From: support Date: Wed, 6 Apr 2022 15:34:51 +0000 (+0000) Subject: Built motion from commit 5ae82ce5.|2.6.7 X-Git-Url: http://repos.xcallymotion.com/base//%22https:/fonts.googleapis.com/icon?a=commitdiff_plain;h=f242ecb854a6947e0a7e56ef417cb887d09ab219;p=motion2.git Built motion from commit 5ae82ce5.|2.6.7 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index cc2a70f..9637fd0 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-04-06T14:06:53.454Z", + "time": "2022-04-06T15:27:39.084Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index cb436eb..19176dc 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-06T14:06:53.454Z", + "time": "2022-04-06T15:27:39.084Z", "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 5f85305..f5a511d 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 _0x7522=['action','STRING','contactManager','integration','motionbar','jscripty','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','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]','TEXT','urlForward[body]','sequelize','exports','getDataValue'];(function(_0x13e36a,_0x57de74){var _0x5c9f65=function(_0x9f33f3){while(--_0x9f33f3){_0x13e36a['push'](_0x13e36a['shift']());}};_0x5c9f65(++_0x57de74);}(_0x7522,0x12f));var _0x2752=function(_0x576dd3,_0x5a22fa){_0x576dd3=_0x576dd3-0x0;var _0x52a931=_0x7522[_0x576dd3];return _0x52a931;};'use strict';var Sequelize=require(_0x2752('0x0'));module[_0x2752('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x9c6fb1){return this[_0x2752('0x2')](_0x2752('0x3'));}},'action':{'type':Sequelize[_0x2752('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x2752('0x5'),_0x2752('0x6'),_0x2752('0x7'),_0x2752('0x8'),'urlForward',_0x2752('0x9'),'bot',_0x2752('0xa')]],'msg':_0x2752('0xb')}},'comment':_0x2752('0xb')},'data1':{'type':Sequelize[_0x2752('0x4')](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[_0x2752('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x2752('0x4')](0x1000),'comment':_0x2752('0xc')},'data4':{'type':Sequelize[_0x2752('0x4')](0x1000),'comments':_0x2752('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x2752('0xe')},'data6':{'type':Sequelize[_0x2752('0x4')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x2752('0xf')],'comments':_0x2752('0x10')}}; \ No newline at end of file +var _0xa1f7=['jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x158da6,_0x3cb06d){var _0x429c30=function(_0x2d5895){while(--_0x2d5895){_0x158da6['push'](_0x158da6['shift']());}};_0x429c30(++_0x3cb06d);}(_0xa1f7,0xda));var _0x7a1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa1f7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7a1f('0x0'));module['exports']={'name':{'type':Sequelize[_0x7a1f('0x1')],'get':function(_0x3ab9f1){return this[_0x7a1f('0x2')]('action');}},'action':{'type':Sequelize[_0x7a1f('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x7a1f('0x4'),_0x7a1f('0x5'),_0x7a1f('0x6'),_0x7a1f('0x7'),_0x7a1f('0x8'),_0x7a1f('0x9'),_0x7a1f('0xa'),_0x7a1f('0xb')]],'msg':_0x7a1f('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x7a1f('0x3')](0x1000),'comment':_0x7a1f('0xd')},'data2':{'type':Sequelize[_0x7a1f('0x3')](0x1000),'comment':_0x7a1f('0xe')},'data3':{'type':Sequelize[_0x7a1f('0x3')](0x1000),'comment':_0x7a1f('0xf')},'data4':{'type':Sequelize[_0x7a1f('0x3')](0x1000),'comments':_0x7a1f('0x10')},'data5':{'type':Sequelize[_0x7a1f('0x3')](0x1000),'comments':_0x7a1f('0x11')},'data6':{'type':Sequelize[_0x7a1f('0x3')],'comments':_0x7a1f('0x12')},'data7':{'type':Sequelize[_0x7a1f('0x13')],'comments':_0x7a1f('0x14')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 49c7a21..86f0d2e 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 _0x1a7c=['then','destroy','sendStatus','error','stack','name','body','Action','find','params','catch','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update'];(function(_0x451c84,_0xc44ca){var _0x404605=function(_0x3c04c1){while(--_0x3c04c1){_0x451c84['push'](_0x451c84['shift']());}};_0x404605(++_0xc44ca);}(_0x1a7c,0x95));var _0xc1a7=function(_0x54b0f3,_0x1fe2f7){_0x54b0f3=_0x54b0f3-0x0;var _0x5ae957=_0x1a7c[_0x54b0f3];return _0x5ae957;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1a7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1a7('0x1'));var rp=require(_0xc1a7('0x2'));var moment=require('moment');var BPromise=require(_0xc1a7('0x3'));var Mustache=require(_0xc1a7('0x4'));var util=require('util');var path=require(_0xc1a7('0x5'));var sox=require(_0xc1a7('0x6'));var csv=require(_0xc1a7('0x7'));var ejs=require(_0xc1a7('0x8'));var fs=require('fs');var fs_extra=require(_0xc1a7('0x9'));var _=require('lodash');var squel=require(_0xc1a7('0xa'));var crypto=require(_0xc1a7('0xb'));var jsforce=require(_0xc1a7('0xc'));var deskjs=require(_0xc1a7('0xd'));var toCsv=require(_0xc1a7('0x7'));var querystring=require(_0xc1a7('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc1a7('0xf'));var qs=require(_0xc1a7('0x10'));var as=require(_0xc1a7('0x11'));var hardwareService=require(_0xc1a7('0x12'));var logger=require(_0xc1a7('0x13'))(_0xc1a7('0x14'));var utils=require(_0xc1a7('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc1a7('0x16'))['db'];function respondWithStatusCode(_0x5e5176,_0x4c2f07){_0x4c2f07=_0x4c2f07||0xcc;return function(_0x2a4818){if(_0x2a4818){return _0x5e5176['sendStatus'](_0x4c2f07);}return _0x5e5176[_0xc1a7('0x17')](_0x4c2f07)[_0xc1a7('0x18')]();};}function respondWithResult(_0xee03b1,_0x2b56a1){_0x2b56a1=_0x2b56a1||0xc8;return function(_0x3612ba){if(_0x3612ba){return _0xee03b1['status'](_0x2b56a1)['json'](_0x3612ba);}};}function respondWithFilteredResult(_0x522b6a,_0x36e0fe){return function(_0x4e19d1){if(_0x4e19d1){var _0x3ccec3=typeof _0x36e0fe[_0xc1a7('0x19')]===_0xc1a7('0x1a')&&typeof _0x36e0fe[_0xc1a7('0x1b')]===_0xc1a7('0x1a');var _0x3bbaf9=_0x4e19d1[_0xc1a7('0x1c')];var _0x4f403f=_0x3ccec3?0x0:_0x36e0fe[_0xc1a7('0x19')];var _0x52a463=_0x3ccec3?_0x4e19d1[_0xc1a7('0x1c')]:_0x36e0fe['offset']+_0x36e0fe[_0xc1a7('0x1b')];var _0x3105c8;if(_0x52a463>=_0x3bbaf9){_0x52a463=_0x3bbaf9;_0x3105c8=0xc8;}else{_0x3105c8=0xce;}_0x522b6a[_0xc1a7('0x17')](_0x3105c8);return _0x522b6a['set'](_0xc1a7('0x1d'),_0x4f403f+'-'+_0x52a463+'/'+_0x3bbaf9)[_0xc1a7('0x1e')](_0x4e19d1);}return null;};}function patchUpdates(_0x41fae9){return function(_0x3f5cf7){try{jsonpatch[_0xc1a7('0x1f')](_0x3f5cf7,_0x41fae9,!![]);}catch(_0x3abcb9){return BPromise[_0xc1a7('0x20')](_0x3abcb9);}return _0x3f5cf7[_0xc1a7('0x21')]();};}function saveUpdates(_0x274dcb,_0x438985){return function(_0x16aa44){if(_0x16aa44){return _0x16aa44[_0xc1a7('0x22')](_0x274dcb)[_0xc1a7('0x23')](function(_0x27d3fd){return _0x27d3fd;});}return null;};}function removeEntity(_0x135b5e,_0x21a254){return function(_0x9f1553){if(_0x9f1553){return _0x9f1553[_0xc1a7('0x24')]()[_0xc1a7('0x23')](function(){_0x135b5e[_0xc1a7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9eeef6,_0x21fc6a){return function(_0x56eabd){if(!_0x56eabd){_0x9eeef6[_0xc1a7('0x25')](0x194);}return _0x56eabd;};}function handleError(_0x13ccce,_0x1650f0){_0x1650f0=_0x1650f0||0x1f4;return function(_0x2a3034){logger[_0xc1a7('0x26')](_0x2a3034[_0xc1a7('0x27')]);if(_0x2a3034[_0xc1a7('0x28')]){delete _0x2a3034[_0xc1a7('0x28')];}_0x13ccce[_0xc1a7('0x17')](_0x1650f0)['send'](_0x2a3034);};}exports[_0xc1a7('0x22')]=function(_0x303ab8,_0x74348d){if(_0x303ab8[_0xc1a7('0x29')]['id']){delete _0x303ab8[_0xc1a7('0x29')]['id'];}return db[_0xc1a7('0x2a')][_0xc1a7('0x2b')]({'where':{'id':_0x303ab8[_0xc1a7('0x2c')]['id']}})[_0xc1a7('0x23')](handleEntityNotFound(_0x74348d,null))[_0xc1a7('0x23')](saveUpdates(_0x303ab8[_0xc1a7('0x29')],null))['then'](respondWithResult(_0x74348d,null))[_0xc1a7('0x2d')](handleError(_0x74348d,null));};exports[_0xc1a7('0x24')]=function(_0x4bf991,_0x51dcb9){return db[_0xc1a7('0x2a')]['find']({'where':{'id':_0x4bf991[_0xc1a7('0x2c')]['id']}})[_0xc1a7('0x23')](handleEntityNotFound(_0x51dcb9,null))[_0xc1a7('0x23')](removeEntity(_0x51dcb9,null))[_0xc1a7('0x2d')](handleError(_0x51dcb9,null));}; \ No newline at end of file +var _0xec73=['count','set','apply','save','destroy','then','name','send','update','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','limit'];(function(_0x1e1cde,_0xb27095){var _0x2f5aa8=function(_0x26a804){while(--_0x26a804){_0x1e1cde['push'](_0x1e1cde['shift']());}};_0x2f5aa8(++_0xb27095);}(_0xec73,0x11f));var _0x3ec7=function(_0x1b2fad,_0x1e85ec){_0x1b2fad=_0x1b2fad-0x0;var _0x325176=_0xec73[_0x1b2fad];return _0x325176;};'use strict';var emlformat=require(_0x3ec7('0x0'));var rimraf=require(_0x3ec7('0x1'));var zipdir=require(_0x3ec7('0x2'));var jsonpatch=require(_0x3ec7('0x3'));var rp=require('request-promise');var moment=require(_0x3ec7('0x4'));var BPromise=require(_0x3ec7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3ec7('0x6'));var csv=require(_0x3ec7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ec7('0x8'));var _=require(_0x3ec7('0x9'));var squel=require(_0x3ec7('0xa'));var crypto=require(_0x3ec7('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3ec7('0x7'));var querystring=require(_0x3ec7('0xc'));var Papa=require(_0x3ec7('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3ec7('0xe'));var as=require(_0x3ec7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ec7('0x10'))(_0x3ec7('0x11'));var utils=require(_0x3ec7('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x3ec7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f2c5b,_0x2f23ae){_0x2f23ae=_0x2f23ae||0xcc;return function(_0x9c173d){if(_0x9c173d){return _0x4f2c5b[_0x3ec7('0x14')](_0x2f23ae);}return _0x4f2c5b[_0x3ec7('0x15')](_0x2f23ae)['end']();};}function respondWithResult(_0x2d4895,_0x710943){_0x710943=_0x710943||0xc8;return function(_0x3fc3d8){if(_0x3fc3d8){return _0x2d4895['status'](_0x710943)['json'](_0x3fc3d8);}};}function respondWithFilteredResult(_0x1190c8,_0x6688ca){return function(_0x13f5e4){if(_0x13f5e4){var _0x1564e8=typeof _0x6688ca[_0x3ec7('0x16')]===_0x3ec7('0x17')&&typeof _0x6688ca[_0x3ec7('0x18')]===_0x3ec7('0x17');var _0x2ba19c=_0x13f5e4[_0x3ec7('0x19')];var _0x49433c=_0x1564e8?0x0:_0x6688ca[_0x3ec7('0x16')];var _0x20518a=_0x1564e8?_0x13f5e4[_0x3ec7('0x19')]:_0x6688ca[_0x3ec7('0x16')]+_0x6688ca[_0x3ec7('0x18')];var _0x3cea7e;if(_0x20518a>=_0x2ba19c){_0x20518a=_0x2ba19c;_0x3cea7e=0xc8;}else{_0x3cea7e=0xce;}_0x1190c8[_0x3ec7('0x15')](_0x3cea7e);return _0x1190c8[_0x3ec7('0x1a')]('Content-Range',_0x49433c+'-'+_0x20518a+'/'+_0x2ba19c)['json'](_0x13f5e4);}return null;};}function patchUpdates(_0x3a0319){return function(_0x4852f8){try{jsonpatch[_0x3ec7('0x1b')](_0x4852f8,_0x3a0319,!![]);}catch(_0x3cbcf1){return BPromise['reject'](_0x3cbcf1);}return _0x4852f8[_0x3ec7('0x1c')]();};}function saveUpdates(_0x3b11e9,_0x3597fd){return function(_0x24dcb5){if(_0x24dcb5){return _0x24dcb5['update'](_0x3b11e9)['then'](function(_0x862de8){return _0x862de8;});}return null;};}function removeEntity(_0x16ecb6,_0x31b103){return function(_0xeb658a){if(_0xeb658a){return _0xeb658a[_0x3ec7('0x1d')]()[_0x3ec7('0x1e')](function(){_0x16ecb6[_0x3ec7('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18d66a,_0x4738c3){return function(_0x338f52){if(!_0x338f52){_0x18d66a['sendStatus'](0x194);}return _0x338f52;};}function handleError(_0x35bf8e,_0x434322){_0x434322=_0x434322||0x1f4;return function(_0x163cb6){logger['error'](_0x163cb6['stack']);if(_0x163cb6[_0x3ec7('0x1f')]){delete _0x163cb6[_0x3ec7('0x1f')];}_0x35bf8e[_0x3ec7('0x15')](_0x434322)[_0x3ec7('0x20')](_0x163cb6);};}exports[_0x3ec7('0x21')]=function(_0x46745f,_0x2c19ff){if(_0x46745f[_0x3ec7('0x22')]['id']){delete _0x46745f['body']['id'];}return db[_0x3ec7('0x23')][_0x3ec7('0x24')]({'where':{'id':_0x46745f[_0x3ec7('0x25')]['id']}})[_0x3ec7('0x1e')](handleEntityNotFound(_0x2c19ff,null))['then'](saveUpdates(_0x46745f['body'],null))['then'](respondWithResult(_0x2c19ff,null))[_0x3ec7('0x26')](handleError(_0x2c19ff,null));};exports['destroy']=function(_0x5b6bb9,_0x3f38fd){return db[_0x3ec7('0x23')][_0x3ec7('0x24')]({'where':{'id':_0x5b6bb9[_0x3ec7('0x25')]['id']}})[_0x3ec7('0x1e')](handleEntityNotFound(_0x3f38fd,null))[_0x3ec7('0x1e')](removeEntity(_0x3f38fd,null))[_0x3ec7('0x26')](handleError(_0x3f38fd,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 3f4c53e..9379ee1 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 _0x8c3c=['./action.attributes','Action','tools_actions','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4db483,_0x5293a9){var _0x401534=function(_0x15d072){while(--_0x15d072){_0x4db483['push'](_0x4db483['shift']());}};_0x401534(++_0x5293a9);}(_0x8c3c,0x142));var _0xc8c3=function(_0x2fa132,_0x14ab75){_0x2fa132=_0x2fa132-0x0;var _0x411d53=_0x8c3c[_0x2fa132];return _0x411d53;};'use strict';var _=require(_0xc8c3('0x0'));var util=require(_0xc8c3('0x1'));var logger=require(_0xc8c3('0x2'))(_0xc8c3('0x3'));var moment=require('moment');var BPromise=require(_0xc8c3('0x4'));var rp=require(_0xc8c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8c3('0x6'));var config=require(_0xc8c3('0x7'));var attributes=require(_0xc8c3('0x8'));module['exports']=function(_0x8a8f82,_0x1a4adb){return _0x8a8f82['define'](_0xc8c3('0x9'),attributes,{'tableName':_0xc8c3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff24=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./action.attributes','exports','define','Action','tools_actions'];(function(_0x3c7784,_0x19115b){var _0x332e8e=function(_0x32b782){while(--_0x32b782){_0x3c7784['push'](_0x3c7784['shift']());}};_0x332e8e(++_0x19115b);}(_0xff24,0x82));var _0x4ff2=function(_0x3a1452,_0x5ba3a4){_0x3a1452=_0x3a1452-0x0;var _0x2a8fc5=_0xff24[_0x3a1452];return _0x2a8fc5;};'use strict';var _=require(_0x4ff2('0x0'));var util=require('util');var logger=require(_0x4ff2('0x1'))(_0x4ff2('0x2'));var moment=require(_0x4ff2('0x3'));var BPromise=require(_0x4ff2('0x4'));var rp=require(_0x4ff2('0x5'));var fs=require('fs');var path=require(_0x4ff2('0x6'));var rimraf=require('rimraf');var config=require(_0x4ff2('0x7'));var attributes=require(_0x4ff2('0x8'));module[_0x4ff2('0x9')]=function(_0x5d7fcc,_0x36a23a){return _0x5d7fcc[_0x4ff2('0xa')](_0x4ff2('0xb'),attributes,{'tableName':_0x4ff2('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 0a2e931..3be11ae 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x5e1914,_0x1313a3){var _0x4fb013=function(_0x31be59){while(--_0x31be59){_0x5e1914['push'](_0x5e1914['shift']());}};_0x4fb013(++_0x1313a3);}(_0xe14b,0x93));var _0xbe14=function(_0x20b807,_0x35fa4a){_0x20b807=_0x20b807-0x0;var _0x147302=_0xe14b[_0x20b807];return _0x147302;};'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 _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2817ca,_0x168a1a){_0x2817ca=_0x2817ca-0x0;var _0x343ee3=_0x1cb9[_0x2817ca];return _0x343ee3;};'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')]('Action,\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);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index e429b36..ef5f101 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 _0x9434=['isAuthenticated','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./action.controller'];(function(_0x53e137,_0x4cfdcd){var _0x39ae2e=function(_0x25a0ed){while(--_0x25a0ed){_0x53e137['push'](_0x53e137['shift']());}};_0x39ae2e(++_0x4cfdcd);}(_0x9434,0x71));var _0x4943=function(_0x430e88,_0x1eabcb){_0x430e88=_0x430e88-0x0;var _0x5616e0=_0x9434[_0x430e88];return _0x5616e0;};'use strict';var multer=require(_0x4943('0x0'));var util=require(_0x4943('0x1'));var path=require('path');var timeout=require(_0x4943('0x2'));var express=require(_0x4943('0x3'));var router=express[_0x4943('0x4')]();var fs_extra=require(_0x4943('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4943('0x6'));var config=require('../../config/environment');var controller=require(_0x4943('0x7'));router['put']('/:id',auth[_0x4943('0x8')](),controller[_0x4943('0x9')]);router[_0x4943('0xa')]('/:id',auth[_0x4943('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa6b7=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated'];(function(_0x135365,_0x5ce7bf){var _0x3cdc77=function(_0x589ebe){while(--_0x589ebe){_0x135365['push'](_0x135365['shift']());}};_0x3cdc77(++_0x5ce7bf);}(_0xa6b7,0x184));var _0x7a6b=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0xa6b7[_0xabfec4];return _0x7bafa2;};'use strict';var multer=require(_0x7a6b('0x0'));var util=require(_0x7a6b('0x1'));var path=require(_0x7a6b('0x2'));var timeout=require(_0x7a6b('0x3'));var express=require('express');var router=express[_0x7a6b('0x4')]();var fs_extra=require(_0x7a6b('0x5'));var auth=require(_0x7a6b('0x6'));var interaction=require(_0x7a6b('0x7'));var config=require('../../config/environment');var controller=require(_0x7a6b('0x8'));router[_0x7a6b('0x9')](_0x7a6b('0xa'),auth[_0x7a6b('0xb')](),controller[_0x7a6b('0xc')]);router[_0x7a6b('0xd')](_0x7a6b('0xa'),auth['isAuthenticated'](),controller[_0x7a6b('0xe')]);module[_0x7a6b('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 6aade28..c4a65c2 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 _0xb138=['TEXT','sequelize','exports','STRING'];(function(_0x4da133,_0x3f7748){var _0xf1969e=function(_0x46055e){while(--_0x46055e){_0x4da133['push'](_0x4da133['shift']());}};_0xf1969e(++_0x3f7748);}(_0xb138,0x1dd));var _0x8b13=function(_0x37f2d6,_0x2aa0ca){_0x37f2d6=_0x37f2d6-0x0;var _0x2b3d86=_0xb138[_0x37f2d6];return _0x2b3d86;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'name':{'type':Sequelize[_0x8b13('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8b13('0x2')]},'parent':{'type':Sequelize[_0x8b13('0x2')]},'table':{'type':Sequelize[_0x8b13('0x2')]},'conditions':{'type':Sequelize[_0x8b13('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x46ed,0x168));var _0xd46e=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x46ed[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 4ee8136..97fff75 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 _0x7cbd=['generate','csv','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','savename','COUNT(*)','SELECT','run','runReport','AVG(%s)','groupBy','Limited\x20Query:','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','function','format','replace','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','sequelize','toString','QueryTypes','right_join','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','keyBy','MetricId','metric','output','web','%s-%s.%s','randomstring'];(function(_0x5b1aed,_0x322c17){var _0x26add8=function(_0x58a9d7){while(--_0x58a9d7){_0x5b1aed['push'](_0x5b1aed['shift']());}};_0x26add8(++_0x322c17);}(_0x7cbd,0xb9));var _0xd7cb=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x7cbd[_0x173d7e];return _0x2220d6;};'use strict';var emlformat=require(_0xd7cb('0x0'));var rimraf=require(_0xd7cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd7cb('0x2'));var moment=require(_0xd7cb('0x3'));var BPromise=require(_0xd7cb('0x4'));var Mustache=require('mustache');var util=require(_0xd7cb('0x5'));var path=require(_0xd7cb('0x6'));var sox=require(_0xd7cb('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd7cb('0x8'));var squel=require(_0xd7cb('0x9'));var crypto=require(_0xd7cb('0xa'));var jsforce=require(_0xd7cb('0xb'));var deskjs=require(_0xd7cb('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd7cb('0xd'));var Papa=require(_0xd7cb('0xe'));var Redis=require(_0xd7cb('0xf'));var authService=require(_0xd7cb('0x10'));var qs=require(_0xd7cb('0x11'));var as=require(_0xd7cb('0x12'));var hardwareService=require(_0xd7cb('0x13'));var logger=require(_0xd7cb('0x14'))(_0xd7cb('0x15'));var utils=require(_0xd7cb('0x16'));var config=require(_0xd7cb('0x17'));var licenseUtil=require(_0xd7cb('0x18'));var db=require(_0xd7cb('0x19'))['db'];var dbH=require(_0xd7cb('0x19'))[_0xd7cb('0x1a')];function respondWithStatusCode(_0x166969,_0x243187){_0x243187=_0x243187||0xcc;return function(_0x293af2){if(_0x293af2){return _0x166969[_0xd7cb('0x1b')](_0x243187);}return _0x166969['status'](_0x243187)[_0xd7cb('0x1c')]();};}function respondWithResult(_0x2d86c8,_0x506981){_0x506981=_0x506981||0xc8;return function(_0x308185){if(_0x308185){return _0x2d86c8[_0xd7cb('0x1d')](_0x506981)[_0xd7cb('0x1e')](_0x308185);}};}function respondWithFilteredResult(_0x54b738,_0x34f217){return function(_0x3186a6){if(_0x3186a6){var _0x57af5b=typeof _0x34f217[_0xd7cb('0x1f')]===_0xd7cb('0x20')&&typeof _0x34f217[_0xd7cb('0x21')]==='undefined';var _0x4a026e=_0x3186a6[_0xd7cb('0x22')];var _0x23b582=_0x57af5b?0x0:_0x34f217['offset'];var _0x356327=_0x57af5b?_0x3186a6[_0xd7cb('0x22')]:_0x34f217[_0xd7cb('0x1f')]+_0x34f217['limit'];var _0x55f7f6;if(_0x356327>=_0x4a026e){_0x356327=_0x4a026e;_0x55f7f6=0xc8;}else{_0x55f7f6=0xce;}_0x54b738[_0xd7cb('0x1d')](_0x55f7f6);return _0x54b738[_0xd7cb('0x23')](_0xd7cb('0x24'),_0x23b582+'-'+_0x356327+'/'+_0x4a026e)[_0xd7cb('0x1e')](_0x3186a6);}return null;};}function patchUpdates(_0x1cb0cb){return function(_0x31b994){try{jsonpatch[_0xd7cb('0x25')](_0x31b994,_0x1cb0cb,!![]);}catch(_0x2a4e9f){return BPromise['reject'](_0x2a4e9f);}return _0x31b994[_0xd7cb('0x26')]();};}function saveUpdates(_0x4ac38c,_0x340817){return function(_0x3f2edf){if(_0x3f2edf){return _0x3f2edf[_0xd7cb('0x27')](_0x4ac38c)[_0xd7cb('0x28')](function(_0x255025){return _0x255025;});}return null;};}function removeEntity(_0x5b5c74,_0x200e39){return function(_0xab80a2){if(_0xab80a2){return _0xab80a2[_0xd7cb('0x29')]()[_0xd7cb('0x28')](function(){var _0x536d2d=_0xab80a2[_0xd7cb('0x2a')]({'plain':!![]});var _0x59e491=_0xd7cb('0x2b');return db[_0xd7cb('0x2c')][_0xd7cb('0x29')]({'where':{'type':_0x59e491,'resourceId':_0x536d2d['id']}})[_0xd7cb('0x28')](function(){return _0xab80a2;});})[_0xd7cb('0x28')](function(){_0x5b5c74['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x589eba,_0x4a7ae2){return function(_0x18cf55){if(!_0x18cf55){_0x589eba['sendStatus'](0x194);}return _0x18cf55;};}function handleError(_0x21a6f3,_0x49cbad){_0x49cbad=_0x49cbad||0x1f4;return function(_0x105787){logger[_0xd7cb('0x2d')](_0x105787[_0xd7cb('0x2e')]);if(_0x105787[_0xd7cb('0x2f')]){delete _0x105787[_0xd7cb('0x2f')];}_0x21a6f3[_0xd7cb('0x1d')](_0x49cbad)[_0xd7cb('0x30')](_0x105787);};}exports[_0xd7cb('0x31')]=function(_0x568833,_0x2ad5ab){var _0x2c9251={},_0x9cf5ed={},_0x13e90b={'count':0x0,'rows':[]};var _0x32bff5=_['map'](db[_0xd7cb('0x32')][_0xd7cb('0x33')],function(_0x120413){return{'name':_0x120413[_0xd7cb('0x34')],'type':_0x120413[_0xd7cb('0x35')][_0xd7cb('0x36')]};});_0x9cf5ed[_0xd7cb('0x37')]=_[_0xd7cb('0x38')](_0x32bff5,'name');_0x9cf5ed[_0xd7cb('0x39')]=_[_0xd7cb('0x3a')](_0x568833[_0xd7cb('0x39')]);_0x9cf5ed[_0xd7cb('0x3b')]=_[_0xd7cb('0x3c')](_0x9cf5ed[_0xd7cb('0x37')],_0x9cf5ed['query']);_0x2c9251['attributes']=_[_0xd7cb('0x3c')](_0x9cf5ed['model'],qs[_0xd7cb('0x3d')](_0x568833[_0xd7cb('0x39')]['fields']));_0x2c9251['attributes']=_0x2c9251['attributes']['length']?_0x2c9251[_0xd7cb('0x3e')]:_0x9cf5ed['model'];if(!_0x568833[_0xd7cb('0x39')][_0xd7cb('0x3f')](_0xd7cb('0x40'))){_0x2c9251['limit']=qs[_0xd7cb('0x21')](_0x568833[_0xd7cb('0x39')][_0xd7cb('0x21')]);_0x2c9251[_0xd7cb('0x1f')]=qs[_0xd7cb('0x1f')](_0x568833[_0xd7cb('0x39')][_0xd7cb('0x1f')]);}_0x2c9251[_0xd7cb('0x41')]=qs['sort'](_0x568833[_0xd7cb('0x39')][_0xd7cb('0x42')]);_0x2c9251[_0xd7cb('0x43')]=qs[_0xd7cb('0x3b')](_[_0xd7cb('0x44')](_0x568833[_0xd7cb('0x39')],_0x9cf5ed[_0xd7cb('0x3b')]),_0x32bff5);if(_0x568833[_0xd7cb('0x39')]['filter']){_0x2c9251['where']=_[_0xd7cb('0x45')](_0x2c9251[_0xd7cb('0x43')],{'$or':_['map'](_0x32bff5,function(_0xd9adaa){if(_0xd9adaa[_0xd7cb('0x35')]!==_0xd7cb('0x46')){var _0x30d665={};_0x30d665[_0xd9adaa['name']]={'$like':'%'+_0x568833[_0xd7cb('0x39')]['filter']+'%'};return _0x30d665;}})});}_0x2c9251=_['merge']({},_0x2c9251,_0x568833[_0xd7cb('0x47')]);var _0x4d7e7e={'where':_0x2c9251[_0xd7cb('0x43')]};return db[_0xd7cb('0x32')][_0xd7cb('0x22')](_0x4d7e7e)['then'](function(_0x232575){_0x13e90b[_0xd7cb('0x22')]=_0x232575;if(_0x568833['query'][_0xd7cb('0x48')]){_0x2c9251[_0xd7cb('0x49')]=[{'all':!![]}];}return db[_0xd7cb('0x32')][_0xd7cb('0x4a')](_0x2c9251);})['then'](function(_0x2631ca){_0x13e90b[_0xd7cb('0x4b')]=_0x2631ca;return _0x13e90b;})[_0xd7cb('0x28')](respondWithFilteredResult(_0x2ad5ab,_0x2c9251))[_0xd7cb('0x4c')](handleError(_0x2ad5ab,null));};exports[_0xd7cb('0x4d')]=function(_0x2df494,_0x44718b){var _0x20250e={'raw':![],'where':{'id':_0x2df494[_0xd7cb('0x4e')]['id']}},_0x5bb271={};_0x5bb271[_0xd7cb('0x37')]=_['keys'](db[_0xd7cb('0x32')][_0xd7cb('0x33')]);_0x5bb271[_0xd7cb('0x39')]=_[_0xd7cb('0x3a')](_0x2df494[_0xd7cb('0x39')]);_0x5bb271['filters']=_[_0xd7cb('0x3c')](_0x5bb271[_0xd7cb('0x37')],_0x5bb271[_0xd7cb('0x39')]);_0x20250e[_0xd7cb('0x3e')]=_[_0xd7cb('0x3c')](_0x5bb271['model'],qs[_0xd7cb('0x3d')](_0x2df494[_0xd7cb('0x39')][_0xd7cb('0x3d')]));_0x20250e[_0xd7cb('0x3e')]=_0x20250e[_0xd7cb('0x3e')][_0xd7cb('0x4f')]?_0x20250e['attributes']:_0x5bb271[_0xd7cb('0x37')];if(_0x2df494[_0xd7cb('0x39')]['includeAll']){_0x20250e[_0xd7cb('0x49')]=[{'all':!![]}];}_0x20250e=_['merge']({},_0x20250e,_0x2df494['options']);return db[_0xd7cb('0x32')][_0xd7cb('0x50')](_0x20250e)[_0xd7cb('0x28')](handleEntityNotFound(_0x44718b,null))[_0xd7cb('0x28')](respondWithResult(_0x44718b,null))[_0xd7cb('0x4c')](handleError(_0x44718b,null));};exports[_0xd7cb('0x51')]=function(_0x50fbdd,_0x28e6ca){return db[_0xd7cb('0x32')][_0xd7cb('0x51')](_0x50fbdd[_0xd7cb('0x52')],{})[_0xd7cb('0x28')](function(_0x264f3d){var _0x56044c=_0x50fbdd[_0xd7cb('0x53')]['get']({'plain':!![]});if(!_0x56044c)throw new Error(_0xd7cb('0x54'));if(_0x56044c[_0xd7cb('0x55')]===_0xd7cb('0x53')){var _0x1375b9=_0x264f3d[_0xd7cb('0x2a')]({'plain':!![]});var _0x3df897=_0xd7cb('0x56');return db['UserProfileSection']['find']({'where':{'name':_0x3df897,'userProfileId':_0x56044c[_0xd7cb('0x57')]},'raw':!![]})[_0xd7cb('0x28')](function(_0x6f0d9f){if(_0x6f0d9f&&_0x6f0d9f[_0xd7cb('0x58')]===0x0){return db[_0xd7cb('0x2c')][_0xd7cb('0x51')]({'name':_0x1375b9[_0xd7cb('0x2f')],'resourceId':_0x1375b9['id'],'type':_0xd7cb('0x2b'),'sectionId':_0x6f0d9f['id']},{})[_0xd7cb('0x28')](function(){return _0x264f3d;});}else{return _0x264f3d;}})[_0xd7cb('0x4c')](function(_0x1ecfc2){logger[_0xd7cb('0x2d')](_0xd7cb('0x59'),_0x1ecfc2);throw _0x1ecfc2;});}return _0x264f3d;})[_0xd7cb('0x28')](respondWithResult(_0x28e6ca,0xc9))['catch'](handleError(_0x28e6ca,null));};exports[_0xd7cb('0x27')]=function(_0x161542,_0x4c1c98){if(_0x161542['body']['id']){delete _0x161542[_0xd7cb('0x52')]['id'];}return db[_0xd7cb('0x32')][_0xd7cb('0x50')]({'where':{'id':_0x161542['params']['id']}})[_0xd7cb('0x28')](handleEntityNotFound(_0x4c1c98,null))[_0xd7cb('0x28')](saveUpdates(_0x161542[_0xd7cb('0x52')],null))[_0xd7cb('0x28')](respondWithResult(_0x4c1c98,null))['catch'](handleError(_0x4c1c98,null));};exports['destroy']=function(_0x575953,_0x40873b){return db[_0xd7cb('0x32')][_0xd7cb('0x50')]({'where':{'id':_0x575953[_0xd7cb('0x4e')]['id']}})[_0xd7cb('0x28')](handleEntityNotFound(_0x40873b,null))[_0xd7cb('0x28')](removeEntity(_0x40873b,null))['catch'](handleError(_0x40873b,null));};exports[_0xd7cb('0x5a')]=function(_0x46d01d,_0xc5ef31){var _0x1720e3=0xa;var _0x539f4c=[_0xd7cb('0x5b'),_0xd7cb('0x5c'),'right_join',_0xd7cb('0x5d')];var _0x241b38={'SUM':'SUM(%s)','COUNT':_0xd7cb('0x5e'),'COUNT DISTINCT':_0xd7cb('0x5f'),'MAX':_0xd7cb('0x60'),'MIN':_0xd7cb('0x61'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd7cb('0x62'),'GROUP_CONCAT ASC':_0xd7cb('0x63'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3ffb79={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd7cb('0x64'),'HOUR':_0xd7cb('0x65'),'ROUND':_0xd7cb('0x66'),'UNIX_TIMESTAMP':_0xd7cb('0x67')};var _0xd91467=function(_0x29ee06){return!_[_0xd7cb('0x68')]([_0xd7cb('0x69'),_0xd7cb('0x6a'),_0xd7cb('0x6b'),_0xd7cb('0x6c')],_0x29ee06);};var _0x13d0a0=function(_0x56d03f){if(!_0x56d03f||!_0x56d03f['rules'][_0xd7cb('0x4f')]){return'';}for(var _0x4b2bf5='(',_0x52ffe6=0x0;_0x52ffe6<_0x56d03f['rules'][_0xd7cb('0x4f')];_0x52ffe6+=0x1){_0x52ffe6>0x0&&(_0x4b2bf5+='\x20'+_0x56d03f[_0xd7cb('0x6d')]+'\x20');_0x4b2bf5+=_0x56d03f[_0xd7cb('0x6e')][_0x52ffe6][_0xd7cb('0x6f')]?_0x13d0a0(_0x56d03f[_0xd7cb('0x6e')][_0x52ffe6]['group']):_0x56d03f[_0xd7cb('0x6e')][_0x52ffe6][_0xd7cb('0x70')]+'\x20'+_0x56d03f[_0xd7cb('0x6e')][_0x52ffe6][_0xd7cb('0x71')]+(_0xd91467(_0x56d03f[_0xd7cb('0x6e')][_0x52ffe6][_0xd7cb('0x71')])?'\x20'+_0x56d03f[_0xd7cb('0x6e')][_0x52ffe6][_0xd7cb('0x72')]:'');}return _0x4b2bf5+')';};var _0x231b50={'where':{'id':_0x46d01d[_0xd7cb('0x4e')]['id']}},_0x256302,_0x45a8c8,_0x3da9ba,_0x589685,_0x2ae544;_0x231b50=_[_0xd7cb('0x45')]({},_0x231b50,_0x46d01d[_0xd7cb('0x47')]);return db[_0xd7cb('0x32')][_0xd7cb('0x50')](_0x231b50)['then'](function(_0x27b4b2){if(_0x27b4b2){_0x256302=_0x27b4b2;return _0x27b4b2[_0xd7cb('0x73')]();}return null;})[_0xd7cb('0x28')](function(_0x12f9f1){if(_0x12f9f1){if(!_0x12f9f1[_0xd7cb('0x4f')]){throw new db[(_0xd7cb('0x74'))][(_0xd7cb('0x75'))](_0xd7cb('0x76'),0x193);}_0x45a8c8=_0x12f9f1;return db[_0xd7cb('0x77')][_0xd7cb('0x4a')]({'raw':!![]});}return null;})['then'](function(_0x10b602){if(_0x10b602){_0x3da9ba=_['keyBy'](_0x10b602,'id');var _0x30d36d;var _0x3b7c12=squel[_0xd7cb('0x78')]();_0x3b7c12[_0xd7cb('0x79')](_0x256302[_0xd7cb('0x7a')]);for(var _0x235dfa=0x0;_0x235dfa<_0x45a8c8['length'];_0x235dfa+=0x1){_0x30d36d=_0x45a8c8[_0x235dfa]['MetricId']?_0x3da9ba[_0x45a8c8[_0x235dfa]['MetricId']]['metric']:_0x45a8c8[_0x235dfa][_0xd7cb('0x70')];_0x30d36d=_0x45a8c8[_0x235dfa][_0xd7cb('0x7b')]?_['replace'](_0x241b38[_0x45a8c8[_0x235dfa][_0xd7cb('0x7b')]],'%s',_0x30d36d):_0x30d36d;_0x30d36d=_0x45a8c8[_0x235dfa][_0xd7cb('0x7c')]?_[_0xd7cb('0x7d')](_0x3ffb79[_0x45a8c8[_0x235dfa][_0xd7cb('0x7c')]],'%s',_0x30d36d):_0x30d36d;if(_0x45a8c8[_0x235dfa]['groupBy']){_0x3b7c12['group'](_0x30d36d);}_0x45a8c8[_0x235dfa][_0xd7cb('0x7e')]&&_0x3b7c12['order'](_0x30d36d,_0x45a8c8[_0x235dfa][_0xd7cb('0x7e')]===_0xd7cb('0x7f')?![]:!![]);_0x3b7c12[_0xd7cb('0x70')](_0x30d36d,_0x45a8c8[_0x235dfa][_0xd7cb('0x80')]||_0x30d36d);}if(_0x256302[_0xd7cb('0x81')]){_0x256302[_0xd7cb('0x81')]=JSON[_0xd7cb('0x82')](_0x256302[_0xd7cb('0x81')]);for(var _0x509d52=0x0;_0x509d52<_0x256302[_0xd7cb('0x81')]['length'];_0x509d52+=0x1){if(_0x256302['joins'][_0x509d52][_0xd7cb('0x35')]&&_['includes'](_0x539f4c,_0x256302[_0xd7cb('0x81')][_0x509d52]['type'])&&_0x256302[_0xd7cb('0x81')][_0x509d52][_0xd7cb('0x83')]&&_0x256302['joins'][_0x509d52][_0xd7cb('0x84')]&&_0x256302[_0xd7cb('0x81')][_0x509d52][_0xd7cb('0x85')]){_0x3b7c12[_0x256302[_0xd7cb('0x81')][_0x509d52][_0xd7cb('0x35')]](_0x256302[_0xd7cb('0x81')][_0x509d52][_0xd7cb('0x84')],null,util['format'](_0xd7cb('0x86'),_0x256302[_0xd7cb('0x7a')],_0x256302['joins'][_0x509d52][_0xd7cb('0x83')],_0x256302[_0xd7cb('0x81')][_0x509d52][_0xd7cb('0x84')],_0x256302['joins'][_0x509d52][_0xd7cb('0x85')]));}}}if(_0x256302[_0xd7cb('0x87')]){_0x256302[_0xd7cb('0x87')]=JSON[_0xd7cb('0x82')](_0x256302[_0xd7cb('0x87')]);_0x3b7c12[_0xd7cb('0x43')](_0x13d0a0(_0x256302[_0xd7cb('0x87')][_0xd7cb('0x6f')]));}_0x2ae544=_0x3b7c12[_0xd7cb('0x88')]();_0x3b7c12[_0xd7cb('0x21')](_0x1720e3);_0x3b7c12['offset'](0x0);logger[_0xd7cb('0x89')]('Limited\x20Query:',_0x3b7c12['toString']());return dbH[_0xd7cb('0x8a')][_0xd7cb('0x39')](_0x3b7c12[_0xd7cb('0x8b')](),{'type':dbH['sequelize'][_0xd7cb('0x8c')]['SELECT']});}})['then'](respondWithResult(_0xc5ef31,null))['catch'](handleError(_0xc5ef31,null));};function runReport(_0x51aea9,_0x17fc1f,_0xa3467f){var _0x23f0b7=_0x17fc1f[_0xd7cb('0x2f')];var _0x6aa708=0xa;var _0x18303f=[_0xd7cb('0x5b'),_0xd7cb('0x5c'),_0xd7cb('0x8d'),'cross_join'];var _0xe1fb36={'SUM':_0xd7cb('0x8e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd7cb('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd7cb('0x62'),'GROUP_CONCAT ASC':_0xd7cb('0x63'),'GROUP_CONCAT DESC':_0xd7cb('0x8f')};var _0xb28ed9={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xd7cb('0x65'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4b6c9b=function(_0x421701){return!_[_0xd7cb('0x68')](['IS\x20NULL',_0xd7cb('0x6a'),_0xd7cb('0x6b'),_0xd7cb('0x6c')],_0x421701);};var _0x79fe2e=function(_0x8f0933){if(!_0x8f0933||!_0x8f0933[_0xd7cb('0x6e')]['length']){return'';}for(var _0x29405d='(',_0x165bf1=0x0;_0x165bf1<_0x8f0933['rules'][_0xd7cb('0x4f')];_0x165bf1+=0x1){_0x165bf1>0x0&&(_0x29405d+='\x20'+_0x8f0933[_0xd7cb('0x6d')]+'\x20');_0x29405d+=_0x8f0933[_0xd7cb('0x6e')][_0x165bf1][_0xd7cb('0x6f')]?_0x79fe2e(_0x8f0933[_0xd7cb('0x6e')][_0x165bf1][_0xd7cb('0x6f')]):_0x8f0933[_0xd7cb('0x6e')][_0x165bf1][_0xd7cb('0x70')]+'\x20'+_0x8f0933['rules'][_0x165bf1][_0xd7cb('0x71')]+(_0x4b6c9b(_0x8f0933[_0xd7cb('0x6e')][_0x165bf1]['condition'])?'\x20'+_0x8f0933[_0xd7cb('0x6e')][_0x165bf1]['value']:'');}return _0x29405d+')';};var _0x1845af={'where':{'id':_0x51aea9['id']}},_0x14a00b,_0x2674a0,_0x524756,_0x368940,_0x9dd168;_0x1845af=_[_0xd7cb('0x45')]({},_0x1845af,_0xa3467f);return db['AnalyticCustomReport'][_0xd7cb('0x50')](_0x1845af)['then'](function(_0x17f6eb){if(_0x17f6eb){_0x14a00b=_0x17f6eb;return _0x17f6eb[_0xd7cb('0x73')]();}return null;})[_0xd7cb('0x28')](function(_0xe87b58){if(_0xe87b58){if(!_0xe87b58['length']){throw new db[(_0xd7cb('0x74'))][(_0xd7cb('0x75'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2674a0=_0xe87b58;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd7cb('0x28')](function(_0x513893){if(_0x513893){_0x524756=_[_0xd7cb('0x90')](_0x513893,'id');var _0x1a7cbb;var _0x3a4ace=squel[_0xd7cb('0x78')]();_0x3a4ace[_0xd7cb('0x79')](_0x14a00b[_0xd7cb('0x7a')]);for(var _0x498654=0x0;_0x498654<_0x2674a0[_0xd7cb('0x4f')];_0x498654+=0x1){_0x1a7cbb=_0x2674a0[_0x498654][_0xd7cb('0x91')]?_0x524756[_0x2674a0[_0x498654]['MetricId']][_0xd7cb('0x92')]:_0x2674a0[_0x498654][_0xd7cb('0x70')];_0x1a7cbb=_0x2674a0[_0x498654]['function']?_[_0xd7cb('0x7d')](_0xe1fb36[_0x2674a0[_0x498654][_0xd7cb('0x7b')]],'%s',_0x1a7cbb):_0x1a7cbb;_0x1a7cbb=_0x2674a0[_0x498654]['format']?_[_0xd7cb('0x7d')](_0xb28ed9[_0x2674a0[_0x498654][_0xd7cb('0x7c')]],'%s',_0x1a7cbb):_0x1a7cbb;if(_0x2674a0[_0x498654]['groupBy']){_0x3a4ace['group'](_0x1a7cbb);}_0x2674a0[_0x498654][_0xd7cb('0x7e')]&&_0x3a4ace[_0xd7cb('0x41')](_0x1a7cbb,_0x2674a0[_0x498654][_0xd7cb('0x7e')]===_0xd7cb('0x7f')?![]:!![]);_0x3a4ace[_0xd7cb('0x70')](_0x1a7cbb,_0x2674a0[_0x498654][_0xd7cb('0x80')]||_0x1a7cbb);}if(_0x14a00b[_0xd7cb('0x81')]){_0x14a00b[_0xd7cb('0x81')]=JSON[_0xd7cb('0x82')](_0x14a00b[_0xd7cb('0x81')]);for(var _0x49b382=0x0;_0x49b382<_0x14a00b[_0xd7cb('0x81')][_0xd7cb('0x4f')];_0x49b382+=0x1){if(_0x14a00b[_0xd7cb('0x81')][_0x49b382][_0xd7cb('0x35')]&&_[_0xd7cb('0x68')](_0x18303f,_0x14a00b['joins'][_0x49b382][_0xd7cb('0x35')])&&_0x14a00b[_0xd7cb('0x81')][_0x49b382]['parentKey']&&_0x14a00b[_0xd7cb('0x81')][_0x49b382]['foreignTable']&&_0x14a00b[_0xd7cb('0x81')][_0x49b382][_0xd7cb('0x85')]){_0x3a4ace[_0x14a00b[_0xd7cb('0x81')][_0x49b382][_0xd7cb('0x35')]](_0x14a00b[_0xd7cb('0x81')][_0x49b382][_0xd7cb('0x84')],null,util['format'](_0xd7cb('0x86'),_0x14a00b[_0xd7cb('0x7a')],_0x14a00b[_0xd7cb('0x81')][_0x49b382][_0xd7cb('0x83')],_0x14a00b['joins'][_0x49b382]['foreignTable'],_0x14a00b['joins'][_0x49b382][_0xd7cb('0x85')]));}}}if(_0x14a00b[_0xd7cb('0x87')]){_0x14a00b[_0xd7cb('0x87')]=JSON[_0xd7cb('0x82')](_0x14a00b[_0xd7cb('0x87')]);_0x3a4ace[_0xd7cb('0x43')](_0x79fe2e(_0x14a00b[_0xd7cb('0x87')][_0xd7cb('0x6f')]));}_0x9dd168=_0x3a4ace[_0xd7cb('0x88')]();_0x3a4ace[_0xd7cb('0x21')](_0x6aa708);_0x3a4ace[_0xd7cb('0x1f')](0x0);return;}})[_0xd7cb('0x28')](function(){if(_0x17fc1f[_0xd7cb('0x93')]===_0xd7cb('0x94')){return null;}var _0x38a1ff=_[_0xd7cb('0x45')](_0x17fc1f,{'name':_0x17fc1f['fullPath']||_0x17fc1f[_0xd7cb('0x2f')]||_0x14a00b[_0xd7cb('0x2f')],'basename':_0x23f0b7,'savename':util[_0xd7cb('0x7c')](_0xd7cb('0x95'),_0x17fc1f[_0xd7cb('0x2f')]||_0x14a00b['name'],require(_0xd7cb('0x96'))[_0xd7cb('0x97')](0x4),_0x17fc1f[_0xd7cb('0x93')]||_0xd7cb('0x98')),'reportId':_0x14a00b['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0xd7cb('0x51')](_0x38a1ff,{'raw':!![]});})[_0xd7cb('0x28')](function(_0x31f1cd){if(_0x14a00b[_0xd7cb('0x7a')]===_0xd7cb('0x99')){_0x9dd168['where'](_0x14a00b[_0xd7cb('0x7a')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x17fc1f['startDate'],_0x17fc1f[_0xd7cb('0x9a')]);}else{_0x9dd168[_0xd7cb('0x43')](_0x14a00b[_0xd7cb('0x7a')]+_0xd7cb('0x9b'),_0x17fc1f['startDate'],_0x17fc1f[_0xd7cb('0x9a')]);}if(_0x31f1cd){logger['info'](_0xd7cb('0x9c'),_0x9dd168[_0xd7cb('0x8b')]());require(_0xd7cb('0x9d'))[_0xd7cb('0x9e')](path[_0xd7cb('0x5b')](__dirname,_0xd7cb('0x9f'),_0x31f1cd[_0xd7cb('0x93')]),[_0x31f1cd['id'],_0x9dd168[_0xd7cb('0x8b')](),path[_0xd7cb('0x5b')](__dirname,'../../files/reports',_0x31f1cd[_0xd7cb('0xa0')]),_0x23f0b7]);return _0x31f1cd;}else{var _0x13bea6=squel['select']();_0x13bea6[_0xd7cb('0x79')]('('+_0x9dd168[_0xd7cb('0x8b')]()+')','countTable');_0x13bea6['field'](_0xd7cb('0xa1'),_0xd7cb('0x22'));_0x9dd168['limit'](_0x17fc1f[_0xd7cb('0x21')]||_0x6aa708);_0x9dd168[_0xd7cb('0x1f')](_0x17fc1f[_0xd7cb('0x1f')]||0x0);return dbH['sequelize'][_0xd7cb('0x39')](_0x13bea6['toString'](),{'type':dbH[_0xd7cb('0x8a')][_0xd7cb('0x8c')][_0xd7cb('0xa2')]})[_0xd7cb('0x28')](function(_0x464dd2){if(!_0x464dd2[_0xd7cb('0x4f')]){_0x368940=0x0;}else{_0x368940=_0x464dd2[0x0][_0xd7cb('0x22')]||0x0;}return dbH['sequelize'][_0xd7cb('0x39')](_0x9dd168[_0xd7cb('0x8b')](),{'type':dbH[_0xd7cb('0x8a')][_0xd7cb('0x8c')][_0xd7cb('0xa2')]});})[_0xd7cb('0x28')](function(_0x45f19e){return{'rows':_0x45f19e||[],'count':_0x368940};});}});}exports[_0xd7cb('0xa3')]=function(_0xb76cd0,_0x239193){return runReport(_0xb76cd0[_0xd7cb('0x4e')],_0xb76cd0['query'],_0xb76cd0[_0xd7cb('0x47')])[_0xd7cb('0x28')](respondWithResult(_0x239193,null))['catch'](handleError(_0x239193,null));};exports[_0xd7cb('0xa4')]=runReport;exports[_0xd7cb('0x39')]=function(_0x58a8fa,_0x4303ef){var _0x59e857=0xa;var _0x43c806=[_0xd7cb('0x5b'),_0xd7cb('0x5c'),_0xd7cb('0x8d'),_0xd7cb('0x5d')];var _0x348e34={'SUM':_0xd7cb('0x8e'),'COUNT':_0xd7cb('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xd7cb('0x61'),'AVG':_0xd7cb('0xa5'),'GROUP_CONCAT':_0xd7cb('0x62'),'GROUP_CONCAT ASC':_0xd7cb('0x63'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x11f4ea={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd7cb('0x64'),'HOUR':_0xd7cb('0x65'),'ROUND':_0xd7cb('0x66'),'UNIX_TIMESTAMP':_0xd7cb('0x67')};var _0x21ecc2=function(_0x3c4e6c){return!_[_0xd7cb('0x68')]([_0xd7cb('0x69'),_0xd7cb('0x6a'),_0xd7cb('0x6b'),_0xd7cb('0x6c')],_0x3c4e6c);};var _0x4d8313=function(_0x9cebba){if(!_0x9cebba||!_0x9cebba[_0xd7cb('0x6e')][_0xd7cb('0x4f')]){return'';}for(var _0x4e8919='(',_0x3debdb=0x0;_0x3debdb<_0x9cebba['rules'][_0xd7cb('0x4f')];_0x3debdb+=0x1){_0x3debdb>0x0&&(_0x4e8919+='\x20'+_0x9cebba['operator']+'\x20');_0x4e8919+=_0x9cebba[_0xd7cb('0x6e')][_0x3debdb][_0xd7cb('0x6f')]?_0x4d8313(_0x9cebba['rules'][_0x3debdb]['group']):_0x9cebba[_0xd7cb('0x6e')][_0x3debdb][_0xd7cb('0x70')]+'\x20'+_0x9cebba[_0xd7cb('0x6e')][_0x3debdb][_0xd7cb('0x71')]+(_0x21ecc2(_0x9cebba[_0xd7cb('0x6e')][_0x3debdb]['condition'])?'\x20'+_0x9cebba[_0xd7cb('0x6e')][_0x3debdb][_0xd7cb('0x72')]:'');}return _0x4e8919+')';};var _0x566c78={'where':{'id':_0x58a8fa['params']['id']}},_0x396004,_0x3a0145,_0x184d50,_0x350621,_0x2f9d72;_0x566c78=_[_0xd7cb('0x45')]({},_0x566c78,_0x58a8fa['options']);return db[_0xd7cb('0x32')][_0xd7cb('0x50')](_0x566c78)[_0xd7cb('0x28')](function(_0x525de9){if(_0x525de9){_0x396004=_0x525de9;return _0x525de9[_0xd7cb('0x73')]();}return null;})[_0xd7cb('0x28')](function(_0x5d8eed){if(_0x5d8eed){if(!_0x5d8eed[_0xd7cb('0x4f')]){throw new db[(_0xd7cb('0x74'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3a0145=_0x5d8eed;return db['AnalyticMetric'][_0xd7cb('0x4a')]({'raw':!![]});}return null;})['then'](function(_0x5ad13d){if(_0x5ad13d){_0x184d50=_[_0xd7cb('0x90')](_0x5ad13d,'id');var _0x2235cc;var _0x3a7ccc=squel[_0xd7cb('0x78')]();_0x3a7ccc[_0xd7cb('0x79')](_0x396004[_0xd7cb('0x7a')]);for(var _0x2a24be=0x0;_0x2a24be<_0x3a0145[_0xd7cb('0x4f')];_0x2a24be+=0x1){_0x2235cc=_0x3a0145[_0x2a24be][_0xd7cb('0x91')]?_0x184d50[_0x3a0145[_0x2a24be][_0xd7cb('0x91')]][_0xd7cb('0x92')]:_0x3a0145[_0x2a24be][_0xd7cb('0x70')];_0x2235cc=_0x3a0145[_0x2a24be][_0xd7cb('0x7b')]?_[_0xd7cb('0x7d')](_0x348e34[_0x3a0145[_0x2a24be][_0xd7cb('0x7b')]],'%s',_0x2235cc):_0x2235cc;_0x2235cc=_0x3a0145[_0x2a24be]['format']?_['replace'](_0x11f4ea[_0x3a0145[_0x2a24be][_0xd7cb('0x7c')]],'%s',_0x2235cc):_0x2235cc;if(_0x3a0145[_0x2a24be][_0xd7cb('0xa6')]){_0x3a7ccc[_0xd7cb('0x6f')](_0x2235cc);}_0x3a0145[_0x2a24be][_0xd7cb('0x7e')]&&_0x3a7ccc['order'](_0x2235cc,_0x3a0145[_0x2a24be]['orderBy']===_0xd7cb('0x7f')?![]:!![]);_0x3a7ccc[_0xd7cb('0x70')](_0x2235cc,_0x3a0145[_0x2a24be][_0xd7cb('0x80')]||_0x2235cc);}if(_0x396004[_0xd7cb('0x81')]){_0x396004[_0xd7cb('0x81')]=JSON[_0xd7cb('0x82')](_0x396004[_0xd7cb('0x81')]);for(var _0x3dd5e0=0x0;_0x3dd5e0<_0x396004[_0xd7cb('0x81')][_0xd7cb('0x4f')];_0x3dd5e0+=0x1){if(_0x396004[_0xd7cb('0x81')][_0x3dd5e0]['type']&&_[_0xd7cb('0x68')](_0x43c806,_0x396004[_0xd7cb('0x81')][_0x3dd5e0][_0xd7cb('0x35')])&&_0x396004['joins'][_0x3dd5e0]['parentKey']&&_0x396004[_0xd7cb('0x81')][_0x3dd5e0]['foreignTable']&&_0x396004[_0xd7cb('0x81')][_0x3dd5e0][_0xd7cb('0x85')]){_0x3a7ccc[_0x396004[_0xd7cb('0x81')][_0x3dd5e0][_0xd7cb('0x35')]](_0x396004[_0xd7cb('0x81')][_0x3dd5e0][_0xd7cb('0x84')],null,util[_0xd7cb('0x7c')](_0xd7cb('0x86'),_0x396004[_0xd7cb('0x7a')],_0x396004['joins'][_0x3dd5e0]['parentKey'],_0x396004[_0xd7cb('0x81')][_0x3dd5e0]['foreignTable'],_0x396004[_0xd7cb('0x81')][_0x3dd5e0][_0xd7cb('0x85')]));}}}if(_0x396004[_0xd7cb('0x87')]){_0x396004[_0xd7cb('0x87')]=JSON[_0xd7cb('0x82')](_0x396004['conditions']);_0x3a7ccc['where'](_0x4d8313(_0x396004[_0xd7cb('0x87')][_0xd7cb('0x6f')]));}_0x2f9d72=_0x3a7ccc[_0xd7cb('0x88')]();_0x3a7ccc[_0xd7cb('0x21')](_0x59e857);_0x3a7ccc['offset'](0x0);logger['debug'](_0xd7cb('0xa7'),_0x3a7ccc[_0xd7cb('0x8b')]());return dbH['sequelize']['query'](_0x3a7ccc[_0xd7cb('0x8b')](),{'type':dbH[_0xd7cb('0x8a')]['QueryTypes'][_0xd7cb('0xa2')]});}})[_0xd7cb('0x28')](function(){return{'sql':_0x2f9d72[_0xd7cb('0x8b')]()};})['then'](respondWithResult(_0x4303ef,null))[_0xd7cb('0x4c')](handleError(_0x4303ef,null));}; \ No newline at end of file +var _0xabfc=['save','then','get','CustomReports','UserProfileResource','destroy','stack','name','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','length','field','condition','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','MetricId','function','replace','format','groupBy','group','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','value','AnalyticMetric','from','table','order','DESC','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','run','runReport','ValidationErrorItem','metric','%s.%s\x20=\x20%s.%s','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0x186a10,_0x2c1d47){var _0x45c11d=function(_0xf460ea){while(--_0xf460ea){_0x186a10['push'](_0x186a10['shift']());}};_0x45c11d(++_0x2c1d47);}(_0xabfc,0x137));var _0xcabf=function(_0x4f4c2a,_0x5f5a28){_0x4f4c2a=_0x4f4c2a-0x0;var _0xd15be6=_0xabfc[_0x4f4c2a];return _0xd15be6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcabf('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcabf('0x1'));var moment=require(_0xcabf('0x2'));var BPromise=require(_0xcabf('0x3'));var Mustache=require(_0xcabf('0x4'));var util=require(_0xcabf('0x5'));var path=require(_0xcabf('0x6'));var sox=require(_0xcabf('0x7'));var csv=require('to-csv');var ejs=require(_0xcabf('0x8'));var fs=require('fs');var fs_extra=require(_0xcabf('0x9'));var _=require('lodash');var squel=require(_0xcabf('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcabf('0xb'));var toCsv=require('to-csv');var querystring=require(_0xcabf('0xc'));var Papa=require(_0xcabf('0xd'));var Redis=require(_0xcabf('0xe'));var authService=require(_0xcabf('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xcabf('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcabf('0x11'))(_0xcabf('0x12'));var utils=require(_0xcabf('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcabf('0x14'))['db'];var dbH=require(_0xcabf('0x14'))['dbH'];function respondWithStatusCode(_0x204535,_0x458ba2){_0x458ba2=_0x458ba2||0xcc;return function(_0x17ba45){if(_0x17ba45){return _0x204535[_0xcabf('0x15')](_0x458ba2);}return _0x204535[_0xcabf('0x16')](_0x458ba2)[_0xcabf('0x17')]();};}function respondWithResult(_0xb5aa46,_0x23feec){_0x23feec=_0x23feec||0xc8;return function(_0x17dbe2){if(_0x17dbe2){return _0xb5aa46[_0xcabf('0x16')](_0x23feec)[_0xcabf('0x18')](_0x17dbe2);}};}function respondWithFilteredResult(_0x21edf3,_0x4893a){return function(_0x4f9850){if(_0x4f9850){var _0x5d18c7=typeof _0x4893a[_0xcabf('0x19')]===_0xcabf('0x1a')&&typeof _0x4893a['limit']===_0xcabf('0x1a');var _0x299413=_0x4f9850[_0xcabf('0x1b')];var _0x3bd3a4=_0x5d18c7?0x0:_0x4893a['offset'];var _0x1992cc=_0x5d18c7?_0x4f9850[_0xcabf('0x1b')]:_0x4893a['offset']+_0x4893a[_0xcabf('0x1c')];var _0x35b4a2;if(_0x1992cc>=_0x299413){_0x1992cc=_0x299413;_0x35b4a2=0xc8;}else{_0x35b4a2=0xce;}_0x21edf3[_0xcabf('0x16')](_0x35b4a2);return _0x21edf3[_0xcabf('0x1d')](_0xcabf('0x1e'),_0x3bd3a4+'-'+_0x1992cc+'/'+_0x299413)['json'](_0x4f9850);}return null;};}function patchUpdates(_0xb929df){return function(_0x509d7e){try{jsonpatch[_0xcabf('0x1f')](_0x509d7e,_0xb929df,!![]);}catch(_0x3d575f){return BPromise[_0xcabf('0x20')](_0x3d575f);}return _0x509d7e[_0xcabf('0x21')]();};}function saveUpdates(_0x51b709,_0x2ca57c){return function(_0x395d99){if(_0x395d99){return _0x395d99['update'](_0x51b709)[_0xcabf('0x22')](function(_0x4ba4d4){return _0x4ba4d4;});}return null;};}function removeEntity(_0x21236e,_0x53f3a6){return function(_0x2963cb){if(_0x2963cb){return _0x2963cb['destroy']()[_0xcabf('0x22')](function(){var _0x5cd137=_0x2963cb[_0xcabf('0x23')]({'plain':!![]});var _0x249170=_0xcabf('0x24');return db[_0xcabf('0x25')][_0xcabf('0x26')]({'where':{'type':_0x249170,'resourceId':_0x5cd137['id']}})[_0xcabf('0x22')](function(){return _0x2963cb;});})[_0xcabf('0x22')](function(){_0x21236e[_0xcabf('0x16')](0xcc)[_0xcabf('0x17')]();});}};}function handleEntityNotFound(_0x48b210,_0x70a714){return function(_0x318cf8){if(!_0x318cf8){_0x48b210[_0xcabf('0x15')](0x194);}return _0x318cf8;};}function handleError(_0x5475f4,_0x5eed16){_0x5eed16=_0x5eed16||0x1f4;return function(_0x20be5c){logger['error'](_0x20be5c[_0xcabf('0x27')]);if(_0x20be5c[_0xcabf('0x28')]){delete _0x20be5c[_0xcabf('0x28')];}_0x5475f4['status'](_0x5eed16)['send'](_0x20be5c);};}exports[_0xcabf('0x29')]=function(_0x24952e,_0x3df62b){var _0xa72dbd={},_0x30a040={},_0x2f1795={'count':0x0,'rows':[]};var _0xbfac51=_['map'](db[_0xcabf('0x2a')][_0xcabf('0x2b')],function(_0x3a09d5){return{'name':_0x3a09d5[_0xcabf('0x2c')],'type':_0x3a09d5[_0xcabf('0x2d')][_0xcabf('0x2e')]};});_0x30a040[_0xcabf('0x2f')]=_[_0xcabf('0x30')](_0xbfac51,_0xcabf('0x28'));_0x30a040[_0xcabf('0x31')]=_['keys'](_0x24952e['query']);_0x30a040['filters']=_[_0xcabf('0x32')](_0x30a040[_0xcabf('0x2f')],_0x30a040[_0xcabf('0x31')]);_0xa72dbd[_0xcabf('0x33')]=_[_0xcabf('0x32')](_0x30a040[_0xcabf('0x2f')],qs['fields'](_0x24952e[_0xcabf('0x31')][_0xcabf('0x34')]));_0xa72dbd['attributes']=_0xa72dbd[_0xcabf('0x33')]['length']?_0xa72dbd[_0xcabf('0x33')]:_0x30a040[_0xcabf('0x2f')];if(!_0x24952e['query'][_0xcabf('0x35')](_0xcabf('0x36'))){_0xa72dbd[_0xcabf('0x1c')]=qs[_0xcabf('0x1c')](_0x24952e['query'][_0xcabf('0x1c')]);_0xa72dbd['offset']=qs[_0xcabf('0x19')](_0x24952e[_0xcabf('0x31')][_0xcabf('0x19')]);}_0xa72dbd['order']=qs[_0xcabf('0x37')](_0x24952e[_0xcabf('0x31')][_0xcabf('0x37')]);_0xa72dbd[_0xcabf('0x38')]=qs[_0xcabf('0x39')](_[_0xcabf('0x3a')](_0x24952e[_0xcabf('0x31')],_0x30a040['filters']),_0xbfac51);if(_0x24952e['query'][_0xcabf('0x3b')]){_0xa72dbd[_0xcabf('0x38')]=_[_0xcabf('0x3c')](_0xa72dbd['where'],{'$or':_[_0xcabf('0x30')](_0xbfac51,function(_0x499894){if(_0x499894[_0xcabf('0x2d')]!==_0xcabf('0x3d')){var _0x2ac5aa={};_0x2ac5aa[_0x499894['name']]={'$like':'%'+_0x24952e[_0xcabf('0x31')]['filter']+'%'};return _0x2ac5aa;}})});}_0xa72dbd=_['merge']({},_0xa72dbd,_0x24952e[_0xcabf('0x3e')]);var _0x216574={'where':_0xa72dbd[_0xcabf('0x38')]};return db[_0xcabf('0x2a')][_0xcabf('0x1b')](_0x216574)[_0xcabf('0x22')](function(_0x1c1e6d){_0x2f1795[_0xcabf('0x1b')]=_0x1c1e6d;if(_0x24952e['query']['includeAll']){_0xa72dbd[_0xcabf('0x3f')]=[{'all':!![]}];}return db[_0xcabf('0x2a')][_0xcabf('0x40')](_0xa72dbd);})['then'](function(_0xa252d1){_0x2f1795[_0xcabf('0x41')]=_0xa252d1;return _0x2f1795;})['then'](respondWithFilteredResult(_0x3df62b,_0xa72dbd))[_0xcabf('0x42')](handleError(_0x3df62b,null));};exports[_0xcabf('0x43')]=function(_0x22a096,_0x19b7fe){var _0x440014={'raw':![],'where':{'id':_0x22a096[_0xcabf('0x44')]['id']}},_0x1cc215={};_0x1cc215['model']=_[_0xcabf('0x45')](db[_0xcabf('0x2a')][_0xcabf('0x2b')]);_0x1cc215[_0xcabf('0x31')]=_['keys'](_0x22a096[_0xcabf('0x31')]);_0x1cc215[_0xcabf('0x39')]=_[_0xcabf('0x32')](_0x1cc215[_0xcabf('0x2f')],_0x1cc215[_0xcabf('0x31')]);_0x440014[_0xcabf('0x33')]=_['intersection'](_0x1cc215[_0xcabf('0x2f')],qs[_0xcabf('0x34')](_0x22a096['query'][_0xcabf('0x34')]));_0x440014[_0xcabf('0x33')]=_0x440014[_0xcabf('0x33')]['length']?_0x440014[_0xcabf('0x33')]:_0x1cc215[_0xcabf('0x2f')];if(_0x22a096[_0xcabf('0x31')][_0xcabf('0x46')]){_0x440014[_0xcabf('0x3f')]=[{'all':!![]}];}_0x440014=_[_0xcabf('0x3c')]({},_0x440014,_0x22a096['options']);return db[_0xcabf('0x2a')][_0xcabf('0x47')](_0x440014)['then'](handleEntityNotFound(_0x19b7fe,null))[_0xcabf('0x22')](respondWithResult(_0x19b7fe,null))[_0xcabf('0x42')](handleError(_0x19b7fe,null));};exports[_0xcabf('0x48')]=function(_0x26189c,_0x20cc97){return db[_0xcabf('0x2a')][_0xcabf('0x48')](_0x26189c[_0xcabf('0x49')],{})[_0xcabf('0x22')](function(_0x1cc411){var _0x295345=_0x26189c[_0xcabf('0x4a')][_0xcabf('0x23')]({'plain':!![]});if(!_0x295345)throw new Error(_0xcabf('0x4b'));if(_0x295345[_0xcabf('0x4c')]==='user'){var _0x400e5a=_0x1cc411[_0xcabf('0x23')]({'plain':!![]});var _0x16c3fb=_0xcabf('0x4d');return db[_0xcabf('0x4e')][_0xcabf('0x47')]({'where':{'name':_0x16c3fb,'userProfileId':_0x295345[_0xcabf('0x4f')]},'raw':!![]})['then'](function(_0x561937){if(_0x561937&&_0x561937[_0xcabf('0x50')]===0x0){return db[_0xcabf('0x25')]['create']({'name':_0x400e5a[_0xcabf('0x28')],'resourceId':_0x400e5a['id'],'type':_0xcabf('0x24'),'sectionId':_0x561937['id']},{})[_0xcabf('0x22')](function(){return _0x1cc411;});}else{return _0x1cc411;}})['catch'](function(_0x3bba7d){logger[_0xcabf('0x51')](_0xcabf('0x52'),_0x3bba7d);throw _0x3bba7d;});}return _0x1cc411;})[_0xcabf('0x22')](respondWithResult(_0x20cc97,0xc9))[_0xcabf('0x42')](handleError(_0x20cc97,null));};exports['update']=function(_0x4a0135,_0x54e2d9){if(_0x4a0135['body']['id']){delete _0x4a0135[_0xcabf('0x49')]['id'];}return db[_0xcabf('0x2a')][_0xcabf('0x47')]({'where':{'id':_0x4a0135[_0xcabf('0x44')]['id']}})[_0xcabf('0x22')](handleEntityNotFound(_0x54e2d9,null))[_0xcabf('0x22')](saveUpdates(_0x4a0135[_0xcabf('0x49')],null))['then'](respondWithResult(_0x54e2d9,null))[_0xcabf('0x42')](handleError(_0x54e2d9,null));};exports[_0xcabf('0x26')]=function(_0x215538,_0x2d5875){return db['AnalyticCustomReport'][_0xcabf('0x47')]({'where':{'id':_0x215538[_0xcabf('0x44')]['id']}})[_0xcabf('0x22')](handleEntityNotFound(_0x2d5875,null))[_0xcabf('0x22')](removeEntity(_0x2d5875,null))[_0xcabf('0x42')](handleError(_0x2d5875,null));};exports[_0xcabf('0x53')]=function(_0x3d4fb6,_0x1a1666){var _0x5d8a16=0xa;var _0x1d97c8=[_0xcabf('0x54'),_0xcabf('0x55'),_0xcabf('0x56'),_0xcabf('0x57')];var _0x5e7a8a={'SUM':_0xcabf('0x58'),'COUNT':_0xcabf('0x59'),'COUNT DISTINCT':_0xcabf('0x5a'),'MAX':_0xcabf('0x5b'),'MIN':_0xcabf('0x5c'),'AVG':_0xcabf('0x5d'),'GROUP_CONCAT':_0xcabf('0x5e'),'GROUP_CONCAT ASC':_0xcabf('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x37051c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xcabf('0x60'),'HOUR':_0xcabf('0x61'),'ROUND':_0xcabf('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x23759d=function(_0x43880d){return!_[_0xcabf('0x63')]([_0xcabf('0x64'),_0xcabf('0x65'),'IS\x20EMPTY',_0xcabf('0x66')],_0x43880d);};var _0x2cfce1=function(_0x1bfa8c){if(!_0x1bfa8c||!_0x1bfa8c[_0xcabf('0x67')][_0xcabf('0x68')]){return'';}for(var _0x3d6de0='(',_0x1eb7aa=0x0;_0x1eb7aa<_0x1bfa8c['rules'][_0xcabf('0x68')];_0x1eb7aa+=0x1){_0x1eb7aa>0x0&&(_0x3d6de0+='\x20'+_0x1bfa8c['operator']+'\x20');_0x3d6de0+=_0x1bfa8c[_0xcabf('0x67')][_0x1eb7aa]['group']?_0x2cfce1(_0x1bfa8c[_0xcabf('0x67')][_0x1eb7aa]['group']):_0x1bfa8c[_0xcabf('0x67')][_0x1eb7aa][_0xcabf('0x69')]+'\x20'+_0x1bfa8c[_0xcabf('0x67')][_0x1eb7aa][_0xcabf('0x6a')]+(_0x23759d(_0x1bfa8c[_0xcabf('0x67')][_0x1eb7aa][_0xcabf('0x6a')])?'\x20'+_0x1bfa8c[_0xcabf('0x67')][_0x1eb7aa]['value']:'');}return _0x3d6de0+')';};var _0x2373e6={'where':{'id':_0x3d4fb6['params']['id']}},_0x58c321,_0x6287ef,_0x47d9f3,_0x524604,_0x1fe5f9;_0x2373e6=_['merge']({},_0x2373e6,_0x3d4fb6[_0xcabf('0x3e')]);return db['AnalyticCustomReport'][_0xcabf('0x47')](_0x2373e6)[_0xcabf('0x22')](function(_0x50bd8a){if(_0x50bd8a){_0x58c321=_0x50bd8a;return _0x50bd8a[_0xcabf('0x6b')]();}return null;})['then'](function(_0x5e5005){if(_0x5e5005){if(!_0x5e5005[_0xcabf('0x68')]){throw new db[(_0xcabf('0x6c'))]['ValidationErrorItem'](_0xcabf('0x6d'),0x193);}_0x6287ef=_0x5e5005;return db['AnalyticMetric'][_0xcabf('0x40')]({'raw':!![]});}return null;})[_0xcabf('0x22')](function(_0x292b05){if(_0x292b05){_0x47d9f3=_[_0xcabf('0x6e')](_0x292b05,'id');var _0x24e29e;var _0x1bfe4c=squel[_0xcabf('0x6f')]();_0x1bfe4c['from'](_0x58c321['table']);for(var _0x5e0119=0x0;_0x5e0119<_0x6287ef[_0xcabf('0x68')];_0x5e0119+=0x1){_0x24e29e=_0x6287ef[_0x5e0119][_0xcabf('0x70')]?_0x47d9f3[_0x6287ef[_0x5e0119][_0xcabf('0x70')]]['metric']:_0x6287ef[_0x5e0119][_0xcabf('0x69')];_0x24e29e=_0x6287ef[_0x5e0119][_0xcabf('0x71')]?_[_0xcabf('0x72')](_0x5e7a8a[_0x6287ef[_0x5e0119][_0xcabf('0x71')]],'%s',_0x24e29e):_0x24e29e;_0x24e29e=_0x6287ef[_0x5e0119][_0xcabf('0x73')]?_[_0xcabf('0x72')](_0x37051c[_0x6287ef[_0x5e0119]['format']],'%s',_0x24e29e):_0x24e29e;if(_0x6287ef[_0x5e0119][_0xcabf('0x74')]){_0x1bfe4c[_0xcabf('0x75')](_0x24e29e);}_0x6287ef[_0x5e0119][_0xcabf('0x76')]&&_0x1bfe4c['order'](_0x24e29e,_0x6287ef[_0x5e0119][_0xcabf('0x76')]==='DESC'?![]:!![]);_0x1bfe4c[_0xcabf('0x69')](_0x24e29e,_0x6287ef[_0x5e0119][_0xcabf('0x77')]||_0x24e29e);}if(_0x58c321[_0xcabf('0x78')]){_0x58c321[_0xcabf('0x78')]=JSON[_0xcabf('0x79')](_0x58c321[_0xcabf('0x78')]);for(var _0x4aca70=0x0;_0x4aca70<_0x58c321[_0xcabf('0x78')][_0xcabf('0x68')];_0x4aca70+=0x1){if(_0x58c321[_0xcabf('0x78')][_0x4aca70]['type']&&_[_0xcabf('0x63')](_0x1d97c8,_0x58c321[_0xcabf('0x78')][_0x4aca70][_0xcabf('0x2d')])&&_0x58c321[_0xcabf('0x78')][_0x4aca70][_0xcabf('0x7a')]&&_0x58c321[_0xcabf('0x78')][_0x4aca70][_0xcabf('0x7b')]&&_0x58c321[_0xcabf('0x78')][_0x4aca70][_0xcabf('0x7c')]){_0x1bfe4c[_0x58c321[_0xcabf('0x78')][_0x4aca70]['type']](_0x58c321[_0xcabf('0x78')][_0x4aca70][_0xcabf('0x7b')],null,util[_0xcabf('0x73')]('%s.%s\x20=\x20%s.%s',_0x58c321['table'],_0x58c321['joins'][_0x4aca70][_0xcabf('0x7a')],_0x58c321[_0xcabf('0x78')][_0x4aca70][_0xcabf('0x7b')],_0x58c321[_0xcabf('0x78')][_0x4aca70][_0xcabf('0x7c')]));}}}if(_0x58c321[_0xcabf('0x7d')]){_0x58c321[_0xcabf('0x7d')]=JSON[_0xcabf('0x79')](_0x58c321[_0xcabf('0x7d')]);_0x1bfe4c[_0xcabf('0x38')](_0x2cfce1(_0x58c321[_0xcabf('0x7d')][_0xcabf('0x75')]));}_0x1fe5f9=_0x1bfe4c[_0xcabf('0x7e')]();_0x1bfe4c[_0xcabf('0x1c')](_0x5d8a16);_0x1bfe4c[_0xcabf('0x19')](0x0);logger[_0xcabf('0x7f')](_0xcabf('0x80'),_0x1bfe4c['toString']());return dbH[_0xcabf('0x81')]['query'](_0x1bfe4c[_0xcabf('0x82')](),{'type':dbH['sequelize']['QueryTypes'][_0xcabf('0x83')]});}})[_0xcabf('0x22')](respondWithResult(_0x1a1666,null))[_0xcabf('0x42')](handleError(_0x1a1666,null));};function runReport(_0x3442fc,_0x2e5f6b,_0x139398){var _0x2151b8=_0x2e5f6b[_0xcabf('0x28')];var _0x13069d=0xa;var _0x19837d=[_0xcabf('0x54'),_0xcabf('0x55'),_0xcabf('0x56'),_0xcabf('0x57')];var _0x392df1={'SUM':_0xcabf('0x58'),'COUNT':_0xcabf('0x59'),'COUNT DISTINCT':_0xcabf('0x5a'),'MAX':_0xcabf('0x5b'),'MIN':_0xcabf('0x5c'),'AVG':_0xcabf('0x5d'),'GROUP_CONCAT':_0xcabf('0x5e'),'GROUP_CONCAT ASC':_0xcabf('0x5f'),'GROUP_CONCAT DESC':_0xcabf('0x84')};var _0x40ee9a={'SEC_TO_TIME':_0xcabf('0x85'),'DATE':_0xcabf('0x60'),'HOUR':'HOUR(%s)','ROUND':_0xcabf('0x62'),'UNIX_TIMESTAMP':_0xcabf('0x86')};var _0x126d1e=function(_0x3c3d2b){return!_[_0xcabf('0x63')]([_0xcabf('0x64'),_0xcabf('0x65'),_0xcabf('0x87'),_0xcabf('0x66')],_0x3c3d2b);};var _0x5ae70b=function(_0x11c387){if(!_0x11c387||!_0x11c387['rules'][_0xcabf('0x68')]){return'';}for(var _0x4cfcac='(',_0x645ec7=0x0;_0x645ec7<_0x11c387[_0xcabf('0x67')]['length'];_0x645ec7+=0x1){_0x645ec7>0x0&&(_0x4cfcac+='\x20'+_0x11c387[_0xcabf('0x88')]+'\x20');_0x4cfcac+=_0x11c387[_0xcabf('0x67')][_0x645ec7][_0xcabf('0x75')]?_0x5ae70b(_0x11c387[_0xcabf('0x67')][_0x645ec7][_0xcabf('0x75')]):_0x11c387[_0xcabf('0x67')][_0x645ec7][_0xcabf('0x69')]+'\x20'+_0x11c387[_0xcabf('0x67')][_0x645ec7][_0xcabf('0x6a')]+(_0x126d1e(_0x11c387[_0xcabf('0x67')][_0x645ec7][_0xcabf('0x6a')])?'\x20'+_0x11c387['rules'][_0x645ec7][_0xcabf('0x89')]:'');}return _0x4cfcac+')';};var _0x47bc57={'where':{'id':_0x3442fc['id']}},_0x1b308d,_0xa5d7d6,_0xb59cad,_0x4ee2c6,_0x10fb2d;_0x47bc57=_[_0xcabf('0x3c')]({},_0x47bc57,_0x139398);return db[_0xcabf('0x2a')]['find'](_0x47bc57)[_0xcabf('0x22')](function(_0x3b285c){if(_0x3b285c){_0x1b308d=_0x3b285c;return _0x3b285c[_0xcabf('0x6b')]();}return null;})[_0xcabf('0x22')](function(_0x127ba0){if(_0x127ba0){if(!_0x127ba0[_0xcabf('0x68')]){throw new db[(_0xcabf('0x6c'))]['ValidationErrorItem'](_0xcabf('0x6d'),0x193);}_0xa5d7d6=_0x127ba0;return db[_0xcabf('0x8a')][_0xcabf('0x40')]({'raw':!![]});}return null;})[_0xcabf('0x22')](function(_0x3a0bae){if(_0x3a0bae){_0xb59cad=_['keyBy'](_0x3a0bae,'id');var _0x119e6f;var _0x2a5902=squel[_0xcabf('0x6f')]();_0x2a5902[_0xcabf('0x8b')](_0x1b308d[_0xcabf('0x8c')]);for(var _0x490fe8=0x0;_0x490fe8<_0xa5d7d6[_0xcabf('0x68')];_0x490fe8+=0x1){_0x119e6f=_0xa5d7d6[_0x490fe8]['MetricId']?_0xb59cad[_0xa5d7d6[_0x490fe8][_0xcabf('0x70')]]['metric']:_0xa5d7d6[_0x490fe8][_0xcabf('0x69')];_0x119e6f=_0xa5d7d6[_0x490fe8][_0xcabf('0x71')]?_[_0xcabf('0x72')](_0x392df1[_0xa5d7d6[_0x490fe8][_0xcabf('0x71')]],'%s',_0x119e6f):_0x119e6f;_0x119e6f=_0xa5d7d6[_0x490fe8]['format']?_[_0xcabf('0x72')](_0x40ee9a[_0xa5d7d6[_0x490fe8][_0xcabf('0x73')]],'%s',_0x119e6f):_0x119e6f;if(_0xa5d7d6[_0x490fe8][_0xcabf('0x74')]){_0x2a5902[_0xcabf('0x75')](_0x119e6f);}_0xa5d7d6[_0x490fe8][_0xcabf('0x76')]&&_0x2a5902[_0xcabf('0x8d')](_0x119e6f,_0xa5d7d6[_0x490fe8][_0xcabf('0x76')]===_0xcabf('0x8e')?![]:!![]);_0x2a5902['field'](_0x119e6f,_0xa5d7d6[_0x490fe8][_0xcabf('0x77')]||_0x119e6f);}if(_0x1b308d[_0xcabf('0x78')]){_0x1b308d[_0xcabf('0x78')]=JSON[_0xcabf('0x79')](_0x1b308d[_0xcabf('0x78')]);for(var _0x25bf93=0x0;_0x25bf93<_0x1b308d[_0xcabf('0x78')]['length'];_0x25bf93+=0x1){if(_0x1b308d[_0xcabf('0x78')][_0x25bf93]['type']&&_[_0xcabf('0x63')](_0x19837d,_0x1b308d[_0xcabf('0x78')][_0x25bf93][_0xcabf('0x2d')])&&_0x1b308d['joins'][_0x25bf93][_0xcabf('0x7a')]&&_0x1b308d[_0xcabf('0x78')][_0x25bf93][_0xcabf('0x7b')]&&_0x1b308d[_0xcabf('0x78')][_0x25bf93][_0xcabf('0x7c')]){_0x2a5902[_0x1b308d[_0xcabf('0x78')][_0x25bf93][_0xcabf('0x2d')]](_0x1b308d[_0xcabf('0x78')][_0x25bf93]['foreignTable'],null,util[_0xcabf('0x73')]('%s.%s\x20=\x20%s.%s',_0x1b308d['table'],_0x1b308d['joins'][_0x25bf93][_0xcabf('0x7a')],_0x1b308d[_0xcabf('0x78')][_0x25bf93]['foreignTable'],_0x1b308d[_0xcabf('0x78')][_0x25bf93][_0xcabf('0x7c')]));}}}if(_0x1b308d[_0xcabf('0x7d')]){_0x1b308d[_0xcabf('0x7d')]=JSON[_0xcabf('0x79')](_0x1b308d[_0xcabf('0x7d')]);_0x2a5902['where'](_0x5ae70b(_0x1b308d[_0xcabf('0x7d')][_0xcabf('0x75')]));}_0x10fb2d=_0x2a5902[_0xcabf('0x7e')]();_0x2a5902[_0xcabf('0x1c')](_0x13069d);_0x2a5902[_0xcabf('0x19')](0x0);return;}})[_0xcabf('0x22')](function(){if(_0x2e5f6b[_0xcabf('0x8f')]===_0xcabf('0x90')){return null;}var _0x5190cf=_['merge'](_0x2e5f6b,{'name':_0x2e5f6b[_0xcabf('0x91')]||_0x2e5f6b[_0xcabf('0x28')]||_0x1b308d[_0xcabf('0x28')],'basename':_0x2151b8,'savename':util[_0xcabf('0x73')](_0xcabf('0x92'),_0x2e5f6b['name']||_0x1b308d[_0xcabf('0x28')],require(_0xcabf('0x93'))[_0xcabf('0x94')](0x4),_0x2e5f6b[_0xcabf('0x8f')]||_0xcabf('0x95')),'reportId':_0x1b308d['id'],'reportType':_0xcabf('0x96')});return db[_0xcabf('0x97')][_0xcabf('0x48')](_0x5190cf,{'raw':!![]});})[_0xcabf('0x22')](function(_0x18a628){if(_0x1b308d[_0xcabf('0x8c')]===_0xcabf('0x98')){_0x10fb2d[_0xcabf('0x38')](_0x1b308d['table']+_0xcabf('0x99'),_0x2e5f6b[_0xcabf('0x9a')],_0x2e5f6b[_0xcabf('0x9b')]);}else{_0x10fb2d[_0xcabf('0x38')](_0x1b308d[_0xcabf('0x8c')]+_0xcabf('0x9c'),_0x2e5f6b[_0xcabf('0x9a')],_0x2e5f6b[_0xcabf('0x9b')]);}if(_0x18a628){logger[_0xcabf('0x9d')](_0xcabf('0x9e'),_0x10fb2d[_0xcabf('0x82')]());require(_0xcabf('0x9f'))[_0xcabf('0xa0')](path[_0xcabf('0x54')](__dirname,_0xcabf('0xa1'),_0x18a628['output']),[_0x18a628['id'],_0x10fb2d[_0xcabf('0x82')](),path[_0xcabf('0x54')](__dirname,_0xcabf('0xa2'),_0x18a628[_0xcabf('0xa3')]),_0x2151b8]);return _0x18a628;}else{var _0x10e180=squel[_0xcabf('0x6f')]();_0x10e180[_0xcabf('0x8b')]('('+_0x10fb2d['toString']()+')',_0xcabf('0xa4'));_0x10e180['field'](_0xcabf('0xa5'),'count');_0x10fb2d[_0xcabf('0x1c')](_0x2e5f6b[_0xcabf('0x1c')]||_0x13069d);_0x10fb2d[_0xcabf('0x19')](_0x2e5f6b[_0xcabf('0x19')]||0x0);return dbH[_0xcabf('0x81')]['query'](_0x10e180['toString'](),{'type':dbH[_0xcabf('0x81')][_0xcabf('0xa6')][_0xcabf('0x83')]})['then'](function(_0x24ebf9){if(!_0x24ebf9[_0xcabf('0x68')]){_0x4ee2c6=0x0;}else{_0x4ee2c6=_0x24ebf9[0x0][_0xcabf('0x1b')]||0x0;}return dbH[_0xcabf('0x81')][_0xcabf('0x31')](_0x10fb2d[_0xcabf('0x82')](),{'type':dbH['sequelize'][_0xcabf('0xa6')][_0xcabf('0x83')]});})[_0xcabf('0x22')](function(_0x31e874){return{'rows':_0x31e874||[],'count':_0x4ee2c6};});}});}exports[_0xcabf('0xa7')]=function(_0x1df9f0,_0x5b7783){return runReport(_0x1df9f0[_0xcabf('0x44')],_0x1df9f0['query'],_0x1df9f0['options'])[_0xcabf('0x22')](respondWithResult(_0x5b7783,null))[_0xcabf('0x42')](handleError(_0x5b7783,null));};exports[_0xcabf('0xa8')]=runReport;exports[_0xcabf('0x31')]=function(_0x56911c,_0x33fb5d){var _0x30e95b=0xa;var _0x42ac19=['join',_0xcabf('0x55'),_0xcabf('0x56'),'cross_join'];var _0x32ae69={'SUM':_0xcabf('0x58'),'COUNT':_0xcabf('0x59'),'COUNT DISTINCT':_0xcabf('0x5a'),'MAX':_0xcabf('0x5b'),'MIN':_0xcabf('0x5c'),'AVG':_0xcabf('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcabf('0x84')};var _0x49694c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xcabf('0x60'),'HOUR':_0xcabf('0x61'),'ROUND':_0xcabf('0x62'),'UNIX_TIMESTAMP':_0xcabf('0x86')};var _0x21b713=function(_0x2ad9de){return!_['includes']([_0xcabf('0x64'),_0xcabf('0x65'),_0xcabf('0x87'),_0xcabf('0x66')],_0x2ad9de);};var _0x1e8c51=function(_0x5ca84e){if(!_0x5ca84e||!_0x5ca84e[_0xcabf('0x67')][_0xcabf('0x68')]){return'';}for(var _0x5a4f36='(',_0x4f8524=0x0;_0x4f8524<_0x5ca84e[_0xcabf('0x67')]['length'];_0x4f8524+=0x1){_0x4f8524>0x0&&(_0x5a4f36+='\x20'+_0x5ca84e['operator']+'\x20');_0x5a4f36+=_0x5ca84e[_0xcabf('0x67')][_0x4f8524][_0xcabf('0x75')]?_0x1e8c51(_0x5ca84e[_0xcabf('0x67')][_0x4f8524][_0xcabf('0x75')]):_0x5ca84e[_0xcabf('0x67')][_0x4f8524][_0xcabf('0x69')]+'\x20'+_0x5ca84e[_0xcabf('0x67')][_0x4f8524]['condition']+(_0x21b713(_0x5ca84e[_0xcabf('0x67')][_0x4f8524][_0xcabf('0x6a')])?'\x20'+_0x5ca84e['rules'][_0x4f8524][_0xcabf('0x89')]:'');}return _0x5a4f36+')';};var _0x52beeb={'where':{'id':_0x56911c[_0xcabf('0x44')]['id']}},_0x279897,_0xccd11f,_0x152eac,_0x2dfee6,_0x314b3a;_0x52beeb=_[_0xcabf('0x3c')]({},_0x52beeb,_0x56911c[_0xcabf('0x3e')]);return db[_0xcabf('0x2a')][_0xcabf('0x47')](_0x52beeb)['then'](function(_0x538a6e){if(_0x538a6e){_0x279897=_0x538a6e;return _0x538a6e[_0xcabf('0x6b')]();}return null;})['then'](function(_0x2ba6e9){if(_0x2ba6e9){if(!_0x2ba6e9['length']){throw new db[(_0xcabf('0x6c'))][(_0xcabf('0xa9'))](_0xcabf('0x6d'),0x193);}_0xccd11f=_0x2ba6e9;return db[_0xcabf('0x8a')][_0xcabf('0x40')]({'raw':!![]});}return null;})[_0xcabf('0x22')](function(_0x5a2ec1){if(_0x5a2ec1){_0x152eac=_[_0xcabf('0x6e')](_0x5a2ec1,'id');var _0x3bc9e6;var _0x252f72=squel[_0xcabf('0x6f')]();_0x252f72[_0xcabf('0x8b')](_0x279897[_0xcabf('0x8c')]);for(var _0x2204ce=0x0;_0x2204ce<_0xccd11f[_0xcabf('0x68')];_0x2204ce+=0x1){_0x3bc9e6=_0xccd11f[_0x2204ce][_0xcabf('0x70')]?_0x152eac[_0xccd11f[_0x2204ce][_0xcabf('0x70')]][_0xcabf('0xaa')]:_0xccd11f[_0x2204ce]['field'];_0x3bc9e6=_0xccd11f[_0x2204ce]['function']?_[_0xcabf('0x72')](_0x32ae69[_0xccd11f[_0x2204ce]['function']],'%s',_0x3bc9e6):_0x3bc9e6;_0x3bc9e6=_0xccd11f[_0x2204ce]['format']?_['replace'](_0x49694c[_0xccd11f[_0x2204ce]['format']],'%s',_0x3bc9e6):_0x3bc9e6;if(_0xccd11f[_0x2204ce][_0xcabf('0x74')]){_0x252f72[_0xcabf('0x75')](_0x3bc9e6);}_0xccd11f[_0x2204ce][_0xcabf('0x76')]&&_0x252f72[_0xcabf('0x8d')](_0x3bc9e6,_0xccd11f[_0x2204ce]['orderBy']==='DESC'?![]:!![]);_0x252f72['field'](_0x3bc9e6,_0xccd11f[_0x2204ce][_0xcabf('0x77')]||_0x3bc9e6);}if(_0x279897[_0xcabf('0x78')]){_0x279897['joins']=JSON[_0xcabf('0x79')](_0x279897['joins']);for(var _0x42e298=0x0;_0x42e298<_0x279897['joins'][_0xcabf('0x68')];_0x42e298+=0x1){if(_0x279897['joins'][_0x42e298][_0xcabf('0x2d')]&&_[_0xcabf('0x63')](_0x42ac19,_0x279897[_0xcabf('0x78')][_0x42e298][_0xcabf('0x2d')])&&_0x279897['joins'][_0x42e298][_0xcabf('0x7a')]&&_0x279897[_0xcabf('0x78')][_0x42e298][_0xcabf('0x7b')]&&_0x279897[_0xcabf('0x78')][_0x42e298][_0xcabf('0x7c')]){_0x252f72[_0x279897[_0xcabf('0x78')][_0x42e298][_0xcabf('0x2d')]](_0x279897['joins'][_0x42e298][_0xcabf('0x7b')],null,util[_0xcabf('0x73')](_0xcabf('0xab'),_0x279897[_0xcabf('0x8c')],_0x279897[_0xcabf('0x78')][_0x42e298][_0xcabf('0x7a')],_0x279897[_0xcabf('0x78')][_0x42e298][_0xcabf('0x7b')],_0x279897[_0xcabf('0x78')][_0x42e298][_0xcabf('0x7c')]));}}}if(_0x279897['conditions']){_0x279897[_0xcabf('0x7d')]=JSON[_0xcabf('0x79')](_0x279897[_0xcabf('0x7d')]);_0x252f72[_0xcabf('0x38')](_0x1e8c51(_0x279897[_0xcabf('0x7d')]['group']));}_0x314b3a=_0x252f72['clone']();_0x252f72[_0xcabf('0x1c')](_0x30e95b);_0x252f72[_0xcabf('0x19')](0x0);logger[_0xcabf('0x7f')](_0xcabf('0x80'),_0x252f72[_0xcabf('0x82')]());return dbH[_0xcabf('0x81')]['query'](_0x252f72[_0xcabf('0x82')](),{'type':dbH[_0xcabf('0x81')]['QueryTypes']['SELECT']});}})[_0xcabf('0x22')](function(){return{'sql':_0x314b3a[_0xcabf('0x82')]()};})['then'](respondWithResult(_0x33fb5d,null))['catch'](handleError(_0x33fb5d,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index d9bd9d9..cdfeb80 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 _0x0071=['exports','define','AnalyticCustomReport','analytics_custom_reports','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes'];(function(_0x3041dc,_0x17d011){var _0x38fd56=function(_0x591601){while(--_0x591601){_0x3041dc['push'](_0x3041dc['shift']());}};_0x38fd56(++_0x17d011);}(_0x0071,0x117));var _0x1007=function(_0x26679e,_0x508e1c){_0x26679e=_0x26679e-0x0;var _0x18c847=_0x0071[_0x26679e];return _0x18c847;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1007('0x0'))(_0x1007('0x1'));var moment=require('moment');var BPromise=require(_0x1007('0x2'));var rp=require(_0x1007('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1007('0x4'));var config=require(_0x1007('0x5'));var attributes=require(_0x1007('0x6'));module[_0x1007('0x7')]=function(_0x191b7b,_0x567754){return _0x191b7b[_0x1007('0x8')](_0x1007('0x9'),attributes,{'tableName':_0x1007('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7a1=['AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','bluebird','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define'];(function(_0x22b4c6,_0x18e2d8){var _0x917d72=function(_0xb62759){while(--_0xb62759){_0x22b4c6['push'](_0x22b4c6['shift']());}};_0x917d72(++_0x18e2d8);}(_0xe7a1,0x110));var _0x1e7a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xe7a1[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x1e7a('0x0'));var util=require('util');var logger=require(_0x1e7a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1e7a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1e7a('0x3'));var config=require(_0x1e7a('0x4'));var attributes=require(_0x1e7a('0x5'));module[_0x1e7a('0x6')]=function(_0x2a37b9,_0x2c76ef){return _0x2a37b9[_0x1e7a('0x7')](_0x1e7a('0x8'),attributes,{'tableName':_0x1e7a('0x9'),'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 04fbac1..7ad4855 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 _0x7bc2=['jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x695b76,_0x551526){var _0x1dc21f=function(_0x5fdb1c){while(--_0x5fdb1c){_0x695b76['push'](_0x695b76['shift']());}};_0x1dc21f(++_0x551526);}(_0x7bc2,0xad));var _0x27bc=function(_0x135898,_0xccb464){_0x135898=_0x135898-0x0;var _0x27368e=_0x7bc2[_0x135898];return _0x27368e;};'use strict';var _=require(_0x27bc('0x0'));var util=require(_0x27bc('0x1'));var moment=require(_0x27bc('0x2'));var BPromise=require(_0x27bc('0x3'));var rs=require(_0x27bc('0x4'));var fs=require('fs');var Redis=require(_0x27bc('0x5'));var db=require(_0x27bc('0x6'))['db'];var utils=require(_0x27bc('0x7'));var logger=require(_0x27bc('0x8'))(_0x27bc('0x9'));var config=require(_0x27bc('0xa'));var jayson=require(_0x27bc('0xb'));var client=jayson['client'][_0x27bc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c1329,_0x1ddd7e,_0x42dd23){return new BPromise(function(_0x5c4190,_0x46b10c){return client[_0x27bc('0xd')](_0x4c1329,_0x42dd23)[_0x27bc('0xe')](function(_0x3ef077){logger[_0x27bc('0xf')](_0x27bc('0x10'),_0x1ddd7e,_0x27bc('0x11'));logger[_0x27bc('0x12')](_0x27bc('0x13'),_0x1ddd7e,'request\x20sent',JSON[_0x27bc('0x14')](_0x3ef077));if(_0x3ef077[_0x27bc('0x15')]){if(_0x3ef077['error']['code']===0x1f4){logger[_0x27bc('0x15')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1ddd7e,_0x3ef077[_0x27bc('0x15')][_0x27bc('0x16')]);return _0x46b10c(_0x3ef077[_0x27bc('0x15')][_0x27bc('0x16')]);}logger[_0x27bc('0x15')](_0x27bc('0x10'),_0x1ddd7e,_0x3ef077[_0x27bc('0x15')][_0x27bc('0x16')]);return _0x5c4190(_0x3ef077[_0x27bc('0x15')][_0x27bc('0x16')]);}else{logger['info'](_0x27bc('0x10'),_0x1ddd7e,'request\x20sent');_0x5c4190(_0x3ef077['result']['message']);}})['catch'](function(_0x2b52b1){logger[_0x27bc('0x15')](_0x27bc('0x10'),_0x1ddd7e,_0x2b52b1);_0x46b10c(_0x2b52b1);});});} \ No newline at end of file +var _0xf2e4=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x598408,_0x5e6f74){var _0x560720=function(_0x56a96d){while(--_0x56a96d){_0x598408['push'](_0x598408['shift']());}};_0x560720(++_0x5e6f74);}(_0xf2e4,0x119));var _0x4f2e=function(_0x37f8cf,_0x4dbb0a){_0x37f8cf=_0x37f8cf-0x0;var _0x595b52=_0xf2e4[_0x37f8cf];return _0x595b52;};'use strict';var _=require(_0x4f2e('0x0'));var util=require(_0x4f2e('0x1'));var moment=require(_0x4f2e('0x2'));var BPromise=require(_0x4f2e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f2e('0x4'));var db=require(_0x4f2e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f2e('0x6'))(_0x4f2e('0x7'));var config=require(_0x4f2e('0x8'));var jayson=require(_0x4f2e('0x9'));var client=jayson[_0x4f2e('0xa')][_0x4f2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x554696,_0xa08672,_0x55c7c2){return new BPromise(function(_0x51f264,_0x1693c5){return client[_0x4f2e('0xc')](_0x554696,_0x55c7c2)['then'](function(_0xe81e3f){logger[_0x4f2e('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0xa08672,'request\x20sent');logger[_0x4f2e('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0xa08672,'request\x20sent',JSON[_0x4f2e('0xf')](_0xe81e3f));if(_0xe81e3f[_0x4f2e('0x10')]){if(_0xe81e3f[_0x4f2e('0x10')][_0x4f2e('0x11')]===0x1f4){logger['error'](_0x4f2e('0x12'),_0xa08672,_0xe81e3f['error'][_0x4f2e('0x13')]);return _0x1693c5(_0xe81e3f[_0x4f2e('0x10')]['message']);}logger[_0x4f2e('0x10')](_0x4f2e('0x12'),_0xa08672,_0xe81e3f[_0x4f2e('0x10')][_0x4f2e('0x13')]);return _0x51f264(_0xe81e3f[_0x4f2e('0x10')][_0x4f2e('0x13')]);}else{logger[_0x4f2e('0xd')](_0x4f2e('0x12'),_0xa08672,_0x4f2e('0x14'));_0x51f264(_0xe81e3f['result'][_0x4f2e('0x13')]);}})[_0x4f2e('0x15')](function(_0x123330){logger[_0x4f2e('0x10')](_0x4f2e('0x12'),_0xa08672,_0x123330);_0x1693c5(_0x123330);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index ca19c10..13f61e6 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 _0x4e15=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0xbd09e4,_0x42e6ae){var _0x55e630=function(_0x9b1917){while(--_0x9b1917){_0xbd09e4['push'](_0xbd09e4['shift']());}};_0x55e630(++_0x42e6ae);}(_0x4e15,0x1c6));var _0x54e1=function(_0x354da0,_0x1ee027){_0x354da0=_0x354da0-0x0;var _0x3c9244=_0x4e15[_0x354da0];return _0x3c9244;};'use strict';var multer=require(_0x54e1('0x0'));var util=require(_0x54e1('0x1'));var path=require(_0x54e1('0x2'));var timeout=require(_0x54e1('0x3'));var express=require(_0x54e1('0x4'));var router=express[_0x54e1('0x5')]();var fs_extra=require(_0x54e1('0x6'));var auth=require(_0x54e1('0x7'));var interaction=require(_0x54e1('0x8'));var config=require(_0x54e1('0x9'));var controller=require(_0x54e1('0xa'));router[_0x54e1('0xb')]('/',auth[_0x54e1('0xc')](),controller[_0x54e1('0xd')]);router['get'](_0x54e1('0xe'),auth[_0x54e1('0xc')](),controller[_0x54e1('0xf')]);router[_0x54e1('0xb')](_0x54e1('0x10'),auth[_0x54e1('0xc')](),controller[_0x54e1('0x11')]);router['get'](_0x54e1('0x12'),auth[_0x54e1('0xc')](),controller['run']);router[_0x54e1('0xb')](_0x54e1('0x13'),auth[_0x54e1('0xc')](),controller[_0x54e1('0x14')]);router[_0x54e1('0x15')]('/',auth[_0x54e1('0xc')](),controller[_0x54e1('0x16')]);router[_0x54e1('0x17')](_0x54e1('0xe'),auth[_0x54e1('0xc')](),controller[_0x54e1('0x18')]);router[_0x54e1('0x19')](_0x54e1('0xe'),auth[_0x54e1('0xc')](),controller['destroy']);module[_0x54e1('0x1a')]=router; \ No newline at end of file +var _0x88be=['show','preview','/:id/run','run','/:id/query','query','post','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index'];(function(_0x15a60a,_0x2657a7){var _0x4193f9=function(_0x47e05d){while(--_0x47e05d){_0x15a60a['push'](_0x15a60a['shift']());}};_0x4193f9(++_0x2657a7);}(_0x88be,0xb4));var _0xe88b=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x88be[_0x2576d7];return _0x16a08c;};'use strict';var multer=require(_0xe88b('0x0'));var util=require(_0xe88b('0x1'));var path=require('path');var timeout=require(_0xe88b('0x2'));var express=require(_0xe88b('0x3'));var router=express[_0xe88b('0x4')]();var fs_extra=require(_0xe88b('0x5'));var auth=require(_0xe88b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe88b('0x7'));var controller=require(_0xe88b('0x8'));router[_0xe88b('0x9')]('/',auth[_0xe88b('0xa')](),controller[_0xe88b('0xb')]);router[_0xe88b('0x9')]('/:id',auth[_0xe88b('0xa')](),controller[_0xe88b('0xc')]);router['get']('/:id/preview',auth[_0xe88b('0xa')](),controller[_0xe88b('0xd')]);router[_0xe88b('0x9')](_0xe88b('0xe'),auth['isAuthenticated'](),controller[_0xe88b('0xf')]);router[_0xe88b('0x9')](_0xe88b('0x10'),auth[_0xe88b('0xa')](),controller[_0xe88b('0x11')]);router[_0xe88b('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe88b('0x13')](_0xe88b('0x14'),auth[_0xe88b('0xa')](),controller[_0xe88b('0x15')]);router[_0xe88b('0x16')](_0xe88b('0x14'),auth[_0xe88b('0xa')](),controller[_0xe88b('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 171b13e..98c0bcc 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 _0xb4c7=['STRING','TEXT','sequelize','exports'];(function(_0x52f159,_0x419d8a){var _0x156799=function(_0xf168e8){while(--_0xf168e8){_0x52f159['push'](_0x52f159['shift']());}};_0x156799(++_0x419d8a);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x4445a9,_0x4d7cc8){_0x4445a9=_0x4445a9-0x0;var _0x18d7f8=_0xb4c7[_0x4445a9];return _0x18d7f8;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'name':{'type':Sequelize[_0x7b4c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7b4c('0x2')]},'parent':{'type':Sequelize[_0x7b4c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7b4c('0x3')]},'joins':{'type':Sequelize[_0x7b4c('0x3')]}}; \ No newline at end of file +var _0x3eea=['STRING','TEXT','sequelize'];(function(_0x2caaaf,_0x34fdb4){var _0x489b29=function(_0x2aa146){while(--_0x2aa146){_0x2caaaf['push'](_0x2caaaf['shift']());}};_0x489b29(++_0x34fdb4);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x2240c1,_0x2657bd){_0x2240c1=_0x2240c1-0x0;var _0x1f0369=_0x3eea[_0x2240c1];return _0x1f0369;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 880a29a..53a0faa 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 _0x2ef3=['Sequelize','from','foreignKey','output','web','fullPath','generate','csv','cdr','startDate','endDate','info','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','runReport','IS\x20NULL','IS\x20NOT\x20EMPTY','metric','Limited\x20Query:','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','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','DefaultReports','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','update','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20EMPTY','operator','rules','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x2ef3,0xba));var _0x32ef=function(_0x5d6f82,_0x1ec9b6){_0x5d6f82=_0x5d6f82-0x0;var _0x4f1af0=_0x2ef3[_0x5d6f82];return _0x4f1af0;};'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'];var dbH=require(_0x32ef('0x18'))['dbH'];function respondWithStatusCode(_0x3e98df,_0x1ef1ae){_0x1ef1ae=_0x1ef1ae||0xcc;return function(_0x5c3eb9){if(_0x5c3eb9){return _0x3e98df['sendStatus'](_0x1ef1ae);}return _0x3e98df[_0x32ef('0x19')](_0x1ef1ae)['end']();};}function respondWithResult(_0x326fce,_0x40a6e6){_0x40a6e6=_0x40a6e6||0xc8;return function(_0x93d492){if(_0x93d492){return _0x326fce[_0x32ef('0x19')](_0x40a6e6)['json'](_0x93d492);}};}function respondWithFilteredResult(_0x55bf0b,_0x531e30){return function(_0x13db1a){if(_0x13db1a){var _0x3950e6=typeof _0x531e30[_0x32ef('0x1a')]==='undefined'&&typeof _0x531e30['limit']===_0x32ef('0x1b');var _0x1a9476=_0x13db1a[_0x32ef('0x1c')];var _0x57863c=_0x3950e6?0x0:_0x531e30[_0x32ef('0x1a')];var _0x33e230=_0x3950e6?_0x13db1a['count']:_0x531e30[_0x32ef('0x1a')]+_0x531e30[_0x32ef('0x1d')];var _0x26aff3;if(_0x33e230>=_0x1a9476){_0x33e230=_0x1a9476;_0x26aff3=0xc8;}else{_0x26aff3=0xce;}_0x55bf0b[_0x32ef('0x19')](_0x26aff3);return _0x55bf0b[_0x32ef('0x1e')](_0x32ef('0x1f'),_0x57863c+'-'+_0x33e230+'/'+_0x1a9476)['json'](_0x13db1a);}return null;};}function patchUpdates(_0x3c5b78){return function(_0x5cc3ef){try{jsonpatch[_0x32ef('0x20')](_0x5cc3ef,_0x3c5b78,!![]);}catch(_0x3a20ca){return BPromise['reject'](_0x3a20ca);}return _0x5cc3ef[_0x32ef('0x21')]();};}function saveUpdates(_0x97780,_0x5e8898){return function(_0x55f7f2){if(_0x55f7f2){return _0x55f7f2['update'](_0x97780)[_0x32ef('0x22')](function(_0xb30fab){return _0xb30fab;});}return null;};}function removeEntity(_0x225feb,_0x478bef){return function(_0x59585f){if(_0x59585f){return _0x59585f[_0x32ef('0x23')]()['then'](function(){var _0x51a412=_0x59585f[_0x32ef('0x24')]({'plain':!![]});var _0x14d4b3=_0x32ef('0x25');return db[_0x32ef('0x26')][_0x32ef('0x23')]({'where':{'type':_0x14d4b3,'resourceId':_0x51a412['id']}})[_0x32ef('0x22')](function(){return _0x59585f;});})[_0x32ef('0x22')](function(){_0x225feb[_0x32ef('0x19')](0xcc)[_0x32ef('0x27')]();});}};}function handleEntityNotFound(_0x2f52d7,_0x1335e2){return function(_0xba4b3f){if(!_0xba4b3f){_0x2f52d7['sendStatus'](0x194);}return _0xba4b3f;};}function handleError(_0xd65fde,_0x2f5d06){_0x2f5d06=_0x2f5d06||0x1f4;return function(_0x5a04cd){logger[_0x32ef('0x28')](_0x5a04cd[_0x32ef('0x29')]);if(_0x5a04cd[_0x32ef('0x2a')]){delete _0x5a04cd[_0x32ef('0x2a')];}_0xd65fde['status'](_0x2f5d06)[_0x32ef('0x2b')](_0x5a04cd);};}exports[_0x32ef('0x2c')]=function(_0x31dbc3,_0x2ac686){var _0x1b668a={},_0x1a6ed2={},_0x1a122d={'count':0x0,'rows':[]};var _0x575f3e=_[_0x32ef('0x2d')](db['AnalyticDefaultReport'][_0x32ef('0x2e')],function(_0x2b6c6a){return{'name':_0x2b6c6a['fieldName'],'type':_0x2b6c6a[_0x32ef('0x2f')][_0x32ef('0x30')]};});_0x1a6ed2[_0x32ef('0x31')]=_[_0x32ef('0x2d')](_0x575f3e,_0x32ef('0x2a'));_0x1a6ed2['query']=_['keys'](_0x31dbc3[_0x32ef('0x32')]);_0x1a6ed2['filters']=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],_0x1a6ed2[_0x32ef('0x32')]);_0x1b668a[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],qs['fields'](_0x31dbc3['query']['fields']));_0x1b668a[_0x32ef('0x34')]=_0x1b668a[_0x32ef('0x34')][_0x32ef('0x35')]?_0x1b668a['attributes']:_0x1a6ed2['model'];if(!_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x36')](_0x32ef('0x37'))){_0x1b668a['limit']=qs['limit'](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1d')]);_0x1b668a[_0x32ef('0x1a')]=qs[_0x32ef('0x1a')](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1a')]);}_0x1b668a[_0x32ef('0x38')]=qs[_0x32ef('0x39')](_0x31dbc3[_0x32ef('0x32')]['sort']);_0x1b668a[_0x32ef('0x3a')]=qs[_0x32ef('0x3b')](_[_0x32ef('0x3c')](_0x31dbc3['query'],_0x1a6ed2[_0x32ef('0x3b')]),_0x575f3e);if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x3d')]){_0x1b668a[_0x32ef('0x3a')]=_[_0x32ef('0x3e')](_0x1b668a[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x2d')](_0x575f3e,function(_0x1cebed){if(_0x1cebed[_0x32ef('0x2f')]!==_0x32ef('0x3f')){var _0xb4db74={};_0xb4db74[_0x1cebed[_0x32ef('0x2a')]]={'$like':'%'+_0x31dbc3['query'][_0x32ef('0x3d')]+'%'};return _0xb4db74;}})});}_0x1b668a=_[_0x32ef('0x3e')]({},_0x1b668a,_0x31dbc3[_0x32ef('0x40')]);var _0x1733e3={'where':_0x1b668a[_0x32ef('0x3a')]};return db[_0x32ef('0x41')][_0x32ef('0x1c')](_0x1733e3)['then'](function(_0x538758){_0x1a122d[_0x32ef('0x1c')]=_0x538758;if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x42')]){_0x1b668a[_0x32ef('0x43')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x32ef('0x44')](_0x1b668a);})[_0x32ef('0x22')](function(_0x5d2f06){_0x1a122d[_0x32ef('0x45')]=_0x5d2f06;return _0x1a122d;})['then'](respondWithFilteredResult(_0x2ac686,_0x1b668a))[_0x32ef('0x46')](handleError(_0x2ac686,null));};exports[_0x32ef('0x47')]=function(_0x37a497,_0x3be46d){var _0x2c2b62={'raw':!![],'where':{'id':_0x37a497[_0x32ef('0x48')]['id']}},_0x2310ae={};_0x2310ae[_0x32ef('0x31')]=_[_0x32ef('0x49')](db[_0x32ef('0x41')]['rawAttributes']);_0x2310ae[_0x32ef('0x32')]=_['keys'](_0x37a497[_0x32ef('0x32')]);_0x2310ae[_0x32ef('0x3b')]=_[_0x32ef('0x33')](_0x2310ae['model'],_0x2310ae[_0x32ef('0x32')]);_0x2c2b62[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x2310ae[_0x32ef('0x31')],qs[_0x32ef('0x4a')](_0x37a497[_0x32ef('0x32')][_0x32ef('0x4a')]));_0x2c2b62['attributes']=_0x2c2b62['attributes'][_0x32ef('0x35')]?_0x2c2b62[_0x32ef('0x34')]:_0x2310ae[_0x32ef('0x31')];if(_0x37a497[_0x32ef('0x32')][_0x32ef('0x42')]){_0x2c2b62[_0x32ef('0x43')]=[{'all':!![]}];}_0x2c2b62=_[_0x32ef('0x3e')]({},_0x2c2b62,_0x37a497[_0x32ef('0x40')]);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2c2b62)[_0x32ef('0x22')](handleEntityNotFound(_0x3be46d,null))[_0x32ef('0x22')](respondWithResult(_0x3be46d,null))[_0x32ef('0x46')](handleError(_0x3be46d,null));};exports['create']=function(_0x420f00,_0x12fbd7){return db[_0x32ef('0x41')][_0x32ef('0x4c')](_0x420f00[_0x32ef('0x4d')],{})[_0x32ef('0x22')](function(_0x278696){var _0x1acded=_0x420f00[_0x32ef('0x4e')][_0x32ef('0x24')]({'plain':!![]});if(!_0x1acded)throw new Error(_0x32ef('0x4f'));if(_0x1acded[_0x32ef('0x50')]===_0x32ef('0x4e')){var _0x326445=_0x278696[_0x32ef('0x24')]({'plain':!![]});var _0x3fb4d8=_0x32ef('0x51');return db[_0x32ef('0x52')]['find']({'where':{'name':_0x3fb4d8,'userProfileId':_0x1acded['userProfileId']},'raw':!![]})[_0x32ef('0x22')](function(_0x259c32){if(_0x259c32&&_0x259c32[_0x32ef('0x53')]===0x0){return db[_0x32ef('0x26')][_0x32ef('0x4c')]({'name':_0x326445[_0x32ef('0x2a')],'resourceId':_0x326445['id'],'type':_0x32ef('0x25'),'sectionId':_0x259c32['id']},{})[_0x32ef('0x22')](function(){return _0x278696;});}else{return _0x278696;}})[_0x32ef('0x46')](function(_0x368bf1){logger[_0x32ef('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x368bf1);throw _0x368bf1;});}return _0x278696;})[_0x32ef('0x22')](respondWithResult(_0x12fbd7,0xc9))[_0x32ef('0x46')](handleError(_0x12fbd7,null));};exports[_0x32ef('0x54')]=function(_0x3fe01f,_0x38314a){if(_0x3fe01f[_0x32ef('0x4d')]['id']){delete _0x3fe01f['body']['id'];}return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x3fe01f[_0x32ef('0x48')]['id']}})['then'](handleEntityNotFound(_0x38314a,null))[_0x32ef('0x22')](saveUpdates(_0x3fe01f['body'],null))[_0x32ef('0x22')](respondWithResult(_0x38314a,null))[_0x32ef('0x46')](handleError(_0x38314a,null));};exports['destroy']=function(_0x206ad5,_0x59e5f9){return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x206ad5[_0x32ef('0x48')]['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x59e5f9,null))[_0x32ef('0x22')](removeEntity(_0x59e5f9,null))[_0x32ef('0x46')](handleError(_0x59e5f9,null));};exports[_0x32ef('0x55')]=function(_0x56260f,_0x56cc75){var _0xdfa103=0xa;var _0x52232a=['join',_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0x6aae59={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0xbd059e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2ac877=function(_0x3c31d0){return!_[_0x32ef('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x3c31d0);};var _0x17f447=function(_0x5bb114){if(!_0x5bb114||!_0x5bb114['rules'][_0x32ef('0x35')]){return'';}for(var _0x208989='(',_0x10cb37=0x0;_0x10cb37<_0x5bb114['rules'][_0x32ef('0x35')];_0x10cb37+=0x1){_0x10cb37>0x0&&(_0x208989+='\x20'+_0x5bb114[_0x32ef('0x65')]+'\x20');_0x208989+=_0x5bb114[_0x32ef('0x66')][_0x10cb37]['group']?_0x17f447(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x67')]):_0x5bb114['rules'][_0x10cb37]['field']+'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')]+(_0x2ac877(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')])?'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x69')]:'');}return _0x208989+')';};var _0x4c89e8={'where':{'id':_0x56260f[_0x32ef('0x48')]['id']}},_0x285330,_0x63b65,_0x25b6d6,_0x36ed97,_0x21e930;_0x4c89e8=_[_0x32ef('0x3e')]({},_0x4c89e8,_0x56260f[_0x32ef('0x40')]);return db[_0x32ef('0x41')]['find'](_0x4c89e8)[_0x32ef('0x22')](function(_0x29ff58){if(_0x29ff58){_0x285330=_0x29ff58;return _0x29ff58[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0x79ae28){if(_0x79ae28){if(!_0x79ae28['length']){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x63b65=_0x79ae28;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x526fb1){if(_0x526fb1){_0x25b6d6=_[_0x32ef('0x6e')](_0x526fb1,'id');var _0x544045;var _0x216e2f=squel[_0x32ef('0x6f')]();_0x216e2f['from'](_0x285330['table']);for(var _0x2c9f7a=0x0;_0x2c9f7a<_0x63b65[_0x32ef('0x35')];_0x2c9f7a+=0x1){_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x70')]?_0x25b6d6[_0x63b65[_0x2c9f7a]['MetricId']]['metric']:_0x63b65[_0x2c9f7a][_0x32ef('0x71')];_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x6aae59[_0x63b65[_0x2c9f7a][_0x32ef('0x72')]],'%s',_0x544045):_0x544045;_0x544045=_0x63b65[_0x2c9f7a]['format']?_[_0x32ef('0x73')](_0xbd059e[_0x63b65[_0x2c9f7a][_0x32ef('0x74')]],'%s',_0x544045):_0x544045;if(_0x63b65[_0x2c9f7a][_0x32ef('0x75')]){_0x216e2f[_0x32ef('0x67')](_0x544045);}_0x63b65[_0x2c9f7a][_0x32ef('0x76')]&&_0x216e2f[_0x32ef('0x38')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x216e2f[_0x32ef('0x71')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x78')]||_0x544045);}if(_0x285330[_0x32ef('0x79')]){_0x285330[_0x32ef('0x79')]=JSON['parse'](_0x285330['joins']);for(var _0x3a9c97=0x0;_0x3a9c97<_0x285330[_0x32ef('0x79')]['length'];_0x3a9c97+=0x1){if(_0x285330[_0x32ef('0x79')][_0x3a9c97]['type']&&_[_0x32ef('0x63')](_0x52232a,_0x285330[_0x32ef('0x79')][_0x3a9c97][_0x32ef('0x2f')])&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7a')]&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')]&&_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']){_0x216e2f[_0x285330['joins'][_0x3a9c97][_0x32ef('0x2f')]](_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')],null,util['format'](_0x32ef('0x7c'),_0x285330[_0x32ef('0x7d')],_0x285330[_0x32ef('0x79')][_0x3a9c97]['parentKey'],_0x285330['joins'][_0x3a9c97]['foreignTable'],_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']));}}}if(_0x285330[_0x32ef('0x7e')]){_0x285330[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x285330[_0x32ef('0x7e')]);_0x216e2f[_0x32ef('0x3a')](_0x17f447(_0x285330[_0x32ef('0x7e')]['group']));}_0x21e930=_0x216e2f[_0x32ef('0x80')]();_0x216e2f['limit'](_0xdfa103);_0x216e2f['offset'](0x0);logger[_0x32ef('0x81')]('Limited\x20Query:',_0x216e2f[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')]['query'](_0x216e2f[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')][_0x32ef('0x84')][_0x32ef('0x85')]});}})[_0x32ef('0x22')](respondWithResult(_0x56cc75,null))[_0x32ef('0x46')](handleError(_0x56cc75,null));};function runReport(_0x4b5506,_0x51736f,_0x35b10d){var _0x5e0b55=_0x51736f[_0x32ef('0x2a')];var _0x266688=0xa;var _0x114d8e=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),'cross_join'];var _0x3232ca={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':_0x32ef('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x211fb1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0xfb4845=function(_0x21067e){return!_[_0x32ef('0x63')](['IS\x20NULL',_0x32ef('0x8b'),_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x21067e);};var _0x35653b=function(_0x5ea727){if(!_0x5ea727||!_0x5ea727[_0x32ef('0x66')]['length']){return'';}for(var _0x43f36e='(',_0x39300f=0x0;_0x39300f<_0x5ea727[_0x32ef('0x66')][_0x32ef('0x35')];_0x39300f+=0x1){_0x39300f>0x0&&(_0x43f36e+='\x20'+_0x5ea727['operator']+'\x20');_0x43f36e+=_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x67')]?_0x35653b(_0x5ea727[_0x32ef('0x66')][_0x39300f]['group']):_0x5ea727['rules'][_0x39300f]['field']+'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')]+(_0xfb4845(_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')])?'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f]['value']:'');}return _0x43f36e+')';};var _0x2678e3={'where':{'id':_0x4b5506['id']}},_0x5b3deb,_0x471de6,_0x7b0ea5,_0xc43e1,_0x4baa7a;_0x2678e3=_[_0x32ef('0x3e')]({},_0x2678e3,_0x35b10d);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2678e3)[_0x32ef('0x22')](function(_0x28bebb){if(_0x28bebb){_0x5b3deb=_0x28bebb;return _0x28bebb['getFields']();}return null;})[_0x32ef('0x22')](function(_0x484df0){if(_0x484df0){if(!_0x484df0[_0x32ef('0x35')]){throw new db[(_0x32ef('0x8c'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x471de6=_0x484df0;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x3b9896){if(_0x3b9896){_0x7b0ea5=_['keyBy'](_0x3b9896,'id');var _0x356fd4;var _0x51ca6e=squel['select']();_0x51ca6e[_0x32ef('0x8d')](_0x5b3deb['table']);for(var _0x2237cf=0x0;_0x2237cf<_0x471de6[_0x32ef('0x35')];_0x2237cf+=0x1){_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x70')]?_0x7b0ea5[_0x471de6[_0x2237cf]['MetricId']]['metric']:_0x471de6[_0x2237cf][_0x32ef('0x71')];_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x3232ca[_0x471de6[_0x2237cf][_0x32ef('0x72')]],'%s',_0x356fd4):_0x356fd4;_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x211fb1[_0x471de6[_0x2237cf][_0x32ef('0x74')]],'%s',_0x356fd4):_0x356fd4;if(_0x471de6[_0x2237cf]['groupBy']){_0x51ca6e[_0x32ef('0x67')](_0x356fd4);}_0x471de6[_0x2237cf][_0x32ef('0x76')]&&_0x51ca6e[_0x32ef('0x38')](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x76')]==='DESC'?![]:!![]);_0x51ca6e['field'](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x78')]||_0x356fd4);}if(_0x5b3deb['joins']){_0x5b3deb[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x5b3deb['joins']);for(var _0x5c7594=0x0;_0x5c7594<_0x5b3deb['joins'][_0x32ef('0x35')];_0x5c7594+=0x1){if(_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x2f')]&&_[_0x32ef('0x63')](_0x114d8e,_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x2f')])&&_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x8e')]){_0x51ca6e[_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['type']](_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')],null,util[_0x32ef('0x74')](_0x32ef('0x7c'),_0x5b3deb[_0x32ef('0x7d')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7b')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['foreignKey']));}}}if(_0x5b3deb[_0x32ef('0x7e')]){_0x5b3deb['conditions']=JSON[_0x32ef('0x7f')](_0x5b3deb[_0x32ef('0x7e')]);_0x51ca6e[_0x32ef('0x3a')](_0x35653b(_0x5b3deb[_0x32ef('0x7e')][_0x32ef('0x67')]));}_0x4baa7a=_0x51ca6e['clone']();_0x51ca6e[_0x32ef('0x1d')](_0x266688);_0x51ca6e[_0x32ef('0x1a')](0x0);return;}})[_0x32ef('0x22')](function(){if(_0x51736f[_0x32ef('0x8f')]===_0x32ef('0x90')){return null;}var _0x1cfdd8=_[_0x32ef('0x3e')](_0x51736f,{'name':_0x51736f[_0x32ef('0x91')]||_0x51736f[_0x32ef('0x2a')]||_0x5b3deb['name'],'basename':_0x5e0b55,'savename':util['format']('%s-%s.%s',_0x51736f[_0x32ef('0x2a')]||_0x5b3deb[_0x32ef('0x2a')],require('randomstring')[_0x32ef('0x92')](0x4),_0x51736f['output']||_0x32ef('0x93')),'reportId':_0x5b3deb['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0x32ef('0x4c')](_0x1cfdd8,{'raw':!![]});})[_0x32ef('0x22')](function(_0x118d2e){if(_0x5b3deb[_0x32ef('0x7d')]===_0x32ef('0x94')){_0x4baa7a['where'](_0x5b3deb[_0x32ef('0x7d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x51736f[_0x32ef('0x95')],_0x51736f['endDate']);}else{_0x4baa7a['where'](_0x5b3deb['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x51736f['startDate'],_0x51736f[_0x32ef('0x96')]);}if(_0x118d2e){logger[_0x32ef('0x97')]('Run\x20Query:',_0x4baa7a[_0x32ef('0x82')]());require(_0x32ef('0x98'))[_0x32ef('0x99')](path[_0x32ef('0x86')](__dirname,_0x32ef('0x9a'),_0x118d2e[_0x32ef('0x8f')]),[_0x118d2e['id'],_0x4baa7a['toString'](),path[_0x32ef('0x86')](__dirname,'../../files/reports',_0x118d2e[_0x32ef('0x9b')]),_0x5e0b55]);return _0x118d2e;}else{var _0x1be713=squel['select']();_0x1be713[_0x32ef('0x8d')]('('+_0x4baa7a['toString']()+')',_0x32ef('0x9c'));_0x1be713[_0x32ef('0x71')](_0x32ef('0x9d'),_0x32ef('0x1c'));_0x4baa7a['limit'](_0x51736f[_0x32ef('0x1d')]||_0x266688);_0x4baa7a[_0x32ef('0x1a')](_0x51736f[_0x32ef('0x1a')]||0x0);return dbH[_0x32ef('0x83')]['query'](_0x1be713[_0x32ef('0x82')](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]})[_0x32ef('0x22')](function(_0x28ef17){if(!_0x28ef17[_0x32ef('0x35')]){_0xc43e1=0x0;}else{_0xc43e1=_0x28ef17[0x0][_0x32ef('0x1c')]||0x0;}return dbH['sequelize'][_0x32ef('0x32')](_0x4baa7a['toString'](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]});})[_0x32ef('0x22')](function(_0x3956e7){return{'rows':_0x3956e7||[],'count':_0xc43e1};});}});}exports['run']=function(_0x8d3b24,_0x642716){return runReport(_0x8d3b24[_0x32ef('0x48')],_0x8d3b24[_0x32ef('0x32')],_0x8d3b24['options'])['then'](respondWithResult(_0x642716,null))['catch'](handleError(_0x642716,null));};exports[_0x32ef('0x9e')]=runReport;exports[_0x32ef('0x32')]=function(_0x4454f3,_0xc92dcc){var _0x3d18b9=0xa;var _0x9233cb=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0xa76912={'SUM':'SUM(%s)','COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0x1526a1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0x2d4d2f=function(_0x292488){return!_[_0x32ef('0x63')]([_0x32ef('0x9f'),_0x32ef('0x8b'),_0x32ef('0x64'),_0x32ef('0xa0')],_0x292488);};var _0x50b674=function(_0x379d40){if(!_0x379d40||!_0x379d40[_0x32ef('0x66')][_0x32ef('0x35')]){return'';}for(var _0x4b7a4d='(',_0x16525b=0x0;_0x16525b<_0x379d40['rules'][_0x32ef('0x35')];_0x16525b+=0x1){_0x16525b>0x0&&(_0x4b7a4d+='\x20'+_0x379d40[_0x32ef('0x65')]+'\x20');_0x4b7a4d+=_0x379d40[_0x32ef('0x66')][_0x16525b]['group']?_0x50b674(_0x379d40[_0x32ef('0x66')][_0x16525b]['group']):_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x71')]+'\x20'+_0x379d40['rules'][_0x16525b][_0x32ef('0x68')]+(_0x2d4d2f(_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x68')])?'\x20'+_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x69')]:'');}return _0x4b7a4d+')';};var _0x264075={'where':{'id':_0x4454f3[_0x32ef('0x48')]['id']}},_0x3798d1,_0x4befa9,_0x493ae9,_0x143d39,_0x497948;_0x264075=_[_0x32ef('0x3e')]({},_0x264075,_0x4454f3['options']);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x264075)['then'](function(_0x1200c9){if(_0x1200c9){_0x3798d1=_0x1200c9;return _0x1200c9[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0xa5f787){if(_0xa5f787){if(!_0xa5f787[_0x32ef('0x35')]){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x4befa9=_0xa5f787;return db['AnalyticMetric'][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x55ad11){if(_0x55ad11){_0x493ae9=_[_0x32ef('0x6e')](_0x55ad11,'id');var _0x2971a8;var _0x522c22=squel[_0x32ef('0x6f')]();_0x522c22[_0x32ef('0x8d')](_0x3798d1['table']);for(var _0xb41a01=0x0;_0xb41a01<_0x4befa9[_0x32ef('0x35')];_0xb41a01+=0x1){_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x70')]?_0x493ae9[_0x4befa9[_0xb41a01][_0x32ef('0x70')]][_0x32ef('0xa1')]:_0x4befa9[_0xb41a01][_0x32ef('0x71')];_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x72')]?_['replace'](_0xa76912[_0x4befa9[_0xb41a01]['function']],'%s',_0x2971a8):_0x2971a8;_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x1526a1[_0x4befa9[_0xb41a01][_0x32ef('0x74')]],'%s',_0x2971a8):_0x2971a8;if(_0x4befa9[_0xb41a01]['groupBy']){_0x522c22[_0x32ef('0x67')](_0x2971a8);}_0x4befa9[_0xb41a01][_0x32ef('0x76')]&&_0x522c22['order'](_0x2971a8,_0x4befa9[_0xb41a01][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x522c22['field'](_0x2971a8,_0x4befa9[_0xb41a01]['alias']||_0x2971a8);}if(_0x3798d1[_0x32ef('0x79')]){_0x3798d1[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x3798d1['joins']);for(var _0x5f4eab=0x0;_0x5f4eab<_0x3798d1['joins'][_0x32ef('0x35')];_0x5f4eab+=0x1){if(_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')]&&_['includes'](_0x9233cb,_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')])&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['parentKey']&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')]&&_0x3798d1['joins'][_0x5f4eab]['foreignKey']){_0x522c22[_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['type']](_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3798d1[_0x32ef('0x7d')],_0x3798d1['joins'][_0x5f4eab][_0x32ef('0x7a')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x8e')]));}}}if(_0x3798d1[_0x32ef('0x7e')]){_0x3798d1[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x3798d1[_0x32ef('0x7e')]);_0x522c22[_0x32ef('0x3a')](_0x50b674(_0x3798d1['conditions']['group']));}_0x497948=_0x522c22[_0x32ef('0x80')]();_0x522c22[_0x32ef('0x1d')](_0x3d18b9);_0x522c22[_0x32ef('0x1a')](0x0);logger[_0x32ef('0x81')](_0x32ef('0xa2'),_0x522c22[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')][_0x32ef('0x32')](_0x522c22[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')]['QueryTypes'][_0x32ef('0x85')]});}})[_0x32ef('0x22')](function(){return{'sql':_0x497948[_0x32ef('0x82')]()};})[_0x32ef('0x22')](respondWithResult(_0xc92dcc,null))[_0x32ef('0x46')](handleError(_0xc92dcc,null));}; \ No newline at end of file +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(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x28ca8a,_0xc92ce8){_0x28ca8a=_0x28ca8a-0x0;var _0x14b711=_0xc6ac[_0x28ca8a];return _0x14b711;};'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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index d6446dc..5853dd1 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 _0x028e=['bluebird','../../config/environment','./analyticDefaultReport.attributes','exports','analytics_default_reports','lodash','util','../../config/logger','api'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x028e,0x71));var _0xe028=function(_0x11f24d,_0x58f26a){_0x11f24d=_0x11f24d-0x0;var _0x1a86e6=_0x028e[_0x11f24d];return _0x1a86e6;};'use strict';var _=require(_0xe028('0x0'));var util=require(_0xe028('0x1'));var logger=require(_0xe028('0x2'))(_0xe028('0x3'));var moment=require('moment');var BPromise=require(_0xe028('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe028('0x5'));var attributes=require(_0xe028('0x6'));module[_0xe028('0x7')]=function(_0x34e511,_0x3bc0d6){return _0x34e511['define']('AnalyticDefaultReport',attributes,{'tableName':_0xe028('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dc1=['../../config/logger','api','bluebird','path','rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','util'];(function(_0xf86904,_0x229152){var _0x589de0=function(_0x1656d9){while(--_0x1656d9){_0xf86904['push'](_0xf86904['shift']());}};_0x589de0(++_0x229152);}(_0x3dc1,0xa4));var _0x13dc=function(_0x98bcc,_0x269ed3){_0x98bcc=_0x98bcc-0x0;var _0x2c32bd=_0x3dc1[_0x98bcc];return _0x2c32bd;};'use strict';var _=require('lodash');var util=require(_0x13dc('0x0'));var logger=require(_0x13dc('0x1'))(_0x13dc('0x2'));var moment=require('moment');var BPromise=require(_0x13dc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x13dc('0x4'));var rimraf=require(_0x13dc('0x5'));var config=require('../../config/environment');var attributes=require(_0x13dc('0x6'));module[_0x13dc('0x7')]=function(_0x1d0714,_0x170e2f){return _0x1d0714[_0x13dc('0x8')](_0x13dc('0x9'),attributes,{'tableName':_0x13dc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index adc83fa..529888f 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 _0xb711=['util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x7d152a,_0x2e9d56){var _0x35c0ae=function(_0x598bd4){while(--_0x598bd4){_0x7d152a['push'](_0x7d152a['shift']());}};_0x35c0ae(++_0x2e9d56);}(_0xb711,0x113));var _0x1b71=function(_0x2e0b2f,_0x25172b){_0x2e0b2f=_0x2e0b2f-0x0;var _0x5cf0fa=_0xb711[_0x2e0b2f];return _0x5cf0fa;};'use strict';var _=require(_0x1b71('0x0'));var util=require(_0x1b71('0x1'));var moment=require('moment');var BPromise=require(_0x1b71('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b71('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b71('0x4'))(_0x1b71('0x5'));var config=require(_0x1b71('0x6'));var jayson=require(_0x1b71('0x7'));var client=jayson[_0x1b71('0x8')][_0x1b71('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x498ed5,_0x276dff,_0x301e89){return new BPromise(function(_0xa642e0,_0xece037){return client[_0x1b71('0xa')](_0x498ed5,_0x301e89)[_0x1b71('0xb')](function(_0x5b5ba7){logger['info'](_0x1b71('0xc'),_0x276dff,_0x1b71('0xd'));logger[_0x1b71('0xe')](_0x1b71('0xf'),_0x276dff,_0x1b71('0xd'),JSON[_0x1b71('0x10')](_0x5b5ba7));if(_0x5b5ba7[_0x1b71('0x11')]){if(_0x5b5ba7['error'][_0x1b71('0x12')]===0x1f4){logger[_0x1b71('0x11')](_0x1b71('0xc'),_0x276dff,_0x5b5ba7['error'][_0x1b71('0x13')]);return _0xece037(_0x5b5ba7[_0x1b71('0x11')][_0x1b71('0x13')]);}logger[_0x1b71('0x11')](_0x1b71('0xc'),_0x276dff,_0x5b5ba7[_0x1b71('0x11')][_0x1b71('0x13')]);return _0xa642e0(_0x5b5ba7[_0x1b71('0x11')][_0x1b71('0x13')]);}else{logger[_0x1b71('0x14')](_0x1b71('0xc'),_0x276dff,'request\x20sent');_0xa642e0(_0x5b5ba7[_0x1b71('0x15')][_0x1b71('0x13')]);}})[_0x1b71('0x16')](function(_0x409816){logger[_0x1b71('0x11')](_0x1b71('0xc'),_0x276dff,_0x409816);_0xece037(_0x409816);});});} \ No newline at end of file +var _0x39ee=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x3f39e5,_0x2bb924){var _0x65dc38=function(_0x1447d4){while(--_0x1447d4){_0x3f39e5['push'](_0x3f39e5['shift']());}};_0x65dc38(++_0x2bb924);}(_0x39ee,0x15d));var _0xe39e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x39ee[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe39e('0x0'));var util=require(_0xe39e('0x1'));var moment=require(_0xe39e('0x2'));var BPromise=require(_0xe39e('0x3'));var rs=require(_0xe39e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe39e('0x5'))['db'];var utils=require(_0xe39e('0x6'));var logger=require('../../config/logger')(_0xe39e('0x7'));var config=require(_0xe39e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe39e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb2964c,_0x3e549f,_0x4bdc6c){return new BPromise(function(_0x5abce7,_0x2ec224){return client[_0xe39e('0xa')](_0xb2964c,_0x4bdc6c)[_0xe39e('0xb')](function(_0x58cb80){logger[_0xe39e('0xc')](_0xe39e('0xd'),_0x3e549f,_0xe39e('0xe'));logger['debug'](_0xe39e('0xf'),_0x3e549f,_0xe39e('0xe'),JSON[_0xe39e('0x10')](_0x58cb80));if(_0x58cb80[_0xe39e('0x11')]){if(_0x58cb80[_0xe39e('0x11')][_0xe39e('0x12')]===0x1f4){logger['error'](_0xe39e('0xd'),_0x3e549f,_0x58cb80[_0xe39e('0x11')][_0xe39e('0x13')]);return _0x2ec224(_0x58cb80[_0xe39e('0x11')][_0xe39e('0x13')]);}logger[_0xe39e('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3e549f,_0x58cb80[_0xe39e('0x11')][_0xe39e('0x13')]);return _0x5abce7(_0x58cb80[_0xe39e('0x11')][_0xe39e('0x13')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x3e549f,_0xe39e('0xe'));_0x5abce7(_0x58cb80[_0xe39e('0x14')]['message']);}})[_0xe39e('0x15')](function(_0xff199c){logger[_0xe39e('0x11')](_0xe39e('0xd'),_0x3e549f,_0xff199c);_0x2ec224(_0xff199c);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index ca6b3c1..3bdc654 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 _0x19b7=['get','isAuthenticated','/:id/preview','/:id/run','run','/:id/query','query','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x19b7,0x157));var _0x719b=function(_0x47ca08,_0x3c48da){_0x47ca08=_0x47ca08-0x0;var _0x17636f=_0x19b7[_0x47ca08];return _0x17636f;};'use strict';var multer=require('multer');var util=require(_0x719b('0x0'));var path=require(_0x719b('0x1'));var timeout=require(_0x719b('0x2'));var express=require(_0x719b('0x3'));var router=express[_0x719b('0x4')]();var fs_extra=require(_0x719b('0x5'));var auth=require(_0x719b('0x6'));var interaction=require(_0x719b('0x7'));var config=require('../../config/environment');var controller=require(_0x719b('0x8'));router[_0x719b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x719b('0xa')](),controller['show']);router[_0x719b('0x9')](_0x719b('0xb'),auth[_0x719b('0xa')](),controller['preview']);router[_0x719b('0x9')](_0x719b('0xc'),auth[_0x719b('0xa')](),controller[_0x719b('0xd')]);router['get'](_0x719b('0xe'),auth[_0x719b('0xa')](),controller[_0x719b('0xf')]);router['post']('/',auth[_0x719b('0xa')](),controller[_0x719b('0x10')]);router['put'](_0x719b('0x11'),auth[_0x719b('0xa')](),controller[_0x719b('0x12')]);router[_0x719b('0x13')](_0x719b('0x11'),auth['isAuthenticated'](),controller[_0x719b('0x14')]);module[_0x719b('0x15')]=router; \ No newline at end of file +var _0x3d4b=['isAuthenticated','index','/:id','show','preview','/:id/run','/:id/query','query','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get'];(function(_0x54d7dc,_0x31b183){var _0xf4ef3b=function(_0x20a740){while(--_0x20a740){_0x54d7dc['push'](_0x54d7dc['shift']());}};_0xf4ef3b(++_0x31b183);}(_0x3d4b,0xf3));var _0xb3d4=function(_0x10e2e6,_0x17f93d){_0x10e2e6=_0x10e2e6-0x0;var _0x4931c6=_0x3d4b[_0x10e2e6];return _0x4931c6;};'use strict';var multer=require(_0xb3d4('0x0'));var util=require(_0xb3d4('0x1'));var path=require('path');var timeout=require(_0xb3d4('0x2'));var express=require(_0xb3d4('0x3'));var router=express[_0xb3d4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb3d4('0x5'));var interaction=require(_0xb3d4('0x6'));var config=require(_0xb3d4('0x7'));var controller=require(_0xb3d4('0x8'));router[_0xb3d4('0x9')]('/',auth[_0xb3d4('0xa')](),controller[_0xb3d4('0xb')]);router[_0xb3d4('0x9')](_0xb3d4('0xc'),auth[_0xb3d4('0xa')](),controller[_0xb3d4('0xd')]);router[_0xb3d4('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0xb3d4('0xe')]);router[_0xb3d4('0x9')](_0xb3d4('0xf'),auth[_0xb3d4('0xa')](),controller['run']);router[_0xb3d4('0x9')](_0xb3d4('0x10'),auth[_0xb3d4('0xa')](),controller[_0xb3d4('0x11')]);router[_0xb3d4('0x12')]('/',auth[_0xb3d4('0xa')](),controller[_0xb3d4('0x13')]);router[_0xb3d4('0x14')](_0xb3d4('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xb3d4('0x15')](_0xb3d4('0xc'),auth[_0xb3d4('0xa')](),controller['destroy']);module[_0xb3d4('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 a70434e..e9739d8 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 _0x96ad=['moment','exports','STRING','ENUM','pdf','xlsx','csv','DATE','Loading','manual','scheduled','INTEGER'];(function(_0x27e025,_0x2264f3){var _0x563bde=function(_0x22cd55){while(--_0x22cd55){_0x27e025['push'](_0x27e025['shift']());}};_0x563bde(++_0x2264f3);}(_0x96ad,0xf0));var _0xd96a=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0x96ad[_0x28a5ad];return _0x176b8a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd96a('0x0'));module[_0xd96a('0x1')]={'name':{'type':Sequelize[_0xd96a('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xd96a('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xd96a('0x3')]('csv',_0xd96a('0x4'),_0xd96a('0x5')),'allowNull':![],'defaultValue':_0xd96a('0x6')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xd96a('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0xd96a('0x8')},'type':{'type':Sequelize[_0xd96a('0x3')](_0xd96a('0x9'),_0xd96a('0xa')),'allowNull':![],'defaultValue':_0xd96a('0x9')},'reportId':{'type':Sequelize[_0xd96a('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xd96a('0x2')]}}; \ No newline at end of file +var _0xa5d8=['INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','scheduled'];(function(_0x515283,_0x813dea){var _0x38f836=function(_0x40c8f4){while(--_0x40c8f4){_0x515283['push'](_0x515283['shift']());}};_0x38f836(++_0x813dea);}(_0xa5d8,0x1af));var _0x8a5d=function(_0x46c80e,_0x204394){_0x46c80e=_0x46c80e-0x0;var _0x36be59=_0xa5d8[_0x46c80e];return _0x36be59;};'use strict';var Sequelize=require(_0x8a5d('0x0'));var moment=require(_0x8a5d('0x1'));module[_0x8a5d('0x2')]={'name':{'type':Sequelize[_0x8a5d('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x8a5d('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x8a5d('0x4')](_0x8a5d('0x5'),_0x8a5d('0x6'),_0x8a5d('0x7')),'allowNull':![],'defaultValue':_0x8a5d('0x5')},'savename':{'type':Sequelize[_0x8a5d('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8a5d('0x8')]},'endDate':{'type':Sequelize[_0x8a5d('0x8')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x8a5d('0x9')},'type':{'type':Sequelize[_0x8a5d('0x4')]('manual',_0x8a5d('0xa')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x8a5d('0xb')](0xb)[_0x8a5d('0xc')]},'reportType':{'type':Sequelize[_0x8a5d('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 2572f5f..8459b8b 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 _0x4f68=['savename','output','existsSync','root','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','%s.%s','toLowerCase','zip-dir','request-promise','bluebird','mustache','path','sox','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','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','error','name','index','map','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','AnalyticExtractedReport','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','download'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x4f68,0x11e));var _0x84f6=function(_0x240449,_0x512fd9){_0x240449=_0x240449-0x0;var _0x1ac45e=_0x4f68[_0x240449];return _0x1ac45e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x84f6('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x84f6('0x1'));var moment=require('moment');var BPromise=require(_0x84f6('0x2'));var Mustache=require(_0x84f6('0x3'));var util=require('util');var path=require(_0x84f6('0x4'));var sox=require(_0x84f6('0x5'));var csv=require(_0x84f6('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x84f6('0x7'));var _=require(_0x84f6('0x8'));var squel=require(_0x84f6('0x9'));var crypto=require(_0x84f6('0xa'));var jsforce=require(_0x84f6('0xb'));var deskjs=require(_0x84f6('0xc'));var toCsv=require(_0x84f6('0x6'));var querystring=require(_0x84f6('0xd'));var Papa=require(_0x84f6('0xe'));var Redis=require('ioredis');var authService=require(_0x84f6('0xf'));var qs=require(_0x84f6('0x10'));var as=require(_0x84f6('0x11'));var hardwareService=require(_0x84f6('0x12'));var logger=require(_0x84f6('0x13'))(_0x84f6('0x14'));var utils=require(_0x84f6('0x15'));var config=require(_0x84f6('0x16'));var licenseUtil=require(_0x84f6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b4d37,_0x418809){_0x418809=_0x418809||0xcc;return function(_0xbcaad7){if(_0xbcaad7){return _0x1b4d37[_0x84f6('0x18')](_0x418809);}return _0x1b4d37[_0x84f6('0x19')](_0x418809)[_0x84f6('0x1a')]();};}function respondWithResult(_0x39699d,_0x4a5733){_0x4a5733=_0x4a5733||0xc8;return function(_0x4b349c){if(_0x4b349c){return _0x39699d['status'](_0x4a5733)[_0x84f6('0x1b')](_0x4b349c);}};}function respondWithFilteredResult(_0x578c81,_0x54adbb){return function(_0x139374){if(_0x139374){var _0x288066=typeof _0x54adbb[_0x84f6('0x1c')]==='undefined'&&typeof _0x54adbb[_0x84f6('0x1d')]==='undefined';var _0x32115f=_0x139374['count'];var _0x15c6bb=_0x288066?0x0:_0x54adbb['offset'];var _0x3d1cec=_0x288066?_0x139374[_0x84f6('0x1e')]:_0x54adbb[_0x84f6('0x1c')]+_0x54adbb[_0x84f6('0x1d')];var _0x1fd074;if(_0x3d1cec>=_0x32115f){_0x3d1cec=_0x32115f;_0x1fd074=0xc8;}else{_0x1fd074=0xce;}_0x578c81[_0x84f6('0x19')](_0x1fd074);return _0x578c81[_0x84f6('0x1f')](_0x84f6('0x20'),_0x15c6bb+'-'+_0x3d1cec+'/'+_0x32115f)[_0x84f6('0x1b')](_0x139374);}return null;};}function patchUpdates(_0x37abb8){return function(_0x224b15){try{jsonpatch[_0x84f6('0x21')](_0x224b15,_0x37abb8,!![]);}catch(_0x18316e){return BPromise[_0x84f6('0x22')](_0x18316e);}return _0x224b15['save']();};}function saveUpdates(_0x176abe,_0x4c1f33){return function(_0x38b7eb){if(_0x38b7eb){return _0x38b7eb[_0x84f6('0x23')](_0x176abe)[_0x84f6('0x24')](function(_0x392bf3){return _0x392bf3;});}return null;};}function removeEntity(_0x24c011,_0x2d7733){return function(_0x3aff59){if(_0x3aff59){return _0x3aff59[_0x84f6('0x25')]()['then'](function(){var _0x57cd1a=_0x3aff59[_0x84f6('0x26')]({'plain':!![]});var _0x1f07c3='ExtractedReports';return db['UserProfileResource'][_0x84f6('0x25')]({'where':{'type':_0x1f07c3,'resourceId':_0x57cd1a['id']}})[_0x84f6('0x24')](function(){return _0x3aff59;});})[_0x84f6('0x24')](function(){_0x24c011['status'](0xcc)[_0x84f6('0x1a')]();});}};}function handleEntityNotFound(_0x3c7162,_0x43f65f){return function(_0x45d494){if(!_0x45d494){_0x3c7162[_0x84f6('0x18')](0x194);}return _0x45d494;};}function handleError(_0x4dfcbe,_0x31f460){_0x31f460=_0x31f460||0x1f4;return function(_0x5ce0b2){logger[_0x84f6('0x27')](_0x5ce0b2['stack']);if(_0x5ce0b2[_0x84f6('0x28')]){delete _0x5ce0b2[_0x84f6('0x28')];}_0x4dfcbe[_0x84f6('0x19')](_0x31f460)['send'](_0x5ce0b2);};}exports[_0x84f6('0x29')]=function(_0x2041a8,_0x52bc59){var _0x1e9c81={},_0x587386={},_0x229dd7={'count':0x0,'rows':[]};var _0x3ece71=_[_0x84f6('0x2a')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x27ed1d){return{'name':_0x27ed1d[_0x84f6('0x2b')],'type':_0x27ed1d['type']['key']};});_0x587386[_0x84f6('0x2c')]=_[_0x84f6('0x2a')](_0x3ece71,_0x84f6('0x28'));_0x587386[_0x84f6('0x2d')]=_[_0x84f6('0x2e')](_0x2041a8[_0x84f6('0x2d')]);_0x587386[_0x84f6('0x2f')]=_[_0x84f6('0x30')](_0x587386[_0x84f6('0x2c')],_0x587386[_0x84f6('0x2d')]);_0x1e9c81[_0x84f6('0x31')]=_[_0x84f6('0x30')](_0x587386[_0x84f6('0x2c')],qs[_0x84f6('0x32')](_0x2041a8[_0x84f6('0x2d')]['fields']));_0x1e9c81[_0x84f6('0x31')]=_0x1e9c81['attributes'][_0x84f6('0x33')]?_0x1e9c81[_0x84f6('0x31')]:_0x587386['model'];if(!_0x2041a8[_0x84f6('0x2d')][_0x84f6('0x34')](_0x84f6('0x35'))){_0x1e9c81[_0x84f6('0x1d')]=qs[_0x84f6('0x1d')](_0x2041a8[_0x84f6('0x2d')]['limit']);_0x1e9c81['offset']=qs['offset'](_0x2041a8[_0x84f6('0x2d')]['offset']);}_0x1e9c81[_0x84f6('0x36')]=qs[_0x84f6('0x37')](_0x2041a8[_0x84f6('0x2d')][_0x84f6('0x37')]);_0x1e9c81[_0x84f6('0x38')]=qs['filters'](_[_0x84f6('0x39')](_0x2041a8[_0x84f6('0x2d')],_0x587386['filters']),_0x3ece71);if(_0x2041a8['query'][_0x84f6('0x3a')]){_0x1e9c81[_0x84f6('0x38')]=_['merge'](_0x1e9c81[_0x84f6('0x38')],{'$or':_[_0x84f6('0x2a')](_0x3ece71,function(_0x8e5d56){if(_0x8e5d56[_0x84f6('0x3b')]!==_0x84f6('0x3c')){var _0x1757c8={};_0x1757c8[_0x8e5d56[_0x84f6('0x28')]]={'$like':'%'+_0x2041a8[_0x84f6('0x2d')]['filter']+'%'};return _0x1757c8;}})});}_0x1e9c81=_[_0x84f6('0x3d')]({},_0x1e9c81,_0x2041a8['options']);var _0x267eb7={'where':_0x1e9c81['where']};return db[_0x84f6('0x3e')][_0x84f6('0x1e')](_0x267eb7)['then'](function(_0x2b964f){_0x229dd7['count']=_0x2b964f;if(_0x2041a8['query'][_0x84f6('0x3f')]){_0x1e9c81[_0x84f6('0x40')]=[{'all':!![]}];}return db[_0x84f6('0x3e')][_0x84f6('0x41')](_0x1e9c81);})[_0x84f6('0x24')](function(_0x168b73){_0x229dd7[_0x84f6('0x42')]=_0x168b73;return _0x229dd7;})[_0x84f6('0x24')](respondWithFilteredResult(_0x52bc59,_0x1e9c81))[_0x84f6('0x43')](handleError(_0x52bc59,null));};exports[_0x84f6('0x44')]=function(_0x27a695,_0x42e78a){var _0xed11a4={'raw':!![],'where':{'id':_0x27a695['params']['id']}},_0x5df5b6={};_0x5df5b6[_0x84f6('0x2c')]=_[_0x84f6('0x2e')](db['AnalyticExtractedReport'][_0x84f6('0x45')]);_0x5df5b6[_0x84f6('0x2d')]=_[_0x84f6('0x2e')](_0x27a695[_0x84f6('0x2d')]);_0x5df5b6['filters']=_['intersection'](_0x5df5b6[_0x84f6('0x2c')],_0x5df5b6['query']);_0xed11a4[_0x84f6('0x31')]=_[_0x84f6('0x30')](_0x5df5b6[_0x84f6('0x2c')],qs[_0x84f6('0x32')](_0x27a695[_0x84f6('0x2d')]['fields']));_0xed11a4[_0x84f6('0x31')]=_0xed11a4[_0x84f6('0x31')]['length']?_0xed11a4['attributes']:_0x5df5b6['model'];if(_0x27a695[_0x84f6('0x2d')][_0x84f6('0x3f')]){_0xed11a4[_0x84f6('0x40')]=[{'all':!![]}];}_0xed11a4=_[_0x84f6('0x3d')]({},_0xed11a4,_0x27a695['options']);return db[_0x84f6('0x3e')][_0x84f6('0x46')](_0xed11a4)[_0x84f6('0x24')](handleEntityNotFound(_0x42e78a,null))[_0x84f6('0x24')](respondWithResult(_0x42e78a,null))[_0x84f6('0x43')](handleError(_0x42e78a,null));};exports['create']=function(_0x4ae3a0,_0x239dc4){return db[_0x84f6('0x3e')][_0x84f6('0x47')](_0x4ae3a0[_0x84f6('0x48')],{})[_0x84f6('0x24')](function(_0x490e59){var _0x462074=_0x4ae3a0[_0x84f6('0x49')][_0x84f6('0x26')]({'plain':!![]});if(!_0x462074)throw new Error(_0x84f6('0x4a'));if(_0x462074[_0x84f6('0x4b')]===_0x84f6('0x49')){var _0x4016f1=_0x490e59['get']({'plain':!![]});var _0x3f0a2c='ExtractedReports';return db[_0x84f6('0x4c')][_0x84f6('0x46')]({'where':{'name':_0x3f0a2c,'userProfileId':_0x462074[_0x84f6('0x4d')]},'raw':!![]})[_0x84f6('0x24')](function(_0xdca0a8){if(_0xdca0a8&&_0xdca0a8[_0x84f6('0x4e')]===0x0){return db[_0x84f6('0x4f')][_0x84f6('0x47')]({'name':_0x4016f1[_0x84f6('0x28')],'resourceId':_0x4016f1['id'],'type':_0xdca0a8[_0x84f6('0x28')],'sectionId':_0xdca0a8['id']},{})[_0x84f6('0x24')](function(){return _0x490e59;});}else{return _0x490e59;}})['catch'](function(_0xb3b3a8){logger[_0x84f6('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb3b3a8);throw _0xb3b3a8;});}return _0x490e59;})[_0x84f6('0x24')](respondWithResult(_0x239dc4,0xc9))[_0x84f6('0x43')](handleError(_0x239dc4,null));};exports['update']=function(_0x592e7a,_0x30a83b){if(_0x592e7a['body']['id']){delete _0x592e7a[_0x84f6('0x48')]['id'];}return db[_0x84f6('0x3e')][_0x84f6('0x46')]({'where':{'id':_0x592e7a[_0x84f6('0x50')]['id']}})[_0x84f6('0x24')](handleEntityNotFound(_0x30a83b,null))[_0x84f6('0x24')](saveUpdates(_0x592e7a['body'],null))[_0x84f6('0x24')](respondWithResult(_0x30a83b,null))['catch'](handleError(_0x30a83b,null));};exports[_0x84f6('0x25')]=function(_0x1b189e,_0x5ec9c6){return db['AnalyticExtractedReport'][_0x84f6('0x46')]({'where':{'id':_0x1b189e['params']['id']}})[_0x84f6('0x24')](handleEntityNotFound(_0x5ec9c6,null))[_0x84f6('0x24')](removeEntity(_0x5ec9c6,null))['catch'](handleError(_0x5ec9c6,null));};exports[_0x84f6('0x51')]=function(_0x10b357,_0x1e1e61,_0xd81e42){return db[_0x84f6('0x3e')][_0x84f6('0x46')]({'where':{'id':_0x10b357[_0x84f6('0x50')]['id']},'attributes':[_0x84f6('0x28'),'basename',_0x84f6('0x52'),_0x84f6('0x53')],'raw':!![]})[_0x84f6('0x24')](handleEntityNotFound(_0x1e1e61,null))[_0x84f6('0x24')](function(_0x551a43){if(_0x551a43){if(!fs[_0x84f6('0x54')](path['join'](config[_0x84f6('0x55')],'server/files/reports',_0x551a43[_0x84f6('0x52')]))){throw new db[(_0x84f6('0x56'))]['ValidationError'](_0x84f6('0x57'));}if(_0x10b357[_0x84f6('0x2d')][_0x84f6('0x58')]){return _0x1e1e61[_0x84f6('0x18')](0xc8);}return _0x1e1e61[_0x84f6('0x51')](path['join'](config[_0x84f6('0x55')],_0x84f6('0x59'),_0x551a43[_0x84f6('0x52')]),util['format'](_0x84f6('0x5a'),_0x551a43['basename']||_0x551a43[_0x84f6('0x28')],_0x551a43['output'][_0x84f6('0x5b')]()));}})[_0x84f6('0x43')](handleError(_0x1e1e61,null));}; \ No newline at end of file +var _0xab41=['Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','eml-format','zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','update','then','get','ExtractedReports','UserProfileResource','destroy','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError'];(function(_0x48a5ac,_0x1a9d81){var _0x1f0644=function(_0x26b220){while(--_0x26b220){_0x48a5ac['push'](_0x48a5ac['shift']());}};_0x1f0644(++_0x1a9d81);}(_0xab41,0x1df));var _0x1ab4=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xab41[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x1ab4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1ab4('0x1'));var jsonpatch=require(_0x1ab4('0x2'));var rp=require('request-promise');var moment=require(_0x1ab4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1ab4('0x4'));var util=require(_0x1ab4('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x1ab4('0x6'));var ejs=require(_0x1ab4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1ab4('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1ab4('0x9'));var deskjs=require(_0x1ab4('0xa'));var toCsv=require(_0x1ab4('0x6'));var querystring=require(_0x1ab4('0xb'));var Papa=require(_0x1ab4('0xc'));var Redis=require(_0x1ab4('0xd'));var authService=require(_0x1ab4('0xe'));var qs=require(_0x1ab4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ab4('0x10'));var logger=require(_0x1ab4('0x11'))(_0x1ab4('0x12'));var utils=require(_0x1ab4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1ab4('0x14'));var db=require(_0x1ab4('0x15'))['db'];function respondWithStatusCode(_0x3b100e,_0x47dc5e){_0x47dc5e=_0x47dc5e||0xcc;return function(_0x453a43){if(_0x453a43){return _0x3b100e[_0x1ab4('0x16')](_0x47dc5e);}return _0x3b100e['status'](_0x47dc5e)[_0x1ab4('0x17')]();};}function respondWithResult(_0x12933b,_0x3af44c){_0x3af44c=_0x3af44c||0xc8;return function(_0x512aa6){if(_0x512aa6){return _0x12933b[_0x1ab4('0x18')](_0x3af44c)['json'](_0x512aa6);}};}function respondWithFilteredResult(_0x52fbae,_0x327966){return function(_0x241670){if(_0x241670){var _0x316f55=typeof _0x327966['offset']===_0x1ab4('0x19')&&typeof _0x327966[_0x1ab4('0x1a')]===_0x1ab4('0x19');var _0x2eabeb=_0x241670[_0x1ab4('0x1b')];var _0x598efb=_0x316f55?0x0:_0x327966[_0x1ab4('0x1c')];var _0x484ae1=_0x316f55?_0x241670[_0x1ab4('0x1b')]:_0x327966[_0x1ab4('0x1c')]+_0x327966[_0x1ab4('0x1a')];var _0x23e597;if(_0x484ae1>=_0x2eabeb){_0x484ae1=_0x2eabeb;_0x23e597=0xc8;}else{_0x23e597=0xce;}_0x52fbae[_0x1ab4('0x18')](_0x23e597);return _0x52fbae[_0x1ab4('0x1d')](_0x1ab4('0x1e'),_0x598efb+'-'+_0x484ae1+'/'+_0x2eabeb)[_0x1ab4('0x1f')](_0x241670);}return null;};}function patchUpdates(_0x341df7){return function(_0x4be880){try{jsonpatch[_0x1ab4('0x20')](_0x4be880,_0x341df7,!![]);}catch(_0x133ceb){return BPromise['reject'](_0x133ceb);}return _0x4be880['save']();};}function saveUpdates(_0xd23721,_0x11cfad){return function(_0x2be570){if(_0x2be570){return _0x2be570[_0x1ab4('0x21')](_0xd23721)[_0x1ab4('0x22')](function(_0x5d0f85){return _0x5d0f85;});}return null;};}function removeEntity(_0x4f9492,_0x1e13c4){return function(_0x2bc925){if(_0x2bc925){return _0x2bc925['destroy']()[_0x1ab4('0x22')](function(){var _0x39b76b=_0x2bc925[_0x1ab4('0x23')]({'plain':!![]});var _0x4b6252=_0x1ab4('0x24');return db[_0x1ab4('0x25')][_0x1ab4('0x26')]({'where':{'type':_0x4b6252,'resourceId':_0x39b76b['id']}})[_0x1ab4('0x22')](function(){return _0x2bc925;});})[_0x1ab4('0x22')](function(){_0x4f9492['status'](0xcc)[_0x1ab4('0x17')]();});}};}function handleEntityNotFound(_0x1669b7,_0x1d9b6b){return function(_0x3f947d){if(!_0x3f947d){_0x1669b7[_0x1ab4('0x16')](0x194);}return _0x3f947d;};}function handleError(_0x968e87,_0x2ce82e){_0x2ce82e=_0x2ce82e||0x1f4;return function(_0x1a8e7e){logger['error'](_0x1a8e7e['stack']);if(_0x1a8e7e[_0x1ab4('0x27')]){delete _0x1a8e7e[_0x1ab4('0x27')];}_0x968e87['status'](_0x2ce82e)[_0x1ab4('0x28')](_0x1a8e7e);};}exports[_0x1ab4('0x29')]=function(_0x312d33,_0x3ad687){var _0x4c589b={},_0x3f0394={},_0x53db4b={'count':0x0,'rows':[]};var _0x7299f1=_[_0x1ab4('0x2a')](db[_0x1ab4('0x2b')][_0x1ab4('0x2c')],function(_0x206957){return{'name':_0x206957[_0x1ab4('0x2d')],'type':_0x206957[_0x1ab4('0x2e')][_0x1ab4('0x2f')]};});_0x3f0394['model']=_[_0x1ab4('0x2a')](_0x7299f1,_0x1ab4('0x27'));_0x3f0394[_0x1ab4('0x30')]=_[_0x1ab4('0x31')](_0x312d33['query']);_0x3f0394['filters']=_[_0x1ab4('0x32')](_0x3f0394['model'],_0x3f0394['query']);_0x4c589b['attributes']=_[_0x1ab4('0x32')](_0x3f0394[_0x1ab4('0x33')],qs[_0x1ab4('0x34')](_0x312d33[_0x1ab4('0x30')][_0x1ab4('0x34')]));_0x4c589b[_0x1ab4('0x35')]=_0x4c589b[_0x1ab4('0x35')][_0x1ab4('0x36')]?_0x4c589b[_0x1ab4('0x35')]:_0x3f0394['model'];if(!_0x312d33[_0x1ab4('0x30')][_0x1ab4('0x37')](_0x1ab4('0x38'))){_0x4c589b[_0x1ab4('0x1a')]=qs[_0x1ab4('0x1a')](_0x312d33['query'][_0x1ab4('0x1a')]);_0x4c589b[_0x1ab4('0x1c')]=qs[_0x1ab4('0x1c')](_0x312d33['query'][_0x1ab4('0x1c')]);}_0x4c589b['order']=qs['sort'](_0x312d33[_0x1ab4('0x30')]['sort']);_0x4c589b[_0x1ab4('0x39')]=qs[_0x1ab4('0x3a')](_[_0x1ab4('0x3b')](_0x312d33['query'],_0x3f0394['filters']),_0x7299f1);if(_0x312d33['query'][_0x1ab4('0x3c')]){_0x4c589b[_0x1ab4('0x39')]=_[_0x1ab4('0x3d')](_0x4c589b[_0x1ab4('0x39')],{'$or':_[_0x1ab4('0x2a')](_0x7299f1,function(_0x3cbc71){if(_0x3cbc71[_0x1ab4('0x2e')]!==_0x1ab4('0x3e')){var _0x22d00f={};_0x22d00f[_0x3cbc71[_0x1ab4('0x27')]]={'$like':'%'+_0x312d33[_0x1ab4('0x30')][_0x1ab4('0x3c')]+'%'};return _0x22d00f;}})});}_0x4c589b=_[_0x1ab4('0x3d')]({},_0x4c589b,_0x312d33[_0x1ab4('0x3f')]);var _0x518f75={'where':_0x4c589b[_0x1ab4('0x39')]};return db[_0x1ab4('0x2b')][_0x1ab4('0x1b')](_0x518f75)[_0x1ab4('0x22')](function(_0x3f164a){_0x53db4b['count']=_0x3f164a;if(_0x312d33[_0x1ab4('0x30')]['includeAll']){_0x4c589b[_0x1ab4('0x40')]=[{'all':!![]}];}return db[_0x1ab4('0x2b')][_0x1ab4('0x41')](_0x4c589b);})[_0x1ab4('0x22')](function(_0x3c05b7){_0x53db4b[_0x1ab4('0x42')]=_0x3c05b7;return _0x53db4b;})[_0x1ab4('0x22')](respondWithFilteredResult(_0x3ad687,_0x4c589b))[_0x1ab4('0x43')](handleError(_0x3ad687,null));};exports[_0x1ab4('0x44')]=function(_0x4fe011,_0xbb2c37){var _0x388176={'raw':!![],'where':{'id':_0x4fe011[_0x1ab4('0x45')]['id']}},_0x611050={};_0x611050[_0x1ab4('0x33')]=_[_0x1ab4('0x31')](db[_0x1ab4('0x2b')][_0x1ab4('0x2c')]);_0x611050[_0x1ab4('0x30')]=_['keys'](_0x4fe011['query']);_0x611050[_0x1ab4('0x3a')]=_['intersection'](_0x611050['model'],_0x611050[_0x1ab4('0x30')]);_0x388176['attributes']=_['intersection'](_0x611050[_0x1ab4('0x33')],qs[_0x1ab4('0x34')](_0x4fe011['query'][_0x1ab4('0x34')]));_0x388176[_0x1ab4('0x35')]=_0x388176[_0x1ab4('0x35')][_0x1ab4('0x36')]?_0x388176[_0x1ab4('0x35')]:_0x611050['model'];if(_0x4fe011[_0x1ab4('0x30')][_0x1ab4('0x46')]){_0x388176['include']=[{'all':!![]}];}_0x388176=_[_0x1ab4('0x3d')]({},_0x388176,_0x4fe011[_0x1ab4('0x3f')]);return db[_0x1ab4('0x2b')]['find'](_0x388176)['then'](handleEntityNotFound(_0xbb2c37,null))['then'](respondWithResult(_0xbb2c37,null))[_0x1ab4('0x43')](handleError(_0xbb2c37,null));};exports['create']=function(_0xc7b4b5,_0x5f92d8){return db[_0x1ab4('0x2b')][_0x1ab4('0x47')](_0xc7b4b5[_0x1ab4('0x48')],{})[_0x1ab4('0x22')](function(_0x18e705){var _0xa94be5=_0xc7b4b5[_0x1ab4('0x49')][_0x1ab4('0x23')]({'plain':!![]});if(!_0xa94be5)throw new Error(_0x1ab4('0x4a'));if(_0xa94be5['role']===_0x1ab4('0x49')){var _0x5b6680=_0x18e705['get']({'plain':!![]});var _0x3f7c79=_0x1ab4('0x24');return db[_0x1ab4('0x4b')][_0x1ab4('0x4c')]({'where':{'name':_0x3f7c79,'userProfileId':_0xa94be5[_0x1ab4('0x4d')]},'raw':!![]})['then'](function(_0x38e384){if(_0x38e384&&_0x38e384[_0x1ab4('0x4e')]===0x0){return db[_0x1ab4('0x25')][_0x1ab4('0x47')]({'name':_0x5b6680[_0x1ab4('0x27')],'resourceId':_0x5b6680['id'],'type':_0x38e384[_0x1ab4('0x27')],'sectionId':_0x38e384['id']},{})['then'](function(){return _0x18e705;});}else{return _0x18e705;}})[_0x1ab4('0x43')](function(_0x1bb795){logger[_0x1ab4('0x4f')](_0x1ab4('0x50'),_0x1bb795);throw _0x1bb795;});}return _0x18e705;})[_0x1ab4('0x22')](respondWithResult(_0x5f92d8,0xc9))['catch'](handleError(_0x5f92d8,null));};exports['update']=function(_0x298bf3,_0x540777){if(_0x298bf3['body']['id']){delete _0x298bf3[_0x1ab4('0x48')]['id'];}return db['AnalyticExtractedReport'][_0x1ab4('0x4c')]({'where':{'id':_0x298bf3['params']['id']}})[_0x1ab4('0x22')](handleEntityNotFound(_0x540777,null))[_0x1ab4('0x22')](saveUpdates(_0x298bf3[_0x1ab4('0x48')],null))[_0x1ab4('0x22')](respondWithResult(_0x540777,null))['catch'](handleError(_0x540777,null));};exports['destroy']=function(_0x4caa74,_0x1eac21){return db['AnalyticExtractedReport'][_0x1ab4('0x4c')]({'where':{'id':_0x4caa74[_0x1ab4('0x45')]['id']}})['then'](handleEntityNotFound(_0x1eac21,null))['then'](removeEntity(_0x1eac21,null))['catch'](handleError(_0x1eac21,null));};exports[_0x1ab4('0x51')]=function(_0x9626f6,_0x15c204,_0x52a929){return db[_0x1ab4('0x2b')][_0x1ab4('0x4c')]({'where':{'id':_0x9626f6[_0x1ab4('0x45')]['id']},'attributes':['name',_0x1ab4('0x52'),_0x1ab4('0x53'),_0x1ab4('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x15c204,null))[_0x1ab4('0x22')](function(_0x5507fe){if(_0x5507fe){if(!fs[_0x1ab4('0x55')](path[_0x1ab4('0x56')](config[_0x1ab4('0x57')],_0x1ab4('0x58'),_0x5507fe['savename']))){throw new db[(_0x1ab4('0x59'))][(_0x1ab4('0x5a'))](_0x1ab4('0x5b'));}if(_0x9626f6[_0x1ab4('0x30')][_0x1ab4('0x5c')]){return _0x15c204[_0x1ab4('0x16')](0xc8);}return _0x15c204[_0x1ab4('0x51')](path[_0x1ab4('0x56')](config['root'],'server/files/reports',_0x5507fe[_0x1ab4('0x53')]),util['format'](_0x1ab4('0x5d'),_0x5507fe[_0x1ab4('0x52')]||_0x5507fe['name'],_0x5507fe[_0x1ab4('0x54')][_0x1ab4('0x5e')]()));}})['catch'](handleError(_0x15c204,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 0351209..58d0fb9 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 _0x0c6e=['path','../../config/environment','exports','AnalyticExtractedReport','analytics_extracted_reports','../../config/logger','bluebird'];(function(_0x78cdea,_0x4d7fdc){var _0x4bf7da=function(_0x138a32){while(--_0x138a32){_0x78cdea['push'](_0x78cdea['shift']());}};_0x4bf7da(++_0x4d7fdc);}(_0x0c6e,0x116));var _0xe0c6=function(_0xf6cba6,_0x1d5375){_0xf6cba6=_0xf6cba6-0x0;var _0x5315c8=_0x0c6e[_0xf6cba6];return _0x5315c8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe0c6('0x0'))('api');var moment=require('moment');var BPromise=require(_0xe0c6('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe0c6('0x2'));var rimraf=require('rimraf');var config=require(_0xe0c6('0x3'));var attributes=require('./analyticExtractedReport.attributes');module[_0xe0c6('0x4')]=function(_0x574c2b,_0x36dda1){return _0x574c2b['define'](_0xe0c6('0x5'),attributes,{'tableName':_0xe0c6('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcabd=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport'];(function(_0x9f1286,_0x4b66e0){var _0x40b2ac=function(_0x3512ae){while(--_0x3512ae){_0x9f1286['push'](_0x9f1286['shift']());}};_0x40b2ac(++_0x4b66e0);}(_0xcabd,0xb4));var _0xdcab=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xcabd[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0xdcab('0x0'));var util=require(_0xdcab('0x1'));var logger=require(_0xdcab('0x2'))('api');var moment=require(_0xdcab('0x3'));var BPromise=require(_0xdcab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdcab('0x5'));var rimraf=require(_0xdcab('0x6'));var config=require(_0xdcab('0x7'));var attributes=require(_0xdcab('0x8'));module[_0xdcab('0x9')]=function(_0x1fdf7c,_0x2c0bdb){return _0x1fdf7c[_0xdcab('0xa')](_0xdcab('0xb'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 27ad509..2ef048f 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 _0x889d=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x346f62,_0x5079bc){var _0x1783a8=function(_0x3dca5e){while(--_0x3dca5e){_0x346f62['push'](_0x346f62['shift']());}};_0x1783a8(++_0x5079bc);}(_0x889d,0x64));var _0xd889=function(_0x181a7b,_0x45b715){_0x181a7b=_0x181a7b-0x0;var _0x2344d4=_0x889d[_0x181a7b];return _0x2344d4;};'use strict';var _=require(_0xd889('0x0'));var util=require(_0xd889('0x1'));var moment=require(_0xd889('0x2'));var BPromise=require(_0xd889('0x3'));var rs=require(_0xd889('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd889('0x5'))['db'];var utils=require(_0xd889('0x6'));var logger=require('../../config/logger')(_0xd889('0x7'));var config=require(_0xd889('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd889('0x9')][_0xd889('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48d516,_0x296269,_0x5bb6f9){return new BPromise(function(_0x494685,_0x37391a){return client[_0xd889('0xb')](_0x48d516,_0x5bb6f9)[_0xd889('0xc')](function(_0x4671a0){logger['info'](_0xd889('0xd'),_0x296269,'request\x20sent');logger['debug'](_0xd889('0xe'),_0x296269,_0xd889('0xf'),JSON['stringify'](_0x4671a0));if(_0x4671a0[_0xd889('0x10')]){if(_0x4671a0[_0xd889('0x10')]['code']===0x1f4){logger[_0xd889('0x10')](_0xd889('0xd'),_0x296269,_0x4671a0['error'][_0xd889('0x11')]);return _0x37391a(_0x4671a0[_0xd889('0x10')][_0xd889('0x11')]);}logger['error'](_0xd889('0xd'),_0x296269,_0x4671a0['error'][_0xd889('0x11')]);return _0x494685(_0x4671a0[_0xd889('0x10')][_0xd889('0x11')]);}else{logger[_0xd889('0x12')](_0xd889('0xd'),_0x296269,'request\x20sent');_0x494685(_0x4671a0[_0xd889('0x13')][_0xd889('0x11')]);}})[_0xd889('0x14')](function(_0xb6a4de){logger[_0xd889('0x10')](_0xd889('0xd'),_0x296269,_0xb6a4de);_0x37391a(_0xb6a4de);});});} \ No newline at end of file +var _0x077e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','message','AnalyticExtractedReport,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x58220a,_0x3545b5){var _0x30e125=function(_0x4aafd){while(--_0x4aafd){_0x58220a['push'](_0x58220a['shift']());}};_0x30e125(++_0x3545b5);}(_0x077e,0x1f4));var _0xe077=function(_0x5e2dd4,_0x2f2dc0){_0x5e2dd4=_0x5e2dd4-0x0;var _0x396f12=_0x077e[_0x5e2dd4];return _0x396f12;};'use strict';var _=require(_0xe077('0x0'));var util=require(_0xe077('0x1'));var moment=require(_0xe077('0x2'));var BPromise=require('bluebird');var rs=require(_0xe077('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe077('0x4'))['db'];var utils=require(_0xe077('0x5'));var logger=require(_0xe077('0x6'))(_0xe077('0x7'));var config=require(_0xe077('0x8'));var jayson=require(_0xe077('0x9'));var client=jayson[_0xe077('0xa')][_0xe077('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c9194,_0x427b23,_0x52e717){return new BPromise(function(_0x49306d,_0x387597){return client[_0xe077('0xc')](_0x1c9194,_0x52e717)[_0xe077('0xd')](function(_0x5ac7e8){logger[_0xe077('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x427b23,_0xe077('0xf'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x427b23,_0xe077('0xf'),JSON[_0xe077('0x10')](_0x5ac7e8));if(_0x5ac7e8[_0xe077('0x11')]){if(_0x5ac7e8[_0xe077('0x11')]['code']===0x1f4){logger[_0xe077('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x427b23,_0x5ac7e8[_0xe077('0x11')][_0xe077('0x12')]);return _0x387597(_0x5ac7e8[_0xe077('0x11')]['message']);}logger['error'](_0xe077('0x13'),_0x427b23,_0x5ac7e8[_0xe077('0x11')][_0xe077('0x12')]);return _0x49306d(_0x5ac7e8[_0xe077('0x11')][_0xe077('0x12')]);}else{logger[_0xe077('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x427b23,_0xe077('0xf'));_0x49306d(_0x5ac7e8[_0xe077('0x14')][_0xe077('0x12')]);}})[_0xe077('0x15')](function(_0x3e57e4){logger[_0xe077('0x11')](_0xe077('0x13'),_0x427b23,_0x3e57e4);_0x387597(_0x3e57e4);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index cab2f5a..aa49fd5 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 _0x1fbe=['../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','/:id/download','download','post','create','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0x1fbe,0x14d));var _0xe1fb=function(_0x1044e5,_0x498e01){_0x1044e5=_0x1044e5-0x0;var _0x5ad0dd=_0x1fbe[_0x1044e5];return _0x5ad0dd;};'use strict';var multer=require(_0xe1fb('0x0'));var util=require('util');var path=require(_0xe1fb('0x1'));var timeout=require(_0xe1fb('0x2'));var express=require(_0xe1fb('0x3'));var router=express[_0xe1fb('0x4')]();var fs_extra=require(_0xe1fb('0x5'));var auth=require(_0xe1fb('0x6'));var interaction=require(_0xe1fb('0x7'));var config=require(_0xe1fb('0x8'));var controller=require(_0xe1fb('0x9'));router['get']('/',auth[_0xe1fb('0xa')](),controller[_0xe1fb('0xb')]);router[_0xe1fb('0xc')](_0xe1fb('0xd'),auth[_0xe1fb('0xa')](),controller['show']);router[_0xe1fb('0xc')](_0xe1fb('0xe'),auth['isAuthenticated'](),controller[_0xe1fb('0xf')]);router[_0xe1fb('0x10')]('/',auth['isAuthenticated'](),controller[_0xe1fb('0x11')]);router['put'](_0xe1fb('0xd'),auth[_0xe1fb('0xa')](),controller['update']);router[_0xe1fb('0x12')](_0xe1fb('0xd'),auth[_0xe1fb('0xa')](),controller['destroy']);module[_0xe1fb('0x13')]=router; \ No newline at end of file +var _0xc881=['delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0xc881,0x16b));var _0x1c88=function(_0x5744b2,_0x1d7aad){_0x5744b2=_0x5744b2-0x0;var _0x2f3a26=_0xc881[_0x5744b2];return _0x2f3a26;};'use strict';var multer=require(_0x1c88('0x0'));var util=require(_0x1c88('0x1'));var path=require(_0x1c88('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1c88('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1c88('0x4'));var config=require(_0x1c88('0x5'));var controller=require(_0x1c88('0x6'));router[_0x1c88('0x7')]('/',auth[_0x1c88('0x8')](),controller[_0x1c88('0x9')]);router['get'](_0x1c88('0xa'),auth[_0x1c88('0x8')](),controller['show']);router[_0x1c88('0x7')](_0x1c88('0xb'),auth[_0x1c88('0x8')](),controller[_0x1c88('0xc')]);router[_0x1c88('0xd')]('/',auth[_0x1c88('0x8')](),controller[_0x1c88('0xe')]);router[_0x1c88('0xf')](_0x1c88('0xa'),auth[_0x1c88('0x8')](),controller[_0x1c88('0x10')]);router[_0x1c88('0x11')]('/:id',auth[_0x1c88('0x8')](),controller[_0x1c88('0x12')]);module[_0x1c88('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 6bf683c..fe2424e 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 _0x956e=['BOOLEAN','exports','STRING'];(function(_0x2c4292,_0x39be32){var _0x50fff0=function(_0x178ee){while(--_0x178ee){_0x2c4292['push'](_0x2c4292['shift']());}};_0x50fff0(++_0x39be32);}(_0x956e,0x1e4));var _0xe956=function(_0x296923,_0x4adaed){_0x296923=_0x296923-0x0;var _0x29af70=_0x956e[_0x296923];return _0x29af70;};'use strict';var Sequelize=require('sequelize');module[_0xe956('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xe956('0x1')]},'format':{'type':Sequelize[_0xe956('0x1')]},'groupBy':{'type':Sequelize[_0xe956('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xe956('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xbc26=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x100208,_0x4fa4a2){var _0x2d83f4=function(_0x261665){while(--_0x261665){_0x100208['push'](_0x100208['shift']());}};_0x2d83f4(++_0x4fa4a2);}(_0xbc26,0x10a));var _0x6bc2=function(_0x40aa69,_0x30b4d8){_0x40aa69=_0x40aa69-0x0;var _0x129414=_0xbc26[_0x40aa69];return _0x129414;};'use strict';var Sequelize=require(_0x6bc2('0x0'));module[_0x6bc2('0x1')]={'field':{'type':Sequelize[_0x6bc2('0x2')]},'alias':{'type':Sequelize[_0x6bc2('0x3')]},'function':{'type':Sequelize[_0x6bc2('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x6bc2('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x6bc2('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index e7f3074..b89243c 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 _0x13fc=['findAll','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','stack','name','map','AnalyticFieldReport','type','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','keys','rawAttributes','find','create','body','bulkCreate','update','bulkDestroy','addFields','AnalyticCustomReport','sequelize','transaction','params','CustomReportId'];(function(_0x6bd32b,_0x2a6baa){var _0x2e3f04=function(_0x4733c1){while(--_0x4733c1){_0x6bd32b['push'](_0x6bd32b['shift']());}};_0x2e3f04(++_0x2a6baa);}(_0x13fc,0xe5));var _0xc13f=function(_0x32279c,_0x154cd7){_0x32279c=_0x32279c-0x0;var _0x3c377f=_0x13fc[_0x32279c];return _0x3c377f;};'use strict';var emlformat=require(_0xc13f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc13f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc13f('0x2'));var moment=require(_0xc13f('0x3'));var BPromise=require(_0xc13f('0x4'));var Mustache=require(_0xc13f('0x5'));var util=require(_0xc13f('0x6'));var path=require(_0xc13f('0x7'));var sox=require(_0xc13f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc13f('0x9'));var _=require('lodash');var squel=require(_0xc13f('0xa'));var crypto=require(_0xc13f('0xb'));var jsforce=require(_0xc13f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc13f('0xd'));var querystring=require(_0xc13f('0xe'));var Papa=require(_0xc13f('0xf'));var Redis=require(_0xc13f('0x10'));var authService=require(_0xc13f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc13f('0x12'))(_0xc13f('0x13'));var utils=require(_0xc13f('0x14'));var config=require(_0xc13f('0x15'));var licenseUtil=require(_0xc13f('0x16'));var db=require(_0xc13f('0x17'))['db'];function respondWithStatusCode(_0x36716e,_0x10fa99){_0x10fa99=_0x10fa99||0xcc;return function(_0x3a0f2b){if(_0x3a0f2b){return _0x36716e[_0xc13f('0x18')](_0x10fa99);}return _0x36716e[_0xc13f('0x19')](_0x10fa99)[_0xc13f('0x1a')]();};}function respondWithResult(_0x56dedd,_0x5d86b8){_0x5d86b8=_0x5d86b8||0xc8;return function(_0x42d76a){if(_0x42d76a){return _0x56dedd[_0xc13f('0x19')](_0x5d86b8)[_0xc13f('0x1b')](_0x42d76a);}};}function respondWithFilteredResult(_0x5386b6,_0x184848){return function(_0x10c367){if(_0x10c367){var _0x561259=typeof _0x184848[_0xc13f('0x1c')]===_0xc13f('0x1d')&&typeof _0x184848[_0xc13f('0x1e')]===_0xc13f('0x1d');var _0x417543=_0x10c367[_0xc13f('0x1f')];var _0x1b0fb1=_0x561259?0x0:_0x184848[_0xc13f('0x1c')];var _0x232db1=_0x561259?_0x10c367[_0xc13f('0x1f')]:_0x184848[_0xc13f('0x1c')]+_0x184848[_0xc13f('0x1e')];var _0x5c6e65;if(_0x232db1>=_0x417543){_0x232db1=_0x417543;_0x5c6e65=0xc8;}else{_0x5c6e65=0xce;}_0x5386b6['status'](_0x5c6e65);return _0x5386b6['set']('Content-Range',_0x1b0fb1+'-'+_0x232db1+'/'+_0x417543)[_0xc13f('0x1b')](_0x10c367);}return null;};}function patchUpdates(_0x1f5700){return function(_0xffbb22){try{jsonpatch[_0xc13f('0x20')](_0xffbb22,_0x1f5700,!![]);}catch(_0x36dbd5){return BPromise[_0xc13f('0x21')](_0x36dbd5);}return _0xffbb22[_0xc13f('0x22')]();};}function saveUpdates(_0x11423c,_0x3aeb7c){return function(_0x181dfa){if(_0x181dfa){return _0x181dfa['update'](_0x11423c)[_0xc13f('0x23')](function(_0x4ed553){return _0x4ed553;});}return null;};}function removeEntity(_0x2074a7,_0x102b5c){return function(_0x5dabb2){if(_0x5dabb2){return _0x5dabb2[_0xc13f('0x24')]()[_0xc13f('0x23')](function(){_0x2074a7[_0xc13f('0x19')](0xcc)[_0xc13f('0x1a')]();});}};}function handleEntityNotFound(_0x3236fb,_0x25d110){return function(_0x96f7e0){if(!_0x96f7e0){_0x3236fb[_0xc13f('0x18')](0x194);}return _0x96f7e0;};}function handleError(_0x88e83a,_0x3111b1){_0x3111b1=_0x3111b1||0x1f4;return function(_0x332226){logger[_0xc13f('0x25')](_0x332226[_0xc13f('0x26')]);if(_0x332226[_0xc13f('0x27')]){delete _0x332226[_0xc13f('0x27')];}_0x88e83a[_0xc13f('0x19')](_0x3111b1)['send'](_0x332226);};}exports['index']=function(_0x264b9c,_0x3538e7){var _0x51b272={},_0x17cb7d={},_0x27b2b1={'count':0x0,'rows':[]};var _0x37a66a=_[_0xc13f('0x28')](db[_0xc13f('0x29')]['rawAttributes'],function(_0x37f024){return{'name':_0x37f024['fieldName'],'type':_0x37f024[_0xc13f('0x2a')]['key']};});_0x17cb7d[_0xc13f('0x2b')]=_[_0xc13f('0x28')](_0x37a66a,_0xc13f('0x27'));_0x17cb7d[_0xc13f('0x2c')]=_['keys'](_0x264b9c[_0xc13f('0x2c')]);_0x17cb7d[_0xc13f('0x2d')]=_[_0xc13f('0x2e')](_0x17cb7d['model'],_0x17cb7d[_0xc13f('0x2c')]);_0x51b272[_0xc13f('0x2f')]=_[_0xc13f('0x2e')](_0x17cb7d[_0xc13f('0x2b')],qs['fields'](_0x264b9c[_0xc13f('0x2c')]['fields']));_0x51b272['attributes']=_0x51b272['attributes']['length']?_0x51b272[_0xc13f('0x2f')]:_0x17cb7d[_0xc13f('0x2b')];if(!_0x264b9c[_0xc13f('0x2c')][_0xc13f('0x30')](_0xc13f('0x31'))){_0x51b272[_0xc13f('0x1e')]=qs[_0xc13f('0x1e')](_0x264b9c[_0xc13f('0x2c')][_0xc13f('0x1e')]);_0x51b272[_0xc13f('0x1c')]=qs[_0xc13f('0x1c')](_0x264b9c[_0xc13f('0x2c')][_0xc13f('0x1c')]);}_0x51b272['order']=qs['sort'](_0x264b9c[_0xc13f('0x2c')]['sort']);_0x51b272[_0xc13f('0x32')]=qs['filters'](_[_0xc13f('0x33')](_0x264b9c['query'],_0x17cb7d['filters']),_0x37a66a);if(_0x264b9c[_0xc13f('0x2c')]['filter']){_0x51b272['where']=_[_0xc13f('0x34')](_0x51b272['where'],{'$or':_[_0xc13f('0x28')](_0x37a66a,function(_0x38db64){if(_0x38db64[_0xc13f('0x2a')]!==_0xc13f('0x35')){var _0x58c97e={};_0x58c97e[_0x38db64[_0xc13f('0x27')]]={'$like':'%'+_0x264b9c[_0xc13f('0x2c')][_0xc13f('0x36')]+'%'};return _0x58c97e;}})});}_0x51b272=_[_0xc13f('0x34')]({},_0x51b272,_0x264b9c[_0xc13f('0x37')]);var _0xa4fd9a={'where':_0x51b272[_0xc13f('0x32')]};return db[_0xc13f('0x29')][_0xc13f('0x1f')](_0xa4fd9a)[_0xc13f('0x23')](function(_0x4d25cf){_0x27b2b1[_0xc13f('0x1f')]=_0x4d25cf;if(_0x264b9c[_0xc13f('0x2c')][_0xc13f('0x38')]){_0x51b272[_0xc13f('0x39')]=[{'all':!![]}];}return db[_0xc13f('0x29')]['findAll'](_0x51b272);})['then'](function(_0x2dacdf){_0x27b2b1[_0xc13f('0x3a')]=_0x2dacdf;return _0x27b2b1;})[_0xc13f('0x23')](respondWithFilteredResult(_0x3538e7,_0x51b272))[_0xc13f('0x3b')](handleError(_0x3538e7,null));};exports[_0xc13f('0x3c')]=function(_0x16132f,_0x3413a6){var _0x17fa70={'raw':![],'where':{'id':_0x16132f['params']['id']}},_0x1d9e27={};_0x1d9e27[_0xc13f('0x2b')]=_[_0xc13f('0x3d')](db[_0xc13f('0x29')][_0xc13f('0x3e')]);_0x1d9e27[_0xc13f('0x2c')]=_['keys'](_0x16132f['query']);_0x1d9e27[_0xc13f('0x2d')]=_[_0xc13f('0x2e')](_0x1d9e27[_0xc13f('0x2b')],_0x1d9e27['query']);_0x17fa70[_0xc13f('0x2f')]=_['intersection'](_0x1d9e27['model'],qs['fields'](_0x16132f[_0xc13f('0x2c')]['fields']));_0x17fa70[_0xc13f('0x2f')]=_0x17fa70['attributes']['length']?_0x17fa70[_0xc13f('0x2f')]:_0x1d9e27[_0xc13f('0x2b')];if(_0x16132f[_0xc13f('0x2c')][_0xc13f('0x38')]){_0x17fa70['include']=[{'all':!![]}];}_0x17fa70=_[_0xc13f('0x34')]({},_0x17fa70,_0x16132f[_0xc13f('0x37')]);return db[_0xc13f('0x29')][_0xc13f('0x3f')](_0x17fa70)[_0xc13f('0x23')](handleEntityNotFound(_0x3413a6,null))[_0xc13f('0x23')](respondWithResult(_0x3413a6,null))[_0xc13f('0x3b')](handleError(_0x3413a6,null));};exports[_0xc13f('0x40')]=function(_0x350c51,_0x21316b){return db[_0xc13f('0x29')][_0xc13f('0x40')](_0x350c51[_0xc13f('0x41')],{})[_0xc13f('0x23')](respondWithResult(_0x21316b,0xc9))['catch'](handleError(_0x21316b,null));};exports[_0xc13f('0x42')]=function(_0x54d803,_0x6f8fbd){return db[_0xc13f('0x29')][_0xc13f('0x42')](_0x54d803[_0xc13f('0x41')],{'raw':![],'individualHooks':!![]})[_0xc13f('0x23')](respondWithResult(_0x6f8fbd,0xc9))[_0xc13f('0x3b')](handleError(_0x6f8fbd,null));};exports[_0xc13f('0x43')]=function(_0x1f6c16,_0x198755){if(_0x1f6c16[_0xc13f('0x41')]['id']){delete _0x1f6c16['body']['id'];}return db[_0xc13f('0x29')][_0xc13f('0x3f')]({'where':{'id':_0x1f6c16['params']['id']}})[_0xc13f('0x23')](handleEntityNotFound(_0x198755,null))[_0xc13f('0x23')](saveUpdates(_0x1f6c16[_0xc13f('0x41')],null))[_0xc13f('0x23')](respondWithResult(_0x198755,null))[_0xc13f('0x3b')](handleError(_0x198755,null));};exports['destroy']=function(_0x5c7753,_0xc97d31){return db[_0xc13f('0x29')][_0xc13f('0x3f')]({'where':{'id':_0x5c7753['params']['id']}})[_0xc13f('0x23')](handleEntityNotFound(_0xc97d31,null))['then'](removeEntity(_0xc97d31,null))[_0xc13f('0x3b')](handleError(_0xc97d31,null));};exports[_0xc13f('0x44')]=function(_0x57617f,_0x1eb048){return db[_0xc13f('0x29')][_0xc13f('0x24')]({'where':{'id':_0x57617f[_0xc13f('0x2c')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xc13f('0x23')](respondWithResult(_0x1eb048,0xcc))['catch'](handleError(_0x1eb048,null));};exports[_0xc13f('0x45')]=function(_0x4b1d5a,_0x5d7c7c,_0x26bd5){return db[_0xc13f('0x46')]['findOne']({'where':{'id':_0x4b1d5a['params']['id']}})[_0xc13f('0x23')](handleEntityNotFound(_0x5d7c7c,null))[_0xc13f('0x23')](function(_0x37d99d){if(_0x37d99d){return db[_0xc13f('0x47')][_0xc13f('0x48')](function(_0x34cc1a){return db[_0xc13f('0x29')]['destroy']({'where':{'CustomReportId':_0x4b1d5a[_0xc13f('0x49')]['id']},'transaction':_0x34cc1a})[_0xc13f('0x23')](function(_0x3eb453){var _0x1461c4=_[_0xc13f('0x28')](_0x4b1d5a[_0xc13f('0x41')],function(_0x595ae3){delete _0x595ae3['id'];_0x595ae3[_0xc13f('0x4a')]=_0x4b1d5a[_0xc13f('0x49')]['id'];return _0x595ae3;});return db[_0xc13f('0x29')][_0xc13f('0x42')](_0x1461c4,{'transaction':_0x34cc1a});});})[_0xc13f('0x23')](function(){return db[_0xc13f('0x29')][_0xc13f('0x4b')]({'where':{'CustomReportId':_0x4b1d5a[_0xc13f('0x49')]['id']}});});}})[_0xc13f('0x23')](respondWithResult(_0x5d7c7c,null))[_0xc13f('0x3b')](handleError(_0x5d7c7c,null));}; \ No newline at end of file +var _0xa71f=['AnalyticFieldReport','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','bulkCreate','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','stack','name','send'];(function(_0x4113a5,_0x483da9){var _0x3e50ee=function(_0x47c5e7){while(--_0x47c5e7){_0x4113a5['push'](_0x4113a5['shift']());}};_0x3e50ee(++_0x483da9);}(_0xa71f,0xd4));var _0xfa71=function(_0x556341,_0x5e232b){_0x556341=_0x556341-0x0;var _0x1f7251=_0xa71f[_0x556341];return _0x1f7251;};'use strict';var emlformat=require(_0xfa71('0x0'));var rimraf=require(_0xfa71('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfa71('0x2'));var rp=require(_0xfa71('0x3'));var moment=require(_0xfa71('0x4'));var BPromise=require(_0xfa71('0x5'));var Mustache=require(_0xfa71('0x6'));var util=require(_0xfa71('0x7'));var path=require(_0xfa71('0x8'));var sox=require(_0xfa71('0x9'));var csv=require('to-csv');var ejs=require(_0xfa71('0xa'));var fs=require('fs');var fs_extra=require(_0xfa71('0xb'));var _=require(_0xfa71('0xc'));var squel=require(_0xfa71('0xd'));var crypto=require(_0xfa71('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfa71('0xf'));var querystring=require(_0xfa71('0x10'));var Papa=require('papaparse');var Redis=require(_0xfa71('0x11'));var authService=require(_0xfa71('0x12'));var qs=require(_0xfa71('0x13'));var as=require(_0xfa71('0x14'));var hardwareService=require(_0xfa71('0x15'));var logger=require(_0xfa71('0x16'))(_0xfa71('0x17'));var utils=require(_0xfa71('0x18'));var config=require(_0xfa71('0x19'));var licenseUtil=require(_0xfa71('0x1a'));var db=require(_0xfa71('0x1b'))['db'];function respondWithStatusCode(_0x192c95,_0x45ee0d){_0x45ee0d=_0x45ee0d||0xcc;return function(_0x45e1f4){if(_0x45e1f4){return _0x192c95[_0xfa71('0x1c')](_0x45ee0d);}return _0x192c95[_0xfa71('0x1d')](_0x45ee0d)[_0xfa71('0x1e')]();};}function respondWithResult(_0x3930ab,_0x118bc1){_0x118bc1=_0x118bc1||0xc8;return function(_0x529fb4){if(_0x529fb4){return _0x3930ab[_0xfa71('0x1d')](_0x118bc1)[_0xfa71('0x1f')](_0x529fb4);}};}function respondWithFilteredResult(_0x14c782,_0x26c652){return function(_0xf9881d){if(_0xf9881d){var _0x2bf2d5=typeof _0x26c652[_0xfa71('0x20')]===_0xfa71('0x21')&&typeof _0x26c652[_0xfa71('0x22')]===_0xfa71('0x21');var _0x39bae1=_0xf9881d[_0xfa71('0x23')];var _0x2091b6=_0x2bf2d5?0x0:_0x26c652['offset'];var _0x1b2f95=_0x2bf2d5?_0xf9881d['count']:_0x26c652[_0xfa71('0x20')]+_0x26c652[_0xfa71('0x22')];var _0x5dea69;if(_0x1b2f95>=_0x39bae1){_0x1b2f95=_0x39bae1;_0x5dea69=0xc8;}else{_0x5dea69=0xce;}_0x14c782['status'](_0x5dea69);return _0x14c782[_0xfa71('0x24')](_0xfa71('0x25'),_0x2091b6+'-'+_0x1b2f95+'/'+_0x39bae1)[_0xfa71('0x1f')](_0xf9881d);}return null;};}function patchUpdates(_0x4c75d){return function(_0x383c70){try{jsonpatch[_0xfa71('0x26')](_0x383c70,_0x4c75d,!![]);}catch(_0x583b91){return BPromise['reject'](_0x583b91);}return _0x383c70['save']();};}function saveUpdates(_0x27aa74,_0x4a4067){return function(_0x29f2d1){if(_0x29f2d1){return _0x29f2d1[_0xfa71('0x27')](_0x27aa74)['then'](function(_0x3aa8fc){return _0x3aa8fc;});}return null;};}function removeEntity(_0x4f62df,_0x2c6545){return function(_0xeae367){if(_0xeae367){return _0xeae367[_0xfa71('0x28')]()[_0xfa71('0x29')](function(){_0x4f62df[_0xfa71('0x1d')](0xcc)[_0xfa71('0x1e')]();});}};}function handleEntityNotFound(_0x23904f,_0xb1be17){return function(_0x21e554){if(!_0x21e554){_0x23904f['sendStatus'](0x194);}return _0x21e554;};}function handleError(_0x4b7689,_0x11bf8b){_0x11bf8b=_0x11bf8b||0x1f4;return function(_0x59b374){logger[_0xfa71('0x2a')](_0x59b374[_0xfa71('0x2b')]);if(_0x59b374[_0xfa71('0x2c')]){delete _0x59b374[_0xfa71('0x2c')];}_0x4b7689[_0xfa71('0x1d')](_0x11bf8b)[_0xfa71('0x2d')](_0x59b374);};}exports['index']=function(_0x1772f1,_0xe0b9b8){var _0x2923bb={},_0x28c534={},_0x5d7be6={'count':0x0,'rows':[]};var _0x40721c=_['map'](db[_0xfa71('0x2e')][_0xfa71('0x2f')],function(_0x2c3999){return{'name':_0x2c3999[_0xfa71('0x30')],'type':_0x2c3999['type'][_0xfa71('0x31')]};});_0x28c534[_0xfa71('0x32')]=_['map'](_0x40721c,_0xfa71('0x2c'));_0x28c534[_0xfa71('0x33')]=_['keys'](_0x1772f1[_0xfa71('0x33')]);_0x28c534[_0xfa71('0x34')]=_['intersection'](_0x28c534[_0xfa71('0x32')],_0x28c534['query']);_0x2923bb[_0xfa71('0x35')]=_[_0xfa71('0x36')](_0x28c534[_0xfa71('0x32')],qs[_0xfa71('0x37')](_0x1772f1[_0xfa71('0x33')][_0xfa71('0x37')]));_0x2923bb[_0xfa71('0x35')]=_0x2923bb[_0xfa71('0x35')][_0xfa71('0x38')]?_0x2923bb['attributes']:_0x28c534[_0xfa71('0x32')];if(!_0x1772f1[_0xfa71('0x33')][_0xfa71('0x39')](_0xfa71('0x3a'))){_0x2923bb[_0xfa71('0x22')]=qs[_0xfa71('0x22')](_0x1772f1[_0xfa71('0x33')][_0xfa71('0x22')]);_0x2923bb['offset']=qs[_0xfa71('0x20')](_0x1772f1['query']['offset']);}_0x2923bb[_0xfa71('0x3b')]=qs[_0xfa71('0x3c')](_0x1772f1[_0xfa71('0x33')][_0xfa71('0x3c')]);_0x2923bb[_0xfa71('0x3d')]=qs[_0xfa71('0x34')](_[_0xfa71('0x3e')](_0x1772f1[_0xfa71('0x33')],_0x28c534[_0xfa71('0x34')]),_0x40721c);if(_0x1772f1[_0xfa71('0x33')][_0xfa71('0x3f')]){_0x2923bb[_0xfa71('0x3d')]=_[_0xfa71('0x40')](_0x2923bb[_0xfa71('0x3d')],{'$or':_['map'](_0x40721c,function(_0x41732e){if(_0x41732e[_0xfa71('0x41')]!=='VIRTUAL'){var _0x29e8dc={};_0x29e8dc[_0x41732e[_0xfa71('0x2c')]]={'$like':'%'+_0x1772f1[_0xfa71('0x33')]['filter']+'%'};return _0x29e8dc;}})});}_0x2923bb=_[_0xfa71('0x40')]({},_0x2923bb,_0x1772f1[_0xfa71('0x42')]);var _0xb4bce4={'where':_0x2923bb[_0xfa71('0x3d')]};return db['AnalyticFieldReport']['count'](_0xb4bce4)['then'](function(_0x240304){_0x5d7be6[_0xfa71('0x23')]=_0x240304;if(_0x1772f1['query'][_0xfa71('0x43')]){_0x2923bb['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xfa71('0x44')](_0x2923bb);})[_0xfa71('0x29')](function(_0x45364e){_0x5d7be6[_0xfa71('0x45')]=_0x45364e;return _0x5d7be6;})[_0xfa71('0x29')](respondWithFilteredResult(_0xe0b9b8,_0x2923bb))[_0xfa71('0x46')](handleError(_0xe0b9b8,null));};exports[_0xfa71('0x47')]=function(_0x17e563,_0x72876){var _0x86b755={'raw':![],'where':{'id':_0x17e563[_0xfa71('0x48')]['id']}},_0x4f6dd0={};_0x4f6dd0[_0xfa71('0x32')]=_['keys'](db[_0xfa71('0x2e')][_0xfa71('0x2f')]);_0x4f6dd0[_0xfa71('0x33')]=_[_0xfa71('0x49')](_0x17e563[_0xfa71('0x33')]);_0x4f6dd0['filters']=_['intersection'](_0x4f6dd0['model'],_0x4f6dd0['query']);_0x86b755[_0xfa71('0x35')]=_[_0xfa71('0x36')](_0x4f6dd0[_0xfa71('0x32')],qs[_0xfa71('0x37')](_0x17e563['query'][_0xfa71('0x37')]));_0x86b755[_0xfa71('0x35')]=_0x86b755[_0xfa71('0x35')][_0xfa71('0x38')]?_0x86b755[_0xfa71('0x35')]:_0x4f6dd0[_0xfa71('0x32')];if(_0x17e563['query'][_0xfa71('0x43')]){_0x86b755[_0xfa71('0x4a')]=[{'all':!![]}];}_0x86b755=_[_0xfa71('0x40')]({},_0x86b755,_0x17e563['options']);return db[_0xfa71('0x2e')]['find'](_0x86b755)[_0xfa71('0x29')](handleEntityNotFound(_0x72876,null))['then'](respondWithResult(_0x72876,null))[_0xfa71('0x46')](handleError(_0x72876,null));};exports[_0xfa71('0x4b')]=function(_0x1714e0,_0x4e9ef3){return db[_0xfa71('0x2e')][_0xfa71('0x4b')](_0x1714e0[_0xfa71('0x4c')],{})['then'](respondWithResult(_0x4e9ef3,0xc9))[_0xfa71('0x46')](handleError(_0x4e9ef3,null));};exports[_0xfa71('0x4d')]=function(_0x502499,_0x29e733){return db[_0xfa71('0x2e')]['bulkCreate'](_0x502499['body'],{'raw':![],'individualHooks':!![]})[_0xfa71('0x29')](respondWithResult(_0x29e733,0xc9))['catch'](handleError(_0x29e733,null));};exports['update']=function(_0x3fd22f,_0x1a9e94){if(_0x3fd22f[_0xfa71('0x4c')]['id']){delete _0x3fd22f['body']['id'];}return db['AnalyticFieldReport'][_0xfa71('0x4e')]({'where':{'id':_0x3fd22f[_0xfa71('0x48')]['id']}})[_0xfa71('0x29')](handleEntityNotFound(_0x1a9e94,null))[_0xfa71('0x29')](saveUpdates(_0x3fd22f[_0xfa71('0x4c')],null))[_0xfa71('0x29')](respondWithResult(_0x1a9e94,null))[_0xfa71('0x46')](handleError(_0x1a9e94,null));};exports[_0xfa71('0x28')]=function(_0x1ba32b,_0x30b6e6){return db[_0xfa71('0x2e')][_0xfa71('0x4e')]({'where':{'id':_0x1ba32b[_0xfa71('0x48')]['id']}})['then'](handleEntityNotFound(_0x30b6e6,null))[_0xfa71('0x29')](removeEntity(_0x30b6e6,null))[_0xfa71('0x46')](handleError(_0x30b6e6,null));};exports[_0xfa71('0x4f')]=function(_0x1c7af4,_0x1e6d4c){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x1c7af4[_0xfa71('0x33')][_0xfa71('0x50')]||[]},'raw':![],'individualHooks':!![]})[_0xfa71('0x29')](respondWithResult(_0x1e6d4c,0xcc))['catch'](handleError(_0x1e6d4c,null));};exports[_0xfa71('0x51')]=function(_0x3144b0,_0x40f68d,_0x3d0e72){return db[_0xfa71('0x52')][_0xfa71('0x53')]({'where':{'id':_0x3144b0['params']['id']}})[_0xfa71('0x29')](handleEntityNotFound(_0x40f68d,null))['then'](function(_0x47062b){if(_0x47062b){return db['sequelize'][_0xfa71('0x54')](function(_0x1361ef){return db[_0xfa71('0x2e')][_0xfa71('0x28')]({'where':{'CustomReportId':_0x3144b0[_0xfa71('0x48')]['id']},'transaction':_0x1361ef})[_0xfa71('0x29')](function(_0x1f4f0b){var _0x2a6077=_['map'](_0x3144b0['body'],function(_0x37c235){delete _0x37c235['id'];_0x37c235[_0xfa71('0x55')]=_0x3144b0['params']['id'];return _0x37c235;});return db[_0xfa71('0x2e')]['bulkCreate'](_0x2a6077,{'transaction':_0x1361ef});});})['then'](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x3144b0['params']['id']}});});}})[_0xfa71('0x29')](respondWithResult(_0x40f68d,null))[_0xfa71('0x46')](handleError(_0x40f68d,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index dccebdc..a90554e 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 _0x8301=['api','moment','bluebird','request-promise','path','rimraf','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger'];(function(_0x83d650,_0x527216){var _0x300857=function(_0x57adad){while(--_0x57adad){_0x83d650['push'](_0x83d650['shift']());}};_0x300857(++_0x527216);}(_0x8301,0x136));var _0x1830=function(_0xf4add4,_0x5b9cc1){_0xf4add4=_0xf4add4-0x0;var _0x1c42fb=_0x8301[_0xf4add4];return _0x1c42fb;};'use strict';var _=require(_0x1830('0x0'));var util=require('util');var logger=require(_0x1830('0x1'))(_0x1830('0x2'));var moment=require(_0x1830('0x3'));var BPromise=require(_0x1830('0x4'));var rp=require(_0x1830('0x5'));var fs=require('fs');var path=require(_0x1830('0x6'));var rimraf=require(_0x1830('0x7'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0x1830('0x8')]=function(_0x15486d,_0x1823d3){return _0x15486d[_0x1830('0x9')](_0x1830('0xa'),attributes,{'tableName':_0x1830('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9284=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x2b9e39,_0xca0c84){var _0x239e79=function(_0x583f7d){while(--_0x583f7d){_0x2b9e39['push'](_0x2b9e39['shift']());}};_0x239e79(++_0xca0c84);}(_0x9284,0x1a4));var _0x4928=function(_0x17789d,_0x5d0c27){_0x17789d=_0x17789d-0x0;var _0x2c1d3a=_0x9284[_0x17789d];return _0x2c1d3a;};'use strict';var _=require(_0x4928('0x0'));var util=require('util');var logger=require(_0x4928('0x1'))(_0x4928('0x2'));var moment=require('moment');var BPromise=require(_0x4928('0x3'));var rp=require(_0x4928('0x4'));var fs=require('fs');var path=require(_0x4928('0x5'));var rimraf=require('rimraf');var config=require(_0x4928('0x6'));var attributes=require(_0x4928('0x7'));module[_0x4928('0x8')]=function(_0x400af1,_0x166e88){return _0x400af1[_0x4928('0x9')](_0x4928('0xa'),attributes,{'tableName':_0x4928('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index dde0408..715c98a 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 _0xbe42=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x10d373,_0x2a4e16){var _0x1cac4c=function(_0x505e08){while(--_0x505e08){_0x10d373['push'](_0x10d373['shift']());}};_0x1cac4c(++_0x2a4e16);}(_0xbe42,0x1ae));var _0x2be4=function(_0x838813,_0x448f0f){_0x838813=_0x838813-0x0;var _0x2bd32d=_0xbe42[_0x838813];return _0x2bd32d;};'use strict';var _=require(_0x2be4('0x0'));var util=require(_0x2be4('0x1'));var moment=require(_0x2be4('0x2'));var BPromise=require(_0x2be4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2be4('0x4'));var db=require(_0x2be4('0x5'))['db'];var utils=require(_0x2be4('0x6'));var logger=require('../../config/logger')(_0x2be4('0x7'));var config=require(_0x2be4('0x8'));var jayson=require(_0x2be4('0x9'));var client=jayson[_0x2be4('0xa')][_0x2be4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15f149,_0x2bf681,_0x2646e3){return new BPromise(function(_0x44c427,_0x43ef61){return client[_0x2be4('0xc')](_0x15f149,_0x2646e3)[_0x2be4('0xd')](function(_0x53acb6){logger[_0x2be4('0xe')](_0x2be4('0xf'),_0x2bf681,_0x2be4('0x10'));logger['debug'](_0x2be4('0x11'),_0x2bf681,'request\x20sent',JSON[_0x2be4('0x12')](_0x53acb6));if(_0x53acb6[_0x2be4('0x13')]){if(_0x53acb6[_0x2be4('0x13')][_0x2be4('0x14')]===0x1f4){logger[_0x2be4('0x13')](_0x2be4('0xf'),_0x2bf681,_0x53acb6[_0x2be4('0x13')][_0x2be4('0x15')]);return _0x43ef61(_0x53acb6[_0x2be4('0x13')][_0x2be4('0x15')]);}logger[_0x2be4('0x13')](_0x2be4('0xf'),_0x2bf681,_0x53acb6[_0x2be4('0x13')][_0x2be4('0x15')]);return _0x44c427(_0x53acb6[_0x2be4('0x13')]['message']);}else{logger[_0x2be4('0xe')](_0x2be4('0xf'),_0x2bf681,_0x2be4('0x10'));_0x44c427(_0x53acb6[_0x2be4('0x16')]['message']);}})['catch'](function(_0x2c8364){logger[_0x2be4('0x13')](_0x2be4('0xf'),_0x2bf681,_0x2c8364);_0x43ef61(_0x2c8364);});});} \ No newline at end of file +var _0xb81a=['then','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x5f519b,_0x5b606f){var _0x2461e2=function(_0x510241){while(--_0x510241){_0x5f519b['push'](_0x5f519b['shift']());}};_0x2461e2(++_0x5b606f);}(_0xb81a,0x16a));var _0xab81=function(_0x34a78f,_0x103dd1){_0x34a78f=_0x34a78f-0x0;var _0x4ea069=_0xb81a[_0x34a78f];return _0x4ea069;};'use strict';var _=require(_0xab81('0x0'));var util=require(_0xab81('0x1'));var moment=require(_0xab81('0x2'));var BPromise=require(_0xab81('0x3'));var rs=require(_0xab81('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab81('0x5'))['db'];var utils=require(_0xab81('0x6'));var logger=require(_0xab81('0x7'))(_0xab81('0x8'));var config=require('../../config/environment');var jayson=require(_0xab81('0x9'));var client=jayson[_0xab81('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ca5f2,_0x5542eb,_0x5ba916){return new BPromise(function(_0x10ee09,_0x54fdc1){return client[_0xab81('0xb')](_0x3ca5f2,_0x5ba916)[_0xab81('0xc')](function(_0x534178){logger[_0xab81('0xd')](_0xab81('0xe'),_0x5542eb,'request\x20sent');logger['debug'](_0xab81('0xf'),_0x5542eb,'request\x20sent',JSON['stringify'](_0x534178));if(_0x534178['error']){if(_0x534178[_0xab81('0x10')][_0xab81('0x11')]===0x1f4){logger[_0xab81('0x10')](_0xab81('0xe'),_0x5542eb,_0x534178[_0xab81('0x10')][_0xab81('0x12')]);return _0x54fdc1(_0x534178[_0xab81('0x10')]['message']);}logger[_0xab81('0x10')](_0xab81('0xe'),_0x5542eb,_0x534178['error'][_0xab81('0x12')]);return _0x10ee09(_0x534178[_0xab81('0x10')][_0xab81('0x12')]);}else{logger['info'](_0xab81('0xe'),_0x5542eb,_0xab81('0x13'));_0x10ee09(_0x534178[_0xab81('0x14')][_0xab81('0x12')]);}})[_0xab81('0x15')](function(_0x53b159){logger[_0xab81('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5542eb,_0x53b159);_0x54fdc1(_0x53b159);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index a49946a..ddcf74a 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(_0x2fbac2,_0x2b7376){var _0x52bc10=function(_0x4272e4){while(--_0x4272e4){_0x2fbac2['push'](_0x2fbac2['shift']());}};_0x52bc10(++_0x2b7376);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x3f8a34,_0x4571a0){var _0x34f031=function(_0x2ae3b8){while(--_0x2ae3b8){_0x3f8a34['push'](_0x3f8a34['shift']());}};_0x34f031(++_0x4571a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 9ff5ebe..58d2ece 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 _0xc5cf=['name','TEXT','sequelize','exports','STRING'];(function(_0x14f161,_0x2699b3){var _0x4a9a17=function(_0x2d2177){while(--_0x2d2177){_0x14f161['push'](_0x14f161['shift']());}};_0x4a9a17(++_0x2699b3);}(_0xc5cf,0x15b));var _0xfc5c=function(_0x4cfb5c,_0x5cdb52){_0x4cfb5c=_0x4cfb5c-0x0;var _0x45097c=_0xc5cf[_0x4cfb5c];return _0x45097c;};'use strict';var Sequelize=require(_0xfc5c('0x0'));module[_0xfc5c('0x1')]={'name':{'type':Sequelize[_0xfc5c('0x2')],'allowNull':![],'unique':_0xfc5c('0x3')},'table':{'type':Sequelize[_0xfc5c('0x2')]},'metric':{'type':Sequelize[_0xfc5c('0x4')]},'description':{'type':Sequelize[_0xfc5c('0x2')]}}; \ No newline at end of file +var _0x2ca5=['exports','STRING','name','TEXT'];(function(_0x31295c,_0x2f2b82){var _0x2c150e=function(_0x957f1){while(--_0x957f1){_0x31295c['push'](_0x31295c['shift']());}};_0x2c150e(++_0x2f2b82);}(_0x2ca5,0x108));var _0x52ca=function(_0x45d56b,_0x3b99e4){_0x45d56b=_0x45d56b-0x0;var _0xd62e37=_0x2ca5[_0x45d56b];return _0xd62e37;};'use strict';var Sequelize=require('sequelize');module[_0x52ca('0x0')]={'name':{'type':Sequelize[_0x52ca('0x1')],'allowNull':![],'unique':_0x52ca('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x52ca('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 7a86802..326d5df 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 _0x9a19=['AnalyticMetric','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Metrics','stack','name','send','index','map'];(function(_0x4356cc,_0x5f19b2){var _0x26863f=function(_0x36f4ff){while(--_0x36f4ff){_0x4356cc['push'](_0x4356cc['shift']());}};_0x26863f(++_0x5f19b2);}(_0x9a19,0x114));var _0x99a1=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9a19[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){var _0x179597=_0x5b5dfa[_0x99a1('0x25')]({'plain':!![]});var _0x3c813=_0x99a1('0x26');return db['UserProfileResource'][_0x99a1('0x24')]({'where':{'type':_0x3c813,'resourceId':_0x179597['id']}})['then'](function(){return _0x5b5dfa;});})['then'](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0xa6799b,_0x15a0b6){return function(_0x25d560){if(!_0x25d560){_0xa6799b[_0x99a1('0x19')](0x194);}return _0x25d560;};}function handleError(_0x183037,_0x549645){_0x549645=_0x549645||0x1f4;return function(_0xf41b0d){logger['error'](_0xf41b0d[_0x99a1('0x27')]);if(_0xf41b0d[_0x99a1('0x28')]){delete _0xf41b0d[_0x99a1('0x28')];}_0x183037['status'](_0x549645)[_0x99a1('0x29')](_0xf41b0d);};}exports[_0x99a1('0x2a')]=function(_0x5718b9,_0x37514e){var _0x1434a0={},_0x36aa34={},_0x303d1e={'count':0x0,'rows':[]};var _0x2a5b8c=_[_0x99a1('0x2b')](db[_0x99a1('0x2c')][_0x99a1('0x2d')],function(_0x52da8d){return{'name':_0x52da8d['fieldName'],'type':_0x52da8d[_0x99a1('0x2e')]['key']};});_0x36aa34[_0x99a1('0x2f')]=_[_0x99a1('0x2b')](_0x2a5b8c,'name');_0x36aa34[_0x99a1('0x30')]=_[_0x99a1('0x31')](_0x5718b9[_0x99a1('0x30')]);_0x36aa34[_0x99a1('0x32')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],_0x36aa34[_0x99a1('0x30')]);_0x1434a0[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1434a0[_0x99a1('0x34')]=_0x1434a0['attributes']['length']?_0x1434a0[_0x99a1('0x34')]:_0x36aa34[_0x99a1('0x2f')];if(!_0x5718b9[_0x99a1('0x30')][_0x99a1('0x36')](_0x99a1('0x37'))){_0x1434a0[_0x99a1('0x1e')]=qs[_0x99a1('0x1e')](_0x5718b9['query'][_0x99a1('0x1e')]);_0x1434a0[_0x99a1('0x1c')]=qs['offset'](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x1c')]);}_0x1434a0[_0x99a1('0x38')]=qs[_0x99a1('0x39')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x39')]);_0x1434a0[_0x99a1('0x3a')]=qs[_0x99a1('0x32')](_[_0x99a1('0x3b')](_0x5718b9[_0x99a1('0x30')],_0x36aa34[_0x99a1('0x32')]),_0x2a5b8c);if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]){_0x1434a0['where']=_['merge'](_0x1434a0['where'],{'$or':_[_0x99a1('0x2b')](_0x2a5b8c,function(_0x169df7){if(_0x169df7[_0x99a1('0x2e')]!==_0x99a1('0x3d')){var _0x40613a={};_0x40613a[_0x169df7['name']]={'$like':'%'+_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]+'%'};return _0x40613a;}})});}_0x1434a0=_[_0x99a1('0x3e')]({},_0x1434a0,_0x5718b9['options']);var _0x49be37={'where':_0x1434a0[_0x99a1('0x3a')]};return db[_0x99a1('0x2c')][_0x99a1('0x1f')](_0x49be37)['then'](function(_0x6c4cb){_0x303d1e[_0x99a1('0x1f')]=_0x6c4cb;if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3f')]){_0x1434a0[_0x99a1('0x40')]=[{'all':!![]}];}return db[_0x99a1('0x2c')][_0x99a1('0x41')](_0x1434a0);})[_0x99a1('0x23')](function(_0x1c4ce4){_0x303d1e[_0x99a1('0x42')]=_0x1c4ce4;return _0x303d1e;})['then'](respondWithFilteredResult(_0x37514e,_0x1434a0))[_0x99a1('0x43')](handleError(_0x37514e,null));};exports[_0x99a1('0x44')]=function(_0x3d5373,_0x50d38b){var _0x1beed2={'raw':!![],'where':{'id':_0x3d5373[_0x99a1('0x45')]['id']}},_0x51536d={};_0x51536d[_0x99a1('0x2f')]=_[_0x99a1('0x31')](db[_0x99a1('0x2c')][_0x99a1('0x2d')]);_0x51536d[_0x99a1('0x30')]=_['keys'](_0x3d5373[_0x99a1('0x30')]);_0x51536d['filters']=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],_0x51536d[_0x99a1('0x30')]);_0x1beed2[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x3d5373[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1beed2[_0x99a1('0x34')]=_0x1beed2[_0x99a1('0x34')]['length']?_0x1beed2[_0x99a1('0x34')]:_0x51536d[_0x99a1('0x2f')];if(_0x3d5373['query'][_0x99a1('0x3f')]){_0x1beed2[_0x99a1('0x40')]=[{'all':!![]}];}_0x1beed2=_[_0x99a1('0x3e')]({},_0x1beed2,_0x3d5373[_0x99a1('0x46')]);return db[_0x99a1('0x2c')][_0x99a1('0x47')](_0x1beed2)[_0x99a1('0x23')](handleEntityNotFound(_0x50d38b,null))['then'](respondWithResult(_0x50d38b,null))[_0x99a1('0x43')](handleError(_0x50d38b,null));};exports['create']=function(_0x1d4d3f,_0x269798){return db['AnalyticMetric']['create'](_0x1d4d3f[_0x99a1('0x48')],{})[_0x99a1('0x23')](function(_0x462c15){var _0x4519fb=_0x1d4d3f[_0x99a1('0x49')]['get']({'plain':!![]});if(!_0x4519fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4519fb['role']===_0x99a1('0x49')){var _0x4ae90e=_0x462c15[_0x99a1('0x25')]({'plain':!![]});var _0x30fdfb=_0x99a1('0x26');return db[_0x99a1('0x4a')][_0x99a1('0x47')]({'where':{'name':_0x30fdfb,'userProfileId':_0x4519fb['userProfileId']},'raw':!![]})[_0x99a1('0x23')](function(_0x22bfd8){if(_0x22bfd8&&_0x22bfd8[_0x99a1('0x4b')]===0x0){return db['UserProfileResource'][_0x99a1('0x4c')]({'name':_0x4ae90e['name'],'resourceId':_0x4ae90e['id'],'type':_0x22bfd8['name'],'sectionId':_0x22bfd8['id']},{})[_0x99a1('0x23')](function(){return _0x462c15;});}else{return _0x462c15;}})[_0x99a1('0x43')](function(_0x1dd17b){logger[_0x99a1('0x4d')](_0x99a1('0x4e'),_0x1dd17b);throw _0x1dd17b;});}return _0x462c15;})[_0x99a1('0x23')](respondWithResult(_0x269798,0xc9))[_0x99a1('0x43')](handleError(_0x269798,null));};exports[_0x99a1('0x4f')]=function(_0x16641e,_0x53e9eb){if(_0x16641e[_0x99a1('0x48')]['id']){delete _0x16641e['body']['id'];}return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x16641e['params']['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x53e9eb,null))[_0x99a1('0x23')](saveUpdates(_0x16641e[_0x99a1('0x48')],null))[_0x99a1('0x23')](respondWithResult(_0x53e9eb,null))[_0x99a1('0x43')](handleError(_0x53e9eb,null));};exports[_0x99a1('0x24')]=function(_0x157c49,_0x1a5658){return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x157c49[_0x99a1('0x45')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x1a5658,null))['then'](removeEntity(_0x1a5658,null))['catch'](handleError(_0x1a5658,null));}; \ No newline at end of file +var _0x8ef6=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','AnalyticMetric','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x491c56,_0x3f8a3a){var _0x2a5f36=function(_0x1e0b94){while(--_0x1e0b94){_0x491c56['push'](_0x491c56['shift']());}};_0x2a5f36(++_0x3f8a3a);}(_0x8ef6,0xf2));var _0x68ef=function(_0x43be9d,_0x451fae){_0x43be9d=_0x43be9d-0x0;var _0x1ddb18=_0x8ef6[_0x43be9d];return _0x1ddb18;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){var _0x49374f=_0x438b4c[_0x68ef('0x29')]({'plain':!![]});var _0x13280b='Metrics';return db[_0x68ef('0x2a')]['destroy']({'where':{'type':_0x13280b,'resourceId':_0x49374f['id']}})['then'](function(){return _0x438b4c;});})['then'](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x123041,_0x29518e){return function(_0x52e67e){if(!_0x52e67e){_0x123041['sendStatus'](0x194);}return _0x52e67e;};}function handleError(_0x1cbe4f,_0x28907a){_0x28907a=_0x28907a||0x1f4;return function(_0x7bf96){logger[_0x68ef('0x2b')](_0x7bf96[_0x68ef('0x2c')]);if(_0x7bf96[_0x68ef('0x2d')]){delete _0x7bf96[_0x68ef('0x2d')];}_0x1cbe4f[_0x68ef('0x1d')](_0x28907a)['send'](_0x7bf96);};}exports[_0x68ef('0x2e')]=function(_0x4314bd,_0x132d9e){var _0x4c25aa={},_0x370a8f={},_0x523120={'count':0x0,'rows':[]};var _0x133788=_[_0x68ef('0x2f')](db['AnalyticMetric']['rawAttributes'],function(_0x159395){return{'name':_0x159395[_0x68ef('0x30')],'type':_0x159395['type'][_0x68ef('0x31')]};});_0x370a8f[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0x133788,_0x68ef('0x2d'));_0x370a8f['query']=_[_0x68ef('0x33')](_0x4314bd[_0x68ef('0x34')]);_0x370a8f['filters']=_[_0x68ef('0x35')](_0x370a8f['model'],_0x370a8f[_0x68ef('0x34')]);_0x4c25aa[_0x68ef('0x36')]=_['intersection'](_0x370a8f[_0x68ef('0x32')],qs['fields'](_0x4314bd[_0x68ef('0x34')]['fields']));_0x4c25aa[_0x68ef('0x36')]=_0x4c25aa[_0x68ef('0x36')][_0x68ef('0x37')]?_0x4c25aa['attributes']:_0x370a8f[_0x68ef('0x32')];if(!_0x4314bd['query'][_0x68ef('0x38')]('nolimit')){_0x4c25aa[_0x68ef('0x21')]=qs[_0x68ef('0x21')](_0x4314bd[_0x68ef('0x34')][_0x68ef('0x21')]);_0x4c25aa[_0x68ef('0x1f')]=qs[_0x68ef('0x1f')](_0x4314bd['query'][_0x68ef('0x1f')]);}_0x4c25aa[_0x68ef('0x39')]=qs[_0x68ef('0x3a')](_0x4314bd['query'][_0x68ef('0x3a')]);_0x4c25aa[_0x68ef('0x3b')]=qs[_0x68ef('0x3c')](_['pick'](_0x4314bd['query'],_0x370a8f[_0x68ef('0x3c')]),_0x133788);if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x3d')]){_0x4c25aa[_0x68ef('0x3b')]=_[_0x68ef('0x3e')](_0x4c25aa[_0x68ef('0x3b')],{'$or':_[_0x68ef('0x2f')](_0x133788,function(_0x5b1246){if(_0x5b1246[_0x68ef('0x3f')]!==_0x68ef('0x40')){var _0x2f6ee0={};_0x2f6ee0[_0x5b1246[_0x68ef('0x2d')]]={'$like':'%'+_0x4314bd['query'][_0x68ef('0x3d')]+'%'};return _0x2f6ee0;}})});}_0x4c25aa=_[_0x68ef('0x3e')]({},_0x4c25aa,_0x4314bd[_0x68ef('0x41')]);var _0x410c10={'where':_0x4c25aa[_0x68ef('0x3b')]};return db[_0x68ef('0x42')]['count'](_0x410c10)[_0x68ef('0x27')](function(_0x3f7699){_0x523120[_0x68ef('0x43')]=_0x3f7699;if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x44')]){_0x4c25aa[_0x68ef('0x45')]=[{'all':!![]}];}return db[_0x68ef('0x42')][_0x68ef('0x46')](_0x4c25aa);})[_0x68ef('0x27')](function(_0x531096){_0x523120[_0x68ef('0x47')]=_0x531096;return _0x523120;})[_0x68ef('0x27')](respondWithFilteredResult(_0x132d9e,_0x4c25aa))[_0x68ef('0x48')](handleError(_0x132d9e,null));};exports[_0x68ef('0x49')]=function(_0xdeacf2,_0x183377){var _0xcac58f={'raw':!![],'where':{'id':_0xdeacf2[_0x68ef('0x4a')]['id']}},_0x576767={};_0x576767['model']=_[_0x68ef('0x33')](db[_0x68ef('0x42')][_0x68ef('0x4b')]);_0x576767[_0x68ef('0x34')]=_['keys'](_0xdeacf2[_0x68ef('0x34')]);_0x576767['filters']=_[_0x68ef('0x35')](_0x576767['model'],_0x576767[_0x68ef('0x34')]);_0xcac58f[_0x68ef('0x36')]=_[_0x68ef('0x35')](_0x576767['model'],qs['fields'](_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x4c')]));_0xcac58f['attributes']=_0xcac58f['attributes']['length']?_0xcac58f[_0x68ef('0x36')]:_0x576767[_0x68ef('0x32')];if(_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x44')]){_0xcac58f[_0x68ef('0x45')]=[{'all':!![]}];}_0xcac58f=_['merge']({},_0xcac58f,_0xdeacf2['options']);return db[_0x68ef('0x42')][_0x68ef('0x4d')](_0xcac58f)[_0x68ef('0x27')](handleEntityNotFound(_0x183377,null))[_0x68ef('0x27')](respondWithResult(_0x183377,null))['catch'](handleError(_0x183377,null));};exports[_0x68ef('0x4e')]=function(_0x474e5a,_0x1c9b6f){return db[_0x68ef('0x42')]['create'](_0x474e5a['body'],{})[_0x68ef('0x27')](function(_0x3c3074){var _0x566e7c=_0x474e5a[_0x68ef('0x4f')][_0x68ef('0x29')]({'plain':!![]});if(!_0x566e7c)throw new Error(_0x68ef('0x50'));if(_0x566e7c[_0x68ef('0x51')]===_0x68ef('0x4f')){var _0x4f0f77=_0x3c3074[_0x68ef('0x29')]({'plain':!![]});var _0x3984ca=_0x68ef('0x52');return db['UserProfileSection'][_0x68ef('0x4d')]({'where':{'name':_0x3984ca,'userProfileId':_0x566e7c[_0x68ef('0x53')]},'raw':!![]})[_0x68ef('0x27')](function(_0x50ef1f){if(_0x50ef1f&&_0x50ef1f[_0x68ef('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f0f77[_0x68ef('0x2d')],'resourceId':_0x4f0f77['id'],'type':_0x50ef1f['name'],'sectionId':_0x50ef1f['id']},{})[_0x68ef('0x27')](function(){return _0x3c3074;});}else{return _0x3c3074;}})[_0x68ef('0x48')](function(_0x53ebd){logger[_0x68ef('0x2b')](_0x68ef('0x55'),_0x53ebd);throw _0x53ebd;});}return _0x3c3074;})[_0x68ef('0x27')](respondWithResult(_0x1c9b6f,0xc9))[_0x68ef('0x48')](handleError(_0x1c9b6f,null));};exports[_0x68ef('0x56')]=function(_0x2b35f4,_0x247915){if(_0x2b35f4['body']['id']){delete _0x2b35f4['body']['id'];}return db[_0x68ef('0x42')][_0x68ef('0x4d')]({'where':{'id':_0x2b35f4[_0x68ef('0x4a')]['id']}})[_0x68ef('0x27')](handleEntityNotFound(_0x247915,null))[_0x68ef('0x27')](saveUpdates(_0x2b35f4[_0x68ef('0x57')],null))[_0x68ef('0x27')](respondWithResult(_0x247915,null))[_0x68ef('0x48')](handleError(_0x247915,null));};exports[_0x68ef('0x28')]=function(_0x4c2e9c,_0x5685bb){return db[_0x68ef('0x42')]['find']({'where':{'id':_0x4c2e9c[_0x68ef('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5685bb,null))[_0x68ef('0x27')](removeEntity(_0x5685bb,null))[_0x68ef('0x48')](handleError(_0x5685bb,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index ee493ae..eccfdd0 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 _0xb3d8=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0x24dc59,_0x92ae8e){var _0x8d63ea=function(_0x1d72de){while(--_0x1d72de){_0x24dc59['push'](_0x24dc59['shift']());}};_0x8d63ea(++_0x92ae8e);}(_0xb3d8,0xdc));var _0x8b3d=function(_0x3730eb,_0x96ee91){_0x3730eb=_0x3730eb-0x0;var _0x5701be=_0xb3d8[_0x3730eb];return _0x5701be;};'use strict';var _=require('lodash');var util=require(_0x8b3d('0x0'));var logger=require(_0x8b3d('0x1'))(_0x8b3d('0x2'));var moment=require(_0x8b3d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b3d('0x4'));var rimraf=require(_0x8b3d('0x5'));var config=require(_0x8b3d('0x6'));var attributes=require(_0x8b3d('0x7'));module[_0x8b3d('0x8')]=function(_0x22d97b,_0x3b0f04){return _0x22d97b[_0x8b3d('0x9')](_0x8b3d('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c6c=['rimraf','../../config/environment','exports','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x2acf48,_0x176934){_0x2acf48=_0x2acf48-0x0;var _0x4a5b1e=_0x3c6c[_0x2acf48];return _0x4a5b1e;};'use strict';var _=require(_0xc3c6('0x0'));var util=require('util');var logger=require(_0xc3c6('0x1'))(_0xc3c6('0x2'));var moment=require(_0xc3c6('0x3'));var BPromise=require(_0xc3c6('0x4'));var rp=require(_0xc3c6('0x5'));var fs=require('fs');var path=require(_0xc3c6('0x6'));var rimraf=require(_0xc3c6('0x7'));var config=require(_0xc3c6('0x8'));var attributes=require('./analyticMetric.attributes');module[_0xc3c6('0x9')]=function(_0x4a2ca1,_0xe7731e){return _0x4a2ca1['define']('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 0c308e1..20d63ed 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 _0xd07e=['AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd07e,0x14c));var _0xed07=function(_0x2fcbaa,_0x35eeb4){_0x2fcbaa=_0x2fcbaa-0x0;var _0x206a5a=_0xd07e[_0x2fcbaa];return _0x206a5a;};'use strict';var _=require('lodash');var util=require(_0xed07('0x0'));var moment=require(_0xed07('0x1'));var BPromise=require(_0xed07('0x2'));var rs=require(_0xed07('0x3'));var fs=require('fs');var Redis=require(_0xed07('0x4'));var db=require(_0xed07('0x5'))['db'];var utils=require(_0xed07('0x6'));var logger=require(_0xed07('0x7'))(_0xed07('0x8'));var config=require('../../config/environment');var jayson=require(_0xed07('0x9'));var client=jayson[_0xed07('0xa')][_0xed07('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2649db,_0x268ed7,_0x58cc48){return new BPromise(function(_0x1af133,_0x4fe486){return client[_0xed07('0xc')](_0x2649db,_0x58cc48)[_0xed07('0xd')](function(_0x14110d){logger[_0xed07('0xe')](_0xed07('0xf'),_0x268ed7,_0xed07('0x10'));logger[_0xed07('0x11')](_0xed07('0x12'),_0x268ed7,_0xed07('0x10'),JSON[_0xed07('0x13')](_0x14110d));if(_0x14110d[_0xed07('0x14')]){if(_0x14110d[_0xed07('0x14')][_0xed07('0x15')]===0x1f4){logger[_0xed07('0x14')](_0xed07('0xf'),_0x268ed7,_0x14110d[_0xed07('0x14')][_0xed07('0x16')]);return _0x4fe486(_0x14110d[_0xed07('0x14')][_0xed07('0x16')]);}logger[_0xed07('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x268ed7,_0x14110d['error'][_0xed07('0x16')]);return _0x1af133(_0x14110d[_0xed07('0x14')][_0xed07('0x16')]);}else{logger[_0xed07('0xe')](_0xed07('0xf'),_0x268ed7,_0xed07('0x10'));_0x1af133(_0x14110d[_0xed07('0x17')][_0xed07('0x16')]);}})[_0xed07('0x18')](function(_0x4f0e3e){logger['error'](_0xed07('0xf'),_0x268ed7,_0x4f0e3e);_0x4fe486(_0x4f0e3e);});});} \ No newline at end of file +var _0xf603=['http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x410787,_0x53f6d5){var _0xc635d8=function(_0x264cd9){while(--_0x264cd9){_0x410787['push'](_0x410787['shift']());}};_0xc635d8(++_0x53f6d5);}(_0xf603,0x1c3));var _0x3f60=function(_0x1b9207,_0x4ae729){_0x1b9207=_0x1b9207-0x0;var _0x54630b=_0xf603[_0x1b9207];return _0x54630b;};'use strict';var _=require(_0x3f60('0x0'));var util=require('util');var moment=require(_0x3f60('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f60('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f60('0x3'));var logger=require(_0x3f60('0x4'))(_0x3f60('0x5'));var config=require(_0x3f60('0x6'));var jayson=require(_0x3f60('0x7'));var client=jayson[_0x3f60('0x8')][_0x3f60('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2feec7,_0x3d0899,_0x2a7bf0){return new BPromise(function(_0x35352f,_0x2abd9e){return client[_0x3f60('0xa')](_0x2feec7,_0x2a7bf0)[_0x3f60('0xb')](function(_0x3331fd){logger[_0x3f60('0xc')](_0x3f60('0xd'),_0x3d0899,_0x3f60('0xe'));logger[_0x3f60('0xf')](_0x3f60('0x10'),_0x3d0899,_0x3f60('0xe'),JSON[_0x3f60('0x11')](_0x3331fd));if(_0x3331fd[_0x3f60('0x12')]){if(_0x3331fd[_0x3f60('0x12')][_0x3f60('0x13')]===0x1f4){logger[_0x3f60('0x12')](_0x3f60('0xd'),_0x3d0899,_0x3331fd[_0x3f60('0x12')][_0x3f60('0x14')]);return _0x2abd9e(_0x3331fd[_0x3f60('0x12')][_0x3f60('0x14')]);}logger['error'](_0x3f60('0xd'),_0x3d0899,_0x3331fd['error']['message']);return _0x35352f(_0x3331fd[_0x3f60('0x12')][_0x3f60('0x14')]);}else{logger[_0x3f60('0xc')](_0x3f60('0xd'),_0x3d0899,_0x3f60('0xe'));_0x35352f(_0x3331fd[_0x3f60('0x15')]['message']);}})[_0x3f60('0x16')](function(_0x37efde){logger[_0x3f60('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x3d0899,_0x37efde);_0x2abd9e(_0x37efde);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 07f92b0..f073527 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 _0x3ca4=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy'];(function(_0x506330,_0x10062e){var _0x3dd612=function(_0x1978b3){while(--_0x1978b3){_0x506330['push'](_0x506330['shift']());}};_0x3dd612(++_0x10062e);}(_0x3ca4,0x17d));var _0x43ca=function(_0x3d0e7e,_0x564590){_0x3d0e7e=_0x3d0e7e-0x0;var _0x4819aa=_0x3ca4[_0x3d0e7e];return _0x4819aa;};'use strict';var multer=require(_0x43ca('0x0'));var util=require(_0x43ca('0x1'));var path=require(_0x43ca('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x43ca('0x3')]();var fs_extra=require(_0x43ca('0x4'));var auth=require(_0x43ca('0x5'));var interaction=require(_0x43ca('0x6'));var config=require(_0x43ca('0x7'));var controller=require(_0x43ca('0x8'));router[_0x43ca('0x9')]('/',auth['isAuthenticated'](),controller[_0x43ca('0xa')]);router[_0x43ca('0x9')](_0x43ca('0xb'),auth[_0x43ca('0xc')](),controller[_0x43ca('0xd')]);router[_0x43ca('0xe')]('/',auth[_0x43ca('0xc')](),controller[_0x43ca('0xf')]);router['put']('/:id',auth[_0x43ca('0xc')](),controller[_0x43ca('0x10')]);router[_0x43ca('0x11')](_0x43ca('0xb'),auth['isAuthenticated'](),controller[_0x43ca('0x12')]);module[_0x43ca('0x13')]=router; \ No newline at end of file +var _0x6208=['put','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x2ef265,_0x3c6a95){var _0x2299af=function(_0x3f18e2){while(--_0x3f18e2){_0x2ef265['push'](_0x2ef265['shift']());}};_0x2299af(++_0x3c6a95);}(_0x6208,0x17d));var _0x8620=function(_0x2d4065,_0x38dc95){_0x2d4065=_0x2d4065-0x0;var _0xef6016=_0x6208[_0x2d4065];return _0xef6016;};'use strict';var multer=require(_0x8620('0x0'));var util=require('util');var path=require(_0x8620('0x1'));var timeout=require(_0x8620('0x2'));var express=require('express');var router=express[_0x8620('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8620('0x4'));var interaction=require(_0x8620('0x5'));var config=require(_0x8620('0x6'));var controller=require(_0x8620('0x7'));router[_0x8620('0x8')]('/',auth[_0x8620('0x9')](),controller[_0x8620('0xa')]);router['get'](_0x8620('0xb'),auth[_0x8620('0x9')](),controller[_0x8620('0xc')]);router[_0x8620('0xd')]('/',auth[_0x8620('0x9')](),controller[_0x8620('0xe')]);router[_0x8620('0xf')](_0x8620('0xb'),auth[_0x8620('0x9')](),controller['update']);router[_0x8620('0x10')](_0x8620('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x8620('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index cf101d1..acad3cd 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 _0x7ca3=['exports','TEXT','sequelize'];(function(_0x4d46ee,_0xa971ad){var _0x3f9536=function(_0xe885c2){while(--_0xe885c2){_0x4d46ee['push'](_0x4d46ee['shift']());}};_0x3f9536(++_0xa971ad);}(_0x7ca3,0x17c));var _0x37ca=function(_0x29db71,_0x306de1){_0x29db71=_0x29db71-0x0;var _0x2c8a07=_0x7ca3[_0x29db71];return _0x2c8a07;};'use strict';var Sequelize=require(_0x37ca('0x0'));module[_0x37ca('0x1')]={'tree':{'type':Sequelize[_0x37ca('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2a56=['exports','TEXT','sequelize'];(function(_0x5496ff,_0x104d17){var _0x36881c=function(_0x395a82){while(--_0x395a82){_0x5496ff['push'](_0x5496ff['shift']());}};_0x36881c(++_0x104d17);}(_0x2a56,0x1c7));var _0x62a5=function(_0x29b38c,_0x87560d){_0x29b38c=_0x29b38c-0x0;var _0x36bfd5=_0x2a56[_0x29b38c];return _0x36bfd5;};'use strict';var Sequelize=require(_0x62a5('0x0'));module[_0x62a5('0x1')]={'tree':{'type':Sequelize[_0x62a5('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index c048a64..de162c2 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 _0xc85f=['querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','AnalyticTreeReport','includeAll','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js'];(function(_0x32f8d7,_0x4da0bd){var _0x29ea63=function(_0x26c9d8){while(--_0x26c9d8){_0x32f8d7['push'](_0x32f8d7['shift']());}};_0x29ea63(++_0x4da0bd);}(_0xc85f,0x163));var _0xfc85=function(_0x3553b5,_0x27c233){_0x3553b5=_0x3553b5-0x0;var _0x47f68e=_0xc85f[_0x3553b5];return _0x47f68e;};'use strict';var emlformat=require(_0xfc85('0x0'));var rimraf=require(_0xfc85('0x1'));var zipdir=require(_0xfc85('0x2'));var jsonpatch=require(_0xfc85('0x3'));var rp=require(_0xfc85('0x4'));var moment=require(_0xfc85('0x5'));var BPromise=require(_0xfc85('0x6'));var Mustache=require(_0xfc85('0x7'));var util=require(_0xfc85('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xfc85('0x9'));var ejs=require(_0xfc85('0xa'));var fs=require('fs');var fs_extra=require(_0xfc85('0xb'));var _=require(_0xfc85('0xc'));var squel=require(_0xfc85('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfc85('0xe'));var toCsv=require(_0xfc85('0x9'));var querystring=require(_0xfc85('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfc85('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc85('0x11'));var logger=require(_0xfc85('0x12'))(_0xfc85('0x13'));var utils=require(_0xfc85('0x14'));var config=require(_0xfc85('0x15'));var licenseUtil=require(_0xfc85('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30b843,_0x3d90f6){_0x3d90f6=_0x3d90f6||0xcc;return function(_0x27f0eb){if(_0x27f0eb){return _0x30b843[_0xfc85('0x17')](_0x3d90f6);}return _0x30b843['status'](_0x3d90f6)[_0xfc85('0x18')]();};}function respondWithResult(_0x3d0906,_0x2503a6){_0x2503a6=_0x2503a6||0xc8;return function(_0x19dfde){if(_0x19dfde){return _0x3d0906['status'](_0x2503a6)[_0xfc85('0x19')](_0x19dfde);}};}function respondWithFilteredResult(_0x25db48,_0x504922){return function(_0x3068b6){if(_0x3068b6){var _0x3845b1=typeof _0x504922['offset']===_0xfc85('0x1a')&&typeof _0x504922[_0xfc85('0x1b')]===_0xfc85('0x1a');var _0x1f7d35=_0x3068b6[_0xfc85('0x1c')];var _0x4ad72b=_0x3845b1?0x0:_0x504922[_0xfc85('0x1d')];var _0x4b2a37=_0x3845b1?_0x3068b6[_0xfc85('0x1c')]:_0x504922[_0xfc85('0x1d')]+_0x504922[_0xfc85('0x1b')];var _0x13d158;if(_0x4b2a37>=_0x1f7d35){_0x4b2a37=_0x1f7d35;_0x13d158=0xc8;}else{_0x13d158=0xce;}_0x25db48[_0xfc85('0x1e')](_0x13d158);return _0x25db48[_0xfc85('0x1f')](_0xfc85('0x20'),_0x4ad72b+'-'+_0x4b2a37+'/'+_0x1f7d35)[_0xfc85('0x19')](_0x3068b6);}return null;};}function patchUpdates(_0x157c39){return function(_0x4e20c1){try{jsonpatch[_0xfc85('0x21')](_0x4e20c1,_0x157c39,!![]);}catch(_0x1e690a){return BPromise[_0xfc85('0x22')](_0x1e690a);}return _0x4e20c1[_0xfc85('0x23')]();};}function saveUpdates(_0x5f3586,_0x40cb71){return function(_0x5dd0b1){if(_0x5dd0b1){return _0x5dd0b1[_0xfc85('0x24')](_0x5f3586)[_0xfc85('0x25')](function(_0x56db18){return _0x56db18;});}return null;};}function removeEntity(_0x122111,_0x2eec52){return function(_0x5a030b){if(_0x5a030b){return _0x5a030b[_0xfc85('0x26')]()[_0xfc85('0x25')](function(){_0x122111[_0xfc85('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35bb69,_0x4aa3df){return function(_0x340633){if(!_0x340633){_0x35bb69[_0xfc85('0x17')](0x194);}return _0x340633;};}function handleError(_0x3f513c,_0x34187b){_0x34187b=_0x34187b||0x1f4;return function(_0x24adf3){logger[_0xfc85('0x27')](_0x24adf3[_0xfc85('0x28')]);if(_0x24adf3[_0xfc85('0x29')]){delete _0x24adf3['name'];}_0x3f513c[_0xfc85('0x1e')](_0x34187b)[_0xfc85('0x2a')](_0x24adf3);};}exports[_0xfc85('0x2b')]=function(_0x38a8bf,_0x1bb7e5){var _0x1fe253={},_0x438715={},_0x254778={'count':0x0,'rows':[]};var _0x202f66=_[_0xfc85('0x2c')](db['AnalyticTreeReport'][_0xfc85('0x2d')],function(_0x59eb35){return{'name':_0x59eb35[_0xfc85('0x2e')],'type':_0x59eb35[_0xfc85('0x2f')]['key']};});_0x438715[_0xfc85('0x30')]=_[_0xfc85('0x2c')](_0x202f66,_0xfc85('0x29'));_0x438715[_0xfc85('0x31')]=_[_0xfc85('0x32')](_0x38a8bf[_0xfc85('0x31')]);_0x438715[_0xfc85('0x33')]=_[_0xfc85('0x34')](_0x438715[_0xfc85('0x30')],_0x438715[_0xfc85('0x31')]);_0x1fe253['attributes']=_[_0xfc85('0x34')](_0x438715['model'],qs[_0xfc85('0x35')](_0x38a8bf[_0xfc85('0x31')]['fields']));_0x1fe253[_0xfc85('0x36')]=_0x1fe253['attributes'][_0xfc85('0x37')]?_0x1fe253[_0xfc85('0x36')]:_0x438715['model'];if(!_0x38a8bf[_0xfc85('0x31')][_0xfc85('0x38')](_0xfc85('0x39'))){_0x1fe253[_0xfc85('0x1b')]=qs['limit'](_0x38a8bf[_0xfc85('0x31')][_0xfc85('0x1b')]);_0x1fe253[_0xfc85('0x1d')]=qs[_0xfc85('0x1d')](_0x38a8bf['query']['offset']);}_0x1fe253[_0xfc85('0x3a')]=qs[_0xfc85('0x3b')](_0x38a8bf['query'][_0xfc85('0x3b')]);_0x1fe253[_0xfc85('0x3c')]=qs[_0xfc85('0x33')](_[_0xfc85('0x3d')](_0x38a8bf['query'],_0x438715['filters']),_0x202f66);if(_0x38a8bf[_0xfc85('0x31')][_0xfc85('0x3e')]){_0x1fe253[_0xfc85('0x3c')]=_[_0xfc85('0x3f')](_0x1fe253[_0xfc85('0x3c')],{'$or':_[_0xfc85('0x2c')](_0x202f66,function(_0x131636){if(_0x131636[_0xfc85('0x2f')]!=='VIRTUAL'){var _0x5bc62b={};_0x5bc62b[_0x131636[_0xfc85('0x29')]]={'$like':'%'+_0x38a8bf[_0xfc85('0x31')][_0xfc85('0x3e')]+'%'};return _0x5bc62b;}})});}_0x1fe253=_[_0xfc85('0x3f')]({},_0x1fe253,_0x38a8bf['options']);var _0xbb964b={'where':_0x1fe253[_0xfc85('0x3c')]};return db[_0xfc85('0x40')][_0xfc85('0x1c')](_0xbb964b)['then'](function(_0xbc5158){_0x254778[_0xfc85('0x1c')]=_0xbc5158;if(_0x38a8bf[_0xfc85('0x31')][_0xfc85('0x41')]){_0x1fe253['include']=[{'all':!![]}];}return db[_0xfc85('0x40')][_0xfc85('0x42')](_0x1fe253);})[_0xfc85('0x25')](function(_0x3a2863){_0x254778[_0xfc85('0x43')]=_0x3a2863;return _0x254778;})[_0xfc85('0x25')](respondWithFilteredResult(_0x1bb7e5,_0x1fe253))[_0xfc85('0x44')](handleError(_0x1bb7e5,null));};exports[_0xfc85('0x45')]=function(_0x1d533c,_0x1ffe51){var _0x5d764d={'raw':!![],'where':{'id':_0x1d533c[_0xfc85('0x46')]['id']}},_0x46f3cf={};_0x46f3cf[_0xfc85('0x30')]=_[_0xfc85('0x32')](db[_0xfc85('0x40')][_0xfc85('0x2d')]);_0x46f3cf[_0xfc85('0x31')]=_[_0xfc85('0x32')](_0x1d533c['query']);_0x46f3cf[_0xfc85('0x33')]=_[_0xfc85('0x34')](_0x46f3cf[_0xfc85('0x30')],_0x46f3cf[_0xfc85('0x31')]);_0x5d764d[_0xfc85('0x36')]=_[_0xfc85('0x34')](_0x46f3cf[_0xfc85('0x30')],qs['fields'](_0x1d533c[_0xfc85('0x31')][_0xfc85('0x35')]));_0x5d764d[_0xfc85('0x36')]=_0x5d764d[_0xfc85('0x36')][_0xfc85('0x37')]?_0x5d764d[_0xfc85('0x36')]:_0x46f3cf[_0xfc85('0x30')];if(_0x1d533c[_0xfc85('0x31')][_0xfc85('0x41')]){_0x5d764d['include']=[{'all':!![]}];}_0x5d764d=_[_0xfc85('0x3f')]({},_0x5d764d,_0x1d533c['options']);return db[_0xfc85('0x40')][_0xfc85('0x47')](_0x5d764d)[_0xfc85('0x25')](handleEntityNotFound(_0x1ffe51,null))['then'](respondWithResult(_0x1ffe51,null))[_0xfc85('0x44')](handleError(_0x1ffe51,null));};exports['create']=function(_0x32d674,_0x213019){return db[_0xfc85('0x40')][_0xfc85('0x48')](_0x32d674[_0xfc85('0x49')],{})[_0xfc85('0x25')](respondWithResult(_0x213019,0xc9))[_0xfc85('0x44')](handleError(_0x213019,null));};exports[_0xfc85('0x24')]=function(_0x1a3865,_0x54b6ac){if(_0x1a3865[_0xfc85('0x49')]['id']){delete _0x1a3865[_0xfc85('0x49')]['id'];}return db[_0xfc85('0x40')][_0xfc85('0x47')]({'where':{'id':_0x1a3865[_0xfc85('0x46')]['id']}})['then'](handleEntityNotFound(_0x54b6ac,null))['then'](saveUpdates(_0x1a3865[_0xfc85('0x49')],null))[_0xfc85('0x25')](respondWithResult(_0x54b6ac,null))[_0xfc85('0x44')](handleError(_0x54b6ac,null));};exports[_0xfc85('0x26')]=function(_0x344097,_0x88f8ed){return db[_0xfc85('0x40')]['find']({'where':{'id':_0x344097[_0xfc85('0x46')]['id']}})[_0xfc85('0x25')](handleEntityNotFound(_0x88f8ed,null))[_0xfc85('0x25')](removeEntity(_0x88f8ed,null))[_0xfc85('0x44')](handleError(_0x88f8ed,null));}; \ No newline at end of file +var _0xf411=['type','VIRTUAL','options','includeAll','catch','show','params','keys','include','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','key','query','filters','intersection','attributes','model','fields','hasOwnProperty','limit','where','filter','merge'];(function(_0x55d829,_0x43f06c){var _0x52163b=function(_0x493cd8){while(--_0x493cd8){_0x55d829['push'](_0x55d829['shift']());}};_0x52163b(++_0x43f06c);}(_0xf411,0x98));var _0x1f41=function(_0x2ee712,_0x5a2179){_0x2ee712=_0x2ee712-0x0;var _0x2e8783=_0xf411[_0x2ee712];return _0x2e8783;};'use strict';var emlformat=require(_0x1f41('0x0'));var rimraf=require(_0x1f41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f41('0x2'));var rp=require(_0x1f41('0x3'));var moment=require(_0x1f41('0x4'));var BPromise=require(_0x1f41('0x5'));var Mustache=require(_0x1f41('0x6'));var util=require(_0x1f41('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1f41('0x8'));var ejs=require(_0x1f41('0x9'));var fs=require('fs');var fs_extra=require(_0x1f41('0xa'));var _=require(_0x1f41('0xb'));var squel=require(_0x1f41('0xc'));var crypto=require('crypto');var jsforce=require(_0x1f41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1f41('0x8'));var querystring=require(_0x1f41('0xe'));var Papa=require(_0x1f41('0xf'));var Redis=require('ioredis');var authService=require(_0x1f41('0x10'));var qs=require(_0x1f41('0x11'));var as=require(_0x1f41('0x12'));var hardwareService=require(_0x1f41('0x13'));var logger=require(_0x1f41('0x14'))(_0x1f41('0x15'));var utils=require(_0x1f41('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1f41('0x17'))['db'];function respondWithStatusCode(_0x148b9a,_0x2ffc46){_0x2ffc46=_0x2ffc46||0xcc;return function(_0x11c3c5){if(_0x11c3c5){return _0x148b9a['sendStatus'](_0x2ffc46);}return _0x148b9a[_0x1f41('0x18')](_0x2ffc46)['end']();};}function respondWithResult(_0x2dac4c,_0x557ff8){_0x557ff8=_0x557ff8||0xc8;return function(_0x8de505){if(_0x8de505){return _0x2dac4c[_0x1f41('0x18')](_0x557ff8)[_0x1f41('0x19')](_0x8de505);}};}function respondWithFilteredResult(_0x507652,_0x541a3c){return function(_0x196acd){if(_0x196acd){var _0x9a7fbc=typeof _0x541a3c[_0x1f41('0x1a')]===_0x1f41('0x1b')&&typeof _0x541a3c['limit']===_0x1f41('0x1b');var _0x768646=_0x196acd[_0x1f41('0x1c')];var _0x3ea6ff=_0x9a7fbc?0x0:_0x541a3c[_0x1f41('0x1a')];var _0x5e8dfc=_0x9a7fbc?_0x196acd[_0x1f41('0x1c')]:_0x541a3c[_0x1f41('0x1a')]+_0x541a3c['limit'];var _0x1d44ef;if(_0x5e8dfc>=_0x768646){_0x5e8dfc=_0x768646;_0x1d44ef=0xc8;}else{_0x1d44ef=0xce;}_0x507652['status'](_0x1d44ef);return _0x507652[_0x1f41('0x1d')](_0x1f41('0x1e'),_0x3ea6ff+'-'+_0x5e8dfc+'/'+_0x768646)[_0x1f41('0x19')](_0x196acd);}return null;};}function patchUpdates(_0x3d8008){return function(_0x26e2fc){try{jsonpatch[_0x1f41('0x1f')](_0x26e2fc,_0x3d8008,!![]);}catch(_0x55f746){return BPromise['reject'](_0x55f746);}return _0x26e2fc[_0x1f41('0x20')]();};}function saveUpdates(_0x2c6624,_0x2abceb){return function(_0x26c159){if(_0x26c159){return _0x26c159[_0x1f41('0x21')](_0x2c6624)[_0x1f41('0x22')](function(_0x2641fa){return _0x2641fa;});}return null;};}function removeEntity(_0x59ea4d,_0x19977f){return function(_0x224fbd){if(_0x224fbd){return _0x224fbd[_0x1f41('0x23')]()[_0x1f41('0x22')](function(){_0x59ea4d[_0x1f41('0x18')](0xcc)[_0x1f41('0x24')]();});}};}function handleEntityNotFound(_0x168197,_0x3bce12){return function(_0x59269b){if(!_0x59269b){_0x168197[_0x1f41('0x25')](0x194);}return _0x59269b;};}function handleError(_0xf9a529,_0x5a5f38){_0x5a5f38=_0x5a5f38||0x1f4;return function(_0x23780){logger[_0x1f41('0x26')](_0x23780[_0x1f41('0x27')]);if(_0x23780[_0x1f41('0x28')]){delete _0x23780['name'];}_0xf9a529[_0x1f41('0x18')](_0x5a5f38)[_0x1f41('0x29')](_0x23780);};}exports['index']=function(_0x415d30,_0x2aab27){var _0x45e687={},_0x1f0c9c={},_0x2710ef={'count':0x0,'rows':[]};var _0x273e66=_[_0x1f41('0x2a')](db[_0x1f41('0x2b')][_0x1f41('0x2c')],function(_0x51a323){return{'name':_0x51a323[_0x1f41('0x2d')],'type':_0x51a323['type'][_0x1f41('0x2e')]};});_0x1f0c9c['model']=_[_0x1f41('0x2a')](_0x273e66,_0x1f41('0x28'));_0x1f0c9c[_0x1f41('0x2f')]=_['keys'](_0x415d30['query']);_0x1f0c9c[_0x1f41('0x30')]=_[_0x1f41('0x31')](_0x1f0c9c['model'],_0x1f0c9c[_0x1f41('0x2f')]);_0x45e687[_0x1f41('0x32')]=_['intersection'](_0x1f0c9c[_0x1f41('0x33')],qs[_0x1f41('0x34')](_0x415d30[_0x1f41('0x2f')][_0x1f41('0x34')]));_0x45e687[_0x1f41('0x32')]=_0x45e687[_0x1f41('0x32')]['length']?_0x45e687[_0x1f41('0x32')]:_0x1f0c9c[_0x1f41('0x33')];if(!_0x415d30[_0x1f41('0x2f')][_0x1f41('0x35')]('nolimit')){_0x45e687[_0x1f41('0x36')]=qs['limit'](_0x415d30[_0x1f41('0x2f')][_0x1f41('0x36')]);_0x45e687[_0x1f41('0x1a')]=qs[_0x1f41('0x1a')](_0x415d30[_0x1f41('0x2f')][_0x1f41('0x1a')]);}_0x45e687['order']=qs['sort'](_0x415d30[_0x1f41('0x2f')]['sort']);_0x45e687[_0x1f41('0x37')]=qs[_0x1f41('0x30')](_['pick'](_0x415d30[_0x1f41('0x2f')],_0x1f0c9c[_0x1f41('0x30')]),_0x273e66);if(_0x415d30[_0x1f41('0x2f')][_0x1f41('0x38')]){_0x45e687[_0x1f41('0x37')]=_[_0x1f41('0x39')](_0x45e687['where'],{'$or':_['map'](_0x273e66,function(_0x1050bc){if(_0x1050bc[_0x1f41('0x3a')]!==_0x1f41('0x3b')){var _0x71aa17={};_0x71aa17[_0x1050bc[_0x1f41('0x28')]]={'$like':'%'+_0x415d30[_0x1f41('0x2f')][_0x1f41('0x38')]+'%'};return _0x71aa17;}})});}_0x45e687=_[_0x1f41('0x39')]({},_0x45e687,_0x415d30[_0x1f41('0x3c')]);var _0x3d91ae={'where':_0x45e687[_0x1f41('0x37')]};return db[_0x1f41('0x2b')][_0x1f41('0x1c')](_0x3d91ae)[_0x1f41('0x22')](function(_0xef90c8){_0x2710ef['count']=_0xef90c8;if(_0x415d30[_0x1f41('0x2f')][_0x1f41('0x3d')]){_0x45e687['include']=[{'all':!![]}];}return db[_0x1f41('0x2b')]['findAll'](_0x45e687);})['then'](function(_0x1a3aba){_0x2710ef['rows']=_0x1a3aba;return _0x2710ef;})['then'](respondWithFilteredResult(_0x2aab27,_0x45e687))[_0x1f41('0x3e')](handleError(_0x2aab27,null));};exports[_0x1f41('0x3f')]=function(_0x5c4081,_0x1bedc6){var _0x3fab24={'raw':!![],'where':{'id':_0x5c4081[_0x1f41('0x40')]['id']}},_0x5f4fb5={};_0x5f4fb5['model']=_[_0x1f41('0x41')](db[_0x1f41('0x2b')][_0x1f41('0x2c')]);_0x5f4fb5[_0x1f41('0x2f')]=_[_0x1f41('0x41')](_0x5c4081[_0x1f41('0x2f')]);_0x5f4fb5[_0x1f41('0x30')]=_['intersection'](_0x5f4fb5['model'],_0x5f4fb5[_0x1f41('0x2f')]);_0x3fab24['attributes']=_[_0x1f41('0x31')](_0x5f4fb5['model'],qs['fields'](_0x5c4081[_0x1f41('0x2f')][_0x1f41('0x34')]));_0x3fab24['attributes']=_0x3fab24[_0x1f41('0x32')]['length']?_0x3fab24['attributes']:_0x5f4fb5[_0x1f41('0x33')];if(_0x5c4081[_0x1f41('0x2f')]['includeAll']){_0x3fab24[_0x1f41('0x42')]=[{'all':!![]}];}_0x3fab24=_[_0x1f41('0x39')]({},_0x3fab24,_0x5c4081[_0x1f41('0x3c')]);return db[_0x1f41('0x2b')]['find'](_0x3fab24)['then'](handleEntityNotFound(_0x1bedc6,null))[_0x1f41('0x22')](respondWithResult(_0x1bedc6,null))[_0x1f41('0x3e')](handleError(_0x1bedc6,null));};exports[_0x1f41('0x43')]=function(_0x4dd502,_0x37848f){return db[_0x1f41('0x2b')]['create'](_0x4dd502[_0x1f41('0x44')],{})['then'](respondWithResult(_0x37848f,0xc9))['catch'](handleError(_0x37848f,null));};exports[_0x1f41('0x21')]=function(_0x972597,_0x4764e6){if(_0x972597['body']['id']){delete _0x972597[_0x1f41('0x44')]['id'];}return db[_0x1f41('0x2b')][_0x1f41('0x45')]({'where':{'id':_0x972597[_0x1f41('0x40')]['id']}})[_0x1f41('0x22')](handleEntityNotFound(_0x4764e6,null))[_0x1f41('0x22')](saveUpdates(_0x972597['body'],null))['then'](respondWithResult(_0x4764e6,null))[_0x1f41('0x3e')](handleError(_0x4764e6,null));};exports['destroy']=function(_0x4d015a,_0x45eacb){return db[_0x1f41('0x2b')][_0x1f41('0x45')]({'where':{'id':_0x4d015a[_0x1f41('0x40')]['id']}})[_0x1f41('0x22')](handleEntityNotFound(_0x45eacb,null))['then'](removeEntity(_0x45eacb,null))['catch'](handleError(_0x45eacb,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 84612f5..a8421e0 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 _0x3f2b=['define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x266c69,_0xa8e09b){var _0x5f40b1=function(_0x462884){while(--_0x462884){_0x266c69['push'](_0x266c69['shift']());}};_0x5f40b1(++_0xa8e09b);}(_0x3f2b,0x9d));var _0xb3f2=function(_0x4a6949,_0x19f035){_0x4a6949=_0x4a6949-0x0;var _0x142277=_0x3f2b[_0x4a6949];return _0x142277;};'use strict';var _=require(_0xb3f2('0x0'));var util=require(_0xb3f2('0x1'));var logger=require(_0xb3f2('0x2'))(_0xb3f2('0x3'));var moment=require(_0xb3f2('0x4'));var BPromise=require(_0xb3f2('0x5'));var rp=require(_0xb3f2('0x6'));var fs=require('fs');var path=require(_0xb3f2('0x7'));var rimraf=require('rimraf');var config=require(_0xb3f2('0x8'));var attributes=require(_0xb3f2('0x9'));module[_0xb3f2('0xa')]=function(_0x58609b,_0x421be4){return _0x58609b[_0xb3f2('0xb')](_0xb3f2('0xc'),attributes,{'tableName':_0xb3f2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4eaf=['request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','bluebird'];(function(_0x4b9caa,_0x19a10d){var _0x19e42a=function(_0x4ddc69){while(--_0x4ddc69){_0x4b9caa['push'](_0x4b9caa['shift']());}};_0x19e42a(++_0x19a10d);}(_0x4eaf,0xce));var _0xf4ea=function(_0x3e0449,_0x12096d){_0x3e0449=_0x3e0449-0x0;var _0x26c9cc=_0x4eaf[_0x3e0449];return _0x26c9cc;};'use strict';var _=require(_0xf4ea('0x0'));var util=require('util');var logger=require(_0xf4ea('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf4ea('0x2'));var rp=require(_0xf4ea('0x3'));var fs=require('fs');var path=require(_0xf4ea('0x4'));var rimraf=require(_0xf4ea('0x5'));var config=require(_0xf4ea('0x6'));var attributes=require(_0xf4ea('0x7'));module[_0xf4ea('0x8')]=function(_0x48fc72,_0x1a928e){return _0x48fc72['define'](_0xf4ea('0x9'),attributes,{'tableName':_0xf4ea('0xa'),'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 06a316c..e49a0fc 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x1bb832,_0x366797){_0x1bb832=_0x1bb832-0x0;var _0x38bc37=_0x7a54[_0x1bb832];return _0x38bc37;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x4f8fdd,_0x888dc4){_0x4f8fdd=_0x4f8fdd-0x0;var _0x1d058d=_0x7a54[_0x4f8fdd];return _0x1d058d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index fda5717..b48d967 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 _0xa6b6=['../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','util','path','fs-extra','../../components/auth/service'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xa6b6,0x171));var _0x6a6b=function(_0x161587,_0x5c4528){_0x161587=_0x161587-0x0;var _0x293546=_0xa6b6[_0x161587];return _0x293546;};'use strict';var multer=require(_0x6a6b('0x0'));var util=require(_0x6a6b('0x1'));var path=require(_0x6a6b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6a6b('0x3'));var auth=require(_0x6a6b('0x4'));var interaction=require(_0x6a6b('0x5'));var config=require('../../config/environment');var controller=require(_0x6a6b('0x6'));router[_0x6a6b('0x7')]('/',auth[_0x6a6b('0x8')](),controller[_0x6a6b('0x9')]);router[_0x6a6b('0x7')](_0x6a6b('0xa'),auth[_0x6a6b('0x8')](),controller[_0x6a6b('0xb')]);router[_0x6a6b('0xc')]('/',auth[_0x6a6b('0x8')](),controller[_0x6a6b('0xd')]);router['put'](_0x6a6b('0xa'),auth['isAuthenticated'](),controller[_0x6a6b('0xe')]);router[_0x6a6b('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6a6b('0x10')]=router; \ No newline at end of file +var _0x195f=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','put','destroy'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0x195f,0xd1));var _0xf195=function(_0x47041d,_0x42153f){_0x47041d=_0x47041d-0x0;var _0x5022bd=_0x195f[_0x47041d];return _0x5022bd;};'use strict';var multer=require(_0xf195('0x0'));var util=require(_0xf195('0x1'));var path=require('path');var timeout=require(_0xf195('0x2'));var express=require('express');var router=express[_0xf195('0x3')]();var fs_extra=require(_0xf195('0x4'));var auth=require(_0xf195('0x5'));var interaction=require(_0xf195('0x6'));var config=require(_0xf195('0x7'));var controller=require('./analyticTreeReport.controller');router[_0xf195('0x8')]('/',auth[_0xf195('0x9')](),controller['index']);router[_0xf195('0x8')](_0xf195('0xa'),auth[_0xf195('0x9')](),controller['show']);router[_0xf195('0xb')]('/',auth[_0xf195('0x9')](),controller[_0xf195('0xc')]);router[_0xf195('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xf195('0xa'),auth[_0xf195('0x9')](),controller[_0xf195('0xe')]);module[_0xf195('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 41ad5e6..f431857 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 _0xecd5=['exports','STRING'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xecd5,0x110));var _0x5ecd=function(_0x32849f,_0x530722){_0x32849f=_0x32849f-0x0;var _0x2b34c7=_0xecd5[_0x32849f];return _0x2b34c7;};'use strict';var Sequelize=require('sequelize');module[_0x5ecd('0x0')]={'name':{'type':Sequelize[_0x5ecd('0x1')]},'basename':{'type':Sequelize[_0x5ecd('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8ff9=['exports','STRING','sequelize'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8ff9,0x188));var _0x98ff=function(_0x38b991,_0xa42a39){_0x38b991=_0x38b991-0x0;var _0x833c5e=_0x8ff9[_0x38b991];return _0x833c5e;};'use strict';var Sequelize=require(_0x98ff('0x0'));module[_0x98ff('0x1')]={'name':{'type':Sequelize[_0x98ff('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x98ff('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 32cbcd4..93811c3 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 _0x27bf=['status','end','json','offset','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','Attachment','include','findAll','catch','params','includeAll','find','clone','rawAttributes','get','omit','createdAt','updatedAt','create','body','file','originalname','basename','filename','mimetype','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','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'];(function(_0x2dffb4,_0x4bbbf3){var _0x4174ec=function(_0x13ec24){while(--_0x13ec24){_0x2dffb4['push'](_0x2dffb4['shift']());}};_0x4174ec(++_0x4bbbf3);}(_0x27bf,0x14e));var _0xf27b=function(_0xbe46a1,_0x496093){_0xbe46a1=_0xbe46a1-0x0;var _0x399489=_0x27bf[_0xbe46a1];return _0x399489;};'use strict';var emlformat=require(_0xf27b('0x0'));var rimraf=require(_0xf27b('0x1'));var zipdir=require(_0xf27b('0x2'));var jsonpatch=require(_0xf27b('0x3'));var rp=require('request-promise');var moment=require(_0xf27b('0x4'));var BPromise=require(_0xf27b('0x5'));var Mustache=require(_0xf27b('0x6'));var util=require(_0xf27b('0x7'));var path=require(_0xf27b('0x8'));var sox=require(_0xf27b('0x9'));var csv=require(_0xf27b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf27b('0xb'));var squel=require(_0xf27b('0xc'));var crypto=require(_0xf27b('0xd'));var jsforce=require(_0xf27b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf27b('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf27b('0x10'));var qs=require(_0xf27b('0x11'));var as=require(_0xf27b('0x12'));var hardwareService=require(_0xf27b('0x13'));var logger=require(_0xf27b('0x14'))(_0xf27b('0x15'));var utils=require(_0xf27b('0x16'));var config=require(_0xf27b('0x17'));var licenseUtil=require(_0xf27b('0x18'));var db=require(_0xf27b('0x19'))['db'];function respondWithStatusCode(_0x1cffb7,_0x224efc){_0x224efc=_0x224efc||0xcc;return function(_0x23403c){if(_0x23403c){return _0x1cffb7['sendStatus'](_0x224efc);}return _0x1cffb7[_0xf27b('0x1a')](_0x224efc)[_0xf27b('0x1b')]();};}function respondWithResult(_0x199d02,_0x327fc8){_0x327fc8=_0x327fc8||0xc8;return function(_0x21402b){if(_0x21402b){return _0x199d02[_0xf27b('0x1a')](_0x327fc8)[_0xf27b('0x1c')](_0x21402b);}};}function respondWithFilteredResult(_0x510fc2,_0x214d76){return function(_0x58dd31){if(_0x58dd31){var _0x19ee90=typeof _0x214d76[_0xf27b('0x1d')]==='undefined'&&typeof _0x214d76[_0xf27b('0x1e')]==='undefined';var _0x6a1766=_0x58dd31[_0xf27b('0x1f')];var _0x249e9b=_0x19ee90?0x0:_0x214d76['offset'];var _0x1e22be=_0x19ee90?_0x58dd31[_0xf27b('0x1f')]:_0x214d76['offset']+_0x214d76[_0xf27b('0x1e')];var _0x4175cd;if(_0x1e22be>=_0x6a1766){_0x1e22be=_0x6a1766;_0x4175cd=0xc8;}else{_0x4175cd=0xce;}_0x510fc2[_0xf27b('0x1a')](_0x4175cd);return _0x510fc2['set'](_0xf27b('0x20'),_0x249e9b+'-'+_0x1e22be+'/'+_0x6a1766)['json'](_0x58dd31);}return null;};}function patchUpdates(_0x5c9f70){return function(_0x2b2cf3){try{jsonpatch[_0xf27b('0x21')](_0x2b2cf3,_0x5c9f70,!![]);}catch(_0xe8eeb){return BPromise[_0xf27b('0x22')](_0xe8eeb);}return _0x2b2cf3['save']();};}function saveUpdates(_0x25af00,_0x431ba4){return function(_0x5edcc7){if(_0x5edcc7){return _0x5edcc7[_0xf27b('0x23')](_0x25af00)[_0xf27b('0x24')](function(_0x53ab3a){return _0x53ab3a;});}return null;};}function removeEntity(_0x30bdcd,_0x66e78e){return function(_0x2446dd){if(_0x2446dd){return _0x2446dd[_0xf27b('0x25')]()['then'](function(){_0x30bdcd[_0xf27b('0x1a')](0xcc)[_0xf27b('0x1b')]();});}};}function handleEntityNotFound(_0x31c1ae,_0x292358){return function(_0x311994){if(!_0x311994){_0x31c1ae[_0xf27b('0x26')](0x194);}return _0x311994;};}function handleError(_0x2e6355,_0x3291ca){_0x3291ca=_0x3291ca||0x1f4;return function(_0x4251bb){logger[_0xf27b('0x27')](_0x4251bb[_0xf27b('0x28')]);if(_0x4251bb[_0xf27b('0x29')]){delete _0x4251bb['name'];}_0x2e6355[_0xf27b('0x1a')](_0x3291ca)[_0xf27b('0x2a')](_0x4251bb);};}exports[_0xf27b('0x2b')]=function(_0x2a0f63,_0xd77301){var _0x40b1c4={},_0x58f3b9={},_0xfe1fc4={'count':0x0,'rows':[]};var _0x30cd3d=_[_0xf27b('0x2c')](db['Attachment']['rawAttributes'],function(_0x1cad44){return{'name':_0x1cad44[_0xf27b('0x2d')],'type':_0x1cad44[_0xf27b('0x2e')]['key']};});_0x58f3b9['model']=_[_0xf27b('0x2c')](_0x30cd3d,'name');_0x58f3b9[_0xf27b('0x2f')]=_[_0xf27b('0x30')](_0x2a0f63[_0xf27b('0x2f')]);_0x58f3b9[_0xf27b('0x31')]=_[_0xf27b('0x32')](_0x58f3b9[_0xf27b('0x33')],_0x58f3b9[_0xf27b('0x2f')]);_0x40b1c4[_0xf27b('0x34')]=_[_0xf27b('0x32')](_0x58f3b9['model'],qs[_0xf27b('0x35')](_0x2a0f63[_0xf27b('0x2f')]['fields']));_0x40b1c4[_0xf27b('0x34')]=_0x40b1c4[_0xf27b('0x34')][_0xf27b('0x36')]?_0x40b1c4[_0xf27b('0x34')]:_0x58f3b9[_0xf27b('0x33')];if(!_0x2a0f63[_0xf27b('0x2f')][_0xf27b('0x37')](_0xf27b('0x38'))){_0x40b1c4[_0xf27b('0x1e')]=qs[_0xf27b('0x1e')](_0x2a0f63['query'][_0xf27b('0x1e')]);_0x40b1c4[_0xf27b('0x1d')]=qs[_0xf27b('0x1d')](_0x2a0f63['query'][_0xf27b('0x1d')]);}_0x40b1c4['order']=qs[_0xf27b('0x39')](_0x2a0f63[_0xf27b('0x2f')][_0xf27b('0x39')]);_0x40b1c4[_0xf27b('0x3a')]=qs[_0xf27b('0x31')](_['pick'](_0x2a0f63[_0xf27b('0x2f')],_0x58f3b9['filters']),_0x30cd3d);if(_0x2a0f63[_0xf27b('0x2f')][_0xf27b('0x3b')]){_0x40b1c4[_0xf27b('0x3a')]=_['merge'](_0x40b1c4[_0xf27b('0x3a')],{'$or':_[_0xf27b('0x2c')](_0x30cd3d,function(_0x41058c){if(_0x41058c['type']!==_0xf27b('0x3c')){var _0xe51d9e={};_0xe51d9e[_0x41058c['name']]={'$like':'%'+_0x2a0f63[_0xf27b('0x2f')][_0xf27b('0x3b')]+'%'};return _0xe51d9e;}})});}_0x40b1c4=_[_0xf27b('0x3d')]({},_0x40b1c4,_0x2a0f63[_0xf27b('0x3e')]);var _0x4f3515={'where':_0x40b1c4[_0xf27b('0x3a')]};return db[_0xf27b('0x3f')]['count'](_0x4f3515)[_0xf27b('0x24')](function(_0x1b8bd2){_0xfe1fc4[_0xf27b('0x1f')]=_0x1b8bd2;if(_0x2a0f63[_0xf27b('0x2f')]['includeAll']){_0x40b1c4[_0xf27b('0x40')]=[{'all':!![]}];}return db['Attachment'][_0xf27b('0x41')](_0x40b1c4);})[_0xf27b('0x24')](function(_0x36ee8a){_0xfe1fc4['rows']=_0x36ee8a;return _0xfe1fc4;})[_0xf27b('0x24')](respondWithFilteredResult(_0xd77301,_0x40b1c4))[_0xf27b('0x42')](handleError(_0xd77301,null));};exports['show']=function(_0x5364f2,_0x59ca9c){var _0x46931e={'raw':!![],'where':{'id':_0x5364f2[_0xf27b('0x43')]['id']}},_0x343212={};_0x343212[_0xf27b('0x33')]=_[_0xf27b('0x30')](db[_0xf27b('0x3f')]['rawAttributes']);_0x343212[_0xf27b('0x2f')]=_['keys'](_0x5364f2[_0xf27b('0x2f')]);_0x343212[_0xf27b('0x31')]=_[_0xf27b('0x32')](_0x343212['model'],_0x343212[_0xf27b('0x2f')]);_0x46931e[_0xf27b('0x34')]=_[_0xf27b('0x32')](_0x343212['model'],qs['fields'](_0x5364f2[_0xf27b('0x2f')]['fields']));_0x46931e[_0xf27b('0x34')]=_0x46931e['attributes'][_0xf27b('0x36')]?_0x46931e[_0xf27b('0x34')]:_0x343212[_0xf27b('0x33')];if(_0x5364f2[_0xf27b('0x2f')][_0xf27b('0x44')]){_0x46931e[_0xf27b('0x40')]=[{'all':!![]}];}_0x46931e=_[_0xf27b('0x3d')]({},_0x46931e,_0x5364f2[_0xf27b('0x3e')]);return db[_0xf27b('0x3f')][_0xf27b('0x45')](_0x46931e)['then'](handleEntityNotFound(_0x59ca9c,null))[_0xf27b('0x24')](respondWithResult(_0x59ca9c,null))[_0xf27b('0x42')](handleError(_0x59ca9c,null));};exports[_0xf27b('0x46')]=function(_0x3951a2,_0x24912){var _0x5acff9={'where':{'id':_0x3951a2[_0xf27b('0x43')]['id']}},_0x203b6e={};_0x203b6e['model']=_[_0xf27b('0x30')](db[_0xf27b('0x3f')][_0xf27b('0x47')]);_0x5acff9[_0xf27b('0x34')]=_[_0xf27b('0x32')](_0x203b6e[_0xf27b('0x33')],qs[_0xf27b('0x35')](_0x3951a2[_0xf27b('0x2f')]['fields']));_0x5acff9[_0xf27b('0x34')]=_0x5acff9[_0xf27b('0x34')][_0xf27b('0x36')]?_0x5acff9['attributes']:_0x203b6e['model'];if(_0x3951a2[_0xf27b('0x2f')]['includeAll']){_0x5acff9[_0xf27b('0x40')]=[{'all':!![]}];}_0x5acff9=_[_0xf27b('0x3d')]({},_0x5acff9,_0x3951a2[_0xf27b('0x3e')]);return db['Attachment']['find'](_0x5acff9)[_0xf27b('0x24')](handleEntityNotFound(_0x24912,null))[_0xf27b('0x24')](function(_0x3de91d){if(_0x3de91d){var _0x267f1f=_0x3de91d[_0xf27b('0x48')]({'plain':!![]});_0x267f1f=qs[_0xf27b('0x49')](_0x267f1f,['id',_0xf27b('0x4a'),'updatedAt']);_0x3951a2['body']=_[_0xf27b('0x49')](_0x3951a2['body'],['id',_0xf27b('0x4a'),_0xf27b('0x4b')]);return db[_0xf27b('0x3f')][_0xf27b('0x4c')](_['merge'](_0x267f1f,_0x3951a2[_0xf27b('0x4d')]),{'include':_0x3951a2['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0xf27b('0x24')](respondWithResult(_0x24912,0xc9))[_0xf27b('0x42')](handleError(_0x24912,null));};exports[_0xf27b('0x23')]=function(_0x39b22e,_0x29e462){if(_0x39b22e[_0xf27b('0x4d')]['id']){delete _0x39b22e['body']['id'];}return db[_0xf27b('0x3f')][_0xf27b('0x45')]({'where':{'id':_0x39b22e['params']['id']}})['then'](handleEntityNotFound(_0x29e462,null))[_0xf27b('0x24')](saveUpdates(_0x39b22e['body'],null))[_0xf27b('0x24')](respondWithResult(_0x29e462,null))[_0xf27b('0x42')](handleError(_0x29e462,null));};exports['destroy']=function(_0x5c5267,_0x4a3f95){return db[_0xf27b('0x3f')][_0xf27b('0x45')]({'where':{'id':_0x5c5267[_0xf27b('0x43')]['id']}})[_0xf27b('0x24')](handleEntityNotFound(_0x4a3f95,null))[_0xf27b('0x24')](removeEntity(_0x4a3f95,null))['catch'](handleError(_0x4a3f95,null));};exports[_0xf27b('0x4c')]=function(_0x5cbe1e,_0xe25b4c,_0x51d88a){_0x5cbe1e['body'][_0xf27b('0x29')]=_0x5cbe1e[_0xf27b('0x4e')][_0xf27b('0x4f')];_0x5cbe1e['body'][_0xf27b('0x50')]=_0x5cbe1e[_0xf27b('0x4e')][_0xf27b('0x51')];_0x5cbe1e[_0xf27b('0x4d')][_0xf27b('0x2e')]=_0x5cbe1e[_0xf27b('0x4e')][_0xf27b('0x52')];return db['Attachment'][_0xf27b('0x4c')](_0x5cbe1e[_0xf27b('0x4d')])[_0xf27b('0x24')](respondWithResult(_0xe25b4c,0xc9))[_0xf27b('0x42')](handleError(_0xe25b4c,null));};exports['download']=function(_0x3cff39,_0x3fdf2c,_0x1e3abb){return db[_0xf27b('0x3f')][_0xf27b('0x53')]({'where':{'id':_0x3cff39['params']['id']},'raw':!![]})[_0xf27b('0x24')](handleEntityNotFound(_0x3fdf2c,null))[_0xf27b('0x24')](function(_0xc48d01){if(_0xc48d01){var _0x64731f=_0xc48d01[_0xf27b('0x54')]!==null;var _0xd8ddae=path['join'](config[_0xf27b('0x55')],_0xf27b('0x56'));if(_0x64731f){_0xd8ddae=path[_0xf27b('0x57')](_0xd8ddae,_0xf27b('0x58'));}var _0x36d8c5=path[_0xf27b('0x57')](_0xd8ddae,_0xc48d01[_0xf27b('0x50')]);return _0x3fdf2c[_0xf27b('0x59')](_0x36d8c5);}})['catch'](handleError(_0x3fdf2c,null));}; \ No newline at end of file +var _0x5a36=['include','findAll','rows','catch','params','clone','find','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','error','name','send','index','map','Attachment','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll'];(function(_0x19d6a1,_0x3ad861){var _0x5c69f4=function(_0x49fa5e){while(--_0x49fa5e){_0x19d6a1['push'](_0x19d6a1['shift']());}};_0x5c69f4(++_0x3ad861);}(_0x5a36,0x190));var _0x65a3=function(_0x5cccde,_0x4c6505){_0x5cccde=_0x5cccde-0x0;var _0x40a5b1=_0x5a36[_0x5cccde];return _0x40a5b1;};'use strict';var emlformat=require(_0x65a3('0x0'));var rimraf=require(_0x65a3('0x1'));var zipdir=require(_0x65a3('0x2'));var jsonpatch=require(_0x65a3('0x3'));var rp=require(_0x65a3('0x4'));var moment=require(_0x65a3('0x5'));var BPromise=require(_0x65a3('0x6'));var Mustache=require('mustache');var util=require(_0x65a3('0x7'));var path=require(_0x65a3('0x8'));var sox=require(_0x65a3('0x9'));var csv=require('to-csv');var ejs=require(_0x65a3('0xa'));var fs=require('fs');var fs_extra=require(_0x65a3('0xb'));var _=require(_0x65a3('0xc'));var squel=require(_0x65a3('0xd'));var crypto=require(_0x65a3('0xe'));var jsforce=require(_0x65a3('0xf'));var deskjs=require(_0x65a3('0x10'));var toCsv=require(_0x65a3('0x11'));var querystring=require(_0x65a3('0x12'));var Papa=require('papaparse');var Redis=require(_0x65a3('0x13'));var authService=require(_0x65a3('0x14'));var qs=require(_0x65a3('0x15'));var as=require(_0x65a3('0x16'));var hardwareService=require(_0x65a3('0x17'));var logger=require('../../config/logger')(_0x65a3('0x18'));var utils=require(_0x65a3('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x65a3('0x1a'));var db=require(_0x65a3('0x1b'))['db'];function respondWithStatusCode(_0x37db5e,_0x29abcb){_0x29abcb=_0x29abcb||0xcc;return function(_0x42da5a){if(_0x42da5a){return _0x37db5e[_0x65a3('0x1c')](_0x29abcb);}return _0x37db5e[_0x65a3('0x1d')](_0x29abcb)['end']();};}function respondWithResult(_0x298810,_0x2c053c){_0x2c053c=_0x2c053c||0xc8;return function(_0x175018){if(_0x175018){return _0x298810[_0x65a3('0x1d')](_0x2c053c)[_0x65a3('0x1e')](_0x175018);}};}function respondWithFilteredResult(_0x5270e5,_0x14fed2){return function(_0x181248){if(_0x181248){var _0x1e6003=typeof _0x14fed2[_0x65a3('0x1f')]===_0x65a3('0x20')&&typeof _0x14fed2[_0x65a3('0x21')]===_0x65a3('0x20');var _0x134d48=_0x181248[_0x65a3('0x22')];var _0x19a5f5=_0x1e6003?0x0:_0x14fed2[_0x65a3('0x1f')];var _0xc2426b=_0x1e6003?_0x181248['count']:_0x14fed2['offset']+_0x14fed2['limit'];var _0x4f22c5;if(_0xc2426b>=_0x134d48){_0xc2426b=_0x134d48;_0x4f22c5=0xc8;}else{_0x4f22c5=0xce;}_0x5270e5[_0x65a3('0x1d')](_0x4f22c5);return _0x5270e5[_0x65a3('0x23')](_0x65a3('0x24'),_0x19a5f5+'-'+_0xc2426b+'/'+_0x134d48)['json'](_0x181248);}return null;};}function patchUpdates(_0x43aaff){return function(_0x3f13ae){try{jsonpatch[_0x65a3('0x25')](_0x3f13ae,_0x43aaff,!![]);}catch(_0x30033a){return BPromise[_0x65a3('0x26')](_0x30033a);}return _0x3f13ae['save']();};}function saveUpdates(_0x44bb27,_0x18e22f){return function(_0x4fba41){if(_0x4fba41){return _0x4fba41[_0x65a3('0x27')](_0x44bb27)['then'](function(_0x5ebb0d){return _0x5ebb0d;});}return null;};}function removeEntity(_0x1fb302,_0x514b9c){return function(_0x53a129){if(_0x53a129){return _0x53a129[_0x65a3('0x28')]()[_0x65a3('0x29')](function(){_0x1fb302['status'](0xcc)[_0x65a3('0x2a')]();});}};}function handleEntityNotFound(_0x27a1cd,_0x52e5a8){return function(_0x350cf5){if(!_0x350cf5){_0x27a1cd[_0x65a3('0x1c')](0x194);}return _0x350cf5;};}function handleError(_0x3ecd82,_0x1c888b){_0x1c888b=_0x1c888b||0x1f4;return function(_0x534c8f){logger[_0x65a3('0x2b')](_0x534c8f['stack']);if(_0x534c8f[_0x65a3('0x2c')]){delete _0x534c8f[_0x65a3('0x2c')];}_0x3ecd82[_0x65a3('0x1d')](_0x1c888b)[_0x65a3('0x2d')](_0x534c8f);};}exports[_0x65a3('0x2e')]=function(_0x4034df,_0x4e9333){var _0x304f15={},_0x392c4a={},_0x443b2f={'count':0x0,'rows':[]};var _0x1e0e72=_[_0x65a3('0x2f')](db[_0x65a3('0x30')][_0x65a3('0x31')],function(_0xa344c2){return{'name':_0xa344c2[_0x65a3('0x32')],'type':_0xa344c2[_0x65a3('0x33')]['key']};});_0x392c4a[_0x65a3('0x34')]=_[_0x65a3('0x2f')](_0x1e0e72,'name');_0x392c4a[_0x65a3('0x35')]=_[_0x65a3('0x36')](_0x4034df['query']);_0x392c4a[_0x65a3('0x37')]=_[_0x65a3('0x38')](_0x392c4a[_0x65a3('0x34')],_0x392c4a['query']);_0x304f15[_0x65a3('0x39')]=_['intersection'](_0x392c4a['model'],qs[_0x65a3('0x3a')](_0x4034df['query'][_0x65a3('0x3a')]));_0x304f15['attributes']=_0x304f15[_0x65a3('0x39')][_0x65a3('0x3b')]?_0x304f15[_0x65a3('0x39')]:_0x392c4a[_0x65a3('0x34')];if(!_0x4034df[_0x65a3('0x35')]['hasOwnProperty'](_0x65a3('0x3c'))){_0x304f15['limit']=qs[_0x65a3('0x21')](_0x4034df[_0x65a3('0x35')][_0x65a3('0x21')]);_0x304f15[_0x65a3('0x1f')]=qs[_0x65a3('0x1f')](_0x4034df['query'][_0x65a3('0x1f')]);}_0x304f15[_0x65a3('0x3d')]=qs[_0x65a3('0x3e')](_0x4034df[_0x65a3('0x35')][_0x65a3('0x3e')]);_0x304f15['where']=qs[_0x65a3('0x37')](_[_0x65a3('0x3f')](_0x4034df[_0x65a3('0x35')],_0x392c4a['filters']),_0x1e0e72);if(_0x4034df[_0x65a3('0x35')][_0x65a3('0x40')]){_0x304f15[_0x65a3('0x41')]=_[_0x65a3('0x42')](_0x304f15[_0x65a3('0x41')],{'$or':_['map'](_0x1e0e72,function(_0x367853){if(_0x367853[_0x65a3('0x33')]!==_0x65a3('0x43')){var _0x47f94d={};_0x47f94d[_0x367853[_0x65a3('0x2c')]]={'$like':'%'+_0x4034df[_0x65a3('0x35')][_0x65a3('0x40')]+'%'};return _0x47f94d;}})});}_0x304f15=_[_0x65a3('0x42')]({},_0x304f15,_0x4034df[_0x65a3('0x44')]);var _0x5a4e3c={'where':_0x304f15[_0x65a3('0x41')]};return db[_0x65a3('0x30')][_0x65a3('0x22')](_0x5a4e3c)[_0x65a3('0x29')](function(_0x4984a3){_0x443b2f[_0x65a3('0x22')]=_0x4984a3;if(_0x4034df['query'][_0x65a3('0x45')]){_0x304f15[_0x65a3('0x46')]=[{'all':!![]}];}return db[_0x65a3('0x30')][_0x65a3('0x47')](_0x304f15);})['then'](function(_0xd7fd45){_0x443b2f[_0x65a3('0x48')]=_0xd7fd45;return _0x443b2f;})[_0x65a3('0x29')](respondWithFilteredResult(_0x4e9333,_0x304f15))[_0x65a3('0x49')](handleError(_0x4e9333,null));};exports['show']=function(_0xc43a18,_0x1f581f){var _0x17ee29={'raw':!![],'where':{'id':_0xc43a18[_0x65a3('0x4a')]['id']}},_0x4b9848={};_0x4b9848[_0x65a3('0x34')]=_[_0x65a3('0x36')](db[_0x65a3('0x30')][_0x65a3('0x31')]);_0x4b9848[_0x65a3('0x35')]=_[_0x65a3('0x36')](_0xc43a18[_0x65a3('0x35')]);_0x4b9848['filters']=_['intersection'](_0x4b9848[_0x65a3('0x34')],_0x4b9848[_0x65a3('0x35')]);_0x17ee29['attributes']=_[_0x65a3('0x38')](_0x4b9848[_0x65a3('0x34')],qs[_0x65a3('0x3a')](_0xc43a18[_0x65a3('0x35')]['fields']));_0x17ee29[_0x65a3('0x39')]=_0x17ee29[_0x65a3('0x39')][_0x65a3('0x3b')]?_0x17ee29[_0x65a3('0x39')]:_0x4b9848[_0x65a3('0x34')];if(_0xc43a18[_0x65a3('0x35')][_0x65a3('0x45')]){_0x17ee29[_0x65a3('0x46')]=[{'all':!![]}];}_0x17ee29=_['merge']({},_0x17ee29,_0xc43a18['options']);return db[_0x65a3('0x30')]['find'](_0x17ee29)['then'](handleEntityNotFound(_0x1f581f,null))[_0x65a3('0x29')](respondWithResult(_0x1f581f,null))[_0x65a3('0x49')](handleError(_0x1f581f,null));};exports[_0x65a3('0x4b')]=function(_0x33df7c,_0x2c3519){var _0x516d12={'where':{'id':_0x33df7c['params']['id']}},_0x572ad7={};_0x572ad7[_0x65a3('0x34')]=_[_0x65a3('0x36')](db[_0x65a3('0x30')]['rawAttributes']);_0x516d12[_0x65a3('0x39')]=_['intersection'](_0x572ad7[_0x65a3('0x34')],qs[_0x65a3('0x3a')](_0x33df7c[_0x65a3('0x35')][_0x65a3('0x3a')]));_0x516d12[_0x65a3('0x39')]=_0x516d12[_0x65a3('0x39')][_0x65a3('0x3b')]?_0x516d12[_0x65a3('0x39')]:_0x572ad7[_0x65a3('0x34')];if(_0x33df7c['query']['includeAll']){_0x516d12[_0x65a3('0x46')]=[{'all':!![]}];}_0x516d12=_[_0x65a3('0x42')]({},_0x516d12,_0x33df7c[_0x65a3('0x44')]);return db[_0x65a3('0x30')][_0x65a3('0x4c')](_0x516d12)[_0x65a3('0x29')](handleEntityNotFound(_0x2c3519,null))[_0x65a3('0x29')](function(_0x2fba1e){if(_0x2fba1e){var _0x32683f=_0x2fba1e['get']({'plain':!![]});_0x32683f=qs[_0x65a3('0x4d')](_0x32683f,['id',_0x65a3('0x4e'),_0x65a3('0x4f')]);_0x33df7c[_0x65a3('0x50')]=_[_0x65a3('0x4d')](_0x33df7c[_0x65a3('0x50')],['id',_0x65a3('0x4e'),_0x65a3('0x4f')]);return db[_0x65a3('0x30')]['create'](_[_0x65a3('0x42')](_0x32683f,_0x33df7c[_0x65a3('0x50')]),{'include':_0x33df7c[_0x65a3('0x35')][_0x65a3('0x45')]?[{'all':!![]}]:undefined});}})[_0x65a3('0x29')](respondWithResult(_0x2c3519,0xc9))[_0x65a3('0x49')](handleError(_0x2c3519,null));};exports[_0x65a3('0x27')]=function(_0x155827,_0xde8879){if(_0x155827['body']['id']){delete _0x155827[_0x65a3('0x50')]['id'];}return db['Attachment'][_0x65a3('0x4c')]({'where':{'id':_0x155827[_0x65a3('0x4a')]['id']}})[_0x65a3('0x29')](handleEntityNotFound(_0xde8879,null))[_0x65a3('0x29')](saveUpdates(_0x155827[_0x65a3('0x50')],null))['then'](respondWithResult(_0xde8879,null))[_0x65a3('0x49')](handleError(_0xde8879,null));};exports['destroy']=function(_0x4f583d,_0x39983f){return db[_0x65a3('0x30')][_0x65a3('0x4c')]({'where':{'id':_0x4f583d[_0x65a3('0x4a')]['id']}})[_0x65a3('0x29')](handleEntityNotFound(_0x39983f,null))[_0x65a3('0x29')](removeEntity(_0x39983f,null))[_0x65a3('0x49')](handleError(_0x39983f,null));};exports[_0x65a3('0x51')]=function(_0x293cfd,_0x37304d,_0x22e6d1){_0x293cfd[_0x65a3('0x50')][_0x65a3('0x2c')]=_0x293cfd[_0x65a3('0x52')][_0x65a3('0x53')];_0x293cfd[_0x65a3('0x50')][_0x65a3('0x54')]=_0x293cfd['file'][_0x65a3('0x55')];_0x293cfd[_0x65a3('0x50')][_0x65a3('0x33')]=_0x293cfd[_0x65a3('0x52')][_0x65a3('0x56')];return db[_0x65a3('0x30')][_0x65a3('0x51')](_0x293cfd[_0x65a3('0x50')])[_0x65a3('0x29')](respondWithResult(_0x37304d,0xc9))[_0x65a3('0x49')](handleError(_0x37304d,null));};exports[_0x65a3('0x57')]=function(_0x504082,_0x881531,_0x5c8404){return db['Attachment'][_0x65a3('0x58')]({'where':{'id':_0x504082[_0x65a3('0x4a')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x881531,null))['then'](function(_0x4c6bb5){if(_0x4c6bb5){var _0x4d1781=_0x4c6bb5[_0x65a3('0x59')]!==null;var _0x3c1f56=path['join'](config[_0x65a3('0x5a')],_0x65a3('0x5b'));if(_0x4d1781){_0x3c1f56=path[_0x65a3('0x5c')](_0x3c1f56,_0x65a3('0x5d'));}var _0x23eb4e=path[_0x65a3('0x5c')](_0x3c1f56,_0x4c6bb5[_0x65a3('0x54')]);return _0x881531[_0x65a3('0x57')](_0x23eb4e);}})[_0x65a3('0x49')](handleError(_0x881531,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 0ec28c2..006ef89 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 _0x1806=['bluebird','path','rimraf','./attachment.attributes','exports','define','Attachment','attachments','../../config/logger','moment'];(function(_0x4536a5,_0x4cbae1){var _0x4ed53a=function(_0x194805){while(--_0x194805){_0x4536a5['push'](_0x4536a5['shift']());}};_0x4ed53a(++_0x4cbae1);}(_0x1806,0x9e));var _0x6180=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1806[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6180('0x0'))('api');var moment=require(_0x6180('0x1'));var BPromise=require(_0x6180('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6180('0x3'));var rimraf=require(_0x6180('0x4'));var config=require('../../config/environment');var attributes=require(_0x6180('0x5'));module[_0x6180('0x6')]=function(_0x2d63f4,_0x4eb429){return _0x2d63f4[_0x6180('0x7')](_0x6180('0x8'),attributes,{'tableName':_0x6180('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32e8=['define','Attachment','attachments','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports'];(function(_0x1c2f29,_0x5a2668){var _0x258465=function(_0x30332f){while(--_0x30332f){_0x1c2f29['push'](_0x1c2f29['shift']());}};_0x258465(++_0x5a2668);}(_0x32e8,0xb9));var _0x832e=function(_0x555655,_0x2e5494){_0x555655=_0x555655-0x0;var _0x11bd8b=_0x32e8[_0x555655];return _0x11bd8b;};'use strict';var _=require(_0x832e('0x0'));var util=require(_0x832e('0x1'));var logger=require('../../config/logger')(_0x832e('0x2'));var moment=require(_0x832e('0x3'));var BPromise=require(_0x832e('0x4'));var rp=require(_0x832e('0x5'));var fs=require('fs');var path=require(_0x832e('0x6'));var rimraf=require(_0x832e('0x7'));var config=require(_0x832e('0x8'));var attributes=require(_0x832e('0x9'));module[_0x832e('0xa')]=function(_0x52d185,_0x1ddbd4){return _0x52d185[_0x832e('0xb')](_0x832e('0xc'),attributes,{'tableName':_0x832e('0xd'),'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 516f4ad..6e27d09 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 _0x9567=['../../config/utils','../../config/logger','../../config/environment','client','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateAttachment','create','options','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x4bbb84,_0x32d824){var _0x279ef5=function(_0x52f376){while(--_0x52f376){_0x4bbb84['push'](_0x4bbb84['shift']());}};_0x279ef5(++_0x32d824);}(_0x9567,0xdc));var _0x7956=function(_0x39cf69,_0x1ddc96){_0x39cf69=_0x39cf69-0x0;var _0x4c0fa6=_0x9567[_0x39cf69];return _0x4c0fa6;};'use strict';var _=require(_0x7956('0x0'));var util=require(_0x7956('0x1'));var moment=require(_0x7956('0x2'));var BPromise=require(_0x7956('0x3'));var rs=require(_0x7956('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7956('0x5'));var logger=require(_0x7956('0x6'))('rpc');var config=require(_0x7956('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7956('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1819b6,_0x31b50d,_0x48b2b3){return new BPromise(function(_0x3c213a,_0x50038a){return client[_0x7956('0x9')](_0x1819b6,_0x48b2b3)[_0x7956('0xa')](function(_0x53310c){logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,'request\x20sent');logger[_0x7956('0xd')](_0x7956('0xe'),_0x31b50d,_0x7956('0xf'),JSON['stringify'](_0x53310c));if(_0x53310c[_0x7956('0x10')]){if(_0x53310c[_0x7956('0x10')][_0x7956('0x11')]===0x1f4){logger[_0x7956('0x10')]('Attachment,\x20%s,\x20%s',_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x50038a(_0x53310c[_0x7956('0x10')]['message']);}logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x3c213a(_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);}else{logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,_0x7956('0xf'));_0x3c213a(_0x53310c[_0x7956('0x13')][_0x7956('0x12')]);}})[_0x7956('0x14')](function(_0x18ae51){logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x18ae51);_0x50038a(_0x18ae51);});});}exports[_0x7956('0x15')]=function(_0x5e6b90){var _0x5c3afb=this;return new Promise(function(_0x10b29c,_0x811122){return db['Attachment'][_0x7956('0x16')](_0x5e6b90['body'],{'raw':_0x5e6b90[_0x7956('0x17')]?_0x5e6b90[_0x7956('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7956('0xa')](function(_0x2e31cd){logger[_0x7956('0xb')]('CreateAttachment',_0x5e6b90);logger[_0x7956('0xd')]('CreateAttachment',_0x5e6b90,JSON[_0x7956('0x18')](_0x2e31cd));_0x10b29c(_0x2e31cd);})['catch'](function(_0x427500){logger[_0x7956('0x10')](_0x7956('0x15'),_0x427500[_0x7956('0x12')],_0x5e6b90);_0x811122(_0x5c3afb['error'](0x1f4,_0x427500[_0x7956('0x12')]));});});}; \ No newline at end of file +var _0x1be1=['Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateAttachment','body','options','raw','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s','debug'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x1be1,0x192));var _0x11be=function(_0x417465,_0xd9f07e){_0x417465=_0x417465-0x0;var _0x2ef918=_0x1be1[_0x417465];return _0x2ef918;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11be('0x0'));var BPromise=require(_0x11be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11be('0x2'));var db=require(_0x11be('0x3'))['db'];var utils=require(_0x11be('0x4'));var logger=require(_0x11be('0x5'))('rpc');var config=require(_0x11be('0x6'));var jayson=require(_0x11be('0x7'));var client=jayson[_0x11be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe8c62,_0x497730,_0x18f661){return new BPromise(function(_0x11fc15,_0x246772){return client[_0x11be('0x9')](_0xfe8c62,_0x18f661)[_0x11be('0xa')](function(_0x5f3d04){logger[_0x11be('0xb')](_0x11be('0xc'),_0x497730,'request\x20sent');logger[_0x11be('0xd')](_0x11be('0xe'),_0x497730,_0x11be('0xf'),JSON[_0x11be('0x10')](_0x5f3d04));if(_0x5f3d04['error']){if(_0x5f3d04[_0x11be('0x11')][_0x11be('0x12')]===0x1f4){logger[_0x11be('0x11')]('Attachment,\x20%s,\x20%s',_0x497730,_0x5f3d04[_0x11be('0x11')][_0x11be('0x13')]);return _0x246772(_0x5f3d04['error'][_0x11be('0x13')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x497730,_0x5f3d04['error']['message']);return _0x11fc15(_0x5f3d04['error']['message']);}else{logger['info'](_0x11be('0xc'),_0x497730,'request\x20sent');_0x11fc15(_0x5f3d04[_0x11be('0x14')][_0x11be('0x13')]);}})[_0x11be('0x15')](function(_0x216b8c){logger['error'](_0x11be('0xc'),_0x497730,_0x216b8c);_0x246772(_0x216b8c);});});}exports[_0x11be('0x16')]=function(_0x56ab61){var _0x299f45=this;return new Promise(function(_0xc3263c,_0x23aa5f){return db['Attachment']['create'](_0x56ab61[_0x11be('0x17')],{'raw':_0x56ab61[_0x11be('0x18')]?_0x56ab61[_0x11be('0x18')][_0x11be('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x12a5bd){logger[_0x11be('0xb')](_0x11be('0x16'),_0x56ab61);logger[_0x11be('0xd')](_0x11be('0x16'),_0x56ab61,JSON[_0x11be('0x10')](_0x12a5bd));_0xc3263c(_0x12a5bd);})[_0x11be('0x15')](function(_0x17678d){logger[_0x11be('0x11')](_0x11be('0x16'),_0x17678d['message'],_0x56ab61);_0x23aa5f(_0x299f45[_0x11be('0x11')](0x1f4,_0x17678d[_0x11be('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index e172257..d1d6a88 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 _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3fe968,_0x4737f0){var _0x5241b5=function(_0x5b34c7){while(--_0x5b34c7){_0x3fe968['push'](_0x3fe968['shift']());}};_0x5241b5(++_0x4737f0);}(_0x2032,0xd9));var _0x2203=function(_0x5bcece,_0x3c0214){_0x5bcece=_0x5bcece-0x0;var _0x1092a2=_0x2032[_0x5bcece];return _0x1092a2;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x0b0e,0x187));var _0xe0b0=function(_0x12dd11,_0x52b882){_0x12dd11=_0x12dd11-0x0;var _0x3a502b=_0x0b0e[_0x12dd11];return _0x3a502b;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 7758574..7d64d22 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 _0x8411=['blocked','blockedAt','online','user','agent','add','minutes','clearBlockUser','getLicense','catch','status','send','message','ad-login','json','User','Strategy','moment','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','disabled'];(function(_0x126a75,_0x30d0fc){var _0x5b3ab9=function(_0x42382c){while(--_0x42382c){_0x126a75['push'](_0x126a75['shift']());}};_0x5b3ab9(++_0x30d0fc);}(_0x8411,0x118));var _0x1841=function(_0x4cba83,_0x81e88f){_0x4cba83=_0x4cba83-0x0;var _0x4375e0=_0x8411[_0x4cba83];return _0x4375e0;};'use strict';var passport=require('passport');var LocalStrategy=require('passport-local')[_0x1841('0x0')];var moment=require(_0x1841('0x1'));var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require(_0x1841('0x2'));var db=require(_0x1841('0x3'))['db'];var authService=require(_0x1841('0x4'));var utils=require(_0x1841('0x5'));var config=require(_0x1841('0x6'));var logger=require('../../config/logger')(_0x1841('0x7'));function isActiveDirectoryConfigured(_0x54a581){var _0x4224eb=![];if(typeof _0x54a581[_0x1841('0x8')]!==_0x1841('0x9')){_0x4224eb=_0x54a581[_0x1841('0x8')][_0x1841('0xa')]&&_0x54a581[_0x1841('0x8')][_0x1841('0xb')]&&_0x54a581[_0x1841('0x8')][_0x1841('0xc')];}return _0x4224eb;}function adAuthenticate(_0x4218ae,_0x108644,_0x1ae8b8){return new BPromise(function(_0x1a3293,_0x19422d){try{var _0x2d7810=new ActiveDirectory(_0x4218ae);_0x2d7810[_0x1841('0xd')](_0x108644,_0x1ae8b8,function(_0x16570d,_0x293ca7){if(_0x16570d){logger[_0x1841('0xe')]('Error\x20authenticate\x20%s:\x20%s',_0x108644,util[_0x1841('0xf')](_0x16570d,{'showHidden':![],'depth':null}));_0x19422d(_0x1841('0x10'));}else if(!_0x293ca7){logger[_0x1841('0xe')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x108644);_0x19422d('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x1a3293(_0x293ca7);}});}catch(_0x415393){_0x19422d(_0x415393);}});}function ActiveDirectoryAuthenticate(_0x443172,_0x4c9df4,_0x101dfd,_0x9dc9c8){var _0x3e7e22,_0x287c5e;if(!isActiveDirectoryConfigured(config)){logger[_0x1841('0xe')](_0x1841('0x11'),_0x4c9df4);return _0x9dc9c8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x1841('0x12')][_0x1841('0x13')]({'where':{'id':0x1},'attributes':[_0x1841('0x14'),_0x1841('0x15')],'raw':!![]})[_0x1841('0x16')](function(_0x16917f){_0x3e7e22=_0x16917f;if(!_0x3e7e22[_0x1841('0x14')]){logger[_0x1841('0xe')](_0x1841('0x17'),_0x4c9df4);throw new Error(_0x1841('0x10'));}return _0x443172[_0x1841('0x13')]({'attributes':['id',_0x1841('0x18'),_0x1841('0x19'),_0x1841('0x1a'),'role',_0x1841('0x1b'),_0x1841('0x1c'),_0x1841('0x1d'),_0x1841('0x1e')],'where':{'name':_0x4c9df4,'role':{'$or':['admin',_0x1841('0x1f'),_0x1841('0x20')]},'adSsoEnabled':!![]}});})[_0x1841('0x16')](function(_0x1ed975){if(!_0x1ed975||_0x1ed975&&_0x1ed975[_0x1841('0x18')]!==_0x4c9df4){throw new Error(_0x1841('0x10'));}_0x287c5e=_0x1ed975;var _0x28a0d2=_0x287c5e[_0x1841('0x18')]+'@'+config[_0x1841('0x8')][_0x1841('0xc')];return adAuthenticate(config[_0x1841('0x8')],_0x28a0d2,_0x101dfd);})[_0x1841('0x16')](function(_0x60ab64){if(_0x287c5e['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x3e7e22[_0x1841('0x15')]>0x0){if(_0x287c5e['blocked']){if(moment(_0x287c5e[_0x1841('0x1d')])[_0x1841('0x21')](_0x3e7e22[_0x1841('0x15')],_0x1841('0x22'))>moment()){throw new Error(_0x1841('0x10'));}return utils[_0x1841('0x23')](_0x287c5e,0x0,![],null)[_0x1841('0x16')](function(){return utils[_0x1841('0x24')](_0x287c5e);})[_0x1841('0x16')](function(){return _0x9dc9c8(null,_0x287c5e);});}else{return utils[_0x1841('0x24')](_0x287c5e)['then'](function(){return _0x9dc9c8(null,_0x287c5e);});}}else{return utils['getLicense'](_0x287c5e)[_0x1841('0x16')](function(){return _0x9dc9c8(null,_0x287c5e);});}})[_0x1841('0x25')](function(_0x4eddde){return _0x9dc9c8(null,![],_0x4eddde);});}function handleError(_0x1f0985,_0x302824,_0x336e60){return _0x1f0985[_0x1841('0x26')](_0x302824||0x1f4)[_0x1841('0x27')]({'message':_0x336e60?_0x336e60[_0x1841('0x28')]||_0x336e60:''});}exports['login']=function(_0x2056cb,_0x3c952c,_0x34aaf2){passport[_0x1841('0xd')](_0x1841('0x29'),function(_0x10e12e,_0x5d3242,_0x371856){var _0x37cc52=_0x10e12e||_0x371856;if(_0x37cc52){return handleError(_0x3c952c,0x191,_0x37cc52);}if(!_0x5d3242){return handleError(_0x3c952c,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x296269={'payload':{'id':_0x5d3242['id'],'role':_0x5d3242['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x296269)[_0x1841('0x16')](function(_0x11d8ee){_0x3c952c[_0x1841('0x2a')]({'id':_0x5d3242['id'],'token':_0x11d8ee,'statusCall':'','isAlreadyLogged':_0x5d3242[_0x1841('0x1e')]});});}})(_0x2056cb,_0x3c952c,_0x34aaf2);};passport['use'](_0x1841('0x29'),new LocalStrategy({'usernameField':_0x1841('0x18'),'passwordField':_0x1841('0x19')},function(_0x59b4dd,_0x423a99,_0x1e3261){return ActiveDirectoryAuthenticate(db[_0x1841('0x2b')],_0x59b4dd,_0x423a99,_0x1e3261);})); \ No newline at end of file +var _0x580b=['agent','blockDuration','add','minutes','clearBlockUser','getLicense','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','online','use','password','User','passport','Strategy','activedirectory2','bluebird','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','undefined','activedirectory','baseDN','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','role','disabled','blocked','blockedAt','admin','user'];(function(_0x5517d1,_0x14be6f){var _0x18f2f1=function(_0x511994){while(--_0x511994){_0x5517d1['push'](_0x5517d1['shift']());}};_0x18f2f1(++_0x14be6f);}(_0x580b,0xf0));var _0xb580=function(_0x562d4c,_0x2812c2){_0x562d4c=_0x562d4c-0x0;var _0x276edd=_0x580b[_0x562d4c];return _0x276edd;};'use strict';var passport=require(_0xb580('0x0'));var LocalStrategy=require('passport-local')[_0xb580('0x1')];var moment=require('moment');var ActiveDirectory=require(_0xb580('0x2'));var BPromise=require(_0xb580('0x3'));var util=require('util');var db=require(_0xb580('0x4'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xb580('0x5'));var config=require(_0xb580('0x6'));var logger=require(_0xb580('0x7'))('api');function isActiveDirectoryConfigured(_0x7683b8){var _0x1cfbda=![];if(typeof _0x7683b8['activedirectory']!==_0xb580('0x8')){_0x1cfbda=_0x7683b8[_0xb580('0x9')][_0xb580('0xa')]&&_0x7683b8[_0xb580('0x9')][_0xb580('0xb')]&&_0x7683b8['activedirectory']['domain'];}return _0x1cfbda;}function adAuthenticate(_0x569f15,_0x5dec2b,_0x4b8acf){return new BPromise(function(_0x453772,_0x11f9b0){try{var _0x3636e2=new ActiveDirectory(_0x569f15);_0x3636e2[_0xb580('0xc')](_0x5dec2b,_0x4b8acf,function(_0x628222,_0x44534f){if(_0x628222){logger[_0xb580('0xd')](_0xb580('0xe'),_0x5dec2b,util['inspect'](_0x628222,{'showHidden':![],'depth':null}));_0x11f9b0(_0xb580('0xf'));}else if(!_0x44534f){logger[_0xb580('0xd')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x5dec2b);_0x11f9b0(_0xb580('0xf'));}else{_0x453772(_0x44534f);}});}catch(_0x30a791){_0x11f9b0(_0x30a791);}});}function ActiveDirectoryAuthenticate(_0x2c2a0b,_0x524c14,_0x1351af,_0x591e30){var _0x11a268,_0x2f50f3;if(!isActiveDirectoryConfigured(config)){logger[_0xb580('0xd')](_0xb580('0x10'),_0x524c14);return _0x591e30(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xb580('0x11')][_0xb580('0x12')]({'where':{'id':0x1},'attributes':['adSsoEnabled','blockDuration'],'raw':!![]})[_0xb580('0x13')](function(_0x695b00){_0x11a268=_0x695b00;if(!_0x11a268[_0xb580('0x14')]){logger[_0xb580('0xd')](_0xb580('0x15'),_0x524c14);throw new Error(_0xb580('0xf'));}return _0x2c2a0b[_0xb580('0x12')]({'attributes':['id',_0xb580('0x16'),'password',_0xb580('0x17'),_0xb580('0x18'),_0xb580('0x19'),_0xb580('0x1a'),_0xb580('0x1b'),'online'],'where':{'name':_0x524c14,'role':{'$or':[_0xb580('0x1c'),_0xb580('0x1d'),_0xb580('0x1e')]},'adSsoEnabled':!![]}});})[_0xb580('0x13')](function(_0x2f5bba){if(!_0x2f5bba||_0x2f5bba&&_0x2f5bba[_0xb580('0x16')]!==_0x524c14){throw new Error(_0xb580('0xf'));}_0x2f50f3=_0x2f5bba;var _0x2b13fb=_0x2f50f3['name']+'@'+config[_0xb580('0x9')]['domain'];return adAuthenticate(config[_0xb580('0x9')],_0x2b13fb,_0x1351af);})['then'](function(_0xda310){if(_0x2f50f3[_0xb580('0x19')]){throw new Error(_0xb580('0xf'));}if(_0x11a268[_0xb580('0x1f')]>0x0){if(_0x2f50f3['blocked']){if(moment(_0x2f50f3['blockedAt'])[_0xb580('0x20')](_0x11a268[_0xb580('0x1f')],_0xb580('0x21'))>moment()){throw new Error(_0xb580('0xf'));}return utils[_0xb580('0x22')](_0x2f50f3,0x0,![],null)[_0xb580('0x13')](function(){return utils[_0xb580('0x23')](_0x2f50f3);})[_0xb580('0x13')](function(){return _0x591e30(null,_0x2f50f3);});}else{return utils[_0xb580('0x23')](_0x2f50f3)[_0xb580('0x13')](function(){return _0x591e30(null,_0x2f50f3);});}}else{return utils[_0xb580('0x23')](_0x2f50f3)[_0xb580('0x13')](function(){return _0x591e30(null,_0x2f50f3);});}})['catch'](function(_0x171dc0){return _0x591e30(null,![],_0x171dc0);});}function handleError(_0x1cf42e,_0x2dfedc,_0x5041c0){return _0x1cf42e[_0xb580('0x24')](_0x2dfedc||0x1f4)[_0xb580('0x25')]({'message':_0x5041c0?_0x5041c0['message']||_0x5041c0:''});}exports[_0xb580('0x26')]=function(_0x271175,_0x3ff049,_0x38ad63){passport[_0xb580('0xc')](_0xb580('0x27'),function(_0x288c1f,_0x545bc4,_0xfbabd9){var _0x21ca1d=_0x288c1f||_0xfbabd9;if(_0x21ca1d){return handleError(_0x3ff049,0x191,_0x21ca1d);}if(!_0x545bc4){return handleError(_0x3ff049,0x194,{'message':_0xb580('0x28')});}else{var _0x1b5746={'payload':{'id':_0x545bc4['id'],'role':_0x545bc4[_0xb580('0x18')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1b5746)[_0xb580('0x13')](function(_0x3a3e57){_0x3ff049['json']({'id':_0x545bc4['id'],'token':_0x3a3e57,'statusCall':'','isAlreadyLogged':_0x545bc4[_0xb580('0x29')]});});}})(_0x271175,_0x3ff049,_0x38ad63);};passport[_0xb580('0x2a')](_0xb580('0x27'),new LocalStrategy({'usernameField':_0xb580('0x16'),'passwordField':_0xb580('0x2b')},function(_0x2f7a19,_0x5c4fdf,_0x24d8b3){return ActiveDirectoryAuthenticate(db[_0xb580('0x2c')],_0x2f7a19,_0x5c4fdf,_0x24d8b3);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 42055ad..af2cd3f 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 _0xa08c=['login','exports','express','Router','./authActiveDirectory.controller'];(function(_0x20f38a,_0x6dd961){var _0x2ccf9f=function(_0x586553){while(--_0x586553){_0x20f38a['push'](_0x20f38a['shift']());}};_0x2ccf9f(++_0x6dd961);}(_0xa08c,0x133));var _0xca08=function(_0x276c4f,_0x55eee3){_0x276c4f=_0x276c4f-0x0;var _0x551485=_0xa08c[_0x276c4f];return _0x551485;};'use strict';var express=require(_0xca08('0x0'));var router=express[_0xca08('0x1')]();var controller=require(_0xca08('0x2'));router['post']('/',controller[_0xca08('0x3')]);module[_0xca08('0x4')]=router; \ No newline at end of file +var _0xd175=['Router','./authActiveDirectory.controller','post','login','express'];(function(_0x1579be,_0x4f5834){var _0x4f4837=function(_0x286b0){while(--_0x286b0){_0x1579be['push'](_0x1579be['shift']());}};_0x4f4837(++_0x4f5834);}(_0xd175,0x1cb));var _0x5d17=function(_0x45dc19,_0x22271a){_0x45dc19=_0x45dc19-0x0;var _0x520888=_0xd175[_0x45dc19];return _0x520888;};'use strict';var express=require(_0x5d17('0x0'));var router=express[_0x5d17('0x1')]();var controller=require(_0x5d17('0x2'));router[_0x5d17('0x3')]('/',controller[_0x5d17('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index e41478d..e139df9 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x7a54,0x106));var _0x47a5=function(_0x4a763a,_0x4350e2){_0x4a763a=_0x4a763a-0x0;var _0xaf1e01=_0x7a54[_0x4a763a];return _0xaf1e01;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _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(_0x305779,_0x57891f){var _0x41c696=function(_0x53f33c){while(--_0x53f33c){_0x305779['push'](_0x305779['shift']());}};_0x41c696(++_0x57891f);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 0f09ae1..4b2fbaf 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 _0x9f13=['../user/user.controller.js','../../components/auth/service','get','/callback','callback','isMiddleware','login','exports','express','passport','Router','./authGoogle.controller'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0x9f13,0x1f4));var _0x39f1=function(_0x40fa64,_0xb797a4){_0x40fa64=_0x40fa64-0x0;var _0x272ab0=_0x9f13[_0x40fa64];return _0x272ab0;};'use strict';var express=require(_0x39f1('0x0'));var passport=require(_0x39f1('0x1'));var router=express[_0x39f1('0x2')]();var controller=require(_0x39f1('0x3'));var userController=require(_0x39f1('0x4'));var authService=require(_0x39f1('0x5'));router[_0x39f1('0x6')]('/',controller['login']);router[_0x39f1('0x6')](_0x39f1('0x7'),controller[_0x39f1('0x8')],authService[_0x39f1('0x9')],userController[_0x39f1('0xa')],authService['setTokenCookie']);module[_0x39f1('0xb')]=router; \ No newline at end of file +var _0xb55e=['exports','express','passport','Router','./authGoogle.controller','get','login','/callback','setTokenCookie'];(function(_0x438f7c,_0x60ba0e){var _0x4c6e38=function(_0xdf6070){while(--_0xdf6070){_0x438f7c['push'](_0x438f7c['shift']());}};_0x4c6e38(++_0x60ba0e);}(_0xb55e,0x106));var _0xeb55=function(_0x58c9d2,_0xc9c90b){_0x58c9d2=_0x58c9d2-0x0;var _0x65481a=_0xb55e[_0x58c9d2];return _0x65481a;};'use strict';var express=require(_0xeb55('0x0'));var passport=require(_0xeb55('0x1'));var router=express[_0xeb55('0x2')]();var controller=require(_0xeb55('0x3'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0xeb55('0x4')]('/',controller[_0xeb55('0x5')]);router['get'](_0xeb55('0x6'),controller['callback'],authService['isMiddleware'],userController['login'],authService[_0xeb55('0x7')]);module[_0xeb55('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index c0293dc..ce71e02 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 _0x915c=['Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','password','role','disabled','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','blockDuration','clearBlockUser','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','user','request','SendMail','error','message','stringify','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0x915c,0xb7));var _0xc915=function(_0x36b8f4,_0x15f119){_0x36b8f4=_0x36b8f4-0x0;var _0x287feb=_0x915c[_0x36b8f4];return _0x287feb;};'use strict';var util=require(_0xc915('0x0'));var passport=require(_0xc915('0x1'));var LocalStrategy=require(_0xc915('0x2'))[_0xc915('0x3')];var jayson=require(_0xc915('0x4'));var _=require(_0xc915('0x5'));var rs=require(_0xc915('0x6'));var moment=require(_0xc915('0x7'));var db=require(_0xc915('0x8'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xc915('0x9'));var client=jayson[_0xc915('0xa')][_0xc915('0xb')]({'port':0x232b});function localAuthenticate(_0x4510d3,_0x1da764,_0x74763d,_0x57c617){var _0x20a704,_0x58dafa;return db[_0xc915('0xc')][_0xc915('0xd')]({'where':{'id':0x1},'attributes':[_0xc915('0xe'),'blockDuration'],'raw':!![]})[_0xc915('0xf')](function(_0x315184){_0x20a704=_0x315184;return _0x4510d3['findOne']({'attributes':['id',_0xc915('0x10'),_0xc915('0x11'),'salt',_0xc915('0x12'),_0xc915('0x13'),'blocked',_0xc915('0x14'),_0xc915('0x15')],'where':{'name':_0x1da764,'role':{'$or':[_0xc915('0x16'),'user',_0xc915('0x17')]}}});})[_0xc915('0xf')](function(_0x47906f){if(!_0x47906f||_0x47906f&&_0x47906f[_0xc915('0x10')]!==_0x1da764){throw new Error(_0xc915('0x18'));}else{_0x58dafa=_0x47906f;return _0x58dafa;}})[_0xc915('0xf')](function(){_0x58dafa['authenticate'](_0x74763d,function(_0x90f29c,_0x20546d){var _0x15ddf3=_0x58dafa[_0xc915('0x15')]+0x1;if(_0x90f29c){return _0x57c617(_0x90f29c);}else if(!_0x20546d){if(_0x58dafa[_0xc915('0x13')]){return _0x57c617(null,![],{'message':_0xc915('0x18')});}else if(_0x20a704[_0xc915('0xe')]>0x0){if(_0x58dafa[_0xc915('0x19')]){if(_0x20a704['blockDuration']>0x0){if(moment(_0x58dafa['blockedAt'])[_0xc915('0x1a')](_0x20a704[_0xc915('0x1b')],'minutes')>moment()){return _0x57c617(null,![],{'message':_0xc915('0x18')});}else{return utils['clearBlockUser'](_0x58dafa,_0x15ddf3,![],null)[_0xc915('0xf')](function(){return _0x57c617(null,![],{'message':_0xc915('0x18')});});}}else{return _0x57c617(null,![],{'message':_0xc915('0x18')});}}else{if(_0x15ddf3>=_0x20a704[_0xc915('0xe')]){return utils[_0xc915('0x1c')](_0x58dafa,0x0,!![],moment())[_0xc915('0xf')](function(){return _0x57c617(null,![],{'message':_0xc915('0x18')});});}else{return utils['clearBlockUser'](_0x58dafa,_0x15ddf3,![],null)[_0xc915('0xf')](function(){return _0x57c617(null,![],{'message':_0xc915('0x18')});});}}}else{return _0x57c617(null,![],{'message':_0xc915('0x18')});}}else{if(_0x58dafa[_0xc915('0x13')]){return _0x57c617(null,![],{'message':_0xc915('0x18')});}else if(_0x20a704[_0xc915('0xe')]>0x0){if(_0x58dafa[_0xc915('0x19')]){if(_0x20a704[_0xc915('0x1b')]>0x0){if(moment(_0x58dafa[_0xc915('0x14')])[_0xc915('0x1a')](_0x20a704['blockDuration'],_0xc915('0x1d'))>moment()){return _0x57c617(null,![],{'message':_0xc915('0x18')});}else{return utils['clearBlockUser'](_0x58dafa,0x0,![],null)[_0xc915('0xf')](function(){return utils[_0xc915('0x1e')](_0x58dafa);})['then'](function(){return _0x57c617(null,_0x58dafa);});}}else{return _0x57c617(null,![],{'message':_0xc915('0x18')});}}else{return utils['clearBlockUser'](_0x58dafa,0x0,![],null)[_0xc915('0xf')](function(){return utils[_0xc915('0x1e')](_0x58dafa);})[_0xc915('0xf')](function(){return _0x57c617(null,_0x58dafa);})[_0xc915('0x1f')](function(_0x32fa29){return _0x57c617(null,![],_0x32fa29);});}}else{if(_0x58dafa['blocked']){return _0x57c617(null,![],{'message':_0xc915('0x18')});}else{return utils[_0xc915('0x1e')](_0x58dafa)[_0xc915('0xf')](function(){return _0x57c617(null,_0x58dafa);});}}}});})['catch'](function(_0xf26dcc){return _0x57c617(null,![],_0xf26dcc);});}function sendServiceMail(_0x1470f2){return db[_0xc915('0x20')][_0xc915('0x21')]({'where':{'service':!![]},'attributes':['id',_0xc915('0x10'),_0xc915('0x22')],'include':[{'model':db[_0xc915('0x23')],'as':_0xc915('0x24'),'include':[{'model':db[_0xc915('0x25')],'as':_0xc915('0x25')}]}]})['then'](function(_0x30eb4d){if(!_0x30eb4d){throw new Error(_0xc915('0x26'));}var _0x37fe04=_0x30eb4d[_0xc915('0x27')]();var _0x118511={'account':_0x37fe04,'message':_[_0xc915('0x28')]({'from':util[_0xc915('0x29')]('\x22%s\x22\x20<%s>',_0x30eb4d[_0xc915('0x10')],_0x30eb4d[_0xc915('0x22')]||_0x30eb4d[_0xc915('0x24')][_0xc915('0x2a')])},_0x1470f2)};return client[_0xc915('0x2b')](_0xc915('0x2c'),_0x118511);})[_0xc915('0xf')](function(_0x3d1008){if(_0x3d1008[_0xc915('0x2d')]){throw new Error(util[_0xc915('0x29')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x3d1008[_0xc915('0x2d')][_0xc915('0x2e')]||JSON[_0xc915('0x2f')](_0x3d1008['error'])));}return!![];});}function handleError(_0x20710a,_0x1ddd45,_0x5548ce){return _0x20710a[_0xc915('0x30')](_0x1ddd45||0x1f4)[_0xc915('0x31')]({'message':_0x5548ce?_0x5548ce['message']||_0x5548ce:''});}exports[_0xc915('0x32')]=function(_0x186cb8,_0xb4984a,_0x2b764b){passport[_0xc915('0x33')](_0xc915('0x34'),function(_0x82696c,_0x472a37,_0x5a82dc){var _0x53b8c9=_0x82696c||_0x5a82dc;if(_0x53b8c9){return handleError(_0xb4984a,0x191,_0x53b8c9);}if(!_0x472a37){return handleError(_0xb4984a,0x194,{'message':_0xc915('0x35')});}else{var _0x19f7df={'payload':{'id':_0x472a37['id'],'role':_0x472a37[_0xc915('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0xc915('0x36')](_0x19f7df)['then'](function(_0x4f4f79){_0xb4984a['json']({'id':_0x472a37['id'],'token':_0x4f4f79,'statusCall':'','isAlreadyLogged':_0x472a37['online']});});}})(_0x186cb8,_0xb4984a,_0x2b764b);};exports[_0xc915('0x37')]=function(_0x37afb5,_0x2cbc44){if(!_0x37afb5[_0xc915('0x38')][_0xc915('0x22')]){return handleError(_0x2cbc44,0x1f4,{'message':_0xc915('0x39')});}var _0x2b376f=rs[_0xc915('0x3a')]();_0x37afb5['body'][_0xc915('0x22')]=_0x37afb5['body'][_0xc915('0x22')][_0xc915('0x3b')]()[_0xc915('0x3c')]();var _0x30a7bf;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xc915('0xe'),'blockDuration'],'raw':!![]})['then'](function(_0x2fc044){_0x30a7bf=_0x2fc044;return db[_0xc915('0x3d')][_0xc915('0x21')]({'where':{'email':_0x37afb5[_0xc915('0x38')][_0xc915('0x22')]}});})[_0xc915('0xf')](function(_0x39b027){if(!_0x39b027){throw new Error(_0xc915('0x3e'));}if(_0x39b027[_0xc915('0x13')]){throw new Error(_0xc915('0x3f'));}if(_0x39b027['blocked']){if(moment(_0x39b027['blockedAt'])[_0xc915('0x1a')](_0x30a7bf[_0xc915('0x1b')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x39b027[_0xc915('0x19')]=![];_0x39b027['blockedAt']=null;}}_0x39b027[_0xc915('0x40')]=_0x2b376f;_0x39b027[_0xc915('0x41')]=Date[_0xc915('0x42')]()+0x36ee80;return _0x39b027[_0xc915('0x43')]();})[_0xc915('0xf')](function(){return sendServiceMail({'to':_0x37afb5['body'][_0xc915('0x22')],'subject':_0xc915('0x44'),'text':_0xc915('0x45')+_0xc915('0x46')+_0xc915('0x47')+_0x37afb5['headers'][_0xc915('0x48')]+'/reset/'+_0x2b376f+'\x0a\x0a'+_0xc915('0x49')});})[_0xc915('0xf')](function(){_0x2cbc44[_0xc915('0x30')](0xc8)[_0xc915('0x31')]({'message':_0xc915('0x4a')});})['catch'](function(_0x2c882e){return handleError(_0x2cbc44,0x1f4,_0x2c882e);});};exports[_0xc915('0x4b')]=function(_0x40878e,_0x4e6a21){return db[_0xc915('0x3d')][_0xc915('0x21')]({'where':{'resetPasswordToken':_0x40878e[_0xc915('0x4c')][_0xc915('0x4d')],'resetPasswordExpires':{'$gt':Date[_0xc915('0x42')]()}}})['then'](function(_0x462a1b){if(!_0x462a1b){throw new Error(_0xc915('0x4e'));}return db['Setting'][_0xc915('0xd')]({'attributes':['id','securePassword',_0xc915('0x4f'),_0xc915('0x50')]})[_0xc915('0xf')](function(_0x441a57){if(_0x441a57[_0xc915('0x51')])authService[_0xc915('0x52')](_0x40878e['body'][_0xc915('0x11')]);if(!_0x441a57[_0xc915('0x4f')]||!_0x462a1b[_0xc915('0x53')])return _0x462a1b;authService[_0xc915('0x54')](_0x40878e['body'][_0xc915('0x11')],_0x462a1b[_0xc915('0x53')],_0x441a57[_0xc915('0x50')]);return _0x462a1b;})[_0xc915('0xf')](function(){_0x462a1b[_0xc915('0x11')]=_0x40878e[_0xc915('0x38')][_0xc915('0x11')];_0x462a1b['resetPasswordToken']=null;_0x462a1b['resetPasswordExpires']=null;return _0x462a1b[_0xc915('0x43')]();});})[_0xc915('0xf')](function(){_0x4e6a21[_0xc915('0x30')](0xc8)['send']({'message':_0xc915('0x55')});})[_0xc915('0x1f')](function(_0x107f39){return handleError(_0x4e6a21,0x1f4,_0x107f39);});};passport[_0xc915('0x56')](_0xc915('0x34'),new LocalStrategy({'usernameField':_0xc915('0x10'),'passwordField':'password'},function(_0x399b1c,_0xbed1c,_0x5ee970){return localAuthenticate(db[_0xc915('0x3d')],_0x399b1c,_0xbed1c,_0x5ee970);})); \ No newline at end of file +var _0x9e31=['message','error','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','previousPasswords','passwordHistoryLimit','Password\x20reset!','use','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','name','password','role','disabled','blocked','blockedAt','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x9e31,0x7c));var _0x19e3=function(_0x5e2603,_0x28b846){_0x5e2603=_0x5e2603-0x0;var _0x19bb24=_0x9e31[_0x5e2603];return _0x19bb24;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0x19e3('0x0'));var _=require(_0x19e3('0x1'));var rs=require(_0x19e3('0x2'));var moment=require(_0x19e3('0x3'));var db=require(_0x19e3('0x4'))['db'];var authService=require(_0x19e3('0x5'));var utils=require(_0x19e3('0x6'));var client=jayson[_0x19e3('0x7')][_0x19e3('0x8')]({'port':0x232b});function localAuthenticate(_0x478e14,_0x204f09,_0x20de12,_0x28ca80){var _0x73abdf,_0x4d867d;return db[_0x19e3('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0x19e3('0xa'),_0x19e3('0xb')],'raw':!![]})['then'](function(_0x4344cc){_0x73abdf=_0x4344cc;return _0x478e14['findOne']({'attributes':['id',_0x19e3('0xc'),_0x19e3('0xd'),'salt',_0x19e3('0xe'),_0x19e3('0xf'),_0x19e3('0x10'),_0x19e3('0x11'),'loginAttempts'],'where':{'name':_0x204f09,'role':{'$or':[_0x19e3('0x12'),_0x19e3('0x13'),_0x19e3('0x14')]}}});})[_0x19e3('0x15')](function(_0x29e082){if(!_0x29e082||_0x29e082&&_0x29e082[_0x19e3('0xc')]!==_0x204f09){throw new Error(_0x19e3('0x16'));}else{_0x4d867d=_0x29e082;return _0x4d867d;}})[_0x19e3('0x15')](function(){_0x4d867d['authenticate'](_0x20de12,function(_0x2349e2,_0x5ecb13){var _0x31bc6c=_0x4d867d[_0x19e3('0x17')]+0x1;if(_0x2349e2){return _0x28ca80(_0x2349e2);}else if(!_0x5ecb13){if(_0x4d867d[_0x19e3('0xf')]){return _0x28ca80(null,![],{'message':_0x19e3('0x16')});}else if(_0x73abdf[_0x19e3('0xa')]>0x0){if(_0x4d867d['blocked']){if(_0x73abdf['blockDuration']>0x0){if(moment(_0x4d867d[_0x19e3('0x11')])[_0x19e3('0x18')](_0x73abdf[_0x19e3('0xb')],_0x19e3('0x19'))>moment()){return _0x28ca80(null,![],{'message':_0x19e3('0x16')});}else{return utils[_0x19e3('0x1a')](_0x4d867d,_0x31bc6c,![],null)[_0x19e3('0x15')](function(){return _0x28ca80(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x28ca80(null,![],{'message':_0x19e3('0x16')});}}else{if(_0x31bc6c>=_0x73abdf['allowedLoginAttempts']){return utils[_0x19e3('0x1a')](_0x4d867d,0x0,!![],moment())[_0x19e3('0x15')](function(){return _0x28ca80(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x19e3('0x1a')](_0x4d867d,_0x31bc6c,![],null)['then'](function(){return _0x28ca80(null,![],{'message':_0x19e3('0x16')});});}}}else{return _0x28ca80(null,![],{'message':_0x19e3('0x16')});}}else{if(_0x4d867d[_0x19e3('0xf')]){return _0x28ca80(null,![],{'message':_0x19e3('0x16')});}else if(_0x73abdf['allowedLoginAttempts']>0x0){if(_0x4d867d[_0x19e3('0x10')]){if(_0x73abdf[_0x19e3('0xb')]>0x0){if(moment(_0x4d867d[_0x19e3('0x11')])[_0x19e3('0x18')](_0x73abdf['blockDuration'],_0x19e3('0x19'))>moment()){return _0x28ca80(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x19e3('0x1a')](_0x4d867d,0x0,![],null)[_0x19e3('0x15')](function(){return utils[_0x19e3('0x1b')](_0x4d867d);})[_0x19e3('0x15')](function(){return _0x28ca80(null,_0x4d867d);});}}else{return _0x28ca80(null,![],{'message':_0x19e3('0x16')});}}else{return utils[_0x19e3('0x1a')](_0x4d867d,0x0,![],null)[_0x19e3('0x15')](function(){return utils['getLicense'](_0x4d867d);})[_0x19e3('0x15')](function(){return _0x28ca80(null,_0x4d867d);})[_0x19e3('0x1c')](function(_0x44f66f){return _0x28ca80(null,![],_0x44f66f);});}}else{if(_0x4d867d['blocked']){return _0x28ca80(null,![],{'message':_0x19e3('0x16')});}else{return utils[_0x19e3('0x1b')](_0x4d867d)[_0x19e3('0x15')](function(){return _0x28ca80(null,_0x4d867d);});}}}});})['catch'](function(_0x10209b){return _0x28ca80(null,![],_0x10209b);});}function sendServiceMail(_0x408806){return db[_0x19e3('0x1d')][_0x19e3('0x1e')]({'where':{'service':!![]},'attributes':['id','name',_0x19e3('0x1f')],'include':[{'model':db['MailServerOut'],'as':_0x19e3('0x20'),'include':[{'model':db[_0x19e3('0x21')],'as':_0x19e3('0x21')}]}]})['then'](function(_0x4809dd){if(!_0x4809dd){throw new Error(_0x19e3('0x22'));}var _0x421d4e=_0x4809dd[_0x19e3('0x23')]();var _0x87015a={'account':_0x421d4e,'message':_[_0x19e3('0x24')]({'from':util[_0x19e3('0x25')](_0x19e3('0x26'),_0x4809dd[_0x19e3('0xc')],_0x4809dd[_0x19e3('0x1f')]||_0x4809dd[_0x19e3('0x20')]['user'])},_0x408806)};return client[_0x19e3('0x27')](_0x19e3('0x28'),_0x87015a);})[_0x19e3('0x15')](function(_0x38ebf0){if(_0x38ebf0['error']){throw new Error(util[_0x19e3('0x25')](_0x19e3('0x29'),_0x38ebf0['error'][_0x19e3('0x2a')]||JSON['stringify'](_0x38ebf0[_0x19e3('0x2b')])));}return!![];});}function handleError(_0x19b550,_0x3b84d3,_0x18e997){return _0x19b550[_0x19e3('0x2c')](_0x3b84d3||0x1f4)[_0x19e3('0x2d')]({'message':_0x18e997?_0x18e997['message']||_0x18e997:''});}exports[_0x19e3('0x2e')]=function(_0x26668e,_0x2f6246,_0xfaf850){passport['authenticate'](_0x19e3('0x2f'),function(_0xee1ed8,_0x32bb76,_0x56c668){var _0x28d195=_0xee1ed8||_0x56c668;if(_0x28d195){return handleError(_0x2f6246,0x191,_0x28d195);}if(!_0x32bb76){return handleError(_0x2f6246,0x194,{'message':_0x19e3('0x30')});}else{var _0x1d9891={'payload':{'id':_0x32bb76['id'],'role':_0x32bb76[_0x19e3('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0x19e3('0x31')](_0x1d9891)[_0x19e3('0x15')](function(_0x22f92c){_0x2f6246[_0x19e3('0x32')]({'id':_0x32bb76['id'],'token':_0x22f92c,'statusCall':'','isAlreadyLogged':_0x32bb76[_0x19e3('0x33')]});});}})(_0x26668e,_0x2f6246,_0xfaf850);};exports['forgot']=function(_0x56f05f,_0x164225){if(!_0x56f05f[_0x19e3('0x34')][_0x19e3('0x1f')]){return handleError(_0x164225,0x1f4,{'message':_0x19e3('0x35')});}var _0x393372=rs[_0x19e3('0x36')]();_0x56f05f[_0x19e3('0x34')][_0x19e3('0x1f')]=_0x56f05f[_0x19e3('0x34')][_0x19e3('0x1f')][_0x19e3('0x37')]()[_0x19e3('0x38')]();var _0x3919b0;return db[_0x19e3('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0x19e3('0xa'),_0x19e3('0xb')],'raw':!![]})['then'](function(_0x48219b){_0x3919b0=_0x48219b;return db[_0x19e3('0x39')][_0x19e3('0x1e')]({'where':{'email':_0x56f05f['body'][_0x19e3('0x1f')]}});})[_0x19e3('0x15')](function(_0x204617){if(!_0x204617){throw new Error(_0x19e3('0x3a'));}if(_0x204617[_0x19e3('0xf')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x204617['blocked']){if(moment(_0x204617[_0x19e3('0x11')])[_0x19e3('0x18')](_0x3919b0[_0x19e3('0xb')],_0x19e3('0x19'))>moment()){throw new Error(_0x19e3('0x3b'));}else{_0x204617[_0x19e3('0x10')]=![];_0x204617[_0x19e3('0x11')]=null;}}_0x204617[_0x19e3('0x3c')]=_0x393372;_0x204617[_0x19e3('0x3d')]=Date[_0x19e3('0x3e')]()+0x36ee80;return _0x204617[_0x19e3('0x3f')]();})[_0x19e3('0x15')](function(){return sendServiceMail({'to':_0x56f05f[_0x19e3('0x34')]['email'],'subject':_0x19e3('0x40'),'text':_0x19e3('0x41')+_0x19e3('0x42')+_0x19e3('0x43')+_0x56f05f[_0x19e3('0x44')]['host']+_0x19e3('0x45')+_0x393372+'\x0a\x0a'+_0x19e3('0x46')});})[_0x19e3('0x15')](function(){_0x164225[_0x19e3('0x2c')](0xc8)[_0x19e3('0x2d')]({'message':_0x19e3('0x47')});})[_0x19e3('0x1c')](function(_0x536563){return handleError(_0x164225,0x1f4,_0x536563);});};exports[_0x19e3('0x48')]=function(_0x5c251a,_0x413c2a){return db['User'][_0x19e3('0x1e')]({'where':{'resetPasswordToken':_0x5c251a[_0x19e3('0x49')]['token'],'resetPasswordExpires':{'$gt':Date[_0x19e3('0x3e')]()}}})['then'](function(_0x1ae9a6){if(!_0x1ae9a6){throw new Error(_0x19e3('0x4a'));}return db[_0x19e3('0x9')]['findOne']({'attributes':['id','securePassword','enforcePasswordHistory','passwordHistoryLimit']})['then'](function(_0x5da8d5){if(_0x5da8d5[_0x19e3('0x4b')])authService[_0x19e3('0x4c')](_0x5c251a[_0x19e3('0x34')]['password']);if(!_0x5da8d5[_0x19e3('0x4d')]||!_0x1ae9a6['previousPasswords'])return _0x1ae9a6;authService[_0x19e3('0x4e')](_0x5c251a[_0x19e3('0x34')]['password'],_0x1ae9a6[_0x19e3('0x4f')],_0x5da8d5[_0x19e3('0x50')]);return _0x1ae9a6;})[_0x19e3('0x15')](function(){_0x1ae9a6[_0x19e3('0xd')]=_0x5c251a[_0x19e3('0x34')][_0x19e3('0xd')];_0x1ae9a6['resetPasswordToken']=null;_0x1ae9a6[_0x19e3('0x3d')]=null;return _0x1ae9a6['save']();});})[_0x19e3('0x15')](function(){_0x413c2a[_0x19e3('0x2c')](0xc8)['send']({'message':_0x19e3('0x51')});})[_0x19e3('0x1c')](function(_0x4c019b){return handleError(_0x413c2a,0x1f4,_0x4c019b);});};passport[_0x19e3('0x52')](_0x19e3('0x2f'),new LocalStrategy({'usernameField':_0x19e3('0xc'),'passwordField':_0x19e3('0xd')},function(_0x13e20b,_0x44c9f8,_0x5669ea){return localAuthenticate(db[_0x19e3('0x39')],_0x13e20b,_0x44c9f8,_0x5669ea);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 4707575..a461bd0 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 _0x22d3=['reset','exports','Router','./authLocal.controller','post','/forgot','forgot','/reset/:token'];(function(_0x5c3e11,_0x4dd35b){var _0x4e9064=function(_0x5ae0cf){while(--_0x5ae0cf){_0x5c3e11['push'](_0x5c3e11['shift']());}};_0x4e9064(++_0x4dd35b);}(_0x22d3,0x11a));var _0x322d=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x22d3[_0x10004e];return _0x5af990;};'use strict';var express=require('express');var router=express[_0x322d('0x0')]();var controller=require(_0x322d('0x1'));router[_0x322d('0x2')]('/',controller['login']);router[_0x322d('0x2')](_0x322d('0x3'),controller[_0x322d('0x4')]);router[_0x322d('0x2')](_0x322d('0x5'),controller[_0x322d('0x6')]);module[_0x322d('0x7')]=router; \ No newline at end of file +var _0xffd5=['login','/forgot','post','/reset/:token','express','Router','./authLocal.controller'];(function(_0xe1c7d7,_0x102465){var _0x272c22=function(_0x56b75e){while(--_0x56b75e){_0xe1c7d7['push'](_0xe1c7d7['shift']());}};_0x272c22(++_0x102465);}(_0xffd5,0x107));var _0x5ffd=function(_0x3005d5,_0xf588c7){_0x3005d5=_0x3005d5-0x0;var _0x547c7e=_0xffd5[_0x3005d5];return _0x547c7e;};'use strict';var express=require(_0x5ffd('0x0'));var router=express[_0x5ffd('0x1')]();var controller=require(_0x5ffd('0x2'));router['post']('/',controller[_0x5ffd('0x3')]);router['post'](_0x5ffd('0x4'),controller['forgot']);router[_0x5ffd('0x5')](_0x5ffd('0x6'),controller['reset']);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index e5fd2e0..6b1942b 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 _0xd105=['exports','STRING','BOOLEAN'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xd105,0x144));var _0x5d10=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd105[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x5d10('0x0')]={'name':{'type':Sequelize[_0x5d10('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x5d10('0x1')]},'description':{'type':Sequelize[_0x5d10('0x1')]},'status':{'type':Sequelize[_0x5d10('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x6f90=['exports','INTEGER'];(function(_0x582a70,_0x488f81){var _0xac9f16=function(_0x3b320b){while(--_0x3b320b){_0x582a70['push'](_0x582a70['shift']());}};_0xac9f16(++_0x488f81);}(_0x6f90,0xc6));var _0x06f9=function(_0x2a96eb,_0x23105a){_0x2a96eb=_0x2a96eb-0x0;var _0x2e86f8=_0x6f90[_0x2a96eb];return _0x2e86f8;};'use strict';var Sequelize=require('sequelize');module[_0x06f9('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x06f9('0x1')],'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 329e48f..3e108df 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 _0xd1f2=['merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','Automation','length','find','create','update','body','params','addConditions','Condition','ids','omit','findOne','getConditions','Action','getActions','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','reject','save','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x39bd4a,_0x4e23f1){var _0x2354af=function(_0x703508){while(--_0x703508){_0x39bd4a['push'](_0x39bd4a['shift']());}};_0x2354af(++_0x4e23f1);}(_0xd1f2,0x1b9));var _0x2d1f=function(_0x18c101,_0x32cb6d){_0x18c101=_0x18c101-0x0;var _0x7305b4=_0xd1f2[_0x18c101];return _0x7305b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d1f('0x0'));var zipdir=require(_0x2d1f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2d1f('0x2'));var moment=require('moment');var BPromise=require(_0x2d1f('0x3'));var Mustache=require(_0x2d1f('0x4'));var util=require(_0x2d1f('0x5'));var path=require(_0x2d1f('0x6'));var sox=require(_0x2d1f('0x7'));var csv=require(_0x2d1f('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(_0x2d1f('0x9'));var jsforce=require(_0x2d1f('0xa'));var deskjs=require(_0x2d1f('0xb'));var toCsv=require(_0x2d1f('0x8'));var querystring=require(_0x2d1f('0xc'));var Papa=require(_0x2d1f('0xd'));var Redis=require(_0x2d1f('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2d1f('0xf'));var hardwareService=require(_0x2d1f('0x10'));var logger=require(_0x2d1f('0x11'))(_0x2d1f('0x12'));var utils=require(_0x2d1f('0x13'));var config=require(_0x2d1f('0x14'));var licenseUtil=require(_0x2d1f('0x15'));var db=require(_0x2d1f('0x16'))['db'];function respondWithStatusCode(_0x153103,_0x2bfec1){_0x2bfec1=_0x2bfec1||0xcc;return function(_0x58940e){if(_0x58940e){return _0x153103[_0x2d1f('0x17')](_0x2bfec1);}return _0x153103[_0x2d1f('0x18')](_0x2bfec1)[_0x2d1f('0x19')]();};}function respondWithResult(_0x579306,_0x4b7df4){_0x4b7df4=_0x4b7df4||0xc8;return function(_0x33bf7a){if(_0x33bf7a){return _0x579306['status'](_0x4b7df4)[_0x2d1f('0x1a')](_0x33bf7a);}};}function respondWithFilteredResult(_0x2b2492,_0x127903){return function(_0x245b83){if(_0x245b83){var _0x181dcf=typeof _0x127903['offset']===_0x2d1f('0x1b')&&typeof _0x127903[_0x2d1f('0x1c')]===_0x2d1f('0x1b');var _0x2708f7=_0x245b83['count'];var _0x4f1f74=_0x181dcf?0x0:_0x127903[_0x2d1f('0x1d')];var _0x5972f1=_0x181dcf?_0x245b83[_0x2d1f('0x1e')]:_0x127903[_0x2d1f('0x1d')]+_0x127903[_0x2d1f('0x1c')];var _0x5c164b;if(_0x5972f1>=_0x2708f7){_0x5972f1=_0x2708f7;_0x5c164b=0xc8;}else{_0x5c164b=0xce;}_0x2b2492[_0x2d1f('0x18')](_0x5c164b);return _0x2b2492[_0x2d1f('0x1f')]('Content-Range',_0x4f1f74+'-'+_0x5972f1+'/'+_0x2708f7)[_0x2d1f('0x1a')](_0x245b83);}return null;};}function patchUpdates(_0x255781){return function(_0x347bcc){try{jsonpatch['apply'](_0x347bcc,_0x255781,!![]);}catch(_0x48fb01){return BPromise[_0x2d1f('0x20')](_0x48fb01);}return _0x347bcc[_0x2d1f('0x21')]();};}function saveUpdates(_0x4457c0,_0x2f3183){return function(_0x3d90ba){if(_0x3d90ba){return _0x3d90ba['update'](_0x4457c0)['then'](function(_0x25d132){return _0x25d132;});}return null;};}function removeEntity(_0x3e0be9,_0xbe00ae){return function(_0x489931){if(_0x489931){return _0x489931[_0x2d1f('0x22')]()['then'](function(){_0x3e0be9[_0x2d1f('0x18')](0xcc)[_0x2d1f('0x19')]();});}};}function handleEntityNotFound(_0x22bd8a,_0x158b84){return function(_0x425a7a){if(!_0x425a7a){_0x22bd8a['sendStatus'](0x194);}return _0x425a7a;};}function handleError(_0xc5f207,_0x56ab57){_0x56ab57=_0x56ab57||0x1f4;return function(_0x454768){logger[_0x2d1f('0x23')](_0x454768[_0x2d1f('0x24')]);if(_0x454768[_0x2d1f('0x25')]){delete _0x454768[_0x2d1f('0x25')];}_0xc5f207[_0x2d1f('0x18')](_0x56ab57)[_0x2d1f('0x26')](_0x454768);};}exports[_0x2d1f('0x27')]=function(_0x3b798b,_0x566ce1){var _0x1ee937={},_0x121f0e={},_0x10be9b={'count':0x0,'rows':[]};var _0x598d8a=_[_0x2d1f('0x28')](db['Automation'][_0x2d1f('0x29')],function(_0x485339){return{'name':_0x485339[_0x2d1f('0x2a')],'type':_0x485339['type']['key']};});_0x121f0e[_0x2d1f('0x2b')]=_[_0x2d1f('0x28')](_0x598d8a,'name');_0x121f0e[_0x2d1f('0x2c')]=_[_0x2d1f('0x2d')](_0x3b798b[_0x2d1f('0x2c')]);_0x121f0e[_0x2d1f('0x2e')]=_[_0x2d1f('0x2f')](_0x121f0e[_0x2d1f('0x2b')],_0x121f0e[_0x2d1f('0x2c')]);_0x1ee937['attributes']=_[_0x2d1f('0x2f')](_0x121f0e[_0x2d1f('0x2b')],qs[_0x2d1f('0x30')](_0x3b798b[_0x2d1f('0x2c')][_0x2d1f('0x30')]));_0x1ee937[_0x2d1f('0x31')]=_0x1ee937[_0x2d1f('0x31')]['length']?_0x1ee937['attributes']:_0x121f0e[_0x2d1f('0x2b')];if(!_0x3b798b['query'][_0x2d1f('0x32')](_0x2d1f('0x33'))){_0x1ee937['limit']=qs[_0x2d1f('0x1c')](_0x3b798b[_0x2d1f('0x2c')][_0x2d1f('0x1c')]);_0x1ee937[_0x2d1f('0x1d')]=qs[_0x2d1f('0x1d')](_0x3b798b['query'][_0x2d1f('0x1d')]);}_0x1ee937[_0x2d1f('0x34')]=qs[_0x2d1f('0x35')](_0x3b798b[_0x2d1f('0x2c')][_0x2d1f('0x35')]);_0x1ee937[_0x2d1f('0x36')]=qs['filters'](_[_0x2d1f('0x37')](_0x3b798b[_0x2d1f('0x2c')],_0x121f0e[_0x2d1f('0x2e')]),_0x598d8a);if(_0x3b798b['query'][_0x2d1f('0x38')]){_0x1ee937[_0x2d1f('0x36')]=_[_0x2d1f('0x39')](_0x1ee937['where'],{'$or':_['map'](_0x598d8a,function(_0x2aed86){if(_0x2aed86[_0x2d1f('0x3a')]!==_0x2d1f('0x3b')){var _0x232a9a={};_0x232a9a[_0x2aed86[_0x2d1f('0x25')]]={'$like':'%'+_0x3b798b[_0x2d1f('0x2c')]['filter']+'%'};return _0x232a9a;}})});}_0x1ee937=_[_0x2d1f('0x39')]({},_0x1ee937,_0x3b798b[_0x2d1f('0x3c')]);var _0x24ec2f={'where':_0x1ee937['where']};return db['Automation'][_0x2d1f('0x1e')](_0x24ec2f)[_0x2d1f('0x3d')](function(_0x31bfee){_0x10be9b[_0x2d1f('0x1e')]=_0x31bfee;if(_0x3b798b[_0x2d1f('0x2c')][_0x2d1f('0x3e')]){_0x1ee937[_0x2d1f('0x3f')]=[{'all':!![]}];}return db['Automation'][_0x2d1f('0x40')](_0x1ee937);})[_0x2d1f('0x3d')](function(_0x5853d6){_0x10be9b[_0x2d1f('0x41')]=_0x5853d6;return _0x10be9b;})[_0x2d1f('0x3d')](respondWithFilteredResult(_0x566ce1,_0x1ee937))[_0x2d1f('0x42')](handleError(_0x566ce1,null));};exports[_0x2d1f('0x43')]=function(_0x215d45,_0x44422a){var _0x3caad8={'raw':![],'where':{'id':_0x215d45['params']['id']}},_0x387075={};_0x387075[_0x2d1f('0x2b')]=_['keys'](db[_0x2d1f('0x44')][_0x2d1f('0x29')]);_0x387075[_0x2d1f('0x2c')]=_[_0x2d1f('0x2d')](_0x215d45[_0x2d1f('0x2c')]);_0x387075[_0x2d1f('0x2e')]=_['intersection'](_0x387075[_0x2d1f('0x2b')],_0x387075[_0x2d1f('0x2c')]);_0x3caad8[_0x2d1f('0x31')]=_[_0x2d1f('0x2f')](_0x387075[_0x2d1f('0x2b')],qs[_0x2d1f('0x30')](_0x215d45[_0x2d1f('0x2c')][_0x2d1f('0x30')]));_0x3caad8[_0x2d1f('0x31')]=_0x3caad8[_0x2d1f('0x31')][_0x2d1f('0x45')]?_0x3caad8[_0x2d1f('0x31')]:_0x387075[_0x2d1f('0x2b')];if(_0x215d45[_0x2d1f('0x2c')][_0x2d1f('0x3e')]){_0x3caad8[_0x2d1f('0x3f')]=[{'all':!![]}];}_0x3caad8=_[_0x2d1f('0x39')]({},_0x3caad8,_0x215d45[_0x2d1f('0x3c')]);return db[_0x2d1f('0x44')][_0x2d1f('0x46')](_0x3caad8)['then'](handleEntityNotFound(_0x44422a,null))[_0x2d1f('0x3d')](respondWithResult(_0x44422a,null))[_0x2d1f('0x42')](handleError(_0x44422a,null));};exports[_0x2d1f('0x47')]=function(_0x4d0536,_0x341d96){return db[_0x2d1f('0x44')][_0x2d1f('0x47')](_0x4d0536['body'],{})['then'](respondWithResult(_0x341d96,0xc9))[_0x2d1f('0x42')](handleError(_0x341d96,null));};exports[_0x2d1f('0x48')]=function(_0x535e98,_0x3fa093){if(_0x535e98[_0x2d1f('0x49')]['id']){delete _0x535e98['body']['id'];}return db[_0x2d1f('0x44')]['find']({'where':{'id':_0x535e98[_0x2d1f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3fa093,null))[_0x2d1f('0x3d')](saveUpdates(_0x535e98['body'],null))[_0x2d1f('0x3d')](respondWithResult(_0x3fa093,null))[_0x2d1f('0x42')](handleError(_0x3fa093,null));};exports['destroy']=function(_0x3165c4,_0x3194a2){return db[_0x2d1f('0x44')][_0x2d1f('0x46')]({'where':{'id':_0x3165c4[_0x2d1f('0x4a')]['id']}})[_0x2d1f('0x3d')](handleEntityNotFound(_0x3194a2,null))[_0x2d1f('0x3d')](removeEntity(_0x3194a2,null))[_0x2d1f('0x42')](handleError(_0x3194a2,null));};exports[_0x2d1f('0x4b')]=function(_0x406268,_0x2777f2,_0x299677){return db[_0x2d1f('0x4c')][_0x2d1f('0x46')]({'where':{'id':_0x406268[_0x2d1f('0x4a')]['id']}})[_0x2d1f('0x3d')](handleEntityNotFound(_0x2777f2,null))[_0x2d1f('0x3d')](function(_0x1878db){if(_0x1878db){return _0x1878db['addConditions'](_0x406268[_0x2d1f('0x49')][_0x2d1f('0x4d')],_[_0x2d1f('0x4e')](_0x406268[_0x2d1f('0x49')],[_0x2d1f('0x4d'),'id'])||{});}})[_0x2d1f('0x3d')](respondWithResult(_0x2777f2,null))[_0x2d1f('0x42')](handleError(_0x2777f2,null));};exports['getConditions']=function(_0x5ab22c,_0x5c27b7,_0x2f21a6){var _0x324c71={};var _0x5a2b96={};var _0x567396;var _0x235de5;return db[_0x2d1f('0x44')][_0x2d1f('0x4f')]({'where':{'id':_0x5ab22c['params']['id']}})['then'](handleEntityNotFound(_0x5c27b7,null))[_0x2d1f('0x3d')](function(_0x53ffbc){if(_0x53ffbc){_0x567396=_0x53ffbc;_0x5a2b96[_0x2d1f('0x2b')]=_[_0x2d1f('0x2d')](db[_0x2d1f('0x4c')][_0x2d1f('0x29')]);_0x5a2b96[_0x2d1f('0x2c')]=_[_0x2d1f('0x2d')](_0x5ab22c[_0x2d1f('0x2c')]);_0x5a2b96[_0x2d1f('0x2e')]=_['intersection'](_0x5a2b96['model'],_0x5a2b96['query']);_0x324c71[_0x2d1f('0x31')]=_['intersection'](_0x5a2b96[_0x2d1f('0x2b')],qs[_0x2d1f('0x30')](_0x5ab22c['query']['fields']));_0x324c71[_0x2d1f('0x31')]=_0x324c71['attributes'][_0x2d1f('0x45')]?_0x324c71[_0x2d1f('0x31')]:_0x5a2b96['model'];_0x324c71[_0x2d1f('0x34')]=qs[_0x2d1f('0x35')](_0x5ab22c[_0x2d1f('0x2c')][_0x2d1f('0x35')]);_0x324c71[_0x2d1f('0x36')]=qs['filters'](_[_0x2d1f('0x37')](_0x5ab22c[_0x2d1f('0x2c')],_0x5a2b96[_0x2d1f('0x2e')]));if(_0x5ab22c[_0x2d1f('0x2c')]['filter']){_0x324c71[_0x2d1f('0x36')]=_['merge'](_0x324c71[_0x2d1f('0x36')],{'$or':_['map'](_0x324c71[_0x2d1f('0x31')],function(_0x2a9f8d){var _0x355dbe={};_0x355dbe[_0x2a9f8d]={'$like':'%'+_0x5ab22c[_0x2d1f('0x2c')][_0x2d1f('0x38')]+'%'};return _0x355dbe;})});}_0x324c71=_['merge']({},_0x324c71,_0x5ab22c[_0x2d1f('0x3c')]);return _0x567396[_0x2d1f('0x50')](_0x324c71);}})['then'](function(_0x2cee56){if(_0x2cee56){_0x235de5=_0x2cee56[_0x2d1f('0x45')];if(!_0x5ab22c[_0x2d1f('0x2c')]['hasOwnProperty']('nolimit')){_0x324c71[_0x2d1f('0x1c')]=qs[_0x2d1f('0x1c')](_0x5ab22c['query'][_0x2d1f('0x1c')]);_0x324c71['offset']=qs['offset'](_0x5ab22c[_0x2d1f('0x2c')][_0x2d1f('0x1d')]);}return _0x567396[_0x2d1f('0x50')](_0x324c71);}})[_0x2d1f('0x3d')](function(_0x131a4c){if(_0x131a4c){return _0x131a4c?{'count':_0x235de5,'rows':_0x131a4c}:null;}})['then'](respondWithResult(_0x5c27b7,null))[_0x2d1f('0x42')](handleError(_0x5c27b7,null));};exports['addActions']=function(_0x2767ea,_0x2a6853,_0x247315){return db['Action'][_0x2d1f('0x46')]({'where':{'id':_0x2767ea['params']['id']}})['then'](handleEntityNotFound(_0x2a6853,null))['then'](function(_0x37b9bf){if(_0x37b9bf){return _0x37b9bf['addActions'](_0x2767ea['body'][_0x2d1f('0x4d')],_[_0x2d1f('0x4e')](_0x2767ea[_0x2d1f('0x49')],[_0x2d1f('0x4d'),'id'])||{});}})[_0x2d1f('0x3d')](respondWithResult(_0x2a6853,null))['catch'](handleError(_0x2a6853,null));};exports['getActions']=function(_0x1367a9,_0x27a508,_0x535950){var _0x48c5d9={};var _0x2323e6={};var _0x4a6966;var _0x28c242;return db['Automation']['findOne']({'where':{'id':_0x1367a9[_0x2d1f('0x4a')]['id']}})[_0x2d1f('0x3d')](handleEntityNotFound(_0x27a508,null))['then'](function(_0x3385f9){if(_0x3385f9){_0x4a6966=_0x3385f9;_0x2323e6[_0x2d1f('0x2b')]=_[_0x2d1f('0x2d')](db[_0x2d1f('0x51')]['rawAttributes']);_0x2323e6[_0x2d1f('0x2c')]=_[_0x2d1f('0x2d')](_0x1367a9[_0x2d1f('0x2c')]);_0x2323e6[_0x2d1f('0x2e')]=_['intersection'](_0x2323e6[_0x2d1f('0x2b')],_0x2323e6['query']);_0x48c5d9[_0x2d1f('0x31')]=_[_0x2d1f('0x2f')](_0x2323e6['model'],qs[_0x2d1f('0x30')](_0x1367a9[_0x2d1f('0x2c')][_0x2d1f('0x30')]));_0x48c5d9['attributes']=_0x48c5d9['attributes'][_0x2d1f('0x45')]?_0x48c5d9[_0x2d1f('0x31')]:_0x2323e6[_0x2d1f('0x2b')];_0x48c5d9['order']=qs[_0x2d1f('0x35')](_0x1367a9['query']['sort']);_0x48c5d9[_0x2d1f('0x36')]=qs[_0x2d1f('0x2e')](_[_0x2d1f('0x37')](_0x1367a9[_0x2d1f('0x2c')],_0x2323e6[_0x2d1f('0x2e')]));if(_0x1367a9['query'][_0x2d1f('0x38')]){_0x48c5d9[_0x2d1f('0x36')]=_[_0x2d1f('0x39')](_0x48c5d9[_0x2d1f('0x36')],{'$or':_[_0x2d1f('0x28')](_0x48c5d9['attributes'],function(_0x4ac1ee){var _0x82270c={};_0x82270c[_0x4ac1ee]={'$like':'%'+_0x1367a9[_0x2d1f('0x2c')][_0x2d1f('0x38')]+'%'};return _0x82270c;})});}_0x48c5d9=_[_0x2d1f('0x39')]({},_0x48c5d9,_0x1367a9['options']);return _0x4a6966[_0x2d1f('0x52')](_0x48c5d9);}})[_0x2d1f('0x3d')](function(_0x5d51ed){if(_0x5d51ed){_0x28c242=_0x5d51ed[_0x2d1f('0x45')];if(!_0x1367a9[_0x2d1f('0x2c')][_0x2d1f('0x32')](_0x2d1f('0x33'))){_0x48c5d9[_0x2d1f('0x1c')]=qs[_0x2d1f('0x1c')](_0x1367a9['query'][_0x2d1f('0x1c')]);_0x48c5d9[_0x2d1f('0x1d')]=qs[_0x2d1f('0x1d')](_0x1367a9[_0x2d1f('0x2c')][_0x2d1f('0x1d')]);}return _0x4a6966['getActions'](_0x48c5d9);}})[_0x2d1f('0x3d')](function(_0x52d24f){if(_0x52d24f){return _0x52d24f?{'count':_0x28c242,'rows':_0x52d24f}:null;}})['then'](respondWithResult(_0x27a508,null))[_0x2d1f('0x42')](handleError(_0x27a508,null));}; \ No newline at end of file +var _0x8654=['destroy','end','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','include','rows','catch','params','find','body','addConditions','ids','Condition','options','getConditions','hasOwnProperty','addActions','Action','omit','getActions','findOne','pick','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x8654,0xcf));var _0x4865=function(_0x4def94,_0x53665e){_0x4def94=_0x4def94-0x0;var _0x4b68c7=_0x8654[_0x4def94];return _0x4b68c7;};'use strict';var emlformat=require(_0x4865('0x0'));var rimraf=require(_0x4865('0x1'));var zipdir=require(_0x4865('0x2'));var jsonpatch=require(_0x4865('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4865('0x4'));var Mustache=require(_0x4865('0x5'));var util=require(_0x4865('0x6'));var path=require(_0x4865('0x7'));var sox=require(_0x4865('0x8'));var csv=require(_0x4865('0x9'));var ejs=require(_0x4865('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4865('0xb'));var squel=require('squel');var crypto=require(_0x4865('0xc'));var jsforce=require(_0x4865('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4865('0x9'));var querystring=require(_0x4865('0xe'));var Papa=require(_0x4865('0xf'));var Redis=require(_0x4865('0x10'));var authService=require(_0x4865('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4865('0x12'));var hardwareService=require(_0x4865('0x13'));var logger=require(_0x4865('0x14'))(_0x4865('0x15'));var utils=require(_0x4865('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4865('0x17'))['db'];function respondWithStatusCode(_0x744fb9,_0x1070dd){_0x1070dd=_0x1070dd||0xcc;return function(_0x5b9bf3){if(_0x5b9bf3){return _0x744fb9[_0x4865('0x18')](_0x1070dd);}return _0x744fb9['status'](_0x1070dd)['end']();};}function respondWithResult(_0x21de99,_0x5b3814){_0x5b3814=_0x5b3814||0xc8;return function(_0x5b056f){if(_0x5b056f){return _0x21de99[_0x4865('0x19')](_0x5b3814)[_0x4865('0x1a')](_0x5b056f);}};}function respondWithFilteredResult(_0x5680f7,_0x47419b){return function(_0x232b43){if(_0x232b43){var _0x32bd31=typeof _0x47419b[_0x4865('0x1b')]===_0x4865('0x1c')&&typeof _0x47419b[_0x4865('0x1d')]===_0x4865('0x1c');var _0x4b5a8f=_0x232b43[_0x4865('0x1e')];var _0x583f74=_0x32bd31?0x0:_0x47419b['offset'];var _0x4dfc65=_0x32bd31?_0x232b43[_0x4865('0x1e')]:_0x47419b[_0x4865('0x1b')]+_0x47419b[_0x4865('0x1d')];var _0x25b0de;if(_0x4dfc65>=_0x4b5a8f){_0x4dfc65=_0x4b5a8f;_0x25b0de=0xc8;}else{_0x25b0de=0xce;}_0x5680f7[_0x4865('0x19')](_0x25b0de);return _0x5680f7[_0x4865('0x1f')]('Content-Range',_0x583f74+'-'+_0x4dfc65+'/'+_0x4b5a8f)[_0x4865('0x1a')](_0x232b43);}return null;};}function patchUpdates(_0x3835ec){return function(_0x2608d5){try{jsonpatch['apply'](_0x2608d5,_0x3835ec,!![]);}catch(_0x4ad6a5){return BPromise[_0x4865('0x20')](_0x4ad6a5);}return _0x2608d5[_0x4865('0x21')]();};}function saveUpdates(_0x33c9fd,_0x14680e){return function(_0x1ac1b2){if(_0x1ac1b2){return _0x1ac1b2[_0x4865('0x22')](_0x33c9fd)[_0x4865('0x23')](function(_0x1c67e1){return _0x1c67e1;});}return null;};}function removeEntity(_0x2d80bf,_0x82e04e){return function(_0x1c8543){if(_0x1c8543){return _0x1c8543[_0x4865('0x24')]()['then'](function(){_0x2d80bf[_0x4865('0x19')](0xcc)[_0x4865('0x25')]();});}};}function handleEntityNotFound(_0x2b97f5,_0x460f6c){return function(_0x3269d5){if(!_0x3269d5){_0x2b97f5[_0x4865('0x18')](0x194);}return _0x3269d5;};}function handleError(_0x8571eb,_0x2d65e1){_0x2d65e1=_0x2d65e1||0x1f4;return function(_0x162b9b){logger[_0x4865('0x26')](_0x162b9b[_0x4865('0x27')]);if(_0x162b9b[_0x4865('0x28')]){delete _0x162b9b['name'];}_0x8571eb[_0x4865('0x19')](_0x2d65e1)[_0x4865('0x29')](_0x162b9b);};}exports[_0x4865('0x2a')]=function(_0x525813,_0x35147c){var _0x4975ad={},_0x24741a={},_0x1a2f84={'count':0x0,'rows':[]};var _0x510fef=_[_0x4865('0x2b')](db[_0x4865('0x2c')][_0x4865('0x2d')],function(_0x2c0864){return{'name':_0x2c0864[_0x4865('0x2e')],'type':_0x2c0864[_0x4865('0x2f')][_0x4865('0x30')]};});_0x24741a['model']=_['map'](_0x510fef,_0x4865('0x28'));_0x24741a['query']=_[_0x4865('0x31')](_0x525813[_0x4865('0x32')]);_0x24741a[_0x4865('0x33')]=_[_0x4865('0x34')](_0x24741a[_0x4865('0x35')],_0x24741a[_0x4865('0x32')]);_0x4975ad['attributes']=_[_0x4865('0x34')](_0x24741a['model'],qs[_0x4865('0x36')](_0x525813[_0x4865('0x32')][_0x4865('0x36')]));_0x4975ad[_0x4865('0x37')]=_0x4975ad[_0x4865('0x37')][_0x4865('0x38')]?_0x4975ad[_0x4865('0x37')]:_0x24741a['model'];if(!_0x525813[_0x4865('0x32')]['hasOwnProperty'](_0x4865('0x39'))){_0x4975ad[_0x4865('0x1d')]=qs[_0x4865('0x1d')](_0x525813['query'][_0x4865('0x1d')]);_0x4975ad[_0x4865('0x1b')]=qs[_0x4865('0x1b')](_0x525813['query'][_0x4865('0x1b')]);}_0x4975ad[_0x4865('0x3a')]=qs[_0x4865('0x3b')](_0x525813[_0x4865('0x32')][_0x4865('0x3b')]);_0x4975ad[_0x4865('0x3c')]=qs['filters'](_['pick'](_0x525813[_0x4865('0x32')],_0x24741a[_0x4865('0x33')]),_0x510fef);if(_0x525813[_0x4865('0x32')][_0x4865('0x3d')]){_0x4975ad['where']=_[_0x4865('0x3e')](_0x4975ad[_0x4865('0x3c')],{'$or':_[_0x4865('0x2b')](_0x510fef,function(_0x1d1df3){if(_0x1d1df3[_0x4865('0x2f')]!=='VIRTUAL'){var _0x538f11={};_0x538f11[_0x1d1df3[_0x4865('0x28')]]={'$like':'%'+_0x525813[_0x4865('0x32')][_0x4865('0x3d')]+'%'};return _0x538f11;}})});}_0x4975ad=_[_0x4865('0x3e')]({},_0x4975ad,_0x525813['options']);var _0xe7560c={'where':_0x4975ad[_0x4865('0x3c')]};return db[_0x4865('0x2c')][_0x4865('0x1e')](_0xe7560c)[_0x4865('0x23')](function(_0x346fc9){_0x1a2f84[_0x4865('0x1e')]=_0x346fc9;if(_0x525813[_0x4865('0x32')]['includeAll']){_0x4975ad[_0x4865('0x3f')]=[{'all':!![]}];}return db[_0x4865('0x2c')]['findAll'](_0x4975ad);})['then'](function(_0x17b91b){_0x1a2f84[_0x4865('0x40')]=_0x17b91b;return _0x1a2f84;})['then'](respondWithFilteredResult(_0x35147c,_0x4975ad))[_0x4865('0x41')](handleError(_0x35147c,null));};exports['show']=function(_0x663d0f,_0xdafd52){var _0x12fe77={'raw':![],'where':{'id':_0x663d0f[_0x4865('0x42')]['id']}},_0x69ceb1={};_0x69ceb1[_0x4865('0x35')]=_[_0x4865('0x31')](db[_0x4865('0x2c')]['rawAttributes']);_0x69ceb1[_0x4865('0x32')]=_['keys'](_0x663d0f[_0x4865('0x32')]);_0x69ceb1[_0x4865('0x33')]=_[_0x4865('0x34')](_0x69ceb1[_0x4865('0x35')],_0x69ceb1['query']);_0x12fe77[_0x4865('0x37')]=_[_0x4865('0x34')](_0x69ceb1['model'],qs[_0x4865('0x36')](_0x663d0f['query'][_0x4865('0x36')]));_0x12fe77[_0x4865('0x37')]=_0x12fe77[_0x4865('0x37')][_0x4865('0x38')]?_0x12fe77[_0x4865('0x37')]:_0x69ceb1['model'];if(_0x663d0f[_0x4865('0x32')]['includeAll']){_0x12fe77[_0x4865('0x3f')]=[{'all':!![]}];}_0x12fe77=_[_0x4865('0x3e')]({},_0x12fe77,_0x663d0f['options']);return db[_0x4865('0x2c')][_0x4865('0x43')](_0x12fe77)[_0x4865('0x23')](handleEntityNotFound(_0xdafd52,null))[_0x4865('0x23')](respondWithResult(_0xdafd52,null))[_0x4865('0x41')](handleError(_0xdafd52,null));};exports['create']=function(_0x515eac,_0x470e29){return db['Automation']['create'](_0x515eac['body'],{})[_0x4865('0x23')](respondWithResult(_0x470e29,0xc9))[_0x4865('0x41')](handleError(_0x470e29,null));};exports['update']=function(_0x30ccb5,_0x2b1b31){if(_0x30ccb5[_0x4865('0x44')]['id']){delete _0x30ccb5[_0x4865('0x44')]['id'];}return db['Automation'][_0x4865('0x43')]({'where':{'id':_0x30ccb5[_0x4865('0x42')]['id']}})['then'](handleEntityNotFound(_0x2b1b31,null))[_0x4865('0x23')](saveUpdates(_0x30ccb5[_0x4865('0x44')],null))[_0x4865('0x23')](respondWithResult(_0x2b1b31,null))[_0x4865('0x41')](handleError(_0x2b1b31,null));};exports[_0x4865('0x24')]=function(_0x43d23a,_0x2e2efb){return db[_0x4865('0x2c')]['find']({'where':{'id':_0x43d23a[_0x4865('0x42')]['id']}})[_0x4865('0x23')](handleEntityNotFound(_0x2e2efb,null))['then'](removeEntity(_0x2e2efb,null))[_0x4865('0x41')](handleError(_0x2e2efb,null));};exports[_0x4865('0x45')]=function(_0x19436b,_0x1cf5ed,_0x536114){return db['Condition'][_0x4865('0x43')]({'where':{'id':_0x19436b[_0x4865('0x42')]['id']}})['then'](handleEntityNotFound(_0x1cf5ed,null))[_0x4865('0x23')](function(_0x23a6d9){if(_0x23a6d9){return _0x23a6d9[_0x4865('0x45')](_0x19436b[_0x4865('0x44')][_0x4865('0x46')],_['omit'](_0x19436b[_0x4865('0x44')],[_0x4865('0x46'),'id'])||{});}})[_0x4865('0x23')](respondWithResult(_0x1cf5ed,null))[_0x4865('0x41')](handleError(_0x1cf5ed,null));};exports['getConditions']=function(_0x1f88b1,_0x1d0f93,_0xead82d){var _0x521c23={};var _0x1c6285={};var _0x505eb4;var _0x2f29f9;return db[_0x4865('0x2c')]['findOne']({'where':{'id':_0x1f88b1[_0x4865('0x42')]['id']}})[_0x4865('0x23')](handleEntityNotFound(_0x1d0f93,null))[_0x4865('0x23')](function(_0x1bc33e){if(_0x1bc33e){_0x505eb4=_0x1bc33e;_0x1c6285['model']=_[_0x4865('0x31')](db[_0x4865('0x47')][_0x4865('0x2d')]);_0x1c6285[_0x4865('0x32')]=_['keys'](_0x1f88b1[_0x4865('0x32')]);_0x1c6285[_0x4865('0x33')]=_[_0x4865('0x34')](_0x1c6285[_0x4865('0x35')],_0x1c6285[_0x4865('0x32')]);_0x521c23[_0x4865('0x37')]=_[_0x4865('0x34')](_0x1c6285[_0x4865('0x35')],qs[_0x4865('0x36')](_0x1f88b1[_0x4865('0x32')]['fields']));_0x521c23[_0x4865('0x37')]=_0x521c23[_0x4865('0x37')]['length']?_0x521c23[_0x4865('0x37')]:_0x1c6285[_0x4865('0x35')];_0x521c23[_0x4865('0x3a')]=qs[_0x4865('0x3b')](_0x1f88b1[_0x4865('0x32')][_0x4865('0x3b')]);_0x521c23['where']=qs[_0x4865('0x33')](_['pick'](_0x1f88b1[_0x4865('0x32')],_0x1c6285[_0x4865('0x33')]));if(_0x1f88b1[_0x4865('0x32')][_0x4865('0x3d')]){_0x521c23[_0x4865('0x3c')]=_[_0x4865('0x3e')](_0x521c23['where'],{'$or':_[_0x4865('0x2b')](_0x521c23[_0x4865('0x37')],function(_0x80e740){var _0x1fd0b7={};_0x1fd0b7[_0x80e740]={'$like':'%'+_0x1f88b1[_0x4865('0x32')]['filter']+'%'};return _0x1fd0b7;})});}_0x521c23=_['merge']({},_0x521c23,_0x1f88b1[_0x4865('0x48')]);return _0x505eb4[_0x4865('0x49')](_0x521c23);}})['then'](function(_0x4fd0a3){if(_0x4fd0a3){_0x2f29f9=_0x4fd0a3['length'];if(!_0x1f88b1['query'][_0x4865('0x4a')]('nolimit')){_0x521c23[_0x4865('0x1d')]=qs[_0x4865('0x1d')](_0x1f88b1[_0x4865('0x32')][_0x4865('0x1d')]);_0x521c23[_0x4865('0x1b')]=qs['offset'](_0x1f88b1[_0x4865('0x32')][_0x4865('0x1b')]);}return _0x505eb4[_0x4865('0x49')](_0x521c23);}})[_0x4865('0x23')](function(_0x10b045){if(_0x10b045){return _0x10b045?{'count':_0x2f29f9,'rows':_0x10b045}:null;}})[_0x4865('0x23')](respondWithResult(_0x1d0f93,null))[_0x4865('0x41')](handleError(_0x1d0f93,null));};exports[_0x4865('0x4b')]=function(_0x4984bf,_0x585dd,_0x44275f){return db[_0x4865('0x4c')][_0x4865('0x43')]({'where':{'id':_0x4984bf['params']['id']}})['then'](handleEntityNotFound(_0x585dd,null))['then'](function(_0x4b99a9){if(_0x4b99a9){return _0x4b99a9['addActions'](_0x4984bf[_0x4865('0x44')]['ids'],_[_0x4865('0x4d')](_0x4984bf['body'],[_0x4865('0x46'),'id'])||{});}})[_0x4865('0x23')](respondWithResult(_0x585dd,null))['catch'](handleError(_0x585dd,null));};exports[_0x4865('0x4e')]=function(_0x50d78,_0x2830bb,_0x2b670c){var _0x26fac8={};var _0x20011f={};var _0x5f2b4a;var _0x2347bd;return db[_0x4865('0x2c')][_0x4865('0x4f')]({'where':{'id':_0x50d78[_0x4865('0x42')]['id']}})[_0x4865('0x23')](handleEntityNotFound(_0x2830bb,null))[_0x4865('0x23')](function(_0xdb514b){if(_0xdb514b){_0x5f2b4a=_0xdb514b;_0x20011f[_0x4865('0x35')]=_[_0x4865('0x31')](db[_0x4865('0x4c')][_0x4865('0x2d')]);_0x20011f['query']=_[_0x4865('0x31')](_0x50d78[_0x4865('0x32')]);_0x20011f[_0x4865('0x33')]=_[_0x4865('0x34')](_0x20011f['model'],_0x20011f[_0x4865('0x32')]);_0x26fac8['attributes']=_[_0x4865('0x34')](_0x20011f[_0x4865('0x35')],qs[_0x4865('0x36')](_0x50d78[_0x4865('0x32')][_0x4865('0x36')]));_0x26fac8[_0x4865('0x37')]=_0x26fac8['attributes'][_0x4865('0x38')]?_0x26fac8[_0x4865('0x37')]:_0x20011f['model'];_0x26fac8[_0x4865('0x3a')]=qs[_0x4865('0x3b')](_0x50d78[_0x4865('0x32')]['sort']);_0x26fac8[_0x4865('0x3c')]=qs[_0x4865('0x33')](_[_0x4865('0x50')](_0x50d78[_0x4865('0x32')],_0x20011f[_0x4865('0x33')]));if(_0x50d78[_0x4865('0x32')][_0x4865('0x3d')]){_0x26fac8[_0x4865('0x3c')]=_['merge'](_0x26fac8[_0x4865('0x3c')],{'$or':_['map'](_0x26fac8[_0x4865('0x37')],function(_0x4ecf86){var _0xf42094={};_0xf42094[_0x4ecf86]={'$like':'%'+_0x50d78[_0x4865('0x32')][_0x4865('0x3d')]+'%'};return _0xf42094;})});}_0x26fac8=_[_0x4865('0x3e')]({},_0x26fac8,_0x50d78[_0x4865('0x48')]);return _0x5f2b4a[_0x4865('0x4e')](_0x26fac8);}})[_0x4865('0x23')](function(_0x16fc7d){if(_0x16fc7d){_0x2347bd=_0x16fc7d[_0x4865('0x38')];if(!_0x50d78['query'][_0x4865('0x4a')](_0x4865('0x39'))){_0x26fac8[_0x4865('0x1d')]=qs[_0x4865('0x1d')](_0x50d78[_0x4865('0x32')][_0x4865('0x1d')]);_0x26fac8['offset']=qs[_0x4865('0x1b')](_0x50d78[_0x4865('0x32')][_0x4865('0x1b')]);}return _0x5f2b4a[_0x4865('0x4e')](_0x26fac8);}})['then'](function(_0x411d93){if(_0x411d93){return _0x411d93?{'count':_0x2347bd,'rows':_0x411d93}:null;}})[_0x4865('0x23')](respondWithResult(_0x2830bb,null))['catch'](handleError(_0x2830bb,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 612e3a3..9782bf6 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 _0xa45c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','util','api'];(function(_0x32ae4e,_0x1dd4b0){var _0x1084a7=function(_0x50c403){while(--_0x50c403){_0x32ae4e['push'](_0x32ae4e['shift']());}};_0x1084a7(++_0x1dd4b0);}(_0xa45c,0xb4));var _0xca45=function(_0x580955,_0x1ad93f){_0x580955=_0x580955-0x0;var _0x1c727f=_0xa45c[_0x580955];return _0x1c727f;};'use strict';var _=require('lodash');var util=require(_0xca45('0x0'));var logger=require('../../config/logger')(_0xca45('0x1'));var moment=require(_0xca45('0x2'));var BPromise=require(_0xca45('0x3'));var rp=require(_0xca45('0x4'));var fs=require('fs');var path=require(_0xca45('0x5'));var rimraf=require(_0xca45('0x6'));var config=require(_0xca45('0x7'));var attributes=require(_0xca45('0x8'));module[_0xca45('0x9')]=function(_0x435859,_0x45ca44){return _0x435859[_0xca45('0xa')](_0xca45('0xb'),attributes,{'tableName':_0xca45('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4ab=['../../config/environment','./automation.attributes','exports','define','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x54a4b4,_0x596ffa){var _0x2dd6ba=function(_0x3cc84c){while(--_0x3cc84c){_0x54a4b4['push'](_0x54a4b4['shift']());}};_0x2dd6ba(++_0x596ffa);}(_0xf4ab,0x17f));var _0xbf4a=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xf4ab[_0x59c301];return _0x3866b9;};'use strict';var _=require(_0xbf4a('0x0'));var util=require(_0xbf4a('0x1'));var logger=require(_0xbf4a('0x2'))(_0xbf4a('0x3'));var moment=require(_0xbf4a('0x4'));var BPromise=require(_0xbf4a('0x5'));var rp=require(_0xbf4a('0x6'));var fs=require('fs');var path=require(_0xbf4a('0x7'));var rimraf=require(_0xbf4a('0x8'));var config=require(_0xbf4a('0x9'));var attributes=require(_0xbf4a('0xa'));module[_0xbf4a('0xb')]=function(_0x35fb88,_0x45778f){return _0x35fb88[_0xbf4a('0xc')]('Automation',attributes,{'tableName':_0xbf4a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 2cac947..453117f 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 _0xb6da=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0xff3f4a,_0x50f3b4){var _0x13db8a=function(_0x41d3c6){while(--_0x41d3c6){_0xff3f4a['push'](_0xff3f4a['shift']());}};_0x13db8a(++_0x50f3b4);}(_0xb6da,0x8e));var _0xab6d=function(_0x58ddb5,_0x16e1f7){_0x58ddb5=_0x58ddb5-0x0;var _0xc2a5bf=_0xb6da[_0x58ddb5];return _0xc2a5bf;};'use strict';var _=require(_0xab6d('0x0'));var util=require('util');var moment=require(_0xab6d('0x1'));var BPromise=require(_0xab6d('0x2'));var rs=require(_0xab6d('0x3'));var fs=require('fs');var Redis=require(_0xab6d('0x4'));var db=require(_0xab6d('0x5'))['db'];var utils=require(_0xab6d('0x6'));var logger=require(_0xab6d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xab6d('0x8'));var client=jayson[_0xab6d('0x9')][_0xab6d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x130285,_0x359bef,_0x44d5fa){return new BPromise(function(_0x4ba0f7,_0x2e30f1){return client['request'](_0x130285,_0x44d5fa)[_0xab6d('0xb')](function(_0x590cfa){logger['info'](_0xab6d('0xc'),_0x359bef,_0xab6d('0xd'));logger['debug'](_0xab6d('0xe'),_0x359bef,'request\x20sent',JSON['stringify'](_0x590cfa));if(_0x590cfa[_0xab6d('0xf')]){if(_0x590cfa[_0xab6d('0xf')][_0xab6d('0x10')]===0x1f4){logger[_0xab6d('0xf')](_0xab6d('0xc'),_0x359bef,_0x590cfa[_0xab6d('0xf')][_0xab6d('0x11')]);return _0x2e30f1(_0x590cfa[_0xab6d('0xf')]['message']);}logger[_0xab6d('0xf')](_0xab6d('0xc'),_0x359bef,_0x590cfa[_0xab6d('0xf')][_0xab6d('0x11')]);return _0x4ba0f7(_0x590cfa[_0xab6d('0xf')][_0xab6d('0x11')]);}else{logger['info'](_0xab6d('0xc'),_0x359bef,_0xab6d('0xd'));_0x4ba0f7(_0x590cfa[_0xab6d('0x12')]['message']);}})[_0xab6d('0x13')](function(_0x3bd40a){logger[_0xab6d('0xf')](_0xab6d('0xc'),_0x359bef,_0x3bd40a);_0x2e30f1(_0x3bd40a);});});} \ No newline at end of file +var _0xc5df=['message','result','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x58dbe8,_0x3567dc){var _0x568dd1=function(_0x2c73c7){while(--_0x2c73c7){_0x58dbe8['push'](_0x58dbe8['shift']());}};_0x568dd1(++_0x3567dc);}(_0xc5df,0x80));var _0xfc5d=function(_0x25fe3e,_0x19b2a4){_0x25fe3e=_0x25fe3e-0x0;var _0xe9ba2a=_0xc5df[_0x25fe3e];return _0xe9ba2a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfc5d('0x0'));var BPromise=require(_0xfc5d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc5d('0x2'))['db'];var utils=require(_0xfc5d('0x3'));var logger=require(_0xfc5d('0x4'))(_0xfc5d('0x5'));var config=require(_0xfc5d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfc5d('0x7')][_0xfc5d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b8b10,_0x535aa7,_0x2a38ce){return new BPromise(function(_0x240ba0,_0x522712){return client[_0xfc5d('0x9')](_0x1b8b10,_0x2a38ce)[_0xfc5d('0xa')](function(_0x4f9a05){logger[_0xfc5d('0xb')](_0xfc5d('0xc'),_0x535aa7,'request\x20sent');logger[_0xfc5d('0xd')](_0xfc5d('0xe'),_0x535aa7,_0xfc5d('0xf'),JSON[_0xfc5d('0x10')](_0x4f9a05));if(_0x4f9a05['error']){if(_0x4f9a05[_0xfc5d('0x11')][_0xfc5d('0x12')]===0x1f4){logger[_0xfc5d('0x11')]('Automation,\x20%s,\x20%s',_0x535aa7,_0x4f9a05[_0xfc5d('0x11')][_0xfc5d('0x13')]);return _0x522712(_0x4f9a05['error'][_0xfc5d('0x13')]);}logger['error'](_0xfc5d('0xc'),_0x535aa7,_0x4f9a05['error'][_0xfc5d('0x13')]);return _0x240ba0(_0x4f9a05[_0xfc5d('0x11')][_0xfc5d('0x13')]);}else{logger[_0xfc5d('0xb')](_0xfc5d('0xc'),_0x535aa7,'request\x20sent');_0x240ba0(_0x4f9a05[_0xfc5d('0x14')][_0xfc5d('0x13')]);}})['catch'](function(_0x26f84a){logger['error'](_0xfc5d('0xc'),_0x535aa7,_0x26f84a);_0x522712(_0x26f84a);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 195ec19..edcf57e 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 _0xac5c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','/:id/conditions','getConditions','getActions','post','create','addActions','put','destroy','exports','multer','util'];(function(_0x2b5ae7,_0x4cf577){var _0x43faff=function(_0x2c6eff){while(--_0x2c6eff){_0x2b5ae7['push'](_0x2b5ae7['shift']());}};_0x43faff(++_0x4cf577);}(_0xac5c,0x10f));var _0xcac5=function(_0x225ff0,_0x152ece){_0x225ff0=_0x225ff0-0x0;var _0x497f5d=_0xac5c[_0x225ff0];return _0x497f5d;};'use strict';var multer=require(_0xcac5('0x0'));var util=require(_0xcac5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcac5('0x2'));var router=express[_0xcac5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcac5('0x4'));var interaction=require(_0xcac5('0x5'));var config=require(_0xcac5('0x6'));var controller=require(_0xcac5('0x7'));router[_0xcac5('0x8')]('/',auth[_0xcac5('0x9')](),controller[_0xcac5('0xa')]);router['get'](_0xcac5('0xb'),auth[_0xcac5('0x9')](),controller['show']);router[_0xcac5('0x8')](_0xcac5('0xc'),auth[_0xcac5('0x9')](),controller[_0xcac5('0xd')]);router[_0xcac5('0x8')]('/:id/actions',auth[_0xcac5('0x9')](),controller[_0xcac5('0xe')]);router[_0xcac5('0xf')]('/',auth[_0xcac5('0x9')](),controller[_0xcac5('0x10')]);router['post'](_0xcac5('0xc'),auth[_0xcac5('0x9')](),controller['addConditions']);router[_0xcac5('0xf')]('/:id/actions',auth['isAuthenticated'](),controller[_0xcac5('0x11')]);router[_0xcac5('0x12')](_0xcac5('0xb'),auth[_0xcac5('0x9')](),controller['update']);router['delete'](_0xcac5('0xb'),auth['isAuthenticated'](),controller[_0xcac5('0x13')]);module[_0xcac5('0x14')]=router; \ No newline at end of file +var _0xcb18=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','index','isAuthenticated','/:id/conditions','getConditions','/:id/actions','getActions','create','post','addConditions','addActions','/:id','update','delete','destroy','exports'];(function(_0x387061,_0x1117e0){var _0x12eb30=function(_0x3932e7){while(--_0x3932e7){_0x387061['push'](_0x387061['shift']());}};_0x12eb30(++_0x1117e0);}(_0xcb18,0x159));var _0x8cb1=function(_0x1e96bb,_0x181481){_0x1e96bb=_0x1e96bb-0x0;var _0x4e03da=_0xcb18[_0x1e96bb];return _0x4e03da;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8cb1('0x0'));var timeout=require('connect-timeout');var express=require(_0x8cb1('0x1'));var router=express['Router']();var fs_extra=require(_0x8cb1('0x2'));var auth=require(_0x8cb1('0x3'));var interaction=require(_0x8cb1('0x4'));var config=require(_0x8cb1('0x5'));var controller=require(_0x8cb1('0x6'));router[_0x8cb1('0x7')]('/',auth['isAuthenticated'](),controller[_0x8cb1('0x8')]);router[_0x8cb1('0x7')]('/:id',auth[_0x8cb1('0x9')](),controller['show']);router[_0x8cb1('0x7')](_0x8cb1('0xa'),auth['isAuthenticated'](),controller[_0x8cb1('0xb')]);router[_0x8cb1('0x7')](_0x8cb1('0xc'),auth[_0x8cb1('0x9')](),controller[_0x8cb1('0xd')]);router['post']('/',auth[_0x8cb1('0x9')](),controller[_0x8cb1('0xe')]);router[_0x8cb1('0xf')]('/:id/conditions',auth[_0x8cb1('0x9')](),controller[_0x8cb1('0x10')]);router[_0x8cb1('0xf')](_0x8cb1('0xc'),auth[_0x8cb1('0x9')](),controller[_0x8cb1('0x11')]);router['put'](_0x8cb1('0x12'),auth['isAuthenticated'](),controller[_0x8cb1('0x13')]);router[_0x8cb1('0x14')](_0x8cb1('0x12'),auth[_0x8cb1('0x9')](),controller[_0x8cb1('0x15')]);module[_0x8cb1('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index a6c4bac..de45cb3 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 _0xd75d=['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)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\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','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0x2a5dbd,_0x8f6f0d){var _0x167312=function(_0x2c5481){while(--_0x2c5481){_0x2a5dbd['push'](_0x2a5dbd['shift']());}};_0x167312(++_0x8f6f0d);}(_0xd75d,0x185));var _0xdd75=function(_0x18550b,_0x75f16a){_0x18550b=_0x18550b-0x0;var _0xa07369=_0xd75d[_0x18550b];return _0xa07369;};'use strict';var Sequelize=require(_0xdd75('0x0'));module[_0xdd75('0x1')]={'name':{'type':Sequelize[_0xdd75('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xdd75('0x3')](_0xdd75('0x4')),'allowNull':![],'defaultValue':_0xdd75('0x4')},'description':{'type':Sequelize[_0xdd75('0x2')]},'active':{'type':Sequelize[_0xdd75('0x5')],'defaultValue':0x0,'comment':_0xdd75('0x6')},'limitCalls':{'type':Sequelize[_0xdd75('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xdd75('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xdd75('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xdd75('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xdd75('0x7')](0x3)[_0xdd75('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd75('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdd75('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdd75('0x7')](0x5)[_0xdd75('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdd75('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xdd75('0x7')](0x5)[_0xdd75('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xdd75('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xdd75('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xdd75('0x7')](0x5)[_0xdd75('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd75('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xdd75('0x7')](0x3)[_0xdd75('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xdd75('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xdd75('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xdd75('0x3')](_0xdd75('0xf'),'never','onlyIfOpen'),'defaultValue':_0xdd75('0xf')},'dialAMDActive':{'type':Sequelize[_0xdd75('0x5')],'defaultValue':0x0,'comment':_0xdd75('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0xdd75('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xdd75('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xdd75('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xdd75('0x7')](0x9)[_0xdd75('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xdd75('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xdd75('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdd75('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0xdd75('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdd75('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xdd75('0x7')](0x9)[_0xdd75('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xdd75('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xdd75('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xdd75('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xdd75('0x7')](0x9)[_0xdd75('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdd75('0x17')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0xdd75('0x18')),'defaultValue':_0xdd75('0x19')},'dialPrefix':{'type':Sequelize[_0xdd75('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xdd75('0x7')](0x3)[_0xdd75('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdd75('0x1a')},'dialCutDigit':{'type':Sequelize[_0xdd75('0x7')](0x3)[_0xdd75('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xdd75('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdd75('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdd75('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xdd75('0x7')](0x5)[_0xdd75('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd75('0x1b')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xdd75('0x7')](0x3)[_0xdd75('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd75('0x1c')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdd75('0x7')](0x5)[_0xdd75('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd75('0x1d')},'dialMachineMaxRetry':{'type':Sequelize[_0xdd75('0x7')](0x3)[_0xdd75('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd75('0x1e')},'dialMachineRetryFrequency':{'type':Sequelize[_0xdd75('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xdd75('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xdd75('0x7')](0x5)[_0xdd75('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd75('0x1f')}}; \ No newline at end of file +var _0x9f9d=['#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','ENUM','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','#AMD\x20Greeting'];(function(_0x2d7ec9,_0x52833e){var _0x199c90=function(_0x584caa){while(--_0x584caa){_0x2d7ec9['push'](_0x2d7ec9['shift']());}};_0x199c90(++_0x52833e);}(_0x9f9d,0x1c2));var _0xd9f9=function(_0x2282a8,_0x3cea15){_0x2282a8=_0x2282a8-0x0;var _0xa9acf2=_0x9f9d[_0x2282a8];return _0xa9acf2;};'use strict';var Sequelize=require(_0xd9f9('0x0'));module['exports']={'name':{'type':Sequelize[_0xd9f9('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd9f9('0x2')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xd9f9('0x1')]},'active':{'type':Sequelize[_0xd9f9('0x3')],'defaultValue':0x0,'comment':_0xd9f9('0x4')},'limitCalls':{'type':Sequelize[_0xd9f9('0x5')](0x4)[_0xd9f9('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd9f9('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd9f9('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd9f9('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xd9f9('0x5')](0x3)[_0xd9f9('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd9f9('0x8')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd9f9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd9f9('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd9f9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd9f9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd9f9('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0xd9f9('0x5')](0x5)[_0xd9f9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd9f9('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd9f9('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xd9f9('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd9f9('0x5')](0x5)[_0xd9f9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd9f9('0xd')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd9f9('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xd9f9('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xd9f9('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xd9f9('0x2')](_0xd9f9('0xf'),_0xd9f9('0x10'),'onlyIfOpen'),'defaultValue':_0xd9f9('0xf')},'dialAMDActive':{'type':Sequelize[_0xd9f9('0x3')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xd9f9('0x5')](0x9)[_0xd9f9('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xd9f9('0x5')](0x9)[_0xd9f9('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd9f9('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd9f9('0x5')](0x9)[_0xd9f9('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd9f9('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd9f9('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd9f9('0x13')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xd9f9('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd9f9('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd9f9('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd9f9('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd9f9('0x5')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd9f9('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd9f9('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd9f9('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd9f9('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd9f9('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd9f9('0x2')]('DESC',_0xd9f9('0x19')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xd9f9('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd9f9('0x1a')},'dialCutDigit':{'type':Sequelize[_0xd9f9('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd9f9('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd9f9('0x5')](0x3)[_0xd9f9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd9f9('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd9f9('0x5')](0x5)[_0xd9f9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd9f9('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0xd9f9('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd9f9('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0xd9f9('0x5')](0x5)[_0xd9f9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd9f9('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd9f9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd9f9('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd9f9('0x5')](0x5)[_0xd9f9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd9f9('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0xd9f9('0x5')](0x3)[_0xd9f9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xd9f9('0x5')](0x5)[_0xd9f9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd9f9('0x5')](0x3)[_0xd9f9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd9f9('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd9f9('0x5')](0x5)[_0xd9f9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd9f9('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 38d869f..2c06374 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 _0x959e=['fromQuery','scheduledAt','ContactId','ListId','select','field','phone','NOW()','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','deletedAt\x20IS\x20NULL','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','save','update','IvrCampaigns','UserProfileResource','then','stack','name','send','index','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','destroy','getHoppers','findOne','CmHopper','nolimit','pick','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','into'];(function(_0x5d96ee,_0x523278){var _0x39092b=function(_0x4ae30b){while(--_0x4ae30b){_0x5d96ee['push'](_0x5d96ee['shift']());}};_0x39092b(++_0x523278);}(_0x959e,0x1e2));var _0xe959=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x959e[_0xa60623];return _0x4a6487;};'use strict';var emlformat=require(_0xe959('0x0'));var rimraf=require(_0xe959('0x1'));var zipdir=require(_0xe959('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe959('0x3'));var moment=require(_0xe959('0x4'));var BPromise=require(_0xe959('0x5'));var Mustache=require(_0xe959('0x6'));var util=require(_0xe959('0x7'));var path=require(_0xe959('0x8'));var sox=require('sox');var csv=require(_0xe959('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe959('0xa'));var _=require(_0xe959('0xb'));var squel=require(_0xe959('0xc'));var crypto=require(_0xe959('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe959('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe959('0xe'));var authService=require(_0xe959('0xf'));var qs=require(_0xe959('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe959('0x11'));var logger=require(_0xe959('0x12'))(_0xe959('0x13'));var utils=require('../../config/utils');var config=require(_0xe959('0x14'));var licenseUtil=require(_0xe959('0x15'));var db=require(_0xe959('0x16'))['db'];function respondWithStatusCode(_0x3deca7,_0x1fa963){_0x1fa963=_0x1fa963||0xcc;return function(_0x5c7a12){if(_0x5c7a12){return _0x3deca7[_0xe959('0x17')](_0x1fa963);}return _0x3deca7['status'](_0x1fa963)[_0xe959('0x18')]();};}function respondWithResult(_0x5bd09e,_0x468f60){_0x468f60=_0x468f60||0xc8;return function(_0x2e68f7){if(_0x2e68f7){return _0x5bd09e[_0xe959('0x19')](_0x468f60)[_0xe959('0x1a')](_0x2e68f7);}};}function respondWithFilteredResult(_0x16a8da,_0x3bd45f){return function(_0x16835a){if(_0x16835a){var _0x48cc78=typeof _0x3bd45f['offset']==='undefined'&&typeof _0x3bd45f[_0xe959('0x1b')]==='undefined';var _0x26d496=_0x16835a[_0xe959('0x1c')];var _0x432c38=_0x48cc78?0x0:_0x3bd45f['offset'];var _0x326c4f=_0x48cc78?_0x16835a[_0xe959('0x1c')]:_0x3bd45f[_0xe959('0x1d')]+_0x3bd45f['limit'];var _0x7cd26d;if(_0x326c4f>=_0x26d496){_0x326c4f=_0x26d496;_0x7cd26d=0xc8;}else{_0x7cd26d=0xce;}_0x16a8da['status'](_0x7cd26d);return _0x16a8da[_0xe959('0x1e')](_0xe959('0x1f'),_0x432c38+'-'+_0x326c4f+'/'+_0x26d496)[_0xe959('0x1a')](_0x16835a);}return null;};}function patchUpdates(_0x40171c){return function(_0x4ad6ac){try{jsonpatch[_0xe959('0x20')](_0x4ad6ac,_0x40171c,!![]);}catch(_0x53cfcb){return BPromise['reject'](_0x53cfcb);}return _0x4ad6ac[_0xe959('0x21')]();};}function saveUpdates(_0x59ac7e,_0x5521e9){return function(_0x1bbf4f){if(_0x1bbf4f){return _0x1bbf4f[_0xe959('0x22')](_0x59ac7e)['then'](function(_0x34af4a){return _0x34af4a;});}return null;};}function removeEntity(_0x37f638,_0x5e2dda){return function(_0x4a0739){if(_0x4a0739){return _0x4a0739['destroy']()['then'](function(){var _0xbe0c93=_0x4a0739['get']({'plain':!![]});var _0x1a1cd9=_0xe959('0x23');return db[_0xe959('0x24')]['destroy']({'where':{'type':_0x1a1cd9,'resourceId':_0xbe0c93['id']}})[_0xe959('0x25')](function(){return _0x4a0739;});})[_0xe959('0x25')](function(){_0x37f638[_0xe959('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf5e0ed,_0x1cc676){return function(_0x2a39ad){if(!_0x2a39ad){_0xf5e0ed[_0xe959('0x17')](0x194);}return _0x2a39ad;};}function handleError(_0xbd3635,_0x14a521){_0x14a521=_0x14a521||0x1f4;return function(_0x562d76){logger['error'](_0x562d76[_0xe959('0x26')]);if(_0x562d76[_0xe959('0x27')]){delete _0x562d76[_0xe959('0x27')];}_0xbd3635['status'](_0x14a521)[_0xe959('0x28')](_0x562d76);};}exports[_0xe959('0x29')]=function(_0x6ba7a9,_0x147442){var _0x3eba7c={},_0x570cc1={},_0x55f000={'count':0x0,'rows':[]};var _0x2e1a73=_['map'](db[_0xe959('0x2a')][_0xe959('0x2b')],function(_0x1341c4){return{'name':_0x1341c4[_0xe959('0x2c')],'type':_0x1341c4[_0xe959('0x2d')][_0xe959('0x2e')]};});_0x570cc1[_0xe959('0x2f')]=_['map'](_0x2e1a73,'name');_0x570cc1[_0xe959('0x30')]=_[_0xe959('0x31')](_0x6ba7a9[_0xe959('0x30')]);_0x570cc1[_0xe959('0x32')]=_[_0xe959('0x33')](_0x570cc1[_0xe959('0x2f')],_0x570cc1[_0xe959('0x30')]);_0x3eba7c[_0xe959('0x34')]=_[_0xe959('0x33')](_0x570cc1['model'],qs[_0xe959('0x35')](_0x6ba7a9['query'][_0xe959('0x35')]));_0x3eba7c[_0xe959('0x34')]=_0x3eba7c['attributes'][_0xe959('0x36')]?_0x3eba7c[_0xe959('0x34')]:_0x570cc1[_0xe959('0x2f')];if(!_0x6ba7a9[_0xe959('0x30')][_0xe959('0x37')]('nolimit')){_0x3eba7c[_0xe959('0x1b')]=qs[_0xe959('0x1b')](_0x6ba7a9[_0xe959('0x30')]['limit']);_0x3eba7c['offset']=qs[_0xe959('0x1d')](_0x6ba7a9[_0xe959('0x30')][_0xe959('0x1d')]);}_0x3eba7c[_0xe959('0x38')]=qs[_0xe959('0x39')](_0x6ba7a9[_0xe959('0x30')][_0xe959('0x39')]);_0x3eba7c[_0xe959('0x3a')]=qs[_0xe959('0x32')](_['pick'](_0x6ba7a9[_0xe959('0x30')],_0x570cc1[_0xe959('0x32')]),_0x2e1a73);if(_0x6ba7a9[_0xe959('0x30')][_0xe959('0x3b')]){_0x3eba7c[_0xe959('0x3a')]=_[_0xe959('0x3c')](_0x3eba7c['where'],{'$or':_[_0xe959('0x3d')](_0x2e1a73,function(_0x4db9e5){if(_0x4db9e5[_0xe959('0x2d')]!==_0xe959('0x3e')){var _0x1af15b={};_0x1af15b[_0x4db9e5['name']]={'$like':'%'+_0x6ba7a9[_0xe959('0x30')][_0xe959('0x3b')]+'%'};return _0x1af15b;}})});}_0x3eba7c=_['merge']({},_0x3eba7c,_0x6ba7a9[_0xe959('0x3f')]);var _0x4e9310={'where':_0x3eba7c[_0xe959('0x3a')]};return db[_0xe959('0x2a')][_0xe959('0x1c')](_0x4e9310)['then'](function(_0x25ebe8){_0x55f000[_0xe959('0x1c')]=_0x25ebe8;if(_0x6ba7a9[_0xe959('0x30')][_0xe959('0x40')]){_0x3eba7c[_0xe959('0x41')]=[{'all':!![]}];}return db[_0xe959('0x2a')][_0xe959('0x42')](_0x3eba7c);})[_0xe959('0x25')](function(_0x813fe7){_0x55f000['rows']=_0x813fe7;return _0x55f000;})['then'](respondWithFilteredResult(_0x147442,_0x3eba7c))[_0xe959('0x43')](handleError(_0x147442,null));};exports[_0xe959('0x44')]=function(_0x475bdc,_0x20ea89){var _0x2ee38b={'raw':![],'where':{'id':_0x475bdc[_0xe959('0x45')]['id']}},_0x1d5cb6={};_0x1d5cb6[_0xe959('0x2f')]=_[_0xe959('0x31')](db[_0xe959('0x2a')][_0xe959('0x2b')]);_0x1d5cb6[_0xe959('0x30')]=_[_0xe959('0x31')](_0x475bdc['query']);_0x1d5cb6[_0xe959('0x32')]=_[_0xe959('0x33')](_0x1d5cb6[_0xe959('0x2f')],_0x1d5cb6[_0xe959('0x30')]);_0x2ee38b[_0xe959('0x34')]=_['intersection'](_0x1d5cb6['model'],qs['fields'](_0x475bdc[_0xe959('0x30')][_0xe959('0x35')]));_0x2ee38b[_0xe959('0x34')]=_0x2ee38b[_0xe959('0x34')][_0xe959('0x36')]?_0x2ee38b[_0xe959('0x34')]:_0x1d5cb6[_0xe959('0x2f')];if(_0x475bdc[_0xe959('0x30')][_0xe959('0x40')]){_0x2ee38b[_0xe959('0x41')]=[{'all':!![]}];}_0x2ee38b=_[_0xe959('0x3c')]({},_0x2ee38b,_0x475bdc['options']);return db[_0xe959('0x2a')]['find'](_0x2ee38b)['then'](handleEntityNotFound(_0x20ea89,null))[_0xe959('0x25')](respondWithResult(_0x20ea89,null))['catch'](handleError(_0x20ea89,null));};exports[_0xe959('0x46')]=function(_0x3ef0cc,_0x4bd6de){return db[_0xe959('0x2a')][_0xe959('0x46')](_0x3ef0cc[_0xe959('0x47')],{})[_0xe959('0x25')](function(_0x53a733){var _0x2b23af=_0x3ef0cc['user'][_0xe959('0x48')]({'plain':!![]});if(!_0x2b23af)throw new Error(_0xe959('0x49'));if(_0x2b23af['role']===_0xe959('0x4a')){var _0x3f5b8f=_0x53a733[_0xe959('0x48')]({'plain':!![]});var _0x1d08ed=_0xe959('0x23');return db[_0xe959('0x4b')][_0xe959('0x4c')]({'where':{'name':_0x1d08ed,'userProfileId':_0x2b23af[_0xe959('0x4d')]},'raw':!![]})[_0xe959('0x25')](function(_0x2d7d15){if(_0x2d7d15&&_0x2d7d15[_0xe959('0x4e')]===0x0){return db[_0xe959('0x24')]['create']({'name':_0x3f5b8f['name'],'resourceId':_0x3f5b8f['id'],'type':_0x2d7d15['name'],'sectionId':_0x2d7d15['id']},{})[_0xe959('0x25')](function(){return _0x53a733;});}else{return _0x53a733;}})[_0xe959('0x43')](function(_0x5dd705){logger[_0xe959('0x4f')](_0xe959('0x50'),_0x5dd705);throw _0x5dd705;});}return _0x53a733;})[_0xe959('0x25')](respondWithResult(_0x4bd6de,0xc9))['catch'](handleError(_0x4bd6de,null));};exports['clone']=function(_0x5e435b,_0x52ddcf){var _0x524181={'where':{'id':_0x5e435b[_0xe959('0x45')]['id']}},_0x4679d3={};_0x4679d3[_0xe959('0x2f')]=_[_0xe959('0x31')](db[_0xe959('0x2a')][_0xe959('0x2b')]);_0x524181[_0xe959('0x34')]=_[_0xe959('0x33')](_0x4679d3[_0xe959('0x2f')],qs[_0xe959('0x35')](_0x5e435b[_0xe959('0x30')][_0xe959('0x35')]));_0x524181[_0xe959('0x34')]=_0x524181['attributes']['length']?_0x524181[_0xe959('0x34')]:_0x4679d3[_0xe959('0x2f')];if(_0x5e435b[_0xe959('0x30')]['includeAll']){_0x524181['include']=[{'all':!![]}];}_0x524181=_[_0xe959('0x3c')]({},_0x524181,_0x5e435b[_0xe959('0x3f')]);return db[_0xe959('0x2a')][_0xe959('0x4c')](_0x524181)[_0xe959('0x25')](handleEntityNotFound(_0x52ddcf,null))[_0xe959('0x25')](function(_0x2a83c1){if(_0x2a83c1){var _0x57e046=_0x2a83c1[_0xe959('0x48')]({'plain':!![]});_0x57e046=qs[_0xe959('0x51')](_0x57e046,['id',_0xe959('0x52'),_0xe959('0x53')]);_0x5e435b[_0xe959('0x47')]=_[_0xe959('0x51')](_0x5e435b[_0xe959('0x47')],['id',_0xe959('0x52'),_0xe959('0x53')]);return db['Campaign'][_0xe959('0x46')](_['merge'](_0x57e046,_0x5e435b['body']),{'include':_0x5e435b[_0xe959('0x30')][_0xe959('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x2423c5){var _0x1829b8=_0x5e435b[_0xe959('0x4a')][_0xe959('0x48')]({'plain':!![]});if(!_0x1829b8)throw new Error(_0xe959('0x49'));if(_0x1829b8['role']==='user'){var _0x22b4c3=_0x2423c5[_0xe959('0x48')]({'plain':!![]});var _0x8ae9e7=_0xe959('0x23');return db[_0xe959('0x4b')]['find']({'where':{'name':_0x8ae9e7,'userProfileId':_0x1829b8[_0xe959('0x4d')]},'raw':!![]})[_0xe959('0x25')](function(_0x59d4eb){if(_0x59d4eb&&_0x59d4eb[_0xe959('0x4e')]===0x0){return db[_0xe959('0x24')]['create']({'name':_0x22b4c3[_0xe959('0x27')],'resourceId':_0x22b4c3['id'],'type':_0x59d4eb[_0xe959('0x27')],'sectionId':_0x59d4eb['id']},{})['then'](function(){return _0x2423c5;});}else{return _0x2423c5;}})[_0xe959('0x43')](function(_0x4de8cd){logger[_0xe959('0x4f')](_0xe959('0x50'),_0x4de8cd);throw _0x4de8cd;});}return _0x2423c5;});}})[_0xe959('0x25')](respondWithResult(_0x52ddcf,0xc9))['catch'](handleError(_0x52ddcf,null));};exports['update']=function(_0x535074,_0x222d97){if(_0x535074[_0xe959('0x47')]['id']){delete _0x535074['body']['id'];}return db[_0xe959('0x2a')][_0xe959('0x4c')]({'where':{'id':_0x535074[_0xe959('0x45')]['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x222d97,null))[_0xe959('0x25')](saveUpdates(_0x535074[_0xe959('0x47')],null))[_0xe959('0x25')](respondWithResult(_0x222d97,null))[_0xe959('0x43')](handleError(_0x222d97,null));};exports[_0xe959('0x54')]=function(_0x3704d8,_0x5445c2){return db[_0xe959('0x2a')]['find']({'where':{'id':_0x3704d8['params']['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x5445c2,null))['then'](removeEntity(_0x5445c2,null))[_0xe959('0x43')](handleError(_0x5445c2,null));};exports[_0xe959('0x55')]=function(_0x5acf08,_0x5ae0f3,_0x54d466){var _0x17459b={'raw':!![],'where':{}};var _0x1359be={};var _0x3dce85={'count':0x0,'rows':[]};return db['Campaign'][_0xe959('0x56')]({'where':{'id':_0x5acf08[_0xe959('0x45')]['id']}})['then'](handleEntityNotFound(_0x5ae0f3,null))[_0xe959('0x25')](function(_0x527d8f){if(_0x527d8f){_0x1359be[_0xe959('0x2f')]=_[_0xe959('0x31')](db[_0xe959('0x57')]['rawAttributes']);_0x1359be[_0xe959('0x30')]=_[_0xe959('0x31')](_0x5acf08[_0xe959('0x30')]);_0x1359be['filters']=_[_0xe959('0x33')](_0x1359be[_0xe959('0x2f')],_0x1359be[_0xe959('0x30')]);_0x17459b[_0xe959('0x34')]=_[_0xe959('0x33')](_0x1359be[_0xe959('0x2f')],qs['fields'](_0x5acf08[_0xe959('0x30')][_0xe959('0x35')]));_0x17459b[_0xe959('0x34')]=_0x17459b[_0xe959('0x34')]['length']?_0x17459b[_0xe959('0x34')]:_0x1359be['model'];if(!_0x5acf08[_0xe959('0x30')]['hasOwnProperty'](_0xe959('0x58'))){_0x17459b[_0xe959('0x1b')]=qs[_0xe959('0x1b')](_0x5acf08[_0xe959('0x30')][_0xe959('0x1b')]);_0x17459b[_0xe959('0x1d')]=qs[_0xe959('0x1d')](_0x5acf08[_0xe959('0x30')][_0xe959('0x1d')]);}_0x17459b[_0xe959('0x38')]=qs[_0xe959('0x39')](_0x5acf08[_0xe959('0x30')][_0xe959('0x39')]);_0x17459b[_0xe959('0x3a')]=qs['filters'](_[_0xe959('0x59')](_0x5acf08[_0xe959('0x30')],_0x1359be['filters']));_0x17459b[_0xe959('0x3a')][_0xe959('0x5a')]=_0x527d8f['id'];if(_0x5acf08['query']['filter']){_0x17459b['where']=_['merge'](_0x17459b[_0xe959('0x3a')],{'$or':_[_0xe959('0x3d')](_0x17459b[_0xe959('0x34')],function(_0x260098){var _0x1a9a81={};_0x1a9a81[_0x260098]={'$like':'%'+_0x5acf08[_0xe959('0x30')][_0xe959('0x3b')]+'%'};return _0x1a9a81;})});}_0x17459b=_[_0xe959('0x3c')]({},_0x17459b,_0x5acf08[_0xe959('0x3f')]);return db[_0xe959('0x57')][_0xe959('0x1c')]({'where':_0x17459b[_0xe959('0x3a')]})['then'](function(_0x7aef49){_0x3dce85['count']=_0x7aef49;if(_0x5acf08['query'][_0xe959('0x40')]){_0x17459b[_0xe959('0x41')]=[{'all':!![]}];}return db[_0xe959('0x57')][_0xe959('0x42')](_0x17459b);})[_0xe959('0x25')](function(_0x216295){_0x3dce85[_0xe959('0x5b')]=_0x216295;return _0x3dce85;});}})[_0xe959('0x25')](respondWithFilteredResult(_0x5ae0f3,_0x17459b))[_0xe959('0x43')](handleError(_0x5ae0f3,null));};exports[_0xe959('0x5c')]=function(_0x24d15e,_0x5afa59,_0x4e9e4d){var _0x57a83a={'raw':!![],'where':{}};var _0x201bfe={};var _0x274139={'count':0x0,'rows':[]};return db[_0xe959('0x2a')]['findOne']({'where':{'id':_0x24d15e['params']['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x5afa59,null))[_0xe959('0x25')](function(_0x1dca35){if(_0x1dca35){_0x201bfe[_0xe959('0x2f')]=_[_0xe959('0x31')](db[_0xe959('0x5d')][_0xe959('0x2b')]);_0x201bfe[_0xe959('0x30')]=_[_0xe959('0x31')](_0x24d15e[_0xe959('0x30')]);_0x201bfe['filters']=_[_0xe959('0x33')](_0x201bfe[_0xe959('0x2f')],_0x201bfe['query']);_0x57a83a[_0xe959('0x34')]=_['intersection'](_0x201bfe[_0xe959('0x2f')],qs['fields'](_0x24d15e[_0xe959('0x30')]['fields']));_0x57a83a[_0xe959('0x34')]=_0x57a83a[_0xe959('0x34')][_0xe959('0x36')]?_0x57a83a[_0xe959('0x34')]:_0x201bfe['model'];if(!_0x24d15e['query']['hasOwnProperty'](_0xe959('0x58'))){_0x57a83a[_0xe959('0x1b')]=qs[_0xe959('0x1b')](_0x24d15e['query'][_0xe959('0x1b')]);_0x57a83a[_0xe959('0x1d')]=qs[_0xe959('0x1d')](_0x24d15e[_0xe959('0x30')][_0xe959('0x1d')]);}_0x57a83a[_0xe959('0x38')]=qs[_0xe959('0x39')](_0x24d15e['query'][_0xe959('0x39')]);_0x57a83a[_0xe959('0x3a')]=qs[_0xe959('0x32')](_[_0xe959('0x59')](_0x24d15e[_0xe959('0x30')],_0x201bfe[_0xe959('0x32')]));_0x57a83a[_0xe959('0x3a')][_0xe959('0x5a')]=_0x1dca35['id'];if(_0x24d15e['query']['filter']){_0x57a83a[_0xe959('0x3a')]=_[_0xe959('0x3c')](_0x57a83a['where'],{'$or':_['map'](_0x57a83a[_0xe959('0x34')],function(_0x1a59cd){var _0x325362={};_0x325362[_0x1a59cd]={'$like':'%'+_0x24d15e['query'][_0xe959('0x3b')]+'%'};return _0x325362;})});}_0x57a83a=_[_0xe959('0x3c')]({},_0x57a83a,_0x24d15e[_0xe959('0x3f')]);return db[_0xe959('0x5d')]['count']({'where':_0x57a83a[_0xe959('0x3a')]})[_0xe959('0x25')](function(_0x5ba992){_0x274139[_0xe959('0x1c')]=_0x5ba992;if(_0x24d15e[_0xe959('0x30')][_0xe959('0x40')]){_0x57a83a[_0xe959('0x41')]=[{'all':!![]}];}return db[_0xe959('0x5d')][_0xe959('0x42')](_0x57a83a);})[_0xe959('0x25')](function(_0x24337d){_0x274139[_0xe959('0x5b')]=_0x24337d;return _0x274139;});}})[_0xe959('0x25')](respondWithFilteredResult(_0x5afa59,_0x57a83a))['catch'](handleError(_0x5afa59,null));};exports[_0xe959('0x5e')]=function(_0x5a3d83,_0x2bc990,_0x38ff42){var _0x18d43a={'raw':!![],'where':{}};var _0x8285db={};var _0x2eb185={'count':0x0,'rows':[]};return db['Campaign'][_0xe959('0x56')]({'where':{'id':_0x5a3d83[_0xe959('0x45')]['id']}})['then'](handleEntityNotFound(_0x2bc990,null))['then'](function(_0x49e36e){if(_0x49e36e){_0x8285db[_0xe959('0x2f')]=_['keys'](db[_0xe959('0x5f')][_0xe959('0x2b')]);_0x8285db[_0xe959('0x30')]=_[_0xe959('0x31')](_0x5a3d83[_0xe959('0x30')]);_0x8285db[_0xe959('0x32')]=_['intersection'](_0x8285db['model'],_0x8285db[_0xe959('0x30')]);_0x18d43a['attributes']=_[_0xe959('0x33')](_0x8285db[_0xe959('0x2f')],qs['fields'](_0x5a3d83['query'][_0xe959('0x35')]));_0x18d43a[_0xe959('0x34')]=_0x18d43a[_0xe959('0x34')]['length']?_0x18d43a[_0xe959('0x34')]:_0x8285db[_0xe959('0x2f')];if(!_0x5a3d83[_0xe959('0x30')][_0xe959('0x37')](_0xe959('0x58'))){_0x18d43a['limit']=qs[_0xe959('0x1b')](_0x5a3d83[_0xe959('0x30')]['limit']);_0x18d43a['offset']=qs[_0xe959('0x1d')](_0x5a3d83[_0xe959('0x30')][_0xe959('0x1d')]);}_0x18d43a[_0xe959('0x38')]=qs[_0xe959('0x39')](_0x5a3d83[_0xe959('0x30')][_0xe959('0x39')]);_0x18d43a[_0xe959('0x3a')]=qs[_0xe959('0x32')](_['pick'](_0x5a3d83[_0xe959('0x30')],_0x8285db[_0xe959('0x32')]));_0x18d43a['where']['CampaignId']=_0x49e36e['id'];if(_0x5a3d83['query'][_0xe959('0x3b')]){_0x18d43a[_0xe959('0x3a')]=_[_0xe959('0x3c')](_0x18d43a['where'],{'$or':_['map'](_0x18d43a[_0xe959('0x34')],function(_0x4fe6de){var _0x3471f5={};_0x3471f5[_0x4fe6de]={'$like':'%'+_0x5a3d83[_0xe959('0x30')]['filter']+'%'};return _0x3471f5;})});}_0x18d43a=_[_0xe959('0x3c')]({},_0x18d43a,_0x5a3d83[_0xe959('0x3f')]);return db[_0xe959('0x5f')][_0xe959('0x1c')]({'where':_0x18d43a[_0xe959('0x3a')]})['then'](function(_0x590d93){_0x2eb185[_0xe959('0x1c')]=_0x590d93;if(_0x5a3d83[_0xe959('0x30')]['includeAll']){_0x18d43a[_0xe959('0x41')]=[{'all':!![]}];}return db[_0xe959('0x5f')][_0xe959('0x42')](_0x18d43a);})[_0xe959('0x25')](function(_0x18d23f){_0x2eb185[_0xe959('0x5b')]=_0x18d23f;return _0x2eb185;});}})[_0xe959('0x25')](respondWithFilteredResult(_0x2bc990,_0x18d43a))[_0xe959('0x43')](handleError(_0x2bc990,null));};exports[_0xe959('0x60')]=function(_0x1cdd45,_0x1b17a4,_0x3d78a1){var _0x2de441={'raw':!![],'where':{}};var _0x1a7e33={};var _0x3a1ab0={'count':0x0,'rows':[]};return db['Campaign'][_0xe959('0x56')]({'where':{'id':_0x1cdd45[_0xe959('0x45')]['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x1b17a4,null))[_0xe959('0x25')](function(_0x2bb9d1){if(_0x2bb9d1){_0x1a7e33[_0xe959('0x2f')]=_['keys'](db[_0xe959('0x61')][_0xe959('0x2b')]);_0x1a7e33[_0xe959('0x30')]=_[_0xe959('0x31')](_0x1cdd45[_0xe959('0x30')]);_0x1a7e33[_0xe959('0x32')]=_['intersection'](_0x1a7e33[_0xe959('0x2f')],_0x1a7e33[_0xe959('0x30')]);_0x2de441[_0xe959('0x34')]=_[_0xe959('0x33')](_0x1a7e33['model'],qs[_0xe959('0x35')](_0x1cdd45['query'][_0xe959('0x35')]));_0x2de441['attributes']=_0x2de441[_0xe959('0x34')][_0xe959('0x36')]?_0x2de441['attributes']:_0x1a7e33['model'];if(!_0x1cdd45[_0xe959('0x30')]['hasOwnProperty']('nolimit')){_0x2de441[_0xe959('0x1b')]=qs[_0xe959('0x1b')](_0x1cdd45[_0xe959('0x30')][_0xe959('0x1b')]);_0x2de441[_0xe959('0x1d')]=qs[_0xe959('0x1d')](_0x1cdd45[_0xe959('0x30')][_0xe959('0x1d')]);}_0x2de441['order']=qs[_0xe959('0x39')](_0x1cdd45['query'][_0xe959('0x39')]);_0x2de441['where']=qs['filters'](_['pick'](_0x1cdd45['query'],_0x1a7e33[_0xe959('0x32')]));_0x2de441[_0xe959('0x3a')][_0xe959('0x5a')]=_0x2bb9d1['id'];if(_0x1cdd45[_0xe959('0x30')][_0xe959('0x3b')]){_0x2de441[_0xe959('0x3a')]=_[_0xe959('0x3c')](_0x2de441[_0xe959('0x3a')],{'$or':_['map'](_0x2de441[_0xe959('0x34')],function(_0x409f69){var _0x289491={};_0x289491[_0x409f69]={'$like':'%'+_0x1cdd45[_0xe959('0x30')]['filter']+'%'};return _0x289491;})});}_0x2de441=_['merge']({},_0x2de441,_0x1cdd45[_0xe959('0x3f')]);return db[_0xe959('0x61')][_0xe959('0x1c')]({'where':_0x2de441[_0xe959('0x3a')]})[_0xe959('0x25')](function(_0x3235f1){_0x3a1ab0[_0xe959('0x1c')]=_0x3235f1;if(_0x1cdd45[_0xe959('0x30')][_0xe959('0x40')]){_0x2de441[_0xe959('0x41')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xe959('0x42')](_0x2de441);})[_0xe959('0x25')](function(_0x4b681e){_0x3a1ab0[_0xe959('0x5b')]=_0x4b681e;return _0x3a1ab0;});}})['then'](respondWithFilteredResult(_0x1b17a4,_0x2de441))[_0xe959('0x43')](handleError(_0x1b17a4,null));};exports[_0xe959('0x62')]=function(_0x14cedd,_0x4bca24,_0x56c81c){var _0x468d12={};var _0x2d53cc={};var _0x2246b3;var _0x3419ad;return db[_0xe959('0x2a')][_0xe959('0x56')]({'where':{'id':_0x14cedd[_0xe959('0x45')]['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x4bca24,null))[_0xe959('0x25')](function(_0x2be10d){if(_0x2be10d){_0x2246b3=_0x2be10d;_0x2d53cc['model']=_[_0xe959('0x31')](db['CmList'][_0xe959('0x2b')]);_0x2d53cc['query']=_[_0xe959('0x31')](_0x14cedd[_0xe959('0x30')]);_0x2d53cc['filters']=_[_0xe959('0x33')](_0x2d53cc[_0xe959('0x2f')],_0x2d53cc[_0xe959('0x30')]);_0x468d12[_0xe959('0x34')]=_[_0xe959('0x33')](_0x2d53cc[_0xe959('0x2f')],qs[_0xe959('0x35')](_0x14cedd['query']['fields']));_0x468d12[_0xe959('0x34')]=_0x468d12['attributes'][_0xe959('0x36')]?_0x468d12[_0xe959('0x34')]:_0x2d53cc[_0xe959('0x2f')];_0x468d12[_0xe959('0x38')]=qs['sort'](_0x14cedd['query']['sort']);_0x468d12[_0xe959('0x3a')]=qs[_0xe959('0x32')](_[_0xe959('0x59')](_0x14cedd[_0xe959('0x30')],_0x2d53cc[_0xe959('0x32')]));if(_0x14cedd['query'][_0xe959('0x3b')]){_0x468d12[_0xe959('0x3a')]=_['merge'](_0x468d12[_0xe959('0x3a')],{'$or':_['map'](_0x468d12[_0xe959('0x34')],function(_0x205094){var _0x53cc08={};_0x53cc08[_0x205094]={'$like':'%'+_0x14cedd[_0xe959('0x30')]['filter']+'%'};return _0x53cc08;})});}_0x468d12=_[_0xe959('0x3c')]({},_0x468d12,_0x14cedd[_0xe959('0x3f')]);return _0x2246b3[_0xe959('0x62')](_0x468d12);}})[_0xe959('0x25')](function(_0x9e4cc7){if(_0x9e4cc7){_0x3419ad=_0x9e4cc7[_0xe959('0x36')];if(!_0x14cedd['query']['hasOwnProperty'](_0xe959('0x58'))){_0x468d12[_0xe959('0x1b')]=qs[_0xe959('0x1b')](_0x14cedd[_0xe959('0x30')][_0xe959('0x1b')]);_0x468d12[_0xe959('0x1d')]=qs[_0xe959('0x1d')](_0x14cedd['query']['offset']);}return _0x2246b3[_0xe959('0x62')](_0x468d12);}})[_0xe959('0x25')](function(_0x13a7f1){if(_0x13a7f1){return _0x13a7f1?{'count':_0x3419ad,'rows':_0x13a7f1}:null;}})[_0xe959('0x25')](respondWithResult(_0x4bca24,null))[_0xe959('0x43')](handleError(_0x4bca24,null));};exports[_0xe959('0x63')]=function(_0x2d5152,_0x37b9cc,_0x54cefa){var _0x30ae03,_0x59a8e2;var _0xa15684=[];var _0x2cb28d=moment()[_0xe959('0x64')](_0xe959('0x65'));return db[_0xe959('0x2a')][_0xe959('0x4c')]({'where':{'id':_0x2d5152[_0xe959('0x45')]['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x37b9cc,null))[_0xe959('0x25')](function(_0x48397d){if(_0x48397d){_0x59a8e2=_0x48397d;return _0x48397d[_0xe959('0x63')](_0x2d5152[_0xe959('0x47')][_0xe959('0x66')],_[_0xe959('0x51')](_0x2d5152[_0xe959('0x47')],['ids','id'])||{});}return null;})[_0xe959('0x67')](function(_0x2a9668){var _0x339650;var _0x2a8ad3;_0x30ae03=_0x2a9668||[];var _0x565296=[];if(_0x2a9668){for(var _0x1287f6=0x0;_0x1287f6<_0x2a9668[_0xe959('0x36')];_0x1287f6+=0x1){var _0x253a27=_0x2a9668[_0x1287f6]['get']({'plain':!![]});_0x59a8e2[_0xe959('0x68')]=_0x2d5152[_0xe959('0x47')][_0xe959('0x68')]?_0x2d5152['body'][_0xe959('0x68')]:_0x59a8e2[_0xe959('0x68')];switch(_0x59a8e2[_0xe959('0x68')]){case'always':_0x339650=squel['insert']()[_0xe959('0x69')]('cm_hopper')[_0xe959('0x6a')](['phone',_0xe959('0x6b'),_0xe959('0x6c'),_0xe959('0x6d'),_0xe959('0x5a'),_0xe959('0x52'),_0xe959('0x53')],squel[_0xe959('0x6e')]()[_0xe959('0x6f')](_0xe959('0x70'),_0xe959('0x70'))['field'](_0xe959('0x71'),_0xe959('0x6b'))[_0xe959('0x6f')]('id','ContactId')[_0xe959('0x6f')](_0x253a27[_0xe959('0x72')][_0xe959('0x73')](),_0xe959('0x6d'))[_0xe959('0x6f')](_0x2d5152[_0xe959('0x45')]['id']['toString'](),_0xe959('0x5a'))['field']('\x27'+_0x2cb28d+'\x27','createdAt')[_0xe959('0x6f')]('\x27'+_0x2cb28d+'\x27',_0xe959('0x53'))[_0xe959('0x74')](_0xe959('0x75'))[_0xe959('0x3a')]('deletedAt\x20IS\x20NULL')['where'](_0xe959('0x76'),_0x253a27[_0xe959('0x72')]['toString']())[_0xe959('0x3a')](_0xe959('0x77'))['where'](_0xe959('0x78'),squel[_0xe959('0x6e')]()[_0xe959('0x6f')](_0xe959('0x79'))[_0xe959('0x74')](_0xe959('0x7a'))[_0xe959('0x3a')](_0xe959('0x7b'),_0x2d5152['params']['id'][_0xe959('0x73')]()))[_0xe959('0x3a')](_0xe959('0x78'),squel[_0xe959('0x6e')]()['field'](_0xe959('0x7c'))['from'](_0xe959('0x7d'))['where'](_0xe959('0x7b'),_0x2d5152[_0xe959('0x45')]['id'][_0xe959('0x73')]())))['toString']();break;case _0xe959('0x7e'):_0x339650=squel[_0xe959('0x7f')]()[_0xe959('0x69')](_0xe959('0x7d'))['fromQuery'](['phone',_0xe959('0x6b'),_0xe959('0x6c'),'ListId','CampaignId',_0xe959('0x52'),_0xe959('0x53')],squel['select']()[_0xe959('0x6f')](_0xe959('0x70'),_0xe959('0x70'))[_0xe959('0x6f')](_0xe959('0x71'),'scheduledAt')['field']('id',_0xe959('0x6c'))[_0xe959('0x6f')](_0x253a27['CmListId'][_0xe959('0x73')](),_0xe959('0x6d'))[_0xe959('0x6f')](_0x2d5152[_0xe959('0x45')]['id'][_0xe959('0x73')](),_0xe959('0x5a'))[_0xe959('0x6f')]('\x27'+_0x2cb28d+'\x27','createdAt')['field']('\x27'+_0x2cb28d+'\x27',_0xe959('0x53'))[_0xe959('0x74')](_0xe959('0x75'))['where'](_0xe959('0x80'))['where'](_0xe959('0x76'),_0x253a27[_0xe959('0x72')][_0xe959('0x73')]())[_0xe959('0x3a')](_0xe959('0x77'))[_0xe959('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xe959('0x6f')](_0xe959('0x7c'))[_0xe959('0x74')](_0xe959('0x7d'))[_0xe959('0x3a')]('CampaignId\x20=\x20?',_0x2d5152[_0xe959('0x45')]['id'][_0xe959('0x73')]())))['toString']();break;default:_0x339650=squel['insert']()['into'](_0xe959('0x7d'))['fromQuery']([_0xe959('0x70'),'scheduledAt',_0xe959('0x6c'),_0xe959('0x6d'),_0xe959('0x5a'),'createdAt','updatedAt'],squel['select']()['field'](_0xe959('0x70'),_0xe959('0x70'))[_0xe959('0x6f')](_0xe959('0x71'),_0xe959('0x6b'))[_0xe959('0x6f')]('id','ContactId')[_0xe959('0x6f')](_0x253a27['CmListId'][_0xe959('0x73')](),'ListId')[_0xe959('0x6f')](_0x2d5152['params']['id'][_0xe959('0x73')](),_0xe959('0x5a'))[_0xe959('0x6f')]('\x27'+_0x2cb28d+'\x27',_0xe959('0x52'))[_0xe959('0x6f')]('\x27'+_0x2cb28d+'\x27',_0xe959('0x53'))[_0xe959('0x74')](_0xe959('0x75'))[_0xe959('0x3a')](_0xe959('0x80'))[_0xe959('0x3a')](_0xe959('0x76'),_0x253a27[_0xe959('0x72')][_0xe959('0x73')]())[_0xe959('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0xe959('0x73')]();}_0x2a8ad3=squel[_0xe959('0x7f')]()[_0xe959('0x69')]('cm_hopper_additional_phones')[_0xe959('0x6a')]([_0xe959('0x81'),_0xe959('0x6b'),_0xe959('0x70'),_0xe959('0x82'),_0xe959('0x52'),_0xe959('0x53')],squel[_0xe959('0x6e')]()['field'](_0xe959('0x83'),'id')[_0xe959('0x6f')]('NOW()',_0xe959('0x6b'))[_0xe959('0x6f')](_0xe959('0x84'),_0xe959('0x70'))['field'](_0xe959('0x85'),_0xe959('0x82'))[_0xe959('0x6f')]('\x27'+_0x2cb28d+'\x27',_0xe959('0x52'))[_0xe959('0x6f')]('\x27'+_0x2cb28d+'\x27',_0xe959('0x53'))[_0xe959('0x74')](_0xe959('0x86'),'ci')[_0xe959('0x87')]('cm_hopper','h',_0xe959('0x88'))[_0xe959('0x3a')](_0xe959('0x89'),_0x253a27['CmListId']['toString']())['where'](_0xe959('0x8a'),_0x2d5152[_0xe959('0x45')]['id'][_0xe959('0x73')]())[_0xe959('0x3a')]('h.createdAt\x20=\x20?',_0x2cb28d))[_0xe959('0x73')]();_0x565296['push'](db['sequelize'][_0xe959('0x30')](_0x339650));_0xa15684[_0xe959('0x8b')](db[_0xe959('0x8c')][_0xe959('0x30')](_0x2a8ad3));}return BPromise[_0xe959('0x8d')](_0x565296);}})['then'](function(){return BPromise[_0xe959('0x8d')](_0xa15684);})[_0xe959('0x25')](function(){return _0x30ae03;})[_0xe959('0x25')](respondWithResult(_0x37b9cc,null))[_0xe959('0x43')](handleError(_0x37b9cc,null));};exports[_0xe959('0x8e')]=function(_0x58610f,_0x4220fa,_0x5fd409){return db['Campaign'][_0xe959('0x4c')]({'where':{'id':_0x58610f[_0xe959('0x45')]['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x4220fa,null))[_0xe959('0x25')](function(_0x113df5){if(_0x113df5){return _0x113df5[_0xe959('0x8e')](_0x58610f[_0xe959('0x30')][_0xe959('0x66')]);}})[_0xe959('0x25')](function(_0x300f25){if(_0x300f25){return db['CmHopper'][_0xe959('0x54')]({'where':{'ListId':_0x58610f[_0xe959('0x30')][_0xe959('0x66')],'CampaignId':_0x58610f[_0xe959('0x45')]['id']}})[_0xe959('0x25')](function(){return _0x300f25;});}})[_0xe959('0x25')](respondWithStatusCode(_0x4220fa,null))[_0xe959('0x43')](handleError(_0x4220fa,null));};exports[_0xe959('0x8f')]=function(_0x15cf08,_0x5b5ab5,_0x5ed44c){var _0x8f8873={};var _0x17deae={};var _0x34213f;var _0x11af9a;return db[_0xe959('0x2a')][_0xe959('0x56')]({'where':{'id':_0x15cf08['params']['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x5b5ab5,null))[_0xe959('0x25')](function(_0x512181){if(_0x512181){_0x34213f=_0x512181;_0x17deae[_0xe959('0x2f')]=_[_0xe959('0x31')](db['CmList'][_0xe959('0x2b')]);_0x17deae['query']=_['keys'](_0x15cf08[_0xe959('0x30')]);_0x17deae[_0xe959('0x32')]=_[_0xe959('0x33')](_0x17deae[_0xe959('0x2f')],_0x17deae[_0xe959('0x30')]);_0x8f8873['attributes']=_['intersection'](_0x17deae[_0xe959('0x2f')],qs[_0xe959('0x35')](_0x15cf08[_0xe959('0x30')][_0xe959('0x35')]));_0x8f8873[_0xe959('0x34')]=_0x8f8873['attributes'][_0xe959('0x36')]?_0x8f8873['attributes']:_0x17deae[_0xe959('0x2f')];_0x8f8873['order']=qs['sort'](_0x15cf08[_0xe959('0x30')][_0xe959('0x39')]);_0x8f8873['where']=qs[_0xe959('0x32')](_[_0xe959('0x59')](_0x15cf08[_0xe959('0x30')],_0x17deae[_0xe959('0x32')]));if(_0x15cf08[_0xe959('0x30')][_0xe959('0x3b')]){_0x8f8873['where']=_['merge'](_0x8f8873[_0xe959('0x3a')],{'$or':_[_0xe959('0x3d')](_0x8f8873[_0xe959('0x34')],function(_0x3bc421){var _0x13016c={};_0x13016c[_0x3bc421]={'$like':'%'+_0x15cf08[_0xe959('0x30')][_0xe959('0x3b')]+'%'};return _0x13016c;})});}_0x8f8873=_[_0xe959('0x3c')]({},_0x8f8873,_0x15cf08['options']);return _0x34213f['getBlackLists'](_0x8f8873);}})['then'](function(_0x459cd4){if(_0x459cd4){_0x11af9a=_0x459cd4[_0xe959('0x36')];if(!_0x15cf08[_0xe959('0x30')][_0xe959('0x37')](_0xe959('0x58'))){_0x8f8873[_0xe959('0x1b')]=qs[_0xe959('0x1b')](_0x15cf08[_0xe959('0x30')][_0xe959('0x1b')]);_0x8f8873[_0xe959('0x1d')]=qs['offset'](_0x15cf08['query'][_0xe959('0x1d')]);}return _0x34213f[_0xe959('0x8f')](_0x8f8873);}})[_0xe959('0x25')](function(_0x2c51a5){if(_0x2c51a5){return _0x2c51a5?{'count':_0x11af9a,'rows':_0x2c51a5}:null;}})[_0xe959('0x25')](respondWithResult(_0x5b5ab5,null))[_0xe959('0x43')](handleError(_0x5b5ab5,null));};exports[_0xe959('0x90')]=function(_0x23b8a7,_0x56d876,_0x851245){var _0x15739d,_0x1ac93e;var _0x5d2adf=[];var _0x458028=moment()[_0xe959('0x64')](_0xe959('0x65'));return db[_0xe959('0x2a')][_0xe959('0x4c')]({'where':{'id':_0x23b8a7[_0xe959('0x45')]['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x56d876,null))['then'](function(_0x5afc54){if(_0x5afc54){_0x1ac93e=_0x5afc54;return _0x5afc54[_0xe959('0x90')](_0x23b8a7['body'][_0xe959('0x66')],_['omit'](_0x23b8a7['body'],[_0xe959('0x66'),'id'])||{});}return null;})[_0xe959('0x67')](function(_0x37bd75){var _0x5d8179;var _0x54c716;_0x15739d=_0x37bd75||[];var _0x563353=[];if(_0x37bd75){for(var _0xdb4e84=0x0;_0xdb4e84<_0x37bd75[_0xe959('0x36')];_0xdb4e84+=0x1){var _0x8179cb=_0x37bd75[_0xdb4e84][_0xe959('0x48')]({'plain':!![]});_0x5d8179=squel[_0xe959('0x7f')]()[_0xe959('0x69')](_0xe959('0x91'))[_0xe959('0x6a')]([_0xe959('0x70'),_0xe959('0x6c'),'ListId',_0xe959('0x5a'),_0xe959('0x52'),_0xe959('0x53')],squel[_0xe959('0x6e')]()[_0xe959('0x6f')](_0xe959('0x70'),_0xe959('0x70'))[_0xe959('0x6f')]('id','ContactId')[_0xe959('0x6f')](_0x8179cb[_0xe959('0x72')][_0xe959('0x73')](),_0xe959('0x6d'))['field'](_0x23b8a7[_0xe959('0x45')]['id']['toString'](),_0xe959('0x5a'))['field'](_0xe959('0x71'),_0xe959('0x52'))[_0xe959('0x6f')](_0xe959('0x71'),_0xe959('0x53'))[_0xe959('0x74')](_0xe959('0x75'))[_0xe959('0x3a')](_0xe959('0x80'))[_0xe959('0x3a')](_0xe959('0x76'),_0x8179cb[_0xe959('0x72')][_0xe959('0x73')]())[_0xe959('0x3a')](_0xe959('0x77')))['toString']();_0x563353[_0xe959('0x8b')](db[_0xe959('0x8c')][_0xe959('0x30')](_0x5d8179));}return BPromise[_0xe959('0x8d')](_0x563353);}})['then'](function(){return _0x15739d;})['then'](respondWithResult(_0x56d876,null))['catch'](handleError(_0x56d876,null));};exports[_0xe959('0x92')]=function(_0x370ffc,_0x50bcea,_0x19a64a){return db['Campaign']['find']({'where':{'id':_0x370ffc['params']['id']}})[_0xe959('0x25')](handleEntityNotFound(_0x50bcea,null))['then'](function(_0xbbfb25){if(_0xbbfb25){return _0xbbfb25['removeBlackLists'](_0x370ffc[_0xe959('0x30')][_0xe959('0x66')]);}})['then'](function(_0x535b64){if(_0x535b64){return db[_0xe959('0x61')][_0xe959('0x54')]({'where':{'ListId':_0x370ffc[_0xe959('0x30')]['ids'],'CampaignId':_0x370ffc[_0xe959('0x45')]['id']}})[_0xe959('0x25')](function(){return _0x535b64;});}})['then'](respondWithStatusCode(_0x50bcea,null))[_0xe959('0x43')](handleError(_0x50bcea,null));}; \ No newline at end of file +var _0xe511=['VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','create','catch','clone','updatedAt','body','omit','createdAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','nolimit','CmHopper','findOne','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','ids','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ListId','select','field','NOW()','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','ListId\x20=\x20?','cmHopperId','OrderBy','ci.item','ci.OrderBY','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','destroy','getBlackLists','YYYY-MM-DD\x20HH:mm:ss','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','save','update','then','get','IvrCampaigns','error','name','send','map','Campaign','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','filters','pick','filter','where','merge'];(function(_0x1e896c,_0x3f9948){var _0xd149d9=function(_0x3281e5){while(--_0x3281e5){_0x1e896c['push'](_0x1e896c['shift']());}};_0xd149d9(++_0x3f9948);}(_0xe511,0x16f));var _0x1e51=function(_0x563582,_0x1c23c5){_0x563582=_0x563582-0x0;var _0x3b6a0f=_0xe511[_0x563582];return _0x3b6a0f;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];function respondWithStatusCode(_0x3c5330,_0x5544eb){_0x5544eb=_0x5544eb||0xcc;return function(_0x408a77){if(_0x408a77){return _0x3c5330[_0x1e51('0x18')](_0x5544eb);}return _0x3c5330[_0x1e51('0x19')](_0x5544eb)[_0x1e51('0x1a')]();};}function respondWithResult(_0x21bcbd,_0x32945d){_0x32945d=_0x32945d||0xc8;return function(_0x441c70){if(_0x441c70){return _0x21bcbd[_0x1e51('0x19')](_0x32945d)[_0x1e51('0x1b')](_0x441c70);}};}function respondWithFilteredResult(_0xd76fba,_0x5a5c07){return function(_0x3b01b7){if(_0x3b01b7){var _0x24db4f=typeof _0x5a5c07[_0x1e51('0x1c')]==='undefined'&&typeof _0x5a5c07[_0x1e51('0x1d')]==='undefined';var _0x53d222=_0x3b01b7[_0x1e51('0x1e')];var _0x27dcad=_0x24db4f?0x0:_0x5a5c07[_0x1e51('0x1c')];var _0x4785a5=_0x24db4f?_0x3b01b7[_0x1e51('0x1e')]:_0x5a5c07[_0x1e51('0x1c')]+_0x5a5c07['limit'];var _0x39449b;if(_0x4785a5>=_0x53d222){_0x4785a5=_0x53d222;_0x39449b=0xc8;}else{_0x39449b=0xce;}_0xd76fba['status'](_0x39449b);return _0xd76fba[_0x1e51('0x1f')](_0x1e51('0x20'),_0x27dcad+'-'+_0x4785a5+'/'+_0x53d222)[_0x1e51('0x1b')](_0x3b01b7);}return null;};}function patchUpdates(_0x183a95){return function(_0x506f40){try{jsonpatch['apply'](_0x506f40,_0x183a95,!![]);}catch(_0x4e6a49){return BPromise['reject'](_0x4e6a49);}return _0x506f40[_0x1e51('0x21')]();};}function saveUpdates(_0x4f1f56,_0x3f7340){return function(_0x28aacb){if(_0x28aacb){return _0x28aacb[_0x1e51('0x22')](_0x4f1f56)[_0x1e51('0x23')](function(_0x23c85a){return _0x23c85a;});}return null;};}function removeEntity(_0xf9298,_0x270adf){return function(_0x461d3d){if(_0x461d3d){return _0x461d3d['destroy']()['then'](function(){var _0x43f5c5=_0x461d3d[_0x1e51('0x24')]({'plain':!![]});var _0x2e42b1=_0x1e51('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x2e42b1,'resourceId':_0x43f5c5['id']}})['then'](function(){return _0x461d3d;});})[_0x1e51('0x23')](function(){_0xf9298[_0x1e51('0x19')](0xcc)[_0x1e51('0x1a')]();});}};}function handleEntityNotFound(_0x5412bc,_0x1e7a96){return function(_0x49c507){if(!_0x49c507){_0x5412bc['sendStatus'](0x194);}return _0x49c507;};}function handleError(_0x3349f0,_0x5c5bbd){_0x5c5bbd=_0x5c5bbd||0x1f4;return function(_0x170ec6){logger[_0x1e51('0x26')](_0x170ec6['stack']);if(_0x170ec6[_0x1e51('0x27')]){delete _0x170ec6[_0x1e51('0x27')];}_0x3349f0[_0x1e51('0x19')](_0x5c5bbd)[_0x1e51('0x28')](_0x170ec6);};}exports['index']=function(_0x4cf046,_0x4f67d3){var _0x20eb9b={},_0x288b50={},_0x1ba84a={'count':0x0,'rows':[]};var _0x36dabe=_[_0x1e51('0x29')](db[_0x1e51('0x2a')][_0x1e51('0x2b')],function(_0x34701c){return{'name':_0x34701c[_0x1e51('0x2c')],'type':_0x34701c[_0x1e51('0x2d')][_0x1e51('0x2e')]};});_0x288b50['model']=_[_0x1e51('0x29')](_0x36dabe,_0x1e51('0x27'));_0x288b50[_0x1e51('0x2f')]=_[_0x1e51('0x30')](_0x4cf046[_0x1e51('0x2f')]);_0x288b50['filters']=_[_0x1e51('0x31')](_0x288b50['model'],_0x288b50[_0x1e51('0x2f')]);_0x20eb9b[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0x288b50['model'],qs[_0x1e51('0x33')](_0x4cf046['query'][_0x1e51('0x33')]));_0x20eb9b['attributes']=_0x20eb9b['attributes'][_0x1e51('0x34')]?_0x20eb9b[_0x1e51('0x32')]:_0x288b50[_0x1e51('0x35')];if(!_0x4cf046['query'][_0x1e51('0x36')]('nolimit')){_0x20eb9b[_0x1e51('0x1d')]=qs[_0x1e51('0x1d')](_0x4cf046['query'][_0x1e51('0x1d')]);_0x20eb9b[_0x1e51('0x1c')]=qs[_0x1e51('0x1c')](_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x1c')]);}_0x20eb9b[_0x1e51('0x37')]=qs['sort'](_0x4cf046['query'][_0x1e51('0x38')]);_0x20eb9b['where']=qs[_0x1e51('0x39')](_[_0x1e51('0x3a')](_0x4cf046[_0x1e51('0x2f')],_0x288b50[_0x1e51('0x39')]),_0x36dabe);if(_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x3b')]){_0x20eb9b[_0x1e51('0x3c')]=_[_0x1e51('0x3d')](_0x20eb9b[_0x1e51('0x3c')],{'$or':_[_0x1e51('0x29')](_0x36dabe,function(_0x45d5fe){if(_0x45d5fe['type']!==_0x1e51('0x3e')){var _0x5818be={};_0x5818be[_0x45d5fe[_0x1e51('0x27')]]={'$like':'%'+_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x5818be;}})});}_0x20eb9b=_[_0x1e51('0x3d')]({},_0x20eb9b,_0x4cf046[_0x1e51('0x3f')]);var _0x2f8fd9={'where':_0x20eb9b[_0x1e51('0x3c')]};return db[_0x1e51('0x2a')][_0x1e51('0x1e')](_0x2f8fd9)[_0x1e51('0x23')](function(_0xc40fce){_0x1ba84a['count']=_0xc40fce;if(_0x4cf046['query'][_0x1e51('0x40')]){_0x20eb9b[_0x1e51('0x41')]=[{'all':!![]}];}return db[_0x1e51('0x2a')][_0x1e51('0x42')](_0x20eb9b);})[_0x1e51('0x23')](function(_0x1a9e0d){_0x1ba84a[_0x1e51('0x43')]=_0x1a9e0d;return _0x1ba84a;})[_0x1e51('0x23')](respondWithFilteredResult(_0x4f67d3,_0x20eb9b))['catch'](handleError(_0x4f67d3,null));};exports[_0x1e51('0x44')]=function(_0x30eba9,_0x1750b3){var _0x41ca21={'raw':![],'where':{'id':_0x30eba9[_0x1e51('0x45')]['id']}},_0xfd96a0={};_0xfd96a0[_0x1e51('0x35')]=_['keys'](db[_0x1e51('0x2a')][_0x1e51('0x2b')]);_0xfd96a0['query']=_[_0x1e51('0x30')](_0x30eba9[_0x1e51('0x2f')]);_0xfd96a0[_0x1e51('0x39')]=_['intersection'](_0xfd96a0[_0x1e51('0x35')],_0xfd96a0[_0x1e51('0x2f')]);_0x41ca21[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0xfd96a0[_0x1e51('0x35')],qs[_0x1e51('0x33')](_0x30eba9[_0x1e51('0x2f')][_0x1e51('0x33')]));_0x41ca21[_0x1e51('0x32')]=_0x41ca21['attributes'][_0x1e51('0x34')]?_0x41ca21[_0x1e51('0x32')]:_0xfd96a0['model'];if(_0x30eba9[_0x1e51('0x2f')][_0x1e51('0x40')]){_0x41ca21[_0x1e51('0x41')]=[{'all':!![]}];}_0x41ca21=_['merge']({},_0x41ca21,_0x30eba9[_0x1e51('0x3f')]);return db[_0x1e51('0x2a')][_0x1e51('0x46')](_0x41ca21)['then'](handleEntityNotFound(_0x1750b3,null))[_0x1e51('0x23')](respondWithResult(_0x1750b3,null))['catch'](handleError(_0x1750b3,null));};exports['create']=function(_0x54688b,_0x169e6c){return db[_0x1e51('0x2a')]['create'](_0x54688b['body'],{})[_0x1e51('0x23')](function(_0x7ffc42){var _0x2a43dd=_0x54688b[_0x1e51('0x47')][_0x1e51('0x24')]({'plain':!![]});if(!_0x2a43dd)throw new Error(_0x1e51('0x48'));if(_0x2a43dd['role']===_0x1e51('0x47')){var _0x48a2d0=_0x7ffc42[_0x1e51('0x24')]({'plain':!![]});var _0x43589a='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x43589a,'userProfileId':_0x2a43dd[_0x1e51('0x49')]},'raw':!![]})[_0x1e51('0x23')](function(_0x31a37a){if(_0x31a37a&&_0x31a37a['autoAssociation']===0x0){return db[_0x1e51('0x4a')][_0x1e51('0x4b')]({'name':_0x48a2d0[_0x1e51('0x27')],'resourceId':_0x48a2d0['id'],'type':_0x31a37a[_0x1e51('0x27')],'sectionId':_0x31a37a['id']},{})[_0x1e51('0x23')](function(){return _0x7ffc42;});}else{return _0x7ffc42;}})[_0x1e51('0x4c')](function(_0x32fe1f){logger[_0x1e51('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32fe1f);throw _0x32fe1f;});}return _0x7ffc42;})[_0x1e51('0x23')](respondWithResult(_0x169e6c,0xc9))[_0x1e51('0x4c')](handleError(_0x169e6c,null));};exports[_0x1e51('0x4d')]=function(_0x213edb,_0x177b63){var _0x2a88db={'where':{'id':_0x213edb[_0x1e51('0x45')]['id']}},_0x5ba6c2={};_0x5ba6c2['model']=_['keys'](db['Campaign'][_0x1e51('0x2b')]);_0x2a88db[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0x5ba6c2['model'],qs[_0x1e51('0x33')](_0x213edb[_0x1e51('0x2f')][_0x1e51('0x33')]));_0x2a88db['attributes']=_0x2a88db[_0x1e51('0x32')][_0x1e51('0x34')]?_0x2a88db[_0x1e51('0x32')]:_0x5ba6c2['model'];if(_0x213edb[_0x1e51('0x2f')][_0x1e51('0x40')]){_0x2a88db[_0x1e51('0x41')]=[{'all':!![]}];}_0x2a88db=_[_0x1e51('0x3d')]({},_0x2a88db,_0x213edb[_0x1e51('0x3f')]);return db[_0x1e51('0x2a')][_0x1e51('0x46')](_0x2a88db)[_0x1e51('0x23')](handleEntityNotFound(_0x177b63,null))['then'](function(_0xd21d08){if(_0xd21d08){var _0x2e78e7=_0xd21d08['get']({'plain':!![]});_0x2e78e7=qs['omit'](_0x2e78e7,['id','createdAt',_0x1e51('0x4e')]);_0x213edb[_0x1e51('0x4f')]=_[_0x1e51('0x50')](_0x213edb[_0x1e51('0x4f')],['id',_0x1e51('0x51'),_0x1e51('0x4e')]);return db[_0x1e51('0x2a')][_0x1e51('0x4b')](_[_0x1e51('0x3d')](_0x2e78e7,_0x213edb['body']),{'include':_0x213edb['query']['includeAll']?[{'all':!![]}]:undefined})[_0x1e51('0x23')](function(_0x4048a4){var _0x50c202=_0x213edb['user'][_0x1e51('0x24')]({'plain':!![]});if(!_0x50c202)throw new Error(_0x1e51('0x48'));if(_0x50c202['role']===_0x1e51('0x47')){var _0x1fc8a9=_0x4048a4[_0x1e51('0x24')]({'plain':!![]});var _0x3e4073=_0x1e51('0x25');return db[_0x1e51('0x52')][_0x1e51('0x46')]({'where':{'name':_0x3e4073,'userProfileId':_0x50c202[_0x1e51('0x49')]},'raw':!![]})[_0x1e51('0x23')](function(_0x32863f){if(_0x32863f&&_0x32863f['autoAssociation']===0x0){return db[_0x1e51('0x4a')][_0x1e51('0x4b')]({'name':_0x1fc8a9[_0x1e51('0x27')],'resourceId':_0x1fc8a9['id'],'type':_0x32863f[_0x1e51('0x27')],'sectionId':_0x32863f['id']},{})[_0x1e51('0x23')](function(){return _0x4048a4;});}else{return _0x4048a4;}})[_0x1e51('0x4c')](function(_0x47cc50){logger['error'](_0x1e51('0x53'),_0x47cc50);throw _0x47cc50;});}return _0x4048a4;});}})[_0x1e51('0x23')](respondWithResult(_0x177b63,0xc9))[_0x1e51('0x4c')](handleError(_0x177b63,null));};exports[_0x1e51('0x22')]=function(_0x52a439,_0x4bbe62){if(_0x52a439['body']['id']){delete _0x52a439[_0x1e51('0x4f')]['id'];}return db[_0x1e51('0x2a')][_0x1e51('0x46')]({'where':{'id':_0x52a439[_0x1e51('0x45')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x4bbe62,null))['then'](saveUpdates(_0x52a439[_0x1e51('0x4f')],null))[_0x1e51('0x23')](respondWithResult(_0x4bbe62,null))[_0x1e51('0x4c')](handleError(_0x4bbe62,null));};exports['destroy']=function(_0x2d0ff0,_0x77f0c1){return db[_0x1e51('0x2a')]['find']({'where':{'id':_0x2d0ff0[_0x1e51('0x45')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x77f0c1,null))['then'](removeEntity(_0x77f0c1,null))['catch'](handleError(_0x77f0c1,null));};exports[_0x1e51('0x54')]=function(_0x4d6d41,_0x4464bf,_0x4cd38b){var _0x17a9fd={'raw':!![],'where':{}};var _0xe1cfa0={};var _0x35f12e={'count':0x0,'rows':[]};return db[_0x1e51('0x2a')]['findOne']({'where':{'id':_0x4d6d41[_0x1e51('0x45')]['id']}})['then'](handleEntityNotFound(_0x4464bf,null))['then'](function(_0xa31c12){if(_0xa31c12){_0xe1cfa0[_0x1e51('0x35')]=_[_0x1e51('0x30')](db['CmHopper'][_0x1e51('0x2b')]);_0xe1cfa0[_0x1e51('0x2f')]=_[_0x1e51('0x30')](_0x4d6d41[_0x1e51('0x2f')]);_0xe1cfa0['filters']=_[_0x1e51('0x31')](_0xe1cfa0['model'],_0xe1cfa0['query']);_0x17a9fd[_0x1e51('0x32')]=_['intersection'](_0xe1cfa0[_0x1e51('0x35')],qs['fields'](_0x4d6d41[_0x1e51('0x2f')]['fields']));_0x17a9fd[_0x1e51('0x32')]=_0x17a9fd[_0x1e51('0x32')]['length']?_0x17a9fd[_0x1e51('0x32')]:_0xe1cfa0['model'];if(!_0x4d6d41[_0x1e51('0x2f')][_0x1e51('0x36')](_0x1e51('0x55'))){_0x17a9fd[_0x1e51('0x1d')]=qs[_0x1e51('0x1d')](_0x4d6d41[_0x1e51('0x2f')]['limit']);_0x17a9fd[_0x1e51('0x1c')]=qs['offset'](_0x4d6d41['query'][_0x1e51('0x1c')]);}_0x17a9fd[_0x1e51('0x37')]=qs[_0x1e51('0x38')](_0x4d6d41[_0x1e51('0x2f')][_0x1e51('0x38')]);_0x17a9fd[_0x1e51('0x3c')]=qs[_0x1e51('0x39')](_['pick'](_0x4d6d41[_0x1e51('0x2f')],_0xe1cfa0[_0x1e51('0x39')]));_0x17a9fd[_0x1e51('0x3c')]['CampaignId']=_0xa31c12['id'];if(_0x4d6d41['query'][_0x1e51('0x3b')]){_0x17a9fd[_0x1e51('0x3c')]=_['merge'](_0x17a9fd[_0x1e51('0x3c')],{'$or':_[_0x1e51('0x29')](_0x17a9fd['attributes'],function(_0x5eb939){var _0xe96651={};_0xe96651[_0x5eb939]={'$like':'%'+_0x4d6d41[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0xe96651;})});}_0x17a9fd=_[_0x1e51('0x3d')]({},_0x17a9fd,_0x4d6d41[_0x1e51('0x3f')]);return db[_0x1e51('0x56')][_0x1e51('0x1e')]({'where':_0x17a9fd['where']})['then'](function(_0x117a81){_0x35f12e[_0x1e51('0x1e')]=_0x117a81;if(_0x4d6d41['query'][_0x1e51('0x40')]){_0x17a9fd[_0x1e51('0x41')]=[{'all':!![]}];}return db['CmHopper'][_0x1e51('0x42')](_0x17a9fd);})['then'](function(_0x34b98f){_0x35f12e['rows']=_0x34b98f;return _0x35f12e;});}})['then'](respondWithFilteredResult(_0x4464bf,_0x17a9fd))['catch'](handleError(_0x4464bf,null));};exports['getHopperHistories']=function(_0x51ada3,_0x5a7201,_0x27d0ea){var _0x5aa741={'raw':!![],'where':{}};var _0xd05f32={};var _0x5682a6={'count':0x0,'rows':[]};return db[_0x1e51('0x2a')][_0x1e51('0x57')]({'where':{'id':_0x51ada3[_0x1e51('0x45')]['id']}})['then'](handleEntityNotFound(_0x5a7201,null))[_0x1e51('0x23')](function(_0x3ed4b1){if(_0x3ed4b1){_0xd05f32['model']=_[_0x1e51('0x30')](db['CmHopperHistory'][_0x1e51('0x2b')]);_0xd05f32['query']=_[_0x1e51('0x30')](_0x51ada3[_0x1e51('0x2f')]);_0xd05f32[_0x1e51('0x39')]=_[_0x1e51('0x31')](_0xd05f32[_0x1e51('0x35')],_0xd05f32[_0x1e51('0x2f')]);_0x5aa741['attributes']=_[_0x1e51('0x31')](_0xd05f32['model'],qs[_0x1e51('0x33')](_0x51ada3[_0x1e51('0x2f')][_0x1e51('0x33')]));_0x5aa741[_0x1e51('0x32')]=_0x5aa741['attributes']['length']?_0x5aa741['attributes']:_0xd05f32[_0x1e51('0x35')];if(!_0x51ada3[_0x1e51('0x2f')][_0x1e51('0x36')](_0x1e51('0x55'))){_0x5aa741['limit']=qs[_0x1e51('0x1d')](_0x51ada3['query'][_0x1e51('0x1d')]);_0x5aa741['offset']=qs['offset'](_0x51ada3[_0x1e51('0x2f')][_0x1e51('0x1c')]);}_0x5aa741['order']=qs[_0x1e51('0x38')](_0x51ada3['query'][_0x1e51('0x38')]);_0x5aa741['where']=qs[_0x1e51('0x39')](_[_0x1e51('0x3a')](_0x51ada3['query'],_0xd05f32[_0x1e51('0x39')]));_0x5aa741['where'][_0x1e51('0x58')]=_0x3ed4b1['id'];if(_0x51ada3[_0x1e51('0x2f')][_0x1e51('0x3b')]){_0x5aa741[_0x1e51('0x3c')]=_['merge'](_0x5aa741[_0x1e51('0x3c')],{'$or':_[_0x1e51('0x29')](_0x5aa741[_0x1e51('0x32')],function(_0x4ff0ff){var _0x4b62a4={};_0x4b62a4[_0x4ff0ff]={'$like':'%'+_0x51ada3[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x4b62a4;})});}_0x5aa741=_[_0x1e51('0x3d')]({},_0x5aa741,_0x51ada3['options']);return db['CmHopperHistory']['count']({'where':_0x5aa741[_0x1e51('0x3c')]})[_0x1e51('0x23')](function(_0x31788a){_0x5682a6['count']=_0x31788a;if(_0x51ada3[_0x1e51('0x2f')][_0x1e51('0x40')]){_0x5aa741['include']=[{'all':!![]}];}return db[_0x1e51('0x59')][_0x1e51('0x42')](_0x5aa741);})[_0x1e51('0x23')](function(_0x4af474){_0x5682a6[_0x1e51('0x43')]=_0x4af474;return _0x5682a6;});}})['then'](respondWithFilteredResult(_0x5a7201,_0x5aa741))[_0x1e51('0x4c')](handleError(_0x5a7201,null));};exports[_0x1e51('0x5a')]=function(_0x3525dc,_0x471b01,_0xd71adc){var _0x37a7ef={'raw':!![],'where':{}};var _0x37f26c={};var _0xa3225a={'count':0x0,'rows':[]};return db[_0x1e51('0x2a')]['findOne']({'where':{'id':_0x3525dc[_0x1e51('0x45')]['id']}})['then'](handleEntityNotFound(_0x471b01,null))[_0x1e51('0x23')](function(_0x4c7eb9){if(_0x4c7eb9){_0x37f26c[_0x1e51('0x35')]=_[_0x1e51('0x30')](db[_0x1e51('0x5b')][_0x1e51('0x2b')]);_0x37f26c[_0x1e51('0x2f')]=_[_0x1e51('0x30')](_0x3525dc[_0x1e51('0x2f')]);_0x37f26c[_0x1e51('0x39')]=_[_0x1e51('0x31')](_0x37f26c['model'],_0x37f26c[_0x1e51('0x2f')]);_0x37a7ef[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0x37f26c['model'],qs[_0x1e51('0x33')](_0x3525dc[_0x1e51('0x2f')][_0x1e51('0x33')]));_0x37a7ef['attributes']=_0x37a7ef[_0x1e51('0x32')][_0x1e51('0x34')]?_0x37a7ef[_0x1e51('0x32')]:_0x37f26c[_0x1e51('0x35')];if(!_0x3525dc[_0x1e51('0x2f')]['hasOwnProperty']('nolimit')){_0x37a7ef[_0x1e51('0x1d')]=qs['limit'](_0x3525dc['query'][_0x1e51('0x1d')]);_0x37a7ef[_0x1e51('0x1c')]=qs[_0x1e51('0x1c')](_0x3525dc[_0x1e51('0x2f')][_0x1e51('0x1c')]);}_0x37a7ef[_0x1e51('0x37')]=qs[_0x1e51('0x38')](_0x3525dc[_0x1e51('0x2f')][_0x1e51('0x38')]);_0x37a7ef['where']=qs[_0x1e51('0x39')](_[_0x1e51('0x3a')](_0x3525dc[_0x1e51('0x2f')],_0x37f26c['filters']));_0x37a7ef['where'][_0x1e51('0x58')]=_0x4c7eb9['id'];if(_0x3525dc[_0x1e51('0x2f')]['filter']){_0x37a7ef[_0x1e51('0x3c')]=_[_0x1e51('0x3d')](_0x37a7ef['where'],{'$or':_[_0x1e51('0x29')](_0x37a7ef[_0x1e51('0x32')],function(_0x4367ba){var _0x570c75={};_0x570c75[_0x4367ba]={'$like':'%'+_0x3525dc[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x570c75;})});}_0x37a7ef=_[_0x1e51('0x3d')]({},_0x37a7ef,_0x3525dc[_0x1e51('0x3f')]);return db[_0x1e51('0x5b')][_0x1e51('0x1e')]({'where':_0x37a7ef[_0x1e51('0x3c')]})[_0x1e51('0x23')](function(_0x1a8903){_0xa3225a[_0x1e51('0x1e')]=_0x1a8903;if(_0x3525dc['query']['includeAll']){_0x37a7ef[_0x1e51('0x41')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x37a7ef);})['then'](function(_0x251595){_0xa3225a['rows']=_0x251595;return _0xa3225a;});}})[_0x1e51('0x23')](respondWithFilteredResult(_0x471b01,_0x37a7ef))['catch'](handleError(_0x471b01,null));};exports[_0x1e51('0x5c')]=function(_0xb79285,_0x4859cd,_0x14d40c){var _0x5c4fe6={'raw':!![],'where':{}};var _0x7ebccd={};var _0x3f0cb2={'count':0x0,'rows':[]};return db['Campaign'][_0x1e51('0x57')]({'where':{'id':_0xb79285[_0x1e51('0x45')]['id']}})['then'](handleEntityNotFound(_0x4859cd,null))['then'](function(_0x4e99dd){if(_0x4e99dd){_0x7ebccd[_0x1e51('0x35')]=_[_0x1e51('0x30')](db[_0x1e51('0x5d')]['rawAttributes']);_0x7ebccd['query']=_[_0x1e51('0x30')](_0xb79285[_0x1e51('0x2f')]);_0x7ebccd[_0x1e51('0x39')]=_['intersection'](_0x7ebccd[_0x1e51('0x35')],_0x7ebccd[_0x1e51('0x2f')]);_0x5c4fe6[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0x7ebccd[_0x1e51('0x35')],qs[_0x1e51('0x33')](_0xb79285['query'][_0x1e51('0x33')]));_0x5c4fe6[_0x1e51('0x32')]=_0x5c4fe6[_0x1e51('0x32')]['length']?_0x5c4fe6['attributes']:_0x7ebccd[_0x1e51('0x35')];if(!_0xb79285['query']['hasOwnProperty']('nolimit')){_0x5c4fe6[_0x1e51('0x1d')]=qs[_0x1e51('0x1d')](_0xb79285[_0x1e51('0x2f')][_0x1e51('0x1d')]);_0x5c4fe6['offset']=qs['offset'](_0xb79285['query'][_0x1e51('0x1c')]);}_0x5c4fe6['order']=qs[_0x1e51('0x38')](_0xb79285[_0x1e51('0x2f')][_0x1e51('0x38')]);_0x5c4fe6[_0x1e51('0x3c')]=qs[_0x1e51('0x39')](_[_0x1e51('0x3a')](_0xb79285[_0x1e51('0x2f')],_0x7ebccd['filters']));_0x5c4fe6[_0x1e51('0x3c')][_0x1e51('0x58')]=_0x4e99dd['id'];if(_0xb79285[_0x1e51('0x2f')][_0x1e51('0x3b')]){_0x5c4fe6['where']=_[_0x1e51('0x3d')](_0x5c4fe6[_0x1e51('0x3c')],{'$or':_['map'](_0x5c4fe6[_0x1e51('0x32')],function(_0x2ab009){var _0x42ae53={};_0x42ae53[_0x2ab009]={'$like':'%'+_0xb79285[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x42ae53;})});}_0x5c4fe6=_[_0x1e51('0x3d')]({},_0x5c4fe6,_0xb79285[_0x1e51('0x3f')]);return db[_0x1e51('0x5d')][_0x1e51('0x1e')]({'where':_0x5c4fe6[_0x1e51('0x3c')]})['then'](function(_0x210df0){_0x3f0cb2[_0x1e51('0x1e')]=_0x210df0;if(_0xb79285[_0x1e51('0x2f')][_0x1e51('0x40')]){_0x5c4fe6[_0x1e51('0x41')]=[{'all':!![]}];}return db[_0x1e51('0x5d')][_0x1e51('0x42')](_0x5c4fe6);})[_0x1e51('0x23')](function(_0x1e1c48){_0x3f0cb2[_0x1e51('0x43')]=_0x1e1c48;return _0x3f0cb2;});}})[_0x1e51('0x23')](respondWithFilteredResult(_0x4859cd,_0x5c4fe6))['catch'](handleError(_0x4859cd,null));};exports[_0x1e51('0x5e')]=function(_0x3fa83a,_0x4c0f22,_0x5ae595){var _0x4595d6={};var _0x3ac432={};var _0x9aa50a;var _0x8cf4bc;return db[_0x1e51('0x2a')][_0x1e51('0x57')]({'where':{'id':_0x3fa83a['params']['id']}})['then'](handleEntityNotFound(_0x4c0f22,null))[_0x1e51('0x23')](function(_0x324a68){if(_0x324a68){_0x9aa50a=_0x324a68;_0x3ac432['model']=_[_0x1e51('0x30')](db[_0x1e51('0x5f')][_0x1e51('0x2b')]);_0x3ac432['query']=_[_0x1e51('0x30')](_0x3fa83a[_0x1e51('0x2f')]);_0x3ac432[_0x1e51('0x39')]=_['intersection'](_0x3ac432[_0x1e51('0x35')],_0x3ac432[_0x1e51('0x2f')]);_0x4595d6[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0x3ac432['model'],qs[_0x1e51('0x33')](_0x3fa83a[_0x1e51('0x2f')]['fields']));_0x4595d6[_0x1e51('0x32')]=_0x4595d6[_0x1e51('0x32')][_0x1e51('0x34')]?_0x4595d6[_0x1e51('0x32')]:_0x3ac432['model'];_0x4595d6[_0x1e51('0x37')]=qs[_0x1e51('0x38')](_0x3fa83a[_0x1e51('0x2f')][_0x1e51('0x38')]);_0x4595d6[_0x1e51('0x3c')]=qs['filters'](_[_0x1e51('0x3a')](_0x3fa83a[_0x1e51('0x2f')],_0x3ac432[_0x1e51('0x39')]));if(_0x3fa83a[_0x1e51('0x2f')]['filter']){_0x4595d6['where']=_[_0x1e51('0x3d')](_0x4595d6['where'],{'$or':_['map'](_0x4595d6[_0x1e51('0x32')],function(_0x2db20f){var _0x1425f4={};_0x1425f4[_0x2db20f]={'$like':'%'+_0x3fa83a[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x1425f4;})});}_0x4595d6=_[_0x1e51('0x3d')]({},_0x4595d6,_0x3fa83a['options']);return _0x9aa50a[_0x1e51('0x5e')](_0x4595d6);}})[_0x1e51('0x23')](function(_0x5bfd77){if(_0x5bfd77){_0x8cf4bc=_0x5bfd77['length'];if(!_0x3fa83a['query']['hasOwnProperty'](_0x1e51('0x55'))){_0x4595d6[_0x1e51('0x1d')]=qs['limit'](_0x3fa83a[_0x1e51('0x2f')][_0x1e51('0x1d')]);_0x4595d6[_0x1e51('0x1c')]=qs[_0x1e51('0x1c')](_0x3fa83a[_0x1e51('0x2f')][_0x1e51('0x1c')]);}return _0x9aa50a[_0x1e51('0x5e')](_0x4595d6);}})[_0x1e51('0x23')](function(_0x236554){if(_0x236554){return _0x236554?{'count':_0x8cf4bc,'rows':_0x236554}:null;}})[_0x1e51('0x23')](respondWithResult(_0x4c0f22,null))[_0x1e51('0x4c')](handleError(_0x4c0f22,null));};exports['addLists']=function(_0x1d3b1d,_0x26eaa8,_0x41f919){var _0xafac74,_0x4ac5bd;var _0x4fbf59=[];var _0x358507=moment()[_0x1e51('0x60')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x1e51('0x2a')][_0x1e51('0x46')]({'where':{'id':_0x1d3b1d['params']['id']}})['then'](handleEntityNotFound(_0x26eaa8,null))[_0x1e51('0x23')](function(_0xc10372){if(_0xc10372){_0x4ac5bd=_0xc10372;return _0xc10372['addLists'](_0x1d3b1d[_0x1e51('0x4f')][_0x1e51('0x61')],_[_0x1e51('0x50')](_0x1d3b1d['body'],[_0x1e51('0x61'),'id'])||{});}return null;})['spread'](function(_0x5b6915){var _0x54ed06;var _0x46277a;_0xafac74=_0x5b6915||[];var _0x563d4b=[];if(_0x5b6915){for(var _0x5b959d=0x0;_0x5b959d<_0x5b6915[_0x1e51('0x34')];_0x5b959d+=0x1){var _0x30d666=_0x5b6915[_0x5b959d][_0x1e51('0x24')]({'plain':!![]});_0x4ac5bd[_0x1e51('0x62')]=_0x1d3b1d[_0x1e51('0x4f')][_0x1e51('0x62')]?_0x1d3b1d[_0x1e51('0x4f')][_0x1e51('0x62')]:_0x4ac5bd[_0x1e51('0x62')];switch(_0x4ac5bd[_0x1e51('0x62')]){case _0x1e51('0x63'):_0x54ed06=squel[_0x1e51('0x64')]()[_0x1e51('0x65')]('cm_hopper')[_0x1e51('0x66')]([_0x1e51('0x67'),_0x1e51('0x68'),'ContactId',_0x1e51('0x69'),_0x1e51('0x58'),'createdAt',_0x1e51('0x4e')],squel[_0x1e51('0x6a')]()[_0x1e51('0x6b')](_0x1e51('0x67'),_0x1e51('0x67'))[_0x1e51('0x6b')](_0x1e51('0x6c'),_0x1e51('0x68'))[_0x1e51('0x6b')]('id',_0x1e51('0x6d'))[_0x1e51('0x6b')](_0x30d666[_0x1e51('0x6e')][_0x1e51('0x6f')](),_0x1e51('0x69'))[_0x1e51('0x6b')](_0x1d3b1d[_0x1e51('0x45')]['id']['toString'](),_0x1e51('0x58'))[_0x1e51('0x6b')]('\x27'+_0x358507+'\x27',_0x1e51('0x51'))['field']('\x27'+_0x358507+'\x27','updatedAt')[_0x1e51('0x70')](_0x1e51('0x71'))[_0x1e51('0x3c')](_0x1e51('0x72'))[_0x1e51('0x3c')]('ListId\x20=\x20?',_0x30d666['CmListId'][_0x1e51('0x6f')]())[_0x1e51('0x3c')](_0x1e51('0x73'))[_0x1e51('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1e51('0x6a')]()[_0x1e51('0x6b')](_0x1e51('0x74'))[_0x1e51('0x70')](_0x1e51('0x75'))[_0x1e51('0x3c')](_0x1e51('0x76'),_0x1d3b1d[_0x1e51('0x45')]['id'][_0x1e51('0x6f')]()))['where'](_0x1e51('0x77'),squel[_0x1e51('0x6a')]()[_0x1e51('0x6b')](_0x1e51('0x78'))[_0x1e51('0x70')](_0x1e51('0x79'))[_0x1e51('0x3c')](_0x1e51('0x76'),_0x1d3b1d['params']['id'][_0x1e51('0x6f')]())))[_0x1e51('0x6f')]();break;case _0x1e51('0x7a'):_0x54ed06=squel[_0x1e51('0x64')]()[_0x1e51('0x65')](_0x1e51('0x79'))[_0x1e51('0x66')](['phone','scheduledAt',_0x1e51('0x6d'),'ListId',_0x1e51('0x58'),'createdAt',_0x1e51('0x4e')],squel[_0x1e51('0x6a')]()[_0x1e51('0x6b')](_0x1e51('0x67'),'phone')[_0x1e51('0x6b')]('NOW()',_0x1e51('0x68'))['field']('id',_0x1e51('0x6d'))['field'](_0x30d666[_0x1e51('0x6e')][_0x1e51('0x6f')](),_0x1e51('0x69'))[_0x1e51('0x6b')](_0x1d3b1d[_0x1e51('0x45')]['id']['toString'](),_0x1e51('0x58'))[_0x1e51('0x6b')]('\x27'+_0x358507+'\x27','createdAt')[_0x1e51('0x6b')]('\x27'+_0x358507+'\x27','updatedAt')[_0x1e51('0x70')](_0x1e51('0x71'))[_0x1e51('0x3c')](_0x1e51('0x72'))['where'](_0x1e51('0x7b'),_0x30d666[_0x1e51('0x6e')]['toString']())[_0x1e51('0x3c')](_0x1e51('0x73'))[_0x1e51('0x3c')](_0x1e51('0x77'),squel[_0x1e51('0x6a')]()[_0x1e51('0x6b')](_0x1e51('0x78'))[_0x1e51('0x70')](_0x1e51('0x79'))[_0x1e51('0x3c')](_0x1e51('0x76'),_0x1d3b1d[_0x1e51('0x45')]['id'][_0x1e51('0x6f')]())))[_0x1e51('0x6f')]();break;default:_0x54ed06=squel[_0x1e51('0x64')]()[_0x1e51('0x65')](_0x1e51('0x79'))[_0x1e51('0x66')]([_0x1e51('0x67'),_0x1e51('0x68'),_0x1e51('0x6d'),_0x1e51('0x69'),_0x1e51('0x58'),'createdAt',_0x1e51('0x4e')],squel['select']()[_0x1e51('0x6b')]('phone','phone')[_0x1e51('0x6b')]('NOW()',_0x1e51('0x68'))[_0x1e51('0x6b')]('id','ContactId')[_0x1e51('0x6b')](_0x30d666[_0x1e51('0x6e')][_0x1e51('0x6f')](),_0x1e51('0x69'))['field'](_0x1d3b1d[_0x1e51('0x45')]['id'][_0x1e51('0x6f')](),'CampaignId')['field']('\x27'+_0x358507+'\x27',_0x1e51('0x51'))[_0x1e51('0x6b')]('\x27'+_0x358507+'\x27',_0x1e51('0x4e'))[_0x1e51('0x70')](_0x1e51('0x71'))[_0x1e51('0x3c')](_0x1e51('0x72'))[_0x1e51('0x3c')](_0x1e51('0x7b'),_0x30d666[_0x1e51('0x6e')][_0x1e51('0x6f')]())[_0x1e51('0x3c')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x46277a=squel[_0x1e51('0x64')]()[_0x1e51('0x65')]('cm_hopper_additional_phones')['fromQuery']([_0x1e51('0x7c'),'scheduledAt',_0x1e51('0x67'),_0x1e51('0x7d'),_0x1e51('0x51'),_0x1e51('0x4e')],squel[_0x1e51('0x6a')]()['field']('h.id','id')[_0x1e51('0x6b')](_0x1e51('0x6c'),_0x1e51('0x68'))['field'](_0x1e51('0x7e'),_0x1e51('0x67'))[_0x1e51('0x6b')](_0x1e51('0x7f'),_0x1e51('0x7d'))['field']('\x27'+_0x358507+'\x27',_0x1e51('0x51'))[_0x1e51('0x6b')]('\x27'+_0x358507+'\x27',_0x1e51('0x4e'))['from']('cm_contact_has_items','ci')[_0x1e51('0x80')](_0x1e51('0x79'),'h',_0x1e51('0x81'))[_0x1e51('0x3c')]('h.ListId\x20=\x20?',_0x30d666[_0x1e51('0x6e')][_0x1e51('0x6f')]())[_0x1e51('0x3c')](_0x1e51('0x82'),_0x1d3b1d[_0x1e51('0x45')]['id'][_0x1e51('0x6f')]())[_0x1e51('0x3c')](_0x1e51('0x83'),_0x358507))[_0x1e51('0x6f')]();_0x563d4b[_0x1e51('0x84')](db[_0x1e51('0x85')][_0x1e51('0x2f')](_0x54ed06));_0x4fbf59[_0x1e51('0x84')](db[_0x1e51('0x85')]['query'](_0x46277a));}return BPromise[_0x1e51('0x86')](_0x563d4b);}})['then'](function(){return BPromise['all'](_0x4fbf59);})[_0x1e51('0x23')](function(){return _0xafac74;})[_0x1e51('0x23')](respondWithResult(_0x26eaa8,null))[_0x1e51('0x4c')](handleError(_0x26eaa8,null));};exports[_0x1e51('0x87')]=function(_0x29668d,_0x584ea6,_0xd3a3c6){return db[_0x1e51('0x2a')][_0x1e51('0x46')]({'where':{'id':_0x29668d[_0x1e51('0x45')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x584ea6,null))[_0x1e51('0x23')](function(_0x272bbd){if(_0x272bbd){return _0x272bbd[_0x1e51('0x87')](_0x29668d[_0x1e51('0x2f')]['ids']);}})['then'](function(_0x4f5c91){if(_0x4f5c91){return db['CmHopper'][_0x1e51('0x88')]({'where':{'ListId':_0x29668d[_0x1e51('0x2f')][_0x1e51('0x61')],'CampaignId':_0x29668d['params']['id']}})[_0x1e51('0x23')](function(){return _0x4f5c91;});}})[_0x1e51('0x23')](respondWithStatusCode(_0x584ea6,null))['catch'](handleError(_0x584ea6,null));};exports[_0x1e51('0x89')]=function(_0x2fb27e,_0x469630,_0x6e245b){var _0x40a50b={};var _0x403cdc={};var _0x991c72;var _0x5076d9;return db[_0x1e51('0x2a')][_0x1e51('0x57')]({'where':{'id':_0x2fb27e[_0x1e51('0x45')]['id']}})['then'](handleEntityNotFound(_0x469630,null))[_0x1e51('0x23')](function(_0x4e9221){if(_0x4e9221){_0x991c72=_0x4e9221;_0x403cdc[_0x1e51('0x35')]=_[_0x1e51('0x30')](db['CmList'][_0x1e51('0x2b')]);_0x403cdc[_0x1e51('0x2f')]=_['keys'](_0x2fb27e[_0x1e51('0x2f')]);_0x403cdc[_0x1e51('0x39')]=_[_0x1e51('0x31')](_0x403cdc[_0x1e51('0x35')],_0x403cdc[_0x1e51('0x2f')]);_0x40a50b[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0x403cdc[_0x1e51('0x35')],qs[_0x1e51('0x33')](_0x2fb27e[_0x1e51('0x2f')]['fields']));_0x40a50b['attributes']=_0x40a50b[_0x1e51('0x32')][_0x1e51('0x34')]?_0x40a50b[_0x1e51('0x32')]:_0x403cdc[_0x1e51('0x35')];_0x40a50b[_0x1e51('0x37')]=qs['sort'](_0x2fb27e[_0x1e51('0x2f')][_0x1e51('0x38')]);_0x40a50b[_0x1e51('0x3c')]=qs['filters'](_['pick'](_0x2fb27e[_0x1e51('0x2f')],_0x403cdc[_0x1e51('0x39')]));if(_0x2fb27e[_0x1e51('0x2f')][_0x1e51('0x3b')]){_0x40a50b[_0x1e51('0x3c')]=_[_0x1e51('0x3d')](_0x40a50b[_0x1e51('0x3c')],{'$or':_[_0x1e51('0x29')](_0x40a50b[_0x1e51('0x32')],function(_0x36f888){var _0x4a9dc2={};_0x4a9dc2[_0x36f888]={'$like':'%'+_0x2fb27e['query'][_0x1e51('0x3b')]+'%'};return _0x4a9dc2;})});}_0x40a50b=_['merge']({},_0x40a50b,_0x2fb27e[_0x1e51('0x3f')]);return _0x991c72[_0x1e51('0x89')](_0x40a50b);}})[_0x1e51('0x23')](function(_0x34c7d5){if(_0x34c7d5){_0x5076d9=_0x34c7d5[_0x1e51('0x34')];if(!_0x2fb27e[_0x1e51('0x2f')][_0x1e51('0x36')](_0x1e51('0x55'))){_0x40a50b['limit']=qs[_0x1e51('0x1d')](_0x2fb27e[_0x1e51('0x2f')][_0x1e51('0x1d')]);_0x40a50b[_0x1e51('0x1c')]=qs[_0x1e51('0x1c')](_0x2fb27e[_0x1e51('0x2f')][_0x1e51('0x1c')]);}return _0x991c72[_0x1e51('0x89')](_0x40a50b);}})[_0x1e51('0x23')](function(_0x38b2ab){if(_0x38b2ab){return _0x38b2ab?{'count':_0x5076d9,'rows':_0x38b2ab}:null;}})[_0x1e51('0x23')](respondWithResult(_0x469630,null))[_0x1e51('0x4c')](handleError(_0x469630,null));};exports['addBlackLists']=function(_0x11a8b6,_0x7eab7a,_0x4002cf){var _0x2bcf63,_0x409830;var _0x169d6f=[];var _0x453835=moment()[_0x1e51('0x60')](_0x1e51('0x8a'));return db[_0x1e51('0x2a')][_0x1e51('0x46')]({'where':{'id':_0x11a8b6['params']['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x7eab7a,null))['then'](function(_0x4f9569){if(_0x4f9569){_0x409830=_0x4f9569;return _0x4f9569[_0x1e51('0x8b')](_0x11a8b6[_0x1e51('0x4f')][_0x1e51('0x61')],_[_0x1e51('0x50')](_0x11a8b6['body'],[_0x1e51('0x61'),'id'])||{});}return null;})[_0x1e51('0x8c')](function(_0x19157e){var _0x5ea4c8;var _0xe52966;_0x2bcf63=_0x19157e||[];var _0x532591=[];if(_0x19157e){for(var _0x487e5f=0x0;_0x487e5f<_0x19157e['length'];_0x487e5f+=0x1){var _0x211923=_0x19157e[_0x487e5f][_0x1e51('0x24')]({'plain':!![]});_0x5ea4c8=squel[_0x1e51('0x64')]()[_0x1e51('0x65')](_0x1e51('0x8d'))[_0x1e51('0x66')](['phone',_0x1e51('0x6d'),'ListId','CampaignId','createdAt','updatedAt'],squel[_0x1e51('0x6a')]()[_0x1e51('0x6b')]('phone','phone')[_0x1e51('0x6b')]('id',_0x1e51('0x6d'))['field'](_0x211923[_0x1e51('0x6e')][_0x1e51('0x6f')](),'ListId')[_0x1e51('0x6b')](_0x11a8b6[_0x1e51('0x45')]['id']['toString'](),'CampaignId')[_0x1e51('0x6b')](_0x1e51('0x6c'),_0x1e51('0x51'))[_0x1e51('0x6b')](_0x1e51('0x6c'),_0x1e51('0x4e'))['from'](_0x1e51('0x71'))[_0x1e51('0x3c')](_0x1e51('0x72'))[_0x1e51('0x3c')](_0x1e51('0x7b'),_0x211923[_0x1e51('0x6e')][_0x1e51('0x6f')]())[_0x1e51('0x3c')](_0x1e51('0x73')))[_0x1e51('0x6f')]();_0x532591[_0x1e51('0x84')](db[_0x1e51('0x85')][_0x1e51('0x2f')](_0x5ea4c8));}return BPromise[_0x1e51('0x86')](_0x532591);}})[_0x1e51('0x23')](function(){return _0x2bcf63;})[_0x1e51('0x23')](respondWithResult(_0x7eab7a,null))['catch'](handleError(_0x7eab7a,null));};exports[_0x1e51('0x8e')]=function(_0x5e8072,_0x52091b,_0x2b758){return db[_0x1e51('0x2a')][_0x1e51('0x46')]({'where':{'id':_0x5e8072[_0x1e51('0x45')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x52091b,null))['then'](function(_0x5c135a){if(_0x5c135a){return _0x5c135a[_0x1e51('0x8e')](_0x5e8072['query'][_0x1e51('0x61')]);}})[_0x1e51('0x23')](function(_0x3a70a0){if(_0x3a70a0){return db['CmHopperBlack'][_0x1e51('0x88')]({'where':{'ListId':_0x5e8072[_0x1e51('0x2f')][_0x1e51('0x61')],'CampaignId':_0x5e8072[_0x1e51('0x45')]['id']}})['then'](function(){return _0x3a70a0;});}})[_0x1e51('0x23')](respondWithStatusCode(_0x52091b,null))['catch'](handleError(_0x52091b,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index fc413f9..a565498 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x16446a,_0x5e9140){var _0x2c7051=function(_0x2e6a25){while(--_0x2e6a25){_0x16446a['push'](_0x16446a['shift']());}};_0x2c7051(++_0x5e9140);}(_0x7a54,0x106));var _0x47a5=function(_0x3f0407,_0x25a746){_0x3f0407=_0x3f0407-0x0;var _0x25863d=_0x7a54[_0x3f0407];return _0x25863d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x2703cf,_0x526b31){var _0x28f18a=function(_0x10e33b){while(--_0x10e33b){_0x2703cf['push'](_0x2703cf['shift']());}};_0x28f18a(++_0x526b31);}(_0x7a54,0x106));var _0x47a5=function(_0x1ed99a,_0x4d4005){_0x1ed99a=_0x1ed99a-0x0;var _0x15ba4e=_0x7a54[_0x1ed99a];return _0x15ba4e;};'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 76e18a9..ace6b93 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 _0x98e1=['client','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','message','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','GetCampaign','stringify','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x3c414c,_0x399dbb){var _0x4f3062=function(_0x1b71cc){while(--_0x1b71cc){_0x3c414c['push'](_0x3c414c['shift']());}};_0x4f3062(++_0x399dbb);}(_0x98e1,0x160));var _0x198e=function(_0x26a692,_0xacd9b7){_0x26a692=_0x26a692-0x0;var _0x277f46=_0x98e1[_0x26a692];return _0x277f46;};'use strict';var _=require('lodash');var util=require(_0x198e('0x0'));var moment=require(_0x198e('0x1'));var BPromise=require(_0x198e('0x2'));var rs=require(_0x198e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x198e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x198e('0x5'));var config=require(_0x198e('0x6'));var jayson=require(_0x198e('0x7'));var client=jayson[_0x198e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x545114,_0x46ac1b,_0x4d45d6){return new BPromise(function(_0x3322c5,_0x5ba06f){return client[_0x198e('0x9')](_0x545114,_0x4d45d6)[_0x198e('0xa')](function(_0x1ea2bf){logger[_0x198e('0xb')](_0x198e('0xc'),_0x46ac1b,_0x198e('0xd'));logger[_0x198e('0xe')](_0x198e('0xf'),_0x46ac1b,_0x198e('0xd'),JSON['stringify'](_0x1ea2bf));if(_0x1ea2bf[_0x198e('0x10')]){if(_0x1ea2bf[_0x198e('0x10')]['code']===0x1f4){logger[_0x198e('0x10')]('Campaign,\x20%s,\x20%s',_0x46ac1b,_0x1ea2bf[_0x198e('0x10')]['message']);return _0x5ba06f(_0x1ea2bf['error']['message']);}logger['error'](_0x198e('0xc'),_0x46ac1b,_0x1ea2bf[_0x198e('0x10')][_0x198e('0x11')]);return _0x3322c5(_0x1ea2bf['error'][_0x198e('0x11')]);}else{logger[_0x198e('0xb')](_0x198e('0xc'),_0x46ac1b,'request\x20sent');_0x3322c5(_0x1ea2bf['result']['message']);}})['catch'](function(_0x57f15e){logger[_0x198e('0x10')]('Campaign,\x20%s,\x20%s',_0x46ac1b,_0x57f15e);_0x5ba06f(_0x57f15e);});});}exports['GetCampaign']=function(_0x440975){var _0x46c980=this;return new Promise(function(_0x2485ea,_0x4cbf50){return db[_0x198e('0x12')][_0x198e('0x13')]({'raw':_0x440975[_0x198e('0x14')]?_0x440975[_0x198e('0x14')][_0x198e('0x15')]===undefined?!![]:![]:!![],'where':_0x440975['options']?_0x440975[_0x198e('0x14')][_0x198e('0x16')]||null:null,'attributes':_0x440975['options']?_0x440975[_0x198e('0x14')][_0x198e('0x17')]||null:null,'limit':_0x440975[_0x198e('0x14')]?_0x440975[_0x198e('0x14')][_0x198e('0x18')]||null:null,'include':_0x440975[_0x198e('0x14')]?_0x440975['options'][_0x198e('0x19')]?_[_0x198e('0x1a')](_0x440975[_0x198e('0x14')][_0x198e('0x19')],function(_0x17d04d){return{'model':db[_0x17d04d[_0x198e('0x1b')]],'as':_0x17d04d['as'],'attributes':_0x17d04d[_0x198e('0x17')],'include':_0x17d04d['include']?_[_0x198e('0x1a')](_0x17d04d[_0x198e('0x19')],function(_0x1fceba){return{'model':db[_0x1fceba[_0x198e('0x1b')]],'as':_0x1fceba['as'],'attributes':_0x1fceba[_0x198e('0x17')],'include':_0x1fceba[_0x198e('0x19')]?_[_0x198e('0x1a')](_0x1fceba[_0x198e('0x19')],function(_0x66c071){return{'model':db[_0x66c071['model']],'as':_0x66c071['as'],'attributes':_0x66c071['attributes']};}):[]};}):[]};}):[]:[]})[_0x198e('0xa')](function(_0x1a249c){logger['info']('GetCampaign',_0x440975);logger[_0x198e('0xe')](_0x198e('0x1c'),_0x440975,JSON[_0x198e('0x1d')](_0x1a249c));_0x2485ea(_0x1a249c);})['catch'](function(_0x5e657e){logger[_0x198e('0x10')](_0x198e('0x1c'),_0x5e657e[_0x198e('0x11')],_0x440975);_0x4cbf50(_0x46c980[_0x198e('0x10')](0x1f4,_0x5e657e[_0x198e('0x11')]));});});}; \ No newline at end of file +var _0xcffe=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','Campaign','options','raw','where','attributes','map','include','model'];(function(_0x57fa5c,_0x22d1e7){var _0x270ebe=function(_0xf97a43){while(--_0xf97a43){_0x57fa5c['push'](_0x57fa5c['shift']());}};_0x270ebe(++_0x22d1e7);}(_0xcffe,0x1a1));var _0xecff=function(_0x1e2372,_0x2ea876){_0x1e2372=_0x1e2372-0x0;var _0x4cd59b=_0xcffe[_0x1e2372];return _0x4cd59b;};'use strict';var _=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var moment=require(_0xecff('0x2'));var BPromise=require(_0xecff('0x3'));var rs=require(_0xecff('0x4'));var fs=require('fs');var Redis=require(_0xecff('0x5'));var db=require(_0xecff('0x6'))['db'];var utils=require(_0xecff('0x7'));var logger=require(_0xecff('0x8'))(_0xecff('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xecff('0xa')][_0xecff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e2fa9,_0x38a8f6,_0x50c98b){return new BPromise(function(_0x298c19,_0x1f7386){return client['request'](_0x2e2fa9,_0x50c98b)[_0xecff('0xc')](function(_0x3eefb9){logger[_0xecff('0xd')](_0xecff('0xe'),_0x38a8f6,_0xecff('0xf'));logger['debug'](_0xecff('0x10'),_0x38a8f6,_0xecff('0xf'),JSON[_0xecff('0x11')](_0x3eefb9));if(_0x3eefb9[_0xecff('0x12')]){if(_0x3eefb9[_0xecff('0x12')][_0xecff('0x13')]===0x1f4){logger[_0xecff('0x12')](_0xecff('0xe'),_0x38a8f6,_0x3eefb9[_0xecff('0x12')][_0xecff('0x14')]);return _0x1f7386(_0x3eefb9[_0xecff('0x12')][_0xecff('0x14')]);}logger[_0xecff('0x12')](_0xecff('0xe'),_0x38a8f6,_0x3eefb9['error']['message']);return _0x298c19(_0x3eefb9[_0xecff('0x12')][_0xecff('0x14')]);}else{logger['info'](_0xecff('0xe'),_0x38a8f6,_0xecff('0xf'));_0x298c19(_0x3eefb9[_0xecff('0x15')]['message']);}})['catch'](function(_0x24abef){logger[_0xecff('0x12')]('Campaign,\x20%s,\x20%s',_0x38a8f6,_0x24abef);_0x1f7386(_0x24abef);});});}exports[_0xecff('0x16')]=function(_0x3adc81){var _0x319ba5=this;return new Promise(function(_0x2393db,_0x2fc1f9){return db[_0xecff('0x17')]['findAll']({'raw':_0x3adc81[_0xecff('0x18')]?_0x3adc81[_0xecff('0x18')][_0xecff('0x19')]===undefined?!![]:![]:!![],'where':_0x3adc81[_0xecff('0x18')]?_0x3adc81['options'][_0xecff('0x1a')]||null:null,'attributes':_0x3adc81[_0xecff('0x18')]?_0x3adc81[_0xecff('0x18')][_0xecff('0x1b')]||null:null,'limit':_0x3adc81[_0xecff('0x18')]?_0x3adc81[_0xecff('0x18')]['limit']||null:null,'include':_0x3adc81[_0xecff('0x18')]?_0x3adc81['options']['include']?_[_0xecff('0x1c')](_0x3adc81['options'][_0xecff('0x1d')],function(_0x49c0cd){return{'model':db[_0x49c0cd[_0xecff('0x1e')]],'as':_0x49c0cd['as'],'attributes':_0x49c0cd['attributes'],'include':_0x49c0cd[_0xecff('0x1d')]?_[_0xecff('0x1c')](_0x49c0cd['include'],function(_0x9f173d){return{'model':db[_0x9f173d[_0xecff('0x1e')]],'as':_0x9f173d['as'],'attributes':_0x9f173d[_0xecff('0x1b')],'include':_0x9f173d[_0xecff('0x1d')]?_[_0xecff('0x1c')](_0x9f173d['include'],function(_0x4f987b){return{'model':db[_0x4f987b[_0xecff('0x1e')]],'as':_0x4f987b['as'],'attributes':_0x4f987b['attributes']};}):[]};}):[]};}):[]:[]})[_0xecff('0xc')](function(_0x3ef198){logger[_0xecff('0xd')](_0xecff('0x16'),_0x3adc81);logger['debug']('GetCampaign',_0x3adc81,JSON['stringify'](_0x3ef198));_0x2393db(_0x3ef198);})[_0xecff('0x1f')](function(_0xabe5da){logger[_0xecff('0x12')](_0xecff('0x16'),_0xabe5da['message'],_0x3adc81);_0x2fc1f9(_0x319ba5[_0xecff('0x12')](0x1f4,_0xabe5da[_0xecff('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 3972e6e..66a2f03 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 _0x0ca4=['put','update','delete','destroy','removeLists','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getLists','/:id/blacklists','getBlackLists','create','clone','post','/:id/lists','addLists','addBlackLists'];(function(_0x6237a0,_0x2b681b){var _0x37c8da=function(_0x47eba1){while(--_0x47eba1){_0x6237a0['push'](_0x6237a0['shift']());}};_0x37c8da(++_0x2b681b);}(_0x0ca4,0x15a));var _0x40ca=function(_0x16da80,_0x43672e){_0x16da80=_0x16da80-0x0;var _0x180dbf=_0x0ca4[_0x16da80];return _0x180dbf;};'use strict';var multer=require(_0x40ca('0x0'));var util=require('util');var path=require(_0x40ca('0x1'));var timeout=require(_0x40ca('0x2'));var express=require(_0x40ca('0x3'));var router=express[_0x40ca('0x4')]();var fs_extra=require(_0x40ca('0x5'));var auth=require(_0x40ca('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x40ca('0x7'));var controller=require(_0x40ca('0x8'));router[_0x40ca('0x9')]('/',auth[_0x40ca('0xa')](),controller[_0x40ca('0xb')]);router[_0x40ca('0x9')](_0x40ca('0xc'),auth[_0x40ca('0xa')](),controller[_0x40ca('0xd')]);router[_0x40ca('0x9')](_0x40ca('0xe'),auth['isAuthenticated'](),controller[_0x40ca('0xf')]);router[_0x40ca('0x9')]('/:id/hopper_histories',auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x40ca('0x9')](_0x40ca('0x10'),auth[_0x40ca('0xa')](),controller[_0x40ca('0x11')]);router[_0x40ca('0x9')](_0x40ca('0x12'),auth[_0x40ca('0xa')](),controller['getHopperBlacks']);router[_0x40ca('0x9')]('/:id/lists',auth['isAuthenticated'](),controller[_0x40ca('0x13')]);router[_0x40ca('0x9')](_0x40ca('0x14'),auth['isAuthenticated'](),controller[_0x40ca('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0x40ca('0x16')]);router['post']('/:id/clone',auth[_0x40ca('0xa')](),controller[_0x40ca('0x17')]);router[_0x40ca('0x18')](_0x40ca('0x19'),auth[_0x40ca('0xa')](),controller[_0x40ca('0x1a')]);router['post'](_0x40ca('0x14'),auth['isAuthenticated'](),controller[_0x40ca('0x1b')]);router[_0x40ca('0x1c')](_0x40ca('0xc'),auth[_0x40ca('0xa')](),controller[_0x40ca('0x1d')]);router[_0x40ca('0x1e')]('/:id',auth[_0x40ca('0xa')](),controller[_0x40ca('0x1f')]);router[_0x40ca('0x1e')](_0x40ca('0x19'),auth[_0x40ca('0xa')](),controller[_0x40ca('0x20')]);router[_0x40ca('0x1e')](_0x40ca('0x14'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x40ca('0x21')]=router; \ No newline at end of file +var _0xab09=['post','create','/:id/clone','clone','update','delete','/:id','destroy','removeLists','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','getHoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists'];(function(_0x54c1db,_0x54ec32){var _0x1fa4c0=function(_0x2e1966){while(--_0x2e1966){_0x54c1db['push'](_0x54c1db['shift']());}};_0x1fa4c0(++_0x54ec32);}(_0xab09,0x6a));var _0x9ab0=function(_0x41010e,_0x25e9c5){_0x41010e=_0x41010e-0x0;var _0x59e342=_0xab09[_0x41010e];return _0x59e342;};'use strict';var multer=require('multer');var util=require(_0x9ab0('0x0'));var path=require(_0x9ab0('0x1'));var timeout=require(_0x9ab0('0x2'));var express=require(_0x9ab0('0x3'));var router=express[_0x9ab0('0x4')]();var fs_extra=require(_0x9ab0('0x5'));var auth=require(_0x9ab0('0x6'));var interaction=require(_0x9ab0('0x7'));var config=require(_0x9ab0('0x8'));var controller=require(_0x9ab0('0x9'));router[_0x9ab0('0xa')]('/',auth[_0x9ab0('0xb')](),controller[_0x9ab0('0xc')]);router[_0x9ab0('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9ab0('0xa')]('/:id/hoppers',auth[_0x9ab0('0xb')](),controller[_0x9ab0('0xd')]);router[_0x9ab0('0xa')]('/:id/hopper_histories',auth[_0x9ab0('0xb')](),controller[_0x9ab0('0xe')]);router[_0x9ab0('0xa')](_0x9ab0('0xf'),auth[_0x9ab0('0xb')](),controller['getHopperFinals']);router[_0x9ab0('0xa')](_0x9ab0('0x10'),auth[_0x9ab0('0xb')](),controller[_0x9ab0('0x11')]);router[_0x9ab0('0xa')](_0x9ab0('0x12'),auth['isAuthenticated'](),controller[_0x9ab0('0x13')]);router[_0x9ab0('0xa')](_0x9ab0('0x14'),auth[_0x9ab0('0xb')](),controller[_0x9ab0('0x15')]);router[_0x9ab0('0x16')]('/',auth['isAuthenticated'](),controller[_0x9ab0('0x17')]);router['post'](_0x9ab0('0x18'),auth['isAuthenticated'](),controller[_0x9ab0('0x19')]);router[_0x9ab0('0x16')](_0x9ab0('0x12'),auth[_0x9ab0('0xb')](),controller['addLists']);router[_0x9ab0('0x16')](_0x9ab0('0x14'),auth[_0x9ab0('0xb')](),controller['addBlackLists']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9ab0('0x1a')]);router[_0x9ab0('0x1b')](_0x9ab0('0x1c'),auth['isAuthenticated'](),controller[_0x9ab0('0x1d')]);router[_0x9ab0('0x1b')](_0x9ab0('0x12'),auth[_0x9ab0('0xb')](),controller[_0x9ab0('0x1e')]);router[_0x9ab0('0x1b')](_0x9ab0('0x14'),auth[_0x9ab0('0xb')](),controller['removeBlackLists']);module[_0x9ab0('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index b53f60b..47a89d6 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 _0xd0d1=['sequelize','STRING','VIRTUAL','getDataValue'];(function(_0x1643cb,_0x8af3cc){var _0x2d1147=function(_0x556e53){while(--_0x556e53){_0x1643cb['push'](_0x1643cb['shift']());}};_0x2d1147(++_0x8af3cc);}(_0xd0d1,0x16c));var _0x1d0d=function(_0xaf7008,_0x5c3cf2){_0xaf7008=_0xaf7008-0x0;var _0x1196bc=_0xd0d1[_0xaf7008];return _0x1196bc;};'use strict';var Sequelize=require(_0x1d0d('0x0'));module['exports']={'key':{'type':Sequelize[_0x1d0d('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x1d0d('0x1')]},'name':{'type':Sequelize[_0x1d0d('0x2')],'get':function(){return this[_0x1d0d('0x3')]('key');}}}; \ No newline at end of file +var _0x779b=['key','sequelize','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x40c402,_0x42ee7d){var _0x4e7680=function(_0x52b150){while(--_0x52b150){_0x40c402['push'](_0x40c402['shift']());}};_0x4e7680(++_0x42ee7d);}(_0x779b,0x1e4));var _0xb779=function(_0x1901f3,_0x49a7da){_0x1901f3=_0x1901f3-0x0;var _0x1d720d=_0x779b[_0x1901f3];return _0x1d720d;};'use strict';var Sequelize=require(_0xb779('0x0'));module[_0xb779('0x1')]={'key':{'type':Sequelize[_0xb779('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xb779('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xb779('0x2')]},'name':{'type':Sequelize[_0xb779('0x4')],'get':function(){return this[_0xb779('0x5')](_0xb779('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 1341021..f356006 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 _0x94ff=['stack','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','update','destroy','then','CannedAnswers','UserProfileResource','end','error'];(function(_0x421376,_0x1b449d){var _0x396d60=function(_0x4c4876){while(--_0x4c4876){_0x421376['push'](_0x421376['shift']());}};_0x396d60(++_0x1b449d);}(_0x94ff,0x186));var _0xf94f=function(_0x15dc77,_0x54d8b8){_0x15dc77=_0x15dc77-0x0;var _0x5e592e=_0x94ff[_0x15dc77];return _0x5e592e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf94f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf94f('0x1'));var moment=require('moment');var BPromise=require(_0xf94f('0x2'));var Mustache=require(_0xf94f('0x3'));var util=require('util');var path=require(_0xf94f('0x4'));var sox=require(_0xf94f('0x5'));var csv=require('to-csv');var ejs=require(_0xf94f('0x6'));var fs=require('fs');var fs_extra=require(_0xf94f('0x7'));var _=require(_0xf94f('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf94f('0x9'));var toCsv=require('to-csv');var querystring=require(_0xf94f('0xa'));var Papa=require(_0xf94f('0xb'));var Redis=require(_0xf94f('0xc'));var authService=require(_0xf94f('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf94f('0xe'))(_0xf94f('0xf'));var utils=require('../../config/utils');var config=require(_0xf94f('0x10'));var licenseUtil=require(_0xf94f('0x11'));var db=require(_0xf94f('0x12'))['db'];function respondWithStatusCode(_0x4c6701,_0x25fc83){_0x25fc83=_0x25fc83||0xcc;return function(_0x16a04e){if(_0x16a04e){return _0x4c6701[_0xf94f('0x13')](_0x25fc83);}return _0x4c6701[_0xf94f('0x14')](_0x25fc83)['end']();};}function respondWithResult(_0x33127e,_0x147d9d){_0x147d9d=_0x147d9d||0xc8;return function(_0x3a8578){if(_0x3a8578){return _0x33127e['status'](_0x147d9d)[_0xf94f('0x15')](_0x3a8578);}};}function respondWithFilteredResult(_0x408815,_0x47070c){return function(_0x5a5d2a){if(_0x5a5d2a){var _0x22c5f5=typeof _0x47070c[_0xf94f('0x16')]===_0xf94f('0x17')&&typeof _0x47070c['limit']===_0xf94f('0x17');var _0x350b17=_0x5a5d2a[_0xf94f('0x18')];var _0x4a8c7b=_0x22c5f5?0x0:_0x47070c[_0xf94f('0x16')];var _0x1747c3=_0x22c5f5?_0x5a5d2a[_0xf94f('0x18')]:_0x47070c[_0xf94f('0x16')]+_0x47070c['limit'];var _0x13145f;if(_0x1747c3>=_0x350b17){_0x1747c3=_0x350b17;_0x13145f=0xc8;}else{_0x13145f=0xce;}_0x408815[_0xf94f('0x14')](_0x13145f);return _0x408815[_0xf94f('0x19')](_0xf94f('0x1a'),_0x4a8c7b+'-'+_0x1747c3+'/'+_0x350b17)[_0xf94f('0x15')](_0x5a5d2a);}return null;};}function patchUpdates(_0x5de797){return function(_0x3acd16){try{jsonpatch['apply'](_0x3acd16,_0x5de797,!![]);}catch(_0x2b65b4){return BPromise[_0xf94f('0x1b')](_0x2b65b4);}return _0x3acd16['save']();};}function saveUpdates(_0x5a6627,_0x3bd161){return function(_0x5e280f){if(_0x5e280f){return _0x5e280f[_0xf94f('0x1c')](_0x5a6627)['then'](function(_0x2f7b5a){return _0x2f7b5a;});}return null;};}function removeEntity(_0x35311b,_0x3c64bc){return function(_0x4f397c){if(_0x4f397c){return _0x4f397c[_0xf94f('0x1d')]()[_0xf94f('0x1e')](function(){var _0x2728de=_0x4f397c['get']({'plain':!![]});var _0x30dcf3=_0xf94f('0x1f');return db[_0xf94f('0x20')]['destroy']({'where':{'type':_0x30dcf3,'resourceId':_0x2728de['id']}})[_0xf94f('0x1e')](function(){return _0x4f397c;});})[_0xf94f('0x1e')](function(){_0x35311b[_0xf94f('0x14')](0xcc)[_0xf94f('0x21')]();});}};}function handleEntityNotFound(_0x17b420,_0x360e4c){return function(_0x4a6d28){if(!_0x4a6d28){_0x17b420[_0xf94f('0x13')](0x194);}return _0x4a6d28;};}function handleError(_0x31a09b,_0xa7f381){_0xa7f381=_0xa7f381||0x1f4;return function(_0xd5d97e){logger[_0xf94f('0x22')](_0xd5d97e[_0xf94f('0x23')]);if(_0xd5d97e[_0xf94f('0x24')]){delete _0xd5d97e[_0xf94f('0x24')];}_0x31a09b[_0xf94f('0x14')](_0xa7f381)[_0xf94f('0x25')](_0xd5d97e);};}exports['index']=function(_0x41dd6d,_0x12aa56){var _0x2e3846={},_0x1e7394={},_0x7b5bd0={'count':0x0,'rows':[]};var _0x176023=_[_0xf94f('0x26')](db[_0xf94f('0x27')][_0xf94f('0x28')],function(_0x375c17){return{'name':_0x375c17[_0xf94f('0x29')],'type':_0x375c17[_0xf94f('0x2a')][_0xf94f('0x2b')]};});_0x1e7394[_0xf94f('0x2c')]=_['map'](_0x176023,_0xf94f('0x24'));_0x1e7394[_0xf94f('0x2d')]=_[_0xf94f('0x2e')](_0x41dd6d['query']);_0x1e7394[_0xf94f('0x2f')]=_['intersection'](_0x1e7394[_0xf94f('0x2c')],_0x1e7394[_0xf94f('0x2d')]);_0x2e3846[_0xf94f('0x30')]=_[_0xf94f('0x31')](_0x1e7394['model'],qs[_0xf94f('0x32')](_0x41dd6d[_0xf94f('0x2d')][_0xf94f('0x32')]));_0x2e3846['attributes']=_0x2e3846[_0xf94f('0x30')]['length']?_0x2e3846[_0xf94f('0x30')]:_0x1e7394[_0xf94f('0x2c')];if(!_0x41dd6d['query'][_0xf94f('0x33')](_0xf94f('0x34'))){_0x2e3846[_0xf94f('0x35')]=qs['limit'](_0x41dd6d[_0xf94f('0x2d')][_0xf94f('0x35')]);_0x2e3846[_0xf94f('0x16')]=qs[_0xf94f('0x16')](_0x41dd6d[_0xf94f('0x2d')][_0xf94f('0x16')]);}_0x2e3846['order']=qs['sort'](_0x41dd6d[_0xf94f('0x2d')][_0xf94f('0x36')]);_0x2e3846[_0xf94f('0x37')]=qs['filters'](_[_0xf94f('0x38')](_0x41dd6d[_0xf94f('0x2d')],_0x1e7394[_0xf94f('0x2f')]),_0x176023);if(_0x41dd6d[_0xf94f('0x2d')][_0xf94f('0x39')]){_0x2e3846[_0xf94f('0x37')]=_[_0xf94f('0x3a')](_0x2e3846[_0xf94f('0x37')],{'$or':[{'key':{'$like':'%'+_0x41dd6d[_0xf94f('0x2d')][_0xf94f('0x39')]+'%'}},{'value':{'$like':'%'+_0x41dd6d[_0xf94f('0x2d')][_0xf94f('0x39')]+'%'}}]});}_0x2e3846=_[_0xf94f('0x3a')]({},_0x2e3846,_0x41dd6d[_0xf94f('0x3b')]);var _0x2f444e={'where':_0x2e3846[_0xf94f('0x37')]};return db['CannedAnswer'][_0xf94f('0x18')](_0x2f444e)[_0xf94f('0x1e')](function(_0x1d752f){_0x7b5bd0['count']=_0x1d752f;if(_0x41dd6d[_0xf94f('0x2d')]['includeAll']){_0x2e3846[_0xf94f('0x3c')]=[{'all':!![]}];}return db[_0xf94f('0x27')][_0xf94f('0x3d')](_0x2e3846);})[_0xf94f('0x1e')](function(_0x4adc99){_0x7b5bd0[_0xf94f('0x3e')]=_0x4adc99;return _0x7b5bd0;})[_0xf94f('0x1e')](respondWithFilteredResult(_0x12aa56,_0x2e3846))[_0xf94f('0x3f')](handleError(_0x12aa56,null));};exports[_0xf94f('0x40')]=function(_0x2b4045,_0x365bc7){var _0x1db51c={'raw':!![],'where':{'id':_0x2b4045[_0xf94f('0x41')]['id']}},_0x4356ac={};_0x4356ac[_0xf94f('0x2c')]=_[_0xf94f('0x2e')](db[_0xf94f('0x27')]['rawAttributes']);_0x4356ac['query']=_[_0xf94f('0x2e')](_0x2b4045[_0xf94f('0x2d')]);_0x4356ac[_0xf94f('0x2f')]=_[_0xf94f('0x31')](_0x4356ac[_0xf94f('0x2c')],_0x4356ac[_0xf94f('0x2d')]);_0x1db51c['attributes']=_[_0xf94f('0x31')](_0x4356ac[_0xf94f('0x2c')],qs[_0xf94f('0x32')](_0x2b4045[_0xf94f('0x2d')][_0xf94f('0x32')]));_0x1db51c[_0xf94f('0x30')]=_0x1db51c['attributes'][_0xf94f('0x42')]?_0x1db51c['attributes']:_0x4356ac['model'];if(_0x2b4045[_0xf94f('0x2d')][_0xf94f('0x43')]){_0x1db51c[_0xf94f('0x3c')]=[{'all':!![]}];}_0x1db51c=_[_0xf94f('0x3a')]({},_0x1db51c,_0x2b4045['options']);return db[_0xf94f('0x27')][_0xf94f('0x44')](_0x1db51c)['then'](handleEntityNotFound(_0x365bc7,null))[_0xf94f('0x1e')](respondWithResult(_0x365bc7,null))['catch'](handleError(_0x365bc7,null));};exports['update']=function(_0xad7f72,_0x1e9d21){if(_0xad7f72[_0xf94f('0x45')]['id']){delete _0xad7f72[_0xf94f('0x45')]['id'];}return db[_0xf94f('0x27')][_0xf94f('0x44')]({'where':{'id':_0xad7f72[_0xf94f('0x41')]['id']}})[_0xf94f('0x1e')](handleEntityNotFound(_0x1e9d21,null))[_0xf94f('0x1e')](saveUpdates(_0xad7f72[_0xf94f('0x45')],null))[_0xf94f('0x1e')](respondWithResult(_0x1e9d21,null))[_0xf94f('0x3f')](handleError(_0x1e9d21,null));};exports[_0xf94f('0x1d')]=function(_0x2c1b68,_0x573317){return db['CannedAnswer'][_0xf94f('0x44')]({'where':{'id':_0x2c1b68[_0xf94f('0x41')]['id']}})[_0xf94f('0x1e')](handleEntityNotFound(_0x573317,null))[_0xf94f('0x1e')](removeEntity(_0x573317,null))[_0xf94f('0x3f')](handleError(_0x573317,null));};exports[_0xf94f('0x46')]=function(_0x14dafe,_0x60a43){var _0x1bb64b={'key':_0x14dafe[_0xf94f('0x45')][_0xf94f('0x2b')]};if(_0x14dafe['body'][_0xf94f('0x47')]){_0x1bb64b[_0xf94f('0x47')]=_0x14dafe[_0xf94f('0x45')][_0xf94f('0x47')];}else if(_0x14dafe[_0xf94f('0x45')][_0xf94f('0x48')]){_0x1bb64b['SmsAccountId']=_0x14dafe[_0xf94f('0x45')][_0xf94f('0x48')];}else if(_0x14dafe[_0xf94f('0x45')][_0xf94f('0x49')]){_0x1bb64b['OpenchannelAccountId']=_0x14dafe['body'][_0xf94f('0x49')];}else if(_0x14dafe[_0xf94f('0x45')][_0xf94f('0x4a')]){_0x1bb64b[_0xf94f('0x4a')]=_0x14dafe[_0xf94f('0x45')]['ChatWebsiteId'];}return db[_0xf94f('0x27')]['find']({'where':_0x1bb64b})[_0xf94f('0x1e')](function(_0x39f303){if(_0x39f303){throw new db[(_0xf94f('0x4b'))][(_0xf94f('0x4c'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xf94f('0x27')][_0xf94f('0x46')](_0x14dafe[_0xf94f('0x45')]);})[_0xf94f('0x1e')](function(_0x3c7b19){var _0x203ef6=_0x14dafe[_0xf94f('0x4d')][_0xf94f('0x4e')]({'plain':!![]});if(!_0x203ef6)throw new Error(_0xf94f('0x4f'));if(_0x203ef6[_0xf94f('0x50')]===_0xf94f('0x4d')){var _0x4297d3=_0x3c7b19[_0xf94f('0x4e')]({'plain':!![]});return db[_0xf94f('0x51')]['find']({'where':{'name':_0xf94f('0x1f'),'userProfileId':_0x203ef6[_0xf94f('0x52')]},'raw':!![]})[_0xf94f('0x1e')](function(_0x1e7052){if(_0x1e7052&&_0x1e7052[_0xf94f('0x53')]===0x0){return db[_0xf94f('0x20')]['create']({'name':_0x4297d3[_0xf94f('0x24')],'resourceId':_0x4297d3['id'],'type':_0x1e7052[_0xf94f('0x24')],'sectionId':_0x1e7052['id']},{})[_0xf94f('0x1e')](function(){return _0x3c7b19;});}else{return _0x3c7b19;}})[_0xf94f('0x3f')](function(_0x1d39a2){logger['error'](_0xf94f('0x54'),_0x1d39a2);throw _0x1d39a2;});}return _0x3c7b19;})['then'](respondWithResult(_0x60a43,0xc9))['catch'](handleError(_0x60a43,null));}; \ No newline at end of file +var _0xed76=['fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','include','catch','params','rawAttributes','includeAll','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','CannedAnswers','UserProfileResource','name','send','map','CannedAnswer','fieldName','type','model','query','keys','filters','intersection','attributes'];(function(_0x3152dc,_0x2a4311){var _0x5c5d91=function(_0x254e00){while(--_0x254e00){_0x3152dc['push'](_0x3152dc['shift']());}};_0x5c5d91(++_0x2a4311);}(_0xed76,0x1d0));var _0x6ed7=function(_0x407a30,_0x30acd6){_0x407a30=_0x407a30-0x0;var _0x2ceed1=_0xed76[_0x407a30];return _0x2ceed1;};'use strict';var emlformat=require(_0x6ed7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6ed7('0x1'));var jsonpatch=require(_0x6ed7('0x2'));var rp=require(_0x6ed7('0x3'));var moment=require('moment');var BPromise=require(_0x6ed7('0x4'));var Mustache=require(_0x6ed7('0x5'));var util=require(_0x6ed7('0x6'));var path=require(_0x6ed7('0x7'));var sox=require(_0x6ed7('0x8'));var csv=require(_0x6ed7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6ed7('0xa'));var _=require(_0x6ed7('0xb'));var squel=require('squel');var crypto=require(_0x6ed7('0xc'));var jsforce=require(_0x6ed7('0xd'));var deskjs=require(_0x6ed7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6ed7('0xf'));var Papa=require(_0x6ed7('0x10'));var Redis=require(_0x6ed7('0x11'));var authService=require(_0x6ed7('0x12'));var qs=require(_0x6ed7('0x13'));var as=require(_0x6ed7('0x14'));var hardwareService=require(_0x6ed7('0x15'));var logger=require(_0x6ed7('0x16'))(_0x6ed7('0x17'));var utils=require(_0x6ed7('0x18'));var config=require(_0x6ed7('0x19'));var licenseUtil=require(_0x6ed7('0x1a'));var db=require(_0x6ed7('0x1b'))['db'];function respondWithStatusCode(_0x438216,_0x573c25){_0x573c25=_0x573c25||0xcc;return function(_0x26de76){if(_0x26de76){return _0x438216[_0x6ed7('0x1c')](_0x573c25);}return _0x438216[_0x6ed7('0x1d')](_0x573c25)[_0x6ed7('0x1e')]();};}function respondWithResult(_0x7e4558,_0x37e68b){_0x37e68b=_0x37e68b||0xc8;return function(_0x5e385c){if(_0x5e385c){return _0x7e4558[_0x6ed7('0x1d')](_0x37e68b)[_0x6ed7('0x1f')](_0x5e385c);}};}function respondWithFilteredResult(_0x3649a5,_0x80d721){return function(_0x2c5a1d){if(_0x2c5a1d){var _0x33babb=typeof _0x80d721[_0x6ed7('0x20')]===_0x6ed7('0x21')&&typeof _0x80d721[_0x6ed7('0x22')]===_0x6ed7('0x21');var _0x341ef1=_0x2c5a1d[_0x6ed7('0x23')];var _0x51966f=_0x33babb?0x0:_0x80d721['offset'];var _0x4b4b19=_0x33babb?_0x2c5a1d[_0x6ed7('0x23')]:_0x80d721[_0x6ed7('0x20')]+_0x80d721[_0x6ed7('0x22')];var _0x41dfde;if(_0x4b4b19>=_0x341ef1){_0x4b4b19=_0x341ef1;_0x41dfde=0xc8;}else{_0x41dfde=0xce;}_0x3649a5[_0x6ed7('0x1d')](_0x41dfde);return _0x3649a5[_0x6ed7('0x24')](_0x6ed7('0x25'),_0x51966f+'-'+_0x4b4b19+'/'+_0x341ef1)[_0x6ed7('0x1f')](_0x2c5a1d);}return null;};}function patchUpdates(_0x510ec3){return function(_0x5df341){try{jsonpatch[_0x6ed7('0x26')](_0x5df341,_0x510ec3,!![]);}catch(_0x36f421){return BPromise['reject'](_0x36f421);}return _0x5df341[_0x6ed7('0x27')]();};}function saveUpdates(_0x20623b,_0x214187){return function(_0x21ef5d){if(_0x21ef5d){return _0x21ef5d[_0x6ed7('0x28')](_0x20623b)[_0x6ed7('0x29')](function(_0x32d19b){return _0x32d19b;});}return null;};}function removeEntity(_0x3e5e00,_0x50e132){return function(_0x56cf33){if(_0x56cf33){return _0x56cf33[_0x6ed7('0x2a')]()[_0x6ed7('0x29')](function(){var _0x1de297=_0x56cf33[_0x6ed7('0x2b')]({'plain':!![]});var _0x4633e0=_0x6ed7('0x2c');return db[_0x6ed7('0x2d')][_0x6ed7('0x2a')]({'where':{'type':_0x4633e0,'resourceId':_0x1de297['id']}})[_0x6ed7('0x29')](function(){return _0x56cf33;});})[_0x6ed7('0x29')](function(){_0x3e5e00['status'](0xcc)[_0x6ed7('0x1e')]();});}};}function handleEntityNotFound(_0x475d3d,_0xae005){return function(_0x58c024){if(!_0x58c024){_0x475d3d[_0x6ed7('0x1c')](0x194);}return _0x58c024;};}function handleError(_0x4a014a,_0xda18ba){_0xda18ba=_0xda18ba||0x1f4;return function(_0x4f766f){logger['error'](_0x4f766f['stack']);if(_0x4f766f[_0x6ed7('0x2e')]){delete _0x4f766f['name'];}_0x4a014a['status'](_0xda18ba)[_0x6ed7('0x2f')](_0x4f766f);};}exports['index']=function(_0x1abece,_0x1e3dd8){var _0x3d2616={},_0x24c5fc={},_0x2f4380={'count':0x0,'rows':[]};var _0x43230b=_[_0x6ed7('0x30')](db[_0x6ed7('0x31')]['rawAttributes'],function(_0x210c9d){return{'name':_0x210c9d[_0x6ed7('0x32')],'type':_0x210c9d[_0x6ed7('0x33')]['key']};});_0x24c5fc[_0x6ed7('0x34')]=_['map'](_0x43230b,_0x6ed7('0x2e'));_0x24c5fc[_0x6ed7('0x35')]=_[_0x6ed7('0x36')](_0x1abece['query']);_0x24c5fc[_0x6ed7('0x37')]=_[_0x6ed7('0x38')](_0x24c5fc['model'],_0x24c5fc[_0x6ed7('0x35')]);_0x3d2616[_0x6ed7('0x39')]=_[_0x6ed7('0x38')](_0x24c5fc[_0x6ed7('0x34')],qs[_0x6ed7('0x3a')](_0x1abece[_0x6ed7('0x35')]['fields']));_0x3d2616[_0x6ed7('0x39')]=_0x3d2616['attributes'][_0x6ed7('0x3b')]?_0x3d2616[_0x6ed7('0x39')]:_0x24c5fc[_0x6ed7('0x34')];if(!_0x1abece['query'][_0x6ed7('0x3c')](_0x6ed7('0x3d'))){_0x3d2616[_0x6ed7('0x22')]=qs['limit'](_0x1abece[_0x6ed7('0x35')][_0x6ed7('0x22')]);_0x3d2616[_0x6ed7('0x20')]=qs[_0x6ed7('0x20')](_0x1abece['query'][_0x6ed7('0x20')]);}_0x3d2616[_0x6ed7('0x3e')]=qs[_0x6ed7('0x3f')](_0x1abece[_0x6ed7('0x35')][_0x6ed7('0x3f')]);_0x3d2616['where']=qs['filters'](_[_0x6ed7('0x40')](_0x1abece[_0x6ed7('0x35')],_0x24c5fc[_0x6ed7('0x37')]),_0x43230b);if(_0x1abece[_0x6ed7('0x35')][_0x6ed7('0x41')]){_0x3d2616['where']=_[_0x6ed7('0x42')](_0x3d2616[_0x6ed7('0x43')],{'$or':[{'key':{'$like':'%'+_0x1abece[_0x6ed7('0x35')][_0x6ed7('0x41')]+'%'}},{'value':{'$like':'%'+_0x1abece[_0x6ed7('0x35')][_0x6ed7('0x41')]+'%'}}]});}_0x3d2616=_[_0x6ed7('0x42')]({},_0x3d2616,_0x1abece[_0x6ed7('0x44')]);var _0x54fd42={'where':_0x3d2616[_0x6ed7('0x43')]};return db[_0x6ed7('0x31')][_0x6ed7('0x23')](_0x54fd42)[_0x6ed7('0x29')](function(_0x3c0af5){_0x2f4380[_0x6ed7('0x23')]=_0x3c0af5;if(_0x1abece[_0x6ed7('0x35')]['includeAll']){_0x3d2616[_0x6ed7('0x45')]=[{'all':!![]}];}return db[_0x6ed7('0x31')]['findAll'](_0x3d2616);})['then'](function(_0x3b7e79){_0x2f4380['rows']=_0x3b7e79;return _0x2f4380;})['then'](respondWithFilteredResult(_0x1e3dd8,_0x3d2616))[_0x6ed7('0x46')](handleError(_0x1e3dd8,null));};exports['show']=function(_0x5bf4ad,_0x2d8002){var _0x3520b0={'raw':!![],'where':{'id':_0x5bf4ad[_0x6ed7('0x47')]['id']}},_0x558323={};_0x558323[_0x6ed7('0x34')]=_[_0x6ed7('0x36')](db['CannedAnswer'][_0x6ed7('0x48')]);_0x558323[_0x6ed7('0x35')]=_[_0x6ed7('0x36')](_0x5bf4ad[_0x6ed7('0x35')]);_0x558323['filters']=_[_0x6ed7('0x38')](_0x558323['model'],_0x558323['query']);_0x3520b0[_0x6ed7('0x39')]=_[_0x6ed7('0x38')](_0x558323[_0x6ed7('0x34')],qs[_0x6ed7('0x3a')](_0x5bf4ad[_0x6ed7('0x35')][_0x6ed7('0x3a')]));_0x3520b0[_0x6ed7('0x39')]=_0x3520b0[_0x6ed7('0x39')][_0x6ed7('0x3b')]?_0x3520b0['attributes']:_0x558323['model'];if(_0x5bf4ad['query'][_0x6ed7('0x49')]){_0x3520b0[_0x6ed7('0x45')]=[{'all':!![]}];}_0x3520b0=_[_0x6ed7('0x42')]({},_0x3520b0,_0x5bf4ad[_0x6ed7('0x44')]);return db[_0x6ed7('0x31')]['find'](_0x3520b0)['then'](handleEntityNotFound(_0x2d8002,null))[_0x6ed7('0x29')](respondWithResult(_0x2d8002,null))['catch'](handleError(_0x2d8002,null));};exports['update']=function(_0x3caba9,_0x5920b4){if(_0x3caba9['body']['id']){delete _0x3caba9[_0x6ed7('0x4a')]['id'];}return db[_0x6ed7('0x31')]['find']({'where':{'id':_0x3caba9[_0x6ed7('0x47')]['id']}})[_0x6ed7('0x29')](handleEntityNotFound(_0x5920b4,null))[_0x6ed7('0x29')](saveUpdates(_0x3caba9[_0x6ed7('0x4a')],null))[_0x6ed7('0x29')](respondWithResult(_0x5920b4,null))[_0x6ed7('0x46')](handleError(_0x5920b4,null));};exports['destroy']=function(_0x970a0a,_0x51f4e8){return db[_0x6ed7('0x31')][_0x6ed7('0x4b')]({'where':{'id':_0x970a0a[_0x6ed7('0x47')]['id']}})[_0x6ed7('0x29')](handleEntityNotFound(_0x51f4e8,null))[_0x6ed7('0x29')](removeEntity(_0x51f4e8,null))[_0x6ed7('0x46')](handleError(_0x51f4e8,null));};exports[_0x6ed7('0x4c')]=function(_0x334b15,_0x202a14){var _0x7a5e5b={'key':_0x334b15['body']['key']};if(_0x334b15['body'][_0x6ed7('0x4d')]){_0x7a5e5b[_0x6ed7('0x4d')]=_0x334b15[_0x6ed7('0x4a')][_0x6ed7('0x4d')];}else if(_0x334b15[_0x6ed7('0x4a')][_0x6ed7('0x4e')]){_0x7a5e5b[_0x6ed7('0x4e')]=_0x334b15[_0x6ed7('0x4a')][_0x6ed7('0x4e')];}else if(_0x334b15[_0x6ed7('0x4a')][_0x6ed7('0x4f')]){_0x7a5e5b[_0x6ed7('0x4f')]=_0x334b15[_0x6ed7('0x4a')][_0x6ed7('0x4f')];}else if(_0x334b15['body']['ChatWebsiteId']){_0x7a5e5b['ChatWebsiteId']=_0x334b15[_0x6ed7('0x4a')][_0x6ed7('0x50')];}return db[_0x6ed7('0x31')][_0x6ed7('0x4b')]({'where':_0x7a5e5b})[_0x6ed7('0x29')](function(_0x1cd0ce){if(_0x1cd0ce){throw new db[(_0x6ed7('0x51'))]['ValidationError'](_0x6ed7('0x52'));}return db[_0x6ed7('0x31')]['create'](_0x334b15[_0x6ed7('0x4a')]);})[_0x6ed7('0x29')](function(_0x1375fc){var _0x560f1b=_0x334b15['user']['get']({'plain':!![]});if(!_0x560f1b)throw new Error(_0x6ed7('0x53'));if(_0x560f1b['role']===_0x6ed7('0x54')){var _0x31e3bc=_0x1375fc['get']({'plain':!![]});return db[_0x6ed7('0x55')][_0x6ed7('0x4b')]({'where':{'name':'CannedAnswers','userProfileId':_0x560f1b['userProfileId']},'raw':!![]})[_0x6ed7('0x29')](function(_0xbf2d46){if(_0xbf2d46&&_0xbf2d46['autoAssociation']===0x0){return db[_0x6ed7('0x2d')][_0x6ed7('0x4c')]({'name':_0x31e3bc['name'],'resourceId':_0x31e3bc['id'],'type':_0xbf2d46[_0x6ed7('0x2e')],'sectionId':_0xbf2d46['id']},{})[_0x6ed7('0x29')](function(){return _0x1375fc;});}else{return _0x1375fc;}})[_0x6ed7('0x46')](function(_0x5993aa){logger['error'](_0x6ed7('0x56'),_0x5993aa);throw _0x5993aa;});}return _0x1375fc;})['then'](respondWithResult(_0x202a14,0xc9))[_0x6ed7('0x46')](handleError(_0x202a14,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 2ebf64f..922bd82 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 _0x694d=['define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports'];(function(_0x1f4b18,_0x4e777c){var _0xde3957=function(_0x1dcbbc){while(--_0x1dcbbc){_0x1f4b18['push'](_0x1f4b18['shift']());}};_0xde3957(++_0x4e777c);}(_0x694d,0x16c));var _0xd694=function(_0x4565a6,_0x5ada44){_0x4565a6=_0x4565a6-0x0;var _0x2010f8=_0x694d[_0x4565a6];return _0x2010f8;};'use strict';var _=require(_0xd694('0x0'));var util=require(_0xd694('0x1'));var logger=require(_0xd694('0x2'))(_0xd694('0x3'));var moment=require('moment');var BPromise=require(_0xd694('0x4'));var rp=require(_0xd694('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd694('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0xd694('0x7')]=function(_0x3e04f6,_0x8130f){return _0x3e04f6[_0xd694('0x8')](_0xd694('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd694('0xa'),'collate':_0xd694('0xb')});}; \ No newline at end of file +var _0xa786=['rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1f8e5d,_0x28d764){var _0x1627c9=function(_0x2dcd38){while(--_0x2dcd38){_0x1f8e5d['push'](_0x1f8e5d['shift']());}};_0x1627c9(++_0x28d764);}(_0xa786,0x1f1));var _0x6a78=function(_0x19d637,_0x94577c){_0x19d637=_0x19d637-0x0;var _0x33b625=_0xa786[_0x19d637];return _0x33b625;};'use strict';var _=require(_0x6a78('0x0'));var util=require(_0x6a78('0x1'));var logger=require(_0x6a78('0x2'))(_0x6a78('0x3'));var moment=require(_0x6a78('0x4'));var BPromise=require(_0x6a78('0x5'));var rp=require(_0x6a78('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a78('0x7'));var config=require(_0x6a78('0x8'));var attributes=require(_0x6a78('0x9'));module[_0x6a78('0xa')]=function(_0x5624df,_0x152b20){return _0x5624df[_0x6a78('0xb')](_0x6a78('0xc'),attributes,{'tableName':_0x6a78('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 2a25209..d20d1cb 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(_0x348e63,_0x567959){var _0x17680c=function(_0x9d67c2){while(--_0x9d67c2){_0x348e63['push'](_0x348e63['shift']());}};_0x17680c(++_0x567959);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x2b0547,_0x2251b6){var _0x3d13fd=function(_0x573072){while(--_0x573072){_0x2b0547['push'](_0x2b0547['shift']());}};_0x3d13fd(++_0x2251b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 9e6acdc..38f3a52 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 _0x9fe8=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports'];(function(_0x58cf07,_0x2e3858){var _0x42afe0=function(_0x3c71ff){while(--_0x3c71ff){_0x58cf07['push'](_0x58cf07['shift']());}};_0x42afe0(++_0x2e3858);}(_0x9fe8,0x19e));var _0x89fe=function(_0x130df6,_0x12ad73){_0x130df6=_0x130df6-0x0;var _0x82df5f=_0x9fe8[_0x130df6];return _0x82df5f;};'use strict';var multer=require(_0x89fe('0x0'));var util=require(_0x89fe('0x1'));var path=require(_0x89fe('0x2'));var timeout=require(_0x89fe('0x3'));var express=require('express');var router=express[_0x89fe('0x4')]();var fs_extra=require(_0x89fe('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x89fe('0x6'));var config=require(_0x89fe('0x7'));var controller=require('./cannedAnswer.controller');router[_0x89fe('0x8')]('/',auth[_0x89fe('0x9')](),controller[_0x89fe('0xa')]);router[_0x89fe('0x8')](_0x89fe('0xb'),auth['isAuthenticated'](),controller[_0x89fe('0xc')]);router['post']('/',auth[_0x89fe('0x9')](),controller[_0x89fe('0xd')]);router[_0x89fe('0xe')]('/:id',auth[_0x89fe('0x9')](),controller['update']);router[_0x89fe('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x89fe('0x10')]);module[_0x89fe('0x11')]=router; \ No newline at end of file +var _0x4816=['delete','/:id','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','get','show','post','put','update'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0x4816,0xa5));var _0x6481=function(_0x1580f7,_0xf2b31c){_0x1580f7=_0x1580f7-0x0;var _0x2a5b4f=_0x4816[_0x1580f7];return _0x2a5b4f;};'use strict';var multer=require(_0x6481('0x0'));var util=require('util');var path=require(_0x6481('0x1'));var timeout=require(_0x6481('0x2'));var express=require(_0x6481('0x3'));var router=express[_0x6481('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6481('0x5'));var interaction=require(_0x6481('0x6'));var config=require(_0x6481('0x7'));var controller=require(_0x6481('0x8'));router['get']('/',auth[_0x6481('0x9')](),controller['index']);router[_0x6481('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6481('0xb')]);router[_0x6481('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6481('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x6481('0xe')]);router[_0x6481('0xf')](_0x6481('0x10'),auth[_0x6481('0x9')](),controller['destroy']);module[_0x6481('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 7051c48..d750cfd 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 _0x5081=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x101134,_0x1ed1d3){var _0xc47acc=function(_0x7ea469){while(--_0x7ea469){_0x101134['push'](_0x101134['shift']());}};_0xc47acc(++_0x1ed1d3);}(_0x5081,0x148));var _0x1508=function(_0x2a287a,_0x3cfd27){_0x2a287a=_0x2a287a-0x0;var _0x57f271=_0x5081[_0x2a287a];return _0x57f271;};'use strict';var Sequelize=require(_0x1508('0x0'));module[_0x1508('0x1')]={'calldate':{'type':Sequelize[_0x1508('0x2')],'allowNull':![],'defaultValue':_0x1508('0x3')},'clid':{'type':Sequelize[_0x1508('0x4')]},'src':{'type':Sequelize[_0x1508('0x4')]},'dst':{'type':Sequelize[_0x1508('0x4')]},'dcontext':{'type':Sequelize[_0x1508('0x4')]},'channel':{'type':Sequelize[_0x1508('0x4')]},'dstchannel':{'type':Sequelize[_0x1508('0x4')]},'lastapp':{'type':Sequelize[_0x1508('0x4')]},'lastdata':{'type':Sequelize[_0x1508('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x1508('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x1508('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x1508('0x4')]},'userfield':{'type':Sequelize[_0x1508('0x4')]},'uniqueid':{'type':Sequelize[_0x1508('0x4')]},'linkedid':{'type':Sequelize[_0x1508('0x4')]},'sequence':{'type':Sequelize[_0x1508('0x4')]},'peeraccount':{'type':Sequelize[_0x1508('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7d13=['exports','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x6f996a,_0x14cf09){var _0x43a5af=function(_0x1c766f){while(--_0x1c766f){_0x6f996a['push'](_0x6f996a['shift']());}};_0x43a5af(++_0x14cf09);}(_0x7d13,0x6c));var _0x37d1=function(_0x3ee8b1,_0x375088){_0x3ee8b1=_0x3ee8b1-0x0;var _0x53aa77=_0x7d13[_0x3ee8b1];return _0x53aa77;};'use strict';var Sequelize=require('sequelize');module[_0x37d1('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x37d1('0x1')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x37d1('0x2')]},'dst':{'type':Sequelize[_0x37d1('0x2')]},'dcontext':{'type':Sequelize[_0x37d1('0x2')]},'channel':{'type':Sequelize[_0x37d1('0x2')]},'dstchannel':{'type':Sequelize[_0x37d1('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x37d1('0x2')]},'duration':{'type':Sequelize[_0x37d1('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x37d1('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x37d1('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x37d1('0x2')]},'userfield':{'type':Sequelize[_0x37d1('0x2')]},'uniqueid':{'type':Sequelize[_0x37d1('0x2')]},'linkedid':{'type':Sequelize[_0x37d1('0x2')]},'sequence':{'type':Sequelize[_0x37d1('0x2')]},'peeraccount':{'type':Sequelize[_0x37d1('0x2')]},'type':{'type':Sequelize[_0x37d1('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 07ed04a..221004b 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 _0xa990=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','json','save','update','then','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','findAll','catch','show','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x206f4b,_0x346117){var _0x20599c=function(_0x2f15b3){while(--_0x2f15b3){_0x206f4b['push'](_0x206f4b['shift']());}};_0x20599c(++_0x346117);}(_0xa990,0xc9));var _0x0a99=function(_0x3f1ca5,_0x4c9c36){_0x3f1ca5=_0x3f1ca5-0x0;var _0x193ab3=_0xa990[_0x3f1ca5];return _0x193ab3;};'use strict';var emlformat=require(_0x0a99('0x0'));var rimraf=require(_0x0a99('0x1'));var zipdir=require(_0x0a99('0x2'));var jsonpatch=require(_0x0a99('0x3'));var rp=require(_0x0a99('0x4'));var moment=require(_0x0a99('0x5'));var BPromise=require(_0x0a99('0x6'));var Mustache=require(_0x0a99('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0a99('0x8'));var csv=require(_0x0a99('0x9'));var ejs=require(_0x0a99('0xa'));var fs=require('fs');var fs_extra=require(_0x0a99('0xb'));var _=require(_0x0a99('0xc'));var squel=require(_0x0a99('0xd'));var crypto=require(_0x0a99('0xe'));var jsforce=require(_0x0a99('0xf'));var deskjs=require(_0x0a99('0x10'));var toCsv=require(_0x0a99('0x9'));var querystring=require(_0x0a99('0x11'));var Papa=require('papaparse');var Redis=require(_0x0a99('0x12'));var authService=require(_0x0a99('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a99('0x14'));var logger=require(_0x0a99('0x15'))(_0x0a99('0x16'));var utils=require(_0x0a99('0x17'));var config=require(_0x0a99('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a99('0x19'))['db'];function respondWithStatusCode(_0x3aaaad,_0x57ab88){_0x57ab88=_0x57ab88||0xcc;return function(_0xb6a34d){if(_0xb6a34d){return _0x3aaaad[_0x0a99('0x1a')](_0x57ab88);}return _0x3aaaad[_0x0a99('0x1b')](_0x57ab88)[_0x0a99('0x1c')]();};}function respondWithResult(_0x346061,_0x23d018){_0x23d018=_0x23d018||0xc8;return function(_0x18c124){if(_0x18c124){return _0x346061[_0x0a99('0x1b')](_0x23d018)['json'](_0x18c124);}};}function respondWithFilteredResult(_0x5a17e1,_0x2c40db){return function(_0x3ac17e){if(_0x3ac17e){var _0xb7356c=typeof _0x2c40db['offset']===_0x0a99('0x1d')&&typeof _0x2c40db['limit']==='undefined';var _0x20104c=_0x3ac17e[_0x0a99('0x1e')];var _0x3de006=_0xb7356c?0x0:_0x2c40db[_0x0a99('0x1f')];var _0x572ce5=_0xb7356c?_0x3ac17e['count']:_0x2c40db[_0x0a99('0x1f')]+_0x2c40db[_0x0a99('0x20')];var _0xbe23f3;if(_0x572ce5>=_0x20104c){_0x572ce5=_0x20104c;_0xbe23f3=0xc8;}else{_0xbe23f3=0xce;}_0x5a17e1[_0x0a99('0x1b')](_0xbe23f3);return _0x5a17e1['set']('Content-Range',_0x3de006+'-'+_0x572ce5+'/'+_0x20104c)[_0x0a99('0x21')](_0x3ac17e);}return null;};}function patchUpdates(_0x4d0c78){return function(_0x1e8d30){try{jsonpatch['apply'](_0x1e8d30,_0x4d0c78,!![]);}catch(_0x191ee4){return BPromise['reject'](_0x191ee4);}return _0x1e8d30[_0x0a99('0x22')]();};}function saveUpdates(_0x356681,_0x3b1d60){return function(_0x1c1e5c){if(_0x1c1e5c){return _0x1c1e5c[_0x0a99('0x23')](_0x356681)[_0x0a99('0x24')](function(_0x19c870){return _0x19c870;});}return null;};}function removeEntity(_0x1d803c,_0x398dd2){return function(_0x5745ca){if(_0x5745ca){return _0x5745ca['destroy']()[_0x0a99('0x24')](function(){_0x1d803c[_0x0a99('0x1b')](0xcc)[_0x0a99('0x1c')]();});}};}function handleEntityNotFound(_0x518617,_0x5d917c){return function(_0x371b31){if(!_0x371b31){_0x518617[_0x0a99('0x1a')](0x194);}return _0x371b31;};}function handleError(_0x1b0e94,_0x40e765){_0x40e765=_0x40e765||0x1f4;return function(_0x10e70f){logger[_0x0a99('0x25')](_0x10e70f[_0x0a99('0x26')]);if(_0x10e70f[_0x0a99('0x27')]){delete _0x10e70f[_0x0a99('0x27')];}_0x1b0e94['status'](_0x40e765)[_0x0a99('0x28')](_0x10e70f);};}exports['index']=function(_0x47bc34,_0x4e597b){var _0x223bdb={},_0x379c7e={},_0x13d26a={'count':0x0,'rows':[]};var _0x26c0c0=_[_0x0a99('0x29')](db[_0x0a99('0x2a')][_0x0a99('0x2b')],function(_0x47da33){return{'name':_0x47da33[_0x0a99('0x2c')],'type':_0x47da33[_0x0a99('0x2d')][_0x0a99('0x2e')]};});_0x379c7e[_0x0a99('0x2f')]=_['map'](_0x26c0c0,'name');_0x379c7e['query']=_[_0x0a99('0x30')](_0x47bc34[_0x0a99('0x31')]);_0x379c7e[_0x0a99('0x32')]=_['intersection'](_0x379c7e[_0x0a99('0x2f')],_0x379c7e[_0x0a99('0x31')]);_0x223bdb[_0x0a99('0x33')]=_[_0x0a99('0x34')](_0x379c7e[_0x0a99('0x2f')],qs[_0x0a99('0x35')](_0x47bc34[_0x0a99('0x31')]['fields']));_0x223bdb[_0x0a99('0x33')]=_0x223bdb[_0x0a99('0x33')][_0x0a99('0x36')]?_0x223bdb[_0x0a99('0x33')]:_0x379c7e[_0x0a99('0x2f')];if(!_0x47bc34['query'][_0x0a99('0x37')]('nolimit')){_0x223bdb['limit']=qs['limit'](_0x47bc34['query'][_0x0a99('0x20')]);_0x223bdb['offset']=qs[_0x0a99('0x1f')](_0x47bc34[_0x0a99('0x31')][_0x0a99('0x1f')]);}_0x223bdb[_0x0a99('0x38')]=qs[_0x0a99('0x39')](_0x47bc34[_0x0a99('0x31')][_0x0a99('0x39')]);_0x223bdb[_0x0a99('0x3a')]=qs[_0x0a99('0x32')](_[_0x0a99('0x3b')](_0x47bc34[_0x0a99('0x31')],_0x379c7e[_0x0a99('0x32')]),_0x26c0c0);if(_0x47bc34[_0x0a99('0x31')]['filter']){_0x223bdb[_0x0a99('0x3a')]=_[_0x0a99('0x3c')](_0x223bdb['where'],{'$or':_[_0x0a99('0x29')](_0x26c0c0,function(_0x549bb9){if(_0x549bb9[_0x0a99('0x2d')]!=='VIRTUAL'){var _0x541178={};_0x541178[_0x549bb9[_0x0a99('0x27')]]={'$like':'%'+_0x47bc34[_0x0a99('0x31')][_0x0a99('0x3d')]+'%'};return _0x541178;}})});}_0x223bdb=_['merge']({},_0x223bdb,_0x47bc34[_0x0a99('0x3e')]);var _0x11e046={'where':_0x223bdb[_0x0a99('0x3a')]};return db['Cdr'][_0x0a99('0x1e')](_0x11e046)[_0x0a99('0x24')](function(_0x23e4b9){_0x13d26a[_0x0a99('0x1e')]=_0x23e4b9;if(_0x47bc34['query'][_0x0a99('0x3f')]){_0x223bdb['include']=[{'all':!![]}];}return db['Cdr'][_0x0a99('0x40')](_0x223bdb);})['then'](function(_0x185495){_0x13d26a['rows']=_0x185495;return _0x13d26a;})[_0x0a99('0x24')](respondWithFilteredResult(_0x4e597b,_0x223bdb))[_0x0a99('0x41')](handleError(_0x4e597b,null));};exports[_0x0a99('0x42')]=function(_0x29da8a,_0x57b999){var _0xcee64a={'raw':!![],'where':{'id':_0x29da8a[_0x0a99('0x43')]['id']}},_0x97158c={};_0x97158c[_0x0a99('0x2f')]=_['keys'](db['Cdr']['rawAttributes']);_0x97158c[_0x0a99('0x31')]=_['keys'](_0x29da8a[_0x0a99('0x31')]);_0x97158c['filters']=_['intersection'](_0x97158c['model'],_0x97158c['query']);_0xcee64a[_0x0a99('0x33')]=_['intersection'](_0x97158c[_0x0a99('0x2f')],qs[_0x0a99('0x35')](_0x29da8a['query'][_0x0a99('0x35')]));_0xcee64a[_0x0a99('0x33')]=_0xcee64a['attributes'][_0x0a99('0x36')]?_0xcee64a['attributes']:_0x97158c[_0x0a99('0x2f')];if(_0x29da8a[_0x0a99('0x31')]['includeAll']){_0xcee64a[_0x0a99('0x44')]=[{'all':!![]}];}_0xcee64a=_['merge']({},_0xcee64a,_0x29da8a['options']);return db[_0x0a99('0x2a')][_0x0a99('0x45')](_0xcee64a)[_0x0a99('0x24')](handleEntityNotFound(_0x57b999,null))[_0x0a99('0x24')](respondWithResult(_0x57b999,null))[_0x0a99('0x41')](handleError(_0x57b999,null));};exports['create']=function(_0x476207,_0x174298){return db[_0x0a99('0x2a')][_0x0a99('0x46')](_0x476207[_0x0a99('0x47')],{})[_0x0a99('0x24')](respondWithResult(_0x174298,0xc9))[_0x0a99('0x41')](handleError(_0x174298,null));};exports[_0x0a99('0x23')]=function(_0x1cd328,_0x1621d9){if(_0x1cd328['body']['id']){delete _0x1cd328['body']['id'];}return db[_0x0a99('0x2a')][_0x0a99('0x45')]({'where':{'id':_0x1cd328[_0x0a99('0x43')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x1621d9,null))[_0x0a99('0x24')](saveUpdates(_0x1cd328[_0x0a99('0x47')],null))['then'](respondWithResult(_0x1621d9,null))[_0x0a99('0x41')](handleError(_0x1621d9,null));};exports[_0x0a99('0x48')]=function(_0x55fee0,_0x11ed07){return db[_0x0a99('0x2a')]['find']({'where':{'id':_0x55fee0[_0x0a99('0x43')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x11ed07,null))[_0x0a99('0x24')](removeEntity(_0x11ed07,null))[_0x0a99('0x41')](handleError(_0x11ed07,null));};exports[_0x0a99('0x49')]=function(_0x2411ea,_0xbdfb18){return db['Cdr'][_0x0a99('0x49')]()[_0x0a99('0x24')](respondWithResult(_0xbdfb18,null))[_0x0a99('0x41')](handleError(_0xbdfb18,null));}; \ No newline at end of file +var _0xf9d5=['lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','then','sendStatus','error','stack','name','index','map','Cdr','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x1156ce,_0x50f233){var _0x2b6d72=function(_0x36a033){while(--_0x36a033){_0x1156ce['push'](_0x1156ce['shift']());}};_0x2b6d72(++_0x50f233);}(_0xf9d5,0x122));var _0x5f9d=function(_0x3f80d3,_0x1df024){_0x3f80d3=_0x3f80d3-0x0;var _0x1d13b1=_0xf9d5[_0x3f80d3];return _0x1d13b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f9d('0x0'));var zipdir=require(_0x5f9d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f9d('0x2'));var moment=require(_0x5f9d('0x3'));var BPromise=require(_0x5f9d('0x4'));var Mustache=require(_0x5f9d('0x5'));var util=require(_0x5f9d('0x6'));var path=require(_0x5f9d('0x7'));var sox=require(_0x5f9d('0x8'));var csv=require('to-csv');var ejs=require(_0x5f9d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f9d('0xa'));var squel=require(_0x5f9d('0xb'));var crypto=require('crypto');var jsforce=require(_0x5f9d('0xc'));var deskjs=require(_0x5f9d('0xd'));var toCsv=require(_0x5f9d('0xe'));var querystring=require(_0x5f9d('0xf'));var Papa=require(_0x5f9d('0x10'));var Redis=require(_0x5f9d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5f9d('0x12'));var as=require(_0x5f9d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5f9d('0x14'));var utils=require(_0x5f9d('0x15'));var config=require(_0x5f9d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f9d('0x17'))['db'];function respondWithStatusCode(_0x10f5b1,_0x257910){_0x257910=_0x257910||0xcc;return function(_0x23a39f){if(_0x23a39f){return _0x10f5b1['sendStatus'](_0x257910);}return _0x10f5b1[_0x5f9d('0x18')](_0x257910)[_0x5f9d('0x19')]();};}function respondWithResult(_0x234902,_0x5aacdc){_0x5aacdc=_0x5aacdc||0xc8;return function(_0x8e2381){if(_0x8e2381){return _0x234902[_0x5f9d('0x18')](_0x5aacdc)['json'](_0x8e2381);}};}function respondWithFilteredResult(_0x4fd1cb,_0x2f0154){return function(_0x334cea){if(_0x334cea){var _0x3d4a1c=typeof _0x2f0154[_0x5f9d('0x1a')]===_0x5f9d('0x1b')&&typeof _0x2f0154['limit']==='undefined';var _0x54bd00=_0x334cea[_0x5f9d('0x1c')];var _0x4fb9a5=_0x3d4a1c?0x0:_0x2f0154[_0x5f9d('0x1a')];var _0x48448e=_0x3d4a1c?_0x334cea[_0x5f9d('0x1c')]:_0x2f0154[_0x5f9d('0x1a')]+_0x2f0154[_0x5f9d('0x1d')];var _0x55a31c;if(_0x48448e>=_0x54bd00){_0x48448e=_0x54bd00;_0x55a31c=0xc8;}else{_0x55a31c=0xce;}_0x4fd1cb[_0x5f9d('0x18')](_0x55a31c);return _0x4fd1cb[_0x5f9d('0x1e')](_0x5f9d('0x1f'),_0x4fb9a5+'-'+_0x48448e+'/'+_0x54bd00)[_0x5f9d('0x20')](_0x334cea);}return null;};}function patchUpdates(_0x320182){return function(_0xa62826){try{jsonpatch[_0x5f9d('0x21')](_0xa62826,_0x320182,!![]);}catch(_0x2563d5){return BPromise[_0x5f9d('0x22')](_0x2563d5);}return _0xa62826['save']();};}function saveUpdates(_0x4a2eeb,_0x5465b1){return function(_0x1bc76b){if(_0x1bc76b){return _0x1bc76b['update'](_0x4a2eeb)[_0x5f9d('0x23')](function(_0x5a3472){return _0x5a3472;});}return null;};}function removeEntity(_0x9d86ce,_0x564886){return function(_0x4875c5){if(_0x4875c5){return _0x4875c5['destroy']()[_0x5f9d('0x23')](function(){_0x9d86ce[_0x5f9d('0x18')](0xcc)[_0x5f9d('0x19')]();});}};}function handleEntityNotFound(_0x234511,_0x542bbc){return function(_0x379d2d){if(!_0x379d2d){_0x234511[_0x5f9d('0x24')](0x194);}return _0x379d2d;};}function handleError(_0x190402,_0x74f212){_0x74f212=_0x74f212||0x1f4;return function(_0x2d097f){logger[_0x5f9d('0x25')](_0x2d097f[_0x5f9d('0x26')]);if(_0x2d097f[_0x5f9d('0x27')]){delete _0x2d097f[_0x5f9d('0x27')];}_0x190402[_0x5f9d('0x18')](_0x74f212)['send'](_0x2d097f);};}exports[_0x5f9d('0x28')]=function(_0x1b9054,_0x1496c0){var _0x13cc7c={},_0x10e542={},_0x24233e={'count':0x0,'rows':[]};var _0x38b10d=_[_0x5f9d('0x29')](db[_0x5f9d('0x2a')]['rawAttributes'],function(_0x4ed27d){return{'name':_0x4ed27d['fieldName'],'type':_0x4ed27d[_0x5f9d('0x2b')]['key']};});_0x10e542[_0x5f9d('0x2c')]=_['map'](_0x38b10d,_0x5f9d('0x27'));_0x10e542['query']=_[_0x5f9d('0x2d')](_0x1b9054[_0x5f9d('0x2e')]);_0x10e542[_0x5f9d('0x2f')]=_[_0x5f9d('0x30')](_0x10e542[_0x5f9d('0x2c')],_0x10e542['query']);_0x13cc7c[_0x5f9d('0x31')]=_['intersection'](_0x10e542[_0x5f9d('0x2c')],qs['fields'](_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x32')]));_0x13cc7c['attributes']=_0x13cc7c[_0x5f9d('0x31')][_0x5f9d('0x33')]?_0x13cc7c[_0x5f9d('0x31')]:_0x10e542['model'];if(!_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x34')](_0x5f9d('0x35'))){_0x13cc7c[_0x5f9d('0x1d')]=qs[_0x5f9d('0x1d')](_0x1b9054['query'][_0x5f9d('0x1d')]);_0x13cc7c[_0x5f9d('0x1a')]=qs[_0x5f9d('0x1a')](_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x1a')]);}_0x13cc7c[_0x5f9d('0x36')]=qs['sort'](_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x37')]);_0x13cc7c[_0x5f9d('0x38')]=qs['filters'](_['pick'](_0x1b9054[_0x5f9d('0x2e')],_0x10e542[_0x5f9d('0x2f')]),_0x38b10d);if(_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x39')]){_0x13cc7c[_0x5f9d('0x38')]=_['merge'](_0x13cc7c['where'],{'$or':_[_0x5f9d('0x29')](_0x38b10d,function(_0x3c5737){if(_0x3c5737['type']!==_0x5f9d('0x3a')){var _0x4e15be={};_0x4e15be[_0x3c5737[_0x5f9d('0x27')]]={'$like':'%'+_0x1b9054[_0x5f9d('0x2e')]['filter']+'%'};return _0x4e15be;}})});}_0x13cc7c=_[_0x5f9d('0x3b')]({},_0x13cc7c,_0x1b9054[_0x5f9d('0x3c')]);var _0x4d3288={'where':_0x13cc7c['where']};return db[_0x5f9d('0x2a')][_0x5f9d('0x1c')](_0x4d3288)[_0x5f9d('0x23')](function(_0x3c43f6){_0x24233e[_0x5f9d('0x1c')]=_0x3c43f6;if(_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x3d')]){_0x13cc7c[_0x5f9d('0x3e')]=[{'all':!![]}];}return db[_0x5f9d('0x2a')][_0x5f9d('0x3f')](_0x13cc7c);})[_0x5f9d('0x23')](function(_0x227ef6){_0x24233e[_0x5f9d('0x40')]=_0x227ef6;return _0x24233e;})[_0x5f9d('0x23')](respondWithFilteredResult(_0x1496c0,_0x13cc7c))[_0x5f9d('0x41')](handleError(_0x1496c0,null));};exports[_0x5f9d('0x42')]=function(_0x45ba15,_0x1590b5){var _0xf02211={'raw':!![],'where':{'id':_0x45ba15[_0x5f9d('0x43')]['id']}},_0x21b5d1={};_0x21b5d1[_0x5f9d('0x2c')]=_[_0x5f9d('0x2d')](db[_0x5f9d('0x2a')][_0x5f9d('0x44')]);_0x21b5d1[_0x5f9d('0x2e')]=_[_0x5f9d('0x2d')](_0x45ba15[_0x5f9d('0x2e')]);_0x21b5d1[_0x5f9d('0x2f')]=_[_0x5f9d('0x30')](_0x21b5d1['model'],_0x21b5d1[_0x5f9d('0x2e')]);_0xf02211['attributes']=_[_0x5f9d('0x30')](_0x21b5d1[_0x5f9d('0x2c')],qs[_0x5f9d('0x32')](_0x45ba15[_0x5f9d('0x2e')][_0x5f9d('0x32')]));_0xf02211[_0x5f9d('0x31')]=_0xf02211[_0x5f9d('0x31')]['length']?_0xf02211[_0x5f9d('0x31')]:_0x21b5d1[_0x5f9d('0x2c')];if(_0x45ba15[_0x5f9d('0x2e')]['includeAll']){_0xf02211[_0x5f9d('0x3e')]=[{'all':!![]}];}_0xf02211=_['merge']({},_0xf02211,_0x45ba15[_0x5f9d('0x3c')]);return db[_0x5f9d('0x2a')][_0x5f9d('0x45')](_0xf02211)['then'](handleEntityNotFound(_0x1590b5,null))['then'](respondWithResult(_0x1590b5,null))[_0x5f9d('0x41')](handleError(_0x1590b5,null));};exports[_0x5f9d('0x46')]=function(_0x4c9645,_0x2a43a3){return db['Cdr'][_0x5f9d('0x46')](_0x4c9645[_0x5f9d('0x47')],{})[_0x5f9d('0x23')](respondWithResult(_0x2a43a3,0xc9))[_0x5f9d('0x41')](handleError(_0x2a43a3,null));};exports[_0x5f9d('0x48')]=function(_0x16a9fa,_0x3aa63c){if(_0x16a9fa[_0x5f9d('0x47')]['id']){delete _0x16a9fa[_0x5f9d('0x47')]['id'];}return db[_0x5f9d('0x2a')]['find']({'where':{'id':_0x16a9fa[_0x5f9d('0x43')]['id']}})[_0x5f9d('0x23')](handleEntityNotFound(_0x3aa63c,null))['then'](saveUpdates(_0x16a9fa[_0x5f9d('0x47')],null))[_0x5f9d('0x23')](respondWithResult(_0x3aa63c,null))[_0x5f9d('0x41')](handleError(_0x3aa63c,null));};exports[_0x5f9d('0x49')]=function(_0xc9a152,_0x414868){return db[_0x5f9d('0x2a')][_0x5f9d('0x45')]({'where':{'id':_0xc9a152['params']['id']}})['then'](handleEntityNotFound(_0x414868,null))[_0x5f9d('0x23')](removeEntity(_0x414868,null))[_0x5f9d('0x41')](handleError(_0x414868,null));};exports[_0x5f9d('0x4a')]=function(_0x101616,_0x97aac2){return db[_0x5f9d('0x2a')][_0x5f9d('0x4a')]()[_0x5f9d('0x23')](respondWithResult(_0x97aac2,null))[_0x5f9d('0x41')](handleError(_0x97aac2,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 355e1aa..24ec8b6 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x189599,_0xdd106a){var _0x152ed2=function(_0x330775){while(--_0x330775){_0x189599['push'](_0x189599['shift']());}};_0x152ed2(++_0xdd106a);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x4566b8,_0x40a546){var _0xf73e97=function(_0x5d12ab){while(--_0x5d12ab){_0x4566b8['push'](_0x4566b8['shift']());}};_0xf73e97(++_0x40a546);}(_0x7a54,0x106));var _0x47a5=function(_0x245580,_0x102345){_0x245580=_0x245580-0x0;var _0x17c79a=_0x7a54[_0x245580];return _0x17c79a;};'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 d627620..41eb0eb 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 _0x97fc=['Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4042de,_0x31c003){var _0x408ce3=function(_0x37647a){while(--_0x37647a){_0x4042de['push'](_0x4042de['shift']());}};_0x408ce3(++_0x31c003);}(_0x97fc,0x193));var _0xc97f=function(_0x2ef83e,_0x3b64b4){_0x2ef83e=_0x2ef83e-0x0;var _0xdc5499=_0x97fc[_0x2ef83e];return _0xdc5499;};'use strict';var _=require(_0xc97f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc97f('0x1'));var rs=require(_0xc97f('0x2'));var fs=require('fs');var Redis=require(_0xc97f('0x3'));var db=require(_0xc97f('0x4'))['db'];var utils=require(_0xc97f('0x5'));var logger=require('../../config/logger')(_0xc97f('0x6'));var config=require('../../config/environment');var jayson=require(_0xc97f('0x7'));var client=jayson[_0xc97f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x475e52,_0x3a280b,_0x481735){return new BPromise(function(_0x3e4e65,_0x1f651e){return client[_0xc97f('0x9')](_0x475e52,_0x481735)[_0xc97f('0xa')](function(_0x5d51b6){logger[_0xc97f('0xb')](_0xc97f('0xc'),_0x3a280b,_0xc97f('0xd'));logger[_0xc97f('0xe')](_0xc97f('0xf'),_0x3a280b,_0xc97f('0xd'),JSON[_0xc97f('0x10')](_0x5d51b6));if(_0x5d51b6[_0xc97f('0x11')]){if(_0x5d51b6[_0xc97f('0x11')][_0xc97f('0x12')]===0x1f4){logger[_0xc97f('0x11')](_0xc97f('0xc'),_0x3a280b,_0x5d51b6[_0xc97f('0x11')][_0xc97f('0x13')]);return _0x1f651e(_0x5d51b6[_0xc97f('0x11')][_0xc97f('0x13')]);}logger['error'](_0xc97f('0xc'),_0x3a280b,_0x5d51b6[_0xc97f('0x11')][_0xc97f('0x13')]);return _0x3e4e65(_0x5d51b6[_0xc97f('0x11')][_0xc97f('0x13')]);}else{logger['info'](_0xc97f('0xc'),_0x3a280b,'request\x20sent');_0x3e4e65(_0x5d51b6[_0xc97f('0x14')]['message']);}})[_0xc97f('0x15')](function(_0x5b0763){logger[_0xc97f('0x11')]('Cdr,\x20%s,\x20%s',_0x3a280b,_0x5b0763);_0x1f651e(_0x5b0763);});});} \ No newline at end of file +var _0xcad4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x542bd0,_0x56b265){var _0xaced4=function(_0x5db5c2){while(--_0x5db5c2){_0x542bd0['push'](_0x542bd0['shift']());}};_0xaced4(++_0x56b265);}(_0xcad4,0x1e9));var _0x4cad=function(_0x4878ad,_0xf2e815){_0x4878ad=_0x4878ad-0x0;var _0x12272f=_0xcad4[_0x4878ad];return _0x12272f;};'use strict';var _=require(_0x4cad('0x0'));var util=require(_0x4cad('0x1'));var moment=require(_0x4cad('0x2'));var BPromise=require(_0x4cad('0x3'));var rs=require(_0x4cad('0x4'));var fs=require('fs');var Redis=require(_0x4cad('0x5'));var db=require(_0x4cad('0x6'))['db'];var utils=require(_0x4cad('0x7'));var logger=require(_0x4cad('0x8'))(_0x4cad('0x9'));var config=require(_0x4cad('0xa'));var jayson=require(_0x4cad('0xb'));var client=jayson[_0x4cad('0xc')][_0x4cad('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x45206a,_0x11d320,_0x21e409){return new BPromise(function(_0x31e992,_0x1b2b76){return client[_0x4cad('0xe')](_0x45206a,_0x21e409)['then'](function(_0x2afcea){logger['info'](_0x4cad('0xf'),_0x11d320,'request\x20sent');logger[_0x4cad('0x10')](_0x4cad('0x11'),_0x11d320,_0x4cad('0x12'),JSON[_0x4cad('0x13')](_0x2afcea));if(_0x2afcea['error']){if(_0x2afcea[_0x4cad('0x14')][_0x4cad('0x15')]===0x1f4){logger[_0x4cad('0x14')]('Cdr,\x20%s,\x20%s',_0x11d320,_0x2afcea['error'][_0x4cad('0x16')]);return _0x1b2b76(_0x2afcea['error'][_0x4cad('0x16')]);}logger['error'](_0x4cad('0xf'),_0x11d320,_0x2afcea[_0x4cad('0x14')][_0x4cad('0x16')]);return _0x31e992(_0x2afcea[_0x4cad('0x14')][_0x4cad('0x16')]);}else{logger[_0x4cad('0x17')](_0x4cad('0xf'),_0x11d320,_0x4cad('0x12'));_0x31e992(_0x2afcea[_0x4cad('0x18')][_0x4cad('0x16')]);}})[_0x4cad('0x19')](function(_0x4e9208){logger[_0x4cad('0x14')](_0x4cad('0xf'),_0x11d320,_0x4e9208);_0x1b2b76(_0x4e9208);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 4b0cd35..2dd6d6f 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x555bbd,_0x196748){var _0x3184d7=function(_0x274943){while(--_0x274943){_0x555bbd['push'](_0x555bbd['shift']());}};_0x3184d7(++_0x196748);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x209e12,_0x2ce907){var _0x3f5b89=function(_0x39cc7f){while(--_0x39cc7f){_0x209e12['push'](_0x209e12['shift']());}};_0x3f5b89(++_0x2ce907);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 2ce5dcb..29a064b 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 _0xfee2=['INTEGER','STRING','TEXT'];(function(_0x4df17c,_0x2d2b61){var _0x4e79b5=function(_0x2134a5){while(--_0x2134a5){_0x4df17c['push'](_0x4df17c['shift']());}};_0x4e79b5(++_0x2d2b61);}(_0xfee2,0x1ec));var _0x2fee=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xfee2[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x2fee('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x2fee('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2fee('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2804=['exports','TEXT','STRING','*,*,*,*'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x2804,0xe0));var _0x4280=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2804[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0x4280('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4280('0x1')]()},'description':{'type':Sequelize[_0x4280('0x2')]},'interval':{'type':Sequelize[_0x4280('0x2')],'defaultValue':_0x4280('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 74b8db8..63f7fa9 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 _0x82b0=['length','attributes','includeAll','merge','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','send','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields'];(function(_0x32e2d7,_0x17e17c){var _0x356379=function(_0x2e6e5d){while(--_0x2e6e5d){_0x32e2d7['push'](_0x32e2d7['shift']());}};_0x356379(++_0x17e17c);}(_0x82b0,0x81));var _0x082b=function(_0x7abd7,_0x1ca3f9){_0x7abd7=_0x7abd7-0x0;var _0x3a2577=_0x82b0[_0x7abd7];return _0x3a2577;};'use strict';var emlformat=require(_0x082b('0x0'));var rimraf=require(_0x082b('0x1'));var zipdir=require(_0x082b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x082b('0x3'));var moment=require(_0x082b('0x4'));var BPromise=require(_0x082b('0x5'));var Mustache=require(_0x082b('0x6'));var util=require('util');var path=require(_0x082b('0x7'));var sox=require(_0x082b('0x8'));var csv=require(_0x082b('0x9'));var ejs=require(_0x082b('0xa'));var fs=require('fs');var fs_extra=require(_0x082b('0xb'));var _=require('lodash');var squel=require(_0x082b('0xc'));var crypto=require(_0x082b('0xd'));var jsforce=require(_0x082b('0xe'));var deskjs=require(_0x082b('0xf'));var toCsv=require(_0x082b('0x9'));var querystring=require(_0x082b('0x10'));var Papa=require(_0x082b('0x11'));var Redis=require(_0x082b('0x12'));var authService=require(_0x082b('0x13'));var qs=require(_0x082b('0x14'));var as=require(_0x082b('0x15'));var hardwareService=require(_0x082b('0x16'));var logger=require(_0x082b('0x17'))(_0x082b('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x082b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54bffb,_0x1c1f9d){_0x1c1f9d=_0x1c1f9d||0xcc;return function(_0x324251){if(_0x324251){return _0x54bffb['sendStatus'](_0x1c1f9d);}return _0x54bffb[_0x082b('0x1a')](_0x1c1f9d)[_0x082b('0x1b')]();};}function respondWithResult(_0x27bc44,_0x1f0c32){_0x1f0c32=_0x1f0c32||0xc8;return function(_0x40e206){if(_0x40e206){return _0x27bc44['status'](_0x1f0c32)[_0x082b('0x1c')](_0x40e206);}};}function respondWithFilteredResult(_0x1dc46e,_0x49db08){return function(_0x2c4f86){if(_0x2c4f86){var _0x588d8a=typeof _0x49db08[_0x082b('0x1d')]===_0x082b('0x1e')&&typeof _0x49db08['limit']===_0x082b('0x1e');var _0x4785fb=_0x2c4f86[_0x082b('0x1f')];var _0x3aa0ed=_0x588d8a?0x0:_0x49db08['offset'];var _0x2772e9=_0x588d8a?_0x2c4f86[_0x082b('0x1f')]:_0x49db08[_0x082b('0x1d')]+_0x49db08[_0x082b('0x20')];var _0x1e8fa5;if(_0x2772e9>=_0x4785fb){_0x2772e9=_0x4785fb;_0x1e8fa5=0xc8;}else{_0x1e8fa5=0xce;}_0x1dc46e[_0x082b('0x1a')](_0x1e8fa5);return _0x1dc46e[_0x082b('0x21')](_0x082b('0x22'),_0x3aa0ed+'-'+_0x2772e9+'/'+_0x4785fb)['json'](_0x2c4f86);}return null;};}function patchUpdates(_0x9faf2){return function(_0x2fffc3){try{jsonpatch[_0x082b('0x23')](_0x2fffc3,_0x9faf2,!![]);}catch(_0x5aab0a){return BPromise[_0x082b('0x24')](_0x5aab0a);}return _0x2fffc3[_0x082b('0x25')]();};}function saveUpdates(_0x42c0ab,_0x56fbd2){return function(_0x47c0d9){if(_0x47c0d9){return _0x47c0d9[_0x082b('0x26')](_0x42c0ab)['then'](function(_0x5cb670){return _0x5cb670;});}return null;};}function removeEntity(_0x3ae657,_0xaa7eb){return function(_0x271340){if(_0x271340){return _0x271340[_0x082b('0x27')]()[_0x082b('0x28')](function(){_0x3ae657['status'](0xcc)[_0x082b('0x1b')]();});}};}function handleEntityNotFound(_0x1254fd,_0x40d737){return function(_0x1082bf){if(!_0x1082bf){_0x1254fd[_0x082b('0x29')](0x194);}return _0x1082bf;};}function handleError(_0x8c3c9,_0x1b6dfc){_0x1b6dfc=_0x1b6dfc||0x1f4;return function(_0x4e30e8){logger[_0x082b('0x2a')](_0x4e30e8['stack']);if(_0x4e30e8[_0x082b('0x2b')]){delete _0x4e30e8['name'];}_0x8c3c9[_0x082b('0x1a')](_0x1b6dfc)[_0x082b('0x2c')](_0x4e30e8);};}exports['show']=function(_0x2279d7,_0x4b172b){var _0x228a5a={'raw':!![],'where':{'id':_0x2279d7[_0x082b('0x2d')]['id']}},_0x55d059={};_0x55d059[_0x082b('0x2e')]=_[_0x082b('0x2f')](db[_0x082b('0x30')][_0x082b('0x31')]);_0x55d059[_0x082b('0x32')]=_[_0x082b('0x2f')](_0x2279d7[_0x082b('0x32')]);_0x55d059[_0x082b('0x33')]=_[_0x082b('0x34')](_0x55d059[_0x082b('0x2e')],_0x55d059[_0x082b('0x32')]);_0x228a5a['attributes']=_[_0x082b('0x34')](_0x55d059[_0x082b('0x2e')],qs[_0x082b('0x35')](_0x2279d7[_0x082b('0x32')][_0x082b('0x35')]));_0x228a5a['attributes']=_0x228a5a['attributes'][_0x082b('0x36')]?_0x228a5a[_0x082b('0x37')]:_0x55d059['model'];if(_0x2279d7[_0x082b('0x32')][_0x082b('0x38')]){_0x228a5a['include']=[{'all':!![]}];}_0x228a5a=_[_0x082b('0x39')]({},_0x228a5a,_0x2279d7['options']);return db[_0x082b('0x30')][_0x082b('0x3a')](_0x228a5a)['then'](handleEntityNotFound(_0x4b172b,null))[_0x082b('0x28')](respondWithResult(_0x4b172b,null))[_0x082b('0x3b')](handleError(_0x4b172b,null));};exports[_0x082b('0x26')]=function(_0x16880f,_0x171bd8){if(_0x16880f['body']['id']){delete _0x16880f[_0x082b('0x3c')]['id'];}return db['ChatApplication'][_0x082b('0x3a')]({'where':{'id':_0x16880f[_0x082b('0x2d')]['id']}})[_0x082b('0x28')](handleEntityNotFound(_0x171bd8,null))[_0x082b('0x28')](saveUpdates(_0x16880f[_0x082b('0x3c')],null))[_0x082b('0x28')](respondWithResult(_0x171bd8,null))[_0x082b('0x3b')](handleError(_0x171bd8,null));};exports[_0x082b('0x27')]=function(_0x56f15c,_0x1e4745){return db[_0x082b('0x30')]['find']({'where':{'id':_0x56f15c[_0x082b('0x2d')]['id']}})[_0x082b('0x28')](handleEntityNotFound(_0x1e4745,null))[_0x082b('0x28')](removeEntity(_0x1e4745,null))[_0x082b('0x3b')](handleError(_0x1e4745,null));}; \ No newline at end of file +var _0xc2da=['includeAll','include','options','find','catch','body','params','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','name','send','show','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','model'];(function(_0x3d6d15,_0x32ac32){var _0x22e018=function(_0x291394){while(--_0x291394){_0x3d6d15['push'](_0x3d6d15['shift']());}};_0x22e018(++_0x32ac32);}(_0xc2da,0x124));var _0xac2d=function(_0x36176e,_0x3719b7){_0x36176e=_0x36176e-0x0;var _0xbe79bc=_0xc2da[_0x36176e];return _0xbe79bc;};'use strict';var emlformat=require(_0xac2d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac2d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac2d('0x2'));var moment=require('moment');var BPromise=require(_0xac2d('0x3'));var Mustache=require(_0xac2d('0x4'));var util=require(_0xac2d('0x5'));var path=require(_0xac2d('0x6'));var sox=require(_0xac2d('0x7'));var csv=require(_0xac2d('0x8'));var ejs=require(_0xac2d('0x9'));var fs=require('fs');var fs_extra=require(_0xac2d('0xa'));var _=require(_0xac2d('0xb'));var squel=require(_0xac2d('0xc'));var crypto=require(_0xac2d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac2d('0x8'));var querystring=require('querystring');var Papa=require(_0xac2d('0xe'));var Redis=require(_0xac2d('0xf'));var authService=require(_0xac2d('0x10'));var qs=require(_0xac2d('0x11'));var as=require(_0xac2d('0x12'));var hardwareService=require(_0xac2d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xac2d('0x14'));var config=require(_0xac2d('0x15'));var licenseUtil=require(_0xac2d('0x16'));var db=require(_0xac2d('0x17'))['db'];function respondWithStatusCode(_0x4b9e88,_0x21aa1b){_0x21aa1b=_0x21aa1b||0xcc;return function(_0x20fa0d){if(_0x20fa0d){return _0x4b9e88[_0xac2d('0x18')](_0x21aa1b);}return _0x4b9e88[_0xac2d('0x19')](_0x21aa1b)[_0xac2d('0x1a')]();};}function respondWithResult(_0x2bed84,_0x284984){_0x284984=_0x284984||0xc8;return function(_0x897641){if(_0x897641){return _0x2bed84[_0xac2d('0x19')](_0x284984)[_0xac2d('0x1b')](_0x897641);}};}function respondWithFilteredResult(_0x11a3aa,_0x33d014){return function(_0x74853a){if(_0x74853a){var _0x2d92b5=typeof _0x33d014[_0xac2d('0x1c')]==='undefined'&&typeof _0x33d014[_0xac2d('0x1d')]===_0xac2d('0x1e');var _0x50ac65=_0x74853a[_0xac2d('0x1f')];var _0xed956b=_0x2d92b5?0x0:_0x33d014[_0xac2d('0x1c')];var _0x4d34fa=_0x2d92b5?_0x74853a[_0xac2d('0x1f')]:_0x33d014['offset']+_0x33d014[_0xac2d('0x1d')];var _0x3651e6;if(_0x4d34fa>=_0x50ac65){_0x4d34fa=_0x50ac65;_0x3651e6=0xc8;}else{_0x3651e6=0xce;}_0x11a3aa['status'](_0x3651e6);return _0x11a3aa[_0xac2d('0x20')]('Content-Range',_0xed956b+'-'+_0x4d34fa+'/'+_0x50ac65)['json'](_0x74853a);}return null;};}function patchUpdates(_0x510e85){return function(_0x5eaaef){try{jsonpatch[_0xac2d('0x21')](_0x5eaaef,_0x510e85,!![]);}catch(_0x21c407){return BPromise[_0xac2d('0x22')](_0x21c407);}return _0x5eaaef[_0xac2d('0x23')]();};}function saveUpdates(_0x211d26,_0x391911){return function(_0x3454ea){if(_0x3454ea){return _0x3454ea[_0xac2d('0x24')](_0x211d26)[_0xac2d('0x25')](function(_0x3f1212){return _0x3f1212;});}return null;};}function removeEntity(_0xafa502,_0x226b6b){return function(_0x1df55b){if(_0x1df55b){return _0x1df55b[_0xac2d('0x26')]()[_0xac2d('0x25')](function(){_0xafa502[_0xac2d('0x19')](0xcc)[_0xac2d('0x1a')]();});}};}function handleEntityNotFound(_0x10da1d,_0x271e47){return function(_0x5f00a0){if(!_0x5f00a0){_0x10da1d[_0xac2d('0x18')](0x194);}return _0x5f00a0;};}function handleError(_0x38cad3,_0x337228){_0x337228=_0x337228||0x1f4;return function(_0x2323c8){logger['error'](_0x2323c8['stack']);if(_0x2323c8[_0xac2d('0x27')]){delete _0x2323c8[_0xac2d('0x27')];}_0x38cad3[_0xac2d('0x19')](_0x337228)[_0xac2d('0x28')](_0x2323c8);};}exports[_0xac2d('0x29')]=function(_0x2906ac,_0x104af8){var _0x42aa82={'raw':!![],'where':{'id':_0x2906ac['params']['id']}},_0x2ac875={};_0x2ac875['model']=_[_0xac2d('0x2a')](db[_0xac2d('0x2b')][_0xac2d('0x2c')]);_0x2ac875[_0xac2d('0x2d')]=_[_0xac2d('0x2a')](_0x2906ac['query']);_0x2ac875[_0xac2d('0x2e')]=_[_0xac2d('0x2f')](_0x2ac875['model'],_0x2ac875[_0xac2d('0x2d')]);_0x42aa82[_0xac2d('0x30')]=_[_0xac2d('0x2f')](_0x2ac875[_0xac2d('0x31')],qs['fields'](_0x2906ac[_0xac2d('0x2d')]['fields']));_0x42aa82[_0xac2d('0x30')]=_0x42aa82[_0xac2d('0x30')]['length']?_0x42aa82[_0xac2d('0x30')]:_0x2ac875[_0xac2d('0x31')];if(_0x2906ac[_0xac2d('0x2d')][_0xac2d('0x32')]){_0x42aa82[_0xac2d('0x33')]=[{'all':!![]}];}_0x42aa82=_['merge']({},_0x42aa82,_0x2906ac[_0xac2d('0x34')]);return db['ChatApplication'][_0xac2d('0x35')](_0x42aa82)['then'](handleEntityNotFound(_0x104af8,null))[_0xac2d('0x25')](respondWithResult(_0x104af8,null))[_0xac2d('0x36')](handleError(_0x104af8,null));};exports['update']=function(_0x5bd1e3,_0x3cf4d5){if(_0x5bd1e3[_0xac2d('0x37')]['id']){delete _0x5bd1e3[_0xac2d('0x37')]['id'];}return db[_0xac2d('0x2b')][_0xac2d('0x35')]({'where':{'id':_0x5bd1e3[_0xac2d('0x38')]['id']}})[_0xac2d('0x25')](handleEntityNotFound(_0x3cf4d5,null))['then'](saveUpdates(_0x5bd1e3[_0xac2d('0x37')],null))[_0xac2d('0x25')](respondWithResult(_0x3cf4d5,null))[_0xac2d('0x36')](handleError(_0x3cf4d5,null));};exports[_0xac2d('0x26')]=function(_0x2d90c2,_0x4eb307){return db[_0xac2d('0x2b')][_0xac2d('0x35')]({'where':{'id':_0x2d90c2[_0xac2d('0x38')]['id']}})[_0xac2d('0x25')](handleEntityNotFound(_0x4eb307,null))[_0xac2d('0x25')](removeEntity(_0x4eb307,null))[_0xac2d('0x36')](handleError(_0x4eb307,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index ed8fa29..19fc499 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 _0x20bc=['chat_applications','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','ChatApplication'];(function(_0x275cea,_0x3cc1eb){var _0x5691bd=function(_0x176fd1){while(--_0x176fd1){_0x275cea['push'](_0x275cea['shift']());}};_0x5691bd(++_0x3cc1eb);}(_0x20bc,0x1c5));var _0xc20b=function(_0x2e9b5b,_0x3e1332){_0x2e9b5b=_0x2e9b5b-0x0;var _0x734c46=_0x20bc[_0x2e9b5b];return _0x734c46;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc20b('0x0'))(_0xc20b('0x1'));var moment=require(_0xc20b('0x2'));var BPromise=require(_0xc20b('0x3'));var rp=require(_0xc20b('0x4'));var fs=require('fs');var path=require(_0xc20b('0x5'));var rimraf=require('rimraf');var config=require(_0xc20b('0x6'));var attributes=require('./chatApplication.attributes');module[_0xc20b('0x7')]=function(_0x18de6c,_0x5828da){return _0x18de6c['define'](_0xc20b('0x8'),attributes,{'tableName':_0xc20b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc20b('0xa')});}; \ No newline at end of file +var _0x271d=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4_unicode_ci'];(function(_0x143e19,_0x184769){var _0xa7b25d=function(_0x2a7711){while(--_0x2a7711){_0x143e19['push'](_0x143e19['shift']());}};_0xa7b25d(++_0x184769);}(_0x271d,0xc4));var _0xd271=function(_0x4b7e2a,_0x27893d){_0x4b7e2a=_0x4b7e2a-0x0;var _0x5d49a3=_0x271d[_0x4b7e2a];return _0x5d49a3;};'use strict';var _=require(_0xd271('0x0'));var util=require(_0xd271('0x1'));var logger=require('../../config/logger')(_0xd271('0x2'));var moment=require('moment');var BPromise=require(_0xd271('0x3'));var rp=require(_0xd271('0x4'));var fs=require('fs');var path=require(_0xd271('0x5'));var rimraf=require(_0xd271('0x6'));var config=require(_0xd271('0x7'));var attributes=require(_0xd271('0x8'));module[_0xd271('0x9')]=function(_0x3a1c19,_0xdcd18c){return _0x3a1c19[_0xd271('0xa')](_0xd271('0xb'),attributes,{'tableName':_0xd271('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd271('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 0886366..5d8ec6a 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 _0x56f4=['request\x20sent','stringify','error','code','message','catch','lodash','util','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','ChatApplication,\x20%s,\x20%s'];(function(_0x1b1b7b,_0xf3cb03){var _0x4d3852=function(_0x2d5494){while(--_0x2d5494){_0x1b1b7b['push'](_0x1b1b7b['shift']());}};_0x4d3852(++_0xf3cb03);}(_0x56f4,0x6f));var _0x456f=function(_0x119091,_0x118d6d){_0x119091=_0x119091-0x0;var _0x503f8c=_0x56f4[_0x119091];return _0x503f8c;};'use strict';var _=require(_0x456f('0x0'));var util=require(_0x456f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x456f('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x456f('0x3'))(_0x456f('0x4'));var config=require(_0x456f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x456f('0x6')][_0x456f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3fcec2,_0x206a99,_0x39b92e){return new BPromise(function(_0x118494,_0x2abb4c){return client['request'](_0x3fcec2,_0x39b92e)['then'](function(_0x423fa4){logger['info'](_0x456f('0x8'),_0x206a99,_0x456f('0x9'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x206a99,_0x456f('0x9'),JSON[_0x456f('0xa')](_0x423fa4));if(_0x423fa4[_0x456f('0xb')]){if(_0x423fa4['error'][_0x456f('0xc')]===0x1f4){logger['error'](_0x456f('0x8'),_0x206a99,_0x423fa4[_0x456f('0xb')][_0x456f('0xd')]);return _0x2abb4c(_0x423fa4['error'][_0x456f('0xd')]);}logger[_0x456f('0xb')](_0x456f('0x8'),_0x206a99,_0x423fa4[_0x456f('0xb')]['message']);return _0x118494(_0x423fa4['error'][_0x456f('0xd')]);}else{logger['info'](_0x456f('0x8'),_0x206a99,_0x456f('0x9'));_0x118494(_0x423fa4['result'][_0x456f('0xd')]);}})[_0x456f('0xe')](function(_0x320624){logger[_0x456f('0xb')](_0x456f('0x8'),_0x206a99,_0x320624);_0x2abb4c(_0x320624);});});} \ No newline at end of file +var _0x412c=['error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x22608c,_0x20fac7){var _0xf01d6d=function(_0x31ffbc){while(--_0x31ffbc){_0x22608c['push'](_0x22608c['shift']());}};_0xf01d6d(++_0x20fac7);}(_0x412c,0x155));var _0xc412=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x412c[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0xc412('0x0'));var util=require(_0xc412('0x1'));var moment=require(_0xc412('0x2'));var BPromise=require(_0xc412('0x3'));var rs=require(_0xc412('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc412('0x5'))(_0xc412('0x6'));var config=require(_0xc412('0x7'));var jayson=require(_0xc412('0x8'));var client=jayson[_0xc412('0x9')][_0xc412('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5699d9,_0x1f1249,_0x1841fc){return new BPromise(function(_0x347598,_0x32cf6a){return client['request'](_0x5699d9,_0x1841fc)['then'](function(_0x41071c){logger['info'](_0xc412('0xb'),_0x1f1249,_0xc412('0xc'));logger[_0xc412('0xd')](_0xc412('0xe'),_0x1f1249,_0xc412('0xc'),JSON[_0xc412('0xf')](_0x41071c));if(_0x41071c[_0xc412('0x10')]){if(_0x41071c[_0xc412('0x10')][_0xc412('0x11')]===0x1f4){logger[_0xc412('0x10')]('ChatApplication,\x20%s,\x20%s',_0x1f1249,_0x41071c['error']['message']);return _0x32cf6a(_0x41071c['error']['message']);}logger[_0xc412('0x10')](_0xc412('0xb'),_0x1f1249,_0x41071c[_0xc412('0x10')][_0xc412('0x12')]);return _0x347598(_0x41071c['error'][_0xc412('0x12')]);}else{logger[_0xc412('0x13')]('ChatApplication,\x20%s,\x20%s',_0x1f1249,_0xc412('0xc'));_0x347598(_0x41071c['result'][_0xc412('0x12')]);}})[_0xc412('0x14')](function(_0x577fed){logger[_0xc412('0x10')](_0xc412('0xb'),_0x1f1249,_0x577fed);_0x32cf6a(_0x577fed);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 736ccb0..a8acb3a 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 _0x1f31=['util','path','express','Router','fs-extra','../../components/interaction/service','./chatApplication.controller','get','/:id','show','put','isAuthenticated','update','destroy'];(function(_0x2e4e9f,_0x85c591){var _0x4e84dd=function(_0x27a81d){while(--_0x27a81d){_0x2e4e9f['push'](_0x2e4e9f['shift']());}};_0x4e84dd(++_0x85c591);}(_0x1f31,0xa8));var _0x11f3=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0x1f31[_0xbec8e6];return _0x4aa6f2;};'use strict';var multer=require('multer');var util=require(_0x11f3('0x0'));var path=require(_0x11f3('0x1'));var timeout=require('connect-timeout');var express=require(_0x11f3('0x2'));var router=express[_0x11f3('0x3')]();var fs_extra=require(_0x11f3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x11f3('0x5'));var config=require('../../config/environment');var controller=require(_0x11f3('0x6'));router[_0x11f3('0x7')](_0x11f3('0x8'),auth['isAuthenticated'](),controller[_0x11f3('0x9')]);router[_0x11f3('0xa')]('/:id',auth[_0x11f3('0xb')](),controller[_0x11f3('0xc')]);router['delete'](_0x11f3('0x8'),auth[_0x11f3('0xb')](),controller[_0x11f3('0xd')]);module['exports']=router; \ No newline at end of file +var _0x1dd3=['update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','get','/:id','isAuthenticated','show'];(function(_0x370597,_0x39eaf2){var _0x3e5ca2=function(_0x1e1d7b){while(--_0x1e1d7b){_0x370597['push'](_0x370597['shift']());}};_0x3e5ca2(++_0x39eaf2);}(_0x1dd3,0x1be));var _0x31dd=function(_0x19103c,_0x4c6c0d){_0x19103c=_0x19103c-0x0;var _0x371d15=_0x1dd3[_0x19103c];return _0x371d15;};'use strict';var multer=require('multer');var util=require(_0x31dd('0x0'));var path=require(_0x31dd('0x1'));var timeout=require('connect-timeout');var express=require(_0x31dd('0x2'));var router=express['Router']();var fs_extra=require(_0x31dd('0x3'));var auth=require(_0x31dd('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0x31dd('0x5')](_0x31dd('0x6'),auth[_0x31dd('0x7')](),controller[_0x31dd('0x8')]);router['put'](_0x31dd('0x6'),auth[_0x31dd('0x7')](),controller[_0x31dd('0x9')]);router[_0x31dd('0xa')]('/:id',auth[_0x31dd('0x7')](),controller[_0x31dd('0xb')]);module[_0x31dd('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 51a0a39..551d07f 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 _0x6f08=['sequelize','exports','STRING','BOOLEAN'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x6f08,0x9c));var _0x86f0=function(_0x12b21a,_0x3f846e){_0x12b21a=_0x12b21a-0x0;var _0x235760=_0x6f08[_0x12b21a];return _0x235760;};'use strict';var Sequelize=require(_0x86f0('0x0'));module[_0x86f0('0x1')]={'name':{'type':Sequelize[_0x86f0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x86f0('0x2')]},'write':{'type':Sequelize[_0x86f0('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4e09=['BOOLEAN','exports','STRING'];(function(_0x13a35a,_0x325d54){var _0x316fac=function(_0x5aa93f){while(--_0x5aa93f){_0x13a35a['push'](_0x13a35a['shift']());}};_0x316fac(++_0x325d54);}(_0x4e09,0x166));var _0x94e0=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4e09[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require('sequelize');module[_0x94e0('0x0')]={'name':{'type':Sequelize[_0x94e0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x94e0('0x1')]},'write':{'type':Sequelize[_0x94e0('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 135ecec..db6c6ce 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 _0xd2b2=['rows','show','params','rawAttributes','find','catch','create','body','destroy','describe','getUnread','toInteger','addMembers','ids','omit','getMembers','findOne','User','pick','filter','addMessage','ChatInternalMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','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/license/util','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','then','stack','name','index','map','ChatGroup','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd2b2,0x138));var _0x2d2b=function(_0x55eaf7,_0x2ddd6c){_0x55eaf7=_0x55eaf7-0x0;var _0x461760=_0xd2b2[_0x55eaf7];return _0x461760;};'use strict';var emlformat=require(_0x2d2b('0x0'));var rimraf=require(_0x2d2b('0x1'));var zipdir=require(_0x2d2b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2d2b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2d2b('0x4'));var util=require(_0x2d2b('0x5'));var path=require(_0x2d2b('0x6'));var sox=require(_0x2d2b('0x7'));var csv=require(_0x2d2b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d2b('0x9'));var _=require(_0x2d2b('0xa'));var squel=require(_0x2d2b('0xb'));var crypto=require(_0x2d2b('0xc'));var jsforce=require(_0x2d2b('0xd'));var deskjs=require(_0x2d2b('0xe'));var toCsv=require(_0x2d2b('0x8'));var querystring=require(_0x2d2b('0xf'));var Papa=require(_0x2d2b('0x10'));var Redis=require('ioredis');var authService=require(_0x2d2b('0x11'));var qs=require(_0x2d2b('0x12'));var as=require(_0x2d2b('0x13'));var hardwareService=require(_0x2d2b('0x14'));var logger=require(_0x2d2b('0x15'))(_0x2d2b('0x16'));var utils=require(_0x2d2b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2d2b('0x18'));var db=require('../../mysqldb')['db'];config[_0x2d2b('0x19')]=_[_0x2d2b('0x1a')](config[_0x2d2b('0x19')],{'host':_0x2d2b('0x1b'),'port':0x18eb});var socket=require(_0x2d2b('0x1c'))(new Redis(config[_0x2d2b('0x19')]));require(_0x2d2b('0x1d'))['register'](socket);function respondWithStatusCode(_0x33c73c,_0x97e7cb){_0x97e7cb=_0x97e7cb||0xcc;return function(_0x26b2c3){if(_0x26b2c3){return _0x33c73c[_0x2d2b('0x1e')](_0x97e7cb);}return _0x33c73c[_0x2d2b('0x1f')](_0x97e7cb)[_0x2d2b('0x20')]();};}function respondWithResult(_0x7cb236,_0x20b419){_0x20b419=_0x20b419||0xc8;return function(_0x3e5736){if(_0x3e5736){return _0x7cb236['status'](_0x20b419)['json'](_0x3e5736);}};}function respondWithFilteredResult(_0x1c104b,_0x9c5be0){return function(_0x74c6ce){if(_0x74c6ce){var _0x2ea5c5=typeof _0x9c5be0[_0x2d2b('0x21')]===_0x2d2b('0x22')&&typeof _0x9c5be0[_0x2d2b('0x23')]===_0x2d2b('0x22');var _0x598198=_0x74c6ce[_0x2d2b('0x24')];var _0x17ccc4=_0x2ea5c5?0x0:_0x9c5be0['offset'];var _0x5be82c=_0x2ea5c5?_0x74c6ce[_0x2d2b('0x24')]:_0x9c5be0[_0x2d2b('0x21')]+_0x9c5be0['limit'];var _0x50cf85;if(_0x5be82c>=_0x598198){_0x5be82c=_0x598198;_0x50cf85=0xc8;}else{_0x50cf85=0xce;}_0x1c104b[_0x2d2b('0x1f')](_0x50cf85);return _0x1c104b[_0x2d2b('0x25')]('Content-Range',_0x17ccc4+'-'+_0x5be82c+'/'+_0x598198)['json'](_0x74c6ce);}return null;};}function patchUpdates(_0x445ee1){return function(_0x600be9){try{jsonpatch[_0x2d2b('0x26')](_0x600be9,_0x445ee1,!![]);}catch(_0x2fb5dc){return BPromise[_0x2d2b('0x27')](_0x2fb5dc);}return _0x600be9['save']();};}function saveUpdates(_0x54dd46,_0xea390f){return function(_0x48e376){if(_0x48e376){return _0x48e376['update'](_0x54dd46)[_0x2d2b('0x28')](function(_0x222dd7){return _0x222dd7;});}return null;};}function removeEntity(_0x2eb048,_0x5769ae){return function(_0x15de29){if(_0x15de29){return _0x15de29['destroy']()[_0x2d2b('0x28')](function(){_0x2eb048[_0x2d2b('0x1f')](0xcc)[_0x2d2b('0x20')]();});}};}function handleEntityNotFound(_0x43b375,_0xa2a23d){return function(_0xded75){if(!_0xded75){_0x43b375[_0x2d2b('0x1e')](0x194);}return _0xded75;};}function handleError(_0x51afc6,_0x2ab2a5){_0x2ab2a5=_0x2ab2a5||0x1f4;return function(_0x343241){logger['error'](_0x343241[_0x2d2b('0x29')]);if(_0x343241['name']){delete _0x343241[_0x2d2b('0x2a')];}_0x51afc6['status'](_0x2ab2a5)['send'](_0x343241);};}exports[_0x2d2b('0x2b')]=function(_0x59fbfc,_0x486cd7){var _0x28a1d6={},_0x4498d8={},_0x5bcf31={'count':0x0,'rows':[]};var _0x2d5e1d=_[_0x2d2b('0x2c')](db[_0x2d2b('0x2d')]['rawAttributes'],function(_0x13e51a){return{'name':_0x13e51a[_0x2d2b('0x2e')],'type':_0x13e51a[_0x2d2b('0x2f')][_0x2d2b('0x30')]};});_0x4498d8['model']=_[_0x2d2b('0x2c')](_0x2d5e1d,'name');_0x4498d8[_0x2d2b('0x31')]=_[_0x2d2b('0x32')](_0x59fbfc['query']);_0x4498d8['filters']=_['intersection'](_0x4498d8[_0x2d2b('0x33')],_0x4498d8['query']);_0x28a1d6[_0x2d2b('0x34')]=_[_0x2d2b('0x35')](_0x4498d8[_0x2d2b('0x33')],qs[_0x2d2b('0x36')](_0x59fbfc['query'][_0x2d2b('0x36')]));_0x28a1d6[_0x2d2b('0x34')]=_0x28a1d6[_0x2d2b('0x34')][_0x2d2b('0x37')]?_0x28a1d6[_0x2d2b('0x34')]:_0x4498d8[_0x2d2b('0x33')];if(!_0x59fbfc['query'][_0x2d2b('0x38')](_0x2d2b('0x39'))){_0x28a1d6[_0x2d2b('0x23')]=qs[_0x2d2b('0x23')](_0x59fbfc['query'][_0x2d2b('0x23')]);_0x28a1d6['offset']=qs[_0x2d2b('0x21')](_0x59fbfc[_0x2d2b('0x31')]['offset']);}_0x28a1d6[_0x2d2b('0x3a')]=qs[_0x2d2b('0x3b')](_0x59fbfc[_0x2d2b('0x31')]['sort']);_0x28a1d6['where']=qs[_0x2d2b('0x3c')](_['pick'](_0x59fbfc[_0x2d2b('0x31')],_0x4498d8[_0x2d2b('0x3c')]),_0x2d5e1d);if(_0x59fbfc['query']['filter']){_0x28a1d6[_0x2d2b('0x3d')]=_[_0x2d2b('0x3e')](_0x28a1d6[_0x2d2b('0x3d')],{'$or':_[_0x2d2b('0x2c')](_0x2d5e1d,function(_0x247ef7){if(_0x247ef7[_0x2d2b('0x2f')]!==_0x2d2b('0x3f')){var _0x56b181={};_0x56b181[_0x247ef7[_0x2d2b('0x2a')]]={'$like':'%'+_0x59fbfc[_0x2d2b('0x31')]['filter']+'%'};return _0x56b181;}})});}_0x28a1d6=_[_0x2d2b('0x3e')]({},_0x28a1d6,_0x59fbfc[_0x2d2b('0x40')]);var _0x356415={'where':_0x28a1d6[_0x2d2b('0x3d')]};return db[_0x2d2b('0x2d')][_0x2d2b('0x24')](_0x356415)[_0x2d2b('0x28')](function(_0x2fd60a){_0x5bcf31[_0x2d2b('0x24')]=_0x2fd60a;if(_0x59fbfc[_0x2d2b('0x31')][_0x2d2b('0x41')]){_0x28a1d6[_0x2d2b('0x42')]=[{'all':!![]}];}return db[_0x2d2b('0x2d')][_0x2d2b('0x43')](_0x28a1d6);})['then'](function(_0x3a0024){_0x5bcf31[_0x2d2b('0x44')]=_0x3a0024;return _0x5bcf31;})[_0x2d2b('0x28')](respondWithFilteredResult(_0x486cd7,_0x28a1d6))['catch'](handleError(_0x486cd7,null));};exports[_0x2d2b('0x45')]=function(_0x238ffa,_0x2b0d58){var _0x512de0={'raw':!![],'where':{'id':_0x238ffa[_0x2d2b('0x46')]['id']}},_0x12d43a={};_0x12d43a[_0x2d2b('0x33')]=_[_0x2d2b('0x32')](db['ChatGroup'][_0x2d2b('0x47')]);_0x12d43a['query']=_[_0x2d2b('0x32')](_0x238ffa[_0x2d2b('0x31')]);_0x12d43a[_0x2d2b('0x3c')]=_['intersection'](_0x12d43a[_0x2d2b('0x33')],_0x12d43a[_0x2d2b('0x31')]);_0x512de0['attributes']=_[_0x2d2b('0x35')](_0x12d43a[_0x2d2b('0x33')],qs[_0x2d2b('0x36')](_0x238ffa[_0x2d2b('0x31')][_0x2d2b('0x36')]));_0x512de0['attributes']=_0x512de0[_0x2d2b('0x34')]['length']?_0x512de0[_0x2d2b('0x34')]:_0x12d43a[_0x2d2b('0x33')];if(_0x238ffa[_0x2d2b('0x31')][_0x2d2b('0x41')]){_0x512de0['include']=[{'all':!![]}];}_0x512de0=_[_0x2d2b('0x3e')]({},_0x512de0,_0x238ffa[_0x2d2b('0x40')]);return db[_0x2d2b('0x2d')][_0x2d2b('0x48')](_0x512de0)['then'](handleEntityNotFound(_0x2b0d58,null))[_0x2d2b('0x28')](respondWithResult(_0x2b0d58,null))[_0x2d2b('0x49')](handleError(_0x2b0d58,null));};exports[_0x2d2b('0x4a')]=function(_0x5723ed,_0x2370e5){return db[_0x2d2b('0x2d')]['create'](_0x5723ed[_0x2d2b('0x4b')],{})[_0x2d2b('0x28')](respondWithResult(_0x2370e5,0xc9))[_0x2d2b('0x49')](handleError(_0x2370e5,null));};exports['update']=function(_0x23e8df,_0x5c5dd2){if(_0x23e8df[_0x2d2b('0x4b')]['id']){delete _0x23e8df['body']['id'];}return db[_0x2d2b('0x2d')][_0x2d2b('0x48')]({'where':{'id':_0x23e8df[_0x2d2b('0x46')]['id']}})[_0x2d2b('0x28')](handleEntityNotFound(_0x5c5dd2,null))[_0x2d2b('0x28')](saveUpdates(_0x23e8df['body'],null))[_0x2d2b('0x28')](respondWithResult(_0x5c5dd2,null))[_0x2d2b('0x49')](handleError(_0x5c5dd2,null));};exports[_0x2d2b('0x4c')]=function(_0x4dca25,_0x531b9e){return db[_0x2d2b('0x2d')][_0x2d2b('0x48')]({'where':{'id':_0x4dca25[_0x2d2b('0x46')]['id']}})[_0x2d2b('0x28')](handleEntityNotFound(_0x531b9e,null))[_0x2d2b('0x28')](removeEntity(_0x531b9e,null))['catch'](handleError(_0x531b9e,null));};exports[_0x2d2b('0x4d')]=function(_0x81bc2c,_0x2a05f4){return db[_0x2d2b('0x2d')][_0x2d2b('0x4d')]()[_0x2d2b('0x28')](respondWithResult(_0x2a05f4,null))[_0x2d2b('0x49')](handleError(_0x2a05f4,null));};exports[_0x2d2b('0x4e')]=function(_0x590121,_0x56332e,_0x527b88){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x590121[_0x2d2b('0x46')]['id'],'ToId':_0x590121['user']['id'],'read':![]}})[_0x2d2b('0x28')](function(_0x51bd7c){return{'id':_[_0x2d2b('0x4f')](_0x590121[_0x2d2b('0x46')]['id']),'count':_0x51bd7c};})[_0x2d2b('0x28')](respondWithResult(_0x56332e,null))[_0x2d2b('0x49')](handleError(_0x56332e,null));};exports[_0x2d2b('0x50')]=function(_0xca1805,_0xbb876a,_0x57fb7c){return db[_0x2d2b('0x2d')]['find']({'where':{'id':_0xca1805[_0x2d2b('0x46')]['id']}})[_0x2d2b('0x28')](handleEntityNotFound(_0xbb876a,null))[_0x2d2b('0x28')](function(_0xebb9c1){if(_0xebb9c1){return _0xebb9c1[_0x2d2b('0x50')](_0xca1805['body'][_0x2d2b('0x51')],_[_0x2d2b('0x52')](_0xca1805[_0x2d2b('0x4b')],['ids','id'])||{});}})[_0x2d2b('0x28')](respondWithResult(_0xbb876a,null))[_0x2d2b('0x49')](handleError(_0xbb876a,null));};exports[_0x2d2b('0x53')]=function(_0x5a08fc,_0x3e59f8,_0x1fcbf6){var _0x403792={};var _0x1a300d={};var _0x2f358c;var _0x50f92c;return db[_0x2d2b('0x2d')][_0x2d2b('0x54')]({'where':{'id':_0x5a08fc[_0x2d2b('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e59f8,null))[_0x2d2b('0x28')](function(_0x315001){if(_0x315001){_0x2f358c=_0x315001;_0x1a300d[_0x2d2b('0x33')]=_[_0x2d2b('0x32')](db[_0x2d2b('0x55')][_0x2d2b('0x47')]);_0x1a300d[_0x2d2b('0x31')]=_[_0x2d2b('0x32')](_0x5a08fc['query']);_0x1a300d[_0x2d2b('0x3c')]=_['intersection'](_0x1a300d['model'],_0x1a300d[_0x2d2b('0x31')]);_0x403792['attributes']=_['intersection'](_0x1a300d[_0x2d2b('0x33')],qs[_0x2d2b('0x36')](_0x5a08fc[_0x2d2b('0x31')][_0x2d2b('0x36')]));_0x403792[_0x2d2b('0x34')]=_0x403792['attributes']['length']?_0x403792[_0x2d2b('0x34')]:_0x1a300d[_0x2d2b('0x33')];_0x403792[_0x2d2b('0x3a')]=qs[_0x2d2b('0x3b')](_0x5a08fc['query'][_0x2d2b('0x3b')]);_0x403792['where']=qs['filters'](_[_0x2d2b('0x56')](_0x5a08fc[_0x2d2b('0x31')],_0x1a300d['filters']));if(_0x5a08fc[_0x2d2b('0x31')][_0x2d2b('0x57')]){_0x403792['where']=_[_0x2d2b('0x3e')](_0x403792[_0x2d2b('0x3d')],{'$or':_[_0x2d2b('0x2c')](_0x403792['attributes'],function(_0x2f4c14){var _0x2ab14f={};_0x2ab14f[_0x2f4c14]={'$like':'%'+_0x5a08fc['query'][_0x2d2b('0x57')]+'%'};return _0x2ab14f;})});}_0x403792=_[_0x2d2b('0x3e')]({},_0x403792,_0x5a08fc['options']);return _0x2f358c[_0x2d2b('0x53')](_0x403792);}})['then'](function(_0x13d44c){if(_0x13d44c){_0x50f92c=_0x13d44c['length'];if(!_0x5a08fc[_0x2d2b('0x31')]['hasOwnProperty']('nolimit')){_0x403792[_0x2d2b('0x23')]=qs[_0x2d2b('0x23')](_0x5a08fc[_0x2d2b('0x31')][_0x2d2b('0x23')]);_0x403792[_0x2d2b('0x21')]=qs['offset'](_0x5a08fc[_0x2d2b('0x31')][_0x2d2b('0x21')]);}return _0x2f358c[_0x2d2b('0x53')](_0x403792);}})[_0x2d2b('0x28')](function(_0x9e1ff4){if(_0x9e1ff4){return _0x9e1ff4?{'count':_0x50f92c,'rows':_0x9e1ff4}:null;}})[_0x2d2b('0x28')](respondWithResult(_0x3e59f8,null))[_0x2d2b('0x49')](handleError(_0x3e59f8,null));};exports['removeMembers']=function(_0x1d4be9,_0x2a2183,_0x2dcb1a){return db[_0x2d2b('0x2d')][_0x2d2b('0x48')]({'where':{'id':_0x1d4be9['params']['id']}})[_0x2d2b('0x28')](handleEntityNotFound(_0x2a2183,null))['then'](function(_0x279cce){if(_0x279cce){return _0x279cce['removeMembers'](_0x1d4be9[_0x2d2b('0x31')][_0x2d2b('0x51')]);}})[_0x2d2b('0x28')](respondWithStatusCode(_0x2a2183,null))[_0x2d2b('0x49')](handleError(_0x2a2183,null));};exports[_0x2d2b('0x58')]=function(_0x2684eb,_0x3e215b,_0xbc86af){if(_0x2684eb[_0x2d2b('0x4b')]['id']){delete _0x2684eb['body']['id'];}return db[_0x2d2b('0x2d')][_0x2d2b('0x48')]({'where':{'id':_0x2684eb['params']['id']}})[_0x2d2b('0x28')](handleEntityNotFound(_0x3e215b,null))['then'](function(_0x37d63f){if(_0x37d63f){_0x2684eb['body']['ChatGroupId']=_0x37d63f['id'];return db[_0x2d2b('0x59')]['create'](_0x2684eb[_0x2d2b('0x4b')]);}})[_0x2d2b('0x28')](respondWithResult(_0x3e215b,null))[_0x2d2b('0x49')](handleError(_0x3e215b,null));};exports[_0x2d2b('0x5a')]=function(_0x263df0,_0x40bf4d,_0x1a74c3){var _0x16ff0f={};var _0xf08c2a={};var _0x4d09ee;var _0x201ce7;return db[_0x2d2b('0x2d')][_0x2d2b('0x54')]({'where':{'id':_0x263df0[_0x2d2b('0x46')]['id']}})[_0x2d2b('0x28')](handleEntityNotFound(_0x40bf4d,null))[_0x2d2b('0x28')](function(_0x3391b7){if(_0x3391b7){_0x4d09ee=_0x3391b7;_0xf08c2a['model']=_[_0x2d2b('0x32')](db[_0x2d2b('0x59')]['rawAttributes']);_0xf08c2a['query']=_[_0x2d2b('0x32')](_0x263df0[_0x2d2b('0x31')]);_0xf08c2a[_0x2d2b('0x3c')]=_['intersection'](_0xf08c2a[_0x2d2b('0x33')],_0xf08c2a[_0x2d2b('0x31')]);_0x16ff0f[_0x2d2b('0x34')]=_[_0x2d2b('0x35')](_0xf08c2a['model'],qs[_0x2d2b('0x36')](_0x263df0[_0x2d2b('0x31')][_0x2d2b('0x36')]));_0x16ff0f[_0x2d2b('0x34')]=_0x16ff0f[_0x2d2b('0x34')][_0x2d2b('0x37')]?_0x16ff0f[_0x2d2b('0x34')]:_0xf08c2a[_0x2d2b('0x33')];_0x16ff0f[_0x2d2b('0x3a')]=qs['sort'](_0x263df0[_0x2d2b('0x31')][_0x2d2b('0x3b')]);_0x16ff0f[_0x2d2b('0x3d')]=qs[_0x2d2b('0x3c')](_[_0x2d2b('0x56')](_0x263df0[_0x2d2b('0x31')],_0xf08c2a[_0x2d2b('0x3c')]));if(_0x263df0['query']['filter']){_0x16ff0f[_0x2d2b('0x3d')]=_[_0x2d2b('0x3e')](_0x16ff0f[_0x2d2b('0x3d')],{'$or':_[_0x2d2b('0x2c')](_0x16ff0f[_0x2d2b('0x34')],function(_0x1ce237){var _0x5778a7={};_0x5778a7[_0x1ce237]={'$like':'%'+_0x263df0[_0x2d2b('0x31')][_0x2d2b('0x57')]+'%'};return _0x5778a7;})});}if(_0x263df0[_0x2d2b('0x31')]['$gte']){var _0x3ad178=_0x263df0[_0x2d2b('0x31')][_0x2d2b('0x5b')][_0x2d2b('0x5c')](',');var _0x4adaf4={};_0x4adaf4[_0x3ad178[0x0]]={'$gte':moment(_0x3ad178[0x1])[_0x2d2b('0x5d')](_0x2d2b('0x5e'))};_0x16ff0f[_0x2d2b('0x3d')]=_['merge'](_0x16ff0f[_0x2d2b('0x3d')],_0x4adaf4);}_0x16ff0f=_[_0x2d2b('0x3e')]({},_0x16ff0f,_0x263df0[_0x2d2b('0x40')]);return _0x4d09ee[_0x2d2b('0x5a')](_0x16ff0f);}})[_0x2d2b('0x28')](function(_0x1beea8){if(_0x1beea8){_0x201ce7=_0x1beea8['length'];if(!_0x263df0[_0x2d2b('0x31')]['hasOwnProperty'](_0x2d2b('0x39'))){_0x16ff0f[_0x2d2b('0x23')]=qs[_0x2d2b('0x23')](_0x263df0[_0x2d2b('0x31')][_0x2d2b('0x23')]);_0x16ff0f['offset']=qs[_0x2d2b('0x21')](_0x263df0[_0x2d2b('0x31')][_0x2d2b('0x21')]);}return _0x4d09ee['getMessages'](_0x16ff0f);}})['then'](function(_0x745af6){if(_0x745af6){return _0x745af6?{'count':_0x201ce7,'rows':_0x745af6}:null;}})[_0x2d2b('0x28')](respondWithResult(_0x40bf4d,null))['catch'](handleError(_0x40bf4d,null));}; \ No newline at end of file +var _0xca0a=['desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','reject','then','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','describe','getUnread','user','toInteger','addMembers','ids','findOne','User','getMembers','hasOwnProperty','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x16c301,_0x3c7c43){var _0x1a2c5a=function(_0xb8f3b9){while(--_0xb8f3b9){_0x16c301['push'](_0x16c301['shift']());}};_0x1a2c5a(++_0x3c7c43);}(_0xca0a,0xb8));var _0xaca0=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xca0a[_0x2f1762];return _0x8ab21;};'use strict';var emlformat=require(_0xaca0('0x0'));var rimraf=require(_0xaca0('0x1'));var zipdir=require(_0xaca0('0x2'));var jsonpatch=require(_0xaca0('0x3'));var rp=require(_0xaca0('0x4'));var moment=require('moment');var BPromise=require(_0xaca0('0x5'));var Mustache=require('mustache');var util=require(_0xaca0('0x6'));var path=require(_0xaca0('0x7'));var sox=require(_0xaca0('0x8'));var csv=require('to-csv');var ejs=require(_0xaca0('0x9'));var fs=require('fs');var fs_extra=require(_0xaca0('0xa'));var _=require(_0xaca0('0xb'));var squel=require('squel');var crypto=require(_0xaca0('0xc'));var jsforce=require(_0xaca0('0xd'));var deskjs=require(_0xaca0('0xe'));var toCsv=require(_0xaca0('0xf'));var querystring=require('querystring');var Papa=require(_0xaca0('0x10'));var Redis=require(_0xaca0('0x11'));var authService=require(_0xaca0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xaca0('0x13'));var hardwareService=require(_0xaca0('0x14'));var logger=require(_0xaca0('0x15'))(_0xaca0('0x16'));var utils=require(_0xaca0('0x17'));var config=require(_0xaca0('0x18'));var licenseUtil=require(_0xaca0('0x19'));var db=require(_0xaca0('0x1a'))['db'];config[_0xaca0('0x1b')]=_[_0xaca0('0x1c')](config['redis'],{'host':_0xaca0('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaca0('0x1e'))[_0xaca0('0x1f')](socket);function respondWithStatusCode(_0x59fb58,_0x34eca9){_0x34eca9=_0x34eca9||0xcc;return function(_0x24a38c){if(_0x24a38c){return _0x59fb58[_0xaca0('0x20')](_0x34eca9);}return _0x59fb58[_0xaca0('0x21')](_0x34eca9)[_0xaca0('0x22')]();};}function respondWithResult(_0xe0a568,_0x3bd12f){_0x3bd12f=_0x3bd12f||0xc8;return function(_0x377ed9){if(_0x377ed9){return _0xe0a568[_0xaca0('0x21')](_0x3bd12f)[_0xaca0('0x23')](_0x377ed9);}};}function respondWithFilteredResult(_0x8735de,_0x3750e0){return function(_0x33f19a){if(_0x33f19a){var _0x4bde98=typeof _0x3750e0[_0xaca0('0x24')]==='undefined'&&typeof _0x3750e0[_0xaca0('0x25')]===_0xaca0('0x26');var _0xa2a4a3=_0x33f19a[_0xaca0('0x27')];var _0x31b7c5=_0x4bde98?0x0:_0x3750e0[_0xaca0('0x24')];var _0x29e9fd=_0x4bde98?_0x33f19a[_0xaca0('0x27')]:_0x3750e0[_0xaca0('0x24')]+_0x3750e0[_0xaca0('0x25')];var _0x3b6276;if(_0x29e9fd>=_0xa2a4a3){_0x29e9fd=_0xa2a4a3;_0x3b6276=0xc8;}else{_0x3b6276=0xce;}_0x8735de[_0xaca0('0x21')](_0x3b6276);return _0x8735de['set']('Content-Range',_0x31b7c5+'-'+_0x29e9fd+'/'+_0xa2a4a3)[_0xaca0('0x23')](_0x33f19a);}return null;};}function patchUpdates(_0x53c475){return function(_0x3190ec){try{jsonpatch['apply'](_0x3190ec,_0x53c475,!![]);}catch(_0x7caaa2){return BPromise[_0xaca0('0x28')](_0x7caaa2);}return _0x3190ec['save']();};}function saveUpdates(_0x4ade65,_0xd12241){return function(_0x256f6f){if(_0x256f6f){return _0x256f6f['update'](_0x4ade65)[_0xaca0('0x29')](function(_0x5ec0e7){return _0x5ec0e7;});}return null;};}function removeEntity(_0x311b48,_0x3abf00){return function(_0x4b35ba){if(_0x4b35ba){return _0x4b35ba[_0xaca0('0x2a')]()[_0xaca0('0x29')](function(){_0x311b48[_0xaca0('0x21')](0xcc)[_0xaca0('0x22')]();});}};}function handleEntityNotFound(_0x399202,_0x36c0ed){return function(_0x17b49b){if(!_0x17b49b){_0x399202['sendStatus'](0x194);}return _0x17b49b;};}function handleError(_0x5370c5,_0x450362){_0x450362=_0x450362||0x1f4;return function(_0x11d27b){logger[_0xaca0('0x2b')](_0x11d27b[_0xaca0('0x2c')]);if(_0x11d27b['name']){delete _0x11d27b[_0xaca0('0x2d')];}_0x5370c5[_0xaca0('0x21')](_0x450362)[_0xaca0('0x2e')](_0x11d27b);};}exports[_0xaca0('0x2f')]=function(_0x5b1ecc,_0x250432){var _0xf815e3={},_0x2f68cb={},_0x5d2183={'count':0x0,'rows':[]};var _0x1cdff3=_[_0xaca0('0x30')](db[_0xaca0('0x31')][_0xaca0('0x32')],function(_0x3e07c8){return{'name':_0x3e07c8[_0xaca0('0x33')],'type':_0x3e07c8[_0xaca0('0x34')][_0xaca0('0x35')]};});_0x2f68cb['model']=_[_0xaca0('0x30')](_0x1cdff3,_0xaca0('0x2d'));_0x2f68cb[_0xaca0('0x36')]=_[_0xaca0('0x37')](_0x5b1ecc[_0xaca0('0x36')]);_0x2f68cb['filters']=_['intersection'](_0x2f68cb['model'],_0x2f68cb[_0xaca0('0x36')]);_0xf815e3[_0xaca0('0x38')]=_[_0xaca0('0x39')](_0x2f68cb[_0xaca0('0x3a')],qs[_0xaca0('0x3b')](_0x5b1ecc['query'][_0xaca0('0x3b')]));_0xf815e3[_0xaca0('0x38')]=_0xf815e3[_0xaca0('0x38')][_0xaca0('0x3c')]?_0xf815e3['attributes']:_0x2f68cb[_0xaca0('0x3a')];if(!_0x5b1ecc['query']['hasOwnProperty'](_0xaca0('0x3d'))){_0xf815e3[_0xaca0('0x25')]=qs[_0xaca0('0x25')](_0x5b1ecc['query']['limit']);_0xf815e3[_0xaca0('0x24')]=qs[_0xaca0('0x24')](_0x5b1ecc[_0xaca0('0x36')][_0xaca0('0x24')]);}_0xf815e3[_0xaca0('0x3e')]=qs['sort'](_0x5b1ecc[_0xaca0('0x36')][_0xaca0('0x3f')]);_0xf815e3[_0xaca0('0x40')]=qs[_0xaca0('0x41')](_[_0xaca0('0x42')](_0x5b1ecc['query'],_0x2f68cb[_0xaca0('0x41')]),_0x1cdff3);if(_0x5b1ecc['query'][_0xaca0('0x43')]){_0xf815e3[_0xaca0('0x40')]=_[_0xaca0('0x44')](_0xf815e3[_0xaca0('0x40')],{'$or':_[_0xaca0('0x30')](_0x1cdff3,function(_0x14c79e){if(_0x14c79e[_0xaca0('0x34')]!==_0xaca0('0x45')){var _0x222a49={};_0x222a49[_0x14c79e['name']]={'$like':'%'+_0x5b1ecc['query']['filter']+'%'};return _0x222a49;}})});}_0xf815e3=_[_0xaca0('0x44')]({},_0xf815e3,_0x5b1ecc[_0xaca0('0x46')]);var _0x370872={'where':_0xf815e3['where']};return db[_0xaca0('0x31')]['count'](_0x370872)[_0xaca0('0x29')](function(_0x56db2b){_0x5d2183[_0xaca0('0x27')]=_0x56db2b;if(_0x5b1ecc['query']['includeAll']){_0xf815e3[_0xaca0('0x47')]=[{'all':!![]}];}return db[_0xaca0('0x31')][_0xaca0('0x48')](_0xf815e3);})[_0xaca0('0x29')](function(_0x392c38){_0x5d2183[_0xaca0('0x49')]=_0x392c38;return _0x5d2183;})[_0xaca0('0x29')](respondWithFilteredResult(_0x250432,_0xf815e3))['catch'](handleError(_0x250432,null));};exports[_0xaca0('0x4a')]=function(_0x4dd086,_0xa4b07){var _0x2a6bc6={'raw':!![],'where':{'id':_0x4dd086[_0xaca0('0x4b')]['id']}},_0x593fc5={};_0x593fc5[_0xaca0('0x3a')]=_['keys'](db[_0xaca0('0x31')][_0xaca0('0x32')]);_0x593fc5[_0xaca0('0x36')]=_[_0xaca0('0x37')](_0x4dd086[_0xaca0('0x36')]);_0x593fc5[_0xaca0('0x41')]=_[_0xaca0('0x39')](_0x593fc5[_0xaca0('0x3a')],_0x593fc5[_0xaca0('0x36')]);_0x2a6bc6['attributes']=_[_0xaca0('0x39')](_0x593fc5['model'],qs[_0xaca0('0x3b')](_0x4dd086['query']['fields']));_0x2a6bc6[_0xaca0('0x38')]=_0x2a6bc6[_0xaca0('0x38')][_0xaca0('0x3c')]?_0x2a6bc6[_0xaca0('0x38')]:_0x593fc5[_0xaca0('0x3a')];if(_0x4dd086['query'][_0xaca0('0x4c')]){_0x2a6bc6[_0xaca0('0x47')]=[{'all':!![]}];}_0x2a6bc6=_[_0xaca0('0x44')]({},_0x2a6bc6,_0x4dd086['options']);return db['ChatGroup'][_0xaca0('0x4d')](_0x2a6bc6)[_0xaca0('0x29')](handleEntityNotFound(_0xa4b07,null))['then'](respondWithResult(_0xa4b07,null))[_0xaca0('0x4e')](handleError(_0xa4b07,null));};exports[_0xaca0('0x4f')]=function(_0x2e3885,_0x16f012){return db[_0xaca0('0x31')][_0xaca0('0x4f')](_0x2e3885['body'],{})[_0xaca0('0x29')](respondWithResult(_0x16f012,0xc9))[_0xaca0('0x4e')](handleError(_0x16f012,null));};exports['update']=function(_0x5856aa,_0x57637){if(_0x5856aa[_0xaca0('0x50')]['id']){delete _0x5856aa[_0xaca0('0x50')]['id'];}return db[_0xaca0('0x31')][_0xaca0('0x4d')]({'where':{'id':_0x5856aa[_0xaca0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x57637,null))[_0xaca0('0x29')](saveUpdates(_0x5856aa[_0xaca0('0x50')],null))[_0xaca0('0x29')](respondWithResult(_0x57637,null))['catch'](handleError(_0x57637,null));};exports[_0xaca0('0x2a')]=function(_0x666f06,_0x191a69){return db['ChatGroup'][_0xaca0('0x4d')]({'where':{'id':_0x666f06['params']['id']}})['then'](handleEntityNotFound(_0x191a69,null))[_0xaca0('0x29')](removeEntity(_0x191a69,null))[_0xaca0('0x4e')](handleError(_0x191a69,null));};exports[_0xaca0('0x51')]=function(_0x1d4708,_0x5791f8){return db[_0xaca0('0x31')][_0xaca0('0x51')]()[_0xaca0('0x29')](respondWithResult(_0x5791f8,null))['catch'](handleError(_0x5791f8,null));};exports[_0xaca0('0x52')]=function(_0x1faa66,_0x8e3436,_0x23da9e){return db['ChatInternalMessage'][_0xaca0('0x27')]({'where':{'ChatGroupId':_0x1faa66['params']['id'],'ToId':_0x1faa66[_0xaca0('0x53')]['id'],'read':![]}})[_0xaca0('0x29')](function(_0x37a7b1){return{'id':_[_0xaca0('0x54')](_0x1faa66[_0xaca0('0x4b')]['id']),'count':_0x37a7b1};})[_0xaca0('0x29')](respondWithResult(_0x8e3436,null))['catch'](handleError(_0x8e3436,null));};exports[_0xaca0('0x55')]=function(_0x4955b2,_0x26ab99,_0x493e95){return db[_0xaca0('0x31')]['find']({'where':{'id':_0x4955b2[_0xaca0('0x4b')]['id']}})[_0xaca0('0x29')](handleEntityNotFound(_0x26ab99,null))['then'](function(_0x4a7d6f){if(_0x4a7d6f){return _0x4a7d6f['addMembers'](_0x4955b2[_0xaca0('0x50')][_0xaca0('0x56')],_['omit'](_0x4955b2[_0xaca0('0x50')],['ids','id'])||{});}})[_0xaca0('0x29')](respondWithResult(_0x26ab99,null))[_0xaca0('0x4e')](handleError(_0x26ab99,null));};exports['getMembers']=function(_0x41289c,_0x5ca491,_0x1d1180){var _0x41971e={};var _0x69269c={};var _0x40e6ad;var _0x2cfb04;return db['ChatGroup'][_0xaca0('0x57')]({'where':{'id':_0x41289c[_0xaca0('0x4b')]['id']}})[_0xaca0('0x29')](handleEntityNotFound(_0x5ca491,null))[_0xaca0('0x29')](function(_0x23727a){if(_0x23727a){_0x40e6ad=_0x23727a;_0x69269c[_0xaca0('0x3a')]=_[_0xaca0('0x37')](db[_0xaca0('0x58')][_0xaca0('0x32')]);_0x69269c[_0xaca0('0x36')]=_['keys'](_0x41289c[_0xaca0('0x36')]);_0x69269c[_0xaca0('0x41')]=_[_0xaca0('0x39')](_0x69269c[_0xaca0('0x3a')],_0x69269c['query']);_0x41971e['attributes']=_[_0xaca0('0x39')](_0x69269c['model'],qs[_0xaca0('0x3b')](_0x41289c['query']['fields']));_0x41971e['attributes']=_0x41971e[_0xaca0('0x38')][_0xaca0('0x3c')]?_0x41971e[_0xaca0('0x38')]:_0x69269c[_0xaca0('0x3a')];_0x41971e[_0xaca0('0x3e')]=qs[_0xaca0('0x3f')](_0x41289c['query'][_0xaca0('0x3f')]);_0x41971e[_0xaca0('0x40')]=qs[_0xaca0('0x41')](_[_0xaca0('0x42')](_0x41289c['query'],_0x69269c[_0xaca0('0x41')]));if(_0x41289c[_0xaca0('0x36')][_0xaca0('0x43')]){_0x41971e[_0xaca0('0x40')]=_[_0xaca0('0x44')](_0x41971e[_0xaca0('0x40')],{'$or':_[_0xaca0('0x30')](_0x41971e[_0xaca0('0x38')],function(_0x2a0ece){var _0x5d5d10={};_0x5d5d10[_0x2a0ece]={'$like':'%'+_0x41289c['query'][_0xaca0('0x43')]+'%'};return _0x5d5d10;})});}_0x41971e=_[_0xaca0('0x44')]({},_0x41971e,_0x41289c[_0xaca0('0x46')]);return _0x40e6ad[_0xaca0('0x59')](_0x41971e);}})[_0xaca0('0x29')](function(_0x52da5e){if(_0x52da5e){_0x2cfb04=_0x52da5e[_0xaca0('0x3c')];if(!_0x41289c[_0xaca0('0x36')][_0xaca0('0x5a')]('nolimit')){_0x41971e['limit']=qs[_0xaca0('0x25')](_0x41289c[_0xaca0('0x36')][_0xaca0('0x25')]);_0x41971e[_0xaca0('0x24')]=qs[_0xaca0('0x24')](_0x41289c[_0xaca0('0x36')][_0xaca0('0x24')]);}return _0x40e6ad[_0xaca0('0x59')](_0x41971e);}})[_0xaca0('0x29')](function(_0x586346){if(_0x586346){return _0x586346?{'count':_0x2cfb04,'rows':_0x586346}:null;}})['then'](respondWithResult(_0x5ca491,null))[_0xaca0('0x4e')](handleError(_0x5ca491,null));};exports['removeMembers']=function(_0x1480ed,_0x10272f,_0x295139){return db['ChatGroup'][_0xaca0('0x4d')]({'where':{'id':_0x1480ed['params']['id']}})[_0xaca0('0x29')](handleEntityNotFound(_0x10272f,null))[_0xaca0('0x29')](function(_0x393a44){if(_0x393a44){return _0x393a44[_0xaca0('0x5b')](_0x1480ed[_0xaca0('0x36')][_0xaca0('0x56')]);}})[_0xaca0('0x29')](respondWithStatusCode(_0x10272f,null))[_0xaca0('0x4e')](handleError(_0x10272f,null));};exports[_0xaca0('0x5c')]=function(_0x3b59b3,_0x19e9d5,_0x1679e7){if(_0x3b59b3[_0xaca0('0x50')]['id']){delete _0x3b59b3[_0xaca0('0x50')]['id'];}return db[_0xaca0('0x31')][_0xaca0('0x4d')]({'where':{'id':_0x3b59b3[_0xaca0('0x4b')]['id']}})[_0xaca0('0x29')](handleEntityNotFound(_0x19e9d5,null))[_0xaca0('0x29')](function(_0x5664b7){if(_0x5664b7){_0x3b59b3[_0xaca0('0x50')][_0xaca0('0x5d')]=_0x5664b7['id'];return db[_0xaca0('0x5e')][_0xaca0('0x4f')](_0x3b59b3[_0xaca0('0x50')]);}})[_0xaca0('0x29')](respondWithResult(_0x19e9d5,null))['catch'](handleError(_0x19e9d5,null));};exports[_0xaca0('0x5f')]=function(_0x42de55,_0x50cffb,_0x9365d5){var _0x354ece={};var _0x495a81={};var _0x3c96c9;var _0x59d26c;return db[_0xaca0('0x31')]['findOne']({'where':{'id':_0x42de55[_0xaca0('0x4b')]['id']}})[_0xaca0('0x29')](handleEntityNotFound(_0x50cffb,null))[_0xaca0('0x29')](function(_0x37c384){if(_0x37c384){_0x3c96c9=_0x37c384;_0x495a81[_0xaca0('0x3a')]=_['keys'](db[_0xaca0('0x5e')][_0xaca0('0x32')]);_0x495a81[_0xaca0('0x36')]=_['keys'](_0x42de55[_0xaca0('0x36')]);_0x495a81[_0xaca0('0x41')]=_[_0xaca0('0x39')](_0x495a81['model'],_0x495a81[_0xaca0('0x36')]);_0x354ece[_0xaca0('0x38')]=_[_0xaca0('0x39')](_0x495a81[_0xaca0('0x3a')],qs['fields'](_0x42de55[_0xaca0('0x36')]['fields']));_0x354ece[_0xaca0('0x38')]=_0x354ece[_0xaca0('0x38')][_0xaca0('0x3c')]?_0x354ece[_0xaca0('0x38')]:_0x495a81[_0xaca0('0x3a')];_0x354ece[_0xaca0('0x3e')]=qs[_0xaca0('0x3f')](_0x42de55[_0xaca0('0x36')][_0xaca0('0x3f')]);_0x354ece[_0xaca0('0x40')]=qs[_0xaca0('0x41')](_[_0xaca0('0x42')](_0x42de55['query'],_0x495a81[_0xaca0('0x41')]));if(_0x42de55[_0xaca0('0x36')][_0xaca0('0x43')]){_0x354ece[_0xaca0('0x40')]=_[_0xaca0('0x44')](_0x354ece[_0xaca0('0x40')],{'$or':_['map'](_0x354ece[_0xaca0('0x38')],function(_0x6a6bb1){var _0x4d18e3={};_0x4d18e3[_0x6a6bb1]={'$like':'%'+_0x42de55[_0xaca0('0x36')][_0xaca0('0x43')]+'%'};return _0x4d18e3;})});}if(_0x42de55[_0xaca0('0x36')][_0xaca0('0x60')]){var _0x4d8e11=_0x42de55[_0xaca0('0x36')]['$gte'][_0xaca0('0x61')](',');var _0x287f43={};_0x287f43[_0x4d8e11[0x0]]={'$gte':moment(_0x4d8e11[0x1])['format'](_0xaca0('0x62'))};_0x354ece['where']=_[_0xaca0('0x44')](_0x354ece['where'],_0x287f43);}_0x354ece=_[_0xaca0('0x44')]({},_0x354ece,_0x42de55[_0xaca0('0x46')]);return _0x3c96c9[_0xaca0('0x5f')](_0x354ece);}})[_0xaca0('0x29')](function(_0x178683){if(_0x178683){_0x59d26c=_0x178683[_0xaca0('0x3c')];if(!_0x42de55[_0xaca0('0x36')][_0xaca0('0x5a')](_0xaca0('0x3d'))){_0x354ece['limit']=qs[_0xaca0('0x25')](_0x42de55[_0xaca0('0x36')][_0xaca0('0x25')]);_0x354ece[_0xaca0('0x24')]=qs[_0xaca0('0x24')](_0x42de55[_0xaca0('0x36')][_0xaca0('0x24')]);}return _0x3c96c9['getMessages'](_0x354ece);}})[_0xaca0('0x29')](function(_0x1a73bc){if(_0x1a73bc){return _0x1a73bc?{'count':_0x59d26c,'rows':_0x1a73bc}:null;}})[_0xaca0('0x29')](respondWithResult(_0x50cffb,null))[_0xaca0('0x4e')](handleError(_0x50cffb,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 5c643bd..054717a 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 _0x7d8a=['ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x7d8a,0x1ca));var _0xa7d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d8a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa7d8('0x0'));var ChatGroup=require(_0xa7d8('0x1'))['db'][_0xa7d8('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xa7d8('0x3')](0x0);var events={'afterCreate':_0xa7d8('0x4'),'afterUpdate':_0xa7d8('0x5'),'afterDestroy':_0xa7d8('0x6')};function emitEvent(_0x2b5af1){return function(_0x14a7d3,_0x199cdd,_0x1162e1){ChatGroupEvents[_0xa7d8('0x7')](_0x2b5af1+':'+_0x14a7d3['id'],_0x14a7d3);ChatGroupEvents[_0xa7d8('0x7')](_0x2b5af1,_0x14a7d3);_0x1162e1(null);};}for(var e in events){if(events[_0xa7d8('0x8')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xa7d8('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0xef0f=['events','ChatGroup','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xef0f,0x168));var _0xfef0=function(_0x5b4b18,_0x1003ab){_0x5b4b18=_0x5b4b18-0x0;var _0x326467=_0xef0f[_0x5b4b18];return _0x326467;};'use strict';var EventEmitter=require(_0xfef0('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xfef0('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xfef0('0x2')](0x0);var events={'afterCreate':_0xfef0('0x3'),'afterUpdate':'update','afterDestroy':_0xfef0('0x4')};function emitEvent(_0x11ab77){return function(_0x4618fb,_0x4e1af6,_0x2a6fcf){ChatGroupEvents[_0xfef0('0x5')](_0x11ab77+':'+_0x4618fb['id'],_0x4618fb);ChatGroupEvents[_0xfef0('0x5')](_0x11ab77,_0x4618fb);_0x2a6fcf(null);};}for(var e in events){if(events[_0xfef0('0x6')](e)){var event=events[e];ChatGroup[_0xfef0('0x7')](e,emitEvent(event));}}module[_0xfef0('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 5f6c219..2c16929 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 _0x8501=['../../config/logger','api','moment','../../config/environment','exports','ChatGroup','chat_groups','lodash','util'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x8501,0x11e));var _0x1850=function(_0x49ad79,_0x48ee93){_0x49ad79=_0x49ad79-0x0;var _0xa4e38a=_0x8501[_0x49ad79];return _0xa4e38a;};'use strict';var _=require(_0x1850('0x0'));var util=require(_0x1850('0x1'));var logger=require(_0x1850('0x2'))(_0x1850('0x3'));var moment=require(_0x1850('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1850('0x5'));var attributes=require('./chatGroup.attributes');module[_0x1850('0x6')]=function(_0x4ffcc9,_0x453fab){return _0x4ffcc9['define'](_0x1850('0x7'),attributes,{'tableName':_0x1850('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x277e=['api','moment','bluebird','request-promise','exports','define','chat_groups','lodash','util','../../config/logger'];(function(_0x20c0e7,_0x4e172a){var _0x405098=function(_0x45853d){while(--_0x45853d){_0x20c0e7['push'](_0x20c0e7['shift']());}};_0x405098(++_0x4e172a);}(_0x277e,0x18d));var _0xe277=function(_0x22de53,_0x489cfe){_0x22de53=_0x22de53-0x0;var _0x492b77=_0x277e[_0x22de53];return _0x492b77;};'use strict';var _=require(_0xe277('0x0'));var util=require(_0xe277('0x1'));var logger=require(_0xe277('0x2'))(_0xe277('0x3'));var moment=require(_0xe277('0x4'));var BPromise=require(_0xe277('0x5'));var rp=require(_0xe277('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0xe277('0x7')]=function(_0x2d4d52,_0x2fecda){return _0x2d4d52[_0xe277('0x8')]('ChatGroup',attributes,{'tableName':_0xe277('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index f601867..64835d9 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 _0x514e=['info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatGroup.socket','request','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x442955,_0x410333){var _0x14f4b3=function(_0x3f0bc3){while(--_0x3f0bc3){_0x442955['push'](_0x442955['shift']());}};_0x14f4b3(++_0x410333);}(_0x514e,0x146));var _0xe514=function(_0x3d260d,_0x52c05d){_0x3d260d=_0x3d260d-0x0;var _0x152dc1=_0x514e[_0x3d260d];return _0x152dc1;};'use strict';var _=require(_0xe514('0x0'));var util=require(_0xe514('0x1'));var moment=require(_0xe514('0x2'));var BPromise=require(_0xe514('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe514('0x4'));var db=require(_0xe514('0x5'))['db'];var utils=require(_0xe514('0x6'));var logger=require(_0xe514('0x7'))(_0xe514('0x8'));var config=require(_0xe514('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe514('0xa')][_0xe514('0xb')]({'port':0x232a});config[_0xe514('0xc')]=_[_0xe514('0xd')](config[_0xe514('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe514('0xe'))(new Redis(config[_0xe514('0xc')]));require(_0xe514('0xf'))['register'](socket);function respondWithRpcPromise(_0x343e58,_0x1109cd,_0xc51a5d){return new BPromise(function(_0x5f07c9,_0x3f370){return client[_0xe514('0x10')](_0x343e58,_0xc51a5d)['then'](function(_0x3a6350){logger['info'](_0xe514('0x11'),_0x1109cd,_0xe514('0x12'));logger[_0xe514('0x13')](_0xe514('0x14'),_0x1109cd,'request\x20sent',JSON[_0xe514('0x15')](_0x3a6350));if(_0x3a6350['error']){if(_0x3a6350[_0xe514('0x16')][_0xe514('0x17')]===0x1f4){logger['error'](_0xe514('0x11'),_0x1109cd,_0x3a6350['error'][_0xe514('0x18')]);return _0x3f370(_0x3a6350[_0xe514('0x16')][_0xe514('0x18')]);}logger[_0xe514('0x16')](_0xe514('0x11'),_0x1109cd,_0x3a6350[_0xe514('0x16')]['message']);return _0x5f07c9(_0x3a6350[_0xe514('0x16')][_0xe514('0x18')]);}else{logger[_0xe514('0x19')]('ChatGroup,\x20%s,\x20%s',_0x1109cd,_0xe514('0x12'));_0x5f07c9(_0x3a6350['result']['message']);}})[_0xe514('0x1a')](function(_0x46d7d1){logger[_0xe514('0x16')](_0xe514('0x11'),_0x1109cd,_0x46d7d1);_0x3f370(_0x46d7d1);});});} \ No newline at end of file +var _0x858e=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','bluebird'];(function(_0x41b29e,_0x34b288){var _0xacd517=function(_0x3318df){while(--_0x3318df){_0x41b29e['push'](_0x41b29e['shift']());}};_0xacd517(++_0x34b288);}(_0x858e,0x178));var _0xe858=function(_0x5cd51d,_0x20d4fa){_0x5cd51d=_0x5cd51d-0x0;var _0x444608=_0x858e[_0x5cd51d];return _0x444608;};'use strict';var _=require(_0xe858('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe858('0x1'));var rs=require(_0xe858('0x2'));var fs=require('fs');var Redis=require(_0xe858('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe858('0x4'));var logger=require(_0xe858('0x5'))(_0xe858('0x6'));var config=require(_0xe858('0x7'));var jayson=require(_0xe858('0x8'));var client=jayson['client'][_0xe858('0x9')]({'port':0x232a});config[_0xe858('0xa')]=_['defaults'](config[_0xe858('0xa')],{'host':_0xe858('0xb'),'port':0x18eb});var socket=require(_0xe858('0xc'))(new Redis(config[_0xe858('0xa')]));require(_0xe858('0xd'))[_0xe858('0xe')](socket);function respondWithRpcPromise(_0x571ad6,_0x3ed125,_0x2dea6c){return new BPromise(function(_0x3677de,_0x128479){return client[_0xe858('0xf')](_0x571ad6,_0x2dea6c)[_0xe858('0x10')](function(_0x3014af){logger['info'](_0xe858('0x11'),_0x3ed125,'request\x20sent');logger[_0xe858('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x3ed125,_0xe858('0x13'),JSON[_0xe858('0x14')](_0x3014af));if(_0x3014af[_0xe858('0x15')]){if(_0x3014af['error'][_0xe858('0x16')]===0x1f4){logger[_0xe858('0x15')](_0xe858('0x11'),_0x3ed125,_0x3014af[_0xe858('0x15')]['message']);return _0x128479(_0x3014af[_0xe858('0x15')][_0xe858('0x17')]);}logger[_0xe858('0x15')]('ChatGroup,\x20%s,\x20%s',_0x3ed125,_0x3014af[_0xe858('0x15')]['message']);return _0x3677de(_0x3014af[_0xe858('0x15')][_0xe858('0x17')]);}else{logger[_0xe858('0x18')](_0xe858('0x11'),_0x3ed125,_0xe858('0x13'));_0x3677de(_0x3014af[_0xe858('0x19')][_0xe858('0x17')]);}})[_0xe858('0x1a')](function(_0x313401){logger['error']('ChatGroup,\x20%s,\x20%s',_0x3ed125,_0x313401);_0x128479(_0x313401);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 0738ba6..60d4025 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 _0x8b6b=['update','removeListener','register','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x8b6b,0x6d));var _0xb8b6=function(_0xcb93bc,_0x5e45ca){_0xcb93bc=_0xcb93bc-0x0;var _0x214eb1=_0x8b6b[_0xcb93bc];return _0x214eb1;};'use strict';var ChatGroupEvents=require(_0xb8b6('0x0'));var events=[_0xb8b6('0x1'),_0xb8b6('0x2'),_0xb8b6('0x3')];function createListener(_0x3fd6e3,_0x4e4608){return function(_0x5d461d){_0x4e4608['emit'](_0x3fd6e3,_0x5d461d);};}function removeListener(_0x40cad3,_0x411479){return function(){ChatGroupEvents[_0xb8b6('0x4')](_0x40cad3,_0x411479);};}exports[_0xb8b6('0x5')]=function(_0x339b16){for(var _0x27549c=0x0,_0x1707ce=events[_0xb8b6('0x6')];_0x27549c<_0x1707ce;_0x27549c++){var _0x6ec1d9=events[_0x27549c];var _0x275723=createListener(_0xb8b6('0x7')+_0x6ec1d9,_0x339b16);ChatGroupEvents['on'](_0x6ec1d9,_0x275723);}}; \ No newline at end of file +var _0x5260=['update','emit','removeListener','register','remove'];(function(_0x4e6fc7,_0x6b9a5d){var _0x3c2ef6=function(_0x3907ed){while(--_0x3907ed){_0x4e6fc7['push'](_0x4e6fc7['shift']());}};_0x3c2ef6(++_0x6b9a5d);}(_0x5260,0xbd));var _0x0526=function(_0x5c7eb7,_0x3fbe3b){_0x5c7eb7=_0x5c7eb7-0x0;var _0x2cbfa8=_0x5260[_0x5c7eb7];return _0x2cbfa8;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0x0526('0x0'),_0x0526('0x1')];function createListener(_0x295ca9,_0x5e67e4){return function(_0x13914c){_0x5e67e4[_0x0526('0x2')](_0x295ca9,_0x13914c);};}function removeListener(_0x1b5f24,_0x9a652d){return function(){ChatGroupEvents[_0x0526('0x3')](_0x1b5f24,_0x9a652d);};}exports[_0x0526('0x4')]=function(_0xb55cec){for(var _0x1b13c8=0x0,_0x160294=events['length'];_0x1b13c8<_0x160294;_0x1b13c8++){var _0x4e1c16=events[_0x1b13c8];var _0x39aa15=createListener('chatGroup:'+_0x4e1c16,_0xb55cec);ChatGroupEvents['on'](_0x4e1c16,_0x39aa15);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 0ec952c..a49a59e 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 _0x9981=['removeMembers','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id/unread','getUnread','getMembers','post','create','/:id/members','/:id/messages','put','delete','/:id','destroy'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x9981,0x1bc));var _0x1998=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9981[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require(_0x1998('0x0'));var path=require(_0x1998('0x1'));var timeout=require('connect-timeout');var express=require(_0x1998('0x2'));var router=express[_0x1998('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1998('0x4'));var interaction=require(_0x1998('0x5'));var config=require(_0x1998('0x6'));var controller=require(_0x1998('0x7'));router['get']('/',auth[_0x1998('0x8')](),controller[_0x1998('0x9')]);router[_0x1998('0xa')](_0x1998('0xb'),auth[_0x1998('0x8')](),controller[_0x1998('0xc')]);router['get']('/:id',auth[_0x1998('0x8')](),controller['show']);router[_0x1998('0xa')](_0x1998('0xd'),auth[_0x1998('0x8')](),controller[_0x1998('0xe')]);router[_0x1998('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0x1998('0xf')]);router[_0x1998('0xa')]('/:id/messages',auth[_0x1998('0x8')](),controller['getMessages']);router[_0x1998('0x10')]('/',auth['isAuthenticated'](),controller[_0x1998('0x11')]);router['post'](_0x1998('0x12'),auth[_0x1998('0x8')](),controller['addMembers']);router[_0x1998('0x10')](_0x1998('0x13'),auth['isAuthenticated'](),controller['addMessage']);router[_0x1998('0x14')]('/:id',auth[_0x1998('0x8')](),controller['update']);router[_0x1998('0x15')](_0x1998('0x16'),auth['isAuthenticated'](),controller[_0x1998('0x17')]);router[_0x1998('0x15')](_0x1998('0x12'),auth[_0x1998('0x8')](),controller[_0x1998('0x18')]);module[_0x1998('0x19')]=router; \ No newline at end of file +var _0x620b=['/:id/unread','getUnread','/:id/members','getMessages','post','create','addMembers','put','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe','/:id','show'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x620b,0x157));var _0xb620=function(_0x15c420,_0x3c6b3c){_0x15c420=_0x15c420-0x0;var _0x5592d1=_0x620b[_0x15c420];return _0x5592d1;};'use strict';var multer=require(_0xb620('0x0'));var util=require(_0xb620('0x1'));var path=require(_0xb620('0x2'));var timeout=require(_0xb620('0x3'));var express=require(_0xb620('0x4'));var router=express[_0xb620('0x5')]();var fs_extra=require(_0xb620('0x6'));var auth=require(_0xb620('0x7'));var interaction=require(_0xb620('0x8'));var config=require(_0xb620('0x9'));var controller=require(_0xb620('0xa'));router['get']('/',auth[_0xb620('0xb')](),controller[_0xb620('0xc')]);router[_0xb620('0xd')](_0xb620('0xe'),auth[_0xb620('0xb')](),controller['describe']);router[_0xb620('0xd')](_0xb620('0xf'),auth[_0xb620('0xb')](),controller[_0xb620('0x10')]);router[_0xb620('0xd')](_0xb620('0x11'),auth[_0xb620('0xb')](),controller[_0xb620('0x12')]);router[_0xb620('0xd')](_0xb620('0x13'),auth['isAuthenticated'](),controller['getMembers']);router[_0xb620('0xd')]('/:id/messages',auth[_0xb620('0xb')](),controller[_0xb620('0x14')]);router[_0xb620('0x15')]('/',auth[_0xb620('0xb')](),controller[_0xb620('0x16')]);router['post']('/:id/members',auth[_0xb620('0xb')](),controller[_0xb620('0x17')]);router[_0xb620('0x15')]('/:id/messages',auth[_0xb620('0xb')](),controller['addMessage']);router[_0xb620('0x18')](_0xb620('0xf'),auth[_0xb620('0xb')](),controller[_0xb620('0x19')]);router[_0xb620('0x1a')](_0xb620('0xf'),auth[_0xb620('0xb')](),controller[_0xb620('0x1b')]);router[_0xb620('0x1a')](_0xb620('0x13'),auth['isAuthenticated'](),controller[_0xb620('0x1c')]);module[_0xb620('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 6b67bf3..8a45b7c 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 _0x8e44=['BOOLEAN','star','thumb','TEXT','STRING','DATE','long','out','sequelize','exports'];(function(_0x1b1c3d,_0x1f36ce){var _0x4f2fe5=function(_0x35263e){while(--_0x35263e){_0x1b1c3d['push'](_0x1b1c3d['shift']());}};_0x4f2fe5(++_0x1f36ce);}(_0x8e44,0x1ac));var _0x48e4=function(_0x344dc4,_0x50eb33){_0x344dc4=_0x344dc4-0x0;var _0x3e722f=_0x8e44[_0x344dc4];return _0x3e722f;};'use strict';var Sequelize=require(_0x48e4('0x0'));module[_0x48e4('0x1')]={'closed':{'type':Sequelize[_0x48e4('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x48e4('0x3'),_0x48e4('0x4')),'defaultValue':_0x48e4('0x3')},'ratingMessage':{'type':Sequelize[_0x48e4('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x48e4('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x48e4('0x7')]},'disposition':{'type':Sequelize[_0x48e4('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x48e4('0x6')]},'browserName':{'type':Sequelize[_0x48e4('0x6')]},'browserVersion':{'type':Sequelize[_0x48e4('0x6')]},'osName':{'type':Sequelize[_0x48e4('0x6')]},'osVersion':{'type':Sequelize[_0x48e4('0x6')]},'deviceModel':{'type':Sequelize[_0x48e4('0x6')]},'deviceVendor':{'type':Sequelize[_0x48e4('0x6')]},'deviceType':{'type':Sequelize[_0x48e4('0x6')]},'referer':{'type':Sequelize[_0x48e4('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x48e4('0x5')](_0x48e4('0x8'))},'read1stAt':{'type':Sequelize[_0x48e4('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x48e4('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x48e4('0x6')]},'customerPort':{'type':Sequelize[_0x48e4('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x48e4('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xdf92=['ENUM','star','thumb','TEXT','STRING','DATE','long','BOOLEAN','sequelize','INTEGER'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0xdf92,0x10c));var _0x2df9=function(_0x284142,_0x3b65a8){_0x284142=_0x284142-0x0;var _0x3e8e47=_0xdf92[_0x284142];return _0x3e8e47;};'use strict';var Sequelize=require(_0x2df9('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x2df9('0x1')]},'ratingType':{'type':Sequelize[_0x2df9('0x2')](_0x2df9('0x3'),_0x2df9('0x4')),'defaultValue':_0x2df9('0x3')},'ratingMessage':{'type':Sequelize[_0x2df9('0x5')]},'pathTranscript':{'type':Sequelize[_0x2df9('0x5')]},'mailTranscript':{'type':Sequelize[_0x2df9('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x2df9('0x7')]},'disposition':{'type':Sequelize[_0x2df9('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2df9('0x6')]},'note':{'type':Sequelize[_0x2df9('0x6')]},'browserName':{'type':Sequelize[_0x2df9('0x6')]},'browserVersion':{'type':Sequelize[_0x2df9('0x6')]},'osName':{'type':Sequelize[_0x2df9('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x2df9('0x6')]},'deviceVendor':{'type':Sequelize[_0x2df9('0x6')]},'deviceType':{'type':Sequelize[_0x2df9('0x6')]},'referer':{'type':Sequelize[_0x2df9('0x5')]},'customerIp':{'type':Sequelize[_0x2df9('0x6')]},'formData':{'type':Sequelize[_0x2df9('0x5')](_0x2df9('0x8'))},'read1stAt':{'type':Sequelize[_0x2df9('0x7')]},'lastMsgAt':{'type':Sequelize[_0x2df9('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x2df9('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x2df9('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x2df9('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 942e4d7..3560e08 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 _0xf76c=['err','unlinkSync','rimraf','request-promise','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','message','ChatInteraction,\x20%s,\x20%s','result','catch','status','end','json','offset','undefined','count','set','Content-Range','stack','name','send','render','merge','agent','interaction','account','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','show','model','keys','filters','attributes','fields','includeAll','create','body','update','find','params','destroy','describe','ChatInteraction','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooApiKey','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','sendStatus','Interaction\x20already\x20assigned','disposition','originalname','basename','file','mimetype','Attachment','attachmentDownload','closed','attachId','join','root','offline-chat/','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','Messages','User','length','UserId','%s%d','agentAlias','System','Visitor','ContactId','agentIdentifier','website_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','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','ids','omit','getMessages','intersection','nolimit','limit','order','sort','where','pick','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','ChatInteractionId','map','includeAgent','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','download','toString','server','files','tmp','attachments','transcript-%d-%s.zip','push','fullname','firstName','lastName','read','Account','Owner','get','mkdirSync','N.A.','osName','referer','customerIp','customerPort','tail','createReadStream','pipe','out','renderFile','views','.pdf','createPdfFromHTML'];(function(_0x47bf73,_0x5a4957){var _0x419b53=function(_0x24ed96){while(--_0x24ed96){_0x47bf73['push'](_0x47bf73['shift']());}};_0x419b53(++_0x5a4957);}(_0xf76c,0x1a6));var _0xcf76=function(_0x386b03,_0x5d0000){_0x386b03=_0x386b03-0x0;var _0xd3d524=_0xf76c[_0x386b03];return _0xd3d524;};'use strict';var rimraf=require(_0xcf76('0x0'));var zipdir=require('zip-dir');var rp=require(_0xcf76('0x1'));var moment=require('moment');var BPromise=require(_0xcf76('0x2'));var Mustache=require(_0xcf76('0x3'));var util=require(_0xcf76('0x4'));var path=require(_0xcf76('0x5'));var ejs=require(_0xcf76('0x6'));var fs=require('fs');var _=require(_0xcf76('0x7'));var Redis=require(_0xcf76('0x8'));var interaction=require(_0xcf76('0x9'));var qs=require(_0xcf76('0xa'));var pdf=require(_0xcf76('0xb'));var logger=require(_0xcf76('0xc'))(_0xcf76('0xd'));var config=require(_0xcf76('0xe'));var db=require(_0xcf76('0xf'))['db'];config[_0xcf76('0x10')]=_[_0xcf76('0x11')](config[_0xcf76('0x10')],{'host':_0xcf76('0x12'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcf76('0x10')]));require(_0xcf76('0x13'))[_0xcf76('0x14')](socket);var jayson=require(_0xcf76('0x15'));var client=jayson[_0xcf76('0x16')][_0xcf76('0x17')]({'port':0x232b});var client9004=jayson['client'][_0xcf76('0x17')]({'port':0x232c});function respondWithRpcPromise(_0xd53272,_0x43ac07,_0x36ac3e,_0x19bef8){return new BPromise(function(_0x1d244c,_0x2c699b){var _0x257966=_0x19bef8||client;return _0x257966[_0xcf76('0x18')](_0xd53272,_0x36ac3e)[_0xcf76('0x19')](function(_0x2db105){logger[_0xcf76('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x43ac07,'request\x20sent');logger[_0xcf76('0x1b')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x43ac07,_0xcf76('0x1c'),JSON['stringify'](_0x2db105));if(_0x2db105[_0xcf76('0x1d')]){if(_0x2db105['error'][_0xcf76('0x1e')]===0x1f4){logger[_0xcf76('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x43ac07,_0x2db105[_0xcf76('0x1d')][_0xcf76('0x1f')]);return _0x2c699b(_0x2db105[_0xcf76('0x1d')][_0xcf76('0x1f')]);}logger[_0xcf76('0x1d')](_0xcf76('0x20'),_0x43ac07,_0x2db105[_0xcf76('0x1d')][_0xcf76('0x1f')]);return _0x1d244c(_0x2db105[_0xcf76('0x1d')][_0xcf76('0x1f')]);}else{logger[_0xcf76('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x43ac07,_0xcf76('0x1c'));_0x1d244c(_0x2db105[_0xcf76('0x21')][_0xcf76('0x1f')]);}})[_0xcf76('0x22')](function(_0x106a82){logger[_0xcf76('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x43ac07,_0x106a82);_0x2c699b(_0x106a82);});});}function respondWithStatusCode(_0x5d65a8,_0x283513){_0x283513=_0x283513||0xcc;return function(_0x62e6f9){if(_0x62e6f9){return _0x5d65a8['sendStatus'](_0x283513);}return _0x5d65a8[_0xcf76('0x23')](_0x283513)[_0xcf76('0x24')]();};}function respondWithResult(_0x42ee71,_0x1c2b0c){_0x1c2b0c=_0x1c2b0c||0xc8;return function(_0x591ebb){if(_0x591ebb){return _0x42ee71['status'](_0x1c2b0c)[_0xcf76('0x25')](_0x591ebb);}};}function respondWithFilteredResult(_0x51dd39,_0x28bb36){return function(_0x17f6ce){if(_0x17f6ce){var _0x242ee6=typeof _0x28bb36[_0xcf76('0x26')]===_0xcf76('0x27')&&typeof _0x28bb36['limit']===_0xcf76('0x27');var _0x17e87b=_0x17f6ce['count'];var _0x219c91=_0x242ee6?0x0:_0x28bb36[_0xcf76('0x26')];var _0x4b087c=_0x242ee6?_0x17f6ce[_0xcf76('0x28')]:_0x28bb36['offset']+_0x28bb36['limit'];var _0x112e32;if(_0x4b087c>=_0x17e87b){_0x4b087c=_0x17e87b;_0x112e32=0xc8;}else{_0x112e32=0xce;}_0x51dd39['status'](_0x112e32);return _0x51dd39[_0xcf76('0x29')](_0xcf76('0x2a'),_0x219c91+'-'+_0x4b087c+'/'+_0x17e87b)[_0xcf76('0x25')](_0x17f6ce);}return null;};}function saveUpdates(_0x153936){return function(_0x43ce25){if(_0x43ce25){return _0x43ce25['update'](_0x153936)[_0xcf76('0x19')](function(_0x23ef9e){return _0x23ef9e;});}return null;};}function removeEntity(_0x1b5635){return function(_0x9f461c){if(_0x9f461c){return _0x9f461c['destroy']()[_0xcf76('0x19')](function(){_0x1b5635['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe3c876){return function(_0x25f278){if(!_0x25f278){_0xe3c876['sendStatus'](0x194);}return _0x25f278;};}function handleError(_0x5a4c58,_0x25f3af){_0x25f3af=_0x25f3af||0x1f4;return function(_0x5f2249){logger[_0xcf76('0x1d')](_0x5f2249[_0xcf76('0x2b')]);if(_0x5f2249[_0xcf76('0x2c')]){delete _0x5f2249[_0xcf76('0x2c')];}_0x5a4c58[_0xcf76('0x23')](_0x25f3af)[_0xcf76('0x2d')](_0x5f2249);};}function getMustacheRender(_0x4f3d29,_0x4931ff){return Mustache[_0xcf76('0x2e')](_0x4f3d29,_[_0xcf76('0x2f')](_0x4931ff['body'],{'contact':_0x4931ff['contact'],'message':_0x4931ff[_0xcf76('0x1f')],'agent':_0x4931ff[_0xcf76('0x30')],'interaction':_0x4931ff[_0xcf76('0x31')],'account':_0x4931ff[_0xcf76('0x32')]}))||'';}exports['index']=function(_0x44e971,_0x5ca8c1){var _0x48cc54={};var _0x33f0cb=_['map'](db['ChatInteraction'][_0xcf76('0x33')],function(_0x406e90){return{'name':_0x406e90[_0xcf76('0x34')],'type':_0x406e90[_0xcf76('0x35')][_0xcf76('0x36')]};});_0x48cc54=qs[_0xcf76('0x37')](_0x33f0cb,_0x44e971);return interaction[_0xcf76('0x38')](_0xcf76('0x39'),_0x44e971[_0xcf76('0x3a')],_0x44e971[_0xcf76('0x3b')],_0x48cc54,_0x33f0cb)[_0xcf76('0x19')](respondWithFilteredResult(_0x5ca8c1,_0x48cc54))[_0xcf76('0x22')](handleError(_0x5ca8c1,null));};exports[_0xcf76('0x3c')]=function(_0x56edaf,_0x14ab99){var _0x5452e7={'raw':![],'where':{'id':_0x56edaf['params']['id']}},_0x241926={};_0x241926[_0xcf76('0x3d')]=_[_0xcf76('0x3e')](db['ChatInteraction'][_0xcf76('0x33')]);_0x241926[_0xcf76('0x3a')]=_[_0xcf76('0x3e')](_0x56edaf[_0xcf76('0x3a')]);_0x241926[_0xcf76('0x3f')]=_['intersection'](_0x241926[_0xcf76('0x3d')],_0x241926[_0xcf76('0x3a')]);_0x5452e7[_0xcf76('0x40')]=_['intersection'](_0x241926['model'],qs[_0xcf76('0x41')](_0x56edaf[_0xcf76('0x3a')][_0xcf76('0x41')]));_0x5452e7[_0xcf76('0x40')]=_0x5452e7[_0xcf76('0x40')]['length']?_0x5452e7[_0xcf76('0x40')]:_0x241926[_0xcf76('0x3d')];if(_0x56edaf[_0xcf76('0x3a')][_0xcf76('0x42')]){_0x5452e7['include']=[{'all':!![]}];}_0x5452e7=_[_0xcf76('0x2f')]({},_0x5452e7,_0x56edaf['options']);return db['ChatInteraction']['find'](_0x5452e7)['then'](handleEntityNotFound(_0x14ab99,null))[_0xcf76('0x19')](respondWithResult(_0x14ab99,null))['catch'](handleError(_0x14ab99,null));};exports[_0xcf76('0x43')]=function(_0x5a3f01,_0x511c9c){return db['ChatInteraction'][_0xcf76('0x43')](_0x5a3f01[_0xcf76('0x44')],{})[_0xcf76('0x19')](respondWithResult(_0x511c9c,0xc9))[_0xcf76('0x22')](handleError(_0x511c9c,null));};exports[_0xcf76('0x45')]=function(_0x55faa4,_0x292e65){if(_0x55faa4[_0xcf76('0x44')]['id']){delete _0x55faa4[_0xcf76('0x44')]['id'];}return db['ChatInteraction'][_0xcf76('0x46')]({'where':{'id':_0x55faa4[_0xcf76('0x47')]['id']}})[_0xcf76('0x19')](handleEntityNotFound(_0x292e65,null))[_0xcf76('0x19')](saveUpdates(_0x55faa4[_0xcf76('0x44')],null))[_0xcf76('0x19')](respondWithResult(_0x292e65,null))[_0xcf76('0x22')](handleError(_0x292e65,null));};exports[_0xcf76('0x48')]=function(_0x47e990,_0x88dde9){return db['ChatInteraction'][_0xcf76('0x46')]({'where':{'id':_0x47e990['params']['id']}})[_0xcf76('0x19')](handleEntityNotFound(_0x88dde9,null))[_0xcf76('0x19')](removeEntity(_0x88dde9,null))[_0xcf76('0x22')](handleError(_0x88dde9,null));};exports[_0xcf76('0x49')]=function(_0x54eb6b,_0x5d8b95){return db[_0xcf76('0x4a')][_0xcf76('0x49')]()[_0xcf76('0x19')](respondWithResult(_0x5d8b95,null))[_0xcf76('0x22')](handleError(_0x5d8b95,null));};exports[_0xcf76('0x4b')]=function(_0x1be64b,_0x50ae6a){var _0x5b4857=_0x1be64b[_0xcf76('0x47')]['id'];var _0x45dec8;var _0x4817ca;var _0x392dfc;return db['ChatInteraction'][_0xcf76('0x4c')]({'where':{'id':_0x5b4857}})['then'](function(_0x2bb951){_0x45dec8=_0x2bb951;return db[_0xcf76('0x4d')][_0xcf76('0x4c')]({'where':{'id':_0x2bb951[_0xcf76('0x4e')]},'attributes':['id','vidaooApiKey',_0xcf76('0x4f'),_0xcf76('0x50'),'vidaooNote','vidaooMetadata'],'raw':!![]});})['then'](function(_0x5bf40e){if(_0x5bf40e&&_0x5bf40e[_0xcf76('0x51')]&&_0x5bf40e[_0xcf76('0x4f')]){_0x4817ca=_0x5bf40e;var _0x385515={'interaction':{'id':_0x5b4857},'agent':{'id':_0x1be64b['user']['id'],'name':_0x1be64b[_0xcf76('0x3b')]['name'],'fullname':_0x1be64b[_0xcf76('0x3b')]['fullname'],'email':_0x1be64b[_0xcf76('0x3b')][_0xcf76('0x52')]},'contact':_0x1be64b[_0xcf76('0x44')][_0xcf76('0x53')],'account':_0x1be64b['body'][_0xcf76('0x32')]};var _0x517bce={'rejectUnauthorized':![],'method':_0xcf76('0x54'),'url':_0xcf76('0x55'),'headers':{'X-APIKEY':_0x5bf40e[_0xcf76('0x51')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1be64b['user'][_0xcf76('0x52')]],'buttons':null,'topic':_0x4817ca[_0xcf76('0x50')],'note':_[_0xcf76('0x56')](_0x4817ca[_0xcf76('0x57')])?null:getMustacheRender(_0x4817ca[_0xcf76('0x57')],_0x385515),'metadata':null},'redirect':_0xcf76('0x58'),'json':!![]};try{if(!_[_0xcf76('0x56')](_0x4817ca[_0xcf76('0x59')])){var _0x55292a=getMustacheRender(_0x4817ca['vidaooMetadata'],_0x385515);var _0x1a67d0=JSON['parse'](_0x55292a);_0x517bce['body'][_0xcf76('0x5a')]=_0x1a67d0;}}catch(_0x192a49){throw new db['Sequelize'][(_0xcf76('0x5b'))](_0xcf76('0x5c'));}return rp(_0x517bce);}else{throw new db[(_0xcf76('0x5d'))]['ValidationError'](_0xcf76('0x5e'));}})[_0xcf76('0x19')](function(_0x25753c){_0x392dfc=_0x25753c;if(_0x392dfc['id']){var _0x21db63={'body':_0x392dfc[_0xcf76('0x5f')],'ChatWebsiteId':_0x4817ca['id'],'ChatInteractionId':_0x45dec8['id'],'direction':'out','UserId':_0x1be64b[_0xcf76('0x3b')]['id']};return db[_0xcf76('0x60')][_0xcf76('0x43')](_0x21db63,{});}else{throw new db[(_0xcf76('0x5d'))][(_0xcf76('0x5b'))](_0xcf76('0x61'));}})[_0xcf76('0x19')](function(){return _0x45dec8[_0xcf76('0x62')]({'vidaooSessionId':_0x392dfc['id']});})['then'](respondWithResult(_0x50ae6a,null))[_0xcf76('0x22')](handleError(_0x50ae6a,null));};exports['customUpdate']=function(_0x323221,_0x5a76dd){if(_0x323221[_0xcf76('0x44')]['id']){delete _0x323221[_0xcf76('0x44')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x323221[_0xcf76('0x47')]['id']},'include':[{'model':db[_0xcf76('0x63')],'as':_0xcf76('0x64')}]})['then'](handleEntityNotFound(_0x5a76dd,null))[_0xcf76('0x19')](saveUpdates(_0x323221[_0xcf76('0x44')],null))[_0xcf76('0x19')](respondWithResult(_0x5a76dd,null))[_0xcf76('0x22')](handleError(_0x5a76dd,null));};exports['abandon']=function(_0x3d3319,_0x4748e3){if(_0x3d3319[_0xcf76('0x44')]['id']){delete _0x3d3319[_0xcf76('0x44')]['id'];}return db[_0xcf76('0x4a')][_0xcf76('0x46')]({'where':{'id':_0x3d3319[_0xcf76('0x47')]['id']}})[_0xcf76('0x19')](function(_0x205416){if(!_0x205416){logger[_0xcf76('0x1d')](_0xcf76('0x65'),_0xcf76('0x66'),0x194,_0xcf76('0x67'));_0x4748e3[_0xcf76('0x68')](0x194);}else{if(_0x205416['UserId']){throw new db[(_0xcf76('0x5d'))][(_0xcf76('0x5b'))](_0xcf76('0x69'));}}return _0x205416;})[_0xcf76('0x19')](function(_0x4a3fe8){if(_0x4a3fe8){return _0x4a3fe8[_0xcf76('0x45')]({'closed':_0x3d3319[_0xcf76('0x44')]['closed'],'disposition':_0x3d3319['body'][_0xcf76('0x6a')]})['then'](function(_0x1dad94){return _0x1dad94;});}})[_0xcf76('0x19')](function(){return respondWithRpcPromise('AbandonInteraction',_0xcf76('0x66'),_0x3d3319['body'],client9004);})[_0xcf76('0x19')](respondWithResult(_0x4748e3,null))[_0xcf76('0x22')](handleError(_0x4748e3,null));};exports['attachmentUpload']=function(_0x3bd8a9,_0x193c12){_0x3bd8a9[_0xcf76('0x44')][_0xcf76('0x2c')]=_0x3bd8a9['file'][_0xcf76('0x6b')];_0x3bd8a9['body'][_0xcf76('0x6c')]=_0x3bd8a9[_0xcf76('0x6d')]['filename'];_0x3bd8a9[_0xcf76('0x44')][_0xcf76('0x35')]=_0x3bd8a9[_0xcf76('0x6d')][_0xcf76('0x6e')];return db[_0xcf76('0x6f')][_0xcf76('0x43')](_0x3bd8a9['body'])[_0xcf76('0x19')](respondWithResult(_0x193c12,0xc9))['catch'](handleError(_0x193c12,null));};exports[_0xcf76('0x70')]=function(_0x39a12c,_0x2373e7){return db['ChatInteraction'][_0xcf76('0x4c')]({'where':{'id':_0x39a12c['params']['id']},'raw':!![]})[_0xcf76('0x19')](handleEntityNotFound(_0x2373e7,null))[_0xcf76('0x19')](function(_0x517f35){if(_0x517f35){if(_0x517f35[_0xcf76('0x71')]){return _0x2373e7[_0xcf76('0x23')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0xcf76('0x6f')]['findOne']({'where':{'id':_0x39a12c[_0xcf76('0x3a')][_0xcf76('0x72')]},'raw':!![]})[_0xcf76('0x19')](handleEntityNotFound(_0x2373e7,null));}})[_0xcf76('0x19')](function(_0x38e7ab){if(_0x38e7ab){var _0x19d698=_0x38e7ab['ChatOfflineMessageId']!==null;var _0x2a3947=path[_0xcf76('0x73')](config[_0xcf76('0x74')],'server/files/attachments/');if(_0x19d698){_0x2a3947=path[_0xcf76('0x73')](_0x2a3947,_0xcf76('0x75'));}var _0x5dd019=path[_0xcf76('0x73')](_0x2a3947,_0x38e7ab[_0xcf76('0x6c')]);return _0x2373e7['download'](_0x5dd019);}})['catch'](handleError(_0x2373e7,null));};exports['close']=function(_0x2713bf,_0x3ff543){var _0x46bf36=null;var _0x2b20d0=null;var _0x5e3f84=null;if(_0x2713bf[_0xcf76('0x44')]['id']){delete _0x2713bf[_0xcf76('0x44')]['id'];}if(_0x2713bf[_0xcf76('0x44')][_0xcf76('0x76')]){_0x5e3f84=path[_0xcf76('0x73')](config['root'],_0xcf76('0x77'),util[_0xcf76('0x78')]('transcript-%s.txt',Date[_0xcf76('0x79')]()));_0x2713bf['body'][_0xcf76('0x7a')]=_0x5e3f84;}return db[_0xcf76('0x4a')]['find']({'where':{'id':_0x2713bf[_0xcf76('0x47')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xcf76('0x7b'),'include':[{'model':db['User'],'as':_0xcf76('0x7c')}]}]})[_0xcf76('0x19')](handleEntityNotFound(_0x3ff543,null))[_0xcf76('0x19')](saveUpdates(_0x2713bf['body'],null))[_0xcf76('0x19')](function(_0xdf40c4){if(_0xdf40c4){_0x46bf36=_0xdf40c4;return db['ChatWebsite'][_0xcf76('0x46')]({'where':{'id':_0x46bf36['ChatWebsiteId']}});}})['then'](function(_0x5e6352){if(_0x5e6352){_0x2b20d0=_0x5e6352;return db[_0xcf76('0x63')][_0xcf76('0x46')]({'where':{'id':_0x46bf36['ContactId']}});}})['then'](function(_0x57b3f7){if(_0x57b3f7){if(_0x5e3f84){var _0x47f60a=null;for(var _0x570b31=0x1;_0x570b31<_0x46bf36['Messages'][_0xcf76('0x7d')];++_0x570b31){_0x47f60a=_0x46bf36[_0xcf76('0x7b')][_0x570b31];var _0x45aa22=_0x47f60a[_0xcf76('0x7e')]?util[_0xcf76('0x78')](_0xcf76('0x7f'),_0x2b20d0[_0xcf76('0x80')],_0x47f60a[_0xcf76('0x7e')]):_0xcf76('0x81');var _0x176f25=_0x2713bf[_0xcf76('0x44')]['customer']||util[_0xcf76('0x78')]('%s%d',_0xcf76('0x82'),_0x47f60a[_0xcf76('0x83')]);switch(_0x2b20d0[_0xcf76('0x84')]){case _0xcf76('0x85'):_0x45aa22=_0x47f60a[_0xcf76('0x7e')]?util['format'](_0xcf76('0x7f'),_0x2b20d0['agentAlias'],_0x47f60a['UserId']):'System';break;case'agent_alias':_0x45aa22=_0x47f60a[_0xcf76('0x7e')]?_0x47f60a['User'][_0xcf76('0x86')]||_0x47f60a['User']['fullname']:_0xcf76('0x81');break;case _0xcf76('0x87'):_0x45aa22=_0x47f60a['UserId']?_0x47f60a['User']['fullname']:_0xcf76('0x81');break;default:_0x45aa22=_0x47f60a['UserId']?util[_0xcf76('0x78')](_0xcf76('0x7f'),_0x2b20d0['agentAlias'],_0x47f60a[_0xcf76('0x7e')]):_0xcf76('0x81');}var _0x28e923=util[_0xcf76('0x78')](_0xcf76('0x88'),moment(_0x47f60a[_0xcf76('0x89')])[_0xcf76('0x78')](_0xcf76('0x8a')),_0x47f60a[_0xcf76('0x8b')]==='in'?_0x176f25:_0x45aa22,_0x47f60a[_0xcf76('0x44')]);if(!_0x47f60a[_0xcf76('0x8c')]){fs[_0xcf76('0x8d')](_0x5e3f84,_0x28e923);}}return db[_0xcf76('0x8e')][_0xcf76('0x4c')]({'where':{'service':!![]},'include':[{'model':db[_0xcf76('0x8f')],'as':_0xcf76('0x90'),'raw':!![],'include':[{'model':db[_0xcf76('0x91')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0xcf76('0x19')](function(_0x3b10fa){if(!_0x3b10fa||!_0x3b10fa[_0xcf76('0x90')]||!_0x2713bf[_0xcf76('0x44')])return _0x46bf36;var _0x3495be=_0x3b10fa['getSmtpOptions']();return respondWithRpcPromise(_0xcf76('0x92'),_0xcf76('0x93'),{'account':_0x3495be,'message':{'from':util[_0xcf76('0x78')](_0xcf76('0x94'),_0x3b10fa[_0xcf76('0x2c')],_0x3b10fa[_0xcf76('0x52')]||_0x3b10fa[_0xcf76('0x90')]['user']),'to':_0x2713bf[_0xcf76('0x44')][_0xcf76('0x76')],'subject':_0xcf76('0x95'),'text':util[_0xcf76('0x78')](_0xcf76('0x96'),_0x2713bf[_0xcf76('0x44')][_0xcf76('0x76')]),'attachments':[{'path':_0x5e3f84}]}})['then'](function(){return _0x46bf36;})[_0xcf76('0x22')](function(_0xc2e55f){logger[_0xcf76('0x1d')](_0xc2e55f);});})[_0xcf76('0x19')](respondWithStatusCode(_0x3ff543,0xc8))['catch'](handleError(_0x3ff543,null));};exports[_0xcf76('0x97')]=function(_0x1fb71c,_0x263f99){return db['ChatMessage']['find']({'where':{'id':_0x1fb71c[_0xcf76('0x47')]['id']}})['then'](handleEntityNotFound(_0x263f99,null))[_0xcf76('0x19')](function(_0x51fd5b){if(_0x51fd5b){return _0x51fd5b[_0xcf76('0x97')](_0x1fb71c['body'][_0xcf76('0x98')],_[_0xcf76('0x99')](_0x1fb71c[_0xcf76('0x44')],[_0xcf76('0x98'),'id'])||{});}})[_0xcf76('0x19')](respondWithResult(_0x263f99,null))[_0xcf76('0x22')](handleError(_0x263f99,null));};exports[_0xcf76('0x9a')]=function(_0x428358,_0x407ce3){var _0x4e120f={'raw':![],'where':{}};var _0x1ee457={};var _0x20ffb5={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xcf76('0x4c')]({'where':{'id':_0x428358[_0xcf76('0x47')]['id']}})[_0xcf76('0x19')](handleEntityNotFound(_0x407ce3,null))['then'](function(_0x42e635){if(_0x42e635){_0x1ee457[_0xcf76('0x3d')]=_[_0xcf76('0x3e')](db['ChatMessage'][_0xcf76('0x33')]);_0x1ee457[_0xcf76('0x3a')]=_['keys'](_0x428358['query']);_0x1ee457[_0xcf76('0x3f')]=_[_0xcf76('0x9b')](_0x1ee457[_0xcf76('0x3d')],_0x1ee457[_0xcf76('0x3a')]);_0x4e120f['attributes']=_[_0xcf76('0x9b')](_0x1ee457['model'],qs[_0xcf76('0x41')](_0x428358[_0xcf76('0x3a')][_0xcf76('0x41')]));_0x4e120f[_0xcf76('0x40')]=_0x4e120f['attributes'][_0xcf76('0x7d')]?_0x4e120f[_0xcf76('0x40')]:_0x1ee457[_0xcf76('0x3d')];if(!_0x428358[_0xcf76('0x3a')]['hasOwnProperty'](_0xcf76('0x9c'))){_0x4e120f['limit']=qs[_0xcf76('0x9d')](_0x428358['query'][_0xcf76('0x9d')]);_0x4e120f[_0xcf76('0x26')]=qs['offset'](_0x428358[_0xcf76('0x3a')]['offset']);}_0x4e120f[_0xcf76('0x9e')]=qs[_0xcf76('0x9f')](_0x428358[_0xcf76('0x3a')]['sort']);_0x4e120f[_0xcf76('0xa0')]=qs[_0xcf76('0x3f')](_[_0xcf76('0xa1')](_0x428358[_0xcf76('0x3a')],_0x1ee457[_0xcf76('0x3f')]));_0x4e120f['where']['ChatInteractionId']=_0x42e635['id'];if(_0x428358[_0xcf76('0x3a')][_0xcf76('0xa2')]){_0x4e120f[_0xcf76('0xa0')]=_[_0xcf76('0x2f')](_0x4e120f[_0xcf76('0xa0')],{'$or':_['map'](_0x4e120f[_0xcf76('0x40')],function(_0xc0d98a){var _0x385f23={};_0x385f23[_0xc0d98a]={'$like':'%'+_0x428358[_0xcf76('0x3a')]['filter']+'%'};return _0x385f23;})});}if(_0x428358[_0xcf76('0x3a')][_0xcf76('0xa3')]){var _0x5eae95=_0x428358['query'][_0xcf76('0xa3')]['split'](',');var _0x207a36={};_0x207a36[_0x5eae95[0x0]]={'$gte':moment(_0x5eae95[0x1])['format'](_0xcf76('0xa4'))};_0x4e120f[_0xcf76('0xa0')]=_[_0xcf76('0x2f')](_0x4e120f[_0xcf76('0xa0')],_0x207a36);}_0x4e120f=_['merge']({},_0x4e120f,_0x428358[_0xcf76('0xa5')]);return db['ChatMessage'][_0xcf76('0x28')]({'where':_0x4e120f['where']})['then'](function(_0x17d2dc){_0x20ffb5['count']=_0x17d2dc;if(_0x428358[_0xcf76('0x3a')][_0xcf76('0x42')]){_0x4e120f[_0xcf76('0xa6')]=[{'all':!![]}];}return db[_0xcf76('0x60')][_0xcf76('0x38')](_0x4e120f);})['then'](function(_0x362283){_0x20ffb5[_0xcf76('0xa7')]=_0x362283;return _0x20ffb5;});}})[_0xcf76('0x19')](respondWithFilteredResult(_0x407ce3,_0x4e120f))[_0xcf76('0x22')](handleError(_0x407ce3,null));};exports['getMyMessages']=function(_0x4bc359,_0x2a83ab){var _0x1b2705={'where':{}},_0x275e09={},_0x29a166={'count':0x0,'rows':[]};return db[_0xcf76('0x4a')][_0xcf76('0x4c')]({'where':{'id':_0x4bc359[_0xcf76('0x47')]['id']}})[_0xcf76('0x19')](handleEntityNotFound(_0x2a83ab,null))['then'](function(_0x4c1389){if(_0x4c1389){_0x275e09[_0xcf76('0x3d')]=_['keys'](db[_0xcf76('0x60')]['rawAttributes']);_0x275e09[_0xcf76('0x3a')]=_[_0xcf76('0x3e')](_0x4bc359[_0xcf76('0x3a')]);_0x275e09[_0xcf76('0x3f')]=_[_0xcf76('0x9b')](_0x275e09[_0xcf76('0x3d')],_0x275e09['query']);_0x1b2705[_0xcf76('0x40')]=_[_0xcf76('0x9b')](_0x275e09[_0xcf76('0x3d')],qs[_0xcf76('0x41')](_0x4bc359['query'][_0xcf76('0x41')]));_0x1b2705[_0xcf76('0x40')]=_0x1b2705[_0xcf76('0x40')][_0xcf76('0x7d')]?_0x1b2705[_0xcf76('0x40')]:_0x275e09[_0xcf76('0x3d')];if(!_0x4bc359[_0xcf76('0x3a')]['hasOwnProperty']('nolimit')){_0x1b2705[_0xcf76('0x9d')]=qs[_0xcf76('0x9d')](_0x4bc359[_0xcf76('0x3a')]['limit']);_0x1b2705[_0xcf76('0x26')]=qs[_0xcf76('0x26')](_0x4bc359[_0xcf76('0x3a')][_0xcf76('0x26')]);}_0x1b2705['order']=qs[_0xcf76('0x9f')](_0x4bc359[_0xcf76('0x3a')][_0xcf76('0x9f')]);_0x1b2705[_0xcf76('0xa0')]=qs[_0xcf76('0x3f')](_['pick'](_0x4bc359[_0xcf76('0x3a')],_0x275e09[_0xcf76('0x3f')]));_0x1b2705[_0xcf76('0xa0')][_0xcf76('0xa8')]=_0x4c1389['id'];if(_0x4bc359[_0xcf76('0x3a')][_0xcf76('0xa2')]){_0x1b2705[_0xcf76('0xa0')]=_[_0xcf76('0x2f')](_0x1b2705[_0xcf76('0xa0')],{'$or':_[_0xcf76('0xa9')](_0x1b2705['attributes'],function(_0x313aad){var _0x50ee9a={};_0x50ee9a[_0x313aad]={'$like':'%'+_0x4bc359['query'][_0xcf76('0xa2')]+'%'};return _0x50ee9a;})});}_0x1b2705[_0xcf76('0xa0')][_0xcf76('0x8c')]=![];if(_0x4bc359[_0xcf76('0x3a')]['id']){_0x1b2705[_0xcf76('0xa0')]['id']={'$gt':_0x4bc359[_0xcf76('0x3a')]['id']};}_0x1b2705=_[_0xcf76('0x2f')]({},_0x1b2705,_0x4bc359['options']);return db[_0xcf76('0x60')]['count']({'where':_0x1b2705[_0xcf76('0xa0')]})['then'](function(_0x4ba314){_0x29a166[_0xcf76('0x28')]=_0x4ba314;_0x1b2705[_0xcf76('0xa6')]=[];if(_0x4bc359['query'][_0xcf76('0xaa')]){_0x1b2705['include']['push']({'model':db[_0xcf76('0x7c')],'as':_0xcf76('0x7c'),'attributes':['id','fullname','alias']});}if(_0x4bc359['query'][_0xcf76('0x42')]){_0x1b2705['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x1b2705);})[_0xcf76('0x19')](function(_0x438b45){_0x29a166[_0xcf76('0xa7')]=_0x438b45;return _0x29a166;});}})[_0xcf76('0x19')](respondWithFilteredResult(_0x2a83ab,_0x1b2705))['catch'](handleError(_0x2a83ab,null));};exports[_0xcf76('0xab')]=function(_0x4d1106,_0x5ad5a0){return db[_0xcf76('0x4a')][_0xcf76('0x46')]({'where':{'id':_0x4d1106[_0xcf76('0x47')]['id']}})[_0xcf76('0x19')](handleEntityNotFound(_0x5ad5a0,null))[_0xcf76('0x19')](function(_0x46d34d){if(_0x46d34d){return _0x46d34d[_0xcf76('0xac')](_0x4d1106[_0xcf76('0x44')][_0xcf76('0x98')],_['omit'](_0x4d1106[_0xcf76('0x44')],[_0xcf76('0x98'),'id'])||{})[_0xcf76('0xad')](function(){return db[_0xcf76('0xae')]['findAll']({'attributes':['id',_0xcf76('0x2c'),_0xcf76('0xaf')],'where':{'id':_0x4d1106['body'][_0xcf76('0x98')]}});})[_0xcf76('0x19')](function(_0x34e943){socket[_0xcf76('0xb0')](_0xcf76('0xb1'),{'id':Number(_0x4d1106['params']['id']),'tags':_0x34e943||[]});return{'id':Number(_0x4d1106[_0xcf76('0x47')]['id']),'tags':_0x34e943||[]};});}})[_0xcf76('0x19')](respondWithResult(_0x5ad5a0,null))[_0xcf76('0x22')](handleError(_0x5ad5a0,null));};exports['removeTags']=function(_0x3ca927,_0x55deac){return db[_0xcf76('0x4a')][_0xcf76('0x46')]({'where':{'id':_0x3ca927['params']['id']}})[_0xcf76('0x19')](handleEntityNotFound(_0x55deac,null))['then'](function(_0x571564){if(_0x571564){return _0x571564[_0xcf76('0xb2')](_0x3ca927['query'][_0xcf76('0x98')]);}})[_0xcf76('0x19')](respondWithStatusCode(_0x55deac,null))['catch'](handleError(_0x55deac,null));};exports[_0xcf76('0xb3')]=function(_0x4416ee,_0x2089e8){var _0x4b6c51=moment()['unix']()[_0xcf76('0xb4')]();var _0x188a09=path[_0xcf76('0x73')](config[_0xcf76('0x74')],_0xcf76('0xb5'),_0xcf76('0xb6'),_0xcf76('0xb7'));var _0xb23641=path[_0xcf76('0x73')](config[_0xcf76('0x74')],'server',_0xcf76('0xb6'),_0xcf76('0xb8'));var _0x193321=path[_0xcf76('0x73')](_0x188a09,_0x4b6c51);var _0x397fd7=util[_0xcf76('0x78')](_0xcf76('0xb9'),_0x4416ee[_0xcf76('0x47')]['id'],_0x4b6c51);var _0x1c925c=path['join'](_0x188a09,_0x397fd7);var _0x40bb90=[];_0x40bb90[_0xcf76('0xba')]({'model':db[_0xcf76('0x7c')],'as':_0xcf76('0x7c'),'attributes':['id',_0xcf76('0xbb')],'raw':!![]});_0x40bb90[_0xcf76('0xba')]({'model':db[_0xcf76('0x63')],'as':_0xcf76('0x64'),'attributes':['id',_0xcf76('0xbc'),_0xcf76('0xbd')],'raw':!![]});if(_0x4416ee['query']['attachments']){_0x40bb90[_0xcf76('0xba')]({'model':db[_0xcf76('0x6f')],'as':'Attachment','raw':!![]});}var _0x3f2536=[{'model':db[_0xcf76('0x60')],'as':'Messages','attributes':['id',_0xcf76('0x44'),_0xcf76('0x89'),_0xcf76('0x8b'),_0xcf76('0x8c'),_0xcf76('0xbe')],'include':_0x40bb90}];_0x3f2536['push']({'model':db[_0xcf76('0x4d')],'as':_0xcf76('0xbf'),'attributes':['id','name']});_0x3f2536['push']({'model':db[_0xcf76('0x7c')],'as':_0xcf76('0xc0'),'attributes':['id',_0xcf76('0xbb')]});return db[_0xcf76('0x4a')][_0xcf76('0x46')]({'where':{'id':_0x4416ee[_0xcf76('0x47')]['id']},'include':_0x3f2536})[_0xcf76('0x19')](handleEntityNotFound(_0x2089e8,null))[_0xcf76('0x19')](function(_0x3e519b){if(_0x3e519b){var _0x13c394=_0x3e519b[_0xcf76('0xc1')]({'plain':!![]});fs[_0xcf76('0xc2')](_0x193321);var _0x25cf6d={'channel':'Chat','account':_0x13c394['Account'][_0xcf76('0x2c')],'agent':_0x13c394[_0xcf76('0xc0')]?_0x13c394[_0xcf76('0xc0')][_0xcf76('0xbb')]:_0xcf76('0xc3'),'createdAt':moment(_0x13c394[_0xcf76('0x89')])[_0xcf76('0x78')]('YYYY-MM-DD\x20HH:mm:ss')[_0xcf76('0xb4')](),'closedAt':_0x13c394[_0xcf76('0x71')]?moment(_0x13c394['closedAt'])[_0xcf76('0x78')](_0xcf76('0xa4'))[_0xcf76('0xb4')]():'','disposition':_0x13c394[_0xcf76('0x6a')],'chatInfo':{'browser':_0x13c394['browserName'],'os':_0x13c394[_0xcf76('0xc4')],'referer':_0x13c394[_0xcf76('0xc5')],'customerIp':_0x13c394[_0xcf76('0xc6')],'customerPort':_0x13c394[_0xcf76('0xc7')]?_0x13c394[_0xcf76('0xc7')]:_0xcf76('0xc3')},'messages':_(_0x13c394[_0xcf76('0x7b')])[_0xcf76('0xc8')]()['filter']({'secret':![]})[_0xcf76('0xa9')](function(_0x244984){if(_0x244984['Attachment']){var _0x446c2d=path[_0xcf76('0x73')](_0xb23641,_0x244984[_0xcf76('0x6f')][_0xcf76('0x6c')]);if(fs['existsSync'](_0x446c2d)){fs[_0xcf76('0xc9')](_0x446c2d)[_0xcf76('0xca')](fs['createWriteStream'](path[_0xcf76('0x73')](_0x193321,_0x244984['Attachment'][_0xcf76('0x6c')])));}}return{'date':moment(_0x244984[_0xcf76('0x89')])[_0xcf76('0x78')](_0xcf76('0xa4'))[_0xcf76('0xb4')](),'sender':_0x244984[_0xcf76('0x8b')]==='out'?_0x244984['User']?_0x244984[_0xcf76('0x7c')][_0xcf76('0xbb')]:'System':_0x244984[_0xcf76('0x64')][_0xcf76('0xbc')]+(_0x244984[_0xcf76('0x64')][_0xcf76('0xbd')]?'\x20'+_0x244984[_0xcf76('0x64')]['lastName']:''),'body':_0x244984[_0xcf76('0x6f')]?_0x244984[_0xcf76('0x6f')][_0xcf76('0x6c')]:_0x244984['body'],'direction':_0x244984[_0xcf76('0x8b')]===_0xcf76('0xcb')?'A':'C','secret':_0x244984[_0xcf76('0x8c')],'read':_0x244984[_0xcf76('0xbe')],'attachment':_0x244984[_0xcf76('0x6f')]};})['value']()};return ejs[_0xcf76('0xcc')](path['join'](config[_0xcf76('0x74')],_0xcf76('0xb5'),_0xcf76('0xcd'),'downloadInteraction.ejs'),{'interaction':_0x25cf6d})['then'](function(_0x7e08ff){var _0x3825a2=path[_0xcf76('0x73')](_0x193321,'transcript-'+_0x13c394['id']+'-'+_0x4b6c51+_0xcf76('0xce'));var _0x5876f3={'path':_0x3825a2,'channel':'Chat','interactionId':_0x13c394['id']};return pdf[_0xcf76('0xcf')](_0x7e08ff,_0x5876f3);})[_0xcf76('0x19')](function(){return new Promise(function(_0xda3d26,_0x161fe3){zipdir(_0x193321,{'saveTo':_0x1c925c},function(_0x5b1196,_0x2527fa){if(_0x5b1196)return _0x161fe3(_0x5b1196);return _0xda3d26(_0x2527fa);});})[_0xcf76('0x19')](function(){return new BPromise(function(_0x48bdb7,_0x3d5017){rimraf(_0x193321,function(_0x389774){if(_0x389774)_0x3d5017(_0x389774);return _0x48bdb7();});});})[_0xcf76('0x19')](function(){return _0x2089e8[_0xcf76('0xb3')](_0x1c925c,_0x397fd7,function(_0x33061d){if(_0x33061d){logger[_0xcf76('0x1d')](_0xcf76('0xd0'),_0x33061d);}else{fs[_0xcf76('0xd1')](_0x1c925c);}});});});}else{return _0x2089e8[_0xcf76('0x68')](0xc8);}})['catch'](handleError(_0x2089e8,null));}; \ No newline at end of file +var _0x98d1=['message','info','result','catch','sendStatus','status','json','offset','limit','count','set','update','end','stack','name','render','merge','body','agent','index','map','ChatInteraction','rawAttributes','fieldName','chat','query','user','params','model','keys','intersection','fields','attributes','length','includeAll','include','options','find','create','destroy','describe','ChatWebsite','findOne','vidaooApiKey','vidaooTopic','vidaooMetadata','vidaooEscalation','fullname','email','contact','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','parse','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','basename','filename','type','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','root','download','close','mailTranscript','server/files/chat/upload/','now','pathTranscript','Messages','User','ChatWebsiteId','ContactId','format','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','Mail\x20Transcript','addMessage','omit','ids','getMessages','filters','hasOwnProperty','nolimit','order','sort','where','ChatInteractionId','filter','$gte','split','rows','getMyMessages','pick','findAll','addTags','setTags','spread','color','chatInteractionTags:save','removeTags','server','files','tmp','attachments','transcript-%d-%s.zip','push','firstName','lastName','direction','read','Account','get','Chat','Owner','YYYY-MM-DD\x20HH:mm:ss','closedAt','toString','browserName','osName','referer','customerPort','N.A.','tail','existsSync','pipe','Contact','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x34149c,_0x2601d1){var _0x50dd97=function(_0x5848a8){while(--_0x5848a8){_0x34149c['push'](_0x34149c['shift']());}};_0x50dd97(++_0x2601d1);}(_0x98d1,0x17e));var _0x198d=function(_0xd304de,_0x4fb962){_0xd304de=_0xd304de-0x0;var _0x2f6f06=_0x98d1[_0xd304de];return _0x2f6f06;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x198d('0x0'));var rp=require(_0x198d('0x1'));var moment=require(_0x198d('0x2'));var BPromise=require(_0x198d('0x3'));var Mustache=require(_0x198d('0x4'));var util=require(_0x198d('0x5'));var path=require(_0x198d('0x6'));var ejs=require(_0x198d('0x7'));var fs=require('fs');var _=require(_0x198d('0x8'));var Redis=require(_0x198d('0x9'));var interaction=require(_0x198d('0xa'));var qs=require(_0x198d('0xb'));var pdf=require(_0x198d('0xc'));var logger=require(_0x198d('0xd'))(_0x198d('0xe'));var config=require('../../config/environment');var db=require(_0x198d('0xf'))['db'];config[_0x198d('0x10')]=_[_0x198d('0x11')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x198d('0x12'))(new Redis(config['redis']));require(_0x198d('0x13'))['register'](socket);var jayson=require(_0x198d('0x14'));var client=jayson[_0x198d('0x15')][_0x198d('0x16')]({'port':0x232b});var client9004=jayson[_0x198d('0x15')][_0x198d('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x2c42df,_0x2b1a44,_0x34979a,_0x6a104d){return new BPromise(function(_0x1594a0,_0x3e2931){var _0x308d93=_0x6a104d||client;return _0x308d93[_0x198d('0x17')](_0x2c42df,_0x34979a)[_0x198d('0x18')](function(_0x5912e8){logger['info'](_0x198d('0x19'),_0x2b1a44,'request\x20sent');logger[_0x198d('0x1a')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2b1a44,_0x198d('0x1b'),JSON[_0x198d('0x1c')](_0x5912e8));if(_0x5912e8['error']){if(_0x5912e8['error']['code']===0x1f4){logger['error'](_0x198d('0x19'),_0x2b1a44,_0x5912e8[_0x198d('0x1d')][_0x198d('0x1e')]);return _0x3e2931(_0x5912e8[_0x198d('0x1d')][_0x198d('0x1e')]);}logger[_0x198d('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x2b1a44,_0x5912e8[_0x198d('0x1d')][_0x198d('0x1e')]);return _0x1594a0(_0x5912e8['error']['message']);}else{logger[_0x198d('0x1f')](_0x198d('0x19'),_0x2b1a44,_0x198d('0x1b'));_0x1594a0(_0x5912e8[_0x198d('0x20')][_0x198d('0x1e')]);}})[_0x198d('0x21')](function(_0x519d05){logger[_0x198d('0x1d')](_0x198d('0x19'),_0x2b1a44,_0x519d05);_0x3e2931(_0x519d05);});});}function respondWithStatusCode(_0x2677e5,_0x5cbfe2){_0x5cbfe2=_0x5cbfe2||0xcc;return function(_0x41ff8a){if(_0x41ff8a){return _0x2677e5[_0x198d('0x22')](_0x5cbfe2);}return _0x2677e5[_0x198d('0x23')](_0x5cbfe2)['end']();};}function respondWithResult(_0x1f0bb4,_0x179101){_0x179101=_0x179101||0xc8;return function(_0xe7718c){if(_0xe7718c){return _0x1f0bb4['status'](_0x179101)[_0x198d('0x24')](_0xe7718c);}};}function respondWithFilteredResult(_0xdd1a55,_0xdecb09){return function(_0x57ae30){if(_0x57ae30){var _0x1ba39a=typeof _0xdecb09[_0x198d('0x25')]==='undefined'&&typeof _0xdecb09[_0x198d('0x26')]==='undefined';var _0x1e9f12=_0x57ae30[_0x198d('0x27')];var _0x4bfd7d=_0x1ba39a?0x0:_0xdecb09[_0x198d('0x25')];var _0x8359ed=_0x1ba39a?_0x57ae30[_0x198d('0x27')]:_0xdecb09[_0x198d('0x25')]+_0xdecb09[_0x198d('0x26')];var _0x25aeca;if(_0x8359ed>=_0x1e9f12){_0x8359ed=_0x1e9f12;_0x25aeca=0xc8;}else{_0x25aeca=0xce;}_0xdd1a55['status'](_0x25aeca);return _0xdd1a55[_0x198d('0x28')]('Content-Range',_0x4bfd7d+'-'+_0x8359ed+'/'+_0x1e9f12)['json'](_0x57ae30);}return null;};}function saveUpdates(_0x40a016){return function(_0x3f4b94){if(_0x3f4b94){return _0x3f4b94[_0x198d('0x29')](_0x40a016)[_0x198d('0x18')](function(_0x3dbe3e){return _0x3dbe3e;});}return null;};}function removeEntity(_0x5c2323){return function(_0x35a65c){if(_0x35a65c){return _0x35a65c['destroy']()[_0x198d('0x18')](function(){_0x5c2323['status'](0xcc)[_0x198d('0x2a')]();});}};}function handleEntityNotFound(_0x7487f0){return function(_0x413434){if(!_0x413434){_0x7487f0['sendStatus'](0x194);}return _0x413434;};}function handleError(_0x3c22f8,_0x6f1268){_0x6f1268=_0x6f1268||0x1f4;return function(_0x209033){logger[_0x198d('0x1d')](_0x209033[_0x198d('0x2b')]);if(_0x209033['name']){delete _0x209033[_0x198d('0x2c')];}_0x3c22f8['status'](_0x6f1268)['send'](_0x209033);};}function getMustacheRender(_0x2536f3,_0x3a82ea){return Mustache[_0x198d('0x2d')](_0x2536f3,_[_0x198d('0x2e')](_0x3a82ea[_0x198d('0x2f')],{'contact':_0x3a82ea['contact'],'message':_0x3a82ea[_0x198d('0x1e')],'agent':_0x3a82ea[_0x198d('0x30')],'interaction':_0x3a82ea['interaction'],'account':_0x3a82ea['account']}))||'';}exports[_0x198d('0x31')]=function(_0xe06925,_0xfef050){var _0x5b9607={};var _0x27e86f=_[_0x198d('0x32')](db[_0x198d('0x33')][_0x198d('0x34')],function(_0x24eb8b){return{'name':_0x24eb8b[_0x198d('0x35')],'type':_0x24eb8b['type']['key']};});_0x5b9607=qs['getOptions'](_0x27e86f,_0xe06925);return interaction['findAll'](_0x198d('0x36'),_0xe06925[_0x198d('0x37')],_0xe06925[_0x198d('0x38')],_0x5b9607,_0x27e86f)[_0x198d('0x18')](respondWithFilteredResult(_0xfef050,_0x5b9607))[_0x198d('0x21')](handleError(_0xfef050,null));};exports['show']=function(_0x18f3a9,_0x485b56){var _0x132fd8={'raw':![],'where':{'id':_0x18f3a9[_0x198d('0x39')]['id']}},_0x295c15={};_0x295c15[_0x198d('0x3a')]=_[_0x198d('0x3b')](db['ChatInteraction'][_0x198d('0x34')]);_0x295c15[_0x198d('0x37')]=_[_0x198d('0x3b')](_0x18f3a9['query']);_0x295c15['filters']=_[_0x198d('0x3c')](_0x295c15['model'],_0x295c15['query']);_0x132fd8['attributes']=_['intersection'](_0x295c15[_0x198d('0x3a')],qs[_0x198d('0x3d')](_0x18f3a9[_0x198d('0x37')][_0x198d('0x3d')]));_0x132fd8[_0x198d('0x3e')]=_0x132fd8[_0x198d('0x3e')][_0x198d('0x3f')]?_0x132fd8[_0x198d('0x3e')]:_0x295c15[_0x198d('0x3a')];if(_0x18f3a9[_0x198d('0x37')][_0x198d('0x40')]){_0x132fd8[_0x198d('0x41')]=[{'all':!![]}];}_0x132fd8=_[_0x198d('0x2e')]({},_0x132fd8,_0x18f3a9[_0x198d('0x42')]);return db[_0x198d('0x33')][_0x198d('0x43')](_0x132fd8)[_0x198d('0x18')](handleEntityNotFound(_0x485b56,null))[_0x198d('0x18')](respondWithResult(_0x485b56,null))['catch'](handleError(_0x485b56,null));};exports[_0x198d('0x44')]=function(_0x27bca8,_0xf99b6){return db['ChatInteraction'][_0x198d('0x44')](_0x27bca8[_0x198d('0x2f')],{})['then'](respondWithResult(_0xf99b6,0xc9))[_0x198d('0x21')](handleError(_0xf99b6,null));};exports[_0x198d('0x29')]=function(_0x4f8e69,_0x5b56fd){if(_0x4f8e69[_0x198d('0x2f')]['id']){delete _0x4f8e69['body']['id'];}return db['ChatInteraction'][_0x198d('0x43')]({'where':{'id':_0x4f8e69[_0x198d('0x39')]['id']}})['then'](handleEntityNotFound(_0x5b56fd,null))[_0x198d('0x18')](saveUpdates(_0x4f8e69['body'],null))[_0x198d('0x18')](respondWithResult(_0x5b56fd,null))[_0x198d('0x21')](handleError(_0x5b56fd,null));};exports[_0x198d('0x45')]=function(_0x19c4df,_0x5edbc4){return db[_0x198d('0x33')][_0x198d('0x43')]({'where':{'id':_0x19c4df[_0x198d('0x39')]['id']}})[_0x198d('0x18')](handleEntityNotFound(_0x5edbc4,null))[_0x198d('0x18')](removeEntity(_0x5edbc4,null))[_0x198d('0x21')](handleError(_0x5edbc4,null));};exports[_0x198d('0x46')]=function(_0x21c82c,_0x5b2cd6){return db[_0x198d('0x33')]['describe']()['then'](respondWithResult(_0x5b2cd6,null))[_0x198d('0x21')](handleError(_0x5b2cd6,null));};exports['createVidaooSession']=function(_0x427347,_0x33fe7f){var _0x48e9dc=_0x427347[_0x198d('0x39')]['id'];var _0x1d2a7a;var _0xfdc0ae;var _0x3ef57a;return db[_0x198d('0x33')]['findOne']({'where':{'id':_0x48e9dc}})[_0x198d('0x18')](function(_0x4bfce0){_0x1d2a7a=_0x4bfce0;return db[_0x198d('0x47')][_0x198d('0x48')]({'where':{'id':_0x4bfce0['ChatWebsiteId']},'attributes':['id',_0x198d('0x49'),'vidaooEscalation',_0x198d('0x4a'),'vidaooNote',_0x198d('0x4b')],'raw':!![]});})[_0x198d('0x18')](function(_0x59784f){if(_0x59784f&&_0x59784f['vidaooApiKey']&&_0x59784f[_0x198d('0x4c')]){_0xfdc0ae=_0x59784f;var _0x5b1ad5={'interaction':{'id':_0x48e9dc},'agent':{'id':_0x427347[_0x198d('0x38')]['id'],'name':_0x427347['user'][_0x198d('0x2c')],'fullname':_0x427347[_0x198d('0x38')][_0x198d('0x4d')],'email':_0x427347[_0x198d('0x38')][_0x198d('0x4e')]},'contact':_0x427347['body'][_0x198d('0x4f')],'account':_0x427347[_0x198d('0x2f')][_0x198d('0x50')]};var _0x81c310={'rejectUnauthorized':![],'method':_0x198d('0x51'),'url':_0x198d('0x52'),'headers':{'X-APIKEY':_0x59784f[_0x198d('0x49')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x427347[_0x198d('0x38')][_0x198d('0x4e')]],'buttons':null,'topic':_0xfdc0ae[_0x198d('0x4a')],'note':_[_0x198d('0x53')](_0xfdc0ae[_0x198d('0x54')])?null:getMustacheRender(_0xfdc0ae['vidaooNote'],_0x5b1ad5),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x198d('0x53')](_0xfdc0ae['vidaooMetadata'])){var _0x2be653=getMustacheRender(_0xfdc0ae['vidaooMetadata'],_0x5b1ad5);var _0x2b140d=JSON[_0x198d('0x55')](_0x2be653);_0x81c310['body'][_0x198d('0x56')]=_0x2b140d;}}catch(_0x5ac897){throw new db[(_0x198d('0x57'))]['ValidationError'](_0x198d('0x58'));}return rp(_0x81c310);}else{throw new db['Sequelize'][(_0x198d('0x59'))](_0x198d('0x5a'));}})[_0x198d('0x18')](function(_0x3c2c24){_0x3ef57a=_0x3c2c24;if(_0x3ef57a['id']){var _0x2aa6f5={'body':_0x3ef57a['join_url'],'ChatWebsiteId':_0xfdc0ae['id'],'ChatInteractionId':_0x1d2a7a['id'],'direction':_0x198d('0x5b'),'UserId':_0x427347[_0x198d('0x38')]['id']};return db[_0x198d('0x5c')][_0x198d('0x44')](_0x2aa6f5,{});}else{throw new db[(_0x198d('0x57'))][(_0x198d('0x59'))](_0x198d('0x5d'));}})[_0x198d('0x18')](function(){return _0x1d2a7a[_0x198d('0x5e')]({'vidaooSessionId':_0x3ef57a['id']});})[_0x198d('0x18')](respondWithResult(_0x33fe7f,null))['catch'](handleError(_0x33fe7f,null));};exports[_0x198d('0x5f')]=function(_0x5c7d3f,_0x271a90){if(_0x5c7d3f[_0x198d('0x2f')]['id']){delete _0x5c7d3f[_0x198d('0x2f')]['id'];}return db[_0x198d('0x33')][_0x198d('0x43')]({'where':{'id':_0x5c7d3f[_0x198d('0x39')]['id']},'include':[{'model':db[_0x198d('0x60')],'as':'Contact'}]})[_0x198d('0x18')](handleEntityNotFound(_0x271a90,null))[_0x198d('0x18')](saveUpdates(_0x5c7d3f[_0x198d('0x2f')],null))[_0x198d('0x18')](respondWithResult(_0x271a90,null))[_0x198d('0x21')](handleError(_0x271a90,null));};exports[_0x198d('0x61')]=function(_0x1f54ea,_0x120a1a){if(_0x1f54ea['body']['id']){delete _0x1f54ea[_0x198d('0x2f')]['id'];}return db[_0x198d('0x33')][_0x198d('0x43')]({'where':{'id':_0x1f54ea[_0x198d('0x39')]['id']}})[_0x198d('0x18')](function(_0x34fff4){if(!_0x34fff4){logger[_0x198d('0x1d')](_0x198d('0x62'),'abandon',0x194,_0x198d('0x63'));_0x120a1a[_0x198d('0x22')](0x194);}else{if(_0x34fff4[_0x198d('0x64')]){throw new db[(_0x198d('0x57'))]['ValidationError'](_0x198d('0x65'));}}return _0x34fff4;})['then'](function(_0x80f4f4){if(_0x80f4f4){return _0x80f4f4['update']({'closed':_0x1f54ea[_0x198d('0x2f')][_0x198d('0x66')],'disposition':_0x1f54ea[_0x198d('0x2f')][_0x198d('0x67')]})[_0x198d('0x18')](function(_0x556b26){return _0x556b26;});}})[_0x198d('0x18')](function(){return respondWithRpcPromise(_0x198d('0x68'),_0x198d('0x61'),_0x1f54ea[_0x198d('0x2f')],client9004);})[_0x198d('0x18')](respondWithResult(_0x120a1a,null))[_0x198d('0x21')](handleError(_0x120a1a,null));};exports['attachmentUpload']=function(_0x1b6542,_0x3e0808){_0x1b6542[_0x198d('0x2f')][_0x198d('0x2c')]=_0x1b6542[_0x198d('0x69')][_0x198d('0x6a')];_0x1b6542[_0x198d('0x2f')][_0x198d('0x6b')]=_0x1b6542['file'][_0x198d('0x6c')];_0x1b6542['body'][_0x198d('0x6d')]=_0x1b6542['file'][_0x198d('0x6e')];return db[_0x198d('0x6f')]['create'](_0x1b6542['body'])[_0x198d('0x18')](respondWithResult(_0x3e0808,0xc9))[_0x198d('0x21')](handleError(_0x3e0808,null));};exports[_0x198d('0x70')]=function(_0xc3e7ad,_0xab5513){return db[_0x198d('0x33')][_0x198d('0x48')]({'where':{'id':_0xc3e7ad[_0x198d('0x39')]['id']},'raw':!![]})[_0x198d('0x18')](handleEntityNotFound(_0xab5513,null))[_0x198d('0x18')](function(_0x5bae7b){if(_0x5bae7b){if(_0x5bae7b[_0x198d('0x66')]){return _0xab5513[_0x198d('0x23')](0x193)[_0x198d('0x24')]({'status':0x193,'message':_0x198d('0x71')});}return db[_0x198d('0x6f')][_0x198d('0x48')]({'where':{'id':_0xc3e7ad[_0x198d('0x37')]['attachId']},'raw':!![]})[_0x198d('0x18')](handleEntityNotFound(_0xab5513,null));}})[_0x198d('0x18')](function(_0x5e1504){if(_0x5e1504){var _0x4a4462=_0x5e1504[_0x198d('0x72')]!==null;var _0x209c46=path[_0x198d('0x73')](config[_0x198d('0x74')],'server/files/attachments/');if(_0x4a4462){_0x209c46=path[_0x198d('0x73')](_0x209c46,'offline-chat/');}var _0x44479c=path[_0x198d('0x73')](_0x209c46,_0x5e1504[_0x198d('0x6b')]);return _0xab5513[_0x198d('0x75')](_0x44479c);}})[_0x198d('0x21')](handleError(_0xab5513,null));};exports[_0x198d('0x76')]=function(_0x400bc2,_0x5f2435){var _0x166ae1=null;var _0x495fa0=null;var _0x5cb25a=null;if(_0x400bc2[_0x198d('0x2f')]['id']){delete _0x400bc2[_0x198d('0x2f')]['id'];}if(_0x400bc2[_0x198d('0x2f')][_0x198d('0x77')]){_0x5cb25a=path[_0x198d('0x73')](config[_0x198d('0x74')],_0x198d('0x78'),util['format']('transcript-%s.txt',Date[_0x198d('0x79')]()));_0x400bc2[_0x198d('0x2f')][_0x198d('0x7a')]=_0x5cb25a;}return db[_0x198d('0x33')][_0x198d('0x43')]({'where':{'id':_0x400bc2[_0x198d('0x39')]['id']},'include':[{'model':db[_0x198d('0x5c')],'as':_0x198d('0x7b'),'include':[{'model':db[_0x198d('0x7c')],'as':_0x198d('0x7c')}]}]})[_0x198d('0x18')](handleEntityNotFound(_0x5f2435,null))[_0x198d('0x18')](saveUpdates(_0x400bc2[_0x198d('0x2f')],null))[_0x198d('0x18')](function(_0x4abba4){if(_0x4abba4){_0x166ae1=_0x4abba4;return db[_0x198d('0x47')][_0x198d('0x43')]({'where':{'id':_0x166ae1[_0x198d('0x7d')]}});}})[_0x198d('0x18')](function(_0x5a037a){if(_0x5a037a){_0x495fa0=_0x5a037a;return db['CmContact']['find']({'where':{'id':_0x166ae1[_0x198d('0x7e')]}});}})[_0x198d('0x18')](function(_0x457bb3){if(_0x457bb3){if(_0x5cb25a){var _0x2c20d3=null;for(var _0x574418=0x1;_0x574418<_0x166ae1[_0x198d('0x7b')][_0x198d('0x3f')];++_0x574418){_0x2c20d3=_0x166ae1[_0x198d('0x7b')][_0x574418];var _0x1d37f0=_0x2c20d3[_0x198d('0x64')]?util[_0x198d('0x7f')](_0x198d('0x80'),_0x495fa0[_0x198d('0x81')],_0x2c20d3[_0x198d('0x64')]):_0x198d('0x82');var _0xa9d871=_0x400bc2[_0x198d('0x2f')][_0x198d('0x83')]||util[_0x198d('0x7f')](_0x198d('0x80'),_0x198d('0x84'),_0x2c20d3[_0x198d('0x7e')]);switch(_0x495fa0[_0x198d('0x85')]){case _0x198d('0x86'):_0x1d37f0=_0x2c20d3[_0x198d('0x64')]?util['format'](_0x198d('0x80'),_0x495fa0[_0x198d('0x81')],_0x2c20d3[_0x198d('0x64')]):'System';break;case _0x198d('0x87'):_0x1d37f0=_0x2c20d3[_0x198d('0x64')]?_0x2c20d3[_0x198d('0x7c')][_0x198d('0x88')]||_0x2c20d3[_0x198d('0x7c')][_0x198d('0x4d')]:_0x198d('0x82');break;case'agent_fullname':_0x1d37f0=_0x2c20d3[_0x198d('0x64')]?_0x2c20d3[_0x198d('0x7c')][_0x198d('0x4d')]:_0x198d('0x82');break;default:_0x1d37f0=_0x2c20d3['UserId']?util[_0x198d('0x7f')](_0x198d('0x80'),_0x495fa0[_0x198d('0x81')],_0x2c20d3[_0x198d('0x64')]):'System';}var _0x592ef3=util[_0x198d('0x7f')](_0x198d('0x89'),moment(_0x2c20d3[_0x198d('0x8a')])[_0x198d('0x7f')](_0x198d('0x8b')),_0x2c20d3['direction']==='in'?_0xa9d871:_0x1d37f0,_0x2c20d3[_0x198d('0x2f')]);if(!_0x2c20d3[_0x198d('0x8c')]){fs['appendFileSync'](_0x5cb25a,_0x592ef3);}}return db['MailAccount'][_0x198d('0x48')]({'where':{'service':!![]},'include':[{'model':db[_0x198d('0x8d')],'as':_0x198d('0x8e'),'raw':!![],'include':[{'model':db[_0x198d('0x8f')],'as':_0x198d('0x8f'),'raw':!![]}]}]});}}})[_0x198d('0x18')](function(_0x110c93){if(!_0x110c93||!_0x110c93[_0x198d('0x8e')]||!_0x400bc2[_0x198d('0x2f')])return _0x166ae1;var _0x3b8a87=_0x110c93[_0x198d('0x90')]();return respondWithRpcPromise(_0x198d('0x91'),_0x198d('0x92'),{'account':_0x3b8a87,'message':{'from':util[_0x198d('0x7f')]('\x22%s\x22\x20<%s>',_0x110c93[_0x198d('0x2c')],_0x110c93[_0x198d('0x4e')]||_0x110c93[_0x198d('0x8e')][_0x198d('0x38')]),'to':_0x400bc2[_0x198d('0x2f')][_0x198d('0x77')],'subject':_0x198d('0x93'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x400bc2[_0x198d('0x2f')][_0x198d('0x77')]),'attachments':[{'path':_0x5cb25a}]}})['then'](function(){return _0x166ae1;})[_0x198d('0x21')](function(_0x4a9a68){logger['error'](_0x4a9a68);});})[_0x198d('0x18')](respondWithStatusCode(_0x5f2435,0xc8))[_0x198d('0x21')](handleError(_0x5f2435,null));};exports[_0x198d('0x94')]=function(_0x10dfc6,_0x1d127a){return db[_0x198d('0x5c')]['find']({'where':{'id':_0x10dfc6[_0x198d('0x39')]['id']}})[_0x198d('0x18')](handleEntityNotFound(_0x1d127a,null))[_0x198d('0x18')](function(_0x46dfb4){if(_0x46dfb4){return _0x46dfb4[_0x198d('0x94')](_0x10dfc6[_0x198d('0x2f')]['ids'],_[_0x198d('0x95')](_0x10dfc6[_0x198d('0x2f')],[_0x198d('0x96'),'id'])||{});}})[_0x198d('0x18')](respondWithResult(_0x1d127a,null))[_0x198d('0x21')](handleError(_0x1d127a,null));};exports[_0x198d('0x97')]=function(_0x3d6d0a,_0x59e554){var _0x3dacf8={'raw':![],'where':{}};var _0x14745d={};var _0x39533e={'count':0x0,'rows':[]};return db[_0x198d('0x33')][_0x198d('0x48')]({'where':{'id':_0x3d6d0a[_0x198d('0x39')]['id']}})[_0x198d('0x18')](handleEntityNotFound(_0x59e554,null))[_0x198d('0x18')](function(_0x412eee){if(_0x412eee){_0x14745d[_0x198d('0x3a')]=_[_0x198d('0x3b')](db['ChatMessage'][_0x198d('0x34')]);_0x14745d[_0x198d('0x37')]=_['keys'](_0x3d6d0a[_0x198d('0x37')]);_0x14745d[_0x198d('0x98')]=_[_0x198d('0x3c')](_0x14745d[_0x198d('0x3a')],_0x14745d[_0x198d('0x37')]);_0x3dacf8['attributes']=_[_0x198d('0x3c')](_0x14745d['model'],qs[_0x198d('0x3d')](_0x3d6d0a[_0x198d('0x37')][_0x198d('0x3d')]));_0x3dacf8[_0x198d('0x3e')]=_0x3dacf8[_0x198d('0x3e')][_0x198d('0x3f')]?_0x3dacf8[_0x198d('0x3e')]:_0x14745d[_0x198d('0x3a')];if(!_0x3d6d0a['query'][_0x198d('0x99')](_0x198d('0x9a'))){_0x3dacf8[_0x198d('0x26')]=qs[_0x198d('0x26')](_0x3d6d0a[_0x198d('0x37')][_0x198d('0x26')]);_0x3dacf8[_0x198d('0x25')]=qs[_0x198d('0x25')](_0x3d6d0a[_0x198d('0x37')][_0x198d('0x25')]);}_0x3dacf8[_0x198d('0x9b')]=qs[_0x198d('0x9c')](_0x3d6d0a[_0x198d('0x37')][_0x198d('0x9c')]);_0x3dacf8['where']=qs[_0x198d('0x98')](_['pick'](_0x3d6d0a[_0x198d('0x37')],_0x14745d['filters']));_0x3dacf8[_0x198d('0x9d')][_0x198d('0x9e')]=_0x412eee['id'];if(_0x3d6d0a[_0x198d('0x37')][_0x198d('0x9f')]){_0x3dacf8[_0x198d('0x9d')]=_['merge'](_0x3dacf8[_0x198d('0x9d')],{'$or':_['map'](_0x3dacf8[_0x198d('0x3e')],function(_0x4bf194){var _0x360538={};_0x360538[_0x4bf194]={'$like':'%'+_0x3d6d0a[_0x198d('0x37')]['filter']+'%'};return _0x360538;})});}if(_0x3d6d0a[_0x198d('0x37')]['$gte']){var _0x2e75f6=_0x3d6d0a[_0x198d('0x37')][_0x198d('0xa0')][_0x198d('0xa1')](',');var _0x378d87={};_0x378d87[_0x2e75f6[0x0]]={'$gte':moment(_0x2e75f6[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3dacf8[_0x198d('0x9d')]=_[_0x198d('0x2e')](_0x3dacf8[_0x198d('0x9d')],_0x378d87);}_0x3dacf8=_[_0x198d('0x2e')]({},_0x3dacf8,_0x3d6d0a[_0x198d('0x42')]);return db[_0x198d('0x5c')][_0x198d('0x27')]({'where':_0x3dacf8['where']})[_0x198d('0x18')](function(_0xe2468d){_0x39533e['count']=_0xe2468d;if(_0x3d6d0a['query']['includeAll']){_0x3dacf8[_0x198d('0x41')]=[{'all':!![]}];}return db[_0x198d('0x5c')]['findAll'](_0x3dacf8);})[_0x198d('0x18')](function(_0xa6f0ca){_0x39533e[_0x198d('0xa2')]=_0xa6f0ca;return _0x39533e;});}})[_0x198d('0x18')](respondWithFilteredResult(_0x59e554,_0x3dacf8))['catch'](handleError(_0x59e554,null));};exports[_0x198d('0xa3')]=function(_0x13ced1,_0x4613bc){var _0x5bd0b5={'where':{}},_0x47d1db={},_0x656c0={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x198d('0x48')]({'where':{'id':_0x13ced1[_0x198d('0x39')]['id']}})['then'](handleEntityNotFound(_0x4613bc,null))['then'](function(_0x3ae2be){if(_0x3ae2be){_0x47d1db[_0x198d('0x3a')]=_[_0x198d('0x3b')](db[_0x198d('0x5c')][_0x198d('0x34')]);_0x47d1db[_0x198d('0x37')]=_[_0x198d('0x3b')](_0x13ced1[_0x198d('0x37')]);_0x47d1db[_0x198d('0x98')]=_['intersection'](_0x47d1db[_0x198d('0x3a')],_0x47d1db[_0x198d('0x37')]);_0x5bd0b5[_0x198d('0x3e')]=_['intersection'](_0x47d1db[_0x198d('0x3a')],qs[_0x198d('0x3d')](_0x13ced1[_0x198d('0x37')][_0x198d('0x3d')]));_0x5bd0b5[_0x198d('0x3e')]=_0x5bd0b5[_0x198d('0x3e')]['length']?_0x5bd0b5[_0x198d('0x3e')]:_0x47d1db[_0x198d('0x3a')];if(!_0x13ced1[_0x198d('0x37')][_0x198d('0x99')]('nolimit')){_0x5bd0b5['limit']=qs[_0x198d('0x26')](_0x13ced1[_0x198d('0x37')]['limit']);_0x5bd0b5[_0x198d('0x25')]=qs[_0x198d('0x25')](_0x13ced1[_0x198d('0x37')][_0x198d('0x25')]);}_0x5bd0b5[_0x198d('0x9b')]=qs[_0x198d('0x9c')](_0x13ced1[_0x198d('0x37')]['sort']);_0x5bd0b5['where']=qs[_0x198d('0x98')](_[_0x198d('0xa4')](_0x13ced1[_0x198d('0x37')],_0x47d1db[_0x198d('0x98')]));_0x5bd0b5['where'][_0x198d('0x9e')]=_0x3ae2be['id'];if(_0x13ced1[_0x198d('0x37')][_0x198d('0x9f')]){_0x5bd0b5[_0x198d('0x9d')]=_['merge'](_0x5bd0b5[_0x198d('0x9d')],{'$or':_[_0x198d('0x32')](_0x5bd0b5['attributes'],function(_0x26b400){var _0x52d28e={};_0x52d28e[_0x26b400]={'$like':'%'+_0x13ced1[_0x198d('0x37')][_0x198d('0x9f')]+'%'};return _0x52d28e;})});}_0x5bd0b5['where']['secret']=![];if(_0x13ced1[_0x198d('0x37')]['id']){_0x5bd0b5[_0x198d('0x9d')]['id']={'$gt':_0x13ced1[_0x198d('0x37')]['id']};}_0x5bd0b5=_[_0x198d('0x2e')]({},_0x5bd0b5,_0x13ced1['options']);return db[_0x198d('0x5c')][_0x198d('0x27')]({'where':_0x5bd0b5[_0x198d('0x9d')]})[_0x198d('0x18')](function(_0x4cdbf7){_0x656c0[_0x198d('0x27')]=_0x4cdbf7;_0x5bd0b5[_0x198d('0x41')]=[];if(_0x13ced1['query']['includeAgent']){_0x5bd0b5[_0x198d('0x41')]['push']({'model':db[_0x198d('0x7c')],'as':'User','attributes':['id',_0x198d('0x4d'),_0x198d('0x88')]});}if(_0x13ced1[_0x198d('0x37')][_0x198d('0x40')]){_0x5bd0b5[_0x198d('0x41')]=[{'all':!![]}];}return db[_0x198d('0x5c')][_0x198d('0xa5')](_0x5bd0b5);})['then'](function(_0x554b4f){_0x656c0['rows']=_0x554b4f;return _0x656c0;});}})['then'](respondWithFilteredResult(_0x4613bc,_0x5bd0b5))[_0x198d('0x21')](handleError(_0x4613bc,null));};exports[_0x198d('0xa6')]=function(_0x527958,_0x2d04a8){return db[_0x198d('0x33')][_0x198d('0x43')]({'where':{'id':_0x527958[_0x198d('0x39')]['id']}})[_0x198d('0x18')](handleEntityNotFound(_0x2d04a8,null))[_0x198d('0x18')](function(_0x1b8e2d){if(_0x1b8e2d){return _0x1b8e2d[_0x198d('0xa7')](_0x527958[_0x198d('0x2f')]['ids'],_[_0x198d('0x95')](_0x527958[_0x198d('0x2f')],[_0x198d('0x96'),'id'])||{})[_0x198d('0xa8')](function(){return db['Tag'][_0x198d('0xa5')]({'attributes':['id',_0x198d('0x2c'),_0x198d('0xa9')],'where':{'id':_0x527958[_0x198d('0x2f')][_0x198d('0x96')]}});})[_0x198d('0x18')](function(_0x341795){socket['emit'](_0x198d('0xaa'),{'id':Number(_0x527958[_0x198d('0x39')]['id']),'tags':_0x341795||[]});return{'id':Number(_0x527958[_0x198d('0x39')]['id']),'tags':_0x341795||[]};});}})[_0x198d('0x18')](respondWithResult(_0x2d04a8,null))[_0x198d('0x21')](handleError(_0x2d04a8,null));};exports[_0x198d('0xab')]=function(_0x573d03,_0x29500b){return db[_0x198d('0x33')][_0x198d('0x43')]({'where':{'id':_0x573d03[_0x198d('0x39')]['id']}})[_0x198d('0x18')](handleEntityNotFound(_0x29500b,null))['then'](function(_0x4e8a4e){if(_0x4e8a4e){return _0x4e8a4e['removeTags'](_0x573d03['query'][_0x198d('0x96')]);}})[_0x198d('0x18')](respondWithStatusCode(_0x29500b,null))[_0x198d('0x21')](handleError(_0x29500b,null));};exports[_0x198d('0x75')]=function(_0x42f0a5,_0x32e65d){var _0x34a02b=moment()['unix']()['toString']();var _0x5a944e=path[_0x198d('0x73')](config['root'],_0x198d('0xac'),_0x198d('0xad'),_0x198d('0xae'));var _0x4855f2=path[_0x198d('0x73')](config[_0x198d('0x74')],_0x198d('0xac'),_0x198d('0xad'),_0x198d('0xaf'));var _0x26b92f=path[_0x198d('0x73')](_0x5a944e,_0x34a02b);var _0x2e8bf9=util[_0x198d('0x7f')](_0x198d('0xb0'),_0x42f0a5['params']['id'],_0x34a02b);var _0x5c6f1b=path[_0x198d('0x73')](_0x5a944e,_0x2e8bf9);var _0xe61a3f=[];_0xe61a3f[_0x198d('0xb1')]({'model':db[_0x198d('0x7c')],'as':_0x198d('0x7c'),'attributes':['id',_0x198d('0x4d')],'raw':!![]});_0xe61a3f[_0x198d('0xb1')]({'model':db[_0x198d('0x60')],'as':'Contact','attributes':['id',_0x198d('0xb2'),_0x198d('0xb3')],'raw':!![]});if(_0x42f0a5[_0x198d('0x37')][_0x198d('0xaf')]){_0xe61a3f[_0x198d('0xb1')]({'model':db['Attachment'],'as':_0x198d('0x6f'),'raw':!![]});}var _0x40811d=[{'model':db[_0x198d('0x5c')],'as':_0x198d('0x7b'),'attributes':['id','body','createdAt',_0x198d('0xb4'),_0x198d('0x8c'),_0x198d('0xb5')],'include':_0xe61a3f}];_0x40811d[_0x198d('0xb1')]({'model':db[_0x198d('0x47')],'as':_0x198d('0xb6'),'attributes':['id','name']});_0x40811d[_0x198d('0xb1')]({'model':db[_0x198d('0x7c')],'as':'Owner','attributes':['id',_0x198d('0x4d')]});return db[_0x198d('0x33')][_0x198d('0x43')]({'where':{'id':_0x42f0a5[_0x198d('0x39')]['id']},'include':_0x40811d})[_0x198d('0x18')](handleEntityNotFound(_0x32e65d,null))[_0x198d('0x18')](function(_0x254348){if(_0x254348){var _0x1687cb=_0x254348[_0x198d('0xb7')]({'plain':!![]});fs['mkdirSync'](_0x26b92f);var _0x1fdc74={'channel':_0x198d('0xb8'),'account':_0x1687cb[_0x198d('0xb6')][_0x198d('0x2c')],'agent':_0x1687cb['Owner']?_0x1687cb[_0x198d('0xb9')][_0x198d('0x4d')]:'N.A.','createdAt':moment(_0x1687cb['createdAt'])[_0x198d('0x7f')](_0x198d('0xba'))['toString'](),'closedAt':_0x1687cb[_0x198d('0x66')]?moment(_0x1687cb[_0x198d('0xbb')])[_0x198d('0x7f')](_0x198d('0xba'))[_0x198d('0xbc')]():'','disposition':_0x1687cb[_0x198d('0x67')],'chatInfo':{'browser':_0x1687cb[_0x198d('0xbd')],'os':_0x1687cb[_0x198d('0xbe')],'referer':_0x1687cb[_0x198d('0xbf')],'customerIp':_0x1687cb['customerIp'],'customerPort':_0x1687cb[_0x198d('0xc0')]?_0x1687cb[_0x198d('0xc0')]:_0x198d('0xc1')},'messages':_(_0x1687cb[_0x198d('0x7b')])[_0x198d('0xc2')]()[_0x198d('0x9f')]({'secret':![]})['map'](function(_0x81526f){if(_0x81526f['Attachment']){var _0x5c3728=path['join'](_0x4855f2,_0x81526f[_0x198d('0x6f')][_0x198d('0x6b')]);if(fs[_0x198d('0xc3')](_0x5c3728)){fs['createReadStream'](_0x5c3728)[_0x198d('0xc4')](fs['createWriteStream'](path[_0x198d('0x73')](_0x26b92f,_0x81526f[_0x198d('0x6f')][_0x198d('0x6b')])));}}return{'date':moment(_0x81526f[_0x198d('0x8a')])[_0x198d('0x7f')](_0x198d('0xba'))[_0x198d('0xbc')](),'sender':_0x81526f[_0x198d('0xb4')]===_0x198d('0x5b')?_0x81526f['User']?_0x81526f[_0x198d('0x7c')][_0x198d('0x4d')]:'System':_0x81526f['Contact']['firstName']+(_0x81526f[_0x198d('0xc5')]['lastName']?'\x20'+_0x81526f[_0x198d('0xc5')]['lastName']:''),'body':_0x81526f[_0x198d('0x6f')]?_0x81526f[_0x198d('0x6f')][_0x198d('0x6b')]:_0x81526f[_0x198d('0x2f')],'direction':_0x81526f[_0x198d('0xb4')]===_0x198d('0x5b')?'A':'C','secret':_0x81526f[_0x198d('0x8c')],'read':_0x81526f['read'],'attachment':_0x81526f[_0x198d('0x6f')]};})[_0x198d('0xc6')]()};return ejs[_0x198d('0xc7')](path['join'](config[_0x198d('0x74')],_0x198d('0xac'),_0x198d('0xc8'),'downloadInteraction.ejs'),{'interaction':_0x1fdc74})['then'](function(_0x20a048){var _0xadbc0b=path[_0x198d('0x73')](_0x26b92f,_0x198d('0xc9')+_0x1687cb['id']+'-'+_0x34a02b+_0x198d('0xca'));var _0x262a47={'path':_0xadbc0b,'channel':_0x198d('0xb8'),'interactionId':_0x1687cb['id']};return pdf[_0x198d('0xcb')](_0x20a048,_0x262a47);})[_0x198d('0x18')](function(){return new Promise(function(_0x2f1a97,_0x4ab7cc){zipdir(_0x26b92f,{'saveTo':_0x5c6f1b},function(_0x2cd0ab,_0x1ff145){if(_0x2cd0ab)return _0x4ab7cc(_0x2cd0ab);return _0x2f1a97(_0x1ff145);});})['then'](function(){return new BPromise(function(_0x1d573b,_0x5de48f){rimraf(_0x26b92f,function(_0x24cbe8){if(_0x24cbe8)_0x5de48f(_0x24cbe8);return _0x1d573b();});});})[_0x198d('0x18')](function(){return _0x32e65d[_0x198d('0x75')](_0x5c6f1b,_0x2e8bf9,function(_0x15dec3){if(_0x15dec3){logger[_0x198d('0x1d')](_0x198d('0xcc'),_0x15dec3);}else{fs[_0x198d('0xcd')](_0x5c6f1b);}});});});}else{return _0x32e65d[_0x198d('0x22')](0xc8);}})['catch'](handleError(_0x32e65d,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index cd6dc97..fba575d 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 _0xe79b=['../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x16743a,_0x34d3ad){var _0x5bf565=function(_0x299268){while(--_0x299268){_0x16743a['push'](_0x16743a['shift']());}};_0x5bf565(++_0x34d3ad);}(_0xe79b,0x10a));var _0xbe79=function(_0x1a87b3,_0x45ba68){_0x1a87b3=_0x1a87b3-0x0;var _0x37e84d=_0xe79b[_0x1a87b3];return _0x37e84d;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xbe79('0x0'))['db'][_0xbe79('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0xbe79('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xbe79('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbe79('0x4'),'afterDestroy':_0xbe79('0x5')};function emitEvent(_0x115547){return function(_0x46e3c8,_0x22172b,_0x5c6d0c){_0x46e3c8[_0xbe79('0x6')]({'attributes':['id'],'raw':!![]})[_0xbe79('0x7')](function(_0x5777e7){_0x46e3c8[_0xbe79('0x8')](_0xbe79('0x9'),_0x5777e7[_0xbe79('0xa')](function(_0xa68265){return{'id':_0xa68265['id']};}));return ChatMessage[_0xbe79('0xb')]({'where':{'ChatInteractionId':_0x46e3c8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1835e9){_0x46e3c8[_0xbe79('0x8')](_0xbe79('0xc'),_0x1835e9[_0xbe79('0xd')]);ChatInteractionEvents[_0xbe79('0xe')](_0x115547+':'+_0x46e3c8['id'],_0x46e3c8);ChatInteractionEvents[_0xbe79('0xe')](_0x115547,_0x46e3c8);_0x5c6d0c(null);})[_0xbe79('0xf')](_0x5c6d0c(null));};}for(var e in events){if(events[_0xbe79('0x10')](e)){var event=events[e];ChatInteraction[_0xbe79('0x11')](e,emitEvent(event));}}module[_0xbe79('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0xb21e=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','update','remove','getUsers','setDataValue','Users','map','findAll','then'];(function(_0x1bdc63,_0x24b3b0){var _0x4d15a5=function(_0x342013){while(--_0x342013){_0x1bdc63['push'](_0x1bdc63['shift']());}};_0x4d15a5(++_0x24b3b0);}(_0xb21e,0xd3));var _0xeb21=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xb21e[_0x4b7b62];return _0x2280df;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xeb21('0x0'))['db'][_0xeb21('0x1')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xeb21('0x2'),'afterDestroy':_0xeb21('0x3')};function emitEvent(_0x5c75b7){return function(_0x4af675,_0x551f23,_0x3caab0){_0x4af675[_0xeb21('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2f5795){_0x4af675[_0xeb21('0x5')](_0xeb21('0x6'),_0x2f5795[_0xeb21('0x7')](function(_0x36983f){return{'id':_0x36983f['id']};}));return ChatMessage[_0xeb21('0x8')]({'where':{'ChatInteractionId':_0x4af675['id'],'direction':'in','read':![]},'raw':!![]});})[_0xeb21('0x9')](function(_0x1b9be7){_0x4af675['setDataValue'](_0xeb21('0xa'),_0x1b9be7[_0xeb21('0xb')]);ChatInteractionEvents[_0xeb21('0xc')](_0x5c75b7+':'+_0x4af675['id'],_0x4af675);ChatInteractionEvents[_0xeb21('0xc')](_0x5c75b7,_0x4af675);_0x3caab0(null);})[_0xeb21('0xd')](_0x3caab0(null));};}for(var e in events){if(events[_0xeb21('0xe')](e)){var event=events[e];ChatInteraction[_0xeb21('0xf')](e,emitEvent(event));}}module[_0xeb21('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index a63dbe6..2a48293 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 _0x06ef=['define','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports'];(function(_0x528a6e,_0x15abad){var _0x2cf224=function(_0x2c4e14){while(--_0x2c4e14){_0x528a6e['push'](_0x528a6e['shift']());}};_0x2cf224(++_0x15abad);}(_0x06ef,0x1c9));var _0xf06e=function(_0x15d469,_0x533556){_0x15d469=_0x15d469-0x0;var _0x3dccfd=_0x06ef[_0x15d469];return _0x3dccfd;};'use strict';var _=require(_0xf06e('0x0'));var util=require(_0xf06e('0x1'));var logger=require(_0xf06e('0x2'))(_0xf06e('0x3'));var moment=require(_0xf06e('0x4'));var BPromise=require('bluebird');var rp=require(_0xf06e('0x5'));var fs=require('fs');var path=require(_0xf06e('0x6'));var rimraf=require(_0xf06e('0x7'));var config=require(_0xf06e('0x8'));var attributes=require(_0xf06e('0x9'));module[_0xf06e('0xa')]=function(_0x605c13,_0x275f9c){return _0x605c13[_0xf06e('0xb')](_0xf06e('0xc'),attributes,{'tableName':_0xf06e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x320266,_0x5873d4,_0x41ed9d){if(_0x320266[_0xf06e('0xe')](_0xf06e('0xf'))){_0x320266['closedAt']=moment()[_0xf06e('0x10')](_0xf06e('0x11'));}_0x41ed9d(null,_0x320266);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x893b=['api','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x42dbaa,_0x5e4227){var _0x1fd2ec=function(_0x56a8d7){while(--_0x56a8d7){_0x42dbaa['push'](_0x42dbaa['shift']());}};_0x1fd2ec(++_0x5e4227);}(_0x893b,0x76));var _0xb893=function(_0x2b55bb,_0x508372){_0x2b55bb=_0x2b55bb-0x0;var _0x1e3223=_0x893b[_0x2b55bb];return _0x1e3223;};'use strict';var _=require('lodash');var util=require(_0xb893('0x0'));var logger=require('../../config/logger')(_0xb893('0x1'));var moment=require('moment');var BPromise=require(_0xb893('0x2'));var rp=require(_0xb893('0x3'));var fs=require('fs');var path=require(_0xb893('0x4'));var rimraf=require('rimraf');var config=require(_0xb893('0x5'));var attributes=require(_0xb893('0x6'));module[_0xb893('0x7')]=function(_0x1a220d,_0x4ff286){return _0x1a220d['define'](_0xb893('0x8'),attributes,{'tableName':_0xb893('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x892e36,_0x73f59c,_0x48a13a){if(_0x892e36[_0xb893('0xa')](_0xb893('0xb'))){_0x892e36[_0xb893('0xc')]=moment()[_0xb893('0xd')](_0xb893('0xe'));}_0x48a13a(null,_0x892e36);}},'charset':_0xb893('0xf'),'collate':_0xb893('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index c21ba16..3f5975a 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 _0xa831=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToChatInteraction','find','addTags','ids','omit','AddTags','lodash'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0xa831,0x18b));var _0x1a83=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xa831[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0x1a83('0x0'));var util=require('util');var moment=require(_0x1a83('0x1'));var BPromise=require(_0x1a83('0x2'));var rs=require(_0x1a83('0x3'));var fs=require('fs');var Redis=require(_0x1a83('0x4'));var db=require(_0x1a83('0x5'))['db'];var utils=require(_0x1a83('0x6'));var logger=require(_0x1a83('0x7'))('rpc');var config=require(_0x1a83('0x8'));var jayson=require(_0x1a83('0x9'));var client=jayson[_0x1a83('0xa')]['http']({'port':0x232a});config['redis']=_[_0x1a83('0xb')](config[_0x1a83('0xc')],{'host':_0x1a83('0xd'),'port':0x18eb});var socket=require(_0x1a83('0xe'))(new Redis(config[_0x1a83('0xc')]));require(_0x1a83('0xf'))[_0x1a83('0x10')](socket);function respondWithRpcPromise(_0x3b7d34,_0xebb3f4,_0x47ecf7){return new BPromise(function(_0x20e5a8,_0x5ebfd0){return client['request'](_0x3b7d34,_0x47ecf7)[_0x1a83('0x11')](function(_0x5a5233){logger[_0x1a83('0x12')](_0x1a83('0x13'),_0xebb3f4,'request\x20sent');logger[_0x1a83('0x14')](_0x1a83('0x15'),_0xebb3f4,_0x1a83('0x16'),JSON['stringify'](_0x5a5233));if(_0x5a5233[_0x1a83('0x17')]){if(_0x5a5233[_0x1a83('0x17')][_0x1a83('0x18')]===0x1f4){logger['error'](_0x1a83('0x13'),_0xebb3f4,_0x5a5233[_0x1a83('0x17')][_0x1a83('0x19')]);return _0x5ebfd0(_0x5a5233[_0x1a83('0x17')]['message']);}logger[_0x1a83('0x17')](_0x1a83('0x13'),_0xebb3f4,_0x5a5233[_0x1a83('0x17')][_0x1a83('0x19')]);return _0x20e5a8(_0x5a5233['error']['message']);}else{logger[_0x1a83('0x12')](_0x1a83('0x13'),_0xebb3f4,'request\x20sent');_0x20e5a8(_0x5a5233[_0x1a83('0x1a')]['message']);}})[_0x1a83('0x1b')](function(_0x290e1f){logger['error'](_0x1a83('0x13'),_0xebb3f4,_0x290e1f);_0x5ebfd0(_0x290e1f);});});}exports[_0x1a83('0x1c')]=function(_0x4e41ea){var _0x29f29c=this;return new Promise(function(_0x432433,_0x3e7ca8){return db[_0x1a83('0x1d')][_0x1a83('0x1e')](_0x4e41ea[_0x1a83('0x1f')],{'raw':_0x4e41ea['options']?_0x4e41ea[_0x1a83('0x20')][_0x1a83('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e41ea[_0x1a83('0x20')]?_0x4e41ea['options'][_0x1a83('0x22')]||null:null,'attributes':_0x4e41ea[_0x1a83('0x20')]?_0x4e41ea['options'][_0x1a83('0x23')]||null:null,'limit':_0x4e41ea[_0x1a83('0x20')]?_0x4e41ea['options'][_0x1a83('0x24')]||null:null})[_0x1a83('0x11')](function(_0x12cd43){logger['info'](_0x1a83('0x1c'),_0x4e41ea);logger['debug'](_0x1a83('0x1c'),_0x4e41ea,JSON[_0x1a83('0x25')](_0x12cd43));_0x432433(_0x12cd43);})[_0x1a83('0x1b')](function(_0x2f5d94){logger[_0x1a83('0x17')](_0x1a83('0x1c'),_0x2f5d94[_0x1a83('0x19')],_0x4e41ea);_0x3e7ca8(_0x29f29c[_0x1a83('0x17')](0x1f4,_0x2f5d94[_0x1a83('0x19')]));});});};exports[_0x1a83('0x26')]=function(_0x67058c){return new Promise(function(_0x48234b,_0x22b80c){return db['ChatInteraction'][_0x1a83('0x27')]({'where':_0x67058c['options']?_0x67058c[_0x1a83('0x20')][_0x1a83('0x22')]||null:null})[_0x1a83('0x11')](function(_0x461275){if(_0x461275){return _0x461275[_0x1a83('0x28')](_0x67058c[_0x1a83('0x1f')][_0x1a83('0x29')],_[_0x1a83('0x2a')](_0x67058c[_0x1a83('0x1f')],[_0x1a83('0x29'),'id'])||{});}})['spread'](function(_0x2cbbea){logger['info'](_0x1a83('0x2b'),_0x67058c);logger['debug'](_0x1a83('0x2b'),_0x67058c,JSON[_0x1a83('0x25')](_0x2cbbea));_0x48234b(_0x2cbbea);})[_0x1a83('0x1b')](function(_0x1c0d8d){logger['error'](_0x1a83('0x2b'),_0x1c0d8d[_0x1a83('0x19')],_0x67058c);_0x22b80c(_this[_0x1a83('0x17')](0x1f4,_0x1c0d8d[_0x1a83('0x19')]));});});}; \ No newline at end of file +var _0x5e8c=['then','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ChatInteraction','body','options','where','limit','UpdateChatInteraction','stringify','find','addTags','omit','ids','spread','AddTags','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','register'];(function(_0x5f0738,_0x2f431a){var _0x35737f=function(_0x42129f){while(--_0x42129f){_0x5f0738['push'](_0x5f0738['shift']());}};_0x35737f(++_0x2f431a);}(_0x5e8c,0xe0));var _0xc5e8=function(_0xe032f8,_0x30c69e){_0xe032f8=_0xe032f8-0x0;var _0x412b79=_0x5e8c[_0xe032f8];return _0x412b79;};'use strict';var _=require(_0xc5e8('0x0'));var util=require(_0xc5e8('0x1'));var moment=require(_0xc5e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5e8('0x3'));var db=require(_0xc5e8('0x4'))['db'];var utils=require(_0xc5e8('0x5'));var logger=require(_0xc5e8('0x6'))('rpc');var config=require(_0xc5e8('0x7'));var jayson=require(_0xc5e8('0x8'));var client=jayson[_0xc5e8('0x9')][_0xc5e8('0xa')]({'port':0x232a});config[_0xc5e8('0xb')]=_[_0xc5e8('0xc')](config[_0xc5e8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc5e8('0xd'))(new Redis(config[_0xc5e8('0xb')]));require(_0xc5e8('0xe'))[_0xc5e8('0xf')](socket);function respondWithRpcPromise(_0x432dc1,_0x334eaa,_0x2b0c03){return new BPromise(function(_0x27c2b7,_0x330983){return client['request'](_0x432dc1,_0x2b0c03)[_0xc5e8('0x10')](function(_0x560f91){logger[_0xc5e8('0x11')](_0xc5e8('0x12'),_0x334eaa,'request\x20sent');logger['debug'](_0xc5e8('0x13'),_0x334eaa,_0xc5e8('0x14'),JSON['stringify'](_0x560f91));if(_0x560f91[_0xc5e8('0x15')]){if(_0x560f91[_0xc5e8('0x15')][_0xc5e8('0x16')]===0x1f4){logger['error'](_0xc5e8('0x12'),_0x334eaa,_0x560f91['error'][_0xc5e8('0x17')]);return _0x330983(_0x560f91['error']['message']);}logger[_0xc5e8('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x334eaa,_0x560f91['error'][_0xc5e8('0x17')]);return _0x27c2b7(_0x560f91['error'][_0xc5e8('0x17')]);}else{logger[_0xc5e8('0x11')](_0xc5e8('0x12'),_0x334eaa,'request\x20sent');_0x27c2b7(_0x560f91[_0xc5e8('0x18')][_0xc5e8('0x17')]);}})[_0xc5e8('0x19')](function(_0x5b1f7c){logger[_0xc5e8('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x334eaa,_0x5b1f7c);_0x330983(_0x5b1f7c);});});}exports['UpdateChatInteraction']=function(_0x3cb3c6){var _0x5a6791=this;return new Promise(function(_0x48d7c1,_0x142e6a){return db[_0xc5e8('0x1a')]['update'](_0x3cb3c6[_0xc5e8('0x1b')],{'raw':_0x3cb3c6[_0xc5e8('0x1c')]?_0x3cb3c6[_0xc5e8('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cb3c6[_0xc5e8('0x1c')]?_0x3cb3c6[_0xc5e8('0x1c')][_0xc5e8('0x1d')]||null:null,'attributes':_0x3cb3c6['options']?_0x3cb3c6[_0xc5e8('0x1c')]['attributes']||null:null,'limit':_0x3cb3c6[_0xc5e8('0x1c')]?_0x3cb3c6[_0xc5e8('0x1c')][_0xc5e8('0x1e')]||null:null})[_0xc5e8('0x10')](function(_0x593c60){logger[_0xc5e8('0x11')](_0xc5e8('0x1f'),_0x3cb3c6);logger['debug']('UpdateChatInteraction',_0x3cb3c6,JSON[_0xc5e8('0x20')](_0x593c60));_0x48d7c1(_0x593c60);})[_0xc5e8('0x19')](function(_0x34907f){logger[_0xc5e8('0x15')]('UpdateChatInteraction',_0x34907f['message'],_0x3cb3c6);_0x142e6a(_0x5a6791[_0xc5e8('0x15')](0x1f4,_0x34907f['message']));});});};exports['AddTagsToChatInteraction']=function(_0x532013){return new Promise(function(_0x7801c3,_0x2d9af6){return db[_0xc5e8('0x1a')][_0xc5e8('0x21')]({'where':_0x532013['options']?_0x532013['options'][_0xc5e8('0x1d')]||null:null})['then'](function(_0xd1e0c7){if(_0xd1e0c7){return _0xd1e0c7[_0xc5e8('0x22')](_0x532013[_0xc5e8('0x1b')]['ids'],_[_0xc5e8('0x23')](_0x532013[_0xc5e8('0x1b')],[_0xc5e8('0x24'),'id'])||{});}})[_0xc5e8('0x25')](function(_0x5b1e8b){logger['info'](_0xc5e8('0x26'),_0x532013);logger[_0xc5e8('0x27')](_0xc5e8('0x26'),_0x532013,JSON[_0xc5e8('0x20')](_0x5b1e8b));_0x7801c3(_0x5b1e8b);})[_0xc5e8('0x19')](function(_0x2cb393){logger[_0xc5e8('0x15')](_0xc5e8('0x26'),_0x2cb393[_0xc5e8('0x17')],_0x532013);_0x2d9af6(_this[_0xc5e8('0x15')](0x1f4,_0x2cb393[_0xc5e8('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 2597eb8..4fe0af8 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 _0x4634=['removeListener','register','length','save','remove','update','emit'];(function(_0x205a12,_0x5d1d07){var _0x2ae9cc=function(_0x3b2e01){while(--_0x3b2e01){_0x205a12['push'](_0x205a12['shift']());}};_0x2ae9cc(++_0x5d1d07);}(_0x4634,0xe3));var _0x4463=function(_0x584981,_0x879ae2){_0x584981=_0x584981-0x0;var _0x5c9992=_0x4634[_0x584981];return _0x5c9992;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x4463('0x0'),_0x4463('0x1'),_0x4463('0x2')];function createListener(_0xed2d17,_0x2458b1){return function(_0x3252a4){_0x2458b1[_0x4463('0x3')](_0xed2d17,_0x3252a4);};}function removeListener(_0x4ad792,_0x18ff63){return function(){ChatInteractionEvents[_0x4463('0x4')](_0x4ad792,_0x18ff63);};}exports[_0x4463('0x5')]=function(_0x4b7dc3){for(var _0x449d81=0x0,_0x18f97a=events[_0x4463('0x6')];_0x449d81<_0x18f97a;_0x449d81++){var _0x22a9ae=events[_0x449d81];var _0x235705=createListener('chatInteraction:'+_0x22a9ae,_0x4b7dc3);ChatInteractionEvents['on'](_0x22a9ae,_0x235705);}}; \ No newline at end of file +var _0x9acd=['save','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x441d10,_0x50971e){var _0x23680a=function(_0x3d6ba3){while(--_0x3d6ba3){_0x441d10['push'](_0x441d10['shift']());}};_0x23680a(++_0x50971e);}(_0x9acd,0x76));var _0xd9ac=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x9acd[_0xc6be3a];return _0x56a310;};'use strict';var ChatInteractionEvents=require(_0xd9ac('0x0'));var events=[_0xd9ac('0x1'),'remove','update'];function createListener(_0x1ddf3f,_0x5c9e84){return function(_0x566442){_0x5c9e84[_0xd9ac('0x2')](_0x1ddf3f,_0x566442);};}function removeListener(_0x1c0cd3,_0x4c9b08){return function(){ChatInteractionEvents[_0xd9ac('0x3')](_0x1c0cd3,_0x4c9b08);};}exports[_0xd9ac('0x4')]=function(_0x340104){for(var _0x3fec24=0x0,_0x295a7c=events[_0xd9ac('0x5')];_0x3fec24<_0x295a7c;_0x3fec24++){var _0x346a54=events[_0x3fec24];var _0x2f4d8b=createListener(_0xd9ac('0x6')+_0x346a54,_0x340104);ChatInteractionEvents['on'](_0x346a54,_0x2f4d8b);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 831bb25..1f0f78a 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 _0xfcc9=['delete','destroy','removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','originalname','single','file','attachmentUpload','addMessage','/:id/tags','addTags','put','tracked','chat','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','close'];(function(_0x3246a6,_0x2a685a){var _0x1df64d=function(_0x4868ad){while(--_0x4868ad){_0x3246a6['push'](_0x3246a6['shift']());}};_0x1df64d(++_0x2a685a);}(_0xfcc9,0x161));var _0x9fcc=function(_0x2d126e,_0x1e8257){_0x2d126e=_0x2d126e-0x0;var _0xcb04d3=_0xfcc9[_0x2d126e];return _0xcb04d3;};'use strict';var multer=require(_0x9fcc('0x0'));var util=require(_0x9fcc('0x1'));var path=require(_0x9fcc('0x2'));var timeout=require(_0x9fcc('0x3'));var express=require('express');var router=express[_0x9fcc('0x4')]();var fs_extra=require(_0x9fcc('0x5'));var auth=require(_0x9fcc('0x6'));var interaction=require(_0x9fcc('0x7'));var config=require('../../config/environment');var controller=require(_0x9fcc('0x8'));router[_0x9fcc('0x9')]('/',auth[_0x9fcc('0xa')](),controller[_0x9fcc('0xb')]);router[_0x9fcc('0x9')](_0x9fcc('0xc'),auth[_0x9fcc('0xa')](),controller['describe']);router[_0x9fcc('0x9')](_0x9fcc('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x9fcc('0xe')]);router[_0x9fcc('0x9')](_0x9fcc('0xf'),auth[_0x9fcc('0x10')](),controller['attachmentDownload']);router[_0x9fcc('0x9')](_0x9fcc('0x11'),auth[_0x9fcc('0xa')](),controller[_0x9fcc('0x12')]);router[_0x9fcc('0x9')](_0x9fcc('0x13'),auth[_0x9fcc('0x10')](),controller[_0x9fcc('0x14')]);router[_0x9fcc('0x9')](_0x9fcc('0x15'),auth[_0x9fcc('0xa')](),controller[_0x9fcc('0x16')]);router['post']('/',auth[_0x9fcc('0xa')](),controller[_0x9fcc('0x17')]);router[_0x9fcc('0x18')](_0x9fcc('0x19'),auth['isAuthenticated'](),controller[_0x9fcc('0x1a')]);var upload=multer({'storage':multer[_0x9fcc('0x1b')]({'destination':function(_0x845f5a,_0x1f7191,_0x901c64){_0x901c64(null,path[_0x9fcc('0x1c')](config[_0x9fcc('0x1d')],_0x9fcc('0x1e')));},'filename':function(_0x9b9ddf,_0x41ffa1,_0x45bba5){_0x45bba5(null,util['format']('%s-%s',Date['now'](),_0x41ffa1[_0x9fcc('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x9fcc('0x20')](_0x9fcc('0x21')),controller[_0x9fcc('0x22')]);router['post'](_0x9fcc('0x11'),auth[_0x9fcc('0x10')](),controller[_0x9fcc('0x23')]);router[_0x9fcc('0x18')](_0x9fcc('0x24'),auth[_0x9fcc('0xa')](),interaction['tracked']('chat','chatinteraction:addtags'),controller[_0x9fcc('0x25')]);router[_0x9fcc('0x26')](_0x9fcc('0xd'),auth[_0x9fcc('0xa')](),interaction[_0x9fcc('0x27')](_0x9fcc('0x28'),'chatinteraction:update'),controller[_0x9fcc('0x29')]);router['put'](_0x9fcc('0x2a'),controller[_0x9fcc('0x2b')]);router['put'](_0x9fcc('0x2c'),auth['isChatInteractionAuthorized'](),controller[_0x9fcc('0x2d')]);router['put']('/:id/close',controller[_0x9fcc('0x2e')]);router[_0x9fcc('0x2f')]('/:id',auth[_0x9fcc('0xa')](),interaction[_0x9fcc('0x27')]('chat','chatinteraction:destroy'),controller[_0x9fcc('0x30')]);router[_0x9fcc('0x2f')](_0x9fcc('0x24'),auth[_0x9fcc('0xa')](),controller[_0x9fcc('0x31')]);module['exports']=router; \ No newline at end of file +var _0x6fc7=['/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','root','server/files/attachments/','now','originalname','single','file','attachmentUpload','addMessage','/:id/tags','chat','addTags','update','customUpdate','put','/:id/abandon','abandon','/:id/close','close','delete','tracked','chatinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe'];(function(_0x21ed88,_0x574daa){var _0x133e35=function(_0x407dc4){while(--_0x407dc4){_0x21ed88['push'](_0x21ed88['shift']());}};_0x133e35(++_0x574daa);}(_0x6fc7,0x8d));var _0x76fc=function(_0x451e42,_0x2d71ea){_0x451e42=_0x451e42-0x0;var _0x484342=_0x6fc7[_0x451e42];return _0x484342;};'use strict';var multer=require('multer');var util=require(_0x76fc('0x0'));var path=require(_0x76fc('0x1'));var timeout=require(_0x76fc('0x2'));var express=require('express');var router=express[_0x76fc('0x3')]();var fs_extra=require(_0x76fc('0x4'));var auth=require(_0x76fc('0x5'));var interaction=require(_0x76fc('0x6'));var config=require(_0x76fc('0x7'));var controller=require(_0x76fc('0x8'));router[_0x76fc('0x9')]('/',auth[_0x76fc('0xa')](),controller['index']);router[_0x76fc('0x9')](_0x76fc('0xb'),auth[_0x76fc('0xa')](),controller['describe']);router[_0x76fc('0x9')](_0x76fc('0xc'),auth['isChatInteractionAuthorized'](),controller[_0x76fc('0xd')]);router[_0x76fc('0x9')](_0x76fc('0xe'),auth[_0x76fc('0xf')](),controller[_0x76fc('0x10')]);router['get'](_0x76fc('0x11'),auth[_0x76fc('0xa')](),controller[_0x76fc('0x12')]);router[_0x76fc('0x9')](_0x76fc('0x13'),auth['isChatInteractionAuthorized'](),controller[_0x76fc('0x14')]);router[_0x76fc('0x9')](_0x76fc('0x15'),auth['isAuthenticated'](),controller[_0x76fc('0x16')]);router[_0x76fc('0x17')]('/',auth[_0x76fc('0xa')](),controller[_0x76fc('0x18')]);router[_0x76fc('0x17')](_0x76fc('0x19'),auth[_0x76fc('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x76fc('0x1a')]({'destination':function(_0x23f7e4,_0x421dfc,_0x35f4d3){_0x35f4d3(null,path['join'](config[_0x76fc('0x1b')],_0x76fc('0x1c')));},'filename':function(_0x333e25,_0x2b467e,_0x43f743){_0x43f743(null,util['format']('%s-%s',Date[_0x76fc('0x1d')](),_0x2b467e[_0x76fc('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x76fc('0x17')]('/:id/attachment_upload',upload[_0x76fc('0x1f')](_0x76fc('0x20')),controller[_0x76fc('0x21')]);router[_0x76fc('0x17')](_0x76fc('0x11'),auth[_0x76fc('0xf')](),controller[_0x76fc('0x22')]);router[_0x76fc('0x17')](_0x76fc('0x23'),auth[_0x76fc('0xa')](),interaction['tracked'](_0x76fc('0x24'),'chatinteraction:addtags'),controller[_0x76fc('0x25')]);router['put'](_0x76fc('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0x76fc('0x24'),'chatinteraction:update'),controller[_0x76fc('0x26')]);router['put']('/:id/custom_update',controller[_0x76fc('0x27')]);router[_0x76fc('0x28')](_0x76fc('0x29'),auth[_0x76fc('0xf')](),controller[_0x76fc('0x2a')]);router['put'](_0x76fc('0x2b'),controller[_0x76fc('0x2c')]);router[_0x76fc('0x2d')](_0x76fc('0xc'),auth[_0x76fc('0xa')](),interaction[_0x76fc('0x2e')](_0x76fc('0x24'),_0x76fc('0x2f')),controller[_0x76fc('0x30')]);router[_0x76fc('0x2d')]('/:id/tags',auth[_0x76fc('0xa')](),controller[_0x76fc('0x31')]);module[_0x76fc('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 250bc62..2ccfa07 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 _0xeb15=['TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x4369ef,_0x33cde3){var _0xf9dac4=function(_0x3f9af1){while(--_0x3f9af1){_0x4369ef['push'](_0x4369ef['shift']());}};_0xf9dac4(++_0x33cde3);}(_0xeb15,0x10d));var _0x5eb1=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0xeb15[_0x31b5a5];return _0x364cc9;};'use strict';var Sequelize=require(_0x5eb1('0x0'));module['exports']={'body':{'type':Sequelize[_0x5eb1('0x1')](_0x5eb1('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5eb1('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5eb1('0x4')]}}; \ No newline at end of file +var _0x5453=['medium','BOOLEAN','INTEGER','exports','TEXT'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x5453,0x1a2));var _0x3545=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5453[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x3545('0x0')]={'body':{'type':Sequelize[_0x3545('0x1')](_0x3545('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3545('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x3545('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index d972fbb..237e934 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 _0xe363=['userProfileId','UserProfileResource','isEmpty','agent','resourceId','push','ToId','read','-createdAt','eml-format','rimraf','zip-dir','mustache','path','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','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','catch','options','create','body','params','describe','messages','createdAt','lastMessage','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','User','findAll','admin','user','fullname','userpic','internal','online','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Agents'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe363,0x1bd));var _0x3e36=function(_0x25d87d,_0xad468c){_0x25d87d=_0x25d87d-0x0;var _0x54e42b=_0xe363[_0x25d87d];return _0x54e42b;};'use strict';var emlformat=require(_0x3e36('0x0'));var rimraf=require(_0x3e36('0x1'));var zipdir=require(_0x3e36('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3e36('0x3'));var util=require('util');var path=require(_0x3e36('0x4'));var sox=require('sox');var csv=require(_0x3e36('0x5'));var ejs=require(_0x3e36('0x6'));var fs=require('fs');var fs_extra=require(_0x3e36('0x7'));var _=require(_0x3e36('0x8'));var squel=require(_0x3e36('0x9'));var crypto=require(_0x3e36('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3e36('0xb'));var Papa=require(_0x3e36('0xc'));var Redis=require(_0x3e36('0xd'));var authService=require(_0x3e36('0xe'));var qs=require(_0x3e36('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e36('0x10'));var logger=require(_0x3e36('0x11'))(_0x3e36('0x12'));var utils=require(_0x3e36('0x13'));var config=require(_0x3e36('0x14'));var licenseUtil=require(_0x3e36('0x15'));var db=require(_0x3e36('0x16'))['db'];config[_0x3e36('0x17')]=_[_0x3e36('0x18')](config[_0x3e36('0x17')],{'host':_0x3e36('0x19'),'port':0x18eb});var socket=require(_0x3e36('0x1a'))(new Redis(config[_0x3e36('0x17')]));require('./chatInternalMessage.socket')[_0x3e36('0x1b')](socket);function respondWithStatusCode(_0x5c4afe,_0x5f8ae2){_0x5f8ae2=_0x5f8ae2||0xcc;return function(_0x2f5a4e){if(_0x2f5a4e){return _0x5c4afe['sendStatus'](_0x5f8ae2);}return _0x5c4afe[_0x3e36('0x1c')](_0x5f8ae2)[_0x3e36('0x1d')]();};}function respondWithResult(_0x41654f,_0xc6970){_0xc6970=_0xc6970||0xc8;return function(_0xcda193){if(_0xcda193){return _0x41654f['status'](_0xc6970)['json'](_0xcda193);}};}function respondWithFilteredResult(_0x16b9ee,_0x3a059f){return function(_0x49c422){if(_0x49c422){var _0x5bef23=typeof _0x3a059f[_0x3e36('0x1e')]===_0x3e36('0x1f')&&typeof _0x3a059f['limit']===_0x3e36('0x1f');var _0xedf502=_0x49c422[_0x3e36('0x20')];var _0x12f0d7=_0x5bef23?0x0:_0x3a059f[_0x3e36('0x1e')];var _0x11895c=_0x5bef23?_0x49c422['count']:_0x3a059f['offset']+_0x3a059f[_0x3e36('0x21')];var _0xa23342;if(_0x11895c>=_0xedf502){_0x11895c=_0xedf502;_0xa23342=0xc8;}else{_0xa23342=0xce;}_0x16b9ee[_0x3e36('0x1c')](_0xa23342);return _0x16b9ee['set'](_0x3e36('0x22'),_0x12f0d7+'-'+_0x11895c+'/'+_0xedf502)[_0x3e36('0x23')](_0x49c422);}return null;};}function patchUpdates(_0x43386e){return function(_0x180831){try{jsonpatch[_0x3e36('0x24')](_0x180831,_0x43386e,!![]);}catch(_0x296c33){return BPromise[_0x3e36('0x25')](_0x296c33);}return _0x180831[_0x3e36('0x26')]();};}function saveUpdates(_0x2b5e90,_0xe2cbf8){return function(_0x4ff7d6){if(_0x4ff7d6){return _0x4ff7d6[_0x3e36('0x27')](_0x2b5e90)[_0x3e36('0x28')](function(_0x3df290){return _0x3df290;});}return null;};}function removeEntity(_0x2474a7,_0x3a3b79){return function(_0x5a8b62){if(_0x5a8b62){return _0x5a8b62[_0x3e36('0x29')]()[_0x3e36('0x28')](function(){_0x2474a7[_0x3e36('0x1c')](0xcc)[_0x3e36('0x1d')]();});}};}function handleEntityNotFound(_0x250f6e,_0x500a85){return function(_0xe37eaf){if(!_0xe37eaf){_0x250f6e[_0x3e36('0x2a')](0x194);}return _0xe37eaf;};}function handleError(_0x12a802,_0x146852){_0x146852=_0x146852||0x1f4;return function(_0x4aa750){logger[_0x3e36('0x2b')](_0x4aa750[_0x3e36('0x2c')]);if(_0x4aa750[_0x3e36('0x2d')]){delete _0x4aa750[_0x3e36('0x2d')];}_0x12a802[_0x3e36('0x1c')](_0x146852)[_0x3e36('0x2e')](_0x4aa750);};}exports[_0x3e36('0x2f')]=function(_0x3733a9,_0x384a22){var _0x54826d={},_0x23c644={},_0x1ed197={'count':0x0,'rows':[]};var _0x1d18d5=_[_0x3e36('0x30')](db[_0x3e36('0x31')][_0x3e36('0x32')],function(_0x49963b){return{'name':_0x49963b[_0x3e36('0x33')],'type':_0x49963b[_0x3e36('0x34')]['key']};});_0x23c644[_0x3e36('0x35')]=_[_0x3e36('0x30')](_0x1d18d5,_0x3e36('0x2d'));_0x23c644[_0x3e36('0x36')]=_[_0x3e36('0x37')](_0x3733a9[_0x3e36('0x36')]);_0x23c644[_0x3e36('0x38')]=_['intersection'](_0x23c644[_0x3e36('0x35')],_0x23c644[_0x3e36('0x36')]);_0x54826d[_0x3e36('0x39')]=_[_0x3e36('0x3a')](_0x23c644[_0x3e36('0x35')],qs[_0x3e36('0x3b')](_0x3733a9[_0x3e36('0x36')][_0x3e36('0x3b')]));_0x54826d[_0x3e36('0x39')]=_0x54826d['attributes'][_0x3e36('0x3c')]?_0x54826d[_0x3e36('0x39')]:_0x23c644['model'];if(!_0x3733a9[_0x3e36('0x36')][_0x3e36('0x3d')](_0x3e36('0x3e'))){_0x54826d[_0x3e36('0x21')]=qs[_0x3e36('0x21')](_0x3733a9[_0x3e36('0x36')]['limit']);_0x54826d[_0x3e36('0x1e')]=qs[_0x3e36('0x1e')](_0x3733a9['query'][_0x3e36('0x1e')]);}_0x54826d[_0x3e36('0x3f')]=qs[_0x3e36('0x40')](_0x3733a9[_0x3e36('0x36')]['sort']);_0x54826d[_0x3e36('0x41')]=qs[_0x3e36('0x38')](_['pick'](_0x3733a9[_0x3e36('0x36')],_0x23c644[_0x3e36('0x38')]),_0x1d18d5);if(_0x3733a9[_0x3e36('0x36')][_0x3e36('0x42')]){_0x54826d[_0x3e36('0x41')]=_[_0x3e36('0x43')](_0x54826d['where'],{'$or':_['map'](_0x1d18d5,function(_0x4ae395){if(_0x4ae395[_0x3e36('0x34')]!==_0x3e36('0x44')){var _0x1432b5={};_0x1432b5[_0x4ae395[_0x3e36('0x2d')]]={'$like':'%'+_0x3733a9[_0x3e36('0x36')][_0x3e36('0x42')]+'%'};return _0x1432b5;}})});}_0x54826d=_['merge']({},_0x54826d,_0x3733a9['options']);var _0x227af1={'where':_0x54826d[_0x3e36('0x41')]};return db['ChatInternalMessage']['count'](_0x227af1)[_0x3e36('0x28')](function(_0x2119f4){_0x1ed197[_0x3e36('0x20')]=_0x2119f4;if(_0x3733a9[_0x3e36('0x36')]['includeAll']){_0x54826d[_0x3e36('0x45')]=[{'all':!![]}];}return db[_0x3e36('0x31')]['findAll'](_0x54826d);})[_0x3e36('0x28')](function(_0x91e414){_0x1ed197['rows']=_0x91e414;return _0x1ed197;})[_0x3e36('0x28')](respondWithFilteredResult(_0x384a22,_0x54826d))[_0x3e36('0x46')](handleError(_0x384a22,null));};exports['show']=function(_0x428231,_0x258310){var _0x2147ba={'raw':!![],'where':{'id':_0x428231['params']['id']}},_0x2152ca={};_0x2152ca[_0x3e36('0x35')]=_[_0x3e36('0x37')](db[_0x3e36('0x31')]['rawAttributes']);_0x2152ca['query']=_[_0x3e36('0x37')](_0x428231[_0x3e36('0x36')]);_0x2152ca[_0x3e36('0x38')]=_[_0x3e36('0x3a')](_0x2152ca['model'],_0x2152ca[_0x3e36('0x36')]);_0x2147ba[_0x3e36('0x39')]=_[_0x3e36('0x3a')](_0x2152ca['model'],qs['fields'](_0x428231[_0x3e36('0x36')]['fields']));_0x2147ba[_0x3e36('0x39')]=_0x2147ba['attributes']['length']?_0x2147ba[_0x3e36('0x39')]:_0x2152ca[_0x3e36('0x35')];if(_0x428231[_0x3e36('0x36')]['includeAll']){_0x2147ba['include']=[{'all':!![]}];}_0x2147ba=_[_0x3e36('0x43')]({},_0x2147ba,_0x428231[_0x3e36('0x47')]);return db[_0x3e36('0x31')]['find'](_0x2147ba)['then'](handleEntityNotFound(_0x258310,null))['then'](respondWithResult(_0x258310,null))[_0x3e36('0x46')](handleError(_0x258310,null));};exports['create']=function(_0x421076,_0x51f5f3){return db['ChatInternalMessage'][_0x3e36('0x48')](_0x421076[_0x3e36('0x49')],{})[_0x3e36('0x28')](respondWithResult(_0x51f5f3,0xc9))[_0x3e36('0x46')](handleError(_0x51f5f3,null));};exports[_0x3e36('0x27')]=function(_0x2f8846,_0x2352de){if(_0x2f8846[_0x3e36('0x49')]['id']){delete _0x2f8846[_0x3e36('0x49')]['id'];}return db[_0x3e36('0x31')]['find']({'where':{'id':_0x2f8846[_0x3e36('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2352de,null))[_0x3e36('0x28')](saveUpdates(_0x2f8846[_0x3e36('0x49')],null))[_0x3e36('0x28')](respondWithResult(_0x2352de,null))[_0x3e36('0x46')](handleError(_0x2352de,null));};exports[_0x3e36('0x29')]=function(_0x5667b9,_0x3b3e13){return db[_0x3e36('0x31')]['find']({'where':{'id':_0x5667b9[_0x3e36('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b3e13,null))[_0x3e36('0x28')](removeEntity(_0x3b3e13,null))[_0x3e36('0x46')](handleError(_0x3b3e13,null));};exports[_0x3e36('0x4b')]=function(_0x338e9d,_0x5693aa){return db[_0x3e36('0x31')][_0x3e36('0x4b')]()[_0x3e36('0x28')](respondWithResult(_0x5693aa,null))[_0x3e36('0x46')](handleError(_0x5693aa,null));};function wrapUser(_0x3a5898){return function(_0x5cbcd3){var _0xa8a425=_0x3a5898['get']({'plain':!![]});_0xa8a425[_0x3e36('0x4c')]=[];if(_0x5cbcd3){_0xa8a425['lastMessageAt']=_0x5cbcd3[_0x3e36('0x4d')];_0xa8a425[_0x3e36('0x4e')]=_0x5cbcd3;}else{_0xa8a425[_0x3e36('0x4f')]=moment(0x0)['format'](_0x3e36('0x50'));_0xa8a425['lastMessage']={};}return _0xa8a425;};}exports['getUsers']=function(_0x5a6697,_0x4553cf,_0x5aefdb){var _0x2ad2a8=[];return db[_0x3e36('0x51')][_0x3e36('0x52')]({'where':{'role':['agent',_0x3e36('0x53'),_0x3e36('0x54')]},'attributes':['id',_0x3e36('0x55'),_0x3e36('0x2d'),'role',_0x3e36('0x56'),_0x3e36('0x57'),_0x3e36('0x58'),_0x3e36('0x59'),'allowmessenger',_0x3e36('0x5a')],'order':qs['sort'](_0x3e36('0x5b')),'include':[{'model':db[_0x3e36('0x5c')],'as':_0x3e36('0x5d'),'attributes':['id',_0x3e36('0x2d'),'type'],'through':{'attributes':[]}}]})['then'](function(_0x41222d){if(_0x41222d){var _0x289e78=_0x5a6697[_0x3e36('0x54')][_0x3e36('0x5e')]({'plain':!![]});if(!_0x289e78)throw new Error(_0x3e36('0x5f'));if(_0x289e78[_0x3e36('0x60')]==='user'){return db[_0x3e36('0x61')][_0x3e36('0x62')]({'where':{'name':_0x3e36('0x63'),'userProfileId':_0x289e78[_0x3e36('0x64')]},'raw':!![]})[_0x3e36('0x28')](function(_0x2ea843){if(_0x2ea843){if(_0x2ea843['autoAssociation']===0x0){return db[_0x3e36('0x65')][_0x3e36('0x52')]({'where':{'sectionId':_0x2ea843['id']},'raw':!![]})['then'](function(_0x294c85){var _0x4108a9=[];if(_[_0x3e36('0x66')](_0x294c85)){_0x4108a9=_[_0x3e36('0x42')](_0x41222d,function(_0x49eeb4){if(_0x49eeb4[_0x3e36('0x60')]!==_0x3e36('0x67')){return _0x49eeb4;}});return _0x4108a9;}else{for(var _0x439ad3=0x0;_0x439ad3<_0x41222d['length'];_0x439ad3++){var _0x51b5e3=_0x41222d[_0x439ad3];if(_0x51b5e3['role']==='agent'){var _0x197287=_['find'](_0x294c85,function(_0x258036){return _0x258036[_0x3e36('0x68')]===_0x51b5e3['id'];});if(_0x197287)_0x4108a9[_0x3e36('0x69')](_0x51b5e3);}else{_0x4108a9[_0x3e36('0x69')](_0x51b5e3);}}return _0x4108a9;}});}else{return _0x41222d;}}else{var _0x5a54e1=_[_0x3e36('0x42')](_0x41222d,function(_0x3818a6){if(_0x3818a6[_0x3e36('0x60')]!==_0x3e36('0x67')){return _0x3818a6;}});return _0x5a54e1;}});}else{return _0x41222d;}}})[_0x3e36('0x28')](function(_0x1c4cfd){var _0x40d61c=[];if(_0x1c4cfd){_0x2ad2a8=_0x1c4cfd;for(var _0x309d64=0x0;_0x309d64<_0x1c4cfd[_0x3e36('0x3c')];_0x309d64+=0x1){_0x2ad2a8[_0x309d64][_0x3e36('0x4c')]=[];_0x40d61c['push'](db['ChatInternalMessage'][_0x3e36('0x62')]({'where':{'FromId':[_0x5a6697['user']['id'],_0x1c4cfd[_0x309d64]['id']],'ToId':[_0x5a6697[_0x3e36('0x54')]['id'],_0x1c4cfd[_0x309d64]['id']],'ChatGroupId':null},'attributes':['id',_0x3e36('0x4d'),'FromId',_0x3e36('0x6a'),_0x3e36('0x6b'),_0x3e36('0x49')],'order':qs[_0x3e36('0x40')](_0x3e36('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x3e36('0x28')](wrapUser(_0x1c4cfd[_0x309d64])));}return BPromise['all'](_0x40d61c);}return[];})[_0x3e36('0x28')](function(_0x3256ea){return{'rows':_0x3256ea,'count':_0x3256ea[_0x3e36('0x3c')]};})[_0x3e36('0x28')](respondWithResult(_0x4553cf,null))[_0x3e36('0x46')](handleError(_0x4553cf,null));}; \ No newline at end of file +var _0x636a=['allowmessenger','-online','VoiceQueue','VoiceQueues','role','UserProfileSection','autoAssociation','UserProfileResource','findAll','isEmpty','length','resourceId','push','FromId','ToId','read','all','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/environment','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','map','ChatInternalMessage','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','agent','admin','user','fullname','userpic','internal','online','lastLoginAt'];(function(_0x45738b,_0x1d7363){var _0x3a91c5=function(_0x1a54e7){while(--_0x1a54e7){_0x45738b['push'](_0x45738b['shift']());}};_0x3a91c5(++_0x1d7363);}(_0x636a,0x15b));var _0xa636=function(_0xf1f37e,_0x159a20){_0xf1f37e=_0xf1f37e-0x0;var _0x2e3a6d=_0x636a[_0xf1f37e];return _0x2e3a6d;};'use strict';var emlformat=require(_0xa636('0x0'));var rimraf=require(_0xa636('0x1'));var zipdir=require(_0xa636('0x2'));var jsonpatch=require(_0xa636('0x3'));var rp=require(_0xa636('0x4'));var moment=require(_0xa636('0x5'));var BPromise=require(_0xa636('0x6'));var Mustache=require(_0xa636('0x7'));var util=require(_0xa636('0x8'));var path=require(_0xa636('0x9'));var sox=require(_0xa636('0xa'));var csv=require(_0xa636('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa636('0xc'));var _=require('lodash');var squel=require(_0xa636('0xd'));var crypto=require(_0xa636('0xe'));var jsforce=require(_0xa636('0xf'));var deskjs=require(_0xa636('0x10'));var toCsv=require(_0xa636('0xb'));var querystring=require(_0xa636('0x11'));var Papa=require(_0xa636('0x12'));var Redis=require(_0xa636('0x13'));var authService=require(_0xa636('0x14'));var qs=require(_0xa636('0x15'));var as=require(_0xa636('0x16'));var hardwareService=require(_0xa636('0x17'));var logger=require(_0xa636('0x18'))(_0xa636('0x19'));var utils=require('../../config/utils');var config=require(_0xa636('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa636('0x1b')]=_['defaults'](config[_0xa636('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xa636('0x1c'))(new Redis(config[_0xa636('0x1b')]));require(_0xa636('0x1d'))[_0xa636('0x1e')](socket);function respondWithStatusCode(_0x408377,_0x1643dc){_0x1643dc=_0x1643dc||0xcc;return function(_0x1f271b){if(_0x1f271b){return _0x408377[_0xa636('0x1f')](_0x1643dc);}return _0x408377[_0xa636('0x20')](_0x1643dc)['end']();};}function respondWithResult(_0x2a049a,_0x178d3d){_0x178d3d=_0x178d3d||0xc8;return function(_0x568433){if(_0x568433){return _0x2a049a[_0xa636('0x20')](_0x178d3d)[_0xa636('0x21')](_0x568433);}};}function respondWithFilteredResult(_0x5182e7,_0xe9c546){return function(_0x1b6cdc){if(_0x1b6cdc){var _0x1efa7f=typeof _0xe9c546[_0xa636('0x22')]===_0xa636('0x23')&&typeof _0xe9c546['limit']===_0xa636('0x23');var _0x2a7fcc=_0x1b6cdc[_0xa636('0x24')];var _0x8f0787=_0x1efa7f?0x0:_0xe9c546['offset'];var _0x2f398d=_0x1efa7f?_0x1b6cdc['count']:_0xe9c546[_0xa636('0x22')]+_0xe9c546[_0xa636('0x25')];var _0x3f0172;if(_0x2f398d>=_0x2a7fcc){_0x2f398d=_0x2a7fcc;_0x3f0172=0xc8;}else{_0x3f0172=0xce;}_0x5182e7[_0xa636('0x20')](_0x3f0172);return _0x5182e7['set'](_0xa636('0x26'),_0x8f0787+'-'+_0x2f398d+'/'+_0x2a7fcc)[_0xa636('0x21')](_0x1b6cdc);}return null;};}function patchUpdates(_0x4660b7){return function(_0x4150ba){try{jsonpatch[_0xa636('0x27')](_0x4150ba,_0x4660b7,!![]);}catch(_0x67b903){return BPromise[_0xa636('0x28')](_0x67b903);}return _0x4150ba['save']();};}function saveUpdates(_0x3d2294,_0x7c9884){return function(_0x41f97b){if(_0x41f97b){return _0x41f97b[_0xa636('0x29')](_0x3d2294)[_0xa636('0x2a')](function(_0xf9ecd5){return _0xf9ecd5;});}return null;};}function removeEntity(_0x4fd857,_0x5d0894){return function(_0x300112){if(_0x300112){return _0x300112[_0xa636('0x2b')]()[_0xa636('0x2a')](function(){_0x4fd857[_0xa636('0x20')](0xcc)[_0xa636('0x2c')]();});}};}function handleEntityNotFound(_0xfb7ec4,_0x5dab3d){return function(_0x5d0021){if(!_0x5d0021){_0xfb7ec4[_0xa636('0x1f')](0x194);}return _0x5d0021;};}function handleError(_0x101ef3,_0x5420c9){_0x5420c9=_0x5420c9||0x1f4;return function(_0x454530){logger['error'](_0x454530[_0xa636('0x2d')]);if(_0x454530[_0xa636('0x2e')]){delete _0x454530[_0xa636('0x2e')];}_0x101ef3[_0xa636('0x20')](_0x5420c9)[_0xa636('0x2f')](_0x454530);};}exports['index']=function(_0x2af7f0,_0x8c1510){var _0x4c85d5={},_0x265d1a={},_0x1ebda0={'count':0x0,'rows':[]};var _0x3a41c9=_[_0xa636('0x30')](db[_0xa636('0x31')]['rawAttributes'],function(_0x16aa13){return{'name':_0x16aa13[_0xa636('0x32')],'type':_0x16aa13[_0xa636('0x33')][_0xa636('0x34')]};});_0x265d1a[_0xa636('0x35')]=_['map'](_0x3a41c9,_0xa636('0x2e'));_0x265d1a[_0xa636('0x36')]=_['keys'](_0x2af7f0[_0xa636('0x36')]);_0x265d1a['filters']=_[_0xa636('0x37')](_0x265d1a[_0xa636('0x35')],_0x265d1a[_0xa636('0x36')]);_0x4c85d5[_0xa636('0x38')]=_[_0xa636('0x37')](_0x265d1a[_0xa636('0x35')],qs['fields'](_0x2af7f0[_0xa636('0x36')][_0xa636('0x39')]));_0x4c85d5['attributes']=_0x4c85d5[_0xa636('0x38')]['length']?_0x4c85d5[_0xa636('0x38')]:_0x265d1a[_0xa636('0x35')];if(!_0x2af7f0['query'][_0xa636('0x3a')]('nolimit')){_0x4c85d5[_0xa636('0x25')]=qs[_0xa636('0x25')](_0x2af7f0[_0xa636('0x36')]['limit']);_0x4c85d5[_0xa636('0x22')]=qs[_0xa636('0x22')](_0x2af7f0[_0xa636('0x36')][_0xa636('0x22')]);}_0x4c85d5['order']=qs[_0xa636('0x3b')](_0x2af7f0[_0xa636('0x36')][_0xa636('0x3b')]);_0x4c85d5[_0xa636('0x3c')]=qs[_0xa636('0x3d')](_[_0xa636('0x3e')](_0x2af7f0[_0xa636('0x36')],_0x265d1a[_0xa636('0x3d')]),_0x3a41c9);if(_0x2af7f0[_0xa636('0x36')][_0xa636('0x3f')]){_0x4c85d5['where']=_[_0xa636('0x40')](_0x4c85d5[_0xa636('0x3c')],{'$or':_[_0xa636('0x30')](_0x3a41c9,function(_0x2102e2){if(_0x2102e2[_0xa636('0x33')]!==_0xa636('0x41')){var _0x495bbd={};_0x495bbd[_0x2102e2[_0xa636('0x2e')]]={'$like':'%'+_0x2af7f0[_0xa636('0x36')][_0xa636('0x3f')]+'%'};return _0x495bbd;}})});}_0x4c85d5=_[_0xa636('0x40')]({},_0x4c85d5,_0x2af7f0[_0xa636('0x42')]);var _0x2fad65={'where':_0x4c85d5[_0xa636('0x3c')]};return db[_0xa636('0x31')]['count'](_0x2fad65)[_0xa636('0x2a')](function(_0x3b8d27){_0x1ebda0[_0xa636('0x24')]=_0x3b8d27;if(_0x2af7f0[_0xa636('0x36')][_0xa636('0x43')]){_0x4c85d5[_0xa636('0x44')]=[{'all':!![]}];}return db[_0xa636('0x31')]['findAll'](_0x4c85d5);})[_0xa636('0x2a')](function(_0x517c1d){_0x1ebda0[_0xa636('0x45')]=_0x517c1d;return _0x1ebda0;})[_0xa636('0x2a')](respondWithFilteredResult(_0x8c1510,_0x4c85d5))[_0xa636('0x46')](handleError(_0x8c1510,null));};exports[_0xa636('0x47')]=function(_0xaac959,_0x26b659){var _0x55f1a8={'raw':!![],'where':{'id':_0xaac959[_0xa636('0x48')]['id']}},_0x1ef7e0={};_0x1ef7e0[_0xa636('0x35')]=_['keys'](db[_0xa636('0x31')][_0xa636('0x49')]);_0x1ef7e0[_0xa636('0x36')]=_['keys'](_0xaac959[_0xa636('0x36')]);_0x1ef7e0[_0xa636('0x3d')]=_[_0xa636('0x37')](_0x1ef7e0['model'],_0x1ef7e0[_0xa636('0x36')]);_0x55f1a8[_0xa636('0x38')]=_[_0xa636('0x37')](_0x1ef7e0[_0xa636('0x35')],qs[_0xa636('0x39')](_0xaac959[_0xa636('0x36')]['fields']));_0x55f1a8[_0xa636('0x38')]=_0x55f1a8[_0xa636('0x38')]['length']?_0x55f1a8[_0xa636('0x38')]:_0x1ef7e0[_0xa636('0x35')];if(_0xaac959[_0xa636('0x36')][_0xa636('0x43')]){_0x55f1a8['include']=[{'all':!![]}];}_0x55f1a8=_[_0xa636('0x40')]({},_0x55f1a8,_0xaac959[_0xa636('0x42')]);return db['ChatInternalMessage'][_0xa636('0x4a')](_0x55f1a8)[_0xa636('0x2a')](handleEntityNotFound(_0x26b659,null))[_0xa636('0x2a')](respondWithResult(_0x26b659,null))['catch'](handleError(_0x26b659,null));};exports[_0xa636('0x4b')]=function(_0xf6c38b,_0x2db202){return db[_0xa636('0x31')][_0xa636('0x4b')](_0xf6c38b[_0xa636('0x4c')],{})[_0xa636('0x2a')](respondWithResult(_0x2db202,0xc9))[_0xa636('0x46')](handleError(_0x2db202,null));};exports[_0xa636('0x29')]=function(_0xa70622,_0x355fbd){if(_0xa70622[_0xa636('0x4c')]['id']){delete _0xa70622[_0xa636('0x4c')]['id'];}return db[_0xa636('0x31')][_0xa636('0x4a')]({'where':{'id':_0xa70622[_0xa636('0x48')]['id']}})['then'](handleEntityNotFound(_0x355fbd,null))[_0xa636('0x2a')](saveUpdates(_0xa70622[_0xa636('0x4c')],null))[_0xa636('0x2a')](respondWithResult(_0x355fbd,null))[_0xa636('0x46')](handleError(_0x355fbd,null));};exports[_0xa636('0x2b')]=function(_0x16f5c8,_0x17c5d0){return db[_0xa636('0x31')][_0xa636('0x4a')]({'where':{'id':_0x16f5c8['params']['id']}})['then'](handleEntityNotFound(_0x17c5d0,null))[_0xa636('0x2a')](removeEntity(_0x17c5d0,null))['catch'](handleError(_0x17c5d0,null));};exports[_0xa636('0x4d')]=function(_0x96a429,_0x282414){return db[_0xa636('0x31')][_0xa636('0x4d')]()[_0xa636('0x2a')](respondWithResult(_0x282414,null))[_0xa636('0x46')](handleError(_0x282414,null));};function wrapUser(_0x491fa0){return function(_0x25c3ef){var _0x598fd6=_0x491fa0[_0xa636('0x4e')]({'plain':!![]});_0x598fd6[_0xa636('0x4f')]=[];if(_0x25c3ef){_0x598fd6[_0xa636('0x50')]=_0x25c3ef[_0xa636('0x51')];_0x598fd6[_0xa636('0x52')]=_0x25c3ef;}else{_0x598fd6[_0xa636('0x50')]=moment(0x0)[_0xa636('0x53')](_0xa636('0x54'));_0x598fd6[_0xa636('0x52')]={};}return _0x598fd6;};}exports['getUsers']=function(_0x1f88b1,_0x33012b,_0x541f12){var _0x2b1177=[];return db['User']['findAll']({'where':{'role':[_0xa636('0x55'),_0xa636('0x56'),_0xa636('0x57')]},'attributes':['id',_0xa636('0x58'),_0xa636('0x2e'),'role',_0xa636('0x59'),_0xa636('0x5a'),_0xa636('0x5b'),_0xa636('0x5c'),_0xa636('0x5d'),'showWebBar'],'order':qs[_0xa636('0x3b')](_0xa636('0x5e')),'include':[{'model':db[_0xa636('0x5f')],'as':_0xa636('0x60'),'attributes':['id','name',_0xa636('0x33')],'through':{'attributes':[]}}]})[_0xa636('0x2a')](function(_0xacac1a){if(_0xacac1a){var _0x3a0577=_0x1f88b1[_0xa636('0x57')][_0xa636('0x4e')]({'plain':!![]});if(!_0x3a0577)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a0577[_0xa636('0x61')]===_0xa636('0x57')){return db[_0xa636('0x62')][_0xa636('0x4a')]({'where':{'name':'Agents','userProfileId':_0x3a0577['userProfileId']},'raw':!![]})[_0xa636('0x2a')](function(_0x711f73){if(_0x711f73){if(_0x711f73[_0xa636('0x63')]===0x0){return db[_0xa636('0x64')][_0xa636('0x65')]({'where':{'sectionId':_0x711f73['id']},'raw':!![]})[_0xa636('0x2a')](function(_0x55fb0b){var _0x2a9bec=[];if(_[_0xa636('0x66')](_0x55fb0b)){_0x2a9bec=_['filter'](_0xacac1a,function(_0x3d5a71){if(_0x3d5a71[_0xa636('0x61')]!==_0xa636('0x55')){return _0x3d5a71;}});return _0x2a9bec;}else{for(var _0x38fa75=0x0;_0x38fa75<_0xacac1a[_0xa636('0x67')];_0x38fa75++){var _0xb83328=_0xacac1a[_0x38fa75];if(_0xb83328['role']===_0xa636('0x55')){var _0x4e851d=_['find'](_0x55fb0b,function(_0x1232d1){return _0x1232d1[_0xa636('0x68')]===_0xb83328['id'];});if(_0x4e851d)_0x2a9bec[_0xa636('0x69')](_0xb83328);}else{_0x2a9bec[_0xa636('0x69')](_0xb83328);}}return _0x2a9bec;}});}else{return _0xacac1a;}}else{var _0x22cffc=_[_0xa636('0x3f')](_0xacac1a,function(_0x28b730){if(_0x28b730['role']!=='agent'){return _0x28b730;}});return _0x22cffc;}});}else{return _0xacac1a;}}})['then'](function(_0xb9d50d){var _0x10ebce=[];if(_0xb9d50d){_0x2b1177=_0xb9d50d;for(var _0xd4a4d0=0x0;_0xd4a4d0<_0xb9d50d[_0xa636('0x67')];_0xd4a4d0+=0x1){_0x2b1177[_0xd4a4d0]['messages']=[];_0x10ebce[_0xa636('0x69')](db[_0xa636('0x31')][_0xa636('0x4a')]({'where':{'FromId':[_0x1f88b1[_0xa636('0x57')]['id'],_0xb9d50d[_0xd4a4d0]['id']],'ToId':[_0x1f88b1[_0xa636('0x57')]['id'],_0xb9d50d[_0xd4a4d0]['id']],'ChatGroupId':null},'attributes':['id',_0xa636('0x51'),_0xa636('0x6a'),_0xa636('0x6b'),_0xa636('0x6c'),_0xa636('0x4c')],'order':qs[_0xa636('0x3b')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xa636('0x2a')](wrapUser(_0xb9d50d[_0xd4a4d0])));}return BPromise[_0xa636('0x6d')](_0x10ebce);}return[];})[_0xa636('0x2a')](function(_0x3ec371){return{'rows':_0x3ec371,'count':_0x3ec371['length']};})[_0xa636('0x2a')](respondWithResult(_0x33012b,null))['catch'](handleError(_0x33012b,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index b9103f2..a630031 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 _0x4200=['hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit'];(function(_0x152449,_0x49f41d){var _0x5b58b2=function(_0x226c30){while(--_0x226c30){_0x152449['push'](_0x152449['shift']());}};_0x5b58b2(++_0x49f41d);}(_0x4200,0x188));var _0x0420=function(_0x225536,_0x315c28){_0x225536=_0x225536-0x0;var _0x4c39e5=_0x4200[_0x225536];return _0x4c39e5;};'use strict';var EventEmitter=require(_0x0420('0x0'));var ChatInternalMessage=require(_0x0420('0x1'))['db'][_0x0420('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x0420('0x3')](0x0);var events={'afterCreate':_0x0420('0x4'),'afterUpdate':_0x0420('0x5'),'afterDestroy':_0x0420('0x6')};function emitEvent(_0x3ab500){return function(_0x370bf7,_0x58c1d4,_0x3142a3){ChatInternalMessageEvents[_0x0420('0x7')](_0x3ab500+':'+_0x370bf7['id'],_0x370bf7);ChatInternalMessageEvents[_0x0420('0x7')](_0x3ab500,_0x370bf7);_0x3142a3(null);};}for(var e in events){if(events[_0x0420('0x8')](e)){var event=events[e];ChatInternalMessage[_0x0420('0x9')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x8e65=['update','remove','emit','hasOwnProperty','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x24e473,_0x3fdd50){var _0x3a3b78=function(_0x5d1f54){while(--_0x5d1f54){_0x24e473['push'](_0x24e473['shift']());}};_0x3a3b78(++_0x3fdd50);}(_0x8e65,0x1ac));var _0x58e6=function(_0x3df4aa,_0x1d5dcf){_0x3df4aa=_0x3df4aa-0x0;var _0x30ca47=_0x8e65[_0x3df4aa];return _0x30ca47;};'use strict';var EventEmitter=require(_0x58e6('0x0'));var ChatInternalMessage=require(_0x58e6('0x1'))['db'][_0x58e6('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x58e6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x58e6('0x4'),'afterDestroy':_0x58e6('0x5')};function emitEvent(_0x3efd67){return function(_0x2f73be,_0x6475f2,_0x536be3){ChatInternalMessageEvents[_0x58e6('0x6')](_0x3efd67+':'+_0x2f73be['id'],_0x2f73be);ChatInternalMessageEvents[_0x58e6('0x6')](_0x3efd67,_0x2f73be);_0x536be3(null);};}for(var e in events){if(events[_0x58e6('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](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 460ca13..b030528 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 _0x7903=['exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0x7903,0x148));var _0x3790=function(_0x3fbfc4,_0x244e54){_0x3fbfc4=_0x3fbfc4-0x0;var _0x469cb9=_0x7903[_0x3fbfc4];return _0x469cb9;};'use strict';var _=require(_0x3790('0x0'));var util=require(_0x3790('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3790('0x2'));var BPromise=require(_0x3790('0x3'));var rp=require(_0x3790('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3790('0x5'));var config=require(_0x3790('0x6'));var attributes=require(_0x3790('0x7'));module[_0x3790('0x8')]=function(_0xd129fb,_0x253ae9){return _0xd129fb[_0x3790('0x9')](_0x3790('0xa'),attributes,{'tableName':_0x3790('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3790('0xc'),'collate':_0x3790('0xd')});}; \ No newline at end of file +var _0xf1a2=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x576119,_0x282fbe){var _0x540253=function(_0x24b26a){while(--_0x24b26a){_0x576119['push'](_0x576119['shift']());}};_0x540253(++_0x282fbe);}(_0xf1a2,0xc2));var _0x2f1a=function(_0x605fb9,_0x45062c){_0x605fb9=_0x605fb9-0x0;var _0x21040e=_0xf1a2[_0x605fb9];return _0x21040e;};'use strict';var _=require(_0x2f1a('0x0'));var util=require(_0x2f1a('0x1'));var logger=require('../../config/logger')(_0x2f1a('0x2'));var moment=require(_0x2f1a('0x3'));var BPromise=require(_0x2f1a('0x4'));var rp=require(_0x2f1a('0x5'));var fs=require('fs');var path=require(_0x2f1a('0x6'));var rimraf=require(_0x2f1a('0x7'));var config=require(_0x2f1a('0x8'));var attributes=require(_0x2f1a('0x9'));module[_0x2f1a('0xa')]=function(_0x148018,_0x3970cb){return _0x148018['define'](_0x2f1a('0xb'),attributes,{'tableName':_0x2f1a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2f1a('0xd'),'collate':_0x2f1a('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 728018a..1f91730 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 _0xd5bf=['register','then','info','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter'];(function(_0x25689f,_0x37a6fb){var _0x364094=function(_0x29b5d8){while(--_0x29b5d8){_0x25689f['push'](_0x25689f['shift']());}};_0x364094(++_0x37a6fb);}(_0xd5bf,0x66));var _0xfd5b=function(_0x5b338a,_0x254f6f){_0x5b338a=_0x5b338a-0x0;var _0x5b23f8=_0xd5bf[_0x5b338a];return _0x5b23f8;};'use strict';var _=require(_0xfd5b('0x0'));var util=require(_0xfd5b('0x1'));var moment=require(_0xfd5b('0x2'));var BPromise=require(_0xfd5b('0x3'));var rs=require(_0xfd5b('0x4'));var fs=require('fs');var Redis=require(_0xfd5b('0x5'));var db=require(_0xfd5b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfd5b('0x7'));var config=require(_0xfd5b('0x8'));var jayson=require(_0xfd5b('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xfd5b('0xa')]=_[_0xfd5b('0xb')](config[_0xfd5b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xfd5b('0xc'))(new Redis(config[_0xfd5b('0xa')]));require('./chatInternalMessage.socket')[_0xfd5b('0xd')](socket);function respondWithRpcPromise(_0x40b49b,_0x5eefe8,_0x20222a){return new BPromise(function(_0x56e7e7,_0x29ee53){return client['request'](_0x40b49b,_0x20222a)[_0xfd5b('0xe')](function(_0x4b3da7){logger[_0xfd5b('0xf')](_0xfd5b('0x10'),_0x5eefe8,'request\x20sent');logger['debug'](_0xfd5b('0x11'),_0x5eefe8,_0xfd5b('0x12'),JSON['stringify'](_0x4b3da7));if(_0x4b3da7[_0xfd5b('0x13')]){if(_0x4b3da7[_0xfd5b('0x13')][_0xfd5b('0x14')]===0x1f4){logger[_0xfd5b('0x13')](_0xfd5b('0x10'),_0x5eefe8,_0x4b3da7[_0xfd5b('0x13')][_0xfd5b('0x15')]);return _0x29ee53(_0x4b3da7[_0xfd5b('0x13')][_0xfd5b('0x15')]);}logger[_0xfd5b('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x5eefe8,_0x4b3da7[_0xfd5b('0x13')][_0xfd5b('0x15')]);return _0x56e7e7(_0x4b3da7[_0xfd5b('0x13')][_0xfd5b('0x15')]);}else{logger['info'](_0xfd5b('0x10'),_0x5eefe8,'request\x20sent');_0x56e7e7(_0x4b3da7['result'][_0xfd5b('0x15')]);}})[_0xfd5b('0x16')](function(_0x4bd45e){logger[_0xfd5b('0x13')](_0xfd5b('0x10'),_0x5eefe8,_0x4bd45e);_0x29ee53(_0x4bd45e);});});} \ No newline at end of file +var _0x407c=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch'];(function(_0x542da8,_0x509c26){var _0x533d7e=function(_0x2a3d04){while(--_0x2a3d04){_0x542da8['push'](_0x542da8['shift']());}};_0x533d7e(++_0x509c26);}(_0x407c,0x68));var _0xc407=function(_0x342940,_0x5cbb91){_0x342940=_0x342940-0x0;var _0x5d5fe8=_0x407c[_0x342940];return _0x5d5fe8;};'use strict';var _=require(_0xc407('0x0'));var util=require('util');var moment=require(_0xc407('0x1'));var BPromise=require(_0xc407('0x2'));var rs=require(_0xc407('0x3'));var fs=require('fs');var Redis=require(_0xc407('0x4'));var db=require(_0xc407('0x5'))['db'];var utils=require(_0xc407('0x6'));var logger=require('../../config/logger')(_0xc407('0x7'));var config=require(_0xc407('0x8'));var jayson=require(_0xc407('0x9'));var client=jayson['client'][_0xc407('0xa')]({'port':0x232a});config['redis']=_[_0xc407('0xb')](config[_0xc407('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc407('0xd'))(new Redis(config[_0xc407('0xc')]));require(_0xc407('0xe'))[_0xc407('0xf')](socket);function respondWithRpcPromise(_0x370cc4,_0x7acab5,_0x2bcfa7){return new BPromise(function(_0x1abaf9,_0x1e0245){return client[_0xc407('0x10')](_0x370cc4,_0x2bcfa7)['then'](function(_0x1d94be){logger[_0xc407('0x11')](_0xc407('0x12'),_0x7acab5,'request\x20sent');logger[_0xc407('0x13')](_0xc407('0x14'),_0x7acab5,'request\x20sent',JSON['stringify'](_0x1d94be));if(_0x1d94be['error']){if(_0x1d94be[_0xc407('0x15')]['code']===0x1f4){logger[_0xc407('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x7acab5,_0x1d94be[_0xc407('0x15')]['message']);return _0x1e0245(_0x1d94be[_0xc407('0x15')][_0xc407('0x16')]);}logger[_0xc407('0x15')](_0xc407('0x12'),_0x7acab5,_0x1d94be[_0xc407('0x15')][_0xc407('0x16')]);return _0x1abaf9(_0x1d94be['error'][_0xc407('0x16')]);}else{logger['info'](_0xc407('0x12'),_0x7acab5,_0xc407('0x17'));_0x1abaf9(_0x1d94be[_0xc407('0x18')][_0xc407('0x16')]);}})[_0xc407('0x19')](function(_0x55b4d1){logger['error'](_0xc407('0x12'),_0x7acab5,_0x55b4d1);_0x1e0245(_0x55b4d1);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 5b356d4..fac6260 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 _0x0fee=['chatInternalMessage:','emit','removeListener','register','length'];(function(_0x2067e3,_0x19bcb2){var _0x180c44=function(_0x53751f){while(--_0x53751f){_0x2067e3['push'](_0x2067e3['shift']());}};_0x180c44(++_0x19bcb2);}(_0x0fee,0x1af));var _0xe0fe=function(_0x3646b4,_0x16af8f){_0x3646b4=_0x3646b4-0x0;var _0x16184a=_0x0fee[_0x3646b4];return _0x16184a;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save','remove','update'];function createListener(_0x53cbba,_0x4ac8fc){return function(_0x12d326){_0x4ac8fc[_0xe0fe('0x0')](_0x53cbba,_0x12d326);};}function removeListener(_0x10401f,_0x24db67){return function(){ChatInternalMessageEvents[_0xe0fe('0x1')](_0x10401f,_0x24db67);};}exports[_0xe0fe('0x2')]=function(_0x6850ec){for(var _0x3ce791=0x0,_0x483415=events[_0xe0fe('0x3')];_0x3ce791<_0x483415;_0x3ce791++){var _0x3e83f0=events[_0x3ce791];var _0x157361=createListener(_0xe0fe('0x4')+_0x3e83f0,_0x6850ec);ChatInternalMessageEvents['on'](_0x3e83f0,_0x157361);}}; \ No newline at end of file +var _0x47cc=['length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','removeListener','register'];(function(_0x3a0dad,_0x4bbf9e){var _0x380070=function(_0x533fe3){while(--_0x533fe3){_0x3a0dad['push'](_0x3a0dad['shift']());}};_0x380070(++_0x4bbf9e);}(_0x47cc,0x132));var _0xc47c=function(_0x15a269,_0x142a09){_0x15a269=_0x15a269-0x0;var _0x2befa6=_0x47cc[_0x15a269];return _0x2befa6;};'use strict';var ChatInternalMessageEvents=require(_0xc47c('0x0'));var events=[_0xc47c('0x1'),_0xc47c('0x2'),_0xc47c('0x3')];function createListener(_0x4b0792,_0x4de7eb){return function(_0x2a04dc){_0x4de7eb['emit'](_0x4b0792,_0x2a04dc);};}function removeListener(_0x526327,_0x5dd443){return function(){ChatInternalMessageEvents[_0xc47c('0x4')](_0x526327,_0x5dd443);};}exports[_0xc47c('0x5')]=function(_0x3a9139){for(var _0x2d118b=0x0,_0x5232d4=events[_0xc47c('0x6')];_0x2d118b<_0x5232d4;_0x2d118b++){var _0x2e5441=events[_0x2d118b];var _0x1ab432=createListener(_0xc47c('0x7')+_0x2e5441,_0x3a9139);ChatInternalMessageEvents['on'](_0x2e5441,_0x1ab432);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index f16abec..483ef83 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 _0x733e=['isAuthenticated','/describe','describe','/users','getUsers','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get'];(function(_0x5305e6,_0x12781f){var _0x30c6f2=function(_0x423fe7){while(--_0x423fe7){_0x5305e6['push'](_0x5305e6['shift']());}};_0x30c6f2(++_0x12781f);}(_0x733e,0x115));var _0xe733=function(_0xe501ff,_0x955b7e){_0xe501ff=_0xe501ff-0x0;var _0x17135d=_0x733e[_0xe501ff];return _0x17135d;};'use strict';var multer=require(_0xe733('0x0'));var util=require(_0xe733('0x1'));var path=require(_0xe733('0x2'));var timeout=require(_0xe733('0x3'));var express=require('express');var router=express[_0xe733('0x4')]();var fs_extra=require(_0xe733('0x5'));var auth=require(_0xe733('0x6'));var interaction=require(_0xe733('0x7'));var config=require(_0xe733('0x8'));var controller=require(_0xe733('0x9'));router[_0xe733('0xa')]('/',auth[_0xe733('0xb')](),controller['index']);router[_0xe733('0xa')](_0xe733('0xc'),auth[_0xe733('0xb')](),controller[_0xe733('0xd')]);router['get'](_0xe733('0xe'),auth['isAuthenticated'](),controller[_0xe733('0xf')]);router['get'](_0xe733('0x10'),auth[_0xe733('0xb')](),controller[_0xe733('0x11')]);router[_0xe733('0x12')]('/',auth[_0xe733('0xb')](),controller[_0xe733('0x13')]);router['put']('/:id',controller[_0xe733('0x14')]);router[_0xe733('0x15')](_0xe733('0x10'),auth[_0xe733('0xb')](),controller[_0xe733('0x16')]);module[_0xe733('0x17')]=router; \ No newline at end of file +var _0x73ed=['multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','/users','getUsers','/:id','show','post','create','put','delete','exports'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x73ed,0x1a4));var _0xd73e=function(_0x2f57fe,_0x329ba4){_0x2f57fe=_0x2f57fe-0x0;var _0x297fc8=_0x73ed[_0x2f57fe];return _0x297fc8;};'use strict';var multer=require(_0xd73e('0x0'));var util=require(_0xd73e('0x1'));var path=require('path');var timeout=require(_0xd73e('0x2'));var express=require(_0xd73e('0x3'));var router=express[_0xd73e('0x4')]();var fs_extra=require(_0xd73e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd73e('0x6'));var config=require('../../config/environment');var controller=require(_0xd73e('0x7'));router[_0xd73e('0x8')]('/',auth[_0xd73e('0x9')](),controller[_0xd73e('0xa')]);router[_0xd73e('0x8')]('/describe',auth[_0xd73e('0x9')](),controller['describe']);router['get'](_0xd73e('0xb'),auth[_0xd73e('0x9')](),controller[_0xd73e('0xc')]);router[_0xd73e('0x8')](_0xd73e('0xd'),auth[_0xd73e('0x9')](),controller[_0xd73e('0xe')]);router[_0xd73e('0xf')]('/',auth['isAuthenticated'](),controller[_0xd73e('0x10')]);router[_0xd73e('0x11')]('/:id',controller['update']);router[_0xd73e('0x12')](_0xd73e('0xd'),auth[_0xd73e('0x9')](),controller['destroy']);module[_0xd73e('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 1a18916..ffa66c6 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 _0x1bd1=['BOOLEAN','DATE','STRING','sequelize','exports','TEXT'];(function(_0x2ef476,_0x19dc5a){var _0x4c11b0=function(_0x5989dc){while(--_0x5989dc){_0x2ef476['push'](_0x2ef476['shift']());}};_0x4c11b0(++_0x19dc5a);}(_0x1bd1,0x123));var _0x11bd=function(_0x10cb1e,_0x1974aa){_0x10cb1e=_0x10cb1e-0x0;var _0x51bbc9=_0x1bd1[_0x10cb1e];return _0x51bbc9;};'use strict';var Sequelize=require(_0x11bd('0x0'));module[_0x11bd('0x1')]={'body':{'type':Sequelize[_0x11bd('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x11bd('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x11bd('0x4')]},'providerName':{'type':Sequelize[_0x11bd('0x5')]},'providerResponse':{'type':Sequelize[_0x11bd('0x2')]}}; \ No newline at end of file +var _0x337f=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x337f,0x11c));var _0xf337=function(_0x393a82,_0x49f72a){_0x393a82=_0x393a82-0x0;var _0x2d9d99=_0x337f[_0x393a82];return _0x2d9d99;};'use strict';var Sequelize=require(_0xf337('0x0'));module[_0xf337('0x1')]={'body':{'type':Sequelize[_0xf337('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf337('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xf337('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf337('0x4')]('in','out'),'defaultValue':_0xf337('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf337('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf337('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 20744e7..35ee221 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 _0xca52=['end','status','offset','undefined','limit','count','Content-Range','json','save','update','sendStatus','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','destroy','describe','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','internal','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','parse','chat-interactions','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT','fullname','email','interface','formData','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','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','defaults','redis','localhost','jayson/promise','request','then','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xca52,0xdb));var _0x2ca5=function(_0x2ec1a2,_0x2213e8){_0x2ec1a2=_0x2ec1a2-0x0;var _0x5ee2d5=_0xca52[_0x2ec1a2];return _0x5ee2d5;};'use strict';var emlformat=require(_0x2ca5('0x0'));var rimraf=require(_0x2ca5('0x1'));var zipdir=require(_0x2ca5('0x2'));var jsonpatch=require(_0x2ca5('0x3'));var rp=require(_0x2ca5('0x4'));var moment=require(_0x2ca5('0x5'));var BPromise=require(_0x2ca5('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2ca5('0x7'));var sox=require(_0x2ca5('0x8'));var csv=require(_0x2ca5('0x9'));var ejs=require(_0x2ca5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ca5('0xb'));var squel=require(_0x2ca5('0xc'));var crypto=require(_0x2ca5('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2ca5('0x9'));var querystring=require(_0x2ca5('0xe'));var Papa=require('papaparse');var Redis=require(_0x2ca5('0xf'));var authService=require(_0x2ca5('0x10'));var qs=require(_0x2ca5('0x11'));var as=require(_0x2ca5('0x12'));var hardwareService=require(_0x2ca5('0x13'));var logger=require(_0x2ca5('0x14'))(_0x2ca5('0x15'));var utils=require(_0x2ca5('0x16'));var config=require(_0x2ca5('0x17'));var licenseUtil=require(_0x2ca5('0x18'));var db=require(_0x2ca5('0x19'))['db'];config['redis']=_[_0x2ca5('0x1a')](config[_0x2ca5('0x1b')],{'host':_0x2ca5('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatMessage.socket')['register'](socket);var jayson=require(_0x2ca5('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38fe3a,_0xede778,_0xb3d1dd,_0x3c86b7){return new BPromise(function(_0x19e33e,_0x4e2e4c){var _0x14e172=_0x3c86b7||client;return _0x14e172[_0x2ca5('0x1e')](_0x38fe3a,_0xb3d1dd)[_0x2ca5('0x1f')](function(_0x5ac534){logger[_0x2ca5('0x20')](_0x2ca5('0x21'),_0xede778,'request\x20sent');logger['debug'](_0x2ca5('0x22'),_0xede778,'request\x20sent',JSON[_0x2ca5('0x23')](_0x5ac534));if(_0x5ac534[_0x2ca5('0x24')]){if(_0x5ac534[_0x2ca5('0x24')]['code']===0x1f4){logger[_0x2ca5('0x24')](_0x2ca5('0x21'),_0xede778,_0x5ac534[_0x2ca5('0x24')][_0x2ca5('0x25')]);return _0x4e2e4c(_0x5ac534[_0x2ca5('0x24')][_0x2ca5('0x25')]);}logger['error'](_0x2ca5('0x21'),_0xede778,_0x5ac534[_0x2ca5('0x24')][_0x2ca5('0x25')]);return _0x19e33e(_0x5ac534[_0x2ca5('0x24')][_0x2ca5('0x25')]);}else{logger[_0x2ca5('0x20')](_0x2ca5('0x21'),_0xede778,_0x2ca5('0x26'));_0x19e33e(_0x5ac534[_0x2ca5('0x27')][_0x2ca5('0x25')]);}})[_0x2ca5('0x28')](function(_0x3be809){logger['error'](_0x2ca5('0x21'),_0xede778,_0x3be809);_0x4e2e4c(_0x3be809);});});}function respondWithStatusCode(_0x2a9296,_0x53dfc1){_0x53dfc1=_0x53dfc1||0xcc;return function(_0x292567){if(_0x292567){return _0x2a9296['sendStatus'](_0x53dfc1);}return _0x2a9296['status'](_0x53dfc1)[_0x2ca5('0x29')]();};}function respondWithResult(_0x333f89,_0x12ae7f){_0x12ae7f=_0x12ae7f||0xc8;return function(_0xf0119){if(_0xf0119){return _0x333f89[_0x2ca5('0x2a')](_0x12ae7f)['json'](_0xf0119);}};}function respondWithFilteredResult(_0x12f410,_0xc3920){return function(_0x336ab2){if(_0x336ab2){var _0x41fb84=typeof _0xc3920[_0x2ca5('0x2b')]===_0x2ca5('0x2c')&&typeof _0xc3920[_0x2ca5('0x2d')]===_0x2ca5('0x2c');var _0x484d3c=_0x336ab2[_0x2ca5('0x2e')];var _0x592964=_0x41fb84?0x0:_0xc3920[_0x2ca5('0x2b')];var _0x2d450c=_0x41fb84?_0x336ab2[_0x2ca5('0x2e')]:_0xc3920[_0x2ca5('0x2b')]+_0xc3920[_0x2ca5('0x2d')];var _0x5f1e6b;if(_0x2d450c>=_0x484d3c){_0x2d450c=_0x484d3c;_0x5f1e6b=0xc8;}else{_0x5f1e6b=0xce;}_0x12f410[_0x2ca5('0x2a')](_0x5f1e6b);return _0x12f410['set'](_0x2ca5('0x2f'),_0x592964+'-'+_0x2d450c+'/'+_0x484d3c)[_0x2ca5('0x30')](_0x336ab2);}return null;};}function patchUpdates(_0x119f94){return function(_0x576915){try{jsonpatch['apply'](_0x576915,_0x119f94,!![]);}catch(_0x5b8106){return BPromise['reject'](_0x5b8106);}return _0x576915[_0x2ca5('0x31')]();};}function saveUpdates(_0xea4d9c,_0x929899){return function(_0x519981){if(_0x519981){return _0x519981[_0x2ca5('0x32')](_0xea4d9c)['then'](function(_0x59a941){return _0x59a941;});}return null;};}function removeEntity(_0xdef9a2,_0xc7b308){return function(_0x26e7db){if(_0x26e7db){return _0x26e7db['destroy']()[_0x2ca5('0x1f')](function(){_0xdef9a2['status'](0xcc)[_0x2ca5('0x29')]();});}};}function handleEntityNotFound(_0x39efda,_0x1d831b){return function(_0x23b13d){if(!_0x23b13d){_0x39efda[_0x2ca5('0x33')](0x194);}return _0x23b13d;};}function handleError(_0x2df45e,_0x58fe8f){_0x58fe8f=_0x58fe8f||0x1f4;return function(_0x2ce0a7){logger[_0x2ca5('0x24')](_0x2ce0a7[_0x2ca5('0x34')]);if(_0x2ce0a7[_0x2ca5('0x35')]){delete _0x2ce0a7['name'];}_0x2df45e[_0x2ca5('0x2a')](_0x58fe8f)[_0x2ca5('0x36')](_0x2ce0a7);};}exports[_0x2ca5('0x37')]=function(_0x124a8a,_0x56e541){var _0x239c75={},_0x5d00d1={},_0x44c868={'count':0x0,'rows':[]};var _0x2314f0=_[_0x2ca5('0x38')](db[_0x2ca5('0x39')][_0x2ca5('0x3a')],function(_0x19c28b){return{'name':_0x19c28b[_0x2ca5('0x3b')],'type':_0x19c28b['type'][_0x2ca5('0x3c')]};});_0x5d00d1[_0x2ca5('0x3d')]=_[_0x2ca5('0x38')](_0x2314f0,'name');_0x5d00d1['query']=_[_0x2ca5('0x3e')](_0x124a8a[_0x2ca5('0x3f')]);_0x5d00d1[_0x2ca5('0x40')]=_[_0x2ca5('0x41')](_0x5d00d1[_0x2ca5('0x3d')],_0x5d00d1['query']);_0x239c75[_0x2ca5('0x42')]=_[_0x2ca5('0x41')](_0x5d00d1['model'],qs[_0x2ca5('0x43')](_0x124a8a[_0x2ca5('0x3f')][_0x2ca5('0x43')]));_0x239c75[_0x2ca5('0x42')]=_0x239c75['attributes']['length']?_0x239c75[_0x2ca5('0x42')]:_0x5d00d1[_0x2ca5('0x3d')];if(!_0x124a8a[_0x2ca5('0x3f')][_0x2ca5('0x44')](_0x2ca5('0x45'))){_0x239c75[_0x2ca5('0x2d')]=qs[_0x2ca5('0x2d')](_0x124a8a[_0x2ca5('0x3f')][_0x2ca5('0x2d')]);_0x239c75['offset']=qs[_0x2ca5('0x2b')](_0x124a8a['query'][_0x2ca5('0x2b')]);}_0x239c75['order']=qs[_0x2ca5('0x46')](_0x124a8a['query'][_0x2ca5('0x46')]);_0x239c75['where']=qs[_0x2ca5('0x40')](_['pick'](_0x124a8a[_0x2ca5('0x3f')],_0x5d00d1[_0x2ca5('0x40')]),_0x2314f0);if(_0x124a8a[_0x2ca5('0x3f')][_0x2ca5('0x47')]){_0x239c75[_0x2ca5('0x48')]=_['merge'](_0x239c75[_0x2ca5('0x48')],{'$or':_['map'](_0x2314f0,function(_0x566483){if(_0x566483['type']!==_0x2ca5('0x49')){var _0x4201fb={};_0x4201fb[_0x566483[_0x2ca5('0x35')]]={'$like':'%'+_0x124a8a[_0x2ca5('0x3f')][_0x2ca5('0x47')]+'%'};return _0x4201fb;}})});}_0x239c75=_[_0x2ca5('0x4a')]({},_0x239c75,_0x124a8a[_0x2ca5('0x4b')]);var _0x174a2f={'where':_0x239c75[_0x2ca5('0x48')]};return db[_0x2ca5('0x39')][_0x2ca5('0x2e')](_0x174a2f)[_0x2ca5('0x1f')](function(_0x42c081){_0x44c868[_0x2ca5('0x2e')]=_0x42c081;if(_0x124a8a[_0x2ca5('0x3f')][_0x2ca5('0x4c')]){_0x239c75[_0x2ca5('0x4d')]=[{'all':!![]}];}return db[_0x2ca5('0x39')][_0x2ca5('0x4e')](_0x239c75);})[_0x2ca5('0x1f')](function(_0x43e057){_0x44c868[_0x2ca5('0x4f')]=_0x43e057;return _0x44c868;})['then'](respondWithFilteredResult(_0x56e541,_0x239c75))[_0x2ca5('0x28')](handleError(_0x56e541,null));};exports[_0x2ca5('0x50')]=function(_0x177513,_0x440438){var _0x47dbfb={'raw':!![],'where':{'id':_0x177513[_0x2ca5('0x51')]['id']}},_0x2c9305={};_0x2c9305['model']=_[_0x2ca5('0x3e')](db['ChatMessage'][_0x2ca5('0x3a')]);_0x2c9305[_0x2ca5('0x3f')]=_['keys'](_0x177513[_0x2ca5('0x3f')]);_0x2c9305[_0x2ca5('0x40')]=_[_0x2ca5('0x41')](_0x2c9305[_0x2ca5('0x3d')],_0x2c9305['query']);_0x47dbfb[_0x2ca5('0x42')]=_[_0x2ca5('0x41')](_0x2c9305[_0x2ca5('0x3d')],qs['fields'](_0x177513['query']['fields']));_0x47dbfb[_0x2ca5('0x42')]=_0x47dbfb['attributes']['length']?_0x47dbfb[_0x2ca5('0x42')]:_0x2c9305[_0x2ca5('0x3d')];if(_0x177513['query'][_0x2ca5('0x4c')]){_0x47dbfb[_0x2ca5('0x4d')]=[{'all':!![]}];}_0x47dbfb=_[_0x2ca5('0x4a')]({},_0x47dbfb,_0x177513[_0x2ca5('0x4b')]);return db['ChatMessage'][_0x2ca5('0x52')](_0x47dbfb)['then'](handleEntityNotFound(_0x440438,null))[_0x2ca5('0x1f')](respondWithResult(_0x440438,null))['catch'](handleError(_0x440438,null));};exports['create']=function(_0x17a9e2,_0x4c2510){return db['ChatMessage'][_0x2ca5('0x53')](_0x17a9e2[_0x2ca5('0x54')],{})['then'](respondWithResult(_0x4c2510,0xc9))[_0x2ca5('0x28')](handleError(_0x4c2510,null));};exports[_0x2ca5('0x32')]=function(_0x3f9fce,_0x5b6df2){if(_0x3f9fce['body']['id']){delete _0x3f9fce[_0x2ca5('0x54')]['id'];}return db['ChatMessage'][_0x2ca5('0x52')]({'where':{'id':_0x3f9fce[_0x2ca5('0x51')]['id']}})['then'](handleEntityNotFound(_0x5b6df2,null))[_0x2ca5('0x1f')](saveUpdates(_0x3f9fce['body'],null))[_0x2ca5('0x1f')](respondWithResult(_0x5b6df2,null))[_0x2ca5('0x28')](handleError(_0x5b6df2,null));};exports[_0x2ca5('0x55')]=function(_0x334166,_0x1fd6da){return db[_0x2ca5('0x39')]['find']({'where':{'id':_0x334166[_0x2ca5('0x51')]['id']}})[_0x2ca5('0x1f')](handleEntityNotFound(_0x1fd6da,null))[_0x2ca5('0x1f')](removeEntity(_0x1fd6da,null))[_0x2ca5('0x28')](handleError(_0x1fd6da,null));};exports[_0x2ca5('0x56')]=function(_0x2cdcef,_0xd7c5ab){return db[_0x2ca5('0x39')][_0x2ca5('0x56')]()[_0x2ca5('0x1f')](respondWithResult(_0xd7c5ab,null))['catch'](handleError(_0xd7c5ab,null));};var interaction_log=require(_0x2ca5('0x14'))('chat-interactions');exports['accept']=function(_0x48ae13,_0x243d1d,_0xfb8589){var _0x4c58d7={'agent':{},'channel':_0x2ca5('0x57')};if(_0x48ae13[_0x2ca5('0x54')]['id']){delete _0x48ae13['body']['id'];}_0x48ae13[_0x2ca5('0x54')][_0x2ca5('0x58')]=!![];_0x48ae13[_0x2ca5('0x54')][_0x2ca5('0x59')]=moment()[_0x2ca5('0x5a')](_0x2ca5('0x5b'));_0x48ae13[_0x2ca5('0x54')][_0x2ca5('0x5c')]=_0x48ae13['body']['UserId']||_0x48ae13[_0x2ca5('0x5d')]['id'];_0x4c58d7[_0x2ca5('0x5e')]['id']=_0x48ae13['body']['UserId'];return db[_0x2ca5('0x39')][_0x2ca5('0x52')]({'where':{'id':_0x48ae13[_0x2ca5('0x51')]['id'],'UserId':null}})[_0x2ca5('0x1f')](handleEntityNotFound(_0x243d1d,null))['then'](saveUpdates(_0x48ae13[_0x2ca5('0x54')],null))[_0x2ca5('0x1f')](function(_0x4634c5){if(_0x4634c5){_0x4c58d7['message']=_0x4634c5[_0x2ca5('0x5f')]({'plain':!![]});return db[_0x2ca5('0x60')][_0x2ca5('0x52')]({'where':{'id':_0x4634c5[_0x2ca5('0x61')]}});}return null;})[_0x2ca5('0x1f')](handleEntityNotFound(_0x243d1d,null))[_0x2ca5('0x1f')](function(_0x2ae0fa){if(_0x2ae0fa){return _0x2ae0fa[_0x2ca5('0x32')]({'UserId':_0x48ae13[_0x2ca5('0x54')][_0x2ca5('0x5c')],'read1stAt':_[_0x2ca5('0x62')](_0x2ae0fa['read1stAt'])?moment()[_0x2ca5('0x5a')](_0x2ca5('0x5b')):undefined});}return null;})['then'](function(_0x1dc608){if(_0x1dc608){_0x4c58d7[_0x2ca5('0x63')]=_0x1dc608[_0x2ca5('0x5f')]({'plain':!![]});interaction_log[_0x2ca5('0x20')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x48ae13[_0x2ca5('0x5d')]['id'],_0x48ae13[_0x2ca5('0x5d')][_0x2ca5('0x35')],_0x48ae13[_0x2ca5('0x5d')][_0x2ca5('0x64')],_0x4c58d7[_0x2ca5('0x63')]['id'],_0x48ae13[_0x2ca5('0x54')]?JSON['stringify'](_0x48ae13[_0x2ca5('0x54')]):_0x2ca5('0x65'));return respondWithRpcPromise(_0x2ca5('0x66'),_0x2ca5('0x67'),_0x4c58d7);}return null;})[_0x2ca5('0x1f')](function(_0x49d7ed){var _0xa9847c=_0x2ca5('0x68')+_0x49d7ed[_0x2ca5('0x25')][_0x2ca5('0x69')];return db[_0x2ca5('0x6a')][_0x2ca5('0x3f')](_0xa9847c,{'type':db[_0x2ca5('0x6b')][_0x2ca5('0x6c')]['SELECT'],'raw':!![]})[_0x2ca5('0x1f')](function(_0x261ae3){return _0x261ae3;});})[_0x2ca5('0x1f')](function(_0x4f6c77){if(_0x4f6c77){_0x4c58d7[_0x2ca5('0x25')][_0x2ca5('0x6d')]=_0x4f6c77[0x0];if(!_0x48ae13[_0x2ca5('0x54')][_0x2ca5('0x5c')])return;return db[_0x2ca5('0x6e')]['find']({'where':{'id':_0x48ae13[_0x2ca5('0x54')][_0x2ca5('0x5c')],'role':_0x2ca5('0x5e')},'attributes':['id',_0x2ca5('0x35'),'fullname','email',_0x2ca5('0x6f')],'raw':!![]});}return null;})['then'](function(_0x1e57d5){if(!_0x1e57d5)return null;_0x4c58d7[_0x2ca5('0x25')][_0x2ca5('0x5e')]=_0x1e57d5;return _0x4c58d7;})[_0x2ca5('0x1f')](function(_0x13f122){if(_0x13f122){if(_0x48ae13[_0x2ca5('0x54')][_0x2ca5('0x70')]){_0x4c58d7[_0x2ca5('0x25')]['interface']=util[_0x2ca5('0x5a')](_0x2ca5('0x71'),_0x48ae13['user'][_0x2ca5('0x35')]);_0x4c58d7[_0x2ca5('0x25')][_0x2ca5('0x72')]=_0x4c58d7[_0x2ca5('0x72')];_0x4c58d7[_0x2ca5('0x25')][_0x2ca5('0x73')]=_0x4c58d7[_0x2ca5('0x72')];_0x4c58d7['message'][_0x2ca5('0x74')]=_0x2ca5('0x75');return respondWithRpcPromise(_0x2ca5('0x76'),_0x2ca5('0x76'),{'event':_0x2ca5('0x77'),'message':_[_0x2ca5('0x4a')](_0x4c58d7[_0x2ca5('0x25')],JSON[_0x2ca5('0x78')](_0x4c58d7[_0x2ca5('0x63')]['formData']))},client9002)['then'](function(){return _0x4c58d7;});}return _0x4c58d7;}return null;})[_0x2ca5('0x1f')](respondWithResult(_0x243d1d,null))[_0x2ca5('0x28')](handleError(_0x243d1d,null));};var interaction_log=require(_0x2ca5('0x14'))(_0x2ca5('0x79'));exports[_0x2ca5('0x7a')]=function(_0x4c6e49,_0x104ead,_0x5ad1be){var _0x5a12f2={'agent':{},'channel':_0x2ca5('0x57')};if(_0x4c6e49['body']['id']){delete _0x4c6e49[_0x2ca5('0x54')]['id'];}_0x4c6e49['body'][_0x2ca5('0x5c')]=_0x4c6e49[_0x2ca5('0x54')][_0x2ca5('0x5c')]||_0x4c6e49['user']['id'];_0x5a12f2[_0x2ca5('0x5e')]['id']=_0x4c6e49[_0x2ca5('0x54')][_0x2ca5('0x5c')];return db[_0x2ca5('0x39')][_0x2ca5('0x52')]({'where':{'id':_0x4c6e49[_0x2ca5('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x104ead,null))[_0x2ca5('0x1f')](function(_0x5af326){if(_0x5af326){_0x5a12f2[_0x2ca5('0x25')]=_0x5af326[_0x2ca5('0x5f')]({'plain':!![]});return db[_0x2ca5('0x60')][_0x2ca5('0x52')]({'where':{'id':_0x5af326[_0x2ca5('0x61')]}});}return null;})[_0x2ca5('0x1f')](handleEntityNotFound(_0x104ead,null))[_0x2ca5('0x1f')](function(_0x18738b){if(_0x18738b){_0x5a12f2[_0x2ca5('0x63')]=_0x18738b[_0x2ca5('0x5f')]({'plain':!![]});interaction_log[_0x2ca5('0x20')](_0x2ca5('0x7b'),_0x4c6e49[_0x2ca5('0x5d')]['id'],_0x4c6e49[_0x2ca5('0x5d')][_0x2ca5('0x35')],_0x4c6e49['user'][_0x2ca5('0x64')],_0x5a12f2[_0x2ca5('0x63')]['id'],_0x4c6e49[_0x2ca5('0x54')]?JSON[_0x2ca5('0x23')](_0x4c6e49['body']):_0x2ca5('0x65'));return respondWithRpcPromise('RejectMessage',_0x2ca5('0x7c'),_0x5a12f2);}return null;})['then'](function(_0x3075aa){var _0x21190d=_0x2ca5('0x68')+_0x3075aa['message'][_0x2ca5('0x69')];return db[_0x2ca5('0x6a')][_0x2ca5('0x3f')](_0x21190d,{'type':db[_0x2ca5('0x6b')][_0x2ca5('0x6c')][_0x2ca5('0x7d')],'raw':!![]})['then'](function(_0x257614){return _0x257614;});})[_0x2ca5('0x1f')](function(_0x4b6a0f){if(_0x4b6a0f){_0x5a12f2[_0x2ca5('0x25')][_0x2ca5('0x6d')]=_0x4b6a0f[0x0];if(!_0x4c6e49[_0x2ca5('0x54')][_0x2ca5('0x5c')])return;return db[_0x2ca5('0x6e')][_0x2ca5('0x52')]({'where':{'id':_0x4c6e49['body']['UserId'],'role':'agent'},'attributes':['id',_0x2ca5('0x35'),_0x2ca5('0x7e'),_0x2ca5('0x7f'),_0x2ca5('0x6f')],'raw':!![]});}return null;})[_0x2ca5('0x1f')](function(_0x42f2a6){if(!_0x42f2a6)return null;_0x5a12f2[_0x2ca5('0x25')][_0x2ca5('0x5e')]=_0x42f2a6;return _0x5a12f2;})[_0x2ca5('0x1f')](function(_0x28d618){if(_0x28d618){_0x28d618[_0x2ca5('0x25')][_0x2ca5('0x80')]=util[_0x2ca5('0x5a')](_0x2ca5('0x71'),_0x4c6e49[_0x2ca5('0x5d')][_0x2ca5('0x35')]);_0x28d618[_0x2ca5('0x25')]['channel']=_0x5a12f2[_0x2ca5('0x72')];_0x28d618[_0x2ca5('0x25')]['motionChannel']=_0x5a12f2[_0x2ca5('0x72')];_0x28d618['message'][_0x2ca5('0x74')]='reject';respondWithRpcPromise(_0x2ca5('0x76'),'EventManager',{'event':'rejectmessage','message':_[_0x2ca5('0x4a')](_0x5a12f2['message'],JSON['parse'](_0x5a12f2[_0x2ca5('0x63')][_0x2ca5('0x81')]))},client9002);return _0x5a12f2;}return null;})[_0x2ca5('0x1f')](respondWithResult(_0x104ead,null))['catch'](handleError(_0x104ead,null));}; \ No newline at end of file +var _0x1ae4=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','end','name','send','index','map','ChatMessage','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','findAll','rows','show','keys','includeAll','include','find','create','body','params','describe','chat-interactions','readAt','UserId','user','agent','get','ChatInteractionId','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','channel','accept','EventManager','parse','formData','chat','ChatInteraction','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','fullname','SIP/%s','motionChannel','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv'];(function(_0xef5a26,_0x338881){var _0x42e1f3=function(_0x333ea8){while(--_0x333ea8){_0xef5a26['push'](_0xef5a26['shift']());}};_0x42e1f3(++_0x338881);}(_0x1ae4,0xf2));var _0x41ae=function(_0x4e2967,_0x55201b){_0x4e2967=_0x4e2967-0x0;var _0x39d360=_0x1ae4[_0x4e2967];return _0x39d360;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x41ae('0x0'));var jsonpatch=require(_0x41ae('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x41ae('0x2'));var util=require(_0x41ae('0x3'));var path=require(_0x41ae('0x4'));var sox=require(_0x41ae('0x5'));var csv=require('to-csv');var ejs=require(_0x41ae('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x41ae('0x7'));var squel=require(_0x41ae('0x8'));var crypto=require(_0x41ae('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x41ae('0xa'));var toCsv=require(_0x41ae('0xb'));var querystring=require(_0x41ae('0xc'));var Papa=require(_0x41ae('0xd'));var Redis=require('ioredis');var authService=require(_0x41ae('0xe'));var qs=require(_0x41ae('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x41ae('0x10'))(_0x41ae('0x11'));var utils=require(_0x41ae('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x41ae('0x13'));var db=require(_0x41ae('0x14'))['db'];config[_0x41ae('0x15')]=_[_0x41ae('0x16')](config[_0x41ae('0x15')],{'host':_0x41ae('0x17'),'port':0x18eb});var socket=require(_0x41ae('0x18'))(new Redis(config[_0x41ae('0x15')]));require(_0x41ae('0x19'))['register'](socket);var jayson=require(_0x41ae('0x1a'));var client=jayson[_0x41ae('0x1b')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1eba43,_0x35216d,_0x22c9a4,_0x31eb85){return new BPromise(function(_0xbf22ca,_0x2a5596){var _0x3be9dd=_0x31eb85||client;return _0x3be9dd[_0x41ae('0x1c')](_0x1eba43,_0x22c9a4)[_0x41ae('0x1d')](function(_0x5c8011){logger[_0x41ae('0x1e')](_0x41ae('0x1f'),_0x35216d,_0x41ae('0x20'));logger[_0x41ae('0x21')](_0x41ae('0x22'),_0x35216d,_0x41ae('0x20'),JSON[_0x41ae('0x23')](_0x5c8011));if(_0x5c8011['error']){if(_0x5c8011[_0x41ae('0x24')][_0x41ae('0x25')]===0x1f4){logger[_0x41ae('0x24')](_0x41ae('0x1f'),_0x35216d,_0x5c8011[_0x41ae('0x24')][_0x41ae('0x26')]);return _0x2a5596(_0x5c8011[_0x41ae('0x24')][_0x41ae('0x26')]);}logger[_0x41ae('0x24')]('ChatMessage,\x20%s,\x20%s',_0x35216d,_0x5c8011[_0x41ae('0x24')][_0x41ae('0x26')]);return _0xbf22ca(_0x5c8011[_0x41ae('0x24')][_0x41ae('0x26')]);}else{logger[_0x41ae('0x1e')](_0x41ae('0x1f'),_0x35216d,_0x41ae('0x20'));_0xbf22ca(_0x5c8011[_0x41ae('0x27')]['message']);}})[_0x41ae('0x28')](function(_0xf58ff3){logger[_0x41ae('0x24')](_0x41ae('0x1f'),_0x35216d,_0xf58ff3);_0x2a5596(_0xf58ff3);});});}function respondWithStatusCode(_0x5f26a2,_0x1f585d){_0x1f585d=_0x1f585d||0xcc;return function(_0x59c22a){if(_0x59c22a){return _0x5f26a2[_0x41ae('0x29')](_0x1f585d);}return _0x5f26a2[_0x41ae('0x2a')](_0x1f585d)['end']();};}function respondWithResult(_0x3e83e7,_0xb8f169){_0xb8f169=_0xb8f169||0xc8;return function(_0x4aab85){if(_0x4aab85){return _0x3e83e7[_0x41ae('0x2a')](_0xb8f169)['json'](_0x4aab85);}};}function respondWithFilteredResult(_0x438218,_0x31aeac){return function(_0x2f83c5){if(_0x2f83c5){var _0x5b7ded=typeof _0x31aeac['offset']===_0x41ae('0x2b')&&typeof _0x31aeac[_0x41ae('0x2c')]===_0x41ae('0x2b');var _0x48373a=_0x2f83c5[_0x41ae('0x2d')];var _0x3049a9=_0x5b7ded?0x0:_0x31aeac[_0x41ae('0x2e')];var _0x4a312b=_0x5b7ded?_0x2f83c5[_0x41ae('0x2d')]:_0x31aeac['offset']+_0x31aeac['limit'];var _0x10e2d9;if(_0x4a312b>=_0x48373a){_0x4a312b=_0x48373a;_0x10e2d9=0xc8;}else{_0x10e2d9=0xce;}_0x438218[_0x41ae('0x2a')](_0x10e2d9);return _0x438218[_0x41ae('0x2f')](_0x41ae('0x30'),_0x3049a9+'-'+_0x4a312b+'/'+_0x48373a)[_0x41ae('0x31')](_0x2f83c5);}return null;};}function patchUpdates(_0x406a00){return function(_0xe3109){try{jsonpatch[_0x41ae('0x32')](_0xe3109,_0x406a00,!![]);}catch(_0x4111e6){return BPromise[_0x41ae('0x33')](_0x4111e6);}return _0xe3109[_0x41ae('0x34')]();};}function saveUpdates(_0x2c2215,_0x3284fd){return function(_0x13db8e){if(_0x13db8e){return _0x13db8e[_0x41ae('0x35')](_0x2c2215)[_0x41ae('0x1d')](function(_0x394ca7){return _0x394ca7;});}return null;};}function removeEntity(_0x2e173a,_0x163407){return function(_0x56a28b){if(_0x56a28b){return _0x56a28b[_0x41ae('0x36')]()[_0x41ae('0x1d')](function(){_0x2e173a[_0x41ae('0x2a')](0xcc)[_0x41ae('0x37')]();});}};}function handleEntityNotFound(_0x2c6ac3,_0x3d53e5){return function(_0xc7edfc){if(!_0xc7edfc){_0x2c6ac3[_0x41ae('0x29')](0x194);}return _0xc7edfc;};}function handleError(_0x16ee14,_0x55b764){_0x55b764=_0x55b764||0x1f4;return function(_0x10ae30){logger[_0x41ae('0x24')](_0x10ae30['stack']);if(_0x10ae30[_0x41ae('0x38')]){delete _0x10ae30['name'];}_0x16ee14[_0x41ae('0x2a')](_0x55b764)[_0x41ae('0x39')](_0x10ae30);};}exports[_0x41ae('0x3a')]=function(_0x171696,_0x21bc7c){var _0x2ee975={},_0xe5a277={},_0x465c47={'count':0x0,'rows':[]};var _0x13aaf4=_[_0x41ae('0x3b')](db[_0x41ae('0x3c')]['rawAttributes'],function(_0x20c840){return{'name':_0x20c840[_0x41ae('0x3d')],'type':_0x20c840[_0x41ae('0x3e')][_0x41ae('0x3f')]};});_0xe5a277['model']=_[_0x41ae('0x3b')](_0x13aaf4,_0x41ae('0x38'));_0xe5a277['query']=_['keys'](_0x171696[_0x41ae('0x40')]);_0xe5a277[_0x41ae('0x41')]=_[_0x41ae('0x42')](_0xe5a277['model'],_0xe5a277[_0x41ae('0x40')]);_0x2ee975[_0x41ae('0x43')]=_[_0x41ae('0x42')](_0xe5a277[_0x41ae('0x44')],qs[_0x41ae('0x45')](_0x171696[_0x41ae('0x40')][_0x41ae('0x45')]));_0x2ee975['attributes']=_0x2ee975[_0x41ae('0x43')][_0x41ae('0x46')]?_0x2ee975[_0x41ae('0x43')]:_0xe5a277[_0x41ae('0x44')];if(!_0x171696['query']['hasOwnProperty'](_0x41ae('0x47'))){_0x2ee975[_0x41ae('0x2c')]=qs['limit'](_0x171696[_0x41ae('0x40')]['limit']);_0x2ee975[_0x41ae('0x2e')]=qs[_0x41ae('0x2e')](_0x171696[_0x41ae('0x40')]['offset']);}_0x2ee975['order']=qs['sort'](_0x171696[_0x41ae('0x40')][_0x41ae('0x48')]);_0x2ee975[_0x41ae('0x49')]=qs['filters'](_['pick'](_0x171696[_0x41ae('0x40')],_0xe5a277[_0x41ae('0x41')]),_0x13aaf4);if(_0x171696['query'][_0x41ae('0x4a')]){_0x2ee975[_0x41ae('0x49')]=_[_0x41ae('0x4b')](_0x2ee975[_0x41ae('0x49')],{'$or':_['map'](_0x13aaf4,function(_0x4e7c47){if(_0x4e7c47[_0x41ae('0x3e')]!==_0x41ae('0x4c')){var _0x215527={};_0x215527[_0x4e7c47[_0x41ae('0x38')]]={'$like':'%'+_0x171696[_0x41ae('0x40')]['filter']+'%'};return _0x215527;}})});}_0x2ee975=_[_0x41ae('0x4b')]({},_0x2ee975,_0x171696[_0x41ae('0x4d')]);var _0x243334={'where':_0x2ee975[_0x41ae('0x49')]};return db[_0x41ae('0x3c')][_0x41ae('0x2d')](_0x243334)[_0x41ae('0x1d')](function(_0xf38094){_0x465c47[_0x41ae('0x2d')]=_0xf38094;if(_0x171696[_0x41ae('0x40')]['includeAll']){_0x2ee975['include']=[{'all':!![]}];}return db[_0x41ae('0x3c')][_0x41ae('0x4e')](_0x2ee975);})['then'](function(_0x37faa9){_0x465c47[_0x41ae('0x4f')]=_0x37faa9;return _0x465c47;})[_0x41ae('0x1d')](respondWithFilteredResult(_0x21bc7c,_0x2ee975))['catch'](handleError(_0x21bc7c,null));};exports[_0x41ae('0x50')]=function(_0x1034dd,_0x12a31e){var _0x302593={'raw':!![],'where':{'id':_0x1034dd['params']['id']}},_0x16b1ac={};_0x16b1ac[_0x41ae('0x44')]=_[_0x41ae('0x51')](db['ChatMessage']['rawAttributes']);_0x16b1ac[_0x41ae('0x40')]=_[_0x41ae('0x51')](_0x1034dd[_0x41ae('0x40')]);_0x16b1ac[_0x41ae('0x41')]=_[_0x41ae('0x42')](_0x16b1ac[_0x41ae('0x44')],_0x16b1ac['query']);_0x302593[_0x41ae('0x43')]=_['intersection'](_0x16b1ac['model'],qs[_0x41ae('0x45')](_0x1034dd['query']['fields']));_0x302593[_0x41ae('0x43')]=_0x302593['attributes']['length']?_0x302593[_0x41ae('0x43')]:_0x16b1ac[_0x41ae('0x44')];if(_0x1034dd[_0x41ae('0x40')][_0x41ae('0x52')]){_0x302593[_0x41ae('0x53')]=[{'all':!![]}];}_0x302593=_[_0x41ae('0x4b')]({},_0x302593,_0x1034dd[_0x41ae('0x4d')]);return db['ChatMessage'][_0x41ae('0x54')](_0x302593)[_0x41ae('0x1d')](handleEntityNotFound(_0x12a31e,null))[_0x41ae('0x1d')](respondWithResult(_0x12a31e,null))[_0x41ae('0x28')](handleError(_0x12a31e,null));};exports[_0x41ae('0x55')]=function(_0x20a597,_0x4e0970){return db[_0x41ae('0x3c')][_0x41ae('0x55')](_0x20a597['body'],{})[_0x41ae('0x1d')](respondWithResult(_0x4e0970,0xc9))['catch'](handleError(_0x4e0970,null));};exports['update']=function(_0x1bf312,_0x2310fe){if(_0x1bf312[_0x41ae('0x56')]['id']){delete _0x1bf312[_0x41ae('0x56')]['id'];}return db[_0x41ae('0x3c')]['find']({'where':{'id':_0x1bf312[_0x41ae('0x57')]['id']}})[_0x41ae('0x1d')](handleEntityNotFound(_0x2310fe,null))['then'](saveUpdates(_0x1bf312[_0x41ae('0x56')],null))[_0x41ae('0x1d')](respondWithResult(_0x2310fe,null))['catch'](handleError(_0x2310fe,null));};exports[_0x41ae('0x36')]=function(_0x1fbbff,_0x38723b){return db['ChatMessage'][_0x41ae('0x54')]({'where':{'id':_0x1fbbff[_0x41ae('0x57')]['id']}})[_0x41ae('0x1d')](handleEntityNotFound(_0x38723b,null))[_0x41ae('0x1d')](removeEntity(_0x38723b,null))[_0x41ae('0x28')](handleError(_0x38723b,null));};exports[_0x41ae('0x58')]=function(_0x34dfc8,_0x7894){return db[_0x41ae('0x3c')]['describe']()['then'](respondWithResult(_0x7894,null))['catch'](handleError(_0x7894,null));};var interaction_log=require(_0x41ae('0x10'))(_0x41ae('0x59'));exports['accept']=function(_0x18a872,_0x202f45,_0x4374d2){var _0x389e28={'agent':{},'channel':'chat'};if(_0x18a872[_0x41ae('0x56')]['id']){delete _0x18a872[_0x41ae('0x56')]['id'];}_0x18a872[_0x41ae('0x56')]['read']=!![];_0x18a872[_0x41ae('0x56')][_0x41ae('0x5a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x18a872[_0x41ae('0x56')][_0x41ae('0x5b')]=_0x18a872[_0x41ae('0x56')][_0x41ae('0x5b')]||_0x18a872[_0x41ae('0x5c')]['id'];_0x389e28[_0x41ae('0x5d')]['id']=_0x18a872[_0x41ae('0x56')][_0x41ae('0x5b')];return db[_0x41ae('0x3c')][_0x41ae('0x54')]({'where':{'id':_0x18a872[_0x41ae('0x57')]['id'],'UserId':null}})[_0x41ae('0x1d')](handleEntityNotFound(_0x202f45,null))['then'](saveUpdates(_0x18a872['body'],null))['then'](function(_0x5d3893){if(_0x5d3893){_0x389e28[_0x41ae('0x26')]=_0x5d3893[_0x41ae('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x41ae('0x54')]({'where':{'id':_0x5d3893[_0x41ae('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x202f45,null))[_0x41ae('0x1d')](function(_0x326dd0){if(_0x326dd0){return _0x326dd0['update']({'UserId':_0x18a872[_0x41ae('0x56')][_0x41ae('0x5b')],'read1stAt':_['isNil'](_0x326dd0[_0x41ae('0x60')])?moment()[_0x41ae('0x61')](_0x41ae('0x62')):undefined});}return null;})[_0x41ae('0x1d')](function(_0x4a1a22){if(_0x4a1a22){_0x389e28[_0x41ae('0x63')]=_0x4a1a22['get']({'plain':!![]});interaction_log[_0x41ae('0x1e')](_0x41ae('0x64'),_0x18a872[_0x41ae('0x5c')]['id'],_0x18a872['user'][_0x41ae('0x38')],_0x18a872[_0x41ae('0x5c')][_0x41ae('0x65')],_0x389e28['interaction']['id'],_0x18a872[_0x41ae('0x56')]?JSON[_0x41ae('0x23')](_0x18a872[_0x41ae('0x56')]):'null');return respondWithRpcPromise('AcceptMessage',_0x41ae('0x66'),_0x389e28);}return null;})[_0x41ae('0x1d')](function(_0xa03fe0){var _0x1ff61a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xa03fe0[_0x41ae('0x26')][_0x41ae('0x67')];return db[_0x41ae('0x68')][_0x41ae('0x40')](_0x1ff61a,{'type':db['Sequelize'][_0x41ae('0x69')][_0x41ae('0x6a')],'raw':!![]})[_0x41ae('0x1d')](function(_0x248a5a){return _0x248a5a;});})['then'](function(_0x5556fa){if(_0x5556fa){_0x389e28[_0x41ae('0x26')][_0x41ae('0x6b')]=_0x5556fa[0x0];if(!_0x18a872['body'][_0x41ae('0x5b')])return;return db[_0x41ae('0x6c')]['find']({'where':{'id':_0x18a872['body']['UserId'],'role':_0x41ae('0x5d')},'attributes':['id',_0x41ae('0x38'),'fullname',_0x41ae('0x6d'),_0x41ae('0x6e')],'raw':!![]});}return null;})[_0x41ae('0x1d')](function(_0x110820){if(!_0x110820)return null;_0x389e28[_0x41ae('0x26')][_0x41ae('0x5d')]=_0x110820;return _0x389e28;})['then'](function(_0x40f96c){if(_0x40f96c){if(_0x18a872[_0x41ae('0x56')][_0x41ae('0x6f')]){_0x389e28['message'][_0x41ae('0x70')]=util[_0x41ae('0x61')]('SIP/%s',_0x18a872[_0x41ae('0x5c')][_0x41ae('0x38')]);_0x389e28[_0x41ae('0x26')][_0x41ae('0x71')]=_0x389e28[_0x41ae('0x71')];_0x389e28[_0x41ae('0x26')]['motionChannel']=_0x389e28[_0x41ae('0x71')];_0x389e28[_0x41ae('0x26')]['event']=_0x41ae('0x72');return respondWithRpcPromise(_0x41ae('0x73'),'EventManager',{'event':'acceptmessage','message':_[_0x41ae('0x4b')](_0x389e28[_0x41ae('0x26')],JSON[_0x41ae('0x74')](_0x389e28['interaction'][_0x41ae('0x75')]))},client9002)[_0x41ae('0x1d')](function(){return _0x389e28;});}return _0x389e28;}return null;})[_0x41ae('0x1d')](respondWithResult(_0x202f45,null))[_0x41ae('0x28')](handleError(_0x202f45,null));};var interaction_log=require(_0x41ae('0x10'))(_0x41ae('0x59'));exports[_0x41ae('0x33')]=function(_0x2f9089,_0x203d85,_0x9a045c){var _0x3cbda1={'agent':{},'channel':_0x41ae('0x76')};if(_0x2f9089[_0x41ae('0x56')]['id']){delete _0x2f9089[_0x41ae('0x56')]['id'];}_0x2f9089['body'][_0x41ae('0x5b')]=_0x2f9089[_0x41ae('0x56')][_0x41ae('0x5b')]||_0x2f9089[_0x41ae('0x5c')]['id'];_0x3cbda1[_0x41ae('0x5d')]['id']=_0x2f9089[_0x41ae('0x56')][_0x41ae('0x5b')];return db['ChatMessage'][_0x41ae('0x54')]({'where':{'id':_0x2f9089[_0x41ae('0x57')]['id'],'UserId':null}})[_0x41ae('0x1d')](handleEntityNotFound(_0x203d85,null))[_0x41ae('0x1d')](function(_0x5e37f2){if(_0x5e37f2){_0x3cbda1[_0x41ae('0x26')]=_0x5e37f2[_0x41ae('0x5e')]({'plain':!![]});return db[_0x41ae('0x77')][_0x41ae('0x54')]({'where':{'id':_0x5e37f2['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x203d85,null))[_0x41ae('0x1d')](function(_0x3ea78e){if(_0x3ea78e){_0x3cbda1[_0x41ae('0x63')]=_0x3ea78e[_0x41ae('0x5e')]({'plain':!![]});interaction_log[_0x41ae('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2f9089[_0x41ae('0x5c')]['id'],_0x2f9089['user'][_0x41ae('0x38')],_0x2f9089['user'][_0x41ae('0x65')],_0x3cbda1[_0x41ae('0x63')]['id'],_0x2f9089[_0x41ae('0x56')]?JSON[_0x41ae('0x23')](_0x2f9089[_0x41ae('0x56')]):_0x41ae('0x78'));return respondWithRpcPromise('RejectMessage',_0x41ae('0x79'),_0x3cbda1);}return null;})['then'](function(_0xb76f6){var _0x315e2a=_0x41ae('0x7a')+_0xb76f6[_0x41ae('0x26')]['ContactId'];return db[_0x41ae('0x68')][_0x41ae('0x40')](_0x315e2a,{'type':db[_0x41ae('0x7b')][_0x41ae('0x69')][_0x41ae('0x6a')],'raw':!![]})[_0x41ae('0x1d')](function(_0x49d415){return _0x49d415;});})[_0x41ae('0x1d')](function(_0x11c3c0){if(_0x11c3c0){_0x3cbda1[_0x41ae('0x26')][_0x41ae('0x6b')]=_0x11c3c0[0x0];if(!_0x2f9089[_0x41ae('0x56')]['UserId'])return;return db['User'][_0x41ae('0x54')]({'where':{'id':_0x2f9089['body'][_0x41ae('0x5b')],'role':_0x41ae('0x5d')},'attributes':['id',_0x41ae('0x38'),_0x41ae('0x7c'),_0x41ae('0x6d'),'internal'],'raw':!![]});}return null;})[_0x41ae('0x1d')](function(_0x117480){if(!_0x117480)return null;_0x3cbda1[_0x41ae('0x26')][_0x41ae('0x5d')]=_0x117480;return _0x3cbda1;})[_0x41ae('0x1d')](function(_0x5994be){if(_0x5994be){_0x5994be[_0x41ae('0x26')]['interface']=util['format'](_0x41ae('0x7d'),_0x2f9089[_0x41ae('0x5c')][_0x41ae('0x38')]);_0x5994be['message'][_0x41ae('0x71')]=_0x3cbda1[_0x41ae('0x71')];_0x5994be['message'][_0x41ae('0x7e')]=_0x3cbda1[_0x41ae('0x71')];_0x5994be[_0x41ae('0x26')]['event']=_0x41ae('0x33');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_['merge'](_0x3cbda1[_0x41ae('0x26')],JSON[_0x41ae('0x74')](_0x3cbda1[_0x41ae('0x63')][_0x41ae('0x75')]))},client9002);return _0x3cbda1;}return null;})['then'](respondWithResult(_0x203d85,null))[_0x41ae('0x28')](handleError(_0x203d85,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 5b135c3..dbd612f 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 _0xce5a=['hook','exports','../../mysqldb','ChatMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0xb113d7,_0x2fc306){var _0xd5a08d=function(_0x873634){while(--_0x873634){_0xb113d7['push'](_0xb113d7['shift']());}};_0xd5a08d(++_0x2fc306);}(_0xce5a,0xfe));var _0xace5=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0xce5a[_0x5951e8];return _0x20a1f5;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xace5('0x0'))['db'][_0xace5('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xace5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xace5('0x3'),'afterDestroy':_0xace5('0x4')};function emitEvent(_0x5f19f0){return function(_0x1b43ac,_0x463116,_0x53a469){ChatMessageEvents[_0xace5('0x5')](_0x5f19f0+':'+_0x1b43ac['id'],_0x1b43ac);ChatMessageEvents[_0xace5('0x5')](_0x5f19f0,_0x1b43ac);_0x53a469(null);};}for(var e in events){if(events[_0xace5('0x6')](e)){var event=events[e];ChatMessage[_0xace5('0x7')](e,emitEvent(event));}}module[_0xace5('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x4afb=['../../mysqldb','ChatMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x4afb,0x103));var _0xb4af=function(_0xe91559,_0x5ead1f){_0xe91559=_0xe91559-0x0;var _0x3bb7bc=_0x4afb[_0xe91559];return _0x3bb7bc;};'use strict';var EventEmitter=require(_0xb4af('0x0'));var ChatMessage=require(_0xb4af('0x1'))['db'][_0xb4af('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xb4af('0x3')](0x0);var events={'afterCreate':_0xb4af('0x4'),'afterUpdate':_0xb4af('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1f5df1){return function(_0x142ffd,_0x4a8c6e,_0x1a2087){ChatMessageEvents[_0xb4af('0x6')](_0x1f5df1+':'+_0x142ffd['id'],_0x142ffd);ChatMessageEvents[_0xb4af('0x6')](_0x1f5df1,_0x142ffd);_0x1a2087(null);};}for(var e in events){if(events[_0xb4af('0x7')](e)){var event=events[e];ChatMessage[_0xb4af('0x8')](e,emitEvent(event));}}module[_0xb4af('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index dc3ccc6..f67c4ff 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 _0xdec1=['ChatInteractionId','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne'];(function(_0x26073a,_0x4652df){var _0x2ab2ad=function(_0x4a378e){while(--_0x4a378e){_0x26073a['push'](_0x26073a['shift']());}};_0x2ab2ad(++_0x4652df);}(_0xdec1,0x11d));var _0x1dec=function(_0x2c2784,_0x36faed){_0x2c2784=_0x2c2784-0x0;var _0x1a8b32=_0xdec1[_0x2c2784];return _0x1a8b32;};'use strict';var _=require(_0x1dec('0x0'));var util=require('util');var logger=require(_0x1dec('0x1'))(_0x1dec('0x2'));var moment=require(_0x1dec('0x3'));var BPromise=require(_0x1dec('0x4'));var rp=require(_0x1dec('0x5'));var fs=require('fs');var path=require(_0x1dec('0x6'));var rimraf=require(_0x1dec('0x7'));var config=require(_0x1dec('0x8'));var attributes=require(_0x1dec('0x9'));module[_0x1dec('0xa')]=function(_0x8f8be1,_0x108f91){return _0x8f8be1[_0x1dec('0xb')](_0x1dec('0xc'),attributes,{'tableName':_0x1dec('0xd'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x1dec('0xe')],'type':_0x1dec('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49420c,_0x2eca5c,_0x12f4ef){var _0x3aa428=_0x8f8be1[_0x1dec('0x10')];var _0x4c1222=_0x49420c[_0x1dec('0x11')]({'plain':!![]});if(_0x4c1222[_0x1dec('0x12')][_0x1dec('0x13')]()==='in'||_0x4c1222[_0x1dec('0x12')][_0x1dec('0x13')]()==='out'&&!_0x4c1222[_0x1dec('0x14')]&&!_[_0x1dec('0x15')](_0x4c1222[_0x1dec('0x16')])){_0x3aa428[_0x1dec('0x17')][_0x1dec('0x18')]({'where':{'id':_0x4c1222[_0x1dec('0x19')]}})['then'](function(_0x3c1fa5){if(_0x3c1fa5){_0x3c1fa5['update']({'lastMsgAt':_0x4c1222[_0x1dec('0x1a')],'lastMsgDirection':_0x4c1222[_0x1dec('0x12')][_0x1dec('0x13')]()});}})[_0x1dec('0x1b')](function(_0x22656d){console[_0x1dec('0x1c')](_0x22656d);});}_0x12f4ef();}},'charset':_0x1dec('0x1d'),'collate':_0x1dec('0x1e')});}; \ No newline at end of file +var _0x211a=['body','FULLTEXT','get','direction','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','update','createdAt','toLowerCase','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','fti_chat_messages'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x211a,0x64));var _0xa211=function(_0x39277f,_0x460842){_0x39277f=_0x39277f-0x0;var _0xfcf21e=_0x211a[_0x39277f];return _0xfcf21e;};'use strict';var _=require(_0xa211('0x0'));var util=require(_0xa211('0x1'));var logger=require(_0xa211('0x2'))('api');var moment=require(_0xa211('0x3'));var BPromise=require('bluebird');var rp=require(_0xa211('0x4'));var fs=require('fs');var path=require(_0xa211('0x5'));var rimraf=require(_0xa211('0x6'));var config=require(_0xa211('0x7'));var attributes=require(_0xa211('0x8'));module['exports']=function(_0x515097,_0x39913a){return _0x515097[_0xa211('0x9')]('ChatMessage',attributes,{'tableName':_0xa211('0xa'),'paranoid':![],'indexes':[{'name':_0xa211('0xb'),'fields':[_0xa211('0xc')],'type':_0xa211('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5cb5b7,_0x34e093,_0x26b5c6){var _0x3d043b=_0x515097['models'];var _0x2c09fd=_0x5cb5b7[_0xa211('0xe')]({'plain':!![]});if(_0x2c09fd[_0xa211('0xf')]['toLowerCase']()==='in'||_0x2c09fd['direction']['toLowerCase']()===_0xa211('0x10')&&!_0x2c09fd[_0xa211('0x11')]&&!_[_0xa211('0x12')](_0x2c09fd[_0xa211('0x13')])){_0x3d043b[_0xa211('0x14')]['findOne']({'where':{'id':_0x2c09fd[_0xa211('0x15')]}})['then'](function(_0x1d1af6){if(_0x1d1af6){_0x1d1af6[_0xa211('0x16')]({'lastMsgAt':_0x2c09fd[_0xa211('0x17')],'lastMsgDirection':_0x2c09fd[_0xa211('0xf')][_0xa211('0x18')]()});}})[_0xa211('0x19')](function(_0x22c8b9){console[_0xa211('0x1a')](_0x22c8b9);});}_0x26b5c6();}},'charset':'utf8mb4','collate':_0xa211('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index ce2e30d..6d6dced 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 _0x26e4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateChatMessage','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x57c067,_0x147938){var _0x1fb541=function(_0x34fa73){while(--_0x34fa73){_0x57c067['push'](_0x57c067['shift']());}};_0x1fb541(++_0x147938);}(_0x26e4,0xe1));var _0x426e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x26e4[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x426e('0x0'));var util=require('util');var moment=require(_0x426e('0x1'));var BPromise=require(_0x426e('0x2'));var rs=require(_0x426e('0x3'));var fs=require('fs');var Redis=require(_0x426e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x426e('0x5'));var logger=require(_0x426e('0x6'))(_0x426e('0x7'));var config=require(_0x426e('0x8'));var jayson=require(_0x426e('0x9'));var client=jayson[_0x426e('0xa')][_0x426e('0xb')]({'port':0x232a});config[_0x426e('0xc')]=_[_0x426e('0xd')](config[_0x426e('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x426e('0xe'))[_0x426e('0xf')](socket);function respondWithRpcPromise(_0xa1bffd,_0x218bed,_0x4fc6c7){return new BPromise(function(_0xde24ff,_0x37350c){return client[_0x426e('0x10')](_0xa1bffd,_0x4fc6c7)[_0x426e('0x11')](function(_0x458af8){logger['info'](_0x426e('0x12'),_0x218bed,_0x426e('0x13'));logger[_0x426e('0x14')](_0x426e('0x15'),_0x218bed,_0x426e('0x13'),JSON['stringify'](_0x458af8));if(_0x458af8[_0x426e('0x16')]){if(_0x458af8['error'][_0x426e('0x17')]===0x1f4){logger[_0x426e('0x16')]('ChatMessage,\x20%s,\x20%s',_0x218bed,_0x458af8[_0x426e('0x16')][_0x426e('0x18')]);return _0x37350c(_0x458af8['error']['message']);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x218bed,_0x458af8[_0x426e('0x16')][_0x426e('0x18')]);return _0xde24ff(_0x458af8[_0x426e('0x16')][_0x426e('0x18')]);}else{logger[_0x426e('0x19')](_0x426e('0x12'),_0x218bed,_0x426e('0x13'));_0xde24ff(_0x458af8[_0x426e('0x1a')][_0x426e('0x18')]);}})[_0x426e('0x1b')](function(_0x39322d){logger[_0x426e('0x16')](_0x426e('0x12'),_0x218bed,_0x39322d);_0x37350c(_0x39322d);});});}exports[_0x426e('0x1c')]=function(_0x486701){var _0x119cb8=this;return new Promise(function(_0x11a096,_0x23b031){return db['ChatMessage'][_0x426e('0x1d')](_0x486701[_0x426e('0x1e')],{'raw':_0x486701[_0x426e('0x1f')]?_0x486701[_0x426e('0x1f')][_0x426e('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x51cff4){logger[_0x426e('0x19')]('CreateChatMessage',_0x486701);logger['debug'](_0x426e('0x1c'),_0x486701,JSON['stringify'](_0x51cff4));_0x11a096(_0x51cff4);})[_0x426e('0x1b')](function(_0x218024){logger[_0x426e('0x16')](_0x426e('0x1c'),_0x218024[_0x426e('0x18')],_0x486701);_0x23b031(_0x119cb8[_0x426e('0x16')](0x1f4,_0x218024[_0x426e('0x18')]));});});}; \ No newline at end of file +var _0x544f=['debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','body','options','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent'];(function(_0xbfa7ab,_0x95acc9){var _0x5d4e5c=function(_0xa25730){while(--_0xa25730){_0xbfa7ab['push'](_0xbfa7ab['shift']());}};_0x5d4e5c(++_0x95acc9);}(_0x544f,0x104));var _0xf544=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x544f[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require('lodash');var util=require(_0xf544('0x0'));var moment=require('moment');var BPromise=require(_0xf544('0x1'));var rs=require(_0xf544('0x2'));var fs=require('fs');var Redis=require(_0xf544('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf544('0x4'));var logger=require(_0xf544('0x5'))(_0xf544('0x6'));var config=require('../../config/environment');var jayson=require(_0xf544('0x7'));var client=jayson[_0xf544('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xf544('0x9')],{'host':_0xf544('0xa'),'port':0x18eb});var socket=require(_0xf544('0xb'))(new Redis(config['redis']));require(_0xf544('0xc'))[_0xf544('0xd')](socket);function respondWithRpcPromise(_0x281ebe,_0x2c59f0,_0x1b3881){return new BPromise(function(_0x18c671,_0x31e29a){return client[_0xf544('0xe')](_0x281ebe,_0x1b3881)[_0xf544('0xf')](function(_0x283476){logger[_0xf544('0x10')](_0xf544('0x11'),_0x2c59f0,_0xf544('0x12'));logger[_0xf544('0x13')](_0xf544('0x14'),_0x2c59f0,_0xf544('0x12'),JSON[_0xf544('0x15')](_0x283476));if(_0x283476[_0xf544('0x16')]){if(_0x283476[_0xf544('0x16')][_0xf544('0x17')]===0x1f4){logger[_0xf544('0x16')]('ChatMessage,\x20%s,\x20%s',_0x2c59f0,_0x283476['error'][_0xf544('0x18')]);return _0x31e29a(_0x283476['error']['message']);}logger[_0xf544('0x16')](_0xf544('0x11'),_0x2c59f0,_0x283476['error'][_0xf544('0x18')]);return _0x18c671(_0x283476[_0xf544('0x16')][_0xf544('0x18')]);}else{logger[_0xf544('0x10')](_0xf544('0x11'),_0x2c59f0,_0xf544('0x12'));_0x18c671(_0x283476[_0xf544('0x19')][_0xf544('0x18')]);}})[_0xf544('0x1a')](function(_0x30b605){logger[_0xf544('0x16')]('ChatMessage,\x20%s,\x20%s',_0x2c59f0,_0x30b605);_0x31e29a(_0x30b605);});});}exports[_0xf544('0x1b')]=function(_0x57cfb7){var _0x5493c3=this;return new Promise(function(_0x29bc70,_0x4cd4c9){return db[_0xf544('0x1c')]['create'](_0x57cfb7[_0xf544('0x1d')],{'raw':_0x57cfb7['options']?_0x57cfb7[_0xf544('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xf544('0xf')](function(_0x1f4235){logger[_0xf544('0x10')](_0xf544('0x1b'),_0x57cfb7);logger['debug'](_0xf544('0x1b'),_0x57cfb7,JSON[_0xf544('0x15')](_0x1f4235));_0x29bc70(_0x1f4235);})[_0xf544('0x1a')](function(_0x54faee){logger['error'](_0xf544('0x1b'),_0x54faee[_0xf544('0x18')],_0x57cfb7);_0x4cd4c9(_0x5493c3['error'](0x1f4,_0x54faee[_0xf544('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index ee852c2..70ee429 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 _0x7da7=['save','remove','register','chatMessage:','./chatMessage.events'];(function(_0x78dc83,_0x3c0e2f){var _0x6532ee=function(_0x247a8f){while(--_0x247a8f){_0x78dc83['push'](_0x78dc83['shift']());}};_0x6532ee(++_0x3c0e2f);}(_0x7da7,0x10d));var _0x77da=function(_0x3a21c0,_0x348451){_0x3a21c0=_0x3a21c0-0x0;var _0x411e84=_0x7da7[_0x3a21c0];return _0x411e84;};'use strict';var ChatMessageEvents=require(_0x77da('0x0'));var events=[_0x77da('0x1'),_0x77da('0x2'),'update'];function createListener(_0x59892b,_0x37667b){return function(_0xaaefb1){_0x37667b['emit'](_0x59892b,_0xaaefb1);};}function removeListener(_0x3a9fa6,_0x37b3d9){return function(){ChatMessageEvents['removeListener'](_0x3a9fa6,_0x37b3d9);};}exports[_0x77da('0x3')]=function(_0xc54a12){for(var _0x47da81=0x0,_0x30afe0=events['length'];_0x47da81<_0x30afe0;_0x47da81++){var _0x1191de=events[_0x47da81];var _0x13992e=createListener(_0x77da('0x4')+_0x1191de,_0xc54a12);ChatMessageEvents['on'](_0x1191de,_0x13992e);}}; \ No newline at end of file +var _0xf2cf=['save','remove','update','emit','removeListener','length','chatMessage:'];(function(_0x3041c6,_0x4dee4e){var _0x268ad8=function(_0x44ddee){while(--_0x44ddee){_0x3041c6['push'](_0x3041c6['shift']());}};_0x268ad8(++_0x4dee4e);}(_0xf2cf,0xf5));var _0xff2c=function(_0x534084,_0x4ea0f6){_0x534084=_0x534084-0x0;var _0x333cbf=_0xf2cf[_0x534084];return _0x333cbf;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xff2c('0x0'),_0xff2c('0x1'),_0xff2c('0x2')];function createListener(_0x5ef2da,_0x8c6724){return function(_0x3d98a5){_0x8c6724[_0xff2c('0x3')](_0x5ef2da,_0x3d98a5);};}function removeListener(_0x2ff0e4,_0x189ac6){return function(){ChatMessageEvents[_0xff2c('0x4')](_0x2ff0e4,_0x189ac6);};}exports['register']=function(_0x8f0f4){for(var _0x68b356=0x0,_0x57ba3d=events[_0xff2c('0x5')];_0x68b356<_0x57ba3d;_0x68b356++){var _0x223a86=events[_0x68b356];var _0x105f4d=createListener(_0xff2c('0x6')+_0x223a86,_0x8f0f4);ChatMessageEvents['on'](_0x223a86,_0x105f4d);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 372c111..f812377 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 _0x958d=['accept','/:id/reject','reject','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','describe','/:id','post','tracked','chat','create','put','update','/:id/accept'];(function(_0x14114a,_0x143008){var _0x212e1f=function(_0x15b714){while(--_0x15b714){_0x14114a['push'](_0x14114a['shift']());}};_0x212e1f(++_0x143008);}(_0x958d,0xb3));var _0xd958=function(_0xe4da3a,_0x701be1){_0xe4da3a=_0xe4da3a-0x0;var _0x53de02=_0x958d[_0xe4da3a];return _0x53de02;};'use strict';var multer=require(_0xd958('0x0'));var util=require(_0xd958('0x1'));var path=require(_0xd958('0x2'));var timeout=require('connect-timeout');var express=require(_0xd958('0x3'));var router=express[_0xd958('0x4')]();var fs_extra=require(_0xd958('0x5'));var auth=require(_0xd958('0x6'));var interaction=require(_0xd958('0x7'));var config=require('../../config/environment');var controller=require(_0xd958('0x8'));router[_0xd958('0x9')]('/',auth[_0xd958('0xa')](),controller[_0xd958('0xb')]);router[_0xd958('0x9')]('/describe',auth[_0xd958('0xa')](),controller[_0xd958('0xc')]);router['get'](_0xd958('0xd'),auth[_0xd958('0xa')](),controller['show']);router[_0xd958('0xe')]('/',auth[_0xd958('0xa')](),interaction[_0xd958('0xf')](_0xd958('0x10'),'chatmessage:create'),controller[_0xd958('0x11')]);router[_0xd958('0x12')]('/:id',controller[_0xd958('0x13')]);router['put'](_0xd958('0x14'),auth[_0xd958('0xa')](),controller[_0xd958('0x15')]);router[_0xd958('0x12')](_0xd958('0x16'),auth[_0xd958('0xa')](),controller[_0xd958('0x17')]);router[_0xd958('0x18')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4b7b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','/:id','destroy','util','path','connect-timeout'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x4b7b,0xc8));var _0xb4b7=function(_0x586f76,_0x4f534c){_0x586f76=_0x586f76-0x0;var _0x298810=_0x4b7b[_0x586f76];return _0x298810;};'use strict';var multer=require('multer');var util=require(_0xb4b7('0x0'));var path=require(_0xb4b7('0x1'));var timeout=require(_0xb4b7('0x2'));var express=require(_0xb4b7('0x3'));var router=express[_0xb4b7('0x4')]();var fs_extra=require(_0xb4b7('0x5'));var auth=require(_0xb4b7('0x6'));var interaction=require(_0xb4b7('0x7'));var config=require(_0xb4b7('0x8'));var controller=require(_0xb4b7('0x9'));router[_0xb4b7('0xa')]('/',auth[_0xb4b7('0xb')](),controller[_0xb4b7('0xc')]);router[_0xb4b7('0xa')](_0xb4b7('0xd'),auth[_0xb4b7('0xb')](),controller[_0xb4b7('0xe')]);router['get']('/:id',auth[_0xb4b7('0xb')](),controller[_0xb4b7('0xf')]);router[_0xb4b7('0x10')]('/',auth[_0xb4b7('0xb')](),interaction[_0xb4b7('0x11')](_0xb4b7('0x12'),_0xb4b7('0x13')),controller[_0xb4b7('0x14')]);router[_0xb4b7('0x15')]('/:id',controller[_0xb4b7('0x16')]);router[_0xb4b7('0x15')](_0xb4b7('0x17'),auth[_0xb4b7('0xb')](),controller['accept']);router[_0xb4b7('0x15')](_0xb4b7('0x18'),auth[_0xb4b7('0xb')](),controller[_0xb4b7('0x19')]);router[_0xb4b7('0x1a')](_0xb4b7('0x1b'),auth[_0xb4b7('0xb')](),controller[_0xb4b7('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index eddf552..25720e1 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 _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x47378a,_0x20bc70){var _0x120fdb=function(_0x2885ec){while(--_0x2885ec){_0x47378a['push'](_0x47378a['shift']());}};_0x120fdb(++_0x20bc70);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2f368d,_0x419bc2){_0x2f368d=_0x2f368d-0x0;var _0x14860b=_0x5f2f[_0x2f368d];return _0x14860b;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['medium','TEXT','exports'];(function(_0x116ffd,_0x3b1b3b){var _0x3850a8=function(_0x2db10f){while(--_0x2db10f){_0x116ffd['push'](_0x116ffd['shift']());}};_0x3850a8(++_0x3b1b3b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index cd8641f..630ad83 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(_0x540824,_0x3b1ae6){var _0x17134b=function(_0x2fec92){while(--_0x2fec92){_0x540824['push'](_0x540824['shift']());}};_0x17134b(++_0x3b1ae6);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x7a54,0x106));var _0x47a5=function(_0x17a0ec,_0x28edb8){_0x17a0ec=_0x17a0ec-0x0;var _0x30137d=_0x7a54[_0x17a0ec];return _0x30137d;};'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 b2d7d26..621d153 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 _0x02b6=['hook','exports','events','ChatOfflineMessage','setMaxListeners','save','emit'];(function(_0x3194b5,_0x495239){var _0x50f2dc=function(_0x13abed){while(--_0x13abed){_0x3194b5['push'](_0x3194b5['shift']());}};_0x50f2dc(++_0x495239);}(_0x02b6,0xfe));var _0x602b=function(_0x3a5715,_0x3d13e6){_0x3a5715=_0x3a5715-0x0;var _0x3460a9=_0x02b6[_0x3a5715];return _0x3460a9;};'use strict';var EventEmitter=require(_0x602b('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x602b('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x602b('0x2')](0x0);var events={'afterCreate':_0x602b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x8291f){return function(_0x31f4a4,_0x33cc82,_0x2eec97){ChatOfflineMessageEvents['emit'](_0x8291f+':'+_0x31f4a4['id'],_0x31f4a4);ChatOfflineMessageEvents[_0x602b('0x4')](_0x8291f,_0x31f4a4);_0x2eec97(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x602b('0x5')](e,emitEvent(event));}}module[_0x602b('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xa490=['hook','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x8d0828,_0x1e830b){var _0x402fc4=function(_0x48e474){while(--_0x48e474){_0x8d0828['push'](_0x8d0828['shift']());}};_0x402fc4(++_0x1e830b);}(_0xa490,0x14e));var _0x0a49=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa490[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x0a49('0x0'));var ChatOfflineMessage=require(_0x0a49('0x1'))['db'][_0x0a49('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x0a49('0x3')](0x0);var events={'afterCreate':_0x0a49('0x4'),'afterUpdate':'update','afterDestroy':_0x0a49('0x5')};function emitEvent(_0x39bccc){return function(_0x12660d,_0x5a58f0,_0x414d45){ChatOfflineMessageEvents[_0x0a49('0x6')](_0x39bccc+':'+_0x12660d['id'],_0x12660d);ChatOfflineMessageEvents[_0x0a49('0x6')](_0x39bccc,_0x12660d);_0x414d45(null);};}for(var e in events){if(events[_0x0a49('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x0a49('0x8')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 6b0d17b..7985e27 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 _0xc998=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc998,0xe4));var _0x8c99=function(_0x28acd6,_0x1ea44b){_0x28acd6=_0x28acd6-0x0;var _0x49e00d=_0xc998[_0x28acd6];return _0x49e00d;};'use strict';var attributes=require(_0x8c99('0x0'));module[_0x8c99('0x1')]=function(_0x4d9209){return _0x4d9209[_0x8c99('0x2')](_0x8c99('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8c99('0x4'),'collate':_0x8c99('0x5')});}; \ No newline at end of file +var _0xb6f8=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb6f8,0xcd));var _0x8b6f=function(_0x4dfd70,_0x35e8d2){_0x4dfd70=_0x4dfd70-0x0;var _0x48d818=_0xb6f8[_0x4dfd70];return _0x48d818;};'use strict';var attributes=require(_0x8b6f('0x0'));module[_0x8b6f('0x1')]=function(_0x1fc116){return _0x1fc116[_0x8b6f('0x2')](_0x8b6f('0x3'),attributes,{'tableName':_0x8b6f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8b6f('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index af7d13b..0ce9bfc 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 _0x9aed=['message','result','catch','moment','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x50ef26,_0x10e500){var _0x34c395=function(_0x53b312){while(--_0x53b312){_0x50ef26['push'](_0x50ef26['shift']());}};_0x34c395(++_0x10e500);}(_0x9aed,0x9c));var _0xd9ae=function(_0x43a464,_0xeea76d){_0x43a464=_0x43a464-0x0;var _0x38d98a=_0x9aed[_0x43a464];return _0x38d98a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd9ae('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9ae('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd9ae('0x2'))(_0xd9ae('0x3'));var config=require(_0xd9ae('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xd9ae('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39c9e7,_0x344903,_0xa638c9){return new BPromise(function(_0x2ec7a4,_0x243e6c){return client['request'](_0x39c9e7,_0xa638c9)[_0xd9ae('0x6')](function(_0x290eb3){logger[_0xd9ae('0x7')](_0xd9ae('0x8'),_0x344903,_0xd9ae('0x9'));logger['debug'](_0xd9ae('0xa'),_0x344903,_0xd9ae('0x9'),JSON[_0xd9ae('0xb')](_0x290eb3));if(_0x290eb3[_0xd9ae('0xc')]){if(_0x290eb3['error'][_0xd9ae('0xd')]===0x1f4){logger[_0xd9ae('0xc')](_0xd9ae('0x8'),_0x344903,_0x290eb3['error'][_0xd9ae('0xe')]);return _0x243e6c(_0x290eb3[_0xd9ae('0xc')][_0xd9ae('0xe')]);}logger['error'](_0xd9ae('0x8'),_0x344903,_0x290eb3['error'][_0xd9ae('0xe')]);return _0x2ec7a4(_0x290eb3[_0xd9ae('0xc')]['message']);}else{logger[_0xd9ae('0x7')]('ChatOfflineMessage,\x20%s,\x20%s',_0x344903,_0xd9ae('0x9'));_0x2ec7a4(_0x290eb3[_0xd9ae('0xf')][_0xd9ae('0xe')]);}})[_0xd9ae('0x10')](function(_0x46450e){logger[_0xd9ae('0xc')](_0xd9ae('0x8'),_0x344903,_0x46450e);_0x243e6c(_0x46450e);});});} \ No newline at end of file +var _0xe5e7=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x3f3c46,_0x33e972){var _0x7d1132=function(_0x2c7b56){while(--_0x2c7b56){_0x3f3c46['push'](_0x3f3c46['shift']());}};_0x7d1132(++_0x33e972);}(_0xe5e7,0x10d));var _0x7e5e=function(_0x154746,_0x58b3e8){_0x154746=_0x154746-0x0;var _0x1b9722=_0xe5e7[_0x154746];return _0x1b9722;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7e5e('0x0'));var BPromise=require(_0x7e5e('0x1'));var rs=require(_0x7e5e('0x2'));var fs=require('fs');var Redis=require(_0x7e5e('0x3'));var db=require(_0x7e5e('0x4'))['db'];var utils=require(_0x7e5e('0x5'));var logger=require(_0x7e5e('0x6'))(_0x7e5e('0x7'));var config=require(_0x7e5e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7e5e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x555fae,_0x33ca4a,_0x3c72af){return new BPromise(function(_0x16823b,_0x2b9a0f){return client[_0x7e5e('0xa')](_0x555fae,_0x3c72af)['then'](function(_0x568bc6){logger[_0x7e5e('0xb')](_0x7e5e('0xc'),_0x33ca4a,_0x7e5e('0xd'));logger['debug'](_0x7e5e('0xe'),_0x33ca4a,_0x7e5e('0xd'),JSON['stringify'](_0x568bc6));if(_0x568bc6['error']){if(_0x568bc6['error']['code']===0x1f4){logger[_0x7e5e('0xf')](_0x7e5e('0xc'),_0x33ca4a,_0x568bc6[_0x7e5e('0xf')][_0x7e5e('0x10')]);return _0x2b9a0f(_0x568bc6[_0x7e5e('0xf')][_0x7e5e('0x10')]);}logger[_0x7e5e('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x33ca4a,_0x568bc6[_0x7e5e('0xf')][_0x7e5e('0x10')]);return _0x16823b(_0x568bc6['error']['message']);}else{logger[_0x7e5e('0xb')](_0x7e5e('0xc'),_0x33ca4a,_0x7e5e('0xd'));_0x16823b(_0x568bc6[_0x7e5e('0x11')]['message']);}})[_0x7e5e('0x12')](function(_0x1f26b6){logger[_0x7e5e('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x33ca4a,_0x1f26b6);_0x2b9a0f(_0x1f26b6);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index b8cc221..c30c8ca 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 _0xc665=['path','express','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','multer','util'];(function(_0x2ca83c,_0x45190a){var _0xe0648f=function(_0x4f8247){while(--_0x4f8247){_0x2ca83c['push'](_0x2ca83c['shift']());}};_0xe0648f(++_0x45190a);}(_0xc665,0x19e));var _0x5c66=function(_0x4c4cbf,_0x1e6e6){_0x4c4cbf=_0x4c4cbf-0x0;var _0xa65774=_0xc665[_0x4c4cbf];return _0xa65774;};'use strict';var multer=require(_0x5c66('0x0'));var util=require(_0x5c66('0x1'));var path=require(_0x5c66('0x2'));var timeout=require('connect-timeout');var express=require(_0x5c66('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5c66('0x4'));var controller=require(_0x5c66('0x5'));router[_0x5c66('0x6')]('/',auth[_0x5c66('0x7')](),controller[_0x5c66('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x5c66('0x7')](),controller[_0x5c66('0x9')]);router['post']('/',auth[_0x5c66('0x7')](),controller[_0x5c66('0xa')]);router[_0x5c66('0xb')](_0x5c66('0xc'),auth[_0x5c66('0x7')](),controller[_0x5c66('0xd')]);router[_0x5c66('0xe')](_0x5c66('0xc'),auth[_0x5c66('0x7')](),controller[_0x5c66('0xf')]);module['exports']=router; \ No newline at end of file +var _0x4b2a=['../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','show','create','put','update','delete','/:id','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3e35e8,_0x17fd7e){var _0xbb61e7=function(_0x3d03fb){while(--_0x3d03fb){_0x3e35e8['push'](_0x3e35e8['shift']());}};_0xbb61e7(++_0x17fd7e);}(_0x4b2a,0x7d));var _0xa4b2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4b2a[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xa4b2('0x0'));var util=require(_0xa4b2('0x1'));var path=require(_0xa4b2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa4b2('0x3')]();var fs_extra=require(_0xa4b2('0x4'));var auth=require(_0xa4b2('0x5'));var interaction=require(_0xa4b2('0x6'));var config=require(_0xa4b2('0x7'));var controller=require(_0xa4b2('0x8'));router[_0xa4b2('0x9')]('/',auth['isAuthenticated'](),controller[_0xa4b2('0xa')]);router[_0xa4b2('0x9')](_0xa4b2('0xb'),auth[_0xa4b2('0xc')](),controller[_0xa4b2('0xd')]);router[_0xa4b2('0x9')]('/:id',auth[_0xa4b2('0xc')](),controller[_0xa4b2('0xe')]);router['post']('/',auth[_0xa4b2('0xc')](),controller[_0xa4b2('0xf')]);router[_0xa4b2('0x10')]('/:id',auth[_0xa4b2('0xc')](),controller[_0xa4b2('0x11')]);router[_0xa4b2('0x12')](_0xa4b2('0x13'),auth[_0xa4b2('0xc')](),controller[_0xa4b2('0x14')]);module[_0xa4b2('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 38eb5ed..7106bcb 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 _0x760b=['sequelize','exports','ENUM','timeout','mouseOver','STRING'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x760b,0x14a));var _0xb760=function(_0x470cae,_0x82f4a2){_0x470cae=_0x470cae-0x0;var _0x11e17e=_0x760b[_0x470cae];return _0x11e17e;};'use strict';var Sequelize=require(_0xb760('0x0'));module[_0xb760('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb760('0x2')]('mouseOver',_0xb760('0x3')),'defaultValue':_0xb760('0x4')},'selector':{'type':Sequelize[_0xb760('0x5')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x547c=['mouseOver','timeout','STRING','INTEGER','ENUM'];(function(_0x499968,_0x4540c7){var _0x559f0b=function(_0x391904){while(--_0x391904){_0x499968['push'](_0x499968['shift']());}};_0x559f0b(++_0x4540c7);}(_0x547c,0xa4));var _0xc547=function(_0x2f6136,_0x274ed2){_0x2f6136=_0x2f6136-0x0;var _0x5ac67b=_0x547c[_0x2f6136];return _0x5ac67b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc547('0x0')](_0xc547('0x1'),_0xc547('0x2')),'defaultValue':_0xc547('0x1')},'selector':{'type':Sequelize[_0xc547('0x3')]},'timeout':{'type':Sequelize[_0xc547('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 8b3d28a..a98967e 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 _0x9417=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','show','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x5cd042,_0xba348){var _0x10490b=function(_0xce382f){while(--_0xce382f){_0x5cd042['push'](_0x5cd042['shift']());}};_0x10490b(++_0xba348);}(_0x9417,0xb4));var _0x7941=function(_0x9fb081,_0x48f480){_0x9fb081=_0x9fb081-0x0;var _0x43f8b0=_0x9417[_0x9fb081];return _0x43f8b0;};'use strict';var emlformat=require(_0x7941('0x0'));var rimraf=require(_0x7941('0x1'));var zipdir=require(_0x7941('0x2'));var jsonpatch=require(_0x7941('0x3'));var rp=require('request-promise');var moment=require(_0x7941('0x4'));var BPromise=require(_0x7941('0x5'));var Mustache=require(_0x7941('0x6'));var util=require(_0x7941('0x7'));var path=require(_0x7941('0x8'));var sox=require(_0x7941('0x9'));var csv=require(_0x7941('0xa'));var ejs=require(_0x7941('0xb'));var fs=require('fs');var fs_extra=require(_0x7941('0xc'));var _=require(_0x7941('0xd'));var squel=require('squel');var crypto=require(_0x7941('0xe'));var jsforce=require(_0x7941('0xf'));var deskjs=require(_0x7941('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7941('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7941('0x12'));var qs=require(_0x7941('0x13'));var as=require(_0x7941('0x14'));var hardwareService=require(_0x7941('0x15'));var logger=require(_0x7941('0x16'))(_0x7941('0x17'));var utils=require(_0x7941('0x18'));var config=require(_0x7941('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7941('0x1a'))['db'];function respondWithStatusCode(_0x51aab8,_0x12b674){_0x12b674=_0x12b674||0xcc;return function(_0x46a86a){if(_0x46a86a){return _0x51aab8['sendStatus'](_0x12b674);}return _0x51aab8['status'](_0x12b674)[_0x7941('0x1b')]();};}function respondWithResult(_0x59f371,_0x18936d){_0x18936d=_0x18936d||0xc8;return function(_0x45c08f){if(_0x45c08f){return _0x59f371[_0x7941('0x1c')](_0x18936d)[_0x7941('0x1d')](_0x45c08f);}};}function respondWithFilteredResult(_0x1da410,_0x41b098){return function(_0x55320b){if(_0x55320b){var _0x11623c=typeof _0x41b098[_0x7941('0x1e')]===_0x7941('0x1f')&&typeof _0x41b098[_0x7941('0x20')]===_0x7941('0x1f');var _0x256f45=_0x55320b[_0x7941('0x21')];var _0x573b44=_0x11623c?0x0:_0x41b098[_0x7941('0x1e')];var _0x533559=_0x11623c?_0x55320b['count']:_0x41b098[_0x7941('0x1e')]+_0x41b098['limit'];var _0x17442f;if(_0x533559>=_0x256f45){_0x533559=_0x256f45;_0x17442f=0xc8;}else{_0x17442f=0xce;}_0x1da410[_0x7941('0x1c')](_0x17442f);return _0x1da410[_0x7941('0x22')]('Content-Range',_0x573b44+'-'+_0x533559+'/'+_0x256f45)['json'](_0x55320b);}return null;};}function patchUpdates(_0x645e4c){return function(_0x4d3b28){try{jsonpatch[_0x7941('0x23')](_0x4d3b28,_0x645e4c,!![]);}catch(_0x57809b){return BPromise[_0x7941('0x24')](_0x57809b);}return _0x4d3b28[_0x7941('0x25')]();};}function saveUpdates(_0x42ff1f,_0x45ae78){return function(_0x3c2ae5){if(_0x3c2ae5){return _0x3c2ae5[_0x7941('0x26')](_0x42ff1f)[_0x7941('0x27')](function(_0x5287e0){return _0x5287e0;});}return null;};}function removeEntity(_0x20dd64,_0x531f20){return function(_0x36ff77){if(_0x36ff77){return _0x36ff77[_0x7941('0x28')]()[_0x7941('0x27')](function(){_0x20dd64[_0x7941('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55f679,_0x1e61e0){return function(_0x5ad836){if(!_0x5ad836){_0x55f679['sendStatus'](0x194);}return _0x5ad836;};}function handleError(_0x5f09c1,_0x43caf0){_0x43caf0=_0x43caf0||0x1f4;return function(_0x1b59e2){logger[_0x7941('0x29')](_0x1b59e2[_0x7941('0x2a')]);if(_0x1b59e2[_0x7941('0x2b')]){delete _0x1b59e2['name'];}_0x5f09c1[_0x7941('0x1c')](_0x43caf0)[_0x7941('0x2c')](_0x1b59e2);};}exports[_0x7941('0x2d')]=function(_0x240052,_0x23f617){var _0x24cc75={'raw':!![],'where':{'id':_0x240052['params']['id']}},_0xd2b022={};_0xd2b022[_0x7941('0x2e')]=_[_0x7941('0x2f')](db[_0x7941('0x30')]['rawAttributes']);_0xd2b022[_0x7941('0x31')]=_['keys'](_0x240052[_0x7941('0x31')]);_0xd2b022[_0x7941('0x32')]=_[_0x7941('0x33')](_0xd2b022['model'],_0xd2b022[_0x7941('0x31')]);_0x24cc75[_0x7941('0x34')]=_['intersection'](_0xd2b022[_0x7941('0x2e')],qs[_0x7941('0x35')](_0x240052['query'][_0x7941('0x35')]));_0x24cc75[_0x7941('0x34')]=_0x24cc75['attributes'][_0x7941('0x36')]?_0x24cc75[_0x7941('0x34')]:_0xd2b022[_0x7941('0x2e')];if(_0x240052[_0x7941('0x31')][_0x7941('0x37')]){_0x24cc75[_0x7941('0x38')]=[{'all':!![]}];}_0x24cc75=_[_0x7941('0x39')]({},_0x24cc75,_0x240052['options']);return db[_0x7941('0x30')][_0x7941('0x3a')](_0x24cc75)['then'](handleEntityNotFound(_0x23f617,null))[_0x7941('0x27')](respondWithResult(_0x23f617,null))[_0x7941('0x3b')](handleError(_0x23f617,null));};exports[_0x7941('0x3c')]=function(_0x1d03d7,_0x1173b8){return db[_0x7941('0x30')]['create'](_0x1d03d7[_0x7941('0x3d')],{})[_0x7941('0x27')](respondWithResult(_0x1173b8,0xc9))[_0x7941('0x3b')](handleError(_0x1173b8,null));};exports[_0x7941('0x26')]=function(_0x469317,_0x1ff304){if(_0x469317[_0x7941('0x3d')]['id']){delete _0x469317['body']['id'];}return db[_0x7941('0x30')][_0x7941('0x3a')]({'where':{'id':_0x469317['params']['id']}})['then'](handleEntityNotFound(_0x1ff304,null))[_0x7941('0x27')](saveUpdates(_0x469317[_0x7941('0x3d')],null))[_0x7941('0x27')](respondWithResult(_0x1ff304,null))[_0x7941('0x3b')](handleError(_0x1ff304,null));};exports[_0x7941('0x28')]=function(_0x2a59f6,_0x234554){return db[_0x7941('0x30')]['find']({'where':{'id':_0x2a59f6[_0x7941('0x3e')]['id']}})['then'](handleEntityNotFound(_0x234554,null))[_0x7941('0x27')](removeEntity(_0x234554,null))[_0x7941('0x3b')](handleError(_0x234554,null));}; \ No newline at end of file +var _0x8098=['end','error','stack','name','send','params','keys','rawAttributes','query','intersection','model','attributes','fields','length','merge','ChatProactiveAction','catch','create','body','update','find','destroy','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x8098,0x1ba));var _0x8809=function(_0x346178,_0xc7c30b){_0x346178=_0x346178-0x0;var _0x201712=_0x8098[_0x346178];return _0x201712;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8809('0x0'));var jsonpatch=require(_0x8809('0x1'));var rp=require(_0x8809('0x2'));var moment=require(_0x8809('0x3'));var BPromise=require(_0x8809('0x4'));var Mustache=require('mustache');var util=require(_0x8809('0x5'));var path=require(_0x8809('0x6'));var sox=require(_0x8809('0x7'));var csv=require(_0x8809('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8809('0x9'));var _=require(_0x8809('0xa'));var squel=require('squel');var crypto=require(_0x8809('0xb'));var jsforce=require(_0x8809('0xc'));var deskjs=require(_0x8809('0xd'));var toCsv=require(_0x8809('0x8'));var querystring=require(_0x8809('0xe'));var Papa=require(_0x8809('0xf'));var Redis=require(_0x8809('0x10'));var authService=require(_0x8809('0x11'));var qs=require(_0x8809('0x12'));var as=require(_0x8809('0x13'));var hardwareService=require(_0x8809('0x14'));var logger=require(_0x8809('0x15'))(_0x8809('0x16'));var utils=require(_0x8809('0x17'));var config=require(_0x8809('0x18'));var licenseUtil=require(_0x8809('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x388b99,_0x455989){_0x455989=_0x455989||0xcc;return function(_0x4d3b4c){if(_0x4d3b4c){return _0x388b99[_0x8809('0x1a')](_0x455989);}return _0x388b99[_0x8809('0x1b')](_0x455989)['end']();};}function respondWithResult(_0x5d87df,_0x316f2c){_0x316f2c=_0x316f2c||0xc8;return function(_0x2e4279){if(_0x2e4279){return _0x5d87df[_0x8809('0x1b')](_0x316f2c)[_0x8809('0x1c')](_0x2e4279);}};}function respondWithFilteredResult(_0x131716,_0x3d4d7e){return function(_0x105bec){if(_0x105bec){var _0x5624b5=typeof _0x3d4d7e[_0x8809('0x1d')]===_0x8809('0x1e')&&typeof _0x3d4d7e['limit']===_0x8809('0x1e');var _0x369d58=_0x105bec['count'];var _0x3b0562=_0x5624b5?0x0:_0x3d4d7e[_0x8809('0x1d')];var _0x7ec1a6=_0x5624b5?_0x105bec[_0x8809('0x1f')]:_0x3d4d7e[_0x8809('0x1d')]+_0x3d4d7e['limit'];var _0x4826e2;if(_0x7ec1a6>=_0x369d58){_0x7ec1a6=_0x369d58;_0x4826e2=0xc8;}else{_0x4826e2=0xce;}_0x131716[_0x8809('0x1b')](_0x4826e2);return _0x131716[_0x8809('0x20')](_0x8809('0x21'),_0x3b0562+'-'+_0x7ec1a6+'/'+_0x369d58)[_0x8809('0x1c')](_0x105bec);}return null;};}function patchUpdates(_0x2ff4a1){return function(_0x91de1e){try{jsonpatch[_0x8809('0x22')](_0x91de1e,_0x2ff4a1,!![]);}catch(_0x404be9){return BPromise[_0x8809('0x23')](_0x404be9);}return _0x91de1e[_0x8809('0x24')]();};}function saveUpdates(_0x16893a,_0x1440aa){return function(_0x26b43e){if(_0x26b43e){return _0x26b43e['update'](_0x16893a)['then'](function(_0x34d2df){return _0x34d2df;});}return null;};}function removeEntity(_0x5984c6,_0x521840){return function(_0x54ddd8){if(_0x54ddd8){return _0x54ddd8['destroy']()[_0x8809('0x25')](function(){_0x5984c6[_0x8809('0x1b')](0xcc)[_0x8809('0x26')]();});}};}function handleEntityNotFound(_0x2bbf26,_0x2947f7){return function(_0x3d21fd){if(!_0x3d21fd){_0x2bbf26[_0x8809('0x1a')](0x194);}return _0x3d21fd;};}function handleError(_0x14f545,_0x125776){_0x125776=_0x125776||0x1f4;return function(_0x6e5dc8){logger[_0x8809('0x27')](_0x6e5dc8[_0x8809('0x28')]);if(_0x6e5dc8['name']){delete _0x6e5dc8[_0x8809('0x29')];}_0x14f545[_0x8809('0x1b')](_0x125776)[_0x8809('0x2a')](_0x6e5dc8);};}exports['show']=function(_0x13d74b,_0x443741){var _0xbba52b={'raw':!![],'where':{'id':_0x13d74b[_0x8809('0x2b')]['id']}},_0x296187={};_0x296187['model']=_[_0x8809('0x2c')](db['ChatProactiveAction'][_0x8809('0x2d')]);_0x296187[_0x8809('0x2e')]=_['keys'](_0x13d74b[_0x8809('0x2e')]);_0x296187['filters']=_[_0x8809('0x2f')](_0x296187[_0x8809('0x30')],_0x296187[_0x8809('0x2e')]);_0xbba52b[_0x8809('0x31')]=_[_0x8809('0x2f')](_0x296187[_0x8809('0x30')],qs['fields'](_0x13d74b['query'][_0x8809('0x32')]));_0xbba52b[_0x8809('0x31')]=_0xbba52b[_0x8809('0x31')][_0x8809('0x33')]?_0xbba52b[_0x8809('0x31')]:_0x296187['model'];if(_0x13d74b[_0x8809('0x2e')]['includeAll']){_0xbba52b['include']=[{'all':!![]}];}_0xbba52b=_[_0x8809('0x34')]({},_0xbba52b,_0x13d74b['options']);return db[_0x8809('0x35')]['find'](_0xbba52b)[_0x8809('0x25')](handleEntityNotFound(_0x443741,null))[_0x8809('0x25')](respondWithResult(_0x443741,null))[_0x8809('0x36')](handleError(_0x443741,null));};exports[_0x8809('0x37')]=function(_0x27565c,_0x29c522){return db['ChatProactiveAction'][_0x8809('0x37')](_0x27565c[_0x8809('0x38')],{})['then'](respondWithResult(_0x29c522,0xc9))[_0x8809('0x36')](handleError(_0x29c522,null));};exports[_0x8809('0x39')]=function(_0x4a09a,_0x2f584f){if(_0x4a09a[_0x8809('0x38')]['id']){delete _0x4a09a[_0x8809('0x38')]['id'];}return db['ChatProactiveAction'][_0x8809('0x3a')]({'where':{'id':_0x4a09a[_0x8809('0x2b')]['id']}})[_0x8809('0x25')](handleEntityNotFound(_0x2f584f,null))[_0x8809('0x25')](saveUpdates(_0x4a09a[_0x8809('0x38')],null))[_0x8809('0x25')](respondWithResult(_0x2f584f,null))[_0x8809('0x36')](handleError(_0x2f584f,null));};exports[_0x8809('0x3b')]=function(_0x4e73ff,_0x13b530){return db[_0x8809('0x35')][_0x8809('0x3a')]({'where':{'id':_0x4e73ff[_0x8809('0x2b')]['id']}})['then'](handleEntityNotFound(_0x13b530,null))[_0x8809('0x25')](removeEntity(_0x13b530,null))[_0x8809('0x36')](handleError(_0x13b530,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 0a5feba..fa0b040 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 _0xe272=['rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x25c659,_0x553ea8){var _0x14fee9=function(_0x17403c){while(--_0x17403c){_0x25c659['push'](_0x25c659['shift']());}};_0x14fee9(++_0x553ea8);}(_0xe272,0x1e7));var _0x2e27=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xe272[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x2e27('0x0'));var util=require(_0x2e27('0x1'));var logger=require(_0x2e27('0x2'))(_0x2e27('0x3'));var moment=require(_0x2e27('0x4'));var BPromise=require(_0x2e27('0x5'));var rp=require(_0x2e27('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e27('0x7'));var config=require(_0x2e27('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0x2e27('0x9')]=function(_0x4a66dc,_0x307412){return _0x4a66dc[_0x2e27('0xa')](_0x2e27('0xb'),attributes,{'tableName':_0x2e27('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bc0=['ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','define'];(function(_0x3ad459,_0x2fb428){var _0x11d0d3=function(_0xb0c9f0){while(--_0xb0c9f0){_0x3ad459['push'](_0x3ad459['shift']());}};_0x11d0d3(++_0x2fb428);}(_0x8bc0,0x12d));var _0x08bc=function(_0x508c0e,_0x511e38){_0x508c0e=_0x508c0e-0x0;var _0x5532a2=_0x8bc0[_0x508c0e];return _0x5532a2;};'use strict';var _=require(_0x08bc('0x0'));var util=require(_0x08bc('0x1'));var logger=require(_0x08bc('0x2'))(_0x08bc('0x3'));var moment=require('moment');var BPromise=require(_0x08bc('0x4'));var rp=require(_0x08bc('0x5'));var fs=require('fs');var path=require(_0x08bc('0x6'));var rimraf=require(_0x08bc('0x7'));var config=require(_0x08bc('0x8'));var attributes=require(_0x08bc('0x9'));module['exports']=function(_0x3b9298,_0x1a9cab){return _0x3b9298[_0x08bc('0xa')](_0x08bc('0xb'),attributes,{'tableName':_0x08bc('0xc'),'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 3adb5c1..a94e270 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 _0x682e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x682e,0x119));var _0xe682=function(_0xfb2f7d,_0x58d8fa){_0xfb2f7d=_0xfb2f7d-0x0;var _0x164866=_0x682e[_0xfb2f7d];return _0x164866;};'use strict';var _=require(_0xe682('0x0'));var util=require('util');var moment=require(_0xe682('0x1'));var BPromise=require(_0xe682('0x2'));var rs=require(_0xe682('0x3'));var fs=require('fs');var Redis=require(_0xe682('0x4'));var db=require(_0xe682('0x5'))['db'];var utils=require(_0xe682('0x6'));var logger=require(_0xe682('0x7'))(_0xe682('0x8'));var config=require(_0xe682('0x9'));var jayson=require(_0xe682('0xa'));var client=jayson[_0xe682('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x82fa21,_0x1d766a,_0x214393){return new BPromise(function(_0x283937,_0x5d9cd5){return client[_0xe682('0xc')](_0x82fa21,_0x214393)[_0xe682('0xd')](function(_0xc6d5fe){logger[_0xe682('0xe')](_0xe682('0xf'),_0x1d766a,_0xe682('0x10'));logger['debug'](_0xe682('0x11'),_0x1d766a,_0xe682('0x10'),JSON['stringify'](_0xc6d5fe));if(_0xc6d5fe[_0xe682('0x12')]){if(_0xc6d5fe[_0xe682('0x12')][_0xe682('0x13')]===0x1f4){logger[_0xe682('0x12')](_0xe682('0xf'),_0x1d766a,_0xc6d5fe[_0xe682('0x12')][_0xe682('0x14')]);return _0x5d9cd5(_0xc6d5fe['error'][_0xe682('0x14')]);}logger[_0xe682('0x12')](_0xe682('0xf'),_0x1d766a,_0xc6d5fe[_0xe682('0x12')][_0xe682('0x14')]);return _0x283937(_0xc6d5fe[_0xe682('0x12')][_0xe682('0x14')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x1d766a,_0xe682('0x10'));_0x283937(_0xc6d5fe[_0xe682('0x15')][_0xe682('0x14')]);}})['catch'](function(_0x11b0aa){logger[_0xe682('0x12')](_0xe682('0xf'),_0x1d766a,_0x11b0aa);_0x5d9cd5(_0x11b0aa);});});} \ No newline at end of file +var _0xeee6=['jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xeee6,0x1af));var _0x6eee=function(_0x4487d8,_0x3627d7){_0x4487d8=_0x4487d8-0x0;var _0x5646bd=_0xeee6[_0x4487d8];return _0x5646bd;};'use strict';var _=require('lodash');var util=require(_0x6eee('0x0'));var moment=require(_0x6eee('0x1'));var BPromise=require('bluebird');var rs=require(_0x6eee('0x2'));var fs=require('fs');var Redis=require(_0x6eee('0x3'));var db=require(_0x6eee('0x4'))['db'];var utils=require(_0x6eee('0x5'));var logger=require(_0x6eee('0x6'))(_0x6eee('0x7'));var config=require(_0x6eee('0x8'));var jayson=require(_0x6eee('0x9'));var client=jayson[_0x6eee('0xa')][_0x6eee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x281ed8,_0x3cdc2f,_0x137c2e){return new BPromise(function(_0x4ff82b,_0x437f35){return client['request'](_0x281ed8,_0x137c2e)[_0x6eee('0xc')](function(_0x512465){logger[_0x6eee('0xd')](_0x6eee('0xe'),_0x3cdc2f,_0x6eee('0xf'));logger['debug'](_0x6eee('0x10'),_0x3cdc2f,_0x6eee('0xf'),JSON[_0x6eee('0x11')](_0x512465));if(_0x512465[_0x6eee('0x12')]){if(_0x512465[_0x6eee('0x12')][_0x6eee('0x13')]===0x1f4){logger[_0x6eee('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x3cdc2f,_0x512465[_0x6eee('0x12')][_0x6eee('0x14')]);return _0x437f35(_0x512465[_0x6eee('0x12')][_0x6eee('0x14')]);}logger['error'](_0x6eee('0xe'),_0x3cdc2f,_0x512465['error'][_0x6eee('0x14')]);return _0x4ff82b(_0x512465[_0x6eee('0x12')][_0x6eee('0x14')]);}else{logger[_0x6eee('0xd')](_0x6eee('0xe'),_0x3cdc2f,_0x6eee('0xf'));_0x4ff82b(_0x512465['result']['message']);}})[_0x6eee('0x15')](function(_0x52b986){logger[_0x6eee('0x12')](_0x6eee('0xe'),_0x3cdc2f,_0x52b986);_0x437f35(_0x52b986);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index bb35a23..a367b6f 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 _0xd8fb=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','isAuthenticated','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x2fd7d9,_0x585704){var _0xd3d662=function(_0x1dc7eb){while(--_0x1dc7eb){_0x2fd7d9['push'](_0x2fd7d9['shift']());}};_0xd3d662(++_0x585704);}(_0xd8fb,0x99));var _0xbd8f=function(_0x46f334,_0x2c63fa){_0x46f334=_0x46f334-0x0;var _0x3db125=_0xd8fb[_0x46f334];return _0x3db125;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd8f('0x4'));var interaction=require(_0xbd8f('0x5'));var config=require('../../config/environment');var controller=require(_0xbd8f('0x6'));router[_0xbd8f('0x7')]('/:id',auth[_0xbd8f('0x8')](),controller['show']);router[_0xbd8f('0x9')]('/',auth['isAuthenticated'](),controller[_0xbd8f('0xa')]);router[_0xbd8f('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xbd8f('0xc')]);router[_0xbd8f('0xd')](_0xbd8f('0xe'),auth['isAuthenticated'](),controller[_0xbd8f('0xf')]);module[_0xbd8f('0x10')]=router; \ No newline at end of file +var _0x6aa7=['/:id','show','post','isAuthenticated','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xa8fb3f,_0x4dd5e3){var _0x556f1f=function(_0x3b530d){while(--_0x3b530d){_0xa8fb3f['push'](_0xa8fb3f['shift']());}};_0x556f1f(++_0x4dd5e3);}(_0x6aa7,0x178));var _0x76aa=function(_0x1c9704,_0x4605aa){_0x1c9704=_0x1c9704-0x0;var _0x4c98d8=_0x6aa7[_0x1c9704];return _0x4c98d8;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0x76aa('0x8'),auth['isAuthenticated'](),controller[_0x76aa('0x9')]);router[_0x76aa('0xa')]('/',auth[_0x76aa('0xb')](),controller['create']);router[_0x76aa('0xc')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller['update']);router[_0x76aa('0xd')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller[_0x76aa('0xe')]);module[_0x76aa('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index e639046..8b3160d 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 _0x6023=['STRING','INTEGER','ENUM','beepall','roundrobin','sequelize','exports','name'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x6023,0x105));var _0x3602=function(_0x30f160,_0x185cea){_0x30f160=_0x30f160-0x0;var _0x87795=_0x6023[_0x30f160];return _0x87795;};'use strict';var Sequelize=require(_0x3602('0x0'));module[_0x3602('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3602('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3602('0x3')]},'timeout':{'type':Sequelize[_0x3602('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3602('0x5')]('rrmemory',_0x3602('0x6'),_0x3602('0x7'))}}; \ No newline at end of file +var _0xcd4c=['roundrobin','sequelize','exports','STRING','name','ENUM','rrmemory','beepall'];(function(_0x50f3fd,_0x14930d){var _0x2da233=function(_0x14a594){while(--_0x14a594){_0x50f3fd['push'](_0x50f3fd['shift']());}};_0x2da233(++_0x14930d);}(_0xcd4c,0x141));var _0xccd4=function(_0x20e1f7,_0x59a3ba){_0x20e1f7=_0x20e1f7-0x0;var _0x54f752=_0xcd4c[_0x20e1f7];return _0x54f752;};'use strict';var Sequelize=require(_0xccd4('0x0'));module[_0xccd4('0x1')]={'name':{'type':Sequelize[_0xccd4('0x2')],'unique':_0xccd4('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xccd4('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xccd4('0x4')](_0xccd4('0x5'),_0xccd4('0x6'),_0xccd4('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 45675cd..87234f1 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 _0xb0a5=['fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserChatQueue','order','ChatQueueId','findAll','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','findOne','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','all','union','removeAgents','addAgents','spread','userChatQueue:remove','getAgents','fast-json-patch','request-promise','bluebird','path','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','client','http','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','sendStatus','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','get','ChatQueues','UserProfileResource','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes'];(function(_0x1296f0,_0x4331c3){var _0x4b2a0f=function(_0x316f53){while(--_0x316f53){_0x1296f0['push'](_0x1296f0['shift']());}};_0x4b2a0f(++_0x4331c3);}(_0xb0a5,0x1e3));var _0x5b0a=function(_0x5d160,_0xa4838e){_0x5d160=_0x5d160-0x0;var _0x1d180d=_0xb0a5[_0x5d160];return _0x1d180d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5b0a('0x0'));var rp=require(_0x5b0a('0x1'));var moment=require('moment');var BPromise=require(_0x5b0a('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5b0a('0x3'));var sox=require('sox');var csv=require(_0x5b0a('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b0a('0x5'));var _=require('lodash');var squel=require(_0x5b0a('0x6'));var crypto=require('crypto');var jsforce=require(_0x5b0a('0x7'));var deskjs=require(_0x5b0a('0x8'));var toCsv=require(_0x5b0a('0x4'));var querystring=require(_0x5b0a('0x9'));var Papa=require(_0x5b0a('0xa'));var Redis=require(_0x5b0a('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x5b0a('0xc'));var as=require(_0x5b0a('0xd'));var hardwareService=require(_0x5b0a('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x5b0a('0xf'));var config=require(_0x5b0a('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b0a('0x11'))['db'];config[_0x5b0a('0x12')]=_[_0x5b0a('0x13')](config[_0x5b0a('0x12')],{'host':_0x5b0a('0x14'),'port':0x18eb});var socket=require(_0x5b0a('0x15'))(new Redis(config['redis']));require(_0x5b0a('0x16'))['register'](socket);var jayson=require(_0x5b0a('0x17'));var client=jayson[_0x5b0a('0x18')][_0x5b0a('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x212794,_0x47557e,_0x5dee57,_0x1630ac){return new BPromise(function(_0x37ebdf,_0x43f620){var _0x43253b=_0x1630ac||client;return _0x43253b[_0x5b0a('0x1a')](_0x212794,_0x5dee57)['then'](function(_0x4aa8af){logger['info'](_0x5b0a('0x1b'),_0x47557e,_0x5b0a('0x1c'));logger[_0x5b0a('0x1d')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x47557e,_0x5b0a('0x1c'),JSON[_0x5b0a('0x1e')](_0x4aa8af));if(_0x4aa8af[_0x5b0a('0x1f')]){if(_0x4aa8af[_0x5b0a('0x1f')]['code']===0x1f4){logger[_0x5b0a('0x1f')]('ChatQueue,\x20%s,\x20%s',_0x47557e,_0x4aa8af[_0x5b0a('0x1f')]['message']);return _0x43f620(_0x4aa8af['error'][_0x5b0a('0x20')]);}logger[_0x5b0a('0x1f')](_0x5b0a('0x1b'),_0x47557e,_0x4aa8af['error'][_0x5b0a('0x20')]);return _0x37ebdf(_0x4aa8af['error'][_0x5b0a('0x20')]);}else{logger[_0x5b0a('0x21')](_0x5b0a('0x1b'),_0x47557e,_0x5b0a('0x1c'));_0x37ebdf(_0x4aa8af[_0x5b0a('0x22')][_0x5b0a('0x20')]);}})['catch'](function(_0x595113){logger[_0x5b0a('0x1f')](_0x5b0a('0x1b'),_0x47557e,_0x595113);_0x43f620(_0x595113);});});}function respondWithStatusCode(_0x2a3c5d,_0x4701e9){_0x4701e9=_0x4701e9||0xcc;return function(_0xacb9aa){if(_0xacb9aa){return _0x2a3c5d[_0x5b0a('0x23')](_0x4701e9);}return _0x2a3c5d[_0x5b0a('0x24')](_0x4701e9)['end']();};}function respondWithResult(_0x3dc282,_0x5e4a9e){_0x5e4a9e=_0x5e4a9e||0xc8;return function(_0x46d685){if(_0x46d685){return _0x3dc282[_0x5b0a('0x24')](_0x5e4a9e)[_0x5b0a('0x25')](_0x46d685);}};}function respondWithFilteredResult(_0x586861,_0x418ad1){return function(_0x2bc069){if(_0x2bc069){var _0x466d0d=typeof _0x418ad1[_0x5b0a('0x26')]===_0x5b0a('0x27')&&typeof _0x418ad1['limit']===_0x5b0a('0x27');var _0xb07541=_0x2bc069[_0x5b0a('0x28')];var _0x5e995c=_0x466d0d?0x0:_0x418ad1[_0x5b0a('0x26')];var _0x1b422e=_0x466d0d?_0x2bc069[_0x5b0a('0x28')]:_0x418ad1['offset']+_0x418ad1[_0x5b0a('0x29')];var _0x40b380;if(_0x1b422e>=_0xb07541){_0x1b422e=_0xb07541;_0x40b380=0xc8;}else{_0x40b380=0xce;}_0x586861[_0x5b0a('0x24')](_0x40b380);return _0x586861['set'](_0x5b0a('0x2a'),_0x5e995c+'-'+_0x1b422e+'/'+_0xb07541)[_0x5b0a('0x25')](_0x2bc069);}return null;};}function patchUpdates(_0x2e9916){return function(_0x21d964){try{jsonpatch['apply'](_0x21d964,_0x2e9916,!![]);}catch(_0xead213){return BPromise[_0x5b0a('0x2b')](_0xead213);}return _0x21d964[_0x5b0a('0x2c')]();};}function saveUpdates(_0x1df966,_0x18d91e){return function(_0x21d0f8){if(_0x21d0f8){return _0x21d0f8[_0x5b0a('0x2d')](_0x1df966)[_0x5b0a('0x2e')](function(_0x523635){return _0x523635;});}return null;};}function removeEntity(_0x56f0bf,_0x513930){return function(_0x2e2189){if(_0x2e2189){return _0x2e2189[_0x5b0a('0x2f')]()[_0x5b0a('0x2e')](function(){var _0x5099b7=_0x2e2189[_0x5b0a('0x30')]({'plain':!![]});var _0x421af2=_0x5b0a('0x31');return db[_0x5b0a('0x32')][_0x5b0a('0x2f')]({'where':{'type':_0x421af2,'resourceId':_0x5099b7['id']}})[_0x5b0a('0x2e')](function(){return _0x2e2189;});})[_0x5b0a('0x2e')](function(){_0x56f0bf[_0x5b0a('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5acb63,_0xa4d8c0){return function(_0x15191a){if(!_0x15191a){_0x5acb63[_0x5b0a('0x23')](0x194);}return _0x15191a;};}function handleError(_0x38d47e,_0xcef7ea){_0xcef7ea=_0xcef7ea||0x1f4;return function(_0x2f01b1){logger[_0x5b0a('0x1f')](_0x2f01b1['stack']);if(_0x2f01b1[_0x5b0a('0x33')]){delete _0x2f01b1[_0x5b0a('0x33')];}_0x38d47e[_0x5b0a('0x24')](_0xcef7ea)[_0x5b0a('0x34')](_0x2f01b1);};}exports[_0x5b0a('0x35')]=function(_0x41f746,_0x1ce2cd){var _0x7927c4={},_0x3b0fc5={},_0x266b94={'count':0x0,'rows':[]};var _0x3efc54=_[_0x5b0a('0x36')](db[_0x5b0a('0x37')][_0x5b0a('0x38')],function(_0x3a7cdc){return{'name':_0x3a7cdc[_0x5b0a('0x39')],'type':_0x3a7cdc[_0x5b0a('0x3a')]['key']};});_0x3b0fc5[_0x5b0a('0x3b')]=_[_0x5b0a('0x36')](_0x3efc54,'name');_0x3b0fc5[_0x5b0a('0x3c')]=_[_0x5b0a('0x3d')](_0x41f746[_0x5b0a('0x3c')]);_0x3b0fc5[_0x5b0a('0x3e')]=_[_0x5b0a('0x3f')](_0x3b0fc5['model'],_0x3b0fc5[_0x5b0a('0x3c')]);_0x7927c4[_0x5b0a('0x40')]=_[_0x5b0a('0x3f')](_0x3b0fc5[_0x5b0a('0x3b')],qs[_0x5b0a('0x41')](_0x41f746[_0x5b0a('0x3c')][_0x5b0a('0x41')]));_0x7927c4[_0x5b0a('0x40')]=_0x7927c4[_0x5b0a('0x40')][_0x5b0a('0x42')]?_0x7927c4[_0x5b0a('0x40')]:_0x3b0fc5[_0x5b0a('0x3b')];if(!_0x41f746[_0x5b0a('0x3c')][_0x5b0a('0x43')](_0x5b0a('0x44'))){_0x7927c4['limit']=qs[_0x5b0a('0x29')](_0x41f746[_0x5b0a('0x3c')][_0x5b0a('0x29')]);_0x7927c4['offset']=qs[_0x5b0a('0x26')](_0x41f746['query']['offset']);}_0x7927c4['order']=qs[_0x5b0a('0x45')](_0x41f746[_0x5b0a('0x3c')]['sort']);_0x7927c4[_0x5b0a('0x46')]=qs[_0x5b0a('0x3e')](_[_0x5b0a('0x47')](_0x41f746['query'],_0x3b0fc5[_0x5b0a('0x3e')]),_0x3efc54);if(_0x41f746[_0x5b0a('0x3c')]['filter']){_0x7927c4[_0x5b0a('0x46')]=_[_0x5b0a('0x48')](_0x7927c4[_0x5b0a('0x46')],{'$or':_[_0x5b0a('0x36')](_0x3efc54,function(_0x1b2edc){if(_0x1b2edc[_0x5b0a('0x3a')]!==_0x5b0a('0x49')){var _0x27d83a={};_0x27d83a[_0x1b2edc[_0x5b0a('0x33')]]={'$like':'%'+_0x41f746['query'][_0x5b0a('0x4a')]+'%'};return _0x27d83a;}})});}_0x7927c4=_[_0x5b0a('0x48')]({},_0x7927c4,_0x41f746[_0x5b0a('0x4b')]);var _0x2f3696={'where':_0x7927c4['where']};return db['ChatQueue'][_0x5b0a('0x28')](_0x2f3696)[_0x5b0a('0x2e')](function(_0x27f47f){_0x266b94['count']=_0x27f47f;if(_0x41f746[_0x5b0a('0x3c')][_0x5b0a('0x4c')]){_0x7927c4[_0x5b0a('0x4d')]=[{'all':!![]}];}return db[_0x5b0a('0x37')]['findAll'](_0x7927c4);})[_0x5b0a('0x2e')](function(_0x37fb99){_0x266b94[_0x5b0a('0x4e')]=_0x37fb99;return _0x266b94;})[_0x5b0a('0x2e')](respondWithFilteredResult(_0x1ce2cd,_0x7927c4))[_0x5b0a('0x4f')](handleError(_0x1ce2cd,null));};exports[_0x5b0a('0x50')]=function(_0x8f23cf,_0x562c0f){var _0x292ab9={'raw':!![],'where':{'id':_0x8f23cf[_0x5b0a('0x51')]['id']}},_0x3e688d={};_0x3e688d[_0x5b0a('0x3b')]=_[_0x5b0a('0x3d')](db[_0x5b0a('0x37')]['rawAttributes']);_0x3e688d[_0x5b0a('0x3c')]=_[_0x5b0a('0x3d')](_0x8f23cf[_0x5b0a('0x3c')]);_0x3e688d[_0x5b0a('0x3e')]=_[_0x5b0a('0x3f')](_0x3e688d[_0x5b0a('0x3b')],_0x3e688d[_0x5b0a('0x3c')]);_0x292ab9[_0x5b0a('0x40')]=_['intersection'](_0x3e688d[_0x5b0a('0x3b')],qs['fields'](_0x8f23cf[_0x5b0a('0x3c')]['fields']));_0x292ab9['attributes']=_0x292ab9[_0x5b0a('0x40')][_0x5b0a('0x42')]?_0x292ab9[_0x5b0a('0x40')]:_0x3e688d[_0x5b0a('0x3b')];if(_0x8f23cf[_0x5b0a('0x3c')][_0x5b0a('0x4c')]){_0x292ab9[_0x5b0a('0x4d')]=[{'all':!![]}];}_0x292ab9=_[_0x5b0a('0x48')]({},_0x292ab9,_0x8f23cf[_0x5b0a('0x4b')]);return db['ChatQueue'][_0x5b0a('0x52')](_0x292ab9)[_0x5b0a('0x2e')](handleEntityNotFound(_0x562c0f,null))[_0x5b0a('0x2e')](respondWithResult(_0x562c0f,null))[_0x5b0a('0x4f')](handleError(_0x562c0f,null));};exports[_0x5b0a('0x53')]=function(_0x1a247c,_0x289954){return db['ChatQueue']['create'](_0x1a247c[_0x5b0a('0x54')],{})[_0x5b0a('0x2e')](function(_0x598da2){var _0x40b3ba=_0x1a247c[_0x5b0a('0x55')][_0x5b0a('0x30')]({'plain':!![]});if(!_0x40b3ba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40b3ba[_0x5b0a('0x56')]===_0x5b0a('0x55')){var _0x45bd49=_0x598da2[_0x5b0a('0x30')]({'plain':!![]});var _0x1df356=_0x5b0a('0x31');return db['UserProfileSection']['find']({'where':{'name':_0x1df356,'userProfileId':_0x40b3ba[_0x5b0a('0x57')]},'raw':!![]})[_0x5b0a('0x2e')](function(_0x2bdc20){if(_0x2bdc20&&_0x2bdc20['autoAssociation']===0x0){return db['UserProfileResource'][_0x5b0a('0x53')]({'name':_0x45bd49['name'],'resourceId':_0x45bd49['id'],'type':_0x2bdc20[_0x5b0a('0x33')],'sectionId':_0x2bdc20['id']},{})['then'](function(){return _0x598da2;});}else{return _0x598da2;}})['catch'](function(_0x10d297){logger['error'](_0x5b0a('0x58'),_0x10d297);throw _0x10d297;});}return _0x598da2;})[_0x5b0a('0x2e')](respondWithResult(_0x289954,0xc9))[_0x5b0a('0x4f')](handleError(_0x289954,null));};exports[_0x5b0a('0x2d')]=function(_0x4490c7,_0xf4cd05){if(_0x4490c7[_0x5b0a('0x54')]['id']){delete _0x4490c7[_0x5b0a('0x54')]['id'];}return db['ChatQueue'][_0x5b0a('0x52')]({'where':{'id':_0x4490c7['params']['id']}})[_0x5b0a('0x2e')](handleEntityNotFound(_0xf4cd05,null))[_0x5b0a('0x2e')](saveUpdates(_0x4490c7[_0x5b0a('0x54')],null))['then'](respondWithResult(_0xf4cd05,null))[_0x5b0a('0x4f')](handleError(_0xf4cd05,null));};exports[_0x5b0a('0x2f')]=function(_0x5b2210,_0x4704f4){return db[_0x5b0a('0x37')]['find']({'where':{'id':_0x5b2210[_0x5b0a('0x51')]['id']}})['then'](handleEntityNotFound(_0x4704f4,null))['then'](removeEntity(_0x4704f4,null))[_0x5b0a('0x4f')](handleError(_0x4704f4,null));};exports[_0x5b0a('0x59')]=function(_0x3fa50a,_0x4e7346){return db[_0x5b0a('0x37')]['describe']()[_0x5b0a('0x2e')](respondWithResult(_0x4e7346,null))[_0x5b0a('0x4f')](handleError(_0x4e7346,null));};exports[_0x5b0a('0x5a')]=function(_0x56a4c7,_0x39c6ed,_0x21a5e6){var _0x258b0e={'raw':!![],'where':{}},_0x1df42f={},_0x349556;return db[_0x5b0a('0x37')]['findOne']({'where':{'id':_0x56a4c7[_0x5b0a('0x51')]['id']}})['then'](handleEntityNotFound(_0x39c6ed,null))[_0x5b0a('0x2e')](function(_0x2e89d2){if(_0x2e89d2){_0x349556=_0x2e89d2[_0x5b0a('0x30')]({'plain':!![]});_0x1df42f[_0x5b0a('0x3b')]=_[_0x5b0a('0x3d')](db[_0x5b0a('0x5b')][_0x5b0a('0x38')]);_0x1df42f['query']=_[_0x5b0a('0x3d')](_0x56a4c7[_0x5b0a('0x3c')]);_0x1df42f[_0x5b0a('0x3e')]=_[_0x5b0a('0x3f')](_0x1df42f[_0x5b0a('0x3b')],_0x1df42f[_0x5b0a('0x3c')]);_0x258b0e[_0x5b0a('0x40')]=_[_0x5b0a('0x3f')](_0x1df42f[_0x5b0a('0x3b')],qs[_0x5b0a('0x41')](_0x56a4c7[_0x5b0a('0x3c')][_0x5b0a('0x41')]));_0x258b0e[_0x5b0a('0x40')]=_0x258b0e[_0x5b0a('0x40')][_0x5b0a('0x42')]?_0x258b0e[_0x5b0a('0x40')]:_0x1df42f[_0x5b0a('0x3b')];if(!_0x56a4c7[_0x5b0a('0x3c')][_0x5b0a('0x43')]('nolimit')){_0x258b0e['limit']=qs[_0x5b0a('0x29')](_0x56a4c7[_0x5b0a('0x3c')]['limit']);_0x258b0e[_0x5b0a('0x26')]=qs[_0x5b0a('0x26')](_0x56a4c7[_0x5b0a('0x3c')][_0x5b0a('0x26')]);}_0x258b0e[_0x5b0a('0x5c')]=qs[_0x5b0a('0x45')](_0x56a4c7[_0x5b0a('0x3c')]['sort']);_0x258b0e[_0x5b0a('0x46')]=qs['filters'](_[_0x5b0a('0x47')](_0x56a4c7['query'],_0x1df42f[_0x5b0a('0x3e')]));_0x258b0e[_0x5b0a('0x46')][_0x5b0a('0x5d')]=_0x2e89d2['id'];if(_0x56a4c7['query'][_0x5b0a('0x4a')]){_0x258b0e['where']=_[_0x5b0a('0x48')](_0x258b0e['where'],{'$or':_[_0x5b0a('0x36')](_0x258b0e[_0x5b0a('0x40')],function(_0x2db562){var _0x41db0d={};_0x41db0d[_0x2db562]={'$like':'%'+_0x56a4c7[_0x5b0a('0x3c')][_0x5b0a('0x4a')]+'%'};return _0x41db0d;})});}_0x258b0e=_[_0x5b0a('0x48')]({},_0x258b0e,_0x56a4c7[_0x5b0a('0x4b')]);return db[_0x5b0a('0x5b')][_0x5b0a('0x5e')](_0x258b0e);}})['then'](function(_0x4e064c){if(_0x4e064c){return db[_0x5b0a('0x5f')][_0x5b0a('0x60')]({'where':{'id':_[_0x5b0a('0x36')](_0x4e064c,'UserId'),'role':_0x5b0a('0x61')},'attributes':['id',_0x5b0a('0x33'),_0x5b0a('0x62'),_0x5b0a('0x63'),_0x5b0a('0x64')]});}})[_0x5b0a('0x2e')](function(_0x5b9dc1){if(_0x5b9dc1){return{'count':_0x5b9dc1[_0x5b0a('0x28')],'rows':_['map'](_0x5b9dc1[_0x5b0a('0x4e')],function(_0x1a3f4a){return{'membername':_0x1a3f4a[_0x5b0a('0x33')],'UserId':_0x1a3f4a['id'],'queue_name':_0x349556[_0x5b0a('0x33')],'ChatQueueId':_0x349556['id'],'interface':util['format'](_0x5b0a('0x65'),_0x5b0a('0x66'),_0x1a3f4a['name']),'penalty':0x0,'paused':_0x1a3f4a['chatPause'],'createdAt':_0x1a3f4a[_0x5b0a('0x64')],'updatedAt':_0x1a3f4a[_0x5b0a('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5b0a('0x2e')](respondWithFilteredResult(_0x39c6ed,_0x258b0e))[_0x5b0a('0x4f')](handleError(_0x39c6ed,null));};exports['getTeams']=function(_0x2ec51b,_0x2d572f,_0x2288fe){var _0x2f525d={};var _0x86293={};var _0x5d92fb;var _0x25fb9e;return db['ChatQueue'][_0x5b0a('0x67')]({'where':{'id':_0x2ec51b['params']['id']}})[_0x5b0a('0x2e')](handleEntityNotFound(_0x2d572f,null))['then'](function(_0x2d65c5){if(_0x2d65c5){_0x5d92fb=_0x2d65c5;_0x86293[_0x5b0a('0x3b')]=_[_0x5b0a('0x3d')](db['Team'][_0x5b0a('0x38')]);_0x86293['query']=_[_0x5b0a('0x3d')](_0x2ec51b['query']);_0x86293['filters']=_['intersection'](_0x86293[_0x5b0a('0x3b')],_0x86293['query']);_0x2f525d['attributes']=_[_0x5b0a('0x3f')](_0x86293[_0x5b0a('0x3b')],qs[_0x5b0a('0x41')](_0x2ec51b[_0x5b0a('0x3c')][_0x5b0a('0x41')]));_0x2f525d['attributes']=_0x2f525d[_0x5b0a('0x40')]['length']?_0x2f525d[_0x5b0a('0x40')]:_0x86293[_0x5b0a('0x3b')];_0x2f525d[_0x5b0a('0x5c')]=qs[_0x5b0a('0x45')](_0x2ec51b['query'][_0x5b0a('0x45')]);_0x2f525d[_0x5b0a('0x46')]=qs[_0x5b0a('0x3e')](_['pick'](_0x2ec51b[_0x5b0a('0x3c')],_0x86293[_0x5b0a('0x3e')]));if(_0x2ec51b[_0x5b0a('0x3c')][_0x5b0a('0x4a')]){_0x2f525d['where']=_[_0x5b0a('0x48')](_0x2f525d['where'],{'$or':_[_0x5b0a('0x36')](_0x2f525d[_0x5b0a('0x40')],function(_0x3d70b5){var _0x2d0f38={};_0x2d0f38[_0x3d70b5]={'$like':'%'+_0x2ec51b[_0x5b0a('0x3c')][_0x5b0a('0x4a')]+'%'};return _0x2d0f38;})});}_0x2f525d=_[_0x5b0a('0x48')]({},_0x2f525d,_0x2ec51b['options']);return _0x5d92fb[_0x5b0a('0x68')](_0x2f525d);}})[_0x5b0a('0x2e')](function(_0x3a20d2){if(_0x3a20d2){_0x25fb9e=_0x3a20d2[_0x5b0a('0x42')];if(!_0x2ec51b[_0x5b0a('0x3c')]['hasOwnProperty']('nolimit')){_0x2f525d[_0x5b0a('0x29')]=qs[_0x5b0a('0x29')](_0x2ec51b[_0x5b0a('0x3c')]['limit']);_0x2f525d[_0x5b0a('0x26')]=qs[_0x5b0a('0x26')](_0x2ec51b['query'][_0x5b0a('0x26')]);}return _0x5d92fb[_0x5b0a('0x68')](_0x2f525d);}})['then'](function(_0x1b3acd){if(_0x1b3acd){return _0x1b3acd?{'count':_0x25fb9e,'rows':_0x1b3acd}:null;}})['then'](respondWithResult(_0x2d572f,null))[_0x5b0a('0x4f')](handleError(_0x2d572f,null));};exports[_0x5b0a('0x69')]=function(_0x2c5b4c,_0xf7472a,_0x257924){var _0x56da7e=_0x2c5b4c[_0x5b0a('0x54')][_0x5b0a('0x6a')];return db[_0x5b0a('0x6b')][_0x5b0a('0x5e')]({'where':{'id':_0x56da7e},'attributes':['id'],'include':[{'model':db[_0x5b0a('0x5f')],'as':_0x5b0a('0x6c'),'attributes':['id',_0x5b0a('0x33'),_0x5b0a('0x6d'),_0x5b0a('0x6e'),_0x5b0a('0x6f')],'raw':!![]}]})[_0x5b0a('0x2e')](function(_0x45f724){if(_0x45f724){var _0x206265=_[_0x5b0a('0x70')](_0x45f724,function(_0xb9b775){var _0x294495=_0xb9b775['get']({'plain':!![]});return _0x294495[_0x5b0a('0x6c')];});return db[_0x5b0a('0x37')][_0x5b0a('0x52')]({'where':{'id':_0x2c5b4c[_0x5b0a('0x51')]['id']}})[_0x5b0a('0x2e')](function(_0x4500f3){return db[_0x5b0a('0x71')][_0x5b0a('0x72')](function(_0x1e2b1b){return _0x4500f3[_0x5b0a('0x69')](_0x56da7e,{'transaction':_0x1e2b1b})['then'](function(){return BPromise['each'](_0x206265,function(_0x312e89){return db[_0x5b0a('0x5b')][_0x5b0a('0x73')]({'where':{'UserId':_0x312e89['id'],'ChatQueueId':_0x2c5b4c[_0x5b0a('0x51')]['id']},'transaction':_0x1e2b1b});});})['then'](function(){_0x206265[_0x5b0a('0x74')](function(_0x44ad98){socket[_0x5b0a('0x75')](_0x5b0a('0x76'),{'UserId':_0x44ad98['id'],'ChatQueueId':_0x4500f3['id']});});});});});}})['then'](respondWithStatusCode(_0xf7472a,null))[_0x5b0a('0x4f')](handleError(_0xf7472a,null));};exports[_0x5b0a('0x77')]=function(_0x13aaca,_0x59a310,_0x22435c){return db[_0x5b0a('0x6b')][_0x5b0a('0x5e')]({'where':{'id':_0x13aaca[_0x5b0a('0x3c')]['ids']},'attributes':['id'],'include':[{'model':db[_0x5b0a('0x5f')],'as':_0x5b0a('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x5b0a('0x2e')](handleEntityNotFound(_0x59a310,null))[_0x5b0a('0x2e')](function(_0x326195){var _0x37a1c4=_[_0x5b0a('0x36')](_0x326195,'id');var _0x3c6db8=[];var _0x170179=[];var _0x453e06=squel[_0x5b0a('0x78')]();_0x453e06[_0x5b0a('0x79')](_0x5b0a('0x7a'))['from']('team_has_chat_queues','tq')['join'](_0x5b0a('0x7b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x5b0a('0x46')](_0x5b0a('0x7c'),_0x13aaca[_0x5b0a('0x51')]['id']);for(var _0x2cb6f7=0x0;_0x2cb6f7<_0x326195['length'];_0x2cb6f7+=0x1){let _0x1356b9=_0x326195[_0x2cb6f7];for(var _0x3860ad=0x0;_0x3860ad<_0x1356b9['Agents']['length'];_0x3860ad+=0x1){let _0x217d39=_0x1356b9[_0x5b0a('0x6c')][_0x3860ad];var _0x25cb35=_0x453e06[_0x5b0a('0x7d')]();_0x25cb35[_0x5b0a('0x46')](_0x5b0a('0x7e'),_0x217d39['id']);_0x170179[_0x5b0a('0x7f')](db[_0x5b0a('0x71')][_0x5b0a('0x3c')](_0x25cb35['toString'](),{'type':db[_0x5b0a('0x71')][_0x5b0a('0x80')]['SELECT']})['then'](function(_0x30b298){if(_0x30b298[_0x5b0a('0x42')]===0x1){return _0x217d39['id'];}else{var _0x52c551=_[_0x5b0a('0x81')](_['map'](_0x30b298,'TeamId'),function(_0x40021c){return _['includes'](_0x37a1c4,_0x40021c);});if(_0x52c551){return _0x217d39['id'];}}}));}}return BPromise[_0x5b0a('0x82')](_0x170179)['then'](function(_0x14c1df){_0x3c6db8=_(_0x3c6db8)[_0x5b0a('0x83')](_0x14c1df)['compact']()['value']();return db[_0x5b0a('0x37')][_0x5b0a('0x52')]({'where':{'id':_0x13aaca[_0x5b0a('0x51')]['id']}})[_0x5b0a('0x2e')](function(_0x1118f4){return db[_0x5b0a('0x71')][_0x5b0a('0x72')](function(_0x807b5a){return _0x1118f4[_0x5b0a('0x77')](_0x13aaca[_0x5b0a('0x3c')][_0x5b0a('0x6a')],{'transaction':_0x807b5a})[_0x5b0a('0x2e')](function(){if(!_['isEmpty'](_0x3c6db8)){return _0x1118f4[_0x5b0a('0x84')](_0x3c6db8,{'transaction':_0x807b5a});}})['then'](function(){_0x3c6db8['forEach'](function(_0x2179e0){socket['emit']('userChatQueue:remove',{'UserId':_0x2179e0,'ChatQueueId':_0x1118f4['id']});});});});});});})[_0x5b0a('0x2e')](respondWithStatusCode(_0x59a310,null))[_0x5b0a('0x4f')](handleError(_0x59a310,null));};exports['addAgents']=function(_0x43724a,_0x4fe728,_0x445fa0){return db[_0x5b0a('0x37')][_0x5b0a('0x52')]({'where':{'id':_0x43724a[_0x5b0a('0x51')]['id']}})[_0x5b0a('0x2e')](handleEntityNotFound(_0x4fe728,null))[_0x5b0a('0x2e')](function(_0x27f004){if(_0x27f004){return _0x27f004[_0x5b0a('0x85')](_0x43724a[_0x5b0a('0x54')]['ids'],_['omit'](_0x43724a[_0x5b0a('0x54')],['ids','id'])||{})[_0x5b0a('0x86')](function(_0x5462a4){for(var _0x51c988=0x0;_0x51c988<_0x43724a[_0x5b0a('0x54')][_0x5b0a('0x6a')][_0x5b0a('0x42')];_0x51c988+=0x1){socket[_0x5b0a('0x75')](_0x5b0a('0x76'),{'UserId':Number(_0x43724a[_0x5b0a('0x54')][_0x5b0a('0x6a')][_0x51c988]),'ChatQueueId':Number(_0x43724a[_0x5b0a('0x51')]['id'])});}return _0x5462a4;});}})[_0x5b0a('0x2e')](respondWithResult(_0x4fe728,null))[_0x5b0a('0x4f')](handleError(_0x4fe728,null));};exports[_0x5b0a('0x84')]=function(_0x28d001,_0x362aaa,_0x47f0c9){return db[_0x5b0a('0x37')][_0x5b0a('0x52')]({'where':{'id':_0x28d001[_0x5b0a('0x51')]['id']}})['then'](handleEntityNotFound(_0x362aaa,null))['then'](function(_0x44fec1){if(_0x44fec1){return _0x44fec1['removeAgents'](_0x28d001[_0x5b0a('0x3c')][_0x5b0a('0x6a')])[_0x5b0a('0x2e')](function(){if(_['isArray'](_0x28d001[_0x5b0a('0x3c')][_0x5b0a('0x6a')])){for(var _0x3047c0=0x0;_0x3047c0<_0x28d001['query'][_0x5b0a('0x6a')]['length'];_0x3047c0+=0x1){socket[_0x5b0a('0x75')](_0x5b0a('0x87'),{'UserId':Number(_0x28d001['query'][_0x5b0a('0x6a')][_0x3047c0]),'ChatQueueId':Number(_0x28d001[_0x5b0a('0x51')]['id'])});}}else{socket[_0x5b0a('0x75')](_0x5b0a('0x87'),{'UserId':Number(_0x28d001[_0x5b0a('0x3c')]['ids']),'ChatQueueId':Number(_0x28d001[_0x5b0a('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x362aaa,null))[_0x5b0a('0x4f')](handleError(_0x362aaa,null));};exports[_0x5b0a('0x88')]=function(_0x1bacc5,_0x12e36f,_0x65ddf4){var _0x3d7247={};var _0x134a6f={};var _0x5da1dd;var _0x27f3b1;return db['ChatQueue'][_0x5b0a('0x67')]({'where':{'id':_0x1bacc5[_0x5b0a('0x51')]['id']}})['then'](handleEntityNotFound(_0x12e36f,null))['then'](function(_0x4caf7b){if(_0x4caf7b){_0x5da1dd=_0x4caf7b;_0x134a6f[_0x5b0a('0x3b')]=_[_0x5b0a('0x3d')](db[_0x5b0a('0x5f')][_0x5b0a('0x38')]);_0x134a6f[_0x5b0a('0x3c')]=_[_0x5b0a('0x3d')](_0x1bacc5[_0x5b0a('0x3c')]);_0x134a6f['filters']=_[_0x5b0a('0x3f')](_0x134a6f[_0x5b0a('0x3b')],_0x134a6f[_0x5b0a('0x3c')]);_0x3d7247[_0x5b0a('0x40')]=_[_0x5b0a('0x3f')](_0x134a6f[_0x5b0a('0x3b')],qs['fields'](_0x1bacc5[_0x5b0a('0x3c')][_0x5b0a('0x41')]));_0x3d7247[_0x5b0a('0x40')]=_0x3d7247['attributes'][_0x5b0a('0x42')]?_0x3d7247[_0x5b0a('0x40')]:_0x134a6f[_0x5b0a('0x3b')];_0x3d7247['order']=qs[_0x5b0a('0x45')](_0x1bacc5['query'][_0x5b0a('0x45')]);_0x3d7247[_0x5b0a('0x46')]=qs[_0x5b0a('0x3e')](_[_0x5b0a('0x47')](_0x1bacc5[_0x5b0a('0x3c')],_0x134a6f[_0x5b0a('0x3e')]));if(_0x1bacc5['query']['filter']){_0x3d7247[_0x5b0a('0x46')]=_['merge'](_0x3d7247['where'],{'$or':_[_0x5b0a('0x36')](_0x3d7247[_0x5b0a('0x40')],function(_0x17360f){var _0x3fdfa5={};_0x3fdfa5[_0x17360f]={'$like':'%'+_0x1bacc5[_0x5b0a('0x3c')][_0x5b0a('0x4a')]+'%'};return _0x3fdfa5;})});}_0x3d7247=_[_0x5b0a('0x48')]({},_0x3d7247,_0x1bacc5[_0x5b0a('0x4b')]);return _0x5da1dd['getAgents'](_0x3d7247);}})[_0x5b0a('0x2e')](function(_0x49251a){if(_0x49251a){_0x27f3b1=_0x49251a['length'];if(!_0x1bacc5[_0x5b0a('0x3c')][_0x5b0a('0x43')](_0x5b0a('0x44'))){_0x3d7247['limit']=qs[_0x5b0a('0x29')](_0x1bacc5[_0x5b0a('0x3c')]['limit']);_0x3d7247['offset']=qs[_0x5b0a('0x26')](_0x1bacc5['query']['offset']);}return _0x5da1dd[_0x5b0a('0x88')](_0x3d7247);}})[_0x5b0a('0x2e')](function(_0x5603b6){if(_0x5603b6){return _0x5603b6?{'count':_0x27f3b1,'rows':_0x5603b6}:null;}})[_0x5b0a('0x2e')](respondWithResult(_0x12e36f,null))['catch'](handleError(_0x12e36f,null));}; \ No newline at end of file +var _0xc9f3=['UserChatQueue','hasOwnProperty','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','ids','Agents','voicePause','flatMap','sequelize','transaction','addTeams','each','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','userChatQueue:save','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','./chatQueue.socket','register','jayson/promise','client','http','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','sendStatus','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','destroy','get','ChatQueues','UserProfileResource','end','stack','name','send','index','ChatQueue','rawAttributes','fieldName','type','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','getMembers','findOne'];(function(_0x39ff33,_0x5eb1fc){var _0x3dc71e=function(_0x5ef5f6){while(--_0x5ef5f6){_0x39ff33['push'](_0x39ff33['shift']());}};_0x3dc71e(++_0x5eb1fc);}(_0xc9f3,0x158));var _0x3c9f=function(_0x8c87c0,_0x240ba0){_0x8c87c0=_0x8c87c0-0x0;var _0xef647=_0xc9f3[_0x8c87c0];return _0xef647;};'use strict';var emlformat=require(_0x3c9f('0x0'));var rimraf=require(_0x3c9f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3c9f('0x2'));var rp=require(_0x3c9f('0x3'));var moment=require('moment');var BPromise=require(_0x3c9f('0x4'));var Mustache=require(_0x3c9f('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3c9f('0x6'));var csv=require(_0x3c9f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c9f('0x8'));var _=require(_0x3c9f('0x9'));var squel=require(_0x3c9f('0xa'));var crypto=require(_0x3c9f('0xb'));var jsforce=require(_0x3c9f('0xc'));var deskjs=require(_0x3c9f('0xd'));var toCsv=require(_0x3c9f('0x7'));var querystring=require('querystring');var Papa=require(_0x3c9f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3c9f('0xf'));var hardwareService=require(_0x3c9f('0x10'));var logger=require(_0x3c9f('0x11'))(_0x3c9f('0x12'));var utils=require(_0x3c9f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3c9f('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x3c9f('0x15')],{'host':_0x3c9f('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c9f('0x15')]));require(_0x3c9f('0x17'))[_0x3c9f('0x18')](socket);var jayson=require(_0x3c9f('0x19'));var client=jayson[_0x3c9f('0x1a')][_0x3c9f('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x23eb5c,_0x39f6b6,_0x2c94e2,_0x2ef845){return new BPromise(function(_0x28f1cc,_0x17e0c8){var _0x3596ba=_0x2ef845||client;return _0x3596ba[_0x3c9f('0x1c')](_0x23eb5c,_0x2c94e2)[_0x3c9f('0x1d')](function(_0x44de3c){logger['info'](_0x3c9f('0x1e'),_0x39f6b6,_0x3c9f('0x1f'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x39f6b6,_0x3c9f('0x1f'),JSON['stringify'](_0x44de3c));if(_0x44de3c[_0x3c9f('0x20')]){if(_0x44de3c[_0x3c9f('0x20')][_0x3c9f('0x21')]===0x1f4){logger[_0x3c9f('0x20')](_0x3c9f('0x1e'),_0x39f6b6,_0x44de3c['error']['message']);return _0x17e0c8(_0x44de3c['error']['message']);}logger[_0x3c9f('0x20')]('ChatQueue,\x20%s,\x20%s',_0x39f6b6,_0x44de3c[_0x3c9f('0x20')][_0x3c9f('0x22')]);return _0x28f1cc(_0x44de3c[_0x3c9f('0x20')][_0x3c9f('0x22')]);}else{logger[_0x3c9f('0x23')](_0x3c9f('0x1e'),_0x39f6b6,_0x3c9f('0x1f'));_0x28f1cc(_0x44de3c[_0x3c9f('0x24')][_0x3c9f('0x22')]);}})[_0x3c9f('0x25')](function(_0x17f1b8){logger[_0x3c9f('0x20')](_0x3c9f('0x1e'),_0x39f6b6,_0x17f1b8);_0x17e0c8(_0x17f1b8);});});}function respondWithStatusCode(_0x18b556,_0x246420){_0x246420=_0x246420||0xcc;return function(_0x2a0982){if(_0x2a0982){return _0x18b556[_0x3c9f('0x26')](_0x246420);}return _0x18b556[_0x3c9f('0x27')](_0x246420)['end']();};}function respondWithResult(_0x3d6aba,_0x3ce0c9){_0x3ce0c9=_0x3ce0c9||0xc8;return function(_0x4b856e){if(_0x4b856e){return _0x3d6aba[_0x3c9f('0x27')](_0x3ce0c9)[_0x3c9f('0x28')](_0x4b856e);}};}function respondWithFilteredResult(_0x4a855e,_0x108f22){return function(_0x12ba6c){if(_0x12ba6c){var _0x47bf76=typeof _0x108f22['offset']===_0x3c9f('0x29')&&typeof _0x108f22[_0x3c9f('0x2a')]==='undefined';var _0x5352c1=_0x12ba6c[_0x3c9f('0x2b')];var _0x1ce147=_0x47bf76?0x0:_0x108f22[_0x3c9f('0x2c')];var _0x4b8902=_0x47bf76?_0x12ba6c['count']:_0x108f22[_0x3c9f('0x2c')]+_0x108f22[_0x3c9f('0x2a')];var _0x321465;if(_0x4b8902>=_0x5352c1){_0x4b8902=_0x5352c1;_0x321465=0xc8;}else{_0x321465=0xce;}_0x4a855e['status'](_0x321465);return _0x4a855e['set'](_0x3c9f('0x2d'),_0x1ce147+'-'+_0x4b8902+'/'+_0x5352c1)[_0x3c9f('0x28')](_0x12ba6c);}return null;};}function patchUpdates(_0x42b1be){return function(_0xfa5621){try{jsonpatch['apply'](_0xfa5621,_0x42b1be,!![]);}catch(_0x494d9b){return BPromise[_0x3c9f('0x2e')](_0x494d9b);}return _0xfa5621[_0x3c9f('0x2f')]();};}function saveUpdates(_0x88e9d8,_0x1837e7){return function(_0x59f93f){if(_0x59f93f){return _0x59f93f[_0x3c9f('0x30')](_0x88e9d8)[_0x3c9f('0x1d')](function(_0x36cbcc){return _0x36cbcc;});}return null;};}function removeEntity(_0x27b72c,_0x223cad){return function(_0x442d03){if(_0x442d03){return _0x442d03[_0x3c9f('0x31')]()[_0x3c9f('0x1d')](function(){var _0x386f2d=_0x442d03[_0x3c9f('0x32')]({'plain':!![]});var _0x5e67ef=_0x3c9f('0x33');return db[_0x3c9f('0x34')]['destroy']({'where':{'type':_0x5e67ef,'resourceId':_0x386f2d['id']}})[_0x3c9f('0x1d')](function(){return _0x442d03;});})[_0x3c9f('0x1d')](function(){_0x27b72c[_0x3c9f('0x27')](0xcc)[_0x3c9f('0x35')]();});}};}function handleEntityNotFound(_0x5c870b,_0x481b0c){return function(_0x53a27a){if(!_0x53a27a){_0x5c870b[_0x3c9f('0x26')](0x194);}return _0x53a27a;};}function handleError(_0x407d70,_0x1160d0){_0x1160d0=_0x1160d0||0x1f4;return function(_0x405401){logger[_0x3c9f('0x20')](_0x405401[_0x3c9f('0x36')]);if(_0x405401[_0x3c9f('0x37')]){delete _0x405401['name'];}_0x407d70[_0x3c9f('0x27')](_0x1160d0)[_0x3c9f('0x38')](_0x405401);};}exports[_0x3c9f('0x39')]=function(_0x31d1ff,_0xae639f){var _0x103759={},_0x215caa={},_0x5c0fc1={'count':0x0,'rows':[]};var _0x3c7bb5=_['map'](db[_0x3c9f('0x3a')][_0x3c9f('0x3b')],function(_0x1b033e){return{'name':_0x1b033e[_0x3c9f('0x3c')],'type':_0x1b033e[_0x3c9f('0x3d')]['key']};});_0x215caa['model']=_[_0x3c9f('0x3e')](_0x3c7bb5,'name');_0x215caa[_0x3c9f('0x3f')]=_['keys'](_0x31d1ff[_0x3c9f('0x3f')]);_0x215caa[_0x3c9f('0x40')]=_[_0x3c9f('0x41')](_0x215caa['model'],_0x215caa[_0x3c9f('0x3f')]);_0x103759['attributes']=_['intersection'](_0x215caa[_0x3c9f('0x42')],qs['fields'](_0x31d1ff['query'][_0x3c9f('0x43')]));_0x103759[_0x3c9f('0x44')]=_0x103759['attributes'][_0x3c9f('0x45')]?_0x103759[_0x3c9f('0x44')]:_0x215caa[_0x3c9f('0x42')];if(!_0x31d1ff[_0x3c9f('0x3f')]['hasOwnProperty'](_0x3c9f('0x46'))){_0x103759[_0x3c9f('0x2a')]=qs[_0x3c9f('0x2a')](_0x31d1ff[_0x3c9f('0x3f')]['limit']);_0x103759[_0x3c9f('0x2c')]=qs[_0x3c9f('0x2c')](_0x31d1ff['query'][_0x3c9f('0x2c')]);}_0x103759[_0x3c9f('0x47')]=qs[_0x3c9f('0x48')](_0x31d1ff[_0x3c9f('0x3f')][_0x3c9f('0x48')]);_0x103759[_0x3c9f('0x49')]=qs[_0x3c9f('0x40')](_[_0x3c9f('0x4a')](_0x31d1ff[_0x3c9f('0x3f')],_0x215caa[_0x3c9f('0x40')]),_0x3c7bb5);if(_0x31d1ff['query']['filter']){_0x103759[_0x3c9f('0x49')]=_[_0x3c9f('0x4b')](_0x103759[_0x3c9f('0x49')],{'$or':_['map'](_0x3c7bb5,function(_0x4b3c8e){if(_0x4b3c8e[_0x3c9f('0x3d')]!==_0x3c9f('0x4c')){var _0x391aaf={};_0x391aaf[_0x4b3c8e[_0x3c9f('0x37')]]={'$like':'%'+_0x31d1ff['query'][_0x3c9f('0x4d')]+'%'};return _0x391aaf;}})});}_0x103759=_[_0x3c9f('0x4b')]({},_0x103759,_0x31d1ff[_0x3c9f('0x4e')]);var _0x9ef9bb={'where':_0x103759[_0x3c9f('0x49')]};return db[_0x3c9f('0x3a')][_0x3c9f('0x2b')](_0x9ef9bb)[_0x3c9f('0x1d')](function(_0x597b56){_0x5c0fc1[_0x3c9f('0x2b')]=_0x597b56;if(_0x31d1ff[_0x3c9f('0x3f')][_0x3c9f('0x4f')]){_0x103759[_0x3c9f('0x50')]=[{'all':!![]}];}return db[_0x3c9f('0x3a')][_0x3c9f('0x51')](_0x103759);})['then'](function(_0x1f2091){_0x5c0fc1['rows']=_0x1f2091;return _0x5c0fc1;})[_0x3c9f('0x1d')](respondWithFilteredResult(_0xae639f,_0x103759))[_0x3c9f('0x25')](handleError(_0xae639f,null));};exports[_0x3c9f('0x52')]=function(_0x1efc68,_0x1eb8e2){var _0xf8c421={'raw':!![],'where':{'id':_0x1efc68[_0x3c9f('0x53')]['id']}},_0x37a96f={};_0x37a96f[_0x3c9f('0x42')]=_[_0x3c9f('0x54')](db['ChatQueue']['rawAttributes']);_0x37a96f[_0x3c9f('0x3f')]=_[_0x3c9f('0x54')](_0x1efc68[_0x3c9f('0x3f')]);_0x37a96f[_0x3c9f('0x40')]=_[_0x3c9f('0x41')](_0x37a96f[_0x3c9f('0x42')],_0x37a96f[_0x3c9f('0x3f')]);_0xf8c421[_0x3c9f('0x44')]=_[_0x3c9f('0x41')](_0x37a96f[_0x3c9f('0x42')],qs[_0x3c9f('0x43')](_0x1efc68['query']['fields']));_0xf8c421[_0x3c9f('0x44')]=_0xf8c421['attributes'][_0x3c9f('0x45')]?_0xf8c421[_0x3c9f('0x44')]:_0x37a96f['model'];if(_0x1efc68['query'][_0x3c9f('0x4f')]){_0xf8c421[_0x3c9f('0x50')]=[{'all':!![]}];}_0xf8c421=_[_0x3c9f('0x4b')]({},_0xf8c421,_0x1efc68[_0x3c9f('0x4e')]);return db[_0x3c9f('0x3a')][_0x3c9f('0x55')](_0xf8c421)[_0x3c9f('0x1d')](handleEntityNotFound(_0x1eb8e2,null))[_0x3c9f('0x1d')](respondWithResult(_0x1eb8e2,null))['catch'](handleError(_0x1eb8e2,null));};exports[_0x3c9f('0x56')]=function(_0x41918,_0x219c26){return db[_0x3c9f('0x3a')][_0x3c9f('0x56')](_0x41918[_0x3c9f('0x57')],{})[_0x3c9f('0x1d')](function(_0x4c8ddc){var _0x41adae=_0x41918[_0x3c9f('0x58')][_0x3c9f('0x32')]({'plain':!![]});if(!_0x41adae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41adae['role']===_0x3c9f('0x58')){var _0x5c2604=_0x4c8ddc[_0x3c9f('0x32')]({'plain':!![]});var _0x590977=_0x3c9f('0x33');return db[_0x3c9f('0x59')]['find']({'where':{'name':_0x590977,'userProfileId':_0x41adae[_0x3c9f('0x5a')]},'raw':!![]})[_0x3c9f('0x1d')](function(_0x68eb0c){if(_0x68eb0c&&_0x68eb0c[_0x3c9f('0x5b')]===0x0){return db[_0x3c9f('0x34')][_0x3c9f('0x56')]({'name':_0x5c2604['name'],'resourceId':_0x5c2604['id'],'type':_0x68eb0c[_0x3c9f('0x37')],'sectionId':_0x68eb0c['id']},{})['then'](function(){return _0x4c8ddc;});}else{return _0x4c8ddc;}})[_0x3c9f('0x25')](function(_0x1b3038){logger[_0x3c9f('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b3038);throw _0x1b3038;});}return _0x4c8ddc;})[_0x3c9f('0x1d')](respondWithResult(_0x219c26,0xc9))[_0x3c9f('0x25')](handleError(_0x219c26,null));};exports[_0x3c9f('0x30')]=function(_0x50f09e,_0x201345){if(_0x50f09e[_0x3c9f('0x57')]['id']){delete _0x50f09e['body']['id'];}return db[_0x3c9f('0x3a')][_0x3c9f('0x55')]({'where':{'id':_0x50f09e[_0x3c9f('0x53')]['id']}})[_0x3c9f('0x1d')](handleEntityNotFound(_0x201345,null))['then'](saveUpdates(_0x50f09e['body'],null))[_0x3c9f('0x1d')](respondWithResult(_0x201345,null))[_0x3c9f('0x25')](handleError(_0x201345,null));};exports[_0x3c9f('0x31')]=function(_0x4588e4,_0x39dfe1){return db[_0x3c9f('0x3a')][_0x3c9f('0x55')]({'where':{'id':_0x4588e4['params']['id']}})[_0x3c9f('0x1d')](handleEntityNotFound(_0x39dfe1,null))[_0x3c9f('0x1d')](removeEntity(_0x39dfe1,null))[_0x3c9f('0x25')](handleError(_0x39dfe1,null));};exports['describe']=function(_0x47225b,_0x21f79c){return db[_0x3c9f('0x3a')]['describe']()[_0x3c9f('0x1d')](respondWithResult(_0x21f79c,null))['catch'](handleError(_0x21f79c,null));};exports[_0x3c9f('0x5c')]=function(_0x5ef576,_0x3960aa,_0x329509){var _0x582c38={'raw':!![],'where':{}},_0x28a87f={},_0x21827e;return db[_0x3c9f('0x3a')][_0x3c9f('0x5d')]({'where':{'id':_0x5ef576[_0x3c9f('0x53')]['id']}})[_0x3c9f('0x1d')](handleEntityNotFound(_0x3960aa,null))['then'](function(_0x4b5ff0){if(_0x4b5ff0){_0x21827e=_0x4b5ff0['get']({'plain':!![]});_0x28a87f[_0x3c9f('0x42')]=_[_0x3c9f('0x54')](db[_0x3c9f('0x5e')][_0x3c9f('0x3b')]);_0x28a87f[_0x3c9f('0x3f')]=_[_0x3c9f('0x54')](_0x5ef576[_0x3c9f('0x3f')]);_0x28a87f['filters']=_[_0x3c9f('0x41')](_0x28a87f[_0x3c9f('0x42')],_0x28a87f[_0x3c9f('0x3f')]);_0x582c38[_0x3c9f('0x44')]=_[_0x3c9f('0x41')](_0x28a87f[_0x3c9f('0x42')],qs[_0x3c9f('0x43')](_0x5ef576['query'][_0x3c9f('0x43')]));_0x582c38['attributes']=_0x582c38[_0x3c9f('0x44')][_0x3c9f('0x45')]?_0x582c38[_0x3c9f('0x44')]:_0x28a87f[_0x3c9f('0x42')];if(!_0x5ef576[_0x3c9f('0x3f')][_0x3c9f('0x5f')]('nolimit')){_0x582c38[_0x3c9f('0x2a')]=qs[_0x3c9f('0x2a')](_0x5ef576[_0x3c9f('0x3f')]['limit']);_0x582c38[_0x3c9f('0x2c')]=qs[_0x3c9f('0x2c')](_0x5ef576[_0x3c9f('0x3f')][_0x3c9f('0x2c')]);}_0x582c38[_0x3c9f('0x47')]=qs[_0x3c9f('0x48')](_0x5ef576[_0x3c9f('0x3f')][_0x3c9f('0x48')]);_0x582c38['where']=qs[_0x3c9f('0x40')](_[_0x3c9f('0x4a')](_0x5ef576['query'],_0x28a87f[_0x3c9f('0x40')]));_0x582c38[_0x3c9f('0x49')][_0x3c9f('0x60')]=_0x4b5ff0['id'];if(_0x5ef576[_0x3c9f('0x3f')][_0x3c9f('0x4d')]){_0x582c38[_0x3c9f('0x49')]=_['merge'](_0x582c38[_0x3c9f('0x49')],{'$or':_['map'](_0x582c38[_0x3c9f('0x44')],function(_0x3a6dd7){var _0x3cf780={};_0x3cf780[_0x3a6dd7]={'$like':'%'+_0x5ef576[_0x3c9f('0x3f')]['filter']+'%'};return _0x3cf780;})});}_0x582c38=_[_0x3c9f('0x4b')]({},_0x582c38,_0x5ef576[_0x3c9f('0x4e')]);return db[_0x3c9f('0x5e')][_0x3c9f('0x51')](_0x582c38);}})[_0x3c9f('0x1d')](function(_0xfdd54c){if(_0xfdd54c){return db[_0x3c9f('0x61')][_0x3c9f('0x62')]({'where':{'id':_[_0x3c9f('0x3e')](_0xfdd54c,_0x3c9f('0x63')),'role':_0x3c9f('0x64')},'attributes':['id','name',_0x3c9f('0x65'),_0x3c9f('0x66'),_0x3c9f('0x67')]});}})[_0x3c9f('0x1d')](function(_0x577942){if(_0x577942){return{'count':_0x577942[_0x3c9f('0x2b')],'rows':_[_0x3c9f('0x3e')](_0x577942['rows'],function(_0x2903cd){return{'membername':_0x2903cd[_0x3c9f('0x37')],'UserId':_0x2903cd['id'],'queue_name':_0x21827e['name'],'ChatQueueId':_0x21827e['id'],'interface':util[_0x3c9f('0x68')](_0x3c9f('0x69'),_0x3c9f('0x6a'),_0x2903cd[_0x3c9f('0x37')]),'penalty':0x0,'paused':_0x2903cd['chatPause'],'createdAt':_0x2903cd[_0x3c9f('0x67')],'updatedAt':_0x2903cd['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3c9f('0x1d')](respondWithFilteredResult(_0x3960aa,_0x582c38))[_0x3c9f('0x25')](handleError(_0x3960aa,null));};exports['getTeams']=function(_0x2124ed,_0x5dce3a,_0x44e233){var _0x341e0a={};var _0xe9cb96={};var _0x1451c6;var _0x30840b;return db[_0x3c9f('0x3a')]['findOne']({'where':{'id':_0x2124ed['params']['id']}})[_0x3c9f('0x1d')](handleEntityNotFound(_0x5dce3a,null))[_0x3c9f('0x1d')](function(_0x149259){if(_0x149259){_0x1451c6=_0x149259;_0xe9cb96[_0x3c9f('0x42')]=_[_0x3c9f('0x54')](db[_0x3c9f('0x6b')]['rawAttributes']);_0xe9cb96['query']=_['keys'](_0x2124ed[_0x3c9f('0x3f')]);_0xe9cb96[_0x3c9f('0x40')]=_['intersection'](_0xe9cb96[_0x3c9f('0x42')],_0xe9cb96[_0x3c9f('0x3f')]);_0x341e0a[_0x3c9f('0x44')]=_['intersection'](_0xe9cb96['model'],qs[_0x3c9f('0x43')](_0x2124ed[_0x3c9f('0x3f')]['fields']));_0x341e0a[_0x3c9f('0x44')]=_0x341e0a[_0x3c9f('0x44')][_0x3c9f('0x45')]?_0x341e0a[_0x3c9f('0x44')]:_0xe9cb96[_0x3c9f('0x42')];_0x341e0a[_0x3c9f('0x47')]=qs[_0x3c9f('0x48')](_0x2124ed['query']['sort']);_0x341e0a[_0x3c9f('0x49')]=qs[_0x3c9f('0x40')](_[_0x3c9f('0x4a')](_0x2124ed[_0x3c9f('0x3f')],_0xe9cb96['filters']));if(_0x2124ed['query'][_0x3c9f('0x4d')]){_0x341e0a['where']=_['merge'](_0x341e0a[_0x3c9f('0x49')],{'$or':_[_0x3c9f('0x3e')](_0x341e0a[_0x3c9f('0x44')],function(_0x16372d){var _0xe22b4={};_0xe22b4[_0x16372d]={'$like':'%'+_0x2124ed[_0x3c9f('0x3f')][_0x3c9f('0x4d')]+'%'};return _0xe22b4;})});}_0x341e0a=_[_0x3c9f('0x4b')]({},_0x341e0a,_0x2124ed[_0x3c9f('0x4e')]);return _0x1451c6[_0x3c9f('0x6c')](_0x341e0a);}})[_0x3c9f('0x1d')](function(_0x31333e){if(_0x31333e){_0x30840b=_0x31333e[_0x3c9f('0x45')];if(!_0x2124ed['query'][_0x3c9f('0x5f')]('nolimit')){_0x341e0a[_0x3c9f('0x2a')]=qs['limit'](_0x2124ed['query'][_0x3c9f('0x2a')]);_0x341e0a[_0x3c9f('0x2c')]=qs['offset'](_0x2124ed[_0x3c9f('0x3f')][_0x3c9f('0x2c')]);}return _0x1451c6['getTeams'](_0x341e0a);}})[_0x3c9f('0x1d')](function(_0x1fa163){if(_0x1fa163){return _0x1fa163?{'count':_0x30840b,'rows':_0x1fa163}:null;}})[_0x3c9f('0x1d')](respondWithResult(_0x5dce3a,null))[_0x3c9f('0x25')](handleError(_0x5dce3a,null));};exports['addTeams']=function(_0x467d41,_0x4d1a1c,_0x4c3f66){var _0x3389f4=_0x467d41[_0x3c9f('0x57')][_0x3c9f('0x6d')];return db[_0x3c9f('0x6b')][_0x3c9f('0x51')]({'where':{'id':_0x3389f4},'attributes':['id'],'include':[{'model':db[_0x3c9f('0x61')],'as':_0x3c9f('0x6e'),'attributes':['id',_0x3c9f('0x37'),'online',_0x3c9f('0x6f'),'interface'],'raw':!![]}]})[_0x3c9f('0x1d')](function(_0x13a1b9){if(_0x13a1b9){var _0x5d5371=_[_0x3c9f('0x70')](_0x13a1b9,function(_0x2c2d7e){var _0x5d756b=_0x2c2d7e[_0x3c9f('0x32')]({'plain':!![]});return _0x5d756b[_0x3c9f('0x6e')];});return db[_0x3c9f('0x3a')][_0x3c9f('0x55')]({'where':{'id':_0x467d41[_0x3c9f('0x53')]['id']}})[_0x3c9f('0x1d')](function(_0x47b96e){return db[_0x3c9f('0x71')][_0x3c9f('0x72')](function(_0x3a2d53){return _0x47b96e[_0x3c9f('0x73')](_0x3389f4,{'transaction':_0x3a2d53})[_0x3c9f('0x1d')](function(){return BPromise[_0x3c9f('0x74')](_0x5d5371,function(_0x16fb75){return db[_0x3c9f('0x5e')]['findOrCreate']({'where':{'UserId':_0x16fb75['id'],'ChatQueueId':_0x467d41['params']['id']},'transaction':_0x3a2d53});});})[_0x3c9f('0x1d')](function(){_0x5d5371[_0x3c9f('0x75')](function(_0xebbd4d){socket[_0x3c9f('0x76')]('userChatQueue:save',{'UserId':_0xebbd4d['id'],'ChatQueueId':_0x47b96e['id']});});});});});}})['then'](respondWithStatusCode(_0x4d1a1c,null))[_0x3c9f('0x25')](handleError(_0x4d1a1c,null));};exports[_0x3c9f('0x77')]=function(_0x567388,_0x4bd5ae,_0x5f42aa){return db['Team'][_0x3c9f('0x51')]({'where':{'id':_0x567388[_0x3c9f('0x3f')][_0x3c9f('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x3c9f('0x61')],'as':_0x3c9f('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x3c9f('0x1d')](handleEntityNotFound(_0x4bd5ae,null))['then'](function(_0x7ab62b){var _0x226fed=_[_0x3c9f('0x3e')](_0x7ab62b,'id');var _0x3611f7=[];var _0x14c8dd=[];var _0x298673=squel[_0x3c9f('0x78')]();_0x298673[_0x3c9f('0x79')](_0x3c9f('0x7a'))[_0x3c9f('0x7b')](_0x3c9f('0x7c'),'tq')[_0x3c9f('0x7d')](_0x3c9f('0x7e'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3c9f('0x49')](_0x3c9f('0x7f'),_0x567388[_0x3c9f('0x53')]['id']);for(var _0x2ddb3d=0x0;_0x2ddb3d<_0x7ab62b[_0x3c9f('0x45')];_0x2ddb3d+=0x1){let _0x1b739a=_0x7ab62b[_0x2ddb3d];for(var _0x12a73a=0x0;_0x12a73a<_0x1b739a[_0x3c9f('0x6e')][_0x3c9f('0x45')];_0x12a73a+=0x1){let _0x8c0d90=_0x1b739a['Agents'][_0x12a73a];var _0x49a10d=_0x298673[_0x3c9f('0x80')]();_0x49a10d[_0x3c9f('0x49')]('ut.UserId\x20=\x20?',_0x8c0d90['id']);_0x14c8dd[_0x3c9f('0x81')](db[_0x3c9f('0x71')][_0x3c9f('0x3f')](_0x49a10d[_0x3c9f('0x82')](),{'type':db[_0x3c9f('0x71')][_0x3c9f('0x83')][_0x3c9f('0x84')]})['then'](function(_0x32ff6e){if(_0x32ff6e[_0x3c9f('0x45')]===0x1){return _0x8c0d90['id'];}else{var _0x3535de=_['every'](_['map'](_0x32ff6e,_0x3c9f('0x85')),function(_0x575c8e){return _[_0x3c9f('0x86')](_0x226fed,_0x575c8e);});if(_0x3535de){return _0x8c0d90['id'];}}}));}}return BPromise[_0x3c9f('0x87')](_0x14c8dd)[_0x3c9f('0x1d')](function(_0x30bb93){_0x3611f7=_(_0x3611f7)[_0x3c9f('0x88')](_0x30bb93)[_0x3c9f('0x89')]()[_0x3c9f('0x8a')]();return db[_0x3c9f('0x3a')][_0x3c9f('0x55')]({'where':{'id':_0x567388[_0x3c9f('0x53')]['id']}})[_0x3c9f('0x1d')](function(_0x448451){return db[_0x3c9f('0x71')]['transaction'](function(_0x29b059){return _0x448451[_0x3c9f('0x77')](_0x567388[_0x3c9f('0x3f')][_0x3c9f('0x6d')],{'transaction':_0x29b059})[_0x3c9f('0x1d')](function(){if(!_[_0x3c9f('0x8b')](_0x3611f7)){return _0x448451[_0x3c9f('0x8c')](_0x3611f7,{'transaction':_0x29b059});}})['then'](function(){_0x3611f7['forEach'](function(_0x567c62){socket['emit'](_0x3c9f('0x8d'),{'UserId':_0x567c62,'ChatQueueId':_0x448451['id']});});});});});});})['then'](respondWithStatusCode(_0x4bd5ae,null))[_0x3c9f('0x25')](handleError(_0x4bd5ae,null));};exports[_0x3c9f('0x8e')]=function(_0x394448,_0x3e23a2,_0x57bd0b){return db[_0x3c9f('0x3a')][_0x3c9f('0x55')]({'where':{'id':_0x394448['params']['id']}})[_0x3c9f('0x1d')](handleEntityNotFound(_0x3e23a2,null))[_0x3c9f('0x1d')](function(_0x50944a){if(_0x50944a){return _0x50944a[_0x3c9f('0x8e')](_0x394448['body'][_0x3c9f('0x6d')],_['omit'](_0x394448[_0x3c9f('0x57')],['ids','id'])||{})['spread'](function(_0x5e6780){for(var _0x57453a=0x0;_0x57453a<_0x394448[_0x3c9f('0x57')][_0x3c9f('0x6d')][_0x3c9f('0x45')];_0x57453a+=0x1){socket[_0x3c9f('0x76')](_0x3c9f('0x8f'),{'UserId':Number(_0x394448[_0x3c9f('0x57')][_0x3c9f('0x6d')][_0x57453a]),'ChatQueueId':Number(_0x394448[_0x3c9f('0x53')]['id'])});}return _0x5e6780;});}})['then'](respondWithResult(_0x3e23a2,null))[_0x3c9f('0x25')](handleError(_0x3e23a2,null));};exports[_0x3c9f('0x8c')]=function(_0x13702d,_0x36265f,_0x38ed89){return db[_0x3c9f('0x3a')][_0x3c9f('0x55')]({'where':{'id':_0x13702d['params']['id']}})[_0x3c9f('0x1d')](handleEntityNotFound(_0x36265f,null))[_0x3c9f('0x1d')](function(_0x1135e9){if(_0x1135e9){return _0x1135e9[_0x3c9f('0x8c')](_0x13702d[_0x3c9f('0x3f')][_0x3c9f('0x6d')])[_0x3c9f('0x1d')](function(){if(_[_0x3c9f('0x90')](_0x13702d['query'][_0x3c9f('0x6d')])){for(var _0xec3480=0x0;_0xec3480<_0x13702d[_0x3c9f('0x3f')]['ids'][_0x3c9f('0x45')];_0xec3480+=0x1){socket[_0x3c9f('0x76')](_0x3c9f('0x8d'),{'UserId':Number(_0x13702d['query'][_0x3c9f('0x6d')][_0xec3480]),'ChatQueueId':Number(_0x13702d[_0x3c9f('0x53')]['id'])});}}else{socket[_0x3c9f('0x76')]('userChatQueue:remove',{'UserId':Number(_0x13702d[_0x3c9f('0x3f')]['ids']),'ChatQueueId':Number(_0x13702d[_0x3c9f('0x53')]['id'])});}});}})[_0x3c9f('0x1d')](respondWithStatusCode(_0x36265f,null))[_0x3c9f('0x25')](handleError(_0x36265f,null));};exports[_0x3c9f('0x91')]=function(_0x4bb12e,_0x312197,_0x1c01ec){var _0x54a22e={};var _0x216a8b={};var _0x333447;var _0x3a934c;return db['ChatQueue'][_0x3c9f('0x5d')]({'where':{'id':_0x4bb12e[_0x3c9f('0x53')]['id']}})[_0x3c9f('0x1d')](handleEntityNotFound(_0x312197,null))[_0x3c9f('0x1d')](function(_0x542390){if(_0x542390){_0x333447=_0x542390;_0x216a8b[_0x3c9f('0x42')]=_[_0x3c9f('0x54')](db['User'][_0x3c9f('0x3b')]);_0x216a8b[_0x3c9f('0x3f')]=_[_0x3c9f('0x54')](_0x4bb12e[_0x3c9f('0x3f')]);_0x216a8b[_0x3c9f('0x40')]=_['intersection'](_0x216a8b['model'],_0x216a8b[_0x3c9f('0x3f')]);_0x54a22e[_0x3c9f('0x44')]=_['intersection'](_0x216a8b[_0x3c9f('0x42')],qs[_0x3c9f('0x43')](_0x4bb12e['query'][_0x3c9f('0x43')]));_0x54a22e[_0x3c9f('0x44')]=_0x54a22e[_0x3c9f('0x44')][_0x3c9f('0x45')]?_0x54a22e[_0x3c9f('0x44')]:_0x216a8b[_0x3c9f('0x42')];_0x54a22e[_0x3c9f('0x47')]=qs[_0x3c9f('0x48')](_0x4bb12e[_0x3c9f('0x3f')][_0x3c9f('0x48')]);_0x54a22e[_0x3c9f('0x49')]=qs[_0x3c9f('0x40')](_[_0x3c9f('0x4a')](_0x4bb12e[_0x3c9f('0x3f')],_0x216a8b[_0x3c9f('0x40')]));if(_0x4bb12e[_0x3c9f('0x3f')][_0x3c9f('0x4d')]){_0x54a22e[_0x3c9f('0x49')]=_['merge'](_0x54a22e[_0x3c9f('0x49')],{'$or':_[_0x3c9f('0x3e')](_0x54a22e['attributes'],function(_0xfa853b){var _0x20df35={};_0x20df35[_0xfa853b]={'$like':'%'+_0x4bb12e[_0x3c9f('0x3f')][_0x3c9f('0x4d')]+'%'};return _0x20df35;})});}_0x54a22e=_['merge']({},_0x54a22e,_0x4bb12e[_0x3c9f('0x4e')]);return _0x333447[_0x3c9f('0x91')](_0x54a22e);}})[_0x3c9f('0x1d')](function(_0x4e3e20){if(_0x4e3e20){_0x3a934c=_0x4e3e20['length'];if(!_0x4bb12e[_0x3c9f('0x3f')][_0x3c9f('0x5f')]('nolimit')){_0x54a22e[_0x3c9f('0x2a')]=qs[_0x3c9f('0x2a')](_0x4bb12e[_0x3c9f('0x3f')][_0x3c9f('0x2a')]);_0x54a22e[_0x3c9f('0x2c')]=qs['offset'](_0x4bb12e[_0x3c9f('0x3f')]['offset']);}return _0x333447[_0x3c9f('0x91')](_0x54a22e);}})[_0x3c9f('0x1d')](function(_0x4b7475){if(_0x4b7475){return _0x4b7475?{'count':_0x3a934c,'rows':_0x4b7475}:null;}})[_0x3c9f('0x1d')](respondWithResult(_0x312197,null))[_0x3c9f('0x25')](handleError(_0x312197,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 309cfc3..a11b009 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 _0x8734=['update','emit','events','ChatQueue','setMaxListeners','save'];(function(_0x2a7ed0,_0x23e60f){var _0x56c2cb=function(_0x429885){while(--_0x429885){_0x2a7ed0['push'](_0x2a7ed0['shift']());}};_0x56c2cb(++_0x23e60f);}(_0x8734,0x134));var _0x4873=function(_0xd6df5e,_0x4a4e46){_0xd6df5e=_0xd6df5e-0x0;var _0x155b12=_0x8734[_0xd6df5e];return _0x155b12;};'use strict';var EventEmitter=require(_0x4873('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x4873('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4873('0x2')](0x0);var events={'afterCreate':_0x4873('0x3'),'afterUpdate':_0x4873('0x4'),'afterDestroy':'remove'};function emitEvent(_0x35bd54){return function(_0x5bcb32,_0x1ae455,_0x2528ff){ChatQueueEvents['emit'](_0x35bd54+':'+_0x5bcb32['id'],_0x5bcb32);ChatQueueEvents[_0x4873('0x5')](_0x35bd54,_0x5bcb32);_0x2528ff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x5395=['events','ChatQueue','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3ce0f3,_0x3974c7){var _0x23e65e=function(_0x2238b4){while(--_0x2238b4){_0x3ce0f3['push'](_0x3ce0f3['shift']());}};_0x23e65e(++_0x3974c7);}(_0x5395,0x150));var _0x5539=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x5395[_0x46e363];return _0x3fb059;};'use strict';var EventEmitter=require(_0x5539('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x5539('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5539('0x2'),'afterDestroy':_0x5539('0x3')};function emitEvent(_0x2d24c7){return function(_0x4cd571,_0x2b6f8b,_0x453ad5){ChatQueueEvents[_0x5539('0x4')](_0x2d24c7+':'+_0x4cd571['id'],_0x4cd571);ChatQueueEvents[_0x5539('0x4')](_0x2d24c7,_0x4cd571);_0x453ad5(null);};}for(var e in events){if(events[_0x5539('0x5')](e)){var event=events[e];ChatQueue[_0x5539('0x6')](e,emitEvent(event));}}module[_0x5539('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index a03d4e1..3af8996 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 _0x70a0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','util','../../config/logger','api'];(function(_0x5cc231,_0x40002f){var _0x1f48c2=function(_0x32a83f){while(--_0x32a83f){_0x5cc231['push'](_0x5cc231['shift']());}};_0x1f48c2(++_0x40002f);}(_0x70a0,0x1d6));var _0x070a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x70a0[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x070a('0x0'));var logger=require(_0x070a('0x1'))(_0x070a('0x2'));var moment=require(_0x070a('0x3'));var BPromise=require(_0x070a('0x4'));var rp=require(_0x070a('0x5'));var fs=require('fs');var path=require(_0x070a('0x6'));var rimraf=require(_0x070a('0x7'));var config=require(_0x070a('0x8'));var attributes=require(_0x070a('0x9'));module[_0x070a('0xa')]=function(_0x1ebed0,_0x112fe0){return _0x1ebed0['define']('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35ba=['ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','define'];(function(_0x4d3475,_0x1cea7d){var _0xb8eab=function(_0x2fc76c){while(--_0x2fc76c){_0x4d3475['push'](_0x4d3475['shift']());}};_0xb8eab(++_0x1cea7d);}(_0x35ba,0x1c9));var _0xa35b=function(_0x3126b6,_0x450061){_0x3126b6=_0x3126b6-0x0;var _0x116531=_0x35ba[_0x3126b6];return _0x116531;};'use strict';var _=require(_0xa35b('0x0'));var util=require(_0xa35b('0x1'));var logger=require(_0xa35b('0x2'))(_0xa35b('0x3'));var moment=require(_0xa35b('0x4'));var BPromise=require('bluebird');var rp=require(_0xa35b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa35b('0x6'));var config=require(_0xa35b('0x7'));var attributes=require(_0xa35b('0x8'));module[_0xa35b('0x9')]=function(_0x16584e,_0x3ce36b){return _0x16584e[_0xa35b('0xa')](_0xa35b('0xb'),attributes,{'tableName':_0xa35b('0xc'),'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 3225ae9..1d6d548 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 _0x0664=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatQueue.socket','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options','where','attributes','limit','include','map','model','ShowChatQueue','find','then','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x252699,_0x134b4e){var _0x56d0c6=function(_0x5551a8){while(--_0x5551a8){_0x252699['push'](_0x252699['shift']());}};_0x56d0c6(++_0x134b4e);}(_0x0664,0x93));var _0x4066=function(_0x3790c1,_0x596e3a){_0x3790c1=_0x3790c1-0x0;var _0x334c6d=_0x0664[_0x3790c1];return _0x334c6d;};'use strict';var _=require('lodash');var util=require(_0x4066('0x0'));var moment=require('moment');var BPromise=require(_0x4066('0x1'));var rs=require(_0x4066('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4066('0x3'))['db'];var utils=require(_0x4066('0x4'));var logger=require(_0x4066('0x5'))(_0x4066('0x6'));var config=require(_0x4066('0x7'));var jayson=require(_0x4066('0x8'));var client=jayson[_0x4066('0x9')][_0x4066('0xa')]({'port':0x232a});config[_0x4066('0xb')]=_[_0x4066('0xc')](config['redis'],{'host':_0x4066('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4066('0xb')]));require(_0x4066('0xe'))['register'](socket);function respondWithRpcPromise(_0x5f3d44,_0x1da4d8,_0x3ea971){return new BPromise(function(_0x16a1f7,_0x41ad8b){return client['request'](_0x5f3d44,_0x3ea971)['then'](function(_0x52d31c){logger['info'](_0x4066('0xf'),_0x1da4d8,_0x4066('0x10'));logger[_0x4066('0x11')](_0x4066('0x12'),_0x1da4d8,_0x4066('0x10'),JSON[_0x4066('0x13')](_0x52d31c));if(_0x52d31c[_0x4066('0x14')]){if(_0x52d31c[_0x4066('0x14')]['code']===0x1f4){logger[_0x4066('0x14')](_0x4066('0xf'),_0x1da4d8,_0x52d31c['error'][_0x4066('0x15')]);return _0x41ad8b(_0x52d31c['error'][_0x4066('0x15')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x1da4d8,_0x52d31c[_0x4066('0x14')][_0x4066('0x15')]);return _0x16a1f7(_0x52d31c[_0x4066('0x14')][_0x4066('0x15')]);}else{logger[_0x4066('0x16')](_0x4066('0xf'),_0x1da4d8,_0x4066('0x10'));_0x16a1f7(_0x52d31c[_0x4066('0x17')][_0x4066('0x15')]);}})[_0x4066('0x18')](function(_0x511cfa){logger['error'](_0x4066('0xf'),_0x1da4d8,_0x511cfa);_0x41ad8b(_0x511cfa);});});}exports[_0x4066('0x19')]=function(_0x5b02a4){var _0x414e6c=this;return new Promise(function(_0x215d68,_0x382950){return db[_0x4066('0x1a')][_0x4066('0x1b')]({'raw':_0x5b02a4[_0x4066('0x1c')]?_0x5b02a4['options']['raw']===undefined?!![]:![]:!![],'where':_0x5b02a4['options']?_0x5b02a4['options'][_0x4066('0x1d')]||null:null,'attributes':_0x5b02a4[_0x4066('0x1c')]?_0x5b02a4[_0x4066('0x1c')][_0x4066('0x1e')]||null:null,'limit':_0x5b02a4[_0x4066('0x1c')]?_0x5b02a4['options'][_0x4066('0x1f')]||null:null,'include':_0x5b02a4[_0x4066('0x1c')]?_0x5b02a4[_0x4066('0x1c')][_0x4066('0x20')]?_[_0x4066('0x21')](_0x5b02a4['options']['include'],function(_0x2984ef){return{'model':db[_0x2984ef[_0x4066('0x22')]],'as':_0x2984ef['as'],'attributes':_0x2984ef[_0x4066('0x1e')],'include':_0x2984ef[_0x4066('0x20')]?_[_0x4066('0x21')](_0x2984ef[_0x4066('0x20')],function(_0x1f9e34){return{'model':db[_0x1f9e34[_0x4066('0x22')]],'as':_0x1f9e34['as'],'attributes':_0x1f9e34[_0x4066('0x1e')],'include':_0x1f9e34[_0x4066('0x20')]?_[_0x4066('0x21')](_0x1f9e34[_0x4066('0x20')],function(_0x540a9){return{'model':db[_0x540a9[_0x4066('0x22')]],'as':_0x540a9['as'],'attributes':_0x540a9[_0x4066('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x80e095){logger['info']('GetChatQueue',_0x5b02a4);logger['debug'](_0x4066('0x19'),_0x5b02a4,JSON['stringify'](_0x80e095));_0x215d68(_0x80e095);})[_0x4066('0x18')](function(_0x2a39e7){logger[_0x4066('0x14')]('GetChatQueue',_0x2a39e7[_0x4066('0x15')],_0x5b02a4);_0x382950(_0x414e6c['error'](0x1f4,_0x2a39e7[_0x4066('0x15')]));});});};exports[_0x4066('0x23')]=function(_0x5eaaca){var _0x4924cf=this;return new Promise(function(_0x3363e8,_0x10dbde){return db['ChatQueue'][_0x4066('0x24')]({'raw':_0x5eaaca[_0x4066('0x1c')]?_0x5eaaca[_0x4066('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5eaaca[_0x4066('0x1c')]?_0x5eaaca['options'][_0x4066('0x1d')]||null:null,'attributes':_0x5eaaca[_0x4066('0x1c')]?_0x5eaaca[_0x4066('0x1c')][_0x4066('0x1e')]||null:null,'include':_0x5eaaca[_0x4066('0x1c')]?_0x5eaaca[_0x4066('0x1c')][_0x4066('0x20')]?_[_0x4066('0x21')](_0x5eaaca[_0x4066('0x1c')][_0x4066('0x20')],function(_0x219010){return{'model':db[_0x219010[_0x4066('0x22')]],'as':_0x219010['as'],'attributes':_0x219010['attributes'],'include':_0x219010[_0x4066('0x20')]?_[_0x4066('0x21')](_0x219010['include'],function(_0x1e1134){return{'model':db[_0x1e1134[_0x4066('0x22')]],'as':_0x1e1134['as'],'attributes':_0x1e1134['attributes'],'include':_0x1e1134[_0x4066('0x20')]?_[_0x4066('0x21')](_0x1e1134[_0x4066('0x20')],function(_0x470fa6){return{'model':db[_0x470fa6[_0x4066('0x22')]],'as':_0x470fa6['as'],'attributes':_0x470fa6[_0x4066('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4066('0x25')](function(_0x178ca2){logger[_0x4066('0x16')]('ShowChatQueue',_0x5eaaca);logger[_0x4066('0x11')](_0x4066('0x23'),_0x5eaaca,JSON['stringify'](_0x178ca2));_0x3363e8(_0x178ca2);})[_0x4066('0x18')](function(_0x3c0e01){logger[_0x4066('0x14')]('ShowChatQueue',_0x3c0e01[_0x4066('0x15')],_0x5eaaca);_0x10dbde(_0x4924cf[_0x4066('0x14')](0x1f4,_0x3c0e01[_0x4066('0x15')]));});});}; \ No newline at end of file +var _0xa149=['model','then','stringify','ShowChatQueue','find','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','request\x20sent','debug','error','ChatQueue,\x20%s,\x20%s','message','info','result','GetChatQueue','findAll','options','raw','where','attributes','include','map'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xa149,0x18c));var _0x9a14=function(_0x5da35a,_0x1e2cdf){_0x5da35a=_0x5da35a-0x0;var _0x4ec963=_0xa149[_0x5da35a];return _0x4ec963;};'use strict';var _=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var moment=require(_0x9a14('0x2'));var BPromise=require(_0x9a14('0x3'));var rs=require(_0x9a14('0x4'));var fs=require('fs');var Redis=require(_0x9a14('0x5'));var db=require(_0x9a14('0x6'))['db'];var utils=require(_0x9a14('0x7'));var logger=require(_0x9a14('0x8'))('rpc');var config=require(_0x9a14('0x9'));var jayson=require(_0x9a14('0xa'));var client=jayson['client'][_0x9a14('0xb')]({'port':0x232a});config[_0x9a14('0xc')]=_[_0x9a14('0xd')](config[_0x9a14('0xc')],{'host':_0x9a14('0xe'),'port':0x18eb});var socket=require(_0x9a14('0xf'))(new Redis(config['redis']));require(_0x9a14('0x10'))['register'](socket);function respondWithRpcPromise(_0x3d0481,_0x25afa7,_0x36c9ed){return new BPromise(function(_0x33bb89,_0x4155e5){return client[_0x9a14('0x11')](_0x3d0481,_0x36c9ed)['then'](function(_0x5d4ed8){logger['info']('ChatQueue,\x20%s,\x20%s',_0x25afa7,_0x9a14('0x12'));logger[_0x9a14('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x25afa7,_0x9a14('0x12'),JSON['stringify'](_0x5d4ed8));if(_0x5d4ed8[_0x9a14('0x14')]){if(_0x5d4ed8['error']['code']===0x1f4){logger[_0x9a14('0x14')](_0x9a14('0x15'),_0x25afa7,_0x5d4ed8[_0x9a14('0x14')][_0x9a14('0x16')]);return _0x4155e5(_0x5d4ed8['error'][_0x9a14('0x16')]);}logger[_0x9a14('0x14')](_0x9a14('0x15'),_0x25afa7,_0x5d4ed8[_0x9a14('0x14')][_0x9a14('0x16')]);return _0x33bb89(_0x5d4ed8[_0x9a14('0x14')][_0x9a14('0x16')]);}else{logger[_0x9a14('0x17')](_0x9a14('0x15'),_0x25afa7,_0x9a14('0x12'));_0x33bb89(_0x5d4ed8[_0x9a14('0x18')]['message']);}})['catch'](function(_0x589822){logger[_0x9a14('0x14')]('ChatQueue,\x20%s,\x20%s',_0x25afa7,_0x589822);_0x4155e5(_0x589822);});});}exports[_0x9a14('0x19')]=function(_0x40ac4c){var _0x4e0c5f=this;return new Promise(function(_0x5bb00c,_0x53e151){return db['ChatQueue'][_0x9a14('0x1a')]({'raw':_0x40ac4c[_0x9a14('0x1b')]?_0x40ac4c[_0x9a14('0x1b')][_0x9a14('0x1c')]===undefined?!![]:![]:!![],'where':_0x40ac4c[_0x9a14('0x1b')]?_0x40ac4c[_0x9a14('0x1b')][_0x9a14('0x1d')]||null:null,'attributes':_0x40ac4c['options']?_0x40ac4c['options'][_0x9a14('0x1e')]||null:null,'limit':_0x40ac4c[_0x9a14('0x1b')]?_0x40ac4c[_0x9a14('0x1b')]['limit']||null:null,'include':_0x40ac4c[_0x9a14('0x1b')]?_0x40ac4c[_0x9a14('0x1b')][_0x9a14('0x1f')]?_[_0x9a14('0x20')](_0x40ac4c[_0x9a14('0x1b')][_0x9a14('0x1f')],function(_0x1ba34f){return{'model':db[_0x1ba34f[_0x9a14('0x21')]],'as':_0x1ba34f['as'],'attributes':_0x1ba34f['attributes'],'include':_0x1ba34f['include']?_[_0x9a14('0x20')](_0x1ba34f[_0x9a14('0x1f')],function(_0x3e20b5){return{'model':db[_0x3e20b5['model']],'as':_0x3e20b5['as'],'attributes':_0x3e20b5['attributes'],'include':_0x3e20b5[_0x9a14('0x1f')]?_[_0x9a14('0x20')](_0x3e20b5[_0x9a14('0x1f')],function(_0x44a589){return{'model':db[_0x44a589[_0x9a14('0x21')]],'as':_0x44a589['as'],'attributes':_0x44a589['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a14('0x22')](function(_0x4e171b){logger['info'](_0x9a14('0x19'),_0x40ac4c);logger[_0x9a14('0x13')]('GetChatQueue',_0x40ac4c,JSON[_0x9a14('0x23')](_0x4e171b));_0x5bb00c(_0x4e171b);})['catch'](function(_0x3930af){logger[_0x9a14('0x14')](_0x9a14('0x19'),_0x3930af[_0x9a14('0x16')],_0x40ac4c);_0x53e151(_0x4e0c5f[_0x9a14('0x14')](0x1f4,_0x3930af[_0x9a14('0x16')]));});});};exports[_0x9a14('0x24')]=function(_0x1d7a59){var _0x303758=this;return new Promise(function(_0x51dc13,_0x485251){return db['ChatQueue'][_0x9a14('0x25')]({'raw':_0x1d7a59[_0x9a14('0x1b')]?_0x1d7a59[_0x9a14('0x1b')][_0x9a14('0x1c')]===undefined?!![]:![]:!![],'where':_0x1d7a59[_0x9a14('0x1b')]?_0x1d7a59[_0x9a14('0x1b')][_0x9a14('0x1d')]||null:null,'attributes':_0x1d7a59['options']?_0x1d7a59[_0x9a14('0x1b')][_0x9a14('0x1e')]||null:null,'include':_0x1d7a59[_0x9a14('0x1b')]?_0x1d7a59[_0x9a14('0x1b')][_0x9a14('0x1f')]?_['map'](_0x1d7a59[_0x9a14('0x1b')][_0x9a14('0x1f')],function(_0x4eb8a0){return{'model':db[_0x4eb8a0[_0x9a14('0x21')]],'as':_0x4eb8a0['as'],'attributes':_0x4eb8a0['attributes'],'include':_0x4eb8a0[_0x9a14('0x1f')]?_[_0x9a14('0x20')](_0x4eb8a0[_0x9a14('0x1f')],function(_0x2901c1){return{'model':db[_0x2901c1[_0x9a14('0x21')]],'as':_0x2901c1['as'],'attributes':_0x2901c1[_0x9a14('0x1e')],'include':_0x2901c1[_0x9a14('0x1f')]?_[_0x9a14('0x20')](_0x2901c1[_0x9a14('0x1f')],function(_0x527c5c){return{'model':db[_0x527c5c['model']],'as':_0x527c5c['as'],'attributes':_0x527c5c[_0x9a14('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9a14('0x22')](function(_0x4c611a){logger[_0x9a14('0x17')](_0x9a14('0x24'),_0x1d7a59);logger['debug'](_0x9a14('0x24'),_0x1d7a59,JSON['stringify'](_0x4c611a));_0x51dc13(_0x4c611a);})[_0x9a14('0x26')](function(_0x1b3ff6){logger['error'](_0x9a14('0x24'),_0x1b3ff6[_0x9a14('0x16')],_0x1d7a59);_0x485251(_0x303758[_0x9a14('0x14')](0x1f4,_0x1b3ff6[_0x9a14('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 0ae441c..29e7396 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 _0x7bae=['remove','update','emit','removeListener','register','length','chatQueue:'];(function(_0x3765ff,_0x16916e){var _0x333f28=function(_0x208816){while(--_0x208816){_0x3765ff['push'](_0x3765ff['shift']());}};_0x333f28(++_0x16916e);}(_0x7bae,0x13b));var _0xe7ba=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x7bae[_0xa8883];return _0x479426;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0xe7ba('0x0'),_0xe7ba('0x1')];function createListener(_0x503803,_0x3963c7){return function(_0x4f2e91){_0x3963c7[_0xe7ba('0x2')](_0x503803,_0x4f2e91);};}function removeListener(_0x10908b,_0x166acb){return function(){ChatQueueEvents[_0xe7ba('0x3')](_0x10908b,_0x166acb);};}exports[_0xe7ba('0x4')]=function(_0xfd3a22){for(var _0x2d31df=0x0,_0x3c5e59=events[_0xe7ba('0x5')];_0x2d31df<_0x3c5e59;_0x2d31df++){var _0x34fb18=events[_0x2d31df];var _0x160565=createListener(_0xe7ba('0x6')+_0x34fb18,_0xfd3a22);ChatQueueEvents['on'](_0x34fb18,_0x160565);}}; \ No newline at end of file +var _0xd0bb=['chatQueue:','./chatQueue.events','save','remove','emit','register','length'];(function(_0x17b239,_0x50aa45){var _0x57eee2=function(_0x155fd4){while(--_0x155fd4){_0x17b239['push'](_0x17b239['shift']());}};_0x57eee2(++_0x50aa45);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0xb4411,_0x5d04ac){_0xb4411=_0xb4411-0x0;var _0x481db4=_0xd0bb[_0xb4411];return _0x481db4;};'use strict';var ChatQueueEvents=require(_0xbd0b('0x0'));var events=[_0xbd0b('0x1'),_0xbd0b('0x2'),'update'];function createListener(_0x68ea36,_0x4ab08f){return function(_0x39b03a){_0x4ab08f[_0xbd0b('0x3')](_0x68ea36,_0x39b03a);};}function removeListener(_0x53e6ce,_0x432acf){return function(){ChatQueueEvents['removeListener'](_0x53e6ce,_0x432acf);};}exports[_0xbd0b('0x4')]=function(_0x1b2499){for(var _0x158b5c=0x0,_0x37c205=events[_0xbd0b('0x5')];_0x158b5c<_0x37c205;_0x158b5c++){var _0x5eb975=events[_0x158b5c];var _0x2a4075=createListener(_0xbd0b('0x6')+_0x5eb975,_0x1b2499);ChatQueueEvents['on'](_0x5eb975,_0x2a4075);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 41e8611..82371d9 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 _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(_0xdb627f,_0x364a0c){var _0x2233a8=function(_0xfac23e){while(--_0xfac23e){_0xdb627f['push'](_0xdb627f['shift']());}};_0x2233a8(++_0x364a0c);}(_0x55ca,0x126));var _0xa55c=function(_0x465533,_0x56ab66){_0x465533=_0x465533-0x0;var _0x49489b=_0x55ca[_0x465533];return _0x49489b;};'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 +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x1b9f3b,_0x416c12){var _0x5c73b9=function(_0x591ea4){while(--_0x591ea4){_0x1b9f3b['push'](_0x1b9f3b['shift']());}};_0x5c73b9(++_0x416c12);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 890e57f..d0fd80b 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 _0xb6be=['STRING','DATE','moment','sequelize'];(function(_0x562785,_0x9bb9c4){var _0x303a17=function(_0x225660){while(--_0x225660){_0x562785['push'](_0x562785['shift']());}};_0x303a17(++_0x9bb9c4);}(_0xb6be,0x132));var _0xeb6b=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xb6be[_0x1ae5ab];return _0x1ce001;};'use strict';var moment=require(_0xeb6b('0x0'));var Sequelize=require(_0xeb6b('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xeb6b('0x2')]},'joinAt':{'type':Sequelize[_0xeb6b('0x3')]},'leaveAt':{'type':Sequelize[_0xeb6b('0x3')]},'acceptAt':{'type':Sequelize[_0xeb6b('0x3')]},'exitAt':{'type':Sequelize[_0xeb6b('0x3')]},'reason':{'type':Sequelize[_0xeb6b('0x2')]}}; \ No newline at end of file +var _0x94b9=['DATE','moment','exports','STRING'];(function(_0x25d18c,_0xab06b9){var _0x471e3e=function(_0xaf7502){while(--_0xaf7502){_0x25d18c['push'](_0x25d18c['shift']());}};_0x471e3e(++_0xab06b9);}(_0x94b9,0x1ad));var _0x994b=function(_0x20cdc3,_0x4055a7){_0x20cdc3=_0x20cdc3-0x0;var _0x47d456=_0x94b9[_0x20cdc3];return _0x47d456;};'use strict';var moment=require(_0x994b('0x0'));var Sequelize=require('sequelize');module[_0x994b('0x1')]={'uniqueid':{'type':Sequelize[_0x994b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x994b('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x994b('0x3')]},'acceptAt':{'type':Sequelize[_0x994b('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x994b('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 38e699d..8302824 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 _0x6f44=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','map','ChatQueueReport','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','VIRTUAL','where','count','includeAll','include','rows','catch','params','keys','rawAttributes','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x34ea04,_0x165a66){var _0x2b6576=function(_0x23de38){while(--_0x23de38){_0x34ea04['push'](_0x34ea04['shift']());}};_0x2b6576(++_0x165a66);}(_0x6f44,0x1ea));var _0x46f4=function(_0x176095,_0x5ccb73){_0x176095=_0x176095-0x0;var _0x2f80a4=_0x6f44[_0x176095];return _0x2f80a4;};'use strict';var emlformat=require(_0x46f4('0x0'));var rimraf=require(_0x46f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46f4('0x2'));var rp=require(_0x46f4('0x3'));var moment=require(_0x46f4('0x4'));var BPromise=require(_0x46f4('0x5'));var Mustache=require(_0x46f4('0x6'));var util=require(_0x46f4('0x7'));var path=require(_0x46f4('0x8'));var sox=require(_0x46f4('0x9'));var csv=require(_0x46f4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46f4('0xb'));var _=require(_0x46f4('0xc'));var squel=require(_0x46f4('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x46f4('0xe'));var toCsv=require(_0x46f4('0xa'));var querystring=require('querystring');var Papa=require(_0x46f4('0xf'));var Redis=require('ioredis');var authService=require(_0x46f4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x46f4('0x11'));var hardwareService=require(_0x46f4('0x12'));var logger=require(_0x46f4('0x13'))(_0x46f4('0x14'));var utils=require(_0x46f4('0x15'));var config=require(_0x46f4('0x16'));var licenseUtil=require(_0x46f4('0x17'));var db=require(_0x46f4('0x18'))['db'];function respondWithStatusCode(_0x21d4a6,_0x1f4748){_0x1f4748=_0x1f4748||0xcc;return function(_0x1dd233){if(_0x1dd233){return _0x21d4a6[_0x46f4('0x19')](_0x1f4748);}return _0x21d4a6['status'](_0x1f4748)[_0x46f4('0x1a')]();};}function respondWithResult(_0x33f73c,_0x52db86){_0x52db86=_0x52db86||0xc8;return function(_0x44a55b){if(_0x44a55b){return _0x33f73c[_0x46f4('0x1b')](_0x52db86)[_0x46f4('0x1c')](_0x44a55b);}};}function respondWithFilteredResult(_0x4dd2fb,_0x3dc516){return function(_0x4e0661){if(_0x4e0661){var _0x4e84ce=typeof _0x3dc516[_0x46f4('0x1d')]===_0x46f4('0x1e')&&typeof _0x3dc516[_0x46f4('0x1f')]==='undefined';var _0x5c191a=_0x4e0661['count'];var _0x5d3471=_0x4e84ce?0x0:_0x3dc516[_0x46f4('0x1d')];var _0x433297=_0x4e84ce?_0x4e0661['count']:_0x3dc516[_0x46f4('0x1d')]+_0x3dc516[_0x46f4('0x1f')];var _0x2232d6;if(_0x433297>=_0x5c191a){_0x433297=_0x5c191a;_0x2232d6=0xc8;}else{_0x2232d6=0xce;}_0x4dd2fb[_0x46f4('0x1b')](_0x2232d6);return _0x4dd2fb['set'](_0x46f4('0x20'),_0x5d3471+'-'+_0x433297+'/'+_0x5c191a)[_0x46f4('0x1c')](_0x4e0661);}return null;};}function patchUpdates(_0x1627db){return function(_0x6476f0){try{jsonpatch[_0x46f4('0x21')](_0x6476f0,_0x1627db,!![]);}catch(_0xdb9f25){return BPromise['reject'](_0xdb9f25);}return _0x6476f0[_0x46f4('0x22')]();};}function saveUpdates(_0x2b88d3,_0x39760b){return function(_0x4ba21a){if(_0x4ba21a){return _0x4ba21a[_0x46f4('0x23')](_0x2b88d3)[_0x46f4('0x24')](function(_0x185ec2){return _0x185ec2;});}return null;};}function removeEntity(_0x47528b,_0x36092e){return function(_0x41be5e){if(_0x41be5e){return _0x41be5e[_0x46f4('0x25')]()[_0x46f4('0x24')](function(){_0x47528b[_0x46f4('0x1b')](0xcc)[_0x46f4('0x1a')]();});}};}function handleEntityNotFound(_0x2ad553,_0x16cd7f){return function(_0x197e55){if(!_0x197e55){_0x2ad553['sendStatus'](0x194);}return _0x197e55;};}function handleError(_0x46e96d,_0x30d4fc){_0x30d4fc=_0x30d4fc||0x1f4;return function(_0xb23194){logger[_0x46f4('0x26')](_0xb23194[_0x46f4('0x27')]);if(_0xb23194[_0x46f4('0x28')]){delete _0xb23194['name'];}_0x46e96d[_0x46f4('0x1b')](_0x30d4fc)['send'](_0xb23194);};}exports['index']=function(_0x53ac21,_0x2cf22c){var _0x57ff78={},_0x1fb343={},_0x183f0c={'count':0x0,'rows':[]};var _0x3c8c91=_[_0x46f4('0x29')](db[_0x46f4('0x2a')]['rawAttributes'],function(_0x1d512b){return{'name':_0x1d512b[_0x46f4('0x2b')],'type':_0x1d512b[_0x46f4('0x2c')]['key']};});_0x1fb343[_0x46f4('0x2d')]=_[_0x46f4('0x29')](_0x3c8c91,_0x46f4('0x28'));_0x1fb343['query']=_['keys'](_0x53ac21[_0x46f4('0x2e')]);_0x1fb343[_0x46f4('0x2f')]=_[_0x46f4('0x30')](_0x1fb343['model'],_0x1fb343[_0x46f4('0x2e')]);_0x57ff78[_0x46f4('0x31')]=_['intersection'](_0x1fb343[_0x46f4('0x2d')],qs['fields'](_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x32')]));_0x57ff78[_0x46f4('0x31')]=_0x57ff78[_0x46f4('0x31')][_0x46f4('0x33')]?_0x57ff78['attributes']:_0x1fb343[_0x46f4('0x2d')];if(!_0x53ac21[_0x46f4('0x2e')]['hasOwnProperty'](_0x46f4('0x34'))){_0x57ff78[_0x46f4('0x1f')]=qs[_0x46f4('0x1f')](_0x53ac21[_0x46f4('0x2e')]['limit']);_0x57ff78[_0x46f4('0x1d')]=qs['offset'](_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x1d')]);}_0x57ff78[_0x46f4('0x35')]=qs[_0x46f4('0x36')](_0x53ac21['query'][_0x46f4('0x36')]);_0x57ff78['where']=qs['filters'](_[_0x46f4('0x37')](_0x53ac21['query'],_0x1fb343['filters']),_0x3c8c91);if(_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x38')]){_0x57ff78['where']=_[_0x46f4('0x39')](_0x57ff78['where'],{'$or':_[_0x46f4('0x29')](_0x3c8c91,function(_0x190c1a){if(_0x190c1a[_0x46f4('0x2c')]!==_0x46f4('0x3a')){var _0x5c6662={};_0x5c6662[_0x190c1a[_0x46f4('0x28')]]={'$like':'%'+_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x38')]+'%'};return _0x5c6662;}})});}_0x57ff78=_['merge']({},_0x57ff78,_0x53ac21['options']);var _0x4a44a6={'where':_0x57ff78[_0x46f4('0x3b')]};return db[_0x46f4('0x2a')][_0x46f4('0x3c')](_0x4a44a6)[_0x46f4('0x24')](function(_0x57bfd2){_0x183f0c[_0x46f4('0x3c')]=_0x57bfd2;if(_0x53ac21[_0x46f4('0x2e')][_0x46f4('0x3d')]){_0x57ff78[_0x46f4('0x3e')]=[{'all':!![]}];}return db[_0x46f4('0x2a')]['findAll'](_0x57ff78);})[_0x46f4('0x24')](function(_0x306400){_0x183f0c[_0x46f4('0x3f')]=_0x306400;return _0x183f0c;})[_0x46f4('0x24')](respondWithFilteredResult(_0x2cf22c,_0x57ff78))[_0x46f4('0x40')](handleError(_0x2cf22c,null));};exports['show']=function(_0x549af3,_0x4e11cb){var _0x21ce83={'raw':!![],'where':{'id':_0x549af3[_0x46f4('0x41')]['id']}},_0x1c0513={};_0x1c0513['model']=_[_0x46f4('0x42')](db[_0x46f4('0x2a')][_0x46f4('0x43')]);_0x1c0513[_0x46f4('0x2e')]=_[_0x46f4('0x42')](_0x549af3[_0x46f4('0x2e')]);_0x1c0513[_0x46f4('0x2f')]=_[_0x46f4('0x30')](_0x1c0513[_0x46f4('0x2d')],_0x1c0513[_0x46f4('0x2e')]);_0x21ce83[_0x46f4('0x31')]=_[_0x46f4('0x30')](_0x1c0513[_0x46f4('0x2d')],qs['fields'](_0x549af3[_0x46f4('0x2e')][_0x46f4('0x32')]));_0x21ce83[_0x46f4('0x31')]=_0x21ce83[_0x46f4('0x31')][_0x46f4('0x33')]?_0x21ce83[_0x46f4('0x31')]:_0x1c0513['model'];if(_0x549af3['query']['includeAll']){_0x21ce83[_0x46f4('0x3e')]=[{'all':!![]}];}_0x21ce83=_[_0x46f4('0x39')]({},_0x21ce83,_0x549af3[_0x46f4('0x44')]);return db[_0x46f4('0x2a')][_0x46f4('0x45')](_0x21ce83)[_0x46f4('0x24')](handleEntityNotFound(_0x4e11cb,null))[_0x46f4('0x24')](respondWithResult(_0x4e11cb,null))[_0x46f4('0x40')](handleError(_0x4e11cb,null));};exports[_0x46f4('0x46')]=function(_0xf73c15,_0x21319d){return db[_0x46f4('0x2a')]['create'](_0xf73c15[_0x46f4('0x47')],{})[_0x46f4('0x24')](respondWithResult(_0x21319d,0xc9))[_0x46f4('0x40')](handleError(_0x21319d,null));};exports['update']=function(_0x5a6d1f,_0x1fedc8){if(_0x5a6d1f[_0x46f4('0x47')]['id']){delete _0x5a6d1f[_0x46f4('0x47')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x5a6d1f[_0x46f4('0x41')]['id']}})[_0x46f4('0x24')](handleEntityNotFound(_0x1fedc8,null))[_0x46f4('0x24')](saveUpdates(_0x5a6d1f[_0x46f4('0x47')],null))[_0x46f4('0x24')](respondWithResult(_0x1fedc8,null))[_0x46f4('0x40')](handleError(_0x1fedc8,null));};exports['destroy']=function(_0x18f0e0,_0x2bbb25){return db[_0x46f4('0x2a')]['find']({'where':{'id':_0x18f0e0[_0x46f4('0x41')]['id']}})[_0x46f4('0x24')](handleEntityNotFound(_0x2bbb25,null))[_0x46f4('0x24')](removeEntity(_0x2bbb25,null))[_0x46f4('0x40')](handleError(_0x2bbb25,null));};exports['describe']=function(_0x26f39a,_0x478dd7){return db[_0x46f4('0x2a')][_0x46f4('0x48')]()[_0x46f4('0x24')](respondWithResult(_0x478dd7,null))['catch'](handleError(_0x478dd7,null));}; \ No newline at end of file +var _0xfc9b=['undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x2ade6c,_0x2d42f2){var _0x2cb372=function(_0x477d8a){while(--_0x477d8a){_0x2ade6c['push'](_0x2ade6c['shift']());}};_0x2cb372(++_0x2d42f2);}(_0xfc9b,0x74));var _0xbfc9=function(_0x34e160,_0x387076){_0x34e160=_0x34e160-0x0;var _0x2eb767=_0xfc9b[_0x34e160];return _0x2eb767;};'use strict';var emlformat=require(_0xbfc9('0x0'));var rimraf=require(_0xbfc9('0x1'));var zipdir=require(_0xbfc9('0x2'));var jsonpatch=require(_0xbfc9('0x3'));var rp=require(_0xbfc9('0x4'));var moment=require(_0xbfc9('0x5'));var BPromise=require(_0xbfc9('0x6'));var Mustache=require('mustache');var util=require(_0xbfc9('0x7'));var path=require('path');var sox=require(_0xbfc9('0x8'));var csv=require(_0xbfc9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbfc9('0xa'));var _=require(_0xbfc9('0xb'));var squel=require(_0xbfc9('0xc'));var crypto=require(_0xbfc9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbfc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbfc9('0xf'));var Papa=require('papaparse');var Redis=require(_0xbfc9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbfc9('0x11'));var as=require(_0xbfc9('0x12'));var hardwareService=require(_0xbfc9('0x13'));var logger=require(_0xbfc9('0x14'))(_0xbfc9('0x15'));var utils=require(_0xbfc9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbfc9('0x17'));var db=require(_0xbfc9('0x18'))['db'];function respondWithStatusCode(_0x57f46c,_0x364b14){_0x364b14=_0x364b14||0xcc;return function(_0x51783e){if(_0x51783e){return _0x57f46c[_0xbfc9('0x19')](_0x364b14);}return _0x57f46c[_0xbfc9('0x1a')](_0x364b14)[_0xbfc9('0x1b')]();};}function respondWithResult(_0x2a5c78,_0x59b8b8){_0x59b8b8=_0x59b8b8||0xc8;return function(_0x3fbad7){if(_0x3fbad7){return _0x2a5c78[_0xbfc9('0x1a')](_0x59b8b8)[_0xbfc9('0x1c')](_0x3fbad7);}};}function respondWithFilteredResult(_0x30c34e,_0x44d984){return function(_0x16a0fc){if(_0x16a0fc){var _0x2bc807=typeof _0x44d984[_0xbfc9('0x1d')]===_0xbfc9('0x1e')&&typeof _0x44d984[_0xbfc9('0x1f')]===_0xbfc9('0x1e');var _0x1b6218=_0x16a0fc[_0xbfc9('0x20')];var _0x21e216=_0x2bc807?0x0:_0x44d984[_0xbfc9('0x1d')];var _0x345e7a=_0x2bc807?_0x16a0fc[_0xbfc9('0x20')]:_0x44d984[_0xbfc9('0x1d')]+_0x44d984[_0xbfc9('0x1f')];var _0x130eba;if(_0x345e7a>=_0x1b6218){_0x345e7a=_0x1b6218;_0x130eba=0xc8;}else{_0x130eba=0xce;}_0x30c34e[_0xbfc9('0x1a')](_0x130eba);return _0x30c34e[_0xbfc9('0x21')]('Content-Range',_0x21e216+'-'+_0x345e7a+'/'+_0x1b6218)[_0xbfc9('0x1c')](_0x16a0fc);}return null;};}function patchUpdates(_0x1217f4){return function(_0x237897){try{jsonpatch[_0xbfc9('0x22')](_0x237897,_0x1217f4,!![]);}catch(_0x2df6b9){return BPromise[_0xbfc9('0x23')](_0x2df6b9);}return _0x237897[_0xbfc9('0x24')]();};}function saveUpdates(_0x3f1603,_0x2e6e5b){return function(_0x3f6c00){if(_0x3f6c00){return _0x3f6c00[_0xbfc9('0x25')](_0x3f1603)[_0xbfc9('0x26')](function(_0x39bc58){return _0x39bc58;});}return null;};}function removeEntity(_0x7012e0,_0x5a3420){return function(_0x1f365f){if(_0x1f365f){return _0x1f365f[_0xbfc9('0x27')]()[_0xbfc9('0x26')](function(){_0x7012e0[_0xbfc9('0x1a')](0xcc)[_0xbfc9('0x1b')]();});}};}function handleEntityNotFound(_0x4ab0ec,_0x4498ed){return function(_0xa64699){if(!_0xa64699){_0x4ab0ec[_0xbfc9('0x19')](0x194);}return _0xa64699;};}function handleError(_0x278d07,_0x1fb58c){_0x1fb58c=_0x1fb58c||0x1f4;return function(_0xfa504){logger[_0xbfc9('0x28')](_0xfa504[_0xbfc9('0x29')]);if(_0xfa504[_0xbfc9('0x2a')]){delete _0xfa504['name'];}_0x278d07['status'](_0x1fb58c)['send'](_0xfa504);};}exports[_0xbfc9('0x2b')]=function(_0x4dd2da,_0x58401b){var _0x123261={},_0x2aa754={},_0xfa1abc={'count':0x0,'rows':[]};var _0x14e1ac=_[_0xbfc9('0x2c')](db[_0xbfc9('0x2d')][_0xbfc9('0x2e')],function(_0x224645){return{'name':_0x224645[_0xbfc9('0x2f')],'type':_0x224645['type'][_0xbfc9('0x30')]};});_0x2aa754[_0xbfc9('0x31')]=_[_0xbfc9('0x2c')](_0x14e1ac,'name');_0x2aa754[_0xbfc9('0x32')]=_[_0xbfc9('0x33')](_0x4dd2da[_0xbfc9('0x32')]);_0x2aa754[_0xbfc9('0x34')]=_[_0xbfc9('0x35')](_0x2aa754[_0xbfc9('0x31')],_0x2aa754[_0xbfc9('0x32')]);_0x123261[_0xbfc9('0x36')]=_[_0xbfc9('0x35')](_0x2aa754[_0xbfc9('0x31')],qs['fields'](_0x4dd2da['query'][_0xbfc9('0x37')]));_0x123261[_0xbfc9('0x36')]=_0x123261[_0xbfc9('0x36')][_0xbfc9('0x38')]?_0x123261[_0xbfc9('0x36')]:_0x2aa754[_0xbfc9('0x31')];if(!_0x4dd2da['query'][_0xbfc9('0x39')]('nolimit')){_0x123261['limit']=qs[_0xbfc9('0x1f')](_0x4dd2da['query'][_0xbfc9('0x1f')]);_0x123261[_0xbfc9('0x1d')]=qs[_0xbfc9('0x1d')](_0x4dd2da['query'][_0xbfc9('0x1d')]);}_0x123261['order']=qs['sort'](_0x4dd2da[_0xbfc9('0x32')][_0xbfc9('0x3a')]);_0x123261['where']=qs[_0xbfc9('0x34')](_['pick'](_0x4dd2da['query'],_0x2aa754[_0xbfc9('0x34')]),_0x14e1ac);if(_0x4dd2da[_0xbfc9('0x32')][_0xbfc9('0x3b')]){_0x123261[_0xbfc9('0x3c')]=_[_0xbfc9('0x3d')](_0x123261[_0xbfc9('0x3c')],{'$or':_[_0xbfc9('0x2c')](_0x14e1ac,function(_0x32d787){if(_0x32d787['type']!==_0xbfc9('0x3e')){var _0x3756d9={};_0x3756d9[_0x32d787['name']]={'$like':'%'+_0x4dd2da['query'][_0xbfc9('0x3b')]+'%'};return _0x3756d9;}})});}_0x123261=_[_0xbfc9('0x3d')]({},_0x123261,_0x4dd2da['options']);var _0xbecdeb={'where':_0x123261[_0xbfc9('0x3c')]};return db[_0xbfc9('0x2d')][_0xbfc9('0x20')](_0xbecdeb)[_0xbfc9('0x26')](function(_0x3d473c){_0xfa1abc[_0xbfc9('0x20')]=_0x3d473c;if(_0x4dd2da[_0xbfc9('0x32')][_0xbfc9('0x3f')]){_0x123261[_0xbfc9('0x40')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xbfc9('0x41')](_0x123261);})['then'](function(_0x5c8479){_0xfa1abc[_0xbfc9('0x42')]=_0x5c8479;return _0xfa1abc;})[_0xbfc9('0x26')](respondWithFilteredResult(_0x58401b,_0x123261))['catch'](handleError(_0x58401b,null));};exports[_0xbfc9('0x43')]=function(_0x19a1c0,_0x557795){var _0x18b75d={'raw':!![],'where':{'id':_0x19a1c0[_0xbfc9('0x44')]['id']}},_0x36a0cc={};_0x36a0cc['model']=_['keys'](db[_0xbfc9('0x2d')][_0xbfc9('0x2e')]);_0x36a0cc['query']=_['keys'](_0x19a1c0['query']);_0x36a0cc['filters']=_[_0xbfc9('0x35')](_0x36a0cc[_0xbfc9('0x31')],_0x36a0cc['query']);_0x18b75d[_0xbfc9('0x36')]=_[_0xbfc9('0x35')](_0x36a0cc['model'],qs['fields'](_0x19a1c0['query'][_0xbfc9('0x37')]));_0x18b75d[_0xbfc9('0x36')]=_0x18b75d[_0xbfc9('0x36')][_0xbfc9('0x38')]?_0x18b75d[_0xbfc9('0x36')]:_0x36a0cc[_0xbfc9('0x31')];if(_0x19a1c0[_0xbfc9('0x32')][_0xbfc9('0x3f')]){_0x18b75d[_0xbfc9('0x40')]=[{'all':!![]}];}_0x18b75d=_[_0xbfc9('0x3d')]({},_0x18b75d,_0x19a1c0['options']);return db[_0xbfc9('0x2d')]['find'](_0x18b75d)[_0xbfc9('0x26')](handleEntityNotFound(_0x557795,null))[_0xbfc9('0x26')](respondWithResult(_0x557795,null))[_0xbfc9('0x45')](handleError(_0x557795,null));};exports['create']=function(_0x5e971d,_0x201281){return db[_0xbfc9('0x2d')][_0xbfc9('0x46')](_0x5e971d['body'],{})[_0xbfc9('0x26')](respondWithResult(_0x201281,0xc9))[_0xbfc9('0x45')](handleError(_0x201281,null));};exports['update']=function(_0x192d07,_0x307e72){if(_0x192d07['body']['id']){delete _0x192d07[_0xbfc9('0x47')]['id'];}return db[_0xbfc9('0x2d')]['find']({'where':{'id':_0x192d07[_0xbfc9('0x44')]['id']}})[_0xbfc9('0x26')](handleEntityNotFound(_0x307e72,null))['then'](saveUpdates(_0x192d07[_0xbfc9('0x47')],null))[_0xbfc9('0x26')](respondWithResult(_0x307e72,null))['catch'](handleError(_0x307e72,null));};exports['destroy']=function(_0x340520,_0x33a8d7){return db[_0xbfc9('0x2d')]['find']({'where':{'id':_0x340520[_0xbfc9('0x44')]['id']}})[_0xbfc9('0x26')](handleEntityNotFound(_0x33a8d7,null))[_0xbfc9('0x26')](removeEntity(_0x33a8d7,null))['catch'](handleError(_0x33a8d7,null));};exports[_0xbfc9('0x48')]=function(_0x3abd7d,_0x4f8ca9){return db[_0xbfc9('0x2d')][_0xbfc9('0x48')]()[_0xbfc9('0x26')](respondWithResult(_0x4f8ca9,null))[_0xbfc9('0x45')](handleError(_0x4f8ca9,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index ed0b803..f286551 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x497809,_0x451ba0){var _0x865565=function(_0x5428c1){while(--_0x5428c1){_0x497809['push'](_0x497809['shift']());}};_0x865565(++_0x451ba0);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xb7e7[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x4037cd,_0x1be60b){var _0x4dec28=function(_0x899142){while(--_0x899142){_0x4037cd['push'](_0x4037cd['shift']());}};_0x4dec28(++_0x1be60b);}(_0x757a,0xde));var _0xa757=function(_0x345ac6,_0x240795){_0x345ac6=_0x345ac6-0x0;var _0x585cd9=_0x757a[_0x345ac6];return _0x585cd9;};'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'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 6d2f27f..4fe73f1 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 _0x2408=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','CreateChatQueueReport','ChatQueueReport','options','UpdateChatQueueReport','update','raw','where','limit','then','lodash','util'];(function(_0x238d75,_0x7681cc){var _0x1244b7=function(_0x169db4){while(--_0x169db4){_0x238d75['push'](_0x238d75['shift']());}};_0x1244b7(++_0x7681cc);}(_0x2408,0x172));var _0x8240=function(_0x12dc5d,_0x262f06){_0x12dc5d=_0x12dc5d-0x0;var _0x3dc618=_0x2408[_0x12dc5d];return _0x3dc618;};'use strict';var _=require(_0x8240('0x0'));var util=require(_0x8240('0x1'));var moment=require('moment');var BPromise=require(_0x8240('0x2'));var rs=require(_0x8240('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8240('0x4'))['db'];var utils=require(_0x8240('0x5'));var logger=require('../../config/logger')(_0x8240('0x6'));var config=require(_0x8240('0x7'));var jayson=require(_0x8240('0x8'));var client=jayson[_0x8240('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7377,_0x475136,_0x48831b){return new BPromise(function(_0x6922b2,_0x2cc931){return client[_0x8240('0xa')](_0x1d7377,_0x48831b)['then'](function(_0x232acc){logger['info'](_0x8240('0xb'),_0x475136,'request\x20sent');logger[_0x8240('0xc')](_0x8240('0xd'),_0x475136,'request\x20sent',JSON[_0x8240('0xe')](_0x232acc));if(_0x232acc[_0x8240('0xf')]){if(_0x232acc[_0x8240('0xf')][_0x8240('0x10')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x475136,_0x232acc[_0x8240('0xf')][_0x8240('0x11')]);return _0x2cc931(_0x232acc[_0x8240('0xf')][_0x8240('0x11')]);}logger[_0x8240('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x475136,_0x232acc[_0x8240('0xf')][_0x8240('0x11')]);return _0x6922b2(_0x232acc[_0x8240('0xf')][_0x8240('0x11')]);}else{logger[_0x8240('0x12')](_0x8240('0xb'),_0x475136,_0x8240('0x13'));_0x6922b2(_0x232acc[_0x8240('0x14')]['message']);}})[_0x8240('0x15')](function(_0x178683){logger[_0x8240('0xf')](_0x8240('0xb'),_0x475136,_0x178683);_0x2cc931(_0x178683);});});}exports[_0x8240('0x16')]=function(_0x19dde1){var _0xfa76f5=this;return new Promise(function(_0xda231c,_0x1162fa){return db[_0x8240('0x17')]['create'](_0x19dde1['body'],{'raw':_0x19dde1[_0x8240('0x18')]?_0x19dde1[_0x8240('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4c3910){logger[_0x8240('0x12')](_0x8240('0x16'),_0x19dde1);logger[_0x8240('0xc')]('CreateChatQueueReport',_0x19dde1,JSON[_0x8240('0xe')](_0x4c3910));_0xda231c(_0x4c3910);})['catch'](function(_0x2c27a9){logger[_0x8240('0xf')](_0x8240('0x16'),_0x2c27a9[_0x8240('0x11')],_0x19dde1);_0x1162fa(_0xfa76f5[_0x8240('0xf')](0x1f4,_0x2c27a9[_0x8240('0x11')]));});});};exports[_0x8240('0x19')]=function(_0x56ce24){var _0x4737e1=this;return new Promise(function(_0x541e44,_0x3c1f06){return db['ChatQueueReport'][_0x8240('0x1a')](_0x56ce24['body'],{'raw':_0x56ce24['options']?_0x56ce24['options'][_0x8240('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56ce24[_0x8240('0x18')]?_0x56ce24[_0x8240('0x18')][_0x8240('0x1c')]||null:null,'attributes':_0x56ce24[_0x8240('0x18')]?_0x56ce24[_0x8240('0x18')]['attributes']||null:null,'limit':_0x56ce24[_0x8240('0x18')]?_0x56ce24[_0x8240('0x18')][_0x8240('0x1d')]||null:null})[_0x8240('0x1e')](function(_0x1efefc){logger[_0x8240('0x12')](_0x8240('0x19'),_0x56ce24);logger['debug'](_0x8240('0x19'),_0x56ce24,JSON[_0x8240('0xe')](_0x1efefc));_0x541e44(_0x1efefc);})[_0x8240('0x15')](function(_0x3106c5){logger['error'](_0x8240('0x19'),_0x3106c5[_0x8240('0x11')],_0x56ce24);_0x3c1f06(_0x4737e1['error'](0x1f4,_0x3106c5[_0x8240('0x11')]));});});}; \ No newline at end of file +var _0x6bcf=['code','message','result','CreateChatQueueReport','ChatQueueReport','options','raw','UpdateChatQueueReport','update','body','attributes','limit','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x43ffad,_0x6800b3){var _0x3c2a91=function(_0x406dac){while(--_0x406dac){_0x43ffad['push'](_0x43ffad['shift']());}};_0x3c2a91(++_0x6800b3);}(_0x6bcf,0x181));var _0xf6bc=function(_0x3cc8c0,_0x57150a){_0x3cc8c0=_0x3cc8c0-0x0;var _0x497477=_0x6bcf[_0x3cc8c0];return _0x497477;};'use strict';var _=require(_0xf6bc('0x0'));var util=require('util');var moment=require(_0xf6bc('0x1'));var BPromise=require(_0xf6bc('0x2'));var rs=require(_0xf6bc('0x3'));var fs=require('fs');var Redis=require(_0xf6bc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf6bc('0x5'))(_0xf6bc('0x6'));var config=require(_0xf6bc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf6bc('0x8')][_0xf6bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c3f2f,_0x484663,_0x21a9e1){return new BPromise(function(_0x3dee61,_0xb51752){return client['request'](_0x3c3f2f,_0x21a9e1)[_0xf6bc('0xa')](function(_0x414700){logger[_0xf6bc('0xb')](_0xf6bc('0xc'),_0x484663,_0xf6bc('0xd'));logger[_0xf6bc('0xe')](_0xf6bc('0xf'),_0x484663,_0xf6bc('0xd'),JSON[_0xf6bc('0x10')](_0x414700));if(_0x414700[_0xf6bc('0x11')]){if(_0x414700[_0xf6bc('0x11')][_0xf6bc('0x12')]===0x1f4){logger[_0xf6bc('0x11')](_0xf6bc('0xc'),_0x484663,_0x414700['error'][_0xf6bc('0x13')]);return _0xb51752(_0x414700['error'][_0xf6bc('0x13')]);}logger[_0xf6bc('0x11')](_0xf6bc('0xc'),_0x484663,_0x414700['error'][_0xf6bc('0x13')]);return _0x3dee61(_0x414700[_0xf6bc('0x11')][_0xf6bc('0x13')]);}else{logger['info'](_0xf6bc('0xc'),_0x484663,_0xf6bc('0xd'));_0x3dee61(_0x414700[_0xf6bc('0x14')][_0xf6bc('0x13')]);}})['catch'](function(_0x84a679){logger['error'](_0xf6bc('0xc'),_0x484663,_0x84a679);_0xb51752(_0x84a679);});});}exports[_0xf6bc('0x15')]=function(_0x5e2e7e){var _0x340f59=this;return new Promise(function(_0xebf22,_0x2b52a6){return db[_0xf6bc('0x16')]['create'](_0x5e2e7e['body'],{'raw':_0x5e2e7e[_0xf6bc('0x17')]?_0x5e2e7e['options'][_0xf6bc('0x18')]===undefined?!![]:![]:!![]})[_0xf6bc('0xa')](function(_0x5e0a40){logger['info'](_0xf6bc('0x15'),_0x5e2e7e);logger['debug'](_0xf6bc('0x15'),_0x5e2e7e,JSON[_0xf6bc('0x10')](_0x5e0a40));_0xebf22(_0x5e0a40);})['catch'](function(_0x41fa25){logger[_0xf6bc('0x11')](_0xf6bc('0x15'),_0x41fa25[_0xf6bc('0x13')],_0x5e2e7e);_0x2b52a6(_0x340f59[_0xf6bc('0x11')](0x1f4,_0x41fa25['message']));});});};exports[_0xf6bc('0x19')]=function(_0x5db815){var _0x332668=this;return new Promise(function(_0x251094,_0x44a42e){return db[_0xf6bc('0x16')][_0xf6bc('0x1a')](_0x5db815[_0xf6bc('0x1b')],{'raw':_0x5db815[_0xf6bc('0x17')]?_0x5db815[_0xf6bc('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5db815[_0xf6bc('0x17')]?_0x5db815['options']['where']||null:null,'attributes':_0x5db815[_0xf6bc('0x17')]?_0x5db815[_0xf6bc('0x17')][_0xf6bc('0x1c')]||null:null,'limit':_0x5db815[_0xf6bc('0x17')]?_0x5db815[_0xf6bc('0x17')][_0xf6bc('0x1d')]||null:null})['then'](function(_0x4b8e6d){logger[_0xf6bc('0xb')](_0xf6bc('0x19'),_0x5db815);logger[_0xf6bc('0xe')](_0xf6bc('0x19'),_0x5db815,JSON[_0xf6bc('0x10')](_0x4b8e6d));_0x251094(_0x4b8e6d);})[_0xf6bc('0x1e')](function(_0x3267c0){logger[_0xf6bc('0x11')](_0xf6bc('0x19'),_0x3267c0[_0xf6bc('0x13')],_0x5db815);_0x44a42e(_0x332668[_0xf6bc('0x11')](0x1f4,_0x3267c0[_0xf6bc('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 0be6e40..5cc12be 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 _0x10eb=['get','isAuthenticated','/describe','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./chatQueueReport.controller'];(function(_0x24b283,_0x510549){var _0x23d8a1=function(_0xc309f){while(--_0xc309f){_0x24b283['push'](_0x24b283['shift']());}};_0x23d8a1(++_0x510549);}(_0x10eb,0x106));var _0xb10e=function(_0x296e52,_0x428515){_0x296e52=_0x296e52-0x0;var _0x286070=_0x10eb[_0x296e52];return _0x286070;};'use strict';var multer=require(_0xb10e('0x0'));var util=require(_0xb10e('0x1'));var path=require(_0xb10e('0x2'));var timeout=require(_0xb10e('0x3'));var express=require('express');var router=express[_0xb10e('0x4')]();var fs_extra=require(_0xb10e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb10e('0x6'));var controller=require(_0xb10e('0x7'));router[_0xb10e('0x8')]('/',auth[_0xb10e('0x9')](),controller['index']);router['get'](_0xb10e('0xa'),auth[_0xb10e('0x9')](),controller['describe']);router['get'](_0xb10e('0xb'),auth[_0xb10e('0x9')](),controller[_0xb10e('0xc')]);router[_0xb10e('0xd')]('/',auth[_0xb10e('0x9')](),controller[_0xb10e('0xe')]);router['put'](_0xb10e('0xb'),auth[_0xb10e('0x9')](),controller[_0xb10e('0xf')]);router[_0xb10e('0x10')](_0xb10e('0xb'),auth[_0xb10e('0x9')](),controller['destroy']);module[_0xb10e('0x11')]=router; \ No newline at end of file +var _0xe087=['update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe087,0x1cf));var _0x7e08=function(_0x3781fe,_0x39211a){_0x3781fe=_0x3781fe-0x0;var _0x109f3e=_0xe087[_0x3781fe];return _0x109f3e;};'use strict';var multer=require(_0x7e08('0x0'));var util=require(_0x7e08('0x1'));var path=require(_0x7e08('0x2'));var timeout=require('connect-timeout');var express=require(_0x7e08('0x3'));var router=express[_0x7e08('0x4')]();var fs_extra=require(_0x7e08('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7e08('0x6'));var config=require(_0x7e08('0x7'));var controller=require('./chatQueueReport.controller');router[_0x7e08('0x8')]('/',auth[_0x7e08('0x9')](),controller[_0x7e08('0xa')]);router[_0x7e08('0x8')](_0x7e08('0xb'),auth[_0x7e08('0x9')](),controller[_0x7e08('0xc')]);router[_0x7e08('0x8')](_0x7e08('0xd'),auth[_0x7e08('0x9')](),controller[_0x7e08('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7e08('0xf')]);router[_0x7e08('0x10')](_0x7e08('0xd'),auth[_0x7e08('0x9')](),controller[_0x7e08('0x11')]);router[_0x7e08('0x12')]('/:id',auth[_0x7e08('0x9')](),controller['destroy']);module[_0x7e08('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 8f8129f..0dbdd3a 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x418815,_0x524351){var _0x3ab866=function(_0x2078e8){while(--_0x2078e8){_0x418815['push'](_0x418815['shift']());}};_0x3ab866(++_0x524351);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x541a67,_0x50728d){_0x541a67=_0x541a67-0x0;var _0x45da2a=_0xcb91[_0x541a67];return _0x45da2a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4fdaa5,_0x212ef3){var _0x48e67f=function(_0x524ef4){while(--_0x524ef4){_0x4fdaa5['push'](_0x4fdaa5['shift']());}};_0x48e67f(++_0x212ef3);}(_0xaa88,0x137));var _0x8aa8=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xaa88[_0x9df060];return _0x338dfe;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 6f4a70d..44bedc1 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 _0x4faa=['mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','then','destroy','error','stack','name','send','map','ChatTransferReport','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','params','catch','describe','eml-format','rimraf','moment'];(function(_0x3b5067,_0x402005){var _0x43a3b0=function(_0x4278c6){while(--_0x4278c6){_0x3b5067['push'](_0x3b5067['shift']());}};_0x43a3b0(++_0x402005);}(_0x4faa,0x8f));var _0xa4fa=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x4faa[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0xa4fa('0x0'));var rimraf=require(_0xa4fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa4fa('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa4fa('0x3'));var util=require(_0xa4fa('0x4'));var path=require(_0xa4fa('0x5'));var sox=require('sox');var csv=require(_0xa4fa('0x6'));var ejs=require(_0xa4fa('0x7'));var fs=require('fs');var fs_extra=require(_0xa4fa('0x8'));var _=require(_0xa4fa('0x9'));var squel=require(_0xa4fa('0xa'));var crypto=require(_0xa4fa('0xb'));var jsforce=require(_0xa4fa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa4fa('0x6'));var querystring=require(_0xa4fa('0xd'));var Papa=require(_0xa4fa('0xe'));var Redis=require('ioredis');var authService=require(_0xa4fa('0xf'));var qs=require(_0xa4fa('0x10'));var as=require(_0xa4fa('0x11'));var hardwareService=require(_0xa4fa('0x12'));var logger=require(_0xa4fa('0x13'))(_0xa4fa('0x14'));var utils=require(_0xa4fa('0x15'));var config=require(_0xa4fa('0x16'));var licenseUtil=require(_0xa4fa('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a9bfd,_0x431690){_0x431690=_0x431690||0xcc;return function(_0x3e8020){if(_0x3e8020){return _0x1a9bfd[_0xa4fa('0x18')](_0x431690);}return _0x1a9bfd[_0xa4fa('0x19')](_0x431690)[_0xa4fa('0x1a')]();};}function respondWithResult(_0x2cf4b5,_0x37b346){_0x37b346=_0x37b346||0xc8;return function(_0xf4b493){if(_0xf4b493){return _0x2cf4b5[_0xa4fa('0x19')](_0x37b346)[_0xa4fa('0x1b')](_0xf4b493);}};}function respondWithFilteredResult(_0x1f1871,_0x31fcce){return function(_0xa1c46d){if(_0xa1c46d){var _0x413a62=typeof _0x31fcce[_0xa4fa('0x1c')]===_0xa4fa('0x1d')&&typeof _0x31fcce[_0xa4fa('0x1e')]==='undefined';var _0xf75196=_0xa1c46d[_0xa4fa('0x1f')];var _0xb9b90d=_0x413a62?0x0:_0x31fcce[_0xa4fa('0x1c')];var _0x2bfd0c=_0x413a62?_0xa1c46d[_0xa4fa('0x1f')]:_0x31fcce[_0xa4fa('0x1c')]+_0x31fcce['limit'];var _0x456448;if(_0x2bfd0c>=_0xf75196){_0x2bfd0c=_0xf75196;_0x456448=0xc8;}else{_0x456448=0xce;}_0x1f1871[_0xa4fa('0x19')](_0x456448);return _0x1f1871['set']('Content-Range',_0xb9b90d+'-'+_0x2bfd0c+'/'+_0xf75196)[_0xa4fa('0x1b')](_0xa1c46d);}return null;};}function patchUpdates(_0x2de93c){return function(_0x114431){try{jsonpatch[_0xa4fa('0x20')](_0x114431,_0x2de93c,!![]);}catch(_0x4c3978){return BPromise['reject'](_0x4c3978);}return _0x114431['save']();};}function saveUpdates(_0x478ae2,_0x948f85){return function(_0x91fb2e){if(_0x91fb2e){return _0x91fb2e['update'](_0x478ae2)[_0xa4fa('0x21')](function(_0x337ae6){return _0x337ae6;});}return null;};}function removeEntity(_0x113524,_0x42c676){return function(_0x36af3f){if(_0x36af3f){return _0x36af3f[_0xa4fa('0x22')]()[_0xa4fa('0x21')](function(){_0x113524[_0xa4fa('0x19')](0xcc)[_0xa4fa('0x1a')]();});}};}function handleEntityNotFound(_0x52e14c,_0x4e430e){return function(_0x528a3c){if(!_0x528a3c){_0x52e14c[_0xa4fa('0x18')](0x194);}return _0x528a3c;};}function handleError(_0x18dd3f,_0x302d80){_0x302d80=_0x302d80||0x1f4;return function(_0x182b10){logger[_0xa4fa('0x23')](_0x182b10[_0xa4fa('0x24')]);if(_0x182b10[_0xa4fa('0x25')]){delete _0x182b10[_0xa4fa('0x25')];}_0x18dd3f['status'](_0x302d80)[_0xa4fa('0x26')](_0x182b10);};}exports['index']=function(_0x2a96d2,_0xd28914){var _0x3f9974={},_0x110011={},_0xf987a6={'count':0x0,'rows':[]};var _0x3c2953=_[_0xa4fa('0x27')](db[_0xa4fa('0x28')][_0xa4fa('0x29')],function(_0x3be477){return{'name':_0x3be477[_0xa4fa('0x2a')],'type':_0x3be477['type'][_0xa4fa('0x2b')]};});_0x110011[_0xa4fa('0x2c')]=_['map'](_0x3c2953,'name');_0x110011['query']=_[_0xa4fa('0x2d')](_0x2a96d2[_0xa4fa('0x2e')]);_0x110011['filters']=_[_0xa4fa('0x2f')](_0x110011[_0xa4fa('0x2c')],_0x110011[_0xa4fa('0x2e')]);_0x3f9974[_0xa4fa('0x30')]=_[_0xa4fa('0x2f')](_0x110011[_0xa4fa('0x2c')],qs['fields'](_0x2a96d2[_0xa4fa('0x2e')]['fields']));_0x3f9974[_0xa4fa('0x30')]=_0x3f9974['attributes'][_0xa4fa('0x31')]?_0x3f9974[_0xa4fa('0x30')]:_0x110011[_0xa4fa('0x2c')];if(!_0x2a96d2[_0xa4fa('0x2e')][_0xa4fa('0x32')](_0xa4fa('0x33'))){_0x3f9974[_0xa4fa('0x1e')]=qs[_0xa4fa('0x1e')](_0x2a96d2[_0xa4fa('0x2e')]['limit']);_0x3f9974[_0xa4fa('0x1c')]=qs[_0xa4fa('0x1c')](_0x2a96d2[_0xa4fa('0x2e')][_0xa4fa('0x1c')]);}_0x3f9974[_0xa4fa('0x34')]=qs[_0xa4fa('0x35')](_0x2a96d2[_0xa4fa('0x2e')][_0xa4fa('0x35')]);_0x3f9974['where']=qs[_0xa4fa('0x36')](_[_0xa4fa('0x37')](_0x2a96d2[_0xa4fa('0x2e')],_0x110011[_0xa4fa('0x36')]),_0x3c2953);if(_0x2a96d2['query'][_0xa4fa('0x38')]){_0x3f9974[_0xa4fa('0x39')]=_[_0xa4fa('0x3a')](_0x3f9974[_0xa4fa('0x39')],{'$or':_[_0xa4fa('0x27')](_0x3c2953,function(_0x478450){if(_0x478450[_0xa4fa('0x3b')]!==_0xa4fa('0x3c')){var _0x353f0c={};_0x353f0c[_0x478450[_0xa4fa('0x25')]]={'$like':'%'+_0x2a96d2[_0xa4fa('0x2e')][_0xa4fa('0x38')]+'%'};return _0x353f0c;}})});}_0x3f9974=_['merge']({},_0x3f9974,_0x2a96d2[_0xa4fa('0x3d')]);var _0x50ee29={'where':_0x3f9974[_0xa4fa('0x39')]};return db[_0xa4fa('0x28')][_0xa4fa('0x1f')](_0x50ee29)[_0xa4fa('0x21')](function(_0x27f5f1){_0xf987a6[_0xa4fa('0x1f')]=_0x27f5f1;if(_0x2a96d2[_0xa4fa('0x2e')][_0xa4fa('0x3e')]){_0x3f9974[_0xa4fa('0x3f')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xa4fa('0x40')](_0x3f9974);})[_0xa4fa('0x21')](function(_0x2473b5){_0xf987a6[_0xa4fa('0x41')]=_0x2473b5;return _0xf987a6;})[_0xa4fa('0x21')](respondWithFilteredResult(_0xd28914,_0x3f9974))['catch'](handleError(_0xd28914,null));};exports[_0xa4fa('0x42')]=function(_0x103d88,_0x285e88){var _0x370198={'raw':!![],'where':{'id':_0x103d88['params']['id']}},_0x5aa283={};_0x5aa283[_0xa4fa('0x2c')]=_[_0xa4fa('0x2d')](db['ChatTransferReport'][_0xa4fa('0x29')]);_0x5aa283[_0xa4fa('0x2e')]=_[_0xa4fa('0x2d')](_0x103d88[_0xa4fa('0x2e')]);_0x5aa283[_0xa4fa('0x36')]=_['intersection'](_0x5aa283[_0xa4fa('0x2c')],_0x5aa283[_0xa4fa('0x2e')]);_0x370198[_0xa4fa('0x30')]=_[_0xa4fa('0x2f')](_0x5aa283['model'],qs['fields'](_0x103d88[_0xa4fa('0x2e')]['fields']));_0x370198[_0xa4fa('0x30')]=_0x370198['attributes'][_0xa4fa('0x31')]?_0x370198['attributes']:_0x5aa283['model'];if(_0x103d88[_0xa4fa('0x2e')][_0xa4fa('0x3e')]){_0x370198['include']=[{'all':!![]}];}_0x370198=_[_0xa4fa('0x3a')]({},_0x370198,_0x103d88[_0xa4fa('0x3d')]);return db['ChatTransferReport'][_0xa4fa('0x43')](_0x370198)['then'](handleEntityNotFound(_0x285e88,null))['then'](respondWithResult(_0x285e88,null))['catch'](handleError(_0x285e88,null));};exports[_0xa4fa('0x44')]=function(_0x4ce7a4,_0x393e7f){return db[_0xa4fa('0x28')]['create'](_0x4ce7a4[_0xa4fa('0x45')],{})['then'](respondWithResult(_0x393e7f,0xc9))['catch'](handleError(_0x393e7f,null));};exports['update']=function(_0x49b382,_0x533c8a){if(_0x49b382['body']['id']){delete _0x49b382['body']['id'];}return db[_0xa4fa('0x28')]['find']({'where':{'id':_0x49b382[_0xa4fa('0x46')]['id']}})['then'](handleEntityNotFound(_0x533c8a,null))[_0xa4fa('0x21')](saveUpdates(_0x49b382[_0xa4fa('0x45')],null))[_0xa4fa('0x21')](respondWithResult(_0x533c8a,null))[_0xa4fa('0x47')](handleError(_0x533c8a,null));};exports[_0xa4fa('0x22')]=function(_0x581366,_0x4535f0){return db[_0xa4fa('0x28')]['find']({'where':{'id':_0x581366['params']['id']}})['then'](handleEntityNotFound(_0x4535f0,null))[_0xa4fa('0x21')](removeEntity(_0x4535f0,null))[_0xa4fa('0x47')](handleError(_0x4535f0,null));};exports[_0xa4fa('0x48')]=function(_0x54463f,_0x233928){return db['ChatTransferReport'][_0xa4fa('0x48')]()[_0xa4fa('0x21')](respondWithResult(_0x233928,null))[_0xa4fa('0x47')](handleError(_0x233928,null));}; \ No newline at end of file +var _0xd0e2=['body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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/utils','../../mysqldb','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','ChatTransferReport','rawAttributes','type','key','model','keys','filters','attributes','intersection','fields','query','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','length','includeAll','create'];(function(_0x37d03f,_0x3859d1){var _0x566781=function(_0x546437){while(--_0x546437){_0x37d03f['push'](_0x37d03f['shift']());}};_0x566781(++_0x3859d1);}(_0xd0e2,0xed));var _0x2d0e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd0e2[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d0e('0x0'));var zipdir=require(_0x2d0e('0x1'));var jsonpatch=require(_0x2d0e('0x2'));var rp=require(_0x2d0e('0x3'));var moment=require('moment');var BPromise=require(_0x2d0e('0x4'));var Mustache=require(_0x2d0e('0x5'));var util=require(_0x2d0e('0x6'));var path=require(_0x2d0e('0x7'));var sox=require(_0x2d0e('0x8'));var csv=require(_0x2d0e('0x9'));var ejs=require(_0x2d0e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d0e('0xb'));var squel=require(_0x2d0e('0xc'));var crypto=require(_0x2d0e('0xd'));var jsforce=require(_0x2d0e('0xe'));var deskjs=require(_0x2d0e('0xf'));var toCsv=require(_0x2d0e('0x9'));var querystring=require(_0x2d0e('0x10'));var Papa=require(_0x2d0e('0x11'));var Redis=require(_0x2d0e('0x12'));var authService=require(_0x2d0e('0x13'));var qs=require(_0x2d0e('0x14'));var as=require(_0x2d0e('0x15'));var hardwareService=require(_0x2d0e('0x16'));var logger=require(_0x2d0e('0x17'))(_0x2d0e('0x18'));var utils=require(_0x2d0e('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2d0e('0x1a'))['db'];function respondWithStatusCode(_0x41b2a8,_0x37a637){_0x37a637=_0x37a637||0xcc;return function(_0x575f5b){if(_0x575f5b){return _0x41b2a8['sendStatus'](_0x37a637);}return _0x41b2a8[_0x2d0e('0x1b')](_0x37a637)[_0x2d0e('0x1c')]();};}function respondWithResult(_0x4dfe78,_0x24093a){_0x24093a=_0x24093a||0xc8;return function(_0x83265){if(_0x83265){return _0x4dfe78['status'](_0x24093a)['json'](_0x83265);}};}function respondWithFilteredResult(_0x451c49,_0x59f113){return function(_0x13a5e4){if(_0x13a5e4){var _0x35fdae=typeof _0x59f113['offset']===_0x2d0e('0x1d')&&typeof _0x59f113[_0x2d0e('0x1e')]===_0x2d0e('0x1d');var _0x3e46f1=_0x13a5e4[_0x2d0e('0x1f')];var _0x55e810=_0x35fdae?0x0:_0x59f113[_0x2d0e('0x20')];var _0x5ce2f3=_0x35fdae?_0x13a5e4[_0x2d0e('0x1f')]:_0x59f113[_0x2d0e('0x20')]+_0x59f113[_0x2d0e('0x1e')];var _0x54c572;if(_0x5ce2f3>=_0x3e46f1){_0x5ce2f3=_0x3e46f1;_0x54c572=0xc8;}else{_0x54c572=0xce;}_0x451c49[_0x2d0e('0x1b')](_0x54c572);return _0x451c49['set'](_0x2d0e('0x21'),_0x55e810+'-'+_0x5ce2f3+'/'+_0x3e46f1)[_0x2d0e('0x22')](_0x13a5e4);}return null;};}function patchUpdates(_0xd6f6e8){return function(_0x3003b5){try{jsonpatch[_0x2d0e('0x23')](_0x3003b5,_0xd6f6e8,!![]);}catch(_0x3f8277){return BPromise[_0x2d0e('0x24')](_0x3f8277);}return _0x3003b5[_0x2d0e('0x25')]();};}function saveUpdates(_0x33c2c0,_0x3da617){return function(_0x516472){if(_0x516472){return _0x516472[_0x2d0e('0x26')](_0x33c2c0)[_0x2d0e('0x27')](function(_0x250fea){return _0x250fea;});}return null;};}function removeEntity(_0x18ff50,_0x3ccd11){return function(_0x12c1c1){if(_0x12c1c1){return _0x12c1c1[_0x2d0e('0x28')]()['then'](function(){_0x18ff50['status'](0xcc)[_0x2d0e('0x1c')]();});}};}function handleEntityNotFound(_0x2f930c,_0x4f6c0e){return function(_0x5cbf80){if(!_0x5cbf80){_0x2f930c[_0x2d0e('0x29')](0x194);}return _0x5cbf80;};}function handleError(_0x926fcb,_0x4bceeb){_0x4bceeb=_0x4bceeb||0x1f4;return function(_0xcaed90){logger[_0x2d0e('0x2a')](_0xcaed90[_0x2d0e('0x2b')]);if(_0xcaed90['name']){delete _0xcaed90[_0x2d0e('0x2c')];}_0x926fcb[_0x2d0e('0x1b')](_0x4bceeb)['send'](_0xcaed90);};}exports[_0x2d0e('0x2d')]=function(_0x594bcf,_0x25d27b){var _0x607231={},_0x457bbb={},_0x34039c={'count':0x0,'rows':[]};var _0x290841=_[_0x2d0e('0x2e')](db[_0x2d0e('0x2f')][_0x2d0e('0x30')],function(_0x3ee5bd){return{'name':_0x3ee5bd['fieldName'],'type':_0x3ee5bd[_0x2d0e('0x31')][_0x2d0e('0x32')]};});_0x457bbb[_0x2d0e('0x33')]=_[_0x2d0e('0x2e')](_0x290841,_0x2d0e('0x2c'));_0x457bbb['query']=_[_0x2d0e('0x34')](_0x594bcf['query']);_0x457bbb[_0x2d0e('0x35')]=_['intersection'](_0x457bbb[_0x2d0e('0x33')],_0x457bbb['query']);_0x607231[_0x2d0e('0x36')]=_[_0x2d0e('0x37')](_0x457bbb[_0x2d0e('0x33')],qs[_0x2d0e('0x38')](_0x594bcf[_0x2d0e('0x39')]['fields']));_0x607231[_0x2d0e('0x36')]=_0x607231[_0x2d0e('0x36')]['length']?_0x607231[_0x2d0e('0x36')]:_0x457bbb[_0x2d0e('0x33')];if(!_0x594bcf['query'][_0x2d0e('0x3a')]('nolimit')){_0x607231[_0x2d0e('0x1e')]=qs[_0x2d0e('0x1e')](_0x594bcf[_0x2d0e('0x39')][_0x2d0e('0x1e')]);_0x607231['offset']=qs[_0x2d0e('0x20')](_0x594bcf[_0x2d0e('0x39')][_0x2d0e('0x20')]);}_0x607231[_0x2d0e('0x3b')]=qs[_0x2d0e('0x3c')](_0x594bcf[_0x2d0e('0x39')][_0x2d0e('0x3c')]);_0x607231[_0x2d0e('0x3d')]=qs['filters'](_[_0x2d0e('0x3e')](_0x594bcf[_0x2d0e('0x39')],_0x457bbb['filters']),_0x290841);if(_0x594bcf[_0x2d0e('0x39')][_0x2d0e('0x3f')]){_0x607231[_0x2d0e('0x3d')]=_[_0x2d0e('0x40')](_0x607231[_0x2d0e('0x3d')],{'$or':_[_0x2d0e('0x2e')](_0x290841,function(_0x1e0adf){if(_0x1e0adf[_0x2d0e('0x31')]!=='VIRTUAL'){var _0x14077d={};_0x14077d[_0x1e0adf['name']]={'$like':'%'+_0x594bcf[_0x2d0e('0x39')]['filter']+'%'};return _0x14077d;}})});}_0x607231=_[_0x2d0e('0x40')]({},_0x607231,_0x594bcf[_0x2d0e('0x41')]);var _0x57e8ce={'where':_0x607231[_0x2d0e('0x3d')]};return db[_0x2d0e('0x2f')][_0x2d0e('0x1f')](_0x57e8ce)['then'](function(_0x39f5f9){_0x34039c['count']=_0x39f5f9;if(_0x594bcf[_0x2d0e('0x39')]['includeAll']){_0x607231[_0x2d0e('0x42')]=[{'all':!![]}];}return db[_0x2d0e('0x2f')][_0x2d0e('0x43')](_0x607231);})[_0x2d0e('0x27')](function(_0x385a0c){_0x34039c[_0x2d0e('0x44')]=_0x385a0c;return _0x34039c;})['then'](respondWithFilteredResult(_0x25d27b,_0x607231))[_0x2d0e('0x45')](handleError(_0x25d27b,null));};exports[_0x2d0e('0x46')]=function(_0x3352e8,_0x2a52a5){var _0x2b7585={'raw':!![],'where':{'id':_0x3352e8[_0x2d0e('0x47')]['id']}},_0x3e2aeb={};_0x3e2aeb[_0x2d0e('0x33')]=_[_0x2d0e('0x34')](db[_0x2d0e('0x2f')][_0x2d0e('0x30')]);_0x3e2aeb[_0x2d0e('0x39')]=_[_0x2d0e('0x34')](_0x3352e8[_0x2d0e('0x39')]);_0x3e2aeb[_0x2d0e('0x35')]=_[_0x2d0e('0x37')](_0x3e2aeb[_0x2d0e('0x33')],_0x3e2aeb[_0x2d0e('0x39')]);_0x2b7585['attributes']=_['intersection'](_0x3e2aeb[_0x2d0e('0x33')],qs[_0x2d0e('0x38')](_0x3352e8[_0x2d0e('0x39')][_0x2d0e('0x38')]));_0x2b7585['attributes']=_0x2b7585[_0x2d0e('0x36')][_0x2d0e('0x48')]?_0x2b7585[_0x2d0e('0x36')]:_0x3e2aeb['model'];if(_0x3352e8[_0x2d0e('0x39')][_0x2d0e('0x49')]){_0x2b7585[_0x2d0e('0x42')]=[{'all':!![]}];}_0x2b7585=_[_0x2d0e('0x40')]({},_0x2b7585,_0x3352e8[_0x2d0e('0x41')]);return db[_0x2d0e('0x2f')]['find'](_0x2b7585)[_0x2d0e('0x27')](handleEntityNotFound(_0x2a52a5,null))[_0x2d0e('0x27')](respondWithResult(_0x2a52a5,null))[_0x2d0e('0x45')](handleError(_0x2a52a5,null));};exports['create']=function(_0x570f2e,_0xfa28d4){return db[_0x2d0e('0x2f')][_0x2d0e('0x4a')](_0x570f2e['body'],{})['then'](respondWithResult(_0xfa28d4,0xc9))[_0x2d0e('0x45')](handleError(_0xfa28d4,null));};exports[_0x2d0e('0x26')]=function(_0x2f7ecf,_0x7a870e){if(_0x2f7ecf[_0x2d0e('0x4b')]['id']){delete _0x2f7ecf[_0x2d0e('0x4b')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x2f7ecf[_0x2d0e('0x47')]['id']}})[_0x2d0e('0x27')](handleEntityNotFound(_0x7a870e,null))['then'](saveUpdates(_0x2f7ecf[_0x2d0e('0x4b')],null))['then'](respondWithResult(_0x7a870e,null))[_0x2d0e('0x45')](handleError(_0x7a870e,null));};exports[_0x2d0e('0x28')]=function(_0x1f7b9e,_0x45d2bd){return db[_0x2d0e('0x2f')][_0x2d0e('0x4c')]({'where':{'id':_0x1f7b9e[_0x2d0e('0x47')]['id']}})[_0x2d0e('0x27')](handleEntityNotFound(_0x45d2bd,null))[_0x2d0e('0x27')](removeEntity(_0x45d2bd,null))[_0x2d0e('0x45')](handleError(_0x45d2bd,null));};exports[_0x2d0e('0x4d')]=function(_0x5d6efa,_0x3e481c){return db[_0x2d0e('0x2f')][_0x2d0e('0x4d')]()[_0x2d0e('0x27')](respondWithResult(_0x3e481c,null))[_0x2d0e('0x45')](handleError(_0x3e481c,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 309b547..75eddad 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 _0x9db8=['lodash','util','../../config/logger','moment','request-promise','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid'];(function(_0x512a50,_0x3057c2){var _0x57c236=function(_0x59338c){while(--_0x59338c){_0x512a50['push'](_0x512a50['shift']());}};_0x57c236(++_0x3057c2);}(_0x9db8,0x14a));var _0x89db=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x9db8[_0x4dc7b9];return _0x3ab114;};'use strict';var _=require(_0x89db('0x0'));var util=require(_0x89db('0x1'));var logger=require(_0x89db('0x2'))('api');var moment=require(_0x89db('0x3'));var BPromise=require('bluebird');var rp=require(_0x89db('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x89db('0x5'));var attributes=require(_0x89db('0x6'));module[_0x89db('0x7')]=function(_0x3e5a70,_0x2ae77e){return _0x3e5a70[_0x89db('0x8')](_0x89db('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x89db('0xa'),'fields':[_0x89db('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x470b=['report_chat_transfer','uniqueid','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ChatTransferReport'];(function(_0x32bc66,_0x2166ca){var _0xf18755=function(_0x5b7493){while(--_0x5b7493){_0x32bc66['push'](_0x32bc66['shift']());}};_0xf18755(++_0x2166ca);}(_0x470b,0x91));var _0xb470=function(_0x2f5b90,_0x4a6f40){_0x2f5b90=_0x2f5b90-0x0;var _0x53e3d4=_0x470b[_0x2f5b90];return _0x53e3d4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb470('0x0'));var moment=require(_0xb470('0x1'));var BPromise=require(_0xb470('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb470('0x3'));var rimraf=require(_0xb470('0x4'));var config=require(_0xb470('0x5'));var attributes=require('./chatTransferReport.attributes');module[_0xb470('0x6')]=function(_0x220a76,_0x1f616a){return _0x220a76[_0xb470('0x7')](_0xb470('0x8'),attributes,{'tableName':_0xb470('0x9'),'paranoid':![],'indexes':[{'name':_0xb470('0xa'),'fields':[_0xb470('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 d2774cb..c1c3012 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 _0x737f=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','lodash','util','moment'];(function(_0xd72e20,_0x1b7c31){var _0xe99992=function(_0x33f902){while(--_0x33f902){_0xd72e20['push'](_0xd72e20['shift']());}};_0xe99992(++_0x1b7c31);}(_0x737f,0x1d8));var _0xf737=function(_0x14a36e,_0x43c479){_0x14a36e=_0x14a36e-0x0;var _0x958c2c=_0x737f[_0x14a36e];return _0x958c2c;};'use strict';var _=require(_0xf737('0x0'));var util=require(_0xf737('0x1'));var moment=require(_0xf737('0x2'));var BPromise=require('bluebird');var rs=require(_0xf737('0x3'));var fs=require('fs');var Redis=require(_0xf737('0x4'));var db=require(_0xf737('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf737('0x6'));var config=require(_0xf737('0x7'));var jayson=require(_0xf737('0x8'));var client=jayson['client'][_0xf737('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x331837,_0x289eaa,_0x493942){return new BPromise(function(_0xc9e977,_0x5bdb46){return client['request'](_0x331837,_0x493942)[_0xf737('0xa')](function(_0x2f2e29){logger[_0xf737('0xb')](_0xf737('0xc'),_0x289eaa,'request\x20sent');logger[_0xf737('0xd')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x289eaa,_0xf737('0xe'),JSON[_0xf737('0xf')](_0x2f2e29));if(_0x2f2e29['error']){if(_0x2f2e29['error']['code']===0x1f4){logger[_0xf737('0x10')](_0xf737('0xc'),_0x289eaa,_0x2f2e29[_0xf737('0x10')][_0xf737('0x11')]);return _0x5bdb46(_0x2f2e29[_0xf737('0x10')][_0xf737('0x11')]);}logger[_0xf737('0x10')](_0xf737('0xc'),_0x289eaa,_0x2f2e29['error'][_0xf737('0x11')]);return _0xc9e977(_0x2f2e29[_0xf737('0x10')][_0xf737('0x11')]);}else{logger[_0xf737('0xb')](_0xf737('0xc'),_0x289eaa,_0xf737('0xe'));_0xc9e977(_0x2f2e29['result']['message']);}})[_0xf737('0x12')](function(_0x2be4bd){logger[_0xf737('0x10')](_0xf737('0xc'),_0x289eaa,_0x2be4bd);_0x5bdb46(_0x2be4bd);});});} \ No newline at end of file +var _0x9a7e=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util'];(function(_0x23a079,_0xb8c9aa){var _0x53f2a5=function(_0x1b3dc5){while(--_0x1b3dc5){_0x23a079['push'](_0x23a079['shift']());}};_0x53f2a5(++_0xb8c9aa);}(_0x9a7e,0xda));var _0xe9a7=function(_0x4994cc,_0x1c5245){_0x4994cc=_0x4994cc-0x0;var _0x4d99cf=_0x9a7e[_0x4994cc];return _0x4d99cf;};'use strict';var _=require(_0xe9a7('0x0'));var util=require(_0xe9a7('0x1'));var moment=require('moment');var BPromise=require(_0xe9a7('0x2'));var rs=require(_0xe9a7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9a7('0x4'))['db'];var utils=require(_0xe9a7('0x5'));var logger=require(_0xe9a7('0x6'))(_0xe9a7('0x7'));var config=require(_0xe9a7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe9a7('0x9')][_0xe9a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48a279,_0xfd9ef3,_0x34d353){return new BPromise(function(_0xcf000b,_0x2e0709){return client[_0xe9a7('0xb')](_0x48a279,_0x34d353)[_0xe9a7('0xc')](function(_0x52452e){logger['info'](_0xe9a7('0xd'),_0xfd9ef3,'request\x20sent');logger['debug'](_0xe9a7('0xe'),_0xfd9ef3,_0xe9a7('0xf'),JSON[_0xe9a7('0x10')](_0x52452e));if(_0x52452e[_0xe9a7('0x11')]){if(_0x52452e[_0xe9a7('0x11')][_0xe9a7('0x12')]===0x1f4){logger[_0xe9a7('0x11')](_0xe9a7('0xd'),_0xfd9ef3,_0x52452e[_0xe9a7('0x11')][_0xe9a7('0x13')]);return _0x2e0709(_0x52452e[_0xe9a7('0x11')][_0xe9a7('0x13')]);}logger['error'](_0xe9a7('0xd'),_0xfd9ef3,_0x52452e[_0xe9a7('0x11')]['message']);return _0xcf000b(_0x52452e[_0xe9a7('0x11')][_0xe9a7('0x13')]);}else{logger[_0xe9a7('0x14')](_0xe9a7('0xd'),_0xfd9ef3,'request\x20sent');_0xcf000b(_0x52452e['result'][_0xe9a7('0x13')]);}})[_0xe9a7('0x15')](function(_0x40590f){logger[_0xe9a7('0x11')](_0xe9a7('0xd'),_0xfd9ef3,_0x40590f);_0x2e0709(_0x40590f);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index ea13ccf..121e52d 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 _0x83d4=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete'];(function(_0x3ba537,_0x56b969){var _0x585c1a=function(_0x1dd30b){while(--_0x1dd30b){_0x3ba537['push'](_0x3ba537['shift']());}};_0x585c1a(++_0x56b969);}(_0x83d4,0x178));var _0x483d=function(_0x149cb4,_0x400116){_0x149cb4=_0x149cb4-0x0;var _0x3c7207=_0x83d4[_0x149cb4];return _0x3c7207;};'use strict';var multer=require(_0x483d('0x0'));var util=require(_0x483d('0x1'));var path=require(_0x483d('0x2'));var timeout=require(_0x483d('0x3'));var express=require(_0x483d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x483d('0x5'));var interaction=require(_0x483d('0x6'));var config=require(_0x483d('0x7'));var controller=require(_0x483d('0x8'));router[_0x483d('0x9')]('/',auth[_0x483d('0xa')](),controller[_0x483d('0xb')]);router['get'](_0x483d('0xc'),auth[_0x483d('0xa')](),controller['describe']);router[_0x483d('0x9')]('/:id',auth[_0x483d('0xa')](),controller[_0x483d('0xd')]);router[_0x483d('0xe')]('/',auth[_0x483d('0xa')](),controller[_0x483d('0xf')]);router[_0x483d('0x10')](_0x483d('0x11'),auth[_0x483d('0xa')](),controller[_0x483d('0x12')]);router[_0x483d('0x13')](_0x483d('0x11'),auth[_0x483d('0xa')](),controller[_0x483d('0x14')]);module[_0x483d('0x15')]=router; \ No newline at end of file +var _0x1f3e=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','util','connect-timeout'];(function(_0x43a1ef,_0x480444){var _0x46c412=function(_0x3661f8){while(--_0x3661f8){_0x43a1ef['push'](_0x43a1ef['shift']());}};_0x46c412(++_0x480444);}(_0x1f3e,0x1a2));var _0xe1f3=function(_0x347c8b,_0x5c4781){_0x347c8b=_0x347c8b-0x0;var _0x596949=_0x1f3e[_0x347c8b];return _0x596949;};'use strict';var multer=require('multer');var util=require(_0xe1f3('0x0'));var path=require('path');var timeout=require(_0xe1f3('0x1'));var express=require(_0xe1f3('0x2'));var router=express[_0xe1f3('0x3')]();var fs_extra=require(_0xe1f3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe1f3('0x5'));var config=require(_0xe1f3('0x6'));var controller=require(_0xe1f3('0x7'));router[_0xe1f3('0x8')]('/',auth[_0xe1f3('0x9')](),controller[_0xe1f3('0xa')]);router[_0xe1f3('0x8')](_0xe1f3('0xb'),auth[_0xe1f3('0x9')](),controller[_0xe1f3('0xc')]);router[_0xe1f3('0x8')](_0xe1f3('0xd'),auth['isAuthenticated'](),controller[_0xe1f3('0xe')]);router[_0xe1f3('0xf')]('/',auth['isAuthenticated'](),controller[_0xe1f3('0x10')]);router[_0xe1f3('0x11')]('/:id',auth[_0xe1f3('0x9')](),controller[_0xe1f3('0x12')]);router['delete'](_0xe1f3('0xd'),auth[_0xe1f3('0x9')](),controller[_0xe1f3('0x13')]);module[_0xe1f3('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 f529284..9d4c43b 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 _0xf109=['#011F6A','#ffffff','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','INTEGER','stringify','input','name','getDataValue','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','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.','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','email','Agent'];(function(_0x4d6dba,_0x2769b9){var _0x5680ff=function(_0x5dc8b5){while(--_0x5dc8b5){_0x4d6dba['push'](_0x4d6dba['shift']());}};_0x5680ff(++_0x2769b9);}(_0xf109,0xce));var _0x9f10=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xf109[_0x82129b];return _0x2ae5dc;};'use strict';var Sequelize=require(_0x9f10('0x0'));var rs=require(_0x9f10('0x1'));module[_0x9f10('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x9f10('0x3')]},'mapKey':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x4')},'mapKeyOffline':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x4')},'key':{'type':Sequelize[_0x9f10('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x5')},'customerAlias':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x9f10('0x3')],'allowNull':![],'defaultValue':_0x9f10('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9f10('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x9f10('0x3')],'allowNull':![],'defaultValue':_0x9f10('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x9f10('0x3')],'allowNull':![],'defaultValue':_0x9f10('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x9f10('0x3')]},'animation':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x9f10('0x9')]('rounded','squared'),'defaultValue':_0x9f10('0xa')},'header_online':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0xc')},'offline_chat_button':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0xe')},'download_transcript':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0x11')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0x12')},'noteTitle':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0xd')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x16')},'ratingType':{'type':Sequelize[_0x9f10('0x9')](_0x9f10('0x17'),_0x9f10('0x18')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x9f10('0x19')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x9f10('0x1a')]({'items':[{'type':_0x9f10('0x1b'),'variable':null,'config':{'placeholder':_0x9f10('0x1c'),'type':'text','required':!![]},'props':{'title':_0x9f10('0x1c'),'helpText':''}},{'type':_0x9f10('0x1b'),'props':{'title':_0x9f10('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x9f10('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x9f10('0x1d')](_0x9f10('0x1e'))?JSON['parse'](this[_0x9f10('0x1d')](_0x9f10('0x1e'))):{};},'set':function(_0x11cae7){return this[_0x9f10('0x1f')]('onlineForm',JSON['stringify'](_0x11cae7));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x9f10('0x1a')]({'items':[{'type':'input','props':{'title':_0x9f10('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x9f10('0x4'),'type':_0x9f10('0x4')},'variable':null},{'type':_0x9f10('0x20'),'config':{'placeholder':_0x9f10('0x21')},'props':{'title':'Comments','helpText':_0x9f10('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x9f10('0x1d')](_0x9f10('0x23'))?JSON[_0x9f10('0x24')](this[_0x9f10('0x1d')](_0x9f10('0x23'))):{};},'set':function(_0x581b1d){return this[_0x9f10('0x1f')](_0x9f10('0x23'),JSON[_0x9f10('0x1a')](_0x581b1d));}},'token':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x25')},'waitingMessage':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x26')},'offlineMessageBody':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0x28')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0x15')},'sendUnmanaged':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x9f10('0x29')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x9f10('0x3')]},'notificationTemplate':{'type':Sequelize[_0x9f10('0x29')],'defaultValue':function(){return _0x9f10('0x2a');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x2c')},'verticalAlignment':{'type':Sequelize[_0x9f10('0x19')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x2d')},'messagesAlignment':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x2e')},'defaultTitle':{'type':Sequelize[_0x9f10('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x9f10('0x19')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x9f10('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9f10('0x19')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9f10('0x19')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x9f10('0x3')],'defaultValue':_0x9f10('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x9f10('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![],'comment':_0x9f10('0x31'),'set':function(_0x433e70){if(!_0x433e70)this[_0x9f10('0x1f')](_0x9f10('0x32'),null);this[_0x9f10('0x1f')](_0x9f10('0x33'),_0x433e70);}},'vidaooEscalation':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x9f10('0x3')]},'vidaooTopic':{'type':Sequelize[_0x9f10('0x3')],'allowNull':![],'defaultValue':_0x9f10('0x34')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xe706=['Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','TEXT','stringify','name','text','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','getDataValue','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','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','bottom_right','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x4be327,_0x180e84){var _0x43b2c8=function(_0x4d1d91){while(--_0x4d1d91){_0x4be327['push'](_0x4be327['shift']());}};_0x43b2c8(++_0x180e84);}(_0xe706,0xa3));var _0x6e70=function(_0x1be9ce,_0x27443d){_0x1be9ce=_0x1be9ce-0x0;var _0x164439=_0xe706[_0x1be9ce];return _0x164439;};'use strict';var Sequelize=require(_0x6e70('0x0'));var rs=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![],'unique':_0x6e70('0x4')},'description':{'type':Sequelize[_0x6e70('0x3')]},'mapKey':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x5')},'mapKeyOffline':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x5')},'key':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x6')},'customerAlias':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![],'defaultValue':_0x6e70('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![],'defaultValue':_0x6e70('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![],'defaultValue':_0x6e70('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![],'defaultValue':_0x6e70('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6e70('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6e70('0x3')]},'animation':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6e70('0xb')](_0x6e70('0xc'),'squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0xd')},'start_chat_button':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0xe')},'offline_chat_button':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0xf')},'header_offline':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x10')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x11')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x12')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x13')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x14')},'noteTitle':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x16')},'closingMessageButton':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x17')},'conditionAgreement':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x18')},'ratingType':{'type':Sequelize[_0x6e70('0xb')](_0x6e70('0x19'),_0x6e70('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x6e70('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6e70('0x1b')],'defaultValue':function(){return JSON[_0x6e70('0x1c')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x6e70('0x1d'),'type':_0x6e70('0x1e'),'required':!![]},'props':{'title':_0x6e70('0x1d'),'helpText':''}},{'type':'input','props':{'title':_0x6e70('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x6e70('0x1f'))?JSON[_0x6e70('0x20')](this['getDataValue'](_0x6e70('0x1f'))):{};},'set':function(_0x1196ed){return this['setDataValue'](_0x6e70('0x1f'),JSON[_0x6e70('0x1c')](_0x1196ed));}},'offlineForm':{'type':Sequelize[_0x6e70('0x1b')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0x6e70('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x6e70('0x5'),'type':_0x6e70('0x5')},'variable':null},{'type':_0x6e70('0x21'),'config':{'placeholder':_0x6e70('0x22')},'props':{'title':'Comments','helpText':_0x6e70('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x6e70('0x24')](_0x6e70('0x25'))?JSON[_0x6e70('0x20')](this[_0x6e70('0x24')](_0x6e70('0x25'))):{};},'set':function(_0x3f78d2){return this[_0x6e70('0x26')](_0x6e70('0x25'),JSON[_0x6e70('0x1c')](_0x3f78d2));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6e70('0x27')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6e70('0x3')]},'forwardOffline':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6e70('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x28')},'waitingMessage':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x29')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x2a')},'enableUnmanagedNote':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x2b')},'skipUnmanaged':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x17')},'sendUnmanaged':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6e70('0x1b')],'defaultValue':function(){return _0x6e70('0x2c');}},'notificationSound':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x2d')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6e70('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x2e')},'verticalAlignment':{'type':Sequelize[_0x6e70('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x2f')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x6e70('0x1b')]},'showCustomerAvatar':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6e70('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![],'defaultValue':_0x6e70('0x30'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6e70('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x31')},'systemAvatar':{'type':Sequelize[_0x6e70('0x1b')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6e70('0x9')],'comment':_0x6e70('0x32')},'mandatoryDisposition':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2c0bd1){if(!_0x2c0bd1)this[_0x6e70('0x26')](_0x6e70('0x33'),null);this[_0x6e70('0x26')](_0x6e70('0x34'),_0x2c0bd1);}},'vidaooEscalation':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6e70('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x6e70('0x35');}},'vidaooMetadata':{'type':Sequelize[_0x6e70('0x1b')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6e70('0x1b')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 3eee0af..8c1930a 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 _0x22ea=['includes','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','orderBy','priority','asc','defaults','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','version','format','%s\x20%s','browser','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','offline','files','send','mapKeyOffline','MailAccount','findOrCreate','readFileSync','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','getSmtpOptions','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','NotifyMailAccount','notifyMail','server','addInteraction','Contact','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','replace','render','alignment','labelText','textColor','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','READ_COMMITTED','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','fs-extra','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','html-to-text','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','catch','sendStatus','status','json','undefined','limit','count','offset','set','update','destroy','get','end','stack','name','map','ChatWebsite','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','Pause','mandatoryDispositionPause','keys','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','sort','options','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','custom','isNil','existsSync','join','server/files/images/logos/','getAvatar','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey'];(function(_0x2ccc71,_0x1c458a){var _0x20fa15=function(_0x320e61){while(--_0x320e61){_0x2ccc71['push'](_0x2ccc71['shift']());}};_0x20fa15(++_0x1c458a);}(_0x22ea,0x98));var _0xa22e=function(_0x5706c9,_0x536d73){_0x5706c9=_0x5706c9-0x0;var _0x46a585=_0x22ea[_0x5706c9];return _0x46a585;};'use strict';var BPromise=require(_0xa22e('0x0'));var Mustache=require(_0xa22e('0x1'));var util=require(_0xa22e('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa22e('0x3'));var _=require('lodash');var querystring=require('querystring');var Redis=require('ioredis');var qs=require(_0xa22e('0x4'));var logger=require(_0xa22e('0x5'))(_0xa22e('0x6'));var config=require(_0xa22e('0x7'));var db=require(_0xa22e('0x8'))['db'];config[_0xa22e('0x9')]=_['defaults'](config[_0xa22e('0x9')],{'host':_0xa22e('0xa'),'port':0x18eb});var socket=require(_0xa22e('0xb'))(new Redis(config[_0xa22e('0x9')]));require(_0xa22e('0xc'))['register'](socket);var htmlToText=require(_0xa22e('0xd'));var jayson=require(_0xa22e('0xe'));var client=jayson[_0xa22e('0xf')][_0xa22e('0x10')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson['client'][_0xa22e('0x10')]({'port':0x232b});var client9001=jayson[_0xa22e('0xf')][_0xa22e('0x10')]({'port':0x2329});function respondWithRpcPromise(_0x592c72,_0x5051e3,_0x1c3306,_0x214476){return new BPromise(function(_0x4b7db6,_0x439b0b){var _0x38bbfa=_0x214476||client;return _0x38bbfa[_0xa22e('0x11')](_0x592c72,_0x1c3306)[_0xa22e('0x12')](function(_0xcf2dac){logger[_0xa22e('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x5051e3,'request\x20sent');logger[_0xa22e('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5051e3,_0xa22e('0x15'),JSON[_0xa22e('0x16')](_0xcf2dac));if(_0xcf2dac['error']){if(_0xcf2dac[_0xa22e('0x17')][_0xa22e('0x18')]===0x1f4){logger[_0xa22e('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x5051e3,_0xcf2dac[_0xa22e('0x17')][_0xa22e('0x19')]);return _0x439b0b(_0xcf2dac[_0xa22e('0x17')][_0xa22e('0x19')]);}logger[_0xa22e('0x17')](_0xa22e('0x1a'),_0x5051e3,_0xcf2dac['error'][_0xa22e('0x19')]);return _0x4b7db6(_0xcf2dac[_0xa22e('0x17')][_0xa22e('0x19')]);}else{logger[_0xa22e('0x13')](_0xa22e('0x1a'),_0x5051e3,_0xa22e('0x15'));_0x4b7db6(_0xcf2dac['result'][_0xa22e('0x19')]);}})[_0xa22e('0x1b')](function(_0x1f11b0){logger[_0xa22e('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x5051e3,_0x1f11b0);_0x439b0b(_0x1f11b0);});});}function respondWithStatusCode(_0x592ab1,_0x2eec4e){_0x2eec4e=_0x2eec4e||0xcc;return function(_0x475d0f){if(_0x475d0f){return _0x592ab1[_0xa22e('0x1c')](_0x2eec4e);}return _0x592ab1[_0xa22e('0x1d')](_0x2eec4e)['end']();};}function respondWithResult(_0x278292,_0x1b12c2){_0x1b12c2=_0x1b12c2||0xc8;return function(_0x21ee85){if(_0x21ee85){return _0x278292[_0xa22e('0x1d')](_0x1b12c2)[_0xa22e('0x1e')](_0x21ee85);}};}function respondWithFilteredResult(_0x227d6c,_0x133038){return function(_0x3cb97e){if(_0x3cb97e){var _0x145299=typeof _0x133038['offset']===_0xa22e('0x1f')&&typeof _0x133038[_0xa22e('0x20')]===_0xa22e('0x1f');var _0x47522b=_0x3cb97e[_0xa22e('0x21')];var _0x13d055=_0x145299?0x0:_0x133038[_0xa22e('0x22')];var _0x1387f3=_0x145299?_0x3cb97e[_0xa22e('0x21')]:_0x133038[_0xa22e('0x22')]+_0x133038[_0xa22e('0x20')];var _0x5abb32;if(_0x1387f3>=_0x47522b){_0x1387f3=_0x47522b;_0x5abb32=0xc8;}else{_0x5abb32=0xce;}_0x227d6c[_0xa22e('0x1d')](_0x5abb32);return _0x227d6c[_0xa22e('0x23')]('Content-Range',_0x13d055+'-'+_0x1387f3+'/'+_0x47522b)[_0xa22e('0x1e')](_0x3cb97e);}return null;};}function saveUpdates(_0x2a045c){return function(_0x21e539){if(_0x21e539){return _0x21e539[_0xa22e('0x24')](_0x2a045c)['then'](function(_0x337f09){return _0x337f09;});}return null;};}function removeEntity(_0x421e9c){return function(_0x140e08){if(_0x140e08){return _0x140e08[_0xa22e('0x25')]()[_0xa22e('0x12')](function(){var _0x3f5c89=_0x140e08[_0xa22e('0x26')]({'plain':!![]});var _0x2de1f8='ChatWebsites';return db['UserProfileResource'][_0xa22e('0x25')]({'where':{'type':_0x2de1f8,'resourceId':_0x3f5c89['id']}})[_0xa22e('0x12')](function(){return _0x140e08;});})[_0xa22e('0x12')](function(){_0x421e9c['status'](0xcc)[_0xa22e('0x27')]();});}};}function handleEntityNotFound(_0x52b9dd){return function(_0x565569){if(!_0x565569){_0x52b9dd[_0xa22e('0x1c')](0x194);}return _0x565569;};}function handleError(_0x15434c,_0x2683af){_0x2683af=_0x2683af||0x1f4;return function(_0x2127c4){logger[_0xa22e('0x17')](_0x2127c4[_0xa22e('0x28')]);if(_0x2127c4[_0xa22e('0x29')]){delete _0x2127c4[_0xa22e('0x29')];}_0x15434c[_0xa22e('0x1d')](_0x2683af)['send'](_0x2127c4);};}exports['index']=function(_0x4eca7c,_0x1c79a5){var _0x4a0cdd={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2fc728={},_0x5435b4={'count':0x0,'rows':[]};var _0x29fb3f=_[_0xa22e('0x2a')](db[_0xa22e('0x2b')]['rawAttributes'],function(_0x2c18a6){return{'name':_0x2c18a6['fieldName'],'type':_0x2c18a6[_0xa22e('0x2c')][_0xa22e('0x2d')]};});_0x2fc728['model']=_['map'](_0x29fb3f,_0xa22e('0x29'));_0x2fc728[_0xa22e('0x2e')]=_['keys'](_0x4eca7c[_0xa22e('0x2e')]);_0x2fc728['filters']=_[_0xa22e('0x2f')](_0x2fc728['model'],_0x2fc728[_0xa22e('0x2e')]);_0x4a0cdd['attributes']=_[_0xa22e('0x2f')](_0x2fc728[_0xa22e('0x30')],qs['fields'](_0x4eca7c['query'][_0xa22e('0x31')]));_0x4a0cdd[_0xa22e('0x32')]=_0x4a0cdd[_0xa22e('0x32')][_0xa22e('0x33')]?_0x4a0cdd[_0xa22e('0x32')]:_0x2fc728[_0xa22e('0x30')];if(!_0x4eca7c[_0xa22e('0x2e')][_0xa22e('0x34')](_0xa22e('0x35'))){_0x4a0cdd[_0xa22e('0x20')]=qs[_0xa22e('0x20')](_0x4eca7c[_0xa22e('0x2e')][_0xa22e('0x20')]);_0x4a0cdd[_0xa22e('0x22')]=qs['offset'](_0x4eca7c['query']['offset']);}_0x4a0cdd[_0xa22e('0x36')]=qs['sort'](_0x4eca7c[_0xa22e('0x2e')]['sort']);_0x4a0cdd[_0xa22e('0x37')]=qs[_0xa22e('0x38')](_[_0xa22e('0x39')](_0x4eca7c[_0xa22e('0x2e')],_0x2fc728['filters']),_0x29fb3f);if(_0x4eca7c[_0xa22e('0x2e')][_0xa22e('0x3a')]){_0x4a0cdd[_0xa22e('0x37')]=_[_0xa22e('0x3b')](_0x4a0cdd[_0xa22e('0x37')],{'$or':_[_0xa22e('0x2a')](_0x29fb3f,function(_0x3aeec8){if(_0x3aeec8[_0xa22e('0x2c')]!==_0xa22e('0x3c')){var _0x56955e={};_0x56955e[_0x3aeec8['name']]={'$like':'%'+_0x4eca7c[_0xa22e('0x2e')][_0xa22e('0x3a')]+'%'};return _0x56955e;}})});}_0x4a0cdd=_['merge']({},_0x4a0cdd,_0x4eca7c['options']);var _0x3e5943={'where':_0x4a0cdd[_0xa22e('0x37')]};return db['ChatWebsite'][_0xa22e('0x21')](_0x3e5943)[_0xa22e('0x12')](function(_0x96d2a9){_0x5435b4[_0xa22e('0x21')]=_0x96d2a9;if(_0x4eca7c[_0xa22e('0x2e')][_0xa22e('0x3d')]){_0x4a0cdd[_0xa22e('0x3e')]=[{'all':!![]}];}return db['ChatWebsite'][_0xa22e('0x3f')](_0x4a0cdd);})['then'](function(_0x332ab4){_0x5435b4['rows']=_0x332ab4;return _0x5435b4;})[_0xa22e('0x12')](respondWithFilteredResult(_0x1c79a5,_0x4a0cdd))[_0xa22e('0x1b')](handleError(_0x1c79a5,null));};exports['show']=function(_0x46a9cf,_0x50e76a){var _0x451519={'raw':![],'where':{'id':_0x46a9cf['params']['id']},'include':[{'model':db[_0xa22e('0x40')],'as':_0xa22e('0x41')}]},_0x5e05ee={};_0x5e05ee[_0xa22e('0x30')]=_[_0xa22e('0x42')](db[_0xa22e('0x2b')][_0xa22e('0x43')]);_0x5e05ee['query']=_['keys'](_0x46a9cf[_0xa22e('0x2e')]);_0x5e05ee[_0xa22e('0x38')]=_['intersection'](_0x5e05ee['model'],_0x5e05ee[_0xa22e('0x2e')]);_0x451519['attributes']=_[_0xa22e('0x2f')](_0x5e05ee[_0xa22e('0x30')],qs[_0xa22e('0x31')](_0x46a9cf[_0xa22e('0x2e')][_0xa22e('0x31')]));_0x451519[_0xa22e('0x32')]=_0x451519[_0xa22e('0x32')][_0xa22e('0x33')]?_0x451519[_0xa22e('0x32')]:_0x5e05ee['model'];if(_0x46a9cf[_0xa22e('0x2e')]['includeAll']){_0x451519[_0xa22e('0x3e')]=[{'all':!![]}];}_0x451519=_[_0xa22e('0x3b')]({},_0x451519,_0x46a9cf['options']);return db[_0xa22e('0x2b')][_0xa22e('0x44')](_0x451519)[_0xa22e('0x12')](handleEntityNotFound(_0x50e76a,null))[_0xa22e('0x12')](respondWithResult(_0x50e76a,null))[_0xa22e('0x1b')](handleError(_0x50e76a,null));};exports[_0xa22e('0x45')]=function(_0x1f0b41,_0x5916a7){return db[_0xa22e('0x2b')][_0xa22e('0x45')](_0x1f0b41[_0xa22e('0x46')],{})[_0xa22e('0x12')](function(_0x39be68){var _0xc980c4=_0x1f0b41['user']['get']({'plain':!![]});if(!_0xc980c4)throw new Error(_0xa22e('0x47'));if(_0xc980c4[_0xa22e('0x48')]==='user'){var _0x1fa320=_0x39be68[_0xa22e('0x26')]({'plain':!![]});var _0x52568b=_0xa22e('0x49');return db[_0xa22e('0x4a')][_0xa22e('0x44')]({'where':{'name':_0x52568b,'userProfileId':_0xc980c4[_0xa22e('0x4b')]},'raw':!![]})['then'](function(_0x7101c8){if(_0x7101c8&&_0x7101c8[_0xa22e('0x4c')]===0x0){return db[_0xa22e('0x4d')][_0xa22e('0x45')]({'name':_0x1fa320[_0xa22e('0x29')],'resourceId':_0x1fa320['id'],'type':_0x7101c8[_0xa22e('0x29')],'sectionId':_0x7101c8['id']},{})[_0xa22e('0x12')](function(){return _0x39be68;});}else{return _0x39be68;}})[_0xa22e('0x1b')](function(_0x4d467e){logger[_0xa22e('0x17')](_0xa22e('0x4e'),_0x4d467e);throw _0x4d467e;});}return _0x39be68;})[_0xa22e('0x12')](respondWithResult(_0x5916a7,0xc9))[_0xa22e('0x1b')](handleError(_0x5916a7,null));};exports[_0xa22e('0x24')]=function(_0x2d5255,_0x26d9fa){if(_0x2d5255[_0xa22e('0x46')]['id']){delete _0x2d5255[_0xa22e('0x46')]['id'];}return db[_0xa22e('0x2b')]['find']({'where':{'id':_0x2d5255[_0xa22e('0x4f')]['id']},'include':[{'model':db[_0xa22e('0x40')],'as':_0xa22e('0x41')}]})['then'](handleEntityNotFound(_0x26d9fa,null))[_0xa22e('0x12')](saveUpdates(_0x2d5255['body'],null))[_0xa22e('0x12')](respondWithResult(_0x26d9fa,null))['catch'](handleError(_0x26d9fa,null));};exports[_0xa22e('0x25')]=function(_0x4255a6,_0xaebe7e){return db[_0xa22e('0x2b')][_0xa22e('0x44')]({'where':{'id':_0x4255a6[_0xa22e('0x4f')]['id']}})['then'](handleEntityNotFound(_0xaebe7e,null))['then'](removeEntity(_0xaebe7e,null))['catch'](handleError(_0xaebe7e,null));};exports[_0xa22e('0x50')]=function(_0x38e41a,_0x1aacf4){return db[_0xa22e('0x2b')][_0xa22e('0x50')]()[_0xa22e('0x12')](respondWithResult(_0x1aacf4,null))['catch'](handleError(_0x1aacf4,null));};exports[_0xa22e('0x51')]=function(_0x131ff0,_0x3f5a0e){if(_0x131ff0[_0xa22e('0x46')]['id']){delete _0x131ff0[_0xa22e('0x46')]['id'];}return db[_0xa22e('0x2b')][_0xa22e('0x44')]({'where':{'id':_0x131ff0['params']['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x3f5a0e,null))[_0xa22e('0x12')](function(_0x59ec6a){if(_0x59ec6a){_0x131ff0['body'][_0xa22e('0x52')]=_0x59ec6a['id'];return db[_0xa22e('0x53')][_0xa22e('0x45')](_0x131ff0[_0xa22e('0x46')]);}})[_0xa22e('0x12')](respondWithResult(_0x3f5a0e,null))['catch'](handleError(_0x3f5a0e,null));};exports[_0xa22e('0x54')]=function(_0x1df760,_0x38ea33){var _0xa4777b={'raw':![],'where':{}};var _0x5d3273={};var _0x4ec2d3={'count':0x0,'rows':[]};return db[_0xa22e('0x2b')][_0xa22e('0x55')]({'where':{'id':_0x1df760['params']['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x38ea33,null))['then'](function(_0x42643c){if(_0x42643c){_0x5d3273['model']=_['keys'](db[_0xa22e('0x53')][_0xa22e('0x43')]);_0x5d3273[_0xa22e('0x2e')]=_[_0xa22e('0x42')](_0x1df760[_0xa22e('0x2e')]);_0x5d3273[_0xa22e('0x38')]=_[_0xa22e('0x2f')](_0x5d3273[_0xa22e('0x30')],_0x5d3273[_0xa22e('0x2e')]);_0xa4777b['attributes']=_[_0xa22e('0x2f')](_0x5d3273[_0xa22e('0x30')],qs[_0xa22e('0x31')](_0x1df760['query'][_0xa22e('0x31')]));_0xa4777b[_0xa22e('0x32')]=_0xa4777b['attributes'][_0xa22e('0x33')]?_0xa4777b['attributes']:_0x5d3273['model'];if(!_0x1df760[_0xa22e('0x2e')][_0xa22e('0x34')](_0xa22e('0x35'))){_0xa4777b[_0xa22e('0x20')]=qs['limit'](_0x1df760[_0xa22e('0x2e')][_0xa22e('0x20')]);_0xa4777b['offset']=qs['offset'](_0x1df760[_0xa22e('0x2e')][_0xa22e('0x22')]);}_0xa4777b[_0xa22e('0x36')]=qs[_0xa22e('0x56')](_0x1df760[_0xa22e('0x2e')]['sort']);_0xa4777b[_0xa22e('0x37')]=qs[_0xa22e('0x38')](_[_0xa22e('0x39')](_0x1df760['query'],_0x5d3273[_0xa22e('0x38')]));_0xa4777b[_0xa22e('0x37')][_0xa22e('0x52')]=_0x42643c['id'];if(_0x1df760[_0xa22e('0x2e')][_0xa22e('0x3a')]){_0xa4777b['where']=_[_0xa22e('0x3b')](_0xa4777b[_0xa22e('0x37')],{'$or':_['map'](_0xa4777b[_0xa22e('0x32')],function(_0x443823){var _0x51ddf2={};_0x51ddf2[_0x443823]={'$like':'%'+_0x1df760[_0xa22e('0x2e')][_0xa22e('0x3a')]+'%'};return _0x51ddf2;})});}_0xa4777b=_[_0xa22e('0x3b')]({},_0xa4777b,_0x1df760[_0xa22e('0x57')]);return db[_0xa22e('0x53')]['count']({'where':_0xa4777b['where']})[_0xa22e('0x12')](function(_0x4ee193){_0x4ec2d3[_0xa22e('0x21')]=_0x4ee193;if(_0x1df760[_0xa22e('0x2e')][_0xa22e('0x3d')]){_0xa4777b[_0xa22e('0x3e')]=[{'all':!![]}];}return db[_0xa22e('0x53')][_0xa22e('0x3f')](_0xa4777b);})[_0xa22e('0x12')](function(_0x5c3947){_0x4ec2d3[_0xa22e('0x58')]=_0x5c3947;return _0x4ec2d3;});}})[_0xa22e('0x12')](respondWithFilteredResult(_0x38ea33,_0xa4777b))[_0xa22e('0x1b')](handleError(_0x38ea33,null));};exports[_0xa22e('0x59')]=function(_0x378fdc,_0x5c5240){return db[_0xa22e('0x2b')]['find']({'where':{'id':_0x378fdc[_0xa22e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5c5240,null))['then'](function(_0x5bf6ae){if(_0x5bf6ae){return _0x5bf6ae[_0xa22e('0x59')](_0x378fdc[_0xa22e('0x2e')][_0xa22e('0x5a')]);}})[_0xa22e('0x12')](respondWithStatusCode(_0x5c5240,null))[_0xa22e('0x1b')](handleError(_0x5c5240,null));};exports[_0xa22e('0x5b')]=function(_0x2be1c1,_0x404b67){if(_0x2be1c1[_0xa22e('0x46')]['id']){delete _0x2be1c1[_0xa22e('0x46')]['id'];}return db[_0xa22e('0x2b')][_0xa22e('0x44')]({'where':{'id':_0x2be1c1[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x404b67,null))[_0xa22e('0x12')](function(_0x37b2b9){if(_0x37b2b9){_0x2be1c1[_0xa22e('0x46')]['ChatWebsiteId']=_0x37b2b9['id'];return db[_0xa22e('0x5c')][_0xa22e('0x45')](_0x2be1c1[_0xa22e('0x46')]);}})['then'](respondWithResult(_0x404b67,null))[_0xa22e('0x1b')](handleError(_0x404b67,null));};exports[_0xa22e('0x5d')]=function(_0x226b3a,_0x302855){var _0x3d1ac9={'raw':![],'where':{}};var _0x468549={};var _0x458bf6={'count':0x0,'rows':[]};return db[_0xa22e('0x2b')][_0xa22e('0x55')]({'where':{'id':_0x226b3a[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x302855,null))[_0xa22e('0x12')](function(_0x1fb819){if(_0x1fb819){_0x468549['model']=_[_0xa22e('0x42')](db[_0xa22e('0x5c')][_0xa22e('0x43')]);_0x468549[_0xa22e('0x2e')]=_['keys'](_0x226b3a['query']);_0x468549[_0xa22e('0x38')]=_[_0xa22e('0x2f')](_0x468549['model'],_0x468549['query']);_0x3d1ac9[_0xa22e('0x32')]=_[_0xa22e('0x2f')](_0x468549[_0xa22e('0x30')],qs[_0xa22e('0x31')](_0x226b3a[_0xa22e('0x2e')][_0xa22e('0x31')]));_0x3d1ac9['attributes']=_0x3d1ac9[_0xa22e('0x32')]['length']?_0x3d1ac9[_0xa22e('0x32')]:_0x468549[_0xa22e('0x30')];if(!_0x226b3a[_0xa22e('0x2e')][_0xa22e('0x34')]('nolimit')){_0x3d1ac9['limit']=qs[_0xa22e('0x20')](_0x226b3a['query'][_0xa22e('0x20')]);_0x3d1ac9[_0xa22e('0x22')]=qs[_0xa22e('0x22')](_0x226b3a[_0xa22e('0x2e')]['offset']);}_0x3d1ac9[_0xa22e('0x36')]=qs[_0xa22e('0x56')](_0x226b3a['query'][_0xa22e('0x56')]);_0x3d1ac9[_0xa22e('0x37')]=qs['filters'](_[_0xa22e('0x39')](_0x226b3a[_0xa22e('0x2e')],_0x468549[_0xa22e('0x38')]));_0x3d1ac9[_0xa22e('0x37')][_0xa22e('0x52')]=_0x1fb819['id'];if(_0x226b3a[_0xa22e('0x2e')][_0xa22e('0x3a')]){_0x3d1ac9['where']=_[_0xa22e('0x3b')](_0x3d1ac9[_0xa22e('0x37')],{'$or':_[_0xa22e('0x2a')](_0x3d1ac9[_0xa22e('0x32')],function(_0xb52c3a){var _0x260b08={};_0x260b08[_0xb52c3a]={'$like':'%'+_0x226b3a['query'][_0xa22e('0x3a')]+'%'};return _0x260b08;})});}_0x3d1ac9=_[_0xa22e('0x3b')]({},_0x3d1ac9,_0x226b3a[_0xa22e('0x57')]);return db[_0xa22e('0x5c')][_0xa22e('0x21')]({'where':_0x3d1ac9[_0xa22e('0x37')]})[_0xa22e('0x12')](function(_0x127945){_0x458bf6[_0xa22e('0x21')]=_0x127945;if(_0x226b3a[_0xa22e('0x2e')][_0xa22e('0x3d')]){_0x3d1ac9[_0xa22e('0x3e')]=[{'all':!![]}];}return db[_0xa22e('0x5c')][_0xa22e('0x3f')](_0x3d1ac9);})[_0xa22e('0x12')](function(_0x4afd01){_0x458bf6[_0xa22e('0x58')]=_0x4afd01;return _0x458bf6;});}})[_0xa22e('0x12')](respondWithFilteredResult(_0x302855,_0x3d1ac9))[_0xa22e('0x1b')](handleError(_0x302855,null));};exports[_0xa22e('0x5e')]=function(_0x2f385e,_0x8efd0){return db['ChatWebsite']['find']({'where':{'id':_0x2f385e[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x8efd0,null))[_0xa22e('0x12')](function(_0x57e8ad){if(_0x57e8ad){return _0x57e8ad[_0xa22e('0x5e')](_0x2f385e[_0xa22e('0x2e')]['ids']);}})[_0xa22e('0x12')](respondWithStatusCode(_0x8efd0,null))[_0xa22e('0x1b')](handleError(_0x8efd0,null));};exports[_0xa22e('0x5f')]=function(_0x153031,_0x58281c){_0x153031[_0xa22e('0x46')]['sitepic']=_0x153031[_0xa22e('0x60')][_0xa22e('0x61')];return db[_0xa22e('0x2b')]['find']({'where':{'id':_0x153031['params']['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x58281c,null))[_0xa22e('0x12')](saveUpdates(_0x153031['body'],null))[_0xa22e('0x12')](respondWithResult(_0x58281c,null))[_0xa22e('0x1b')](handleError(_0x58281c,null));};exports[_0xa22e('0x62')]=function(_0x531aef,_0x177d05){_0x531aef[_0xa22e('0x46')][_0xa22e('0x63')]=_0x531aef[_0xa22e('0x60')][_0xa22e('0x61')];return db['ChatWebsite']['find']({'where':{'id':_0x531aef['params']['id']}})['then'](handleEntityNotFound(_0x177d05,null))[_0xa22e('0x12')](saveUpdates(_0x531aef['body'],null))[_0xa22e('0x12')](respondWithResult(_0x177d05,null))[_0xa22e('0x1b')](handleError(_0x177d05,null));};exports[_0xa22e('0x64')]=function(_0x1c6894,_0x52014e){_0x1c6894[_0xa22e('0x46')][_0xa22e('0x65')]=_0x1c6894[_0xa22e('0x60')][_0xa22e('0x61')];return db[_0xa22e('0x2b')][_0xa22e('0x44')]({'where':{'id':_0x1c6894[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x52014e,null))[_0xa22e('0x12')](saveUpdates(_0x1c6894['body'],null))['then'](respondWithResult(_0x52014e,null))[_0xa22e('0x1b')](handleError(_0x52014e,null));};exports[_0xa22e('0x66')]=function(_0x401683,_0x48ab17){_0x401683[_0xa22e('0x46')][_0xa22e('0x67')]=_0x401683[_0xa22e('0x60')][_0xa22e('0x61')];return db[_0xa22e('0x2b')][_0xa22e('0x44')]({'where':{'id':_0x401683[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x48ab17,null))[_0xa22e('0x12')](saveUpdates(_0x401683[_0xa22e('0x46')],null))[_0xa22e('0x12')](respondWithResult(_0x48ab17,null))[_0xa22e('0x1b')](handleError(_0x48ab17,null));};exports['getLogo']=function(_0x5e4500,_0x45cbb2){var _0x46196c=path['join'](config[_0xa22e('0x68')],_0xa22e('0x69'));var _0x1c66b2={'where':{'id':_0x5e4500[_0xa22e('0x4f')]['id']},'attributes':['id',_0xa22e('0x6a')],'raw':!![]};var _0x1b2581=![];return require(_0xa22e('0x6b'))['getLicense']()[_0xa22e('0x12')](function(_0xf800e1){if(_0xf800e1){_0x1b2581=_0xf800e1[_0xa22e('0x6c')];}})[_0xa22e('0x12')](function(){return db[_0xa22e('0x2b')][_0xa22e('0x44')](_0x1c66b2);})['then'](handleEntityNotFound(_0x45cbb2,null))['then'](function(_0x127947){if(_0x127947){if(!_[_0xa22e('0x6d')](_0x127947[_0xa22e('0x6a')])){if(fs[_0xa22e('0x6e')](path['join'](config[_0xa22e('0x68')],'server/files/images/logos/',_0x127947[_0xa22e('0x6a')]))&&_0x1b2581){_0x46196c=path[_0xa22e('0x6f')](config[_0xa22e('0x68')],_0xa22e('0x70'),_0x127947[_0xa22e('0x6a')]);}}return _0x45cbb2['download'](_0x46196c);}})[_0xa22e('0x1b')](handleError(_0x45cbb2,null));};exports[_0xa22e('0x71')]=function(_0x4fd2c6,_0x4b265d){var _0x1536a9=path[_0xa22e('0x6f')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x4d0a11={'where':{'id':_0x4fd2c6[_0xa22e('0x4f')]['id']},'attributes':['id',_0xa22e('0x63')],'raw':!![]};return db[_0xa22e('0x2b')][_0xa22e('0x44')](_0x4d0a11)[_0xa22e('0x12')](handleEntityNotFound(_0x4b265d,null))[_0xa22e('0x12')](function(_0x320837){if(_0x320837){if(!_['isNil'](_0x320837[_0xa22e('0x63')])){if(fs[_0xa22e('0x6e')](path[_0xa22e('0x6f')](config[_0xa22e('0x68')],_0xa22e('0x72'),_0x320837[_0xa22e('0x63')]))){_0x1536a9=path[_0xa22e('0x6f')](config[_0xa22e('0x68')],_0xa22e('0x72'),_0x320837[_0xa22e('0x63')]);}}return _0x4b265d[_0xa22e('0x73')](_0x1536a9);}})[_0xa22e('0x1b')](handleError(_0x4b265d,null));};exports[_0xa22e('0x74')]=function(_0x47f554,_0x5f0b97){var _0x2da203=path[_0xa22e('0x6f')](config['root'],_0xa22e('0x75'));var _0x5e27d5={'where':{'id':_0x47f554[_0xa22e('0x4f')]['id']},'attributes':['id',_0xa22e('0x65'),_0xa22e('0x76')],'raw':!![]};return db[_0xa22e('0x2b')][_0xa22e('0x44')](_0x5e27d5)[_0xa22e('0x12')](handleEntityNotFound(_0x5f0b97,null))[_0xa22e('0x12')](function(_0x17d742){if(_0x17d742){if(!_['isNil'](_0x17d742[_0xa22e('0x65')])){if(fs[_0xa22e('0x6e')](path[_0xa22e('0x6f')](config[_0xa22e('0x68')],_0xa22e('0x72'),_0x17d742[_0xa22e('0x65')]))&&_0x17d742[_0xa22e('0x76')]){_0x2da203=path[_0xa22e('0x6f')](config[_0xa22e('0x68')],_0xa22e('0x72'),_0x17d742[_0xa22e('0x65')]);}}return _0x5f0b97['download'](_0x2da203);}})[_0xa22e('0x1b')](handleError(_0x5f0b97,null));};exports[_0xa22e('0x77')]=function(_0x36f1cc,_0x537fc9){var _0x568ea4=path[_0xa22e('0x6f')](config[_0xa22e('0x68')],_0xa22e('0x78'));var _0x4724cd={'where':{'id':_0x36f1cc[_0xa22e('0x4f')]['id']},'attributes':['id',_0xa22e('0x67')],'raw':!![]};return db['ChatWebsite'][_0xa22e('0x44')](_0x4724cd)['then'](handleEntityNotFound(_0x537fc9,null))['then'](function(_0x42b25e){if(_0x42b25e){if(!_[_0xa22e('0x6d')](_0x42b25e['systemAvatar'])){if(fs[_0xa22e('0x6e')](path[_0xa22e('0x6f')](config[_0xa22e('0x68')],_0xa22e('0x72'),_0x42b25e[_0xa22e('0x67')]))){_0x568ea4=path[_0xa22e('0x6f')](config['root'],_0xa22e('0x72'),_0x42b25e[_0xa22e('0x67')]);}}return _0x537fc9[_0xa22e('0x73')](_0x568ea4);}})[_0xa22e('0x1b')](handleError(_0x537fc9,null));};exports[_0xa22e('0x79')]=function(_0x1b36db,_0x506c63){var _0x153117=require(_0xa22e('0x7a'));var _0x3ed0fa=new _0x153117();var _0x3b6a33=_0x3ed0fa[_0xa22e('0x7b')](_0x1b36db['headers'][_0xa22e('0x7c')])[_0xa22e('0x7d')]();var _0xf65ff0={'body':_0x1b36db[_0xa22e('0x46')],'channel':'chat'};var _0x34debb=[];var _0x11c05a=[];var _0x125634={};var _0x1f0fe4=![];return db[_0xa22e('0x7e')]['describe']()[_0xa22e('0x12')](function(_0x49c55c){if(!_0x49c55c){throw new db[(_0xa22e('0x7f'))][(_0xa22e('0x80'))](_0xa22e('0x81'));}_0x34debb=_[_0xa22e('0x82')](_[_0xa22e('0x42')](_0x49c55c),[_0xa22e('0x83'),_0xa22e('0x84')]);_0x11c05a=_[_0xa22e('0x82')](_['keys'](_0x49c55c),[_0xa22e('0x83'),_0xa22e('0x84'),_0xa22e('0x85'),_0xa22e('0x86')]);if(_0x1b36db[_0xa22e('0x46')]['id']){delete _0x1b36db[_0xa22e('0x46')]['id'];}if(_['isNil'](_0x1b36db[_0xa22e('0x46')][_0xa22e('0x87')])){throw new db[(_0xa22e('0x7f'))][(_0xa22e('0x80'))](_0xa22e('0x88'));}if(_[_0xa22e('0x6d')](_0x1b36db['body'][_0xa22e('0x46')])||_0x1b36db[_0xa22e('0x46')][_0xa22e('0x46')]===''){throw new db[(_0xa22e('0x7f'))][(_0xa22e('0x80'))](_0xa22e('0x89'));}if(_[_0xa22e('0x6d')](_0x1b36db[_0xa22e('0x46')][_0xa22e('0x8a')])){throw new db[(_0xa22e('0x7f'))][(_0xa22e('0x80'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x11c05a);}if(!_[_0xa22e('0x8b')](_0x11c05a,_0x1b36db['body'][_0xa22e('0x8a')])){throw new db[(_0xa22e('0x7f'))][(_0xa22e('0x80'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x11c05a);}_0x125634[_0x1b36db[_0xa22e('0x46')][_0xa22e('0x8a')]]=_0x1b36db[_0xa22e('0x46')][_0xa22e('0x87')];})['then'](function(){return db[_0xa22e('0x2b')]['find']({'where':{'id':_0x1b36db[_0xa22e('0x4f')]['id']},'include':[{'model':db[_0xa22e('0x8c')],'as':_0xa22e('0x8d'),'include':[{'model':db[_0xa22e('0x7e')],'as':_0xa22e('0x8e'),'where':_0x125634,'limit':0x1,'order':[[_0xa22e('0x84'),_0xa22e('0x8f')]]}]},{'model':db[_0xa22e('0x90')],'as':_0xa22e('0x91')}]});})[_0xa22e('0x12')](handleEntityNotFound(_0x506c63,null))['then'](function(_0x105aa5){if(_0x105aa5&&_0x105aa5[_0xa22e('0x8d')]){_0xf65ff0[_0xa22e('0x92')]=_0x105aa5;_0xf65ff0[_0xa22e('0x93')]=_0x105aa5[_0xa22e('0x91')];_0xf65ff0['list']=_0x105aa5['List'];_0xf65ff0[_0xa22e('0x93')]=_[_0xa22e('0x94')](_0xf65ff0[_0xa22e('0x93')],[_0xa22e('0x95')],[_0xa22e('0x96')]);if(_0xf65ff0[_0xa22e('0x92')][_0xa22e('0x91')]){delete _0xf65ff0[_0xa22e('0x92')][_0xa22e('0x91')];}if(_0xf65ff0[_0xa22e('0x92')]['List']&&_0xf65ff0[_0xa22e('0x92')][_0xa22e('0x8d')][_0xa22e('0x8e')][_0xa22e('0x33')]){return _0xf65ff0[_0xa22e('0x92')][_0xa22e('0x8d')][_0xa22e('0x8e')][0x0];}var _0x44005d=_[_0xa22e('0x97')](_0x1b36db[_0xa22e('0x46')],{'firstName':_0x1b36db[_0xa22e('0x46')][_0xa22e('0x87')],'ListId':_0x105aa5[_0xa22e('0x86')]});_0x44005d[_0x1b36db[_0xa22e('0x46')][_0xa22e('0x8a')]]=_0x1b36db[_0xa22e('0x46')]['from'];return db['CmContact'][_0xa22e('0x45')](_0x44005d,{'fields':_0x34debb,'raw':!![]});}})[_0xa22e('0x12')](handleEntityNotFound(_0x506c63,null))[_0xa22e('0x12')](function(_0x567651){_0xf65ff0[_0xa22e('0x98')]=_0x567651;var _0x24fed9=_0x1b36db[_0xa22e('0x46')][_0xa22e('0x99')];if(_0x1b36db[_0xa22e('0x9a')][_0xa22e('0x9b')]){_0x24fed9=_0x1b36db[_0xa22e('0x9a')][_0xa22e('0x9b')];}else if(_0x1b36db['headers'][_0xa22e('0x9c')]){_0x24fed9=_[_0xa22e('0x9d')](_0x1b36db['headers'][_0xa22e('0x9c')][_0xa22e('0x9e')](','));}if(_0x567651){var _0x23654e={'ContactId':_0x567651['id'],'ChatWebsiteId':_0x1b36db[_0xa22e('0x4f')]['id'],'from':(_0x567651[_0xa22e('0x9f')]||'')+'\x20'+(_0x567651[_0xa22e('0xa0')]||''),'customerIp':_0x24fed9,'customerPort':_0x1b36db[_0xa22e('0x9a')][_0xa22e('0xa1')]?_0x1b36db['headers'][_0xa22e('0xa1')]:null,'referer':_0x1b36db[_0xa22e('0x46')][_0xa22e('0xa2')],'browserName':_0x3b6a33['browser'][_0xa22e('0x29')]&&_0x3b6a33['browser'][_0xa22e('0xa3')]?util[_0xa22e('0xa4')](_0xa22e('0xa5'),_0x3b6a33[_0xa22e('0xa6')][_0xa22e('0x29')],_0x3b6a33[_0xa22e('0xa6')][_0xa22e('0xa3')]):_0xa22e('0xa7'),'browserVersion':_0x3b6a33[_0xa22e('0xa6')][_0xa22e('0xa3')]||_0xa22e('0xa7'),'osName':util['format'](_0xa22e('0xa5'),_0x3b6a33['os'][_0xa22e('0x29')],_0x3b6a33['os']['version']),'osVersion':_0x3b6a33['os'][_0xa22e('0xa3')],'deviceModel':_0x3b6a33[_0xa22e('0xa8')][_0xa22e('0x30')]&&_0x3b6a33[_0xa22e('0xa8')][_0xa22e('0xa9')]?util['format'](_0xa22e('0xaa'),_0x3b6a33[_0xa22e('0xa8')][_0xa22e('0x30')],_0x3b6a33['device'][_0xa22e('0xa9')],_0x3b6a33['device'][_0xa22e('0x2c')]):null,'deviceVendor':_0x3b6a33[_0xa22e('0xa8')][_0xa22e('0xa9')],'deviceType':_0x3b6a33['device']['type'],'formData':JSON['stringify'](_0x1b36db[_0xa22e('0x46')])};var _0x1be673={'ChatWebsiteId':_0x1b36db['params']['id'],'closed':![]};if(_0x1b36db[_0xa22e('0x46')][_0xa22e('0xab')]){_0x1be673[_0xa22e('0xab')]=_0x1b36db[_0xa22e('0x46')]['threadId'];return db[_0xa22e('0xac')][_0xa22e('0x44')]({'where':_0x1be673})[_0xa22e('0x12')](function(_0x3cfcd7){if(_0x3cfcd7){return[_0x3cfcd7,![]];}_0x23654e[_0xa22e('0xab')]=_0x1b36db[_0xa22e('0x46')][_0xa22e('0xab')];_0x23654e[_0xa22e('0xad')]=_0x1b36db[_0xa22e('0x46')][_0xa22e('0xad')];return db[_0xa22e('0xac')]['create'](_0x23654e)[_0xa22e('0x12')](function(_0x192926){return[_0x192926,!![]];});});}_0x1be673[_0xa22e('0xae')]=_0x567651['id'];if(_0x1b36db['body']['interaction']&&_0x1b36db[_0xa22e('0x46')][_0xa22e('0xaf')]['id']){_0x1be673['id']=_0x1b36db['body']['interaction']['id'];return db[_0xa22e('0xac')][_0xa22e('0x44')]({'where':_0x1be673})[_0xa22e('0x12')](function(_0x3385b4){if(_0x3385b4){return[_0x3385b4,![]];}return db['ChatInteraction'][_0xa22e('0x45')](_0x23654e)[_0xa22e('0x12')](function(_0x3d1bc9){return[_0x3d1bc9,!![]];});});}return db[_0xa22e('0xac')][_0xa22e('0x45')](_0x23654e)[_0xa22e('0x12')](function(_0x453a46){return[_0x453a46,!![]];});}})[_0xa22e('0xb0')](function(_0x188a18,_0x29551a){if(_0x188a18){_0x1f0fe4=_0x29551a;if(!_0x29551a){var _0x3ce2ee={'from':(_0xf65ff0['contact'][_0xa22e('0x9f')]||'')+'\x20'+(_0xf65ff0['contact'][_0xa22e('0xa0')]||'')};if(_0x1b36db[_0xa22e('0x46')][_0xa22e('0xab')]&&_0x1b36db[_0xa22e('0x46')][_0xa22e('0xb1')]&&_0x1b36db['body'][_0xa22e('0xab')]!=_0x1b36db['body'][_0xa22e('0xb1')]){_0x3ce2ee['threadId']=_0x1b36db[_0xa22e('0x46')][_0xa22e('0xb1')];}return _0x188a18[_0xa22e('0x24')](_0x3ce2ee);}else{return _0x188a18;}}})['then'](function(_0x41b291){_0xf65ff0[_0xa22e('0xaf')]=_0x41b291[_0xa22e('0x26')]({'plain':!![]});_0xf65ff0[_0xa22e('0xaf')]['created']=_0x1f0fe4;if(_0xf65ff0[_0xa22e('0xaf')]['created']){if(_0xf65ff0[_0xa22e('0x92')]['autoclose']){_0xf65ff0[_0xa22e('0x93')][_0xa22e('0xb2')]({'id':0x0,'priority':_0xf65ff0['applications']['length']+0x1,'app':_0xa22e('0xb3'),'appdata':_0xa22e('0xb4'),'interval':_0xa22e('0xb5')});}}return db[_0xa22e('0xb6')][_0xa22e('0x45')]({'body':_0x1b36db[_0xa22e('0x46')][_0xa22e('0x46')],'ChatWebsiteId':_0x1b36db[_0xa22e('0x4f')]['id'],'ChatInteractionId':_0x41b291['id'],'direction':'in','ContactId':_0xf65ff0[_0xa22e('0x98')]['id'],'AttachmentId':_0x1b36db[_0xa22e('0x46')][_0xa22e('0xb7')]});})[_0xa22e('0x12')](function(_0x494b77){_0xf65ff0[_0xa22e('0x19')]=_0x494b77;if(_0xf65ff0[_0xa22e('0xaf')][_0xa22e('0xb8')]){return db[_0xa22e('0xb9')]['find']({'attributes':['id',_0xa22e('0x29')],'where':{'id':_0xf65ff0[_0xa22e('0xaf')][_0xa22e('0xb8')]}})[_0xa22e('0x12')](function(_0xc14603){if(_0xc14603){_0xf65ff0[_0xa22e('0x93')][_0xa22e('0xba')]({'id':0x0,'priority':0x0,'app':_0xa22e('0xbb'),'appdata':_0xc14603['name']+','+(_0xf65ff0[_0xa22e('0x92')][_0xa22e('0xbc')]||0xa),'interval':_0xa22e('0xb5')});_0xf65ff0[_0xa22e('0xbd')]=!![];}return respondWithRpcPromise('Start',_0xa22e('0xbe'),_0xf65ff0);});}return respondWithRpcPromise(_0xa22e('0xbf'),'startRouting',_0xf65ff0);})[_0xa22e('0x12')](function(_0x5e1011){respondWithRpcPromise(_0xa22e('0xc0'),'EventManager',{'event':_0xa22e('0x79'),'message':_0x5e1011},client9002);return _0x5e1011;})['then'](respondWithResult(_0x506c63,null))[_0xa22e('0x1b')](handleError(_0x506c63,null));};exports[_0xa22e('0xc1')]=function(_0x48c572,_0x1cd053){var _0x57c47a,_0x354e15,_0x4077ab;var _0x3f46e0=[];var _0x4d4831={};var _0x2605db=_0x48c572[_0xa22e('0xc2')]||[];var _0x1063c9=[];var _0x41874d;return db['CmContact'][_0xa22e('0x50')]()['then'](function(_0x4e2b39){if(!_0x4e2b39){throw new db[(_0xa22e('0x7f'))][(_0xa22e('0x80'))]('no\x20available\x20attributes');}_0x3f46e0=_['difference'](_[_0xa22e('0x42')](_0x4e2b39),[_0xa22e('0x83'),_0xa22e('0x84'),'CompanyId',_0xa22e('0x86')]);if(_0x48c572[_0xa22e('0x46')]['id']){delete _0x48c572['body']['id'];}if(_['isNil'](_0x48c572[_0xa22e('0x46')][_0xa22e('0x87')])){throw _0x1cd053[_0xa22e('0x1d')](0x1f4)[_0xa22e('0xc3')](new db['Sequelize']['ValidationError'](_0xa22e('0x88')));}if(_[_0xa22e('0x6d')](_0x48c572[_0xa22e('0x46')][_0xa22e('0x46')])||_0x48c572[_0xa22e('0x46')][_0xa22e('0x46')]===''){throw _0x1cd053['status'](0x1f4)[_0xa22e('0xc3')](new db[(_0xa22e('0x7f'))][(_0xa22e('0x80'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xa22e('0x6d')](_0x48c572[_0xa22e('0x46')][_0xa22e('0xc4')])){throw _0x1cd053[_0xa22e('0x1d')](0x1f4)[_0xa22e('0xc3')](new db[(_0xa22e('0x7f'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3f46e0));}if(!_[_0xa22e('0x8b')](_0x3f46e0,_0x48c572['body'][_0xa22e('0xc4')])){throw _0x1cd053[_0xa22e('0x1d')](0x1f4)[_0xa22e('0xc3')](new db[(_0xa22e('0x7f'))][(_0xa22e('0x80'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3f46e0));}_0x4d4831[_0x48c572[_0xa22e('0x46')][_0xa22e('0xc4')]]=_0x48c572['body'][_0xa22e('0x87')];})[_0xa22e('0x12')](function(){return db['ChatWebsite'][_0xa22e('0x44')]({'where':{'id':_0x48c572['params']['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0xa22e('0xc5')],'as':'MailAccount'}]});})[_0xa22e('0x12')](handleEntityNotFound(_0x1cd053,null))[_0xa22e('0x12')](function(_0x168550){if(_0x168550&&_0x168550[_0xa22e('0x8d')]){_0x354e15=_0x168550;var _0xeb9dcc=_[_0xa22e('0x97')](_0x48c572[_0xa22e('0x46')],{'firstName':_0x48c572[_0xa22e('0x46')][_0xa22e('0x87')],'phone':_0x48c572[_0xa22e('0x46')][_0xa22e('0x87')],'ListId':_0x168550[_0xa22e('0x86')]});_0xeb9dcc[_0x48c572[_0xa22e('0x46')][_0xa22e('0xc4')]]=_0x48c572['body'][_0xa22e('0x87')];return db[_0xa22e('0x7e')][_0xa22e('0xc6')]({'where':_0x4d4831,'defaults':_0xeb9dcc});}})['spread'](function(_0x499d3e){if(_0x499d3e){_0x4077ab=_0x499d3e;var _0x3f6e5a=fs[_0xa22e('0xc7')](path[_0xa22e('0x6f')](config[_0xa22e('0x68')],'server/files/templates/chatOfflineMessage.ejs'),_0xa22e('0xc8'));var _0x53fc94=ejs['render'](_0x3f6e5a,{'body':_[_0xa22e('0xc9')](_0x48c572['body'][_0xa22e('0x46')]),'bodyTitle':_0x354e15[_0xa22e('0xca')]});return db[_0xa22e('0xcb')]['create']({'body':_0x53fc94,'plainBody':htmlToText[_0xa22e('0xcc')](_0x53fc94),'ContactId':_0x499d3e['id'],'ChatWebsiteId':_0x354e15['id']});}})[_0xa22e('0x12')](function(_0x4e795c){_0x41874d=_0x4e795c;if(_0x2605db[_0xa22e('0x33')]){var _0x5a0283=_0x2605db[_0xa22e('0x2a')](function(_0x4e4497){return{'name':_0x4e4497[_0xa22e('0xcd')],'basename':_0x4e4497[_0xa22e('0x61')],'type':_0x4e4497[_0xa22e('0xce')],'ChatOfflineMessageId':_0x4e795c['id']};});_0x1063c9=_0x5a0283[_0xa22e('0x2a')](_0x1f8029=>{var _0x15e90c={'filename':_0x1f8029['name'],'path':path['join'](config[_0xa22e('0x68')],'server',_0xa22e('0xc2'),_0xa22e('0xcf'),_0xa22e('0xd0'),_0x1f8029[_0xa22e('0xd1')])};return _0x15e90c;});if(!_0x354e15[_0xa22e('0xd2')]){return db[_0xa22e('0xd3')][_0xa22e('0xd4')](function(_0x220bb0){return db[_0xa22e('0xd5')][_0xa22e('0xd6')](_0x5a0283,{'transaction':_0x220bb0});});}}})[_0xa22e('0x12')](function(){if(_0x41874d){_0x57c47a=_0x41874d;return db[_0xa22e('0xc5')][_0xa22e('0x55')]({'where':{'service':!![]},'include':[{'model':db[_0xa22e('0xd7')],'as':_0xa22e('0xd8'),'raw':!![],'include':[{'model':db[_0xa22e('0xd9')],'as':_0xa22e('0xd9'),'raw':!![]}]}]});}})[_0xa22e('0x12')](function(_0x30cac4){if(_0x30cac4&&_0x30cac4[_0xa22e('0xd8')]&&_0x354e15['forwardOffline']&&_0x354e15['forwardOfflineAddress']){var _0xdd7780=_0x30cac4[_0xa22e('0xda')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0xdd7780,'message':{'from':util[_0xa22e('0xa4')](_0xa22e('0xdb'),_0x30cac4[_0xa22e('0x29')],_0x30cac4[_0xa22e('0xdc')]||_0x30cac4[_0xa22e('0xd8')]['user']),'to':_0x354e15[_0xa22e('0xdd')],'subject':_0x354e15[_0xa22e('0xde')],'html':_0x57c47a[_0xa22e('0x46')],'attachments':_0x1063c9}},client9003)[_0xa22e('0x12')](function(){return _0x57c47a;})[_0xa22e('0x1b')](function(_0x166cd1){logger[_0xa22e('0x17')](_0x166cd1);});}})[_0xa22e('0x12')](function(){if(_0x354e15&&_0x354e15['openNewInteraction']&&_0x354e15[_0xa22e('0xdf')]){var _0x5c634b=[];if(_0x2605db[_0xa22e('0x33')]){_0x5c634b=_0x2605db[_0xa22e('0x2a')](function(_0x19fa9b){return{'name':_0x19fa9b[_0xa22e('0xcd')],'basename':_0x19fa9b[_0xa22e('0x61')],'type':_0x19fa9b['mimetype'],'ChatOfflineMessageId':_0x41874d['id']};});}var _0x323066;if(!_[_0xa22e('0x6d')](_0x354e15[_0xa22e('0xe0')])){var _0x459e52=_[_0xa22e('0x2a')](_0x48c572['body'],function(_0x34524b){return _0x34524b;});var _0x4f520b=_[_0xa22e('0xe1')](_0x459e52)[0x0];var _0x3e1cf7=_['mapValues'](_0x4f520b,function(_0x56f001){return _0x56f001;});_0x323066=_0x3e1cf7[0x1][_0x354e15['subjectOffline']];}var _0x3f487f={'from':_0x4077ab[_0xa22e('0xdc')],'firstName':_0x4077ab[_0xa22e('0x9f')],'lastName':_0x4077ab['lastName'],'mapKey':'email','message':{'from':_0x4077ab['email'],'to':_0x354e15[_0xa22e('0xc5')][_0xa22e('0xdc')],'cc':'','subject':_[_0xa22e('0x6d')](_0x323066)?_0x354e15[_0xa22e('0xde')]:_0x323066,'messageId':'','sentAt':new Date(),'attach':_0x5c634b[_0xa22e('0x33')],'attachments':_0x5c634b,'originChannel':'Chat','ChatWebsiteId':_0x354e15['id'],'ChatOfflineMessageId':_0x57c47a['id'],'originTo':_0x354e15['MailAccount'][_0xa22e('0xdc')]},'body':_0x57c47a[_0xa22e('0x46')]};var _0x2a7935={'account':{'id':_0x354e15['MailAccountId']},'body':_0x3f487f,'log':_0xa22e('0xe2')};return respondWithRpcPromise(_0xa22e('0xe2'),_0xa22e('0xe3'),_0x2a7935,client9001)[_0xa22e('0x12')](function(){return _0x57c47a;})['catch'](function(_0x5c02d){logger[_0xa22e('0x17')](_0x5c02d);});}return;})[_0xa22e('0x12')](function(){if(_0x57c47a){return _0x57c47a;}})[_0xa22e('0x12')](respondWithResult(_0x1cd053,null))[_0xa22e('0x1b')](function(_0x5c4c66){logger['error']('catch',_0x5c4c66);for(var _0x1a2592 of _0x2605db){var _0x173284=path[_0xa22e('0x6f')](config['root'],_0xa22e('0xe4'),'files','attachments','offline-chat',_0x1a2592[_0xa22e('0x61')]);fs_extra['remove'](_0x173284)[_0xa22e('0x1b')](function(_0x131d90){logger[_0xa22e('0x17')]('Could\x20not\x20remove\x20attachment\x20file',_0x173284,_0x131d90);});}});};exports[_0xa22e('0xe5')]=function(_0x205ffc,_0x26a3ca){return db[_0xa22e('0xac')][_0xa22e('0x44')]({'where':{'id':_0x205ffc[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x26a3ca,null))[_0xa22e('0x12')](function(_0x3d63b5){if(_0x3d63b5){return _0x3d63b5['addInteraction'](_0x205ffc[_0xa22e('0x46')]['ids'],_['omit'](_0x205ffc[_0xa22e('0x46')],[_0xa22e('0x5a'),'id'])||{});}})[_0xa22e('0x12')](respondWithResult(_0x26a3ca,null))[_0xa22e('0x1b')](handleError(_0x26a3ca,null));};exports['getInteractions']=function(_0x1a68f5,_0x36423b){var _0x251308={'raw':![],'where':{}};var _0x32ad72={};var _0x31df37={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xa22e('0x55')]({'where':{'id':_0x1a68f5['params']['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x36423b,null))[_0xa22e('0x12')](function(_0x2e8274){if(_0x2e8274){_0x32ad72[_0xa22e('0x30')]=_[_0xa22e('0x42')](db[_0xa22e('0xac')][_0xa22e('0x43')]);_0x32ad72[_0xa22e('0x2e')]=_[_0xa22e('0x42')](_0x1a68f5['query']);_0x32ad72[_0xa22e('0x38')]=_[_0xa22e('0x2f')](_0x32ad72[_0xa22e('0x30')],_0x32ad72[_0xa22e('0x2e')]);_0x251308[_0xa22e('0x32')]=_[_0xa22e('0x2f')](_0x32ad72[_0xa22e('0x30')],qs[_0xa22e('0x31')](_0x1a68f5[_0xa22e('0x2e')][_0xa22e('0x31')]));_0x251308[_0xa22e('0x32')]=_0x251308[_0xa22e('0x32')][_0xa22e('0x33')]?_0x251308['attributes']:_0x32ad72[_0xa22e('0x30')];if(!_0x1a68f5[_0xa22e('0x2e')][_0xa22e('0x34')](_0xa22e('0x35'))){_0x251308[_0xa22e('0x20')]=qs[_0xa22e('0x20')](_0x1a68f5[_0xa22e('0x2e')][_0xa22e('0x20')]);_0x251308[_0xa22e('0x22')]=qs['offset'](_0x1a68f5[_0xa22e('0x2e')][_0xa22e('0x22')]);}_0x251308['order']=qs[_0xa22e('0x56')](_0x1a68f5[_0xa22e('0x2e')]['sort']);_0x251308[_0xa22e('0x37')]=qs[_0xa22e('0x38')](_['pick'](_0x1a68f5[_0xa22e('0x2e')],_0x32ad72[_0xa22e('0x38')]));_0x251308[_0xa22e('0x37')][_0xa22e('0x52')]=_0x2e8274['id'];if(_0x1a68f5['query'][_0xa22e('0x3a')]){_0x251308[_0xa22e('0x37')]=_[_0xa22e('0x3b')](_0x251308['where'],{'$or':_[_0xa22e('0x2a')](_0x251308['attributes'],function(_0x3bd1b7){var _0x2b93c2={};_0x2b93c2[_0x3bd1b7]={'$like':'%'+_0x1a68f5['query'][_0xa22e('0x3a')]+'%'};return _0x2b93c2;})});}_0x251308=_[_0xa22e('0x3b')]({},_0x251308,_0x1a68f5['options']);return db['ChatInteraction'][_0xa22e('0x21')]({'where':_0x251308[_0xa22e('0x37')]})['then'](function(_0x2186c6){_0x31df37[_0xa22e('0x21')]=_0x2186c6;if(_0x1a68f5[_0xa22e('0x2e')]['includeAll']){_0x251308['include']=[{'model':db[_0xa22e('0x7e')],'as':_0xa22e('0xe6'),'required':![]},{'model':db[_0xa22e('0xb9')],'as':'Owner','attributes':['name','fullname','internal'],'required':![]},{'model':db[_0xa22e('0xe7')],'as':_0xa22e('0xe8'),'attributes':['id',_0xa22e('0x29'),_0xa22e('0xe9')],'where':_0x1a68f5['query']['tag']?{'id':_0x1a68f5[_0xa22e('0x2e')]['tag']}:undefined,'required':_0x1a68f5[_0xa22e('0x2e')][_0xa22e('0xea')]?!![]:![]}];}return db['ChatInteraction'][_0xa22e('0x3f')](_0x251308);})['then'](function(_0xf0c383){_0x31df37[_0xa22e('0x58')]=_0xf0c383;return _0x31df37;});}})[_0xa22e('0x12')](respondWithFilteredResult(_0x36423b,_0x251308))[_0xa22e('0x1b')](handleError(_0x36423b,null));};function iftimePromise(_0x48f40e,_0x4b9b3c){return respondWithRpcPromise(_0xa22e('0xeb'),_0xa22e('0xec'),{'command':_0x4b9b3c[_0xa22e('0xed')]?util['format'](_0xa22e('0xee'),_0x48f40e[_0xa22e('0xef')],_0x4b9b3c[_0xa22e('0xed')]):util[_0xa22e('0xa4')]('iftime\x20%s',_0x48f40e['interval'])},client9002)[_0xa22e('0x12')](function(_0x1c8e5b){var _0x71e596=_0x1c8e5b&&_0x1c8e5b[_0xa22e('0xf0')](_0xa22e('0xf1'))>=0x0?!![]:![];logger[_0xa22e('0x13')](_0xa22e('0xf2'),_0x4b9b3c['id'],_0x48f40e['id'],_0x48f40e['interval'],_0x71e596?_0xa22e('0xf3'):'OFFLINE',_0x4b9b3c['timezone']?_0x4b9b3c[_0xa22e('0xed')]:_0xa22e('0xf4'));return _0x71e596;})[_0xa22e('0x1b')](function(_0x2e802a){logger[_0xa22e('0x17')](_0xa22e('0xf2'),_0x4b9b3c['id'],_0x48f40e['id'],_0x48f40e['interval'],util[_0xa22e('0xf5')](_0x2e802a,{'showHidden':![],'depth':null}),_0x4b9b3c[_0xa22e('0xed')]?_0x4b9b3c[_0xa22e('0xed')]:'No\x20timezone');return![];});}exports[_0xa22e('0xec')]=function(_0x2839e9,_0x4204f3){var _0x4fc5fe=0x0;var _0x19294e=0x0;var _0x1bcb4a=![];var _0x46bce4;var _0x2e3cbf;return db[_0xa22e('0x2b')][_0xa22e('0x44')]({'where':{'id':_0x2839e9[_0xa22e('0x4f')]['id']},'include':[{'model':db[_0xa22e('0xf6')],'as':'Interval','include':[{'model':db[_0xa22e('0xf6')],'as':_0xa22e('0xf7'),'attributes':['id',_0xa22e('0xef')],'raw':!![]}]}]})[_0xa22e('0x12')](handleEntityNotFound(_0x4204f3,null))[_0xa22e('0x12')](function(_0xabac88){if(_0xabac88){_0x46bce4=_0xabac88;return _0xabac88[_0xa22e('0xf8')]({'raw':!![]});}})[_0xa22e('0x12')](function(_0x19c45c){if(_0x46bce4){if(_0x19c45c){_0x2e3cbf=_0x19c45c;}}return require(_0xa22e('0x6b'))['getLicense']();})[_0xa22e('0x12')](function(_0x5400a1){if(_0x5400a1){_0x19294e=_0x5400a1[_0xa22e('0xf9')];_0x1bcb4a=_0x5400a1[_0xa22e('0x6c')];}})[_0xa22e('0x12')](function(){return db[_0xa22e('0xac')][_0xa22e('0x21')]({'where':{'closed':![]}});})['then'](function(_0x12a587){_0x4fc5fe=_0x12a587;if(_0x19294e&&_0x12a587>_0x19294e){return db[_0xa22e('0xfa')][_0xa22e('0x55')]({'where':{'id':0x1}})[_0xa22e('0x12')](function(_0x68b5e9){if(_0x68b5e9){_0x68b5e9[_0xa22e('0xfb')]('chatLicenseExceeded');}});}})[_0xa22e('0x12')](function(){if(_0x46bce4[_0xa22e('0xf6')]&&_0x46bce4[_0xa22e('0xf6')]['Intervals']){var _0x58c750=[];for(var _0x136a2f=0x0;_0x136a2f<_0x46bce4[_0xa22e('0xf6')][_0xa22e('0xf7')][_0xa22e('0x33')];_0x136a2f++){var _0x460da0=_0x46bce4[_0xa22e('0xf6')][_0xa22e('0xf7')][_0x136a2f][_0xa22e('0x26')]({'plain':!![]});_0x58c750[_0xa22e('0xb2')](iftimePromise(_0x460da0,_0x46bce4));}return BPromise[_0xa22e('0xfc')](_0x58c750)[_0xa22e('0x12')](function(_0x549295){return _[_0xa22e('0xfd')](_0x549295);});}else{return!![];}})[_0xa22e('0x12')](function(_0x31679d){var _0x252ba8=fs[_0xa22e('0xc7')](path['join'](config[_0xa22e('0x68')],_0xa22e('0xfe')),_0xa22e('0xc8'));var _0x4e8099={'remote':_0x46bce4[_0xa22e('0xff')],'query':querystring['stringify'](_[_0xa22e('0x3b')](_0x46bce4[_0xa22e('0x26')]({'plain':!![]}),{'customerIp':_0x2839e9[_0xa22e('0x9a')][_0xa22e('0x9c')]||_0x2839e9[_0xa22e('0x9a')][_0xa22e('0x100')]||_0x2839e9[_0xa22e('0x101')][_0xa22e('0x102')]||_0x2839e9['ip'],'referer':_0x2839e9['headers'][_0xa22e('0xa2')],'openedInteractions':_0x4fc5fe,'maxInteractions':_0x19294e,'virtual':_0x1bcb4a[_0xa22e('0xf9')],'online':_0x31679d,'custom':_0x1bcb4a}))[_0xa22e('0x103')](/'/g,'\x5c\x27')};_0x4204f3[_0xa22e('0xc3')](ejs['render'](Mustache[_0xa22e('0x104')](_0x252ba8,_0x4e8099),{'proactiveActions':_0x2e3cbf,'alignment':_0x46bce4[_0xa22e('0x105')],'verticalAlignment':_0x46bce4['verticalAlignment'],'div_color':_0x46bce4['color'],'labelText':_0x46bce4[_0xa22e('0x106')],'text_color':_0x46bce4[_0xa22e('0x107')],'text_button_color':_0x46bce4[_0xa22e('0x108')],'button_color':_0x46bce4[_0xa22e('0x109')],'background_color':_0x46bce4['backgroundColor'],'hideWhenOffline':_0x46bce4[_0xa22e('0x10a')],'interval':_0x46bce4[_0xa22e('0x10b')]}));})[_0xa22e('0x1b')](handleError(_0x4204f3,null));};exports[_0xa22e('0x10c')]=function(_0x47500b,_0x30bd85){var _0x11106d=_0x47500b[_0xa22e('0x4f')]['id'];var _0x596448=_0x47500b['body'];var _0x3ce862=0xc8;var _0x24434f=null;return db['sequelize'][_0xa22e('0xd4')]({'isolationLevel':db[_0xa22e('0xd3')]['Transaction']['ISOLATION_LEVELS'][_0xa22e('0x10d')]},function(_0x30cf32){return db['ChatWebsite'][_0xa22e('0x55')]({'where':{'id':_0x11106d},'transaction':_0x30cf32})['then'](function(_0x2f9056){if(_0x2f9056){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x11106d},'transaction':_0x30cf32})[_0xa22e('0x12')](function(){var _0x384329=_[_0xa22e('0x2a')](_0x596448,function(_0x17c08d){_0x17c08d[_0xa22e('0x52')]=_0x11106d;return _0x17c08d;});return db[_0xa22e('0x90')][_0xa22e('0xd6')](_0x384329,{'transaction':_0x30cf32});});}else{_0x3ce862=0x194;_0x24434f=[];}});})['then'](function(){if(_0x3ce862!==0x194){return db[_0xa22e('0x90')][_0xa22e('0x10e')]({'where':{'ChatWebsiteId':_0x11106d},'order':_0xa22e('0x95')})[_0xa22e('0x12')](function(_0x439bde){_0x24434f=_0x439bde;});}})[_0xa22e('0x1b')](function(_0x4a836e){_0x3ce862=0x1f4;logger['error'](_0x4a836e[_0xa22e('0x28')]);if(_0x4a836e[_0xa22e('0x29')]){delete _0x4a836e['name'];}_0x24434f=_0x4a836e;})['finally'](function(){if(_0x24434f===null){_0x30bd85[_0xa22e('0x1c')](_0x3ce862);}else{if(_0x3ce862===0x1f4){_0x30bd85[_0xa22e('0x1d')](_0x3ce862)['send'](_0x24434f);}else{_0x30bd85[_0xa22e('0x1d')](_0x3ce862)['json'](_0x24434f);}}});};exports[_0xa22e('0x10f')]=function(_0x467feb,_0x5bef63){var _0x2f2b5e={};var _0x1c7e18={};var _0x177ca8;var _0x2ad8a9;return db['ChatWebsite']['findOne']({'where':{'id':_0x467feb['params']['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x5bef63,null))[_0xa22e('0x12')](function(_0x28e515){if(_0x28e515){_0x177ca8=_0x28e515;_0x1c7e18[_0xa22e('0x30')]=_['keys'](db['ChatApplication'][_0xa22e('0x43')]);_0x1c7e18[_0xa22e('0x2e')]=_['keys'](_0x467feb[_0xa22e('0x2e')]);_0x1c7e18['filters']=_[_0xa22e('0x2f')](_0x1c7e18[_0xa22e('0x30')],_0x1c7e18[_0xa22e('0x2e')]);_0x2f2b5e['attributes']=_[_0xa22e('0x2f')](_0x1c7e18['model'],qs[_0xa22e('0x31')](_0x467feb[_0xa22e('0x2e')]['fields']));_0x2f2b5e['attributes']=_0x2f2b5e[_0xa22e('0x32')]['length']?_0x2f2b5e[_0xa22e('0x32')]:_0x1c7e18['model'];_0x2f2b5e['order']=qs[_0xa22e('0x56')](_0x467feb[_0xa22e('0x2e')][_0xa22e('0x56')]);_0x2f2b5e['where']=qs[_0xa22e('0x38')](_[_0xa22e('0x39')](_0x467feb[_0xa22e('0x2e')],_0x1c7e18[_0xa22e('0x38')]));if(_0x467feb[_0xa22e('0x2e')][_0xa22e('0x3a')]){_0x2f2b5e[_0xa22e('0x37')]=_[_0xa22e('0x3b')](_0x2f2b5e[_0xa22e('0x37')],{'$or':_[_0xa22e('0x2a')](_0x2f2b5e[_0xa22e('0x32')],function(_0x1d2b5c){var _0x50f148={};_0x50f148[_0x1d2b5c]={'$like':'%'+_0x467feb['query']['filter']+'%'};return _0x50f148;})});}_0x2f2b5e=_[_0xa22e('0x3b')]({},_0x2f2b5e,_0x467feb[_0xa22e('0x57')]);return _0x177ca8[_0xa22e('0x10f')](_0x2f2b5e);}})[_0xa22e('0x12')](function(_0x4a785c){if(_0x4a785c){_0x2ad8a9=_0x4a785c[_0xa22e('0x33')];if(!_0x467feb[_0xa22e('0x2e')][_0xa22e('0x34')](_0xa22e('0x35'))){_0x2f2b5e[_0xa22e('0x20')]=qs[_0xa22e('0x20')](_0x467feb['query']['limit']);_0x2f2b5e[_0xa22e('0x22')]=qs[_0xa22e('0x22')](_0x467feb['query'][_0xa22e('0x22')]);}return _0x177ca8['getApplications'](_0x2f2b5e);}})[_0xa22e('0x12')](function(_0x30ecaa){if(_0x30ecaa){return _0x30ecaa?{'count':_0x2ad8a9,'rows':_0x30ecaa}:null;}})[_0xa22e('0x12')](respondWithResult(_0x5bef63,null))[_0xa22e('0x1b')](handleError(_0x5bef63,null));};exports[_0xa22e('0x110')]=function(_0xe13136,_0x1b14e0){return db[_0xa22e('0x111')][_0xa22e('0x44')]({'where':{'id':_0xe13136[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x1b14e0,null))['then'](function(_0x5d2387){if(_0x5d2387){return _0x5d2387['addProactiveActions'](_0xe13136[_0xa22e('0x46')]['ids'],_[_0xa22e('0x112')](_0xe13136[_0xa22e('0x46')],['ids','id'])||{});}})[_0xa22e('0x12')](respondWithResult(_0x1b14e0,null))[_0xa22e('0x1b')](handleError(_0x1b14e0,null));};exports[_0xa22e('0xf8')]=function(_0x1e88a4,_0x29605b){var _0x403f70={};var _0x32b2f9={};var _0x3974f0;var _0x4c1148;return db[_0xa22e('0x2b')]['findOne']({'where':{'id':_0x1e88a4[_0xa22e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x29605b,null))[_0xa22e('0x12')](function(_0x5c6ab0){if(_0x5c6ab0){_0x3974f0=_0x5c6ab0;_0x32b2f9['model']=_[_0xa22e('0x42')](db[_0xa22e('0x113')]['rawAttributes']);_0x32b2f9[_0xa22e('0x2e')]=_[_0xa22e('0x42')](_0x1e88a4['query']);_0x32b2f9[_0xa22e('0x38')]=_[_0xa22e('0x2f')](_0x32b2f9[_0xa22e('0x30')],_0x32b2f9[_0xa22e('0x2e')]);_0x403f70[_0xa22e('0x32')]=_[_0xa22e('0x2f')](_0x32b2f9['model'],qs[_0xa22e('0x31')](_0x1e88a4[_0xa22e('0x2e')][_0xa22e('0x31')]));_0x403f70[_0xa22e('0x32')]=_0x403f70['attributes'][_0xa22e('0x33')]?_0x403f70[_0xa22e('0x32')]:_0x32b2f9['model'];_0x403f70[_0xa22e('0x36')]=qs['sort'](_0x1e88a4['query'][_0xa22e('0x56')]);_0x403f70[_0xa22e('0x37')]=qs[_0xa22e('0x38')](_[_0xa22e('0x39')](_0x1e88a4[_0xa22e('0x2e')],_0x32b2f9[_0xa22e('0x38')]));if(_0x1e88a4['query']['filter']){_0x403f70[_0xa22e('0x37')]=_[_0xa22e('0x3b')](_0x403f70['where'],{'$or':_[_0xa22e('0x2a')](_0x403f70[_0xa22e('0x32')],function(_0x362187){var _0x2d1ee3={};_0x2d1ee3[_0x362187]={'$like':'%'+_0x1e88a4[_0xa22e('0x2e')][_0xa22e('0x3a')]+'%'};return _0x2d1ee3;})});}_0x403f70=_[_0xa22e('0x3b')]({},_0x403f70,_0x1e88a4[_0xa22e('0x57')]);return _0x3974f0['getProactiveActions'](_0x403f70);}})[_0xa22e('0x12')](function(_0x579d31){if(_0x579d31){_0x4c1148=_0x579d31[_0xa22e('0x33')];if(!_0x1e88a4['query'][_0xa22e('0x34')](_0xa22e('0x35'))){_0x403f70[_0xa22e('0x20')]=qs[_0xa22e('0x20')](_0x1e88a4[_0xa22e('0x2e')][_0xa22e('0x20')]);_0x403f70[_0xa22e('0x22')]=qs[_0xa22e('0x22')](_0x1e88a4[_0xa22e('0x2e')][_0xa22e('0x22')]);}return _0x3974f0[_0xa22e('0xf8')](_0x403f70);}})[_0xa22e('0x12')](function(_0x1e2329){if(_0x1e2329){return _0x1e2329?{'count':_0x4c1148,'rows':_0x1e2329}:null;}})['then'](respondWithResult(_0x29605b,null))['catch'](handleError(_0x29605b,null));};exports[_0xa22e('0x114')]=function(_0x57a5c3,_0x538b94){var _0xf13519=_0x57a5c3['query'][_0xa22e('0x115')]===_0xa22e('0x116')?'offlineForm':_0xa22e('0x117');return db['ChatWebsite'][_0xa22e('0x44')]({'attributes':['id',_0xf13519],'where':{'id':_0x57a5c3[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x538b94,null))[_0xa22e('0x12')](function(_0x49683c){if(_0x49683c){var _0x39b930=_0x49683c[_0xf13519];var _0x15f9bd=_0x39b930&&_0x39b930[_0xa22e('0x118')]?_0x39b930[_0xa22e('0x118')]:[];_0x538b94['send']({'fromKey':_['isNil'](_0x39b930[_0xa22e('0x119')])?undefined:_0x39b930[_0xa22e('0x119')],'count':_0x15f9bd[_0xa22e('0x33')],'rows':_0x15f9bd});}})[_0xa22e('0x1b')](handleError(_0x538b94,null));};exports[_0xa22e('0x11a')]=function(_0x394b15,_0x26f89c){var _0x35c69e={'raw':![],'where':{}};var _0x5b59ae={};var _0x3afe03={'count':0x0,'rows':[]};return db[_0xa22e('0x2b')][_0xa22e('0x55')]({'where':{'id':_0x394b15[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x26f89c,null))['then'](function(_0x5dbb11){if(_0x5dbb11){_0x5b59ae['model']=_[_0xa22e('0x42')](db['ChatOfflineMessage'][_0xa22e('0x43')]);_0x5b59ae['query']=_['keys'](_0x394b15[_0xa22e('0x2e')]);_0x5b59ae[_0xa22e('0x38')]=_['intersection'](_0x5b59ae[_0xa22e('0x30')],_0x5b59ae['query']);_0x35c69e[_0xa22e('0x32')]=_[_0xa22e('0x2f')](_0x5b59ae[_0xa22e('0x30')],qs[_0xa22e('0x31')](_0x394b15[_0xa22e('0x2e')][_0xa22e('0x31')]));_0x35c69e[_0xa22e('0x32')]=_0x35c69e[_0xa22e('0x32')]['length']?_0x35c69e['attributes']:_0x5b59ae[_0xa22e('0x30')];if(!_0x394b15['query'][_0xa22e('0x34')](_0xa22e('0x35'))){_0x35c69e[_0xa22e('0x20')]=qs[_0xa22e('0x20')](_0x394b15[_0xa22e('0x2e')][_0xa22e('0x20')]);_0x35c69e[_0xa22e('0x22')]=qs['offset'](_0x394b15[_0xa22e('0x2e')][_0xa22e('0x22')]);}_0x35c69e['order']=qs['sort'](_0x394b15[_0xa22e('0x2e')][_0xa22e('0x56')]);_0x35c69e[_0xa22e('0x37')]=qs[_0xa22e('0x38')](_[_0xa22e('0x39')](_0x394b15[_0xa22e('0x2e')],_0x5b59ae[_0xa22e('0x38')]));_0x35c69e['where']['ChatWebsiteId']=_0x5dbb11['id'];if(_0x394b15['query'][_0xa22e('0x3a')]){_0x35c69e[_0xa22e('0x37')]=_[_0xa22e('0x3b')](_0x35c69e[_0xa22e('0x37')],{'$or':_[_0xa22e('0x2a')](_0x35c69e[_0xa22e('0x32')],function(_0x461ff5){var _0x1784c7={};_0x1784c7[_0x461ff5]={'$like':'%'+_0x394b15[_0xa22e('0x2e')][_0xa22e('0x3a')]+'%'};return _0x1784c7;})});}_0x35c69e=_[_0xa22e('0x3b')]({},_0x35c69e,_0x394b15[_0xa22e('0x57')]);return db[_0xa22e('0xcb')]['count']({'where':_0x35c69e['where']})[_0xa22e('0x12')](function(_0x256a94){_0x3afe03[_0xa22e('0x21')]=_0x256a94;if(_0x394b15[_0xa22e('0x2e')][_0xa22e('0x3d')]){_0x35c69e['include']=[{'all':!![]}];}else{_0x35c69e[_0xa22e('0x3e')]=[{'model':db[_0xa22e('0x7e')],'as':_0xa22e('0xe6'),'required':![]},{'model':db[_0xa22e('0xd5')],'as':_0xa22e('0x11b'),'required':![]}];}return db[_0xa22e('0xcb')][_0xa22e('0x3f')](_0x35c69e);})[_0xa22e('0x12')](function(_0x81b77){_0x3afe03[_0xa22e('0x58')]=_0x81b77;return _0x3afe03;});}})['then'](respondWithFilteredResult(_0x26f89c,_0x35c69e))['catch'](handleError(_0x26f89c,null));};exports[_0xa22e('0x11c')]=function(_0x4f4b91,_0x545f1f){return db[_0xa22e('0x2b')][_0xa22e('0x44')]({'where':{'id':_0x4f4b91[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x545f1f,null))[_0xa22e('0x12')](function(_0x1b74a3){if(_0x1b74a3){return _0x1b74a3['addAgents'](_0x4f4b91[_0xa22e('0x46')][_0xa22e('0x5a')],_[_0xa22e('0x112')](_0x4f4b91['body'],[_0xa22e('0x5a'),'id'])||{})[_0xa22e('0xb0')](function(_0x46d0aa){for(var _0x186c23=0x0;_0x186c23<_0x4f4b91[_0xa22e('0x46')][_0xa22e('0x5a')]['length'];_0x186c23+=0x1){socket[_0xa22e('0x11d')](_0xa22e('0x11e'),{'UserId':Number(_0x4f4b91['body'][_0xa22e('0x5a')][_0x186c23]),'ChatWebsiteId':Number(_0x4f4b91[_0xa22e('0x4f')]['id'])});}return _0x46d0aa;});}})[_0xa22e('0x12')](respondWithResult(_0x545f1f,null))['catch'](handleError(_0x545f1f,null));};exports[_0xa22e('0x11f')]=function(_0x51662f,_0x315595){return db['ChatWebsite'][_0xa22e('0x44')]({'where':{'id':_0x51662f[_0xa22e('0x4f')]['id']}})[_0xa22e('0x12')](handleEntityNotFound(_0x315595,null))[_0xa22e('0x12')](function(_0x336f20){if(_0x336f20){return _0x336f20[_0xa22e('0x11f')](_0x51662f[_0xa22e('0x2e')][_0xa22e('0x5a')])['then'](function(){if(_[_0xa22e('0x120')](_0x51662f[_0xa22e('0x2e')]['ids'])){for(var _0x34f947=0x0;_0x34f947<_0x51662f[_0xa22e('0x2e')]['ids'][_0xa22e('0x33')];_0x34f947+=0x1){socket['emit'](_0xa22e('0x121'),{'UserId':Number(_0x51662f[_0xa22e('0x2e')][_0xa22e('0x5a')][_0x34f947]),'ChatWebsiteId':Number(_0x51662f['params']['id'])});}}else{socket[_0xa22e('0x11d')](_0xa22e('0x121'),{'UserId':Number(_0x51662f[_0xa22e('0x2e')][_0xa22e('0x5a')]),'ChatWebsiteId':Number(_0x51662f[_0xa22e('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x315595,null))[_0xa22e('0x1b')](handleError(_0x315595,null));};exports[_0xa22e('0x122')]=function(_0x5761e9,_0xd7e1c3){var _0x2f75a4={};var _0xf87a8c={};var _0x3794fd;var _0x3e9787;return db[_0xa22e('0x2b')][_0xa22e('0x55')]({'where':{'id':_0x5761e9[_0xa22e('0x4f')]['id']}})['then'](handleEntityNotFound(_0xd7e1c3,null))['then'](function(_0x13654){if(_0x13654){_0x3794fd=_0x13654;_0xf87a8c[_0xa22e('0x30')]=_[_0xa22e('0x42')](db[_0xa22e('0xb9')][_0xa22e('0x43')]);_0xf87a8c[_0xa22e('0x2e')]=_[_0xa22e('0x42')](_0x5761e9['query']);_0xf87a8c['filters']=_[_0xa22e('0x2f')](_0xf87a8c['model'],_0xf87a8c[_0xa22e('0x2e')]);_0x2f75a4[_0xa22e('0x32')]=_[_0xa22e('0x2f')](_0xf87a8c[_0xa22e('0x30')],qs['fields'](_0x5761e9[_0xa22e('0x2e')][_0xa22e('0x31')]));_0x2f75a4[_0xa22e('0x32')]=_0x2f75a4[_0xa22e('0x32')]['length']?_0x2f75a4[_0xa22e('0x32')]:_0xf87a8c[_0xa22e('0x30')];_0x2f75a4[_0xa22e('0x36')]=qs['sort'](_0x5761e9[_0xa22e('0x2e')]['sort']);_0x2f75a4[_0xa22e('0x37')]=qs[_0xa22e('0x38')](_[_0xa22e('0x39')](_0x5761e9[_0xa22e('0x2e')],_0xf87a8c['filters']));if(_0x5761e9[_0xa22e('0x2e')][_0xa22e('0x3a')]){_0x2f75a4[_0xa22e('0x37')]=_[_0xa22e('0x3b')](_0x2f75a4[_0xa22e('0x37')],{'$or':_[_0xa22e('0x2a')](_0x2f75a4['attributes'],function(_0x5c9d21){var _0x91f83c={};_0x91f83c[_0x5c9d21]={'$like':'%'+_0x5761e9[_0xa22e('0x2e')][_0xa22e('0x3a')]+'%'};return _0x91f83c;})});}_0x2f75a4=_[_0xa22e('0x3b')]({},_0x2f75a4,_0x5761e9['options']);return _0x3794fd[_0xa22e('0x122')](_0x2f75a4);}})[_0xa22e('0x12')](function(_0x577574){if(_0x577574){_0x3e9787=_0x577574[_0xa22e('0x33')];if(!_0x5761e9[_0xa22e('0x2e')][_0xa22e('0x34')](_0xa22e('0x35'))){_0x2f75a4[_0xa22e('0x20')]=qs[_0xa22e('0x20')](_0x5761e9[_0xa22e('0x2e')][_0xa22e('0x20')]);_0x2f75a4[_0xa22e('0x22')]=qs[_0xa22e('0x22')](_0x5761e9[_0xa22e('0x2e')][_0xa22e('0x22')]);}return _0x3794fd[_0xa22e('0x122')](_0x2f75a4);}})[_0xa22e('0x12')](function(_0x502c03){if(_0x502c03){return _0x502c03?{'count':_0x3e9787,'rows':_0x502c03}:null;}})['then'](respondWithResult(_0xd7e1c3,null))[_0xa22e('0x1b')](handleError(_0xd7e1c3,null));}; \ No newline at end of file +var _0xcad0=['Chat','NotifyMailAccount','notifyMail','files','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tags','tag','Command','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','getSnippet','Interval','getProactiveActions','getLicense','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.ejs','remote','connection','remoteAddress','virtual','render','alignment','verticalAlignment','labelText','textColor','textButtonColor','IntervalId','sequelize','Transaction','ISOLATION_LEVELS','findAndCountAll','priority','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','items','fromKey','getOfflineMessages','Attachment','addAgents','emit','userChatWebsite:save','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','fs-extra','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','offset','undefined','limit','count','set','get','ChatWebsites','UserProfileResource','destroy','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','ChatWebsite','includeAll','include','findAll','rows','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','../../config/license/util','custom','isNil','server/files/images/logos/','download','getAvatar','root','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','chat','CmContact','Sequelize','createdAt','updatedAt','CompanyId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','ChatApplication','List','account','Applications','applications','orderBy','ListId','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','interaction','spread','messageId','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','difference','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','attachments','offline-chat','openNewInteraction','transaction','bulkCreate','MailServerOut','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','email','Smtp','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','lastName','offlineMessageSubject'];(function(_0x355d94,_0x534a11){var _0x530338=function(_0x30bd00){while(--_0x30bd00){_0x355d94['push'](_0x355d94['shift']());}};_0x530338(++_0x534a11);}(_0xcad0,0x168));var _0x0cad=function(_0x36909d,_0x2795f1){_0x36909d=_0x36909d-0x0;var _0x1fd29d=_0xcad0[_0x36909d];return _0x1fd29d;};'use strict';var BPromise=require(_0x0cad('0x0'));var Mustache=require(_0x0cad('0x1'));var util=require(_0x0cad('0x2'));var path=require(_0x0cad('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0cad('0x4'));var _=require('lodash');var querystring=require('querystring');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x0cad('0x5'))(_0x0cad('0x6'));var config=require(_0x0cad('0x7'));var db=require(_0x0cad('0x8'))['db'];config[_0x0cad('0x9')]=_[_0x0cad('0xa')](config[_0x0cad('0x9')],{'host':_0x0cad('0xb'),'port':0x18eb});var socket=require(_0x0cad('0xc'))(new Redis(config['redis']));require(_0x0cad('0xd'))[_0x0cad('0xe')](socket);var htmlToText=require(_0x0cad('0xf'));var jayson=require('jayson/promise');var client=jayson[_0x0cad('0x10')][_0x0cad('0x11')]({'port':0x232c});var client9002=jayson['client'][_0x0cad('0x11')]({'port':0x232a});var client9003=jayson[_0x0cad('0x10')]['http']({'port':0x232b});var client9001=jayson[_0x0cad('0x10')]['http']({'port':0x2329});function respondWithRpcPromise(_0x5ed3c4,_0x182fef,_0x245d53,_0x84ccb2){return new BPromise(function(_0x3d499d,_0x1ea2e2){var _0x281549=_0x84ccb2||client;return _0x281549[_0x0cad('0x12')](_0x5ed3c4,_0x245d53)[_0x0cad('0x13')](function(_0x574be4){logger[_0x0cad('0x14')](_0x0cad('0x15'),_0x182fef,_0x0cad('0x16'));logger[_0x0cad('0x17')](_0x0cad('0x18'),_0x182fef,_0x0cad('0x16'),JSON[_0x0cad('0x19')](_0x574be4));if(_0x574be4[_0x0cad('0x1a')]){if(_0x574be4[_0x0cad('0x1a')][_0x0cad('0x1b')]===0x1f4){logger[_0x0cad('0x1a')](_0x0cad('0x15'),_0x182fef,_0x574be4[_0x0cad('0x1a')]['message']);return _0x1ea2e2(_0x574be4[_0x0cad('0x1a')][_0x0cad('0x1c')]);}logger[_0x0cad('0x1a')](_0x0cad('0x15'),_0x182fef,_0x574be4[_0x0cad('0x1a')][_0x0cad('0x1c')]);return _0x3d499d(_0x574be4[_0x0cad('0x1a')][_0x0cad('0x1c')]);}else{logger[_0x0cad('0x14')](_0x0cad('0x15'),_0x182fef,'request\x20sent');_0x3d499d(_0x574be4[_0x0cad('0x1d')][_0x0cad('0x1c')]);}})[_0x0cad('0x1e')](function(_0x345349){logger['error'](_0x0cad('0x15'),_0x182fef,_0x345349);_0x1ea2e2(_0x345349);});});}function respondWithStatusCode(_0x2ee3f1,_0x1383d8){_0x1383d8=_0x1383d8||0xcc;return function(_0x1687ac){if(_0x1687ac){return _0x2ee3f1['sendStatus'](_0x1383d8);}return _0x2ee3f1['status'](_0x1383d8)[_0x0cad('0x1f')]();};}function respondWithResult(_0x289546,_0x34e421){_0x34e421=_0x34e421||0xc8;return function(_0x1eb8c6){if(_0x1eb8c6){return _0x289546[_0x0cad('0x20')](_0x34e421)[_0x0cad('0x21')](_0x1eb8c6);}};}function respondWithFilteredResult(_0x5a32c8,_0x1ab6a6){return function(_0x1ab3ba){if(_0x1ab3ba){var _0xa86d0=typeof _0x1ab6a6[_0x0cad('0x22')]===_0x0cad('0x23')&&typeof _0x1ab6a6[_0x0cad('0x24')]===_0x0cad('0x23');var _0x6e089d=_0x1ab3ba[_0x0cad('0x25')];var _0x5a2996=_0xa86d0?0x0:_0x1ab6a6[_0x0cad('0x22')];var _0x5eaeb1=_0xa86d0?_0x1ab3ba['count']:_0x1ab6a6['offset']+_0x1ab6a6[_0x0cad('0x24')];var _0x1de71e;if(_0x5eaeb1>=_0x6e089d){_0x5eaeb1=_0x6e089d;_0x1de71e=0xc8;}else{_0x1de71e=0xce;}_0x5a32c8[_0x0cad('0x20')](_0x1de71e);return _0x5a32c8[_0x0cad('0x26')]('Content-Range',_0x5a2996+'-'+_0x5eaeb1+'/'+_0x6e089d)[_0x0cad('0x21')](_0x1ab3ba);}return null;};}function saveUpdates(_0x347c32){return function(_0x3f23c7){if(_0x3f23c7){return _0x3f23c7['update'](_0x347c32)[_0x0cad('0x13')](function(_0x276bec){return _0x276bec;});}return null;};}function removeEntity(_0x4fb425){return function(_0x36ac01){if(_0x36ac01){return _0x36ac01['destroy']()['then'](function(){var _0x3a3b0f=_0x36ac01[_0x0cad('0x27')]({'plain':!![]});var _0x1c978f=_0x0cad('0x28');return db[_0x0cad('0x29')][_0x0cad('0x2a')]({'where':{'type':_0x1c978f,'resourceId':_0x3a3b0f['id']}})[_0x0cad('0x13')](function(){return _0x36ac01;});})[_0x0cad('0x13')](function(){_0x4fb425['status'](0xcc)[_0x0cad('0x1f')]();});}};}function handleEntityNotFound(_0xefcc89){return function(_0x5eb2f4){if(!_0x5eb2f4){_0xefcc89[_0x0cad('0x2b')](0x194);}return _0x5eb2f4;};}function handleError(_0x55cbde,_0x2ccf28){_0x2ccf28=_0x2ccf28||0x1f4;return function(_0x22899f){logger[_0x0cad('0x1a')](_0x22899f[_0x0cad('0x2c')]);if(_0x22899f[_0x0cad('0x2d')]){delete _0x22899f['name'];}_0x55cbde[_0x0cad('0x20')](_0x2ccf28)[_0x0cad('0x2e')](_0x22899f);};}exports[_0x0cad('0x2f')]=function(_0xcd6b7f,_0x43c4a9){var _0x463a3f={'include':[{'model':db[_0x0cad('0x30')],'as':_0x0cad('0x31')}]},_0x3b13c8={},_0x7e7a75={'count':0x0,'rows':[]};var _0x478170=_[_0x0cad('0x32')](db['ChatWebsite'][_0x0cad('0x33')],function(_0x4a1a9d){return{'name':_0x4a1a9d['fieldName'],'type':_0x4a1a9d[_0x0cad('0x34')]['key']};});_0x3b13c8[_0x0cad('0x35')]=_[_0x0cad('0x32')](_0x478170,_0x0cad('0x2d'));_0x3b13c8[_0x0cad('0x36')]=_[_0x0cad('0x37')](_0xcd6b7f[_0x0cad('0x36')]);_0x3b13c8[_0x0cad('0x38')]=_['intersection'](_0x3b13c8[_0x0cad('0x35')],_0x3b13c8[_0x0cad('0x36')]);_0x463a3f[_0x0cad('0x39')]=_[_0x0cad('0x3a')](_0x3b13c8[_0x0cad('0x35')],qs[_0x0cad('0x3b')](_0xcd6b7f[_0x0cad('0x36')][_0x0cad('0x3b')]));_0x463a3f[_0x0cad('0x39')]=_0x463a3f[_0x0cad('0x39')][_0x0cad('0x3c')]?_0x463a3f[_0x0cad('0x39')]:_0x3b13c8[_0x0cad('0x35')];if(!_0xcd6b7f[_0x0cad('0x36')][_0x0cad('0x3d')](_0x0cad('0x3e'))){_0x463a3f[_0x0cad('0x24')]=qs['limit'](_0xcd6b7f[_0x0cad('0x36')][_0x0cad('0x24')]);_0x463a3f['offset']=qs[_0x0cad('0x22')](_0xcd6b7f['query'][_0x0cad('0x22')]);}_0x463a3f[_0x0cad('0x3f')]=qs[_0x0cad('0x40')](_0xcd6b7f[_0x0cad('0x36')][_0x0cad('0x40')]);_0x463a3f['where']=qs[_0x0cad('0x38')](_[_0x0cad('0x41')](_0xcd6b7f[_0x0cad('0x36')],_0x3b13c8[_0x0cad('0x38')]),_0x478170);if(_0xcd6b7f['query'][_0x0cad('0x42')]){_0x463a3f[_0x0cad('0x43')]=_[_0x0cad('0x44')](_0x463a3f[_0x0cad('0x43')],{'$or':_[_0x0cad('0x32')](_0x478170,function(_0x535765){if(_0x535765[_0x0cad('0x34')]!=='VIRTUAL'){var _0x3f2082={};_0x3f2082[_0x535765[_0x0cad('0x2d')]]={'$like':'%'+_0xcd6b7f[_0x0cad('0x36')][_0x0cad('0x42')]+'%'};return _0x3f2082;}})});}_0x463a3f=_[_0x0cad('0x44')]({},_0x463a3f,_0xcd6b7f[_0x0cad('0x45')]);var _0x338345={'where':_0x463a3f[_0x0cad('0x43')]};return db[_0x0cad('0x46')][_0x0cad('0x25')](_0x338345)[_0x0cad('0x13')](function(_0xbd44bb){_0x7e7a75[_0x0cad('0x25')]=_0xbd44bb;if(_0xcd6b7f[_0x0cad('0x36')][_0x0cad('0x47')]){_0x463a3f[_0x0cad('0x48')]=[{'all':!![]}];}return db[_0x0cad('0x46')][_0x0cad('0x49')](_0x463a3f);})['then'](function(_0x32aaa3){_0x7e7a75[_0x0cad('0x4a')]=_0x32aaa3;return _0x7e7a75;})[_0x0cad('0x13')](respondWithFilteredResult(_0x43c4a9,_0x463a3f))[_0x0cad('0x1e')](handleError(_0x43c4a9,null));};exports['show']=function(_0x540e33,_0x3788d2){var _0x140dd1={'raw':![],'where':{'id':_0x540e33[_0x0cad('0x4b')]['id']},'include':[{'model':db['Pause'],'as':_0x0cad('0x31')}]},_0x41dd03={};_0x41dd03[_0x0cad('0x35')]=_[_0x0cad('0x37')](db[_0x0cad('0x46')]['rawAttributes']);_0x41dd03['query']=_[_0x0cad('0x37')](_0x540e33[_0x0cad('0x36')]);_0x41dd03[_0x0cad('0x38')]=_[_0x0cad('0x3a')](_0x41dd03[_0x0cad('0x35')],_0x41dd03[_0x0cad('0x36')]);_0x140dd1[_0x0cad('0x39')]=_[_0x0cad('0x3a')](_0x41dd03[_0x0cad('0x35')],qs['fields'](_0x540e33[_0x0cad('0x36')][_0x0cad('0x3b')]));_0x140dd1[_0x0cad('0x39')]=_0x140dd1[_0x0cad('0x39')]['length']?_0x140dd1[_0x0cad('0x39')]:_0x41dd03[_0x0cad('0x35')];if(_0x540e33[_0x0cad('0x36')][_0x0cad('0x47')]){_0x140dd1[_0x0cad('0x48')]=[{'all':!![]}];}_0x140dd1=_[_0x0cad('0x44')]({},_0x140dd1,_0x540e33[_0x0cad('0x45')]);return db[_0x0cad('0x46')]['find'](_0x140dd1)[_0x0cad('0x13')](handleEntityNotFound(_0x3788d2,null))[_0x0cad('0x13')](respondWithResult(_0x3788d2,null))[_0x0cad('0x1e')](handleError(_0x3788d2,null));};exports[_0x0cad('0x4c')]=function(_0x4e21ef,_0x14e0ec){return db[_0x0cad('0x46')][_0x0cad('0x4c')](_0x4e21ef[_0x0cad('0x4d')],{})[_0x0cad('0x13')](function(_0x5eab62){var _0x5149b5=_0x4e21ef[_0x0cad('0x4e')][_0x0cad('0x27')]({'plain':!![]});if(!_0x5149b5)throw new Error(_0x0cad('0x4f'));if(_0x5149b5[_0x0cad('0x50')]===_0x0cad('0x4e')){var _0x151cf6=_0x5eab62[_0x0cad('0x27')]({'plain':!![]});var _0x20f700='ChatWebsites';return db[_0x0cad('0x51')][_0x0cad('0x52')]({'where':{'name':_0x20f700,'userProfileId':_0x5149b5[_0x0cad('0x53')]},'raw':!![]})[_0x0cad('0x13')](function(_0x1e800b){if(_0x1e800b&&_0x1e800b[_0x0cad('0x54')]===0x0){return db[_0x0cad('0x29')][_0x0cad('0x4c')]({'name':_0x151cf6[_0x0cad('0x2d')],'resourceId':_0x151cf6['id'],'type':_0x1e800b[_0x0cad('0x2d')],'sectionId':_0x1e800b['id']},{})[_0x0cad('0x13')](function(){return _0x5eab62;});}else{return _0x5eab62;}})[_0x0cad('0x1e')](function(_0x51d462){logger[_0x0cad('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51d462);throw _0x51d462;});}return _0x5eab62;})[_0x0cad('0x13')](respondWithResult(_0x14e0ec,0xc9))[_0x0cad('0x1e')](handleError(_0x14e0ec,null));};exports['update']=function(_0x56cb03,_0xfbe0b9){if(_0x56cb03[_0x0cad('0x4d')]['id']){delete _0x56cb03[_0x0cad('0x4d')]['id'];}return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0x56cb03[_0x0cad('0x4b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x0cad('0x13')](handleEntityNotFound(_0xfbe0b9,null))[_0x0cad('0x13')](saveUpdates(_0x56cb03[_0x0cad('0x4d')],null))[_0x0cad('0x13')](respondWithResult(_0xfbe0b9,null))['catch'](handleError(_0xfbe0b9,null));};exports[_0x0cad('0x2a')]=function(_0x49d2de,_0x16e96b){return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0x49d2de[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x16e96b,null))[_0x0cad('0x13')](removeEntity(_0x16e96b,null))[_0x0cad('0x1e')](handleError(_0x16e96b,null));};exports[_0x0cad('0x55')]=function(_0x198fb7,_0x4d55a3){return db['ChatWebsite'][_0x0cad('0x55')]()[_0x0cad('0x13')](respondWithResult(_0x4d55a3,null))[_0x0cad('0x1e')](handleError(_0x4d55a3,null));};exports[_0x0cad('0x56')]=function(_0x264950,_0x2deb57){if(_0x264950[_0x0cad('0x4d')]['id']){delete _0x264950[_0x0cad('0x4d')]['id'];}return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0x264950[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x2deb57,null))[_0x0cad('0x13')](function(_0x3dc0d8){if(_0x3dc0d8){_0x264950[_0x0cad('0x4d')][_0x0cad('0x57')]=_0x3dc0d8['id'];return db[_0x0cad('0x58')][_0x0cad('0x4c')](_0x264950[_0x0cad('0x4d')]);}})[_0x0cad('0x13')](respondWithResult(_0x2deb57,null))[_0x0cad('0x1e')](handleError(_0x2deb57,null));};exports[_0x0cad('0x59')]=function(_0x241a34,_0x390553){var _0x4f71af={'raw':![],'where':{}};var _0x56e434={};var _0x5ca327={'count':0x0,'rows':[]};return db[_0x0cad('0x46')][_0x0cad('0x5a')]({'where':{'id':_0x241a34[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x390553,null))[_0x0cad('0x13')](function(_0x598867){if(_0x598867){_0x56e434[_0x0cad('0x35')]=_[_0x0cad('0x37')](db[_0x0cad('0x58')]['rawAttributes']);_0x56e434[_0x0cad('0x36')]=_[_0x0cad('0x37')](_0x241a34[_0x0cad('0x36')]);_0x56e434['filters']=_['intersection'](_0x56e434[_0x0cad('0x35')],_0x56e434[_0x0cad('0x36')]);_0x4f71af['attributes']=_[_0x0cad('0x3a')](_0x56e434[_0x0cad('0x35')],qs[_0x0cad('0x3b')](_0x241a34[_0x0cad('0x36')][_0x0cad('0x3b')]));_0x4f71af[_0x0cad('0x39')]=_0x4f71af[_0x0cad('0x39')][_0x0cad('0x3c')]?_0x4f71af[_0x0cad('0x39')]:_0x56e434['model'];if(!_0x241a34[_0x0cad('0x36')][_0x0cad('0x3d')](_0x0cad('0x3e'))){_0x4f71af[_0x0cad('0x24')]=qs[_0x0cad('0x24')](_0x241a34['query'][_0x0cad('0x24')]);_0x4f71af[_0x0cad('0x22')]=qs[_0x0cad('0x22')](_0x241a34['query']['offset']);}_0x4f71af[_0x0cad('0x3f')]=qs[_0x0cad('0x40')](_0x241a34[_0x0cad('0x36')][_0x0cad('0x40')]);_0x4f71af[_0x0cad('0x43')]=qs[_0x0cad('0x38')](_[_0x0cad('0x41')](_0x241a34[_0x0cad('0x36')],_0x56e434[_0x0cad('0x38')]));_0x4f71af['where'][_0x0cad('0x57')]=_0x598867['id'];if(_0x241a34[_0x0cad('0x36')][_0x0cad('0x42')]){_0x4f71af[_0x0cad('0x43')]=_[_0x0cad('0x44')](_0x4f71af[_0x0cad('0x43')],{'$or':_[_0x0cad('0x32')](_0x4f71af[_0x0cad('0x39')],function(_0x5bbbe0){var _0x2fb5c8={};_0x2fb5c8[_0x5bbbe0]={'$like':'%'+_0x241a34[_0x0cad('0x36')][_0x0cad('0x42')]+'%'};return _0x2fb5c8;})});}_0x4f71af=_['merge']({},_0x4f71af,_0x241a34[_0x0cad('0x45')]);return db[_0x0cad('0x58')][_0x0cad('0x25')]({'where':_0x4f71af['where']})[_0x0cad('0x13')](function(_0x3cd1ef){_0x5ca327[_0x0cad('0x25')]=_0x3cd1ef;if(_0x241a34[_0x0cad('0x36')][_0x0cad('0x47')]){_0x4f71af[_0x0cad('0x48')]=[{'all':!![]}];}return db[_0x0cad('0x58')][_0x0cad('0x49')](_0x4f71af);})['then'](function(_0x2f2470){_0x5ca327[_0x0cad('0x4a')]=_0x2f2470;return _0x5ca327;});}})[_0x0cad('0x13')](respondWithFilteredResult(_0x390553,_0x4f71af))['catch'](handleError(_0x390553,null));};exports[_0x0cad('0x5b')]=function(_0x397e4f,_0xc8f8ad){return db[_0x0cad('0x46')]['find']({'where':{'id':_0x397e4f['params']['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0xc8f8ad,null))[_0x0cad('0x13')](function(_0x707b69){if(_0x707b69){return _0x707b69[_0x0cad('0x5b')](_0x397e4f[_0x0cad('0x36')]['ids']);}})['then'](respondWithStatusCode(_0xc8f8ad,null))['catch'](handleError(_0xc8f8ad,null));};exports['addAnswer']=function(_0x39c28f,_0x1d4f23){if(_0x39c28f[_0x0cad('0x4d')]['id']){delete _0x39c28f[_0x0cad('0x4d')]['id'];}return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0x39c28f[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x1d4f23,null))[_0x0cad('0x13')](function(_0x598af6){if(_0x598af6){_0x39c28f[_0x0cad('0x4d')][_0x0cad('0x57')]=_0x598af6['id'];return db[_0x0cad('0x5c')]['create'](_0x39c28f[_0x0cad('0x4d')]);}})[_0x0cad('0x13')](respondWithResult(_0x1d4f23,null))[_0x0cad('0x1e')](handleError(_0x1d4f23,null));};exports[_0x0cad('0x5d')]=function(_0x41c8e3,_0x1e4cc0){var _0x437571={'raw':![],'where':{}};var _0x46b705={};var _0x44401d={'count':0x0,'rows':[]};return db[_0x0cad('0x46')]['findOne']({'where':{'id':_0x41c8e3['params']['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x1e4cc0,null))[_0x0cad('0x13')](function(_0x4a06ca){if(_0x4a06ca){_0x46b705[_0x0cad('0x35')]=_[_0x0cad('0x37')](db[_0x0cad('0x5c')]['rawAttributes']);_0x46b705[_0x0cad('0x36')]=_['keys'](_0x41c8e3[_0x0cad('0x36')]);_0x46b705[_0x0cad('0x38')]=_[_0x0cad('0x3a')](_0x46b705[_0x0cad('0x35')],_0x46b705[_0x0cad('0x36')]);_0x437571[_0x0cad('0x39')]=_['intersection'](_0x46b705['model'],qs['fields'](_0x41c8e3[_0x0cad('0x36')][_0x0cad('0x3b')]));_0x437571['attributes']=_0x437571[_0x0cad('0x39')][_0x0cad('0x3c')]?_0x437571[_0x0cad('0x39')]:_0x46b705[_0x0cad('0x35')];if(!_0x41c8e3[_0x0cad('0x36')][_0x0cad('0x3d')](_0x0cad('0x3e'))){_0x437571[_0x0cad('0x24')]=qs['limit'](_0x41c8e3['query'][_0x0cad('0x24')]);_0x437571[_0x0cad('0x22')]=qs[_0x0cad('0x22')](_0x41c8e3[_0x0cad('0x36')][_0x0cad('0x22')]);}_0x437571[_0x0cad('0x3f')]=qs[_0x0cad('0x40')](_0x41c8e3[_0x0cad('0x36')][_0x0cad('0x40')]);_0x437571[_0x0cad('0x43')]=qs[_0x0cad('0x38')](_[_0x0cad('0x41')](_0x41c8e3[_0x0cad('0x36')],_0x46b705[_0x0cad('0x38')]));_0x437571[_0x0cad('0x43')][_0x0cad('0x57')]=_0x4a06ca['id'];if(_0x41c8e3[_0x0cad('0x36')]['filter']){_0x437571[_0x0cad('0x43')]=_[_0x0cad('0x44')](_0x437571[_0x0cad('0x43')],{'$or':_[_0x0cad('0x32')](_0x437571[_0x0cad('0x39')],function(_0x28f9ca){var _0x128815={};_0x128815[_0x28f9ca]={'$like':'%'+_0x41c8e3[_0x0cad('0x36')][_0x0cad('0x42')]+'%'};return _0x128815;})});}_0x437571=_['merge']({},_0x437571,_0x41c8e3[_0x0cad('0x45')]);return db['CannedAnswer']['count']({'where':_0x437571['where']})[_0x0cad('0x13')](function(_0x24790d){_0x44401d[_0x0cad('0x25')]=_0x24790d;if(_0x41c8e3[_0x0cad('0x36')][_0x0cad('0x47')]){_0x437571[_0x0cad('0x48')]=[{'all':!![]}];}return db[_0x0cad('0x5c')][_0x0cad('0x49')](_0x437571);})[_0x0cad('0x13')](function(_0x291b92){_0x44401d[_0x0cad('0x4a')]=_0x291b92;return _0x44401d;});}})[_0x0cad('0x13')](respondWithFilteredResult(_0x1e4cc0,_0x437571))[_0x0cad('0x1e')](handleError(_0x1e4cc0,null));};exports[_0x0cad('0x5e')]=function(_0x4cd210,_0x37bc7d){return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0x4cd210['params']['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x37bc7d,null))[_0x0cad('0x13')](function(_0x1a393f){if(_0x1a393f){return _0x1a393f['removeAnswers'](_0x4cd210[_0x0cad('0x36')][_0x0cad('0x5f')]);}})[_0x0cad('0x13')](respondWithStatusCode(_0x37bc7d,null))[_0x0cad('0x1e')](handleError(_0x37bc7d,null));};exports['addLogo']=function(_0x446f84,_0x4d87ce){_0x446f84[_0x0cad('0x4d')][_0x0cad('0x60')]=_0x446f84[_0x0cad('0x61')][_0x0cad('0x62')];return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0x446f84[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x4d87ce,null))[_0x0cad('0x13')](saveUpdates(_0x446f84[_0x0cad('0x4d')],null))[_0x0cad('0x13')](respondWithResult(_0x4d87ce,null))[_0x0cad('0x1e')](handleError(_0x4d87ce,null));};exports['addAvatar']=function(_0x159428,_0x51b772){_0x159428['body'][_0x0cad('0x63')]=_0x159428[_0x0cad('0x61')][_0x0cad('0x62')];return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0x159428['params']['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x51b772,null))['then'](saveUpdates(_0x159428[_0x0cad('0x4d')],null))[_0x0cad('0x13')](respondWithResult(_0x51b772,null))['catch'](handleError(_0x51b772,null));};exports[_0x0cad('0x64')]=function(_0x4dbbf0,_0x1115dd){_0x4dbbf0['body'][_0x0cad('0x65')]=_0x4dbbf0['file'][_0x0cad('0x62')];return db['ChatWebsite'][_0x0cad('0x52')]({'where':{'id':_0x4dbbf0[_0x0cad('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1115dd,null))[_0x0cad('0x13')](saveUpdates(_0x4dbbf0['body'],null))[_0x0cad('0x13')](respondWithResult(_0x1115dd,null))[_0x0cad('0x1e')](handleError(_0x1115dd,null));};exports[_0x0cad('0x66')]=function(_0xd16af6,_0x434c99){_0xd16af6[_0x0cad('0x4d')][_0x0cad('0x67')]=_0xd16af6['file'][_0x0cad('0x62')];return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0xd16af6[_0x0cad('0x4b')]['id']}})['then'](handleEntityNotFound(_0x434c99,null))[_0x0cad('0x13')](saveUpdates(_0xd16af6[_0x0cad('0x4d')],null))[_0x0cad('0x13')](respondWithResult(_0x434c99,null))[_0x0cad('0x1e')](handleError(_0x434c99,null));};exports[_0x0cad('0x68')]=function(_0x210fd9,_0x4a86b0){var _0x2913b1=path[_0x0cad('0x69')](config['root'],'server/files/images/logos/default_logo.svg');var _0x203f91={'where':{'id':_0x210fd9[_0x0cad('0x4b')]['id']},'attributes':['id',_0x0cad('0x60')],'raw':!![]};var _0x48a2c6=![];return require(_0x0cad('0x6a'))['getLicense']()[_0x0cad('0x13')](function(_0x10d072){if(_0x10d072){_0x48a2c6=_0x10d072[_0x0cad('0x6b')];}})[_0x0cad('0x13')](function(){return db[_0x0cad('0x46')]['find'](_0x203f91);})[_0x0cad('0x13')](handleEntityNotFound(_0x4a86b0,null))[_0x0cad('0x13')](function(_0x6e4b92){if(_0x6e4b92){if(!_[_0x0cad('0x6c')](_0x6e4b92[_0x0cad('0x60')])){if(fs['existsSync'](path[_0x0cad('0x69')](config['root'],_0x0cad('0x6d'),_0x6e4b92[_0x0cad('0x60')]))&&_0x48a2c6){_0x2913b1=path['join'](config['root'],_0x0cad('0x6d'),_0x6e4b92[_0x0cad('0x60')]);}}return _0x4a86b0[_0x0cad('0x6e')](_0x2913b1);}})['catch'](handleError(_0x4a86b0,null));};exports[_0x0cad('0x6f')]=function(_0x35091d,_0x4df3f2){var _0x55248d=path['join'](config[_0x0cad('0x70')],_0x0cad('0x71'));var _0x5adb68={'where':{'id':_0x35091d[_0x0cad('0x4b')]['id']},'attributes':['id',_0x0cad('0x63')],'raw':!![]};return db['ChatWebsite'][_0x0cad('0x52')](_0x5adb68)[_0x0cad('0x13')](handleEntityNotFound(_0x4df3f2,null))[_0x0cad('0x13')](function(_0xcc40c){if(_0xcc40c){if(!_[_0x0cad('0x6c')](_0xcc40c[_0x0cad('0x63')])){if(fs[_0x0cad('0x72')](path[_0x0cad('0x69')](config[_0x0cad('0x70')],_0x0cad('0x73'),_0xcc40c[_0x0cad('0x63')]))){_0x55248d=path['join'](config[_0x0cad('0x70')],_0x0cad('0x73'),_0xcc40c[_0x0cad('0x63')]);}}return _0x4df3f2[_0x0cad('0x6e')](_0x55248d);}})['catch'](handleError(_0x4df3f2,null));};exports[_0x0cad('0x74')]=function(_0x4e150b,_0x2e2d73){var _0x35712d=path[_0x0cad('0x69')](config[_0x0cad('0x70')],_0x0cad('0x75'));var _0x58a80a={'where':{'id':_0x4e150b['params']['id']},'attributes':['id',_0x0cad('0x65'),'showCustomerAvatar'],'raw':!![]};return db[_0x0cad('0x46')][_0x0cad('0x52')](_0x58a80a)[_0x0cad('0x13')](handleEntityNotFound(_0x2e2d73,null))[_0x0cad('0x13')](function(_0x16145d){if(_0x16145d){if(!_[_0x0cad('0x6c')](_0x16145d['customerAvatar'])){if(fs['existsSync'](path[_0x0cad('0x69')](config[_0x0cad('0x70')],_0x0cad('0x73'),_0x16145d[_0x0cad('0x65')]))&&_0x16145d[_0x0cad('0x76')]){_0x35712d=path[_0x0cad('0x69')](config[_0x0cad('0x70')],_0x0cad('0x73'),_0x16145d[_0x0cad('0x65')]);}}return _0x2e2d73['download'](_0x35712d);}})[_0x0cad('0x1e')](handleError(_0x2e2d73,null));};exports[_0x0cad('0x77')]=function(_0x1f31a6,_0x58f518){var _0x18a26f=path['join'](config['root'],_0x0cad('0x78'));var _0xba7351={'where':{'id':_0x1f31a6['params']['id']},'attributes':['id',_0x0cad('0x67')],'raw':!![]};return db[_0x0cad('0x46')][_0x0cad('0x52')](_0xba7351)[_0x0cad('0x13')](handleEntityNotFound(_0x58f518,null))['then'](function(_0x3f4271){if(_0x3f4271){if(!_[_0x0cad('0x6c')](_0x3f4271['systemAvatar'])){if(fs[_0x0cad('0x72')](path[_0x0cad('0x69')](config['root'],'server/files/images/avatars/',_0x3f4271[_0x0cad('0x67')]))){_0x18a26f=path[_0x0cad('0x69')](config[_0x0cad('0x70')],_0x0cad('0x73'),_0x3f4271[_0x0cad('0x67')]);}}return _0x58f518[_0x0cad('0x6e')](_0x18a26f);}})[_0x0cad('0x1e')](handleError(_0x58f518,null));};exports[_0x0cad('0x79')]=function(_0x41b54a,_0x3a2df2){var _0x149aac=require(_0x0cad('0x7a'));var _0x5f0a7c=new _0x149aac();var _0x3bf079=_0x5f0a7c[_0x0cad('0x7b')](_0x41b54a[_0x0cad('0x7c')][_0x0cad('0x7d')])['getResult']();var _0x3029e7={'body':_0x41b54a[_0x0cad('0x4d')],'channel':_0x0cad('0x7e')};var _0x58070f=[];var _0x29ceda=[];var _0x5d619f={};var _0x2726c4=![];return db[_0x0cad('0x7f')]['describe']()['then'](function(_0x1b1181){if(!_0x1b1181){throw new db[(_0x0cad('0x80'))]['ValidationError']('no\x20available\x20attributes');}_0x58070f=_['difference'](_['keys'](_0x1b1181),[_0x0cad('0x81'),_0x0cad('0x82')]);_0x29ceda=_['difference'](_[_0x0cad('0x37')](_0x1b1181),[_0x0cad('0x81'),'updatedAt',_0x0cad('0x83'),'ListId']);if(_0x41b54a[_0x0cad('0x4d')]['id']){delete _0x41b54a['body']['id'];}if(_['isNil'](_0x41b54a[_0x0cad('0x4d')][_0x0cad('0x84')])){throw new db[(_0x0cad('0x80'))][(_0x0cad('0x85'))](_0x0cad('0x86'));}if(_[_0x0cad('0x6c')](_0x41b54a[_0x0cad('0x4d')][_0x0cad('0x4d')])||_0x41b54a['body']['body']===''){throw new db['Sequelize'][(_0x0cad('0x85'))](_0x0cad('0x87'));}if(_[_0x0cad('0x6c')](_0x41b54a['body'][_0x0cad('0x88')])){throw new db[(_0x0cad('0x80'))][(_0x0cad('0x85'))](_0x0cad('0x89')+_0x29ceda);}if(!_[_0x0cad('0x8a')](_0x29ceda,_0x41b54a[_0x0cad('0x4d')][_0x0cad('0x88')])){throw new db['Sequelize'][(_0x0cad('0x85'))](_0x0cad('0x8b')+_0x29ceda);}_0x5d619f[_0x41b54a['body'][_0x0cad('0x88')]]=_0x41b54a[_0x0cad('0x4d')][_0x0cad('0x84')];})[_0x0cad('0x13')](function(){return db['ChatWebsite'][_0x0cad('0x52')]({'where':{'id':_0x41b54a[_0x0cad('0x4b')]['id']},'include':[{'model':db[_0x0cad('0x8c')],'as':'List','include':[{'model':db[_0x0cad('0x7f')],'as':_0x0cad('0x8d'),'where':_0x5d619f,'limit':0x1,'order':[[_0x0cad('0x82'),_0x0cad('0x8e')]]}]},{'model':db[_0x0cad('0x8f')],'as':'Applications'}]});})[_0x0cad('0x13')](handleEntityNotFound(_0x3a2df2,null))[_0x0cad('0x13')](function(_0x44410d){if(_0x44410d&&_0x44410d[_0x0cad('0x90')]){_0x3029e7[_0x0cad('0x91')]=_0x44410d;_0x3029e7['applications']=_0x44410d[_0x0cad('0x92')];_0x3029e7['list']=_0x44410d[_0x0cad('0x90')];_0x3029e7[_0x0cad('0x93')]=_[_0x0cad('0x94')](_0x3029e7[_0x0cad('0x93')],['priority'],['asc']);if(_0x3029e7['account']['Applications']){delete _0x3029e7['account'][_0x0cad('0x92')];}if(_0x3029e7[_0x0cad('0x91')]['List']&&_0x3029e7['account'][_0x0cad('0x90')][_0x0cad('0x8d')][_0x0cad('0x3c')]){return _0x3029e7['account'][_0x0cad('0x90')]['Contacts'][0x0];}var _0x1cd958=_['defaults'](_0x41b54a[_0x0cad('0x4d')],{'firstName':_0x41b54a[_0x0cad('0x4d')][_0x0cad('0x84')],'ListId':_0x44410d[_0x0cad('0x95')]});_0x1cd958[_0x41b54a[_0x0cad('0x4d')][_0x0cad('0x88')]]=_0x41b54a[_0x0cad('0x4d')][_0x0cad('0x84')];return db[_0x0cad('0x7f')][_0x0cad('0x4c')](_0x1cd958,{'fields':_0x58070f,'raw':!![]});}})[_0x0cad('0x13')](handleEntityNotFound(_0x3a2df2,null))['then'](function(_0x178522){_0x3029e7[_0x0cad('0x96')]=_0x178522;var _0x3b45be=_0x41b54a[_0x0cad('0x4d')][_0x0cad('0x97')];if(_0x41b54a[_0x0cad('0x7c')][_0x0cad('0x98')]){_0x3b45be=_0x41b54a[_0x0cad('0x7c')][_0x0cad('0x98')];}else if(_0x41b54a[_0x0cad('0x7c')][_0x0cad('0x99')]){_0x3b45be=_[_0x0cad('0x9a')](_0x41b54a[_0x0cad('0x7c')][_0x0cad('0x99')][_0x0cad('0x9b')](','));}if(_0x178522){var _0x52f1c0={'ContactId':_0x178522['id'],'ChatWebsiteId':_0x41b54a['params']['id'],'from':(_0x178522[_0x0cad('0x9c')]||'')+'\x20'+(_0x178522['lastName']||''),'customerIp':_0x3b45be,'customerPort':_0x41b54a['headers'][_0x0cad('0x9d')]?_0x41b54a['headers'][_0x0cad('0x9d')]:null,'referer':_0x41b54a[_0x0cad('0x4d')][_0x0cad('0x9e')],'browserName':_0x3bf079['browser']['name']&&_0x3bf079[_0x0cad('0x9f')][_0x0cad('0xa0')]?util[_0x0cad('0xa1')](_0x0cad('0xa2'),_0x3bf079[_0x0cad('0x9f')][_0x0cad('0x2d')],_0x3bf079[_0x0cad('0x9f')][_0x0cad('0xa0')]):_0x0cad('0xa3'),'browserVersion':_0x3bf079[_0x0cad('0x9f')][_0x0cad('0xa0')]||'unknown','osName':util[_0x0cad('0xa1')](_0x0cad('0xa2'),_0x3bf079['os']['name'],_0x3bf079['os'][_0x0cad('0xa0')]),'osVersion':_0x3bf079['os'][_0x0cad('0xa0')],'deviceModel':_0x3bf079[_0x0cad('0xa4')]['model']&&_0x3bf079[_0x0cad('0xa4')][_0x0cad('0xa5')]?util[_0x0cad('0xa1')](_0x0cad('0xa6'),_0x3bf079[_0x0cad('0xa4')]['model'],_0x3bf079['device'][_0x0cad('0xa5')],_0x3bf079[_0x0cad('0xa4')]['type']):null,'deviceVendor':_0x3bf079[_0x0cad('0xa4')][_0x0cad('0xa5')],'deviceType':_0x3bf079['device'][_0x0cad('0x34')],'formData':JSON[_0x0cad('0x19')](_0x41b54a['body'])};var _0x3c3894={'ChatWebsiteId':_0x41b54a[_0x0cad('0x4b')]['id'],'closed':![]};if(_0x41b54a['body']['threadId']){_0x3c3894[_0x0cad('0xa7')]=_0x41b54a[_0x0cad('0x4d')]['threadId'];return db[_0x0cad('0xa8')][_0x0cad('0x52')]({'where':_0x3c3894})[_0x0cad('0x13')](function(_0x53454d){if(_0x53454d){return[_0x53454d,![]];}_0x52f1c0['threadId']=_0x41b54a[_0x0cad('0x4d')][_0x0cad('0xa7')];_0x52f1c0['externalUrl']=_0x41b54a[_0x0cad('0x4d')]['externalUrl'];return db[_0x0cad('0xa8')][_0x0cad('0x4c')](_0x52f1c0)[_0x0cad('0x13')](function(_0x108614){return[_0x108614,!![]];});});}_0x3c3894['ContactId']=_0x178522['id'];if(_0x41b54a[_0x0cad('0x4d')][_0x0cad('0xa9')]&&_0x41b54a['body'][_0x0cad('0xa9')]['id']){_0x3c3894['id']=_0x41b54a[_0x0cad('0x4d')][_0x0cad('0xa9')]['id'];return db[_0x0cad('0xa8')][_0x0cad('0x52')]({'where':_0x3c3894})['then'](function(_0x198a68){if(_0x198a68){return[_0x198a68,![]];}return db[_0x0cad('0xa8')]['create'](_0x52f1c0)[_0x0cad('0x13')](function(_0x3d66b5){return[_0x3d66b5,!![]];});});}return db[_0x0cad('0xa8')][_0x0cad('0x4c')](_0x52f1c0)[_0x0cad('0x13')](function(_0x51a707){return[_0x51a707,!![]];});}})[_0x0cad('0xaa')](function(_0x2f2b2d,_0xcb0b04){if(_0x2f2b2d){_0x2726c4=_0xcb0b04;if(!_0xcb0b04){var _0x4fb183={'from':(_0x3029e7[_0x0cad('0x96')][_0x0cad('0x9c')]||'')+'\x20'+(_0x3029e7['contact']['lastName']||'')};if(_0x41b54a['body'][_0x0cad('0xa7')]&&_0x41b54a[_0x0cad('0x4d')]['messageId']&&_0x41b54a[_0x0cad('0x4d')]['threadId']!=_0x41b54a[_0x0cad('0x4d')]['messageId']){_0x4fb183['threadId']=_0x41b54a[_0x0cad('0x4d')][_0x0cad('0xab')];}return _0x2f2b2d['update'](_0x4fb183);}else{return _0x2f2b2d;}}})[_0x0cad('0x13')](function(_0x6ab081){_0x3029e7[_0x0cad('0xa9')]=_0x6ab081['get']({'plain':!![]});_0x3029e7[_0x0cad('0xa9')][_0x0cad('0xac')]=_0x2726c4;if(_0x3029e7[_0x0cad('0xa9')][_0x0cad('0xac')]){if(_0x3029e7[_0x0cad('0x91')][_0x0cad('0xad')]){_0x3029e7[_0x0cad('0x93')][_0x0cad('0xae')]({'id':0x0,'priority':_0x3029e7[_0x0cad('0x93')][_0x0cad('0x3c')]+0x1,'app':_0x0cad('0xaf'),'appdata':'unmanaged','interval':_0x0cad('0xb0')});}}return db['ChatMessage'][_0x0cad('0x4c')]({'body':_0x41b54a[_0x0cad('0x4d')]['body'],'ChatWebsiteId':_0x41b54a[_0x0cad('0x4b')]['id'],'ChatInteractionId':_0x6ab081['id'],'direction':'in','ContactId':_0x3029e7[_0x0cad('0x96')]['id'],'AttachmentId':_0x41b54a[_0x0cad('0x4d')][_0x0cad('0xb1')]});})[_0x0cad('0x13')](function(_0xe0bc58){_0x3029e7[_0x0cad('0x1c')]=_0xe0bc58;if(_0x3029e7['interaction'][_0x0cad('0xb2')]){return db[_0x0cad('0xb3')]['find']({'attributes':['id','name'],'where':{'id':_0x3029e7[_0x0cad('0xa9')][_0x0cad('0xb2')]}})[_0x0cad('0x13')](function(_0x4b5488){if(_0x4b5488){_0x3029e7['applications'][_0x0cad('0xb4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4b5488['name']+','+(_0x3029e7[_0x0cad('0x91')][_0x0cad('0xb5')]||0xa),'interval':_0x0cad('0xb0')});_0x3029e7['forcedOwnership']=!![];}return respondWithRpcPromise(_0x0cad('0xb6'),_0x0cad('0xb7'),_0x3029e7);});}return respondWithRpcPromise('Start',_0x0cad('0xb7'),_0x3029e7);})[_0x0cad('0x13')](function(_0x5272ea){respondWithRpcPromise(_0x0cad('0xb8'),_0x0cad('0xb8'),{'event':'notify','message':_0x5272ea},client9002);return _0x5272ea;})['then'](respondWithResult(_0x3a2df2,null))[_0x0cad('0x1e')](handleError(_0x3a2df2,null));};exports[_0x0cad('0xb9')]=function(_0x3aca67,_0x2980a7){var _0x7bd5f2,_0x579989,_0x1511ec;var _0x67e894=[];var _0x26b668={};var _0x30e050=_0x3aca67['files']||[];var _0x595fe8=[];var _0x5b1bb3;return db[_0x0cad('0x7f')][_0x0cad('0x55')]()['then'](function(_0x545854){if(!_0x545854){throw new db[(_0x0cad('0x80'))][(_0x0cad('0x85'))]('no\x20available\x20attributes');}_0x67e894=_[_0x0cad('0xba')](_[_0x0cad('0x37')](_0x545854),[_0x0cad('0x81'),_0x0cad('0x82'),_0x0cad('0x83'),_0x0cad('0x95')]);if(_0x3aca67[_0x0cad('0x4d')]['id']){delete _0x3aca67['body']['id'];}if(_['isNil'](_0x3aca67[_0x0cad('0x4d')]['from'])){throw _0x2980a7[_0x0cad('0x20')](0x1f4)['send'](new db['Sequelize'][(_0x0cad('0x85'))](_0x0cad('0x86')));}if(_[_0x0cad('0x6c')](_0x3aca67[_0x0cad('0x4d')][_0x0cad('0x4d')])||_0x3aca67[_0x0cad('0x4d')][_0x0cad('0x4d')]===''){throw _0x2980a7['status'](0x1f4)['send'](new db[(_0x0cad('0x80'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x0cad('0x6c')](_0x3aca67[_0x0cad('0x4d')][_0x0cad('0xbb')])){throw _0x2980a7[_0x0cad('0x20')](0x1f4)[_0x0cad('0x2e')](new db['Sequelize'][(_0x0cad('0x85'))](_0x0cad('0xbc')+_0x67e894));}if(!_[_0x0cad('0x8a')](_0x67e894,_0x3aca67[_0x0cad('0x4d')]['mapKeyOffline'])){throw _0x2980a7[_0x0cad('0x20')](0x1f4)['send'](new db[(_0x0cad('0x80'))][(_0x0cad('0x85'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x67e894));}_0x26b668[_0x3aca67[_0x0cad('0x4d')][_0x0cad('0xbb')]]=_0x3aca67[_0x0cad('0x4d')]['from'];})[_0x0cad('0x13')](function(){return db['ChatWebsite'][_0x0cad('0x52')]({'where':{'id':_0x3aca67[_0x0cad('0x4b')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0x0cad('0xbd')],'as':_0x0cad('0xbd')}]});})['then'](handleEntityNotFound(_0x2980a7,null))[_0x0cad('0x13')](function(_0x3aeaff){if(_0x3aeaff&&_0x3aeaff[_0x0cad('0x90')]){_0x579989=_0x3aeaff;var _0x3a53b2=_[_0x0cad('0xa')](_0x3aca67[_0x0cad('0x4d')],{'firstName':_0x3aca67[_0x0cad('0x4d')][_0x0cad('0x84')],'phone':_0x3aca67[_0x0cad('0x4d')][_0x0cad('0x84')],'ListId':_0x3aeaff[_0x0cad('0x95')]});_0x3a53b2[_0x3aca67[_0x0cad('0x4d')]['mapKeyOffline']]=_0x3aca67['body'][_0x0cad('0x84')];return db['CmContact'][_0x0cad('0xbe')]({'where':_0x26b668,'defaults':_0x3a53b2});}})[_0x0cad('0xaa')](function(_0x361754){if(_0x361754){_0x1511ec=_0x361754;var _0x2446a2=fs[_0x0cad('0xbf')](path[_0x0cad('0x69')](config['root'],_0x0cad('0xc0')),_0x0cad('0xc1'));var _0x271321=ejs['render'](_0x2446a2,{'body':_[_0x0cad('0xc2')](_0x3aca67['body'][_0x0cad('0x4d')]),'bodyTitle':_0x579989[_0x0cad('0xc3')]});return db[_0x0cad('0xc4')][_0x0cad('0x4c')]({'body':_0x271321,'plainBody':htmlToText[_0x0cad('0xc5')](_0x271321),'ContactId':_0x361754['id'],'ChatWebsiteId':_0x579989['id']});}})[_0x0cad('0x13')](function(_0x1964dc){_0x5b1bb3=_0x1964dc;if(_0x30e050[_0x0cad('0x3c')]){var _0xabb682=_0x30e050['map'](function(_0x235a1e){return{'name':_0x235a1e[_0x0cad('0xc6')],'basename':_0x235a1e[_0x0cad('0x62')],'type':_0x235a1e['mimetype'],'ChatOfflineMessageId':_0x1964dc['id']};});_0x595fe8=_0xabb682[_0x0cad('0x32')](_0x595079=>{var _0x546917={'filename':_0x595079[_0x0cad('0x2d')],'path':path[_0x0cad('0x69')](config['root'],'server','files',_0x0cad('0xc7'),_0x0cad('0xc8'),_0x595079['basename'])};return _0x546917;});if(!_0x579989[_0x0cad('0xc9')]){return db['sequelize'][_0x0cad('0xca')](function(_0x5dc2c2){return db['Attachment'][_0x0cad('0xcb')](_0xabb682,{'transaction':_0x5dc2c2});});}}})[_0x0cad('0x13')](function(){if(_0x5b1bb3){_0x7bd5f2=_0x5b1bb3;return db[_0x0cad('0xbd')][_0x0cad('0x5a')]({'where':{'service':!![]},'include':[{'model':db[_0x0cad('0xcc')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x0cad('0xcd'),'raw':!![]}]}]});}})[_0x0cad('0x13')](function(_0x983ee4){if(_0x983ee4&&_0x983ee4['Smtp']&&_0x579989[_0x0cad('0xce')]&&_0x579989[_0x0cad('0xcf')]){var _0x25bc76=_0x983ee4[_0x0cad('0xd0')]();return respondWithRpcPromise(_0x0cad('0xd1'),_0x0cad('0xd2'),{'account':_0x25bc76,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x983ee4[_0x0cad('0x2d')],_0x983ee4[_0x0cad('0xd3')]||_0x983ee4[_0x0cad('0xd4')][_0x0cad('0x4e')]),'to':_0x579989[_0x0cad('0xcf')],'subject':_0x579989['offlineMessageSubject'],'html':_0x7bd5f2[_0x0cad('0x4d')],'attachments':_0x595fe8}},client9003)['then'](function(){return _0x7bd5f2;})['catch'](function(_0x58825a){logger['error'](_0x58825a);});}})[_0x0cad('0x13')](function(){if(_0x579989&&_0x579989[_0x0cad('0xc9')]&&_0x579989[_0x0cad('0xd5')]){var _0x486aba=[];if(_0x30e050[_0x0cad('0x3c')]){_0x486aba=_0x30e050[_0x0cad('0x32')](function(_0x15eafa){return{'name':_0x15eafa['originalname'],'basename':_0x15eafa['filename'],'type':_0x15eafa[_0x0cad('0xd6')],'ChatOfflineMessageId':_0x5b1bb3['id']};});}var _0x507371;if(!_['isNil'](_0x579989[_0x0cad('0xd7')])){var _0x287ad1=_[_0x0cad('0x32')](_0x3aca67[_0x0cad('0x4d')],function(_0x15c106){return _0x15c106;});var _0x20543b=_[_0x0cad('0xd8')](_0x287ad1)[0x0];var _0x1de185=_[_0x0cad('0xd9')](_0x20543b,function(_0x47cb5d){return _0x47cb5d;});_0x507371=_0x1de185[0x1][_0x579989[_0x0cad('0xd7')]];}var _0x208d36={'from':_0x1511ec[_0x0cad('0xd3')],'firstName':_0x1511ec[_0x0cad('0x9c')],'lastName':_0x1511ec[_0x0cad('0xda')],'mapKey':_0x0cad('0xd3'),'message':{'from':_0x1511ec[_0x0cad('0xd3')],'to':_0x579989[_0x0cad('0xbd')][_0x0cad('0xd3')],'cc':'','subject':_['isNil'](_0x507371)?_0x579989[_0x0cad('0xdb')]:_0x507371,'messageId':'','sentAt':new Date(),'attach':_0x486aba[_0x0cad('0x3c')],'attachments':_0x486aba,'originChannel':_0x0cad('0xdc'),'ChatWebsiteId':_0x579989['id'],'ChatOfflineMessageId':_0x7bd5f2['id'],'originTo':_0x579989['MailAccount'][_0x0cad('0xd3')]},'body':_0x7bd5f2[_0x0cad('0x4d')]};var _0x4fb4e9={'account':{'id':_0x579989['MailAccountId']},'body':_0x208d36,'log':_0x0cad('0xdd')};return respondWithRpcPromise('NotifyMailAccount',_0x0cad('0xde'),_0x4fb4e9,client9001)[_0x0cad('0x13')](function(){return _0x7bd5f2;})[_0x0cad('0x1e')](function(_0xbf65fa){logger[_0x0cad('0x1a')](_0xbf65fa);});}return;})['then'](function(){if(_0x7bd5f2){return _0x7bd5f2;}})['then'](respondWithResult(_0x2980a7,null))[_0x0cad('0x1e')](function(_0x58ab84){logger[_0x0cad('0x1a')]('catch',_0x58ab84);for(var _0x5622cd of _0x30e050){var _0x10bfe4=path[_0x0cad('0x69')](config['root'],'server',_0x0cad('0xdf'),_0x0cad('0xc7'),_0x0cad('0xc8'),_0x5622cd[_0x0cad('0x62')]);fs_extra[_0x0cad('0xe0')](_0x10bfe4)[_0x0cad('0x1e')](function(_0x446d92){logger[_0x0cad('0x1a')](_0x0cad('0xe1'),_0x10bfe4,_0x446d92);});}});};exports[_0x0cad('0xe2')]=function(_0x35879d,_0x53b45b){return db[_0x0cad('0xa8')]['find']({'where':{'id':_0x35879d[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x53b45b,null))[_0x0cad('0x13')](function(_0x8b4cf8){if(_0x8b4cf8){return _0x8b4cf8[_0x0cad('0xe2')](_0x35879d[_0x0cad('0x4d')]['ids'],_[_0x0cad('0xe3')](_0x35879d[_0x0cad('0x4d')],[_0x0cad('0x5f'),'id'])||{});}})['then'](respondWithResult(_0x53b45b,null))['catch'](handleError(_0x53b45b,null));};exports[_0x0cad('0xe4')]=function(_0x1c35f9,_0xe7a4e8){var _0x4de2cf={'raw':![],'where':{}};var _0x594b11={};var _0x1f1ca1={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0cad('0x5a')]({'where':{'id':_0x1c35f9[_0x0cad('0x4b')]['id']}})['then'](handleEntityNotFound(_0xe7a4e8,null))[_0x0cad('0x13')](function(_0x30ea62){if(_0x30ea62){_0x594b11['model']=_[_0x0cad('0x37')](db[_0x0cad('0xa8')][_0x0cad('0x33')]);_0x594b11[_0x0cad('0x36')]=_['keys'](_0x1c35f9[_0x0cad('0x36')]);_0x594b11[_0x0cad('0x38')]=_['intersection'](_0x594b11[_0x0cad('0x35')],_0x594b11[_0x0cad('0x36')]);_0x4de2cf[_0x0cad('0x39')]=_[_0x0cad('0x3a')](_0x594b11[_0x0cad('0x35')],qs[_0x0cad('0x3b')](_0x1c35f9[_0x0cad('0x36')]['fields']));_0x4de2cf[_0x0cad('0x39')]=_0x4de2cf[_0x0cad('0x39')][_0x0cad('0x3c')]?_0x4de2cf['attributes']:_0x594b11[_0x0cad('0x35')];if(!_0x1c35f9['query']['hasOwnProperty'](_0x0cad('0x3e'))){_0x4de2cf[_0x0cad('0x24')]=qs[_0x0cad('0x24')](_0x1c35f9[_0x0cad('0x36')][_0x0cad('0x24')]);_0x4de2cf[_0x0cad('0x22')]=qs['offset'](_0x1c35f9['query'][_0x0cad('0x22')]);}_0x4de2cf[_0x0cad('0x3f')]=qs[_0x0cad('0x40')](_0x1c35f9[_0x0cad('0x36')][_0x0cad('0x40')]);_0x4de2cf[_0x0cad('0x43')]=qs['filters'](_[_0x0cad('0x41')](_0x1c35f9['query'],_0x594b11[_0x0cad('0x38')]));_0x4de2cf['where'][_0x0cad('0x57')]=_0x30ea62['id'];if(_0x1c35f9[_0x0cad('0x36')]['filter']){_0x4de2cf[_0x0cad('0x43')]=_[_0x0cad('0x44')](_0x4de2cf[_0x0cad('0x43')],{'$or':_[_0x0cad('0x32')](_0x4de2cf[_0x0cad('0x39')],function(_0x5e1e35){var _0x114d70={};_0x114d70[_0x5e1e35]={'$like':'%'+_0x1c35f9[_0x0cad('0x36')]['filter']+'%'};return _0x114d70;})});}_0x4de2cf=_[_0x0cad('0x44')]({},_0x4de2cf,_0x1c35f9['options']);return db[_0x0cad('0xa8')][_0x0cad('0x25')]({'where':_0x4de2cf[_0x0cad('0x43')]})[_0x0cad('0x13')](function(_0x47ab35){_0x1f1ca1[_0x0cad('0x25')]=_0x47ab35;if(_0x1c35f9[_0x0cad('0x36')][_0x0cad('0x47')]){_0x4de2cf[_0x0cad('0x48')]=[{'model':db[_0x0cad('0x7f')],'as':_0x0cad('0xe5'),'required':![]},{'model':db[_0x0cad('0xb3')],'as':_0x0cad('0xe6'),'attributes':[_0x0cad('0x2d'),_0x0cad('0xe7'),_0x0cad('0xe8')],'required':![]},{'model':db['Tag'],'as':_0x0cad('0xe9'),'attributes':['id',_0x0cad('0x2d'),'color'],'where':_0x1c35f9['query'][_0x0cad('0xea')]?{'id':_0x1c35f9[_0x0cad('0x36')]['tag']}:undefined,'required':_0x1c35f9['query'][_0x0cad('0xea')]?!![]:![]}];}return db[_0x0cad('0xa8')]['findAll'](_0x4de2cf);})[_0x0cad('0x13')](function(_0xb72009){_0x1f1ca1[_0x0cad('0x4a')]=_0xb72009;return _0x1f1ca1;});}})['then'](respondWithFilteredResult(_0xe7a4e8,_0x4de2cf))['catch'](handleError(_0xe7a4e8,null));};function iftimePromise(_0x2b613e,_0x46a965){return respondWithRpcPromise(_0x0cad('0xeb'),'getSnippet',{'command':_0x46a965[_0x0cad('0xec')]?util[_0x0cad('0xa1')](_0x0cad('0xed'),_0x2b613e[_0x0cad('0xee')],_0x46a965[_0x0cad('0xec')]):util[_0x0cad('0xa1')]('iftime\x20%s',_0x2b613e[_0x0cad('0xee')])},client9002)['then'](function(_0x4e3e28){var _0x214c1f=_0x4e3e28&&_0x4e3e28[_0x0cad('0xef')](_0x0cad('0xf0'))>=0x0?!![]:![];logger[_0x0cad('0x14')](_0x0cad('0xf1'),_0x46a965['id'],_0x2b613e['id'],_0x2b613e['interval'],_0x214c1f?_0x0cad('0xf2'):_0x0cad('0xf3'),_0x46a965[_0x0cad('0xec')]?_0x46a965[_0x0cad('0xec')]:_0x0cad('0xf4'));return _0x214c1f;})[_0x0cad('0x1e')](function(_0x7ff830){logger[_0x0cad('0x1a')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x46a965['id'],_0x2b613e['id'],_0x2b613e[_0x0cad('0xee')],util['inspect'](_0x7ff830,{'showHidden':![],'depth':null}),_0x46a965[_0x0cad('0xec')]?_0x46a965['timezone']:_0x0cad('0xf4'));return![];});}exports[_0x0cad('0xf5')]=function(_0x25555d,_0x35c0b7){var _0x145f25=0x0;var _0x520ddb=0x0;var _0x454702=![];var _0x28a456;var _0x19bf7d;return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0x25555d[_0x0cad('0x4b')]['id']},'include':[{'model':db[_0x0cad('0xf6')],'as':_0x0cad('0xf6'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0x0cad('0xee')],'raw':!![]}]}]})[_0x0cad('0x13')](handleEntityNotFound(_0x35c0b7,null))[_0x0cad('0x13')](function(_0x26d535){if(_0x26d535){_0x28a456=_0x26d535;return _0x26d535[_0x0cad('0xf7')]({'raw':!![]});}})[_0x0cad('0x13')](function(_0x3948d7){if(_0x28a456){if(_0x3948d7){_0x19bf7d=_0x3948d7;}}return require(_0x0cad('0x6a'))[_0x0cad('0xf8')]();})['then'](function(_0x4af5e4){if(_0x4af5e4){_0x520ddb=_0x4af5e4['virtual'];_0x454702=_0x4af5e4[_0x0cad('0x6b')];}})[_0x0cad('0x13')](function(){return db[_0x0cad('0xa8')]['count']({'where':{'closed':![]}});})[_0x0cad('0x13')](function(_0x570428){_0x145f25=_0x570428;if(_0x520ddb&&_0x570428>_0x520ddb){return db[_0x0cad('0xf9')][_0x0cad('0x5a')]({'where':{'id':0x1}})['then'](function(_0x169bf8){if(_0x169bf8){_0x169bf8[_0x0cad('0xfa')](_0x0cad('0xfb'));}});}})[_0x0cad('0x13')](function(){if(_0x28a456[_0x0cad('0xf6')]&&_0x28a456['Interval']['Intervals']){var _0x41041e=[];for(var _0x14f9a2=0x0;_0x14f9a2<_0x28a456[_0x0cad('0xf6')][_0x0cad('0xfc')][_0x0cad('0x3c')];_0x14f9a2++){var _0x2b12f2=_0x28a456[_0x0cad('0xf6')][_0x0cad('0xfc')][_0x14f9a2]['get']({'plain':!![]});_0x41041e[_0x0cad('0xae')](iftimePromise(_0x2b12f2,_0x28a456));}return BPromise[_0x0cad('0xfd')](_0x41041e)['then'](function(_0x2a3264){return _[_0x0cad('0xfe')](_0x2a3264);});}else{return!![];}})[_0x0cad('0x13')](function(_0x1fd19b){var _0xefc4a1=fs[_0x0cad('0xbf')](path['join'](config[_0x0cad('0x70')],_0x0cad('0xff')),_0x0cad('0xc1'));var _0x1e2bb0={'remote':_0x28a456[_0x0cad('0x100')],'query':querystring[_0x0cad('0x19')](_[_0x0cad('0x44')](_0x28a456[_0x0cad('0x27')]({'plain':!![]}),{'customerIp':_0x25555d[_0x0cad('0x7c')][_0x0cad('0x99')]||_0x25555d[_0x0cad('0x7c')]['x-real-ip']||_0x25555d[_0x0cad('0x101')][_0x0cad('0x102')]||_0x25555d['ip'],'referer':_0x25555d[_0x0cad('0x7c')]['referer'],'openedInteractions':_0x145f25,'maxInteractions':_0x520ddb,'virtual':_0x454702[_0x0cad('0x103')],'online':_0x1fd19b,'custom':_0x454702}))['replace'](/'/g,'\x5c\x27')};_0x35c0b7[_0x0cad('0x2e')](ejs[_0x0cad('0x104')](Mustache[_0x0cad('0x104')](_0xefc4a1,_0x1e2bb0),{'proactiveActions':_0x19bf7d,'alignment':_0x28a456[_0x0cad('0x105')],'verticalAlignment':_0x28a456[_0x0cad('0x106')],'div_color':_0x28a456['color'],'labelText':_0x28a456[_0x0cad('0x107')],'text_color':_0x28a456[_0x0cad('0x108')],'text_button_color':_0x28a456[_0x0cad('0x109')],'button_color':_0x28a456['color_button'],'background_color':_0x28a456['backgroundColor'],'hideWhenOffline':_0x28a456['hideWhenOffline'],'interval':_0x28a456[_0x0cad('0x10a')]}));})[_0x0cad('0x1e')](handleError(_0x35c0b7,null));};exports['addApplications']=function(_0x2011ca,_0x15d91c){var _0x20f65a=_0x2011ca[_0x0cad('0x4b')]['id'];var _0x3bef9a=_0x2011ca[_0x0cad('0x4d')];var _0x4a1fb2=0xc8;var _0x5f57ed=null;return db[_0x0cad('0x10b')][_0x0cad('0xca')]({'isolationLevel':db[_0x0cad('0x10b')][_0x0cad('0x10c')][_0x0cad('0x10d')]['READ_COMMITTED']},function(_0x1552e6){return db[_0x0cad('0x46')][_0x0cad('0x5a')]({'where':{'id':_0x20f65a},'transaction':_0x1552e6})['then'](function(_0x1c7a08){if(_0x1c7a08){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x20f65a},'transaction':_0x1552e6})[_0x0cad('0x13')](function(){var _0x4f0eab=_[_0x0cad('0x32')](_0x3bef9a,function(_0x23962a){_0x23962a[_0x0cad('0x57')]=_0x20f65a;return _0x23962a;});return db['ChatApplication']['bulkCreate'](_0x4f0eab,{'transaction':_0x1552e6});});}else{_0x4a1fb2=0x194;_0x5f57ed=[];}});})['then'](function(){if(_0x4a1fb2!==0x194){return db[_0x0cad('0x8f')][_0x0cad('0x10e')]({'where':{'ChatWebsiteId':_0x20f65a},'order':_0x0cad('0x10f')})[_0x0cad('0x13')](function(_0x5e2660){_0x5f57ed=_0x5e2660;});}})[_0x0cad('0x1e')](function(_0x2911ec){_0x4a1fb2=0x1f4;logger[_0x0cad('0x1a')](_0x2911ec['stack']);if(_0x2911ec[_0x0cad('0x2d')]){delete _0x2911ec['name'];}_0x5f57ed=_0x2911ec;})[_0x0cad('0x110')](function(){if(_0x5f57ed===null){_0x15d91c['sendStatus'](_0x4a1fb2);}else{if(_0x4a1fb2===0x1f4){_0x15d91c[_0x0cad('0x20')](_0x4a1fb2)[_0x0cad('0x2e')](_0x5f57ed);}else{_0x15d91c[_0x0cad('0x20')](_0x4a1fb2)['json'](_0x5f57ed);}}});};exports['getApplications']=function(_0x8c328f,_0x482298){var _0x432299={};var _0x59400c={};var _0x3a982b;var _0x19a9e8;return db[_0x0cad('0x46')][_0x0cad('0x5a')]({'where':{'id':_0x8c328f[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x482298,null))['then'](function(_0x377c41){if(_0x377c41){_0x3a982b=_0x377c41;_0x59400c[_0x0cad('0x35')]=_[_0x0cad('0x37')](db[_0x0cad('0x8f')][_0x0cad('0x33')]);_0x59400c[_0x0cad('0x36')]=_[_0x0cad('0x37')](_0x8c328f[_0x0cad('0x36')]);_0x59400c[_0x0cad('0x38')]=_['intersection'](_0x59400c[_0x0cad('0x35')],_0x59400c[_0x0cad('0x36')]);_0x432299['attributes']=_[_0x0cad('0x3a')](_0x59400c[_0x0cad('0x35')],qs[_0x0cad('0x3b')](_0x8c328f['query'][_0x0cad('0x3b')]));_0x432299[_0x0cad('0x39')]=_0x432299[_0x0cad('0x39')][_0x0cad('0x3c')]?_0x432299['attributes']:_0x59400c[_0x0cad('0x35')];_0x432299[_0x0cad('0x3f')]=qs[_0x0cad('0x40')](_0x8c328f[_0x0cad('0x36')]['sort']);_0x432299[_0x0cad('0x43')]=qs[_0x0cad('0x38')](_[_0x0cad('0x41')](_0x8c328f[_0x0cad('0x36')],_0x59400c[_0x0cad('0x38')]));if(_0x8c328f['query'][_0x0cad('0x42')]){_0x432299[_0x0cad('0x43')]=_[_0x0cad('0x44')](_0x432299[_0x0cad('0x43')],{'$or':_[_0x0cad('0x32')](_0x432299[_0x0cad('0x39')],function(_0x5d0f76){var _0x3e4277={};_0x3e4277[_0x5d0f76]={'$like':'%'+_0x8c328f[_0x0cad('0x36')][_0x0cad('0x42')]+'%'};return _0x3e4277;})});}_0x432299=_[_0x0cad('0x44')]({},_0x432299,_0x8c328f[_0x0cad('0x45')]);return _0x3a982b[_0x0cad('0x111')](_0x432299);}})['then'](function(_0x122ab0){if(_0x122ab0){_0x19a9e8=_0x122ab0[_0x0cad('0x3c')];if(!_0x8c328f[_0x0cad('0x36')]['hasOwnProperty'](_0x0cad('0x3e'))){_0x432299[_0x0cad('0x24')]=qs[_0x0cad('0x24')](_0x8c328f[_0x0cad('0x36')]['limit']);_0x432299[_0x0cad('0x22')]=qs[_0x0cad('0x22')](_0x8c328f[_0x0cad('0x36')][_0x0cad('0x22')]);}return _0x3a982b['getApplications'](_0x432299);}})[_0x0cad('0x13')](function(_0x5b2aca){if(_0x5b2aca){return _0x5b2aca?{'count':_0x19a9e8,'rows':_0x5b2aca}:null;}})[_0x0cad('0x13')](respondWithResult(_0x482298,null))[_0x0cad('0x1e')](handleError(_0x482298,null));};exports[_0x0cad('0x112')]=function(_0x444c95,_0x11d893){return db['chatProactiveAction'][_0x0cad('0x52')]({'where':{'id':_0x444c95[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x11d893,null))[_0x0cad('0x13')](function(_0xbe7310){if(_0xbe7310){return _0xbe7310[_0x0cad('0x112')](_0x444c95[_0x0cad('0x4d')][_0x0cad('0x5f')],_[_0x0cad('0xe3')](_0x444c95[_0x0cad('0x4d')],[_0x0cad('0x5f'),'id'])||{});}})[_0x0cad('0x13')](respondWithResult(_0x11d893,null))['catch'](handleError(_0x11d893,null));};exports[_0x0cad('0xf7')]=function(_0x50fa5f,_0x13f28c){var _0x2d5534={};var _0x3b55e1={};var _0x536a0d;var _0x752be6;return db[_0x0cad('0x46')]['findOne']({'where':{'id':_0x50fa5f[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x13f28c,null))['then'](function(_0x4f5ec0){if(_0x4f5ec0){_0x536a0d=_0x4f5ec0;_0x3b55e1['model']=_[_0x0cad('0x37')](db[_0x0cad('0x113')]['rawAttributes']);_0x3b55e1[_0x0cad('0x36')]=_['keys'](_0x50fa5f[_0x0cad('0x36')]);_0x3b55e1[_0x0cad('0x38')]=_[_0x0cad('0x3a')](_0x3b55e1[_0x0cad('0x35')],_0x3b55e1[_0x0cad('0x36')]);_0x2d5534['attributes']=_[_0x0cad('0x3a')](_0x3b55e1[_0x0cad('0x35')],qs[_0x0cad('0x3b')](_0x50fa5f[_0x0cad('0x36')][_0x0cad('0x3b')]));_0x2d5534[_0x0cad('0x39')]=_0x2d5534[_0x0cad('0x39')][_0x0cad('0x3c')]?_0x2d5534[_0x0cad('0x39')]:_0x3b55e1[_0x0cad('0x35')];_0x2d5534[_0x0cad('0x3f')]=qs[_0x0cad('0x40')](_0x50fa5f[_0x0cad('0x36')][_0x0cad('0x40')]);_0x2d5534[_0x0cad('0x43')]=qs[_0x0cad('0x38')](_[_0x0cad('0x41')](_0x50fa5f[_0x0cad('0x36')],_0x3b55e1['filters']));if(_0x50fa5f[_0x0cad('0x36')]['filter']){_0x2d5534[_0x0cad('0x43')]=_[_0x0cad('0x44')](_0x2d5534[_0x0cad('0x43')],{'$or':_['map'](_0x2d5534[_0x0cad('0x39')],function(_0x5dbfc8){var _0x3c4bd8={};_0x3c4bd8[_0x5dbfc8]={'$like':'%'+_0x50fa5f[_0x0cad('0x36')]['filter']+'%'};return _0x3c4bd8;})});}_0x2d5534=_['merge']({},_0x2d5534,_0x50fa5f['options']);return _0x536a0d[_0x0cad('0xf7')](_0x2d5534);}})['then'](function(_0x192caf){if(_0x192caf){_0x752be6=_0x192caf['length'];if(!_0x50fa5f[_0x0cad('0x36')][_0x0cad('0x3d')](_0x0cad('0x3e'))){_0x2d5534[_0x0cad('0x24')]=qs[_0x0cad('0x24')](_0x50fa5f[_0x0cad('0x36')][_0x0cad('0x24')]);_0x2d5534[_0x0cad('0x22')]=qs[_0x0cad('0x22')](_0x50fa5f[_0x0cad('0x36')]['offset']);}return _0x536a0d[_0x0cad('0xf7')](_0x2d5534);}})['then'](function(_0x2cf68b){if(_0x2cf68b){return _0x2cf68b?{'count':_0x752be6,'rows':_0x2cf68b}:null;}})[_0x0cad('0x13')](respondWithResult(_0x13f28c,null))[_0x0cad('0x1e')](handleError(_0x13f28c,null));};exports[_0x0cad('0x114')]=function(_0x51abf7,_0x5a80f9){var _0x561d9d=_0x51abf7[_0x0cad('0x36')][_0x0cad('0x115')]===_0x0cad('0x116')?_0x0cad('0x117'):'onlineForm';return db[_0x0cad('0x46')][_0x0cad('0x52')]({'attributes':['id',_0x561d9d],'where':{'id':_0x51abf7[_0x0cad('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a80f9,null))[_0x0cad('0x13')](function(_0x1dde7d){if(_0x1dde7d){var _0x439fa7=_0x1dde7d[_0x561d9d];var _0x5c5f60=_0x439fa7&&_0x439fa7[_0x0cad('0x118')]?_0x439fa7['items']:[];_0x5a80f9[_0x0cad('0x2e')]({'fromKey':_[_0x0cad('0x6c')](_0x439fa7[_0x0cad('0x119')])?undefined:_0x439fa7[_0x0cad('0x119')],'count':_0x5c5f60[_0x0cad('0x3c')],'rows':_0x5c5f60});}})[_0x0cad('0x1e')](handleError(_0x5a80f9,null));};exports[_0x0cad('0x11a')]=function(_0x15b725,_0x232ac1){var _0x3eddc1={'raw':![],'where':{}};var _0x58c91d={};var _0x5de085={'count':0x0,'rows':[]};return db[_0x0cad('0x46')][_0x0cad('0x5a')]({'where':{'id':_0x15b725[_0x0cad('0x4b')]['id']}})['then'](handleEntityNotFound(_0x232ac1,null))[_0x0cad('0x13')](function(_0x177524){if(_0x177524){_0x58c91d[_0x0cad('0x35')]=_[_0x0cad('0x37')](db['ChatOfflineMessage'][_0x0cad('0x33')]);_0x58c91d[_0x0cad('0x36')]=_[_0x0cad('0x37')](_0x15b725[_0x0cad('0x36')]);_0x58c91d[_0x0cad('0x38')]=_[_0x0cad('0x3a')](_0x58c91d[_0x0cad('0x35')],_0x58c91d[_0x0cad('0x36')]);_0x3eddc1[_0x0cad('0x39')]=_[_0x0cad('0x3a')](_0x58c91d['model'],qs[_0x0cad('0x3b')](_0x15b725[_0x0cad('0x36')][_0x0cad('0x3b')]));_0x3eddc1[_0x0cad('0x39')]=_0x3eddc1[_0x0cad('0x39')][_0x0cad('0x3c')]?_0x3eddc1['attributes']:_0x58c91d[_0x0cad('0x35')];if(!_0x15b725[_0x0cad('0x36')]['hasOwnProperty'](_0x0cad('0x3e'))){_0x3eddc1[_0x0cad('0x24')]=qs['limit'](_0x15b725[_0x0cad('0x36')]['limit']);_0x3eddc1['offset']=qs[_0x0cad('0x22')](_0x15b725[_0x0cad('0x36')][_0x0cad('0x22')]);}_0x3eddc1[_0x0cad('0x3f')]=qs[_0x0cad('0x40')](_0x15b725[_0x0cad('0x36')][_0x0cad('0x40')]);_0x3eddc1[_0x0cad('0x43')]=qs['filters'](_[_0x0cad('0x41')](_0x15b725[_0x0cad('0x36')],_0x58c91d[_0x0cad('0x38')]));_0x3eddc1[_0x0cad('0x43')]['ChatWebsiteId']=_0x177524['id'];if(_0x15b725[_0x0cad('0x36')][_0x0cad('0x42')]){_0x3eddc1['where']=_[_0x0cad('0x44')](_0x3eddc1[_0x0cad('0x43')],{'$or':_[_0x0cad('0x32')](_0x3eddc1['attributes'],function(_0x3fa7a4){var _0x43b803={};_0x43b803[_0x3fa7a4]={'$like':'%'+_0x15b725[_0x0cad('0x36')][_0x0cad('0x42')]+'%'};return _0x43b803;})});}_0x3eddc1=_[_0x0cad('0x44')]({},_0x3eddc1,_0x15b725[_0x0cad('0x45')]);return db['ChatOfflineMessage'][_0x0cad('0x25')]({'where':_0x3eddc1['where']})['then'](function(_0x47a9c9){_0x5de085[_0x0cad('0x25')]=_0x47a9c9;if(_0x15b725['query'][_0x0cad('0x47')]){_0x3eddc1[_0x0cad('0x48')]=[{'all':!![]}];}else{_0x3eddc1[_0x0cad('0x48')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x0cad('0x11b')],'as':'Attachments','required':![]}];}return db[_0x0cad('0xc4')][_0x0cad('0x49')](_0x3eddc1);})['then'](function(_0x5060b7){_0x5de085[_0x0cad('0x4a')]=_0x5060b7;return _0x5de085;});}})[_0x0cad('0x13')](respondWithFilteredResult(_0x232ac1,_0x3eddc1))['catch'](handleError(_0x232ac1,null));};exports[_0x0cad('0x11c')]=function(_0x4ffdb3,_0x2fa11b){return db['ChatWebsite']['find']({'where':{'id':_0x4ffdb3['params']['id']}})['then'](handleEntityNotFound(_0x2fa11b,null))[_0x0cad('0x13')](function(_0x3244f6){if(_0x3244f6){return _0x3244f6['addAgents'](_0x4ffdb3['body'][_0x0cad('0x5f')],_[_0x0cad('0xe3')](_0x4ffdb3[_0x0cad('0x4d')],[_0x0cad('0x5f'),'id'])||{})[_0x0cad('0xaa')](function(_0x42e604){for(var _0xa32aab=0x0;_0xa32aab<_0x4ffdb3[_0x0cad('0x4d')][_0x0cad('0x5f')][_0x0cad('0x3c')];_0xa32aab+=0x1){socket[_0x0cad('0x11d')](_0x0cad('0x11e'),{'UserId':Number(_0x4ffdb3[_0x0cad('0x4d')]['ids'][_0xa32aab]),'ChatWebsiteId':Number(_0x4ffdb3[_0x0cad('0x4b')]['id'])});}return _0x42e604;});}})[_0x0cad('0x13')](respondWithResult(_0x2fa11b,null))[_0x0cad('0x1e')](handleError(_0x2fa11b,null));};exports['removeAgents']=function(_0x4dca9c,_0x17f43f){return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0x4dca9c[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x17f43f,null))[_0x0cad('0x13')](function(_0x174a48){if(_0x174a48){return _0x174a48['removeAgents'](_0x4dca9c[_0x0cad('0x36')][_0x0cad('0x5f')])['then'](function(){if(_[_0x0cad('0x11f')](_0x4dca9c[_0x0cad('0x36')][_0x0cad('0x5f')])){for(var _0xd018cf=0x0;_0xd018cf<_0x4dca9c['query'][_0x0cad('0x5f')]['length'];_0xd018cf+=0x1){socket[_0x0cad('0x11d')]('userChatWebsite:remove',{'UserId':Number(_0x4dca9c[_0x0cad('0x36')][_0x0cad('0x5f')][_0xd018cf]),'ChatWebsiteId':Number(_0x4dca9c[_0x0cad('0x4b')]['id'])});}}else{socket[_0x0cad('0x11d')](_0x0cad('0x120'),{'UserId':Number(_0x4dca9c[_0x0cad('0x36')][_0x0cad('0x5f')]),'ChatWebsiteId':Number(_0x4dca9c[_0x0cad('0x4b')]['id'])});}});}})[_0x0cad('0x13')](respondWithStatusCode(_0x17f43f,null))['catch'](handleError(_0x17f43f,null));};exports[_0x0cad('0x121')]=function(_0xf5840a,_0x4daf46){var _0x1c9dcb={};var _0x3074ad={};var _0x339615;var _0x4a2797;return db['ChatWebsite'][_0x0cad('0x5a')]({'where':{'id':_0xf5840a[_0x0cad('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4daf46,null))[_0x0cad('0x13')](function(_0xcf042b){if(_0xcf042b){_0x339615=_0xcf042b;_0x3074ad[_0x0cad('0x35')]=_[_0x0cad('0x37')](db[_0x0cad('0xb3')][_0x0cad('0x33')]);_0x3074ad[_0x0cad('0x36')]=_[_0x0cad('0x37')](_0xf5840a[_0x0cad('0x36')]);_0x3074ad[_0x0cad('0x38')]=_[_0x0cad('0x3a')](_0x3074ad[_0x0cad('0x35')],_0x3074ad[_0x0cad('0x36')]);_0x1c9dcb[_0x0cad('0x39')]=_[_0x0cad('0x3a')](_0x3074ad['model'],qs[_0x0cad('0x3b')](_0xf5840a[_0x0cad('0x36')][_0x0cad('0x3b')]));_0x1c9dcb[_0x0cad('0x39')]=_0x1c9dcb[_0x0cad('0x39')]['length']?_0x1c9dcb['attributes']:_0x3074ad[_0x0cad('0x35')];_0x1c9dcb[_0x0cad('0x3f')]=qs['sort'](_0xf5840a[_0x0cad('0x36')][_0x0cad('0x40')]);_0x1c9dcb[_0x0cad('0x43')]=qs[_0x0cad('0x38')](_['pick'](_0xf5840a[_0x0cad('0x36')],_0x3074ad[_0x0cad('0x38')]));if(_0xf5840a['query'][_0x0cad('0x42')]){_0x1c9dcb[_0x0cad('0x43')]=_[_0x0cad('0x44')](_0x1c9dcb[_0x0cad('0x43')],{'$or':_[_0x0cad('0x32')](_0x1c9dcb[_0x0cad('0x39')],function(_0x416994){var _0x31408e={};_0x31408e[_0x416994]={'$like':'%'+_0xf5840a['query'][_0x0cad('0x42')]+'%'};return _0x31408e;})});}_0x1c9dcb=_['merge']({},_0x1c9dcb,_0xf5840a['options']);return _0x339615[_0x0cad('0x121')](_0x1c9dcb);}})[_0x0cad('0x13')](function(_0x2992c3){if(_0x2992c3){_0x4a2797=_0x2992c3[_0x0cad('0x3c')];if(!_0xf5840a[_0x0cad('0x36')][_0x0cad('0x3d')]('nolimit')){_0x1c9dcb[_0x0cad('0x24')]=qs[_0x0cad('0x24')](_0xf5840a[_0x0cad('0x36')][_0x0cad('0x24')]);_0x1c9dcb[_0x0cad('0x22')]=qs['offset'](_0xf5840a[_0x0cad('0x36')][_0x0cad('0x22')]);}return _0x339615[_0x0cad('0x121')](_0x1c9dcb);}})['then'](function(_0x464355){if(_0x464355){return _0x464355?{'count':_0x4a2797,'rows':_0x464355}:null;}})[_0x0cad('0x13')](respondWithResult(_0x4daf46,null))[_0x0cad('0x1e')](handleError(_0x4daf46,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 4f5fb9d..d0b4d6c 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 _0xcee8=['hasOwnProperty','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','emit'];(function(_0x381dbb,_0x4a1419){var _0x301378=function(_0xd1993c){while(--_0xd1993c){_0x381dbb['push'](_0x381dbb['shift']());}};_0x301378(++_0x4a1419);}(_0xcee8,0xb1));var _0x8cee=function(_0x2f1f74,_0x4a884e){_0x2f1f74=_0x2f1f74-0x0;var _0x1170fc=_0xcee8[_0x2f1f74];return _0x1170fc;};'use strict';var EventEmitter=require(_0x8cee('0x0'));var ChatWebsite=require(_0x8cee('0x1'))['db'][_0x8cee('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x8cee('0x3')](0x0);var events={'afterCreate':_0x8cee('0x4'),'afterUpdate':_0x8cee('0x5'),'afterDestroy':'remove'};function emitEvent(_0x127360){return function(_0x4e4143,_0xffd42d,_0x1ec415){ChatWebsiteEvents['emit'](_0x127360+':'+_0x4e4143['id'],_0x4e4143);ChatWebsiteEvents[_0x8cee('0x6')](_0x127360,_0x4e4143);_0x1ec415(null);};}for(var e in events){if(events[_0x8cee('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xf021=['emit','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','remove'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xf021,0x18f));var _0x1f02=function(_0x224ad0,_0x2482bd){_0x224ad0=_0x224ad0-0x0;var _0x2e04fc=_0xf021[_0x224ad0];return _0x2e04fc;};'use strict';var EventEmitter=require(_0x1f02('0x0'));var ChatWebsite=require(_0x1f02('0x1'))['db'][_0x1f02('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x1f02('0x3')](0x0);var events={'afterCreate':_0x1f02('0x4'),'afterUpdate':'update','afterDestroy':_0x1f02('0x5')};function emitEvent(_0x54cd44){return function(_0x2e8594,_0x3164f0,_0x51eff6){ChatWebsiteEvents['emit'](_0x54cd44+':'+_0x2e8594['id'],_0x2e8594);ChatWebsiteEvents[_0x1f02('0x6')](_0x54cd44,_0x2e8594);_0x51eff6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x1f02('0x7')](e,emitEvent(event));}}module[_0x1f02('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 54b84ef..b5ffe36 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 _0xa8de=['chat_websites','util','../../config/logger','moment','bluebird','request-promise','rimraf','./chatWebsite.attributes','exports','ChatWebsite'];(function(_0x20fc79,_0x35186d){var _0x39a80e=function(_0x3c756a){while(--_0x3c756a){_0x20fc79['push'](_0x20fc79['shift']());}};_0x39a80e(++_0x35186d);}(_0xa8de,0x187));var _0xea8d=function(_0x2c4be0,_0x41af29){_0x2c4be0=_0x2c4be0-0x0;var _0xf2a3dc=_0xa8de[_0x2c4be0];return _0xf2a3dc;};'use strict';var _=require('lodash');var util=require(_0xea8d('0x0'));var logger=require(_0xea8d('0x1'))('api');var moment=require(_0xea8d('0x2'));var BPromise=require(_0xea8d('0x3'));var rp=require(_0xea8d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea8d('0x5'));var config=require('../../config/environment');var attributes=require(_0xea8d('0x6'));module[_0xea8d('0x7')]=function(_0x540548,_0x49f1d4){return _0x540548['define'](_0xea8d('0x8'),attributes,{'tableName':_0xea8d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf665=['lodash','util','../../config/logger','api','moment','rimraf','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites'];(function(_0x5affbd,_0x594b38){var _0x5093a8=function(_0xe8b562){while(--_0xe8b562){_0x5affbd['push'](_0x5affbd['shift']());}};_0x5093a8(++_0x594b38);}(_0xf665,0x84));var _0x5f66=function(_0x47bb19,_0x17a096){_0x47bb19=_0x47bb19-0x0;var _0x4ef57a=_0xf665[_0x47bb19];return _0x4ef57a;};'use strict';var _=require(_0x5f66('0x0'));var util=require(_0x5f66('0x1'));var logger=require(_0x5f66('0x2'))(_0x5f66('0x3'));var moment=require(_0x5f66('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5f66('0x5'));var config=require('../../config/environment');var attributes=require(_0x5f66('0x6'));module[_0x5f66('0x7')]=function(_0x5dcbc6,_0x2e3605){return _0x5dcbc6[_0x5f66('0x8')](_0x5f66('0x9'),attributes,{'tableName':_0x5f66('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 95e0b6f..9c9f493 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 _0xef27=['../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','util','bluebird','randomstring','../../mysqldb'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xef27,0x17c));var _0x7ef2=function(_0x908522,_0x37d960){_0x908522=_0x908522-0x0;var _0x50c7a8=_0xef27[_0x908522];return _0x50c7a8;};'use strict';var _=require('lodash');var util=require(_0x7ef2('0x0'));var moment=require('moment');var BPromise=require(_0x7ef2('0x1'));var rs=require(_0x7ef2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ef2('0x3'))['db'];var utils=require(_0x7ef2('0x4'));var logger=require(_0x7ef2('0x5'))(_0x7ef2('0x6'));var config=require(_0x7ef2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7ef2('0x8')]['http']({'port':0x232a});config[_0x7ef2('0x9')]=_['defaults'](config[_0x7ef2('0x9')],{'host':_0x7ef2('0xa'),'port':0x18eb});var socket=require(_0x7ef2('0xb'))(new Redis(config[_0x7ef2('0x9')]));require(_0x7ef2('0xc'))[_0x7ef2('0xd')](socket);function respondWithRpcPromise(_0x2ec3ec,_0x146eb9,_0x3d8261){return new BPromise(function(_0xc69d6c,_0xc2ff54){return client[_0x7ef2('0xe')](_0x2ec3ec,_0x3d8261)[_0x7ef2('0xf')](function(_0x44bbee){logger[_0x7ef2('0x10')](_0x7ef2('0x11'),_0x146eb9,'request\x20sent');logger[_0x7ef2('0x12')](_0x7ef2('0x13'),_0x146eb9,_0x7ef2('0x14'),JSON['stringify'](_0x44bbee));if(_0x44bbee[_0x7ef2('0x15')]){if(_0x44bbee[_0x7ef2('0x15')][_0x7ef2('0x16')]===0x1f4){logger['error'](_0x7ef2('0x11'),_0x146eb9,_0x44bbee['error'][_0x7ef2('0x17')]);return _0xc2ff54(_0x44bbee['error']['message']);}logger[_0x7ef2('0x15')](_0x7ef2('0x11'),_0x146eb9,_0x44bbee[_0x7ef2('0x15')]['message']);return _0xc69d6c(_0x44bbee[_0x7ef2('0x15')][_0x7ef2('0x17')]);}else{logger[_0x7ef2('0x10')](_0x7ef2('0x11'),_0x146eb9,_0x7ef2('0x14'));_0xc69d6c(_0x44bbee['result'][_0x7ef2('0x17')]);}})['catch'](function(_0x34392b){logger[_0x7ef2('0x15')](_0x7ef2('0x11'),_0x146eb9,_0x34392b);_0xc2ff54(_0x34392b);});});} \ No newline at end of file +var _0x97ea=['localhost','./chatWebsite.socket','register','then','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x28831e,_0x57062b){var _0x57c7a0=function(_0x34c775){while(--_0x34c775){_0x28831e['push'](_0x28831e['shift']());}};_0x57c7a0(++_0x57062b);}(_0x97ea,0x1f3));var _0xa97e=function(_0x1c6289,_0x389a28){_0x1c6289=_0x1c6289-0x0;var _0x28ab7a=_0x97ea[_0x1c6289];return _0x28ab7a;};'use strict';var _=require(_0xa97e('0x0'));var util=require(_0xa97e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa97e('0x2'));var fs=require('fs');var Redis=require(_0xa97e('0x3'));var db=require(_0xa97e('0x4'))['db'];var utils=require(_0xa97e('0x5'));var logger=require(_0xa97e('0x6'))(_0xa97e('0x7'));var config=require(_0xa97e('0x8'));var jayson=require(_0xa97e('0x9'));var client=jayson[_0xa97e('0xa')][_0xa97e('0xb')]({'port':0x232a});config[_0xa97e('0xc')]=_[_0xa97e('0xd')](config[_0xa97e('0xc')],{'host':_0xa97e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa97e('0xc')]));require(_0xa97e('0xf'))[_0xa97e('0x10')](socket);function respondWithRpcPromise(_0x484536,_0x595d7f,_0x59e7c7){return new BPromise(function(_0x56e226,_0x39c379){return client['request'](_0x484536,_0x59e7c7)[_0xa97e('0x11')](function(_0x4dd3a2){logger['info'](_0xa97e('0x12'),_0x595d7f,'request\x20sent');logger[_0xa97e('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x595d7f,_0xa97e('0x14'),JSON[_0xa97e('0x15')](_0x4dd3a2));if(_0x4dd3a2[_0xa97e('0x16')]){if(_0x4dd3a2['error']['code']===0x1f4){logger[_0xa97e('0x16')](_0xa97e('0x12'),_0x595d7f,_0x4dd3a2[_0xa97e('0x16')][_0xa97e('0x17')]);return _0x39c379(_0x4dd3a2['error'][_0xa97e('0x17')]);}logger[_0xa97e('0x16')](_0xa97e('0x12'),_0x595d7f,_0x4dd3a2[_0xa97e('0x16')][_0xa97e('0x17')]);return _0x56e226(_0x4dd3a2['error']['message']);}else{logger[_0xa97e('0x18')](_0xa97e('0x12'),_0x595d7f,_0xa97e('0x14'));_0x56e226(_0x4dd3a2[_0xa97e('0x19')][_0xa97e('0x17')]);}})[_0xa97e('0x1a')](function(_0x3a8a60){logger[_0xa97e('0x16')](_0xa97e('0x12'),_0x595d7f,_0x3a8a60);_0x39c379(_0x3a8a60);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index b9b43f9..4cce358 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 _0x0154=['removeListener','register','chatWebsite:','save','remove','update','emit'];(function(_0x594e11,_0x28f652){var _0x5418ad=function(_0x5dcfa7){while(--_0x5dcfa7){_0x594e11['push'](_0x594e11['shift']());}};_0x5418ad(++_0x28f652);}(_0x0154,0x73));var _0x4015=function(_0x35ba14,_0x31f105){_0x35ba14=_0x35ba14-0x0;var _0x102ca7=_0x0154[_0x35ba14];return _0x102ca7;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x4015('0x0'),_0x4015('0x1'),_0x4015('0x2')];function createListener(_0x53dc12,_0x5e97c6){return function(_0xcd8249){_0x5e97c6[_0x4015('0x3')](_0x53dc12,_0xcd8249);};}function removeListener(_0x5e8e7d,_0xf18edf){return function(){ChatWebsiteEvents[_0x4015('0x4')](_0x5e8e7d,_0xf18edf);};}exports[_0x4015('0x5')]=function(_0x50120f){for(var _0x1ec2ea=0x0,_0x59d2ea=events['length'];_0x1ec2ea<_0x59d2ea;_0x1ec2ea++){var _0x5d3bcc=events[_0x1ec2ea];var _0x1e326e=createListener(_0x4015('0x6')+_0x5d3bcc,_0x50120f);ChatWebsiteEvents['on'](_0x5d3bcc,_0x1e326e);}}; \ No newline at end of file +var _0xf937=['length','chatWebsite:','./chatWebsite.events','save','remove','register'];(function(_0x26a686,_0x4f51d2){var _0x2bf65d=function(_0x20addc){while(--_0x20addc){_0x26a686['push'](_0x26a686['shift']());}};_0x2bf65d(++_0x4f51d2);}(_0xf937,0xda));var _0x7f93=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0xf937[_0x146a97];return _0x259d5c;};'use strict';var ChatWebsiteEvents=require(_0x7f93('0x0'));var events=[_0x7f93('0x1'),_0x7f93('0x2'),'update'];function createListener(_0x36648c,_0x42490d){return function(_0x1a41e9){_0x42490d['emit'](_0x36648c,_0x1a41e9);};}function removeListener(_0x3ec9bc,_0xd373a4){return function(){ChatWebsiteEvents['removeListener'](_0x3ec9bc,_0xd373a4);};}exports[_0x7f93('0x3')]=function(_0x2f06d2){for(var _0x23b4f2=0x0,_0x4d0b79=events[_0x7f93('0x4')];_0x23b4f2<_0x4d0b79;_0x23b4f2++){var _0x33bebb=events[_0x23b4f2];var _0x27516f=createListener(_0x7f93('0x5')+_0x33bebb,_0x2f06d2);ChatWebsiteEvents['on'](_0x33bebb,_0x27516f);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index af59b37..9bac966 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 _0x633f=['destroy','/:id/dispositions','removeDispositions','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','getSnippet','/:id/proactive_actions','getProactiveActions','/:id/offline_messages','getOfflineMessages','/:id/users','create','post','addDisposition','addAnswer','join','format','%s-%s','now','originalname','single','addLogo','diskStorage','server/files/images/avatars/','/:id/avatar','file','addAvatar','addCustomerAvatar','/:id/notify','notify','root','server/files','offline-chat','ensureDir','replace','any','offline','/:id/interactions','/:id/applications','addApplications','addProactiveActions','addAgents','put','update','delete'];(function(_0x485de1,_0x5df409){var _0x53647e=function(_0x4f4f2d){while(--_0x4f4f2d){_0x485de1['push'](_0x485de1['shift']());}};_0x53647e(++_0x5df409);}(_0x633f,0x8d));var _0xf633=function(_0x3aa6c9,_0x498f87){_0x3aa6c9=_0x3aa6c9-0x0;var _0x4e48a7=_0x633f[_0x3aa6c9];return _0x4e48a7;};'use strict';var multer=require(_0xf633('0x0'));var util=require(_0xf633('0x1'));var path=require(_0xf633('0x2'));var timeout=require('connect-timeout');var express=require(_0xf633('0x3'));var router=express['Router']();var fs_extra=require(_0xf633('0x4'));var auth=require(_0xf633('0x5'));var interaction=require(_0xf633('0x6'));var config=require(_0xf633('0x7'));var controller=require(_0xf633('0x8'));router[_0xf633('0x9')]('/',auth[_0xf633('0xa')](),controller[_0xf633('0xb')]);router[_0xf633('0x9')]('/describe',auth[_0xf633('0xa')](),controller[_0xf633('0xc')]);router[_0xf633('0x9')](_0xf633('0xd'),auth[_0xf633('0xa')](),controller['show']);router[_0xf633('0x9')]('/:id/dispositions',auth[_0xf633('0xa')](),controller['getDispositions']);router[_0xf633('0x9')]('/:id/canned_answers',auth[_0xf633('0xa')](),controller[_0xf633('0xe')]);router['get'](_0xf633('0xf'),controller[_0xf633('0x10')]);router['get']('/:id/avatar',controller[_0xf633('0x11')]);router['get'](_0xf633('0x12'),controller[_0xf633('0x13')]);router[_0xf633('0x9')](_0xf633('0x14'),controller[_0xf633('0x15')]);router[_0xf633('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xf633('0x16')]);router['get']('/:id/snippet',controller[_0xf633('0x17')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0xf633('0x9')](_0xf633('0x18'),auth[_0xf633('0xa')](),controller[_0xf633('0x19')]);router['get']('/:id/fields',controller['getFields']);router[_0xf633('0x9')](_0xf633('0x1a'),auth[_0xf633('0xa')](),controller[_0xf633('0x1b')]);router['get'](_0xf633('0x1c'),auth[_0xf633('0xa')](),controller['getAgents']);router['post']('/',auth[_0xf633('0xa')](),controller[_0xf633('0x1d')]);router[_0xf633('0x1e')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf633('0x1f')]);router[_0xf633('0x1e')]('/:id/canned_answers',auth[_0xf633('0xa')](),controller[_0xf633('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x127948,_0x81c529,_0x4fd86d){_0x4fd86d(null,path[_0xf633('0x21')](config['root'],'server/files/images/logos/'));},'filename':function(_0x1d0a36,_0x1a3e4d,_0x190c51){_0x190c51(null,util[_0xf633('0x22')](_0xf633('0x23'),Date[_0xf633('0x24')](),_0x1a3e4d[_0xf633('0x25')]));}})});router[_0xf633('0x1e')]('/:id/logo',upload[_0xf633('0x26')]('file'),controller[_0xf633('0x27')]);var upload=multer({'storage':multer[_0xf633('0x28')]({'destination':function(_0x8db2b2,_0x37487d,_0x1e824b){_0x1e824b(null,path['join'](config['root'],_0xf633('0x29')));},'filename':function(_0x4eb597,_0x11cd60,_0x46e7b4){_0x46e7b4(null,util['format'](_0xf633('0x23'),Date[_0xf633('0x24')](),_0x11cd60[_0xf633('0x25')]));}})});router['post'](_0xf633('0x2a'),upload[_0xf633('0x26')](_0xf633('0x2b')),controller[_0xf633('0x2c')]);var upload=multer({'storage':multer[_0xf633('0x28')]({'destination':function(_0x4886bb,_0x9a89d0,_0x40fa7c){_0x40fa7c(null,path[_0xf633('0x21')](config['root'],_0xf633('0x29')));},'filename':function(_0x207696,_0x37a37d,_0x5c2eff){_0x5c2eff(null,util[_0xf633('0x22')](_0xf633('0x23'),Date[_0xf633('0x24')](),_0x37a37d[_0xf633('0x25')]));}})});router[_0xf633('0x1e')](_0xf633('0x12'),upload[_0xf633('0x26')](_0xf633('0x2b')),controller[_0xf633('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x395754,_0x386b41,_0x52bbcc){_0x52bbcc(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x593f30,_0xb65ebd,_0x568182){_0x568182(null,util[_0xf633('0x22')](_0xf633('0x23'),Date[_0xf633('0x24')](),_0xb65ebd['originalname']));}})});router[_0xf633('0x1e')](_0xf633('0x14'),upload['single'](_0xf633('0x2b')),controller['addSystemAvatar']);router[_0xf633('0x1e')](_0xf633('0x2e'),controller[_0xf633('0x2f')]);const offlineUploadMulter=multer({'storage':multer[_0xf633('0x28')]({'destination':function(_0x514b42,_0x33caec,_0x41a471){const _0x597b5c=path[_0xf633('0x21')](config[_0xf633('0x30')],_0xf633('0x31'),'attachments',_0xf633('0x32'));fs_extra[_0xf633('0x33')](_0x597b5c,function(){_0x41a471(null,_0x597b5c);});},'filename':function(_0x10e589,_0x3632f9,_0x157d2c){const _0x5a0c8b=_0x3632f9[_0xf633('0x25')][_0xf633('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x12341b=path['extname'](_0x5a0c8b);const _0x29e94d=Date[_0xf633('0x24')]()+'-'+_0x5a0c8b[_0xf633('0x34')](_0x12341b,'')+_0x12341b;_0x157d2c(null,_0x29e94d);}})});router['post']('/:id/offline',offlineUploadMulter[_0xf633('0x35')](),controller[_0xf633('0x36')]);router[_0xf633('0x1e')](_0xf633('0x37'),auth[_0xf633('0xa')](),controller['addInteraction']);router[_0xf633('0x1e')](_0xf633('0x38'),auth['isAuthenticated'](),controller[_0xf633('0x39')]);router[_0xf633('0x1e')](_0xf633('0x18'),auth[_0xf633('0xa')](),controller[_0xf633('0x3a')]);router[_0xf633('0x1e')](_0xf633('0x1c'),auth[_0xf633('0xa')](),controller[_0xf633('0x3b')]);router[_0xf633('0x3c')](_0xf633('0xd'),auth['isAuthenticated'](),controller[_0xf633('0x3d')]);router[_0xf633('0x3e')](_0xf633('0xd'),auth[_0xf633('0xa')](),controller[_0xf633('0x3f')]);router[_0xf633('0x3e')](_0xf633('0x40'),auth[_0xf633('0xa')](),controller[_0xf633('0x41')]);router[_0xf633('0x3e')]('/:id/canned_answers',auth[_0xf633('0xa')](),controller['removeAnswers']);router[_0xf633('0x3e')](_0xf633('0x1c'),auth[_0xf633('0xa')](),controller[_0xf633('0x42')]);module[_0xf633('0x43')]=router; \ No newline at end of file +var _0x5b05=['%s-%s','/:id/logo','single','file','root','now','originalname','/:id/avatar','addAvatar','server/files/images/avatars/','addSystemAvatar','server/files','attachments','ensureDir','replace','extname','/:id/offline','addInteraction','addApplications','addProactiveActions','put','/:id','delete','destroy','removeAnswers','removeAgents','exports','multer','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','/:id/fields','getOfflineMessages','/:id/users','getAgents','post','addAnswer','diskStorage','join','server/files/images/logos/','format'];(function(_0x3e73f5,_0x5a53f3){var _0x8bd161=function(_0x3da42c){while(--_0x3da42c){_0x3e73f5['push'](_0x3e73f5['shift']());}};_0x8bd161(++_0x5a53f3);}(_0x5b05,0x11b));var _0x55b0=function(_0x1b1b3b,_0x20988f){_0x1b1b3b=_0x1b1b3b-0x0;var _0x195d16=_0x5b05[_0x1b1b3b];return _0x195d16;};'use strict';var multer=require(_0x55b0('0x0'));var util=require('util');var path=require(_0x55b0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x55b0('0x2'));var interaction=require(_0x55b0('0x3'));var config=require(_0x55b0('0x4'));var controller=require(_0x55b0('0x5'));router[_0x55b0('0x6')]('/',auth[_0x55b0('0x7')](),controller[_0x55b0('0x8')]);router[_0x55b0('0x6')](_0x55b0('0x9'),auth[_0x55b0('0x7')](),controller[_0x55b0('0xa')]);router[_0x55b0('0x6')]('/:id',auth[_0x55b0('0x7')](),controller[_0x55b0('0xb')]);router[_0x55b0('0x6')](_0x55b0('0xc'),auth[_0x55b0('0x7')](),controller[_0x55b0('0xd')]);router[_0x55b0('0x6')](_0x55b0('0xe'),auth[_0x55b0('0x7')](),controller[_0x55b0('0xf')]);router['get']('/:id/logo',controller[_0x55b0('0x10')]);router[_0x55b0('0x6')]('/:id/avatar',controller[_0x55b0('0x11')]);router[_0x55b0('0x6')](_0x55b0('0x12'),controller['getCustomerAvatar']);router[_0x55b0('0x6')](_0x55b0('0x13'),controller[_0x55b0('0x14')]);router[_0x55b0('0x6')](_0x55b0('0x15'),auth[_0x55b0('0x7')](),controller[_0x55b0('0x16')]);router[_0x55b0('0x6')](_0x55b0('0x17'),controller[_0x55b0('0x18')]);router[_0x55b0('0x6')](_0x55b0('0x19'),auth[_0x55b0('0x7')](),controller['getApplications']);router[_0x55b0('0x6')](_0x55b0('0x1a'),auth[_0x55b0('0x7')](),controller['getProactiveActions']);router[_0x55b0('0x6')](_0x55b0('0x1b'),controller['getFields']);router[_0x55b0('0x6')]('/:id/offline_messages',auth[_0x55b0('0x7')](),controller[_0x55b0('0x1c')]);router[_0x55b0('0x6')](_0x55b0('0x1d'),auth[_0x55b0('0x7')](),controller[_0x55b0('0x1e')]);router[_0x55b0('0x1f')]('/',auth[_0x55b0('0x7')](),controller['create']);router[_0x55b0('0x1f')](_0x55b0('0xc'),auth[_0x55b0('0x7')](),controller['addDisposition']);router[_0x55b0('0x1f')](_0x55b0('0xe'),auth[_0x55b0('0x7')](),controller[_0x55b0('0x20')]);var upload=multer({'storage':multer[_0x55b0('0x21')]({'destination':function(_0x1753b2,_0x4afa5d,_0x54d755){_0x54d755(null,path[_0x55b0('0x22')](config['root'],_0x55b0('0x23')));},'filename':function(_0x37b1b0,_0x32d641,_0x16b89d){_0x16b89d(null,util[_0x55b0('0x24')](_0x55b0('0x25'),Date['now'](),_0x32d641['originalname']));}})});router[_0x55b0('0x1f')](_0x55b0('0x26'),upload[_0x55b0('0x27')](_0x55b0('0x28')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5b271c,_0x4840e0,_0x88f3b8){_0x88f3b8(null,path['join'](config[_0x55b0('0x29')],'server/files/images/avatars/'));},'filename':function(_0x5ea240,_0x286bbf,_0x1d18f1){_0x1d18f1(null,util[_0x55b0('0x24')](_0x55b0('0x25'),Date[_0x55b0('0x2a')](),_0x286bbf[_0x55b0('0x2b')]));}})});router[_0x55b0('0x1f')](_0x55b0('0x2c'),upload[_0x55b0('0x27')](_0x55b0('0x28')),controller[_0x55b0('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1ac523,_0x239d37,_0x2a7325){_0x2a7325(null,path[_0x55b0('0x22')](config[_0x55b0('0x29')],_0x55b0('0x2e')));},'filename':function(_0x3f74b2,_0x497602,_0x4d8ae1){_0x4d8ae1(null,util['format'](_0x55b0('0x25'),Date[_0x55b0('0x2a')](),_0x497602[_0x55b0('0x2b')]));}})});router[_0x55b0('0x1f')](_0x55b0('0x12'),upload[_0x55b0('0x27')](_0x55b0('0x28')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x15bf4e,_0x1368ad,_0x2ae5f9){_0x2ae5f9(null,path[_0x55b0('0x22')](config[_0x55b0('0x29')],'server/files/images/avatars/'));},'filename':function(_0xb86071,_0x10f28d,_0x491ba2){_0x491ba2(null,util[_0x55b0('0x24')]('%s-%s',Date[_0x55b0('0x2a')](),_0x10f28d[_0x55b0('0x2b')]));}})});router[_0x55b0('0x1f')](_0x55b0('0x13'),upload[_0x55b0('0x27')](_0x55b0('0x28')),controller[_0x55b0('0x2f')]);router[_0x55b0('0x1f')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x55b0('0x21')]({'destination':function(_0x1987aa,_0x20d806,_0x3111e0){const _0x430399=path[_0x55b0('0x22')](config[_0x55b0('0x29')],_0x55b0('0x30'),_0x55b0('0x31'),'offline-chat');fs_extra[_0x55b0('0x32')](_0x430399,function(){_0x3111e0(null,_0x430399);});},'filename':function(_0xe95cfc,_0x47ec80,_0x123773){const _0x329400=_0x47ec80[_0x55b0('0x2b')][_0x55b0('0x33')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x211d51=path[_0x55b0('0x34')](_0x329400);const _0x1dc59e=Date[_0x55b0('0x2a')]()+'-'+_0x329400['replace'](_0x211d51,'')+_0x211d51;_0x123773(null,_0x1dc59e);}})});router[_0x55b0('0x1f')](_0x55b0('0x35'),offlineUploadMulter['any'](),controller['offline']);router[_0x55b0('0x1f')](_0x55b0('0x15'),auth[_0x55b0('0x7')](),controller[_0x55b0('0x36')]);router[_0x55b0('0x1f')](_0x55b0('0x19'),auth['isAuthenticated'](),controller[_0x55b0('0x37')]);router['post'](_0x55b0('0x1a'),auth[_0x55b0('0x7')](),controller[_0x55b0('0x38')]);router['post'](_0x55b0('0x1d'),auth[_0x55b0('0x7')](),controller['addAgents']);router[_0x55b0('0x39')](_0x55b0('0x3a'),auth['isAuthenticated'](),controller['update']);router[_0x55b0('0x3b')]('/:id',auth['isAuthenticated'](),controller[_0x55b0('0x3c')]);router['delete'](_0x55b0('0xc'),auth[_0x55b0('0x7')](),controller['removeDispositions']);router['delete'](_0x55b0('0xe'),auth[_0x55b0('0x7')](),controller[_0x55b0('0x3d')]);router[_0x55b0('0x3b')](_0x55b0('0x1d'),auth[_0x55b0('0x7')](),controller[_0x55b0('0x3e')]);module[_0x55b0('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 dee79b5..ea44076 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 _0x3c93=['production','app','get','Client-Side\x20logger\x20not\x20found!','/client-logs','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','env'];(function(_0x4f454d,_0x23628e){var _0x3b260=function(_0x19d6f6){while(--_0x19d6f6){_0x4f454d['push'](_0x4f454d['shift']());}};_0x3b260(++_0x23628e);}(_0x3c93,0x1c3));var _0x33c9=function(_0x2e58fe,_0x1bb5c3){_0x2e58fe=_0x2e58fe-0x0;var _0x2f297e=_0x3c93[_0x2e58fe];return _0x2f297e;};var beaverLogger=require(_0x33c9('0x0'));var express=require(_0x33c9('0x1'));var auth=require(_0x33c9('0x2'));var config=require(_0x33c9('0x3'));var router=express['Router']();var isProduction=config[_0x33c9('0x4')]===_0x33c9('0x5')||![];function clientSideLogs(_0x5bc320,_0x5e6b1b,_0x1ac6de){var _0x1d0944=_0x5bc320[_0x33c9('0x6')][_0x33c9('0x7')]('client-side-logger');if(!_0x1d0944){throw new Error(_0x33c9('0x8'));}return beaverLogger['expressEndpoint']({'uri':_0x33c9('0x9'),'logger':_0x1d0944,'enableCors':!isProduction})(_0x5bc320,_0x5e6b1b,_0x1ac6de);}router['use'](auth[_0x33c9('0xa')](),clientSideLogs);module[_0x33c9('0xb')]=router; \ No newline at end of file +var _0x7a6b=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','../components/auth/service','../config/environment','Router','app'];(function(_0x27cb81,_0x756485){var _0x4f4893=function(_0x5702a4){while(--_0x5702a4){_0x27cb81['push'](_0x27cb81['shift']());}};_0x4f4893(++_0x756485);}(_0x7a6b,0x182));var _0xb7a6=function(_0x30804b,_0x2fe8ef){_0x30804b=_0x30804b-0x0;var _0x325cc0=_0x7a6b[_0x30804b];return _0x325cc0;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0xb7a6('0x0'));var config=require(_0xb7a6('0x1'));var router=express[_0xb7a6('0x2')]();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x25695c,_0x69a002,_0x5dc809){var _0x159853=_0x25695c[_0xb7a6('0x3')]['get']('client-side-logger');if(!_0x159853){throw new Error(_0xb7a6('0x4'));}return beaverLogger[_0xb7a6('0x5')]({'uri':_0xb7a6('0x6'),'logger':_0x159853,'enableCors':!isProduction})(_0x25695c,_0x69a002,_0x5dc809);}router[_0xb7a6('0x7')](auth[_0xb7a6('0x8')](),clientSideLogs);module[_0xb7a6('0x9')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 21bea80..dd807cb 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 _0x38fc=['TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','AmazonAWS','Google','MicrosoftAzure','ENUM','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri'];(function(_0x1f8f66,_0x5dc25a){var _0x3b992d=function(_0x25dadb){while(--_0x25dadb){_0x1f8f66['push'](_0x1f8f66['shift']());}};_0x3b992d(++_0x5dc25a);}(_0x38fc,0xb7));var _0xc38f=function(_0x27e43d,_0x3841bf){_0x27e43d=_0x27e43d-0x0;var _0xaa45f2=_0x38fc[_0x27e43d];return _0xaa45f2;};'use strict';var Sequelize=require(_0xc38f('0x0'));module[_0xc38f('0x1')]={'name':{'type':Sequelize[_0xc38f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xc38f('0x3'),_0xc38f('0x4'),_0xc38f('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xc38f('0x6')](_0xc38f('0x7'),'Dynamics365')},'data1':{'type':Sequelize['STRING'],'comment':_0xc38f('0x8')},'data2':{'type':Sequelize[_0xc38f('0x2')],'comment':_0xc38f('0x9')},'data3':{'type':Sequelize['STRING'],'comment':_0xc38f('0xa')},'data4':{'type':Sequelize[_0xc38f('0x2')],'comment':_0xc38f('0xb')},'data5':{'type':Sequelize[_0xc38f('0xc')],'comment':_0xc38f('0xd')},'data6':{'type':Sequelize[_0xc38f('0xc')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xc38f('0xc')],'comment':_0xc38f('0xe')}}; \ No newline at end of file +var _0x3d29=['MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','ENUM','Google','MicrosoftAzure','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT'];(function(_0x47a802,_0x424bf1){var _0xb3badc=function(_0x5f44d3){while(--_0x5f44d3){_0x47a802['push'](_0x47a802['shift']());}};_0xb3badc(++_0x424bf1);}(_0x3d29,0xda));var _0x93d2=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x3d29[_0x38537f];return _0x141e23;};'use strict';var Sequelize=require('sequelize');module[_0x93d2('0x0')]={'name':{'type':Sequelize[_0x93d2('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x93d2('0x2')]('AmazonAWS',_0x93d2('0x3'),_0x93d2('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x93d2('0x2')]('Outlook365','Dynamics365')},'data1':{'type':Sequelize[_0x93d2('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x93d2('0x1')],'comment':_0x93d2('0x5')},'data3':{'type':Sequelize['STRING'],'comment':_0x93d2('0x6')},'data4':{'type':Sequelize['STRING'],'comment':_0x93d2('0x7')},'data5':{'type':Sequelize['TEXT'],'comment':_0x93d2('0x8')},'data6':{'type':Sequelize[_0x93d2('0x9')],'comment':_0x93d2('0xa')},'data7':{'type':Sequelize[_0x93d2('0x9')],'comment':_0x93d2('0xb')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index dd4ba99..f44b0ec 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 _0x25c3=['parse','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','microsoftAuthorization:success','emit','microsoftAuthorization:error','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','defaults','socket.io-emitter','redis','status','end','json','offset','undefined','limit','count','set','update','then','sendStatus','error','name','send','index','CloudProvider','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','MicrosoftAzure','data3','catch','show','params','keys','length','includeAll','options','service','decryptString','create','body','Name\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','find','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter'];(function(_0x292456,_0x9a9d5){var _0x2e4bfe=function(_0x3a4584){while(--_0x3a4584){_0x292456['push'](_0x292456['shift']());}};_0x2e4bfe(++_0x9a9d5);}(_0x25c3,0xd0));var _0x325c=function(_0x445908,_0x106a15){_0x445908=_0x445908-0x0;var _0x37da57=_0x25c3[_0x445908];return _0x37da57;};'use strict';var _=require(_0x325c('0x0'));var Redis=require(_0x325c('0x1'));var qs=require(_0x325c('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0x325c('0x3'));var logger=require(_0x325c('0x4'))(_0x325c('0x5'));var db=require(_0x325c('0x6'))['db'];var oauth=require(_0x325c('0x7'));config['redis']=_[_0x325c('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x325c('0x9'))(new Redis(config[_0x325c('0xa')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x3d0af6,_0x20fe50){_0x20fe50=_0x20fe50||0xcc;return function(_0xe4b9a5){if(_0xe4b9a5){return _0x3d0af6['sendStatus'](_0x20fe50);}return _0x3d0af6[_0x325c('0xb')](_0x20fe50)[_0x325c('0xc')]();};}function respondWithResult(_0x316aac,_0xee9709){_0xee9709=_0xee9709||0xc8;return function(_0x10a55d){if(_0x10a55d){return _0x316aac[_0x325c('0xb')](_0xee9709)[_0x325c('0xd')](_0x10a55d);}};}function respondWithFilteredResult(_0x5e1d44,_0x39b41e){return function(_0x874b7c){if(_0x874b7c){var _0x3959f9=typeof _0x39b41e[_0x325c('0xe')]===_0x325c('0xf')&&typeof _0x39b41e[_0x325c('0x10')]===_0x325c('0xf');var _0x22ab65=_0x874b7c[_0x325c('0x11')];var _0x2da61a=_0x3959f9?0x0:_0x39b41e[_0x325c('0xe')];var _0x2f3b80=_0x3959f9?_0x874b7c[_0x325c('0x11')]:_0x39b41e[_0x325c('0xe')]+_0x39b41e[_0x325c('0x10')];var _0x212291;if(_0x2f3b80>=_0x22ab65){_0x2f3b80=_0x22ab65;_0x212291=0xc8;}else{_0x212291=0xce;}_0x5e1d44[_0x325c('0xb')](_0x212291);return _0x5e1d44[_0x325c('0x12')]('Content-Range',_0x2da61a+'-'+_0x2f3b80+'/'+_0x22ab65)[_0x325c('0xd')](_0x874b7c);}return null;};}function saveUpdates(_0x47b12f){return function(_0x4be8ec){if(_0x4be8ec){return _0x4be8ec[_0x325c('0x13')](_0x47b12f)[_0x325c('0x14')](function(_0x54d2d4){return _0x54d2d4;});}return null;};}function removeEntity(_0xda5727){return function(_0x4b07d3){if(_0x4b07d3){return _0x4b07d3['destroy']()[_0x325c('0x14')](function(){_0xda5727[_0x325c('0xb')](0xcc)[_0x325c('0xc')]();});}};}function handleEntityNotFound(_0x372155){return function(_0xb1f22f){if(!_0xb1f22f){_0x372155[_0x325c('0x15')](0x194);}return _0xb1f22f;};}function handleError(_0x3de9fa,_0x5dfbde){_0x5dfbde=_0x5dfbde||0x1f4;return function(_0x396e7c){logger[_0x325c('0x16')](_0x396e7c['stack']);if(_0x396e7c[_0x325c('0x17')]){delete _0x396e7c[_0x325c('0x17')];}_0x3de9fa[_0x325c('0xb')](_0x5dfbde)[_0x325c('0x18')](_0x396e7c);};}function maskClientSecret(_0x3c458f){return _['padEnd'](_0x3c458f['slice'](0x0,0x3),0x14,'*');}exports[_0x325c('0x19')]=function(_0x326d69,_0x5a741b){var _0x3d28a5={},_0x184841={},_0x599936={'count':0x0,'rows':[]};var _0x5777eb=_['map'](db[_0x325c('0x1a')][_0x325c('0x1b')],function(_0x40485c){return{'name':_0x40485c[_0x325c('0x1c')],'type':_0x40485c['type'][_0x325c('0x1d')]};});_0x184841[_0x325c('0x1e')]=_[_0x325c('0x1f')](_0x5777eb,_0x325c('0x17'));_0x184841[_0x325c('0x20')]=_['keys'](_0x326d69[_0x325c('0x20')]);_0x184841[_0x325c('0x21')]=_[_0x325c('0x22')](_0x184841[_0x325c('0x1e')],_0x184841['query']);_0x3d28a5['attributes']=_[_0x325c('0x22')](_0x184841[_0x325c('0x1e')],qs[_0x325c('0x23')](_0x326d69[_0x325c('0x20')]['fields']));_0x3d28a5['attributes']=_0x3d28a5['attributes']['length']?_0x3d28a5[_0x325c('0x24')]:_0x184841[_0x325c('0x1e')];if(!_0x326d69[_0x325c('0x20')]['hasOwnProperty']('nolimit')){_0x3d28a5[_0x325c('0x10')]=qs['limit'](_0x326d69['query']['limit']);_0x3d28a5[_0x325c('0xe')]=qs[_0x325c('0xe')](_0x326d69[_0x325c('0x20')][_0x325c('0xe')]);}_0x3d28a5[_0x325c('0x25')]=qs[_0x325c('0x26')](_0x326d69[_0x325c('0x20')]['sort']);_0x3d28a5[_0x325c('0x27')]=qs[_0x325c('0x21')](_[_0x325c('0x28')](_0x326d69['query'],_0x184841['filters']),_0x5777eb);if(_0x326d69[_0x325c('0x20')][_0x325c('0x29')]){_0x3d28a5[_0x325c('0x27')]=_[_0x325c('0x2a')](_0x3d28a5['where'],{'$or':_[_0x325c('0x1f')](_0x5777eb,function(_0x1449b8){if(_0x1449b8[_0x325c('0x2b')]!==_0x325c('0x2c')){var _0x4313ff={};_0x4313ff[_0x1449b8[_0x325c('0x17')]]={'$like':'%'+_0x326d69['query'][_0x325c('0x29')]+'%'};return _0x4313ff;}})});}_0x3d28a5=_[_0x325c('0x2a')]({},_0x3d28a5,_0x326d69['options']);var _0x676cfe={'where':_0x3d28a5[_0x325c('0x27')]};return db[_0x325c('0x1a')][_0x325c('0x11')](_0x676cfe)[_0x325c('0x14')](function(_0x4c4c1c){_0x599936[_0x325c('0x11')]=_0x4c4c1c;if(_0x326d69['query']['includeAll']){_0x3d28a5[_0x325c('0x2d')]=[{'all':!![]}];}return db[_0x325c('0x1a')][_0x325c('0x2e')](_0x3d28a5);})['then'](function(_0x2b6c3a){_0x599936[_0x325c('0x2f')]=_['map'](_0x2b6c3a,function(_0x3b259e){if(_0x3b259e['service']===_0x325c('0x30')){var _0x1cb6f0=encryptor['decryptString'](_0x3b259e[_0x325c('0x31')]);_0x3b259e[_0x325c('0x31')]=maskClientSecret(_0x1cb6f0);}return _0x3b259e;});return _0x599936;})[_0x325c('0x14')](respondWithFilteredResult(_0x5a741b,_0x3d28a5))[_0x325c('0x32')](handleError(_0x5a741b,null));};exports[_0x325c('0x33')]=function(_0x15fe82,_0x561080){var _0x48f9c3={'raw':!![],'where':{'id':_0x15fe82[_0x325c('0x34')]['id']}},_0x45b72b={};_0x45b72b[_0x325c('0x1e')]=_['keys'](db[_0x325c('0x1a')][_0x325c('0x1b')]);_0x45b72b[_0x325c('0x20')]=_[_0x325c('0x35')](_0x15fe82[_0x325c('0x20')]);_0x45b72b['filters']=_[_0x325c('0x22')](_0x45b72b[_0x325c('0x1e')],_0x45b72b[_0x325c('0x20')]);_0x48f9c3['attributes']=_[_0x325c('0x22')](_0x45b72b[_0x325c('0x1e')],qs[_0x325c('0x23')](_0x15fe82[_0x325c('0x20')][_0x325c('0x23')]));_0x48f9c3[_0x325c('0x24')]=_0x48f9c3[_0x325c('0x24')][_0x325c('0x36')]?_0x48f9c3[_0x325c('0x24')]:_0x45b72b[_0x325c('0x1e')];if(_0x15fe82[_0x325c('0x20')][_0x325c('0x37')]){_0x48f9c3[_0x325c('0x2d')]=[{'all':!![]}];}_0x48f9c3=_[_0x325c('0x2a')]({},_0x48f9c3,_0x15fe82[_0x325c('0x38')]);return db[_0x325c('0x1a')]['find'](_0x48f9c3)['then'](handleEntityNotFound(_0x561080,null))[_0x325c('0x14')](function(_0xa4f6b5){if(_0xa4f6b5[_0x325c('0x39')]===_0x325c('0x30')){var _0x5def82=encryptor[_0x325c('0x3a')](_0xa4f6b5[_0x325c('0x31')]);_0xa4f6b5[_0x325c('0x31')]=maskClientSecret(_0x5def82);}return _0xa4f6b5;})[_0x325c('0x14')](respondWithResult(_0x561080,null))[_0x325c('0x32')](handleError(_0x561080,null));};exports[_0x325c('0x3b')]=function(_0x2f4d7e,_0x5b9a09){if(!_0x2f4d7e[_0x325c('0x3c')][_0x325c('0x17')])throw new Error(_0x325c('0x3d'));if(!_0x2f4d7e['body'][_0x325c('0x39')])throw new Error('Service\x20parameter\x20not\x20specified');var _0xde6da0=db[_0x325c('0x1a')][_0x325c('0x1b')][_0x325c('0x39')][_0x325c('0x3e')];if(!_0xde6da0[_0x325c('0x3f')](_0x2f4d7e['body'][_0x325c('0x39')]))throw new Error(_0x325c('0x40')+_0xde6da0[_0x325c('0x41')](',\x20'));if(_0x2f4d7e[_0x325c('0x3c')][_0x325c('0x39')]===_0x325c('0x30')&&_0x2f4d7e[_0x325c('0x3c')]['data3']){_0x2f4d7e[_0x325c('0x3c')][_0x325c('0x31')]=encryptor[_0x325c('0x42')](_0x2f4d7e['body'][_0x325c('0x31')]);}return db[_0x325c('0x1a')]['create'](_0x2f4d7e[_0x325c('0x3c')],{})[_0x325c('0x14')](respondWithResult(_0x5b9a09,0xc9))['catch'](handleError(_0x5b9a09,null));};exports[_0x325c('0x13')]=function(_0x347958,_0x1a1489){if(_0x347958[_0x325c('0x3c')]['id']){delete _0x347958[_0x325c('0x3c')]['id'];}return db['CloudProvider'][_0x325c('0x43')]({'where':{'id':_0x347958[_0x325c('0x34')]['id']}})['then'](handleEntityNotFound(_0x1a1489,null))[_0x325c('0x14')](function(_0x2f9ead){if(_0x2f9ead[_0x325c('0x39')]===_0x325c('0x30')&&_0x347958[_0x325c('0x3c')][_0x325c('0x31')]){_0x347958[_0x325c('0x3c')][_0x325c('0x31')]=encryptor[_0x325c('0x42')](_0x347958['body'][_0x325c('0x31')]);}return _0x2f9ead;})[_0x325c('0x14')](saveUpdates(_0x347958['body'],null))[_0x325c('0x14')](respondWithResult(_0x1a1489,null))[_0x325c('0x32')](handleError(_0x1a1489,null));};exports['destroy']=function(_0x3cc348,_0x714bbd){return db['CloudProvider'][_0x325c('0x43')]({'where':{'id':_0x3cc348['params']['id']}})[_0x325c('0x14')](handleEntityNotFound(_0x714bbd,null))[_0x325c('0x14')](removeEntity(_0x714bbd,null))[_0x325c('0x32')](handleError(_0x714bbd,null));};exports['oauth2MicrosoftAuthorize']=function(_0x44ce46,_0x472666){return db['CloudProvider'][_0x325c('0x44')]({'where':{'id':_0x44ce46[_0x325c('0x34')]['id']},'raw':!![]})['then'](function(_0x183d75){if(!_0x183d75)return _0x472666['sendStatus'](0x194);return{'url':oauth[_0x325c('0x45')](_0x183d75,_0x44ce46[_0x325c('0x46')]['id'])};})[_0x325c('0x14')](respondWithResult(_0x472666,null))[_0x325c('0x32')](handleError(_0x472666,null));};exports[_0x325c('0x47')]=function(_0x46f619,_0xa4933c){var _0x518396=_0x46f619['body'];var _0x519c27;var _0x3b5fa7;if(_0x518396[_0x325c('0x16')])throw _0x518396;redis['get'](_0x518396[_0x325c('0x48')])[_0x325c('0x14')](function(_0x1289c1){if(!_0x1289c1)throw new Error(_0x325c('0x49'));_0x519c27=JSON[_0x325c('0x4a')](_0x1289c1);var _0x5e31ff=Buffer['from'](_0x518396[_0x325c('0x48')],_0x325c('0x4b'))[_0x325c('0x4c')](_0x325c('0x4d'));_0x3b5fa7=JSON[_0x325c('0x4a')](_0x5e31ff);if(!oauth[_0x325c('0x4e')](_0x518396[_0x325c('0x4f')],_0x519c27[_0x325c('0x50')]))throw new Error(_0x325c('0x51'));redis[_0x325c('0x52')](_0x518396[_0x325c('0x48')]);return oauth[_0x325c('0x53')](_0x518396[_0x325c('0x54')],_0x519c27);})[_0x325c('0x14')](function(_0x266a25){_0x519c27[_0x325c('0x55')]=_0x266a25[_0x325c('0x56')];_0x519c27[_0x325c('0x57')]=_0x266a25[_0x325c('0x58')];return db[_0x325c('0x1a')][_0x325c('0x13')]({'data5':_0x519c27[_0x325c('0x55')],'data6':_0x519c27[_0x325c('0x57')]},{'where':{'id':_0x519c27['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x519c27);socket['emit'](_0x325c('0x59'),{'id':_0x3b5fa7['id']});return;})[_0x325c('0x14')](respondWithStatusCode(_0xa4933c,null))[_0x325c('0x32')](function(_0x1b5de5){if(_0x3b5fa7){socket[_0x325c('0x5a')](_0x325c('0x5b'),{'id':_0x3b5fa7['id']});}if(!_0x519c27){logger[_0x325c('0x16')]('Invalid\x20authentication\x20state\x20parameter',_0x1b5de5);return _0xa4933c[_0x325c('0xb')](0x1f4)[_0x325c('0x18')](_0x1b5de5['message']);}logger['error'](_0x325c('0x5c'),_0x519c27['id'],JSON[_0x325c('0x5d')](_0x1b5de5));});}; \ No newline at end of file +var _0x224f=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','MicrosoftAzure','decryptString','data3','catch','show','params','options','find','service','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','update','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','get','state','Invalid\x20state\x20parameter','from','base64','toString','ascii','parse','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','../../mysqldb','./cloudProvider.oauth','defaults','redis','localhost','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','then','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x224f,0x1da));var _0xf224=function(_0x4cee4b,_0x1dfff3){_0x4cee4b=_0x4cee4b-0x0;var _0x4d891d=_0x224f[_0x4cee4b];return _0x4d891d;};'use strict';var _=require('lodash');var Redis=require(_0xf224('0x0'));var qs=require(_0xf224('0x1'));var encryptor=require(_0xf224('0x2'));var config=require('../../config/environment');var logger=require(_0xf224('0x3'))('api');var db=require(_0xf224('0x4'))['db'];var oauth=require(_0xf224('0x5'));config['redis']=_[_0xf224('0x6')](config[_0xf224('0x7')],{'host':_0xf224('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf224('0x7')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x26f1ed,_0x4383e){_0x4383e=_0x4383e||0xcc;return function(_0x50f9a2){if(_0x50f9a2){return _0x26f1ed[_0xf224('0x9')](_0x4383e);}return _0x26f1ed[_0xf224('0xa')](_0x4383e)[_0xf224('0xb')]();};}function respondWithResult(_0x26184b,_0x1eea4a){_0x1eea4a=_0x1eea4a||0xc8;return function(_0x334bdd){if(_0x334bdd){return _0x26184b[_0xf224('0xa')](_0x1eea4a)[_0xf224('0xc')](_0x334bdd);}};}function respondWithFilteredResult(_0x4f9c0c,_0xaa57ee){return function(_0x3a1a44){if(_0x3a1a44){var _0xb7fb8=typeof _0xaa57ee[_0xf224('0xd')]===_0xf224('0xe')&&typeof _0xaa57ee[_0xf224('0xf')]===_0xf224('0xe');var _0x11a59c=_0x3a1a44[_0xf224('0x10')];var _0x45d9c7=_0xb7fb8?0x0:_0xaa57ee[_0xf224('0xd')];var _0x351be9=_0xb7fb8?_0x3a1a44[_0xf224('0x10')]:_0xaa57ee[_0xf224('0xd')]+_0xaa57ee[_0xf224('0xf')];var _0x1a291a;if(_0x351be9>=_0x11a59c){_0x351be9=_0x11a59c;_0x1a291a=0xc8;}else{_0x1a291a=0xce;}_0x4f9c0c[_0xf224('0xa')](_0x1a291a);return _0x4f9c0c[_0xf224('0x11')]('Content-Range',_0x45d9c7+'-'+_0x351be9+'/'+_0x11a59c)[_0xf224('0xc')](_0x3a1a44);}return null;};}function saveUpdates(_0x1a1ccc){return function(_0xd0189b){if(_0xd0189b){return _0xd0189b['update'](_0x1a1ccc)['then'](function(_0x954cca){return _0x954cca;});}return null;};}function removeEntity(_0x114eb4){return function(_0x19313c){if(_0x19313c){return _0x19313c[_0xf224('0x12')]()[_0xf224('0x13')](function(){_0x114eb4[_0xf224('0xa')](0xcc)[_0xf224('0xb')]();});}};}function handleEntityNotFound(_0xb16786){return function(_0x4bda23){if(!_0x4bda23){_0xb16786[_0xf224('0x9')](0x194);}return _0x4bda23;};}function handleError(_0x18bf29,_0x472844){_0x472844=_0x472844||0x1f4;return function(_0x27c0e9){logger[_0xf224('0x14')](_0x27c0e9[_0xf224('0x15')]);if(_0x27c0e9[_0xf224('0x16')]){delete _0x27c0e9[_0xf224('0x16')];}_0x18bf29[_0xf224('0xa')](_0x472844)[_0xf224('0x17')](_0x27c0e9);};}function maskClientSecret(_0x4ff754){return _[_0xf224('0x18')](_0x4ff754[_0xf224('0x19')](0x0,0x3),0x14,'*');}exports[_0xf224('0x1a')]=function(_0x256176,_0xebb29a){var _0x18148d={},_0xf234da={},_0xe69582={'count':0x0,'rows':[]};var _0xe1b0ca=_[_0xf224('0x1b')](db[_0xf224('0x1c')][_0xf224('0x1d')],function(_0x364f31){return{'name':_0x364f31[_0xf224('0x1e')],'type':_0x364f31[_0xf224('0x1f')][_0xf224('0x20')]};});_0xf234da['model']=_[_0xf224('0x1b')](_0xe1b0ca,'name');_0xf234da[_0xf224('0x21')]=_[_0xf224('0x22')](_0x256176[_0xf224('0x21')]);_0xf234da[_0xf224('0x23')]=_[_0xf224('0x24')](_0xf234da[_0xf224('0x25')],_0xf234da['query']);_0x18148d['attributes']=_['intersection'](_0xf234da[_0xf224('0x25')],qs[_0xf224('0x26')](_0x256176[_0xf224('0x21')][_0xf224('0x26')]));_0x18148d[_0xf224('0x27')]=_0x18148d['attributes'][_0xf224('0x28')]?_0x18148d[_0xf224('0x27')]:_0xf234da['model'];if(!_0x256176[_0xf224('0x21')][_0xf224('0x29')](_0xf224('0x2a'))){_0x18148d[_0xf224('0xf')]=qs[_0xf224('0xf')](_0x256176[_0xf224('0x21')][_0xf224('0xf')]);_0x18148d[_0xf224('0xd')]=qs[_0xf224('0xd')](_0x256176[_0xf224('0x21')][_0xf224('0xd')]);}_0x18148d[_0xf224('0x2b')]=qs['sort'](_0x256176['query'][_0xf224('0x2c')]);_0x18148d[_0xf224('0x2d')]=qs[_0xf224('0x23')](_[_0xf224('0x2e')](_0x256176[_0xf224('0x21')],_0xf234da[_0xf224('0x23')]),_0xe1b0ca);if(_0x256176[_0xf224('0x21')][_0xf224('0x2f')]){_0x18148d['where']=_[_0xf224('0x30')](_0x18148d['where'],{'$or':_[_0xf224('0x1b')](_0xe1b0ca,function(_0xa9bd86){if(_0xa9bd86[_0xf224('0x1f')]!==_0xf224('0x31')){var _0x37e242={};_0x37e242[_0xa9bd86[_0xf224('0x16')]]={'$like':'%'+_0x256176[_0xf224('0x21')]['filter']+'%'};return _0x37e242;}})});}_0x18148d=_['merge']({},_0x18148d,_0x256176['options']);var _0x288e93={'where':_0x18148d[_0xf224('0x2d')]};return db[_0xf224('0x1c')][_0xf224('0x10')](_0x288e93)['then'](function(_0x1f82d4){_0xe69582[_0xf224('0x10')]=_0x1f82d4;if(_0x256176['query'][_0xf224('0x32')]){_0x18148d[_0xf224('0x33')]=[{'all':!![]}];}return db[_0xf224('0x1c')][_0xf224('0x34')](_0x18148d);})[_0xf224('0x13')](function(_0x4951d2){_0xe69582[_0xf224('0x35')]=_[_0xf224('0x1b')](_0x4951d2,function(_0x47a14a){if(_0x47a14a['service']===_0xf224('0x36')){var _0x5080cf=encryptor[_0xf224('0x37')](_0x47a14a[_0xf224('0x38')]);_0x47a14a[_0xf224('0x38')]=maskClientSecret(_0x5080cf);}return _0x47a14a;});return _0xe69582;})[_0xf224('0x13')](respondWithFilteredResult(_0xebb29a,_0x18148d))[_0xf224('0x39')](handleError(_0xebb29a,null));};exports[_0xf224('0x3a')]=function(_0x1f6506,_0x333f41){var _0x4a5808={'raw':!![],'where':{'id':_0x1f6506[_0xf224('0x3b')]['id']}},_0x3a5920={};_0x3a5920['model']=_[_0xf224('0x22')](db[_0xf224('0x1c')][_0xf224('0x1d')]);_0x3a5920[_0xf224('0x21')]=_[_0xf224('0x22')](_0x1f6506['query']);_0x3a5920[_0xf224('0x23')]=_[_0xf224('0x24')](_0x3a5920[_0xf224('0x25')],_0x3a5920[_0xf224('0x21')]);_0x4a5808[_0xf224('0x27')]=_[_0xf224('0x24')](_0x3a5920[_0xf224('0x25')],qs[_0xf224('0x26')](_0x1f6506['query']['fields']));_0x4a5808[_0xf224('0x27')]=_0x4a5808['attributes'][_0xf224('0x28')]?_0x4a5808['attributes']:_0x3a5920[_0xf224('0x25')];if(_0x1f6506[_0xf224('0x21')][_0xf224('0x32')]){_0x4a5808['include']=[{'all':!![]}];}_0x4a5808=_[_0xf224('0x30')]({},_0x4a5808,_0x1f6506[_0xf224('0x3c')]);return db[_0xf224('0x1c')][_0xf224('0x3d')](_0x4a5808)[_0xf224('0x13')](handleEntityNotFound(_0x333f41,null))[_0xf224('0x13')](function(_0xa01960){if(_0xa01960[_0xf224('0x3e')]===_0xf224('0x36')){var _0x32e995=encryptor[_0xf224('0x37')](_0xa01960['data3']);_0xa01960[_0xf224('0x38')]=maskClientSecret(_0x32e995);}return _0xa01960;})[_0xf224('0x13')](respondWithResult(_0x333f41,null))['catch'](handleError(_0x333f41,null));};exports[_0xf224('0x3f')]=function(_0x103692,_0x38d7d5){if(!_0x103692[_0xf224('0x40')][_0xf224('0x16')])throw new Error(_0xf224('0x41'));if(!_0x103692['body']['service'])throw new Error(_0xf224('0x42'));var _0x72f5bb=db[_0xf224('0x1c')]['rawAttributes'][_0xf224('0x3e')][_0xf224('0x43')];if(!_0x72f5bb[_0xf224('0x44')](_0x103692[_0xf224('0x40')][_0xf224('0x3e')]))throw new Error(_0xf224('0x45')+_0x72f5bb[_0xf224('0x46')](',\x20'));if(_0x103692['body']['service']===_0xf224('0x36')&&_0x103692['body'][_0xf224('0x38')]){_0x103692[_0xf224('0x40')][_0xf224('0x38')]=encryptor[_0xf224('0x47')](_0x103692[_0xf224('0x40')][_0xf224('0x38')]);}return db['CloudProvider']['create'](_0x103692[_0xf224('0x40')],{})[_0xf224('0x13')](respondWithResult(_0x38d7d5,0xc9))[_0xf224('0x39')](handleError(_0x38d7d5,null));};exports[_0xf224('0x48')]=function(_0x13d9f3,_0x407a73){if(_0x13d9f3['body']['id']){delete _0x13d9f3['body']['id'];}return db[_0xf224('0x1c')][_0xf224('0x3d')]({'where':{'id':_0x13d9f3[_0xf224('0x3b')]['id']}})[_0xf224('0x13')](handleEntityNotFound(_0x407a73,null))[_0xf224('0x13')](function(_0x389ba6){if(_0x389ba6[_0xf224('0x3e')]==='MicrosoftAzure'&&_0x13d9f3['body'][_0xf224('0x38')]){_0x13d9f3[_0xf224('0x40')][_0xf224('0x38')]=encryptor[_0xf224('0x47')](_0x13d9f3[_0xf224('0x40')][_0xf224('0x38')]);}return _0x389ba6;})[_0xf224('0x13')](saveUpdates(_0x13d9f3[_0xf224('0x40')],null))['then'](respondWithResult(_0x407a73,null))['catch'](handleError(_0x407a73,null));};exports[_0xf224('0x12')]=function(_0x24469a,_0x46b314){return db['CloudProvider'][_0xf224('0x3d')]({'where':{'id':_0x24469a[_0xf224('0x3b')]['id']}})[_0xf224('0x13')](handleEntityNotFound(_0x46b314,null))[_0xf224('0x13')](removeEntity(_0x46b314,null))[_0xf224('0x39')](handleError(_0x46b314,null));};exports[_0xf224('0x49')]=function(_0x169de8,_0x23d2b1){return db[_0xf224('0x1c')][_0xf224('0x4a')]({'where':{'id':_0x169de8[_0xf224('0x3b')]['id']},'raw':!![]})[_0xf224('0x13')](function(_0x36ef83){if(!_0x36ef83)return _0x23d2b1[_0xf224('0x9')](0x194);return{'url':oauth[_0xf224('0x4b')](_0x36ef83,_0x169de8[_0xf224('0x4c')]['id'])};})[_0xf224('0x13')](respondWithResult(_0x23d2b1,null))[_0xf224('0x39')](handleError(_0x23d2b1,null));};exports['oauth2MicrosoftCallback']=function(_0x22a89f,_0x425bea){var _0x302611=_0x22a89f[_0xf224('0x40')];var _0xb9ca27;var _0xcfb4f4;if(_0x302611[_0xf224('0x14')])throw _0x302611;redis[_0xf224('0x4d')](_0x302611[_0xf224('0x4e')])[_0xf224('0x13')](function(_0x5ee013){if(!_0x5ee013)throw new Error(_0xf224('0x4f'));_0xb9ca27=JSON['parse'](_0x5ee013);var _0x21767d=Buffer[_0xf224('0x50')](_0x302611[_0xf224('0x4e')],_0xf224('0x51'))[_0xf224('0x52')](_0xf224('0x53'));_0xcfb4f4=JSON[_0xf224('0x54')](_0x21767d);if(!oauth[_0xf224('0x55')](_0x302611[_0xf224('0x56')],_0xb9ca27[_0xf224('0x57')]))throw new Error(_0xf224('0x58'));redis[_0xf224('0x59')](_0x302611['state']);return oauth[_0xf224('0x5a')](_0x302611[_0xf224('0x5b')],_0xb9ca27);})[_0xf224('0x13')](function(_0x665637){_0xb9ca27[_0xf224('0x5c')]=_0x665637[_0xf224('0x5d')];_0xb9ca27['data6']=_0x665637[_0xf224('0x5e')];return db[_0xf224('0x1c')][_0xf224('0x48')]({'data5':_0xb9ca27[_0xf224('0x5c')],'data6':_0xb9ca27['data6']},{'where':{'id':_0xb9ca27['id']}});})[_0xf224('0x13')](function(){oauth[_0xf224('0x5f')](_0xb9ca27);socket[_0xf224('0x60')](_0xf224('0x61'),{'id':_0xcfb4f4['id']});return;})[_0xf224('0x13')](respondWithStatusCode(_0x425bea,null))[_0xf224('0x39')](function(_0x58a1e3){if(_0xcfb4f4){socket[_0xf224('0x60')](_0xf224('0x62'),{'id':_0xcfb4f4['id']});}if(!_0xb9ca27){logger[_0xf224('0x14')](_0xf224('0x63'),_0x58a1e3);return _0x425bea[_0xf224('0xa')](0x1f4)[_0xf224('0x17')](_0x58a1e3[_0xf224('0x64')]);}logger[_0xf224('0x14')](_0xf224('0x65'),_0xb9ca27['id'],JSON['stringify'](_0x58a1e3));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 1e26266..ea852af 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 _0x096a=['../../config/environment','./cloudProvider.attributes','exports','cloud_providers','lodash','../../config/logger','api','bluebird','path','rimraf'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x096a,0x1b2));var _0xa096=function(_0x51235c,_0x310731){_0x51235c=_0x51235c-0x0;var _0x43d852=_0x096a[_0x51235c];return _0x43d852;};'use strict';var _=require(_0xa096('0x0'));var util=require('util');var logger=require(_0xa096('0x1'))(_0xa096('0x2'));var moment=require('moment');var BPromise=require(_0xa096('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa096('0x4'));var rimraf=require(_0xa096('0x5'));var config=require(_0xa096('0x6'));var attributes=require(_0xa096('0x7'));module[_0xa096('0x8')]=function(_0x14f3c1,_0x5a9350){return _0x14f3c1['define']('CloudProvider',attributes,{'tableName':_0xa096('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcddc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','lodash','util','../../config/logger','api'];(function(_0x50aecd,_0x3afbf1){var _0x21321d=function(_0x12b40c){while(--_0x12b40c){_0x50aecd['push'](_0x50aecd['shift']());}};_0x21321d(++_0x3afbf1);}(_0xcddc,0x130));var _0xccdd=function(_0x6b910b,_0x38ce8f){_0x6b910b=_0x6b910b-0x0;var _0x3408a7=_0xcddc[_0x6b910b];return _0x3408a7;};'use strict';var _=require(_0xccdd('0x0'));var util=require(_0xccdd('0x1'));var logger=require(_0xccdd('0x2'))(_0xccdd('0x3'));var moment=require(_0xccdd('0x4'));var BPromise=require(_0xccdd('0x5'));var rp=require(_0xccdd('0x6'));var fs=require('fs');var path=require(_0xccdd('0x7'));var rimraf=require(_0xccdd('0x8'));var config=require(_0xccdd('0x9'));var attributes=require(_0xccdd('0xa'));module['exports']=function(_0x1ff323,_0x5e5daa){return _0x1ff323['define']('CloudProvider',attributes,{'tableName':'cloud_providers','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 e00e158..0fc07d9 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 _0xb222=['util','../../config/logger','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','offline_access','/authorize','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','id_token','from','stringify','toString','base64','hex','client_id','response_type','redirect_uri','data4','response_mode','form_post','scope','nonce','prompt','login','key','value','oauth2/','data1','set','decode','payload','iss','issuer','aud','audience','isAfter','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','access_token','update','catch','error','authorization_code','intervals','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise'];(function(_0x9f27ef,_0xf53771){var _0x5ed282=function(_0x1fb91a){while(--_0x1fb91a){_0x9f27ef['push'](_0x9f27ef['shift']());}};_0x5ed282(++_0xf53771);}(_0xb222,0xe4));var _0x2b22=function(_0x1707af,_0x17ab07){_0x1707af=_0x1707af-0x0;var _0x44b17c=_0xb222[_0x1707af];return _0x44b17c;};'use strict';var _=require(_0x2b22('0x0'));var crypto=require(_0x2b22('0x1'));var jwt=require(_0x2b22('0x2'));var moment=require(_0x2b22('0x3'));var Redis=require(_0x2b22('0x4'));var rp=require(_0x2b22('0x5'));var util=require(_0x2b22('0x6'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x2b22('0x7'))('api');var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x2b22('0x8'))['db'];config[_0x2b22('0x9')]=_[_0x2b22('0xa')](config[_0x2b22('0x9')],{'host':_0x2b22('0xb'),'port':0x18eb});var redis=new Redis(config[_0x2b22('0x9')]);var MICROSOFT_AUTH_URL=_0x2b22('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x2b22('0xd'),_0x2b22('0xe'),_0x2b22('0xf'),'offline_access',_0x2b22('0x10'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x2b22('0xd'),_0x2b22('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0x2b22('0x12');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2d878d){var _0x4d5bcc=_[_0x2b22('0x13')](AZURE_AUTH_SCOPES[_0x2d878d[_0x2b22('0x14')]]);if(_0x2d878d[_0x2b22('0x14')]===_0x2b22('0x15'))_0x4d5bcc[_0x2b22('0x16')](_0x2d878d[_0x2b22('0x17')]+_0x2b22('0x18'));return _0x4d5bcc[_0x2b22('0x19')]('\x20');}function getAccessTokenScope(_0x12b246){if(_0x12b246[_0x2b22('0x14')]===_0x2b22('0x1a'))return _0x2b22('0x10');if(_0x12b246['type']===_0x2b22('0x15'))return _0x12b246[_0x2b22('0x17')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x2dad0e,_0x4cb62e){var _0x2cc364=MICROSOFT_AUTH_URL[_0x2b22('0x1b')](_0x2b22('0x1c'),_0x2dad0e[_0x2b22('0x1d')]);var _0x517fe3=['code',_0x2b22('0x1e')];var _0x1f85ba=Buffer[_0x2b22('0x1f')](JSON[_0x2b22('0x20')]({'id':_0x4cb62e}))[_0x2b22('0x21')](_0x2b22('0x22'));var _0x2e9040=crypto['randomBytes'](0x10)[_0x2b22('0x21')](_0x2b22('0x23'));var _0x4c5c4d=getAuthorizationScopes(_0x2dad0e);var _0x306f49=[{'key':_0x2b22('0x24'),'value':_0x2dad0e['data1']},{'key':_0x2b22('0x25'),'value':encodeURIComponent(_0x517fe3[_0x2b22('0x19')]('\x20'))},{'key':_0x2b22('0x26'),'value':_0x2dad0e[_0x2b22('0x27')]},{'key':_0x2b22('0x28'),'value':_0x2b22('0x29')},{'key':_0x2b22('0x2a'),'value':encodeURIComponent(_0x4c5c4d)},{'key':'state','value':_0x1f85ba},{'key':_0x2b22('0x2b'),'value':_0x2e9040},{'key':_0x2b22('0x2c'),'value':_0x2b22('0x2d')}];var _0x53d5c9=_0x2cc364+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x2b22('0x13')](_0x306f49,function(_0x4e07ec){return _0x4e07ec[_0x2b22('0x2e')]+'='+_0x4e07ec[_0x2b22('0x2f')];})[_0x2b22('0x19')]('&');_0x2dad0e['oauth2Claims']={'issuer':_0x2cc364['replace'](_0x2b22('0x30'),''),'audience':_0x2dad0e[_0x2b22('0x31')],'state':_0x1f85ba,'nonce':_0x2e9040};redis[_0x2b22('0x32')](_0x1f85ba,JSON[_0x2b22('0x20')](_0x2dad0e));return _0x53d5c9;}function isValidIdToken(_0x38f73e,_0x499db2){try{var _0x47a939=jwt[_0x2b22('0x33')](_0x38f73e,{'complete':!![]});var _0x19dc22=_0x47a939[_0x2b22('0x34')];if(_0x19dc22[_0x2b22('0x35')]!==_0x499db2[_0x2b22('0x36')])return![];if(_0x19dc22[_0x2b22('0x37')]!==_0x499db2[_0x2b22('0x38')])return![];if(_0x19dc22[_0x2b22('0x2b')]!==_0x499db2['nonce'])return![];if(moment()[_0x2b22('0x39')](moment['unix'](_0x19dc22[_0x2b22('0x3a')])))return![];return!![];}catch(_0x533d3a){throw _0x533d3a;}}function refreshOauth2MicrosoftAccessToken(_0xf08860){return Promise[_0x2b22('0x3b')]()[_0x2b22('0x3c')](function(){if(_0xf08860[_0x2b22('0x3d')])return _0xf08860;return db[_0x2b22('0x3e')][_0x2b22('0x3f')]({'where':{'id':_0xf08860['id']},'raw':!![]});})[_0x2b22('0x3c')](function(_0x12ab20){var _0xf45e62={'grant_type':_0x2b22('0x40'),'refresh_token':_0x12ab20[_0x2b22('0x41')],'scope':getAccessTokenScope(_0x12ab20),'redirect_uri':_0x12ab20[_0x2b22('0x27')],'client_id':_0x12ab20['data1'],'client_secret':encryptor[_0x2b22('0x42')](_0x12ab20[_0x2b22('0x3d')])};var _0x1b41f5={'method':_0x2b22('0x43'),'uri':MICROSOFT_AUTH_URL[_0x2b22('0x1b')](_0x2b22('0x1c'),_0x12ab20['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xf45e62,'json':!![]};return rp(_0x1b41f5);})[_0x2b22('0x3c')](function(_0x33efa6){_0xf08860[_0x2b22('0x44')]=_0x33efa6[_0x2b22('0x45')];_0xf08860[_0x2b22('0x41')]=_0x33efa6[_0x2b22('0x40')];return db[_0x2b22('0x3e')][_0x2b22('0x46')]({'data5':_0xf08860[_0x2b22('0x44')],'data6':_0xf08860[_0x2b22('0x41')]},{'where':{'id':_0xf08860['id']}});})['then'](function(){return _0xf08860;})[_0x2b22('0x47')](function(_0x20a85a){logger[_0x2b22('0x48')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0xf08860['id'],_0x20a85a);});}function getOauth2MicrosoftAccessToken(_0x1e2162,_0x3a8af5){var _0x227e0b={'grant_type':_0x2b22('0x49'),'code':_0x1e2162,'scope':getAccessTokenScope(_0x3a8af5),'redirect_uri':_0x3a8af5['data4'],'client_id':_0x3a8af5[_0x2b22('0x31')],'client_secret':encryptor[_0x2b22('0x42')](_0x3a8af5[_0x2b22('0x3d')])};var _0x2b04a1={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x2b22('0x1b')](_0x2b22('0x1c'),_0x3a8af5['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x227e0b,'json':!![]};return rp(_0x2b04a1);}function startRefreshInterval(_0x15f24d){var _0x4e6e2d=schedule[_0x2b22('0x4a')];if(_0x4e6e2d[_0x15f24d['id']])clearInterval(_0x4e6e2d[_0x15f24d['id']]);_0x4e6e2d[_0x15f24d['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x15f24d['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x2b22('0x4a')]=_0x4e6e2d;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x2b22('0x3c')](function(_0x179feb){var _0x569ae2=_0x179feb[_0x2b22('0x13')](function(_0x3fa54c){return refreshOauth2MicrosoftAccessToken(_0x3fa54c)['then'](function(_0x12bbf5){startRefreshInterval(_0x12bbf5);});});return Promise[_0x2b22('0x4b')](_0x569ae2);})[_0x2b22('0x47')](function(_0x145c96){var _0x2bedde=_0x145c96?util['inspect'](_0x145c96,{'showHidden':![],'depth':null}):'';logger[_0x2b22('0x48')](_0x2b22('0x4c'),_0x2bedde);});}module[_0x2b22('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xdf68=['unix','exp','resolve','data3','CloudProvider','findOne','then','refresh_token','data6','decryptString','data5','access_token','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','POST','intervals','bind','findAll','all','catch','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','push','/.default','join','Outlook365','{TENANT_ID}','data2','code','id_token','stringify','base64','randomBytes','toString','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','prompt','login','key','value','replace','oauth2/','set','decode','iss','aud','audience','nonce','isAfter'];(function(_0x464ee2,_0x3d1a7f){var _0x2b4454=function(_0x35587b){while(--_0x35587b){_0x464ee2['push'](_0x464ee2['shift']());}};_0x2b4454(++_0x3d1a7f);}(_0xdf68,0x198));var _0x8df6=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0xdf68[_0x87239];return _0x53af1e;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0x8df6('0x0'));var moment=require(_0x8df6('0x1'));var Redis=require(_0x8df6('0x2'));var rp=require(_0x8df6('0x3'));var util=require(_0x8df6('0x4'));var encryptor=require(_0x8df6('0x5'));var config=require(_0x8df6('0x6'));var logger=require('../../config/logger')('api');var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x8df6('0x7'))['db'];config[_0x8df6('0x8')]=_[_0x8df6('0x9')](config[_0x8df6('0x8')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x8df6('0x8')]);var MICROSOFT_AUTH_URL=_0x8df6('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0x8df6('0xb'),_0x8df6('0xc'),'email',_0x8df6('0xd'),_0x8df6('0xe'),_0x8df6('0xf'),_0x8df6('0x10')],'Dynamics365':[_0x8df6('0xb'),_0x8df6('0xd')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x8df6('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5857a2){var _0x8a2de0=_[_0x8df6('0x12')](AZURE_AUTH_SCOPES[_0x5857a2[_0x8df6('0x13')]]);if(_0x5857a2[_0x8df6('0x13')]===_0x8df6('0x14'))_0x8a2de0[_0x8df6('0x15')](_0x5857a2['data7']+_0x8df6('0x16'));return _0x8a2de0[_0x8df6('0x17')]('\x20');}function getAccessTokenScope(_0x532df2){if(_0x532df2['type']===_0x8df6('0x18'))return _0x8df6('0xe');if(_0x532df2[_0x8df6('0x13')]==='Dynamics365')return _0x532df2['data7']+_0x8df6('0x16');}function generateMicrosoftAuthorizationUrl(_0x494aa1,_0xb37cb9){var _0x345372=MICROSOFT_AUTH_URL['replace'](_0x8df6('0x19'),_0x494aa1[_0x8df6('0x1a')]);var _0x2cf03a=[_0x8df6('0x1b'),_0x8df6('0x1c')];var _0x5af783=Buffer['from'](JSON[_0x8df6('0x1d')]({'id':_0xb37cb9}))['toString'](_0x8df6('0x1e'));var _0x2b653c=crypto[_0x8df6('0x1f')](0x10)[_0x8df6('0x20')](_0x8df6('0x21'));var _0x5b456c=getAuthorizationScopes(_0x494aa1);var _0x2c9aac=[{'key':_0x8df6('0x22'),'value':_0x494aa1[_0x8df6('0x23')]},{'key':_0x8df6('0x24'),'value':encodeURIComponent(_0x2cf03a[_0x8df6('0x17')]('\x20'))},{'key':_0x8df6('0x25'),'value':_0x494aa1[_0x8df6('0x26')]},{'key':_0x8df6('0x27'),'value':_0x8df6('0x28')},{'key':'scope','value':encodeURIComponent(_0x5b456c)},{'key':'state','value':_0x5af783},{'key':'nonce','value':_0x2b653c},{'key':_0x8df6('0x29'),'value':_0x8df6('0x2a')}];var _0x5a034e=_0x345372+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x8df6('0x12')](_0x2c9aac,function(_0x248df6){return _0x248df6[_0x8df6('0x2b')]+'='+_0x248df6[_0x8df6('0x2c')];})['join']('&');_0x494aa1['oauth2Claims']={'issuer':_0x345372[_0x8df6('0x2d')](_0x8df6('0x2e'),''),'audience':_0x494aa1[_0x8df6('0x23')],'state':_0x5af783,'nonce':_0x2b653c};redis[_0x8df6('0x2f')](_0x5af783,JSON['stringify'](_0x494aa1));return _0x5a034e;}function isValidIdToken(_0x16760e,_0x5a24a2){try{var _0x2a409c=jwt[_0x8df6('0x30')](_0x16760e,{'complete':!![]});var _0x1b230f=_0x2a409c['payload'];if(_0x1b230f[_0x8df6('0x31')]!==_0x5a24a2['issuer'])return![];if(_0x1b230f[_0x8df6('0x32')]!==_0x5a24a2[_0x8df6('0x33')])return![];if(_0x1b230f[_0x8df6('0x34')]!==_0x5a24a2[_0x8df6('0x34')])return![];if(moment()[_0x8df6('0x35')](moment[_0x8df6('0x36')](_0x1b230f[_0x8df6('0x37')])))return![];return!![];}catch(_0x6f434f){throw _0x6f434f;}}function refreshOauth2MicrosoftAccessToken(_0x225120){return Promise[_0x8df6('0x38')]()['then'](function(){if(_0x225120[_0x8df6('0x39')])return _0x225120;return db[_0x8df6('0x3a')][_0x8df6('0x3b')]({'where':{'id':_0x225120['id']},'raw':!![]});})[_0x8df6('0x3c')](function(_0x38e95f){var _0x13c818={'grant_type':_0x8df6('0x3d'),'refresh_token':_0x38e95f[_0x8df6('0x3e')],'scope':getAccessTokenScope(_0x38e95f),'redirect_uri':_0x38e95f['data4'],'client_id':_0x38e95f[_0x8df6('0x23')],'client_secret':encryptor[_0x8df6('0x3f')](_0x38e95f[_0x8df6('0x39')])};var _0x436590={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x8df6('0x2d')](_0x8df6('0x19'),_0x38e95f[_0x8df6('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x13c818,'json':!![]};return rp(_0x436590);})['then'](function(_0x2ccd9a){_0x225120[_0x8df6('0x40')]=_0x2ccd9a[_0x8df6('0x41')];_0x225120[_0x8df6('0x3e')]=_0x2ccd9a['refresh_token'];return db[_0x8df6('0x3a')][_0x8df6('0x42')]({'data5':_0x225120[_0x8df6('0x40')],'data6':_0x225120[_0x8df6('0x3e')]},{'where':{'id':_0x225120['id']}});})['then'](function(){return _0x225120;})['catch'](function(_0x4c76a1){logger[_0x8df6('0x43')](_0x8df6('0x44'),_0x225120['id'],_0x4c76a1);});}function getOauth2MicrosoftAccessToken(_0x49e9de,_0xed910d){var _0x9561cc={'grant_type':'authorization_code','code':_0x49e9de,'scope':getAccessTokenScope(_0xed910d),'redirect_uri':_0xed910d['data4'],'client_id':_0xed910d['data1'],'client_secret':encryptor[_0x8df6('0x3f')](_0xed910d[_0x8df6('0x39')])};var _0x4d9be9={'method':_0x8df6('0x45'),'uri':MICROSOFT_AUTH_URL['replace'](_0x8df6('0x19'),_0xed910d['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x9561cc,'json':!![]};return rp(_0x4d9be9);}function startRefreshInterval(_0x5b3dde){var _0x5aa48b=schedule[_0x8df6('0x46')];if(_0x5aa48b[_0x5b3dde['id']])clearInterval(_0x5aa48b[_0x5b3dde['id']]);_0x5aa48b[_0x5b3dde['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x8df6('0x47')](this,{'id':_0x5b3dde['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x8df6('0x46')]=_0x5aa48b;}function startAllRefreshIntervals(){return db[_0x8df6('0x3a')][_0x8df6('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x8df6('0x3c')](function(_0x42b9b5){var _0x1a4163=_0x42b9b5['map'](function(_0x498cf6){return refreshOauth2MicrosoftAccessToken(_0x498cf6)[_0x8df6('0x3c')](function(_0x6e3664){startRefreshInterval(_0x6e3664);});});return Promise[_0x8df6('0x49')](_0x1a4163);})[_0x8df6('0x4a')](function(_0x5ac586){var _0x5d1001=_0x5ac586?util['inspect'](_0x5ac586,{'showHidden':![],'depth':null}):'';logger[_0x8df6('0x43')](_0x8df6('0x4b'),_0x5d1001);});}module[_0x8df6('0x4c')]={'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 2351bdc..9016e41 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 _0xb4f4=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x78d8b4,_0x1c9824){var _0x49b14a=function(_0x3f5d35){while(--_0x3f5d35){_0x78d8b4['push'](_0x78d8b4['shift']());}};_0x49b14a(++_0x1c9824);}(_0xb4f4,0xda));var _0x4b4f=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xb4f4[_0x3740fe];return _0x55492b;};'use strict';var _=require(_0x4b4f('0x0'));var util=require(_0x4b4f('0x1'));var moment=require('moment');var BPromise=require(_0x4b4f('0x2'));var rs=require(_0x4b4f('0x3'));var fs=require('fs');var Redis=require(_0x4b4f('0x4'));var db=require(_0x4b4f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b4f('0x6'))(_0x4b4f('0x7'));var config=require(_0x4b4f('0x8'));var jayson=require(_0x4b4f('0x9'));var client=jayson[_0x4b4f('0xa')][_0x4b4f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x405321,_0x58c1e5,_0x5ba9b0){return new BPromise(function(_0x108b4e,_0x2c647f){return client[_0x4b4f('0xc')](_0x405321,_0x5ba9b0)[_0x4b4f('0xd')](function(_0x25e0c9){logger['info'](_0x4b4f('0xe'),_0x58c1e5,_0x4b4f('0xf'));logger[_0x4b4f('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x58c1e5,_0x4b4f('0xf'),JSON[_0x4b4f('0x11')](_0x25e0c9));if(_0x25e0c9['error']){if(_0x25e0c9[_0x4b4f('0x12')][_0x4b4f('0x13')]===0x1f4){logger[_0x4b4f('0x12')](_0x4b4f('0xe'),_0x58c1e5,_0x25e0c9[_0x4b4f('0x12')][_0x4b4f('0x14')]);return _0x2c647f(_0x25e0c9[_0x4b4f('0x12')][_0x4b4f('0x14')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x58c1e5,_0x25e0c9[_0x4b4f('0x12')][_0x4b4f('0x14')]);return _0x108b4e(_0x25e0c9['error'][_0x4b4f('0x14')]);}else{logger[_0x4b4f('0x15')](_0x4b4f('0xe'),_0x58c1e5,'request\x20sent');_0x108b4e(_0x25e0c9[_0x4b4f('0x16')][_0x4b4f('0x14')]);}})[_0x4b4f('0x17')](function(_0x57d09a){logger[_0x4b4f('0x12')](_0x4b4f('0xe'),_0x58c1e5,_0x57d09a);_0x2c647f(_0x57d09a);});});} \ No newline at end of file +var _0xccef=['stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s'];(function(_0x58ccd6,_0x37a2f4){var _0x368e39=function(_0x56866b){while(--_0x56866b){_0x58ccd6['push'](_0x58ccd6['shift']());}};_0x368e39(++_0x37a2f4);}(_0xccef,0x1d4));var _0xfcce=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xccef[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0xfcce('0x0'));var moment=require('moment');var BPromise=require(_0xfcce('0x1'));var rs=require(_0xfcce('0x2'));var fs=require('fs');var Redis=require(_0xfcce('0x3'));var db=require(_0xfcce('0x4'))['db'];var utils=require(_0xfcce('0x5'));var logger=require(_0xfcce('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfcce('0x7'));var client=jayson['client'][_0xfcce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd71971,_0x12d091,_0x4598c1){return new BPromise(function(_0x117bc3,_0x380c2c){return client[_0xfcce('0x9')](_0xd71971,_0x4598c1)['then'](function(_0x382ea5){logger[_0xfcce('0xa')](_0xfcce('0xb'),_0x12d091,_0xfcce('0xc'));logger[_0xfcce('0xd')](_0xfcce('0xe'),_0x12d091,_0xfcce('0xc'),JSON[_0xfcce('0xf')](_0x382ea5));if(_0x382ea5[_0xfcce('0x10')]){if(_0x382ea5[_0xfcce('0x10')][_0xfcce('0x11')]===0x1f4){logger['error'](_0xfcce('0xb'),_0x12d091,_0x382ea5[_0xfcce('0x10')][_0xfcce('0x12')]);return _0x380c2c(_0x382ea5[_0xfcce('0x10')]['message']);}logger[_0xfcce('0x10')](_0xfcce('0xb'),_0x12d091,_0x382ea5['error']['message']);return _0x117bc3(_0x382ea5[_0xfcce('0x10')][_0xfcce('0x12')]);}else{logger[_0xfcce('0xa')](_0xfcce('0xb'),_0x12d091,_0xfcce('0xc'));_0x117bc3(_0x382ea5[_0xfcce('0x13')][_0xfcce('0x12')]);}})[_0xfcce('0x14')](function(_0x2d7611){logger[_0xfcce('0x10')](_0xfcce('0xb'),_0x12d091,_0x2d7611);_0x380c2c(_0x2d7611);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 8bd1d85..3ae5329 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x2534cf,_0x545be6){var _0x221461=function(_0x379e83){while(--_0x379e83){_0x2534cf['push'](_0x2534cf['shift']());}};_0x221461(++_0x545be6);}(_0x1261,0x144));var _0x1126=function(_0x2effa6,_0x1440d7){_0x2effa6=_0x2effa6-0x0;var _0x226598=_0x1261[_0x2effa6];return _0x226598;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x3e91a9,_0x53c466){var _0x25c9ad=function(_0x69ee2d){while(--_0x69ee2d){_0x3e91a9['push'](_0x3e91a9['shift']());}};_0x25c9ad(++_0x53c466);}(_0x1261,0x144));var _0x1126=function(_0x3af6d3,_0xd6ff2e){_0x3af6d3=_0x3af6d3-0x0;var _0xf0c5a8=_0x1261[_0x3af6d3];return _0xf0c5a8;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index e111d6a..72df926 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 _0x7a30=['sequelize','exports','STRING','name'];(function(_0xb03c1c,_0x2f98ed){var _0x507e93=function(_0xbb4f3f){while(--_0xbb4f3f){_0xb03c1c['push'](_0xb03c1c['shift']());}};_0x507e93(++_0x2f98ed);}(_0x7a30,0x8c));var _0x07a3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7a30[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x07a3('0x0'));module[_0x07a3('0x1')]={'name':{'type':Sequelize[_0x07a3('0x2')],'unique':_0x07a3('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x07a3('0x2')]},'companyId':{'type':Sequelize[_0x07a3('0x2')]},'website':{'type':Sequelize[_0x07a3('0x2')]},'phone':{'type':Sequelize[_0x07a3('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x07a3('0x2')]},'street':{'type':Sequelize[_0x07a3('0x2')]},'postalCode':{'type':Sequelize[_0x07a3('0x2')]},'city':{'type':Sequelize[_0x07a3('0x2')]},'country':{'type':Sequelize[_0x07a3('0x2')]},'email':{'type':Sequelize[_0x07a3('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x07a3('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x07a3('0x2')]},'sCity':{'type':Sequelize[_0x07a3('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x07a3('0x2')]}}; \ No newline at end of file +var _0x672d=['STRING','sequelize','exports','name'];(function(_0x3bf9fe,_0x5ed880){var _0x39bfc4=function(_0xf6515f){while(--_0xf6515f){_0x3bf9fe['push'](_0x3bf9fe['shift']());}};_0x39bfc4(++_0x5ed880);}(_0x672d,0x121));var _0xd672=function(_0x4c69f4,_0x684e63){_0x4c69f4=_0x4c69f4-0x0;var _0x3636c9=_0x672d[_0x4c69f4];return _0x3636c9;};'use strict';var Sequelize=require(_0xd672('0x0'));module[_0xd672('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd672('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd672('0x3')]},'companyId':{'type':Sequelize[_0xd672('0x3')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xd672('0x3')]},'fax':{'type':Sequelize[_0xd672('0x3')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xd672('0x3')]},'postalCode':{'type':Sequelize[_0xd672('0x3')]},'city':{'type':Sequelize[_0xd672('0x3')]},'country':{'type':Sequelize[_0xd672('0x3')]},'email':{'type':Sequelize[_0xd672('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xd672('0x3')]},'sPostalCode':{'type':Sequelize[_0xd672('0x3')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xd672('0x3')]},'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 2b5b190..ee309df 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 _0xa79c=['Companies','destroy','error','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','addContacts','CmContact','ids','omit','getContacts','findOne','rawAttributes','length','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','then','get'];(function(_0x236487,_0x39046f){var _0x1c64cc=function(_0x5e1bfb){while(--_0x5e1bfb){_0x236487['push'](_0x236487['shift']());}};_0x1c64cc(++_0x39046f);}(_0xa79c,0xd8));var _0xca79=function(_0x332a8a,_0x47c675){_0x332a8a=_0x332a8a-0x0;var _0x5c287a=_0xa79c[_0x332a8a];return _0x5c287a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca79('0x0'));var zipdir=require(_0xca79('0x1'));var jsonpatch=require(_0xca79('0x2'));var rp=require(_0xca79('0x3'));var moment=require(_0xca79('0x4'));var BPromise=require(_0xca79('0x5'));var Mustache=require(_0xca79('0x6'));var util=require('util');var path=require(_0xca79('0x7'));var sox=require('sox');var csv=require(_0xca79('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca79('0x9'));var _=require(_0xca79('0xa'));var squel=require(_0xca79('0xb'));var crypto=require(_0xca79('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xca79('0x8'));var querystring=require(_0xca79('0xd'));var Papa=require(_0xca79('0xe'));var Redis=require('ioredis');var authService=require(_0xca79('0xf'));var qs=require(_0xca79('0x10'));var as=require(_0xca79('0x11'));var hardwareService=require(_0xca79('0x12'));var logger=require(_0xca79('0x13'))(_0xca79('0x14'));var utils=require(_0xca79('0x15'));var config=require(_0xca79('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xca79('0x17'))['db'];function respondWithStatusCode(_0x568a1f,_0x25dd8e){_0x25dd8e=_0x25dd8e||0xcc;return function(_0x4e5913){if(_0x4e5913){return _0x568a1f[_0xca79('0x18')](_0x25dd8e);}return _0x568a1f[_0xca79('0x19')](_0x25dd8e)[_0xca79('0x1a')]();};}function respondWithResult(_0x35986e,_0xc61781){_0xc61781=_0xc61781||0xc8;return function(_0x122cfe){if(_0x122cfe){return _0x35986e['status'](_0xc61781)[_0xca79('0x1b')](_0x122cfe);}};}function respondWithFilteredResult(_0x548739,_0x19cb88){return function(_0x1db4ca){if(_0x1db4ca){var _0x2bea05=typeof _0x19cb88[_0xca79('0x1c')]==='undefined'&&typeof _0x19cb88[_0xca79('0x1d')]===_0xca79('0x1e');var _0x1642a5=_0x1db4ca['count'];var _0x90dade=_0x2bea05?0x0:_0x19cb88[_0xca79('0x1c')];var _0x292f67=_0x2bea05?_0x1db4ca[_0xca79('0x1f')]:_0x19cb88[_0xca79('0x1c')]+_0x19cb88[_0xca79('0x1d')];var _0x4b199d;if(_0x292f67>=_0x1642a5){_0x292f67=_0x1642a5;_0x4b199d=0xc8;}else{_0x4b199d=0xce;}_0x548739[_0xca79('0x19')](_0x4b199d);return _0x548739[_0xca79('0x20')]('Content-Range',_0x90dade+'-'+_0x292f67+'/'+_0x1642a5)[_0xca79('0x1b')](_0x1db4ca);}return null;};}function patchUpdates(_0x3b4597){return function(_0x43f928){try{jsonpatch[_0xca79('0x21')](_0x43f928,_0x3b4597,!![]);}catch(_0x3cf25b){return BPromise['reject'](_0x3cf25b);}return _0x43f928['save']();};}function saveUpdates(_0x59c6d2,_0x4338d1){return function(_0x4e0c39){if(_0x4e0c39){return _0x4e0c39['update'](_0x59c6d2)['then'](function(_0x3c5658){return _0x3c5658;});}return null;};}function removeEntity(_0x2c6ca4,_0x8e25e3){return function(_0x13aad6){if(_0x13aad6){return _0x13aad6['destroy']()[_0xca79('0x22')](function(){var _0x5d2233=_0x13aad6[_0xca79('0x23')]({'plain':!![]});var _0x2bf4e0=_0xca79('0x24');return db['UserProfileResource'][_0xca79('0x25')]({'where':{'type':_0x2bf4e0,'resourceId':_0x5d2233['id']}})[_0xca79('0x22')](function(){return _0x13aad6;});})[_0xca79('0x22')](function(){_0x2c6ca4[_0xca79('0x19')](0xcc)[_0xca79('0x1a')]();});}};}function handleEntityNotFound(_0x5d304b,_0x4cd7ce){return function(_0x1856f1){if(!_0x1856f1){_0x5d304b['sendStatus'](0x194);}return _0x1856f1;};}function handleError(_0x3600fd,_0x2f2811){_0x2f2811=_0x2f2811||0x1f4;return function(_0x3919d1){logger[_0xca79('0x26')](_0x3919d1['stack']);if(_0x3919d1[_0xca79('0x27')]){delete _0x3919d1[_0xca79('0x27')];}_0x3600fd[_0xca79('0x19')](_0x2f2811)[_0xca79('0x28')](_0x3919d1);};}exports[_0xca79('0x29')]=function(_0x3b834f,_0x1e48be){var _0x1584bb={},_0x3b31bc={},_0x2d355f={'count':0x0,'rows':[]};return db[_0xca79('0x2a')][_0xca79('0x2b')]()[_0xca79('0x22')](function(_0x389670){_0x3b31bc[_0xca79('0x2c')]=_[_0xca79('0x2d')](_0x389670);_0x3b31bc[_0xca79('0x2e')]=_[_0xca79('0x2d')](_0x3b834f[_0xca79('0x2e')]);_0x3b31bc[_0xca79('0x2f')]=_[_0xca79('0x30')](_0x3b31bc[_0xca79('0x2c')],_0x3b31bc['query']);_0x1584bb[_0xca79('0x31')]=_[_0xca79('0x30')](_0x3b31bc[_0xca79('0x2c')],qs[_0xca79('0x32')](_0x3b834f[_0xca79('0x2e')][_0xca79('0x32')]));_0x1584bb[_0xca79('0x31')]=_0x1584bb[_0xca79('0x31')]['length']?_0x1584bb[_0xca79('0x31')]:_0x3b31bc[_0xca79('0x2c')];if(!_0x3b834f[_0xca79('0x2e')][_0xca79('0x33')](_0xca79('0x34'))){_0x1584bb[_0xca79('0x1d')]=qs[_0xca79('0x1d')](_0x3b834f[_0xca79('0x2e')][_0xca79('0x1d')]);_0x1584bb[_0xca79('0x1c')]=qs['offset'](_0x3b834f[_0xca79('0x2e')][_0xca79('0x1c')]);}_0x1584bb[_0xca79('0x35')]=qs[_0xca79('0x36')](_0x3b834f[_0xca79('0x2e')][_0xca79('0x36')]);_0x1584bb[_0xca79('0x37')]=qs[_0xca79('0x2f')](_[_0xca79('0x38')](_0x3b834f[_0xca79('0x2e')],_0x3b31bc['filters']),_0x389670);if(_0x3b834f[_0xca79('0x2e')][_0xca79('0x39')]){_0x1584bb[_0xca79('0x37')]=_[_0xca79('0x3a')](_0x1584bb[_0xca79('0x37')],{'$or':_[_0xca79('0x3b')](_0x1584bb[_0xca79('0x31')],function(_0x4a5655){var _0x53f883={};_0x53f883[_0x4a5655]={'$like':'%'+_0x3b834f['query']['filter']+'%'};return _0x53f883;})});}_0x1584bb=_['merge']({},_0x1584bb,_0x3b834f[_0xca79('0x3c')]);var _0x332e87={'where':_0x1584bb[_0xca79('0x37')]};return db[_0xca79('0x2a')][_0xca79('0x1f')](_0x332e87)[_0xca79('0x22')](function(_0x425327){_0x2d355f['count']=_0x425327;if(_0x3b834f[_0xca79('0x2e')][_0xca79('0x3d')]){_0x1584bb[_0xca79('0x3e')]=[{'all':!![]}];}return db[_0xca79('0x2a')]['findAll'](_0x1584bb);})[_0xca79('0x22')](function(_0x16fb5f){_0x2d355f[_0xca79('0x3f')]=_0x16fb5f;return _0x2d355f;})['then'](respondWithFilteredResult(_0x1e48be,_0x1584bb))['catch'](handleError(_0x1e48be,null));})['catch'](handleError(_0x1e48be,null));};exports[_0xca79('0x40')]=function(_0x69d714,_0x186d66){var _0x1e908d={'raw':![],'where':{'id':_0x69d714[_0xca79('0x41')]['id']}},_0x527f1d={};_0x527f1d[_0xca79('0x2c')]=_[_0xca79('0x2d')](db[_0xca79('0x2a')]['rawAttributes']);_0x527f1d[_0xca79('0x2e')]=_[_0xca79('0x2d')](_0x69d714[_0xca79('0x2e')]);_0x527f1d['filters']=_['intersection'](_0x527f1d[_0xca79('0x2c')],_0x527f1d['query']);_0x1e908d[_0xca79('0x31')]=_['intersection'](_0x527f1d[_0xca79('0x2c')],qs[_0xca79('0x32')](_0x69d714['query'][_0xca79('0x32')]));_0x1e908d[_0xca79('0x31')]=_0x1e908d[_0xca79('0x31')]['length']?_0x1e908d[_0xca79('0x31')]:_0x527f1d[_0xca79('0x2c')];if(_0x69d714[_0xca79('0x2e')][_0xca79('0x3d')]){_0x1e908d[_0xca79('0x3e')]=[{'all':!![]}];}_0x1e908d=_['merge']({},_0x1e908d,_0x69d714[_0xca79('0x3c')]);return db[_0xca79('0x2a')][_0xca79('0x42')](_0x1e908d)['then'](handleEntityNotFound(_0x186d66,null))[_0xca79('0x22')](respondWithResult(_0x186d66,null))[_0xca79('0x43')](handleError(_0x186d66,null));};exports[_0xca79('0x44')]=function(_0x19719e,_0x24449d){return db[_0xca79('0x2a')][_0xca79('0x44')](_0x19719e[_0xca79('0x45')],{})['then'](function(_0x5bd3f5){var _0x4c6d23=_0x19719e[_0xca79('0x46')]['get']({'plain':!![]});if(!_0x4c6d23)throw new Error(_0xca79('0x47'));if(_0x4c6d23[_0xca79('0x48')]===_0xca79('0x46')){var _0x38d884=_0x5bd3f5['get']({'plain':!![]});var _0x41ffc9='Companies';return db[_0xca79('0x49')][_0xca79('0x42')]({'where':{'name':_0x41ffc9,'userProfileId':_0x4c6d23[_0xca79('0x4a')]},'raw':!![]})['then'](function(_0x58799){if(_0x58799&&_0x58799[_0xca79('0x4b')]===0x0){return db['UserProfileResource'][_0xca79('0x44')]({'name':_0x38d884[_0xca79('0x27')],'resourceId':_0x38d884['id'],'type':_0x58799['name'],'sectionId':_0x58799['id']},{})['then'](function(){return _0x5bd3f5;});}else{return _0x5bd3f5;}})[_0xca79('0x43')](function(_0x205b10){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x205b10);throw _0x205b10;});}return _0x5bd3f5;})[_0xca79('0x22')](respondWithResult(_0x24449d,0xc9))['catch'](handleError(_0x24449d,null));};exports['update']=function(_0x3cdd36,_0x1dfa18){if(_0x3cdd36['body']['id']){delete _0x3cdd36[_0xca79('0x45')]['id'];}return db[_0xca79('0x2a')]['find']({'where':{'id':_0x3cdd36[_0xca79('0x41')]['id']}})[_0xca79('0x22')](handleEntityNotFound(_0x1dfa18,null))[_0xca79('0x22')](saveUpdates(_0x3cdd36[_0xca79('0x45')],null))[_0xca79('0x22')](respondWithResult(_0x1dfa18,null))['catch'](handleError(_0x1dfa18,null));};exports[_0xca79('0x25')]=function(_0x48a741,_0x86358b){return db['CmCompany']['find']({'where':{'id':_0x48a741[_0xca79('0x41')]['id']}})['then'](handleEntityNotFound(_0x86358b,null))[_0xca79('0x22')](removeEntity(_0x86358b,null))[_0xca79('0x43')](handleError(_0x86358b,null));};exports[_0xca79('0x2b')]=function(_0x2f8bbb,_0x4e3cf0){return db[_0xca79('0x2a')][_0xca79('0x2b')]()['then'](respondWithResult(_0x4e3cf0,null))[_0xca79('0x43')](handleError(_0x4e3cf0,null));};exports[_0xca79('0x4c')]=function(_0x5bda30,_0x412866,_0xb2142){return db[_0xca79('0x4d')][_0xca79('0x42')]({'where':{'id':_0x5bda30[_0xca79('0x41')]['id']}})[_0xca79('0x22')](handleEntityNotFound(_0x412866,null))[_0xca79('0x22')](function(_0x3eecce){if(_0x3eecce){return _0x3eecce['addContacts'](_0x5bda30[_0xca79('0x45')][_0xca79('0x4e')],_[_0xca79('0x4f')](_0x5bda30[_0xca79('0x45')],[_0xca79('0x4e'),'id'])||{});}})[_0xca79('0x22')](respondWithResult(_0x412866,null))[_0xca79('0x43')](handleError(_0x412866,null));};exports[_0xca79('0x50')]=function(_0x3b6f67,_0x2381b6,_0xf9a53){var _0x5de678={};var _0x4d1178={};var _0x135ac3;var _0x1a0e5d;return db[_0xca79('0x2a')][_0xca79('0x51')]({'where':{'id':_0x3b6f67[_0xca79('0x41')]['id']}})['then'](handleEntityNotFound(_0x2381b6,null))['then'](function(_0x6ddce6){if(_0x6ddce6){_0x135ac3=_0x6ddce6;_0x4d1178[_0xca79('0x2c')]=_[_0xca79('0x2d')](db['CmContact'][_0xca79('0x52')]);_0x4d1178[_0xca79('0x2e')]=_[_0xca79('0x2d')](_0x3b6f67['query']);_0x4d1178[_0xca79('0x2f')]=_['intersection'](_0x4d1178[_0xca79('0x2c')],_0x4d1178['query']);_0x5de678[_0xca79('0x31')]=_[_0xca79('0x30')](_0x4d1178[_0xca79('0x2c')],qs[_0xca79('0x32')](_0x3b6f67[_0xca79('0x2e')][_0xca79('0x32')]));_0x5de678[_0xca79('0x31')]=_0x5de678[_0xca79('0x31')]['length']?_0x5de678[_0xca79('0x31')]:_0x4d1178[_0xca79('0x2c')];_0x5de678[_0xca79('0x35')]=qs[_0xca79('0x36')](_0x3b6f67[_0xca79('0x2e')][_0xca79('0x36')]);_0x5de678[_0xca79('0x37')]=qs[_0xca79('0x2f')](_[_0xca79('0x38')](_0x3b6f67[_0xca79('0x2e')],_0x4d1178[_0xca79('0x2f')]));if(_0x3b6f67[_0xca79('0x2e')]['filter']){_0x5de678[_0xca79('0x37')]=_[_0xca79('0x3a')](_0x5de678[_0xca79('0x37')],{'$or':_[_0xca79('0x3b')](_0x5de678[_0xca79('0x31')],function(_0x581864){var _0x1189db={};_0x1189db[_0x581864]={'$like':'%'+_0x3b6f67[_0xca79('0x2e')]['filter']+'%'};return _0x1189db;})});}_0x5de678=_['merge']({},_0x5de678,_0x3b6f67['options']);return _0x135ac3['getContacts'](_0x5de678);}})[_0xca79('0x22')](function(_0x401ea0){if(_0x401ea0){_0x1a0e5d=_0x401ea0[_0xca79('0x53')];if(!_0x3b6f67['query']['hasOwnProperty'](_0xca79('0x34'))){_0x5de678[_0xca79('0x1d')]=qs['limit'](_0x3b6f67[_0xca79('0x2e')][_0xca79('0x1d')]);_0x5de678['offset']=qs[_0xca79('0x1c')](_0x3b6f67['query'][_0xca79('0x1c')]);}return _0x135ac3[_0xca79('0x50')](_0x5de678);}})[_0xca79('0x22')](function(_0x1d7a98){if(_0x1d7a98){return _0x1d7a98?{'count':_0x1a0e5d,'rows':_0x1d7a98}:null;}})['then'](respondWithResult(_0x2381b6,null))[_0xca79('0x43')](handleError(_0x2381b6,null));}; \ No newline at end of file +var _0x6802=['name','send','index','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','include','findAll','rows','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addContacts','CmContact','omit','getContacts','findOne','rawAttributes','map','nolimit','eml-format','rimraf','zip-dir','request-promise','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','get','UserProfileResource','end','error','stack'];(function(_0x25d875,_0x45de83){var _0x4010b1=function(_0x4b8d09){while(--_0x4b8d09){_0x25d875['push'](_0x25d875['shift']());}};_0x4010b1(++_0x45de83);}(_0x6802,0x17a));var _0x2680=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x6802[_0x422905];return _0x33dc6c;};'use strict';var emlformat=require(_0x2680('0x0'));var rimraf=require(_0x2680('0x1'));var zipdir=require(_0x2680('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2680('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2680('0x4'));var util=require('util');var path=require('path');var sox=require(_0x2680('0x5'));var csv=require('to-csv');var ejs=require(_0x2680('0x6'));var fs=require('fs');var fs_extra=require(_0x2680('0x7'));var _=require('lodash');var squel=require(_0x2680('0x8'));var crypto=require(_0x2680('0x9'));var jsforce=require(_0x2680('0xa'));var deskjs=require(_0x2680('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2680('0xc'));var Papa=require(_0x2680('0xd'));var Redis=require(_0x2680('0xe'));var authService=require(_0x2680('0xf'));var qs=require(_0x2680('0x10'));var as=require(_0x2680('0x11'));var hardwareService=require(_0x2680('0x12'));var logger=require(_0x2680('0x13'))(_0x2680('0x14'));var utils=require(_0x2680('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2680('0x16'))['db'];function respondWithStatusCode(_0x524ba9,_0x4694b5){_0x4694b5=_0x4694b5||0xcc;return function(_0x574aae){if(_0x574aae){return _0x524ba9[_0x2680('0x17')](_0x4694b5);}return _0x524ba9[_0x2680('0x18')](_0x4694b5)['end']();};}function respondWithResult(_0xc94b63,_0x1b0a04){_0x1b0a04=_0x1b0a04||0xc8;return function(_0x226739){if(_0x226739){return _0xc94b63[_0x2680('0x18')](_0x1b0a04)['json'](_0x226739);}};}function respondWithFilteredResult(_0x589e59,_0x328f30){return function(_0x1f4f82){if(_0x1f4f82){var _0x2e11e1=typeof _0x328f30['offset']===_0x2680('0x19')&&typeof _0x328f30[_0x2680('0x1a')]===_0x2680('0x19');var _0x1116d8=_0x1f4f82[_0x2680('0x1b')];var _0x3804a8=_0x2e11e1?0x0:_0x328f30[_0x2680('0x1c')];var _0x384250=_0x2e11e1?_0x1f4f82[_0x2680('0x1b')]:_0x328f30[_0x2680('0x1c')]+_0x328f30['limit'];var _0x3db20c;if(_0x384250>=_0x1116d8){_0x384250=_0x1116d8;_0x3db20c=0xc8;}else{_0x3db20c=0xce;}_0x589e59[_0x2680('0x18')](_0x3db20c);return _0x589e59[_0x2680('0x1d')](_0x2680('0x1e'),_0x3804a8+'-'+_0x384250+'/'+_0x1116d8)[_0x2680('0x1f')](_0x1f4f82);}return null;};}function patchUpdates(_0x4302dd){return function(_0x6e714d){try{jsonpatch[_0x2680('0x20')](_0x6e714d,_0x4302dd,!![]);}catch(_0x35be6e){return BPromise[_0x2680('0x21')](_0x35be6e);}return _0x6e714d[_0x2680('0x22')]();};}function saveUpdates(_0x3015af,_0x191770){return function(_0x281f9a){if(_0x281f9a){return _0x281f9a['update'](_0x3015af)[_0x2680('0x23')](function(_0x229a45){return _0x229a45;});}return null;};}function removeEntity(_0x2ddc6b,_0x437857){return function(_0x3bd787){if(_0x3bd787){return _0x3bd787[_0x2680('0x24')]()[_0x2680('0x23')](function(){var _0x98e2c2=_0x3bd787[_0x2680('0x25')]({'plain':!![]});var _0x2f1ede='Companies';return db[_0x2680('0x26')][_0x2680('0x24')]({'where':{'type':_0x2f1ede,'resourceId':_0x98e2c2['id']}})[_0x2680('0x23')](function(){return _0x3bd787;});})[_0x2680('0x23')](function(){_0x2ddc6b[_0x2680('0x18')](0xcc)[_0x2680('0x27')]();});}};}function handleEntityNotFound(_0xea567c,_0x381f2c){return function(_0x18f523){if(!_0x18f523){_0xea567c[_0x2680('0x17')](0x194);}return _0x18f523;};}function handleError(_0x5e2b89,_0x3bdf36){_0x3bdf36=_0x3bdf36||0x1f4;return function(_0x12330f){logger[_0x2680('0x28')](_0x12330f[_0x2680('0x29')]);if(_0x12330f['name']){delete _0x12330f[_0x2680('0x2a')];}_0x5e2b89['status'](_0x3bdf36)[_0x2680('0x2b')](_0x12330f);};}exports[_0x2680('0x2c')]=function(_0x5d7f81,_0x2e61ea){var _0x560f19={},_0x1d9f7e={},_0x3add76={'count':0x0,'rows':[]};return db[_0x2680('0x2d')]['describe']()['then'](function(_0x10d593){_0x1d9f7e[_0x2680('0x2e')]=_[_0x2680('0x2f')](_0x10d593);_0x1d9f7e[_0x2680('0x30')]=_[_0x2680('0x2f')](_0x5d7f81['query']);_0x1d9f7e[_0x2680('0x31')]=_[_0x2680('0x32')](_0x1d9f7e['model'],_0x1d9f7e[_0x2680('0x30')]);_0x560f19[_0x2680('0x33')]=_[_0x2680('0x32')](_0x1d9f7e[_0x2680('0x2e')],qs[_0x2680('0x34')](_0x5d7f81[_0x2680('0x30')]['fields']));_0x560f19[_0x2680('0x33')]=_0x560f19['attributes'][_0x2680('0x35')]?_0x560f19['attributes']:_0x1d9f7e[_0x2680('0x2e')];if(!_0x5d7f81[_0x2680('0x30')][_0x2680('0x36')]('nolimit')){_0x560f19[_0x2680('0x1a')]=qs[_0x2680('0x1a')](_0x5d7f81[_0x2680('0x30')][_0x2680('0x1a')]);_0x560f19[_0x2680('0x1c')]=qs[_0x2680('0x1c')](_0x5d7f81[_0x2680('0x30')][_0x2680('0x1c')]);}_0x560f19[_0x2680('0x37')]=qs[_0x2680('0x38')](_0x5d7f81[_0x2680('0x30')][_0x2680('0x38')]);_0x560f19[_0x2680('0x39')]=qs['filters'](_['pick'](_0x5d7f81[_0x2680('0x30')],_0x1d9f7e[_0x2680('0x31')]),_0x10d593);if(_0x5d7f81[_0x2680('0x30')][_0x2680('0x3a')]){_0x560f19[_0x2680('0x39')]=_[_0x2680('0x3b')](_0x560f19[_0x2680('0x39')],{'$or':_['map'](_0x560f19[_0x2680('0x33')],function(_0x3ac48f){var _0x11390b={};_0x11390b[_0x3ac48f]={'$like':'%'+_0x5d7f81[_0x2680('0x30')][_0x2680('0x3a')]+'%'};return _0x11390b;})});}_0x560f19=_[_0x2680('0x3b')]({},_0x560f19,_0x5d7f81[_0x2680('0x3c')]);var _0x397f40={'where':_0x560f19[_0x2680('0x39')]};return db[_0x2680('0x2d')][_0x2680('0x1b')](_0x397f40)[_0x2680('0x23')](function(_0x2189ac){_0x3add76['count']=_0x2189ac;if(_0x5d7f81[_0x2680('0x30')]['includeAll']){_0x560f19[_0x2680('0x3d')]=[{'all':!![]}];}return db[_0x2680('0x2d')][_0x2680('0x3e')](_0x560f19);})['then'](function(_0x4c4d00){_0x3add76[_0x2680('0x3f')]=_0x4c4d00;return _0x3add76;})[_0x2680('0x23')](respondWithFilteredResult(_0x2e61ea,_0x560f19))['catch'](handleError(_0x2e61ea,null));})['catch'](handleError(_0x2e61ea,null));};exports['show']=function(_0x3761a2,_0x24659a){var _0x5060aa={'raw':![],'where':{'id':_0x3761a2['params']['id']}},_0x46003d={};_0x46003d[_0x2680('0x2e')]=_[_0x2680('0x2f')](db[_0x2680('0x2d')]['rawAttributes']);_0x46003d[_0x2680('0x30')]=_['keys'](_0x3761a2['query']);_0x46003d[_0x2680('0x31')]=_['intersection'](_0x46003d['model'],_0x46003d[_0x2680('0x30')]);_0x5060aa[_0x2680('0x33')]=_[_0x2680('0x32')](_0x46003d[_0x2680('0x2e')],qs[_0x2680('0x34')](_0x3761a2[_0x2680('0x30')][_0x2680('0x34')]));_0x5060aa[_0x2680('0x33')]=_0x5060aa[_0x2680('0x33')][_0x2680('0x35')]?_0x5060aa[_0x2680('0x33')]:_0x46003d[_0x2680('0x2e')];if(_0x3761a2[_0x2680('0x30')][_0x2680('0x40')]){_0x5060aa[_0x2680('0x3d')]=[{'all':!![]}];}_0x5060aa=_['merge']({},_0x5060aa,_0x3761a2['options']);return db[_0x2680('0x2d')][_0x2680('0x41')](_0x5060aa)[_0x2680('0x23')](handleEntityNotFound(_0x24659a,null))['then'](respondWithResult(_0x24659a,null))['catch'](handleError(_0x24659a,null));};exports['create']=function(_0x36a202,_0x2e6ab0){return db['CmCompany'][_0x2680('0x42')](_0x36a202[_0x2680('0x43')],{})[_0x2680('0x23')](function(_0x98762e){var _0x3bf8f2=_0x36a202['user'][_0x2680('0x25')]({'plain':!![]});if(!_0x3bf8f2)throw new Error(_0x2680('0x44'));if(_0x3bf8f2[_0x2680('0x45')]==='user'){var _0x4d3e6d=_0x98762e[_0x2680('0x25')]({'plain':!![]});var _0x4131a1=_0x2680('0x46');return db['UserProfileSection'][_0x2680('0x41')]({'where':{'name':_0x4131a1,'userProfileId':_0x3bf8f2[_0x2680('0x47')]},'raw':!![]})[_0x2680('0x23')](function(_0xb31383){if(_0xb31383&&_0xb31383['autoAssociation']===0x0){return db[_0x2680('0x26')]['create']({'name':_0x4d3e6d[_0x2680('0x2a')],'resourceId':_0x4d3e6d['id'],'type':_0xb31383['name'],'sectionId':_0xb31383['id']},{})[_0x2680('0x23')](function(){return _0x98762e;});}else{return _0x98762e;}})[_0x2680('0x48')](function(_0x292285){logger[_0x2680('0x28')](_0x2680('0x49'),_0x292285);throw _0x292285;});}return _0x98762e;})['then'](respondWithResult(_0x2e6ab0,0xc9))[_0x2680('0x48')](handleError(_0x2e6ab0,null));};exports['update']=function(_0x11c373,_0x22075d){if(_0x11c373['body']['id']){delete _0x11c373[_0x2680('0x43')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x11c373[_0x2680('0x4a')]['id']}})[_0x2680('0x23')](handleEntityNotFound(_0x22075d,null))['then'](saveUpdates(_0x11c373[_0x2680('0x43')],null))[_0x2680('0x23')](respondWithResult(_0x22075d,null))[_0x2680('0x48')](handleError(_0x22075d,null));};exports['destroy']=function(_0x3ffb97,_0x34c6df){return db[_0x2680('0x2d')]['find']({'where':{'id':_0x3ffb97[_0x2680('0x4a')]['id']}})[_0x2680('0x23')](handleEntityNotFound(_0x34c6df,null))[_0x2680('0x23')](removeEntity(_0x34c6df,null))['catch'](handleError(_0x34c6df,null));};exports['describe']=function(_0x4c0215,_0x15a27d){return db[_0x2680('0x2d')][_0x2680('0x4b')]()[_0x2680('0x23')](respondWithResult(_0x15a27d,null))[_0x2680('0x48')](handleError(_0x15a27d,null));};exports[_0x2680('0x4c')]=function(_0x3f5312,_0xe1aa6,_0x2f549f){return db[_0x2680('0x4d')][_0x2680('0x41')]({'where':{'id':_0x3f5312[_0x2680('0x4a')]['id']}})[_0x2680('0x23')](handleEntityNotFound(_0xe1aa6,null))['then'](function(_0x5d4586){if(_0x5d4586){return _0x5d4586[_0x2680('0x4c')](_0x3f5312['body']['ids'],_[_0x2680('0x4e')](_0x3f5312['body'],['ids','id'])||{});}})['then'](respondWithResult(_0xe1aa6,null))[_0x2680('0x48')](handleError(_0xe1aa6,null));};exports[_0x2680('0x4f')]=function(_0x1d20b9,_0x3dcf29,_0x40570f){var _0x5cfd7e={};var _0x426a28={};var _0x23013a;var _0x35b594;return db[_0x2680('0x2d')][_0x2680('0x50')]({'where':{'id':_0x1d20b9['params']['id']}})[_0x2680('0x23')](handleEntityNotFound(_0x3dcf29,null))[_0x2680('0x23')](function(_0x59de7d){if(_0x59de7d){_0x23013a=_0x59de7d;_0x426a28[_0x2680('0x2e')]=_[_0x2680('0x2f')](db[_0x2680('0x4d')][_0x2680('0x51')]);_0x426a28[_0x2680('0x30')]=_[_0x2680('0x2f')](_0x1d20b9[_0x2680('0x30')]);_0x426a28[_0x2680('0x31')]=_[_0x2680('0x32')](_0x426a28[_0x2680('0x2e')],_0x426a28[_0x2680('0x30')]);_0x5cfd7e[_0x2680('0x33')]=_[_0x2680('0x32')](_0x426a28[_0x2680('0x2e')],qs[_0x2680('0x34')](_0x1d20b9[_0x2680('0x30')][_0x2680('0x34')]));_0x5cfd7e[_0x2680('0x33')]=_0x5cfd7e[_0x2680('0x33')][_0x2680('0x35')]?_0x5cfd7e['attributes']:_0x426a28[_0x2680('0x2e')];_0x5cfd7e[_0x2680('0x37')]=qs[_0x2680('0x38')](_0x1d20b9[_0x2680('0x30')]['sort']);_0x5cfd7e[_0x2680('0x39')]=qs[_0x2680('0x31')](_['pick'](_0x1d20b9[_0x2680('0x30')],_0x426a28[_0x2680('0x31')]));if(_0x1d20b9[_0x2680('0x30')]['filter']){_0x5cfd7e['where']=_[_0x2680('0x3b')](_0x5cfd7e['where'],{'$or':_[_0x2680('0x52')](_0x5cfd7e[_0x2680('0x33')],function(_0x3c8fa1){var _0x3ccb64={};_0x3ccb64[_0x3c8fa1]={'$like':'%'+_0x1d20b9[_0x2680('0x30')][_0x2680('0x3a')]+'%'};return _0x3ccb64;})});}_0x5cfd7e=_['merge']({},_0x5cfd7e,_0x1d20b9[_0x2680('0x3c')]);return _0x23013a['getContacts'](_0x5cfd7e);}})[_0x2680('0x23')](function(_0x3f079a){if(_0x3f079a){_0x35b594=_0x3f079a['length'];if(!_0x1d20b9[_0x2680('0x30')][_0x2680('0x36')](_0x2680('0x53'))){_0x5cfd7e[_0x2680('0x1a')]=qs[_0x2680('0x1a')](_0x1d20b9['query']['limit']);_0x5cfd7e[_0x2680('0x1c')]=qs[_0x2680('0x1c')](_0x1d20b9[_0x2680('0x30')][_0x2680('0x1c')]);}return _0x23013a[_0x2680('0x4f')](_0x5cfd7e);}})[_0x2680('0x23')](function(_0x5c2e2c){if(_0x5c2e2c){return _0x5c2e2c?{'count':_0x35b594,'rows':_0x5c2e2c}:null;}})[_0x2680('0x23')](respondWithResult(_0x3dcf29,null))[_0x2680('0x48')](handleError(_0x3dcf29,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index c839952..3d45111 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 _0xea98=['util','api','moment','path','../../config/environment','define','CmCompany','cm_companies'];(function(_0xf9fcc9,_0x46350e){var _0x396114=function(_0x3418fe){while(--_0x3418fe){_0xf9fcc9['push'](_0xf9fcc9['shift']());}};_0x396114(++_0x46350e);}(_0xea98,0x180));var _0x8ea9=function(_0x25e4c7,_0x3986c5){_0x25e4c7=_0x25e4c7-0x0;var _0x333f1e=_0xea98[_0x25e4c7];return _0x333f1e;};'use strict';var _=require('lodash');var util=require(_0x8ea9('0x0'));var logger=require('../../config/logger')(_0x8ea9('0x1'));var moment=require(_0x8ea9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ea9('0x3'));var rimraf=require('rimraf');var config=require(_0x8ea9('0x4'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x422cf5,_0x1ce77e){return _0x422cf5[_0x8ea9('0x5')](_0x8ea9('0x6'),attributes,{'tableName':_0x8ea9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb7d=['cm_companies','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany'];(function(_0x412faa,_0x6d5ea8){var _0x204402=function(_0x1ddbe0){while(--_0x1ddbe0){_0x412faa['push'](_0x412faa['shift']());}};_0x204402(++_0x6d5ea8);}(_0xfb7d,0xc5));var _0xdfb7=function(_0x886664,_0x4d7b96){_0x886664=_0x886664-0x0;var _0x273401=_0xfb7d[_0x886664];return _0x273401;};'use strict';var _=require(_0xdfb7('0x0'));var util=require(_0xdfb7('0x1'));var logger=require(_0xdfb7('0x2'))('api');var moment=require(_0xdfb7('0x3'));var BPromise=require(_0xdfb7('0x4'));var rp=require(_0xdfb7('0x5'));var fs=require('fs');var path=require(_0xdfb7('0x6'));var rimraf=require(_0xdfb7('0x7'));var config=require(_0xdfb7('0x8'));var attributes=require(_0xdfb7('0x9'));module[_0xdfb7('0xa')]=function(_0x16da99,_0x57308a){return _0x16da99[_0xdfb7('0xb')](_0xdfb7('0xc'),attributes,{'tableName':_0xdfb7('0xd'),'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 1c29845..113d764 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 _0xa29a=['request\x20sent','error','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0x54f3e8,_0x3ed493){var _0x267b37=function(_0x58247e){while(--_0x58247e){_0x54f3e8['push'](_0x54f3e8['shift']());}};_0x267b37(++_0x3ed493);}(_0xa29a,0xd5));var _0xaa29=function(_0x2d98ac,_0x4e6161){_0x2d98ac=_0x2d98ac-0x0;var _0x444708=_0xa29a[_0x2d98ac];return _0x444708;};'use strict';var _=require(_0xaa29('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaa29('0x1'));var rs=require(_0xaa29('0x2'));var fs=require('fs');var Redis=require(_0xaa29('0x3'));var db=require(_0xaa29('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa29('0x5'))('rpc');var config=require(_0xaa29('0x6'));var jayson=require(_0xaa29('0x7'));var client=jayson[_0xaa29('0x8')][_0xaa29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35f2fb,_0x1283d1,_0x39c0c3){return new BPromise(function(_0x108a38,_0x12d7c0){return client[_0xaa29('0xa')](_0x35f2fb,_0x39c0c3)[_0xaa29('0xb')](function(_0x52df12){logger[_0xaa29('0xc')](_0xaa29('0xd'),_0x1283d1,'request\x20sent');logger['debug'](_0xaa29('0xe'),_0x1283d1,_0xaa29('0xf'),JSON['stringify'](_0x52df12));if(_0x52df12[_0xaa29('0x10')]){if(_0x52df12[_0xaa29('0x10')]['code']===0x1f4){logger[_0xaa29('0x10')](_0xaa29('0xd'),_0x1283d1,_0x52df12[_0xaa29('0x10')][_0xaa29('0x11')]);return _0x12d7c0(_0x52df12[_0xaa29('0x10')][_0xaa29('0x11')]);}logger[_0xaa29('0x10')](_0xaa29('0xd'),_0x1283d1,_0x52df12[_0xaa29('0x10')][_0xaa29('0x11')]);return _0x108a38(_0x52df12[_0xaa29('0x10')][_0xaa29('0x11')]);}else{logger[_0xaa29('0xc')]('CmCompany,\x20%s,\x20%s',_0x1283d1,_0xaa29('0xf'));_0x108a38(_0x52df12['result'][_0xaa29('0x11')]);}})[_0xaa29('0x12')](function(_0x406a86){logger[_0xaa29('0x10')](_0xaa29('0xd'),_0x1283d1,_0x406a86);_0x12d7c0(_0x406a86);});});} \ No newline at end of file +var _0xc6fb=['CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xc6fb,0x83));var _0xbc6f=function(_0x1c8cc6,_0x411e5c){_0x1c8cc6=_0x1c8cc6-0x0;var _0x522936=_0xc6fb[_0x1c8cc6];return _0x522936;};'use strict';var _=require(_0xbc6f('0x0'));var util=require(_0xbc6f('0x1'));var moment=require(_0xbc6f('0x2'));var BPromise=require(_0xbc6f('0x3'));var rs=require(_0xbc6f('0x4'));var fs=require('fs');var Redis=require(_0xbc6f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc6f('0x6'));var logger=require(_0xbc6f('0x7'))('rpc');var config=require(_0xbc6f('0x8'));var jayson=require(_0xbc6f('0x9'));var client=jayson[_0xbc6f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x466a69,_0x442fb1,_0x4d0afa){return new BPromise(function(_0x565f2d,_0x284cbb){return client[_0xbc6f('0xb')](_0x466a69,_0x4d0afa)[_0xbc6f('0xc')](function(_0x3fe04e){logger[_0xbc6f('0xd')](_0xbc6f('0xe'),_0x442fb1,_0xbc6f('0xf'));logger['debug'](_0xbc6f('0x10'),_0x442fb1,_0xbc6f('0xf'),JSON[_0xbc6f('0x11')](_0x3fe04e));if(_0x3fe04e[_0xbc6f('0x12')]){if(_0x3fe04e[_0xbc6f('0x12')][_0xbc6f('0x13')]===0x1f4){logger[_0xbc6f('0x12')](_0xbc6f('0xe'),_0x442fb1,_0x3fe04e[_0xbc6f('0x12')]['message']);return _0x284cbb(_0x3fe04e['error'][_0xbc6f('0x14')]);}logger[_0xbc6f('0x12')]('CmCompany,\x20%s,\x20%s',_0x442fb1,_0x3fe04e[_0xbc6f('0x12')]['message']);return _0x565f2d(_0x3fe04e[_0xbc6f('0x12')]['message']);}else{logger[_0xbc6f('0xd')](_0xbc6f('0xe'),_0x442fb1,_0xbc6f('0xf'));_0x565f2d(_0x3fe04e['result'][_0xbc6f('0x14')]);}})['catch'](function(_0x45dbc6){logger[_0xbc6f('0x12')](_0xbc6f('0xe'),_0x442fb1,_0x45dbc6);_0x284cbb(_0x45dbc6);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 6fcfd1a..72053ec 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 _0x83d0=['/:id/contacts','getContacts','create','addContacts','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','/describe','/:id','show'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x83d0,0x76));var _0x083d=function(_0x2d497f,_0x2f5113){_0x2d497f=_0x2d497f-0x0;var _0x58eb02=_0x83d0[_0x2d497f];return _0x58eb02;};'use strict';var multer=require(_0x083d('0x0'));var util=require(_0x083d('0x1'));var path=require(_0x083d('0x2'));var timeout=require(_0x083d('0x3'));var express=require('express');var router=express[_0x083d('0x4')]();var fs_extra=require(_0x083d('0x5'));var auth=require(_0x083d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x083d('0x7'));var controller=require(_0x083d('0x8'));router[_0x083d('0x9')]('/',auth[_0x083d('0xa')](),controller['index']);router[_0x083d('0x9')](_0x083d('0xb'),auth[_0x083d('0xa')](),controller['describe']);router[_0x083d('0x9')](_0x083d('0xc'),auth[_0x083d('0xa')](),controller[_0x083d('0xd')]);router[_0x083d('0x9')](_0x083d('0xe'),auth['isAuthenticated'](),controller[_0x083d('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x083d('0x10')]);router['post']('/:id/contacts',auth['isAuthenticated'](),controller[_0x083d('0x11')]);router[_0x083d('0x12')]('/:id',auth[_0x083d('0xa')](),controller[_0x083d('0x13')]);router['delete'](_0x083d('0xc'),auth[_0x083d('0xa')](),controller[_0x083d('0x14')]);module[_0x083d('0x15')]=router; \ No newline at end of file +var _0x698e=['get','describe','/:id','isAuthenticated','show','/:id/contacts','getContacts','post','create','put','update','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','index'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0x698e,0x14f));var _0xe698=function(_0x453310,_0x4dcff6){_0x453310=_0x453310-0x0;var _0x337eb4=_0x698e[_0x453310];return _0x337eb4;};'use strict';var multer=require('multer');var util=require(_0xe698('0x0'));var path=require('path');var timeout=require(_0xe698('0x1'));var express=require(_0xe698('0x2'));var router=express['Router']();var fs_extra=require(_0xe698('0x3'));var auth=require(_0xe698('0x4'));var interaction=require(_0xe698('0x5'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe698('0x6')]);router[_0xe698('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xe698('0x8')]);router[_0xe698('0x7')](_0xe698('0x9'),auth[_0xe698('0xa')](),controller[_0xe698('0xb')]);router[_0xe698('0x7')](_0xe698('0xc'),auth[_0xe698('0xa')](),controller[_0xe698('0xd')]);router[_0xe698('0xe')]('/',auth[_0xe698('0xa')](),controller[_0xe698('0xf')]);router[_0xe698('0xe')](_0xe698('0xc'),auth[_0xe698('0xa')](),controller['addContacts']);router[_0xe698('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe698('0x11')]);router['delete'](_0xe698('0x9'),auth[_0xe698('0xa')](),controller['destroy']);module[_0xe698('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 2979506..567d6c3 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 _0x66ef=['exports','STRING','TEXT','UNSIGNED','DATE','NOW','INTEGER','sequelize'];(function(_0x45eee2,_0x4d8c9e){var _0x4eb329=function(_0x3d99a5){while(--_0x3d99a5){_0x45eee2['push'](_0x45eee2['shift']());}};_0x4eb329(++_0x4d8c9e);}(_0x66ef,0x147));var _0xf66e=function(_0x20dc38,_0x371fbf){_0x20dc38=_0x20dc38-0x0;var _0x42a113=_0x66ef[_0x20dc38];return _0x42a113;};'use strict';var _=require('lodash');var Sequelize=require(_0xf66e('0x0'));module[_0xf66e('0x1')]={'firstName':{'type':Sequelize[_0xf66e('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf66e('0x2')]},'street':{'type':Sequelize[_0xf66e('0x2')]},'postalCode':{'type':Sequelize[_0xf66e('0x2')]},'city':{'type':Sequelize[_0xf66e('0x2')]},'country':{'type':Sequelize[_0xf66e('0x2')]},'dateOfBirth':{'type':Sequelize[_0xf66e('0x2')]},'description':{'type':Sequelize[_0xf66e('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xf66e('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf66e('0x2')]},'url':{'type':Sequelize[_0xf66e('0x2')]},'facebook':{'type':Sequelize[_0xf66e('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xf66e('0x2')]},'skype':{'type':Sequelize[_0xf66e('0x2')]},'teams':{'type':Sequelize[_0xf66e('0x2')]},'viber':{'type':Sequelize[_0xf66e('0x2')]},'line':{'type':Sequelize[_0xf66e('0x2')]},'wechat':{'type':Sequelize[_0xf66e('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xf66e('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xf66e('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf66e('0x5')],'defaultValue':Sequelize[_0xf66e('0x6')]},'dialTimezone':{'type':Sequelize[_0xf66e('0x2')]},'utcOffset':{'type':Sequelize[_0xf66e('0x7')]}}; \ No newline at end of file +var _0x5802=['STRING','INTEGER','UNSIGNED','DATE','lodash','sequelize','exports'];(function(_0x30899c,_0x4a08a9){var _0x1aa246=function(_0x177694){while(--_0x177694){_0x30899c['push'](_0x30899c['shift']());}};_0x1aa246(++_0x4a08a9);}(_0x5802,0x12a));var _0x2580=function(_0x5ad67c,_0x144860){_0x5ad67c=_0x5ad67c-0x0;var _0xccce2e=_0x5802[_0x5ad67c];return _0xccce2e;};'use strict';var _=require(_0x2580('0x0'));var Sequelize=require(_0x2580('0x1'));module[_0x2580('0x2')]={'firstName':{'type':Sequelize[_0x2580('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x2580('0x3')]},'postalCode':{'type':Sequelize[_0x2580('0x3')]},'city':{'type':Sequelize[_0x2580('0x3')]},'country':{'type':Sequelize[_0x2580('0x3')]},'dateOfBirth':{'type':Sequelize[_0x2580('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x2580('0x3')]},'mobile':{'type':Sequelize[_0x2580('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x2580('0x3')]},'url':{'type':Sequelize[_0x2580('0x3')]},'facebook':{'type':Sequelize[_0x2580('0x3')]},'fb_data':{'type':Sequelize[_0x2580('0x3')]},'twitter':{'type':Sequelize[_0x2580('0x3')]},'skype':{'type':Sequelize[_0x2580('0x3')]},'teams':{'type':Sequelize[_0x2580('0x3')]},'viber':{'type':Sequelize[_0x2580('0x3')]},'line':{'type':Sequelize[_0x2580('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x2580('0x3')]},'UserId':{'type':Sequelize[_0x2580('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x2580('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x2580('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x2580('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 732abb1..8bc233d 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 53bbe52..682231a 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73da=['CmContact','setMaxListeners','save','remove','emit','exports','events','../../mysqldb'];(function(_0xeb29b5,_0x460b52){var _0x551565=function(_0x5eaa41){while(--_0x5eaa41){_0xeb29b5['push'](_0xeb29b5['shift']());}};_0x551565(++_0x460b52);}(_0x73da,0x136));var _0xa73d=function(_0x279645,_0x2ed6c5){_0x279645=_0x279645-0x0;var _0x1b6272=_0x73da[_0x279645];return _0x1b6272;};'use strict';var EventEmitter=require(_0xa73d('0x0'));var CmContact=require(_0xa73d('0x1'))['db'][_0xa73d('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xa73d('0x3')](0x0);var events={'afterCreate':_0xa73d('0x4'),'afterUpdate':'update','afterDestroy':_0xa73d('0x5')};function emitEvent(_0x40b69a){return function(_0x50513d,_0x590ba8,_0x160ab1){CmContactEvents[_0xa73d('0x6')](_0x40b69a+':'+_0x50513d['id'],_0x50513d);CmContactEvents[_0xa73d('0x6')](_0x40b69a,_0x50513d);_0x160ab1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xa73d('0x7')]=CmContactEvents; \ No newline at end of file +var _0x4f8c=['CmContact','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x4dc4f8,_0x2aa78a){var _0x3d1122=function(_0x20e0ce){while(--_0x20e0ce){_0x4dc4f8['push'](_0x4dc4f8['shift']());}};_0x3d1122(++_0x2aa78a);}(_0x4f8c,0x1b7));var _0xc4f8=function(_0x559320,_0xe481a2){_0x559320=_0x559320-0x0;var _0x3dabca=_0x4f8c[_0x559320];return _0x3dabca;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xc4f8('0x0'))['db'][_0xc4f8('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xc4f8('0x2')](0x0);var events={'afterCreate':_0xc4f8('0x3'),'afterUpdate':_0xc4f8('0x4'),'afterDestroy':_0xc4f8('0x5')};function emitEvent(_0x42066a){return function(_0x468232,_0x53dbb4,_0x4c1ff7){CmContactEvents[_0xc4f8('0x6')](_0x42066a+':'+_0x468232['id'],_0x468232);CmContactEvents[_0xc4f8('0x6')](_0x42066a,_0x468232);_0x4c1ff7(null);};}for(var e in events){if(events[_0xc4f8('0x7')](e)){var event=events[e];CmContact[_0xc4f8('0x8')](e,emitEvent(event));}}module[_0xc4f8('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 1d4ae16..caf5418 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa643=['phone','fti_cm_contacts','firstName','mobile','email','FULLTEXT','utf8mb4_unicode_ci','models','get','error','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','findOne','then','isNil','timezones','utcOffset','add','minutes','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','create','cmContact','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','onlyIfOpen','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','destroy','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','util','../../config/logger','api','moment','bluebird','../../config/environment','../../config/environment/shared','./cmContact.attributes','define','CmContact','cm_contacts'];(function(_0x47642a,_0x5c2651){var _0x1d674f=function(_0x1e4606){while(--_0x1e4606){_0x47642a['push'](_0x47642a['shift']());}};_0x1d674f(++_0x5c2651);}(_0xa643,0x119));var _0x3a64=function(_0x2cdf84,_0x5ed00f){_0x2cdf84=_0x2cdf84-0x0;var _0x2af121=_0xa643[_0x2cdf84];return _0x2af121;};'use strict';var _=require('lodash');var util=require(_0x3a64('0x0'));var logger=require(_0x3a64('0x1'))(_0x3a64('0x2'));var moment=require(_0x3a64('0x3'));var BPromise=require(_0x3a64('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3a64('0x5'));var shared=require(_0x3a64('0x6'));var attributes=require(_0x3a64('0x7'));module['exports']=function(_0x49c31d,_0x53c635){return _0x49c31d[_0x3a64('0x8')](_0x3a64('0x9'),attributes,{'tableName':_0x3a64('0xa'),'paranoid':!![],'indexes':[{'name':_0x3a64('0xb'),'fields':[_0x3a64('0xb')]},{'name':_0x3a64('0xc'),'fields':[_0x3a64('0xd'),'lastName',_0x3a64('0xb'),_0x3a64('0xe'),'fax',_0x3a64('0xf')],'type':_0x3a64('0x10')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x3a64('0x11'),'hooks':{'afterCreate':function(_0x31c1e3,_0x55396d,_0xf320c3){var _0x2df44b=_0x49c31d[_0x3a64('0x12')];var _0x4a54fc=_0x31c1e3[_0x3a64('0x13')]({'plain':!![]});function _0x3f0515(){return function(_0x16a8ab){logger[_0x3a64('0x14')]('cmContact',_0x3a64('0x15'),util[_0x3a64('0x16')](_0x16a8ab,{'showHidden':![],'depth':null}));};}function _0x348b54(_0x227da0,_0x2d0327){var _0x3d69b7=_0x2d0327[_0x3a64('0x17')]?_0x2d0327['scheduledat']:moment()[_0x3a64('0x18')](_0x3a64('0x19'));return new BPromise(function(_0x41b46d,_0x258dd6){if(_['isNil'](_0x2d0327[_0x3a64('0x1a')])){_0x41b46d({'ret':_0x3d69b7});}else{_0x2df44b['VoiceQueue'][_0x3a64('0x1b')]({'where':{'id':_0x227da0['id']}})[_0x3a64('0x1c')](function(_0x1f103e){if(!_[_0x3a64('0x1d')](_0x1f103e)){var _0x11074a=_0x1f103e[_0x3a64('0x1a')];if(!_[_0x3a64('0x1d')](_0x11074a)){var _0x15a4bd=shared[_0x3a64('0x1e')];var _0x2f8b48=_0x15a4bd[_0x11074a];var _0x19b2e0=_0x15a4bd[_0x2d0327['dialTimezone']];if(!_[_0x3a64('0x1d')](_0x2f8b48)&&!_[_0x3a64('0x1d')](_0x19b2e0)){var _0x15991a=_0x2f8b48[_0x3a64('0x1f')]-_0x19b2e0[_0x3a64('0x1f')];_0x3d69b7=_0x2d0327[_0x3a64('0x17')]?_0x2d0327['scheduledat']:moment();var _0x48f6fc=moment(_0x3d69b7)[_0x3a64('0x20')](_0x15991a,_0x3a64('0x21'));_0x41b46d({'ret':_0x48f6fc[_0x3a64('0x18')](_0x3a64('0x19'))});}else _0x41b46d({'ret':_0x3d69b7});}else _0x41b46d({'ret':_0x3d69b7});}else{_0x41b46d({'ret':_0x3d69b7});}});}});return 0xa;}var _0x21c8f3=function(_0x2ea3ba){return new BPromise(function(_0x9be972,_0x307deb){_0x348b54(_0x2ea3ba,_0x4a54fc)[_0x3a64('0x1c')](function(_0x8e54f9){_0x4a54fc[_0x3a64('0x17')]=_0x8e54f9[_0x3a64('0x22')];_0x2df44b['CmHopper']['findOne']({'where':{'phone':_0x4a54fc[_0x3a64('0xb')],'VoiceQueueId':_0x2ea3ba['id']}})[_0x3a64('0x1c')](function(_0x4b108d){if(!_[_0x3a64('0x1d')](_0x4b108d)){throw new Error(_0x3a64('0x23')+_0x4a54fc[_0x3a64('0xb')]+_0x3a64('0x24')+_0x2ea3ba['id']);}return _0x2df44b[_0x3a64('0x25')]['create']({'phone':_0x4a54fc['phone'],'ContactId':_0x4a54fc['id'],'ListId':_0x4a54fc[_0x3a64('0x26')],'priority':_0x4a54fc[_0x3a64('0x27')]?_0x4a54fc['priority']:0x2,'scheduledat':_0x4a54fc[_0x3a64('0x17')]?_0x4a54fc['scheduledat']:moment()[_0x3a64('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4a54fc[_0x3a64('0x28')]?!![]:![],'callbackuniqueid':_0x4a54fc[_0x3a64('0x28')]?_0x4a54fc[_0x3a64('0x28')]:undefined,'callbackat':_0x4a54fc[_0x3a64('0x28')]?moment()[_0x3a64('0x18')](_0x3a64('0x19')):undefined,'VoiceQueueId':_0x2ea3ba['id']});})[_0x3a64('0x29')](function(_0x426f6e){_0x307deb(_0x426f6e);});});});};var _0x1af555=function(_0x521db1){return new BPromise(function(_0x244ebb,_0x548964){_0x348b54(_0x521db1,_0x4a54fc)[_0x3a64('0x1c')](function(_0x40314f){_0x4a54fc['scheduledat']=_0x40314f[_0x3a64('0x22')];_0x2df44b[_0x3a64('0x25')][_0x3a64('0x1b')]({'where':{'phone':_0x4a54fc[_0x3a64('0xb')],'VoiceQueueId':_0x521db1['id']}})['then'](function(_0x35c9ce){if(!_[_0x3a64('0x1d')](_0x35c9ce)){throw new Error(_0x3a64('0x23')+_0x4a54fc[_0x3a64('0xb')]+_0x3a64('0x2a')+_0x521db1['id']);}return _0x2df44b[_0x3a64('0x2b')][_0x3a64('0x1b')]({'where':{'calleridnum':_0x4a54fc[_0x3a64('0xb')],'VoiceQueueId':_0x521db1['id']}});})[_0x3a64('0x1c')](function(_0x89b2c2){if(!_['isNil'](_0x89b2c2)){throw new Error(_0x3a64('0x2c')+_0x4a54fc[_0x3a64('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x521db1['id']);}return _0x2df44b[_0x3a64('0x25')][_0x3a64('0x2d')]({'phone':_0x4a54fc[_0x3a64('0xb')],'ContactId':_0x4a54fc['id'],'ListId':_0x4a54fc[_0x3a64('0x26')],'priority':_0x4a54fc['priority']?_0x4a54fc[_0x3a64('0x27')]:0x2,'scheduledat':_0x4a54fc[_0x3a64('0x17')]?_0x4a54fc['scheduledat']:moment()[_0x3a64('0x18')](_0x3a64('0x19')),'callback':_0x4a54fc[_0x3a64('0x28')]?!![]:![],'callbackuniqueid':_0x4a54fc['callbackUniqueid']?_0x4a54fc[_0x3a64('0x28')]:undefined,'callbackat':_0x4a54fc[_0x3a64('0x28')]?moment()[_0x3a64('0x18')](_0x3a64('0x19')):undefined,'VoiceQueueId':_0x521db1['id']});})[_0x3a64('0x29')](function(_0x1bd3fc){_0x548964(_0x1bd3fc);});});});};function _0x4c69a3(){return function(_0x11e727){logger['error'](_0x3a64('0x2e'),'afterCreate',util[_0x3a64('0x16')](_0x11e727,{'showHidden':![],'depth':null}));};}function _0x1b2937(_0x4e7ad2,_0x1198d6){var _0x280bf9=_0x1198d6[_0x3a64('0x17')]?_0x1198d6[_0x3a64('0x17')]:moment()[_0x3a64('0x18')](_0x3a64('0x19'));return new BPromise(function(_0xd80f29,_0x3519eb){if(_[_0x3a64('0x1d')](_0x1198d6['dialTimezone'])){_0xd80f29({'ret':_0x280bf9});}else{_0x2df44b[_0x3a64('0x2f')][_0x3a64('0x1b')]({'where':{'id':_0x4e7ad2['id']}})['then'](function(_0x313d58){if(!_[_0x3a64('0x1d')](_0x313d58)){var _0x44285c=_0x313d58[_0x3a64('0x1a')];if(!_['isNil'](_0x44285c)){var _0x4701e4=shared[_0x3a64('0x1e')];var _0x2e175b=_0x4701e4[_0x44285c];var _0x1fbff5=_0x4701e4[_0x1198d6[_0x3a64('0x1a')]];if(!_['isNil'](_0x2e175b)&&!_[_0x3a64('0x1d')](_0x1fbff5)){var _0x5dec10=_0x2e175b[_0x3a64('0x1f')]-_0x1fbff5[_0x3a64('0x1f')];_0x280bf9=_0x1198d6[_0x3a64('0x17')]?_0x1198d6[_0x3a64('0x17')]:moment();var _0x1653a3=moment(_0x280bf9)[_0x3a64('0x20')](_0x5dec10,'minutes');_0xd80f29({'ret':_0x1653a3[_0x3a64('0x18')](_0x3a64('0x19'))});}else _0xd80f29({'ret':_0x280bf9});}else _0xd80f29({'ret':_0x280bf9});}else{_0xd80f29({'ret':_0x280bf9});}});}});return 0xa;}var _0x3d7c3b=function(_0x2c0478){return new BPromise(function(_0x467355,_0x528f64){_0x1b2937(_0x2c0478,_0x4a54fc)[_0x3a64('0x1c')](function(_0x5938fa){_0x4a54fc[_0x3a64('0x17')]=_0x5938fa[_0x3a64('0x22')];_0x2df44b[_0x3a64('0x25')]['findOne']({'where':{'phone':_0x4a54fc[_0x3a64('0xb')],'CampaignId':_0x2c0478['id']}})['then'](function(_0xb19267){if(!_[_0x3a64('0x1d')](_0xb19267)){throw new Error(_0x3a64('0x23')+_0x4a54fc[_0x3a64('0xb')]+_0x3a64('0x30')+_0x2c0478['id']);}return _0x2df44b[_0x3a64('0x25')][_0x3a64('0x2d')]({'phone':_0x4a54fc['phone'],'ContactId':_0x4a54fc['id'],'ListId':_0x4a54fc['ListId'],'priority':_0x4a54fc[_0x3a64('0x27')]?_0x4a54fc[_0x3a64('0x27')]:0x2,'scheduledat':_0x4a54fc['scheduledat']?_0x4a54fc[_0x3a64('0x17')]:moment()[_0x3a64('0x18')](_0x3a64('0x19')),'callback':_0x4a54fc[_0x3a64('0x28')]?!![]:![],'callbackuniqueid':_0x4a54fc[_0x3a64('0x28')]?_0x4a54fc['callbackUniqueid']:undefined,'callbackat':_0x4a54fc[_0x3a64('0x28')]?moment()[_0x3a64('0x18')](_0x3a64('0x19')):undefined,'CampaignId':_0x2c0478['id']});})['catch'](function(_0x4f9bed){_0x528f64(_0x4f9bed);});});});};var _0x2dddd2=function(_0x5a2129){return new BPromise(function(_0x19a776,_0x114e98){_0x1b2937(_0x5a2129,_0x4a54fc)['then'](function(_0x413f43){_0x4a54fc[_0x3a64('0x17')]=_0x413f43[_0x3a64('0x22')];_0x2df44b[_0x3a64('0x25')]['findOne']({'where':{'phone':_0x4a54fc[_0x3a64('0xb')],'CampaignId':_0x5a2129['id']}})['then'](function(_0x4427d2){if(!_[_0x3a64('0x1d')](_0x4427d2)){throw new Error(_0x3a64('0x23')+_0x4a54fc[_0x3a64('0xb')]+_0x3a64('0x31')+_0x5a2129['id']);}return _0x2df44b['CmHopperFinal'][_0x3a64('0x1b')]({'where':{'calleridnum':_0x4a54fc[_0x3a64('0xb')],'CampaignId':_0x5a2129['id']}});})[_0x3a64('0x1c')](function(_0x1e91a0){if(!_['isNil'](_0x1e91a0)){throw new Error(_0x3a64('0x2c')+_0x4a54fc['phone']+_0x3a64('0x32')+_0x5a2129['id']);}return _0x2df44b[_0x3a64('0x25')][_0x3a64('0x2d')]({'phone':_0x4a54fc[_0x3a64('0xb')],'ContactId':_0x4a54fc['id'],'ListId':_0x4a54fc[_0x3a64('0x26')],'priority':_0x4a54fc[_0x3a64('0x27')]?_0x4a54fc[_0x3a64('0x27')]:0x2,'scheduledat':_0x4a54fc[_0x3a64('0x17')]?_0x4a54fc[_0x3a64('0x17')]:moment()[_0x3a64('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4a54fc[_0x3a64('0x28')]?!![]:![],'callbackuniqueid':_0x4a54fc['callbackUniqueid']?_0x4a54fc[_0x3a64('0x28')]:undefined,'callbackat':_0x4a54fc[_0x3a64('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x5a2129['id']});})['catch'](function(_0x4d9c36){_0x114e98(_0x4d9c36);});});});};if(_0x4a54fc[_0x3a64('0x26')]){_0x2df44b[_0x3a64('0x33')][_0x3a64('0x34')]({'where':{'type':_0x3a64('0x35')},'attributes':['id',_0x3a64('0x36'),_0x3a64('0x1a')],'include':[{'model':_0x2df44b[_0x3a64('0x37')],'as':_0x3a64('0x38'),'where':{'id':_0x4a54fc[_0x3a64('0x26')]}}]})[_0x3a64('0x1c')](function(_0x5d21ae){if(_0x5d21ae){var _0x30a450=[];for(var _0x400874=0x0,_0x1ac2e7;_0x400874<_0x5d21ae['length'];_0x400874+=0x1){_0x1ac2e7=_0x5d21ae[_0x400874][_0x3a64('0x13')]({'plain':!![]});switch(_0x1ac2e7[_0x3a64('0x36')]){case _0x3a64('0x39'):_0x1af555(_0x1ac2e7)[_0x3a64('0x29')](_0x3f0515());break;case _0x3a64('0x3a'):_0x21c8f3(_0x1ac2e7)[_0x3a64('0x29')](_0x3f0515());break;default:_0x1b2937(_0x1ac2e7,_0x4a54fc)[_0x3a64('0x1c')](function(_0x43c889){_0x4a54fc[_0x3a64('0x17')]=_0x43c889[_0x3a64('0x22')];_0x2df44b[_0x3a64('0x25')][_0x3a64('0x2d')]({'phone':_0x4a54fc[_0x3a64('0xb')],'ContactId':_0x4a54fc['id'],'ListId':_0x4a54fc[_0x3a64('0x26')],'scheduledat':_0x4a54fc[_0x3a64('0x17')]?_0x4a54fc[_0x3a64('0x17')]:moment()[_0x3a64('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x4a54fc[_0x3a64('0x27')]?_0x4a54fc['priority']:0x2,'callback':_0x4a54fc[_0x3a64('0x28')]?!![]:![],'callbackuniqueid':_0x4a54fc[_0x3a64('0x28')]?_0x4a54fc[_0x3a64('0x28')]:undefined,'callbackat':_0x4a54fc[_0x3a64('0x28')]?moment()[_0x3a64('0x18')](_0x3a64('0x19')):undefined,'VoiceQueueId':_0x1ac2e7['id']})[_0x3a64('0x29')](_0x3f0515());});}}}})['then'](function(){return _0x2df44b[_0x3a64('0x33')]['findAll']({'where':{'type':_0x3a64('0x35')},'attributes':['id'],'include':[{'model':_0x2df44b[_0x3a64('0x37')],'as':_0x3a64('0x3b'),'where':{'id':_0x4a54fc[_0x3a64('0x26')]}}]})[_0x3a64('0x1c')](function(_0x4bef6a){if(_0x4bef6a){var _0x16419c=[];for(var _0x33a7d9=0x0,_0x464bb4;_0x33a7d9<_0x4bef6a[_0x3a64('0x3c')];_0x33a7d9+=0x1){_0x464bb4=_0x4bef6a[_0x33a7d9][_0x3a64('0x13')]({'plain':!![]});_0x2df44b[_0x3a64('0x3d')][_0x3a64('0x2d')]({'phone':_0x4a54fc['phone'],'ContactId':_0x4a54fc['id'],'ListId':_0x4a54fc[_0x3a64('0x26')],'VoiceQueueId':_0x464bb4['id']})[_0x3a64('0x29')](function(_0x1d0f5c){logger[_0x3a64('0x14')](_0x3a64('0x3e'),'afterCreate',_0x1d0f5c[_0x3a64('0x3f')]);});}}});})[_0x3a64('0x1c')](function(){return _0x2df44b[_0x3a64('0x2f')][_0x3a64('0x34')]({'attributes':['id',_0x3a64('0x36'),_0x3a64('0x1a')],'include':[{'model':_0x2df44b[_0x3a64('0x37')],'as':_0x3a64('0x38'),'where':{'id':_0x4a54fc[_0x3a64('0x26')]}}]})[_0x3a64('0x1c')](function(_0x1c08b1){if(_0x1c08b1){var _0x37f504=[];for(var _0x13af15=0x0,_0xea20df;_0x13af15<_0x1c08b1[_0x3a64('0x3c')];_0x13af15+=0x1){_0xea20df=_0x1c08b1[_0x13af15][_0x3a64('0x13')]({'plain':!![]});switch(_0xea20df['dialCheckDuplicateType']){case'always':_0x2dddd2(_0xea20df)[_0x3a64('0x29')](_0x4c69a3());break;case _0x3a64('0x3a'):_0x3d7c3b(_0xea20df)['catch'](_0x4c69a3());break;default:_0x2df44b[_0x3a64('0x25')]['create']({'phone':_0x4a54fc['phone'],'ContactId':_0x4a54fc['id'],'ListId':_0x4a54fc['ListId'],'scheduledat':_0x4a54fc[_0x3a64('0x17')]?_0x4a54fc[_0x3a64('0x17')]:moment()[_0x3a64('0x18')](_0x3a64('0x19')),'priority':_0x4a54fc[_0x3a64('0x27')]?_0x4a54fc[_0x3a64('0x27')]:0x2,'callback':_0x4a54fc[_0x3a64('0x28')]?!![]:![],'callbackuniqueid':_0x4a54fc[_0x3a64('0x28')]?_0x4a54fc[_0x3a64('0x28')]:undefined,'callbackat':_0x4a54fc[_0x3a64('0x28')]?moment()[_0x3a64('0x18')](_0x3a64('0x19')):undefined,'CampaignId':_0xea20df['id']})['catch'](_0x4c69a3());}}}});})[_0x3a64('0x1c')](function(){return _0x2df44b[_0x3a64('0x2f')][_0x3a64('0x34')]({'attributes':['id'],'include':[{'model':_0x2df44b['CmList'],'as':'BlackLists','where':{'id':_0x4a54fc[_0x3a64('0x26')]}}]})[_0x3a64('0x1c')](function(_0x26e5eb){if(_0x26e5eb){var _0x15947d=[];for(var _0x4c9075=0x0,_0x2f18fd;_0x4c9075<_0x26e5eb[_0x3a64('0x3c')];_0x4c9075+=0x1){_0x2f18fd=_0x26e5eb[_0x4c9075][_0x3a64('0x13')]({'plain':!![]});_0x2df44b[_0x3a64('0x3d')]['create']({'phone':_0x4a54fc[_0x3a64('0xb')],'ContactId':_0x4a54fc['id'],'ListId':_0x4a54fc[_0x3a64('0x26')],'CampaignId':_0x2f18fd['id']})['catch'](function(_0x20c0e4){logger[_0x3a64('0x14')](_0x3a64('0x3e'),_0x3a64('0x15'),_0x20c0e4[_0x3a64('0x3f')]);});}}});})[_0x3a64('0x1c')](function(){_0xf320c3();})[_0x3a64('0x29')](function(_0xbc1080){logger[_0x3a64('0x14')]('cmContact,\x20%s,\x20%s','afterCreate',_0xbc1080[_0x3a64('0x3f')]);_0xf320c3(_0xbc1080);});}else{_0xf320c3(new Error(_0x3a64('0x40')));}},'afterDestroy':function(_0x28b6e0,_0x3a350a,_0x3fa957){var _0x5bdb5b=_0x49c31d['models'];var _0x547937=_0x28b6e0['get']({'plain':!![]});return _0x5bdb5b['CmHopper'][_0x3a64('0x34')]({'raw':!![],'where':{'ListId':_0x547937[_0x3a64('0x26')],'ContactId':_0x547937['id']}})[_0x3a64('0x1c')](function(_0x4ae22a){if(!_['isEmpty'](_0x4ae22a)){var _0x3a007f=[];for(var _0x1acd5f=0x0;_0x1acd5f<_0x4ae22a[_0x3a64('0x3c')];_0x1acd5f+=0x1){var _0x3a6d91=_0x5bdb5b['CmHopper'][_0x3a64('0x41')]({'where':{'ListId':_0x4ae22a[_0x1acd5f][_0x3a64('0x26')],'ContactId':_0x4ae22a[_0x1acd5f][_0x3a64('0x42')],'VoiceQueueId':_0x4ae22a[_0x1acd5f][_0x3a64('0x43')],'CampaignId':_0x4ae22a[_0x1acd5f]['CampaignId']}});_0x3a007f[_0x3a64('0x44')](_0x3a6d91);}return BPromise[_0x3a64('0x45')](_0x3a007f);}})[_0x3a64('0x1c')](function(_0x19817e){logger[_0x3a64('0x46')](_0x3a64('0x47'),util[_0x3a64('0x16')](_0x19817e,{'showHidden':![],'depth':null}));_0x3fa957();})['catch'](function(_0x1efb0b){logger[_0x3a64('0x14')](_0x3a64('0x48'),util[_0x3a64('0x16')](_0x1efb0b,{'showHidden':![],'depth':null}));_0x3fa957(_0x1efb0b);});}}});}; \ No newline at end of file +var _0xfd69=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','always','onlyIfOpen','findAll','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','isEmpty','ContactId','VoiceQueueId','CampaignId','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4_unicode_ci','models','get','cmContact','afterCreate','scheduledat','format','isNil','findOne','then','dialTimezone','timezones','utcOffset','minutes','YYYY-MM-DD\x20HH:mm:ss','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','error','inspect','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','create','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'];(function(_0x56f6d3,_0x4ab677){var _0x4a262b=function(_0x1cfd13){while(--_0x1cfd13){_0x56f6d3['push'](_0x56f6d3['shift']());}};_0x4a262b(++_0x4ab677);}(_0xfd69,0xf7));var _0x9fd6=function(_0x535f35,_0x2414f6){_0x535f35=_0x535f35-0x0;var _0x24d37d=_0xfd69[_0x535f35];return _0x24d37d;};'use strict';var _=require(_0x9fd6('0x0'));var util=require(_0x9fd6('0x1'));var logger=require(_0x9fd6('0x2'))(_0x9fd6('0x3'));var moment=require(_0x9fd6('0x4'));var BPromise=require(_0x9fd6('0x5'));var rp=require(_0x9fd6('0x6'));var fs=require('fs');var path=require(_0x9fd6('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var shared=require(_0x9fd6('0x8'));var attributes=require(_0x9fd6('0x9'));module[_0x9fd6('0xa')]=function(_0x9d3e13,_0x292be9){return _0x9d3e13[_0x9fd6('0xb')](_0x9fd6('0xc'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x9fd6('0xd'),'fields':[_0x9fd6('0xd')]},{'name':_0x9fd6('0xe'),'fields':[_0x9fd6('0xf'),_0x9fd6('0x10'),_0x9fd6('0xd'),_0x9fd6('0x11'),_0x9fd6('0x12'),_0x9fd6('0x13')],'type':_0x9fd6('0x14')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x9fd6('0x15'),'hooks':{'afterCreate':function(_0x57c11e,_0x5e17c8,_0x438cd0){var _0x4181df=_0x9d3e13[_0x9fd6('0x16')];var _0x558b8e=_0x57c11e[_0x9fd6('0x17')]({'plain':!![]});function _0xd34820(){return function(_0x4dd127){logger['error'](_0x9fd6('0x18'),_0x9fd6('0x19'),util['inspect'](_0x4dd127,{'showHidden':![],'depth':null}));};}function _0x286480(_0x264334,_0x57b41b){var _0x57376a=_0x57b41b[_0x9fd6('0x1a')]?_0x57b41b['scheduledat']:moment()[_0x9fd6('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x28cd35,_0x5432cc){if(_[_0x9fd6('0x1c')](_0x57b41b['dialTimezone'])){_0x28cd35({'ret':_0x57376a});}else{_0x4181df['VoiceQueue'][_0x9fd6('0x1d')]({'where':{'id':_0x264334['id']}})[_0x9fd6('0x1e')](function(_0x3fbd0b){if(!_[_0x9fd6('0x1c')](_0x3fbd0b)){var _0x2f2186=_0x3fbd0b[_0x9fd6('0x1f')];if(!_['isNil'](_0x2f2186)){var _0x2ff086=shared[_0x9fd6('0x20')];var _0x490b04=_0x2ff086[_0x2f2186];var _0x230766=_0x2ff086[_0x57b41b[_0x9fd6('0x1f')]];if(!_['isNil'](_0x490b04)&&!_[_0x9fd6('0x1c')](_0x230766)){var _0x1169d5=_0x490b04[_0x9fd6('0x21')]-_0x230766[_0x9fd6('0x21')];_0x57376a=_0x57b41b[_0x9fd6('0x1a')]?_0x57b41b[_0x9fd6('0x1a')]:moment();var _0x71abbf=moment(_0x57376a)['add'](_0x1169d5,_0x9fd6('0x22'));_0x28cd35({'ret':_0x71abbf['format'](_0x9fd6('0x23'))});}else _0x28cd35({'ret':_0x57376a});}else _0x28cd35({'ret':_0x57376a});}else{_0x28cd35({'ret':_0x57376a});}});}});return 0xa;}var _0xd7b2cd=function(_0x461195){return new BPromise(function(_0x2afaff,_0x1fe17c){_0x286480(_0x461195,_0x558b8e)[_0x9fd6('0x1e')](function(_0x391b1b){_0x558b8e[_0x9fd6('0x1a')]=_0x391b1b[_0x9fd6('0x24')];_0x4181df[_0x9fd6('0x25')]['findOne']({'where':{'phone':_0x558b8e['phone'],'VoiceQueueId':_0x461195['id']}})['then'](function(_0x54316c){if(!_[_0x9fd6('0x1c')](_0x54316c)){throw new Error(_0x9fd6('0x26')+_0x558b8e[_0x9fd6('0xd')]+_0x9fd6('0x27')+_0x461195['id']);}return _0x4181df[_0x9fd6('0x25')]['create']({'phone':_0x558b8e['phone'],'ContactId':_0x558b8e['id'],'ListId':_0x558b8e[_0x9fd6('0x28')],'priority':_0x558b8e[_0x9fd6('0x29')]?_0x558b8e[_0x9fd6('0x29')]:0x2,'scheduledat':_0x558b8e[_0x9fd6('0x1a')]?_0x558b8e['scheduledat']:moment()[_0x9fd6('0x1b')](_0x9fd6('0x23')),'callback':_0x558b8e[_0x9fd6('0x2a')]?!![]:![],'callbackuniqueid':_0x558b8e['callbackUniqueid']?_0x558b8e[_0x9fd6('0x2a')]:undefined,'callbackat':_0x558b8e['callbackUniqueid']?moment()[_0x9fd6('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x461195['id']});})[_0x9fd6('0x2b')](function(_0x56f9f4){_0x1fe17c(_0x56f9f4);});});});};var _0x45a331=function(_0x344b66){return new BPromise(function(_0x16ccd3,_0x4306c2){_0x286480(_0x344b66,_0x558b8e)[_0x9fd6('0x1e')](function(_0x455dc0){_0x558b8e[_0x9fd6('0x1a')]=_0x455dc0['ret'];_0x4181df[_0x9fd6('0x25')][_0x9fd6('0x1d')]({'where':{'phone':_0x558b8e[_0x9fd6('0xd')],'VoiceQueueId':_0x344b66['id']}})[_0x9fd6('0x1e')](function(_0x1ba7e8){if(!_[_0x9fd6('0x1c')](_0x1ba7e8)){throw new Error(_0x9fd6('0x26')+_0x558b8e[_0x9fd6('0xd')]+_0x9fd6('0x2c')+_0x344b66['id']);}return _0x4181df[_0x9fd6('0x2d')][_0x9fd6('0x1d')]({'where':{'calleridnum':_0x558b8e[_0x9fd6('0xd')],'VoiceQueueId':_0x344b66['id']}});})[_0x9fd6('0x1e')](function(_0x2c8c21){if(!_[_0x9fd6('0x1c')](_0x2c8c21)){throw new Error(_0x9fd6('0x2e')+_0x558b8e[_0x9fd6('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x344b66['id']);}return _0x4181df['CmHopper']['create']({'phone':_0x558b8e[_0x9fd6('0xd')],'ContactId':_0x558b8e['id'],'ListId':_0x558b8e[_0x9fd6('0x28')],'priority':_0x558b8e[_0x9fd6('0x29')]?_0x558b8e[_0x9fd6('0x29')]:0x2,'scheduledat':_0x558b8e[_0x9fd6('0x1a')]?_0x558b8e[_0x9fd6('0x1a')]:moment()[_0x9fd6('0x1b')](_0x9fd6('0x23')),'callback':_0x558b8e[_0x9fd6('0x2a')]?!![]:![],'callbackuniqueid':_0x558b8e[_0x9fd6('0x2a')]?_0x558b8e[_0x9fd6('0x2a')]:undefined,'callbackat':_0x558b8e[_0x9fd6('0x2a')]?moment()[_0x9fd6('0x1b')](_0x9fd6('0x23')):undefined,'VoiceQueueId':_0x344b66['id']});})[_0x9fd6('0x2b')](function(_0x1a3240){_0x4306c2(_0x1a3240);});});});};function _0x25fba5(){return function(_0x20d19f){logger[_0x9fd6('0x2f')](_0x9fd6('0x18'),'afterCreate',util[_0x9fd6('0x30')](_0x20d19f,{'showHidden':![],'depth':null}));};}function _0x54d7aa(_0x4abb11,_0x344179){var _0xd8ca4d=_0x344179[_0x9fd6('0x1a')]?_0x344179[_0x9fd6('0x1a')]:moment()[_0x9fd6('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x4afdf8,_0x31d9af){if(_[_0x9fd6('0x1c')](_0x344179[_0x9fd6('0x1f')])){_0x4afdf8({'ret':_0xd8ca4d});}else{_0x4181df['Campaign']['findOne']({'where':{'id':_0x4abb11['id']}})['then'](function(_0x8c50ce){if(!_[_0x9fd6('0x1c')](_0x8c50ce)){var _0x39fb53=_0x8c50ce[_0x9fd6('0x1f')];if(!_['isNil'](_0x39fb53)){var _0x22abde=shared[_0x9fd6('0x20')];var _0x3a22c8=_0x22abde[_0x39fb53];var _0x587380=_0x22abde[_0x344179['dialTimezone']];if(!_[_0x9fd6('0x1c')](_0x3a22c8)&&!_[_0x9fd6('0x1c')](_0x587380)){var _0xcf4807=_0x3a22c8[_0x9fd6('0x21')]-_0x587380[_0x9fd6('0x21')];_0xd8ca4d=_0x344179[_0x9fd6('0x1a')]?_0x344179[_0x9fd6('0x1a')]:moment();var _0x57ca0f=moment(_0xd8ca4d)[_0x9fd6('0x31')](_0xcf4807,_0x9fd6('0x22'));_0x4afdf8({'ret':_0x57ca0f[_0x9fd6('0x1b')](_0x9fd6('0x23'))});}else _0x4afdf8({'ret':_0xd8ca4d});}else _0x4afdf8({'ret':_0xd8ca4d});}else{_0x4afdf8({'ret':_0xd8ca4d});}});}});return 0xa;}var _0x44eba1=function(_0x3bde63){return new BPromise(function(_0x5dba34,_0x30c913){_0x54d7aa(_0x3bde63,_0x558b8e)['then'](function(_0x56533b){_0x558b8e[_0x9fd6('0x1a')]=_0x56533b[_0x9fd6('0x24')];_0x4181df[_0x9fd6('0x25')][_0x9fd6('0x1d')]({'where':{'phone':_0x558b8e[_0x9fd6('0xd')],'CampaignId':_0x3bde63['id']}})[_0x9fd6('0x1e')](function(_0xa12a95){if(!_['isNil'](_0xa12a95)){throw new Error(_0x9fd6('0x26')+_0x558b8e[_0x9fd6('0xd')]+_0x9fd6('0x32')+_0x3bde63['id']);}return _0x4181df[_0x9fd6('0x25')][_0x9fd6('0x33')]({'phone':_0x558b8e[_0x9fd6('0xd')],'ContactId':_0x558b8e['id'],'ListId':_0x558b8e[_0x9fd6('0x28')],'priority':_0x558b8e['priority']?_0x558b8e['priority']:0x2,'scheduledat':_0x558b8e[_0x9fd6('0x1a')]?_0x558b8e[_0x9fd6('0x1a')]:moment()['format'](_0x9fd6('0x23')),'callback':_0x558b8e[_0x9fd6('0x2a')]?!![]:![],'callbackuniqueid':_0x558b8e[_0x9fd6('0x2a')]?_0x558b8e[_0x9fd6('0x2a')]:undefined,'callbackat':_0x558b8e[_0x9fd6('0x2a')]?moment()['format'](_0x9fd6('0x23')):undefined,'CampaignId':_0x3bde63['id']});})[_0x9fd6('0x2b')](function(_0x19c915){_0x30c913(_0x19c915);});});});};var _0x3212ed=function(_0x54fb11){return new BPromise(function(_0x261629,_0x509bb7){_0x54d7aa(_0x54fb11,_0x558b8e)['then'](function(_0x4b810b){_0x558b8e['scheduledat']=_0x4b810b[_0x9fd6('0x24')];_0x4181df[_0x9fd6('0x25')][_0x9fd6('0x1d')]({'where':{'phone':_0x558b8e[_0x9fd6('0xd')],'CampaignId':_0x54fb11['id']}})[_0x9fd6('0x1e')](function(_0x144222){if(!_[_0x9fd6('0x1c')](_0x144222)){throw new Error(_0x9fd6('0x26')+_0x558b8e[_0x9fd6('0xd')]+_0x9fd6('0x34')+_0x54fb11['id']);}return _0x4181df[_0x9fd6('0x2d')]['findOne']({'where':{'calleridnum':_0x558b8e[_0x9fd6('0xd')],'CampaignId':_0x54fb11['id']}});})[_0x9fd6('0x1e')](function(_0x372bcf){if(!_[_0x9fd6('0x1c')](_0x372bcf)){throw new Error(_0x9fd6('0x2e')+_0x558b8e[_0x9fd6('0xd')]+_0x9fd6('0x35')+_0x54fb11['id']);}return _0x4181df['CmHopper'][_0x9fd6('0x33')]({'phone':_0x558b8e['phone'],'ContactId':_0x558b8e['id'],'ListId':_0x558b8e[_0x9fd6('0x28')],'priority':_0x558b8e[_0x9fd6('0x29')]?_0x558b8e['priority']:0x2,'scheduledat':_0x558b8e[_0x9fd6('0x1a')]?_0x558b8e[_0x9fd6('0x1a')]:moment()[_0x9fd6('0x1b')](_0x9fd6('0x23')),'callback':_0x558b8e[_0x9fd6('0x2a')]?!![]:![],'callbackuniqueid':_0x558b8e[_0x9fd6('0x2a')]?_0x558b8e[_0x9fd6('0x2a')]:undefined,'callbackat':_0x558b8e[_0x9fd6('0x2a')]?moment()[_0x9fd6('0x1b')](_0x9fd6('0x23')):undefined,'CampaignId':_0x54fb11['id']});})[_0x9fd6('0x2b')](function(_0x2c25eb){_0x509bb7(_0x2c25eb);});});});};if(_0x558b8e[_0x9fd6('0x28')]){_0x4181df[_0x9fd6('0x36')]['findAll']({'where':{'type':_0x9fd6('0x37')},'attributes':['id',_0x9fd6('0x38'),'dialTimezone'],'include':[{'model':_0x4181df[_0x9fd6('0x39')],'as':_0x9fd6('0x3a'),'where':{'id':_0x558b8e['ListId']}}]})[_0x9fd6('0x1e')](function(_0x4e8d11){if(_0x4e8d11){var _0x423af0=[];for(var _0x392001=0x0,_0x384be7;_0x392001<_0x4e8d11['length'];_0x392001+=0x1){_0x384be7=_0x4e8d11[_0x392001]['get']({'plain':!![]});switch(_0x384be7[_0x9fd6('0x38')]){case _0x9fd6('0x3b'):_0x45a331(_0x384be7)[_0x9fd6('0x2b')](_0xd34820());break;case _0x9fd6('0x3c'):_0xd7b2cd(_0x384be7)[_0x9fd6('0x2b')](_0xd34820());break;default:_0x54d7aa(_0x384be7,_0x558b8e)[_0x9fd6('0x1e')](function(_0x178704){_0x558b8e[_0x9fd6('0x1a')]=_0x178704[_0x9fd6('0x24')];_0x4181df[_0x9fd6('0x25')][_0x9fd6('0x33')]({'phone':_0x558b8e['phone'],'ContactId':_0x558b8e['id'],'ListId':_0x558b8e[_0x9fd6('0x28')],'scheduledat':_0x558b8e[_0x9fd6('0x1a')]?_0x558b8e[_0x9fd6('0x1a')]:moment()['format'](_0x9fd6('0x23')),'priority':_0x558b8e[_0x9fd6('0x29')]?_0x558b8e[_0x9fd6('0x29')]:0x2,'callback':_0x558b8e['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x558b8e[_0x9fd6('0x2a')]?_0x558b8e[_0x9fd6('0x2a')]:undefined,'callbackat':_0x558b8e['callbackUniqueid']?moment()[_0x9fd6('0x1b')](_0x9fd6('0x23')):undefined,'VoiceQueueId':_0x384be7['id']})[_0x9fd6('0x2b')](_0xd34820());});}}}})[_0x9fd6('0x1e')](function(){return _0x4181df[_0x9fd6('0x36')][_0x9fd6('0x3d')]({'where':{'type':_0x9fd6('0x37')},'attributes':['id'],'include':[{'model':_0x4181df[_0x9fd6('0x39')],'as':_0x9fd6('0x3e'),'where':{'id':_0x558b8e['ListId']}}]})[_0x9fd6('0x1e')](function(_0x322082){if(_0x322082){var _0x2a8d93=[];for(var _0xc76890=0x0,_0x23424f;_0xc76890<_0x322082[_0x9fd6('0x3f')];_0xc76890+=0x1){_0x23424f=_0x322082[_0xc76890][_0x9fd6('0x17')]({'plain':!![]});_0x4181df[_0x9fd6('0x40')][_0x9fd6('0x33')]({'phone':_0x558b8e[_0x9fd6('0xd')],'ContactId':_0x558b8e['id'],'ListId':_0x558b8e['ListId'],'VoiceQueueId':_0x23424f['id']})['catch'](function(_0x12baaf){logger[_0x9fd6('0x2f')](_0x9fd6('0x41'),'afterCreate',_0x12baaf[_0x9fd6('0x42')]);});}}});})['then'](function(){return _0x4181df[_0x9fd6('0x43')][_0x9fd6('0x3d')]({'attributes':['id',_0x9fd6('0x38'),_0x9fd6('0x1f')],'include':[{'model':_0x4181df[_0x9fd6('0x39')],'as':_0x9fd6('0x3a'),'where':{'id':_0x558b8e[_0x9fd6('0x28')]}}]})[_0x9fd6('0x1e')](function(_0x31267a){if(_0x31267a){var _0xee5675=[];for(var _0x2a2e73=0x0,_0x5c640f;_0x2a2e73<_0x31267a[_0x9fd6('0x3f')];_0x2a2e73+=0x1){_0x5c640f=_0x31267a[_0x2a2e73][_0x9fd6('0x17')]({'plain':!![]});switch(_0x5c640f[_0x9fd6('0x38')]){case _0x9fd6('0x3b'):_0x3212ed(_0x5c640f)[_0x9fd6('0x2b')](_0x25fba5());break;case _0x9fd6('0x3c'):_0x44eba1(_0x5c640f)[_0x9fd6('0x2b')](_0x25fba5());break;default:_0x4181df[_0x9fd6('0x25')][_0x9fd6('0x33')]({'phone':_0x558b8e[_0x9fd6('0xd')],'ContactId':_0x558b8e['id'],'ListId':_0x558b8e[_0x9fd6('0x28')],'scheduledat':_0x558b8e[_0x9fd6('0x1a')]?_0x558b8e[_0x9fd6('0x1a')]:moment()['format'](_0x9fd6('0x23')),'priority':_0x558b8e[_0x9fd6('0x29')]?_0x558b8e['priority']:0x2,'callback':_0x558b8e[_0x9fd6('0x2a')]?!![]:![],'callbackuniqueid':_0x558b8e[_0x9fd6('0x2a')]?_0x558b8e[_0x9fd6('0x2a')]:undefined,'callbackat':_0x558b8e[_0x9fd6('0x2a')]?moment()[_0x9fd6('0x1b')](_0x9fd6('0x23')):undefined,'CampaignId':_0x5c640f['id']})['catch'](_0x25fba5());}}}});})['then'](function(){return _0x4181df[_0x9fd6('0x43')][_0x9fd6('0x3d')]({'attributes':['id'],'include':[{'model':_0x4181df['CmList'],'as':_0x9fd6('0x3e'),'where':{'id':_0x558b8e[_0x9fd6('0x28')]}}]})['then'](function(_0x298271){if(_0x298271){var _0x501985=[];for(var _0x1da416=0x0,_0x2a1164;_0x1da416<_0x298271[_0x9fd6('0x3f')];_0x1da416+=0x1){_0x2a1164=_0x298271[_0x1da416]['get']({'plain':!![]});_0x4181df[_0x9fd6('0x40')]['create']({'phone':_0x558b8e['phone'],'ContactId':_0x558b8e['id'],'ListId':_0x558b8e[_0x9fd6('0x28')],'CampaignId':_0x2a1164['id']})['catch'](function(_0x4cdb94){logger['error'](_0x9fd6('0x41'),'afterCreate',_0x4cdb94[_0x9fd6('0x42')]);});}}});})[_0x9fd6('0x1e')](function(){_0x438cd0();})['catch'](function(_0x46a9e1){logger[_0x9fd6('0x2f')]('cmContact,\x20%s,\x20%s',_0x9fd6('0x19'),_0x46a9e1[_0x9fd6('0x42')]);_0x438cd0(_0x46a9e1);});}else{_0x438cd0(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x42d436,_0x2dae87,_0x263e14){var _0x1956de=_0x9d3e13['models'];var _0x5e6ddf=_0x42d436[_0x9fd6('0x17')]({'plain':!![]});return _0x1956de['CmHopper']['findAll']({'raw':!![],'where':{'ListId':_0x5e6ddf['ListId'],'ContactId':_0x5e6ddf['id']}})[_0x9fd6('0x1e')](function(_0x342da3){if(!_[_0x9fd6('0x44')](_0x342da3)){var _0x4bf9a4=[];for(var _0x58dc14=0x0;_0x58dc14<_0x342da3['length'];_0x58dc14+=0x1){var _0x4582ae=_0x1956de[_0x9fd6('0x25')]['destroy']({'where':{'ListId':_0x342da3[_0x58dc14][_0x9fd6('0x28')],'ContactId':_0x342da3[_0x58dc14][_0x9fd6('0x45')],'VoiceQueueId':_0x342da3[_0x58dc14][_0x9fd6('0x46')],'CampaignId':_0x342da3[_0x58dc14][_0x9fd6('0x47')]}});_0x4bf9a4['push'](_0x4582ae);}return BPromise['all'](_0x4bf9a4);}})[_0x9fd6('0x1e')](function(_0x4dbdea){logger[_0x9fd6('0x48')](_0x9fd6('0x49'),util[_0x9fd6('0x30')](_0x4dbdea,{'showHidden':![],'depth':null}));_0x263e14();})['catch'](function(_0x1a2c80){logger[_0x9fd6('0x2f')](_0x9fd6('0x4a'),util['inspect'](_0x1a2c80,{'showHidden':![],'depth':null}));_0x263e14(_0x1a2c80);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 3848d19..02a35ea 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x24954e,_0x2a7923){var _0x184093=function(_0x1c3c9d){while(--_0x1c3c9d){_0x24954e['push'](_0x24954e['shift']());}};_0x184093(++_0x2a7923);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x3796de,_0x5b2545){var _0x135b02=function(_0x4d0abd){while(--_0x4d0abd){_0x3796de['push'](_0x3796de['shift']());}};_0x135b02(++_0x5b2545);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 237d1db..7bc2912 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9990=['STRING','PHONE','exports','INTEGER'];(function(_0x33d020,_0x5249f4){var _0xc3bfca=function(_0x459212){while(--_0x459212){_0x33d020['push'](_0x33d020['shift']());}};_0xc3bfca(++_0x5249f4);}(_0x9990,0xf6));var _0x0999=function(_0x158988,_0x30addd){_0x158988=_0x158988-0x0;var _0x2bd5cd=_0x9990[_0x158988];return _0x2bd5cd;};'use strict';var Sequelize=require('sequelize');module[_0x0999('0x0')]={'CmContactId':{'type':Sequelize[_0x0999('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x0999('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x0999('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x0999('0x2')],'defaultValue':_0x0999('0x3')},'OrderBy':{'type':Sequelize[_0x0999('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x0999('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x03ce=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x1a7ba3,_0x347c46){var _0x2f69a5=function(_0x4ebd23){while(--_0x4ebd23){_0x1a7ba3['push'](_0x1a7ba3['shift']());}};_0x2f69a5(++_0x347c46);}(_0x03ce,0x1a1));var _0xe03c=function(_0x1ab95e,_0x30a6e4){_0x1ab95e=_0x1ab95e-0x0;var _0x1dfdec=_0x03ce[_0x1ab95e];return _0x1dfdec;};'use strict';var Sequelize=require(_0xe03c('0x0'));module[_0xe03c('0x1')]={'CmContactId':{'type':Sequelize[_0xe03c('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xe03c('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xe03c('0x3')],'defaultValue':_0xe03c('0x4')},'OrderBy':{'type':Sequelize[_0xe03c('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index edbeb24..1d5cbff 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02ae=['fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','apply','reject','save','destroy','then','get','CmContactHasItems','UserProfileResource','end','stack','name','send','index','map','rawAttributes','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','CmContactHasItem','count','includeAll','rows','catch','params','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs'];(function(_0x5d6448,_0x53522f){var _0x58c195=function(_0x200a2f){while(--_0x200a2f){_0x5d6448['push'](_0x5d6448['shift']());}};_0x58c195(++_0x53522f);}(_0x02ae,0x1c6));var _0xe02a=function(_0x11b1f9,_0x56ea40){_0x11b1f9=_0x11b1f9-0x0;var _0x443d2c=_0x02ae[_0x11b1f9];return _0x443d2c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe02a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe02a('0x1'));var rp=require(_0xe02a('0x2'));var moment=require('moment');var BPromise=require(_0xe02a('0x3'));var Mustache=require('mustache');var util=require(_0xe02a('0x4'));var path=require('path');var sox=require(_0xe02a('0x5'));var csv=require(_0xe02a('0x6'));var ejs=require(_0xe02a('0x7'));var fs=require('fs');var fs_extra=require(_0xe02a('0x8'));var _=require(_0xe02a('0x9'));var squel=require('squel');var crypto=require(_0xe02a('0xa'));var jsforce=require(_0xe02a('0xb'));var deskjs=require(_0xe02a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe02a('0xd'));var Papa=require('papaparse');var Redis=require(_0xe02a('0xe'));var authService=require(_0xe02a('0xf'));var qs=require(_0xe02a('0x10'));var as=require(_0xe02a('0x11'));var hardwareService=require(_0xe02a('0x12'));var logger=require(_0xe02a('0x13'))(_0xe02a('0x14'));var utils=require(_0xe02a('0x15'));var config=require(_0xe02a('0x16'));var licenseUtil=require(_0xe02a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b9f4e,_0x50a47f){_0x50a47f=_0x50a47f||0xcc;return function(_0x435754){if(_0x435754){return _0x5b9f4e[_0xe02a('0x18')](_0x50a47f);}return _0x5b9f4e[_0xe02a('0x19')](_0x50a47f)['end']();};}function respondWithResult(_0x18f88a,_0x32a256){_0x32a256=_0x32a256||0xc8;return function(_0x987bc2){if(_0x987bc2){return _0x18f88a[_0xe02a('0x19')](_0x32a256)[_0xe02a('0x1a')](_0x987bc2);}};}function respondWithFilteredResult(_0x1d3662,_0x1ec544){return function(_0x188a9c){if(_0x188a9c){var _0x1387a9=typeof _0x1ec544[_0xe02a('0x1b')]==='undefined'&&typeof _0x1ec544[_0xe02a('0x1c')]===_0xe02a('0x1d');var _0x234afb=_0x188a9c['count'];var _0x4cf8b4=_0x1387a9?0x0:_0x1ec544[_0xe02a('0x1b')];var _0x3574af=_0x1387a9?_0x188a9c['count']:_0x1ec544[_0xe02a('0x1b')]+_0x1ec544[_0xe02a('0x1c')];var _0x16eaf8;if(_0x3574af>=_0x234afb){_0x3574af=_0x234afb;_0x16eaf8=0xc8;}else{_0x16eaf8=0xce;}_0x1d3662[_0xe02a('0x19')](_0x16eaf8);return _0x1d3662['set']('Content-Range',_0x4cf8b4+'-'+_0x3574af+'/'+_0x234afb)['json'](_0x188a9c);}return null;};}function patchUpdates(_0x509cca){return function(_0x11f9f5){try{jsonpatch[_0xe02a('0x1e')](_0x11f9f5,_0x509cca,!![]);}catch(_0x13fe4b){return BPromise[_0xe02a('0x1f')](_0x13fe4b);}return _0x11f9f5[_0xe02a('0x20')]();};}function saveUpdates(_0x236a2b,_0x3fff73){return function(_0x40880d){if(_0x40880d){return _0x40880d['update'](_0x236a2b)['then'](function(_0x54a4e8){return _0x54a4e8;});}return null;};}function removeEntity(_0x2c60e3,_0xa6cd01){return function(_0x208238){if(_0x208238){return _0x208238[_0xe02a('0x21')]()[_0xe02a('0x22')](function(){var _0x140957=_0x208238[_0xe02a('0x23')]({'plain':!![]});var _0x3a8ee3=_0xe02a('0x24');return db[_0xe02a('0x25')]['destroy']({'where':{'type':_0x3a8ee3,'resourceId':_0x140957['id']}})[_0xe02a('0x22')](function(){return _0x208238;});})[_0xe02a('0x22')](function(){_0x2c60e3[_0xe02a('0x19')](0xcc)[_0xe02a('0x26')]();});}};}function handleEntityNotFound(_0x222a21,_0x3463b9){return function(_0x12849c){if(!_0x12849c){_0x222a21[_0xe02a('0x18')](0x194);}return _0x12849c;};}function handleError(_0x4b79c6,_0x572522){_0x572522=_0x572522||0x1f4;return function(_0x1da55f){logger['error'](_0x1da55f[_0xe02a('0x27')]);if(_0x1da55f[_0xe02a('0x28')]){delete _0x1da55f[_0xe02a('0x28')];}_0x4b79c6[_0xe02a('0x19')](_0x572522)[_0xe02a('0x29')](_0x1da55f);};}exports[_0xe02a('0x2a')]=function(_0x3c60f0,_0x27befb){var _0x1ae396={},_0x43ff5f={},_0x210acb={'count':0x0,'rows':[]};var _0x1880a2=_[_0xe02a('0x2b')](db['CmContactHasItem'][_0xe02a('0x2c')],function(_0x2e770a){return{'name':_0x2e770a['fieldName'],'type':_0x2e770a['type'][_0xe02a('0x2d')]};});_0x43ff5f[_0xe02a('0x2e')]=_[_0xe02a('0x2b')](_0x1880a2,'name');_0x43ff5f['query']=_['keys'](_0x3c60f0['query']);_0x43ff5f[_0xe02a('0x2f')]=_[_0xe02a('0x30')](_0x43ff5f[_0xe02a('0x2e')],_0x43ff5f['query']);_0x1ae396['attributes']=_['intersection'](_0x43ff5f[_0xe02a('0x2e')],qs['fields'](_0x3c60f0[_0xe02a('0x31')][_0xe02a('0x32')]));_0x1ae396['attributes']=_0x1ae396[_0xe02a('0x33')][_0xe02a('0x34')]?_0x1ae396['attributes']:_0x43ff5f['model'];if(!_0x3c60f0[_0xe02a('0x31')][_0xe02a('0x35')]('nolimit')){_0x1ae396[_0xe02a('0x1c')]=qs[_0xe02a('0x1c')](_0x3c60f0['query'][_0xe02a('0x1c')]);_0x1ae396[_0xe02a('0x1b')]=qs['offset'](_0x3c60f0[_0xe02a('0x31')][_0xe02a('0x1b')]);}_0x1ae396[_0xe02a('0x36')]=qs[_0xe02a('0x37')](_0x3c60f0[_0xe02a('0x31')][_0xe02a('0x37')]);_0x1ae396['where']=qs[_0xe02a('0x2f')](_[_0xe02a('0x38')](_0x3c60f0[_0xe02a('0x31')],_0x43ff5f['filters']),_0x1880a2);if(_0x3c60f0[_0xe02a('0x31')][_0xe02a('0x39')]){_0x1ae396[_0xe02a('0x3a')]=_[_0xe02a('0x3b')](_0x1ae396['where'],{'$or':_[_0xe02a('0x2b')](_0x1880a2,function(_0xf913f8){if(_0xf913f8['type']!=='VIRTUAL'){var _0x2d053e={};_0x2d053e[_0xf913f8[_0xe02a('0x28')]]={'$like':'%'+_0x3c60f0[_0xe02a('0x31')][_0xe02a('0x39')]+'%'};return _0x2d053e;}})});}_0x1ae396=_[_0xe02a('0x3b')]({},_0x1ae396,_0x3c60f0[_0xe02a('0x3c')]);var _0x4dda41={'where':_0x1ae396['where']};return db[_0xe02a('0x3d')][_0xe02a('0x3e')](_0x4dda41)[_0xe02a('0x22')](function(_0x493024){_0x210acb[_0xe02a('0x3e')]=_0x493024;if(_0x3c60f0[_0xe02a('0x31')][_0xe02a('0x3f')]){_0x1ae396['include']=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x1ae396);})[_0xe02a('0x22')](function(_0x341e56){_0x210acb[_0xe02a('0x40')]=_0x341e56;return _0x210acb;})[_0xe02a('0x22')](respondWithFilteredResult(_0x27befb,_0x1ae396))[_0xe02a('0x41')](handleError(_0x27befb,null));};exports['show']=function(_0x22c106,_0x161b19){var _0x2f52d6={'raw':!![],'where':{'id':_0x22c106[_0xe02a('0x42')]['id']}},_0x5efcda={};_0x5efcda['model']=_[_0xe02a('0x43')](db[_0xe02a('0x3d')][_0xe02a('0x2c')]);_0x5efcda[_0xe02a('0x31')]=_[_0xe02a('0x43')](_0x22c106[_0xe02a('0x31')]);_0x5efcda[_0xe02a('0x2f')]=_['intersection'](_0x5efcda[_0xe02a('0x2e')],_0x5efcda[_0xe02a('0x31')]);_0x2f52d6[_0xe02a('0x33')]=_[_0xe02a('0x30')](_0x5efcda[_0xe02a('0x2e')],qs[_0xe02a('0x32')](_0x22c106[_0xe02a('0x31')][_0xe02a('0x32')]));_0x2f52d6[_0xe02a('0x33')]=_0x2f52d6['attributes']['length']?_0x2f52d6[_0xe02a('0x33')]:_0x5efcda['model'];if(_0x22c106['query']['includeAll']){_0x2f52d6[_0xe02a('0x44')]=[{'all':!![]}];}_0x2f52d6=_[_0xe02a('0x3b')]({},_0x2f52d6,_0x22c106['options']);return db['CmContactHasItem'][_0xe02a('0x45')](_0x2f52d6)[_0xe02a('0x22')](handleEntityNotFound(_0x161b19,null))[_0xe02a('0x22')](respondWithResult(_0x161b19,null))[_0xe02a('0x41')](handleError(_0x161b19,null));};exports[_0xe02a('0x46')]=function(_0x52f600,_0x3af073){return db[_0xe02a('0x3d')][_0xe02a('0x46')](_0x52f600['body'],{})[_0xe02a('0x22')](function(_0x2869a5){var _0x8a6c33=_0x52f600[_0xe02a('0x47')]['get']({'plain':!![]});if(!_0x8a6c33)throw new Error(_0xe02a('0x48'));if(_0x8a6c33[_0xe02a('0x49')]===_0xe02a('0x47')){var _0x3764e4=_0x2869a5[_0xe02a('0x23')]({'plain':!![]});var _0x243b1f='CmContactHasItems';return db[_0xe02a('0x4a')][_0xe02a('0x45')]({'where':{'name':_0x243b1f,'userProfileId':_0x8a6c33[_0xe02a('0x4b')]},'raw':!![]})[_0xe02a('0x22')](function(_0x33cd29){if(_0x33cd29&&_0x33cd29['autoAssociation']===0x0){return db[_0xe02a('0x25')][_0xe02a('0x46')]({'name':_0x3764e4[_0xe02a('0x28')],'resourceId':_0x3764e4['id'],'type':_0x33cd29[_0xe02a('0x28')],'sectionId':_0x33cd29['id']},{})[_0xe02a('0x22')](function(){return _0x2869a5;});}else{return _0x2869a5;}})[_0xe02a('0x41')](function(_0x4ed773){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ed773);throw _0x4ed773;});}return _0x2869a5;})[_0xe02a('0x22')](respondWithResult(_0x3af073,0xc9))[_0xe02a('0x41')](handleError(_0x3af073,null));};exports['update']=function(_0x295ff6,_0x3a588f){if(_0x295ff6[_0xe02a('0x4c')]['id']){delete _0x295ff6[_0xe02a('0x4c')]['id'];}return db['CmContactHasItem'][_0xe02a('0x45')]({'where':{'id':_0x295ff6[_0xe02a('0x42')]['id']}})['then'](handleEntityNotFound(_0x3a588f,null))[_0xe02a('0x22')](saveUpdates(_0x295ff6['body'],null))[_0xe02a('0x22')](respondWithResult(_0x3a588f,null))['catch'](handleError(_0x3a588f,null));};exports[_0xe02a('0x21')]=function(_0x18f7a9,_0x122cb9){return db[_0xe02a('0x3d')][_0xe02a('0x45')]({'where':{'id':_0x18f7a9[_0xe02a('0x42')]['id']}})[_0xe02a('0x22')](handleEntityNotFound(_0x122cb9,null))[_0xe02a('0x22')](removeEntity(_0x122cb9,null))[_0xe02a('0x41')](handleError(_0x122cb9,null));}; \ No newline at end of file +var _0xac00=['../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','CmContactHasItems','UserProfileResource','sendStatus','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/environment'];(function(_0x21a34a,_0x565906){var _0x1d00dd=function(_0x3ae86a){while(--_0x3ae86a){_0x21a34a['push'](_0x21a34a['shift']());}};_0x1d00dd(++_0x565906);}(_0xac00,0x93));var _0x0ac0=function(_0x2f89c0,_0x455702){_0x2f89c0=_0x2f89c0-0x0;var _0x164223=_0xac00[_0x2f89c0];return _0x164223;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ac0('0x0'));var zipdir=require(_0x0ac0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ac0('0x2'));var moment=require(_0x0ac0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0ac0('0x4'));var util=require(_0x0ac0('0x5'));var path=require(_0x0ac0('0x6'));var sox=require(_0x0ac0('0x7'));var csv=require(_0x0ac0('0x8'));var ejs=require(_0x0ac0('0x9'));var fs=require('fs');var fs_extra=require(_0x0ac0('0xa'));var _=require(_0x0ac0('0xb'));var squel=require(_0x0ac0('0xc'));var crypto=require(_0x0ac0('0xd'));var jsforce=require(_0x0ac0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0ac0('0x8'));var querystring=require(_0x0ac0('0xf'));var Papa=require(_0x0ac0('0x10'));var Redis=require('ioredis');var authService=require(_0x0ac0('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ac0('0x12'))(_0x0ac0('0x13'));var utils=require('../../config/utils');var config=require(_0x0ac0('0x14'));var licenseUtil=require(_0x0ac0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a5310,_0x45e020){_0x45e020=_0x45e020||0xcc;return function(_0x13fc09){if(_0x13fc09){return _0x5a5310['sendStatus'](_0x45e020);}return _0x5a5310[_0x0ac0('0x16')](_0x45e020)[_0x0ac0('0x17')]();};}function respondWithResult(_0x4ab570,_0x577f6e){_0x577f6e=_0x577f6e||0xc8;return function(_0x201d55){if(_0x201d55){return _0x4ab570[_0x0ac0('0x16')](_0x577f6e)[_0x0ac0('0x18')](_0x201d55);}};}function respondWithFilteredResult(_0x313b13,_0x49ea67){return function(_0x1a158f){if(_0x1a158f){var _0x1bdbca=typeof _0x49ea67[_0x0ac0('0x19')]===_0x0ac0('0x1a')&&typeof _0x49ea67['limit']==='undefined';var _0x1d7ac4=_0x1a158f[_0x0ac0('0x1b')];var _0x702615=_0x1bdbca?0x0:_0x49ea67['offset'];var _0x17902b=_0x1bdbca?_0x1a158f[_0x0ac0('0x1b')]:_0x49ea67[_0x0ac0('0x19')]+_0x49ea67[_0x0ac0('0x1c')];var _0x4baca6;if(_0x17902b>=_0x1d7ac4){_0x17902b=_0x1d7ac4;_0x4baca6=0xc8;}else{_0x4baca6=0xce;}_0x313b13[_0x0ac0('0x16')](_0x4baca6);return _0x313b13[_0x0ac0('0x1d')](_0x0ac0('0x1e'),_0x702615+'-'+_0x17902b+'/'+_0x1d7ac4)[_0x0ac0('0x18')](_0x1a158f);}return null;};}function patchUpdates(_0xaf1aa){return function(_0x30fbab){try{jsonpatch[_0x0ac0('0x1f')](_0x30fbab,_0xaf1aa,!![]);}catch(_0x46d6ed){return BPromise[_0x0ac0('0x20')](_0x46d6ed);}return _0x30fbab[_0x0ac0('0x21')]();};}function saveUpdates(_0x413f21,_0x139423){return function(_0x3ce5e8){if(_0x3ce5e8){return _0x3ce5e8['update'](_0x413f21)['then'](function(_0x366719){return _0x366719;});}return null;};}function removeEntity(_0x5d006f,_0x42c8f2){return function(_0x694b87){if(_0x694b87){return _0x694b87[_0x0ac0('0x22')]()[_0x0ac0('0x23')](function(){var _0x170c5e=_0x694b87['get']({'plain':!![]});var _0x49e252=_0x0ac0('0x24');return db[_0x0ac0('0x25')]['destroy']({'where':{'type':_0x49e252,'resourceId':_0x170c5e['id']}})[_0x0ac0('0x23')](function(){return _0x694b87;});})['then'](function(){_0x5d006f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bdf03,_0x520acb){return function(_0x18a41a){if(!_0x18a41a){_0x1bdf03[_0x0ac0('0x26')](0x194);}return _0x18a41a;};}function handleError(_0x1472c1,_0x3427b7){_0x3427b7=_0x3427b7||0x1f4;return function(_0x5f2c6b){logger['error'](_0x5f2c6b[_0x0ac0('0x27')]);if(_0x5f2c6b[_0x0ac0('0x28')]){delete _0x5f2c6b['name'];}_0x1472c1[_0x0ac0('0x16')](_0x3427b7)[_0x0ac0('0x29')](_0x5f2c6b);};}exports[_0x0ac0('0x2a')]=function(_0x1ad823,_0x1f4659){var _0x2cbfc9={},_0x135dd6={},_0x5cee05={'count':0x0,'rows':[]};var _0x212dec=_[_0x0ac0('0x2b')](db[_0x0ac0('0x2c')][_0x0ac0('0x2d')],function(_0x5a5a07){return{'name':_0x5a5a07[_0x0ac0('0x2e')],'type':_0x5a5a07['type'][_0x0ac0('0x2f')]};});_0x135dd6[_0x0ac0('0x30')]=_['map'](_0x212dec,'name');_0x135dd6[_0x0ac0('0x31')]=_['keys'](_0x1ad823[_0x0ac0('0x31')]);_0x135dd6[_0x0ac0('0x32')]=_['intersection'](_0x135dd6[_0x0ac0('0x30')],_0x135dd6[_0x0ac0('0x31')]);_0x2cbfc9['attributes']=_[_0x0ac0('0x33')](_0x135dd6[_0x0ac0('0x30')],qs[_0x0ac0('0x34')](_0x1ad823[_0x0ac0('0x31')][_0x0ac0('0x34')]));_0x2cbfc9['attributes']=_0x2cbfc9[_0x0ac0('0x35')][_0x0ac0('0x36')]?_0x2cbfc9[_0x0ac0('0x35')]:_0x135dd6[_0x0ac0('0x30')];if(!_0x1ad823[_0x0ac0('0x31')][_0x0ac0('0x37')](_0x0ac0('0x38'))){_0x2cbfc9[_0x0ac0('0x1c')]=qs['limit'](_0x1ad823['query'][_0x0ac0('0x1c')]);_0x2cbfc9['offset']=qs[_0x0ac0('0x19')](_0x1ad823[_0x0ac0('0x31')][_0x0ac0('0x19')]);}_0x2cbfc9[_0x0ac0('0x39')]=qs[_0x0ac0('0x3a')](_0x1ad823[_0x0ac0('0x31')][_0x0ac0('0x3a')]);_0x2cbfc9[_0x0ac0('0x3b')]=qs[_0x0ac0('0x32')](_[_0x0ac0('0x3c')](_0x1ad823[_0x0ac0('0x31')],_0x135dd6[_0x0ac0('0x32')]),_0x212dec);if(_0x1ad823[_0x0ac0('0x31')][_0x0ac0('0x3d')]){_0x2cbfc9[_0x0ac0('0x3b')]=_[_0x0ac0('0x3e')](_0x2cbfc9[_0x0ac0('0x3b')],{'$or':_[_0x0ac0('0x2b')](_0x212dec,function(_0x37af33){if(_0x37af33[_0x0ac0('0x3f')]!=='VIRTUAL'){var _0x54267a={};_0x54267a[_0x37af33[_0x0ac0('0x28')]]={'$like':'%'+_0x1ad823[_0x0ac0('0x31')][_0x0ac0('0x3d')]+'%'};return _0x54267a;}})});}_0x2cbfc9=_[_0x0ac0('0x3e')]({},_0x2cbfc9,_0x1ad823[_0x0ac0('0x40')]);var _0x112bb9={'where':_0x2cbfc9[_0x0ac0('0x3b')]};return db[_0x0ac0('0x2c')][_0x0ac0('0x1b')](_0x112bb9)[_0x0ac0('0x23')](function(_0x2222cb){_0x5cee05['count']=_0x2222cb;if(_0x1ad823[_0x0ac0('0x31')][_0x0ac0('0x41')]){_0x2cbfc9[_0x0ac0('0x42')]=[{'all':!![]}];}return db[_0x0ac0('0x2c')][_0x0ac0('0x43')](_0x2cbfc9);})['then'](function(_0x3c98a0){_0x5cee05[_0x0ac0('0x44')]=_0x3c98a0;return _0x5cee05;})[_0x0ac0('0x23')](respondWithFilteredResult(_0x1f4659,_0x2cbfc9))[_0x0ac0('0x45')](handleError(_0x1f4659,null));};exports['show']=function(_0x2717b6,_0x53a262){var _0x4c0e7b={'raw':!![],'where':{'id':_0x2717b6[_0x0ac0('0x46')]['id']}},_0x597a3c={};_0x597a3c[_0x0ac0('0x30')]=_[_0x0ac0('0x47')](db[_0x0ac0('0x2c')][_0x0ac0('0x2d')]);_0x597a3c[_0x0ac0('0x31')]=_[_0x0ac0('0x47')](_0x2717b6[_0x0ac0('0x31')]);_0x597a3c[_0x0ac0('0x32')]=_[_0x0ac0('0x33')](_0x597a3c['model'],_0x597a3c[_0x0ac0('0x31')]);_0x4c0e7b['attributes']=_['intersection'](_0x597a3c[_0x0ac0('0x30')],qs['fields'](_0x2717b6[_0x0ac0('0x31')]['fields']));_0x4c0e7b[_0x0ac0('0x35')]=_0x4c0e7b[_0x0ac0('0x35')][_0x0ac0('0x36')]?_0x4c0e7b[_0x0ac0('0x35')]:_0x597a3c[_0x0ac0('0x30')];if(_0x2717b6[_0x0ac0('0x31')][_0x0ac0('0x41')]){_0x4c0e7b[_0x0ac0('0x42')]=[{'all':!![]}];}_0x4c0e7b=_[_0x0ac0('0x3e')]({},_0x4c0e7b,_0x2717b6[_0x0ac0('0x40')]);return db[_0x0ac0('0x2c')][_0x0ac0('0x48')](_0x4c0e7b)[_0x0ac0('0x23')](handleEntityNotFound(_0x53a262,null))[_0x0ac0('0x23')](respondWithResult(_0x53a262,null))['catch'](handleError(_0x53a262,null));};exports['create']=function(_0x3341c5,_0x1f2bda){return db[_0x0ac0('0x2c')][_0x0ac0('0x49')](_0x3341c5[_0x0ac0('0x4a')],{})[_0x0ac0('0x23')](function(_0x3b6215){var _0x1e3153=_0x3341c5[_0x0ac0('0x4b')][_0x0ac0('0x4c')]({'plain':!![]});if(!_0x1e3153)throw new Error(_0x0ac0('0x4d'));if(_0x1e3153[_0x0ac0('0x4e')]==='user'){var _0x242cc5=_0x3b6215['get']({'plain':!![]});var _0x27a262=_0x0ac0('0x24');return db[_0x0ac0('0x4f')][_0x0ac0('0x48')]({'where':{'name':_0x27a262,'userProfileId':_0x1e3153[_0x0ac0('0x50')]},'raw':!![]})[_0x0ac0('0x23')](function(_0x1ebbcc){if(_0x1ebbcc&&_0x1ebbcc[_0x0ac0('0x51')]===0x0){return db[_0x0ac0('0x25')][_0x0ac0('0x49')]({'name':_0x242cc5[_0x0ac0('0x28')],'resourceId':_0x242cc5['id'],'type':_0x1ebbcc[_0x0ac0('0x28')],'sectionId':_0x1ebbcc['id']},{})[_0x0ac0('0x23')](function(){return _0x3b6215;});}else{return _0x3b6215;}})[_0x0ac0('0x45')](function(_0x36c7b4){logger['error'](_0x0ac0('0x52'),_0x36c7b4);throw _0x36c7b4;});}return _0x3b6215;})['then'](respondWithResult(_0x1f2bda,0xc9))[_0x0ac0('0x45')](handleError(_0x1f2bda,null));};exports[_0x0ac0('0x53')]=function(_0x228b89,_0x14a379){if(_0x228b89['body']['id']){delete _0x228b89['body']['id'];}return db[_0x0ac0('0x2c')][_0x0ac0('0x48')]({'where':{'id':_0x228b89[_0x0ac0('0x46')]['id']}})[_0x0ac0('0x23')](handleEntityNotFound(_0x14a379,null))[_0x0ac0('0x23')](saveUpdates(_0x228b89['body'],null))[_0x0ac0('0x23')](respondWithResult(_0x14a379,null))['catch'](handleError(_0x14a379,null));};exports[_0x0ac0('0x22')]=function(_0x226c2c,_0x55e8ad){return db[_0x0ac0('0x2c')][_0x0ac0('0x48')]({'where':{'id':_0x226c2c[_0x0ac0('0x46')]['id']}})['then'](handleEntityNotFound(_0x55e8ad,null))[_0x0ac0('0x23')](removeEntity(_0x55e8ad,null))['catch'](handleError(_0x55e8ad,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 665a07d..2e1f06e 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70c9=['bluebird','request-promise','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','util','../../config/logger','api','moment'];(function(_0x4a1256,_0x1750a0){var _0x476d1a=function(_0x5753ee){while(--_0x5753ee){_0x4a1256['push'](_0x4a1256['shift']());}};_0x476d1a(++_0x1750a0);}(_0x70c9,0x193));var _0x970c=function(_0x2d17d9,_0x107d70){_0x2d17d9=_0x2d17d9-0x0;var _0xb12fbf=_0x70c9[_0x2d17d9];return _0xb12fbf;};'use strict';var _=require('lodash');var util=require(_0x970c('0x0'));var logger=require(_0x970c('0x1'))(_0x970c('0x2'));var moment=require(_0x970c('0x3'));var BPromise=require(_0x970c('0x4'));var rp=require(_0x970c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x970c('0x6'));var attributes=require(_0x970c('0x7'));module[_0x970c('0x8')]=function(_0x3d4564,_0x49950b){return _0x3d4564[_0x970c('0x9')](_0x970c('0xa'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fd3=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items'];(function(_0x1e7345,_0x18bcce){var _0x33017c=function(_0x2b274f){while(--_0x2b274f){_0x1e7345['push'](_0x1e7345['shift']());}};_0x33017c(++_0x18bcce);}(_0x6fd3,0x1ee));var _0x36fd=function(_0x5e87ec,_0x20ed69){_0x5e87ec=_0x5e87ec-0x0;var _0x3c3207=_0x6fd3[_0x5e87ec];return _0x3c3207;};'use strict';var _=require(_0x36fd('0x0'));var util=require(_0x36fd('0x1'));var logger=require(_0x36fd('0x2'))(_0x36fd('0x3'));var moment=require(_0x36fd('0x4'));var BPromise=require('bluebird');var rp=require(_0x36fd('0x5'));var fs=require('fs');var path=require(_0x36fd('0x6'));var rimraf=require('rimraf');var config=require(_0x36fd('0x7'));var attributes=require(_0x36fd('0x8'));module[_0x36fd('0x9')]=function(_0x868060,_0x235bc9){return _0x868060[_0x36fd('0xa')](_0x36fd('0xb'),attributes,{'tableName':_0x36fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 6be8b05..81d71db 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc73d=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message'];(function(_0x58539f,_0x5c9937){var _0x5151fa=function(_0x1be30c){while(--_0x1be30c){_0x58539f['push'](_0x58539f['shift']());}};_0x5151fa(++_0x5c9937);}(_0xc73d,0x188));var _0xdc73=function(_0x181945,_0x180cb8){_0x181945=_0x181945-0x0;var _0x3a129c=_0xc73d[_0x181945];return _0x3a129c;};'use strict';var _=require(_0xdc73('0x0'));var util=require(_0xdc73('0x1'));var moment=require(_0xdc73('0x2'));var BPromise=require(_0xdc73('0x3'));var rs=require(_0xdc73('0x4'));var fs=require('fs');var Redis=require(_0xdc73('0x5'));var db=require(_0xdc73('0x6'))['db'];var utils=require(_0xdc73('0x7'));var logger=require(_0xdc73('0x8'))('rpc');var config=require(_0xdc73('0x9'));var jayson=require(_0xdc73('0xa'));var client=jayson[_0xdc73('0xb')][_0xdc73('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1739fa,_0x50287f,_0x20de48){return new BPromise(function(_0x69f4e7,_0xd35213){return client[_0xdc73('0xd')](_0x1739fa,_0x20de48)[_0xdc73('0xe')](function(_0x1d1344){logger[_0xdc73('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x50287f,_0xdc73('0x10'));logger[_0xdc73('0x11')](_0xdc73('0x12'),_0x50287f,_0xdc73('0x10'),JSON[_0xdc73('0x13')](_0x1d1344));if(_0x1d1344[_0xdc73('0x14')]){if(_0x1d1344[_0xdc73('0x14')][_0xdc73('0x15')]===0x1f4){logger[_0xdc73('0x14')](_0xdc73('0x16'),_0x50287f,_0x1d1344['error'][_0xdc73('0x17')]);return _0xd35213(_0x1d1344['error'][_0xdc73('0x17')]);}logger[_0xdc73('0x14')]('CmContactHasItem,\x20%s,\x20%s',_0x50287f,_0x1d1344[_0xdc73('0x14')][_0xdc73('0x17')]);return _0x69f4e7(_0x1d1344[_0xdc73('0x14')][_0xdc73('0x17')]);}else{logger['info'](_0xdc73('0x16'),_0x50287f,_0xdc73('0x10'));_0x69f4e7(_0x1d1344[_0xdc73('0x18')][_0xdc73('0x17')]);}})[_0xdc73('0x19')](function(_0x3eea7c){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x50287f,_0x3eea7c);_0xd35213(_0x3eea7c);});});} \ No newline at end of file +var _0x348f=['ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird'];(function(_0x257c0e,_0x4631da){var _0x393c16=function(_0x5239b9){while(--_0x5239b9){_0x257c0e['push'](_0x257c0e['shift']());}};_0x393c16(++_0x4631da);}(_0x348f,0xf9));var _0xf348=function(_0x1cf9ce,_0x17ba64){_0x1cf9ce=_0x1cf9ce-0x0;var _0x66738e=_0x348f[_0x1cf9ce];return _0x66738e;};'use strict';var _=require(_0xf348('0x0'));var util=require(_0xf348('0x1'));var moment=require('moment');var BPromise=require(_0xf348('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf348('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf348('0x4'));var logger=require('../../config/logger')(_0xf348('0x5'));var config=require(_0xf348('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf348('0x7')][_0xf348('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57fbe7,_0x18451e,_0x45d938){return new BPromise(function(_0x3bab9d,_0x47f3e0){return client[_0xf348('0x9')](_0x57fbe7,_0x45d938)[_0xf348('0xa')](function(_0x3cdc9f){logger[_0xf348('0xb')](_0xf348('0xc'),_0x18451e,_0xf348('0xd'));logger[_0xf348('0xe')](_0xf348('0xf'),_0x18451e,_0xf348('0xd'),JSON[_0xf348('0x10')](_0x3cdc9f));if(_0x3cdc9f[_0xf348('0x11')]){if(_0x3cdc9f['error'][_0xf348('0x12')]===0x1f4){logger[_0xf348('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x18451e,_0x3cdc9f[_0xf348('0x11')]['message']);return _0x47f3e0(_0x3cdc9f[_0xf348('0x11')][_0xf348('0x13')]);}logger[_0xf348('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x18451e,_0x3cdc9f[_0xf348('0x11')][_0xf348('0x13')]);return _0x3bab9d(_0x3cdc9f['error'][_0xf348('0x13')]);}else{logger[_0xf348('0xb')](_0xf348('0xc'),_0x18451e,_0xf348('0xd'));_0x3bab9d(_0x3cdc9f['result']['message']);}})[_0xf348('0x14')](function(_0x2c64f1){logger[_0xf348('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x18451e,_0x2c64f1);_0x47f3e0(_0x2c64f1);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index de869a8..9002c40 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa631=['../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','post','create','put','delete','/:id','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x32e4de,_0x7da1c5){var _0x51ba2a=function(_0x2a7322){while(--_0x2a7322){_0x32e4de['push'](_0x32e4de['shift']());}};_0x51ba2a(++_0x7da1c5);}(_0xa631,0xb8));var _0x1a63=function(_0x4cd76e,_0xdf00d6){_0x4cd76e=_0x4cd76e-0x0;var _0x470253=_0xa631[_0x4cd76e];return _0x470253;};'use strict';var multer=require(_0x1a63('0x0'));var util=require('util');var path=require(_0x1a63('0x1'));var timeout=require(_0x1a63('0x2'));var express=require(_0x1a63('0x3'));var router=express['Router']();var fs_extra=require(_0x1a63('0x4'));var auth=require(_0x1a63('0x5'));var interaction=require(_0x1a63('0x6'));var config=require(_0x1a63('0x7'));var controller=require(_0x1a63('0x8'));router[_0x1a63('0x9')]('/',auth[_0x1a63('0xa')](),controller[_0x1a63('0xb')]);router[_0x1a63('0x9')]('/:id',auth[_0x1a63('0xa')](),controller['show']);router[_0x1a63('0xc')]('/',auth[_0x1a63('0xa')](),controller[_0x1a63('0xd')]);router[_0x1a63('0xe')]('/:id',auth[_0x1a63('0xa')](),controller['update']);router[_0x1a63('0xf')](_0x1a63('0x10'),auth[_0x1a63('0xa')](),controller[_0x1a63('0x11')]);module[_0x1a63('0x12')]=router; \ No newline at end of file +var _0x8d2b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x31d339,_0x53302b){var _0x348e21=function(_0x39acf6){while(--_0x39acf6){_0x31d339['push'](_0x31d339['shift']());}};_0x348e21(++_0x53302b);}(_0x8d2b,0x1c9));var _0xb8d2=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x8d2b[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0xb8d2('0x0'));var util=require(_0xb8d2('0x1'));var path=require(_0xb8d2('0x2'));var timeout=require('connect-timeout');var express=require(_0xb8d2('0x3'));var router=express[_0xb8d2('0x4')]();var fs_extra=require(_0xb8d2('0x5'));var auth=require(_0xb8d2('0x6'));var interaction=require(_0xb8d2('0x7'));var config=require(_0xb8d2('0x8'));var controller=require('./cmContactHasItem.controller');router[_0xb8d2('0x9')]('/',auth[_0xb8d2('0xa')](),controller[_0xb8d2('0xb')]);router[_0xb8d2('0x9')](_0xb8d2('0xc'),auth[_0xb8d2('0xa')](),controller['show']);router[_0xb8d2('0xd')]('/',auth[_0xb8d2('0xa')](),controller[_0xb8d2('0xe')]);router[_0xb8d2('0xf')](_0xb8d2('0xc'),auth[_0xb8d2('0xa')](),controller[_0xb8d2('0x10')]);router[_0xb8d2('0x11')]('/:id',auth[_0xb8d2('0xa')](),controller[_0xb8d2('0x12')]);module[_0xb8d2('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 5b4c930..0c610e8 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 _0xd262=['values','isArray','setDataValue','ENUM','voice','VIRTUAL','getDataValue','alias','name','STRING','TEXT','type','select','parse'];(function(_0xcaf223,_0xd39f07){var _0x17e00d=function(_0xe2852e){while(--_0xe2852e){_0xcaf223['push'](_0xcaf223['shift']());}};_0x17e00d(++_0xd39f07);}(_0xd262,0x155));var _0x2d26=function(_0x3f20b9,_0x51b2bc){_0x3f20b9=_0x3f20b9-0x0;var _0xd99499=_0xd262[_0x3f20b9];return _0xd99499;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x2d26('0x0')],'get':function(_0x5ce021){return this[_0x2d26('0x1')](_0x2d26('0x2'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x59ef86){this['setDataValue'](_0x2d26('0x2'),_0x59ef86?_0x59ef86:this[_0x2d26('0x1')](_0x2d26('0x3')));}},'type':{'type':Sequelize[_0x2d26('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x2d26('0x5')]('long'),'get':function(){if(this[_0x2d26('0x1')](_0x2d26('0x6'))===_0x2d26('0x7')){return JSON[_0x2d26('0x8')](this['getDataValue']('values'));}else{return this[_0x2d26('0x1')](_0x2d26('0x9'));}},'set':function(_0x12e905){if(Array[_0x2d26('0xa')](_0x12e905)){this[_0x2d26('0xb')](_0x2d26('0x9'),JSON['stringify'](_0x12e905));}else{this[_0x2d26('0xb')](_0x2d26('0x9'),_0x12e905);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x2d26('0xc')](_0x2d26('0xd'))}}; \ No newline at end of file +var _0x0e61=['VIRTUAL','getDataValue','alias','STRING','name','long','type','select','parse','values','setDataValue','BOOLEAN','ENUM','sequelize','lodash','exports'];(function(_0x4fecf3,_0x17fdb0){var _0x50161f=function(_0x49b2ad){while(--_0x49b2ad){_0x4fecf3['push'](_0x4fecf3['shift']());}};_0x50161f(++_0x17fdb0);}(_0x0e61,0x19d));var _0x10e6=function(_0x4dbba7,_0x34d6d1){_0x4dbba7=_0x4dbba7-0x0;var _0x43ef83=_0x0e61[_0x4dbba7];return _0x43ef83;};'use strict';var Sequelize=require(_0x10e6('0x0'));var _=require(_0x10e6('0x1'));module[_0x10e6('0x2')]={'name':{'type':Sequelize[_0x10e6('0x3')],'get':function(_0x88f983){return this[_0x10e6('0x4')](_0x10e6('0x5'));}},'alias':{'type':Sequelize[_0x10e6('0x6')],'allowNull':![],'set':function(_0x507f38){this['setDataValue'](_0x10e6('0x5'),_0x507f38?_0x507f38:this[_0x10e6('0x4')](_0x10e6('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x10e6('0x8')),'get':function(){if(this[_0x10e6('0x4')](_0x10e6('0x9'))===_0x10e6('0xa')){return JSON[_0x10e6('0xb')](this['getDataValue'](_0x10e6('0xc')));}else{return this['getDataValue']('values');}},'set':function(_0x132a9b){if(Array['isArray'](_0x132a9b)){this[_0x10e6('0xd')](_0x10e6('0xc'),JSON['stringify'](_0x132a9b));}else{this[_0x10e6('0xd')](_0x10e6('0xc'),_0x132a9b);}}},'required':{'type':Sequelize[_0x10e6('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x10e6('0xf')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 54cfa31..5ff1782 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 _0x7863=['util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','apply','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','key','differenceBy','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','includeAll','find','body','params','catch','create','sequelize','transaction','Sequelize','TEXT','type','text','number','INTEGER','switch','defaultValue','addColumn','format','cf_%d','rimraf','request-promise','bluebird'];(function(_0x22b993,_0x5261be){var _0x4556d4=function(_0x5e216e){while(--_0x5e216e){_0x22b993['push'](_0x22b993['shift']());}};_0x4556d4(++_0x5261be);}(_0x7863,0x18d));var _0x3786=function(_0x71ae3c,_0x49c7a8){_0x71ae3c=_0x71ae3c-0x0;var _0x267933=_0x7863[_0x71ae3c];return _0x267933;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3786('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3786('0x1'));var moment=require('moment');var BPromise=require(_0x3786('0x2'));var Mustache=require('mustache');var util=require(_0x3786('0x3'));var path=require(_0x3786('0x4'));var sox=require('sox');var csv=require(_0x3786('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3786('0x6'));var _=require(_0x3786('0x7'));var squel=require(_0x3786('0x8'));var crypto=require(_0x3786('0x9'));var jsforce=require(_0x3786('0xa'));var deskjs=require(_0x3786('0xb'));var toCsv=require(_0x3786('0x5'));var querystring=require(_0x3786('0xc'));var Papa=require(_0x3786('0xd'));var Redis=require(_0x3786('0xe'));var authService=require(_0x3786('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3786('0x10'))(_0x3786('0x11'));var utils=require(_0x3786('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x3786('0x13'));var db=require(_0x3786('0x14'))['db'];function respondWithStatusCode(_0x44ce50,_0x47e315){_0x47e315=_0x47e315||0xcc;return function(_0x2f1b2b){if(_0x2f1b2b){return _0x44ce50['sendStatus'](_0x47e315);}return _0x44ce50[_0x3786('0x15')](_0x47e315)[_0x3786('0x16')]();};}function respondWithResult(_0xda9d09,_0x5b331f){_0x5b331f=_0x5b331f||0xc8;return function(_0x481062){if(_0x481062){return _0xda9d09[_0x3786('0x15')](_0x5b331f)['json'](_0x481062);}};}function respondWithFilteredResult(_0x16c314,_0x20e983){return function(_0x4f8d25){if(_0x4f8d25){var _0x302740=typeof _0x20e983[_0x3786('0x17')]===_0x3786('0x18')&&typeof _0x20e983['limit']===_0x3786('0x18');var _0x59384e=_0x4f8d25[_0x3786('0x19')];var _0xcb081f=_0x302740?0x0:_0x20e983[_0x3786('0x17')];var _0xf97e12=_0x302740?_0x4f8d25[_0x3786('0x19')]:_0x20e983[_0x3786('0x17')]+_0x20e983['limit'];var _0x14959f;if(_0xf97e12>=_0x59384e){_0xf97e12=_0x59384e;_0x14959f=0xc8;}else{_0x14959f=0xce;}_0x16c314[_0x3786('0x15')](_0x14959f);return _0x16c314[_0x3786('0x1a')]('Content-Range',_0xcb081f+'-'+_0xf97e12+'/'+_0x59384e)['json'](_0x4f8d25);}return null;};}function patchUpdates(_0x2c3cad){return function(_0xee0e71){try{jsonpatch[_0x3786('0x1b')](_0xee0e71,_0x2c3cad,!![]);}catch(_0x5270a7){return BPromise['reject'](_0x5270a7);}return _0xee0e71[_0x3786('0x1c')]();};}function saveUpdates(_0x4b226d,_0x15c541){return function(_0x2332d9){if(_0x2332d9){return _0x2332d9[_0x3786('0x1d')](_0x4b226d)[_0x3786('0x1e')](function(_0x50a473){return _0x50a473;});}return null;};}function removeEntity(_0x1bf821,_0x21377b){return function(_0x2aae80){if(_0x2aae80){return _0x2aae80[_0x3786('0x1f')]()[_0x3786('0x1e')](function(){_0x1bf821[_0x3786('0x15')](0xcc)[_0x3786('0x16')]();});}};}function handleEntityNotFound(_0x1b0a91,_0x4fd3a2){return function(_0x4cf538){if(!_0x4cf538){_0x1b0a91['sendStatus'](0x194);}return _0x4cf538;};}function handleError(_0x4405b2,_0x438887){_0x438887=_0x438887||0x1f4;return function(_0x494a0d){logger[_0x3786('0x20')](_0x494a0d[_0x3786('0x21')]);if(_0x494a0d['name']){delete _0x494a0d[_0x3786('0x22')];}_0x4405b2[_0x3786('0x15')](_0x438887)[_0x3786('0x23')](_0x494a0d);};}exports[_0x3786('0x24')]=function(_0x784a23,_0x508063){var _0x3a5d08={},_0x3a9067={},_0x26891d={'count':0x0,'rows':[]};var _0x591688=_[_0x3786('0x25')](db[_0x3786('0x26')][_0x3786('0x27')],function(_0x5ab384){return{'name':_0x5ab384['fieldName'],'type':_0x5ab384['type'][_0x3786('0x28')]};});_0x3a9067['model']=_[_0x3786('0x29')](_['map'](_0x591688,_0x3786('0x22')),[_0x3786('0x22')]);_0x3a9067[_0x3786('0x2a')]=_['keys'](_0x784a23[_0x3786('0x2a')]);_0x3a9067[_0x3786('0x2b')]=_[_0x3786('0x2c')](_0x3a9067[_0x3786('0x2d')],_0x3a9067[_0x3786('0x2a')]);_0x3a5d08[_0x3786('0x2e')]=_[_0x3786('0x2c')](_0x3a9067[_0x3786('0x2d')],qs[_0x3786('0x2f')](_0x784a23['query']['fields']));_0x3a5d08['attributes']=_0x3a5d08[_0x3786('0x2e')][_0x3786('0x30')]?_0x3a5d08[_0x3786('0x2e')]:_0x3a9067[_0x3786('0x2d')];if(!_0x784a23[_0x3786('0x2a')][_0x3786('0x31')](_0x3786('0x32'))){_0x3a5d08[_0x3786('0x33')]=qs['limit'](_0x784a23['query']['limit']);_0x3a5d08['offset']=qs[_0x3786('0x17')](_0x784a23['query'][_0x3786('0x17')]);}_0x3a5d08[_0x3786('0x34')]=qs[_0x3786('0x35')](_0x784a23['query'][_0x3786('0x35')]);_0x3a5d08[_0x3786('0x36')]=qs[_0x3786('0x2b')](_[_0x3786('0x37')](_0x784a23['query'],_0x3a9067[_0x3786('0x2b')]),_0x591688);if(_0x784a23[_0x3786('0x2a')]['filter']){_0x3a5d08[_0x3786('0x36')]=_[_0x3786('0x38')](_0x3a5d08['where'],{'$or':_['map'](_0x591688,function(_0x30cdf1){if(_0x30cdf1['type']!==_0x3786('0x39')){var _0x31b78c={};_0x31b78c[_0x30cdf1[_0x3786('0x22')]]={'$like':'%'+_0x784a23[_0x3786('0x2a')]['filter']+'%'};return _0x31b78c;}})});}_0x3a5d08=_[_0x3786('0x38')]({},_0x3a5d08,_0x784a23[_0x3786('0x3a')]);var _0x218853={'where':_0x3a5d08[_0x3786('0x36')]};return db[_0x3786('0x26')][_0x3786('0x19')](_0x218853)[_0x3786('0x1e')](function(_0x1900fe){_0x26891d[_0x3786('0x19')]=_0x1900fe;if(_0x784a23[_0x3786('0x2a')]['includeAll']){_0x3a5d08[_0x3786('0x3b')]=[{'all':!![]}];}return db[_0x3786('0x26')][_0x3786('0x3c')](_0x3a5d08);})[_0x3786('0x1e')](function(_0xce7249){_0x26891d['rows']=_0xce7249;return _0x26891d;})['then'](respondWithFilteredResult(_0x508063,_0x3a5d08))['catch'](handleError(_0x508063,null));};exports['show']=function(_0x2c0ae5,_0x3cc839){var _0x304c07={'raw':!![],'where':{'id':_0x2c0ae5['params']['id']}},_0x4c3ad0={};_0x4c3ad0[_0x3786('0x2d')]=_['keys'](db['CmCustomField']['rawAttributes']);_0x4c3ad0[_0x3786('0x2a')]=_['keys'](_0x2c0ae5[_0x3786('0x2a')]);_0x4c3ad0[_0x3786('0x2b')]=_[_0x3786('0x2c')](_0x4c3ad0[_0x3786('0x2d')],_0x4c3ad0[_0x3786('0x2a')]);_0x304c07[_0x3786('0x2e')]=_[_0x3786('0x2c')](_0x4c3ad0[_0x3786('0x2d')],qs[_0x3786('0x2f')](_0x2c0ae5[_0x3786('0x2a')]['fields']));_0x304c07[_0x3786('0x2e')]=_0x304c07[_0x3786('0x2e')][_0x3786('0x30')]?_0x304c07[_0x3786('0x2e')]:_0x4c3ad0[_0x3786('0x2d')];if(_0x2c0ae5[_0x3786('0x2a')][_0x3786('0x3d')]){_0x304c07[_0x3786('0x3b')]=[{'all':!![]}];}_0x304c07=_['merge']({},_0x304c07,_0x2c0ae5['options']);return db[_0x3786('0x26')][_0x3786('0x3e')](_0x304c07)[_0x3786('0x1e')](handleEntityNotFound(_0x3cc839,null))[_0x3786('0x1e')](respondWithResult(_0x3cc839,null))['catch'](handleError(_0x3cc839,null));};exports[_0x3786('0x1d')]=function(_0x3a4e5c,_0x46a3a0){if(_0x3a4e5c[_0x3786('0x3f')]['id']){delete _0x3a4e5c[_0x3786('0x3f')]['id'];}return db[_0x3786('0x26')]['find']({'where':{'id':_0x3a4e5c['params']['id']}})[_0x3786('0x1e')](handleEntityNotFound(_0x46a3a0,null))['then'](saveUpdates(_0x3a4e5c[_0x3786('0x3f')],null))[_0x3786('0x1e')](respondWithResult(_0x46a3a0,null))['catch'](handleError(_0x46a3a0,null));};exports[_0x3786('0x1f')]=function(_0x2b7a58,_0x2757fc){return db['CmCustomField'][_0x3786('0x3e')]({'where':{'id':_0x2b7a58[_0x3786('0x40')]['id']}})[_0x3786('0x1e')](handleEntityNotFound(_0x2757fc,null))[_0x3786('0x1e')](removeEntity(_0x2757fc,null))[_0x3786('0x41')](handleError(_0x2757fc,null));};exports[_0x3786('0x42')]=function(_0x5b722a,_0x3916f7){var _0x2f9d24;return db[_0x3786('0x43')][_0x3786('0x44')](function(_0x2bab5f){return db[_0x3786('0x26')][_0x3786('0x42')](_0x5b722a[_0x3786('0x3f')],{'transaction':_0x2bab5f})[_0x3786('0x1e')](function(_0x33da9e){_0x2f9d24=_0x33da9e;var _0x85af35={'type':db[_0x3786('0x45')][_0x3786('0x46')],'transaction':_0x2bab5f};switch(_0x5b722a[_0x3786('0x3f')][_0x3786('0x47')]){case _0x3786('0x48'):_0x85af35['type']=db[_0x3786('0x45')][_0x3786('0x46')];break;case _0x3786('0x49'):_0x85af35[_0x3786('0x47')]=db[_0x3786('0x45')][_0x3786('0x4a')];break;case _0x3786('0x4b'):_0x85af35[_0x3786('0x47')]=db['Sequelize']['BOOLEAN'];_0x85af35[_0x3786('0x4c')]=![];break;default:}return db[_0x3786('0x43')]['queryInterface'][_0x3786('0x4d')]('cm_contacts',util[_0x3786('0x4e')](_0x3786('0x4f'),_0x2f9d24['id']),_0x85af35);})[_0x3786('0x1e')](function(){return _0x2f9d24;});})['then'](respondWithResult(_0x3916f7,0xc9))[_0x3786('0x41')](handleError(_0x3916f7,null));}; \ No newline at end of file +var _0x1527=['catch','show','params','include','find','body','transaction','create','Sequelize','TEXT','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','json','offset','undefined','count','status','set','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','CmCustomField','rawAttributes','type','key','differenceBy','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows'];(function(_0x5931e3,_0x3e6e5c){var _0x4fb81d=function(_0x43f8dd){while(--_0x43f8dd){_0x5931e3['push'](_0x5931e3['shift']());}};_0x4fb81d(++_0x3e6e5c);}(_0x1527,0xc1));var _0x7152=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x1527[_0x7e2eb0];return _0xd92de4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7152('0x0'));var zipdir=require(_0x7152('0x1'));var jsonpatch=require(_0x7152('0x2'));var rp=require(_0x7152('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7152('0x4'));var util=require(_0x7152('0x5'));var path=require('path');var sox=require(_0x7152('0x6'));var csv=require(_0x7152('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7152('0x8'));var _=require(_0x7152('0x9'));var squel=require(_0x7152('0xa'));var crypto=require('crypto');var jsforce=require(_0x7152('0xb'));var deskjs=require(_0x7152('0xc'));var toCsv=require(_0x7152('0x7'));var querystring=require(_0x7152('0xd'));var Papa=require(_0x7152('0xe'));var Redis=require(_0x7152('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7152('0x10'));var as=require(_0x7152('0x11'));var hardwareService=require(_0x7152('0x12'));var logger=require(_0x7152('0x13'))(_0x7152('0x14'));var utils=require('../../config/utils');var config=require(_0x7152('0x15'));var licenseUtil=require(_0x7152('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d853f,_0x2928cf){_0x2928cf=_0x2928cf||0xcc;return function(_0x4b03a8){if(_0x4b03a8){return _0x5d853f['sendStatus'](_0x2928cf);}return _0x5d853f['status'](_0x2928cf)[_0x7152('0x17')]();};}function respondWithResult(_0x2df802,_0x2114cf){_0x2114cf=_0x2114cf||0xc8;return function(_0x49d976){if(_0x49d976){return _0x2df802['status'](_0x2114cf)[_0x7152('0x18')](_0x49d976);}};}function respondWithFilteredResult(_0x6ae434,_0x39c58f){return function(_0x53315e){if(_0x53315e){var _0x589716=typeof _0x39c58f[_0x7152('0x19')]==='undefined'&&typeof _0x39c58f['limit']===_0x7152('0x1a');var _0x51f0ce=_0x53315e[_0x7152('0x1b')];var _0xf2ad37=_0x589716?0x0:_0x39c58f['offset'];var _0x4a83a2=_0x589716?_0x53315e[_0x7152('0x1b')]:_0x39c58f[_0x7152('0x19')]+_0x39c58f['limit'];var _0x3027b6;if(_0x4a83a2>=_0x51f0ce){_0x4a83a2=_0x51f0ce;_0x3027b6=0xc8;}else{_0x3027b6=0xce;}_0x6ae434[_0x7152('0x1c')](_0x3027b6);return _0x6ae434[_0x7152('0x1d')]('Content-Range',_0xf2ad37+'-'+_0x4a83a2+'/'+_0x51f0ce)['json'](_0x53315e);}return null;};}function patchUpdates(_0x1720c9){return function(_0x14b63d){try{jsonpatch[_0x7152('0x1e')](_0x14b63d,_0x1720c9,!![]);}catch(_0x378acd){return BPromise[_0x7152('0x1f')](_0x378acd);}return _0x14b63d['save']();};}function saveUpdates(_0x22c805,_0x149c64){return function(_0x241c98){if(_0x241c98){return _0x241c98[_0x7152('0x20')](_0x22c805)[_0x7152('0x21')](function(_0x51051d){return _0x51051d;});}return null;};}function removeEntity(_0x3bdee5,_0x24a664){return function(_0xf019d5){if(_0xf019d5){return _0xf019d5[_0x7152('0x22')]()[_0x7152('0x21')](function(){_0x3bdee5[_0x7152('0x1c')](0xcc)[_0x7152('0x17')]();});}};}function handleEntityNotFound(_0x2427e2,_0x578576){return function(_0x4671bf){if(!_0x4671bf){_0x2427e2[_0x7152('0x23')](0x194);}return _0x4671bf;};}function handleError(_0x128239,_0x3aff43){_0x3aff43=_0x3aff43||0x1f4;return function(_0x36c73b){logger['error'](_0x36c73b[_0x7152('0x24')]);if(_0x36c73b[_0x7152('0x25')]){delete _0x36c73b[_0x7152('0x25')];}_0x128239[_0x7152('0x1c')](_0x3aff43)[_0x7152('0x26')](_0x36c73b);};}exports[_0x7152('0x27')]=function(_0x51fb5c,_0x1d71f4){var _0x37b821={},_0x2e22bf={},_0x39ae3b={'count':0x0,'rows':[]};var _0x478323=_[_0x7152('0x28')](db[_0x7152('0x29')][_0x7152('0x2a')],function(_0x2c04af){return{'name':_0x2c04af['fieldName'],'type':_0x2c04af[_0x7152('0x2b')][_0x7152('0x2c')]};});_0x2e22bf['model']=_[_0x7152('0x2d')](_[_0x7152('0x28')](_0x478323,'name'),[_0x7152('0x25')]);_0x2e22bf[_0x7152('0x2e')]=_[_0x7152('0x2f')](_0x51fb5c[_0x7152('0x2e')]);_0x2e22bf[_0x7152('0x30')]=_[_0x7152('0x31')](_0x2e22bf[_0x7152('0x32')],_0x2e22bf['query']);_0x37b821['attributes']=_[_0x7152('0x31')](_0x2e22bf[_0x7152('0x32')],qs[_0x7152('0x33')](_0x51fb5c[_0x7152('0x2e')]['fields']));_0x37b821[_0x7152('0x34')]=_0x37b821[_0x7152('0x34')][_0x7152('0x35')]?_0x37b821[_0x7152('0x34')]:_0x2e22bf[_0x7152('0x32')];if(!_0x51fb5c[_0x7152('0x2e')][_0x7152('0x36')](_0x7152('0x37'))){_0x37b821[_0x7152('0x38')]=qs[_0x7152('0x38')](_0x51fb5c['query'][_0x7152('0x38')]);_0x37b821['offset']=qs[_0x7152('0x19')](_0x51fb5c[_0x7152('0x2e')][_0x7152('0x19')]);}_0x37b821[_0x7152('0x39')]=qs[_0x7152('0x3a')](_0x51fb5c[_0x7152('0x2e')][_0x7152('0x3a')]);_0x37b821[_0x7152('0x3b')]=qs[_0x7152('0x30')](_[_0x7152('0x3c')](_0x51fb5c[_0x7152('0x2e')],_0x2e22bf[_0x7152('0x30')]),_0x478323);if(_0x51fb5c[_0x7152('0x2e')][_0x7152('0x3d')]){_0x37b821[_0x7152('0x3b')]=_[_0x7152('0x3e')](_0x37b821[_0x7152('0x3b')],{'$or':_[_0x7152('0x28')](_0x478323,function(_0x465101){if(_0x465101[_0x7152('0x2b')]!==_0x7152('0x3f')){var _0x23b569={};_0x23b569[_0x465101[_0x7152('0x25')]]={'$like':'%'+_0x51fb5c[_0x7152('0x2e')][_0x7152('0x3d')]+'%'};return _0x23b569;}})});}_0x37b821=_[_0x7152('0x3e')]({},_0x37b821,_0x51fb5c[_0x7152('0x40')]);var _0x2dfe06={'where':_0x37b821[_0x7152('0x3b')]};return db['CmCustomField'][_0x7152('0x1b')](_0x2dfe06)[_0x7152('0x21')](function(_0x37398a){_0x39ae3b[_0x7152('0x1b')]=_0x37398a;if(_0x51fb5c[_0x7152('0x2e')][_0x7152('0x41')]){_0x37b821['include']=[{'all':!![]}];}return db['CmCustomField'][_0x7152('0x42')](_0x37b821);})[_0x7152('0x21')](function(_0xb7ed1f){_0x39ae3b[_0x7152('0x43')]=_0xb7ed1f;return _0x39ae3b;})[_0x7152('0x21')](respondWithFilteredResult(_0x1d71f4,_0x37b821))[_0x7152('0x44')](handleError(_0x1d71f4,null));};exports[_0x7152('0x45')]=function(_0x4cc0e5,_0x5b4e8c){var _0x5d317f={'raw':!![],'where':{'id':_0x4cc0e5[_0x7152('0x46')]['id']}},_0x288bf2={};_0x288bf2[_0x7152('0x32')]=_[_0x7152('0x2f')](db[_0x7152('0x29')][_0x7152('0x2a')]);_0x288bf2[_0x7152('0x2e')]=_[_0x7152('0x2f')](_0x4cc0e5[_0x7152('0x2e')]);_0x288bf2[_0x7152('0x30')]=_[_0x7152('0x31')](_0x288bf2[_0x7152('0x32')],_0x288bf2[_0x7152('0x2e')]);_0x5d317f['attributes']=_[_0x7152('0x31')](_0x288bf2[_0x7152('0x32')],qs['fields'](_0x4cc0e5['query'][_0x7152('0x33')]));_0x5d317f[_0x7152('0x34')]=_0x5d317f[_0x7152('0x34')][_0x7152('0x35')]?_0x5d317f['attributes']:_0x288bf2[_0x7152('0x32')];if(_0x4cc0e5['query']['includeAll']){_0x5d317f[_0x7152('0x47')]=[{'all':!![]}];}_0x5d317f=_[_0x7152('0x3e')]({},_0x5d317f,_0x4cc0e5[_0x7152('0x40')]);return db['CmCustomField'][_0x7152('0x48')](_0x5d317f)['then'](handleEntityNotFound(_0x5b4e8c,null))['then'](respondWithResult(_0x5b4e8c,null))[_0x7152('0x44')](handleError(_0x5b4e8c,null));};exports[_0x7152('0x20')]=function(_0x586c95,_0x9c5216){if(_0x586c95[_0x7152('0x49')]['id']){delete _0x586c95[_0x7152('0x49')]['id'];}return db['CmCustomField'][_0x7152('0x48')]({'where':{'id':_0x586c95[_0x7152('0x46')]['id']}})['then'](handleEntityNotFound(_0x9c5216,null))['then'](saveUpdates(_0x586c95[_0x7152('0x49')],null))[_0x7152('0x21')](respondWithResult(_0x9c5216,null))[_0x7152('0x44')](handleError(_0x9c5216,null));};exports['destroy']=function(_0x58a816,_0xb4f9f1){return db['CmCustomField']['find']({'where':{'id':_0x58a816[_0x7152('0x46')]['id']}})[_0x7152('0x21')](handleEntityNotFound(_0xb4f9f1,null))[_0x7152('0x21')](removeEntity(_0xb4f9f1,null))[_0x7152('0x44')](handleError(_0xb4f9f1,null));};exports['create']=function(_0x426efd,_0x12161b){var _0x4d9d50;return db['sequelize'][_0x7152('0x4a')](function(_0x94f294){return db[_0x7152('0x29')][_0x7152('0x4b')](_0x426efd[_0x7152('0x49')],{'transaction':_0x94f294})[_0x7152('0x21')](function(_0x4995df){_0x4d9d50=_0x4995df;var _0x21a7e2={'type':db[_0x7152('0x4c')]['TEXT'],'transaction':_0x94f294};switch(_0x426efd[_0x7152('0x49')][_0x7152('0x2b')]){case'text':_0x21a7e2[_0x7152('0x2b')]=db[_0x7152('0x4c')][_0x7152('0x4d')];break;case _0x7152('0x4e'):_0x21a7e2[_0x7152('0x2b')]=db['Sequelize']['INTEGER'];break;case _0x7152('0x4f'):_0x21a7e2[_0x7152('0x2b')]=db['Sequelize'][_0x7152('0x50')];_0x21a7e2[_0x7152('0x51')]=![];break;default:}return db['sequelize'][_0x7152('0x52')][_0x7152('0x53')](_0x7152('0x54'),util[_0x7152('0x55')](_0x7152('0x56'),_0x4d9d50['id']),_0x21a7e2);})[_0x7152('0x21')](function(){return _0x4d9d50;});})['then'](respondWithResult(_0x12161b,0xc9))[_0x7152('0x44')](handleError(_0x12161b,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index a7cf9bc..5f65aef 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 _0x696c=['request-promise','path','rimraf','../../config/environment','exports','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','moment','bluebird'];(function(_0x392831,_0x4a558b){var _0x3f6f75=function(_0x2cc9d6){while(--_0x2cc9d6){_0x392831['push'](_0x392831['shift']());}};_0x3f6f75(++_0x4a558b);}(_0x696c,0x17b));var _0xc696=function(_0x479988,_0x17b763){_0x479988=_0x479988-0x0;var _0x17610c=_0x696c[_0x479988];return _0x17610c;};'use strict';var _=require(_0xc696('0x0'));var util=require(_0xc696('0x1'));var logger=require(_0xc696('0x2'))('api');var moment=require(_0xc696('0x3'));var BPromise=require(_0xc696('0x4'));var rp=require(_0xc696('0x5'));var fs=require('fs');var path=require(_0xc696('0x6'));var rimraf=require(_0xc696('0x7'));var config=require(_0xc696('0x8'));var attributes=require('./cmCustomField.attributes');module[_0xc696('0x9')]=function(_0x1b8479,_0x3d3149){return _0x1b8479['define'](_0xc696('0xa'),attributes,{'tableName':_0xc696('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x154b=['../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0xc8f0ea,_0x3b007b){var _0x5533bf=function(_0x4de67d){while(--_0x4de67d){_0xc8f0ea['push'](_0xc8f0ea['shift']());}};_0x5533bf(++_0x3b007b);}(_0x154b,0x12e));var _0xb154=function(_0x3292cd,_0x2f56e2){_0x3292cd=_0x3292cd-0x0;var _0x39a1bc=_0x154b[_0x3292cd];return _0x39a1bc;};'use strict';var _=require(_0xb154('0x0'));var util=require('util');var logger=require(_0xb154('0x1'))(_0xb154('0x2'));var moment=require(_0xb154('0x3'));var BPromise=require('bluebird');var rp=require(_0xb154('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb154('0x5'));var config=require(_0xb154('0x6'));var attributes=require(_0xb154('0x7'));module[_0xb154('0x8')]=function(_0x1028ce,_0x17f46a){return _0x1028ce['define'](_0xb154('0x9'),attributes,{'tableName':_0xb154('0xa'),'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 9299f7e..a7103ec 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 _0x0d53=['request','info','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x4a7529,_0xba0830){var _0x254252=function(_0x53cbea){while(--_0x53cbea){_0x4a7529['push'](_0x4a7529['shift']());}};_0x254252(++_0xba0830);}(_0x0d53,0x79));var _0x30d5=function(_0x3294e6,_0x20fdb6){_0x3294e6=_0x3294e6-0x0;var _0x4fce75=_0x0d53[_0x3294e6];return _0x4fce75;};'use strict';var _=require(_0x30d5('0x0'));var util=require(_0x30d5('0x1'));var moment=require('moment');var BPromise=require(_0x30d5('0x2'));var rs=require(_0x30d5('0x3'));var fs=require('fs');var Redis=require(_0x30d5('0x4'));var db=require(_0x30d5('0x5'))['db'];var utils=require(_0x30d5('0x6'));var logger=require(_0x30d5('0x7'))(_0x30d5('0x8'));var config=require(_0x30d5('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x30d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fc92a,_0x5c4b47,_0x4c114f){return new BPromise(function(_0x35efd8,_0x46ec19){return client[_0x30d5('0xb')](_0x4fc92a,_0x4c114f)['then'](function(_0x2edb28){logger[_0x30d5('0xc')]('CmCustomField,\x20%s,\x20%s',_0x5c4b47,_0x30d5('0xd'));logger['debug'](_0x30d5('0xe'),_0x5c4b47,_0x30d5('0xd'),JSON[_0x30d5('0xf')](_0x2edb28));if(_0x2edb28[_0x30d5('0x10')]){if(_0x2edb28[_0x30d5('0x10')][_0x30d5('0x11')]===0x1f4){logger[_0x30d5('0x10')]('CmCustomField,\x20%s,\x20%s',_0x5c4b47,_0x2edb28[_0x30d5('0x10')]['message']);return _0x46ec19(_0x2edb28[_0x30d5('0x10')]['message']);}logger[_0x30d5('0x10')](_0x30d5('0x12'),_0x5c4b47,_0x2edb28[_0x30d5('0x10')][_0x30d5('0x13')]);return _0x35efd8(_0x2edb28[_0x30d5('0x10')][_0x30d5('0x13')]);}else{logger[_0x30d5('0xc')](_0x30d5('0x12'),_0x5c4b47,_0x30d5('0xd'));_0x35efd8(_0x2edb28[_0x30d5('0x14')]['message']);}})[_0x30d5('0x15')](function(_0x2e9656){logger[_0x30d5('0x10')](_0x30d5('0x12'),_0x5c4b47,_0x2e9656);_0x46ec19(_0x2e9656);});});} \ No newline at end of file +var _0x7840=['debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0x7059d1,_0x220af6){var _0x398f43=function(_0x155383){while(--_0x155383){_0x7059d1['push'](_0x7059d1['shift']());}};_0x398f43(++_0x220af6);}(_0x7840,0x68));var _0x0784=function(_0x92b599,_0x31b337){_0x92b599=_0x92b599-0x0;var _0x513c4d=_0x7840[_0x92b599];return _0x513c4d;};'use strict';var _=require('lodash');var util=require(_0x0784('0x0'));var moment=require(_0x0784('0x1'));var BPromise=require(_0x0784('0x2'));var rs=require(_0x0784('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0784('0x4'))['db'];var utils=require(_0x0784('0x5'));var logger=require(_0x0784('0x6'))(_0x0784('0x7'));var config=require('../../config/environment');var jayson=require(_0x0784('0x8'));var client=jayson[_0x0784('0x9')][_0x0784('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45dc20,_0x574768,_0x1e323a){return new BPromise(function(_0x41c7ef,_0x292447){return client[_0x0784('0xb')](_0x45dc20,_0x1e323a)[_0x0784('0xc')](function(_0x3e558f){logger[_0x0784('0xd')](_0x0784('0xe'),_0x574768,_0x0784('0xf'));logger[_0x0784('0x10')](_0x0784('0x11'),_0x574768,_0x0784('0xf'),JSON[_0x0784('0x12')](_0x3e558f));if(_0x3e558f[_0x0784('0x13')]){if(_0x3e558f['error'][_0x0784('0x14')]===0x1f4){logger[_0x0784('0x13')](_0x0784('0xe'),_0x574768,_0x3e558f[_0x0784('0x13')][_0x0784('0x15')]);return _0x292447(_0x3e558f[_0x0784('0x13')]['message']);}logger['error'](_0x0784('0xe'),_0x574768,_0x3e558f[_0x0784('0x13')][_0x0784('0x15')]);return _0x41c7ef(_0x3e558f['error'][_0x0784('0x15')]);}else{logger[_0x0784('0xd')](_0x0784('0xe'),_0x574768,_0x0784('0xf'));_0x41c7ef(_0x3e558f[_0x0784('0x16')]['message']);}})[_0x0784('0x17')](function(_0x113c53){logger[_0x0784('0x13')](_0x0784('0xe'),_0x574768,_0x113c53);_0x292447(_0x113c53);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index c2c831b..7f216e7 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 _0xf939=['delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','isAuthenticated','show','post','create','put','/:id'];(function(_0xeff2c3,_0x3a5a82){var _0x2cade6=function(_0x5a26a1){while(--_0x5a26a1){_0xeff2c3['push'](_0xeff2c3['shift']());}};_0x2cade6(++_0x3a5a82);}(_0xf939,0x1b8));var _0x9f93=function(_0x5be062,_0x48a5aa){_0x5be062=_0x5be062-0x0;var _0x1aa1b6=_0xf939[_0x5be062];return _0x1aa1b6;};'use strict';var multer=require(_0x9f93('0x0'));var util=require('util');var path=require(_0x9f93('0x1'));var timeout=require(_0x9f93('0x2'));var express=require(_0x9f93('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9f93('0x4'));var interaction=require(_0x9f93('0x5'));var config=require(_0x9f93('0x6'));var controller=require(_0x9f93('0x7'));router[_0x9f93('0x8')]('/',auth['isAuthenticated'](),controller[_0x9f93('0x9')]);router[_0x9f93('0x8')]('/:id',auth[_0x9f93('0xa')](),controller[_0x9f93('0xb')]);router[_0x9f93('0xc')]('/',auth[_0x9f93('0xa')](),controller[_0x9f93('0xd')]);router[_0x9f93('0xe')](_0x9f93('0xf'),auth[_0x9f93('0xa')](),controller['update']);router[_0x9f93('0x10')](_0x9f93('0xf'),auth['isAuthenticated'](),controller[_0x9f93('0x11')]);module[_0x9f93('0x12')]=router; \ No newline at end of file +var _0xb42d=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmCustomField.controller','isAuthenticated','index','get','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x1362b8,_0x20b21e){var _0x20372d=function(_0x41da5d){while(--_0x41da5d){_0x1362b8['push'](_0x1362b8['shift']());}};_0x20372d(++_0x20b21e);}(_0xb42d,0x1ed));var _0xdb42=function(_0x5cedf2,_0x3759f6){_0x5cedf2=_0x5cedf2-0x0;var _0x25453f=_0xb42d[_0x5cedf2];return _0x25453f;};'use strict';var multer=require(_0xdb42('0x0'));var util=require(_0xdb42('0x1'));var path=require(_0xdb42('0x2'));var timeout=require(_0xdb42('0x3'));var express=require(_0xdb42('0x4'));var router=express[_0xdb42('0x5')]();var fs_extra=require(_0xdb42('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdb42('0x7'));var config=require('../../config/environment');var controller=require(_0xdb42('0x8'));router['get']('/',auth[_0xdb42('0x9')](),controller[_0xdb42('0xa')]);router[_0xdb42('0xb')]('/:id',auth[_0xdb42('0x9')](),controller['show']);router[_0xdb42('0xc')]('/',auth[_0xdb42('0x9')](),controller[_0xdb42('0xd')]);router[_0xdb42('0xe')](_0xdb42('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xdb42('0x10')](_0xdb42('0xf'),auth[_0xdb42('0x9')](),controller[_0xdb42('0x11')]);module[_0xdb42('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index ec777bd..6781316 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 _0x5f3b=['BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','contactListQueue','moment','exports'];(function(_0x583405,_0x1a0d4b){var _0x30810b=function(_0x40119b){while(--_0x40119b){_0x583405['push'](_0x583405['shift']());}};_0x30810b(++_0x1a0d4b);}(_0x5f3b,0x1b7));var _0xb5f3=function(_0x268103,_0x373d73){_0x268103=_0x268103-0x0;var _0x209dfa=_0x5f3b[_0x268103];return _0x209dfa;};'use strict';var moment=require(_0xb5f3('0x0'));var Sequelize=require('sequelize');module[_0xb5f3('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xb5f3('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xb5f3('0x3')],'defaultValue':moment()[_0xb5f3('0x4')](_0xb5f3('0x5'))},'countbusyretry':{'type':Sequelize[_0xb5f3('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb5f3('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb5f3('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb5f3('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb5f3('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb5f3('0x3')]},'priority':{'type':Sequelize[_0xb5f3('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xb5f3('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb5f3('0x6')],'unique':_0xb5f3('0x8')},'ListId':{'type':Sequelize[_0xb5f3('0x6')],'unique':_0xb5f3('0x8')},'UserId':{'type':Sequelize[_0xb5f3('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xb5f3('0x8')},'CampaignId':{'type':Sequelize[_0xb5f3('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xb5f3('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb5f3('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb5f3('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb5f3('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb5f3('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xb5f3('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb5f3('0x7')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xaf06=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','sequelize','STRING','BOOLEAN','DATE','format'];(function(_0x12a2a6,_0x374ff1){var _0x1754ae=function(_0x49d787){while(--_0x49d787){_0x12a2a6['push'](_0x12a2a6['shift']());}};_0x1754ae(++_0x374ff1);}(_0xaf06,0x14b));var _0x6af0=function(_0x30b730,_0x1616aa){_0x30b730=_0x30b730-0x0;var _0x2b9434=_0xaf06[_0x30b730];return _0x2b9434;};'use strict';var moment=require('moment');var Sequelize=require(_0x6af0('0x0'));module['exports']={'phone':{'type':Sequelize[_0x6af0('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x6af0('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6af0('0x3')],'defaultValue':moment()[_0x6af0('0x4')](_0x6af0('0x5'))},'countbusyretry':{'type':Sequelize[_0x6af0('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6af0('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6af0('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6af0('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6af0('0x3')]},'priority':{'type':Sequelize[_0x6af0('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6af0('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x6af0('0x7')},'UserId':{'type':Sequelize[_0x6af0('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x6af0('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x6af0('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x6af0('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6af0('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6af0('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6af0('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0x6af0('0x3')],'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 8b5fbd8..c46c7cf 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 _0xcb99=['getPreviewRecall','recallme','Company','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','push','utcOffset','getTimezone','timezones','moment','../../components/parsers/qs','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','json','then','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$iLike','$overlap','$contains','$contained','attributes','length','nolimit','sort','where','pick','filter','merge','options','includeAll','CmHopper','findAll','rows','catch','show','params','fields','include','find','create','update','body','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','statedesc','deleted','campaign','membername','UserId','user','format','YYYY-MM-DD\x20HH:mm:ss','queue','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','destroy','end','CmContact','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','value','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','findOne','scheduledat','phone','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue'];(function(_0x49328c,_0x27dd83){var _0x171d08=function(_0x5c7f45){while(--_0x5c7f45){_0x49328c['push'](_0x49328c['shift']());}};_0x171d08(++_0x27dd83);}(_0xcb99,0x8b));var _0x9cb9=function(_0x84a85,_0x54e55c){_0x84a85=_0x84a85-0x0;var _0x1c2943=_0xcb99[_0x84a85];return _0x1c2943;};'use strict';var moment=require(_0x9cb9('0x0'));var _=require('lodash');var qs=require(_0x9cb9('0x1'));var logger=require('../../config/logger')('api');var shared=require(_0x9cb9('0x2'));var db=require(_0x9cb9('0x3'))['db'];function respondWithResult(_0x124c48,_0x51f2ee){_0x51f2ee=_0x51f2ee||0xc8;return function(_0x167735){if(_0x167735){return _0x124c48[_0x9cb9('0x4')](_0x51f2ee)['json'](_0x167735);}};}function respondWithFilteredResult(_0x214b72,_0x509cfc){return function(_0x2ed26a){if(_0x2ed26a){var _0xa84493=typeof _0x509cfc[_0x9cb9('0x5')]===_0x9cb9('0x6')&&typeof _0x509cfc[_0x9cb9('0x7')]===_0x9cb9('0x6');var _0x106f17=_0x2ed26a[_0x9cb9('0x8')];var _0x48d99a=_0xa84493?0x0:_0x509cfc['offset'];var _0xe6d275=_0xa84493?_0x2ed26a[_0x9cb9('0x8')]:_0x509cfc[_0x9cb9('0x5')]+_0x509cfc['limit'];var _0x3be02c;if(_0xe6d275>=_0x106f17){_0xe6d275=_0x106f17;_0x3be02c=0xc8;}else{_0x3be02c=0xce;}_0x214b72[_0x9cb9('0x4')](_0x3be02c);return _0x214b72['set']('Content-Range',_0x48d99a+'-'+_0xe6d275+'/'+_0x106f17)[_0x9cb9('0x9')](_0x2ed26a);}return null;};}function saveUpdates(_0x2e687e,_0x3382c8){return function(_0x1bcb05){if(_0x1bcb05){return _0x1bcb05['update'](_0x2e687e)[_0x9cb9('0xa')](function(_0x37dc98){return _0x37dc98;});}return null;};}function handleEntityNotFound(_0x3ec500,_0x32352d){return function(_0x18fa1f){if(!_0x18fa1f){_0x3ec500[_0x9cb9('0xb')](0x194);}return _0x18fa1f;};}function handleError(_0xc0bf6,_0x2132be){_0x2132be=_0x2132be||0x1f4;return function(_0x3975a5){logger[_0x9cb9('0xc')](_0x3975a5[_0x9cb9('0xd')]);if(_0x3975a5[_0x9cb9('0xe')]){delete _0x3975a5[_0x9cb9('0xe')];}_0xc0bf6[_0x9cb9('0x4')](_0x2132be)[_0x9cb9('0xf')](_0x3975a5);};}exports[_0x9cb9('0x10')]=function(_0x41e598,_0x5a6fba){var _0x4e89cf={},_0x59fcae={},_0x1a23d3={'count':0x0,'rows':[]};var _0x50169f=_['map'](db['CmHopper'][_0x9cb9('0x11')],function(_0x5b2aa3){return{'name':_0x5b2aa3[_0x9cb9('0x12')],'type':_0x5b2aa3[_0x9cb9('0x13')][_0x9cb9('0x14')]};});_0x59fcae[_0x9cb9('0x15')]=_[_0x9cb9('0x16')](_0x50169f,_0x9cb9('0xe'));_0x59fcae[_0x9cb9('0x17')]=_[_0x9cb9('0x18')](_0x41e598[_0x9cb9('0x17')]);_0x59fcae[_0x9cb9('0x19')]=_[_0x9cb9('0x1a')](_0x59fcae[_0x9cb9('0x15')],_0x59fcae[_0x9cb9('0x17')]);_0x59fcae[_0x9cb9('0x19')]=_['concat'](_0x59fcae['filters'],[_0x9cb9('0x1b'),_0x9cb9('0x1c'),_0x9cb9('0x1d'),_0x9cb9('0x1e'),_0x9cb9('0x1f'),_0x9cb9('0x20'),_0x9cb9('0x21'),_0x9cb9('0x22'),_0x9cb9('0x23'),'$between',_0x9cb9('0x24'),_0x9cb9('0x25'),_0x9cb9('0x26'),_0x9cb9('0x27'),'$notLike',_0x9cb9('0x28'),'$notILike',_0x9cb9('0x27'),_0x9cb9('0x29'),_0x9cb9('0x2a'),_0x9cb9('0x2b'),'$any']);_0x4e89cf[_0x9cb9('0x2c')]=_[_0x9cb9('0x1a')](_0x59fcae[_0x9cb9('0x15')],qs['fields'](_0x41e598[_0x9cb9('0x17')]['fields']));_0x4e89cf[_0x9cb9('0x2c')]=_0x4e89cf[_0x9cb9('0x2c')][_0x9cb9('0x2d')]?_0x4e89cf[_0x9cb9('0x2c')]:_0x59fcae[_0x9cb9('0x15')];if(!_0x41e598[_0x9cb9('0x17')]['hasOwnProperty'](_0x9cb9('0x2e'))){_0x4e89cf[_0x9cb9('0x7')]=qs[_0x9cb9('0x7')](_0x41e598['query']['limit']);_0x4e89cf[_0x9cb9('0x5')]=qs[_0x9cb9('0x5')](_0x41e598[_0x9cb9('0x17')]['offset']);}_0x4e89cf['order']=qs[_0x9cb9('0x2f')](_0x41e598[_0x9cb9('0x17')]['sort']);_0x4e89cf[_0x9cb9('0x30')]=qs[_0x9cb9('0x19')](_[_0x9cb9('0x31')](_0x41e598[_0x9cb9('0x17')],_0x59fcae[_0x9cb9('0x19')]),_0x50169f);if(_0x41e598['query'][_0x9cb9('0x32')]){_0x4e89cf[_0x9cb9('0x30')]=_['merge'](_0x4e89cf[_0x9cb9('0x30')],{'$or':_['map'](_0x50169f,function(_0x1f72b2){if(_0x1f72b2[_0x9cb9('0x13')]!=='VIRTUAL'){var _0x5668c4={};_0x5668c4[_0x1f72b2[_0x9cb9('0xe')]]={'$like':'%'+_0x41e598[_0x9cb9('0x17')][_0x9cb9('0x32')]+'%'};return _0x5668c4;}})});}_0x4e89cf=_[_0x9cb9('0x33')]({},_0x4e89cf,_0x41e598[_0x9cb9('0x34')]);var _0x2dd463={'where':_0x4e89cf[_0x9cb9('0x30')]};return db['CmHopper'][_0x9cb9('0x8')](_0x2dd463)[_0x9cb9('0xa')](function(_0x4496a4){_0x1a23d3[_0x9cb9('0x8')]=_0x4496a4;if(_0x41e598[_0x9cb9('0x17')][_0x9cb9('0x35')]){_0x4e89cf['include']=[{'all':!![]}];}return db[_0x9cb9('0x36')][_0x9cb9('0x37')](_0x4e89cf);})[_0x9cb9('0xa')](function(_0x31f8d7){_0x1a23d3[_0x9cb9('0x38')]=_0x31f8d7;return _0x1a23d3;})[_0x9cb9('0xa')](respondWithFilteredResult(_0x5a6fba,_0x4e89cf))[_0x9cb9('0x39')](handleError(_0x5a6fba,null));};exports[_0x9cb9('0x3a')]=function(_0x481377,_0x597db6){var _0x448113={'raw':!![],'where':{'id':_0x481377[_0x9cb9('0x3b')]['id']}},_0x5c0811={};_0x5c0811['model']=_[_0x9cb9('0x18')](db[_0x9cb9('0x36')][_0x9cb9('0x11')]);_0x5c0811[_0x9cb9('0x17')]=_['keys'](_0x481377[_0x9cb9('0x17')]);_0x5c0811['filters']=_[_0x9cb9('0x1a')](_0x5c0811[_0x9cb9('0x15')],_0x5c0811[_0x9cb9('0x17')]);_0x448113[_0x9cb9('0x2c')]=_[_0x9cb9('0x1a')](_0x5c0811['model'],qs[_0x9cb9('0x3c')](_0x481377[_0x9cb9('0x17')][_0x9cb9('0x3c')]));_0x448113[_0x9cb9('0x2c')]=_0x448113[_0x9cb9('0x2c')][_0x9cb9('0x2d')]?_0x448113[_0x9cb9('0x2c')]:_0x5c0811[_0x9cb9('0x15')];if(_0x481377[_0x9cb9('0x17')]['includeAll']){_0x448113[_0x9cb9('0x3d')]=[{'all':!![]}];}_0x448113=_[_0x9cb9('0x33')]({},_0x448113,_0x481377[_0x9cb9('0x34')]);return db[_0x9cb9('0x36')][_0x9cb9('0x3e')](_0x448113)['then'](handleEntityNotFound(_0x597db6,null))[_0x9cb9('0xa')](respondWithResult(_0x597db6,null))[_0x9cb9('0x39')](handleError(_0x597db6,null));};exports[_0x9cb9('0x3f')]=function(_0x52c295,_0x2813ce){return db[_0x9cb9('0x36')][_0x9cb9('0x3f')](_0x52c295['body'],{})[_0x9cb9('0xa')](respondWithResult(_0x2813ce,0xc9))[_0x9cb9('0x39')](handleError(_0x2813ce,null));};exports[_0x9cb9('0x40')]=function(_0x45bbdd,_0x2920fb){if(_0x45bbdd[_0x9cb9('0x41')]['id']){delete _0x45bbdd['body']['id'];}return db[_0x9cb9('0x36')][_0x9cb9('0x3e')]({'where':{'id':_0x45bbdd[_0x9cb9('0x3b')]['id']}})[_0x9cb9('0xa')](handleEntityNotFound(_0x2920fb,null))[_0x9cb9('0xa')](saveUpdates(_0x45bbdd[_0x9cb9('0x41')],null))[_0x9cb9('0xa')](respondWithResult(_0x2920fb,null))[_0x9cb9('0x39')](handleError(_0x2920fb,null));};exports[_0x9cb9('0x42')]=function(_0x28efec,_0x11e990){return db[_0x9cb9('0x36')][_0x9cb9('0x42')]()['then'](respondWithResult(_0x11e990,null))[_0x9cb9('0x39')](handleError(_0x11e990,null));};exports['destroy']=function(_0x40ae9b,_0x23fece){var _0x401f1e;var _0x5a7691=_0x40ae9b[_0x9cb9('0x3b')]['id'];return db[_0x9cb9('0x36')][_0x9cb9('0x3e')]({'where':{'id':_0x40ae9b[_0x9cb9('0x3b')]['id']}})['then'](handleEntityNotFound(_0x23fece,null))['then'](function(_0x57475e){if(_0x57475e){return _0x57475e['destroy']()['then'](function(_0x527e4a){return _0x527e4a;});}})[_0x9cb9('0xa')](function(_0x4490ec){_0x401f1e=_0x4490ec;if(_0x4490ec){if(_0x4490ec[_0x9cb9('0x43')]||_0x4490ec['CampaignId']){return db[_0x4490ec[_0x9cb9('0x43')]?_0x9cb9('0x44'):_0x9cb9('0x45')][_0x9cb9('0x3e')]({'where':{'id':_0x4490ec[_0x9cb9('0x43')]?_0x4490ec[_0x9cb9('0x43')]:_0x4490ec[_0x9cb9('0x46')]},'attributes':['id',_0x9cb9('0xe')],'raw':!![]});}}})['then'](function(_0x5b8ffa){var _0x58df82={};if(_0x5b8ffa){_[_0x9cb9('0x33')](_0x58df82,_[_0x9cb9('0x47')](_0x401f1e[_0x9cb9('0x48')],[_0x9cb9('0x49'),'updatedAt','id']));_0x58df82['state']=0x15;_0x58df82[_0x9cb9('0x4a')]=_0x9cb9('0x4b');_0x58df82[_0x9cb9('0x4c')]=_0x5b8ffa['name'];_0x58df82[_0x9cb9('0x4d')]=_0x40ae9b['user'][_0x9cb9('0xe')];_0x58df82[_0x9cb9('0x4e')]=_0x40ae9b[_0x9cb9('0x4f')]['id'];_0x58df82[_0x9cb9('0x4b')]=!![];_0x58df82['deletedat']=moment()[_0x9cb9('0x50')](_0x9cb9('0x51'));_0x58df82['calleridnum']=_0x401f1e['phone'];_0x58df82['campaigntype']=_0x401f1e[_0x9cb9('0x43')]?_0x9cb9('0x52'):'ivr';return db['CmContact'][_0x9cb9('0x3e')]({'where':{'id':_0x58df82[_0x9cb9('0x53')]},'attributes':[_0x9cb9('0x54'),_0x9cb9('0x55')]})[_0x9cb9('0xa')](function(_0x4e030a){if(!_[_0x9cb9('0x56')](_0x23fece)&&!_['isNil'](_0x4e030a['firstName'])){_0x58df82[_0x9cb9('0x57')]=_0x4e030a[_0x9cb9('0x54')];if(!_[_0x9cb9('0x56')](_0x4e030a['lastName'])){_0x58df82[_0x9cb9('0x57')]+='\x20'+_0x4e030a[_0x9cb9('0x55')];}}})[_0x9cb9('0x58')](function(){return db[_0x9cb9('0x59')][_0x9cb9('0x3f')](_0x58df82);});}})[_0x9cb9('0xa')](function(_0x21f73a){return db[_0x9cb9('0x5a')][_0x9cb9('0x5b')]({'where':{'CmHopperId':_0x5a7691}});})[_0x9cb9('0xa')](function(){return _0x23fece[_0x9cb9('0x4')](0xcc)[_0x9cb9('0x5c')]();})[_0x9cb9('0x39')](handleError(_0x23fece,null));};exports['getPreview']=function(_0x4dfc6e,_0x3e19ca){var _0x41ff82=[];return db[_0x9cb9('0x5d')]['describe']()[_0x9cb9('0xa')](function(_0xfd180d){_0x41ff82=_['keys'](_0xfd180d);return _0x4dfc6e['user'][_0x9cb9('0x5e')]({'where':{'type':_0x9cb9('0x5f'),'dialActive':!![],'dialMethod':_0x9cb9('0x60')},'attributes':['id','dialOrderByScheduledAt',_0x9cb9('0x61')],'raw':!![]});})['then'](function(_0x4473c6){if(_0x4473c6&&_0x4473c6[_0x9cb9('0x2d')]){return db[_0x9cb9('0x62')][_0x9cb9('0x63')](function(_0x3b3897){var _0x2d1b65={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x9cb9('0x16')](_0x4473c6,'id')},'$or':[{'UserId':null},{'UserId':_0x4dfc6e[_0x9cb9('0x4f')]['id']}]};var _0x38acc6={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4473c6)[_0x9cb9('0x32')](['dialPreviewAutoRecallMe',0x0])[_0x9cb9('0x16')]('id')[_0x9cb9('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x4dfc6e[_0x9cb9('0x4f')]['id']}]};var _0x58b9b3={'$or':[_0x2d1b65,_0x38acc6]};var _0x4f11b6=[];if(_0x4dfc6e['body']['direction']&&_0x4dfc6e[_0x9cb9('0x41')]['direction']===_0x9cb9('0x65')){if(!_[_0x9cb9('0x66')](_0x4dfc6e[_0x9cb9('0x41')][_0x9cb9('0x67')])){_0x58b9b3['id']={'$in':_0x4dfc6e[_0x9cb9('0x41')][_0x9cb9('0x67')]};}_0x4f11b6=[[_0x9cb9('0x68'),_0x9cb9('0x69')],[_0x9cb9('0x6a'),_0x4473c6[0x0]['dialOrderByScheduledAt']==='ASC'?_0x9cb9('0x6b'):_0x9cb9('0x69')],db['sequelize']['literal'](_0x9cb9('0x6c')),['id',_0x9cb9('0x6b')]];}else{if(!_['isEmpty'](_0x4dfc6e['body']['hopperIds'])){_0x58b9b3['id']={'$notIn':_0x4dfc6e['body'][_0x9cb9('0x67')]};}_0x4f11b6=[['priority',_0x9cb9('0x6b')],[_0x9cb9('0x6a'),_0x4473c6[0x0]['dialOrderByScheduledAt']],db[_0x9cb9('0x62')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0x9cb9('0x36')][_0x9cb9('0x6d')]({'attributes':['id',_0x9cb9('0x6e'),_0x9cb9('0x6f'),'recallme'],'where':_0x58b9b3,'order':_0x4f11b6,'transaction':_0x3b3897,'lock':_0x3b3897[_0x9cb9('0x70')][_0x9cb9('0x71')],'include':[{'model':db['CmContact'],'as':_0x9cb9('0x72'),'attributes':_0x41ff82,'include':[{'model':db[_0x9cb9('0x73')],'as':'Company','attributes':['id',_0x9cb9('0xe')]}]},{'model':db[_0x9cb9('0x74')],'as':_0x9cb9('0x75'),'attributes':['id',_0x9cb9('0xe')]},{'model':db[_0x9cb9('0x44')],'as':_0x9cb9('0x76'),'attributes':['id','name','dialActive']}]})[_0x9cb9('0xa')](function(_0x2c2ff1){if(_0x2c2ff1){return _0x2c2ff1[_0x9cb9('0x40')]({'UserId':_0x4dfc6e[_0x9cb9('0x4f')]['id']},{'transaction':_0x3b3897});}});});}})[_0x9cb9('0xa')](handleEntityNotFound(_0x3e19ca,null))[_0x9cb9('0xa')](respondWithResult(_0x3e19ca,null))[_0x9cb9('0x39')](handleError(_0x3e19ca,null));};exports[_0x9cb9('0x77')]=function(_0x24f574,_0x4eb9c6,_0x23a727){var _0x1ef68b=[];var _0x3ceb83=_0x24f574['params']['id'];var _0x7d8ce8=_0x24f574[_0x9cb9('0x4f')]['id'];return db[_0x9cb9('0x5d')][_0x9cb9('0x42')]()['then'](function(_0x222393){_0x1ef68b=_[_0x9cb9('0x18')](_0x222393);return db[_0x9cb9('0x62')][_0x9cb9('0x63')](function(_0x30342f){const _0x203156={'id':_0x3ceb83};return db[_0x9cb9('0x36')][_0x9cb9('0x6d')]({'attributes':['id',_0x9cb9('0x6e'),_0x9cb9('0x78')],'where':_0x203156,'transaction':_0x30342f,'lock':_0x30342f[_0x9cb9('0x70')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x1ef68b,'include':[{'model':db[_0x9cb9('0x73')],'as':_0x9cb9('0x79'),'attributes':['id','name']}]},{'model':db[_0x9cb9('0x74')],'as':_0x9cb9('0x75'),'attributes':['id','name']},{'model':db[_0x9cb9('0x44')],'as':'Queue','attributes':['id',_0x9cb9('0xe'),'dialActive']}]})[_0x9cb9('0xa')](function(_0xd49604){if(_0xd49604){return _0xd49604[_0x9cb9('0x40')]({'UserId':_0x7d8ce8},{'transaction':_0x30342f});}});});})[_0x9cb9('0xa')](handleEntityNotFound(_0x4eb9c6,null))[_0x9cb9('0xa')](respondWithResult(_0x4eb9c6,null))['catch'](handleError(_0x4eb9c6,null));};exports[_0x9cb9('0x7a')]=function(_0x303dfc,_0x3a60d3){return _0x303dfc['user']['getVoiceQueues']({'where':{'type':_0x9cb9('0x5f'),'dialActive':!![],'dialMethod':_0x9cb9('0x60')},'attributes':['id'],'raw':!![]})[_0x9cb9('0xa')](function(_0x288782){if(_0x288782&&_0x288782['length']){return db[_0x9cb9('0x36')][_0x9cb9('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x9cb9('0x51'))},'VoiceQueueId':{'$in':_[_0x9cb9('0x16')](_0x288782,'id')},'$or':[{'UserId':null},{'UserId':_0x303dfc[_0x9cb9('0x4f')]['id']}]}});}return 0x0;})[_0x9cb9('0xa')](function(_0x54043e){if(!_[_0x9cb9('0x56')](_0x54043e)&&_[_0x9cb9('0x7b')](_0x54043e)){return _0x3a60d3[_0x9cb9('0x4')](0xc8)[_0x9cb9('0x9')]({'contacts':_0x54043e});}else{logger[_0x9cb9('0xc')](_0x9cb9('0x7c'),_0x9cb9('0x7a'),0x194,'entity\x20not\x20found');_0x3a60d3[_0x9cb9('0xb')](0x194);}})['catch'](handleError(_0x3a60d3,null));};exports['getTimezones']=function(_0x54d5ed,_0x5341d1){var _0x32130f=shared['timezones'];var _0x4c2ca1=[];_[_0x9cb9('0x16')](_0x32130f,function(_0x465945){_0x4c2ca1[_0x9cb9('0x7d')]({'id':_0x465945[_0x9cb9('0xe')],'name':_0x465945[_0x9cb9('0xe')],'utcOffset':_0x465945[_0x9cb9('0x7e')]});});return _0x5341d1[_0x9cb9('0x4')](0xc8)[_0x9cb9('0x9')]({'tz':_0x4c2ca1});};exports[_0x9cb9('0x7f')]=function(_0x206abd,_0x5971eb){var _0xe48750=shared[_0x9cb9('0x80')];var _0x13b776={};if(!_[_0x9cb9('0x56')](_0xe48750[_0x206abd[_0x9cb9('0x41')]['id']]))_0x13b776=_0xe48750[_0x206abd['body']['id']];return _0x5971eb['status'](0xc8)[_0x9cb9('0x9')](_0x13b776);}; \ No newline at end of file +var _0x99c9=['queue','ivr','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','findOne','scheduledat','LOCK','UPDATE','CmContact','Contact','CmCompany','Company','CmList','dialActive','recallme','Queue','getOpenContacts','preview','sendStatus','getTimezones','timezones','push','utcOffset','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','send','index','map','CmHopper','fieldName','type','key','model','query','keys','filters','intersection','concat','$and','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$like','$notLike','$notILike','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone'];(function(_0xcb6fc2,_0x3bb85a){var _0x41eb97=function(_0x3b77a0){while(--_0x3b77a0){_0xcb6fc2['push'](_0xcb6fc2['shift']());}};_0x41eb97(++_0x3bb85a);}(_0x99c9,0x13c));var _0x999c=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x99c9[_0x49b207];return _0x2dc8fa;};'use strict';var moment=require(_0x999c('0x0'));var _=require(_0x999c('0x1'));var qs=require(_0x999c('0x2'));var logger=require(_0x999c('0x3'))(_0x999c('0x4'));var shared=require(_0x999c('0x5'));var db=require(_0x999c('0x6'))['db'];function respondWithResult(_0x52dc75,_0x2a4e06){_0x2a4e06=_0x2a4e06||0xc8;return function(_0x140cd5){if(_0x140cd5){return _0x52dc75[_0x999c('0x7')](_0x2a4e06)[_0x999c('0x8')](_0x140cd5);}};}function respondWithFilteredResult(_0x2bdd73,_0x14df32){return function(_0x34f100){if(_0x34f100){var _0x651b7e=typeof _0x14df32[_0x999c('0x9')]===_0x999c('0xa')&&typeof _0x14df32[_0x999c('0xb')]===_0x999c('0xa');var _0x32984f=_0x34f100[_0x999c('0xc')];var _0x4dd585=_0x651b7e?0x0:_0x14df32[_0x999c('0x9')];var _0x2bf133=_0x651b7e?_0x34f100['count']:_0x14df32[_0x999c('0x9')]+_0x14df32[_0x999c('0xb')];var _0x97d9fd;if(_0x2bf133>=_0x32984f){_0x2bf133=_0x32984f;_0x97d9fd=0xc8;}else{_0x97d9fd=0xce;}_0x2bdd73[_0x999c('0x7')](_0x97d9fd);return _0x2bdd73[_0x999c('0xd')](_0x999c('0xe'),_0x4dd585+'-'+_0x2bf133+'/'+_0x32984f)[_0x999c('0x8')](_0x34f100);}return null;};}function saveUpdates(_0x3d7c6d,_0x2e5f7e){return function(_0x44a5bc){if(_0x44a5bc){return _0x44a5bc[_0x999c('0xf')](_0x3d7c6d)[_0x999c('0x10')](function(_0x4c3209){return _0x4c3209;});}return null;};}function handleEntityNotFound(_0x15f812,_0xd14862){return function(_0x4f2916){if(!_0x4f2916){_0x15f812['sendStatus'](0x194);}return _0x4f2916;};}function handleError(_0x5f5a20,_0x161434){_0x161434=_0x161434||0x1f4;return function(_0xb3e981){logger[_0x999c('0x11')](_0xb3e981[_0x999c('0x12')]);if(_0xb3e981[_0x999c('0x13')]){delete _0xb3e981['name'];}_0x5f5a20[_0x999c('0x7')](_0x161434)[_0x999c('0x14')](_0xb3e981);};}exports[_0x999c('0x15')]=function(_0xc05363,_0x110486){var _0x500048={},_0x1b327f={},_0x3fb85e={'count':0x0,'rows':[]};var _0x3a8a99=_[_0x999c('0x16')](db[_0x999c('0x17')]['rawAttributes'],function(_0x3630b8){return{'name':_0x3630b8[_0x999c('0x18')],'type':_0x3630b8[_0x999c('0x19')][_0x999c('0x1a')]};});_0x1b327f[_0x999c('0x1b')]=_[_0x999c('0x16')](_0x3a8a99,'name');_0x1b327f[_0x999c('0x1c')]=_[_0x999c('0x1d')](_0xc05363[_0x999c('0x1c')]);_0x1b327f[_0x999c('0x1e')]=_[_0x999c('0x1f')](_0x1b327f[_0x999c('0x1b')],_0x1b327f[_0x999c('0x1c')]);_0x1b327f[_0x999c('0x1e')]=_[_0x999c('0x20')](_0x1b327f[_0x999c('0x1e')],[_0x999c('0x21'),'$or',_0x999c('0x22'),_0x999c('0x23'),_0x999c('0x24'),_0x999c('0x25'),_0x999c('0x26'),_0x999c('0x27'),'$not',_0x999c('0x28'),_0x999c('0x29'),_0x999c('0x2a'),'$notIn',_0x999c('0x2b'),_0x999c('0x2c'),'$iLike',_0x999c('0x2d'),'$like','$overlap',_0x999c('0x2e'),_0x999c('0x2f'),_0x999c('0x30')]);_0x500048[_0x999c('0x31')]=_[_0x999c('0x1f')](_0x1b327f[_0x999c('0x1b')],qs[_0x999c('0x32')](_0xc05363[_0x999c('0x1c')][_0x999c('0x32')]));_0x500048[_0x999c('0x31')]=_0x500048['attributes'][_0x999c('0x33')]?_0x500048[_0x999c('0x31')]:_0x1b327f[_0x999c('0x1b')];if(!_0xc05363[_0x999c('0x1c')][_0x999c('0x34')](_0x999c('0x35'))){_0x500048[_0x999c('0xb')]=qs[_0x999c('0xb')](_0xc05363['query']['limit']);_0x500048[_0x999c('0x9')]=qs[_0x999c('0x9')](_0xc05363[_0x999c('0x1c')][_0x999c('0x9')]);}_0x500048['order']=qs[_0x999c('0x36')](_0xc05363[_0x999c('0x1c')][_0x999c('0x36')]);_0x500048[_0x999c('0x37')]=qs['filters'](_['pick'](_0xc05363[_0x999c('0x1c')],_0x1b327f[_0x999c('0x1e')]),_0x3a8a99);if(_0xc05363[_0x999c('0x1c')][_0x999c('0x38')]){_0x500048[_0x999c('0x37')]=_[_0x999c('0x39')](_0x500048[_0x999c('0x37')],{'$or':_['map'](_0x3a8a99,function(_0x5ad13e){if(_0x5ad13e['type']!==_0x999c('0x3a')){var _0x574eae={};_0x574eae[_0x5ad13e['name']]={'$like':'%'+_0xc05363['query']['filter']+'%'};return _0x574eae;}})});}_0x500048=_[_0x999c('0x39')]({},_0x500048,_0xc05363[_0x999c('0x3b')]);var _0x15dc10={'where':_0x500048[_0x999c('0x37')]};return db['CmHopper'][_0x999c('0xc')](_0x15dc10)[_0x999c('0x10')](function(_0x513aa4){_0x3fb85e['count']=_0x513aa4;if(_0xc05363[_0x999c('0x1c')]['includeAll']){_0x500048[_0x999c('0x3c')]=[{'all':!![]}];}return db['CmHopper'][_0x999c('0x3d')](_0x500048);})[_0x999c('0x10')](function(_0x1763f0){_0x3fb85e[_0x999c('0x3e')]=_0x1763f0;return _0x3fb85e;})['then'](respondWithFilteredResult(_0x110486,_0x500048))['catch'](handleError(_0x110486,null));};exports[_0x999c('0x3f')]=function(_0x391c2e,_0x37c40d){var _0xf26ba3={'raw':!![],'where':{'id':_0x391c2e[_0x999c('0x40')]['id']}},_0x5e21b6={};_0x5e21b6[_0x999c('0x1b')]=_[_0x999c('0x1d')](db[_0x999c('0x17')]['rawAttributes']);_0x5e21b6[_0x999c('0x1c')]=_['keys'](_0x391c2e[_0x999c('0x1c')]);_0x5e21b6[_0x999c('0x1e')]=_['intersection'](_0x5e21b6[_0x999c('0x1b')],_0x5e21b6[_0x999c('0x1c')]);_0xf26ba3[_0x999c('0x31')]=_[_0x999c('0x1f')](_0x5e21b6[_0x999c('0x1b')],qs[_0x999c('0x32')](_0x391c2e[_0x999c('0x1c')][_0x999c('0x32')]));_0xf26ba3['attributes']=_0xf26ba3['attributes']['length']?_0xf26ba3['attributes']:_0x5e21b6[_0x999c('0x1b')];if(_0x391c2e[_0x999c('0x1c')][_0x999c('0x41')]){_0xf26ba3[_0x999c('0x3c')]=[{'all':!![]}];}_0xf26ba3=_[_0x999c('0x39')]({},_0xf26ba3,_0x391c2e['options']);return db[_0x999c('0x17')][_0x999c('0x42')](_0xf26ba3)[_0x999c('0x10')](handleEntityNotFound(_0x37c40d,null))[_0x999c('0x10')](respondWithResult(_0x37c40d,null))[_0x999c('0x43')](handleError(_0x37c40d,null));};exports['create']=function(_0x40fca1,_0x2e8dd6){return db[_0x999c('0x17')][_0x999c('0x44')](_0x40fca1[_0x999c('0x45')],{})[_0x999c('0x10')](respondWithResult(_0x2e8dd6,0xc9))[_0x999c('0x43')](handleError(_0x2e8dd6,null));};exports[_0x999c('0xf')]=function(_0x41d2b2,_0x4e82a9){if(_0x41d2b2['body']['id']){delete _0x41d2b2[_0x999c('0x45')]['id'];}return db[_0x999c('0x17')][_0x999c('0x42')]({'where':{'id':_0x41d2b2[_0x999c('0x40')]['id']}})[_0x999c('0x10')](handleEntityNotFound(_0x4e82a9,null))[_0x999c('0x10')](saveUpdates(_0x41d2b2[_0x999c('0x45')],null))[_0x999c('0x10')](respondWithResult(_0x4e82a9,null))[_0x999c('0x43')](handleError(_0x4e82a9,null));};exports[_0x999c('0x46')]=function(_0x3457d6,_0x4ca662){return db[_0x999c('0x17')][_0x999c('0x46')]()[_0x999c('0x10')](respondWithResult(_0x4ca662,null))[_0x999c('0x43')](handleError(_0x4ca662,null));};exports[_0x999c('0x47')]=function(_0x386be6,_0x11f3bf){var _0x396e2c;var _0x55eb16=_0x386be6[_0x999c('0x40')]['id'];return db[_0x999c('0x17')][_0x999c('0x42')]({'where':{'id':_0x386be6[_0x999c('0x40')]['id']}})[_0x999c('0x10')](handleEntityNotFound(_0x11f3bf,null))[_0x999c('0x10')](function(_0x12eb3d){if(_0x12eb3d){return _0x12eb3d['destroy']()['then'](function(_0x1139f6){return _0x1139f6;});}})[_0x999c('0x10')](function(_0x37fb36){_0x396e2c=_0x37fb36;if(_0x37fb36){if(_0x37fb36[_0x999c('0x48')]||_0x37fb36[_0x999c('0x49')]){return db[_0x37fb36['VoiceQueueId']?_0x999c('0x4a'):_0x999c('0x4b')][_0x999c('0x42')]({'where':{'id':_0x37fb36[_0x999c('0x48')]?_0x37fb36['VoiceQueueId']:_0x37fb36[_0x999c('0x49')]},'attributes':['id','name'],'raw':!![]});}}})[_0x999c('0x10')](function(_0x1129e9){var _0x243913={};if(_0x1129e9){_[_0x999c('0x39')](_0x243913,_[_0x999c('0x4c')](_0x396e2c[_0x999c('0x4d')],[_0x999c('0x4e'),'updatedAt','id']));_0x243913[_0x999c('0x4f')]=0x15;_0x243913[_0x999c('0x50')]=_0x999c('0x51');_0x243913['campaign']=_0x1129e9[_0x999c('0x13')];_0x243913[_0x999c('0x52')]=_0x386be6[_0x999c('0x53')]['name'];_0x243913[_0x999c('0x54')]=_0x386be6['user']['id'];_0x243913[_0x999c('0x51')]=!![];_0x243913[_0x999c('0x55')]=moment()[_0x999c('0x56')](_0x999c('0x57'));_0x243913['calleridnum']=_0x396e2c[_0x999c('0x58')];_0x243913['campaigntype']=_0x396e2c['VoiceQueueId']?_0x999c('0x59'):_0x999c('0x5a');return db['CmContact'][_0x999c('0x42')]({'where':{'id':_0x243913['ContactId']},'attributes':[_0x999c('0x5b'),_0x999c('0x5c')]})['then'](function(_0x9ca1c1){if(!_[_0x999c('0x5d')](_0x11f3bf)&&!_[_0x999c('0x5d')](_0x9ca1c1[_0x999c('0x5b')])){_0x243913[_0x999c('0x5e')]=_0x9ca1c1[_0x999c('0x5b')];if(!_[_0x999c('0x5d')](_0x9ca1c1[_0x999c('0x5c')])){_0x243913[_0x999c('0x5e')]+='\x20'+_0x9ca1c1['lastName'];}}})[_0x999c('0x5f')](function(){return db[_0x999c('0x60')][_0x999c('0x44')](_0x243913);});}})[_0x999c('0x10')](function(_0x171e60){return db[_0x999c('0x61')]['destroy']({'where':{'CmHopperId':_0x55eb16}});})['then'](function(){return _0x11f3bf['status'](0xcc)['end']();})[_0x999c('0x43')](handleError(_0x11f3bf,null));};exports[_0x999c('0x62')]=function(_0x36fd71,_0x4d4236){var _0x3569e8=[];return db['CmContact'][_0x999c('0x46')]()['then'](function(_0x27c404){_0x3569e8=_[_0x999c('0x1d')](_0x27c404);return _0x36fd71[_0x999c('0x53')][_0x999c('0x63')]({'where':{'type':_0x999c('0x64'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x999c('0x65'),_0x999c('0x66')],'raw':!![]});})[_0x999c('0x10')](function(_0x27f9af){if(_0x27f9af&&_0x27f9af[_0x999c('0x33')]){return db[_0x999c('0x67')][_0x999c('0x68')](function(_0x4d4c33){var _0x30f93c={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x999c('0x56')](_0x999c('0x57'))},'VoiceQueueId':{'$in':_[_0x999c('0x16')](_0x27f9af,'id')},'$or':[{'UserId':null},{'UserId':_0x36fd71[_0x999c('0x53')]['id']}]};var _0xc6c0c3={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x27f9af)[_0x999c('0x38')](['dialPreviewAutoRecallMe',0x0])[_0x999c('0x16')]('id')[_0x999c('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x36fd71['user']['id']}]};var _0x569ec9={'$or':[_0x30f93c,_0xc6c0c3]};var _0x25966e=[];if(_0x36fd71[_0x999c('0x45')][_0x999c('0x6a')]&&_0x36fd71['body'][_0x999c('0x6a')]===_0x999c('0x6b')){if(!_[_0x999c('0x6c')](_0x36fd71[_0x999c('0x45')][_0x999c('0x6d')])){_0x569ec9['id']={'$in':_0x36fd71[_0x999c('0x45')]['hopperIds']};}_0x25966e=[[_0x999c('0x6e'),'ASC'],[_0x999c('0x6f'),_0x27f9af[0x0][_0x999c('0x65')]===_0x999c('0x70')?_0x999c('0x71'):_0x999c('0x70')],db[_0x999c('0x67')][_0x999c('0x72')](_0x999c('0x73')),['id',_0x999c('0x71')]];}else{if(!_[_0x999c('0x6c')](_0x36fd71[_0x999c('0x45')][_0x999c('0x6d')])){_0x569ec9['id']={'$notIn':_0x36fd71[_0x999c('0x45')]['hopperIds']};}_0x25966e=[[_0x999c('0x6e'),_0x999c('0x71')],['scheduledAt',_0x27f9af[0x0][_0x999c('0x65')]],db[_0x999c('0x67')][_0x999c('0x72')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x999c('0x70')]];}return db[_0x999c('0x17')][_0x999c('0x74')]({'attributes':['id',_0x999c('0x75'),_0x999c('0x58'),'recallme'],'where':_0x569ec9,'order':_0x25966e,'transaction':_0x4d4c33,'lock':_0x4d4c33[_0x999c('0x76')][_0x999c('0x77')],'include':[{'model':db[_0x999c('0x78')],'as':_0x999c('0x79'),'attributes':_0x3569e8,'include':[{'model':db[_0x999c('0x7a')],'as':_0x999c('0x7b'),'attributes':['id',_0x999c('0x13')]}]},{'model':db[_0x999c('0x7c')],'as':'List','attributes':['id',_0x999c('0x13')]},{'model':db[_0x999c('0x4a')],'as':'Queue','attributes':['id','name',_0x999c('0x7d')]}]})[_0x999c('0x10')](function(_0x19a8e9){if(_0x19a8e9){return _0x19a8e9[_0x999c('0xf')]({'UserId':_0x36fd71['user']['id']},{'transaction':_0x4d4c33});}});});}})[_0x999c('0x10')](handleEntityNotFound(_0x4d4236,null))[_0x999c('0x10')](respondWithResult(_0x4d4236,null))[_0x999c('0x43')](handleError(_0x4d4236,null));};exports['getPreviewRecall']=function(_0x42261c,_0x4f6544,_0x2c1b7d){var _0x90eb9a=[];var _0x5d3c9f=_0x42261c[_0x999c('0x40')]['id'];var _0x587177=_0x42261c[_0x999c('0x53')]['id'];return db[_0x999c('0x78')][_0x999c('0x46')]()[_0x999c('0x10')](function(_0x1d27fe){_0x90eb9a=_[_0x999c('0x1d')](_0x1d27fe);return db[_0x999c('0x67')][_0x999c('0x68')](function(_0x22f536){const _0x1fa726={'id':_0x5d3c9f};return db[_0x999c('0x17')]['findOne']({'attributes':['id',_0x999c('0x75'),_0x999c('0x7e')],'where':_0x1fa726,'transaction':_0x22f536,'lock':_0x22f536[_0x999c('0x76')][_0x999c('0x77')],'include':[{'model':db[_0x999c('0x78')],'as':_0x999c('0x79'),'attributes':_0x90eb9a,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x999c('0x13')]}]},{'model':db[_0x999c('0x7c')],'as':'List','attributes':['id',_0x999c('0x13')]},{'model':db[_0x999c('0x4a')],'as':_0x999c('0x7f'),'attributes':['id','name',_0x999c('0x7d')]}]})['then'](function(_0xb2bd6){if(_0xb2bd6){return _0xb2bd6[_0x999c('0xf')]({'UserId':_0x587177},{'transaction':_0x22f536});}});});})[_0x999c('0x10')](handleEntityNotFound(_0x4f6544,null))[_0x999c('0x10')](respondWithResult(_0x4f6544,null))[_0x999c('0x43')](handleError(_0x4f6544,null));};exports[_0x999c('0x80')]=function(_0x1e8931,_0x417e2f){return _0x1e8931['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x999c('0x81')},'attributes':['id'],'raw':!![]})[_0x999c('0x10')](function(_0x179493){if(_0x179493&&_0x179493[_0x999c('0x33')]){return db[_0x999c('0x17')][_0x999c('0xc')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x999c('0x56')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x999c('0x16')](_0x179493,'id')},'$or':[{'UserId':null},{'UserId':_0x1e8931[_0x999c('0x53')]['id']}]}});}return 0x0;})[_0x999c('0x10')](function(_0x103f75){if(!_[_0x999c('0x5d')](_0x103f75)&&_['isNumber'](_0x103f75)){return _0x417e2f[_0x999c('0x7')](0xc8)['json']({'contacts':_0x103f75});}else{logger[_0x999c('0x11')]('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,'entity\x20not\x20found');_0x417e2f[_0x999c('0x82')](0x194);}})['catch'](handleError(_0x417e2f,null));};exports[_0x999c('0x83')]=function(_0x38df92,_0xebac9f){var _0x57c1c6=shared[_0x999c('0x84')];var _0x3e2275=[];_[_0x999c('0x16')](_0x57c1c6,function(_0x2c7c28){_0x3e2275[_0x999c('0x85')]({'id':_0x2c7c28[_0x999c('0x13')],'name':_0x2c7c28[_0x999c('0x13')],'utcOffset':_0x2c7c28[_0x999c('0x86')]});});return _0xebac9f[_0x999c('0x7')](0xc8)[_0x999c('0x8')]({'tz':_0x3e2275});};exports['getTimezone']=function(_0x20888e,_0x353d2b){var _0x59d43e=shared[_0x999c('0x84')];var _0x4ddc1c={};if(!_[_0x999c('0x5d')](_0x59d43e[_0x20888e['body']['id']]))_0x4ddc1c=_0x59d43e[_0x20888e[_0x999c('0x45')]['id']];return _0x353d2b['status'](0xc8)[_0x999c('0x8')](_0x4ddc1c);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index ad0149a..01170a3 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 _0xeff8=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone'];(function(_0x59b289,_0x247a13){var _0x4e90e8=function(_0x3c0da7){while(--_0x3c0da7){_0x59b289['push'](_0x59b289['shift']());}};_0x4e90e8(++_0x247a13);}(_0xeff8,0x186));var _0x8eff=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xeff8[_0xac151d];return _0x111dba;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));module['exports']=function(_0x469641,_0xb54063){return _0x469641[_0x8eff('0x9')](_0x8eff('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x8eff('0xb'),'fields':[_0x8eff('0xb')]},{'name':_0x8eff('0xc'),'fields':[_0x8eff('0xc')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xafc4=['priority','lodash','../../config/logger','moment','bluebird','request-promise','path','exports','define','CmHopper','cm_hopper','scheduledat','phone'];(function(_0x41a3de,_0x5dc963){var _0x570f43=function(_0x139f9a){while(--_0x139f9a){_0x41a3de['push'](_0x41a3de['shift']());}};_0x570f43(++_0x5dc963);}(_0xafc4,0x69));var _0x4afc=function(_0x535d32,_0x5aec8b){_0x535d32=_0x535d32-0x0;var _0x6e8424=_0xafc4[_0x535d32];return _0x6e8424;};'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('./cmHopper.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x4afc('0xa')]},{'name':_0x4afc('0xb'),'fields':[_0x4afc('0xb')]},{'name':_0x4afc('0xc'),'fields':[_0x4afc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index ee96fbe..a2c612b 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 _0x143a=['name','CmList','List','CmHopperHandlePreviewRecallNotifications','lodash','moment','bluebird','../../mysqldb','../../config/logger','client','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','map','include','model','catch','find','ShowCmHopper','stringify','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','order','LOCK','Contact','keys','User','Agent','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','UPDATE','GetCmHopperPreview','GetContactByPhone','phone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','NOW()'];(function(_0x3790f1,_0x1f6272){var _0x3978cd=function(_0x33390c){while(--_0x33390c){_0x3790f1['push'](_0x3790f1['shift']());}};_0x3978cd(++_0x1f6272);}(_0x143a,0x1c1));var _0xa143=function(_0x31ddea,_0x40de6d){_0x31ddea=_0x31ddea-0x0;var _0x12539b=_0x143a[_0x31ddea];return _0x12539b;};'use strict';var _=require(_0xa143('0x0'));var util=require('util');var moment=require(_0xa143('0x1'));var BPromise=require(_0xa143('0x2'));var db=require(_0xa143('0x3'))['db'];var logger=require(_0xa143('0x4'))('rpc');var jayson=require('jayson/promise');var client=jayson[_0xa143('0x5')][_0xa143('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x513195,_0x1fe314,_0x4ea719){return new BPromise(function(_0x594b3d,_0x3df418){return client[_0xa143('0x7')](_0x513195,_0x4ea719)[_0xa143('0x8')](function(_0x4b1b05){logger['info'](_0xa143('0x9'),_0x1fe314,_0xa143('0xa'));logger[_0xa143('0xb')](_0xa143('0xc'),_0x1fe314,_0xa143('0xa'),JSON['stringify'](_0x4b1b05));if(_0x4b1b05[_0xa143('0xd')]){if(_0x4b1b05[_0xa143('0xd')][_0xa143('0xe')]===0x1f4){logger[_0xa143('0xd')](_0xa143('0x9'),_0x1fe314,_0x4b1b05[_0xa143('0xd')][_0xa143('0xf')]);return _0x3df418(_0x4b1b05[_0xa143('0xd')][_0xa143('0xf')]);}logger[_0xa143('0xd')]('CmHopper,\x20%s,\x20%s',_0x1fe314,_0x4b1b05['error'][_0xa143('0xf')]);return _0x594b3d(_0x4b1b05[_0xa143('0xd')][_0xa143('0xf')]);}else{logger[_0xa143('0x10')](_0xa143('0x9'),_0x1fe314,_0xa143('0xa'));_0x594b3d(_0x4b1b05[_0xa143('0x11')][_0xa143('0xf')]);}})['catch'](function(_0x352eda){logger[_0xa143('0xd')](_0xa143('0x9'),_0x1fe314,_0x352eda);_0x3df418(_0x352eda);});});}exports[_0xa143('0x12')]=function(_0x9bec4b){var _0x1ea9b1=this;return new Promise(function(_0x5b235c,_0x15f360){return db[_0xa143('0x13')][_0xa143('0x14')]({'raw':_0x9bec4b[_0xa143('0x15')]?_0x9bec4b[_0xa143('0x15')][_0xa143('0x16')]===undefined?!![]:![]:!![],'where':_0x9bec4b[_0xa143('0x15')]?_0x9bec4b[_0xa143('0x15')][_0xa143('0x17')]||null:null,'attributes':_0x9bec4b['options']?_0x9bec4b[_0xa143('0x15')][_0xa143('0x18')]||null:null,'limit':_0x9bec4b['options']?_0x9bec4b[_0xa143('0x15')][_0xa143('0x19')]||null:null,'include':_0x9bec4b[_0xa143('0x15')]?_0x9bec4b[_0xa143('0x15')]['include']?_[_0xa143('0x1a')](_0x9bec4b[_0xa143('0x15')][_0xa143('0x1b')],function(_0x677999){return{'model':db[_0x677999[_0xa143('0x1c')]],'as':_0x677999['as'],'attributes':_0x677999[_0xa143('0x18')],'include':_0x677999[_0xa143('0x1b')]?_[_0xa143('0x1a')](_0x677999[_0xa143('0x1b')],function(_0x472550){return{'model':db[_0x472550['model']],'as':_0x472550['as'],'attributes':_0x472550[_0xa143('0x18')],'include':_0x472550[_0xa143('0x1b')]?_[_0xa143('0x1a')](_0x472550[_0xa143('0x1b')],function(_0x5c4edb){return{'model':db[_0x5c4edb[_0xa143('0x1c')]],'as':_0x5c4edb['as'],'attributes':_0x5c4edb[_0xa143('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa143('0x8')](function(_0x3ff330){logger[_0xa143('0x10')](_0xa143('0x12'),_0x9bec4b);logger[_0xa143('0xb')](_0xa143('0x12'),_0x9bec4b,JSON['stringify'](_0x3ff330));_0x5b235c(_0x3ff330);})[_0xa143('0x1d')](function(_0x5ec3e1){logger[_0xa143('0xd')](_0xa143('0x12'),_0x5ec3e1[_0xa143('0xf')],_0x9bec4b);_0x15f360(_0x1ea9b1['error'](0x1f4,_0x5ec3e1[_0xa143('0xf')]));});});};exports['ShowCmHopper']=function(_0x2d19a0){var _0x1e8e76=this;return new Promise(function(_0x1e82cb,_0x43ffa4){return db[_0xa143('0x13')][_0xa143('0x1e')]({'raw':_0x2d19a0['options']?_0x2d19a0[_0xa143('0x15')][_0xa143('0x16')]===undefined?!![]:![]:!![],'where':_0x2d19a0[_0xa143('0x15')]?_0x2d19a0['options'][_0xa143('0x17')]||null:null,'attributes':_0x2d19a0['options']?_0x2d19a0[_0xa143('0x15')][_0xa143('0x18')]||null:null,'include':_0x2d19a0['options']?_0x2d19a0[_0xa143('0x15')][_0xa143('0x1b')]?_[_0xa143('0x1a')](_0x2d19a0[_0xa143('0x15')][_0xa143('0x1b')],function(_0x5b2408){return{'model':db[_0x5b2408[_0xa143('0x1c')]],'as':_0x5b2408['as'],'attributes':_0x5b2408['attributes'],'include':_0x5b2408[_0xa143('0x1b')]?_[_0xa143('0x1a')](_0x5b2408[_0xa143('0x1b')],function(_0x5b5d77){return{'model':db[_0x5b5d77[_0xa143('0x1c')]],'as':_0x5b5d77['as'],'attributes':_0x5b5d77['attributes'],'include':_0x5b5d77['include']?_[_0xa143('0x1a')](_0x5b5d77['include'],function(_0x39e68b){return{'model':db[_0x39e68b[_0xa143('0x1c')]],'as':_0x39e68b['as'],'attributes':_0x39e68b[_0xa143('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa143('0x8')](function(_0x5ed04e){logger[_0xa143('0x10')](_0xa143('0x1f'),_0x2d19a0);logger[_0xa143('0xb')](_0xa143('0x1f'),_0x2d19a0,JSON[_0xa143('0x20')](_0x5ed04e));_0x1e82cb(_0x5ed04e);})['catch'](function(_0x479872){logger[_0xa143('0xd')](_0xa143('0x1f'),_0x479872[_0xa143('0xf')],_0x2d19a0);_0x43ffa4(_0x1e8e76['error'](0x1f4,_0x479872[_0xa143('0xf')]));});});};exports[_0xa143('0x21')]=function(_0x155ec7){var _0x464c67=this;return new Promise(function(_0x26ded8,_0x338fb8){return db[_0xa143('0x13')][_0xa143('0x22')](_0x155ec7[_0xa143('0x23')],{'raw':_0x155ec7[_0xa143('0x15')]?_0x155ec7[_0xa143('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xa143('0x8')](function(_0x123bb8){logger['info'](_0xa143('0x21'),_0x155ec7);logger['debug']('CreateCmHopper',_0x155ec7,JSON[_0xa143('0x20')](_0x123bb8));_0x26ded8(_0x123bb8);})['catch'](function(_0x5e785b){logger[_0xa143('0xd')]('CreateCmHopper',_0x5e785b['message'],_0x155ec7);_0x338fb8(_0x464c67[_0xa143('0xd')](0x1f4,_0x5e785b['message']));});});};exports[_0xa143('0x24')]=function(_0x587512){var _0x423319=this;return new Promise(function(_0x373b2a,_0x27c12c){return db['CmHopper'][_0xa143('0x25')](_0x587512[_0xa143('0x23')],{'raw':_0x587512['options']?_0x587512[_0xa143('0x15')][_0xa143('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x587512[_0xa143('0x15')]?_0x587512[_0xa143('0x15')][_0xa143('0x17')]||null:null,'attributes':_0x587512[_0xa143('0x15')]?_0x587512[_0xa143('0x15')][_0xa143('0x18')]||null:null,'limit':_0x587512[_0xa143('0x15')]?_0x587512[_0xa143('0x15')]['limit']||null:null})['then'](function(_0x45305a){logger[_0xa143('0x10')]('UpdateCmHopper',_0x587512);logger[_0xa143('0x10')](_0xa143('0x26'),JSON[_0xa143('0x20')](_0x587512[_0xa143('0x15')][_0xa143('0x17')]),_0x587512['body'][_0xa143('0x27')]);logger[_0xa143('0xb')](_0xa143('0x24'),_0x587512,JSON[_0xa143('0x20')](_0x45305a));_0x373b2a(_0x45305a);})[_0xa143('0x1d')](function(_0x329cdb){logger[_0xa143('0xd')](_0xa143('0x24'),_0x329cdb[_0xa143('0xf')],_0x587512);_0x27c12c(_0x423319[_0xa143('0xd')](0x1f4,_0x329cdb[_0xa143('0xf')]));});});};exports[_0xa143('0x28')]=function(_0x3885fa){var _0xb2cedd=this;return new Promise(function(_0x246afb,_0x1f9a81){return db['CmHopper'][_0xa143('0x29')]({'where':_0x3885fa[_0xa143('0x15')]?_0x3885fa['options']['where']||null:null})[_0xa143('0x8')](function(_0xac3498){logger[_0xa143('0x10')](_0xa143('0x28'),_0x3885fa);logger[_0xa143('0xb')](_0xa143('0x28'),_0x3885fa,JSON[_0xa143('0x20')](_0xac3498));_0x246afb(_0xac3498);})[_0xa143('0x1d')](function(_0x4b5229){logger[_0xa143('0xd')](_0xa143('0x28'),_0x4b5229['message'],_0x3885fa);_0x1f9a81(_0xb2cedd[_0xa143('0xd')](0x1f4,_0x4b5229[_0xa143('0xf')]));});});};exports['GetContactDialer']=function(_0x5f0a1b){var _0xa1c18f=this;return new Promise(function(_0x49d1c8,_0x48289f){return db[_0xa143('0x2a')][_0xa143('0x2b')]()[_0xa143('0x8')](function(_0x4a6063){return db[_0xa143('0x2c')][_0xa143('0x2d')](function(_0x364cf1){return db['CmHopper']['findAll']({'where':_0x5f0a1b[_0xa143('0x15')]?_0x5f0a1b[_0xa143('0x15')][_0xa143('0x17')]||null:null,'attributes':_0x5f0a1b[_0xa143('0x15')]?_0x5f0a1b[_0xa143('0x15')][_0xa143('0x18')]||null:null,'limit':_0x5f0a1b['options']?_0x5f0a1b['options'][_0xa143('0x19')]||null:null,'order':_0x5f0a1b[_0xa143('0x15')]?_0x5f0a1b['options'][_0xa143('0x2e')]||null:null,'transaction':_0x364cf1,'lock':_0x364cf1[_0xa143('0x2f')]['UPDATE'],'include':[{'model':db[_0xa143('0x2a')],'as':_0xa143('0x30'),'attributes':_[_0xa143('0x31')](_0x4a6063)},{'model':db[_0xa143('0x32')],'as':_0xa143('0x33'),'attributes':['id','name',_0xa143('0x34')]}]})[_0xa143('0x8')](function(_0x136637){var _0x6c37c8=[];var _0x98c104=[];for(var _0x183e49=0x0;_0x183e49<_0x136637[_0xa143('0x35')];_0x183e49+=0x1){var _0x2dc84a=_0x136637[_0x183e49][_0xa143('0x36')];if(_0x2dc84a===null){_0x6c37c8[_0xa143('0x37')](_0x136637[_0x183e49]['update'](_0x5f0a1b[_0xa143('0x23')],{'transaction':_0x364cf1}));}else if(!_0x98c104[_0xa143('0x38')](_0x2dc84a)){_0x98c104[_0xa143('0x37')](_0x2dc84a);_0x6c37c8[_0xa143('0x37')](_0x136637[_0x183e49][_0xa143('0x25')](_0x5f0a1b['body'],{'transaction':_0x364cf1}));}}return BPromise[_0xa143('0x39')](_0x6c37c8);});})[_0xa143('0x8')](function(_0x1c3dd7){logger[_0xa143('0x10')]('GetContactDialer',_0x5f0a1b);if(_0x1c3dd7[_0xa143('0x35')]>0x0){logger[_0xa143('0x10')](_0xa143('0x3a'),_0x1c3dd7[0x0][_0xa143('0x3b')]['id'],_0x1c3dd7[0x0][_0xa143('0x3b')][_0xa143('0x3c')],_0x1c3dd7[0x0]['dataValues'][_0xa143('0x27')]);}logger[_0xa143('0xb')](_0xa143('0x3d'),_0x5f0a1b,JSON[_0xa143('0x20')](_0x1c3dd7));_0x49d1c8(_0x1c3dd7);})[_0xa143('0x1d')](function(_0x5c5b54){logger[_0xa143('0xd')](_0xa143('0x3d'),_0x5c5b54[_0xa143('0xf')],_0x5f0a1b);_0x48289f(_0xa1c18f[_0xa143('0xd')](0x1f4,_0x5c5b54['message']));});});});};exports[_0xa143('0x3e')]=function(_0x5852d0){var _0x57facc=this;return new Promise(function(_0x43432c,_0x41ebd4){return db[_0xa143('0x2c')][_0xa143('0x2d')](function(_0x3d41ab){return db[_0xa143('0x3f')][_0xa143('0x22')](_0x5852d0[_0xa143('0x23')],{'raw':_0x5852d0[_0xa143('0x15')]?_0x5852d0[_0xa143('0x15')]['raw']===undefined?!![]:![]:!![],'transaction':_0x3d41ab})[_0xa143('0x8')](function(){logger[_0xa143('0x10')](_0xa143('0x40'),JSON[_0xa143('0x20')](_0x5852d0[_0xa143('0x15')]['where']),_0x5852d0[_0xa143('0x15')]['where'][_0xa143('0x27')]);return db['CmHopper'][_0xa143('0x29')]({'where':_0x5852d0['options']?_0x5852d0[_0xa143('0x15')][_0xa143('0x17')]||null:null,'transaction':_0x3d41ab});});})[_0xa143('0x8')](function(_0x473005){logger['info'](_0xa143('0x3e'),_0x5852d0);logger['debug'](_0xa143('0x3e'),_0x5852d0,JSON[_0xa143('0x20')](_0x473005));_0x43432c(_0x473005);})[_0xa143('0x1d')](function(_0xd7bef1){logger[_0xa143('0xd')](_0xa143('0x3e'),_0xd7bef1[_0xa143('0xf')],_0x5852d0);_0x41ebd4(_0x57facc[_0xa143('0xd')](0x1f4,_0xd7bef1['message']));});});};exports['CountReScheduled']=function(_0x43185a){var _0x398985=this;return new Promise(function(_0x585186,_0x3b1e1c){return db[_0xa143('0x13')][_0xa143('0x14')]({'raw':_0x43185a[_0xa143('0x15')]?_0x43185a[_0xa143('0x15')][_0xa143('0x16')]===undefined?!![]:![]:!![],'where':_0x43185a[_0xa143('0x15')]?_0x43185a[_0xa143('0x15')]['where']||null:null,'attributes':[[db[_0xa143('0x2c')]['fn'](_0xa143('0x41'),db['sequelize']['fn']('IF',db[_0xa143('0x2c')][_0xa143('0x42')](_0xa143('0x43')+util[_0xa143('0x44')](_0xa143('0x45'),moment()[_0xa143('0x44')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xa143('0x46')))),_0xa143('0x47')]]})['then'](function(_0x5af7e6){logger[_0xa143('0x10')](_0xa143('0x48'),_0x43185a);logger['debug'](_0xa143('0x48'),_0x43185a,JSON[_0xa143('0x20')](_0x5af7e6));_0x585186(_0x5af7e6);})[_0xa143('0x1d')](function(_0x51b6e9){logger['error'](_0xa143('0x48'),_0x51b6e9[_0xa143('0xf')],_0x43185a);_0x3b1e1c(_0x398985[_0xa143('0xd')](0x1f4,_0x51b6e9['message']));});});};exports[_0xa143('0x49')]=function(_0x2fec72){var _0x36b10b=this;return new Promise(function(_0x2fe6a8,_0x569d98){return db['CmContact'][_0xa143('0x2b')]()[_0xa143('0x8')](function(_0x177833){return db[_0xa143('0x2c')]['transaction'](function(_0x17a102){return db[_0xa143('0x13')][_0xa143('0x14')]({'where':_0x2fec72[_0xa143('0x15')]?_0x2fec72[_0xa143('0x15')][_0xa143('0x17')]||null:null,'attributes':_0x2fec72[_0xa143('0x15')]?_0x2fec72[_0xa143('0x15')]['attributes']||null:null,'limit':0x1,'order':_0x2fec72[_0xa143('0x15')]?_0x2fec72['options'][_0xa143('0x2e')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x17a102,'lock':_0x17a102['LOCK'][_0xa143('0x4a')],'include':_0x2fec72[_0xa143('0x15')]?_0x2fec72['options'][_0xa143('0x1b')]?_[_0xa143('0x1a')](_0x2fec72['options'][_0xa143('0x1b')],function(_0x5b4253){return{'model':db[_0x5b4253[_0xa143('0x1c')]],'as':_0x5b4253['as'],'attributes':_0x5b4253['attributes'],'include':_0x5b4253[_0xa143('0x1b')]?_[_0xa143('0x1a')](_0x5b4253[_0xa143('0x1b')],function(_0x36e36f){return{'model':db[_0x36e36f[_0xa143('0x1c')]],'as':_0x36e36f['as'],'attributes':_0x36e36f['attributes'],'include':_0x36e36f[_0xa143('0x1b')]?_[_0xa143('0x1a')](_0x36e36f[_0xa143('0x1b')],function(_0xf0fdd6){return{'model':db[_0xf0fdd6[_0xa143('0x1c')]],'as':_0xf0fdd6['as'],'attributes':_0xf0fdd6['attributes']};}):[]};}):[]};}):[]:[]})[_0xa143('0x8')](function(_0x386753){var _0x18edf3=[];for(var _0x38f74e=0x0;_0x38f74e<_0x386753[_0xa143('0x35')];_0x38f74e+=0x1){_0x18edf3[_0xa143('0x37')](_0x386753[_0x38f74e][_0xa143('0x25')](_0x2fec72[_0xa143('0x23')],{'transaction':_0x17a102}));}return BPromise[_0xa143('0x39')](_0x18edf3);});})[_0xa143('0x8')](function(_0x38e898){logger[_0xa143('0x10')](_0xa143('0x49'),_0x2fec72);logger[_0xa143('0xb')](_0xa143('0x49'),_0x2fec72,JSON[_0xa143('0x20')](_0x38e898));_0x2fe6a8(_0x38e898);})['catch'](function(_0x31daec){logger[_0xa143('0xd')](_0xa143('0x49'),_0x31daec['message'],_0x2fec72);_0x569d98(_0x36b10b['error'](0x1f4,_0x31daec[_0xa143('0xf')]));});});});};exports[_0xa143('0x4b')]=function(_0x1ca37d){var _0x586b64=this;return new Promise(function(_0x513d8c,_0x1d703c){db[_0xa143('0x2a')]['describe']()[_0xa143('0x8')](function(_0x2f1fb2){return db['CmHopper'][_0xa143('0x14')]({'raw':_0x1ca37d[_0xa143('0x15')]?_0x1ca37d[_0xa143('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1ca37d[_0xa143('0x15')]?_0x1ca37d[_0xa143('0x15')][_0xa143('0x17')]||null:null,'attributes':_0x1ca37d[_0xa143('0x15')]?_0x1ca37d[_0xa143('0x15')][_0xa143('0x18')]||null:null,'limit':_0x1ca37d[_0xa143('0x15')]?_0x1ca37d['options']['limit']||null:null,'include':_0x1ca37d[_0xa143('0x15')]?_0x1ca37d[_0xa143('0x15')][_0xa143('0x1b')]?_[_0xa143('0x1a')](_0x1ca37d['options'][_0xa143('0x1b')],function(_0x4e748e){return{'model':db[_0x4e748e[_0xa143('0x1c')]],'as':_0x4e748e['as'],'attributes':_0x4e748e['as']===_0xa143('0x30')?_[_0xa143('0x31')](_0x2f1fb2):_0x4e748e[_0xa143('0x18')],'include':_0x4e748e[_0xa143('0x1b')]?_[_0xa143('0x1a')](_0x4e748e['include'],function(_0x53f159){return{'model':db[_0x53f159[_0xa143('0x1c')]],'as':_0x53f159['as'],'attributes':_0x53f159[_0xa143('0x18')],'include':_0x53f159['include']?_[_0xa143('0x1a')](_0x53f159[_0xa143('0x1b')],function(_0x3bed8c){return{'model':db[_0x3bed8c[_0xa143('0x1c')]],'as':_0x3bed8c['as'],'attributes':_0x3bed8c[_0xa143('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa143('0x8')](function(_0x5470f){logger[_0xa143('0x10')](_0xa143('0x12'),_0x1ca37d);logger[_0xa143('0xb')](_0xa143('0x12'),_0x1ca37d,JSON['stringify'](_0x5470f));_0x513d8c(_0x5470f);})[_0xa143('0x1d')](function(_0x30b962){logger[_0xa143('0xd')]('GetCmHopper',_0x30b962['message'],_0x1ca37d);_0x1d703c(_0x586b64[_0xa143('0xd')](0x1f4,_0x30b962[_0xa143('0xf')]));});});});};exports[_0xa143('0x4c')]=function(_0x1967b6){var _0x2d3da8=this;return new Promise(function(_0x4c8d11,_0x49fa8b){return db[_0xa143('0x2a')]['findOne']({'raw':!![],'where':{'phone':_0x1967b6['options'][_0xa143('0x17')][_0xa143('0x4d')]},'attributes':['id','dialTimezone'],'order':[['id',_0xa143('0x4e')]]})['then'](function(_0x44aa7c){logger[_0xa143('0x10')](_0xa143('0x4f'),_0x1967b6);logger['debug'](_0xa143('0x4f'),_0x1967b6,JSON[_0xa143('0x20')](_0x44aa7c));_0x4c8d11(_0x44aa7c);})[_0xa143('0x1d')](function(_0x498721){logger[_0xa143('0xd')](_0xa143('0x4f'),_0x498721[_0xa143('0xf')],_0x1967b6);_0x49fa8b(_0x2d3da8[_0xa143('0xd')](0x1f4,_0x498721['message']));});});};exports['ResetActiveCalls']=function(_0x1c2dbd){var _0x214d54=this;return new Promise(function(_0x3ec8d6,_0x17fd33){return db[_0xa143('0x2c')]['transaction'](function(_0x461d0c){return db[_0xa143('0x13')]['update'](_0x1c2dbd[_0xa143('0x23')],{'where':{},'transaction':_0x461d0c})['then'](function(_0x1e742c){logger['info']('ResetActiveCalls',_0x1c2dbd);logger['debug'](_0xa143('0x50'),_0x1c2dbd,JSON[_0xa143('0x20')](_0x1e742c));_0x3ec8d6(_0x1e742c);})[_0xa143('0x1d')](function(_0x3ac73f){logger[_0xa143('0xd')]('ResetActiveCalls',_0x3ac73f['message'],_0x1c2dbd);_0x17fd33(_0x214d54[_0xa143('0xd')](0x1f4,_0x3ac73f[_0xa143('0xf')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0xc3273e){var _0x34171a=this;var _0x214416=_0xc3273e[_0xa143('0x23')][_0xa143('0x17')][_0xa143('0x51')];var _0x447499=_0xc3273e[_0xa143('0x23')][_0xa143('0x17')]['interval'];var _0x7b645e=_0xc3273e[_0xa143('0x23')][_0xa143('0x17')][_0xa143('0x52')];return new Promise(function(_0x53b392,_0x2892f3){return db[_0xa143('0x13')][_0xa143('0x14')]({'where':{'voiceQueueId':{'$in':_0x214416},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xa143('0x2c')][_0xa143('0x42')](_0xa143('0x53')+_0x447499+'\x20MINUTE'),'$gt':db[_0xa143('0x2c')][_0xa143('0x42')](_0xa143('0x54'))}},'UserId':{'$in':_0x7b645e}},'include':[{'model':db['CmContact'],'as':_0xa143('0x30')},{'model':db[_0xa143('0x32')],'as':_0xa143('0x33'),'attributes':['id',_0xa143('0x55'),'voicePause']},{'model':db[_0xa143('0x56')],'as':_0xa143('0x57')}]})['then'](function(_0x47794f){if(_0x47794f['length']>0x0){return db['sequelize'][_0xa143('0x2d')](function(_0x491197){return db[_0xa143('0x13')][_0xa143('0x25')]({'recallmeNotifiedDate':db['sequelize'][_0xa143('0x42')]('NOW()')},{'where':{'id':{'$in':_[_0xa143('0x1a')](_0x47794f,'id')}},'transaction':_0x491197})[_0xa143('0x8')](function(){_0x53b392(_0x47794f);})[_0xa143('0x1d')](function(_0x8d066a){logger[_0xa143('0xd')](_0xa143('0x58'),_0x8d066a[_0xa143('0xf')],_0xc3273e);_0x2892f3(_0x34171a[_0xa143('0xd')](0x1f4,_0x8d066a[_0xa143('0xf')]));});})[_0xa143('0x1d')](function(_0x116f4c){logger[_0xa143('0xd')](_0xa143('0x58'),_0x116f4c['message'],_0xc3273e);_0x2892f3(_0x34171a['error'](0x1f4,_0x116f4c[_0xa143('0xf')]));});}else{_0x53b392(_0x47794f);}});});}; \ No newline at end of file +var _0x8871=['Contact','keys','Agent','name','voicePause','length','UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','create','sequelize','COUNT','literal','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','CmContact','GetCmHopperPreview','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','\x20MINUTE','CmList','NOW()','lodash','util','moment','bluebird','rpc','jayson/promise','client','http','then','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','ShowCmHopper','find','CreateCmHopper','body','update','UpdateCmHopper','active','DestroyCmHopper','destroy','GetContactDialer','describe','transaction','order','LOCK','UPDATE'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0x8871,0x7a));var _0x1887=function(_0x133f36,_0x5047f5){_0x133f36=_0x133f36-0x0;var _0x1120b1=_0x8871[_0x133f36];return _0x1120b1;};'use strict';var _=require(_0x1887('0x0'));var util=require(_0x1887('0x1'));var moment=require(_0x1887('0x2'));var BPromise=require(_0x1887('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x1887('0x4'));var jayson=require(_0x1887('0x5'));var client=jayson[_0x1887('0x6')][_0x1887('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3646f1,_0x5b9578,_0x36c20f){return new BPromise(function(_0x262fc3,_0x279f21){return client['request'](_0x3646f1,_0x36c20f)[_0x1887('0x8')](function(_0x220829){logger['info'](_0x1887('0x9'),_0x5b9578,'request\x20sent');logger[_0x1887('0xa')](_0x1887('0xb'),_0x5b9578,_0x1887('0xc'),JSON[_0x1887('0xd')](_0x220829));if(_0x220829[_0x1887('0xe')]){if(_0x220829[_0x1887('0xe')][_0x1887('0xf')]===0x1f4){logger['error'](_0x1887('0x9'),_0x5b9578,_0x220829[_0x1887('0xe')][_0x1887('0x10')]);return _0x279f21(_0x220829[_0x1887('0xe')]['message']);}logger[_0x1887('0xe')](_0x1887('0x9'),_0x5b9578,_0x220829['error'][_0x1887('0x10')]);return _0x262fc3(_0x220829['error'][_0x1887('0x10')]);}else{logger[_0x1887('0x11')](_0x1887('0x9'),_0x5b9578,_0x1887('0xc'));_0x262fc3(_0x220829[_0x1887('0x12')][_0x1887('0x10')]);}})[_0x1887('0x13')](function(_0x1efa1c){logger[_0x1887('0xe')]('CmHopper,\x20%s,\x20%s',_0x5b9578,_0x1efa1c);_0x279f21(_0x1efa1c);});});}exports[_0x1887('0x14')]=function(_0xa46d73){var _0x144b9f=this;return new Promise(function(_0x27402d,_0x6cbe30){return db[_0x1887('0x15')][_0x1887('0x16')]({'raw':_0xa46d73[_0x1887('0x17')]?_0xa46d73[_0x1887('0x17')][_0x1887('0x18')]===undefined?!![]:![]:!![],'where':_0xa46d73[_0x1887('0x17')]?_0xa46d73[_0x1887('0x17')][_0x1887('0x19')]||null:null,'attributes':_0xa46d73[_0x1887('0x17')]?_0xa46d73[_0x1887('0x17')][_0x1887('0x1a')]||null:null,'limit':_0xa46d73[_0x1887('0x17')]?_0xa46d73[_0x1887('0x17')][_0x1887('0x1b')]||null:null,'include':_0xa46d73[_0x1887('0x17')]?_0xa46d73[_0x1887('0x17')][_0x1887('0x1c')]?_['map'](_0xa46d73[_0x1887('0x17')]['include'],function(_0x4deda3){return{'model':db[_0x4deda3[_0x1887('0x1d')]],'as':_0x4deda3['as'],'attributes':_0x4deda3[_0x1887('0x1a')],'include':_0x4deda3[_0x1887('0x1c')]?_[_0x1887('0x1e')](_0x4deda3[_0x1887('0x1c')],function(_0x43aa75){return{'model':db[_0x43aa75[_0x1887('0x1d')]],'as':_0x43aa75['as'],'attributes':_0x43aa75['attributes'],'include':_0x43aa75[_0x1887('0x1c')]?_['map'](_0x43aa75[_0x1887('0x1c')],function(_0x200296){return{'model':db[_0x200296[_0x1887('0x1d')]],'as':_0x200296['as'],'attributes':_0x200296[_0x1887('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1887('0x8')](function(_0x7ac29a){logger[_0x1887('0x11')](_0x1887('0x14'),_0xa46d73);logger['debug'](_0x1887('0x14'),_0xa46d73,JSON['stringify'](_0x7ac29a));_0x27402d(_0x7ac29a);})[_0x1887('0x13')](function(_0x597845){logger[_0x1887('0xe')]('GetCmHopper',_0x597845[_0x1887('0x10')],_0xa46d73);_0x6cbe30(_0x144b9f[_0x1887('0xe')](0x1f4,_0x597845[_0x1887('0x10')]));});});};exports[_0x1887('0x1f')]=function(_0xf16fe7){var _0x23b031=this;return new Promise(function(_0x1dbcf5,_0xfffd99){return db[_0x1887('0x15')][_0x1887('0x20')]({'raw':_0xf16fe7[_0x1887('0x17')]?_0xf16fe7[_0x1887('0x17')][_0x1887('0x18')]===undefined?!![]:![]:!![],'where':_0xf16fe7[_0x1887('0x17')]?_0xf16fe7[_0x1887('0x17')][_0x1887('0x19')]||null:null,'attributes':_0xf16fe7[_0x1887('0x17')]?_0xf16fe7[_0x1887('0x17')][_0x1887('0x1a')]||null:null,'include':_0xf16fe7[_0x1887('0x17')]?_0xf16fe7[_0x1887('0x17')][_0x1887('0x1c')]?_[_0x1887('0x1e')](_0xf16fe7['options'][_0x1887('0x1c')],function(_0x6760bf){return{'model':db[_0x6760bf[_0x1887('0x1d')]],'as':_0x6760bf['as'],'attributes':_0x6760bf[_0x1887('0x1a')],'include':_0x6760bf[_0x1887('0x1c')]?_['map'](_0x6760bf[_0x1887('0x1c')],function(_0x35ff50){return{'model':db[_0x35ff50['model']],'as':_0x35ff50['as'],'attributes':_0x35ff50['attributes'],'include':_0x35ff50[_0x1887('0x1c')]?_['map'](_0x35ff50[_0x1887('0x1c')],function(_0xb614d5){return{'model':db[_0xb614d5['model']],'as':_0xb614d5['as'],'attributes':_0xb614d5[_0x1887('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1887('0x8')](function(_0x4e4f61){logger['info'](_0x1887('0x1f'),_0xf16fe7);logger[_0x1887('0xa')]('ShowCmHopper',_0xf16fe7,JSON[_0x1887('0xd')](_0x4e4f61));_0x1dbcf5(_0x4e4f61);})[_0x1887('0x13')](function(_0x58104a){logger[_0x1887('0xe')](_0x1887('0x1f'),_0x58104a[_0x1887('0x10')],_0xf16fe7);_0xfffd99(_0x23b031[_0x1887('0xe')](0x1f4,_0x58104a[_0x1887('0x10')]));});});};exports[_0x1887('0x21')]=function(_0x29fd72){var _0x2540e1=this;return new Promise(function(_0x108540,_0x2809a1){return db[_0x1887('0x15')]['create'](_0x29fd72[_0x1887('0x22')],{'raw':_0x29fd72['options']?_0x29fd72['options'][_0x1887('0x18')]===undefined?!![]:![]:!![]})[_0x1887('0x8')](function(_0x5b575c){logger[_0x1887('0x11')]('CreateCmHopper',_0x29fd72);logger[_0x1887('0xa')]('CreateCmHopper',_0x29fd72,JSON[_0x1887('0xd')](_0x5b575c));_0x108540(_0x5b575c);})[_0x1887('0x13')](function(_0x347959){logger[_0x1887('0xe')](_0x1887('0x21'),_0x347959[_0x1887('0x10')],_0x29fd72);_0x2809a1(_0x2540e1['error'](0x1f4,_0x347959['message']));});});};exports['UpdateCmHopper']=function(_0xcbd82b){var _0x4d64b4=this;return new Promise(function(_0x25a8a1,_0x14956d){return db[_0x1887('0x15')][_0x1887('0x23')](_0xcbd82b[_0x1887('0x22')],{'raw':_0xcbd82b[_0x1887('0x17')]?_0xcbd82b[_0x1887('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcbd82b['options']?_0xcbd82b['options'][_0x1887('0x19')]||null:null,'attributes':_0xcbd82b[_0x1887('0x17')]?_0xcbd82b[_0x1887('0x17')][_0x1887('0x1a')]||null:null,'limit':_0xcbd82b[_0x1887('0x17')]?_0xcbd82b[_0x1887('0x17')][_0x1887('0x1b')]||null:null})['then'](function(_0x15caab){logger['info'](_0x1887('0x24'),_0xcbd82b);logger[_0x1887('0x11')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x1887('0xd')](_0xcbd82b[_0x1887('0x17')][_0x1887('0x19')]),_0xcbd82b['body'][_0x1887('0x25')]);logger['debug'](_0x1887('0x24'),_0xcbd82b,JSON[_0x1887('0xd')](_0x15caab));_0x25a8a1(_0x15caab);})[_0x1887('0x13')](function(_0x53b0ee){logger[_0x1887('0xe')](_0x1887('0x24'),_0x53b0ee[_0x1887('0x10')],_0xcbd82b);_0x14956d(_0x4d64b4[_0x1887('0xe')](0x1f4,_0x53b0ee[_0x1887('0x10')]));});});};exports[_0x1887('0x26')]=function(_0x346961){var _0x5cf98e=this;return new Promise(function(_0x2365b0,_0x2ac10c){return db[_0x1887('0x15')][_0x1887('0x27')]({'where':_0x346961[_0x1887('0x17')]?_0x346961['options'][_0x1887('0x19')]||null:null})[_0x1887('0x8')](function(_0x55c96a){logger[_0x1887('0x11')](_0x1887('0x26'),_0x346961);logger[_0x1887('0xa')](_0x1887('0x26'),_0x346961,JSON[_0x1887('0xd')](_0x55c96a));_0x2365b0(_0x55c96a);})[_0x1887('0x13')](function(_0xae620d){logger[_0x1887('0xe')](_0x1887('0x26'),_0xae620d[_0x1887('0x10')],_0x346961);_0x2ac10c(_0x5cf98e['error'](0x1f4,_0xae620d[_0x1887('0x10')]));});});};exports[_0x1887('0x28')]=function(_0x2ef748){var _0x4a12f3=this;return new Promise(function(_0x8b98e9,_0x5f1272){return db['CmContact'][_0x1887('0x29')]()[_0x1887('0x8')](function(_0x4483ce){return db['sequelize'][_0x1887('0x2a')](function(_0x340fa0){return db[_0x1887('0x15')][_0x1887('0x16')]({'where':_0x2ef748[_0x1887('0x17')]?_0x2ef748[_0x1887('0x17')][_0x1887('0x19')]||null:null,'attributes':_0x2ef748[_0x1887('0x17')]?_0x2ef748[_0x1887('0x17')]['attributes']||null:null,'limit':_0x2ef748[_0x1887('0x17')]?_0x2ef748['options'][_0x1887('0x1b')]||null:null,'order':_0x2ef748[_0x1887('0x17')]?_0x2ef748[_0x1887('0x17')][_0x1887('0x2b')]||null:null,'transaction':_0x340fa0,'lock':_0x340fa0[_0x1887('0x2c')][_0x1887('0x2d')],'include':[{'model':db['CmContact'],'as':_0x1887('0x2e'),'attributes':_[_0x1887('0x2f')](_0x4483ce)},{'model':db['User'],'as':_0x1887('0x30'),'attributes':['id',_0x1887('0x31'),_0x1887('0x32')]}]})[_0x1887('0x8')](function(_0x1ff07c){var _0x23fb65=[];var _0x580cbd=[];for(var _0x9a5010=0x0;_0x9a5010<_0x1ff07c[_0x1887('0x33')];_0x9a5010+=0x1){var _0x4ec0bd=_0x1ff07c[_0x9a5010][_0x1887('0x34')];if(_0x4ec0bd===null){_0x23fb65[_0x1887('0x35')](_0x1ff07c[_0x9a5010]['update'](_0x2ef748[_0x1887('0x22')],{'transaction':_0x340fa0}));}else if(!_0x580cbd['includes'](_0x4ec0bd)){_0x580cbd[_0x1887('0x35')](_0x4ec0bd);_0x23fb65[_0x1887('0x35')](_0x1ff07c[_0x9a5010][_0x1887('0x23')](_0x2ef748[_0x1887('0x22')],{'transaction':_0x340fa0}));}}return BPromise[_0x1887('0x36')](_0x23fb65);});})[_0x1887('0x8')](function(_0x5832d6){logger[_0x1887('0x11')](_0x1887('0x28'),_0x2ef748);if(_0x5832d6['length']>0x0){logger[_0x1887('0x11')](_0x1887('0x37'),_0x5832d6[0x0][_0x1887('0x38')]['id'],_0x5832d6[0x0][_0x1887('0x38')][_0x1887('0x39')],_0x5832d6[0x0][_0x1887('0x38')][_0x1887('0x25')]);}logger[_0x1887('0xa')](_0x1887('0x28'),_0x2ef748,JSON[_0x1887('0xd')](_0x5832d6));_0x8b98e9(_0x5832d6);})[_0x1887('0x13')](function(_0x590b8a){logger[_0x1887('0xe')]('GetContactDialer',_0x590b8a[_0x1887('0x10')],_0x2ef748);_0x5f1272(_0x4a12f3['error'](0x1f4,_0x590b8a[_0x1887('0x10')]));});});});};exports[_0x1887('0x3a')]=function(_0x5c9d08){var _0x2b92f8=this;return new Promise(function(_0x4b594d,_0x4f69e9){return db['sequelize']['transaction'](function(_0x447bf3){return db['CmHopperFinal'][_0x1887('0x3b')](_0x5c9d08[_0x1887('0x22')],{'raw':_0x5c9d08[_0x1887('0x17')]?_0x5c9d08[_0x1887('0x17')]['raw']===undefined?!![]:![]:!![],'transaction':_0x447bf3})[_0x1887('0x8')](function(){logger['info']('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x5c9d08['options'][_0x1887('0x19')]),_0x5c9d08[_0x1887('0x17')][_0x1887('0x19')][_0x1887('0x25')]);return db[_0x1887('0x15')]['destroy']({'where':_0x5c9d08[_0x1887('0x17')]?_0x5c9d08[_0x1887('0x17')][_0x1887('0x19')]||null:null,'transaction':_0x447bf3});});})['then'](function(_0x308d3e){logger[_0x1887('0x11')](_0x1887('0x3a'),_0x5c9d08);logger[_0x1887('0xa')](_0x1887('0x3a'),_0x5c9d08,JSON[_0x1887('0xd')](_0x308d3e));_0x4b594d(_0x308d3e);})[_0x1887('0x13')](function(_0x24c06d){logger['error'](_0x1887('0x3a'),_0x24c06d['message'],_0x5c9d08);_0x4f69e9(_0x2b92f8[_0x1887('0xe')](0x1f4,_0x24c06d[_0x1887('0x10')]));});});};exports['CountReScheduled']=function(_0x16bbc0){var _0x26a322=this;return new Promise(function(_0x113f8e,_0x347fe8){return db[_0x1887('0x15')][_0x1887('0x16')]({'raw':_0x16bbc0[_0x1887('0x17')]?_0x16bbc0[_0x1887('0x17')][_0x1887('0x18')]===undefined?!![]:![]:!![],'where':_0x16bbc0['options']?_0x16bbc0[_0x1887('0x17')][_0x1887('0x19')]||null:null,'attributes':[[db[_0x1887('0x3c')]['fn'](_0x1887('0x3d'),db[_0x1887('0x3c')]['fn']('IF',db[_0x1887('0x3c')][_0x1887('0x3e')]('`scheduledat`\x20>=\x20'+util[_0x1887('0x3f')](_0x1887('0x40'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0x1887('0x41')))),_0x1887('0x42')]]})[_0x1887('0x8')](function(_0x346151){logger[_0x1887('0x11')](_0x1887('0x43'),_0x16bbc0);logger[_0x1887('0xa')](_0x1887('0x43'),_0x16bbc0,JSON[_0x1887('0xd')](_0x346151));_0x113f8e(_0x346151);})['catch'](function(_0x2e3565){logger[_0x1887('0xe')](_0x1887('0x43'),_0x2e3565[_0x1887('0x10')],_0x16bbc0);_0x347fe8(_0x26a322[_0x1887('0xe')](0x1f4,_0x2e3565[_0x1887('0x10')]));});});};exports[_0x1887('0x44')]=function(_0x2ed326){var _0x4715f2=this;return new Promise(function(_0x435c93,_0x2addfd){return db[_0x1887('0x45')]['describe']()[_0x1887('0x8')](function(_0x105213){return db[_0x1887('0x3c')]['transaction'](function(_0xac6eae){return db['CmHopper']['findAll']({'where':_0x2ed326[_0x1887('0x17')]?_0x2ed326[_0x1887('0x17')]['where']||null:null,'attributes':_0x2ed326['options']?_0x2ed326[_0x1887('0x17')][_0x1887('0x1a')]||null:null,'limit':0x1,'order':_0x2ed326[_0x1887('0x17')]?_0x2ed326[_0x1887('0x17')][_0x1887('0x2b')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0xac6eae,'lock':_0xac6eae['LOCK'][_0x1887('0x2d')],'include':_0x2ed326['options']?_0x2ed326[_0x1887('0x17')][_0x1887('0x1c')]?_[_0x1887('0x1e')](_0x2ed326[_0x1887('0x17')][_0x1887('0x1c')],function(_0x3ba05d){return{'model':db[_0x3ba05d[_0x1887('0x1d')]],'as':_0x3ba05d['as'],'attributes':_0x3ba05d[_0x1887('0x1a')],'include':_0x3ba05d[_0x1887('0x1c')]?_[_0x1887('0x1e')](_0x3ba05d[_0x1887('0x1c')],function(_0x326602){return{'model':db[_0x326602[_0x1887('0x1d')]],'as':_0x326602['as'],'attributes':_0x326602['attributes'],'include':_0x326602['include']?_[_0x1887('0x1e')](_0x326602[_0x1887('0x1c')],function(_0x51e59e){return{'model':db[_0x51e59e[_0x1887('0x1d')]],'as':_0x51e59e['as'],'attributes':_0x51e59e[_0x1887('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1887('0x8')](function(_0x38bea3){var _0x9f221=[];for(var _0x209756=0x0;_0x209756<_0x38bea3[_0x1887('0x33')];_0x209756+=0x1){_0x9f221[_0x1887('0x35')](_0x38bea3[_0x209756][_0x1887('0x23')](_0x2ed326[_0x1887('0x22')],{'transaction':_0xac6eae}));}return BPromise[_0x1887('0x36')](_0x9f221);});})[_0x1887('0x8')](function(_0x438c20){logger[_0x1887('0x11')]('GetContactRecallMe',_0x2ed326);logger[_0x1887('0xa')]('GetContactRecallMe',_0x2ed326,JSON['stringify'](_0x438c20));_0x435c93(_0x438c20);})['catch'](function(_0x5e3092){logger[_0x1887('0xe')](_0x1887('0x44'),_0x5e3092['message'],_0x2ed326);_0x2addfd(_0x4715f2[_0x1887('0xe')](0x1f4,_0x5e3092[_0x1887('0x10')]));});});});};exports[_0x1887('0x46')]=function(_0x21f286){var _0x3b4d8f=this;return new Promise(function(_0x10802b,_0x656f30){db[_0x1887('0x45')][_0x1887('0x29')]()[_0x1887('0x8')](function(_0x5c7de6){return db[_0x1887('0x15')][_0x1887('0x16')]({'raw':_0x21f286[_0x1887('0x17')]?_0x21f286[_0x1887('0x17')][_0x1887('0x18')]===undefined?!![]:![]:!![],'where':_0x21f286[_0x1887('0x17')]?_0x21f286[_0x1887('0x17')][_0x1887('0x19')]||null:null,'attributes':_0x21f286[_0x1887('0x17')]?_0x21f286[_0x1887('0x17')][_0x1887('0x1a')]||null:null,'limit':_0x21f286[_0x1887('0x17')]?_0x21f286[_0x1887('0x17')][_0x1887('0x1b')]||null:null,'include':_0x21f286['options']?_0x21f286[_0x1887('0x17')][_0x1887('0x1c')]?_['map'](_0x21f286['options'][_0x1887('0x1c')],function(_0x2afd86){return{'model':db[_0x2afd86[_0x1887('0x1d')]],'as':_0x2afd86['as'],'attributes':_0x2afd86['as']===_0x1887('0x2e')?_['keys'](_0x5c7de6):_0x2afd86['attributes'],'include':_0x2afd86[_0x1887('0x1c')]?_[_0x1887('0x1e')](_0x2afd86[_0x1887('0x1c')],function(_0x46a6d8){return{'model':db[_0x46a6d8['model']],'as':_0x46a6d8['as'],'attributes':_0x46a6d8[_0x1887('0x1a')],'include':_0x46a6d8[_0x1887('0x1c')]?_[_0x1887('0x1e')](_0x46a6d8['include'],function(_0xbd7227){return{'model':db[_0xbd7227[_0x1887('0x1d')]],'as':_0xbd7227['as'],'attributes':_0xbd7227[_0x1887('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1887('0x8')](function(_0x3ff626){logger[_0x1887('0x11')](_0x1887('0x14'),_0x21f286);logger[_0x1887('0xa')]('GetCmHopper',_0x21f286,JSON[_0x1887('0xd')](_0x3ff626));_0x10802b(_0x3ff626);})[_0x1887('0x13')](function(_0x5aa806){logger['error']('GetCmHopper',_0x5aa806['message'],_0x21f286);_0x656f30(_0x3b4d8f['error'](0x1f4,_0x5aa806['message']));});});});};exports[_0x1887('0x47')]=function(_0x431e68){var _0x4f95a3=this;return new Promise(function(_0x56e1be,_0x29a9bf){return db[_0x1887('0x45')][_0x1887('0x48')]({'raw':!![],'where':{'phone':_0x431e68[_0x1887('0x17')][_0x1887('0x19')]['phone']},'attributes':['id',_0x1887('0x49')],'order':[['id',_0x1887('0x4a')]]})['then'](function(_0x2c1f03){logger[_0x1887('0x11')]('getContactByPhone',_0x431e68);logger[_0x1887('0xa')]('getContactByPhone',_0x431e68,JSON[_0x1887('0xd')](_0x2c1f03));_0x56e1be(_0x2c1f03);})['catch'](function(_0x2dbcfc){logger['error'](_0x1887('0x4b'),_0x2dbcfc[_0x1887('0x10')],_0x431e68);_0x29a9bf(_0x4f95a3[_0x1887('0xe')](0x1f4,_0x2dbcfc[_0x1887('0x10')]));});});};exports[_0x1887('0x4c')]=function(_0x21b94d){var _0xe6772=this;return new Promise(function(_0x337cb7,_0x2308a0){return db['sequelize'][_0x1887('0x2a')](function(_0x5e9840){return db['CmHopper'][_0x1887('0x23')](_0x21b94d[_0x1887('0x22')],{'where':{},'transaction':_0x5e9840})[_0x1887('0x8')](function(_0x31aea4){logger[_0x1887('0x11')](_0x1887('0x4c'),_0x21b94d);logger[_0x1887('0xa')](_0x1887('0x4c'),_0x21b94d,JSON[_0x1887('0xd')](_0x31aea4));_0x337cb7(_0x31aea4);})[_0x1887('0x13')](function(_0x38feee){logger[_0x1887('0xe')](_0x1887('0x4c'),_0x38feee[_0x1887('0x10')],_0x21b94d);_0x2308a0(_0xe6772[_0x1887('0xe')](0x1f4,_0x38feee[_0x1887('0x10')]));});});});};exports[_0x1887('0x4d')]=function(_0xc4c4b2){var _0x1acebf=this;var _0x5dd155=_0xc4c4b2[_0x1887('0x22')][_0x1887('0x19')][_0x1887('0x4e')];var _0x4191c3=_0xc4c4b2[_0x1887('0x22')]['where'][_0x1887('0x4f')];var _0x3ac134=_0xc4c4b2[_0x1887('0x22')][_0x1887('0x19')][_0x1887('0x50')];return new Promise(function(_0x9caa5c,_0x44c785){return db[_0x1887('0x15')]['findAll']({'where':{'voiceQueueId':{'$in':_0x5dd155},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x1887('0x3c')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x4191c3+_0x1887('0x51')),'$gt':db[_0x1887('0x3c')][_0x1887('0x3e')]('NOW()')}},'UserId':{'$in':_0x3ac134}},'include':[{'model':db[_0x1887('0x45')],'as':'Contact'},{'model':db['User'],'as':_0x1887('0x30'),'attributes':['id','name',_0x1887('0x32')]},{'model':db[_0x1887('0x52')],'as':'List'}]})['then'](function(_0x3bf6dc){if(_0x3bf6dc[_0x1887('0x33')]>0x0){return db['sequelize'][_0x1887('0x2a')](function(_0x4028da){return db[_0x1887('0x15')][_0x1887('0x23')]({'recallmeNotifiedDate':db['sequelize'][_0x1887('0x3e')](_0x1887('0x53'))},{'where':{'id':{'$in':_[_0x1887('0x1e')](_0x3bf6dc,'id')}},'transaction':_0x4028da})[_0x1887('0x8')](function(){_0x9caa5c(_0x3bf6dc);})[_0x1887('0x13')](function(_0xc83e9a){logger['error'](_0x1887('0x4d'),_0xc83e9a['message'],_0xc4c4b2);_0x44c785(_0x1acebf[_0x1887('0xe')](0x1f4,_0xc83e9a[_0x1887('0x10')]));});})[_0x1887('0x13')](function(_0x20a723){logger[_0x1887('0xe')](_0x1887('0x4d'),_0x20a723['message'],_0xc4c4b2);_0x44c785(_0x1acebf['error'](0x1f4,_0x20a723[_0x1887('0x10')]));});}else{_0x9caa5c(_0x3bf6dc);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 985b78f..f33806b 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 _0xf118=['index','get','/describe','describe','/opencontacts','getTimezones','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','isAuthenticated'];(function(_0x727101,_0x3c37e1){var _0x1ddc48=function(_0x2d4146){while(--_0x2d4146){_0x727101['push'](_0x727101['shift']());}};_0x1ddc48(++_0x3c37e1);}(_0xf118,0x17b));var _0x8f11=function(_0x2bc2a2,_0x51e95f){_0x2bc2a2=_0x2bc2a2-0x0;var _0x20de67=_0xf118[_0x2bc2a2];return _0x20de67;};'use strict';var express=require(_0x8f11('0x0'));var router=express[_0x8f11('0x1')]();var auth=require(_0x8f11('0x2'));var controller=require(_0x8f11('0x3'));router['get']('/',auth[_0x8f11('0x4')](),controller[_0x8f11('0x5')]);router[_0x8f11('0x6')](_0x8f11('0x7'),auth[_0x8f11('0x4')](),controller[_0x8f11('0x8')]);router[_0x8f11('0x6')](_0x8f11('0x9'),auth[_0x8f11('0x4')](),controller['getOpenContacts']);router['get']('/timezones',auth[_0x8f11('0x4')](),controller[_0x8f11('0xa')]);router[_0x8f11('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x8f11('0xb')]);router[_0x8f11('0x6')](_0x8f11('0xc'),auth[_0x8f11('0x4')](),controller[_0x8f11('0xd')]);router[_0x8f11('0xe')]('/',auth['isAuthenticated'](),controller[_0x8f11('0xf')]);router[_0x8f11('0xe')](_0x8f11('0x10'),auth[_0x8f11('0x4')](),controller[_0x8f11('0x11')]);router['post'](_0x8f11('0x12'),auth['isAuthenticated'](),controller['getTimezone']);router[_0x8f11('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x8f11('0x14')]);router[_0x8f11('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x8f11('0x16')]);module[_0x8f11('0x17')]=router; \ No newline at end of file +var _0x6eae=['../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','getPreviewRecall','post','create','getTimezone','put','delete','destroy','exports','express'];(function(_0x105e5c,_0x2a1c3a){var _0x4426f8=function(_0x44fa1f){while(--_0x44fa1f){_0x105e5c['push'](_0x105e5c['shift']());}};_0x4426f8(++_0x2a1c3a);}(_0x6eae,0xbc));var _0xe6ea=function(_0x723499,_0x125b6c){_0x723499=_0x723499-0x0;var _0x3d031c=_0x6eae[_0x723499];return _0x3d031c;};'use strict';var express=require(_0xe6ea('0x0'));var router=express['Router']();var auth=require(_0xe6ea('0x1'));var controller=require(_0xe6ea('0x2'));router[_0xe6ea('0x3')]('/',auth[_0xe6ea('0x4')](),controller[_0xe6ea('0x5')]);router[_0xe6ea('0x3')](_0xe6ea('0x6'),auth[_0xe6ea('0x4')](),controller[_0xe6ea('0x7')]);router[_0xe6ea('0x3')](_0xe6ea('0x8'),auth[_0xe6ea('0x4')](),controller[_0xe6ea('0x9')]);router[_0xe6ea('0x3')]('/timezones',auth[_0xe6ea('0x4')](),controller[_0xe6ea('0xa')]);router['get'](_0xe6ea('0xb'),auth[_0xe6ea('0x4')](),controller[_0xe6ea('0xc')]);router['get']('/:id/previewrecall',auth['isAuthenticated'](),controller[_0xe6ea('0xd')]);router[_0xe6ea('0xe')]('/',auth['isAuthenticated'](),controller[_0xe6ea('0xf')]);router[_0xe6ea('0xe')]('/preview',auth[_0xe6ea('0x4')](),controller['getPreview']);router['post']('/timezone',auth[_0xe6ea('0x4')](),controller[_0xe6ea('0x10')]);router[_0xe6ea('0x11')](_0xe6ea('0xb'),auth[_0xe6ea('0x4')](),controller['update']);router[_0xe6ea('0x12')](_0xe6ea('0xb'),auth[_0xe6ea('0x4')](),controller[_0xe6ea('0x13')]);module[_0xe6ea('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index ff6f465..ddb1f88 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe30=['INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe30,0x1a2));var _0x0fe3=function(_0x22ec80,_0x304732){_0x22ec80=_0x22ec80-0x0;var _0x3018b4=_0xfe30[_0x22ec80];return _0x3018b4;};'use strict';var moment=require(_0x0fe3('0x0'));var Sequelize=require('sequelize');module[_0x0fe3('0x1')]={'CmHopperId':{'type':Sequelize[_0x0fe3('0x2')]},'phone':{'type':Sequelize[_0x0fe3('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x0fe3('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x0fe3('0x4')],'defaultValue':moment()[_0x0fe3('0x5')](_0x0fe3('0x6'))},'countbusyretry':{'type':Sequelize[_0x0fe3('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0fe3('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0fe3('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x0fe3('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0fe3('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0fe3('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0fe3('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0fe3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xaeeb=['STRING','INTEGER','DATE','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports'];(function(_0x218756,_0x419c39){var _0x1b90ec=function(_0x237c8e){while(--_0x237c8e){_0x218756['push'](_0x218756['shift']());}};_0x1b90ec(++_0x419c39);}(_0xaeeb,0x15b));var _0xbaee=function(_0x3d9e80,_0x1b52ba){_0x3d9e80=_0x3d9e80-0x0;var _0x4bca00=_0xaeeb[_0x3d9e80];return _0x4bca00;};'use strict';var moment=require(_0xbaee('0x0'));var Sequelize=require(_0xbaee('0x1'));module[_0xbaee('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0xbaee('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xbaee('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xbaee('0x5')],'defaultValue':moment()['format'](_0xbaee('0x6'))},'countbusyretry':{'type':Sequelize[_0xbaee('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbaee('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbaee('0x4')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xbaee('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbaee('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbaee('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbaee('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 86c252a..5f11f5b 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe834=['get','CmHopperAdditionalPhones','UserProfileResource','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','find','create','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','destroy','then'];(function(_0x3fc869,_0xc7a1c7){var _0x376ded=function(_0x279778){while(--_0x279778){_0x3fc869['push'](_0x3fc869['shift']());}};_0x376ded(++_0xc7a1c7);}(_0xe834,0xc1));var _0x4e83=function(_0x10eb40,_0x3f5002){_0x10eb40=_0x10eb40-0x0;var _0x36e2d1=_0xe834[_0x10eb40];return _0x36e2d1;};'use strict';var emlformat=require(_0x4e83('0x0'));var rimraf=require(_0x4e83('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e83('0x2'));var rp=require(_0x4e83('0x3'));var moment=require(_0x4e83('0x4'));var BPromise=require(_0x4e83('0x5'));var Mustache=require('mustache');var util=require(_0x4e83('0x6'));var path=require(_0x4e83('0x7'));var sox=require('sox');var csv=require(_0x4e83('0x8'));var ejs=require(_0x4e83('0x9'));var fs=require('fs');var fs_extra=require(_0x4e83('0xa'));var _=require(_0x4e83('0xb'));var squel=require(_0x4e83('0xc'));var crypto=require(_0x4e83('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4e83('0xe'));var Papa=require(_0x4e83('0xf'));var Redis=require(_0x4e83('0x10'));var authService=require(_0x4e83('0x11'));var qs=require(_0x4e83('0x12'));var as=require(_0x4e83('0x13'));var hardwareService=require(_0x4e83('0x14'));var logger=require(_0x4e83('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x4e83('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4e83('0x17'))['db'];function respondWithStatusCode(_0x21b66c,_0x389954){_0x389954=_0x389954||0xcc;return function(_0xca6f19){if(_0xca6f19){return _0x21b66c[_0x4e83('0x18')](_0x389954);}return _0x21b66c[_0x4e83('0x19')](_0x389954)[_0x4e83('0x1a')]();};}function respondWithResult(_0x50d655,_0x52a612){_0x52a612=_0x52a612||0xc8;return function(_0x590132){if(_0x590132){return _0x50d655['status'](_0x52a612)['json'](_0x590132);}};}function respondWithFilteredResult(_0x37c56c,_0x4122e9){return function(_0x20696b){if(_0x20696b){var _0xc19501=typeof _0x4122e9['offset']===_0x4e83('0x1b')&&typeof _0x4122e9['limit']==='undefined';var _0x69532f=_0x20696b[_0x4e83('0x1c')];var _0x41f3b5=_0xc19501?0x0:_0x4122e9['offset'];var _0x29f855=_0xc19501?_0x20696b[_0x4e83('0x1c')]:_0x4122e9[_0x4e83('0x1d')]+_0x4122e9[_0x4e83('0x1e')];var _0x229771;if(_0x29f855>=_0x69532f){_0x29f855=_0x69532f;_0x229771=0xc8;}else{_0x229771=0xce;}_0x37c56c[_0x4e83('0x19')](_0x229771);return _0x37c56c['set'](_0x4e83('0x1f'),_0x41f3b5+'-'+_0x29f855+'/'+_0x69532f)[_0x4e83('0x20')](_0x20696b);}return null;};}function patchUpdates(_0x402c6e){return function(_0x28cf7d){try{jsonpatch[_0x4e83('0x21')](_0x28cf7d,_0x402c6e,!![]);}catch(_0x50587e){return BPromise[_0x4e83('0x22')](_0x50587e);}return _0x28cf7d[_0x4e83('0x23')]();};}function saveUpdates(_0x2ed1e8,_0x39206a){return function(_0x1de062){if(_0x1de062){return _0x1de062['update'](_0x2ed1e8)['then'](function(_0x4bf164){return _0x4bf164;});}return null;};}function removeEntity(_0x3adb1c,_0x467c48){return function(_0x5afeb0){if(_0x5afeb0){return _0x5afeb0[_0x4e83('0x24')]()[_0x4e83('0x25')](function(){var _0x14694d=_0x5afeb0[_0x4e83('0x26')]({'plain':!![]});var _0x5b03c6=_0x4e83('0x27');return db[_0x4e83('0x28')]['destroy']({'where':{'type':_0x5b03c6,'resourceId':_0x14694d['id']}})[_0x4e83('0x25')](function(){return _0x5afeb0;});})['then'](function(){_0x3adb1c[_0x4e83('0x19')](0xcc)[_0x4e83('0x1a')]();});}};}function handleEntityNotFound(_0x260306,_0x572d36){return function(_0x375009){if(!_0x375009){_0x260306[_0x4e83('0x18')](0x194);}return _0x375009;};}function handleError(_0x14577e,_0x359b44){_0x359b44=_0x359b44||0x1f4;return function(_0x31f53d){logger['error'](_0x31f53d[_0x4e83('0x29')]);if(_0x31f53d[_0x4e83('0x2a')]){delete _0x31f53d[_0x4e83('0x2a')];}_0x14577e[_0x4e83('0x19')](_0x359b44)[_0x4e83('0x2b')](_0x31f53d);};}exports[_0x4e83('0x2c')]=function(_0x459021,_0x3569ac){var _0x4f5d51={},_0x347c7e={},_0x4c7359={'count':0x0,'rows':[]};var _0x1610a5=_[_0x4e83('0x2d')](db[_0x4e83('0x2e')]['rawAttributes'],function(_0x365b21){return{'name':_0x365b21[_0x4e83('0x2f')],'type':_0x365b21[_0x4e83('0x30')]['key']};});_0x347c7e[_0x4e83('0x31')]=_['map'](_0x1610a5,'name');_0x347c7e['query']=_[_0x4e83('0x32')](_0x459021[_0x4e83('0x33')]);_0x347c7e[_0x4e83('0x34')]=_[_0x4e83('0x35')](_0x347c7e[_0x4e83('0x31')],_0x347c7e[_0x4e83('0x33')]);_0x4f5d51['attributes']=_['intersection'](_0x347c7e[_0x4e83('0x31')],qs[_0x4e83('0x36')](_0x459021[_0x4e83('0x33')][_0x4e83('0x36')]));_0x4f5d51['attributes']=_0x4f5d51[_0x4e83('0x37')][_0x4e83('0x38')]?_0x4f5d51[_0x4e83('0x37')]:_0x347c7e['model'];if(!_0x459021['query'][_0x4e83('0x39')]('nolimit')){_0x4f5d51[_0x4e83('0x1e')]=qs['limit'](_0x459021['query']['limit']);_0x4f5d51['offset']=qs[_0x4e83('0x1d')](_0x459021[_0x4e83('0x33')][_0x4e83('0x1d')]);}_0x4f5d51['order']=qs['sort'](_0x459021['query']['sort']);_0x4f5d51[_0x4e83('0x3a')]=qs[_0x4e83('0x34')](_['pick'](_0x459021[_0x4e83('0x33')],_0x347c7e['filters']),_0x1610a5);if(_0x459021[_0x4e83('0x33')][_0x4e83('0x3b')]){_0x4f5d51[_0x4e83('0x3a')]=_[_0x4e83('0x3c')](_0x4f5d51[_0x4e83('0x3a')],{'$or':_[_0x4e83('0x2d')](_0x1610a5,function(_0x522cb3){if(_0x522cb3['type']!==_0x4e83('0x3d')){var _0x693c54={};_0x693c54[_0x522cb3[_0x4e83('0x2a')]]={'$like':'%'+_0x459021[_0x4e83('0x33')][_0x4e83('0x3b')]+'%'};return _0x693c54;}})});}_0x4f5d51=_[_0x4e83('0x3c')]({},_0x4f5d51,_0x459021['options']);var _0x3b2bad={'where':_0x4f5d51[_0x4e83('0x3a')]};return db[_0x4e83('0x2e')]['count'](_0x3b2bad)[_0x4e83('0x25')](function(_0x508b23){_0x4c7359[_0x4e83('0x1c')]=_0x508b23;if(_0x459021[_0x4e83('0x33')][_0x4e83('0x3e')]){_0x4f5d51['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x4e83('0x3f')](_0x4f5d51);})['then'](function(_0x28efc0){_0x4c7359[_0x4e83('0x40')]=_0x28efc0;return _0x4c7359;})[_0x4e83('0x25')](respondWithFilteredResult(_0x3569ac,_0x4f5d51))[_0x4e83('0x41')](handleError(_0x3569ac,null));};exports[_0x4e83('0x42')]=function(_0x51b390,_0x133c60){var _0x135c2f={'raw':!![],'where':{'id':_0x51b390[_0x4e83('0x43')]['id']}},_0x1b1c66={};_0x1b1c66['model']=_[_0x4e83('0x32')](db[_0x4e83('0x2e')]['rawAttributes']);_0x1b1c66['query']=_['keys'](_0x51b390[_0x4e83('0x33')]);_0x1b1c66[_0x4e83('0x34')]=_[_0x4e83('0x35')](_0x1b1c66[_0x4e83('0x31')],_0x1b1c66[_0x4e83('0x33')]);_0x135c2f[_0x4e83('0x37')]=_[_0x4e83('0x35')](_0x1b1c66[_0x4e83('0x31')],qs['fields'](_0x51b390['query']['fields']));_0x135c2f[_0x4e83('0x37')]=_0x135c2f['attributes'][_0x4e83('0x38')]?_0x135c2f[_0x4e83('0x37')]:_0x1b1c66[_0x4e83('0x31')];if(_0x51b390[_0x4e83('0x33')][_0x4e83('0x3e')]){_0x135c2f[_0x4e83('0x44')]=[{'all':!![]}];}_0x135c2f=_[_0x4e83('0x3c')]({},_0x135c2f,_0x51b390['options']);return db[_0x4e83('0x2e')][_0x4e83('0x45')](_0x135c2f)['then'](handleEntityNotFound(_0x133c60,null))[_0x4e83('0x25')](respondWithResult(_0x133c60,null))['catch'](handleError(_0x133c60,null));};exports[_0x4e83('0x46')]=function(_0x4c98fc,_0x36025e){return db[_0x4e83('0x2e')][_0x4e83('0x46')](_0x4c98fc['body'],{})[_0x4e83('0x25')](function(_0x240917){var _0xe01fd7=_0x4c98fc[_0x4e83('0x47')][_0x4e83('0x26')]({'plain':!![]});if(!_0xe01fd7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe01fd7[_0x4e83('0x48')]===_0x4e83('0x47')){var _0x212107=_0x240917[_0x4e83('0x26')]({'plain':!![]});var _0x3d6ac0=_0x4e83('0x27');return db['UserProfileSection'][_0x4e83('0x45')]({'where':{'name':_0x3d6ac0,'userProfileId':_0xe01fd7[_0x4e83('0x49')]},'raw':!![]})[_0x4e83('0x25')](function(_0x5de578){if(_0x5de578&&_0x5de578['autoAssociation']===0x0){return db[_0x4e83('0x28')][_0x4e83('0x46')]({'name':_0x212107['name'],'resourceId':_0x212107['id'],'type':_0x5de578[_0x4e83('0x2a')],'sectionId':_0x5de578['id']},{})['then'](function(){return _0x240917;});}else{return _0x240917;}})[_0x4e83('0x41')](function(_0x319324){logger['error'](_0x4e83('0x4a'),_0x319324);throw _0x319324;});}return _0x240917;})[_0x4e83('0x25')](respondWithResult(_0x36025e,0xc9))[_0x4e83('0x41')](handleError(_0x36025e,null));};exports[_0x4e83('0x4b')]=function(_0x2825ad,_0x4cab3c){if(_0x2825ad[_0x4e83('0x4c')]['id']){delete _0x2825ad['body']['id'];}return db[_0x4e83('0x2e')][_0x4e83('0x45')]({'where':{'id':_0x2825ad[_0x4e83('0x43')]['id']}})[_0x4e83('0x25')](handleEntityNotFound(_0x4cab3c,null))[_0x4e83('0x25')](saveUpdates(_0x2825ad[_0x4e83('0x4c')],null))[_0x4e83('0x25')](respondWithResult(_0x4cab3c,null))[_0x4e83('0x41')](handleError(_0x4cab3c,null));};exports['destroy']=function(_0x90f200,_0x5e8f52){return db[_0x4e83('0x2e')][_0x4e83('0x45')]({'where':{'id':_0x90f200[_0x4e83('0x43')]['id']}})[_0x4e83('0x25')](handleEntityNotFound(_0x5e8f52,null))[_0x4e83('0x25')](removeEntity(_0x5e8f52,null))[_0x4e83('0x41')](handleError(_0x5e8f52,null));}; \ No newline at end of file +var _0x8f14=['error','stack','name','send','index','CmHopperAdditionalPhone','fieldName','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','destroy','get','CmHopperAdditionalPhones','end'];(function(_0x451528,_0xa7af19){var _0x5c1878=function(_0x1518c0){while(--_0x1518c0){_0x451528['push'](_0x451528['shift']());}};_0x5c1878(++_0xa7af19);}(_0x8f14,0xd1));var _0x48f1=function(_0x490735,_0x1cb9f9){_0x490735=_0x490735-0x0;var _0x4b6e2b=_0x8f14[_0x490735];return _0x4b6e2b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x48f1('0x0'));var zipdir=require(_0x48f1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x48f1('0x2'));var BPromise=require(_0x48f1('0x3'));var Mustache=require(_0x48f1('0x4'));var util=require(_0x48f1('0x5'));var path=require(_0x48f1('0x6'));var sox=require(_0x48f1('0x7'));var csv=require('to-csv');var ejs=require(_0x48f1('0x8'));var fs=require('fs');var fs_extra=require(_0x48f1('0x9'));var _=require(_0x48f1('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x48f1('0xb'));var deskjs=require(_0x48f1('0xc'));var toCsv=require(_0x48f1('0xd'));var querystring=require(_0x48f1('0xe'));var Papa=require(_0x48f1('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x48f1('0x10'));var as=require(_0x48f1('0x11'));var hardwareService=require(_0x48f1('0x12'));var logger=require('../../config/logger')(_0x48f1('0x13'));var utils=require(_0x48f1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x48f1('0x15'));var db=require(_0x48f1('0x16'))['db'];function respondWithStatusCode(_0x3dcb7c,_0x5daf26){_0x5daf26=_0x5daf26||0xcc;return function(_0x3ef4e6){if(_0x3ef4e6){return _0x3dcb7c[_0x48f1('0x17')](_0x5daf26);}return _0x3dcb7c[_0x48f1('0x18')](_0x5daf26)['end']();};}function respondWithResult(_0xb2976,_0x575d56){_0x575d56=_0x575d56||0xc8;return function(_0x4aa81d){if(_0x4aa81d){return _0xb2976[_0x48f1('0x18')](_0x575d56)[_0x48f1('0x19')](_0x4aa81d);}};}function respondWithFilteredResult(_0x4e79e6,_0xe352ed){return function(_0x585b36){if(_0x585b36){var _0x896693=typeof _0xe352ed[_0x48f1('0x1a')]===_0x48f1('0x1b')&&typeof _0xe352ed[_0x48f1('0x1c')]===_0x48f1('0x1b');var _0xab8fa0=_0x585b36[_0x48f1('0x1d')];var _0x50a365=_0x896693?0x0:_0xe352ed[_0x48f1('0x1a')];var _0x5ee843=_0x896693?_0x585b36[_0x48f1('0x1d')]:_0xe352ed[_0x48f1('0x1a')]+_0xe352ed['limit'];var _0x1beb85;if(_0x5ee843>=_0xab8fa0){_0x5ee843=_0xab8fa0;_0x1beb85=0xc8;}else{_0x1beb85=0xce;}_0x4e79e6[_0x48f1('0x18')](_0x1beb85);return _0x4e79e6[_0x48f1('0x1e')]('Content-Range',_0x50a365+'-'+_0x5ee843+'/'+_0xab8fa0)['json'](_0x585b36);}return null;};}function patchUpdates(_0x1b6009){return function(_0x838b70){try{jsonpatch[_0x48f1('0x1f')](_0x838b70,_0x1b6009,!![]);}catch(_0x9fb0e0){return BPromise['reject'](_0x9fb0e0);}return _0x838b70['save']();};}function saveUpdates(_0x3030a4,_0x4ea3d5){return function(_0x28bbb6){if(_0x28bbb6){return _0x28bbb6['update'](_0x3030a4)[_0x48f1('0x20')](function(_0x208f7a){return _0x208f7a;});}return null;};}function removeEntity(_0x5259c5,_0x570330){return function(_0x51a7b7){if(_0x51a7b7){return _0x51a7b7[_0x48f1('0x21')]()['then'](function(){var _0x55f701=_0x51a7b7[_0x48f1('0x22')]({'plain':!![]});var _0x185e1c=_0x48f1('0x23');return db['UserProfileResource'][_0x48f1('0x21')]({'where':{'type':_0x185e1c,'resourceId':_0x55f701['id']}})[_0x48f1('0x20')](function(){return _0x51a7b7;});})[_0x48f1('0x20')](function(){_0x5259c5[_0x48f1('0x18')](0xcc)[_0x48f1('0x24')]();});}};}function handleEntityNotFound(_0x4689ff,_0x4de2b4){return function(_0x344cf9){if(!_0x344cf9){_0x4689ff[_0x48f1('0x17')](0x194);}return _0x344cf9;};}function handleError(_0x20e6d7,_0x35f28e){_0x35f28e=_0x35f28e||0x1f4;return function(_0x368c20){logger[_0x48f1('0x25')](_0x368c20[_0x48f1('0x26')]);if(_0x368c20[_0x48f1('0x27')]){delete _0x368c20['name'];}_0x20e6d7[_0x48f1('0x18')](_0x35f28e)[_0x48f1('0x28')](_0x368c20);};}exports[_0x48f1('0x29')]=function(_0x31f973,_0x111f3b){var _0x56a354={},_0x2ece02={},_0x471c38={'count':0x0,'rows':[]};var _0x5623ef=_['map'](db[_0x48f1('0x2a')]['rawAttributes'],function(_0x35a4a5){return{'name':_0x35a4a5[_0x48f1('0x2b')],'type':_0x35a4a5['type'][_0x48f1('0x2c')]};});_0x2ece02['model']=_['map'](_0x5623ef,_0x48f1('0x27'));_0x2ece02['query']=_[_0x48f1('0x2d')](_0x31f973[_0x48f1('0x2e')]);_0x2ece02[_0x48f1('0x2f')]=_[_0x48f1('0x30')](_0x2ece02[_0x48f1('0x31')],_0x2ece02['query']);_0x56a354[_0x48f1('0x32')]=_[_0x48f1('0x30')](_0x2ece02['model'],qs['fields'](_0x31f973[_0x48f1('0x2e')][_0x48f1('0x33')]));_0x56a354['attributes']=_0x56a354[_0x48f1('0x32')]['length']?_0x56a354['attributes']:_0x2ece02['model'];if(!_0x31f973[_0x48f1('0x2e')][_0x48f1('0x34')](_0x48f1('0x35'))){_0x56a354[_0x48f1('0x1c')]=qs[_0x48f1('0x1c')](_0x31f973[_0x48f1('0x2e')][_0x48f1('0x1c')]);_0x56a354['offset']=qs[_0x48f1('0x1a')](_0x31f973[_0x48f1('0x2e')][_0x48f1('0x1a')]);}_0x56a354['order']=qs[_0x48f1('0x36')](_0x31f973[_0x48f1('0x2e')]['sort']);_0x56a354['where']=qs[_0x48f1('0x2f')](_[_0x48f1('0x37')](_0x31f973[_0x48f1('0x2e')],_0x2ece02[_0x48f1('0x2f')]),_0x5623ef);if(_0x31f973[_0x48f1('0x2e')][_0x48f1('0x38')]){_0x56a354[_0x48f1('0x39')]=_[_0x48f1('0x3a')](_0x56a354[_0x48f1('0x39')],{'$or':_[_0x48f1('0x3b')](_0x5623ef,function(_0xc45712){if(_0xc45712[_0x48f1('0x3c')]!==_0x48f1('0x3d')){var _0x117155={};_0x117155[_0xc45712[_0x48f1('0x27')]]={'$like':'%'+_0x31f973['query']['filter']+'%'};return _0x117155;}})});}_0x56a354=_['merge']({},_0x56a354,_0x31f973[_0x48f1('0x3e')]);var _0x49fc3f={'where':_0x56a354[_0x48f1('0x39')]};return db[_0x48f1('0x2a')][_0x48f1('0x1d')](_0x49fc3f)[_0x48f1('0x20')](function(_0x31af5d){_0x471c38['count']=_0x31af5d;if(_0x31f973[_0x48f1('0x2e')][_0x48f1('0x3f')]){_0x56a354[_0x48f1('0x40')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x56a354);})[_0x48f1('0x20')](function(_0x174278){_0x471c38[_0x48f1('0x41')]=_0x174278;return _0x471c38;})[_0x48f1('0x20')](respondWithFilteredResult(_0x111f3b,_0x56a354))[_0x48f1('0x42')](handleError(_0x111f3b,null));};exports[_0x48f1('0x43')]=function(_0x30deff,_0x499f85){var _0x17e061={'raw':!![],'where':{'id':_0x30deff[_0x48f1('0x44')]['id']}},_0x39caa8={};_0x39caa8[_0x48f1('0x31')]=_['keys'](db[_0x48f1('0x2a')][_0x48f1('0x45')]);_0x39caa8[_0x48f1('0x2e')]=_[_0x48f1('0x2d')](_0x30deff[_0x48f1('0x2e')]);_0x39caa8[_0x48f1('0x2f')]=_[_0x48f1('0x30')](_0x39caa8['model'],_0x39caa8[_0x48f1('0x2e')]);_0x17e061[_0x48f1('0x32')]=_[_0x48f1('0x30')](_0x39caa8[_0x48f1('0x31')],qs[_0x48f1('0x33')](_0x30deff[_0x48f1('0x2e')]['fields']));_0x17e061[_0x48f1('0x32')]=_0x17e061['attributes'][_0x48f1('0x46')]?_0x17e061[_0x48f1('0x32')]:_0x39caa8[_0x48f1('0x31')];if(_0x30deff['query'][_0x48f1('0x3f')]){_0x17e061[_0x48f1('0x40')]=[{'all':!![]}];}_0x17e061=_['merge']({},_0x17e061,_0x30deff[_0x48f1('0x3e')]);return db[_0x48f1('0x2a')][_0x48f1('0x47')](_0x17e061)[_0x48f1('0x20')](handleEntityNotFound(_0x499f85,null))[_0x48f1('0x20')](respondWithResult(_0x499f85,null))[_0x48f1('0x42')](handleError(_0x499f85,null));};exports[_0x48f1('0x48')]=function(_0xd52e8d,_0x1905bd){return db['CmHopperAdditionalPhone'][_0x48f1('0x48')](_0xd52e8d['body'],{})[_0x48f1('0x20')](function(_0x3ae67a){var _0x397086=_0xd52e8d[_0x48f1('0x49')][_0x48f1('0x22')]({'plain':!![]});if(!_0x397086)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x397086[_0x48f1('0x4a')]==='user'){var _0xca7d8b=_0x3ae67a[_0x48f1('0x22')]({'plain':!![]});var _0x4dd164=_0x48f1('0x23');return db[_0x48f1('0x4b')][_0x48f1('0x47')]({'where':{'name':_0x4dd164,'userProfileId':_0x397086[_0x48f1('0x4c')]},'raw':!![]})['then'](function(_0xe583f4){if(_0xe583f4&&_0xe583f4[_0x48f1('0x4d')]===0x0){return db[_0x48f1('0x4e')][_0x48f1('0x48')]({'name':_0xca7d8b['name'],'resourceId':_0xca7d8b['id'],'type':_0xe583f4['name'],'sectionId':_0xe583f4['id']},{})[_0x48f1('0x20')](function(){return _0x3ae67a;});}else{return _0x3ae67a;}})[_0x48f1('0x42')](function(_0x80f766){logger[_0x48f1('0x25')](_0x48f1('0x4f'),_0x80f766);throw _0x80f766;});}return _0x3ae67a;})['then'](respondWithResult(_0x1905bd,0xc9))[_0x48f1('0x42')](handleError(_0x1905bd,null));};exports[_0x48f1('0x50')]=function(_0x2f45c4,_0x15bf80){if(_0x2f45c4[_0x48f1('0x51')]['id']){delete _0x2f45c4[_0x48f1('0x51')]['id'];}return db[_0x48f1('0x2a')]['find']({'where':{'id':_0x2f45c4[_0x48f1('0x44')]['id']}})[_0x48f1('0x20')](handleEntityNotFound(_0x15bf80,null))[_0x48f1('0x20')](saveUpdates(_0x2f45c4[_0x48f1('0x51')],null))['then'](respondWithResult(_0x15bf80,null))[_0x48f1('0x42')](handleError(_0x15bf80,null));};exports[_0x48f1('0x21')]=function(_0x1d1871,_0x32b604){return db['CmHopperAdditionalPhone'][_0x48f1('0x47')]({'where':{'id':_0x1d1871[_0x48f1('0x44')]['id']}})['then'](handleEntityNotFound(_0x32b604,null))[_0x48f1('0x20')](removeEntity(_0x32b604,null))[_0x48f1('0x42')](handleError(_0x32b604,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 2e12957..329de88 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c7e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','util','api'];(function(_0x2c0e4c,_0x203e04){var _0x176a73=function(_0x16a8b0){while(--_0x16a8b0){_0x2c0e4c['push'](_0x2c0e4c['shift']());}};_0x176a73(++_0x203e04);}(_0x3c7e,0xdb));var _0xe3c7=function(_0x52096b,_0x20bab4){_0x52096b=_0x52096b-0x0;var _0x2b1cc7=_0x3c7e[_0x52096b];return _0x2b1cc7;};'use strict';var _=require('lodash');var util=require(_0xe3c7('0x0'));var logger=require('../../config/logger')(_0xe3c7('0x1'));var moment=require(_0xe3c7('0x2'));var BPromise=require(_0xe3c7('0x3'));var rp=require(_0xe3c7('0x4'));var fs=require('fs');var path=require(_0xe3c7('0x5'));var rimraf=require(_0xe3c7('0x6'));var config=require(_0xe3c7('0x7'));var attributes=require(_0xe3c7('0x8'));module[_0xe3c7('0x9')]=function(_0x595d55,_0x3e0da8){return _0x595d55[_0xe3c7('0xa')](_0xe3c7('0xb'),attributes,{'tableName':_0xe3c7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd734=['moment','request-promise','rimraf','./cmHopperAdditionalPhone.attributes','define','cm_hopper_additional_phones','lodash','util','../../config/logger','api'];(function(_0x5b6353,_0x17c692){var _0x5e940b=function(_0x1d8405){while(--_0x1d8405){_0x5b6353['push'](_0x5b6353['shift']());}};_0x5e940b(++_0x17c692);}(_0xd734,0x18c));var _0x4d73=function(_0x5ac031,_0x4007bb){_0x5ac031=_0x5ac031-0x0;var _0xd8b5e3=_0xd734[_0x5ac031];return _0xd8b5e3;};'use strict';var _=require(_0x4d73('0x0'));var util=require(_0x4d73('0x1'));var logger=require(_0x4d73('0x2'))(_0x4d73('0x3'));var moment=require(_0x4d73('0x4'));var BPromise=require('bluebird');var rp=require(_0x4d73('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d73('0x6'));var config=require('../../config/environment');var attributes=require(_0x4d73('0x7'));module['exports']=function(_0x361d70,_0x209d65){return _0x361d70[_0x4d73('0x8')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x4d73('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index c9f261e..3eb5f82 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cf0=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','findOne','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','update','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','OrderBy','ASC'];(function(_0x37cfe7,_0x38c2e2){var _0x182fdd=function(_0x53baf2){while(--_0x53baf2){_0x37cfe7['push'](_0x37cfe7['shift']());}};_0x182fdd(++_0x38c2e2);}(_0x1cf0,0x182));var _0x01cf=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0x1cf0[_0x53bcc3];return _0x47c959;};'use strict';var _=require(_0x01cf('0x0'));var util=require(_0x01cf('0x1'));var moment=require(_0x01cf('0x2'));var BPromise=require(_0x01cf('0x3'));var rs=require(_0x01cf('0x4'));var fs=require('fs');var Redis=require(_0x01cf('0x5'));var db=require(_0x01cf('0x6'))['db'];var utils=require(_0x01cf('0x7'));var logger=require(_0x01cf('0x8'))(_0x01cf('0x9'));var config=require(_0x01cf('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x01cf('0xb')][_0x01cf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x44f84e,_0x28c4f8,_0x5abce3){return new BPromise(function(_0x5cca6a,_0x1a2442){return client[_0x01cf('0xd')](_0x44f84e,_0x5abce3)[_0x01cf('0xe')](function(_0x15b021){logger[_0x01cf('0xf')](_0x01cf('0x10'),_0x28c4f8,_0x01cf('0x11'));logger[_0x01cf('0x12')](_0x01cf('0x13'),_0x28c4f8,_0x01cf('0x11'),JSON[_0x01cf('0x14')](_0x15b021));if(_0x15b021[_0x01cf('0x15')]){if(_0x15b021[_0x01cf('0x15')]['code']===0x1f4){logger[_0x01cf('0x15')](_0x01cf('0x10'),_0x28c4f8,_0x15b021[_0x01cf('0x15')][_0x01cf('0x16')]);return _0x1a2442(_0x15b021['error'][_0x01cf('0x16')]);}logger[_0x01cf('0x15')](_0x01cf('0x10'),_0x28c4f8,_0x15b021[_0x01cf('0x15')][_0x01cf('0x16')]);return _0x5cca6a(_0x15b021['error']['message']);}else{logger[_0x01cf('0xf')](_0x01cf('0x10'),_0x28c4f8,_0x01cf('0x11'));_0x5cca6a(_0x15b021[_0x01cf('0x17')][_0x01cf('0x16')]);}})[_0x01cf('0x18')](function(_0x23b12a){logger[_0x01cf('0x15')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x28c4f8,_0x23b12a);_0x1a2442(_0x23b12a);});});}exports[_0x01cf('0x19')]=function(_0x18095e){var _0x56655f=this;return new Promise(function(_0x56d8f5,_0x258bfc){return db[_0x01cf('0x1a')]['findOne']({'raw':!![],'where':{'ContactId':_0x18095e[_0x01cf('0x1b')][_0x01cf('0x1c')],'ListId':_0x18095e[_0x01cf('0x1b')][_0x01cf('0x1d')],'VoiceQueueId':_0x18095e[_0x01cf('0x1b')][_0x01cf('0x1e')]===undefined?null:_0x18095e[_0x01cf('0x1b')][_0x01cf('0x1e')],'CampaignId':_0x18095e['body'][_0x01cf('0x1f')]===undefined?null:_0x18095e[_0x01cf('0x1b')][_0x01cf('0x1f')]}})[_0x01cf('0xe')](function(_0xea3044){if(_0xea3044!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0xea3044['id'],'OrderBy':{'$gt':_0xea3044[_0x01cf('0x20')]}},'order':[[_0x01cf('0x20'),_0x01cf('0x21')]]})[_0x01cf('0xe')](function(_0x14760c){var _0x29dbfc=0x0;if(_0x14760c){if(_0x14760c[_0x01cf('0x22')]+_0x14760c[_0x01cf('0x23')]+_0x14760c[_0x01cf('0x24')]+_0x14760c[_0x01cf('0x25')]+_0x14760c[_0x01cf('0x26')]+_0x14760c[_0x01cf('0x27')]+_0x14760c[_0x01cf('0x28')]+_0x14760c[_0x01cf('0x29')]<_0x18095e[_0x01cf('0x2a')][_0x01cf('0x2b')])_0x29dbfc=0x1;_0x56d8f5({'additional':_0x29dbfc});}else{return db[_0x01cf('0x2c')][_0x01cf('0x2d')]({'raw':!![],'where':{'CmHopperId':_0xea3044['id']},'order':[[_0x01cf('0x20'),_0x01cf('0x21')]]})['then'](function(_0x486105){var _0x2f63db=0x0;if(_0x486105){if(_0x486105['countbusyretry']+_0x486105[_0x01cf('0x23')]+_0x486105[_0x01cf('0x24')]+_0x486105[_0x01cf('0x25')]+_0x486105[_0x01cf('0x26')]+_0x486105[_0x01cf('0x27')]+_0x486105['countmachineretry']+_0x486105[_0x01cf('0x29')]<_0x18095e[_0x01cf('0x2a')][_0x01cf('0x2b')])_0x2f63db=0x1;_0x56d8f5({'additional':_0x2f63db});}else{_0x56d8f5({'additional':0x0});}})[_0x01cf('0x18')](function(_0x1f8a7e){logger[_0x01cf('0x15')](_0x01cf('0x19'),_0x1f8a7e[_0x01cf('0x16')]);_0x258bfc(_0x56655f['error'](0x1f4,_0x1f8a7e[_0x01cf('0x16')]));});}})[_0x01cf('0x18')](function(_0x4aa682){logger[_0x01cf('0x15')](_0x01cf('0x19'),_0x4aa682[_0x01cf('0x16')]);_0x258bfc(_0x56655f[_0x01cf('0x15')](0x1f4,_0x4aa682[_0x01cf('0x16')]));});}else _0x56d8f5({'additional':0x0});});});};exports[_0x01cf('0x2e')]=function(_0x3b7283){var _0x3373fd=this;return new Promise(function(_0x589ca8,_0x189186){return db[_0x01cf('0x1a')][_0x01cf('0x2d')]({'raw':!![],'where':{'ContactId':_0x3b7283['body'][_0x01cf('0x1c')],'ListId':_0x3b7283[_0x01cf('0x1b')][_0x01cf('0x1d')],'VoiceQueueId':_0x3b7283[_0x01cf('0x1b')]['VoiceQueueId']===undefined?null:_0x3b7283[_0x01cf('0x1b')][_0x01cf('0x1e')],'CampaignId':_0x3b7283['body'][_0x01cf('0x1f')]===undefined?null:_0x3b7283['body'][_0x01cf('0x1f')]}})[_0x01cf('0xe')](function(_0x32fa61){if(_0x32fa61!=null){return db[_0x01cf('0x2c')][_0x01cf('0x2d')]({'raw':!![],'where':{'CmHopperId':_0x32fa61['id'],'OrderBy':{'$gte':_0x32fa61['OrderBy']}},'order':[[_0x01cf('0x20'),'ASC']]})[_0x01cf('0xe')](function(_0x5f230e){if(_0x5f230e)return activateAdditionalPhone(_0x32fa61,_0x3b7283['body'],_0x5f230e,_0x3b7283[_0x01cf('0x2f')],_0x3b7283[_0x01cf('0x30')])['then'](function(_0x463f88){_0x589ca8(_0x463f88);});else{return db[_0x01cf('0x2c')][_0x01cf('0x2d')]({'raw':!![],'where':{'CmHopperId':_0x32fa61['id']},'order':[['OrderBy',_0x01cf('0x21')]]})['then'](function(_0xa0487c){if(_0xa0487c)return activateAdditionalPhone(_0x32fa61,_0x3b7283[_0x01cf('0x1b')],_0xa0487c,_0x3b7283[_0x01cf('0x2f')],_0x3b7283[_0x01cf('0x30')])[_0x01cf('0xe')](function(_0x435d01){_0x589ca8(_0x435d01);});else{_0x589ca8({'id':_0x32fa61['id'],'phone':''});}})['catch'](function(_0x2ca6b0){logger[_0x01cf('0x15')](_0x01cf('0x19'),_0x2ca6b0[_0x01cf('0x16')]);_0x189186(_0x3373fd[_0x01cf('0x15')](0x1f4,_0x2ca6b0[_0x01cf('0x16')]));});}})[_0x01cf('0x18')](function(_0x3747fe){logger['error'](_0x01cf('0x19'),_0x3747fe[_0x01cf('0x16')]);_0x189186(_0x3373fd[_0x01cf('0x15')](0x1f4,_0x3747fe[_0x01cf('0x16')]));});}else _0x589ca8(0x1);});});};function activateAdditionalPhone(_0x2c8ed1,_0x465a58,_0x5cdb5d,_0x2dab32,_0x5d6b5f){return new Promise(function(_0x233a61,_0x12eab7){var _0x407cbf;if(_[_0x01cf('0x31')](_0x5cdb5d[_0x01cf('0x32')])){_0x5cdb5d['scheduledat']=moment();}if(moment()>moment(_0x5cdb5d[_0x01cf('0x32')])){_0x407cbf=moment()[_0x01cf('0x33')](_0x5d6b5f||0x3,_0x01cf('0x34'));}else{if(_0x5cdb5d[_0x01cf('0x20')]==0x0){_0x407cbf=moment(_0x5cdb5d[_0x01cf('0x32')]);}else{_0x407cbf=moment()[_0x01cf('0x33')](_0x5d6b5f||0x3,_0x01cf('0x34'));}}if(_[_0x01cf('0x31')](_0x407cbf)){_0x407cbf=moment()[_0x01cf('0x33')](_0x5d6b5f||0x3,_0x01cf('0x34'));}var _0xa3079e={'phone':_0x2c8ed1[_0x01cf('0x35')],'active':0x0,'OrderBy':_['isNil'](_0x2c8ed1[_0x01cf('0x20')])?0x0:_0x2c8ed1[_0x01cf('0x20')],'scheduledat':moment()[_0x01cf('0x33')](_0x2dab32||0x1,_0x01cf('0x34')),'countbusyretry':_0x465a58[_0x01cf('0x22')],'countcongestionretry':_0x465a58[_0x01cf('0x23')],'countnoanswerretry':_0x465a58[_0x01cf('0x24')],'countnosuchnumberretry':_0x465a58[_0x01cf('0x25')],'countdropretry':_0x465a58[_0x01cf('0x26')],'countabandonedretry':_0x465a58[_0x01cf('0x27')],'countmachineretry':_0x465a58[_0x01cf('0x28')],'countagentrejectretry':_0x465a58[_0x01cf('0x29')],'createdAt':_0x465a58[_0x01cf('0x36')],'updatedAt':_0x465a58[_0x01cf('0x37')]};var _0x47058c={'CmHopperId':_0x2c8ed1['id'],'phone':_0x5cdb5d[_0x01cf('0x35')],'active':0x0,'OrderBy':_[_0x01cf('0x31')](_0x5cdb5d[_0x01cf('0x20')])?0x0:_0x5cdb5d['OrderBy'],'scheduledat':_0x407cbf,'countbusyretry':_0x5cdb5d['countbusyretry'],'countcongestionretry':_0x5cdb5d[_0x01cf('0x23')],'countnoanswerretry':_0x5cdb5d['countnoanswerretry'],'countnosuchnumberretry':_0x5cdb5d[_0x01cf('0x25')],'countdropretry':_0x5cdb5d[_0x01cf('0x26')],'countabandonedretry':_0x5cdb5d['countabandonedretry'],'countmachineretry':_0x5cdb5d[_0x01cf('0x28')],'countagentrejectretry':_0x5cdb5d[_0x01cf('0x29')],'createdAt':_0x5cdb5d[_0x01cf('0x36')],'updatedAt':_0x5cdb5d['updatedAt']};return db[_0x01cf('0x38')]['transaction'](function(_0xe8db03){return db[_0x01cf('0x2c')][_0x01cf('0x39')](_0xa3079e,{'where':{'id':_0x5cdb5d['id']}},{'transaction':_0xe8db03})['then'](function(){return db[_0x01cf('0x1a')][_0x01cf('0x39')](_0x47058c,{'where':{'id':_0x2c8ed1['id']}},{'transaction':_0xe8db03});});})[_0x01cf('0xe')](function(_0x2dea23){_0x233a61({'id':_0x2c8ed1['id'],'phone':_0x5cdb5d[_0x01cf('0x35')]});})[_0x01cf('0x18')](function(_0x291e91){logger[_0x01cf('0x15')]('activateAdditionalPhone',_0x291e91[_0x01cf('0x16')]);_0x12eab7({'error':_0x291e91[_0x01cf('0x16')]});});});}exports[_0x01cf('0x3a')]=function(_0x4edc89){var _0x1695a2=this;return new Promise(function(_0x4b5b3d,_0x4df767){return db['CmHopper'][_0x01cf('0x39')](_0x4edc89[_0x01cf('0x1b')][_0x01cf('0x3b')],{'where':{'id':_0x4edc89['body']['id']}})['then'](function(_0x58e28b){_0x4b5b3d(_0x58e28b);})[_0x01cf('0x18')](function(_0x4ad666){logger[_0x01cf('0x15')](_0x01cf('0x3a'),_0x4ad666['message']);_0x4df767(_0x1695a2['error'](0x1f4,_0x4ad666[_0x01cf('0x16')]));});});}; \ No newline at end of file +var _0xf87d=['countnosuchnumberretry','countabandonedretry','dialGlobalMaxRetry','countdropretry','countmachineretry','countagentrejectretry','entity','SwapAdditionalPhones','CmHopper','ContactId','then','duration','waitTime','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VerifyAdditionalPhones','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf87d,0x13c));var _0xdf87=function(_0x10b593,_0x4e497d){_0x10b593=_0x10b593-0x0;var _0x40cf20=_0xf87d[_0x10b593];return _0x40cf20;};'use strict';var _=require(_0xdf87('0x0'));var util=require(_0xdf87('0x1'));var moment=require(_0xdf87('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf87('0x3'));var db=require(_0xdf87('0x4'))['db'];var utils=require(_0xdf87('0x5'));var logger=require(_0xdf87('0x6'))(_0xdf87('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdf87('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5174b3,_0x45397c,_0x16bda4){return new BPromise(function(_0x522a00,_0x58f1d1){return client[_0xdf87('0x9')](_0x5174b3,_0x16bda4)['then'](function(_0x149ae3){logger[_0xdf87('0xa')](_0xdf87('0xb'),_0x45397c,_0xdf87('0xc'));logger[_0xdf87('0xd')](_0xdf87('0xe'),_0x45397c,'request\x20sent',JSON['stringify'](_0x149ae3));if(_0x149ae3[_0xdf87('0xf')]){if(_0x149ae3[_0xdf87('0xf')][_0xdf87('0x10')]===0x1f4){logger[_0xdf87('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x45397c,_0x149ae3[_0xdf87('0xf')][_0xdf87('0x11')]);return _0x58f1d1(_0x149ae3[_0xdf87('0xf')]['message']);}logger[_0xdf87('0xf')](_0xdf87('0xb'),_0x45397c,_0x149ae3[_0xdf87('0xf')][_0xdf87('0x11')]);return _0x522a00(_0x149ae3[_0xdf87('0xf')][_0xdf87('0x11')]);}else{logger[_0xdf87('0xa')](_0xdf87('0xb'),_0x45397c,_0xdf87('0xc'));_0x522a00(_0x149ae3[_0xdf87('0x12')][_0xdf87('0x11')]);}})[_0xdf87('0x13')](function(_0x1147c5){logger[_0xdf87('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x45397c,_0x1147c5);_0x58f1d1(_0x1147c5);});});}exports[_0xdf87('0x14')]=function(_0x13b1bd){var _0x471125=this;return new Promise(function(_0x46e018,_0x34f392){return db['CmHopper'][_0xdf87('0x15')]({'raw':!![],'where':{'ContactId':_0x13b1bd['body']['ContactId'],'ListId':_0x13b1bd[_0xdf87('0x16')][_0xdf87('0x17')],'VoiceQueueId':_0x13b1bd[_0xdf87('0x16')]['VoiceQueueId']===undefined?null:_0x13b1bd[_0xdf87('0x16')][_0xdf87('0x18')],'CampaignId':_0x13b1bd[_0xdf87('0x16')][_0xdf87('0x19')]===undefined?null:_0x13b1bd['body'][_0xdf87('0x19')]}})['then'](function(_0x2a4109){if(_0x2a4109!=null){return db[_0xdf87('0x1a')][_0xdf87('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2a4109['id'],'OrderBy':{'$gt':_0x2a4109[_0xdf87('0x1b')]}},'order':[[_0xdf87('0x1b'),_0xdf87('0x1c')]]})['then'](function(_0x5d56b0){var _0x396661=0x0;if(_0x5d56b0){if(_0x5d56b0[_0xdf87('0x1d')]+_0x5d56b0[_0xdf87('0x1e')]+_0x5d56b0[_0xdf87('0x1f')]+_0x5d56b0[_0xdf87('0x20')]+_0x5d56b0['countdropretry']+_0x5d56b0[_0xdf87('0x21')]+_0x5d56b0['countmachineretry']+_0x5d56b0['countagentrejectretry']<_0x13b1bd['entity'][_0xdf87('0x22')])_0x396661=0x1;_0x46e018({'additional':_0x396661});}else{return db[_0xdf87('0x1a')][_0xdf87('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2a4109['id']},'order':[[_0xdf87('0x1b'),_0xdf87('0x1c')]]})['then'](function(_0x42e491){var _0x37f81c=0x0;if(_0x42e491){if(_0x42e491[_0xdf87('0x1d')]+_0x42e491[_0xdf87('0x1e')]+_0x42e491[_0xdf87('0x1f')]+_0x42e491[_0xdf87('0x20')]+_0x42e491[_0xdf87('0x23')]+_0x42e491[_0xdf87('0x21')]+_0x42e491[_0xdf87('0x24')]+_0x42e491[_0xdf87('0x25')]<_0x13b1bd[_0xdf87('0x26')][_0xdf87('0x22')])_0x37f81c=0x1;_0x46e018({'additional':_0x37f81c});}else{_0x46e018({'additional':0x0});}})[_0xdf87('0x13')](function(_0x506d79){logger[_0xdf87('0xf')]('VerifyAdditionalPhones',_0x506d79[_0xdf87('0x11')]);_0x34f392(_0x471125[_0xdf87('0xf')](0x1f4,_0x506d79['message']));});}})['catch'](function(_0xed8b81){logger[_0xdf87('0xf')]('VerifyAdditionalPhones',_0xed8b81[_0xdf87('0x11')]);_0x34f392(_0x471125[_0xdf87('0xf')](0x1f4,_0xed8b81[_0xdf87('0x11')]));});}else _0x46e018({'additional':0x0});});});};exports[_0xdf87('0x27')]=function(_0x21f690){var _0x330c5e=this;return new Promise(function(_0x4a1194,_0x278e6a){return db[_0xdf87('0x28')][_0xdf87('0x15')]({'raw':!![],'where':{'ContactId':_0x21f690[_0xdf87('0x16')][_0xdf87('0x29')],'ListId':_0x21f690['body'][_0xdf87('0x17')],'VoiceQueueId':_0x21f690['body'][_0xdf87('0x18')]===undefined?null:_0x21f690[_0xdf87('0x16')][_0xdf87('0x18')],'CampaignId':_0x21f690[_0xdf87('0x16')][_0xdf87('0x19')]===undefined?null:_0x21f690[_0xdf87('0x16')][_0xdf87('0x19')]}})[_0xdf87('0x2a')](function(_0x2fefc2){if(_0x2fefc2!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x2fefc2['id'],'OrderBy':{'$gte':_0x2fefc2[_0xdf87('0x1b')]}},'order':[[_0xdf87('0x1b'),_0xdf87('0x1c')]]})[_0xdf87('0x2a')](function(_0x35186f){if(_0x35186f)return activateAdditionalPhone(_0x2fefc2,_0x21f690[_0xdf87('0x16')],_0x35186f,_0x21f690[_0xdf87('0x2b')],_0x21f690[_0xdf87('0x2c')])[_0xdf87('0x2a')](function(_0x3b2287){_0x4a1194(_0x3b2287);});else{return db[_0xdf87('0x1a')][_0xdf87('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2fefc2['id']},'order':[[_0xdf87('0x1b'),_0xdf87('0x1c')]]})['then'](function(_0x5072d4){if(_0x5072d4)return activateAdditionalPhone(_0x2fefc2,_0x21f690[_0xdf87('0x16')],_0x5072d4,_0x21f690[_0xdf87('0x2b')],_0x21f690[_0xdf87('0x2c')])['then'](function(_0xf6e220){_0x4a1194(_0xf6e220);});else{_0x4a1194({'id':_0x2fefc2['id'],'phone':''});}})[_0xdf87('0x13')](function(_0x5247ef){logger['error'](_0xdf87('0x14'),_0x5247ef[_0xdf87('0x11')]);_0x278e6a(_0x330c5e['error'](0x1f4,_0x5247ef[_0xdf87('0x11')]));});}})[_0xdf87('0x13')](function(_0x5afb1e){logger[_0xdf87('0xf')]('VerifyAdditionalPhones',_0x5afb1e[_0xdf87('0x11')]);_0x278e6a(_0x330c5e[_0xdf87('0xf')](0x1f4,_0x5afb1e[_0xdf87('0x11')]));});}else _0x4a1194(0x1);});});};function activateAdditionalPhone(_0xcc7394,_0x1bb6dd,_0x365668,_0x534adc,_0x4e682a){return new Promise(function(_0x23156a,_0x2d1ada){var _0x375aeb;if(_['isNil'](_0x365668[_0xdf87('0x2d')])){_0x365668[_0xdf87('0x2d')]=moment();}if(moment()>moment(_0x365668[_0xdf87('0x2d')])){_0x375aeb=moment()[_0xdf87('0x2e')](_0x4e682a||0x3,'minutes');}else{if(_0x365668[_0xdf87('0x1b')]==0x0){_0x375aeb=moment(_0x365668[_0xdf87('0x2d')]);}else{_0x375aeb=moment()[_0xdf87('0x2e')](_0x4e682a||0x3,_0xdf87('0x2f'));}}if(_[_0xdf87('0x30')](_0x375aeb)){_0x375aeb=moment()[_0xdf87('0x2e')](_0x4e682a||0x3,_0xdf87('0x2f'));}var _0x2daa1d={'phone':_0xcc7394[_0xdf87('0x31')],'active':0x0,'OrderBy':_[_0xdf87('0x30')](_0xcc7394['OrderBy'])?0x0:_0xcc7394['OrderBy'],'scheduledat':moment()[_0xdf87('0x2e')](_0x534adc||0x1,_0xdf87('0x2f')),'countbusyretry':_0x1bb6dd[_0xdf87('0x1d')],'countcongestionretry':_0x1bb6dd['countcongestionretry'],'countnoanswerretry':_0x1bb6dd['countnoanswerretry'],'countnosuchnumberretry':_0x1bb6dd[_0xdf87('0x20')],'countdropretry':_0x1bb6dd[_0xdf87('0x23')],'countabandonedretry':_0x1bb6dd[_0xdf87('0x21')],'countmachineretry':_0x1bb6dd[_0xdf87('0x24')],'countagentrejectretry':_0x1bb6dd[_0xdf87('0x25')],'createdAt':_0x1bb6dd[_0xdf87('0x32')],'updatedAt':_0x1bb6dd[_0xdf87('0x33')]};var _0xd9997f={'CmHopperId':_0xcc7394['id'],'phone':_0x365668[_0xdf87('0x31')],'active':0x0,'OrderBy':_[_0xdf87('0x30')](_0x365668[_0xdf87('0x1b')])?0x0:_0x365668[_0xdf87('0x1b')],'scheduledat':_0x375aeb,'countbusyretry':_0x365668[_0xdf87('0x1d')],'countcongestionretry':_0x365668[_0xdf87('0x1e')],'countnoanswerretry':_0x365668['countnoanswerretry'],'countnosuchnumberretry':_0x365668[_0xdf87('0x20')],'countdropretry':_0x365668[_0xdf87('0x23')],'countabandonedretry':_0x365668[_0xdf87('0x21')],'countmachineretry':_0x365668[_0xdf87('0x24')],'countagentrejectretry':_0x365668[_0xdf87('0x25')],'createdAt':_0x365668[_0xdf87('0x32')],'updatedAt':_0x365668[_0xdf87('0x33')]};return db[_0xdf87('0x34')][_0xdf87('0x35')](function(_0x656e01){return db[_0xdf87('0x1a')]['update'](_0x2daa1d,{'where':{'id':_0x365668['id']}},{'transaction':_0x656e01})[_0xdf87('0x2a')](function(){return db['CmHopper'][_0xdf87('0x36')](_0xd9997f,{'where':{'id':_0xcc7394['id']}},{'transaction':_0x656e01});});})[_0xdf87('0x2a')](function(_0x417b05){_0x23156a({'id':_0xcc7394['id'],'phone':_0x365668[_0xdf87('0x31')]});})[_0xdf87('0x13')](function(_0x5df7c4){logger[_0xdf87('0xf')](_0xdf87('0x37'),_0x5df7c4['message']);_0x2d1ada({'error':_0x5df7c4['message']});});});}exports['IncrementPreviewCounters']=function(_0x261ecb){var _0x19e7f1=this;return new Promise(function(_0x3e641b,_0x32595f){return db[_0xdf87('0x28')][_0xdf87('0x36')](_0x261ecb[_0xdf87('0x16')][_0xdf87('0x38')],{'where':{'id':_0x261ecb[_0xdf87('0x16')]['id']}})[_0xdf87('0x2a')](function(_0x34e0f7){_0x3e641b(_0x34e0f7);})['catch'](function(_0x3f7425){logger['error'](_0xdf87('0x39'),_0x3f7425['message']);_0x32595f(_0x19e7f1[_0xdf87('0xf')](0x1f4,_0x3f7425[_0xdf87('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 23556c3..835351e 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbd5=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x11807a,_0xb04cc2){var _0x347921=function(_0x12389a){while(--_0x12389a){_0x11807a['push'](_0x11807a['shift']());}};_0x347921(++_0xb04cc2);}(_0xfbd5,0x7e));var _0x5fbd=function(_0x1281dd,_0x34277c){_0x1281dd=_0x1281dd-0x0;var _0x30a8d3=_0xfbd5[_0x1281dd];return _0x30a8d3;};'use strict';var multer=require('multer');var util=require(_0x5fbd('0x0'));var path=require('path');var timeout=require(_0x5fbd('0x1'));var express=require('express');var router=express[_0x5fbd('0x2')]();var fs_extra=require(_0x5fbd('0x3'));var auth=require(_0x5fbd('0x4'));var interaction=require(_0x5fbd('0x5'));var config=require(_0x5fbd('0x6'));var controller=require(_0x5fbd('0x7'));router[_0x5fbd('0x8')]('/',auth[_0x5fbd('0x9')](),controller['index']);router[_0x5fbd('0x8')](_0x5fbd('0xa'),auth['isAuthenticated'](),controller[_0x5fbd('0xb')]);router[_0x5fbd('0xc')]('/',auth[_0x5fbd('0x9')](),controller[_0x5fbd('0xd')]);router[_0x5fbd('0xe')](_0x5fbd('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5fbd('0xf')](_0x5fbd('0xa'),auth[_0x5fbd('0x9')](),controller[_0x5fbd('0x10')]);module[_0x5fbd('0x11')]=router; \ No newline at end of file +var _0xbc78=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','put','update','delete','destroy'];(function(_0x1a968e,_0x3f45f4){var _0x2c7b23=function(_0xc1e5c4){while(--_0xc1e5c4){_0x1a968e['push'](_0x1a968e['shift']());}};_0x2c7b23(++_0x3f45f4);}(_0xbc78,0x191));var _0x8bc7=function(_0x5ce358,_0xa88c44){_0x5ce358=_0x5ce358-0x0;var _0x107f30=_0xbc78[_0x5ce358];return _0x107f30;};'use strict';var multer=require(_0x8bc7('0x0'));var util=require(_0x8bc7('0x1'));var path=require(_0x8bc7('0x2'));var timeout=require(_0x8bc7('0x3'));var express=require(_0x8bc7('0x4'));var router=express[_0x8bc7('0x5')]();var fs_extra=require(_0x8bc7('0x6'));var auth=require(_0x8bc7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8bc7('0x8'));var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8bc7('0x9')]);router[_0x8bc7('0xa')](_0x8bc7('0xb'),auth[_0x8bc7('0xc')](),controller[_0x8bc7('0xd')]);router[_0x8bc7('0xe')]('/',auth[_0x8bc7('0xc')](),controller['create']);router[_0x8bc7('0xf')](_0x8bc7('0xb'),auth['isAuthenticated'](),controller[_0x8bc7('0x10')]);router[_0x8bc7('0x11')](_0x8bc7('0xb'),auth[_0x8bc7('0xc')](),controller[_0x8bc7('0x12')]);module[_0x8bc7('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index d3080b5..6edb708 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 _0x3916=['contactListQueue','INTEGER','moment','exports','STRING'];(function(_0xcd7e9b,_0xe99af){var _0xa9196a=function(_0x56238d){while(--_0x56238d){_0xcd7e9b['push'](_0xcd7e9b['shift']());}};_0xa9196a(++_0xe99af);}(_0x3916,0x18d));var _0x6391=function(_0x4bed75,_0x211cc7){_0x4bed75=_0x4bed75-0x0;var _0x2dd8e8=_0x3916[_0x4bed75];return _0x2dd8e8;};'use strict';var moment=require(_0x6391('0x0'));var Sequelize=require('sequelize');module[_0x6391('0x1')]={'phone':{'type':Sequelize[_0x6391('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x6391('0x3')},'ListId':{'type':Sequelize[_0x6391('0x4')],'unique':_0x6391('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x6391('0x3')}}; \ No newline at end of file +var _0x98a7=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x98a7,0xdf));var _0x798a=function(_0x2af837,_0x3b67ca){_0x2af837=_0x2af837-0x0;var _0x2112e1=_0x98a7[_0x2af837];return _0x2112e1;};'use strict';var moment=require(_0x798a('0x0'));var Sequelize=require(_0x798a('0x1'));module[_0x798a('0x2')]={'phone':{'type':Sequelize[_0x798a('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x798a('0x4')],'unique':_0x798a('0x5')},'ListId':{'type':Sequelize[_0x798a('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x798a('0x4')],'unique':_0x798a('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 6538b24..be80255 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 _0x5580=['index','map','CmHopperBlack','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','catch','body','find','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../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','error','stack','name','send'];(function(_0x32504a,_0x475539){var _0x536848=function(_0x5d3040){while(--_0x5d3040){_0x32504a['push'](_0x32504a['shift']());}};_0x536848(++_0x475539);}(_0x5580,0xbd));var _0x0558=function(_0x2439b8,_0x53c970){_0x2439b8=_0x2439b8-0x0;var _0x12c79e=_0x5580[_0x2439b8];return _0x12c79e;};'use strict';var emlformat=require(_0x0558('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0558('0x1'));var jsonpatch=require(_0x0558('0x2'));var rp=require(_0x0558('0x3'));var moment=require(_0x0558('0x4'));var BPromise=require(_0x0558('0x5'));var Mustache=require(_0x0558('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0558('0x7'));var csv=require(_0x0558('0x8'));var ejs=require(_0x0558('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0558('0xa'));var squel=require('squel');var crypto=require(_0x0558('0xb'));var jsforce=require(_0x0558('0xc'));var deskjs=require(_0x0558('0xd'));var toCsv=require(_0x0558('0x8'));var querystring=require('querystring');var Papa=require(_0x0558('0xe'));var Redis=require(_0x0558('0xf'));var authService=require(_0x0558('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0558('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0558('0x12'))(_0x0558('0x13'));var utils=require(_0x0558('0x14'));var config=require(_0x0558('0x15'));var licenseUtil=require(_0x0558('0x16'));var db=require(_0x0558('0x17'))['db'];function respondWithStatusCode(_0x32aa51,_0x270ca9){_0x270ca9=_0x270ca9||0xcc;return function(_0x5cbaa3){if(_0x5cbaa3){return _0x32aa51[_0x0558('0x18')](_0x270ca9);}return _0x32aa51[_0x0558('0x19')](_0x270ca9)[_0x0558('0x1a')]();};}function respondWithResult(_0x629ccd,_0x2325f2){_0x2325f2=_0x2325f2||0xc8;return function(_0x3caba6){if(_0x3caba6){return _0x629ccd[_0x0558('0x19')](_0x2325f2)[_0x0558('0x1b')](_0x3caba6);}};}function respondWithFilteredResult(_0x547ec4,_0x4ef5a7){return function(_0x522d03){if(_0x522d03){var _0x277115=typeof _0x4ef5a7[_0x0558('0x1c')]===_0x0558('0x1d')&&typeof _0x4ef5a7[_0x0558('0x1e')]===_0x0558('0x1d');var _0x3f5e73=_0x522d03[_0x0558('0x1f')];var _0x3f8b67=_0x277115?0x0:_0x4ef5a7[_0x0558('0x1c')];var _0x233d4b=_0x277115?_0x522d03[_0x0558('0x1f')]:_0x4ef5a7[_0x0558('0x1c')]+_0x4ef5a7['limit'];var _0x5482d8;if(_0x233d4b>=_0x3f5e73){_0x233d4b=_0x3f5e73;_0x5482d8=0xc8;}else{_0x5482d8=0xce;}_0x547ec4['status'](_0x5482d8);return _0x547ec4[_0x0558('0x20')](_0x0558('0x21'),_0x3f8b67+'-'+_0x233d4b+'/'+_0x3f5e73)[_0x0558('0x1b')](_0x522d03);}return null;};}function patchUpdates(_0x39e554){return function(_0x2f200d){try{jsonpatch[_0x0558('0x22')](_0x2f200d,_0x39e554,!![]);}catch(_0x347bb8){return BPromise['reject'](_0x347bb8);}return _0x2f200d[_0x0558('0x23')]();};}function saveUpdates(_0x19ff11,_0x492485){return function(_0x3d7ab9){if(_0x3d7ab9){return _0x3d7ab9[_0x0558('0x24')](_0x19ff11)['then'](function(_0x3e01d1){return _0x3e01d1;});}return null;};}function removeEntity(_0x1fd224,_0x4837bc){return function(_0x318c5e){if(_0x318c5e){return _0x318c5e['destroy']()[_0x0558('0x25')](function(){_0x1fd224['status'](0xcc)[_0x0558('0x1a')]();});}};}function handleEntityNotFound(_0xd84865,_0x3d8d56){return function(_0x5a0e73){if(!_0x5a0e73){_0xd84865[_0x0558('0x18')](0x194);}return _0x5a0e73;};}function handleError(_0x573f07,_0x2185a5){_0x2185a5=_0x2185a5||0x1f4;return function(_0x371d46){logger[_0x0558('0x26')](_0x371d46[_0x0558('0x27')]);if(_0x371d46[_0x0558('0x28')]){delete _0x371d46[_0x0558('0x28')];}_0x573f07['status'](_0x2185a5)[_0x0558('0x29')](_0x371d46);};}exports[_0x0558('0x2a')]=function(_0x2c96b2,_0x1a45d0){var _0x397abe={},_0x3da81a={},_0x29b014={'count':0x0,'rows':[]};var _0x27d277=_[_0x0558('0x2b')](db[_0x0558('0x2c')]['rawAttributes'],function(_0x4e057f){return{'name':_0x4e057f[_0x0558('0x2d')],'type':_0x4e057f[_0x0558('0x2e')][_0x0558('0x2f')]};});_0x3da81a[_0x0558('0x30')]=_[_0x0558('0x2b')](_0x27d277,'name');_0x3da81a[_0x0558('0x31')]=_[_0x0558('0x32')](_0x2c96b2[_0x0558('0x31')]);_0x3da81a[_0x0558('0x33')]=_[_0x0558('0x34')](_0x3da81a[_0x0558('0x30')],_0x3da81a[_0x0558('0x31')]);_0x397abe[_0x0558('0x35')]=_[_0x0558('0x34')](_0x3da81a['model'],qs[_0x0558('0x36')](_0x2c96b2[_0x0558('0x31')][_0x0558('0x36')]));_0x397abe[_0x0558('0x35')]=_0x397abe[_0x0558('0x35')][_0x0558('0x37')]?_0x397abe[_0x0558('0x35')]:_0x3da81a[_0x0558('0x30')];if(!_0x2c96b2[_0x0558('0x31')][_0x0558('0x38')](_0x0558('0x39'))){_0x397abe[_0x0558('0x1e')]=qs[_0x0558('0x1e')](_0x2c96b2[_0x0558('0x31')][_0x0558('0x1e')]);_0x397abe[_0x0558('0x1c')]=qs[_0x0558('0x1c')](_0x2c96b2[_0x0558('0x31')][_0x0558('0x1c')]);}_0x397abe[_0x0558('0x3a')]=qs['sort'](_0x2c96b2[_0x0558('0x31')][_0x0558('0x3b')]);_0x397abe[_0x0558('0x3c')]=qs[_0x0558('0x33')](_[_0x0558('0x3d')](_0x2c96b2[_0x0558('0x31')],_0x3da81a[_0x0558('0x33')]),_0x27d277);if(_0x2c96b2[_0x0558('0x31')][_0x0558('0x3e')]){_0x397abe['where']=_[_0x0558('0x3f')](_0x397abe[_0x0558('0x3c')],{'$or':_[_0x0558('0x2b')](_0x27d277,function(_0x1d9f0f){if(_0x1d9f0f[_0x0558('0x2e')]!==_0x0558('0x40')){var _0x76dd8={};_0x76dd8[_0x1d9f0f[_0x0558('0x28')]]={'$like':'%'+_0x2c96b2['query'][_0x0558('0x3e')]+'%'};return _0x76dd8;}})});}_0x397abe=_[_0x0558('0x3f')]({},_0x397abe,_0x2c96b2[_0x0558('0x41')]);var _0x944619={'where':_0x397abe[_0x0558('0x3c')]};return db[_0x0558('0x2c')][_0x0558('0x1f')](_0x944619)['then'](function(_0x305d1f){_0x29b014[_0x0558('0x1f')]=_0x305d1f;if(_0x2c96b2[_0x0558('0x31')][_0x0558('0x42')]){_0x397abe['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x0558('0x43')](_0x397abe);})[_0x0558('0x25')](function(_0x4c491d){_0x29b014[_0x0558('0x44')]=_0x4c491d;return _0x29b014;})[_0x0558('0x25')](respondWithFilteredResult(_0x1a45d0,_0x397abe))['catch'](handleError(_0x1a45d0,null));};exports[_0x0558('0x45')]=function(_0xc16629,_0x4d9a97){var _0x22b887={'raw':!![],'where':{'id':_0xc16629['params']['id']}},_0xe308bd={};_0xe308bd[_0x0558('0x30')]=_[_0x0558('0x32')](db[_0x0558('0x2c')]['rawAttributes']);_0xe308bd['query']=_[_0x0558('0x32')](_0xc16629['query']);_0xe308bd['filters']=_[_0x0558('0x34')](_0xe308bd['model'],_0xe308bd[_0x0558('0x31')]);_0x22b887[_0x0558('0x35')]=_['intersection'](_0xe308bd[_0x0558('0x30')],qs[_0x0558('0x36')](_0xc16629[_0x0558('0x31')][_0x0558('0x36')]));_0x22b887[_0x0558('0x35')]=_0x22b887['attributes'][_0x0558('0x37')]?_0x22b887['attributes']:_0xe308bd[_0x0558('0x30')];if(_0xc16629[_0x0558('0x31')]['includeAll']){_0x22b887[_0x0558('0x46')]=[{'all':!![]}];}_0x22b887=_[_0x0558('0x3f')]({},_0x22b887,_0xc16629[_0x0558('0x41')]);return db[_0x0558('0x2c')]['find'](_0x22b887)[_0x0558('0x25')](handleEntityNotFound(_0x4d9a97,null))[_0x0558('0x25')](respondWithResult(_0x4d9a97,null))[_0x0558('0x47')](handleError(_0x4d9a97,null));};exports['update']=function(_0x29e9cb,_0xa48e45){if(_0x29e9cb['body']['id']){delete _0x29e9cb[_0x0558('0x48')]['id'];}return db[_0x0558('0x2c')][_0x0558('0x49')]({'where':{'id':_0x29e9cb[_0x0558('0x4a')]['id']}})[_0x0558('0x25')](handleEntityNotFound(_0xa48e45,null))[_0x0558('0x25')](saveUpdates(_0x29e9cb['body'],null))[_0x0558('0x25')](respondWithResult(_0xa48e45,null))[_0x0558('0x47')](handleError(_0xa48e45,null));};exports[_0x0558('0x4b')]=function(_0x2fa11a,_0x51cf51){return db[_0x0558('0x2c')][_0x0558('0x49')]({'where':{'id':_0x2fa11a[_0x0558('0x4a')]['id']}})[_0x0558('0x25')](handleEntityNotFound(_0x51cf51,null))[_0x0558('0x25')](removeEntity(_0x51cf51,null))[_0x0558('0x47')](handleError(_0x51cf51,null));};exports[_0x0558('0x4c')]=function(_0x45c760,_0x153ba7){return db[_0x0558('0x2c')][_0x0558('0x4c')]()[_0x0558('0x25')](respondWithResult(_0x153ba7,null))[_0x0558('0x47')](handleError(_0x153ba7,null));}; \ No newline at end of file +var _0xadee=['options','includeAll','findAll','rows','catch','show','keys','include','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xadee,0xa2));var _0xeade=function(_0x305c3c,_0x190f72){_0x305c3c=_0x305c3c-0x0;var _0x8d9fb6=_0xadee[_0x305c3c];return _0x8d9fb6;};'use strict';var emlformat=require(_0xeade('0x0'));var rimraf=require(_0xeade('0x1'));var zipdir=require(_0xeade('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeade('0x3'));var moment=require(_0xeade('0x4'));var BPromise=require(_0xeade('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xeade('0x6'));var sox=require(_0xeade('0x7'));var csv=require(_0xeade('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeade('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeade('0xa'));var toCsv=require('to-csv');var querystring=require(_0xeade('0xb'));var Papa=require(_0xeade('0xc'));var Redis=require(_0xeade('0xd'));var authService=require(_0xeade('0xe'));var qs=require(_0xeade('0xf'));var as=require(_0xeade('0x10'));var hardwareService=require(_0xeade('0x11'));var logger=require('../../config/logger')(_0xeade('0x12'));var utils=require(_0xeade('0x13'));var config=require(_0xeade('0x14'));var licenseUtil=require(_0xeade('0x15'));var db=require(_0xeade('0x16'))['db'];function respondWithStatusCode(_0x3957a7,_0x4c1af7){_0x4c1af7=_0x4c1af7||0xcc;return function(_0x16dbe6){if(_0x16dbe6){return _0x3957a7[_0xeade('0x17')](_0x4c1af7);}return _0x3957a7[_0xeade('0x18')](_0x4c1af7)['end']();};}function respondWithResult(_0x34c9c5,_0x56ceb3){_0x56ceb3=_0x56ceb3||0xc8;return function(_0x5ac46e){if(_0x5ac46e){return _0x34c9c5[_0xeade('0x18')](_0x56ceb3)[_0xeade('0x19')](_0x5ac46e);}};}function respondWithFilteredResult(_0x240db2,_0x13e4e9){return function(_0x159a2f){if(_0x159a2f){var _0x216adb=typeof _0x13e4e9['offset']===_0xeade('0x1a')&&typeof _0x13e4e9[_0xeade('0x1b')]===_0xeade('0x1a');var _0x39de5b=_0x159a2f[_0xeade('0x1c')];var _0x3515e1=_0x216adb?0x0:_0x13e4e9[_0xeade('0x1d')];var _0x270d52=_0x216adb?_0x159a2f[_0xeade('0x1c')]:_0x13e4e9['offset']+_0x13e4e9[_0xeade('0x1b')];var _0x613a10;if(_0x270d52>=_0x39de5b){_0x270d52=_0x39de5b;_0x613a10=0xc8;}else{_0x613a10=0xce;}_0x240db2[_0xeade('0x18')](_0x613a10);return _0x240db2[_0xeade('0x1e')](_0xeade('0x1f'),_0x3515e1+'-'+_0x270d52+'/'+_0x39de5b)[_0xeade('0x19')](_0x159a2f);}return null;};}function patchUpdates(_0x4345d6){return function(_0x1afb17){try{jsonpatch['apply'](_0x1afb17,_0x4345d6,!![]);}catch(_0x4115b8){return BPromise[_0xeade('0x20')](_0x4115b8);}return _0x1afb17['save']();};}function saveUpdates(_0x47b3c4,_0x55823a){return function(_0x295f2b){if(_0x295f2b){return _0x295f2b[_0xeade('0x21')](_0x47b3c4)[_0xeade('0x22')](function(_0x1af71f){return _0x1af71f;});}return null;};}function removeEntity(_0x95200d,_0x133f97){return function(_0xc0b15){if(_0xc0b15){return _0xc0b15[_0xeade('0x23')]()[_0xeade('0x22')](function(){_0x95200d[_0xeade('0x18')](0xcc)[_0xeade('0x24')]();});}};}function handleEntityNotFound(_0x59fa3a,_0x3a60b7){return function(_0x2a9d9b){if(!_0x2a9d9b){_0x59fa3a[_0xeade('0x17')](0x194);}return _0x2a9d9b;};}function handleError(_0x5ed7fd,_0x41cf02){_0x41cf02=_0x41cf02||0x1f4;return function(_0x46145e){logger[_0xeade('0x25')](_0x46145e[_0xeade('0x26')]);if(_0x46145e[_0xeade('0x27')]){delete _0x46145e[_0xeade('0x27')];}_0x5ed7fd[_0xeade('0x18')](_0x41cf02)[_0xeade('0x28')](_0x46145e);};}exports[_0xeade('0x29')]=function(_0x3569ce,_0x1bbdeb){var _0xe55078={},_0x37a55e={},_0x3fbe05={'count':0x0,'rows':[]};var _0x445dac=_[_0xeade('0x2a')](db[_0xeade('0x2b')][_0xeade('0x2c')],function(_0x161f7c){return{'name':_0x161f7c[_0xeade('0x2d')],'type':_0x161f7c[_0xeade('0x2e')][_0xeade('0x2f')]};});_0x37a55e[_0xeade('0x30')]=_['map'](_0x445dac,_0xeade('0x27'));_0x37a55e[_0xeade('0x31')]=_['keys'](_0x3569ce[_0xeade('0x31')]);_0x37a55e[_0xeade('0x32')]=_[_0xeade('0x33')](_0x37a55e['model'],_0x37a55e[_0xeade('0x31')]);_0xe55078[_0xeade('0x34')]=_['intersection'](_0x37a55e[_0xeade('0x30')],qs[_0xeade('0x35')](_0x3569ce[_0xeade('0x31')][_0xeade('0x35')]));_0xe55078[_0xeade('0x34')]=_0xe55078[_0xeade('0x34')][_0xeade('0x36')]?_0xe55078['attributes']:_0x37a55e[_0xeade('0x30')];if(!_0x3569ce[_0xeade('0x31')][_0xeade('0x37')](_0xeade('0x38'))){_0xe55078[_0xeade('0x1b')]=qs[_0xeade('0x1b')](_0x3569ce[_0xeade('0x31')]['limit']);_0xe55078['offset']=qs[_0xeade('0x1d')](_0x3569ce[_0xeade('0x31')][_0xeade('0x1d')]);}_0xe55078[_0xeade('0x39')]=qs[_0xeade('0x3a')](_0x3569ce['query'][_0xeade('0x3a')]);_0xe55078['where']=qs[_0xeade('0x32')](_[_0xeade('0x3b')](_0x3569ce[_0xeade('0x31')],_0x37a55e['filters']),_0x445dac);if(_0x3569ce[_0xeade('0x31')]['filter']){_0xe55078[_0xeade('0x3c')]=_[_0xeade('0x3d')](_0xe55078[_0xeade('0x3c')],{'$or':_[_0xeade('0x2a')](_0x445dac,function(_0x3953bc){if(_0x3953bc['type']!==_0xeade('0x3e')){var _0x347155={};_0x347155[_0x3953bc[_0xeade('0x27')]]={'$like':'%'+_0x3569ce[_0xeade('0x31')]['filter']+'%'};return _0x347155;}})});}_0xe55078=_[_0xeade('0x3d')]({},_0xe55078,_0x3569ce[_0xeade('0x3f')]);var _0x338d06={'where':_0xe55078[_0xeade('0x3c')]};return db['CmHopperBlack'][_0xeade('0x1c')](_0x338d06)['then'](function(_0x3fcd85){_0x3fbe05[_0xeade('0x1c')]=_0x3fcd85;if(_0x3569ce[_0xeade('0x31')][_0xeade('0x40')]){_0xe55078['include']=[{'all':!![]}];}return db[_0xeade('0x2b')][_0xeade('0x41')](_0xe55078);})[_0xeade('0x22')](function(_0x355769){_0x3fbe05[_0xeade('0x42')]=_0x355769;return _0x3fbe05;})[_0xeade('0x22')](respondWithFilteredResult(_0x1bbdeb,_0xe55078))[_0xeade('0x43')](handleError(_0x1bbdeb,null));};exports[_0xeade('0x44')]=function(_0x4b60a4,_0x40c49b){var _0x4a1915={'raw':!![],'where':{'id':_0x4b60a4['params']['id']}},_0x62d4ff={};_0x62d4ff['model']=_[_0xeade('0x45')](db[_0xeade('0x2b')][_0xeade('0x2c')]);_0x62d4ff['query']=_[_0xeade('0x45')](_0x4b60a4[_0xeade('0x31')]);_0x62d4ff[_0xeade('0x32')]=_['intersection'](_0x62d4ff[_0xeade('0x30')],_0x62d4ff[_0xeade('0x31')]);_0x4a1915[_0xeade('0x34')]=_[_0xeade('0x33')](_0x62d4ff['model'],qs[_0xeade('0x35')](_0x4b60a4[_0xeade('0x31')][_0xeade('0x35')]));_0x4a1915[_0xeade('0x34')]=_0x4a1915[_0xeade('0x34')][_0xeade('0x36')]?_0x4a1915[_0xeade('0x34')]:_0x62d4ff[_0xeade('0x30')];if(_0x4b60a4[_0xeade('0x31')][_0xeade('0x40')]){_0x4a1915[_0xeade('0x46')]=[{'all':!![]}];}_0x4a1915=_[_0xeade('0x3d')]({},_0x4a1915,_0x4b60a4[_0xeade('0x3f')]);return db['CmHopperBlack']['find'](_0x4a1915)['then'](handleEntityNotFound(_0x40c49b,null))[_0xeade('0x22')](respondWithResult(_0x40c49b,null))['catch'](handleError(_0x40c49b,null));};exports['update']=function(_0x384be3,_0x14d696){if(_0x384be3['body']['id']){delete _0x384be3[_0xeade('0x47')]['id'];}return db[_0xeade('0x2b')][_0xeade('0x48')]({'where':{'id':_0x384be3[_0xeade('0x49')]['id']}})[_0xeade('0x22')](handleEntityNotFound(_0x14d696,null))[_0xeade('0x22')](saveUpdates(_0x384be3['body'],null))[_0xeade('0x22')](respondWithResult(_0x14d696,null))[_0xeade('0x43')](handleError(_0x14d696,null));};exports['destroy']=function(_0x50b683,_0x2d65b1){return db[_0xeade('0x2b')][_0xeade('0x48')]({'where':{'id':_0x50b683[_0xeade('0x49')]['id']}})[_0xeade('0x22')](handleEntityNotFound(_0x2d65b1,null))[_0xeade('0x22')](removeEntity(_0x2d65b1,null))[_0xeade('0x43')](handleError(_0x2d65b1,null));};exports[_0xeade('0x4a')]=function(_0x417505,_0x10fb71){return db[_0xeade('0x2b')][_0xeade('0x4a')]()['then'](respondWithResult(_0x10fb71,null))[_0xeade('0x43')](handleError(_0x10fb71,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index f569dbf..b3c425d 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 _0xf685=['CmHopperBlack','cm_hopper_black','api','request-promise','rimraf','../../config/environment','define'];(function(_0x27b76d,_0x5a9a00){var _0x5e98a9=function(_0x3e8963){while(--_0x3e8963){_0x27b76d['push'](_0x27b76d['shift']());}};_0x5e98a9(++_0x5a9a00);}(_0xf685,0x175));var _0x5f68=function(_0x3da50d,_0xd88a77){_0x3da50d=_0x3da50d-0x0;var _0x932729=_0xf685[_0x3da50d];return _0x932729;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5f68('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5f68('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f68('0x2'));var config=require(_0x5f68('0x3'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x30cd86,_0x31c4e5){return _0x30cd86[_0x5f68('0x4')](_0x5f68('0x5'),attributes,{'tableName':_0x5f68('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a63=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black'];(function(_0x410cc5,_0x54eb36){var _0xe64a6c=function(_0x186f6d){while(--_0x186f6d){_0x410cc5['push'](_0x410cc5['shift']());}};_0xe64a6c(++_0x54eb36);}(_0x3a63,0xd0));var _0x33a6=function(_0xf89c3,_0x351bf1){_0xf89c3=_0xf89c3-0x0;var _0x274fc8=_0x3a63[_0xf89c3];return _0x274fc8;};'use strict';var _=require(_0x33a6('0x0'));var util=require(_0x33a6('0x1'));var logger=require(_0x33a6('0x2'))(_0x33a6('0x3'));var moment=require('moment');var BPromise=require(_0x33a6('0x4'));var rp=require(_0x33a6('0x5'));var fs=require('fs');var path=require(_0x33a6('0x6'));var rimraf=require(_0x33a6('0x7'));var config=require('../../config/environment');var attributes=require(_0x33a6('0x8'));module[_0x33a6('0x9')]=function(_0x960fba,_0x391681){return _0x960fba[_0x33a6('0xa')](_0x33a6('0xb'),attributes,{'tableName':_0x33a6('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 2ed9e85..15dca02 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 _0x35ac=['catch','UpdateCmHopperBlack','update','raw','where','DestroyCmHopperBlack','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','limit','map','model','include','attributes'];(function(_0x581b56,_0xea0f7a){var _0x5647c6=function(_0x431705){while(--_0x431705){_0x581b56['push'](_0x581b56['shift']());}};_0x5647c6(++_0xea0f7a);}(_0x35ac,0x109));var _0xc35a=function(_0x10720e,_0x325703){_0x10720e=_0x10720e-0x0;var _0x447e7a=_0x35ac[_0x10720e];return _0x447e7a;};'use strict';var _=require(_0xc35a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc35a('0x1'));var rs=require(_0xc35a('0x2'));var fs=require('fs');var Redis=require(_0xc35a('0x3'));var db=require(_0xc35a('0x4'))['db'];var utils=require(_0xc35a('0x5'));var logger=require(_0xc35a('0x6'))(_0xc35a('0x7'));var config=require(_0xc35a('0x8'));var jayson=require(_0xc35a('0x9'));var client=jayson['client'][_0xc35a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ba87,_0x1a4b26,_0x35356a){return new BPromise(function(_0x5f5c66,_0x49cf7b){return client[_0xc35a('0xb')](_0x5ba87,_0x35356a)[_0xc35a('0xc')](function(_0x129e48){logger[_0xc35a('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x1a4b26,'request\x20sent');logger[_0xc35a('0xe')](_0xc35a('0xf'),_0x1a4b26,_0xc35a('0x10'),JSON[_0xc35a('0x11')](_0x129e48));if(_0x129e48[_0xc35a('0x12')]){if(_0x129e48[_0xc35a('0x12')]['code']===0x1f4){logger['error'](_0xc35a('0x13'),_0x1a4b26,_0x129e48[_0xc35a('0x12')][_0xc35a('0x14')]);return _0x49cf7b(_0x129e48[_0xc35a('0x12')][_0xc35a('0x14')]);}logger[_0xc35a('0x12')](_0xc35a('0x13'),_0x1a4b26,_0x129e48[_0xc35a('0x12')]['message']);return _0x5f5c66(_0x129e48[_0xc35a('0x12')][_0xc35a('0x14')]);}else{logger['info'](_0xc35a('0x13'),_0x1a4b26,_0xc35a('0x10'));_0x5f5c66(_0x129e48[_0xc35a('0x15')][_0xc35a('0x14')]);}})['catch'](function(_0x27ff55){logger[_0xc35a('0x12')](_0xc35a('0x13'),_0x1a4b26,_0x27ff55);_0x49cf7b(_0x27ff55);});});}exports[_0xc35a('0x16')]=function(_0x1d03f7){var _0x521f7c=this;return new Promise(function(_0x2da213,_0x4bd32d){return db[_0xc35a('0x17')][_0xc35a('0x18')]({'raw':_0x1d03f7['options']?_0x1d03f7[_0xc35a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1d03f7['options']?_0x1d03f7[_0xc35a('0x19')]['where']||null:null,'attributes':_0x1d03f7['options']?_0x1d03f7['options']['attributes']||null:null,'limit':_0x1d03f7[_0xc35a('0x19')]?_0x1d03f7[_0xc35a('0x19')][_0xc35a('0x1a')]||null:null,'include':_0x1d03f7[_0xc35a('0x19')]?_0x1d03f7[_0xc35a('0x19')]['include']?_[_0xc35a('0x1b')](_0x1d03f7['options']['include'],function(_0x9ee13f){return{'model':db[_0x9ee13f[_0xc35a('0x1c')]],'as':_0x9ee13f['as'],'attributes':_0x9ee13f['attributes'],'include':_0x9ee13f[_0xc35a('0x1d')]?_[_0xc35a('0x1b')](_0x9ee13f['include'],function(_0x19a780){return{'model':db[_0x19a780[_0xc35a('0x1c')]],'as':_0x19a780['as'],'attributes':_0x19a780[_0xc35a('0x1e')],'include':_0x19a780[_0xc35a('0x1d')]?_[_0xc35a('0x1b')](_0x19a780[_0xc35a('0x1d')],function(_0xea4c0e){return{'model':db[_0xea4c0e[_0xc35a('0x1c')]],'as':_0xea4c0e['as'],'attributes':_0xea4c0e[_0xc35a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc35a('0xc')](function(_0x26f513){logger[_0xc35a('0xd')](_0xc35a('0x16'),_0x1d03f7);logger[_0xc35a('0xe')](_0xc35a('0x16'),_0x1d03f7,JSON[_0xc35a('0x11')](_0x26f513));_0x2da213(_0x26f513);})[_0xc35a('0x1f')](function(_0x54d3aa){logger[_0xc35a('0x12')](_0xc35a('0x16'),_0x54d3aa[_0xc35a('0x14')],_0x1d03f7);_0x4bd32d(_0x521f7c[_0xc35a('0x12')](0x1f4,_0x54d3aa[_0xc35a('0x14')]));});});};exports[_0xc35a('0x20')]=function(_0x2eaae1){var _0xb1a27b=this;return new Promise(function(_0x46d313,_0x493173){return db['CmHopperBlack'][_0xc35a('0x21')](_0x2eaae1['body'],{'raw':_0x2eaae1['options']?_0x2eaae1[_0xc35a('0x19')][_0xc35a('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2eaae1['options']?_0x2eaae1[_0xc35a('0x19')][_0xc35a('0x23')]||null:null,'attributes':_0x2eaae1['options']?_0x2eaae1[_0xc35a('0x19')][_0xc35a('0x1e')]||null:null,'limit':_0x2eaae1[_0xc35a('0x19')]?_0x2eaae1['options']['limit']||null:null})[_0xc35a('0xc')](function(_0x29e51c){logger[_0xc35a('0xd')](_0xc35a('0x20'),_0x2eaae1);logger['debug'](_0xc35a('0x20'),_0x2eaae1,JSON['stringify'](_0x29e51c));_0x46d313(_0x29e51c);})['catch'](function(_0x5c0f18){logger[_0xc35a('0x12')](_0xc35a('0x20'),_0x5c0f18[_0xc35a('0x14')],_0x2eaae1);_0x493173(_0xb1a27b[_0xc35a('0x12')](0x1f4,_0x5c0f18[_0xc35a('0x14')]));});});};exports[_0xc35a('0x24')]=function(_0x50f912){var _0x508918=this;return new Promise(function(_0x229596,_0x328be3){return db[_0xc35a('0x17')]['destroy']({'where':_0x50f912['options']?_0x50f912[_0xc35a('0x19')][_0xc35a('0x23')]||null:null})[_0xc35a('0xc')](function(_0x149a25){logger[_0xc35a('0xd')](_0xc35a('0x24'),_0x50f912);logger[_0xc35a('0xe')](_0xc35a('0x24'),_0x50f912,JSON[_0xc35a('0x11')](_0x149a25));_0x229596(_0x149a25);})[_0xc35a('0x1f')](function(_0x303050){logger[_0xc35a('0x12')]('DestroyCmHopperBlack',_0x303050[_0xc35a('0x14')],_0x50f912);_0x328be3(_0x508918[_0xc35a('0x12')](0x1f4,_0x303050[_0xc35a('0x14')]));});});}; \ No newline at end of file +var _0x964c=['client','http','request','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CmHopperBlack','findAll','raw','options','where','attributes','include','model','then','GetCmHopperBlack','debug','UpdateCmHopperBlack','update','body','limit','destroy','DestroyCmHopperBlack','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x6dd57,_0x8ad656){var _0x2e93ca=function(_0x2dbc71){while(--_0x2dbc71){_0x6dd57['push'](_0x6dd57['shift']());}};_0x2e93ca(++_0x8ad656);}(_0x964c,0xfb));var _0xc964=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x964c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc964('0x0'));var moment=require(_0xc964('0x1'));var BPromise=require('bluebird');var rs=require(_0xc964('0x2'));var fs=require('fs');var Redis=require(_0xc964('0x3'));var db=require(_0xc964('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc964('0x5'))(_0xc964('0x6'));var config=require('../../config/environment');var jayson=require(_0xc964('0x7'));var client=jayson[_0xc964('0x8')][_0xc964('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3eb3fa,_0x3534b5,_0x3ea8ac){return new BPromise(function(_0x297625,_0xf41306){return client[_0xc964('0xa')](_0x3eb3fa,_0x3ea8ac)['then'](function(_0x2e972d){logger['info'](_0xc964('0xb'),_0x3534b5,_0xc964('0xc'));logger['debug'](_0xc964('0xd'),_0x3534b5,'request\x20sent',JSON[_0xc964('0xe')](_0x2e972d));if(_0x2e972d[_0xc964('0xf')]){if(_0x2e972d['error']['code']===0x1f4){logger[_0xc964('0xf')](_0xc964('0xb'),_0x3534b5,_0x2e972d['error']['message']);return _0xf41306(_0x2e972d['error'][_0xc964('0x10')]);}logger[_0xc964('0xf')](_0xc964('0xb'),_0x3534b5,_0x2e972d[_0xc964('0xf')][_0xc964('0x10')]);return _0x297625(_0x2e972d[_0xc964('0xf')][_0xc964('0x10')]);}else{logger[_0xc964('0x11')](_0xc964('0xb'),_0x3534b5,'request\x20sent');_0x297625(_0x2e972d[_0xc964('0x12')][_0xc964('0x10')]);}})[_0xc964('0x13')](function(_0x4c318c){logger[_0xc964('0xf')](_0xc964('0xb'),_0x3534b5,_0x4c318c);_0xf41306(_0x4c318c);});});}exports['GetCmHopperBlack']=function(_0x3705ce){var _0x1ce70e=this;return new Promise(function(_0x305182,_0x30cd06){return db[_0xc964('0x14')][_0xc964('0x15')]({'raw':_0x3705ce['options']?_0x3705ce['options'][_0xc964('0x16')]===undefined?!![]:![]:!![],'where':_0x3705ce[_0xc964('0x17')]?_0x3705ce['options'][_0xc964('0x18')]||null:null,'attributes':_0x3705ce[_0xc964('0x17')]?_0x3705ce['options'][_0xc964('0x19')]||null:null,'limit':_0x3705ce[_0xc964('0x17')]?_0x3705ce[_0xc964('0x17')]['limit']||null:null,'include':_0x3705ce['options']?_0x3705ce[_0xc964('0x17')][_0xc964('0x1a')]?_['map'](_0x3705ce[_0xc964('0x17')][_0xc964('0x1a')],function(_0xee1dbc){return{'model':db[_0xee1dbc[_0xc964('0x1b')]],'as':_0xee1dbc['as'],'attributes':_0xee1dbc[_0xc964('0x19')],'include':_0xee1dbc['include']?_['map'](_0xee1dbc[_0xc964('0x1a')],function(_0x32a770){return{'model':db[_0x32a770['model']],'as':_0x32a770['as'],'attributes':_0x32a770[_0xc964('0x19')],'include':_0x32a770[_0xc964('0x1a')]?_['map'](_0x32a770[_0xc964('0x1a')],function(_0x55ac8c){return{'model':db[_0x55ac8c[_0xc964('0x1b')]],'as':_0x55ac8c['as'],'attributes':_0x55ac8c[_0xc964('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc964('0x1c')](function(_0x58a310){logger['info'](_0xc964('0x1d'),_0x3705ce);logger[_0xc964('0x1e')](_0xc964('0x1d'),_0x3705ce,JSON['stringify'](_0x58a310));_0x305182(_0x58a310);})[_0xc964('0x13')](function(_0x56c36d){logger[_0xc964('0xf')](_0xc964('0x1d'),_0x56c36d[_0xc964('0x10')],_0x3705ce);_0x30cd06(_0x1ce70e['error'](0x1f4,_0x56c36d[_0xc964('0x10')]));});});};exports[_0xc964('0x1f')]=function(_0x5c25df){var _0x385057=this;return new Promise(function(_0x5e7ef3,_0x15e06b){return db[_0xc964('0x14')][_0xc964('0x20')](_0x5c25df[_0xc964('0x21')],{'raw':_0x5c25df[_0xc964('0x17')]?_0x5c25df['options'][_0xc964('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c25df['options']?_0x5c25df[_0xc964('0x17')][_0xc964('0x18')]||null:null,'attributes':_0x5c25df[_0xc964('0x17')]?_0x5c25df[_0xc964('0x17')][_0xc964('0x19')]||null:null,'limit':_0x5c25df[_0xc964('0x17')]?_0x5c25df[_0xc964('0x17')][_0xc964('0x22')]||null:null})[_0xc964('0x1c')](function(_0x1409ef){logger[_0xc964('0x11')](_0xc964('0x1f'),_0x5c25df);logger[_0xc964('0x1e')](_0xc964('0x1f'),_0x5c25df,JSON[_0xc964('0xe')](_0x1409ef));_0x5e7ef3(_0x1409ef);})['catch'](function(_0xfe0c4a){logger[_0xc964('0xf')](_0xc964('0x1f'),_0xfe0c4a[_0xc964('0x10')],_0x5c25df);_0x15e06b(_0x385057['error'](0x1f4,_0xfe0c4a[_0xc964('0x10')]));});});};exports['DestroyCmHopperBlack']=function(_0x3e3620){var _0x1eb5cb=this;return new Promise(function(_0x49e90a,_0x1b927f){return db[_0xc964('0x14')][_0xc964('0x23')]({'where':_0x3e3620[_0xc964('0x17')]?_0x3e3620[_0xc964('0x17')][_0xc964('0x18')]||null:null})[_0xc964('0x1c')](function(_0x3d9f1e){logger[_0xc964('0x11')](_0xc964('0x24'),_0x3e3620);logger['debug'](_0xc964('0x24'),_0x3e3620,JSON[_0xc964('0xe')](_0x3d9f1e));_0x49e90a(_0x3d9f1e);})['catch'](function(_0x22250f){logger['error'](_0xc964('0x24'),_0x22250f[_0xc964('0x10')],_0x3e3620);_0x1b927f(_0x1eb5cb[_0xc964('0xf')](0x1f4,_0x22250f['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index d2dbb70..05a930e 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 _0x33af=['isAuthenticated','describe','show','put','/:id','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','index','/describe'];(function(_0x4ee261,_0x314cde){var _0x4b6722=function(_0x465e29){while(--_0x465e29){_0x4ee261['push'](_0x4ee261['shift']());}};_0x4b6722(++_0x314cde);}(_0x33af,0xec));var _0xf33a=function(_0x2fad8a,_0x26de69){_0x2fad8a=_0x2fad8a-0x0;var _0x494d7d=_0x33af[_0x2fad8a];return _0x494d7d;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var fs_extra=require(_0xf33a('0x4'));var auth=require(_0xf33a('0x5'));var interaction=require(_0xf33a('0x6'));var config=require('../../config/environment');var controller=require(_0xf33a('0x7'));router[_0xf33a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33a('0x9')]);router[_0xf33a('0x8')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xc')]);router[_0xf33a('0x8')]('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0xd')]);router[_0xf33a('0xe')](_0xf33a('0xf'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x10')]);router['delete']('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0x11')]);module[_0xf33a('0x12')]=router; \ No newline at end of file +var _0x1261=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','index','get','isAuthenticated','describe','/:id','put','delete','destroy'];(function(_0x49ac70,_0x3af65c){var _0x44802e=function(_0x20b60b){while(--_0x20b60b){_0x49ac70['push'](_0x49ac70['shift']());}};_0x44802e(++_0x3af65c);}(_0x1261,0x144));var _0x1126=function(_0x28ef4e,_0x202aa3){_0x28ef4e=_0x28ef4e-0x0;var _0x1aa097=_0x1261[_0x28ef4e];return _0x1aa097;};'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')]('/describe',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['show']);router[_0x1126('0xf')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['update']);router[_0x1126('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1126('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 8b1dbe4..d19396a 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 _0x2177=['INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','moment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2177,0xaf));var _0x7217=function(_0x234e1a,_0x500d79){_0x234e1a=_0x234e1a-0x0;var _0x55aad2=_0x2177[_0x234e1a];return _0x55aad2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7217('0x0'));module['exports']={'state':{'type':Sequelize[_0x7217('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x7217('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7217('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x7217('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7217('0x2')]},'calleridname':{'type':Sequelize[_0x7217('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x7217('0x3')]},'answertime':{'type':Sequelize[_0x7217('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x7217('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7217('0x2')]},'campaign':{'type':Sequelize[_0x7217('0x2')]},'campaigntype':{'type':Sequelize[_0x7217('0x2')]},'membername':{'type':Sequelize[_0x7217('0x2')]},'reason':{'type':Sequelize[_0x7217('0x2')]},'disposition':{'type':Sequelize[_0x7217('0x2')]},'secondDisposition':{'type':Sequelize[_0x7217('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7217('0x2')]},'dispositionat':{'type':Sequelize[_0x7217('0x3')],'set':function(_0x36b142){var _0x338931=this[_0x7217('0x4')](_0x7217('0x5'));if(_0x338931&&_0x36b142){this[_0x7217('0x6')](_0x7217('0x7'),moment(_0x36b142)[_0x7217('0x8')](moment(_0x338931),_0x7217('0x9')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x7217('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x7217('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x7217('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x7217('0x3')]},'callback':{'type':Sequelize[_0x7217('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7217('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7217('0x3')]},'deleted':{'type':Sequelize[_0x7217('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x7217('0x3')]},'recallme':{'type':Sequelize[_0x7217('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x7217('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7217('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9b07=['setDataValue','BOOLEAN','sequelize','moment','exports','DATE','INTEGER','STRING','endtime'];(function(_0x36544f,_0x143f97){var _0x3bf8a4=function(_0x19c537){while(--_0x19c537){_0x36544f['push'](_0x36544f['shift']());}};_0x3bf8a4(++_0x143f97);}(_0x9b07,0x9b));var _0x79b0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9b07[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x79b0('0x0'));var moment=require(_0x79b0('0x1'));module[_0x79b0('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x79b0('0x3')]},'countbusyretry':{'type':Sequelize[_0x79b0('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x79b0('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x79b0('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x79b0('0x5')]},'originatecalleridnum':{'type':Sequelize[_0x79b0('0x5')]},'originatecalleridname':{'type':Sequelize[_0x79b0('0x5')]},'calleridnum':{'type':Sequelize[_0x79b0('0x5')]},'calleridname':{'type':Sequelize[_0x79b0('0x5')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x79b0('0x3')]},'answertime':{'type':Sequelize[_0x79b0('0x3')]},'droptime':{'type':Sequelize[_0x79b0('0x3')]},'endtime':{'type':Sequelize[_0x79b0('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x79b0('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x79b0('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x79b0('0x5')]},'campaign':{'type':Sequelize[_0x79b0('0x5')]},'campaigntype':{'type':Sequelize[_0x79b0('0x5')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x79b0('0x5')]},'disposition':{'type':Sequelize[_0x79b0('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x79b0('0x5')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x54d06c){var _0x287e72=this['getDataValue'](_0x79b0('0x6'));if(_0x287e72&&_0x54d06c){this[_0x79b0('0x7')]('followuptime',moment(_0x54d06c)['diff'](moment(_0x287e72),'seconds'));}}},'amd':{'type':Sequelize[_0x79b0('0x8')],'defaultValue':![]},'fax':{'type':Sequelize[_0x79b0('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x79b0('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x79b0('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x79b0('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x79b0('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x79b0('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x79b0('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x79b0('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x79b0('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x79b0('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x79b0('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x79b0('0x4')],'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 89d9e9d..49eea05 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 _0x53ec=['ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','name','send','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','show','params','include','find','catch','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`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','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','noSuchContacts','`state`\x20=\x203,\x201,\x20null','dropContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','phone','ContactId','VoiceQueueId','updatedAt','select','ANY_VALUE(calleridnum)','scheduledAt','field','ListId','ANY_VALUE(VoiceQueueId)','NOW()','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(ContactId)'];(function(_0x5c8f47,_0x4fa861){var _0x53a878=function(_0x2b803c){while(--_0x2b803c){_0x5c8f47['push'](_0x5c8f47['shift']());}};_0x53a878(++_0x4fa861);}(_0x53ec,0x192));var _0xc53e=function(_0x16fa8d,_0x3a1ca5){_0x16fa8d=_0x16fa8d-0x0;var _0x1948d8=_0x53ec[_0x16fa8d];return _0x1948d8;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];function respondWithStatusCode(_0x863fa,_0x4203aa){_0x4203aa=_0x4203aa||0xcc;return function(_0x56f0e5){if(_0x56f0e5){return _0x863fa['sendStatus'](_0x4203aa);}return _0x863fa[_0xc53e('0x18')](_0x4203aa)[_0xc53e('0x19')]();};}function respondWithResult(_0x7cd798,_0x3d2e17){_0x3d2e17=_0x3d2e17||0xc8;return function(_0x358ef3){if(_0x358ef3){return _0x7cd798[_0xc53e('0x18')](_0x3d2e17)[_0xc53e('0x1a')](_0x358ef3);}};}function respondWithFilteredResult(_0x19c0d1,_0x455e4d){return function(_0x2ad6eb){if(_0x2ad6eb){var _0x5b0a88=typeof _0x455e4d[_0xc53e('0x1b')]===_0xc53e('0x1c')&&typeof _0x455e4d[_0xc53e('0x1d')]===_0xc53e('0x1c');var _0x15333b=_0x2ad6eb[_0xc53e('0x1e')];var _0x164016=_0x5b0a88?0x0:_0x455e4d[_0xc53e('0x1b')];var _0x3b550e=_0x5b0a88?_0x2ad6eb['count']:_0x455e4d['offset']+_0x455e4d[_0xc53e('0x1d')];var _0x2a5bac;if(_0x3b550e>=_0x15333b){_0x3b550e=_0x15333b;_0x2a5bac=0xc8;}else{_0x2a5bac=0xce;}_0x19c0d1[_0xc53e('0x18')](_0x2a5bac);return _0x19c0d1[_0xc53e('0x1f')](_0xc53e('0x20'),_0x164016+'-'+_0x3b550e+'/'+_0x15333b)[_0xc53e('0x1a')](_0x2ad6eb);}return null;};}function patchUpdates(_0x15a015){return function(_0x25702b){try{jsonpatch[_0xc53e('0x21')](_0x25702b,_0x15a015,!![]);}catch(_0x401af6){return BPromise[_0xc53e('0x22')](_0x401af6);}return _0x25702b[_0xc53e('0x23')]();};}function saveUpdates(_0x426467,_0x4fb695){return function(_0x47cfdd){if(_0x47cfdd){return _0x47cfdd['update'](_0x426467)[_0xc53e('0x24')](function(_0x384218){return _0x384218;});}return null;};}function removeEntity(_0x7591c1,_0x4015c8){return function(_0x180811){if(_0x180811){return _0x180811['destroy']()['then'](function(){_0x7591c1[_0xc53e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae55e,_0x3a5ce8){return function(_0x443179){if(!_0x443179){_0x1ae55e[_0xc53e('0x25')](0x194);}return _0x443179;};}function handleError(_0x63c5dc,_0x4df8cf){_0x4df8cf=_0x4df8cf||0x1f4;return function(_0x398e7a){logger['error'](_0x398e7a['stack']);if(_0x398e7a['name']){delete _0x398e7a[_0xc53e('0x26')];}_0x63c5dc['status'](_0x4df8cf)[_0xc53e('0x27')](_0x398e7a);};}exports['index']=function(_0x24a77e,_0x5112d2){var _0x5ce216={},_0x8f0ee6={},_0x6a62b0={'count':0x0,'rows':[]};var _0x42dec1=_[_0xc53e('0x28')](db[_0xc53e('0x29')][_0xc53e('0x2a')],function(_0x3280fe){return{'name':_0x3280fe[_0xc53e('0x2b')],'type':_0x3280fe['type'][_0xc53e('0x2c')]};});_0x8f0ee6[_0xc53e('0x2d')]=_[_0xc53e('0x28')](_0x42dec1,'name');_0x8f0ee6[_0xc53e('0x2e')]=_['keys'](_0x24a77e[_0xc53e('0x2e')]);_0x8f0ee6[_0xc53e('0x2f')]=_['intersection'](_0x8f0ee6['model'],_0x8f0ee6[_0xc53e('0x2e')]);_0x5ce216[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x8f0ee6[_0xc53e('0x2d')],qs[_0xc53e('0x32')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x5ce216[_0xc53e('0x30')]=_0x5ce216['attributes'][_0xc53e('0x33')]?_0x5ce216[_0xc53e('0x30')]:_0x8f0ee6[_0xc53e('0x2d')];if(!_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x34')](_0xc53e('0x35'))){_0x5ce216[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x24a77e[_0xc53e('0x2e')]['limit']);_0x5ce216[_0xc53e('0x1b')]=qs['offset'](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x1b')]);}_0x5ce216['order']=qs[_0xc53e('0x36')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x36')]);_0x5ce216['where']=qs[_0xc53e('0x2f')](_[_0xc53e('0x37')](_0x24a77e[_0xc53e('0x2e')],_0x8f0ee6[_0xc53e('0x2f')]),_0x42dec1);if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]){_0x5ce216[_0xc53e('0x39')]=_['merge'](_0x5ce216[_0xc53e('0x39')],{'$or':_[_0xc53e('0x28')](_0x42dec1,function(_0x2db711){if(_0x2db711['type']!==_0xc53e('0x3a')){var _0x5e8ab7={};_0x5e8ab7[_0x2db711[_0xc53e('0x26')]]={'$like':'%'+_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]+'%'};return _0x5e8ab7;}})});}_0x5ce216=_[_0xc53e('0x3b')]({},_0x5ce216,_0x24a77e[_0xc53e('0x3c')]);var _0x5507d0={'where':_0x5ce216[_0xc53e('0x39')]};return db[_0xc53e('0x29')]['count'](_0x5507d0)['then'](function(_0x5e9e15){_0x6a62b0['count']=_0x5e9e15;if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x5ce216['include']=[{'all':!![]}];}return db[_0xc53e('0x29')]['findAll'](_0x5ce216);})['then'](function(_0x53447e){_0x6a62b0[_0xc53e('0x3e')]=_0x53447e;return _0x6a62b0;})['then'](respondWithFilteredResult(_0x5112d2,_0x5ce216))['catch'](handleError(_0x5112d2,null));};exports[_0xc53e('0x3f')]=function(_0x53a82f,_0x422088){var _0x360af9={'raw':!![],'where':{'id':_0x53a82f[_0xc53e('0x40')]['id']}},_0x49f204={};_0x49f204[_0xc53e('0x2d')]=_['keys'](db[_0xc53e('0x29')]['rawAttributes']);_0x49f204['query']=_['keys'](_0x53a82f['query']);_0x49f204[_0xc53e('0x2f')]=_[_0xc53e('0x31')](_0x49f204[_0xc53e('0x2d')],_0x49f204['query']);_0x360af9[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x49f204['model'],qs['fields'](_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x360af9[_0xc53e('0x30')]=_0x360af9['attributes'][_0xc53e('0x33')]?_0x360af9[_0xc53e('0x30')]:_0x49f204[_0xc53e('0x2d')];if(_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x360af9[_0xc53e('0x41')]=[{'all':!![]}];}_0x360af9=_[_0xc53e('0x3b')]({},_0x360af9,_0x53a82f['options']);return db[_0xc53e('0x29')][_0xc53e('0x42')](_0x360af9)[_0xc53e('0x24')](handleEntityNotFound(_0x422088,null))['then'](respondWithResult(_0x422088,null))[_0xc53e('0x43')](handleError(_0x422088,null));};exports[_0xc53e('0x44')]=function(_0x4458c8,_0x15e744){return db[_0xc53e('0x29')][_0xc53e('0x44')]()['then'](respondWithResult(_0x15e744,null))[_0xc53e('0x43')](handleError(_0x15e744,null));};exports[_0xc53e('0x45')]=function(_0x39feea,_0x5a6e41){if(_0x39feea[_0xc53e('0x46')][_0xc53e('0x47')]){delete _0x39feea[_0xc53e('0x46')][_0xc53e('0x47')];}return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'uniqueid':_0x39feea[_0xc53e('0x40')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x5a6e41,null))[_0xc53e('0x24')](saveUpdates(_0x39feea[_0xc53e('0x46')],null))['then'](respondWithResult(_0x5a6e41,null))[_0xc53e('0x43')](handleError(_0x5a6e41,null));};exports[_0xc53e('0x48')]=function(_0x38520c,_0x3d74ac,_0x136544){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x38520c[_0xc53e('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x4c')))),'noSuchContacts'],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db['sequelize'][_0xc53e('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0xc53e('0x4d')],[db[_0xc53e('0x4a')]['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')]['literal'](_0xc53e('0x4e')))),_0xc53e('0x4f')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x50')))),_0xc53e('0x51')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')]['literal'](_0xc53e('0x52')))),'dropContacts'],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x53')))),_0xc53e('0x54')],[db['sequelize']['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db['sequelize']['literal'](_0xc53e('0x55')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db['sequelize'][_0xc53e('0x4b')]('`state`\x20=\x2019,\x201,\x20null'))),_0xc53e('0x56')]]})[_0xc53e('0x24')](handleEntityNotFound(_0x3d74ac,null))[_0xc53e('0x24')](respondWithResult(_0x3d74ac,null))[_0xc53e('0x43')](handleError(_0x3d74ac,null));};exports[_0xc53e('0x57')]=function(_0x4caf5f,_0x55e068,_0x4655b7){return db[_0xc53e('0x29')][_0xc53e('0x58')]({'raw':![],'where':{'CampaignId':_0x4caf5f[_0xc53e('0x40')]['id']},'attributes':[[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x4c')))),_0xc53e('0x59')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')]['literal'](_0xc53e('0x5a')))),_0xc53e('0x4d')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x4e')))),'busyContacts'],[db['sequelize']['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x50')))),_0xc53e('0x51')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xc53e('0x52')))),_0xc53e('0x5b')],[db['sequelize']['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x53')))),_0xc53e('0x54')],[db['sequelize']['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x55')))),_0xc53e('0x5c')],[db[_0xc53e('0x4a')]['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x5d')))),'answeringMachine']]})[_0xc53e('0x24')](handleEntityNotFound(_0x55e068,null))[_0xc53e('0x24')](respondWithResult(_0x55e068,null))[_0xc53e('0x43')](handleError(_0x55e068,null));};exports[_0xc53e('0x5e')]=function(_0x32f954,_0x2d9803,_0x51638a){return db[_0xc53e('0x5f')][_0xc53e('0x42')]({'where':{'id':_0x32f954[_0xc53e('0x40')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x2d9803,null))['then'](function(_0x5e1f4a){var _0x57edb;if(_0x5e1f4a){_0x57edb=squel[_0xc53e('0x60')]()[_0xc53e('0x61')](_0xc53e('0x62'))['fromQuery']([_0xc53e('0x63'),'scheduledAt',_0xc53e('0x64'),'ListId',_0xc53e('0x65'),'createdAt',_0xc53e('0x66')],squel[_0xc53e('0x67')]()['field'](_0xc53e('0x68'),_0xc53e('0x63'))['field']('NOW()',_0xc53e('0x69'))[_0xc53e('0x6a')]('ANY_VALUE(ContactId)','ContactId')[_0xc53e('0x6a')]('ANY_VALUE(ListId)',_0xc53e('0x6b'))['field'](_0xc53e('0x6c'),_0xc53e('0x65'))[_0xc53e('0x6a')](_0xc53e('0x6d'),_0xc53e('0x6e'))[_0xc53e('0x6a')](_0xc53e('0x6d'),_0xc53e('0x66'))[_0xc53e('0x6f')](_0xc53e('0x70'))['where'](_0xc53e('0x71'),_0x32f954['params']['id'][_0xc53e('0x72')]())[_0xc53e('0x39')](_0xc53e('0x73'),_0x32f954[_0xc53e('0x46')][_0xc53e('0x74')][_0xc53e('0x72')]())[_0xc53e('0x39')](_0xc53e('0x75'))[_0xc53e('0x39')](_0xc53e('0x76'),squel['select']()[_0xc53e('0x6a')]('phone')[_0xc53e('0x6f')](_0xc53e('0x62'))[_0xc53e('0x39')]('VoiceQueueId\x20=\x20?',_0x32f954[_0xc53e('0x40')]['id'][_0xc53e('0x72')]()))[_0xc53e('0x39')](_0xc53e('0x76'),squel[_0xc53e('0x67')]()['field'](_0xc53e('0x77'))[_0xc53e('0x6f')]('cm_hopper_final')[_0xc53e('0x39')](_0xc53e('0x71'),_0x32f954[_0xc53e('0x40')]['id']['toString']())[_0xc53e('0x39')](_0xc53e('0x78')))['group'](_0xc53e('0x64')))[_0xc53e('0x72')]();return db['sequelize']['query'](_0x57edb);}return[];})[_0xc53e('0x24')](respondWithResult(_0x2d9803,null))['catch'](handleError(_0x2d9803,null));};exports[_0xc53e('0x79')]=function(_0x3d2636,_0x263d97,_0x58684c){return db[_0xc53e('0x7a')][_0xc53e('0x42')]({'where':{'id':_0x3d2636[_0xc53e('0x40')]['id']}})['then'](handleEntityNotFound(_0x263d97,null))[_0xc53e('0x24')](function(_0x2e048a){var _0x1c24e6;if(_0x2e048a){_0x1c24e6=squel[_0xc53e('0x60')]()[_0xc53e('0x61')]('cm_hopper')[_0xc53e('0x7b')]([_0xc53e('0x63'),_0xc53e('0x69'),_0xc53e('0x64'),_0xc53e('0x6b'),_0xc53e('0x7c'),_0xc53e('0x6e'),_0xc53e('0x66')],squel[_0xc53e('0x67')]()['field'](_0xc53e('0x68'),_0xc53e('0x63'))[_0xc53e('0x6a')](_0xc53e('0x6d'),_0xc53e('0x69'))[_0xc53e('0x6a')](_0xc53e('0x7d'),_0xc53e('0x64'))[_0xc53e('0x6a')]('ANY_VALUE(ListId)',_0xc53e('0x6b'))[_0xc53e('0x6a')](_0xc53e('0x7e'),_0xc53e('0x7c'))['field'](_0xc53e('0x6d'),_0xc53e('0x6e'))[_0xc53e('0x6a')](_0xc53e('0x6d'),'updatedAt')[_0xc53e('0x6f')](_0xc53e('0x70'))[_0xc53e('0x39')](_0xc53e('0x7f'),_0x3d2636[_0xc53e('0x40')]['id'][_0xc53e('0x72')]())[_0xc53e('0x39')]('state\x20=\x20?',_0x3d2636[_0xc53e('0x46')]['state'][_0xc53e('0x72')]())[_0xc53e('0x39')](_0xc53e('0x75'))['where'](_0xc53e('0x76'),squel[_0xc53e('0x67')]()[_0xc53e('0x6a')]('phone')[_0xc53e('0x6f')](_0xc53e('0x62'))[_0xc53e('0x39')]('CampaignId\x20=\x20?',_0x3d2636[_0xc53e('0x40')]['id'][_0xc53e('0x72')]()))[_0xc53e('0x39')](_0xc53e('0x76'),squel[_0xc53e('0x67')]()['field']('calleridnum')['from'](_0xc53e('0x70'))[_0xc53e('0x39')](_0xc53e('0x7f'),_0x3d2636[_0xc53e('0x40')]['id']['toString']())[_0xc53e('0x39')]('state\x20=\x204'))[_0xc53e('0x80')](_0xc53e('0x64')))[_0xc53e('0x72')]();return db[_0xc53e('0x4a')]['query'](_0x1c24e6);}return[];})[_0xc53e('0x24')](respondWithResult(_0x263d97,null))[_0xc53e('0x43')](handleError(_0x263d97,null));};exports[_0xc53e('0x81')]=function(_0x352bc6,_0x67be18,_0x306343){return db[_0xc53e('0x82')][_0xc53e('0x83')]({'where':{'VoiceQueueId':_0x352bc6[_0xc53e('0x46')][_0xc53e('0x65')],'CampaignId':_0x352bc6[_0xc53e('0x46')][_0xc53e('0x7c')],'ContactId':_0x352bc6[_0xc53e('0x46')][_0xc53e('0x64')]}})[_0xc53e('0x24')](handleEntityNotFound(_0x67be18,null))[_0xc53e('0x24')](function(_0x3dc1be){if(_0x3dc1be){return _0x3dc1be;}return null;})[_0xc53e('0x24')](respondWithResult(_0x67be18,null))[_0xc53e('0x43')](handleError(_0x67be18,null));}; \ No newline at end of file +var _0xc2c7=['`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','group','moveContactsIvrCampaignHopperFinal','Campaign','ANY_VALUE(calleridnum)','CampaignId','CampaignId\x20=\x20?','calleridnum','state\x20=\x204','checkContactHopper','CmHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','uniqueid','params','body','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal'];(function(_0x31d403,_0xb1ae5f){var _0x1f06ab=function(_0x2a9a5d){while(--_0x2a9a5d){_0x31d403['push'](_0x31d403['shift']());}};_0x1f06ab(++_0xb1ae5f);}(_0xc2c7,0x134));var _0x7c2c=function(_0x21c23b,_0x23cb46){_0x21c23b=_0x21c23b-0x0;var _0x508df0=_0xc2c7[_0x21c23b];return _0x508df0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':!![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['CmHopperFinal'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['describe']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['describe']()['then'](respondWithResult(_0x3091bd,null))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x39d5af,_0x2b79d5){if(_0x39d5af['body']['uniqueid']){delete _0x39d5af['body'][_0x7c2c('0x48')];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'uniqueid':_0x39d5af[_0x7c2c('0x49')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x2b79d5,null))['then'](saveUpdates(_0x39d5af[_0x7c2c('0x4a')],null))[_0x7c2c('0x26')](respondWithResult(_0x2b79d5,null))['catch'](handleError(_0x2b79d5,null));};exports[_0x7c2c('0x4b')]=function(_0x56e09d,_0xfba6a7,_0x3806f4){return db[_0x7c2c('0x2c')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x56e09d['params']['id']},'attributes':[[db[_0x7c2c('0x4c')]['fn']('COUNT',db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x4d')))),_0x7c2c('0x4e')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize'][_0x7c2c('0x50')](_0x7c2c('0x51')))),_0x7c2c('0x52')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x7c2c('0x53')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize'][_0x7c2c('0x50')](_0x7c2c('0x54')))),'congestionContacts'],[db[_0x7c2c('0x4c')]['fn']('COUNT',db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x55')))),_0x7c2c('0x56')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7c2c('0x57')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x58')))),_0x7c2c('0x59')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x7c2c('0x26')](handleEntityNotFound(_0xfba6a7,null))[_0x7c2c('0x26')](respondWithResult(_0xfba6a7,null))[_0x7c2c('0x45')](handleError(_0xfba6a7,null));};exports[_0x7c2c('0x5a')]=function(_0x44602a,_0x1ad537,_0x2d04da){return db[_0x7c2c('0x2c')]['findAll']({'raw':![],'where':{'CampaignId':_0x44602a['params']['id']},'attributes':[[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x7c2c('0x4e')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x51')))),_0x7c2c('0x52')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x5b')))),'busyContacts'],[db[_0x7c2c('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x7c2c('0x54')))),_0x7c2c('0x5c')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x55')))),_0x7c2c('0x56')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x5d')))),_0x7c2c('0x57')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize'][_0x7c2c('0x50')](_0x7c2c('0x58')))),'reCallContacts'],[db['sequelize']['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x5e')))),_0x7c2c('0x5f')]]})['then'](handleEntityNotFound(_0x1ad537,null))[_0x7c2c('0x26')](respondWithResult(_0x1ad537,null))['catch'](handleError(_0x1ad537,null));};exports[_0x7c2c('0x60')]=function(_0x2b597d,_0x20eb63,_0x56f737){return db[_0x7c2c('0x61')][_0x7c2c('0x47')]({'where':{'id':_0x2b597d[_0x7c2c('0x49')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x20eb63,null))['then'](function(_0x158352){var _0x1e711e;if(_0x158352){_0x1e711e=squel[_0x7c2c('0x62')]()[_0x7c2c('0x63')](_0x7c2c('0x64'))[_0x7c2c('0x65')]([_0x7c2c('0x66'),_0x7c2c('0x67'),_0x7c2c('0x68'),'ListId',_0x7c2c('0x69'),_0x7c2c('0x6a'),'updatedAt'],squel[_0x7c2c('0x6b')]()['field']('ANY_VALUE(calleridnum)',_0x7c2c('0x66'))[_0x7c2c('0x6c')](_0x7c2c('0x6d'),'scheduledAt')[_0x7c2c('0x6c')](_0x7c2c('0x6e'),_0x7c2c('0x68'))['field'](_0x7c2c('0x6f'),_0x7c2c('0x70'))[_0x7c2c('0x6c')](_0x7c2c('0x71'),'VoiceQueueId')[_0x7c2c('0x6c')]('NOW()',_0x7c2c('0x6a'))['field'](_0x7c2c('0x6d'),_0x7c2c('0x72'))[_0x7c2c('0x73')](_0x7c2c('0x74'))[_0x7c2c('0x3d')](_0x7c2c('0x75'),_0x2b597d[_0x7c2c('0x49')]['id']['toString']())[_0x7c2c('0x3d')](_0x7c2c('0x76'),_0x2b597d[_0x7c2c('0x4a')][_0x7c2c('0x77')][_0x7c2c('0x78')]())[_0x7c2c('0x3d')](_0x7c2c('0x79'))[_0x7c2c('0x3d')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x7c2c('0x6b')]()[_0x7c2c('0x6c')](_0x7c2c('0x66'))[_0x7c2c('0x73')](_0x7c2c('0x64'))['where'](_0x7c2c('0x75'),_0x2b597d[_0x7c2c('0x49')]['id']['toString']()))[_0x7c2c('0x3d')](_0x7c2c('0x7a'),squel['select']()[_0x7c2c('0x6c')]('calleridnum')[_0x7c2c('0x73')](_0x7c2c('0x74'))[_0x7c2c('0x3d')](_0x7c2c('0x75'),_0x2b597d[_0x7c2c('0x49')]['id'][_0x7c2c('0x78')]())[_0x7c2c('0x3d')]('state\x20=\x204'))[_0x7c2c('0x7b')](_0x7c2c('0x68')))['toString']();return db[_0x7c2c('0x4c')][_0x7c2c('0x32')](_0x1e711e);}return[];})[_0x7c2c('0x26')](respondWithResult(_0x20eb63,null))[_0x7c2c('0x45')](handleError(_0x20eb63,null));};exports[_0x7c2c('0x7c')]=function(_0x2f249d,_0x136226,_0x354236){return db[_0x7c2c('0x7d')][_0x7c2c('0x47')]({'where':{'id':_0x2f249d[_0x7c2c('0x49')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x136226,null))[_0x7c2c('0x26')](function(_0xb47bf0){var _0x4d0922;if(_0xb47bf0){_0x4d0922=squel[_0x7c2c('0x62')]()[_0x7c2c('0x63')]('cm_hopper')[_0x7c2c('0x65')]([_0x7c2c('0x66'),_0x7c2c('0x67'),_0x7c2c('0x68'),_0x7c2c('0x70'),'CampaignId',_0x7c2c('0x6a'),_0x7c2c('0x72')],squel[_0x7c2c('0x6b')]()['field'](_0x7c2c('0x7e'),_0x7c2c('0x66'))[_0x7c2c('0x6c')]('NOW()',_0x7c2c('0x67'))['field'](_0x7c2c('0x6e'),'ContactId')['field'](_0x7c2c('0x6f'),_0x7c2c('0x70'))[_0x7c2c('0x6c')]('ANY_VALUE(CampaignId)',_0x7c2c('0x7f'))[_0x7c2c('0x6c')](_0x7c2c('0x6d'),_0x7c2c('0x6a'))['field'](_0x7c2c('0x6d'),'updatedAt')['from']('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x2f249d[_0x7c2c('0x49')]['id'][_0x7c2c('0x78')]())[_0x7c2c('0x3d')](_0x7c2c('0x76'),_0x2f249d[_0x7c2c('0x4a')]['state'][_0x7c2c('0x78')]())[_0x7c2c('0x3d')](_0x7c2c('0x79'))[_0x7c2c('0x3d')](_0x7c2c('0x7a'),squel[_0x7c2c('0x6b')]()['field']('phone')[_0x7c2c('0x73')](_0x7c2c('0x64'))[_0x7c2c('0x3d')](_0x7c2c('0x80'),_0x2f249d['params']['id'][_0x7c2c('0x78')]()))[_0x7c2c('0x3d')](_0x7c2c('0x7a'),squel[_0x7c2c('0x6b')]()[_0x7c2c('0x6c')](_0x7c2c('0x81'))[_0x7c2c('0x73')](_0x7c2c('0x74'))[_0x7c2c('0x3d')]('CampaignId\x20=\x20?',_0x2f249d[_0x7c2c('0x49')]['id'][_0x7c2c('0x78')]())['where'](_0x7c2c('0x82')))['group'](_0x7c2c('0x68')))['toString']();return db[_0x7c2c('0x4c')][_0x7c2c('0x32')](_0x4d0922);}return[];})[_0x7c2c('0x26')](respondWithResult(_0x136226,null))[_0x7c2c('0x45')](handleError(_0x136226,null));};exports[_0x7c2c('0x83')]=function(_0x309051,_0x3f8683,_0x1eeb00){return db[_0x7c2c('0x84')]['findOne']({'where':{'VoiceQueueId':_0x309051[_0x7c2c('0x4a')][_0x7c2c('0x69')],'CampaignId':_0x309051[_0x7c2c('0x4a')]['CampaignId'],'ContactId':_0x309051[_0x7c2c('0x4a')][_0x7c2c('0x68')]}})['then'](handleEntityNotFound(_0x3f8683,null))[_0x7c2c('0x26')](function(_0x511158){if(_0x511158){return _0x511158;}return null;})[_0x7c2c('0x26')](respondWithResult(_0x3f8683,null))['catch'](handleError(_0x3f8683,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 4910f1a..9a33f22 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 _0x14e2=['./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x590e58,_0x16ec53){var _0x2811e2=function(_0x32d1f9){while(--_0x32d1f9){_0x590e58['push'](_0x590e58['shift']());}};_0x2811e2(++_0x16ec53);}(_0x14e2,0x172));var _0x214e=function(_0x2af29a,_0x4f44bc){_0x2af29a=_0x2af29a-0x0;var _0x5ef02f=_0x14e2[_0x2af29a];return _0x5ef02f;};'use strict';var _=require(_0x214e('0x0'));var util=require(_0x214e('0x1'));var logger=require(_0x214e('0x2'))('api');var moment=require(_0x214e('0x3'));var BPromise=require(_0x214e('0x4'));var rp=require(_0x214e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x214e('0x6'));var config=require(_0x214e('0x7'));var attributes=require(_0x214e('0x8'));module['exports']=function(_0xb2d4ff,_0x1fd985){return _0xb2d4ff[_0x214e('0x9')](_0x214e('0xa'),attributes,{'tableName':_0x214e('0xb'),'paranoid':![],'indexes':[{'name':_0x214e('0xc'),'fields':[_0x214e('0xc')]},{'name':'uniqueid','fields':[_0x214e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x36a5=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid'];(function(_0x2e4483,_0x4848ab){var _0x3c3106=function(_0x2355f5){while(--_0x2355f5){_0x2e4483['push'](_0x2e4483['shift']());}};_0x3c3106(++_0x4848ab);}(_0x36a5,0x113));var _0x536a=function(_0x301038,_0x5f5e0d){_0x301038=_0x301038-0x0;var _0x43aad3=_0x36a5[_0x301038];return _0x43aad3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x536a('0x0'))(_0x536a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x536a('0x2'));var fs=require('fs');var path=require(_0x536a('0x3'));var rimraf=require(_0x536a('0x4'));var config=require(_0x536a('0x5'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x26689e,_0x48e7ad){return _0x26689e[_0x536a('0x6')](_0x536a('0x7'),attributes,{'tableName':_0x536a('0x8'),'paranoid':![],'indexes':[{'name':_0x536a('0x9'),'fields':[_0x536a('0x9')]},{'name':_0x536a('0xa'),'fields':[_0x536a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index b7174ac..3f7aec3 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x71c47a,_0xf95fef){var _0x2933a9=function(_0xaf289e){while(--_0xaf289e){_0x71c47a['push'](_0x71c47a['shift']());}};_0x2933a9(++_0xf95fef);}(_0x7a54,0x106));var _0x47a5=function(_0x329b58,_0x110a7e){_0x329b58=_0x329b58-0x0;var _0x2c4c9a=_0x7a54[_0x329b58];return _0x2c4c9a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x9b38e6,_0x208ca4){var _0x15fe1d=function(_0x56e294){while(--_0x56e294){_0x9b38e6['push'](_0x9b38e6['shift']());}};_0x15fe1d(++_0x208ca4);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ee20d,_0x354e70){_0x2ee20d=_0x2ee20d-0x0;var _0xade530=_0xb10b[_0x2ee20d];return _0xade530;};'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 c129dd2..46ea8b5 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 _0xaf79=['/checkContactHopper','checkContactHopper','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal'];(function(_0xe6a2ab,_0x55de20){var _0x5181a7=function(_0xe854e1){while(--_0xe854e1){_0xe6a2ab['push'](_0xe6a2ab['shift']());}};_0x5181a7(++_0x55de20);}(_0xaf79,0xe4));var _0x9af7=function(_0x11d544,_0x3947f2){_0x11d544=_0x11d544-0x0;var _0x2a2883=_0xaf79[_0x11d544];return _0x2a2883;};'use strict';var multer=require(_0x9af7('0x0'));var util=require(_0x9af7('0x1'));var path=require(_0x9af7('0x2'));var timeout=require(_0x9af7('0x3'));var express=require(_0x9af7('0x4'));var router=express[_0x9af7('0x5')]();var fs_extra=require(_0x9af7('0x6'));var auth=require(_0x9af7('0x7'));var interaction=require(_0x9af7('0x8'));var config=require(_0x9af7('0x9'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9af7('0xa')]);router[_0x9af7('0xb')](_0x9af7('0xc'),auth[_0x9af7('0xd')](),controller[_0x9af7('0xe')]);router[_0x9af7('0xb')](_0x9af7('0xf'),auth[_0x9af7('0xd')](),controller[_0x9af7('0x10')]);router['get']('/voice/queue/countAttributes/:id',auth[_0x9af7('0xd')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x9af7('0xb')](_0x9af7('0x11'),auth[_0x9af7('0xd')](),controller[_0x9af7('0x12')]);router[_0x9af7('0x13')](_0x9af7('0x14'),auth['isAuthenticated'](),controller[_0x9af7('0x15')]);router[_0x9af7('0x13')](_0x9af7('0x16'),auth[_0x9af7('0xd')](),controller[_0x9af7('0x17')]);router[_0x9af7('0x13')](_0x9af7('0x18'),auth[_0x9af7('0xd')](),controller[_0x9af7('0x19')]);router[_0x9af7('0x1a')](_0x9af7('0xf'),auth[_0x9af7('0xd')](),controller['update']);module[_0x9af7('0x1b')]=router; \ No newline at end of file +var _0x92f3=['moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post'];(function(_0xd9ff12,_0x4c6946){var _0x3e7265=function(_0xdc83e9){while(--_0xdc83e9){_0xd9ff12['push'](_0xd9ff12['shift']());}};_0x3e7265(++_0x4c6946);}(_0x92f3,0xf0));var _0x392f=function(_0x2ecd74,_0x43247c){_0x2ecd74=_0x2ecd74-0x0;var _0x2d6a1d=_0x92f3[_0x2ecd74];return _0x2d6a1d;};'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[_0x392f('0x5')]();var fs_extra=require(_0x392f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x392f('0x7'));var config=require(_0x392f('0x8'));var controller=require(_0x392f('0x9'));router[_0x392f('0xa')]('/',auth[_0x392f('0xb')](),controller[_0x392f('0xc')]);router[_0x392f('0xa')](_0x392f('0xd'),auth[_0x392f('0xb')](),controller[_0x392f('0xe')]);router['get'](_0x392f('0xf'),auth['isAuthenticated'](),controller[_0x392f('0x10')]);router['get']('/voice/queue/countAttributes/:id',auth[_0x392f('0xb')](),controller[_0x392f('0x11')]);router[_0x392f('0xa')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0x392f('0x12')]);router[_0x392f('0x13')]('/voice/queue/moveContacts/:id',auth[_0x392f('0xb')](),controller[_0x392f('0x14')]);router['post'](_0x392f('0x15'),auth[_0x392f('0xb')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x392f('0x13')](_0x392f('0x16'),auth[_0x392f('0xb')](),controller[_0x392f('0x17')]);router['put'](_0x392f('0xf'),auth[_0x392f('0xb')](),controller[_0x392f('0x18')]);module[_0x392f('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 8c9866f..96bea36 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 _0x23c7=['STRING','BOOLEAN','sequelize','exports','INTEGER','DATE'];(function(_0x259a2e,_0x45bbba){var _0x395691=function(_0x460bbe){while(--_0x460bbe){_0x259a2e['push'](_0x259a2e['shift']());}};_0x395691(++_0x45bbba);}(_0x23c7,0x86));var _0x723c=function(_0x129807,_0x2c7aab){_0x129807=_0x129807-0x0;var _0x191330=_0x23c7[_0x129807];return _0x191330;};'use strict';var Sequelize=require(_0x723c('0x0'));module[_0x723c('0x1')]={'state':{'type':Sequelize[_0x723c('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x723c('0x3')]},'countbusyretry':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x723c('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x723c('0x4')]},'calleridnum':{'type':Sequelize[_0x723c('0x4')]},'calleridname':{'type':Sequelize[_0x723c('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x723c('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x723c('0x4')]},'campaign':{'type':Sequelize[_0x723c('0x4')]},'campaigntype':{'type':Sequelize[_0x723c('0x4')]},'membername':{'type':Sequelize[_0x723c('0x4')]},'reason':{'type':Sequelize[_0x723c('0x4')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x723c('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x723c('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x723c('0x3')]},'recallme':{'type':Sequelize[_0x723c('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x723c('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x723c('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9613=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x581f55,_0x430686){var _0x1e83c4=function(_0x5538d3){while(--_0x5538d3){_0x581f55['push'](_0x581f55['shift']());}};_0x1e83c4(++_0x430686);}(_0x9613,0x1c9));var _0x3961=function(_0x2407f0,_0xd6516e){_0x2407f0=_0x2407f0-0x0;var _0x76ac38=_0x9613[_0x2407f0];return _0x76ac38;};'use strict';var Sequelize=require(_0x3961('0x0'));module[_0x3961('0x1')]={'state':{'type':Sequelize[_0x3961('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3961('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x3961('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3961('0x3')]},'starttime':{'type':Sequelize[_0x3961('0x4')]},'responsetime':{'type':Sequelize[_0x3961('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x3961('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x3961('0x3')]},'campaigntype':{'type':Sequelize[_0x3961('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x3961('0x3')]},'amd':{'type':Sequelize[_0x3961('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x3961('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x3961('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3961('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3961('0x4')]},'recallme':{'type':Sequelize[_0x3961('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x3961('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3961('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index f3488ee..8814f39 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 _0x707e=['where','merge','filter','options','includeAll','include','rows','catch','params','find','create','describe','body','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick'];(function(_0xff14fb,_0x1c31e8){var _0x266f08=function(_0x3ce2e0){while(--_0x3ce2e0){_0xff14fb['push'](_0xff14fb['shift']());}};_0x266f08(++_0x1c31e8);}(_0x707e,0x1e8));var _0xe707=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0x707e[_0x4b4f24];return _0x1c13d4;};'use strict';var emlformat=require(_0xe707('0x0'));var rimraf=require(_0xe707('0x1'));var zipdir=require(_0xe707('0x2'));var jsonpatch=require(_0xe707('0x3'));var rp=require(_0xe707('0x4'));var moment=require(_0xe707('0x5'));var BPromise=require(_0xe707('0x6'));var Mustache=require('mustache');var util=require(_0xe707('0x7'));var path=require(_0xe707('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe707('0x9'));var fs=require('fs');var fs_extra=require(_0xe707('0xa'));var _=require(_0xe707('0xb'));var squel=require(_0xe707('0xc'));var crypto=require(_0xe707('0xd'));var jsforce=require(_0xe707('0xe'));var deskjs=require(_0xe707('0xf'));var toCsv=require(_0xe707('0x10'));var querystring=require('querystring');var Papa=require(_0xe707('0x11'));var Redis=require(_0xe707('0x12'));var authService=require(_0xe707('0x13'));var qs=require(_0xe707('0x14'));var as=require(_0xe707('0x15'));var hardwareService=require(_0xe707('0x16'));var logger=require(_0xe707('0x17'))(_0xe707('0x18'));var utils=require(_0xe707('0x19'));var config=require(_0xe707('0x1a'));var licenseUtil=require(_0xe707('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x712000,_0x3c676a){_0x3c676a=_0x3c676a||0xcc;return function(_0x50e202){if(_0x50e202){return _0x712000['sendStatus'](_0x3c676a);}return _0x712000[_0xe707('0x1c')](_0x3c676a)[_0xe707('0x1d')]();};}function respondWithResult(_0x1f08b3,_0x11fb76){_0x11fb76=_0x11fb76||0xc8;return function(_0x174ec7){if(_0x174ec7){return _0x1f08b3['status'](_0x11fb76)[_0xe707('0x1e')](_0x174ec7);}};}function respondWithFilteredResult(_0x3380c5,_0x1e3510){return function(_0x4b6025){if(_0x4b6025){var _0x2ccc0d=typeof _0x1e3510[_0xe707('0x1f')]===_0xe707('0x20')&&typeof _0x1e3510[_0xe707('0x21')]===_0xe707('0x20');var _0x1d49af=_0x4b6025[_0xe707('0x22')];var _0x56e6a4=_0x2ccc0d?0x0:_0x1e3510['offset'];var _0x46b52d=_0x2ccc0d?_0x4b6025['count']:_0x1e3510[_0xe707('0x1f')]+_0x1e3510[_0xe707('0x21')];var _0x887ca6;if(_0x46b52d>=_0x1d49af){_0x46b52d=_0x1d49af;_0x887ca6=0xc8;}else{_0x887ca6=0xce;}_0x3380c5[_0xe707('0x1c')](_0x887ca6);return _0x3380c5[_0xe707('0x23')](_0xe707('0x24'),_0x56e6a4+'-'+_0x46b52d+'/'+_0x1d49af)[_0xe707('0x1e')](_0x4b6025);}return null;};}function patchUpdates(_0x16349b){return function(_0xbb2f18){try{jsonpatch[_0xe707('0x25')](_0xbb2f18,_0x16349b,!![]);}catch(_0x7b86a3){return BPromise['reject'](_0x7b86a3);}return _0xbb2f18['save']();};}function saveUpdates(_0x307f19,_0x4c4183){return function(_0x220b65){if(_0x220b65){return _0x220b65[_0xe707('0x26')](_0x307f19)[_0xe707('0x27')](function(_0x45995d){return _0x45995d;});}return null;};}function removeEntity(_0x17673f,_0xb1abe6){return function(_0x44cf7e){if(_0x44cf7e){return _0x44cf7e[_0xe707('0x28')]()['then'](function(){_0x17673f[_0xe707('0x1c')](0xcc)[_0xe707('0x1d')]();});}};}function handleEntityNotFound(_0x1a0881,_0x3134ee){return function(_0x50e450){if(!_0x50e450){_0x1a0881[_0xe707('0x29')](0x194);}return _0x50e450;};}function handleError(_0x43b9bd,_0x2ab00c){_0x2ab00c=_0x2ab00c||0x1f4;return function(_0x2b1c2c){logger[_0xe707('0x2a')](_0x2b1c2c[_0xe707('0x2b')]);if(_0x2b1c2c[_0xe707('0x2c')]){delete _0x2b1c2c[_0xe707('0x2c')];}_0x43b9bd[_0xe707('0x1c')](_0x2ab00c)[_0xe707('0x2d')](_0x2b1c2c);};}exports[_0xe707('0x2e')]=function(_0x2263fd,_0x1aa50c){var _0x225e7d={},_0x395c4b={},_0x1e4dcb={'count':0x0,'rows':[]};var _0x3f8424=_[_0xe707('0x2f')](db[_0xe707('0x30')][_0xe707('0x31')],function(_0x27cffa){return{'name':_0x27cffa[_0xe707('0x32')],'type':_0x27cffa[_0xe707('0x33')]['key']};});_0x395c4b['model']=_[_0xe707('0x2f')](_0x3f8424,_0xe707('0x2c'));_0x395c4b[_0xe707('0x34')]=_[_0xe707('0x35')](_0x2263fd['query']);_0x395c4b['filters']=_[_0xe707('0x36')](_0x395c4b[_0xe707('0x37')],_0x395c4b[_0xe707('0x34')]);_0x225e7d['attributes']=_[_0xe707('0x36')](_0x395c4b[_0xe707('0x37')],qs[_0xe707('0x38')](_0x2263fd[_0xe707('0x34')]['fields']));_0x225e7d[_0xe707('0x39')]=_0x225e7d[_0xe707('0x39')][_0xe707('0x3a')]?_0x225e7d['attributes']:_0x395c4b['model'];if(!_0x2263fd[_0xe707('0x34')][_0xe707('0x3b')](_0xe707('0x3c'))){_0x225e7d[_0xe707('0x21')]=qs[_0xe707('0x21')](_0x2263fd[_0xe707('0x34')][_0xe707('0x21')]);_0x225e7d[_0xe707('0x1f')]=qs[_0xe707('0x1f')](_0x2263fd['query']['offset']);}_0x225e7d[_0xe707('0x3d')]=qs[_0xe707('0x3e')](_0x2263fd[_0xe707('0x34')][_0xe707('0x3e')]);_0x225e7d['where']=qs[_0xe707('0x3f')](_[_0xe707('0x40')](_0x2263fd[_0xe707('0x34')],_0x395c4b[_0xe707('0x3f')]),_0x3f8424);if(_0x2263fd['query']['filter']){_0x225e7d[_0xe707('0x41')]=_[_0xe707('0x42')](_0x225e7d[_0xe707('0x41')],{'$or':_[_0xe707('0x2f')](_0x3f8424,function(_0x304664){if(_0x304664[_0xe707('0x33')]!=='VIRTUAL'){var _0x109765={};_0x109765[_0x304664['name']]={'$like':'%'+_0x2263fd[_0xe707('0x34')][_0xe707('0x43')]+'%'};return _0x109765;}})});}_0x225e7d=_[_0xe707('0x42')]({},_0x225e7d,_0x2263fd[_0xe707('0x44')]);var _0x45f249={'where':_0x225e7d[_0xe707('0x41')]};return db['CmHopperHistory'][_0xe707('0x22')](_0x45f249)['then'](function(_0xf5db00){_0x1e4dcb[_0xe707('0x22')]=_0xf5db00;if(_0x2263fd[_0xe707('0x34')][_0xe707('0x45')]){_0x225e7d[_0xe707('0x46')]=[{'all':!![]}];}return db[_0xe707('0x30')]['findAll'](_0x225e7d);})['then'](function(_0x561dba){_0x1e4dcb[_0xe707('0x47')]=_0x561dba;return _0x1e4dcb;})['then'](respondWithFilteredResult(_0x1aa50c,_0x225e7d))[_0xe707('0x48')](handleError(_0x1aa50c,null));};exports['show']=function(_0x13851e,_0x46902d){var _0x30856e={'raw':!![],'where':{'id':_0x13851e[_0xe707('0x49')]['id']}},_0xb06378={};_0xb06378[_0xe707('0x37')]=_['keys'](db[_0xe707('0x30')][_0xe707('0x31')]);_0xb06378[_0xe707('0x34')]=_[_0xe707('0x35')](_0x13851e[_0xe707('0x34')]);_0xb06378['filters']=_[_0xe707('0x36')](_0xb06378[_0xe707('0x37')],_0xb06378[_0xe707('0x34')]);_0x30856e['attributes']=_[_0xe707('0x36')](_0xb06378[_0xe707('0x37')],qs['fields'](_0x13851e[_0xe707('0x34')]['fields']));_0x30856e[_0xe707('0x39')]=_0x30856e[_0xe707('0x39')][_0xe707('0x3a')]?_0x30856e[_0xe707('0x39')]:_0xb06378[_0xe707('0x37')];if(_0x13851e['query'][_0xe707('0x45')]){_0x30856e[_0xe707('0x46')]=[{'all':!![]}];}_0x30856e=_[_0xe707('0x42')]({},_0x30856e,_0x13851e[_0xe707('0x44')]);return db['CmHopperHistory'][_0xe707('0x4a')](_0x30856e)['then'](handleEntityNotFound(_0x46902d,null))[_0xe707('0x27')](respondWithResult(_0x46902d,null))[_0xe707('0x48')](handleError(_0x46902d,null));};exports[_0xe707('0x4b')]=function(_0x3a8701,_0x4ef9af){return db[_0xe707('0x30')][_0xe707('0x4b')](_0x3a8701['body'],{})[_0xe707('0x27')](respondWithResult(_0x4ef9af,0xc9))[_0xe707('0x48')](handleError(_0x4ef9af,null));};exports[_0xe707('0x4c')]=function(_0x56ff6f,_0x559715){return db['CmHopperHistory'][_0xe707('0x4c')]()[_0xe707('0x27')](respondWithResult(_0x559715,null))[_0xe707('0x48')](handleError(_0x559715,null));};exports[_0xe707('0x26')]=function(_0xb4a52c,_0x220614){if(_0xb4a52c[_0xe707('0x4d')]['uniqueid']){delete _0xb4a52c['body'][_0xe707('0x4e')];}return db[_0xe707('0x30')][_0xe707('0x4a')]({'where':{'uniqueid':_0xb4a52c['params']['id']}})[_0xe707('0x27')](handleEntityNotFound(_0x220614,null))[_0xe707('0x27')](saveUpdates(_0xb4a52c['body'],null))[_0xe707('0x27')](respondWithResult(_0x220614,null))[_0xe707('0x48')](handleError(_0x220614,null));}; \ No newline at end of file +var _0xc2b0=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','describe','update','uniqueid','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','end','sendStatus','error','name','map','CmHopperHistory','rawAttributes','type','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter'];(function(_0x5cd5a0,_0x139767){var _0x2d11e2=function(_0x58c87a){while(--_0x58c87a){_0x5cd5a0['push'](_0x5cd5a0['shift']());}};_0x2d11e2(++_0x139767);}(_0xc2b0,0xa3));var _0x0c2b=function(_0x4e7c1c,_0x56eafd){_0x4e7c1c=_0x4e7c1c-0x0;var _0x47adb2=_0xc2b0[_0x4e7c1c];return _0x47adb2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c2b('0x0'));var zipdir=require(_0x0c2b('0x1'));var jsonpatch=require(_0x0c2b('0x2'));var rp=require(_0x0c2b('0x3'));var moment=require('moment');var BPromise=require(_0x0c2b('0x4'));var Mustache=require(_0x0c2b('0x5'));var util=require(_0x0c2b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0c2b('0x7'));var ejs=require(_0x0c2b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0c2b('0x9'));var squel=require(_0x0c2b('0xa'));var crypto=require('crypto');var jsforce=require(_0x0c2b('0xb'));var deskjs=require(_0x0c2b('0xc'));var toCsv=require(_0x0c2b('0x7'));var querystring=require(_0x0c2b('0xd'));var Papa=require('papaparse');var Redis=require(_0x0c2b('0xe'));var authService=require(_0x0c2b('0xf'));var qs=require(_0x0c2b('0x10'));var as=require(_0x0c2b('0x11'));var hardwareService=require(_0x0c2b('0x12'));var logger=require(_0x0c2b('0x13'))(_0x0c2b('0x14'));var utils=require('../../config/utils');var config=require(_0x0c2b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c2b('0x16'))['db'];function respondWithStatusCode(_0x27ca4d,_0x4eda89){_0x4eda89=_0x4eda89||0xcc;return function(_0x3dd23d){if(_0x3dd23d){return _0x27ca4d['sendStatus'](_0x4eda89);}return _0x27ca4d[_0x0c2b('0x17')](_0x4eda89)['end']();};}function respondWithResult(_0x4c74c2,_0xd35e70){_0xd35e70=_0xd35e70||0xc8;return function(_0x30e941){if(_0x30e941){return _0x4c74c2[_0x0c2b('0x17')](_0xd35e70)[_0x0c2b('0x18')](_0x30e941);}};}function respondWithFilteredResult(_0x103862,_0x3f7db4){return function(_0x4d6006){if(_0x4d6006){var _0x2afc23=typeof _0x3f7db4['offset']===_0x0c2b('0x19')&&typeof _0x3f7db4[_0x0c2b('0x1a')]===_0x0c2b('0x19');var _0x421ce1=_0x4d6006[_0x0c2b('0x1b')];var _0x2067e4=_0x2afc23?0x0:_0x3f7db4[_0x0c2b('0x1c')];var _0x5f0f17=_0x2afc23?_0x4d6006[_0x0c2b('0x1b')]:_0x3f7db4[_0x0c2b('0x1c')]+_0x3f7db4[_0x0c2b('0x1a')];var _0xfd2011;if(_0x5f0f17>=_0x421ce1){_0x5f0f17=_0x421ce1;_0xfd2011=0xc8;}else{_0xfd2011=0xce;}_0x103862[_0x0c2b('0x17')](_0xfd2011);return _0x103862[_0x0c2b('0x1d')](_0x0c2b('0x1e'),_0x2067e4+'-'+_0x5f0f17+'/'+_0x421ce1)[_0x0c2b('0x18')](_0x4d6006);}return null;};}function patchUpdates(_0x3923ed){return function(_0x41d4b6){try{jsonpatch['apply'](_0x41d4b6,_0x3923ed,!![]);}catch(_0x18348a){return BPromise[_0x0c2b('0x1f')](_0x18348a);}return _0x41d4b6[_0x0c2b('0x20')]();};}function saveUpdates(_0x6c1235,_0x5895c5){return function(_0x432d7e){if(_0x432d7e){return _0x432d7e['update'](_0x6c1235)[_0x0c2b('0x21')](function(_0x3caa58){return _0x3caa58;});}return null;};}function removeEntity(_0x2b51fc,_0x47d759){return function(_0x2bdad1){if(_0x2bdad1){return _0x2bdad1['destroy']()[_0x0c2b('0x21')](function(){_0x2b51fc[_0x0c2b('0x17')](0xcc)[_0x0c2b('0x22')]();});}};}function handleEntityNotFound(_0x4a853a,_0x31d34d){return function(_0x2d1709){if(!_0x2d1709){_0x4a853a[_0x0c2b('0x23')](0x194);}return _0x2d1709;};}function handleError(_0x3562d1,_0x3d2d0a){_0x3d2d0a=_0x3d2d0a||0x1f4;return function(_0x26c8b1){logger[_0x0c2b('0x24')](_0x26c8b1['stack']);if(_0x26c8b1[_0x0c2b('0x25')]){delete _0x26c8b1['name'];}_0x3562d1[_0x0c2b('0x17')](_0x3d2d0a)['send'](_0x26c8b1);};}exports['index']=function(_0x5d0367,_0x8802d9){var _0xc5c9af={},_0x30a0b7={},_0x222e2b={'count':0x0,'rows':[]};var _0x2e0417=_[_0x0c2b('0x26')](db[_0x0c2b('0x27')][_0x0c2b('0x28')],function(_0x181a5f){return{'name':_0x181a5f['fieldName'],'type':_0x181a5f[_0x0c2b('0x29')]['key']};});_0x30a0b7[_0x0c2b('0x2a')]=_[_0x0c2b('0x26')](_0x2e0417,_0x0c2b('0x25'));_0x30a0b7['query']=_[_0x0c2b('0x2b')](_0x5d0367[_0x0c2b('0x2c')]);_0x30a0b7['filters']=_[_0x0c2b('0x2d')](_0x30a0b7[_0x0c2b('0x2a')],_0x30a0b7[_0x0c2b('0x2c')]);_0xc5c9af[_0x0c2b('0x2e')]=_[_0x0c2b('0x2d')](_0x30a0b7['model'],qs['fields'](_0x5d0367[_0x0c2b('0x2c')]['fields']));_0xc5c9af['attributes']=_0xc5c9af[_0x0c2b('0x2e')][_0x0c2b('0x2f')]?_0xc5c9af[_0x0c2b('0x2e')]:_0x30a0b7['model'];if(!_0x5d0367['query'][_0x0c2b('0x30')](_0x0c2b('0x31'))){_0xc5c9af[_0x0c2b('0x1a')]=qs[_0x0c2b('0x1a')](_0x5d0367[_0x0c2b('0x2c')][_0x0c2b('0x1a')]);_0xc5c9af['offset']=qs['offset'](_0x5d0367[_0x0c2b('0x2c')][_0x0c2b('0x1c')]);}_0xc5c9af[_0x0c2b('0x32')]=qs['sort'](_0x5d0367[_0x0c2b('0x2c')][_0x0c2b('0x33')]);_0xc5c9af[_0x0c2b('0x34')]=qs[_0x0c2b('0x35')](_[_0x0c2b('0x36')](_0x5d0367[_0x0c2b('0x2c')],_0x30a0b7[_0x0c2b('0x35')]),_0x2e0417);if(_0x5d0367[_0x0c2b('0x2c')][_0x0c2b('0x37')]){_0xc5c9af[_0x0c2b('0x34')]=_[_0x0c2b('0x38')](_0xc5c9af['where'],{'$or':_[_0x0c2b('0x26')](_0x2e0417,function(_0x74512a){if(_0x74512a[_0x0c2b('0x29')]!==_0x0c2b('0x39')){var _0x28cbd4={};_0x28cbd4[_0x74512a[_0x0c2b('0x25')]]={'$like':'%'+_0x5d0367['query'][_0x0c2b('0x37')]+'%'};return _0x28cbd4;}})});}_0xc5c9af=_['merge']({},_0xc5c9af,_0x5d0367[_0x0c2b('0x3a')]);var _0x11b55a={'where':_0xc5c9af['where']};return db[_0x0c2b('0x27')][_0x0c2b('0x1b')](_0x11b55a)[_0x0c2b('0x21')](function(_0x21a3d4){_0x222e2b[_0x0c2b('0x1b')]=_0x21a3d4;if(_0x5d0367[_0x0c2b('0x2c')][_0x0c2b('0x3b')]){_0xc5c9af[_0x0c2b('0x3c')]=[{'all':!![]}];}return db[_0x0c2b('0x27')][_0x0c2b('0x3d')](_0xc5c9af);})[_0x0c2b('0x21')](function(_0x295db0){_0x222e2b[_0x0c2b('0x3e')]=_0x295db0;return _0x222e2b;})['then'](respondWithFilteredResult(_0x8802d9,_0xc5c9af))[_0x0c2b('0x3f')](handleError(_0x8802d9,null));};exports[_0x0c2b('0x40')]=function(_0x2261d7,_0x217a0a){var _0x407525={'raw':!![],'where':{'id':_0x2261d7[_0x0c2b('0x41')]['id']}},_0x324de5={};_0x324de5['model']=_['keys'](db[_0x0c2b('0x27')]['rawAttributes']);_0x324de5[_0x0c2b('0x2c')]=_[_0x0c2b('0x2b')](_0x2261d7[_0x0c2b('0x2c')]);_0x324de5[_0x0c2b('0x35')]=_[_0x0c2b('0x2d')](_0x324de5[_0x0c2b('0x2a')],_0x324de5['query']);_0x407525[_0x0c2b('0x2e')]=_[_0x0c2b('0x2d')](_0x324de5[_0x0c2b('0x2a')],qs[_0x0c2b('0x42')](_0x2261d7[_0x0c2b('0x2c')][_0x0c2b('0x42')]));_0x407525[_0x0c2b('0x2e')]=_0x407525[_0x0c2b('0x2e')]['length']?_0x407525[_0x0c2b('0x2e')]:_0x324de5['model'];if(_0x2261d7[_0x0c2b('0x2c')][_0x0c2b('0x3b')]){_0x407525[_0x0c2b('0x3c')]=[{'all':!![]}];}_0x407525=_[_0x0c2b('0x38')]({},_0x407525,_0x2261d7[_0x0c2b('0x3a')]);return db[_0x0c2b('0x27')][_0x0c2b('0x43')](_0x407525)[_0x0c2b('0x21')](handleEntityNotFound(_0x217a0a,null))[_0x0c2b('0x21')](respondWithResult(_0x217a0a,null))[_0x0c2b('0x3f')](handleError(_0x217a0a,null));};exports[_0x0c2b('0x44')]=function(_0x534336,_0x1f0c31){return db[_0x0c2b('0x27')]['create'](_0x534336[_0x0c2b('0x45')],{})['then'](respondWithResult(_0x1f0c31,0xc9))[_0x0c2b('0x3f')](handleError(_0x1f0c31,null));};exports[_0x0c2b('0x46')]=function(_0x174fdb,_0xb97f30){return db['CmHopperHistory'][_0x0c2b('0x46')]()[_0x0c2b('0x21')](respondWithResult(_0xb97f30,null))['catch'](handleError(_0xb97f30,null));};exports[_0x0c2b('0x47')]=function(_0x2e602b,_0x346d20){if(_0x2e602b['body']['uniqueid']){delete _0x2e602b[_0x0c2b('0x45')][_0x0c2b('0x48')];}return db[_0x0c2b('0x27')][_0x0c2b('0x43')]({'where':{'uniqueid':_0x2e602b['params']['id']}})[_0x0c2b('0x21')](handleEntityNotFound(_0x346d20,null))['then'](saveUpdates(_0x2e602b[_0x0c2b('0x45')],null))[_0x0c2b('0x21')](respondWithResult(_0x346d20,null))[_0x0c2b('0x3f')](handleError(_0x346d20,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index ee62c32..5a628c8 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 _0xb8cb=['moment','bluebird','request-promise','rimraf','../../config/environment','define','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x3800a2,_0x44c556){_0x3800a2=_0x3800a2-0x0;var _0x3e5e1f=_0xb8cb[_0x3800a2];return _0x3e5e1f;};'use strict';var _=require(_0xbb8c('0x0'));var util=require(_0xbb8c('0x1'));var logger=require(_0xbb8c('0x2'))(_0xbb8c('0x3'));var moment=require(_0xbb8c('0x4'));var BPromise=require(_0xbb8c('0x5'));var rp=require(_0xbb8c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb8c('0x7'));var config=require(_0xbb8c('0x8'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x3b2ad2,_0x27c59e){return _0x3b2ad2[_0xbb8c('0x9')]('CmHopperHistory',attributes,{'tableName':_0xbb8c('0xa'),'paranoid':![],'indexes':[{'name':_0xbb8c('0xb'),'fields':[_0xbb8c('0xb')]},{'name':_0xbb8c('0xc'),'fields':[_0xbb8c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8710=['lodash','util','api','moment','bluebird','path','rimraf','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8710,0x68));var _0x0871=function(_0x4415dc,_0x2a61bb){_0x4415dc=_0x4415dc-0x0;var _0x74e72c=_0x8710[_0x4415dc];return _0x74e72c;};'use strict';var _=require(_0x0871('0x0'));var util=require(_0x0871('0x1'));var logger=require('../../config/logger')(_0x0871('0x2'));var moment=require(_0x0871('0x3'));var BPromise=require(_0x0871('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0871('0x5'));var rimraf=require(_0x0871('0x6'));var config=require('../../config/environment');var attributes=require(_0x0871('0x7'));module['exports']=function(_0x32d76a,_0x42539c){return _0x32d76a[_0x0871('0x8')](_0x0871('0x9'),attributes,{'tableName':_0x0871('0xa'),'paranoid':![],'indexes':[{'name':_0x0871('0xb'),'fields':['endtime']},{'name':_0x0871('0xc'),'fields':[_0x0871('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 3a56ece..e70be80 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 _0xee11=['`state`\x20=\x2011,\x201,\x20null','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`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','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','debug','GetCampaignHopperHistory','campaign','ivrTotalCallsDays','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperHistory,\x20%s,\x20%s','result','CreateCmHopperHistory','CmHopperHistory','body','options','catch','AvgHandleTime','findAll','raw','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout'];(function(_0x4e2fc9,_0x5e1f21){var _0x1c803b=function(_0xda0f05){while(--_0xda0f05){_0x4e2fc9['push'](_0x4e2fc9['shift']());}};_0x1c803b(++_0x5e1f21);}(_0xee11,0x146));var _0x1ee1=function(_0x92b4dc,_0x20f18a){_0x92b4dc=_0x92b4dc-0x0;var _0xe68d92=_0xee11[_0x92b4dc];return _0xe68d92;};'use strict';var _=require(_0x1ee1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1ee1('0x1'));var rs=require(_0x1ee1('0x2'));var fs=require('fs');var Redis=require(_0x1ee1('0x3'));var db=require(_0x1ee1('0x4'))['db'];var utils=require(_0x1ee1('0x5'));var logger=require(_0x1ee1('0x6'))(_0x1ee1('0x7'));var config=require(_0x1ee1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1ee1('0x9')][_0x1ee1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fdb3b,_0x289d4c,_0x356919){return new BPromise(function(_0x47f984,_0x48af4c){return client[_0x1ee1('0xb')](_0x3fdb3b,_0x356919)[_0x1ee1('0xc')](function(_0x5899ca){logger[_0x1ee1('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x289d4c,_0x1ee1('0xe'));logger['debug'](_0x1ee1('0xf'),_0x289d4c,_0x1ee1('0xe'),JSON[_0x1ee1('0x10')](_0x5899ca));if(_0x5899ca[_0x1ee1('0x11')]){if(_0x5899ca['error'][_0x1ee1('0x12')]===0x1f4){logger[_0x1ee1('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x289d4c,_0x5899ca[_0x1ee1('0x11')][_0x1ee1('0x13')]);return _0x48af4c(_0x5899ca[_0x1ee1('0x11')][_0x1ee1('0x13')]);}logger[_0x1ee1('0x11')](_0x1ee1('0x14'),_0x289d4c,_0x5899ca[_0x1ee1('0x11')][_0x1ee1('0x13')]);return _0x47f984(_0x5899ca[_0x1ee1('0x11')][_0x1ee1('0x13')]);}else{logger[_0x1ee1('0xd')](_0x1ee1('0x14'),_0x289d4c,_0x1ee1('0xe'));_0x47f984(_0x5899ca[_0x1ee1('0x15')]['message']);}})['catch'](function(_0x7ff856){logger[_0x1ee1('0x11')](_0x1ee1('0x14'),_0x289d4c,_0x7ff856);_0x48af4c(_0x7ff856);});});}exports[_0x1ee1('0x16')]=function(_0x1e18b9){var _0xff3d76=this;return new Promise(function(_0x55abff,_0x39229e){return db[_0x1ee1('0x17')]['create'](_0x1e18b9[_0x1ee1('0x18')],{'raw':_0x1e18b9[_0x1ee1('0x19')]?_0x1e18b9['options']['raw']===undefined?!![]:![]:!![]})[_0x1ee1('0xc')](function(_0x1b6cdf){logger[_0x1ee1('0xd')](_0x1ee1('0x16'),_0x1e18b9);logger['debug'](_0x1ee1('0x16'),_0x1e18b9,JSON[_0x1ee1('0x10')](_0x1b6cdf));_0x55abff(_0x1b6cdf);})[_0x1ee1('0x1a')](function(_0x5093ff){logger[_0x1ee1('0x11')](_0x1ee1('0x16'),_0x5093ff[_0x1ee1('0x13')],_0x1e18b9);_0x39229e(_0xff3d76[_0x1ee1('0x11')](0x1f4,_0x5093ff[_0x1ee1('0x13')]));});});};exports[_0x1ee1('0x1b')]=function(_0x55921f){var _0x1142fd=this;return new Promise(function(_0x5d1948,_0x4932cd){return db[_0x1ee1('0x17')][_0x1ee1('0x1c')]({'raw':_0x55921f['options']?_0x55921f[_0x1ee1('0x19')][_0x1ee1('0x1d')]===undefined?!![]:![]:!![],'where':_0x55921f[_0x1ee1('0x19')]?_0x55921f[_0x1ee1('0x19')][_0x1ee1('0x1e')]||null:null,'attributes':[[db[_0x1ee1('0x1f')]['fn']('COUNT',db[_0x1ee1('0x1f')][_0x1ee1('0x20')]('id')),_0x1ee1('0x21')],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db['sequelize'][_0x1ee1('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x1ee1('0x24')],[db[_0x1ee1('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x25')))),_0x1ee1('0x26')],[db['sequelize']['fn']('COUNT',db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x27')))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0x1ee1('0x28'),db['sequelize']['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x1ee1('0x29')],[db['sequelize']['fn'](_0x1ee1('0x28'),db['sequelize']['fn']('IF',db[_0x1ee1('0x1f')]['literal'](_0x1ee1('0x2a')))),_0x1ee1('0x2b')]]})['then'](function(_0x4cc56e){logger[_0x1ee1('0xd')](_0x1ee1('0x1b'),_0x55921f);logger['debug'](_0x1ee1('0x1b'),_0x55921f,JSON[_0x1ee1('0x10')](_0x4cc56e));_0x5d1948(_0x4cc56e);})[_0x1ee1('0x1a')](function(_0x3d9e0a){logger[_0x1ee1('0x11')](_0x1ee1('0x1b'),_0x3d9e0a[_0x1ee1('0x13')],_0x55921f);_0x4932cd(_0x1142fd[_0x1ee1('0x11')](0x1f4,_0x3d9e0a[_0x1ee1('0x13')]));});});};exports[_0x1ee1('0x2c')]=function(_0x15232c){var _0x3a900c=this;return new Promise(function(_0x3f0449,_0x1e5775){return db[_0x1ee1('0x17')][_0x1ee1('0x1c')]({'raw':_0x15232c[_0x1ee1('0x19')]?_0x15232c[_0x1ee1('0x19')][_0x1ee1('0x1d')]===undefined?!![]:![]:!![],'where':_0x15232c[_0x1ee1('0x19')]?_0x15232c[_0x1ee1('0x19')][_0x1ee1('0x1e')]||null:null,'attributes':[['campaign',_0x1ee1('0x2d')],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x2e')))),_0x1ee1('0x2f')],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')]['literal'](_0x1ee1('0x30')))),_0x1ee1('0x31')],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x1ee1('0x32')],[db[_0x1ee1('0x1f')]['fn']('COUNT',db[_0x1ee1('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x1ee1('0x33')))),_0x1ee1('0x34')],[db['sequelize']['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x35')))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x36')))),_0x1ee1('0x37')],[db[_0x1ee1('0x1f')]['fn']('COUNT',db[_0x1ee1('0x1f')]['fn']('IF',db['sequelize'][_0x1ee1('0x23')](_0x1ee1('0x38')))),_0x1ee1('0x39')],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x3a')))),_0x1ee1('0x3b')],[db['sequelize']['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')]['literal'](_0x1ee1('0x3c')))),_0x1ee1('0x3d')],[db[_0x1ee1('0x1f')]['fn']('COUNT',db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x3e')))),'outboundOriginateFailureCallsDay'],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x1ee1('0x3f')],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db['sequelize'][_0x1ee1('0x23')](_0x1ee1('0x40')))),'outboundAnswerAgiCallsDay'],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x41')))),'outboundRejectCallsDay'],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x42')))),'outboundReCallsDay']],'group':['campaign']})[_0x1ee1('0xc')](function(_0xe93945){logger['info']('GetVoiceQueueHopperHistory',_0x15232c);logger[_0x1ee1('0x43')](_0x1ee1('0x2c'),_0x15232c,JSON[_0x1ee1('0x10')](_0xe93945));_0x3f0449(_0xe93945);})['catch'](function(_0x3791de){logger[_0x1ee1('0x11')](_0x1ee1('0x2c'),_0x3791de[_0x1ee1('0x13')],_0x15232c);_0x1e5775(_0x3a900c[_0x1ee1('0x11')](0x1f4,_0x3791de[_0x1ee1('0x13')]));});});};exports[_0x1ee1('0x44')]=function(_0x37f960){var _0x51a643=this;return new Promise(function(_0x5855e9,_0x28dc90){return db['CmHopperHistory']['findAll']({'raw':_0x37f960[_0x1ee1('0x19')]?_0x37f960['options']['raw']===undefined?!![]:![]:!![],'where':_0x37f960[_0x1ee1('0x19')]?_0x37f960[_0x1ee1('0x19')]['where']||null:null,'attributes':[[_0x1ee1('0x45'),'name'],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db['sequelize'][_0x1ee1('0x20')]('id')),_0x1ee1('0x46')],[db[_0x1ee1('0x1f')]['fn'](_0x1ee1('0x22'),db[_0x1ee1('0x1f')]['fn']('IF',db[_0x1ee1('0x1f')][_0x1ee1('0x23')](_0x1ee1('0x47')))),_0x1ee1('0x48')]],'group':[_0x1ee1('0x45')]})[_0x1ee1('0xc')](function(_0x3f5d6b){logger['info'](_0x1ee1('0x44'),_0x37f960);logger[_0x1ee1('0x43')]('GetCampaignHopperHistory',_0x37f960,JSON['stringify'](_0x3f5d6b));_0x5855e9(_0x3f5d6b);})[_0x1ee1('0x1a')](function(_0x2bde09){logger['error'](_0x1ee1('0x44'),_0x2bde09['message'],_0x37f960);_0x28dc90(_0x51a643[_0x1ee1('0x11')](0x1f4,_0x2bde09[_0x1ee1('0x13')]));});});}; \ No newline at end of file +var _0xf150=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','AvgHandleTime','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgTalktime','then','stringify','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','findAll','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3b23a7,_0x511488){var _0xab9705=function(_0x415fe6){while(--_0x415fe6){_0x3b23a7['push'](_0x3b23a7['shift']());}};_0xab9705(++_0x511488);}(_0xf150,0x106));var _0x0f15=function(_0x2f59da,_0x482473){_0x2f59da=_0x2f59da-0x0;var _0x243099=_0xf150[_0x2f59da];return _0x243099;};'use strict';var _=require(_0x0f15('0x0'));var util=require(_0x0f15('0x1'));var moment=require(_0x0f15('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f15('0x3'));var fs=require('fs');var Redis=require(_0x0f15('0x4'));var db=require(_0x0f15('0x5'))['db'];var utils=require(_0x0f15('0x6'));var logger=require(_0x0f15('0x7'))(_0x0f15('0x8'));var config=require(_0x0f15('0x9'));var jayson=require(_0x0f15('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d8a90,_0xb3af27,_0x2c603d){return new BPromise(function(_0x3928e2,_0x57bcde){return client[_0x0f15('0xb')](_0x1d8a90,_0x2c603d)['then'](function(_0x43a831){logger[_0x0f15('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0xb3af27,'request\x20sent');logger[_0x0f15('0xd')](_0x0f15('0xe'),_0xb3af27,_0x0f15('0xf'),JSON['stringify'](_0x43a831));if(_0x43a831[_0x0f15('0x10')]){if(_0x43a831['error']['code']===0x1f4){logger[_0x0f15('0x10')](_0x0f15('0x11'),_0xb3af27,_0x43a831[_0x0f15('0x10')][_0x0f15('0x12')]);return _0x57bcde(_0x43a831['error'][_0x0f15('0x12')]);}logger[_0x0f15('0x10')](_0x0f15('0x11'),_0xb3af27,_0x43a831['error'][_0x0f15('0x12')]);return _0x3928e2(_0x43a831['error'][_0x0f15('0x12')]);}else{logger[_0x0f15('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0xb3af27,'request\x20sent');_0x3928e2(_0x43a831[_0x0f15('0x13')][_0x0f15('0x12')]);}})[_0x0f15('0x14')](function(_0xafd98){logger[_0x0f15('0x10')](_0x0f15('0x11'),_0xb3af27,_0xafd98);_0x57bcde(_0xafd98);});});}exports[_0x0f15('0x15')]=function(_0x47fb13){var _0x134bca=this;return new Promise(function(_0xae2a06,_0x4ff30b){return db[_0x0f15('0x16')]['create'](_0x47fb13[_0x0f15('0x17')],{'raw':_0x47fb13['options']?_0x47fb13[_0x0f15('0x18')][_0x0f15('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x45b7ed){logger[_0x0f15('0xc')]('CreateCmHopperHistory',_0x47fb13);logger[_0x0f15('0xd')]('CreateCmHopperHistory',_0x47fb13,JSON['stringify'](_0x45b7ed));_0xae2a06(_0x45b7ed);})[_0x0f15('0x14')](function(_0x5d5adf){logger['error']('CreateCmHopperHistory',_0x5d5adf[_0x0f15('0x12')],_0x47fb13);_0x4ff30b(_0x134bca[_0x0f15('0x10')](0x1f4,_0x5d5adf[_0x0f15('0x12')]));});});};exports[_0x0f15('0x1a')]=function(_0x159ba6){var _0xc1287b=this;return new Promise(function(_0x399044,_0x26008e){return db[_0x0f15('0x16')]['findAll']({'raw':_0x159ba6[_0x0f15('0x18')]?_0x159ba6[_0x0f15('0x18')][_0x0f15('0x19')]===undefined?!![]:![]:!![],'where':_0x159ba6['options']?_0x159ba6[_0x0f15('0x18')][_0x0f15('0x1b')]||null:null,'attributes':[[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')][_0x0f15('0x1e')]('id')),_0x0f15('0x1f')],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')]['literal'](_0x0f15('0x20')))),_0x0f15('0x21')],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')](_0x0f15('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x24'),db['sequelize']['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')](_0x0f15('0x25')))),'predictiveIntervalAvgHoldtime'],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x24'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x0f15('0x26')]]})[_0x0f15('0x27')](function(_0xf2a036){logger[_0x0f15('0xc')](_0x0f15('0x1a'),_0x159ba6);logger[_0x0f15('0xd')](_0x0f15('0x1a'),_0x159ba6,JSON[_0x0f15('0x28')](_0xf2a036));_0x399044(_0xf2a036);})[_0x0f15('0x14')](function(_0x434f2c){logger[_0x0f15('0x10')](_0x0f15('0x1a'),_0x434f2c[_0x0f15('0x12')],_0x159ba6);_0x26008e(_0xc1287b['error'](0x1f4,_0x434f2c[_0x0f15('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x50b319){var _0x437b81=this;return new Promise(function(_0x1240bb,_0x4d4903){return db[_0x0f15('0x16')]['findAll']({'raw':_0x50b319['options']?_0x50b319['options'][_0x0f15('0x19')]===undefined?!![]:![]:!![],'where':_0x50b319[_0x0f15('0x18')]?_0x50b319[_0x0f15('0x18')][_0x0f15('0x1b')]||null:null,'attributes':[[_0x0f15('0x29'),_0x0f15('0x2a')],[db['sequelize']['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')](_0x0f15('0x2b')))),'outboundNoSuchCallsDay'],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x0f15('0x2c')],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db['sequelize']['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')](_0x0f15('0x20')))),_0x0f15('0x2d')],[db['sequelize']['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')]['literal'](_0x0f15('0x2e')))),_0x0f15('0x2f')],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')](_0x0f15('0x30')))),_0x0f15('0x31')],[db[_0x0f15('0x1c')]['fn']('COUNT',db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')]['literal'](_0x0f15('0x32')))),_0x0f15('0x33')],[db['sequelize']['fn']('COUNT',db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')](_0x0f15('0x34')))),_0x0f15('0x35')],[db['sequelize']['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')]['literal']('`state`\x20=\x2013,\x201,\x20null'))),_0x0f15('0x36')],[db['sequelize']['fn'](_0x0f15('0x1d'),db['sequelize']['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')](_0x0f15('0x37')))),_0x0f15('0x38')],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db['sequelize']['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')](_0x0f15('0x39')))),'outboundRejectCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')](_0x0f15('0x3a')))),_0x0f15('0x3b')],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db['sequelize'][_0x0f15('0x22')]('`state`\x20=\x2020,\x201,\x20null'))),_0x0f15('0x3c')],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x0f15('0x22')](_0x0f15('0x3d')))),_0x0f15('0x3e')]],'group':[_0x0f15('0x29')]})['then'](function(_0x5156d0){logger[_0x0f15('0xc')](_0x0f15('0x3f'),_0x50b319);logger[_0x0f15('0xd')](_0x0f15('0x3f'),_0x50b319,JSON[_0x0f15('0x28')](_0x5156d0));_0x1240bb(_0x5156d0);})[_0x0f15('0x14')](function(_0x3d4eb0){logger[_0x0f15('0x10')](_0x0f15('0x3f'),_0x3d4eb0[_0x0f15('0x12')],_0x50b319);_0x4d4903(_0x437b81['error'](0x1f4,_0x3d4eb0[_0x0f15('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x1a187e){var _0x5bbd43=this;return new Promise(function(_0x19f9e9,_0x48f376){return db[_0x0f15('0x16')][_0x0f15('0x40')]({'raw':_0x1a187e[_0x0f15('0x18')]?_0x1a187e[_0x0f15('0x18')][_0x0f15('0x19')]===undefined?!![]:![]:!![],'where':_0x1a187e[_0x0f15('0x18')]?_0x1a187e[_0x0f15('0x18')][_0x0f15('0x1b')]||null:null,'attributes':[[_0x0f15('0x29'),_0x0f15('0x2a')],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')][_0x0f15('0x1e')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db['sequelize'][_0x0f15('0x22')](_0x0f15('0x20')))),_0x0f15('0x41')]],'group':[_0x0f15('0x29')]})[_0x0f15('0x27')](function(_0x6d780b){logger[_0x0f15('0xc')](_0x0f15('0x42'),_0x1a187e);logger[_0x0f15('0xd')](_0x0f15('0x42'),_0x1a187e,JSON[_0x0f15('0x28')](_0x6d780b));_0x19f9e9(_0x6d780b);})['catch'](function(_0x378ab4){logger[_0x0f15('0x10')](_0x0f15('0x42'),_0x378ab4[_0x0f15('0x12')],_0x1a187e);_0x48f376(_0x5bbd43[_0x0f15('0x10')](0x1f4,_0x378ab4[_0x0f15('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 33db07f..e81856d 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 _0xd77a=['/describe','describe','/:id','show','post','create','put','update','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index'];(function(_0x3b78e0,_0x57d297){var _0x4cdbac=function(_0x5236bc){while(--_0x5236bc){_0x3b78e0['push'](_0x3b78e0['shift']());}};_0x4cdbac(++_0x57d297);}(_0xd77a,0x10d));var _0xad77=function(_0x22f351,_0x13a411){_0x22f351=_0x22f351-0x0;var _0x29e7ae=_0xd77a[_0x22f351];return _0x29e7ae;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xad77('0x0'));var timeout=require('connect-timeout');var express=require(_0xad77('0x1'));var router=express[_0xad77('0x2')]();var fs_extra=require(_0xad77('0x3'));var auth=require(_0xad77('0x4'));var interaction=require(_0xad77('0x5'));var config=require(_0xad77('0x6'));var controller=require(_0xad77('0x7'));router[_0xad77('0x8')]('/',auth[_0xad77('0x9')](),controller[_0xad77('0xa')]);router['get'](_0xad77('0xb'),auth[_0xad77('0x9')](),controller[_0xad77('0xc')]);router[_0xad77('0x8')](_0xad77('0xd'),auth[_0xad77('0x9')](),controller[_0xad77('0xe')]);router[_0xad77('0xf')]('/',auth[_0xad77('0x9')](),controller[_0xad77('0x10')]);router[_0xad77('0x11')](_0xad77('0xd'),auth[_0xad77('0x9')](),controller[_0xad77('0x12')]);module[_0xad77('0x13')]=router; \ No newline at end of file +var _0x363f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/:id','show','post','put','update','exports','multer','util','path','connect-timeout'];(function(_0x3079c0,_0x44a3d0){var _0x36aa04=function(_0x2be58b){while(--_0x2be58b){_0x3079c0['push'](_0x3079c0['shift']());}};_0x36aa04(++_0x44a3d0);}(_0x363f,0x128));var _0xf363=function(_0x3c4844,_0x5ae4cf){_0x3c4844=_0x3c4844-0x0;var _0x1c8eef=_0x363f[_0x3c4844];return _0x1c8eef;};'use strict';var multer=require(_0xf363('0x0'));var util=require(_0xf363('0x1'));var path=require(_0xf363('0x2'));var timeout=require(_0xf363('0x3'));var express=require(_0xf363('0x4'));var router=express[_0xf363('0x5')]();var fs_extra=require(_0xf363('0x6'));var auth=require(_0xf363('0x7'));var interaction=require(_0xf363('0x8'));var config=require(_0xf363('0x9'));var controller=require(_0xf363('0xa'));router[_0xf363('0xb')]('/',auth[_0xf363('0xc')](),controller[_0xf363('0xd')]);router['get']('/describe',auth[_0xf363('0xc')](),controller['describe']);router['get'](_0xf363('0xe'),auth[_0xf363('0xc')](),controller[_0xf363('0xf')]);router[_0xf363('0x10')]('/',auth[_0xf363('0xc')](),controller['create']);router[_0xf363('0x11')](_0xf363('0xe'),auth['isAuthenticated'](),controller[_0xf363('0x12')]);module[_0xf363('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 1235148..adba8ae 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 _0x308a=['STRING','name','sequelize'];(function(_0x5e8993,_0xac2caf){var _0x25ba30=function(_0x471aeb){while(--_0x471aeb){_0x5e8993['push'](_0x5e8993['shift']());}};_0x25ba30(++_0xac2caf);}(_0x308a,0x71));var _0xa308=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x308a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa308('0x0'));module['exports']={'name':{'type':Sequelize[_0xa308('0x1')],'unique':_0xa308('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa308('0x1')]},'dialPrefix':{'type':Sequelize[_0xa308('0x1')]}}; \ No newline at end of file +var _0xdcf6=['exports','STRING','name'];(function(_0x161e4d,_0x4a70e0){var _0x40e2d6=function(_0x35f800){while(--_0x35f800){_0x161e4d['push'](_0x161e4d['shift']());}};_0x40e2d6(++_0x4a70e0);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x4b3da3,_0x7e6f6a){_0x4b3da3=_0x4b3da3-0x0;var _0x373c4f=_0xdcf6[_0x4b3da3];return _0x373c4f;};'use strict';var Sequelize=require('sequelize');module[_0x6dcf('0x0')]={'name':{'type':Sequelize[_0x6dcf('0x1')],'unique':_0x6dcf('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6dcf('0x1')]},'dialPrefix':{'type':Sequelize[_0x6dcf('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 6d034f9..54a9c22 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 _0x122d=['hasOwnProperty','ListId','findAll','ids','addContacts','CmContact','tags','isArray','push','each','omit','success','dataValues','errors','message','getContacts','CmCustomField','CustomFields','concat','format','raw','getContactsCsv','ContactItemType','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','alias','select','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','spread','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','undefined','limit','count','offset','Content-Range','json','apply','reject','update','destroy','then','get','Lists','status','end','error','name','send','index','CmList','type','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','Disposition','getDispositions','findOne'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x122d,0x18e));var _0xd122=function(_0x131a70,_0x5f53b2){_0x131a70=_0x131a70-0x0;var _0x212967=_0x122d[_0x131a70];return _0x212967;};'use strict';var emlformat=require(_0xd122('0x0'));var rimraf=require(_0xd122('0x1'));var zipdir=require(_0xd122('0x2'));var jsonpatch=require(_0xd122('0x3'));var rp=require('request-promise');var moment=require(_0xd122('0x4'));var BPromise=require(_0xd122('0x5'));var Mustache=require('mustache');var util=require(_0xd122('0x6'));var path=require('path');var sox=require(_0xd122('0x7'));var csv=require(_0xd122('0x8'));var ejs=require(_0xd122('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd122('0xa'));var crypto=require(_0xd122('0xb'));var jsforce=require(_0xd122('0xc'));var deskjs=require(_0xd122('0xd'));var toCsv=require(_0xd122('0x8'));var querystring=require(_0xd122('0xe'));var Papa=require(_0xd122('0xf'));var Redis=require(_0xd122('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd122('0x11'));var hardwareService=require(_0xd122('0x12'));var logger=require(_0xd122('0x13'))(_0xd122('0x14'));var utils=require(_0xd122('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd122('0x16'));var db=require(_0xd122('0x17'))['db'];var csv_results;config[_0xd122('0x18')]=_[_0xd122('0x19')](config[_0xd122('0x18')],{'host':_0xd122('0x1a'),'port':0x18eb});var socket=require(_0xd122('0x1b'))(new Redis(config[_0xd122('0x18')]));require(_0xd122('0x1c'))[_0xd122('0x1d')](socket);function respondWithStatusCode(_0x4668bc,_0x1d35da){_0x1d35da=_0x1d35da||0xcc;return function(_0x2bc054){if(_0x2bc054){return _0x4668bc[_0xd122('0x1e')](_0x1d35da);}return _0x4668bc['status'](_0x1d35da)['end']();};}function respondWithResult(_0x1eb7fd,_0x40c921){_0x40c921=_0x40c921||0xc8;return function(_0x39ba6f){if(_0x39ba6f){return _0x1eb7fd['status'](_0x40c921)['json'](_0x39ba6f);}};}function respondWithFilteredResult(_0x1fe290,_0x14a1cf){return function(_0x14b69a){if(_0x14b69a){var _0x3b06c1=typeof _0x14a1cf['offset']===_0xd122('0x1f')&&typeof _0x14a1cf[_0xd122('0x20')]===_0xd122('0x1f');var _0x31c21d=_0x14b69a[_0xd122('0x21')];var _0x4df0cc=_0x3b06c1?0x0:_0x14a1cf['offset'];var _0x155212=_0x3b06c1?_0x14b69a[_0xd122('0x21')]:_0x14a1cf[_0xd122('0x22')]+_0x14a1cf['limit'];var _0x13675a;if(_0x155212>=_0x31c21d){_0x155212=_0x31c21d;_0x13675a=0xc8;}else{_0x13675a=0xce;}_0x1fe290['status'](_0x13675a);return _0x1fe290['set'](_0xd122('0x23'),_0x4df0cc+'-'+_0x155212+'/'+_0x31c21d)[_0xd122('0x24')](_0x14b69a);}return null;};}function patchUpdates(_0x55f593){return function(_0x1559d2){try{jsonpatch[_0xd122('0x25')](_0x1559d2,_0x55f593,!![]);}catch(_0x43097b){return BPromise[_0xd122('0x26')](_0x43097b);}return _0x1559d2['save']();};}function saveUpdates(_0x1b20a2,_0x3c388b){return function(_0x5d8b3c){if(_0x5d8b3c){return _0x5d8b3c[_0xd122('0x27')](_0x1b20a2)['then'](function(_0x3aa0af){return _0x3aa0af;});}return null;};}function removeEntity(_0x56a6e4,_0x164280){return function(_0x196b87){if(_0x196b87){return _0x196b87[_0xd122('0x28')]()[_0xd122('0x29')](function(){var _0x23ebfd=_0x196b87[_0xd122('0x2a')]({'plain':!![]});var _0x6529c4=_0xd122('0x2b');return db['UserProfileResource'][_0xd122('0x28')]({'where':{'type':_0x6529c4,'resourceId':_0x23ebfd['id']}})[_0xd122('0x29')](function(){return _0x196b87;});})[_0xd122('0x29')](function(){_0x56a6e4[_0xd122('0x2c')](0xcc)[_0xd122('0x2d')]();});}};}function handleEntityNotFound(_0x3c3c03,_0x294065){return function(_0x32312b){if(!_0x32312b){_0x3c3c03[_0xd122('0x1e')](0x194);}return _0x32312b;};}function handleError(_0xba5da7,_0x112845){_0x112845=_0x112845||0x1f4;return function(_0x317632){logger[_0xd122('0x2e')](_0x317632['stack']);if(_0x317632[_0xd122('0x2f')]){delete _0x317632[_0xd122('0x2f')];}_0xba5da7[_0xd122('0x2c')](_0x112845)[_0xd122('0x30')](_0x317632);};}exports[_0xd122('0x31')]=function(_0x4bf9c7,_0x12a143){var _0x5cbce9={},_0x5c3db4={},_0x20e132={'count':0x0,'rows':[]};var _0x331efa=_['map'](db[_0xd122('0x32')]['rawAttributes'],function(_0x4633dc){return{'name':_0x4633dc['fieldName'],'type':_0x4633dc[_0xd122('0x33')]['key']};});_0x5c3db4[_0xd122('0x34')]=_[_0xd122('0x35')](_0x331efa,_0xd122('0x2f'));_0x5c3db4[_0xd122('0x36')]=_['keys'](_0x4bf9c7['query']);_0x5c3db4[_0xd122('0x37')]=_[_0xd122('0x38')](_0x5c3db4[_0xd122('0x34')],_0x5c3db4['query']);_0x5cbce9[_0xd122('0x39')]=_[_0xd122('0x38')](_0x5c3db4[_0xd122('0x34')],qs[_0xd122('0x3a')](_0x4bf9c7[_0xd122('0x36')]['fields']));_0x5cbce9[_0xd122('0x39')]=_0x5cbce9[_0xd122('0x39')][_0xd122('0x3b')]?_0x5cbce9[_0xd122('0x39')]:_0x5c3db4[_0xd122('0x34')];if(!_0x4bf9c7['query']['hasOwnProperty'](_0xd122('0x3c'))){_0x5cbce9['limit']=qs['limit'](_0x4bf9c7[_0xd122('0x36')][_0xd122('0x20')]);_0x5cbce9[_0xd122('0x22')]=qs[_0xd122('0x22')](_0x4bf9c7['query'][_0xd122('0x22')]);}_0x5cbce9['order']=qs[_0xd122('0x3d')](_0x4bf9c7[_0xd122('0x36')][_0xd122('0x3d')]);_0x5cbce9['where']=qs['filters'](_[_0xd122('0x3e')](_0x4bf9c7['query'],_0x5c3db4['filters']),_0x331efa);if(_0x4bf9c7[_0xd122('0x36')][_0xd122('0x3f')]){_0x5cbce9[_0xd122('0x40')]=_[_0xd122('0x41')](_0x5cbce9[_0xd122('0x40')],{'$or':_[_0xd122('0x35')](_0x331efa,function(_0x50c9b8){if(_0x50c9b8[_0xd122('0x33')]!==_0xd122('0x42')){var _0xcc7db0={};_0xcc7db0[_0x50c9b8[_0xd122('0x2f')]]={'$like':'%'+_0x4bf9c7[_0xd122('0x36')][_0xd122('0x3f')]+'%'};return _0xcc7db0;}})});}_0x5cbce9=_['merge']({},_0x5cbce9,_0x4bf9c7[_0xd122('0x43')]);var _0x292397={'where':_0x5cbce9[_0xd122('0x40')]};return db[_0xd122('0x32')]['count'](_0x292397)[_0xd122('0x29')](function(_0xcab2c8){_0x20e132[_0xd122('0x21')]=_0xcab2c8;if(_0x4bf9c7[_0xd122('0x36')]['includeAll']){_0x5cbce9[_0xd122('0x44')]=[{'all':!![]}];}return db[_0xd122('0x32')]['findAll'](_0x5cbce9);})[_0xd122('0x29')](function(_0x40bcb1){_0x20e132[_0xd122('0x45')]=_0x40bcb1;return _0x20e132;})['then'](respondWithFilteredResult(_0x12a143,_0x5cbce9))[_0xd122('0x46')](handleError(_0x12a143,null));};exports[_0xd122('0x47')]=function(_0x51d408,_0x29a529){var _0x2b4be8={'raw':![],'where':{'id':_0x51d408[_0xd122('0x48')]['id']}},_0x3f013e={};_0x3f013e[_0xd122('0x34')]=_[_0xd122('0x49')](db[_0xd122('0x32')][_0xd122('0x4a')]);_0x3f013e['query']=_[_0xd122('0x49')](_0x51d408[_0xd122('0x36')]);_0x3f013e[_0xd122('0x37')]=_[_0xd122('0x38')](_0x3f013e[_0xd122('0x34')],_0x3f013e[_0xd122('0x36')]);_0x2b4be8['attributes']=_['intersection'](_0x3f013e[_0xd122('0x34')],qs[_0xd122('0x3a')](_0x51d408[_0xd122('0x36')][_0xd122('0x3a')]));_0x2b4be8['attributes']=_0x2b4be8[_0xd122('0x39')][_0xd122('0x3b')]?_0x2b4be8[_0xd122('0x39')]:_0x3f013e[_0xd122('0x34')];if(_0x51d408['query'][_0xd122('0x4b')]){_0x2b4be8[_0xd122('0x44')]=[{'all':!![]}];}_0x2b4be8=_['merge']({},_0x2b4be8,_0x51d408[_0xd122('0x43')]);return db[_0xd122('0x32')][_0xd122('0x4c')](_0x2b4be8)['then'](handleEntityNotFound(_0x29a529,null))[_0xd122('0x29')](respondWithResult(_0x29a529,null))[_0xd122('0x46')](handleError(_0x29a529,null));};exports[_0xd122('0x4d')]=function(_0x10aa02,_0x565c2f){return db[_0xd122('0x32')][_0xd122('0x4d')](_0x10aa02[_0xd122('0x4e')],{})['then'](function(_0x37aace){var _0x24f0fa=_0x10aa02[_0xd122('0x4f')][_0xd122('0x2a')]({'plain':!![]});if(!_0x24f0fa)throw new Error(_0xd122('0x50'));if(_0x24f0fa[_0xd122('0x51')]===_0xd122('0x4f')){var _0x52210f=_0x37aace[_0xd122('0x2a')]({'plain':!![]});var _0x39bab3=_0xd122('0x2b');return db[_0xd122('0x52')][_0xd122('0x4c')]({'where':{'name':_0x39bab3,'userProfileId':_0x24f0fa[_0xd122('0x53')]},'raw':!![]})[_0xd122('0x29')](function(_0x3d9f55){if(_0x3d9f55&&_0x3d9f55[_0xd122('0x54')]===0x0){return db[_0xd122('0x55')]['create']({'name':_0x52210f[_0xd122('0x2f')],'resourceId':_0x52210f['id'],'type':_0x3d9f55[_0xd122('0x2f')],'sectionId':_0x3d9f55['id']},{})[_0xd122('0x29')](function(){return _0x37aace;});}else{return _0x37aace;}})[_0xd122('0x46')](function(_0x4283a5){logger[_0xd122('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4283a5);throw _0x4283a5;});}return _0x37aace;})['then'](respondWithResult(_0x565c2f,0xc9))[_0xd122('0x46')](handleError(_0x565c2f,null));};exports[_0xd122('0x27')]=function(_0x52265e,_0x3796b8){if(_0x52265e['body']['id']){delete _0x52265e[_0xd122('0x4e')]['id'];}return db[_0xd122('0x32')][_0xd122('0x4c')]({'where':{'id':_0x52265e['params']['id']}})['then'](handleEntityNotFound(_0x3796b8,null))[_0xd122('0x29')](saveUpdates(_0x52265e[_0xd122('0x4e')],null))[_0xd122('0x29')](respondWithResult(_0x3796b8,null))[_0xd122('0x46')](handleError(_0x3796b8,null));};exports[_0xd122('0x28')]=function(_0x2286af,_0x4528a3){return db[_0xd122('0x32')][_0xd122('0x4c')]({'where':{'id':_0x2286af[_0xd122('0x48')]['id']}})[_0xd122('0x29')](handleEntityNotFound(_0x4528a3,null))[_0xd122('0x29')](removeEntity(_0x4528a3,null))[_0xd122('0x46')](handleError(_0x4528a3,null));};exports[_0xd122('0x56')]=function(_0xf6c870,_0x49325a){return db[_0xd122('0x32')][_0xd122('0x56')]()['then'](respondWithResult(_0x49325a,null))[_0xd122('0x46')](handleError(_0x49325a,null));};exports[_0xd122('0x57')]=function(_0x171eba,_0x11c97a,_0x242cb8){if(_0x171eba[_0xd122('0x4e')]['id']){delete _0x171eba[_0xd122('0x4e')]['id'];}return db['CmList'][_0xd122('0x4c')]({'where':{'id':_0x171eba[_0xd122('0x48')]['id']}})[_0xd122('0x29')](handleEntityNotFound(_0x11c97a,null))[_0xd122('0x29')](function(_0x5b52bd){if(_0x5b52bd){_0x171eba['body']['ListId']=_0x5b52bd['id'];return db[_0xd122('0x58')]['create'](_0x171eba[_0xd122('0x4e')]);}})[_0xd122('0x29')](respondWithResult(_0x11c97a,null))['catch'](handleError(_0x11c97a,null));};exports[_0xd122('0x59')]=function(_0x5169c5,_0x133efc,_0x3f4cff){var _0x480a42={'raw':![],'where':{}};var _0x55bd2c={};var _0x58e223={'count':0x0,'rows':[]};return db[_0xd122('0x32')][_0xd122('0x5a')]({'where':{'id':_0x5169c5[_0xd122('0x48')]['id']}})[_0xd122('0x29')](handleEntityNotFound(_0x133efc,null))[_0xd122('0x29')](function(_0x52b07a){if(_0x52b07a){_0x55bd2c['model']=_[_0xd122('0x49')](db[_0xd122('0x58')]['rawAttributes']);_0x55bd2c[_0xd122('0x36')]=_[_0xd122('0x49')](_0x5169c5[_0xd122('0x36')]);_0x55bd2c[_0xd122('0x37')]=_['intersection'](_0x55bd2c[_0xd122('0x34')],_0x55bd2c[_0xd122('0x36')]);_0x480a42[_0xd122('0x39')]=_['intersection'](_0x55bd2c['model'],qs[_0xd122('0x3a')](_0x5169c5['query'][_0xd122('0x3a')]));_0x480a42[_0xd122('0x39')]=_0x480a42[_0xd122('0x39')][_0xd122('0x3b')]?_0x480a42[_0xd122('0x39')]:_0x55bd2c[_0xd122('0x34')];if(!_0x5169c5[_0xd122('0x36')][_0xd122('0x5b')](_0xd122('0x3c'))){_0x480a42[_0xd122('0x20')]=qs[_0xd122('0x20')](_0x5169c5[_0xd122('0x36')][_0xd122('0x20')]);_0x480a42[_0xd122('0x22')]=qs[_0xd122('0x22')](_0x5169c5[_0xd122('0x36')]['offset']);}_0x480a42['order']=qs[_0xd122('0x3d')](_0x5169c5[_0xd122('0x36')]['sort']);_0x480a42[_0xd122('0x40')]=qs['filters'](_[_0xd122('0x3e')](_0x5169c5[_0xd122('0x36')],_0x55bd2c['filters']));_0x480a42[_0xd122('0x40')][_0xd122('0x5c')]=_0x52b07a['id'];if(_0x5169c5[_0xd122('0x36')][_0xd122('0x3f')]){_0x480a42[_0xd122('0x40')]=_[_0xd122('0x41')](_0x480a42['where'],{'$or':_['map'](_0x480a42['attributes'],function(_0xa2e132){var _0x20d54a={};_0x20d54a[_0xa2e132]={'$like':'%'+_0x5169c5[_0xd122('0x36')][_0xd122('0x3f')]+'%'};return _0x20d54a;})});}_0x480a42=_[_0xd122('0x41')]({},_0x480a42,_0x5169c5[_0xd122('0x43')]);return db[_0xd122('0x58')][_0xd122('0x21')]({'where':_0x480a42[_0xd122('0x40')]})[_0xd122('0x29')](function(_0x357f4a){_0x58e223['count']=_0x357f4a;if(_0x5169c5[_0xd122('0x36')][_0xd122('0x4b')]){_0x480a42['include']=[{'all':!![]}];}return db[_0xd122('0x58')][_0xd122('0x5d')](_0x480a42);})[_0xd122('0x29')](function(_0x21ee1c){_0x58e223[_0xd122('0x45')]=_0x21ee1c;return _0x58e223;});}})[_0xd122('0x29')](respondWithFilteredResult(_0x133efc,_0x480a42))['catch'](handleError(_0x133efc,null));};exports['removeDispositions']=function(_0x1f0111,_0x561a3c,_0x2ba28c){return db[_0xd122('0x32')][_0xd122('0x4c')]({'where':{'id':_0x1f0111[_0xd122('0x48')]['id']}})[_0xd122('0x29')](handleEntityNotFound(_0x561a3c,null))[_0xd122('0x29')](function(_0x2687c8){if(_0x2687c8){return _0x2687c8['removeDispositions'](_0x1f0111['query'][_0xd122('0x5e')]);}})[_0xd122('0x29')](respondWithStatusCode(_0x561a3c,null))[_0xd122('0x46')](handleError(_0x561a3c,null));};exports[_0xd122('0x5f')]=function(_0x33ba2f,_0x71ad9a,_0x5f1a65){return db[_0xd122('0x32')][_0xd122('0x4c')]({'where':{'id':_0x33ba2f[_0xd122('0x48')]['id']}})['then'](handleEntityNotFound(_0x71ad9a,null))['then'](function(_0x156d32){if(_0x156d32){var _0x19f604=[];var _0x41b887={'success':[],'errors':[]};return db[_0xd122('0x60')][_0xd122('0x56')]()[_0xd122('0x29')](function(_0x1b3a45){if(_0x33ba2f[_0xd122('0x4e')][_0xd122('0x61')]&&_[_0xd122('0x62')](_0x33ba2f[_0xd122('0x4e')]['tags'])){if(_0x33ba2f[_0xd122('0x4e')][_0xd122('0x61')][_0xd122('0x3b')]){_0x33ba2f['body'][_0xd122('0x61')]=_0x33ba2f[_0xd122('0x4e')][_0xd122('0x61')]['join'](';')+';';}else{_0x33ba2f[_0xd122('0x4e')]['tags']=null;}}else{_0x33ba2f[_0xd122('0x4e')][_0xd122('0x61')]=null;}if(_0x33ba2f['body']&&_[_0xd122('0x62')](_0x33ba2f[_0xd122('0x4e')])){for(var _0x344e91=0x0;_0x344e91<_0x33ba2f[_0xd122('0x4e')][_0xd122('0x3b')];_0x344e91+=0x1){_0x33ba2f[_0xd122('0x4e')][_0x344e91][_0xd122('0x5c')]=_0x33ba2f[_0xd122('0x48')]['id'];_0x19f604[_0xd122('0x63')](_0x33ba2f[_0xd122('0x4e')][_0x344e91]);}return BPromise[_0xd122('0x64')](_0x19f604,function(_0xad267){return db['CmContact'][_0xd122('0x4d')](_[_0xd122('0x65')](_0xad267,['ids','id'])||{},{'fields':_[_0xd122('0x49')](_0x1b3a45),'raw':!![]})[_0xd122('0x29')](function(_0x38b518){_0x41b887[_0xd122('0x66')][_0xd122('0x63')](_0x38b518[_0xd122('0x67')]);})[_0xd122('0x46')](function(_0x44a7ad){_0x41b887[_0xd122('0x68')][_0xd122('0x63')]({'data':_0xad267,'error':_0x44a7ad[_0xd122('0x69')]});});})[_0xd122('0x29')](function(_0x1a2777){return _0x41b887;})['catch'](function(_0x4e3178){return _0x4e3178;});}else{_0x71ad9a[_0xd122('0x2c')](0x190)[_0xd122('0x24')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xd122('0x29')](respondWithResult(_0x71ad9a,null))[_0xd122('0x46')](handleError(_0x71ad9a,null));};exports[_0xd122('0x6a')]=function(_0x1f00df,_0x3cd1d0,_0x4e359b){var _0x47712e;return db[_0xd122('0x32')][_0xd122('0x4c')]({'where':{'id':_0x1f00df['params']['id']},'include':[{'model':db[_0xd122('0x6b')],'as':_0xd122('0x6c')}]})[_0xd122('0x29')](handleEntityNotFound(_0x3cd1d0,null))[_0xd122('0x29')](function(_0x2c472d){if(_0x2c472d){_0x47712e=_0x2c472d;return db[_0xd122('0x60')][_0xd122('0x4a')];}})[_0xd122('0x29')](function(_0x43ccea){if(_0x43ccea){var _0x22f9aa={};var _0x2d513f={};_0x2d513f[_0xd122('0x34')]=_[_0xd122('0x6d')](_['keys'](_0x43ccea),_[_0xd122('0x35')](_0x47712e[_0xd122('0x6c')],function(_0x46dd83){return util[_0xd122('0x6e')]('cf_%d',_0x46dd83['id']);}));_0x2d513f[_0xd122('0x36')]=_[_0xd122('0x49')](_0x1f00df[_0xd122('0x36')]);_0x2d513f['filters']=_[_0xd122('0x38')](_0x2d513f[_0xd122('0x34')],_0x2d513f[_0xd122('0x36')]);_0x22f9aa['attributes']=_['intersection'](_0x2d513f['model'],qs[_0xd122('0x3a')](_0x1f00df[_0xd122('0x36')][_0xd122('0x3a')]));_0x22f9aa[_0xd122('0x39')]=_0x22f9aa[_0xd122('0x39')][_0xd122('0x3b')]?_0x22f9aa[_0xd122('0x39')]:_0x2d513f[_0xd122('0x34')];if(!_0x1f00df[_0xd122('0x36')][_0xd122('0x5b')]('nolimit')){_0x22f9aa[_0xd122('0x20')]=qs['limit'](_0x1f00df[_0xd122('0x36')]['limit']);_0x22f9aa[_0xd122('0x22')]=qs[_0xd122('0x22')](_0x1f00df['query']['offset']);}_0x22f9aa['order']=qs[_0xd122('0x3d')](_0x1f00df[_0xd122('0x36')][_0xd122('0x3d')]);_0x22f9aa[_0xd122('0x40')]=qs[_0xd122('0x37')](_[_0xd122('0x3e')](_0x1f00df[_0xd122('0x36')],_0x2d513f[_0xd122('0x37')]));_0x22f9aa[_0xd122('0x6f')]=!![];if(_0x1f00df['query'][_0xd122('0x3f')]){_0x22f9aa[_0xd122('0x40')]=_[_0xd122('0x41')](_0x22f9aa['where'],{'$or':_[_0xd122('0x35')](_0x22f9aa[_0xd122('0x39')],function(_0xb4c772){var _0x1f55c1={};_0x1f55c1[_0xb4c772]={'$like':'%'+_0x1f00df[_0xd122('0x36')][_0xd122('0x3f')]+'%'};return _0x1f55c1;})});}_0x22f9aa=_[_0xd122('0x41')]({},_0x22f9aa,_0x1f00df['options']);return _0x47712e[_0xd122('0x6a')](_0x22f9aa);}})[_0xd122('0x29')](respondWithResult(_0x3cd1d0,null))['catch'](handleError(_0x3cd1d0,null));};exports[_0xd122('0x70')]=function(_0x429d17,_0x20c7a0,_0x2c7d5f){var _0x76f234;var _0x2cd5c8;var _0xe8e0a;var _0x688de3=_0x429d17[_0xd122('0x48')]['id'];csv_results=[];return db[_0xd122('0x71')][_0xd122('0x5d')]({'attributes':['id','name'],'raw':!![],'order':['OrderBy']})[_0xd122('0x29')](function(_0x39dde2){_0x76f234=_0x39dde2;var _0x2d7759=_[_0xd122('0x49')](db[_0xd122('0x60')][_0xd122('0x4a')]);return db['CmCustomField'][_0xd122('0x5d')]({'raw':!![],'attributes':['id','alias']})[_0xd122('0x29')](function(_0x32f0f5){_0x2cd5c8=_0x32f0f5;var _0x532894=squel['select']()[_0xd122('0x3a')](_0x2d7759)[_0xd122('0x72')](_0xd122('0x73'),'c')[_0xd122('0x40')](_0xd122('0x74'),_0x688de3)['where'](_0xd122('0x75'))[_0xd122('0x76')]();for(var _0x2a70a6=0x0;_0x2a70a6<_0x2cd5c8[_0xd122('0x3b')];_0x2a70a6++){_0x532894[_0xd122('0x77')]('c.cf_'+_0x2cd5c8[_0x2a70a6]['id'],'customField_'+_0x2cd5c8[_0x2a70a6][_0xd122('0x78')]);}for(var _0x2a70a6=0x0;_0x2a70a6<_0x76f234[_0xd122('0x3b')];_0x2a70a6++){_0x532894[_0xd122('0x77')](squel[_0xd122('0x79')]()[_0xd122('0x77')](_0xd122('0x7a'))[_0xd122('0x72')](_0xd122('0x7b'))[_0xd122('0x40')](_0xd122('0x7c'),_0x76f234[_0x2a70a6]['id'])[_0xd122('0x40')](_0xd122('0x7d')),_0xd122('0x7e')+_0x76f234[_0x2a70a6][_0xd122('0x2f')]);_0x532894[_0xd122('0x77')](squel[_0xd122('0x79')]()[_0xd122('0x77')](_0xd122('0x7f'))['from'](_0xd122('0x7b'))[_0xd122('0x40')](_0xd122('0x7c'),_0x76f234[_0x2a70a6]['id'])['where'](_0xd122('0x7d')),_0xd122('0x80')+_0x76f234[_0x2a70a6][_0xd122('0x2f')]);}var _0x280d21=[];_0x280d21[_0xd122('0x63')](_0x532894[_0xd122('0x81')]());BPromise['each'](_0x280d21,handleQuery)[_0xd122('0x29')](function(_0x3dd5e2){handleQuery(_0x532894[_0xd122('0x81')]());var _0x4e5dcc=csv_results[0x0];if(!_[_0xd122('0x82')](_0x4e5dcc)){var _0x1a893e=toCsv(_0x4e5dcc);var _0x44452a=Date[_0xd122('0x83')]();fs[_0xd122('0x84')](util[_0xd122('0x6e')](_0xd122('0x85'),_0x688de3,_0x44452a),_0x1a893e);_0x20c7a0[_0xd122('0x86')]('Content-disposition','attachment;\x20filename='+util[_0xd122('0x6e')](_0xd122('0x87'),_0x688de3,_0x44452a));_0x20c7a0['setHeader'](_0xd122('0x88'),_0xd122('0x89'));return _0x20c7a0['download'](util[_0xd122('0x6e')](_0xd122('0x85'),_0x688de3,_0x44452a));}else{return _0x20c7a0[_0xd122('0x1e')](0xcc);}});});});};exports[_0xd122('0x8a')]=function(_0xad17ca,_0x448ae0,_0x125112){var _0x15184a;delete _0xad17ca[_0xd122('0x4e')]['id'];return db[_0xd122('0x32')]['findOne']({'where':{'id':_0xad17ca['params']['id']}})['then'](handleEntityNotFound(_0x448ae0,null))[_0xd122('0x29')](function(_0xa826c4){if(_0xa826c4){return db[_0xd122('0x8b')][_0xd122('0x8c')](function(_0x47b1f5){return db['CmCustomField'][_0xd122('0x4d')](_0xad17ca[_0xd122('0x4e')],{'transaction':_0x47b1f5})[_0xd122('0x29')](function(_0x5371dd){_0x15184a=_0x5371dd;return _0xa826c4[_0xd122('0x8d')](_0x5371dd,{'transaction':_0x47b1f5});})[_0xd122('0x29')](function(){var _0x15b217={'type':db[_0xd122('0x8e')][_0xd122('0x8f')],'transaction':_0x47b1f5};switch(_0xad17ca[_0xd122('0x4e')][_0xd122('0x33')]){case _0xd122('0x90'):_0x15b217['type']=db['Sequelize'][_0xd122('0x8f')];break;case _0xd122('0x91'):_0x15b217[_0xd122('0x33')]=db['Sequelize'][_0xd122('0x92')];break;case _0xd122('0x93'):_0x15b217[_0xd122('0x33')]=db['Sequelize'][_0xd122('0x94')];_0x15b217[_0xd122('0x95')]=![];break;default:}return db[_0xd122('0x8b')][_0xd122('0x96')][_0xd122('0x97')](_0xd122('0x73'),util[_0xd122('0x6e')]('cf_%s',_0x15184a['id']),_0x15b217);})[_0xd122('0x29')](function(){return _0x15184a;});});}})['then'](respondWithResult(_0x448ae0,null))[_0xd122('0x46')](handleError(_0x448ae0,null));};exports[_0xd122('0x98')]=function(_0xa4a789,_0x159082,_0x1ccefd){var _0x30addc={};var _0x2ae8fb={};var _0x18102d;var _0x12c9b7;return db[_0xd122('0x32')][_0xd122('0x5a')]({'where':{'id':_0xa4a789[_0xd122('0x48')]['id']}})[_0xd122('0x29')](handleEntityNotFound(_0x159082,null))['then'](function(_0x4f6666){if(_0x4f6666){_0x18102d=_0x4f6666;_0x2ae8fb[_0xd122('0x34')]=_[_0xd122('0x49')](db['CmCustomField'][_0xd122('0x4a')]);_0x2ae8fb[_0xd122('0x36')]=_[_0xd122('0x49')](_0xa4a789['query']);_0x2ae8fb[_0xd122('0x37')]=_['intersection'](_0x2ae8fb[_0xd122('0x34')],_0x2ae8fb['query']);_0x30addc[_0xd122('0x39')]=_[_0xd122('0x38')](_0x2ae8fb[_0xd122('0x34')],qs[_0xd122('0x3a')](_0xa4a789[_0xd122('0x36')][_0xd122('0x3a')]));_0x30addc[_0xd122('0x39')]=_0x30addc[_0xd122('0x39')][_0xd122('0x3b')]?_0x30addc[_0xd122('0x39')]:_0x2ae8fb[_0xd122('0x34')];_0x30addc['order']=qs[_0xd122('0x3d')](_0xa4a789['query'][_0xd122('0x3d')]);_0x30addc[_0xd122('0x40')]=qs['filters'](_[_0xd122('0x3e')](_0xa4a789['query'],_0x2ae8fb[_0xd122('0x37')]));_0x30addc[_0xd122('0x40')]=_['merge'](_0x30addc['where'],{'$or':[{'ListId':_0x4f6666['id']},{'ListId':null}]});if(_0xa4a789[_0xd122('0x36')][_0xd122('0x3f')]){_0x30addc[_0xd122('0x40')]=_[_0xd122('0x41')](_0x30addc['where'],{'$or':_[_0xd122('0x35')](_0x30addc[_0xd122('0x39')],function(_0x1f15a1){var _0xa8c146={};_0xa8c146[_0x1f15a1]={'$like':'%'+_0xa4a789['query']['filter']+'%'};return _0xa8c146;})});}_0x30addc=_[_0xd122('0x41')]({},_0x30addc,_0xa4a789[_0xd122('0x43')]);return db['CmCustomField'][_0xd122('0x99')](_0x30addc);}})[_0xd122('0x29')](respondWithResult(_0x159082,null))[_0xd122('0x46')](handleError(_0x159082,null));};exports[_0xd122('0x9a')]=function(_0x40a865,_0x291c78){return db['CmCustomField'][_0xd122('0x99')]({'where':{'ListId':null}})[_0xd122('0x29')](handleEntityNotFound(_0x291c78,null))['then'](function(_0x1d12d7){return _0x1d12d7;})[_0xd122('0x29')](respondWithResult(_0x291c78,null))[_0xd122('0x46')](handleError(_0x291c78,null));};exports[_0xd122('0x9b')]=function(_0x62deae,_0x404cfc,_0xef3ad8){return db[_0xd122('0x32')][_0xd122('0x4c')]({'where':{'id':_0x62deae[_0xd122('0x48')]['id']}})[_0xd122('0x29')](handleEntityNotFound(_0x404cfc,null))[_0xd122('0x29')](function(_0x4074cd){if(_0x4074cd){return _0x4074cd['addAgents'](_0x62deae['body']['ids'],_[_0xd122('0x65')](_0x62deae[_0xd122('0x4e')],[_0xd122('0x5e'),'id'])||{})['spread'](function(_0x5708d3){for(var _0x26ccab=0x0;_0x26ccab<_0x62deae[_0xd122('0x4e')]['ids'][_0xd122('0x3b')];_0x26ccab+=0x1){socket['emit'](_0xd122('0x9c'),{'UserId':Number(_0x62deae[_0xd122('0x4e')]['ids'][_0x26ccab]),'CmListId':Number(_0x62deae[_0xd122('0x48')]['id'])});}return _0x5708d3;});}})[_0xd122('0x29')](respondWithResult(_0x404cfc,null))[_0xd122('0x46')](handleError(_0x404cfc,null));};exports[_0xd122('0x9d')]=function(_0x50f135,_0x7adbb0,_0x2d4cc2){return db[_0xd122('0x32')]['find']({'where':{'id':_0x50f135[_0xd122('0x48')]['id']}})['then'](handleEntityNotFound(_0x7adbb0,null))['then'](function(_0x42adaf){if(_0x42adaf){return _0x42adaf[_0xd122('0x9d')](_0x50f135[_0xd122('0x36')][_0xd122('0x5e')])['then'](function(){if(_[_0xd122('0x62')](_0x50f135[_0xd122('0x36')][_0xd122('0x5e')])){for(var _0x1ea44b=0x0;_0x1ea44b<_0x50f135[_0xd122('0x36')][_0xd122('0x5e')][_0xd122('0x3b')];_0x1ea44b+=0x1){socket[_0xd122('0x9e')](_0xd122('0x9f'),{'UserId':Number(_0x50f135[_0xd122('0x36')][_0xd122('0x5e')][_0x1ea44b]),'CmListId':Number(_0x50f135[_0xd122('0x48')]['id'])});}}else{socket[_0xd122('0x9e')](_0xd122('0x9f'),{'UserId':Number(_0x50f135['query'][_0xd122('0x5e')]),'CmListId':Number(_0x50f135['params']['id'])});}});}})[_0xd122('0x29')](respondWithStatusCode(_0x7adbb0,null))['catch'](handleError(_0x7adbb0,null));};exports[_0xd122('0xa0')]=function(_0x116290,_0x343891,_0x34a65e){var _0x2d9c2d={};var _0x25e724={};var _0x2f5580;var _0x16591c;return db[_0xd122('0x32')][_0xd122('0x5a')]({'where':{'id':_0x116290[_0xd122('0x48')]['id']}})[_0xd122('0x29')](handleEntityNotFound(_0x343891,null))[_0xd122('0x29')](function(_0x2877ac){if(_0x2877ac){_0x2f5580=_0x2877ac;_0x25e724[_0xd122('0x34')]=_[_0xd122('0x49')](db[_0xd122('0xa1')][_0xd122('0x4a')]);_0x25e724[_0xd122('0x36')]=_['keys'](_0x116290[_0xd122('0x36')]);_0x25e724[_0xd122('0x37')]=_['intersection'](_0x25e724[_0xd122('0x34')],_0x25e724[_0xd122('0x36')]);_0x2d9c2d[_0xd122('0x39')]=_[_0xd122('0x38')](_0x25e724['model'],qs[_0xd122('0x3a')](_0x116290[_0xd122('0x36')][_0xd122('0x3a')]));_0x2d9c2d[_0xd122('0x39')]=_0x2d9c2d[_0xd122('0x39')][_0xd122('0x3b')]?_0x2d9c2d[_0xd122('0x39')]:_0x25e724[_0xd122('0x34')];_0x2d9c2d['order']=qs['sort'](_0x116290[_0xd122('0x36')]['sort']);_0x2d9c2d[_0xd122('0x40')]=qs[_0xd122('0x37')](_[_0xd122('0x3e')](_0x116290[_0xd122('0x36')],_0x25e724['filters']));if(_0x116290[_0xd122('0x36')][_0xd122('0x3f')]){_0x2d9c2d[_0xd122('0x40')]=_[_0xd122('0x41')](_0x2d9c2d[_0xd122('0x40')],{'$or':_['map'](_0x2d9c2d[_0xd122('0x39')],function(_0x16d2cb){var _0x5f37de={};_0x5f37de[_0x16d2cb]={'$like':'%'+_0x116290[_0xd122('0x36')]['filter']+'%'};return _0x5f37de;})});}_0x2d9c2d=_[_0xd122('0x41')]({},_0x2d9c2d,_0x116290[_0xd122('0x43')]);return _0x2f5580[_0xd122('0xa0')](_0x2d9c2d);}})[_0xd122('0x29')](function(_0x385171){if(_0x385171){_0x16591c=_0x385171[_0xd122('0x3b')];if(!_0x116290['query']['hasOwnProperty'](_0xd122('0x3c'))){_0x2d9c2d[_0xd122('0x20')]=qs[_0xd122('0x20')](_0x116290[_0xd122('0x36')][_0xd122('0x20')]);_0x2d9c2d[_0xd122('0x22')]=qs['offset'](_0x116290[_0xd122('0x36')]['offset']);}return _0x2f5580['getAgents'](_0x2d9c2d);}})[_0xd122('0x29')](function(_0x125fc7){if(_0x125fc7){return _0x125fc7?{'count':_0x16591c,'rows':_0x125fc7}:null;}})[_0xd122('0x29')](respondWithResult(_0x343891,null))[_0xd122('0x46')](handleError(_0x343891,null));};function handleQuery(_0x2fef6f){logger['info'](_0x2fef6f);return db['sequelize']['query'](_0x2fef6f)[_0xd122('0xa2')](function(_0x5e1418){csv_results[_0xd122('0x63')](_0x5e1418);})[_0xd122('0x46')](function(_0x515c0d){logger[_0xd122('0x2e')](_0x515c0d[_0xd122('0x69')]);});} \ No newline at end of file +var _0x4762=['reject','save','update','destroy','then','get','Lists','UserProfileResource','error','stack','name','send','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','include','rows','show','params','length','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','ListId','merge','findAll','removeDispositions','ids','addContacts','CmContact','isArray','tags','each','omit','success','push','dataValues','Malformed\x20request\x20syntax','CustomFields','format','cf_%d','getContacts','OrderBy','CmCustomField','alias','select','from','cm_contacts','c.ListId\x20=\x20?','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cf_%s','getCustomFields','findOne','findAndCountAll','getGlobalCustomFields','addAgents','userCmList:save','userCmList:remove','emit','getAgents','info','spread','message','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x4762,0x7a));var _0x2476=function(_0x356628,_0x534c29){_0x356628=_0x356628-0x0;var _0x2d8f2d=_0x4762[_0x356628];return _0x2d8f2d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2476('0x0'));var jsonpatch=require(_0x2476('0x1'));var rp=require(_0x2476('0x2'));var moment=require(_0x2476('0x3'));var BPromise=require(_0x2476('0x4'));var Mustache=require('mustache');var util=require(_0x2476('0x5'));var path=require(_0x2476('0x6'));var sox=require(_0x2476('0x7'));var csv=require(_0x2476('0x8'));var ejs=require(_0x2476('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2476('0xa'));var squel=require(_0x2476('0xb'));var crypto=require(_0x2476('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2476('0x8'));var querystring=require('querystring');var Papa=require(_0x2476('0xd'));var Redis=require(_0x2476('0xe'));var authService=require(_0x2476('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2476('0x10'));var hardwareService=require(_0x2476('0x11'));var logger=require(_0x2476('0x12'))(_0x2476('0x13'));var utils=require('../../config/utils');var config=require(_0x2476('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2476('0x15'))['db'];var csv_results;config[_0x2476('0x16')]=_[_0x2476('0x17')](config[_0x2476('0x16')],{'host':_0x2476('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2476('0x16')]));require(_0x2476('0x19'))[_0x2476('0x1a')](socket);function respondWithStatusCode(_0x5cd367,_0x213c27){_0x213c27=_0x213c27||0xcc;return function(_0x561e55){if(_0x561e55){return _0x5cd367[_0x2476('0x1b')](_0x213c27);}return _0x5cd367[_0x2476('0x1c')](_0x213c27)[_0x2476('0x1d')]();};}function respondWithResult(_0x2fcc83,_0x1d78eb){_0x1d78eb=_0x1d78eb||0xc8;return function(_0x26460e){if(_0x26460e){return _0x2fcc83[_0x2476('0x1c')](_0x1d78eb)['json'](_0x26460e);}};}function respondWithFilteredResult(_0x32d57e,_0xf3276){return function(_0x5c1cb8){if(_0x5c1cb8){var _0x25e207=typeof _0xf3276[_0x2476('0x1e')]===_0x2476('0x1f')&&typeof _0xf3276[_0x2476('0x20')]===_0x2476('0x1f');var _0x10581f=_0x5c1cb8[_0x2476('0x21')];var _0x312285=_0x25e207?0x0:_0xf3276[_0x2476('0x1e')];var _0x4cd230=_0x25e207?_0x5c1cb8[_0x2476('0x21')]:_0xf3276[_0x2476('0x1e')]+_0xf3276['limit'];var _0x580bb6;if(_0x4cd230>=_0x10581f){_0x4cd230=_0x10581f;_0x580bb6=0xc8;}else{_0x580bb6=0xce;}_0x32d57e[_0x2476('0x1c')](_0x580bb6);return _0x32d57e[_0x2476('0x22')]('Content-Range',_0x312285+'-'+_0x4cd230+'/'+_0x10581f)[_0x2476('0x23')](_0x5c1cb8);}return null;};}function patchUpdates(_0x39535e){return function(_0x194f25){try{jsonpatch[_0x2476('0x24')](_0x194f25,_0x39535e,!![]);}catch(_0x4b21c3){return BPromise[_0x2476('0x25')](_0x4b21c3);}return _0x194f25[_0x2476('0x26')]();};}function saveUpdates(_0x39e2aa,_0x3d2138){return function(_0x597c62){if(_0x597c62){return _0x597c62[_0x2476('0x27')](_0x39e2aa)['then'](function(_0x1ac050){return _0x1ac050;});}return null;};}function removeEntity(_0x2f9843,_0x3b7c8d){return function(_0x1f0ee5){if(_0x1f0ee5){return _0x1f0ee5[_0x2476('0x28')]()[_0x2476('0x29')](function(){var _0x5e0002=_0x1f0ee5[_0x2476('0x2a')]({'plain':!![]});var _0x18a33d=_0x2476('0x2b');return db[_0x2476('0x2c')][_0x2476('0x28')]({'where':{'type':_0x18a33d,'resourceId':_0x5e0002['id']}})[_0x2476('0x29')](function(){return _0x1f0ee5;});})[_0x2476('0x29')](function(){_0x2f9843['status'](0xcc)[_0x2476('0x1d')]();});}};}function handleEntityNotFound(_0x56bade,_0x5d2f4a){return function(_0x291e42){if(!_0x291e42){_0x56bade[_0x2476('0x1b')](0x194);}return _0x291e42;};}function handleError(_0x5d2512,_0x2902ad){_0x2902ad=_0x2902ad||0x1f4;return function(_0x453ef2){logger[_0x2476('0x2d')](_0x453ef2[_0x2476('0x2e')]);if(_0x453ef2[_0x2476('0x2f')]){delete _0x453ef2[_0x2476('0x2f')];}_0x5d2512[_0x2476('0x1c')](_0x2902ad)[_0x2476('0x30')](_0x453ef2);};}exports['index']=function(_0x1e494f,_0x830693){var _0x3ad2a3={},_0xb22c34={},_0x3bb73b={'count':0x0,'rows':[]};var _0x584310=_[_0x2476('0x31')](db[_0x2476('0x32')][_0x2476('0x33')],function(_0x544fe7){return{'name':_0x544fe7[_0x2476('0x34')],'type':_0x544fe7[_0x2476('0x35')][_0x2476('0x36')]};});_0xb22c34[_0x2476('0x37')]=_[_0x2476('0x31')](_0x584310,_0x2476('0x2f'));_0xb22c34[_0x2476('0x38')]=_[_0x2476('0x39')](_0x1e494f[_0x2476('0x38')]);_0xb22c34[_0x2476('0x3a')]=_[_0x2476('0x3b')](_0xb22c34[_0x2476('0x37')],_0xb22c34['query']);_0x3ad2a3[_0x2476('0x3c')]=_['intersection'](_0xb22c34[_0x2476('0x37')],qs[_0x2476('0x3d')](_0x1e494f[_0x2476('0x38')]['fields']));_0x3ad2a3[_0x2476('0x3c')]=_0x3ad2a3[_0x2476('0x3c')]['length']?_0x3ad2a3[_0x2476('0x3c')]:_0xb22c34[_0x2476('0x37')];if(!_0x1e494f[_0x2476('0x38')][_0x2476('0x3e')](_0x2476('0x3f'))){_0x3ad2a3[_0x2476('0x20')]=qs[_0x2476('0x20')](_0x1e494f['query'][_0x2476('0x20')]);_0x3ad2a3['offset']=qs[_0x2476('0x1e')](_0x1e494f[_0x2476('0x38')][_0x2476('0x1e')]);}_0x3ad2a3[_0x2476('0x40')]=qs[_0x2476('0x41')](_0x1e494f[_0x2476('0x38')][_0x2476('0x41')]);_0x3ad2a3[_0x2476('0x42')]=qs[_0x2476('0x3a')](_[_0x2476('0x43')](_0x1e494f[_0x2476('0x38')],_0xb22c34[_0x2476('0x3a')]),_0x584310);if(_0x1e494f['query'][_0x2476('0x44')]){_0x3ad2a3[_0x2476('0x42')]=_['merge'](_0x3ad2a3[_0x2476('0x42')],{'$or':_['map'](_0x584310,function(_0x213f53){if(_0x213f53['type']!=='VIRTUAL'){var _0x4b3261={};_0x4b3261[_0x213f53[_0x2476('0x2f')]]={'$like':'%'+_0x1e494f[_0x2476('0x38')][_0x2476('0x44')]+'%'};return _0x4b3261;}})});}_0x3ad2a3=_['merge']({},_0x3ad2a3,_0x1e494f[_0x2476('0x45')]);var _0x509f7a={'where':_0x3ad2a3[_0x2476('0x42')]};return db[_0x2476('0x32')][_0x2476('0x21')](_0x509f7a)['then'](function(_0x260da7){_0x3bb73b[_0x2476('0x21')]=_0x260da7;if(_0x1e494f[_0x2476('0x38')]['includeAll']){_0x3ad2a3[_0x2476('0x46')]=[{'all':!![]}];}return db[_0x2476('0x32')]['findAll'](_0x3ad2a3);})[_0x2476('0x29')](function(_0x38709c){_0x3bb73b[_0x2476('0x47')]=_0x38709c;return _0x3bb73b;})[_0x2476('0x29')](respondWithFilteredResult(_0x830693,_0x3ad2a3))['catch'](handleError(_0x830693,null));};exports[_0x2476('0x48')]=function(_0x4d8038,_0x3358bc){var _0x18bd29={'raw':![],'where':{'id':_0x4d8038[_0x2476('0x49')]['id']}},_0x45d4d3={};_0x45d4d3[_0x2476('0x37')]=_['keys'](db[_0x2476('0x32')][_0x2476('0x33')]);_0x45d4d3[_0x2476('0x38')]=_[_0x2476('0x39')](_0x4d8038['query']);_0x45d4d3['filters']=_['intersection'](_0x45d4d3[_0x2476('0x37')],_0x45d4d3['query']);_0x18bd29[_0x2476('0x3c')]=_['intersection'](_0x45d4d3[_0x2476('0x37')],qs[_0x2476('0x3d')](_0x4d8038[_0x2476('0x38')]['fields']));_0x18bd29['attributes']=_0x18bd29[_0x2476('0x3c')][_0x2476('0x4a')]?_0x18bd29['attributes']:_0x45d4d3[_0x2476('0x37')];if(_0x4d8038['query'][_0x2476('0x4b')]){_0x18bd29[_0x2476('0x46')]=[{'all':!![]}];}_0x18bd29=_['merge']({},_0x18bd29,_0x4d8038['options']);return db[_0x2476('0x32')]['find'](_0x18bd29)[_0x2476('0x29')](handleEntityNotFound(_0x3358bc,null))[_0x2476('0x29')](respondWithResult(_0x3358bc,null))['catch'](handleError(_0x3358bc,null));};exports[_0x2476('0x4c')]=function(_0x54c0a5,_0x49c838){return db[_0x2476('0x32')]['create'](_0x54c0a5[_0x2476('0x4d')],{})['then'](function(_0x206333){var _0x5baae4=_0x54c0a5['user'][_0x2476('0x2a')]({'plain':!![]});if(!_0x5baae4)throw new Error(_0x2476('0x4e'));if(_0x5baae4[_0x2476('0x4f')]===_0x2476('0x50')){var _0x3107ad=_0x206333['get']({'plain':!![]});var _0x5a8a7c=_0x2476('0x2b');return db['UserProfileSection'][_0x2476('0x51')]({'where':{'name':_0x5a8a7c,'userProfileId':_0x5baae4[_0x2476('0x52')]},'raw':!![]})[_0x2476('0x29')](function(_0x2f9f5a){if(_0x2f9f5a&&_0x2f9f5a[_0x2476('0x53')]===0x0){return db[_0x2476('0x2c')][_0x2476('0x4c')]({'name':_0x3107ad[_0x2476('0x2f')],'resourceId':_0x3107ad['id'],'type':_0x2f9f5a[_0x2476('0x2f')],'sectionId':_0x2f9f5a['id']},{})[_0x2476('0x29')](function(){return _0x206333;});}else{return _0x206333;}})[_0x2476('0x54')](function(_0x2bc470){logger[_0x2476('0x2d')](_0x2476('0x55'),_0x2bc470);throw _0x2bc470;});}return _0x206333;})[_0x2476('0x29')](respondWithResult(_0x49c838,0xc9))[_0x2476('0x54')](handleError(_0x49c838,null));};exports[_0x2476('0x27')]=function(_0x5a9d12,_0x5398b1){if(_0x5a9d12[_0x2476('0x4d')]['id']){delete _0x5a9d12[_0x2476('0x4d')]['id'];}return db[_0x2476('0x32')][_0x2476('0x51')]({'where':{'id':_0x5a9d12['params']['id']}})[_0x2476('0x29')](handleEntityNotFound(_0x5398b1,null))[_0x2476('0x29')](saveUpdates(_0x5a9d12[_0x2476('0x4d')],null))['then'](respondWithResult(_0x5398b1,null))[_0x2476('0x54')](handleError(_0x5398b1,null));};exports['destroy']=function(_0xd24487,_0x2312e6){return db['CmList']['find']({'where':{'id':_0xd24487[_0x2476('0x49')]['id']}})[_0x2476('0x29')](handleEntityNotFound(_0x2312e6,null))['then'](removeEntity(_0x2312e6,null))['catch'](handleError(_0x2312e6,null));};exports[_0x2476('0x56')]=function(_0x21287e,_0x268d6c){return db[_0x2476('0x32')][_0x2476('0x56')]()[_0x2476('0x29')](respondWithResult(_0x268d6c,null))['catch'](handleError(_0x268d6c,null));};exports[_0x2476('0x57')]=function(_0x52c40d,_0x2f2877,_0x3b2976){if(_0x52c40d[_0x2476('0x4d')]['id']){delete _0x52c40d['body']['id'];}return db[_0x2476('0x32')]['find']({'where':{'id':_0x52c40d[_0x2476('0x49')]['id']}})['then'](handleEntityNotFound(_0x2f2877,null))['then'](function(_0x331bae){if(_0x331bae){_0x52c40d[_0x2476('0x4d')]['ListId']=_0x331bae['id'];return db[_0x2476('0x58')][_0x2476('0x4c')](_0x52c40d[_0x2476('0x4d')]);}})[_0x2476('0x29')](respondWithResult(_0x2f2877,null))[_0x2476('0x54')](handleError(_0x2f2877,null));};exports[_0x2476('0x59')]=function(_0x1d0cdf,_0x56285a,_0x5ae958){var _0x4b523d={'raw':![],'where':{}};var _0x5c348e={};var _0x4774ba={'count':0x0,'rows':[]};return db[_0x2476('0x32')]['findOne']({'where':{'id':_0x1d0cdf['params']['id']}})['then'](handleEntityNotFound(_0x56285a,null))[_0x2476('0x29')](function(_0x55ee78){if(_0x55ee78){_0x5c348e[_0x2476('0x37')]=_[_0x2476('0x39')](db['Disposition'][_0x2476('0x33')]);_0x5c348e['query']=_[_0x2476('0x39')](_0x1d0cdf[_0x2476('0x38')]);_0x5c348e[_0x2476('0x3a')]=_[_0x2476('0x3b')](_0x5c348e['model'],_0x5c348e['query']);_0x4b523d[_0x2476('0x3c')]=_['intersection'](_0x5c348e[_0x2476('0x37')],qs[_0x2476('0x3d')](_0x1d0cdf['query'][_0x2476('0x3d')]));_0x4b523d[_0x2476('0x3c')]=_0x4b523d[_0x2476('0x3c')][_0x2476('0x4a')]?_0x4b523d[_0x2476('0x3c')]:_0x5c348e[_0x2476('0x37')];if(!_0x1d0cdf['query'][_0x2476('0x3e')]('nolimit')){_0x4b523d[_0x2476('0x20')]=qs[_0x2476('0x20')](_0x1d0cdf[_0x2476('0x38')]['limit']);_0x4b523d['offset']=qs[_0x2476('0x1e')](_0x1d0cdf[_0x2476('0x38')]['offset']);}_0x4b523d[_0x2476('0x40')]=qs[_0x2476('0x41')](_0x1d0cdf[_0x2476('0x38')][_0x2476('0x41')]);_0x4b523d[_0x2476('0x42')]=qs[_0x2476('0x3a')](_[_0x2476('0x43')](_0x1d0cdf[_0x2476('0x38')],_0x5c348e[_0x2476('0x3a')]));_0x4b523d[_0x2476('0x42')][_0x2476('0x5a')]=_0x55ee78['id'];if(_0x1d0cdf[_0x2476('0x38')][_0x2476('0x44')]){_0x4b523d[_0x2476('0x42')]=_[_0x2476('0x5b')](_0x4b523d[_0x2476('0x42')],{'$or':_[_0x2476('0x31')](_0x4b523d[_0x2476('0x3c')],function(_0x2a1633){var _0x191262={};_0x191262[_0x2a1633]={'$like':'%'+_0x1d0cdf[_0x2476('0x38')][_0x2476('0x44')]+'%'};return _0x191262;})});}_0x4b523d=_[_0x2476('0x5b')]({},_0x4b523d,_0x1d0cdf[_0x2476('0x45')]);return db[_0x2476('0x58')][_0x2476('0x21')]({'where':_0x4b523d['where']})[_0x2476('0x29')](function(_0x337415){_0x4774ba[_0x2476('0x21')]=_0x337415;if(_0x1d0cdf['query'][_0x2476('0x4b')]){_0x4b523d['include']=[{'all':!![]}];}return db[_0x2476('0x58')][_0x2476('0x5c')](_0x4b523d);})[_0x2476('0x29')](function(_0x2d0262){_0x4774ba[_0x2476('0x47')]=_0x2d0262;return _0x4774ba;});}})[_0x2476('0x29')](respondWithFilteredResult(_0x56285a,_0x4b523d))[_0x2476('0x54')](handleError(_0x56285a,null));};exports[_0x2476('0x5d')]=function(_0x10ce09,_0x1be24d,_0x32ea52){return db['CmList']['find']({'where':{'id':_0x10ce09[_0x2476('0x49')]['id']}})[_0x2476('0x29')](handleEntityNotFound(_0x1be24d,null))[_0x2476('0x29')](function(_0x36f394){if(_0x36f394){return _0x36f394[_0x2476('0x5d')](_0x10ce09[_0x2476('0x38')][_0x2476('0x5e')]);}})[_0x2476('0x29')](respondWithStatusCode(_0x1be24d,null))[_0x2476('0x54')](handleError(_0x1be24d,null));};exports[_0x2476('0x5f')]=function(_0x479a4f,_0x16c602,_0x4d5a2b){return db['CmList'][_0x2476('0x51')]({'where':{'id':_0x479a4f[_0x2476('0x49')]['id']}})['then'](handleEntityNotFound(_0x16c602,null))[_0x2476('0x29')](function(_0x5674b8){if(_0x5674b8){var _0x9767ee=[];var _0x4be2e9={'success':[],'errors':[]};return db[_0x2476('0x60')][_0x2476('0x56')]()[_0x2476('0x29')](function(_0x165120){if(_0x479a4f[_0x2476('0x4d')]['tags']&&_[_0x2476('0x61')](_0x479a4f[_0x2476('0x4d')][_0x2476('0x62')])){if(_0x479a4f[_0x2476('0x4d')]['tags']['length']){_0x479a4f[_0x2476('0x4d')][_0x2476('0x62')]=_0x479a4f[_0x2476('0x4d')][_0x2476('0x62')]['join'](';')+';';}else{_0x479a4f[_0x2476('0x4d')][_0x2476('0x62')]=null;}}else{_0x479a4f['body'][_0x2476('0x62')]=null;}if(_0x479a4f[_0x2476('0x4d')]&&_['isArray'](_0x479a4f[_0x2476('0x4d')])){for(var _0x3442a8=0x0;_0x3442a8<_0x479a4f['body'][_0x2476('0x4a')];_0x3442a8+=0x1){_0x479a4f[_0x2476('0x4d')][_0x3442a8][_0x2476('0x5a')]=_0x479a4f['params']['id'];_0x9767ee['push'](_0x479a4f['body'][_0x3442a8]);}return BPromise[_0x2476('0x63')](_0x9767ee,function(_0x1a193e){return db[_0x2476('0x60')][_0x2476('0x4c')](_[_0x2476('0x64')](_0x1a193e,[_0x2476('0x5e'),'id'])||{},{'fields':_[_0x2476('0x39')](_0x165120),'raw':!![]})[_0x2476('0x29')](function(_0x1b82e3){_0x4be2e9[_0x2476('0x65')][_0x2476('0x66')](_0x1b82e3[_0x2476('0x67')]);})['catch'](function(_0x59df7f){_0x4be2e9['errors'][_0x2476('0x66')]({'data':_0x1a193e,'error':_0x59df7f['message']});});})[_0x2476('0x29')](function(_0x3b4907){return _0x4be2e9;})[_0x2476('0x54')](function(_0x469260){return _0x469260;});}else{_0x16c602[_0x2476('0x1c')](0x190)[_0x2476('0x23')]({'message':_0x2476('0x68')});}});}})[_0x2476('0x29')](respondWithResult(_0x16c602,null))[_0x2476('0x54')](handleError(_0x16c602,null));};exports['getContacts']=function(_0xdcb52d,_0x25b9cb,_0x5205b5){var _0x93f488;return db['CmList']['find']({'where':{'id':_0xdcb52d[_0x2476('0x49')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x2476('0x69')}]})[_0x2476('0x29')](handleEntityNotFound(_0x25b9cb,null))[_0x2476('0x29')](function(_0x509bf0){if(_0x509bf0){_0x93f488=_0x509bf0;return db[_0x2476('0x60')][_0x2476('0x33')];}})[_0x2476('0x29')](function(_0x5af904){if(_0x5af904){var _0x56d90d={};var _0x1a0ef1={};_0x1a0ef1['model']=_['concat'](_[_0x2476('0x39')](_0x5af904),_[_0x2476('0x31')](_0x93f488[_0x2476('0x69')],function(_0x364bd5){return util[_0x2476('0x6a')](_0x2476('0x6b'),_0x364bd5['id']);}));_0x1a0ef1[_0x2476('0x38')]=_[_0x2476('0x39')](_0xdcb52d[_0x2476('0x38')]);_0x1a0ef1[_0x2476('0x3a')]=_[_0x2476('0x3b')](_0x1a0ef1[_0x2476('0x37')],_0x1a0ef1['query']);_0x56d90d[_0x2476('0x3c')]=_[_0x2476('0x3b')](_0x1a0ef1[_0x2476('0x37')],qs[_0x2476('0x3d')](_0xdcb52d[_0x2476('0x38')][_0x2476('0x3d')]));_0x56d90d['attributes']=_0x56d90d[_0x2476('0x3c')][_0x2476('0x4a')]?_0x56d90d[_0x2476('0x3c')]:_0x1a0ef1[_0x2476('0x37')];if(!_0xdcb52d[_0x2476('0x38')]['hasOwnProperty']('nolimit')){_0x56d90d[_0x2476('0x20')]=qs[_0x2476('0x20')](_0xdcb52d['query'][_0x2476('0x20')]);_0x56d90d[_0x2476('0x1e')]=qs[_0x2476('0x1e')](_0xdcb52d[_0x2476('0x38')][_0x2476('0x1e')]);}_0x56d90d[_0x2476('0x40')]=qs[_0x2476('0x41')](_0xdcb52d[_0x2476('0x38')][_0x2476('0x41')]);_0x56d90d[_0x2476('0x42')]=qs[_0x2476('0x3a')](_['pick'](_0xdcb52d[_0x2476('0x38')],_0x1a0ef1['filters']));_0x56d90d['raw']=!![];if(_0xdcb52d['query'][_0x2476('0x44')]){_0x56d90d[_0x2476('0x42')]=_['merge'](_0x56d90d[_0x2476('0x42')],{'$or':_[_0x2476('0x31')](_0x56d90d[_0x2476('0x3c')],function(_0x46d8ef){var _0x36d6b6={};_0x36d6b6[_0x46d8ef]={'$like':'%'+_0xdcb52d[_0x2476('0x38')][_0x2476('0x44')]+'%'};return _0x36d6b6;})});}_0x56d90d=_[_0x2476('0x5b')]({},_0x56d90d,_0xdcb52d[_0x2476('0x45')]);return _0x93f488[_0x2476('0x6c')](_0x56d90d);}})[_0x2476('0x29')](respondWithResult(_0x25b9cb,null))[_0x2476('0x54')](handleError(_0x25b9cb,null));};exports['getContactsCsv']=function(_0x2c3cd5,_0x1362fe,_0x11bd6e){var _0x49b795;var _0x3f2059;var _0x1563e4;var _0x2be232=_0x2c3cd5[_0x2476('0x49')]['id'];csv_results=[];return db['ContactItemType'][_0x2476('0x5c')]({'attributes':['id',_0x2476('0x2f')],'raw':!![],'order':[_0x2476('0x6d')]})[_0x2476('0x29')](function(_0x37467b){_0x49b795=_0x37467b;var _0x5d335c=_[_0x2476('0x39')](db[_0x2476('0x60')][_0x2476('0x33')]);return db[_0x2476('0x6e')][_0x2476('0x5c')]({'raw':!![],'attributes':['id',_0x2476('0x6f')]})[_0x2476('0x29')](function(_0x29893a){_0x3f2059=_0x29893a;var _0x54a9f3=squel[_0x2476('0x70')]()['fields'](_0x5d335c)[_0x2476('0x71')](_0x2476('0x72'),'c')[_0x2476('0x42')](_0x2476('0x73'),_0x2be232)['where']('c.deletedAt\x20is\x20null')[_0x2476('0x74')]();for(var _0x2e80f3=0x0;_0x2e80f3<_0x3f2059[_0x2476('0x4a')];_0x2e80f3++){_0x54a9f3[_0x2476('0x75')](_0x2476('0x76')+_0x3f2059[_0x2e80f3]['id'],_0x2476('0x77')+_0x3f2059[_0x2e80f3][_0x2476('0x6f')]);}for(var _0x2e80f3=0x0;_0x2e80f3<_0x49b795[_0x2476('0x4a')];_0x2e80f3++){_0x54a9f3[_0x2476('0x75')](squel['select']()[_0x2476('0x75')](_0x2476('0x78'))[_0x2476('0x71')](_0x2476('0x79'))[_0x2476('0x42')](_0x2476('0x7a'),_0x49b795[_0x2e80f3]['id'])[_0x2476('0x42')](_0x2476('0x7b')),_0x2476('0x7c')+_0x49b795[_0x2e80f3][_0x2476('0x2f')]);_0x54a9f3[_0x2476('0x75')](squel[_0x2476('0x70')]()[_0x2476('0x75')](_0x2476('0x7d'))['from'](_0x2476('0x79'))['where'](_0x2476('0x7a'),_0x49b795[_0x2e80f3]['id'])[_0x2476('0x42')](_0x2476('0x7b')),_0x2476('0x7e')+_0x49b795[_0x2e80f3][_0x2476('0x2f')]);}var _0x419155=[];_0x419155[_0x2476('0x66')](_0x54a9f3[_0x2476('0x7f')]());BPromise[_0x2476('0x63')](_0x419155,handleQuery)[_0x2476('0x29')](function(_0x4cef20){handleQuery(_0x54a9f3['toString']());var _0x8ebf23=csv_results[0x0];if(!_['isEmpty'](_0x8ebf23)){var _0xc05b6c=toCsv(_0x8ebf23);var _0x5bc745=Date[_0x2476('0x80')]();fs['writeFileSync'](util[_0x2476('0x6a')](_0x2476('0x81'),_0x2be232,_0x5bc745),_0xc05b6c);_0x1362fe[_0x2476('0x82')](_0x2476('0x83'),'attachment;\x20filename='+util[_0x2476('0x6a')](_0x2476('0x84'),_0x2be232,_0x5bc745));_0x1362fe[_0x2476('0x82')](_0x2476('0x85'),_0x2476('0x86'));return _0x1362fe['download'](util[_0x2476('0x6a')](_0x2476('0x81'),_0x2be232,_0x5bc745));}else{return _0x1362fe[_0x2476('0x1b')](0xcc);}});});});};exports[_0x2476('0x87')]=function(_0x47c13b,_0x38aa13,_0x5796bf){var _0x1ef69b;delete _0x47c13b[_0x2476('0x4d')]['id'];return db[_0x2476('0x32')]['findOne']({'where':{'id':_0x47c13b[_0x2476('0x49')]['id']}})[_0x2476('0x29')](handleEntityNotFound(_0x38aa13,null))[_0x2476('0x29')](function(_0x98525f){if(_0x98525f){return db[_0x2476('0x88')][_0x2476('0x89')](function(_0x3565bd){return db[_0x2476('0x6e')][_0x2476('0x4c')](_0x47c13b[_0x2476('0x4d')],{'transaction':_0x3565bd})[_0x2476('0x29')](function(_0x2c04b1){_0x1ef69b=_0x2c04b1;return _0x98525f[_0x2476('0x8a')](_0x2c04b1,{'transaction':_0x3565bd});})[_0x2476('0x29')](function(){var _0x1fde1e={'type':db[_0x2476('0x8b')][_0x2476('0x8c')],'transaction':_0x3565bd};switch(_0x47c13b[_0x2476('0x4d')][_0x2476('0x35')]){case'text':_0x1fde1e['type']=db[_0x2476('0x8b')][_0x2476('0x8c')];break;case'number':_0x1fde1e[_0x2476('0x35')]=db[_0x2476('0x8b')][_0x2476('0x8d')];break;case _0x2476('0x8e'):_0x1fde1e[_0x2476('0x35')]=db['Sequelize'][_0x2476('0x8f')];_0x1fde1e[_0x2476('0x90')]=![];break;default:}return db[_0x2476('0x88')][_0x2476('0x91')]['addColumn']('cm_contacts',util[_0x2476('0x6a')](_0x2476('0x92'),_0x1ef69b['id']),_0x1fde1e);})[_0x2476('0x29')](function(){return _0x1ef69b;});});}})[_0x2476('0x29')](respondWithResult(_0x38aa13,null))[_0x2476('0x54')](handleError(_0x38aa13,null));};exports[_0x2476('0x93')]=function(_0x4226a9,_0xca2b6f,_0x50242c){var _0x49acda={};var _0x28d3c6={};var _0x19c390;var _0x4441f2;return db[_0x2476('0x32')][_0x2476('0x94')]({'where':{'id':_0x4226a9[_0x2476('0x49')]['id']}})[_0x2476('0x29')](handleEntityNotFound(_0xca2b6f,null))['then'](function(_0x8b8847){if(_0x8b8847){_0x19c390=_0x8b8847;_0x28d3c6[_0x2476('0x37')]=_[_0x2476('0x39')](db[_0x2476('0x6e')][_0x2476('0x33')]);_0x28d3c6['query']=_['keys'](_0x4226a9[_0x2476('0x38')]);_0x28d3c6['filters']=_[_0x2476('0x3b')](_0x28d3c6[_0x2476('0x37')],_0x28d3c6[_0x2476('0x38')]);_0x49acda['attributes']=_[_0x2476('0x3b')](_0x28d3c6['model'],qs[_0x2476('0x3d')](_0x4226a9[_0x2476('0x38')]['fields']));_0x49acda[_0x2476('0x3c')]=_0x49acda['attributes'][_0x2476('0x4a')]?_0x49acda[_0x2476('0x3c')]:_0x28d3c6[_0x2476('0x37')];_0x49acda[_0x2476('0x40')]=qs[_0x2476('0x41')](_0x4226a9[_0x2476('0x38')][_0x2476('0x41')]);_0x49acda['where']=qs['filters'](_[_0x2476('0x43')](_0x4226a9['query'],_0x28d3c6[_0x2476('0x3a')]));_0x49acda[_0x2476('0x42')]=_['merge'](_0x49acda[_0x2476('0x42')],{'$or':[{'ListId':_0x8b8847['id']},{'ListId':null}]});if(_0x4226a9[_0x2476('0x38')][_0x2476('0x44')]){_0x49acda[_0x2476('0x42')]=_[_0x2476('0x5b')](_0x49acda[_0x2476('0x42')],{'$or':_[_0x2476('0x31')](_0x49acda[_0x2476('0x3c')],function(_0x19ef62){var _0x5c32b4={};_0x5c32b4[_0x19ef62]={'$like':'%'+_0x4226a9[_0x2476('0x38')][_0x2476('0x44')]+'%'};return _0x5c32b4;})});}_0x49acda=_[_0x2476('0x5b')]({},_0x49acda,_0x4226a9[_0x2476('0x45')]);return db['CmCustomField'][_0x2476('0x95')](_0x49acda);}})[_0x2476('0x29')](respondWithResult(_0xca2b6f,null))[_0x2476('0x54')](handleError(_0xca2b6f,null));};exports[_0x2476('0x96')]=function(_0x3a47b4,_0x50469e){return db[_0x2476('0x6e')]['findAndCountAll']({'where':{'ListId':null}})[_0x2476('0x29')](handleEntityNotFound(_0x50469e,null))[_0x2476('0x29')](function(_0x5c7b25){return _0x5c7b25;})[_0x2476('0x29')](respondWithResult(_0x50469e,null))[_0x2476('0x54')](handleError(_0x50469e,null));};exports[_0x2476('0x97')]=function(_0x72e0f2,_0xac450e,_0x1ada89){return db['CmList'][_0x2476('0x51')]({'where':{'id':_0x72e0f2[_0x2476('0x49')]['id']}})[_0x2476('0x29')](handleEntityNotFound(_0xac450e,null))['then'](function(_0x134386){if(_0x134386){return _0x134386[_0x2476('0x97')](_0x72e0f2['body'][_0x2476('0x5e')],_['omit'](_0x72e0f2['body'],[_0x2476('0x5e'),'id'])||{})['spread'](function(_0x50fe54){for(var _0x56d3d1=0x0;_0x56d3d1<_0x72e0f2[_0x2476('0x4d')][_0x2476('0x5e')][_0x2476('0x4a')];_0x56d3d1+=0x1){socket['emit'](_0x2476('0x98'),{'UserId':Number(_0x72e0f2[_0x2476('0x4d')][_0x2476('0x5e')][_0x56d3d1]),'CmListId':Number(_0x72e0f2[_0x2476('0x49')]['id'])});}return _0x50fe54;});}})[_0x2476('0x29')](respondWithResult(_0xac450e,null))[_0x2476('0x54')](handleError(_0xac450e,null));};exports['removeAgents']=function(_0x596155,_0x5895cd,_0x590b7a){return db[_0x2476('0x32')][_0x2476('0x51')]({'where':{'id':_0x596155[_0x2476('0x49')]['id']}})[_0x2476('0x29')](handleEntityNotFound(_0x5895cd,null))[_0x2476('0x29')](function(_0x4a8989){if(_0x4a8989){return _0x4a8989['removeAgents'](_0x596155[_0x2476('0x38')]['ids'])[_0x2476('0x29')](function(){if(_[_0x2476('0x61')](_0x596155[_0x2476('0x38')][_0x2476('0x5e')])){for(var _0x180cd7=0x0;_0x180cd7<_0x596155['query'][_0x2476('0x5e')][_0x2476('0x4a')];_0x180cd7+=0x1){socket['emit'](_0x2476('0x99'),{'UserId':Number(_0x596155[_0x2476('0x38')][_0x2476('0x5e')][_0x180cd7]),'CmListId':Number(_0x596155['params']['id'])});}}else{socket[_0x2476('0x9a')]('userCmList:remove',{'UserId':Number(_0x596155['query'][_0x2476('0x5e')]),'CmListId':Number(_0x596155[_0x2476('0x49')]['id'])});}});}})[_0x2476('0x29')](respondWithStatusCode(_0x5895cd,null))['catch'](handleError(_0x5895cd,null));};exports['getAgents']=function(_0x347a34,_0x5de89d,_0x2880ba){var _0x482308={};var _0x1212b7={};var _0x45430e;var _0x4279a0;return db[_0x2476('0x32')][_0x2476('0x94')]({'where':{'id':_0x347a34['params']['id']}})[_0x2476('0x29')](handleEntityNotFound(_0x5de89d,null))[_0x2476('0x29')](function(_0x45e43d){if(_0x45e43d){_0x45430e=_0x45e43d;_0x1212b7[_0x2476('0x37')]=_[_0x2476('0x39')](db['User'][_0x2476('0x33')]);_0x1212b7['query']=_[_0x2476('0x39')](_0x347a34[_0x2476('0x38')]);_0x1212b7[_0x2476('0x3a')]=_[_0x2476('0x3b')](_0x1212b7[_0x2476('0x37')],_0x1212b7[_0x2476('0x38')]);_0x482308[_0x2476('0x3c')]=_[_0x2476('0x3b')](_0x1212b7[_0x2476('0x37')],qs[_0x2476('0x3d')](_0x347a34[_0x2476('0x38')]['fields']));_0x482308[_0x2476('0x3c')]=_0x482308[_0x2476('0x3c')][_0x2476('0x4a')]?_0x482308['attributes']:_0x1212b7[_0x2476('0x37')];_0x482308['order']=qs['sort'](_0x347a34['query'][_0x2476('0x41')]);_0x482308['where']=qs['filters'](_[_0x2476('0x43')](_0x347a34[_0x2476('0x38')],_0x1212b7['filters']));if(_0x347a34[_0x2476('0x38')][_0x2476('0x44')]){_0x482308[_0x2476('0x42')]=_[_0x2476('0x5b')](_0x482308['where'],{'$or':_[_0x2476('0x31')](_0x482308[_0x2476('0x3c')],function(_0x31248c){var _0x3fb71c={};_0x3fb71c[_0x31248c]={'$like':'%'+_0x347a34[_0x2476('0x38')][_0x2476('0x44')]+'%'};return _0x3fb71c;})});}_0x482308=_[_0x2476('0x5b')]({},_0x482308,_0x347a34[_0x2476('0x45')]);return _0x45430e[_0x2476('0x9b')](_0x482308);}})[_0x2476('0x29')](function(_0x35d261){if(_0x35d261){_0x4279a0=_0x35d261['length'];if(!_0x347a34[_0x2476('0x38')][_0x2476('0x3e')](_0x2476('0x3f'))){_0x482308[_0x2476('0x20')]=qs['limit'](_0x347a34[_0x2476('0x38')][_0x2476('0x20')]);_0x482308[_0x2476('0x1e')]=qs['offset'](_0x347a34[_0x2476('0x38')][_0x2476('0x1e')]);}return _0x45430e['getAgents'](_0x482308);}})['then'](function(_0xd8b4e7){if(_0xd8b4e7){return _0xd8b4e7?{'count':_0x4279a0,'rows':_0xd8b4e7}:null;}})[_0x2476('0x29')](respondWithResult(_0x5de89d,null))['catch'](handleError(_0x5de89d,null));};function handleQuery(_0x34a589){logger[_0x2476('0x9c')](_0x34a589);return db[_0x2476('0x88')][_0x2476('0x38')](_0x34a589)[_0x2476('0x9d')](function(_0x289b7d){csv_results[_0x2476('0x66')](_0x289b7d);})[_0x2476('0x54')](function(_0x492144){logger[_0x2476('0x2d')](_0x492144[_0x2476('0x9e')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 6cac523..fbddcbb 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(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4f1da5,_0x4ced17){_0x4f1da5=_0x4f1da5-0x0;var _0xe972a8=_0x5fc3[_0x4f1da5];return _0xe972a8;};'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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe14b,0x93));var _0xbe14=function(_0x27ec2b,_0x5b9e78){_0x27ec2b=_0x27ec2b-0x0;var _0x1813d1=_0xe14b[_0x27ec2b];return _0x1813d1;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index f977227..cff9a01 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 _0x99e9=['util','../../config/logger','api','moment','request-promise','path','rimraf','./cmList.attributes','define','CmList'];(function(_0x58e358,_0x4cd732){var _0x34015f=function(_0x22cf00){while(--_0x22cf00){_0x58e358['push'](_0x58e358['shift']());}};_0x34015f(++_0x4cd732);}(_0x99e9,0xb4));var _0x999e=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x99e9[_0x4b7895];return _0x264180;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var BPromise=require('bluebird');var rp=require(_0x999e('0x4'));var fs=require('fs');var path=require(_0x999e('0x5'));var rimraf=require(_0x999e('0x6'));var config=require('../../config/environment');var attributes=require(_0x999e('0x7'));module['exports']=function(_0x25421f,_0x1bda0a){return _0x25421f[_0x999e('0x8')](_0x999e('0x9'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1339=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmList','cm_lists','../../config/logger','api'];(function(_0x58f073,_0x440c14){var _0x4d3a50=function(_0x22046a){while(--_0x22046a){_0x58f073['push'](_0x58f073['shift']());}};_0x4d3a50(++_0x440c14);}(_0x1339,0x1ed));var _0x9133=function(_0x8aaf4e,_0x54c96a){_0x8aaf4e=_0x8aaf4e-0x0;var _0x38f922=_0x1339[_0x8aaf4e];return _0x38f922;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var BPromise=require(_0x9133('0x3'));var rp=require(_0x9133('0x4'));var fs=require('fs');var path=require(_0x9133('0x5'));var rimraf=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var attributes=require('./cmList.attributes');module[_0x9133('0x8')]=function(_0x855473,_0x379915){return _0x855473['define'](_0x9133('0x9'),attributes,{'tableName':_0x9133('0xa'),'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 d1c786b..01036f7 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 _0x9b8d=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s'];(function(_0x13cab0,_0x14d825){var _0x38804f=function(_0x1bffaf){while(--_0x1bffaf){_0x13cab0['push'](_0x13cab0['shift']());}};_0x38804f(++_0x14d825);}(_0x9b8d,0x199));var _0xd9b8=function(_0x11908c,_0x547af6){_0x11908c=_0x11908c-0x0;var _0x10cd4e=_0x9b8d[_0x11908c];return _0x10cd4e;};'use strict';var _=require(_0xd9b8('0x0'));var util=require(_0xd9b8('0x1'));var moment=require(_0xd9b8('0x2'));var BPromise=require(_0xd9b8('0x3'));var rs=require(_0xd9b8('0x4'));var fs=require('fs');var Redis=require(_0xd9b8('0x5'));var db=require(_0xd9b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9b8('0x7'))(_0xd9b8('0x8'));var config=require(_0xd9b8('0x9'));var jayson=require(_0xd9b8('0xa'));var client=jayson['client'][_0xd9b8('0xb')]({'port':0x232a});config['redis']=_[_0xd9b8('0xc')](config[_0xd9b8('0xd')],{'host':_0xd9b8('0xe'),'port':0x18eb});var socket=require(_0xd9b8('0xf'))(new Redis(config['redis']));require(_0xd9b8('0x10'))['register'](socket);function respondWithRpcPromise(_0x16800a,_0x586797,_0x399ceb){return new BPromise(function(_0x20b4df,_0x4cf5d7){return client['request'](_0x16800a,_0x399ceb)[_0xd9b8('0x11')](function(_0x157df0){logger[_0xd9b8('0x12')]('CmList,\x20%s,\x20%s',_0x586797,_0xd9b8('0x13'));logger[_0xd9b8('0x14')](_0xd9b8('0x15'),_0x586797,'request\x20sent',JSON[_0xd9b8('0x16')](_0x157df0));if(_0x157df0[_0xd9b8('0x17')]){if(_0x157df0[_0xd9b8('0x17')][_0xd9b8('0x18')]===0x1f4){logger[_0xd9b8('0x17')](_0xd9b8('0x19'),_0x586797,_0x157df0[_0xd9b8('0x17')][_0xd9b8('0x1a')]);return _0x4cf5d7(_0x157df0[_0xd9b8('0x17')][_0xd9b8('0x1a')]);}logger[_0xd9b8('0x17')](_0xd9b8('0x19'),_0x586797,_0x157df0['error'][_0xd9b8('0x1a')]);return _0x20b4df(_0x157df0[_0xd9b8('0x17')]['message']);}else{logger[_0xd9b8('0x12')](_0xd9b8('0x19'),_0x586797,_0xd9b8('0x13'));_0x20b4df(_0x157df0[_0xd9b8('0x1b')][_0xd9b8('0x1a')]);}})[_0xd9b8('0x1c')](function(_0x1957c2){logger[_0xd9b8('0x17')]('CmList,\x20%s,\x20%s',_0x586797,_0x1957c2);_0x4cf5d7(_0x1957c2);});});} \ No newline at end of file +var _0xef40=['rpc','../../config/environment','client','defaults','redis','localhost','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','../../mysqldb','../../config/logger'];(function(_0x38011d,_0x58ae31){var _0x2a1682=function(_0x5f1e39){while(--_0x5f1e39){_0x38011d['push'](_0x38011d['shift']());}};_0x2a1682(++_0x58ae31);}(_0xef40,0x1e9));var _0x0ef4=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xef40[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0ef4('0x0'));var util=require(_0x0ef4('0x1'));var moment=require(_0x0ef4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ef4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ef4('0x4'))(_0x0ef4('0x5'));var config=require(_0x0ef4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0ef4('0x7')]['http']({'port':0x232a});config['redis']=_[_0x0ef4('0x8')](config[_0x0ef4('0x9')],{'host':_0x0ef4('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0ef4('0xb'))[_0x0ef4('0xc')](socket);function respondWithRpcPromise(_0x128706,_0xf4d5cf,_0x381ce4){return new BPromise(function(_0x2187d4,_0x52f979){return client[_0x0ef4('0xd')](_0x128706,_0x381ce4)[_0x0ef4('0xe')](function(_0x42bed){logger['info'](_0x0ef4('0xf'),_0xf4d5cf,_0x0ef4('0x10'));logger[_0x0ef4('0x11')](_0x0ef4('0x12'),_0xf4d5cf,'request\x20sent',JSON[_0x0ef4('0x13')](_0x42bed));if(_0x42bed[_0x0ef4('0x14')]){if(_0x42bed[_0x0ef4('0x14')][_0x0ef4('0x15')]===0x1f4){logger[_0x0ef4('0x14')]('CmList,\x20%s,\x20%s',_0xf4d5cf,_0x42bed['error'][_0x0ef4('0x16')]);return _0x52f979(_0x42bed[_0x0ef4('0x14')][_0x0ef4('0x16')]);}logger[_0x0ef4('0x14')]('CmList,\x20%s,\x20%s',_0xf4d5cf,_0x42bed[_0x0ef4('0x14')][_0x0ef4('0x16')]);return _0x2187d4(_0x42bed[_0x0ef4('0x14')][_0x0ef4('0x16')]);}else{logger[_0x0ef4('0x17')](_0x0ef4('0xf'),_0xf4d5cf,_0x0ef4('0x10'));_0x2187d4(_0x42bed[_0x0ef4('0x18')][_0x0ef4('0x16')]);}})[_0x0ef4('0x19')](function(_0x5798ea){logger[_0x0ef4('0x14')](_0x0ef4('0xf'),_0xf4d5cf,_0x5798ea);_0x52f979(_0x5798ea);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index b485112..490cf55 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 _0x87c6=['update','emit','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x12d6c6,_0x1d7ee2){var _0x270fd4=function(_0x2a401e){while(--_0x2a401e){_0x12d6c6['push'](_0x12d6c6['shift']());}};_0x270fd4(++_0x1d7ee2);}(_0x87c6,0x186));var _0x687c=function(_0x164f87,_0x283939){_0x164f87=_0x164f87-0x0;var _0x5f2259=_0x87c6[_0x164f87];return _0x5f2259;};'use strict';var CmListEvents=require(_0x687c('0x0'));var events=[_0x687c('0x1'),'remove',_0x687c('0x2')];function createListener(_0x50373c,_0x43f2a0){return function(_0x325c9d){_0x43f2a0[_0x687c('0x3')](_0x50373c,_0x325c9d);};}function removeListener(_0x262e0e,_0x5097e5){return function(){CmListEvents[_0x687c('0x4')](_0x262e0e,_0x5097e5);};}exports[_0x687c('0x5')]=function(_0x535c92){for(var _0x424306=0x0,_0x584d3a=events[_0x687c('0x6')];_0x424306<_0x584d3a;_0x424306++){var _0x365b5f=events[_0x424306];var _0x1f10fb=createListener(_0x687c('0x7')+_0x365b5f,_0x535c92);CmListEvents['on'](_0x365b5f,_0x1f10fb);}}; \ No newline at end of file +var _0x3a5c=['removeListener','length','cmList:','./cmList.events','save','remove','update','emit'];(function(_0x4179e2,_0xf2dbb){var _0x24cb50=function(_0x3b7899){while(--_0x3b7899){_0x4179e2['push'](_0x4179e2['shift']());}};_0x24cb50(++_0xf2dbb);}(_0x3a5c,0x15b));var _0xc3a5=function(_0x537d53,_0x26d1f0){_0x537d53=_0x537d53-0x0;var _0x1b1faa=_0x3a5c[_0x537d53];return _0x1b1faa;};'use strict';var CmListEvents=require(_0xc3a5('0x0'));var events=[_0xc3a5('0x1'),_0xc3a5('0x2'),_0xc3a5('0x3')];function createListener(_0x6e7847,_0x353d48){return function(_0x36f236){_0x353d48[_0xc3a5('0x4')](_0x6e7847,_0x36f236);};}function removeListener(_0x10cb4f,_0x2371db){return function(){CmListEvents[_0xc3a5('0x5')](_0x10cb4f,_0x2371db);};}exports['register']=function(_0x3ff729){for(var _0x117d4a=0x0,_0x4d9537=events[_0xc3a5('0x6')];_0x117d4a<_0x4d9537;_0x117d4a++){var _0x3ad886=events[_0x117d4a];var _0x127208=createListener(_0xc3a5('0x7')+_0x3ad886,_0x3ff729);CmListEvents['on'](_0x3ad886,_0x127208);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 1b74af3..5956c63 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 _0x6efe=['isAuthenticated','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create','addDisposition','update','delete','removeDispositions','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','/describe','describe','get','getGlobalCustomFields','/:id'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0x6efe,0x1a5));var _0xe6ef=function(_0x5e3683,_0x41bc90){_0x5e3683=_0x5e3683-0x0;var _0x5c4fc3=_0x6efe[_0x5e3683];return _0x5c4fc3;};'use strict';var multer=require('multer');var util=require(_0xe6ef('0x0'));var path=require('path');var timeout=require(_0xe6ef('0x1'));var express=require(_0xe6ef('0x2'));var router=express[_0xe6ef('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe6ef('0x4'));var config=require(_0xe6ef('0x5'));var controller=require('./cmList.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe6ef('0x6'),auth['isAuthenticated'](),controller[_0xe6ef('0x7')]);router[_0xe6ef('0x8')]('/global_fields',auth['isAuthenticated'](),controller[_0xe6ef('0x9')]);router[_0xe6ef('0x8')](_0xe6ef('0xa'),auth[_0xe6ef('0xb')](),controller['show']);router[_0xe6ef('0x8')](_0xe6ef('0xc'),auth[_0xe6ef('0xb')](),controller[_0xe6ef('0xd')]);router['get'](_0xe6ef('0xe'),auth[_0xe6ef('0xb')](),controller['getContacts']);router[_0xe6ef('0x8')](_0xe6ef('0xf'),auth[_0xe6ef('0xb')](),controller[_0xe6ef('0x10')]);router['get'](_0xe6ef('0x11'),auth['isAuthenticated'](),controller[_0xe6ef('0x12')]);router[_0xe6ef('0x8')](_0xe6ef('0x13'),auth[_0xe6ef('0xb')](),controller['getAgents']);router[_0xe6ef('0x14')]('/',auth[_0xe6ef('0xb')](),controller[_0xe6ef('0x15')]);router['post'](_0xe6ef('0xc'),auth[_0xe6ef('0xb')](),controller[_0xe6ef('0x16')]);router['post'](_0xe6ef('0xe'),auth[_0xe6ef('0xb')](),controller['addContacts']);router[_0xe6ef('0x14')](_0xe6ef('0x11'),auth[_0xe6ef('0xb')](),controller['addCustomField']);router[_0xe6ef('0x14')](_0xe6ef('0x13'),auth[_0xe6ef('0xb')](),controller['addAgents']);router['put'](_0xe6ef('0xa'),auth[_0xe6ef('0xb')](),controller[_0xe6ef('0x17')]);router[_0xe6ef('0x18')](_0xe6ef('0xa'),auth[_0xe6ef('0xb')](),controller['destroy']);router[_0xe6ef('0x18')](_0xe6ef('0xc'),auth[_0xe6ef('0xb')](),controller[_0xe6ef('0x19')]);router[_0xe6ef('0x18')](_0xe6ef('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xe6ef('0x1a')]=router; \ No newline at end of file +var _0x2318=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','describe','/global_fields','get','/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','/:id/fields','/:id/users','post','addDisposition','/:id/contacts','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','util','path','connect-timeout'];(function(_0x5d1594,_0x105585){var _0x5c4153=function(_0x19ea52){while(--_0x19ea52){_0x5d1594['push'](_0x5d1594['shift']());}};_0x5c4153(++_0x105585);}(_0x2318,0x115));var _0x8231=function(_0x44449d,_0x28c540){_0x44449d=_0x44449d-0x0;var _0x59e01d=_0x2318[_0x44449d];return _0x59e01d;};'use strict';var multer=require('multer');var util=require(_0x8231('0x0'));var path=require(_0x8231('0x1'));var timeout=require(_0x8231('0x2'));var express=require('express');var router=express[_0x8231('0x3')]();var fs_extra=require(_0x8231('0x4'));var auth=require(_0x8231('0x5'));var interaction=require(_0x8231('0x6'));var config=require(_0x8231('0x7'));var controller=require(_0x8231('0x8'));router['get']('/',auth[_0x8231('0x9')](),controller[_0x8231('0xa')]);router['get']('/describe',auth[_0x8231('0x9')](),controller[_0x8231('0xb')]);router['get'](_0x8231('0xc'),auth[_0x8231('0x9')](),controller['getGlobalCustomFields']);router[_0x8231('0xd')](_0x8231('0xe'),auth[_0x8231('0x9')](),controller[_0x8231('0xf')]);router['get'](_0x8231('0x10'),auth[_0x8231('0x9')](),controller[_0x8231('0x11')]);router[_0x8231('0xd')]('/:id/contacts',auth[_0x8231('0x9')](),controller[_0x8231('0x12')]);router[_0x8231('0xd')](_0x8231('0x13'),auth[_0x8231('0x9')](),controller['getContactsCsv']);router[_0x8231('0xd')](_0x8231('0x14'),auth[_0x8231('0x9')](),controller['getCustomFields']);router[_0x8231('0xd')](_0x8231('0x15'),auth[_0x8231('0x9')](),controller['getAgents']);router[_0x8231('0x16')]('/',auth[_0x8231('0x9')](),controller['create']);router[_0x8231('0x16')](_0x8231('0x10'),auth[_0x8231('0x9')](),controller[_0x8231('0x17')]);router[_0x8231('0x16')](_0x8231('0x18'),auth[_0x8231('0x9')](),controller[_0x8231('0x19')]);router[_0x8231('0x16')](_0x8231('0x14'),auth[_0x8231('0x9')](),controller[_0x8231('0x1a')]);router[_0x8231('0x16')](_0x8231('0x15'),auth['isAuthenticated'](),controller[_0x8231('0x1b')]);router[_0x8231('0x1c')]('/:id',auth[_0x8231('0x9')](),controller[_0x8231('0x1d')]);router[_0x8231('0x1e')](_0x8231('0xe'),auth[_0x8231('0x9')](),controller[_0x8231('0x1f')]);router['delete'](_0x8231('0x10'),auth[_0x8231('0x9')](),controller[_0x8231('0x20')]);router[_0x8231('0x1e')](_0x8231('0x15'),auth['isAuthenticated'](),controller[_0x8231('0x21')]);module[_0x8231('0x22')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 6654533..292d9f9 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 _0xbe57=['sequelize','exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x225306,_0x20d9de){var _0x10bd79=function(_0x5ee586){while(--_0x5ee586){_0x225306['push'](_0x225306['shift']());}};_0x10bd79(++_0x20d9de);}(_0xbe57,0x168));var _0x7be5=function(_0x438de6,_0x198556){_0x438de6=_0x438de6-0x0;var _0x43d857=_0xbe57[_0x438de6];return _0x43d857;};'use strict';var Sequelize=require(_0x7be5('0x0'));module[_0x7be5('0x1')]={'name':{'type':Sequelize[_0x7be5('0x2')],'get':function(_0x41676c){return this[_0x7be5('0x3')](_0x7be5('0x4'));}},'field':{'type':Sequelize[_0x7be5('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x7be5('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x7be5('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x42b4=['field','STRING','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x30946c,_0x17d8b0){var _0x2dfd1e=function(_0x20c099){while(--_0x20c099){_0x30946c['push'](_0x30946c['shift']());}};_0x2dfd1e(++_0x17d8b0);}(_0x42b4,0xbc));var _0x442b=function(_0x3c8e5b,_0x5e9f1b){_0x3c8e5b=_0x3c8e5b-0x0;var _0x456e2c=_0x42b4[_0x3c8e5b];return _0x456e2c;};'use strict';var Sequelize=require(_0x442b('0x0'));module[_0x442b('0x1')]={'name':{'type':Sequelize[_0x442b('0x2')],'get':function(_0x1bc869){return this[_0x442b('0x3')](_0x442b('0x4'));}},'field':{'type':Sequelize[_0x442b('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x442b('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x442b('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index a0f9521..305d689 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x3c211a,_0x167478){var _0x1281f3=function(_0x2fffcd){while(--_0x2fffcd){_0x3c211a['push'](_0x3c211a['shift']());}};_0x1281f3(++_0x167478);}(_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){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0xe0edbe,_0x1a084e){var _0xe399f9=function(_0x3b3f80){while(--_0x3b3f80){_0xe0edbe['push'](_0xe0edbe['shift']());}};_0xe399f9(++_0x1a084e);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index b50db8e..93e80bd 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 _0x5229=['bluebird','request-promise','path','rimraf','../../config/environment','define','Condition','tools_conditions','lodash','../../config/logger','api'];(function(_0x72dfb,_0x2f6be9){var _0x4d9bc9=function(_0x511d5f){while(--_0x511d5f){_0x72dfb['push'](_0x72dfb['shift']());}};_0x4d9bc9(++_0x2f6be9);}(_0x5229,0x194));var _0x9522=function(_0x471beb,_0x210026){_0x471beb=_0x471beb-0x0;var _0x3d4e0d=_0x5229[_0x471beb];return _0x3d4e0d;};'use strict';var _=require(_0x9522('0x0'));var util=require('util');var logger=require(_0x9522('0x1'))(_0x9522('0x2'));var moment=require('moment');var BPromise=require(_0x9522('0x3'));var rp=require(_0x9522('0x4'));var fs=require('fs');var path=require(_0x9522('0x5'));var rimraf=require(_0x9522('0x6'));var config=require(_0x9522('0x7'));var attributes=require('./condition.attributes');module['exports']=function(_0x116db9,_0x3524ed){return _0x116db9[_0x9522('0x8')](_0x9522('0x9'),attributes,{'tableName':_0x9522('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bdc=['tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Condition'];(function(_0x939d1f,_0x14c16c){var _0x19642c=function(_0x538397){while(--_0x538397){_0x939d1f['push'](_0x939d1f['shift']());}};_0x19642c(++_0x14c16c);}(_0x8bdc,0x189));var _0xc8bd=function(_0x585c06,_0x29d659){_0x585c06=_0x585c06-0x0;var _0x39b8e4=_0x8bdc[_0x585c06];return _0x39b8e4;};'use strict';var _=require(_0xc8bd('0x0'));var util=require(_0xc8bd('0x1'));var logger=require(_0xc8bd('0x2'))(_0xc8bd('0x3'));var moment=require(_0xc8bd('0x4'));var BPromise=require(_0xc8bd('0x5'));var rp=require(_0xc8bd('0x6'));var fs=require('fs');var path=require(_0xc8bd('0x7'));var rimraf=require(_0xc8bd('0x8'));var config=require(_0xc8bd('0x9'));var attributes=require('./condition.attributes');module[_0xc8bd('0xa')]=function(_0x4846ae,_0x4a01c0){return _0x4846ae[_0xc8bd('0xb')](_0xc8bd('0xc'),attributes,{'tableName':_0xc8bd('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 b9ad054..1617f0a 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 _0xc4e3=['jayson/promise','client','Condition,\x20%s,\x20%s','debug','stringify','error','message','info','request\x20sent','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4e3,0x6e));var _0x3c4e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc4e3[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3c4e('0x0'));var util=require(_0x3c4e('0x1'));var moment=require(_0x3c4e('0x2'));var BPromise=require('bluebird');var rs=require(_0x3c4e('0x3'));var fs=require('fs');var Redis=require(_0x3c4e('0x4'));var db=require(_0x3c4e('0x5'))['db'];var utils=require(_0x3c4e('0x6'));var logger=require(_0x3c4e('0x7'))(_0x3c4e('0x8'));var config=require(_0x3c4e('0x9'));var jayson=require(_0x3c4e('0xa'));var client=jayson[_0x3c4e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x330f28,_0x4a896b,_0x2b2427){return new BPromise(function(_0x26c617,_0x57ef43){return client['request'](_0x330f28,_0x2b2427)['then'](function(_0x58120e){logger['info'](_0x3c4e('0xc'),_0x4a896b,'request\x20sent');logger[_0x3c4e('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x4a896b,'request\x20sent',JSON[_0x3c4e('0xe')](_0x58120e));if(_0x58120e[_0x3c4e('0xf')]){if(_0x58120e[_0x3c4e('0xf')]['code']===0x1f4){logger['error'](_0x3c4e('0xc'),_0x4a896b,_0x58120e[_0x3c4e('0xf')][_0x3c4e('0x10')]);return _0x57ef43(_0x58120e['error']['message']);}logger[_0x3c4e('0xf')](_0x3c4e('0xc'),_0x4a896b,_0x58120e['error'][_0x3c4e('0x10')]);return _0x26c617(_0x58120e[_0x3c4e('0xf')][_0x3c4e('0x10')]);}else{logger[_0x3c4e('0x11')]('Condition,\x20%s,\x20%s',_0x4a896b,_0x3c4e('0x12'));_0x26c617(_0x58120e[_0x3c4e('0x13')][_0x3c4e('0x10')]);}})['catch'](function(_0x289729){logger[_0x3c4e('0xf')](_0x3c4e('0xc'),_0x4a896b,_0x289729);_0x57ef43(_0x289729);});});} \ No newline at end of file +var _0x69a5=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x571c83,_0x4c97dc){var _0x2b8bd2=function(_0x1401a1){while(--_0x1401a1){_0x571c83['push'](_0x571c83['shift']());}};_0x2b8bd2(++_0x4c97dc);}(_0x69a5,0x16b));var _0x569a=function(_0x85efc8,_0x4249e7){_0x85efc8=_0x85efc8-0x0;var _0x7e529=_0x69a5[_0x85efc8];return _0x7e529;};'use strict';var _=require(_0x569a('0x0'));var util=require(_0x569a('0x1'));var moment=require('moment');var BPromise=require(_0x569a('0x2'));var rs=require(_0x569a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x569a('0x4'));var logger=require('../../config/logger')(_0x569a('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x569a('0x6')][_0x569a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e3a61,_0x32dc39,_0x2ed8d6){return new BPromise(function(_0x1a4ffb,_0x4ced83){return client[_0x569a('0x8')](_0x4e3a61,_0x2ed8d6)[_0x569a('0x9')](function(_0x465c59){logger[_0x569a('0xa')](_0x569a('0xb'),_0x32dc39,_0x569a('0xc'));logger[_0x569a('0xd')](_0x569a('0xe'),_0x32dc39,_0x569a('0xc'),JSON[_0x569a('0xf')](_0x465c59));if(_0x465c59['error']){if(_0x465c59[_0x569a('0x10')][_0x569a('0x11')]===0x1f4){logger[_0x569a('0x10')](_0x569a('0xb'),_0x32dc39,_0x465c59[_0x569a('0x10')][_0x569a('0x12')]);return _0x4ced83(_0x465c59['error']['message']);}logger['error'](_0x569a('0xb'),_0x32dc39,_0x465c59[_0x569a('0x10')][_0x569a('0x12')]);return _0x1a4ffb(_0x465c59[_0x569a('0x10')][_0x569a('0x12')]);}else{logger[_0x569a('0xa')](_0x569a('0xb'),_0x32dc39,'request\x20sent');_0x1a4ffb(_0x465c59[_0x569a('0x13')][_0x569a('0x12')]);}})[_0x569a('0x14')](function(_0x554d74){logger[_0x569a('0x10')](_0x569a('0xb'),_0x32dc39,_0x554d74);_0x4ced83(_0x554d74);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index e68ea73..2504634 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 _0xf65f=['put','/:id','isAuthenticated','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller'];(function(_0x1df8d3,_0x220ecf){var _0x5799b5=function(_0x1f5e5b){while(--_0x1f5e5b){_0x1df8d3['push'](_0x1df8d3['shift']());}};_0x5799b5(++_0x220ecf);}(_0xf65f,0xe6));var _0xff65=function(_0x384904,_0x516a42){_0x384904=_0x384904-0x0;var _0x3bb81f=_0xf65f[_0x384904];return _0x3bb81f;};'use strict';var multer=require(_0xff65('0x0'));var util=require('util');var path=require(_0xff65('0x1'));var timeout=require('connect-timeout');var express=require(_0xff65('0x2'));var router=express[_0xff65('0x3')]();var fs_extra=require(_0xff65('0x4'));var auth=require(_0xff65('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xff65('0x6'));var controller=require(_0xff65('0x7'));router[_0xff65('0x8')](_0xff65('0x9'),auth[_0xff65('0xa')](),controller['update']);router[_0xff65('0xb')]('/:id',auth[_0xff65('0xa')](),controller[_0xff65('0xc')]);module[_0xff65('0xd')]=router; \ No newline at end of file +var _0xc315=['path','express','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0xc315,0x15d));var _0x5c31=function(_0xa64f60,_0x303c02){_0xa64f60=_0xa64f60-0x0;var _0x5be127=_0xc315[_0xa64f60];return _0x5be127;};'use strict';var multer=require(_0x5c31('0x0'));var util=require('util');var path=require(_0x5c31('0x1'));var timeout=require('connect-timeout');var express=require(_0x5c31('0x2'));var router=express['Router']();var fs_extra=require(_0x5c31('0x3'));var auth=require(_0x5c31('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5c31('0x5'));var controller=require(_0x5c31('0x6'));router[_0x5c31('0x7')](_0x5c31('0x8'),auth[_0x5c31('0x9')](),controller[_0x5c31('0xa')]);router[_0x5c31('0xb')](_0x5c31('0x8'),auth[_0x5c31('0x9')](),controller[_0x5c31('0xc')]);module[_0x5c31('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index aa5e7e8..423e35a 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x52be=['STRING','name','INTEGER','sequelize','exports'];(function(_0x8e487d,_0x2fe34d){var _0x1dbc6c=function(_0x219625){while(--_0x219625){_0x8e487d['push'](_0x8e487d['shift']());}};_0x1dbc6c(++_0x2fe34d);}(_0x52be,0x1cf));var _0xe52b=function(_0x42cc1f,_0xe9eb20){_0x42cc1f=_0x42cc1f-0x0;var _0x175df5=_0x52be[_0x42cc1f];return _0x175df5;};'use strict';var Sequelize=require(_0xe52b('0x0'));module[_0xe52b('0x1')]={'name':{'type':Sequelize[_0xe52b('0x2')],'allowNull':![],'unique':_0xe52b('0x3')},'OrderBy':{'type':Sequelize[_0xe52b('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xbe39=['name','STRING'];(function(_0x2dbc98,_0x10a06f){var _0x538f04=function(_0x1d9235){while(--_0x1d9235){_0x2dbc98['push'](_0x2dbc98['shift']());}};_0x538f04(++_0x10a06f);}(_0xbe39,0x145));var _0x9be3=function(_0x473c55,_0x323b87){_0x473c55=_0x473c55-0x0;var _0x222e74=_0xbe39[_0x473c55];return _0x222e74;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9be3('0x0')],'allowNull':![],'unique':_0x9be3('0x1')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x9be3('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 976a235..acb4e2a 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['count','set','Content-Range','reject','update','then','destroy','get','end','error','stack','name','send','map','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','type','merge','options','ContactItemType','include','findAll','rows','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ContactItemTypes','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0xb10b,0x12a));var _0xbb10=function(_0x12d917,_0x59ddd4){_0x12d917=_0x12d917-0x0;var _0x576d1a=_0xb10b[_0x12d917];return _0x576d1a;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x3ba6cd=_0x436104[_0xbb10('0x25')]({'plain':!![]});var _0x537898='ContactItemTypes';return db['UserProfileResource'][_0xbb10('0x24')]({'where':{'type':_0x537898,'resourceId':_0x3ba6cd['id']}})[_0xbb10('0x23')](function(){return _0x436104;});})[_0xbb10('0x23')](function(){_0x1824b7['status'](0xcc)[_0xbb10('0x26')]();});}};}function handleEntityNotFound(_0x24d586,_0x6ed43b){return function(_0x1d5e95){if(!_0x1d5e95){_0x24d586[_0xbb10('0x18')](0x194);}return _0x1d5e95;};}function handleError(_0x20d946,_0x2a0e8b){_0x2a0e8b=_0x2a0e8b||0x1f4;return function(_0x4aabb9){logger[_0xbb10('0x27')](_0x4aabb9[_0xbb10('0x28')]);if(_0x4aabb9[_0xbb10('0x29')]){delete _0x4aabb9[_0xbb10('0x29')];}_0x20d946[_0xbb10('0x19')](_0x2a0e8b)[_0xbb10('0x2a')](_0x4aabb9);};}exports['index']=function(_0x221624,_0x4ee02e){var _0x448d5c={},_0x56f2da={},_0x16ad2a={'count':0x0,'rows':[]};var _0x1dcc9c=_[_0xbb10('0x2b')](db['ContactItemType']['rawAttributes'],function(_0x4c3744){return{'name':_0x4c3744[_0xbb10('0x2c')],'type':_0x4c3744['type'][_0xbb10('0x2d')]};});_0x56f2da[_0xbb10('0x2e')]=_[_0xbb10('0x2b')](_0x1dcc9c,_0xbb10('0x29'));_0x56f2da[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0x221624[_0xbb10('0x2f')]);_0x56f2da['filters']=_[_0xbb10('0x31')](_0x56f2da[_0xbb10('0x2e')],_0x56f2da[_0xbb10('0x2f')]);_0x448d5c[_0xbb10('0x32')]=_[_0xbb10('0x31')](_0x56f2da[_0xbb10('0x2e')],qs[_0xbb10('0x33')](_0x221624[_0xbb10('0x2f')][_0xbb10('0x33')]));_0x448d5c['attributes']=_0x448d5c[_0xbb10('0x32')][_0xbb10('0x34')]?_0x448d5c[_0xbb10('0x32')]:_0x56f2da[_0xbb10('0x2e')];if(!_0x221624['query'][_0xbb10('0x35')]('nolimit')){_0x448d5c['limit']=qs[_0xbb10('0x1c')](_0x221624[_0xbb10('0x2f')][_0xbb10('0x1c')]);_0x448d5c[_0xbb10('0x1b')]=qs[_0xbb10('0x1b')](_0x221624[_0xbb10('0x2f')]['offset']);}_0x448d5c[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x221624['query']['sort']);_0x448d5c['where']=qs[_0xbb10('0x38')](_[_0xbb10('0x39')](_0x221624[_0xbb10('0x2f')],_0x56f2da['filters']),_0x1dcc9c);if(_0x221624[_0xbb10('0x2f')][_0xbb10('0x3a')]){_0x448d5c[_0xbb10('0x3b')]=_['merge'](_0x448d5c[_0xbb10('0x3b')],{'$or':_[_0xbb10('0x2b')](_0x1dcc9c,function(_0x1dcd38){if(_0x1dcd38[_0xbb10('0x3c')]!=='VIRTUAL'){var _0xd238e9={};_0xd238e9[_0x1dcd38[_0xbb10('0x29')]]={'$like':'%'+_0x221624['query'][_0xbb10('0x3a')]+'%'};return _0xd238e9;}})});}_0x448d5c=_[_0xbb10('0x3d')]({},_0x448d5c,_0x221624[_0xbb10('0x3e')]);var _0x3a9934={'where':_0x448d5c[_0xbb10('0x3b')]};return db[_0xbb10('0x3f')]['count'](_0x3a9934)[_0xbb10('0x23')](function(_0x1c7fae){_0x16ad2a[_0xbb10('0x1e')]=_0x1c7fae;if(_0x221624[_0xbb10('0x2f')]['includeAll']){_0x448d5c[_0xbb10('0x40')]=[{'all':!![]}];}return db[_0xbb10('0x3f')][_0xbb10('0x41')](_0x448d5c);})[_0xbb10('0x23')](function(_0x5e2cfa){_0x16ad2a[_0xbb10('0x42')]=_0x5e2cfa;return _0x16ad2a;})[_0xbb10('0x23')](respondWithFilteredResult(_0x4ee02e,_0x448d5c))['catch'](handleError(_0x4ee02e,null));};exports['show']=function(_0x38d78f,_0x4a3ddf){var _0x318984={'raw':!![],'where':{'id':_0x38d78f['params']['id']}},_0x180933={};_0x180933[_0xbb10('0x2e')]=_[_0xbb10('0x30')](db[_0xbb10('0x3f')]['rawAttributes']);_0x180933[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0x38d78f[_0xbb10('0x2f')]);_0x180933[_0xbb10('0x38')]=_[_0xbb10('0x31')](_0x180933[_0xbb10('0x2e')],_0x180933[_0xbb10('0x2f')]);_0x318984[_0xbb10('0x32')]=_[_0xbb10('0x31')](_0x180933[_0xbb10('0x2e')],qs[_0xbb10('0x33')](_0x38d78f[_0xbb10('0x2f')]['fields']));_0x318984[_0xbb10('0x32')]=_0x318984[_0xbb10('0x32')]['length']?_0x318984[_0xbb10('0x32')]:_0x180933[_0xbb10('0x2e')];if(_0x38d78f[_0xbb10('0x2f')][_0xbb10('0x43')]){_0x318984[_0xbb10('0x40')]=[{'all':!![]}];}_0x318984=_[_0xbb10('0x3d')]({},_0x318984,_0x38d78f[_0xbb10('0x3e')]);return db['ContactItemType']['find'](_0x318984)[_0xbb10('0x23')](handleEntityNotFound(_0x4a3ddf,null))[_0xbb10('0x23')](respondWithResult(_0x4a3ddf,null))[_0xbb10('0x44')](handleError(_0x4a3ddf,null));};exports['create']=function(_0x5f0c12,_0x3cd6f3){return db[_0xbb10('0x3f')][_0xbb10('0x45')](_0x5f0c12[_0xbb10('0x46')],{})[_0xbb10('0x23')](function(_0x22b315){var _0x2f2552=_0x5f0c12[_0xbb10('0x47')][_0xbb10('0x25')]({'plain':!![]});if(!_0x2f2552)throw new Error(_0xbb10('0x48'));if(_0x2f2552['role']==='user'){var _0x412e13=_0x22b315[_0xbb10('0x25')]({'plain':!![]});var _0x36ab7d=_0xbb10('0x49');return db[_0xbb10('0x4a')][_0xbb10('0x4b')]({'where':{'name':_0x36ab7d,'userProfileId':_0x2f2552[_0xbb10('0x4c')]},'raw':!![]})[_0xbb10('0x23')](function(_0x1c0d8f){if(_0x1c0d8f&&_0x1c0d8f[_0xbb10('0x4d')]===0x0){return db[_0xbb10('0x4e')][_0xbb10('0x45')]({'name':_0x412e13[_0xbb10('0x29')],'resourceId':_0x412e13['id'],'type':_0x1c0d8f[_0xbb10('0x29')],'sectionId':_0x1c0d8f['id']},{})[_0xbb10('0x23')](function(){return _0x22b315;});}else{return _0x22b315;}})['catch'](function(_0x124052){logger['error'](_0xbb10('0x4f'),_0x124052);throw _0x124052;});}return _0x22b315;})[_0xbb10('0x23')](respondWithResult(_0x3cd6f3,0xc9))[_0xbb10('0x44')](handleError(_0x3cd6f3,null));};exports[_0xbb10('0x22')]=function(_0x26e66e,_0x32d8e9){if(_0x26e66e[_0xbb10('0x46')]['id']){delete _0x26e66e[_0xbb10('0x46')]['id'];}return db[_0xbb10('0x3f')][_0xbb10('0x4b')]({'where':{'id':_0x26e66e[_0xbb10('0x50')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x32d8e9,null))[_0xbb10('0x23')](saveUpdates(_0x26e66e[_0xbb10('0x46')],null))[_0xbb10('0x23')](respondWithResult(_0x32d8e9,null))['catch'](handleError(_0x32d8e9,null));};exports[_0xbb10('0x24')]=function(_0x466eb7,_0x1b83a9){return db[_0xbb10('0x3f')][_0xbb10('0x4b')]({'where':{'id':_0x466eb7[_0xbb10('0x50')]['id']}})['then'](handleEntityNotFound(_0x1b83a9,null))[_0xbb10('0x23')](db[_0xbb10('0x51')][_0xbb10('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x466eb7[_0xbb10('0x50')]['id']}}))[_0xbb10('0x23')](removeEntity(_0x1b83a9,null))[_0xbb10('0x44')](handleError(_0x1b83a9,null));}; \ No newline at end of file +var _0x32f4=['Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','ContactItemTypes','UserProfileResource','end','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','nolimit','limit','sort','where','pick','filter','includeAll','include','findAll','rows','catch','show','params','keys','length','merge','options','find','create'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x32f4,0x154));var _0x432f=function(_0x52c1b9,_0x175a00){_0x52c1b9=_0x52c1b9-0x0;var _0x2b356=_0x32f4[_0x52c1b9];return _0x2b356;};'use strict';var emlformat=require(_0x432f('0x0'));var rimraf=require(_0x432f('0x1'));var zipdir=require(_0x432f('0x2'));var jsonpatch=require(_0x432f('0x3'));var rp=require('request-promise');var moment=require(_0x432f('0x4'));var BPromise=require(_0x432f('0x5'));var Mustache=require('mustache');var util=require(_0x432f('0x6'));var path=require(_0x432f('0x7'));var sox=require(_0x432f('0x8'));var csv=require(_0x432f('0x9'));var ejs=require(_0x432f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x432f('0xb'));var crypto=require(_0x432f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x432f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x432f('0xe'));var Papa=require(_0x432f('0xf'));var Redis=require(_0x432f('0x10'));var authService=require(_0x432f('0x11'));var qs=require(_0x432f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x432f('0x13'));var logger=require('../../config/logger')(_0x432f('0x14'));var utils=require('../../config/utils');var config=require(_0x432f('0x15'));var licenseUtil=require(_0x432f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x457389,_0x29f7d2){_0x29f7d2=_0x29f7d2||0xcc;return function(_0x52e40f){if(_0x52e40f){return _0x457389[_0x432f('0x17')](_0x29f7d2);}return _0x457389[_0x432f('0x18')](_0x29f7d2)['end']();};}function respondWithResult(_0x48a4db,_0x28d9e9){_0x28d9e9=_0x28d9e9||0xc8;return function(_0x44756d){if(_0x44756d){return _0x48a4db[_0x432f('0x18')](_0x28d9e9)[_0x432f('0x19')](_0x44756d);}};}function respondWithFilteredResult(_0x419bfe,_0x4f91c5){return function(_0x175ba7){if(_0x175ba7){var _0x2f0708=typeof _0x4f91c5[_0x432f('0x1a')]===_0x432f('0x1b')&&typeof _0x4f91c5['limit']===_0x432f('0x1b');var _0x30f231=_0x175ba7[_0x432f('0x1c')];var _0x243cf=_0x2f0708?0x0:_0x4f91c5[_0x432f('0x1a')];var _0x129582=_0x2f0708?_0x175ba7['count']:_0x4f91c5[_0x432f('0x1a')]+_0x4f91c5['limit'];var _0x3d545d;if(_0x129582>=_0x30f231){_0x129582=_0x30f231;_0x3d545d=0xc8;}else{_0x3d545d=0xce;}_0x419bfe[_0x432f('0x18')](_0x3d545d);return _0x419bfe[_0x432f('0x1d')](_0x432f('0x1e'),_0x243cf+'-'+_0x129582+'/'+_0x30f231)[_0x432f('0x19')](_0x175ba7);}return null;};}function patchUpdates(_0xf1f5d){return function(_0x10f39b){try{jsonpatch[_0x432f('0x1f')](_0x10f39b,_0xf1f5d,!![]);}catch(_0x693eb3){return BPromise[_0x432f('0x20')](_0x693eb3);}return _0x10f39b[_0x432f('0x21')]();};}function saveUpdates(_0x3446fd,_0x4dd230){return function(_0x5940bd){if(_0x5940bd){return _0x5940bd[_0x432f('0x22')](_0x3446fd)['then'](function(_0x28968e){return _0x28968e;});}return null;};}function removeEntity(_0x5b9c70,_0x37f136){return function(_0x175d1b){if(_0x175d1b){return _0x175d1b[_0x432f('0x23')]()[_0x432f('0x24')](function(){var _0x2f84a7=_0x175d1b[_0x432f('0x25')]({'plain':!![]});var _0x59f352=_0x432f('0x26');return db[_0x432f('0x27')]['destroy']({'where':{'type':_0x59f352,'resourceId':_0x2f84a7['id']}})[_0x432f('0x24')](function(){return _0x175d1b;});})[_0x432f('0x24')](function(){_0x5b9c70[_0x432f('0x18')](0xcc)[_0x432f('0x28')]();});}};}function handleEntityNotFound(_0x44839,_0x781862){return function(_0x138a6a){if(!_0x138a6a){_0x44839['sendStatus'](0x194);}return _0x138a6a;};}function handleError(_0x294bfe,_0x4eeae1){_0x4eeae1=_0x4eeae1||0x1f4;return function(_0x1f1fdd){logger['error'](_0x1f1fdd[_0x432f('0x29')]);if(_0x1f1fdd['name']){delete _0x1f1fdd[_0x432f('0x2a')];}_0x294bfe['status'](_0x4eeae1)[_0x432f('0x2b')](_0x1f1fdd);};}exports[_0x432f('0x2c')]=function(_0x263cd8,_0x59c1ab){var _0x6a116e={},_0x24406a={},_0x48139b={'count':0x0,'rows':[]};var _0x5ee0fa=_[_0x432f('0x2d')](db[_0x432f('0x2e')][_0x432f('0x2f')],function(_0x3581c2){return{'name':_0x3581c2[_0x432f('0x30')],'type':_0x3581c2[_0x432f('0x31')]['key']};});_0x24406a['model']=_[_0x432f('0x2d')](_0x5ee0fa,_0x432f('0x2a'));_0x24406a[_0x432f('0x32')]=_['keys'](_0x263cd8[_0x432f('0x32')]);_0x24406a[_0x432f('0x33')]=_[_0x432f('0x34')](_0x24406a[_0x432f('0x35')],_0x24406a[_0x432f('0x32')]);_0x6a116e[_0x432f('0x36')]=_[_0x432f('0x34')](_0x24406a[_0x432f('0x35')],qs['fields'](_0x263cd8['query'][_0x432f('0x37')]));_0x6a116e[_0x432f('0x36')]=_0x6a116e['attributes']['length']?_0x6a116e['attributes']:_0x24406a[_0x432f('0x35')];if(!_0x263cd8[_0x432f('0x32')]['hasOwnProperty'](_0x432f('0x38'))){_0x6a116e[_0x432f('0x39')]=qs[_0x432f('0x39')](_0x263cd8['query'][_0x432f('0x39')]);_0x6a116e[_0x432f('0x1a')]=qs['offset'](_0x263cd8[_0x432f('0x32')][_0x432f('0x1a')]);}_0x6a116e['order']=qs[_0x432f('0x3a')](_0x263cd8[_0x432f('0x32')][_0x432f('0x3a')]);_0x6a116e[_0x432f('0x3b')]=qs[_0x432f('0x33')](_[_0x432f('0x3c')](_0x263cd8[_0x432f('0x32')],_0x24406a[_0x432f('0x33')]),_0x5ee0fa);if(_0x263cd8[_0x432f('0x32')][_0x432f('0x3d')]){_0x6a116e[_0x432f('0x3b')]=_['merge'](_0x6a116e[_0x432f('0x3b')],{'$or':_['map'](_0x5ee0fa,function(_0x1550fc){if(_0x1550fc[_0x432f('0x31')]!=='VIRTUAL'){var _0x43d836={};_0x43d836[_0x1550fc['name']]={'$like':'%'+_0x263cd8[_0x432f('0x32')][_0x432f('0x3d')]+'%'};return _0x43d836;}})});}_0x6a116e=_['merge']({},_0x6a116e,_0x263cd8['options']);var _0xbd4240={'where':_0x6a116e[_0x432f('0x3b')]};return db[_0x432f('0x2e')][_0x432f('0x1c')](_0xbd4240)[_0x432f('0x24')](function(_0x513a57){_0x48139b['count']=_0x513a57;if(_0x263cd8['query'][_0x432f('0x3e')]){_0x6a116e[_0x432f('0x3f')]=[{'all':!![]}];}return db['ContactItemType'][_0x432f('0x40')](_0x6a116e);})[_0x432f('0x24')](function(_0x41c90c){_0x48139b[_0x432f('0x41')]=_0x41c90c;return _0x48139b;})[_0x432f('0x24')](respondWithFilteredResult(_0x59c1ab,_0x6a116e))[_0x432f('0x42')](handleError(_0x59c1ab,null));};exports[_0x432f('0x43')]=function(_0x1a2be2,_0x1c5f87){var _0x5c6298={'raw':!![],'where':{'id':_0x1a2be2[_0x432f('0x44')]['id']}},_0x247b63={};_0x247b63['model']=_[_0x432f('0x45')](db[_0x432f('0x2e')][_0x432f('0x2f')]);_0x247b63[_0x432f('0x32')]=_[_0x432f('0x45')](_0x1a2be2[_0x432f('0x32')]);_0x247b63[_0x432f('0x33')]=_[_0x432f('0x34')](_0x247b63[_0x432f('0x35')],_0x247b63[_0x432f('0x32')]);_0x5c6298[_0x432f('0x36')]=_[_0x432f('0x34')](_0x247b63[_0x432f('0x35')],qs[_0x432f('0x37')](_0x1a2be2['query']['fields']));_0x5c6298[_0x432f('0x36')]=_0x5c6298[_0x432f('0x36')][_0x432f('0x46')]?_0x5c6298[_0x432f('0x36')]:_0x247b63[_0x432f('0x35')];if(_0x1a2be2['query'][_0x432f('0x3e')]){_0x5c6298[_0x432f('0x3f')]=[{'all':!![]}];}_0x5c6298=_[_0x432f('0x47')]({},_0x5c6298,_0x1a2be2[_0x432f('0x48')]);return db[_0x432f('0x2e')][_0x432f('0x49')](_0x5c6298)[_0x432f('0x24')](handleEntityNotFound(_0x1c5f87,null))['then'](respondWithResult(_0x1c5f87,null))[_0x432f('0x42')](handleError(_0x1c5f87,null));};exports[_0x432f('0x4a')]=function(_0x359853,_0x547bd0){return db[_0x432f('0x2e')][_0x432f('0x4a')](_0x359853['body'],{})['then'](function(_0x3b2021){var _0x24f244=_0x359853['user']['get']({'plain':!![]});if(!_0x24f244)throw new Error(_0x432f('0x4b'));if(_0x24f244['role']===_0x432f('0x4c')){var _0x66b80e=_0x3b2021['get']({'plain':!![]});var _0x12f2f7='ContactItemTypes';return db[_0x432f('0x4d')][_0x432f('0x49')]({'where':{'name':_0x12f2f7,'userProfileId':_0x24f244[_0x432f('0x4e')]},'raw':!![]})[_0x432f('0x24')](function(_0x3051ea){if(_0x3051ea&&_0x3051ea[_0x432f('0x4f')]===0x0){return db['UserProfileResource'][_0x432f('0x4a')]({'name':_0x66b80e['name'],'resourceId':_0x66b80e['id'],'type':_0x3051ea[_0x432f('0x2a')],'sectionId':_0x3051ea['id']},{})[_0x432f('0x24')](function(){return _0x3b2021;});}else{return _0x3b2021;}})[_0x432f('0x42')](function(_0x21ae8c){logger['error'](_0x432f('0x50'),_0x21ae8c);throw _0x21ae8c;});}return _0x3b2021;})[_0x432f('0x24')](respondWithResult(_0x547bd0,0xc9))[_0x432f('0x42')](handleError(_0x547bd0,null));};exports[_0x432f('0x22')]=function(_0x13aced,_0x2a26bd){if(_0x13aced[_0x432f('0x51')]['id']){delete _0x13aced['body']['id'];}return db['ContactItemType'][_0x432f('0x49')]({'where':{'id':_0x13aced[_0x432f('0x44')]['id']}})[_0x432f('0x24')](handleEntityNotFound(_0x2a26bd,null))[_0x432f('0x24')](saveUpdates(_0x13aced[_0x432f('0x51')],null))[_0x432f('0x24')](respondWithResult(_0x2a26bd,null))['catch'](handleError(_0x2a26bd,null));};exports[_0x432f('0x23')]=function(_0x545035,_0x4e96d8){return db[_0x432f('0x2e')][_0x432f('0x49')]({'where':{'id':_0x545035[_0x432f('0x44')]['id']}})[_0x432f('0x24')](handleEntityNotFound(_0x4e96d8,null))[_0x432f('0x24')](db[_0x432f('0x52')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x545035[_0x432f('0x44')]['id']}}))[_0x432f('0x24')](removeEntity(_0x4e96d8,null))['catch'](handleError(_0x4e96d8,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 05fba0a..4b91be4 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3079=['util','api','moment','bluebird','request-promise','path','../../config/environment','./contactItemType.attributes','exports','define','lodash'];(function(_0x454883,_0x5b0757){var _0x18d8bc=function(_0x381498){while(--_0x381498){_0x454883['push'](_0x454883['shift']());}};_0x18d8bc(++_0x5b0757);}(_0x3079,0x112));var _0x9307=function(_0x3bead1,_0xd1d368){_0x3bead1=_0x3bead1-0x0;var _0xebd16d=_0x3079[_0x3bead1];return _0xebd16d;};'use strict';var _=require(_0x9307('0x0'));var util=require(_0x9307('0x1'));var logger=require('../../config/logger')(_0x9307('0x2'));var moment=require(_0x9307('0x3'));var BPromise=require(_0x9307('0x4'));var rp=require(_0x9307('0x5'));var fs=require('fs');var path=require(_0x9307('0x6'));var rimraf=require('rimraf');var config=require(_0x9307('0x7'));var attributes=require(_0x9307('0x8'));module[_0x9307('0x9')]=function(_0x5b189b,_0x5deffa){return _0x5b189b[_0x9307('0xa')]('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0865=['bluebird','request-promise','path','../../config/environment','exports','tools_contact_item_types','util','../../config/logger'];(function(_0x40a13b,_0x134e8e){var _0x259445=function(_0x12f4d3){while(--_0x12f4d3){_0x40a13b['push'](_0x40a13b['shift']());}};_0x259445(++_0x134e8e);}(_0x0865,0x156));var _0x5086=function(_0x16867b,_0x4e2bc3){_0x16867b=_0x16867b-0x0;var _0x4d46fa=_0x0865[_0x16867b];return _0x4d46fa;};'use strict';var _=require('lodash');var util=require(_0x5086('0x0'));var logger=require(_0x5086('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5086('0x2'));var rp=require(_0x5086('0x3'));var fs=require('fs');var path=require(_0x5086('0x4'));var rimraf=require('rimraf');var config=require(_0x5086('0x5'));var attributes=require('./contactItemType.attributes');module[_0x5086('0x6')]=function(_0x421c3e,_0x33fd3f){return _0x421c3e['define']('ContactItemType',attributes,{'tableName':_0x5086('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 44830ef..6b76687 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9750=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','../../config/utils','../../config/logger'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9750,0x199));var _0x0975=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x9750[_0x433a86];return _0x23000c;};'use strict';var _=require('lodash');var util=require(_0x0975('0x0'));var moment=require(_0x0975('0x1'));var BPromise=require('bluebird');var rs=require(_0x0975('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0975('0x3'));var logger=require(_0x0975('0x4'))(_0x0975('0x5'));var config=require(_0x0975('0x6'));var jayson=require(_0x0975('0x7'));var client=jayson[_0x0975('0x8')][_0x0975('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe68205,_0x27a194,_0x5c0cf6){return new BPromise(function(_0x1532b3,_0x1e676e){return client[_0x0975('0xa')](_0xe68205,_0x5c0cf6)[_0x0975('0xb')](function(_0x1dcf72){logger[_0x0975('0xc')]('ContactItemType,\x20%s,\x20%s',_0x27a194,_0x0975('0xd'));logger[_0x0975('0xe')](_0x0975('0xf'),_0x27a194,_0x0975('0xd'),JSON[_0x0975('0x10')](_0x1dcf72));if(_0x1dcf72[_0x0975('0x11')]){if(_0x1dcf72[_0x0975('0x11')][_0x0975('0x12')]===0x1f4){logger[_0x0975('0x11')](_0x0975('0x13'),_0x27a194,_0x1dcf72[_0x0975('0x11')]['message']);return _0x1e676e(_0x1dcf72[_0x0975('0x11')][_0x0975('0x14')]);}logger[_0x0975('0x11')](_0x0975('0x13'),_0x27a194,_0x1dcf72[_0x0975('0x11')][_0x0975('0x14')]);return _0x1532b3(_0x1dcf72[_0x0975('0x11')][_0x0975('0x14')]);}else{logger[_0x0975('0xc')](_0x0975('0x13'),_0x27a194,_0x0975('0xd'));_0x1532b3(_0x1dcf72[_0x0975('0x15')]['message']);}})[_0x0975('0x16')](function(_0x263d75){logger[_0x0975('0x11')](_0x0975('0x13'),_0x27a194,_0x263d75);_0x1e676e(_0x263d75);});});} \ No newline at end of file +var _0x7211=['then','info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','result','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x50605b,_0x529812){var _0x2627f3=function(_0x1c8f0d){while(--_0x1c8f0d){_0x50605b['push'](_0x50605b['shift']());}};_0x2627f3(++_0x529812);}(_0x7211,0x123));var _0x1721=function(_0x5b888b,_0xd9f3a4){_0x5b888b=_0x5b888b-0x0;var _0x36b905=_0x7211[_0x5b888b];return _0x36b905;};'use strict';var _=require('lodash');var util=require(_0x1721('0x0'));var moment=require(_0x1721('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1721('0x2'))['db'];var utils=require(_0x1721('0x3'));var logger=require(_0x1721('0x4'))(_0x1721('0x5'));var config=require(_0x1721('0x6'));var jayson=require(_0x1721('0x7'));var client=jayson['client'][_0x1721('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a2d36,_0x4d46a9,_0x35007f){return new BPromise(function(_0x334de9,_0x2ab633){return client['request'](_0x2a2d36,_0x35007f)[_0x1721('0x9')](function(_0xb0bd1){logger[_0x1721('0xa')]('ContactItemType,\x20%s,\x20%s',_0x4d46a9,_0x1721('0xb'));logger[_0x1721('0xc')](_0x1721('0xd'),_0x4d46a9,_0x1721('0xb'),JSON[_0x1721('0xe')](_0xb0bd1));if(_0xb0bd1['error']){if(_0xb0bd1[_0x1721('0xf')][_0x1721('0x10')]===0x1f4){logger[_0x1721('0xf')](_0x1721('0x11'),_0x4d46a9,_0xb0bd1[_0x1721('0xf')][_0x1721('0x12')]);return _0x2ab633(_0xb0bd1[_0x1721('0xf')][_0x1721('0x12')]);}logger['error'](_0x1721('0x11'),_0x4d46a9,_0xb0bd1['error'][_0x1721('0x12')]);return _0x334de9(_0xb0bd1[_0x1721('0xf')][_0x1721('0x12')]);}else{logger[_0x1721('0xa')](_0x1721('0x11'),_0x4d46a9,'request\x20sent');_0x334de9(_0xb0bd1[_0x1721('0x13')][_0x1721('0x12')]);}})['catch'](function(_0x321eed){logger[_0x1721('0xf')]('ContactItemType,\x20%s,\x20%s',_0x4d46a9,_0x321eed);_0x2ab633(_0x321eed);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index bb6a7b2..4c6b700 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d9c=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','/:id','post'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x8d9c,0x71));var _0xc8d9=function(_0x5a6d6b,_0x29c89c){_0x5a6d6b=_0x5a6d6b-0x0;var _0x11a5cb=_0x8d9c[_0x5a6d6b];return _0x11a5cb;};'use strict';var multer=require(_0xc8d9('0x0'));var util=require(_0xc8d9('0x1'));var path=require(_0xc8d9('0x2'));var timeout=require(_0xc8d9('0x3'));var express=require(_0xc8d9('0x4'));var router=express[_0xc8d9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8d9('0x6'));var interaction=require(_0xc8d9('0x7'));var config=require('../../config/environment');var controller=require(_0xc8d9('0x8'));router[_0xc8d9('0x9')]('/',auth[_0xc8d9('0xa')](),controller['index']);router[_0xc8d9('0x9')](_0xc8d9('0xb'),auth[_0xc8d9('0xa')](),controller['show']);router[_0xc8d9('0xc')]('/',auth[_0xc8d9('0xa')](),controller[_0xc8d9('0xd')]);router[_0xc8d9('0xe')]('/:id',auth[_0xc8d9('0xa')](),controller[_0xc8d9('0xf')]);router[_0xc8d9('0x10')](_0xc8d9('0xb'),auth[_0xc8d9('0xa')](),controller['destroy']);module[_0xc8d9('0x11')]=router; \ No newline at end of file +var _0x736c=['post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./contactItemType.controller','isAuthenticated','/:id','show'];(function(_0x129d04,_0x5c0644){var _0x3cb2ff=function(_0x5274ef){while(--_0x5274ef){_0x129d04['push'](_0x129d04['shift']());}};_0x3cb2ff(++_0x5c0644);}(_0x736c,0x6b));var _0xc736=function(_0x2a0738,_0x3c0bc5){_0x2a0738=_0x2a0738-0x0;var _0x159679=_0x736c[_0x2a0738];return _0x159679;};'use strict';var multer=require(_0xc736('0x0'));var util=require(_0xc736('0x1'));var path=require(_0xc736('0x2'));var timeout=require(_0xc736('0x3'));var express=require(_0xc736('0x4'));var router=express[_0xc736('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc736('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc736('0x7'));var controller=require(_0xc736('0x8'));router['get']('/',auth[_0xc736('0x9')](),controller['index']);router['get'](_0xc736('0xa'),auth[_0xc736('0x9')](),controller[_0xc736('0xb')]);router[_0xc736('0xc')]('/',auth[_0xc736('0x9')](),controller[_0xc736('0xd')]);router[_0xc736('0xe')](_0xc736('0xa'),auth[_0xc736('0x9')](),controller[_0xc736('0xf')]);router[_0xc736('0x10')](_0xc736('0xa'),auth[_0xc736('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 2e7ad18..68032a8 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 _0x0713=['STRING','name'];(function(_0xbd3562,_0x49f8cf){var _0x5b5668=function(_0xdda8f2){while(--_0xdda8f2){_0xbd3562['push'](_0xbd3562['shift']());}};_0x5b5668(++_0x49f8cf);}(_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 +var _0xb10b=['name','sequelize','STRING'];(function(_0x419ddb,_0x2ce2ea){var _0x5200b4=function(_0x286b54){while(--_0x286b54){_0x419ddb['push'](_0x419ddb['shift']());}};_0x5200b4(++_0x2ce2ea);}(_0xb10b,0x12a));var _0xbb10=function(_0x533852,_0x5e1347){_0x533852=_0x533852-0x0;var _0x3b39f2=_0xb10b[_0x533852];return _0x3b39f2;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index dbc381b..cd8b7ab 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 _0xddd2=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','status','end','json','offset','undefined','count','limit','set','apply','save','update','destroy','then','UserProfileResource','sendStatus','error','stack','name','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','omit','updatedAt','createdAt','CustomDashboards','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','findOne','getItems','nolimit','eml-format','rimraf'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xddd2,0x181));var _0x2ddd=function(_0x97ec0e,_0x10eb67){_0x97ec0e=_0x97ec0e-0x0;var _0x1fd9dd=_0xddd2[_0x97ec0e];return _0x1fd9dd;};'use strict';var emlformat=require(_0x2ddd('0x0'));var rimraf=require(_0x2ddd('0x1'));var zipdir=require(_0x2ddd('0x2'));var jsonpatch=require(_0x2ddd('0x3'));var rp=require(_0x2ddd('0x4'));var moment=require('moment');var BPromise=require(_0x2ddd('0x5'));var Mustache=require(_0x2ddd('0x6'));var util=require(_0x2ddd('0x7'));var path=require('path');var sox=require(_0x2ddd('0x8'));var csv=require('to-csv');var ejs=require(_0x2ddd('0x9'));var fs=require('fs');var fs_extra=require(_0x2ddd('0xa'));var _=require(_0x2ddd('0xb'));var squel=require(_0x2ddd('0xc'));var crypto=require(_0x2ddd('0xd'));var jsforce=require(_0x2ddd('0xe'));var deskjs=require(_0x2ddd('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2ddd('0x10'));var Papa=require(_0x2ddd('0x11'));var Redis=require(_0x2ddd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2ddd('0x13'));var as=require(_0x2ddd('0x14'));var hardwareService=require(_0x2ddd('0x15'));var logger=require(_0x2ddd('0x16'))(_0x2ddd('0x17'));var utils=require(_0x2ddd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2ddd('0x19'));var db=require(_0x2ddd('0x1a'))['db'];config[_0x2ddd('0x1b')]=_[_0x2ddd('0x1c')](config[_0x2ddd('0x1b')],{'host':_0x2ddd('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ddd('0x1b')]));require('./dashboard.socket')[_0x2ddd('0x1e')](socket);function respondWithStatusCode(_0x199e1e,_0x12562c){_0x12562c=_0x12562c||0xcc;return function(_0x501f7b){if(_0x501f7b){return _0x199e1e['sendStatus'](_0x12562c);}return _0x199e1e[_0x2ddd('0x1f')](_0x12562c)[_0x2ddd('0x20')]();};}function respondWithResult(_0x12814c,_0x56f226){_0x56f226=_0x56f226||0xc8;return function(_0x3e3857){if(_0x3e3857){return _0x12814c[_0x2ddd('0x1f')](_0x56f226)[_0x2ddd('0x21')](_0x3e3857);}};}function respondWithFilteredResult(_0x435866,_0x21e06a){return function(_0x38a412){if(_0x38a412){var _0x3db759=typeof _0x21e06a[_0x2ddd('0x22')]==='undefined'&&typeof _0x21e06a['limit']===_0x2ddd('0x23');var _0x53a6c4=_0x38a412[_0x2ddd('0x24')];var _0x559116=_0x3db759?0x0:_0x21e06a['offset'];var _0x540852=_0x3db759?_0x38a412[_0x2ddd('0x24')]:_0x21e06a['offset']+_0x21e06a[_0x2ddd('0x25')];var _0x59905a;if(_0x540852>=_0x53a6c4){_0x540852=_0x53a6c4;_0x59905a=0xc8;}else{_0x59905a=0xce;}_0x435866[_0x2ddd('0x1f')](_0x59905a);return _0x435866[_0x2ddd('0x26')]('Content-Range',_0x559116+'-'+_0x540852+'/'+_0x53a6c4)[_0x2ddd('0x21')](_0x38a412);}return null;};}function patchUpdates(_0x5b66a1){return function(_0x1b8576){try{jsonpatch[_0x2ddd('0x27')](_0x1b8576,_0x5b66a1,!![]);}catch(_0x2e2f95){return BPromise['reject'](_0x2e2f95);}return _0x1b8576[_0x2ddd('0x28')]();};}function saveUpdates(_0x352aaa,_0x34179b){return function(_0x728dbe){if(_0x728dbe){return _0x728dbe[_0x2ddd('0x29')](_0x352aaa)['then'](function(_0xe8acc1){return _0xe8acc1;});}return null;};}function removeEntity(_0x181ccd,_0x250694){return function(_0x31c449){if(_0x31c449){return _0x31c449[_0x2ddd('0x2a')]()[_0x2ddd('0x2b')](function(){var _0x28f723=_0x31c449['get']({'plain':!![]});var _0x12ccf2='CustomDashboards';return db[_0x2ddd('0x2c')][_0x2ddd('0x2a')]({'where':{'type':_0x12ccf2,'resourceId':_0x28f723['id']}})['then'](function(){return _0x31c449;});})[_0x2ddd('0x2b')](function(){_0x181ccd[_0x2ddd('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x543349,_0x3067d0){return function(_0x3d4c33){if(!_0x3d4c33){_0x543349[_0x2ddd('0x2d')](0x194);}return _0x3d4c33;};}function handleError(_0xf531cc,_0x5d591c){_0x5d591c=_0x5d591c||0x1f4;return function(_0x529ffd){logger[_0x2ddd('0x2e')](_0x529ffd[_0x2ddd('0x2f')]);if(_0x529ffd['name']){delete _0x529ffd[_0x2ddd('0x30')];}_0xf531cc['status'](_0x5d591c)['send'](_0x529ffd);};}exports['index']=function(_0x286542,_0xd845d){var _0x48f963={},_0x9755c5={},_0x5d6725={'count':0x0,'rows':[]};var _0x5a582a=_[_0x2ddd('0x31')](db[_0x2ddd('0x32')][_0x2ddd('0x33')],function(_0x1d95d4){return{'name':_0x1d95d4[_0x2ddd('0x34')],'type':_0x1d95d4[_0x2ddd('0x35')][_0x2ddd('0x36')]};});_0x9755c5[_0x2ddd('0x37')]=_['map'](_0x5a582a,_0x2ddd('0x30'));_0x9755c5[_0x2ddd('0x38')]=_[_0x2ddd('0x39')](_0x286542[_0x2ddd('0x38')]);_0x9755c5[_0x2ddd('0x3a')]=_[_0x2ddd('0x3b')](_0x9755c5[_0x2ddd('0x37')],_0x9755c5[_0x2ddd('0x38')]);_0x48f963[_0x2ddd('0x3c')]=_[_0x2ddd('0x3b')](_0x9755c5[_0x2ddd('0x37')],qs[_0x2ddd('0x3d')](_0x286542['query']['fields']));_0x48f963[_0x2ddd('0x3c')]=_0x48f963['attributes'][_0x2ddd('0x3e')]?_0x48f963[_0x2ddd('0x3c')]:_0x9755c5['model'];if(!_0x286542[_0x2ddd('0x38')][_0x2ddd('0x3f')]('nolimit')){_0x48f963[_0x2ddd('0x25')]=qs[_0x2ddd('0x25')](_0x286542[_0x2ddd('0x38')][_0x2ddd('0x25')]);_0x48f963[_0x2ddd('0x22')]=qs[_0x2ddd('0x22')](_0x286542[_0x2ddd('0x38')][_0x2ddd('0x22')]);}_0x48f963[_0x2ddd('0x40')]=qs[_0x2ddd('0x41')](_0x286542['query'][_0x2ddd('0x41')]);_0x48f963[_0x2ddd('0x42')]=qs[_0x2ddd('0x3a')](_[_0x2ddd('0x43')](_0x286542[_0x2ddd('0x38')],_0x9755c5[_0x2ddd('0x3a')]),_0x5a582a);if(_0x286542[_0x2ddd('0x38')][_0x2ddd('0x44')]){_0x48f963[_0x2ddd('0x42')]=_['merge'](_0x48f963[_0x2ddd('0x42')],{'$or':_[_0x2ddd('0x31')](_0x5a582a,function(_0x3d1170){if(_0x3d1170[_0x2ddd('0x35')]!==_0x2ddd('0x45')){var _0x25e74f={};_0x25e74f[_0x3d1170[_0x2ddd('0x30')]]={'$like':'%'+_0x286542['query'][_0x2ddd('0x44')]+'%'};return _0x25e74f;}})});}_0x48f963=_[_0x2ddd('0x46')]({},_0x48f963,_0x286542[_0x2ddd('0x47')]);var _0x51c823={'where':_0x48f963[_0x2ddd('0x42')]};return db[_0x2ddd('0x32')][_0x2ddd('0x24')](_0x51c823)['then'](function(_0x4ecb00){_0x5d6725[_0x2ddd('0x24')]=_0x4ecb00;if(_0x286542[_0x2ddd('0x38')][_0x2ddd('0x48')]){_0x48f963[_0x2ddd('0x49')]=[{'all':!![]}];}return db[_0x2ddd('0x32')][_0x2ddd('0x4a')](_0x48f963);})[_0x2ddd('0x2b')](function(_0x4ca9c6){_0x5d6725['rows']=_0x4ca9c6;return _0x5d6725;})['then'](respondWithFilteredResult(_0xd845d,_0x48f963))[_0x2ddd('0x4b')](handleError(_0xd845d,null));};exports['show']=function(_0x10ee03,_0x56359f){var _0x40c23c={'raw':![],'where':{'id':_0x10ee03[_0x2ddd('0x4c')]['id']}},_0x1f32b6={};_0x1f32b6[_0x2ddd('0x37')]=_[_0x2ddd('0x39')](db[_0x2ddd('0x32')][_0x2ddd('0x33')]);_0x1f32b6['query']=_[_0x2ddd('0x39')](_0x10ee03[_0x2ddd('0x38')]);_0x1f32b6[_0x2ddd('0x3a')]=_['intersection'](_0x1f32b6[_0x2ddd('0x37')],_0x1f32b6['query']);_0x40c23c['attributes']=_[_0x2ddd('0x3b')](_0x1f32b6['model'],qs[_0x2ddd('0x3d')](_0x10ee03[_0x2ddd('0x38')][_0x2ddd('0x3d')]));_0x40c23c[_0x2ddd('0x3c')]=_0x40c23c[_0x2ddd('0x3c')][_0x2ddd('0x3e')]?_0x40c23c[_0x2ddd('0x3c')]:_0x1f32b6[_0x2ddd('0x37')];if(_0x10ee03[_0x2ddd('0x38')][_0x2ddd('0x48')]){_0x40c23c[_0x2ddd('0x49')]=[{'all':!![]}];}_0x40c23c=_['merge']({},_0x40c23c,_0x10ee03['options']);return db[_0x2ddd('0x32')][_0x2ddd('0x4d')](_0x40c23c)[_0x2ddd('0x2b')](handleEntityNotFound(_0x56359f,null))[_0x2ddd('0x2b')](respondWithResult(_0x56359f,null))['catch'](handleError(_0x56359f,null));};exports[_0x2ddd('0x4e')]=function(_0x5a6677,_0x43e05d){return db[_0x2ddd('0x32')][_0x2ddd('0x4e')](_0x5a6677[_0x2ddd('0x4f')],{})['then'](function(_0x30fff8){var _0x47a686=_0x5a6677[_0x2ddd('0x50')][_0x2ddd('0x51')]({'plain':!![]});if(!_0x47a686)throw new Error(_0x2ddd('0x52'));if(_0x47a686[_0x2ddd('0x53')]===_0x2ddd('0x50')){var _0x4724ee=_0x30fff8[_0x2ddd('0x51')]({'plain':!![]});var _0x32dd42='CustomDashboards';return db[_0x2ddd('0x54')][_0x2ddd('0x4d')]({'where':{'name':_0x32dd42,'userProfileId':_0x47a686['userProfileId']},'raw':!![]})[_0x2ddd('0x2b')](function(_0x363517){if(_0x363517&&_0x363517[_0x2ddd('0x55')]===0x0){return db[_0x2ddd('0x2c')]['create']({'name':_0x4724ee[_0x2ddd('0x30')],'resourceId':_0x4724ee['id'],'type':_0x363517[_0x2ddd('0x30')],'sectionId':_0x363517['id']},{})[_0x2ddd('0x2b')](function(){return _0x30fff8;});}else{return _0x30fff8;}})[_0x2ddd('0x4b')](function(_0x1bb5e2){logger[_0x2ddd('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bb5e2);throw _0x1bb5e2;});}return _0x30fff8;})['then'](respondWithResult(_0x43e05d,0xc9))[_0x2ddd('0x4b')](handleError(_0x43e05d,null));};exports['clone']=function(_0x1e1b1e,_0x5ab733){var _0x4cd58d={'where':{'id':_0x1e1b1e['params']['id']}},_0x4f4f41={};_0x4f4f41[_0x2ddd('0x37')]=_[_0x2ddd('0x39')](db['Dashboard']['rawAttributes']);_0x4cd58d['attributes']=_[_0x2ddd('0x3b')](_0x4f4f41['model'],qs[_0x2ddd('0x3d')](_0x1e1b1e[_0x2ddd('0x38')][_0x2ddd('0x3d')]));_0x4cd58d['attributes']=_0x4cd58d[_0x2ddd('0x3c')][_0x2ddd('0x3e')]?_0x4cd58d[_0x2ddd('0x3c')]:_0x4f4f41[_0x2ddd('0x37')];if(_0x1e1b1e['query'][_0x2ddd('0x48')]){_0x4cd58d[_0x2ddd('0x49')]=[{'all':!![]}];}_0x4cd58d=_[_0x2ddd('0x46')]({},_0x4cd58d,_0x1e1b1e['options']);return db['Dashboard'][_0x2ddd('0x4d')](_0x4cd58d)['then'](handleEntityNotFound(_0x5ab733,null))[_0x2ddd('0x2b')](function(_0x20d39a){if(_0x20d39a){var _0x123731=_0x20d39a[_0x2ddd('0x51')]({'plain':!![]});_0x123731=qs[_0x2ddd('0x56')](_0x123731,['id','createdAt',_0x2ddd('0x57')]);_0x1e1b1e['body']=_[_0x2ddd('0x56')](_0x1e1b1e[_0x2ddd('0x4f')],['id',_0x2ddd('0x58'),_0x2ddd('0x57')]);return db[_0x2ddd('0x32')][_0x2ddd('0x4e')](_[_0x2ddd('0x46')](_0x123731,_0x1e1b1e['body']),{'include':_0x1e1b1e[_0x2ddd('0x38')][_0x2ddd('0x48')]?[{'all':!![]}]:undefined})[_0x2ddd('0x2b')](function(_0x1bf05c){var _0x4acaeb=_0x1e1b1e[_0x2ddd('0x50')][_0x2ddd('0x51')]({'plain':!![]});if(!_0x4acaeb)throw new Error(_0x2ddd('0x52'));if(_0x4acaeb[_0x2ddd('0x53')]===_0x2ddd('0x50')){var _0x2bcba4=_0x1bf05c[_0x2ddd('0x51')]({'plain':!![]});var _0x4fe82a=_0x2ddd('0x59');return db[_0x2ddd('0x54')]['find']({'where':{'name':_0x4fe82a,'userProfileId':_0x4acaeb[_0x2ddd('0x5a')]},'raw':!![]})['then'](function(_0x1633cb){if(_0x1633cb&&_0x1633cb[_0x2ddd('0x55')]===0x0){return db[_0x2ddd('0x2c')][_0x2ddd('0x4e')]({'name':_0x2bcba4[_0x2ddd('0x30')],'resourceId':_0x2bcba4['id'],'type':_0x1633cb[_0x2ddd('0x30')],'sectionId':_0x1633cb['id']},{})[_0x2ddd('0x2b')](function(){return _0x1bf05c;});}else{return _0x1bf05c;}})[_0x2ddd('0x4b')](function(_0x1e228d){logger[_0x2ddd('0x2e')](_0x2ddd('0x5b'),_0x1e228d);throw _0x1e228d;});}return _0x1bf05c;});}})['then'](respondWithResult(_0x5ab733,0xc9))[_0x2ddd('0x4b')](handleError(_0x5ab733,null));};exports[_0x2ddd('0x29')]=function(_0x22d3f9,_0x41d406){if(_0x22d3f9['body']['id']){delete _0x22d3f9[_0x2ddd('0x4f')]['id'];}return db['Dashboard'][_0x2ddd('0x4d')]({'where':{'id':_0x22d3f9['params']['id']}})[_0x2ddd('0x2b')](handleEntityNotFound(_0x41d406,null))[_0x2ddd('0x2b')](saveUpdates(_0x22d3f9[_0x2ddd('0x4f')],null))[_0x2ddd('0x2b')](respondWithResult(_0x41d406,null))[_0x2ddd('0x4b')](handleError(_0x41d406,null));};exports[_0x2ddd('0x2a')]=function(_0x59ed9c,_0xafad4d){return db[_0x2ddd('0x32')][_0x2ddd('0x4d')]({'where':{'id':_0x59ed9c[_0x2ddd('0x4c')]['id']}})[_0x2ddd('0x2b')](handleEntityNotFound(_0xafad4d,null))[_0x2ddd('0x2b')](removeEntity(_0xafad4d,null))[_0x2ddd('0x4b')](handleError(_0xafad4d,null));};function widgetAttributes(_0x3913fa){try{switch(_0x3913fa[_0x2ddd('0x35')]){case _0x2ddd('0x5c'):return[{'name':_0x2ddd('0x5d'),'value':_0x3913fa[_0x2ddd('0x5d')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x0]?_0x3913fa[_0x2ddd('0x5e')][0x0][_0x2ddd('0x5f')]:undefined)||_0x2ddd('0x60')}];case _0x2ddd('0x61'):return[{'name':_0x2ddd('0x62'),'value':_0x3913fa[_0x2ddd('0x62')]||(_0x3913fa['attrs']&&_0x3913fa[_0x2ddd('0x5e')][0x0]?_0x3913fa[_0x2ddd('0x5e')][0x0][_0x2ddd('0x5f')]:undefined)||''}];case _0x2ddd('0x63'):return[{'name':_0x2ddd('0x64'),'value':_0x3913fa[_0x2ddd('0x64')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x0]?_0x3913fa[_0x2ddd('0x5e')][0x0][_0x2ddd('0x5f')]:undefined)||_0x2ddd('0x65')},{'name':_0x2ddd('0x66'),'value':_0x3913fa['attrTimezone']||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x1]?_0x3913fa[_0x2ddd('0x5e')][0x1]['value']:undefined)||_0x2ddd('0x67')},{'name':_0x2ddd('0x68'),'value':_0x3913fa['attrFontSize']||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x2]?_0x3913fa[_0x2ddd('0x5e')][0x2][_0x2ddd('0x5f')]:undefined)||0xc}];case _0x2ddd('0x69'):return[{'name':_0x2ddd('0x6a'),'value':_0x3913fa[_0x2ddd('0x6a')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x0]?_0x3913fa['attrs'][0x0][_0x2ddd('0x5f')]:undefined)||_0x2ddd('0x6b')},{'name':_0x2ddd('0x6c'),'value':_0x3913fa['attrVoiceQueues']||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x1]?_0x3913fa[_0x2ddd('0x5e')][0x1][_0x2ddd('0x5f')]:undefined)||[]},{'name':_0x2ddd('0x68'),'value':_0x3913fa[_0x2ddd('0x68')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x2]?_0x3913fa[_0x2ddd('0x5e')][0x2][_0x2ddd('0x5f')]:undefined)||0x14},{'name':_0x2ddd('0x6d'),'value':_0x3913fa[_0x2ddd('0x6d')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x3]?_0x3913fa[_0x2ddd('0x5e')][0x3]['value']:undefined)||_0x2ddd('0x6e')},{'name':_0x2ddd('0x6f'),'value':_0x3913fa[_0x2ddd('0x6f')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x4]?_0x3913fa[_0x2ddd('0x5e')][0x4][_0x2ddd('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x3913fa[_0x2ddd('0x70')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x5]?_0x3913fa[_0x2ddd('0x5e')][0x5][_0x2ddd('0x5f')]:undefined)||''},{'name':_0x2ddd('0x71'),'value':_0x3913fa[_0x2ddd('0x71')]||(_0x3913fa['attrs']&&_0x3913fa[_0x2ddd('0x5e')][0x6]?_0x3913fa[_0x2ddd('0x5e')][0x6][_0x2ddd('0x5f')]:undefined)||''},{'name':_0x2ddd('0x72'),'value':_0x3913fa[_0x2ddd('0x72')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x7]?_0x3913fa[_0x2ddd('0x5e')][0x7][_0x2ddd('0x5f')]:undefined)||''},{'name':_0x2ddd('0x73'),'value':_0x3913fa['attrWhatsappAccounts']||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x8]?_0x3913fa[_0x2ddd('0x5e')][0x8]['value']:undefined)||''},{'name':_0x2ddd('0x74'),'value':_0x3913fa[_0x2ddd('0x74')]||(_0x3913fa['attrs']&&_0x3913fa['attrs'][0x9]?_0x3913fa[_0x2ddd('0x5e')][0x9]['value']:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x3913fa['attrSerie1']||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x0]?_0x3913fa[_0x2ddd('0x5e')][0x0][_0x2ddd('0x5f')]:undefined)||_0x2ddd('0x6b')},{'name':'attrSerie2','value':_0x3913fa[_0x2ddd('0x75')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa['attrs'][0x1]?_0x3913fa['attrs'][0x1][_0x2ddd('0x5f')]:undefined)||null},{'name':_0x2ddd('0x76'),'value':_0x3913fa[_0x2ddd('0x76')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x2]?_0x3913fa[_0x2ddd('0x5e')][0x2][_0x2ddd('0x5f')]:undefined)||null},{'name':_0x2ddd('0x6c'),'value':_0x3913fa[_0x2ddd('0x6c')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x3]?_0x3913fa[_0x2ddd('0x5e')][0x3]['value']:undefined)||[]},{'name':_0x2ddd('0x6d'),'value':_0x3913fa[_0x2ddd('0x6d')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x4]?_0x3913fa[_0x2ddd('0x5e')][0x4][_0x2ddd('0x5f')]:undefined)||_0x2ddd('0x6e')},{'name':_0x2ddd('0x6f'),'value':_0x3913fa[_0x2ddd('0x6f')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa['attrs'][0x5]?_0x3913fa[_0x2ddd('0x5e')][0x5][_0x2ddd('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x3913fa[_0x2ddd('0x70')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x6]?_0x3913fa[_0x2ddd('0x5e')][0x6][_0x2ddd('0x5f')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3913fa[_0x2ddd('0x71')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x7]?_0x3913fa[_0x2ddd('0x5e')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3913fa[_0x2ddd('0x72')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x8]?_0x3913fa[_0x2ddd('0x5e')][0x8][_0x2ddd('0x5f')]:undefined)||''},{'name':_0x2ddd('0x73'),'value':_0x3913fa[_0x2ddd('0x73')]||(_0x3913fa['attrs']&&_0x3913fa['attrs'][0x9]?_0x3913fa[_0x2ddd('0x5e')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x3913fa[_0x2ddd('0x74')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0xa]?_0x3913fa['attrs'][0xa][_0x2ddd('0x5f')]:undefined)||''}];case'web-report':return[{'name':_0x2ddd('0x77'),'type':_0x3913fa[_0x2ddd('0x78')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa[_0x2ddd('0x5e')][0x0]?_0x3913fa[_0x2ddd('0x5e')][0x0][_0x2ddd('0x35')]:undefined)||null,'value':_0x3913fa[_0x2ddd('0x77')]||(_0x3913fa['attrs']&&_0x3913fa[_0x2ddd('0x5e')][0x0]?_0x3913fa[_0x2ddd('0x5e')][0x0][_0x2ddd('0x5f')]:undefined)||null},{'name':'attrRefresh','value':_0x3913fa[_0x2ddd('0x79')]||(_0x3913fa[_0x2ddd('0x5e')]&&_0x3913fa['attrs'][0x1]?_0x3913fa[_0x2ddd('0x5e')][0x1][_0x2ddd('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x56af79){logger[_0x2ddd('0x2e')](_0x2ddd('0x7a'),JSON[_0x2ddd('0x7b')](_0x56af79));return[];}}exports[_0x2ddd('0x7c')]=function(_0x43bda3,_0x2031c3,_0xea1bc1){if(_0x43bda3[_0x2ddd('0x4f')]['id']){delete _0x43bda3[_0x2ddd('0x4f')]['id'];}return db[_0x2ddd('0x32')][_0x2ddd('0x4d')]({'where':{'id':_0x43bda3[_0x2ddd('0x4c')]['id']}})[_0x2ddd('0x2b')](handleEntityNotFound(_0x2031c3,null))[_0x2ddd('0x2b')](function(_0x1d5339){if(_0x1d5339){_0x43bda3['body']['DashboardId']=_0x1d5339['id'];_0x43bda3[_0x2ddd('0x4f')][_0x2ddd('0x5e')]=widgetAttributes(_0x43bda3['body']);return db[_0x2ddd('0x7d')][_0x2ddd('0x4e')](_0x43bda3[_0x2ddd('0x4f')]);}})[_0x2ddd('0x2b')](respondWithResult(_0x2031c3,null))['catch'](handleError(_0x2031c3,null));};exports['getItems']=function(_0x1d6dea,_0x8f8b20,_0x83eac3){var _0xca2212={};var _0x5884d9={};var _0x3e5e8c;var _0x3e497f;return db['Dashboard'][_0x2ddd('0x7e')]({'where':{'id':_0x1d6dea[_0x2ddd('0x4c')]['id']}})[_0x2ddd('0x2b')](handleEntityNotFound(_0x8f8b20,null))['then'](function(_0x5a3636){if(_0x5a3636){_0x3e5e8c=_0x5a3636;_0x5884d9[_0x2ddd('0x37')]=_[_0x2ddd('0x39')](db[_0x2ddd('0x7d')][_0x2ddd('0x33')]);_0x5884d9[_0x2ddd('0x38')]=_[_0x2ddd('0x39')](_0x1d6dea['query']);_0x5884d9[_0x2ddd('0x3a')]=_[_0x2ddd('0x3b')](_0x5884d9['model'],_0x5884d9['query']);_0xca2212[_0x2ddd('0x3c')]=_[_0x2ddd('0x3b')](_0x5884d9['model'],qs[_0x2ddd('0x3d')](_0x1d6dea[_0x2ddd('0x38')][_0x2ddd('0x3d')]));_0xca2212['attributes']=_0xca2212[_0x2ddd('0x3c')][_0x2ddd('0x3e')]?_0xca2212[_0x2ddd('0x3c')]:_0x5884d9[_0x2ddd('0x37')];_0xca2212[_0x2ddd('0x40')]=qs['sort'](_0x1d6dea[_0x2ddd('0x38')][_0x2ddd('0x41')]);_0xca2212[_0x2ddd('0x42')]=qs[_0x2ddd('0x3a')](_[_0x2ddd('0x43')](_0x1d6dea[_0x2ddd('0x38')],_0x5884d9['filters']));if(_0x1d6dea[_0x2ddd('0x38')]['filter']){_0xca2212['where']=_['merge'](_0xca2212[_0x2ddd('0x42')],{'$or':_[_0x2ddd('0x31')](_0xca2212[_0x2ddd('0x3c')],function(_0x379242){var _0x316a5b={};_0x316a5b[_0x379242]={'$like':'%'+_0x1d6dea['query']['filter']+'%'};return _0x316a5b;})});}_0xca2212=_[_0x2ddd('0x46')]({},_0xca2212,_0x1d6dea[_0x2ddd('0x47')]);return _0x3e5e8c[_0x2ddd('0x7f')](_0xca2212);}})[_0x2ddd('0x2b')](function(_0x540544){if(_0x540544){_0x3e497f=_0x540544[_0x2ddd('0x3e')];if(!_0x1d6dea['query']['hasOwnProperty'](_0x2ddd('0x80'))){_0xca2212['limit']=qs[_0x2ddd('0x25')](_0x1d6dea[_0x2ddd('0x38')][_0x2ddd('0x25')]);_0xca2212['offset']=qs[_0x2ddd('0x22')](_0x1d6dea[_0x2ddd('0x38')]['offset']);}return _0x3e5e8c[_0x2ddd('0x7f')](_0xca2212);}})['then'](function(_0x150ad7){if(_0x150ad7){return _0x150ad7?{'count':_0x3e497f,'rows':_0x150ad7}:null;}})[_0x2ddd('0x2b')](respondWithResult(_0x8f8b20,null))[_0x2ddd('0x4b')](handleError(_0x8f8b20,null));}; \ No newline at end of file +var _0x9ccb=['userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','findOne','DashboardItem','order','getItems','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','map','Dashboard','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','user','UserProfileSection','clone','updatedAt','body','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x36a7a3,_0x22e47e){var _0x481620=function(_0x546dbf){while(--_0x546dbf){_0x36a7a3['push'](_0x36a7a3['shift']());}};_0x481620(++_0x22e47e);}(_0x9ccb,0x127));var _0xb9cc=function(_0x13e758,_0x317d23){_0x13e758=_0x13e758-0x0;var _0x5b53c3=_0x9ccb[_0x13e758];return _0x5b53c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9cc('0x0'));var zipdir=require(_0xb9cc('0x1'));var jsonpatch=require(_0xb9cc('0x2'));var rp=require(_0xb9cc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb9cc('0x4'));var util=require(_0xb9cc('0x5'));var path=require(_0xb9cc('0x6'));var sox=require(_0xb9cc('0x7'));var csv=require(_0xb9cc('0x8'));var ejs=require(_0xb9cc('0x9'));var fs=require('fs');var fs_extra=require(_0xb9cc('0xa'));var _=require(_0xb9cc('0xb'));var squel=require(_0xb9cc('0xc'));var crypto=require('crypto');var jsforce=require(_0xb9cc('0xd'));var deskjs=require(_0xb9cc('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb9cc('0xf'));var Papa=require(_0xb9cc('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9cc('0x11'));var logger=require(_0xb9cc('0x12'))('api');var utils=require(_0xb9cc('0x13'));var config=require(_0xb9cc('0x14'));var licenseUtil=require(_0xb9cc('0x15'));var db=require(_0xb9cc('0x16'))['db'];config[_0xb9cc('0x17')]=_[_0xb9cc('0x18')](config['redis'],{'host':_0xb9cc('0x19'),'port':0x18eb});var socket=require(_0xb9cc('0x1a'))(new Redis(config[_0xb9cc('0x17')]));require('./dashboard.socket')[_0xb9cc('0x1b')](socket);function respondWithStatusCode(_0x1626a9,_0x1f4675){_0x1f4675=_0x1f4675||0xcc;return function(_0x35dba4){if(_0x35dba4){return _0x1626a9[_0xb9cc('0x1c')](_0x1f4675);}return _0x1626a9[_0xb9cc('0x1d')](_0x1f4675)[_0xb9cc('0x1e')]();};}function respondWithResult(_0x23df37,_0x50dbb0){_0x50dbb0=_0x50dbb0||0xc8;return function(_0x3a22f4){if(_0x3a22f4){return _0x23df37[_0xb9cc('0x1d')](_0x50dbb0)[_0xb9cc('0x1f')](_0x3a22f4);}};}function respondWithFilteredResult(_0x5dfcb6,_0x349a63){return function(_0x232963){if(_0x232963){var _0x3ebeef=typeof _0x349a63[_0xb9cc('0x20')]===_0xb9cc('0x21')&&typeof _0x349a63[_0xb9cc('0x22')]===_0xb9cc('0x21');var _0x1fbbf9=_0x232963[_0xb9cc('0x23')];var _0x16c0e5=_0x3ebeef?0x0:_0x349a63[_0xb9cc('0x20')];var _0x1e6c3c=_0x3ebeef?_0x232963['count']:_0x349a63[_0xb9cc('0x20')]+_0x349a63['limit'];var _0x269557;if(_0x1e6c3c>=_0x1fbbf9){_0x1e6c3c=_0x1fbbf9;_0x269557=0xc8;}else{_0x269557=0xce;}_0x5dfcb6['status'](_0x269557);return _0x5dfcb6['set'](_0xb9cc('0x24'),_0x16c0e5+'-'+_0x1e6c3c+'/'+_0x1fbbf9)[_0xb9cc('0x1f')](_0x232963);}return null;};}function patchUpdates(_0x1169e7){return function(_0x3c845d){try{jsonpatch[_0xb9cc('0x25')](_0x3c845d,_0x1169e7,!![]);}catch(_0x4780ff){return BPromise[_0xb9cc('0x26')](_0x4780ff);}return _0x3c845d[_0xb9cc('0x27')]();};}function saveUpdates(_0x1bf0d9,_0x1d53a5){return function(_0x26ed0f){if(_0x26ed0f){return _0x26ed0f['update'](_0x1bf0d9)[_0xb9cc('0x28')](function(_0x3663d5){return _0x3663d5;});}return null;};}function removeEntity(_0x5b096c,_0x57871e){return function(_0x42f58c){if(_0x42f58c){return _0x42f58c[_0xb9cc('0x29')]()[_0xb9cc('0x28')](function(){var _0x5bb626=_0x42f58c[_0xb9cc('0x2a')]({'plain':!![]});var _0x29bae2=_0xb9cc('0x2b');return db[_0xb9cc('0x2c')][_0xb9cc('0x29')]({'where':{'type':_0x29bae2,'resourceId':_0x5bb626['id']}})[_0xb9cc('0x28')](function(){return _0x42f58c;});})[_0xb9cc('0x28')](function(){_0x5b096c['status'](0xcc)[_0xb9cc('0x1e')]();});}};}function handleEntityNotFound(_0x18c33b,_0x24af50){return function(_0x2b125c){if(!_0x2b125c){_0x18c33b[_0xb9cc('0x1c')](0x194);}return _0x2b125c;};}function handleError(_0x4c14f3,_0x2fe6db){_0x2fe6db=_0x2fe6db||0x1f4;return function(_0x1f73e3){logger[_0xb9cc('0x2d')](_0x1f73e3[_0xb9cc('0x2e')]);if(_0x1f73e3[_0xb9cc('0x2f')]){delete _0x1f73e3[_0xb9cc('0x2f')];}_0x4c14f3[_0xb9cc('0x1d')](_0x2fe6db)['send'](_0x1f73e3);};}exports['index']=function(_0x23edaf,_0x4ef372){var _0x26cf3b={},_0x48f5f1={},_0x329fe2={'count':0x0,'rows':[]};var _0x2172bf=_[_0xb9cc('0x30')](db[_0xb9cc('0x31')][_0xb9cc('0x32')],function(_0x459ddd){return{'name':_0x459ddd[_0xb9cc('0x33')],'type':_0x459ddd[_0xb9cc('0x34')][_0xb9cc('0x35')]};});_0x48f5f1['model']=_['map'](_0x2172bf,_0xb9cc('0x2f'));_0x48f5f1[_0xb9cc('0x36')]=_[_0xb9cc('0x37')](_0x23edaf[_0xb9cc('0x36')]);_0x48f5f1[_0xb9cc('0x38')]=_[_0xb9cc('0x39')](_0x48f5f1[_0xb9cc('0x3a')],_0x48f5f1[_0xb9cc('0x36')]);_0x26cf3b[_0xb9cc('0x3b')]=_[_0xb9cc('0x39')](_0x48f5f1['model'],qs['fields'](_0x23edaf[_0xb9cc('0x36')][_0xb9cc('0x3c')]));_0x26cf3b['attributes']=_0x26cf3b[_0xb9cc('0x3b')][_0xb9cc('0x3d')]?_0x26cf3b[_0xb9cc('0x3b')]:_0x48f5f1[_0xb9cc('0x3a')];if(!_0x23edaf['query'][_0xb9cc('0x3e')](_0xb9cc('0x3f'))){_0x26cf3b['limit']=qs[_0xb9cc('0x22')](_0x23edaf[_0xb9cc('0x36')][_0xb9cc('0x22')]);_0x26cf3b['offset']=qs['offset'](_0x23edaf[_0xb9cc('0x36')][_0xb9cc('0x20')]);}_0x26cf3b['order']=qs[_0xb9cc('0x40')](_0x23edaf['query'][_0xb9cc('0x40')]);_0x26cf3b[_0xb9cc('0x41')]=qs[_0xb9cc('0x38')](_[_0xb9cc('0x42')](_0x23edaf[_0xb9cc('0x36')],_0x48f5f1[_0xb9cc('0x38')]),_0x2172bf);if(_0x23edaf[_0xb9cc('0x36')]['filter']){_0x26cf3b[_0xb9cc('0x41')]=_[_0xb9cc('0x43')](_0x26cf3b[_0xb9cc('0x41')],{'$or':_[_0xb9cc('0x30')](_0x2172bf,function(_0x51e33a){if(_0x51e33a[_0xb9cc('0x34')]!==_0xb9cc('0x44')){var _0x4979a2={};_0x4979a2[_0x51e33a[_0xb9cc('0x2f')]]={'$like':'%'+_0x23edaf[_0xb9cc('0x36')][_0xb9cc('0x45')]+'%'};return _0x4979a2;}})});}_0x26cf3b=_[_0xb9cc('0x43')]({},_0x26cf3b,_0x23edaf[_0xb9cc('0x46')]);var _0x2fb607={'where':_0x26cf3b[_0xb9cc('0x41')]};return db[_0xb9cc('0x31')][_0xb9cc('0x23')](_0x2fb607)['then'](function(_0x211ced){_0x329fe2[_0xb9cc('0x23')]=_0x211ced;if(_0x23edaf['query'][_0xb9cc('0x47')]){_0x26cf3b[_0xb9cc('0x48')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x26cf3b);})[_0xb9cc('0x28')](function(_0x3c7bf3){_0x329fe2[_0xb9cc('0x49')]=_0x3c7bf3;return _0x329fe2;})[_0xb9cc('0x28')](respondWithFilteredResult(_0x4ef372,_0x26cf3b))[_0xb9cc('0x4a')](handleError(_0x4ef372,null));};exports[_0xb9cc('0x4b')]=function(_0x3bfe03,_0x542d82){var _0x2fab86={'raw':![],'where':{'id':_0x3bfe03[_0xb9cc('0x4c')]['id']}},_0x2185ff={};_0x2185ff[_0xb9cc('0x3a')]=_[_0xb9cc('0x37')](db[_0xb9cc('0x31')]['rawAttributes']);_0x2185ff[_0xb9cc('0x36')]=_[_0xb9cc('0x37')](_0x3bfe03[_0xb9cc('0x36')]);_0x2185ff[_0xb9cc('0x38')]=_['intersection'](_0x2185ff['model'],_0x2185ff['query']);_0x2fab86[_0xb9cc('0x3b')]=_[_0xb9cc('0x39')](_0x2185ff[_0xb9cc('0x3a')],qs[_0xb9cc('0x3c')](_0x3bfe03[_0xb9cc('0x36')][_0xb9cc('0x3c')]));_0x2fab86[_0xb9cc('0x3b')]=_0x2fab86[_0xb9cc('0x3b')]['length']?_0x2fab86[_0xb9cc('0x3b')]:_0x2185ff['model'];if(_0x3bfe03[_0xb9cc('0x36')]['includeAll']){_0x2fab86['include']=[{'all':!![]}];}_0x2fab86=_['merge']({},_0x2fab86,_0x3bfe03['options']);return db[_0xb9cc('0x31')][_0xb9cc('0x4d')](_0x2fab86)[_0xb9cc('0x28')](handleEntityNotFound(_0x542d82,null))[_0xb9cc('0x28')](respondWithResult(_0x542d82,null))[_0xb9cc('0x4a')](handleError(_0x542d82,null));};exports['create']=function(_0x3df236,_0x3fc528){return db['Dashboard'][_0xb9cc('0x4e')](_0x3df236['body'],{})[_0xb9cc('0x28')](function(_0x54f0ea){var _0x1d06de=_0x3df236[_0xb9cc('0x4f')][_0xb9cc('0x2a')]({'plain':!![]});if(!_0x1d06de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d06de['role']===_0xb9cc('0x4f')){var _0x5c3801=_0x54f0ea[_0xb9cc('0x2a')]({'plain':!![]});var _0x26bd97=_0xb9cc('0x2b');return db[_0xb9cc('0x50')][_0xb9cc('0x4d')]({'where':{'name':_0x26bd97,'userProfileId':_0x1d06de['userProfileId']},'raw':!![]})[_0xb9cc('0x28')](function(_0x13be3c){if(_0x13be3c&&_0x13be3c['autoAssociation']===0x0){return db[_0xb9cc('0x2c')][_0xb9cc('0x4e')]({'name':_0x5c3801[_0xb9cc('0x2f')],'resourceId':_0x5c3801['id'],'type':_0x13be3c['name'],'sectionId':_0x13be3c['id']},{})[_0xb9cc('0x28')](function(){return _0x54f0ea;});}else{return _0x54f0ea;}})[_0xb9cc('0x4a')](function(_0x3309e5){logger[_0xb9cc('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3309e5);throw _0x3309e5;});}return _0x54f0ea;})['then'](respondWithResult(_0x3fc528,0xc9))['catch'](handleError(_0x3fc528,null));};exports[_0xb9cc('0x51')]=function(_0x42c57b,_0x2d228f){var _0x23b676={'where':{'id':_0x42c57b[_0xb9cc('0x4c')]['id']}},_0x2976f1={};_0x2976f1['model']=_[_0xb9cc('0x37')](db[_0xb9cc('0x31')][_0xb9cc('0x32')]);_0x23b676[_0xb9cc('0x3b')]=_[_0xb9cc('0x39')](_0x2976f1[_0xb9cc('0x3a')],qs['fields'](_0x42c57b[_0xb9cc('0x36')]['fields']));_0x23b676['attributes']=_0x23b676[_0xb9cc('0x3b')][_0xb9cc('0x3d')]?_0x23b676['attributes']:_0x2976f1[_0xb9cc('0x3a')];if(_0x42c57b[_0xb9cc('0x36')]['includeAll']){_0x23b676[_0xb9cc('0x48')]=[{'all':!![]}];}_0x23b676=_[_0xb9cc('0x43')]({},_0x23b676,_0x42c57b[_0xb9cc('0x46')]);return db[_0xb9cc('0x31')][_0xb9cc('0x4d')](_0x23b676)['then'](handleEntityNotFound(_0x2d228f,null))[_0xb9cc('0x28')](function(_0x3ef944){if(_0x3ef944){var _0x51155e=_0x3ef944[_0xb9cc('0x2a')]({'plain':!![]});_0x51155e=qs['omit'](_0x51155e,['id','createdAt',_0xb9cc('0x52')]);_0x42c57b[_0xb9cc('0x53')]=_['omit'](_0x42c57b['body'],['id',_0xb9cc('0x54'),_0xb9cc('0x52')]);return db[_0xb9cc('0x31')][_0xb9cc('0x4e')](_[_0xb9cc('0x43')](_0x51155e,_0x42c57b[_0xb9cc('0x53')]),{'include':_0x42c57b['query'][_0xb9cc('0x47')]?[{'all':!![]}]:undefined})[_0xb9cc('0x28')](function(_0x35b121){var _0x4901c1=_0x42c57b[_0xb9cc('0x4f')][_0xb9cc('0x2a')]({'plain':!![]});if(!_0x4901c1)throw new Error(_0xb9cc('0x55'));if(_0x4901c1['role']===_0xb9cc('0x4f')){var _0x21d5b6=_0x35b121[_0xb9cc('0x2a')]({'plain':!![]});var _0x1978df='CustomDashboards';return db[_0xb9cc('0x50')][_0xb9cc('0x4d')]({'where':{'name':_0x1978df,'userProfileId':_0x4901c1[_0xb9cc('0x56')]},'raw':!![]})[_0xb9cc('0x28')](function(_0x47b371){if(_0x47b371&&_0x47b371['autoAssociation']===0x0){return db[_0xb9cc('0x2c')]['create']({'name':_0x21d5b6['name'],'resourceId':_0x21d5b6['id'],'type':_0x47b371['name'],'sectionId':_0x47b371['id']},{})[_0xb9cc('0x28')](function(){return _0x35b121;});}else{return _0x35b121;}})[_0xb9cc('0x4a')](function(_0x227368){logger[_0xb9cc('0x2d')](_0xb9cc('0x57'),_0x227368);throw _0x227368;});}return _0x35b121;});}})['then'](respondWithResult(_0x2d228f,0xc9))['catch'](handleError(_0x2d228f,null));};exports[_0xb9cc('0x58')]=function(_0x2344ee,_0x5eaab5){if(_0x2344ee['body']['id']){delete _0x2344ee[_0xb9cc('0x53')]['id'];}return db[_0xb9cc('0x31')]['find']({'where':{'id':_0x2344ee['params']['id']}})['then'](handleEntityNotFound(_0x5eaab5,null))[_0xb9cc('0x28')](saveUpdates(_0x2344ee[_0xb9cc('0x53')],null))['then'](respondWithResult(_0x5eaab5,null))[_0xb9cc('0x4a')](handleError(_0x5eaab5,null));};exports[_0xb9cc('0x29')]=function(_0x49330b,_0x13f3da){return db[_0xb9cc('0x31')][_0xb9cc('0x4d')]({'where':{'id':_0x49330b[_0xb9cc('0x4c')]['id']}})[_0xb9cc('0x28')](handleEntityNotFound(_0x13f3da,null))[_0xb9cc('0x28')](removeEntity(_0x13f3da,null))[_0xb9cc('0x4a')](handleError(_0x13f3da,null));};function widgetAttributes(_0x4e3979){try{switch(_0x4e3979[_0xb9cc('0x34')]){case _0xb9cc('0x59'):return[{'name':_0xb9cc('0x5a'),'value':_0x4e3979[_0xb9cc('0x5a')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979['attrs'][0x0]?_0x4e3979[_0xb9cc('0x5b')][0x0][_0xb9cc('0x5c')]:undefined)||'https://'}];case'custom':return[{'name':_0xb9cc('0x5d'),'value':_0x4e3979[_0xb9cc('0x5d')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x0]?_0x4e3979['attrs'][0x0][_0xb9cc('0x5c')]:undefined)||''}];case _0xb9cc('0x5e'):return[{'name':_0xb9cc('0x5f'),'value':_0x4e3979[_0xb9cc('0x5f')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x0]?_0x4e3979['attrs'][0x0][_0xb9cc('0x5c')]:undefined)||_0xb9cc('0x60')},{'name':_0xb9cc('0x61'),'value':_0x4e3979[_0xb9cc('0x61')]||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x1]?_0x4e3979[_0xb9cc('0x5b')][0x1][_0xb9cc('0x5c')]:undefined)||_0xb9cc('0x62')},{'name':_0xb9cc('0x63'),'value':_0x4e3979[_0xb9cc('0x63')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x2]?_0x4e3979[_0xb9cc('0x5b')][0x2][_0xb9cc('0x5c')]:undefined)||0xc}];case'counter':return[{'name':_0xb9cc('0x64'),'value':_0x4e3979[_0xb9cc('0x64')]||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x0]?_0x4e3979[_0xb9cc('0x5b')][0x0]['value']:undefined)||_0xb9cc('0x65')},{'name':_0xb9cc('0x66'),'value':_0x4e3979[_0xb9cc('0x66')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x1]?_0x4e3979[_0xb9cc('0x5b')][0x1][_0xb9cc('0x5c')]:undefined)||[]},{'name':_0xb9cc('0x63'),'value':_0x4e3979['attrFontSize']||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x2]?_0x4e3979[_0xb9cc('0x5b')][0x2]['value']:undefined)||0x14},{'name':_0xb9cc('0x67'),'value':_0x4e3979[_0xb9cc('0x67')]||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x3]?_0x4e3979[_0xb9cc('0x5b')][0x3][_0xb9cc('0x5c')]:undefined)||_0xb9cc('0x68')},{'name':'attrEmailAccounts','value':_0x4e3979[_0xb9cc('0x69')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x4]?_0x4e3979[_0xb9cc('0x5b')][0x4][_0xb9cc('0x5c')]:undefined)||''},{'name':_0xb9cc('0x6a'),'value':_0x4e3979[_0xb9cc('0x6a')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979['attrs'][0x5]?_0x4e3979[_0xb9cc('0x5b')][0x5][_0xb9cc('0x5c')]:undefined)||''},{'name':_0xb9cc('0x6b'),'value':_0x4e3979[_0xb9cc('0x6b')]||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x6]?_0x4e3979[_0xb9cc('0x5b')][0x6][_0xb9cc('0x5c')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4e3979[_0xb9cc('0x6c')]||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x7]?_0x4e3979[_0xb9cc('0x5b')][0x7][_0xb9cc('0x5c')]:undefined)||''},{'name':_0xb9cc('0x6d'),'value':_0x4e3979['attrWhatsappAccounts']||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x8]?_0x4e3979['attrs'][0x8]['value']:undefined)||''},{'name':_0xb9cc('0x6e'),'value':_0x4e3979[_0xb9cc('0x6e')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x9]?_0x4e3979[_0xb9cc('0x5b')][0x9]['value']:undefined)||''}];case _0xb9cc('0x6f'):case _0xb9cc('0x70'):return[{'name':_0xb9cc('0x71'),'value':_0x4e3979['attrSerie1']||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x0]?_0x4e3979[_0xb9cc('0x5b')][0x0][_0xb9cc('0x5c')]:undefined)||_0xb9cc('0x65')},{'name':_0xb9cc('0x72'),'value':_0x4e3979['attrSerie2']||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x1]?_0x4e3979[_0xb9cc('0x5b')][0x1][_0xb9cc('0x5c')]:undefined)||null},{'name':_0xb9cc('0x73'),'value':_0x4e3979[_0xb9cc('0x73')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x2]?_0x4e3979[_0xb9cc('0x5b')][0x2][_0xb9cc('0x5c')]:undefined)||null},{'name':_0xb9cc('0x66'),'value':_0x4e3979[_0xb9cc('0x66')]||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x3]?_0x4e3979[_0xb9cc('0x5b')][0x3][_0xb9cc('0x5c')]:undefined)||[]},{'name':_0xb9cc('0x67'),'value':_0x4e3979['attrChannel']||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x4]?_0x4e3979[_0xb9cc('0x5b')][0x4][_0xb9cc('0x5c')]:undefined)||_0xb9cc('0x68')},{'name':'attrEmailAccounts','value':_0x4e3979[_0xb9cc('0x69')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979['attrs'][0x5]?_0x4e3979[_0xb9cc('0x5b')][0x5][_0xb9cc('0x5c')]:undefined)||''},{'name':_0xb9cc('0x6a'),'value':_0x4e3979[_0xb9cc('0x6a')]||(_0x4e3979['attrs']&&_0x4e3979['attrs'][0x6]?_0x4e3979['attrs'][0x6][_0xb9cc('0x5c')]:undefined)||''},{'name':_0xb9cc('0x6b'),'value':_0x4e3979[_0xb9cc('0x6b')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x7]?_0x4e3979[_0xb9cc('0x5b')][0x7][_0xb9cc('0x5c')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4e3979[_0xb9cc('0x6c')]||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x8]?_0x4e3979[_0xb9cc('0x5b')][0x8][_0xb9cc('0x5c')]:undefined)||''},{'name':_0xb9cc('0x6d'),'value':_0x4e3979[_0xb9cc('0x6d')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x9]?_0x4e3979[_0xb9cc('0x5b')][0x9][_0xb9cc('0x5c')]:undefined)||''},{'name':_0xb9cc('0x6e'),'value':_0x4e3979[_0xb9cc('0x6e')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0xa]?_0x4e3979['attrs'][0xa]['value']:undefined)||''}];case _0xb9cc('0x74'):return[{'name':_0xb9cc('0x75'),'type':_0x4e3979[_0xb9cc('0x76')]||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x0]?_0x4e3979[_0xb9cc('0x5b')][0x0][_0xb9cc('0x34')]:undefined)||null,'value':_0x4e3979[_0xb9cc('0x75')]||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x0]?_0x4e3979[_0xb9cc('0x5b')][0x0][_0xb9cc('0x5c')]:undefined)||null},{'name':_0xb9cc('0x77'),'value':_0x4e3979[_0xb9cc('0x77')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979['attrs'][0x1]?_0x4e3979[_0xb9cc('0x5b')][0x1][_0xb9cc('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x3a61a5){logger[_0xb9cc('0x2d')](_0xb9cc('0x78'),JSON[_0xb9cc('0x79')](_0x3a61a5));return[];}}exports[_0xb9cc('0x7a')]=function(_0xe8139f,_0x273cf6,_0x1b9a70){if(_0xe8139f['body']['id']){delete _0xe8139f[_0xb9cc('0x53')]['id'];}return db['Dashboard'][_0xb9cc('0x4d')]({'where':{'id':_0xe8139f[_0xb9cc('0x4c')]['id']}})[_0xb9cc('0x28')](handleEntityNotFound(_0x273cf6,null))[_0xb9cc('0x28')](function(_0x14252f){if(_0x14252f){_0xe8139f['body']['DashboardId']=_0x14252f['id'];_0xe8139f['body'][_0xb9cc('0x5b')]=widgetAttributes(_0xe8139f[_0xb9cc('0x53')]);return db['DashboardItem'][_0xb9cc('0x4e')](_0xe8139f[_0xb9cc('0x53')]);}})[_0xb9cc('0x28')](respondWithResult(_0x273cf6,null))['catch'](handleError(_0x273cf6,null));};exports['getItems']=function(_0x4710f5,_0x2b2fb9,_0x24b70f){var _0x20a2bc={};var _0x378ac4={};var _0x106f26;var _0x3b8cd6;return db[_0xb9cc('0x31')][_0xb9cc('0x7b')]({'where':{'id':_0x4710f5[_0xb9cc('0x4c')]['id']}})[_0xb9cc('0x28')](handleEntityNotFound(_0x2b2fb9,null))[_0xb9cc('0x28')](function(_0x281d62){if(_0x281d62){_0x106f26=_0x281d62;_0x378ac4[_0xb9cc('0x3a')]=_[_0xb9cc('0x37')](db[_0xb9cc('0x7c')][_0xb9cc('0x32')]);_0x378ac4['query']=_[_0xb9cc('0x37')](_0x4710f5['query']);_0x378ac4[_0xb9cc('0x38')]=_['intersection'](_0x378ac4[_0xb9cc('0x3a')],_0x378ac4[_0xb9cc('0x36')]);_0x20a2bc['attributes']=_[_0xb9cc('0x39')](_0x378ac4['model'],qs[_0xb9cc('0x3c')](_0x4710f5['query'][_0xb9cc('0x3c')]));_0x20a2bc[_0xb9cc('0x3b')]=_0x20a2bc[_0xb9cc('0x3b')][_0xb9cc('0x3d')]?_0x20a2bc[_0xb9cc('0x3b')]:_0x378ac4[_0xb9cc('0x3a')];_0x20a2bc[_0xb9cc('0x7d')]=qs[_0xb9cc('0x40')](_0x4710f5[_0xb9cc('0x36')][_0xb9cc('0x40')]);_0x20a2bc[_0xb9cc('0x41')]=qs[_0xb9cc('0x38')](_['pick'](_0x4710f5[_0xb9cc('0x36')],_0x378ac4[_0xb9cc('0x38')]));if(_0x4710f5[_0xb9cc('0x36')][_0xb9cc('0x45')]){_0x20a2bc[_0xb9cc('0x41')]=_[_0xb9cc('0x43')](_0x20a2bc[_0xb9cc('0x41')],{'$or':_[_0xb9cc('0x30')](_0x20a2bc[_0xb9cc('0x3b')],function(_0x248f14){var _0x18e466={};_0x18e466[_0x248f14]={'$like':'%'+_0x4710f5[_0xb9cc('0x36')][_0xb9cc('0x45')]+'%'};return _0x18e466;})});}_0x20a2bc=_[_0xb9cc('0x43')]({},_0x20a2bc,_0x4710f5['options']);return _0x106f26[_0xb9cc('0x7e')](_0x20a2bc);}})[_0xb9cc('0x28')](function(_0x1d2cda){if(_0x1d2cda){_0x3b8cd6=_0x1d2cda[_0xb9cc('0x3d')];if(!_0x4710f5[_0xb9cc('0x36')]['hasOwnProperty'](_0xb9cc('0x3f'))){_0x20a2bc['limit']=qs[_0xb9cc('0x22')](_0x4710f5['query']['limit']);_0x20a2bc[_0xb9cc('0x20')]=qs['offset'](_0x4710f5[_0xb9cc('0x36')][_0xb9cc('0x20')]);}return _0x106f26[_0xb9cc('0x7e')](_0x20a2bc);}})[_0xb9cc('0x28')](function(_0x2edd21){if(_0x2edd21){return _0x2edd21?{'count':_0x3b8cd6,'rows':_0x2edd21}:null;}})['then'](respondWithResult(_0x2b2fb9,null))['catch'](handleError(_0x2b2fb9,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 52c2f9c..ad82fcf 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 _0x3788=['../../mysqldb','Dashboard','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x335271,_0x5025f2){var _0xa9fff8=function(_0x28d0bd){while(--_0x28d0bd){_0x335271['push'](_0x335271['shift']());}};_0xa9fff8(++_0x5025f2);}(_0x3788,0x1a6));var _0x8378=function(_0x49ed89,_0x199179){_0x49ed89=_0x49ed89-0x0;var _0x7b4291=_0x3788[_0x49ed89];return _0x7b4291;};'use strict';var EventEmitter=require(_0x8378('0x0'));var Dashboard=require(_0x8378('0x1'))['db'][_0x8378('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8378('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8378('0x4')};function emitEvent(_0x53c195){return function(_0xf44f67,_0x1c2f51,_0x24fc98){DashboardEvents[_0x8378('0x5')](_0x53c195+':'+_0xf44f67['id'],_0xf44f67);DashboardEvents['emit'](_0x53c195,_0xf44f67);_0x24fc98(null);};}for(var e in events){if(events[_0x8378('0x6')](e)){var event=events[e];Dashboard[_0x8378('0x7')](e,emitEvent(event));}}module[_0x8378('0x8')]=DashboardEvents; \ No newline at end of file +var _0x01cc=['remove','emit','exports','events','../../mysqldb','Dashboard','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01cc,0xbb));var _0xc01c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x01cc[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0xc01c('0x0'));var Dashboard=require(_0xc01c('0x1'))['db'][_0xc01c('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xc01c('0x3')](0x0);var events={'afterCreate':_0xc01c('0x4'),'afterUpdate':'update','afterDestroy':_0xc01c('0x5')};function emitEvent(_0x19b757){return function(_0x5be2d1,_0x7cb9b8,_0x310b68){DashboardEvents[_0xc01c('0x6')](_0x19b757+':'+_0x5be2d1['id'],_0x5be2d1);DashboardEvents['emit'](_0x19b757,_0x5be2d1);_0x310b68(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xc01c('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 519e6bd..baca086 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 _0xc00c=['dashboards','../../config/logger','api','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x2bc7d8,_0x2fbce6){var _0x37a718=function(_0x4a68da){while(--_0x4a68da){_0x2bc7d8['push'](_0x2bc7d8['shift']());}};_0x37a718(++_0x2fbce6);}(_0xc00c,0x97));var _0xcc00=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xc00c[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcc00('0x0'))(_0xcc00('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc00('0x2'));var rimraf=require(_0xcc00('0x3'));var config=require(_0xcc00('0x4'));var attributes=require(_0xcc00('0x5'));module[_0xcc00('0x6')]=function(_0x13df32,_0x482f73){return _0x13df32[_0xcc00('0x7')](_0xcc00('0x8'),attributes,{'tableName':_0xcc00('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81b8=['define','Dashboard','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','exports'];(function(_0x504c5d,_0x27a75a){var _0x4d1821=function(_0x558ffe){while(--_0x558ffe){_0x504c5d['push'](_0x504c5d['shift']());}};_0x4d1821(++_0x27a75a);}(_0x81b8,0x1ce));var _0x881b=function(_0x385030,_0x37a17d){_0x385030=_0x385030-0x0;var _0x2607af=_0x81b8[_0x385030];return _0x2607af;};'use strict';var _=require(_0x881b('0x0'));var util=require(_0x881b('0x1'));var logger=require(_0x881b('0x2'))(_0x881b('0x3'));var moment=require(_0x881b('0x4'));var BPromise=require(_0x881b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x881b('0x6'));var attributes=require('./dashboard.attributes');module[_0x881b('0x7')]=function(_0x203c33,_0xfc215d){return _0x203c33[_0x881b('0x8')](_0x881b('0x9'),attributes,{'tableName':'dashboards','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 5bd9715..ddef436 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 _0x2a3f=['message','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xfd4ffb,_0x3a3bf6){var _0x57e729=function(_0x5bb756){while(--_0x5bb756){_0xfd4ffb['push'](_0xfd4ffb['shift']());}};_0x57e729(++_0x3a3bf6);}(_0x2a3f,0x10a));var _0xf2a3=function(_0x3ae2b2,_0x2d936f){_0x3ae2b2=_0x3ae2b2-0x0;var _0x1dbf00=_0x2a3f[_0x3ae2b2];return _0x1dbf00;};'use strict';var _=require('lodash');var util=require(_0xf2a3('0x0'));var moment=require(_0xf2a3('0x1'));var BPromise=require(_0xf2a3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf2a3('0x3'))['db'];var utils=require(_0xf2a3('0x4'));var logger=require('../../config/logger')(_0xf2a3('0x5'));var config=require(_0xf2a3('0x6'));var jayson=require(_0xf2a3('0x7'));var client=jayson[_0xf2a3('0x8')][_0xf2a3('0x9')]({'port':0x232a});config[_0xf2a3('0xa')]=_['defaults'](config[_0xf2a3('0xa')],{'host':_0xf2a3('0xb'),'port':0x18eb});var socket=require(_0xf2a3('0xc'))(new Redis(config[_0xf2a3('0xa')]));require(_0xf2a3('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e5687,_0x5c0522,_0x52e279){return new BPromise(function(_0x3c4633,_0x3e8b9b){return client[_0xf2a3('0xe')](_0x2e5687,_0x52e279)[_0xf2a3('0xf')](function(_0x17039e){logger[_0xf2a3('0x10')](_0xf2a3('0x11'),_0x5c0522,'request\x20sent');logger['debug'](_0xf2a3('0x12'),_0x5c0522,_0xf2a3('0x13'),JSON[_0xf2a3('0x14')](_0x17039e));if(_0x17039e[_0xf2a3('0x15')]){if(_0x17039e[_0xf2a3('0x15')]['code']===0x1f4){logger['error'](_0xf2a3('0x11'),_0x5c0522,_0x17039e[_0xf2a3('0x15')][_0xf2a3('0x16')]);return _0x3e8b9b(_0x17039e['error'][_0xf2a3('0x16')]);}logger[_0xf2a3('0x15')](_0xf2a3('0x11'),_0x5c0522,_0x17039e[_0xf2a3('0x15')]['message']);return _0x3c4633(_0x17039e[_0xf2a3('0x15')][_0xf2a3('0x16')]);}else{logger[_0xf2a3('0x10')](_0xf2a3('0x11'),_0x5c0522,_0xf2a3('0x13'));_0x3c4633(_0x17039e['result']['message']);}})[_0xf2a3('0x17')](function(_0x349c47){logger[_0xf2a3('0x15')](_0xf2a3('0x11'),_0x5c0522,_0x349c47);_0x3e8b9b(_0x349c47);});});} \ No newline at end of file +var _0xd245=['./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xd245,0x14d));var _0x5d24=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0xd245[_0x100682];return _0xcb6e87;};'use strict';var _=require('lodash');var util=require(_0x5d24('0x0'));var moment=require(_0x5d24('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d24('0x2'));var fs=require('fs');var Redis=require(_0x5d24('0x3'));var db=require(_0x5d24('0x4'))['db'];var utils=require(_0x5d24('0x5'));var logger=require(_0x5d24('0x6'))(_0x5d24('0x7'));var config=require('../../config/environment');var jayson=require(_0x5d24('0x8'));var client=jayson[_0x5d24('0x9')][_0x5d24('0xa')]({'port':0x232a});config[_0x5d24('0xb')]=_[_0x5d24('0xc')](config[_0x5d24('0xb')],{'host':_0x5d24('0xd'),'port':0x18eb});var socket=require(_0x5d24('0xe'))(new Redis(config['redis']));require(_0x5d24('0xf'))['register'](socket);function respondWithRpcPromise(_0x613959,_0xdf32b7,_0x228bd5){return new BPromise(function(_0x5aaf3f,_0x33f17b){return client[_0x5d24('0x10')](_0x613959,_0x228bd5)[_0x5d24('0x11')](function(_0x3788ad){logger[_0x5d24('0x12')](_0x5d24('0x13'),_0xdf32b7,_0x5d24('0x14'));logger[_0x5d24('0x15')](_0x5d24('0x16'),_0xdf32b7,_0x5d24('0x14'),JSON[_0x5d24('0x17')](_0x3788ad));if(_0x3788ad['error']){if(_0x3788ad[_0x5d24('0x18')][_0x5d24('0x19')]===0x1f4){logger[_0x5d24('0x18')](_0x5d24('0x13'),_0xdf32b7,_0x3788ad['error'][_0x5d24('0x1a')]);return _0x33f17b(_0x3788ad[_0x5d24('0x18')][_0x5d24('0x1a')]);}logger['error'](_0x5d24('0x13'),_0xdf32b7,_0x3788ad[_0x5d24('0x18')][_0x5d24('0x1a')]);return _0x5aaf3f(_0x3788ad[_0x5d24('0x18')][_0x5d24('0x1a')]);}else{logger['info'](_0x5d24('0x13'),_0xdf32b7,_0x5d24('0x14'));_0x5aaf3f(_0x3788ad[_0x5d24('0x1b')]['message']);}})[_0x5d24('0x1c')](function(_0x1f2f2f){logger[_0x5d24('0x18')](_0x5d24('0x13'),_0xdf32b7,_0x1f2f2f);_0x33f17b(_0x1f2f2f);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 4e3257d..a6d9a94 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 _0x3e59=['save','remove','emit','register','length','dashboard:','./dashboard.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e59,0x6f));var _0x93e5=function(_0x3b5f66,_0x1dbfc5){_0x3b5f66=_0x3b5f66-0x0;var _0x4aa1a8=_0x3e59[_0x3b5f66];return _0x4aa1a8;};'use strict';var DashboardEvents=require(_0x93e5('0x0'));var events=[_0x93e5('0x1'),_0x93e5('0x2'),'update'];function createListener(_0x43ce46,_0x5a76a6){return function(_0x31f0c6){_0x5a76a6[_0x93e5('0x3')](_0x43ce46,_0x31f0c6);};}function removeListener(_0x220580,_0x45095d){return function(){DashboardEvents['removeListener'](_0x220580,_0x45095d);};}exports[_0x93e5('0x4')]=function(_0x334b17){for(var _0x4de58d=0x0,_0x598f72=events[_0x93e5('0x5')];_0x4de58d<_0x598f72;_0x4de58d++){var _0x248326=events[_0x4de58d];var _0x4de85e=createListener(_0x93e5('0x6')+_0x248326,_0x334b17);DashboardEvents['on'](_0x248326,_0x4de85e);}}; \ No newline at end of file +var _0x11dc=['./dashboard.events','save','remove','update','emit','removeListener','dashboard:'];(function(_0x289333,_0x31cb26){var _0x3237d3=function(_0x13f6c8){while(--_0x13f6c8){_0x289333['push'](_0x289333['shift']());}};_0x3237d3(++_0x31cb26);}(_0x11dc,0x1c7));var _0xc11d=function(_0x144556,_0x5ca316){_0x144556=_0x144556-0x0;var _0x1bb692=_0x11dc[_0x144556];return _0x1bb692;};'use strict';var DashboardEvents=require(_0xc11d('0x0'));var events=[_0xc11d('0x1'),_0xc11d('0x2'),_0xc11d('0x3')];function createListener(_0x39af17,_0x45863e){return function(_0x5863ce){_0x45863e[_0xc11d('0x4')](_0x39af17,_0x5863ce);};}function removeListener(_0x5b4660,_0x2f109b){return function(){DashboardEvents[_0xc11d('0x5')](_0x5b4660,_0x2f109b);};}exports['register']=function(_0x9860a0){for(var _0x258e1f=0x0,_0x5e7264=events['length'];_0x258e1f<_0x5e7264;_0x258e1f++){var _0x325dbf=events[_0x258e1f];var _0x24c99b=createListener(_0xc11d('0x6')+_0x325dbf,_0x9860a0);DashboardEvents['on'](_0x325dbf,_0x24c99b);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5aa1bae..37d7875 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 _0x7a09=['/:id','isAuthenticated','show','/:id/items','getItems','post','create','/:id/clone','addItem','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index'];(function(_0x1498dd,_0x3155dd){var _0x46b1a7=function(_0x2bfa78){while(--_0x2bfa78){_0x1498dd['push'](_0x1498dd['shift']());}};_0x46b1a7(++_0x3155dd);}(_0x7a09,0x141));var _0x97a0=function(_0xe09d0,_0x1e55d0){_0xe09d0=_0xe09d0-0x0;var _0x44ad05=_0x7a09[_0xe09d0];return _0x44ad05;};'use strict';var multer=require(_0x97a0('0x0'));var util=require('util');var path=require(_0x97a0('0x1'));var timeout=require(_0x97a0('0x2'));var express=require(_0x97a0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x97a0('0x4'));var config=require(_0x97a0('0x5'));var controller=require(_0x97a0('0x6'));router[_0x97a0('0x7')]('/',auth['isAuthenticated'](),controller[_0x97a0('0x8')]);router['get'](_0x97a0('0x9'),auth[_0x97a0('0xa')](),controller[_0x97a0('0xb')]);router[_0x97a0('0x7')](_0x97a0('0xc'),auth[_0x97a0('0xa')](),controller[_0x97a0('0xd')]);router[_0x97a0('0xe')]('/',auth['isAuthenticated'](),controller[_0x97a0('0xf')]);router[_0x97a0('0xe')](_0x97a0('0x10'),auth['isAuthenticated'](),controller['clone']);router[_0x97a0('0xe')](_0x97a0('0xc'),auth['isAuthenticated'](),controller[_0x97a0('0x11')]);router['put'](_0x97a0('0x9'),auth[_0x97a0('0xa')](),controller[_0x97a0('0x12')]);router[_0x97a0('0x13')](_0x97a0('0x9'),auth[_0x97a0('0xa')](),controller[_0x97a0('0x14')]);module[_0x97a0('0x15')]=router; \ No newline at end of file +var _0x8e16=['put','update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','post','create','/:id/clone','clone','addItem'];(function(_0x57f2cd,_0x3d117a){var _0xc1a150=function(_0x851f3d){while(--_0x851f3d){_0x57f2cd['push'](_0x57f2cd['shift']());}};_0xc1a150(++_0x3d117a);}(_0x8e16,0xa6));var _0x68e1=function(_0x2400b9,_0x104482){_0x2400b9=_0x2400b9-0x0;var _0x1c1800=_0x8e16[_0x2400b9];return _0x1c1800;};'use strict';var multer=require('multer');var util=require(_0x68e1('0x0'));var path=require(_0x68e1('0x1'));var timeout=require('connect-timeout');var express=require(_0x68e1('0x2'));var router=express['Router']();var fs_extra=require(_0x68e1('0x3'));var auth=require(_0x68e1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x68e1('0x5'));var controller=require(_0x68e1('0x6'));router[_0x68e1('0x7')]('/',auth[_0x68e1('0x8')](),controller[_0x68e1('0x9')]);router[_0x68e1('0x7')](_0x68e1('0xa'),auth[_0x68e1('0x8')](),controller[_0x68e1('0xb')]);router[_0x68e1('0x7')](_0x68e1('0xc'),auth[_0x68e1('0x8')](),controller['getItems']);router[_0x68e1('0xd')]('/',auth[_0x68e1('0x8')](),controller[_0x68e1('0xe')]);router[_0x68e1('0xd')](_0x68e1('0xf'),auth[_0x68e1('0x8')](),controller[_0x68e1('0x10')]);router[_0x68e1('0xd')](_0x68e1('0xc'),auth[_0x68e1('0x8')](),controller[_0x68e1('0x11')]);router[_0x68e1('0x12')](_0x68e1('0xa'),auth[_0x68e1('0x8')](),controller[_0x68e1('0x13')]);router[_0x68e1('0x14')]('/:id',auth[_0x68e1('0x8')](),controller[_0x68e1('0x15')]);module[_0x68e1('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 8dd4a3b..3975f8e 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 _0xb4c7=['TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x2ce073,_0x11a712){_0x2ce073=_0x2ce073-0x0;var _0x364337=_0xb4c7[_0x2ce073];return _0x364337;};'use strict';var Sequelize=require(_0x7b4c('0x0'));var squel=require(_0x7b4c('0x1'));var _=require(_0x7b4c('0x2'));module[_0x7b4c('0x3')]={'title':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7b4c('0x5')](_0x7b4c('0x6')),'get':function(){try{return JSON[_0x7b4c('0x7')](this[_0x7b4c('0x8')](_0x7b4c('0x9')));}catch(_0x5adec9){return[];}},'set':function(_0x1b0f57){try{this[_0x7b4c('0xa')](_0x7b4c('0x9'),JSON['stringify'](_0x1b0f57));}catch(_0x2d7b7e){this[_0x7b4c('0xa')]('attrs',JSON[_0x7b4c('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x7b4c('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7b4c('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7b4c('0xc')]},'col':{'type':Sequelize[_0x7b4c('0xc')]},'background':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![],'defaultValue':_0x7b4c('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![],'defaultValue':_0x7b4c('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7b4c('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x5fc3=['squel','exports','STRING','TEXT','long','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x5fc3,0xa8));var _0x35fc=function(_0x11f0e3,_0x5170bc){_0x11f0e3=_0x11f0e3-0x0;var _0x2892e8=_0x5fc3[_0x11f0e3];return _0x2892e8;};'use strict';var Sequelize=require(_0x35fc('0x0'));var squel=require(_0x35fc('0x1'));var _=require('lodash');module[_0x35fc('0x2')]={'title':{'type':Sequelize[_0x35fc('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x35fc('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x35fc('0x4')](_0x35fc('0x5')),'get':function(){try{return JSON['parse'](this[_0x35fc('0x6')](_0x35fc('0x7')));}catch(_0x186a06){return[];}},'set':function(_0x5b85ad){try{this['setDataValue'](_0x35fc('0x7'),JSON['stringify'](_0x5b85ad));}catch(_0x16e153){this[_0x35fc('0x8')](_0x35fc('0x7'),JSON[_0x35fc('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x35fc('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x35fc('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x35fc('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x35fc('0x3')],'allowNull':![],'defaultValue':_0x35fc('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x35fc('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x35fc('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'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 9909c7e..b5ef569 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 _0xdbcd=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','end','undefined','count','offset','status','Content-Range','json','reject','save','destroy','then','sendStatus','stack','name','show','params','model','keys','DashboardItem','rawAttributes','filters','intersection','query','attributes','fields','includeAll','merge','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','attrChatWebsites','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','find','eml-format','rimraf','request-promise','moment','bluebird','util','path','fs-extra','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdbcd,0x1ba));var _0xddbc=function(_0x367bfc,_0x278556){_0x367bfc=_0x367bfc-0x0;var _0x50f6d3=_0xdbcd[_0x367bfc];return _0x50f6d3;};'use strict';var emlformat=require(_0xddbc('0x0'));var rimraf=require(_0xddbc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xddbc('0x2'));var moment=require(_0xddbc('0x3'));var BPromise=require(_0xddbc('0x4'));var Mustache=require('mustache');var util=require(_0xddbc('0x5'));var path=require(_0xddbc('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xddbc('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xddbc('0x8'));var toCsv=require(_0xddbc('0x9'));var querystring=require(_0xddbc('0xa'));var Papa=require(_0xddbc('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xddbc('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xddbc('0xd'));var logger=require('../../config/logger')(_0xddbc('0xe'));var utils=require(_0xddbc('0xf'));var config=require(_0xddbc('0x10'));var licenseUtil=require(_0xddbc('0x11'));var db=require(_0xddbc('0x12'))['db'];config[_0xddbc('0x13')]=_[_0xddbc('0x14')](config[_0xddbc('0x13')],{'host':_0xddbc('0x15'),'port':0x18eb});var socket=require(_0xddbc('0x16'))(new Redis(config[_0xddbc('0x13')]));require(_0xddbc('0x17'))['register'](socket);function respondWithStatusCode(_0x57c81f,_0x45d556){_0x45d556=_0x45d556||0xcc;return function(_0x4453bf){if(_0x4453bf){return _0x57c81f['sendStatus'](_0x45d556);}return _0x57c81f['status'](_0x45d556)[_0xddbc('0x18')]();};}function respondWithResult(_0x2d4a9b,_0x2d366d){_0x2d366d=_0x2d366d||0xc8;return function(_0x19f977){if(_0x19f977){return _0x2d4a9b['status'](_0x2d366d)['json'](_0x19f977);}};}function respondWithFilteredResult(_0x356afe,_0x193c84){return function(_0x5d0a34){if(_0x5d0a34){var _0x48efdb=typeof _0x193c84['offset']===_0xddbc('0x19')&&typeof _0x193c84['limit']===_0xddbc('0x19');var _0xedd271=_0x5d0a34[_0xddbc('0x1a')];var _0x118569=_0x48efdb?0x0:_0x193c84[_0xddbc('0x1b')];var _0x114fc7=_0x48efdb?_0x5d0a34['count']:_0x193c84[_0xddbc('0x1b')]+_0x193c84['limit'];var _0x52426a;if(_0x114fc7>=_0xedd271){_0x114fc7=_0xedd271;_0x52426a=0xc8;}else{_0x52426a=0xce;}_0x356afe[_0xddbc('0x1c')](_0x52426a);return _0x356afe['set'](_0xddbc('0x1d'),_0x118569+'-'+_0x114fc7+'/'+_0xedd271)[_0xddbc('0x1e')](_0x5d0a34);}return null;};}function patchUpdates(_0x1cac88){return function(_0xa5a3a0){try{jsonpatch['apply'](_0xa5a3a0,_0x1cac88,!![]);}catch(_0x1e677a){return BPromise[_0xddbc('0x1f')](_0x1e677a);}return _0xa5a3a0[_0xddbc('0x20')]();};}function saveUpdates(_0x1d44a7,_0x328316){return function(_0x57eb60){if(_0x57eb60){return _0x57eb60['update'](_0x1d44a7)['then'](function(_0x302120){return _0x302120;});}return null;};}function removeEntity(_0x2f58cd,_0x2db65f){return function(_0x37c6f5){if(_0x37c6f5){return _0x37c6f5[_0xddbc('0x21')]()[_0xddbc('0x22')](function(){_0x2f58cd[_0xddbc('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a7e0b,_0x136f64){return function(_0x12bf5b){if(!_0x12bf5b){_0x2a7e0b[_0xddbc('0x23')](0x194);}return _0x12bf5b;};}function handleError(_0x3b1f06,_0xb4f6f5){_0xb4f6f5=_0xb4f6f5||0x1f4;return function(_0x16a720){logger['error'](_0x16a720[_0xddbc('0x24')]);if(_0x16a720[_0xddbc('0x25')]){delete _0x16a720[_0xddbc('0x25')];}_0x3b1f06[_0xddbc('0x1c')](_0xb4f6f5)['send'](_0x16a720);};}exports[_0xddbc('0x26')]=function(_0x56042c,_0x49cc11){var _0x95a9c6={'raw':![],'where':{'id':_0x56042c[_0xddbc('0x27')]['id']}},_0x4d6329={};_0x4d6329[_0xddbc('0x28')]=_[_0xddbc('0x29')](db[_0xddbc('0x2a')][_0xddbc('0x2b')]);_0x4d6329['query']=_[_0xddbc('0x29')](_0x56042c['query']);_0x4d6329[_0xddbc('0x2c')]=_[_0xddbc('0x2d')](_0x4d6329[_0xddbc('0x28')],_0x4d6329[_0xddbc('0x2e')]);_0x95a9c6[_0xddbc('0x2f')]=_[_0xddbc('0x2d')](_0x4d6329[_0xddbc('0x28')],qs[_0xddbc('0x30')](_0x56042c['query'][_0xddbc('0x30')]));_0x95a9c6[_0xddbc('0x2f')]=_0x95a9c6[_0xddbc('0x2f')]['length']?_0x95a9c6[_0xddbc('0x2f')]:_0x4d6329['model'];if(_0x56042c[_0xddbc('0x2e')][_0xddbc('0x31')]){_0x95a9c6['include']=[{'all':!![]}];}_0x95a9c6=_[_0xddbc('0x32')]({},_0x95a9c6,_0x56042c['options']);return db[_0xddbc('0x2a')]['find'](_0x95a9c6)['then'](handleEntityNotFound(_0x49cc11,null))[_0xddbc('0x22')](respondWithResult(_0x49cc11,null))['catch'](handleError(_0x49cc11,null));};exports['destroy']=function(_0x457fe8,_0x8d2fbd){return db[_0xddbc('0x2a')]['find']({'where':{'id':_0x457fe8['params']['id']}})[_0xddbc('0x22')](handleEntityNotFound(_0x8d2fbd,null))['then'](removeEntity(_0x8d2fbd,null))[_0xddbc('0x33')](handleError(_0x8d2fbd,null));};function widgetAttributes(_0x217c99){try{switch(_0x217c99[_0xddbc('0x34')]){case _0xddbc('0x35'):return[{'name':_0xddbc('0x36'),'value':_0x217c99[_0xddbc('0x36')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x0]?_0x217c99[_0xddbc('0x37')][0x0][_0xddbc('0x38')]:undefined)||_0xddbc('0x39')}];case _0xddbc('0x3a'):return[{'name':_0xddbc('0x3b'),'value':_0x217c99[_0xddbc('0x3b')]||(_0x217c99['attrs']&&_0x217c99[_0xddbc('0x37')][0x0]?_0x217c99[_0xddbc('0x37')][0x0][_0xddbc('0x38')]:undefined)||''}];case _0xddbc('0x3c'):return[{'name':_0xddbc('0x3d'),'value':_0x217c99['attrHourFormat']||(_0x217c99['attrs']&&_0x217c99[_0xddbc('0x37')][0x0]?_0x217c99[_0xddbc('0x37')][0x0][_0xddbc('0x38')]:undefined)||_0xddbc('0x3e')},{'name':'attrTimezone','value':_0x217c99[_0xddbc('0x3f')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x1]?_0x217c99[_0xddbc('0x37')][0x1][_0xddbc('0x38')]:undefined)||_0xddbc('0x40')},{'name':_0xddbc('0x41'),'value':_0x217c99[_0xddbc('0x41')]||(_0x217c99['attrs']&&_0x217c99[_0xddbc('0x37')][0x2]?_0x217c99[_0xddbc('0x37')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xddbc('0x42'),'value':_0x217c99[_0xddbc('0x42')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x0]?_0x217c99[_0xddbc('0x37')][0x0]['value']:undefined)||_0xddbc('0x43')},{'name':'attrVoiceQueues','value':_0x217c99[_0xddbc('0x44')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99['attrs'][0x1]?_0x217c99[_0xddbc('0x37')][0x1][_0xddbc('0x38')]:undefined)||[]},{'name':_0xddbc('0x41'),'value':_0x217c99['attrFontSize']||(_0x217c99['attrs']&&_0x217c99['attrs'][0x2]?_0x217c99[_0xddbc('0x37')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x217c99['attrChannel']||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x3]?_0x217c99[_0xddbc('0x37')][0x3][_0xddbc('0x38')]:undefined)||_0xddbc('0x45')},{'name':_0xddbc('0x46'),'value':_0x217c99[_0xddbc('0x46')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x4]?_0x217c99['attrs'][0x4][_0xddbc('0x38')]:undefined)||''},{'name':_0xddbc('0x47'),'value':_0x217c99[_0xddbc('0x47')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99['attrs'][0x5]?_0x217c99[_0xddbc('0x37')][0x5][_0xddbc('0x38')]:undefined)||''},{'name':_0xddbc('0x48'),'value':_0x217c99['attrSmsAccounts']||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x6]?_0x217c99[_0xddbc('0x37')][0x6][_0xddbc('0x38')]:undefined)||''},{'name':_0xddbc('0x49'),'value':_0x217c99['attrOpenchannelAccounts']||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x7]?_0x217c99[_0xddbc('0x37')][0x7]['value']:undefined)||''},{'name':_0xddbc('0x4a'),'value':_0x217c99[_0xddbc('0x4a')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x8]?_0x217c99[_0xddbc('0x37')][0x8][_0xddbc('0x38')]:undefined)||''},{'name':'attrChatWebsites','value':_0x217c99['attrChatWebsites']||(_0x217c99[_0xddbc('0x37')]&&_0x217c99['attrs'][0x9]?_0x217c99[_0xddbc('0x37')][0x9][_0xddbc('0x38')]:undefined)||''}];case _0xddbc('0x4b'):case _0xddbc('0x4c'):return[{'name':'attrSerie1','value':_0x217c99[_0xddbc('0x4d')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x0]?_0x217c99[_0xddbc('0x37')][0x0]['value']:undefined)||_0xddbc('0x43')},{'name':_0xddbc('0x4e'),'value':_0x217c99[_0xddbc('0x4e')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x1]?_0x217c99[_0xddbc('0x37')][0x1][_0xddbc('0x38')]:undefined)||null},{'name':'attrSerie3','value':_0x217c99[_0xddbc('0x4f')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x2]?_0x217c99[_0xddbc('0x37')][0x2]['value']:undefined)||null},{'name':_0xddbc('0x44'),'value':_0x217c99[_0xddbc('0x44')]||(_0x217c99['attrs']&&_0x217c99[_0xddbc('0x37')][0x3]?_0x217c99[_0xddbc('0x37')][0x3][_0xddbc('0x38')]:undefined)||[]},{'name':_0xddbc('0x50'),'value':_0x217c99[_0xddbc('0x50')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99['attrs'][0x4]?_0x217c99[_0xddbc('0x37')][0x4][_0xddbc('0x38')]:undefined)||'voice'},{'name':_0xddbc('0x46'),'value':_0x217c99[_0xddbc('0x46')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x5]?_0x217c99[_0xddbc('0x37')][0x5]['value']:undefined)||''},{'name':_0xddbc('0x47'),'value':_0x217c99[_0xddbc('0x47')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x6]?_0x217c99[_0xddbc('0x37')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x217c99[_0xddbc('0x48')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x7]?_0x217c99[_0xddbc('0x37')][0x7]['value']:undefined)||''},{'name':_0xddbc('0x49'),'value':_0x217c99['attrOpenchannelAccounts']||(_0x217c99[_0xddbc('0x37')]&&_0x217c99['attrs'][0x8]?_0x217c99['attrs'][0x8][_0xddbc('0x38')]:undefined)||''},{'name':_0xddbc('0x4a'),'value':_0x217c99[_0xddbc('0x4a')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0x9]?_0x217c99[_0xddbc('0x37')][0x9]['value']:undefined)||''},{'name':_0xddbc('0x51'),'value':_0x217c99[_0xddbc('0x51')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99[_0xddbc('0x37')][0xa]?_0x217c99['attrs'][0xa]['value']:undefined)||''}];case _0xddbc('0x52'):return[{'name':_0xddbc('0x53'),'type':_0x217c99[_0xddbc('0x54')]||(_0x217c99[_0xddbc('0x37')]&&_0x217c99['attrs'][0x0]?_0x217c99[_0xddbc('0x37')][0x0][_0xddbc('0x34')]:undefined)||null,'value':_0x217c99[_0xddbc('0x53')]||(_0x217c99['attrs']&&_0x217c99[_0xddbc('0x37')][0x0]?_0x217c99[_0xddbc('0x37')][0x0]['value']:undefined)||null},{'name':_0xddbc('0x55'),'value':_0x217c99[_0xddbc('0x55')]||(_0x217c99['attrs']&&_0x217c99['attrs'][0x1]?_0x217c99['attrs'][0x1][_0xddbc('0x38')]:undefined)||0x0}];default:return[];}}catch(_0x1959e0){logger['error'](_0xddbc('0x56'),JSON[_0xddbc('0x57')](_0x1959e0));return[];}}exports[_0xddbc('0x58')]=function(_0x5e9a01,_0x2a1060){if(_0x5e9a01['body']){_0x5e9a01[_0xddbc('0x59')]['attrs']=widgetAttributes(_0x5e9a01[_0xddbc('0x59')]);}return db[_0xddbc('0x2a')][_0xddbc('0x58')](_0x5e9a01[_0xddbc('0x59')],{})['then'](respondWithResult(_0x2a1060,0xc9))[_0xddbc('0x33')](handleError(_0x2a1060,null));};exports[_0xddbc('0x5a')]=function(_0x294fda,_0xda1c23){if(_0x294fda[_0xddbc('0x59')]['id']){delete _0x294fda[_0xddbc('0x59')]['id'];}_0x294fda['body'][_0xddbc('0x37')]=widgetAttributes(_0x294fda['body']);return db['DashboardItem'][_0xddbc('0x5b')]({'where':{'id':_0x294fda[_0xddbc('0x27')]['id']}})[_0xddbc('0x22')](handleEntityNotFound(_0xda1c23,null))[_0xddbc('0x22')](saveUpdates(_0x294fda[_0xddbc('0x59')],null))[_0xddbc('0x22')](respondWithResult(_0xda1c23,null))[_0xddbc('0x33')](handleError(_0xda1c23,null));}; \ No newline at end of file +var _0x9c63=['name','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','find','catch','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x43dbff,_0x59f501){var _0xca6537=function(_0xd46f81){while(--_0xd46f81){_0x43dbff['push'](_0x43dbff['shift']());}};_0xca6537(++_0x59f501);}(_0x9c63,0x1a7));var _0x39c6=function(_0x1ae66f,_0x3fce21){_0x1ae66f=_0x1ae66f-0x0;var _0x56a591=_0x9c63[_0x1ae66f];return _0x56a591;};'use strict';var emlformat=require(_0x39c6('0x0'));var rimraf=require(_0x39c6('0x1'));var zipdir=require(_0x39c6('0x2'));var jsonpatch=require(_0x39c6('0x3'));var rp=require(_0x39c6('0x4'));var moment=require('moment');var BPromise=require(_0x39c6('0x5'));var Mustache=require(_0x39c6('0x6'));var util=require('util');var path=require('path');var sox=require(_0x39c6('0x7'));var csv=require(_0x39c6('0x8'));var ejs=require(_0x39c6('0x9'));var fs=require('fs');var fs_extra=require(_0x39c6('0xa'));var _=require(_0x39c6('0xb'));var squel=require(_0x39c6('0xc'));var crypto=require('crypto');var jsforce=require(_0x39c6('0xd'));var deskjs=require(_0x39c6('0xe'));var toCsv=require(_0x39c6('0x8'));var querystring=require(_0x39c6('0xf'));var Papa=require(_0x39c6('0x10'));var Redis=require('ioredis');var authService=require(_0x39c6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x39c6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39c6('0x13'))(_0x39c6('0x14'));var utils=require(_0x39c6('0x15'));var config=require(_0x39c6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x39c6('0x17'))['db'];config['redis']=_['defaults'](config[_0x39c6('0x18')],{'host':_0x39c6('0x19'),'port':0x18eb});var socket=require(_0x39c6('0x1a'))(new Redis(config[_0x39c6('0x18')]));require('./dashboardItem.socket')[_0x39c6('0x1b')](socket);function respondWithStatusCode(_0x4c83dc,_0xf713c8){_0xf713c8=_0xf713c8||0xcc;return function(_0x1c25a9){if(_0x1c25a9){return _0x4c83dc[_0x39c6('0x1c')](_0xf713c8);}return _0x4c83dc['status'](_0xf713c8)['end']();};}function respondWithResult(_0x4581d7,_0x1b8bc3){_0x1b8bc3=_0x1b8bc3||0xc8;return function(_0x50a267){if(_0x50a267){return _0x4581d7[_0x39c6('0x1d')](_0x1b8bc3)[_0x39c6('0x1e')](_0x50a267);}};}function respondWithFilteredResult(_0x10ffb8,_0x28779d){return function(_0x129613){if(_0x129613){var _0x3eaac7=typeof _0x28779d['offset']==='undefined'&&typeof _0x28779d['limit']==='undefined';var _0x524702=_0x129613[_0x39c6('0x1f')];var _0x5d4eec=_0x3eaac7?0x0:_0x28779d['offset'];var _0x26d07b=_0x3eaac7?_0x129613[_0x39c6('0x1f')]:_0x28779d[_0x39c6('0x20')]+_0x28779d[_0x39c6('0x21')];var _0x5608dd;if(_0x26d07b>=_0x524702){_0x26d07b=_0x524702;_0x5608dd=0xc8;}else{_0x5608dd=0xce;}_0x10ffb8['status'](_0x5608dd);return _0x10ffb8['set'](_0x39c6('0x22'),_0x5d4eec+'-'+_0x26d07b+'/'+_0x524702)['json'](_0x129613);}return null;};}function patchUpdates(_0x5d4083){return function(_0x58d69a){try{jsonpatch[_0x39c6('0x23')](_0x58d69a,_0x5d4083,!![]);}catch(_0x358f6f){return BPromise[_0x39c6('0x24')](_0x358f6f);}return _0x58d69a[_0x39c6('0x25')]();};}function saveUpdates(_0x33132f,_0x19e54d){return function(_0x3497d3){if(_0x3497d3){return _0x3497d3[_0x39c6('0x26')](_0x33132f)[_0x39c6('0x27')](function(_0x2fd3a7){return _0x2fd3a7;});}return null;};}function removeEntity(_0x3018f6,_0x3e49ca){return function(_0xa177fc){if(_0xa177fc){return _0xa177fc[_0x39c6('0x28')]()[_0x39c6('0x27')](function(){_0x3018f6[_0x39c6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f5985,_0x25d748){return function(_0x929a7b){if(!_0x929a7b){_0x3f5985['sendStatus'](0x194);}return _0x929a7b;};}function handleError(_0xf06e09,_0x348f90){_0x348f90=_0x348f90||0x1f4;return function(_0x185869){logger[_0x39c6('0x29')](_0x185869['stack']);if(_0x185869['name']){delete _0x185869[_0x39c6('0x2a')];}_0xf06e09[_0x39c6('0x1d')](_0x348f90)['send'](_0x185869);};}exports[_0x39c6('0x2b')]=function(_0x482aa9,_0x520e8a){var _0x21ca3f={'raw':![],'where':{'id':_0x482aa9[_0x39c6('0x2c')]['id']}},_0x2aeab0={};_0x2aeab0[_0x39c6('0x2d')]=_[_0x39c6('0x2e')](db[_0x39c6('0x2f')][_0x39c6('0x30')]);_0x2aeab0[_0x39c6('0x31')]=_[_0x39c6('0x2e')](_0x482aa9[_0x39c6('0x31')]);_0x2aeab0[_0x39c6('0x32')]=_[_0x39c6('0x33')](_0x2aeab0[_0x39c6('0x2d')],_0x2aeab0[_0x39c6('0x31')]);_0x21ca3f[_0x39c6('0x34')]=_[_0x39c6('0x33')](_0x2aeab0[_0x39c6('0x2d')],qs['fields'](_0x482aa9['query'][_0x39c6('0x35')]));_0x21ca3f[_0x39c6('0x34')]=_0x21ca3f[_0x39c6('0x34')][_0x39c6('0x36')]?_0x21ca3f[_0x39c6('0x34')]:_0x2aeab0[_0x39c6('0x2d')];if(_0x482aa9[_0x39c6('0x31')]['includeAll']){_0x21ca3f[_0x39c6('0x37')]=[{'all':!![]}];}_0x21ca3f=_[_0x39c6('0x38')]({},_0x21ca3f,_0x482aa9['options']);return db['DashboardItem'][_0x39c6('0x39')](_0x21ca3f)[_0x39c6('0x27')](handleEntityNotFound(_0x520e8a,null))[_0x39c6('0x27')](respondWithResult(_0x520e8a,null))[_0x39c6('0x3a')](handleError(_0x520e8a,null));};exports[_0x39c6('0x28')]=function(_0x2ec74d,_0x321f5a){return db[_0x39c6('0x2f')][_0x39c6('0x39')]({'where':{'id':_0x2ec74d[_0x39c6('0x2c')]['id']}})[_0x39c6('0x27')](handleEntityNotFound(_0x321f5a,null))[_0x39c6('0x27')](removeEntity(_0x321f5a,null))[_0x39c6('0x3a')](handleError(_0x321f5a,null));};function widgetAttributes(_0x52404e){try{switch(_0x52404e['type']){case _0x39c6('0x3b'):return[{'name':_0x39c6('0x3c'),'value':_0x52404e[_0x39c6('0x3c')]||(_0x52404e['attrs']&&_0x52404e[_0x39c6('0x3d')][0x0]?_0x52404e[_0x39c6('0x3d')][0x0][_0x39c6('0x3e')]:undefined)||_0x39c6('0x3f')}];case'custom':return[{'name':'attrPath','value':_0x52404e[_0x39c6('0x40')]||(_0x52404e['attrs']&&_0x52404e[_0x39c6('0x3d')][0x0]?_0x52404e[_0x39c6('0x3d')][0x0][_0x39c6('0x3e')]:undefined)||''}];case _0x39c6('0x41'):return[{'name':'attrHourFormat','value':_0x52404e[_0x39c6('0x42')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x0]?_0x52404e[_0x39c6('0x3d')][0x0][_0x39c6('0x3e')]:undefined)||_0x39c6('0x43')},{'name':_0x39c6('0x44'),'value':_0x52404e[_0x39c6('0x44')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e['attrs'][0x1]?_0x52404e['attrs'][0x1][_0x39c6('0x3e')]:undefined)||'0.00'},{'name':_0x39c6('0x45'),'value':_0x52404e['attrFontSize']||(_0x52404e['attrs']&&_0x52404e[_0x39c6('0x3d')][0x2]?_0x52404e[_0x39c6('0x3d')][0x2][_0x39c6('0x3e')]:undefined)||0xc}];case'counter':return[{'name':_0x39c6('0x46'),'value':_0x52404e[_0x39c6('0x46')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x0]?_0x52404e[_0x39c6('0x3d')][0x0][_0x39c6('0x3e')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x52404e[_0x39c6('0x47')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e['attrs'][0x1]?_0x52404e[_0x39c6('0x3d')][0x1][_0x39c6('0x3e')]:undefined)||[]},{'name':'attrFontSize','value':_0x52404e[_0x39c6('0x45')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x2]?_0x52404e[_0x39c6('0x3d')][0x2][_0x39c6('0x3e')]:undefined)||0x14},{'name':_0x39c6('0x48'),'value':_0x52404e['attrChannel']||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x3]?_0x52404e[_0x39c6('0x3d')][0x3][_0x39c6('0x3e')]:undefined)||_0x39c6('0x49')},{'name':'attrEmailAccounts','value':_0x52404e[_0x39c6('0x4a')]||(_0x52404e['attrs']&&_0x52404e[_0x39c6('0x3d')][0x4]?_0x52404e[_0x39c6('0x3d')][0x4][_0x39c6('0x3e')]:undefined)||''},{'name':_0x39c6('0x4b'),'value':_0x52404e[_0x39c6('0x4b')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x5]?_0x52404e[_0x39c6('0x3d')][0x5]['value']:undefined)||''},{'name':_0x39c6('0x4c'),'value':_0x52404e[_0x39c6('0x4c')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x6]?_0x52404e[_0x39c6('0x3d')][0x6][_0x39c6('0x3e')]:undefined)||''},{'name':_0x39c6('0x4d'),'value':_0x52404e[_0x39c6('0x4d')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e['attrs'][0x7]?_0x52404e[_0x39c6('0x3d')][0x7][_0x39c6('0x3e')]:undefined)||''},{'name':_0x39c6('0x4e'),'value':_0x52404e['attrWhatsappAccounts']||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e['attrs'][0x8]?_0x52404e[_0x39c6('0x3d')][0x8]['value']:undefined)||''},{'name':_0x39c6('0x4f'),'value':_0x52404e[_0x39c6('0x4f')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e['attrs'][0x9]?_0x52404e[_0x39c6('0x3d')][0x9][_0x39c6('0x3e')]:undefined)||''}];case _0x39c6('0x50'):case _0x39c6('0x51'):return[{'name':_0x39c6('0x52'),'value':_0x52404e[_0x39c6('0x52')]||(_0x52404e['attrs']&&_0x52404e[_0x39c6('0x3d')][0x0]?_0x52404e[_0x39c6('0x3d')][0x0][_0x39c6('0x3e')]:undefined)||'total'},{'name':_0x39c6('0x53'),'value':_0x52404e[_0x39c6('0x53')]||(_0x52404e['attrs']&&_0x52404e[_0x39c6('0x3d')][0x1]?_0x52404e[_0x39c6('0x3d')][0x1][_0x39c6('0x3e')]:undefined)||null},{'name':_0x39c6('0x54'),'value':_0x52404e[_0x39c6('0x54')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e['attrs'][0x2]?_0x52404e[_0x39c6('0x3d')][0x2]['value']:undefined)||null},{'name':_0x39c6('0x47'),'value':_0x52404e[_0x39c6('0x47')]||(_0x52404e['attrs']&&_0x52404e['attrs'][0x3]?_0x52404e[_0x39c6('0x3d')][0x3][_0x39c6('0x3e')]:undefined)||[]},{'name':_0x39c6('0x48'),'value':_0x52404e[_0x39c6('0x48')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e['attrs'][0x4]?_0x52404e['attrs'][0x4]['value']:undefined)||_0x39c6('0x49')},{'name':_0x39c6('0x4a'),'value':_0x52404e[_0x39c6('0x4a')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x5]?_0x52404e['attrs'][0x5][_0x39c6('0x3e')]:undefined)||''},{'name':_0x39c6('0x4b'),'value':_0x52404e[_0x39c6('0x4b')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x6]?_0x52404e[_0x39c6('0x3d')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x52404e[_0x39c6('0x4c')]||(_0x52404e['attrs']&&_0x52404e[_0x39c6('0x3d')][0x7]?_0x52404e[_0x39c6('0x3d')][0x7][_0x39c6('0x3e')]:undefined)||''},{'name':_0x39c6('0x4d'),'value':_0x52404e[_0x39c6('0x4d')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x8]?_0x52404e[_0x39c6('0x3d')][0x8][_0x39c6('0x3e')]:undefined)||''},{'name':_0x39c6('0x4e'),'value':_0x52404e['attrWhatsappAccounts']||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e['attrs'][0x9]?_0x52404e[_0x39c6('0x3d')][0x9]['value']:undefined)||''},{'name':_0x39c6('0x4f'),'value':_0x52404e[_0x39c6('0x4f')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0xa]?_0x52404e[_0x39c6('0x3d')][0xa]['value']:undefined)||''}];case _0x39c6('0x55'):return[{'name':_0x39c6('0x56'),'type':_0x52404e['reportType']||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x0]?_0x52404e[_0x39c6('0x3d')][0x0][_0x39c6('0x57')]:undefined)||null,'value':_0x52404e[_0x39c6('0x56')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x0]?_0x52404e[_0x39c6('0x3d')][0x0][_0x39c6('0x3e')]:undefined)||null},{'name':_0x39c6('0x58'),'value':_0x52404e['attrRefresh']||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x1]?_0x52404e[_0x39c6('0x3d')][0x1][_0x39c6('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0xd43d54){logger['error'](_0x39c6('0x59'),JSON[_0x39c6('0x5a')](_0xd43d54));return[];}}exports[_0x39c6('0x5b')]=function(_0x151c13,_0x1300a){if(_0x151c13[_0x39c6('0x5c')]){_0x151c13['body']['attrs']=widgetAttributes(_0x151c13[_0x39c6('0x5c')]);}return db[_0x39c6('0x2f')]['create'](_0x151c13[_0x39c6('0x5c')],{})[_0x39c6('0x27')](respondWithResult(_0x1300a,0xc9))['catch'](handleError(_0x1300a,null));};exports[_0x39c6('0x26')]=function(_0x5bd7db,_0x14182d){if(_0x5bd7db[_0x39c6('0x5c')]['id']){delete _0x5bd7db['body']['id'];}_0x5bd7db[_0x39c6('0x5c')][_0x39c6('0x3d')]=widgetAttributes(_0x5bd7db[_0x39c6('0x5c')]);return db[_0x39c6('0x2f')]['find']({'where':{'id':_0x5bd7db[_0x39c6('0x2c')]['id']}})['then'](handleEntityNotFound(_0x14182d,null))[_0x39c6('0x27')](saveUpdates(_0x5bd7db['body'],null))[_0x39c6('0x27')](respondWithResult(_0x14182d,null))[_0x39c6('0x3a')](handleError(_0x14182d,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index d6e0054..c1fc672 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 _0x1e5e=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1e5e,0x88));var _0xe1e5=function(_0x4e85ec,_0x2913b6){_0x4e85ec=_0x4e85ec-0x0;var _0x1c1ab3=_0x1e5e[_0x4e85ec];return _0x1c1ab3;};'use strict';var EventEmitter=require(_0xe1e5('0x0'));var DashboardItem=require(_0xe1e5('0x1'))['db'][_0xe1e5('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xe1e5('0x3')](0x0);var events={'afterCreate':_0xe1e5('0x4'),'afterUpdate':_0xe1e5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x512dc2){return function(_0x286815,_0x58a335,_0x510bb2){DashboardItemEvents[_0xe1e5('0x6')](_0x512dc2+':'+_0x286815['id'],_0x286815);DashboardItemEvents['emit'](_0x512dc2,_0x286815);_0x510bb2(null);};}for(var e in events){if(events[_0xe1e5('0x7')](e)){var event=events[e];DashboardItem[_0xe1e5('0x8')](e,emitEvent(event));}}module[_0xe1e5('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0xdac0=['hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x59e184,_0x27ba2b){var _0x4b0453=function(_0xd423bb){while(--_0xd423bb){_0x59e184['push'](_0x59e184['shift']());}};_0x4b0453(++_0x27ba2b);}(_0xdac0,0x17e));var _0x0dac=function(_0x425777,_0xf8d470){_0x425777=_0x425777-0x0;var _0x52ab15=_0xdac0[_0x425777];return _0x52ab15;};'use strict';var EventEmitter=require(_0x0dac('0x0'));var DashboardItem=require(_0x0dac('0x1'))['db'][_0x0dac('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0dac('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0dac('0x4'),'afterDestroy':_0x0dac('0x5')};function emitEvent(_0x338f68){return function(_0x445760,_0x577b65,_0x4d3b25){DashboardItemEvents[_0x0dac('0x6')](_0x338f68+':'+_0x445760['id'],_0x445760);DashboardItemEvents[_0x0dac('0x6')](_0x338f68,_0x445760);_0x4d3b25(null);};}for(var e in events){if(events[_0x0dac('0x7')](e)){var event=events[e];DashboardItem[_0x0dac('0x8')](e,emitEvent(event));}}module[_0x0dac('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 b280119..399de5c 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 _0xb4f2=['api','moment','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items','lodash','util','../../config/logger'];(function(_0x114b7c,_0xc4b93b){var _0x47185f=function(_0x5b4cfa){while(--_0x5b4cfa){_0x114b7c['push'](_0x114b7c['shift']());}};_0x47185f(++_0xc4b93b);}(_0xb4f2,0x1eb));var _0x2b4f=function(_0x513b20,_0x4b77e4){_0x513b20=_0x513b20-0x0;var _0x37da72=_0xb4f2[_0x513b20];return _0x37da72;};'use strict';var _=require(_0x2b4f('0x0'));var util=require(_0x2b4f('0x1'));var logger=require(_0x2b4f('0x2'))(_0x2b4f('0x3'));var moment=require(_0x2b4f('0x4'));var BPromise=require('bluebird');var rp=require(_0x2b4f('0x5'));var fs=require('fs');var path=require(_0x2b4f('0x6'));var rimraf=require(_0x2b4f('0x7'));var config=require(_0x2b4f('0x8'));var attributes=require(_0x2b4f('0x9'));module['exports']=function(_0xb3c554,_0x5613ca){return _0xb3c554[_0x2b4f('0xa')](_0x2b4f('0xb'),attributes,{'tableName':_0x2b4f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe78c=['define','dashboard_items','util','moment','request-promise','path'];(function(_0x448f8,_0x2aa1d7){var _0xa73126=function(_0x1fcafa){while(--_0x1fcafa){_0x448f8['push'](_0x448f8['shift']());}};_0xa73126(++_0x2aa1d7);}(_0xe78c,0xaa));var _0xce78=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xe78c[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require(_0xce78('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xce78('0x1'));var BPromise=require('bluebird');var rp=require(_0xce78('0x2'));var fs=require('fs');var path=require(_0xce78('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x1ef314,_0x967d31){return _0x1ef314[_0xce78('0x4')]('DashboardItem',attributes,{'tableName':_0xce78('0x5'),'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 fdd1717..5ea394f 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 _0x2127=['message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2127,0xb9));var _0x7212=function(_0x15f4c5,_0x2e3e61){_0x15f4c5=_0x15f4c5-0x0;var _0x53b5ee=_0x2127[_0x15f4c5];return _0x53b5ee;};'use strict';var _=require(_0x7212('0x0'));var util=require(_0x7212('0x1'));var moment=require('moment');var BPromise=require(_0x7212('0x2'));var rs=require(_0x7212('0x3'));var fs=require('fs');var Redis=require(_0x7212('0x4'));var db=require(_0x7212('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7212('0x6'));var config=require(_0x7212('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7212('0x8')]({'port':0x232a});config[_0x7212('0x9')]=_[_0x7212('0xa')](config[_0x7212('0x9')],{'host':_0x7212('0xb'),'port':0x18eb});var socket=require(_0x7212('0xc'))(new Redis(config[_0x7212('0x9')]));require(_0x7212('0xd'))[_0x7212('0xe')](socket);function respondWithRpcPromise(_0x32ae24,_0x428a2f,_0x5cd7cf){return new BPromise(function(_0x3c7b02,_0xc047f3){return client[_0x7212('0xf')](_0x32ae24,_0x5cd7cf)['then'](function(_0x33e08b){logger['info']('DashboardItem,\x20%s,\x20%s',_0x428a2f,_0x7212('0x10'));logger[_0x7212('0x11')](_0x7212('0x12'),_0x428a2f,_0x7212('0x10'),JSON[_0x7212('0x13')](_0x33e08b));if(_0x33e08b[_0x7212('0x14')]){if(_0x33e08b['error'][_0x7212('0x15')]===0x1f4){logger[_0x7212('0x14')](_0x7212('0x16'),_0x428a2f,_0x33e08b[_0x7212('0x14')][_0x7212('0x17')]);return _0xc047f3(_0x33e08b[_0x7212('0x14')][_0x7212('0x17')]);}logger[_0x7212('0x14')](_0x7212('0x16'),_0x428a2f,_0x33e08b[_0x7212('0x14')][_0x7212('0x17')]);return _0x3c7b02(_0x33e08b[_0x7212('0x14')][_0x7212('0x17')]);}else{logger[_0x7212('0x18')]('DashboardItem,\x20%s,\x20%s',_0x428a2f,_0x7212('0x10'));_0x3c7b02(_0x33e08b[_0x7212('0x19')][_0x7212('0x17')]);}})['catch'](function(_0x13bc4a){logger[_0x7212('0x14')](_0x7212('0x16'),_0x428a2f,_0x13bc4a);_0xc047f3(_0x13bc4a);});});} \ No newline at end of file +var _0x885e=['debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent'];(function(_0x414bf0,_0x1b1907){var _0xb89924=function(_0x318d9c){while(--_0x318d9c){_0x414bf0['push'](_0x414bf0['shift']());}};_0xb89924(++_0x1b1907);}(_0x885e,0x72));var _0xe885=function(_0xf8d4d3,_0x10c7e6){_0xf8d4d3=_0xf8d4d3-0x0;var _0x378ee2=_0x885e[_0xf8d4d3];return _0x378ee2;};'use strict';var _=require(_0xe885('0x0'));var util=require(_0xe885('0x1'));var moment=require(_0xe885('0x2'));var BPromise=require(_0xe885('0x3'));var rs=require(_0xe885('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe885('0x5'))['db'];var utils=require(_0xe885('0x6'));var logger=require(_0xe885('0x7'))('rpc');var config=require(_0xe885('0x8'));var jayson=require(_0xe885('0x9'));var client=jayson[_0xe885('0xa')][_0xe885('0xb')]({'port':0x232a});config['redis']=_[_0xe885('0xc')](config[_0xe885('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe885('0xd')]));require(_0xe885('0xe'))[_0xe885('0xf')](socket);function respondWithRpcPromise(_0x1a0855,_0x513bdd,_0xa72572){return new BPromise(function(_0x5087c9,_0x40e640){return client[_0xe885('0x10')](_0x1a0855,_0xa72572)[_0xe885('0x11')](function(_0x3e4daf){logger[_0xe885('0x12')](_0xe885('0x13'),_0x513bdd,_0xe885('0x14'));logger[_0xe885('0x15')](_0xe885('0x16'),_0x513bdd,_0xe885('0x14'),JSON['stringify'](_0x3e4daf));if(_0x3e4daf[_0xe885('0x17')]){if(_0x3e4daf[_0xe885('0x17')][_0xe885('0x18')]===0x1f4){logger[_0xe885('0x17')](_0xe885('0x13'),_0x513bdd,_0x3e4daf[_0xe885('0x17')][_0xe885('0x19')]);return _0x40e640(_0x3e4daf[_0xe885('0x17')][_0xe885('0x19')]);}logger[_0xe885('0x17')](_0xe885('0x13'),_0x513bdd,_0x3e4daf[_0xe885('0x17')][_0xe885('0x19')]);return _0x5087c9(_0x3e4daf[_0xe885('0x17')][_0xe885('0x19')]);}else{logger[_0xe885('0x12')](_0xe885('0x13'),_0x513bdd,_0xe885('0x14'));_0x5087c9(_0x3e4daf['result'][_0xe885('0x19')]);}})[_0xe885('0x1a')](function(_0x3396ec){logger['error'](_0xe885('0x13'),_0x513bdd,_0x3396ec);_0x40e640(_0x3396ec);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 7ec0ba3..9b7b523 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 _0x8def=['update','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x8def,0xfb));var _0xf8de=function(_0x144268,_0x1f17ee){_0x144268=_0x144268-0x0;var _0xd3d92d=_0x8def[_0x144268];return _0xd3d92d;};'use strict';var DashboardItemEvents=require(_0xf8de('0x0'));var events=['save','remove',_0xf8de('0x1')];function createListener(_0x19e43e,_0x520fb5){return function(_0x58c412){_0x520fb5[_0xf8de('0x2')](_0x19e43e,_0x58c412);};}function removeListener(_0x39018f,_0x501e62){return function(){DashboardItemEvents[_0xf8de('0x3')](_0x39018f,_0x501e62);};}exports[_0xf8de('0x4')]=function(_0x2f0c8a){for(var _0x49f159=0x0,_0x1e5cd3=events[_0xf8de('0x5')];_0x49f159<_0x1e5cd3;_0x49f159++){var _0xbe6a1b=events[_0x49f159];var _0x35029b=createListener(_0xf8de('0x6')+_0xbe6a1b,_0x2f0c8a);DashboardItemEvents['on'](_0xbe6a1b,_0x35029b);}}; \ No newline at end of file +var _0x104c=['./dashboardItem.events','save','remove','update','emit','register','length','dashboardItem:'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x104c,0x1e0));var _0xc104=function(_0x470b1e,_0x469d95){_0x470b1e=_0x470b1e-0x0;var _0x58d7ff=_0x104c[_0x470b1e];return _0x58d7ff;};'use strict';var DashboardItemEvents=require(_0xc104('0x0'));var events=[_0xc104('0x1'),_0xc104('0x2'),_0xc104('0x3')];function createListener(_0x3fcf2c,_0x3de6ac){return function(_0x31c953){_0x3de6ac[_0xc104('0x4')](_0x3fcf2c,_0x31c953);};}function removeListener(_0xe1824c,_0x57330e){return function(){DashboardItemEvents['removeListener'](_0xe1824c,_0x57330e);};}exports[_0xc104('0x5')]=function(_0x7398e){for(var _0x3f4e96=0x0,_0x3eeb98=events[_0xc104('0x6')];_0x3f4e96<_0x3eeb98;_0x3f4e96++){var _0x4a4c3f=events[_0x3f4e96];var _0xb8e47f=createListener(_0xc104('0x7')+_0x4a4c3f,_0x7398e);DashboardItemEvents['on'](_0x4a4c3f,_0xb8e47f);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index c27f60e..fc03f05 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 _0xe742=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4cfd13,_0x1a0b90){var _0x4df1a1=function(_0xadf26d){while(--_0xadf26d){_0x4cfd13['push'](_0x4cfd13['shift']());}};_0x4df1a1(++_0x1a0b90);}(_0xe742,0x19e));var _0x2e74=function(_0x58143c,_0x5add3f){_0x58143c=_0x58143c-0x0;var _0x2bba42=_0xe742[_0x58143c];return _0x2bba42;};'use strict';var multer=require(_0x2e74('0x0'));var util=require(_0x2e74('0x1'));var path=require(_0x2e74('0x2'));var timeout=require(_0x2e74('0x3'));var express=require(_0x2e74('0x4'));var router=express[_0x2e74('0x5')]();var fs_extra=require(_0x2e74('0x6'));var auth=require(_0x2e74('0x7'));var interaction=require(_0x2e74('0x8'));var config=require(_0x2e74('0x9'));var controller=require('./dashboardItem.controller');router[_0x2e74('0xa')]('/:id',auth[_0x2e74('0xb')](),controller['show']);router[_0x2e74('0xc')]('/',auth['isAuthenticated'](),controller[_0x2e74('0xd')]);router[_0x2e74('0xe')](_0x2e74('0xf'),auth['isAuthenticated'](),controller[_0x2e74('0x10')]);router[_0x2e74('0x11')]('/:id',auth[_0x2e74('0xb')](),controller[_0x2e74('0x12')]);module[_0x2e74('0x13')]=router; \ No newline at end of file +var _0xf178=['isAuthenticated','put','/:id','update','delete','util','path','express','fs-extra','../../components/interaction/service','get','show','post'];(function(_0x520f7d,_0x339eb8){var _0x266fbe=function(_0x1ae42d){while(--_0x1ae42d){_0x520f7d['push'](_0x520f7d['shift']());}};_0x266fbe(++_0x339eb8);}(_0xf178,0x164));var _0x8f17=function(_0x11aef5,_0x5917a0){_0x11aef5=_0x11aef5-0x0;var _0x5f0de1=_0xf178[_0x11aef5];return _0x5f0de1;};'use strict';var multer=require('multer');var util=require(_0x8f17('0x0'));var path=require(_0x8f17('0x1'));var timeout=require('connect-timeout');var express=require(_0x8f17('0x2'));var router=express['Router']();var fs_extra=require(_0x8f17('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8f17('0x4'));var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router[_0x8f17('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x8f17('0x6')]);router[_0x8f17('0x7')]('/',auth[_0x8f17('0x8')](),controller['create']);router[_0x8f17('0x9')](_0x8f17('0xa'),auth['isAuthenticated'](),controller[_0x8f17('0xb')]);router[_0x8f17('0xc')]('/:id',auth[_0x8f17('0x8')](),controller['destroy']);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 18c83a7..a0002f9 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 _0xebe5=['ENUM','first','second','third','STRING','sequelize','exports'];(function(_0x4a3643,_0x28ccb2){var _0x345387=function(_0x224bd3){while(--_0x224bd3){_0x4a3643['push'](_0x4a3643['shift']());}};_0x345387(++_0x28ccb2);}(_0xebe5,0x16a));var _0x5ebe=function(_0x1ff528,_0x22ce2b){_0x1ff528=_0x1ff528-0x0;var _0x2094c2=_0xebe5[_0x1ff528];return _0x2094c2;};'use strict';var Sequelize=require(_0x5ebe('0x0'));module[_0x5ebe('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x5ebe('0x2')](_0x5ebe('0x3'),_0x5ebe('0x4'),_0x5ebe('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x5ebe('0x6')]}}; \ No newline at end of file +var _0xd46e=['third','STRING','ENUM','first'];(function(_0x520e95,_0x1237a7){var _0x5a442e=function(_0x346c1f){while(--_0x346c1f){_0x520e95['push'](_0x520e95['shift']());}};_0x5a442e(++_0x1237a7);}(_0xd46e,0x142));var _0xed46=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xd46e[_0x20589d];return _0x422de9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xed46('0x0')](_0xed46('0x1'),'second',_0xed46('0x2')),'allowNull':![],'defaultValue':_0xed46('0x1')},'description':{'type':Sequelize[_0xed46('0x3')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index cba1e40..0f18cef 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 _0xe364=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','Dispositions','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','Disposition','includeAll','findAll','rows','catch','show','params','include','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xe364,0x1c3));var _0x4e36=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xe364[_0x344a3f];return _0x264712;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e36('0x0'));var zipdir=require(_0x4e36('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e36('0x2'));var moment=require('moment');var BPromise=require(_0x4e36('0x3'));var Mustache=require(_0x4e36('0x4'));var util=require(_0x4e36('0x5'));var path=require(_0x4e36('0x6'));var sox=require(_0x4e36('0x7'));var csv=require(_0x4e36('0x8'));var ejs=require(_0x4e36('0x9'));var fs=require('fs');var fs_extra=require(_0x4e36('0xa'));var _=require(_0x4e36('0xb'));var squel=require(_0x4e36('0xc'));var crypto=require(_0x4e36('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4e36('0xe'));var toCsv=require(_0x4e36('0x8'));var querystring=require('querystring');var Papa=require(_0x4e36('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4e36('0x10'));var as=require(_0x4e36('0x11'));var hardwareService=require(_0x4e36('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4e36('0x13'));var licenseUtil=require(_0x4e36('0x14'));var db=require(_0x4e36('0x15'))['db'];function respondWithStatusCode(_0x15aef4,_0x207b36){_0x207b36=_0x207b36||0xcc;return function(_0x450389){if(_0x450389){return _0x15aef4['sendStatus'](_0x207b36);}return _0x15aef4['status'](_0x207b36)[_0x4e36('0x16')]();};}function respondWithResult(_0x4dea49,_0x3df804){_0x3df804=_0x3df804||0xc8;return function(_0xf8f048){if(_0xf8f048){return _0x4dea49[_0x4e36('0x17')](_0x3df804)['json'](_0xf8f048);}};}function respondWithFilteredResult(_0x5625a9,_0x35f9be){return function(_0x32f83c){if(_0x32f83c){var _0x11dcae=typeof _0x35f9be[_0x4e36('0x18')]===_0x4e36('0x19')&&typeof _0x35f9be[_0x4e36('0x1a')]===_0x4e36('0x19');var _0x20a00d=_0x32f83c[_0x4e36('0x1b')];var _0xe76500=_0x11dcae?0x0:_0x35f9be['offset'];var _0x26deb0=_0x11dcae?_0x32f83c[_0x4e36('0x1b')]:_0x35f9be['offset']+_0x35f9be[_0x4e36('0x1a')];var _0x133665;if(_0x26deb0>=_0x20a00d){_0x26deb0=_0x20a00d;_0x133665=0xc8;}else{_0x133665=0xce;}_0x5625a9[_0x4e36('0x17')](_0x133665);return _0x5625a9['set'](_0x4e36('0x1c'),_0xe76500+'-'+_0x26deb0+'/'+_0x20a00d)[_0x4e36('0x1d')](_0x32f83c);}return null;};}function patchUpdates(_0x349486){return function(_0xd95e41){try{jsonpatch[_0x4e36('0x1e')](_0xd95e41,_0x349486,!![]);}catch(_0x3bd4a9){return BPromise['reject'](_0x3bd4a9);}return _0xd95e41[_0x4e36('0x1f')]();};}function saveUpdates(_0x561618,_0x36a6f0){return function(_0xa6b337){if(_0xa6b337){return _0xa6b337[_0x4e36('0x20')](_0x561618)[_0x4e36('0x21')](function(_0x5d6bf6){return _0x5d6bf6;});}return null;};}function removeEntity(_0x4edcf8,_0x147cf7){return function(_0x2a1662){if(_0x2a1662){return _0x2a1662[_0x4e36('0x22')]()[_0x4e36('0x21')](function(){var _0x179084=_0x2a1662['get']({'plain':!![]});var _0x2076e3=_0x4e36('0x23');return db[_0x4e36('0x24')]['destroy']({'where':{'type':_0x2076e3,'resourceId':_0x179084['id']}})[_0x4e36('0x21')](function(){return _0x2a1662;});})[_0x4e36('0x21')](function(){_0x4edcf8[_0x4e36('0x17')](0xcc)[_0x4e36('0x16')]();});}};}function handleEntityNotFound(_0x86cbaa,_0x38e92b){return function(_0x4132ff){if(!_0x4132ff){_0x86cbaa[_0x4e36('0x25')](0x194);}return _0x4132ff;};}function handleError(_0x58ba65,_0x43d7e4){_0x43d7e4=_0x43d7e4||0x1f4;return function(_0x54e78e){logger['error'](_0x54e78e[_0x4e36('0x26')]);if(_0x54e78e['name']){delete _0x54e78e[_0x4e36('0x27')];}_0x58ba65[_0x4e36('0x17')](_0x43d7e4)[_0x4e36('0x28')](_0x54e78e);};}exports[_0x4e36('0x29')]=function(_0x4e2c35,_0x35a6e7){var _0x369974={},_0x5e635f={},_0x5d9148={'count':0x0,'rows':[]};var _0x59503c=_[_0x4e36('0x2a')](db['Disposition'][_0x4e36('0x2b')],function(_0x3ecb32){return{'name':_0x3ecb32['fieldName'],'type':_0x3ecb32[_0x4e36('0x2c')]['key']};});_0x5e635f[_0x4e36('0x2d')]=_['map'](_0x59503c,_0x4e36('0x27'));_0x5e635f[_0x4e36('0x2e')]=_[_0x4e36('0x2f')](_0x4e2c35[_0x4e36('0x2e')]);_0x5e635f[_0x4e36('0x30')]=_[_0x4e36('0x31')](_0x5e635f[_0x4e36('0x2d')],_0x5e635f[_0x4e36('0x2e')]);_0x369974[_0x4e36('0x32')]=_['intersection'](_0x5e635f[_0x4e36('0x2d')],qs['fields'](_0x4e2c35[_0x4e36('0x2e')][_0x4e36('0x33')]));_0x369974[_0x4e36('0x32')]=_0x369974[_0x4e36('0x32')][_0x4e36('0x34')]?_0x369974[_0x4e36('0x32')]:_0x5e635f[_0x4e36('0x2d')];if(!_0x4e2c35['query'][_0x4e36('0x35')]('nolimit')){_0x369974[_0x4e36('0x1a')]=qs[_0x4e36('0x1a')](_0x4e2c35[_0x4e36('0x2e')][_0x4e36('0x1a')]);_0x369974[_0x4e36('0x18')]=qs[_0x4e36('0x18')](_0x4e2c35[_0x4e36('0x2e')][_0x4e36('0x18')]);}_0x369974[_0x4e36('0x36')]=qs[_0x4e36('0x37')](_0x4e2c35[_0x4e36('0x2e')][_0x4e36('0x37')]);_0x369974['where']=qs[_0x4e36('0x30')](_[_0x4e36('0x38')](_0x4e2c35[_0x4e36('0x2e')],_0x5e635f[_0x4e36('0x30')]),_0x59503c);if(_0x4e2c35[_0x4e36('0x2e')][_0x4e36('0x39')]){_0x369974[_0x4e36('0x3a')]=_[_0x4e36('0x3b')](_0x369974[_0x4e36('0x3a')],{'$or':_[_0x4e36('0x2a')](_0x59503c,function(_0x27b640){if(_0x27b640['type']!==_0x4e36('0x3c')){var _0x2fc121={};_0x2fc121[_0x27b640[_0x4e36('0x27')]]={'$like':'%'+_0x4e2c35[_0x4e36('0x2e')][_0x4e36('0x39')]+'%'};return _0x2fc121;}})});}_0x369974=_[_0x4e36('0x3b')]({},_0x369974,_0x4e2c35[_0x4e36('0x3d')]);var _0x3e65db={'where':_0x369974[_0x4e36('0x3a')]};return db[_0x4e36('0x3e')]['count'](_0x3e65db)[_0x4e36('0x21')](function(_0x40f7ec){_0x5d9148[_0x4e36('0x1b')]=_0x40f7ec;if(_0x4e2c35[_0x4e36('0x2e')][_0x4e36('0x3f')]){_0x369974['include']=[{'all':!![]}];}return db[_0x4e36('0x3e')][_0x4e36('0x40')](_0x369974);})[_0x4e36('0x21')](function(_0x37c03e){_0x5d9148[_0x4e36('0x41')]=_0x37c03e;return _0x5d9148;})[_0x4e36('0x21')](respondWithFilteredResult(_0x35a6e7,_0x369974))[_0x4e36('0x42')](handleError(_0x35a6e7,null));};exports[_0x4e36('0x43')]=function(_0x18436c,_0xa6bae3){var _0x1d9dc0={'raw':!![],'where':{'id':_0x18436c[_0x4e36('0x44')]['id']}},_0x1a15e5={};_0x1a15e5[_0x4e36('0x2d')]=_[_0x4e36('0x2f')](db[_0x4e36('0x3e')][_0x4e36('0x2b')]);_0x1a15e5[_0x4e36('0x2e')]=_[_0x4e36('0x2f')](_0x18436c[_0x4e36('0x2e')]);_0x1a15e5[_0x4e36('0x30')]=_[_0x4e36('0x31')](_0x1a15e5['model'],_0x1a15e5[_0x4e36('0x2e')]);_0x1d9dc0['attributes']=_[_0x4e36('0x31')](_0x1a15e5['model'],qs[_0x4e36('0x33')](_0x18436c[_0x4e36('0x2e')][_0x4e36('0x33')]));_0x1d9dc0[_0x4e36('0x32')]=_0x1d9dc0['attributes'][_0x4e36('0x34')]?_0x1d9dc0[_0x4e36('0x32')]:_0x1a15e5[_0x4e36('0x2d')];if(_0x18436c[_0x4e36('0x2e')][_0x4e36('0x3f')]){_0x1d9dc0[_0x4e36('0x45')]=[{'all':!![]}];}_0x1d9dc0=_[_0x4e36('0x3b')]({},_0x1d9dc0,_0x18436c[_0x4e36('0x3d')]);return db['Disposition'][_0x4e36('0x46')](_0x1d9dc0)[_0x4e36('0x21')](handleEntityNotFound(_0xa6bae3,null))['then'](respondWithResult(_0xa6bae3,null))[_0x4e36('0x42')](handleError(_0xa6bae3,null));};exports[_0x4e36('0x47')]=function(_0x53f4d5,_0x4b090b){return db[_0x4e36('0x3e')][_0x4e36('0x47')](_0x53f4d5['body'],{})[_0x4e36('0x21')](function(_0x42b33e){var _0x327577=_0x53f4d5['user'][_0x4e36('0x48')]({'plain':!![]});if(!_0x327577)throw new Error(_0x4e36('0x49'));if(_0x327577['role']===_0x4e36('0x4a')){var _0x4b7f13=_0x42b33e[_0x4e36('0x48')]({'plain':!![]});var _0x5767f7=_0x4e36('0x23');return db['UserProfileSection'][_0x4e36('0x46')]({'where':{'name':_0x5767f7,'userProfileId':_0x327577['userProfileId']},'raw':!![]})['then'](function(_0x17dd7d){if(_0x17dd7d&&_0x17dd7d['autoAssociation']===0x0){return db[_0x4e36('0x24')]['create']({'name':_0x4b7f13['name'],'resourceId':_0x4b7f13['id'],'type':_0x17dd7d[_0x4e36('0x27')],'sectionId':_0x17dd7d['id']},{})['then'](function(){return _0x42b33e;});}else{return _0x42b33e;}})[_0x4e36('0x42')](function(_0x51e874){logger[_0x4e36('0x4b')](_0x4e36('0x4c'),_0x51e874);throw _0x51e874;});}return _0x42b33e;})['then'](respondWithResult(_0x4b090b,0xc9))[_0x4e36('0x42')](handleError(_0x4b090b,null));};exports[_0x4e36('0x20')]=function(_0x4bcb69,_0x5fb55c){if(_0x4bcb69['body']['id']){delete _0x4bcb69[_0x4e36('0x4d')]['id'];}return db[_0x4e36('0x3e')]['find']({'where':{'id':_0x4bcb69[_0x4e36('0x44')]['id']}})[_0x4e36('0x21')](handleEntityNotFound(_0x5fb55c,null))[_0x4e36('0x21')](saveUpdates(_0x4bcb69['body'],null))[_0x4e36('0x21')](respondWithResult(_0x5fb55c,null))[_0x4e36('0x42')](handleError(_0x5fb55c,null));};exports[_0x4e36('0x22')]=function(_0x19c0d,_0x21d5be){return db[_0x4e36('0x3e')]['find']({'where':{'id':_0x19c0d[_0x4e36('0x44')]['id']}})[_0x4e36('0x21')](handleEntityNotFound(_0x21d5be,null))[_0x4e36('0x21')](removeEntity(_0x21d5be,null))['catch'](handleError(_0x21d5be,null));}; \ No newline at end of file +var _0x2f3d=['pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','rows','catch','show','params','keys','length','create','body','get','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','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/license/util','../../mysqldb','status','end','json','undefined','limit','offset','apply','reject','save','update','then','destroy','Dispositions','UserProfileResource','sendStatus','stack','name','send','index','Disposition','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort'];(function(_0x1373f3,_0x423359){var _0x51e472=function(_0x1a95a1){while(--_0x1a95a1){_0x1373f3['push'](_0x1373f3['shift']());}};_0x51e472(++_0x423359);}(_0x2f3d,0x1a8));var _0xd2f3=function(_0x4c60af,_0x47f2fc){_0x4c60af=_0x4c60af-0x0;var _0x201282=_0x2f3d[_0x4c60af];return _0x201282;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd2f3('0x0'));var zipdir=require(_0xd2f3('0x1'));var jsonpatch=require(_0xd2f3('0x2'));var rp=require(_0xd2f3('0x3'));var moment=require(_0xd2f3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd2f3('0x5'));var path=require(_0xd2f3('0x6'));var sox=require(_0xd2f3('0x7'));var csv=require('to-csv');var ejs=require(_0xd2f3('0x8'));var fs=require('fs');var fs_extra=require(_0xd2f3('0x9'));var _=require(_0xd2f3('0xa'));var squel=require(_0xd2f3('0xb'));var crypto=require(_0xd2f3('0xc'));var jsforce=require(_0xd2f3('0xd'));var deskjs=require(_0xd2f3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd2f3('0xf'));var Papa=require(_0xd2f3('0x10'));var Redis=require('ioredis');var authService=require(_0xd2f3('0x11'));var qs=require(_0xd2f3('0x12'));var as=require(_0xd2f3('0x13'));var hardwareService=require(_0xd2f3('0x14'));var logger=require(_0xd2f3('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd2f3('0x16'));var db=require(_0xd2f3('0x17'))['db'];function respondWithStatusCode(_0x4d5a9e,_0xa040a7){_0xa040a7=_0xa040a7||0xcc;return function(_0x543005){if(_0x543005){return _0x4d5a9e['sendStatus'](_0xa040a7);}return _0x4d5a9e[_0xd2f3('0x18')](_0xa040a7)[_0xd2f3('0x19')]();};}function respondWithResult(_0x35bf4e,_0x1df3eb){_0x1df3eb=_0x1df3eb||0xc8;return function(_0x280957){if(_0x280957){return _0x35bf4e[_0xd2f3('0x18')](_0x1df3eb)[_0xd2f3('0x1a')](_0x280957);}};}function respondWithFilteredResult(_0xc40245,_0x1332f1){return function(_0x365a35){if(_0x365a35){var _0x228b23=typeof _0x1332f1['offset']===_0xd2f3('0x1b')&&typeof _0x1332f1[_0xd2f3('0x1c')]===_0xd2f3('0x1b');var _0x48a2f3=_0x365a35['count'];var _0x5e8f0a=_0x228b23?0x0:_0x1332f1[_0xd2f3('0x1d')];var _0x5c5dba=_0x228b23?_0x365a35['count']:_0x1332f1[_0xd2f3('0x1d')]+_0x1332f1[_0xd2f3('0x1c')];var _0x469f7a;if(_0x5c5dba>=_0x48a2f3){_0x5c5dba=_0x48a2f3;_0x469f7a=0xc8;}else{_0x469f7a=0xce;}_0xc40245[_0xd2f3('0x18')](_0x469f7a);return _0xc40245['set']('Content-Range',_0x5e8f0a+'-'+_0x5c5dba+'/'+_0x48a2f3)[_0xd2f3('0x1a')](_0x365a35);}return null;};}function patchUpdates(_0x5a2472){return function(_0x1b750b){try{jsonpatch[_0xd2f3('0x1e')](_0x1b750b,_0x5a2472,!![]);}catch(_0x1f0c0a){return BPromise[_0xd2f3('0x1f')](_0x1f0c0a);}return _0x1b750b[_0xd2f3('0x20')]();};}function saveUpdates(_0x4e9f16,_0x26aa11){return function(_0x2ecd65){if(_0x2ecd65){return _0x2ecd65[_0xd2f3('0x21')](_0x4e9f16)[_0xd2f3('0x22')](function(_0x11a657){return _0x11a657;});}return null;};}function removeEntity(_0xc8e9f4,_0x3a7fb7){return function(_0x4f6b8b){if(_0x4f6b8b){return _0x4f6b8b[_0xd2f3('0x23')]()[_0xd2f3('0x22')](function(){var _0x7c97b9=_0x4f6b8b['get']({'plain':!![]});var _0x22c443=_0xd2f3('0x24');return db[_0xd2f3('0x25')]['destroy']({'where':{'type':_0x22c443,'resourceId':_0x7c97b9['id']}})['then'](function(){return _0x4f6b8b;});})['then'](function(){_0xc8e9f4['status'](0xcc)[_0xd2f3('0x19')]();});}};}function handleEntityNotFound(_0x38d00d,_0x529d4a){return function(_0x17beea){if(!_0x17beea){_0x38d00d[_0xd2f3('0x26')](0x194);}return _0x17beea;};}function handleError(_0x12a96f,_0x26bfca){_0x26bfca=_0x26bfca||0x1f4;return function(_0x4b18b0){logger['error'](_0x4b18b0[_0xd2f3('0x27')]);if(_0x4b18b0[_0xd2f3('0x28')]){delete _0x4b18b0[_0xd2f3('0x28')];}_0x12a96f['status'](_0x26bfca)[_0xd2f3('0x29')](_0x4b18b0);};}exports[_0xd2f3('0x2a')]=function(_0x5bee3f,_0xf05788){var _0x1aa264={},_0x515f6c={},_0x2f1522={'count':0x0,'rows':[]};var _0x10ebcd=_['map'](db[_0xd2f3('0x2b')][_0xd2f3('0x2c')],function(_0x5b01d6){return{'name':_0x5b01d6[_0xd2f3('0x2d')],'type':_0x5b01d6['type']['key']};});_0x515f6c[_0xd2f3('0x2e')]=_[_0xd2f3('0x2f')](_0x10ebcd,_0xd2f3('0x28'));_0x515f6c[_0xd2f3('0x30')]=_['keys'](_0x5bee3f[_0xd2f3('0x30')]);_0x515f6c[_0xd2f3('0x31')]=_[_0xd2f3('0x32')](_0x515f6c['model'],_0x515f6c[_0xd2f3('0x30')]);_0x1aa264[_0xd2f3('0x33')]=_[_0xd2f3('0x32')](_0x515f6c['model'],qs[_0xd2f3('0x34')](_0x5bee3f[_0xd2f3('0x30')][_0xd2f3('0x34')]));_0x1aa264[_0xd2f3('0x33')]=_0x1aa264['attributes']['length']?_0x1aa264[_0xd2f3('0x33')]:_0x515f6c[_0xd2f3('0x2e')];if(!_0x5bee3f[_0xd2f3('0x30')][_0xd2f3('0x35')]('nolimit')){_0x1aa264['limit']=qs['limit'](_0x5bee3f[_0xd2f3('0x30')][_0xd2f3('0x1c')]);_0x1aa264[_0xd2f3('0x1d')]=qs['offset'](_0x5bee3f[_0xd2f3('0x30')][_0xd2f3('0x1d')]);}_0x1aa264[_0xd2f3('0x36')]=qs[_0xd2f3('0x37')](_0x5bee3f[_0xd2f3('0x30')][_0xd2f3('0x37')]);_0x1aa264['where']=qs[_0xd2f3('0x31')](_[_0xd2f3('0x38')](_0x5bee3f['query'],_0x515f6c[_0xd2f3('0x31')]),_0x10ebcd);if(_0x5bee3f[_0xd2f3('0x30')]['filter']){_0x1aa264[_0xd2f3('0x39')]=_[_0xd2f3('0x3a')](_0x1aa264[_0xd2f3('0x39')],{'$or':_[_0xd2f3('0x2f')](_0x10ebcd,function(_0x2b218c){if(_0x2b218c['type']!==_0xd2f3('0x3b')){var _0x287ee9={};_0x287ee9[_0x2b218c[_0xd2f3('0x28')]]={'$like':'%'+_0x5bee3f['query'][_0xd2f3('0x3c')]+'%'};return _0x287ee9;}})});}_0x1aa264=_[_0xd2f3('0x3a')]({},_0x1aa264,_0x5bee3f[_0xd2f3('0x3d')]);var _0x16613c={'where':_0x1aa264['where']};return db[_0xd2f3('0x2b')][_0xd2f3('0x3e')](_0x16613c)[_0xd2f3('0x22')](function(_0xf3ff63){_0x2f1522[_0xd2f3('0x3e')]=_0xf3ff63;if(_0x5bee3f[_0xd2f3('0x30')][_0xd2f3('0x3f')]){_0x1aa264[_0xd2f3('0x40')]=[{'all':!![]}];}return db[_0xd2f3('0x2b')]['findAll'](_0x1aa264);})['then'](function(_0x2f604e){_0x2f1522[_0xd2f3('0x41')]=_0x2f604e;return _0x2f1522;})[_0xd2f3('0x22')](respondWithFilteredResult(_0xf05788,_0x1aa264))[_0xd2f3('0x42')](handleError(_0xf05788,null));};exports[_0xd2f3('0x43')]=function(_0xb79756,_0x59bea7){var _0x5801b0={'raw':!![],'where':{'id':_0xb79756[_0xd2f3('0x44')]['id']}},_0x101d2c={};_0x101d2c['model']=_[_0xd2f3('0x45')](db['Disposition'][_0xd2f3('0x2c')]);_0x101d2c[_0xd2f3('0x30')]=_[_0xd2f3('0x45')](_0xb79756[_0xd2f3('0x30')]);_0x101d2c[_0xd2f3('0x31')]=_[_0xd2f3('0x32')](_0x101d2c['model'],_0x101d2c[_0xd2f3('0x30')]);_0x5801b0['attributes']=_[_0xd2f3('0x32')](_0x101d2c['model'],qs[_0xd2f3('0x34')](_0xb79756[_0xd2f3('0x30')][_0xd2f3('0x34')]));_0x5801b0[_0xd2f3('0x33')]=_0x5801b0[_0xd2f3('0x33')][_0xd2f3('0x46')]?_0x5801b0[_0xd2f3('0x33')]:_0x101d2c[_0xd2f3('0x2e')];if(_0xb79756[_0xd2f3('0x30')][_0xd2f3('0x3f')]){_0x5801b0['include']=[{'all':!![]}];}_0x5801b0=_[_0xd2f3('0x3a')]({},_0x5801b0,_0xb79756[_0xd2f3('0x3d')]);return db[_0xd2f3('0x2b')]['find'](_0x5801b0)[_0xd2f3('0x22')](handleEntityNotFound(_0x59bea7,null))['then'](respondWithResult(_0x59bea7,null))['catch'](handleError(_0x59bea7,null));};exports[_0xd2f3('0x47')]=function(_0xcfc0b5,_0x23d72f){return db[_0xd2f3('0x2b')][_0xd2f3('0x47')](_0xcfc0b5[_0xd2f3('0x48')],{})[_0xd2f3('0x22')](function(_0x12ca97){var _0x5cc0db=_0xcfc0b5['user'][_0xd2f3('0x49')]({'plain':!![]});if(!_0x5cc0db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cc0db[_0xd2f3('0x4a')]===_0xd2f3('0x4b')){var _0x3f5718=_0x12ca97['get']({'plain':!![]});var _0x99b8d='Dispositions';return db[_0xd2f3('0x4c')]['find']({'where':{'name':_0x99b8d,'userProfileId':_0x5cc0db['userProfileId']},'raw':!![]})['then'](function(_0x1c1d81){if(_0x1c1d81&&_0x1c1d81[_0xd2f3('0x4d')]===0x0){return db[_0xd2f3('0x25')][_0xd2f3('0x47')]({'name':_0x3f5718[_0xd2f3('0x28')],'resourceId':_0x3f5718['id'],'type':_0x1c1d81[_0xd2f3('0x28')],'sectionId':_0x1c1d81['id']},{})[_0xd2f3('0x22')](function(){return _0x12ca97;});}else{return _0x12ca97;}})[_0xd2f3('0x42')](function(_0x3f48e9){logger['error'](_0xd2f3('0x4e'),_0x3f48e9);throw _0x3f48e9;});}return _0x12ca97;})[_0xd2f3('0x22')](respondWithResult(_0x23d72f,0xc9))[_0xd2f3('0x42')](handleError(_0x23d72f,null));};exports[_0xd2f3('0x21')]=function(_0x54c9df,_0x5a5b82){if(_0x54c9df['body']['id']){delete _0x54c9df['body']['id'];}return db[_0xd2f3('0x2b')][_0xd2f3('0x4f')]({'where':{'id':_0x54c9df[_0xd2f3('0x44')]['id']}})[_0xd2f3('0x22')](handleEntityNotFound(_0x5a5b82,null))[_0xd2f3('0x22')](saveUpdates(_0x54c9df[_0xd2f3('0x48')],null))[_0xd2f3('0x22')](respondWithResult(_0x5a5b82,null))[_0xd2f3('0x42')](handleError(_0x5a5b82,null));};exports[_0xd2f3('0x23')]=function(_0x23dbca,_0x5cb682){return db[_0xd2f3('0x2b')][_0xd2f3('0x4f')]({'where':{'id':_0x23dbca['params']['id']}})[_0xd2f3('0x22')](handleEntityNotFound(_0x5cb682,null))[_0xd2f3('0x22')](removeEntity(_0x5cb682,null))[_0xd2f3('0x42')](handleError(_0x5cb682,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index ed221af..19bc167 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 _0xf715=['api','moment','bluebird','request-promise','path','rimraf','exports','Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf715,0xc5));var _0x5f71=function(_0x99d596,_0x31a253){_0x99d596=_0x99d596-0x0;var _0x274f6b=_0xf715[_0x99d596];return _0x274f6b;};'use strict';var _=require(_0x5f71('0x0'));var util=require(_0x5f71('0x1'));var logger=require(_0x5f71('0x2'))(_0x5f71('0x3'));var moment=require(_0x5f71('0x4'));var BPromise=require(_0x5f71('0x5'));var rp=require(_0x5f71('0x6'));var fs=require('fs');var path=require(_0x5f71('0x7'));var rimraf=require(_0x5f71('0x8'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x5f71('0x9')]=function(_0x120cdb,_0x50d3e6){return _0x120cdb['define'](_0x5f71('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x5f71('0xb'),'fields':[_0x5f71('0xc'),_0x5f71('0xd')]},{'unique':!![],'name':_0x5f71('0xe'),'fields':[_0x5f71('0xc'),_0x5f71('0xf')]},{'unique':!![],'name':_0x5f71('0x10'),'fields':['name',_0x5f71('0x11')]},{'unique':!![],'name':_0x5f71('0x12'),'fields':[_0x5f71('0xc'),_0x5f71('0x13')]},{'unique':!![],'name':'name_fax','fields':[_0x5f71('0xc'),_0x5f71('0x14')]},{'unique':!![],'name':_0x5f71('0x15'),'fields':['name',_0x5f71('0x16')]},{'unique':!![],'name':_0x5f71('0x17'),'fields':[_0x5f71('0xc'),_0x5f71('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x58b0=['tools_dispositions','name_voice','ListId','name_chat','name','ChatWebsiteId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x58b0,0x1c7));var _0x058b=function(_0x1e5a59,_0x22d345){_0x1e5a59=_0x1e5a59-0x0;var _0x4ca834=_0x58b0[_0x1e5a59];return _0x4ca834;};'use strict';var _=require(_0x058b('0x0'));var util=require(_0x058b('0x1'));var logger=require(_0x058b('0x2'))(_0x058b('0x3'));var moment=require(_0x058b('0x4'));var BPromise=require('bluebird');var rp=require(_0x058b('0x5'));var fs=require('fs');var path=require(_0x058b('0x6'));var rimraf=require(_0x058b('0x7'));var config=require(_0x058b('0x8'));var attributes=require(_0x058b('0x9'));module[_0x058b('0xa')]=function(_0x1a05bd,_0x1bd925){return _0x1a05bd[_0x058b('0xb')](_0x058b('0xc'),attributes,{'tableName':_0x058b('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x058b('0xe'),'fields':['name',_0x058b('0xf')]},{'unique':!![],'name':_0x058b('0x10'),'fields':[_0x058b('0x11'),_0x058b('0x12')]},{'unique':!![],'name':'name_mail','fields':[_0x058b('0x11'),'MailAccountId']},{'unique':!![],'name':_0x058b('0x13'),'fields':[_0x058b('0x11'),_0x058b('0x14')]},{'unique':!![],'name':_0x058b('0x15'),'fields':[_0x058b('0x11'),_0x058b('0x16')]},{'unique':!![],'name':_0x058b('0x17'),'fields':[_0x058b('0x11'),'OpenchannelAccountId']},{'unique':!![],'name':_0x058b('0x18'),'fields':[_0x058b('0x11'),_0x058b('0x19')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 9d7e1d5..e95a75b 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(_0x23dc21,_0x17ab2e){var _0x390219=function(_0x4236e3){while(--_0x4236e3){_0x23dc21['push'](_0x23dc21['shift']());}};_0x390219(++_0x17ab2e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x445a24,_0x495d4f){var _0x384d9d=function(_0x4be351){while(--_0x4be351){_0x445a24['push'](_0x445a24['shift']());}};_0x384d9d(++_0x495d4f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 ded92b4..8a1e5b8 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 _0xa24e=['multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0x20d93c,_0x39f389){var _0x8df8df=function(_0x43ccd4){while(--_0x43ccd4){_0x20d93c['push'](_0x20d93c['shift']());}};_0x8df8df(++_0x39f389);}(_0xa24e,0x7e));var _0xea24=function(_0x2ac32b,_0x134b81){_0x2ac32b=_0x2ac32b-0x0;var _0x298c2e=_0xa24e[_0x2ac32b];return _0x298c2e;};'use strict';var multer=require(_0xea24('0x0'));var util=require('util');var path=require(_0xea24('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xea24('0x2')]();var fs_extra=require(_0xea24('0x3'));var auth=require(_0xea24('0x4'));var interaction=require(_0xea24('0x5'));var config=require(_0xea24('0x6'));var controller=require(_0xea24('0x7'));router[_0xea24('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xea24('0x8')](_0xea24('0x9'),auth[_0xea24('0xa')](),controller[_0xea24('0xb')]);router[_0xea24('0xc')]('/',auth[_0xea24('0xa')](),controller[_0xea24('0xd')]);router[_0xea24('0xe')](_0xea24('0x9'),auth[_0xea24('0xa')](),controller[_0xea24('0xf')]);router[_0xea24('0x10')](_0xea24('0x9'),auth[_0xea24('0xa')](),controller[_0xea24('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc9c5=['post','create','put','update','delete','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','index','get','isAuthenticated','show'];(function(_0x50c8bc,_0x1d0748){var _0x393260=function(_0x3d3606){while(--_0x3d3606){_0x50c8bc['push'](_0x50c8bc['shift']());}};_0x393260(++_0x1d0748);}(_0xc9c5,0x193));var _0x5c9c=function(_0x559702,_0x2fa1a9){_0x559702=_0x559702-0x0;var _0x25a86b=_0xc9c5[_0x559702];return _0x25a86b;};'use strict';var multer=require(_0x5c9c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5c9c('0x1'));var router=express[_0x5c9c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5c9c('0x3'));var interaction=require(_0x5c9c('0x4'));var config=require(_0x5c9c('0x5'));var controller=require(_0x5c9c('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x5c9c('0x7')]);router[_0x5c9c('0x8')]('/:id',auth[_0x5c9c('0x9')](),controller[_0x5c9c('0xa')]);router[_0x5c9c('0xb')]('/',auth[_0x5c9c('0x9')](),controller[_0x5c9c('0xc')]);router[_0x5c9c('0xd')]('/:id',auth[_0x5c9c('0x9')](),controller[_0x5c9c('0xe')]);router[_0x5c9c('0xf')]('/:id',auth[_0x5c9c('0x9')](),controller[_0x5c9c('0x10')]);module[_0x5c9c('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 0c49635..d63919c 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 _0x8ef7=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','4800','9600','14400','2400','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x43f489,_0x2b4fea){var _0x4134b4=function(_0x4365f6){while(--_0x4365f6){_0x43f489['push'](_0x43f489['shift']());}};_0x4134b4(++_0x2b4fea);}(_0x8ef7,0xa4));var _0x78ef=function(_0x3de5e5,_0x3d3665){_0x3de5e5=_0x3de5e5-0x0;var _0x1c6f10=_0x8ef7[_0x3de5e5];return _0x1c6f10;};'use strict';var Sequelize=require('sequelize');module[_0x78ef('0x0')]={'name':{'type':Sequelize[_0x78ef('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x78ef('0x2')]('yes','no'),'defaultValue':_0x78ef('0x3')},'headerinfo':{'type':Sequelize[_0x78ef('0x1')],'defaultValue':_0x78ef('0x4')},'localstationid':{'type':Sequelize[_0x78ef('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM']('2400',_0x78ef('0x5'),'7200',_0x78ef('0x6'),'12000',_0x78ef('0x7')),'defaultValue':_0x78ef('0x5')},'maxrate':{'type':Sequelize['ENUM'](_0x78ef('0x8'),'4800','7200','9600',_0x78ef('0x9'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x78ef('0x1')],'defaultValue':_0x78ef('0xa')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x78ef('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x78ef('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x78ef('0x2')](_0x78ef('0xc'),_0x78ef('0xd'),_0x78ef('0xe'),_0x78ef('0xf')),'defaultValue':_0x78ef('0xc')},'key':{'type':Sequelize[_0x78ef('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x78ef('0x10')],'defaultValue':function(){return _0x78ef('0x11');}},'notificationSound':{'type':Sequelize[_0x78ef('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x78ef('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x78ef('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x78ef('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x78ef('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x78ef('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x78ef('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2323fc){if(!_0x2323fc)this[_0x78ef('0x14')](_0x78ef('0x15'),null);this[_0x78ef('0x14')](_0x78ef('0x16'),_0x2323fc);}}}; \ No newline at end of file +var _0x3d44=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','14400','v17,v27,v29','INTEGER','SIP','IAX','KHOMP','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x41c5bf,_0x12697d){var _0x149644=function(_0x4a9ded){while(--_0x4a9ded){_0x41c5bf['push'](_0x41c5bf['shift']());}};_0x149644(++_0x12697d);}(_0x3d44,0xff));var _0x43d4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3d44[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x43d4('0x0'));module[_0x43d4('0x1')]={'name':{'type':Sequelize[_0x43d4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x43d4('0x2')]},'ecm':{'type':Sequelize[_0x43d4('0x3')](_0x43d4('0x4'),'no'),'defaultValue':_0x43d4('0x4')},'headerinfo':{'type':Sequelize[_0x43d4('0x2')],'defaultValue':_0x43d4('0x5')},'localstationid':{'type':Sequelize[_0x43d4('0x2')],'unique':_0x43d4('0x6')},'minrate':{'type':Sequelize[_0x43d4('0x3')](_0x43d4('0x7'),_0x43d4('0x8'),_0x43d4('0x9'),'9600','12000','14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x43d4('0x3')]('2400','4800',_0x43d4('0x9'),_0x43d4('0xa'),'12000',_0x43d4('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x43d4('0x2')],'defaultValue':_0x43d4('0xc')},'gateway':{'type':Sequelize[_0x43d4('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x43d4('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x43d4('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x43d4('0x3')](_0x43d4('0xe'),_0x43d4('0xf'),'DADHI',_0x43d4('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x43d4('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[_0x43d4('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x43d4('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x43d4('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x43d4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x43d4('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x43d4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x43d4('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x43d4('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x43d4('0x11')],'defaultValue':![],'comment':_0x43d4('0x13'),'set':function(_0x50eece){if(!_0x50eece)this[_0x43d4('0x14')](_0x43d4('0x15'),null);this['setDataValue'](_0x43d4('0x16'),_0x50eece);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 7f4eb8a..352db3f 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 _0xafe0=['attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','mandatoryDispositionPause','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','FaxAccountId','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','VoiceExtension','updateAccountApplications','tech','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','defaults','List\x20not\x20found','filename','Messages','Contact\x20not\x20found','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','result','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','get','FaxAccounts','end','stack','name','send','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','fields','query'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xafe0,0x7b));var _0x0afe=function(_0x133e8d,_0x4648f1){_0x133e8d=_0x133e8d-0x0;var _0x10ce55=_0xafe0[_0x133e8d];return _0x10ce55;};'use strict';var emlformat=require(_0x0afe('0x0'));var rimraf=require(_0x0afe('0x1'));var zipdir=require(_0x0afe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0afe('0x3'));var moment=require(_0x0afe('0x4'));var BPromise=require(_0x0afe('0x5'));var Mustache=require('mustache');var util=require(_0x0afe('0x6'));var path=require(_0x0afe('0x7'));var sox=require(_0x0afe('0x8'));var csv=require(_0x0afe('0x9'));var ejs=require(_0x0afe('0xa'));var fs=require('fs');var fs_extra=require(_0x0afe('0xb'));var _=require(_0x0afe('0xc'));var squel=require(_0x0afe('0xd'));var crypto=require(_0x0afe('0xe'));var jsforce=require(_0x0afe('0xf'));var deskjs=require(_0x0afe('0x10'));var toCsv=require(_0x0afe('0x9'));var querystring=require(_0x0afe('0x11'));var Papa=require(_0x0afe('0x12'));var Redis=require(_0x0afe('0x13'));var authService=require(_0x0afe('0x14'));var qs=require(_0x0afe('0x15'));var as=require(_0x0afe('0x16'));var hardwareService=require(_0x0afe('0x17'));var logger=require('../../config/logger')(_0x0afe('0x18'));var utils=require(_0x0afe('0x19'));var config=require(_0x0afe('0x1a'));var licenseUtil=require(_0x0afe('0x1b'));var db=require('../../mysqldb')['db'];config[_0x0afe('0x1c')]=_['defaults'](config[_0x0afe('0x1c')],{'host':_0x0afe('0x1d'),'port':0x18eb});var socket=require(_0x0afe('0x1e'))(new Redis(config[_0x0afe('0x1c')]));require('./faxAccount.socket')[_0x0afe('0x1f')](socket);var jayson=require(_0x0afe('0x20'));var client=jayson[_0x0afe('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x0afe('0x21')][_0x0afe('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x1c43f9,_0x1ff928,_0x16b2bc,_0x8d09be){return new BPromise(function(_0x151374,_0x57f236){var _0x132df5=_0x8d09be||client;return _0x132df5[_0x0afe('0x23')](_0x1c43f9,_0x16b2bc)[_0x0afe('0x24')](function(_0x464438){logger[_0x0afe('0x25')]('FaxAccount,\x20%s,\x20%s',_0x1ff928,_0x0afe('0x26'));logger[_0x0afe('0x27')](_0x0afe('0x28'),_0x1ff928,_0x0afe('0x26'),JSON[_0x0afe('0x29')](_0x464438));if(_0x464438['error']){if(_0x464438[_0x0afe('0x2a')][_0x0afe('0x2b')]===0x1f4){logger[_0x0afe('0x2a')](_0x0afe('0x2c'),_0x1ff928,_0x464438[_0x0afe('0x2a')]['message']);return _0x57f236(_0x464438[_0x0afe('0x2a')]['message']);}logger[_0x0afe('0x2a')](_0x0afe('0x2c'),_0x1ff928,_0x464438['error']['message']);return _0x151374(_0x464438[_0x0afe('0x2a')]['message']);}else{logger['info'](_0x0afe('0x2c'),_0x1ff928,_0x0afe('0x26'));_0x151374(_0x464438[_0x0afe('0x2d')][_0x0afe('0x2e')]);}})[_0x0afe('0x2f')](function(_0x41c6a6){logger[_0x0afe('0x2a')](_0x0afe('0x2c'),_0x1ff928,_0x41c6a6);_0x57f236(_0x41c6a6);});});}function respondWithStatusCode(_0x1ff6b6,_0x51446b){_0x51446b=_0x51446b||0xcc;return function(_0x203a03){if(_0x203a03){return _0x1ff6b6[_0x0afe('0x30')](_0x51446b);}return _0x1ff6b6['status'](_0x51446b)['end']();};}function respondWithResult(_0xae2a2f,_0x5371fc){_0x5371fc=_0x5371fc||0xc8;return function(_0x296285){if(_0x296285){return _0xae2a2f[_0x0afe('0x31')](_0x5371fc)[_0x0afe('0x32')](_0x296285);}};}function respondWithFilteredResult(_0x151efa,_0x267b75){return function(_0x248207){if(_0x248207){var _0x5b49e2=typeof _0x267b75[_0x0afe('0x33')]===_0x0afe('0x34')&&typeof _0x267b75[_0x0afe('0x35')]==='undefined';var _0x338081=_0x248207[_0x0afe('0x36')];var _0x4f6705=_0x5b49e2?0x0:_0x267b75[_0x0afe('0x33')];var _0x181d0b=_0x5b49e2?_0x248207[_0x0afe('0x36')]:_0x267b75[_0x0afe('0x33')]+_0x267b75[_0x0afe('0x35')];var _0x44db89;if(_0x181d0b>=_0x338081){_0x181d0b=_0x338081;_0x44db89=0xc8;}else{_0x44db89=0xce;}_0x151efa['status'](_0x44db89);return _0x151efa[_0x0afe('0x37')]('Content-Range',_0x4f6705+'-'+_0x181d0b+'/'+_0x338081)[_0x0afe('0x32')](_0x248207);}return null;};}function patchUpdates(_0x9e7332){return function(_0x4948dc){try{jsonpatch[_0x0afe('0x38')](_0x4948dc,_0x9e7332,!![]);}catch(_0x3d5308){return BPromise[_0x0afe('0x39')](_0x3d5308);}return _0x4948dc['save']();};}function saveUpdates(_0x267566,_0x4e1873){return function(_0x3ca3f9){if(_0x3ca3f9){return _0x3ca3f9[_0x0afe('0x3a')](_0x267566)[_0x0afe('0x24')](function(_0x4c98cb){return _0x4c98cb;});}return null;};}function removeEntity(_0x10cd5f,_0x510a6f){return function(_0x5c32bf){if(_0x5c32bf){return _0x5c32bf[_0x0afe('0x3b')]()[_0x0afe('0x24')](function(){var _0x499fd4=_0x5c32bf[_0x0afe('0x3c')]({'plain':!![]});var _0x28f12b=_0x0afe('0x3d');return db['UserProfileResource'][_0x0afe('0x3b')]({'where':{'type':_0x28f12b,'resourceId':_0x499fd4['id']}})[_0x0afe('0x24')](function(){return _0x5c32bf;});})[_0x0afe('0x24')](function(){_0x10cd5f['status'](0xcc)[_0x0afe('0x3e')]();});}};}function handleEntityNotFound(_0xfd856b,_0x5a7baf){return function(_0x3724fd){if(!_0x3724fd){_0xfd856b['sendStatus'](0x194);}return _0x3724fd;};}function handleError(_0x24aa89,_0x174bba){_0x174bba=_0x174bba||0x1f4;return function(_0x19b5bc){logger[_0x0afe('0x2a')](_0x19b5bc[_0x0afe('0x3f')]);if(_0x19b5bc[_0x0afe('0x40')]){delete _0x19b5bc[_0x0afe('0x40')];}_0x24aa89[_0x0afe('0x31')](_0x174bba)[_0x0afe('0x41')](_0x19b5bc);};}exports['index']=function(_0x3a5d7,_0xcc991b){var _0x5a39dc={'include':[{'model':db[_0x0afe('0x42')],'as':'mandatoryDispositionPause'}]},_0x3a0514={},_0x51e6d7={'count':0x0,'rows':[]};var _0x8de65=_[_0x0afe('0x43')](db[_0x0afe('0x44')][_0x0afe('0x45')],function(_0x86cf71){return{'name':_0x86cf71[_0x0afe('0x46')],'type':_0x86cf71[_0x0afe('0x47')][_0x0afe('0x48')]};});_0x3a0514[_0x0afe('0x49')]=_[_0x0afe('0x43')](_0x8de65,_0x0afe('0x40'));_0x3a0514['query']=_[_0x0afe('0x4a')](_0x3a5d7['query']);_0x3a0514[_0x0afe('0x4b')]=_['intersection'](_0x3a0514[_0x0afe('0x49')],_0x3a0514['query']);_0x5a39dc['attributes']=_[_0x0afe('0x4c')](_0x3a0514['model'],qs[_0x0afe('0x4d')](_0x3a5d7[_0x0afe('0x4e')][_0x0afe('0x4d')]));_0x5a39dc['attributes']=_0x5a39dc[_0x0afe('0x4f')]['length']?_0x5a39dc['attributes']:_0x3a0514[_0x0afe('0x49')];if(!_0x3a5d7[_0x0afe('0x4e')][_0x0afe('0x50')](_0x0afe('0x51'))){_0x5a39dc[_0x0afe('0x35')]=qs[_0x0afe('0x35')](_0x3a5d7[_0x0afe('0x4e')][_0x0afe('0x35')]);_0x5a39dc[_0x0afe('0x33')]=qs['offset'](_0x3a5d7[_0x0afe('0x4e')][_0x0afe('0x33')]);}_0x5a39dc[_0x0afe('0x52')]=qs[_0x0afe('0x53')](_0x3a5d7[_0x0afe('0x4e')][_0x0afe('0x53')]);_0x5a39dc[_0x0afe('0x54')]=qs[_0x0afe('0x4b')](_[_0x0afe('0x55')](_0x3a5d7[_0x0afe('0x4e')],_0x3a0514[_0x0afe('0x4b')]),_0x8de65);if(_0x3a5d7[_0x0afe('0x4e')]['filter']){_0x5a39dc[_0x0afe('0x54')]=_[_0x0afe('0x56')](_0x5a39dc[_0x0afe('0x54')],{'$or':_[_0x0afe('0x43')](_0x8de65,function(_0x3957a3){if(_0x3957a3[_0x0afe('0x47')]!==_0x0afe('0x57')){var _0x14f30d={};_0x14f30d[_0x3957a3['name']]={'$like':'%'+_0x3a5d7[_0x0afe('0x4e')][_0x0afe('0x58')]+'%'};return _0x14f30d;}})});}_0x5a39dc=_[_0x0afe('0x56')]({},_0x5a39dc,_0x3a5d7[_0x0afe('0x59')]);var _0x2bd9e2={'where':_0x5a39dc['where']};return db[_0x0afe('0x44')][_0x0afe('0x36')](_0x2bd9e2)[_0x0afe('0x24')](function(_0x4300ea){_0x51e6d7['count']=_0x4300ea;if(_0x3a5d7[_0x0afe('0x4e')][_0x0afe('0x5a')]){_0x5a39dc[_0x0afe('0x5b')]=[{'all':!![]}];}return db[_0x0afe('0x44')]['findAll'](_0x5a39dc);})[_0x0afe('0x24')](function(_0x40d85d){_0x51e6d7[_0x0afe('0x5c')]=_0x40d85d;return _0x51e6d7;})[_0x0afe('0x24')](respondWithFilteredResult(_0xcc991b,_0x5a39dc))['catch'](handleError(_0xcc991b,null));};exports[_0x0afe('0x5d')]=function(_0x48b6e2,_0x42a305){var _0x4ae7c5={'raw':![],'where':{'id':_0x48b6e2[_0x0afe('0x5e')]['id']},'include':[{'model':db['Pause'],'as':_0x0afe('0x5f')}]},_0x2da340={};_0x2da340['model']=_['keys'](db[_0x0afe('0x44')][_0x0afe('0x45')]);_0x2da340[_0x0afe('0x4e')]=_['keys'](_0x48b6e2[_0x0afe('0x4e')]);_0x2da340[_0x0afe('0x4b')]=_[_0x0afe('0x4c')](_0x2da340[_0x0afe('0x49')],_0x2da340[_0x0afe('0x4e')]);_0x4ae7c5[_0x0afe('0x4f')]=_[_0x0afe('0x4c')](_0x2da340[_0x0afe('0x49')],qs[_0x0afe('0x4d')](_0x48b6e2[_0x0afe('0x4e')]['fields']));_0x4ae7c5['attributes']=_0x4ae7c5[_0x0afe('0x4f')][_0x0afe('0x60')]?_0x4ae7c5[_0x0afe('0x4f')]:_0x2da340[_0x0afe('0x49')];if(_0x48b6e2[_0x0afe('0x4e')][_0x0afe('0x5a')]){_0x4ae7c5[_0x0afe('0x5b')]=[{'all':!![]}];}_0x4ae7c5=_[_0x0afe('0x56')]({},_0x4ae7c5,_0x48b6e2[_0x0afe('0x59')]);return db[_0x0afe('0x44')][_0x0afe('0x61')](_0x4ae7c5)[_0x0afe('0x24')](handleEntityNotFound(_0x42a305,null))[_0x0afe('0x24')](respondWithResult(_0x42a305,null))[_0x0afe('0x2f')](handleError(_0x42a305,null));};exports['create']=function(_0x5c749e,_0x5b238f){return db[_0x0afe('0x44')][_0x0afe('0x62')](_0x5c749e['body'],{})[_0x0afe('0x24')](function(_0x328f29){var _0xb25f09=_0x5c749e[_0x0afe('0x63')][_0x0afe('0x3c')]({'plain':!![]});if(!_0xb25f09)throw new Error(_0x0afe('0x64'));if(_0xb25f09['role']===_0x0afe('0x63')){var _0x39fe9f=_0x328f29[_0x0afe('0x3c')]({'plain':!![]});var _0x159b3e='FaxAccounts';return db[_0x0afe('0x65')][_0x0afe('0x61')]({'where':{'name':_0x159b3e,'userProfileId':_0xb25f09[_0x0afe('0x66')]},'raw':!![]})[_0x0afe('0x24')](function(_0x1100f6){if(_0x1100f6&&_0x1100f6[_0x0afe('0x67')]===0x0){return db[_0x0afe('0x68')][_0x0afe('0x62')]({'name':_0x39fe9f['name'],'resourceId':_0x39fe9f['id'],'type':_0x1100f6[_0x0afe('0x40')],'sectionId':_0x1100f6['id']},{})[_0x0afe('0x24')](function(){return _0x328f29;});}else{return _0x328f29;}})['catch'](function(_0x75c5b1){logger['error'](_0x0afe('0x69'),_0x75c5b1);throw _0x75c5b1;});}return _0x328f29;})[_0x0afe('0x24')](respondWithResult(_0x5b238f,0xc9))['catch'](handleError(_0x5b238f,null));};exports['update']=function(_0x3db50f,_0x313364){if(_0x3db50f[_0x0afe('0x6a')]['id']){delete _0x3db50f[_0x0afe('0x6a')]['id'];}return db[_0x0afe('0x44')][_0x0afe('0x61')]({'where':{'id':_0x3db50f[_0x0afe('0x5e')]['id']},'include':[{'model':db[_0x0afe('0x42')],'as':_0x0afe('0x5f')}]})[_0x0afe('0x24')](handleEntityNotFound(_0x313364,null))[_0x0afe('0x24')](saveUpdates(_0x3db50f[_0x0afe('0x6a')],null))[_0x0afe('0x24')](respondWithResult(_0x313364,null))[_0x0afe('0x2f')](handleError(_0x313364,null));};exports[_0x0afe('0x3b')]=function(_0x1976f6,_0x1ed69d){return db[_0x0afe('0x44')][_0x0afe('0x61')]({'where':{'id':_0x1976f6[_0x0afe('0x5e')]['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0x1ed69d,null))[_0x0afe('0x24')](removeEntity(_0x1ed69d,null))[_0x0afe('0x2f')](handleError(_0x1ed69d,null));};exports[_0x0afe('0x6b')]=function(_0x3bdcf3,_0x30bb36){return db[_0x0afe('0x44')][_0x0afe('0x6b')]()[_0x0afe('0x24')](respondWithResult(_0x30bb36,null))[_0x0afe('0x2f')](handleError(_0x30bb36,null));};exports[_0x0afe('0x6c')]=function(_0x403427,_0x4e7b5d,_0x291139){if(_0x403427[_0x0afe('0x6a')]['id']){delete _0x403427[_0x0afe('0x6a')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x403427[_0x0afe('0x5e')]['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0x4e7b5d,null))[_0x0afe('0x24')](function(_0x46350c){if(_0x46350c){_0x403427[_0x0afe('0x6a')]['FaxAccountId']=_0x46350c['id'];return db[_0x0afe('0x6d')][_0x0afe('0x62')](_0x403427[_0x0afe('0x6a')]);}})[_0x0afe('0x24')](respondWithResult(_0x4e7b5d,null))[_0x0afe('0x2f')](handleError(_0x4e7b5d,null));};exports[_0x0afe('0x6e')]=function(_0x11c3de,_0x45daa8,_0x567684){var _0x2aa440={'raw':![],'where':{}};var _0x2b9db3={};var _0x10bedd={'count':0x0,'rows':[]};return db[_0x0afe('0x44')]['findOne']({'where':{'id':_0x11c3de[_0x0afe('0x5e')]['id']}})['then'](handleEntityNotFound(_0x45daa8,null))[_0x0afe('0x24')](function(_0xdc29ba){if(_0xdc29ba){_0x2b9db3[_0x0afe('0x49')]=_['keys'](db[_0x0afe('0x6d')][_0x0afe('0x45')]);_0x2b9db3[_0x0afe('0x4e')]=_[_0x0afe('0x4a')](_0x11c3de[_0x0afe('0x4e')]);_0x2b9db3[_0x0afe('0x4b')]=_['intersection'](_0x2b9db3[_0x0afe('0x49')],_0x2b9db3['query']);_0x2aa440[_0x0afe('0x4f')]=_[_0x0afe('0x4c')](_0x2b9db3[_0x0afe('0x49')],qs[_0x0afe('0x4d')](_0x11c3de['query'][_0x0afe('0x4d')]));_0x2aa440['attributes']=_0x2aa440[_0x0afe('0x4f')][_0x0afe('0x60')]?_0x2aa440[_0x0afe('0x4f')]:_0x2b9db3[_0x0afe('0x49')];if(!_0x11c3de[_0x0afe('0x4e')][_0x0afe('0x50')](_0x0afe('0x51'))){_0x2aa440[_0x0afe('0x35')]=qs[_0x0afe('0x35')](_0x11c3de[_0x0afe('0x4e')][_0x0afe('0x35')]);_0x2aa440[_0x0afe('0x33')]=qs[_0x0afe('0x33')](_0x11c3de[_0x0afe('0x4e')]['offset']);}_0x2aa440[_0x0afe('0x52')]=qs['sort'](_0x11c3de[_0x0afe('0x4e')][_0x0afe('0x53')]);_0x2aa440[_0x0afe('0x54')]=qs[_0x0afe('0x4b')](_[_0x0afe('0x55')](_0x11c3de['query'],_0x2b9db3[_0x0afe('0x4b')]));_0x2aa440['where'][_0x0afe('0x6f')]=_0xdc29ba['id'];if(_0x11c3de[_0x0afe('0x4e')]['filter']){_0x2aa440[_0x0afe('0x54')]=_[_0x0afe('0x56')](_0x2aa440['where'],{'$or':_[_0x0afe('0x43')](_0x2aa440[_0x0afe('0x4f')],function(_0xeea105){var _0x2715e5={};_0x2715e5[_0xeea105]={'$like':'%'+_0x11c3de[_0x0afe('0x4e')][_0x0afe('0x58')]+'%'};return _0x2715e5;})});}_0x2aa440=_[_0x0afe('0x56')]({},_0x2aa440,_0x11c3de[_0x0afe('0x59')]);return db[_0x0afe('0x6d')][_0x0afe('0x36')]({'where':_0x2aa440['where']})['then'](function(_0x560c55){_0x10bedd['count']=_0x560c55;if(_0x11c3de[_0x0afe('0x4e')][_0x0afe('0x5a')]){_0x2aa440[_0x0afe('0x5b')]=[{'all':!![]}];}return db[_0x0afe('0x6d')][_0x0afe('0x70')](_0x2aa440);})[_0x0afe('0x24')](function(_0x12f2f9){_0x10bedd[_0x0afe('0x5c')]=_0x12f2f9;return _0x10bedd;});}})[_0x0afe('0x24')](respondWithFilteredResult(_0x45daa8,_0x2aa440))[_0x0afe('0x2f')](handleError(_0x45daa8,null));};exports[_0x0afe('0x71')]=function(_0x515210,_0x145c14,_0x217169){return db[_0x0afe('0x44')][_0x0afe('0x61')]({'where':{'id':_0x515210[_0x0afe('0x5e')]['id']}})['then'](handleEntityNotFound(_0x145c14,null))[_0x0afe('0x24')](function(_0x233750){if(_0x233750){return _0x233750[_0x0afe('0x71')](_0x515210[_0x0afe('0x4e')][_0x0afe('0x72')]);}})[_0x0afe('0x24')](respondWithStatusCode(_0x145c14,null))[_0x0afe('0x2f')](handleError(_0x145c14,null));};exports['addAnswer']=function(_0x4f15df,_0x18539f,_0x4981f1){if(_0x4f15df[_0x0afe('0x6a')]['id']){delete _0x4f15df[_0x0afe('0x6a')]['id'];}return db['FaxAccount'][_0x0afe('0x61')]({'where':{'id':_0x4f15df[_0x0afe('0x5e')]['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0x18539f,null))[_0x0afe('0x24')](function(_0x558938){if(_0x558938){_0x4f15df['body'][_0x0afe('0x6f')]=_0x558938['id'];return db[_0x0afe('0x73')][_0x0afe('0x62')](_0x4f15df[_0x0afe('0x6a')]);}})[_0x0afe('0x24')](respondWithResult(_0x18539f,null))[_0x0afe('0x2f')](handleError(_0x18539f,null));};exports[_0x0afe('0x74')]=function(_0x332c5,_0x1d8bb6,_0x3184d2){var _0x5d9268={'raw':![],'where':{}};var _0x562bad={};var _0x5d0f4c={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x332c5[_0x0afe('0x5e')]['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0x1d8bb6,null))['then'](function(_0x15f5d1){if(_0x15f5d1){_0x562bad['model']=_[_0x0afe('0x4a')](db[_0x0afe('0x73')][_0x0afe('0x45')]);_0x562bad['query']=_[_0x0afe('0x4a')](_0x332c5[_0x0afe('0x4e')]);_0x562bad['filters']=_[_0x0afe('0x4c')](_0x562bad[_0x0afe('0x49')],_0x562bad['query']);_0x5d9268[_0x0afe('0x4f')]=_[_0x0afe('0x4c')](_0x562bad['model'],qs[_0x0afe('0x4d')](_0x332c5['query'][_0x0afe('0x4d')]));_0x5d9268[_0x0afe('0x4f')]=_0x5d9268['attributes'][_0x0afe('0x60')]?_0x5d9268[_0x0afe('0x4f')]:_0x562bad[_0x0afe('0x49')];if(!_0x332c5['query']['hasOwnProperty'](_0x0afe('0x51'))){_0x5d9268[_0x0afe('0x35')]=qs[_0x0afe('0x35')](_0x332c5[_0x0afe('0x4e')][_0x0afe('0x35')]);_0x5d9268[_0x0afe('0x33')]=qs[_0x0afe('0x33')](_0x332c5[_0x0afe('0x4e')][_0x0afe('0x33')]);}_0x5d9268['order']=qs[_0x0afe('0x53')](_0x332c5[_0x0afe('0x4e')]['sort']);_0x5d9268[_0x0afe('0x54')]=qs['filters'](_[_0x0afe('0x55')](_0x332c5[_0x0afe('0x4e')],_0x562bad['filters']));_0x5d9268[_0x0afe('0x54')][_0x0afe('0x6f')]=_0x15f5d1['id'];if(_0x332c5['query'][_0x0afe('0x58')]){_0x5d9268[_0x0afe('0x54')]=_[_0x0afe('0x56')](_0x5d9268[_0x0afe('0x54')],{'$or':_[_0x0afe('0x43')](_0x5d9268[_0x0afe('0x4f')],function(_0x2d6f99){var _0x3c25c3={};_0x3c25c3[_0x2d6f99]={'$like':'%'+_0x332c5[_0x0afe('0x4e')][_0x0afe('0x58')]+'%'};return _0x3c25c3;})});}_0x5d9268=_[_0x0afe('0x56')]({},_0x5d9268,_0x332c5[_0x0afe('0x59')]);return db[_0x0afe('0x73')][_0x0afe('0x36')]({'where':_0x5d9268[_0x0afe('0x54')]})[_0x0afe('0x24')](function(_0x33b2b9){_0x5d0f4c[_0x0afe('0x36')]=_0x33b2b9;if(_0x332c5[_0x0afe('0x4e')][_0x0afe('0x5a')]){_0x5d9268[_0x0afe('0x5b')]=[{'all':!![]}];}return db[_0x0afe('0x73')][_0x0afe('0x70')](_0x5d9268);})[_0x0afe('0x24')](function(_0x2e90af){_0x5d0f4c[_0x0afe('0x5c')]=_0x2e90af;return _0x5d0f4c;});}})[_0x0afe('0x24')](respondWithFilteredResult(_0x1d8bb6,_0x5d9268))['catch'](handleError(_0x1d8bb6,null));};exports[_0x0afe('0x75')]=function(_0x4a27a7,_0x363b10,_0x2cb792){return db[_0x0afe('0x44')]['find']({'where':{'id':_0x4a27a7[_0x0afe('0x5e')]['id']}})['then'](handleEntityNotFound(_0x363b10,null))[_0x0afe('0x24')](function(_0x507cd6){if(_0x507cd6){return _0x507cd6['removeAnswers'](_0x4a27a7[_0x0afe('0x4e')][_0x0afe('0x72')]);}})[_0x0afe('0x24')](respondWithStatusCode(_0x363b10,null))[_0x0afe('0x2f')](handleError(_0x363b10,null));};exports[_0x0afe('0x76')]=function(_0x5c2c98,_0x47a0e3,_0x3992ab){return db[_0x0afe('0x77')][_0x0afe('0x61')]({'where':{'id':_0x5c2c98[_0x0afe('0x5e')]['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0x47a0e3,null))['then'](function(_0x49c951){if(_0x49c951){return _0x49c951[_0x0afe('0x76')](_0x5c2c98['body'][_0x0afe('0x72')],_[_0x0afe('0x78')](_0x5c2c98[_0x0afe('0x6a')],['ids','id'])||{});}})['then'](respondWithResult(_0x47a0e3,null))[_0x0afe('0x2f')](handleError(_0x47a0e3,null));};exports['getInteractions']=function(_0x43a6c7,_0x292bc9,_0x535d97){var _0x2a71f6={'raw':![],'where':{}};var _0x3eeeb5={};var _0x3ee25e={'count':0x0,'rows':[]};return db[_0x0afe('0x44')]['findOne']({'where':{'id':_0x43a6c7[_0x0afe('0x5e')]['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0x292bc9,null))[_0x0afe('0x24')](function(_0x4084e2){if(_0x4084e2){_0x3eeeb5[_0x0afe('0x49')]=_['keys'](db[_0x0afe('0x77')][_0x0afe('0x45')]);_0x3eeeb5['query']=_[_0x0afe('0x4a')](_0x43a6c7[_0x0afe('0x4e')]);_0x3eeeb5['filters']=_[_0x0afe('0x4c')](_0x3eeeb5[_0x0afe('0x49')],_0x3eeeb5[_0x0afe('0x4e')]);_0x2a71f6[_0x0afe('0x4f')]=_[_0x0afe('0x4c')](_0x3eeeb5[_0x0afe('0x49')],qs[_0x0afe('0x4d')](_0x43a6c7[_0x0afe('0x4e')]['fields']));_0x2a71f6[_0x0afe('0x4f')]=_0x2a71f6[_0x0afe('0x4f')][_0x0afe('0x60')]?_0x2a71f6[_0x0afe('0x4f')]:_0x3eeeb5[_0x0afe('0x49')];if(!_0x43a6c7[_0x0afe('0x4e')]['hasOwnProperty'](_0x0afe('0x51'))){_0x2a71f6[_0x0afe('0x35')]=qs[_0x0afe('0x35')](_0x43a6c7[_0x0afe('0x4e')][_0x0afe('0x35')]);_0x2a71f6[_0x0afe('0x33')]=qs[_0x0afe('0x33')](_0x43a6c7[_0x0afe('0x4e')]['offset']);}_0x2a71f6[_0x0afe('0x52')]=qs[_0x0afe('0x53')](_0x43a6c7[_0x0afe('0x4e')][_0x0afe('0x53')]);_0x2a71f6['where']=qs[_0x0afe('0x4b')](_[_0x0afe('0x55')](_0x43a6c7[_0x0afe('0x4e')],_0x3eeeb5[_0x0afe('0x4b')]));_0x2a71f6[_0x0afe('0x54')][_0x0afe('0x6f')]=_0x4084e2['id'];if(_0x43a6c7[_0x0afe('0x4e')][_0x0afe('0x58')]){_0x2a71f6[_0x0afe('0x54')]=_[_0x0afe('0x56')](_0x2a71f6[_0x0afe('0x54')],{'$or':_[_0x0afe('0x43')](_0x2a71f6['attributes'],function(_0x3d7e03){var _0x113a2e={};_0x113a2e[_0x3d7e03]={'$like':'%'+_0x43a6c7[_0x0afe('0x4e')][_0x0afe('0x58')]+'%'};return _0x113a2e;})});}_0x2a71f6=_[_0x0afe('0x56')]({},_0x2a71f6,_0x43a6c7['options']);return db[_0x0afe('0x77')][_0x0afe('0x36')]({'where':_0x2a71f6[_0x0afe('0x54')]})[_0x0afe('0x24')](function(_0x36ffe5){_0x3ee25e[_0x0afe('0x36')]=_0x36ffe5;if(_0x43a6c7[_0x0afe('0x4e')][_0x0afe('0x5a')]){_0x2a71f6['include']=[{'model':db[_0x0afe('0x79')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x0afe('0x7a'),'attributes':[_0x0afe('0x40'),_0x0afe('0x7b'),_0x0afe('0x7c')],'required':![]},{'model':db['Tag'],'as':_0x0afe('0x7d'),'attributes':['id','name',_0x0afe('0x7e')],'where':_0x43a6c7[_0x0afe('0x4e')][_0x0afe('0x7f')]?{'id':_0x43a6c7['query']['tag']}:undefined,'required':_0x43a6c7[_0x0afe('0x4e')][_0x0afe('0x7f')]?!![]:![]}];}return db['FaxInteraction'][_0x0afe('0x70')](_0x2a71f6);})[_0x0afe('0x24')](function(_0x4c8057){_0x3ee25e[_0x0afe('0x5c')]=_0x4c8057;return _0x3ee25e;});}})[_0x0afe('0x24')](respondWithFilteredResult(_0x292bc9,_0x2a71f6))['catch'](handleError(_0x292bc9,null));};exports[_0x0afe('0x80')]=function(_0x2984ac,_0x3ff4d9){var _0x54ee00=_0x2984ac[_0x0afe('0x5e')]['id'];var _0x22b7ec=_0x2984ac['body'];var _0x25f3fc=0xc8;var _0x3d80a8=null;return db[_0x0afe('0x81')][_0x0afe('0x82')]({'isolationLevel':db['sequelize'][_0x0afe('0x83')][_0x0afe('0x84')][_0x0afe('0x85')]},function(_0x21bf92){return db['FaxAccount'][_0x0afe('0x86')]({'where':{'id':_0x54ee00},'transaction':_0x21bf92})[_0x0afe('0x24')](function(_0x48798c){if(_0x48798c){return db[_0x0afe('0x87')][_0x0afe('0x3b')]({'where':{'FaxAccountId':_0x54ee00},'transaction':_0x21bf92})[_0x0afe('0x24')](function(){var _0x3b4b05=_[_0x0afe('0x43')](_0x22b7ec,function(_0x28307e){_0x28307e[_0x0afe('0x6f')]=_0x54ee00;return _0x28307e;});return db[_0x0afe('0x87')][_0x0afe('0x88')](_0x3b4b05,{'transaction':_0x21bf92});});}else{_0x25f3fc=0x194;_0x3d80a8=[];}});})[_0x0afe('0x24')](function(){if(_0x25f3fc!==0x194){return db[_0x0afe('0x87')][_0x0afe('0x89')]({'where':{'FaxAccountId':_0x54ee00},'order':_0x0afe('0x8a')})[_0x0afe('0x24')](function(_0x4817e3){_0x3d80a8=_0x4817e3;});}})[_0x0afe('0x2f')](function(_0x226ab3){_0x25f3fc=0x1f4;logger['error'](_0x226ab3['stack']);if(_0x226ab3[_0x0afe('0x40')]){delete _0x226ab3[_0x0afe('0x40')];}_0x3d80a8=_0x226ab3;})[_0x0afe('0x8b')](function(){if(_0x3d80a8===null){_0x3ff4d9[_0x0afe('0x30')](_0x25f3fc);}else{if(_0x25f3fc===0x1f4){_0x3ff4d9['status'](_0x25f3fc)['send'](_0x3d80a8);}else{_0x3ff4d9[_0x0afe('0x31')](_0x25f3fc)[_0x0afe('0x32')](_0x3d80a8);}}});};exports[_0x0afe('0x8c')]=function(_0x5c928c,_0x5e49f7,_0x268a78){var _0x371017={};var _0x5538aa={};var _0x30fb20;var _0x5408da;return db[_0x0afe('0x44')][_0x0afe('0x86')]({'where':{'id':_0x5c928c[_0x0afe('0x5e')]['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0x5e49f7,null))[_0x0afe('0x24')](function(_0x27495e){if(_0x27495e){_0x30fb20=_0x27495e;_0x5538aa[_0x0afe('0x49')]=_[_0x0afe('0x4a')](db['FaxApplication']['rawAttributes']);_0x5538aa[_0x0afe('0x4e')]=_[_0x0afe('0x4a')](_0x5c928c[_0x0afe('0x4e')]);_0x5538aa[_0x0afe('0x4b')]=_[_0x0afe('0x4c')](_0x5538aa[_0x0afe('0x49')],_0x5538aa[_0x0afe('0x4e')]);_0x371017[_0x0afe('0x4f')]=_[_0x0afe('0x4c')](_0x5538aa[_0x0afe('0x49')],qs['fields'](_0x5c928c['query'][_0x0afe('0x4d')]));_0x371017[_0x0afe('0x4f')]=_0x371017['attributes'][_0x0afe('0x60')]?_0x371017[_0x0afe('0x4f')]:_0x5538aa[_0x0afe('0x49')];_0x371017['order']=qs[_0x0afe('0x53')](_0x5c928c[_0x0afe('0x4e')][_0x0afe('0x53')]);_0x371017['where']=qs[_0x0afe('0x4b')](_['pick'](_0x5c928c[_0x0afe('0x4e')],_0x5538aa[_0x0afe('0x4b')]));if(_0x5c928c[_0x0afe('0x4e')][_0x0afe('0x58')]){_0x371017['where']=_[_0x0afe('0x56')](_0x371017[_0x0afe('0x54')],{'$or':_[_0x0afe('0x43')](_0x371017[_0x0afe('0x4f')],function(_0x8ff7){var _0x429754={};_0x429754[_0x8ff7]={'$like':'%'+_0x5c928c[_0x0afe('0x4e')][_0x0afe('0x58')]+'%'};return _0x429754;})});}_0x371017=_[_0x0afe('0x56')]({},_0x371017,_0x5c928c[_0x0afe('0x59')]);return _0x30fb20['getApplications'](_0x371017);}})[_0x0afe('0x24')](function(_0x3cfad0){if(_0x3cfad0){_0x5408da=_0x3cfad0[_0x0afe('0x60')];if(!_0x5c928c[_0x0afe('0x4e')][_0x0afe('0x50')](_0x0afe('0x51'))){_0x371017[_0x0afe('0x35')]=qs[_0x0afe('0x35')](_0x5c928c[_0x0afe('0x4e')][_0x0afe('0x35')]);_0x371017[_0x0afe('0x33')]=qs['offset'](_0x5c928c['query'][_0x0afe('0x33')]);}return _0x30fb20[_0x0afe('0x8c')](_0x371017);}})['then'](function(_0x449c8f){if(_0x449c8f){return _0x449c8f?{'count':_0x5408da,'rows':_0x449c8f}:null;}})[_0x0afe('0x24')](respondWithResult(_0x5e49f7,null))[_0x0afe('0x2f')](handleError(_0x5e49f7,null));};function Extension(_0x2cb7ad,_0x4c745c,_0xbc4e18,_0x192afb){this[_0x0afe('0x8d')]=_0x0afe('0x8e');this[_0x0afe('0x8f')]=_0x2cb7ad[_0x0afe('0x90')];this['app']=_0x192afb;this[_0x0afe('0x47')]='system';this[_0x0afe('0x91')]=_0x0afe('0x92');this[_0x0afe('0x6f')]=_0x2cb7ad['id'];this[_0x0afe('0x8a')]=_0x4c745c;this[_0x0afe('0x93')]=_0xbc4e18;}function createExtensionsReciveFax(_0x3c4858){var _0x5d3e2d=0x1;var _0x6972e2=[];_0x6972e2['push'](new Extension(_0x3c4858,_0x5d3e2d,'',_0x0afe('0x94')));_0x5d3e2d+=0x1;_0x6972e2[_0x0afe('0x95')](new Extension(_0x3c4858,_0x5d3e2d,_0x0afe('0x96'),'Set'));_0x5d3e2d+=0x1;for(var _0x1d2ea6 in _0x3c4858){if(_0x3c4858[_0x0afe('0x50')](_0x1d2ea6)&&(_0x1d2ea6==='ecm'||_0x1d2ea6===_0x0afe('0x90')||_0x1d2ea6===_0x0afe('0x97')||_0x1d2ea6===_0x0afe('0x98')||_0x1d2ea6===_0x0afe('0x99')||_0x1d2ea6===_0x0afe('0x9a')||_0x1d2ea6===_0x0afe('0x9b')||_0x1d2ea6===_0x0afe('0x9c')||_0x1d2ea6===_0x0afe('0x9d'))){_0x6972e2[_0x0afe('0x95')](new Extension(_0x3c4858,_0x5d3e2d,_0x0afe('0x9e')+_0x1d2ea6+')='+_0x3c4858[_0x1d2ea6],_0x0afe('0x9f')));_0x5d3e2d+=0x1;}}_0x6972e2['push'](new Extension(_0x3c4858,_0x5d3e2d,'6',_0x0afe('0xa0')));_0x5d3e2d+=0x1;_0x6972e2[_0x0afe('0x95')](new Extension(_0x3c4858,_0x5d3e2d,_0x0afe('0xa1'),'ReceiveFax'));_0x5d3e2d=0x0;return _0x6972e2;}exports['addAccountApplications']=function(_0x46b805,_0x462d53,_0x373326){var _0x1f679b;return db['sequelize'][_0x0afe('0x82')](function(_0x249a32){return db[_0x0afe('0x44')]['create'](_0x46b805['body'],{'transaction':_0x249a32})[_0x0afe('0x24')](function(_0x154a75){_0x1f679b=_0x154a75[_0x0afe('0x3c')]({'plain':!![]});return db[_0x0afe('0xa2')]['bulkCreate'](createExtensionsReciveFax(_0x1f679b),{'transaction':_0x249a32});});})['then'](function(){return _0x1f679b;})[_0x0afe('0x24')](respondWithResult(_0x462d53,null))['catch'](handleError(_0x462d53,null));};exports[_0x0afe('0xa3')]=function(_0x1c4db7,_0x2ec82f,_0x5d5d3a){var _0x497481;return db[_0x0afe('0x81')][_0x0afe('0x82')](function(_0x363e85){return db[_0x0afe('0x44')]['update'](_0x1c4db7[_0x0afe('0x6a')],{'where':{'id':_0x1c4db7['body']['id']},'transaction':_0x363e85})[_0x0afe('0x24')](function(_0xa211d7){return db['VoiceExtension'][_0x0afe('0x3b')]({'where':{'FaxAccountId':_0x1c4db7[_0x0afe('0x6a')]['id']},'transaction':_0x363e85})[_0x0afe('0x24')](function(_0x5db90c){return db[_0x0afe('0xa2')][_0x0afe('0x88')](createExtensionsReciveFax(_[_0x0afe('0x78')](_0x1c4db7['body'],[_0x0afe('0xa4'),_0x0afe('0x48'),'createdAt','updatedAt','TrunkId','ListId'])),{'transaction':_0x363e85});});});})[_0x0afe('0x24')](function(){return db['FaxAccount']['findById'](_0x1c4db7[_0x0afe('0x6a')]['id']);})[_0x0afe('0x24')](respondWithResult(_0x2ec82f,null))['catch'](handleError(_0x2ec82f,null));};exports[_0x0afe('0xa5')]=function(_0x5234ba,_0x131b5f,_0x47c9ec){var _0x47e2fa={'raw':!![],'where':{}};var _0x2235c6={};var _0x58281e={'count':0x0,'rows':[]};return db[_0x0afe('0x44')][_0x0afe('0x86')]({'where':{'id':_0x5234ba[_0x0afe('0x5e')]['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0x131b5f,null))[_0x0afe('0x24')](function(_0x4ed8af){if(_0x4ed8af){_0x2235c6[_0x0afe('0x49')]=_[_0x0afe('0x4a')](db[_0x0afe('0xa6')][_0x0afe('0x45')]);_0x2235c6['query']=_[_0x0afe('0x4a')](_0x5234ba[_0x0afe('0x4e')]);_0x2235c6[_0x0afe('0x4b')]=_[_0x0afe('0x4c')](_0x2235c6[_0x0afe('0x49')],_0x2235c6[_0x0afe('0x4e')]);_0x47e2fa['attributes']=_[_0x0afe('0x4c')](_0x2235c6[_0x0afe('0x49')],qs[_0x0afe('0x4d')](_0x5234ba['query'][_0x0afe('0x4d')]));_0x47e2fa[_0x0afe('0x4f')]=_0x47e2fa[_0x0afe('0x4f')][_0x0afe('0x60')]?_0x47e2fa[_0x0afe('0x4f')]:_0x2235c6[_0x0afe('0x49')];if(!_0x5234ba['query'][_0x0afe('0x50')](_0x0afe('0x51'))){_0x47e2fa[_0x0afe('0x35')]=qs[_0x0afe('0x35')](_0x5234ba[_0x0afe('0x4e')][_0x0afe('0x35')]);_0x47e2fa[_0x0afe('0x33')]=qs[_0x0afe('0x33')](_0x5234ba[_0x0afe('0x4e')][_0x0afe('0x33')]);}_0x47e2fa[_0x0afe('0x52')]=qs[_0x0afe('0x53')](_0x5234ba[_0x0afe('0x4e')][_0x0afe('0x53')]);_0x47e2fa['where']=qs[_0x0afe('0x4b')](_[_0x0afe('0x55')](_0x5234ba['query'],_0x2235c6['filters']));_0x47e2fa[_0x0afe('0x54')][_0x0afe('0x6f')]=_0x4ed8af['id'];if(_0x5234ba[_0x0afe('0x4e')][_0x0afe('0x58')]){_0x47e2fa[_0x0afe('0x54')]=_[_0x0afe('0x56')](_0x47e2fa[_0x0afe('0x54')],{'$or':_['map'](_0x47e2fa[_0x0afe('0x4f')],function(_0x17f3f5){var _0x53c177={};_0x53c177[_0x17f3f5]={'$like':'%'+_0x5234ba[_0x0afe('0x4e')][_0x0afe('0x58')]+'%'};return _0x53c177;})});}if(_0x5234ba[_0x0afe('0x4e')]['$gte']){var _0x327193=_0x5234ba[_0x0afe('0x4e')][_0x0afe('0xa7')]['split'](',');var _0x819520={};_0x819520[_0x327193[0x0]]={'$gte':moment(_0x327193[0x1])[_0x0afe('0xa8')](_0x0afe('0xa9'))};_0x47e2fa[_0x0afe('0x54')]=_[_0x0afe('0x56')](_0x47e2fa[_0x0afe('0x54')],_0x819520);}_0x47e2fa=_[_0x0afe('0x56')]({},_0x47e2fa,_0x5234ba[_0x0afe('0x59')]);return db[_0x0afe('0xa6')]['count']({'where':_0x47e2fa[_0x0afe('0x54')]})[_0x0afe('0x24')](function(_0x1222b2){_0x58281e[_0x0afe('0x36')]=_0x1222b2;if(_0x5234ba[_0x0afe('0x4e')][_0x0afe('0x5a')]){_0x47e2fa[_0x0afe('0x5b')]=[{'all':!![]}];}return db['FaxMessage'][_0x0afe('0x70')](_0x47e2fa);})[_0x0afe('0x24')](function(_0x5f5200){_0x58281e['rows']=_0x5f5200;return _0x58281e;});}})[_0x0afe('0x24')](respondWithFilteredResult(_0x131b5f,_0x47e2fa))[_0x0afe('0x2f')](handleError(_0x131b5f,null));};exports['send']=function(_0x1c8dd1,_0x5c6eab,_0x301e3d){var _0x469d52,_0x523d5a={},_0x5ec724;if(_0x1c8dd1[_0x0afe('0x6a')]['to']){_0x5ec724=_0x1c8dd1[_0x0afe('0x6a')]['to'][0x0];}return db[_0x0afe('0x44')][_0x0afe('0x61')]({'where':{'id':_0x1c8dd1[_0x0afe('0x5e')]['id']},'include':[{'model':db[_0x0afe('0xaa')],'as':_0x0afe('0xab'),'include':[{'model':db[_0x0afe('0x79')],'as':_0x0afe('0xac'),'where':{'fax':_0x5ec724},'limit':0x1,'order':[[_0x0afe('0xad'),_0x0afe('0xae')]]}]}]})[_0x0afe('0x24')](handleEntityNotFound(_0x5c6eab,null))['then'](function(_0x36afb9){_0x469d52=_0x36afb9;if(_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')]&&_0x1c8dd1['body'][_0x0afe('0xaf')][_0x0afe('0x60')]){for(var _0x51640d=0x0;_0x51640d<_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')][_0x0afe('0x60')];_0x51640d+=0x1){_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')][_0x51640d]={'filename':_0x1c8dd1[_0x0afe('0x6a')]['attachments'][_0x51640d][_0x0afe('0x40')],'id':_0x1c8dd1[_0x0afe('0x6a')]['attachments'][_0x51640d]['id'],'path':path[_0x0afe('0xb0')](config[_0x0afe('0xb1')],_0x0afe('0xb2'),_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')][_0x51640d][_0x0afe('0xb3')])};}}return respondWithRpcPromise(_0x0afe('0xb4'),_0x0afe('0xb4'),{'FaxAccountId':_[_0x0afe('0xb5')](_0x1c8dd1['params']['id'])?undefined:_0x1c8dd1[_0x0afe('0x5e')]['id'],'path':_['isNil'](_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')][0x0][_0x0afe('0x7')])?undefined:_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')][0x0][_0x0afe('0x7')],'fax':_[_0x0afe('0xb5')](_0x1c8dd1[_0x0afe('0x6a')]['to'][0x0])?undefined:_0x1c8dd1[_0x0afe('0x6a')]['to'][0x0]},client9002);})[_0x0afe('0x24')](function(){if(_0x469d52){if(_['isNil'](_0x1c8dd1[_0x0afe('0x6a')]['from'])){_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xb6')]=util['format'](_0x0afe('0xb7'),_0x469d52[_0x0afe('0x40')],_0x469d52[_0x0afe('0xb8')]);}if(_0x469d52[_0x0afe('0xab')]){if(_0x469d52[_0x0afe('0xab')][_0x0afe('0xac')][_0x0afe('0x60')]){return _0x469d52[_0x0afe('0xab')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0x0afe('0xb9')](_0x1c8dd1['body'],{'firstName':_0x1c8dd1[_0x0afe('0x6a')]['to'][0x0],'phone':_0x1c8dd1[_0x0afe('0x6a')]['to'][0x0],'fax':_0x1c8dd1[_0x0afe('0x6a')]['to'][0x0],'ListId':_0x469d52['ListId']}));}}else{throw new Error(_0x0afe('0xba'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x0afe('0x24')](function(_0x49f2db){if(_0x49f2db){return db[_0x0afe('0x77')][_0x0afe('0x61')]({'where':{'ContactId':_0x49f2db['id'],'closed':![],'FaxAccountId':_0x469d52['id']}})[_0x0afe('0x24')](function(_0xb9c230){if(_0xb9c230){return[_0xb9c230,![]];}return db[_0x0afe('0x77')][_0x0afe('0x62')]({'UserId':_0x1c8dd1[_0x0afe('0x63')]['id'],'ContactId':_0x49f2db['id'],'FaxAccountId':_0x469d52['id'],'fax':_0x1c8dd1[_0x0afe('0x6a')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x0afe('0x56')](_0x1c8dd1[_0x0afe('0x6a')],{'read':![],'body':_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')][0x0][_0x0afe('0xbb')],'FaxAccountId':_0x469d52['id'],'UserId':_0x1c8dd1[_0x0afe('0x63')]['id'],'ContactId':_0x49f2db['id'],'AttachmentId':_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')][0x0]['id']})]},{'include':[{'model':db[_0x0afe('0xa6')],'as':_0x0afe('0xbc')}]})[_0x0afe('0x24')](function(_0x2e28c1){return[_0x2e28c1,!![]];});});}else{throw new Error(_0x0afe('0xbd'));}})['spread'](function(_0x2d30be,_0x30a42e){if(_0x30a42e){return _0x2d30be;}return db[_0x0afe('0xa6')][_0x0afe('0x62')]({'direction':_0x0afe('0xbe'),'read':![],'body':_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')][0x0]['filename'],'FaxAccountId':_0x469d52['id'],'FaxInteractionId':_0x2d30be['id'],'UserId':_0x1c8dd1[_0x0afe('0x63')]['id'],'ContactId':_0x2d30be[_0x0afe('0xbf')],'AttachmentId':_0x1c8dd1['body']['attachments'][0x0]['id']})['then'](function(_0x35687f){_0x2d30be['dataValues'][_0x0afe('0xbc')]=[];_0x2d30be[_0x0afe('0xc0')][_0x0afe('0xbc')]['push'](_0x35687f[_0x0afe('0xc0')]);return _0x2d30be;});})['then'](function(_0x287273){respondWithRpcPromise(_0x0afe('0xc1'),_0x0afe('0xc1'),{'FaxAccountId':_[_0x0afe('0xb5')](_0x1c8dd1['params']['id'])?undefined:_0x1c8dd1['params']['id'],'path':_['isNil'](_0x1c8dd1[_0x0afe('0x6a')][_0x0afe('0xaf')][0x0][_0x0afe('0x7')])?undefined:_0x1c8dd1[_0x0afe('0x6a')]['attachments'][0x0]['path'],'fax':_[_0x0afe('0xb5')](_0x1c8dd1['body']['to'][0x0])?undefined:_0x1c8dd1[_0x0afe('0x6a')]['to'][0x0],'AttachmentId':_0x1c8dd1['body'][_0x0afe('0xaf')][0x0]['id']},client9002)[_0x0afe('0x24')](function(_0x46405c){logger[_0x0afe('0x25')](_0x0afe('0xc2'),_0x46405c);})[_0x0afe('0x2f')](function(_0x59ec8e){logger['info'](_0x0afe('0xc2'),_0x59ec8e);});return _0x287273;})[_0x0afe('0x24')](respondWithResult(_0x5c6eab,null))[_0x0afe('0x2f')](handleError(_0x5c6eab,null));};exports[_0x0afe('0xc3')]=function(_0x1a715f,_0xa5e398,_0xd4bbcd){return db[_0x0afe('0x44')]['find']({'where':{'id':_0x1a715f['params']['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0xa5e398,null))[_0x0afe('0x24')](function(_0x1e38c3){if(_0x1e38c3){return _0x1e38c3[_0x0afe('0xc3')](_0x1a715f[_0x0afe('0x6a')][_0x0afe('0x72')],_[_0x0afe('0x78')](_0x1a715f[_0x0afe('0x6a')],[_0x0afe('0x72'),'id'])||{})['spread'](function(_0x54b2a3){for(var _0x3e40e7=0x0;_0x3e40e7<_0x1a715f[_0x0afe('0x6a')][_0x0afe('0x72')]['length'];_0x3e40e7+=0x1){socket[_0x0afe('0xc4')](_0x0afe('0xc5'),{'UserId':Number(_0x1a715f['body'][_0x0afe('0x72')][_0x3e40e7]),'FaxAccountId':Number(_0x1a715f[_0x0afe('0x5e')]['id'])});}return _0x54b2a3;});}})['then'](respondWithResult(_0xa5e398,null))[_0x0afe('0x2f')](handleError(_0xa5e398,null));};exports[_0x0afe('0xc6')]=function(_0x2aea08,_0x74379a,_0x4924ed){return db[_0x0afe('0x44')][_0x0afe('0x61')]({'where':{'id':_0x2aea08['params']['id']}})['then'](handleEntityNotFound(_0x74379a,null))[_0x0afe('0x24')](function(_0x141193){if(_0x141193){return _0x141193['removeAgents'](_0x2aea08[_0x0afe('0x4e')][_0x0afe('0x72')])[_0x0afe('0x24')](function(){if(_['isArray'](_0x2aea08[_0x0afe('0x4e')][_0x0afe('0x72')])){for(var _0x132ad9=0x0;_0x132ad9<_0x2aea08[_0x0afe('0x4e')][_0x0afe('0x72')][_0x0afe('0x60')];_0x132ad9+=0x1){socket[_0x0afe('0xc4')](_0x0afe('0xc7'),{'UserId':Number(_0x2aea08['query'][_0x0afe('0x72')][_0x132ad9]),'FaxAccountId':Number(_0x2aea08['params']['id'])});}}else{socket[_0x0afe('0xc4')](_0x0afe('0xc7'),{'UserId':Number(_0x2aea08[_0x0afe('0x4e')][_0x0afe('0x72')]),'FaxAccountId':Number(_0x2aea08[_0x0afe('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x74379a,null))['catch'](handleError(_0x74379a,null));};exports[_0x0afe('0xc8')]=function(_0x55e99d,_0x222447,_0x2aa2ce){var _0x3ec753={};var _0x1384d6={};var _0x10ab77;var _0x44d971;return db[_0x0afe('0x44')][_0x0afe('0x86')]({'where':{'id':_0x55e99d[_0x0afe('0x5e')]['id']}})[_0x0afe('0x24')](handleEntityNotFound(_0x222447,null))[_0x0afe('0x24')](function(_0x8acbee){if(_0x8acbee){_0x10ab77=_0x8acbee;_0x1384d6[_0x0afe('0x49')]=_[_0x0afe('0x4a')](db[_0x0afe('0xc9')][_0x0afe('0x45')]);_0x1384d6['query']=_['keys'](_0x55e99d[_0x0afe('0x4e')]);_0x1384d6[_0x0afe('0x4b')]=_[_0x0afe('0x4c')](_0x1384d6['model'],_0x1384d6['query']);_0x3ec753['attributes']=_['intersection'](_0x1384d6['model'],qs[_0x0afe('0x4d')](_0x55e99d[_0x0afe('0x4e')]['fields']));_0x3ec753[_0x0afe('0x4f')]=_0x3ec753[_0x0afe('0x4f')][_0x0afe('0x60')]?_0x3ec753['attributes']:_0x1384d6[_0x0afe('0x49')];_0x3ec753[_0x0afe('0x52')]=qs['sort'](_0x55e99d['query'][_0x0afe('0x53')]);_0x3ec753[_0x0afe('0x54')]=qs[_0x0afe('0x4b')](_[_0x0afe('0x55')](_0x55e99d[_0x0afe('0x4e')],_0x1384d6[_0x0afe('0x4b')]));if(_0x55e99d[_0x0afe('0x4e')][_0x0afe('0x58')]){_0x3ec753[_0x0afe('0x54')]=_[_0x0afe('0x56')](_0x3ec753['where'],{'$or':_[_0x0afe('0x43')](_0x3ec753[_0x0afe('0x4f')],function(_0x333e6c){var _0x45f1e3={};_0x45f1e3[_0x333e6c]={'$like':'%'+_0x55e99d[_0x0afe('0x4e')]['filter']+'%'};return _0x45f1e3;})});}_0x3ec753=_[_0x0afe('0x56')]({},_0x3ec753,_0x55e99d[_0x0afe('0x59')]);return _0x10ab77['getAgents'](_0x3ec753);}})[_0x0afe('0x24')](function(_0x7927e3){if(_0x7927e3){_0x44d971=_0x7927e3['length'];if(!_0x55e99d[_0x0afe('0x4e')][_0x0afe('0x50')](_0x0afe('0x51'))){_0x3ec753[_0x0afe('0x35')]=qs[_0x0afe('0x35')](_0x55e99d['query']['limit']);_0x3ec753[_0x0afe('0x33')]=qs[_0x0afe('0x33')](_0x55e99d['query'][_0x0afe('0x33')]);}return _0x10ab77[_0x0afe('0xc8')](_0x3ec753);}})[_0x0afe('0x24')](function(_0x123120){if(_0x123120){return _0x123120?{'count':_0x44d971,'rows':_0x123120}:null;}})[_0x0afe('0x24')](respondWithResult(_0x222447,null))[_0x0afe('0x2f')](handleError(_0x222447,null));}; \ No newline at end of file +var _0x84a6=['register','client','http','request','then','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','get','FaxAccounts','UserProfileResource','end','name','send','index','map','FaxAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','findAll','rows','show','params','Pause','mandatoryDispositionPause','options','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','includeAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','pick','include','removeAnswers','ids','addInteraction','FaxInteraction','Contact','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','stack','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','push','Answer','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','omit','tech','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','CmList','List','CmContact','updatedAt','DESC','attachments','root','server/files/attachments','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','Contacts','defaults','List\x20not\x20found','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','./faxAccount.socket'];(function(_0x85e674,_0x5e0cd4){var _0x19fdcc=function(_0x1ec36a){while(--_0x1ec36a){_0x85e674['push'](_0x85e674['shift']());}};_0x19fdcc(++_0x5e0cd4);}(_0x84a6,0xaa));var _0x684a=function(_0x5582d2,_0x5a87cf){_0x5582d2=_0x5582d2-0x0;var _0x47c2fe=_0x84a6[_0x5582d2];return _0x47c2fe;};'use strict';var emlformat=require(_0x684a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x684a('0x1'));var jsonpatch=require(_0x684a('0x2'));var rp=require(_0x684a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x684a('0x4'));var sox=require(_0x684a('0x5'));var csv=require(_0x684a('0x6'));var ejs=require(_0x684a('0x7'));var fs=require('fs');var fs_extra=require(_0x684a('0x8'));var _=require(_0x684a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x684a('0xa'));var deskjs=require(_0x684a('0xb'));var toCsv=require(_0x684a('0x6'));var querystring=require('querystring');var Papa=require(_0x684a('0xc'));var Redis=require(_0x684a('0xd'));var authService=require(_0x684a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x684a('0xf'));var hardwareService=require(_0x684a('0x10'));var logger=require(_0x684a('0x11'))('api');var utils=require(_0x684a('0x12'));var config=require(_0x684a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x684a('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x684a('0x15')]));require(_0x684a('0x16'))[_0x684a('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0x684a('0x18')][_0x684a('0x19')]({'port':0x232c});var client9002=jayson[_0x684a('0x18')][_0x684a('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3994ba,_0x1020e7,_0xed0d33,_0x2b3cfc){return new BPromise(function(_0x49e81d,_0x1bb947){var _0x4eb92e=_0x2b3cfc||client;return _0x4eb92e[_0x684a('0x1a')](_0x3994ba,_0xed0d33)[_0x684a('0x1b')](function(_0x506561){logger['info']('FaxAccount,\x20%s,\x20%s',_0x1020e7,'request\x20sent');logger['debug'](_0x684a('0x1c'),_0x1020e7,_0x684a('0x1d'),JSON[_0x684a('0x1e')](_0x506561));if(_0x506561['error']){if(_0x506561[_0x684a('0x1f')][_0x684a('0x20')]===0x1f4){logger[_0x684a('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x1020e7,_0x506561[_0x684a('0x1f')][_0x684a('0x21')]);return _0x1bb947(_0x506561['error']['message']);}logger[_0x684a('0x1f')](_0x684a('0x22'),_0x1020e7,_0x506561[_0x684a('0x1f')][_0x684a('0x21')]);return _0x49e81d(_0x506561[_0x684a('0x1f')][_0x684a('0x21')]);}else{logger[_0x684a('0x23')]('FaxAccount,\x20%s,\x20%s',_0x1020e7,_0x684a('0x1d'));_0x49e81d(_0x506561[_0x684a('0x24')]['message']);}})[_0x684a('0x25')](function(_0x553edb){logger[_0x684a('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x1020e7,_0x553edb);_0x1bb947(_0x553edb);});});}function respondWithStatusCode(_0x7004be,_0x651fca){_0x651fca=_0x651fca||0xcc;return function(_0x194930){if(_0x194930){return _0x7004be[_0x684a('0x26')](_0x651fca);}return _0x7004be[_0x684a('0x27')](_0x651fca)['end']();};}function respondWithResult(_0x381a02,_0x4f6a59){_0x4f6a59=_0x4f6a59||0xc8;return function(_0x4901b9){if(_0x4901b9){return _0x381a02[_0x684a('0x27')](_0x4f6a59)[_0x684a('0x28')](_0x4901b9);}};}function respondWithFilteredResult(_0x219dd5,_0x56e4e5){return function(_0x414972){if(_0x414972){var _0x56e20c=typeof _0x56e4e5[_0x684a('0x29')]===_0x684a('0x2a')&&typeof _0x56e4e5[_0x684a('0x2b')]==='undefined';var _0x370442=_0x414972[_0x684a('0x2c')];var _0x451464=_0x56e20c?0x0:_0x56e4e5[_0x684a('0x29')];var _0x25899c=_0x56e20c?_0x414972[_0x684a('0x2c')]:_0x56e4e5[_0x684a('0x29')]+_0x56e4e5['limit'];var _0x34f63a;if(_0x25899c>=_0x370442){_0x25899c=_0x370442;_0x34f63a=0xc8;}else{_0x34f63a=0xce;}_0x219dd5[_0x684a('0x27')](_0x34f63a);return _0x219dd5[_0x684a('0x2d')](_0x684a('0x2e'),_0x451464+'-'+_0x25899c+'/'+_0x370442)[_0x684a('0x28')](_0x414972);}return null;};}function patchUpdates(_0x4b9633){return function(_0x4c1a02){try{jsonpatch['apply'](_0x4c1a02,_0x4b9633,!![]);}catch(_0x1e01db){return BPromise[_0x684a('0x2f')](_0x1e01db);}return _0x4c1a02['save']();};}function saveUpdates(_0x55a0c9,_0x1d2547){return function(_0x344b94){if(_0x344b94){return _0x344b94[_0x684a('0x30')](_0x55a0c9)[_0x684a('0x1b')](function(_0x3ca386){return _0x3ca386;});}return null;};}function removeEntity(_0x4fb3d1,_0x45fd71){return function(_0x3e48ff){if(_0x3e48ff){return _0x3e48ff[_0x684a('0x31')]()[_0x684a('0x1b')](function(){var _0x5cad2e=_0x3e48ff[_0x684a('0x32')]({'plain':!![]});var _0x592b5d=_0x684a('0x33');return db[_0x684a('0x34')][_0x684a('0x31')]({'where':{'type':_0x592b5d,'resourceId':_0x5cad2e['id']}})[_0x684a('0x1b')](function(){return _0x3e48ff;});})[_0x684a('0x1b')](function(){_0x4fb3d1[_0x684a('0x27')](0xcc)[_0x684a('0x35')]();});}};}function handleEntityNotFound(_0x37adff,_0x56f69a){return function(_0x54d667){if(!_0x54d667){_0x37adff['sendStatus'](0x194);}return _0x54d667;};}function handleError(_0x4cb237,_0x22d74b){_0x22d74b=_0x22d74b||0x1f4;return function(_0x1fadea){logger['error'](_0x1fadea['stack']);if(_0x1fadea[_0x684a('0x36')]){delete _0x1fadea[_0x684a('0x36')];}_0x4cb237[_0x684a('0x27')](_0x22d74b)[_0x684a('0x37')](_0x1fadea);};}exports[_0x684a('0x38')]=function(_0x323879,_0xe450d0){var _0x13f639={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x18c9f3={},_0xa2ace4={'count':0x0,'rows':[]};var _0x1952fb=_[_0x684a('0x39')](db[_0x684a('0x3a')][_0x684a('0x3b')],function(_0x572776){return{'name':_0x572776['fieldName'],'type':_0x572776[_0x684a('0x3c')][_0x684a('0x3d')]};});_0x18c9f3[_0x684a('0x3e')]=_['map'](_0x1952fb,_0x684a('0x36'));_0x18c9f3[_0x684a('0x3f')]=_[_0x684a('0x40')](_0x323879[_0x684a('0x3f')]);_0x18c9f3[_0x684a('0x41')]=_[_0x684a('0x42')](_0x18c9f3[_0x684a('0x3e')],_0x18c9f3[_0x684a('0x3f')]);_0x13f639[_0x684a('0x43')]=_[_0x684a('0x42')](_0x18c9f3[_0x684a('0x3e')],qs[_0x684a('0x44')](_0x323879[_0x684a('0x3f')][_0x684a('0x44')]));_0x13f639[_0x684a('0x43')]=_0x13f639[_0x684a('0x43')][_0x684a('0x45')]?_0x13f639[_0x684a('0x43')]:_0x18c9f3[_0x684a('0x3e')];if(!_0x323879[_0x684a('0x3f')][_0x684a('0x46')](_0x684a('0x47'))){_0x13f639[_0x684a('0x2b')]=qs[_0x684a('0x2b')](_0x323879[_0x684a('0x3f')][_0x684a('0x2b')]);_0x13f639[_0x684a('0x29')]=qs[_0x684a('0x29')](_0x323879[_0x684a('0x3f')]['offset']);}_0x13f639[_0x684a('0x48')]=qs[_0x684a('0x49')](_0x323879[_0x684a('0x3f')][_0x684a('0x49')]);_0x13f639[_0x684a('0x4a')]=qs[_0x684a('0x41')](_['pick'](_0x323879[_0x684a('0x3f')],_0x18c9f3[_0x684a('0x41')]),_0x1952fb);if(_0x323879[_0x684a('0x3f')]['filter']){_0x13f639[_0x684a('0x4a')]=_[_0x684a('0x4b')](_0x13f639[_0x684a('0x4a')],{'$or':_[_0x684a('0x39')](_0x1952fb,function(_0x10086e){if(_0x10086e['type']!==_0x684a('0x4c')){var _0x1091c={};_0x1091c[_0x10086e[_0x684a('0x36')]]={'$like':'%'+_0x323879[_0x684a('0x3f')][_0x684a('0x4d')]+'%'};return _0x1091c;}})});}_0x13f639=_[_0x684a('0x4b')]({},_0x13f639,_0x323879['options']);var _0x193d1a={'where':_0x13f639['where']};return db[_0x684a('0x3a')][_0x684a('0x2c')](_0x193d1a)['then'](function(_0x195d6d){_0xa2ace4[_0x684a('0x2c')]=_0x195d6d;if(_0x323879[_0x684a('0x3f')]['includeAll']){_0x13f639['include']=[{'all':!![]}];}return db[_0x684a('0x3a')][_0x684a('0x4e')](_0x13f639);})[_0x684a('0x1b')](function(_0x53b9d6){_0xa2ace4[_0x684a('0x4f')]=_0x53b9d6;return _0xa2ace4;})[_0x684a('0x1b')](respondWithFilteredResult(_0xe450d0,_0x13f639))[_0x684a('0x25')](handleError(_0xe450d0,null));};exports[_0x684a('0x50')]=function(_0x560378,_0x29ed33){var _0x195913={'raw':![],'where':{'id':_0x560378[_0x684a('0x51')]['id']},'include':[{'model':db[_0x684a('0x52')],'as':_0x684a('0x53')}]},_0x3bf1d0={};_0x3bf1d0[_0x684a('0x3e')]=_['keys'](db[_0x684a('0x3a')]['rawAttributes']);_0x3bf1d0[_0x684a('0x3f')]=_[_0x684a('0x40')](_0x560378['query']);_0x3bf1d0['filters']=_[_0x684a('0x42')](_0x3bf1d0[_0x684a('0x3e')],_0x3bf1d0[_0x684a('0x3f')]);_0x195913[_0x684a('0x43')]=_[_0x684a('0x42')](_0x3bf1d0[_0x684a('0x3e')],qs[_0x684a('0x44')](_0x560378['query'][_0x684a('0x44')]));_0x195913[_0x684a('0x43')]=_0x195913[_0x684a('0x43')][_0x684a('0x45')]?_0x195913[_0x684a('0x43')]:_0x3bf1d0[_0x684a('0x3e')];if(_0x560378[_0x684a('0x3f')]['includeAll']){_0x195913['include']=[{'all':!![]}];}_0x195913=_[_0x684a('0x4b')]({},_0x195913,_0x560378[_0x684a('0x54')]);return db[_0x684a('0x3a')]['find'](_0x195913)[_0x684a('0x1b')](handleEntityNotFound(_0x29ed33,null))[_0x684a('0x1b')](respondWithResult(_0x29ed33,null))[_0x684a('0x25')](handleError(_0x29ed33,null));};exports['create']=function(_0x3ab9cd,_0xf5706e){return db[_0x684a('0x3a')]['create'](_0x3ab9cd['body'],{})[_0x684a('0x1b')](function(_0x2e7a8d){var _0xfe15c5=_0x3ab9cd[_0x684a('0x55')][_0x684a('0x32')]({'plain':!![]});if(!_0xfe15c5)throw new Error(_0x684a('0x56'));if(_0xfe15c5[_0x684a('0x57')]===_0x684a('0x55')){var _0x23c9e3=_0x2e7a8d[_0x684a('0x32')]({'plain':!![]});var _0x3e891e='FaxAccounts';return db[_0x684a('0x58')][_0x684a('0x59')]({'where':{'name':_0x3e891e,'userProfileId':_0xfe15c5['userProfileId']},'raw':!![]})[_0x684a('0x1b')](function(_0x517081){if(_0x517081&&_0x517081['autoAssociation']===0x0){return db['UserProfileResource'][_0x684a('0x5a')]({'name':_0x23c9e3[_0x684a('0x36')],'resourceId':_0x23c9e3['id'],'type':_0x517081[_0x684a('0x36')],'sectionId':_0x517081['id']},{})[_0x684a('0x1b')](function(){return _0x2e7a8d;});}else{return _0x2e7a8d;}})[_0x684a('0x25')](function(_0x13c850){logger[_0x684a('0x1f')](_0x684a('0x5b'),_0x13c850);throw _0x13c850;});}return _0x2e7a8d;})[_0x684a('0x1b')](respondWithResult(_0xf5706e,0xc9))[_0x684a('0x25')](handleError(_0xf5706e,null));};exports[_0x684a('0x30')]=function(_0x3081dc,_0x114945){if(_0x3081dc[_0x684a('0x5c')]['id']){delete _0x3081dc['body']['id'];}return db[_0x684a('0x3a')][_0x684a('0x59')]({'where':{'id':_0x3081dc[_0x684a('0x51')]['id']},'include':[{'model':db[_0x684a('0x52')],'as':'mandatoryDispositionPause'}]})[_0x684a('0x1b')](handleEntityNotFound(_0x114945,null))[_0x684a('0x1b')](saveUpdates(_0x3081dc[_0x684a('0x5c')],null))[_0x684a('0x1b')](respondWithResult(_0x114945,null))['catch'](handleError(_0x114945,null));};exports[_0x684a('0x31')]=function(_0x291e79,_0x5d775d){return db[_0x684a('0x3a')][_0x684a('0x59')]({'where':{'id':_0x291e79[_0x684a('0x51')]['id']}})['then'](handleEntityNotFound(_0x5d775d,null))[_0x684a('0x1b')](removeEntity(_0x5d775d,null))['catch'](handleError(_0x5d775d,null));};exports[_0x684a('0x5d')]=function(_0x32d060,_0x2b0e37){return db['FaxAccount'][_0x684a('0x5d')]()[_0x684a('0x1b')](respondWithResult(_0x2b0e37,null))['catch'](handleError(_0x2b0e37,null));};exports[_0x684a('0x5e')]=function(_0x2be273,_0x1fa049,_0x487e19){if(_0x2be273[_0x684a('0x5c')]['id']){delete _0x2be273['body']['id'];}return db[_0x684a('0x3a')][_0x684a('0x59')]({'where':{'id':_0x2be273[_0x684a('0x51')]['id']}})['then'](handleEntityNotFound(_0x1fa049,null))[_0x684a('0x1b')](function(_0x30e3ac){if(_0x30e3ac){_0x2be273[_0x684a('0x5c')][_0x684a('0x5f')]=_0x30e3ac['id'];return db['Disposition'][_0x684a('0x5a')](_0x2be273['body']);}})['then'](respondWithResult(_0x1fa049,null))[_0x684a('0x25')](handleError(_0x1fa049,null));};exports[_0x684a('0x60')]=function(_0x230a33,_0x8a0977,_0x111fcf){var _0x47570c={'raw':![],'where':{}};var _0x31ad4c={};var _0x400a0f={'count':0x0,'rows':[]};return db[_0x684a('0x3a')][_0x684a('0x61')]({'where':{'id':_0x230a33[_0x684a('0x51')]['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0x8a0977,null))[_0x684a('0x1b')](function(_0x202be2){if(_0x202be2){_0x31ad4c['model']=_['keys'](db[_0x684a('0x62')][_0x684a('0x3b')]);_0x31ad4c['query']=_[_0x684a('0x40')](_0x230a33[_0x684a('0x3f')]);_0x31ad4c[_0x684a('0x41')]=_[_0x684a('0x42')](_0x31ad4c[_0x684a('0x3e')],_0x31ad4c[_0x684a('0x3f')]);_0x47570c[_0x684a('0x43')]=_[_0x684a('0x42')](_0x31ad4c[_0x684a('0x3e')],qs[_0x684a('0x44')](_0x230a33['query'][_0x684a('0x44')]));_0x47570c['attributes']=_0x47570c['attributes']['length']?_0x47570c[_0x684a('0x43')]:_0x31ad4c['model'];if(!_0x230a33[_0x684a('0x3f')]['hasOwnProperty'](_0x684a('0x47'))){_0x47570c[_0x684a('0x2b')]=qs[_0x684a('0x2b')](_0x230a33[_0x684a('0x3f')][_0x684a('0x2b')]);_0x47570c[_0x684a('0x29')]=qs['offset'](_0x230a33[_0x684a('0x3f')][_0x684a('0x29')]);}_0x47570c[_0x684a('0x48')]=qs['sort'](_0x230a33[_0x684a('0x3f')]['sort']);_0x47570c[_0x684a('0x4a')]=qs[_0x684a('0x41')](_['pick'](_0x230a33[_0x684a('0x3f')],_0x31ad4c['filters']));_0x47570c['where'][_0x684a('0x5f')]=_0x202be2['id'];if(_0x230a33[_0x684a('0x3f')]['filter']){_0x47570c[_0x684a('0x4a')]=_[_0x684a('0x4b')](_0x47570c[_0x684a('0x4a')],{'$or':_['map'](_0x47570c[_0x684a('0x43')],function(_0x3d27a4){var _0x597892={};_0x597892[_0x3d27a4]={'$like':'%'+_0x230a33['query']['filter']+'%'};return _0x597892;})});}_0x47570c=_['merge']({},_0x47570c,_0x230a33[_0x684a('0x54')]);return db['Disposition'][_0x684a('0x2c')]({'where':_0x47570c[_0x684a('0x4a')]})[_0x684a('0x1b')](function(_0x4c99c9){_0x400a0f['count']=_0x4c99c9;if(_0x230a33[_0x684a('0x3f')][_0x684a('0x63')]){_0x47570c['include']=[{'all':!![]}];}return db[_0x684a('0x62')][_0x684a('0x4e')](_0x47570c);})[_0x684a('0x1b')](function(_0x146807){_0x400a0f[_0x684a('0x4f')]=_0x146807;return _0x400a0f;});}})[_0x684a('0x1b')](respondWithFilteredResult(_0x8a0977,_0x47570c))[_0x684a('0x25')](handleError(_0x8a0977,null));};exports[_0x684a('0x64')]=function(_0x2d8ff2,_0x5b0b12,_0x303306){return db['FaxAccount'][_0x684a('0x59')]({'where':{'id':_0x2d8ff2[_0x684a('0x51')]['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0x5b0b12,null))['then'](function(_0x4e4c9a){if(_0x4e4c9a){return _0x4e4c9a[_0x684a('0x64')](_0x2d8ff2[_0x684a('0x3f')]['ids']);}})['then'](respondWithStatusCode(_0x5b0b12,null))[_0x684a('0x25')](handleError(_0x5b0b12,null));};exports[_0x684a('0x65')]=function(_0x55fa4a,_0x223141,_0x8aa0ee){if(_0x55fa4a[_0x684a('0x5c')]['id']){delete _0x55fa4a['body']['id'];}return db[_0x684a('0x3a')][_0x684a('0x59')]({'where':{'id':_0x55fa4a['params']['id']}})['then'](handleEntityNotFound(_0x223141,null))[_0x684a('0x1b')](function(_0x57b5b4){if(_0x57b5b4){_0x55fa4a[_0x684a('0x5c')]['FaxAccountId']=_0x57b5b4['id'];return db[_0x684a('0x66')][_0x684a('0x5a')](_0x55fa4a['body']);}})[_0x684a('0x1b')](respondWithResult(_0x223141,null))[_0x684a('0x25')](handleError(_0x223141,null));};exports[_0x684a('0x67')]=function(_0x171c4e,_0xfa6f50,_0x23280a){var _0x364849={'raw':![],'where':{}};var _0x2d3fad={};var _0x55792c={'count':0x0,'rows':[]};return db['FaxAccount'][_0x684a('0x61')]({'where':{'id':_0x171c4e[_0x684a('0x51')]['id']}})['then'](handleEntityNotFound(_0xfa6f50,null))[_0x684a('0x1b')](function(_0x34198b){if(_0x34198b){_0x2d3fad['model']=_[_0x684a('0x40')](db['CannedAnswer'][_0x684a('0x3b')]);_0x2d3fad[_0x684a('0x3f')]=_['keys'](_0x171c4e[_0x684a('0x3f')]);_0x2d3fad[_0x684a('0x41')]=_[_0x684a('0x42')](_0x2d3fad[_0x684a('0x3e')],_0x2d3fad[_0x684a('0x3f')]);_0x364849[_0x684a('0x43')]=_[_0x684a('0x42')](_0x2d3fad['model'],qs[_0x684a('0x44')](_0x171c4e[_0x684a('0x3f')][_0x684a('0x44')]));_0x364849['attributes']=_0x364849[_0x684a('0x43')][_0x684a('0x45')]?_0x364849['attributes']:_0x2d3fad[_0x684a('0x3e')];if(!_0x171c4e[_0x684a('0x3f')][_0x684a('0x46')](_0x684a('0x47'))){_0x364849[_0x684a('0x2b')]=qs[_0x684a('0x2b')](_0x171c4e['query'][_0x684a('0x2b')]);_0x364849[_0x684a('0x29')]=qs[_0x684a('0x29')](_0x171c4e['query'][_0x684a('0x29')]);}_0x364849[_0x684a('0x48')]=qs['sort'](_0x171c4e[_0x684a('0x3f')][_0x684a('0x49')]);_0x364849[_0x684a('0x4a')]=qs[_0x684a('0x41')](_[_0x684a('0x68')](_0x171c4e['query'],_0x2d3fad['filters']));_0x364849['where'][_0x684a('0x5f')]=_0x34198b['id'];if(_0x171c4e[_0x684a('0x3f')][_0x684a('0x4d')]){_0x364849['where']=_['merge'](_0x364849[_0x684a('0x4a')],{'$or':_[_0x684a('0x39')](_0x364849[_0x684a('0x43')],function(_0x38e92c){var _0x2cea81={};_0x2cea81[_0x38e92c]={'$like':'%'+_0x171c4e['query'][_0x684a('0x4d')]+'%'};return _0x2cea81;})});}_0x364849=_[_0x684a('0x4b')]({},_0x364849,_0x171c4e[_0x684a('0x54')]);return db['CannedAnswer'][_0x684a('0x2c')]({'where':_0x364849[_0x684a('0x4a')]})['then'](function(_0x5e0ee8){_0x55792c[_0x684a('0x2c')]=_0x5e0ee8;if(_0x171c4e['query'][_0x684a('0x63')]){_0x364849[_0x684a('0x69')]=[{'all':!![]}];}return db[_0x684a('0x66')]['findAll'](_0x364849);})[_0x684a('0x1b')](function(_0x15a46c){_0x55792c[_0x684a('0x4f')]=_0x15a46c;return _0x55792c;});}})[_0x684a('0x1b')](respondWithFilteredResult(_0xfa6f50,_0x364849))[_0x684a('0x25')](handleError(_0xfa6f50,null));};exports[_0x684a('0x6a')]=function(_0x4b7436,_0x2fb920,_0x3b0744){return db[_0x684a('0x3a')]['find']({'where':{'id':_0x4b7436['params']['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0x2fb920,null))[_0x684a('0x1b')](function(_0x1abe8b){if(_0x1abe8b){return _0x1abe8b[_0x684a('0x6a')](_0x4b7436[_0x684a('0x3f')][_0x684a('0x6b')]);}})[_0x684a('0x1b')](respondWithStatusCode(_0x2fb920,null))[_0x684a('0x25')](handleError(_0x2fb920,null));};exports[_0x684a('0x6c')]=function(_0x549995,_0x2754b8,_0x16a46d){return db['FaxInteraction'][_0x684a('0x59')]({'where':{'id':_0x549995[_0x684a('0x51')]['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0x2754b8,null))[_0x684a('0x1b')](function(_0x4b4d6c){if(_0x4b4d6c){return _0x4b4d6c[_0x684a('0x6c')](_0x549995[_0x684a('0x5c')][_0x684a('0x6b')],_['omit'](_0x549995[_0x684a('0x5c')],['ids','id'])||{});}})[_0x684a('0x1b')](respondWithResult(_0x2754b8,null))[_0x684a('0x25')](handleError(_0x2754b8,null));};exports['getInteractions']=function(_0xabcbd2,_0x190a37,_0x4715cc){var _0x4f677e={'raw':![],'where':{}};var _0x9074a6={};var _0x3030ba={'count':0x0,'rows':[]};return db['FaxAccount'][_0x684a('0x61')]({'where':{'id':_0xabcbd2[_0x684a('0x51')]['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0x190a37,null))['then'](function(_0x283d2e){if(_0x283d2e){_0x9074a6[_0x684a('0x3e')]=_['keys'](db[_0x684a('0x6d')]['rawAttributes']);_0x9074a6[_0x684a('0x3f')]=_[_0x684a('0x40')](_0xabcbd2['query']);_0x9074a6[_0x684a('0x41')]=_[_0x684a('0x42')](_0x9074a6[_0x684a('0x3e')],_0x9074a6['query']);_0x4f677e[_0x684a('0x43')]=_[_0x684a('0x42')](_0x9074a6[_0x684a('0x3e')],qs[_0x684a('0x44')](_0xabcbd2['query']['fields']));_0x4f677e[_0x684a('0x43')]=_0x4f677e['attributes'][_0x684a('0x45')]?_0x4f677e[_0x684a('0x43')]:_0x9074a6['model'];if(!_0xabcbd2[_0x684a('0x3f')][_0x684a('0x46')](_0x684a('0x47'))){_0x4f677e['limit']=qs['limit'](_0xabcbd2['query'][_0x684a('0x2b')]);_0x4f677e[_0x684a('0x29')]=qs[_0x684a('0x29')](_0xabcbd2['query']['offset']);}_0x4f677e[_0x684a('0x48')]=qs[_0x684a('0x49')](_0xabcbd2['query'][_0x684a('0x49')]);_0x4f677e[_0x684a('0x4a')]=qs[_0x684a('0x41')](_[_0x684a('0x68')](_0xabcbd2[_0x684a('0x3f')],_0x9074a6[_0x684a('0x41')]));_0x4f677e['where'][_0x684a('0x5f')]=_0x283d2e['id'];if(_0xabcbd2[_0x684a('0x3f')][_0x684a('0x4d')]){_0x4f677e['where']=_[_0x684a('0x4b')](_0x4f677e[_0x684a('0x4a')],{'$or':_['map'](_0x4f677e['attributes'],function(_0x39df54){var _0x42e7f5={};_0x42e7f5[_0x39df54]={'$like':'%'+_0xabcbd2[_0x684a('0x3f')][_0x684a('0x4d')]+'%'};return _0x42e7f5;})});}_0x4f677e=_['merge']({},_0x4f677e,_0xabcbd2['options']);return db[_0x684a('0x6d')]['count']({'where':_0x4f677e[_0x684a('0x4a')]})[_0x684a('0x1b')](function(_0x181bc0){_0x3030ba[_0x684a('0x2c')]=_0x181bc0;if(_0xabcbd2[_0x684a('0x3f')][_0x684a('0x63')]){_0x4f677e[_0x684a('0x69')]=[{'model':db['CmContact'],'as':_0x684a('0x6e'),'required':![]},{'model':db['User'],'as':_0x684a('0x6f'),'attributes':[_0x684a('0x36'),'fullname',_0x684a('0x70')],'required':![]},{'model':db[_0x684a('0x71')],'as':_0x684a('0x72'),'attributes':['id',_0x684a('0x36'),_0x684a('0x73')],'where':_0xabcbd2['query'][_0x684a('0x74')]?{'id':_0xabcbd2[_0x684a('0x3f')]['tag']}:undefined,'required':_0xabcbd2[_0x684a('0x3f')][_0x684a('0x74')]?!![]:![]}];}return db[_0x684a('0x6d')]['findAll'](_0x4f677e);})[_0x684a('0x1b')](function(_0xbe7caf){_0x3030ba['rows']=_0xbe7caf;return _0x3030ba;});}})['then'](respondWithFilteredResult(_0x190a37,_0x4f677e))[_0x684a('0x25')](handleError(_0x190a37,null));};exports[_0x684a('0x75')]=function(_0x21f51e,_0x16bc7c){var _0x592277=_0x21f51e[_0x684a('0x51')]['id'];var _0x46fd86=_0x21f51e[_0x684a('0x5c')];var _0x2e7346=0xc8;var _0x5ca442=null;return db[_0x684a('0x76')][_0x684a('0x77')]({'isolationLevel':db[_0x684a('0x76')][_0x684a('0x78')][_0x684a('0x79')]['READ_COMMITTED']},function(_0x9b1b44){return db['FaxAccount'][_0x684a('0x61')]({'where':{'id':_0x592277},'transaction':_0x9b1b44})[_0x684a('0x1b')](function(_0x50ae10){if(_0x50ae10){return db[_0x684a('0x7a')][_0x684a('0x31')]({'where':{'FaxAccountId':_0x592277},'transaction':_0x9b1b44})[_0x684a('0x1b')](function(){var _0xc6738d=_['map'](_0x46fd86,function(_0x605cea){_0x605cea[_0x684a('0x5f')]=_0x592277;return _0x605cea;});return db[_0x684a('0x7a')][_0x684a('0x7b')](_0xc6738d,{'transaction':_0x9b1b44});});}else{_0x2e7346=0x194;_0x5ca442=[];}});})[_0x684a('0x1b')](function(){if(_0x2e7346!==0x194){return db['FaxApplication'][_0x684a('0x7c')]({'where':{'FaxAccountId':_0x592277},'order':'priority'})[_0x684a('0x1b')](function(_0x1f0ef1){_0x5ca442=_0x1f0ef1;});}})[_0x684a('0x25')](function(_0xb553c9){_0x2e7346=0x1f4;logger[_0x684a('0x1f')](_0xb553c9[_0x684a('0x7d')]);if(_0xb553c9[_0x684a('0x36')]){delete _0xb553c9[_0x684a('0x36')];}_0x5ca442=_0xb553c9;})['finally'](function(){if(_0x5ca442===null){_0x16bc7c[_0x684a('0x26')](_0x2e7346);}else{if(_0x2e7346===0x1f4){_0x16bc7c[_0x684a('0x27')](_0x2e7346)[_0x684a('0x37')](_0x5ca442);}else{_0x16bc7c[_0x684a('0x27')](_0x2e7346)[_0x684a('0x28')](_0x5ca442);}}});};exports[_0x684a('0x7e')]=function(_0x2a1a12,_0xad76a4,_0x23e1a5){var _0x13fee2={};var _0x3a86f1={};var _0x1c3e6b;var _0x591467;return db[_0x684a('0x3a')][_0x684a('0x61')]({'where':{'id':_0x2a1a12[_0x684a('0x51')]['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0xad76a4,null))[_0x684a('0x1b')](function(_0x57cfc3){if(_0x57cfc3){_0x1c3e6b=_0x57cfc3;_0x3a86f1[_0x684a('0x3e')]=_[_0x684a('0x40')](db[_0x684a('0x7a')][_0x684a('0x3b')]);_0x3a86f1[_0x684a('0x3f')]=_[_0x684a('0x40')](_0x2a1a12[_0x684a('0x3f')]);_0x3a86f1[_0x684a('0x41')]=_['intersection'](_0x3a86f1[_0x684a('0x3e')],_0x3a86f1['query']);_0x13fee2[_0x684a('0x43')]=_[_0x684a('0x42')](_0x3a86f1['model'],qs[_0x684a('0x44')](_0x2a1a12[_0x684a('0x3f')][_0x684a('0x44')]));_0x13fee2['attributes']=_0x13fee2[_0x684a('0x43')][_0x684a('0x45')]?_0x13fee2['attributes']:_0x3a86f1[_0x684a('0x3e')];_0x13fee2[_0x684a('0x48')]=qs[_0x684a('0x49')](_0x2a1a12[_0x684a('0x3f')][_0x684a('0x49')]);_0x13fee2[_0x684a('0x4a')]=qs[_0x684a('0x41')](_[_0x684a('0x68')](_0x2a1a12['query'],_0x3a86f1[_0x684a('0x41')]));if(_0x2a1a12[_0x684a('0x3f')][_0x684a('0x4d')]){_0x13fee2[_0x684a('0x4a')]=_[_0x684a('0x4b')](_0x13fee2['where'],{'$or':_[_0x684a('0x39')](_0x13fee2['attributes'],function(_0x473d70){var _0x1a9795={};_0x1a9795[_0x473d70]={'$like':'%'+_0x2a1a12[_0x684a('0x3f')][_0x684a('0x4d')]+'%'};return _0x1a9795;})});}_0x13fee2=_['merge']({},_0x13fee2,_0x2a1a12['options']);return _0x1c3e6b['getApplications'](_0x13fee2);}})['then'](function(_0x151325){if(_0x151325){_0x591467=_0x151325[_0x684a('0x45')];if(!_0x2a1a12[_0x684a('0x3f')][_0x684a('0x46')](_0x684a('0x47'))){_0x13fee2[_0x684a('0x2b')]=qs[_0x684a('0x2b')](_0x2a1a12[_0x684a('0x3f')]['limit']);_0x13fee2['offset']=qs[_0x684a('0x29')](_0x2a1a12[_0x684a('0x3f')]['offset']);}return _0x1c3e6b[_0x684a('0x7e')](_0x13fee2);}})['then'](function(_0x31c892){if(_0x31c892){return _0x31c892?{'count':_0x591467,'rows':_0x31c892}:null;}})[_0x684a('0x1b')](respondWithResult(_0xad76a4,null))['catch'](handleError(_0xad76a4,null));};function Extension(_0xf6db71,_0x143206,_0x332075,_0x1ed60a){this[_0x684a('0x7f')]=_0x684a('0x80');this[_0x684a('0x81')]=_0xf6db71[_0x684a('0x82')];this[_0x684a('0x83')]=_0x1ed60a;this[_0x684a('0x3c')]=_0x684a('0x84');this[_0x684a('0x85')]=_0x684a('0x86');this[_0x684a('0x5f')]=_0xf6db71['id'];this['priority']=_0x143206;this['appdata']=_0x332075;}function createExtensionsReciveFax(_0x435f30){var _0x2a426e=0x1;var _0x5730b8=[];_0x5730b8[_0x684a('0x87')](new Extension(_0x435f30,_0x2a426e,'',_0x684a('0x88')));_0x2a426e+=0x1;_0x5730b8[_0x684a('0x87')](new Extension(_0x435f30,_0x2a426e,'CDR(type)=inbound-fax',_0x684a('0x89')));_0x2a426e+=0x1;for(var _0x1a04bc in _0x435f30){if(_0x435f30['hasOwnProperty'](_0x1a04bc)&&(_0x1a04bc===_0x684a('0x8a')||_0x1a04bc==='localstationid'||_0x1a04bc===_0x684a('0x8b')||_0x1a04bc===_0x684a('0x8c')||_0x1a04bc===_0x684a('0x8d')||_0x1a04bc===_0x684a('0x8e')||_0x1a04bc===_0x684a('0x8f')||_0x1a04bc===_0x684a('0x90')||_0x1a04bc==='t38timeout')){_0x5730b8[_0x684a('0x87')](new Extension(_0x435f30,_0x2a426e,_0x684a('0x91')+_0x1a04bc+')='+_0x435f30[_0x1a04bc],_0x684a('0x89')));_0x2a426e+=0x1;}}_0x5730b8['push'](new Extension(_0x435f30,_0x2a426e,'6',_0x684a('0x92')));_0x2a426e+=0x1;_0x5730b8[_0x684a('0x87')](new Extension(_0x435f30,_0x2a426e,'/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',_0x684a('0x93')));_0x2a426e=0x0;return _0x5730b8;}exports[_0x684a('0x94')]=function(_0x3c1885,_0x36cf74,_0x2db757){var _0x449d55;return db['sequelize'][_0x684a('0x77')](function(_0xf54216){return db[_0x684a('0x3a')][_0x684a('0x5a')](_0x3c1885[_0x684a('0x5c')],{'transaction':_0xf54216})['then'](function(_0x36d03a){_0x449d55=_0x36d03a['get']({'plain':!![]});return db[_0x684a('0x95')]['bulkCreate'](createExtensionsReciveFax(_0x449d55),{'transaction':_0xf54216});});})[_0x684a('0x1b')](function(){return _0x449d55;})[_0x684a('0x1b')](respondWithResult(_0x36cf74,null))['catch'](handleError(_0x36cf74,null));};exports[_0x684a('0x96')]=function(_0x2d39e2,_0x330cc2,_0x1a6d1e){var _0x1065ee;return db['sequelize']['transaction'](function(_0x4ae9fa){return db[_0x684a('0x3a')][_0x684a('0x30')](_0x2d39e2[_0x684a('0x5c')],{'where':{'id':_0x2d39e2[_0x684a('0x5c')]['id']},'transaction':_0x4ae9fa})[_0x684a('0x1b')](function(_0xcf3bd1){return db[_0x684a('0x95')][_0x684a('0x31')]({'where':{'FaxAccountId':_0x2d39e2[_0x684a('0x5c')]['id']},'transaction':_0x4ae9fa})[_0x684a('0x1b')](function(_0x3e526d){return db[_0x684a('0x95')][_0x684a('0x7b')](createExtensionsReciveFax(_[_0x684a('0x97')](_0x2d39e2[_0x684a('0x5c')],[_0x684a('0x98'),_0x684a('0x3d'),_0x684a('0x99'),'updatedAt',_0x684a('0x9a'),_0x684a('0x9b')])),{'transaction':_0x4ae9fa});});});})['then'](function(){return db[_0x684a('0x3a')][_0x684a('0x9c')](_0x2d39e2[_0x684a('0x5c')]['id']);})[_0x684a('0x1b')](respondWithResult(_0x330cc2,null))['catch'](handleError(_0x330cc2,null));};exports[_0x684a('0x9d')]=function(_0x2abf38,_0x4dfb2a,_0x24ba11){var _0x2dd14e={'raw':!![],'where':{}};var _0x5e823d={};var _0x44acbc={'count':0x0,'rows':[]};return db['FaxAccount'][_0x684a('0x61')]({'where':{'id':_0x2abf38[_0x684a('0x51')]['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0x4dfb2a,null))['then'](function(_0x57da51){if(_0x57da51){_0x5e823d['model']=_[_0x684a('0x40')](db[_0x684a('0x9e')][_0x684a('0x3b')]);_0x5e823d['query']=_[_0x684a('0x40')](_0x2abf38['query']);_0x5e823d[_0x684a('0x41')]=_[_0x684a('0x42')](_0x5e823d[_0x684a('0x3e')],_0x5e823d[_0x684a('0x3f')]);_0x2dd14e['attributes']=_[_0x684a('0x42')](_0x5e823d[_0x684a('0x3e')],qs['fields'](_0x2abf38['query'][_0x684a('0x44')]));_0x2dd14e[_0x684a('0x43')]=_0x2dd14e[_0x684a('0x43')][_0x684a('0x45')]?_0x2dd14e['attributes']:_0x5e823d[_0x684a('0x3e')];if(!_0x2abf38[_0x684a('0x3f')][_0x684a('0x46')]('nolimit')){_0x2dd14e['limit']=qs[_0x684a('0x2b')](_0x2abf38[_0x684a('0x3f')][_0x684a('0x2b')]);_0x2dd14e[_0x684a('0x29')]=qs[_0x684a('0x29')](_0x2abf38[_0x684a('0x3f')][_0x684a('0x29')]);}_0x2dd14e[_0x684a('0x48')]=qs[_0x684a('0x49')](_0x2abf38[_0x684a('0x3f')][_0x684a('0x49')]);_0x2dd14e['where']=qs['filters'](_['pick'](_0x2abf38[_0x684a('0x3f')],_0x5e823d[_0x684a('0x41')]));_0x2dd14e[_0x684a('0x4a')][_0x684a('0x5f')]=_0x57da51['id'];if(_0x2abf38[_0x684a('0x3f')][_0x684a('0x4d')]){_0x2dd14e[_0x684a('0x4a')]=_[_0x684a('0x4b')](_0x2dd14e[_0x684a('0x4a')],{'$or':_['map'](_0x2dd14e['attributes'],function(_0x1e633a){var _0x9ac49c={};_0x9ac49c[_0x1e633a]={'$like':'%'+_0x2abf38[_0x684a('0x3f')][_0x684a('0x4d')]+'%'};return _0x9ac49c;})});}if(_0x2abf38[_0x684a('0x3f')][_0x684a('0x9f')]){var _0x2cb9ae=_0x2abf38[_0x684a('0x3f')][_0x684a('0x9f')][_0x684a('0xa0')](',');var _0x2d7890={};_0x2d7890[_0x2cb9ae[0x0]]={'$gte':moment(_0x2cb9ae[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2dd14e[_0x684a('0x4a')]=_[_0x684a('0x4b')](_0x2dd14e[_0x684a('0x4a')],_0x2d7890);}_0x2dd14e=_[_0x684a('0x4b')]({},_0x2dd14e,_0x2abf38[_0x684a('0x54')]);return db[_0x684a('0x9e')][_0x684a('0x2c')]({'where':_0x2dd14e[_0x684a('0x4a')]})[_0x684a('0x1b')](function(_0x32e017){_0x44acbc[_0x684a('0x2c')]=_0x32e017;if(_0x2abf38[_0x684a('0x3f')][_0x684a('0x63')]){_0x2dd14e['include']=[{'all':!![]}];}return db[_0x684a('0x9e')]['findAll'](_0x2dd14e);})['then'](function(_0x5c6c40){_0x44acbc['rows']=_0x5c6c40;return _0x44acbc;});}})['then'](respondWithFilteredResult(_0x4dfb2a,_0x2dd14e))[_0x684a('0x25')](handleError(_0x4dfb2a,null));};exports[_0x684a('0x37')]=function(_0x79a0a6,_0x17bac4,_0x4f55b7){var _0x5e8013,_0x263753={},_0x4d720f;if(_0x79a0a6[_0x684a('0x5c')]['to']){_0x4d720f=_0x79a0a6['body']['to'][0x0];}return db['FaxAccount'][_0x684a('0x59')]({'where':{'id':_0x79a0a6[_0x684a('0x51')]['id']},'include':[{'model':db[_0x684a('0xa1')],'as':_0x684a('0xa2'),'include':[{'model':db[_0x684a('0xa3')],'as':'Contacts','where':{'fax':_0x4d720f},'limit':0x1,'order':[[_0x684a('0xa4'),_0x684a('0xa5')]]}]}]})[_0x684a('0x1b')](handleEntityNotFound(_0x17bac4,null))[_0x684a('0x1b')](function(_0x468d18){_0x5e8013=_0x468d18;if(_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')]&&_0x79a0a6['body'][_0x684a('0xa6')][_0x684a('0x45')]){for(var _0x7614c2=0x0;_0x7614c2<_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][_0x684a('0x45')];_0x7614c2+=0x1){_0x79a0a6[_0x684a('0x5c')]['attachments'][_0x7614c2]={'filename':_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][_0x7614c2][_0x684a('0x36')],'id':_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][_0x7614c2]['id'],'path':path['join'](config[_0x684a('0xa7')],_0x684a('0xa8'),_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][_0x7614c2]['basename'])};}}return respondWithRpcPromise(_0x684a('0xa9'),_0x684a('0xa9'),{'FaxAccountId':_[_0x684a('0xaa')](_0x79a0a6[_0x684a('0x51')]['id'])?undefined:_0x79a0a6[_0x684a('0x51')]['id'],'path':_[_0x684a('0xaa')](_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][0x0][_0x684a('0x4')])?undefined:_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][0x0][_0x684a('0x4')],'fax':_[_0x684a('0xaa')](_0x79a0a6['body']['to'][0x0])?undefined:_0x79a0a6['body']['to'][0x0]},client9002);})[_0x684a('0x1b')](function(){if(_0x5e8013){if(_[_0x684a('0xaa')](_0x79a0a6[_0x684a('0x5c')][_0x684a('0xab')])){_0x79a0a6[_0x684a('0x5c')]['from']=util[_0x684a('0xac')](_0x684a('0xad'),_0x5e8013[_0x684a('0x36')],_0x5e8013[_0x684a('0xae')]);}if(_0x5e8013[_0x684a('0xa2')]){if(_0x5e8013[_0x684a('0xa2')][_0x684a('0xaf')][_0x684a('0x45')]){return _0x5e8013[_0x684a('0xa2')][_0x684a('0xaf')][0x0];}else{return db[_0x684a('0xa3')][_0x684a('0x5a')](_[_0x684a('0xb0')](_0x79a0a6[_0x684a('0x5c')],{'firstName':_0x79a0a6[_0x684a('0x5c')]['to'][0x0],'phone':_0x79a0a6[_0x684a('0x5c')]['to'][0x0],'fax':_0x79a0a6[_0x684a('0x5c')]['to'][0x0],'ListId':_0x5e8013[_0x684a('0x9b')]}));}}else{throw new Error(_0x684a('0xb1'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x684a('0x1b')](function(_0xe906dc){if(_0xe906dc){return db[_0x684a('0x6d')][_0x684a('0x59')]({'where':{'ContactId':_0xe906dc['id'],'closed':![],'FaxAccountId':_0x5e8013['id']}})[_0x684a('0x1b')](function(_0x86aec9){if(_0x86aec9){return[_0x86aec9,![]];}return db[_0x684a('0x6d')][_0x684a('0x5a')]({'UserId':_0x79a0a6[_0x684a('0x55')]['id'],'ContactId':_0xe906dc['id'],'FaxAccountId':_0x5e8013['id'],'fax':_0x79a0a6[_0x684a('0x5c')]['to'][0x0],'firstMsgDirection':_0x684a('0xb2'),'Messages':[_[_0x684a('0x4b')](_0x79a0a6[_0x684a('0x5c')],{'read':![],'body':_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][0x0][_0x684a('0xb3')],'FaxAccountId':_0x5e8013['id'],'UserId':_0x79a0a6[_0x684a('0x55')]['id'],'ContactId':_0xe906dc['id'],'AttachmentId':_0x79a0a6['body'][_0x684a('0xa6')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0x684a('0x1b')](function(_0x2dec3c){return[_0x2dec3c,!![]];});});}else{throw new Error(_0x684a('0xb4'));}})[_0x684a('0xb5')](function(_0xe8e2fb,_0x4ace67){if(_0x4ace67){return _0xe8e2fb;}return db[_0x684a('0x9e')][_0x684a('0x5a')]({'direction':_0x684a('0xb2'),'read':![],'body':_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][0x0][_0x684a('0xb3')],'FaxAccountId':_0x5e8013['id'],'FaxInteractionId':_0xe8e2fb['id'],'UserId':_0x79a0a6[_0x684a('0x55')]['id'],'ContactId':_0xe8e2fb[_0x684a('0xb6')],'AttachmentId':_0x79a0a6['body']['attachments'][0x0]['id']})[_0x684a('0x1b')](function(_0x334a87){_0xe8e2fb[_0x684a('0xb7')][_0x684a('0xb8')]=[];_0xe8e2fb[_0x684a('0xb7')][_0x684a('0xb8')]['push'](_0x334a87[_0x684a('0xb7')]);return _0xe8e2fb;});})[_0x684a('0x1b')](function(_0x8fdef6){respondWithRpcPromise(_0x684a('0xb9'),_0x684a('0xb9'),{'FaxAccountId':_[_0x684a('0xaa')](_0x79a0a6['params']['id'])?undefined:_0x79a0a6[_0x684a('0x51')]['id'],'path':_[_0x684a('0xaa')](_0x79a0a6['body'][_0x684a('0xa6')][0x0][_0x684a('0x4')])?undefined:_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][0x0][_0x684a('0x4')],'fax':_['isNil'](_0x79a0a6[_0x684a('0x5c')]['to'][0x0])?undefined:_0x79a0a6[_0x684a('0x5c')]['to'][0x0],'AttachmentId':_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][0x0]['id']},client9002)[_0x684a('0x1b')](function(_0x9fa64c){logger[_0x684a('0x23')](_0x684a('0xba'),_0x9fa64c);})[_0x684a('0x25')](function(_0x5a08d5){logger[_0x684a('0x23')]('SendFaxRpc,\x20%s',_0x5a08d5);});return _0x8fdef6;})['then'](respondWithResult(_0x17bac4,null))[_0x684a('0x25')](handleError(_0x17bac4,null));};exports['addAgents']=function(_0x4e57a6,_0x50a31a,_0x273147){return db[_0x684a('0x3a')][_0x684a('0x59')]({'where':{'id':_0x4e57a6[_0x684a('0x51')]['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0x50a31a,null))[_0x684a('0x1b')](function(_0x5434a8){if(_0x5434a8){return _0x5434a8['addAgents'](_0x4e57a6[_0x684a('0x5c')]['ids'],_[_0x684a('0x97')](_0x4e57a6[_0x684a('0x5c')],[_0x684a('0x6b'),'id'])||{})['spread'](function(_0x1567b7){for(var _0x3bc943=0x0;_0x3bc943<_0x4e57a6[_0x684a('0x5c')]['ids'][_0x684a('0x45')];_0x3bc943+=0x1){socket[_0x684a('0xbb')](_0x684a('0xbc'),{'UserId':Number(_0x4e57a6[_0x684a('0x5c')][_0x684a('0x6b')][_0x3bc943]),'FaxAccountId':Number(_0x4e57a6[_0x684a('0x51')]['id'])});}return _0x1567b7;});}})[_0x684a('0x1b')](respondWithResult(_0x50a31a,null))[_0x684a('0x25')](handleError(_0x50a31a,null));};exports[_0x684a('0xbd')]=function(_0x26c87e,_0x58c651,_0x7ed757){return db[_0x684a('0x3a')][_0x684a('0x59')]({'where':{'id':_0x26c87e[_0x684a('0x51')]['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0x58c651,null))['then'](function(_0x2c7f79){if(_0x2c7f79){return _0x2c7f79[_0x684a('0xbd')](_0x26c87e['query']['ids'])[_0x684a('0x1b')](function(){if(_[_0x684a('0xbe')](_0x26c87e['query'][_0x684a('0x6b')])){for(var _0x556281=0x0;_0x556281<_0x26c87e[_0x684a('0x3f')][_0x684a('0x6b')][_0x684a('0x45')];_0x556281+=0x1){socket[_0x684a('0xbb')](_0x684a('0xbf'),{'UserId':Number(_0x26c87e[_0x684a('0x3f')][_0x684a('0x6b')][_0x556281]),'FaxAccountId':Number(_0x26c87e['params']['id'])});}}else{socket[_0x684a('0xbb')](_0x684a('0xbf'),{'UserId':Number(_0x26c87e[_0x684a('0x3f')][_0x684a('0x6b')]),'FaxAccountId':Number(_0x26c87e[_0x684a('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x58c651,null))[_0x684a('0x25')](handleError(_0x58c651,null));};exports['getAgents']=function(_0x98f45c,_0x3c592e,_0x2fec86){var _0x5a9131={};var _0x4046cc={};var _0xfb4114;var _0xda4e98;return db[_0x684a('0x3a')]['findOne']({'where':{'id':_0x98f45c['params']['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0x3c592e,null))[_0x684a('0x1b')](function(_0x587e5c){if(_0x587e5c){_0xfb4114=_0x587e5c;_0x4046cc['model']=_[_0x684a('0x40')](db['User'][_0x684a('0x3b')]);_0x4046cc[_0x684a('0x3f')]=_[_0x684a('0x40')](_0x98f45c[_0x684a('0x3f')]);_0x4046cc[_0x684a('0x41')]=_['intersection'](_0x4046cc['model'],_0x4046cc['query']);_0x5a9131['attributes']=_[_0x684a('0x42')](_0x4046cc[_0x684a('0x3e')],qs[_0x684a('0x44')](_0x98f45c['query']['fields']));_0x5a9131[_0x684a('0x43')]=_0x5a9131[_0x684a('0x43')]['length']?_0x5a9131[_0x684a('0x43')]:_0x4046cc[_0x684a('0x3e')];_0x5a9131[_0x684a('0x48')]=qs[_0x684a('0x49')](_0x98f45c[_0x684a('0x3f')][_0x684a('0x49')]);_0x5a9131[_0x684a('0x4a')]=qs['filters'](_[_0x684a('0x68')](_0x98f45c['query'],_0x4046cc[_0x684a('0x41')]));if(_0x98f45c[_0x684a('0x3f')][_0x684a('0x4d')]){_0x5a9131[_0x684a('0x4a')]=_['merge'](_0x5a9131['where'],{'$or':_['map'](_0x5a9131[_0x684a('0x43')],function(_0x3b151c){var _0x4a66b4={};_0x4a66b4[_0x3b151c]={'$like':'%'+_0x98f45c['query'][_0x684a('0x4d')]+'%'};return _0x4a66b4;})});}_0x5a9131=_['merge']({},_0x5a9131,_0x98f45c[_0x684a('0x54')]);return _0xfb4114['getAgents'](_0x5a9131);}})[_0x684a('0x1b')](function(_0x5a08f0){if(_0x5a08f0){_0xda4e98=_0x5a08f0[_0x684a('0x45')];if(!_0x98f45c[_0x684a('0x3f')][_0x684a('0x46')](_0x684a('0x47'))){_0x5a9131[_0x684a('0x2b')]=qs[_0x684a('0x2b')](_0x98f45c[_0x684a('0x3f')][_0x684a('0x2b')]);_0x5a9131[_0x684a('0x29')]=qs[_0x684a('0x29')](_0x98f45c[_0x684a('0x3f')][_0x684a('0x29')]);}return _0xfb4114[_0x684a('0xc0')](_0x5a9131);}})[_0x684a('0x1b')](function(_0x351179){if(_0x351179){return _0x351179?{'count':_0xda4e98,'rows':_0x351179}:null;}})[_0x684a('0x1b')](respondWithResult(_0x3c592e,null))[_0x684a('0x25')](handleError(_0x3c592e,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 3823399..881d2b8 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 _0xb09a=['../../mysqldb','FaxAccount','update','emit','hook','exports','events'];(function(_0x28253c,_0x1cf1b4){var _0xa357d8=function(_0x112da8){while(--_0x112da8){_0x28253c['push'](_0x28253c['shift']());}};_0xa357d8(++_0x1cf1b4);}(_0xb09a,0xe6));var _0xab09=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xb09a[_0x263a74];return _0x2aa86c;};'use strict';var EventEmitter=require(_0xab09('0x0'));var FaxAccount=require(_0xab09('0x1'))['db'][_0xab09('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xab09('0x3'),'afterDestroy':'remove'};function emitEvent(_0x418991){return function(_0x4dbb7f,_0xc186ca,_0x2fb92d){FaxAccountEvents[_0xab09('0x4')](_0x418991+':'+_0x4dbb7f['id'],_0x4dbb7f);FaxAccountEvents[_0xab09('0x4')](_0x418991,_0x4dbb7f);_0x2fb92d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xab09('0x5')](e,emitEvent(event));}}module[_0xab09('0x6')]=FaxAccountEvents; \ No newline at end of file +var _0xbfe2=['../../mysqldb','FaxAccount','setMaxListeners','hook','exports','events'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xbfe2,0x16d));var _0x2bfe=function(_0x5adce5,_0x3938fb){_0x5adce5=_0x5adce5-0x0;var _0x2666ac=_0xbfe2[_0x5adce5];return _0x2666ac;};'use strict';var EventEmitter=require(_0x2bfe('0x0'));var FaxAccount=require(_0x2bfe('0x1'))['db'][_0x2bfe('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x2bfe('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xdd77c8){return function(_0x35f3ca,_0x1deaf7,_0x3a48fc){FaxAccountEvents['emit'](_0xdd77c8+':'+_0x35f3ca['id'],_0x35f3ca);FaxAccountEvents['emit'](_0xdd77c8,_0x35f3ca);_0x3a48fc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x2bfe('0x4')](e,emitEvent(event));}}module[_0x2bfe('0x5')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 5bf29c5..059bfd0 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 _0xde0c=['bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','util','../../config/logger','api','moment'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xde0c,0x1d0));var _0xcde0=function(_0x54b171,_0x3ba074){_0x54b171=_0x54b171-0x0;var _0x5cdb4d=_0xde0c[_0x54b171];return _0x5cdb4d;};'use strict';var _=require('lodash');var util=require(_0xcde0('0x0'));var logger=require(_0xcde0('0x1'))(_0xcde0('0x2'));var moment=require(_0xcde0('0x3'));var BPromise=require(_0xcde0('0x4'));var rp=require(_0xcde0('0x5'));var fs=require('fs');var path=require(_0xcde0('0x6'));var rimraf=require(_0xcde0('0x7'));var config=require(_0xcde0('0x8'));var attributes=require(_0xcde0('0x9'));module['exports']=function(_0x1b5b74,_0x359290){return _0x1b5b74[_0xcde0('0xa')](_0xcde0('0xb'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd894=['rimraf','./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x279d53,_0x27bfd9){var _0x52d883=function(_0x26d810){while(--_0x26d810){_0x279d53['push'](_0x279d53['shift']());}};_0x52d883(++_0x27bfd9);}(_0xd894,0xb9));var _0x4d89=function(_0x33c126,_0x36f522){_0x33c126=_0x33c126-0x0;var _0x4414f9=_0xd894[_0x33c126];return _0x4414f9;};'use strict';var _=require(_0x4d89('0x0'));var util=require(_0x4d89('0x1'));var logger=require('../../config/logger')(_0x4d89('0x2'));var moment=require(_0x4d89('0x3'));var BPromise=require(_0x4d89('0x4'));var rp=require(_0x4d89('0x5'));var fs=require('fs');var path=require(_0x4d89('0x6'));var rimraf=require(_0x4d89('0x7'));var config=require('../../config/environment');var attributes=require(_0x4d89('0x8'));module['exports']=function(_0x168277,_0x3fabc9){return _0x168277[_0x4d89('0x9')](_0x4d89('0xa'),attributes,{'tableName':_0x4d89('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 31a2c76..d938bae 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 _0x54ab=['http','redis','defaults','localhost','./faxAccount.socket','register','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','FaxAccount','findAll','options','raw','where','attributes','include','map','model','then','GetFaxAccount','stringify','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','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','find','account','List','DESC','FaxApplication','get','Applications','list','applications','orderBy','priority','Contacts','length','create','FaxInteraction','Contact\x20not\x20found','push','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x48f827,_0x269e8d){var _0xc763f7=function(_0x19769a){while(--_0x19769a){_0x48f827['push'](_0x48f827['shift']());}};_0xc763f7(++_0x269e8d);}(_0x54ab,0x100));var _0xb54a=function(_0x56e6bd,_0x50e7e0){_0x56e6bd=_0x56e6bd-0x0;var _0x38c4a9=_0x54ab[_0x56e6bd];return _0x38c4a9;};'use strict';var _=require('lodash');var util=require(_0xb54a('0x0'));var moment=require(_0xb54a('0x1'));var BPromise=require(_0xb54a('0x2'));var rs=require(_0xb54a('0x3'));var fs=require('fs');var Redis=require(_0xb54a('0x4'));var db=require(_0xb54a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb54a('0x6'))(_0xb54a('0x7'));var config=require(_0xb54a('0x8'));var jayson=require(_0xb54a('0x9'));var client=jayson[_0xb54a('0xa')][_0xb54a('0xb')]({'port':0x232c});config[_0xb54a('0xc')]=_[_0xb54a('0xd')](config[_0xb54a('0xc')],{'host':_0xb54a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb54a('0xf'))[_0xb54a('0x10')](socket);function respondWithRpcPromise(_0x3c4988,_0x5947c4,_0x5b55f8){return new BPromise(function(_0x5d2ea4,_0x208303){return client['request'](_0x3c4988,_0x5b55f8)['then'](function(_0x536cd8){logger[_0xb54a('0x11')](_0xb54a('0x12'),_0x5947c4,'request\x20sent');logger[_0xb54a('0x13')](_0xb54a('0x14'),_0x5947c4,_0xb54a('0x15'),JSON['stringify'](_0x536cd8));if(_0x536cd8[_0xb54a('0x16')]){if(_0x536cd8[_0xb54a('0x16')][_0xb54a('0x17')]===0x1f4){logger[_0xb54a('0x16')](_0xb54a('0x12'),_0x5947c4,_0x536cd8[_0xb54a('0x16')]['message']);return _0x208303(_0x536cd8['error']['message']);}logger[_0xb54a('0x16')]('FaxAccount,\x20%s,\x20%s',_0x5947c4,_0x536cd8[_0xb54a('0x16')]['message']);return _0x5d2ea4(_0x536cd8[_0xb54a('0x16')][_0xb54a('0x18')]);}else{logger[_0xb54a('0x11')](_0xb54a('0x12'),_0x5947c4,_0xb54a('0x15'));_0x5d2ea4(_0x536cd8['result'][_0xb54a('0x18')]);}})[_0xb54a('0x19')](function(_0x531ce3){logger['error'](_0xb54a('0x12'),_0x5947c4,_0x531ce3);_0x208303(_0x531ce3);});});}exports['GetFaxAccount']=function(_0x208c78){var _0x1f47ad=this;return new Promise(function(_0x1efb5d,_0xdf9065){return db[_0xb54a('0x1a')][_0xb54a('0x1b')]({'raw':_0x208c78['options']?_0x208c78[_0xb54a('0x1c')][_0xb54a('0x1d')]===undefined?!![]:![]:!![],'where':_0x208c78[_0xb54a('0x1c')]?_0x208c78[_0xb54a('0x1c')][_0xb54a('0x1e')]||null:null,'attributes':_0x208c78[_0xb54a('0x1c')]?_0x208c78['options'][_0xb54a('0x1f')]||null:null,'limit':_0x208c78[_0xb54a('0x1c')]?_0x208c78[_0xb54a('0x1c')]['limit']||null:null,'include':_0x208c78[_0xb54a('0x1c')]?_0x208c78[_0xb54a('0x1c')][_0xb54a('0x20')]?_[_0xb54a('0x21')](_0x208c78[_0xb54a('0x1c')][_0xb54a('0x20')],function(_0x4e46c0){return{'model':db[_0x4e46c0[_0xb54a('0x22')]],'as':_0x4e46c0['as'],'attributes':_0x4e46c0[_0xb54a('0x1f')],'include':_0x4e46c0[_0xb54a('0x20')]?_[_0xb54a('0x21')](_0x4e46c0[_0xb54a('0x20')],function(_0xfda701){return{'model':db[_0xfda701[_0xb54a('0x22')]],'as':_0xfda701['as'],'attributes':_0xfda701[_0xb54a('0x1f')],'include':_0xfda701[_0xb54a('0x20')]?_['map'](_0xfda701[_0xb54a('0x20')],function(_0xb752db){return{'model':db[_0xb752db[_0xb54a('0x22')]],'as':_0xb752db['as'],'attributes':_0xb752db[_0xb54a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb54a('0x23')](function(_0x515c87){logger[_0xb54a('0x11')](_0xb54a('0x24'),_0x208c78);logger[_0xb54a('0x13')](_0xb54a('0x24'),_0x208c78,JSON[_0xb54a('0x25')](_0x515c87));_0x1efb5d(_0x515c87);})[_0xb54a('0x19')](function(_0x2986fa){logger[_0xb54a('0x16')](_0xb54a('0x24'),_0x2986fa[_0xb54a('0x18')],_0x208c78);_0xdf9065(_0x1f47ad[_0xb54a('0x16')](0x1f4,_0x2986fa[_0xb54a('0x18')]));});});};exports[_0xb54a('0x26')]=function(_0x5a25f7,_0x10d326,_0x3e4485){var _0x2daae2=this;return new Promise(function(_0x199b1a,_0x15716c){var _0x5c876a={'body':_0x5a25f7['body'],'channel':_0xb54a('0x27')};var _0x1bdaf0=[];var _0x581d15=[];var _0x389daa={};return db[_0xb54a('0x28')][_0xb54a('0x29')]()[_0xb54a('0x23')](function(_0x2dec87){if(!_0x2dec87){throw new db[(_0xb54a('0x2a'))][(_0xb54a('0x2b'))]('no\x20available\x20attributes');}_0x1bdaf0=_[_0xb54a('0x2c')](_[_0xb54a('0x2d')](_0x2dec87),[_0xb54a('0x2e'),_0xb54a('0x2f')]);_0x581d15=_[_0xb54a('0x2c')](_[_0xb54a('0x2d')](_0x2dec87),[_0xb54a('0x2e'),_0xb54a('0x2f'),_0xb54a('0x30'),_0xb54a('0x31')]);if(_0x5a25f7[_0xb54a('0x32')]['id']){delete _0x5a25f7[_0xb54a('0x32')]['id'];}if(_[_0xb54a('0x33')](_0x5a25f7[_0xb54a('0x32')][_0xb54a('0x34')])){throw new db['Sequelize'][(_0xb54a('0x2b'))](_0xb54a('0x35'));}if(_[_0xb54a('0x33')](_0x5a25f7[_0xb54a('0x32')][_0xb54a('0x32')])||_0x5a25f7[_0xb54a('0x32')][_0xb54a('0x32')]===''){throw new db[(_0xb54a('0x2a'))][(_0xb54a('0x2b'))](_0xb54a('0x36'));}if(_[_0xb54a('0x33')](_0x5a25f7[_0xb54a('0x32')][_0xb54a('0x37')])){throw new db['Sequelize'][(_0xb54a('0x2b'))](_0xb54a('0x38')+_0x581d15);}if(!_[_0xb54a('0x39')](_0x581d15,_0x5a25f7[_0xb54a('0x32')][_0xb54a('0x37')])){throw new db[(_0xb54a('0x2a'))]['ValidationError'](_0xb54a('0x3a')+_0x581d15);}_0x389daa[_0x5a25f7[_0xb54a('0x32')][_0xb54a('0x37')]]=_0x5a25f7[_0xb54a('0x32')]['from'];})[_0xb54a('0x23')](function(){return db['FaxAccount'][_0xb54a('0x3b')]({'where':{'id':_0x5a25f7[_0xb54a('0x3c')]['id']},'include':[{'model':db['CmList'],'as':_0xb54a('0x3d'),'include':[{'model':db[_0xb54a('0x28')],'as':'Contacts','where':_0x389daa,'limit':0x1,'order':[[_0xb54a('0x2f'),_0xb54a('0x3e')]]}]},{'model':db[_0xb54a('0x3f')],'as':'Applications'}]});})[_0xb54a('0x23')](function(_0x283633){if(_0x283633&&_0x283633[_0xb54a('0x3d')]){var _0x559a3a=_0x283633[_0xb54a('0x40')]({'plain':!![]});_0x5c876a['account']=_0x559a3a;_0x5c876a['applications']=_0x559a3a[_0xb54a('0x41')];_0x5c876a[_0xb54a('0x42')]=_0x559a3a[_0xb54a('0x3d')];_0x5c876a[_0xb54a('0x43')]=_[_0xb54a('0x44')](_0x5c876a[_0xb54a('0x43')],[_0xb54a('0x45')],['asc']);if(_0x5c876a[_0xb54a('0x3c')][_0xb54a('0x41')]){delete _0x5c876a[_0xb54a('0x3c')][_0xb54a('0x41')];}if(_0x5c876a[_0xb54a('0x3c')][_0xb54a('0x3d')]&&_0x5c876a[_0xb54a('0x3c')][_0xb54a('0x3d')][_0xb54a('0x46')][_0xb54a('0x47')]){return _0x5c876a[_0xb54a('0x3c')][_0xb54a('0x3d')][_0xb54a('0x46')][0x0];}var _0x4139ce=_['defaults'](_0x5a25f7[_0xb54a('0x32')],{'firstName':_0x5a25f7[_0xb54a('0x32')][_0xb54a('0x34')],'ListId':_0x559a3a['ListId']});_0x4139ce[_0x5a25f7[_0xb54a('0x32')][_0xb54a('0x37')]]=_0x5a25f7[_0xb54a('0x32')]['from'];return db[_0xb54a('0x28')][_0xb54a('0x48')](_0x4139ce,{'fields':_0x1bdaf0,'raw':!![]});}})[_0xb54a('0x23')](function(_0x2b593a){_0x5c876a['contact']=_0x2b593a;if(_0x2b593a){var _0x3e9c94={'ContactId':_0x2b593a['id'],'FaxAccountId':_0x5a25f7[_0xb54a('0x3c')]['id'],'fax':_0x2b593a[_0xb54a('0x27')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x2b593a['id'],'closed':![],'FaxAccountId':_0x5a25f7['account']['id']}})[_0xb54a('0x23')](function(_0x2fa909){if(_0x2fa909){return[_0x2fa909,![]];}return db[_0xb54a('0x49')]['create'](_0x3e9c94)[_0xb54a('0x23')](function(_0x310ca6){return[_0x310ca6,!![]];});});}else{throw new Error(_0xb54a('0x4a'));}})['spread'](function(_0x586ccd,_0x52d2d3){var _0x75cec1=_0x586ccd['get']({'plain':!![]});if(_0x52d2d3){if(_0x5c876a[_0xb54a('0x3c')]['autoclose']){_0x5c876a[_0xb54a('0x43')][_0xb54a('0x4b')]({'id':0x0,'priority':_0x5c876a[_0xb54a('0x43')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0xb54a('0x4c')});}_0x75cec1['created']=!![];}else{_0x75cec1[_0xb54a('0x4d')]=![];}_0x5c876a[_0xb54a('0x4e')]=_0x75cec1;return db[_0xb54a('0x4f')]['create']({'body':_0x5a25f7[_0xb54a('0x32')]['body'],'FaxAccountId':_0x5a25f7[_0xb54a('0x3c')]['id'],'FaxInteractionId':_0x586ccd['id'],'direction':'in','ContactId':_0x586ccd['ContactId'],'AttachmentId':_0x5a25f7[_0xb54a('0x32')][_0xb54a('0x50')]});})[_0xb54a('0x23')](function(_0x566bbe){_0x5c876a[_0xb54a('0x18')]=_0x566bbe;if(_0x5c876a[_0xb54a('0x4e')][_0xb54a('0x51')]){return db[_0xb54a('0x52')][_0xb54a('0x3b')]({'attributes':['id',_0xb54a('0x53')],'where':{'id':_0x5c876a[_0xb54a('0x4e')][_0xb54a('0x51')]}})[_0xb54a('0x23')](function(_0x46a9b4){if(_0x46a9b4){_0x5c876a[_0xb54a('0x43')][_0xb54a('0x54')]({'id':0x0,'priority':0x0,'app':_0xb54a('0x55'),'appdata':_0x46a9b4[_0xb54a('0x53')]+','+(_0x5c876a['account'][_0xb54a('0x56')]||0xa),'interval':_0xb54a('0x4c')});}return respondWithRpcPromise(_0xb54a('0x57'),_0xb54a('0x58'),_0x5c876a);});}return respondWithRpcPromise(_0xb54a('0x57'),_0xb54a('0x58'),_0x5c876a);})[_0xb54a('0x23')](function(_0x1a59ab){_0x199b1a(_0x1a59ab);})[_0xb54a('0x19')](function(_0x2da066){_0x15716c(_0x2daae2['error'](0x1f4,_0x2da066['message']));});});}; \ No newline at end of file +var _0x81c0=['findAll','options','raw','where','include','model','attributes','map','then','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','difference','keys','createdAt','CompanyId','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','Contacts','updatedAt','FaxApplication','Applications','List','applications','list','orderBy','priority','asc','length','from','ListId','create','FaxInteraction','spread','autoclose','push','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','GetFaxAccount','FaxAccount'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0x81c0,0xee));var _0x081c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x81c0[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x081c('0x0'));var util=require(_0x081c('0x1'));var moment=require(_0x081c('0x2'));var BPromise=require('bluebird');var rs=require(_0x081c('0x3'));var fs=require('fs');var Redis=require(_0x081c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x081c('0x5'));var logger=require(_0x081c('0x6'))(_0x081c('0x7'));var config=require(_0x081c('0x8'));var jayson=require(_0x081c('0x9'));var client=jayson['client'][_0x081c('0xa')]({'port':0x232c});config[_0x081c('0xb')]=_[_0x081c('0xc')](config['redis'],{'host':_0x081c('0xd'),'port':0x18eb});var socket=require(_0x081c('0xe'))(new Redis(config[_0x081c('0xb')]));require(_0x081c('0xf'))[_0x081c('0x10')](socket);function respondWithRpcPromise(_0x227b9b,_0x2d87ae,_0x2ff990){return new BPromise(function(_0x2bd955,_0x1c317e){return client[_0x081c('0x11')](_0x227b9b,_0x2ff990)['then'](function(_0xcdce31){logger[_0x081c('0x12')](_0x081c('0x13'),_0x2d87ae,_0x081c('0x14'));logger[_0x081c('0x15')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2d87ae,_0x081c('0x14'),JSON[_0x081c('0x16')](_0xcdce31));if(_0xcdce31['error']){if(_0xcdce31['error'][_0x081c('0x17')]===0x1f4){logger['error'](_0x081c('0x13'),_0x2d87ae,_0xcdce31[_0x081c('0x18')][_0x081c('0x19')]);return _0x1c317e(_0xcdce31[_0x081c('0x18')][_0x081c('0x19')]);}logger[_0x081c('0x18')](_0x081c('0x13'),_0x2d87ae,_0xcdce31[_0x081c('0x18')][_0x081c('0x19')]);return _0x2bd955(_0xcdce31[_0x081c('0x18')][_0x081c('0x19')]);}else{logger[_0x081c('0x12')]('FaxAccount,\x20%s,\x20%s',_0x2d87ae,'request\x20sent');_0x2bd955(_0xcdce31[_0x081c('0x1a')][_0x081c('0x19')]);}})['catch'](function(_0x154f69){logger['error'](_0x081c('0x13'),_0x2d87ae,_0x154f69);_0x1c317e(_0x154f69);});});}exports[_0x081c('0x1b')]=function(_0x32f4d2){var _0x4233da=this;return new Promise(function(_0x386501,_0x33f862){return db[_0x081c('0x1c')][_0x081c('0x1d')]({'raw':_0x32f4d2['options']?_0x32f4d2[_0x081c('0x1e')][_0x081c('0x1f')]===undefined?!![]:![]:!![],'where':_0x32f4d2[_0x081c('0x1e')]?_0x32f4d2[_0x081c('0x1e')][_0x081c('0x20')]||null:null,'attributes':_0x32f4d2['options']?_0x32f4d2['options']['attributes']||null:null,'limit':_0x32f4d2[_0x081c('0x1e')]?_0x32f4d2[_0x081c('0x1e')]['limit']||null:null,'include':_0x32f4d2[_0x081c('0x1e')]?_0x32f4d2[_0x081c('0x1e')][_0x081c('0x21')]?_['map'](_0x32f4d2[_0x081c('0x1e')][_0x081c('0x21')],function(_0x22fd31){return{'model':db[_0x22fd31[_0x081c('0x22')]],'as':_0x22fd31['as'],'attributes':_0x22fd31[_0x081c('0x23')],'include':_0x22fd31[_0x081c('0x21')]?_[_0x081c('0x24')](_0x22fd31['include'],function(_0x5dd8e1){return{'model':db[_0x5dd8e1[_0x081c('0x22')]],'as':_0x5dd8e1['as'],'attributes':_0x5dd8e1[_0x081c('0x23')],'include':_0x5dd8e1['include']?_[_0x081c('0x24')](_0x5dd8e1[_0x081c('0x21')],function(_0x165b9e){return{'model':db[_0x165b9e[_0x081c('0x22')]],'as':_0x165b9e['as'],'attributes':_0x165b9e[_0x081c('0x23')]};}):[]};}):[]};}):[]:[]})[_0x081c('0x25')](function(_0x5a50c3){logger[_0x081c('0x12')]('GetFaxAccount',_0x32f4d2);logger[_0x081c('0x15')](_0x081c('0x1b'),_0x32f4d2,JSON[_0x081c('0x16')](_0x5a50c3));_0x386501(_0x5a50c3);})['catch'](function(_0x460083){logger['error'](_0x081c('0x1b'),_0x460083[_0x081c('0x19')],_0x32f4d2);_0x33f862(_0x4233da[_0x081c('0x18')](0x1f4,_0x460083[_0x081c('0x19')]));});});};exports[_0x081c('0x26')]=function(_0x410d91,_0x422078,_0x3a3337){var _0x3cded1=this;return new Promise(function(_0x32170a,_0x2c3b7a){var _0x18a970={'body':_0x410d91[_0x081c('0x27')],'channel':_0x081c('0x28')};var _0x4802f6=[];var _0x25bdd5=[];var _0x3e98eb={};return db[_0x081c('0x29')][_0x081c('0x2a')]()['then'](function(_0x504622){if(!_0x504622){throw new db[(_0x081c('0x2b'))]['ValidationError']('no\x20available\x20attributes');}_0x4802f6=_[_0x081c('0x2c')](_[_0x081c('0x2d')](_0x504622),[_0x081c('0x2e'),'updatedAt']);_0x25bdd5=_[_0x081c('0x2c')](_[_0x081c('0x2d')](_0x504622),[_0x081c('0x2e'),'updatedAt',_0x081c('0x2f'),'ListId']);if(_0x410d91[_0x081c('0x27')]['id']){delete _0x410d91['body']['id'];}if(_['isNil'](_0x410d91['body']['from'])){throw new db['Sequelize'][(_0x081c('0x30'))](_0x081c('0x31'));}if(_['isNil'](_0x410d91[_0x081c('0x27')]['body'])||_0x410d91['body'][_0x081c('0x27')]===''){throw new db[(_0x081c('0x2b'))][(_0x081c('0x30'))](_0x081c('0x32'));}if(_[_0x081c('0x33')](_0x410d91[_0x081c('0x27')][_0x081c('0x34')])){throw new db['Sequelize']['ValidationError'](_0x081c('0x35')+_0x25bdd5);}if(!_[_0x081c('0x36')](_0x25bdd5,_0x410d91[_0x081c('0x27')]['mapKey'])){throw new db[(_0x081c('0x2b'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x25bdd5);}_0x3e98eb[_0x410d91[_0x081c('0x27')][_0x081c('0x34')]]=_0x410d91['body']['from'];})[_0x081c('0x25')](function(){return db[_0x081c('0x1c')][_0x081c('0x37')]({'where':{'id':_0x410d91[_0x081c('0x38')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x081c('0x29')],'as':_0x081c('0x39'),'where':_0x3e98eb,'limit':0x1,'order':[[_0x081c('0x3a'),'DESC']]}]},{'model':db[_0x081c('0x3b')],'as':_0x081c('0x3c')}]});})['then'](function(_0x12f423){if(_0x12f423&&_0x12f423[_0x081c('0x3d')]){var _0x468cf0=_0x12f423['get']({'plain':!![]});_0x18a970[_0x081c('0x38')]=_0x468cf0;_0x18a970[_0x081c('0x3e')]=_0x468cf0[_0x081c('0x3c')];_0x18a970[_0x081c('0x3f')]=_0x468cf0['List'];_0x18a970['applications']=_[_0x081c('0x40')](_0x18a970[_0x081c('0x3e')],[_0x081c('0x41')],[_0x081c('0x42')]);if(_0x18a970['account']['Applications']){delete _0x18a970[_0x081c('0x38')][_0x081c('0x3c')];}if(_0x18a970[_0x081c('0x38')][_0x081c('0x3d')]&&_0x18a970['account'][_0x081c('0x3d')][_0x081c('0x39')][_0x081c('0x43')]){return _0x18a970[_0x081c('0x38')][_0x081c('0x3d')][_0x081c('0x39')][0x0];}var _0x320271=_[_0x081c('0xc')](_0x410d91[_0x081c('0x27')],{'firstName':_0x410d91[_0x081c('0x27')][_0x081c('0x44')],'ListId':_0x468cf0[_0x081c('0x45')]});_0x320271[_0x410d91[_0x081c('0x27')][_0x081c('0x34')]]=_0x410d91[_0x081c('0x27')]['from'];return db[_0x081c('0x29')][_0x081c('0x46')](_0x320271,{'fields':_0x4802f6,'raw':!![]});}})[_0x081c('0x25')](function(_0x3f5b8e){_0x18a970['contact']=_0x3f5b8e;if(_0x3f5b8e){var _0x3a746c={'ContactId':_0x3f5b8e['id'],'FaxAccountId':_0x410d91[_0x081c('0x38')]['id'],'fax':_0x3f5b8e[_0x081c('0x28')]};return db[_0x081c('0x47')][_0x081c('0x37')]({'where':{'ContactId':_0x3f5b8e['id'],'closed':![],'FaxAccountId':_0x410d91[_0x081c('0x38')]['id']}})['then'](function(_0x21f464){if(_0x21f464){return[_0x21f464,![]];}return db[_0x081c('0x47')][_0x081c('0x46')](_0x3a746c)[_0x081c('0x25')](function(_0x16ed48){return[_0x16ed48,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x081c('0x48')](function(_0x4dc7f8,_0x453f6f){var _0x10a1f1=_0x4dc7f8['get']({'plain':!![]});if(_0x453f6f){if(_0x18a970[_0x081c('0x38')][_0x081c('0x49')]){_0x18a970[_0x081c('0x3e')][_0x081c('0x4a')]({'id':0x0,'priority':_0x18a970[_0x081c('0x3e')][_0x081c('0x43')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x081c('0x4b')});}_0x10a1f1[_0x081c('0x4c')]=!![];}else{_0x10a1f1['created']=![];}_0x18a970['interaction']=_0x10a1f1;return db[_0x081c('0x4d')][_0x081c('0x46')]({'body':_0x410d91[_0x081c('0x27')][_0x081c('0x27')],'FaxAccountId':_0x410d91[_0x081c('0x38')]['id'],'FaxInteractionId':_0x4dc7f8['id'],'direction':'in','ContactId':_0x4dc7f8[_0x081c('0x4e')],'AttachmentId':_0x410d91[_0x081c('0x27')][_0x081c('0x4f')]});})[_0x081c('0x25')](function(_0x436974){_0x18a970[_0x081c('0x19')]=_0x436974;if(_0x18a970[_0x081c('0x50')][_0x081c('0x51')]){return db[_0x081c('0x52')][_0x081c('0x37')]({'attributes':['id','name'],'where':{'id':_0x18a970[_0x081c('0x50')][_0x081c('0x51')]}})['then'](function(_0x2865a8){if(_0x2865a8){_0x18a970[_0x081c('0x3e')][_0x081c('0x53')]({'id':0x0,'priority':0x0,'app':_0x081c('0x54'),'appdata':_0x2865a8[_0x081c('0x55')]+','+(_0x18a970[_0x081c('0x38')][_0x081c('0x56')]||0xa),'interval':_0x081c('0x4b')});}return respondWithRpcPromise(_0x081c('0x57'),_0x081c('0x58'),_0x18a970);});}return respondWithRpcPromise(_0x081c('0x57'),_0x081c('0x58'),_0x18a970);})[_0x081c('0x25')](function(_0x29b92b){_0x32170a(_0x29b92b);})['catch'](function(_0xa5b3bb){_0x2c3b7a(_0x3cded1[_0x081c('0x18')](0x1f4,_0xa5b3bb['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index a536077..2c80616 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 _0x6710=['faxAccount:','remove','emit','removeListener','register','length'];(function(_0x45099a,_0x274cd8){var _0x339c5d=function(_0x3cbc00){while(--_0x3cbc00){_0x45099a['push'](_0x45099a['shift']());}};_0x339c5d(++_0x274cd8);}(_0x6710,0x11b));var _0x0671=function(_0x59a68f,_0x410d07){_0x59a68f=_0x59a68f-0x0;var _0x3aff41=_0x6710[_0x59a68f];return _0x3aff41;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save',_0x0671('0x0'),'update'];function createListener(_0x290f68,_0x2796ae){return function(_0x1e938c){_0x2796ae[_0x0671('0x1')](_0x290f68,_0x1e938c);};}function removeListener(_0x1a9811,_0x2e1a23){return function(){FaxAccountEvents[_0x0671('0x2')](_0x1a9811,_0x2e1a23);};}exports[_0x0671('0x3')]=function(_0x32b3a7){for(var _0x2551cf=0x0,_0x2f697e=events[_0x0671('0x4')];_0x2551cf<_0x2f697e;_0x2551cf++){var _0x245695=events[_0x2551cf];var _0x3f3352=createListener(_0x0671('0x5')+_0x245695,_0x32b3a7);FaxAccountEvents['on'](_0x245695,_0x3f3352);}}; \ No newline at end of file +var _0xfc05=['update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x544ed3,_0x5efe4e){var _0x413f3a=function(_0x47e77e){while(--_0x47e77e){_0x544ed3['push'](_0x544ed3['shift']());}};_0x413f3a(++_0x5efe4e);}(_0xfc05,0xbe));var _0x5fc0=function(_0x47ae27,_0xa2b532){_0x47ae27=_0x47ae27-0x0;var _0x456356=_0xfc05[_0x47ae27];return _0x456356;};'use strict';var FaxAccountEvents=require(_0x5fc0('0x0'));var events=[_0x5fc0('0x1'),'remove',_0x5fc0('0x2')];function createListener(_0x53feed,_0x4b3680){return function(_0xc2b721){_0x4b3680[_0x5fc0('0x3')](_0x53feed,_0xc2b721);};}function removeListener(_0x45789f,_0x564ed9){return function(){FaxAccountEvents[_0x5fc0('0x4')](_0x45789f,_0x564ed9);};}exports[_0x5fc0('0x5')]=function(_0x1bb16d){for(var _0x53ca47=0x0,_0xef5d=events[_0x5fc0('0x6')];_0x53ca47<_0xef5d;_0x53ca47++){var _0x1eb09a=events[_0x53ca47];var _0x1900a0=createListener(_0x5fc0('0x7')+_0x1eb09a,_0x1bb16d);FaxAccountEvents['on'](_0x1eb09a,_0x1900a0);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 6e68d9f..9138dae 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(_0x5d2157,_0x660c95){var _0x2a74da=function(_0x59501f){while(--_0x59501f){_0x5d2157['push'](_0x5d2157['shift']());}};_0x2a74da(++_0x660c95);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x452fed,_0x2873b2){var _0x32e65f=function(_0x19bb38){while(--_0x19bb38){_0x452fed['push'](_0x452fed['shift']());}};_0x32e65f(++_0x2873b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 8f3a84d..3b12bf9 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 _0x184e=['INTEGER','STRING','noop','sequelize','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x184e,0x16b));var _0xe184=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x184e[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0xe184('0x0'));module[_0xe184('0x1')]={'priority':{'type':Sequelize[_0xe184('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe184('0x3')],'allowNull':![],'defaultValue':_0xe184('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe184('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xe8bc=['STRING','noop','TEXT','sequelize','INTEGER'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0xe8bc,0xd5));var _0xce8b=function(_0x578e60,_0x126343){_0x578e60=_0x578e60-0x0;var _0x585d4a=_0xe8bc[_0x578e60];return _0x585d4a;};'use strict';var Sequelize=require(_0xce8b('0x0'));module['exports']={'priority':{'type':Sequelize[_0xce8b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xce8b('0x2')],'allowNull':![],'defaultValue':_0xce8b('0x3')},'appdata':{'type':Sequelize[_0xce8b('0x4')]()},'description':{'type':Sequelize[_0xce8b('0x2')]},'interval':{'type':Sequelize[_0xce8b('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index dfeb30b..e1873e2 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 _0x3f38=['map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','show','find','catch','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','then','destroy','name','send','index','FaxApplication','rawAttributes','type','model'];(function(_0x517b9c,_0x4b32ce){var _0x340fb5=function(_0x4dfedb){while(--_0x4dfedb){_0x517b9c['push'](_0x517b9c['shift']());}};_0x340fb5(++_0x4b32ce);}(_0x3f38,0x65));var _0x83f3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3f38[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x83f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x83f3('0x1'));var jsonpatch=require(_0x83f3('0x2'));var rp=require('request-promise');var moment=require(_0x83f3('0x3'));var BPromise=require(_0x83f3('0x4'));var Mustache=require(_0x83f3('0x5'));var util=require(_0x83f3('0x6'));var path=require(_0x83f3('0x7'));var sox=require(_0x83f3('0x8'));var csv=require(_0x83f3('0x9'));var ejs=require(_0x83f3('0xa'));var fs=require('fs');var fs_extra=require(_0x83f3('0xb'));var _=require(_0x83f3('0xc'));var squel=require(_0x83f3('0xd'));var crypto=require(_0x83f3('0xe'));var jsforce=require(_0x83f3('0xf'));var deskjs=require(_0x83f3('0x10'));var toCsv=require(_0x83f3('0x9'));var querystring=require('querystring');var Papa=require(_0x83f3('0x11'));var Redis=require(_0x83f3('0x12'));var authService=require(_0x83f3('0x13'));var qs=require(_0x83f3('0x14'));var as=require(_0x83f3('0x15'));var hardwareService=require(_0x83f3('0x16'));var logger=require(_0x83f3('0x17'))(_0x83f3('0x18'));var utils=require(_0x83f3('0x19'));var config=require(_0x83f3('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x83f3('0x1b'))['db'];function respondWithStatusCode(_0x998e68,_0x1b0e9d){_0x1b0e9d=_0x1b0e9d||0xcc;return function(_0x3f327e){if(_0x3f327e){return _0x998e68[_0x83f3('0x1c')](_0x1b0e9d);}return _0x998e68[_0x83f3('0x1d')](_0x1b0e9d)[_0x83f3('0x1e')]();};}function respondWithResult(_0x5e7994,_0x5ad050){_0x5ad050=_0x5ad050||0xc8;return function(_0x3ca2df){if(_0x3ca2df){return _0x5e7994[_0x83f3('0x1d')](_0x5ad050)[_0x83f3('0x1f')](_0x3ca2df);}};}function respondWithFilteredResult(_0x1a1475,_0x502431){return function(_0x54361d){if(_0x54361d){var _0x5bcb5d=typeof _0x502431['offset']===_0x83f3('0x20')&&typeof _0x502431[_0x83f3('0x21')]===_0x83f3('0x20');var _0x57e52d=_0x54361d['count'];var _0x2499f0=_0x5bcb5d?0x0:_0x502431[_0x83f3('0x22')];var _0x24c42c=_0x5bcb5d?_0x54361d[_0x83f3('0x23')]:_0x502431['offset']+_0x502431[_0x83f3('0x21')];var _0x3080ae;if(_0x24c42c>=_0x57e52d){_0x24c42c=_0x57e52d;_0x3080ae=0xc8;}else{_0x3080ae=0xce;}_0x1a1475[_0x83f3('0x1d')](_0x3080ae);return _0x1a1475[_0x83f3('0x24')](_0x83f3('0x25'),_0x2499f0+'-'+_0x24c42c+'/'+_0x57e52d)[_0x83f3('0x1f')](_0x54361d);}return null;};}function patchUpdates(_0x55dfcd){return function(_0x17e9ea){try{jsonpatch['apply'](_0x17e9ea,_0x55dfcd,!![]);}catch(_0x14f5d3){return BPromise[_0x83f3('0x26')](_0x14f5d3);}return _0x17e9ea[_0x83f3('0x27')]();};}function saveUpdates(_0x3993a4,_0x19fb39){return function(_0x316a2c){if(_0x316a2c){return _0x316a2c['update'](_0x3993a4)[_0x83f3('0x28')](function(_0x1132bd){return _0x1132bd;});}return null;};}function removeEntity(_0x5b7603,_0x1cfeec){return function(_0x28f9a9){if(_0x28f9a9){return _0x28f9a9[_0x83f3('0x29')]()['then'](function(){_0x5b7603['status'](0xcc)[_0x83f3('0x1e')]();});}};}function handleEntityNotFound(_0xc1cc99,_0x380ca6){return function(_0x4c8057){if(!_0x4c8057){_0xc1cc99[_0x83f3('0x1c')](0x194);}return _0x4c8057;};}function handleError(_0x3d7e77,_0x5e85d6){_0x5e85d6=_0x5e85d6||0x1f4;return function(_0x48cd6a){logger['error'](_0x48cd6a['stack']);if(_0x48cd6a[_0x83f3('0x2a')]){delete _0x48cd6a[_0x83f3('0x2a')];}_0x3d7e77['status'](_0x5e85d6)[_0x83f3('0x2b')](_0x48cd6a);};}exports[_0x83f3('0x2c')]=function(_0x1449b4,_0x47b60b){var _0x1da7a5={},_0x426596={},_0x6c6fa5={'count':0x0,'rows':[]};var _0x4d927e=_['map'](db[_0x83f3('0x2d')][_0x83f3('0x2e')],function(_0x240dea){return{'name':_0x240dea['fieldName'],'type':_0x240dea[_0x83f3('0x2f')]['key']};});_0x426596[_0x83f3('0x30')]=_[_0x83f3('0x31')](_0x4d927e,'name');_0x426596['query']=_[_0x83f3('0x32')](_0x1449b4[_0x83f3('0x33')]);_0x426596['filters']=_[_0x83f3('0x34')](_0x426596[_0x83f3('0x30')],_0x426596[_0x83f3('0x33')]);_0x1da7a5[_0x83f3('0x35')]=_[_0x83f3('0x34')](_0x426596[_0x83f3('0x30')],qs[_0x83f3('0x36')](_0x1449b4[_0x83f3('0x33')][_0x83f3('0x36')]));_0x1da7a5[_0x83f3('0x35')]=_0x1da7a5[_0x83f3('0x35')][_0x83f3('0x37')]?_0x1da7a5[_0x83f3('0x35')]:_0x426596[_0x83f3('0x30')];if(!_0x1449b4['query'][_0x83f3('0x38')](_0x83f3('0x39'))){_0x1da7a5[_0x83f3('0x21')]=qs[_0x83f3('0x21')](_0x1449b4[_0x83f3('0x33')][_0x83f3('0x21')]);_0x1da7a5[_0x83f3('0x22')]=qs[_0x83f3('0x22')](_0x1449b4[_0x83f3('0x33')][_0x83f3('0x22')]);}_0x1da7a5['order']=qs[_0x83f3('0x3a')](_0x1449b4['query'][_0x83f3('0x3a')]);_0x1da7a5['where']=qs[_0x83f3('0x3b')](_[_0x83f3('0x3c')](_0x1449b4[_0x83f3('0x33')],_0x426596[_0x83f3('0x3b')]),_0x4d927e);if(_0x1449b4[_0x83f3('0x33')][_0x83f3('0x3d')]){_0x1da7a5['where']=_[_0x83f3('0x3e')](_0x1da7a5['where'],{'$or':_[_0x83f3('0x31')](_0x4d927e,function(_0xef1016){if(_0xef1016[_0x83f3('0x2f')]!==_0x83f3('0x3f')){var _0x2066b1={};_0x2066b1[_0xef1016[_0x83f3('0x2a')]]={'$like':'%'+_0x1449b4[_0x83f3('0x33')][_0x83f3('0x3d')]+'%'};return _0x2066b1;}})});}_0x1da7a5=_[_0x83f3('0x3e')]({},_0x1da7a5,_0x1449b4[_0x83f3('0x40')]);var _0x29ebdc={'where':_0x1da7a5[_0x83f3('0x41')]};return db[_0x83f3('0x2d')][_0x83f3('0x23')](_0x29ebdc)[_0x83f3('0x28')](function(_0x3b9827){_0x6c6fa5[_0x83f3('0x23')]=_0x3b9827;if(_0x1449b4['query'][_0x83f3('0x42')]){_0x1da7a5[_0x83f3('0x43')]=[{'all':!![]}];}return db[_0x83f3('0x2d')][_0x83f3('0x44')](_0x1da7a5);})[_0x83f3('0x28')](function(_0x556cff){_0x6c6fa5[_0x83f3('0x45')]=_0x556cff;return _0x6c6fa5;})[_0x83f3('0x28')](respondWithFilteredResult(_0x47b60b,_0x1da7a5))['catch'](handleError(_0x47b60b,null));};exports[_0x83f3('0x46')]=function(_0x27d962,_0x26ddf5){var _0x68bf08={'raw':!![],'where':{'id':_0x27d962['params']['id']}},_0x3b926b={};_0x3b926b[_0x83f3('0x30')]=_[_0x83f3('0x32')](db['FaxApplication'][_0x83f3('0x2e')]);_0x3b926b[_0x83f3('0x33')]=_['keys'](_0x27d962['query']);_0x3b926b[_0x83f3('0x3b')]=_['intersection'](_0x3b926b['model'],_0x3b926b[_0x83f3('0x33')]);_0x68bf08[_0x83f3('0x35')]=_['intersection'](_0x3b926b['model'],qs[_0x83f3('0x36')](_0x27d962[_0x83f3('0x33')][_0x83f3('0x36')]));_0x68bf08[_0x83f3('0x35')]=_0x68bf08['attributes'][_0x83f3('0x37')]?_0x68bf08['attributes']:_0x3b926b['model'];if(_0x27d962[_0x83f3('0x33')][_0x83f3('0x42')]){_0x68bf08[_0x83f3('0x43')]=[{'all':!![]}];}_0x68bf08=_[_0x83f3('0x3e')]({},_0x68bf08,_0x27d962[_0x83f3('0x40')]);return db[_0x83f3('0x2d')][_0x83f3('0x47')](_0x68bf08)['then'](handleEntityNotFound(_0x26ddf5,null))['then'](respondWithResult(_0x26ddf5,null))[_0x83f3('0x48')](handleError(_0x26ddf5,null));};exports['create']=function(_0x19ac48,_0x458b5c){return db[_0x83f3('0x2d')]['create'](_0x19ac48['body'],{})['then'](respondWithResult(_0x458b5c,0xc9))['catch'](handleError(_0x458b5c,null));};exports['update']=function(_0x5ef6a1,_0x144653){if(_0x5ef6a1[_0x83f3('0x49')]['id']){delete _0x5ef6a1[_0x83f3('0x49')]['id'];}return db[_0x83f3('0x2d')][_0x83f3('0x47')]({'where':{'id':_0x5ef6a1[_0x83f3('0x4a')]['id']}})[_0x83f3('0x28')](handleEntityNotFound(_0x144653,null))[_0x83f3('0x28')](saveUpdates(_0x5ef6a1['body'],null))['then'](respondWithResult(_0x144653,null))[_0x83f3('0x48')](handleError(_0x144653,null));};exports['destroy']=function(_0x276531,_0x1dac8f){return db[_0x83f3('0x2d')][_0x83f3('0x47')]({'where':{'id':_0x276531['params']['id']}})[_0x83f3('0x28')](handleEntityNotFound(_0x1dac8f,null))[_0x83f3('0x28')](removeEntity(_0x1dac8f,null))[_0x83f3('0x48')](handleError(_0x1dac8f,null));}; \ No newline at end of file +var _0x26a7=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','map','FaxApplication','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x2cb8ad,_0x235475){var _0x414f6b=function(_0xc3a742){while(--_0xc3a742){_0x2cb8ad['push'](_0x2cb8ad['shift']());}};_0x414f6b(++_0x235475);}(_0x26a7,0x153));var _0x726a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x26a7[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x726a('0x0'));var rimraf=require(_0x726a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x726a('0x2'));var rp=require(_0x726a('0x3'));var moment=require(_0x726a('0x4'));var BPromise=require(_0x726a('0x5'));var Mustache=require(_0x726a('0x6'));var util=require(_0x726a('0x7'));var path=require(_0x726a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x726a('0x9'));var fs=require('fs');var fs_extra=require(_0x726a('0xa'));var _=require(_0x726a('0xb'));var squel=require(_0x726a('0xc'));var crypto=require('crypto');var jsforce=require(_0x726a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x726a('0xe'));var Papa=require(_0x726a('0xf'));var Redis=require(_0x726a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x726a('0x11'));var as=require(_0x726a('0x12'));var hardwareService=require(_0x726a('0x13'));var logger=require('../../config/logger')(_0x726a('0x14'));var utils=require(_0x726a('0x15'));var config=require(_0x726a('0x16'));var licenseUtil=require(_0x726a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a8bed,_0x4ef7a8){_0x4ef7a8=_0x4ef7a8||0xcc;return function(_0x3b3f29){if(_0x3b3f29){return _0x3a8bed[_0x726a('0x18')](_0x4ef7a8);}return _0x3a8bed[_0x726a('0x19')](_0x4ef7a8)[_0x726a('0x1a')]();};}function respondWithResult(_0x2eacd0,_0xecfa3){_0xecfa3=_0xecfa3||0xc8;return function(_0x105939){if(_0x105939){return _0x2eacd0[_0x726a('0x19')](_0xecfa3)[_0x726a('0x1b')](_0x105939);}};}function respondWithFilteredResult(_0x2cb32b,_0x291b25){return function(_0x51ad69){if(_0x51ad69){var _0x1d384b=typeof _0x291b25[_0x726a('0x1c')]==='undefined'&&typeof _0x291b25[_0x726a('0x1d')]==='undefined';var _0x1794fa=_0x51ad69[_0x726a('0x1e')];var _0x2bfe5a=_0x1d384b?0x0:_0x291b25[_0x726a('0x1c')];var _0x2506b8=_0x1d384b?_0x51ad69['count']:_0x291b25[_0x726a('0x1c')]+_0x291b25[_0x726a('0x1d')];var _0x3b19b2;if(_0x2506b8>=_0x1794fa){_0x2506b8=_0x1794fa;_0x3b19b2=0xc8;}else{_0x3b19b2=0xce;}_0x2cb32b['status'](_0x3b19b2);return _0x2cb32b[_0x726a('0x1f')](_0x726a('0x20'),_0x2bfe5a+'-'+_0x2506b8+'/'+_0x1794fa)[_0x726a('0x1b')](_0x51ad69);}return null;};}function patchUpdates(_0x327bf1){return function(_0x51e2a8){try{jsonpatch[_0x726a('0x21')](_0x51e2a8,_0x327bf1,!![]);}catch(_0x5b55d8){return BPromise['reject'](_0x5b55d8);}return _0x51e2a8[_0x726a('0x22')]();};}function saveUpdates(_0x11c9be,_0x518f3c){return function(_0x419bec){if(_0x419bec){return _0x419bec[_0x726a('0x23')](_0x11c9be)[_0x726a('0x24')](function(_0xde26a6){return _0xde26a6;});}return null;};}function removeEntity(_0x5cee19,_0x31083a){return function(_0x2b826c){if(_0x2b826c){return _0x2b826c['destroy']()[_0x726a('0x24')](function(){_0x5cee19[_0x726a('0x19')](0xcc)[_0x726a('0x1a')]();});}};}function handleEntityNotFound(_0x374509,_0x673604){return function(_0x349ab9){if(!_0x349ab9){_0x374509[_0x726a('0x18')](0x194);}return _0x349ab9;};}function handleError(_0x246344,_0xb79f80){_0xb79f80=_0xb79f80||0x1f4;return function(_0x480a7b){logger[_0x726a('0x25')](_0x480a7b[_0x726a('0x26')]);if(_0x480a7b[_0x726a('0x27')]){delete _0x480a7b['name'];}_0x246344[_0x726a('0x19')](_0xb79f80)['send'](_0x480a7b);};}exports['index']=function(_0x31bc73,_0x4e87e6){var _0x32ba68={},_0x4c8fc3={},_0x5de056={'count':0x0,'rows':[]};var _0x27cf54=_[_0x726a('0x28')](db[_0x726a('0x29')][_0x726a('0x2a')],function(_0x53220d){return{'name':_0x53220d['fieldName'],'type':_0x53220d[_0x726a('0x2b')][_0x726a('0x2c')]};});_0x4c8fc3[_0x726a('0x2d')]=_[_0x726a('0x28')](_0x27cf54,_0x726a('0x27'));_0x4c8fc3[_0x726a('0x2e')]=_[_0x726a('0x2f')](_0x31bc73['query']);_0x4c8fc3['filters']=_[_0x726a('0x30')](_0x4c8fc3['model'],_0x4c8fc3[_0x726a('0x2e')]);_0x32ba68[_0x726a('0x31')]=_[_0x726a('0x30')](_0x4c8fc3[_0x726a('0x2d')],qs[_0x726a('0x32')](_0x31bc73[_0x726a('0x2e')]['fields']));_0x32ba68[_0x726a('0x31')]=_0x32ba68[_0x726a('0x31')][_0x726a('0x33')]?_0x32ba68['attributes']:_0x4c8fc3[_0x726a('0x2d')];if(!_0x31bc73['query'][_0x726a('0x34')](_0x726a('0x35'))){_0x32ba68['limit']=qs[_0x726a('0x1d')](_0x31bc73['query'][_0x726a('0x1d')]);_0x32ba68[_0x726a('0x1c')]=qs[_0x726a('0x1c')](_0x31bc73[_0x726a('0x2e')][_0x726a('0x1c')]);}_0x32ba68[_0x726a('0x36')]=qs[_0x726a('0x37')](_0x31bc73[_0x726a('0x2e')][_0x726a('0x37')]);_0x32ba68[_0x726a('0x38')]=qs[_0x726a('0x39')](_[_0x726a('0x3a')](_0x31bc73[_0x726a('0x2e')],_0x4c8fc3[_0x726a('0x39')]),_0x27cf54);if(_0x31bc73[_0x726a('0x2e')][_0x726a('0x3b')]){_0x32ba68['where']=_[_0x726a('0x3c')](_0x32ba68[_0x726a('0x38')],{'$or':_[_0x726a('0x28')](_0x27cf54,function(_0x19cff3){if(_0x19cff3[_0x726a('0x2b')]!==_0x726a('0x3d')){var _0x12c91f={};_0x12c91f[_0x19cff3[_0x726a('0x27')]]={'$like':'%'+_0x31bc73[_0x726a('0x2e')]['filter']+'%'};return _0x12c91f;}})});}_0x32ba68=_['merge']({},_0x32ba68,_0x31bc73[_0x726a('0x3e')]);var _0x1948c5={'where':_0x32ba68[_0x726a('0x38')]};return db[_0x726a('0x29')][_0x726a('0x1e')](_0x1948c5)['then'](function(_0x4450cc){_0x5de056[_0x726a('0x1e')]=_0x4450cc;if(_0x31bc73[_0x726a('0x2e')][_0x726a('0x3f')]){_0x32ba68[_0x726a('0x40')]=[{'all':!![]}];}return db[_0x726a('0x29')]['findAll'](_0x32ba68);})['then'](function(_0xbc524f){_0x5de056[_0x726a('0x41')]=_0xbc524f;return _0x5de056;})[_0x726a('0x24')](respondWithFilteredResult(_0x4e87e6,_0x32ba68))[_0x726a('0x42')](handleError(_0x4e87e6,null));};exports['show']=function(_0x29b588,_0x179ded){var _0x19a8ab={'raw':!![],'where':{'id':_0x29b588[_0x726a('0x43')]['id']}},_0x4dd6b7={};_0x4dd6b7[_0x726a('0x2d')]=_['keys'](db[_0x726a('0x29')][_0x726a('0x2a')]);_0x4dd6b7[_0x726a('0x2e')]=_[_0x726a('0x2f')](_0x29b588[_0x726a('0x2e')]);_0x4dd6b7[_0x726a('0x39')]=_[_0x726a('0x30')](_0x4dd6b7[_0x726a('0x2d')],_0x4dd6b7['query']);_0x19a8ab[_0x726a('0x31')]=_[_0x726a('0x30')](_0x4dd6b7[_0x726a('0x2d')],qs[_0x726a('0x32')](_0x29b588['query'][_0x726a('0x32')]));_0x19a8ab['attributes']=_0x19a8ab['attributes'][_0x726a('0x33')]?_0x19a8ab[_0x726a('0x31')]:_0x4dd6b7[_0x726a('0x2d')];if(_0x29b588[_0x726a('0x2e')][_0x726a('0x3f')]){_0x19a8ab['include']=[{'all':!![]}];}_0x19a8ab=_[_0x726a('0x3c')]({},_0x19a8ab,_0x29b588['options']);return db[_0x726a('0x29')][_0x726a('0x44')](_0x19a8ab)[_0x726a('0x24')](handleEntityNotFound(_0x179ded,null))[_0x726a('0x24')](respondWithResult(_0x179ded,null))['catch'](handleError(_0x179ded,null));};exports[_0x726a('0x45')]=function(_0x4ce45f,_0x3255a6){return db[_0x726a('0x29')]['create'](_0x4ce45f[_0x726a('0x46')],{})['then'](respondWithResult(_0x3255a6,0xc9))['catch'](handleError(_0x3255a6,null));};exports[_0x726a('0x23')]=function(_0x1dfac0,_0x582c55){if(_0x1dfac0[_0x726a('0x46')]['id']){delete _0x1dfac0[_0x726a('0x46')]['id'];}return db['FaxApplication'][_0x726a('0x44')]({'where':{'id':_0x1dfac0[_0x726a('0x43')]['id']}})[_0x726a('0x24')](handleEntityNotFound(_0x582c55,null))[_0x726a('0x24')](saveUpdates(_0x1dfac0[_0x726a('0x46')],null))[_0x726a('0x24')](respondWithResult(_0x582c55,null))[_0x726a('0x42')](handleError(_0x582c55,null));};exports[_0x726a('0x47')]=function(_0x28110a,_0x33765a){return db[_0x726a('0x29')][_0x726a('0x44')]({'where':{'id':_0x28110a[_0x726a('0x43')]['id']}})[_0x726a('0x24')](handleEntityNotFound(_0x33765a,null))['then'](removeEntity(_0x33765a,null))[_0x726a('0x42')](handleError(_0x33765a,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 4131ada..f3bd6dd 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 _0x32dd=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0xe9718,_0x477057){var _0xe19c0=function(_0x40de88){while(--_0x40de88){_0xe9718['push'](_0xe9718['shift']());}};_0xe19c0(++_0x477057);}(_0x32dd,0x1ed));var _0xd32d=function(_0x4131da,_0x124783){_0x4131da=_0x4131da-0x0;var _0x583242=_0x32dd[_0x4131da];return _0x583242;};'use strict';var _=require(_0xd32d('0x0'));var util=require(_0xd32d('0x1'));var logger=require(_0xd32d('0x2'))(_0xd32d('0x3'));var moment=require(_0xd32d('0x4'));var BPromise=require(_0xd32d('0x5'));var rp=require(_0xd32d('0x6'));var fs=require('fs');var path=require(_0xd32d('0x7'));var rimraf=require(_0xd32d('0x8'));var config=require(_0xd32d('0x9'));var attributes=require('./faxApplication.attributes');module[_0xd32d('0xa')]=function(_0x3b8dbb,_0x26ab4d){return _0x3b8dbb[_0xd32d('0xb')](_0xd32d('0xc'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd32d('0xd'),'collate':_0xd32d('0xe')});}; \ No newline at end of file +var _0xea68=['rimraf','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2dd8e8,_0x40e2ac){var _0x5a0c20=function(_0x572fce){while(--_0x572fce){_0x2dd8e8['push'](_0x2dd8e8['shift']());}};_0x5a0c20(++_0x40e2ac);}(_0xea68,0x78));var _0x8ea6=function(_0x3e3cdb,_0x556cd1){_0x3e3cdb=_0x3e3cdb-0x0;var _0x3a31b1=_0xea68[_0x3e3cdb];return _0x3a31b1;};'use strict';var _=require(_0x8ea6('0x0'));var util=require(_0x8ea6('0x1'));var logger=require(_0x8ea6('0x2'))('api');var moment=require(_0x8ea6('0x3'));var BPromise=require(_0x8ea6('0x4'));var rp=require(_0x8ea6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ea6('0x6'));var config=require('../../config/environment');var attributes=require(_0x8ea6('0x7'));module[_0x8ea6('0x8')]=function(_0x23ee7b,_0x4871cf){return _0x23ee7b[_0x8ea6('0x9')](_0x8ea6('0xa'),attributes,{'tableName':_0x8ea6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8ea6('0xc'),'collate':_0x8ea6('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 62ed102..78406b0 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 _0x3cd8=['then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','raw','options','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4a5290,_0x457f7d){var _0x5503ca=function(_0x247aba){while(--_0x247aba){_0x4a5290['push'](_0x4a5290['shift']());}};_0x5503ca(++_0x457f7d);}(_0x3cd8,0x150));var _0x83cd=function(_0x47a8c0,_0x4d5931){_0x47a8c0=_0x47a8c0-0x0;var _0x551fa1=_0x3cd8[_0x47a8c0];return _0x551fa1;};'use strict';var _=require(_0x83cd('0x0'));var util=require(_0x83cd('0x1'));var moment=require(_0x83cd('0x2'));var BPromise=require(_0x83cd('0x3'));var rs=require(_0x83cd('0x4'));var fs=require('fs');var Redis=require(_0x83cd('0x5'));var db=require(_0x83cd('0x6'))['db'];var utils=require(_0x83cd('0x7'));var logger=require('../../config/logger')(_0x83cd('0x8'));var config=require(_0x83cd('0x9'));var jayson=require(_0x83cd('0xa'));var client=jayson[_0x83cd('0xb')][_0x83cd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb6ca3a,_0x69187a,_0x309a7a){return new BPromise(function(_0x1bd528,_0x3e7b0c){return client[_0x83cd('0xd')](_0xb6ca3a,_0x309a7a)[_0x83cd('0xe')](function(_0x43b349){logger[_0x83cd('0xf')](_0x83cd('0x10'),_0x69187a,_0x83cd('0x11'));logger[_0x83cd('0x12')](_0x83cd('0x13'),_0x69187a,_0x83cd('0x11'),JSON[_0x83cd('0x14')](_0x43b349));if(_0x43b349['error']){if(_0x43b349[_0x83cd('0x15')][_0x83cd('0x16')]===0x1f4){logger[_0x83cd('0x15')](_0x83cd('0x10'),_0x69187a,_0x43b349[_0x83cd('0x15')][_0x83cd('0x17')]);return _0x3e7b0c(_0x43b349[_0x83cd('0x15')][_0x83cd('0x17')]);}logger['error'](_0x83cd('0x10'),_0x69187a,_0x43b349[_0x83cd('0x15')][_0x83cd('0x17')]);return _0x1bd528(_0x43b349[_0x83cd('0x15')][_0x83cd('0x17')]);}else{logger[_0x83cd('0xf')]('FaxApplication,\x20%s,\x20%s',_0x69187a,'request\x20sent');_0x1bd528(_0x43b349[_0x83cd('0x18')][_0x83cd('0x17')]);}})[_0x83cd('0x19')](function(_0x28d4c8){logger[_0x83cd('0x15')](_0x83cd('0x10'),_0x69187a,_0x28d4c8);_0x3e7b0c(_0x28d4c8);});});}exports[_0x83cd('0x1a')]=function(_0x1e136e){var _0x5e35e3=this;return new Promise(function(_0x1df488,_0x4ab232){return db[_0x83cd('0x1b')][_0x83cd('0x1c')](_0x1e136e[_0x83cd('0x1d')],{'raw':_0x1e136e['options']?_0x1e136e['options'][_0x83cd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e136e['options']?_0x1e136e[_0x83cd('0x1f')][_0x83cd('0x20')]||null:null,'attributes':_0x1e136e['options']?_0x1e136e[_0x83cd('0x1f')][_0x83cd('0x21')]||null:null,'limit':_0x1e136e[_0x83cd('0x1f')]?_0x1e136e[_0x83cd('0x1f')][_0x83cd('0x22')]||null:null})[_0x83cd('0xe')](function(_0x10b957){logger[_0x83cd('0xf')]('UpdateFaxApplication',_0x1e136e);logger['debug'](_0x83cd('0x1a'),_0x1e136e,JSON['stringify'](_0x10b957));_0x1df488(_0x10b957);})[_0x83cd('0x19')](function(_0x2a99aa){logger[_0x83cd('0x15')]('UpdateFaxApplication',_0x2a99aa[_0x83cd('0x17')],_0x1e136e);_0x4ab232(_0x5e35e3[_0x83cd('0x15')](0x1f4,_0x2a99aa[_0x83cd('0x17')]));});});}; \ No newline at end of file +var _0x97f7=['jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','FaxApplication','update','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x453e53,_0x330fd8){var _0x147e21=function(_0x5dfacf){while(--_0x5dfacf){_0x453e53['push'](_0x453e53['shift']());}};_0x147e21(++_0x330fd8);}(_0x97f7,0x10f));var _0x797f=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x97f7[_0x44946b];return _0x249bc4;};'use strict';var _=require(_0x797f('0x0'));var util=require(_0x797f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x797f('0x2'));var db=require(_0x797f('0x3'))['db'];var utils=require(_0x797f('0x4'));var logger=require(_0x797f('0x5'))(_0x797f('0x6'));var config=require(_0x797f('0x7'));var jayson=require(_0x797f('0x8'));var client=jayson[_0x797f('0x9')][_0x797f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24742a,_0x2c05d1,_0x41caee){return new BPromise(function(_0x1dbb36,_0x32e1f3){return client[_0x797f('0xb')](_0x24742a,_0x41caee)[_0x797f('0xc')](function(_0x23f2d1){logger['info'](_0x797f('0xd'),_0x2c05d1,_0x797f('0xe'));logger[_0x797f('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2c05d1,_0x797f('0xe'),JSON['stringify'](_0x23f2d1));if(_0x23f2d1[_0x797f('0x10')]){if(_0x23f2d1[_0x797f('0x10')][_0x797f('0x11')]===0x1f4){logger[_0x797f('0x10')](_0x797f('0xd'),_0x2c05d1,_0x23f2d1[_0x797f('0x10')]['message']);return _0x32e1f3(_0x23f2d1[_0x797f('0x10')][_0x797f('0x12')]);}logger['error'](_0x797f('0xd'),_0x2c05d1,_0x23f2d1[_0x797f('0x10')][_0x797f('0x12')]);return _0x1dbb36(_0x23f2d1[_0x797f('0x10')][_0x797f('0x12')]);}else{logger[_0x797f('0x13')](_0x797f('0xd'),_0x2c05d1,_0x797f('0xe'));_0x1dbb36(_0x23f2d1[_0x797f('0x14')][_0x797f('0x12')]);}})[_0x797f('0x15')](function(_0x3a48d2){logger[_0x797f('0x10')](_0x797f('0xd'),_0x2c05d1,_0x3a48d2);_0x32e1f3(_0x3a48d2);});});}exports['UpdateFaxApplication']=function(_0x164fe7){var _0x1c04f5=this;return new Promise(function(_0x430819,_0x578cac){return db[_0x797f('0x16')][_0x797f('0x17')](_0x164fe7[_0x797f('0x18')],{'raw':_0x164fe7[_0x797f('0x19')]?_0x164fe7[_0x797f('0x19')][_0x797f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x164fe7[_0x797f('0x19')]?_0x164fe7[_0x797f('0x19')][_0x797f('0x1b')]||null:null,'attributes':_0x164fe7[_0x797f('0x19')]?_0x164fe7[_0x797f('0x19')][_0x797f('0x1c')]||null:null,'limit':_0x164fe7[_0x797f('0x19')]?_0x164fe7[_0x797f('0x19')][_0x797f('0x1d')]||null:null})['then'](function(_0x2f462b){logger[_0x797f('0x13')](_0x797f('0x1e'),_0x164fe7);logger['debug'](_0x797f('0x1e'),_0x164fe7,JSON['stringify'](_0x2f462b));_0x430819(_0x2f462b);})[_0x797f('0x15')](function(_0x35b37f){logger[_0x797f('0x10')]('UpdateFaxApplication',_0x35b37f[_0x797f('0x12')],_0x164fe7);_0x578cac(_0x1c04f5[_0x797f('0x10')](0x1f4,_0x35b37f[_0x797f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 069533c..3a8d291 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 _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x56e077,_0x389aeb){var _0x458520=function(_0x5d9609){while(--_0x5d9609){_0x56e077['push'](_0x56e077['shift']());}};_0x458520(++_0x389aeb);}(_0xb7e7,0x121));var _0x7b7e=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xb7e7[_0x369151];return _0x4292d5;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file +var _0x9c00=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x1b10d0,_0x48b73b){var _0x3c1a27=function(_0x198678){while(--_0x198678){_0x1b10d0['push'](_0x1b10d0['shift']());}};_0x3c1a27(++_0x48b73b);}(_0x9c00,0x1a0));var _0x09c0=function(_0x30a2b4,_0x2fe7b3){_0x30a2b4=_0x30a2b4-0x0;var _0x1b2bef=_0x9c00[_0x30a2b4];return _0x1b2bef;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x4'));var interaction=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var controller=require(_0x09c0('0x7'));router[_0x09c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c0('0x8')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0xc')]('/',auth['isAuthenticated'](),controller[_0x09c0('0xd')]);router[_0x09c0('0xe')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xf')]);router[_0x09c0('0x10')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x11')]);module[_0x09c0('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index b62d053..7ad7bfa 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 _0x04a6=['ENUM','out','exports','BOOLEAN','DATE','STRING'];(function(_0x206090,_0x407c97){var _0x31a12e=function(_0x1b6376){while(--_0x1b6376){_0x206090['push'](_0x206090['shift']());}};_0x31a12e(++_0x407c97);}(_0x04a6,0x8c));var _0x604a=function(_0x28d9c5,_0x17c03c){_0x28d9c5=_0x28d9c5-0x0;var _0x5d5a0c=_0x04a6[_0x28d9c5];return _0x5d5a0c;};'use strict';var Sequelize=require('sequelize');module[_0x604a('0x0')]={'closed':{'type':Sequelize[_0x604a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x604a('0x2')]},'disposition':{'type':Sequelize[_0x604a('0x3')]},'secondDisposition':{'type':Sequelize[_0x604a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x604a('0x3')]},'note':{'type':Sequelize[_0x604a('0x3')]},'read1stAt':{'type':Sequelize[_0x604a('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x604a('0x4')]('in',_0x604a('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x604a('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x604a('0x4')]('in',_0x604a('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x025a=['STRING','DATE','ENUM','out','exports','BOOLEAN'];(function(_0x547add,_0x387042){var _0x2ed1f3=function(_0x3bbb4d){while(--_0x3bbb4d){_0x547add['push'](_0x547add['shift']());}};_0x2ed1f3(++_0x387042);}(_0x025a,0x16c));var _0xa025=function(_0xe1269d,_0x57b7c3){_0xe1269d=_0xe1269d-0x0;var _0x261ca1=_0x025a[_0xe1269d];return _0x261ca1;};'use strict';var Sequelize=require('sequelize');module[_0xa025('0x0')]={'closed':{'type':Sequelize[_0xa025('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa025('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa025('0x2')]},'read1stAt':{'type':Sequelize[_0xa025('0x3')]},'fax':{'type':Sequelize[_0xa025('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xa025('0x4')]('in',_0xa025('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa025('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa025('0x4')]('in',_0xa025('0x5')),'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 1df6c09..15b2b01 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 _0xe2c7=['create','body','find','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','push','Attachment','Messages','createdAt','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','basename','log','err','unlinkSync','zip-dir','moment','util','path','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','destroy','then','end','name','send','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','user','catch','params','query','keys','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options'];(function(_0x5b3a3c,_0x4f5d7e){var _0x5b8add=function(_0x93362d){while(--_0x93362d){_0x5b3a3c['push'](_0x5b3a3c['shift']());}};_0x5b8add(++_0x4f5d7e);}(_0xe2c7,0x104));var _0x7e2c=function(_0x4a4d88,_0x2be95a){_0x4a4d88=_0x4a4d88-0x0;var _0x479329=_0xe2c7[_0x4a4d88];return _0x479329;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x7e2c('0x0'));var moment=require(_0x7e2c('0x1'));var BPromise=require('bluebird');var util=require(_0x7e2c('0x2'));var path=require(_0x7e2c('0x3'));var fs=require('fs');var _=require(_0x7e2c('0x4'));var Redis=require(_0x7e2c('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0x7e2c('0x6'));var logger=require('../../config/logger')(_0x7e2c('0x7'));var config=require(_0x7e2c('0x8'));var db=require(_0x7e2c('0x9'))['db'];config[_0x7e2c('0xa')]=_[_0x7e2c('0xb')](config[_0x7e2c('0xa')],{'host':_0x7e2c('0xc'),'port':0x18eb});var socket=require(_0x7e2c('0xd'))(new Redis(config[_0x7e2c('0xa')]));require('./faxInteraction.socket')[_0x7e2c('0xe')](socket);function respondWithStatusCode(_0x4df7fb,_0x405f3b){_0x405f3b=_0x405f3b||0xcc;return function(_0x33c843){if(_0x33c843){return _0x4df7fb[_0x7e2c('0xf')](_0x405f3b);}return _0x4df7fb['status'](_0x405f3b)['end']();};}function respondWithResult(_0x1361e2,_0x3406cb){_0x3406cb=_0x3406cb||0xc8;return function(_0x1808e1){if(_0x1808e1){return _0x1361e2[_0x7e2c('0x10')](_0x3406cb)[_0x7e2c('0x11')](_0x1808e1);}};}function respondWithFilteredResult(_0x113a6b,_0xf72a33){return function(_0x27fadf){if(_0x27fadf){var _0x174ecc=typeof _0xf72a33[_0x7e2c('0x12')]==='undefined'&&typeof _0xf72a33['limit']===_0x7e2c('0x13');var _0x3e693a=_0x27fadf['count'];var _0x12fde4=_0x174ecc?0x0:_0xf72a33[_0x7e2c('0x12')];var _0x33d783=_0x174ecc?_0x27fadf[_0x7e2c('0x14')]:_0xf72a33[_0x7e2c('0x12')]+_0xf72a33[_0x7e2c('0x15')];var _0x3d58f3;if(_0x33d783>=_0x3e693a){_0x33d783=_0x3e693a;_0x3d58f3=0xc8;}else{_0x3d58f3=0xce;}_0x113a6b[_0x7e2c('0x10')](_0x3d58f3);return _0x113a6b[_0x7e2c('0x16')](_0x7e2c('0x17'),_0x12fde4+'-'+_0x33d783+'/'+_0x3e693a)[_0x7e2c('0x11')](_0x27fadf);}return null;};}function saveUpdates(_0x3534bc){return function(_0x3c9571){if(_0x3c9571){return _0x3c9571['update'](_0x3534bc)['then'](function(_0xdaec80){return _0xdaec80;});}return null;};}function removeEntity(_0x71c92c){return function(_0x42ef1d){if(_0x42ef1d){return _0x42ef1d[_0x7e2c('0x18')]()[_0x7e2c('0x19')](function(){_0x71c92c[_0x7e2c('0x10')](0xcc)[_0x7e2c('0x1a')]();});}};}function handleEntityNotFound(_0x29860a){return function(_0x1cb3d9){if(!_0x1cb3d9){_0x29860a[_0x7e2c('0xf')](0x194);}return _0x1cb3d9;};}function handleError(_0xd55b48,_0xf210d6){_0xf210d6=_0xf210d6||0x1f4;return function(_0x30822c){logger['error'](_0x30822c['stack']);if(_0x30822c[_0x7e2c('0x1b')]){delete _0x30822c[_0x7e2c('0x1b')];}_0xd55b48[_0x7e2c('0x10')](_0xf210d6)[_0x7e2c('0x1c')](_0x30822c);};}exports['index']=function(_0x285c83,_0x239bbd){var _0x18e9d6={};var _0x3058c5=_['map'](db[_0x7e2c('0x1d')][_0x7e2c('0x1e')],function(_0xb58977){return{'name':_0xb58977[_0x7e2c('0x1f')],'type':_0xb58977[_0x7e2c('0x20')][_0x7e2c('0x21')]};});_0x18e9d6=qs[_0x7e2c('0x22')](_0x3058c5,_0x285c83);return interaction[_0x7e2c('0x23')](_0x7e2c('0x24'),_0x285c83['query'],_0x285c83[_0x7e2c('0x25')],_0x18e9d6,_0x3058c5)['then'](respondWithFilteredResult(_0x239bbd,_0x18e9d6))[_0x7e2c('0x26')](handleError(_0x239bbd,null));};exports['show']=function(_0xa08b99,_0x42225c){var _0x1a828f={'raw':![],'where':{'id':_0xa08b99[_0x7e2c('0x27')]['id']}},_0x53ff12={};_0x53ff12['model']=_['keys'](db[_0x7e2c('0x1d')]['rawAttributes']);_0x53ff12[_0x7e2c('0x28')]=_[_0x7e2c('0x29')](_0xa08b99[_0x7e2c('0x28')]);_0x53ff12[_0x7e2c('0x2a')]=_[_0x7e2c('0x2b')](_0x53ff12[_0x7e2c('0x2c')],_0x53ff12['query']);_0x1a828f[_0x7e2c('0x2d')]=_[_0x7e2c('0x2b')](_0x53ff12[_0x7e2c('0x2c')],qs[_0x7e2c('0x2e')](_0xa08b99[_0x7e2c('0x28')][_0x7e2c('0x2e')]));_0x1a828f['attributes']=_0x1a828f[_0x7e2c('0x2d')][_0x7e2c('0x2f')]?_0x1a828f[_0x7e2c('0x2d')]:_0x53ff12[_0x7e2c('0x2c')];if(_0xa08b99[_0x7e2c('0x28')][_0x7e2c('0x30')]){_0x1a828f[_0x7e2c('0x31')]=[{'all':!![]}];}_0x1a828f=_[_0x7e2c('0x32')]({},_0x1a828f,_0xa08b99[_0x7e2c('0x33')]);return db['FaxInteraction']['find'](_0x1a828f)[_0x7e2c('0x19')](handleEntityNotFound(_0x42225c,null))[_0x7e2c('0x19')](respondWithResult(_0x42225c,null))[_0x7e2c('0x26')](handleError(_0x42225c,null));};exports[_0x7e2c('0x34')]=function(_0x45eb9e,_0x4a3eee){return db[_0x7e2c('0x1d')][_0x7e2c('0x34')](_0x45eb9e['body'],{})['then'](respondWithResult(_0x4a3eee,0xc9))[_0x7e2c('0x26')](handleError(_0x4a3eee,null));};exports['update']=function(_0x29cd23,_0x4742c5){if(_0x29cd23['body']['id']){delete _0x29cd23[_0x7e2c('0x35')]['id'];}return db['FaxInteraction'][_0x7e2c('0x36')]({'where':{'id':_0x29cd23[_0x7e2c('0x27')]['id']}})['then'](handleEntityNotFound(_0x4742c5,null))[_0x7e2c('0x19')](saveUpdates(_0x29cd23[_0x7e2c('0x35')],null))['then'](respondWithResult(_0x4742c5,null))['catch'](handleError(_0x4742c5,null));};exports[_0x7e2c('0x18')]=function(_0xba0438,_0x263a14){return db['FaxInteraction'][_0x7e2c('0x36')]({'where':{'id':_0xba0438[_0x7e2c('0x27')]['id']}})[_0x7e2c('0x19')](handleEntityNotFound(_0x263a14,null))[_0x7e2c('0x19')](removeEntity(_0x263a14,null))['catch'](handleError(_0x263a14,null));};exports[_0x7e2c('0x37')]=function(_0x5f5c18,_0x387409){return db[_0x7e2c('0x1d')]['describe']()[_0x7e2c('0x19')](respondWithResult(_0x387409,null))[_0x7e2c('0x26')](handleError(_0x387409,null));};exports[_0x7e2c('0x38')]=function(_0x138855,_0x244099){return db[_0x7e2c('0x39')]['find']({'where':{'id':_0x138855[_0x7e2c('0x27')]['id']}})[_0x7e2c('0x19')](handleEntityNotFound(_0x244099,null))['then'](function(_0x416d49){if(_0x416d49){return _0x416d49[_0x7e2c('0x38')](_0x138855[_0x7e2c('0x35')][_0x7e2c('0x3a')],_[_0x7e2c('0x3b')](_0x138855[_0x7e2c('0x35')],[_0x7e2c('0x3a'),'id'])||{});}})[_0x7e2c('0x19')](respondWithResult(_0x244099,null))['catch'](handleError(_0x244099,null));};exports[_0x7e2c('0x3c')]=function(_0x40f1a5,_0x62eade){var _0x483135={'raw':![],'where':{}};var _0xc80b2b={};var _0x3a8030={'count':0x0,'rows':[]};return db[_0x7e2c('0x1d')][_0x7e2c('0x3d')]({'where':{'id':_0x40f1a5['params']['id']}})[_0x7e2c('0x19')](handleEntityNotFound(_0x62eade,null))['then'](function(_0x7a2ad){if(_0x7a2ad){_0xc80b2b['model']=_[_0x7e2c('0x29')](db[_0x7e2c('0x39')][_0x7e2c('0x1e')]);_0xc80b2b[_0x7e2c('0x28')]=_[_0x7e2c('0x29')](_0x40f1a5[_0x7e2c('0x28')]);_0xc80b2b[_0x7e2c('0x2a')]=_[_0x7e2c('0x2b')](_0xc80b2b[_0x7e2c('0x2c')],_0xc80b2b[_0x7e2c('0x28')]);_0x483135[_0x7e2c('0x2d')]=_[_0x7e2c('0x2b')](_0xc80b2b[_0x7e2c('0x2c')],qs[_0x7e2c('0x2e')](_0x40f1a5[_0x7e2c('0x28')]['fields']));_0x483135[_0x7e2c('0x2d')]=_0x483135['attributes'][_0x7e2c('0x2f')]?_0x483135[_0x7e2c('0x2d')]:_0xc80b2b['model'];if(!_0x40f1a5['query'][_0x7e2c('0x3e')](_0x7e2c('0x3f'))){_0x483135[_0x7e2c('0x15')]=qs[_0x7e2c('0x15')](_0x40f1a5['query'][_0x7e2c('0x15')]);_0x483135['offset']=qs[_0x7e2c('0x12')](_0x40f1a5[_0x7e2c('0x28')][_0x7e2c('0x12')]);}_0x483135[_0x7e2c('0x40')]=qs[_0x7e2c('0x41')](_0x40f1a5[_0x7e2c('0x28')]['sort']);_0x483135[_0x7e2c('0x42')]=qs[_0x7e2c('0x2a')](_[_0x7e2c('0x43')](_0x40f1a5['query'],_0xc80b2b['filters']));_0x483135['where'][_0x7e2c('0x44')]=_0x7a2ad['id'];if(_0x40f1a5[_0x7e2c('0x28')][_0x7e2c('0x45')]){_0x483135[_0x7e2c('0x42')]=_[_0x7e2c('0x32')](_0x483135[_0x7e2c('0x42')],{'$or':_[_0x7e2c('0x46')](_0x483135['attributes'],function(_0x1f6e92){var _0x3df5ef={};_0x3df5ef[_0x1f6e92]={'$like':'%'+_0x40f1a5['query'][_0x7e2c('0x45')]+'%'};return _0x3df5ef;})});}if(_0x40f1a5[_0x7e2c('0x28')][_0x7e2c('0x47')]){var _0x1bc9a6=_0x40f1a5[_0x7e2c('0x28')][_0x7e2c('0x47')][_0x7e2c('0x48')](',');var _0x2f6072={};_0x2f6072[_0x1bc9a6[0x0]]={'$gte':moment(_0x1bc9a6[0x1])[_0x7e2c('0x49')](_0x7e2c('0x4a'))};_0x483135[_0x7e2c('0x42')]=_['merge'](_0x483135[_0x7e2c('0x42')],_0x2f6072);}_0x483135=_[_0x7e2c('0x32')]({},_0x483135,_0x40f1a5['options']);return db[_0x7e2c('0x39')][_0x7e2c('0x14')]({'where':_0x483135[_0x7e2c('0x42')]})[_0x7e2c('0x19')](function(_0x81f35c){_0x3a8030[_0x7e2c('0x14')]=_0x81f35c;if(_0x40f1a5[_0x7e2c('0x28')]['includeAll']){_0x483135[_0x7e2c('0x31')]=[{'all':!![]}];}return db[_0x7e2c('0x39')][_0x7e2c('0x23')](_0x483135);})[_0x7e2c('0x19')](function(_0x7f2c3d){_0x3a8030[_0x7e2c('0x4b')]=_0x7f2c3d;return _0x3a8030;});}})[_0x7e2c('0x19')](respondWithFilteredResult(_0x62eade,_0x483135))['catch'](handleError(_0x62eade,null));};exports[_0x7e2c('0x4c')]=function(_0x28f0bd,_0x846239){return db[_0x7e2c('0x1d')][_0x7e2c('0x36')]({'where':{'id':_0x28f0bd[_0x7e2c('0x27')]['id']}})['then'](handleEntityNotFound(_0x846239,null))['then'](function(_0x1d8065){if(_0x1d8065){return _0x1d8065[_0x7e2c('0x4d')](_0x28f0bd[_0x7e2c('0x35')][_0x7e2c('0x3a')],_[_0x7e2c('0x3b')](_0x28f0bd[_0x7e2c('0x35')],[_0x7e2c('0x3a'),'id'])||{})[_0x7e2c('0x4e')](function(){return db[_0x7e2c('0x4f')]['findAll']({'attributes':['id','name',_0x7e2c('0x50')],'where':{'id':_0x28f0bd[_0x7e2c('0x35')]['ids']}});})[_0x7e2c('0x19')](function(_0x211e24){socket['emit'](_0x7e2c('0x51'),{'id':Number(_0x28f0bd['params']['id']),'tags':_0x211e24||[]});return{'id':Number(_0x28f0bd['params']['id']),'tags':_0x211e24||[]};});}})[_0x7e2c('0x19')](respondWithResult(_0x846239,null))[_0x7e2c('0x26')](handleError(_0x846239,null));};exports['removeTags']=function(_0xedda8b,_0x3864ad){return db['FaxInteraction'][_0x7e2c('0x36')]({'where':{'id':_0xedda8b[_0x7e2c('0x27')]['id']}})[_0x7e2c('0x19')](handleEntityNotFound(_0x3864ad,null))['then'](function(_0x3ffe8a){if(_0x3ffe8a){return _0x3ffe8a[_0x7e2c('0x52')](_0xedda8b[_0x7e2c('0x28')][_0x7e2c('0x3a')]);}})[_0x7e2c('0x19')](respondWithStatusCode(_0x3864ad,null))['catch'](handleError(_0x3864ad,null));};exports[_0x7e2c('0x53')]=function(_0x17c2da,_0x4d129f){var _0x40ce1c=moment()[_0x7e2c('0x54')]()[_0x7e2c('0x55')]();var _0x189e29=path[_0x7e2c('0x56')](config[_0x7e2c('0x57')],_0x7e2c('0x58'),_0x7e2c('0x59'),'tmp');var _0x85da5d=path[_0x7e2c('0x56')](config[_0x7e2c('0x57')],_0x7e2c('0x58'),_0x7e2c('0x59'),_0x7e2c('0x5a'));var _0x3a0941=path[_0x7e2c('0x56')](_0x189e29,_0x40ce1c);var _0xb8026=util[_0x7e2c('0x49')]('transcript-%d-%s.zip',_0x17c2da[_0x7e2c('0x27')]['id'],_0x40ce1c);var _0x503996=path['join'](_0x189e29,_0xb8026);var _0x4d5f45=[];_0x4d5f45[_0x7e2c('0x5b')]({'model':db['Attachment'],'as':_0x7e2c('0x5c'),'raw':!![]});var _0x151bb5=[{'model':db[_0x7e2c('0x39')],'as':_0x7e2c('0x5d'),'attributes':['id',_0x7e2c('0x35'),_0x7e2c('0x5e')],'include':_0x4d5f45}];return db[_0x7e2c('0x1d')][_0x7e2c('0x36')]({'where':{'id':_0x17c2da['params']['id']},'include':_0x151bb5})[_0x7e2c('0x19')](handleEntityNotFound(_0x4d129f,null))[_0x7e2c('0x19')](function(_0x52e598){if(_0x52e598&&_0x52e598[_0x7e2c('0x5d')]){var _0x18df2d=_0x52e598['get']({'plain':!![]});fs[_0x7e2c('0x5f')](_0x3a0941);for(var _0x15bc79=0x0;_0x15bc79<_0x18df2d[_0x7e2c('0x5d')][_0x7e2c('0x2f')];_0x15bc79++){var _0x48370a=_0x18df2d[_0x7e2c('0x5d')][_0x15bc79][_0x7e2c('0x5c')];if(_0x48370a){var _0x2335ff=path[_0x7e2c('0x56')](_0x85da5d,_0x48370a['basename']);if(fs[_0x7e2c('0x60')](_0x2335ff)){fs[_0x7e2c('0x61')](_0x2335ff)[_0x7e2c('0x62')](fs[_0x7e2c('0x63')](path[_0x7e2c('0x56')](_0x3a0941,_0x48370a[_0x7e2c('0x64')])));}}}return BPromise['resolve']()[_0x7e2c('0x19')](function(){return new BPromise(function(_0x63cc07,_0x2aa94c){zipdir(_0x3a0941,{'saveTo':_0x503996},function(_0x479df8,_0x427b89){if(_0x479df8)return _0x2aa94c(_0x479df8);return _0x63cc07(_0x427b89);});})[_0x7e2c('0x19')](function(){return new BPromise(function(_0x9767b4,_0x5b2893){rimraf(_0x3a0941,function(_0x52c85a){if(_0x52c85a)_0x5b2893(_0x52c85a);return _0x9767b4();});});})[_0x7e2c('0x19')](function(){return _0x4d129f[_0x7e2c('0x53')](_0x503996,_0xb8026,function(_0x485250){if(_0x485250){console[_0x7e2c('0x65')](_0x7e2c('0x66'),_0x485250);}else{fs[_0x7e2c('0x67')](_0x503996);}});});});}else{return _0x4d129f[_0x7e2c('0xf')](0xc8);}})[_0x7e2c('0x26')](handleError(_0x4d129f,null));}; \ No newline at end of file +var _0x3a72=['name','send','index','map','FaxInteraction','findAll','fax','query','user','catch','show','params','rawAttributes','filters','intersection','model','fields','attributes','length','includeAll','include','merge','find','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','keys','order','sort','where','pick','FaxInteractionId','filter','$gte','split','format','options','rows','setTags','spread','Tag','emit','faxInteractionTags:save','removeTags','unix','toString','root','server','files','tmp','join','transcript-%d-%s.zip','push','Attachment','createdAt','Messages','get','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','basename','resolve','download','unlinkSync','zip-dir','moment','bluebird','path','lodash','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0x3a72,0x10f));var _0x23a7=function(_0x5d6200,_0x184f0f){_0x5d6200=_0x5d6200-0x0;var _0x3a5b83=_0x3a72[_0x5d6200];return _0x3a5b83;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x23a7('0x0'));var moment=require(_0x23a7('0x1'));var BPromise=require(_0x23a7('0x2'));var util=require('util');var path=require(_0x23a7('0x3'));var fs=require('fs');var _=require(_0x23a7('0x4'));var Redis=require('ioredis');var interaction=require(_0x23a7('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x23a7('0x6'))(_0x23a7('0x7'));var config=require(_0x23a7('0x8'));var db=require(_0x23a7('0x9'))['db'];config[_0x23a7('0xa')]=_[_0x23a7('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x23a7('0xc'))(new Redis(config[_0x23a7('0xa')]));require(_0x23a7('0xd'))[_0x23a7('0xe')](socket);function respondWithStatusCode(_0x37d194,_0x3326fb){_0x3326fb=_0x3326fb||0xcc;return function(_0x2ea2fe){if(_0x2ea2fe){return _0x37d194[_0x23a7('0xf')](_0x3326fb);}return _0x37d194['status'](_0x3326fb)['end']();};}function respondWithResult(_0x6cd93c,_0x1aa719){_0x1aa719=_0x1aa719||0xc8;return function(_0x52fdca){if(_0x52fdca){return _0x6cd93c[_0x23a7('0x10')](_0x1aa719)[_0x23a7('0x11')](_0x52fdca);}};}function respondWithFilteredResult(_0x46b279,_0xf92d15){return function(_0x482563){if(_0x482563){var _0x389a2f=typeof _0xf92d15[_0x23a7('0x12')]===_0x23a7('0x13')&&typeof _0xf92d15['limit']===_0x23a7('0x13');var _0x4ac350=_0x482563[_0x23a7('0x14')];var _0x9318ac=_0x389a2f?0x0:_0xf92d15['offset'];var _0x418fbf=_0x389a2f?_0x482563[_0x23a7('0x14')]:_0xf92d15[_0x23a7('0x12')]+_0xf92d15[_0x23a7('0x15')];var _0x19dd3f;if(_0x418fbf>=_0x4ac350){_0x418fbf=_0x4ac350;_0x19dd3f=0xc8;}else{_0x19dd3f=0xce;}_0x46b279[_0x23a7('0x10')](_0x19dd3f);return _0x46b279[_0x23a7('0x16')](_0x23a7('0x17'),_0x9318ac+'-'+_0x418fbf+'/'+_0x4ac350)[_0x23a7('0x11')](_0x482563);}return null;};}function saveUpdates(_0x363f5a){return function(_0x51b414){if(_0x51b414){return _0x51b414[_0x23a7('0x18')](_0x363f5a)[_0x23a7('0x19')](function(_0x3ad77c){return _0x3ad77c;});}return null;};}function removeEntity(_0x3ff3ff){return function(_0x186f96){if(_0x186f96){return _0x186f96[_0x23a7('0x1a')]()[_0x23a7('0x19')](function(){_0x3ff3ff[_0x23a7('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d60d9){return function(_0x2e1546){if(!_0x2e1546){_0x4d60d9[_0x23a7('0xf')](0x194);}return _0x2e1546;};}function handleError(_0x12c5b4,_0x791bbd){_0x791bbd=_0x791bbd||0x1f4;return function(_0x8b976b){logger[_0x23a7('0x1b')](_0x8b976b[_0x23a7('0x1c')]);if(_0x8b976b[_0x23a7('0x1d')]){delete _0x8b976b[_0x23a7('0x1d')];}_0x12c5b4['status'](_0x791bbd)[_0x23a7('0x1e')](_0x8b976b);};}exports[_0x23a7('0x1f')]=function(_0x4e5e89,_0x49307d){var _0x364ea7={};var _0x1c0a12=_[_0x23a7('0x20')](db[_0x23a7('0x21')]['rawAttributes'],function(_0x25b5fc){return{'name':_0x25b5fc['fieldName'],'type':_0x25b5fc['type']['key']};});_0x364ea7=qs['getOptions'](_0x1c0a12,_0x4e5e89);return interaction[_0x23a7('0x22')](_0x23a7('0x23'),_0x4e5e89[_0x23a7('0x24')],_0x4e5e89[_0x23a7('0x25')],_0x364ea7,_0x1c0a12)['then'](respondWithFilteredResult(_0x49307d,_0x364ea7))[_0x23a7('0x26')](handleError(_0x49307d,null));};exports[_0x23a7('0x27')]=function(_0x273fb1,_0x227a74){var _0x44e88c={'raw':![],'where':{'id':_0x273fb1[_0x23a7('0x28')]['id']}},_0x1ece13={};_0x1ece13['model']=_['keys'](db['FaxInteraction'][_0x23a7('0x29')]);_0x1ece13[_0x23a7('0x24')]=_['keys'](_0x273fb1[_0x23a7('0x24')]);_0x1ece13[_0x23a7('0x2a')]=_[_0x23a7('0x2b')](_0x1ece13[_0x23a7('0x2c')],_0x1ece13[_0x23a7('0x24')]);_0x44e88c['attributes']=_['intersection'](_0x1ece13[_0x23a7('0x2c')],qs['fields'](_0x273fb1[_0x23a7('0x24')][_0x23a7('0x2d')]));_0x44e88c['attributes']=_0x44e88c[_0x23a7('0x2e')][_0x23a7('0x2f')]?_0x44e88c[_0x23a7('0x2e')]:_0x1ece13['model'];if(_0x273fb1[_0x23a7('0x24')][_0x23a7('0x30')]){_0x44e88c[_0x23a7('0x31')]=[{'all':!![]}];}_0x44e88c=_[_0x23a7('0x32')]({},_0x44e88c,_0x273fb1['options']);return db[_0x23a7('0x21')][_0x23a7('0x33')](_0x44e88c)[_0x23a7('0x19')](handleEntityNotFound(_0x227a74,null))['then'](respondWithResult(_0x227a74,null))[_0x23a7('0x26')](handleError(_0x227a74,null));};exports[_0x23a7('0x34')]=function(_0x343ffa,_0x5cb29b){return db['FaxInteraction'][_0x23a7('0x34')](_0x343ffa[_0x23a7('0x35')],{})[_0x23a7('0x19')](respondWithResult(_0x5cb29b,0xc9))[_0x23a7('0x26')](handleError(_0x5cb29b,null));};exports['update']=function(_0x4598ec,_0x289387){if(_0x4598ec['body']['id']){delete _0x4598ec['body']['id'];}return db[_0x23a7('0x21')][_0x23a7('0x33')]({'where':{'id':_0x4598ec[_0x23a7('0x28')]['id']}})['then'](handleEntityNotFound(_0x289387,null))['then'](saveUpdates(_0x4598ec[_0x23a7('0x35')],null))[_0x23a7('0x19')](respondWithResult(_0x289387,null))[_0x23a7('0x26')](handleError(_0x289387,null));};exports[_0x23a7('0x1a')]=function(_0x458249,_0x114042){return db['FaxInteraction']['find']({'where':{'id':_0x458249[_0x23a7('0x28')]['id']}})['then'](handleEntityNotFound(_0x114042,null))['then'](removeEntity(_0x114042,null))['catch'](handleError(_0x114042,null));};exports[_0x23a7('0x36')]=function(_0x244241,_0x28edb4){return db['FaxInteraction'][_0x23a7('0x36')]()[_0x23a7('0x19')](respondWithResult(_0x28edb4,null))[_0x23a7('0x26')](handleError(_0x28edb4,null));};exports[_0x23a7('0x37')]=function(_0x113c58,_0x5e5148){return db[_0x23a7('0x38')][_0x23a7('0x33')]({'where':{'id':_0x113c58[_0x23a7('0x28')]['id']}})['then'](handleEntityNotFound(_0x5e5148,null))[_0x23a7('0x19')](function(_0x214954){if(_0x214954){return _0x214954[_0x23a7('0x37')](_0x113c58[_0x23a7('0x35')][_0x23a7('0x39')],_[_0x23a7('0x3a')](_0x113c58[_0x23a7('0x35')],[_0x23a7('0x39'),'id'])||{});}})['then'](respondWithResult(_0x5e5148,null))['catch'](handleError(_0x5e5148,null));};exports[_0x23a7('0x3b')]=function(_0x1af2cc,_0x5d5e47){var _0x18cbad={'raw':![],'where':{}};var _0x202907={};var _0x31de2a={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x1af2cc[_0x23a7('0x28')]['id']}})[_0x23a7('0x19')](handleEntityNotFound(_0x5d5e47,null))[_0x23a7('0x19')](function(_0x33261f){if(_0x33261f){_0x202907[_0x23a7('0x2c')]=_[_0x23a7('0x3c')](db[_0x23a7('0x38')]['rawAttributes']);_0x202907['query']=_[_0x23a7('0x3c')](_0x1af2cc[_0x23a7('0x24')]);_0x202907[_0x23a7('0x2a')]=_[_0x23a7('0x2b')](_0x202907[_0x23a7('0x2c')],_0x202907[_0x23a7('0x24')]);_0x18cbad[_0x23a7('0x2e')]=_['intersection'](_0x202907[_0x23a7('0x2c')],qs[_0x23a7('0x2d')](_0x1af2cc[_0x23a7('0x24')][_0x23a7('0x2d')]));_0x18cbad[_0x23a7('0x2e')]=_0x18cbad[_0x23a7('0x2e')]['length']?_0x18cbad[_0x23a7('0x2e')]:_0x202907['model'];if(!_0x1af2cc['query']['hasOwnProperty']('nolimit')){_0x18cbad['limit']=qs[_0x23a7('0x15')](_0x1af2cc[_0x23a7('0x24')][_0x23a7('0x15')]);_0x18cbad['offset']=qs[_0x23a7('0x12')](_0x1af2cc[_0x23a7('0x24')][_0x23a7('0x12')]);}_0x18cbad[_0x23a7('0x3d')]=qs['sort'](_0x1af2cc['query'][_0x23a7('0x3e')]);_0x18cbad[_0x23a7('0x3f')]=qs[_0x23a7('0x2a')](_[_0x23a7('0x40')](_0x1af2cc[_0x23a7('0x24')],_0x202907[_0x23a7('0x2a')]));_0x18cbad[_0x23a7('0x3f')][_0x23a7('0x41')]=_0x33261f['id'];if(_0x1af2cc[_0x23a7('0x24')][_0x23a7('0x42')]){_0x18cbad['where']=_[_0x23a7('0x32')](_0x18cbad[_0x23a7('0x3f')],{'$or':_['map'](_0x18cbad[_0x23a7('0x2e')],function(_0x1a30e7){var _0x144325={};_0x144325[_0x1a30e7]={'$like':'%'+_0x1af2cc['query'][_0x23a7('0x42')]+'%'};return _0x144325;})});}if(_0x1af2cc[_0x23a7('0x24')][_0x23a7('0x43')]){var _0x547a91=_0x1af2cc[_0x23a7('0x24')][_0x23a7('0x43')][_0x23a7('0x44')](',');var _0x23433d={};_0x23433d[_0x547a91[0x0]]={'$gte':moment(_0x547a91[0x1])[_0x23a7('0x45')]('YYYY-MM-DD\x20HH:mm:ss')};_0x18cbad[_0x23a7('0x3f')]=_['merge'](_0x18cbad[_0x23a7('0x3f')],_0x23433d);}_0x18cbad=_[_0x23a7('0x32')]({},_0x18cbad,_0x1af2cc[_0x23a7('0x46')]);return db[_0x23a7('0x38')][_0x23a7('0x14')]({'where':_0x18cbad[_0x23a7('0x3f')]})[_0x23a7('0x19')](function(_0x2f6c44){_0x31de2a[_0x23a7('0x14')]=_0x2f6c44;if(_0x1af2cc[_0x23a7('0x24')][_0x23a7('0x30')]){_0x18cbad[_0x23a7('0x31')]=[{'all':!![]}];}return db[_0x23a7('0x38')][_0x23a7('0x22')](_0x18cbad);})[_0x23a7('0x19')](function(_0x1ca872){_0x31de2a[_0x23a7('0x47')]=_0x1ca872;return _0x31de2a;});}})['then'](respondWithFilteredResult(_0x5d5e47,_0x18cbad))[_0x23a7('0x26')](handleError(_0x5d5e47,null));};exports['addTags']=function(_0x32a974,_0x3c5009){return db[_0x23a7('0x21')][_0x23a7('0x33')]({'where':{'id':_0x32a974[_0x23a7('0x28')]['id']}})['then'](handleEntityNotFound(_0x3c5009,null))[_0x23a7('0x19')](function(_0x54e8d7){if(_0x54e8d7){return _0x54e8d7[_0x23a7('0x48')](_0x32a974[_0x23a7('0x35')][_0x23a7('0x39')],_[_0x23a7('0x3a')](_0x32a974[_0x23a7('0x35')],[_0x23a7('0x39'),'id'])||{})[_0x23a7('0x49')](function(){return db[_0x23a7('0x4a')][_0x23a7('0x22')]({'attributes':['id',_0x23a7('0x1d'),'color'],'where':{'id':_0x32a974[_0x23a7('0x35')][_0x23a7('0x39')]}});})[_0x23a7('0x19')](function(_0x3e5046){socket[_0x23a7('0x4b')](_0x23a7('0x4c'),{'id':Number(_0x32a974[_0x23a7('0x28')]['id']),'tags':_0x3e5046||[]});return{'id':Number(_0x32a974['params']['id']),'tags':_0x3e5046||[]};});}})['then'](respondWithResult(_0x3c5009,null))[_0x23a7('0x26')](handleError(_0x3c5009,null));};exports[_0x23a7('0x4d')]=function(_0x57c097,_0x48d8b3){return db[_0x23a7('0x21')][_0x23a7('0x33')]({'where':{'id':_0x57c097['params']['id']}})[_0x23a7('0x19')](handleEntityNotFound(_0x48d8b3,null))[_0x23a7('0x19')](function(_0x4be083){if(_0x4be083){return _0x4be083[_0x23a7('0x4d')](_0x57c097[_0x23a7('0x24')]['ids']);}})[_0x23a7('0x19')](respondWithStatusCode(_0x48d8b3,null))[_0x23a7('0x26')](handleError(_0x48d8b3,null));};exports['download']=function(_0xd3d458,_0x397c18){var _0x2ed7e5=moment()[_0x23a7('0x4e')]()[_0x23a7('0x4f')]();var _0x227222=path['join'](config[_0x23a7('0x50')],_0x23a7('0x51'),_0x23a7('0x52'),_0x23a7('0x53'));var _0x51eb2e=path[_0x23a7('0x54')](config[_0x23a7('0x50')],_0x23a7('0x51'),_0x23a7('0x52'),'attachments');var _0x50cd08=path[_0x23a7('0x54')](_0x227222,_0x2ed7e5);var _0x5a8c00=util[_0x23a7('0x45')](_0x23a7('0x55'),_0xd3d458['params']['id'],_0x2ed7e5);var _0x25c46a=path['join'](_0x227222,_0x5a8c00);var _0x6b3091=[];_0x6b3091[_0x23a7('0x56')]({'model':db[_0x23a7('0x57')],'as':'Attachment','raw':!![]});var _0x5c7807=[{'model':db[_0x23a7('0x38')],'as':'Messages','attributes':['id','body',_0x23a7('0x58')],'include':_0x6b3091}];return db[_0x23a7('0x21')][_0x23a7('0x33')]({'where':{'id':_0xd3d458[_0x23a7('0x28')]['id']},'include':_0x5c7807})['then'](handleEntityNotFound(_0x397c18,null))[_0x23a7('0x19')](function(_0x867b75){if(_0x867b75&&_0x867b75[_0x23a7('0x59')]){var _0x2bb3e0=_0x867b75[_0x23a7('0x5a')]({'plain':!![]});fs[_0x23a7('0x5b')](_0x50cd08);for(var _0x36d924=0x0;_0x36d924<_0x2bb3e0[_0x23a7('0x59')][_0x23a7('0x2f')];_0x36d924++){var _0x4dd068=_0x2bb3e0[_0x23a7('0x59')][_0x36d924][_0x23a7('0x57')];if(_0x4dd068){var _0x17e3cf=path[_0x23a7('0x54')](_0x51eb2e,_0x4dd068['basename']);if(fs[_0x23a7('0x5c')](_0x17e3cf)){fs[_0x23a7('0x5d')](_0x17e3cf)[_0x23a7('0x5e')](fs[_0x23a7('0x5f')](path[_0x23a7('0x54')](_0x50cd08,_0x4dd068[_0x23a7('0x60')])));}}}return BPromise[_0x23a7('0x61')]()[_0x23a7('0x19')](function(){return new BPromise(function(_0x4c2a2a,_0x5204aa){zipdir(_0x50cd08,{'saveTo':_0x25c46a},function(_0x38ef29,_0x9173b3){if(_0x38ef29)return _0x5204aa(_0x38ef29);return _0x4c2a2a(_0x9173b3);});})[_0x23a7('0x19')](function(){return new BPromise(function(_0x19c225,_0x513c77){rimraf(_0x50cd08,function(_0x5343d7){if(_0x5343d7)_0x513c77(_0x5343d7);return _0x19c225();});});})['then'](function(){return _0x397c18[_0x23a7('0x62')](_0x25c46a,_0x5a8c00,function(_0x502595){if(_0x502595){console['log']('err',_0x502595);}else{fs[_0x23a7('0x63')](_0x25c46a);}});});});}else{return _0x397c18['sendStatus'](0xc8);}})[_0x23a7('0x26')](handleError(_0x397c18,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index d2afca8..694f3cb 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 _0xcd4a=['update','remove','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save'];(function(_0x34baf0,_0x3367fa){var _0x52a5f4=function(_0x382182){while(--_0x382182){_0x34baf0['push'](_0x34baf0['shift']());}};_0x52a5f4(++_0x3367fa);}(_0xcd4a,0x117));var _0xacd4=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0xcd4a[_0x4ed4d2];return _0x15ae2e;};'use strict';var EventEmitter=require(_0xacd4('0x0'));var FaxInteraction=require(_0xacd4('0x1'))['db'][_0xacd4('0x2')];var FaxMessage=require(_0xacd4('0x1'))['db'][_0xacd4('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xacd4('0x4')](0x0);var events={'afterCreate':_0xacd4('0x5'),'afterUpdate':_0xacd4('0x6'),'afterDestroy':_0xacd4('0x7')};function emitEvent(_0x35bc16){return function(_0x1b41aa,_0x5c3be9,_0x3ff1ab){_0x1b41aa['getUsers']({'attributes':['id'],'raw':!![]})[_0xacd4('0x8')](function(_0x28d9c0){_0x1b41aa[_0xacd4('0x9')](_0xacd4('0xa'),_0x28d9c0[_0xacd4('0xb')](function(_0x1d3674){return{'id':_0x1d3674['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x1b41aa['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x41b29b){_0x1b41aa[_0xacd4('0x9')](_0xacd4('0xc'),_0x41b29b[_0xacd4('0xd')]);FaxInteractionEvents[_0xacd4('0xe')](_0x35bc16+':'+_0x1b41aa['id'],_0x1b41aa);FaxInteractionEvents[_0xacd4('0xe')](_0x35bc16,_0x1b41aa);_0x3ff1ab(null);})[_0xacd4('0xf')](_0x3ff1ab(null));};}for(var e in events){if(events[_0xacd4('0x10')](e)){var event=events[e];FaxInteraction[_0xacd4('0x11')](e,emitEvent(event));}}module[_0xacd4('0x12')]=FaxInteractionEvents; \ No newline at end of file +var _0xd956=['FaxInteraction','setMaxListeners','save','update','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb'];(function(_0x5828fd,_0x1fbb9c){var _0x50a269=function(_0x32f1b1){while(--_0x32f1b1){_0x5828fd['push'](_0x5828fd['shift']());}};_0x50a269(++_0x1fbb9c);}(_0xd956,0xce));var _0x6d95=function(_0x4a9379,_0x20cbd8){_0x4a9379=_0x4a9379-0x0;var _0x4976ed=_0xd956[_0x4a9379];return _0x4976ed;};'use strict';var EventEmitter=require(_0x6d95('0x0'));var FaxInteraction=require(_0x6d95('0x1'))['db'][_0x6d95('0x2')];var FaxMessage=require(_0x6d95('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x6d95('0x3')](0x0);var events={'afterCreate':_0x6d95('0x4'),'afterUpdate':_0x6d95('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3919d5){return function(_0x499797,_0x19a7bc,_0x4d4fe3){_0x499797['getUsers']({'attributes':['id'],'raw':!![]})[_0x6d95('0x6')](function(_0x1521cb){_0x499797[_0x6d95('0x7')](_0x6d95('0x8'),_0x1521cb[_0x6d95('0x9')](function(_0x597d1e){return{'id':_0x597d1e['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x499797['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6d95('0x6')](function(_0x3e97c5){_0x499797['setDataValue'](_0x6d95('0xa'),_0x3e97c5[_0x6d95('0xb')]);FaxInteractionEvents[_0x6d95('0xc')](_0x3919d5+':'+_0x499797['id'],_0x499797);FaxInteractionEvents[_0x6d95('0xc')](_0x3919d5,_0x499797);_0x4d4fe3(null);})[_0x6d95('0xd')](_0x4d4fe3(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x6d95('0xe')](e,emitEvent(event));}}module[_0x6d95('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 9d79089..1bd129d 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 _0xacf4=['define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxInteraction.attributes','exports'];(function(_0x20520f,_0x4bf423){var _0xf893fd=function(_0x35f8dc){while(--_0x35f8dc){_0x20520f['push'](_0x20520f['shift']());}};_0xf893fd(++_0x4bf423);}(_0xacf4,0xe7));var _0x4acf=function(_0x4a20b1,_0xeedabf){_0x4a20b1=_0x4a20b1-0x0;var _0x5afe3a=_0xacf4[_0x4a20b1];return _0x5afe3a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));module[_0x4acf('0x8')]=function(_0x4e0c43,_0x24bf24){return _0x4e0c43[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25d345,_0x50f5f4,_0x55f61d){if(_0x25d345[_0x4acf('0xc')]('closed')){_0x25d345[_0x4acf('0xd')]=moment()[_0x4acf('0xe')](_0x4acf('0xf'));}_0x55f61d(null,_0x25d345);}}});}; \ No newline at end of file +var _0x1c77=['fax_interactions','closed','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x1c77,0xed));var _0x71c7=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0x1c77[_0x466bc5];return _0x138952;};'use strict';var _=require('lodash');var util=require(_0x71c7('0x0'));var logger=require(_0x71c7('0x1'))(_0x71c7('0x2'));var moment=require(_0x71c7('0x3'));var BPromise=require(_0x71c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71c7('0x5'));var rimraf=require(_0x71c7('0x6'));var config=require(_0x71c7('0x7'));var attributes=require(_0x71c7('0x8'));module[_0x71c7('0x9')]=function(_0x1ee344,_0x2fb422){return _0x1ee344['define']('FaxInteraction',attributes,{'tableName':_0x71c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x244867,_0x229b00,_0x471bc6){if(_0x244867['changed'](_0x71c7('0xb'))){_0x244867['closedAt']=moment()['format'](_0x71c7('0xc'));}_0x471bc6(null,_0x244867);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 310c1ca..e912c42 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 _0x0294=['localhost','socket.io-emitter','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','limit','stringify','AddTagsToFaxInteraction','find','ids','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','defaults','redis'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x0294,0x89));var _0x4029=function(_0x5d275e,_0x3c595b){_0x5d275e=_0x5d275e-0x0;var _0x3462e1=_0x0294[_0x5d275e];return _0x3462e1;};'use strict';var _=require(_0x4029('0x0'));var util=require(_0x4029('0x1'));var moment=require('moment');var BPromise=require(_0x4029('0x2'));var rs=require(_0x4029('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4029('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4029('0x5'))(_0x4029('0x6'));var config=require('../../config/environment');var jayson=require(_0x4029('0x7'));var client=jayson['client'][_0x4029('0x8')]({'port':0x232a});config['redis']=_[_0x4029('0x9')](config[_0x4029('0xa')],{'host':_0x4029('0xb'),'port':0x18eb});var socket=require(_0x4029('0xc'))(new Redis(config[_0x4029('0xa')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x5ea907,_0xb3f923,_0xa0121c){return new BPromise(function(_0x98e2b7,_0x4efdb5){return client['request'](_0x5ea907,_0xa0121c)[_0x4029('0xd')](function(_0x3fed7a){logger[_0x4029('0xe')](_0x4029('0xf'),_0xb3f923,_0x4029('0x10'));logger[_0x4029('0x11')](_0x4029('0x12'),_0xb3f923,'request\x20sent',JSON['stringify'](_0x3fed7a));if(_0x3fed7a['error']){if(_0x3fed7a[_0x4029('0x13')][_0x4029('0x14')]===0x1f4){logger[_0x4029('0x13')]('FaxInteraction,\x20%s,\x20%s',_0xb3f923,_0x3fed7a[_0x4029('0x13')][_0x4029('0x15')]);return _0x4efdb5(_0x3fed7a['error'][_0x4029('0x15')]);}logger[_0x4029('0x13')](_0x4029('0xf'),_0xb3f923,_0x3fed7a['error'][_0x4029('0x15')]);return _0x98e2b7(_0x3fed7a[_0x4029('0x13')]['message']);}else{logger[_0x4029('0xe')](_0x4029('0xf'),_0xb3f923,_0x4029('0x10'));_0x98e2b7(_0x3fed7a[_0x4029('0x16')]['message']);}})[_0x4029('0x17')](function(_0x2f9e7b){logger[_0x4029('0x13')](_0x4029('0xf'),_0xb3f923,_0x2f9e7b);_0x4efdb5(_0x2f9e7b);});});}exports[_0x4029('0x18')]=function(_0x7265d7){var _0x579176=this;return new Promise(function(_0x56ba8a,_0x51a4f6){return db[_0x4029('0x19')][_0x4029('0x1a')](_0x7265d7[_0x4029('0x1b')],{'raw':_0x7265d7[_0x4029('0x1c')]?_0x7265d7[_0x4029('0x1c')][_0x4029('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7265d7[_0x4029('0x1c')]?_0x7265d7[_0x4029('0x1c')][_0x4029('0x1e')]||null:null,'attributes':_0x7265d7[_0x4029('0x1c')]?_0x7265d7[_0x4029('0x1c')]['attributes']||null:null,'limit':_0x7265d7[_0x4029('0x1c')]?_0x7265d7[_0x4029('0x1c')][_0x4029('0x1f')]||null:null})[_0x4029('0xd')](function(_0x5226e9){logger[_0x4029('0xe')](_0x4029('0x18'),_0x7265d7);logger[_0x4029('0x11')](_0x4029('0x18'),_0x7265d7,JSON[_0x4029('0x20')](_0x5226e9));_0x56ba8a(_0x5226e9);})['catch'](function(_0x708d46){logger[_0x4029('0x13')](_0x4029('0x18'),_0x708d46[_0x4029('0x15')],_0x7265d7);_0x51a4f6(_0x579176['error'](0x1f4,_0x708d46['message']));});});};exports[_0x4029('0x21')]=function(_0x23dad0){return new Promise(function(_0x38ac49,_0x2fac26){return db[_0x4029('0x19')][_0x4029('0x22')]({'where':_0x23dad0['options']?_0x23dad0['options'][_0x4029('0x1e')]||null:null})[_0x4029('0xd')](function(_0x12aa8d){if(_0x12aa8d){return _0x12aa8d['addTags'](_0x23dad0[_0x4029('0x1b')][_0x4029('0x23')],_['omit'](_0x23dad0['body'],[_0x4029('0x23'),'id'])||{});}})['spread'](function(_0x316d37){logger[_0x4029('0xe')](_0x4029('0x24'),_0x23dad0);logger['debug'](_0x4029('0x24'),_0x23dad0,JSON['stringify'](_0x316d37));_0x38ac49(_0x316d37);})[_0x4029('0x17')](function(_0x32e014){logger[_0x4029('0x13')](_0x4029('0x24'),_0x32e014[_0x4029('0x15')],_0x23dad0);_0x2fac26(_this[_0x4029('0x13')](0x1f4,_0x32e014['message']));});});}; \ No newline at end of file +var _0xb91e=['find','where','addTags','omit','ids','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','message','error','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','limit','info','AddTagsToFaxInteraction'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xb91e,0x1ca));var _0xeb91=function(_0x103a39,_0x5b9859){_0x103a39=_0x103a39-0x0;var _0x259893=_0xb91e[_0x103a39];return _0x259893;};'use strict';var _=require(_0xeb91('0x0'));var util=require(_0xeb91('0x1'));var moment=require('moment');var BPromise=require(_0xeb91('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb91('0x3'));var db=require(_0xeb91('0x4'))['db'];var utils=require(_0xeb91('0x5'));var logger=require(_0xeb91('0x6'))(_0xeb91('0x7'));var config=require('../../config/environment');var jayson=require(_0xeb91('0x8'));var client=jayson[_0xeb91('0x9')][_0xeb91('0xa')]({'port':0x232a});config['redis']=_[_0xeb91('0xb')](config[_0xeb91('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb91('0xd'))(new Redis(config[_0xeb91('0xc')]));require(_0xeb91('0xe'))['register'](socket);function respondWithRpcPromise(_0xfcc033,_0x17cd3b,_0x1d51c1){return new BPromise(function(_0x2d5a5a,_0x16088b){return client[_0xeb91('0xf')](_0xfcc033,_0x1d51c1)[_0xeb91('0x10')](function(_0x3a0fb7){logger['info'](_0xeb91('0x11'),_0x17cd3b,_0xeb91('0x12'));logger[_0xeb91('0x13')](_0xeb91('0x14'),_0x17cd3b,_0xeb91('0x12'),JSON[_0xeb91('0x15')](_0x3a0fb7));if(_0x3a0fb7['error']){if(_0x3a0fb7['error']['code']===0x1f4){logger['error'](_0xeb91('0x11'),_0x17cd3b,_0x3a0fb7['error'][_0xeb91('0x16')]);return _0x16088b(_0x3a0fb7[_0xeb91('0x17')]['message']);}logger[_0xeb91('0x17')](_0xeb91('0x11'),_0x17cd3b,_0x3a0fb7[_0xeb91('0x17')]['message']);return _0x2d5a5a(_0x3a0fb7[_0xeb91('0x17')][_0xeb91('0x16')]);}else{logger['info'](_0xeb91('0x11'),_0x17cd3b,'request\x20sent');_0x2d5a5a(_0x3a0fb7[_0xeb91('0x18')][_0xeb91('0x16')]);}})[_0xeb91('0x19')](function(_0x1073af){logger[_0xeb91('0x17')](_0xeb91('0x11'),_0x17cd3b,_0x1073af);_0x16088b(_0x1073af);});});}exports[_0xeb91('0x1a')]=function(_0x5d522f){var _0x40037c=this;return new Promise(function(_0x171d33,_0x23f484){return db[_0xeb91('0x1b')]['update'](_0x5d522f[_0xeb91('0x1c')],{'raw':_0x5d522f[_0xeb91('0x1d')]?_0x5d522f[_0xeb91('0x1d')][_0xeb91('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d522f[_0xeb91('0x1d')]?_0x5d522f[_0xeb91('0x1d')]['where']||null:null,'attributes':_0x5d522f[_0xeb91('0x1d')]?_0x5d522f['options']['attributes']||null:null,'limit':_0x5d522f[_0xeb91('0x1d')]?_0x5d522f[_0xeb91('0x1d')][_0xeb91('0x1f')]||null:null})[_0xeb91('0x10')](function(_0x41f791){logger[_0xeb91('0x20')]('UpdateFaxInteraction',_0x5d522f);logger[_0xeb91('0x13')](_0xeb91('0x1a'),_0x5d522f,JSON[_0xeb91('0x15')](_0x41f791));_0x171d33(_0x41f791);})[_0xeb91('0x19')](function(_0x3c4ae6){logger['error'](_0xeb91('0x1a'),_0x3c4ae6[_0xeb91('0x16')],_0x5d522f);_0x23f484(_0x40037c['error'](0x1f4,_0x3c4ae6[_0xeb91('0x16')]));});});};exports[_0xeb91('0x21')]=function(_0x54a817){return new Promise(function(_0x3f58d9,_0x41724c){return db['FaxInteraction'][_0xeb91('0x22')]({'where':_0x54a817[_0xeb91('0x1d')]?_0x54a817[_0xeb91('0x1d')][_0xeb91('0x23')]||null:null})['then'](function(_0x289913){if(_0x289913){return _0x289913[_0xeb91('0x24')](_0x54a817[_0xeb91('0x1c')]['ids'],_[_0xeb91('0x25')](_0x54a817[_0xeb91('0x1c')],[_0xeb91('0x26'),'id'])||{});}})[_0xeb91('0x27')](function(_0x457619){logger['info'](_0xeb91('0x28'),_0x54a817);logger[_0xeb91('0x13')](_0xeb91('0x28'),_0x54a817,JSON['stringify'](_0x457619));_0x3f58d9(_0x457619);})[_0xeb91('0x19')](function(_0x1aa82b){logger[_0xeb91('0x17')](_0xeb91('0x28'),_0x1aa82b[_0xeb91('0x16')],_0x54a817);_0x41724c(_this[_0xeb91('0x17')](0x1f4,_0x1aa82b[_0xeb91('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 323ee44..6b0286e 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 _0x4574=['faxInteraction:','./faxInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x2eb9a6,_0x5f3991){var _0xe8b656=function(_0x1410b6){while(--_0x1410b6){_0x2eb9a6['push'](_0x2eb9a6['shift']());}};_0xe8b656(++_0x5f3991);}(_0x4574,0x91));var _0x4457=function(_0xd9bf93,_0x43cb74){_0xd9bf93=_0xd9bf93-0x0;var _0x532cfc=_0x4574[_0xd9bf93];return _0x532cfc;};'use strict';var FaxInteractionEvents=require(_0x4457('0x0'));var events=[_0x4457('0x1'),_0x4457('0x2'),_0x4457('0x3')];function createListener(_0x562803,_0x94d803){return function(_0x3de66e){_0x94d803[_0x4457('0x4')](_0x562803,_0x3de66e);};}function removeListener(_0x4b59f5,_0x330a59){return function(){FaxInteractionEvents[_0x4457('0x5')](_0x4b59f5,_0x330a59);};}exports[_0x4457('0x6')]=function(_0x2090eb){for(var _0x15a57c=0x0,_0x463033=events[_0x4457('0x7')];_0x15a57c<_0x463033;_0x15a57c++){var _0x36b4d7=events[_0x15a57c];var _0x438083=createListener(_0x4457('0x8')+_0x36b4d7,_0x2090eb);FaxInteractionEvents['on'](_0x36b4d7,_0x438083);}}; \ No newline at end of file +var _0xb952=['removeListener','register','length','faxInteraction:','./faxInteraction.events','save','update','emit'];(function(_0x486f67,_0x31a5ba){var _0x51e075=function(_0x5aec97){while(--_0x5aec97){_0x486f67['push'](_0x486f67['shift']());}};_0x51e075(++_0x31a5ba);}(_0xb952,0xe4));var _0x2b95=function(_0x290368,_0x30bae2){_0x290368=_0x290368-0x0;var _0x17aa96=_0xb952[_0x290368];return _0x17aa96;};'use strict';var FaxInteractionEvents=require(_0x2b95('0x0'));var events=[_0x2b95('0x1'),'remove',_0x2b95('0x2')];function createListener(_0x4b6c32,_0x1f14e1){return function(_0x21e51f){_0x1f14e1[_0x2b95('0x3')](_0x4b6c32,_0x21e51f);};}function removeListener(_0x45a174,_0x539ee2){return function(){FaxInteractionEvents[_0x2b95('0x4')](_0x45a174,_0x539ee2);};}exports[_0x2b95('0x5')]=function(_0x2b7c33){for(var _0x52d39f=0x0,_0x22a2d0=events[_0x2b95('0x6')];_0x52d39f<_0x22a2d0;_0x52d39f++){var _0x6aea62=events[_0x52d39f];var _0x17e357=createListener(_0x2b95('0x7')+_0x6aea62,_0x2b7c33);FaxInteractionEvents['on'](_0x6aea62,_0x17e357);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index b3208fb..b893a9d 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 _0x42c8=['../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','fax','addTags','put','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x42c8,0x12c));var _0x842c=function(_0x128d68,_0x555a32){_0x128d68=_0x128d68-0x0;var _0x24ad4d=_0x42c8[_0x128d68];return _0x24ad4d;};'use strict';var multer=require(_0x842c('0x0'));var util=require(_0x842c('0x1'));var path=require('path');var timeout=require(_0x842c('0x2'));var express=require(_0x842c('0x3'));var router=express['Router']();var fs_extra=require(_0x842c('0x4'));var auth=require(_0x842c('0x5'));var interaction=require(_0x842c('0x6'));var config=require(_0x842c('0x7'));var controller=require(_0x842c('0x8'));router[_0x842c('0x9')]('/',auth['isAuthenticated'](),controller[_0x842c('0xa')]);router[_0x842c('0x9')](_0x842c('0xb'),auth[_0x842c('0xc')](),controller[_0x842c('0xd')]);router['get'](_0x842c('0xe'),auth[_0x842c('0xc')](),controller[_0x842c('0xf')]);router[_0x842c('0x9')](_0x842c('0x10'),auth[_0x842c('0xc')](),controller[_0x842c('0x11')]);router['get'](_0x842c('0x12'),auth[_0x842c('0xc')](),controller[_0x842c('0x13')]);router[_0x842c('0x14')]('/',auth[_0x842c('0xc')](),controller[_0x842c('0x15')]);router[_0x842c('0x14')]('/:id/messages',auth[_0x842c('0xc')](),controller[_0x842c('0x16')]);router[_0x842c('0x14')](_0x842c('0x17'),auth['isAuthenticated'](),interaction['tracked'](_0x842c('0x18'),'faxinteraction:addtags'),controller[_0x842c('0x19')]);router[_0x842c('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x842c('0x1b')](_0x842c('0x18'),_0x842c('0x1c')),controller[_0x842c('0x1d')]);router[_0x842c('0x1e')]('/:id',auth[_0x842c('0xc')](),interaction[_0x842c('0x1b')]('fax',_0x842c('0x1f')),controller[_0x842c('0x20')]);router[_0x842c('0x1e')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0x842c('0x21')]=router; \ No newline at end of file +var _0xa812=['faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','faxinteraction:addtags','tracked','fax','faxinteraction:update','update','delete'];(function(_0xe66c57,_0x245188){var _0x4956b0=function(_0x460694){while(--_0x460694){_0xe66c57['push'](_0xe66c57['shift']());}};_0x4956b0(++_0x245188);}(_0xa812,0x19c));var _0x2a81=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa812[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x2a81('0x0'));var util=require(_0x2a81('0x1'));var path=require(_0x2a81('0x2'));var timeout=require(_0x2a81('0x3'));var express=require(_0x2a81('0x4'));var router=express[_0x2a81('0x5')]();var fs_extra=require(_0x2a81('0x6'));var auth=require(_0x2a81('0x7'));var interaction=require(_0x2a81('0x8'));var config=require(_0x2a81('0x9'));var controller=require(_0x2a81('0xa'));router[_0x2a81('0xb')]('/',auth[_0x2a81('0xc')](),controller['index']);router['get'](_0x2a81('0xd'),auth[_0x2a81('0xc')](),controller[_0x2a81('0xe')]);router['get'](_0x2a81('0xf'),auth['isAuthenticated'](),controller[_0x2a81('0x10')]);router['get'](_0x2a81('0x11'),auth[_0x2a81('0xc')](),controller[_0x2a81('0x12')]);router[_0x2a81('0xb')]('/:id/download',auth[_0x2a81('0xc')](),controller[_0x2a81('0x13')]);router['post']('/',auth[_0x2a81('0xc')](),controller[_0x2a81('0x14')]);router[_0x2a81('0x15')](_0x2a81('0x11'),auth[_0x2a81('0xc')](),controller[_0x2a81('0x16')]);router[_0x2a81('0x15')](_0x2a81('0x17'),auth[_0x2a81('0xc')](),interaction['tracked']('fax',_0x2a81('0x18')),controller['addTags']);router['put'](_0x2a81('0xf'),auth[_0x2a81('0xc')](),interaction[_0x2a81('0x19')](_0x2a81('0x1a'),_0x2a81('0x1b')),controller[_0x2a81('0x1c')]);router[_0x2a81('0x1d')](_0x2a81('0xf'),auth[_0x2a81('0xc')](),interaction[_0x2a81('0x19')]('fax',_0x2a81('0x1e')),controller[_0x2a81('0x1f')]);router[_0x2a81('0x1d')](_0x2a81('0x17'),auth['isAuthenticated'](),controller[_0x2a81('0x20')]);module[_0x2a81('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index eabdd3a..a12a9e3 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 _0x2dae=['TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x5ec528,_0xe07bc5){var _0x4e6e60=function(_0x596c12){while(--_0x596c12){_0x5ec528['push'](_0x5ec528['shift']());}};_0x4e6e60(++_0xe07bc5);}(_0x2dae,0xc3));var _0xe2da=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0x2dae[_0x142ec2];return _0x45ef4e;};'use strict';var Sequelize=require(_0xe2da('0x0'));module['exports']={'body':{'type':Sequelize[_0xe2da('0x1')](_0xe2da('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xe2da('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe2da('0x4')]('in',_0xe2da('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xe2da('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xe2da('0x6')]}}; \ No newline at end of file +var _0xfa2b=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x43e2e4,_0x4ad3b4){var _0x1b71d0=function(_0x45812a){while(--_0x45812a){_0x43e2e4['push'](_0x43e2e4['shift']());}};_0x1b71d0(++_0x4ad3b4);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x1c40db,_0x25fb29){_0x1c40db=_0x1c40db-0x0;var _0x283a4f=_0xfa2b[_0x1c40db];return _0x283a4f;};'use strict';var Sequelize=require(_0xbfa2('0x0'));module[_0xbfa2('0x1')]={'body':{'type':Sequelize[_0xbfa2('0x2')](_0xbfa2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xbfa2('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbfa2('0x5')]('in',_0xbfa2('0x6')),'defaultValue':_0xbfa2('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xbfa2('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xbfa2('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 38e022e..c79d071 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 _0x221d=['SendFax','FaxAccountId','basename','download','join','root','files','attachments','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','rows','show','params','length','find','body','describe','fax-interactions','accept','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','EventManager','acceptmessage','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','QueryTypes','User','agent','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId'];(function(_0x52b5a7,_0x36c83a){var _0x1b490f=function(_0x49ef48){while(--_0x49ef48){_0x52b5a7['push'](_0x52b5a7['shift']());}};_0x1b490f(++_0x36c83a);}(_0x221d,0x128));var _0xd221=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x221d[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0xd221('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd221('0x1'));var jsonpatch=require(_0xd221('0x2'));var rp=require(_0xd221('0x3'));var moment=require(_0xd221('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd221('0x5'));var util=require(_0xd221('0x6'));var path=require('path');var sox=require(_0xd221('0x7'));var csv=require(_0xd221('0x8'));var ejs=require(_0xd221('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd221('0xa'));var jsforce=require(_0xd221('0xb'));var deskjs=require(_0xd221('0xc'));var toCsv=require(_0xd221('0x8'));var querystring=require(_0xd221('0xd'));var Papa=require(_0xd221('0xe'));var Redis=require(_0xd221('0xf'));var authService=require(_0xd221('0x10'));var qs=require(_0xd221('0x11'));var as=require(_0xd221('0x12'));var hardwareService=require(_0xd221('0x13'));var logger=require(_0xd221('0x14'))(_0xd221('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd221('0x16'));var db=require(_0xd221('0x17'))['db'];config[_0xd221('0x18')]=_[_0xd221('0x19')](config[_0xd221('0x18')],{'host':_0xd221('0x1a'),'port':0x18eb});var socket=require(_0xd221('0x1b'))(new Redis(config['redis']));require(_0xd221('0x1c'))['register'](socket);var jayson=require(_0xd221('0x1d'));var client=jayson[_0xd221('0x1e')][_0xd221('0x1f')]({'port':0x232c});var client9002=jayson[_0xd221('0x1e')][_0xd221('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x51824c,_0x3eeada,_0x47f0c1,_0xf2586e){return new BPromise(function(_0x1bbd48,_0x3be2c3){var _0x4de972=_0xf2586e||client;return _0x4de972[_0xd221('0x20')](_0x51824c,_0x47f0c1)[_0xd221('0x21')](function(_0x427acc){logger[_0xd221('0x22')](_0xd221('0x23'),_0x3eeada,_0xd221('0x24'));logger[_0xd221('0x25')](_0xd221('0x26'),_0x3eeada,_0xd221('0x24'),JSON[_0xd221('0x27')](_0x427acc));if(_0x427acc[_0xd221('0x28')]){if(_0x427acc[_0xd221('0x28')][_0xd221('0x29')]===0x1f4){logger[_0xd221('0x28')](_0xd221('0x23'),_0x3eeada,_0x427acc[_0xd221('0x28')][_0xd221('0x2a')]);return _0x3be2c3(_0x427acc[_0xd221('0x28')]['message']);}logger[_0xd221('0x28')]('FaxMessage,\x20%s,\x20%s',_0x3eeada,_0x427acc[_0xd221('0x28')][_0xd221('0x2a')]);return _0x1bbd48(_0x427acc[_0xd221('0x28')][_0xd221('0x2a')]);}else{logger['info'](_0xd221('0x23'),_0x3eeada,_0xd221('0x24'));_0x1bbd48(_0x427acc[_0xd221('0x2b')]['message']);}})[_0xd221('0x2c')](function(_0x2c8dbe){logger[_0xd221('0x28')]('FaxMessage,\x20%s,\x20%s',_0x3eeada,_0x2c8dbe);_0x3be2c3(_0x2c8dbe);});});}function respondWithStatusCode(_0x4d3704,_0x134c33){_0x134c33=_0x134c33||0xcc;return function(_0xaa4750){if(_0xaa4750){return _0x4d3704[_0xd221('0x2d')](_0x134c33);}return _0x4d3704[_0xd221('0x2e')](_0x134c33)[_0xd221('0x2f')]();};}function respondWithResult(_0x174be8,_0x5963a2){_0x5963a2=_0x5963a2||0xc8;return function(_0x4761da){if(_0x4761da){return _0x174be8[_0xd221('0x2e')](_0x5963a2)[_0xd221('0x30')](_0x4761da);}};}function respondWithFilteredResult(_0x545814,_0x5b52e7){return function(_0x62ee65){if(_0x62ee65){var _0x2ab023=typeof _0x5b52e7[_0xd221('0x31')]==='undefined'&&typeof _0x5b52e7[_0xd221('0x32')]===_0xd221('0x33');var _0xdd1d59=_0x62ee65[_0xd221('0x34')];var _0x152ee0=_0x2ab023?0x0:_0x5b52e7[_0xd221('0x31')];var _0x224d3e=_0x2ab023?_0x62ee65[_0xd221('0x34')]:_0x5b52e7['offset']+_0x5b52e7[_0xd221('0x32')];var _0x357681;if(_0x224d3e>=_0xdd1d59){_0x224d3e=_0xdd1d59;_0x357681=0xc8;}else{_0x357681=0xce;}_0x545814['status'](_0x357681);return _0x545814['set'](_0xd221('0x35'),_0x152ee0+'-'+_0x224d3e+'/'+_0xdd1d59)['json'](_0x62ee65);}return null;};}function patchUpdates(_0x33b676){return function(_0x1190c0){try{jsonpatch[_0xd221('0x36')](_0x1190c0,_0x33b676,!![]);}catch(_0x2d9ff7){return BPromise[_0xd221('0x37')](_0x2d9ff7);}return _0x1190c0[_0xd221('0x38')]();};}function saveUpdates(_0x33d025,_0x33e4ec){return function(_0x2a953e){if(_0x2a953e){return _0x2a953e[_0xd221('0x39')](_0x33d025)[_0xd221('0x21')](function(_0x24f1f8){return _0x24f1f8;});}return null;};}function removeEntity(_0x5339ca,_0x38710a){return function(_0x31c35d){if(_0x31c35d){return _0x31c35d[_0xd221('0x3a')]()[_0xd221('0x21')](function(){_0x5339ca[_0xd221('0x2e')](0xcc)[_0xd221('0x2f')]();});}};}function handleEntityNotFound(_0x255c5d,_0x5b47f2){return function(_0x4591cd){if(!_0x4591cd){_0x255c5d['sendStatus'](0x194);}return _0x4591cd;};}function handleError(_0x271954,_0x80aa85){_0x80aa85=_0x80aa85||0x1f4;return function(_0x27c10e){logger[_0xd221('0x28')](_0x27c10e[_0xd221('0x3b')]);if(_0x27c10e[_0xd221('0x3c')]){delete _0x27c10e[_0xd221('0x3c')];}_0x271954['status'](_0x80aa85)['send'](_0x27c10e);};}exports[_0xd221('0x3d')]=function(_0x6c96b1,_0x2a7d9e){var _0x12228f={},_0xf8c18e={},_0x21086b={'count':0x0,'rows':[]};var _0x5605b5=_[_0xd221('0x3e')](db[_0xd221('0x3f')][_0xd221('0x40')],function(_0x23f776){return{'name':_0x23f776[_0xd221('0x41')],'type':_0x23f776[_0xd221('0x42')][_0xd221('0x43')]};});_0xf8c18e[_0xd221('0x44')]=_[_0xd221('0x3e')](_0x5605b5,_0xd221('0x3c'));_0xf8c18e['query']=_[_0xd221('0x45')](_0x6c96b1[_0xd221('0x46')]);_0xf8c18e[_0xd221('0x47')]=_['intersection'](_0xf8c18e[_0xd221('0x44')],_0xf8c18e['query']);_0x12228f[_0xd221('0x48')]=_[_0xd221('0x49')](_0xf8c18e[_0xd221('0x44')],qs[_0xd221('0x4a')](_0x6c96b1['query'][_0xd221('0x4a')]));_0x12228f[_0xd221('0x48')]=_0x12228f[_0xd221('0x48')]['length']?_0x12228f['attributes']:_0xf8c18e['model'];if(!_0x6c96b1[_0xd221('0x46')][_0xd221('0x4b')]('nolimit')){_0x12228f[_0xd221('0x32')]=qs[_0xd221('0x32')](_0x6c96b1[_0xd221('0x46')][_0xd221('0x32')]);_0x12228f['offset']=qs[_0xd221('0x31')](_0x6c96b1[_0xd221('0x46')][_0xd221('0x31')]);}_0x12228f[_0xd221('0x4c')]=qs['sort'](_0x6c96b1[_0xd221('0x46')][_0xd221('0x4d')]);_0x12228f['where']=qs[_0xd221('0x47')](_['pick'](_0x6c96b1[_0xd221('0x46')],_0xf8c18e[_0xd221('0x47')]),_0x5605b5);if(_0x6c96b1[_0xd221('0x46')][_0xd221('0x4e')]){_0x12228f[_0xd221('0x4f')]=_['merge'](_0x12228f[_0xd221('0x4f')],{'$or':_['map'](_0x5605b5,function(_0x5c8fd9){if(_0x5c8fd9[_0xd221('0x42')]!==_0xd221('0x50')){var _0x516310={};_0x516310[_0x5c8fd9[_0xd221('0x3c')]]={'$like':'%'+_0x6c96b1[_0xd221('0x46')][_0xd221('0x4e')]+'%'};return _0x516310;}})});}_0x12228f=_[_0xd221('0x51')]({},_0x12228f,_0x6c96b1[_0xd221('0x52')]);var _0x3ec1a9={'where':_0x12228f[_0xd221('0x4f')]};return db[_0xd221('0x3f')][_0xd221('0x34')](_0x3ec1a9)['then'](function(_0x35d215){_0x21086b['count']=_0x35d215;if(_0x6c96b1['query'][_0xd221('0x53')]){_0x12228f[_0xd221('0x54')]=[{'all':!![]}];}return db[_0xd221('0x3f')]['findAll'](_0x12228f);})[_0xd221('0x21')](function(_0x2f3e92){_0x21086b[_0xd221('0x55')]=_0x2f3e92;return _0x21086b;})[_0xd221('0x21')](respondWithFilteredResult(_0x2a7d9e,_0x12228f))['catch'](handleError(_0x2a7d9e,null));};exports[_0xd221('0x56')]=function(_0x3764ef,_0x17b516){var _0x352ee1={'raw':!![],'where':{'id':_0x3764ef[_0xd221('0x57')]['id']}},_0x48de35={};_0x48de35[_0xd221('0x44')]=_[_0xd221('0x45')](db['FaxMessage']['rawAttributes']);_0x48de35[_0xd221('0x46')]=_[_0xd221('0x45')](_0x3764ef[_0xd221('0x46')]);_0x48de35[_0xd221('0x47')]=_[_0xd221('0x49')](_0x48de35[_0xd221('0x44')],_0x48de35['query']);_0x352ee1[_0xd221('0x48')]=_[_0xd221('0x49')](_0x48de35[_0xd221('0x44')],qs[_0xd221('0x4a')](_0x3764ef['query'][_0xd221('0x4a')]));_0x352ee1[_0xd221('0x48')]=_0x352ee1[_0xd221('0x48')][_0xd221('0x58')]?_0x352ee1[_0xd221('0x48')]:_0x48de35['model'];if(_0x3764ef[_0xd221('0x46')][_0xd221('0x53')]){_0x352ee1[_0xd221('0x54')]=[{'all':!![]}];}_0x352ee1=_['merge']({},_0x352ee1,_0x3764ef['options']);return db[_0xd221('0x3f')][_0xd221('0x59')](_0x352ee1)[_0xd221('0x21')](handleEntityNotFound(_0x17b516,null))['then'](respondWithResult(_0x17b516,null))[_0xd221('0x2c')](handleError(_0x17b516,null));};exports[_0xd221('0x39')]=function(_0x36ccad,_0xec675){if(_0x36ccad['body']['id']){delete _0x36ccad[_0xd221('0x5a')]['id'];}return db[_0xd221('0x3f')][_0xd221('0x59')]({'where':{'id':_0x36ccad[_0xd221('0x57')]['id']}})[_0xd221('0x21')](handleEntityNotFound(_0xec675,null))['then'](saveUpdates(_0x36ccad[_0xd221('0x5a')],null))[_0xd221('0x21')](respondWithResult(_0xec675,null))[_0xd221('0x2c')](handleError(_0xec675,null));};exports['destroy']=function(_0x4c3395,_0x5610ac){return db[_0xd221('0x3f')][_0xd221('0x59')]({'where':{'id':_0x4c3395[_0xd221('0x57')]['id']}})[_0xd221('0x21')](handleEntityNotFound(_0x5610ac,null))['then'](removeEntity(_0x5610ac,null))[_0xd221('0x2c')](handleError(_0x5610ac,null));};exports[_0xd221('0x5b')]=function(_0x11881c,_0x3333af){return db[_0xd221('0x3f')][_0xd221('0x5b')]()['then'](respondWithResult(_0x3333af,null))[_0xd221('0x2c')](handleError(_0x3333af,null));};var interaction_log=require(_0xd221('0x14'))(_0xd221('0x5c'));exports[_0xd221('0x5d')]=function(_0x433615,_0x823ef,_0x178c7a){var _0x61dc54={'agent':{},'channel':'fax'};if(_0x433615['body']['id']){delete _0x433615['body']['id'];}_0x433615['body'][_0xd221('0x5e')]=!![];_0x433615['body']['readAt']=moment()['format'](_0xd221('0x5f'));_0x433615[_0xd221('0x5a')][_0xd221('0x60')]=_0x433615['body'][_0xd221('0x60')]||_0x433615[_0xd221('0x61')]['id'];_0x61dc54['agent']['id']=_0x433615[_0xd221('0x5a')]['UserId'];return db[_0xd221('0x3f')][_0xd221('0x59')]({'where':{'id':_0x433615['params']['id'],'UserId':null}})[_0xd221('0x21')](handleEntityNotFound(_0x823ef,null))[_0xd221('0x21')](saveUpdates(_0x433615[_0xd221('0x5a')],null))[_0xd221('0x21')](function(_0x20fd26){if(_0x20fd26){_0x61dc54[_0xd221('0x2a')]=_0x20fd26[_0xd221('0x62')]({'plain':!![]});return db[_0xd221('0x63')][_0xd221('0x59')]({'where':{'id':_0x20fd26[_0xd221('0x64')]}});}return null;})[_0xd221('0x21')](handleEntityNotFound(_0x823ef,null))[_0xd221('0x21')](function(_0x482598){if(_0x482598){return _0x482598[_0xd221('0x39')]({'UserId':_0x433615[_0xd221('0x5a')]['UserId'],'read1stAt':_[_0xd221('0x65')](_0x482598[_0xd221('0x66')])?moment()['format'](_0xd221('0x5f')):undefined});}return null;})['then'](function(_0x53c9a3){if(_0x53c9a3){_0x61dc54['interaction']=_0x53c9a3[_0xd221('0x62')]({'plain':!![]});interaction_log[_0xd221('0x22')](_0xd221('0x67'),_0x433615['user']['id'],_0x433615[_0xd221('0x61')]['name'],_0x433615[_0xd221('0x61')][_0xd221('0x68')],_0x61dc54[_0xd221('0x69')]['id'],_0x433615['body']?JSON[_0xd221('0x27')](_0x433615[_0xd221('0x5a')]):_0xd221('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xd221('0x6b'),_0x61dc54);}return null;})[_0xd221('0x21')](function(_0x2b92f2){var _0x280dc3=_0xd221('0x6c')+_0x2b92f2[_0xd221('0x2a')][_0xd221('0x6d')];return db[_0xd221('0x6e')]['query'](_0x280dc3,{'type':db[_0xd221('0x6f')]['QueryTypes'][_0xd221('0x70')],'raw':!![]})[_0xd221('0x21')](function(_0x17af03){return _0x17af03;});})[_0xd221('0x21')](function(_0x530880){if(_0x530880){_0x61dc54['message'][_0xd221('0x71')]=_0x530880[0x0];if(!_0x433615['body'][_0xd221('0x60')])return;return db['User'][_0xd221('0x59')]({'where':{'id':_0x433615[_0xd221('0x5a')][_0xd221('0x60')],'role':'agent'},'attributes':['id',_0xd221('0x3c'),_0xd221('0x72'),_0xd221('0x73'),_0xd221('0x74')],'raw':!![]});}return null;})[_0xd221('0x21')](function(_0x54f20e){if(!_0x54f20e)return null;_0x61dc54[_0xd221('0x2a')]['agent']=_0x54f20e;return _0x61dc54;})[_0xd221('0x21')](function(_0x2bf420){if(_0x2bf420){if(_0x433615[_0xd221('0x5a')]['manual']){_0x61dc54['message'][_0xd221('0x75')]=util[_0xd221('0x76')](_0xd221('0x77'),_0x433615[_0xd221('0x61')]['name']);_0x61dc54['message'][_0xd221('0x78')]=_0x61dc54['channel'];_0x61dc54[_0xd221('0x2a')][_0xd221('0x79')]=_0x61dc54[_0xd221('0x78')];_0x61dc54[_0xd221('0x2a')]['event']=_0xd221('0x5d');return respondWithRpcPromise(_0xd221('0x7a'),'EventManager',{'event':_0xd221('0x7b'),'message':_0x61dc54[_0xd221('0x2a')]},client9002)[_0xd221('0x21')](function(){return _0x61dc54;});}return _0x61dc54;}return null;})[_0xd221('0x21')](respondWithResult(_0x823ef,null))['catch'](handleError(_0x823ef,null));};var interaction_log=require(_0xd221('0x14'))(_0xd221('0x5c'));exports[_0xd221('0x37')]=function(_0x235ea1,_0x560a7d,_0xb10ffd){var _0x262448={'agent':{},'channel':_0xd221('0x7c')};if(_0x235ea1[_0xd221('0x5a')]['id']){delete _0x235ea1[_0xd221('0x5a')]['id'];}_0x235ea1[_0xd221('0x5a')][_0xd221('0x60')]=_0x235ea1['body'][_0xd221('0x60')]||_0x235ea1[_0xd221('0x61')]['id'];_0x262448['agent']['id']=_0x235ea1[_0xd221('0x5a')][_0xd221('0x60')];return db[_0xd221('0x3f')][_0xd221('0x59')]({'where':{'id':_0x235ea1['params']['id'],'UserId':null}})[_0xd221('0x21')](handleEntityNotFound(_0x560a7d,null))[_0xd221('0x21')](function(_0x43e30a){if(_0x43e30a){_0x262448['message']=_0x43e30a['get']({'plain':!![]});return db[_0xd221('0x63')]['find']({'where':{'id':_0x43e30a['FaxInteractionId']}});}return null;})[_0xd221('0x21')](handleEntityNotFound(_0x560a7d,null))[_0xd221('0x21')](function(_0x2aba2f){if(_0x2aba2f){_0x262448['interaction']=_0x2aba2f[_0xd221('0x62')]({'plain':!![]});interaction_log['info'](_0xd221('0x7d'),_0x235ea1['user']['id'],_0x235ea1[_0xd221('0x61')][_0xd221('0x3c')],_0x235ea1['user']['role'],_0x262448[_0xd221('0x69')]['id'],_0x235ea1[_0xd221('0x5a')]?JSON[_0xd221('0x27')](_0x235ea1[_0xd221('0x5a')]):_0xd221('0x6a'));return respondWithRpcPromise('RejectMessage',_0xd221('0x7e'),_0x262448);}return null;})['then'](function(_0x2d1739){var _0x6a51a2=_0xd221('0x6c')+_0x2d1739[_0xd221('0x2a')][_0xd221('0x6d')];return db[_0xd221('0x6e')][_0xd221('0x46')](_0x6a51a2,{'type':db[_0xd221('0x6f')][_0xd221('0x7f')]['SELECT'],'raw':!![]})[_0xd221('0x21')](function(_0x241587){return _0x241587;});})[_0xd221('0x21')](function(_0x508a93){if(_0x508a93){_0x262448[_0xd221('0x2a')][_0xd221('0x71')]=_0x508a93[0x0];if(!_0x235ea1['body'][_0xd221('0x60')])return;return db[_0xd221('0x80')][_0xd221('0x59')]({'where':{'id':_0x235ea1[_0xd221('0x5a')][_0xd221('0x60')],'role':_0xd221('0x81')},'attributes':['id','name','fullname',_0xd221('0x73'),_0xd221('0x74')],'raw':!![]});}return null;})[_0xd221('0x21')](function(_0x356dc8){if(!_0x356dc8)return null;_0x262448[_0xd221('0x2a')][_0xd221('0x81')]=_0x356dc8;return _0x262448;})[_0xd221('0x21')](function(_0x50cab3){if(_0x50cab3){_0x50cab3[_0xd221('0x2a')]['interface']=util['format'](_0xd221('0x77'),_0x235ea1['user']['name']);_0x50cab3[_0xd221('0x2a')][_0xd221('0x78')]=_0x262448[_0xd221('0x78')];_0x50cab3['message'][_0xd221('0x79')]=_0x262448[_0xd221('0x78')];_0x50cab3[_0xd221('0x2a')]['event']=_0xd221('0x37');respondWithRpcPromise(_0xd221('0x7a'),_0xd221('0x7a'),{'event':_0xd221('0x82'),'message':_0x50cab3['message']},client9002);return _0x262448;}return null;})['then'](respondWithResult(_0x560a7d,null))[_0xd221('0x2c')](handleError(_0x560a7d,null));};exports[_0xd221('0x83')]=function(_0x1e8ba2,_0x3c6faa){var _0x15f5ef;return db[_0xd221('0x3f')][_0xd221('0x83')](_0x1e8ba2[_0xd221('0x5a')],{})[_0xd221('0x21')](function(_0x1f250d){_0x15f5ef=_0x1f250d;return db[_0xd221('0x84')][_0xd221('0x85')]({'where':{'id':_0x15f5ef['ContactId']}});})[_0xd221('0x21')](function(_0xcf4439){if(_[_0xd221('0x65')](_0xcf4439)){return;}else{_0x15f5ef[_0xd221('0x7c')]=_0xcf4439['fax'];return db[_0xd221('0x86')][_0xd221('0x85')]({'where':{'id':_0x15f5ef[_0xd221('0x87')]}});}})[_0xd221('0x21')](function(_0x3711ca){return respondWithRpcPromise(_0xd221('0x88'),_0xd221('0x88'),{'FaxAccountId':_[_0xd221('0x65')](_0x1e8ba2[_0xd221('0x5a')])?undefined:_0x1e8ba2['body'][_0xd221('0x89')],'path':_[_0xd221('0x65')](_0x3711ca)?undefined:util[_0xd221('0x76')]('/var/opt/motion2/server/files/attachments/%s',_0x3711ca[_0xd221('0x8a')]),'fax':_[_0xd221('0x65')](_0x15f5ef[_0xd221('0x7c')])?undefined:_0x15f5ef[_0xd221('0x7c')],'AttachmentId':_0x15f5ef[_0xd221('0x87')]},client9002);})[_0xd221('0x21')](respondWithResult(_0x3c6faa,0xc9))[_0xd221('0x2c')](handleError(_0x3c6faa,null));};exports[_0xd221('0x8b')]=function(_0x23f9ce,_0x2da7d5){var _0x50bbf9=path[_0xd221('0x8c')](config[_0xd221('0x8d')],'server',_0xd221('0x8e'),_0xd221('0x8f'));return db[_0xd221('0x3f')][_0xd221('0x59')]({'where':{'id':_0x23f9ce[_0xd221('0x57')]['id']},'include':[{'model':db[_0xd221('0x86')],'as':_0xd221('0x86')}]})['then'](handleEntityNotFound(_0x2da7d5,null))['then'](function(_0x15199b){if(_0x15199b){return _0x2da7d5['download'](path['join'](_0x50bbf9,_0x15199b['Attachment'][_0xd221('0x8a')]));}})['catch'](handleError(_0x2da7d5,null));}; \ No newline at end of file +var _0xd783=['ContactId','sequelize','SELECT','SIP/%s','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','files','attachments','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','http','info','request\x20sent','debug','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','result','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','length','include','find','catch','body','describe','accept','fax','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','fax-interactions','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage'];(function(_0x1d06a5,_0x4fc577){var _0xbaab59=function(_0x458664){while(--_0x458664){_0x1d06a5['push'](_0x1d06a5['shift']());}};_0xbaab59(++_0x4fc577);}(_0xd783,0xa6));var _0x3d78=function(_0x513f27,_0x1cbc87){_0x513f27=_0x513f27-0x0;var _0xa316b7=_0xd783[_0x513f27];return _0xa316b7;};'use strict';var emlformat=require(_0x3d78('0x0'));var rimraf=require(_0x3d78('0x1'));var zipdir=require(_0x3d78('0x2'));var jsonpatch=require(_0x3d78('0x3'));var rp=require('request-promise');var moment=require(_0x3d78('0x4'));var BPromise=require(_0x3d78('0x5'));var Mustache=require('mustache');var util=require(_0x3d78('0x6'));var path=require(_0x3d78('0x7'));var sox=require(_0x3d78('0x8'));var csv=require(_0x3d78('0x9'));var ejs=require(_0x3d78('0xa'));var fs=require('fs');var fs_extra=require(_0x3d78('0xb'));var _=require(_0x3d78('0xc'));var squel=require(_0x3d78('0xd'));var crypto=require('crypto');var jsforce=require(_0x3d78('0xe'));var deskjs=require(_0x3d78('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3d78('0x10'));var Papa=require(_0x3d78('0x11'));var Redis=require(_0x3d78('0x12'));var authService=require(_0x3d78('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3d78('0x14'));var hardwareService=require(_0x3d78('0x15'));var logger=require(_0x3d78('0x16'))(_0x3d78('0x17'));var utils=require(_0x3d78('0x18'));var config=require(_0x3d78('0x19'));var licenseUtil=require(_0x3d78('0x1a'));var db=require(_0x3d78('0x1b'))['db'];config[_0x3d78('0x1c')]=_[_0x3d78('0x1d')](config[_0x3d78('0x1c')],{'host':_0x3d78('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d78('0x1c')]));require(_0x3d78('0x1f'))[_0x3d78('0x20')](socket);var jayson=require(_0x3d78('0x21'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x3d78('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x350d52,_0x3a46ae,_0x4e2626,_0x386d29){return new BPromise(function(_0x427dd2,_0x30f383){var _0x587f35=_0x386d29||client;return _0x587f35['request'](_0x350d52,_0x4e2626)['then'](function(_0x125923){logger[_0x3d78('0x23')]('FaxMessage,\x20%s,\x20%s',_0x3a46ae,_0x3d78('0x24'));logger[_0x3d78('0x25')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x3a46ae,_0x3d78('0x24'),JSON[_0x3d78('0x26')](_0x125923));if(_0x125923[_0x3d78('0x27')]){if(_0x125923[_0x3d78('0x27')][_0x3d78('0x28')]===0x1f4){logger[_0x3d78('0x27')]('FaxMessage,\x20%s,\x20%s',_0x3a46ae,_0x125923[_0x3d78('0x27')][_0x3d78('0x29')]);return _0x30f383(_0x125923[_0x3d78('0x27')][_0x3d78('0x29')]);}logger['error'](_0x3d78('0x2a'),_0x3a46ae,_0x125923[_0x3d78('0x27')][_0x3d78('0x29')]);return _0x427dd2(_0x125923[_0x3d78('0x27')][_0x3d78('0x29')]);}else{logger[_0x3d78('0x23')](_0x3d78('0x2a'),_0x3a46ae,_0x3d78('0x24'));_0x427dd2(_0x125923[_0x3d78('0x2b')][_0x3d78('0x29')]);}})['catch'](function(_0x47f93b){logger[_0x3d78('0x27')]('FaxMessage,\x20%s,\x20%s',_0x3a46ae,_0x47f93b);_0x30f383(_0x47f93b);});});}function respondWithStatusCode(_0x194550,_0x2f5ecd){_0x2f5ecd=_0x2f5ecd||0xcc;return function(_0x189d50){if(_0x189d50){return _0x194550[_0x3d78('0x2c')](_0x2f5ecd);}return _0x194550['status'](_0x2f5ecd)[_0x3d78('0x2d')]();};}function respondWithResult(_0x3b7c93,_0x530471){_0x530471=_0x530471||0xc8;return function(_0x39d1ba){if(_0x39d1ba){return _0x3b7c93[_0x3d78('0x2e')](_0x530471)['json'](_0x39d1ba);}};}function respondWithFilteredResult(_0xbbec29,_0xc6e2b8){return function(_0x3f8c13){if(_0x3f8c13){var _0x38ae90=typeof _0xc6e2b8[_0x3d78('0x2f')]===_0x3d78('0x30')&&typeof _0xc6e2b8[_0x3d78('0x31')]===_0x3d78('0x30');var _0x18f979=_0x3f8c13[_0x3d78('0x32')];var _0x3b4491=_0x38ae90?0x0:_0xc6e2b8[_0x3d78('0x2f')];var _0x4da4e3=_0x38ae90?_0x3f8c13[_0x3d78('0x32')]:_0xc6e2b8[_0x3d78('0x2f')]+_0xc6e2b8[_0x3d78('0x31')];var _0x5f1d91;if(_0x4da4e3>=_0x18f979){_0x4da4e3=_0x18f979;_0x5f1d91=0xc8;}else{_0x5f1d91=0xce;}_0xbbec29['status'](_0x5f1d91);return _0xbbec29[_0x3d78('0x33')](_0x3d78('0x34'),_0x3b4491+'-'+_0x4da4e3+'/'+_0x18f979)[_0x3d78('0x35')](_0x3f8c13);}return null;};}function patchUpdates(_0x576ebe){return function(_0x19023d){try{jsonpatch[_0x3d78('0x36')](_0x19023d,_0x576ebe,!![]);}catch(_0x14683f){return BPromise[_0x3d78('0x37')](_0x14683f);}return _0x19023d['save']();};}function saveUpdates(_0x2c1a35,_0x3a05f1){return function(_0x5e0978){if(_0x5e0978){return _0x5e0978[_0x3d78('0x38')](_0x2c1a35)[_0x3d78('0x39')](function(_0x1638c6){return _0x1638c6;});}return null;};}function removeEntity(_0x24b924,_0x1c7a1f){return function(_0x432cbf){if(_0x432cbf){return _0x432cbf[_0x3d78('0x3a')]()['then'](function(){_0x24b924[_0x3d78('0x2e')](0xcc)[_0x3d78('0x2d')]();});}};}function handleEntityNotFound(_0x244e6c,_0x51d88d){return function(_0x2f0eea){if(!_0x2f0eea){_0x244e6c[_0x3d78('0x2c')](0x194);}return _0x2f0eea;};}function handleError(_0x182b1a,_0x104a90){_0x104a90=_0x104a90||0x1f4;return function(_0x2fa879){logger[_0x3d78('0x27')](_0x2fa879[_0x3d78('0x3b')]);if(_0x2fa879[_0x3d78('0x3c')]){delete _0x2fa879[_0x3d78('0x3c')];}_0x182b1a[_0x3d78('0x2e')](_0x104a90)[_0x3d78('0x3d')](_0x2fa879);};}exports[_0x3d78('0x3e')]=function(_0x1f695e,_0x40a3df){var _0x9f2778={},_0x1cd191={},_0x3c7468={'count':0x0,'rows':[]};var _0x4a4b86=_[_0x3d78('0x3f')](db[_0x3d78('0x40')][_0x3d78('0x41')],function(_0xbb97e6){return{'name':_0xbb97e6['fieldName'],'type':_0xbb97e6[_0x3d78('0x42')]['key']};});_0x1cd191['model']=_[_0x3d78('0x3f')](_0x4a4b86,'name');_0x1cd191[_0x3d78('0x43')]=_[_0x3d78('0x44')](_0x1f695e[_0x3d78('0x43')]);_0x1cd191['filters']=_[_0x3d78('0x45')](_0x1cd191[_0x3d78('0x46')],_0x1cd191[_0x3d78('0x43')]);_0x9f2778[_0x3d78('0x47')]=_[_0x3d78('0x45')](_0x1cd191[_0x3d78('0x46')],qs[_0x3d78('0x48')](_0x1f695e[_0x3d78('0x43')][_0x3d78('0x48')]));_0x9f2778[_0x3d78('0x47')]=_0x9f2778['attributes']['length']?_0x9f2778[_0x3d78('0x47')]:_0x1cd191[_0x3d78('0x46')];if(!_0x1f695e['query'][_0x3d78('0x49')]('nolimit')){_0x9f2778['limit']=qs['limit'](_0x1f695e[_0x3d78('0x43')][_0x3d78('0x31')]);_0x9f2778[_0x3d78('0x2f')]=qs['offset'](_0x1f695e[_0x3d78('0x43')][_0x3d78('0x2f')]);}_0x9f2778[_0x3d78('0x4a')]=qs[_0x3d78('0x4b')](_0x1f695e[_0x3d78('0x43')][_0x3d78('0x4b')]);_0x9f2778['where']=qs[_0x3d78('0x4c')](_[_0x3d78('0x4d')](_0x1f695e['query'],_0x1cd191[_0x3d78('0x4c')]),_0x4a4b86);if(_0x1f695e[_0x3d78('0x43')][_0x3d78('0x4e')]){_0x9f2778[_0x3d78('0x4f')]=_[_0x3d78('0x50')](_0x9f2778['where'],{'$or':_['map'](_0x4a4b86,function(_0x491446){if(_0x491446[_0x3d78('0x42')]!==_0x3d78('0x51')){var _0x22dcf7={};_0x22dcf7[_0x491446['name']]={'$like':'%'+_0x1f695e[_0x3d78('0x43')][_0x3d78('0x4e')]+'%'};return _0x22dcf7;}})});}_0x9f2778=_['merge']({},_0x9f2778,_0x1f695e[_0x3d78('0x52')]);var _0x224f1b={'where':_0x9f2778['where']};return db[_0x3d78('0x40')][_0x3d78('0x32')](_0x224f1b)['then'](function(_0x1f340b){_0x3c7468[_0x3d78('0x32')]=_0x1f340b;if(_0x1f695e[_0x3d78('0x43')][_0x3d78('0x53')]){_0x9f2778['include']=[{'all':!![]}];}return db[_0x3d78('0x40')][_0x3d78('0x54')](_0x9f2778);})['then'](function(_0x2e61de){_0x3c7468[_0x3d78('0x55')]=_0x2e61de;return _0x3c7468;})[_0x3d78('0x39')](respondWithFilteredResult(_0x40a3df,_0x9f2778))['catch'](handleError(_0x40a3df,null));};exports[_0x3d78('0x56')]=function(_0x85e5c2,_0x48400d){var _0x35bdbe={'raw':!![],'where':{'id':_0x85e5c2[_0x3d78('0x57')]['id']}},_0x4edd11={};_0x4edd11['model']=_['keys'](db[_0x3d78('0x40')][_0x3d78('0x41')]);_0x4edd11[_0x3d78('0x43')]=_[_0x3d78('0x44')](_0x85e5c2[_0x3d78('0x43')]);_0x4edd11[_0x3d78('0x4c')]=_['intersection'](_0x4edd11[_0x3d78('0x46')],_0x4edd11[_0x3d78('0x43')]);_0x35bdbe['attributes']=_[_0x3d78('0x45')](_0x4edd11['model'],qs[_0x3d78('0x48')](_0x85e5c2[_0x3d78('0x43')]['fields']));_0x35bdbe[_0x3d78('0x47')]=_0x35bdbe[_0x3d78('0x47')][_0x3d78('0x58')]?_0x35bdbe['attributes']:_0x4edd11[_0x3d78('0x46')];if(_0x85e5c2[_0x3d78('0x43')][_0x3d78('0x53')]){_0x35bdbe[_0x3d78('0x59')]=[{'all':!![]}];}_0x35bdbe=_[_0x3d78('0x50')]({},_0x35bdbe,_0x85e5c2[_0x3d78('0x52')]);return db[_0x3d78('0x40')][_0x3d78('0x5a')](_0x35bdbe)[_0x3d78('0x39')](handleEntityNotFound(_0x48400d,null))[_0x3d78('0x39')](respondWithResult(_0x48400d,null))[_0x3d78('0x5b')](handleError(_0x48400d,null));};exports[_0x3d78('0x38')]=function(_0x266d45,_0x495775){if(_0x266d45[_0x3d78('0x5c')]['id']){delete _0x266d45[_0x3d78('0x5c')]['id'];}return db[_0x3d78('0x40')][_0x3d78('0x5a')]({'where':{'id':_0x266d45[_0x3d78('0x57')]['id']}})[_0x3d78('0x39')](handleEntityNotFound(_0x495775,null))['then'](saveUpdates(_0x266d45['body'],null))[_0x3d78('0x39')](respondWithResult(_0x495775,null))[_0x3d78('0x5b')](handleError(_0x495775,null));};exports[_0x3d78('0x3a')]=function(_0x2825f8,_0x1928a2){return db['FaxMessage'][_0x3d78('0x5a')]({'where':{'id':_0x2825f8[_0x3d78('0x57')]['id']}})[_0x3d78('0x39')](handleEntityNotFound(_0x1928a2,null))['then'](removeEntity(_0x1928a2,null))[_0x3d78('0x5b')](handleError(_0x1928a2,null));};exports[_0x3d78('0x5d')]=function(_0x41ebc5,_0x5f31c8){return db[_0x3d78('0x40')]['describe']()[_0x3d78('0x39')](respondWithResult(_0x5f31c8,null))['catch'](handleError(_0x5f31c8,null));};var interaction_log=require(_0x3d78('0x16'))('fax-interactions');exports[_0x3d78('0x5e')]=function(_0x45e803,_0xf8531e,_0x5552ce){var _0xb030d7={'agent':{},'channel':_0x3d78('0x5f')};if(_0x45e803[_0x3d78('0x5c')]['id']){delete _0x45e803[_0x3d78('0x5c')]['id'];}_0x45e803[_0x3d78('0x5c')]['read']=!![];_0x45e803[_0x3d78('0x5c')]['readAt']=moment()[_0x3d78('0x60')](_0x3d78('0x61'));_0x45e803[_0x3d78('0x5c')][_0x3d78('0x62')]=_0x45e803[_0x3d78('0x5c')][_0x3d78('0x62')]||_0x45e803[_0x3d78('0x63')]['id'];_0xb030d7[_0x3d78('0x64')]['id']=_0x45e803['body']['UserId'];return db[_0x3d78('0x40')][_0x3d78('0x5a')]({'where':{'id':_0x45e803['params']['id'],'UserId':null}})[_0x3d78('0x39')](handleEntityNotFound(_0xf8531e,null))['then'](saveUpdates(_0x45e803[_0x3d78('0x5c')],null))['then'](function(_0x437ee3){if(_0x437ee3){_0xb030d7[_0x3d78('0x29')]=_0x437ee3[_0x3d78('0x65')]({'plain':!![]});return db[_0x3d78('0x66')][_0x3d78('0x5a')]({'where':{'id':_0x437ee3['FaxInteractionId']}});}return null;})[_0x3d78('0x39')](handleEntityNotFound(_0xf8531e,null))[_0x3d78('0x39')](function(_0x1aa6c4){if(_0x1aa6c4){return _0x1aa6c4[_0x3d78('0x38')]({'UserId':_0x45e803[_0x3d78('0x5c')][_0x3d78('0x62')],'read1stAt':_[_0x3d78('0x67')](_0x1aa6c4[_0x3d78('0x68')])?moment()[_0x3d78('0x60')](_0x3d78('0x61')):undefined});}return null;})['then'](function(_0x50eea0){if(_0x50eea0){_0xb030d7[_0x3d78('0x69')]=_0x50eea0[_0x3d78('0x65')]({'plain':!![]});interaction_log[_0x3d78('0x23')](_0x3d78('0x6a'),_0x45e803[_0x3d78('0x63')]['id'],_0x45e803[_0x3d78('0x63')][_0x3d78('0x3c')],_0x45e803['user'][_0x3d78('0x6b')],_0xb030d7['interaction']['id'],_0x45e803['body']?JSON[_0x3d78('0x26')](_0x45e803['body']):_0x3d78('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x3d78('0x6d'),_0xb030d7);}return null;})[_0x3d78('0x39')](function(_0xd614e3){var _0x2ff266=_0x3d78('0x6e')+_0xd614e3[_0x3d78('0x29')]['ContactId'];return db['sequelize'][_0x3d78('0x43')](_0x2ff266,{'type':db['Sequelize'][_0x3d78('0x6f')]['SELECT'],'raw':!![]})[_0x3d78('0x39')](function(_0x5d5996){return _0x5d5996;});})[_0x3d78('0x39')](function(_0x1aa8e6){if(_0x1aa8e6){_0xb030d7[_0x3d78('0x29')][_0x3d78('0x70')]=_0x1aa8e6[0x0];if(!_0x45e803[_0x3d78('0x5c')][_0x3d78('0x62')])return;return db[_0x3d78('0x71')][_0x3d78('0x5a')]({'where':{'id':_0x45e803[_0x3d78('0x5c')][_0x3d78('0x62')],'role':'agent'},'attributes':['id',_0x3d78('0x3c'),_0x3d78('0x72'),_0x3d78('0x73'),_0x3d78('0x74')],'raw':!![]});}return null;})[_0x3d78('0x39')](function(_0x2c6b48){if(!_0x2c6b48)return null;_0xb030d7['message'][_0x3d78('0x64')]=_0x2c6b48;return _0xb030d7;})[_0x3d78('0x39')](function(_0x21e322){if(_0x21e322){if(_0x45e803[_0x3d78('0x5c')][_0x3d78('0x75')]){_0xb030d7[_0x3d78('0x29')][_0x3d78('0x76')]=util[_0x3d78('0x60')]('SIP/%s',_0x45e803[_0x3d78('0x63')][_0x3d78('0x3c')]);_0xb030d7['message'][_0x3d78('0x77')]=_0xb030d7[_0x3d78('0x77')];_0xb030d7['message'][_0x3d78('0x78')]=_0xb030d7[_0x3d78('0x77')];_0xb030d7['message'][_0x3d78('0x79')]=_0x3d78('0x5e');return respondWithRpcPromise(_0x3d78('0x7a'),_0x3d78('0x7a'),{'event':_0x3d78('0x7b'),'message':_0xb030d7[_0x3d78('0x29')]},client9002)[_0x3d78('0x39')](function(){return _0xb030d7;});}return _0xb030d7;}return null;})[_0x3d78('0x39')](respondWithResult(_0xf8531e,null))[_0x3d78('0x5b')](handleError(_0xf8531e,null));};var interaction_log=require(_0x3d78('0x16'))(_0x3d78('0x7c'));exports[_0x3d78('0x37')]=function(_0x112789,_0x381378,_0x14c0c9){var _0x175f7d={'agent':{},'channel':_0x3d78('0x5f')};if(_0x112789[_0x3d78('0x5c')]['id']){delete _0x112789['body']['id'];}_0x112789['body'][_0x3d78('0x62')]=_0x112789['body'][_0x3d78('0x62')]||_0x112789[_0x3d78('0x63')]['id'];_0x175f7d['agent']['id']=_0x112789[_0x3d78('0x5c')][_0x3d78('0x62')];return db[_0x3d78('0x40')][_0x3d78('0x5a')]({'where':{'id':_0x112789[_0x3d78('0x57')]['id'],'UserId':null}})[_0x3d78('0x39')](handleEntityNotFound(_0x381378,null))['then'](function(_0x43d374){if(_0x43d374){_0x175f7d[_0x3d78('0x29')]=_0x43d374[_0x3d78('0x65')]({'plain':!![]});return db[_0x3d78('0x66')][_0x3d78('0x5a')]({'where':{'id':_0x43d374[_0x3d78('0x7d')]}});}return null;})[_0x3d78('0x39')](handleEntityNotFound(_0x381378,null))[_0x3d78('0x39')](function(_0x10672f){if(_0x10672f){_0x175f7d[_0x3d78('0x69')]=_0x10672f['get']({'plain':!![]});interaction_log[_0x3d78('0x23')](_0x3d78('0x7e'),_0x112789[_0x3d78('0x63')]['id'],_0x112789[_0x3d78('0x63')][_0x3d78('0x3c')],_0x112789['user']['role'],_0x175f7d[_0x3d78('0x69')]['id'],_0x112789[_0x3d78('0x5c')]?JSON[_0x3d78('0x26')](_0x112789[_0x3d78('0x5c')]):_0x3d78('0x6c'));return respondWithRpcPromise('RejectMessage',_0x3d78('0x7f'),_0x175f7d);}return null;})[_0x3d78('0x39')](function(_0x29df89){var _0x58d6bb=_0x3d78('0x6e')+_0x29df89[_0x3d78('0x29')][_0x3d78('0x80')];return db[_0x3d78('0x81')][_0x3d78('0x43')](_0x58d6bb,{'type':db['Sequelize']['QueryTypes'][_0x3d78('0x82')],'raw':!![]})[_0x3d78('0x39')](function(_0x221cab){return _0x221cab;});})['then'](function(_0x1bce35){if(_0x1bce35){_0x175f7d[_0x3d78('0x29')][_0x3d78('0x70')]=_0x1bce35[0x0];if(!_0x112789[_0x3d78('0x5c')][_0x3d78('0x62')])return;return db[_0x3d78('0x71')]['find']({'where':{'id':_0x112789['body'][_0x3d78('0x62')],'role':_0x3d78('0x64')},'attributes':['id',_0x3d78('0x3c'),_0x3d78('0x72'),_0x3d78('0x73'),'internal'],'raw':!![]});}return null;})[_0x3d78('0x39')](function(_0x16f52f){if(!_0x16f52f)return null;_0x175f7d[_0x3d78('0x29')][_0x3d78('0x64')]=_0x16f52f;return _0x175f7d;})[_0x3d78('0x39')](function(_0xde69b8){if(_0xde69b8){_0xde69b8[_0x3d78('0x29')][_0x3d78('0x76')]=util[_0x3d78('0x60')](_0x3d78('0x83'),_0x112789[_0x3d78('0x63')][_0x3d78('0x3c')]);_0xde69b8[_0x3d78('0x29')]['channel']=_0x175f7d['channel'];_0xde69b8['message'][_0x3d78('0x78')]=_0x175f7d[_0x3d78('0x77')];_0xde69b8[_0x3d78('0x29')]['event']=_0x3d78('0x37');respondWithRpcPromise('EventManager','EventManager',{'event':_0x3d78('0x84'),'message':_0xde69b8['message']},client9002);return _0x175f7d;}return null;})[_0x3d78('0x39')](respondWithResult(_0x381378,null))[_0x3d78('0x5b')](handleError(_0x381378,null));};exports[_0x3d78('0x85')]=function(_0x29e200,_0x395ec2){var _0x8a6368;return db[_0x3d78('0x40')][_0x3d78('0x85')](_0x29e200['body'],{})[_0x3d78('0x39')](function(_0x12e45a){_0x8a6368=_0x12e45a;return db[_0x3d78('0x86')][_0x3d78('0x87')]({'where':{'id':_0x8a6368[_0x3d78('0x80')]}});})[_0x3d78('0x39')](function(_0xa41dca){if(_[_0x3d78('0x67')](_0xa41dca)){return;}else{_0x8a6368[_0x3d78('0x5f')]=_0xa41dca[_0x3d78('0x5f')];return db['Attachment']['findOne']({'where':{'id':_0x8a6368[_0x3d78('0x88')]}});}})[_0x3d78('0x39')](function(_0x10a6ea){return respondWithRpcPromise(_0x3d78('0x89'),_0x3d78('0x89'),{'FaxAccountId':_[_0x3d78('0x67')](_0x29e200[_0x3d78('0x5c')])?undefined:_0x29e200[_0x3d78('0x5c')][_0x3d78('0x8a')],'path':_[_0x3d78('0x67')](_0x10a6ea)?undefined:util[_0x3d78('0x60')](_0x3d78('0x8b'),_0x10a6ea[_0x3d78('0x8c')]),'fax':_[_0x3d78('0x67')](_0x8a6368[_0x3d78('0x5f')])?undefined:_0x8a6368[_0x3d78('0x5f')],'AttachmentId':_0x8a6368[_0x3d78('0x88')]},client9002);})[_0x3d78('0x39')](respondWithResult(_0x395ec2,0xc9))['catch'](handleError(_0x395ec2,null));};exports[_0x3d78('0x8d')]=function(_0x32cd87,_0x1e95ab){var _0x3ab6a2=path[_0x3d78('0x8e')](config['root'],_0x3d78('0x8f'),_0x3d78('0x90'),_0x3d78('0x91'));return db[_0x3d78('0x40')][_0x3d78('0x5a')]({'where':{'id':_0x32cd87['params']['id']},'include':[{'model':db['Attachment'],'as':_0x3d78('0x92')}]})[_0x3d78('0x39')](handleEntityNotFound(_0x1e95ab,null))['then'](function(_0x5644e3){if(_0x5644e3){return _0x1e95ab[_0x3d78('0x8d')](path[_0x3d78('0x8e')](_0x3ab6a2,_0x5644e3['Attachment'][_0x3d78('0x8c')]));}})[_0x3d78('0x5b')](handleError(_0x1e95ab,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 47c9efa..50cdaf2 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 _0xacc6=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','remove'];(function(_0x5e5c4c,_0x21abba){var _0x176148=function(_0x59522a){while(--_0x59522a){_0x5e5c4c['push'](_0x5e5c4c['shift']());}};_0x176148(++_0x21abba);}(_0xacc6,0x150));var _0x6acc=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0xacc6[_0x162780];return _0x1ea2dc;};'use strict';var EventEmitter=require(_0x6acc('0x0'));var FaxMessage=require(_0x6acc('0x1'))['db'][_0x6acc('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x6acc('0x3')](0x0);var events={'afterCreate':_0x6acc('0x4'),'afterUpdate':'update','afterDestroy':_0x6acc('0x5')};function emitEvent(_0x14a0d1){return function(_0x2ff2ff,_0x53dcdb,_0x148455){FaxMessageEvents['emit'](_0x14a0d1+':'+_0x2ff2ff['id'],_0x2ff2ff);FaxMessageEvents[_0x6acc('0x6')](_0x14a0d1,_0x2ff2ff);_0x148455(null);};}for(var e in events){if(events[_0x6acc('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x6acc('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x8110=['update','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x2f3ed6,_0x4913ea){var _0x3ba5c8=function(_0x485b44){while(--_0x485b44){_0x2f3ed6['push'](_0x2f3ed6['shift']());}};_0x3ba5c8(++_0x4913ea);}(_0x8110,0x185));var _0x0811=function(_0x23377a,_0x4c7e0a){_0x23377a=_0x23377a-0x0;var _0x421693=_0x8110[_0x23377a];return _0x421693;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x0811('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0811('0x1'),'afterDestroy':'remove'};function emitEvent(_0x16057f){return function(_0x266310,_0x424170,_0x419fd7){FaxMessageEvents[_0x0811('0x2')](_0x16057f+':'+_0x266310['id'],_0x266310);FaxMessageEvents['emit'](_0x16057f,_0x266310);_0x419fd7(null);};}for(var e in events){if(events[_0x0811('0x3')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x0811('0x4')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index fbde1e6..8b62953 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 _0xef39=['UserId','findOne','then','update','catch','error','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret'];(function(_0x5a843d,_0x43aa9f){var _0x2227bc=function(_0x221c7a){while(--_0x221c7a){_0x5a843d['push'](_0x5a843d['shift']());}};_0x2227bc(++_0x43aa9f);}(_0xef39,0x1ba));var _0x9ef3=function(_0x1f7f8e,_0x1e2df2){_0x1f7f8e=_0x1f7f8e-0x0;var _0x2ea3ae=_0xef39[_0x1f7f8e];return _0x2ea3ae;};'use strict';var _=require(_0x9ef3('0x0'));var util=require(_0x9ef3('0x1'));var logger=require('../../config/logger')(_0x9ef3('0x2'));var moment=require(_0x9ef3('0x3'));var BPromise=require(_0x9ef3('0x4'));var rp=require(_0x9ef3('0x5'));var fs=require('fs');var path=require(_0x9ef3('0x6'));var rimraf=require(_0x9ef3('0x7'));var config=require('../../config/environment');var attributes=require(_0x9ef3('0x8'));module[_0x9ef3('0x9')]=function(_0x266b2a,_0x10df48){return _0x266b2a[_0x9ef3('0xa')](_0x9ef3('0xb'),attributes,{'tableName':_0x9ef3('0xc'),'paranoid':![],'indexes':[{'name':_0x9ef3('0xd'),'fields':[_0x9ef3('0xe')],'type':_0x9ef3('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x341183,_0x24e183,_0x221540){var _0x22c05f=_0x266b2a[_0x9ef3('0x10')];var _0x48cf51=_0x341183[_0x9ef3('0x11')]({'plain':!![]});if(_0x48cf51[_0x9ef3('0x12')][_0x9ef3('0x13')]()==='in'||_0x48cf51['direction']['toLowerCase']()===_0x9ef3('0x14')&&!_0x48cf51[_0x9ef3('0x15')]&&!_['isNil'](_0x48cf51[_0x9ef3('0x16')])){_0x22c05f['FaxInteraction'][_0x9ef3('0x17')]({'where':{'id':_0x48cf51['FaxInteractionId']}})[_0x9ef3('0x18')](function(_0x3ef4b1){if(_0x3ef4b1){_0x3ef4b1[_0x9ef3('0x19')]({'lastMsgAt':_0x48cf51['createdAt'],'lastMsgDirection':_0x48cf51[_0x9ef3('0x12')][_0x9ef3('0x13')]()});}})[_0x9ef3('0x1a')](function(_0x10e9dd){console[_0x9ef3('0x1b')](_0x10e9dd);});}_0x221540();}},'charset':'utf8mb4','collate':_0x9ef3('0x1c')});}; \ No newline at end of file +var _0xa643=['path','rimraf','../../config/environment','./faxMessage.attributes','exports','fax_messages','fti_fax_messages','body','FULLTEXT','get','toLowerCase','direction','secret','isNil','then','update','createdAt','error','utf8mb4','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1d02e4,_0x70ad69){var _0x1fecbe=function(_0x14f637){while(--_0x14f637){_0x1d02e4['push'](_0x1d02e4['shift']());}};_0x1fecbe(++_0x70ad69);}(_0xa643,0xa9));var _0x3a64=function(_0x1062c2,_0x2bd58a){_0x1062c2=_0x1062c2-0x0;var _0x271448=_0xa643[_0x1062c2];return _0x271448;};'use strict';var _=require(_0x3a64('0x0'));var util=require(_0x3a64('0x1'));var logger=require('../../config/logger')(_0x3a64('0x2'));var moment=require(_0x3a64('0x3'));var BPromise=require(_0x3a64('0x4'));var rp=require(_0x3a64('0x5'));var fs=require('fs');var path=require(_0x3a64('0x6'));var rimraf=require(_0x3a64('0x7'));var config=require(_0x3a64('0x8'));var attributes=require(_0x3a64('0x9'));module[_0x3a64('0xa')]=function(_0xdb084c,_0x5045a0){return _0xdb084c['define']('FaxMessage',attributes,{'tableName':_0x3a64('0xb'),'paranoid':![],'indexes':[{'name':_0x3a64('0xc'),'fields':[_0x3a64('0xd')],'type':_0x3a64('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x445f09,_0x288f3f,_0xc30326){var _0x337dca=_0xdb084c['models'];var _0x991676=_0x445f09[_0x3a64('0xf')]({'plain':!![]});if(_0x991676['direction'][_0x3a64('0x10')]()==='in'||_0x991676[_0x3a64('0x11')]['toLowerCase']()==='out'&&!_0x991676[_0x3a64('0x12')]&&!_[_0x3a64('0x13')](_0x991676['UserId'])){_0x337dca['FaxInteraction']['findOne']({'where':{'id':_0x991676['FaxInteractionId']}})[_0x3a64('0x14')](function(_0x1e56c9){if(_0x1e56c9){_0x1e56c9[_0x3a64('0x15')]({'lastMsgAt':_0x991676[_0x3a64('0x16')],'lastMsgDirection':_0x991676[_0x3a64('0x11')][_0x3a64('0x10')]()});}})['catch'](function(_0x222f1c){console[_0x3a64('0x17')](_0x222f1c);});}_0xc30326();}},'charset':_0x3a64('0x18'),'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 0fd1a6c..c195576 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 _0x9957=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','body','options','raw','CreateFaxMessage','catch','UpdateFaxMessage','FaxMessage','where','attributes','lodash'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});config[_0x7995('0xc')]=_[_0x7995('0xd')](config['redis'],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require(_0x7995('0xf'))(new Redis(config['redis']));require(_0x7995('0x10'))[_0x7995('0x11')](socket);function respondWithRpcPromise(_0x18c8a3,_0x35b5fe,_0x3c1d19){return new BPromise(function(_0x1e400a,_0x341672){return client['request'](_0x18c8a3,_0x3c1d19)[_0x7995('0x12')](function(_0x41c652){logger['info'](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));logger[_0x7995('0x15')](_0x7995('0x16'),_0x35b5fe,_0x7995('0x14'),JSON[_0x7995('0x17')](_0x41c652));if(_0x41c652[_0x7995('0x18')]){if(_0x41c652['error']['code']===0x1f4){logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);return _0x341672(_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);}logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652['error'][_0x7995('0x19')]);return _0x1e400a(_0x41c652['error'][_0x7995('0x19')]);}else{logger[_0x7995('0x1a')](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));_0x1e400a(_0x41c652[_0x7995('0x1b')][_0x7995('0x19')]);}})['catch'](function(_0x54c9ae){logger[_0x7995('0x18')]('FaxMessage,\x20%s,\x20%s',_0x35b5fe,_0x54c9ae);_0x341672(_0x54c9ae);});});}exports['CreateFaxMessage']=function(_0x3ec178){var _0x3d463e=this;return new Promise(function(_0x4cbe10,_0x3a9b54){return db['FaxMessage']['create'](_0x3ec178[_0x7995('0x1c')],{'raw':_0x3ec178[_0x7995('0x1d')]?_0x3ec178[_0x7995('0x1d')][_0x7995('0x1e')]===undefined?!![]:![]:!![]})[_0x7995('0x12')](function(_0x1c278a){logger['info'](_0x7995('0x1f'),_0x3ec178);logger[_0x7995('0x15')](_0x7995('0x1f'),_0x3ec178,JSON[_0x7995('0x17')](_0x1c278a));_0x4cbe10(_0x1c278a);})[_0x7995('0x20')](function(_0x13bc35){logger[_0x7995('0x18')](_0x7995('0x1f'),_0x13bc35['message'],_0x3ec178);_0x3a9b54(_0x3d463e[_0x7995('0x18')](0x1f4,_0x13bc35[_0x7995('0x19')]));});});};exports[_0x7995('0x21')]=function(_0x268ce7){var _0x3a3fcf=this;return new Promise(function(_0x2a307e,_0x56691a){return db[_0x7995('0x22')]['update'](_0x268ce7[_0x7995('0x1c')],{'raw':_0x268ce7[_0x7995('0x1d')]?_0x268ce7[_0x7995('0x1d')][_0x7995('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x268ce7[_0x7995('0x1d')]?_0x268ce7['options'][_0x7995('0x23')]||null:null,'attributes':_0x268ce7['options']?_0x268ce7[_0x7995('0x1d')][_0x7995('0x24')]||null:null,'limit':_0x268ce7[_0x7995('0x1d')]?_0x268ce7['options']['limit']||null:null})['then'](function(_0x3573be){logger[_0x7995('0x1a')](_0x7995('0x21'),_0x268ce7);logger[_0x7995('0x15')](_0x7995('0x21'),_0x268ce7,JSON[_0x7995('0x17')](_0x3573be));_0x2a307e(_0x3573be);})['catch'](function(_0x481c74){logger[_0x7995('0x18')]('UpdateFaxMessage',_0x481c74[_0x7995('0x19')],_0x268ce7);_0x56691a(_0x3a3fcf[_0x7995('0x18')](0x1f4,_0x481c74[_0x7995('0x19')]));});});}; \ No newline at end of file +var _0x2dae=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','result','catch','CreateFaxMessage','FaxMessage','create','body','options','debug','UpdateFaxMessage','update','raw','attributes'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x2dae,0xc3));var _0xe2da=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0x2dae[_0x2bf466];return _0x856885;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var moment=require(_0xe2da('0x1'));var BPromise=require(_0xe2da('0x2'));var rs=require(_0xe2da('0x3'));var fs=require('fs');var Redis=require(_0xe2da('0x4'));var db=require(_0xe2da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2da('0x6'))(_0xe2da('0x7'));var config=require(_0xe2da('0x8'));var jayson=require(_0xe2da('0x9'));var client=jayson['client'][_0xe2da('0xa')]({'port':0x232a});config[_0xe2da('0xb')]=_[_0xe2da('0xc')](config[_0xe2da('0xb')],{'host':_0xe2da('0xd'),'port':0x18eb});var socket=require(_0xe2da('0xe'))(new Redis(config[_0xe2da('0xb')]));require(_0xe2da('0xf'))[_0xe2da('0x10')](socket);function respondWithRpcPromise(_0x5a2fc5,_0x52e650,_0x3baaa8){return new BPromise(function(_0x104fb3,_0x17086c){return client[_0xe2da('0x11')](_0x5a2fc5,_0x3baaa8)[_0xe2da('0x12')](function(_0x1a29b9){logger[_0xe2da('0x13')]('FaxMessage,\x20%s,\x20%s',_0x52e650,_0xe2da('0x14'));logger['debug'](_0xe2da('0x15'),_0x52e650,_0xe2da('0x14'),JSON[_0xe2da('0x16')](_0x1a29b9));if(_0x1a29b9[_0xe2da('0x17')]){if(_0x1a29b9[_0xe2da('0x17')][_0xe2da('0x18')]===0x1f4){logger[_0xe2da('0x17')]('FaxMessage,\x20%s,\x20%s',_0x52e650,_0x1a29b9[_0xe2da('0x17')]['message']);return _0x17086c(_0x1a29b9['error'][_0xe2da('0x19')]);}logger[_0xe2da('0x17')](_0xe2da('0x1a'),_0x52e650,_0x1a29b9['error'][_0xe2da('0x19')]);return _0x104fb3(_0x1a29b9[_0xe2da('0x17')][_0xe2da('0x19')]);}else{logger[_0xe2da('0x13')]('FaxMessage,\x20%s,\x20%s',_0x52e650,_0xe2da('0x14'));_0x104fb3(_0x1a29b9[_0xe2da('0x1b')][_0xe2da('0x19')]);}})[_0xe2da('0x1c')](function(_0x329ffe){logger['error'](_0xe2da('0x1a'),_0x52e650,_0x329ffe);_0x17086c(_0x329ffe);});});}exports[_0xe2da('0x1d')]=function(_0x538d96){var _0x1a9324=this;return new Promise(function(_0x254b37,_0x332193){return db[_0xe2da('0x1e')][_0xe2da('0x1f')](_0x538d96[_0xe2da('0x20')],{'raw':_0x538d96['options']?_0x538d96[_0xe2da('0x21')]['raw']===undefined?!![]:![]:!![]})[_0xe2da('0x12')](function(_0x191d38){logger[_0xe2da('0x13')](_0xe2da('0x1d'),_0x538d96);logger[_0xe2da('0x22')](_0xe2da('0x1d'),_0x538d96,JSON[_0xe2da('0x16')](_0x191d38));_0x254b37(_0x191d38);})[_0xe2da('0x1c')](function(_0x5a08d6){logger[_0xe2da('0x17')](_0xe2da('0x1d'),_0x5a08d6[_0xe2da('0x19')],_0x538d96);_0x332193(_0x1a9324[_0xe2da('0x17')](0x1f4,_0x5a08d6[_0xe2da('0x19')]));});});};exports[_0xe2da('0x23')]=function(_0x124d93){var _0x56c37e=this;return new Promise(function(_0x2adc49,_0x3e23d7){return db[_0xe2da('0x1e')][_0xe2da('0x24')](_0x124d93[_0xe2da('0x20')],{'raw':_0x124d93[_0xe2da('0x21')]?_0x124d93[_0xe2da('0x21')][_0xe2da('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x124d93['options']?_0x124d93['options']['where']||null:null,'attributes':_0x124d93[_0xe2da('0x21')]?_0x124d93[_0xe2da('0x21')][_0xe2da('0x26')]||null:null,'limit':_0x124d93[_0xe2da('0x21')]?_0x124d93['options']['limit']||null:null})[_0xe2da('0x12')](function(_0x1ec8ca){logger[_0xe2da('0x13')](_0xe2da('0x23'),_0x124d93);logger[_0xe2da('0x22')](_0xe2da('0x23'),_0x124d93,JSON[_0xe2da('0x16')](_0x1ec8ca));_0x2adc49(_0x1ec8ca);})[_0xe2da('0x1c')](function(_0x461610){logger['error']('UpdateFaxMessage',_0x461610[_0xe2da('0x19')],_0x124d93);_0x3e23d7(_0x56c37e[_0xe2da('0x17')](0x1f4,_0x461610[_0xe2da('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index c4d4e59..cbe192c 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 _0xbd38=['./faxMessage.events','save','remove','update','emit','removeListener','register','faxMessage:'];(function(_0x5149b8,_0x594385){var _0x4cf856=function(_0x261131){while(--_0x261131){_0x5149b8['push'](_0x5149b8['shift']());}};_0x4cf856(++_0x594385);}(_0xbd38,0x180));var _0x8bd3=function(_0x46ba75,_0x209d1f){_0x46ba75=_0x46ba75-0x0;var _0x20daaa=_0xbd38[_0x46ba75];return _0x20daaa;};'use strict';var FaxMessageEvents=require(_0x8bd3('0x0'));var events=[_0x8bd3('0x1'),_0x8bd3('0x2'),_0x8bd3('0x3')];function createListener(_0x5d3a11,_0x1a99e3){return function(_0x22c246){_0x1a99e3[_0x8bd3('0x4')](_0x5d3a11,_0x22c246);};}function removeListener(_0x151912,_0x457b67){return function(){FaxMessageEvents[_0x8bd3('0x5')](_0x151912,_0x457b67);};}exports[_0x8bd3('0x6')]=function(_0x4b0e53){for(var _0x110d83=0x0,_0x1e1932=events['length'];_0x110d83<_0x1e1932;_0x110d83++){var _0x4e6cf4=events[_0x110d83];var _0x49dcd7=createListener(_0x8bd3('0x7')+_0x4e6cf4,_0x4b0e53);FaxMessageEvents['on'](_0x4e6cf4,_0x49dcd7);}}; \ No newline at end of file +var _0xf137=['faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x2c0bb5,_0x568a0b){var _0x1c2434=function(_0x2961e3){while(--_0x2961e3){_0x2c0bb5['push'](_0x2c0bb5['shift']());}};_0x1c2434(++_0x568a0b);}(_0xf137,0x15f));var _0x7f13=function(_0x4d2329,_0x5c505a){_0x4d2329=_0x4d2329-0x0;var _0x37233b=_0xf137[_0x4d2329];return _0x37233b;};'use strict';var FaxMessageEvents=require(_0x7f13('0x0'));var events=[_0x7f13('0x1'),_0x7f13('0x2'),_0x7f13('0x3')];function createListener(_0xef2223,_0xffa17b){return function(_0x3f106){_0xffa17b[_0x7f13('0x4')](_0xef2223,_0x3f106);};}function removeListener(_0x188729,_0x5eadbe){return function(){FaxMessageEvents[_0x7f13('0x5')](_0x188729,_0x5eadbe);};}exports['register']=function(_0x2c2aaf){for(var _0x569eef=0x0,_0x2f805f=events['length'];_0x569eef<_0x2f805f;_0x569eef++){var _0x1a065d=events[_0x569eef];var _0xa0fdc3=createListener(_0x7f13('0x6')+_0x1a065d,_0x2c2aaf);FaxMessageEvents['on'](_0x1a065d,_0xa0fdc3);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 6b2fab2..53f8bd2 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 _0x39cb=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','express'];(function(_0x485abd,_0x32c7c1){var _0x3379f1=function(_0x36b528){while(--_0x36b528){_0x485abd['push'](_0x485abd['shift']());}};_0x3379f1(++_0x32c7c1);}(_0x39cb,0x1bd));var _0xb39c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x39cb[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require(_0xb39c('0x0'));var path=require(_0xb39c('0x1'));var timeout=require('connect-timeout');var express=require(_0xb39c('0x2'));var router=express[_0xb39c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb39c('0x4'));var interaction=require(_0xb39c('0x5'));var config=require(_0xb39c('0x6'));var controller=require(_0xb39c('0x7'));router[_0xb39c('0x8')]('/',auth['isAuthenticated'](),controller[_0xb39c('0x9')]);router[_0xb39c('0x8')](_0xb39c('0xa'),auth[_0xb39c('0xb')](),controller['describe']);router['get'](_0xb39c('0xc'),auth[_0xb39c('0xb')](),controller[_0xb39c('0xd')]);router[_0xb39c('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xb39c('0xe')]('/',auth[_0xb39c('0xb')](),interaction[_0xb39c('0xf')](_0xb39c('0x10'),_0xb39c('0x11')),controller[_0xb39c('0x12')]);router[_0xb39c('0x13')](_0xb39c('0xc'),auth['isAuthenticated'](),controller[_0xb39c('0x14')]);router[_0xb39c('0x13')](_0xb39c('0x15'),auth['isAuthenticated'](),controller[_0xb39c('0x16')]);router[_0xb39c('0x13')](_0xb39c('0x17'),auth[_0xb39c('0xb')](),controller[_0xb39c('0x18')]);router[_0xb39c('0x19')](_0xb39c('0xc'),auth['isAuthenticated'](),controller[_0xb39c('0x1a')]);module[_0xb39c('0x1b')]=router; \ No newline at end of file +var _0x702d=['get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','tracked','create','put','update','/:id/accept','accept','reject','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x428dbd,_0x2726b9){var _0x2509f2=function(_0x53a53f){while(--_0x53a53f){_0x428dbd['push'](_0x428dbd['shift']());}};_0x2509f2(++_0x2726b9);}(_0x702d,0x147));var _0xd702=function(_0xa76946,_0x18d2da){_0xa76946=_0xa76946-0x0;var _0x5ce549=_0x702d[_0xa76946];return _0x5ce549;};'use strict';var multer=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var path=require(_0xd702('0x2'));var timeout=require(_0xd702('0x3'));var express=require(_0xd702('0x4'));var router=express['Router']();var fs_extra=require(_0xd702('0x5'));var auth=require(_0xd702('0x6'));var interaction=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var controller=require('./faxMessage.controller');router[_0xd702('0x9')]('/',auth['isAuthenticated'](),controller[_0xd702('0xa')]);router[_0xd702('0x9')](_0xd702('0xb'),auth['isAuthenticated'](),controller[_0xd702('0xc')]);router['get'](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0xf')]);router[_0xd702('0x9')](_0xd702('0x10'),auth[_0xd702('0xe')](),controller[_0xd702('0x11')]);router[_0xd702('0x12')]('/',auth[_0xd702('0xe')](),interaction[_0xd702('0x13')]('fax','faxmessage:create'),controller[_0xd702('0x14')]);router[_0xd702('0x15')](_0xd702('0xd'),auth['isAuthenticated'](),controller[_0xd702('0x16')]);router[_0xd702('0x15')](_0xd702('0x17'),auth[_0xd702('0xe')](),controller[_0xd702('0x18')]);router[_0xd702('0x15')]('/:id/reject',auth[_0xd702('0xe')](),controller[_0xd702('0x19')]);router['delete'](_0xd702('0xd'),auth['isAuthenticated'](),controller[_0xd702('0x1a')]);module[_0xd702('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 3ea5651..f21457c 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 _0xa0f4=['exports','INTEGER','ENUM','rrmemory'];(function(_0x188ba5,_0x5b6ef1){var _0x221598=function(_0x4d006e){while(--_0x4d006e){_0x188ba5['push'](_0x188ba5['shift']());}};_0x221598(++_0x5b6ef1);}(_0xa0f4,0x1b4));var _0x4a0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0f4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x4a0f('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4a0f('0x1')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4a0f('0x2')](_0x4a0f('0x3'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5946=['name','STRING','INTEGER','ENUM','rrmemory','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5946,0x8f));var _0x6594=function(_0x49e584,_0x2886f8){_0x49e584=_0x49e584-0x0;var _0x58b1be=_0x5946[_0x49e584];return _0x58b1be;};'use strict';var Sequelize=require('sequelize');module[_0x6594('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6594('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6594('0x2')]},'timeout':{'type':Sequelize[_0x6594('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6594('0x4')](_0x6594('0x5'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x6594('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 a3a7151..3afe092 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 _0x2b7d=['omit','spread','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','redis','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','get','FaxQueues','UserProfileResource','destroy','then','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','FaxQueue','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','UserId','agent','createdAt','format','%s/%s','SIP','faxPause','getTeams','Team','ids','Agents','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','removeAgents','userFaxQueue:remove','addAgents'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x2b7d,0x1b6));var _0xd2b7=function(_0x6f65ae,_0x797e){_0x6f65ae=_0x6f65ae-0x0;var _0x3f635e=_0x2b7d[_0x6f65ae];return _0x3f635e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd2b7('0x0'));var zipdir=require(_0xd2b7('0x1'));var jsonpatch=require(_0xd2b7('0x2'));var rp=require(_0xd2b7('0x3'));var moment=require(_0xd2b7('0x4'));var BPromise=require(_0xd2b7('0x5'));var Mustache=require(_0xd2b7('0x6'));var util=require(_0xd2b7('0x7'));var path=require('path');var sox=require(_0xd2b7('0x8'));var csv=require(_0xd2b7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd2b7('0xa'));var _=require(_0xd2b7('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd2b7('0xc'));var deskjs=require(_0xd2b7('0xd'));var toCsv=require(_0xd2b7('0x9'));var querystring=require('querystring');var Papa=require(_0xd2b7('0xe'));var Redis=require('ioredis');var authService=require(_0xd2b7('0xf'));var qs=require(_0xd2b7('0x10'));var as=require(_0xd2b7('0x11'));var hardwareService=require(_0xd2b7('0x12'));var logger=require(_0xd2b7('0x13'))(_0xd2b7('0x14'));var utils=require(_0xd2b7('0x15'));var config=require(_0xd2b7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd2b7('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd2b7('0x18'))(new Redis(config[_0xd2b7('0x19')]));require(_0xd2b7('0x1a'))[_0xd2b7('0x1b')](socket);function respondWithStatusCode(_0x24d515,_0x4cfb93){_0x4cfb93=_0x4cfb93||0xcc;return function(_0x361894){if(_0x361894){return _0x24d515[_0xd2b7('0x1c')](_0x4cfb93);}return _0x24d515[_0xd2b7('0x1d')](_0x4cfb93)[_0xd2b7('0x1e')]();};}function respondWithResult(_0xf528ff,_0x327bd8){_0x327bd8=_0x327bd8||0xc8;return function(_0x5104b2){if(_0x5104b2){return _0xf528ff[_0xd2b7('0x1d')](_0x327bd8)[_0xd2b7('0x1f')](_0x5104b2);}};}function respondWithFilteredResult(_0x58a3fc,_0x44acdf){return function(_0x42ee40){if(_0x42ee40){var _0x3e21da=typeof _0x44acdf[_0xd2b7('0x20')]===_0xd2b7('0x21')&&typeof _0x44acdf['limit']===_0xd2b7('0x21');var _0x3d733b=_0x42ee40['count'];var _0x46f8c3=_0x3e21da?0x0:_0x44acdf[_0xd2b7('0x20')];var _0x50c54f=_0x3e21da?_0x42ee40[_0xd2b7('0x22')]:_0x44acdf[_0xd2b7('0x20')]+_0x44acdf['limit'];var _0x5b7c43;if(_0x50c54f>=_0x3d733b){_0x50c54f=_0x3d733b;_0x5b7c43=0xc8;}else{_0x5b7c43=0xce;}_0x58a3fc[_0xd2b7('0x1d')](_0x5b7c43);return _0x58a3fc[_0xd2b7('0x23')](_0xd2b7('0x24'),_0x46f8c3+'-'+_0x50c54f+'/'+_0x3d733b)[_0xd2b7('0x1f')](_0x42ee40);}return null;};}function patchUpdates(_0x3afaa0){return function(_0xdb4921){try{jsonpatch[_0xd2b7('0x25')](_0xdb4921,_0x3afaa0,!![]);}catch(_0x5a63c9){return BPromise[_0xd2b7('0x26')](_0x5a63c9);}return _0xdb4921[_0xd2b7('0x27')]();};}function saveUpdates(_0x4f8aee,_0x1601d0){return function(_0x2d6b54){if(_0x2d6b54){return _0x2d6b54[_0xd2b7('0x28')](_0x4f8aee)['then'](function(_0x5e97c1){return _0x5e97c1;});}return null;};}function removeEntity(_0x262785,_0x43506f){return function(_0x301250){if(_0x301250){return _0x301250['destroy']()['then'](function(){var _0x5dafb0=_0x301250[_0xd2b7('0x29')]({'plain':!![]});var _0x5b0737=_0xd2b7('0x2a');return db[_0xd2b7('0x2b')][_0xd2b7('0x2c')]({'where':{'type':_0x5b0737,'resourceId':_0x5dafb0['id']}})[_0xd2b7('0x2d')](function(){return _0x301250;});})[_0xd2b7('0x2d')](function(){_0x262785[_0xd2b7('0x1d')](0xcc)[_0xd2b7('0x1e')]();});}};}function handleEntityNotFound(_0x1cd0da,_0x5160d1){return function(_0x2ec798){if(!_0x2ec798){_0x1cd0da[_0xd2b7('0x1c')](0x194);}return _0x2ec798;};}function handleError(_0x3516c8,_0x54c240){_0x54c240=_0x54c240||0x1f4;return function(_0x3d9ec1){logger[_0xd2b7('0x2e')](_0x3d9ec1[_0xd2b7('0x2f')]);if(_0x3d9ec1[_0xd2b7('0x30')]){delete _0x3d9ec1[_0xd2b7('0x30')];}_0x3516c8[_0xd2b7('0x1d')](_0x54c240)['send'](_0x3d9ec1);};}exports[_0xd2b7('0x31')]=function(_0x2af9a8,_0x52b608){var _0x14a254={},_0x1e4676={},_0x507b54={'count':0x0,'rows':[]};var _0x4c7f9e=_[_0xd2b7('0x32')](db['FaxQueue']['rawAttributes'],function(_0x5fbdae){return{'name':_0x5fbdae[_0xd2b7('0x33')],'type':_0x5fbdae[_0xd2b7('0x34')][_0xd2b7('0x35')]};});_0x1e4676[_0xd2b7('0x36')]=_[_0xd2b7('0x32')](_0x4c7f9e,_0xd2b7('0x30'));_0x1e4676[_0xd2b7('0x37')]=_[_0xd2b7('0x38')](_0x2af9a8['query']);_0x1e4676[_0xd2b7('0x39')]=_['intersection'](_0x1e4676[_0xd2b7('0x36')],_0x1e4676[_0xd2b7('0x37')]);_0x14a254['attributes']=_[_0xd2b7('0x3a')](_0x1e4676[_0xd2b7('0x36')],qs[_0xd2b7('0x3b')](_0x2af9a8[_0xd2b7('0x37')][_0xd2b7('0x3b')]));_0x14a254['attributes']=_0x14a254['attributes'][_0xd2b7('0x3c')]?_0x14a254[_0xd2b7('0x3d')]:_0x1e4676[_0xd2b7('0x36')];if(!_0x2af9a8[_0xd2b7('0x37')][_0xd2b7('0x3e')](_0xd2b7('0x3f'))){_0x14a254[_0xd2b7('0x40')]=qs[_0xd2b7('0x40')](_0x2af9a8['query'][_0xd2b7('0x40')]);_0x14a254['offset']=qs[_0xd2b7('0x20')](_0x2af9a8['query'][_0xd2b7('0x20')]);}_0x14a254[_0xd2b7('0x41')]=qs[_0xd2b7('0x42')](_0x2af9a8['query'][_0xd2b7('0x42')]);_0x14a254[_0xd2b7('0x43')]=qs[_0xd2b7('0x39')](_[_0xd2b7('0x44')](_0x2af9a8[_0xd2b7('0x37')],_0x1e4676['filters']),_0x4c7f9e);if(_0x2af9a8[_0xd2b7('0x37')][_0xd2b7('0x45')]){_0x14a254['where']=_[_0xd2b7('0x46')](_0x14a254[_0xd2b7('0x43')],{'$or':_[_0xd2b7('0x32')](_0x4c7f9e,function(_0x379cf3){if(_0x379cf3[_0xd2b7('0x34')]!==_0xd2b7('0x47')){var _0x1a41b9={};_0x1a41b9[_0x379cf3[_0xd2b7('0x30')]]={'$like':'%'+_0x2af9a8[_0xd2b7('0x37')]['filter']+'%'};return _0x1a41b9;}})});}_0x14a254=_[_0xd2b7('0x46')]({},_0x14a254,_0x2af9a8['options']);var _0xd75af7={'where':_0x14a254[_0xd2b7('0x43')]};return db[_0xd2b7('0x48')]['count'](_0xd75af7)[_0xd2b7('0x2d')](function(_0x369eb1){_0x507b54[_0xd2b7('0x22')]=_0x369eb1;if(_0x2af9a8[_0xd2b7('0x37')][_0xd2b7('0x49')]){_0x14a254[_0xd2b7('0x4a')]=[{'all':!![]}];}return db['FaxQueue'][_0xd2b7('0x4b')](_0x14a254);})[_0xd2b7('0x2d')](function(_0x3084a6){_0x507b54[_0xd2b7('0x4c')]=_0x3084a6;return _0x507b54;})['then'](respondWithFilteredResult(_0x52b608,_0x14a254))[_0xd2b7('0x4d')](handleError(_0x52b608,null));};exports[_0xd2b7('0x4e')]=function(_0x4ef632,_0x49dd5d){var _0xfec270={'raw':!![],'where':{'id':_0x4ef632[_0xd2b7('0x4f')]['id']}},_0x8a970f={};_0x8a970f[_0xd2b7('0x36')]=_[_0xd2b7('0x38')](db[_0xd2b7('0x48')][_0xd2b7('0x50')]);_0x8a970f[_0xd2b7('0x37')]=_[_0xd2b7('0x38')](_0x4ef632[_0xd2b7('0x37')]);_0x8a970f[_0xd2b7('0x39')]=_[_0xd2b7('0x3a')](_0x8a970f['model'],_0x8a970f[_0xd2b7('0x37')]);_0xfec270[_0xd2b7('0x3d')]=_[_0xd2b7('0x3a')](_0x8a970f[_0xd2b7('0x36')],qs[_0xd2b7('0x3b')](_0x4ef632[_0xd2b7('0x37')]['fields']));_0xfec270[_0xd2b7('0x3d')]=_0xfec270[_0xd2b7('0x3d')][_0xd2b7('0x3c')]?_0xfec270[_0xd2b7('0x3d')]:_0x8a970f[_0xd2b7('0x36')];if(_0x4ef632[_0xd2b7('0x37')][_0xd2b7('0x49')]){_0xfec270[_0xd2b7('0x4a')]=[{'all':!![]}];}_0xfec270=_[_0xd2b7('0x46')]({},_0xfec270,_0x4ef632[_0xd2b7('0x51')]);return db['FaxQueue']['find'](_0xfec270)['then'](handleEntityNotFound(_0x49dd5d,null))['then'](respondWithResult(_0x49dd5d,null))['catch'](handleError(_0x49dd5d,null));};exports[_0xd2b7('0x52')]=function(_0x10ab50,_0x499f9d){return db[_0xd2b7('0x48')][_0xd2b7('0x52')](_0x10ab50[_0xd2b7('0x53')],{})[_0xd2b7('0x2d')](function(_0x364da5){var _0x2ffa9a=_0x10ab50[_0xd2b7('0x54')][_0xd2b7('0x29')]({'plain':!![]});if(!_0x2ffa9a)throw new Error(_0xd2b7('0x55'));if(_0x2ffa9a[_0xd2b7('0x56')]==='user'){var _0x4ba244=_0x364da5['get']({'plain':!![]});var _0x3f85bf='FaxQueues';return db[_0xd2b7('0x57')][_0xd2b7('0x58')]({'where':{'name':_0x3f85bf,'userProfileId':_0x2ffa9a[_0xd2b7('0x59')]},'raw':!![]})['then'](function(_0x183af3){if(_0x183af3&&_0x183af3[_0xd2b7('0x5a')]===0x0){return db[_0xd2b7('0x2b')][_0xd2b7('0x52')]({'name':_0x4ba244['name'],'resourceId':_0x4ba244['id'],'type':_0x183af3[_0xd2b7('0x30')],'sectionId':_0x183af3['id']},{})['then'](function(){return _0x364da5;});}else{return _0x364da5;}})[_0xd2b7('0x4d')](function(_0x372b08){logger[_0xd2b7('0x2e')](_0xd2b7('0x5b'),_0x372b08);throw _0x372b08;});}return _0x364da5;})[_0xd2b7('0x2d')](respondWithResult(_0x499f9d,0xc9))[_0xd2b7('0x4d')](handleError(_0x499f9d,null));};exports[_0xd2b7('0x28')]=function(_0x4f8d15,_0x72bf8b){if(_0x4f8d15[_0xd2b7('0x53')]['id']){delete _0x4f8d15[_0xd2b7('0x53')]['id'];}return db[_0xd2b7('0x48')]['find']({'where':{'id':_0x4f8d15['params']['id']}})[_0xd2b7('0x2d')](handleEntityNotFound(_0x72bf8b,null))[_0xd2b7('0x2d')](saveUpdates(_0x4f8d15[_0xd2b7('0x53')],null))[_0xd2b7('0x2d')](respondWithResult(_0x72bf8b,null))['catch'](handleError(_0x72bf8b,null));};exports['destroy']=function(_0x2a8840,_0x109e04){return db[_0xd2b7('0x48')][_0xd2b7('0x58')]({'where':{'id':_0x2a8840[_0xd2b7('0x4f')]['id']}})[_0xd2b7('0x2d')](handleEntityNotFound(_0x109e04,null))[_0xd2b7('0x2d')](removeEntity(_0x109e04,null))['catch'](handleError(_0x109e04,null));};exports[_0xd2b7('0x5c')]=function(_0x59321c,_0x351133){return db[_0xd2b7('0x48')][_0xd2b7('0x5c')]()[_0xd2b7('0x2d')](respondWithResult(_0x351133,null))[_0xd2b7('0x4d')](handleError(_0x351133,null));};exports[_0xd2b7('0x5d')]=function(_0x820dbb,_0x5dd2b2,_0x271d62){var _0x35cf45={'raw':!![],'where':{}},_0x538a26={},_0x1cec07;return db[_0xd2b7('0x48')][_0xd2b7('0x5e')]({'where':{'id':_0x820dbb[_0xd2b7('0x4f')]['id']}})[_0xd2b7('0x2d')](handleEntityNotFound(_0x5dd2b2,null))[_0xd2b7('0x2d')](function(_0x3ef682){if(_0x3ef682){_0x1cec07=_0x3ef682[_0xd2b7('0x29')]({'plain':!![]});_0x538a26[_0xd2b7('0x36')]=_[_0xd2b7('0x38')](db[_0xd2b7('0x5f')][_0xd2b7('0x50')]);_0x538a26[_0xd2b7('0x37')]=_[_0xd2b7('0x38')](_0x820dbb['query']);_0x538a26[_0xd2b7('0x39')]=_['intersection'](_0x538a26[_0xd2b7('0x36')],_0x538a26[_0xd2b7('0x37')]);_0x35cf45[_0xd2b7('0x3d')]=_[_0xd2b7('0x3a')](_0x538a26['model'],qs[_0xd2b7('0x3b')](_0x820dbb[_0xd2b7('0x37')][_0xd2b7('0x3b')]));_0x35cf45['attributes']=_0x35cf45[_0xd2b7('0x3d')]['length']?_0x35cf45[_0xd2b7('0x3d')]:_0x538a26[_0xd2b7('0x36')];if(!_0x820dbb['query']['hasOwnProperty'](_0xd2b7('0x3f'))){_0x35cf45[_0xd2b7('0x40')]=qs['limit'](_0x820dbb[_0xd2b7('0x37')][_0xd2b7('0x40')]);_0x35cf45[_0xd2b7('0x20')]=qs['offset'](_0x820dbb[_0xd2b7('0x37')]['offset']);}_0x35cf45[_0xd2b7('0x41')]=qs[_0xd2b7('0x42')](_0x820dbb[_0xd2b7('0x37')][_0xd2b7('0x42')]);_0x35cf45[_0xd2b7('0x43')]=qs[_0xd2b7('0x39')](_[_0xd2b7('0x44')](_0x820dbb[_0xd2b7('0x37')],_0x538a26['filters']));_0x35cf45['where'][_0xd2b7('0x60')]=_0x3ef682['id'];if(_0x820dbb[_0xd2b7('0x37')][_0xd2b7('0x45')]){_0x35cf45[_0xd2b7('0x43')]=_[_0xd2b7('0x46')](_0x35cf45[_0xd2b7('0x43')],{'$or':_['map'](_0x35cf45[_0xd2b7('0x3d')],function(_0x33731d){var _0x8641be={};_0x8641be[_0x33731d]={'$like':'%'+_0x820dbb['query']['filter']+'%'};return _0x8641be;})});}_0x35cf45=_[_0xd2b7('0x46')]({},_0x35cf45,_0x820dbb[_0xd2b7('0x51')]);return db[_0xd2b7('0x5f')][_0xd2b7('0x4b')](_0x35cf45);}})[_0xd2b7('0x2d')](function(_0xddcd86){if(_0xddcd86){return db[_0xd2b7('0x61')]['findAndCountAll']({'where':{'id':_[_0xd2b7('0x32')](_0xddcd86,_0xd2b7('0x62')),'role':_0xd2b7('0x63')},'attributes':['id',_0xd2b7('0x30'),'faxPause','updatedAt',_0xd2b7('0x64')]});}})['then'](function(_0x1d176a){if(_0x1d176a){return{'count':_0x1d176a[_0xd2b7('0x22')],'rows':_['map'](_0x1d176a['rows'],function(_0x148a38){return{'membername':_0x148a38[_0xd2b7('0x30')],'UserId':_0x148a38['id'],'queue_name':_0x1cec07[_0xd2b7('0x30')],'FaxQueueId':_0x1cec07['id'],'interface':util[_0xd2b7('0x65')](_0xd2b7('0x66'),_0xd2b7('0x67'),_0x148a38[_0xd2b7('0x30')]),'penalty':0x0,'paused':_0x148a38[_0xd2b7('0x68')],'createdAt':_0x148a38['createdAt'],'updatedAt':_0x148a38['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd2b7('0x2d')](respondWithFilteredResult(_0x5dd2b2,_0x35cf45))[_0xd2b7('0x4d')](handleError(_0x5dd2b2,null));};exports[_0xd2b7('0x69')]=function(_0xb0796b,_0x573802,_0x2ef539){var _0x261513={};var _0x589974={};var _0x86d386;var _0x12f2fb;return db['FaxQueue'][_0xd2b7('0x5e')]({'where':{'id':_0xb0796b[_0xd2b7('0x4f')]['id']}})['then'](handleEntityNotFound(_0x573802,null))['then'](function(_0x5d4d5e){if(_0x5d4d5e){_0x86d386=_0x5d4d5e;_0x589974[_0xd2b7('0x36')]=_[_0xd2b7('0x38')](db[_0xd2b7('0x6a')][_0xd2b7('0x50')]);_0x589974['query']=_[_0xd2b7('0x38')](_0xb0796b[_0xd2b7('0x37')]);_0x589974['filters']=_[_0xd2b7('0x3a')](_0x589974[_0xd2b7('0x36')],_0x589974['query']);_0x261513[_0xd2b7('0x3d')]=_[_0xd2b7('0x3a')](_0x589974[_0xd2b7('0x36')],qs[_0xd2b7('0x3b')](_0xb0796b['query'][_0xd2b7('0x3b')]));_0x261513[_0xd2b7('0x3d')]=_0x261513[_0xd2b7('0x3d')][_0xd2b7('0x3c')]?_0x261513[_0xd2b7('0x3d')]:_0x589974[_0xd2b7('0x36')];_0x261513[_0xd2b7('0x41')]=qs['sort'](_0xb0796b[_0xd2b7('0x37')][_0xd2b7('0x42')]);_0x261513['where']=qs['filters'](_[_0xd2b7('0x44')](_0xb0796b[_0xd2b7('0x37')],_0x589974[_0xd2b7('0x39')]));if(_0xb0796b[_0xd2b7('0x37')]['filter']){_0x261513['where']=_['merge'](_0x261513[_0xd2b7('0x43')],{'$or':_[_0xd2b7('0x32')](_0x261513[_0xd2b7('0x3d')],function(_0x1e23dc){var _0x1f441d={};_0x1f441d[_0x1e23dc]={'$like':'%'+_0xb0796b[_0xd2b7('0x37')]['filter']+'%'};return _0x1f441d;})});}_0x261513=_['merge']({},_0x261513,_0xb0796b[_0xd2b7('0x51')]);return _0x86d386[_0xd2b7('0x69')](_0x261513);}})[_0xd2b7('0x2d')](function(_0x3fa28c){if(_0x3fa28c){_0x12f2fb=_0x3fa28c[_0xd2b7('0x3c')];if(!_0xb0796b[_0xd2b7('0x37')][_0xd2b7('0x3e')](_0xd2b7('0x3f'))){_0x261513['limit']=qs[_0xd2b7('0x40')](_0xb0796b['query'][_0xd2b7('0x40')]);_0x261513[_0xd2b7('0x20')]=qs[_0xd2b7('0x20')](_0xb0796b[_0xd2b7('0x37')]['offset']);}return _0x86d386[_0xd2b7('0x69')](_0x261513);}})[_0xd2b7('0x2d')](function(_0x48efbe){if(_0x48efbe){return _0x48efbe?{'count':_0x12f2fb,'rows':_0x48efbe}:null;}})[_0xd2b7('0x2d')](respondWithResult(_0x573802,null))[_0xd2b7('0x4d')](handleError(_0x573802,null));};exports['addTeams']=function(_0x18b5fd,_0x37131f,_0x268bfe){var _0xa42ba5=_0x18b5fd['body'][_0xd2b7('0x6b')];return db['Team'][_0xd2b7('0x4b')]({'where':{'id':_0xa42ba5},'attributes':['id'],'include':[{'model':db[_0xd2b7('0x61')],'as':_0xd2b7('0x6c'),'attributes':['id',_0xd2b7('0x30'),'online','voicePause',_0xd2b7('0x6d')],'raw':!![]}]})[_0xd2b7('0x2d')](function(_0x5077c6){if(_0x5077c6){var _0x32d5f6=_[_0xd2b7('0x6e')](_0x5077c6,function(_0x132d2a){var _0x4849a2=_0x132d2a[_0xd2b7('0x29')]({'plain':!![]});return _0x4849a2[_0xd2b7('0x6c')];});return db[_0xd2b7('0x48')][_0xd2b7('0x58')]({'where':{'id':_0x18b5fd[_0xd2b7('0x4f')]['id']}})[_0xd2b7('0x2d')](function(_0x1711d4){return db[_0xd2b7('0x6f')][_0xd2b7('0x70')](function(_0x22579d){return _0x1711d4[_0xd2b7('0x71')](_0xa42ba5,{'transaction':_0x22579d})['then'](function(){return BPromise[_0xd2b7('0x72')](_0x32d5f6,function(_0x56d64f){return db[_0xd2b7('0x5f')][_0xd2b7('0x73')]({'where':{'UserId':_0x56d64f['id'],'FaxQueueId':_0x18b5fd[_0xd2b7('0x4f')]['id']},'transaction':_0x22579d});});})[_0xd2b7('0x2d')](function(){_0x32d5f6[_0xd2b7('0x74')](function(_0x3c5f80){socket[_0xd2b7('0x75')]('userFaxQueue:save',{'UserId':_0x3c5f80['id'],'FaxQueueId':_0x1711d4['id']});});});});});}})[_0xd2b7('0x2d')](respondWithStatusCode(_0x37131f,null))[_0xd2b7('0x4d')](handleError(_0x37131f,null));};exports[_0xd2b7('0x76')]=function(_0x26b1bf,_0x1cdc35,_0x37061b){return db['Team'][_0xd2b7('0x4b')]({'where':{'id':_0x26b1bf[_0xd2b7('0x37')][_0xd2b7('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xd2b7('0x61')],'as':_0xd2b7('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xd2b7('0x2d')](handleEntityNotFound(_0x1cdc35,null))[_0xd2b7('0x2d')](function(_0x471d7e){var _0x33e1a0=_['map'](_0x471d7e,'id');var _0x3d08dd=[];var _0x382998=[];var _0x2d84da=squel[_0xd2b7('0x77')]();_0x2d84da[_0xd2b7('0x78')](_0xd2b7('0x79'))['from'](_0xd2b7('0x7a'),'tq')[_0xd2b7('0x7b')](_0xd2b7('0x7c'),'ut',_0xd2b7('0x7d'))[_0xd2b7('0x43')](_0xd2b7('0x7e'),_0x26b1bf[_0xd2b7('0x4f')]['id']);for(var _0x30180c=0x0;_0x30180c<_0x471d7e[_0xd2b7('0x3c')];_0x30180c+=0x1){let _0x15695b=_0x471d7e[_0x30180c];for(var _0x9473c9=0x0;_0x9473c9<_0x15695b['Agents'][_0xd2b7('0x3c')];_0x9473c9+=0x1){let _0x2309a4=_0x15695b['Agents'][_0x9473c9];var _0x50e8bf=_0x2d84da[_0xd2b7('0x7f')]();_0x50e8bf[_0xd2b7('0x43')](_0xd2b7('0x80'),_0x2309a4['id']);_0x382998[_0xd2b7('0x81')](db[_0xd2b7('0x6f')][_0xd2b7('0x37')](_0x50e8bf[_0xd2b7('0x82')](),{'type':db['sequelize'][_0xd2b7('0x83')][_0xd2b7('0x84')]})['then'](function(_0x1ce536){if(_0x1ce536['length']===0x1){return _0x2309a4['id'];}else{var _0x45f94d=_[_0xd2b7('0x85')](_['map'](_0x1ce536,_0xd2b7('0x86')),function(_0x3b3120){return _[_0xd2b7('0x87')](_0x33e1a0,_0x3b3120);});if(_0x45f94d){return _0x2309a4['id'];}}}));}}return BPromise[_0xd2b7('0x88')](_0x382998)['then'](function(_0x244308){_0x3d08dd=_(_0x3d08dd)[_0xd2b7('0x89')](_0x244308)['compact']()[_0xd2b7('0x8a')]();return db[_0xd2b7('0x48')][_0xd2b7('0x58')]({'where':{'id':_0x26b1bf[_0xd2b7('0x4f')]['id']}})[_0xd2b7('0x2d')](function(_0x771b5f){return db['sequelize'][_0xd2b7('0x70')](function(_0x4a0066){return _0x771b5f[_0xd2b7('0x76')](_0x26b1bf[_0xd2b7('0x37')][_0xd2b7('0x6b')],{'transaction':_0x4a0066})[_0xd2b7('0x2d')](function(){if(!_['isEmpty'](_0x3d08dd)){return _0x771b5f[_0xd2b7('0x8b')](_0x3d08dd,{'transaction':_0x4a0066});}})[_0xd2b7('0x2d')](function(){_0x3d08dd['forEach'](function(_0x57a8f3){socket[_0xd2b7('0x75')](_0xd2b7('0x8c'),{'UserId':_0x57a8f3,'FaxQueueId':_0x771b5f['id']});});});});});});})[_0xd2b7('0x2d')](respondWithStatusCode(_0x1cdc35,null))['catch'](handleError(_0x1cdc35,null));};exports[_0xd2b7('0x8d')]=function(_0x9e3981,_0x3a7815,_0x5dd746){return db[_0xd2b7('0x48')]['find']({'where':{'id':_0x9e3981['params']['id']}})[_0xd2b7('0x2d')](handleEntityNotFound(_0x3a7815,null))['then'](function(_0x1c07fc){if(_0x1c07fc){return _0x1c07fc[_0xd2b7('0x8d')](_0x9e3981['body'][_0xd2b7('0x6b')],_[_0xd2b7('0x8e')](_0x9e3981[_0xd2b7('0x53')],[_0xd2b7('0x6b'),'id'])||{})[_0xd2b7('0x8f')](function(_0x5c9a72){for(var _0x190eab=0x0;_0x190eab<_0x9e3981['body'][_0xd2b7('0x6b')]['length'];_0x190eab+=0x1){socket[_0xd2b7('0x75')]('userFaxQueue:save',{'UserId':Number(_0x9e3981[_0xd2b7('0x53')][_0xd2b7('0x6b')][_0x190eab]),'FaxQueueId':Number(_0x9e3981[_0xd2b7('0x4f')]['id'])});}return _0x5c9a72;});}})[_0xd2b7('0x2d')](respondWithResult(_0x3a7815,null))[_0xd2b7('0x4d')](handleError(_0x3a7815,null));};exports['removeAgents']=function(_0x155b09,_0x1d800b,_0x1a7c26){return db[_0xd2b7('0x48')][_0xd2b7('0x58')]({'where':{'id':_0x155b09[_0xd2b7('0x4f')]['id']}})[_0xd2b7('0x2d')](handleEntityNotFound(_0x1d800b,null))[_0xd2b7('0x2d')](function(_0x2e4c97){if(_0x2e4c97){return _0x2e4c97[_0xd2b7('0x8b')](_0x155b09['query'][_0xd2b7('0x6b')])[_0xd2b7('0x2d')](function(){if(_['isArray'](_0x155b09[_0xd2b7('0x37')][_0xd2b7('0x6b')])){for(var _0x33b99e=0x0;_0x33b99e<_0x155b09['query'][_0xd2b7('0x6b')][_0xd2b7('0x3c')];_0x33b99e+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x155b09[_0xd2b7('0x37')]['ids'][_0x33b99e]),'FaxQueueId':Number(_0x155b09[_0xd2b7('0x4f')]['id'])});}}else{socket[_0xd2b7('0x75')](_0xd2b7('0x8c'),{'UserId':Number(_0x155b09[_0xd2b7('0x37')][_0xd2b7('0x6b')]),'FaxQueueId':Number(_0x155b09['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1d800b,null))['catch'](handleError(_0x1d800b,null));};exports['getAgents']=function(_0x4f4885,_0x491314,_0x5be227){var _0xd6adbd={};var _0x5773ed={};var _0xbcc26b;var _0x3e6dbb;return db[_0xd2b7('0x48')]['findOne']({'where':{'id':_0x4f4885[_0xd2b7('0x4f')]['id']}})[_0xd2b7('0x2d')](handleEntityNotFound(_0x491314,null))[_0xd2b7('0x2d')](function(_0x22527a){if(_0x22527a){_0xbcc26b=_0x22527a;_0x5773ed[_0xd2b7('0x36')]=_[_0xd2b7('0x38')](db['User'][_0xd2b7('0x50')]);_0x5773ed[_0xd2b7('0x37')]=_[_0xd2b7('0x38')](_0x4f4885['query']);_0x5773ed[_0xd2b7('0x39')]=_[_0xd2b7('0x3a')](_0x5773ed[_0xd2b7('0x36')],_0x5773ed['query']);_0xd6adbd[_0xd2b7('0x3d')]=_[_0xd2b7('0x3a')](_0x5773ed[_0xd2b7('0x36')],qs['fields'](_0x4f4885[_0xd2b7('0x37')][_0xd2b7('0x3b')]));_0xd6adbd[_0xd2b7('0x3d')]=_0xd6adbd[_0xd2b7('0x3d')][_0xd2b7('0x3c')]?_0xd6adbd[_0xd2b7('0x3d')]:_0x5773ed[_0xd2b7('0x36')];_0xd6adbd[_0xd2b7('0x41')]=qs[_0xd2b7('0x42')](_0x4f4885[_0xd2b7('0x37')][_0xd2b7('0x42')]);_0xd6adbd[_0xd2b7('0x43')]=qs[_0xd2b7('0x39')](_[_0xd2b7('0x44')](_0x4f4885['query'],_0x5773ed[_0xd2b7('0x39')]));if(_0x4f4885[_0xd2b7('0x37')][_0xd2b7('0x45')]){_0xd6adbd[_0xd2b7('0x43')]=_['merge'](_0xd6adbd[_0xd2b7('0x43')],{'$or':_[_0xd2b7('0x32')](_0xd6adbd[_0xd2b7('0x3d')],function(_0x3ed667){var _0x11b375={};_0x11b375[_0x3ed667]={'$like':'%'+_0x4f4885[_0xd2b7('0x37')]['filter']+'%'};return _0x11b375;})});}_0xd6adbd=_['merge']({},_0xd6adbd,_0x4f4885[_0xd2b7('0x51')]);return _0xbcc26b['getAgents'](_0xd6adbd);}})[_0xd2b7('0x2d')](function(_0x26df9d){if(_0x26df9d){_0x3e6dbb=_0x26df9d['length'];if(!_0x4f4885[_0xd2b7('0x37')][_0xd2b7('0x3e')]('nolimit')){_0xd6adbd[_0xd2b7('0x40')]=qs[_0xd2b7('0x40')](_0x4f4885[_0xd2b7('0x37')][_0xd2b7('0x40')]);_0xd6adbd[_0xd2b7('0x20')]=qs[_0xd2b7('0x20')](_0x4f4885[_0xd2b7('0x37')][_0xd2b7('0x20')]);}return _0xbcc26b[_0xd2b7('0x90')](_0xd6adbd);}})[_0xd2b7('0x2d')](function(_0x4a7399){if(_0x4a7399){return _0x4a7399?{'count':_0x3e6dbb,'rows':_0x4a7399}:null;}})['then'](respondWithResult(_0x491314,null))[_0xd2b7('0x4d')](handleError(_0x491314,null));}; \ No newline at end of file +var _0x12e9=['role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserFaxQueue','pick','User','findAndCountAll','UserId','agent','faxPause','createdAt','%s/%s','SIP','updatedAt','getTeams','Team','nolimit','ids','Agents','voicePause','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','userFaxQueue:remove','addAgents','spread','userFaxQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','FaxQueues','UserProfileResource','error','stack','index','map','FaxQueue','fieldName','type','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0xd2d0d6,_0x35eea1){var _0x298487=function(_0x53f570){while(--_0x53f570){_0xd2d0d6['push'](_0xd2d0d6['shift']());}};_0x298487(++_0x35eea1);}(_0x12e9,0x1f0));var _0x912e=function(_0x1ab07d,_0x3e6db4){_0x1ab07d=_0x1ab07d-0x0;var _0x27780b=_0x12e9[_0x1ab07d];return _0x27780b;};'use strict';var emlformat=require(_0x912e('0x0'));var rimraf=require(_0x912e('0x1'));var zipdir=require(_0x912e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x912e('0x3'));var moment=require(_0x912e('0x4'));var BPromise=require(_0x912e('0x5'));var Mustache=require(_0x912e('0x6'));var util=require(_0x912e('0x7'));var path=require(_0x912e('0x8'));var sox=require(_0x912e('0x9'));var csv=require(_0x912e('0xa'));var ejs=require(_0x912e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x912e('0xc'));var squel=require(_0x912e('0xd'));var crypto=require(_0x912e('0xe'));var jsforce=require(_0x912e('0xf'));var deskjs=require(_0x912e('0x10'));var toCsv=require(_0x912e('0xa'));var querystring=require('querystring');var Papa=require(_0x912e('0x11'));var Redis=require('ioredis');var authService=require(_0x912e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x912e('0x13'));var hardwareService=require(_0x912e('0x14'));var logger=require(_0x912e('0x15'))(_0x912e('0x16'));var utils=require('../../config/utils');var config=require(_0x912e('0x17'));var licenseUtil=require(_0x912e('0x18'));var db=require(_0x912e('0x19'))['db'];config[_0x912e('0x1a')]=_[_0x912e('0x1b')](config[_0x912e('0x1a')],{'host':_0x912e('0x1c'),'port':0x18eb});var socket=require(_0x912e('0x1d'))(new Redis(config[_0x912e('0x1a')]));require(_0x912e('0x1e'))[_0x912e('0x1f')](socket);function respondWithStatusCode(_0x20eb84,_0x5a2745){_0x5a2745=_0x5a2745||0xcc;return function(_0x4b244d){if(_0x4b244d){return _0x20eb84[_0x912e('0x20')](_0x5a2745);}return _0x20eb84[_0x912e('0x21')](_0x5a2745)[_0x912e('0x22')]();};}function respondWithResult(_0x5f098d,_0x34fb89){_0x34fb89=_0x34fb89||0xc8;return function(_0xd22a28){if(_0xd22a28){return _0x5f098d['status'](_0x34fb89)[_0x912e('0x23')](_0xd22a28);}};}function respondWithFilteredResult(_0x43800d,_0x5f2201){return function(_0x3ed483){if(_0x3ed483){var _0x272702=typeof _0x5f2201[_0x912e('0x24')]==='undefined'&&typeof _0x5f2201['limit']===_0x912e('0x25');var _0x32b10c=_0x3ed483[_0x912e('0x26')];var _0x3a5e3e=_0x272702?0x0:_0x5f2201[_0x912e('0x24')];var _0x5edcab=_0x272702?_0x3ed483[_0x912e('0x26')]:_0x5f2201[_0x912e('0x24')]+_0x5f2201[_0x912e('0x27')];var _0x3b9c65;if(_0x5edcab>=_0x32b10c){_0x5edcab=_0x32b10c;_0x3b9c65=0xc8;}else{_0x3b9c65=0xce;}_0x43800d[_0x912e('0x21')](_0x3b9c65);return _0x43800d[_0x912e('0x28')](_0x912e('0x29'),_0x3a5e3e+'-'+_0x5edcab+'/'+_0x32b10c)[_0x912e('0x23')](_0x3ed483);}return null;};}function patchUpdates(_0x3967c8){return function(_0x5b6584){try{jsonpatch[_0x912e('0x2a')](_0x5b6584,_0x3967c8,!![]);}catch(_0x27ab19){return BPromise[_0x912e('0x2b')](_0x27ab19);}return _0x5b6584[_0x912e('0x2c')]();};}function saveUpdates(_0x3eddef,_0x11dcea){return function(_0x504c80){if(_0x504c80){return _0x504c80['update'](_0x3eddef)[_0x912e('0x2d')](function(_0x18a656){return _0x18a656;});}return null;};}function removeEntity(_0x2f4dda,_0x35b1ea){return function(_0x26933c){if(_0x26933c){return _0x26933c[_0x912e('0x2e')]()[_0x912e('0x2d')](function(){var _0x5d542a=_0x26933c['get']({'plain':!![]});var _0x29d410=_0x912e('0x2f');return db[_0x912e('0x30')][_0x912e('0x2e')]({'where':{'type':_0x29d410,'resourceId':_0x5d542a['id']}})[_0x912e('0x2d')](function(){return _0x26933c;});})['then'](function(){_0x2f4dda['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x150ec1,_0x5d0a1d){return function(_0x2c6c52){if(!_0x2c6c52){_0x150ec1[_0x912e('0x20')](0x194);}return _0x2c6c52;};}function handleError(_0x1809f3,_0x51e99e){_0x51e99e=_0x51e99e||0x1f4;return function(_0x22448a){logger[_0x912e('0x31')](_0x22448a[_0x912e('0x32')]);if(_0x22448a['name']){delete _0x22448a['name'];}_0x1809f3[_0x912e('0x21')](_0x51e99e)['send'](_0x22448a);};}exports[_0x912e('0x33')]=function(_0x2406b7,_0x5e48c8){var _0xb4814c={},_0x5ae94d={},_0x560dc1={'count':0x0,'rows':[]};var _0x54ce0a=_[_0x912e('0x34')](db[_0x912e('0x35')]['rawAttributes'],function(_0x3a8433){return{'name':_0x3a8433[_0x912e('0x36')],'type':_0x3a8433[_0x912e('0x37')]['key']};});_0x5ae94d[_0x912e('0x38')]=_['map'](_0x54ce0a,'name');_0x5ae94d['query']=_['keys'](_0x2406b7['query']);_0x5ae94d[_0x912e('0x39')]=_[_0x912e('0x3a')](_0x5ae94d[_0x912e('0x38')],_0x5ae94d[_0x912e('0x3b')]);_0xb4814c[_0x912e('0x3c')]=_['intersection'](_0x5ae94d[_0x912e('0x38')],qs[_0x912e('0x3d')](_0x2406b7['query'][_0x912e('0x3d')]));_0xb4814c[_0x912e('0x3c')]=_0xb4814c[_0x912e('0x3c')][_0x912e('0x3e')]?_0xb4814c['attributes']:_0x5ae94d[_0x912e('0x38')];if(!_0x2406b7[_0x912e('0x3b')][_0x912e('0x3f')]('nolimit')){_0xb4814c[_0x912e('0x27')]=qs[_0x912e('0x27')](_0x2406b7[_0x912e('0x3b')][_0x912e('0x27')]);_0xb4814c[_0x912e('0x24')]=qs[_0x912e('0x24')](_0x2406b7['query'][_0x912e('0x24')]);}_0xb4814c[_0x912e('0x40')]=qs[_0x912e('0x41')](_0x2406b7[_0x912e('0x3b')][_0x912e('0x41')]);_0xb4814c['where']=qs['filters'](_['pick'](_0x2406b7['query'],_0x5ae94d[_0x912e('0x39')]),_0x54ce0a);if(_0x2406b7[_0x912e('0x3b')][_0x912e('0x42')]){_0xb4814c[_0x912e('0x43')]=_[_0x912e('0x44')](_0xb4814c[_0x912e('0x43')],{'$or':_['map'](_0x54ce0a,function(_0x19c79f){if(_0x19c79f[_0x912e('0x37')]!==_0x912e('0x45')){var _0x45b3f1={};_0x45b3f1[_0x19c79f[_0x912e('0x46')]]={'$like':'%'+_0x2406b7[_0x912e('0x3b')][_0x912e('0x42')]+'%'};return _0x45b3f1;}})});}_0xb4814c=_[_0x912e('0x44')]({},_0xb4814c,_0x2406b7[_0x912e('0x47')]);var _0x209e2c={'where':_0xb4814c[_0x912e('0x43')]};return db[_0x912e('0x35')][_0x912e('0x26')](_0x209e2c)[_0x912e('0x2d')](function(_0x4c8b88){_0x560dc1['count']=_0x4c8b88;if(_0x2406b7['query'][_0x912e('0x48')]){_0xb4814c[_0x912e('0x49')]=[{'all':!![]}];}return db[_0x912e('0x35')][_0x912e('0x4a')](_0xb4814c);})[_0x912e('0x2d')](function(_0x568b7f){_0x560dc1[_0x912e('0x4b')]=_0x568b7f;return _0x560dc1;})[_0x912e('0x2d')](respondWithFilteredResult(_0x5e48c8,_0xb4814c))[_0x912e('0x4c')](handleError(_0x5e48c8,null));};exports['show']=function(_0x2b5dd6,_0x1249c9){var _0x61e54a={'raw':!![],'where':{'id':_0x2b5dd6[_0x912e('0x4d')]['id']}},_0x9d0a80={};_0x9d0a80[_0x912e('0x38')]=_[_0x912e('0x4e')](db['FaxQueue'][_0x912e('0x4f')]);_0x9d0a80[_0x912e('0x3b')]=_[_0x912e('0x4e')](_0x2b5dd6[_0x912e('0x3b')]);_0x9d0a80[_0x912e('0x39')]=_[_0x912e('0x3a')](_0x9d0a80[_0x912e('0x38')],_0x9d0a80[_0x912e('0x3b')]);_0x61e54a['attributes']=_[_0x912e('0x3a')](_0x9d0a80['model'],qs[_0x912e('0x3d')](_0x2b5dd6['query'][_0x912e('0x3d')]));_0x61e54a[_0x912e('0x3c')]=_0x61e54a[_0x912e('0x3c')][_0x912e('0x3e')]?_0x61e54a[_0x912e('0x3c')]:_0x9d0a80[_0x912e('0x38')];if(_0x2b5dd6[_0x912e('0x3b')][_0x912e('0x48')]){_0x61e54a[_0x912e('0x49')]=[{'all':!![]}];}_0x61e54a=_[_0x912e('0x44')]({},_0x61e54a,_0x2b5dd6['options']);return db['FaxQueue'][_0x912e('0x50')](_0x61e54a)[_0x912e('0x2d')](handleEntityNotFound(_0x1249c9,null))[_0x912e('0x2d')](respondWithResult(_0x1249c9,null))[_0x912e('0x4c')](handleError(_0x1249c9,null));};exports[_0x912e('0x51')]=function(_0x5077a9,_0x38c048){return db[_0x912e('0x35')]['create'](_0x5077a9['body'],{})[_0x912e('0x2d')](function(_0x5bc5cf){var _0x5c5920=_0x5077a9[_0x912e('0x52')]['get']({'plain':!![]});if(!_0x5c5920)throw new Error(_0x912e('0x53'));if(_0x5c5920[_0x912e('0x54')]===_0x912e('0x52')){var _0x33714b=_0x5bc5cf[_0x912e('0x55')]({'plain':!![]});var _0x18c04c=_0x912e('0x2f');return db[_0x912e('0x56')][_0x912e('0x50')]({'where':{'name':_0x18c04c,'userProfileId':_0x5c5920[_0x912e('0x57')]},'raw':!![]})[_0x912e('0x2d')](function(_0x4a6df8){if(_0x4a6df8&&_0x4a6df8['autoAssociation']===0x0){return db[_0x912e('0x30')]['create']({'name':_0x33714b[_0x912e('0x46')],'resourceId':_0x33714b['id'],'type':_0x4a6df8[_0x912e('0x46')],'sectionId':_0x4a6df8['id']},{})['then'](function(){return _0x5bc5cf;});}else{return _0x5bc5cf;}})['catch'](function(_0x59533d){logger['error'](_0x912e('0x58'),_0x59533d);throw _0x59533d;});}return _0x5bc5cf;})['then'](respondWithResult(_0x38c048,0xc9))['catch'](handleError(_0x38c048,null));};exports['update']=function(_0x110b38,_0x4cd50f){if(_0x110b38[_0x912e('0x59')]['id']){delete _0x110b38[_0x912e('0x59')]['id'];}return db[_0x912e('0x35')][_0x912e('0x50')]({'where':{'id':_0x110b38[_0x912e('0x4d')]['id']}})[_0x912e('0x2d')](handleEntityNotFound(_0x4cd50f,null))['then'](saveUpdates(_0x110b38['body'],null))['then'](respondWithResult(_0x4cd50f,null))[_0x912e('0x4c')](handleError(_0x4cd50f,null));};exports['destroy']=function(_0x17f698,_0x5c17de){return db['FaxQueue'][_0x912e('0x50')]({'where':{'id':_0x17f698['params']['id']}})[_0x912e('0x2d')](handleEntityNotFound(_0x5c17de,null))[_0x912e('0x2d')](removeEntity(_0x5c17de,null))[_0x912e('0x4c')](handleError(_0x5c17de,null));};exports[_0x912e('0x5a')]=function(_0x337e93,_0x18f208){return db[_0x912e('0x35')][_0x912e('0x5a')]()[_0x912e('0x2d')](respondWithResult(_0x18f208,null))[_0x912e('0x4c')](handleError(_0x18f208,null));};exports['getMembers']=function(_0x453567,_0xbe7d78,_0x540118){var _0x115812={'raw':!![],'where':{}},_0x5022a7={},_0x2727ad;return db['FaxQueue'][_0x912e('0x5b')]({'where':{'id':_0x453567[_0x912e('0x4d')]['id']}})[_0x912e('0x2d')](handleEntityNotFound(_0xbe7d78,null))[_0x912e('0x2d')](function(_0x56657b){if(_0x56657b){_0x2727ad=_0x56657b['get']({'plain':!![]});_0x5022a7[_0x912e('0x38')]=_[_0x912e('0x4e')](db[_0x912e('0x5c')][_0x912e('0x4f')]);_0x5022a7[_0x912e('0x3b')]=_['keys'](_0x453567[_0x912e('0x3b')]);_0x5022a7['filters']=_[_0x912e('0x3a')](_0x5022a7[_0x912e('0x38')],_0x5022a7['query']);_0x115812[_0x912e('0x3c')]=_['intersection'](_0x5022a7[_0x912e('0x38')],qs[_0x912e('0x3d')](_0x453567[_0x912e('0x3b')]['fields']));_0x115812[_0x912e('0x3c')]=_0x115812[_0x912e('0x3c')][_0x912e('0x3e')]?_0x115812[_0x912e('0x3c')]:_0x5022a7[_0x912e('0x38')];if(!_0x453567[_0x912e('0x3b')]['hasOwnProperty']('nolimit')){_0x115812['limit']=qs['limit'](_0x453567[_0x912e('0x3b')][_0x912e('0x27')]);_0x115812['offset']=qs[_0x912e('0x24')](_0x453567[_0x912e('0x3b')][_0x912e('0x24')]);}_0x115812['order']=qs[_0x912e('0x41')](_0x453567[_0x912e('0x3b')][_0x912e('0x41')]);_0x115812[_0x912e('0x43')]=qs[_0x912e('0x39')](_[_0x912e('0x5d')](_0x453567[_0x912e('0x3b')],_0x5022a7[_0x912e('0x39')]));_0x115812['where']['FaxQueueId']=_0x56657b['id'];if(_0x453567[_0x912e('0x3b')][_0x912e('0x42')]){_0x115812[_0x912e('0x43')]=_[_0x912e('0x44')](_0x115812[_0x912e('0x43')],{'$or':_[_0x912e('0x34')](_0x115812['attributes'],function(_0x39e048){var _0x575c2c={};_0x575c2c[_0x39e048]={'$like':'%'+_0x453567['query']['filter']+'%'};return _0x575c2c;})});}_0x115812=_[_0x912e('0x44')]({},_0x115812,_0x453567['options']);return db[_0x912e('0x5c')]['findAll'](_0x115812);}})[_0x912e('0x2d')](function(_0x571fcf){if(_0x571fcf){return db[_0x912e('0x5e')][_0x912e('0x5f')]({'where':{'id':_['map'](_0x571fcf,_0x912e('0x60')),'role':_0x912e('0x61')},'attributes':['id',_0x912e('0x46'),_0x912e('0x62'),'updatedAt',_0x912e('0x63')]});}})['then'](function(_0x39b4b5){if(_0x39b4b5){return{'count':_0x39b4b5[_0x912e('0x26')],'rows':_[_0x912e('0x34')](_0x39b4b5[_0x912e('0x4b')],function(_0x1567d1){return{'membername':_0x1567d1[_0x912e('0x46')],'UserId':_0x1567d1['id'],'queue_name':_0x2727ad[_0x912e('0x46')],'FaxQueueId':_0x2727ad['id'],'interface':util['format'](_0x912e('0x64'),_0x912e('0x65'),_0x1567d1[_0x912e('0x46')]),'penalty':0x0,'paused':_0x1567d1[_0x912e('0x62')],'createdAt':_0x1567d1['createdAt'],'updatedAt':_0x1567d1[_0x912e('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x912e('0x2d')](respondWithFilteredResult(_0xbe7d78,_0x115812))[_0x912e('0x4c')](handleError(_0xbe7d78,null));};exports[_0x912e('0x67')]=function(_0x1fac3f,_0x295ec2,_0x3da342){var _0x12549d={};var _0x2ea683={};var _0x53ae95;var _0x307e30;return db[_0x912e('0x35')][_0x912e('0x5b')]({'where':{'id':_0x1fac3f['params']['id']}})[_0x912e('0x2d')](handleEntityNotFound(_0x295ec2,null))[_0x912e('0x2d')](function(_0x4a221a){if(_0x4a221a){_0x53ae95=_0x4a221a;_0x2ea683['model']=_[_0x912e('0x4e')](db[_0x912e('0x68')][_0x912e('0x4f')]);_0x2ea683[_0x912e('0x3b')]=_['keys'](_0x1fac3f[_0x912e('0x3b')]);_0x2ea683['filters']=_['intersection'](_0x2ea683[_0x912e('0x38')],_0x2ea683[_0x912e('0x3b')]);_0x12549d[_0x912e('0x3c')]=_[_0x912e('0x3a')](_0x2ea683['model'],qs[_0x912e('0x3d')](_0x1fac3f['query'][_0x912e('0x3d')]));_0x12549d[_0x912e('0x3c')]=_0x12549d['attributes']['length']?_0x12549d[_0x912e('0x3c')]:_0x2ea683[_0x912e('0x38')];_0x12549d[_0x912e('0x40')]=qs[_0x912e('0x41')](_0x1fac3f[_0x912e('0x3b')]['sort']);_0x12549d[_0x912e('0x43')]=qs[_0x912e('0x39')](_[_0x912e('0x5d')](_0x1fac3f[_0x912e('0x3b')],_0x2ea683[_0x912e('0x39')]));if(_0x1fac3f['query']['filter']){_0x12549d[_0x912e('0x43')]=_['merge'](_0x12549d[_0x912e('0x43')],{'$or':_['map'](_0x12549d[_0x912e('0x3c')],function(_0x31beb7){var _0x2a725c={};_0x2a725c[_0x31beb7]={'$like':'%'+_0x1fac3f['query'][_0x912e('0x42')]+'%'};return _0x2a725c;})});}_0x12549d=_[_0x912e('0x44')]({},_0x12549d,_0x1fac3f[_0x912e('0x47')]);return _0x53ae95[_0x912e('0x67')](_0x12549d);}})[_0x912e('0x2d')](function(_0x312ec2){if(_0x312ec2){_0x307e30=_0x312ec2[_0x912e('0x3e')];if(!_0x1fac3f['query']['hasOwnProperty'](_0x912e('0x69'))){_0x12549d[_0x912e('0x27')]=qs[_0x912e('0x27')](_0x1fac3f[_0x912e('0x3b')][_0x912e('0x27')]);_0x12549d[_0x912e('0x24')]=qs['offset'](_0x1fac3f[_0x912e('0x3b')][_0x912e('0x24')]);}return _0x53ae95[_0x912e('0x67')](_0x12549d);}})['then'](function(_0x4d3074){if(_0x4d3074){return _0x4d3074?{'count':_0x307e30,'rows':_0x4d3074}:null;}})[_0x912e('0x2d')](respondWithResult(_0x295ec2,null))[_0x912e('0x4c')](handleError(_0x295ec2,null));};exports['addTeams']=function(_0x22f791,_0x415b8b,_0x58bb7b){var _0x1a3eaf=_0x22f791[_0x912e('0x59')][_0x912e('0x6a')];return db[_0x912e('0x68')][_0x912e('0x4a')]({'where':{'id':_0x1a3eaf},'attributes':['id'],'include':[{'model':db['User'],'as':_0x912e('0x6b'),'attributes':['id','name','online',_0x912e('0x6c'),_0x912e('0x6d')],'raw':!![]}]})['then'](function(_0x32a6e9){if(_0x32a6e9){var _0xd73036=_['flatMap'](_0x32a6e9,function(_0x19d764){var _0x35b8c5=_0x19d764[_0x912e('0x55')]({'plain':!![]});return _0x35b8c5[_0x912e('0x6b')];});return db[_0x912e('0x35')][_0x912e('0x50')]({'where':{'id':_0x22f791[_0x912e('0x4d')]['id']}})[_0x912e('0x2d')](function(_0x310230){return db[_0x912e('0x6e')][_0x912e('0x6f')](function(_0x1540cf){return _0x310230[_0x912e('0x70')](_0x1a3eaf,{'transaction':_0x1540cf})[_0x912e('0x2d')](function(){return BPromise[_0x912e('0x71')](_0xd73036,function(_0x31fba2){return db['UserFaxQueue'][_0x912e('0x72')]({'where':{'UserId':_0x31fba2['id'],'FaxQueueId':_0x22f791[_0x912e('0x4d')]['id']},'transaction':_0x1540cf});});})[_0x912e('0x2d')](function(){_0xd73036[_0x912e('0x73')](function(_0xe1528e){socket[_0x912e('0x74')]('userFaxQueue:save',{'UserId':_0xe1528e['id'],'FaxQueueId':_0x310230['id']});});});});});}})[_0x912e('0x2d')](respondWithStatusCode(_0x415b8b,null))[_0x912e('0x4c')](handleError(_0x415b8b,null));};exports['removeTeams']=function(_0x3de9a0,_0x3dfbe5,_0x5862f6){return db[_0x912e('0x68')][_0x912e('0x4a')]({'where':{'id':_0x3de9a0['query'][_0x912e('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x912e('0x5e')],'as':_0x912e('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3dfbe5,null))['then'](function(_0x271bdb){var _0xae9d68=_[_0x912e('0x34')](_0x271bdb,'id');var _0x31bb63=[];var _0x1b36ed=[];var _0x5a5899=squel['select']();_0x5a5899[_0x912e('0x75')](_0x912e('0x76'))[_0x912e('0x77')](_0x912e('0x78'),'tq')[_0x912e('0x79')](_0x912e('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x912e('0x43')](_0x912e('0x7b'),_0x3de9a0[_0x912e('0x4d')]['id']);for(var _0x27f8d4=0x0;_0x27f8d4<_0x271bdb[_0x912e('0x3e')];_0x27f8d4+=0x1){let _0x5a5b78=_0x271bdb[_0x27f8d4];for(var _0x510abd=0x0;_0x510abd<_0x5a5b78[_0x912e('0x6b')][_0x912e('0x3e')];_0x510abd+=0x1){let _0x2416a4=_0x5a5b78['Agents'][_0x510abd];var _0x2954c0=_0x5a5899[_0x912e('0x7c')]();_0x2954c0[_0x912e('0x43')](_0x912e('0x7d'),_0x2416a4['id']);_0x1b36ed[_0x912e('0x7e')](db[_0x912e('0x6e')][_0x912e('0x3b')](_0x2954c0[_0x912e('0x7f')](),{'type':db[_0x912e('0x6e')]['QueryTypes'][_0x912e('0x80')]})[_0x912e('0x2d')](function(_0x23cc5d){if(_0x23cc5d['length']===0x1){return _0x2416a4['id'];}else{var _0x320e55=_[_0x912e('0x81')](_[_0x912e('0x34')](_0x23cc5d,_0x912e('0x82')),function(_0x59012f){return _[_0x912e('0x83')](_0xae9d68,_0x59012f);});if(_0x320e55){return _0x2416a4['id'];}}}));}}return BPromise[_0x912e('0x84')](_0x1b36ed)[_0x912e('0x2d')](function(_0x25c38d){_0x31bb63=_(_0x31bb63)[_0x912e('0x85')](_0x25c38d)[_0x912e('0x86')]()[_0x912e('0x87')]();return db['FaxQueue'][_0x912e('0x50')]({'where':{'id':_0x3de9a0[_0x912e('0x4d')]['id']}})[_0x912e('0x2d')](function(_0xe18604){return db['sequelize'][_0x912e('0x6f')](function(_0xb911aa){return _0xe18604[_0x912e('0x88')](_0x3de9a0[_0x912e('0x3b')][_0x912e('0x6a')],{'transaction':_0xb911aa})[_0x912e('0x2d')](function(){if(!_[_0x912e('0x89')](_0x31bb63)){return _0xe18604['removeAgents'](_0x31bb63,{'transaction':_0xb911aa});}})[_0x912e('0x2d')](function(){_0x31bb63['forEach'](function(_0x1f8cce){socket['emit'](_0x912e('0x8a'),{'UserId':_0x1f8cce,'FaxQueueId':_0xe18604['id']});});});});});});})[_0x912e('0x2d')](respondWithStatusCode(_0x3dfbe5,null))[_0x912e('0x4c')](handleError(_0x3dfbe5,null));};exports['addAgents']=function(_0x546255,_0x118c3b,_0x5db559){return db[_0x912e('0x35')][_0x912e('0x50')]({'where':{'id':_0x546255['params']['id']}})[_0x912e('0x2d')](handleEntityNotFound(_0x118c3b,null))[_0x912e('0x2d')](function(_0x33ae4e){if(_0x33ae4e){return _0x33ae4e[_0x912e('0x8b')](_0x546255[_0x912e('0x59')][_0x912e('0x6a')],_['omit'](_0x546255[_0x912e('0x59')],[_0x912e('0x6a'),'id'])||{})[_0x912e('0x8c')](function(_0x2a7189){for(var _0xefdaed=0x0;_0xefdaed<_0x546255[_0x912e('0x59')]['ids'][_0x912e('0x3e')];_0xefdaed+=0x1){socket[_0x912e('0x74')](_0x912e('0x8d'),{'UserId':Number(_0x546255[_0x912e('0x59')][_0x912e('0x6a')][_0xefdaed]),'FaxQueueId':Number(_0x546255[_0x912e('0x4d')]['id'])});}return _0x2a7189;});}})['then'](respondWithResult(_0x118c3b,null))['catch'](handleError(_0x118c3b,null));};exports[_0x912e('0x8e')]=function(_0x206310,_0x12c525,_0x48a509){return db['FaxQueue']['find']({'where':{'id':_0x206310['params']['id']}})[_0x912e('0x2d')](handleEntityNotFound(_0x12c525,null))['then'](function(_0x2b0ef1){if(_0x2b0ef1){return _0x2b0ef1[_0x912e('0x8e')](_0x206310[_0x912e('0x3b')]['ids'])[_0x912e('0x2d')](function(){if(_[_0x912e('0x8f')](_0x206310[_0x912e('0x3b')][_0x912e('0x6a')])){for(var _0x5839a2=0x0;_0x5839a2<_0x206310[_0x912e('0x3b')]['ids']['length'];_0x5839a2+=0x1){socket[_0x912e('0x74')](_0x912e('0x8a'),{'UserId':Number(_0x206310[_0x912e('0x3b')][_0x912e('0x6a')][_0x5839a2]),'FaxQueueId':Number(_0x206310[_0x912e('0x4d')]['id'])});}}else{socket['emit'](_0x912e('0x8a'),{'UserId':Number(_0x206310[_0x912e('0x3b')][_0x912e('0x6a')]),'FaxQueueId':Number(_0x206310[_0x912e('0x4d')]['id'])});}});}})[_0x912e('0x2d')](respondWithStatusCode(_0x12c525,null))[_0x912e('0x4c')](handleError(_0x12c525,null));};exports[_0x912e('0x90')]=function(_0x26d493,_0x29f9d0,_0x2db177){var _0x1bc255={};var _0x4b2d0d={};var _0x1c2bb8;var _0x2db5e8;return db['FaxQueue'][_0x912e('0x5b')]({'where':{'id':_0x26d493[_0x912e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x29f9d0,null))[_0x912e('0x2d')](function(_0x46e5d3){if(_0x46e5d3){_0x1c2bb8=_0x46e5d3;_0x4b2d0d[_0x912e('0x38')]=_[_0x912e('0x4e')](db[_0x912e('0x5e')]['rawAttributes']);_0x4b2d0d[_0x912e('0x3b')]=_[_0x912e('0x4e')](_0x26d493[_0x912e('0x3b')]);_0x4b2d0d['filters']=_[_0x912e('0x3a')](_0x4b2d0d[_0x912e('0x38')],_0x4b2d0d[_0x912e('0x3b')]);_0x1bc255['attributes']=_['intersection'](_0x4b2d0d[_0x912e('0x38')],qs['fields'](_0x26d493['query']['fields']));_0x1bc255['attributes']=_0x1bc255[_0x912e('0x3c')][_0x912e('0x3e')]?_0x1bc255[_0x912e('0x3c')]:_0x4b2d0d['model'];_0x1bc255['order']=qs['sort'](_0x26d493[_0x912e('0x3b')][_0x912e('0x41')]);_0x1bc255['where']=qs['filters'](_[_0x912e('0x5d')](_0x26d493[_0x912e('0x3b')],_0x4b2d0d[_0x912e('0x39')]));if(_0x26d493['query']['filter']){_0x1bc255[_0x912e('0x43')]=_[_0x912e('0x44')](_0x1bc255['where'],{'$or':_['map'](_0x1bc255[_0x912e('0x3c')],function(_0x46d673){var _0x1b6d4c={};_0x1b6d4c[_0x46d673]={'$like':'%'+_0x26d493['query'][_0x912e('0x42')]+'%'};return _0x1b6d4c;})});}_0x1bc255=_[_0x912e('0x44')]({},_0x1bc255,_0x26d493[_0x912e('0x47')]);return _0x1c2bb8[_0x912e('0x90')](_0x1bc255);}})[_0x912e('0x2d')](function(_0x5dcc92){if(_0x5dcc92){_0x2db5e8=_0x5dcc92[_0x912e('0x3e')];if(!_0x26d493[_0x912e('0x3b')][_0x912e('0x3f')](_0x912e('0x69'))){_0x1bc255[_0x912e('0x27')]=qs[_0x912e('0x27')](_0x26d493[_0x912e('0x3b')][_0x912e('0x27')]);_0x1bc255[_0x912e('0x24')]=qs['offset'](_0x26d493[_0x912e('0x3b')]['offset']);}return _0x1c2bb8[_0x912e('0x90')](_0x1bc255);}})[_0x912e('0x2d')](function(_0x1d0ece){if(_0x1d0ece){return _0x1d0ece?{'count':_0x2db5e8,'rows':_0x1d0ece}:null;}})[_0x912e('0x2d')](respondWithResult(_0x29f9d0,null))['catch'](handleError(_0x29f9d0,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 87898d3..fadd1ca 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 _0x0c09=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x373096,_0x4d37aa){var _0x14a6d0=function(_0xb3b614){while(--_0xb3b614){_0x373096['push'](_0x373096['shift']());}};_0x14a6d0(++_0x4d37aa);}(_0x0c09,0xc9));var _0x90c0=function(_0x2ac5ca,_0x52c5eb){_0x2ac5ca=_0x2ac5ca-0x0;var _0x39c4ab=_0x0c09[_0x2ac5ca];return _0x39c4ab;};'use strict';var EventEmitter=require(_0x90c0('0x0'));var FaxQueue=require(_0x90c0('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x90c0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x90c0('0x3'),'afterDestroy':_0x90c0('0x4')};function emitEvent(_0x3dfecc){return function(_0x540460,_0x1c5642,_0xf89b17){FaxQueueEvents[_0x90c0('0x5')](_0x3dfecc+':'+_0x540460['id'],_0x540460);FaxQueueEvents['emit'](_0x3dfecc,_0x540460);_0xf89b17(null);};}for(var e in events){if(events[_0x90c0('0x6')](e)){var event=events[e];FaxQueue[_0x90c0('0x7')](e,emitEvent(event));}}module[_0x90c0('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xb632=['emit','hasOwnProperty','hook','exports','events','FaxQueue','setMaxListeners','update','remove'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0xb632,0xdc));var _0x2b63=function(_0x504ef8,_0x535706){_0x504ef8=_0x504ef8-0x0;var _0x597345=_0xb632[_0x504ef8];return _0x597345;};'use strict';var EventEmitter=require(_0x2b63('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x2b63('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x2b63('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2b63('0x3'),'afterDestroy':_0x2b63('0x4')};function emitEvent(_0x196d30){return function(_0x4d8290,_0x1b16fe,_0xb4e00c){FaxQueueEvents[_0x2b63('0x5')](_0x196d30+':'+_0x4d8290['id'],_0x4d8290);FaxQueueEvents['emit'](_0x196d30,_0x4d8290);_0xb4e00c(null);};}for(var e in events){if(events[_0x2b63('0x6')](e)){var event=events[e];FaxQueue[_0x2b63('0x7')](e,emitEvent(event));}}module[_0x2b63('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 238c219..ef5ba0e 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 _0xbdd1=['FaxQueue','fax_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf','exports'];(function(_0x131018,_0xbb3d89){var _0x4ddb99=function(_0x2a8732){while(--_0x2a8732){_0x131018['push'](_0x131018['shift']());}};_0x4ddb99(++_0xbb3d89);}(_0xbdd1,0xb6));var _0x1bdd=function(_0x378380,_0x31dba0){_0x378380=_0x378380-0x0;var _0x2a4744=_0xbdd1[_0x378380];return _0x2a4744;};'use strict';var _=require(_0x1bdd('0x0'));var util=require(_0x1bdd('0x1'));var logger=require(_0x1bdd('0x2'))(_0x1bdd('0x3'));var moment=require('moment');var BPromise=require(_0x1bdd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1bdd('0x5'));var rimraf=require(_0x1bdd('0x6'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x1bdd('0x7')]=function(_0x2cc4c8,_0x361d26){return _0x2cc4c8['define'](_0x1bdd('0x8'),attributes,{'tableName':_0x1bdd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6550=['../../config/environment','./faxQueue.attributes','FaxQueue','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x584823,_0x20e0da){var _0x4df891=function(_0x4234e4){while(--_0x4234e4){_0x584823['push'](_0x584823['shift']());}};_0x4df891(++_0x20e0da);}(_0x6550,0x1cf));var _0x0655=function(_0x459be5,_0x2da5c5){_0x459be5=_0x459be5-0x0;var _0x239342=_0x6550[_0x459be5];return _0x239342;};'use strict';var _=require('lodash');var util=require(_0x0655('0x0'));var logger=require(_0x0655('0x1'))(_0x0655('0x2'));var moment=require(_0x0655('0x3'));var BPromise=require('bluebird');var rp=require(_0x0655('0x4'));var fs=require('fs');var path=require(_0x0655('0x5'));var rimraf=require(_0x0655('0x6'));var config=require(_0x0655('0x7'));var attributes=require(_0x0655('0x8'));module['exports']=function(_0x3e12f2,_0x45c3a5){return _0x3e12f2['define'](_0x0655('0x9'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index b941a73..5f8a93e 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 _0xc0be=['raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','FaxQueue','findAll','options','where','limit','include','model','attributes','map','GetFaxQueue','ShowFaxQueue','find'];(function(_0x1f1211,_0xc87eff){var _0x29da0f=function(_0x11f1ef){while(--_0x11f1ef){_0x1f1211['push'](_0x1f1211['shift']());}};_0x29da0f(++_0xc87eff);}(_0xc0be,0x109));var _0xec0b=function(_0x37069a,_0x1fff43){_0x37069a=_0x37069a-0x0;var _0x1c050a=_0xc0be[_0x37069a];return _0x1c050a;};'use strict';var _=require('lodash');var util=require(_0xec0b('0x0'));var moment=require(_0xec0b('0x1'));var BPromise=require(_0xec0b('0x2'));var rs=require(_0xec0b('0x3'));var fs=require('fs');var Redis=require(_0xec0b('0x4'));var db=require(_0xec0b('0x5'))['db'];var utils=require(_0xec0b('0x6'));var logger=require(_0xec0b('0x7'))(_0xec0b('0x8'));var config=require(_0xec0b('0x9'));var jayson=require(_0xec0b('0xa'));var client=jayson[_0xec0b('0xb')][_0xec0b('0xc')]({'port':0x232a});config['redis']=_[_0xec0b('0xd')](config[_0xec0b('0xe')],{'host':_0xec0b('0xf'),'port':0x18eb});var socket=require(_0xec0b('0x10'))(new Redis(config[_0xec0b('0xe')]));require(_0xec0b('0x11'))[_0xec0b('0x12')](socket);function respondWithRpcPromise(_0x3ded84,_0x246795,_0x441995){return new BPromise(function(_0x4b5d0b,_0x32ab23){return client[_0xec0b('0x13')](_0x3ded84,_0x441995)[_0xec0b('0x14')](function(_0x4e6309){logger[_0xec0b('0x15')](_0xec0b('0x16'),_0x246795,'request\x20sent');logger[_0xec0b('0x17')](_0xec0b('0x18'),_0x246795,_0xec0b('0x19'),JSON[_0xec0b('0x1a')](_0x4e6309));if(_0x4e6309[_0xec0b('0x1b')]){if(_0x4e6309[_0xec0b('0x1b')][_0xec0b('0x1c')]===0x1f4){logger[_0xec0b('0x1b')]('FaxQueue,\x20%s,\x20%s',_0x246795,_0x4e6309['error'][_0xec0b('0x1d')]);return _0x32ab23(_0x4e6309[_0xec0b('0x1b')][_0xec0b('0x1d')]);}logger['error'](_0xec0b('0x16'),_0x246795,_0x4e6309[_0xec0b('0x1b')][_0xec0b('0x1d')]);return _0x4b5d0b(_0x4e6309[_0xec0b('0x1b')]['message']);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x246795,_0xec0b('0x19'));_0x4b5d0b(_0x4e6309['result'][_0xec0b('0x1d')]);}})[_0xec0b('0x1e')](function(_0x5b131e){logger[_0xec0b('0x1b')]('FaxQueue,\x20%s,\x20%s',_0x246795,_0x5b131e);_0x32ab23(_0x5b131e);});});}exports['GetFaxQueue']=function(_0x43b305){var _0x106ced=this;return new Promise(function(_0x47cf3b,_0x17d6ce){return db[_0xec0b('0x1f')][_0xec0b('0x20')]({'raw':_0x43b305[_0xec0b('0x21')]?_0x43b305['options']['raw']===undefined?!![]:![]:!![],'where':_0x43b305[_0xec0b('0x21')]?_0x43b305[_0xec0b('0x21')][_0xec0b('0x22')]||null:null,'attributes':_0x43b305[_0xec0b('0x21')]?_0x43b305['options']['attributes']||null:null,'limit':_0x43b305[_0xec0b('0x21')]?_0x43b305[_0xec0b('0x21')][_0xec0b('0x23')]||null:null,'include':_0x43b305['options']?_0x43b305[_0xec0b('0x21')][_0xec0b('0x24')]?_['map'](_0x43b305[_0xec0b('0x21')][_0xec0b('0x24')],function(_0xf1a757){return{'model':db[_0xf1a757[_0xec0b('0x25')]],'as':_0xf1a757['as'],'attributes':_0xf1a757[_0xec0b('0x26')],'include':_0xf1a757[_0xec0b('0x24')]?_[_0xec0b('0x27')](_0xf1a757[_0xec0b('0x24')],function(_0xc04bc9){return{'model':db[_0xc04bc9[_0xec0b('0x25')]],'as':_0xc04bc9['as'],'attributes':_0xc04bc9[_0xec0b('0x26')],'include':_0xc04bc9[_0xec0b('0x24')]?_['map'](_0xc04bc9['include'],function(_0x28022a){return{'model':db[_0x28022a['model']],'as':_0x28022a['as'],'attributes':_0x28022a[_0xec0b('0x26')]};}):[]};}):[]};}):[]:[]})[_0xec0b('0x14')](function(_0x170d7b){logger['info']('GetFaxQueue',_0x43b305);logger[_0xec0b('0x17')](_0xec0b('0x28'),_0x43b305,JSON[_0xec0b('0x1a')](_0x170d7b));_0x47cf3b(_0x170d7b);})[_0xec0b('0x1e')](function(_0x512d6f){logger['error']('GetFaxQueue',_0x512d6f['message'],_0x43b305);_0x17d6ce(_0x106ced[_0xec0b('0x1b')](0x1f4,_0x512d6f['message']));});});};exports[_0xec0b('0x29')]=function(_0x30d183){var _0x37589e=this;return new Promise(function(_0x414a0d,_0x59fb88){return db[_0xec0b('0x1f')][_0xec0b('0x2a')]({'raw':_0x30d183[_0xec0b('0x21')]?_0x30d183[_0xec0b('0x21')][_0xec0b('0x2b')]===undefined?!![]:![]:!![],'where':_0x30d183[_0xec0b('0x21')]?_0x30d183[_0xec0b('0x21')][_0xec0b('0x22')]||null:null,'attributes':_0x30d183[_0xec0b('0x21')]?_0x30d183['options'][_0xec0b('0x26')]||null:null,'include':_0x30d183['options']?_0x30d183[_0xec0b('0x21')][_0xec0b('0x24')]?_[_0xec0b('0x27')](_0x30d183[_0xec0b('0x21')][_0xec0b('0x24')],function(_0x11c52f){return{'model':db[_0x11c52f[_0xec0b('0x25')]],'as':_0x11c52f['as'],'attributes':_0x11c52f[_0xec0b('0x26')],'include':_0x11c52f[_0xec0b('0x24')]?_[_0xec0b('0x27')](_0x11c52f['include'],function(_0x244e5d){return{'model':db[_0x244e5d[_0xec0b('0x25')]],'as':_0x244e5d['as'],'attributes':_0x244e5d[_0xec0b('0x26')],'include':_0x244e5d[_0xec0b('0x24')]?_[_0xec0b('0x27')](_0x244e5d['include'],function(_0x4ce7e0){return{'model':db[_0x4ce7e0[_0xec0b('0x25')]],'as':_0x4ce7e0['as'],'attributes':_0x4ce7e0[_0xec0b('0x26')]};}):[]};}):[]};}):[]:[]})[_0xec0b('0x14')](function(_0x31a209){logger[_0xec0b('0x15')](_0xec0b('0x29'),_0x30d183);logger['debug'](_0xec0b('0x29'),_0x30d183,JSON['stringify'](_0x31a209));_0x414a0d(_0x31a209);})[_0xec0b('0x1e')](function(_0x53b714){logger[_0xec0b('0x1b')]('ShowFaxQueue',_0x53b714[_0xec0b('0x1d')],_0x30d183);_0x59fb88(_0x37589e[_0xec0b('0x1b')](0x1f4,_0x53b714[_0xec0b('0x1d')]));});});}; \ No newline at end of file +var _0x2af2=['request\x20sent','stringify','error','message','info','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowFaxQueue','find','debug','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s'];(function(_0x1fd842,_0x44c9db){var _0x16f894=function(_0x4e33fb){while(--_0x4e33fb){_0x1fd842['push'](_0x1fd842['shift']());}};_0x16f894(++_0x44c9db);}(_0x2af2,0xdc));var _0x22af=function(_0x5b7838,_0x25e81d){_0x5b7838=_0x5b7838-0x0;var _0x2817a3=_0x2af2[_0x5b7838];return _0x2817a3;};'use strict';var _=require(_0x22af('0x0'));var util=require(_0x22af('0x1'));var moment=require(_0x22af('0x2'));var BPromise=require(_0x22af('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22af('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x22af('0x5'));var logger=require('../../config/logger')(_0x22af('0x6'));var config=require(_0x22af('0x7'));var jayson=require(_0x22af('0x8'));var client=jayson[_0x22af('0x9')][_0x22af('0xa')]({'port':0x232a});config['redis']=_[_0x22af('0xb')](config[_0x22af('0xc')],{'host':_0x22af('0xd'),'port':0x18eb});var socket=require(_0x22af('0xe'))(new Redis(config[_0x22af('0xc')]));require(_0x22af('0xf'))[_0x22af('0x10')](socket);function respondWithRpcPromise(_0x264d74,_0x1aea58,_0x56008c){return new BPromise(function(_0x318d6b,_0x4ef3f8){return client[_0x22af('0x11')](_0x264d74,_0x56008c)[_0x22af('0x12')](function(_0x1864b3){logger['info'](_0x22af('0x13'),_0x1aea58,_0x22af('0x14'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x1aea58,_0x22af('0x14'),JSON[_0x22af('0x15')](_0x1864b3));if(_0x1864b3[_0x22af('0x16')]){if(_0x1864b3[_0x22af('0x16')]['code']===0x1f4){logger[_0x22af('0x16')](_0x22af('0x13'),_0x1aea58,_0x1864b3[_0x22af('0x16')][_0x22af('0x17')]);return _0x4ef3f8(_0x1864b3[_0x22af('0x16')][_0x22af('0x17')]);}logger['error'](_0x22af('0x13'),_0x1aea58,_0x1864b3[_0x22af('0x16')]['message']);return _0x318d6b(_0x1864b3[_0x22af('0x16')][_0x22af('0x17')]);}else{logger[_0x22af('0x18')](_0x22af('0x13'),_0x1aea58,'request\x20sent');_0x318d6b(_0x1864b3['result'][_0x22af('0x17')]);}})[_0x22af('0x19')](function(_0x12b49e){logger['error'](_0x22af('0x13'),_0x1aea58,_0x12b49e);_0x4ef3f8(_0x12b49e);});});}exports[_0x22af('0x1a')]=function(_0x4d8e62){var _0x18fe37=this;return new Promise(function(_0x3e9b4c,_0x1b54fb){return db[_0x22af('0x1b')][_0x22af('0x1c')]({'raw':_0x4d8e62[_0x22af('0x1d')]?_0x4d8e62[_0x22af('0x1d')][_0x22af('0x1e')]===undefined?!![]:![]:!![],'where':_0x4d8e62['options']?_0x4d8e62[_0x22af('0x1d')][_0x22af('0x1f')]||null:null,'attributes':_0x4d8e62[_0x22af('0x1d')]?_0x4d8e62[_0x22af('0x1d')]['attributes']||null:null,'limit':_0x4d8e62[_0x22af('0x1d')]?_0x4d8e62['options'][_0x22af('0x20')]||null:null,'include':_0x4d8e62[_0x22af('0x1d')]?_0x4d8e62[_0x22af('0x1d')][_0x22af('0x21')]?_['map'](_0x4d8e62['options']['include'],function(_0x51ff80){return{'model':db[_0x51ff80['model']],'as':_0x51ff80['as'],'attributes':_0x51ff80['attributes'],'include':_0x51ff80[_0x22af('0x21')]?_[_0x22af('0x22')](_0x51ff80[_0x22af('0x21')],function(_0x128de4){return{'model':db[_0x128de4[_0x22af('0x23')]],'as':_0x128de4['as'],'attributes':_0x128de4[_0x22af('0x24')],'include':_0x128de4['include']?_[_0x22af('0x22')](_0x128de4['include'],function(_0x443190){return{'model':db[_0x443190[_0x22af('0x23')]],'as':_0x443190['as'],'attributes':_0x443190[_0x22af('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b60ae){logger[_0x22af('0x18')](_0x22af('0x1a'),_0x4d8e62);logger['debug'](_0x22af('0x1a'),_0x4d8e62,JSON[_0x22af('0x15')](_0x1b60ae));_0x3e9b4c(_0x1b60ae);})[_0x22af('0x19')](function(_0x2b0bde){logger[_0x22af('0x16')]('GetFaxQueue',_0x2b0bde[_0x22af('0x17')],_0x4d8e62);_0x1b54fb(_0x18fe37[_0x22af('0x16')](0x1f4,_0x2b0bde['message']));});});};exports[_0x22af('0x25')]=function(_0x17af5d){var _0x1e1c9b=this;return new Promise(function(_0x25f2e3,_0x48372c){return db[_0x22af('0x1b')][_0x22af('0x26')]({'raw':_0x17af5d['options']?_0x17af5d[_0x22af('0x1d')][_0x22af('0x1e')]===undefined?!![]:![]:!![],'where':_0x17af5d[_0x22af('0x1d')]?_0x17af5d[_0x22af('0x1d')][_0x22af('0x1f')]||null:null,'attributes':_0x17af5d[_0x22af('0x1d')]?_0x17af5d[_0x22af('0x1d')][_0x22af('0x24')]||null:null,'include':_0x17af5d[_0x22af('0x1d')]?_0x17af5d['options'][_0x22af('0x21')]?_['map'](_0x17af5d['options'][_0x22af('0x21')],function(_0x8ef9b3){return{'model':db[_0x8ef9b3[_0x22af('0x23')]],'as':_0x8ef9b3['as'],'attributes':_0x8ef9b3[_0x22af('0x24')],'include':_0x8ef9b3[_0x22af('0x21')]?_['map'](_0x8ef9b3['include'],function(_0x32f525){return{'model':db[_0x32f525[_0x22af('0x23')]],'as':_0x32f525['as'],'attributes':_0x32f525[_0x22af('0x24')],'include':_0x32f525[_0x22af('0x21')]?_[_0x22af('0x22')](_0x32f525[_0x22af('0x21')],function(_0x310901){return{'model':db[_0x310901['model']],'as':_0x310901['as'],'attributes':_0x310901[_0x22af('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43e4e7){logger[_0x22af('0x18')]('ShowFaxQueue',_0x17af5d);logger[_0x22af('0x27')]('ShowFaxQueue',_0x17af5d,JSON[_0x22af('0x15')](_0x43e4e7));_0x25f2e3(_0x43e4e7);})[_0x22af('0x19')](function(_0x3245d8){logger[_0x22af('0x16')](_0x22af('0x25'),_0x3245d8[_0x22af('0x17')],_0x17af5d);_0x48372c(_0x1e1c9b[_0x22af('0x16')](0x1f4,_0x3245d8[_0x22af('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 6a51918..f3399dd 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 _0x5d7d=['update','emit','register','./faxQueue.events','save'];(function(_0x3f24bd,_0x4c8a74){var _0x24f64d=function(_0x159469){while(--_0x159469){_0x3f24bd['push'](_0x3f24bd['shift']());}};_0x24f64d(++_0x4c8a74);}(_0x5d7d,0xc6));var _0xd5d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d7d[_0x3dd15e];return _0x231fd0;};'use strict';var FaxQueueEvents=require(_0xd5d7('0x0'));var events=[_0xd5d7('0x1'),'remove',_0xd5d7('0x2')];function createListener(_0x26eadd,_0x3cf0e6){return function(_0x15456e){_0x3cf0e6[_0xd5d7('0x3')](_0x26eadd,_0x15456e);};}function removeListener(_0x4f02a1,_0x11f7f7){return function(){FaxQueueEvents['removeListener'](_0x4f02a1,_0x11f7f7);};}exports[_0xd5d7('0x4')]=function(_0x29c89a){for(var _0x14ce0f=0x0,_0x551fc6=events['length'];_0x14ce0f<_0x551fc6;_0x14ce0f++){var _0x10c1cb=events[_0x14ce0f];var _0x356e2b=createListener('faxQueue:'+_0x10c1cb,_0x29c89a);FaxQueueEvents['on'](_0x10c1cb,_0x356e2b);}}; \ No newline at end of file +var _0xd6d7=['./faxQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x26bcec,_0xe13f50){var _0x1049dc=function(_0x4c0d9b){while(--_0x4c0d9b){_0x26bcec['push'](_0x26bcec['shift']());}};_0x1049dc(++_0xe13f50);}(_0xd6d7,0x70));var _0x7d6d=function(_0x5c490c,_0x17cc06){_0x5c490c=_0x5c490c-0x0;var _0x344996=_0xd6d7[_0x5c490c];return _0x344996;};'use strict';var FaxQueueEvents=require(_0x7d6d('0x0'));var events=[_0x7d6d('0x1'),_0x7d6d('0x2'),_0x7d6d('0x3')];function createListener(_0x1b080e,_0x2804c9){return function(_0x3aab4a){_0x2804c9[_0x7d6d('0x4')](_0x1b080e,_0x3aab4a);};}function removeListener(_0x194fb9,_0x393ef0){return function(){FaxQueueEvents[_0x7d6d('0x5')](_0x194fb9,_0x393ef0);};}exports[_0x7d6d('0x6')]=function(_0x11b276){for(var _0x3c4a85=0x0,_0xda917e=events[_0x7d6d('0x7')];_0x3c4a85<_0xda917e;_0x3c4a85++){var _0x4ef787=events[_0x3c4a85];var _0x255d96=createListener('faxQueue:'+_0x4ef787,_0x11b276);FaxQueueEvents['on'](_0x4ef787,_0x255d96);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 76749f8..8ebafb8 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 _0xee3c=['./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','put','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xee3c,0x14a));var _0xcee3=function(_0x390b59,_0x5d9b29){_0x390b59=_0x390b59-0x0;var _0x44d2b0=_0xee3c[_0x390b59];return _0x44d2b0;};'use strict';var multer=require(_0xcee3('0x0'));var util=require(_0xcee3('0x1'));var path=require(_0xcee3('0x2'));var timeout=require(_0xcee3('0x3'));var express=require(_0xcee3('0x4'));var router=express[_0xcee3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcee3('0x6'));var config=require(_0xcee3('0x7'));var controller=require(_0xcee3('0x8'));router[_0xcee3('0x9')]('/',auth[_0xcee3('0xa')](),controller[_0xcee3('0xb')]);router[_0xcee3('0x9')](_0xcee3('0xc'),auth[_0xcee3('0xa')](),controller[_0xcee3('0xd')]);router[_0xcee3('0x9')](_0xcee3('0xe'),auth[_0xcee3('0xa')](),controller[_0xcee3('0xf')]);router[_0xcee3('0x9')]('/:id/members',auth[_0xcee3('0xa')](),controller[_0xcee3('0x10')]);router[_0xcee3('0x9')](_0xcee3('0x11'),auth[_0xcee3('0xa')](),controller[_0xcee3('0x12')]);router['get'](_0xcee3('0x13'),auth[_0xcee3('0xa')](),controller[_0xcee3('0x14')]);router[_0xcee3('0x15')]('/',auth[_0xcee3('0xa')](),controller['create']);router[_0xcee3('0x15')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0xcee3('0x15')](_0xcee3('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0xcee3('0x16')]('/:id',auth[_0xcee3('0xa')](),controller['update']);router[_0xcee3('0x17')](_0xcee3('0xe'),auth['isAuthenticated'](),controller[_0xcee3('0x18')]);router[_0xcee3('0x17')](_0xcee3('0x11'),auth[_0xcee3('0xa')](),controller['removeTeams']);router[_0xcee3('0x17')](_0xcee3('0x13'),auth[_0xcee3('0xa')](),controller[_0xcee3('0x19')]);module['exports']=router; \ No newline at end of file +var _0xed1c=['/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','getTeams'];(function(_0x19e128,_0x54764d){var _0x2c27a7=function(_0x59f66c){while(--_0x59f66c){_0x19e128['push'](_0x19e128['shift']());}};_0x2c27a7(++_0x54764d);}(_0xed1c,0xe4));var _0xced1=function(_0x4808ee,_0x5e1d72){_0x4808ee=_0x4808ee-0x0;var _0x23ed56=_0xed1c[_0x4808ee];return _0x23ed56;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xced1('0x2'));var auth=require(_0xced1('0x3'));var interaction=require(_0xced1('0x4'));var config=require('../../config/environment');var controller=require(_0xced1('0x5'));router[_0xced1('0x6')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x8')]);router['get'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xa')]);router[_0xced1('0x6')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xc')]);router[_0xced1('0x6')]('/:id/members',auth[_0xced1('0x7')](),controller['getMembers']);router[_0xced1('0x6')](_0xced1('0xd'),auth[_0xced1('0x7')](),controller[_0xced1('0xe')]);router[_0xced1('0x6')](_0xced1('0xf'),auth[_0xced1('0x7')](),controller['getAgents']);router[_0xced1('0x10')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x11')]);router[_0xced1('0x10')]('/:id/teams',auth[_0xced1('0x7')](),controller[_0xced1('0x12')]);router['post'](_0xced1('0xf'),auth[_0xced1('0x7')](),controller[_0xced1('0x13')]);router[_0xced1('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xced1('0x15')]);router[_0xced1('0x16')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0x17')]);router[_0xced1('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0xced1('0x18')]);router[_0xced1('0x16')](_0xced1('0xf'),auth['isAuthenticated'](),controller[_0xced1('0x19')]);module[_0xced1('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 912e698..3ab2fbd 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 _0x03dc=['DATE','moment','sequelize','STRING'];(function(_0x329664,_0x130748){var _0x4e346e=function(_0x172b0d){while(--_0x172b0d){_0x329664['push'](_0x329664['shift']());}};_0x4e346e(++_0x130748);}(_0x03dc,0x85));var _0xc03d=function(_0x469d4d,_0x5892c6){_0x469d4d=_0x469d4d-0x0;var _0x158e96=_0x03dc[_0x469d4d];return _0x158e96;};'use strict';var moment=require(_0xc03d('0x0'));var Sequelize=require(_0xc03d('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc03d('0x2')]},'joinAt':{'type':Sequelize[_0xc03d('0x3')]},'leaveAt':{'type':Sequelize[_0xc03d('0x3')]},'acceptAt':{'type':Sequelize[_0xc03d('0x3')]},'exitAt':{'type':Sequelize[_0xc03d('0x3')]},'reason':{'type':Sequelize[_0xc03d('0x2')]}}; \ No newline at end of file +var _0x4139=['sequelize','exports','STRING','DATE'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x4139,0x140));var _0x9413=function(_0x74aabb,_0x1e8757){_0x74aabb=_0x74aabb-0x0;var _0x48fd8e=_0x4139[_0x74aabb];return _0x48fd8e;};'use strict';var moment=require('moment');var Sequelize=require(_0x9413('0x0'));module[_0x9413('0x1')]={'uniqueid':{'type':Sequelize[_0x9413('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9413('0x2')]},'joinAt':{'type':Sequelize[_0x9413('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9413('0x3')]},'exitAt':{'type':Sequelize[_0x9413('0x3')]},'reason':{'type':Sequelize[_0x9413('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 4be790d..4e68cfa 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 _0x4bc3=['catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','destroy','then','sendStatus','stack','name','send','FaxQueueReport','rawAttributes','fieldName','type','key','map','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x4bc3,0x16e));var _0x34bc=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x4bc3[_0x46698a];return _0x356db0;};'use strict';var emlformat=require(_0x34bc('0x0'));var rimraf=require(_0x34bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x34bc('0x2'));var rp=require(_0x34bc('0x3'));var moment=require('moment');var BPromise=require(_0x34bc('0x4'));var Mustache=require(_0x34bc('0x5'));var util=require(_0x34bc('0x6'));var path=require(_0x34bc('0x7'));var sox=require(_0x34bc('0x8'));var csv=require(_0x34bc('0x9'));var ejs=require(_0x34bc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34bc('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x34bc('0xc'));var deskjs=require(_0x34bc('0xd'));var toCsv=require(_0x34bc('0x9'));var querystring=require(_0x34bc('0xe'));var Papa=require(_0x34bc('0xf'));var Redis=require(_0x34bc('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x34bc('0x11'));var hardwareService=require(_0x34bc('0x12'));var logger=require(_0x34bc('0x13'))('api');var utils=require(_0x34bc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x34bc('0x15'));var db=require(_0x34bc('0x16'))['db'];function respondWithStatusCode(_0x164fb2,_0x536ebd){_0x536ebd=_0x536ebd||0xcc;return function(_0x3f8852){if(_0x3f8852){return _0x164fb2['sendStatus'](_0x536ebd);}return _0x164fb2[_0x34bc('0x17')](_0x536ebd)[_0x34bc('0x18')]();};}function respondWithResult(_0xc77013,_0x5a22a3){_0x5a22a3=_0x5a22a3||0xc8;return function(_0x4c365a){if(_0x4c365a){return _0xc77013[_0x34bc('0x17')](_0x5a22a3)['json'](_0x4c365a);}};}function respondWithFilteredResult(_0x3e93bf,_0x217605){return function(_0x1da8eb){if(_0x1da8eb){var _0x25da29=typeof _0x217605[_0x34bc('0x19')]===_0x34bc('0x1a')&&typeof _0x217605['limit']==='undefined';var _0x5a5895=_0x1da8eb[_0x34bc('0x1b')];var _0x3eaedf=_0x25da29?0x0:_0x217605[_0x34bc('0x19')];var _0x239e6c=_0x25da29?_0x1da8eb['count']:_0x217605[_0x34bc('0x19')]+_0x217605[_0x34bc('0x1c')];var _0x50106a;if(_0x239e6c>=_0x5a5895){_0x239e6c=_0x5a5895;_0x50106a=0xc8;}else{_0x50106a=0xce;}_0x3e93bf[_0x34bc('0x17')](_0x50106a);return _0x3e93bf[_0x34bc('0x1d')]('Content-Range',_0x3eaedf+'-'+_0x239e6c+'/'+_0x5a5895)[_0x34bc('0x1e')](_0x1da8eb);}return null;};}function patchUpdates(_0x26cdec){return function(_0x2d18ea){try{jsonpatch[_0x34bc('0x1f')](_0x2d18ea,_0x26cdec,!![]);}catch(_0x1f993b){return BPromise[_0x34bc('0x20')](_0x1f993b);}return _0x2d18ea['save']();};}function saveUpdates(_0x40e128,_0x3c9939){return function(_0x38882c){if(_0x38882c){return _0x38882c['update'](_0x40e128)['then'](function(_0x358d51){return _0x358d51;});}return null;};}function removeEntity(_0x1b820a,_0x4263de){return function(_0x410800){if(_0x410800){return _0x410800[_0x34bc('0x21')]()[_0x34bc('0x22')](function(){_0x1b820a[_0x34bc('0x17')](0xcc)[_0x34bc('0x18')]();});}};}function handleEntityNotFound(_0x19472e,_0x25d6fe){return function(_0x2de017){if(!_0x2de017){_0x19472e[_0x34bc('0x23')](0x194);}return _0x2de017;};}function handleError(_0x4fd589,_0x43e527){_0x43e527=_0x43e527||0x1f4;return function(_0x48ec13){logger['error'](_0x48ec13[_0x34bc('0x24')]);if(_0x48ec13['name']){delete _0x48ec13[_0x34bc('0x25')];}_0x4fd589[_0x34bc('0x17')](_0x43e527)[_0x34bc('0x26')](_0x48ec13);};}exports['index']=function(_0x2e6d96,_0x351ed8){var _0x384fd7={},_0x1a83f7={},_0x2bb874={'count':0x0,'rows':[]};var _0x33bf46=_['map'](db[_0x34bc('0x27')][_0x34bc('0x28')],function(_0x22aacc){return{'name':_0x22aacc[_0x34bc('0x29')],'type':_0x22aacc[_0x34bc('0x2a')][_0x34bc('0x2b')]};});_0x1a83f7['model']=_[_0x34bc('0x2c')](_0x33bf46,'name');_0x1a83f7['query']=_[_0x34bc('0x2d')](_0x2e6d96['query']);_0x1a83f7[_0x34bc('0x2e')]=_[_0x34bc('0x2f')](_0x1a83f7[_0x34bc('0x30')],_0x1a83f7[_0x34bc('0x31')]);_0x384fd7[_0x34bc('0x32')]=_[_0x34bc('0x2f')](_0x1a83f7[_0x34bc('0x30')],qs['fields'](_0x2e6d96[_0x34bc('0x31')][_0x34bc('0x33')]));_0x384fd7[_0x34bc('0x32')]=_0x384fd7[_0x34bc('0x32')][_0x34bc('0x34')]?_0x384fd7['attributes']:_0x1a83f7[_0x34bc('0x30')];if(!_0x2e6d96[_0x34bc('0x31')][_0x34bc('0x35')](_0x34bc('0x36'))){_0x384fd7[_0x34bc('0x1c')]=qs['limit'](_0x2e6d96['query'][_0x34bc('0x1c')]);_0x384fd7[_0x34bc('0x19')]=qs[_0x34bc('0x19')](_0x2e6d96[_0x34bc('0x31')]['offset']);}_0x384fd7[_0x34bc('0x37')]=qs[_0x34bc('0x38')](_0x2e6d96[_0x34bc('0x31')]['sort']);_0x384fd7[_0x34bc('0x39')]=qs[_0x34bc('0x2e')](_[_0x34bc('0x3a')](_0x2e6d96[_0x34bc('0x31')],_0x1a83f7['filters']),_0x33bf46);if(_0x2e6d96[_0x34bc('0x31')][_0x34bc('0x3b')]){_0x384fd7[_0x34bc('0x39')]=_['merge'](_0x384fd7[_0x34bc('0x39')],{'$or':_[_0x34bc('0x2c')](_0x33bf46,function(_0x71d6bb){if(_0x71d6bb[_0x34bc('0x2a')]!==_0x34bc('0x3c')){var _0x4fc2dc={};_0x4fc2dc[_0x71d6bb[_0x34bc('0x25')]]={'$like':'%'+_0x2e6d96[_0x34bc('0x31')][_0x34bc('0x3b')]+'%'};return _0x4fc2dc;}})});}_0x384fd7=_[_0x34bc('0x3d')]({},_0x384fd7,_0x2e6d96[_0x34bc('0x3e')]);var _0x4bf331={'where':_0x384fd7[_0x34bc('0x39')]};return db['FaxQueueReport'][_0x34bc('0x1b')](_0x4bf331)[_0x34bc('0x22')](function(_0xfaa92d){_0x2bb874[_0x34bc('0x1b')]=_0xfaa92d;if(_0x2e6d96['query'][_0x34bc('0x3f')]){_0x384fd7[_0x34bc('0x40')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x34bc('0x41')](_0x384fd7);})[_0x34bc('0x22')](function(_0xa2cbd0){_0x2bb874['rows']=_0xa2cbd0;return _0x2bb874;})[_0x34bc('0x22')](respondWithFilteredResult(_0x351ed8,_0x384fd7))[_0x34bc('0x42')](handleError(_0x351ed8,null));};exports[_0x34bc('0x43')]=function(_0x3444ea,_0xacada7){var _0x20debf={'raw':!![],'where':{'id':_0x3444ea[_0x34bc('0x44')]['id']}},_0x428326={};_0x428326[_0x34bc('0x30')]=_[_0x34bc('0x2d')](db[_0x34bc('0x27')]['rawAttributes']);_0x428326['query']=_[_0x34bc('0x2d')](_0x3444ea[_0x34bc('0x31')]);_0x428326[_0x34bc('0x2e')]=_[_0x34bc('0x2f')](_0x428326[_0x34bc('0x30')],_0x428326[_0x34bc('0x31')]);_0x20debf['attributes']=_[_0x34bc('0x2f')](_0x428326['model'],qs[_0x34bc('0x33')](_0x3444ea[_0x34bc('0x31')][_0x34bc('0x33')]));_0x20debf['attributes']=_0x20debf[_0x34bc('0x32')][_0x34bc('0x34')]?_0x20debf[_0x34bc('0x32')]:_0x428326[_0x34bc('0x30')];if(_0x3444ea[_0x34bc('0x31')][_0x34bc('0x3f')]){_0x20debf[_0x34bc('0x40')]=[{'all':!![]}];}_0x20debf=_[_0x34bc('0x3d')]({},_0x20debf,_0x3444ea[_0x34bc('0x3e')]);return db[_0x34bc('0x27')][_0x34bc('0x45')](_0x20debf)[_0x34bc('0x22')](handleEntityNotFound(_0xacada7,null))['then'](respondWithResult(_0xacada7,null))['catch'](handleError(_0xacada7,null));};exports[_0x34bc('0x46')]=function(_0x14bda4,_0x180a51){return db['FaxQueueReport']['create'](_0x14bda4[_0x34bc('0x47')],{})[_0x34bc('0x22')](respondWithResult(_0x180a51,0xc9))[_0x34bc('0x42')](handleError(_0x180a51,null));};exports['update']=function(_0x43bfb7,_0x25b02e){if(_0x43bfb7['body']['id']){delete _0x43bfb7[_0x34bc('0x47')]['id'];}return db['FaxQueueReport'][_0x34bc('0x45')]({'where':{'id':_0x43bfb7['params']['id']}})[_0x34bc('0x22')](handleEntityNotFound(_0x25b02e,null))[_0x34bc('0x22')](saveUpdates(_0x43bfb7[_0x34bc('0x47')],null))[_0x34bc('0x22')](respondWithResult(_0x25b02e,null))['catch'](handleError(_0x25b02e,null));};exports[_0x34bc('0x21')]=function(_0x2bbd0b,_0x103bd1){return db[_0x34bc('0x27')][_0x34bc('0x45')]({'where':{'id':_0x2bbd0b[_0x34bc('0x44')]['id']}})[_0x34bc('0x22')](handleEntityNotFound(_0x103bd1,null))[_0x34bc('0x22')](removeEntity(_0x103bd1,null))['catch'](handleError(_0x103bd1,null));};exports['describe']=function(_0x561ee8,_0x3a66b4){return db[_0x34bc('0x27')]['describe']()[_0x34bc('0x22')](respondWithResult(_0x3a66b4,null))[_0x34bc('0x42')](handleError(_0x3a66b4,null));}; \ No newline at end of file +var _0x4584=['params','includeAll','create','body','find','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','include','findAll','rows','catch','show'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x4584,0x1cf));var _0x4458=function(_0x10d52b,_0xc6a4f1){_0x10d52b=_0x10d52b-0x0;var _0x2bf44a=_0x4584[_0x10d52b];return _0x2bf44a;};'use strict';var emlformat=require(_0x4458('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4458('0x1'));var jsonpatch=require(_0x4458('0x2'));var rp=require(_0x4458('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4458('0x4'));var util=require(_0x4458('0x5'));var path=require(_0x4458('0x6'));var sox=require(_0x4458('0x7'));var csv=require(_0x4458('0x8'));var ejs=require(_0x4458('0x9'));var fs=require('fs');var fs_extra=require(_0x4458('0xa'));var _=require(_0x4458('0xb'));var squel=require(_0x4458('0xc'));var crypto=require('crypto');var jsforce=require(_0x4458('0xd'));var deskjs=require(_0x4458('0xe'));var toCsv=require(_0x4458('0x8'));var querystring=require(_0x4458('0xf'));var Papa=require(_0x4458('0x10'));var Redis=require(_0x4458('0x11'));var authService=require(_0x4458('0x12'));var qs=require(_0x4458('0x13'));var as=require(_0x4458('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4458('0x15'))(_0x4458('0x16'));var utils=require(_0x4458('0x17'));var config=require(_0x4458('0x18'));var licenseUtil=require(_0x4458('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x302552,_0x527809){_0x527809=_0x527809||0xcc;return function(_0x1f13ab){if(_0x1f13ab){return _0x302552['sendStatus'](_0x527809);}return _0x302552[_0x4458('0x1a')](_0x527809)[_0x4458('0x1b')]();};}function respondWithResult(_0x4abaf9,_0x5e2f05){_0x5e2f05=_0x5e2f05||0xc8;return function(_0x42771e){if(_0x42771e){return _0x4abaf9[_0x4458('0x1a')](_0x5e2f05)[_0x4458('0x1c')](_0x42771e);}};}function respondWithFilteredResult(_0x2619ed,_0x30d440){return function(_0x21ff11){if(_0x21ff11){var _0x225679=typeof _0x30d440[_0x4458('0x1d')]==='undefined'&&typeof _0x30d440[_0x4458('0x1e')]==='undefined';var _0x3bb7f4=_0x21ff11[_0x4458('0x1f')];var _0x130d39=_0x225679?0x0:_0x30d440['offset'];var _0x319247=_0x225679?_0x21ff11[_0x4458('0x1f')]:_0x30d440[_0x4458('0x1d')]+_0x30d440[_0x4458('0x1e')];var _0x463809;if(_0x319247>=_0x3bb7f4){_0x319247=_0x3bb7f4;_0x463809=0xc8;}else{_0x463809=0xce;}_0x2619ed[_0x4458('0x1a')](_0x463809);return _0x2619ed[_0x4458('0x20')](_0x4458('0x21'),_0x130d39+'-'+_0x319247+'/'+_0x3bb7f4)[_0x4458('0x1c')](_0x21ff11);}return null;};}function patchUpdates(_0x2dfcf1){return function(_0x531ab6){try{jsonpatch[_0x4458('0x22')](_0x531ab6,_0x2dfcf1,!![]);}catch(_0x24ecd1){return BPromise[_0x4458('0x23')](_0x24ecd1);}return _0x531ab6['save']();};}function saveUpdates(_0xe09a2b,_0x1688f2){return function(_0x58aeca){if(_0x58aeca){return _0x58aeca[_0x4458('0x24')](_0xe09a2b)[_0x4458('0x25')](function(_0x5d3df2){return _0x5d3df2;});}return null;};}function removeEntity(_0xcf668c,_0x17e482){return function(_0x3e7945){if(_0x3e7945){return _0x3e7945['destroy']()[_0x4458('0x25')](function(){_0xcf668c['status'](0xcc)[_0x4458('0x1b')]();});}};}function handleEntityNotFound(_0x504a86,_0x543e21){return function(_0x277b1c){if(!_0x277b1c){_0x504a86[_0x4458('0x26')](0x194);}return _0x277b1c;};}function handleError(_0x1631d3,_0x25ade9){_0x25ade9=_0x25ade9||0x1f4;return function(_0x153a98){logger[_0x4458('0x27')](_0x153a98[_0x4458('0x28')]);if(_0x153a98[_0x4458('0x29')]){delete _0x153a98[_0x4458('0x29')];}_0x1631d3[_0x4458('0x1a')](_0x25ade9)[_0x4458('0x2a')](_0x153a98);};}exports['index']=function(_0x179be7,_0x4e076a){var _0x4579d9={},_0x5f22be={},_0x19dc1f={'count':0x0,'rows':[]};var _0x6bdb4c=_[_0x4458('0x2b')](db[_0x4458('0x2c')][_0x4458('0x2d')],function(_0x235832){return{'name':_0x235832[_0x4458('0x2e')],'type':_0x235832[_0x4458('0x2f')][_0x4458('0x30')]};});_0x5f22be[_0x4458('0x31')]=_[_0x4458('0x2b')](_0x6bdb4c,_0x4458('0x29'));_0x5f22be[_0x4458('0x32')]=_[_0x4458('0x33')](_0x179be7['query']);_0x5f22be[_0x4458('0x34')]=_[_0x4458('0x35')](_0x5f22be[_0x4458('0x31')],_0x5f22be[_0x4458('0x32')]);_0x4579d9[_0x4458('0x36')]=_[_0x4458('0x35')](_0x5f22be[_0x4458('0x31')],qs[_0x4458('0x37')](_0x179be7['query']['fields']));_0x4579d9['attributes']=_0x4579d9[_0x4458('0x36')][_0x4458('0x38')]?_0x4579d9[_0x4458('0x36')]:_0x5f22be[_0x4458('0x31')];if(!_0x179be7[_0x4458('0x32')][_0x4458('0x39')](_0x4458('0x3a'))){_0x4579d9[_0x4458('0x1e')]=qs[_0x4458('0x1e')](_0x179be7[_0x4458('0x32')][_0x4458('0x1e')]);_0x4579d9[_0x4458('0x1d')]=qs[_0x4458('0x1d')](_0x179be7['query'][_0x4458('0x1d')]);}_0x4579d9['order']=qs[_0x4458('0x3b')](_0x179be7[_0x4458('0x32')][_0x4458('0x3b')]);_0x4579d9[_0x4458('0x3c')]=qs['filters'](_['pick'](_0x179be7[_0x4458('0x32')],_0x5f22be[_0x4458('0x34')]),_0x6bdb4c);if(_0x179be7[_0x4458('0x32')]['filter']){_0x4579d9[_0x4458('0x3c')]=_[_0x4458('0x3d')](_0x4579d9[_0x4458('0x3c')],{'$or':_[_0x4458('0x2b')](_0x6bdb4c,function(_0x2751f6){if(_0x2751f6[_0x4458('0x2f')]!==_0x4458('0x3e')){var _0x39d151={};_0x39d151[_0x2751f6[_0x4458('0x29')]]={'$like':'%'+_0x179be7[_0x4458('0x32')]['filter']+'%'};return _0x39d151;}})});}_0x4579d9=_['merge']({},_0x4579d9,_0x179be7[_0x4458('0x3f')]);var _0x17fe5a={'where':_0x4579d9[_0x4458('0x3c')]};return db[_0x4458('0x2c')][_0x4458('0x1f')](_0x17fe5a)[_0x4458('0x25')](function(_0x2a66e9){_0x19dc1f[_0x4458('0x1f')]=_0x2a66e9;if(_0x179be7[_0x4458('0x32')]['includeAll']){_0x4579d9[_0x4458('0x40')]=[{'all':!![]}];}return db[_0x4458('0x2c')][_0x4458('0x41')](_0x4579d9);})[_0x4458('0x25')](function(_0x2e98ce){_0x19dc1f[_0x4458('0x42')]=_0x2e98ce;return _0x19dc1f;})[_0x4458('0x25')](respondWithFilteredResult(_0x4e076a,_0x4579d9))[_0x4458('0x43')](handleError(_0x4e076a,null));};exports[_0x4458('0x44')]=function(_0xb7e263,_0x56f900){var _0x35b56f={'raw':!![],'where':{'id':_0xb7e263[_0x4458('0x45')]['id']}},_0x474735={};_0x474735[_0x4458('0x31')]=_[_0x4458('0x33')](db['FaxQueueReport']['rawAttributes']);_0x474735['query']=_[_0x4458('0x33')](_0xb7e263[_0x4458('0x32')]);_0x474735[_0x4458('0x34')]=_['intersection'](_0x474735[_0x4458('0x31')],_0x474735['query']);_0x35b56f['attributes']=_['intersection'](_0x474735[_0x4458('0x31')],qs[_0x4458('0x37')](_0xb7e263['query'][_0x4458('0x37')]));_0x35b56f[_0x4458('0x36')]=_0x35b56f['attributes']['length']?_0x35b56f[_0x4458('0x36')]:_0x474735[_0x4458('0x31')];if(_0xb7e263[_0x4458('0x32')][_0x4458('0x46')]){_0x35b56f[_0x4458('0x40')]=[{'all':!![]}];}_0x35b56f=_['merge']({},_0x35b56f,_0xb7e263[_0x4458('0x3f')]);return db['FaxQueueReport']['find'](_0x35b56f)['then'](handleEntityNotFound(_0x56f900,null))['then'](respondWithResult(_0x56f900,null))[_0x4458('0x43')](handleError(_0x56f900,null));};exports[_0x4458('0x47')]=function(_0x5b7221,_0x2b6946){return db['FaxQueueReport'][_0x4458('0x47')](_0x5b7221[_0x4458('0x48')],{})[_0x4458('0x25')](respondWithResult(_0x2b6946,0xc9))[_0x4458('0x43')](handleError(_0x2b6946,null));};exports[_0x4458('0x24')]=function(_0x455931,_0x3dd938){if(_0x455931[_0x4458('0x48')]['id']){delete _0x455931[_0x4458('0x48')]['id'];}return db[_0x4458('0x2c')][_0x4458('0x49')]({'where':{'id':_0x455931[_0x4458('0x45')]['id']}})[_0x4458('0x25')](handleEntityNotFound(_0x3dd938,null))[_0x4458('0x25')](saveUpdates(_0x455931[_0x4458('0x48')],null))[_0x4458('0x25')](respondWithResult(_0x3dd938,null))['catch'](handleError(_0x3dd938,null));};exports[_0x4458('0x4a')]=function(_0x5251e1,_0x3e57e0){return db[_0x4458('0x2c')][_0x4458('0x49')]({'where':{'id':_0x5251e1['params']['id']}})[_0x4458('0x25')](handleEntityNotFound(_0x3e57e0,null))[_0x4458('0x25')](removeEntity(_0x3e57e0,null))['catch'](handleError(_0x3e57e0,null));};exports[_0x4458('0x4b')]=function(_0x39d159,_0x4297b5){return db[_0x4458('0x2c')][_0x4458('0x4b')]()[_0x4458('0x25')](respondWithResult(_0x4297b5,null))['catch'](handleError(_0x4297b5,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 87025c3..261af31 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 _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x3b93bb,_0x3807e0){var _0x276727=function(_0x2ea1cf){while(--_0x2ea1cf){_0x3b93bb['push'](_0x3b93bb['shift']());}};_0x276727(++_0x3807e0);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x444519,_0x3f1f10){var _0x66ac02=function(_0x47913b){while(--_0x47913b){_0x444519['push'](_0x444519['shift']());}};_0x66ac02(++_0x3f1f10);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5cceb8,_0xa8e57a){_0x5cceb8=_0x5cceb8-0x0;var _0xeaf4be=_0x7fbe[_0x5cceb8];return _0xeaf4be;};'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 74fba73..1e8aa1a 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 _0x2d83=['raw','UpdateFaxQueueReport','FaxQueueReport','update','limit','then','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxQueueReport','body','options'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0x2d83,0x92));var _0x32d8=function(_0x1ce35c,_0x19f4a5){_0x1ce35c=_0x1ce35c-0x0;var _0x4e4bcf=_0x2d83[_0x1ce35c];return _0x4e4bcf;};'use strict';var _=require(_0x32d8('0x0'));var util=require('util');var moment=require(_0x32d8('0x1'));var BPromise=require(_0x32d8('0x2'));var rs=require(_0x32d8('0x3'));var fs=require('fs');var Redis=require(_0x32d8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x32d8('0x5'))(_0x32d8('0x6'));var config=require('../../config/environment');var jayson=require(_0x32d8('0x7'));var client=jayson[_0x32d8('0x8')][_0x32d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17ed9c,_0x1d2255,_0x26da47){return new BPromise(function(_0x1783f5,_0x2a8f96){return client['request'](_0x17ed9c,_0x26da47)['then'](function(_0x386aeb){logger[_0x32d8('0xa')](_0x32d8('0xb'),_0x1d2255,_0x32d8('0xc'));logger['debug'](_0x32d8('0xd'),_0x1d2255,'request\x20sent',JSON[_0x32d8('0xe')](_0x386aeb));if(_0x386aeb[_0x32d8('0xf')]){if(_0x386aeb[_0x32d8('0xf')][_0x32d8('0x10')]===0x1f4){logger[_0x32d8('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x1d2255,_0x386aeb[_0x32d8('0xf')][_0x32d8('0x11')]);return _0x2a8f96(_0x386aeb[_0x32d8('0xf')][_0x32d8('0x11')]);}logger[_0x32d8('0xf')](_0x32d8('0xb'),_0x1d2255,_0x386aeb[_0x32d8('0xf')][_0x32d8('0x11')]);return _0x1783f5(_0x386aeb['error'][_0x32d8('0x11')]);}else{logger[_0x32d8('0xa')]('FaxQueueReport,\x20%s,\x20%s',_0x1d2255,_0x32d8('0xc'));_0x1783f5(_0x386aeb['result'][_0x32d8('0x11')]);}})[_0x32d8('0x12')](function(_0x4d811d){logger[_0x32d8('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x1d2255,_0x4d811d);_0x2a8f96(_0x4d811d);});});}exports[_0x32d8('0x13')]=function(_0x4844c3){var _0x64f598=this;return new Promise(function(_0x2f4b8a,_0x2cd24b){return db['FaxQueueReport']['create'](_0x4844c3[_0x32d8('0x14')],{'raw':_0x4844c3['options']?_0x4844c3[_0x32d8('0x15')][_0x32d8('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0xf4a770){logger[_0x32d8('0xa')]('CreateFaxQueueReport',_0x4844c3);logger['debug'](_0x32d8('0x13'),_0x4844c3,JSON[_0x32d8('0xe')](_0xf4a770));_0x2f4b8a(_0xf4a770);})['catch'](function(_0x3dbaab){logger[_0x32d8('0xf')](_0x32d8('0x13'),_0x3dbaab[_0x32d8('0x11')],_0x4844c3);_0x2cd24b(_0x64f598[_0x32d8('0xf')](0x1f4,_0x3dbaab[_0x32d8('0x11')]));});});};exports[_0x32d8('0x17')]=function(_0x59de7c){var _0xaae6df=this;return new Promise(function(_0xb5461,_0x16514c){return db[_0x32d8('0x18')][_0x32d8('0x19')](_0x59de7c['body'],{'raw':_0x59de7c[_0x32d8('0x15')]?_0x59de7c[_0x32d8('0x15')][_0x32d8('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59de7c[_0x32d8('0x15')]?_0x59de7c['options']['where']||null:null,'attributes':_0x59de7c[_0x32d8('0x15')]?_0x59de7c['options']['attributes']||null:null,'limit':_0x59de7c[_0x32d8('0x15')]?_0x59de7c[_0x32d8('0x15')][_0x32d8('0x1a')]||null:null})[_0x32d8('0x1b')](function(_0x536fa1){logger[_0x32d8('0xa')](_0x32d8('0x17'),_0x59de7c);logger['debug'](_0x32d8('0x17'),_0x59de7c,JSON[_0x32d8('0xe')](_0x536fa1));_0xb5461(_0x536fa1);})[_0x32d8('0x12')](function(_0x4cd228){logger[_0x32d8('0xf')](_0x32d8('0x17'),_0x4cd228[_0x32d8('0x11')],_0x59de7c);_0x16514c(_0xaae6df[_0x32d8('0xf')](0x1f4,_0x4cd228[_0x32d8('0x11')]));});});}; \ No newline at end of file +var _0x8409=['util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateFaxQueueReport','create','options','raw','then','UpdateFaxQueueReport','FaxQueueReport','where','attributes','limit','lodash'];(function(_0x431807,_0x187385){var _0x51d062=function(_0x2bd6a6){while(--_0x2bd6a6){_0x431807['push'](_0x431807['shift']());}};_0x51d062(++_0x187385);}(_0x8409,0x104));var _0x9840=function(_0x171fb6,_0x1116d6){_0x171fb6=_0x171fb6-0x0;var _0x2dda01=_0x8409[_0x171fb6];return _0x2dda01;};'use strict';var _=require(_0x9840('0x0'));var util=require(_0x9840('0x1'));var moment=require(_0x9840('0x2'));var BPromise=require(_0x9840('0x3'));var rs=require(_0x9840('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9840('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9840('0x6'));var config=require('../../config/environment');var jayson=require(_0x9840('0x7'));var client=jayson[_0x9840('0x8')][_0x9840('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55ea66,_0x42287e,_0x52995c){return new BPromise(function(_0x4400f4,_0x25de71){return client['request'](_0x55ea66,_0x52995c)['then'](function(_0x38b68d){logger[_0x9840('0xa')](_0x9840('0xb'),_0x42287e,_0x9840('0xc'));logger[_0x9840('0xd')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x42287e,_0x9840('0xc'),JSON[_0x9840('0xe')](_0x38b68d));if(_0x38b68d[_0x9840('0xf')]){if(_0x38b68d['error']['code']===0x1f4){logger[_0x9840('0xf')](_0x9840('0xb'),_0x42287e,_0x38b68d[_0x9840('0xf')][_0x9840('0x10')]);return _0x25de71(_0x38b68d[_0x9840('0xf')]['message']);}logger[_0x9840('0xf')](_0x9840('0xb'),_0x42287e,_0x38b68d['error'][_0x9840('0x10')]);return _0x4400f4(_0x38b68d[_0x9840('0xf')][_0x9840('0x10')]);}else{logger[_0x9840('0xa')]('FaxQueueReport,\x20%s,\x20%s',_0x42287e,_0x9840('0xc'));_0x4400f4(_0x38b68d[_0x9840('0x11')][_0x9840('0x10')]);}})[_0x9840('0x12')](function(_0x7337b5){logger[_0x9840('0xf')](_0x9840('0xb'),_0x42287e,_0x7337b5);_0x25de71(_0x7337b5);});});}exports[_0x9840('0x13')]=function(_0x5b852a){var _0x4a48ce=this;return new Promise(function(_0x35c91a,_0x4f0302){return db['FaxQueueReport'][_0x9840('0x14')](_0x5b852a['body'],{'raw':_0x5b852a[_0x9840('0x15')]?_0x5b852a[_0x9840('0x15')][_0x9840('0x16')]===undefined?!![]:![]:!![]})[_0x9840('0x17')](function(_0x1ac37c){logger[_0x9840('0xa')](_0x9840('0x13'),_0x5b852a);logger[_0x9840('0xd')](_0x9840('0x13'),_0x5b852a,JSON[_0x9840('0xe')](_0x1ac37c));_0x35c91a(_0x1ac37c);})[_0x9840('0x12')](function(_0x41d609){logger['error'](_0x9840('0x13'),_0x41d609[_0x9840('0x10')],_0x5b852a);_0x4f0302(_0x4a48ce['error'](0x1f4,_0x41d609[_0x9840('0x10')]));});});};exports[_0x9840('0x18')]=function(_0x314657){var _0x4996b7=this;return new Promise(function(_0x57937c,_0x10d47a){return db[_0x9840('0x19')]['update'](_0x314657['body'],{'raw':_0x314657['options']?_0x314657[_0x9840('0x15')][_0x9840('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x314657[_0x9840('0x15')]?_0x314657[_0x9840('0x15')][_0x9840('0x1a')]||null:null,'attributes':_0x314657[_0x9840('0x15')]?_0x314657['options'][_0x9840('0x1b')]||null:null,'limit':_0x314657['options']?_0x314657['options'][_0x9840('0x1c')]||null:null})['then'](function(_0x24c21a){logger[_0x9840('0xa')]('UpdateFaxQueueReport',_0x314657);logger[_0x9840('0xd')](_0x9840('0x18'),_0x314657,JSON[_0x9840('0xe')](_0x24c21a));_0x57937c(_0x24c21a);})[_0x9840('0x12')](function(_0x5c3420){logger[_0x9840('0xf')](_0x9840('0x18'),_0x5c3420['message'],_0x314657);_0x10d47a(_0x4996b7[_0x9840('0xf')](0x1f4,_0x5c3420[_0x9840('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 9e6b87e..c18307b 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 _0xb39a=['/:id','create','put','update','delete','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x209ba4,_0x11aee){var _0x336e86=function(_0x46b455){while(--_0x46b455){_0x209ba4['push'](_0x209ba4['shift']());}};_0x336e86(++_0x11aee);}(_0xb39a,0xa7));var _0xab39=function(_0x109e1d,_0x4474f0){_0x109e1d=_0x109e1d-0x0;var _0x549e93=_0xb39a[_0x109e1d];return _0x549e93;};'use strict';var multer=require(_0xab39('0x0'));var util=require(_0xab39('0x1'));var path=require('path');var timeout=require(_0xab39('0x2'));var express=require('express');var router=express[_0xab39('0x3')]();var fs_extra=require(_0xab39('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xab39('0x5'));var config=require(_0xab39('0x6'));var controller=require(_0xab39('0x7'));router[_0xab39('0x8')]('/',auth[_0xab39('0x9')](),controller[_0xab39('0xa')]);router[_0xab39('0x8')](_0xab39('0xb'),auth['isAuthenticated'](),controller[_0xab39('0xc')]);router[_0xab39('0x8')](_0xab39('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xab39('0x9')](),controller[_0xab39('0xe')]);router[_0xab39('0xf')]('/:id',auth[_0xab39('0x9')](),controller[_0xab39('0x10')]);router[_0xab39('0x11')](_0xab39('0xd'),auth[_0xab39('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc4de=['post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x2cea86,_0xf336){var _0xe4dc97=function(_0x594d1d){while(--_0x594d1d){_0x2cea86['push'](_0x2cea86['shift']());}};_0xe4dc97(++_0xf336);}(_0xc4de,0x73));var _0xec4d=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xc4de[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0xec4d('0x0'));var util=require(_0xec4d('0x1'));var path=require(_0xec4d('0x2'));var timeout=require(_0xec4d('0x3'));var express=require(_0xec4d('0x4'));var router=express[_0xec4d('0x5')]();var fs_extra=require(_0xec4d('0x6'));var auth=require(_0xec4d('0x7'));var interaction=require(_0xec4d('0x8'));var config=require('../../config/environment');var controller=require(_0xec4d('0x9'));router[_0xec4d('0xa')]('/',auth[_0xec4d('0xb')](),controller[_0xec4d('0xc')]);router[_0xec4d('0xa')](_0xec4d('0xd'),auth[_0xec4d('0xb')](),controller[_0xec4d('0xe')]);router[_0xec4d('0xa')](_0xec4d('0xf'),auth[_0xec4d('0xb')](),controller[_0xec4d('0x10')]);router[_0xec4d('0x11')]('/',auth['isAuthenticated'](),controller[_0xec4d('0x12')]);router['put']('/:id',auth[_0xec4d('0xb')](),controller[_0xec4d('0x13')]);router['delete'](_0xec4d('0xf'),auth[_0xec4d('0xb')](),controller[_0xec4d('0x14')]);module[_0xec4d('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 5e7a56c..d145c8f 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0xfb675c,_0x2cfb12){var _0x56179a=function(_0x4d7e34){while(--_0x4d7e34){_0xfb675c['push'](_0xfb675c['shift']());}};_0x56179a(++_0x2cfb12);}(_0x34e8,0x12c));var _0x834e=function(_0x59a508,_0x586f9f){_0x59a508=_0x59a508-0x0;var _0x39825a=_0x34e8[_0x59a508];return _0x39825a;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x26930f,_0x2d582e){var _0x22ec6e=function(_0x128073){while(--_0x128073){_0x26930f['push'](_0x26930f['shift']());}};_0x22ec6e(++_0x2d582e);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 55a3c3b..5fe6df6 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 _0xd470=['order','where','pick','filter','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xd470,0xf7));var _0x0d47=function(_0x5eff7f,_0x41eb27){_0x5eff7f=_0x5eff7f-0x0;var _0x302866=_0xd470[_0x5eff7f];return _0x302866;};'use strict';var emlformat=require(_0x0d47('0x0'));var rimraf=require(_0x0d47('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d47('0x2'));var rp=require('request-promise');var moment=require(_0x0d47('0x3'));var BPromise=require(_0x0d47('0x4'));var Mustache=require(_0x0d47('0x5'));var util=require(_0x0d47('0x6'));var path=require(_0x0d47('0x7'));var sox=require(_0x0d47('0x8'));var csv=require(_0x0d47('0x9'));var ejs=require(_0x0d47('0xa'));var fs=require('fs');var fs_extra=require(_0x0d47('0xb'));var _=require(_0x0d47('0xc'));var squel=require(_0x0d47('0xd'));var crypto=require(_0x0d47('0xe'));var jsforce=require(_0x0d47('0xf'));var deskjs=require(_0x0d47('0x10'));var toCsv=require(_0x0d47('0x9'));var querystring=require(_0x0d47('0x11'));var Papa=require(_0x0d47('0x12'));var Redis=require('ioredis');var authService=require(_0x0d47('0x13'));var qs=require(_0x0d47('0x14'));var as=require(_0x0d47('0x15'));var hardwareService=require(_0x0d47('0x16'));var logger=require(_0x0d47('0x17'))('api');var utils=require(_0x0d47('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0d47('0x19'))['db'];function respondWithStatusCode(_0x55db24,_0x52c187){_0x52c187=_0x52c187||0xcc;return function(_0x269b68){if(_0x269b68){return _0x55db24[_0x0d47('0x1a')](_0x52c187);}return _0x55db24['status'](_0x52c187)[_0x0d47('0x1b')]();};}function respondWithResult(_0x552e76,_0x129a12){_0x129a12=_0x129a12||0xc8;return function(_0x46a919){if(_0x46a919){return _0x552e76[_0x0d47('0x1c')](_0x129a12)[_0x0d47('0x1d')](_0x46a919);}};}function respondWithFilteredResult(_0x592654,_0x563d0f){return function(_0x58819f){if(_0x58819f){var _0x1b134f=typeof _0x563d0f[_0x0d47('0x1e')]==='undefined'&&typeof _0x563d0f['limit']===_0x0d47('0x1f');var _0x33b9cc=_0x58819f[_0x0d47('0x20')];var _0x46725b=_0x1b134f?0x0:_0x563d0f[_0x0d47('0x1e')];var _0x59db61=_0x1b134f?_0x58819f[_0x0d47('0x20')]:_0x563d0f[_0x0d47('0x1e')]+_0x563d0f['limit'];var _0x5c5f1f;if(_0x59db61>=_0x33b9cc){_0x59db61=_0x33b9cc;_0x5c5f1f=0xc8;}else{_0x5c5f1f=0xce;}_0x592654[_0x0d47('0x1c')](_0x5c5f1f);return _0x592654['set'](_0x0d47('0x21'),_0x46725b+'-'+_0x59db61+'/'+_0x33b9cc)[_0x0d47('0x1d')](_0x58819f);}return null;};}function patchUpdates(_0x5927e0){return function(_0x1e4650){try{jsonpatch[_0x0d47('0x22')](_0x1e4650,_0x5927e0,!![]);}catch(_0x156da5){return BPromise[_0x0d47('0x23')](_0x156da5);}return _0x1e4650['save']();};}function saveUpdates(_0x34083b,_0x1169a9){return function(_0x34912e){if(_0x34912e){return _0x34912e['update'](_0x34083b)[_0x0d47('0x24')](function(_0x2533b4){return _0x2533b4;});}return null;};}function removeEntity(_0x334210,_0x94c781){return function(_0x4c6e59){if(_0x4c6e59){return _0x4c6e59[_0x0d47('0x25')]()[_0x0d47('0x24')](function(){_0x334210[_0x0d47('0x1c')](0xcc)[_0x0d47('0x1b')]();});}};}function handleEntityNotFound(_0x3ecd8d,_0x9e0600){return function(_0x29b870){if(!_0x29b870){_0x3ecd8d['sendStatus'](0x194);}return _0x29b870;};}function handleError(_0x3b7555,_0x4f814b){_0x4f814b=_0x4f814b||0x1f4;return function(_0xabfdc0){logger[_0x0d47('0x26')](_0xabfdc0[_0x0d47('0x27')]);if(_0xabfdc0[_0x0d47('0x28')]){delete _0xabfdc0[_0x0d47('0x28')];}_0x3b7555[_0x0d47('0x1c')](_0x4f814b)[_0x0d47('0x29')](_0xabfdc0);};}exports[_0x0d47('0x2a')]=function(_0x164463,_0x5ab31b){var _0x3950d4={},_0x276b0c={},_0x91d7f8={'count':0x0,'rows':[]};var _0xa00106=_[_0x0d47('0x2b')](db[_0x0d47('0x2c')][_0x0d47('0x2d')],function(_0x2e825d){return{'name':_0x2e825d[_0x0d47('0x2e')],'type':_0x2e825d['type'][_0x0d47('0x2f')]};});_0x276b0c[_0x0d47('0x30')]=_['map'](_0xa00106,_0x0d47('0x28'));_0x276b0c[_0x0d47('0x31')]=_['keys'](_0x164463[_0x0d47('0x31')]);_0x276b0c[_0x0d47('0x32')]=_['intersection'](_0x276b0c[_0x0d47('0x30')],_0x276b0c['query']);_0x3950d4[_0x0d47('0x33')]=_[_0x0d47('0x34')](_0x276b0c[_0x0d47('0x30')],qs['fields'](_0x164463[_0x0d47('0x31')][_0x0d47('0x35')]));_0x3950d4[_0x0d47('0x33')]=_0x3950d4[_0x0d47('0x33')][_0x0d47('0x36')]?_0x3950d4['attributes']:_0x276b0c['model'];if(!_0x164463['query'][_0x0d47('0x37')]('nolimit')){_0x3950d4[_0x0d47('0x38')]=qs[_0x0d47('0x38')](_0x164463['query'][_0x0d47('0x38')]);_0x3950d4[_0x0d47('0x1e')]=qs[_0x0d47('0x1e')](_0x164463[_0x0d47('0x31')]['offset']);}_0x3950d4[_0x0d47('0x39')]=qs['sort'](_0x164463[_0x0d47('0x31')]['sort']);_0x3950d4[_0x0d47('0x3a')]=qs['filters'](_[_0x0d47('0x3b')](_0x164463['query'],_0x276b0c[_0x0d47('0x32')]),_0xa00106);if(_0x164463[_0x0d47('0x31')][_0x0d47('0x3c')]){_0x3950d4['where']=_['merge'](_0x3950d4[_0x0d47('0x3a')],{'$or':_[_0x0d47('0x2b')](_0xa00106,function(_0x228375){if(_0x228375[_0x0d47('0x3d')]!==_0x0d47('0x3e')){var _0x4252f5={};_0x4252f5[_0x228375[_0x0d47('0x28')]]={'$like':'%'+_0x164463[_0x0d47('0x31')][_0x0d47('0x3c')]+'%'};return _0x4252f5;}})});}_0x3950d4=_['merge']({},_0x3950d4,_0x164463[_0x0d47('0x3f')]);var _0x5e5b21={'where':_0x3950d4[_0x0d47('0x3a')]};return db[_0x0d47('0x2c')]['count'](_0x5e5b21)[_0x0d47('0x24')](function(_0x3dfb7d){_0x91d7f8[_0x0d47('0x20')]=_0x3dfb7d;if(_0x164463['query'][_0x0d47('0x40')]){_0x3950d4[_0x0d47('0x41')]=[{'all':!![]}];}return db[_0x0d47('0x2c')]['findAll'](_0x3950d4);})[_0x0d47('0x24')](function(_0x187dc5){_0x91d7f8[_0x0d47('0x42')]=_0x187dc5;return _0x91d7f8;})[_0x0d47('0x24')](respondWithFilteredResult(_0x5ab31b,_0x3950d4))[_0x0d47('0x43')](handleError(_0x5ab31b,null));};exports[_0x0d47('0x44')]=function(_0x14d111,_0x1ceaf6){var _0x4e8654={'raw':!![],'where':{'id':_0x14d111[_0x0d47('0x45')]['id']}},_0x5cc164={};_0x5cc164[_0x0d47('0x30')]=_['keys'](db[_0x0d47('0x2c')]['rawAttributes']);_0x5cc164[_0x0d47('0x31')]=_['keys'](_0x14d111[_0x0d47('0x31')]);_0x5cc164[_0x0d47('0x32')]=_[_0x0d47('0x34')](_0x5cc164[_0x0d47('0x30')],_0x5cc164[_0x0d47('0x31')]);_0x4e8654[_0x0d47('0x33')]=_[_0x0d47('0x34')](_0x5cc164[_0x0d47('0x30')],qs[_0x0d47('0x35')](_0x14d111[_0x0d47('0x31')][_0x0d47('0x35')]));_0x4e8654[_0x0d47('0x33')]=_0x4e8654[_0x0d47('0x33')]['length']?_0x4e8654[_0x0d47('0x33')]:_0x5cc164[_0x0d47('0x30')];if(_0x14d111['query'][_0x0d47('0x40')]){_0x4e8654['include']=[{'all':!![]}];}_0x4e8654=_[_0x0d47('0x46')]({},_0x4e8654,_0x14d111['options']);return db[_0x0d47('0x2c')][_0x0d47('0x47')](_0x4e8654)[_0x0d47('0x24')](handleEntityNotFound(_0x1ceaf6,null))['then'](respondWithResult(_0x1ceaf6,null))[_0x0d47('0x43')](handleError(_0x1ceaf6,null));};exports[_0x0d47('0x48')]=function(_0x18c51b,_0x5082da){return db[_0x0d47('0x2c')][_0x0d47('0x48')](_0x18c51b[_0x0d47('0x49')],{})[_0x0d47('0x24')](respondWithResult(_0x5082da,0xc9))[_0x0d47('0x43')](handleError(_0x5082da,null));};exports[_0x0d47('0x4a')]=function(_0x4c1a90,_0x39e535){if(_0x4c1a90[_0x0d47('0x49')]['id']){delete _0x4c1a90[_0x0d47('0x49')]['id'];}return db[_0x0d47('0x2c')][_0x0d47('0x47')]({'where':{'id':_0x4c1a90['params']['id']}})[_0x0d47('0x24')](handleEntityNotFound(_0x39e535,null))[_0x0d47('0x24')](saveUpdates(_0x4c1a90[_0x0d47('0x49')],null))['then'](respondWithResult(_0x39e535,null))[_0x0d47('0x43')](handleError(_0x39e535,null));};exports[_0x0d47('0x25')]=function(_0xbfdde2,_0x1c8355){return db['FaxTransferReport']['find']({'where':{'id':_0xbfdde2[_0x0d47('0x45')]['id']}})[_0x0d47('0x24')](handleEntityNotFound(_0x1c8355,null))[_0x0d47('0x24')](removeEntity(_0x1c8355,null))[_0x0d47('0x43')](handleError(_0x1c8355,null));};exports[_0x0d47('0x4b')]=function(_0x39d125,_0x4313e1){return db[_0x0d47('0x2c')][_0x0d47('0x4b')]()['then'](respondWithResult(_0x4313e1,null))[_0x0d47('0x43')](handleError(_0x4313e1,null));}; \ No newline at end of file +var _0x0863=['end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x5f0501,_0x19196e){var _0x3c2c45=function(_0x107fe6){while(--_0x107fe6){_0x5f0501['push'](_0x5f0501['shift']());}};_0x3c2c45(++_0x19196e);}(_0x0863,0x15c));var _0x3086=function(_0x2fe5b9,_0x127e48){_0x2fe5b9=_0x2fe5b9-0x0;var _0x6f874=_0x0863[_0x2fe5b9];return _0x6f874;};'use strict';var emlformat=require(_0x3086('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3086('0x1'));var jsonpatch=require(_0x3086('0x2'));var rp=require('request-promise');var moment=require(_0x3086('0x3'));var BPromise=require(_0x3086('0x4'));var Mustache=require(_0x3086('0x5'));var util=require('util');var path=require(_0x3086('0x6'));var sox=require(_0x3086('0x7'));var csv=require(_0x3086('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3086('0x9'));var _=require(_0x3086('0xa'));var squel=require(_0x3086('0xb'));var crypto=require(_0x3086('0xc'));var jsforce=require(_0x3086('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3086('0x8'));var querystring=require(_0x3086('0xe'));var Papa=require(_0x3086('0xf'));var Redis=require(_0x3086('0x10'));var authService=require(_0x3086('0x11'));var qs=require(_0x3086('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3086('0x13'));var logger=require('../../config/logger')(_0x3086('0x14'));var utils=require(_0x3086('0x15'));var config=require(_0x3086('0x16'));var licenseUtil=require(_0x3086('0x17'));var db=require(_0x3086('0x18'))['db'];function respondWithStatusCode(_0x1a2938,_0x207977){_0x207977=_0x207977||0xcc;return function(_0x6dbfe){if(_0x6dbfe){return _0x1a2938[_0x3086('0x19')](_0x207977);}return _0x1a2938[_0x3086('0x1a')](_0x207977)[_0x3086('0x1b')]();};}function respondWithResult(_0xc7ed82,_0x13d140){_0x13d140=_0x13d140||0xc8;return function(_0x248bfa){if(_0x248bfa){return _0xc7ed82[_0x3086('0x1a')](_0x13d140)[_0x3086('0x1c')](_0x248bfa);}};}function respondWithFilteredResult(_0x4e72cc,_0x921db9){return function(_0x1b1601){if(_0x1b1601){var _0x8c1bae=typeof _0x921db9['offset']===_0x3086('0x1d')&&typeof _0x921db9['limit']==='undefined';var _0x53c69d=_0x1b1601[_0x3086('0x1e')];var _0x11dcf8=_0x8c1bae?0x0:_0x921db9[_0x3086('0x1f')];var _0x10425d=_0x8c1bae?_0x1b1601[_0x3086('0x1e')]:_0x921db9['offset']+_0x921db9[_0x3086('0x20')];var _0x219da8;if(_0x10425d>=_0x53c69d){_0x10425d=_0x53c69d;_0x219da8=0xc8;}else{_0x219da8=0xce;}_0x4e72cc[_0x3086('0x1a')](_0x219da8);return _0x4e72cc['set'](_0x3086('0x21'),_0x11dcf8+'-'+_0x10425d+'/'+_0x53c69d)['json'](_0x1b1601);}return null;};}function patchUpdates(_0x2f9705){return function(_0x5f4af0){try{jsonpatch[_0x3086('0x22')](_0x5f4af0,_0x2f9705,!![]);}catch(_0x42d797){return BPromise[_0x3086('0x23')](_0x42d797);}return _0x5f4af0[_0x3086('0x24')]();};}function saveUpdates(_0x2e141c,_0xdfc067){return function(_0x3d97be){if(_0x3d97be){return _0x3d97be[_0x3086('0x25')](_0x2e141c)[_0x3086('0x26')](function(_0x3c730f){return _0x3c730f;});}return null;};}function removeEntity(_0xdeef07,_0x108db0){return function(_0x5e3cb4){if(_0x5e3cb4){return _0x5e3cb4[_0x3086('0x27')]()[_0x3086('0x26')](function(){_0xdeef07['status'](0xcc)[_0x3086('0x1b')]();});}};}function handleEntityNotFound(_0x21c86a,_0x308242){return function(_0x1256d6){if(!_0x1256d6){_0x21c86a[_0x3086('0x19')](0x194);}return _0x1256d6;};}function handleError(_0x25d3ea,_0x5b0c6d){_0x5b0c6d=_0x5b0c6d||0x1f4;return function(_0x4fbca2){logger['error'](_0x4fbca2[_0x3086('0x28')]);if(_0x4fbca2[_0x3086('0x29')]){delete _0x4fbca2[_0x3086('0x29')];}_0x25d3ea[_0x3086('0x1a')](_0x5b0c6d)['send'](_0x4fbca2);};}exports[_0x3086('0x2a')]=function(_0x31c37b,_0xd7765d){var _0x5669a4={},_0x6d02ec={},_0x5b67a7={'count':0x0,'rows':[]};var _0x32fc50=_['map'](db[_0x3086('0x2b')][_0x3086('0x2c')],function(_0x47e130){return{'name':_0x47e130[_0x3086('0x2d')],'type':_0x47e130[_0x3086('0x2e')][_0x3086('0x2f')]};});_0x6d02ec[_0x3086('0x30')]=_[_0x3086('0x31')](_0x32fc50,_0x3086('0x29'));_0x6d02ec[_0x3086('0x32')]=_[_0x3086('0x33')](_0x31c37b[_0x3086('0x32')]);_0x6d02ec[_0x3086('0x34')]=_[_0x3086('0x35')](_0x6d02ec[_0x3086('0x30')],_0x6d02ec['query']);_0x5669a4[_0x3086('0x36')]=_[_0x3086('0x35')](_0x6d02ec[_0x3086('0x30')],qs[_0x3086('0x37')](_0x31c37b[_0x3086('0x32')][_0x3086('0x37')]));_0x5669a4['attributes']=_0x5669a4[_0x3086('0x36')][_0x3086('0x38')]?_0x5669a4[_0x3086('0x36')]:_0x6d02ec[_0x3086('0x30')];if(!_0x31c37b[_0x3086('0x32')]['hasOwnProperty']('nolimit')){_0x5669a4[_0x3086('0x20')]=qs[_0x3086('0x20')](_0x31c37b['query']['limit']);_0x5669a4['offset']=qs[_0x3086('0x1f')](_0x31c37b[_0x3086('0x32')][_0x3086('0x1f')]);}_0x5669a4[_0x3086('0x39')]=qs[_0x3086('0x3a')](_0x31c37b[_0x3086('0x32')][_0x3086('0x3a')]);_0x5669a4[_0x3086('0x3b')]=qs[_0x3086('0x34')](_[_0x3086('0x3c')](_0x31c37b[_0x3086('0x32')],_0x6d02ec[_0x3086('0x34')]),_0x32fc50);if(_0x31c37b['query']['filter']){_0x5669a4[_0x3086('0x3b')]=_[_0x3086('0x3d')](_0x5669a4[_0x3086('0x3b')],{'$or':_[_0x3086('0x31')](_0x32fc50,function(_0x7fafbd){if(_0x7fafbd[_0x3086('0x2e')]!==_0x3086('0x3e')){var _0x29a57d={};_0x29a57d[_0x7fafbd[_0x3086('0x29')]]={'$like':'%'+_0x31c37b[_0x3086('0x32')]['filter']+'%'};return _0x29a57d;}})});}_0x5669a4=_['merge']({},_0x5669a4,_0x31c37b[_0x3086('0x3f')]);var _0x4dfffe={'where':_0x5669a4[_0x3086('0x3b')]};return db['FaxTransferReport']['count'](_0x4dfffe)['then'](function(_0x3f9908){_0x5b67a7['count']=_0x3f9908;if(_0x31c37b[_0x3086('0x32')][_0x3086('0x40')]){_0x5669a4[_0x3086('0x41')]=[{'all':!![]}];}return db[_0x3086('0x2b')][_0x3086('0x42')](_0x5669a4);})[_0x3086('0x26')](function(_0x5ed83c){_0x5b67a7[_0x3086('0x43')]=_0x5ed83c;return _0x5b67a7;})[_0x3086('0x26')](respondWithFilteredResult(_0xd7765d,_0x5669a4))[_0x3086('0x44')](handleError(_0xd7765d,null));};exports[_0x3086('0x45')]=function(_0x3c8807,_0x5256b0){var _0x231881={'raw':!![],'where':{'id':_0x3c8807[_0x3086('0x46')]['id']}},_0x4affa9={};_0x4affa9[_0x3086('0x30')]=_[_0x3086('0x33')](db[_0x3086('0x2b')]['rawAttributes']);_0x4affa9['query']=_[_0x3086('0x33')](_0x3c8807['query']);_0x4affa9[_0x3086('0x34')]=_[_0x3086('0x35')](_0x4affa9[_0x3086('0x30')],_0x4affa9[_0x3086('0x32')]);_0x231881[_0x3086('0x36')]=_['intersection'](_0x4affa9[_0x3086('0x30')],qs['fields'](_0x3c8807[_0x3086('0x32')][_0x3086('0x37')]));_0x231881['attributes']=_0x231881[_0x3086('0x36')][_0x3086('0x38')]?_0x231881[_0x3086('0x36')]:_0x4affa9['model'];if(_0x3c8807[_0x3086('0x32')][_0x3086('0x40')]){_0x231881[_0x3086('0x41')]=[{'all':!![]}];}_0x231881=_['merge']({},_0x231881,_0x3c8807['options']);return db['FaxTransferReport']['find'](_0x231881)['then'](handleEntityNotFound(_0x5256b0,null))['then'](respondWithResult(_0x5256b0,null))['catch'](handleError(_0x5256b0,null));};exports[_0x3086('0x47')]=function(_0x18f3ae,_0x460534){return db['FaxTransferReport'][_0x3086('0x47')](_0x18f3ae[_0x3086('0x48')],{})[_0x3086('0x26')](respondWithResult(_0x460534,0xc9))[_0x3086('0x44')](handleError(_0x460534,null));};exports[_0x3086('0x25')]=function(_0x24bd29,_0x4fe84d){if(_0x24bd29[_0x3086('0x48')]['id']){delete _0x24bd29['body']['id'];}return db[_0x3086('0x2b')][_0x3086('0x49')]({'where':{'id':_0x24bd29[_0x3086('0x46')]['id']}})[_0x3086('0x26')](handleEntityNotFound(_0x4fe84d,null))[_0x3086('0x26')](saveUpdates(_0x24bd29[_0x3086('0x48')],null))[_0x3086('0x26')](respondWithResult(_0x4fe84d,null))[_0x3086('0x44')](handleError(_0x4fe84d,null));};exports[_0x3086('0x27')]=function(_0x15e83a,_0x4005f9){return db[_0x3086('0x2b')][_0x3086('0x49')]({'where':{'id':_0x15e83a[_0x3086('0x46')]['id']}})[_0x3086('0x26')](handleEntityNotFound(_0x4005f9,null))['then'](removeEntity(_0x4005f9,null))[_0x3086('0x44')](handleError(_0x4005f9,null));};exports[_0x3086('0x4a')]=function(_0x152f50,_0x26f9c6){return db[_0x3086('0x2b')][_0x3086('0x4a')]()['then'](respondWithResult(_0x26f9c6,null))['catch'](handleError(_0x26f9c6,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index e12c1ee..a956276 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 _0xc67b=['moment','bluebird','path','rimraf','../../config/environment','exports','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x498396,_0x395c9a){var _0x1b0fbd=function(_0x1c511e){while(--_0x1c511e){_0x498396['push'](_0x498396['shift']());}};_0x1b0fbd(++_0x395c9a);}(_0xc67b,0x104));var _0xbc67=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc67b[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xbc67('0x0'));var util=require(_0xbc67('0x1'));var logger=require(_0xbc67('0x2'))(_0xbc67('0x3'));var moment=require(_0xbc67('0x4'));var BPromise=require(_0xbc67('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc67('0x6'));var rimraf=require(_0xbc67('0x7'));var config=require(_0xbc67('0x8'));var attributes=require('./faxTransferReport.attributes');module[_0xbc67('0x9')]=function(_0x20ad01,_0x5f0619){return _0x20ad01['define']('FaxTransferReport',attributes,{'tableName':_0xbc67('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbc67('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x700c=['report_fax_transfer','uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports'];(function(_0x110924,_0x1374bb){var _0x12905b=function(_0x47d32c){while(--_0x47d32c){_0x110924['push'](_0x110924['shift']());}};_0x12905b(++_0x1374bb);}(_0x700c,0x1b2));var _0xc700=function(_0x23f313,_0x1e7157){_0x23f313=_0x23f313-0x0;var _0x4f9063=_0x700c[_0x23f313];return _0x4f9063;};'use strict';var _=require(_0xc700('0x0'));var util=require(_0xc700('0x1'));var logger=require('../../config/logger')(_0xc700('0x2'));var moment=require(_0xc700('0x3'));var BPromise=require(_0xc700('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc700('0x5'));var rimraf=require(_0xc700('0x6'));var config=require(_0xc700('0x7'));var attributes=require(_0xc700('0x8'));module[_0xc700('0x9')]=function(_0x449db1,_0x5c5b18){return _0x449db1['define']('FaxTransferReport',attributes,{'tableName':_0xc700('0xa'),'paranoid':![],'indexes':[{'name':_0xc700('0xb'),'fields':[_0xc700('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 2a33443..aac808b 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 _0xd459=['rpc','jayson/promise','client','http','request','then','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x502da7,_0x42bcc2){var _0x246e4b=function(_0x4898b0){while(--_0x4898b0){_0x502da7['push'](_0x502da7['shift']());}};_0x246e4b(++_0x42bcc2);}(_0xd459,0x1bf));var _0x9d45=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xd459[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x9d45('0x0'));var util=require(_0x9d45('0x1'));var moment=require(_0x9d45('0x2'));var BPromise=require(_0x9d45('0x3'));var rs=require(_0x9d45('0x4'));var fs=require('fs');var Redis=require(_0x9d45('0x5'));var db=require(_0x9d45('0x6'))['db'];var utils=require(_0x9d45('0x7'));var logger=require(_0x9d45('0x8'))(_0x9d45('0x9'));var config=require('../../config/environment');var jayson=require(_0x9d45('0xa'));var client=jayson[_0x9d45('0xb')][_0x9d45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cf684,_0x508501,_0x26aacd){return new BPromise(function(_0x1278eb,_0xeae6fc){return client[_0x9d45('0xd')](_0x2cf684,_0x26aacd)[_0x9d45('0xe')](function(_0x4c7f45){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x508501,_0x9d45('0xf'));logger[_0x9d45('0x10')](_0x9d45('0x11'),_0x508501,_0x9d45('0xf'),JSON[_0x9d45('0x12')](_0x4c7f45));if(_0x4c7f45[_0x9d45('0x13')]){if(_0x4c7f45[_0x9d45('0x13')][_0x9d45('0x14')]===0x1f4){logger[_0x9d45('0x13')](_0x9d45('0x15'),_0x508501,_0x4c7f45[_0x9d45('0x13')][_0x9d45('0x16')]);return _0xeae6fc(_0x4c7f45[_0x9d45('0x13')][_0x9d45('0x16')]);}logger['error'](_0x9d45('0x15'),_0x508501,_0x4c7f45['error'][_0x9d45('0x16')]);return _0x1278eb(_0x4c7f45[_0x9d45('0x13')][_0x9d45('0x16')]);}else{logger[_0x9d45('0x17')](_0x9d45('0x15'),_0x508501,'request\x20sent');_0x1278eb(_0x4c7f45['result'][_0x9d45('0x16')]);}})['catch'](function(_0x3ec452){logger[_0x9d45('0x13')](_0x9d45('0x15'),_0x508501,_0x3ec452);_0xeae6fc(_0x3ec452);});});} \ No newline at end of file +var _0x4c32=['FaxTransferReport,\x20%s,\x20%s','message','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','info','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1cbb10,_0x3e6dfa){var _0x4b4d86=function(_0x393c1c){while(--_0x393c1c){_0x1cbb10['push'](_0x1cbb10['shift']());}};_0x4b4d86(++_0x3e6dfa);}(_0x4c32,0x1a2));var _0x24c3=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x4c32[_0xcd0918];return _0x250704;};'use strict';var _=require('lodash');var util=require(_0x24c3('0x0'));var moment=require('moment');var BPromise=require(_0x24c3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24c3('0x2'));var db=require(_0x24c3('0x3'))['db'];var utils=require(_0x24c3('0x4'));var logger=require(_0x24c3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x24c3('0x6'));var client=jayson[_0x24c3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50721a,_0x31b6f9,_0x47f843){return new BPromise(function(_0x3df78b,_0x25dce1){return client['request'](_0x50721a,_0x47f843)[_0x24c3('0x8')](function(_0x3cf093){logger[_0x24c3('0x9')]('FaxTransferReport,\x20%s,\x20%s',_0x31b6f9,_0x24c3('0xa'));logger['debug'](_0x24c3('0xb'),_0x31b6f9,_0x24c3('0xa'),JSON['stringify'](_0x3cf093));if(_0x3cf093[_0x24c3('0xc')]){if(_0x3cf093[_0x24c3('0xc')][_0x24c3('0xd')]===0x1f4){logger['error'](_0x24c3('0xe'),_0x31b6f9,_0x3cf093['error'][_0x24c3('0xf')]);return _0x25dce1(_0x3cf093[_0x24c3('0xc')][_0x24c3('0xf')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x31b6f9,_0x3cf093['error'][_0x24c3('0xf')]);return _0x3df78b(_0x3cf093[_0x24c3('0xc')][_0x24c3('0xf')]);}else{logger[_0x24c3('0x9')](_0x24c3('0xe'),_0x31b6f9,_0x24c3('0xa'));_0x3df78b(_0x3cf093['result'][_0x24c3('0xf')]);}})['catch'](function(_0x26eb52){logger[_0x24c3('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x31b6f9,_0x26eb52);_0x25dce1(_0x26eb52);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 92d4b2f..a2b72af 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 _0xeb9d=['./faxTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x23bb8b,_0x170e51){var _0x4e0105=function(_0x50e0f1){while(--_0x50e0f1){_0x23bb8b['push'](_0x23bb8b['shift']());}};_0x4e0105(++_0x170e51);}(_0xeb9d,0x1e7));var _0xdeb9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb9d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xdeb9('0x0'));var util=require(_0xdeb9('0x1'));var path=require(_0xdeb9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdeb9('0x3')]();var fs_extra=require(_0xdeb9('0x4'));var auth=require(_0xdeb9('0x5'));var interaction=require(_0xdeb9('0x6'));var config=require('../../config/environment');var controller=require(_0xdeb9('0x7'));router['get']('/',auth[_0xdeb9('0x8')](),controller['index']);router[_0xdeb9('0x9')](_0xdeb9('0xa'),auth[_0xdeb9('0x8')](),controller[_0xdeb9('0xb')]);router['get'](_0xdeb9('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xdeb9('0x8')](),controller[_0xdeb9('0xd')]);router[_0xdeb9('0xe')](_0xdeb9('0xc'),auth['isAuthenticated'](),controller[_0xdeb9('0xf')]);router[_0xdeb9('0x10')](_0xdeb9('0xc'),auth['isAuthenticated'](),controller[_0xdeb9('0x11')]);module[_0xdeb9('0x12')]=router; \ No newline at end of file +var _0xa80e=['get','isAuthenticated','/:id','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller'];(function(_0x912fb7,_0x5b401f){var _0x5f55c8=function(_0x4d487b){while(--_0x4d487b){_0x912fb7['push'](_0x912fb7['shift']());}};_0x5f55c8(++_0x5b401f);}(_0xa80e,0x1aa));var _0xea80=function(_0x1a340f,_0x4b9893){_0x1a340f=_0x1a340f-0x0;var _0xbcb1c0=_0xa80e[_0x1a340f];return _0xbcb1c0;};'use strict';var multer=require(_0xea80('0x0'));var util=require(_0xea80('0x1'));var path=require(_0xea80('0x2'));var timeout=require(_0xea80('0x3'));var express=require(_0xea80('0x4'));var router=express[_0xea80('0x5')]();var fs_extra=require(_0xea80('0x6'));var auth=require(_0xea80('0x7'));var interaction=require(_0xea80('0x8'));var config=require(_0xea80('0x9'));var controller=require(_0xea80('0xa'));router[_0xea80('0xb')]('/',auth[_0xea80('0xc')](),controller['index']);router['get']('/describe',auth[_0xea80('0xc')](),controller['describe']);router[_0xea80('0xb')](_0xea80('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xea80('0xc')](),controller[_0xea80('0xe')]);router[_0xea80('0xf')]('/:id',auth[_0xea80('0xc')](),controller[_0xea80('0x10')]);router[_0xea80('0x11')]('/:id',auth[_0xea80('0xc')](),controller['destroy']);module[_0xea80('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 238f71e..052fdbf 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 _0xc67a=['index','/:id','get','/:id/configurations','getConfigurations','create','post','addConfiguration','put','update','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated'];(function(_0x2d0ec6,_0xd8f44c){var _0x16fff5=function(_0x4f36d1){while(--_0x4f36d1){_0x2d0ec6['push'](_0x2d0ec6['shift']());}};_0x16fff5(++_0xd8f44c);}(_0xc67a,0x108));var _0xac67=function(_0x144daf,_0x234135){_0x144daf=_0x144daf-0x0;var _0x4e75a7=_0xc67a[_0x144daf];return _0x4e75a7;};'use strict';var multer=require(_0xac67('0x0'));var util=require(_0xac67('0x1'));var path=require('path');var timeout=require(_0xac67('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xac67('0x3'));var auth=require(_0xac67('0x4'));var interaction=require(_0xac67('0x5'));var config=require(_0xac67('0x6'));var controller=require(_0xac67('0x7'));router['get']('/',auth[_0xac67('0x8')](),controller[_0xac67('0x9')]);router['get'](_0xac67('0xa'),auth[_0xac67('0x8')](),controller['show']);router[_0xac67('0xb')](_0xac67('0xc'),auth[_0xac67('0x8')](),controller[_0xac67('0xd')]);router[_0xac67('0xb')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0xac67('0xe')]);router[_0xac67('0xf')](_0xac67('0xc'),auth[_0xac67('0x8')](),controller[_0xac67('0x10')]);router[_0xac67('0x11')](_0xac67('0xa'),auth[_0xac67('0x8')](),controller[_0xac67('0x12')]);router[_0xac67('0x13')](_0xac67('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xac67('0x14')]=router; \ No newline at end of file +var _0xe7fe=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','isAuthenticated','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','destroy','exports','multer'];(function(_0x69ea92,_0x14506b){var _0x45b8ea=function(_0x2a33c0){while(--_0x2a33c0){_0x69ea92['push'](_0x69ea92['shift']());}};_0x45b8ea(++_0x14506b);}(_0xe7fe,0x17f));var _0xee7f=function(_0x24f6fb,_0xc144a7){_0x24f6fb=_0x24f6fb-0x0;var _0x94b1e4=_0xe7fe[_0x24f6fb];return _0x94b1e4;};'use strict';var multer=require(_0xee7f('0x0'));var util=require(_0xee7f('0x1'));var path=require(_0xee7f('0x2'));var timeout=require(_0xee7f('0x3'));var express=require(_0xee7f('0x4'));var router=express[_0xee7f('0x5')]();var fs_extra=require(_0xee7f('0x6'));var auth=require(_0xee7f('0x7'));var interaction=require(_0xee7f('0x8'));var config=require('../../config/environment');var controller=require(_0xee7f('0x9'));router['get']('/',auth[_0xee7f('0xa')](),controller['index']);router['get'](_0xee7f('0xb'),auth[_0xee7f('0xa')](),controller[_0xee7f('0xc')]);router[_0xee7f('0xd')](_0xee7f('0xe'),auth['isAuthenticated'](),controller[_0xee7f('0xf')]);router['get'](_0xee7f('0x10'),auth[_0xee7f('0xa')](),controller[_0xee7f('0x11')]);router[_0xee7f('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xee7f('0x12')](_0xee7f('0xe'),auth[_0xee7f('0xa')](),controller[_0xee7f('0x13')]);router[_0xee7f('0x14')](_0xee7f('0xb'),auth[_0xee7f('0xa')](),controller[_0xee7f('0x15')]);router['delete'](_0xee7f('0xb'),auth[_0xee7f('0xa')](),controller[_0xee7f('0x16')]);module[_0xee7f('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 5874784..c1e7502 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 _0xb179=['newTab','sequelize','STRING','ENUM','basic','integrationTab'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xb179,0x181));var _0x9b17=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb179[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x9b17('0x0'));module['exports']={'name':{'type':Sequelize[_0x9b17('0x1')]},'description':{'type':Sequelize[_0x9b17('0x1')]},'username':{'type':Sequelize[_0x9b17('0x1')]},'remoteUri':{'type':Sequelize[_0x9b17('0x1')]},'authType':{'type':Sequelize[_0x9b17('0x2')](_0x9b17('0x3')),'defaultValue':_0x9b17('0x3')},'password':{'type':Sequelize[_0x9b17('0x1')]},'consumerKey':{'type':Sequelize[_0x9b17('0x1')]},'consumerSecret':{'type':Sequelize[_0x9b17('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x9b17('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9b17('0x4'),_0x9b17('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x85a8=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x4509dd,_0x2ab3ec){var _0x37b0de=function(_0x17a76b){while(--_0x17a76b){_0x4509dd['push'](_0x4509dd['shift']());}};_0x37b0de(++_0x2ab3ec);}(_0x85a8,0x180));var _0x885a=function(_0x42887e,_0x501467){_0x42887e=_0x42887e-0x0;var _0x4c9bdb=_0x85a8[_0x42887e];return _0x4c9bdb;};'use strict';var Sequelize=require(_0x885a('0x0'));module[_0x885a('0x1')]={'name':{'type':Sequelize[_0x885a('0x2')]},'description':{'type':Sequelize[_0x885a('0x2')]},'username':{'type':Sequelize[_0x885a('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x885a('0x3')]('basic'),'defaultValue':_0x885a('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x885a('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x885a('0x2')]},'serverUrl':{'type':Sequelize[_0x885a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x885a('0x3')](_0x885a('0x5'),_0x885a('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 6d5a39d..52dd94e 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 _0x02d1=['base64','concat','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','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','papaparse','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','json','offset','undefined','limit','count','set','apply','reject','update','destroy','error','stack','name','index','DeskAccount','key','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','findOne','order','getConfigurations','AccountId','getSubjects','getDescriptions','channel','Subjects','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','GET','format','application/json','headers','Authorization','Basic\x20%s','%s:%s','toString'];(function(_0x4136d8,_0x2e300f){var _0xe2b951=function(_0x6480ef){while(--_0x6480ef){_0x4136d8['push'](_0x4136d8['shift']());}};_0xe2b951(++_0x2e300f);}(_0x02d1,0x1e5));var _0x102d=function(_0x49206a,_0xd7d9a9){_0x49206a=_0x49206a-0x0;var _0xd893da=_0x02d1[_0x49206a];return _0xd893da;};'use strict';var emlformat=require(_0x102d('0x0'));var rimraf=require(_0x102d('0x1'));var zipdir=require(_0x102d('0x2'));var jsonpatch=require(_0x102d('0x3'));var rp=require(_0x102d('0x4'));var moment=require(_0x102d('0x5'));var BPromise=require(_0x102d('0x6'));var Mustache=require(_0x102d('0x7'));var util=require(_0x102d('0x8'));var path=require('path');var sox=require(_0x102d('0x9'));var csv=require(_0x102d('0xa'));var ejs=require(_0x102d('0xb'));var fs=require('fs');var fs_extra=require(_0x102d('0xc'));var _=require(_0x102d('0xd'));var squel=require(_0x102d('0xe'));var crypto=require(_0x102d('0xf'));var jsforce=require(_0x102d('0x10'));var deskjs=require(_0x102d('0x11'));var toCsv=require('to-csv');var querystring=require(_0x102d('0x12'));var Papa=require(_0x102d('0x13'));var Redis=require(_0x102d('0x14'));var authService=require(_0x102d('0x15'));var qs=require(_0x102d('0x16'));var as=require(_0x102d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x102d('0x18'))(_0x102d('0x19'));var utils=require(_0x102d('0x1a'));var config=require(_0x102d('0x1b'));var licenseUtil=require(_0x102d('0x1c'));var db=require(_0x102d('0x1d'))['db'];var integrations=require(_0x102d('0x1e'));function respondWithStatusCode(_0x5744a3,_0x346be0){_0x346be0=_0x346be0||0xcc;return function(_0x2df6f0){if(_0x2df6f0){return _0x5744a3[_0x102d('0x1f')](_0x346be0);}return _0x5744a3[_0x102d('0x20')](_0x346be0)[_0x102d('0x21')]();};}function respondWithResult(_0x30d6af,_0x1ba042){_0x1ba042=_0x1ba042||0xc8;return function(_0x1a8686){if(_0x1a8686){return _0x30d6af[_0x102d('0x20')](_0x1ba042)[_0x102d('0x22')](_0x1a8686);}};}function respondWithFilteredResult(_0x428614,_0x3451e4){return function(_0x13f773){if(_0x13f773){var _0x3be3dd=typeof _0x3451e4[_0x102d('0x23')]===_0x102d('0x24')&&typeof _0x3451e4[_0x102d('0x25')]===_0x102d('0x24');var _0x516ec7=_0x13f773['count'];var _0x16c4ca=_0x3be3dd?0x0:_0x3451e4[_0x102d('0x23')];var _0x180d1b=_0x3be3dd?_0x13f773[_0x102d('0x26')]:_0x3451e4[_0x102d('0x23')]+_0x3451e4[_0x102d('0x25')];var _0x343df1;if(_0x180d1b>=_0x516ec7){_0x180d1b=_0x516ec7;_0x343df1=0xc8;}else{_0x343df1=0xce;}_0x428614[_0x102d('0x20')](_0x343df1);return _0x428614[_0x102d('0x27')]('Content-Range',_0x16c4ca+'-'+_0x180d1b+'/'+_0x516ec7)[_0x102d('0x22')](_0x13f773);}return null;};}function patchUpdates(_0x4c6f60){return function(_0x1ea94c){try{jsonpatch[_0x102d('0x28')](_0x1ea94c,_0x4c6f60,!![]);}catch(_0x4b0dee){return BPromise[_0x102d('0x29')](_0x4b0dee);}return _0x1ea94c['save']();};}function saveUpdates(_0x454975,_0x476cf8){return function(_0x471363){if(_0x471363){return _0x471363[_0x102d('0x2a')](_0x454975)['then'](function(_0x221302){return _0x221302;});}return null;};}function removeEntity(_0x4c2e14,_0x35ac35){return function(_0x2e19ea){if(_0x2e19ea){return _0x2e19ea[_0x102d('0x2b')]()['then'](function(){_0x4c2e14[_0x102d('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aa326,_0x132547){return function(_0x1ab49a){if(!_0x1ab49a){_0x3aa326[_0x102d('0x1f')](0x194);}return _0x1ab49a;};}function handleError(_0x3b1d81,_0x2e5f24){_0x2e5f24=_0x2e5f24||0x1f4;return function(_0x5f5b8d){logger[_0x102d('0x2c')](_0x5f5b8d[_0x102d('0x2d')]);if(_0x5f5b8d[_0x102d('0x2e')]){delete _0x5f5b8d[_0x102d('0x2e')];}_0x3b1d81[_0x102d('0x20')](_0x2e5f24)['send'](_0x5f5b8d);};}exports[_0x102d('0x2f')]=function(_0x5d3661,_0x280c9f){var _0x46710c={},_0x398b37={},_0x2a2af8={'count':0x0,'rows':[]};var _0x4b033b=_['map'](db[_0x102d('0x30')]['rawAttributes'],function(_0x496443){return{'name':_0x496443['fieldName'],'type':_0x496443['type'][_0x102d('0x31')]};});_0x398b37['model']=_[_0x102d('0x32')](_0x4b033b,'name');_0x398b37[_0x102d('0x33')]=_[_0x102d('0x34')](_0x5d3661[_0x102d('0x33')]);_0x398b37['filters']=_[_0x102d('0x35')](_0x398b37['model'],_0x398b37[_0x102d('0x33')]);_0x46710c[_0x102d('0x36')]=_['intersection'](_0x398b37[_0x102d('0x37')],qs[_0x102d('0x38')](_0x5d3661[_0x102d('0x33')]['fields']));_0x46710c['attributes']=_0x46710c['attributes'][_0x102d('0x39')]?_0x46710c[_0x102d('0x36')]:_0x398b37[_0x102d('0x37')];if(!_0x5d3661[_0x102d('0x33')][_0x102d('0x3a')](_0x102d('0x3b'))){_0x46710c[_0x102d('0x25')]=qs['limit'](_0x5d3661[_0x102d('0x33')][_0x102d('0x25')]);_0x46710c[_0x102d('0x23')]=qs[_0x102d('0x23')](_0x5d3661[_0x102d('0x33')][_0x102d('0x23')]);}_0x46710c['order']=qs[_0x102d('0x3c')](_0x5d3661[_0x102d('0x33')][_0x102d('0x3c')]);_0x46710c['where']=qs['filters'](_['pick'](_0x5d3661[_0x102d('0x33')],_0x398b37[_0x102d('0x3d')]),_0x4b033b);if(_0x5d3661['query'][_0x102d('0x3e')]){_0x46710c[_0x102d('0x3f')]=_[_0x102d('0x40')](_0x46710c[_0x102d('0x3f')],{'$or':_[_0x102d('0x32')](_0x4b033b,function(_0x1248b8){if(_0x1248b8[_0x102d('0x41')]!==_0x102d('0x42')){var _0x209b02={};_0x209b02[_0x1248b8['name']]={'$like':'%'+_0x5d3661[_0x102d('0x33')]['filter']+'%'};return _0x209b02;}})});}_0x46710c=_[_0x102d('0x40')]({},_0x46710c,_0x5d3661[_0x102d('0x43')]);var _0x46976c={'where':_0x46710c['where']};return db[_0x102d('0x30')][_0x102d('0x26')](_0x46976c)[_0x102d('0x44')](function(_0x215a57){_0x2a2af8[_0x102d('0x26')]=_0x215a57;if(_0x5d3661[_0x102d('0x33')][_0x102d('0x45')]){_0x46710c[_0x102d('0x46')]=[{'all':!![]}];}return db['DeskAccount'][_0x102d('0x47')](_0x46710c);})[_0x102d('0x44')](function(_0x24bda3){_0x2a2af8[_0x102d('0x48')]=_0x24bda3;return _0x2a2af8;})[_0x102d('0x44')](respondWithFilteredResult(_0x280c9f,_0x46710c))[_0x102d('0x49')](handleError(_0x280c9f,null));};exports[_0x102d('0x4a')]=function(_0x232c00,_0x2dc543){var _0x4acad8={'raw':![],'where':{'id':_0x232c00[_0x102d('0x4b')]['id']}},_0x47e986={};_0x47e986[_0x102d('0x37')]=_['keys'](db[_0x102d('0x30')][_0x102d('0x4c')]);_0x47e986[_0x102d('0x33')]=_[_0x102d('0x34')](_0x232c00[_0x102d('0x33')]);_0x47e986[_0x102d('0x3d')]=_['intersection'](_0x47e986[_0x102d('0x37')],_0x47e986[_0x102d('0x33')]);_0x4acad8[_0x102d('0x36')]=_['intersection'](_0x47e986[_0x102d('0x37')],qs[_0x102d('0x38')](_0x232c00[_0x102d('0x33')][_0x102d('0x38')]));_0x4acad8['attributes']=_0x4acad8[_0x102d('0x36')][_0x102d('0x39')]?_0x4acad8[_0x102d('0x36')]:_0x47e986[_0x102d('0x37')];if(_0x232c00[_0x102d('0x33')][_0x102d('0x45')]){_0x4acad8[_0x102d('0x46')]=[{'all':!![]}];}_0x4acad8=_[_0x102d('0x40')]({},_0x4acad8,_0x232c00[_0x102d('0x43')]);return db[_0x102d('0x30')][_0x102d('0x4d')](_0x4acad8)[_0x102d('0x44')](handleEntityNotFound(_0x2dc543,null))[_0x102d('0x44')](respondWithResult(_0x2dc543,null))[_0x102d('0x49')](handleError(_0x2dc543,null));};exports[_0x102d('0x4e')]=function(_0x373a88,_0x28e768){return db[_0x102d('0x30')][_0x102d('0x4e')](_0x373a88[_0x102d('0x4f')],{})[_0x102d('0x44')](respondWithResult(_0x28e768,0xc9))['catch'](handleError(_0x28e768,null));};exports[_0x102d('0x2a')]=function(_0x55a07e,_0xe57186){if(_0x55a07e[_0x102d('0x4f')]['id']){delete _0x55a07e[_0x102d('0x4f')]['id'];}return db[_0x102d('0x30')][_0x102d('0x4d')]({'where':{'id':_0x55a07e[_0x102d('0x4b')]['id']}})[_0x102d('0x44')](handleEntityNotFound(_0xe57186,null))[_0x102d('0x44')](saveUpdates(_0x55a07e[_0x102d('0x4f')],null))[_0x102d('0x44')](respondWithResult(_0xe57186,null))[_0x102d('0x49')](handleError(_0xe57186,null));};exports[_0x102d('0x2b')]=function(_0x409d30,_0x42a6f2){return db[_0x102d('0x30')][_0x102d('0x4d')]({'where':{'id':_0x409d30[_0x102d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x42a6f2,null))[_0x102d('0x44')](removeEntity(_0x42a6f2,null))['catch'](handleError(_0x42a6f2,null));};exports['getConfigurations']=function(_0x2c40ec,_0x5ced2d,_0x3efa2b){var _0x532be9={};var _0x20235e={};var _0xe700af;var _0x28e14f;return db[_0x102d('0x30')][_0x102d('0x50')]({'where':{'id':_0x2c40ec[_0x102d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5ced2d,null))[_0x102d('0x44')](function(_0x32a494){if(_0x32a494){_0xe700af=_0x32a494;_0x20235e[_0x102d('0x37')]=_[_0x102d('0x34')](db['DeskConfiguration'][_0x102d('0x4c')]);_0x20235e[_0x102d('0x33')]=_[_0x102d('0x34')](_0x2c40ec[_0x102d('0x33')]);_0x20235e[_0x102d('0x3d')]=_[_0x102d('0x35')](_0x20235e[_0x102d('0x37')],_0x20235e[_0x102d('0x33')]);_0x532be9[_0x102d('0x36')]=_[_0x102d('0x35')](_0x20235e[_0x102d('0x37')],qs[_0x102d('0x38')](_0x2c40ec['query'][_0x102d('0x38')]));_0x532be9[_0x102d('0x36')]=_0x532be9[_0x102d('0x36')]['length']?_0x532be9['attributes']:_0x20235e[_0x102d('0x37')];_0x532be9[_0x102d('0x51')]=qs[_0x102d('0x3c')](_0x2c40ec[_0x102d('0x33')][_0x102d('0x3c')]);_0x532be9[_0x102d('0x3f')]=qs[_0x102d('0x3d')](_['pick'](_0x2c40ec[_0x102d('0x33')],_0x20235e[_0x102d('0x3d')]));if(_0x2c40ec[_0x102d('0x33')][_0x102d('0x3e')]){_0x532be9['where']=_['merge'](_0x532be9[_0x102d('0x3f')],{'$or':_[_0x102d('0x32')](_0x532be9[_0x102d('0x36')],function(_0x5d709f){var _0x39a1a4={};_0x39a1a4[_0x5d709f]={'$like':'%'+_0x2c40ec['query']['filter']+'%'};return _0x39a1a4;})});}_0x532be9=_['merge']({},_0x532be9,_0x2c40ec[_0x102d('0x43')]);return _0xe700af[_0x102d('0x52')](_0x532be9);}})[_0x102d('0x44')](function(_0x20bcc8){if(_0x20bcc8){_0x28e14f=_0x20bcc8['length'];if(!_0x2c40ec[_0x102d('0x33')][_0x102d('0x3a')](_0x102d('0x3b'))){_0x532be9['limit']=qs[_0x102d('0x25')](_0x2c40ec['query']['limit']);_0x532be9[_0x102d('0x23')]=qs['offset'](_0x2c40ec[_0x102d('0x33')][_0x102d('0x23')]);}return _0xe700af[_0x102d('0x52')](_0x532be9);}})[_0x102d('0x44')](function(_0x4025ca){if(_0x4025ca){return _0x4025ca?{'count':_0x28e14f,'rows':_0x4025ca}:null;}})[_0x102d('0x44')](respondWithResult(_0x5ced2d,null))[_0x102d('0x49')](handleError(_0x5ced2d,null));};exports['addConfiguration']=function(_0x387068,_0x1c072d,_0x3936d5){if(_0x387068['body']['id']){delete _0x387068[_0x102d('0x4f')]['id'];}return db[_0x102d('0x30')][_0x102d('0x50')]({'where':{'id':_0x387068[_0x102d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1c072d,null))[_0x102d('0x44')](function(_0x4b064d){if(_0x4b064d){_0x387068[_0x102d('0x4f')][_0x102d('0x53')]=_0x4b064d['id'];_0x387068[_0x102d('0x4f')]['Subjects']=integrations[_0x102d('0x54')](_0x387068['body']['channel'],_0x387068[_0x102d('0x4f')][_0x102d('0x41')]);_0x387068[_0x102d('0x4f')]['Descriptions']=integrations[_0x102d('0x55')](_0x387068[_0x102d('0x4f')][_0x102d('0x56')],_0x387068[_0x102d('0x4f')][_0x102d('0x41')]);return db['DeskConfiguration'][_0x102d('0x4e')](_0x387068[_0x102d('0x4f')],{'include':[{'model':db['DeskField'],'as':_0x102d('0x57')},{'model':db[_0x102d('0x58')],'as':_0x102d('0x59')}]});}return null;})[_0x102d('0x44')](respondWithResult(_0x1c072d,null))['catch'](handleError(_0x1c072d,null));};exports[_0x102d('0x5a')]=function(_0x5e1de5,_0x2bb8d4,_0x37b397){var _0x292e59=[{'name':_0x102d('0x5b'),'label':_0x102d('0x5b'),'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 _0x3b9754='';return db[_0x102d('0x30')][_0x102d('0x50')]({'where':{'id':_0x5e1de5[_0x102d('0x4b')]['id']},'attributes':['id',_0x102d('0x5c'),_0x102d('0x5d'),_0x102d('0x5e'),_0x102d('0x5f'),_0x102d('0x60'),_0x102d('0x61'),_0x102d('0x62'),_0x102d('0x63')]})['then'](handleEntityNotFound(_0x2bb8d4,null))[_0x102d('0x44')](function(_0x4af07e){if(_0x4af07e){_0x3b9754=_0x4af07e[_0x102d('0x5c')];var _0x5d3f00=_0x3b9754[_0x102d('0x64')](-0x1);if(_0x5d3f00==='/'){_0x3b9754=_0x3b9754[_0x102d('0x65')](0x0,_0x3b9754['lastIndexOf'](_0x5d3f00));}var _0x43aab7={'method':_0x102d('0x66'),'uri':util[_0x102d('0x67')]('%s/custom_fields',_0x3b9754),'headers':{'Content-Type':_0x102d('0x68'),'Accept':'application/json'},'json':!![]};if(_0x4af07e['authType']==='basic'){_0x43aab7[_0x102d('0x69')][_0x102d('0x6a')]=util['format'](_0x102d('0x6b'),new Buffer(util[_0x102d('0x67')](_0x102d('0x6c'),_0x4af07e[_0x102d('0x5e')],_0x4af07e[_0x102d('0x5f')]))[_0x102d('0x6d')](_0x102d('0x6e')));}return rp(_0x43aab7)[_0x102d('0x44')](function(_0x581e8b){return _0x292e59[_0x102d('0x6f')](_[_0x102d('0x32')](_0x581e8b['_embedded'][_0x102d('0x70')],function(_0x1bc8d5){return{'id':_0x1bc8d5[_0x102d('0x2e')],'name':_0x1bc8d5[_0x102d('0x2e')],'type':_0x1bc8d5['type'],'active':_0x1bc8d5['active'],'label':_0x1bc8d5[_0x102d('0x71')],'custom':!![]};}));});}})[_0x102d('0x44')](function(_0x2ee74b){return{'count':_0x2ee74b[_0x102d('0x39')],'rows':_0x2ee74b};})['then'](respondWithResult(_0x2bb8d4,null))[_0x102d('0x49')](function(_0x153a7b){var _0x624770=_0x5e1de5[_0x102d('0x33')][_0x102d('0x72')]?0x1f4:_0x153a7b[_0x102d('0x73')]||0x1f4;logger['error'](_0x102d('0x74'),_0x102d('0x5a'),_0x624770,JSON[_0x102d('0x75')](_0x153a7b));delete _0x153a7b[_0x102d('0x2e')];if(_0x624770===0x191){_0x624770=0x190;}_0x2bb8d4['status'](_0x624770)[_0x102d('0x76')](_0x5e1de5[_0x102d('0x33')][_0x102d('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x153a7b[_0x102d('0x73')]}:_0x153a7b);});}; \ No newline at end of file +var _0x9a15=['../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','offset','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','catch','show','params','DeskAccount','find','create','body','getConfigurations','findOne','rawAttributes','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','tokenSecret','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','%s:%s','toString','base64','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','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','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0xcb62,_0x1da81b){var _0x3b56b4=function(_0x3ebbc7){while(--_0x3ebbc7){_0xcb62['push'](_0xcb62['shift']());}};_0x3b56b4(++_0x1da81b);}(_0x9a15,0x14c));var _0x59a1=function(_0x356518,_0x1c5e99){_0x356518=_0x356518-0x0;var _0xf45484=_0x9a15[_0x356518];return _0xf45484;};'use strict';var emlformat=require(_0x59a1('0x0'));var rimraf=require(_0x59a1('0x1'));var zipdir=require(_0x59a1('0x2'));var jsonpatch=require(_0x59a1('0x3'));var rp=require(_0x59a1('0x4'));var moment=require(_0x59a1('0x5'));var BPromise=require(_0x59a1('0x6'));var Mustache=require(_0x59a1('0x7'));var util=require(_0x59a1('0x8'));var path=require('path');var sox=require(_0x59a1('0x9'));var csv=require(_0x59a1('0xa'));var ejs=require(_0x59a1('0xb'));var fs=require('fs');var fs_extra=require(_0x59a1('0xc'));var _=require(_0x59a1('0xd'));var squel=require(_0x59a1('0xe'));var crypto=require(_0x59a1('0xf'));var jsforce=require(_0x59a1('0x10'));var deskjs=require(_0x59a1('0x11'));var toCsv=require(_0x59a1('0xa'));var querystring=require(_0x59a1('0x12'));var Papa=require(_0x59a1('0x13'));var Redis=require('ioredis');var authService=require(_0x59a1('0x14'));var qs=require(_0x59a1('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x59a1('0x16'));var logger=require('../../config/logger')(_0x59a1('0x17'));var utils=require('../../config/utils');var config=require(_0x59a1('0x18'));var licenseUtil=require(_0x59a1('0x19'));var db=require(_0x59a1('0x1a'))['db'];var integrations=require(_0x59a1('0x1b'));function respondWithStatusCode(_0xf7c26c,_0x13b7a5){_0x13b7a5=_0x13b7a5||0xcc;return function(_0x1708e1){if(_0x1708e1){return _0xf7c26c['sendStatus'](_0x13b7a5);}return _0xf7c26c[_0x59a1('0x1c')](_0x13b7a5)['end']();};}function respondWithResult(_0x2e5323,_0x35eb27){_0x35eb27=_0x35eb27||0xc8;return function(_0x368898){if(_0x368898){return _0x2e5323[_0x59a1('0x1c')](_0x35eb27)[_0x59a1('0x1d')](_0x368898);}};}function respondWithFilteredResult(_0x10864c,_0x16a29a){return function(_0xd07ca4){if(_0xd07ca4){var _0x375954=typeof _0x16a29a['offset']===_0x59a1('0x1e')&&typeof _0x16a29a[_0x59a1('0x1f')]==='undefined';var _0x54452b=_0xd07ca4['count'];var _0x53e505=_0x375954?0x0:_0x16a29a[_0x59a1('0x20')];var _0x44de7e=_0x375954?_0xd07ca4['count']:_0x16a29a[_0x59a1('0x20')]+_0x16a29a[_0x59a1('0x1f')];var _0x4b81e9;if(_0x44de7e>=_0x54452b){_0x44de7e=_0x54452b;_0x4b81e9=0xc8;}else{_0x4b81e9=0xce;}_0x10864c[_0x59a1('0x1c')](_0x4b81e9);return _0x10864c[_0x59a1('0x21')](_0x59a1('0x22'),_0x53e505+'-'+_0x44de7e+'/'+_0x54452b)[_0x59a1('0x1d')](_0xd07ca4);}return null;};}function patchUpdates(_0x20a637){return function(_0x4e910c){try{jsonpatch[_0x59a1('0x23')](_0x4e910c,_0x20a637,!![]);}catch(_0xc87985){return BPromise['reject'](_0xc87985);}return _0x4e910c[_0x59a1('0x24')]();};}function saveUpdates(_0x2213a7,_0x38c899){return function(_0x59584a){if(_0x59584a){return _0x59584a[_0x59a1('0x25')](_0x2213a7)[_0x59a1('0x26')](function(_0xe4be34){return _0xe4be34;});}return null;};}function removeEntity(_0xf25e5f,_0x3338b3){return function(_0x427d22){if(_0x427d22){return _0x427d22[_0x59a1('0x27')]()[_0x59a1('0x26')](function(){_0xf25e5f[_0x59a1('0x1c')](0xcc)[_0x59a1('0x28')]();});}};}function handleEntityNotFound(_0x4003ba,_0x4302b9){return function(_0x33a920){if(!_0x33a920){_0x4003ba['sendStatus'](0x194);}return _0x33a920;};}function handleError(_0x2ddc83,_0x49c331){_0x49c331=_0x49c331||0x1f4;return function(_0x12c719){logger[_0x59a1('0x29')](_0x12c719[_0x59a1('0x2a')]);if(_0x12c719['name']){delete _0x12c719[_0x59a1('0x2b')];}_0x2ddc83[_0x59a1('0x1c')](_0x49c331)[_0x59a1('0x2c')](_0x12c719);};}exports[_0x59a1('0x2d')]=function(_0x392f5f,_0x4be059){var _0x49eec7={},_0x3069a1={},_0x36c9b6={'count':0x0,'rows':[]};var _0x3d1941=_['map'](db['DeskAccount']['rawAttributes'],function(_0x4cbd5c){return{'name':_0x4cbd5c[_0x59a1('0x2e')],'type':_0x4cbd5c[_0x59a1('0x2f')][_0x59a1('0x30')]};});_0x3069a1[_0x59a1('0x31')]=_[_0x59a1('0x32')](_0x3d1941,_0x59a1('0x2b'));_0x3069a1[_0x59a1('0x33')]=_[_0x59a1('0x34')](_0x392f5f[_0x59a1('0x33')]);_0x3069a1[_0x59a1('0x35')]=_[_0x59a1('0x36')](_0x3069a1['model'],_0x3069a1[_0x59a1('0x33')]);_0x49eec7['attributes']=_[_0x59a1('0x36')](_0x3069a1[_0x59a1('0x31')],qs[_0x59a1('0x37')](_0x392f5f['query'][_0x59a1('0x37')]));_0x49eec7[_0x59a1('0x38')]=_0x49eec7[_0x59a1('0x38')][_0x59a1('0x39')]?_0x49eec7[_0x59a1('0x38')]:_0x3069a1[_0x59a1('0x31')];if(!_0x392f5f[_0x59a1('0x33')][_0x59a1('0x3a')](_0x59a1('0x3b'))){_0x49eec7['limit']=qs[_0x59a1('0x1f')](_0x392f5f[_0x59a1('0x33')][_0x59a1('0x1f')]);_0x49eec7[_0x59a1('0x20')]=qs[_0x59a1('0x20')](_0x392f5f[_0x59a1('0x33')][_0x59a1('0x20')]);}_0x49eec7[_0x59a1('0x3c')]=qs[_0x59a1('0x3d')](_0x392f5f[_0x59a1('0x33')][_0x59a1('0x3d')]);_0x49eec7[_0x59a1('0x3e')]=qs[_0x59a1('0x35')](_[_0x59a1('0x3f')](_0x392f5f[_0x59a1('0x33')],_0x3069a1[_0x59a1('0x35')]),_0x3d1941);if(_0x392f5f[_0x59a1('0x33')]['filter']){_0x49eec7[_0x59a1('0x3e')]=_[_0x59a1('0x40')](_0x49eec7['where'],{'$or':_['map'](_0x3d1941,function(_0x4067f6){if(_0x4067f6[_0x59a1('0x2f')]!==_0x59a1('0x41')){var _0x402fd3={};_0x402fd3[_0x4067f6[_0x59a1('0x2b')]]={'$like':'%'+_0x392f5f['query'][_0x59a1('0x42')]+'%'};return _0x402fd3;}})});}_0x49eec7=_[_0x59a1('0x40')]({},_0x49eec7,_0x392f5f[_0x59a1('0x43')]);var _0x1f4ba9={'where':_0x49eec7['where']};return db['DeskAccount'][_0x59a1('0x44')](_0x1f4ba9)[_0x59a1('0x26')](function(_0x314d8c){_0x36c9b6['count']=_0x314d8c;if(_0x392f5f['query'][_0x59a1('0x45')]){_0x49eec7[_0x59a1('0x46')]=[{'all':!![]}];}return db['DeskAccount'][_0x59a1('0x47')](_0x49eec7);})[_0x59a1('0x26')](function(_0x40c09a){_0x36c9b6['rows']=_0x40c09a;return _0x36c9b6;})['then'](respondWithFilteredResult(_0x4be059,_0x49eec7))[_0x59a1('0x48')](handleError(_0x4be059,null));};exports[_0x59a1('0x49')]=function(_0x59dda6,_0x3d6acb){var _0x7d4c52={'raw':![],'where':{'id':_0x59dda6[_0x59a1('0x4a')]['id']}},_0x4ecff1={};_0x4ecff1[_0x59a1('0x31')]=_['keys'](db[_0x59a1('0x4b')]['rawAttributes']);_0x4ecff1[_0x59a1('0x33')]=_['keys'](_0x59dda6[_0x59a1('0x33')]);_0x4ecff1['filters']=_[_0x59a1('0x36')](_0x4ecff1[_0x59a1('0x31')],_0x4ecff1[_0x59a1('0x33')]);_0x7d4c52['attributes']=_[_0x59a1('0x36')](_0x4ecff1[_0x59a1('0x31')],qs[_0x59a1('0x37')](_0x59dda6[_0x59a1('0x33')]['fields']));_0x7d4c52[_0x59a1('0x38')]=_0x7d4c52[_0x59a1('0x38')][_0x59a1('0x39')]?_0x7d4c52[_0x59a1('0x38')]:_0x4ecff1[_0x59a1('0x31')];if(_0x59dda6['query'][_0x59a1('0x45')]){_0x7d4c52['include']=[{'all':!![]}];}_0x7d4c52=_[_0x59a1('0x40')]({},_0x7d4c52,_0x59dda6['options']);return db[_0x59a1('0x4b')][_0x59a1('0x4c')](_0x7d4c52)[_0x59a1('0x26')](handleEntityNotFound(_0x3d6acb,null))['then'](respondWithResult(_0x3d6acb,null))[_0x59a1('0x48')](handleError(_0x3d6acb,null));};exports[_0x59a1('0x4d')]=function(_0x79ae17,_0x26f89d){return db[_0x59a1('0x4b')][_0x59a1('0x4d')](_0x79ae17[_0x59a1('0x4e')],{})[_0x59a1('0x26')](respondWithResult(_0x26f89d,0xc9))[_0x59a1('0x48')](handleError(_0x26f89d,null));};exports[_0x59a1('0x25')]=function(_0x5e39bd,_0x58cbce){if(_0x5e39bd[_0x59a1('0x4e')]['id']){delete _0x5e39bd[_0x59a1('0x4e')]['id'];}return db[_0x59a1('0x4b')][_0x59a1('0x4c')]({'where':{'id':_0x5e39bd['params']['id']}})[_0x59a1('0x26')](handleEntityNotFound(_0x58cbce,null))[_0x59a1('0x26')](saveUpdates(_0x5e39bd[_0x59a1('0x4e')],null))[_0x59a1('0x26')](respondWithResult(_0x58cbce,null))['catch'](handleError(_0x58cbce,null));};exports['destroy']=function(_0x24b508,_0x293244){return db[_0x59a1('0x4b')][_0x59a1('0x4c')]({'where':{'id':_0x24b508[_0x59a1('0x4a')]['id']}})[_0x59a1('0x26')](handleEntityNotFound(_0x293244,null))[_0x59a1('0x26')](removeEntity(_0x293244,null))[_0x59a1('0x48')](handleError(_0x293244,null));};exports[_0x59a1('0x4f')]=function(_0x20211b,_0x2d2e29,_0x128060){var _0x9068f8={};var _0x2eacc8={};var _0x1940b3;var _0x233d11;return db['DeskAccount'][_0x59a1('0x50')]({'where':{'id':_0x20211b['params']['id']}})[_0x59a1('0x26')](handleEntityNotFound(_0x2d2e29,null))['then'](function(_0x2a3c72){if(_0x2a3c72){_0x1940b3=_0x2a3c72;_0x2eacc8['model']=_[_0x59a1('0x34')](db['DeskConfiguration'][_0x59a1('0x51')]);_0x2eacc8['query']=_[_0x59a1('0x34')](_0x20211b[_0x59a1('0x33')]);_0x2eacc8[_0x59a1('0x35')]=_[_0x59a1('0x36')](_0x2eacc8[_0x59a1('0x31')],_0x2eacc8['query']);_0x9068f8[_0x59a1('0x38')]=_[_0x59a1('0x36')](_0x2eacc8['model'],qs[_0x59a1('0x37')](_0x20211b['query'][_0x59a1('0x37')]));_0x9068f8[_0x59a1('0x38')]=_0x9068f8[_0x59a1('0x38')][_0x59a1('0x39')]?_0x9068f8['attributes']:_0x2eacc8[_0x59a1('0x31')];_0x9068f8[_0x59a1('0x3c')]=qs['sort'](_0x20211b['query']['sort']);_0x9068f8[_0x59a1('0x3e')]=qs[_0x59a1('0x35')](_['pick'](_0x20211b['query'],_0x2eacc8[_0x59a1('0x35')]));if(_0x20211b[_0x59a1('0x33')]['filter']){_0x9068f8[_0x59a1('0x3e')]=_[_0x59a1('0x40')](_0x9068f8[_0x59a1('0x3e')],{'$or':_['map'](_0x9068f8['attributes'],function(_0x3b6932){var _0x322b19={};_0x322b19[_0x3b6932]={'$like':'%'+_0x20211b[_0x59a1('0x33')][_0x59a1('0x42')]+'%'};return _0x322b19;})});}_0x9068f8=_[_0x59a1('0x40')]({},_0x9068f8,_0x20211b['options']);return _0x1940b3[_0x59a1('0x4f')](_0x9068f8);}})[_0x59a1('0x26')](function(_0x3652fe){if(_0x3652fe){_0x233d11=_0x3652fe[_0x59a1('0x39')];if(!_0x20211b[_0x59a1('0x33')][_0x59a1('0x3a')](_0x59a1('0x3b'))){_0x9068f8['limit']=qs[_0x59a1('0x1f')](_0x20211b[_0x59a1('0x33')][_0x59a1('0x1f')]);_0x9068f8[_0x59a1('0x20')]=qs[_0x59a1('0x20')](_0x20211b['query'][_0x59a1('0x20')]);}return _0x1940b3[_0x59a1('0x4f')](_0x9068f8);}})[_0x59a1('0x26')](function(_0x3901fb){if(_0x3901fb){return _0x3901fb?{'count':_0x233d11,'rows':_0x3901fb}:null;}})[_0x59a1('0x26')](respondWithResult(_0x2d2e29,null))[_0x59a1('0x48')](handleError(_0x2d2e29,null));};exports[_0x59a1('0x52')]=function(_0x378e5e,_0x1cdf1b,_0x31aa87){if(_0x378e5e['body']['id']){delete _0x378e5e[_0x59a1('0x4e')]['id'];}return db[_0x59a1('0x4b')][_0x59a1('0x50')]({'where':{'id':_0x378e5e[_0x59a1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1cdf1b,null))['then'](function(_0x21f5fb){if(_0x21f5fb){_0x378e5e[_0x59a1('0x4e')][_0x59a1('0x53')]=_0x21f5fb['id'];_0x378e5e['body'][_0x59a1('0x54')]=integrations[_0x59a1('0x55')](_0x378e5e[_0x59a1('0x4e')]['channel'],_0x378e5e[_0x59a1('0x4e')][_0x59a1('0x2f')]);_0x378e5e[_0x59a1('0x4e')][_0x59a1('0x56')]=integrations['getDescriptions'](_0x378e5e[_0x59a1('0x4e')][_0x59a1('0x57')],_0x378e5e[_0x59a1('0x4e')][_0x59a1('0x2f')]);return db[_0x59a1('0x58')][_0x59a1('0x4d')](_0x378e5e[_0x59a1('0x4e')],{'include':[{'model':db[_0x59a1('0x59')],'as':_0x59a1('0x54')},{'model':db[_0x59a1('0x59')],'as':_0x59a1('0x56')}]});}return null;})[_0x59a1('0x26')](respondWithResult(_0x1cdf1b,null))['catch'](handleError(_0x1cdf1b,null));};exports[_0x59a1('0x5a')]=function(_0x3bb07c,_0x1314a7,_0x3b544b){var _0x30359d=[{'name':_0x59a1('0x5b'),'label':_0x59a1('0x5b'),'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 _0x22ffde='';return db['DeskAccount'][_0x59a1('0x50')]({'where':{'id':_0x3bb07c[_0x59a1('0x4a')]['id']},'attributes':['id',_0x59a1('0x5c'),_0x59a1('0x5d'),_0x59a1('0x5e'),_0x59a1('0x5f'),_0x59a1('0x60'),_0x59a1('0x61'),'token',_0x59a1('0x62')]})[_0x59a1('0x26')](handleEntityNotFound(_0x1314a7,null))[_0x59a1('0x26')](function(_0x4ec7b3){if(_0x4ec7b3){_0x22ffde=_0x4ec7b3[_0x59a1('0x5c')];var _0x276ffc=_0x22ffde[_0x59a1('0x63')](-0x1);if(_0x276ffc==='/'){_0x22ffde=_0x22ffde[_0x59a1('0x64')](0x0,_0x22ffde[_0x59a1('0x65')](_0x276ffc));}var _0x3cb7f8={'method':'GET','uri':util[_0x59a1('0x66')](_0x59a1('0x67'),_0x22ffde),'headers':{'Content-Type':_0x59a1('0x68'),'Accept':'application/json'},'json':!![]};if(_0x4ec7b3[_0x59a1('0x5d')]===_0x59a1('0x69')){_0x3cb7f8[_0x59a1('0x6a')]['Authorization']=util[_0x59a1('0x66')](_0x59a1('0x6b'),new Buffer(util[_0x59a1('0x66')](_0x59a1('0x6c'),_0x4ec7b3[_0x59a1('0x5e')],_0x4ec7b3[_0x59a1('0x5f')]))[_0x59a1('0x6d')](_0x59a1('0x6e')));}return rp(_0x3cb7f8)[_0x59a1('0x26')](function(_0x360d96){return _0x30359d['concat'](_[_0x59a1('0x32')](_0x360d96[_0x59a1('0x6f')][_0x59a1('0x70')],function(_0x5de850){return{'id':_0x5de850[_0x59a1('0x2b')],'name':_0x5de850['name'],'type':_0x5de850[_0x59a1('0x2f')],'active':_0x5de850[_0x59a1('0x71')],'label':_0x5de850[_0x59a1('0x72')],'custom':!![]};}));});}})[_0x59a1('0x26')](function(_0x4e7b8c){return{'count':_0x4e7b8c[_0x59a1('0x39')],'rows':_0x4e7b8c};})[_0x59a1('0x26')](respondWithResult(_0x1314a7,null))[_0x59a1('0x48')](function(_0x37ecce){var _0x74b792=_0x3bb07c['query'][_0x59a1('0x73')]?0x1f4:_0x37ecce[_0x59a1('0x74')]||0x1f4;logger[_0x59a1('0x29')](_0x59a1('0x75'),'getFields',_0x74b792,JSON['stringify'](_0x37ecce));delete _0x37ecce[_0x59a1('0x2b')];if(_0x74b792===0x191){_0x74b792=0x190;}_0x1314a7[_0x59a1('0x1c')](_0x74b792)[_0x59a1('0x2c')](_0x3bb07c['query'][_0x59a1('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x37ecce[_0x59a1('0x74')]}:_0x37ecce);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 154dc79..3e7206b 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 _0x8b8b=['api','moment','bluebird','request-promise','path','./intDeskAccount.attributes','DeskAccount','int_desk_accounts','util','../../config/logger'];(function(_0xbb8027,_0x2a601e){var _0x348bbc=function(_0x2c138d){while(--_0x2c138d){_0xbb8027['push'](_0xbb8027['shift']());}};_0x348bbc(++_0x2a601e);}(_0x8b8b,0xa8));var _0xb8b8=function(_0x24e01b,_0x4ad77e){_0x24e01b=_0x24e01b-0x0;var _0x7ab785=_0x8b8b[_0x24e01b];return _0x7ab785;};'use strict';var _=require('lodash');var util=require(_0xb8b8('0x0'));var logger=require(_0xb8b8('0x1'))(_0xb8b8('0x2'));var moment=require(_0xb8b8('0x3'));var BPromise=require(_0xb8b8('0x4'));var rp=require(_0xb8b8('0x5'));var fs=require('fs');var path=require(_0xb8b8('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb8b8('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4e1212,_0x2fe606){return _0x4e1212['define'](_0xb8b8('0x8'),attributes,{'tableName':_0xb8b8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcad8=['util','moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','DeskAccount','int_desk_accounts','lodash'];(function(_0x5a7372,_0x26ed53){var _0x2f359d=function(_0x500018){while(--_0x500018){_0x5a7372['push'](_0x5a7372['shift']());}};_0x2f359d(++_0x26ed53);}(_0xcad8,0xdb));var _0x8cad=function(_0x3885f5,_0x19ac74){_0x3885f5=_0x3885f5-0x0;var _0x263902=_0xcad8[_0x3885f5];return _0x263902;};'use strict';var _=require(_0x8cad('0x0'));var util=require(_0x8cad('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8cad('0x2'));var BPromise=require('bluebird');var rp=require(_0x8cad('0x3'));var fs=require('fs');var path=require(_0x8cad('0x4'));var rimraf=require(_0x8cad('0x5'));var config=require(_0x8cad('0x6'));var attributes=require(_0x8cad('0x7'));var integrations=require(_0x8cad('0x8'));module['exports']=function(_0x4e8d98,_0x179e0c){return _0x4e8d98['define'](_0x8cad('0x9'),attributes,{'tableName':_0x8cad('0xa'),'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 f403d7b..1129052 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 _0x0845=['attributes','GetDeskAccount','debug','stringify','DeskAccount','find','ShowDeskAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','findAll','options','raw','where','limit','include','map','model'];(function(_0xad6ad6,_0x2d5164){var _0x299b03=function(_0x27d6c0){while(--_0x27d6c0){_0xad6ad6['push'](_0xad6ad6['shift']());}};_0x299b03(++_0x2d5164);}(_0x0845,0xd9));var _0x5084=function(_0x25a9f1,_0x1d857d){_0x25a9f1=_0x25a9f1-0x0;var _0x9bf1e=_0x0845[_0x25a9f1];return _0x9bf1e;};'use strict';var _=require(_0x5084('0x0'));var util=require('util');var moment=require(_0x5084('0x1'));var BPromise=require('bluebird');var rs=require(_0x5084('0x2'));var fs=require('fs');var Redis=require(_0x5084('0x3'));var db=require(_0x5084('0x4'))['db'];var utils=require(_0x5084('0x5'));var logger=require(_0x5084('0x6'))(_0x5084('0x7'));var config=require(_0x5084('0x8'));var jayson=require(_0x5084('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf77eda,_0x7f1a03,_0x5dc5ab){return new BPromise(function(_0x53bb5d,_0x38882b){return client[_0x5084('0xa')](_0xf77eda,_0x5dc5ab)[_0x5084('0xb')](function(_0xf61dee){logger[_0x5084('0xc')](_0x5084('0xd'),_0x7f1a03,'request\x20sent');logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x7f1a03,_0x5084('0xe'),JSON['stringify'](_0xf61dee));if(_0xf61dee['error']){if(_0xf61dee['error'][_0x5084('0xf')]===0x1f4){logger[_0x5084('0x10')](_0x5084('0xd'),_0x7f1a03,_0xf61dee[_0x5084('0x10')]['message']);return _0x38882b(_0xf61dee[_0x5084('0x10')][_0x5084('0x11')]);}logger[_0x5084('0x10')]('DeskAccount,\x20%s,\x20%s',_0x7f1a03,_0xf61dee[_0x5084('0x10')][_0x5084('0x11')]);return _0x53bb5d(_0xf61dee[_0x5084('0x10')][_0x5084('0x11')]);}else{logger[_0x5084('0xc')]('DeskAccount,\x20%s,\x20%s',_0x7f1a03,_0x5084('0xe'));_0x53bb5d(_0xf61dee[_0x5084('0x12')][_0x5084('0x11')]);}})[_0x5084('0x13')](function(_0x360975){logger['error'](_0x5084('0xd'),_0x7f1a03,_0x360975);_0x38882b(_0x360975);});});}exports['GetDeskAccount']=function(_0x158720){var _0x25865e=this;return new Promise(function(_0x390c8f,_0x4167e6){return db['DeskAccount'][_0x5084('0x14')]({'raw':_0x158720[_0x5084('0x15')]?_0x158720[_0x5084('0x15')][_0x5084('0x16')]===undefined?!![]:![]:!![],'where':_0x158720['options']?_0x158720[_0x5084('0x15')][_0x5084('0x17')]||null:null,'attributes':_0x158720[_0x5084('0x15')]?_0x158720['options']['attributes']||null:null,'limit':_0x158720[_0x5084('0x15')]?_0x158720[_0x5084('0x15')][_0x5084('0x18')]||null:null,'include':_0x158720['options']?_0x158720[_0x5084('0x15')][_0x5084('0x19')]?_[_0x5084('0x1a')](_0x158720['options'][_0x5084('0x19')],function(_0x19ce7a){return{'model':db[_0x19ce7a[_0x5084('0x1b')]],'as':_0x19ce7a['as'],'attributes':_0x19ce7a['attributes'],'include':_0x19ce7a[_0x5084('0x19')]?_[_0x5084('0x1a')](_0x19ce7a[_0x5084('0x19')],function(_0x40bfe2){return{'model':db[_0x40bfe2[_0x5084('0x1b')]],'as':_0x40bfe2['as'],'attributes':_0x40bfe2[_0x5084('0x1c')],'include':_0x40bfe2[_0x5084('0x19')]?_[_0x5084('0x1a')](_0x40bfe2[_0x5084('0x19')],function(_0x1d078e){return{'model':db[_0x1d078e[_0x5084('0x1b')]],'as':_0x1d078e['as'],'attributes':_0x1d078e['attributes']};}):[]};}):[]};}):[]:[]})[_0x5084('0xb')](function(_0x42dddf){logger[_0x5084('0xc')](_0x5084('0x1d'),_0x158720);logger[_0x5084('0x1e')]('GetDeskAccount',_0x158720,JSON[_0x5084('0x1f')](_0x42dddf));_0x390c8f(_0x42dddf);})['catch'](function(_0x5f2015){logger[_0x5084('0x10')]('GetDeskAccount',_0x5f2015[_0x5084('0x11')],_0x158720);_0x4167e6(_0x25865e['error'](0x1f4,_0x5f2015[_0x5084('0x11')]));});});};exports['ShowDeskAccount']=function(_0x24e6fe){var _0x55894e=this;return new Promise(function(_0x4aff5b,_0x7c62c1){return db[_0x5084('0x20')][_0x5084('0x21')]({'raw':_0x24e6fe['options']?_0x24e6fe[_0x5084('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x24e6fe[_0x5084('0x15')]?_0x24e6fe[_0x5084('0x15')]['where']||null:null,'attributes':_0x24e6fe['options']?_0x24e6fe['options'][_0x5084('0x1c')]||null:null,'include':_0x24e6fe['options']?_0x24e6fe[_0x5084('0x15')][_0x5084('0x19')]?_['map'](_0x24e6fe[_0x5084('0x15')][_0x5084('0x19')],function(_0x31b343){return{'model':db[_0x31b343['model']],'as':_0x31b343['as'],'attributes':_0x31b343['attributes'],'include':_0x31b343[_0x5084('0x19')]?_[_0x5084('0x1a')](_0x31b343['include'],function(_0x9898fe){return{'model':db[_0x9898fe[_0x5084('0x1b')]],'as':_0x9898fe['as'],'attributes':_0x9898fe[_0x5084('0x1c')],'include':_0x9898fe['include']?_[_0x5084('0x1a')](_0x9898fe['include'],function(_0x18c98c){return{'model':db[_0x18c98c['model']],'as':_0x18c98c['as'],'attributes':_0x18c98c[_0x5084('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5084('0xb')](function(_0x522ae9){logger['info'](_0x5084('0x22'),_0x24e6fe);logger[_0x5084('0x1e')]('ShowDeskAccount',_0x24e6fe,JSON[_0x5084('0x1f')](_0x522ae9));_0x4aff5b(_0x522ae9);})[_0x5084('0x13')](function(_0x5dd310){logger[_0x5084('0x10')](_0x5084('0x22'),_0x5dd310[_0x5084('0x11')],_0x24e6fe);_0x7c62c1(_0x55894e[_0x5084('0x10')](0x1f4,_0x5dd310[_0x5084('0x11')]));});});}; \ No newline at end of file +var _0xfe8f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetDeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','debug','catch','ShowDeskAccount','DeskAccount','find','lodash','moment','ioredis'];(function(_0x240ed0,_0x342564){var _0x21beec=function(_0x113f74){while(--_0x113f74){_0x240ed0['push'](_0x240ed0['shift']());}};_0x21beec(++_0x342564);}(_0xfe8f,0x69));var _0xffe8=function(_0x285d70,_0x551b70){_0x285d70=_0x285d70-0x0;var _0x15ad2d=_0xfe8f[_0x285d70];return _0x15ad2d;};'use strict';var _=require(_0xffe8('0x0'));var util=require('util');var moment=require(_0xffe8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xffe8('0x2'));var db=require(_0xffe8('0x3'))['db'];var utils=require(_0xffe8('0x4'));var logger=require(_0xffe8('0x5'))(_0xffe8('0x6'));var config=require(_0xffe8('0x7'));var jayson=require(_0xffe8('0x8'));var client=jayson[_0xffe8('0x9')][_0xffe8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x385ab9,_0x5492e0,_0x31e030){return new BPromise(function(_0x367333,_0x467751){return client[_0xffe8('0xb')](_0x385ab9,_0x31e030)[_0xffe8('0xc')](function(_0x489a1e){logger['info'](_0xffe8('0xd'),_0x5492e0,_0xffe8('0xe'));logger['debug'](_0xffe8('0xf'),_0x5492e0,_0xffe8('0xe'),JSON[_0xffe8('0x10')](_0x489a1e));if(_0x489a1e[_0xffe8('0x11')]){if(_0x489a1e[_0xffe8('0x11')]['code']===0x1f4){logger[_0xffe8('0x11')](_0xffe8('0xd'),_0x5492e0,_0x489a1e[_0xffe8('0x11')][_0xffe8('0x12')]);return _0x467751(_0x489a1e[_0xffe8('0x11')][_0xffe8('0x12')]);}logger['error'](_0xffe8('0xd'),_0x5492e0,_0x489a1e[_0xffe8('0x11')][_0xffe8('0x12')]);return _0x367333(_0x489a1e['error'][_0xffe8('0x12')]);}else{logger[_0xffe8('0x13')](_0xffe8('0xd'),_0x5492e0,'request\x20sent');_0x367333(_0x489a1e[_0xffe8('0x14')][_0xffe8('0x12')]);}})['catch'](function(_0xa8558b){logger[_0xffe8('0x11')](_0xffe8('0xd'),_0x5492e0,_0xa8558b);_0x467751(_0xa8558b);});});}exports[_0xffe8('0x15')]=function(_0xf8e7ca){var _0x3c1e97=this;return new Promise(function(_0x4592fe,_0xb72b7c){return db['DeskAccount'][_0xffe8('0x16')]({'raw':_0xf8e7ca[_0xffe8('0x17')]?_0xf8e7ca[_0xffe8('0x17')][_0xffe8('0x18')]===undefined?!![]:![]:!![],'where':_0xf8e7ca[_0xffe8('0x17')]?_0xf8e7ca['options'][_0xffe8('0x19')]||null:null,'attributes':_0xf8e7ca[_0xffe8('0x17')]?_0xf8e7ca[_0xffe8('0x17')][_0xffe8('0x1a')]||null:null,'limit':_0xf8e7ca['options']?_0xf8e7ca[_0xffe8('0x17')][_0xffe8('0x1b')]||null:null,'include':_0xf8e7ca['options']?_0xf8e7ca[_0xffe8('0x17')]['include']?_['map'](_0xf8e7ca[_0xffe8('0x17')][_0xffe8('0x1c')],function(_0x3488f3){return{'model':db[_0x3488f3['model']],'as':_0x3488f3['as'],'attributes':_0x3488f3[_0xffe8('0x1a')],'include':_0x3488f3[_0xffe8('0x1c')]?_['map'](_0x3488f3[_0xffe8('0x1c')],function(_0x26beb4){return{'model':db[_0x26beb4[_0xffe8('0x1d')]],'as':_0x26beb4['as'],'attributes':_0x26beb4[_0xffe8('0x1a')],'include':_0x26beb4[_0xffe8('0x1c')]?_[_0xffe8('0x1e')](_0x26beb4['include'],function(_0xcd047c){return{'model':db[_0xcd047c[_0xffe8('0x1d')]],'as':_0xcd047c['as'],'attributes':_0xcd047c[_0xffe8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xffe8('0xc')](function(_0x432057){logger[_0xffe8('0x13')]('GetDeskAccount',_0xf8e7ca);logger[_0xffe8('0x1f')](_0xffe8('0x15'),_0xf8e7ca,JSON[_0xffe8('0x10')](_0x432057));_0x4592fe(_0x432057);})[_0xffe8('0x20')](function(_0x87686b){logger[_0xffe8('0x11')](_0xffe8('0x15'),_0x87686b[_0xffe8('0x12')],_0xf8e7ca);_0xb72b7c(_0x3c1e97[_0xffe8('0x11')](0x1f4,_0x87686b[_0xffe8('0x12')]));});});};exports[_0xffe8('0x21')]=function(_0x4d4c23){var _0x301d87=this;return new Promise(function(_0x2789f3,_0x55eb9c){return db[_0xffe8('0x22')][_0xffe8('0x23')]({'raw':_0x4d4c23['options']?_0x4d4c23[_0xffe8('0x17')][_0xffe8('0x18')]===undefined?!![]:![]:!![],'where':_0x4d4c23[_0xffe8('0x17')]?_0x4d4c23[_0xffe8('0x17')][_0xffe8('0x19')]||null:null,'attributes':_0x4d4c23['options']?_0x4d4c23[_0xffe8('0x17')]['attributes']||null:null,'include':_0x4d4c23['options']?_0x4d4c23[_0xffe8('0x17')]['include']?_['map'](_0x4d4c23[_0xffe8('0x17')][_0xffe8('0x1c')],function(_0xfd81b2){return{'model':db[_0xfd81b2[_0xffe8('0x1d')]],'as':_0xfd81b2['as'],'attributes':_0xfd81b2[_0xffe8('0x1a')],'include':_0xfd81b2[_0xffe8('0x1c')]?_['map'](_0xfd81b2[_0xffe8('0x1c')],function(_0x4e4259){return{'model':db[_0x4e4259[_0xffe8('0x1d')]],'as':_0x4e4259['as'],'attributes':_0x4e4259[_0xffe8('0x1a')],'include':_0x4e4259['include']?_[_0xffe8('0x1e')](_0x4e4259['include'],function(_0x14c027){return{'model':db[_0x14c027[_0xffe8('0x1d')]],'as':_0x14c027['as'],'attributes':_0x14c027[_0xffe8('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x276d69){logger[_0xffe8('0x13')](_0xffe8('0x21'),_0x4d4c23);logger[_0xffe8('0x1f')](_0xffe8('0x21'),_0x4d4c23,JSON['stringify'](_0x276d69));_0x2789f3(_0x276d69);})[_0xffe8('0x20')](function(_0x205279){logger[_0xffe8('0x11')](_0xffe8('0x21'),_0x205279[_0xffe8('0x12')],_0x4d4c23);_0x55eb9c(_0x301d87['error'](0x1f4,_0x205279['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index db634ba..222f8c1 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x254bb9,_0x494838){var _0x223fcc=function(_0x9307c7){while(--_0x9307c7){_0x254bb9['push'](_0x254bb9['shift']());}};_0x223fcc(++_0x494838);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x1bf0cd,_0x14fd85){var _0x16c040=function(_0x12609b){while(--_0x12609b){_0x1bf0cd['push'](_0x1bf0cd['shift']());}};_0x16c040(++_0x14fd85);}(_0xedd9,0xfc));var _0x9edd=function(_0x327c2c,_0x273cc5){_0x327c2c=_0x327c2c-0x0;var _0x533fb2=_0xedd9[_0x327c2c];return _0x533fb2;};'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('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 937aedf..b0319fc 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 _0x2948=['exports','STRING','sequelize'];(function(_0x2b7e52,_0x2a4b8f){var _0x4c55d7=function(_0x127660){while(--_0x127660){_0x2b7e52['push'](_0x2b7e52['shift']());}};_0x4c55d7(++_0x2a4b8f);}(_0x2948,0xef));var _0x8294=function(_0x2dcbe2,_0xd779f3){_0x2dcbe2=_0x2dcbe2-0x0;var _0x372f90=_0x2948[_0x2dcbe2];return _0x372f90;};'use strict';var Sequelize=require(_0x8294('0x0'));module[_0x8294('0x1')]={'name':{'type':Sequelize[_0x8294('0x2')]},'description':{'type':Sequelize[_0x8294('0x2')]}}; \ No newline at end of file +var _0x2b03=['exports','STRING','sequelize'];(function(_0x43969f,_0x215367){var _0x5118ba=function(_0x5aa127){while(--_0x5aa127){_0x43969f['push'](_0x43969f['shift']());}};_0x5118ba(++_0x215367);}(_0x2b03,0x1b5));var _0x32b0=function(_0x491544,_0x5874f1){_0x491544=_0x491544-0x0;var _0x33cbdb=_0x2b03[_0x491544];return _0x33cbdb;};'use strict';var Sequelize=require(_0x32b0('0x0'));module[_0x32b0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x32b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 8b21391..1e156a1 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 _0x0289=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','stack','name','send','index','map','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','DeskConfiguration','includeAll','rows','catch','show','include','find','create','body','params','getFields','DeskField','rawAttributes','order','filter','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path'];(function(_0x12807b,_0x7c0dfb){var _0x5a676e=function(_0x2cb9d9){while(--_0x2cb9d9){_0x12807b['push'](_0x12807b['shift']());}};_0x5a676e(++_0x7c0dfb);}(_0x0289,0x9a));var _0x9028=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0x0289[_0x421263];return _0x34e4b5;};'use strict';var emlformat=require(_0x9028('0x0'));var rimraf=require(_0x9028('0x1'));var zipdir=require(_0x9028('0x2'));var jsonpatch=require(_0x9028('0x3'));var rp=require(_0x9028('0x4'));var moment=require('moment');var BPromise=require(_0x9028('0x5'));var Mustache=require(_0x9028('0x6'));var util=require('util');var path=require(_0x9028('0x7'));var sox=require(_0x9028('0x8'));var csv=require(_0x9028('0x9'));var ejs=require(_0x9028('0xa'));var fs=require('fs');var fs_extra=require(_0x9028('0xb'));var _=require(_0x9028('0xc'));var squel=require(_0x9028('0xd'));var crypto=require('crypto');var jsforce=require(_0x9028('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9028('0x9'));var querystring=require(_0x9028('0xf'));var Papa=require('papaparse');var Redis=require(_0x9028('0x10'));var authService=require(_0x9028('0x11'));var qs=require(_0x9028('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9028('0x13'));var logger=require('../../config/logger')(_0x9028('0x14'));var utils=require('../../config/utils');var config=require(_0x9028('0x15'));var licenseUtil=require(_0x9028('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dd089,_0x5d4908){_0x5d4908=_0x5d4908||0xcc;return function(_0x15cd0d){if(_0x15cd0d){return _0x5dd089[_0x9028('0x17')](_0x5d4908);}return _0x5dd089[_0x9028('0x18')](_0x5d4908)[_0x9028('0x19')]();};}function respondWithResult(_0x42dbec,_0xa15821){_0xa15821=_0xa15821||0xc8;return function(_0x449750){if(_0x449750){return _0x42dbec[_0x9028('0x18')](_0xa15821)[_0x9028('0x1a')](_0x449750);}};}function respondWithFilteredResult(_0x3f27e0,_0x7210a4){return function(_0x486db7){if(_0x486db7){var _0x34f7df=typeof _0x7210a4[_0x9028('0x1b')]===_0x9028('0x1c')&&typeof _0x7210a4[_0x9028('0x1d')]===_0x9028('0x1c');var _0x377b98=_0x486db7[_0x9028('0x1e')];var _0x510a5b=_0x34f7df?0x0:_0x7210a4['offset'];var _0x4ec5a0=_0x34f7df?_0x486db7[_0x9028('0x1e')]:_0x7210a4[_0x9028('0x1b')]+_0x7210a4['limit'];var _0x22c8ef;if(_0x4ec5a0>=_0x377b98){_0x4ec5a0=_0x377b98;_0x22c8ef=0xc8;}else{_0x22c8ef=0xce;}_0x3f27e0[_0x9028('0x18')](_0x22c8ef);return _0x3f27e0['set'](_0x9028('0x1f'),_0x510a5b+'-'+_0x4ec5a0+'/'+_0x377b98)[_0x9028('0x1a')](_0x486db7);}return null;};}function patchUpdates(_0x4c1f76){return function(_0x114712){try{jsonpatch[_0x9028('0x20')](_0x114712,_0x4c1f76,!![]);}catch(_0x77ad8d){return BPromise['reject'](_0x77ad8d);}return _0x114712[_0x9028('0x21')]();};}function saveUpdates(_0x45f461,_0x5e7f24){return function(_0x4b1df5){if(_0x4b1df5){return _0x4b1df5[_0x9028('0x22')](_0x45f461)['then'](function(_0x45dec3){return _0x45dec3;});}return null;};}function removeEntity(_0x3df4b3,_0x47808b){return function(_0x5713c0){if(_0x5713c0){return _0x5713c0['destroy']()[_0x9028('0x23')](function(){_0x3df4b3[_0x9028('0x18')](0xcc)[_0x9028('0x19')]();});}};}function handleEntityNotFound(_0x291b3a,_0x291ffe){return function(_0x462132){if(!_0x462132){_0x291b3a[_0x9028('0x17')](0x194);}return _0x462132;};}function handleError(_0x5aca24,_0x1d159c){_0x1d159c=_0x1d159c||0x1f4;return function(_0x4eef49){logger['error'](_0x4eef49[_0x9028('0x24')]);if(_0x4eef49[_0x9028('0x25')]){delete _0x4eef49[_0x9028('0x25')];}_0x5aca24[_0x9028('0x18')](_0x1d159c)[_0x9028('0x26')](_0x4eef49);};}exports[_0x9028('0x27')]=function(_0x319706,_0x4de46b){var _0x1ff25b={},_0x179de2={},_0x52aec7={'count':0x0,'rows':[]};var _0x393f60=_[_0x9028('0x28')](db['DeskConfiguration']['rawAttributes'],function(_0x3843d2){return{'name':_0x3843d2[_0x9028('0x29')],'type':_0x3843d2[_0x9028('0x2a')]['key']};});_0x179de2[_0x9028('0x2b')]=_[_0x9028('0x28')](_0x393f60,_0x9028('0x25'));_0x179de2[_0x9028('0x2c')]=_[_0x9028('0x2d')](_0x319706[_0x9028('0x2c')]);_0x179de2['filters']=_[_0x9028('0x2e')](_0x179de2[_0x9028('0x2b')],_0x179de2[_0x9028('0x2c')]);_0x1ff25b[_0x9028('0x2f')]=_['intersection'](_0x179de2['model'],qs['fields'](_0x319706[_0x9028('0x2c')][_0x9028('0x30')]));_0x1ff25b[_0x9028('0x2f')]=_0x1ff25b['attributes'][_0x9028('0x31')]?_0x1ff25b[_0x9028('0x2f')]:_0x179de2['model'];if(!_0x319706[_0x9028('0x2c')]['hasOwnProperty'](_0x9028('0x32'))){_0x1ff25b[_0x9028('0x1d')]=qs[_0x9028('0x1d')](_0x319706[_0x9028('0x2c')][_0x9028('0x1d')]);_0x1ff25b['offset']=qs[_0x9028('0x1b')](_0x319706['query']['offset']);}_0x1ff25b['order']=qs[_0x9028('0x33')](_0x319706[_0x9028('0x2c')]['sort']);_0x1ff25b[_0x9028('0x34')]=qs[_0x9028('0x35')](_[_0x9028('0x36')](_0x319706[_0x9028('0x2c')],_0x179de2[_0x9028('0x35')]),_0x393f60);if(_0x319706[_0x9028('0x2c')]['filter']){_0x1ff25b['where']=_['merge'](_0x1ff25b[_0x9028('0x34')],{'$or':_[_0x9028('0x28')](_0x393f60,function(_0x1f3b5e){if(_0x1f3b5e['type']!==_0x9028('0x37')){var _0x55630c={};_0x55630c[_0x1f3b5e[_0x9028('0x25')]]={'$like':'%'+_0x319706['query']['filter']+'%'};return _0x55630c;}})});}_0x1ff25b=_[_0x9028('0x38')]({},_0x1ff25b,_0x319706[_0x9028('0x39')]);var _0x51ad0b={'where':_0x1ff25b[_0x9028('0x34')]};return db[_0x9028('0x3a')][_0x9028('0x1e')](_0x51ad0b)[_0x9028('0x23')](function(_0x510e27){_0x52aec7[_0x9028('0x1e')]=_0x510e27;if(_0x319706[_0x9028('0x2c')][_0x9028('0x3b')]){_0x1ff25b['include']=[{'all':!![]}];}return db[_0x9028('0x3a')]['findAll'](_0x1ff25b);})[_0x9028('0x23')](function(_0x19ad06){_0x52aec7[_0x9028('0x3c')]=_0x19ad06;return _0x52aec7;})[_0x9028('0x23')](respondWithFilteredResult(_0x4de46b,_0x1ff25b))[_0x9028('0x3d')](handleError(_0x4de46b,null));};exports[_0x9028('0x3e')]=function(_0x101aae,_0x1acaee){var _0x4443ef={'raw':![],'where':{'id':_0x101aae['params']['id']}},_0x29d7b7={};_0x29d7b7[_0x9028('0x2b')]=_['keys'](db[_0x9028('0x3a')]['rawAttributes']);_0x29d7b7[_0x9028('0x2c')]=_[_0x9028('0x2d')](_0x101aae[_0x9028('0x2c')]);_0x29d7b7['filters']=_[_0x9028('0x2e')](_0x29d7b7[_0x9028('0x2b')],_0x29d7b7[_0x9028('0x2c')]);_0x4443ef['attributes']=_['intersection'](_0x29d7b7['model'],qs['fields'](_0x101aae[_0x9028('0x2c')][_0x9028('0x30')]));_0x4443ef[_0x9028('0x2f')]=_0x4443ef[_0x9028('0x2f')]['length']?_0x4443ef[_0x9028('0x2f')]:_0x29d7b7[_0x9028('0x2b')];if(_0x101aae[_0x9028('0x2c')][_0x9028('0x3b')]){_0x4443ef[_0x9028('0x3f')]=[{'all':!![]}];}_0x4443ef=_[_0x9028('0x38')]({},_0x4443ef,_0x101aae[_0x9028('0x39')]);return db['DeskConfiguration'][_0x9028('0x40')](_0x4443ef)[_0x9028('0x23')](handleEntityNotFound(_0x1acaee,null))[_0x9028('0x23')](respondWithResult(_0x1acaee,null))[_0x9028('0x3d')](handleError(_0x1acaee,null));};exports['create']=function(_0x19837a,_0x45dce5){return db['DeskConfiguration'][_0x9028('0x41')](_0x19837a[_0x9028('0x42')],{})[_0x9028('0x23')](respondWithResult(_0x45dce5,0xc9))['catch'](handleError(_0x45dce5,null));};exports[_0x9028('0x22')]=function(_0x5d28b3,_0x1448bc){if(_0x5d28b3[_0x9028('0x42')]['id']){delete _0x5d28b3[_0x9028('0x42')]['id'];}return db[_0x9028('0x3a')][_0x9028('0x40')]({'where':{'id':_0x5d28b3[_0x9028('0x43')]['id']}})['then'](handleEntityNotFound(_0x1448bc,null))[_0x9028('0x23')](saveUpdates(_0x5d28b3[_0x9028('0x42')],null))['then'](respondWithResult(_0x1448bc,null))[_0x9028('0x3d')](handleError(_0x1448bc,null));};exports['destroy']=function(_0x3bd9eb,_0x7adfd7){return db[_0x9028('0x3a')][_0x9028('0x40')]({'where':{'id':_0x3bd9eb[_0x9028('0x43')]['id']}})[_0x9028('0x23')](handleEntityNotFound(_0x7adfd7,null))[_0x9028('0x23')](removeEntity(_0x7adfd7,null))[_0x9028('0x3d')](handleError(_0x7adfd7,null));};exports[_0x9028('0x44')]=function(_0x27b441,_0x4a07c7,_0x277de1){var _0x3c591b={};var _0x2a52b2={};var _0x3957e4;var _0x3d2219;return db[_0x9028('0x3a')]['findOne']({'where':{'id':_0x27b441[_0x9028('0x43')]['id']}})[_0x9028('0x23')](handleEntityNotFound(_0x4a07c7,null))[_0x9028('0x23')](function(_0x158e7a){if(_0x158e7a){_0x3957e4=_0x158e7a;_0x2a52b2[_0x9028('0x2b')]=_[_0x9028('0x2d')](db[_0x9028('0x45')][_0x9028('0x46')]);_0x2a52b2[_0x9028('0x2c')]=_['keys'](_0x27b441[_0x9028('0x2c')]);_0x2a52b2[_0x9028('0x35')]=_['intersection'](_0x2a52b2['model'],_0x2a52b2[_0x9028('0x2c')]);_0x3c591b[_0x9028('0x2f')]=_[_0x9028('0x2e')](_0x2a52b2[_0x9028('0x2b')],qs[_0x9028('0x30')](_0x27b441['query'][_0x9028('0x30')]));_0x3c591b[_0x9028('0x2f')]=_0x3c591b[_0x9028('0x2f')][_0x9028('0x31')]?_0x3c591b[_0x9028('0x2f')]:_0x2a52b2[_0x9028('0x2b')];_0x3c591b[_0x9028('0x47')]=qs[_0x9028('0x33')](_0x27b441['query']['sort']);_0x3c591b[_0x9028('0x34')]=qs[_0x9028('0x35')](_[_0x9028('0x36')](_0x27b441[_0x9028('0x2c')],_0x2a52b2[_0x9028('0x35')]));if(_0x27b441['query'][_0x9028('0x48')]){_0x3c591b[_0x9028('0x34')]=_[_0x9028('0x38')](_0x3c591b[_0x9028('0x34')],{'$or':_[_0x9028('0x28')](_0x3c591b[_0x9028('0x2f')],function(_0x26afcd){var _0x566202={};_0x566202[_0x26afcd]={'$like':'%'+_0x27b441[_0x9028('0x2c')][_0x9028('0x48')]+'%'};return _0x566202;})});}_0x3c591b=_[_0x9028('0x38')]({},_0x3c591b,_0x27b441[_0x9028('0x39')]);return _0x3957e4[_0x9028('0x44')](_0x3c591b);}})['then'](function(_0x3977bc){if(_0x3977bc){_0x3d2219=_0x3977bc[_0x9028('0x31')];if(!_0x27b441[_0x9028('0x2c')][_0x9028('0x49')](_0x9028('0x32'))){_0x3c591b[_0x9028('0x1d')]=qs[_0x9028('0x1d')](_0x27b441[_0x9028('0x2c')][_0x9028('0x1d')]);_0x3c591b['offset']=qs['offset'](_0x27b441[_0x9028('0x2c')][_0x9028('0x1b')]);}return _0x3957e4[_0x9028('0x44')](_0x3c591b);}})[_0x9028('0x23')](function(_0x3dc247){if(_0x3dc247){return _0x3dc247?{'count':_0x3d2219,'rows':_0x3dc247}:null;}})[_0x9028('0x23')](respondWithResult(_0x4a07c7,null))[_0x9028('0x3d')](handleError(_0x4a07c7,null));};exports[_0x9028('0x4a')]=function(_0x2b8ab4,_0x5755a1,_0x17ab5b){var _0x3dee00={};var _0x119436={};var _0x3db9b1;var _0x54342b;return db[_0x9028('0x3a')][_0x9028('0x4b')]({'where':{'id':_0x2b8ab4[_0x9028('0x43')]['id']}})[_0x9028('0x23')](handleEntityNotFound(_0x5755a1,null))[_0x9028('0x23')](function(_0x50b604){if(_0x50b604){_0x3db9b1=_0x50b604;_0x119436['model']=_[_0x9028('0x2d')](db[_0x9028('0x45')]['rawAttributes']);_0x119436[_0x9028('0x2c')]=_[_0x9028('0x2d')](_0x2b8ab4[_0x9028('0x2c')]);_0x119436['filters']=_[_0x9028('0x2e')](_0x119436[_0x9028('0x2b')],_0x119436[_0x9028('0x2c')]);_0x3dee00['attributes']=_[_0x9028('0x2e')](_0x119436[_0x9028('0x2b')],qs['fields'](_0x2b8ab4[_0x9028('0x2c')][_0x9028('0x30')]));_0x3dee00[_0x9028('0x2f')]=_0x3dee00[_0x9028('0x2f')][_0x9028('0x31')]?_0x3dee00['attributes']:_0x119436[_0x9028('0x2b')];_0x3dee00['order']=qs[_0x9028('0x33')](_0x2b8ab4['query']['sort']);_0x3dee00['where']=qs[_0x9028('0x35')](_[_0x9028('0x36')](_0x2b8ab4[_0x9028('0x2c')],_0x119436['filters']));if(_0x2b8ab4[_0x9028('0x2c')]['filter']){_0x3dee00['where']=_['merge'](_0x3dee00[_0x9028('0x34')],{'$or':_[_0x9028('0x28')](_0x3dee00[_0x9028('0x2f')],function(_0x45cdcb){var _0x33ac2b={};_0x33ac2b[_0x45cdcb]={'$like':'%'+_0x2b8ab4[_0x9028('0x2c')]['filter']+'%'};return _0x33ac2b;})});}_0x3dee00=_['merge']({},_0x3dee00,_0x2b8ab4['options']);return _0x3db9b1['getSubjects'](_0x3dee00);}})[_0x9028('0x23')](function(_0x568825){if(_0x568825){_0x54342b=_0x568825['length'];if(!_0x2b8ab4[_0x9028('0x2c')][_0x9028('0x49')](_0x9028('0x32'))){_0x3dee00[_0x9028('0x1d')]=qs[_0x9028('0x1d')](_0x2b8ab4[_0x9028('0x2c')][_0x9028('0x1d')]);_0x3dee00[_0x9028('0x1b')]=qs['offset'](_0x2b8ab4['query'][_0x9028('0x1b')]);}return _0x3db9b1['getSubjects'](_0x3dee00);}})[_0x9028('0x23')](function(_0x8dcc25){if(_0x8dcc25){return _0x8dcc25?{'count':_0x54342b,'rows':_0x8dcc25}:null;}})[_0x9028('0x23')](respondWithResult(_0x5755a1,null))[_0x9028('0x3d')](handleError(_0x5755a1,null));};exports[_0x9028('0x4c')]=function(_0x335749,_0x538365,_0x1c5210){var _0x338cbc={};var _0x29e382={};var _0xe23c94;var _0x3b30c8;return db[_0x9028('0x3a')]['findOne']({'where':{'id':_0x335749[_0x9028('0x43')]['id']}})[_0x9028('0x23')](handleEntityNotFound(_0x538365,null))[_0x9028('0x23')](function(_0x20201a){if(_0x20201a){_0xe23c94=_0x20201a;_0x29e382[_0x9028('0x2b')]=_[_0x9028('0x2d')](db[_0x9028('0x45')]['rawAttributes']);_0x29e382['query']=_[_0x9028('0x2d')](_0x335749[_0x9028('0x2c')]);_0x29e382[_0x9028('0x35')]=_[_0x9028('0x2e')](_0x29e382[_0x9028('0x2b')],_0x29e382['query']);_0x338cbc[_0x9028('0x2f')]=_[_0x9028('0x2e')](_0x29e382['model'],qs[_0x9028('0x30')](_0x335749[_0x9028('0x2c')][_0x9028('0x30')]));_0x338cbc[_0x9028('0x2f')]=_0x338cbc[_0x9028('0x2f')][_0x9028('0x31')]?_0x338cbc[_0x9028('0x2f')]:_0x29e382[_0x9028('0x2b')];_0x338cbc[_0x9028('0x47')]=qs[_0x9028('0x33')](_0x335749[_0x9028('0x2c')][_0x9028('0x33')]);_0x338cbc[_0x9028('0x34')]=qs['filters'](_[_0x9028('0x36')](_0x335749[_0x9028('0x2c')],_0x29e382['filters']));if(_0x335749['query'][_0x9028('0x48')]){_0x338cbc['where']=_[_0x9028('0x38')](_0x338cbc[_0x9028('0x34')],{'$or':_['map'](_0x338cbc[_0x9028('0x2f')],function(_0x5baa8c){var _0x3d120c={};_0x3d120c[_0x5baa8c]={'$like':'%'+_0x335749[_0x9028('0x2c')][_0x9028('0x48')]+'%'};return _0x3d120c;})});}_0x338cbc=_[_0x9028('0x38')]({},_0x338cbc,_0x335749['options']);return _0xe23c94[_0x9028('0x4c')](_0x338cbc);}})[_0x9028('0x23')](function(_0x41169c){if(_0x41169c){_0x3b30c8=_0x41169c['length'];if(!_0x335749[_0x9028('0x2c')]['hasOwnProperty']('nolimit')){_0x338cbc[_0x9028('0x1d')]=qs[_0x9028('0x1d')](_0x335749[_0x9028('0x2c')]['limit']);_0x338cbc[_0x9028('0x1b')]=qs[_0x9028('0x1b')](_0x335749['query'][_0x9028('0x1b')]);}return _0xe23c94[_0x9028('0x4c')](_0x338cbc);}})['then'](function(_0x3d6953){if(_0x3d6953){return _0x3d6953?{'count':_0x3b30c8,'rows':_0x3d6953}:null;}})['then'](respondWithResult(_0x538365,null))[_0x9028('0x3d')](handleError(_0x538365,null));};exports[_0x9028('0x4d')]=function(_0x36950b,_0x278e87,_0x161f84){var _0x2256ce={};var _0x4601e4={};var _0x54fe8a;var _0x1cc626;return db[_0x9028('0x3a')][_0x9028('0x4b')]({'where':{'id':_0x36950b[_0x9028('0x43')]['id']}})[_0x9028('0x23')](handleEntityNotFound(_0x278e87,null))['then'](function(_0x491757){if(_0x491757){_0x54fe8a=_0x491757;_0x4601e4['model']=_[_0x9028('0x2d')](db[_0x9028('0x4e')]['rawAttributes']);_0x4601e4[_0x9028('0x2c')]=_[_0x9028('0x2d')](_0x36950b[_0x9028('0x2c')]);_0x4601e4[_0x9028('0x35')]=_[_0x9028('0x2e')](_0x4601e4[_0x9028('0x2b')],_0x4601e4[_0x9028('0x2c')]);_0x2256ce[_0x9028('0x2f')]=_['intersection'](_0x4601e4[_0x9028('0x2b')],qs['fields'](_0x36950b[_0x9028('0x2c')][_0x9028('0x30')]));_0x2256ce[_0x9028('0x2f')]=_0x2256ce[_0x9028('0x2f')][_0x9028('0x31')]?_0x2256ce[_0x9028('0x2f')]:_0x4601e4[_0x9028('0x2b')];_0x2256ce[_0x9028('0x47')]=qs[_0x9028('0x33')](_0x36950b[_0x9028('0x2c')][_0x9028('0x33')]);_0x2256ce[_0x9028('0x34')]=qs[_0x9028('0x35')](_[_0x9028('0x36')](_0x36950b[_0x9028('0x2c')],_0x4601e4['filters']));if(_0x36950b[_0x9028('0x2c')]['filter']){_0x2256ce[_0x9028('0x34')]=_[_0x9028('0x38')](_0x2256ce[_0x9028('0x34')],{'$or':_[_0x9028('0x28')](_0x2256ce[_0x9028('0x2f')],function(_0x5129f6){var _0x49f57f={};_0x49f57f[_0x5129f6]={'$like':'%'+_0x36950b[_0x9028('0x2c')]['filter']+'%'};return _0x49f57f;})});}_0x2256ce=_[_0x9028('0x38')]({},_0x2256ce,_0x36950b[_0x9028('0x39')]);return _0x54fe8a[_0x9028('0x4d')](_0x2256ce);}})['then'](function(_0x47f917){if(_0x47f917){_0x1cc626=_0x47f917[_0x9028('0x31')];if(!_0x36950b['query']['hasOwnProperty'](_0x9028('0x32'))){_0x2256ce[_0x9028('0x1d')]=qs[_0x9028('0x1d')](_0x36950b[_0x9028('0x2c')][_0x9028('0x1d')]);_0x2256ce['offset']=qs[_0x9028('0x1b')](_0x36950b[_0x9028('0x2c')][_0x9028('0x1b')]);}return _0x54fe8a[_0x9028('0x4d')](_0x2256ce);}})[_0x9028('0x23')](function(_0x5eb67a){if(_0x5eb67a){return _0x5eb67a?{'count':_0x1cc626,'rows':_0x5eb67a}:null;}})[_0x9028('0x23')](respondWithResult(_0x278e87,null))[_0x9028('0x3d')](handleError(_0x278e87,null));};exports[_0x9028('0x4f')]=function(_0x3dfd9f,_0xfd2e1d,_0x527719){if(_0x3dfd9f[_0x9028('0x42')]['id']){delete _0x3dfd9f[_0x9028('0x42')]['id'];}return db[_0x9028('0x3a')]['findOne']({'where':{'id':_0x3dfd9f[_0x9028('0x43')]['id']}})['then'](handleEntityNotFound(_0xfd2e1d,null))[_0x9028('0x23')](function(_0x329a11){if(_0x329a11){return _0x329a11[_0x9028('0x4f')](_0x3dfd9f[_0x9028('0x42')][_0x9028('0x50')]||[]);}return null;})[_0x9028('0x23')](respondWithResult(_0xfd2e1d,null))[_0x9028('0x3d')](handleError(_0xfd2e1d,null));}; \ No newline at end of file +var _0x0f2c=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','DeskConfiguration','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','create','body','find','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse'];(function(_0x30af6f,_0x31ae68){var _0x9c1ea5=function(_0x49a3e3){while(--_0x49a3e3){_0x30af6f['push'](_0x30af6f['shift']());}};_0x9c1ea5(++_0x31ae68);}(_0x0f2c,0xdf));var _0xc0f2=function(_0xfddbba,_0x4becb8){_0xfddbba=_0xfddbba-0x0;var _0x574be3=_0x0f2c[_0xfddbba];return _0x574be3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc0f2('0x0'));var zipdir=require(_0xc0f2('0x1'));var jsonpatch=require(_0xc0f2('0x2'));var rp=require('request-promise');var moment=require(_0xc0f2('0x3'));var BPromise=require(_0xc0f2('0x4'));var Mustache=require('mustache');var util=require(_0xc0f2('0x5'));var path=require('path');var sox=require(_0xc0f2('0x6'));var csv=require(_0xc0f2('0x7'));var ejs=require(_0xc0f2('0x8'));var fs=require('fs');var fs_extra=require(_0xc0f2('0x9'));var _=require('lodash');var squel=require(_0xc0f2('0xa'));var crypto=require(_0xc0f2('0xb'));var jsforce=require(_0xc0f2('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc0f2('0xd'));var Redis=require(_0xc0f2('0xe'));var authService=require(_0xc0f2('0xf'));var qs=require(_0xc0f2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc0f2('0x11'));var config=require(_0xc0f2('0x12'));var licenseUtil=require(_0xc0f2('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bd014,_0x444853){_0x444853=_0x444853||0xcc;return function(_0xbade0f){if(_0xbade0f){return _0x4bd014[_0xc0f2('0x14')](_0x444853);}return _0x4bd014[_0xc0f2('0x15')](_0x444853)['end']();};}function respondWithResult(_0x4b649f,_0x1a880e){_0x1a880e=_0x1a880e||0xc8;return function(_0x30bc21){if(_0x30bc21){return _0x4b649f['status'](_0x1a880e)[_0xc0f2('0x16')](_0x30bc21);}};}function respondWithFilteredResult(_0x50be8e,_0x5d727b){return function(_0x3af8a7){if(_0x3af8a7){var _0x7a5084=typeof _0x5d727b[_0xc0f2('0x17')]===_0xc0f2('0x18')&&typeof _0x5d727b['limit']===_0xc0f2('0x18');var _0x57c4d6=_0x3af8a7['count'];var _0x27f736=_0x7a5084?0x0:_0x5d727b['offset'];var _0x131423=_0x7a5084?_0x3af8a7[_0xc0f2('0x19')]:_0x5d727b['offset']+_0x5d727b[_0xc0f2('0x1a')];var _0x1f3f96;if(_0x131423>=_0x57c4d6){_0x131423=_0x57c4d6;_0x1f3f96=0xc8;}else{_0x1f3f96=0xce;}_0x50be8e[_0xc0f2('0x15')](_0x1f3f96);return _0x50be8e['set'](_0xc0f2('0x1b'),_0x27f736+'-'+_0x131423+'/'+_0x57c4d6)['json'](_0x3af8a7);}return null;};}function patchUpdates(_0xd80bda){return function(_0x53ca85){try{jsonpatch[_0xc0f2('0x1c')](_0x53ca85,_0xd80bda,!![]);}catch(_0x57bb6c){return BPromise[_0xc0f2('0x1d')](_0x57bb6c);}return _0x53ca85[_0xc0f2('0x1e')]();};}function saveUpdates(_0x3644f0,_0x55afc6){return function(_0x1a287c){if(_0x1a287c){return _0x1a287c[_0xc0f2('0x1f')](_0x3644f0)[_0xc0f2('0x20')](function(_0x4e35a3){return _0x4e35a3;});}return null;};}function removeEntity(_0x4bc2a1,_0x5f5af8){return function(_0x556054){if(_0x556054){return _0x556054[_0xc0f2('0x21')]()['then'](function(){_0x4bc2a1['status'](0xcc)[_0xc0f2('0x22')]();});}};}function handleEntityNotFound(_0x81ea5f,_0x44911b){return function(_0x15dad1){if(!_0x15dad1){_0x81ea5f[_0xc0f2('0x14')](0x194);}return _0x15dad1;};}function handleError(_0x240949,_0x166e40){_0x166e40=_0x166e40||0x1f4;return function(_0x4e919e){logger[_0xc0f2('0x23')](_0x4e919e[_0xc0f2('0x24')]);if(_0x4e919e[_0xc0f2('0x25')]){delete _0x4e919e[_0xc0f2('0x25')];}_0x240949[_0xc0f2('0x15')](_0x166e40)[_0xc0f2('0x26')](_0x4e919e);};}exports['index']=function(_0x61762a,_0x44a3e0){var _0x2b4641={},_0x5d5112={},_0x415f76={'count':0x0,'rows':[]};var _0x3a3adf=_['map'](db[_0xc0f2('0x27')][_0xc0f2('0x28')],function(_0xdc0ed){return{'name':_0xdc0ed[_0xc0f2('0x29')],'type':_0xdc0ed[_0xc0f2('0x2a')]['key']};});_0x5d5112[_0xc0f2('0x2b')]=_[_0xc0f2('0x2c')](_0x3a3adf,'name');_0x5d5112[_0xc0f2('0x2d')]=_[_0xc0f2('0x2e')](_0x61762a['query']);_0x5d5112['filters']=_[_0xc0f2('0x2f')](_0x5d5112[_0xc0f2('0x2b')],_0x5d5112['query']);_0x2b4641['attributes']=_[_0xc0f2('0x2f')](_0x5d5112[_0xc0f2('0x2b')],qs[_0xc0f2('0x30')](_0x61762a[_0xc0f2('0x2d')][_0xc0f2('0x30')]));_0x2b4641['attributes']=_0x2b4641[_0xc0f2('0x31')][_0xc0f2('0x32')]?_0x2b4641['attributes']:_0x5d5112['model'];if(!_0x61762a[_0xc0f2('0x2d')][_0xc0f2('0x33')](_0xc0f2('0x34'))){_0x2b4641[_0xc0f2('0x1a')]=qs[_0xc0f2('0x1a')](_0x61762a[_0xc0f2('0x2d')][_0xc0f2('0x1a')]);_0x2b4641[_0xc0f2('0x17')]=qs[_0xc0f2('0x17')](_0x61762a[_0xc0f2('0x2d')]['offset']);}_0x2b4641[_0xc0f2('0x35')]=qs['sort'](_0x61762a[_0xc0f2('0x2d')][_0xc0f2('0x36')]);_0x2b4641[_0xc0f2('0x37')]=qs[_0xc0f2('0x38')](_[_0xc0f2('0x39')](_0x61762a[_0xc0f2('0x2d')],_0x5d5112['filters']),_0x3a3adf);if(_0x61762a[_0xc0f2('0x2d')]['filter']){_0x2b4641[_0xc0f2('0x37')]=_[_0xc0f2('0x3a')](_0x2b4641[_0xc0f2('0x37')],{'$or':_[_0xc0f2('0x2c')](_0x3a3adf,function(_0x47c870){if(_0x47c870[_0xc0f2('0x2a')]!=='VIRTUAL'){var _0x4da055={};_0x4da055[_0x47c870['name']]={'$like':'%'+_0x61762a['query'][_0xc0f2('0x3b')]+'%'};return _0x4da055;}})});}_0x2b4641=_[_0xc0f2('0x3a')]({},_0x2b4641,_0x61762a[_0xc0f2('0x3c')]);var _0x3f7086={'where':_0x2b4641['where']};return db[_0xc0f2('0x27')][_0xc0f2('0x19')](_0x3f7086)[_0xc0f2('0x20')](function(_0x47f08c){_0x415f76[_0xc0f2('0x19')]=_0x47f08c;if(_0x61762a[_0xc0f2('0x2d')][_0xc0f2('0x3d')]){_0x2b4641[_0xc0f2('0x3e')]=[{'all':!![]}];}return db[_0xc0f2('0x27')][_0xc0f2('0x3f')](_0x2b4641);})[_0xc0f2('0x20')](function(_0x4bbe70){_0x415f76['rows']=_0x4bbe70;return _0x415f76;})[_0xc0f2('0x20')](respondWithFilteredResult(_0x44a3e0,_0x2b4641))[_0xc0f2('0x40')](handleError(_0x44a3e0,null));};exports[_0xc0f2('0x41')]=function(_0x33df48,_0x983072){var _0x32e50a={'raw':![],'where':{'id':_0x33df48[_0xc0f2('0x42')]['id']}},_0x459e06={};_0x459e06['model']=_['keys'](db[_0xc0f2('0x27')][_0xc0f2('0x28')]);_0x459e06[_0xc0f2('0x2d')]=_[_0xc0f2('0x2e')](_0x33df48[_0xc0f2('0x2d')]);_0x459e06[_0xc0f2('0x38')]=_[_0xc0f2('0x2f')](_0x459e06[_0xc0f2('0x2b')],_0x459e06[_0xc0f2('0x2d')]);_0x32e50a['attributes']=_[_0xc0f2('0x2f')](_0x459e06[_0xc0f2('0x2b')],qs[_0xc0f2('0x30')](_0x33df48[_0xc0f2('0x2d')][_0xc0f2('0x30')]));_0x32e50a['attributes']=_0x32e50a[_0xc0f2('0x31')][_0xc0f2('0x32')]?_0x32e50a[_0xc0f2('0x31')]:_0x459e06['model'];if(_0x33df48[_0xc0f2('0x2d')]['includeAll']){_0x32e50a[_0xc0f2('0x3e')]=[{'all':!![]}];}_0x32e50a=_[_0xc0f2('0x3a')]({},_0x32e50a,_0x33df48[_0xc0f2('0x3c')]);return db[_0xc0f2('0x27')]['find'](_0x32e50a)['then'](handleEntityNotFound(_0x983072,null))[_0xc0f2('0x20')](respondWithResult(_0x983072,null))[_0xc0f2('0x40')](handleError(_0x983072,null));};exports[_0xc0f2('0x43')]=function(_0xc3144a,_0x23f010){return db[_0xc0f2('0x27')][_0xc0f2('0x43')](_0xc3144a[_0xc0f2('0x44')],{})['then'](respondWithResult(_0x23f010,0xc9))['catch'](handleError(_0x23f010,null));};exports[_0xc0f2('0x1f')]=function(_0x210f1f,_0x455645){if(_0x210f1f[_0xc0f2('0x44')]['id']){delete _0x210f1f['body']['id'];}return db[_0xc0f2('0x27')][_0xc0f2('0x45')]({'where':{'id':_0x210f1f[_0xc0f2('0x42')]['id']}})[_0xc0f2('0x20')](handleEntityNotFound(_0x455645,null))[_0xc0f2('0x20')](saveUpdates(_0x210f1f[_0xc0f2('0x44')],null))[_0xc0f2('0x20')](respondWithResult(_0x455645,null))[_0xc0f2('0x40')](handleError(_0x455645,null));};exports[_0xc0f2('0x21')]=function(_0x360c5c,_0xe73465){return db['DeskConfiguration'][_0xc0f2('0x45')]({'where':{'id':_0x360c5c[_0xc0f2('0x42')]['id']}})['then'](handleEntityNotFound(_0xe73465,null))[_0xc0f2('0x20')](removeEntity(_0xe73465,null))[_0xc0f2('0x40')](handleError(_0xe73465,null));};exports[_0xc0f2('0x46')]=function(_0x397981,_0x466e3f,_0x6190a0){var _0x48cca8={};var _0x54cbca={};var _0x3d5424;var _0x25e0a9;return db['DeskConfiguration'][_0xc0f2('0x47')]({'where':{'id':_0x397981[_0xc0f2('0x42')]['id']}})['then'](handleEntityNotFound(_0x466e3f,null))['then'](function(_0x28e8de){if(_0x28e8de){_0x3d5424=_0x28e8de;_0x54cbca[_0xc0f2('0x2b')]=_[_0xc0f2('0x2e')](db[_0xc0f2('0x48')][_0xc0f2('0x28')]);_0x54cbca[_0xc0f2('0x2d')]=_[_0xc0f2('0x2e')](_0x397981[_0xc0f2('0x2d')]);_0x54cbca[_0xc0f2('0x38')]=_[_0xc0f2('0x2f')](_0x54cbca[_0xc0f2('0x2b')],_0x54cbca[_0xc0f2('0x2d')]);_0x48cca8[_0xc0f2('0x31')]=_['intersection'](_0x54cbca['model'],qs[_0xc0f2('0x30')](_0x397981[_0xc0f2('0x2d')]['fields']));_0x48cca8['attributes']=_0x48cca8[_0xc0f2('0x31')][_0xc0f2('0x32')]?_0x48cca8[_0xc0f2('0x31')]:_0x54cbca[_0xc0f2('0x2b')];_0x48cca8['order']=qs[_0xc0f2('0x36')](_0x397981[_0xc0f2('0x2d')][_0xc0f2('0x36')]);_0x48cca8[_0xc0f2('0x37')]=qs[_0xc0f2('0x38')](_[_0xc0f2('0x39')](_0x397981[_0xc0f2('0x2d')],_0x54cbca['filters']));if(_0x397981['query'][_0xc0f2('0x3b')]){_0x48cca8[_0xc0f2('0x37')]=_[_0xc0f2('0x3a')](_0x48cca8[_0xc0f2('0x37')],{'$or':_[_0xc0f2('0x2c')](_0x48cca8[_0xc0f2('0x31')],function(_0xff6ca5){var _0x22c5c5={};_0x22c5c5[_0xff6ca5]={'$like':'%'+_0x397981[_0xc0f2('0x2d')]['filter']+'%'};return _0x22c5c5;})});}_0x48cca8=_[_0xc0f2('0x3a')]({},_0x48cca8,_0x397981[_0xc0f2('0x3c')]);return _0x3d5424['getFields'](_0x48cca8);}})[_0xc0f2('0x20')](function(_0x3c81ce){if(_0x3c81ce){_0x25e0a9=_0x3c81ce[_0xc0f2('0x32')];if(!_0x397981[_0xc0f2('0x2d')][_0xc0f2('0x33')](_0xc0f2('0x34'))){_0x48cca8[_0xc0f2('0x1a')]=qs[_0xc0f2('0x1a')](_0x397981[_0xc0f2('0x2d')][_0xc0f2('0x1a')]);_0x48cca8[_0xc0f2('0x17')]=qs[_0xc0f2('0x17')](_0x397981[_0xc0f2('0x2d')][_0xc0f2('0x17')]);}return _0x3d5424[_0xc0f2('0x46')](_0x48cca8);}})[_0xc0f2('0x20')](function(_0x44d406){if(_0x44d406){return _0x44d406?{'count':_0x25e0a9,'rows':_0x44d406}:null;}})[_0xc0f2('0x20')](respondWithResult(_0x466e3f,null))[_0xc0f2('0x40')](handleError(_0x466e3f,null));};exports[_0xc0f2('0x49')]=function(_0x3a8f7b,_0xa909d0,_0x159a4b){var _0x2cf8dd={};var _0x2e7e12={};var _0x54d0b7;var _0x90b2b0;return db[_0xc0f2('0x27')]['findOne']({'where':{'id':_0x3a8f7b['params']['id']}})[_0xc0f2('0x20')](handleEntityNotFound(_0xa909d0,null))[_0xc0f2('0x20')](function(_0x390d3e){if(_0x390d3e){_0x54d0b7=_0x390d3e;_0x2e7e12[_0xc0f2('0x2b')]=_['keys'](db[_0xc0f2('0x48')][_0xc0f2('0x28')]);_0x2e7e12[_0xc0f2('0x2d')]=_[_0xc0f2('0x2e')](_0x3a8f7b['query']);_0x2e7e12[_0xc0f2('0x38')]=_[_0xc0f2('0x2f')](_0x2e7e12[_0xc0f2('0x2b')],_0x2e7e12['query']);_0x2cf8dd[_0xc0f2('0x31')]=_[_0xc0f2('0x2f')](_0x2e7e12[_0xc0f2('0x2b')],qs[_0xc0f2('0x30')](_0x3a8f7b['query'][_0xc0f2('0x30')]));_0x2cf8dd[_0xc0f2('0x31')]=_0x2cf8dd['attributes'][_0xc0f2('0x32')]?_0x2cf8dd[_0xc0f2('0x31')]:_0x2e7e12['model'];_0x2cf8dd[_0xc0f2('0x35')]=qs['sort'](_0x3a8f7b[_0xc0f2('0x2d')][_0xc0f2('0x36')]);_0x2cf8dd[_0xc0f2('0x37')]=qs[_0xc0f2('0x38')](_[_0xc0f2('0x39')](_0x3a8f7b['query'],_0x2e7e12[_0xc0f2('0x38')]));if(_0x3a8f7b['query']['filter']){_0x2cf8dd[_0xc0f2('0x37')]=_[_0xc0f2('0x3a')](_0x2cf8dd[_0xc0f2('0x37')],{'$or':_[_0xc0f2('0x2c')](_0x2cf8dd[_0xc0f2('0x31')],function(_0x25bf40){var _0x510b56={};_0x510b56[_0x25bf40]={'$like':'%'+_0x3a8f7b[_0xc0f2('0x2d')][_0xc0f2('0x3b')]+'%'};return _0x510b56;})});}_0x2cf8dd=_[_0xc0f2('0x3a')]({},_0x2cf8dd,_0x3a8f7b[_0xc0f2('0x3c')]);return _0x54d0b7[_0xc0f2('0x49')](_0x2cf8dd);}})[_0xc0f2('0x20')](function(_0x160c1d){if(_0x160c1d){_0x90b2b0=_0x160c1d[_0xc0f2('0x32')];if(!_0x3a8f7b[_0xc0f2('0x2d')][_0xc0f2('0x33')](_0xc0f2('0x34'))){_0x2cf8dd[_0xc0f2('0x1a')]=qs[_0xc0f2('0x1a')](_0x3a8f7b[_0xc0f2('0x2d')][_0xc0f2('0x1a')]);_0x2cf8dd[_0xc0f2('0x17')]=qs[_0xc0f2('0x17')](_0x3a8f7b[_0xc0f2('0x2d')][_0xc0f2('0x17')]);}return _0x54d0b7[_0xc0f2('0x49')](_0x2cf8dd);}})[_0xc0f2('0x20')](function(_0x49f24b){if(_0x49f24b){return _0x49f24b?{'count':_0x90b2b0,'rows':_0x49f24b}:null;}})[_0xc0f2('0x20')](respondWithResult(_0xa909d0,null))[_0xc0f2('0x40')](handleError(_0xa909d0,null));};exports[_0xc0f2('0x4a')]=function(_0xd0cfef,_0x5dd5de,_0x16ade6){var _0x4f7e6b={};var _0x566301={};var _0x448be1;var _0x17bcf9;return db['DeskConfiguration'][_0xc0f2('0x47')]({'where':{'id':_0xd0cfef[_0xc0f2('0x42')]['id']}})['then'](handleEntityNotFound(_0x5dd5de,null))[_0xc0f2('0x20')](function(_0x239353){if(_0x239353){_0x448be1=_0x239353;_0x566301[_0xc0f2('0x2b')]=_[_0xc0f2('0x2e')](db['DeskField'][_0xc0f2('0x28')]);_0x566301[_0xc0f2('0x2d')]=_[_0xc0f2('0x2e')](_0xd0cfef[_0xc0f2('0x2d')]);_0x566301[_0xc0f2('0x38')]=_[_0xc0f2('0x2f')](_0x566301[_0xc0f2('0x2b')],_0x566301['query']);_0x4f7e6b[_0xc0f2('0x31')]=_[_0xc0f2('0x2f')](_0x566301[_0xc0f2('0x2b')],qs[_0xc0f2('0x30')](_0xd0cfef[_0xc0f2('0x2d')][_0xc0f2('0x30')]));_0x4f7e6b['attributes']=_0x4f7e6b['attributes']['length']?_0x4f7e6b[_0xc0f2('0x31')]:_0x566301[_0xc0f2('0x2b')];_0x4f7e6b[_0xc0f2('0x35')]=qs[_0xc0f2('0x36')](_0xd0cfef['query'][_0xc0f2('0x36')]);_0x4f7e6b['where']=qs[_0xc0f2('0x38')](_[_0xc0f2('0x39')](_0xd0cfef['query'],_0x566301[_0xc0f2('0x38')]));if(_0xd0cfef['query'][_0xc0f2('0x3b')]){_0x4f7e6b[_0xc0f2('0x37')]=_[_0xc0f2('0x3a')](_0x4f7e6b[_0xc0f2('0x37')],{'$or':_[_0xc0f2('0x2c')](_0x4f7e6b[_0xc0f2('0x31')],function(_0x113e69){var _0x22ff9e={};_0x22ff9e[_0x113e69]={'$like':'%'+_0xd0cfef['query']['filter']+'%'};return _0x22ff9e;})});}_0x4f7e6b=_[_0xc0f2('0x3a')]({},_0x4f7e6b,_0xd0cfef[_0xc0f2('0x3c')]);return _0x448be1['getDescriptions'](_0x4f7e6b);}})[_0xc0f2('0x20')](function(_0x55561e){if(_0x55561e){_0x17bcf9=_0x55561e[_0xc0f2('0x32')];if(!_0xd0cfef[_0xc0f2('0x2d')]['hasOwnProperty'](_0xc0f2('0x34'))){_0x4f7e6b[_0xc0f2('0x1a')]=qs[_0xc0f2('0x1a')](_0xd0cfef[_0xc0f2('0x2d')]['limit']);_0x4f7e6b[_0xc0f2('0x17')]=qs[_0xc0f2('0x17')](_0xd0cfef[_0xc0f2('0x2d')][_0xc0f2('0x17')]);}return _0x448be1[_0xc0f2('0x4a')](_0x4f7e6b);}})[_0xc0f2('0x20')](function(_0x4dd9e8){if(_0x4dd9e8){return _0x4dd9e8?{'count':_0x17bcf9,'rows':_0x4dd9e8}:null;}})[_0xc0f2('0x20')](respondWithResult(_0x5dd5de,null))[_0xc0f2('0x40')](handleError(_0x5dd5de,null));};exports[_0xc0f2('0x4b')]=function(_0x4758c4,_0x4cf40,_0x384d3e){var _0x6c7deb={};var _0x260908={};var _0x44e162;var _0x20983d;return db[_0xc0f2('0x27')]['findOne']({'where':{'id':_0x4758c4[_0xc0f2('0x42')]['id']}})[_0xc0f2('0x20')](handleEntityNotFound(_0x4cf40,null))[_0xc0f2('0x20')](function(_0x393e5b){if(_0x393e5b){_0x44e162=_0x393e5b;_0x260908[_0xc0f2('0x2b')]=_['keys'](db[_0xc0f2('0x4c')]['rawAttributes']);_0x260908[_0xc0f2('0x2d')]=_[_0xc0f2('0x2e')](_0x4758c4[_0xc0f2('0x2d')]);_0x260908[_0xc0f2('0x38')]=_[_0xc0f2('0x2f')](_0x260908[_0xc0f2('0x2b')],_0x260908[_0xc0f2('0x2d')]);_0x6c7deb[_0xc0f2('0x31')]=_[_0xc0f2('0x2f')](_0x260908['model'],qs[_0xc0f2('0x30')](_0x4758c4[_0xc0f2('0x2d')][_0xc0f2('0x30')]));_0x6c7deb['attributes']=_0x6c7deb[_0xc0f2('0x31')][_0xc0f2('0x32')]?_0x6c7deb[_0xc0f2('0x31')]:_0x260908[_0xc0f2('0x2b')];_0x6c7deb[_0xc0f2('0x35')]=qs[_0xc0f2('0x36')](_0x4758c4[_0xc0f2('0x2d')][_0xc0f2('0x36')]);_0x6c7deb['where']=qs[_0xc0f2('0x38')](_[_0xc0f2('0x39')](_0x4758c4[_0xc0f2('0x2d')],_0x260908[_0xc0f2('0x38')]));if(_0x4758c4[_0xc0f2('0x2d')][_0xc0f2('0x3b')]){_0x6c7deb[_0xc0f2('0x37')]=_[_0xc0f2('0x3a')](_0x6c7deb[_0xc0f2('0x37')],{'$or':_[_0xc0f2('0x2c')](_0x6c7deb[_0xc0f2('0x31')],function(_0x9c01bc){var _0x5ef67c={};_0x5ef67c[_0x9c01bc]={'$like':'%'+_0x4758c4[_0xc0f2('0x2d')]['filter']+'%'};return _0x5ef67c;})});}_0x6c7deb=_[_0xc0f2('0x3a')]({},_0x6c7deb,_0x4758c4[_0xc0f2('0x3c')]);return _0x44e162[_0xc0f2('0x4b')](_0x6c7deb);}})['then'](function(_0x3da7c5){if(_0x3da7c5){_0x20983d=_0x3da7c5['length'];if(!_0x4758c4['query'][_0xc0f2('0x33')]('nolimit')){_0x6c7deb[_0xc0f2('0x1a')]=qs[_0xc0f2('0x1a')](_0x4758c4[_0xc0f2('0x2d')][_0xc0f2('0x1a')]);_0x6c7deb[_0xc0f2('0x17')]=qs[_0xc0f2('0x17')](_0x4758c4[_0xc0f2('0x2d')][_0xc0f2('0x17')]);}return _0x44e162[_0xc0f2('0x4b')](_0x6c7deb);}})[_0xc0f2('0x20')](function(_0xfac725){if(_0xfac725){return _0xfac725?{'count':_0x20983d,'rows':_0xfac725}:null;}})['then'](respondWithResult(_0x4cf40,null))[_0xc0f2('0x40')](handleError(_0x4cf40,null));};exports[_0xc0f2('0x4d')]=function(_0x59b492,_0x47c373,_0x4cf528){if(_0x59b492[_0xc0f2('0x44')]['id']){delete _0x59b492[_0xc0f2('0x44')]['id'];}return db[_0xc0f2('0x27')][_0xc0f2('0x47')]({'where':{'id':_0x59b492[_0xc0f2('0x42')]['id']}})[_0xc0f2('0x20')](handleEntityNotFound(_0x47c373,null))['then'](function(_0x40b5b6){if(_0x40b5b6){return _0x40b5b6[_0xc0f2('0x4d')](_0x59b492[_0xc0f2('0x44')][_0xc0f2('0x4e')]||[]);}return null;})[_0xc0f2('0x20')](respondWithResult(_0x47c373,null))[_0xc0f2('0x40')](handleError(_0x47c373,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index cbbdeb9..0db9c30 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 _0x9f44=['request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x55e8f9,_0x40da22){var _0x4c2d41=function(_0x528e20){while(--_0x528e20){_0x55e8f9['push'](_0x55e8f9['shift']());}};_0x4c2d41(++_0x40da22);}(_0x9f44,0x113));var _0x49f4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9f44[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x49f4('0x0'));var util=require('util');var logger=require(_0x49f4('0x1'))(_0x49f4('0x2'));var moment=require(_0x49f4('0x3'));var BPromise=require(_0x49f4('0x4'));var rp=require(_0x49f4('0x5'));var fs=require('fs');var path=require(_0x49f4('0x6'));var rimraf=require(_0x49f4('0x7'));var config=require(_0x49f4('0x8'));var attributes=require(_0x49f4('0x9'));module[_0x49f4('0xa')]=function(_0x1187be,_0x9ee846){return _0x1187be[_0x49f4('0xb')](_0x49f4('0xc'),attributes,{'tableName':_0x49f4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb88c=['path','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','util','api','moment','bluebird','request-promise'];(function(_0xf2034a,_0x35868a){var _0x502d2e=function(_0x27e095){while(--_0x27e095){_0xf2034a['push'](_0xf2034a['shift']());}};_0x502d2e(++_0x35868a);}(_0xb88c,0xcd));var _0xcb88=function(_0x363063,_0x863a4c){_0x363063=_0x363063-0x0;var _0x27f875=_0xb88c[_0x363063];return _0x27f875;};'use strict';var _=require('lodash');var util=require(_0xcb88('0x0'));var logger=require('../../config/logger')(_0xcb88('0x1'));var moment=require(_0xcb88('0x2'));var BPromise=require(_0xcb88('0x3'));var rp=require(_0xcb88('0x4'));var fs=require('fs');var path=require(_0xcb88('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcb88('0x6'));module[_0xcb88('0x7')]=function(_0x2f3b43,_0x3a6562){return _0x2f3b43['define'](_0xcb88('0x8'),attributes,{'tableName':_0xcb88('0x9'),'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 b87d68d..9500a48 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 _0x1d21=['../../config/environment','jayson/promise','client','http','request','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x30bef2,_0x3d4186){var _0x567d67=function(_0x1acf17){while(--_0x1acf17){_0x30bef2['push'](_0x30bef2['shift']());}};_0x567d67(++_0x3d4186);}(_0x1d21,0x158));var _0x11d2=function(_0x25f797,_0x449916){_0x25f797=_0x25f797-0x0;var _0x157fdd=_0x1d21[_0x25f797];return _0x157fdd;};'use strict';var _=require(_0x11d2('0x0'));var util=require(_0x11d2('0x1'));var moment=require(_0x11d2('0x2'));var BPromise=require(_0x11d2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11d2('0x4'));var db=require(_0x11d2('0x5'))['db'];var utils=require(_0x11d2('0x6'));var logger=require(_0x11d2('0x7'))('rpc');var config=require(_0x11d2('0x8'));var jayson=require(_0x11d2('0x9'));var client=jayson[_0x11d2('0xa')][_0x11d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1eb6ca,_0x185dc4,_0x3a3713){return new BPromise(function(_0x4d8792,_0xd6d34c){return client[_0x11d2('0xc')](_0x1eb6ca,_0x3a3713)['then'](function(_0x3109ab){logger['info'](_0x11d2('0xd'),_0x185dc4,_0x11d2('0xe'));logger['debug'](_0x11d2('0xf'),_0x185dc4,_0x11d2('0xe'),JSON[_0x11d2('0x10')](_0x3109ab));if(_0x3109ab[_0x11d2('0x11')]){if(_0x3109ab['error']['code']===0x1f4){logger[_0x11d2('0x11')](_0x11d2('0xd'),_0x185dc4,_0x3109ab[_0x11d2('0x11')]['message']);return _0xd6d34c(_0x3109ab[_0x11d2('0x11')][_0x11d2('0x12')]);}logger[_0x11d2('0x11')](_0x11d2('0xd'),_0x185dc4,_0x3109ab['error'][_0x11d2('0x12')]);return _0x4d8792(_0x3109ab[_0x11d2('0x11')]['message']);}else{logger[_0x11d2('0x13')](_0x11d2('0xd'),_0x185dc4,_0x11d2('0xe'));_0x4d8792(_0x3109ab[_0x11d2('0x14')][_0x11d2('0x12')]);}})[_0x11d2('0x15')](function(_0x3e75f4){logger[_0x11d2('0x11')](_0x11d2('0xd'),_0x185dc4,_0x3e75f4);_0xd6d34c(_0x3e75f4);});});} \ No newline at end of file +var _0x6a47=['http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2a5156,_0x5244e9){var _0x4d3841=function(_0x5eb505){while(--_0x5eb505){_0x2a5156['push'](_0x2a5156['shift']());}};_0x4d3841(++_0x5244e9);}(_0x6a47,0x84));var _0x76a4=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x6a47[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x76a4('0x0'));var util=require(_0x76a4('0x1'));var moment=require(_0x76a4('0x2'));var BPromise=require(_0x76a4('0x3'));var rs=require(_0x76a4('0x4'));var fs=require('fs');var Redis=require(_0x76a4('0x5'));var db=require(_0x76a4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x76a4('0x7'))(_0x76a4('0x8'));var config=require(_0x76a4('0x9'));var jayson=require(_0x76a4('0xa'));var client=jayson[_0x76a4('0xb')][_0x76a4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x481862,_0x1b5cf6,_0x46c86b){return new BPromise(function(_0x5a7cda,_0x3ced93){return client['request'](_0x481862,_0x46c86b)[_0x76a4('0xd')](function(_0x2475c5){logger[_0x76a4('0xe')](_0x76a4('0xf'),_0x1b5cf6,_0x76a4('0x10'));logger['debug'](_0x76a4('0x11'),_0x1b5cf6,_0x76a4('0x10'),JSON[_0x76a4('0x12')](_0x2475c5));if(_0x2475c5[_0x76a4('0x13')]){if(_0x2475c5[_0x76a4('0x13')][_0x76a4('0x14')]===0x1f4){logger[_0x76a4('0x13')](_0x76a4('0xf'),_0x1b5cf6,_0x2475c5[_0x76a4('0x13')]['message']);return _0x3ced93(_0x2475c5[_0x76a4('0x13')][_0x76a4('0x15')]);}logger[_0x76a4('0x13')](_0x76a4('0xf'),_0x1b5cf6,_0x2475c5['error'][_0x76a4('0x15')]);return _0x5a7cda(_0x2475c5[_0x76a4('0x13')][_0x76a4('0x15')]);}else{logger[_0x76a4('0xe')](_0x76a4('0xf'),_0x1b5cf6,_0x76a4('0x10'));_0x5a7cda(_0x2475c5[_0x76a4('0x16')][_0x76a4('0x15')]);}})[_0x76a4('0x17')](function(_0xa964aa){logger[_0x76a4('0x13')](_0x76a4('0xf'),_0x1b5cf6,_0xa964aa);_0x3ced93(_0xa964aa);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 8e7e828..d6e7d59 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 _0x9123=['multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x2f090b,_0x134600){var _0x5df1d8=function(_0x59055f){while(--_0x59055f){_0x2f090b['push'](_0x2f090b['shift']());}};_0x5df1d8(++_0x134600);}(_0x9123,0x140));var _0x3912=function(_0x175602,_0x2300d7){_0x175602=_0x175602-0x0;var _0x4a0c2f=_0x9123[_0x175602];return _0x4a0c2f;};'use strict';var multer=require(_0x3912('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3912('0x1'));var router=express['Router']();var fs_extra=require(_0x3912('0x2'));var auth=require(_0x3912('0x3'));var interaction=require(_0x3912('0x4'));var config=require(_0x3912('0x5'));var controller=require('./intDeskField.controller');router[_0x3912('0x6')]('/',auth[_0x3912('0x7')](),controller['index']);router['get'](_0x3912('0x8'),auth[_0x3912('0x7')](),controller[_0x3912('0x9')]);router['post']('/',auth[_0x3912('0x7')](),controller[_0x3912('0xa')]);router[_0x3912('0xb')](_0x3912('0x8'),auth['isAuthenticated'](),controller[_0x3912('0xc')]);router[_0x3912('0xd')]('/:id',auth[_0x3912('0x7')](),controller[_0x3912('0xe')]);module[_0x3912('0xf')]=router; \ No newline at end of file +var _0x3134=['update','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskField.controller','get','index','isAuthenticated','show','post','create','put','/:id'];(function(_0x19e291,_0x5052bc){var _0x5c816f=function(_0x4a9cdf){while(--_0x4a9cdf){_0x19e291['push'](_0x19e291['shift']());}};_0x5c816f(++_0x5052bc);}(_0x3134,0xdf));var _0x4313=function(_0x1422a9,_0x4d21a6){_0x1422a9=_0x1422a9-0x0;var _0x3baa66=_0x3134[_0x1422a9];return _0x3baa66;};'use strict';var multer=require(_0x4313('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4313('0x1'));var express=require(_0x4313('0x2'));var router=express[_0x4313('0x3')]();var fs_extra=require(_0x4313('0x4'));var auth=require(_0x4313('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4313('0x6'));router[_0x4313('0x7')]('/',auth['isAuthenticated'](),controller[_0x4313('0x8')]);router['get']('/:id',auth[_0x4313('0x9')](),controller[_0x4313('0xa')]);router[_0x4313('0xb')]('/',auth[_0x4313('0x9')](),controller[_0x4313('0xc')]);router[_0x4313('0xd')](_0x4313('0xe'),auth[_0x4313('0x9')](),controller[_0x4313('0xf')]);router['delete'](_0x4313('0xe'),auth[_0x4313('0x9')](),controller[_0x4313('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index f002282..5c75c9b 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 _0x77d4=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports'];(function(_0x3b870e,_0x29b811){var _0x2b4300=function(_0x2ecc42){while(--_0x2ecc42){_0x3b870e['push'](_0x3b870e['shift']());}};_0x2b4300(++_0x29b811);}(_0x77d4,0xa1));var _0x477d=function(_0x541a78,_0x219591){_0x541a78=_0x541a78-0x0;var _0x3107f3=_0x77d4[_0x541a78];return _0x3107f3;};'use strict';var Sequelize=require('sequelize');module[_0x477d('0x0')]={'type':{'type':Sequelize[_0x477d('0x1')](_0x477d('0x2'),_0x477d('0x3'),_0x477d('0x4'),_0x477d('0x5'),_0x477d('0x6')),'defaultValue':_0x477d('0x2')},'content':{'type':Sequelize[_0x477d('0x7')]},'key':{'type':Sequelize[_0x477d('0x7')]},'keyType':{'type':Sequelize[_0x477d('0x1')]('string',_0x477d('0x3'),_0x477d('0x4'))},'keyContent':{'type':Sequelize[_0x477d('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x477d('0x7')]},'customField':{'type':Sequelize[_0x477d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x477d('0x7')]}}; \ No newline at end of file +var _0x9483=['keyValue','picklist','string','STRING','BOOLEAN','exports','ENUM','customVariable'];(function(_0x7fe85c,_0x10b2eb){var _0x10b90f=function(_0x2400d9){while(--_0x2400d9){_0x7fe85c['push'](_0x7fe85c['shift']());}};_0x10b90f(++_0x10b2eb);}(_0x9483,0xc5));var _0x3948=function(_0x4d4fe1,_0x5f4f35){_0x4d4fe1=_0x4d4fe1-0x0;var _0x32ab47=_0x9483[_0x4d4fe1];return _0x32ab47;};'use strict';var Sequelize=require('sequelize');module[_0x3948('0x0')]={'type':{'type':Sequelize[_0x3948('0x1')]('string','variable',_0x3948('0x2'),_0x3948('0x3'),_0x3948('0x4')),'defaultValue':_0x3948('0x5')},'content':{'type':Sequelize[_0x3948('0x6')]},'key':{'type':Sequelize[_0x3948('0x6')]},'keyType':{'type':Sequelize[_0x3948('0x1')](_0x3948('0x5'),'variable',_0x3948('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3948('0x6')]},'customField':{'type':Sequelize[_0x3948('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3948('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 2937697..69d15eb 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 _0x9aac=['set','save','then','name','send','index','map','DeskField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x9d9343,_0x494c83){var _0x2abcd2=function(_0x101a63){while(--_0x101a63){_0x9d9343['push'](_0x9d9343['shift']());}};_0x2abcd2(++_0x494c83);}(_0x9aac,0x135));var _0xc9aa=function(_0x5f42fc,_0x2f8d08){_0x5f42fc=_0x5f42fc-0x0;var _0x22c2b8=_0x9aac[_0x5f42fc];return _0x22c2b8;};'use strict';var emlformat=require(_0xc9aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc9aa('0x1'));var jsonpatch=require(_0xc9aa('0x2'));var rp=require('request-promise');var moment=require(_0xc9aa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc9aa('0x4'));var util=require('util');var path=require(_0xc9aa('0x5'));var sox=require(_0xc9aa('0x6'));var csv=require('to-csv');var ejs=require(_0xc9aa('0x7'));var fs=require('fs');var fs_extra=require(_0xc9aa('0x8'));var _=require(_0xc9aa('0x9'));var squel=require('squel');var crypto=require(_0xc9aa('0xa'));var jsforce=require(_0xc9aa('0xb'));var deskjs=require(_0xc9aa('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc9aa('0xd'));var Papa=require(_0xc9aa('0xe'));var Redis=require(_0xc9aa('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc9aa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9aa('0x11'))(_0xc9aa('0x12'));var utils=require(_0xc9aa('0x13'));var config=require(_0xc9aa('0x14'));var licenseUtil=require(_0xc9aa('0x15'));var db=require(_0xc9aa('0x16'))['db'];function respondWithStatusCode(_0x21e9c3,_0x2b38da){_0x2b38da=_0x2b38da||0xcc;return function(_0xfc9acd){if(_0xfc9acd){return _0x21e9c3[_0xc9aa('0x17')](_0x2b38da);}return _0x21e9c3[_0xc9aa('0x18')](_0x2b38da)[_0xc9aa('0x19')]();};}function respondWithResult(_0x39331d,_0x406422){_0x406422=_0x406422||0xc8;return function(_0x2b5708){if(_0x2b5708){return _0x39331d[_0xc9aa('0x18')](_0x406422)[_0xc9aa('0x1a')](_0x2b5708);}};}function respondWithFilteredResult(_0x53834b,_0x129cc1){return function(_0x4ed0c1){if(_0x4ed0c1){var _0x5b351f=typeof _0x129cc1[_0xc9aa('0x1b')]===_0xc9aa('0x1c')&&typeof _0x129cc1[_0xc9aa('0x1d')]===_0xc9aa('0x1c');var _0x4b42a4=_0x4ed0c1[_0xc9aa('0x1e')];var _0x28a1a0=_0x5b351f?0x0:_0x129cc1[_0xc9aa('0x1b')];var _0x4bacb3=_0x5b351f?_0x4ed0c1[_0xc9aa('0x1e')]:_0x129cc1[_0xc9aa('0x1b')]+_0x129cc1[_0xc9aa('0x1d')];var _0x22ad7f;if(_0x4bacb3>=_0x4b42a4){_0x4bacb3=_0x4b42a4;_0x22ad7f=0xc8;}else{_0x22ad7f=0xce;}_0x53834b[_0xc9aa('0x18')](_0x22ad7f);return _0x53834b[_0xc9aa('0x1f')]('Content-Range',_0x28a1a0+'-'+_0x4bacb3+'/'+_0x4b42a4)[_0xc9aa('0x1a')](_0x4ed0c1);}return null;};}function patchUpdates(_0x55037f){return function(_0x2c634a){try{jsonpatch['apply'](_0x2c634a,_0x55037f,!![]);}catch(_0x7c837f){return BPromise['reject'](_0x7c837f);}return _0x2c634a[_0xc9aa('0x20')]();};}function saveUpdates(_0x3f8bfd,_0x214c09){return function(_0x465f52){if(_0x465f52){return _0x465f52['update'](_0x3f8bfd)[_0xc9aa('0x21')](function(_0x122d0c){return _0x122d0c;});}return null;};}function removeEntity(_0xbb6dc1,_0x1b4246){return function(_0x3f5347){if(_0x3f5347){return _0x3f5347['destroy']()[_0xc9aa('0x21')](function(){_0xbb6dc1[_0xc9aa('0x18')](0xcc)[_0xc9aa('0x19')]();});}};}function handleEntityNotFound(_0x59dcfe,_0x1f6646){return function(_0x13cb3f){if(!_0x13cb3f){_0x59dcfe[_0xc9aa('0x17')](0x194);}return _0x13cb3f;};}function handleError(_0x4dab46,_0x44108f){_0x44108f=_0x44108f||0x1f4;return function(_0x40e628){logger['error'](_0x40e628['stack']);if(_0x40e628[_0xc9aa('0x22')]){delete _0x40e628[_0xc9aa('0x22')];}_0x4dab46[_0xc9aa('0x18')](_0x44108f)[_0xc9aa('0x23')](_0x40e628);};}exports[_0xc9aa('0x24')]=function(_0x12e908,_0x1251e1){var _0x5865b5={},_0x1d1215={},_0x3446aa={'count':0x0,'rows':[]};var _0x25d3e5=_[_0xc9aa('0x25')](db[_0xc9aa('0x26')][_0xc9aa('0x27')],function(_0x363394){return{'name':_0x363394['fieldName'],'type':_0x363394[_0xc9aa('0x28')][_0xc9aa('0x29')]};});_0x1d1215[_0xc9aa('0x2a')]=_[_0xc9aa('0x25')](_0x25d3e5,_0xc9aa('0x22'));_0x1d1215[_0xc9aa('0x2b')]=_[_0xc9aa('0x2c')](_0x12e908[_0xc9aa('0x2b')]);_0x1d1215[_0xc9aa('0x2d')]=_[_0xc9aa('0x2e')](_0x1d1215[_0xc9aa('0x2a')],_0x1d1215['query']);_0x5865b5['attributes']=_[_0xc9aa('0x2e')](_0x1d1215['model'],qs[_0xc9aa('0x2f')](_0x12e908[_0xc9aa('0x2b')][_0xc9aa('0x2f')]));_0x5865b5['attributes']=_0x5865b5[_0xc9aa('0x30')][_0xc9aa('0x31')]?_0x5865b5['attributes']:_0x1d1215[_0xc9aa('0x2a')];if(!_0x12e908[_0xc9aa('0x2b')]['hasOwnProperty'](_0xc9aa('0x32'))){_0x5865b5[_0xc9aa('0x1d')]=qs[_0xc9aa('0x1d')](_0x12e908[_0xc9aa('0x2b')]['limit']);_0x5865b5[_0xc9aa('0x1b')]=qs[_0xc9aa('0x1b')](_0x12e908['query'][_0xc9aa('0x1b')]);}_0x5865b5[_0xc9aa('0x33')]=qs[_0xc9aa('0x34')](_0x12e908[_0xc9aa('0x2b')][_0xc9aa('0x34')]);_0x5865b5[_0xc9aa('0x35')]=qs['filters'](_['pick'](_0x12e908[_0xc9aa('0x2b')],_0x1d1215[_0xc9aa('0x2d')]),_0x25d3e5);if(_0x12e908[_0xc9aa('0x2b')][_0xc9aa('0x36')]){_0x5865b5[_0xc9aa('0x35')]=_[_0xc9aa('0x37')](_0x5865b5[_0xc9aa('0x35')],{'$or':_['map'](_0x25d3e5,function(_0x3631ef){if(_0x3631ef[_0xc9aa('0x28')]!==_0xc9aa('0x38')){var _0x2c680b={};_0x2c680b[_0x3631ef['name']]={'$like':'%'+_0x12e908['query']['filter']+'%'};return _0x2c680b;}})});}_0x5865b5=_[_0xc9aa('0x37')]({},_0x5865b5,_0x12e908[_0xc9aa('0x39')]);var _0x311a2c={'where':_0x5865b5[_0xc9aa('0x35')]};return db[_0xc9aa('0x26')][_0xc9aa('0x1e')](_0x311a2c)[_0xc9aa('0x21')](function(_0x55bd4f){_0x3446aa[_0xc9aa('0x1e')]=_0x55bd4f;if(_0x12e908[_0xc9aa('0x2b')][_0xc9aa('0x3a')]){_0x5865b5[_0xc9aa('0x3b')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0x5865b5);})[_0xc9aa('0x21')](function(_0x5699c3){_0x3446aa[_0xc9aa('0x3c')]=_0x5699c3;return _0x3446aa;})[_0xc9aa('0x21')](respondWithFilteredResult(_0x1251e1,_0x5865b5))[_0xc9aa('0x3d')](handleError(_0x1251e1,null));};exports[_0xc9aa('0x3e')]=function(_0x51c85e,_0x6cf2dd){var _0x59006b={'raw':!![],'where':{'id':_0x51c85e[_0xc9aa('0x3f')]['id']}},_0x2990f0={};_0x2990f0[_0xc9aa('0x2a')]=_[_0xc9aa('0x2c')](db[_0xc9aa('0x26')]['rawAttributes']);_0x2990f0[_0xc9aa('0x2b')]=_['keys'](_0x51c85e[_0xc9aa('0x2b')]);_0x2990f0[_0xc9aa('0x2d')]=_[_0xc9aa('0x2e')](_0x2990f0[_0xc9aa('0x2a')],_0x2990f0[_0xc9aa('0x2b')]);_0x59006b[_0xc9aa('0x30')]=_[_0xc9aa('0x2e')](_0x2990f0['model'],qs['fields'](_0x51c85e[_0xc9aa('0x2b')]['fields']));_0x59006b[_0xc9aa('0x30')]=_0x59006b['attributes'][_0xc9aa('0x31')]?_0x59006b[_0xc9aa('0x30')]:_0x2990f0[_0xc9aa('0x2a')];if(_0x51c85e[_0xc9aa('0x2b')][_0xc9aa('0x3a')]){_0x59006b[_0xc9aa('0x3b')]=[{'all':!![]}];}_0x59006b=_[_0xc9aa('0x37')]({},_0x59006b,_0x51c85e[_0xc9aa('0x39')]);return db[_0xc9aa('0x26')][_0xc9aa('0x40')](_0x59006b)[_0xc9aa('0x21')](handleEntityNotFound(_0x6cf2dd,null))[_0xc9aa('0x21')](respondWithResult(_0x6cf2dd,null))['catch'](handleError(_0x6cf2dd,null));};exports[_0xc9aa('0x41')]=function(_0x16851c,_0x575c7b){return db['DeskField']['create'](_0x16851c['body'],{})['then'](respondWithResult(_0x575c7b,0xc9))['catch'](handleError(_0x575c7b,null));};exports['update']=function(_0x53f5f1,_0x44c5db){if(_0x53f5f1[_0xc9aa('0x42')]['id']){delete _0x53f5f1[_0xc9aa('0x42')]['id'];}return db[_0xc9aa('0x26')][_0xc9aa('0x40')]({'where':{'id':_0x53f5f1[_0xc9aa('0x3f')]['id']}})[_0xc9aa('0x21')](handleEntityNotFound(_0x44c5db,null))[_0xc9aa('0x21')](saveUpdates(_0x53f5f1['body'],null))[_0xc9aa('0x21')](respondWithResult(_0x44c5db,null))[_0xc9aa('0x3d')](handleError(_0x44c5db,null));};exports[_0xc9aa('0x43')]=function(_0x5e99e0,_0x1855d5){return db[_0xc9aa('0x26')][_0xc9aa('0x40')]({'where':{'id':_0x5e99e0[_0xc9aa('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1855d5,null))['then'](removeEntity(_0x1855d5,null))[_0xc9aa('0x3d')](handleError(_0x1855d5,null));}; \ No newline at end of file +var _0x4745=['rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','DeskField','includeAll','include','findAll','rows','show','params','create','body','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','name','index','map'];(function(_0x32d414,_0x4d23da){var _0x4e0bca=function(_0x15d397){while(--_0x15d397){_0x32d414['push'](_0x32d414['shift']());}};_0x4e0bca(++_0x4d23da);}(_0x4745,0x1e7));var _0x5474=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x4745[_0x40ac5e];return _0x2839d6;};'use strict';var emlformat=require(_0x5474('0x0'));var rimraf=require(_0x5474('0x1'));var zipdir=require(_0x5474('0x2'));var jsonpatch=require(_0x5474('0x3'));var rp=require(_0x5474('0x4'));var moment=require(_0x5474('0x5'));var BPromise=require(_0x5474('0x6'));var Mustache=require(_0x5474('0x7'));var util=require(_0x5474('0x8'));var path=require(_0x5474('0x9'));var sox=require(_0x5474('0xa'));var csv=require(_0x5474('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5474('0xc'));var _=require(_0x5474('0xd'));var squel=require('squel');var crypto=require(_0x5474('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5474('0xf'));var toCsv=require(_0x5474('0xb'));var querystring=require('querystring');var Papa=require(_0x5474('0x10'));var Redis=require(_0x5474('0x11'));var authService=require(_0x5474('0x12'));var qs=require(_0x5474('0x13'));var as=require(_0x5474('0x14'));var hardwareService=require(_0x5474('0x15'));var logger=require(_0x5474('0x16'))(_0x5474('0x17'));var utils=require('../../config/utils');var config=require(_0x5474('0x18'));var licenseUtil=require(_0x5474('0x19'));var db=require(_0x5474('0x1a'))['db'];function respondWithStatusCode(_0x12cd7f,_0x10eac7){_0x10eac7=_0x10eac7||0xcc;return function(_0x261c64){if(_0x261c64){return _0x12cd7f[_0x5474('0x1b')](_0x10eac7);}return _0x12cd7f[_0x5474('0x1c')](_0x10eac7)[_0x5474('0x1d')]();};}function respondWithResult(_0x4a8db0,_0xb828fe){_0xb828fe=_0xb828fe||0xc8;return function(_0x17e424){if(_0x17e424){return _0x4a8db0[_0x5474('0x1c')](_0xb828fe)[_0x5474('0x1e')](_0x17e424);}};}function respondWithFilteredResult(_0x5a6353,_0x540e31){return function(_0x50b949){if(_0x50b949){var _0x50eb42=typeof _0x540e31[_0x5474('0x1f')]===_0x5474('0x20')&&typeof _0x540e31[_0x5474('0x21')]==='undefined';var _0x3da004=_0x50b949[_0x5474('0x22')];var _0x56dbfa=_0x50eb42?0x0:_0x540e31[_0x5474('0x1f')];var _0x198fc8=_0x50eb42?_0x50b949[_0x5474('0x22')]:_0x540e31[_0x5474('0x1f')]+_0x540e31[_0x5474('0x21')];var _0x4ab269;if(_0x198fc8>=_0x3da004){_0x198fc8=_0x3da004;_0x4ab269=0xc8;}else{_0x4ab269=0xce;}_0x5a6353[_0x5474('0x1c')](_0x4ab269);return _0x5a6353['set'](_0x5474('0x23'),_0x56dbfa+'-'+_0x198fc8+'/'+_0x3da004)[_0x5474('0x1e')](_0x50b949);}return null;};}function patchUpdates(_0x50d3a1){return function(_0x504826){try{jsonpatch['apply'](_0x504826,_0x50d3a1,!![]);}catch(_0x1f81d6){return BPromise[_0x5474('0x24')](_0x1f81d6);}return _0x504826[_0x5474('0x25')]();};}function saveUpdates(_0x401dd8,_0x36b389){return function(_0x24db35){if(_0x24db35){return _0x24db35[_0x5474('0x26')](_0x401dd8)[_0x5474('0x27')](function(_0x219be1){return _0x219be1;});}return null;};}function removeEntity(_0x9c80cc,_0x542d1f){return function(_0x5f065d){if(_0x5f065d){return _0x5f065d[_0x5474('0x28')]()[_0x5474('0x27')](function(){_0x9c80cc[_0x5474('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24997a,_0x49f691){return function(_0xa95a2){if(!_0xa95a2){_0x24997a[_0x5474('0x1b')](0x194);}return _0xa95a2;};}function handleError(_0x4b8985,_0x2a5f03){_0x2a5f03=_0x2a5f03||0x1f4;return function(_0x5d4cd7){logger[_0x5474('0x29')](_0x5d4cd7['stack']);if(_0x5d4cd7[_0x5474('0x2a')]){delete _0x5d4cd7[_0x5474('0x2a')];}_0x4b8985[_0x5474('0x1c')](_0x2a5f03)['send'](_0x5d4cd7);};}exports[_0x5474('0x2b')]=function(_0x42b99a,_0x479e44){var _0x57731b={},_0x5d2381={},_0x492a31={'count':0x0,'rows':[]};var _0x168dee=_[_0x5474('0x2c')](db['DeskField'][_0x5474('0x2d')],function(_0x4a657e){return{'name':_0x4a657e[_0x5474('0x2e')],'type':_0x4a657e['type'][_0x5474('0x2f')]};});_0x5d2381['model']=_[_0x5474('0x2c')](_0x168dee,'name');_0x5d2381[_0x5474('0x30')]=_[_0x5474('0x31')](_0x42b99a[_0x5474('0x30')]);_0x5d2381[_0x5474('0x32')]=_['intersection'](_0x5d2381['model'],_0x5d2381[_0x5474('0x30')]);_0x57731b[_0x5474('0x33')]=_[_0x5474('0x34')](_0x5d2381[_0x5474('0x35')],qs['fields'](_0x42b99a['query'][_0x5474('0x36')]));_0x57731b[_0x5474('0x33')]=_0x57731b['attributes'][_0x5474('0x37')]?_0x57731b[_0x5474('0x33')]:_0x5d2381[_0x5474('0x35')];if(!_0x42b99a[_0x5474('0x30')]['hasOwnProperty'](_0x5474('0x38'))){_0x57731b[_0x5474('0x21')]=qs[_0x5474('0x21')](_0x42b99a['query'][_0x5474('0x21')]);_0x57731b[_0x5474('0x1f')]=qs[_0x5474('0x1f')](_0x42b99a[_0x5474('0x30')]['offset']);}_0x57731b['order']=qs[_0x5474('0x39')](_0x42b99a[_0x5474('0x30')][_0x5474('0x39')]);_0x57731b[_0x5474('0x3a')]=qs['filters'](_[_0x5474('0x3b')](_0x42b99a[_0x5474('0x30')],_0x5d2381[_0x5474('0x32')]),_0x168dee);if(_0x42b99a[_0x5474('0x30')]['filter']){_0x57731b['where']=_['merge'](_0x57731b[_0x5474('0x3a')],{'$or':_['map'](_0x168dee,function(_0x28660f){if(_0x28660f[_0x5474('0x3c')]!==_0x5474('0x3d')){var _0x214ab2={};_0x214ab2[_0x28660f[_0x5474('0x2a')]]={'$like':'%'+_0x42b99a[_0x5474('0x30')][_0x5474('0x3e')]+'%'};return _0x214ab2;}})});}_0x57731b=_[_0x5474('0x3f')]({},_0x57731b,_0x42b99a[_0x5474('0x40')]);var _0x58f76d={'where':_0x57731b[_0x5474('0x3a')]};return db[_0x5474('0x41')][_0x5474('0x22')](_0x58f76d)[_0x5474('0x27')](function(_0x5e1901){_0x492a31[_0x5474('0x22')]=_0x5e1901;if(_0x42b99a['query'][_0x5474('0x42')]){_0x57731b[_0x5474('0x43')]=[{'all':!![]}];}return db['DeskField'][_0x5474('0x44')](_0x57731b);})[_0x5474('0x27')](function(_0x5690a0){_0x492a31[_0x5474('0x45')]=_0x5690a0;return _0x492a31;})[_0x5474('0x27')](respondWithFilteredResult(_0x479e44,_0x57731b))['catch'](handleError(_0x479e44,null));};exports[_0x5474('0x46')]=function(_0x547c72,_0x206733){var _0x291999={'raw':!![],'where':{'id':_0x547c72[_0x5474('0x47')]['id']}},_0x5c93d0={};_0x5c93d0[_0x5474('0x35')]=_[_0x5474('0x31')](db['DeskField'][_0x5474('0x2d')]);_0x5c93d0[_0x5474('0x30')]=_[_0x5474('0x31')](_0x547c72[_0x5474('0x30')]);_0x5c93d0['filters']=_['intersection'](_0x5c93d0[_0x5474('0x35')],_0x5c93d0['query']);_0x291999[_0x5474('0x33')]=_[_0x5474('0x34')](_0x5c93d0['model'],qs[_0x5474('0x36')](_0x547c72[_0x5474('0x30')]['fields']));_0x291999[_0x5474('0x33')]=_0x291999[_0x5474('0x33')]['length']?_0x291999['attributes']:_0x5c93d0[_0x5474('0x35')];if(_0x547c72[_0x5474('0x30')]['includeAll']){_0x291999[_0x5474('0x43')]=[{'all':!![]}];}_0x291999=_[_0x5474('0x3f')]({},_0x291999,_0x547c72[_0x5474('0x40')]);return db[_0x5474('0x41')]['find'](_0x291999)[_0x5474('0x27')](handleEntityNotFound(_0x206733,null))[_0x5474('0x27')](respondWithResult(_0x206733,null))['catch'](handleError(_0x206733,null));};exports[_0x5474('0x48')]=function(_0x137a76,_0x3c59bb){return db[_0x5474('0x41')][_0x5474('0x48')](_0x137a76[_0x5474('0x49')],{})[_0x5474('0x27')](respondWithResult(_0x3c59bb,0xc9))[_0x5474('0x4a')](handleError(_0x3c59bb,null));};exports[_0x5474('0x26')]=function(_0x21d29f,_0x3c9cb2){if(_0x21d29f[_0x5474('0x49')]['id']){delete _0x21d29f['body']['id'];}return db[_0x5474('0x41')][_0x5474('0x4b')]({'where':{'id':_0x21d29f[_0x5474('0x47')]['id']}})[_0x5474('0x27')](handleEntityNotFound(_0x3c9cb2,null))['then'](saveUpdates(_0x21d29f[_0x5474('0x49')],null))[_0x5474('0x27')](respondWithResult(_0x3c9cb2,null))[_0x5474('0x4a')](handleError(_0x3c9cb2,null));};exports[_0x5474('0x28')]=function(_0x771aad,_0x119398){return db[_0x5474('0x41')][_0x5474('0x4b')]({'where':{'id':_0x771aad[_0x5474('0x47')]['id']}})[_0x5474('0x27')](handleEntityNotFound(_0x119398,null))[_0x5474('0x27')](removeEntity(_0x119398,null))[_0x5474('0x4a')](handleError(_0x119398,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index e701095..736febe 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 _0x2293=['exports','define','desk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x184277,_0x4f0d0e){var _0x37d740=function(_0x3d6c58){while(--_0x3d6c58){_0x184277['push'](_0x184277['shift']());}};_0x37d740(++_0x4f0d0e);}(_0x2293,0xa0));var _0x3229=function(_0x3c62d7,_0x3d65e5){_0x3c62d7=_0x3c62d7-0x0;var _0xde5a0b=_0x2293[_0x3c62d7];return _0xde5a0b;};'use strict';var _=require(_0x3229('0x0'));var util=require(_0x3229('0x1'));var logger=require(_0x3229('0x2'))(_0x3229('0x3'));var moment=require(_0x3229('0x4'));var BPromise=require(_0x3229('0x5'));var rp=require(_0x3229('0x6'));var fs=require('fs');var path=require(_0x3229('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0x3229('0x8')]=function(_0x20a724,_0x3f0ddc){return _0x20a724[_0x3229('0x9')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x3229('0xa'),'fields':[_0x3229('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7146=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField','desk_unique_index','idField','lodash'];(function(_0x48fb10,_0xa50a89){var _0x534251=function(_0xcdc19e){while(--_0xcdc19e){_0x48fb10['push'](_0x48fb10['shift']());}};_0x534251(++_0xa50a89);}(_0x7146,0x99));var _0x6714=function(_0xec034,_0x16c358){_0xec034=_0xec034-0x0;var _0x2c5a19=_0x7146[_0xec034];return _0x2c5a19;};'use strict';var _=require(_0x6714('0x0'));var util=require(_0x6714('0x1'));var logger=require(_0x6714('0x2'))(_0x6714('0x3'));var moment=require(_0x6714('0x4'));var BPromise=require(_0x6714('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6714('0x6'));var rimraf=require(_0x6714('0x7'));var config=require(_0x6714('0x8'));var attributes=require(_0x6714('0x9'));module['exports']=function(_0x4ce0c4,_0x16f4b0){return _0x4ce0c4[_0x6714('0xa')](_0x6714('0xb'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x6714('0xc'),'fields':[_0x6714('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 0080cd7..63418e2 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 _0x5764=['../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','ioredis'];(function(_0x24bbd7,_0x1ac456){var _0x43584d=function(_0x412b7d){while(--_0x412b7d){_0x24bbd7['push'](_0x24bbd7['shift']());}};_0x43584d(++_0x1ac456);}(_0x5764,0x137));var _0x4576=function(_0x3433c2,_0x461727){_0x3433c2=_0x3433c2-0x0;var _0x276947=_0x5764[_0x3433c2];return _0x276947;};'use strict';var _=require(_0x4576('0x0'));var util=require(_0x4576('0x1'));var moment=require('moment');var BPromise=require(_0x4576('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4576('0x3'));var db=require(_0x4576('0x4'))['db'];var utils=require(_0x4576('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4576('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4576('0x7')][_0x4576('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb94f5b,_0x17e955,_0x427fac){return new BPromise(function(_0x513c99,_0x4cba43){return client[_0x4576('0x9')](_0xb94f5b,_0x427fac)[_0x4576('0xa')](function(_0x40940b){logger[_0x4576('0xb')](_0x4576('0xc'),_0x17e955,'request\x20sent');logger[_0x4576('0xd')](_0x4576('0xe'),_0x17e955,_0x4576('0xf'),JSON[_0x4576('0x10')](_0x40940b));if(_0x40940b[_0x4576('0x11')]){if(_0x40940b[_0x4576('0x11')]['code']===0x1f4){logger[_0x4576('0x11')](_0x4576('0xc'),_0x17e955,_0x40940b[_0x4576('0x11')]['message']);return _0x4cba43(_0x40940b[_0x4576('0x11')][_0x4576('0x12')]);}logger[_0x4576('0x11')](_0x4576('0xc'),_0x17e955,_0x40940b[_0x4576('0x11')][_0x4576('0x12')]);return _0x513c99(_0x40940b[_0x4576('0x11')][_0x4576('0x12')]);}else{logger[_0x4576('0xb')](_0x4576('0xc'),_0x17e955,_0x4576('0xf'));_0x513c99(_0x40940b[_0x4576('0x13')][_0x4576('0x12')]);}})[_0x4576('0x14')](function(_0x2e0840){logger[_0x4576('0x11')]('DeskField,\x20%s,\x20%s',_0x17e955,_0x2e0840);_0x4cba43(_0x2e0840);});});} \ No newline at end of file +var _0xdf83=['request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x10fd98,_0x5209db){var _0x5347d5=function(_0x570103){while(--_0x570103){_0x10fd98['push'](_0x10fd98['shift']());}};_0x5347d5(++_0x5209db);}(_0xdf83,0x79));var _0x3df8=function(_0x2d959a,_0x4d8b26){_0x2d959a=_0x2d959a-0x0;var _0x2fa8d6=_0xdf83[_0x2d959a];return _0x2fa8d6;};'use strict';var _=require(_0x3df8('0x0'));var util=require(_0x3df8('0x1'));var moment=require(_0x3df8('0x2'));var BPromise=require(_0x3df8('0x3'));var rs=require(_0x3df8('0x4'));var fs=require('fs');var Redis=require(_0x3df8('0x5'));var db=require(_0x3df8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3df8('0x7'))('rpc');var config=require(_0x3df8('0x8'));var jayson=require(_0x3df8('0x9'));var client=jayson['client'][_0x3df8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20391d,_0x1ef1cf,_0x2648d5){return new BPromise(function(_0x4a856b,_0x56f404){return client[_0x3df8('0xb')](_0x20391d,_0x2648d5)[_0x3df8('0xc')](function(_0x19c809){logger[_0x3df8('0xd')](_0x3df8('0xe'),_0x1ef1cf,_0x3df8('0xf'));logger[_0x3df8('0x10')](_0x3df8('0x11'),_0x1ef1cf,_0x3df8('0xf'),JSON[_0x3df8('0x12')](_0x19c809));if(_0x19c809[_0x3df8('0x13')]){if(_0x19c809['error'][_0x3df8('0x14')]===0x1f4){logger[_0x3df8('0x13')](_0x3df8('0xe'),_0x1ef1cf,_0x19c809[_0x3df8('0x13')][_0x3df8('0x15')]);return _0x56f404(_0x19c809[_0x3df8('0x13')]['message']);}logger[_0x3df8('0x13')]('DeskField,\x20%s,\x20%s',_0x1ef1cf,_0x19c809[_0x3df8('0x13')][_0x3df8('0x15')]);return _0x4a856b(_0x19c809[_0x3df8('0x13')][_0x3df8('0x15')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x1ef1cf,_0x3df8('0xf'));_0x4a856b(_0x19c809['result'][_0x3df8('0x15')]);}})['catch'](function(_0x4c2613){logger[_0x3df8('0x13')]('DeskField,\x20%s,\x20%s',_0x1ef1cf,_0x4c2613);_0x56f404(_0x4c2613);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index d0fd5e2..d73d709 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 _0x5fe9=['put','update','delete','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration'];(function(_0x4af0fc,_0x19fb80){var _0x591640=function(_0x4c585e){while(--_0x4c585e){_0x4af0fc['push'](_0x4af0fc['shift']());}};_0x591640(++_0x19fb80);}(_0x5fe9,0x1a8));var _0x95fe=function(_0xfe6fcb,_0x1a534e){_0xfe6fcb=_0xfe6fcb-0x0;var _0x4eba5e=_0x5fe9[_0xfe6fcb];return _0x4eba5e;};'use strict';var multer=require(_0x95fe('0x0'));var util=require('util');var path=require(_0x95fe('0x1'));var timeout=require(_0x95fe('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x95fe('0x3'));var auth=require(_0x95fe('0x4'));var interaction=require(_0x95fe('0x5'));var config=require('../../config/environment');var controller=require(_0x95fe('0x6'));router[_0x95fe('0x7')]('/',auth[_0x95fe('0x8')](),controller[_0x95fe('0x9')]);router['get'](_0x95fe('0xa'),auth['isAuthenticated'](),controller[_0x95fe('0xb')]);router['get'](_0x95fe('0xc'),auth[_0x95fe('0x8')](),controller['getConfigurations']);router[_0x95fe('0x7')](_0x95fe('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x95fe('0xe')]('/',auth[_0x95fe('0x8')](),controller[_0x95fe('0xf')]);router['post']('/:id/configurations',auth[_0x95fe('0x8')](),controller[_0x95fe('0x10')]);router[_0x95fe('0x11')](_0x95fe('0xa'),auth['isAuthenticated'](),controller[_0x95fe('0x12')]);router[_0x95fe('0x13')]('/:id',auth[_0x95fe('0x8')](),controller[_0x95fe('0x14')]);module['exports']=router; \ No newline at end of file +var _0xab48=['../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','/:id','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3a3473,_0x49e97e){var _0x32122f=function(_0x2a714c){while(--_0x2a714c){_0x3a3473['push'](_0x3a3473['shift']());}};_0x32122f(++_0x49e97e);}(_0xab48,0x173));var _0x8ab4=function(_0x37fead,_0x178c7d){_0x37fead=_0x37fead-0x0;var _0x211a4c=_0xab48[_0x37fead];return _0x211a4c;};'use strict';var multer=require(_0x8ab4('0x0'));var util=require(_0x8ab4('0x1'));var path=require(_0x8ab4('0x2'));var timeout=require('connect-timeout');var express=require(_0x8ab4('0x3'));var router=express['Router']();var fs_extra=require(_0x8ab4('0x4'));var auth=require(_0x8ab4('0x5'));var interaction=require(_0x8ab4('0x6'));var config=require(_0x8ab4('0x7'));var controller=require('./intDynamics365Account.controller');router[_0x8ab4('0x8')]('/',auth[_0x8ab4('0x9')](),controller[_0x8ab4('0xa')]);router[_0x8ab4('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x8ab4('0xb')]);router[_0x8ab4('0x8')](_0x8ab4('0xc'),auth[_0x8ab4('0x9')](),controller[_0x8ab4('0xd')]);router[_0x8ab4('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8ab4('0xe')]);router[_0x8ab4('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8ab4('0xf')]('/:id/configurations',auth[_0x8ab4('0x9')](),controller[_0x8ab4('0x10')]);router['put'](_0x8ab4('0x11'),auth[_0x8ab4('0x9')](),controller['update']);router[_0x8ab4('0x12')](_0x8ab4('0x11'),auth[_0x8ab4('0x9')](),controller[_0x8ab4('0x13')]);module[_0x8ab4('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 17a3d0f..1c0e223 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 _0x88d5=['STRING','BOOLEAN','sequelize','exports'];(function(_0x481063,_0x5a7a3c){var _0x5ef52e=function(_0x405861){while(--_0x405861){_0x481063['push'](_0x481063['shift']());}};_0x5ef52e(++_0x5a7a3c);}(_0x88d5,0x76));var _0x588d=function(_0x7ed9e9,_0x35fb5d){_0x7ed9e9=_0x7ed9e9-0x0;var _0x383437=_0x88d5[_0x7ed9e9];return _0x383437;};'use strict';var Sequelize=require(_0x588d('0x0'));module[_0x588d('0x1')]={'name':{'type':Sequelize[_0x588d('0x2')]},'username':{'type':Sequelize[_0x588d('0x2')]},'password':{'type':Sequelize[_0x588d('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x588d('0x2')]},'clientId':{'type':Sequelize[_0x588d('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x588d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x588d('0x2')]},'modernAuthentication':{'type':Sequelize[_0x588d('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0618=['STRING','BOOLEAN','sequelize','exports'];(function(_0x5114ce,_0x539ecc){var _0x196363=function(_0x179f08){while(--_0x179f08){_0x5114ce['push'](_0x5114ce['shift']());}};_0x196363(++_0x539ecc);}(_0x0618,0x1c6));var _0x8061=function(_0x339702,_0x465d98){_0x339702=_0x339702-0x0;var _0x55cc03=_0x0618[_0x339702];return _0x55cc03;};'use strict';var Sequelize=require(_0x8061('0x0'));module[_0x8061('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8061('0x2')]},'password':{'type':Sequelize[_0x8061('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x8061('0x2')]},'clientSecret':{'type':Sequelize[_0x8061('0x2')]},'serverUrl':{'type':Sequelize[_0x8061('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8061('0x2')]},'modernAuthentication':{'type':Sequelize[_0x8061('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 fbec308..a7e2b5c 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 _0x7e0b=['filter','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','channel','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','PhoneCall','description','customerid','caseorigincode','subject','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','followupby','importsequencenumber','influencescore','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','versionnumber','username','password','remoteUri','clientSecret','modernAuthentication','data7','CloudProvider','data5','POST','tenantId','/oauth2/token','clientId','access_token','GET','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','error','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','stack','name','index','map','Dynamics365Account','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x4d7f19,_0x510f6e){var _0x589642=function(_0xa7013e){while(--_0xa7013e){_0x4d7f19['push'](_0x4d7f19['shift']());}};_0x589642(++_0x510f6e);}(_0x7e0b,0x8f));var _0xb7e0=function(_0x4c1339,_0x1e7e1e){_0x4c1339=_0x4c1339-0x0;var _0x5137ca=_0x7e0b[_0x4c1339];return _0x5137ca;};'use strict';var rp=require('request-promise');var util=require(_0xb7e0('0x0'));var _=require(_0xb7e0('0x1'));var qs=require(_0xb7e0('0x2'));var logger=require(_0xb7e0('0x3'))(_0xb7e0('0x4'));var db=require(_0xb7e0('0x5'))['db'];var integrations=require(_0xb7e0('0x6'));function respondWithResult(_0x213ea4,_0x55ea9e){_0x55ea9e=_0x55ea9e||0xc8;return function(_0x1931a3){if(_0x1931a3){return _0x213ea4[_0xb7e0('0x7')](_0x55ea9e)[_0xb7e0('0x8')](_0x1931a3);}};}function respondWithFilteredResult(_0x17c1f0,_0x12e167){return function(_0x2e9746){if(_0x2e9746){var _0x318605=typeof _0x12e167[_0xb7e0('0x9')]===_0xb7e0('0xa')&&typeof _0x12e167[_0xb7e0('0xb')]==='undefined';var _0x1b9f88=_0x2e9746[_0xb7e0('0xc')];var _0x4d5c92=_0x318605?0x0:_0x12e167[_0xb7e0('0x9')];var _0x1e3fdc=_0x318605?_0x2e9746[_0xb7e0('0xc')]:_0x12e167[_0xb7e0('0x9')]+_0x12e167['limit'];var _0xc266a7;if(_0x1e3fdc>=_0x1b9f88){_0x1e3fdc=_0x1b9f88;_0xc266a7=0xc8;}else{_0xc266a7=0xce;}_0x17c1f0['status'](_0xc266a7);return _0x17c1f0[_0xb7e0('0xd')](_0xb7e0('0xe'),_0x4d5c92+'-'+_0x1e3fdc+'/'+_0x1b9f88)[_0xb7e0('0x8')](_0x2e9746);}return null;};}function saveUpdates(_0x46ce9c){return function(_0x53c4c2){if(_0x53c4c2){return _0x53c4c2[_0xb7e0('0xf')](_0x46ce9c)[_0xb7e0('0x10')](function(_0x3133f7){return _0x3133f7;});}return null;};}function removeEntity(_0x3b1c9a){return function(_0x44f9c7){if(_0x44f9c7){return _0x44f9c7['destroy']()[_0xb7e0('0x10')](function(){_0x3b1c9a[_0xb7e0('0x7')](0xcc)[_0xb7e0('0x11')]();});}};}function handleEntityNotFound(_0x124558){return function(_0xd49d75){if(!_0xd49d75){_0x124558['sendStatus'](0x194);}return _0xd49d75;};}function handleError(_0x3b1aa2,_0x1156a){_0x1156a=_0x1156a||0x1f4;return function(_0x4d5f18){logger['error'](_0x4d5f18[_0xb7e0('0x12')]);if(_0x4d5f18[_0xb7e0('0x13')]){delete _0x4d5f18[_0xb7e0('0x13')];}_0x3b1aa2[_0xb7e0('0x7')](_0x1156a)['send'](_0x4d5f18);};}exports[_0xb7e0('0x14')]=function(_0x61354b,_0x1a5247){var _0x95e623={},_0x106e94={},_0xa04419={'count':0x0,'rows':[]};var _0x2a519b=_[_0xb7e0('0x15')](db[_0xb7e0('0x16')][_0xb7e0('0x17')],function(_0x5cd616){return{'name':_0x5cd616['fieldName'],'type':_0x5cd616[_0xb7e0('0x18')][_0xb7e0('0x19')]};});_0x106e94[_0xb7e0('0x1a')]=_[_0xb7e0('0x15')](_0x2a519b,_0xb7e0('0x13'));_0x106e94[_0xb7e0('0x1b')]=_[_0xb7e0('0x1c')](_0x61354b['query']);_0x106e94['filters']=_[_0xb7e0('0x1d')](_0x106e94[_0xb7e0('0x1a')],_0x106e94[_0xb7e0('0x1b')]);_0x95e623[_0xb7e0('0x1e')]=_[_0xb7e0('0x1d')](_0x106e94['model'],qs['fields'](_0x61354b[_0xb7e0('0x1b')]['fields']));_0x95e623[_0xb7e0('0x1e')]=_0x95e623[_0xb7e0('0x1e')][_0xb7e0('0x1f')]?_0x95e623[_0xb7e0('0x1e')]:_0x106e94[_0xb7e0('0x1a')];if(!_0x61354b[_0xb7e0('0x1b')][_0xb7e0('0x20')](_0xb7e0('0x21'))){_0x95e623[_0xb7e0('0xb')]=qs['limit'](_0x61354b['query'][_0xb7e0('0xb')]);_0x95e623[_0xb7e0('0x9')]=qs['offset'](_0x61354b[_0xb7e0('0x1b')]['offset']);}_0x95e623[_0xb7e0('0x22')]=qs[_0xb7e0('0x23')](_0x61354b[_0xb7e0('0x1b')][_0xb7e0('0x23')]);_0x95e623[_0xb7e0('0x24')]=qs[_0xb7e0('0x25')](_[_0xb7e0('0x26')](_0x61354b['query'],_0x106e94[_0xb7e0('0x25')]),_0x2a519b);if(_0x61354b[_0xb7e0('0x1b')][_0xb7e0('0x27')]){_0x95e623[_0xb7e0('0x24')]=_[_0xb7e0('0x28')](_0x95e623[_0xb7e0('0x24')],{'$or':_[_0xb7e0('0x15')](_0x2a519b,function(_0x5ca1c5){if(_0x5ca1c5[_0xb7e0('0x18')]!=='VIRTUAL'){var _0x17a9eb={};_0x17a9eb[_0x5ca1c5[_0xb7e0('0x13')]]={'$like':'%'+_0x61354b[_0xb7e0('0x1b')][_0xb7e0('0x27')]+'%'};return _0x17a9eb;}})});}_0x95e623=_[_0xb7e0('0x28')]({},_0x95e623,_0x61354b[_0xb7e0('0x29')]);var _0x6d4b74={'where':_0x95e623[_0xb7e0('0x24')]};return db[_0xb7e0('0x16')][_0xb7e0('0xc')](_0x6d4b74)[_0xb7e0('0x10')](function(_0x46670b){_0xa04419[_0xb7e0('0xc')]=_0x46670b;if(_0x61354b[_0xb7e0('0x1b')][_0xb7e0('0x2a')]){_0x95e623[_0xb7e0('0x2b')]=[{'all':!![]}];}return db[_0xb7e0('0x16')][_0xb7e0('0x2c')](_0x95e623);})[_0xb7e0('0x10')](function(_0x2f1053){_0xa04419[_0xb7e0('0x2d')]=_0x2f1053;return _0xa04419;})[_0xb7e0('0x10')](respondWithFilteredResult(_0x1a5247,_0x95e623))[_0xb7e0('0x2e')](handleError(_0x1a5247,null));};exports[_0xb7e0('0x2f')]=function(_0x5005f9,_0x1eed7c){var _0x2bf641={'raw':![],'where':{'id':_0x5005f9[_0xb7e0('0x30')]['id']}},_0x48a1ab={};_0x48a1ab[_0xb7e0('0x1a')]=_[_0xb7e0('0x1c')](db[_0xb7e0('0x16')][_0xb7e0('0x17')]);_0x48a1ab[_0xb7e0('0x1b')]=_['keys'](_0x5005f9[_0xb7e0('0x1b')]);_0x48a1ab[_0xb7e0('0x25')]=_['intersection'](_0x48a1ab[_0xb7e0('0x1a')],_0x48a1ab[_0xb7e0('0x1b')]);_0x2bf641['attributes']=_[_0xb7e0('0x1d')](_0x48a1ab[_0xb7e0('0x1a')],qs[_0xb7e0('0x31')](_0x5005f9[_0xb7e0('0x1b')][_0xb7e0('0x31')]));_0x2bf641[_0xb7e0('0x1e')]=_0x2bf641[_0xb7e0('0x1e')][_0xb7e0('0x1f')]?_0x2bf641[_0xb7e0('0x1e')]:_0x48a1ab[_0xb7e0('0x1a')];if(_0x5005f9[_0xb7e0('0x1b')]['includeAll']){_0x2bf641['include']=[{'all':!![]}];}_0x2bf641=_[_0xb7e0('0x28')]({},_0x2bf641,_0x5005f9['options']);return db['Dynamics365Account'][_0xb7e0('0x32')](_0x2bf641)[_0xb7e0('0x10')](handleEntityNotFound(_0x1eed7c,null))[_0xb7e0('0x10')](respondWithResult(_0x1eed7c,null))[_0xb7e0('0x2e')](handleError(_0x1eed7c,null));};exports[_0xb7e0('0x33')]=function(_0x1ca259,_0xd80f8d){return db[_0xb7e0('0x16')][_0xb7e0('0x33')](_0x1ca259[_0xb7e0('0x34')],{})[_0xb7e0('0x10')](respondWithResult(_0xd80f8d,0xc9))[_0xb7e0('0x2e')](handleError(_0xd80f8d,null));};exports[_0xb7e0('0xf')]=function(_0x4ba15e,_0x2b492d){if(_0x4ba15e['body']['id']){delete _0x4ba15e[_0xb7e0('0x34')]['id'];}return db[_0xb7e0('0x16')]['find']({'where':{'id':_0x4ba15e['params']['id']}})['then'](handleEntityNotFound(_0x2b492d,null))['then'](saveUpdates(_0x4ba15e[_0xb7e0('0x34')],null))[_0xb7e0('0x10')](respondWithResult(_0x2b492d,null))[_0xb7e0('0x2e')](handleError(_0x2b492d,null));};exports['destroy']=function(_0x34c5b9,_0x30e134){return db[_0xb7e0('0x16')]['find']({'where':{'id':_0x34c5b9[_0xb7e0('0x30')]['id']}})[_0xb7e0('0x10')](handleEntityNotFound(_0x30e134,null))[_0xb7e0('0x10')](removeEntity(_0x30e134,null))['catch'](handleError(_0x30e134,null));};exports[_0xb7e0('0x35')]=function(_0xbe4130,_0x5b5e86){var _0x2869c3={};var _0x32e838={};var _0x39e527;var _0x3b62f8;return db[_0xb7e0('0x16')]['findOne']({'where':{'id':_0xbe4130['params']['id']}})[_0xb7e0('0x10')](handleEntityNotFound(_0x5b5e86,null))[_0xb7e0('0x10')](function(_0x17d500){if(_0x17d500){_0x39e527=_0x17d500;_0x32e838['model']=_[_0xb7e0('0x1c')](db['Dynamics365Configuration']['rawAttributes']);_0x32e838[_0xb7e0('0x1b')]=_[_0xb7e0('0x1c')](_0xbe4130['query']);_0x32e838[_0xb7e0('0x25')]=_[_0xb7e0('0x1d')](_0x32e838[_0xb7e0('0x1a')],_0x32e838['query']);_0x2869c3['attributes']=_[_0xb7e0('0x1d')](_0x32e838['model'],qs[_0xb7e0('0x31')](_0xbe4130['query'][_0xb7e0('0x31')]));_0x2869c3[_0xb7e0('0x1e')]=_0x2869c3[_0xb7e0('0x1e')][_0xb7e0('0x1f')]?_0x2869c3[_0xb7e0('0x1e')]:_0x32e838[_0xb7e0('0x1a')];_0x2869c3[_0xb7e0('0x22')]=qs['sort'](_0xbe4130[_0xb7e0('0x1b')][_0xb7e0('0x23')]);_0x2869c3['where']=qs[_0xb7e0('0x25')](_[_0xb7e0('0x26')](_0xbe4130[_0xb7e0('0x1b')],_0x32e838[_0xb7e0('0x25')]));if(_0xbe4130[_0xb7e0('0x1b')][_0xb7e0('0x27')]){_0x2869c3[_0xb7e0('0x24')]=_['merge'](_0x2869c3['where'],{'$or':_[_0xb7e0('0x15')](_0x2869c3[_0xb7e0('0x1e')],function(_0x25543c){var _0x1182c9={};_0x1182c9[_0x25543c]={'$like':'%'+_0xbe4130[_0xb7e0('0x1b')][_0xb7e0('0x27')]+'%'};return _0x1182c9;})});}_0x2869c3=_[_0xb7e0('0x28')]({},_0x2869c3,_0xbe4130['options']);return _0x39e527[_0xb7e0('0x35')](_0x2869c3);}})[_0xb7e0('0x10')](function(_0x5b39c9){if(_0x5b39c9){_0x3b62f8=_0x5b39c9['length'];if(!_0xbe4130[_0xb7e0('0x1b')][_0xb7e0('0x20')](_0xb7e0('0x21'))){_0x2869c3[_0xb7e0('0xb')]=qs['limit'](_0xbe4130[_0xb7e0('0x1b')][_0xb7e0('0xb')]);_0x2869c3[_0xb7e0('0x9')]=qs[_0xb7e0('0x9')](_0xbe4130[_0xb7e0('0x1b')][_0xb7e0('0x9')]);}return _0x39e527[_0xb7e0('0x35')](_0x2869c3);}})['then'](function(_0x226192){if(_0x226192){return _0x226192?{'count':_0x3b62f8,'rows':_0x226192}:null;}})[_0xb7e0('0x10')](respondWithResult(_0x5b5e86,null))['catch'](handleError(_0x5b5e86,null));};exports[_0xb7e0('0x36')]=function(_0xe73872,_0x326432){if(_0xe73872[_0xb7e0('0x34')]['id']){delete _0xe73872[_0xb7e0('0x34')]['id'];}return db[_0xb7e0('0x16')][_0xb7e0('0x37')]({'where':{'id':_0xe73872[_0xb7e0('0x30')]['id']}})[_0xb7e0('0x10')](handleEntityNotFound(_0x326432,null))[_0xb7e0('0x10')](function(_0x3dadd8){if(_0x3dadd8){_0xe73872[_0xb7e0('0x34')][_0xb7e0('0x38')]=_0x3dadd8['id'];_0xe73872[_0xb7e0('0x34')][_0xb7e0('0x39')]=integrations[_0xb7e0('0x3a')](_0xe73872[_0xb7e0('0x34')]['channel'],_0xe73872[_0xb7e0('0x34')][_0xb7e0('0x18')]);_0xe73872['body'][_0xb7e0('0x3b')]=integrations['getDescriptions'](_0xe73872[_0xb7e0('0x34')][_0xb7e0('0x3c')],_0xe73872[_0xb7e0('0x34')][_0xb7e0('0x18')]);return db['Dynamics365Configuration'][_0xb7e0('0x33')](_0xe73872[_0xb7e0('0x34')],{'include':[{'model':db[_0xb7e0('0x3d')],'as':_0xb7e0('0x39')},{'model':db[_0xb7e0('0x3d')],'as':'Descriptions'}]});}return null;})[_0xb7e0('0x10')](respondWithResult(_0x326432,null))[_0xb7e0('0x2e')](handleError(_0x326432,null));};function sanitizeRemoteUri(_0x5135a6){var _0x25babd=_0x5135a6[_0xb7e0('0x3e')](-0x1);if(_0x25babd==='/')return _0x5135a6[_0xb7e0('0x3f')](0x0,_0x5135a6[_0xb7e0('0x40')](_0x25babd));return _0x5135a6;}function getWebApiUrl(_0x2b124f){return util[_0xb7e0('0x41')](_0xb7e0('0x42'),_0x2b124f);}exports[_0xb7e0('0x43')]=function(_0x48f81b,_0x133b4d){var _0x988a39=_0x48f81b[_0xb7e0('0x1b')][_0xb7e0('0x44')];var _0x49284e=_0x988a39===_0xb7e0('0x45')?'Incident':_0xb7e0('0x46');var _0x464f36='';var _0x1a6d59='';var _0x2539a2='';var _0x16396e='';var _0x318b3c='';var _0x26e041='';var _0x3d95e7='';var _0x1cde89='';var _0x49d38c=['title',_0xb7e0('0x47'),_0xb7e0('0x48'),'ownerid',_0xb7e0('0x49'),_0xb7e0('0x4a'),'phonenumber','regardingobjectid',_0xb7e0('0x4b'),_0xb7e0('0x4c')];var _0x105769=[_0xb7e0('0x4d'),_0xb7e0('0x4e'),_0xb7e0('0x4f'),_0xb7e0('0x50'),_0xb7e0('0x51'),'contactidyominame','contractdetailidname',_0xb7e0('0x52'),_0xb7e0('0x53'),'createdbyexternalpartyyominame',_0xb7e0('0x54'),_0xb7e0('0x55'),_0xb7e0('0x56'),_0xb7e0('0x57'),_0xb7e0('0x58'),_0xb7e0('0x59'),_0xb7e0('0x5a'),_0xb7e0('0x5b'),_0xb7e0('0x5c'),_0xb7e0('0x5d'),_0xb7e0('0x5e'),_0xb7e0('0x5f'),'escalatedon','exchangerate','firstresponsebykpiidname',_0xb7e0('0x60'),_0xb7e0('0x61'),_0xb7e0('0x62'),_0xb7e0('0x63'),'lastonholdtime','masteridname',_0xb7e0('0x64'),_0xb7e0('0x65'),'modifiedbyname','modifiedbyyominame','modifiedon',_0xb7e0('0x66'),_0xb7e0('0x67'),'msdyn_incidenttypename',_0xb7e0('0x68'),_0xb7e0('0x69'),_0xb7e0('0x6a'),'overriddencreatedon','owneridname',_0xb7e0('0x6b'),'owneridyominame',_0xb7e0('0x6c'),_0xb7e0('0x6d'),_0xb7e0('0x6e'),'prioritycodename',_0xb7e0('0x6f'),_0xb7e0('0x70'),_0xb7e0('0x71'),_0xb7e0('0x72'),'responseby',_0xb7e0('0x73'),_0xb7e0('0x74'),_0xb7e0('0x75'),_0xb7e0('0x76'),_0xb7e0('0x77'),'socialprofileidname',_0xb7e0('0x78'),_0xb7e0('0x79'),_0xb7e0('0x7a'),_0xb7e0('0x7b'),_0xb7e0('0x7c'),'transactioncurrencyidname','traversedpath','utcconversiontimezonecode',_0xb7e0('0x7d')];var _0x367b6f=_0x49d38c['concat'](_0x105769);return db[_0xb7e0('0x16')][_0xb7e0('0x37')]({'where':{'id':_0x48f81b[_0xb7e0('0x30')]['id']},'attributes':['id',_0xb7e0('0x7e'),_0xb7e0('0x7f'),_0xb7e0('0x80'),'tenantId','clientId',_0xb7e0('0x81'),_0xb7e0('0x82')],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','attributes':['id','data5',_0xb7e0('0x83')]}]})[_0xb7e0('0x10')](handleEntityNotFound(_0x133b4d,null))[_0xb7e0('0x10')](function(_0x195a16){if(_0x195a16){if(_0x195a16[_0xb7e0('0x82')]){_0x195a16['access_token']=_0x195a16[_0xb7e0('0x84')][_0xb7e0('0x85')];_0x1cde89=sanitizeRemoteUri(_0x195a16['CloudProvider'][_0xb7e0('0x83')]);_0x3d95e7=getWebApiUrl(_0x1cde89);return _0x195a16;}_0x1cde89=sanitizeRemoteUri(_0x195a16[_0xb7e0('0x80')]);_0x3d95e7=getWebApiUrl(_0x1cde89);var _0x1007aa={'method':_0xb7e0('0x86'),'uri':'https://login.microsoftonline.com/'+_0x195a16[_0xb7e0('0x87')]+_0xb7e0('0x88'),'form':{'client_id':_0x195a16[_0xb7e0('0x89')],'resource':_0x1cde89,'username':_0x195a16['username'],'password':_0x195a16[_0xb7e0('0x7f')],'grant_type':_0xb7e0('0x7f'),'client_secret':_0x195a16[_0xb7e0('0x81')]},'json':!![]};return rp(_0x1007aa);}})[_0xb7e0('0x10')](function(_0x1685b7){_0x26e041=_0x1685b7[_0xb7e0('0x8a')];var _0x4f9626={'method':_0xb7e0('0x8b'),'uri':encodeURI(_0x3d95e7+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x49284e+'\x27'),'headers':{'Authorization':_0xb7e0('0x8c')+_0x26e041,'If-None-Match':null,'OData-Version':_0xb7e0('0x8d')},'json':!![]};return rp(_0x4f9626);})[_0xb7e0('0x10')](function(_0x2aca47){var _0x536a10=_0x2aca47['value'][0x0];var _0x388274=_0x536a10[_0xb7e0('0x8e')];var _0x46c47b={'method':'GET','uri':_0x3d95e7+_0xb7e0('0x8f')+_0x388274+_0xb7e0('0x90'),'headers':{'Authorization':_0xb7e0('0x8c')+_0x26e041,'If-None-Match':null,'OData-Version':_0xb7e0('0x8d')},'json':!![]};return rp(_0x46c47b);})[_0xb7e0('0x10')](function(_0x19f979){_0x464f36=_0x19f979;_0x1a6d59=_0x464f36[_0xb7e0('0x91')];_0x1a6d59=_['remove'](_0x1a6d59,function(_0x35d9e7){return!_0x367b6f[_0xb7e0('0x92')](_0x35d9e7[_0xb7e0('0x93')]);});var _0x503e53=[];var _0x492ac6=[];_0x1a6d59[_0xb7e0('0x94')](function(_0x242967){if(_0x242967[_0xb7e0('0x95')]){var _0x4a4694=_0x242967[_0xb7e0('0x95')]['substring'](_0x242967[_0xb7e0('0x95')][_0xb7e0('0x40')]('.')+0x1);if(_0x4a4694===_0xb7e0('0x96')){_0x503e53[_0xb7e0('0x97')](getSelectList(_0x3d95e7,_0x988a39,_0x492ac6,_0x464f36[_0xb7e0('0x8e')],_0x242967[_0xb7e0('0x8e')],_0x26e041));}}});return Promise[_0xb7e0('0x98')](_0x503e53);})['then'](function(_0x4da385){_0x2539a2=_0x4da385[0x0];var _0x36d483=[];var _0x54d58b=[];_0x1a6d59[_0xb7e0('0x94')](function(_0x2b8a1d){if(!_['isNil'](_0x2b8a1d[_0xb7e0('0x95')])){var _0x5a438a=_0x2b8a1d[_0xb7e0('0x95')]['substring'](_0x2b8a1d['@odata.type']['lastIndexOf']('.')+0x1);if(_0x5a438a===_0xb7e0('0x99')){_0x36d483['push'](getBooleanList(_0x3d95e7,_0x988a39,_0x54d58b,_0x464f36[_0xb7e0('0x8e')],_0x2b8a1d[_0xb7e0('0x8e')],_0x26e041));}}});return Promise[_0xb7e0('0x98')](_0x36d483);})[_0xb7e0('0x10')](function(_0x5e1a45){_0x16396e=_0x5e1a45[0x0];var _0x2a5b96=[];var _0xcc6b9f=[];_0x1a6d59[_0xb7e0('0x94')](function(_0x58ee0f){if(_0x58ee0f[_0xb7e0('0x95')]){var _0x65b31e=_0x58ee0f[_0xb7e0('0x95')]['substring'](_0x58ee0f['@odata.type']['lastIndexOf']('.')+0x1);if(_0x65b31e===_0xb7e0('0x9a')||_0x65b31e===_0xb7e0('0x9b')||_0x65b31e===_0xb7e0('0x9c')||_0x65b31e===_0xb7e0('0x9d')||_0x65b31e==='MemoAttributeMetadata'||_0x65b31e===_0xb7e0('0x9e')||_0x65b31e===_0xb7e0('0x9f')||_0x65b31e===_0xb7e0('0xa0')||_0x65b31e===_0xb7e0('0xa1')||_0x65b31e===_0xb7e0('0xa2')){_0x2a5b96[_0xb7e0('0x97')](getInputList(_0x3d95e7,_0x988a39,_0x65b31e,_0xcc6b9f,_0x464f36['MetadataId'],_0x58ee0f[_0xb7e0('0x8e')],_0x26e041));}}});return Promise[_0xb7e0('0x98')](_0x2a5b96);})[_0xb7e0('0x10')](function(_0x12eb19){_0x318b3c=_0x12eb19[0x0];var _0x183447=_0x2539a2[_0xb7e0('0xa3')](_0x16396e)[_0xb7e0('0xa3')](_0x318b3c);var _0x3ccd14={'count':_0x183447[_0xb7e0('0x1f')],'rows':_0x183447};return _0x3ccd14;})[_0xb7e0('0x10')](respondWithResult(_0x133b4d,null))[_0xb7e0('0x2e')](function(_0x573918){var _0x486e90=_0x48f81b[_0xb7e0('0x1b')][_0xb7e0('0xa4')]?0x1f4:_0x573918['statusCode']||0x1f4;logger[_0xb7e0('0xa5')](_0x573918['stack']);delete _0x573918['name'];if(_0x486e90===0x191){_0x486e90=0x190;}_0x133b4d[_0xb7e0('0x7')](_0x486e90)[_0xb7e0('0xa6')](_0x48f81b[_0xb7e0('0x1b')]['test']?{'message':_0xb7e0('0xa7'),'statusCode':_0x573918['statusCode']}:_0x573918);});};function getSelectList(_0x131f2f,_0xd08f33,_0x5ca88e,_0x201e3d,_0xfb2ac2,_0x55ee4b){var _0xb40f2b={'method':_0xb7e0('0x8b'),'uri':_0x131f2f+_0xb7e0('0x8f')+_0x201e3d+_0xb7e0('0xa8')+_0xfb2ac2+_0xb7e0('0xa9')+_0xb7e0('0xaa'),'headers':{'Authorization':_0xb7e0('0x8c')+_0x55ee4b,'If-None-Match':null,'OData-Version':_0xb7e0('0x8d')},'json':!![]};return rp(_0xb40f2b)[_0xb7e0('0x10')](function(_0x41025a){var _0x6bf3d2=[];var _0xdba82d=_0x41025a[_0xb7e0('0xab')][_0xb7e0('0xac')];_0xdba82d[_0xb7e0('0x94')](function(_0x4775bc){_0x6bf3d2[_0xb7e0('0x97')]({'name':_0x4775bc[_0xb7e0('0xad')]['UserLocalizedLabel'][_0xb7e0('0xad')],'value':String(_0x4775bc[_0xb7e0('0xae')])});});var _0x3ab7b1={'id':_0xd08f33+'_'+_0x41025a[_0xb7e0('0x93')],'name':_0x41025a[_0xb7e0('0xaf')][_0xb7e0('0xb0')][_0xb7e0('0xad')],'custom':![],'options':_0x6bf3d2};_0x5ca88e['push'](_0x3ab7b1);return _0x5ca88e;});}function getBooleanList(_0x38616c,_0x362040,_0x23cdfe,_0x44723f,_0x393074,_0x47044c){var _0x52c6fe={'method':_0xb7e0('0x8b'),'uri':_0x38616c+'EntityDefinitions('+_0x44723f+_0xb7e0('0xa8')+_0x393074+_0xb7e0('0xb1'),'headers':{'Authorization':_0xb7e0('0x8c')+_0x47044c,'If-None-Match':null,'OData-Version':_0xb7e0('0x8d')},'json':!![]};return rp(_0x52c6fe)[_0xb7e0('0x10')](function(_0x15303b){var _0x1ab793=[];_0x1ab793[_0xb7e0('0x97')]({'name':_0x15303b['OptionSet'][_0xb7e0('0xb2')][_0xb7e0('0xad')][_0xb7e0('0xb0')][_0xb7e0('0xad')],'value':_0xb7e0('0xb3')},{'name':_0x15303b[_0xb7e0('0xab')]['FalseOption'][_0xb7e0('0xad')][_0xb7e0('0xb0')]['Label'],'value':'false'});var _0x3ff273={'id':_0x362040+'_'+_0x15303b[_0xb7e0('0x93')],'name':_0x15303b[_0xb7e0('0xaf')][_0xb7e0('0xb0')][_0xb7e0('0xad')],'custom':![],'options':_0x1ab793};_0x23cdfe[_0xb7e0('0x97')](_0x3ff273);return _0x23cdfe;});}function getInputList(_0x50da41,_0x26941a,_0x567ceb,_0x3788dc,_0x1593d5,_0x560345,_0x18559e){var _0x313c14={'method':_0xb7e0('0x8b'),'uri':_0x50da41+_0xb7e0('0x8f')+_0x1593d5+')/Attributes('+_0x560345+_0xb7e0('0xb4')+_0x567ceb+_0xb7e0('0xb5'),'headers':{'Authorization':'Bearer\x20'+_0x18559e,'If-None-Match':null,'OData-Version':_0xb7e0('0x8d')},'json':!![]};return rp(_0x313c14)[_0xb7e0('0x10')](function(_0x274cea){var _0xf6f995={'id':_0x26941a+'_'+_0x274cea['LogicalName'],'name':_0x274cea[_0xb7e0('0xaf')][_0xb7e0('0xb0')]?_0x274cea['DisplayName'][_0xb7e0('0xb0')][_0xb7e0('0xad')]:_0x274cea[_0xb7e0('0x93')],'custom':![],'options':[]};_0x3788dc['push'](_0xf6f995);return _0x3788dc;});} \ No newline at end of file +var _0xe5db=['catch','find','create','body','params','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Configuration','Dynamics365Field','substring','lastIndexOf','format','ticketType','incident','PhoneCall','title','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','https://login.microsoftonline.com/','tenantId','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','Bearer\x20','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','json','undefined','count','offset','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Dynamics365Account','includeAll','include','rows'];(function(_0x23cce2,_0x5ca66d){var _0xd7efa2=function(_0x2b1ad9){while(--_0x2b1ad9){_0x23cce2['push'](_0x23cce2['shift']());}};_0xd7efa2(++_0x5ca66d);}(_0xe5db,0x1f3));var _0xbe5d=function(_0x5cc0f5,_0x241d4e){_0x5cc0f5=_0x5cc0f5-0x0;var _0x231110=_0xe5db[_0x5cc0f5];return _0x231110;};'use strict';var rp=require('request-promise');var util=require(_0xbe5d('0x0'));var _=require('lodash');var qs=require(_0xbe5d('0x1'));var logger=require(_0xbe5d('0x2'))(_0xbe5d('0x3'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbe5d('0x4'));function respondWithResult(_0x53d3c9,_0x24f699){_0x24f699=_0x24f699||0xc8;return function(_0x5f9625){if(_0x5f9625){return _0x53d3c9[_0xbe5d('0x5')](_0x24f699)[_0xbe5d('0x6')](_0x5f9625);}};}function respondWithFilteredResult(_0x5e7aab,_0x4d37b5){return function(_0x5511da){if(_0x5511da){var _0x4ba77c=typeof _0x4d37b5['offset']===_0xbe5d('0x7')&&typeof _0x4d37b5['limit']===_0xbe5d('0x7');var _0x4c6dfb=_0x5511da[_0xbe5d('0x8')];var _0x2ef62b=_0x4ba77c?0x0:_0x4d37b5[_0xbe5d('0x9')];var _0x3853f5=_0x4ba77c?_0x5511da[_0xbe5d('0x8')]:_0x4d37b5['offset']+_0x4d37b5['limit'];var _0x34154b;if(_0x3853f5>=_0x4c6dfb){_0x3853f5=_0x4c6dfb;_0x34154b=0xc8;}else{_0x34154b=0xce;}_0x5e7aab['status'](_0x34154b);return _0x5e7aab[_0xbe5d('0xa')](_0xbe5d('0xb'),_0x2ef62b+'-'+_0x3853f5+'/'+_0x4c6dfb)[_0xbe5d('0x6')](_0x5511da);}return null;};}function saveUpdates(_0x48410f){return function(_0x379148){if(_0x379148){return _0x379148[_0xbe5d('0xc')](_0x48410f)[_0xbe5d('0xd')](function(_0x39bb74){return _0x39bb74;});}return null;};}function removeEntity(_0x5270fd){return function(_0x28471b){if(_0x28471b){return _0x28471b[_0xbe5d('0xe')]()[_0xbe5d('0xd')](function(){_0x5270fd[_0xbe5d('0x5')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c12dd){return function(_0x4e5961){if(!_0x4e5961){_0x4c12dd[_0xbe5d('0xf')](0x194);}return _0x4e5961;};}function handleError(_0x1f3620,_0x209aff){_0x209aff=_0x209aff||0x1f4;return function(_0x4da39e){logger[_0xbe5d('0x10')](_0x4da39e[_0xbe5d('0x11')]);if(_0x4da39e['name']){delete _0x4da39e[_0xbe5d('0x12')];}_0x1f3620[_0xbe5d('0x5')](_0x209aff)[_0xbe5d('0x13')](_0x4da39e);};}exports[_0xbe5d('0x14')]=function(_0x7b95a6,_0x5f0594){var _0x85b7e={},_0x30ee8f={},_0x840b3={'count':0x0,'rows':[]};var _0x4f624b=_[_0xbe5d('0x15')](db['Dynamics365Account'][_0xbe5d('0x16')],function(_0x261b60){return{'name':_0x261b60['fieldName'],'type':_0x261b60['type'][_0xbe5d('0x17')]};});_0x30ee8f[_0xbe5d('0x18')]=_[_0xbe5d('0x15')](_0x4f624b,_0xbe5d('0x12'));_0x30ee8f['query']=_[_0xbe5d('0x19')](_0x7b95a6[_0xbe5d('0x1a')]);_0x30ee8f[_0xbe5d('0x1b')]=_[_0xbe5d('0x1c')](_0x30ee8f[_0xbe5d('0x18')],_0x30ee8f['query']);_0x85b7e[_0xbe5d('0x1d')]=_[_0xbe5d('0x1c')](_0x30ee8f[_0xbe5d('0x18')],qs[_0xbe5d('0x1e')](_0x7b95a6[_0xbe5d('0x1a')][_0xbe5d('0x1e')]));_0x85b7e[_0xbe5d('0x1d')]=_0x85b7e[_0xbe5d('0x1d')][_0xbe5d('0x1f')]?_0x85b7e[_0xbe5d('0x1d')]:_0x30ee8f[_0xbe5d('0x18')];if(!_0x7b95a6[_0xbe5d('0x1a')]['hasOwnProperty'](_0xbe5d('0x20'))){_0x85b7e['limit']=qs[_0xbe5d('0x21')](_0x7b95a6[_0xbe5d('0x1a')][_0xbe5d('0x21')]);_0x85b7e[_0xbe5d('0x9')]=qs[_0xbe5d('0x9')](_0x7b95a6[_0xbe5d('0x1a')][_0xbe5d('0x9')]);}_0x85b7e[_0xbe5d('0x22')]=qs[_0xbe5d('0x23')](_0x7b95a6[_0xbe5d('0x1a')][_0xbe5d('0x23')]);_0x85b7e[_0xbe5d('0x24')]=qs[_0xbe5d('0x1b')](_[_0xbe5d('0x25')](_0x7b95a6[_0xbe5d('0x1a')],_0x30ee8f[_0xbe5d('0x1b')]),_0x4f624b);if(_0x7b95a6[_0xbe5d('0x1a')][_0xbe5d('0x26')]){_0x85b7e['where']=_[_0xbe5d('0x27')](_0x85b7e[_0xbe5d('0x24')],{'$or':_[_0xbe5d('0x15')](_0x4f624b,function(_0x47b88e){if(_0x47b88e[_0xbe5d('0x28')]!==_0xbe5d('0x29')){var _0x17a4ca={};_0x17a4ca[_0x47b88e[_0xbe5d('0x12')]]={'$like':'%'+_0x7b95a6[_0xbe5d('0x1a')][_0xbe5d('0x26')]+'%'};return _0x17a4ca;}})});}_0x85b7e=_[_0xbe5d('0x27')]({},_0x85b7e,_0x7b95a6[_0xbe5d('0x2a')]);var _0x19f01f={'where':_0x85b7e[_0xbe5d('0x24')]};return db[_0xbe5d('0x2b')][_0xbe5d('0x8')](_0x19f01f)[_0xbe5d('0xd')](function(_0x4c7078){_0x840b3[_0xbe5d('0x8')]=_0x4c7078;if(_0x7b95a6['query'][_0xbe5d('0x2c')]){_0x85b7e[_0xbe5d('0x2d')]=[{'all':!![]}];}return db[_0xbe5d('0x2b')]['findAll'](_0x85b7e);})[_0xbe5d('0xd')](function(_0x35043b){_0x840b3[_0xbe5d('0x2e')]=_0x35043b;return _0x840b3;})[_0xbe5d('0xd')](respondWithFilteredResult(_0x5f0594,_0x85b7e))[_0xbe5d('0x2f')](handleError(_0x5f0594,null));};exports['show']=function(_0x1e12c6,_0x4d0175){var _0x570db5={'raw':![],'where':{'id':_0x1e12c6['params']['id']}},_0xab5ad6={};_0xab5ad6['model']=_['keys'](db[_0xbe5d('0x2b')][_0xbe5d('0x16')]);_0xab5ad6['query']=_[_0xbe5d('0x19')](_0x1e12c6[_0xbe5d('0x1a')]);_0xab5ad6[_0xbe5d('0x1b')]=_[_0xbe5d('0x1c')](_0xab5ad6['model'],_0xab5ad6[_0xbe5d('0x1a')]);_0x570db5[_0xbe5d('0x1d')]=_['intersection'](_0xab5ad6['model'],qs[_0xbe5d('0x1e')](_0x1e12c6[_0xbe5d('0x1a')][_0xbe5d('0x1e')]));_0x570db5[_0xbe5d('0x1d')]=_0x570db5[_0xbe5d('0x1d')][_0xbe5d('0x1f')]?_0x570db5['attributes']:_0xab5ad6[_0xbe5d('0x18')];if(_0x1e12c6[_0xbe5d('0x1a')]['includeAll']){_0x570db5[_0xbe5d('0x2d')]=[{'all':!![]}];}_0x570db5=_[_0xbe5d('0x27')]({},_0x570db5,_0x1e12c6[_0xbe5d('0x2a')]);return db[_0xbe5d('0x2b')][_0xbe5d('0x30')](_0x570db5)[_0xbe5d('0xd')](handleEntityNotFound(_0x4d0175,null))[_0xbe5d('0xd')](respondWithResult(_0x4d0175,null))[_0xbe5d('0x2f')](handleError(_0x4d0175,null));};exports[_0xbe5d('0x31')]=function(_0x3ec0c7,_0x1b3ab5){return db['Dynamics365Account'][_0xbe5d('0x31')](_0x3ec0c7[_0xbe5d('0x32')],{})['then'](respondWithResult(_0x1b3ab5,0xc9))[_0xbe5d('0x2f')](handleError(_0x1b3ab5,null));};exports[_0xbe5d('0xc')]=function(_0xdf2aef,_0x3a483e){if(_0xdf2aef[_0xbe5d('0x32')]['id']){delete _0xdf2aef[_0xbe5d('0x32')]['id'];}return db[_0xbe5d('0x2b')][_0xbe5d('0x30')]({'where':{'id':_0xdf2aef[_0xbe5d('0x33')]['id']}})[_0xbe5d('0xd')](handleEntityNotFound(_0x3a483e,null))['then'](saveUpdates(_0xdf2aef[_0xbe5d('0x32')],null))['then'](respondWithResult(_0x3a483e,null))['catch'](handleError(_0x3a483e,null));};exports['destroy']=function(_0x224e4e,_0x1fb251){return db[_0xbe5d('0x2b')][_0xbe5d('0x30')]({'where':{'id':_0x224e4e[_0xbe5d('0x33')]['id']}})[_0xbe5d('0xd')](handleEntityNotFound(_0x1fb251,null))[_0xbe5d('0xd')](removeEntity(_0x1fb251,null))[_0xbe5d('0x2f')](handleError(_0x1fb251,null));};exports[_0xbe5d('0x34')]=function(_0x3e7a3b,_0x1b24b4){var _0x3508db={};var _0x172a0f={};var _0x1c4d3c;var _0x3d91c8;return db['Dynamics365Account'][_0xbe5d('0x35')]({'where':{'id':_0x3e7a3b['params']['id']}})['then'](handleEntityNotFound(_0x1b24b4,null))[_0xbe5d('0xd')](function(_0x34f448){if(_0x34f448){_0x1c4d3c=_0x34f448;_0x172a0f[_0xbe5d('0x18')]=_[_0xbe5d('0x19')](db['Dynamics365Configuration'][_0xbe5d('0x16')]);_0x172a0f['query']=_['keys'](_0x3e7a3b['query']);_0x172a0f[_0xbe5d('0x1b')]=_[_0xbe5d('0x1c')](_0x172a0f[_0xbe5d('0x18')],_0x172a0f['query']);_0x3508db[_0xbe5d('0x1d')]=_[_0xbe5d('0x1c')](_0x172a0f['model'],qs[_0xbe5d('0x1e')](_0x3e7a3b[_0xbe5d('0x1a')][_0xbe5d('0x1e')]));_0x3508db['attributes']=_0x3508db[_0xbe5d('0x1d')][_0xbe5d('0x1f')]?_0x3508db[_0xbe5d('0x1d')]:_0x172a0f[_0xbe5d('0x18')];_0x3508db['order']=qs['sort'](_0x3e7a3b[_0xbe5d('0x1a')][_0xbe5d('0x23')]);_0x3508db[_0xbe5d('0x24')]=qs[_0xbe5d('0x1b')](_['pick'](_0x3e7a3b[_0xbe5d('0x1a')],_0x172a0f[_0xbe5d('0x1b')]));if(_0x3e7a3b[_0xbe5d('0x1a')][_0xbe5d('0x26')]){_0x3508db['where']=_['merge'](_0x3508db[_0xbe5d('0x24')],{'$or':_[_0xbe5d('0x15')](_0x3508db[_0xbe5d('0x1d')],function(_0x48d95b){var _0xcbabe9={};_0xcbabe9[_0x48d95b]={'$like':'%'+_0x3e7a3b['query'][_0xbe5d('0x26')]+'%'};return _0xcbabe9;})});}_0x3508db=_[_0xbe5d('0x27')]({},_0x3508db,_0x3e7a3b[_0xbe5d('0x2a')]);return _0x1c4d3c[_0xbe5d('0x34')](_0x3508db);}})[_0xbe5d('0xd')](function(_0x404078){if(_0x404078){_0x3d91c8=_0x404078[_0xbe5d('0x1f')];if(!_0x3e7a3b[_0xbe5d('0x1a')][_0xbe5d('0x36')]('nolimit')){_0x3508db[_0xbe5d('0x21')]=qs['limit'](_0x3e7a3b[_0xbe5d('0x1a')][_0xbe5d('0x21')]);_0x3508db[_0xbe5d('0x9')]=qs['offset'](_0x3e7a3b['query'][_0xbe5d('0x9')]);}return _0x1c4d3c[_0xbe5d('0x34')](_0x3508db);}})[_0xbe5d('0xd')](function(_0x12d3cb){if(_0x12d3cb){return _0x12d3cb?{'count':_0x3d91c8,'rows':_0x12d3cb}:null;}})['then'](respondWithResult(_0x1b24b4,null))[_0xbe5d('0x2f')](handleError(_0x1b24b4,null));};exports[_0xbe5d('0x37')]=function(_0x18a0d0,_0x17ff43){if(_0x18a0d0['body']['id']){delete _0x18a0d0[_0xbe5d('0x32')]['id'];}return db[_0xbe5d('0x2b')][_0xbe5d('0x35')]({'where':{'id':_0x18a0d0[_0xbe5d('0x33')]['id']}})[_0xbe5d('0xd')](handleEntityNotFound(_0x17ff43,null))[_0xbe5d('0xd')](function(_0x4ef3bb){if(_0x4ef3bb){_0x18a0d0[_0xbe5d('0x32')][_0xbe5d('0x38')]=_0x4ef3bb['id'];_0x18a0d0[_0xbe5d('0x32')][_0xbe5d('0x39')]=integrations[_0xbe5d('0x3a')](_0x18a0d0[_0xbe5d('0x32')][_0xbe5d('0x3b')],_0x18a0d0[_0xbe5d('0x32')]['type']);_0x18a0d0[_0xbe5d('0x32')]['Descriptions']=integrations[_0xbe5d('0x3c')](_0x18a0d0[_0xbe5d('0x32')][_0xbe5d('0x3b')],_0x18a0d0[_0xbe5d('0x32')][_0xbe5d('0x28')]);return db[_0xbe5d('0x3d')][_0xbe5d('0x31')](_0x18a0d0[_0xbe5d('0x32')],{'include':[{'model':db[_0xbe5d('0x3e')],'as':_0xbe5d('0x39')},{'model':db[_0xbe5d('0x3e')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x17ff43,null))[_0xbe5d('0x2f')](handleError(_0x17ff43,null));};function sanitizeRemoteUri(_0x3c0719){var _0x9fc580=_0x3c0719['slice'](-0x1);if(_0x9fc580==='/')return _0x3c0719[_0xbe5d('0x3f')](0x0,_0x3c0719[_0xbe5d('0x40')](_0x9fc580));return _0x3c0719;}function getWebApiUrl(_0x2ba57d){return util[_0xbe5d('0x41')]('%s/api/data/v9.0/',_0x2ba57d);}exports['getFields']=function(_0x1a5840,_0x250667){var _0x19967c=_0x1a5840[_0xbe5d('0x1a')][_0xbe5d('0x42')];var _0x3d6da3=_0x19967c===_0xbe5d('0x43')?'Incident':_0xbe5d('0x44');var _0x435eb2='';var _0x32bd8b='';var _0x59b269='';var _0x297796='';var _0x4a47a7='';var _0x2cc0fb='';var _0x2682b0='';var _0xb87cd2='';var _0x389c53=[_0xbe5d('0x45'),'description',_0xbe5d('0x46'),_0xbe5d('0x47'),_0xbe5d('0x48'),_0xbe5d('0x49'),_0xbe5d('0x4a'),_0xbe5d('0x4b'),'directioncode',_0xbe5d('0x4c')];var _0x2ed641=[_0xbe5d('0x4d'),_0xbe5d('0x4e'),_0xbe5d('0x4f'),_0xbe5d('0x50'),_0xbe5d('0x51'),_0xbe5d('0x52'),_0xbe5d('0x53'),'contractidname',_0xbe5d('0x54'),'createdbyexternalpartyyominame',_0xbe5d('0x55'),_0xbe5d('0x56'),_0xbe5d('0x57'),_0xbe5d('0x58'),'createdonbehalfbyyominame',_0xbe5d('0x59'),_0xbe5d('0x5a'),_0xbe5d('0x5b'),'emailaddress',_0xbe5d('0x5c'),_0xbe5d('0x5d'),_0xbe5d('0x5e'),_0xbe5d('0x5f'),_0xbe5d('0x60'),_0xbe5d('0x61'),_0xbe5d('0x62'),_0xbe5d('0x63'),'influencescore',_0xbe5d('0x64'),_0xbe5d('0x65'),_0xbe5d('0x66'),_0xbe5d('0x67'),_0xbe5d('0x68'),_0xbe5d('0x69'),_0xbe5d('0x6a'),_0xbe5d('0x6b'),_0xbe5d('0x6c'),_0xbe5d('0x6d'),'msdyn_incidenttypename',_0xbe5d('0x6e'),_0xbe5d('0x6f'),_0xbe5d('0x70'),'overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname',_0xbe5d('0x71'),_0xbe5d('0x72'),_0xbe5d('0x73'),'productidname',_0xbe5d('0x74'),_0xbe5d('0x75'),'resolvebykpiidname','responseby','responsiblecontactidname',_0xbe5d('0x76'),_0xbe5d('0x77'),_0xbe5d('0x78'),'slaname','socialprofileidname','statecode','statuscode',_0xbe5d('0x79'),_0xbe5d('0x7a'),_0xbe5d('0x7b'),'transactioncurrencyidname',_0xbe5d('0x7c'),_0xbe5d('0x7d'),_0xbe5d('0x7e')];var _0x107650=_0x389c53[_0xbe5d('0x7f')](_0x2ed641);return db['Dynamics365Account']['findOne']({'where':{'id':_0x1a5840['params']['id']},'attributes':['id',_0xbe5d('0x80'),'password',_0xbe5d('0x81'),'tenantId',_0xbe5d('0x82'),_0xbe5d('0x83'),_0xbe5d('0x84')],'include':[{'model':db[_0xbe5d('0x85')],'as':_0xbe5d('0x85'),'attributes':['id',_0xbe5d('0x86'),_0xbe5d('0x87')]}]})[_0xbe5d('0xd')](handleEntityNotFound(_0x250667,null))[_0xbe5d('0xd')](function(_0x4d4e25){if(_0x4d4e25){if(_0x4d4e25[_0xbe5d('0x84')]){_0x4d4e25['access_token']=_0x4d4e25[_0xbe5d('0x85')][_0xbe5d('0x86')];_0xb87cd2=sanitizeRemoteUri(_0x4d4e25[_0xbe5d('0x85')][_0xbe5d('0x87')]);_0x2682b0=getWebApiUrl(_0xb87cd2);return _0x4d4e25;}_0xb87cd2=sanitizeRemoteUri(_0x4d4e25[_0xbe5d('0x81')]);_0x2682b0=getWebApiUrl(_0xb87cd2);var _0x670b5a={'method':'POST','uri':_0xbe5d('0x88')+_0x4d4e25[_0xbe5d('0x89')]+_0xbe5d('0x8a'),'form':{'client_id':_0x4d4e25[_0xbe5d('0x82')],'resource':_0xb87cd2,'username':_0x4d4e25['username'],'password':_0x4d4e25['password'],'grant_type':'password','client_secret':_0x4d4e25[_0xbe5d('0x83')]},'json':!![]};return rp(_0x670b5a);}})[_0xbe5d('0xd')](function(_0x4e60dd){_0x2cc0fb=_0x4e60dd[_0xbe5d('0x8b')];var _0x1e79bc={'method':_0xbe5d('0x8c'),'uri':encodeURI(_0x2682b0+_0xbe5d('0x8d')+_0x3d6da3+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2cc0fb,'If-None-Match':null,'OData-Version':_0xbe5d('0x8e')},'json':!![]};return rp(_0x1e79bc);})[_0xbe5d('0xd')](function(_0xf3f72b){var _0x10c58b=_0xf3f72b[_0xbe5d('0x8f')][0x0];var _0x49d052=_0x10c58b[_0xbe5d('0x90')];var _0x275ce4={'method':_0xbe5d('0x8c'),'uri':_0x2682b0+_0xbe5d('0x91')+_0x49d052+_0xbe5d('0x92'),'headers':{'Authorization':'Bearer\x20'+_0x2cc0fb,'If-None-Match':null,'OData-Version':_0xbe5d('0x8e')},'json':!![]};return rp(_0x275ce4);})[_0xbe5d('0xd')](function(_0x5920a5){_0x435eb2=_0x5920a5;_0x32bd8b=_0x435eb2['Attributes'];_0x32bd8b=_[_0xbe5d('0x93')](_0x32bd8b,function(_0x9ad49d){return!_0x107650['includes'](_0x9ad49d[_0xbe5d('0x94')]);});var _0x2f963d=[];var _0x2f95cb=[];_0x32bd8b[_0xbe5d('0x95')](function(_0x27f54c){if(_0x27f54c[_0xbe5d('0x96')]){var _0x2a5f2b=_0x27f54c[_0xbe5d('0x96')][_0xbe5d('0x3f')](_0x27f54c[_0xbe5d('0x96')][_0xbe5d('0x40')]('.')+0x1);if(_0x2a5f2b===_0xbe5d('0x97')){_0x2f963d[_0xbe5d('0x98')](getSelectList(_0x2682b0,_0x19967c,_0x2f95cb,_0x435eb2[_0xbe5d('0x90')],_0x27f54c['MetadataId'],_0x2cc0fb));}}});return Promise[_0xbe5d('0x99')](_0x2f963d);})[_0xbe5d('0xd')](function(_0x13b86d){_0x59b269=_0x13b86d[0x0];var _0x2fd9c9=[];var _0x1d5be7=[];_0x32bd8b[_0xbe5d('0x95')](function(_0x20a66d){if(!_[_0xbe5d('0x9a')](_0x20a66d[_0xbe5d('0x96')])){var _0x3feb35=_0x20a66d['@odata.type'][_0xbe5d('0x3f')](_0x20a66d[_0xbe5d('0x96')][_0xbe5d('0x40')]('.')+0x1);if(_0x3feb35===_0xbe5d('0x9b')){_0x2fd9c9[_0xbe5d('0x98')](getBooleanList(_0x2682b0,_0x19967c,_0x1d5be7,_0x435eb2[_0xbe5d('0x90')],_0x20a66d[_0xbe5d('0x90')],_0x2cc0fb));}}});return Promise[_0xbe5d('0x99')](_0x2fd9c9);})[_0xbe5d('0xd')](function(_0x36407c){_0x297796=_0x36407c[0x0];var _0xb80f03=[];var _0x582c00=[];_0x32bd8b['forEach'](function(_0x39782b){if(_0x39782b[_0xbe5d('0x96')]){var _0x35cc4d=_0x39782b['@odata.type']['substring'](_0x39782b[_0xbe5d('0x96')][_0xbe5d('0x40')]('.')+0x1);if(_0x35cc4d===_0xbe5d('0x9c')||_0x35cc4d==='DoubleAttributeMetadata'||_0x35cc4d===_0xbe5d('0x9d')||_0x35cc4d===_0xbe5d('0x9e')||_0x35cc4d===_0xbe5d('0x9f')||_0x35cc4d==='DateTimeAttributeMetadata'||_0x35cc4d==='StatusAttributeMetadata'||_0x35cc4d===_0xbe5d('0xa0')||_0x35cc4d===_0xbe5d('0xa1')||_0x35cc4d===_0xbe5d('0xa2')){_0xb80f03[_0xbe5d('0x98')](getInputList(_0x2682b0,_0x19967c,_0x35cc4d,_0x582c00,_0x435eb2['MetadataId'],_0x39782b[_0xbe5d('0x90')],_0x2cc0fb));}}});return Promise[_0xbe5d('0x99')](_0xb80f03);})[_0xbe5d('0xd')](function(_0x8b1d2c){_0x4a47a7=_0x8b1d2c[0x0];var _0x5f53a5=_0x59b269[_0xbe5d('0x7f')](_0x297796)[_0xbe5d('0x7f')](_0x4a47a7);var _0x1c1b15={'count':_0x5f53a5[_0xbe5d('0x1f')],'rows':_0x5f53a5};return _0x1c1b15;})[_0xbe5d('0xd')](respondWithResult(_0x250667,null))['catch'](function(_0x246e88){var _0x280b50=_0x1a5840[_0xbe5d('0x1a')]['test']?0x1f4:_0x246e88[_0xbe5d('0xa3')]||0x1f4;logger['error'](_0x246e88['stack']);delete _0x246e88[_0xbe5d('0x12')];if(_0x280b50===0x191){_0x280b50=0x190;}_0x250667[_0xbe5d('0x5')](_0x280b50)[_0xbe5d('0x13')](_0x1a5840[_0xbe5d('0x1a')][_0xbe5d('0xa4')]?{'message':_0xbe5d('0xa5'),'statusCode':_0x246e88[_0xbe5d('0xa3')]}:_0x246e88);});};function getSelectList(_0x1c4b3a,_0x245176,_0x2936f5,_0x212c9c,_0x28d739,_0x5e4a8f){var _0x1e788e={'method':_0xbe5d('0x8c'),'uri':_0x1c4b3a+_0xbe5d('0x91')+_0x212c9c+_0xbe5d('0xa6')+_0x28d739+_0xbe5d('0xa7')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x5e4a8f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1e788e)[_0xbe5d('0xd')](function(_0x1868e4){var _0x5d9d7a=[];var _0x41a771=_0x1868e4[_0xbe5d('0xa8')][_0xbe5d('0xa9')];_0x41a771[_0xbe5d('0x95')](function(_0x545aeb){_0x5d9d7a[_0xbe5d('0x98')]({'name':_0x545aeb[_0xbe5d('0xaa')][_0xbe5d('0xab')][_0xbe5d('0xaa')],'value':String(_0x545aeb[_0xbe5d('0xac')])});});var _0x35bf2d={'id':_0x245176+'_'+_0x1868e4[_0xbe5d('0x94')],'name':_0x1868e4[_0xbe5d('0xad')][_0xbe5d('0xab')][_0xbe5d('0xaa')],'custom':![],'options':_0x5d9d7a};_0x2936f5['push'](_0x35bf2d);return _0x2936f5;});}function getBooleanList(_0x3a6f6f,_0x54470b,_0xa808d2,_0x254995,_0xb2f433,_0x69017){var _0x2d6a12={'method':_0xbe5d('0x8c'),'uri':_0x3a6f6f+_0xbe5d('0x91')+_0x254995+_0xbe5d('0xa6')+_0xb2f433+_0xbe5d('0xae'),'headers':{'Authorization':_0xbe5d('0xaf')+_0x69017,'If-None-Match':null,'OData-Version':_0xbe5d('0x8e')},'json':!![]};return rp(_0x2d6a12)['then'](function(_0x228d65){var _0x15b812=[];_0x15b812[_0xbe5d('0x98')]({'name':_0x228d65['OptionSet'][_0xbe5d('0xb0')][_0xbe5d('0xaa')]['UserLocalizedLabel']['Label'],'value':_0xbe5d('0xb1')},{'name':_0x228d65[_0xbe5d('0xa8')][_0xbe5d('0xb2')][_0xbe5d('0xaa')][_0xbe5d('0xab')]['Label'],'value':_0xbe5d('0xb3')});var _0x3eabb1={'id':_0x54470b+'_'+_0x228d65[_0xbe5d('0x94')],'name':_0x228d65[_0xbe5d('0xad')][_0xbe5d('0xab')]['Label'],'custom':![],'options':_0x15b812};_0xa808d2[_0xbe5d('0x98')](_0x3eabb1);return _0xa808d2;});}function getInputList(_0x467c87,_0x2efc6a,_0x1c85f1,_0x2caf0f,_0x47eda7,_0x35ca2b,_0x419964){var _0x2b58d6={'method':_0xbe5d('0x8c'),'uri':_0x467c87+_0xbe5d('0x91')+_0x47eda7+_0xbe5d('0xa6')+_0x35ca2b+_0xbe5d('0xb4')+_0x1c85f1+_0xbe5d('0xb5'),'headers':{'Authorization':_0xbe5d('0xaf')+_0x419964,'If-None-Match':null,'OData-Version':_0xbe5d('0x8e')},'json':!![]};return rp(_0x2b58d6)[_0xbe5d('0xd')](function(_0x42ab61){var _0x2af1f8={'id':_0x2efc6a+'_'+_0x42ab61[_0xbe5d('0x94')],'name':_0x42ab61['DisplayName'][_0xbe5d('0xab')]?_0x42ab61[_0xbe5d('0xad')][_0xbe5d('0xab')]['Label']:_0x42ab61[_0xbe5d('0x94')],'custom':![],'options':[]};_0x2caf0f[_0xbe5d('0x98')](_0x2af1f8);return _0x2caf0f;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 595262e..470cf6e 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1cf868,_0x127879){var _0x6862d1=function(_0x1cfffb){while(--_0x1cfffb){_0x1cf868['push'](_0x1cf868['shift']());}};_0x6862d1(++_0x127879);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x7276e9,_0x44642c){var _0x8bb8fc=function(_0x8bde73){while(--_0x8bde73){_0x7276e9['push'](_0x7276e9['shift']());}};_0x8bb8fc(++_0x44642c);}(_0x757a,0xde));var _0xa757=function(_0x4f11ca,_0x5c8418){_0x4f11ca=_0x4f11ca-0x0;var _0x480c73=_0x757a[_0x4f11ca];return _0x480c73;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 8f7f702..a1c4699 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 _0x28cc=['result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','catch','ShowDynamics365Account','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x894c0b,_0xb5ce86){var _0x1f27a9=function(_0x25237f){while(--_0x25237f){_0x894c0b['push'](_0x894c0b['shift']());}};_0x1f27a9(++_0xb5ce86);}(_0x28cc,0x1d4));var _0xc28c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x28cc[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc28c('0x0'));var util=require('util');var moment=require(_0xc28c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc28c('0x2'));var fs=require('fs');var Redis=require(_0xc28c('0x3'));var db=require(_0xc28c('0x4'))['db'];var utils=require(_0xc28c('0x5'));var logger=require(_0xc28c('0x6'))(_0xc28c('0x7'));var config=require(_0xc28c('0x8'));var jayson=require(_0xc28c('0x9'));var client=jayson[_0xc28c('0xa')][_0xc28c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dd6d3,_0x10b8cd,_0x25c89c){return new BPromise(function(_0x2b3b13,_0x44d2ed){return client[_0xc28c('0xc')](_0x5dd6d3,_0x25c89c)[_0xc28c('0xd')](function(_0x5bf2da){logger[_0xc28c('0xe')](_0xc28c('0xf'),_0x10b8cd,'request\x20sent');logger[_0xc28c('0x10')](_0xc28c('0x11'),_0x10b8cd,_0xc28c('0x12'),JSON[_0xc28c('0x13')](_0x5bf2da));if(_0x5bf2da['error']){if(_0x5bf2da[_0xc28c('0x14')]['code']===0x1f4){logger[_0xc28c('0x14')](_0xc28c('0xf'),_0x10b8cd,_0x5bf2da[_0xc28c('0x14')][_0xc28c('0x15')]);return _0x44d2ed(_0x5bf2da[_0xc28c('0x14')]['message']);}logger[_0xc28c('0x14')](_0xc28c('0xf'),_0x10b8cd,_0x5bf2da['error'][_0xc28c('0x15')]);return _0x2b3b13(_0x5bf2da['error'][_0xc28c('0x15')]);}else{logger[_0xc28c('0xe')](_0xc28c('0xf'),_0x10b8cd,'request\x20sent');_0x2b3b13(_0x5bf2da[_0xc28c('0x16')][_0xc28c('0x15')]);}})['catch'](function(_0x3e3b73){logger[_0xc28c('0x14')](_0xc28c('0xf'),_0x10b8cd,_0x3e3b73);_0x44d2ed(_0x3e3b73);});});}exports[_0xc28c('0x17')]=function(_0x151716){var _0x1beca0=this;return new Promise(function(_0x46bfed,_0x54d1a1){return db[_0xc28c('0x18')][_0xc28c('0x19')]({'raw':_0x151716[_0xc28c('0x1a')]?_0x151716[_0xc28c('0x1a')][_0xc28c('0x1b')]===undefined?!![]:![]:!![],'where':_0x151716[_0xc28c('0x1a')]?_0x151716['options'][_0xc28c('0x1c')]||null:null,'attributes':_0x151716[_0xc28c('0x1a')]?_0x151716['options'][_0xc28c('0x1d')]||null:null,'limit':_0x151716[_0xc28c('0x1a')]?_0x151716[_0xc28c('0x1a')]['limit']||null:null,'include':_0x151716['options']?_0x151716[_0xc28c('0x1a')][_0xc28c('0x1e')]?_[_0xc28c('0x1f')](_0x151716[_0xc28c('0x1a')][_0xc28c('0x1e')],function(_0x1e00c8){return{'model':db[_0x1e00c8[_0xc28c('0x20')]],'as':_0x1e00c8['as'],'attributes':_0x1e00c8[_0xc28c('0x1d')],'include':_0x1e00c8[_0xc28c('0x1e')]?_[_0xc28c('0x1f')](_0x1e00c8['include'],function(_0x53b06a){return{'model':db[_0x53b06a[_0xc28c('0x20')]],'as':_0x53b06a['as'],'attributes':_0x53b06a['attributes'],'include':_0x53b06a['include']?_['map'](_0x53b06a['include'],function(_0x26f5a4){return{'model':db[_0x26f5a4['model']],'as':_0x26f5a4['as'],'attributes':_0x26f5a4[_0xc28c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc28c('0xd')](function(_0x2e0077){logger[_0xc28c('0xe')]('GetDynamics365Account',_0x151716);logger[_0xc28c('0x10')](_0xc28c('0x17'),_0x151716,JSON[_0xc28c('0x13')](_0x2e0077));_0x46bfed(_0x2e0077);})[_0xc28c('0x21')](function(_0xc8f60a){logger[_0xc28c('0x14')]('GetDynamics365Account',_0xc8f60a[_0xc28c('0x15')],_0x151716);_0x54d1a1(_0x1beca0[_0xc28c('0x14')](0x1f4,_0xc8f60a[_0xc28c('0x15')]));});});};exports[_0xc28c('0x22')]=function(_0x1ff570){var _0x4ce8f5=this;return new Promise(function(_0x36c1a3,_0xd2b658){return db['Dynamics365Account']['find']({'raw':_0x1ff570[_0xc28c('0x1a')]?_0x1ff570[_0xc28c('0x1a')][_0xc28c('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ff570['options']?_0x1ff570['options'][_0xc28c('0x1c')]||null:null,'attributes':_0x1ff570['options']?_0x1ff570['options']['attributes']||null:null,'include':_0x1ff570['options']?_0x1ff570[_0xc28c('0x1a')]['include']?_['map'](_0x1ff570[_0xc28c('0x1a')]['include'],function(_0x254b0e){return{'model':db[_0x254b0e[_0xc28c('0x20')]],'as':_0x254b0e['as'],'attributes':_0x254b0e['attributes'],'include':_0x254b0e[_0xc28c('0x1e')]?_[_0xc28c('0x1f')](_0x254b0e[_0xc28c('0x1e')],function(_0x427908){return{'model':db[_0x427908[_0xc28c('0x20')]],'as':_0x427908['as'],'attributes':_0x427908['attributes'],'include':_0x427908['include']?_[_0xc28c('0x1f')](_0x427908['include'],function(_0x57cacf){return{'model':db[_0x57cacf['model']],'as':_0x57cacf['as'],'attributes':_0x57cacf[_0xc28c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc28c('0xd')](function(_0x424d40){logger[_0xc28c('0xe')](_0xc28c('0x22'),_0x1ff570);logger[_0xc28c('0x10')](_0xc28c('0x22'),_0x1ff570,JSON[_0xc28c('0x13')](_0x424d40));_0x36c1a3(_0x424d40);})[_0xc28c('0x21')](function(_0x4cda3c){logger[_0xc28c('0x14')](_0xc28c('0x22'),_0x4cda3c[_0xc28c('0x15')],_0x1ff570);_0xd2b658(_0x4ce8f5[_0xc28c('0x14')](0x1f4,_0x4cda3c[_0xc28c('0x15')]));});});}; \ No newline at end of file +var _0x0eac=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Dynamics365Account,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','Dynamics365Account','findAll','options','raw','where','attributes','limit','map','include','model','then','GetDynamics365Account','ShowDynamics365Account','find','catch'];(function(_0x167c28,_0x4b86e2){var _0x11dd22=function(_0x441497){while(--_0x441497){_0x167c28['push'](_0x167c28['shift']());}};_0x11dd22(++_0x4b86e2);}(_0x0eac,0x1e1));var _0xc0ea=function(_0x38ce4c,_0xfdbe8c){_0x38ce4c=_0x38ce4c-0x0;var _0x5d4544=_0x0eac[_0x38ce4c];return _0x5d4544;};'use strict';var _=require(_0xc0ea('0x0'));var util=require(_0xc0ea('0x1'));var moment=require(_0xc0ea('0x2'));var BPromise=require(_0xc0ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0ea('0x4'));var db=require(_0xc0ea('0x5'))['db'];var utils=require(_0xc0ea('0x6'));var logger=require(_0xc0ea('0x7'))(_0xc0ea('0x8'));var config=require(_0xc0ea('0x9'));var jayson=require(_0xc0ea('0xa'));var client=jayson[_0xc0ea('0xb')][_0xc0ea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x397f9f,_0x16d41c,_0x2499c5){return new BPromise(function(_0x25f321,_0x44746f){return client['request'](_0x397f9f,_0x2499c5)['then'](function(_0xc2a5dc){logger[_0xc0ea('0xd')](_0xc0ea('0xe'),_0x16d41c,'request\x20sent');logger[_0xc0ea('0xf')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x16d41c,_0xc0ea('0x10'),JSON[_0xc0ea('0x11')](_0xc2a5dc));if(_0xc2a5dc[_0xc0ea('0x12')]){if(_0xc2a5dc[_0xc0ea('0x12')][_0xc0ea('0x13')]===0x1f4){logger[_0xc0ea('0x12')](_0xc0ea('0xe'),_0x16d41c,_0xc2a5dc[_0xc0ea('0x12')]['message']);return _0x44746f(_0xc2a5dc['error'][_0xc0ea('0x14')]);}logger[_0xc0ea('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x16d41c,_0xc2a5dc[_0xc0ea('0x12')][_0xc0ea('0x14')]);return _0x25f321(_0xc2a5dc[_0xc0ea('0x12')]['message']);}else{logger[_0xc0ea('0xd')](_0xc0ea('0xe'),_0x16d41c,_0xc0ea('0x10'));_0x25f321(_0xc2a5dc[_0xc0ea('0x15')][_0xc0ea('0x14')]);}})['catch'](function(_0x3b4e50){logger[_0xc0ea('0x12')](_0xc0ea('0xe'),_0x16d41c,_0x3b4e50);_0x44746f(_0x3b4e50);});});}exports['GetDynamics365Account']=function(_0x51d295){var _0x5007dc=this;return new Promise(function(_0x5e8d39,_0x2f58fc){return db[_0xc0ea('0x16')][_0xc0ea('0x17')]({'raw':_0x51d295[_0xc0ea('0x18')]?_0x51d295[_0xc0ea('0x18')][_0xc0ea('0x19')]===undefined?!![]:![]:!![],'where':_0x51d295[_0xc0ea('0x18')]?_0x51d295[_0xc0ea('0x18')][_0xc0ea('0x1a')]||null:null,'attributes':_0x51d295['options']?_0x51d295[_0xc0ea('0x18')][_0xc0ea('0x1b')]||null:null,'limit':_0x51d295[_0xc0ea('0x18')]?_0x51d295[_0xc0ea('0x18')][_0xc0ea('0x1c')]||null:null,'include':_0x51d295['options']?_0x51d295[_0xc0ea('0x18')]['include']?_[_0xc0ea('0x1d')](_0x51d295[_0xc0ea('0x18')][_0xc0ea('0x1e')],function(_0x2d3ccc){return{'model':db[_0x2d3ccc[_0xc0ea('0x1f')]],'as':_0x2d3ccc['as'],'attributes':_0x2d3ccc[_0xc0ea('0x1b')],'include':_0x2d3ccc[_0xc0ea('0x1e')]?_[_0xc0ea('0x1d')](_0x2d3ccc[_0xc0ea('0x1e')],function(_0x1bf6bf){return{'model':db[_0x1bf6bf[_0xc0ea('0x1f')]],'as':_0x1bf6bf['as'],'attributes':_0x1bf6bf[_0xc0ea('0x1b')],'include':_0x1bf6bf['include']?_[_0xc0ea('0x1d')](_0x1bf6bf[_0xc0ea('0x1e')],function(_0x1fa258){return{'model':db[_0x1fa258['model']],'as':_0x1fa258['as'],'attributes':_0x1fa258[_0xc0ea('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc0ea('0x20')](function(_0x2593cb){logger[_0xc0ea('0xd')](_0xc0ea('0x21'),_0x51d295);logger[_0xc0ea('0xf')](_0xc0ea('0x21'),_0x51d295,JSON[_0xc0ea('0x11')](_0x2593cb));_0x5e8d39(_0x2593cb);})['catch'](function(_0x414756){logger[_0xc0ea('0x12')](_0xc0ea('0x21'),_0x414756[_0xc0ea('0x14')],_0x51d295);_0x2f58fc(_0x5007dc[_0xc0ea('0x12')](0x1f4,_0x414756[_0xc0ea('0x14')]));});});};exports[_0xc0ea('0x22')]=function(_0x13c47c){var _0x2028db=this;return new Promise(function(_0x101114,_0x321137){return db[_0xc0ea('0x16')][_0xc0ea('0x23')]({'raw':_0x13c47c[_0xc0ea('0x18')]?_0x13c47c['options'][_0xc0ea('0x19')]===undefined?!![]:![]:!![],'where':_0x13c47c[_0xc0ea('0x18')]?_0x13c47c['options'][_0xc0ea('0x1a')]||null:null,'attributes':_0x13c47c[_0xc0ea('0x18')]?_0x13c47c[_0xc0ea('0x18')][_0xc0ea('0x1b')]||null:null,'include':_0x13c47c[_0xc0ea('0x18')]?_0x13c47c[_0xc0ea('0x18')][_0xc0ea('0x1e')]?_[_0xc0ea('0x1d')](_0x13c47c['options'][_0xc0ea('0x1e')],function(_0x5b7fcc){return{'model':db[_0x5b7fcc[_0xc0ea('0x1f')]],'as':_0x5b7fcc['as'],'attributes':_0x5b7fcc[_0xc0ea('0x1b')],'include':_0x5b7fcc['include']?_['map'](_0x5b7fcc[_0xc0ea('0x1e')],function(_0x54fc70){return{'model':db[_0x54fc70[_0xc0ea('0x1f')]],'as':_0x54fc70['as'],'attributes':_0x54fc70['attributes'],'include':_0x54fc70[_0xc0ea('0x1e')]?_[_0xc0ea('0x1d')](_0x54fc70[_0xc0ea('0x1e')],function(_0x41fdef){return{'model':db[_0x41fdef[_0xc0ea('0x1f')]],'as':_0x41fdef['as'],'attributes':_0x41fdef[_0xc0ea('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc0ea('0x20')](function(_0x160994){logger['info'](_0xc0ea('0x22'),_0x13c47c);logger['debug']('ShowDynamics365Account',_0x13c47c,JSON[_0xc0ea('0x11')](_0x160994));_0x101114(_0x160994);})[_0xc0ea('0x24')](function(_0x65fa19){logger[_0xc0ea('0x12')](_0xc0ea('0x22'),_0x65fa19[_0xc0ea('0x14')],_0x13c47c);_0x321137(_0x2028db['error'](0x1f4,_0x65fa19['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index cc40afe..642b3e2 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 _0xd5eb=['update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put'];(function(_0x12309b,_0x59dd8c){var _0x482e4d=function(_0x308407){while(--_0x308407){_0x12309b['push'](_0x12309b['shift']());}};_0x482e4d(++_0x59dd8c);}(_0xd5eb,0x183));var _0xbd5e=function(_0x56247f,_0x14328c){_0x56247f=_0x56247f-0x0;var _0x366b52=_0xd5eb[_0x56247f];return _0x366b52;};'use strict';var multer=require(_0xbd5e('0x0'));var util=require(_0xbd5e('0x1'));var path=require('path');var timeout=require(_0xbd5e('0x2'));var express=require(_0xbd5e('0x3'));var router=express[_0xbd5e('0x4')]();var fs_extra=require(_0xbd5e('0x5'));var auth=require(_0xbd5e('0x6'));var interaction=require(_0xbd5e('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0xbd5e('0x8')](),controller[_0xbd5e('0x9')]);router['get'](_0xbd5e('0xa'),auth[_0xbd5e('0x8')](),controller[_0xbd5e('0xb')]);router[_0xbd5e('0xc')](_0xbd5e('0xd'),auth[_0xbd5e('0x8')](),controller[_0xbd5e('0xe')]);router['get'](_0xbd5e('0xf'),auth['isAuthenticated'](),controller[_0xbd5e('0x10')]);router['get'](_0xbd5e('0x11'),auth[_0xbd5e('0x8')](),controller[_0xbd5e('0x12')]);router['post']('/',auth[_0xbd5e('0x8')](),controller[_0xbd5e('0x13')]);router[_0xbd5e('0x14')](_0xbd5e('0xa'),auth[_0xbd5e('0x8')](),controller[_0xbd5e('0x15')]);router[_0xbd5e('0x16')](_0xbd5e('0xa'),auth[_0xbd5e('0x8')](),controller[_0xbd5e('0x17')]);module['exports']=router; \ No newline at end of file +var _0x7f3b=['post','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions'];(function(_0x44c768,_0x552a5e){var _0x55daf5=function(_0x4958e8){while(--_0x4958e8){_0x44c768['push'](_0x44c768['shift']());}};_0x55daf5(++_0x552a5e);}(_0x7f3b,0x13e));var _0xb7f3=function(_0x3ce708,_0x493726){_0x3ce708=_0x3ce708-0x0;var _0x58f926=_0x7f3b[_0x3ce708];return _0x58f926;};'use strict';var multer=require(_0xb7f3('0x0'));var util=require('util');var path=require(_0xb7f3('0x1'));var timeout=require(_0xb7f3('0x2'));var express=require(_0xb7f3('0x3'));var router=express[_0xb7f3('0x4')]();var fs_extra=require(_0xb7f3('0x5'));var auth=require(_0xb7f3('0x6'));var interaction=require(_0xb7f3('0x7'));var config=require(_0xb7f3('0x8'));var controller=require(_0xb7f3('0x9'));router[_0xb7f3('0xa')]('/',auth['isAuthenticated'](),controller[_0xb7f3('0xb')]);router['get']('/:id',auth[_0xb7f3('0xc')](),controller['show']);router[_0xb7f3('0xa')](_0xb7f3('0xd'),auth[_0xb7f3('0xc')](),controller[_0xb7f3('0xe')]);router['get'](_0xb7f3('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xb7f3('0xa')](_0xb7f3('0x10'),auth['isAuthenticated'](),controller[_0xb7f3('0x11')]);router[_0xb7f3('0x12')]('/',auth[_0xb7f3('0xc')](),controller['create']);router['put'](_0xb7f3('0x13'),auth[_0xb7f3('0xc')](),controller[_0xb7f3('0x14')]);router[_0xb7f3('0x15')]('/:id',auth[_0xb7f3('0xc')](),controller[_0xb7f3('0x16')]);module[_0xb7f3('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 1c67051..d18fbab 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 _0xacb7=['phonecall','ENUM','contact','BOOLEAN','sequelize','exports','STRING','incident'];(function(_0x4e9df2,_0x36818e){var _0x9fe790=function(_0x126eb5){while(--_0x126eb5){_0x4e9df2['push'](_0x4e9df2['shift']());}};_0x9fe790(++_0x36818e);}(_0xacb7,0xe4));var _0x7acb=function(_0x28a6f5,_0x285201){_0x28a6f5=_0x28a6f5-0x0;var _0x28dca3=_0xacb7[_0x28a6f5];return _0x28dca3;};'use strict';var Sequelize=require(_0x7acb('0x0'));module[_0x7acb('0x1')]={'name':{'type':Sequelize[_0x7acb('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x7acb('0x3'),_0x7acb('0x4')),'defaultValue':_0x7acb('0x3')},'moduleCreate':{'type':Sequelize[_0x7acb('0x5')](_0x7acb('0x6'),'nothing'),'defaultValue':_0x7acb('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x7acb('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x7acb('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe43c=['phonecall','contact','nothing','BOOLEAN','sequelize','exports','STRING','ENUM','incident'];(function(_0xb9ad6d,_0x2bb216){var _0x219d35=function(_0x32fda4){while(--_0x32fda4){_0xb9ad6d['push'](_0xb9ad6d['shift']());}};_0x219d35(++_0x2bb216);}(_0xe43c,0x13f));var _0xce43=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xe43c[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require(_0xce43('0x0'));module[_0xce43('0x1')]={'name':{'type':Sequelize[_0xce43('0x2')]},'description':{'type':Sequelize[_0xce43('0x2')]},'ticketType':{'type':Sequelize[_0xce43('0x3')](_0xce43('0x4'),_0xce43('0x5')),'defaultValue':_0xce43('0x4')},'moduleCreate':{'type':Sequelize[_0xce43('0x3')](_0xce43('0x6'),_0xce43('0x7')),'defaultValue':_0xce43('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xce43('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index bb88fbb..7ab93c7 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 _0xdbb0=['rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','reject','save','update','then','destroy','error','stack','name','map','Dynamics365Configuration'];(function(_0x27dae9,_0xb8e12f){var _0x1e6fe3=function(_0x352a25){while(--_0x352a25){_0x27dae9['push'](_0x27dae9['shift']());}};_0x1e6fe3(++_0xb8e12f);}(_0xdbb0,0x107));var _0x0dbb=function(_0x1453e3,_0x132953){_0x1453e3=_0x1453e3-0x0;var _0x236f5b=_0xdbb0[_0x1453e3];return _0x236f5b;};'use strict';var emlformat=require(_0x0dbb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0dbb('0x1'));var rp=require(_0x0dbb('0x2'));var moment=require(_0x0dbb('0x3'));var BPromise=require(_0x0dbb('0x4'));var Mustache=require(_0x0dbb('0x5'));var util=require(_0x0dbb('0x6'));var path=require(_0x0dbb('0x7'));var sox=require(_0x0dbb('0x8'));var csv=require(_0x0dbb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0dbb('0xa'));var squel=require('squel');var crypto=require(_0x0dbb('0xb'));var jsforce=require(_0x0dbb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0dbb('0x9'));var querystring=require('querystring');var Papa=require(_0x0dbb('0xd'));var Redis=require(_0x0dbb('0xe'));var authService=require(_0x0dbb('0xf'));var qs=require(_0x0dbb('0x10'));var as=require(_0x0dbb('0x11'));var hardwareService=require(_0x0dbb('0x12'));var logger=require('../../config/logger')(_0x0dbb('0x13'));var utils=require(_0x0dbb('0x14'));var config=require(_0x0dbb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0dbb('0x16'))['db'];function respondWithStatusCode(_0x52c3d2,_0x7ae461){_0x7ae461=_0x7ae461||0xcc;return function(_0x1958b8){if(_0x1958b8){return _0x52c3d2[_0x0dbb('0x17')](_0x7ae461);}return _0x52c3d2[_0x0dbb('0x18')](_0x7ae461)[_0x0dbb('0x19')]();};}function respondWithResult(_0x44f326,_0x5eaf34){_0x5eaf34=_0x5eaf34||0xc8;return function(_0x58721d){if(_0x58721d){return _0x44f326[_0x0dbb('0x18')](_0x5eaf34)[_0x0dbb('0x1a')](_0x58721d);}};}function respondWithFilteredResult(_0x21c009,_0x2b9b22){return function(_0x3098b0){if(_0x3098b0){var _0x51479f=typeof _0x2b9b22['offset']===_0x0dbb('0x1b')&&typeof _0x2b9b22[_0x0dbb('0x1c')]===_0x0dbb('0x1b');var _0xa3f938=_0x3098b0[_0x0dbb('0x1d')];var _0x53d286=_0x51479f?0x0:_0x2b9b22['offset'];var _0x31ee5a=_0x51479f?_0x3098b0[_0x0dbb('0x1d')]:_0x2b9b22[_0x0dbb('0x1e')]+_0x2b9b22[_0x0dbb('0x1c')];var _0x5ef5db;if(_0x31ee5a>=_0xa3f938){_0x31ee5a=_0xa3f938;_0x5ef5db=0xc8;}else{_0x5ef5db=0xce;}_0x21c009[_0x0dbb('0x18')](_0x5ef5db);return _0x21c009['set']('Content-Range',_0x53d286+'-'+_0x31ee5a+'/'+_0xa3f938)[_0x0dbb('0x1a')](_0x3098b0);}return null;};}function patchUpdates(_0x32c04b){return function(_0x3d04b9){try{jsonpatch['apply'](_0x3d04b9,_0x32c04b,!![]);}catch(_0x164237){return BPromise[_0x0dbb('0x1f')](_0x164237);}return _0x3d04b9[_0x0dbb('0x20')]();};}function saveUpdates(_0x135004,_0x2ce9a7){return function(_0x4a5f19){if(_0x4a5f19){return _0x4a5f19[_0x0dbb('0x21')](_0x135004)[_0x0dbb('0x22')](function(_0x4be94a){return _0x4be94a;});}return null;};}function removeEntity(_0x3c19b0,_0x2df886){return function(_0x380214){if(_0x380214){return _0x380214[_0x0dbb('0x23')]()[_0x0dbb('0x22')](function(){_0x3c19b0[_0x0dbb('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28e0d6,_0x3e4a93){return function(_0x108136){if(!_0x108136){_0x28e0d6[_0x0dbb('0x17')](0x194);}return _0x108136;};}function handleError(_0x4548ff,_0x4fc952){_0x4fc952=_0x4fc952||0x1f4;return function(_0x199791){logger[_0x0dbb('0x24')](_0x199791[_0x0dbb('0x25')]);if(_0x199791[_0x0dbb('0x26')]){delete _0x199791[_0x0dbb('0x26')];}_0x4548ff[_0x0dbb('0x18')](_0x4fc952)['send'](_0x199791);};}exports['index']=function(_0x3bf471,_0x34f81b){var _0x565616={},_0x1e6c61={},_0x49ad66={'count':0x0,'rows':[]};var _0x220487=_[_0x0dbb('0x27')](db[_0x0dbb('0x28')][_0x0dbb('0x29')],function(_0x3fae2c){return{'name':_0x3fae2c[_0x0dbb('0x2a')],'type':_0x3fae2c[_0x0dbb('0x2b')][_0x0dbb('0x2c')]};});_0x1e6c61[_0x0dbb('0x2d')]=_[_0x0dbb('0x27')](_0x220487,_0x0dbb('0x26'));_0x1e6c61[_0x0dbb('0x2e')]=_['keys'](_0x3bf471[_0x0dbb('0x2e')]);_0x1e6c61[_0x0dbb('0x2f')]=_[_0x0dbb('0x30')](_0x1e6c61[_0x0dbb('0x2d')],_0x1e6c61[_0x0dbb('0x2e')]);_0x565616[_0x0dbb('0x31')]=_[_0x0dbb('0x30')](_0x1e6c61['model'],qs[_0x0dbb('0x32')](_0x3bf471['query'][_0x0dbb('0x32')]));_0x565616[_0x0dbb('0x31')]=_0x565616[_0x0dbb('0x31')][_0x0dbb('0x33')]?_0x565616[_0x0dbb('0x31')]:_0x1e6c61[_0x0dbb('0x2d')];if(!_0x3bf471[_0x0dbb('0x2e')][_0x0dbb('0x34')](_0x0dbb('0x35'))){_0x565616[_0x0dbb('0x1c')]=qs[_0x0dbb('0x1c')](_0x3bf471[_0x0dbb('0x2e')]['limit']);_0x565616[_0x0dbb('0x1e')]=qs[_0x0dbb('0x1e')](_0x3bf471[_0x0dbb('0x2e')][_0x0dbb('0x1e')]);}_0x565616[_0x0dbb('0x36')]=qs[_0x0dbb('0x37')](_0x3bf471['query'][_0x0dbb('0x37')]);_0x565616[_0x0dbb('0x38')]=qs[_0x0dbb('0x2f')](_[_0x0dbb('0x39')](_0x3bf471[_0x0dbb('0x2e')],_0x1e6c61['filters']),_0x220487);if(_0x3bf471[_0x0dbb('0x2e')][_0x0dbb('0x3a')]){_0x565616[_0x0dbb('0x38')]=_[_0x0dbb('0x3b')](_0x565616[_0x0dbb('0x38')],{'$or':_['map'](_0x220487,function(_0x5818f0){if(_0x5818f0[_0x0dbb('0x2b')]!=='VIRTUAL'){var _0xde0ff6={};_0xde0ff6[_0x5818f0['name']]={'$like':'%'+_0x3bf471['query'][_0x0dbb('0x3a')]+'%'};return _0xde0ff6;}})});}_0x565616=_[_0x0dbb('0x3b')]({},_0x565616,_0x3bf471[_0x0dbb('0x3c')]);var _0x444736={'where':_0x565616[_0x0dbb('0x38')]};return db['Dynamics365Configuration'][_0x0dbb('0x1d')](_0x444736)[_0x0dbb('0x22')](function(_0x150516){_0x49ad66[_0x0dbb('0x1d')]=_0x150516;if(_0x3bf471[_0x0dbb('0x2e')][_0x0dbb('0x3d')]){_0x565616[_0x0dbb('0x3e')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x565616);})[_0x0dbb('0x22')](function(_0x31511d){_0x49ad66[_0x0dbb('0x3f')]=_0x31511d;return _0x49ad66;})[_0x0dbb('0x22')](respondWithFilteredResult(_0x34f81b,_0x565616))[_0x0dbb('0x40')](handleError(_0x34f81b,null));};exports[_0x0dbb('0x41')]=function(_0x380274,_0x570eee){var _0xc5a236={'raw':![],'where':{'id':_0x380274[_0x0dbb('0x42')]['id']}},_0x350883={};_0x350883[_0x0dbb('0x2d')]=_['keys'](db[_0x0dbb('0x28')][_0x0dbb('0x29')]);_0x350883[_0x0dbb('0x2e')]=_[_0x0dbb('0x43')](_0x380274['query']);_0x350883[_0x0dbb('0x2f')]=_['intersection'](_0x350883[_0x0dbb('0x2d')],_0x350883[_0x0dbb('0x2e')]);_0xc5a236[_0x0dbb('0x31')]=_[_0x0dbb('0x30')](_0x350883[_0x0dbb('0x2d')],qs[_0x0dbb('0x32')](_0x380274[_0x0dbb('0x2e')][_0x0dbb('0x32')]));_0xc5a236[_0x0dbb('0x31')]=_0xc5a236[_0x0dbb('0x31')]['length']?_0xc5a236['attributes']:_0x350883[_0x0dbb('0x2d')];if(_0x380274[_0x0dbb('0x2e')]['includeAll']){_0xc5a236[_0x0dbb('0x3e')]=[{'all':!![]}];}_0xc5a236=_['merge']({},_0xc5a236,_0x380274[_0x0dbb('0x3c')]);return db['Dynamics365Configuration'][_0x0dbb('0x44')](_0xc5a236)[_0x0dbb('0x22')](handleEntityNotFound(_0x570eee,null))[_0x0dbb('0x22')](respondWithResult(_0x570eee,null))[_0x0dbb('0x40')](handleError(_0x570eee,null));};exports[_0x0dbb('0x45')]=function(_0x2acb25,_0x4dcc0b){return db[_0x0dbb('0x28')][_0x0dbb('0x45')](_0x2acb25[_0x0dbb('0x46')],{})[_0x0dbb('0x22')](respondWithResult(_0x4dcc0b,0xc9))[_0x0dbb('0x40')](handleError(_0x4dcc0b,null));};exports[_0x0dbb('0x21')]=function(_0x1f8c5e,_0x20821f){if(_0x1f8c5e[_0x0dbb('0x46')]['id']){delete _0x1f8c5e[_0x0dbb('0x46')]['id'];}return db['Dynamics365Configuration'][_0x0dbb('0x44')]({'where':{'id':_0x1f8c5e[_0x0dbb('0x42')]['id']}})['then'](handleEntityNotFound(_0x20821f,null))[_0x0dbb('0x22')](saveUpdates(_0x1f8c5e[_0x0dbb('0x46')],null))[_0x0dbb('0x22')](respondWithResult(_0x20821f,null))[_0x0dbb('0x40')](handleError(_0x20821f,null));};exports[_0x0dbb('0x23')]=function(_0x27d05f,_0x3a752a){return db['Dynamics365Configuration']['find']({'where':{'id':_0x27d05f[_0x0dbb('0x42')]['id']}})[_0x0dbb('0x22')](handleEntityNotFound(_0x3a752a,null))['then'](removeEntity(_0x3a752a,null))[_0x0dbb('0x40')](handleError(_0x3a752a,null));};exports[_0x0dbb('0x47')]=function(_0x4ef1b5,_0xf771c9,_0x1fc9c9){var _0x455a0a={};var _0x324615={};var _0x3df1ee;var _0x2115d0;return db['Dynamics365Configuration'][_0x0dbb('0x48')]({'where':{'id':_0x4ef1b5[_0x0dbb('0x42')]['id']}})[_0x0dbb('0x22')](handleEntityNotFound(_0xf771c9,null))[_0x0dbb('0x22')](function(_0x502af7){if(_0x502af7){_0x3df1ee=_0x502af7;_0x324615[_0x0dbb('0x2d')]=_[_0x0dbb('0x43')](db[_0x0dbb('0x49')][_0x0dbb('0x29')]);_0x324615[_0x0dbb('0x2e')]=_[_0x0dbb('0x43')](_0x4ef1b5[_0x0dbb('0x2e')]);_0x324615[_0x0dbb('0x2f')]=_[_0x0dbb('0x30')](_0x324615['model'],_0x324615[_0x0dbb('0x2e')]);_0x455a0a['attributes']=_[_0x0dbb('0x30')](_0x324615[_0x0dbb('0x2d')],qs['fields'](_0x4ef1b5[_0x0dbb('0x2e')][_0x0dbb('0x32')]));_0x455a0a[_0x0dbb('0x31')]=_0x455a0a[_0x0dbb('0x31')][_0x0dbb('0x33')]?_0x455a0a[_0x0dbb('0x31')]:_0x324615[_0x0dbb('0x2d')];_0x455a0a['order']=qs['sort'](_0x4ef1b5[_0x0dbb('0x2e')]['sort']);_0x455a0a[_0x0dbb('0x38')]=qs['filters'](_['pick'](_0x4ef1b5[_0x0dbb('0x2e')],_0x324615['filters']));if(_0x4ef1b5[_0x0dbb('0x2e')][_0x0dbb('0x3a')]){_0x455a0a[_0x0dbb('0x38')]=_[_0x0dbb('0x3b')](_0x455a0a[_0x0dbb('0x38')],{'$or':_['map'](_0x455a0a[_0x0dbb('0x31')],function(_0x12f97a){var _0xff23a7={};_0xff23a7[_0x12f97a]={'$like':'%'+_0x4ef1b5[_0x0dbb('0x2e')][_0x0dbb('0x3a')]+'%'};return _0xff23a7;})});}_0x455a0a=_[_0x0dbb('0x3b')]({},_0x455a0a,_0x4ef1b5[_0x0dbb('0x3c')]);return _0x3df1ee['getFields'](_0x455a0a);}})[_0x0dbb('0x22')](function(_0x300a2e){if(_0x300a2e){_0x2115d0=_0x300a2e['length'];if(!_0x4ef1b5[_0x0dbb('0x2e')]['hasOwnProperty'](_0x0dbb('0x35'))){_0x455a0a[_0x0dbb('0x1c')]=qs[_0x0dbb('0x1c')](_0x4ef1b5[_0x0dbb('0x2e')][_0x0dbb('0x1c')]);_0x455a0a[_0x0dbb('0x1e')]=qs['offset'](_0x4ef1b5['query'][_0x0dbb('0x1e')]);}return _0x3df1ee[_0x0dbb('0x47')](_0x455a0a);}})[_0x0dbb('0x22')](function(_0x5d2999){if(_0x5d2999){return _0x5d2999?{'count':_0x2115d0,'rows':_0x5d2999}:null;}})['then'](respondWithResult(_0xf771c9,null))[_0x0dbb('0x40')](handleError(_0xf771c9,null));};exports[_0x0dbb('0x4a')]=function(_0x2e96e5,_0x1f6d0a,_0x2321c8){var _0x333ebf={};var _0x5f49fe={};var _0x896f94;var _0x3b7cf3;return db[_0x0dbb('0x28')]['findOne']({'where':{'id':_0x2e96e5[_0x0dbb('0x42')]['id']}})[_0x0dbb('0x22')](handleEntityNotFound(_0x1f6d0a,null))[_0x0dbb('0x22')](function(_0x11d70d){if(_0x11d70d){_0x896f94=_0x11d70d;_0x5f49fe[_0x0dbb('0x2d')]=_[_0x0dbb('0x43')](db[_0x0dbb('0x49')]['rawAttributes']);_0x5f49fe[_0x0dbb('0x2e')]=_[_0x0dbb('0x43')](_0x2e96e5[_0x0dbb('0x2e')]);_0x5f49fe[_0x0dbb('0x2f')]=_[_0x0dbb('0x30')](_0x5f49fe[_0x0dbb('0x2d')],_0x5f49fe[_0x0dbb('0x2e')]);_0x333ebf[_0x0dbb('0x31')]=_[_0x0dbb('0x30')](_0x5f49fe[_0x0dbb('0x2d')],qs[_0x0dbb('0x32')](_0x2e96e5[_0x0dbb('0x2e')][_0x0dbb('0x32')]));_0x333ebf[_0x0dbb('0x31')]=_0x333ebf[_0x0dbb('0x31')]['length']?_0x333ebf[_0x0dbb('0x31')]:_0x5f49fe[_0x0dbb('0x2d')];_0x333ebf[_0x0dbb('0x36')]=qs[_0x0dbb('0x37')](_0x2e96e5[_0x0dbb('0x2e')]['sort']);_0x333ebf[_0x0dbb('0x38')]=qs[_0x0dbb('0x2f')](_[_0x0dbb('0x39')](_0x2e96e5[_0x0dbb('0x2e')],_0x5f49fe[_0x0dbb('0x2f')]));if(_0x2e96e5[_0x0dbb('0x2e')]['filter']){_0x333ebf[_0x0dbb('0x38')]=_[_0x0dbb('0x3b')](_0x333ebf[_0x0dbb('0x38')],{'$or':_[_0x0dbb('0x27')](_0x333ebf[_0x0dbb('0x31')],function(_0x26d790){var _0xc1547d={};_0xc1547d[_0x26d790]={'$like':'%'+_0x2e96e5[_0x0dbb('0x2e')][_0x0dbb('0x3a')]+'%'};return _0xc1547d;})});}_0x333ebf=_[_0x0dbb('0x3b')]({},_0x333ebf,_0x2e96e5['options']);return _0x896f94[_0x0dbb('0x4a')](_0x333ebf);}})[_0x0dbb('0x22')](function(_0x20b72f){if(_0x20b72f){_0x3b7cf3=_0x20b72f[_0x0dbb('0x33')];if(!_0x2e96e5['query'][_0x0dbb('0x34')](_0x0dbb('0x35'))){_0x333ebf[_0x0dbb('0x1c')]=qs[_0x0dbb('0x1c')](_0x2e96e5[_0x0dbb('0x2e')][_0x0dbb('0x1c')]);_0x333ebf['offset']=qs['offset'](_0x2e96e5[_0x0dbb('0x2e')][_0x0dbb('0x1e')]);}return _0x896f94[_0x0dbb('0x4a')](_0x333ebf);}})[_0x0dbb('0x22')](function(_0xa9d6c8){if(_0xa9d6c8){return _0xa9d6c8?{'count':_0x3b7cf3,'rows':_0xa9d6c8}:null;}})[_0x0dbb('0x22')](respondWithResult(_0x1f6d0a,null))[_0x0dbb('0x40')](handleError(_0x1f6d0a,null));};exports[_0x0dbb('0x4b')]=function(_0x57f865,_0x4fefe2,_0x46c89a){var _0x3a6da5={};var _0x458c14={};var _0x41e771;var _0x57978b;return db['Dynamics365Configuration'][_0x0dbb('0x48')]({'where':{'id':_0x57f865['params']['id']}})['then'](handleEntityNotFound(_0x4fefe2,null))[_0x0dbb('0x22')](function(_0x5f4b62){if(_0x5f4b62){_0x41e771=_0x5f4b62;_0x458c14[_0x0dbb('0x2d')]=_[_0x0dbb('0x43')](db[_0x0dbb('0x49')][_0x0dbb('0x29')]);_0x458c14[_0x0dbb('0x2e')]=_[_0x0dbb('0x43')](_0x57f865[_0x0dbb('0x2e')]);_0x458c14[_0x0dbb('0x2f')]=_[_0x0dbb('0x30')](_0x458c14[_0x0dbb('0x2d')],_0x458c14[_0x0dbb('0x2e')]);_0x3a6da5[_0x0dbb('0x31')]=_[_0x0dbb('0x30')](_0x458c14[_0x0dbb('0x2d')],qs[_0x0dbb('0x32')](_0x57f865[_0x0dbb('0x2e')][_0x0dbb('0x32')]));_0x3a6da5['attributes']=_0x3a6da5['attributes'][_0x0dbb('0x33')]?_0x3a6da5['attributes']:_0x458c14[_0x0dbb('0x2d')];_0x3a6da5[_0x0dbb('0x36')]=qs[_0x0dbb('0x37')](_0x57f865['query']['sort']);_0x3a6da5[_0x0dbb('0x38')]=qs['filters'](_[_0x0dbb('0x39')](_0x57f865[_0x0dbb('0x2e')],_0x458c14['filters']));if(_0x57f865['query']['filter']){_0x3a6da5[_0x0dbb('0x38')]=_[_0x0dbb('0x3b')](_0x3a6da5[_0x0dbb('0x38')],{'$or':_[_0x0dbb('0x27')](_0x3a6da5['attributes'],function(_0x2cbb77){var _0x2539df={};_0x2539df[_0x2cbb77]={'$like':'%'+_0x57f865['query'][_0x0dbb('0x3a')]+'%'};return _0x2539df;})});}_0x3a6da5=_[_0x0dbb('0x3b')]({},_0x3a6da5,_0x57f865[_0x0dbb('0x3c')]);return _0x41e771[_0x0dbb('0x4b')](_0x3a6da5);}})['then'](function(_0x5c29aa){if(_0x5c29aa){_0x57978b=_0x5c29aa[_0x0dbb('0x33')];if(!_0x57f865[_0x0dbb('0x2e')]['hasOwnProperty'](_0x0dbb('0x35'))){_0x3a6da5['limit']=qs[_0x0dbb('0x1c')](_0x57f865[_0x0dbb('0x2e')]['limit']);_0x3a6da5[_0x0dbb('0x1e')]=qs[_0x0dbb('0x1e')](_0x57f865[_0x0dbb('0x2e')][_0x0dbb('0x1e')]);}return _0x41e771['getDescriptions'](_0x3a6da5);}})[_0x0dbb('0x22')](function(_0x440556){if(_0x440556){return _0x440556?{'count':_0x57978b,'rows':_0x440556}:null;}})[_0x0dbb('0x22')](respondWithResult(_0x4fefe2,null))[_0x0dbb('0x40')](handleError(_0x4fefe2,null));}; \ No newline at end of file +var _0x8477=['options','Dynamics365Configuration','include','rows','catch','params','includeAll','find','create','body','findOne','getFields','Dynamics365Field','getSubjects','getDescriptions','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x95bc1,_0x5d1bf){var _0x3d450f=function(_0x3926e5){while(--_0x3926e5){_0x95bc1['push'](_0x95bc1['shift']());}};_0x3d450f(++_0x5d1bf);}(_0x8477,0x181));var _0x7847=function(_0x49c653,_0x390195){_0x49c653=_0x49c653-0x0;var _0x31e169=_0x8477[_0x49c653];return _0x31e169;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7847('0x0'));var BPromise=require(_0x7847('0x1'));var Mustache=require(_0x7847('0x2'));var util=require(_0x7847('0x3'));var path=require(_0x7847('0x4'));var sox=require(_0x7847('0x5'));var csv=require(_0x7847('0x6'));var ejs=require(_0x7847('0x7'));var fs=require('fs');var fs_extra=require(_0x7847('0x8'));var _=require(_0x7847('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7847('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7847('0x6'));var querystring=require('querystring');var Papa=require(_0x7847('0xb'));var Redis=require('ioredis');var authService=require(_0x7847('0xc'));var qs=require(_0x7847('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7847('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x7847('0xf'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7847('0x10'))['db'];function respondWithStatusCode(_0x5ca247,_0x35db3e){_0x35db3e=_0x35db3e||0xcc;return function(_0x558704){if(_0x558704){return _0x5ca247[_0x7847('0x11')](_0x35db3e);}return _0x5ca247[_0x7847('0x12')](_0x35db3e)[_0x7847('0x13')]();};}function respondWithResult(_0x537028,_0x10635c){_0x10635c=_0x10635c||0xc8;return function(_0xbcac92){if(_0xbcac92){return _0x537028[_0x7847('0x12')](_0x10635c)[_0x7847('0x14')](_0xbcac92);}};}function respondWithFilteredResult(_0x4e16b9,_0x191924){return function(_0x2c15cb){if(_0x2c15cb){var _0x61f2cb=typeof _0x191924['offset']===_0x7847('0x15')&&typeof _0x191924[_0x7847('0x16')]===_0x7847('0x15');var _0x9f6477=_0x2c15cb[_0x7847('0x17')];var _0x950994=_0x61f2cb?0x0:_0x191924[_0x7847('0x18')];var _0x31dfbb=_0x61f2cb?_0x2c15cb[_0x7847('0x17')]:_0x191924[_0x7847('0x18')]+_0x191924[_0x7847('0x16')];var _0x3ea48f;if(_0x31dfbb>=_0x9f6477){_0x31dfbb=_0x9f6477;_0x3ea48f=0xc8;}else{_0x3ea48f=0xce;}_0x4e16b9[_0x7847('0x12')](_0x3ea48f);return _0x4e16b9[_0x7847('0x19')](_0x7847('0x1a'),_0x950994+'-'+_0x31dfbb+'/'+_0x9f6477)[_0x7847('0x14')](_0x2c15cb);}return null;};}function patchUpdates(_0x9bc00){return function(_0xadde70){try{jsonpatch['apply'](_0xadde70,_0x9bc00,!![]);}catch(_0x403937){return BPromise[_0x7847('0x1b')](_0x403937);}return _0xadde70[_0x7847('0x1c')]();};}function saveUpdates(_0x39a56d,_0x5d0628){return function(_0x546098){if(_0x546098){return _0x546098[_0x7847('0x1d')](_0x39a56d)[_0x7847('0x1e')](function(_0x5d89d){return _0x5d89d;});}return null;};}function removeEntity(_0x21cfa9,_0x4d1b3f){return function(_0x120baa){if(_0x120baa){return _0x120baa[_0x7847('0x1f')]()['then'](function(){_0x21cfa9['status'](0xcc)[_0x7847('0x13')]();});}};}function handleEntityNotFound(_0x1bb129,_0x5b3fb2){return function(_0x3fff23){if(!_0x3fff23){_0x1bb129[_0x7847('0x11')](0x194);}return _0x3fff23;};}function handleError(_0x4e6181,_0x445d01){_0x445d01=_0x445d01||0x1f4;return function(_0x538e36){logger[_0x7847('0x20')](_0x538e36[_0x7847('0x21')]);if(_0x538e36[_0x7847('0x22')]){delete _0x538e36['name'];}_0x4e6181[_0x7847('0x12')](_0x445d01)[_0x7847('0x23')](_0x538e36);};}exports[_0x7847('0x24')]=function(_0x16c87d,_0xdf60dd){var _0x294104={},_0x9e8f7e={},_0x38a692={'count':0x0,'rows':[]};var _0x4ece56=_[_0x7847('0x25')](db['Dynamics365Configuration'][_0x7847('0x26')],function(_0x406844){return{'name':_0x406844[_0x7847('0x27')],'type':_0x406844[_0x7847('0x28')][_0x7847('0x29')]};});_0x9e8f7e[_0x7847('0x2a')]=_[_0x7847('0x25')](_0x4ece56,_0x7847('0x22'));_0x9e8f7e[_0x7847('0x2b')]=_[_0x7847('0x2c')](_0x16c87d['query']);_0x9e8f7e[_0x7847('0x2d')]=_[_0x7847('0x2e')](_0x9e8f7e[_0x7847('0x2a')],_0x9e8f7e['query']);_0x294104[_0x7847('0x2f')]=_['intersection'](_0x9e8f7e[_0x7847('0x2a')],qs[_0x7847('0x30')](_0x16c87d[_0x7847('0x2b')][_0x7847('0x30')]));_0x294104[_0x7847('0x2f')]=_0x294104[_0x7847('0x2f')][_0x7847('0x31')]?_0x294104[_0x7847('0x2f')]:_0x9e8f7e[_0x7847('0x2a')];if(!_0x16c87d[_0x7847('0x2b')][_0x7847('0x32')](_0x7847('0x33'))){_0x294104[_0x7847('0x16')]=qs['limit'](_0x16c87d[_0x7847('0x2b')][_0x7847('0x16')]);_0x294104[_0x7847('0x18')]=qs[_0x7847('0x18')](_0x16c87d['query'][_0x7847('0x18')]);}_0x294104[_0x7847('0x34')]=qs[_0x7847('0x35')](_0x16c87d[_0x7847('0x2b')][_0x7847('0x35')]);_0x294104['where']=qs[_0x7847('0x2d')](_[_0x7847('0x36')](_0x16c87d[_0x7847('0x2b')],_0x9e8f7e[_0x7847('0x2d')]),_0x4ece56);if(_0x16c87d[_0x7847('0x2b')][_0x7847('0x37')]){_0x294104[_0x7847('0x38')]=_[_0x7847('0x39')](_0x294104[_0x7847('0x38')],{'$or':_[_0x7847('0x25')](_0x4ece56,function(_0x17c151){if(_0x17c151[_0x7847('0x28')]!==_0x7847('0x3a')){var _0x28a9ba={};_0x28a9ba[_0x17c151[_0x7847('0x22')]]={'$like':'%'+_0x16c87d[_0x7847('0x2b')][_0x7847('0x37')]+'%'};return _0x28a9ba;}})});}_0x294104=_[_0x7847('0x39')]({},_0x294104,_0x16c87d[_0x7847('0x3b')]);var _0x5bb14b={'where':_0x294104[_0x7847('0x38')]};return db[_0x7847('0x3c')][_0x7847('0x17')](_0x5bb14b)[_0x7847('0x1e')](function(_0xa06308){_0x38a692[_0x7847('0x17')]=_0xa06308;if(_0x16c87d[_0x7847('0x2b')]['includeAll']){_0x294104[_0x7847('0x3d')]=[{'all':!![]}];}return db[_0x7847('0x3c')]['findAll'](_0x294104);})[_0x7847('0x1e')](function(_0x4a0b57){_0x38a692[_0x7847('0x3e')]=_0x4a0b57;return _0x38a692;})[_0x7847('0x1e')](respondWithFilteredResult(_0xdf60dd,_0x294104))[_0x7847('0x3f')](handleError(_0xdf60dd,null));};exports['show']=function(_0x579a3d,_0x55f3bb){var _0x4e50f8={'raw':![],'where':{'id':_0x579a3d[_0x7847('0x40')]['id']}},_0x5973ae={};_0x5973ae['model']=_[_0x7847('0x2c')](db['Dynamics365Configuration']['rawAttributes']);_0x5973ae['query']=_['keys'](_0x579a3d[_0x7847('0x2b')]);_0x5973ae[_0x7847('0x2d')]=_[_0x7847('0x2e')](_0x5973ae[_0x7847('0x2a')],_0x5973ae['query']);_0x4e50f8[_0x7847('0x2f')]=_[_0x7847('0x2e')](_0x5973ae[_0x7847('0x2a')],qs[_0x7847('0x30')](_0x579a3d[_0x7847('0x2b')][_0x7847('0x30')]));_0x4e50f8['attributes']=_0x4e50f8[_0x7847('0x2f')][_0x7847('0x31')]?_0x4e50f8[_0x7847('0x2f')]:_0x5973ae[_0x7847('0x2a')];if(_0x579a3d[_0x7847('0x2b')][_0x7847('0x41')]){_0x4e50f8[_0x7847('0x3d')]=[{'all':!![]}];}_0x4e50f8=_['merge']({},_0x4e50f8,_0x579a3d[_0x7847('0x3b')]);return db[_0x7847('0x3c')][_0x7847('0x42')](_0x4e50f8)[_0x7847('0x1e')](handleEntityNotFound(_0x55f3bb,null))[_0x7847('0x1e')](respondWithResult(_0x55f3bb,null))[_0x7847('0x3f')](handleError(_0x55f3bb,null));};exports[_0x7847('0x43')]=function(_0x52eb3c,_0x49cf33){return db[_0x7847('0x3c')]['create'](_0x52eb3c['body'],{})[_0x7847('0x1e')](respondWithResult(_0x49cf33,0xc9))[_0x7847('0x3f')](handleError(_0x49cf33,null));};exports[_0x7847('0x1d')]=function(_0x52b2de,_0x46a27d){if(_0x52b2de[_0x7847('0x44')]['id']){delete _0x52b2de[_0x7847('0x44')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x52b2de[_0x7847('0x40')]['id']}})[_0x7847('0x1e')](handleEntityNotFound(_0x46a27d,null))[_0x7847('0x1e')](saveUpdates(_0x52b2de[_0x7847('0x44')],null))[_0x7847('0x1e')](respondWithResult(_0x46a27d,null))[_0x7847('0x3f')](handleError(_0x46a27d,null));};exports[_0x7847('0x1f')]=function(_0x4028bc,_0x170fb0){return db[_0x7847('0x3c')][_0x7847('0x42')]({'where':{'id':_0x4028bc['params']['id']}})['then'](handleEntityNotFound(_0x170fb0,null))[_0x7847('0x1e')](removeEntity(_0x170fb0,null))[_0x7847('0x3f')](handleError(_0x170fb0,null));};exports['getFields']=function(_0x1a5ca8,_0x2487af,_0x3c690c){var _0x96f032={};var _0xe26b20={};var _0xf049bd;var _0x36ee66;return db[_0x7847('0x3c')][_0x7847('0x45')]({'where':{'id':_0x1a5ca8[_0x7847('0x40')]['id']}})[_0x7847('0x1e')](handleEntityNotFound(_0x2487af,null))[_0x7847('0x1e')](function(_0x1d555d){if(_0x1d555d){_0xf049bd=_0x1d555d;_0xe26b20[_0x7847('0x2a')]=_[_0x7847('0x2c')](db['Dynamics365Field'][_0x7847('0x26')]);_0xe26b20[_0x7847('0x2b')]=_['keys'](_0x1a5ca8[_0x7847('0x2b')]);_0xe26b20['filters']=_['intersection'](_0xe26b20[_0x7847('0x2a')],_0xe26b20['query']);_0x96f032[_0x7847('0x2f')]=_[_0x7847('0x2e')](_0xe26b20['model'],qs[_0x7847('0x30')](_0x1a5ca8['query'][_0x7847('0x30')]));_0x96f032[_0x7847('0x2f')]=_0x96f032[_0x7847('0x2f')][_0x7847('0x31')]?_0x96f032[_0x7847('0x2f')]:_0xe26b20['model'];_0x96f032[_0x7847('0x34')]=qs[_0x7847('0x35')](_0x1a5ca8[_0x7847('0x2b')][_0x7847('0x35')]);_0x96f032[_0x7847('0x38')]=qs['filters'](_[_0x7847('0x36')](_0x1a5ca8[_0x7847('0x2b')],_0xe26b20[_0x7847('0x2d')]));if(_0x1a5ca8[_0x7847('0x2b')][_0x7847('0x37')]){_0x96f032[_0x7847('0x38')]=_[_0x7847('0x39')](_0x96f032[_0x7847('0x38')],{'$or':_[_0x7847('0x25')](_0x96f032['attributes'],function(_0x41d42c){var _0x54590d={};_0x54590d[_0x41d42c]={'$like':'%'+_0x1a5ca8[_0x7847('0x2b')][_0x7847('0x37')]+'%'};return _0x54590d;})});}_0x96f032=_[_0x7847('0x39')]({},_0x96f032,_0x1a5ca8[_0x7847('0x3b')]);return _0xf049bd['getFields'](_0x96f032);}})[_0x7847('0x1e')](function(_0xb303d1){if(_0xb303d1){_0x36ee66=_0xb303d1[_0x7847('0x31')];if(!_0x1a5ca8[_0x7847('0x2b')][_0x7847('0x32')](_0x7847('0x33'))){_0x96f032[_0x7847('0x16')]=qs[_0x7847('0x16')](_0x1a5ca8['query']['limit']);_0x96f032[_0x7847('0x18')]=qs[_0x7847('0x18')](_0x1a5ca8[_0x7847('0x2b')]['offset']);}return _0xf049bd[_0x7847('0x46')](_0x96f032);}})[_0x7847('0x1e')](function(_0x5c672a){if(_0x5c672a){return _0x5c672a?{'count':_0x36ee66,'rows':_0x5c672a}:null;}})[_0x7847('0x1e')](respondWithResult(_0x2487af,null))[_0x7847('0x3f')](handleError(_0x2487af,null));};exports['getSubjects']=function(_0x402ef5,_0x1a8669,_0x62d91c){var _0x470c6b={};var _0x4e9283={};var _0x1ea60b;var _0x40b057;return db[_0x7847('0x3c')][_0x7847('0x45')]({'where':{'id':_0x402ef5[_0x7847('0x40')]['id']}})[_0x7847('0x1e')](handleEntityNotFound(_0x1a8669,null))[_0x7847('0x1e')](function(_0xaf430c){if(_0xaf430c){_0x1ea60b=_0xaf430c;_0x4e9283[_0x7847('0x2a')]=_[_0x7847('0x2c')](db[_0x7847('0x47')][_0x7847('0x26')]);_0x4e9283[_0x7847('0x2b')]=_[_0x7847('0x2c')](_0x402ef5[_0x7847('0x2b')]);_0x4e9283['filters']=_[_0x7847('0x2e')](_0x4e9283['model'],_0x4e9283[_0x7847('0x2b')]);_0x470c6b['attributes']=_[_0x7847('0x2e')](_0x4e9283[_0x7847('0x2a')],qs[_0x7847('0x30')](_0x402ef5[_0x7847('0x2b')][_0x7847('0x30')]));_0x470c6b[_0x7847('0x2f')]=_0x470c6b['attributes'][_0x7847('0x31')]?_0x470c6b[_0x7847('0x2f')]:_0x4e9283[_0x7847('0x2a')];_0x470c6b[_0x7847('0x34')]=qs[_0x7847('0x35')](_0x402ef5['query'][_0x7847('0x35')]);_0x470c6b['where']=qs[_0x7847('0x2d')](_[_0x7847('0x36')](_0x402ef5[_0x7847('0x2b')],_0x4e9283[_0x7847('0x2d')]));if(_0x402ef5['query'][_0x7847('0x37')]){_0x470c6b[_0x7847('0x38')]=_[_0x7847('0x39')](_0x470c6b[_0x7847('0x38')],{'$or':_[_0x7847('0x25')](_0x470c6b[_0x7847('0x2f')],function(_0x50aa39){var _0x19dacc={};_0x19dacc[_0x50aa39]={'$like':'%'+_0x402ef5[_0x7847('0x2b')]['filter']+'%'};return _0x19dacc;})});}_0x470c6b=_[_0x7847('0x39')]({},_0x470c6b,_0x402ef5[_0x7847('0x3b')]);return _0x1ea60b[_0x7847('0x48')](_0x470c6b);}})['then'](function(_0x619578){if(_0x619578){_0x40b057=_0x619578[_0x7847('0x31')];if(!_0x402ef5[_0x7847('0x2b')]['hasOwnProperty'](_0x7847('0x33'))){_0x470c6b['limit']=qs['limit'](_0x402ef5['query'][_0x7847('0x16')]);_0x470c6b[_0x7847('0x18')]=qs[_0x7847('0x18')](_0x402ef5['query'][_0x7847('0x18')]);}return _0x1ea60b[_0x7847('0x48')](_0x470c6b);}})[_0x7847('0x1e')](function(_0x4033b8){if(_0x4033b8){return _0x4033b8?{'count':_0x40b057,'rows':_0x4033b8}:null;}})[_0x7847('0x1e')](respondWithResult(_0x1a8669,null))[_0x7847('0x3f')](handleError(_0x1a8669,null));};exports[_0x7847('0x49')]=function(_0x3c3ab1,_0x4c5755,_0x1d0f99){var _0x1d28e5={};var _0x27c1b7={};var _0x2a5a3f;var _0x4d9977;return db[_0x7847('0x3c')][_0x7847('0x45')]({'where':{'id':_0x3c3ab1[_0x7847('0x40')]['id']}})[_0x7847('0x1e')](handleEntityNotFound(_0x4c5755,null))[_0x7847('0x1e')](function(_0x4a688d){if(_0x4a688d){_0x2a5a3f=_0x4a688d;_0x27c1b7['model']=_[_0x7847('0x2c')](db[_0x7847('0x47')][_0x7847('0x26')]);_0x27c1b7[_0x7847('0x2b')]=_[_0x7847('0x2c')](_0x3c3ab1[_0x7847('0x2b')]);_0x27c1b7[_0x7847('0x2d')]=_[_0x7847('0x2e')](_0x27c1b7[_0x7847('0x2a')],_0x27c1b7[_0x7847('0x2b')]);_0x1d28e5[_0x7847('0x2f')]=_['intersection'](_0x27c1b7['model'],qs[_0x7847('0x30')](_0x3c3ab1[_0x7847('0x2b')][_0x7847('0x30')]));_0x1d28e5['attributes']=_0x1d28e5[_0x7847('0x2f')][_0x7847('0x31')]?_0x1d28e5[_0x7847('0x2f')]:_0x27c1b7['model'];_0x1d28e5[_0x7847('0x34')]=qs[_0x7847('0x35')](_0x3c3ab1['query'][_0x7847('0x35')]);_0x1d28e5['where']=qs['filters'](_[_0x7847('0x36')](_0x3c3ab1[_0x7847('0x2b')],_0x27c1b7['filters']));if(_0x3c3ab1[_0x7847('0x2b')][_0x7847('0x37')]){_0x1d28e5[_0x7847('0x38')]=_[_0x7847('0x39')](_0x1d28e5[_0x7847('0x38')],{'$or':_[_0x7847('0x25')](_0x1d28e5[_0x7847('0x2f')],function(_0x5b730a){var _0x51a0e7={};_0x51a0e7[_0x5b730a]={'$like':'%'+_0x3c3ab1[_0x7847('0x2b')][_0x7847('0x37')]+'%'};return _0x51a0e7;})});}_0x1d28e5=_[_0x7847('0x39')]({},_0x1d28e5,_0x3c3ab1[_0x7847('0x3b')]);return _0x2a5a3f[_0x7847('0x49')](_0x1d28e5);}})[_0x7847('0x1e')](function(_0x26c632){if(_0x26c632){_0x4d9977=_0x26c632[_0x7847('0x31')];if(!_0x3c3ab1[_0x7847('0x2b')][_0x7847('0x32')]('nolimit')){_0x1d28e5[_0x7847('0x16')]=qs[_0x7847('0x16')](_0x3c3ab1[_0x7847('0x2b')][_0x7847('0x16')]);_0x1d28e5['offset']=qs['offset'](_0x3c3ab1[_0x7847('0x2b')]['offset']);}return _0x2a5a3f[_0x7847('0x49')](_0x1d28e5);}})[_0x7847('0x1e')](function(_0xd911c4){if(_0xd911c4){return _0xd911c4?{'count':_0x4d9977,'rows':_0xd911c4}:null;}})[_0x7847('0x1e')](respondWithResult(_0x4c5755,null))[_0x7847('0x3f')](handleError(_0x4c5755,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index e38d1d0..ff2a141 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 _0xf109=['Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x4f3262,_0x5d46a0){var _0x16bd21=function(_0xe9e282){while(--_0xe9e282){_0x4f3262['push'](_0x4f3262['shift']());}};_0x16bd21(++_0x5d46a0);}(_0xf109,0xce));var _0x9f10=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xf109[_0x12fc8d];return _0x3f9d04;};'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 _0xd6d6=['path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5813c4,_0x477e60){var _0x3948c1=function(_0x25a410){while(--_0x25a410){_0x5813c4['push'](_0x5813c4['shift']());}};_0x3948c1(++_0x477e60);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x5b8a70,_0x5179b8){_0x5b8a70=_0x5b8a70-0x0;var _0x455a66=_0xd6d6[_0x5b8a70];return _0x455a66;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index d7b9b5b..763f6e8 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 _0x3609=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3a4a59,_0x10c41e){var _0x57b27d=function(_0x25bd50){while(--_0x25bd50){_0x3a4a59['push'](_0x3a4a59['shift']());}};_0x57b27d(++_0x10c41e);}(_0x3609,0x15c));var _0x9360=function(_0x22f162,_0x4ba754){_0x22f162=_0x22f162-0x0;var _0x203407=_0x3609[_0x22f162];return _0x203407;};'use strict';var _=require(_0x9360('0x0'));var util=require(_0x9360('0x1'));var moment=require(_0x9360('0x2'));var BPromise=require(_0x9360('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9360('0x4'));var db=require(_0x9360('0x5'))['db'];var utils=require(_0x9360('0x6'));var logger=require(_0x9360('0x7'))(_0x9360('0x8'));var config=require(_0x9360('0x9'));var jayson=require(_0x9360('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21942c,_0x3b0086,_0x10d12a){return new BPromise(function(_0x2f0cb6,_0xb3aa43){return client[_0x9360('0xb')](_0x21942c,_0x10d12a)[_0x9360('0xc')](function(_0xcc420d){logger[_0x9360('0xd')](_0x9360('0xe'),_0x3b0086,'request\x20sent');logger['debug'](_0x9360('0xf'),_0x3b0086,_0x9360('0x10'),JSON['stringify'](_0xcc420d));if(_0xcc420d['error']){if(_0xcc420d[_0x9360('0x11')][_0x9360('0x12')]===0x1f4){logger[_0x9360('0x11')](_0x9360('0xe'),_0x3b0086,_0xcc420d[_0x9360('0x11')][_0x9360('0x13')]);return _0xb3aa43(_0xcc420d[_0x9360('0x11')][_0x9360('0x13')]);}logger[_0x9360('0x11')](_0x9360('0xe'),_0x3b0086,_0xcc420d[_0x9360('0x11')]['message']);return _0x2f0cb6(_0xcc420d['error'][_0x9360('0x13')]);}else{logger[_0x9360('0xd')](_0x9360('0xe'),_0x3b0086,_0x9360('0x10'));_0x2f0cb6(_0xcc420d[_0x9360('0x14')][_0x9360('0x13')]);}})[_0x9360('0x15')](function(_0x3bbca2){logger[_0x9360('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3b0086,_0x3bbca2);_0xb3aa43(_0x3bbca2);});});} \ No newline at end of file +var _0xabec=['lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xde66a8,_0x43d684){var _0x5c97ba=function(_0x3a2c7e){while(--_0x3a2c7e){_0xde66a8['push'](_0xde66a8['shift']());}};_0x5c97ba(++_0x43d684);}(_0xabec,0x8c));var _0xcabe=function(_0x30eb36,_0x4f7dab){_0x30eb36=_0x30eb36-0x0;var _0x1b33d1=_0xabec[_0x30eb36];return _0x1b33d1;};'use strict';var _=require(_0xcabe('0x0'));var util=require(_0xcabe('0x1'));var moment=require('moment');var BPromise=require(_0xcabe('0x2'));var rs=require(_0xcabe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcabe('0x4'))(_0xcabe('0x5'));var config=require(_0xcabe('0x6'));var jayson=require(_0xcabe('0x7'));var client=jayson['client'][_0xcabe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x35ee60,_0x458dbc,_0x48dbcf){return new BPromise(function(_0x5e58a8,_0x2eb459){return client[_0xcabe('0x9')](_0x35ee60,_0x48dbcf)[_0xcabe('0xa')](function(_0x5025c2){logger[_0xcabe('0xb')](_0xcabe('0xc'),_0x458dbc,_0xcabe('0xd'));logger[_0xcabe('0xe')](_0xcabe('0xf'),_0x458dbc,_0xcabe('0xd'),JSON[_0xcabe('0x10')](_0x5025c2));if(_0x5025c2['error']){if(_0x5025c2[_0xcabe('0x11')][_0xcabe('0x12')]===0x1f4){logger[_0xcabe('0x11')](_0xcabe('0xc'),_0x458dbc,_0x5025c2[_0xcabe('0x11')][_0xcabe('0x13')]);return _0x2eb459(_0x5025c2['error'][_0xcabe('0x13')]);}logger[_0xcabe('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x458dbc,_0x5025c2[_0xcabe('0x11')][_0xcabe('0x13')]);return _0x5e58a8(_0x5025c2['error'][_0xcabe('0x13')]);}else{logger[_0xcabe('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x458dbc,'request\x20sent');_0x5e58a8(_0x5025c2['result'][_0xcabe('0x13')]);}})['catch'](function(_0x28cfbd){logger[_0xcabe('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x458dbc,_0x28cfbd);_0x2eb459(_0x28cfbd);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 172d608..39b4415 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 _0x4037=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','util'];(function(_0x2a2c4b,_0xb4f6d){var _0x82dbd9=function(_0x22c6cc){while(--_0x22c6cc){_0x2a2c4b['push'](_0x2a2c4b['shift']());}};_0x82dbd9(++_0xb4f6d);}(_0x4037,0x168));var _0x7403=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4037[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x7403('0x0'));var path=require(_0x7403('0x1'));var timeout=require(_0x7403('0x2'));var express=require('express');var router=express[_0x7403('0x3')]();var fs_extra=require(_0x7403('0x4'));var auth=require(_0x7403('0x5'));var interaction=require(_0x7403('0x6'));var config=require(_0x7403('0x7'));var controller=require(_0x7403('0x8'));router[_0x7403('0x9')]('/',auth[_0x7403('0xa')](),controller['index']);router[_0x7403('0x9')](_0x7403('0xb'),auth[_0x7403('0xa')](),controller[_0x7403('0xc')]);router[_0x7403('0xd')]('/',auth[_0x7403('0xa')](),controller[_0x7403('0xe')]);router[_0x7403('0xf')]('/:id',auth[_0x7403('0xa')](),controller[_0x7403('0x10')]);router[_0x7403('0x11')]('/:id',auth[_0x7403('0xa')](),controller['destroy']);module[_0x7403('0x12')]=router; \ No newline at end of file +var _0x4c81=['get','isAuthenticated','index','/:id','post','create','put','destroy','exports','util','path','Router','fs-extra','../../components/interaction/service','./intDynamics365Field.controller'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4c81,0x1bc));var _0x14c8=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4c81[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x14c8('0x0'));var path=require(_0x14c8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x14c8('0x2')]();var fs_extra=require(_0x14c8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x14c8('0x4'));var config=require('../../config/environment');var controller=require(_0x14c8('0x5'));router[_0x14c8('0x6')]('/',auth[_0x14c8('0x7')](),controller[_0x14c8('0x8')]);router[_0x14c8('0x6')](_0x14c8('0x9'),auth[_0x14c8('0x7')](),controller['show']);router[_0x14c8('0xa')]('/',auth['isAuthenticated'](),controller[_0x14c8('0xb')]);router[_0x14c8('0xc')](_0x14c8('0x9'),auth[_0x14c8('0x7')](),controller['update']);router['delete'](_0x14c8('0x9'),auth[_0x14c8('0x7')](),controller[_0x14c8('0xd')]);module[_0x14c8('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 8aee38d..67d825e 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 _0xfc08=['variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','ENUM'];(function(_0x1bb7a1,_0x194bfc){var _0x17abcd=function(_0x108d8b){while(--_0x108d8b){_0x1bb7a1['push'](_0x1bb7a1['shift']());}};_0x17abcd(++_0x194bfc);}(_0xfc08,0x6f));var _0x8fc0=function(_0x17aa6e,_0x95b5df){_0x17aa6e=_0x17aa6e-0x0;var _0x305f54=_0xfc08[_0x17aa6e];return _0x305f54;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x8fc0('0x0')]('string',_0x8fc0('0x1'),_0x8fc0('0x2'),_0x8fc0('0x3'),_0x8fc0('0x4')),'defaultValue':_0x8fc0('0x5')},'content':{'type':Sequelize[_0x8fc0('0x6')]},'key':{'type':Sequelize[_0x8fc0('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x8fc0('0x1'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8fc0('0x6')]},'customField':{'type':Sequelize[_0x8fc0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8fc0('0x6')]}}; \ No newline at end of file +var _0xe6b2=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','string','customVariable'];(function(_0x3f8ce5,_0x37cc98){var _0x4f43ae=function(_0x5a85d2){while(--_0x5a85d2){_0x3f8ce5['push'](_0x3f8ce5['shift']());}};_0x4f43ae(++_0x37cc98);}(_0xe6b2,0x7a));var _0x2e6b=function(_0x473ac3,_0xf8066a){_0x473ac3=_0x473ac3-0x0;var _0x563cfd=_0xe6b2[_0x473ac3];return _0x563cfd;};'use strict';var Sequelize=require(_0x2e6b('0x0'));module[_0x2e6b('0x1')]={'type':{'type':Sequelize[_0x2e6b('0x2')]('string',_0x2e6b('0x3'),'customVariable',_0x2e6b('0x4'),_0x2e6b('0x5')),'defaultValue':_0x2e6b('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2e6b('0x2')]('string',_0x2e6b('0x3'),_0x2e6b('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2e6b('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2e6b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2e6b('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 3dd2b56..342c8c1 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 _0x647a=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','Dynamics365Field','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x332d6d,_0xdf0025){var _0x55c3ff=function(_0x4cd60d){while(--_0x4cd60d){_0x332d6d['push'](_0x332d6d['shift']());}};_0x55c3ff(++_0xdf0025);}(_0x647a,0x1c6));var _0xa647=function(_0x140752,_0x3cc756){_0x140752=_0x140752-0x0;var _0x24de5b=_0x647a[_0x140752];return _0x24de5b;};'use strict';var emlformat=require(_0xa647('0x0'));var rimraf=require(_0xa647('0x1'));var zipdir=require(_0xa647('0x2'));var jsonpatch=require(_0xa647('0x3'));var rp=require(_0xa647('0x4'));var moment=require(_0xa647('0x5'));var BPromise=require(_0xa647('0x6'));var Mustache=require(_0xa647('0x7'));var util=require(_0xa647('0x8'));var path=require(_0xa647('0x9'));var sox=require(_0xa647('0xa'));var csv=require(_0xa647('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa647('0xc'));var crypto=require(_0xa647('0xd'));var jsforce=require(_0xa647('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa647('0xb'));var querystring=require(_0xa647('0xf'));var Papa=require(_0xa647('0x10'));var Redis=require(_0xa647('0x11'));var authService=require(_0xa647('0x12'));var qs=require(_0xa647('0x13'));var as=require(_0xa647('0x14'));var hardwareService=require(_0xa647('0x15'));var logger=require(_0xa647('0x16'))(_0xa647('0x17'));var utils=require(_0xa647('0x18'));var config=require(_0xa647('0x19'));var licenseUtil=require(_0xa647('0x1a'));var db=require(_0xa647('0x1b'))['db'];function respondWithStatusCode(_0x249a51,_0x316a31){_0x316a31=_0x316a31||0xcc;return function(_0x4b09ec){if(_0x4b09ec){return _0x249a51['sendStatus'](_0x316a31);}return _0x249a51[_0xa647('0x1c')](_0x316a31)[_0xa647('0x1d')]();};}function respondWithResult(_0x52755c,_0x3fa971){_0x3fa971=_0x3fa971||0xc8;return function(_0x2305e5){if(_0x2305e5){return _0x52755c[_0xa647('0x1c')](_0x3fa971)[_0xa647('0x1e')](_0x2305e5);}};}function respondWithFilteredResult(_0x5845e4,_0x317abe){return function(_0x388ea6){if(_0x388ea6){var _0x2fae3b=typeof _0x317abe[_0xa647('0x1f')]===_0xa647('0x20')&&typeof _0x317abe[_0xa647('0x21')]===_0xa647('0x20');var _0x321b30=_0x388ea6[_0xa647('0x22')];var _0x102fe8=_0x2fae3b?0x0:_0x317abe['offset'];var _0x1afaae=_0x2fae3b?_0x388ea6[_0xa647('0x22')]:_0x317abe['offset']+_0x317abe[_0xa647('0x21')];var _0x522a0b;if(_0x1afaae>=_0x321b30){_0x1afaae=_0x321b30;_0x522a0b=0xc8;}else{_0x522a0b=0xce;}_0x5845e4[_0xa647('0x1c')](_0x522a0b);return _0x5845e4[_0xa647('0x23')](_0xa647('0x24'),_0x102fe8+'-'+_0x1afaae+'/'+_0x321b30)[_0xa647('0x1e')](_0x388ea6);}return null;};}function patchUpdates(_0x415d6c){return function(_0x7a496b){try{jsonpatch[_0xa647('0x25')](_0x7a496b,_0x415d6c,!![]);}catch(_0x178d58){return BPromise[_0xa647('0x26')](_0x178d58);}return _0x7a496b[_0xa647('0x27')]();};}function saveUpdates(_0x1f2002,_0x4af712){return function(_0x33037c){if(_0x33037c){return _0x33037c[_0xa647('0x28')](_0x1f2002)[_0xa647('0x29')](function(_0x26e94d){return _0x26e94d;});}return null;};}function removeEntity(_0x4d696b,_0x5eab1d){return function(_0x171cde){if(_0x171cde){return _0x171cde[_0xa647('0x2a')]()['then'](function(){_0x4d696b['status'](0xcc)[_0xa647('0x1d')]();});}};}function handleEntityNotFound(_0x2e76d6,_0xa25d03){return function(_0x5a52df){if(!_0x5a52df){_0x2e76d6[_0xa647('0x2b')](0x194);}return _0x5a52df;};}function handleError(_0x28bcd9,_0x426053){_0x426053=_0x426053||0x1f4;return function(_0x1197a9){logger[_0xa647('0x2c')](_0x1197a9['stack']);if(_0x1197a9[_0xa647('0x2d')]){delete _0x1197a9[_0xa647('0x2d')];}_0x28bcd9['status'](_0x426053)['send'](_0x1197a9);};}exports['index']=function(_0x334f9d,_0x49ce73){var _0xd4b05a={},_0x4041e7={},_0x52520a={'count':0x0,'rows':[]};var _0x2117cc=_['map'](db[_0xa647('0x2e')][_0xa647('0x2f')],function(_0x510d34){return{'name':_0x510d34[_0xa647('0x30')],'type':_0x510d34[_0xa647('0x31')][_0xa647('0x32')]};});_0x4041e7[_0xa647('0x33')]=_[_0xa647('0x34')](_0x2117cc,_0xa647('0x2d'));_0x4041e7['query']=_[_0xa647('0x35')](_0x334f9d[_0xa647('0x36')]);_0x4041e7[_0xa647('0x37')]=_[_0xa647('0x38')](_0x4041e7[_0xa647('0x33')],_0x4041e7[_0xa647('0x36')]);_0xd4b05a[_0xa647('0x39')]=_[_0xa647('0x38')](_0x4041e7['model'],qs['fields'](_0x334f9d['query'][_0xa647('0x3a')]));_0xd4b05a[_0xa647('0x39')]=_0xd4b05a[_0xa647('0x39')][_0xa647('0x3b')]?_0xd4b05a[_0xa647('0x39')]:_0x4041e7[_0xa647('0x33')];if(!_0x334f9d['query']['hasOwnProperty'](_0xa647('0x3c'))){_0xd4b05a['limit']=qs['limit'](_0x334f9d[_0xa647('0x36')]['limit']);_0xd4b05a[_0xa647('0x1f')]=qs[_0xa647('0x1f')](_0x334f9d['query'][_0xa647('0x1f')]);}_0xd4b05a[_0xa647('0x3d')]=qs[_0xa647('0x3e')](_0x334f9d[_0xa647('0x36')][_0xa647('0x3e')]);_0xd4b05a['where']=qs['filters'](_[_0xa647('0x3f')](_0x334f9d['query'],_0x4041e7[_0xa647('0x37')]),_0x2117cc);if(_0x334f9d[_0xa647('0x36')][_0xa647('0x40')]){_0xd4b05a[_0xa647('0x41')]=_[_0xa647('0x42')](_0xd4b05a[_0xa647('0x41')],{'$or':_[_0xa647('0x34')](_0x2117cc,function(_0x1cbd8b){if(_0x1cbd8b[_0xa647('0x31')]!==_0xa647('0x43')){var _0x37cdc0={};_0x37cdc0[_0x1cbd8b[_0xa647('0x2d')]]={'$like':'%'+_0x334f9d['query'][_0xa647('0x40')]+'%'};return _0x37cdc0;}})});}_0xd4b05a=_[_0xa647('0x42')]({},_0xd4b05a,_0x334f9d[_0xa647('0x44')]);var _0x2079cb={'where':_0xd4b05a[_0xa647('0x41')]};return db[_0xa647('0x2e')][_0xa647('0x22')](_0x2079cb)[_0xa647('0x29')](function(_0x3faeea){_0x52520a[_0xa647('0x22')]=_0x3faeea;if(_0x334f9d[_0xa647('0x36')][_0xa647('0x45')]){_0xd4b05a[_0xa647('0x46')]=[{'all':!![]}];}return db[_0xa647('0x2e')][_0xa647('0x47')](_0xd4b05a);})[_0xa647('0x29')](function(_0x559740){_0x52520a[_0xa647('0x48')]=_0x559740;return _0x52520a;})['then'](respondWithFilteredResult(_0x49ce73,_0xd4b05a))[_0xa647('0x49')](handleError(_0x49ce73,null));};exports[_0xa647('0x4a')]=function(_0x3162ae,_0x2dd1ac){var _0x5908f9={'raw':!![],'where':{'id':_0x3162ae[_0xa647('0x4b')]['id']}},_0x3c343c={};_0x3c343c['model']=_[_0xa647('0x35')](db['Dynamics365Field']['rawAttributes']);_0x3c343c[_0xa647('0x36')]=_[_0xa647('0x35')](_0x3162ae['query']);_0x3c343c['filters']=_[_0xa647('0x38')](_0x3c343c['model'],_0x3c343c[_0xa647('0x36')]);_0x5908f9[_0xa647('0x39')]=_[_0xa647('0x38')](_0x3c343c[_0xa647('0x33')],qs[_0xa647('0x3a')](_0x3162ae[_0xa647('0x36')][_0xa647('0x3a')]));_0x5908f9[_0xa647('0x39')]=_0x5908f9[_0xa647('0x39')]['length']?_0x5908f9['attributes']:_0x3c343c[_0xa647('0x33')];if(_0x3162ae[_0xa647('0x36')][_0xa647('0x45')]){_0x5908f9[_0xa647('0x46')]=[{'all':!![]}];}_0x5908f9=_[_0xa647('0x42')]({},_0x5908f9,_0x3162ae[_0xa647('0x44')]);return db[_0xa647('0x2e')][_0xa647('0x4c')](_0x5908f9)[_0xa647('0x29')](handleEntityNotFound(_0x2dd1ac,null))['then'](respondWithResult(_0x2dd1ac,null))[_0xa647('0x49')](handleError(_0x2dd1ac,null));};exports['create']=function(_0x47df03,_0x4bb456){return db['Dynamics365Field'][_0xa647('0x4d')](_0x47df03['body'],{})[_0xa647('0x29')](respondWithResult(_0x4bb456,0xc9))['catch'](handleError(_0x4bb456,null));};exports[_0xa647('0x28')]=function(_0x417b37,_0x1dee2d){if(_0x417b37[_0xa647('0x4e')]['id']){delete _0x417b37[_0xa647('0x4e')]['id'];}return db[_0xa647('0x2e')][_0xa647('0x4c')]({'where':{'id':_0x417b37[_0xa647('0x4b')]['id']}})[_0xa647('0x29')](handleEntityNotFound(_0x1dee2d,null))[_0xa647('0x29')](saveUpdates(_0x417b37['body'],null))['then'](respondWithResult(_0x1dee2d,null))[_0xa647('0x49')](handleError(_0x1dee2d,null));};exports[_0xa647('0x2a')]=function(_0x26eb6c,_0x10b310){return db[_0xa647('0x2e')]['find']({'where':{'id':_0x26eb6c['params']['id']}})[_0xa647('0x29')](handleEntityNotFound(_0x10b310,null))[_0xa647('0x29')](removeEntity(_0x10b310,null))['catch'](handleError(_0x10b310,null));}; \ No newline at end of file +var _0x7882=['length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','params','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','update','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x7882,0x142));var _0x2788=function(_0x2714ec,_0x36daa4){_0x2714ec=_0x2714ec-0x0;var _0x2608e5=_0x7882[_0x2714ec];return _0x2608e5;};'use strict';var emlformat=require(_0x2788('0x0'));var rimraf=require(_0x2788('0x1'));var zipdir=require(_0x2788('0x2'));var jsonpatch=require(_0x2788('0x3'));var rp=require(_0x2788('0x4'));var moment=require(_0x2788('0x5'));var BPromise=require(_0x2788('0x6'));var Mustache=require(_0x2788('0x7'));var util=require('util');var path=require(_0x2788('0x8'));var sox=require(_0x2788('0x9'));var csv=require('to-csv');var ejs=require(_0x2788('0xa'));var fs=require('fs');var fs_extra=require(_0x2788('0xb'));var _=require('lodash');var squel=require(_0x2788('0xc'));var crypto=require(_0x2788('0xd'));var jsforce=require(_0x2788('0xe'));var deskjs=require(_0x2788('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2788('0x10'));var Papa=require(_0x2788('0x11'));var Redis=require(_0x2788('0x12'));var authService=require(_0x2788('0x13'));var qs=require(_0x2788('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2788('0x15'));var logger=require(_0x2788('0x16'))(_0x2788('0x17'));var utils=require(_0x2788('0x18'));var config=require(_0x2788('0x19'));var licenseUtil=require(_0x2788('0x1a'));var db=require(_0x2788('0x1b'))['db'];function respondWithStatusCode(_0x423340,_0x4cf420){_0x4cf420=_0x4cf420||0xcc;return function(_0x117789){if(_0x117789){return _0x423340[_0x2788('0x1c')](_0x4cf420);}return _0x423340[_0x2788('0x1d')](_0x4cf420)[_0x2788('0x1e')]();};}function respondWithResult(_0x68adb6,_0xf55166){_0xf55166=_0xf55166||0xc8;return function(_0x84a5dc){if(_0x84a5dc){return _0x68adb6[_0x2788('0x1d')](_0xf55166)['json'](_0x84a5dc);}};}function respondWithFilteredResult(_0x277384,_0x58dad5){return function(_0x3d8f54){if(_0x3d8f54){var _0x9b19e3=typeof _0x58dad5['offset']===_0x2788('0x1f')&&typeof _0x58dad5[_0x2788('0x20')]==='undefined';var _0x24649a=_0x3d8f54[_0x2788('0x21')];var _0x34c2f0=_0x9b19e3?0x0:_0x58dad5[_0x2788('0x22')];var _0x364606=_0x9b19e3?_0x3d8f54[_0x2788('0x21')]:_0x58dad5[_0x2788('0x22')]+_0x58dad5[_0x2788('0x20')];var _0x47709c;if(_0x364606>=_0x24649a){_0x364606=_0x24649a;_0x47709c=0xc8;}else{_0x47709c=0xce;}_0x277384['status'](_0x47709c);return _0x277384[_0x2788('0x23')](_0x2788('0x24'),_0x34c2f0+'-'+_0x364606+'/'+_0x24649a)['json'](_0x3d8f54);}return null;};}function patchUpdates(_0x2b86dc){return function(_0x462d37){try{jsonpatch[_0x2788('0x25')](_0x462d37,_0x2b86dc,!![]);}catch(_0x41c8cc){return BPromise['reject'](_0x41c8cc);}return _0x462d37['save']();};}function saveUpdates(_0x5ccdb7,_0x4104c8){return function(_0x3be876){if(_0x3be876){return _0x3be876[_0x2788('0x26')](_0x5ccdb7)[_0x2788('0x27')](function(_0x32298e){return _0x32298e;});}return null;};}function removeEntity(_0x16ad5a,_0x324eaf){return function(_0x39790a){if(_0x39790a){return _0x39790a['destroy']()[_0x2788('0x27')](function(){_0x16ad5a[_0x2788('0x1d')](0xcc)[_0x2788('0x1e')]();});}};}function handleEntityNotFound(_0x7f07a,_0x3ce906){return function(_0x172f2d){if(!_0x172f2d){_0x7f07a[_0x2788('0x1c')](0x194);}return _0x172f2d;};}function handleError(_0x4506a9,_0x4883e7){_0x4883e7=_0x4883e7||0x1f4;return function(_0x2982bb){logger[_0x2788('0x28')](_0x2982bb[_0x2788('0x29')]);if(_0x2982bb['name']){delete _0x2982bb[_0x2788('0x2a')];}_0x4506a9[_0x2788('0x1d')](_0x4883e7)[_0x2788('0x2b')](_0x2982bb);};}exports[_0x2788('0x2c')]=function(_0x3b5053,_0x33e60c){var _0x2753c6={},_0x307f0d={},_0xda38f3={'count':0x0,'rows':[]};var _0x520cb9=_[_0x2788('0x2d')](db[_0x2788('0x2e')][_0x2788('0x2f')],function(_0x19a4d1){return{'name':_0x19a4d1[_0x2788('0x30')],'type':_0x19a4d1[_0x2788('0x31')][_0x2788('0x32')]};});_0x307f0d['model']=_[_0x2788('0x2d')](_0x520cb9,_0x2788('0x2a'));_0x307f0d[_0x2788('0x33')]=_[_0x2788('0x34')](_0x3b5053[_0x2788('0x33')]);_0x307f0d[_0x2788('0x35')]=_[_0x2788('0x36')](_0x307f0d[_0x2788('0x37')],_0x307f0d[_0x2788('0x33')]);_0x2753c6[_0x2788('0x38')]=_[_0x2788('0x36')](_0x307f0d[_0x2788('0x37')],qs['fields'](_0x3b5053[_0x2788('0x33')][_0x2788('0x39')]));_0x2753c6[_0x2788('0x38')]=_0x2753c6['attributes'][_0x2788('0x3a')]?_0x2753c6['attributes']:_0x307f0d[_0x2788('0x37')];if(!_0x3b5053[_0x2788('0x33')]['hasOwnProperty'](_0x2788('0x3b'))){_0x2753c6[_0x2788('0x20')]=qs[_0x2788('0x20')](_0x3b5053[_0x2788('0x33')][_0x2788('0x20')]);_0x2753c6[_0x2788('0x22')]=qs[_0x2788('0x22')](_0x3b5053[_0x2788('0x33')]['offset']);}_0x2753c6[_0x2788('0x3c')]=qs['sort'](_0x3b5053[_0x2788('0x33')][_0x2788('0x3d')]);_0x2753c6[_0x2788('0x3e')]=qs[_0x2788('0x35')](_[_0x2788('0x3f')](_0x3b5053['query'],_0x307f0d[_0x2788('0x35')]),_0x520cb9);if(_0x3b5053[_0x2788('0x33')][_0x2788('0x40')]){_0x2753c6[_0x2788('0x3e')]=_[_0x2788('0x41')](_0x2753c6[_0x2788('0x3e')],{'$or':_[_0x2788('0x2d')](_0x520cb9,function(_0x3bd7d8){if(_0x3bd7d8['type']!=='VIRTUAL'){var _0x5a52b5={};_0x5a52b5[_0x3bd7d8[_0x2788('0x2a')]]={'$like':'%'+_0x3b5053[_0x2788('0x33')]['filter']+'%'};return _0x5a52b5;}})});}_0x2753c6=_[_0x2788('0x41')]({},_0x2753c6,_0x3b5053[_0x2788('0x42')]);var _0x5b03f1={'where':_0x2753c6['where']};return db[_0x2788('0x2e')][_0x2788('0x21')](_0x5b03f1)[_0x2788('0x27')](function(_0x2eebaa){_0xda38f3['count']=_0x2eebaa;if(_0x3b5053['query'][_0x2788('0x43')]){_0x2753c6['include']=[{'all':!![]}];}return db[_0x2788('0x2e')][_0x2788('0x44')](_0x2753c6);})['then'](function(_0x3c2c18){_0xda38f3[_0x2788('0x45')]=_0x3c2c18;return _0xda38f3;})[_0x2788('0x27')](respondWithFilteredResult(_0x33e60c,_0x2753c6))['catch'](handleError(_0x33e60c,null));};exports['show']=function(_0x216778,_0x3205ad){var _0x3e7283={'raw':!![],'where':{'id':_0x216778[_0x2788('0x46')]['id']}},_0x4a81ef={};_0x4a81ef[_0x2788('0x37')]=_[_0x2788('0x34')](db['Dynamics365Field'][_0x2788('0x2f')]);_0x4a81ef[_0x2788('0x33')]=_[_0x2788('0x34')](_0x216778[_0x2788('0x33')]);_0x4a81ef[_0x2788('0x35')]=_[_0x2788('0x36')](_0x4a81ef[_0x2788('0x37')],_0x4a81ef['query']);_0x3e7283[_0x2788('0x38')]=_[_0x2788('0x36')](_0x4a81ef[_0x2788('0x37')],qs[_0x2788('0x39')](_0x216778['query'][_0x2788('0x39')]));_0x3e7283[_0x2788('0x38')]=_0x3e7283[_0x2788('0x38')][_0x2788('0x3a')]?_0x3e7283['attributes']:_0x4a81ef[_0x2788('0x37')];if(_0x216778[_0x2788('0x33')][_0x2788('0x43')]){_0x3e7283['include']=[{'all':!![]}];}_0x3e7283=_[_0x2788('0x41')]({},_0x3e7283,_0x216778['options']);return db['Dynamics365Field'][_0x2788('0x47')](_0x3e7283)['then'](handleEntityNotFound(_0x3205ad,null))[_0x2788('0x27')](respondWithResult(_0x3205ad,null))[_0x2788('0x48')](handleError(_0x3205ad,null));};exports[_0x2788('0x49')]=function(_0x2cb263,_0x3dd39b){return db[_0x2788('0x2e')][_0x2788('0x49')](_0x2cb263['body'],{})[_0x2788('0x27')](respondWithResult(_0x3dd39b,0xc9))[_0x2788('0x48')](handleError(_0x3dd39b,null));};exports[_0x2788('0x26')]=function(_0x4e0d6c,_0x7c7cb6){if(_0x4e0d6c['body']['id']){delete _0x4e0d6c[_0x2788('0x4a')]['id'];}return db[_0x2788('0x2e')][_0x2788('0x47')]({'where':{'id':_0x4e0d6c[_0x2788('0x46')]['id']}})[_0x2788('0x27')](handleEntityNotFound(_0x7c7cb6,null))['then'](saveUpdates(_0x4e0d6c['body'],null))[_0x2788('0x27')](respondWithResult(_0x7c7cb6,null))['catch'](handleError(_0x7c7cb6,null));};exports[_0x2788('0x4b')]=function(_0xab6df1,_0x4ac962){return db['Dynamics365Field'][_0x2788('0x47')]({'where':{'id':_0xab6df1[_0x2788('0x46')]['id']}})[_0x2788('0x27')](handleEntityNotFound(_0x4ac962,null))[_0x2788('0x27')](removeEntity(_0x4ac962,null))[_0x2788('0x48')](handleError(_0x4ac962,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 796eaa9..01b5a6c 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 _0xb913=['util','../../config/logger','moment','bluebird','path','../../config/environment','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash'];(function(_0x168b2a,_0x56bc6b){var _0x1a95cd=function(_0x28737b){while(--_0x28737b){_0x168b2a['push'](_0x168b2a['shift']());}};_0x1a95cd(++_0x56bc6b);}(_0xb913,0x99));var _0x3b91=function(_0x391991,_0x191092){_0x391991=_0x391991-0x0;var _0x5f010d=_0xb913[_0x391991];return _0x5f010d;};'use strict';var _=require(_0x3b91('0x0'));var util=require(_0x3b91('0x1'));var logger=require(_0x3b91('0x2'))('api');var moment=require(_0x3b91('0x3'));var BPromise=require(_0x3b91('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b91('0x5'));var rimraf=require('rimraf');var config=require(_0x3b91('0x6'));var attributes=require('./intDynamics365Field.attributes');module[_0x3b91('0x7')]=function(_0x41625a,_0x577644){return _0x41625a[_0x3b91('0x8')](_0x3b91('0x9'),attributes,{'tableName':_0x3b91('0xa'),'paranoid':![],'indexes':[{'name':_0x3b91('0xb'),'fields':[_0x3b91('0xc'),_0x3b91('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x298a=['exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x298a,0x14a));var _0xa298=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x298a[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xa298('0x0'));var util=require(_0xa298('0x1'));var logger=require(_0xa298('0x2'))(_0xa298('0x3'));var moment=require(_0xa298('0x4'));var BPromise=require(_0xa298('0x5'));var rp=require(_0xa298('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa298('0x7'));var config=require(_0xa298('0x8'));var attributes=require(_0xa298('0x9'));module[_0xa298('0xa')]=function(_0xb05593,_0x1ffbb5){return _0xb05593[_0xa298('0xb')](_0xa298('0xc'),attributes,{'tableName':_0xa298('0xd'),'paranoid':![],'indexes':[{'name':_0xa298('0xe'),'fields':[_0xa298('0xf'),_0xa298('0x10')],'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 b9560f4..0a457a1 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 _0x37b2=['request\x20sent','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x22ee0f,_0x22e6d2){var _0x204696=function(_0x4cab38){while(--_0x4cab38){_0x22ee0f['push'](_0x22ee0f['shift']());}};_0x204696(++_0x22e6d2);}(_0x37b2,0xd3));var _0x237b=function(_0x5da875,_0x475a8b){_0x5da875=_0x5da875-0x0;var _0x25d687=_0x37b2[_0x5da875];return _0x25d687;};'use strict';var _=require(_0x237b('0x0'));var util=require(_0x237b('0x1'));var moment=require(_0x237b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x237b('0x3'));var db=require(_0x237b('0x4'))['db'];var utils=require(_0x237b('0x5'));var logger=require(_0x237b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x237b('0x7'));var client=jayson[_0x237b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1be08a,_0x340cbd,_0x360c16){return new BPromise(function(_0x16bddb,_0x2c47da){return client['request'](_0x1be08a,_0x360c16)['then'](function(_0x1aebc9){logger['info'](_0x237b('0x9'),_0x340cbd,'request\x20sent');logger[_0x237b('0xa')](_0x237b('0xb'),_0x340cbd,'request\x20sent',JSON[_0x237b('0xc')](_0x1aebc9));if(_0x1aebc9[_0x237b('0xd')]){if(_0x1aebc9[_0x237b('0xd')][_0x237b('0xe')]===0x1f4){logger[_0x237b('0xd')](_0x237b('0x9'),_0x340cbd,_0x1aebc9[_0x237b('0xd')]['message']);return _0x2c47da(_0x1aebc9[_0x237b('0xd')][_0x237b('0xf')]);}logger['error'](_0x237b('0x9'),_0x340cbd,_0x1aebc9[_0x237b('0xd')][_0x237b('0xf')]);return _0x16bddb(_0x1aebc9[_0x237b('0xd')][_0x237b('0xf')]);}else{logger[_0x237b('0x10')](_0x237b('0x9'),_0x340cbd,_0x237b('0x11'));_0x16bddb(_0x1aebc9[_0x237b('0x12')]['message']);}})['catch'](function(_0x1db79c){logger[_0x237b('0xd')](_0x237b('0x9'),_0x340cbd,_0x1db79c);_0x2c47da(_0x1db79c);});});} \ No newline at end of file +var _0x5795=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x3a57a3,_0x5673df){var _0x292eda=function(_0x1a321f){while(--_0x1a321f){_0x3a57a3['push'](_0x3a57a3['shift']());}};_0x292eda(++_0x5673df);}(_0x5795,0xd1));var _0x5579=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5795[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5579('0x0'));var util=require(_0x5579('0x1'));var moment=require(_0x5579('0x2'));var BPromise=require(_0x5579('0x3'));var rs=require(_0x5579('0x4'));var fs=require('fs');var Redis=require(_0x5579('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5579('0x6'));var config=require(_0x5579('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5579('0x8')][_0x5579('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3eee07,_0x93bedd,_0x16b184){return new BPromise(function(_0x47984b,_0x51c579){return client[_0x5579('0xa')](_0x3eee07,_0x16b184)[_0x5579('0xb')](function(_0x502e86){logger['info'](_0x5579('0xc'),_0x93bedd,_0x5579('0xd'));logger[_0x5579('0xe')](_0x5579('0xf'),_0x93bedd,'request\x20sent',JSON[_0x5579('0x10')](_0x502e86));if(_0x502e86['error']){if(_0x502e86[_0x5579('0x11')][_0x5579('0x12')]===0x1f4){logger[_0x5579('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x93bedd,_0x502e86[_0x5579('0x11')][_0x5579('0x13')]);return _0x51c579(_0x502e86['error']['message']);}logger[_0x5579('0x11')](_0x5579('0xc'),_0x93bedd,_0x502e86[_0x5579('0x11')][_0x5579('0x13')]);return _0x47984b(_0x502e86[_0x5579('0x11')][_0x5579('0x13')]);}else{logger[_0x5579('0x14')](_0x5579('0xc'),_0x93bedd,_0x5579('0xd'));_0x47984b(_0x502e86[_0x5579('0x15')][_0x5579('0x13')]);}})[_0x5579('0x16')](function(_0x45f200){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x93bedd,_0x45f200);_0x51c579(_0x45f200);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index fd29963..65bd9d4 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 _0x0b54=['addConfiguration','put','/:id','update','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations'];(function(_0x5224b4,_0x355198){var _0x4cd0ae=function(_0x1d1d1c){while(--_0x1d1d1c){_0x5224b4['push'](_0x5224b4['shift']());}};_0x4cd0ae(++_0x355198);}(_0x0b54,0x176));var _0x40b5=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x0b54[_0x38b14f];return _0x22a324;};'use strict';var multer=require('multer');var util=require(_0x40b5('0x0'));var path=require(_0x40b5('0x1'));var timeout=require('connect-timeout');var express=require(_0x40b5('0x2'));var router=express[_0x40b5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x40b5('0x4'));var interaction=require(_0x40b5('0x5'));var config=require(_0x40b5('0x6'));var controller=require('./intFreshdeskAccount.controller');router[_0x40b5('0x7')]('/',auth[_0x40b5('0x8')](),controller[_0x40b5('0x9')]);router[_0x40b5('0x7')]('/:id',auth[_0x40b5('0x8')](),controller[_0x40b5('0xa')]);router['get']('/:id/configurations',auth[_0x40b5('0x8')](),controller[_0x40b5('0xb')]);router[_0x40b5('0x7')](_0x40b5('0xc'),auth['isAuthenticated'](),controller[_0x40b5('0xd')]);router[_0x40b5('0xe')]('/',auth[_0x40b5('0x8')](),controller[_0x40b5('0xf')]);router[_0x40b5('0xe')](_0x40b5('0x10'),auth[_0x40b5('0x8')](),controller[_0x40b5('0x11')]);router[_0x40b5('0x12')](_0x40b5('0x13'),auth[_0x40b5('0x8')](),controller[_0x40b5('0x14')]);router[_0x40b5('0x15')](_0x40b5('0x13'),auth[_0x40b5('0x8')](),controller[_0x40b5('0x16')]);module['exports']=router; \ No newline at end of file +var _0x15e1=['post','create','addConfiguration','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields'];(function(_0x42a010,_0x20ae1a){var _0x351067=function(_0x1e8439){while(--_0x1e8439){_0x42a010['push'](_0x42a010['shift']());}};_0x351067(++_0x20ae1a);}(_0x15e1,0x13a));var _0x115e=function(_0x444024,_0x44b7d9){_0x444024=_0x444024-0x0;var _0x2eb8dc=_0x15e1[_0x444024];return _0x2eb8dc;};'use strict';var multer=require(_0x115e('0x0'));var util=require(_0x115e('0x1'));var path=require(_0x115e('0x2'));var timeout=require(_0x115e('0x3'));var express=require(_0x115e('0x4'));var router=express['Router']();var fs_extra=require(_0x115e('0x5'));var auth=require(_0x115e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x115e('0x7'));var controller=require(_0x115e('0x8'));router[_0x115e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x115e('0x9')](_0x115e('0xa'),auth[_0x115e('0xb')](),controller[_0x115e('0xc')]);router[_0x115e('0x9')](_0x115e('0xd'),auth[_0x115e('0xb')](),controller['getConfigurations']);router['get'](_0x115e('0xe'),auth[_0x115e('0xb')](),controller[_0x115e('0xf')]);router[_0x115e('0x10')]('/',auth['isAuthenticated'](),controller[_0x115e('0x11')]);router[_0x115e('0x10')]('/:id/configurations',auth[_0x115e('0xb')](),controller[_0x115e('0x12')]);router['put'](_0x115e('0xa'),auth[_0x115e('0xb')](),controller[_0x115e('0x13')]);router[_0x115e('0x14')](_0x115e('0xa'),auth[_0x115e('0xb')](),controller['destroy']);module[_0x115e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index eeea703..e74778b 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 _0x524e=['username','remoteUri','STRING'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0x524e,0x15e));var _0xe524=function(_0x1f310a,_0x50a29c){_0x1f310a=_0x1f310a-0x0;var _0x233e49=_0x524e[_0x1f310a];return _0x233e49;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe524('0x0')]},'description':{'type':Sequelize[_0xe524('0x0')]},'username':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x1')},'apiKey':{'type':Sequelize[_0xe524('0x0')]},'remoteUri':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x2')},'serverUrl':{'type':Sequelize[_0xe524('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x4bd3=['sequelize','STRING','remoteUri'];(function(_0x2a5042,_0x307d04){var _0x4bc22f=function(_0x2ef928){while(--_0x2ef928){_0x2a5042['push'](_0x2a5042['shift']());}};_0x4bc22f(++_0x307d04);}(_0x4bd3,0x174));var _0x34bd=function(_0x4437ee,_0x5dd6ab){_0x4437ee=_0x4437ee-0x0;var _0xd7fac8=_0x4bd3[_0x4437ee];return _0xd7fac8;};'use strict';var Sequelize=require(_0x34bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x34bd('0x1')]},'description':{'type':Sequelize[_0x34bd('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x34bd('0x1')],'unique':_0x34bd('0x2')},'serverUrl':{'type':Sequelize[_0x34bd('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 59a0627..3319ed5 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 _0x4899=['getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','FreshdeskAccount','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','FreshdeskConfiguration','getConfigurations','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','substring','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','subject','agent','priority','group','source','ticket_type','company','remove','default','choices','capitalize','test','statusCode'];(function(_0x138b49,_0x2a7216){var _0x56aa6e=function(_0x37a10b){while(--_0x37a10b){_0x138b49['push'](_0x138b49['shift']());}};_0x56aa6e(++_0x2a7216);}(_0x4899,0x74));var _0x9489=function(_0x2c9591,_0x5f49d7){_0x2c9591=_0x2c9591-0x0;var _0x496131=_0x4899[_0x2c9591];return _0x496131;};'use strict';var emlformat=require(_0x9489('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9489('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9489('0x2'));var moment=require('moment');var BPromise=require(_0x9489('0x3'));var Mustache=require(_0x9489('0x4'));var util=require(_0x9489('0x5'));var path=require(_0x9489('0x6'));var sox=require(_0x9489('0x7'));var csv=require('to-csv');var ejs=require(_0x9489('0x8'));var fs=require('fs');var fs_extra=require(_0x9489('0x9'));var _=require(_0x9489('0xa'));var squel=require(_0x9489('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9489('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9489('0xd'));var Papa=require(_0x9489('0xe'));var Redis=require('ioredis');var authService=require(_0x9489('0xf'));var qs=require(_0x9489('0x10'));var as=require(_0x9489('0x11'));var hardwareService=require(_0x9489('0x12'));var logger=require(_0x9489('0x13'))(_0x9489('0x14'));var utils=require(_0x9489('0x15'));var config=require(_0x9489('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9489('0x17'))['db'];var integrations=require(_0x9489('0x18'));function respondWithStatusCode(_0x7368e2,_0x5de484){_0x5de484=_0x5de484||0xcc;return function(_0x532b72){if(_0x532b72){return _0x7368e2[_0x9489('0x19')](_0x5de484);}return _0x7368e2[_0x9489('0x1a')](_0x5de484)[_0x9489('0x1b')]();};}function respondWithResult(_0x4c3003,_0x402022){_0x402022=_0x402022||0xc8;return function(_0x51ecea){if(_0x51ecea){return _0x4c3003[_0x9489('0x1a')](_0x402022)['json'](_0x51ecea);}};}function respondWithFilteredResult(_0x98390b,_0x18a0aa){return function(_0x1cb631){if(_0x1cb631){var _0x33c217=typeof _0x18a0aa[_0x9489('0x1c')]==='undefined'&&typeof _0x18a0aa[_0x9489('0x1d')]==='undefined';var _0x5b939f=_0x1cb631[_0x9489('0x1e')];var _0x1f0a5d=_0x33c217?0x0:_0x18a0aa[_0x9489('0x1c')];var _0x50b7da=_0x33c217?_0x1cb631[_0x9489('0x1e')]:_0x18a0aa[_0x9489('0x1c')]+_0x18a0aa['limit'];var _0x5347b2;if(_0x50b7da>=_0x5b939f){_0x50b7da=_0x5b939f;_0x5347b2=0xc8;}else{_0x5347b2=0xce;}_0x98390b[_0x9489('0x1a')](_0x5347b2);return _0x98390b[_0x9489('0x1f')](_0x9489('0x20'),_0x1f0a5d+'-'+_0x50b7da+'/'+_0x5b939f)[_0x9489('0x21')](_0x1cb631);}return null;};}function patchUpdates(_0x208bad){return function(_0x1e505a){try{jsonpatch[_0x9489('0x22')](_0x1e505a,_0x208bad,!![]);}catch(_0x4c58ec){return BPromise[_0x9489('0x23')](_0x4c58ec);}return _0x1e505a[_0x9489('0x24')]();};}function saveUpdates(_0x1cf61d,_0x5da0e9){return function(_0x1d248a){if(_0x1d248a){return _0x1d248a[_0x9489('0x25')](_0x1cf61d)[_0x9489('0x26')](function(_0x2f604a){return _0x2f604a;});}return null;};}function removeEntity(_0x1d6aa2,_0x37cea1){return function(_0x551b93){if(_0x551b93){return _0x551b93[_0x9489('0x27')]()[_0x9489('0x26')](function(){_0x1d6aa2[_0x9489('0x1a')](0xcc)[_0x9489('0x1b')]();});}};}function handleEntityNotFound(_0x2daed4,_0x1ede2f){return function(_0x21ea0a){if(!_0x21ea0a){_0x2daed4[_0x9489('0x19')](0x194);}return _0x21ea0a;};}function handleError(_0xd92a57,_0x1d9cdf){_0x1d9cdf=_0x1d9cdf||0x1f4;return function(_0x464ea6){logger[_0x9489('0x28')](_0x464ea6[_0x9489('0x29')]);if(_0x464ea6[_0x9489('0x2a')]){delete _0x464ea6[_0x9489('0x2a')];}_0xd92a57[_0x9489('0x1a')](_0x1d9cdf)['send'](_0x464ea6);};}exports[_0x9489('0x2b')]=function(_0x59b968,_0x4a640e){var _0x4bc3ce={},_0x42ff88={},_0x13fc88={'count':0x0,'rows':[]};var _0x5515a9=_[_0x9489('0x2c')](db[_0x9489('0x2d')][_0x9489('0x2e')],function(_0x4f1bad){return{'name':_0x4f1bad['fieldName'],'type':_0x4f1bad[_0x9489('0x2f')]['key']};});_0x42ff88[_0x9489('0x30')]=_[_0x9489('0x2c')](_0x5515a9,_0x9489('0x2a'));_0x42ff88[_0x9489('0x31')]=_[_0x9489('0x32')](_0x59b968['query']);_0x42ff88['filters']=_[_0x9489('0x33')](_0x42ff88[_0x9489('0x30')],_0x42ff88[_0x9489('0x31')]);_0x4bc3ce['attributes']=_[_0x9489('0x33')](_0x42ff88['model'],qs[_0x9489('0x34')](_0x59b968[_0x9489('0x31')][_0x9489('0x34')]));_0x4bc3ce[_0x9489('0x35')]=_0x4bc3ce['attributes'][_0x9489('0x36')]?_0x4bc3ce[_0x9489('0x35')]:_0x42ff88[_0x9489('0x30')];if(!_0x59b968['query'][_0x9489('0x37')]('nolimit')){_0x4bc3ce[_0x9489('0x1d')]=qs[_0x9489('0x1d')](_0x59b968['query'][_0x9489('0x1d')]);_0x4bc3ce[_0x9489('0x1c')]=qs[_0x9489('0x1c')](_0x59b968['query'][_0x9489('0x1c')]);}_0x4bc3ce[_0x9489('0x38')]=qs[_0x9489('0x39')](_0x59b968[_0x9489('0x31')][_0x9489('0x39')]);_0x4bc3ce[_0x9489('0x3a')]=qs[_0x9489('0x3b')](_[_0x9489('0x3c')](_0x59b968[_0x9489('0x31')],_0x42ff88[_0x9489('0x3b')]),_0x5515a9);if(_0x59b968[_0x9489('0x31')][_0x9489('0x3d')]){_0x4bc3ce[_0x9489('0x3a')]=_[_0x9489('0x3e')](_0x4bc3ce[_0x9489('0x3a')],{'$or':_[_0x9489('0x2c')](_0x5515a9,function(_0x253a32){if(_0x253a32[_0x9489('0x2f')]!==_0x9489('0x3f')){var _0x367a54={};_0x367a54[_0x253a32[_0x9489('0x2a')]]={'$like':'%'+_0x59b968[_0x9489('0x31')]['filter']+'%'};return _0x367a54;}})});}_0x4bc3ce=_['merge']({},_0x4bc3ce,_0x59b968['options']);var _0x453cd2={'where':_0x4bc3ce[_0x9489('0x3a')]};return db[_0x9489('0x2d')][_0x9489('0x1e')](_0x453cd2)[_0x9489('0x26')](function(_0x2ff936){_0x13fc88[_0x9489('0x1e')]=_0x2ff936;if(_0x59b968[_0x9489('0x31')][_0x9489('0x40')]){_0x4bc3ce[_0x9489('0x41')]=[{'all':!![]}];}return db[_0x9489('0x2d')]['findAll'](_0x4bc3ce);})[_0x9489('0x26')](function(_0x33e00d){_0x13fc88[_0x9489('0x42')]=_0x33e00d;return _0x13fc88;})[_0x9489('0x26')](respondWithFilteredResult(_0x4a640e,_0x4bc3ce))[_0x9489('0x43')](handleError(_0x4a640e,null));};exports[_0x9489('0x44')]=function(_0xe0714d,_0x26b316){var _0x1aaeb6={'raw':![],'where':{'id':_0xe0714d[_0x9489('0x45')]['id']}},_0x5d7549={};_0x5d7549[_0x9489('0x30')]=_[_0x9489('0x32')](db[_0x9489('0x2d')][_0x9489('0x2e')]);_0x5d7549[_0x9489('0x31')]=_[_0x9489('0x32')](_0xe0714d['query']);_0x5d7549[_0x9489('0x3b')]=_[_0x9489('0x33')](_0x5d7549[_0x9489('0x30')],_0x5d7549[_0x9489('0x31')]);_0x1aaeb6[_0x9489('0x35')]=_[_0x9489('0x33')](_0x5d7549['model'],qs['fields'](_0xe0714d['query'][_0x9489('0x34')]));_0x1aaeb6[_0x9489('0x35')]=_0x1aaeb6[_0x9489('0x35')][_0x9489('0x36')]?_0x1aaeb6[_0x9489('0x35')]:_0x5d7549[_0x9489('0x30')];if(_0xe0714d[_0x9489('0x31')][_0x9489('0x40')]){_0x1aaeb6[_0x9489('0x41')]=[{'all':!![]}];}_0x1aaeb6=_[_0x9489('0x3e')]({},_0x1aaeb6,_0xe0714d[_0x9489('0x46')]);return db[_0x9489('0x2d')][_0x9489('0x47')](_0x1aaeb6)['then'](handleEntityNotFound(_0x26b316,null))[_0x9489('0x26')](respondWithResult(_0x26b316,null))[_0x9489('0x43')](handleError(_0x26b316,null));};exports[_0x9489('0x48')]=function(_0xd63998,_0x289ea7){return db['FreshdeskAccount']['create'](_0xd63998[_0x9489('0x49')],{})[_0x9489('0x26')](respondWithResult(_0x289ea7,0xc9))[_0x9489('0x43')](handleError(_0x289ea7,null));};exports[_0x9489('0x25')]=function(_0x35abcb,_0x3dbebe){if(_0x35abcb[_0x9489('0x49')]['id']){delete _0x35abcb[_0x9489('0x49')]['id'];}return db[_0x9489('0x2d')][_0x9489('0x47')]({'where':{'id':_0x35abcb[_0x9489('0x45')]['id']}})[_0x9489('0x26')](handleEntityNotFound(_0x3dbebe,null))[_0x9489('0x26')](saveUpdates(_0x35abcb[_0x9489('0x49')],null))[_0x9489('0x26')](respondWithResult(_0x3dbebe,null))[_0x9489('0x43')](handleError(_0x3dbebe,null));};exports[_0x9489('0x27')]=function(_0x2c9ce7,_0x3be848){return db[_0x9489('0x2d')][_0x9489('0x47')]({'where':{'id':_0x2c9ce7[_0x9489('0x45')]['id']}})[_0x9489('0x26')](handleEntityNotFound(_0x3be848,null))[_0x9489('0x26')](removeEntity(_0x3be848,null))[_0x9489('0x43')](handleError(_0x3be848,null));};exports['getConfigurations']=function(_0x24a965,_0x1a36ef,_0x20847b){var _0x3b7023={};var _0x4e91c3={};var _0x41331a;var _0x1edcc1;return db[_0x9489('0x2d')]['findOne']({'where':{'id':_0x24a965['params']['id']}})[_0x9489('0x26')](handleEntityNotFound(_0x1a36ef,null))['then'](function(_0x466bee){if(_0x466bee){_0x41331a=_0x466bee;_0x4e91c3['model']=_[_0x9489('0x32')](db[_0x9489('0x4a')][_0x9489('0x2e')]);_0x4e91c3[_0x9489('0x31')]=_[_0x9489('0x32')](_0x24a965['query']);_0x4e91c3['filters']=_['intersection'](_0x4e91c3['model'],_0x4e91c3['query']);_0x3b7023[_0x9489('0x35')]=_['intersection'](_0x4e91c3[_0x9489('0x30')],qs[_0x9489('0x34')](_0x24a965[_0x9489('0x31')][_0x9489('0x34')]));_0x3b7023[_0x9489('0x35')]=_0x3b7023[_0x9489('0x35')][_0x9489('0x36')]?_0x3b7023[_0x9489('0x35')]:_0x4e91c3['model'];_0x3b7023[_0x9489('0x38')]=qs['sort'](_0x24a965[_0x9489('0x31')]['sort']);_0x3b7023['where']=qs[_0x9489('0x3b')](_[_0x9489('0x3c')](_0x24a965[_0x9489('0x31')],_0x4e91c3[_0x9489('0x3b')]));if(_0x24a965[_0x9489('0x31')][_0x9489('0x3d')]){_0x3b7023[_0x9489('0x3a')]=_[_0x9489('0x3e')](_0x3b7023[_0x9489('0x3a')],{'$or':_[_0x9489('0x2c')](_0x3b7023[_0x9489('0x35')],function(_0x2164d8){var _0x2ae177={};_0x2ae177[_0x2164d8]={'$like':'%'+_0x24a965['query'][_0x9489('0x3d')]+'%'};return _0x2ae177;})});}_0x3b7023=_['merge']({},_0x3b7023,_0x24a965['options']);return _0x41331a[_0x9489('0x4b')](_0x3b7023);}})[_0x9489('0x26')](function(_0xf3ab37){if(_0xf3ab37){_0x1edcc1=_0xf3ab37[_0x9489('0x36')];if(!_0x24a965[_0x9489('0x31')][_0x9489('0x37')](_0x9489('0x4c'))){_0x3b7023[_0x9489('0x1d')]=qs[_0x9489('0x1d')](_0x24a965[_0x9489('0x31')][_0x9489('0x1d')]);_0x3b7023['offset']=qs[_0x9489('0x1c')](_0x24a965[_0x9489('0x31')][_0x9489('0x1c')]);}return _0x41331a['getConfigurations'](_0x3b7023);}})[_0x9489('0x26')](function(_0x186608){if(_0x186608){return _0x186608?{'count':_0x1edcc1,'rows':_0x186608}:null;}})[_0x9489('0x26')](respondWithResult(_0x1a36ef,null))[_0x9489('0x43')](handleError(_0x1a36ef,null));};exports[_0x9489('0x4d')]=function(_0x16f995,_0x203818,_0x19ee5c){if(_0x16f995['body']['id']){delete _0x16f995['body']['id'];}return db[_0x9489('0x2d')][_0x9489('0x4e')]({'where':{'id':_0x16f995[_0x9489('0x45')]['id']}})[_0x9489('0x26')](handleEntityNotFound(_0x203818,null))['then'](function(_0xfdd005){if(_0xfdd005){_0x16f995[_0x9489('0x49')][_0x9489('0x4f')]=_0xfdd005['id'];_0x16f995[_0x9489('0x49')][_0x9489('0x50')]=integrations[_0x9489('0x51')](_0x16f995['body'][_0x9489('0x52')],_0x16f995[_0x9489('0x49')][_0x9489('0x2f')]);_0x16f995[_0x9489('0x49')][_0x9489('0x53')]=integrations[_0x9489('0x54')](_0x16f995[_0x9489('0x49')][_0x9489('0x52')],_0x16f995['body']['type']);return db[_0x9489('0x4a')][_0x9489('0x48')](_0x16f995['body'],{'include':[{'model':db[_0x9489('0x55')],'as':_0x9489('0x50')},{'model':db[_0x9489('0x55')],'as':_0x9489('0x53')}]});}return null;})[_0x9489('0x26')](respondWithResult(_0x203818,null))[_0x9489('0x43')](handleError(_0x203818,null));};exports[_0x9489('0x56')]=function(_0x451bad,_0x1cafdb,_0x2b06ef){var _0x5bc1e7='';return db[_0x9489('0x2d')][_0x9489('0x4e')]({'where':{'id':_0x451bad[_0x9489('0x45')]['id']},'attributes':['id',_0x9489('0x57'),_0x9489('0x58')]})['then'](handleEntityNotFound(_0x1cafdb,null))[_0x9489('0x26')](function(_0x5dacf5){if(_0x5dacf5){_0x5bc1e7=_0x5dacf5[_0x9489('0x57')];var _0x911c40=_0x5bc1e7['slice'](-0x1);if(_0x911c40==='/'){_0x5bc1e7=_0x5bc1e7[_0x9489('0x59')](0x0,_0x5bc1e7['lastIndexOf'](_0x911c40));}return rp({'method':_0x9489('0x5a'),'uri':util[_0x9489('0x5b')]('%s/%s',_0x5bc1e7,_0x9489('0x5c')),'headers':{'Authorization':util[_0x9489('0x5b')](_0x9489('0x5d'),new Buffer(util['format'](_0x9489('0x5e'),_0x5dacf5[_0x9489('0x58')]))[_0x9489('0x5f')]('base64'))},'json':!![]});}})[_0x9489('0x26')](function(_0x58f106){if(_0x58f106){var _0x233632=[_0x9489('0x60'),_0x9489('0x61'),_0x9489('0x62'),'description',_0x9489('0x1a'),_0x9489('0x63'),_0x9489('0x64'),_0x9489('0x65'),_0x9489('0x66'),_0x9489('0x64'),_0x9489('0x67')];_[_0x9489('0x68')](_0x58f106,function(_0x4707bf){return _0x233632['includes'](_0x4707bf[_0x9489('0x2a')])||!_0x4707bf[_0x9489('0x69')]&&_0x4707bf[_0x9489('0x2f')]!=='custom_text'&&_0x4707bf[_0x9489('0x2f')]!=='custom_dropdown';});return{'count':_0x58f106['length'],'rows':_[_0x9489('0x2c')](_0x58f106,function(_0x1f7ca4){return{'id':_0x1f7ca4[_0x9489('0x2a')],'name':_0x1f7ca4['label'],'custom':!_0x1f7ca4[_0x9489('0x69')],'options':_0x1f7ca4['choices']?_[_0x9489('0x2c')](_0x1f7ca4[_0x9489('0x6a')],function(_0x367eed){return{'name':_[_0x9489('0x6b')](_0x367eed),'value':_0x367eed};}):[]};})};}})[_0x9489('0x26')](respondWithResult(_0x1cafdb,null))[_0x9489('0x43')](function(_0x100ca6){var _0x504071=_0x451bad[_0x9489('0x31')][_0x9489('0x6c')]?0x1f4:_0x100ca6[_0x9489('0x6d')]||0x1f4;logger[_0x9489('0x28')](_0x9489('0x6e'),_0x9489('0x56'),_0x504071,JSON[_0x9489('0x6f')](_0x100ca6));delete _0x100ca6[_0x9489('0x2a')];if(_0x504071===0x191){_0x504071=0x190;}_0x1cafdb['status'](_0x504071)['send'](_0x451bad[_0x9489('0x31')][_0x9489('0x6c')]?{'message':_0x9489('0x70'),'statusCode':_0x100ca6[_0x9489('0x6d')]}:_0x100ca6);});}; \ No newline at end of file +var _0x559a=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Descriptions','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','base64','requester','agent','description','priority','source','ticket_type','group','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','error','stack','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields'];(function(_0x8ce9e0,_0x3aea7c){var _0x332c52=function(_0x5518e9){while(--_0x5518e9){_0x8ce9e0['push'](_0x8ce9e0['shift']());}};_0x332c52(++_0x3aea7c);}(_0x559a,0xb3));var _0xa559=function(_0x5c65d7,_0x286eae){_0x5c65d7=_0x5c65d7-0x0;var _0x8b79b7=_0x559a[_0x5c65d7];return _0x8b79b7;};'use strict';var emlformat=require(_0xa559('0x0'));var rimraf=require(_0xa559('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa559('0x2'));var rp=require(_0xa559('0x3'));var moment=require(_0xa559('0x4'));var BPromise=require(_0xa559('0x5'));var Mustache=require(_0xa559('0x6'));var util=require(_0xa559('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa559('0x8'));var ejs=require(_0xa559('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa559('0xa'));var squel=require(_0xa559('0xb'));var crypto=require('crypto');var jsforce=require(_0xa559('0xc'));var deskjs=require(_0xa559('0xd'));var toCsv=require(_0xa559('0x8'));var querystring=require(_0xa559('0xe'));var Papa=require('papaparse');var Redis=require(_0xa559('0xf'));var authService=require(_0xa559('0x10'));var qs=require(_0xa559('0x11'));var as=require(_0xa559('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa559('0x13'));var utils=require(_0xa559('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa559('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa559('0x16'));function respondWithStatusCode(_0x5f0463,_0x2a646e){_0x2a646e=_0x2a646e||0xcc;return function(_0x3a82f7){if(_0x3a82f7){return _0x5f0463[_0xa559('0x17')](_0x2a646e);}return _0x5f0463['status'](_0x2a646e)[_0xa559('0x18')]();};}function respondWithResult(_0x3853fd,_0x5ed915){_0x5ed915=_0x5ed915||0xc8;return function(_0x32b782){if(_0x32b782){return _0x3853fd[_0xa559('0x19')](_0x5ed915)[_0xa559('0x1a')](_0x32b782);}};}function respondWithFilteredResult(_0x1e48b3,_0x539a4b){return function(_0x309c27){if(_0x309c27){var _0x495b96=typeof _0x539a4b[_0xa559('0x1b')]===_0xa559('0x1c')&&typeof _0x539a4b['limit']===_0xa559('0x1c');var _0x174740=_0x309c27[_0xa559('0x1d')];var _0xd21ebf=_0x495b96?0x0:_0x539a4b[_0xa559('0x1b')];var _0x16f090=_0x495b96?_0x309c27[_0xa559('0x1d')]:_0x539a4b[_0xa559('0x1b')]+_0x539a4b[_0xa559('0x1e')];var _0x9ae158;if(_0x16f090>=_0x174740){_0x16f090=_0x174740;_0x9ae158=0xc8;}else{_0x9ae158=0xce;}_0x1e48b3['status'](_0x9ae158);return _0x1e48b3['set'](_0xa559('0x1f'),_0xd21ebf+'-'+_0x16f090+'/'+_0x174740)[_0xa559('0x1a')](_0x309c27);}return null;};}function patchUpdates(_0x47cb65){return function(_0x3496c3){try{jsonpatch[_0xa559('0x20')](_0x3496c3,_0x47cb65,!![]);}catch(_0x185781){return BPromise[_0xa559('0x21')](_0x185781);}return _0x3496c3[_0xa559('0x22')]();};}function saveUpdates(_0x2dd8cf,_0x572046){return function(_0x36aa43){if(_0x36aa43){return _0x36aa43['update'](_0x2dd8cf)[_0xa559('0x23')](function(_0x396fe9){return _0x396fe9;});}return null;};}function removeEntity(_0x314fef,_0x487a60){return function(_0xc37c82){if(_0xc37c82){return _0xc37c82['destroy']()[_0xa559('0x23')](function(){_0x314fef[_0xa559('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a5181,_0x552c2c){return function(_0x4d41cf){if(!_0x4d41cf){_0x2a5181[_0xa559('0x17')](0x194);}return _0x4d41cf;};}function handleError(_0x1914e7,_0x3fcf7f){_0x3fcf7f=_0x3fcf7f||0x1f4;return function(_0x24229d){logger[_0xa559('0x24')](_0x24229d[_0xa559('0x25')]);if(_0x24229d[_0xa559('0x26')]){delete _0x24229d[_0xa559('0x26')];}_0x1914e7['status'](_0x3fcf7f)[_0xa559('0x27')](_0x24229d);};}exports[_0xa559('0x28')]=function(_0x21c8a0,_0x1c92b9){var _0x5f3fbb={},_0x1fb70f={},_0x32db9d={'count':0x0,'rows':[]};var _0x195ec4=_['map'](db[_0xa559('0x29')][_0xa559('0x2a')],function(_0xd0481e){return{'name':_0xd0481e[_0xa559('0x2b')],'type':_0xd0481e[_0xa559('0x2c')][_0xa559('0x2d')]};});_0x1fb70f[_0xa559('0x2e')]=_[_0xa559('0x2f')](_0x195ec4,_0xa559('0x26'));_0x1fb70f['query']=_[_0xa559('0x30')](_0x21c8a0[_0xa559('0x31')]);_0x1fb70f[_0xa559('0x32')]=_[_0xa559('0x33')](_0x1fb70f['model'],_0x1fb70f[_0xa559('0x31')]);_0x5f3fbb['attributes']=_[_0xa559('0x33')](_0x1fb70f[_0xa559('0x2e')],qs[_0xa559('0x34')](_0x21c8a0[_0xa559('0x31')][_0xa559('0x34')]));_0x5f3fbb[_0xa559('0x35')]=_0x5f3fbb['attributes'][_0xa559('0x36')]?_0x5f3fbb[_0xa559('0x35')]:_0x1fb70f[_0xa559('0x2e')];if(!_0x21c8a0[_0xa559('0x31')][_0xa559('0x37')](_0xa559('0x38'))){_0x5f3fbb[_0xa559('0x1e')]=qs[_0xa559('0x1e')](_0x21c8a0['query'][_0xa559('0x1e')]);_0x5f3fbb[_0xa559('0x1b')]=qs[_0xa559('0x1b')](_0x21c8a0[_0xa559('0x31')][_0xa559('0x1b')]);}_0x5f3fbb[_0xa559('0x39')]=qs[_0xa559('0x3a')](_0x21c8a0['query'][_0xa559('0x3a')]);_0x5f3fbb[_0xa559('0x3b')]=qs[_0xa559('0x32')](_[_0xa559('0x3c')](_0x21c8a0[_0xa559('0x31')],_0x1fb70f[_0xa559('0x32')]),_0x195ec4);if(_0x21c8a0[_0xa559('0x31')][_0xa559('0x3d')]){_0x5f3fbb[_0xa559('0x3b')]=_[_0xa559('0x3e')](_0x5f3fbb[_0xa559('0x3b')],{'$or':_[_0xa559('0x2f')](_0x195ec4,function(_0xe9dc78){if(_0xe9dc78['type']!==_0xa559('0x3f')){var _0x49adbd={};_0x49adbd[_0xe9dc78[_0xa559('0x26')]]={'$like':'%'+_0x21c8a0['query'][_0xa559('0x3d')]+'%'};return _0x49adbd;}})});}_0x5f3fbb=_['merge']({},_0x5f3fbb,_0x21c8a0[_0xa559('0x40')]);var _0x1ef87b={'where':_0x5f3fbb[_0xa559('0x3b')]};return db[_0xa559('0x29')][_0xa559('0x1d')](_0x1ef87b)[_0xa559('0x23')](function(_0x1e22fe){_0x32db9d['count']=_0x1e22fe;if(_0x21c8a0[_0xa559('0x31')][_0xa559('0x41')]){_0x5f3fbb[_0xa559('0x42')]=[{'all':!![]}];}return db[_0xa559('0x29')][_0xa559('0x43')](_0x5f3fbb);})[_0xa559('0x23')](function(_0x5e7a22){_0x32db9d[_0xa559('0x44')]=_0x5e7a22;return _0x32db9d;})[_0xa559('0x23')](respondWithFilteredResult(_0x1c92b9,_0x5f3fbb))[_0xa559('0x45')](handleError(_0x1c92b9,null));};exports[_0xa559('0x46')]=function(_0x5d6325,_0x6340d3){var _0x2af622={'raw':![],'where':{'id':_0x5d6325[_0xa559('0x47')]['id']}},_0x16e21d={};_0x16e21d[_0xa559('0x2e')]=_['keys'](db[_0xa559('0x29')][_0xa559('0x2a')]);_0x16e21d[_0xa559('0x31')]=_[_0xa559('0x30')](_0x5d6325[_0xa559('0x31')]);_0x16e21d[_0xa559('0x32')]=_[_0xa559('0x33')](_0x16e21d['model'],_0x16e21d[_0xa559('0x31')]);_0x2af622[_0xa559('0x35')]=_[_0xa559('0x33')](_0x16e21d[_0xa559('0x2e')],qs[_0xa559('0x34')](_0x5d6325[_0xa559('0x31')][_0xa559('0x34')]));_0x2af622[_0xa559('0x35')]=_0x2af622[_0xa559('0x35')]['length']?_0x2af622[_0xa559('0x35')]:_0x16e21d[_0xa559('0x2e')];if(_0x5d6325[_0xa559('0x31')][_0xa559('0x41')]){_0x2af622[_0xa559('0x42')]=[{'all':!![]}];}_0x2af622=_[_0xa559('0x3e')]({},_0x2af622,_0x5d6325[_0xa559('0x40')]);return db['FreshdeskAccount'][_0xa559('0x48')](_0x2af622)[_0xa559('0x23')](handleEntityNotFound(_0x6340d3,null))[_0xa559('0x23')](respondWithResult(_0x6340d3,null))[_0xa559('0x45')](handleError(_0x6340d3,null));};exports[_0xa559('0x49')]=function(_0x482e46,_0x3e917c){return db[_0xa559('0x29')]['create'](_0x482e46[_0xa559('0x4a')],{})[_0xa559('0x23')](respondWithResult(_0x3e917c,0xc9))['catch'](handleError(_0x3e917c,null));};exports['update']=function(_0x140490,_0x27cd4f){if(_0x140490[_0xa559('0x4a')]['id']){delete _0x140490[_0xa559('0x4a')]['id'];}return db[_0xa559('0x29')][_0xa559('0x48')]({'where':{'id':_0x140490['params']['id']}})[_0xa559('0x23')](handleEntityNotFound(_0x27cd4f,null))['then'](saveUpdates(_0x140490['body'],null))['then'](respondWithResult(_0x27cd4f,null))[_0xa559('0x45')](handleError(_0x27cd4f,null));};exports[_0xa559('0x4b')]=function(_0x17453f,_0xad03d0){return db[_0xa559('0x29')][_0xa559('0x48')]({'where':{'id':_0x17453f[_0xa559('0x47')]['id']}})[_0xa559('0x23')](handleEntityNotFound(_0xad03d0,null))[_0xa559('0x23')](removeEntity(_0xad03d0,null))[_0xa559('0x45')](handleError(_0xad03d0,null));};exports[_0xa559('0x4c')]=function(_0x4abc17,_0x284005,_0x2be007){var _0x163e43={};var _0x580259={};var _0x38fb71;var _0x5da1aa;return db[_0xa559('0x29')][_0xa559('0x4d')]({'where':{'id':_0x4abc17[_0xa559('0x47')]['id']}})[_0xa559('0x23')](handleEntityNotFound(_0x284005,null))[_0xa559('0x23')](function(_0x3b0fdb){if(_0x3b0fdb){_0x38fb71=_0x3b0fdb;_0x580259[_0xa559('0x2e')]=_[_0xa559('0x30')](db['FreshdeskConfiguration'][_0xa559('0x2a')]);_0x580259[_0xa559('0x31')]=_[_0xa559('0x30')](_0x4abc17['query']);_0x580259['filters']=_[_0xa559('0x33')](_0x580259[_0xa559('0x2e')],_0x580259['query']);_0x163e43[_0xa559('0x35')]=_[_0xa559('0x33')](_0x580259[_0xa559('0x2e')],qs['fields'](_0x4abc17[_0xa559('0x31')][_0xa559('0x34')]));_0x163e43['attributes']=_0x163e43['attributes']['length']?_0x163e43[_0xa559('0x35')]:_0x580259[_0xa559('0x2e')];_0x163e43[_0xa559('0x39')]=qs[_0xa559('0x3a')](_0x4abc17[_0xa559('0x31')][_0xa559('0x3a')]);_0x163e43[_0xa559('0x3b')]=qs[_0xa559('0x32')](_['pick'](_0x4abc17['query'],_0x580259[_0xa559('0x32')]));if(_0x4abc17[_0xa559('0x31')][_0xa559('0x3d')]){_0x163e43['where']=_[_0xa559('0x3e')](_0x163e43[_0xa559('0x3b')],{'$or':_['map'](_0x163e43[_0xa559('0x35')],function(_0x1997dd){var _0x114dcd={};_0x114dcd[_0x1997dd]={'$like':'%'+_0x4abc17[_0xa559('0x31')][_0xa559('0x3d')]+'%'};return _0x114dcd;})});}_0x163e43=_[_0xa559('0x3e')]({},_0x163e43,_0x4abc17[_0xa559('0x40')]);return _0x38fb71[_0xa559('0x4c')](_0x163e43);}})['then'](function(_0x3c488a){if(_0x3c488a){_0x5da1aa=_0x3c488a[_0xa559('0x36')];if(!_0x4abc17['query'][_0xa559('0x37')](_0xa559('0x38'))){_0x163e43[_0xa559('0x1e')]=qs[_0xa559('0x1e')](_0x4abc17[_0xa559('0x31')][_0xa559('0x1e')]);_0x163e43[_0xa559('0x1b')]=qs[_0xa559('0x1b')](_0x4abc17['query'][_0xa559('0x1b')]);}return _0x38fb71[_0xa559('0x4c')](_0x163e43);}})[_0xa559('0x23')](function(_0xf75eae){if(_0xf75eae){return _0xf75eae?{'count':_0x5da1aa,'rows':_0xf75eae}:null;}})[_0xa559('0x23')](respondWithResult(_0x284005,null))[_0xa559('0x45')](handleError(_0x284005,null));};exports[_0xa559('0x4e')]=function(_0x536019,_0x2f0ea1,_0x41329f){if(_0x536019[_0xa559('0x4a')]['id']){delete _0x536019['body']['id'];}return db[_0xa559('0x29')][_0xa559('0x4d')]({'where':{'id':_0x536019[_0xa559('0x47')]['id']}})[_0xa559('0x23')](handleEntityNotFound(_0x2f0ea1,null))[_0xa559('0x23')](function(_0x2c3c6d){if(_0x2c3c6d){_0x536019[_0xa559('0x4a')][_0xa559('0x4f')]=_0x2c3c6d['id'];_0x536019['body'][_0xa559('0x50')]=integrations[_0xa559('0x51')](_0x536019[_0xa559('0x4a')][_0xa559('0x52')],_0x536019['body'][_0xa559('0x2c')]);_0x536019[_0xa559('0x4a')]['Descriptions']=integrations[_0xa559('0x53')](_0x536019[_0xa559('0x4a')][_0xa559('0x52')],_0x536019[_0xa559('0x4a')][_0xa559('0x2c')]);return db['FreshdeskConfiguration'][_0xa559('0x49')](_0x536019[_0xa559('0x4a')],{'include':[{'model':db['FreshdeskField'],'as':_0xa559('0x50')},{'model':db['FreshdeskField'],'as':_0xa559('0x54')}]});}return null;})[_0xa559('0x23')](respondWithResult(_0x2f0ea1,null))[_0xa559('0x45')](handleError(_0x2f0ea1,null));};exports[_0xa559('0x55')]=function(_0xc26ee3,_0x9f5d26,_0x1e9300){var _0x52a304='';return db['FreshdeskAccount'][_0xa559('0x4d')]({'where':{'id':_0xc26ee3[_0xa559('0x47')]['id']},'attributes':['id',_0xa559('0x56'),'apiKey']})[_0xa559('0x23')](handleEntityNotFound(_0x9f5d26,null))[_0xa559('0x23')](function(_0x222dbb){if(_0x222dbb){_0x52a304=_0x222dbb[_0xa559('0x56')];var _0x428c9f=_0x52a304[_0xa559('0x57')](-0x1);if(_0x428c9f==='/'){_0x52a304=_0x52a304[_0xa559('0x58')](0x0,_0x52a304[_0xa559('0x59')](_0x428c9f));}return rp({'method':_0xa559('0x5a'),'uri':util[_0xa559('0x5b')](_0xa559('0x5c'),_0x52a304,_0xa559('0x5d')),'headers':{'Authorization':util[_0xa559('0x5b')](_0xa559('0x5e'),new Buffer(util['format']('%s:X',_0x222dbb['apiKey']))['toString'](_0xa559('0x5f')))},'json':!![]});}})[_0xa559('0x23')](function(_0x2d69ee){if(_0x2d69ee){var _0xbf574=[_0xa559('0x60'),'subject',_0xa559('0x61'),_0xa559('0x62'),_0xa559('0x19'),_0xa559('0x63'),'group',_0xa559('0x64'),_0xa559('0x65'),_0xa559('0x66'),'company'];_[_0xa559('0x67')](_0x2d69ee,function(_0x4a2d47){return _0xbf574[_0xa559('0x68')](_0x4a2d47['name'])||!_0x4a2d47[_0xa559('0x69')]&&_0x4a2d47[_0xa559('0x2c')]!==_0xa559('0x6a')&&_0x4a2d47[_0xa559('0x2c')]!==_0xa559('0x6b');});return{'count':_0x2d69ee[_0xa559('0x36')],'rows':_[_0xa559('0x2f')](_0x2d69ee,function(_0x17d876){return{'id':_0x17d876[_0xa559('0x26')],'name':_0x17d876[_0xa559('0x6c')],'custom':!_0x17d876[_0xa559('0x69')],'options':_0x17d876['choices']?_[_0xa559('0x2f')](_0x17d876[_0xa559('0x6d')],function(_0x132deb){return{'name':_[_0xa559('0x6e')](_0x132deb),'value':_0x132deb};}):[]};})};}})['then'](respondWithResult(_0x9f5d26,null))[_0xa559('0x45')](function(_0x14408d){var _0x405e9d=_0xc26ee3[_0xa559('0x31')][_0xa559('0x6f')]?0x1f4:_0x14408d[_0xa559('0x70')]||0x1f4;logger[_0xa559('0x24')](_0xa559('0x71'),_0xa559('0x55'),_0x405e9d,JSON[_0xa559('0x72')](_0x14408d));delete _0x14408d['name'];if(_0x405e9d===0x191){_0x405e9d=0x190;}_0x9f5d26[_0xa559('0x19')](_0x405e9d)[_0xa559('0x27')](_0xc26ee3['query']['test']?{'message':_0xa559('0x73'),'statusCode':_0x14408d[_0xa559('0x70')]}:_0x14408d);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 72fecf4..e72fce8 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 _0xdfa7=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_freshdesk_accounts','lodash','util'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xdfa7,0x172));var _0x7dfa=function(_0x479623,_0x789c1d){_0x479623=_0x479623-0x0;var _0x778767=_0xdfa7[_0x479623];return _0x778767;};'use strict';var _=require(_0x7dfa('0x0'));var util=require(_0x7dfa('0x1'));var logger=require('../../config/logger')(_0x7dfa('0x2'));var moment=require(_0x7dfa('0x3'));var BPromise=require(_0x7dfa('0x4'));var rp=require(_0x7dfa('0x5'));var fs=require('fs');var path=require(_0x7dfa('0x6'));var rimraf=require(_0x7dfa('0x7'));var config=require(_0x7dfa('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x7dfa('0x9')]=function(_0x486935,_0x3bb86e){return _0x486935[_0x7dfa('0xa')]('FreshdeskAccount',attributes,{'tableName':_0x7dfa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x882d=['FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x295ded,_0x2f396c){var _0xce5a40=function(_0x1dc940){while(--_0x1dc940){_0x295ded['push'](_0x295ded['shift']());}};_0xce5a40(++_0x2f396c);}(_0x882d,0x1c9));var _0xd882=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x882d[_0x1f99a0];return _0x1e0849;};'use strict';var _=require('lodash');var util=require(_0xd882('0x0'));var logger=require(_0xd882('0x1'))(_0xd882('0x2'));var moment=require(_0xd882('0x3'));var BPromise=require(_0xd882('0x4'));var rp=require(_0xd882('0x5'));var fs=require('fs');var path=require(_0xd882('0x6'));var rimraf=require(_0xd882('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xd882('0x8'));module[_0xd882('0x9')]=function(_0x140fdd,_0x33b478){return _0x140fdd[_0xd882('0xa')](_0xd882('0xb'),attributes,{'tableName':_0xd882('0xc'),'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 3ccf8e3..40c52ee 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 _0x9964=['stringify','ShowFreshdeskAccount','find','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetFreshdeskAccount','debug'];(function(_0x3ca503,_0x12521a){var _0x4d0ac6=function(_0x2443b4){while(--_0x2443b4){_0x3ca503['push'](_0x3ca503['shift']());}};_0x4d0ac6(++_0x12521a);}(_0x9964,0x1d7));var _0x4996=function(_0x3df871,_0xda2e11){_0x3df871=_0x3df871-0x0;var _0x570f7b=_0x9964[_0x3df871];return _0x570f7b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4996('0x0'));var BPromise=require('bluebird');var rs=require(_0x4996('0x1'));var fs=require('fs');var Redis=require(_0x4996('0x2'));var db=require(_0x4996('0x3'))['db'];var utils=require(_0x4996('0x4'));var logger=require(_0x4996('0x5'))(_0x4996('0x6'));var config=require('../../config/environment');var jayson=require(_0x4996('0x7'));var client=jayson[_0x4996('0x8')][_0x4996('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x277c0f,_0x2f39a8,_0xa70ad5){return new BPromise(function(_0x10dba3,_0x3be4a6){return client[_0x4996('0xa')](_0x277c0f,_0xa70ad5)[_0x4996('0xb')](function(_0x5cbdfd){logger[_0x4996('0xc')](_0x4996('0xd'),_0x2f39a8,_0x4996('0xe'));logger['debug'](_0x4996('0xf'),_0x2f39a8,_0x4996('0xe'),JSON['stringify'](_0x5cbdfd));if(_0x5cbdfd[_0x4996('0x10')]){if(_0x5cbdfd['error'][_0x4996('0x11')]===0x1f4){logger['error'](_0x4996('0xd'),_0x2f39a8,_0x5cbdfd[_0x4996('0x10')]['message']);return _0x3be4a6(_0x5cbdfd['error'][_0x4996('0x12')]);}logger[_0x4996('0x10')](_0x4996('0xd'),_0x2f39a8,_0x5cbdfd[_0x4996('0x10')][_0x4996('0x12')]);return _0x10dba3(_0x5cbdfd[_0x4996('0x10')][_0x4996('0x12')]);}else{logger['info'](_0x4996('0xd'),_0x2f39a8,_0x4996('0xe'));_0x10dba3(_0x5cbdfd[_0x4996('0x13')][_0x4996('0x12')]);}})[_0x4996('0x14')](function(_0x8a7f99){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x2f39a8,_0x8a7f99);_0x3be4a6(_0x8a7f99);});});}exports['GetFreshdeskAccount']=function(_0xc92b95){var _0x452b61=this;return new Promise(function(_0x45e169,_0x473dcf){return db[_0x4996('0x15')][_0x4996('0x16')]({'raw':_0xc92b95[_0x4996('0x17')]?_0xc92b95[_0x4996('0x17')][_0x4996('0x18')]===undefined?!![]:![]:!![],'where':_0xc92b95[_0x4996('0x17')]?_0xc92b95[_0x4996('0x17')][_0x4996('0x19')]||null:null,'attributes':_0xc92b95[_0x4996('0x17')]?_0xc92b95['options'][_0x4996('0x1a')]||null:null,'limit':_0xc92b95[_0x4996('0x17')]?_0xc92b95[_0x4996('0x17')][_0x4996('0x1b')]||null:null,'include':_0xc92b95[_0x4996('0x17')]?_0xc92b95[_0x4996('0x17')][_0x4996('0x1c')]?_['map'](_0xc92b95[_0x4996('0x17')][_0x4996('0x1c')],function(_0x417311){return{'model':db[_0x417311[_0x4996('0x1d')]],'as':_0x417311['as'],'attributes':_0x417311['attributes'],'include':_0x417311[_0x4996('0x1c')]?_['map'](_0x417311[_0x4996('0x1c')],function(_0x4f0d46){return{'model':db[_0x4f0d46[_0x4996('0x1d')]],'as':_0x4f0d46['as'],'attributes':_0x4f0d46[_0x4996('0x1a')],'include':_0x4f0d46[_0x4996('0x1c')]?_[_0x4996('0x1e')](_0x4f0d46[_0x4996('0x1c')],function(_0x3d0555){return{'model':db[_0x3d0555[_0x4996('0x1d')]],'as':_0x3d0555['as'],'attributes':_0x3d0555[_0x4996('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1def9e){logger['info'](_0x4996('0x1f'),_0xc92b95);logger[_0x4996('0x20')](_0x4996('0x1f'),_0xc92b95,JSON[_0x4996('0x21')](_0x1def9e));_0x45e169(_0x1def9e);})[_0x4996('0x14')](function(_0x1e9a3f){logger['error'](_0x4996('0x1f'),_0x1e9a3f[_0x4996('0x12')],_0xc92b95);_0x473dcf(_0x452b61['error'](0x1f4,_0x1e9a3f[_0x4996('0x12')]));});});};exports[_0x4996('0x22')]=function(_0x1e8256){var _0x38e7ce=this;return new Promise(function(_0xf02a3e,_0x4cb9c4){return db[_0x4996('0x15')][_0x4996('0x23')]({'raw':_0x1e8256[_0x4996('0x17')]?_0x1e8256[_0x4996('0x17')][_0x4996('0x18')]===undefined?!![]:![]:!![],'where':_0x1e8256[_0x4996('0x17')]?_0x1e8256[_0x4996('0x17')][_0x4996('0x19')]||null:null,'attributes':_0x1e8256['options']?_0x1e8256[_0x4996('0x17')][_0x4996('0x1a')]||null:null,'include':_0x1e8256[_0x4996('0x17')]?_0x1e8256[_0x4996('0x17')][_0x4996('0x1c')]?_[_0x4996('0x1e')](_0x1e8256[_0x4996('0x17')][_0x4996('0x1c')],function(_0x58ec62){return{'model':db[_0x58ec62[_0x4996('0x1d')]],'as':_0x58ec62['as'],'attributes':_0x58ec62[_0x4996('0x1a')],'include':_0x58ec62[_0x4996('0x1c')]?_[_0x4996('0x1e')](_0x58ec62[_0x4996('0x1c')],function(_0x5cb5dc){return{'model':db[_0x5cb5dc[_0x4996('0x1d')]],'as':_0x5cb5dc['as'],'attributes':_0x5cb5dc[_0x4996('0x1a')],'include':_0x5cb5dc['include']?_[_0x4996('0x1e')](_0x5cb5dc['include'],function(_0x28ceb2){return{'model':db[_0x28ceb2[_0x4996('0x1d')]],'as':_0x28ceb2['as'],'attributes':_0x28ceb2['attributes']};}):[]};}):[]};}):[]:[]})[_0x4996('0xb')](function(_0x597613){logger[_0x4996('0xc')](_0x4996('0x22'),_0x1e8256);logger[_0x4996('0x20')](_0x4996('0x22'),_0x1e8256,JSON[_0x4996('0x21')](_0x597613));_0xf02a3e(_0x597613);})[_0x4996('0x14')](function(_0x242279){logger[_0x4996('0x10')](_0x4996('0x22'),_0x242279['message'],_0x1e8256);_0x4cb9c4(_0x38e7ce['error'](0x1f4,_0x242279[_0x4996('0x12')]));});});}; \ No newline at end of file +var _0x691a=['client','request','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','include','map','model','then','stringify','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4512bf,_0xbf58be){var _0x663272=function(_0x30defe){while(--_0x30defe){_0x4512bf['push'](_0x4512bf['shift']());}};_0x663272(++_0xbf58be);}(_0x691a,0x1df));var _0xa691=function(_0x1e2764,_0x14d808){_0x1e2764=_0x1e2764-0x0;var _0xb0085d=_0x691a[_0x1e2764];return _0xb0085d;};'use strict';var _=require(_0xa691('0x0'));var util=require(_0xa691('0x1'));var moment=require(_0xa691('0x2'));var BPromise=require(_0xa691('0x3'));var rs=require(_0xa691('0x4'));var fs=require('fs');var Redis=require(_0xa691('0x5'));var db=require(_0xa691('0x6'))['db'];var utils=require(_0xa691('0x7'));var logger=require(_0xa691('0x8'))(_0xa691('0x9'));var config=require('../../config/environment');var jayson=require(_0xa691('0xa'));var client=jayson[_0xa691('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x173d1d,_0x5c53a0,_0x450b9d){return new BPromise(function(_0x91da2f,_0x1ad63c){return client[_0xa691('0xc')](_0x173d1d,_0x450b9d)['then'](function(_0xd24630){logger[_0xa691('0xd')](_0xa691('0xe'),_0x5c53a0,'request\x20sent');logger[_0xa691('0xf')](_0xa691('0x10'),_0x5c53a0,_0xa691('0x11'),JSON['stringify'](_0xd24630));if(_0xd24630[_0xa691('0x12')]){if(_0xd24630['error'][_0xa691('0x13')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x5c53a0,_0xd24630['error'][_0xa691('0x14')]);return _0x1ad63c(_0xd24630[_0xa691('0x12')][_0xa691('0x14')]);}logger[_0xa691('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x5c53a0,_0xd24630[_0xa691('0x12')][_0xa691('0x14')]);return _0x91da2f(_0xd24630[_0xa691('0x12')][_0xa691('0x14')]);}else{logger['info'](_0xa691('0xe'),_0x5c53a0,_0xa691('0x11'));_0x91da2f(_0xd24630['result'][_0xa691('0x14')]);}})[_0xa691('0x15')](function(_0x394841){logger[_0xa691('0x12')](_0xa691('0xe'),_0x5c53a0,_0x394841);_0x1ad63c(_0x394841);});});}exports[_0xa691('0x16')]=function(_0x3b3b2d){var _0x1def30=this;return new Promise(function(_0x25da7a,_0x42dd21){return db[_0xa691('0x17')]['findAll']({'raw':_0x3b3b2d['options']?_0x3b3b2d[_0xa691('0x18')][_0xa691('0x19')]===undefined?!![]:![]:!![],'where':_0x3b3b2d[_0xa691('0x18')]?_0x3b3b2d[_0xa691('0x18')][_0xa691('0x1a')]||null:null,'attributes':_0x3b3b2d[_0xa691('0x18')]?_0x3b3b2d['options'][_0xa691('0x1b')]||null:null,'limit':_0x3b3b2d[_0xa691('0x18')]?_0x3b3b2d['options']['limit']||null:null,'include':_0x3b3b2d[_0xa691('0x18')]?_0x3b3b2d['options'][_0xa691('0x1c')]?_[_0xa691('0x1d')](_0x3b3b2d[_0xa691('0x18')][_0xa691('0x1c')],function(_0x1633af){return{'model':db[_0x1633af[_0xa691('0x1e')]],'as':_0x1633af['as'],'attributes':_0x1633af[_0xa691('0x1b')],'include':_0x1633af[_0xa691('0x1c')]?_[_0xa691('0x1d')](_0x1633af[_0xa691('0x1c')],function(_0x25b92c){return{'model':db[_0x25b92c[_0xa691('0x1e')]],'as':_0x25b92c['as'],'attributes':_0x25b92c[_0xa691('0x1b')],'include':_0x25b92c['include']?_[_0xa691('0x1d')](_0x25b92c[_0xa691('0x1c')],function(_0x40569f){return{'model':db[_0x40569f['model']],'as':_0x40569f['as'],'attributes':_0x40569f[_0xa691('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa691('0x1f')](function(_0x34b819){logger[_0xa691('0xd')]('GetFreshdeskAccount',_0x3b3b2d);logger[_0xa691('0xf')](_0xa691('0x16'),_0x3b3b2d,JSON[_0xa691('0x20')](_0x34b819));_0x25da7a(_0x34b819);})[_0xa691('0x15')](function(_0x441630){logger[_0xa691('0x12')](_0xa691('0x16'),_0x441630[_0xa691('0x14')],_0x3b3b2d);_0x42dd21(_0x1def30['error'](0x1f4,_0x441630[_0xa691('0x14')]));});});};exports[_0xa691('0x21')]=function(_0x244b21){var _0x235381=this;return new Promise(function(_0x21b2cb,_0x3a453a){return db[_0xa691('0x17')][_0xa691('0x22')]({'raw':_0x244b21['options']?_0x244b21[_0xa691('0x18')][_0xa691('0x19')]===undefined?!![]:![]:!![],'where':_0x244b21[_0xa691('0x18')]?_0x244b21[_0xa691('0x18')][_0xa691('0x1a')]||null:null,'attributes':_0x244b21[_0xa691('0x18')]?_0x244b21['options'][_0xa691('0x1b')]||null:null,'include':_0x244b21[_0xa691('0x18')]?_0x244b21[_0xa691('0x18')][_0xa691('0x1c')]?_[_0xa691('0x1d')](_0x244b21['options'][_0xa691('0x1c')],function(_0x130ad9){return{'model':db[_0x130ad9[_0xa691('0x1e')]],'as':_0x130ad9['as'],'attributes':_0x130ad9[_0xa691('0x1b')],'include':_0x130ad9['include']?_[_0xa691('0x1d')](_0x130ad9[_0xa691('0x1c')],function(_0x3d2b46){return{'model':db[_0x3d2b46[_0xa691('0x1e')]],'as':_0x3d2b46['as'],'attributes':_0x3d2b46[_0xa691('0x1b')],'include':_0x3d2b46['include']?_[_0xa691('0x1d')](_0x3d2b46[_0xa691('0x1c')],function(_0x3d4e2a){return{'model':db[_0x3d4e2a[_0xa691('0x1e')]],'as':_0x3d4e2a['as'],'attributes':_0x3d4e2a[_0xa691('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa691('0x1f')](function(_0x36c6c5){logger['info']('ShowFreshdeskAccount',_0x244b21);logger['debug'](_0xa691('0x21'),_0x244b21,JSON['stringify'](_0x36c6c5));_0x21b2cb(_0x36c6c5);})[_0xa691('0x15')](function(_0x213e8a){logger['error']('ShowFreshdeskAccount',_0x213e8a[_0xa691('0x14')],_0x244b21);_0x3a453a(_0x235381[_0xa691('0x12')](0x1f4,_0x213e8a[_0xa691('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index f85a085..02cbb21 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 _0x3840=['post','/:id/tags','setTags','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3840,0x155));var _0x0384=function(_0xffc72b,_0x8ed570){_0xffc72b=_0xffc72b-0x0;var _0x25d195=_0x3840[_0xffc72b];return _0x25d195;};'use strict';var multer=require(_0x0384('0x0'));var util=require(_0x0384('0x1'));var path=require(_0x0384('0x2'));var timeout=require(_0x0384('0x3'));var express=require(_0x0384('0x4'));var router=express[_0x0384('0x5')]();var fs_extra=require(_0x0384('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0384('0x7'));var config=require(_0x0384('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x0384('0x9')]('/',auth[_0x0384('0xa')](),controller['index']);router[_0x0384('0x9')](_0x0384('0xb'),auth[_0x0384('0xa')](),controller['show']);router['get'](_0x0384('0xc'),auth[_0x0384('0xa')](),controller['getFields']);router['get'](_0x0384('0xd'),auth['isAuthenticated'](),controller[_0x0384('0xe')]);router[_0x0384('0x9')](_0x0384('0xf'),auth[_0x0384('0xa')](),controller[_0x0384('0x10')]);router[_0x0384('0x9')]('/:id/tags',auth[_0x0384('0xa')](),controller[_0x0384('0x11')]);router['post']('/',auth[_0x0384('0xa')](),controller[_0x0384('0x12')]);router[_0x0384('0x13')](_0x0384('0x14'),auth[_0x0384('0xa')](),controller[_0x0384('0x15')]);router[_0x0384('0x16')](_0x0384('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0384('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd5d2=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags','getTags','create','setTags','put','update'];(function(_0x19a57d,_0x5b1be5){var _0x4c7636=function(_0x5485b5){while(--_0x5485b5){_0x19a57d['push'](_0x19a57d['shift']());}};_0x4c7636(++_0x5b1be5);}(_0xd5d2,0x110));var _0x2d5d=function(_0x2a6a46,_0x36aa81){_0x2a6a46=_0x2a6a46-0x0;var _0xaf0836=_0xd5d2[_0x2a6a46];return _0xaf0836;};'use strict';var multer=require(_0x2d5d('0x0'));var util=require(_0x2d5d('0x1'));var path=require(_0x2d5d('0x2'));var timeout=require(_0x2d5d('0x3'));var express=require(_0x2d5d('0x4'));var router=express[_0x2d5d('0x5')]();var fs_extra=require(_0x2d5d('0x6'));var auth=require(_0x2d5d('0x7'));var interaction=require(_0x2d5d('0x8'));var config=require(_0x2d5d('0x9'));var controller=require(_0x2d5d('0xa'));router[_0x2d5d('0xb')]('/',auth[_0x2d5d('0xc')](),controller[_0x2d5d('0xd')]);router[_0x2d5d('0xb')](_0x2d5d('0xe'),auth['isAuthenticated'](),controller[_0x2d5d('0xf')]);router[_0x2d5d('0xb')](_0x2d5d('0x10'),auth[_0x2d5d('0xc')](),controller['getFields']);router[_0x2d5d('0xb')]('/:id/subjects',auth[_0x2d5d('0xc')](),controller[_0x2d5d('0x11')]);router[_0x2d5d('0xb')](_0x2d5d('0x12'),auth[_0x2d5d('0xc')](),controller['getDescriptions']);router[_0x2d5d('0xb')](_0x2d5d('0x13'),auth['isAuthenticated'](),controller[_0x2d5d('0x14')]);router['post']('/',auth[_0x2d5d('0xc')](),controller[_0x2d5d('0x15')]);router['post'](_0x2d5d('0x13'),auth['isAuthenticated'](),controller[_0x2d5d('0x16')]);router[_0x2d5d('0x17')](_0x2d5d('0xe'),auth[_0x2d5d('0xc')](),controller[_0x2d5d('0x18')]);router[_0x2d5d('0x19')](_0x2d5d('0xe'),auth[_0x2d5d('0xc')](),controller[_0x2d5d('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index f5d8851..268d9e0 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 _0x6479=['exports','STRING','sequelize'];(function(_0x9e31e0,_0x51a678){var _0x46a76d=function(_0x363db8){while(--_0x363db8){_0x9e31e0['push'](_0x9e31e0['shift']());}};_0x46a76d(++_0x51a678);}(_0x6479,0x71));var _0x9647=function(_0x4b19e3,_0x2b63c3){_0x4b19e3=_0x4b19e3-0x0;var _0x2ce22a=_0x6479[_0x4b19e3];return _0x2ce22a;};'use strict';var Sequelize=require(_0x9647('0x0'));module[_0x9647('0x1')]={'name':{'type':Sequelize[_0x9647('0x2')]},'description':{'type':Sequelize[_0x9647('0x2')]}}; \ No newline at end of file +var _0x676b=['STRING','sequelize','exports'];(function(_0x3d9377,_0x4c602a){var _0x3e6b85=function(_0x4001d2){while(--_0x4001d2){_0x3d9377['push'](_0x3d9377['shift']());}};_0x3e6b85(++_0x4c602a);}(_0x676b,0x1d2));var _0xb676=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0x676b[_0x178856];return _0x3c7fe7;};'use strict';var Sequelize=require(_0xb676('0x0'));module[_0xb676('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb676('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index bc4c6f9..4eb2e87 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 _0xb1be=['path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','sendStatus','status','end','json','limit','undefined','count','Content-Range','reject','save','update','then','error','stack','index','map','FreshdeskConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','pick','where','VIRTUAL','name','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','destroy','getFields','findOne','FreshdeskField','rawAttributes','filter','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x407de4,_0x39b031){var _0x49b3a5=function(_0x10ea52){while(--_0x10ea52){_0x407de4['push'](_0x407de4['shift']());}};_0x49b3a5(++_0x39b031);}(_0xb1be,0x139));var _0xeb1b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb1be[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xeb1b('0x0'));var rimraf=require(_0xeb1b('0x1'));var zipdir=require(_0xeb1b('0x2'));var jsonpatch=require(_0xeb1b('0x3'));var rp=require(_0xeb1b('0x4'));var moment=require(_0xeb1b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xeb1b('0x6'));var util=require('util');var path=require(_0xeb1b('0x7'));var sox=require(_0xeb1b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb1b('0x9'));var _=require(_0xeb1b('0xa'));var squel=require(_0xeb1b('0xb'));var crypto=require(_0xeb1b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xeb1b('0xd'));var toCsv=require(_0xeb1b('0xe'));var querystring=require(_0xeb1b('0xf'));var Papa=require(_0xeb1b('0x10'));var Redis=require(_0xeb1b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xeb1b('0x12'));var as=require(_0xeb1b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x368980,_0x410934){_0x410934=_0x410934||0xcc;return function(_0x15d72d){if(_0x15d72d){return _0x368980[_0xeb1b('0x14')](_0x410934);}return _0x368980[_0xeb1b('0x15')](_0x410934)[_0xeb1b('0x16')]();};}function respondWithResult(_0x5619e4,_0x3043c6){_0x3043c6=_0x3043c6||0xc8;return function(_0x4c6d35){if(_0x4c6d35){return _0x5619e4['status'](_0x3043c6)[_0xeb1b('0x17')](_0x4c6d35);}};}function respondWithFilteredResult(_0x162bae,_0xae4ee0){return function(_0x20b827){if(_0x20b827){var _0x1a4606=typeof _0xae4ee0['offset']==='undefined'&&typeof _0xae4ee0[_0xeb1b('0x18')]===_0xeb1b('0x19');var _0x451159=_0x20b827[_0xeb1b('0x1a')];var _0x2da777=_0x1a4606?0x0:_0xae4ee0['offset'];var _0xaa721=_0x1a4606?_0x20b827['count']:_0xae4ee0['offset']+_0xae4ee0[_0xeb1b('0x18')];var _0x316af4;if(_0xaa721>=_0x451159){_0xaa721=_0x451159;_0x316af4=0xc8;}else{_0x316af4=0xce;}_0x162bae[_0xeb1b('0x15')](_0x316af4);return _0x162bae['set'](_0xeb1b('0x1b'),_0x2da777+'-'+_0xaa721+'/'+_0x451159)[_0xeb1b('0x17')](_0x20b827);}return null;};}function patchUpdates(_0x26f312){return function(_0x432c1a){try{jsonpatch['apply'](_0x432c1a,_0x26f312,!![]);}catch(_0x1ec6b7){return BPromise[_0xeb1b('0x1c')](_0x1ec6b7);}return _0x432c1a[_0xeb1b('0x1d')]();};}function saveUpdates(_0x391c80,_0x1d33c6){return function(_0x3bb13e){if(_0x3bb13e){return _0x3bb13e[_0xeb1b('0x1e')](_0x391c80)[_0xeb1b('0x1f')](function(_0x3ea891){return _0x3ea891;});}return null;};}function removeEntity(_0x22a017,_0xf2d959){return function(_0x25e858){if(_0x25e858){return _0x25e858['destroy']()['then'](function(){_0x22a017['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x37eda7,_0xa0fb79){return function(_0x572eb8){if(!_0x572eb8){_0x37eda7[_0xeb1b('0x14')](0x194);}return _0x572eb8;};}function handleError(_0x2719ec,_0x56b8e4){_0x56b8e4=_0x56b8e4||0x1f4;return function(_0x2f664b){logger[_0xeb1b('0x20')](_0x2f664b[_0xeb1b('0x21')]);if(_0x2f664b['name']){delete _0x2f664b['name'];}_0x2719ec[_0xeb1b('0x15')](_0x56b8e4)['send'](_0x2f664b);};}exports[_0xeb1b('0x22')]=function(_0x59001b,_0x1653d2){var _0x195a5b={},_0x437b5f={},_0x596fb1={'count':0x0,'rows':[]};var _0x324bb4=_[_0xeb1b('0x23')](db[_0xeb1b('0x24')]['rawAttributes'],function(_0x18714f){return{'name':_0x18714f[_0xeb1b('0x25')],'type':_0x18714f[_0xeb1b('0x26')][_0xeb1b('0x27')]};});_0x437b5f[_0xeb1b('0x28')]=_['map'](_0x324bb4,'name');_0x437b5f[_0xeb1b('0x29')]=_[_0xeb1b('0x2a')](_0x59001b[_0xeb1b('0x29')]);_0x437b5f[_0xeb1b('0x2b')]=_[_0xeb1b('0x2c')](_0x437b5f[_0xeb1b('0x28')],_0x437b5f[_0xeb1b('0x29')]);_0x195a5b[_0xeb1b('0x2d')]=_[_0xeb1b('0x2c')](_0x437b5f['model'],qs[_0xeb1b('0x2e')](_0x59001b['query'][_0xeb1b('0x2e')]));_0x195a5b[_0xeb1b('0x2d')]=_0x195a5b[_0xeb1b('0x2d')][_0xeb1b('0x2f')]?_0x195a5b[_0xeb1b('0x2d')]:_0x437b5f[_0xeb1b('0x28')];if(!_0x59001b[_0xeb1b('0x29')][_0xeb1b('0x30')]('nolimit')){_0x195a5b[_0xeb1b('0x18')]=qs[_0xeb1b('0x18')](_0x59001b[_0xeb1b('0x29')][_0xeb1b('0x18')]);_0x195a5b[_0xeb1b('0x31')]=qs[_0xeb1b('0x31')](_0x59001b[_0xeb1b('0x29')]['offset']);}_0x195a5b[_0xeb1b('0x32')]=qs[_0xeb1b('0x33')](_0x59001b['query'][_0xeb1b('0x33')]);_0x195a5b['where']=qs['filters'](_[_0xeb1b('0x34')](_0x59001b[_0xeb1b('0x29')],_0x437b5f[_0xeb1b('0x2b')]),_0x324bb4);if(_0x59001b[_0xeb1b('0x29')]['filter']){_0x195a5b[_0xeb1b('0x35')]=_['merge'](_0x195a5b[_0xeb1b('0x35')],{'$or':_['map'](_0x324bb4,function(_0x506945){if(_0x506945['type']!==_0xeb1b('0x36')){var _0x5bc629={};_0x5bc629[_0x506945[_0xeb1b('0x37')]]={'$like':'%'+_0x59001b[_0xeb1b('0x29')]['filter']+'%'};return _0x5bc629;}})});}_0x195a5b=_[_0xeb1b('0x38')]({},_0x195a5b,_0x59001b[_0xeb1b('0x39')]);var _0x576547={'where':_0x195a5b['where']};return db[_0xeb1b('0x24')][_0xeb1b('0x1a')](_0x576547)[_0xeb1b('0x1f')](function(_0x398705){_0x596fb1[_0xeb1b('0x1a')]=_0x398705;if(_0x59001b['query'][_0xeb1b('0x3a')]){_0x195a5b[_0xeb1b('0x3b')]=[{'all':!![]}];}return db[_0xeb1b('0x24')][_0xeb1b('0x3c')](_0x195a5b);})[_0xeb1b('0x1f')](function(_0x3c09cb){_0x596fb1[_0xeb1b('0x3d')]=_0x3c09cb;return _0x596fb1;})[_0xeb1b('0x1f')](respondWithFilteredResult(_0x1653d2,_0x195a5b))['catch'](handleError(_0x1653d2,null));};exports['show']=function(_0x34e26f,_0x576a97){var _0x53166e={'raw':![],'where':{'id':_0x34e26f[_0xeb1b('0x3e')]['id']}},_0x1e5e13={};_0x1e5e13[_0xeb1b('0x28')]=_['keys'](db[_0xeb1b('0x24')]['rawAttributes']);_0x1e5e13[_0xeb1b('0x29')]=_[_0xeb1b('0x2a')](_0x34e26f[_0xeb1b('0x29')]);_0x1e5e13[_0xeb1b('0x2b')]=_[_0xeb1b('0x2c')](_0x1e5e13[_0xeb1b('0x28')],_0x1e5e13['query']);_0x53166e[_0xeb1b('0x2d')]=_[_0xeb1b('0x2c')](_0x1e5e13[_0xeb1b('0x28')],qs[_0xeb1b('0x2e')](_0x34e26f[_0xeb1b('0x29')][_0xeb1b('0x2e')]));_0x53166e['attributes']=_0x53166e[_0xeb1b('0x2d')][_0xeb1b('0x2f')]?_0x53166e[_0xeb1b('0x2d')]:_0x1e5e13[_0xeb1b('0x28')];if(_0x34e26f[_0xeb1b('0x29')][_0xeb1b('0x3a')]){_0x53166e[_0xeb1b('0x3b')]=[{'all':!![]}];}_0x53166e=_[_0xeb1b('0x38')]({},_0x53166e,_0x34e26f[_0xeb1b('0x39')]);return db[_0xeb1b('0x24')][_0xeb1b('0x3f')](_0x53166e)[_0xeb1b('0x1f')](handleEntityNotFound(_0x576a97,null))[_0xeb1b('0x1f')](respondWithResult(_0x576a97,null))[_0xeb1b('0x40')](handleError(_0x576a97,null));};exports[_0xeb1b('0x41')]=function(_0x1eb900,_0x3bd09b){return db[_0xeb1b('0x24')][_0xeb1b('0x41')](_0x1eb900[_0xeb1b('0x42')],{})[_0xeb1b('0x1f')](respondWithResult(_0x3bd09b,0xc9))[_0xeb1b('0x40')](handleError(_0x3bd09b,null));};exports['update']=function(_0x4fe562,_0x586635){if(_0x4fe562[_0xeb1b('0x42')]['id']){delete _0x4fe562[_0xeb1b('0x42')]['id'];}return db[_0xeb1b('0x24')][_0xeb1b('0x3f')]({'where':{'id':_0x4fe562[_0xeb1b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x586635,null))[_0xeb1b('0x1f')](saveUpdates(_0x4fe562[_0xeb1b('0x42')],null))[_0xeb1b('0x1f')](respondWithResult(_0x586635,null))[_0xeb1b('0x40')](handleError(_0x586635,null));};exports[_0xeb1b('0x43')]=function(_0x34b492,_0x4db56e){return db[_0xeb1b('0x24')][_0xeb1b('0x3f')]({'where':{'id':_0x34b492['params']['id']}})[_0xeb1b('0x1f')](handleEntityNotFound(_0x4db56e,null))[_0xeb1b('0x1f')](removeEntity(_0x4db56e,null))['catch'](handleError(_0x4db56e,null));};exports[_0xeb1b('0x44')]=function(_0x10fbb3,_0xdd9b9e,_0x4e6215){var _0x3f892b={};var _0x11b2dd={};var _0xfd9943;var _0x1e0778;return db['FreshdeskConfiguration'][_0xeb1b('0x45')]({'where':{'id':_0x10fbb3[_0xeb1b('0x3e')]['id']}})[_0xeb1b('0x1f')](handleEntityNotFound(_0xdd9b9e,null))[_0xeb1b('0x1f')](function(_0x341fc6){if(_0x341fc6){_0xfd9943=_0x341fc6;_0x11b2dd[_0xeb1b('0x28')]=_[_0xeb1b('0x2a')](db[_0xeb1b('0x46')][_0xeb1b('0x47')]);_0x11b2dd[_0xeb1b('0x29')]=_['keys'](_0x10fbb3[_0xeb1b('0x29')]);_0x11b2dd[_0xeb1b('0x2b')]=_[_0xeb1b('0x2c')](_0x11b2dd[_0xeb1b('0x28')],_0x11b2dd[_0xeb1b('0x29')]);_0x3f892b[_0xeb1b('0x2d')]=_[_0xeb1b('0x2c')](_0x11b2dd[_0xeb1b('0x28')],qs[_0xeb1b('0x2e')](_0x10fbb3[_0xeb1b('0x29')][_0xeb1b('0x2e')]));_0x3f892b[_0xeb1b('0x2d')]=_0x3f892b[_0xeb1b('0x2d')][_0xeb1b('0x2f')]?_0x3f892b[_0xeb1b('0x2d')]:_0x11b2dd['model'];_0x3f892b[_0xeb1b('0x32')]=qs[_0xeb1b('0x33')](_0x10fbb3['query'][_0xeb1b('0x33')]);_0x3f892b['where']=qs['filters'](_['pick'](_0x10fbb3[_0xeb1b('0x29')],_0x11b2dd[_0xeb1b('0x2b')]));if(_0x10fbb3['query'][_0xeb1b('0x48')]){_0x3f892b[_0xeb1b('0x35')]=_['merge'](_0x3f892b[_0xeb1b('0x35')],{'$or':_[_0xeb1b('0x23')](_0x3f892b['attributes'],function(_0x28f240){var _0x15907e={};_0x15907e[_0x28f240]={'$like':'%'+_0x10fbb3[_0xeb1b('0x29')]['filter']+'%'};return _0x15907e;})});}_0x3f892b=_[_0xeb1b('0x38')]({},_0x3f892b,_0x10fbb3[_0xeb1b('0x39')]);return _0xfd9943[_0xeb1b('0x44')](_0x3f892b);}})['then'](function(_0x33805a){if(_0x33805a){_0x1e0778=_0x33805a['length'];if(!_0x10fbb3[_0xeb1b('0x29')][_0xeb1b('0x30')](_0xeb1b('0x49'))){_0x3f892b[_0xeb1b('0x18')]=qs[_0xeb1b('0x18')](_0x10fbb3[_0xeb1b('0x29')]['limit']);_0x3f892b[_0xeb1b('0x31')]=qs['offset'](_0x10fbb3[_0xeb1b('0x29')][_0xeb1b('0x31')]);}return _0xfd9943['getFields'](_0x3f892b);}})[_0xeb1b('0x1f')](function(_0x2ec47c){if(_0x2ec47c){return _0x2ec47c?{'count':_0x1e0778,'rows':_0x2ec47c}:null;}})[_0xeb1b('0x1f')](respondWithResult(_0xdd9b9e,null))[_0xeb1b('0x40')](handleError(_0xdd9b9e,null));};exports[_0xeb1b('0x4a')]=function(_0x4641d1,_0xb723c9,_0x3e64ce){var _0x16beb9={};var _0x2b0b41={};var _0x8c8075;var _0x213d03;return db[_0xeb1b('0x24')][_0xeb1b('0x45')]({'where':{'id':_0x4641d1['params']['id']}})[_0xeb1b('0x1f')](handleEntityNotFound(_0xb723c9,null))[_0xeb1b('0x1f')](function(_0x1002d4){if(_0x1002d4){_0x8c8075=_0x1002d4;_0x2b0b41[_0xeb1b('0x28')]=_[_0xeb1b('0x2a')](db[_0xeb1b('0x46')][_0xeb1b('0x47')]);_0x2b0b41['query']=_[_0xeb1b('0x2a')](_0x4641d1[_0xeb1b('0x29')]);_0x2b0b41[_0xeb1b('0x2b')]=_['intersection'](_0x2b0b41[_0xeb1b('0x28')],_0x2b0b41[_0xeb1b('0x29')]);_0x16beb9[_0xeb1b('0x2d')]=_[_0xeb1b('0x2c')](_0x2b0b41[_0xeb1b('0x28')],qs[_0xeb1b('0x2e')](_0x4641d1[_0xeb1b('0x29')][_0xeb1b('0x2e')]));_0x16beb9[_0xeb1b('0x2d')]=_0x16beb9[_0xeb1b('0x2d')]['length']?_0x16beb9['attributes']:_0x2b0b41[_0xeb1b('0x28')];_0x16beb9[_0xeb1b('0x32')]=qs[_0xeb1b('0x33')](_0x4641d1[_0xeb1b('0x29')]['sort']);_0x16beb9[_0xeb1b('0x35')]=qs[_0xeb1b('0x2b')](_['pick'](_0x4641d1[_0xeb1b('0x29')],_0x2b0b41['filters']));if(_0x4641d1[_0xeb1b('0x29')]['filter']){_0x16beb9['where']=_[_0xeb1b('0x38')](_0x16beb9[_0xeb1b('0x35')],{'$or':_[_0xeb1b('0x23')](_0x16beb9[_0xeb1b('0x2d')],function(_0x1c2e27){var _0xa8bed7={};_0xa8bed7[_0x1c2e27]={'$like':'%'+_0x4641d1['query']['filter']+'%'};return _0xa8bed7;})});}_0x16beb9=_[_0xeb1b('0x38')]({},_0x16beb9,_0x4641d1[_0xeb1b('0x39')]);return _0x8c8075['getSubjects'](_0x16beb9);}})[_0xeb1b('0x1f')](function(_0x561ee9){if(_0x561ee9){_0x213d03=_0x561ee9['length'];if(!_0x4641d1[_0xeb1b('0x29')]['hasOwnProperty']('nolimit')){_0x16beb9[_0xeb1b('0x18')]=qs[_0xeb1b('0x18')](_0x4641d1[_0xeb1b('0x29')][_0xeb1b('0x18')]);_0x16beb9[_0xeb1b('0x31')]=qs[_0xeb1b('0x31')](_0x4641d1[_0xeb1b('0x29')][_0xeb1b('0x31')]);}return _0x8c8075[_0xeb1b('0x4a')](_0x16beb9);}})[_0xeb1b('0x1f')](function(_0x204473){if(_0x204473){return _0x204473?{'count':_0x213d03,'rows':_0x204473}:null;}})[_0xeb1b('0x1f')](respondWithResult(_0xb723c9,null))[_0xeb1b('0x40')](handleError(_0xb723c9,null));};exports[_0xeb1b('0x4b')]=function(_0x3ce9c5,_0x4de5ac,_0x458589){var _0x2b4126={};var _0x42d8b9={};var _0x30f83e;var _0x1cffd0;return db[_0xeb1b('0x24')][_0xeb1b('0x45')]({'where':{'id':_0x3ce9c5[_0xeb1b('0x3e')]['id']}})[_0xeb1b('0x1f')](handleEntityNotFound(_0x4de5ac,null))['then'](function(_0x4db2bd){if(_0x4db2bd){_0x30f83e=_0x4db2bd;_0x42d8b9['model']=_[_0xeb1b('0x2a')](db[_0xeb1b('0x46')]['rawAttributes']);_0x42d8b9[_0xeb1b('0x29')]=_[_0xeb1b('0x2a')](_0x3ce9c5[_0xeb1b('0x29')]);_0x42d8b9[_0xeb1b('0x2b')]=_[_0xeb1b('0x2c')](_0x42d8b9[_0xeb1b('0x28')],_0x42d8b9[_0xeb1b('0x29')]);_0x2b4126[_0xeb1b('0x2d')]=_[_0xeb1b('0x2c')](_0x42d8b9['model'],qs[_0xeb1b('0x2e')](_0x3ce9c5[_0xeb1b('0x29')][_0xeb1b('0x2e')]));_0x2b4126[_0xeb1b('0x2d')]=_0x2b4126['attributes'][_0xeb1b('0x2f')]?_0x2b4126[_0xeb1b('0x2d')]:_0x42d8b9[_0xeb1b('0x28')];_0x2b4126['order']=qs[_0xeb1b('0x33')](_0x3ce9c5[_0xeb1b('0x29')]['sort']);_0x2b4126[_0xeb1b('0x35')]=qs[_0xeb1b('0x2b')](_['pick'](_0x3ce9c5[_0xeb1b('0x29')],_0x42d8b9['filters']));if(_0x3ce9c5[_0xeb1b('0x29')][_0xeb1b('0x48')]){_0x2b4126['where']=_[_0xeb1b('0x38')](_0x2b4126[_0xeb1b('0x35')],{'$or':_[_0xeb1b('0x23')](_0x2b4126[_0xeb1b('0x2d')],function(_0x46aaf2){var _0x4b6ba4={};_0x4b6ba4[_0x46aaf2]={'$like':'%'+_0x3ce9c5[_0xeb1b('0x29')][_0xeb1b('0x48')]+'%'};return _0x4b6ba4;})});}_0x2b4126=_['merge']({},_0x2b4126,_0x3ce9c5[_0xeb1b('0x39')]);return _0x30f83e[_0xeb1b('0x4b')](_0x2b4126);}})[_0xeb1b('0x1f')](function(_0x226e70){if(_0x226e70){_0x1cffd0=_0x226e70[_0xeb1b('0x2f')];if(!_0x3ce9c5['query'][_0xeb1b('0x30')](_0xeb1b('0x49'))){_0x2b4126['limit']=qs[_0xeb1b('0x18')](_0x3ce9c5[_0xeb1b('0x29')][_0xeb1b('0x18')]);_0x2b4126['offset']=qs[_0xeb1b('0x31')](_0x3ce9c5[_0xeb1b('0x29')]['offset']);}return _0x30f83e[_0xeb1b('0x4b')](_0x2b4126);}})[_0xeb1b('0x1f')](function(_0x18effa){if(_0x18effa){return _0x18effa?{'count':_0x1cffd0,'rows':_0x18effa}:null;}})[_0xeb1b('0x1f')](respondWithResult(_0x4de5ac,null))[_0xeb1b('0x40')](handleError(_0x4de5ac,null));};exports[_0xeb1b('0x4c')]=function(_0x599ae2,_0x4ef39d,_0x58eb22){var _0x3484bf={};var _0x3d4fa5={};var _0x2d2d2b;var _0x3d3e4a;return db['FreshdeskConfiguration'][_0xeb1b('0x45')]({'where':{'id':_0x599ae2[_0xeb1b('0x3e')]['id']}})[_0xeb1b('0x1f')](handleEntityNotFound(_0x4ef39d,null))[_0xeb1b('0x1f')](function(_0x41d2d4){if(_0x41d2d4){_0x2d2d2b=_0x41d2d4;_0x3d4fa5[_0xeb1b('0x28')]=_['keys'](db[_0xeb1b('0x4d')][_0xeb1b('0x47')]);_0x3d4fa5['query']=_[_0xeb1b('0x2a')](_0x599ae2[_0xeb1b('0x29')]);_0x3d4fa5[_0xeb1b('0x2b')]=_['intersection'](_0x3d4fa5['model'],_0x3d4fa5[_0xeb1b('0x29')]);_0x3484bf[_0xeb1b('0x2d')]=_[_0xeb1b('0x2c')](_0x3d4fa5[_0xeb1b('0x28')],qs['fields'](_0x599ae2[_0xeb1b('0x29')]['fields']));_0x3484bf[_0xeb1b('0x2d')]=_0x3484bf[_0xeb1b('0x2d')][_0xeb1b('0x2f')]?_0x3484bf['attributes']:_0x3d4fa5['model'];_0x3484bf[_0xeb1b('0x32')]=qs[_0xeb1b('0x33')](_0x599ae2[_0xeb1b('0x29')][_0xeb1b('0x33')]);_0x3484bf[_0xeb1b('0x35')]=qs[_0xeb1b('0x2b')](_[_0xeb1b('0x34')](_0x599ae2[_0xeb1b('0x29')],_0x3d4fa5[_0xeb1b('0x2b')]));if(_0x599ae2[_0xeb1b('0x29')][_0xeb1b('0x48')]){_0x3484bf[_0xeb1b('0x35')]=_[_0xeb1b('0x38')](_0x3484bf[_0xeb1b('0x35')],{'$or':_[_0xeb1b('0x23')](_0x3484bf[_0xeb1b('0x2d')],function(_0x3a304a){var _0x1d3973={};_0x1d3973[_0x3a304a]={'$like':'%'+_0x599ae2[_0xeb1b('0x29')][_0xeb1b('0x48')]+'%'};return _0x1d3973;})});}_0x3484bf=_['merge']({},_0x3484bf,_0x599ae2[_0xeb1b('0x39')]);return _0x2d2d2b[_0xeb1b('0x4c')](_0x3484bf);}})[_0xeb1b('0x1f')](function(_0x3da5d9){if(_0x3da5d9){_0x3d3e4a=_0x3da5d9[_0xeb1b('0x2f')];if(!_0x599ae2[_0xeb1b('0x29')][_0xeb1b('0x30')](_0xeb1b('0x49'))){_0x3484bf[_0xeb1b('0x18')]=qs[_0xeb1b('0x18')](_0x599ae2[_0xeb1b('0x29')][_0xeb1b('0x18')]);_0x3484bf['offset']=qs[_0xeb1b('0x31')](_0x599ae2[_0xeb1b('0x29')][_0xeb1b('0x31')]);}return _0x2d2d2b[_0xeb1b('0x4c')](_0x3484bf);}})[_0xeb1b('0x1f')](function(_0xa155a0){if(_0xa155a0){return _0xa155a0?{'count':_0x3d3e4a,'rows':_0xa155a0}:null;}})[_0xeb1b('0x1f')](respondWithResult(_0x4ef39d,null))[_0xeb1b('0x40')](handleError(_0x4ef39d,null));};exports[_0xeb1b('0x4e')]=function(_0x41a471,_0x17c358,_0x59a055){if(_0x41a471[_0xeb1b('0x42')]['id']){delete _0x41a471['body']['id'];}return db[_0xeb1b('0x24')]['findOne']({'where':{'id':_0x41a471[_0xeb1b('0x3e')]['id']}})[_0xeb1b('0x1f')](handleEntityNotFound(_0x17c358,null))[_0xeb1b('0x1f')](function(_0x532507){if(_0x532507){return _0x532507[_0xeb1b('0x4e')](_0x41a471[_0xeb1b('0x42')][_0xeb1b('0x4f')]||[]);}return null;})[_0xeb1b('0x1f')](respondWithResult(_0x17c358,null))[_0xeb1b('0x40')](handleError(_0x17c358,null));}; \ No newline at end of file +var _0x1272=['show','params','find','catch','create','body','getFields','order','nolimit','getSubjects','findOne','FreshdeskField','getDescriptions','Tag','getTags','setTags','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0x1272,0x1be));var _0x2127=function(_0xce58df,_0x4b6850){_0xce58df=_0xce58df-0x0;var _0x57b86a=_0x1272[_0xce58df];return _0x57b86a;};'use strict';var emlformat=require(_0x2127('0x0'));var rimraf=require(_0x2127('0x1'));var zipdir=require(_0x2127('0x2'));var jsonpatch=require(_0x2127('0x3'));var rp=require(_0x2127('0x4'));var moment=require('moment');var BPromise=require(_0x2127('0x5'));var Mustache=require('mustache');var util=require(_0x2127('0x6'));var path=require(_0x2127('0x7'));var sox=require(_0x2127('0x8'));var csv=require(_0x2127('0x9'));var ejs=require(_0x2127('0xa'));var fs=require('fs');var fs_extra=require(_0x2127('0xb'));var _=require(_0x2127('0xc'));var squel=require(_0x2127('0xd'));var crypto=require(_0x2127('0xe'));var jsforce=require(_0x2127('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2127('0x9'));var querystring=require(_0x2127('0x10'));var Papa=require(_0x2127('0x11'));var Redis=require('ioredis');var authService=require(_0x2127('0x12'));var qs=require(_0x2127('0x13'));var as=require(_0x2127('0x14'));var hardwareService=require(_0x2127('0x15'));var logger=require(_0x2127('0x16'))(_0x2127('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2127('0x18'));var db=require(_0x2127('0x19'))['db'];function respondWithStatusCode(_0x5464c5,_0x22d700){_0x22d700=_0x22d700||0xcc;return function(_0x134fa3){if(_0x134fa3){return _0x5464c5[_0x2127('0x1a')](_0x22d700);}return _0x5464c5[_0x2127('0x1b')](_0x22d700)['end']();};}function respondWithResult(_0x3422f9,_0x4c716c){_0x4c716c=_0x4c716c||0xc8;return function(_0x458fbc){if(_0x458fbc){return _0x3422f9['status'](_0x4c716c)[_0x2127('0x1c')](_0x458fbc);}};}function respondWithFilteredResult(_0x369b10,_0x18461f){return function(_0x229708){if(_0x229708){var _0x859cfa=typeof _0x18461f['offset']==='undefined'&&typeof _0x18461f[_0x2127('0x1d')]==='undefined';var _0xdf4fb2=_0x229708['count'];var _0x49e2d0=_0x859cfa?0x0:_0x18461f['offset'];var _0x562930=_0x859cfa?_0x229708[_0x2127('0x1e')]:_0x18461f[_0x2127('0x1f')]+_0x18461f['limit'];var _0xf79b41;if(_0x562930>=_0xdf4fb2){_0x562930=_0xdf4fb2;_0xf79b41=0xc8;}else{_0xf79b41=0xce;}_0x369b10[_0x2127('0x1b')](_0xf79b41);return _0x369b10[_0x2127('0x20')](_0x2127('0x21'),_0x49e2d0+'-'+_0x562930+'/'+_0xdf4fb2)[_0x2127('0x1c')](_0x229708);}return null;};}function patchUpdates(_0x52592e){return function(_0x209570){try{jsonpatch[_0x2127('0x22')](_0x209570,_0x52592e,!![]);}catch(_0x2eda25){return BPromise['reject'](_0x2eda25);}return _0x209570[_0x2127('0x23')]();};}function saveUpdates(_0x3f3030,_0x2740ba){return function(_0x2d678c){if(_0x2d678c){return _0x2d678c[_0x2127('0x24')](_0x3f3030)[_0x2127('0x25')](function(_0x311712){return _0x311712;});}return null;};}function removeEntity(_0x36e75b,_0x15fe44){return function(_0x49d6c4){if(_0x49d6c4){return _0x49d6c4[_0x2127('0x26')]()[_0x2127('0x25')](function(){_0x36e75b[_0x2127('0x1b')](0xcc)[_0x2127('0x27')]();});}};}function handleEntityNotFound(_0x5028b4,_0x2fe353){return function(_0x39210c){if(!_0x39210c){_0x5028b4[_0x2127('0x1a')](0x194);}return _0x39210c;};}function handleError(_0x49a950,_0x2258fa){_0x2258fa=_0x2258fa||0x1f4;return function(_0x477b80){logger[_0x2127('0x28')](_0x477b80[_0x2127('0x29')]);if(_0x477b80[_0x2127('0x2a')]){delete _0x477b80[_0x2127('0x2a')];}_0x49a950[_0x2127('0x1b')](_0x2258fa)[_0x2127('0x2b')](_0x477b80);};}exports[_0x2127('0x2c')]=function(_0x3175a0,_0x13b5e6){var _0x1c656f={},_0x43f59d={},_0x1fa482={'count':0x0,'rows':[]};var _0x598d58=_['map'](db[_0x2127('0x2d')][_0x2127('0x2e')],function(_0x25846e){return{'name':_0x25846e[_0x2127('0x2f')],'type':_0x25846e[_0x2127('0x30')][_0x2127('0x31')]};});_0x43f59d['model']=_[_0x2127('0x32')](_0x598d58,_0x2127('0x2a'));_0x43f59d[_0x2127('0x33')]=_[_0x2127('0x34')](_0x3175a0[_0x2127('0x33')]);_0x43f59d[_0x2127('0x35')]=_[_0x2127('0x36')](_0x43f59d[_0x2127('0x37')],_0x43f59d['query']);_0x1c656f[_0x2127('0x38')]=_[_0x2127('0x36')](_0x43f59d['model'],qs['fields'](_0x3175a0['query'][_0x2127('0x39')]));_0x1c656f[_0x2127('0x38')]=_0x1c656f[_0x2127('0x38')][_0x2127('0x3a')]?_0x1c656f['attributes']:_0x43f59d[_0x2127('0x37')];if(!_0x3175a0['query'][_0x2127('0x3b')]('nolimit')){_0x1c656f[_0x2127('0x1d')]=qs[_0x2127('0x1d')](_0x3175a0['query'][_0x2127('0x1d')]);_0x1c656f[_0x2127('0x1f')]=qs['offset'](_0x3175a0[_0x2127('0x33')][_0x2127('0x1f')]);}_0x1c656f['order']=qs['sort'](_0x3175a0[_0x2127('0x33')][_0x2127('0x3c')]);_0x1c656f[_0x2127('0x3d')]=qs[_0x2127('0x35')](_[_0x2127('0x3e')](_0x3175a0[_0x2127('0x33')],_0x43f59d[_0x2127('0x35')]),_0x598d58);if(_0x3175a0[_0x2127('0x33')][_0x2127('0x3f')]){_0x1c656f[_0x2127('0x3d')]=_[_0x2127('0x40')](_0x1c656f[_0x2127('0x3d')],{'$or':_[_0x2127('0x32')](_0x598d58,function(_0x242d33){if(_0x242d33[_0x2127('0x30')]!==_0x2127('0x41')){var _0x3a59b9={};_0x3a59b9[_0x242d33[_0x2127('0x2a')]]={'$like':'%'+_0x3175a0[_0x2127('0x33')][_0x2127('0x3f')]+'%'};return _0x3a59b9;}})});}_0x1c656f=_[_0x2127('0x40')]({},_0x1c656f,_0x3175a0[_0x2127('0x42')]);var _0x1261d8={'where':_0x1c656f[_0x2127('0x3d')]};return db['FreshdeskConfiguration']['count'](_0x1261d8)[_0x2127('0x25')](function(_0x15f345){_0x1fa482['count']=_0x15f345;if(_0x3175a0[_0x2127('0x33')][_0x2127('0x43')]){_0x1c656f[_0x2127('0x44')]=[{'all':!![]}];}return db[_0x2127('0x2d')][_0x2127('0x45')](_0x1c656f);})[_0x2127('0x25')](function(_0x3a58e7){_0x1fa482['rows']=_0x3a58e7;return _0x1fa482;})['then'](respondWithFilteredResult(_0x13b5e6,_0x1c656f))['catch'](handleError(_0x13b5e6,null));};exports[_0x2127('0x46')]=function(_0x14683c,_0x3ec23e){var _0x15dc08={'raw':![],'where':{'id':_0x14683c[_0x2127('0x47')]['id']}},_0x47aca3={};_0x47aca3[_0x2127('0x37')]=_['keys'](db['FreshdeskConfiguration'][_0x2127('0x2e')]);_0x47aca3['query']=_[_0x2127('0x34')](_0x14683c['query']);_0x47aca3[_0x2127('0x35')]=_['intersection'](_0x47aca3['model'],_0x47aca3[_0x2127('0x33')]);_0x15dc08['attributes']=_[_0x2127('0x36')](_0x47aca3[_0x2127('0x37')],qs[_0x2127('0x39')](_0x14683c['query'][_0x2127('0x39')]));_0x15dc08[_0x2127('0x38')]=_0x15dc08[_0x2127('0x38')][_0x2127('0x3a')]?_0x15dc08[_0x2127('0x38')]:_0x47aca3[_0x2127('0x37')];if(_0x14683c[_0x2127('0x33')]['includeAll']){_0x15dc08[_0x2127('0x44')]=[{'all':!![]}];}_0x15dc08=_[_0x2127('0x40')]({},_0x15dc08,_0x14683c['options']);return db[_0x2127('0x2d')][_0x2127('0x48')](_0x15dc08)[_0x2127('0x25')](handleEntityNotFound(_0x3ec23e,null))[_0x2127('0x25')](respondWithResult(_0x3ec23e,null))[_0x2127('0x49')](handleError(_0x3ec23e,null));};exports['create']=function(_0x5152dc,_0x558d42){return db[_0x2127('0x2d')][_0x2127('0x4a')](_0x5152dc['body'],{})[_0x2127('0x25')](respondWithResult(_0x558d42,0xc9))[_0x2127('0x49')](handleError(_0x558d42,null));};exports[_0x2127('0x24')]=function(_0x596d37,_0x503ab3){if(_0x596d37[_0x2127('0x4b')]['id']){delete _0x596d37[_0x2127('0x4b')]['id'];}return db[_0x2127('0x2d')][_0x2127('0x48')]({'where':{'id':_0x596d37[_0x2127('0x47')]['id']}})[_0x2127('0x25')](handleEntityNotFound(_0x503ab3,null))['then'](saveUpdates(_0x596d37[_0x2127('0x4b')],null))[_0x2127('0x25')](respondWithResult(_0x503ab3,null))['catch'](handleError(_0x503ab3,null));};exports['destroy']=function(_0x48603d,_0x466ce1){return db['FreshdeskConfiguration'][_0x2127('0x48')]({'where':{'id':_0x48603d[_0x2127('0x47')]['id']}})[_0x2127('0x25')](handleEntityNotFound(_0x466ce1,null))[_0x2127('0x25')](removeEntity(_0x466ce1,null))[_0x2127('0x49')](handleError(_0x466ce1,null));};exports[_0x2127('0x4c')]=function(_0x8812b6,_0x22fde5,_0x234585){var _0x9a5ad9={};var _0x5031ab={};var _0x4851e3;var _0x24233a;return db[_0x2127('0x2d')]['findOne']({'where':{'id':_0x8812b6['params']['id']}})[_0x2127('0x25')](handleEntityNotFound(_0x22fde5,null))[_0x2127('0x25')](function(_0x3c813d){if(_0x3c813d){_0x4851e3=_0x3c813d;_0x5031ab[_0x2127('0x37')]=_[_0x2127('0x34')](db['FreshdeskField'][_0x2127('0x2e')]);_0x5031ab[_0x2127('0x33')]=_[_0x2127('0x34')](_0x8812b6[_0x2127('0x33')]);_0x5031ab[_0x2127('0x35')]=_[_0x2127('0x36')](_0x5031ab[_0x2127('0x37')],_0x5031ab[_0x2127('0x33')]);_0x9a5ad9['attributes']=_[_0x2127('0x36')](_0x5031ab['model'],qs['fields'](_0x8812b6['query'][_0x2127('0x39')]));_0x9a5ad9['attributes']=_0x9a5ad9['attributes']['length']?_0x9a5ad9[_0x2127('0x38')]:_0x5031ab[_0x2127('0x37')];_0x9a5ad9[_0x2127('0x4d')]=qs[_0x2127('0x3c')](_0x8812b6[_0x2127('0x33')]['sort']);_0x9a5ad9[_0x2127('0x3d')]=qs['filters'](_[_0x2127('0x3e')](_0x8812b6['query'],_0x5031ab[_0x2127('0x35')]));if(_0x8812b6[_0x2127('0x33')][_0x2127('0x3f')]){_0x9a5ad9[_0x2127('0x3d')]=_[_0x2127('0x40')](_0x9a5ad9['where'],{'$or':_['map'](_0x9a5ad9[_0x2127('0x38')],function(_0x126c72){var _0x1104e0={};_0x1104e0[_0x126c72]={'$like':'%'+_0x8812b6[_0x2127('0x33')][_0x2127('0x3f')]+'%'};return _0x1104e0;})});}_0x9a5ad9=_['merge']({},_0x9a5ad9,_0x8812b6['options']);return _0x4851e3[_0x2127('0x4c')](_0x9a5ad9);}})['then'](function(_0x17db81){if(_0x17db81){_0x24233a=_0x17db81[_0x2127('0x3a')];if(!_0x8812b6[_0x2127('0x33')][_0x2127('0x3b')](_0x2127('0x4e'))){_0x9a5ad9[_0x2127('0x1d')]=qs[_0x2127('0x1d')](_0x8812b6[_0x2127('0x33')][_0x2127('0x1d')]);_0x9a5ad9[_0x2127('0x1f')]=qs[_0x2127('0x1f')](_0x8812b6[_0x2127('0x33')][_0x2127('0x1f')]);}return _0x4851e3['getFields'](_0x9a5ad9);}})[_0x2127('0x25')](function(_0x45edf8){if(_0x45edf8){return _0x45edf8?{'count':_0x24233a,'rows':_0x45edf8}:null;}})[_0x2127('0x25')](respondWithResult(_0x22fde5,null))['catch'](handleError(_0x22fde5,null));};exports[_0x2127('0x4f')]=function(_0x20ade9,_0x2f6dd3,_0x1141e5){var _0x2db9ab={};var _0x1c9aa1={};var _0xf0438e;var _0x2dd46b;return db[_0x2127('0x2d')][_0x2127('0x50')]({'where':{'id':_0x20ade9[_0x2127('0x47')]['id']}})['then'](handleEntityNotFound(_0x2f6dd3,null))[_0x2127('0x25')](function(_0x1be4a2){if(_0x1be4a2){_0xf0438e=_0x1be4a2;_0x1c9aa1[_0x2127('0x37')]=_[_0x2127('0x34')](db[_0x2127('0x51')][_0x2127('0x2e')]);_0x1c9aa1['query']=_[_0x2127('0x34')](_0x20ade9[_0x2127('0x33')]);_0x1c9aa1[_0x2127('0x35')]=_[_0x2127('0x36')](_0x1c9aa1[_0x2127('0x37')],_0x1c9aa1[_0x2127('0x33')]);_0x2db9ab[_0x2127('0x38')]=_[_0x2127('0x36')](_0x1c9aa1[_0x2127('0x37')],qs['fields'](_0x20ade9['query'][_0x2127('0x39')]));_0x2db9ab[_0x2127('0x38')]=_0x2db9ab['attributes'][_0x2127('0x3a')]?_0x2db9ab[_0x2127('0x38')]:_0x1c9aa1['model'];_0x2db9ab[_0x2127('0x4d')]=qs[_0x2127('0x3c')](_0x20ade9[_0x2127('0x33')]['sort']);_0x2db9ab[_0x2127('0x3d')]=qs[_0x2127('0x35')](_['pick'](_0x20ade9[_0x2127('0x33')],_0x1c9aa1['filters']));if(_0x20ade9[_0x2127('0x33')]['filter']){_0x2db9ab[_0x2127('0x3d')]=_[_0x2127('0x40')](_0x2db9ab[_0x2127('0x3d')],{'$or':_['map'](_0x2db9ab[_0x2127('0x38')],function(_0x10a2d6){var _0x202118={};_0x202118[_0x10a2d6]={'$like':'%'+_0x20ade9[_0x2127('0x33')]['filter']+'%'};return _0x202118;})});}_0x2db9ab=_[_0x2127('0x40')]({},_0x2db9ab,_0x20ade9['options']);return _0xf0438e[_0x2127('0x4f')](_0x2db9ab);}})[_0x2127('0x25')](function(_0x3ad477){if(_0x3ad477){_0x2dd46b=_0x3ad477[_0x2127('0x3a')];if(!_0x20ade9['query'][_0x2127('0x3b')](_0x2127('0x4e'))){_0x2db9ab[_0x2127('0x1d')]=qs['limit'](_0x20ade9[_0x2127('0x33')][_0x2127('0x1d')]);_0x2db9ab[_0x2127('0x1f')]=qs[_0x2127('0x1f')](_0x20ade9[_0x2127('0x33')][_0x2127('0x1f')]);}return _0xf0438e[_0x2127('0x4f')](_0x2db9ab);}})[_0x2127('0x25')](function(_0x30d9a5){if(_0x30d9a5){return _0x30d9a5?{'count':_0x2dd46b,'rows':_0x30d9a5}:null;}})[_0x2127('0x25')](respondWithResult(_0x2f6dd3,null))[_0x2127('0x49')](handleError(_0x2f6dd3,null));};exports['getDescriptions']=function(_0x1555dd,_0x4f20fc,_0x457dbb){var _0xb1242d={};var _0x3c8a40={};var _0x1e4464;var _0x2d12cd;return db[_0x2127('0x2d')]['findOne']({'where':{'id':_0x1555dd[_0x2127('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f20fc,null))[_0x2127('0x25')](function(_0x49e248){if(_0x49e248){_0x1e4464=_0x49e248;_0x3c8a40['model']=_[_0x2127('0x34')](db['FreshdeskField'][_0x2127('0x2e')]);_0x3c8a40[_0x2127('0x33')]=_['keys'](_0x1555dd[_0x2127('0x33')]);_0x3c8a40[_0x2127('0x35')]=_[_0x2127('0x36')](_0x3c8a40[_0x2127('0x37')],_0x3c8a40[_0x2127('0x33')]);_0xb1242d[_0x2127('0x38')]=_[_0x2127('0x36')](_0x3c8a40[_0x2127('0x37')],qs[_0x2127('0x39')](_0x1555dd[_0x2127('0x33')][_0x2127('0x39')]));_0xb1242d[_0x2127('0x38')]=_0xb1242d[_0x2127('0x38')][_0x2127('0x3a')]?_0xb1242d[_0x2127('0x38')]:_0x3c8a40[_0x2127('0x37')];_0xb1242d[_0x2127('0x4d')]=qs['sort'](_0x1555dd[_0x2127('0x33')]['sort']);_0xb1242d[_0x2127('0x3d')]=qs[_0x2127('0x35')](_[_0x2127('0x3e')](_0x1555dd[_0x2127('0x33')],_0x3c8a40[_0x2127('0x35')]));if(_0x1555dd['query'][_0x2127('0x3f')]){_0xb1242d[_0x2127('0x3d')]=_[_0x2127('0x40')](_0xb1242d[_0x2127('0x3d')],{'$or':_[_0x2127('0x32')](_0xb1242d['attributes'],function(_0x5083ce){var _0x18640f={};_0x18640f[_0x5083ce]={'$like':'%'+_0x1555dd[_0x2127('0x33')][_0x2127('0x3f')]+'%'};return _0x18640f;})});}_0xb1242d=_['merge']({},_0xb1242d,_0x1555dd[_0x2127('0x42')]);return _0x1e4464[_0x2127('0x52')](_0xb1242d);}})['then'](function(_0x2e92f0){if(_0x2e92f0){_0x2d12cd=_0x2e92f0[_0x2127('0x3a')];if(!_0x1555dd[_0x2127('0x33')][_0x2127('0x3b')]('nolimit')){_0xb1242d['limit']=qs[_0x2127('0x1d')](_0x1555dd[_0x2127('0x33')][_0x2127('0x1d')]);_0xb1242d[_0x2127('0x1f')]=qs['offset'](_0x1555dd['query'][_0x2127('0x1f')]);}return _0x1e4464[_0x2127('0x52')](_0xb1242d);}})[_0x2127('0x25')](function(_0x2c13e1){if(_0x2c13e1){return _0x2c13e1?{'count':_0x2d12cd,'rows':_0x2c13e1}:null;}})[_0x2127('0x25')](respondWithResult(_0x4f20fc,null))[_0x2127('0x49')](handleError(_0x4f20fc,null));};exports['getTags']=function(_0xf0a77d,_0x58b82f,_0x34aa10){var _0x165d68={};var _0x1a4601={};var _0x2e7b18;var _0x449177;return db[_0x2127('0x2d')][_0x2127('0x50')]({'where':{'id':_0xf0a77d['params']['id']}})[_0x2127('0x25')](handleEntityNotFound(_0x58b82f,null))[_0x2127('0x25')](function(_0x79ea9e){if(_0x79ea9e){_0x2e7b18=_0x79ea9e;_0x1a4601['model']=_[_0x2127('0x34')](db[_0x2127('0x53')][_0x2127('0x2e')]);_0x1a4601[_0x2127('0x33')]=_[_0x2127('0x34')](_0xf0a77d['query']);_0x1a4601['filters']=_['intersection'](_0x1a4601[_0x2127('0x37')],_0x1a4601[_0x2127('0x33')]);_0x165d68[_0x2127('0x38')]=_[_0x2127('0x36')](_0x1a4601[_0x2127('0x37')],qs['fields'](_0xf0a77d['query']['fields']));_0x165d68[_0x2127('0x38')]=_0x165d68[_0x2127('0x38')][_0x2127('0x3a')]?_0x165d68[_0x2127('0x38')]:_0x1a4601[_0x2127('0x37')];_0x165d68[_0x2127('0x4d')]=qs[_0x2127('0x3c')](_0xf0a77d[_0x2127('0x33')]['sort']);_0x165d68[_0x2127('0x3d')]=qs[_0x2127('0x35')](_[_0x2127('0x3e')](_0xf0a77d['query'],_0x1a4601[_0x2127('0x35')]));if(_0xf0a77d[_0x2127('0x33')]['filter']){_0x165d68[_0x2127('0x3d')]=_[_0x2127('0x40')](_0x165d68[_0x2127('0x3d')],{'$or':_[_0x2127('0x32')](_0x165d68[_0x2127('0x38')],function(_0x1d6cd9){var _0x140c0a={};_0x140c0a[_0x1d6cd9]={'$like':'%'+_0xf0a77d[_0x2127('0x33')]['filter']+'%'};return _0x140c0a;})});}_0x165d68=_[_0x2127('0x40')]({},_0x165d68,_0xf0a77d[_0x2127('0x42')]);return _0x2e7b18[_0x2127('0x54')](_0x165d68);}})[_0x2127('0x25')](function(_0x2ea3b3){if(_0x2ea3b3){_0x449177=_0x2ea3b3[_0x2127('0x3a')];if(!_0xf0a77d[_0x2127('0x33')][_0x2127('0x3b')]('nolimit')){_0x165d68['limit']=qs['limit'](_0xf0a77d[_0x2127('0x33')][_0x2127('0x1d')]);_0x165d68[_0x2127('0x1f')]=qs['offset'](_0xf0a77d[_0x2127('0x33')][_0x2127('0x1f')]);}return _0x2e7b18[_0x2127('0x54')](_0x165d68);}})[_0x2127('0x25')](function(_0x553182){if(_0x553182){return _0x553182?{'count':_0x449177,'rows':_0x553182}:null;}})['then'](respondWithResult(_0x58b82f,null))['catch'](handleError(_0x58b82f,null));};exports['setTags']=function(_0x3de9dc,_0x2f1811,_0x15689c){if(_0x3de9dc[_0x2127('0x4b')]['id']){delete _0x3de9dc[_0x2127('0x4b')]['id'];}return db['FreshdeskConfiguration'][_0x2127('0x50')]({'where':{'id':_0x3de9dc['params']['id']}})['then'](handleEntityNotFound(_0x2f1811,null))[_0x2127('0x25')](function(_0x1c5e5e){if(_0x1c5e5e){return _0x1c5e5e[_0x2127('0x55')](_0x3de9dc['body']['ids']||[]);}return null;})[_0x2127('0x25')](respondWithResult(_0x2f1811,null))['catch'](handleError(_0x2f1811,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index a08a34c..5a41421 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 _0x407b=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshdeskConfiguration'];(function(_0x2f7696,_0x1e9085){var _0x13d6f1=function(_0x1dc25a){while(--_0x1dc25a){_0x2f7696['push'](_0x2f7696['shift']());}};_0x13d6f1(++_0x1e9085);}(_0x407b,0x78));var _0xb407=function(_0xc94ef9,_0x38dc30){_0xc94ef9=_0xc94ef9-0x0;var _0x25af61=_0x407b[_0xc94ef9];return _0x25af61;};'use strict';var _=require('lodash');var util=require(_0xb407('0x0'));var logger=require(_0xb407('0x1'))(_0xb407('0x2'));var moment=require(_0xb407('0x3'));var BPromise=require(_0xb407('0x4'));var rp=require(_0xb407('0x5'));var fs=require('fs');var path=require(_0xb407('0x6'));var rimraf=require(_0xb407('0x7'));var config=require(_0xb407('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xb407('0x9')]=function(_0x226ce8,_0x2cef53){return _0x226ce8[_0xb407('0xa')](_0xb407('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x801a=['api','moment','bluebird','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger'];(function(_0x3c2834,_0x31a38f){var _0x4aec4f=function(_0x5db3d5){while(--_0x5db3d5){_0x3c2834['push'](_0x3c2834['shift']());}};_0x4aec4f(++_0x31a38f);}(_0x801a,0x1b7));var _0xa801=function(_0x50304f,_0x50cf75){_0x50304f=_0x50304f-0x0;var _0x1f73e4=_0x801a[_0x50304f];return _0x1f73e4;};'use strict';var _=require(_0xa801('0x0'));var util=require(_0xa801('0x1'));var logger=require(_0xa801('0x2'))(_0xa801('0x3'));var moment=require(_0xa801('0x4'));var BPromise=require(_0xa801('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa801('0x6'));var config=require(_0xa801('0x7'));var attributes=require(_0xa801('0x8'));module[_0xa801('0x9')]=function(_0x41c96d,_0x1512a8){return _0x41c96d[_0xa801('0xa')](_0xa801('0xb'),attributes,{'tableName':_0xa801('0xc'),'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 ef6214e..d8a0606 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 _0xd14e=['../../config/logger','rpc','../../config/environment','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd14e,0x197));var _0xed14=function(_0x5427c6,_0x1240a1){_0x5427c6=_0x5427c6-0x0;var _0x5144ff=_0xd14e[_0x5427c6];return _0x5144ff;};'use strict';var _=require(_0xed14('0x0'));var util=require(_0xed14('0x1'));var moment=require(_0xed14('0x2'));var BPromise=require(_0xed14('0x3'));var rs=require(_0xed14('0x4'));var fs=require('fs');var Redis=require(_0xed14('0x5'));var db=require(_0xed14('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xed14('0x7'))(_0xed14('0x8'));var config=require(_0xed14('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xed14('0xa')][_0xed14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36722a,_0x17f6a7,_0x3ef4e7){return new BPromise(function(_0x3a7a9d,_0x4786e5){return client[_0xed14('0xc')](_0x36722a,_0x3ef4e7)['then'](function(_0xa6d622){logger[_0xed14('0xd')](_0xed14('0xe'),_0x17f6a7,_0xed14('0xf'));logger[_0xed14('0x10')](_0xed14('0x11'),_0x17f6a7,_0xed14('0xf'),JSON['stringify'](_0xa6d622));if(_0xa6d622[_0xed14('0x12')]){if(_0xa6d622[_0xed14('0x12')][_0xed14('0x13')]===0x1f4){logger[_0xed14('0x12')](_0xed14('0xe'),_0x17f6a7,_0xa6d622[_0xed14('0x12')][_0xed14('0x14')]);return _0x4786e5(_0xa6d622['error'][_0xed14('0x14')]);}logger['error'](_0xed14('0xe'),_0x17f6a7,_0xa6d622[_0xed14('0x12')][_0xed14('0x14')]);return _0x3a7a9d(_0xa6d622[_0xed14('0x12')][_0xed14('0x14')]);}else{logger[_0xed14('0xd')](_0xed14('0xe'),_0x17f6a7,_0xed14('0xf'));_0x3a7a9d(_0xa6d622[_0xed14('0x15')][_0xed14('0x14')]);}})[_0xed14('0x16')](function(_0x4e56d3){logger['error'](_0xed14('0xe'),_0x17f6a7,_0x4e56d3);_0x4786e5(_0x4e56d3);});});} \ No newline at end of file +var _0x6481=['rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','catch','util','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x6481,0xa3));var _0x1648=function(_0xa7551c,_0x5251e1){_0xa7551c=_0xa7551c-0x0;var _0x5f53af=_0x6481[_0xa7551c];return _0x5f53af;};'use strict';var _=require('lodash');var util=require(_0x1648('0x0'));var moment=require('moment');var BPromise=require(_0x1648('0x1'));var rs=require(_0x1648('0x2'));var fs=require('fs');var Redis=require(_0x1648('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1648('0x4'))(_0x1648('0x5'));var config=require(_0x1648('0x6'));var jayson=require(_0x1648('0x7'));var client=jayson['client'][_0x1648('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x407ec7,_0x430577,_0x266e25){return new BPromise(function(_0x5957f4,_0x1406aa){return client[_0x1648('0x9')](_0x407ec7,_0x266e25)[_0x1648('0xa')](function(_0x132441){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x430577,_0x1648('0xb'));logger[_0x1648('0xc')](_0x1648('0xd'),_0x430577,'request\x20sent',JSON[_0x1648('0xe')](_0x132441));if(_0x132441['error']){if(_0x132441[_0x1648('0xf')][_0x1648('0x10')]===0x1f4){logger[_0x1648('0xf')](_0x1648('0x11'),_0x430577,_0x132441[_0x1648('0xf')][_0x1648('0x12')]);return _0x1406aa(_0x132441[_0x1648('0xf')][_0x1648('0x12')]);}logger[_0x1648('0xf')](_0x1648('0x11'),_0x430577,_0x132441[_0x1648('0xf')][_0x1648('0x12')]);return _0x5957f4(_0x132441[_0x1648('0xf')]['message']);}else{logger[_0x1648('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x430577,_0x1648('0xb'));_0x5957f4(_0x132441['result'][_0x1648('0x12')]);}})[_0x1648('0x14')](function(_0x4f9833){logger[_0x1648('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x430577,_0x4f9833);_0x1406aa(_0x4f9833);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index bf32a24..0466564 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 _0xd4d9=['update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','index','show','post','isAuthenticated','create','/:id'];(function(_0x879aba,_0x22bbe1){var _0x2dff0b=function(_0x21da3e){while(--_0x21da3e){_0x879aba['push'](_0x879aba['shift']());}};_0x2dff0b(++_0x22bbe1);}(_0xd4d9,0x157));var _0x9d4d=function(_0x81480d,_0x44cb9a){_0x81480d=_0x81480d-0x0;var _0x26d57f=_0xd4d9[_0x81480d];return _0x26d57f;};'use strict';var multer=require(_0x9d4d('0x0'));var util=require(_0x9d4d('0x1'));var path=require(_0x9d4d('0x2'));var timeout=require(_0x9d4d('0x3'));var express=require('express');var router=express[_0x9d4d('0x4')]();var fs_extra=require(_0x9d4d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9d4d('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x9d4d('0x7')]('/',auth['isAuthenticated'](),controller[_0x9d4d('0x8')]);router[_0x9d4d('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x9d4d('0x9')]);router[_0x9d4d('0xa')]('/',auth[_0x9d4d('0xb')](),controller[_0x9d4d('0xc')]);router['put'](_0x9d4d('0xd'),auth['isAuthenticated'](),controller[_0x9d4d('0xe')]);router['delete'](_0x9d4d('0xd'),auth[_0x9d4d('0xb')](),controller[_0x9d4d('0xf')]);module[_0x9d4d('0x10')]=router; \ No newline at end of file +var _0x14d1=['index','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x14d1,0x16d));var _0x114d=function(_0x20897d,_0x1c9163){_0x20897d=_0x20897d-0x0;var _0x2f6c32=_0x14d1[_0x20897d];return _0x2f6c32;};'use strict';var multer=require(_0x114d('0x0'));var util=require(_0x114d('0x1'));var path=require(_0x114d('0x2'));var timeout=require(_0x114d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x114d('0x4'));var interaction=require(_0x114d('0x5'));var config=require(_0x114d('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x114d('0x7')]('/',auth[_0x114d('0x8')](),controller[_0x114d('0x9')]);router['get'](_0x114d('0xa'),auth[_0x114d('0x8')](),controller[_0x114d('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x114d('0xc')]);router[_0x114d('0xd')](_0x114d('0xa'),auth[_0x114d('0x8')](),controller[_0x114d('0xe')]);router['delete'](_0x114d('0xa'),auth[_0x114d('0x8')](),controller[_0x114d('0xf')]);module[_0x114d('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 1108c88..a72cef4 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 _0xa841=['variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x431c26,_0x4b8f47){var _0x3092fd=function(_0x4dca59){while(--_0x4dca59){_0x431c26['push'](_0x431c26['shift']());}};_0x3092fd(++_0x4b8f47);}(_0xa841,0xb0));var _0x1a84=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa841[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x1a84('0x0'));module[_0x1a84('0x1')]={'type':{'type':Sequelize[_0x1a84('0x2')](_0x1a84('0x3'),_0x1a84('0x4'),'customVariable',_0x1a84('0x5'),_0x1a84('0x6')),'defaultValue':_0x1a84('0x3')},'content':{'type':Sequelize[_0x1a84('0x7')]},'key':{'type':Sequelize[_0x1a84('0x7')]},'keyType':{'type':Sequelize[_0x1a84('0x2')](_0x1a84('0x3'),_0x1a84('0x4'),_0x1a84('0x8'))},'keyContent':{'type':Sequelize[_0x1a84('0x7')]},'idField':{'type':Sequelize[_0x1a84('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1a84('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1a84('0x7')]}}; \ No newline at end of file +var _0x72f0=['STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x8d9969,_0x302b80){var _0x2338ce=function(_0x3cdf05){while(--_0x3cdf05){_0x8d9969['push'](_0x8d9969['shift']());}};_0x2338ce(++_0x302b80);}(_0x72f0,0x1ba));var _0x072f=function(_0x20d08e,_0x4cc575){_0x20d08e=_0x20d08e-0x0;var _0x2cbd12=_0x72f0[_0x20d08e];return _0x2cbd12;};'use strict';var Sequelize=require(_0x072f('0x0'));module[_0x072f('0x1')]={'type':{'type':Sequelize[_0x072f('0x2')](_0x072f('0x3'),_0x072f('0x4'),_0x072f('0x5'),'keyValue','picklist'),'defaultValue':_0x072f('0x3')},'content':{'type':Sequelize[_0x072f('0x6')]},'key':{'type':Sequelize[_0x072f('0x6')]},'keyType':{'type':Sequelize[_0x072f('0x2')]('string','variable',_0x072f('0x5'))},'keyContent':{'type':Sequelize[_0x072f('0x6')]},'idField':{'type':Sequelize[_0x072f('0x6')]},'nameField':{'type':Sequelize[_0x072f('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x072f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index b95d6e3..18a6e56 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 _0xb9a7=['merge','VIRTUAL','name','options','includeAll','include','rows','catch','show','params','rawAttributes','intersection','create','body','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','stack','map','FreshdeskField','fieldName','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xb9a7,0x112));var _0x7b9a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb9a7[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b9a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b9a('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x7b9a('0x2'));var util=require(_0x7b9a('0x3'));var path=require(_0x7b9a('0x4'));var sox=require(_0x7b9a('0x5'));var csv=require(_0x7b9a('0x6'));var ejs=require(_0x7b9a('0x7'));var fs=require('fs');var fs_extra=require(_0x7b9a('0x8'));var _=require(_0x7b9a('0x9'));var squel=require(_0x7b9a('0xa'));var crypto=require(_0x7b9a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7b9a('0xc'));var toCsv=require(_0x7b9a('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7b9a('0xd'));var qs=require(_0x7b9a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b9a('0xf'));var logger=require('../../config/logger')(_0x7b9a('0x10'));var utils=require('../../config/utils');var config=require(_0x7b9a('0x11'));var licenseUtil=require(_0x7b9a('0x12'));var db=require(_0x7b9a('0x13'))['db'];function respondWithStatusCode(_0x5948ca,_0x32f616){_0x32f616=_0x32f616||0xcc;return function(_0xec5949){if(_0xec5949){return _0x5948ca['sendStatus'](_0x32f616);}return _0x5948ca[_0x7b9a('0x14')](_0x32f616)[_0x7b9a('0x15')]();};}function respondWithResult(_0x4b7ec0,_0xb157e5){_0xb157e5=_0xb157e5||0xc8;return function(_0xde180d){if(_0xde180d){return _0x4b7ec0[_0x7b9a('0x14')](_0xb157e5)[_0x7b9a('0x16')](_0xde180d);}};}function respondWithFilteredResult(_0x344fa7,_0x346daa){return function(_0x22a7e4){if(_0x22a7e4){var _0x35e602=typeof _0x346daa[_0x7b9a('0x17')]==='undefined'&&typeof _0x346daa[_0x7b9a('0x18')]==='undefined';var _0x123921=_0x22a7e4[_0x7b9a('0x19')];var _0x271263=_0x35e602?0x0:_0x346daa[_0x7b9a('0x17')];var _0x44a232=_0x35e602?_0x22a7e4[_0x7b9a('0x19')]:_0x346daa[_0x7b9a('0x17')]+_0x346daa[_0x7b9a('0x18')];var _0x2064a0;if(_0x44a232>=_0x123921){_0x44a232=_0x123921;_0x2064a0=0xc8;}else{_0x2064a0=0xce;}_0x344fa7[_0x7b9a('0x14')](_0x2064a0);return _0x344fa7[_0x7b9a('0x1a')](_0x7b9a('0x1b'),_0x271263+'-'+_0x44a232+'/'+_0x123921)[_0x7b9a('0x16')](_0x22a7e4);}return null;};}function patchUpdates(_0x58aed7){return function(_0x993048){try{jsonpatch['apply'](_0x993048,_0x58aed7,!![]);}catch(_0x1eacbc){return BPromise['reject'](_0x1eacbc);}return _0x993048[_0x7b9a('0x1c')]();};}function saveUpdates(_0x331ae6,_0x23d812){return function(_0x54fda7){if(_0x54fda7){return _0x54fda7[_0x7b9a('0x1d')](_0x331ae6)[_0x7b9a('0x1e')](function(_0x5705b2){return _0x5705b2;});}return null;};}function removeEntity(_0x35aca7,_0x374dca){return function(_0x269c07){if(_0x269c07){return _0x269c07[_0x7b9a('0x1f')]()[_0x7b9a('0x1e')](function(){_0x35aca7['status'](0xcc)[_0x7b9a('0x15')]();});}};}function handleEntityNotFound(_0x23219e,_0x5809f5){return function(_0x39b7ec){if(!_0x39b7ec){_0x23219e['sendStatus'](0x194);}return _0x39b7ec;};}function handleError(_0x31eb67,_0x3091ab){_0x3091ab=_0x3091ab||0x1f4;return function(_0x4c2271){logger['error'](_0x4c2271[_0x7b9a('0x20')]);if(_0x4c2271['name']){delete _0x4c2271['name'];}_0x31eb67[_0x7b9a('0x14')](_0x3091ab)['send'](_0x4c2271);};}exports['index']=function(_0x3847b4,_0x4d5880){var _0x5c89b6={},_0x314b6d={},_0x4fee38={'count':0x0,'rows':[]};var _0x1553ae=_[_0x7b9a('0x21')](db[_0x7b9a('0x22')]['rawAttributes'],function(_0x45ccf5){return{'name':_0x45ccf5[_0x7b9a('0x23')],'type':_0x45ccf5[_0x7b9a('0x24')][_0x7b9a('0x25')]};});_0x314b6d[_0x7b9a('0x26')]=_[_0x7b9a('0x21')](_0x1553ae,'name');_0x314b6d['query']=_[_0x7b9a('0x27')](_0x3847b4[_0x7b9a('0x28')]);_0x314b6d[_0x7b9a('0x29')]=_['intersection'](_0x314b6d[_0x7b9a('0x26')],_0x314b6d[_0x7b9a('0x28')]);_0x5c89b6['attributes']=_['intersection'](_0x314b6d[_0x7b9a('0x26')],qs[_0x7b9a('0x2a')](_0x3847b4['query'][_0x7b9a('0x2a')]));_0x5c89b6[_0x7b9a('0x2b')]=_0x5c89b6[_0x7b9a('0x2b')][_0x7b9a('0x2c')]?_0x5c89b6[_0x7b9a('0x2b')]:_0x314b6d['model'];if(!_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x2d')](_0x7b9a('0x2e'))){_0x5c89b6[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x3847b4[_0x7b9a('0x28')]['limit']);_0x5c89b6['offset']=qs[_0x7b9a('0x17')](_0x3847b4[_0x7b9a('0x28')]['offset']);}_0x5c89b6[_0x7b9a('0x2f')]=qs[_0x7b9a('0x30')](_0x3847b4[_0x7b9a('0x28')]['sort']);_0x5c89b6[_0x7b9a('0x31')]=qs[_0x7b9a('0x29')](_['pick'](_0x3847b4['query'],_0x314b6d[_0x7b9a('0x29')]),_0x1553ae);if(_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x32')]){_0x5c89b6[_0x7b9a('0x31')]=_[_0x7b9a('0x33')](_0x5c89b6[_0x7b9a('0x31')],{'$or':_[_0x7b9a('0x21')](_0x1553ae,function(_0x380f4b){if(_0x380f4b['type']!==_0x7b9a('0x34')){var _0x5ac175={};_0x5ac175[_0x380f4b[_0x7b9a('0x35')]]={'$like':'%'+_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x32')]+'%'};return _0x5ac175;}})});}_0x5c89b6=_[_0x7b9a('0x33')]({},_0x5c89b6,_0x3847b4[_0x7b9a('0x36')]);var _0x89951b={'where':_0x5c89b6['where']};return db[_0x7b9a('0x22')][_0x7b9a('0x19')](_0x89951b)[_0x7b9a('0x1e')](function(_0x1bc1f0){_0x4fee38['count']=_0x1bc1f0;if(_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x37')]){_0x5c89b6[_0x7b9a('0x38')]=[{'all':!![]}];}return db[_0x7b9a('0x22')]['findAll'](_0x5c89b6);})[_0x7b9a('0x1e')](function(_0x53d89a){_0x4fee38[_0x7b9a('0x39')]=_0x53d89a;return _0x4fee38;})[_0x7b9a('0x1e')](respondWithFilteredResult(_0x4d5880,_0x5c89b6))[_0x7b9a('0x3a')](handleError(_0x4d5880,null));};exports[_0x7b9a('0x3b')]=function(_0x43fad0,_0x41f541){var _0x56e274={'raw':!![],'where':{'id':_0x43fad0[_0x7b9a('0x3c')]['id']}},_0x33edc6={};_0x33edc6[_0x7b9a('0x26')]=_['keys'](db['FreshdeskField'][_0x7b9a('0x3d')]);_0x33edc6[_0x7b9a('0x28')]=_[_0x7b9a('0x27')](_0x43fad0[_0x7b9a('0x28')]);_0x33edc6[_0x7b9a('0x29')]=_[_0x7b9a('0x3e')](_0x33edc6['model'],_0x33edc6['query']);_0x56e274['attributes']=_[_0x7b9a('0x3e')](_0x33edc6[_0x7b9a('0x26')],qs['fields'](_0x43fad0[_0x7b9a('0x28')][_0x7b9a('0x2a')]));_0x56e274[_0x7b9a('0x2b')]=_0x56e274['attributes'][_0x7b9a('0x2c')]?_0x56e274['attributes']:_0x33edc6[_0x7b9a('0x26')];if(_0x43fad0[_0x7b9a('0x28')][_0x7b9a('0x37')]){_0x56e274[_0x7b9a('0x38')]=[{'all':!![]}];}_0x56e274=_[_0x7b9a('0x33')]({},_0x56e274,_0x43fad0['options']);return db[_0x7b9a('0x22')]['find'](_0x56e274)[_0x7b9a('0x1e')](handleEntityNotFound(_0x41f541,null))['then'](respondWithResult(_0x41f541,null))['catch'](handleError(_0x41f541,null));};exports[_0x7b9a('0x3f')]=function(_0x3727ef,_0x717d08){return db[_0x7b9a('0x22')][_0x7b9a('0x3f')](_0x3727ef[_0x7b9a('0x40')],{})[_0x7b9a('0x1e')](respondWithResult(_0x717d08,0xc9))[_0x7b9a('0x3a')](handleError(_0x717d08,null));};exports[_0x7b9a('0x1d')]=function(_0x5088c7,_0x1d7957){if(_0x5088c7[_0x7b9a('0x40')]['id']){delete _0x5088c7['body']['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x5088c7[_0x7b9a('0x3c')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x1d7957,null))[_0x7b9a('0x1e')](saveUpdates(_0x5088c7[_0x7b9a('0x40')],null))['then'](respondWithResult(_0x1d7957,null))[_0x7b9a('0x3a')](handleError(_0x1d7957,null));};exports[_0x7b9a('0x1f')]=function(_0x287dea,_0x33b200){return db[_0x7b9a('0x22')]['find']({'where':{'id':_0x287dea[_0x7b9a('0x3c')]['id']}})['then'](handleEntityNotFound(_0x33b200,null))[_0x7b9a('0x1e')](removeEntity(_0x33b200,null))[_0x7b9a('0x3a')](handleError(_0x33b200,null));}; \ No newline at end of file +var _0x4ea3=['count','set','Content-Range','reject','save','update','then','destroy','stack','name','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','fields','query','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','FreshdeskField','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x4812e0,_0x2ccf3c){var _0x252e0f=function(_0x14cdb8){while(--_0x14cdb8){_0x4812e0['push'](_0x4812e0['shift']());}};_0x252e0f(++_0x2ccf3c);}(_0x4ea3,0x70));var _0x34ea=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4ea3[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x34ea('0x0'));var rimraf=require(_0x34ea('0x1'));var zipdir=require(_0x34ea('0x2'));var jsonpatch=require(_0x34ea('0x3'));var rp=require('request-promise');var moment=require(_0x34ea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x34ea('0x5'));var util=require('util');var path=require('path');var sox=require(_0x34ea('0x6'));var csv=require(_0x34ea('0x7'));var ejs=require(_0x34ea('0x8'));var fs=require('fs');var fs_extra=require(_0x34ea('0x9'));var _=require(_0x34ea('0xa'));var squel=require(_0x34ea('0xb'));var crypto=require(_0x34ea('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x34ea('0xd'));var toCsv=require(_0x34ea('0x7'));var querystring=require(_0x34ea('0xe'));var Papa=require('papaparse');var Redis=require(_0x34ea('0xf'));var authService=require(_0x34ea('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34ea('0x11'));var logger=require(_0x34ea('0x12'))(_0x34ea('0x13'));var utils=require('../../config/utils');var config=require(_0x34ea('0x14'));var licenseUtil=require(_0x34ea('0x15'));var db=require(_0x34ea('0x16'))['db'];function respondWithStatusCode(_0x233b11,_0x60725f){_0x60725f=_0x60725f||0xcc;return function(_0xc56a7d){if(_0xc56a7d){return _0x233b11[_0x34ea('0x17')](_0x60725f);}return _0x233b11[_0x34ea('0x18')](_0x60725f)[_0x34ea('0x19')]();};}function respondWithResult(_0x2a19c6,_0x36a4c6){_0x36a4c6=_0x36a4c6||0xc8;return function(_0x5ef9ae){if(_0x5ef9ae){return _0x2a19c6[_0x34ea('0x18')](_0x36a4c6)[_0x34ea('0x1a')](_0x5ef9ae);}};}function respondWithFilteredResult(_0x14ebb9,_0x3f9ffe){return function(_0x44e44e){if(_0x44e44e){var _0x56b2d7=typeof _0x3f9ffe[_0x34ea('0x1b')]===_0x34ea('0x1c')&&typeof _0x3f9ffe[_0x34ea('0x1d')]===_0x34ea('0x1c');var _0x5f420f=_0x44e44e[_0x34ea('0x1e')];var _0x34caea=_0x56b2d7?0x0:_0x3f9ffe[_0x34ea('0x1b')];var _0x5340a4=_0x56b2d7?_0x44e44e[_0x34ea('0x1e')]:_0x3f9ffe[_0x34ea('0x1b')]+_0x3f9ffe[_0x34ea('0x1d')];var _0x127308;if(_0x5340a4>=_0x5f420f){_0x5340a4=_0x5f420f;_0x127308=0xc8;}else{_0x127308=0xce;}_0x14ebb9['status'](_0x127308);return _0x14ebb9[_0x34ea('0x1f')](_0x34ea('0x20'),_0x34caea+'-'+_0x5340a4+'/'+_0x5f420f)[_0x34ea('0x1a')](_0x44e44e);}return null;};}function patchUpdates(_0x247ee7){return function(_0x4fc1a2){try{jsonpatch['apply'](_0x4fc1a2,_0x247ee7,!![]);}catch(_0xe3b292){return BPromise[_0x34ea('0x21')](_0xe3b292);}return _0x4fc1a2[_0x34ea('0x22')]();};}function saveUpdates(_0x51022f,_0x5197a2){return function(_0x2eafc6){if(_0x2eafc6){return _0x2eafc6[_0x34ea('0x23')](_0x51022f)[_0x34ea('0x24')](function(_0x30c4b0){return _0x30c4b0;});}return null;};}function removeEntity(_0x12e7e9,_0x697475){return function(_0x5ade46){if(_0x5ade46){return _0x5ade46[_0x34ea('0x25')]()[_0x34ea('0x24')](function(){_0x12e7e9[_0x34ea('0x18')](0xcc)[_0x34ea('0x19')]();});}};}function handleEntityNotFound(_0x5b5885,_0x56f320){return function(_0x564d1b){if(!_0x564d1b){_0x5b5885[_0x34ea('0x17')](0x194);}return _0x564d1b;};}function handleError(_0x187306,_0x37c214){_0x37c214=_0x37c214||0x1f4;return function(_0x4204d7){logger['error'](_0x4204d7[_0x34ea('0x26')]);if(_0x4204d7[_0x34ea('0x27')]){delete _0x4204d7[_0x34ea('0x27')];}_0x187306['status'](_0x37c214)['send'](_0x4204d7);};}exports['index']=function(_0x4d4360,_0x2942ce){var _0x6227db={},_0x859b7e={},_0x162081={'count':0x0,'rows':[]};var _0x56c9dd=_[_0x34ea('0x28')](db['FreshdeskField'][_0x34ea('0x29')],function(_0x4f2b77){return{'name':_0x4f2b77[_0x34ea('0x2a')],'type':_0x4f2b77[_0x34ea('0x2b')][_0x34ea('0x2c')]};});_0x859b7e['model']=_[_0x34ea('0x28')](_0x56c9dd,_0x34ea('0x27'));_0x859b7e['query']=_[_0x34ea('0x2d')](_0x4d4360['query']);_0x859b7e[_0x34ea('0x2e')]=_[_0x34ea('0x2f')](_0x859b7e[_0x34ea('0x30')],_0x859b7e['query']);_0x6227db['attributes']=_[_0x34ea('0x2f')](_0x859b7e['model'],qs[_0x34ea('0x31')](_0x4d4360[_0x34ea('0x32')]['fields']));_0x6227db[_0x34ea('0x33')]=_0x6227db[_0x34ea('0x33')][_0x34ea('0x34')]?_0x6227db[_0x34ea('0x33')]:_0x859b7e['model'];if(!_0x4d4360['query']['hasOwnProperty'](_0x34ea('0x35'))){_0x6227db[_0x34ea('0x1d')]=qs[_0x34ea('0x1d')](_0x4d4360['query']['limit']);_0x6227db['offset']=qs[_0x34ea('0x1b')](_0x4d4360[_0x34ea('0x32')]['offset']);}_0x6227db[_0x34ea('0x36')]=qs[_0x34ea('0x37')](_0x4d4360[_0x34ea('0x32')][_0x34ea('0x37')]);_0x6227db[_0x34ea('0x38')]=qs[_0x34ea('0x2e')](_['pick'](_0x4d4360[_0x34ea('0x32')],_0x859b7e[_0x34ea('0x2e')]),_0x56c9dd);if(_0x4d4360[_0x34ea('0x32')][_0x34ea('0x39')]){_0x6227db['where']=_['merge'](_0x6227db[_0x34ea('0x38')],{'$or':_[_0x34ea('0x28')](_0x56c9dd,function(_0xf39615){if(_0xf39615[_0x34ea('0x2b')]!==_0x34ea('0x3a')){var _0x4c696f={};_0x4c696f[_0xf39615[_0x34ea('0x27')]]={'$like':'%'+_0x4d4360[_0x34ea('0x32')][_0x34ea('0x39')]+'%'};return _0x4c696f;}})});}_0x6227db=_[_0x34ea('0x3b')]({},_0x6227db,_0x4d4360[_0x34ea('0x3c')]);var _0x4743f1={'where':_0x6227db[_0x34ea('0x38')]};return db[_0x34ea('0x3d')][_0x34ea('0x1e')](_0x4743f1)[_0x34ea('0x24')](function(_0x448bc0){_0x162081[_0x34ea('0x1e')]=_0x448bc0;if(_0x4d4360[_0x34ea('0x32')][_0x34ea('0x3e')]){_0x6227db[_0x34ea('0x3f')]=[{'all':!![]}];}return db[_0x34ea('0x3d')]['findAll'](_0x6227db);})[_0x34ea('0x24')](function(_0x4ae353){_0x162081[_0x34ea('0x40')]=_0x4ae353;return _0x162081;})[_0x34ea('0x24')](respondWithFilteredResult(_0x2942ce,_0x6227db))[_0x34ea('0x41')](handleError(_0x2942ce,null));};exports[_0x34ea('0x42')]=function(_0x2a57b5,_0x1b785b){var _0x35d81d={'raw':!![],'where':{'id':_0x2a57b5[_0x34ea('0x43')]['id']}},_0x17ba01={};_0x17ba01['model']=_[_0x34ea('0x2d')](db['FreshdeskField'][_0x34ea('0x29')]);_0x17ba01[_0x34ea('0x32')]=_[_0x34ea('0x2d')](_0x2a57b5[_0x34ea('0x32')]);_0x17ba01[_0x34ea('0x2e')]=_[_0x34ea('0x2f')](_0x17ba01['model'],_0x17ba01[_0x34ea('0x32')]);_0x35d81d[_0x34ea('0x33')]=_['intersection'](_0x17ba01[_0x34ea('0x30')],qs[_0x34ea('0x31')](_0x2a57b5[_0x34ea('0x32')][_0x34ea('0x31')]));_0x35d81d[_0x34ea('0x33')]=_0x35d81d['attributes'][_0x34ea('0x34')]?_0x35d81d[_0x34ea('0x33')]:_0x17ba01[_0x34ea('0x30')];if(_0x2a57b5[_0x34ea('0x32')][_0x34ea('0x3e')]){_0x35d81d[_0x34ea('0x3f')]=[{'all':!![]}];}_0x35d81d=_['merge']({},_0x35d81d,_0x2a57b5['options']);return db[_0x34ea('0x3d')][_0x34ea('0x44')](_0x35d81d)[_0x34ea('0x24')](handleEntityNotFound(_0x1b785b,null))['then'](respondWithResult(_0x1b785b,null))[_0x34ea('0x41')](handleError(_0x1b785b,null));};exports['create']=function(_0x16e9b7,_0x4cc586){return db[_0x34ea('0x3d')][_0x34ea('0x45')](_0x16e9b7[_0x34ea('0x46')],{})['then'](respondWithResult(_0x4cc586,0xc9))[_0x34ea('0x41')](handleError(_0x4cc586,null));};exports['update']=function(_0x404a59,_0x3fb739){if(_0x404a59[_0x34ea('0x46')]['id']){delete _0x404a59[_0x34ea('0x46')]['id'];}return db['FreshdeskField'][_0x34ea('0x44')]({'where':{'id':_0x404a59[_0x34ea('0x43')]['id']}})[_0x34ea('0x24')](handleEntityNotFound(_0x3fb739,null))[_0x34ea('0x24')](saveUpdates(_0x404a59[_0x34ea('0x46')],null))[_0x34ea('0x24')](respondWithResult(_0x3fb739,null))[_0x34ea('0x41')](handleError(_0x3fb739,null));};exports['destroy']=function(_0x1059dc,_0x224c53){return db[_0x34ea('0x3d')][_0x34ea('0x44')]({'where':{'id':_0x1059dc[_0x34ea('0x43')]['id']}})[_0x34ea('0x24')](handleEntityNotFound(_0x224c53,null))[_0x34ea('0x24')](removeEntity(_0x224c53,null))[_0x34ea('0x41')](handleError(_0x224c53,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 6c44df5..f8c695f 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 _0xc199=['idField','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields'];(function(_0x35485a,_0x91cdd4){var _0x5148e6=function(_0x27ed1d){while(--_0x27ed1d){_0x35485a['push'](_0x35485a['shift']());}};_0x5148e6(++_0x91cdd4);}(_0xc199,0xa9));var _0x9c19=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0xc199[_0x42bc91];return _0x3f5507;};'use strict';var _=require(_0x9c19('0x0'));var util=require('util');var logger=require(_0x9c19('0x1'))('api');var moment=require(_0x9c19('0x2'));var BPromise=require(_0x9c19('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c19('0x4'));var rimraf=require(_0x9c19('0x5'));var config=require(_0x9c19('0x6'));var attributes=require(_0x9c19('0x7'));module[_0x9c19('0x8')]=function(_0x19c193,_0x334d04){return _0x19c193['define'](_0x9c19('0x9'),attributes,{'tableName':_0x9c19('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x9c19('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4635=['rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xe4518b,_0x48523c){var _0x4b6b29=function(_0x39603c){while(--_0x39603c){_0xe4518b['push'](_0xe4518b['shift']());}};_0x4b6b29(++_0x48523c);}(_0x4635,0x80));var _0x5463=function(_0x3dad7f,_0x1f0244){_0x3dad7f=_0x3dad7f-0x0;var _0x43cea6=_0x4635[_0x3dad7f];return _0x43cea6;};'use strict';var _=require(_0x5463('0x0'));var util=require(_0x5463('0x1'));var logger=require(_0x5463('0x2'))(_0x5463('0x3'));var moment=require(_0x5463('0x4'));var BPromise=require(_0x5463('0x5'));var rp=require(_0x5463('0x6'));var fs=require('fs');var path=require(_0x5463('0x7'));var rimraf=require(_0x5463('0x8'));var config=require(_0x5463('0x9'));var attributes=require(_0x5463('0xa'));module[_0x5463('0xb')]=function(_0x545216,_0x5d28a3){return _0x545216[_0x5463('0xc')](_0x5463('0xd'),attributes,{'tableName':_0x5463('0xe'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x5463('0xf'),_0x5463('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index a6656c4..9342e5b 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 _0x8121=['request','then','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8121,0xf2));var _0x1812=function(_0x2cc4b9,_0x26b99d){_0x2cc4b9=_0x2cc4b9-0x0;var _0x49b85d=_0x8121[_0x2cc4b9];return _0x49b85d;};'use strict';var _=require(_0x1812('0x0'));var util=require(_0x1812('0x1'));var moment=require(_0x1812('0x2'));var BPromise=require(_0x1812('0x3'));var rs=require(_0x1812('0x4'));var fs=require('fs');var Redis=require(_0x1812('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1812('0x6'));var logger=require('../../config/logger')(_0x1812('0x7'));var config=require(_0x1812('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1812('0x9')][_0x1812('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f551e,_0xb81bcc,_0x56f396){return new BPromise(function(_0x16e02d,_0x5e86d3){return client[_0x1812('0xb')](_0x1f551e,_0x56f396)[_0x1812('0xc')](function(_0x5e41bb){logger[_0x1812('0xd')](_0x1812('0xe'),_0xb81bcc,'request\x20sent');logger[_0x1812('0xf')](_0x1812('0x10'),_0xb81bcc,'request\x20sent',JSON[_0x1812('0x11')](_0x5e41bb));if(_0x5e41bb[_0x1812('0x12')]){if(_0x5e41bb[_0x1812('0x12')][_0x1812('0x13')]===0x1f4){logger[_0x1812('0x12')](_0x1812('0xe'),_0xb81bcc,_0x5e41bb[_0x1812('0x12')][_0x1812('0x14')]);return _0x5e86d3(_0x5e41bb[_0x1812('0x12')][_0x1812('0x14')]);}logger['error'](_0x1812('0xe'),_0xb81bcc,_0x5e41bb['error']['message']);return _0x16e02d(_0x5e41bb[_0x1812('0x12')][_0x1812('0x14')]);}else{logger[_0x1812('0xd')](_0x1812('0xe'),_0xb81bcc,_0x1812('0x15'));_0x16e02d(_0x5e41bb[_0x1812('0x16')][_0x1812('0x14')]);}})['catch'](function(_0x24e5ab){logger[_0x1812('0x12')](_0x1812('0xe'),_0xb81bcc,_0x24e5ab);_0x5e86d3(_0x24e5ab);});});} \ No newline at end of file +var _0xaf9c=['request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x483e3a,_0x568361){var _0x43fca9=function(_0x273d7e){while(--_0x273d7e){_0x483e3a['push'](_0x483e3a['shift']());}};_0x43fca9(++_0x568361);}(_0xaf9c,0x87));var _0xcaf9=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xaf9c[_0x42bdad];return _0x122626;};'use strict';var _=require(_0xcaf9('0x0'));var util=require(_0xcaf9('0x1'));var moment=require(_0xcaf9('0x2'));var BPromise=require(_0xcaf9('0x3'));var rs=require(_0xcaf9('0x4'));var fs=require('fs');var Redis=require(_0xcaf9('0x5'));var db=require(_0xcaf9('0x6'))['db'];var utils=require(_0xcaf9('0x7'));var logger=require(_0xcaf9('0x8'))('rpc');var config=require(_0xcaf9('0x9'));var jayson=require(_0xcaf9('0xa'));var client=jayson['client'][_0xcaf9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b1814,_0x15fdc5,_0x482a25){return new BPromise(function(_0x9c6dd6,_0x5aef08){return client[_0xcaf9('0xc')](_0x5b1814,_0x482a25)[_0xcaf9('0xd')](function(_0x510a37){logger[_0xcaf9('0xe')](_0xcaf9('0xf'),_0x15fdc5,_0xcaf9('0x10'));logger['debug'](_0xcaf9('0x11'),_0x15fdc5,_0xcaf9('0x10'),JSON['stringify'](_0x510a37));if(_0x510a37[_0xcaf9('0x12')]){if(_0x510a37[_0xcaf9('0x12')]['code']===0x1f4){logger[_0xcaf9('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x15fdc5,_0x510a37[_0xcaf9('0x12')][_0xcaf9('0x13')]);return _0x5aef08(_0x510a37[_0xcaf9('0x12')][_0xcaf9('0x13')]);}logger[_0xcaf9('0x12')](_0xcaf9('0xf'),_0x15fdc5,_0x510a37[_0xcaf9('0x12')][_0xcaf9('0x13')]);return _0x9c6dd6(_0x510a37[_0xcaf9('0x12')][_0xcaf9('0x13')]);}else{logger['info'](_0xcaf9('0xf'),_0x15fdc5,_0xcaf9('0x10'));_0x9c6dd6(_0x510a37[_0xcaf9('0x14')][_0xcaf9('0x13')]);}})['catch'](function(_0x5885b4){logger[_0xcaf9('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x15fdc5,_0x5885b4);_0x5aef08(_0x5885b4);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index e2ec850..69491cf 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 _0x0fd9=['../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x2971e6,_0x4a962e){var _0x5e6392=function(_0x16e6cf){while(--_0x16e6cf){_0x2971e6['push'](_0x2971e6['shift']());}};_0x5e6392(++_0x4a962e);}(_0x0fd9,0xa3));var _0x90fd=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0x0fd9[_0x272638];return _0x19d027;};'use strict';var multer=require('multer');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var timeout=require(_0x90fd('0x2'));var express=require(_0x90fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90fd('0x4'));var interaction=require(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var controller=require(_0x90fd('0x7'));router[_0x90fd('0x8')]('/',auth[_0x90fd('0x9')](),controller['index']);router['get'](_0x90fd('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x90fd('0x8')](_0x90fd('0xb'),auth['isAuthenticated'](),controller[_0x90fd('0xc')]);router[_0x90fd('0x8')](_0x90fd('0xd'),auth[_0x90fd('0x9')](),controller[_0x90fd('0xe')]);router[_0x90fd('0xf')]('/',auth[_0x90fd('0x9')](),controller[_0x90fd('0x10')]);router[_0x90fd('0xf')]('/:id/configurations',auth[_0x90fd('0x9')](),controller[_0x90fd('0x11')]);router['put'](_0x90fd('0xa'),auth[_0x90fd('0x9')](),controller[_0x90fd('0x12')]);router['delete'](_0x90fd('0xa'),auth['isAuthenticated'](),controller[_0x90fd('0x13')]);module[_0x90fd('0x14')]=router; \ No newline at end of file +var _0x7af2=['getConfigurations','/:id/configurations','addConfiguration','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7af2,0x119));var _0x27af=function(_0x2cd1a1,_0x5830e4){_0x2cd1a1=_0x2cd1a1-0x0;var _0x15091c=_0x7af2[_0x2cd1a1];return _0x15091c;};'use strict';var multer=require('multer');var util=require(_0x27af('0x0'));var path=require(_0x27af('0x1'));var timeout=require(_0x27af('0x2'));var express=require(_0x27af('0x3'));var router=express['Router']();var fs_extra=require(_0x27af('0x4'));var auth=require(_0x27af('0x5'));var interaction=require(_0x27af('0x6'));var config=require(_0x27af('0x7'));var controller=require(_0x27af('0x8'));router[_0x27af('0x9')]('/',auth[_0x27af('0xa')](),controller[_0x27af('0xb')]);router[_0x27af('0x9')]('/:id',auth[_0x27af('0xa')](),controller[_0x27af('0xc')]);router[_0x27af('0x9')]('/:id/configurations',auth[_0x27af('0xa')](),controller[_0x27af('0xd')]);router[_0x27af('0x9')]('/:id/fields',auth[_0x27af('0xa')](),controller['getFields']);router['post']('/',auth[_0x27af('0xa')](),controller['create']);router['post'](_0x27af('0xe'),auth['isAuthenticated'](),controller[_0x27af('0xf')]);router['put'](_0x27af('0x10'),auth[_0x27af('0xa')](),controller[_0x27af('0x11')]);router[_0x27af('0x12')](_0x27af('0x10'),auth[_0x27af('0xa')](),controller[_0x27af('0x13')]);module[_0x27af('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index e21ef17..589f5ed 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 _0x32f4=['sequelize','exports','STRING','username','remoteUri'];(function(_0x78db5e,_0x3b9804){var _0x250b88=function(_0x20a40f){while(--_0x20a40f){_0x78db5e['push'](_0x78db5e['shift']());}};_0x250b88(++_0x3b9804);}(_0x32f4,0x154));var _0x432f=function(_0x503bd9,_0x53a90f){_0x503bd9=_0x503bd9-0x0;var _0x5bcb7c=_0x32f4[_0x503bd9];return _0x5bcb7c;};'use strict';var Sequelize=require(_0x432f('0x0'));module[_0x432f('0x1')]={'name':{'type':Sequelize[_0x432f('0x2')]},'description':{'type':Sequelize[_0x432f('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x432f('0x3')},'apiKey':{'type':Sequelize[_0x432f('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x432f('0x4')},'serverUrl':{'type':Sequelize[_0x432f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xcf2f=['exports','STRING','remoteUri','sequelize'];(function(_0x50460e,_0xf5caa1){var _0x31a993=function(_0x5bdfd5){while(--_0x5bdfd5){_0x50460e['push'](_0x50460e['shift']());}};_0x31a993(++_0xf5caa1);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x3f7bfb,_0x761dd7){_0x3f7bfb=_0x3f7bfb-0x0;var _0xe05ac3=_0xcf2f[_0x3f7bfb];return _0xe05ac3;};'use strict';var Sequelize=require(_0xfcf2('0x0'));module[_0xfcf2('0x1')]={'name':{'type':Sequelize[_0xfcf2('0x2')]},'description':{'type':Sequelize[_0xfcf2('0x2')]},'username':{'type':Sequelize[_0xfcf2('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xfcf2('0x2')]},'remoteUri':{'type':Sequelize[_0xfcf2('0x2')],'unique':_0xfcf2('0x3')},'serverUrl':{'type':Sequelize[_0xfcf2('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 65bb0d6..57d6587 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 _0x90f6=['set','Content-Range','apply','reject','destroy','then','stack','name','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','options','FreshsalesAccount','includeAll','findAll','catch','show','include','merge','find','create','body','update','params','getConfigurations','FreshsalesConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','findOne','username','apiKey','remoteUri','slice','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x29cb36,_0x5f1049){var _0x11c1a6=function(_0x37a894){while(--_0x37a894){_0x29cb36['push'](_0x29cb36['shift']());}};_0x11c1a6(++_0x5f1049);}(_0x90f6,0x114));var _0x690f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90f6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x690f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x690f('0x1'));var jsonpatch=require(_0x690f('0x2'));var rp=require(_0x690f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x690f('0x4'));var path=require(_0x690f('0x5'));var sox=require(_0x690f('0x6'));var csv=require('to-csv');var ejs=require(_0x690f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x690f('0x8'));var squel=require(_0x690f('0x9'));var crypto=require(_0x690f('0xa'));var jsforce=require(_0x690f('0xb'));var deskjs=require(_0x690f('0xc'));var toCsv=require(_0x690f('0xd'));var querystring=require(_0x690f('0xe'));var Papa=require(_0x690f('0xf'));var Redis=require(_0x690f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x690f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x690f('0x12'));var logger=require(_0x690f('0x13'))(_0x690f('0x14'));var utils=require('../../config/utils');var config=require(_0x690f('0x15'));var licenseUtil=require(_0x690f('0x16'));var db=require(_0x690f('0x17'))['db'];var integrations=require(_0x690f('0x18'));function respondWithStatusCode(_0x245940,_0x3001de){_0x3001de=_0x3001de||0xcc;return function(_0x40dc20){if(_0x40dc20){return _0x245940[_0x690f('0x19')](_0x3001de);}return _0x245940[_0x690f('0x1a')](_0x3001de)[_0x690f('0x1b')]();};}function respondWithResult(_0x44b227,_0x32d37b){_0x32d37b=_0x32d37b||0xc8;return function(_0x4ba16f){if(_0x4ba16f){return _0x44b227[_0x690f('0x1a')](_0x32d37b)[_0x690f('0x1c')](_0x4ba16f);}};}function respondWithFilteredResult(_0x55ca0d,_0x3afed4){return function(_0x14c4cf){if(_0x14c4cf){var _0x1e7f3f=typeof _0x3afed4[_0x690f('0x1d')]===_0x690f('0x1e')&&typeof _0x3afed4[_0x690f('0x1f')]==='undefined';var _0x3b3018=_0x14c4cf['count'];var _0x370a24=_0x1e7f3f?0x0:_0x3afed4['offset'];var _0x4a5c10=_0x1e7f3f?_0x14c4cf[_0x690f('0x20')]:_0x3afed4['offset']+_0x3afed4[_0x690f('0x1f')];var _0x435666;if(_0x4a5c10>=_0x3b3018){_0x4a5c10=_0x3b3018;_0x435666=0xc8;}else{_0x435666=0xce;}_0x55ca0d[_0x690f('0x1a')](_0x435666);return _0x55ca0d[_0x690f('0x21')](_0x690f('0x22'),_0x370a24+'-'+_0x4a5c10+'/'+_0x3b3018)[_0x690f('0x1c')](_0x14c4cf);}return null;};}function patchUpdates(_0x27a308){return function(_0x10ab5c){try{jsonpatch[_0x690f('0x23')](_0x10ab5c,_0x27a308,!![]);}catch(_0x121ca7){return BPromise[_0x690f('0x24')](_0x121ca7);}return _0x10ab5c['save']();};}function saveUpdates(_0x25ffbd,_0x1cb0fc){return function(_0x3ce07f){if(_0x3ce07f){return _0x3ce07f['update'](_0x25ffbd)['then'](function(_0x2ae741){return _0x2ae741;});}return null;};}function removeEntity(_0x55bb3d,_0x179331){return function(_0x541ccb){if(_0x541ccb){return _0x541ccb[_0x690f('0x25')]()[_0x690f('0x26')](function(){_0x55bb3d[_0x690f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x279e24,_0x5c8e50){return function(_0x1fa8e6){if(!_0x1fa8e6){_0x279e24[_0x690f('0x19')](0x194);}return _0x1fa8e6;};}function handleError(_0x36419,_0x279f53){_0x279f53=_0x279f53||0x1f4;return function(_0x299c65){logger['error'](_0x299c65[_0x690f('0x27')]);if(_0x299c65[_0x690f('0x28')]){delete _0x299c65[_0x690f('0x28')];}_0x36419[_0x690f('0x1a')](_0x279f53)['send'](_0x299c65);};}exports['index']=function(_0xb2e728,_0x4d5cdf){var _0x38fb10={},_0x31262d={},_0x10c588={'count':0x0,'rows':[]};var _0xa3d0ac=_['map'](db['FreshsalesAccount'][_0x690f('0x29')],function(_0x195418){return{'name':_0x195418[_0x690f('0x2a')],'type':_0x195418[_0x690f('0x2b')][_0x690f('0x2c')]};});_0x31262d['model']=_[_0x690f('0x2d')](_0xa3d0ac,_0x690f('0x28'));_0x31262d['query']=_[_0x690f('0x2e')](_0xb2e728[_0x690f('0x2f')]);_0x31262d[_0x690f('0x30')]=_[_0x690f('0x31')](_0x31262d[_0x690f('0x32')],_0x31262d[_0x690f('0x2f')]);_0x38fb10[_0x690f('0x33')]=_[_0x690f('0x31')](_0x31262d[_0x690f('0x32')],qs[_0x690f('0x34')](_0xb2e728[_0x690f('0x2f')][_0x690f('0x34')]));_0x38fb10[_0x690f('0x33')]=_0x38fb10[_0x690f('0x33')][_0x690f('0x35')]?_0x38fb10[_0x690f('0x33')]:_0x31262d['model'];if(!_0xb2e728['query'][_0x690f('0x36')]('nolimit')){_0x38fb10[_0x690f('0x1f')]=qs[_0x690f('0x1f')](_0xb2e728[_0x690f('0x2f')]['limit']);_0x38fb10['offset']=qs[_0x690f('0x1d')](_0xb2e728[_0x690f('0x2f')][_0x690f('0x1d')]);}_0x38fb10[_0x690f('0x37')]=qs[_0x690f('0x38')](_0xb2e728[_0x690f('0x2f')][_0x690f('0x38')]);_0x38fb10[_0x690f('0x39')]=qs[_0x690f('0x30')](_['pick'](_0xb2e728['query'],_0x31262d[_0x690f('0x30')]),_0xa3d0ac);if(_0xb2e728[_0x690f('0x2f')][_0x690f('0x3a')]){_0x38fb10['where']=_['merge'](_0x38fb10[_0x690f('0x39')],{'$or':_['map'](_0xa3d0ac,function(_0x40c18f){if(_0x40c18f[_0x690f('0x2b')]!==_0x690f('0x3b')){var _0xc525dc={};_0xc525dc[_0x40c18f[_0x690f('0x28')]]={'$like':'%'+_0xb2e728[_0x690f('0x2f')][_0x690f('0x3a')]+'%'};return _0xc525dc;}})});}_0x38fb10=_['merge']({},_0x38fb10,_0xb2e728[_0x690f('0x3c')]);var _0x51bc18={'where':_0x38fb10[_0x690f('0x39')]};return db[_0x690f('0x3d')][_0x690f('0x20')](_0x51bc18)[_0x690f('0x26')](function(_0xf32209){_0x10c588['count']=_0xf32209;if(_0xb2e728[_0x690f('0x2f')][_0x690f('0x3e')]){_0x38fb10['include']=[{'all':!![]}];}return db[_0x690f('0x3d')][_0x690f('0x3f')](_0x38fb10);})['then'](function(_0x209ef5){_0x10c588['rows']=_0x209ef5;return _0x10c588;})['then'](respondWithFilteredResult(_0x4d5cdf,_0x38fb10))[_0x690f('0x40')](handleError(_0x4d5cdf,null));};exports[_0x690f('0x41')]=function(_0x4a1284,_0x212a1f){var _0x40734f={'raw':![],'where':{'id':_0x4a1284['params']['id']}},_0x12f624={};_0x12f624[_0x690f('0x32')]=_[_0x690f('0x2e')](db[_0x690f('0x3d')]['rawAttributes']);_0x12f624[_0x690f('0x2f')]=_[_0x690f('0x2e')](_0x4a1284['query']);_0x12f624[_0x690f('0x30')]=_[_0x690f('0x31')](_0x12f624[_0x690f('0x32')],_0x12f624[_0x690f('0x2f')]);_0x40734f['attributes']=_[_0x690f('0x31')](_0x12f624[_0x690f('0x32')],qs['fields'](_0x4a1284[_0x690f('0x2f')]['fields']));_0x40734f['attributes']=_0x40734f['attributes'][_0x690f('0x35')]?_0x40734f[_0x690f('0x33')]:_0x12f624[_0x690f('0x32')];if(_0x4a1284[_0x690f('0x2f')]['includeAll']){_0x40734f[_0x690f('0x42')]=[{'all':!![]}];}_0x40734f=_[_0x690f('0x43')]({},_0x40734f,_0x4a1284[_0x690f('0x3c')]);return db[_0x690f('0x3d')][_0x690f('0x44')](_0x40734f)[_0x690f('0x26')](handleEntityNotFound(_0x212a1f,null))[_0x690f('0x26')](respondWithResult(_0x212a1f,null))['catch'](handleError(_0x212a1f,null));};exports['create']=function(_0x1bc806,_0x127fe9){return db[_0x690f('0x3d')][_0x690f('0x45')](_0x1bc806[_0x690f('0x46')],{})[_0x690f('0x26')](respondWithResult(_0x127fe9,0xc9))[_0x690f('0x40')](handleError(_0x127fe9,null));};exports[_0x690f('0x47')]=function(_0x286454,_0xbe9dfe){if(_0x286454[_0x690f('0x46')]['id']){delete _0x286454[_0x690f('0x46')]['id'];}return db[_0x690f('0x3d')]['find']({'where':{'id':_0x286454[_0x690f('0x48')]['id']}})[_0x690f('0x26')](handleEntityNotFound(_0xbe9dfe,null))[_0x690f('0x26')](saveUpdates(_0x286454[_0x690f('0x46')],null))[_0x690f('0x26')](respondWithResult(_0xbe9dfe,null))[_0x690f('0x40')](handleError(_0xbe9dfe,null));};exports[_0x690f('0x25')]=function(_0x49495c,_0x325da1){return db[_0x690f('0x3d')][_0x690f('0x44')]({'where':{'id':_0x49495c[_0x690f('0x48')]['id']}})[_0x690f('0x26')](handleEntityNotFound(_0x325da1,null))[_0x690f('0x26')](removeEntity(_0x325da1,null))[_0x690f('0x40')](handleError(_0x325da1,null));};exports[_0x690f('0x49')]=function(_0x4a3135,_0x46ec35,_0x93d93a){var _0x18b1b3={};var _0xda0c92={};var _0x5562ca;var _0x39463d;return db[_0x690f('0x3d')]['findOne']({'where':{'id':_0x4a3135['params']['id']}})[_0x690f('0x26')](handleEntityNotFound(_0x46ec35,null))['then'](function(_0x2c9d35){if(_0x2c9d35){_0x5562ca=_0x2c9d35;_0xda0c92[_0x690f('0x32')]=_['keys'](db[_0x690f('0x4a')]['rawAttributes']);_0xda0c92[_0x690f('0x2f')]=_[_0x690f('0x2e')](_0x4a3135[_0x690f('0x2f')]);_0xda0c92[_0x690f('0x30')]=_[_0x690f('0x31')](_0xda0c92[_0x690f('0x32')],_0xda0c92[_0x690f('0x2f')]);_0x18b1b3['attributes']=_[_0x690f('0x31')](_0xda0c92['model'],qs[_0x690f('0x34')](_0x4a3135[_0x690f('0x2f')][_0x690f('0x34')]));_0x18b1b3[_0x690f('0x33')]=_0x18b1b3[_0x690f('0x33')][_0x690f('0x35')]?_0x18b1b3['attributes']:_0xda0c92[_0x690f('0x32')];_0x18b1b3[_0x690f('0x37')]=qs['sort'](_0x4a3135['query'][_0x690f('0x38')]);_0x18b1b3['where']=qs['filters'](_[_0x690f('0x4b')](_0x4a3135[_0x690f('0x2f')],_0xda0c92[_0x690f('0x30')]));if(_0x4a3135[_0x690f('0x2f')][_0x690f('0x3a')]){_0x18b1b3[_0x690f('0x39')]=_[_0x690f('0x43')](_0x18b1b3[_0x690f('0x39')],{'$or':_['map'](_0x18b1b3[_0x690f('0x33')],function(_0x4f4642){var _0x41ce34={};_0x41ce34[_0x4f4642]={'$like':'%'+_0x4a3135[_0x690f('0x2f')][_0x690f('0x3a')]+'%'};return _0x41ce34;})});}_0x18b1b3=_[_0x690f('0x43')]({},_0x18b1b3,_0x4a3135[_0x690f('0x3c')]);return _0x5562ca[_0x690f('0x49')](_0x18b1b3);}})[_0x690f('0x26')](function(_0x4940da){if(_0x4940da){_0x39463d=_0x4940da[_0x690f('0x35')];if(!_0x4a3135[_0x690f('0x2f')][_0x690f('0x36')](_0x690f('0x4c'))){_0x18b1b3[_0x690f('0x1f')]=qs[_0x690f('0x1f')](_0x4a3135['query'][_0x690f('0x1f')]);_0x18b1b3['offset']=qs[_0x690f('0x1d')](_0x4a3135[_0x690f('0x2f')]['offset']);}return _0x5562ca['getConfigurations'](_0x18b1b3);}})[_0x690f('0x26')](function(_0x281952){if(_0x281952){return _0x281952?{'count':_0x39463d,'rows':_0x281952}:null;}})[_0x690f('0x26')](respondWithResult(_0x46ec35,null))[_0x690f('0x40')](handleError(_0x46ec35,null));};exports[_0x690f('0x4d')]=function(_0x3831fa,_0x26d8b1,_0x1ce860){if(_0x3831fa[_0x690f('0x46')]['id']){delete _0x3831fa[_0x690f('0x46')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x3831fa[_0x690f('0x48')]['id']}})[_0x690f('0x26')](handleEntityNotFound(_0x26d8b1,null))[_0x690f('0x26')](function(_0xa05ddb){if(_0xa05ddb){_0x3831fa[_0x690f('0x46')][_0x690f('0x4e')]=_0xa05ddb['id'];_0x3831fa[_0x690f('0x46')][_0x690f('0x4f')]=integrations[_0x690f('0x50')](_0x3831fa['body'][_0x690f('0x51')],_0x3831fa[_0x690f('0x46')][_0x690f('0x2b')]);_0x3831fa[_0x690f('0x46')][_0x690f('0x52')]=integrations[_0x690f('0x53')](_0x3831fa[_0x690f('0x46')][_0x690f('0x51')],_0x3831fa[_0x690f('0x46')][_0x690f('0x2b')]);return db[_0x690f('0x4a')][_0x690f('0x45')](_0x3831fa[_0x690f('0x46')],{'include':[{'model':db['FreshsalesField'],'as':_0x690f('0x4f')},{'model':db['FreshsalesField'],'as':_0x690f('0x52')}]});}return null;})['then'](respondWithResult(_0x26d8b1,null))[_0x690f('0x40')](handleError(_0x26d8b1,null));};exports[_0x690f('0x54')]=function(_0x1ebebb,_0x10865f,_0x51be75){var _0x350b29='';var _0x5a53fd='';return db['FreshsalesAccount'][_0x690f('0x55')]({'where':{'id':_0x1ebebb[_0x690f('0x48')]['id']},'attributes':['id',_0x690f('0x56'),'remoteUri',_0x690f('0x57')]})[_0x690f('0x26')](handleEntityNotFound(_0x10865f,null))[_0x690f('0x26')](function(_0x5aa602){if(_0x5aa602){_0x5a53fd=_0x5aa602[_0x690f('0x56')];_0x350b29=_0x5aa602['remoteUri'];var _0x4d48d5=_0x5aa602[_0x690f('0x58')][_0x690f('0x59')](-0x1);if(_0x4d48d5==='/'){_0x350b29=_0x350b29['substring'](0x0,_0x350b29['lastIndexOf'](_0x4d48d5));}return rp({'method':_0x690f('0x5a'),'uri':util[_0x690f('0x5b')](_0x690f('0x5c'),_0x350b29,_0x690f('0x5d')),'headers':{'Authorization':_0x690f('0x5e')+_0x5aa602[_0x690f('0x57')]},'json':!![]});}})[_0x690f('0x26')](function(_0x4c81e6){if(_0x4c81e6){var _0x1d6f95=_0x4c81e6[_0x690f('0x5f')];var _0x54ac17=![];var _0x26226e=null;for(_0x26226e=0x0;_0x26226e<_0x1d6f95[_0x690f('0x35')];_0x26226e++){if(_0x1d6f95[_0x26226e][_0x690f('0x60')]===_0x5a53fd){_0x54ac17=!![];}}if(_0x54ac17){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x690f('0x61')});}}})[_0x690f('0x26')](respondWithResult(_0x10865f,null))['catch'](function(_0x2e4ef6){var _0x3b741d=_0x1ebebb[_0x690f('0x2f')][_0x690f('0x62')]?0x1f4:_0x2e4ef6[_0x690f('0x63')]||0x1f4;logger[_0x690f('0x64')](_0x690f('0x65'),_0x690f('0x54'),_0x3b741d,JSON[_0x690f('0x66')](_0x2e4ef6));delete _0x2e4ef6[_0x690f('0x28')];if(_0x3b741d===0x191){_0x3b741d=0x190;}_0x10865f['status'](_0x3b741d)['send'](_0x1ebebb[_0x690f('0x2f')][_0x690f('0x62')]?{'message':'Wrong\x20credentials','statusCode':_0x2e4ef6[_0x690f('0x63')]}:_0x2e4ef6);});}; \ No newline at end of file +var _0x5c15=['params','keys','find','create','body','update','getConfigurations','FreshsalesConfiguration','merge','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','findOne','username','apiKey','remoteUri','slice','GET','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','then','sendStatus','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','options','includeAll','include','findAll','rows','catch'];(function(_0x429194,_0x4ea940){var _0x66fd30=function(_0x2f6232){while(--_0x2f6232){_0x429194['push'](_0x429194['shift']());}};_0x66fd30(++_0x4ea940);}(_0x5c15,0xe3));var _0x55c1=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x5c15[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require(_0x55c1('0x0'));var rimraf=require(_0x55c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x55c1('0x2'));var rp=require(_0x55c1('0x3'));var moment=require(_0x55c1('0x4'));var BPromise=require(_0x55c1('0x5'));var Mustache=require(_0x55c1('0x6'));var util=require('util');var path=require('path');var sox=require(_0x55c1('0x7'));var csv=require(_0x55c1('0x8'));var ejs=require(_0x55c1('0x9'));var fs=require('fs');var fs_extra=require(_0x55c1('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x55c1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x55c1('0x8'));var querystring=require(_0x55c1('0xc'));var Papa=require('papaparse');var Redis=require(_0x55c1('0xd'));var authService=require(_0x55c1('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x55c1('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x55c1('0x10'))(_0x55c1('0x11'));var utils=require(_0x55c1('0x12'));var config=require(_0x55c1('0x13'));var licenseUtil=require(_0x55c1('0x14'));var db=require(_0x55c1('0x15'))['db'];var integrations=require(_0x55c1('0x16'));function respondWithStatusCode(_0xec8bb3,_0x41dfaa){_0x41dfaa=_0x41dfaa||0xcc;return function(_0x4e9e67){if(_0x4e9e67){return _0xec8bb3['sendStatus'](_0x41dfaa);}return _0xec8bb3[_0x55c1('0x17')](_0x41dfaa)[_0x55c1('0x18')]();};}function respondWithResult(_0x5b64cd,_0x5bea48){_0x5bea48=_0x5bea48||0xc8;return function(_0x10275d){if(_0x10275d){return _0x5b64cd['status'](_0x5bea48)[_0x55c1('0x19')](_0x10275d);}};}function respondWithFilteredResult(_0x21e6d9,_0x46774d){return function(_0x3e14db){if(_0x3e14db){var _0x4d0dae=typeof _0x46774d[_0x55c1('0x1a')]===_0x55c1('0x1b')&&typeof _0x46774d[_0x55c1('0x1c')]===_0x55c1('0x1b');var _0x248e08=_0x3e14db['count'];var _0x3f2e13=_0x4d0dae?0x0:_0x46774d[_0x55c1('0x1a')];var _0x5f0a8f=_0x4d0dae?_0x3e14db[_0x55c1('0x1d')]:_0x46774d[_0x55c1('0x1a')]+_0x46774d[_0x55c1('0x1c')];var _0x51e3ca;if(_0x5f0a8f>=_0x248e08){_0x5f0a8f=_0x248e08;_0x51e3ca=0xc8;}else{_0x51e3ca=0xce;}_0x21e6d9[_0x55c1('0x17')](_0x51e3ca);return _0x21e6d9['set'](_0x55c1('0x1e'),_0x3f2e13+'-'+_0x5f0a8f+'/'+_0x248e08)[_0x55c1('0x19')](_0x3e14db);}return null;};}function patchUpdates(_0x700ea1){return function(_0x327f78){try{jsonpatch[_0x55c1('0x1f')](_0x327f78,_0x700ea1,!![]);}catch(_0x54ff4b){return BPromise[_0x55c1('0x20')](_0x54ff4b);}return _0x327f78['save']();};}function saveUpdates(_0x5e76da,_0x309e9d){return function(_0x20b2a9){if(_0x20b2a9){return _0x20b2a9['update'](_0x5e76da)['then'](function(_0x1818a2){return _0x1818a2;});}return null;};}function removeEntity(_0x1a276a,_0x23689f){return function(_0x3b4298){if(_0x3b4298){return _0x3b4298[_0x55c1('0x21')]()[_0x55c1('0x22')](function(){_0x1a276a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38f215,_0x4ba7b5){return function(_0x31730b){if(!_0x31730b){_0x38f215[_0x55c1('0x23')](0x194);}return _0x31730b;};}function handleError(_0x394c96,_0x226c98){_0x226c98=_0x226c98||0x1f4;return function(_0x3dd904){logger['error'](_0x3dd904[_0x55c1('0x24')]);if(_0x3dd904['name']){delete _0x3dd904[_0x55c1('0x25')];}_0x394c96[_0x55c1('0x17')](_0x226c98)[_0x55c1('0x26')](_0x3dd904);};}exports[_0x55c1('0x27')]=function(_0x411707,_0x5353f9){var _0x37535f={},_0x321c0d={},_0x45b83d={'count':0x0,'rows':[]};var _0x910820=_[_0x55c1('0x28')](db[_0x55c1('0x29')][_0x55c1('0x2a')],function(_0x23a636){return{'name':_0x23a636[_0x55c1('0x2b')],'type':_0x23a636[_0x55c1('0x2c')]['key']};});_0x321c0d['model']=_[_0x55c1('0x28')](_0x910820,_0x55c1('0x25'));_0x321c0d['query']=_['keys'](_0x411707['query']);_0x321c0d['filters']=_[_0x55c1('0x2d')](_0x321c0d[_0x55c1('0x2e')],_0x321c0d[_0x55c1('0x2f')]);_0x37535f[_0x55c1('0x30')]=_[_0x55c1('0x2d')](_0x321c0d[_0x55c1('0x2e')],qs[_0x55c1('0x31')](_0x411707[_0x55c1('0x2f')][_0x55c1('0x31')]));_0x37535f[_0x55c1('0x30')]=_0x37535f[_0x55c1('0x30')][_0x55c1('0x32')]?_0x37535f[_0x55c1('0x30')]:_0x321c0d[_0x55c1('0x2e')];if(!_0x411707[_0x55c1('0x2f')][_0x55c1('0x33')]('nolimit')){_0x37535f['limit']=qs['limit'](_0x411707['query'][_0x55c1('0x1c')]);_0x37535f[_0x55c1('0x1a')]=qs['offset'](_0x411707['query'][_0x55c1('0x1a')]);}_0x37535f[_0x55c1('0x34')]=qs[_0x55c1('0x35')](_0x411707[_0x55c1('0x2f')][_0x55c1('0x35')]);_0x37535f[_0x55c1('0x36')]=qs['filters'](_[_0x55c1('0x37')](_0x411707['query'],_0x321c0d[_0x55c1('0x38')]),_0x910820);if(_0x411707[_0x55c1('0x2f')]['filter']){_0x37535f[_0x55c1('0x36')]=_['merge'](_0x37535f[_0x55c1('0x36')],{'$or':_[_0x55c1('0x28')](_0x910820,function(_0x5a6176){if(_0x5a6176[_0x55c1('0x2c')]!=='VIRTUAL'){var _0x24a92c={};_0x24a92c[_0x5a6176[_0x55c1('0x25')]]={'$like':'%'+_0x411707[_0x55c1('0x2f')][_0x55c1('0x39')]+'%'};return _0x24a92c;}})});}_0x37535f=_['merge']({},_0x37535f,_0x411707[_0x55c1('0x3a')]);var _0x5ef15f={'where':_0x37535f[_0x55c1('0x36')]};return db['FreshsalesAccount'][_0x55c1('0x1d')](_0x5ef15f)[_0x55c1('0x22')](function(_0x50ea79){_0x45b83d['count']=_0x50ea79;if(_0x411707[_0x55c1('0x2f')][_0x55c1('0x3b')]){_0x37535f[_0x55c1('0x3c')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x55c1('0x3d')](_0x37535f);})[_0x55c1('0x22')](function(_0x57127f){_0x45b83d[_0x55c1('0x3e')]=_0x57127f;return _0x45b83d;})[_0x55c1('0x22')](respondWithFilteredResult(_0x5353f9,_0x37535f))[_0x55c1('0x3f')](handleError(_0x5353f9,null));};exports['show']=function(_0x210d38,_0x49d4ce){var _0x57df23={'raw':![],'where':{'id':_0x210d38[_0x55c1('0x40')]['id']}},_0xacfbe0={};_0xacfbe0[_0x55c1('0x2e')]=_[_0x55c1('0x41')](db['FreshsalesAccount'][_0x55c1('0x2a')]);_0xacfbe0[_0x55c1('0x2f')]=_['keys'](_0x210d38['query']);_0xacfbe0[_0x55c1('0x38')]=_[_0x55c1('0x2d')](_0xacfbe0[_0x55c1('0x2e')],_0xacfbe0[_0x55c1('0x2f')]);_0x57df23[_0x55c1('0x30')]=_[_0x55c1('0x2d')](_0xacfbe0['model'],qs[_0x55c1('0x31')](_0x210d38['query']['fields']));_0x57df23[_0x55c1('0x30')]=_0x57df23[_0x55c1('0x30')][_0x55c1('0x32')]?_0x57df23[_0x55c1('0x30')]:_0xacfbe0['model'];if(_0x210d38[_0x55c1('0x2f')][_0x55c1('0x3b')]){_0x57df23[_0x55c1('0x3c')]=[{'all':!![]}];}_0x57df23=_['merge']({},_0x57df23,_0x210d38[_0x55c1('0x3a')]);return db['FreshsalesAccount'][_0x55c1('0x42')](_0x57df23)[_0x55c1('0x22')](handleEntityNotFound(_0x49d4ce,null))[_0x55c1('0x22')](respondWithResult(_0x49d4ce,null))[_0x55c1('0x3f')](handleError(_0x49d4ce,null));};exports['create']=function(_0x3d0874,_0x458cac){return db[_0x55c1('0x29')][_0x55c1('0x43')](_0x3d0874[_0x55c1('0x44')],{})[_0x55c1('0x22')](respondWithResult(_0x458cac,0xc9))[_0x55c1('0x3f')](handleError(_0x458cac,null));};exports[_0x55c1('0x45')]=function(_0x37accf,_0x2ab7f0){if(_0x37accf[_0x55c1('0x44')]['id']){delete _0x37accf['body']['id'];}return db[_0x55c1('0x29')][_0x55c1('0x42')]({'where':{'id':_0x37accf[_0x55c1('0x40')]['id']}})['then'](handleEntityNotFound(_0x2ab7f0,null))[_0x55c1('0x22')](saveUpdates(_0x37accf[_0x55c1('0x44')],null))[_0x55c1('0x22')](respondWithResult(_0x2ab7f0,null))[_0x55c1('0x3f')](handleError(_0x2ab7f0,null));};exports[_0x55c1('0x21')]=function(_0x410943,_0x49fe97){return db[_0x55c1('0x29')][_0x55c1('0x42')]({'where':{'id':_0x410943[_0x55c1('0x40')]['id']}})[_0x55c1('0x22')](handleEntityNotFound(_0x49fe97,null))[_0x55c1('0x22')](removeEntity(_0x49fe97,null))[_0x55c1('0x3f')](handleError(_0x49fe97,null));};exports[_0x55c1('0x46')]=function(_0x26260e,_0x172e3b,_0x3e9882){var _0x2ff843={};var _0x4e1a77={};var _0x85f105;var _0x4a4b76;return db[_0x55c1('0x29')]['findOne']({'where':{'id':_0x26260e[_0x55c1('0x40')]['id']}})[_0x55c1('0x22')](handleEntityNotFound(_0x172e3b,null))[_0x55c1('0x22')](function(_0x1ca042){if(_0x1ca042){_0x85f105=_0x1ca042;_0x4e1a77[_0x55c1('0x2e')]=_[_0x55c1('0x41')](db[_0x55c1('0x47')][_0x55c1('0x2a')]);_0x4e1a77[_0x55c1('0x2f')]=_[_0x55c1('0x41')](_0x26260e['query']);_0x4e1a77[_0x55c1('0x38')]=_[_0x55c1('0x2d')](_0x4e1a77[_0x55c1('0x2e')],_0x4e1a77[_0x55c1('0x2f')]);_0x2ff843[_0x55c1('0x30')]=_[_0x55c1('0x2d')](_0x4e1a77[_0x55c1('0x2e')],qs[_0x55c1('0x31')](_0x26260e[_0x55c1('0x2f')][_0x55c1('0x31')]));_0x2ff843[_0x55c1('0x30')]=_0x2ff843['attributes'][_0x55c1('0x32')]?_0x2ff843[_0x55c1('0x30')]:_0x4e1a77[_0x55c1('0x2e')];_0x2ff843[_0x55c1('0x34')]=qs[_0x55c1('0x35')](_0x26260e['query']['sort']);_0x2ff843['where']=qs[_0x55c1('0x38')](_[_0x55c1('0x37')](_0x26260e[_0x55c1('0x2f')],_0x4e1a77[_0x55c1('0x38')]));if(_0x26260e[_0x55c1('0x2f')][_0x55c1('0x39')]){_0x2ff843[_0x55c1('0x36')]=_[_0x55c1('0x48')](_0x2ff843[_0x55c1('0x36')],{'$or':_[_0x55c1('0x28')](_0x2ff843[_0x55c1('0x30')],function(_0x20e522){var _0x5e94ad={};_0x5e94ad[_0x20e522]={'$like':'%'+_0x26260e[_0x55c1('0x2f')][_0x55c1('0x39')]+'%'};return _0x5e94ad;})});}_0x2ff843=_[_0x55c1('0x48')]({},_0x2ff843,_0x26260e['options']);return _0x85f105[_0x55c1('0x46')](_0x2ff843);}})[_0x55c1('0x22')](function(_0x46f50f){if(_0x46f50f){_0x4a4b76=_0x46f50f[_0x55c1('0x32')];if(!_0x26260e[_0x55c1('0x2f')]['hasOwnProperty'](_0x55c1('0x49'))){_0x2ff843[_0x55c1('0x1c')]=qs[_0x55c1('0x1c')](_0x26260e[_0x55c1('0x2f')][_0x55c1('0x1c')]);_0x2ff843[_0x55c1('0x1a')]=qs[_0x55c1('0x1a')](_0x26260e[_0x55c1('0x2f')][_0x55c1('0x1a')]);}return _0x85f105[_0x55c1('0x46')](_0x2ff843);}})[_0x55c1('0x22')](function(_0x4c8294){if(_0x4c8294){return _0x4c8294?{'count':_0x4a4b76,'rows':_0x4c8294}:null;}})[_0x55c1('0x22')](respondWithResult(_0x172e3b,null))[_0x55c1('0x3f')](handleError(_0x172e3b,null));};exports[_0x55c1('0x4a')]=function(_0x5ee839,_0x5c7ea4,_0x3f3ab4){if(_0x5ee839['body']['id']){delete _0x5ee839['body']['id'];}return db[_0x55c1('0x29')]['findOne']({'where':{'id':_0x5ee839[_0x55c1('0x40')]['id']}})['then'](handleEntityNotFound(_0x5c7ea4,null))[_0x55c1('0x22')](function(_0xcdda44){if(_0xcdda44){_0x5ee839[_0x55c1('0x44')]['AccountId']=_0xcdda44['id'];_0x5ee839[_0x55c1('0x44')][_0x55c1('0x4b')]=integrations[_0x55c1('0x4c')](_0x5ee839[_0x55c1('0x44')][_0x55c1('0x4d')],_0x5ee839['body']['type']);_0x5ee839['body'][_0x55c1('0x4e')]=integrations[_0x55c1('0x4f')](_0x5ee839[_0x55c1('0x44')][_0x55c1('0x4d')],_0x5ee839[_0x55c1('0x44')][_0x55c1('0x2c')]);return db[_0x55c1('0x47')]['create'](_0x5ee839[_0x55c1('0x44')],{'include':[{'model':db['FreshsalesField'],'as':_0x55c1('0x4b')},{'model':db[_0x55c1('0x50')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x5c7ea4,null))[_0x55c1('0x3f')](handleError(_0x5c7ea4,null));};exports['getFields']=function(_0x3bb1ec,_0x45bb46,_0x41262d){var _0x7577bb='';var _0x51395c='';return db['FreshsalesAccount'][_0x55c1('0x51')]({'where':{'id':_0x3bb1ec[_0x55c1('0x40')]['id']},'attributes':['id',_0x55c1('0x52'),'remoteUri',_0x55c1('0x53')]})[_0x55c1('0x22')](handleEntityNotFound(_0x45bb46,null))[_0x55c1('0x22')](function(_0xb1d7c4){if(_0xb1d7c4){_0x51395c=_0xb1d7c4['username'];_0x7577bb=_0xb1d7c4[_0x55c1('0x54')];var _0x1c0b2a=_0xb1d7c4[_0x55c1('0x54')][_0x55c1('0x55')](-0x1);if(_0x1c0b2a==='/'){_0x7577bb=_0x7577bb['substring'](0x0,_0x7577bb['lastIndexOf'](_0x1c0b2a));}return rp({'method':_0x55c1('0x56'),'uri':util['format'](_0x55c1('0x57'),_0x7577bb,_0x55c1('0x58')),'headers':{'Authorization':_0x55c1('0x59')+_0xb1d7c4[_0x55c1('0x53')]},'json':!![]});}})[_0x55c1('0x22')](function(_0x3e3719){if(_0x3e3719){var _0x180bc0=_0x3e3719[_0x55c1('0x5a')];var _0x2af963=![];var _0x4c8391=null;for(_0x4c8391=0x0;_0x4c8391<_0x180bc0['length'];_0x4c8391++){if(_0x180bc0[_0x4c8391]['email']===_0x51395c){_0x2af963=!![];}}if(_0x2af963){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x55c1('0x5b')});}}})[_0x55c1('0x22')](respondWithResult(_0x45bb46,null))[_0x55c1('0x3f')](function(_0x1dfa48){var _0xe3394e=_0x3bb1ec['query'][_0x55c1('0x5c')]?0x1f4:_0x1dfa48[_0x55c1('0x5d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x55c1('0x5e'),_0xe3394e,JSON[_0x55c1('0x5f')](_0x1dfa48));delete _0x1dfa48[_0x55c1('0x25')];if(_0xe3394e===0x191){_0xe3394e=0x190;}_0x45bb46['status'](_0xe3394e)[_0x55c1('0x26')](_0x3bb1ec[_0x55c1('0x2f')][_0x55c1('0x5c')]?{'message':_0x55c1('0x60'),'statusCode':_0x1dfa48[_0x55c1('0x5d')]}:_0x1dfa48);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 47f92bd..e49b490 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 _0xb016=['../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x23f668,_0x132974){var _0x30a6c7=function(_0x12ec0b){while(--_0x12ec0b){_0x23f668['push'](_0x23f668['shift']());}};_0x30a6c7(++_0x132974);}(_0xb016,0x159));var _0x6b01=function(_0x2c39a4,_0x4d4c91){_0x2c39a4=_0x2c39a4-0x0;var _0x4fc6df=_0xb016[_0x2c39a4];return _0x4fc6df;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6b01('0x2'));var BPromise=require('bluebird');var rp=require(_0x6b01('0x3'));var fs=require('fs');var path=require(_0x6b01('0x4'));var rimraf=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x6b01('0x7'));module[_0x6b01('0x8')]=function(_0x192b2d,_0x5759a1){return _0x192b2d['define'](_0x6b01('0x9'),attributes,{'tableName':_0x6b01('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47c5=['rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4fd0d1,_0x52cc20){var _0x536632=function(_0x6565d8){while(--_0x6565d8){_0x4fd0d1['push'](_0x4fd0d1['shift']());}};_0x536632(++_0x52cc20);}(_0x47c5,0x165));var _0x547c=function(_0x4cefee,_0xabb91e){_0x4cefee=_0x4cefee-0x0;var _0x473af2=_0x47c5[_0x4cefee];return _0x473af2;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var logger=require(_0x547c('0x2'))(_0x547c('0x3'));var moment=require(_0x547c('0x4'));var BPromise=require(_0x547c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x547c('0x6'));var rimraf=require(_0x547c('0x7'));var config=require('../../config/environment');var attributes=require(_0x547c('0x8'));var integrations=require(_0x547c('0x9'));module['exports']=function(_0x2e5b57,_0x439f25){return _0x2e5b57[_0x547c('0xa')](_0x547c('0xb'),attributes,{'tableName':_0x547c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index a72a7b4..9a95186 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 _0xa6b0=['http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','attributes','limit','include','map','then','GetFreshsalesAccount','ShowFreshsalesAccount','FreshsalesAccount','find','where','model','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0xa6b0,0xaf));var _0x0a6b=function(_0xb65e2e,_0x2d9de3){_0xb65e2e=_0xb65e2e-0x0;var _0x5b1753=_0xa6b0[_0xb65e2e];return _0x5b1753;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a6b('0x2'));var fs=require('fs');var Redis=require(_0x0a6b('0x3'));var db=require(_0x0a6b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a6b('0x5'))(_0x0a6b('0x6'));var config=require(_0x0a6b('0x7'));var jayson=require(_0x0a6b('0x8'));var client=jayson[_0x0a6b('0x9')][_0x0a6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b5fb5,_0xa908dd,_0x26f761){return new BPromise(function(_0x340a33,_0x8e89f){return client[_0x0a6b('0xb')](_0x1b5fb5,_0x26f761)['then'](function(_0x493948){logger[_0x0a6b('0xc')](_0x0a6b('0xd'),_0xa908dd,_0x0a6b('0xe'));logger[_0x0a6b('0xf')](_0x0a6b('0x10'),_0xa908dd,_0x0a6b('0xe'),JSON[_0x0a6b('0x11')](_0x493948));if(_0x493948[_0x0a6b('0x12')]){if(_0x493948[_0x0a6b('0x12')][_0x0a6b('0x13')]===0x1f4){logger[_0x0a6b('0x12')](_0x0a6b('0xd'),_0xa908dd,_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);return _0x8e89f(_0x493948['error']['message']);}logger[_0x0a6b('0x12')](_0x0a6b('0xd'),_0xa908dd,_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);return _0x340a33(_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);}else{logger[_0x0a6b('0xc')](_0x0a6b('0xd'),_0xa908dd,_0x0a6b('0xe'));_0x340a33(_0x493948[_0x0a6b('0x15')]['message']);}})[_0x0a6b('0x16')](function(_0x1538f4){logger['error'](_0x0a6b('0xd'),_0xa908dd,_0x1538f4);_0x8e89f(_0x1538f4);});});}exports['GetFreshsalesAccount']=function(_0xcb412){var _0x31f347=this;return new Promise(function(_0x2cb10b,_0x1ad45d){return db['FreshsalesAccount'][_0x0a6b('0x17')]({'raw':_0xcb412[_0x0a6b('0x18')]?_0xcb412['options'][_0x0a6b('0x19')]===undefined?!![]:![]:!![],'where':_0xcb412[_0x0a6b('0x18')]?_0xcb412[_0x0a6b('0x18')]['where']||null:null,'attributes':_0xcb412[_0x0a6b('0x18')]?_0xcb412[_0x0a6b('0x18')][_0x0a6b('0x1a')]||null:null,'limit':_0xcb412['options']?_0xcb412[_0x0a6b('0x18')][_0x0a6b('0x1b')]||null:null,'include':_0xcb412[_0x0a6b('0x18')]?_0xcb412[_0x0a6b('0x18')][_0x0a6b('0x1c')]?_['map'](_0xcb412[_0x0a6b('0x18')][_0x0a6b('0x1c')],function(_0x3d153f){return{'model':db[_0x3d153f['model']],'as':_0x3d153f['as'],'attributes':_0x3d153f[_0x0a6b('0x1a')],'include':_0x3d153f[_0x0a6b('0x1c')]?_[_0x0a6b('0x1d')](_0x3d153f[_0x0a6b('0x1c')],function(_0x3b12a2){return{'model':db[_0x3b12a2['model']],'as':_0x3b12a2['as'],'attributes':_0x3b12a2[_0x0a6b('0x1a')],'include':_0x3b12a2[_0x0a6b('0x1c')]?_[_0x0a6b('0x1d')](_0x3b12a2['include'],function(_0x3a9092){return{'model':db[_0x3a9092['model']],'as':_0x3a9092['as'],'attributes':_0x3a9092[_0x0a6b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0a6b('0x1e')](function(_0x45ae97){logger['info']('GetFreshsalesAccount',_0xcb412);logger[_0x0a6b('0xf')](_0x0a6b('0x1f'),_0xcb412,JSON[_0x0a6b('0x11')](_0x45ae97));_0x2cb10b(_0x45ae97);})[_0x0a6b('0x16')](function(_0x1935a3){logger[_0x0a6b('0x12')]('GetFreshsalesAccount',_0x1935a3[_0x0a6b('0x14')],_0xcb412);_0x1ad45d(_0x31f347[_0x0a6b('0x12')](0x1f4,_0x1935a3['message']));});});};exports[_0x0a6b('0x20')]=function(_0x554145){var _0x4eb516=this;return new Promise(function(_0xbf2f1a,_0x24e96a){return db[_0x0a6b('0x21')][_0x0a6b('0x22')]({'raw':_0x554145[_0x0a6b('0x18')]?_0x554145['options']['raw']===undefined?!![]:![]:!![],'where':_0x554145[_0x0a6b('0x18')]?_0x554145[_0x0a6b('0x18')][_0x0a6b('0x23')]||null:null,'attributes':_0x554145[_0x0a6b('0x18')]?_0x554145['options'][_0x0a6b('0x1a')]||null:null,'include':_0x554145[_0x0a6b('0x18')]?_0x554145['options']['include']?_[_0x0a6b('0x1d')](_0x554145[_0x0a6b('0x18')]['include'],function(_0x3c3c23){return{'model':db[_0x3c3c23[_0x0a6b('0x24')]],'as':_0x3c3c23['as'],'attributes':_0x3c3c23[_0x0a6b('0x1a')],'include':_0x3c3c23[_0x0a6b('0x1c')]?_[_0x0a6b('0x1d')](_0x3c3c23[_0x0a6b('0x1c')],function(_0x1f6f82){return{'model':db[_0x1f6f82[_0x0a6b('0x24')]],'as':_0x1f6f82['as'],'attributes':_0x1f6f82[_0x0a6b('0x1a')],'include':_0x1f6f82[_0x0a6b('0x1c')]?_[_0x0a6b('0x1d')](_0x1f6f82[_0x0a6b('0x1c')],function(_0x49fa53){return{'model':db[_0x49fa53[_0x0a6b('0x24')]],'as':_0x49fa53['as'],'attributes':_0x49fa53[_0x0a6b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x390d62){logger[_0x0a6b('0xc')](_0x0a6b('0x20'),_0x554145);logger[_0x0a6b('0xf')](_0x0a6b('0x20'),_0x554145,JSON[_0x0a6b('0x11')](_0x390d62));_0xbf2f1a(_0x390d62);})[_0x0a6b('0x16')](function(_0x3f1be6){logger[_0x0a6b('0x12')]('ShowFreshsalesAccount',_0x3f1be6[_0x0a6b('0x14')],_0x554145);_0x24e96a(_0x4eb516[_0x0a6b('0x12')](0x1f4,_0x3f1be6[_0x0a6b('0x14')]));});});}; \ No newline at end of file +var _0x1261=['FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFreshsalesAccount','options','raw','limit','include','map','model','attributes','stringify','ShowFreshsalesAccount','FreshsalesAccount','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x42e5a4,_0x3c2733){var _0x4f35d4=function(_0x14e09f){while(--_0x14e09f){_0x42e5a4['push'](_0x42e5a4['shift']());}};_0x4f35d4(++_0x3c2733);}(_0x1261,0x144));var _0x1126=function(_0x54514c,_0xf1c84a){_0x54514c=_0x54514c-0x0;var _0x5cd80e=_0x1261[_0x54514c];return _0x5cd80e;};'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')]('FreshsalesAccount,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['FreshsalesAccount']['findAll']({'raw':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49['options'][_0x1126('0x17')]===undefined?!![]:![]:!![],'where':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49[_0x1126('0x16')]['where']||null:null,'attributes':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49['options']['attributes']||null:null,'limit':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49[_0x1126('0x16')][_0x1126('0x18')]||null:null,'include':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49['options'][_0x1126('0x19')]?_[_0x1126('0x1a')](_0x4a7b49['options'][_0x1126('0x19')],function(_0x59cd8e){return{'model':db[_0x59cd8e['model']],'as':_0x59cd8e['as'],'attributes':_0x59cd8e['attributes'],'include':_0x59cd8e[_0x1126('0x19')]?_[_0x1126('0x1a')](_0x59cd8e[_0x1126('0x19')],function(_0x34bcf1){return{'model':db[_0x34bcf1[_0x1126('0x1b')]],'as':_0x34bcf1['as'],'attributes':_0x34bcf1[_0x1126('0x1c')],'include':_0x34bcf1[_0x1126('0x19')]?_[_0x1126('0x1a')](_0x34bcf1['include'],function(_0x35eec3){return{'model':db[_0x35eec3[_0x1126('0x1b')]],'as':_0x35eec3['as'],'attributes':_0x35eec3[_0x1126('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x541bc9){logger[_0x1126('0xd')](_0x1126('0x15'),_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x1d')](_0x541bc9));_0x22ae0b(_0x541bc9);})['catch'](function(_0x3fa694){logger['error'](_0x1126('0x15'),_0x3fa694['message'],_0x4a7b49);_0x2b2487(_0x4d2b38[_0x1126('0x11')](0x1f4,_0x3fa694['message']));});});};exports[_0x1126('0x1e')]=function(_0x5f2611){var _0x5252e0=this;return new Promise(function(_0x4a53ab,_0x17646e){return db[_0x1126('0x1f')][_0x1126('0x20')]({'raw':_0x5f2611['options']?_0x5f2611[_0x1126('0x16')][_0x1126('0x17')]===undefined?!![]:![]:!![],'where':_0x5f2611['options']?_0x5f2611[_0x1126('0x16')][_0x1126('0x21')]||null:null,'attributes':_0x5f2611[_0x1126('0x16')]?_0x5f2611[_0x1126('0x16')]['attributes']||null:null,'include':_0x5f2611['options']?_0x5f2611[_0x1126('0x16')][_0x1126('0x19')]?_[_0x1126('0x1a')](_0x5f2611[_0x1126('0x16')]['include'],function(_0x145314){return{'model':db[_0x145314[_0x1126('0x1b')]],'as':_0x145314['as'],'attributes':_0x145314[_0x1126('0x1c')],'include':_0x145314[_0x1126('0x19')]?_[_0x1126('0x1a')](_0x145314['include'],function(_0x2a0dfe){return{'model':db[_0x2a0dfe[_0x1126('0x1b')]],'as':_0x2a0dfe['as'],'attributes':_0x2a0dfe[_0x1126('0x1c')],'include':_0x2a0dfe[_0x1126('0x19')]?_['map'](_0x2a0dfe['include'],function(_0x22827a){return{'model':db[_0x22827a[_0x1126('0x1b')]],'as':_0x22827a['as'],'attributes':_0x22827a['attributes']};}):[]};}):[]};}):[]:[]})[_0x1126('0xc')](function(_0xf3c21b){logger[_0x1126('0xd')]('ShowFreshsalesAccount',_0x5f2611);logger['debug'](_0x1126('0x1e'),_0x5f2611,JSON[_0x1126('0x1d')](_0xf3c21b));_0x4a53ab(_0xf3c21b);})[_0x1126('0x14')](function(_0x156554){logger['error'](_0x1126('0x1e'),_0x156554['message'],_0x5f2611);_0x17646e(_0x5252e0[_0x1126('0x11')](0x1f4,_0x156554[_0x1126('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 031a347..2667c1d 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 _0xe5eb=['show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','create','update','delete','destroy','exports','multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated'];(function(_0xf32a17,_0x230e17){var _0x3131a6=function(_0x3eb6b6){while(--_0x3eb6b6){_0xf32a17['push'](_0xf32a17['shift']());}};_0x3131a6(++_0x230e17);}(_0xe5eb,0x9e));var _0xbe5e=function(_0x5dce97,_0x56ffaa){_0x5dce97=_0x5dce97-0x0;var _0x1f317f=_0xe5eb[_0x5dce97];return _0x1f317f;};'use strict';var multer=require(_0xbe5e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbe5e('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xbe5e('0x2'));var interaction=require(_0xbe5e('0x3'));var config=require(_0xbe5e('0x4'));var controller=require(_0xbe5e('0x5'));router[_0xbe5e('0x6')]('/',auth['isAuthenticated'](),controller[_0xbe5e('0x7')]);router[_0xbe5e('0x6')](_0xbe5e('0x8'),auth[_0xbe5e('0x9')](),controller[_0xbe5e('0xa')]);router['get'](_0xbe5e('0xb'),auth['isAuthenticated'](),controller[_0xbe5e('0xc')]);router[_0xbe5e('0x6')]('/:id/descriptions',auth[_0xbe5e('0x9')](),controller[_0xbe5e('0xd')]);router['get'](_0xbe5e('0xe'),auth[_0xbe5e('0x9')](),controller[_0xbe5e('0xf')]);router['post']('/',auth[_0xbe5e('0x9')](),controller[_0xbe5e('0x10')]);router['put']('/:id',auth[_0xbe5e('0x9')](),controller[_0xbe5e('0x11')]);router[_0xbe5e('0x12')](_0xbe5e('0x8'),auth[_0xbe5e('0x9')](),controller[_0xbe5e('0x13')]);module[_0xbe5e('0x14')]=router; \ No newline at end of file +var _0x7a56=['/:id/fields','getFields','post','create','put','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x50e21b,_0x37398e){var _0x44018e=function(_0x26f792){while(--_0x26f792){_0x50e21b['push'](_0x50e21b['shift']());}};_0x44018e(++_0x37398e);}(_0x7a56,0x187));var _0x67a5=function(_0x339fdd,_0x433dbf){_0x339fdd=_0x339fdd-0x0;var _0x1d87e2=_0x7a56[_0x339fdd];return _0x1d87e2;};'use strict';var multer=require(_0x67a5('0x0'));var util=require('util');var path=require(_0x67a5('0x1'));var timeout=require(_0x67a5('0x2'));var express=require(_0x67a5('0x3'));var router=express['Router']();var fs_extra=require(_0x67a5('0x4'));var auth=require(_0x67a5('0x5'));var interaction=require(_0x67a5('0x6'));var config=require(_0x67a5('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0x67a5('0x8')](),controller[_0x67a5('0x9')]);router[_0x67a5('0xa')](_0x67a5('0xb'),auth[_0x67a5('0x8')](),controller[_0x67a5('0xc')]);router[_0x67a5('0xa')](_0x67a5('0xd'),auth[_0x67a5('0x8')](),controller[_0x67a5('0xe')]);router[_0x67a5('0xa')](_0x67a5('0xf'),auth[_0x67a5('0x8')](),controller[_0x67a5('0x10')]);router[_0x67a5('0xa')](_0x67a5('0x11'),auth[_0x67a5('0x8')](),controller[_0x67a5('0x12')]);router[_0x67a5('0x13')]('/',auth[_0x67a5('0x8')](),controller[_0x67a5('0x14')]);router[_0x67a5('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x67a5('0x16')](_0x67a5('0xb'),auth[_0x67a5('0x8')](),controller['destroy']);module[_0x67a5('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 74b2b89..42ce9c0 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 _0x79bb=['STRING','exports'];(function(_0x9157,_0x157ebd){var _0x5d2b99=function(_0x2e2812){while(--_0x2e2812){_0x9157['push'](_0x9157['shift']());}};_0x5d2b99(++_0x157ebd);}(_0x79bb,0x14f));var _0xb79b=function(_0x5cdad2,_0x129d32){_0x5cdad2=_0x5cdad2-0x0;var _0x508c9b=_0x79bb[_0x5cdad2];return _0x508c9b;};'use strict';var Sequelize=require('sequelize');module[_0xb79b('0x0')]={'name':{'type':Sequelize[_0xb79b('0x1')]},'description':{'type':Sequelize[_0xb79b('0x1')]}}; \ No newline at end of file +var _0xb477=['STRING','sequelize','exports'];(function(_0x2d4b0a,_0x5147ba){var _0xe59a7a=function(_0x18b7d0){while(--_0x18b7d0){_0x2d4b0a['push'](_0x2d4b0a['shift']());}};_0xe59a7a(++_0x5147ba);}(_0xb477,0xaf));var _0x7b47=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xb477[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0x7b47('0x0'));module[_0x7b47('0x1')]={'name':{'type':Sequelize[_0x7b47('0x2')]},'description':{'type':Sequelize[_0x7b47('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 1ab28c1..0badd9f 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 _0x677b=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','FreshsalesConfiguration','fieldName','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','destroy','getSubjects','findOne','FreshsalesField','order','getDescriptions','getFields','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x4ba626,_0x1fc9c9){var _0x771827=function(_0x35973d){while(--_0x35973d){_0x4ba626['push'](_0x4ba626['shift']());}};_0x771827(++_0x1fc9c9);}(_0x677b,0x8e));var _0xb677=function(_0x9c8b4a,_0x2387ff){_0x9c8b4a=_0x9c8b4a-0x0;var _0x198bef=_0x677b[_0x9c8b4a];return _0x198bef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb677('0x0'));var BPromise=require('bluebird');var Mustache=require(_0xb677('0x1'));var util=require(_0xb677('0x2'));var path=require(_0xb677('0x3'));var sox=require(_0xb677('0x4'));var csv=require(_0xb677('0x5'));var ejs=require(_0xb677('0x6'));var fs=require('fs');var fs_extra=require(_0xb677('0x7'));var _=require(_0xb677('0x8'));var squel=require(_0xb677('0x9'));var crypto=require(_0xb677('0xa'));var jsforce=require(_0xb677('0xb'));var deskjs=require(_0xb677('0xc'));var toCsv=require(_0xb677('0x5'));var querystring=require('querystring');var Papa=require(_0xb677('0xd'));var Redis=require(_0xb677('0xe'));var authService=require(_0xb677('0xf'));var qs=require(_0xb677('0x10'));var as=require(_0xb677('0x11'));var hardwareService=require(_0xb677('0x12'));var logger=require(_0xb677('0x13'))(_0xb677('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb677('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3066a0,_0x2e542b){_0x2e542b=_0x2e542b||0xcc;return function(_0x5515c5){if(_0x5515c5){return _0x3066a0[_0xb677('0x16')](_0x2e542b);}return _0x3066a0[_0xb677('0x17')](_0x2e542b)[_0xb677('0x18')]();};}function respondWithResult(_0x59373c,_0x17f688){_0x17f688=_0x17f688||0xc8;return function(_0xb41030){if(_0xb41030){return _0x59373c[_0xb677('0x17')](_0x17f688)['json'](_0xb41030);}};}function respondWithFilteredResult(_0x4eca0f,_0x3e43c0){return function(_0x468333){if(_0x468333){var _0x83353=typeof _0x3e43c0['offset']===_0xb677('0x19')&&typeof _0x3e43c0[_0xb677('0x1a')]==='undefined';var _0x3fe7d7=_0x468333[_0xb677('0x1b')];var _0x3b7afc=_0x83353?0x0:_0x3e43c0[_0xb677('0x1c')];var _0x2f1584=_0x83353?_0x468333[_0xb677('0x1b')]:_0x3e43c0[_0xb677('0x1c')]+_0x3e43c0[_0xb677('0x1a')];var _0x35d380;if(_0x2f1584>=_0x3fe7d7){_0x2f1584=_0x3fe7d7;_0x35d380=0xc8;}else{_0x35d380=0xce;}_0x4eca0f[_0xb677('0x17')](_0x35d380);return _0x4eca0f['set'](_0xb677('0x1d'),_0x3b7afc+'-'+_0x2f1584+'/'+_0x3fe7d7)['json'](_0x468333);}return null;};}function patchUpdates(_0x4b6fa8){return function(_0x55503f){try{jsonpatch[_0xb677('0x1e')](_0x55503f,_0x4b6fa8,!![]);}catch(_0x1fd219){return BPromise[_0xb677('0x1f')](_0x1fd219);}return _0x55503f['save']();};}function saveUpdates(_0x1d8ba7,_0x1fdc93){return function(_0x1b17fc){if(_0x1b17fc){return _0x1b17fc[_0xb677('0x20')](_0x1d8ba7)[_0xb677('0x21')](function(_0x211697){return _0x211697;});}return null;};}function removeEntity(_0x108e03,_0x4f1412){return function(_0x504220){if(_0x504220){return _0x504220['destroy']()[_0xb677('0x21')](function(){_0x108e03['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56a7eb,_0x5030d1){return function(_0x2d3562){if(!_0x2d3562){_0x56a7eb[_0xb677('0x16')](0x194);}return _0x2d3562;};}function handleError(_0x3ee5c7,_0x523c7d){_0x523c7d=_0x523c7d||0x1f4;return function(_0x27ada4){logger[_0xb677('0x22')](_0x27ada4[_0xb677('0x23')]);if(_0x27ada4[_0xb677('0x24')]){delete _0x27ada4[_0xb677('0x24')];}_0x3ee5c7[_0xb677('0x17')](_0x523c7d)[_0xb677('0x25')](_0x27ada4);};}exports[_0xb677('0x26')]=function(_0x5ee1ae,_0x553919){var _0x37397d={},_0x4c4045={},_0x56b29d={'count':0x0,'rows':[]};var _0x2a0e54=_[_0xb677('0x27')](db[_0xb677('0x28')]['rawAttributes'],function(_0x283f59){return{'name':_0x283f59[_0xb677('0x29')],'type':_0x283f59['type'][_0xb677('0x2a')]};});_0x4c4045[_0xb677('0x2b')]=_[_0xb677('0x27')](_0x2a0e54,_0xb677('0x24'));_0x4c4045['query']=_[_0xb677('0x2c')](_0x5ee1ae[_0xb677('0x2d')]);_0x4c4045['filters']=_['intersection'](_0x4c4045[_0xb677('0x2b')],_0x4c4045[_0xb677('0x2d')]);_0x37397d[_0xb677('0x2e')]=_[_0xb677('0x2f')](_0x4c4045[_0xb677('0x2b')],qs['fields'](_0x5ee1ae['query'][_0xb677('0x30')]));_0x37397d['attributes']=_0x37397d[_0xb677('0x2e')][_0xb677('0x31')]?_0x37397d[_0xb677('0x2e')]:_0x4c4045[_0xb677('0x2b')];if(!_0x5ee1ae[_0xb677('0x2d')][_0xb677('0x32')](_0xb677('0x33'))){_0x37397d['limit']=qs['limit'](_0x5ee1ae['query']['limit']);_0x37397d[_0xb677('0x1c')]=qs[_0xb677('0x1c')](_0x5ee1ae['query'][_0xb677('0x1c')]);}_0x37397d['order']=qs[_0xb677('0x34')](_0x5ee1ae['query'][_0xb677('0x34')]);_0x37397d['where']=qs[_0xb677('0x35')](_[_0xb677('0x36')](_0x5ee1ae['query'],_0x4c4045[_0xb677('0x35')]),_0x2a0e54);if(_0x5ee1ae[_0xb677('0x2d')][_0xb677('0x37')]){_0x37397d[_0xb677('0x38')]=_[_0xb677('0x39')](_0x37397d['where'],{'$or':_[_0xb677('0x27')](_0x2a0e54,function(_0x3deca3){if(_0x3deca3['type']!==_0xb677('0x3a')){var _0x5710dd={};_0x5710dd[_0x3deca3['name']]={'$like':'%'+_0x5ee1ae['query'][_0xb677('0x37')]+'%'};return _0x5710dd;}})});}_0x37397d=_['merge']({},_0x37397d,_0x5ee1ae[_0xb677('0x3b')]);var _0x41d670={'where':_0x37397d['where']};return db[_0xb677('0x28')][_0xb677('0x1b')](_0x41d670)[_0xb677('0x21')](function(_0x47fe58){_0x56b29d['count']=_0x47fe58;if(_0x5ee1ae[_0xb677('0x2d')][_0xb677('0x3c')]){_0x37397d[_0xb677('0x3d')]=[{'all':!![]}];}return db[_0xb677('0x28')][_0xb677('0x3e')](_0x37397d);})['then'](function(_0x2c5efa){_0x56b29d[_0xb677('0x3f')]=_0x2c5efa;return _0x56b29d;})['then'](respondWithFilteredResult(_0x553919,_0x37397d))[_0xb677('0x40')](handleError(_0x553919,null));};exports['show']=function(_0xd91ec9,_0x3d81d4){var _0x36ecdd={'raw':![],'where':{'id':_0xd91ec9[_0xb677('0x41')]['id']}},_0x20992b={};_0x20992b[_0xb677('0x2b')]=_[_0xb677('0x2c')](db[_0xb677('0x28')][_0xb677('0x42')]);_0x20992b['query']=_[_0xb677('0x2c')](_0xd91ec9[_0xb677('0x2d')]);_0x20992b[_0xb677('0x35')]=_[_0xb677('0x2f')](_0x20992b[_0xb677('0x2b')],_0x20992b[_0xb677('0x2d')]);_0x36ecdd[_0xb677('0x2e')]=_[_0xb677('0x2f')](_0x20992b[_0xb677('0x2b')],qs[_0xb677('0x30')](_0xd91ec9['query'][_0xb677('0x30')]));_0x36ecdd[_0xb677('0x2e')]=_0x36ecdd[_0xb677('0x2e')][_0xb677('0x31')]?_0x36ecdd['attributes']:_0x20992b[_0xb677('0x2b')];if(_0xd91ec9[_0xb677('0x2d')]['includeAll']){_0x36ecdd[_0xb677('0x3d')]=[{'all':!![]}];}_0x36ecdd=_[_0xb677('0x39')]({},_0x36ecdd,_0xd91ec9[_0xb677('0x3b')]);return db[_0xb677('0x28')][_0xb677('0x43')](_0x36ecdd)[_0xb677('0x21')](handleEntityNotFound(_0x3d81d4,null))[_0xb677('0x21')](respondWithResult(_0x3d81d4,null))['catch'](handleError(_0x3d81d4,null));};exports[_0xb677('0x44')]=function(_0x57e6fa,_0x57df63){return db['FreshsalesConfiguration'][_0xb677('0x44')](_0x57e6fa[_0xb677('0x45')],{})[_0xb677('0x21')](respondWithResult(_0x57df63,0xc9))[_0xb677('0x40')](handleError(_0x57df63,null));};exports['update']=function(_0x379341,_0x1830a8){if(_0x379341[_0xb677('0x45')]['id']){delete _0x379341[_0xb677('0x45')]['id'];}return db[_0xb677('0x28')][_0xb677('0x43')]({'where':{'id':_0x379341[_0xb677('0x41')]['id']}})['then'](handleEntityNotFound(_0x1830a8,null))[_0xb677('0x21')](saveUpdates(_0x379341['body'],null))[_0xb677('0x21')](respondWithResult(_0x1830a8,null))[_0xb677('0x40')](handleError(_0x1830a8,null));};exports[_0xb677('0x46')]=function(_0x39abb2,_0x77e46b){return db[_0xb677('0x28')][_0xb677('0x43')]({'where':{'id':_0x39abb2[_0xb677('0x41')]['id']}})[_0xb677('0x21')](handleEntityNotFound(_0x77e46b,null))['then'](removeEntity(_0x77e46b,null))['catch'](handleError(_0x77e46b,null));};exports[_0xb677('0x47')]=function(_0x4c57f7,_0x241497,_0x23e6bf){var _0x4bfd6d={};var _0x4f4c8d={};var _0x176888;var _0x4c87b9;return db[_0xb677('0x28')][_0xb677('0x48')]({'where':{'id':_0x4c57f7['params']['id']}})['then'](handleEntityNotFound(_0x241497,null))[_0xb677('0x21')](function(_0x2f14eb){if(_0x2f14eb){_0x176888=_0x2f14eb;_0x4f4c8d[_0xb677('0x2b')]=_[_0xb677('0x2c')](db[_0xb677('0x49')][_0xb677('0x42')]);_0x4f4c8d[_0xb677('0x2d')]=_['keys'](_0x4c57f7[_0xb677('0x2d')]);_0x4f4c8d['filters']=_[_0xb677('0x2f')](_0x4f4c8d[_0xb677('0x2b')],_0x4f4c8d[_0xb677('0x2d')]);_0x4bfd6d[_0xb677('0x2e')]=_['intersection'](_0x4f4c8d[_0xb677('0x2b')],qs['fields'](_0x4c57f7[_0xb677('0x2d')][_0xb677('0x30')]));_0x4bfd6d[_0xb677('0x2e')]=_0x4bfd6d[_0xb677('0x2e')]['length']?_0x4bfd6d['attributes']:_0x4f4c8d[_0xb677('0x2b')];_0x4bfd6d['order']=qs[_0xb677('0x34')](_0x4c57f7[_0xb677('0x2d')]['sort']);_0x4bfd6d[_0xb677('0x38')]=qs['filters'](_[_0xb677('0x36')](_0x4c57f7['query'],_0x4f4c8d[_0xb677('0x35')]));if(_0x4c57f7[_0xb677('0x2d')][_0xb677('0x37')]){_0x4bfd6d['where']=_[_0xb677('0x39')](_0x4bfd6d[_0xb677('0x38')],{'$or':_[_0xb677('0x27')](_0x4bfd6d['attributes'],function(_0x22d7e6){var _0x4eefc0={};_0x4eefc0[_0x22d7e6]={'$like':'%'+_0x4c57f7['query'][_0xb677('0x37')]+'%'};return _0x4eefc0;})});}_0x4bfd6d=_[_0xb677('0x39')]({},_0x4bfd6d,_0x4c57f7[_0xb677('0x3b')]);return _0x176888[_0xb677('0x47')](_0x4bfd6d);}})[_0xb677('0x21')](function(_0x256140){if(_0x256140){_0x4c87b9=_0x256140['length'];if(!_0x4c57f7[_0xb677('0x2d')][_0xb677('0x32')](_0xb677('0x33'))){_0x4bfd6d[_0xb677('0x1a')]=qs['limit'](_0x4c57f7[_0xb677('0x2d')][_0xb677('0x1a')]);_0x4bfd6d[_0xb677('0x1c')]=qs[_0xb677('0x1c')](_0x4c57f7[_0xb677('0x2d')][_0xb677('0x1c')]);}return _0x176888[_0xb677('0x47')](_0x4bfd6d);}})[_0xb677('0x21')](function(_0x531907){if(_0x531907){return _0x531907?{'count':_0x4c87b9,'rows':_0x531907}:null;}})[_0xb677('0x21')](respondWithResult(_0x241497,null))[_0xb677('0x40')](handleError(_0x241497,null));};exports['getDescriptions']=function(_0x49038a,_0x504d49,_0x4958ac){var _0x3a7922={};var _0x3124e7={};var _0x493182;var _0x297b97;return db[_0xb677('0x28')][_0xb677('0x48')]({'where':{'id':_0x49038a[_0xb677('0x41')]['id']}})[_0xb677('0x21')](handleEntityNotFound(_0x504d49,null))[_0xb677('0x21')](function(_0xbafca8){if(_0xbafca8){_0x493182=_0xbafca8;_0x3124e7[_0xb677('0x2b')]=_['keys'](db[_0xb677('0x49')][_0xb677('0x42')]);_0x3124e7[_0xb677('0x2d')]=_[_0xb677('0x2c')](_0x49038a['query']);_0x3124e7['filters']=_[_0xb677('0x2f')](_0x3124e7[_0xb677('0x2b')],_0x3124e7[_0xb677('0x2d')]);_0x3a7922['attributes']=_[_0xb677('0x2f')](_0x3124e7[_0xb677('0x2b')],qs[_0xb677('0x30')](_0x49038a[_0xb677('0x2d')][_0xb677('0x30')]));_0x3a7922[_0xb677('0x2e')]=_0x3a7922[_0xb677('0x2e')]['length']?_0x3a7922[_0xb677('0x2e')]:_0x3124e7['model'];_0x3a7922[_0xb677('0x4a')]=qs[_0xb677('0x34')](_0x49038a[_0xb677('0x2d')]['sort']);_0x3a7922[_0xb677('0x38')]=qs[_0xb677('0x35')](_[_0xb677('0x36')](_0x49038a[_0xb677('0x2d')],_0x3124e7[_0xb677('0x35')]));if(_0x49038a[_0xb677('0x2d')]['filter']){_0x3a7922['where']=_['merge'](_0x3a7922[_0xb677('0x38')],{'$or':_[_0xb677('0x27')](_0x3a7922[_0xb677('0x2e')],function(_0x20ccc9){var _0x5150e3={};_0x5150e3[_0x20ccc9]={'$like':'%'+_0x49038a[_0xb677('0x2d')][_0xb677('0x37')]+'%'};return _0x5150e3;})});}_0x3a7922=_[_0xb677('0x39')]({},_0x3a7922,_0x49038a[_0xb677('0x3b')]);return _0x493182[_0xb677('0x4b')](_0x3a7922);}})['then'](function(_0x2f387b){if(_0x2f387b){_0x297b97=_0x2f387b['length'];if(!_0x49038a[_0xb677('0x2d')][_0xb677('0x32')]('nolimit')){_0x3a7922[_0xb677('0x1a')]=qs['limit'](_0x49038a[_0xb677('0x2d')]['limit']);_0x3a7922[_0xb677('0x1c')]=qs[_0xb677('0x1c')](_0x49038a[_0xb677('0x2d')][_0xb677('0x1c')]);}return _0x493182['getDescriptions'](_0x3a7922);}})[_0xb677('0x21')](function(_0x4b0963){if(_0x4b0963){return _0x4b0963?{'count':_0x297b97,'rows':_0x4b0963}:null;}})[_0xb677('0x21')](respondWithResult(_0x504d49,null))[_0xb677('0x40')](handleError(_0x504d49,null));};exports['getFields']=function(_0x4ac5a4,_0x1ccdd6,_0x3b777c){var _0x16a98a={};var _0x442431={};var _0x1d045f;var _0x454c3b;return db[_0xb677('0x28')]['findOne']({'where':{'id':_0x4ac5a4[_0xb677('0x41')]['id']}})['then'](handleEntityNotFound(_0x1ccdd6,null))[_0xb677('0x21')](function(_0x299221){if(_0x299221){_0x1d045f=_0x299221;_0x442431[_0xb677('0x2b')]=_[_0xb677('0x2c')](db['FreshsalesField'][_0xb677('0x42')]);_0x442431[_0xb677('0x2d')]=_[_0xb677('0x2c')](_0x4ac5a4[_0xb677('0x2d')]);_0x442431[_0xb677('0x35')]=_['intersection'](_0x442431[_0xb677('0x2b')],_0x442431[_0xb677('0x2d')]);_0x16a98a[_0xb677('0x2e')]=_[_0xb677('0x2f')](_0x442431[_0xb677('0x2b')],qs[_0xb677('0x30')](_0x4ac5a4['query'][_0xb677('0x30')]));_0x16a98a[_0xb677('0x2e')]=_0x16a98a[_0xb677('0x2e')][_0xb677('0x31')]?_0x16a98a[_0xb677('0x2e')]:_0x442431[_0xb677('0x2b')];_0x16a98a[_0xb677('0x4a')]=qs['sort'](_0x4ac5a4[_0xb677('0x2d')][_0xb677('0x34')]);_0x16a98a[_0xb677('0x38')]=qs[_0xb677('0x35')](_['pick'](_0x4ac5a4['query'],_0x442431[_0xb677('0x35')]));if(_0x4ac5a4['query'][_0xb677('0x37')]){_0x16a98a[_0xb677('0x38')]=_[_0xb677('0x39')](_0x16a98a[_0xb677('0x38')],{'$or':_['map'](_0x16a98a['attributes'],function(_0x1bc587){var _0x5655a2={};_0x5655a2[_0x1bc587]={'$like':'%'+_0x4ac5a4[_0xb677('0x2d')][_0xb677('0x37')]+'%'};return _0x5655a2;})});}_0x16a98a=_['merge']({},_0x16a98a,_0x4ac5a4[_0xb677('0x3b')]);return _0x1d045f[_0xb677('0x4c')](_0x16a98a);}})[_0xb677('0x21')](function(_0x57e312){if(_0x57e312){_0x454c3b=_0x57e312['length'];if(!_0x4ac5a4[_0xb677('0x2d')][_0xb677('0x32')](_0xb677('0x33'))){_0x16a98a[_0xb677('0x1a')]=qs[_0xb677('0x1a')](_0x4ac5a4[_0xb677('0x2d')][_0xb677('0x1a')]);_0x16a98a[_0xb677('0x1c')]=qs['offset'](_0x4ac5a4['query'][_0xb677('0x1c')]);}return _0x1d045f[_0xb677('0x4c')](_0x16a98a);}})[_0xb677('0x21')](function(_0x3970ec){if(_0x3970ec){return _0x3970ec?{'count':_0x454c3b,'rows':_0x3970ec}:null;}})[_0xb677('0x21')](respondWithResult(_0x1ccdd6,null))['catch'](handleError(_0x1ccdd6,null));}; \ No newline at end of file +var _0x7e61=['to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','update','then','error','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','intersection','find','create','body','params','getSubjects','findOne','merge','nolimit','FreshsalesField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7e61,0xe0));var _0x17e6=function(_0xc28fbf,_0x4c7009){_0xc28fbf=_0xc28fbf-0x0;var _0x42c598=_0x7e61[_0xc28fbf];return _0x42c598;};'use strict';var emlformat=require(_0x17e6('0x0'));var rimraf=require(_0x17e6('0x1'));var zipdir=require(_0x17e6('0x2'));var jsonpatch=require(_0x17e6('0x3'));var rp=require(_0x17e6('0x4'));var moment=require(_0x17e6('0x5'));var BPromise=require(_0x17e6('0x6'));var Mustache=require(_0x17e6('0x7'));var util=require('util');var path=require(_0x17e6('0x8'));var sox=require(_0x17e6('0x9'));var csv=require('to-csv');var ejs=require(_0x17e6('0xa'));var fs=require('fs');var fs_extra=require(_0x17e6('0xb'));var _=require('lodash');var squel=require(_0x17e6('0xc'));var crypto=require(_0x17e6('0xd'));var jsforce=require(_0x17e6('0xe'));var deskjs=require(_0x17e6('0xf'));var toCsv=require(_0x17e6('0x10'));var querystring=require(_0x17e6('0x11'));var Papa=require('papaparse');var Redis=require(_0x17e6('0x12'));var authService=require(_0x17e6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x17e6('0x14'));var hardwareService=require(_0x17e6('0x15'));var logger=require(_0x17e6('0x16'))(_0x17e6('0x17'));var utils=require(_0x17e6('0x18'));var config=require(_0x17e6('0x19'));var licenseUtil=require(_0x17e6('0x1a'));var db=require(_0x17e6('0x1b'))['db'];function respondWithStatusCode(_0x536978,_0x57be86){_0x57be86=_0x57be86||0xcc;return function(_0x392b3b){if(_0x392b3b){return _0x536978[_0x17e6('0x1c')](_0x57be86);}return _0x536978['status'](_0x57be86)[_0x17e6('0x1d')]();};}function respondWithResult(_0x1bb51a,_0x406163){_0x406163=_0x406163||0xc8;return function(_0x1a7f41){if(_0x1a7f41){return _0x1bb51a[_0x17e6('0x1e')](_0x406163)[_0x17e6('0x1f')](_0x1a7f41);}};}function respondWithFilteredResult(_0x4f1b78,_0x135362){return function(_0x316046){if(_0x316046){var _0x5cc525=typeof _0x135362['offset']===_0x17e6('0x20')&&typeof _0x135362[_0x17e6('0x21')]===_0x17e6('0x20');var _0x1cd4f2=_0x316046['count'];var _0x35688f=_0x5cc525?0x0:_0x135362['offset'];var _0x21abae=_0x5cc525?_0x316046[_0x17e6('0x22')]:_0x135362[_0x17e6('0x23')]+_0x135362[_0x17e6('0x21')];var _0x51518d;if(_0x21abae>=_0x1cd4f2){_0x21abae=_0x1cd4f2;_0x51518d=0xc8;}else{_0x51518d=0xce;}_0x4f1b78[_0x17e6('0x1e')](_0x51518d);return _0x4f1b78[_0x17e6('0x24')](_0x17e6('0x25'),_0x35688f+'-'+_0x21abae+'/'+_0x1cd4f2)['json'](_0x316046);}return null;};}function patchUpdates(_0x2478e2){return function(_0x11c9fc){try{jsonpatch['apply'](_0x11c9fc,_0x2478e2,!![]);}catch(_0x220b26){return BPromise['reject'](_0x220b26);}return _0x11c9fc['save']();};}function saveUpdates(_0xdf7bae,_0x4de478){return function(_0x93a6ee){if(_0x93a6ee){return _0x93a6ee[_0x17e6('0x26')](_0xdf7bae)['then'](function(_0x16ba34){return _0x16ba34;});}return null;};}function removeEntity(_0x5844b5,_0x38ef3d){return function(_0x3ea041){if(_0x3ea041){return _0x3ea041['destroy']()[_0x17e6('0x27')](function(){_0x5844b5[_0x17e6('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b8479,_0xe92287){return function(_0x147ad7){if(!_0x147ad7){_0x4b8479[_0x17e6('0x1c')](0x194);}return _0x147ad7;};}function handleError(_0x6d5383,_0x2cfef6){_0x2cfef6=_0x2cfef6||0x1f4;return function(_0x39d18f){logger[_0x17e6('0x28')](_0x39d18f['stack']);if(_0x39d18f['name']){delete _0x39d18f[_0x17e6('0x29')];}_0x6d5383[_0x17e6('0x1e')](_0x2cfef6)[_0x17e6('0x2a')](_0x39d18f);};}exports[_0x17e6('0x2b')]=function(_0x26ffde,_0x559f39){var _0x5e70ab={},_0x17929c={},_0x5ad1f6={'count':0x0,'rows':[]};var _0x5c5f8c=_['map'](db[_0x17e6('0x2c')][_0x17e6('0x2d')],function(_0x114570){return{'name':_0x114570[_0x17e6('0x2e')],'type':_0x114570[_0x17e6('0x2f')][_0x17e6('0x30')]};});_0x17929c[_0x17e6('0x31')]=_[_0x17e6('0x32')](_0x5c5f8c,_0x17e6('0x29'));_0x17929c[_0x17e6('0x33')]=_[_0x17e6('0x34')](_0x26ffde[_0x17e6('0x33')]);_0x17929c[_0x17e6('0x35')]=_['intersection'](_0x17929c['model'],_0x17929c['query']);_0x5e70ab[_0x17e6('0x36')]=_['intersection'](_0x17929c[_0x17e6('0x31')],qs['fields'](_0x26ffde[_0x17e6('0x33')][_0x17e6('0x37')]));_0x5e70ab[_0x17e6('0x36')]=_0x5e70ab[_0x17e6('0x36')][_0x17e6('0x38')]?_0x5e70ab['attributes']:_0x17929c[_0x17e6('0x31')];if(!_0x26ffde[_0x17e6('0x33')][_0x17e6('0x39')]('nolimit')){_0x5e70ab['limit']=qs[_0x17e6('0x21')](_0x26ffde[_0x17e6('0x33')]['limit']);_0x5e70ab['offset']=qs[_0x17e6('0x23')](_0x26ffde[_0x17e6('0x33')][_0x17e6('0x23')]);}_0x5e70ab[_0x17e6('0x3a')]=qs[_0x17e6('0x3b')](_0x26ffde[_0x17e6('0x33')][_0x17e6('0x3b')]);_0x5e70ab[_0x17e6('0x3c')]=qs[_0x17e6('0x35')](_[_0x17e6('0x3d')](_0x26ffde[_0x17e6('0x33')],_0x17929c[_0x17e6('0x35')]),_0x5c5f8c);if(_0x26ffde[_0x17e6('0x33')][_0x17e6('0x3e')]){_0x5e70ab['where']=_['merge'](_0x5e70ab[_0x17e6('0x3c')],{'$or':_[_0x17e6('0x32')](_0x5c5f8c,function(_0x5b7428){if(_0x5b7428[_0x17e6('0x2f')]!=='VIRTUAL'){var _0x194c72={};_0x194c72[_0x5b7428['name']]={'$like':'%'+_0x26ffde[_0x17e6('0x33')][_0x17e6('0x3e')]+'%'};return _0x194c72;}})});}_0x5e70ab=_['merge']({},_0x5e70ab,_0x26ffde[_0x17e6('0x3f')]);var _0x4bd819={'where':_0x5e70ab[_0x17e6('0x3c')]};return db[_0x17e6('0x2c')][_0x17e6('0x22')](_0x4bd819)['then'](function(_0x3c5846){_0x5ad1f6[_0x17e6('0x22')]=_0x3c5846;if(_0x26ffde[_0x17e6('0x33')][_0x17e6('0x40')]){_0x5e70ab[_0x17e6('0x41')]=[{'all':!![]}];}return db[_0x17e6('0x2c')][_0x17e6('0x42')](_0x5e70ab);})[_0x17e6('0x27')](function(_0x4d5a85){_0x5ad1f6[_0x17e6('0x43')]=_0x4d5a85;return _0x5ad1f6;})[_0x17e6('0x27')](respondWithFilteredResult(_0x559f39,_0x5e70ab))[_0x17e6('0x44')](handleError(_0x559f39,null));};exports['show']=function(_0x134db8,_0x570b8f){var _0xd27b6e={'raw':![],'where':{'id':_0x134db8['params']['id']}},_0x21d14a={};_0x21d14a['model']=_[_0x17e6('0x34')](db[_0x17e6('0x2c')][_0x17e6('0x2d')]);_0x21d14a[_0x17e6('0x33')]=_['keys'](_0x134db8['query']);_0x21d14a[_0x17e6('0x35')]=_[_0x17e6('0x45')](_0x21d14a[_0x17e6('0x31')],_0x21d14a['query']);_0xd27b6e['attributes']=_[_0x17e6('0x45')](_0x21d14a[_0x17e6('0x31')],qs[_0x17e6('0x37')](_0x134db8[_0x17e6('0x33')][_0x17e6('0x37')]));_0xd27b6e[_0x17e6('0x36')]=_0xd27b6e[_0x17e6('0x36')][_0x17e6('0x38')]?_0xd27b6e[_0x17e6('0x36')]:_0x21d14a['model'];if(_0x134db8['query'][_0x17e6('0x40')]){_0xd27b6e[_0x17e6('0x41')]=[{'all':!![]}];}_0xd27b6e=_['merge']({},_0xd27b6e,_0x134db8[_0x17e6('0x3f')]);return db[_0x17e6('0x2c')][_0x17e6('0x46')](_0xd27b6e)[_0x17e6('0x27')](handleEntityNotFound(_0x570b8f,null))[_0x17e6('0x27')](respondWithResult(_0x570b8f,null))[_0x17e6('0x44')](handleError(_0x570b8f,null));};exports[_0x17e6('0x47')]=function(_0x2a659a,_0x4582fd){return db[_0x17e6('0x2c')][_0x17e6('0x47')](_0x2a659a[_0x17e6('0x48')],{})[_0x17e6('0x27')](respondWithResult(_0x4582fd,0xc9))['catch'](handleError(_0x4582fd,null));};exports['update']=function(_0x19deba,_0x20ec4e){if(_0x19deba[_0x17e6('0x48')]['id']){delete _0x19deba['body']['id'];}return db[_0x17e6('0x2c')][_0x17e6('0x46')]({'where':{'id':_0x19deba[_0x17e6('0x49')]['id']}})['then'](handleEntityNotFound(_0x20ec4e,null))[_0x17e6('0x27')](saveUpdates(_0x19deba['body'],null))['then'](respondWithResult(_0x20ec4e,null))['catch'](handleError(_0x20ec4e,null));};exports['destroy']=function(_0x1afef7,_0x25e4ce){return db[_0x17e6('0x2c')]['find']({'where':{'id':_0x1afef7[_0x17e6('0x49')]['id']}})[_0x17e6('0x27')](handleEntityNotFound(_0x25e4ce,null))[_0x17e6('0x27')](removeEntity(_0x25e4ce,null))['catch'](handleError(_0x25e4ce,null));};exports[_0x17e6('0x4a')]=function(_0x156b7f,_0x4b8837,_0x1dc7b7){var _0x2e7013={};var _0x1cc31a={};var _0x4cfcb6;var _0x41cc9d;return db['FreshsalesConfiguration'][_0x17e6('0x4b')]({'where':{'id':_0x156b7f[_0x17e6('0x49')]['id']}})['then'](handleEntityNotFound(_0x4b8837,null))[_0x17e6('0x27')](function(_0x45a02b){if(_0x45a02b){_0x4cfcb6=_0x45a02b;_0x1cc31a[_0x17e6('0x31')]=_[_0x17e6('0x34')](db['FreshsalesField']['rawAttributes']);_0x1cc31a[_0x17e6('0x33')]=_[_0x17e6('0x34')](_0x156b7f['query']);_0x1cc31a[_0x17e6('0x35')]=_[_0x17e6('0x45')](_0x1cc31a[_0x17e6('0x31')],_0x1cc31a[_0x17e6('0x33')]);_0x2e7013['attributes']=_[_0x17e6('0x45')](_0x1cc31a['model'],qs[_0x17e6('0x37')](_0x156b7f[_0x17e6('0x33')]['fields']));_0x2e7013[_0x17e6('0x36')]=_0x2e7013[_0x17e6('0x36')][_0x17e6('0x38')]?_0x2e7013[_0x17e6('0x36')]:_0x1cc31a[_0x17e6('0x31')];_0x2e7013['order']=qs[_0x17e6('0x3b')](_0x156b7f['query']['sort']);_0x2e7013[_0x17e6('0x3c')]=qs[_0x17e6('0x35')](_[_0x17e6('0x3d')](_0x156b7f[_0x17e6('0x33')],_0x1cc31a[_0x17e6('0x35')]));if(_0x156b7f[_0x17e6('0x33')][_0x17e6('0x3e')]){_0x2e7013[_0x17e6('0x3c')]=_['merge'](_0x2e7013[_0x17e6('0x3c')],{'$or':_[_0x17e6('0x32')](_0x2e7013[_0x17e6('0x36')],function(_0x56edfd){var _0xae855e={};_0xae855e[_0x56edfd]={'$like':'%'+_0x156b7f['query']['filter']+'%'};return _0xae855e;})});}_0x2e7013=_[_0x17e6('0x4c')]({},_0x2e7013,_0x156b7f[_0x17e6('0x3f')]);return _0x4cfcb6[_0x17e6('0x4a')](_0x2e7013);}})[_0x17e6('0x27')](function(_0x566c46){if(_0x566c46){_0x41cc9d=_0x566c46['length'];if(!_0x156b7f['query']['hasOwnProperty'](_0x17e6('0x4d'))){_0x2e7013[_0x17e6('0x21')]=qs[_0x17e6('0x21')](_0x156b7f[_0x17e6('0x33')][_0x17e6('0x21')]);_0x2e7013[_0x17e6('0x23')]=qs['offset'](_0x156b7f[_0x17e6('0x33')][_0x17e6('0x23')]);}return _0x4cfcb6[_0x17e6('0x4a')](_0x2e7013);}})[_0x17e6('0x27')](function(_0x181d4c){if(_0x181d4c){return _0x181d4c?{'count':_0x41cc9d,'rows':_0x181d4c}:null;}})['then'](respondWithResult(_0x4b8837,null))[_0x17e6('0x44')](handleError(_0x4b8837,null));};exports['getDescriptions']=function(_0x5c9033,_0x4db5ca,_0x1ed930){var _0x4c0adf={};var _0x3c139b={};var _0xad7e2;var _0x2fd61e;return db[_0x17e6('0x2c')][_0x17e6('0x4b')]({'where':{'id':_0x5c9033[_0x17e6('0x49')]['id']}})[_0x17e6('0x27')](handleEntityNotFound(_0x4db5ca,null))[_0x17e6('0x27')](function(_0xd0f6d1){if(_0xd0f6d1){_0xad7e2=_0xd0f6d1;_0x3c139b[_0x17e6('0x31')]=_['keys'](db[_0x17e6('0x4e')][_0x17e6('0x2d')]);_0x3c139b[_0x17e6('0x33')]=_[_0x17e6('0x34')](_0x5c9033[_0x17e6('0x33')]);_0x3c139b[_0x17e6('0x35')]=_[_0x17e6('0x45')](_0x3c139b[_0x17e6('0x31')],_0x3c139b['query']);_0x4c0adf['attributes']=_['intersection'](_0x3c139b[_0x17e6('0x31')],qs[_0x17e6('0x37')](_0x5c9033['query']['fields']));_0x4c0adf[_0x17e6('0x36')]=_0x4c0adf[_0x17e6('0x36')]['length']?_0x4c0adf[_0x17e6('0x36')]:_0x3c139b[_0x17e6('0x31')];_0x4c0adf[_0x17e6('0x3a')]=qs[_0x17e6('0x3b')](_0x5c9033[_0x17e6('0x33')][_0x17e6('0x3b')]);_0x4c0adf[_0x17e6('0x3c')]=qs[_0x17e6('0x35')](_[_0x17e6('0x3d')](_0x5c9033['query'],_0x3c139b[_0x17e6('0x35')]));if(_0x5c9033[_0x17e6('0x33')][_0x17e6('0x3e')]){_0x4c0adf[_0x17e6('0x3c')]=_[_0x17e6('0x4c')](_0x4c0adf['where'],{'$or':_[_0x17e6('0x32')](_0x4c0adf[_0x17e6('0x36')],function(_0x4381f3){var _0x4f0617={};_0x4f0617[_0x4381f3]={'$like':'%'+_0x5c9033[_0x17e6('0x33')][_0x17e6('0x3e')]+'%'};return _0x4f0617;})});}_0x4c0adf=_[_0x17e6('0x4c')]({},_0x4c0adf,_0x5c9033[_0x17e6('0x3f')]);return _0xad7e2['getDescriptions'](_0x4c0adf);}})[_0x17e6('0x27')](function(_0x1d5099){if(_0x1d5099){_0x2fd61e=_0x1d5099[_0x17e6('0x38')];if(!_0x5c9033[_0x17e6('0x33')][_0x17e6('0x39')]('nolimit')){_0x4c0adf[_0x17e6('0x21')]=qs[_0x17e6('0x21')](_0x5c9033[_0x17e6('0x33')][_0x17e6('0x21')]);_0x4c0adf[_0x17e6('0x23')]=qs[_0x17e6('0x23')](_0x5c9033[_0x17e6('0x33')][_0x17e6('0x23')]);}return _0xad7e2[_0x17e6('0x4f')](_0x4c0adf);}})['then'](function(_0x7751ee){if(_0x7751ee){return _0x7751ee?{'count':_0x2fd61e,'rows':_0x7751ee}:null;}})[_0x17e6('0x27')](respondWithResult(_0x4db5ca,null))[_0x17e6('0x44')](handleError(_0x4db5ca,null));};exports['getFields']=function(_0x11b308,_0x24c4dc,_0x3bf041){var _0x39d1b1={};var _0x4f7f26={};var _0x44f0a1;var _0x298b36;return db[_0x17e6('0x2c')]['findOne']({'where':{'id':_0x11b308[_0x17e6('0x49')]['id']}})[_0x17e6('0x27')](handleEntityNotFound(_0x24c4dc,null))[_0x17e6('0x27')](function(_0xbbb97f){if(_0xbbb97f){_0x44f0a1=_0xbbb97f;_0x4f7f26[_0x17e6('0x31')]=_[_0x17e6('0x34')](db[_0x17e6('0x4e')][_0x17e6('0x2d')]);_0x4f7f26[_0x17e6('0x33')]=_[_0x17e6('0x34')](_0x11b308[_0x17e6('0x33')]);_0x4f7f26[_0x17e6('0x35')]=_[_0x17e6('0x45')](_0x4f7f26['model'],_0x4f7f26[_0x17e6('0x33')]);_0x39d1b1['attributes']=_['intersection'](_0x4f7f26['model'],qs[_0x17e6('0x37')](_0x11b308[_0x17e6('0x33')][_0x17e6('0x37')]));_0x39d1b1[_0x17e6('0x36')]=_0x39d1b1[_0x17e6('0x36')]['length']?_0x39d1b1[_0x17e6('0x36')]:_0x4f7f26[_0x17e6('0x31')];_0x39d1b1[_0x17e6('0x3a')]=qs['sort'](_0x11b308['query'][_0x17e6('0x3b')]);_0x39d1b1[_0x17e6('0x3c')]=qs[_0x17e6('0x35')](_[_0x17e6('0x3d')](_0x11b308[_0x17e6('0x33')],_0x4f7f26[_0x17e6('0x35')]));if(_0x11b308['query'][_0x17e6('0x3e')]){_0x39d1b1[_0x17e6('0x3c')]=_['merge'](_0x39d1b1['where'],{'$or':_[_0x17e6('0x32')](_0x39d1b1[_0x17e6('0x36')],function(_0x4f85a3){var _0x340345={};_0x340345[_0x4f85a3]={'$like':'%'+_0x11b308[_0x17e6('0x33')][_0x17e6('0x3e')]+'%'};return _0x340345;})});}_0x39d1b1=_[_0x17e6('0x4c')]({},_0x39d1b1,_0x11b308['options']);return _0x44f0a1['getFields'](_0x39d1b1);}})['then'](function(_0x370845){if(_0x370845){_0x298b36=_0x370845[_0x17e6('0x38')];if(!_0x11b308[_0x17e6('0x33')][_0x17e6('0x39')](_0x17e6('0x4d'))){_0x39d1b1['limit']=qs['limit'](_0x11b308['query'][_0x17e6('0x21')]);_0x39d1b1[_0x17e6('0x23')]=qs[_0x17e6('0x23')](_0x11b308[_0x17e6('0x33')][_0x17e6('0x23')]);}return _0x44f0a1['getFields'](_0x39d1b1);}})[_0x17e6('0x27')](function(_0x2f4253){if(_0x2f4253){return _0x2f4253?{'count':_0x298b36,'rows':_0x2f4253}:null;}})[_0x17e6('0x27')](respondWithResult(_0x24c4dc,null))[_0x17e6('0x44')](handleError(_0x24c4dc,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 31cd02d..aae041e 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 _0xc5aa=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','int_freshsales_configurations'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xc5aa,0x1e0));var _0xac5a=function(_0x20440d,_0x28466f){_0x20440d=_0x20440d-0x0;var _0x22b52d=_0xc5aa[_0x20440d];return _0x22b52d;};'use strict';var _=require('lodash');var util=require(_0xac5a('0x0'));var logger=require(_0xac5a('0x1'))(_0xac5a('0x2'));var moment=require(_0xac5a('0x3'));var BPromise=require(_0xac5a('0x4'));var rp=require(_0xac5a('0x5'));var fs=require('fs');var path=require(_0xac5a('0x6'));var rimraf=require(_0xac5a('0x7'));var config=require(_0xac5a('0x8'));var attributes=require(_0xac5a('0x9'));module['exports']=function(_0x5e7912,_0x3debdc){return _0x5e7912[_0xac5a('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0xac5a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d1d=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','int_freshsales_configurations','lodash'];(function(_0xe495a7,_0x3b4589){var _0x1cc145=function(_0x578d41){while(--_0x578d41){_0xe495a7['push'](_0xe495a7['shift']());}};_0x1cc145(++_0x3b4589);}(_0x8d1d,0x135));var _0xd8d1=function(_0x26e8cd,_0x4b5df5){_0x26e8cd=_0x26e8cd-0x0;var _0x3b8c85=_0x8d1d[_0x26e8cd];return _0x3b8c85;};'use strict';var _=require(_0xd8d1('0x0'));var util=require(_0xd8d1('0x1'));var logger=require(_0xd8d1('0x2'))(_0xd8d1('0x3'));var moment=require(_0xd8d1('0x4'));var BPromise=require(_0xd8d1('0x5'));var rp=require(_0xd8d1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd8d1('0x7'));var config=require(_0xd8d1('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x34c390,_0x54f061){return _0x34c390['define']('FreshsalesConfiguration',attributes,{'tableName':_0xd8d1('0x9'),'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 4c70968..c19d7a2 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 _0xec7a=['request\x20sent','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x3d8a41,_0x2b0fbe){var _0x28675e=function(_0x222859){while(--_0x222859){_0x3d8a41['push'](_0x3d8a41['shift']());}};_0x28675e(++_0x2b0fbe);}(_0xec7a,0x1cf));var _0xaec7=function(_0x343b56,_0x27ebbf){_0x343b56=_0x343b56-0x0;var _0x4bdc57=_0xec7a[_0x343b56];return _0x4bdc57;};'use strict';var _=require('lodash');var util=require(_0xaec7('0x0'));var moment=require(_0xaec7('0x1'));var BPromise=require(_0xaec7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaec7('0x3'));var db=require(_0xaec7('0x4'))['db'];var utils=require(_0xaec7('0x5'));var logger=require(_0xaec7('0x6'))(_0xaec7('0x7'));var config=require(_0xaec7('0x8'));var jayson=require(_0xaec7('0x9'));var client=jayson[_0xaec7('0xa')][_0xaec7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x386f2a,_0x56f072,_0x5601d3){return new BPromise(function(_0x28bb57,_0x380e67){return client['request'](_0x386f2a,_0x5601d3)[_0xaec7('0xc')](function(_0x546e16){logger[_0xaec7('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x56f072,'request\x20sent');logger[_0xaec7('0xe')](_0xaec7('0xf'),_0x56f072,'request\x20sent',JSON[_0xaec7('0x10')](_0x546e16));if(_0x546e16[_0xaec7('0x11')]){if(_0x546e16[_0xaec7('0x11')]['code']===0x1f4){logger[_0xaec7('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x56f072,_0x546e16[_0xaec7('0x11')]['message']);return _0x380e67(_0x546e16[_0xaec7('0x11')][_0xaec7('0x12')]);}logger[_0xaec7('0x11')](_0xaec7('0x13'),_0x56f072,_0x546e16[_0xaec7('0x11')][_0xaec7('0x12')]);return _0x28bb57(_0x546e16['error'][_0xaec7('0x12')]);}else{logger[_0xaec7('0xd')](_0xaec7('0x13'),_0x56f072,_0xaec7('0x14'));_0x28bb57(_0x546e16[_0xaec7('0x15')]['message']);}})[_0xaec7('0x16')](function(_0x552d1b){logger[_0xaec7('0x11')](_0xaec7('0x13'),_0x56f072,_0x552d1b);_0x380e67(_0x552d1b);});});} \ No newline at end of file +var _0x4abd=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','ioredis'];(function(_0x29eeb3,_0x189911){var _0x34e287=function(_0xcf4a87){while(--_0xcf4a87){_0x29eeb3['push'](_0x29eeb3['shift']());}};_0x34e287(++_0x189911);}(_0x4abd,0x7a));var _0xd4ab=function(_0x2e2104,_0x11287d){_0x2e2104=_0x2e2104-0x0;var _0x1280c5=_0x4abd[_0x2e2104];return _0x1280c5;};'use strict';var _=require(_0xd4ab('0x0'));var util=require(_0xd4ab('0x1'));var moment=require(_0xd4ab('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4ab('0x3'));var db=require(_0xd4ab('0x4'))['db'];var utils=require(_0xd4ab('0x5'));var logger=require(_0xd4ab('0x6'))(_0xd4ab('0x7'));var config=require('../../config/environment');var jayson=require(_0xd4ab('0x8'));var client=jayson[_0xd4ab('0x9')][_0xd4ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e3676,_0x5107ae,_0x566592){return new BPromise(function(_0x5506e0,_0x2b7212){return client[_0xd4ab('0xb')](_0x1e3676,_0x566592)['then'](function(_0x3741c9){logger['info'](_0xd4ab('0xc'),_0x5107ae,_0xd4ab('0xd'));logger[_0xd4ab('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x5107ae,_0xd4ab('0xd'),JSON[_0xd4ab('0xf')](_0x3741c9));if(_0x3741c9['error']){if(_0x3741c9[_0xd4ab('0x10')][_0xd4ab('0x11')]===0x1f4){logger[_0xd4ab('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5107ae,_0x3741c9[_0xd4ab('0x10')][_0xd4ab('0x12')]);return _0x2b7212(_0x3741c9[_0xd4ab('0x10')][_0xd4ab('0x12')]);}logger[_0xd4ab('0x10')](_0xd4ab('0xc'),_0x5107ae,_0x3741c9[_0xd4ab('0x10')][_0xd4ab('0x12')]);return _0x5506e0(_0x3741c9[_0xd4ab('0x10')][_0xd4ab('0x12')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5107ae,_0xd4ab('0xd'));_0x5506e0(_0x3741c9[_0xd4ab('0x13')][_0xd4ab('0x12')]);}})[_0xd4ab('0x14')](function(_0x3e254f){logger[_0xd4ab('0x10')](_0xd4ab('0xc'),_0x5107ae,_0x3e254f);_0x2b7212(_0x3e254f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 0ff242c..75b1e6e 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 _0x3098=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','post','/:id','update','delete','destroy'];(function(_0x454e6d,_0x1e1f38){var _0x4bc294=function(_0x2c803a){while(--_0x2c803a){_0x454e6d['push'](_0x454e6d['shift']());}};_0x4bc294(++_0x1e1f38);}(_0x3098,0x86));var _0x8309=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0x3098[_0x3e6b2f];return _0x323215;};'use strict';var multer=require(_0x8309('0x0'));var util=require(_0x8309('0x1'));var path=require(_0x8309('0x2'));var timeout=require(_0x8309('0x3'));var express=require('express');var router=express[_0x8309('0x4')]();var fs_extra=require(_0x8309('0x5'));var auth=require(_0x8309('0x6'));var interaction=require(_0x8309('0x7'));var config=require(_0x8309('0x8'));var controller=require(_0x8309('0x9'));router[_0x8309('0xa')]('/',auth[_0x8309('0xb')](),controller[_0x8309('0xc')]);router[_0x8309('0xa')]('/:id',auth[_0x8309('0xb')](),controller['show']);router[_0x8309('0xd')]('/',auth[_0x8309('0xb')](),controller['create']);router['put'](_0x8309('0xe'),auth[_0x8309('0xb')](),controller[_0x8309('0xf')]);router[_0x8309('0x10')](_0x8309('0xe'),auth['isAuthenticated'](),controller[_0x8309('0x11')]);module[_0x8309('0x12')]=router; \ No newline at end of file +var _0xa5ca=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2d194a,_0x197dbf){var _0x147d83=function(_0x4c5f4b){while(--_0x4c5f4b){_0x2d194a['push'](_0x2d194a['shift']());}};_0x147d83(++_0x197dbf);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xa5ca[_0x1a7846];return _0x48049;};'use strict';var multer=require(_0xaa5c('0x0'));var util=require(_0xaa5c('0x1'));var path=require(_0xaa5c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaa5c('0x3')]();var fs_extra=require(_0xaa5c('0x4'));var auth=require(_0xaa5c('0x5'));var interaction=require(_0xaa5c('0x6'));var config=require(_0xaa5c('0x7'));var controller=require(_0xaa5c('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xaa5c('0x9')](_0xaa5c('0xa'),auth[_0xaa5c('0xb')](),controller['show']);router['post']('/',auth[_0xaa5c('0xb')](),controller[_0xaa5c('0xc')]);router[_0xaa5c('0xd')]('/:id',auth[_0xaa5c('0xb')](),controller[_0xaa5c('0xe')]);router[_0xaa5c('0xf')](_0xaa5c('0xa'),auth[_0xaa5c('0xb')](),controller[_0xaa5c('0x10')]);module[_0xaa5c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 0aa41e2..01b6c81 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 _0x91e2=['string','STRING','ENUM','BOOLEAN','sequelize','variable','customVariable'];(function(_0x4d6830,_0x54e1f5){var _0xaa7ea=function(_0x545a49){while(--_0x545a49){_0x4d6830['push'](_0x4d6830['shift']());}};_0xaa7ea(++_0x54e1f5);}(_0x91e2,0x1d2));var _0x291e=function(_0x2462c7,_0x51b09d){_0x2462c7=_0x2462c7-0x0;var _0x1afbf7=_0x91e2[_0x2462c7];return _0x1afbf7;};'use strict';var Sequelize=require(_0x291e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x291e('0x1'),_0x291e('0x2'),'keyValue','picklist'),'defaultValue':_0x291e('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x291e('0x4')]},'keyType':{'type':Sequelize[_0x291e('0x5')](_0x291e('0x3'),'variable',_0x291e('0x2'))},'keyContent':{'type':Sequelize[_0x291e('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x291e('0x4')]},'customField':{'type':Sequelize[_0x291e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x291e('0x4')]}}; \ No newline at end of file +var _0xea47=['variable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x507ec6,_0x5c9a15){var _0x2f70f0=function(_0x4aa2d4){while(--_0x4aa2d4){_0x507ec6['push'](_0x507ec6['shift']());}};_0x2f70f0(++_0x5c9a15);}(_0xea47,0x1eb));var _0x7ea4=function(_0xb365df,_0x28b3b2){_0xb365df=_0xb365df-0x0;var _0x2870ba=_0xea47[_0xb365df];return _0x2870ba;};'use strict';var Sequelize=require(_0x7ea4('0x0'));module[_0x7ea4('0x1')]={'type':{'type':Sequelize[_0x7ea4('0x2')](_0x7ea4('0x3'),_0x7ea4('0x4'),'customVariable',_0x7ea4('0x5'),_0x7ea4('0x6')),'defaultValue':_0x7ea4('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7ea4('0x7')]},'keyType':{'type':Sequelize[_0x7ea4('0x2')](_0x7ea4('0x3'),_0x7ea4('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x7ea4('0x7')]},'idField':{'type':Sequelize[_0x7ea4('0x7')]},'nameField':{'type':Sequelize[_0x7ea4('0x7')]},'customField':{'type':Sequelize[_0x7ea4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7ea4('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 1a0a1b0..a8728c5 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 _0x38c9=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','merge','options','includeAll','include','rows','catch','show','params','create','body','find','eml-format','rimraf'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0x38c9,0x122));var _0x938c=function(_0x2f1114,_0x4561f1){_0x2f1114=_0x2f1114-0x0;var _0x2fe856=_0x38c9[_0x2f1114];return _0x2fe856;};'use strict';var emlformat=require(_0x938c('0x0'));var rimraf=require(_0x938c('0x1'));var zipdir=require(_0x938c('0x2'));var jsonpatch=require(_0x938c('0x3'));var rp=require(_0x938c('0x4'));var moment=require('moment');var BPromise=require(_0x938c('0x5'));var Mustache=require(_0x938c('0x6'));var util=require(_0x938c('0x7'));var path=require(_0x938c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x938c('0x9'));var fs=require('fs');var fs_extra=require(_0x938c('0xa'));var _=require(_0x938c('0xb'));var squel=require('squel');var crypto=require(_0x938c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x938c('0xd'));var toCsv=require(_0x938c('0xe'));var querystring=require(_0x938c('0xf'));var Papa=require(_0x938c('0x10'));var Redis=require(_0x938c('0x11'));var authService=require(_0x938c('0x12'));var qs=require(_0x938c('0x13'));var as=require(_0x938c('0x14'));var hardwareService=require(_0x938c('0x15'));var logger=require(_0x938c('0x16'))(_0x938c('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x938c('0x18'));var db=require(_0x938c('0x19'))['db'];function respondWithStatusCode(_0x476906,_0x269aff){_0x269aff=_0x269aff||0xcc;return function(_0x14c517){if(_0x14c517){return _0x476906['sendStatus'](_0x269aff);}return _0x476906['status'](_0x269aff)[_0x938c('0x1a')]();};}function respondWithResult(_0x27d3ff,_0x2beab2){_0x2beab2=_0x2beab2||0xc8;return function(_0x468d2c){if(_0x468d2c){return _0x27d3ff['status'](_0x2beab2)[_0x938c('0x1b')](_0x468d2c);}};}function respondWithFilteredResult(_0x3cef52,_0x22ff23){return function(_0x1fbb34){if(_0x1fbb34){var _0x38666c=typeof _0x22ff23['offset']===_0x938c('0x1c')&&typeof _0x22ff23[_0x938c('0x1d')]===_0x938c('0x1c');var _0x560872=_0x1fbb34['count'];var _0x548905=_0x38666c?0x0:_0x22ff23[_0x938c('0x1e')];var _0x468362=_0x38666c?_0x1fbb34[_0x938c('0x1f')]:_0x22ff23[_0x938c('0x1e')]+_0x22ff23['limit'];var _0x514d21;if(_0x468362>=_0x560872){_0x468362=_0x560872;_0x514d21=0xc8;}else{_0x514d21=0xce;}_0x3cef52[_0x938c('0x20')](_0x514d21);return _0x3cef52[_0x938c('0x21')](_0x938c('0x22'),_0x548905+'-'+_0x468362+'/'+_0x560872)[_0x938c('0x1b')](_0x1fbb34);}return null;};}function patchUpdates(_0x5272ac){return function(_0x460e80){try{jsonpatch[_0x938c('0x23')](_0x460e80,_0x5272ac,!![]);}catch(_0x260b29){return BPromise['reject'](_0x260b29);}return _0x460e80[_0x938c('0x24')]();};}function saveUpdates(_0x2202ba,_0x138365){return function(_0x52c1da){if(_0x52c1da){return _0x52c1da[_0x938c('0x25')](_0x2202ba)[_0x938c('0x26')](function(_0x441b61){return _0x441b61;});}return null;};}function removeEntity(_0x4592e0,_0x3080f0){return function(_0x27d2a8){if(_0x27d2a8){return _0x27d2a8[_0x938c('0x27')]()['then'](function(){_0x4592e0[_0x938c('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x119ddc,_0x227736){return function(_0x12e002){if(!_0x12e002){_0x119ddc[_0x938c('0x28')](0x194);}return _0x12e002;};}function handleError(_0x4c5377,_0x338ab4){_0x338ab4=_0x338ab4||0x1f4;return function(_0x36549d){logger['error'](_0x36549d['stack']);if(_0x36549d[_0x938c('0x29')]){delete _0x36549d[_0x938c('0x29')];}_0x4c5377[_0x938c('0x20')](_0x338ab4)[_0x938c('0x2a')](_0x36549d);};}exports[_0x938c('0x2b')]=function(_0x128462,_0x20cf4e){var _0x2ab87c={},_0x39d0fe={},_0x6e4e6b={'count':0x0,'rows':[]};var _0x5f6f30=_[_0x938c('0x2c')](db[_0x938c('0x2d')][_0x938c('0x2e')],function(_0x1b119c){return{'name':_0x1b119c[_0x938c('0x2f')],'type':_0x1b119c[_0x938c('0x30')][_0x938c('0x31')]};});_0x39d0fe[_0x938c('0x32')]=_[_0x938c('0x2c')](_0x5f6f30,_0x938c('0x29'));_0x39d0fe[_0x938c('0x33')]=_[_0x938c('0x34')](_0x128462['query']);_0x39d0fe['filters']=_['intersection'](_0x39d0fe[_0x938c('0x32')],_0x39d0fe[_0x938c('0x33')]);_0x2ab87c[_0x938c('0x35')]=_[_0x938c('0x36')](_0x39d0fe[_0x938c('0x32')],qs[_0x938c('0x37')](_0x128462['query'][_0x938c('0x37')]));_0x2ab87c['attributes']=_0x2ab87c[_0x938c('0x35')][_0x938c('0x38')]?_0x2ab87c[_0x938c('0x35')]:_0x39d0fe[_0x938c('0x32')];if(!_0x128462[_0x938c('0x33')]['hasOwnProperty'](_0x938c('0x39'))){_0x2ab87c[_0x938c('0x1d')]=qs[_0x938c('0x1d')](_0x128462[_0x938c('0x33')][_0x938c('0x1d')]);_0x2ab87c[_0x938c('0x1e')]=qs[_0x938c('0x1e')](_0x128462[_0x938c('0x33')][_0x938c('0x1e')]);}_0x2ab87c['order']=qs[_0x938c('0x3a')](_0x128462['query'][_0x938c('0x3a')]);_0x2ab87c[_0x938c('0x3b')]=qs[_0x938c('0x3c')](_[_0x938c('0x3d')](_0x128462[_0x938c('0x33')],_0x39d0fe['filters']),_0x5f6f30);if(_0x128462[_0x938c('0x33')]['filter']){_0x2ab87c[_0x938c('0x3b')]=_['merge'](_0x2ab87c[_0x938c('0x3b')],{'$or':_['map'](_0x5f6f30,function(_0x42feb8){if(_0x42feb8[_0x938c('0x30')]!=='VIRTUAL'){var _0x1e200e={};_0x1e200e[_0x42feb8[_0x938c('0x29')]]={'$like':'%'+_0x128462[_0x938c('0x33')]['filter']+'%'};return _0x1e200e;}})});}_0x2ab87c=_[_0x938c('0x3e')]({},_0x2ab87c,_0x128462[_0x938c('0x3f')]);var _0x135110={'where':_0x2ab87c['where']};return db[_0x938c('0x2d')][_0x938c('0x1f')](_0x135110)[_0x938c('0x26')](function(_0x4792e3){_0x6e4e6b['count']=_0x4792e3;if(_0x128462[_0x938c('0x33')][_0x938c('0x40')]){_0x2ab87c[_0x938c('0x41')]=[{'all':!![]}];}return db[_0x938c('0x2d')]['findAll'](_0x2ab87c);})['then'](function(_0x352bc1){_0x6e4e6b[_0x938c('0x42')]=_0x352bc1;return _0x6e4e6b;})[_0x938c('0x26')](respondWithFilteredResult(_0x20cf4e,_0x2ab87c))[_0x938c('0x43')](handleError(_0x20cf4e,null));};exports[_0x938c('0x44')]=function(_0x5fbd64,_0x4d6fd2){var _0x515a15={'raw':!![],'where':{'id':_0x5fbd64[_0x938c('0x45')]['id']}},_0x1b5016={};_0x1b5016['model']=_[_0x938c('0x34')](db['FreshsalesField'][_0x938c('0x2e')]);_0x1b5016[_0x938c('0x33')]=_[_0x938c('0x34')](_0x5fbd64[_0x938c('0x33')]);_0x1b5016['filters']=_[_0x938c('0x36')](_0x1b5016[_0x938c('0x32')],_0x1b5016[_0x938c('0x33')]);_0x515a15[_0x938c('0x35')]=_['intersection'](_0x1b5016['model'],qs[_0x938c('0x37')](_0x5fbd64[_0x938c('0x33')][_0x938c('0x37')]));_0x515a15[_0x938c('0x35')]=_0x515a15[_0x938c('0x35')][_0x938c('0x38')]?_0x515a15[_0x938c('0x35')]:_0x1b5016[_0x938c('0x32')];if(_0x5fbd64[_0x938c('0x33')][_0x938c('0x40')]){_0x515a15['include']=[{'all':!![]}];}_0x515a15=_['merge']({},_0x515a15,_0x5fbd64[_0x938c('0x3f')]);return db[_0x938c('0x2d')]['find'](_0x515a15)['then'](handleEntityNotFound(_0x4d6fd2,null))[_0x938c('0x26')](respondWithResult(_0x4d6fd2,null))[_0x938c('0x43')](handleError(_0x4d6fd2,null));};exports[_0x938c('0x46')]=function(_0x2cc951,_0x37cfb5){return db[_0x938c('0x2d')][_0x938c('0x46')](_0x2cc951[_0x938c('0x47')],{})[_0x938c('0x26')](respondWithResult(_0x37cfb5,0xc9))['catch'](handleError(_0x37cfb5,null));};exports[_0x938c('0x25')]=function(_0xd227a3,_0x15e5ca){if(_0xd227a3['body']['id']){delete _0xd227a3['body']['id'];}return db[_0x938c('0x2d')]['find']({'where':{'id':_0xd227a3[_0x938c('0x45')]['id']}})['then'](handleEntityNotFound(_0x15e5ca,null))[_0x938c('0x26')](saveUpdates(_0xd227a3[_0x938c('0x47')],null))[_0x938c('0x26')](respondWithResult(_0x15e5ca,null))[_0x938c('0x43')](handleError(_0x15e5ca,null));};exports[_0x938c('0x27')]=function(_0x519c5d,_0x277263){return db[_0x938c('0x2d')][_0x938c('0x48')]({'where':{'id':_0x519c5d[_0x938c('0x45')]['id']}})[_0x938c('0x26')](handleEntityNotFound(_0x277263,null))[_0x938c('0x26')](removeEntity(_0x277263,null))['catch'](handleError(_0x277263,null));}; \ No newline at end of file +var _0xd3c7=['map','FreshsalesField','rawAttributes','fieldName','key','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','findAll','rows','catch','show','params','keys','include','find','create','body','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','reject','save','update','then','destroy','error','stack','name','send','index'];(function(_0x44af93,_0x45fa15){var _0x22eef3=function(_0x53dc6f){while(--_0x53dc6f){_0x44af93['push'](_0x44af93['shift']());}};_0x22eef3(++_0x45fa15);}(_0xd3c7,0xfe));var _0x7d3c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd3c7[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7d3c('0x0'));var rp=require(_0x7d3c('0x1'));var moment=require(_0x7d3c('0x2'));var BPromise=require(_0x7d3c('0x3'));var Mustache=require(_0x7d3c('0x4'));var util=require(_0x7d3c('0x5'));var path=require('path');var sox=require(_0x7d3c('0x6'));var csv=require(_0x7d3c('0x7'));var ejs=require(_0x7d3c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7d3c('0x9'));var crypto=require(_0x7d3c('0xa'));var jsforce=require(_0x7d3c('0xb'));var deskjs=require(_0x7d3c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7d3c('0xd'));var Papa=require(_0x7d3c('0xe'));var Redis=require(_0x7d3c('0xf'));var authService=require(_0x7d3c('0x10'));var qs=require(_0x7d3c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d3c('0x12'));var logger=require(_0x7d3c('0x13'))(_0x7d3c('0x14'));var utils=require('../../config/utils');var config=require(_0x7d3c('0x15'));var licenseUtil=require(_0x7d3c('0x16'));var db=require(_0x7d3c('0x17'))['db'];function respondWithStatusCode(_0x2066a5,_0x3cdbc3){_0x3cdbc3=_0x3cdbc3||0xcc;return function(_0x15bfa7){if(_0x15bfa7){return _0x2066a5[_0x7d3c('0x18')](_0x3cdbc3);}return _0x2066a5[_0x7d3c('0x19')](_0x3cdbc3)[_0x7d3c('0x1a')]();};}function respondWithResult(_0x3d4703,_0x48c4af){_0x48c4af=_0x48c4af||0xc8;return function(_0x441e57){if(_0x441e57){return _0x3d4703[_0x7d3c('0x19')](_0x48c4af)['json'](_0x441e57);}};}function respondWithFilteredResult(_0x108c68,_0x2f57ef){return function(_0x4599ca){if(_0x4599ca){var _0xa3723e=typeof _0x2f57ef['offset']===_0x7d3c('0x1b')&&typeof _0x2f57ef[_0x7d3c('0x1c')]===_0x7d3c('0x1b');var _0x402c82=_0x4599ca[_0x7d3c('0x1d')];var _0x267788=_0xa3723e?0x0:_0x2f57ef[_0x7d3c('0x1e')];var _0x486360=_0xa3723e?_0x4599ca['count']:_0x2f57ef[_0x7d3c('0x1e')]+_0x2f57ef[_0x7d3c('0x1c')];var _0x2f19ec;if(_0x486360>=_0x402c82){_0x486360=_0x402c82;_0x2f19ec=0xc8;}else{_0x2f19ec=0xce;}_0x108c68[_0x7d3c('0x19')](_0x2f19ec);return _0x108c68[_0x7d3c('0x1f')]('Content-Range',_0x267788+'-'+_0x486360+'/'+_0x402c82)['json'](_0x4599ca);}return null;};}function patchUpdates(_0xcd07ae){return function(_0x5b8cc3){try{jsonpatch['apply'](_0x5b8cc3,_0xcd07ae,!![]);}catch(_0x34a882){return BPromise[_0x7d3c('0x20')](_0x34a882);}return _0x5b8cc3[_0x7d3c('0x21')]();};}function saveUpdates(_0x2f7a41,_0x449f80){return function(_0x5629e0){if(_0x5629e0){return _0x5629e0[_0x7d3c('0x22')](_0x2f7a41)[_0x7d3c('0x23')](function(_0x4404d2){return _0x4404d2;});}return null;};}function removeEntity(_0x2f2c3e,_0x52dd5b){return function(_0x440bcd){if(_0x440bcd){return _0x440bcd[_0x7d3c('0x24')]()[_0x7d3c('0x23')](function(){_0x2f2c3e[_0x7d3c('0x19')](0xcc)[_0x7d3c('0x1a')]();});}};}function handleEntityNotFound(_0x47d165,_0x8cde9){return function(_0x319b82){if(!_0x319b82){_0x47d165[_0x7d3c('0x18')](0x194);}return _0x319b82;};}function handleError(_0x42d417,_0x18abf6){_0x18abf6=_0x18abf6||0x1f4;return function(_0x3f3dd0){logger[_0x7d3c('0x25')](_0x3f3dd0[_0x7d3c('0x26')]);if(_0x3f3dd0[_0x7d3c('0x27')]){delete _0x3f3dd0[_0x7d3c('0x27')];}_0x42d417[_0x7d3c('0x19')](_0x18abf6)[_0x7d3c('0x28')](_0x3f3dd0);};}exports[_0x7d3c('0x29')]=function(_0x326750,_0x29c139){var _0x21f82d={},_0x5ecefa={},_0x18796f={'count':0x0,'rows':[]};var _0x3bc32e=_[_0x7d3c('0x2a')](db[_0x7d3c('0x2b')][_0x7d3c('0x2c')],function(_0xa8e5c5){return{'name':_0xa8e5c5[_0x7d3c('0x2d')],'type':_0xa8e5c5['type'][_0x7d3c('0x2e')]};});_0x5ecefa['model']=_[_0x7d3c('0x2a')](_0x3bc32e,_0x7d3c('0x27'));_0x5ecefa[_0x7d3c('0x2f')]=_['keys'](_0x326750[_0x7d3c('0x2f')]);_0x5ecefa[_0x7d3c('0x30')]=_[_0x7d3c('0x31')](_0x5ecefa['model'],_0x5ecefa[_0x7d3c('0x2f')]);_0x21f82d['attributes']=_[_0x7d3c('0x31')](_0x5ecefa['model'],qs[_0x7d3c('0x32')](_0x326750['query']['fields']));_0x21f82d[_0x7d3c('0x33')]=_0x21f82d['attributes'][_0x7d3c('0x34')]?_0x21f82d[_0x7d3c('0x33')]:_0x5ecefa[_0x7d3c('0x35')];if(!_0x326750[_0x7d3c('0x2f')][_0x7d3c('0x36')](_0x7d3c('0x37'))){_0x21f82d[_0x7d3c('0x1c')]=qs[_0x7d3c('0x1c')](_0x326750[_0x7d3c('0x2f')]['limit']);_0x21f82d['offset']=qs[_0x7d3c('0x1e')](_0x326750[_0x7d3c('0x2f')][_0x7d3c('0x1e')]);}_0x21f82d[_0x7d3c('0x38')]=qs['sort'](_0x326750[_0x7d3c('0x2f')][_0x7d3c('0x39')]);_0x21f82d[_0x7d3c('0x3a')]=qs['filters'](_['pick'](_0x326750[_0x7d3c('0x2f')],_0x5ecefa['filters']),_0x3bc32e);if(_0x326750[_0x7d3c('0x2f')]['filter']){_0x21f82d[_0x7d3c('0x3a')]=_[_0x7d3c('0x3b')](_0x21f82d[_0x7d3c('0x3a')],{'$or':_[_0x7d3c('0x2a')](_0x3bc32e,function(_0x1c54d6){if(_0x1c54d6[_0x7d3c('0x3c')]!==_0x7d3c('0x3d')){var _0x4b7903={};_0x4b7903[_0x1c54d6[_0x7d3c('0x27')]]={'$like':'%'+_0x326750[_0x7d3c('0x2f')][_0x7d3c('0x3e')]+'%'};return _0x4b7903;}})});}_0x21f82d=_[_0x7d3c('0x3b')]({},_0x21f82d,_0x326750[_0x7d3c('0x3f')]);var _0x2c855c={'where':_0x21f82d[_0x7d3c('0x3a')]};return db[_0x7d3c('0x2b')]['count'](_0x2c855c)[_0x7d3c('0x23')](function(_0x44da26){_0x18796f[_0x7d3c('0x1d')]=_0x44da26;if(_0x326750[_0x7d3c('0x2f')]['includeAll']){_0x21f82d['include']=[{'all':!![]}];}return db[_0x7d3c('0x2b')][_0x7d3c('0x40')](_0x21f82d);})[_0x7d3c('0x23')](function(_0x1ff098){_0x18796f[_0x7d3c('0x41')]=_0x1ff098;return _0x18796f;})[_0x7d3c('0x23')](respondWithFilteredResult(_0x29c139,_0x21f82d))[_0x7d3c('0x42')](handleError(_0x29c139,null));};exports[_0x7d3c('0x43')]=function(_0x457df6,_0x1834c9){var _0x49ef1a={'raw':!![],'where':{'id':_0x457df6[_0x7d3c('0x44')]['id']}},_0x4da7b7={};_0x4da7b7[_0x7d3c('0x35')]=_['keys'](db[_0x7d3c('0x2b')][_0x7d3c('0x2c')]);_0x4da7b7[_0x7d3c('0x2f')]=_[_0x7d3c('0x45')](_0x457df6[_0x7d3c('0x2f')]);_0x4da7b7[_0x7d3c('0x30')]=_['intersection'](_0x4da7b7[_0x7d3c('0x35')],_0x4da7b7[_0x7d3c('0x2f')]);_0x49ef1a[_0x7d3c('0x33')]=_[_0x7d3c('0x31')](_0x4da7b7[_0x7d3c('0x35')],qs[_0x7d3c('0x32')](_0x457df6[_0x7d3c('0x2f')]['fields']));_0x49ef1a[_0x7d3c('0x33')]=_0x49ef1a[_0x7d3c('0x33')][_0x7d3c('0x34')]?_0x49ef1a[_0x7d3c('0x33')]:_0x4da7b7[_0x7d3c('0x35')];if(_0x457df6[_0x7d3c('0x2f')]['includeAll']){_0x49ef1a[_0x7d3c('0x46')]=[{'all':!![]}];}_0x49ef1a=_[_0x7d3c('0x3b')]({},_0x49ef1a,_0x457df6['options']);return db[_0x7d3c('0x2b')][_0x7d3c('0x47')](_0x49ef1a)['then'](handleEntityNotFound(_0x1834c9,null))['then'](respondWithResult(_0x1834c9,null))[_0x7d3c('0x42')](handleError(_0x1834c9,null));};exports[_0x7d3c('0x48')]=function(_0x3f3edf,_0x845061){return db['FreshsalesField'][_0x7d3c('0x48')](_0x3f3edf[_0x7d3c('0x49')],{})['then'](respondWithResult(_0x845061,0xc9))[_0x7d3c('0x42')](handleError(_0x845061,null));};exports[_0x7d3c('0x22')]=function(_0x3c0d9e,_0x910254){if(_0x3c0d9e[_0x7d3c('0x49')]['id']){delete _0x3c0d9e[_0x7d3c('0x49')]['id'];}return db['FreshsalesField'][_0x7d3c('0x47')]({'where':{'id':_0x3c0d9e['params']['id']}})['then'](handleEntityNotFound(_0x910254,null))[_0x7d3c('0x23')](saveUpdates(_0x3c0d9e[_0x7d3c('0x49')],null))[_0x7d3c('0x23')](respondWithResult(_0x910254,null))[_0x7d3c('0x42')](handleError(_0x910254,null));};exports[_0x7d3c('0x24')]=function(_0x3f2df7,_0x2c74cc){return db[_0x7d3c('0x2b')][_0x7d3c('0x47')]({'where':{'id':_0x3f2df7[_0x7d3c('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c74cc,null))[_0x7d3c('0x23')](removeEntity(_0x2c74cc,null))[_0x7d3c('0x42')](handleError(_0x2c74cc,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index e36d592..2c42fd0 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 _0x7497=['../../config/logger','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util'];(function(_0x38725d,_0x3f5001){var _0x51a6c8=function(_0x5bad4e){while(--_0x5bad4e){_0x38725d['push'](_0x38725d['shift']());}};_0x51a6c8(++_0x3f5001);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7749('0x0'));var util=require(_0x7749('0x1'));var logger=require(_0x7749('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7749('0x3'));var fs=require('fs');var path=require(_0x7749('0x4'));var rimraf=require('rimraf');var config=require(_0x7749('0x5'));var attributes=require(_0x7749('0x6'));module[_0x7749('0x7')]=function(_0x455d05,_0x289268){return _0x455d05[_0x7749('0x8')](_0x7749('0x9'),attributes,{'tableName':_0x7749('0xa'),'paranoid':![],'indexes':[{'name':_0x7749('0xb'),'fields':[_0x7749('0xc'),_0x7749('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c91=['idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','int_freshsales_fields','freshsales_unique_index'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x3c91,0x1af));var _0x13c9=function(_0x110bbb,_0x55d31d){_0x110bbb=_0x110bbb-0x0;var _0x531ba9=_0x3c91[_0x110bbb];return _0x531ba9;};'use strict';var _=require(_0x13c9('0x0'));var util=require(_0x13c9('0x1'));var logger=require(_0x13c9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x13c9('0x3'));var rp=require(_0x13c9('0x4'));var fs=require('fs');var path=require(_0x13c9('0x5'));var rimraf=require('rimraf');var config=require(_0x13c9('0x6'));var attributes=require(_0x13c9('0x7'));module[_0x13c9('0x8')]=function(_0x8eedb,_0x1c6771){return _0x8eedb['define']('FreshsalesField',attributes,{'tableName':_0x13c9('0x9'),'paranoid':![],'indexes':[{'name':_0x13c9('0xa'),'fields':[_0x13c9('0xb'),_0x13c9('0xc')],'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 f1bd76d..ea43432 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x4dd4b2,_0x3387aa){var _0x11fd69=function(_0xf5cde){while(--_0xf5cde){_0x4dd4b2['push'](_0x4dd4b2['shift']());}};_0x11fd69(++_0x3387aa);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xc4aa[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x326f=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x9d9a2e,_0x8eea54){var _0x1602fb=function(_0x55ec7f){while(--_0x55ec7f){_0x9d9a2e['push'](_0x9d9a2e['shift']());}};_0x1602fb(++_0x8eea54);}(_0x326f,0xd1));var _0xf326=function(_0x27b698,_0x306f80){_0x27b698=_0x27b698-0x0;var _0x365008=_0x326f[_0x27b698];return _0x365008;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 43e7cfe..5204831 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(_0xb96537,_0x1ba0df){var _0x38f1b4=function(_0xf54922){while(--_0xf54922){_0xb96537['push'](_0xb96537['shift']());}};_0x38f1b4(++_0x1ba0df);}(_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','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2e88cd,_0x3e595d){var _0x5d9e0f=function(_0x37cc35){while(--_0x37cc35){_0x2e88cd['push'](_0x2e88cd['shift']());}};_0x5d9e0f(++_0x3e595d);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 b3c6fb3..3ab8e6f 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 _0x1967=['STRING','username','ENUM','integrationTab','newTab','exports'];(function(_0x47bab5,_0x67fdf3){var _0x47be91=function(_0x268dc1){while(--_0x268dc1){_0x47bab5['push'](_0x47bab5['shift']());}};_0x47be91(++_0x67fdf3);}(_0x1967,0x173));var _0x7196=function(_0x1111b5,_0x19d2bb){_0x1111b5=_0x1111b5-0x0;var _0x13e790=_0x1967[_0x1111b5];return _0x13e790;};'use strict';var Sequelize=require('sequelize');module[_0x7196('0x0')]={'name':{'type':Sequelize[_0x7196('0x1')]},'description':{'type':Sequelize[_0x7196('0x1')]},'username':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x2')},'remoteUri':{'type':Sequelize[_0x7196('0x1')]},'password':{'type':Sequelize[_0x7196('0x1')]},'clientId':{'type':Sequelize[_0x7196('0x1')]},'clientSecret':{'type':Sequelize[_0x7196('0x1')]},'securityToken':{'type':Sequelize[_0x7196('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7196('0x3')](_0x7196('0x4'),_0x7196('0x5')),'defaultValue':_0x7196('0x4')}}; \ No newline at end of file +var _0x235b=['integrationTab','sequelize','STRING','username','ENUM','newTab'];(function(_0x390733,_0x1e3d32){var _0x33beb9=function(_0x4491a3){while(--_0x4491a3){_0x390733['push'](_0x390733['shift']());}};_0x33beb9(++_0x1e3d32);}(_0x235b,0x1ed));var _0xb235=function(_0x3c842a,_0xc4874d){_0x3c842a=_0x3c842a-0x0;var _0x22791a=_0x235b[_0x3c842a];return _0x22791a;};'use strict';var Sequelize=require(_0xb235('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb235('0x1')]},'username':{'type':Sequelize[_0xb235('0x1')],'unique':_0xb235('0x2')},'remoteUri':{'type':Sequelize[_0xb235('0x1')]},'password':{'type':Sequelize[_0xb235('0x1')]},'clientId':{'type':Sequelize[_0xb235('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xb235('0x1')]},'serverUrl':{'type':Sequelize[_0xb235('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb235('0x3')]('integrationTab',_0xb235('0x4')),'defaultValue':_0xb235('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 3366e40..2fb6d46 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 _0xb2fe=['keys','rawAttributes','includeAll','create','body','findOne','order','pick','nolimit','getConfigurations','addConfiguration','Subjects','getSubjects','channel','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','password','securityToken','slice','substring','Connection','clientSecret','login','username','concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','Description','int','picklist','boolean','textarea','remove','includes','label','custom','picklistValues','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','SalesforceAccount','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params'];(function(_0x146d8c,_0x2dae71){var _0x4970c6=function(_0x29e848){while(--_0x29e848){_0x146d8c['push'](_0x146d8c['shift']());}};_0x4970c6(++_0x2dae71);}(_0xb2fe,0xaf));var _0xeb2f=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0xb2fe[_0xa990b7];return _0x52c99c;};'use strict';var emlformat=require(_0xeb2f('0x0'));var rimraf=require(_0xeb2f('0x1'));var zipdir=require(_0xeb2f('0x2'));var jsonpatch=require(_0xeb2f('0x3'));var rp=require('request-promise');var moment=require(_0xeb2f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeb2f('0x5'));var path=require(_0xeb2f('0x6'));var sox=require(_0xeb2f('0x7'));var csv=require(_0xeb2f('0x8'));var ejs=require(_0xeb2f('0x9'));var fs=require('fs');var fs_extra=require(_0xeb2f('0xa'));var _=require('lodash');var squel=require(_0xeb2f('0xb'));var crypto=require(_0xeb2f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xeb2f('0xd'));var toCsv=require(_0xeb2f('0x8'));var querystring=require(_0xeb2f('0xe'));var Papa=require('papaparse');var Redis=require(_0xeb2f('0xf'));var authService=require(_0xeb2f('0x10'));var qs=require(_0xeb2f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb2f('0x12'));var logger=require(_0xeb2f('0x13'))(_0xeb2f('0x14'));var utils=require(_0xeb2f('0x15'));var config=require(_0xeb2f('0x16'));var licenseUtil=require(_0xeb2f('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeb2f('0x18'));function respondWithStatusCode(_0x753847,_0xd576f1){_0xd576f1=_0xd576f1||0xcc;return function(_0x334300){if(_0x334300){return _0x753847['sendStatus'](_0xd576f1);}return _0x753847[_0xeb2f('0x19')](_0xd576f1)[_0xeb2f('0x1a')]();};}function respondWithResult(_0x4d076b,_0x424aea){_0x424aea=_0x424aea||0xc8;return function(_0x4d1a5f){if(_0x4d1a5f){return _0x4d076b['status'](_0x424aea)['json'](_0x4d1a5f);}};}function respondWithFilteredResult(_0x539221,_0x27689b){return function(_0x338a66){if(_0x338a66){var _0x53f2f6=typeof _0x27689b[_0xeb2f('0x1b')]===_0xeb2f('0x1c')&&typeof _0x27689b['limit']===_0xeb2f('0x1c');var _0x59e959=_0x338a66[_0xeb2f('0x1d')];var _0xc4aef2=_0x53f2f6?0x0:_0x27689b['offset'];var _0x4b9d25=_0x53f2f6?_0x338a66['count']:_0x27689b[_0xeb2f('0x1b')]+_0x27689b['limit'];var _0xcebaeb;if(_0x4b9d25>=_0x59e959){_0x4b9d25=_0x59e959;_0xcebaeb=0xc8;}else{_0xcebaeb=0xce;}_0x539221[_0xeb2f('0x19')](_0xcebaeb);return _0x539221[_0xeb2f('0x1e')](_0xeb2f('0x1f'),_0xc4aef2+'-'+_0x4b9d25+'/'+_0x59e959)[_0xeb2f('0x20')](_0x338a66);}return null;};}function patchUpdates(_0x4acd37){return function(_0x9aaa5){try{jsonpatch[_0xeb2f('0x21')](_0x9aaa5,_0x4acd37,!![]);}catch(_0x2001a8){return BPromise[_0xeb2f('0x22')](_0x2001a8);}return _0x9aaa5['save']();};}function saveUpdates(_0x2edf2b,_0x3c8737){return function(_0xc6ed8f){if(_0xc6ed8f){return _0xc6ed8f[_0xeb2f('0x23')](_0x2edf2b)[_0xeb2f('0x24')](function(_0x23a12f){return _0x23a12f;});}return null;};}function removeEntity(_0x263956,_0x210ffd){return function(_0xa5928f){if(_0xa5928f){return _0xa5928f[_0xeb2f('0x25')]()['then'](function(){_0x263956[_0xeb2f('0x19')](0xcc)[_0xeb2f('0x1a')]();});}};}function handleEntityNotFound(_0x32ec9d,_0xfef247){return function(_0x494076){if(!_0x494076){_0x32ec9d[_0xeb2f('0x26')](0x194);}return _0x494076;};}function handleError(_0x584997,_0x9671d2){_0x9671d2=_0x9671d2||0x1f4;return function(_0x23c1a6){logger[_0xeb2f('0x27')](_0x23c1a6[_0xeb2f('0x28')]);if(_0x23c1a6[_0xeb2f('0x29')]){delete _0x23c1a6[_0xeb2f('0x29')];}_0x584997[_0xeb2f('0x19')](_0x9671d2)['send'](_0x23c1a6);};}exports[_0xeb2f('0x2a')]=function(_0x5121ed,_0x52dea0){var _0x612413={},_0x2f4016={},_0x5e2461={'count':0x0,'rows':[]};var _0x41db7f=_[_0xeb2f('0x2b')](db[_0xeb2f('0x2c')]['rawAttributes'],function(_0x1e883b){return{'name':_0x1e883b[_0xeb2f('0x2d')],'type':_0x1e883b[_0xeb2f('0x2e')][_0xeb2f('0x2f')]};});_0x2f4016[_0xeb2f('0x30')]=_[_0xeb2f('0x2b')](_0x41db7f,_0xeb2f('0x29'));_0x2f4016[_0xeb2f('0x31')]=_['keys'](_0x5121ed[_0xeb2f('0x31')]);_0x2f4016['filters']=_[_0xeb2f('0x32')](_0x2f4016[_0xeb2f('0x30')],_0x2f4016[_0xeb2f('0x31')]);_0x612413[_0xeb2f('0x33')]=_[_0xeb2f('0x32')](_0x2f4016['model'],qs[_0xeb2f('0x34')](_0x5121ed[_0xeb2f('0x31')][_0xeb2f('0x34')]));_0x612413[_0xeb2f('0x33')]=_0x612413['attributes'][_0xeb2f('0x35')]?_0x612413[_0xeb2f('0x33')]:_0x2f4016[_0xeb2f('0x30')];if(!_0x5121ed[_0xeb2f('0x31')][_0xeb2f('0x36')]('nolimit')){_0x612413[_0xeb2f('0x37')]=qs['limit'](_0x5121ed[_0xeb2f('0x31')][_0xeb2f('0x37')]);_0x612413[_0xeb2f('0x1b')]=qs[_0xeb2f('0x1b')](_0x5121ed['query'][_0xeb2f('0x1b')]);}_0x612413['order']=qs[_0xeb2f('0x38')](_0x5121ed['query']['sort']);_0x612413[_0xeb2f('0x39')]=qs[_0xeb2f('0x3a')](_['pick'](_0x5121ed['query'],_0x2f4016[_0xeb2f('0x3a')]),_0x41db7f);if(_0x5121ed[_0xeb2f('0x31')][_0xeb2f('0x3b')]){_0x612413[_0xeb2f('0x39')]=_['merge'](_0x612413[_0xeb2f('0x39')],{'$or':_[_0xeb2f('0x2b')](_0x41db7f,function(_0x2433c0){if(_0x2433c0[_0xeb2f('0x2e')]!==_0xeb2f('0x3c')){var _0x33d58d={};_0x33d58d[_0x2433c0[_0xeb2f('0x29')]]={'$like':'%'+_0x5121ed[_0xeb2f('0x31')][_0xeb2f('0x3b')]+'%'};return _0x33d58d;}})});}_0x612413=_[_0xeb2f('0x3d')]({},_0x612413,_0x5121ed[_0xeb2f('0x3e')]);var _0x2e40dd={'where':_0x612413[_0xeb2f('0x39')]};return db[_0xeb2f('0x2c')][_0xeb2f('0x1d')](_0x2e40dd)[_0xeb2f('0x24')](function(_0xb9e4f7){_0x5e2461[_0xeb2f('0x1d')]=_0xb9e4f7;if(_0x5121ed[_0xeb2f('0x31')]['includeAll']){_0x612413[_0xeb2f('0x3f')]=[{'all':!![]}];}return db[_0xeb2f('0x2c')][_0xeb2f('0x40')](_0x612413);})['then'](function(_0x5c9403){_0x5e2461[_0xeb2f('0x41')]=_0x5c9403;return _0x5e2461;})[_0xeb2f('0x24')](respondWithFilteredResult(_0x52dea0,_0x612413))[_0xeb2f('0x42')](handleError(_0x52dea0,null));};exports[_0xeb2f('0x43')]=function(_0x464dc7,_0x3cb2d2){var _0x174e33={'raw':![],'where':{'id':_0x464dc7[_0xeb2f('0x44')]['id']}},_0x37cebf={};_0x37cebf[_0xeb2f('0x30')]=_[_0xeb2f('0x45')](db[_0xeb2f('0x2c')][_0xeb2f('0x46')]);_0x37cebf[_0xeb2f('0x31')]=_[_0xeb2f('0x45')](_0x464dc7[_0xeb2f('0x31')]);_0x37cebf[_0xeb2f('0x3a')]=_['intersection'](_0x37cebf[_0xeb2f('0x30')],_0x37cebf[_0xeb2f('0x31')]);_0x174e33[_0xeb2f('0x33')]=_['intersection'](_0x37cebf[_0xeb2f('0x30')],qs[_0xeb2f('0x34')](_0x464dc7['query'][_0xeb2f('0x34')]));_0x174e33[_0xeb2f('0x33')]=_0x174e33[_0xeb2f('0x33')][_0xeb2f('0x35')]?_0x174e33[_0xeb2f('0x33')]:_0x37cebf[_0xeb2f('0x30')];if(_0x464dc7[_0xeb2f('0x31')][_0xeb2f('0x47')]){_0x174e33['include']=[{'all':!![]}];}_0x174e33=_[_0xeb2f('0x3d')]({},_0x174e33,_0x464dc7[_0xeb2f('0x3e')]);return db[_0xeb2f('0x2c')]['find'](_0x174e33)[_0xeb2f('0x24')](handleEntityNotFound(_0x3cb2d2,null))[_0xeb2f('0x24')](respondWithResult(_0x3cb2d2,null))[_0xeb2f('0x42')](handleError(_0x3cb2d2,null));};exports[_0xeb2f('0x48')]=function(_0x8c603c,_0x90d834){return db[_0xeb2f('0x2c')][_0xeb2f('0x48')](_0x8c603c['body'],{})['then'](respondWithResult(_0x90d834,0xc9))[_0xeb2f('0x42')](handleError(_0x90d834,null));};exports['update']=function(_0x24447f,_0x51c74f){if(_0x24447f[_0xeb2f('0x49')]['id']){delete _0x24447f[_0xeb2f('0x49')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x24447f[_0xeb2f('0x44')]['id']}})[_0xeb2f('0x24')](handleEntityNotFound(_0x51c74f,null))[_0xeb2f('0x24')](saveUpdates(_0x24447f[_0xeb2f('0x49')],null))[_0xeb2f('0x24')](respondWithResult(_0x51c74f,null))[_0xeb2f('0x42')](handleError(_0x51c74f,null));};exports[_0xeb2f('0x25')]=function(_0x381d85,_0x4a960c){return db[_0xeb2f('0x2c')]['find']({'where':{'id':_0x381d85[_0xeb2f('0x44')]['id']}})[_0xeb2f('0x24')](handleEntityNotFound(_0x4a960c,null))[_0xeb2f('0x24')](removeEntity(_0x4a960c,null))['catch'](handleError(_0x4a960c,null));};exports['getConfigurations']=function(_0x31c380,_0x19aa36,_0x547b56){var _0x2b5641={};var _0x4c076e={};var _0x42740f;var _0x233ec0;return db[_0xeb2f('0x2c')][_0xeb2f('0x4a')]({'where':{'id':_0x31c380['params']['id']}})['then'](handleEntityNotFound(_0x19aa36,null))[_0xeb2f('0x24')](function(_0x56d506){if(_0x56d506){_0x42740f=_0x56d506;_0x4c076e[_0xeb2f('0x30')]=_['keys'](db['SalesforceConfiguration']['rawAttributes']);_0x4c076e[_0xeb2f('0x31')]=_[_0xeb2f('0x45')](_0x31c380[_0xeb2f('0x31')]);_0x4c076e[_0xeb2f('0x3a')]=_[_0xeb2f('0x32')](_0x4c076e[_0xeb2f('0x30')],_0x4c076e['query']);_0x2b5641[_0xeb2f('0x33')]=_[_0xeb2f('0x32')](_0x4c076e[_0xeb2f('0x30')],qs[_0xeb2f('0x34')](_0x31c380[_0xeb2f('0x31')]['fields']));_0x2b5641['attributes']=_0x2b5641[_0xeb2f('0x33')]['length']?_0x2b5641[_0xeb2f('0x33')]:_0x4c076e['model'];_0x2b5641[_0xeb2f('0x4b')]=qs[_0xeb2f('0x38')](_0x31c380['query'][_0xeb2f('0x38')]);_0x2b5641['where']=qs['filters'](_[_0xeb2f('0x4c')](_0x31c380[_0xeb2f('0x31')],_0x4c076e['filters']));if(_0x31c380[_0xeb2f('0x31')][_0xeb2f('0x3b')]){_0x2b5641[_0xeb2f('0x39')]=_[_0xeb2f('0x3d')](_0x2b5641[_0xeb2f('0x39')],{'$or':_[_0xeb2f('0x2b')](_0x2b5641['attributes'],function(_0xe1c1eb){var _0x5354c6={};_0x5354c6[_0xe1c1eb]={'$like':'%'+_0x31c380[_0xeb2f('0x31')][_0xeb2f('0x3b')]+'%'};return _0x5354c6;})});}_0x2b5641=_[_0xeb2f('0x3d')]({},_0x2b5641,_0x31c380['options']);return _0x42740f['getConfigurations'](_0x2b5641);}})[_0xeb2f('0x24')](function(_0x2d7d27){if(_0x2d7d27){_0x233ec0=_0x2d7d27[_0xeb2f('0x35')];if(!_0x31c380[_0xeb2f('0x31')]['hasOwnProperty'](_0xeb2f('0x4d'))){_0x2b5641[_0xeb2f('0x37')]=qs[_0xeb2f('0x37')](_0x31c380[_0xeb2f('0x31')][_0xeb2f('0x37')]);_0x2b5641[_0xeb2f('0x1b')]=qs['offset'](_0x31c380[_0xeb2f('0x31')][_0xeb2f('0x1b')]);}return _0x42740f[_0xeb2f('0x4e')](_0x2b5641);}})['then'](function(_0x2a794d){if(_0x2a794d){return _0x2a794d?{'count':_0x233ec0,'rows':_0x2a794d}:null;}})['then'](respondWithResult(_0x19aa36,null))[_0xeb2f('0x42')](handleError(_0x19aa36,null));};exports[_0xeb2f('0x4f')]=function(_0x362c30,_0x3ec188,_0x4267e3){if(_0x362c30[_0xeb2f('0x49')]['id']){delete _0x362c30[_0xeb2f('0x49')]['id'];}return db[_0xeb2f('0x2c')]['findOne']({'where':{'id':_0x362c30[_0xeb2f('0x44')]['id']}})[_0xeb2f('0x24')](handleEntityNotFound(_0x3ec188,null))[_0xeb2f('0x24')](function(_0x41e786){if(_0x41e786){_0x362c30['body']['AccountId']=_0x41e786['id'];_0x362c30[_0xeb2f('0x49')][_0xeb2f('0x50')]=integrations[_0xeb2f('0x51')](_0x362c30['body'][_0xeb2f('0x52')],_0x362c30[_0xeb2f('0x49')][_0xeb2f('0x2e')]);_0x362c30[_0xeb2f('0x49')]['Descriptions']=integrations['getDescriptions'](_0x362c30[_0xeb2f('0x49')][_0xeb2f('0x52')],_0x362c30['body'][_0xeb2f('0x2e')]);return db['SalesforceConfiguration'][_0xeb2f('0x48')](_0x362c30[_0xeb2f('0x49')],{'include':[{'model':db['SalesforceField'],'as':_0xeb2f('0x50')},{'model':db[_0xeb2f('0x53')],'as':_0xeb2f('0x54')}]});}return null;})[_0xeb2f('0x24')](respondWithResult(_0x3ec188,null))['catch'](handleError(_0x3ec188,null));};exports[_0xeb2f('0x55')]=function(_0x2e5ac5,_0x16de3b,_0x266742){var _0x5db8d9;var _0x44c6c9='';var _0x10f510=_0xeb2f('0x56');return db[_0xeb2f('0x2c')][_0xeb2f('0x4a')]({'where':{'id':_0x2e5ac5['params']['id']},'attributes':['id',_0xeb2f('0x57'),_0xeb2f('0x58'),'clientSecret','username',_0xeb2f('0x59'),_0xeb2f('0x5a')]})[_0xeb2f('0x24')](handleEntityNotFound(_0x16de3b,null))[_0xeb2f('0x24')](function(_0x1d5bbf){if(_0x1d5bbf){_0x44c6c9=_0x1d5bbf[_0xeb2f('0x57')];var _0x5bb9ab=_0x44c6c9[_0xeb2f('0x5b')](-0x1);if(_0x5bb9ab==='/'){_0x44c6c9=_0x44c6c9[_0xeb2f('0x5c')](0x0,_0x44c6c9['lastIndexOf'](_0x5bb9ab));}_0x5db8d9=new jsforce[(_0xeb2f('0x5d'))]({'oauth2':{'loginUrl':_0x44c6c9,'clientId':_0x1d5bbf[_0xeb2f('0x58')],'clientSecret':_0x1d5bbf[_0xeb2f('0x5e')]}});return _0x5db8d9[_0xeb2f('0x5f')](_0x1d5bbf[_0xeb2f('0x60')],_0x1d5bbf[_0xeb2f('0x59')][_0xeb2f('0x61')](_0x1d5bbf[_0xeb2f('0x5a')]));}})['then'](function(_0x4a87bd){if(_0x4a87bd){if(!_[_0xeb2f('0x62')](_0x2e5ac5['query'][_0xeb2f('0x63')])){_0x10f510=_0x2e5ac5[_0xeb2f('0x31')][_0xeb2f('0x63')];}return _0x5db8d9[_0xeb2f('0x64')](_0x10f510)[_0xeb2f('0x65')]();}})[_0xeb2f('0x24')](function(_0x5170c5){var _0x21acdf=['OwnerId',_0xeb2f('0x66'),_0xeb2f('0x67'),'IsRecurrence','Subject',_0xeb2f('0x68')];var _0x59f419=['string',_0xeb2f('0x69'),_0xeb2f('0x6a'),_0xeb2f('0x6b'),'email',_0xeb2f('0x6c'),'phone'];if(_0x5170c5){_[_0xeb2f('0x6d')](_0x5170c5[_0xeb2f('0x34')],function(_0x46d9b7){return _0x21acdf[_0xeb2f('0x6e')](_0x46d9b7[_0xeb2f('0x29')])||!_0x59f419[_0xeb2f('0x6e')](_0x46d9b7[_0xeb2f('0x2e')]);});return{'count':_0x5170c5[_0xeb2f('0x34')][_0xeb2f('0x35')],'rows':_['map'](_0x5170c5[_0xeb2f('0x34')],function(_0x19f29d){return{'id':_0x19f29d[_0xeb2f('0x29')],'name':_0x19f29d[_0xeb2f('0x6f')],'custom':_0x19f29d[_0xeb2f('0x70')],'options':_0x19f29d[_0xeb2f('0x71')][_0xeb2f('0x35')]>0x0?_['map'](_0x19f29d[_0xeb2f('0x71')],function(_0x456e87){return{'name':_0x456e87['label'],'value':_0x456e87['value']};}):_0x19f29d[_0xeb2f('0x2e')]=='boolean'?[{'name':'True','value':_0xeb2f('0x72')},{'name':_0xeb2f('0x73'),'value':'false'}]:[]};})};}})[_0xeb2f('0x24')](respondWithResult(_0x16de3b,null))[_0xeb2f('0x42')](function(_0x801840){var _0x2953d6=_0x2e5ac5[_0xeb2f('0x31')][_0xeb2f('0x74')]?0x1f4:_0x801840[_0xeb2f('0x75')]||0x1f4;logger[_0xeb2f('0x27')](_0xeb2f('0x76'),_0xeb2f('0x55'),_0x2953d6,JSON[_0xeb2f('0x77')](_0x801840));delete _0x801840[_0xeb2f('0x29')];if(_0x2953d6===0x191){_0x2953d6=0x190;}_0x16de3b[_0xeb2f('0x19')](_0x2953d6)[_0xeb2f('0x78')](_0x2e5ac5['query']['test']?{'message':_0xeb2f('0x79'),'statusCode':_0x801840[_0xeb2f('0x75')]}:_0x801840);});}; \ No newline at end of file +var _0xa04b=['send','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','SalesforceAccount','includeAll','findAll','rows','catch','show','params','keys','length','include','create','body','findOne','SalesforceConfiguration','filter','getConfigurations','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','slice','substring','lastIndexOf','login','password','securityToken','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','Description','int','email','textarea','remove','includes','custom','picklistValues','label','value','boolean','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','offset','count','limit','set','apply','reject','update','then','destroy','error','name'];(function(_0x1de2bd,_0x953fb){var _0x595960=function(_0xea260b){while(--_0xea260b){_0x1de2bd['push'](_0x1de2bd['shift']());}};_0x595960(++_0x953fb);}(_0xa04b,0x1b6));var _0xba04=function(_0x4b1375,_0x57b8a4){_0x4b1375=_0x4b1375-0x0;var _0x2bda3c=_0xa04b[_0x4b1375];return _0x2bda3c;};'use strict';var emlformat=require(_0xba04('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba04('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba04('0x2'));var moment=require(_0xba04('0x3'));var BPromise=require(_0xba04('0x4'));var Mustache=require(_0xba04('0x5'));var util=require(_0xba04('0x6'));var path=require('path');var sox=require(_0xba04('0x7'));var csv=require(_0xba04('0x8'));var ejs=require(_0xba04('0x9'));var fs=require('fs');var fs_extra=require(_0xba04('0xa'));var _=require(_0xba04('0xb'));var squel=require(_0xba04('0xc'));var crypto=require('crypto');var jsforce=require(_0xba04('0xd'));var deskjs=require(_0xba04('0xe'));var toCsv=require(_0xba04('0x8'));var querystring=require(_0xba04('0xf'));var Papa=require(_0xba04('0x10'));var Redis=require(_0xba04('0x11'));var authService=require(_0xba04('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xba04('0x13'));var hardwareService=require(_0xba04('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xba04('0x15'));var config=require(_0xba04('0x16'));var licenseUtil=require(_0xba04('0x17'));var db=require(_0xba04('0x18'))['db'];var integrations=require(_0xba04('0x19'));function respondWithStatusCode(_0x13ef77,_0x212456){_0x212456=_0x212456||0xcc;return function(_0x39bbca){if(_0x39bbca){return _0x13ef77[_0xba04('0x1a')](_0x212456);}return _0x13ef77[_0xba04('0x1b')](_0x212456)[_0xba04('0x1c')]();};}function respondWithResult(_0x93cfb5,_0x16e53f){_0x16e53f=_0x16e53f||0xc8;return function(_0x2966e9){if(_0x2966e9){return _0x93cfb5[_0xba04('0x1b')](_0x16e53f)[_0xba04('0x1d')](_0x2966e9);}};}function respondWithFilteredResult(_0x1b80a9,_0x1382a2){return function(_0x254961){if(_0x254961){var _0x9370fb=typeof _0x1382a2['offset']===_0xba04('0x1e')&&typeof _0x1382a2['limit']==='undefined';var _0x492fa8=_0x254961['count'];var _0x517ca3=_0x9370fb?0x0:_0x1382a2[_0xba04('0x1f')];var _0xfd8ac0=_0x9370fb?_0x254961[_0xba04('0x20')]:_0x1382a2[_0xba04('0x1f')]+_0x1382a2[_0xba04('0x21')];var _0x5a4dd0;if(_0xfd8ac0>=_0x492fa8){_0xfd8ac0=_0x492fa8;_0x5a4dd0=0xc8;}else{_0x5a4dd0=0xce;}_0x1b80a9['status'](_0x5a4dd0);return _0x1b80a9[_0xba04('0x22')]('Content-Range',_0x517ca3+'-'+_0xfd8ac0+'/'+_0x492fa8)['json'](_0x254961);}return null;};}function patchUpdates(_0xdec040){return function(_0x19509b){try{jsonpatch[_0xba04('0x23')](_0x19509b,_0xdec040,!![]);}catch(_0x34c3eb){return BPromise[_0xba04('0x24')](_0x34c3eb);}return _0x19509b['save']();};}function saveUpdates(_0x168957,_0x14efc0){return function(_0x53ce6a){if(_0x53ce6a){return _0x53ce6a[_0xba04('0x25')](_0x168957)[_0xba04('0x26')](function(_0x3f69b6){return _0x3f69b6;});}return null;};}function removeEntity(_0x43c91a,_0x2e320f){return function(_0x193958){if(_0x193958){return _0x193958[_0xba04('0x27')]()[_0xba04('0x26')](function(){_0x43c91a[_0xba04('0x1b')](0xcc)[_0xba04('0x1c')]();});}};}function handleEntityNotFound(_0x4832d3,_0x29ea17){return function(_0x1fb95b){if(!_0x1fb95b){_0x4832d3['sendStatus'](0x194);}return _0x1fb95b;};}function handleError(_0x2bd644,_0x14e5b5){_0x14e5b5=_0x14e5b5||0x1f4;return function(_0x46e62b){logger[_0xba04('0x28')](_0x46e62b['stack']);if(_0x46e62b[_0xba04('0x29')]){delete _0x46e62b['name'];}_0x2bd644['status'](_0x14e5b5)[_0xba04('0x2a')](_0x46e62b);};}exports['index']=function(_0x4eeb2d,_0x59b75a){var _0x41bafe={},_0x2b30e5={},_0x32408e={'count':0x0,'rows':[]};var _0x4d8e6c=_['map'](db['SalesforceAccount'][_0xba04('0x2b')],function(_0x5220f6){return{'name':_0x5220f6[_0xba04('0x2c')],'type':_0x5220f6[_0xba04('0x2d')][_0xba04('0x2e')]};});_0x2b30e5[_0xba04('0x2f')]=_[_0xba04('0x30')](_0x4d8e6c,_0xba04('0x29'));_0x2b30e5[_0xba04('0x31')]=_['keys'](_0x4eeb2d[_0xba04('0x31')]);_0x2b30e5['filters']=_[_0xba04('0x32')](_0x2b30e5[_0xba04('0x2f')],_0x2b30e5['query']);_0x41bafe['attributes']=_[_0xba04('0x32')](_0x2b30e5['model'],qs[_0xba04('0x33')](_0x4eeb2d[_0xba04('0x31')]['fields']));_0x41bafe[_0xba04('0x34')]=_0x41bafe[_0xba04('0x34')]['length']?_0x41bafe[_0xba04('0x34')]:_0x2b30e5[_0xba04('0x2f')];if(!_0x4eeb2d[_0xba04('0x31')][_0xba04('0x35')](_0xba04('0x36'))){_0x41bafe[_0xba04('0x21')]=qs[_0xba04('0x21')](_0x4eeb2d['query'][_0xba04('0x21')]);_0x41bafe[_0xba04('0x1f')]=qs[_0xba04('0x1f')](_0x4eeb2d[_0xba04('0x31')][_0xba04('0x1f')]);}_0x41bafe[_0xba04('0x37')]=qs[_0xba04('0x38')](_0x4eeb2d[_0xba04('0x31')]['sort']);_0x41bafe[_0xba04('0x39')]=qs[_0xba04('0x3a')](_[_0xba04('0x3b')](_0x4eeb2d[_0xba04('0x31')],_0x2b30e5[_0xba04('0x3a')]),_0x4d8e6c);if(_0x4eeb2d['query']['filter']){_0x41bafe[_0xba04('0x39')]=_['merge'](_0x41bafe[_0xba04('0x39')],{'$or':_[_0xba04('0x30')](_0x4d8e6c,function(_0x229337){if(_0x229337['type']!==_0xba04('0x3c')){var _0x2c822a={};_0x2c822a[_0x229337[_0xba04('0x29')]]={'$like':'%'+_0x4eeb2d['query']['filter']+'%'};return _0x2c822a;}})});}_0x41bafe=_[_0xba04('0x3d')]({},_0x41bafe,_0x4eeb2d[_0xba04('0x3e')]);var _0x12f978={'where':_0x41bafe['where']};return db[_0xba04('0x3f')][_0xba04('0x20')](_0x12f978)[_0xba04('0x26')](function(_0xa23964){_0x32408e[_0xba04('0x20')]=_0xa23964;if(_0x4eeb2d[_0xba04('0x31')][_0xba04('0x40')]){_0x41bafe['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0xba04('0x41')](_0x41bafe);})[_0xba04('0x26')](function(_0x46efde){_0x32408e[_0xba04('0x42')]=_0x46efde;return _0x32408e;})[_0xba04('0x26')](respondWithFilteredResult(_0x59b75a,_0x41bafe))[_0xba04('0x43')](handleError(_0x59b75a,null));};exports[_0xba04('0x44')]=function(_0x5df73c,_0x2b1fd0){var _0x4245b0={'raw':![],'where':{'id':_0x5df73c[_0xba04('0x45')]['id']}},_0x1dc904={};_0x1dc904[_0xba04('0x2f')]=_[_0xba04('0x46')](db[_0xba04('0x3f')][_0xba04('0x2b')]);_0x1dc904[_0xba04('0x31')]=_[_0xba04('0x46')](_0x5df73c[_0xba04('0x31')]);_0x1dc904[_0xba04('0x3a')]=_[_0xba04('0x32')](_0x1dc904['model'],_0x1dc904[_0xba04('0x31')]);_0x4245b0[_0xba04('0x34')]=_[_0xba04('0x32')](_0x1dc904[_0xba04('0x2f')],qs['fields'](_0x5df73c['query'][_0xba04('0x33')]));_0x4245b0[_0xba04('0x34')]=_0x4245b0[_0xba04('0x34')][_0xba04('0x47')]?_0x4245b0[_0xba04('0x34')]:_0x1dc904['model'];if(_0x5df73c[_0xba04('0x31')][_0xba04('0x40')]){_0x4245b0[_0xba04('0x48')]=[{'all':!![]}];}_0x4245b0=_['merge']({},_0x4245b0,_0x5df73c[_0xba04('0x3e')]);return db['SalesforceAccount']['find'](_0x4245b0)['then'](handleEntityNotFound(_0x2b1fd0,null))[_0xba04('0x26')](respondWithResult(_0x2b1fd0,null))['catch'](handleError(_0x2b1fd0,null));};exports[_0xba04('0x49')]=function(_0x1e2cbe,_0x3a9e26){return db[_0xba04('0x3f')]['create'](_0x1e2cbe[_0xba04('0x4a')],{})[_0xba04('0x26')](respondWithResult(_0x3a9e26,0xc9))['catch'](handleError(_0x3a9e26,null));};exports[_0xba04('0x25')]=function(_0x3d0d0b,_0x3c53c9){if(_0x3d0d0b['body']['id']){delete _0x3d0d0b[_0xba04('0x4a')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x3d0d0b[_0xba04('0x45')]['id']}})[_0xba04('0x26')](handleEntityNotFound(_0x3c53c9,null))['then'](saveUpdates(_0x3d0d0b['body'],null))[_0xba04('0x26')](respondWithResult(_0x3c53c9,null))[_0xba04('0x43')](handleError(_0x3c53c9,null));};exports[_0xba04('0x27')]=function(_0xc9c3b2,_0x73edff){return db[_0xba04('0x3f')]['find']({'where':{'id':_0xc9c3b2[_0xba04('0x45')]['id']}})[_0xba04('0x26')](handleEntityNotFound(_0x73edff,null))['then'](removeEntity(_0x73edff,null))[_0xba04('0x43')](handleError(_0x73edff,null));};exports['getConfigurations']=function(_0xe0ea72,_0x389c7a,_0x54eb4c){var _0x1effd7={};var _0x3846e7={};var _0x1cbcab;var _0x23fe57;return db[_0xba04('0x3f')][_0xba04('0x4b')]({'where':{'id':_0xe0ea72['params']['id']}})[_0xba04('0x26')](handleEntityNotFound(_0x389c7a,null))[_0xba04('0x26')](function(_0x1c94d8){if(_0x1c94d8){_0x1cbcab=_0x1c94d8;_0x3846e7[_0xba04('0x2f')]=_[_0xba04('0x46')](db[_0xba04('0x4c')]['rawAttributes']);_0x3846e7[_0xba04('0x31')]=_[_0xba04('0x46')](_0xe0ea72[_0xba04('0x31')]);_0x3846e7[_0xba04('0x3a')]=_[_0xba04('0x32')](_0x3846e7['model'],_0x3846e7[_0xba04('0x31')]);_0x1effd7['attributes']=_[_0xba04('0x32')](_0x3846e7['model'],qs[_0xba04('0x33')](_0xe0ea72[_0xba04('0x31')][_0xba04('0x33')]));_0x1effd7[_0xba04('0x34')]=_0x1effd7[_0xba04('0x34')]['length']?_0x1effd7[_0xba04('0x34')]:_0x3846e7[_0xba04('0x2f')];_0x1effd7['order']=qs['sort'](_0xe0ea72['query'][_0xba04('0x38')]);_0x1effd7['where']=qs[_0xba04('0x3a')](_['pick'](_0xe0ea72[_0xba04('0x31')],_0x3846e7[_0xba04('0x3a')]));if(_0xe0ea72[_0xba04('0x31')][_0xba04('0x4d')]){_0x1effd7[_0xba04('0x39')]=_[_0xba04('0x3d')](_0x1effd7[_0xba04('0x39')],{'$or':_[_0xba04('0x30')](_0x1effd7[_0xba04('0x34')],function(_0x431635){var _0x54e9d7={};_0x54e9d7[_0x431635]={'$like':'%'+_0xe0ea72['query'][_0xba04('0x4d')]+'%'};return _0x54e9d7;})});}_0x1effd7=_['merge']({},_0x1effd7,_0xe0ea72['options']);return _0x1cbcab[_0xba04('0x4e')](_0x1effd7);}})[_0xba04('0x26')](function(_0x437706){if(_0x437706){_0x23fe57=_0x437706[_0xba04('0x47')];if(!_0xe0ea72[_0xba04('0x31')][_0xba04('0x35')]('nolimit')){_0x1effd7['limit']=qs[_0xba04('0x21')](_0xe0ea72['query'][_0xba04('0x21')]);_0x1effd7['offset']=qs[_0xba04('0x1f')](_0xe0ea72[_0xba04('0x31')][_0xba04('0x1f')]);}return _0x1cbcab[_0xba04('0x4e')](_0x1effd7);}})[_0xba04('0x26')](function(_0x49901e){if(_0x49901e){return _0x49901e?{'count':_0x23fe57,'rows':_0x49901e}:null;}})[_0xba04('0x26')](respondWithResult(_0x389c7a,null))[_0xba04('0x43')](handleError(_0x389c7a,null));};exports['addConfiguration']=function(_0x3f3eb7,_0x156ddb,_0x321dc8){if(_0x3f3eb7[_0xba04('0x4a')]['id']){delete _0x3f3eb7[_0xba04('0x4a')]['id'];}return db[_0xba04('0x3f')]['findOne']({'where':{'id':_0x3f3eb7[_0xba04('0x45')]['id']}})[_0xba04('0x26')](handleEntityNotFound(_0x156ddb,null))[_0xba04('0x26')](function(_0x3f6f66){if(_0x3f6f66){_0x3f3eb7[_0xba04('0x4a')]['AccountId']=_0x3f6f66['id'];_0x3f3eb7[_0xba04('0x4a')][_0xba04('0x4f')]=integrations[_0xba04('0x50')](_0x3f3eb7[_0xba04('0x4a')]['channel'],_0x3f3eb7[_0xba04('0x4a')][_0xba04('0x2d')]);_0x3f3eb7[_0xba04('0x4a')][_0xba04('0x51')]=integrations[_0xba04('0x52')](_0x3f3eb7[_0xba04('0x4a')][_0xba04('0x53')],_0x3f3eb7[_0xba04('0x4a')][_0xba04('0x2d')]);return db[_0xba04('0x4c')][_0xba04('0x49')](_0x3f3eb7[_0xba04('0x4a')],{'include':[{'model':db[_0xba04('0x54')],'as':_0xba04('0x4f')},{'model':db[_0xba04('0x54')],'as':_0xba04('0x51')}]});}return null;})[_0xba04('0x26')](respondWithResult(_0x156ddb,null))[_0xba04('0x43')](handleError(_0x156ddb,null));};exports[_0xba04('0x55')]=function(_0x542d2f,_0x15b189,_0x47f759){var _0x544291;var _0x3f0c5e='';var _0x4c0b2d=_0xba04('0x56');return db[_0xba04('0x3f')]['findOne']({'where':{'id':_0x542d2f[_0xba04('0x45')]['id']},'attributes':['id',_0xba04('0x57'),_0xba04('0x58'),_0xba04('0x59'),_0xba04('0x5a'),'password','securityToken']})[_0xba04('0x26')](handleEntityNotFound(_0x15b189,null))['then'](function(_0x4e6229){if(_0x4e6229){_0x3f0c5e=_0x4e6229[_0xba04('0x57')];var _0x38d8e5=_0x3f0c5e[_0xba04('0x5b')](-0x1);if(_0x38d8e5==='/'){_0x3f0c5e=_0x3f0c5e[_0xba04('0x5c')](0x0,_0x3f0c5e[_0xba04('0x5d')](_0x38d8e5));}_0x544291=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3f0c5e,'clientId':_0x4e6229[_0xba04('0x58')],'clientSecret':_0x4e6229[_0xba04('0x59')]}});return _0x544291[_0xba04('0x5e')](_0x4e6229[_0xba04('0x5a')],_0x4e6229[_0xba04('0x5f')]['concat'](_0x4e6229[_0xba04('0x60')]));}})[_0xba04('0x26')](function(_0x50a14c){if(_0x50a14c){if(!_[_0xba04('0x61')](_0x542d2f['query'][_0xba04('0x62')])){_0x4c0b2d=_0x542d2f[_0xba04('0x31')][_0xba04('0x62')];}return _0x544291[_0xba04('0x63')](_0x4c0b2d)[_0xba04('0x64')]();}})[_0xba04('0x26')](function(_0x46a101){var _0x4252ce=[_0xba04('0x65'),'ActivityDate',_0xba04('0x66'),'IsRecurrence','Subject',_0xba04('0x67')];var _0x3839e0=['string',_0xba04('0x68'),'picklist','boolean',_0xba04('0x69'),_0xba04('0x6a'),'phone'];if(_0x46a101){_[_0xba04('0x6b')](_0x46a101[_0xba04('0x33')],function(_0x25b92f){return _0x4252ce[_0xba04('0x6c')](_0x25b92f[_0xba04('0x29')])||!_0x3839e0[_0xba04('0x6c')](_0x25b92f['type']);});return{'count':_0x46a101['fields'][_0xba04('0x47')],'rows':_[_0xba04('0x30')](_0x46a101[_0xba04('0x33')],function(_0x5ccdb2){return{'id':_0x5ccdb2[_0xba04('0x29')],'name':_0x5ccdb2['label'],'custom':_0x5ccdb2[_0xba04('0x6d')],'options':_0x5ccdb2['picklistValues'][_0xba04('0x47')]>0x0?_['map'](_0x5ccdb2[_0xba04('0x6e')],function(_0x143bea){return{'name':_0x143bea[_0xba04('0x6f')],'value':_0x143bea[_0xba04('0x70')]};}):_0x5ccdb2[_0xba04('0x2d')]==_0xba04('0x71')?[{'name':'True','value':_0xba04('0x72')},{'name':_0xba04('0x73'),'value':_0xba04('0x74')}]:[]};})};}})[_0xba04('0x26')](respondWithResult(_0x15b189,null))[_0xba04('0x43')](function(_0x396c14){var _0x3c8703=_0x542d2f['query']['test']?0x1f4:_0x396c14[_0xba04('0x75')]||0x1f4;logger[_0xba04('0x28')](_0xba04('0x76'),'getFields',_0x3c8703,JSON['stringify'](_0x396c14));delete _0x396c14[_0xba04('0x29')];if(_0x3c8703===0x191){_0x3c8703=0x190;}_0x15b189[_0xba04('0x1b')](_0x3c8703)[_0xba04('0x2a')](_0x542d2f[_0xba04('0x31')]['test']?{'message':_0xba04('0x77'),'statusCode':_0x396c14['statusCode']}:_0x396c14);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index eef8ab9..9b8dbbd 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 _0x803f=['../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x212f4c,_0x44292e){var _0x47cbe1=function(_0xde8ab7){while(--_0xde8ab7){_0x212f4c['push'](_0x212f4c['shift']());}};_0x47cbe1(++_0x44292e);}(_0x803f,0x64));var _0xf803=function(_0x21b2b7,_0x10b70f){_0x21b2b7=_0x21b2b7-0x0;var _0x5f2f84=_0x803f[_0x21b2b7];return _0x5f2f84;};'use strict';var _=require(_0xf803('0x0'));var util=require('util');var logger=require(_0xf803('0x1'))(_0xf803('0x2'));var moment=require('moment');var BPromise=require(_0xf803('0x3'));var rp=require(_0xf803('0x4'));var fs=require('fs');var path=require(_0xf803('0x5'));var rimraf=require(_0xf803('0x6'));var config=require(_0xf803('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xf803('0x8'));module[_0xf803('0x9')]=function(_0x1d3a79,_0x584b2d){return _0x1d3a79[_0xf803('0xa')](_0xf803('0xb'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d1a=['api','bluebird','rimraf','../../components/integrations/configuration','define','int_salesforce_accounts','lodash','util','../../config/logger'];(function(_0x440d4c,_0x5ea9e1){var _0x21fba9=function(_0x13d8ce){while(--_0x13d8ce){_0x440d4c['push'](_0x440d4c['shift']());}};_0x21fba9(++_0x5ea9e1);}(_0x1d1a,0x1da));var _0xa1d1=function(_0x139601,_0x401cb7){_0x139601=_0x139601-0x0;var _0x32f2b3=_0x1d1a[_0x139601];return _0x32f2b3;};'use strict';var _=require(_0xa1d1('0x0'));var util=require(_0xa1d1('0x1'));var logger=require(_0xa1d1('0x2'))(_0xa1d1('0x3'));var moment=require('moment');var BPromise=require(_0xa1d1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa1d1('0x5'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xa1d1('0x6'));module['exports']=function(_0x28b41b,_0x39b92b){return _0x28b41b[_0xa1d1('0x7')]('SalesforceAccount',attributes,{'tableName':_0xa1d1('0x8'),'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 d8bbc80..83e6b71 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 _0x5a43=['randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','limit','include','model','map','attributes','debug','stringify','ShowSalesforceAccount','find','lodash','util','moment','bluebird'];(function(_0x4db8a8,_0x879b1e){var _0x247ae1=function(_0x4d43bb){while(--_0x4d43bb){_0x4db8a8['push'](_0x4db8a8['shift']());}};_0x247ae1(++_0x879b1e);}(_0x5a43,0xf1));var _0x35a4=function(_0x1a0ea8,_0x2b0d25){_0x1a0ea8=_0x1a0ea8-0x0;var _0x343be1=_0x5a43[_0x1a0ea8];return _0x343be1;};'use strict';var _=require(_0x35a4('0x0'));var util=require(_0x35a4('0x1'));var moment=require(_0x35a4('0x2'));var BPromise=require(_0x35a4('0x3'));var rs=require(_0x35a4('0x4'));var fs=require('fs');var Redis=require(_0x35a4('0x5'));var db=require(_0x35a4('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x35a4('0x7'));var client=jayson[_0x35a4('0x8')][_0x35a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b2bf2,_0x384a3e,_0xa4665e){return new BPromise(function(_0x4cc7a3,_0x38e68f){return client[_0x35a4('0xa')](_0x1b2bf2,_0xa4665e)[_0x35a4('0xb')](function(_0x3e23d6){logger[_0x35a4('0xc')](_0x35a4('0xd'),_0x384a3e,'request\x20sent');logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x384a3e,_0x35a4('0xe'),JSON['stringify'](_0x3e23d6));if(_0x3e23d6[_0x35a4('0xf')]){if(_0x3e23d6[_0x35a4('0xf')][_0x35a4('0x10')]===0x1f4){logger['error'](_0x35a4('0xd'),_0x384a3e,_0x3e23d6[_0x35a4('0xf')][_0x35a4('0x11')]);return _0x38e68f(_0x3e23d6[_0x35a4('0xf')]['message']);}logger[_0x35a4('0xf')](_0x35a4('0xd'),_0x384a3e,_0x3e23d6['error'][_0x35a4('0x11')]);return _0x4cc7a3(_0x3e23d6['error'][_0x35a4('0x11')]);}else{logger[_0x35a4('0xc')](_0x35a4('0xd'),_0x384a3e,_0x35a4('0xe'));_0x4cc7a3(_0x3e23d6[_0x35a4('0x12')][_0x35a4('0x11')]);}})[_0x35a4('0x13')](function(_0x26a97e){logger[_0x35a4('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x384a3e,_0x26a97e);_0x38e68f(_0x26a97e);});});}exports[_0x35a4('0x14')]=function(_0x41b56c){var _0x199ef3=this;return new Promise(function(_0x61f568,_0x46cc80){return db[_0x35a4('0x15')][_0x35a4('0x16')]({'raw':_0x41b56c[_0x35a4('0x17')]?_0x41b56c['options'][_0x35a4('0x18')]===undefined?!![]:![]:!![],'where':_0x41b56c['options']?_0x41b56c['options'][_0x35a4('0x19')]||null:null,'attributes':_0x41b56c[_0x35a4('0x17')]?_0x41b56c[_0x35a4('0x17')]['attributes']||null:null,'limit':_0x41b56c[_0x35a4('0x17')]?_0x41b56c[_0x35a4('0x17')][_0x35a4('0x1a')]||null:null,'include':_0x41b56c['options']?_0x41b56c[_0x35a4('0x17')][_0x35a4('0x1b')]?_['map'](_0x41b56c[_0x35a4('0x17')][_0x35a4('0x1b')],function(_0x34fc8d){return{'model':db[_0x34fc8d[_0x35a4('0x1c')]],'as':_0x34fc8d['as'],'attributes':_0x34fc8d['attributes'],'include':_0x34fc8d['include']?_[_0x35a4('0x1d')](_0x34fc8d['include'],function(_0x469728){return{'model':db[_0x469728[_0x35a4('0x1c')]],'as':_0x469728['as'],'attributes':_0x469728[_0x35a4('0x1e')],'include':_0x469728[_0x35a4('0x1b')]?_[_0x35a4('0x1d')](_0x469728[_0x35a4('0x1b')],function(_0x503719){return{'model':db[_0x503719['model']],'as':_0x503719['as'],'attributes':_0x503719['attributes']};}):[]};}):[]};}):[]:[]})[_0x35a4('0xb')](function(_0x69b73e){logger['info']('GetSalesforceAccount',_0x41b56c);logger[_0x35a4('0x1f')](_0x35a4('0x14'),_0x41b56c,JSON[_0x35a4('0x20')](_0x69b73e));_0x61f568(_0x69b73e);})[_0x35a4('0x13')](function(_0x5d3313){logger['error']('GetSalesforceAccount',_0x5d3313['message'],_0x41b56c);_0x46cc80(_0x199ef3[_0x35a4('0xf')](0x1f4,_0x5d3313[_0x35a4('0x11')]));});});};exports[_0x35a4('0x21')]=function(_0x1da508){var _0x2e1985=this;return new Promise(function(_0x160bb5,_0x2e6d5d){return db[_0x35a4('0x15')][_0x35a4('0x22')]({'raw':_0x1da508[_0x35a4('0x17')]?_0x1da508[_0x35a4('0x17')][_0x35a4('0x18')]===undefined?!![]:![]:!![],'where':_0x1da508[_0x35a4('0x17')]?_0x1da508[_0x35a4('0x17')][_0x35a4('0x19')]||null:null,'attributes':_0x1da508[_0x35a4('0x17')]?_0x1da508['options'][_0x35a4('0x1e')]||null:null,'include':_0x1da508[_0x35a4('0x17')]?_0x1da508[_0x35a4('0x17')]['include']?_[_0x35a4('0x1d')](_0x1da508[_0x35a4('0x17')][_0x35a4('0x1b')],function(_0x48245c){return{'model':db[_0x48245c['model']],'as':_0x48245c['as'],'attributes':_0x48245c[_0x35a4('0x1e')],'include':_0x48245c['include']?_[_0x35a4('0x1d')](_0x48245c[_0x35a4('0x1b')],function(_0x274237){return{'model':db[_0x274237['model']],'as':_0x274237['as'],'attributes':_0x274237['attributes'],'include':_0x274237[_0x35a4('0x1b')]?_[_0x35a4('0x1d')](_0x274237[_0x35a4('0x1b')],function(_0x55510a){return{'model':db[_0x55510a[_0x35a4('0x1c')]],'as':_0x55510a['as'],'attributes':_0x55510a[_0x35a4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x35a4('0xb')](function(_0x368330){logger['info']('ShowSalesforceAccount',_0x1da508);logger[_0x35a4('0x1f')](_0x35a4('0x21'),_0x1da508,JSON[_0x35a4('0x20')](_0x368330));_0x160bb5(_0x368330);})[_0x35a4('0x13')](function(_0xba030a){logger['error'](_0x35a4('0x21'),_0xba030a['message'],_0x1da508);_0x2e6d5d(_0x2e1985[_0x35a4('0xf')](0x1f4,_0xba030a['message']));});});}; \ No newline at end of file +var _0x7b72=['../../config/utils','../../config/logger','../../config/environment','http','request','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','findAll','options','where','attributes','limit','include','model','map','info','find','then','ShowSalesforceAccount','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1d1d77,_0xbf807){var _0x463a5f=function(_0x2452ce){while(--_0x2452ce){_0x1d1d77['push'](_0x1d1d77['shift']());}};_0x463a5f(++_0xbf807);}(_0x7b72,0x1ea));var _0x27b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b72[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x27b7('0x0'));var BPromise=require(_0x27b7('0x1'));var rs=require(_0x27b7('0x2'));var fs=require('fs');var Redis=require(_0x27b7('0x3'));var db=require(_0x27b7('0x4'))['db'];var utils=require(_0x27b7('0x5'));var logger=require(_0x27b7('0x6'))('rpc');var config=require(_0x27b7('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x27b7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d6d59,_0x34e503,_0x441deb){return new BPromise(function(_0x5af4f1,_0x57b833){return client[_0x27b7('0x9')](_0x3d6d59,_0x441deb)['then'](function(_0x3dc9c8){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x34e503,_0x27b7('0xa'));logger[_0x27b7('0xb')](_0x27b7('0xc'),_0x34e503,_0x27b7('0xa'),JSON[_0x27b7('0xd')](_0x3dc9c8));if(_0x3dc9c8[_0x27b7('0xe')]){if(_0x3dc9c8[_0x27b7('0xe')][_0x27b7('0xf')]===0x1f4){logger[_0x27b7('0xe')](_0x27b7('0x10'),_0x34e503,_0x3dc9c8[_0x27b7('0xe')]['message']);return _0x57b833(_0x3dc9c8[_0x27b7('0xe')]['message']);}logger[_0x27b7('0xe')](_0x27b7('0x10'),_0x34e503,_0x3dc9c8[_0x27b7('0xe')][_0x27b7('0x11')]);return _0x5af4f1(_0x3dc9c8['error'][_0x27b7('0x11')]);}else{logger['info'](_0x27b7('0x10'),_0x34e503,'request\x20sent');_0x5af4f1(_0x3dc9c8[_0x27b7('0x12')][_0x27b7('0x11')]);}})[_0x27b7('0x13')](function(_0x2085ac){logger[_0x27b7('0xe')](_0x27b7('0x10'),_0x34e503,_0x2085ac);_0x57b833(_0x2085ac);});});}exports[_0x27b7('0x14')]=function(_0x8ba19b){var _0x39af49=this;return new Promise(function(_0x362bf6,_0x3b83d7){return db['SalesforceAccount'][_0x27b7('0x15')]({'raw':_0x8ba19b[_0x27b7('0x16')]?_0x8ba19b[_0x27b7('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x8ba19b[_0x27b7('0x16')]?_0x8ba19b[_0x27b7('0x16')][_0x27b7('0x17')]||null:null,'attributes':_0x8ba19b[_0x27b7('0x16')]?_0x8ba19b['options'][_0x27b7('0x18')]||null:null,'limit':_0x8ba19b[_0x27b7('0x16')]?_0x8ba19b[_0x27b7('0x16')][_0x27b7('0x19')]||null:null,'include':_0x8ba19b[_0x27b7('0x16')]?_0x8ba19b[_0x27b7('0x16')][_0x27b7('0x1a')]?_['map'](_0x8ba19b[_0x27b7('0x16')]['include'],function(_0x114241){return{'model':db[_0x114241[_0x27b7('0x1b')]],'as':_0x114241['as'],'attributes':_0x114241[_0x27b7('0x18')],'include':_0x114241[_0x27b7('0x1a')]?_[_0x27b7('0x1c')](_0x114241[_0x27b7('0x1a')],function(_0x1ab99d){return{'model':db[_0x1ab99d[_0x27b7('0x1b')]],'as':_0x1ab99d['as'],'attributes':_0x1ab99d[_0x27b7('0x18')],'include':_0x1ab99d[_0x27b7('0x1a')]?_[_0x27b7('0x1c')](_0x1ab99d[_0x27b7('0x1a')],function(_0x524f7f){return{'model':db[_0x524f7f[_0x27b7('0x1b')]],'as':_0x524f7f['as'],'attributes':_0x524f7f[_0x27b7('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c2011){logger[_0x27b7('0x1d')](_0x27b7('0x14'),_0x8ba19b);logger['debug']('GetSalesforceAccount',_0x8ba19b,JSON['stringify'](_0x4c2011));_0x362bf6(_0x4c2011);})[_0x27b7('0x13')](function(_0x5d2120){logger[_0x27b7('0xe')](_0x27b7('0x14'),_0x5d2120[_0x27b7('0x11')],_0x8ba19b);_0x3b83d7(_0x39af49[_0x27b7('0xe')](0x1f4,_0x5d2120[_0x27b7('0x11')]));});});};exports['ShowSalesforceAccount']=function(_0xdb3fa7){var _0x10915d=this;return new Promise(function(_0x30d8cd,_0x50edcb){return db['SalesforceAccount'][_0x27b7('0x1e')]({'raw':_0xdb3fa7['options']?_0xdb3fa7[_0x27b7('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xdb3fa7[_0x27b7('0x16')]?_0xdb3fa7[_0x27b7('0x16')]['where']||null:null,'attributes':_0xdb3fa7['options']?_0xdb3fa7[_0x27b7('0x16')][_0x27b7('0x18')]||null:null,'include':_0xdb3fa7['options']?_0xdb3fa7[_0x27b7('0x16')][_0x27b7('0x1a')]?_[_0x27b7('0x1c')](_0xdb3fa7[_0x27b7('0x16')]['include'],function(_0x315f93){return{'model':db[_0x315f93['model']],'as':_0x315f93['as'],'attributes':_0x315f93[_0x27b7('0x18')],'include':_0x315f93[_0x27b7('0x1a')]?_['map'](_0x315f93[_0x27b7('0x1a')],function(_0x5852b3){return{'model':db[_0x5852b3[_0x27b7('0x1b')]],'as':_0x5852b3['as'],'attributes':_0x5852b3[_0x27b7('0x18')],'include':_0x5852b3['include']?_[_0x27b7('0x1c')](_0x5852b3['include'],function(_0x28e35c){return{'model':db[_0x28e35c['model']],'as':_0x28e35c['as'],'attributes':_0x28e35c[_0x27b7('0x18')]};}):[]};}):[]};}):[]:[]})[_0x27b7('0x1f')](function(_0x353592){logger['info'](_0x27b7('0x20'),_0xdb3fa7);logger[_0x27b7('0xb')](_0x27b7('0x20'),_0xdb3fa7,JSON[_0x27b7('0xd')](_0x353592));_0x30d8cd(_0x353592);})[_0x27b7('0x13')](function(_0x26b181){logger[_0x27b7('0xe')](_0x27b7('0x20'),_0x26b181[_0x27b7('0x11')],_0xdb3fa7);_0x50edcb(_0x10915d[_0x27b7('0xe')](0x1f4,_0x26b181[_0x27b7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 9465167..728397f 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 _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x215dc8,_0x52c245){_0x215dc8=_0x215dc8-0x0;var _0x583ea3=_0x0b0e[_0x215dc8];return _0x583ea3;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x3609ef,_0xb951ab){var _0x370d91=function(_0x3039c6){while(--_0x3039c6){_0x3609ef['push'](_0x3609ef['shift']());}};_0x370d91(++_0xb951ab);}(_0x2ef3,0xba));var _0x32ef=function(_0x5f1d4d,_0x55dfd6){_0x5f1d4d=_0x5f1d4d-0x0;var _0x4c55ef=_0x2ef3[_0x5f1d4d];return _0x4c55ef;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 334fde9..a881c23 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 _0x6ca1=['sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account','nothing'];(function(_0x1a6ae1,_0x5643a1){var _0x2ed02f=function(_0x4f9b5f){while(--_0x4f9b5f){_0x1a6ae1['push'](_0x1a6ae1['shift']());}};_0x2ed02f(++_0x5643a1);}(_0x6ca1,0x108));var _0x16ca=function(_0x432feb,_0x430eb9){_0x432feb=_0x432feb-0x0;var _0x3ef64b=_0x6ca1[_0x432feb];return _0x3ef64b;};'use strict';var Sequelize=require(_0x16ca('0x0'));module[_0x16ca('0x1')]={'name':{'type':Sequelize[_0x16ca('0x2')]},'description':{'type':Sequelize[_0x16ca('0x2')]},'ticketType':{'type':Sequelize[_0x16ca('0x3')](_0x16ca('0x4'),_0x16ca('0x5')),'defaultValue':_0x16ca('0x4')},'moduleSearch':{'type':Sequelize[_0x16ca('0x3')](_0x16ca('0x6'),_0x16ca('0x7'),_0x16ca('0x8'),_0x16ca('0x9'),_0x16ca('0xa')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0x16ca('0xb'),'contact',_0x16ca('0x8'),_0x16ca('0xa')),'defaultValue':_0x16ca('0x8')},'leadId':{'type':Sequelize[_0x16ca('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x16ca('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x16ca('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x16ca('0x2')]}}; \ No newline at end of file +var _0x2934=['Case','contact_lead','lead','account_contact_lead','nothing','account','sequelize','exports','STRING','ENUM','Task'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x2934,0x74));var _0x4293=function(_0x515189,_0x4512f9){_0x515189=_0x515189-0x0;var _0x323b51=_0x2934[_0x515189];return _0x323b51;};'use strict';var Sequelize=require(_0x4293('0x0'));module[_0x4293('0x1')]={'name':{'type':Sequelize[_0x4293('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x4293('0x3')](_0x4293('0x4'),_0x4293('0x5')),'defaultValue':_0x4293('0x4')},'moduleSearch':{'type':Sequelize[_0x4293('0x3')](_0x4293('0x6'),'contact',_0x4293('0x7'),_0x4293('0x8'),'account'),'defaultValue':_0x4293('0x6')},'moduleCreate':{'type':Sequelize[_0x4293('0x3')](_0x4293('0x9'),'contact',_0x4293('0x7'),_0x4293('0xa')),'defaultValue':_0x4293('0x7')},'leadId':{'type':Sequelize[_0x4293('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x4293('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x4293('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 180fcc3..7f85a2d 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 _0x3fec=['include','findAll','params','options','find','create','body','catch','getFields','findOne','hasOwnProperty','getSubjects','SalesforceField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','includeAll'];(function(_0x3dc8e2,_0x447e46){var _0x421970=function(_0x443e5b){while(--_0x443e5b){_0x3dc8e2['push'](_0x3dc8e2['shift']());}};_0x421970(++_0x447e46);}(_0x3fec,0x14d));var _0xc3fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fec[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xc3fe('0x0'));var rimraf=require(_0xc3fe('0x1'));var zipdir=require(_0xc3fe('0x2'));var jsonpatch=require(_0xc3fe('0x3'));var rp=require(_0xc3fe('0x4'));var moment=require(_0xc3fe('0x5'));var BPromise=require(_0xc3fe('0x6'));var Mustache=require('mustache');var util=require(_0xc3fe('0x7'));var path=require('path');var sox=require(_0xc3fe('0x8'));var csv=require(_0xc3fe('0x9'));var ejs=require(_0xc3fe('0xa'));var fs=require('fs');var fs_extra=require(_0xc3fe('0xb'));var _=require(_0xc3fe('0xc'));var squel=require(_0xc3fe('0xd'));var crypto=require(_0xc3fe('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc3fe('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc3fe('0x10'));var Papa=require(_0xc3fe('0x11'));var Redis=require('ioredis');var authService=require(_0xc3fe('0x12'));var qs=require(_0xc3fe('0x13'));var as=require(_0xc3fe('0x14'));var hardwareService=require(_0xc3fe('0x15'));var logger=require(_0xc3fe('0x16'))(_0xc3fe('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc3fe('0x18'))['db'];function respondWithStatusCode(_0x4d7696,_0x42eae8){_0x42eae8=_0x42eae8||0xcc;return function(_0xf25c6){if(_0xf25c6){return _0x4d7696[_0xc3fe('0x19')](_0x42eae8);}return _0x4d7696['status'](_0x42eae8)['end']();};}function respondWithResult(_0x27d1b1,_0x486393){_0x486393=_0x486393||0xc8;return function(_0x474812){if(_0x474812){return _0x27d1b1[_0xc3fe('0x1a')](_0x486393)[_0xc3fe('0x1b')](_0x474812);}};}function respondWithFilteredResult(_0x31bf3f,_0x947985){return function(_0x52c881){if(_0x52c881){var _0x34d6bb=typeof _0x947985[_0xc3fe('0x1c')]===_0xc3fe('0x1d')&&typeof _0x947985[_0xc3fe('0x1e')]===_0xc3fe('0x1d');var _0x548a14=_0x52c881[_0xc3fe('0x1f')];var _0x270f6d=_0x34d6bb?0x0:_0x947985['offset'];var _0x5a5f9a=_0x34d6bb?_0x52c881[_0xc3fe('0x1f')]:_0x947985['offset']+_0x947985['limit'];var _0x123065;if(_0x5a5f9a>=_0x548a14){_0x5a5f9a=_0x548a14;_0x123065=0xc8;}else{_0x123065=0xce;}_0x31bf3f[_0xc3fe('0x1a')](_0x123065);return _0x31bf3f[_0xc3fe('0x20')](_0xc3fe('0x21'),_0x270f6d+'-'+_0x5a5f9a+'/'+_0x548a14)[_0xc3fe('0x1b')](_0x52c881);}return null;};}function patchUpdates(_0x56a27b){return function(_0x30bca7){try{jsonpatch[_0xc3fe('0x22')](_0x30bca7,_0x56a27b,!![]);}catch(_0x10c478){return BPromise[_0xc3fe('0x23')](_0x10c478);}return _0x30bca7[_0xc3fe('0x24')]();};}function saveUpdates(_0x409873,_0x5fb20c){return function(_0x4144a7){if(_0x4144a7){return _0x4144a7[_0xc3fe('0x25')](_0x409873)[_0xc3fe('0x26')](function(_0x5683cb){return _0x5683cb;});}return null;};}function removeEntity(_0xb10c0b,_0x3d3f02){return function(_0x13ede2){if(_0x13ede2){return _0x13ede2['destroy']()['then'](function(){_0xb10c0b['status'](0xcc)[_0xc3fe('0x27')]();});}};}function handleEntityNotFound(_0x38ac0f,_0x2cce08){return function(_0x5b8b94){if(!_0x5b8b94){_0x38ac0f[_0xc3fe('0x19')](0x194);}return _0x5b8b94;};}function handleError(_0x408461,_0x3012a0){_0x3012a0=_0x3012a0||0x1f4;return function(_0xcdb6a9){logger[_0xc3fe('0x28')](_0xcdb6a9[_0xc3fe('0x29')]);if(_0xcdb6a9[_0xc3fe('0x2a')]){delete _0xcdb6a9[_0xc3fe('0x2a')];}_0x408461[_0xc3fe('0x1a')](_0x3012a0)[_0xc3fe('0x2b')](_0xcdb6a9);};}exports['index']=function(_0x18ddd2,_0x493b85){var _0x359c36={},_0x122633={},_0x1b5168={'count':0x0,'rows':[]};var _0x1eb592=_[_0xc3fe('0x2c')](db[_0xc3fe('0x2d')][_0xc3fe('0x2e')],function(_0x823cc7){return{'name':_0x823cc7[_0xc3fe('0x2f')],'type':_0x823cc7[_0xc3fe('0x30')][_0xc3fe('0x31')]};});_0x122633[_0xc3fe('0x32')]=_[_0xc3fe('0x2c')](_0x1eb592,_0xc3fe('0x2a'));_0x122633[_0xc3fe('0x33')]=_[_0xc3fe('0x34')](_0x18ddd2[_0xc3fe('0x33')]);_0x122633[_0xc3fe('0x35')]=_[_0xc3fe('0x36')](_0x122633[_0xc3fe('0x32')],_0x122633[_0xc3fe('0x33')]);_0x359c36['attributes']=_['intersection'](_0x122633['model'],qs['fields'](_0x18ddd2[_0xc3fe('0x33')][_0xc3fe('0x37')]));_0x359c36[_0xc3fe('0x38')]=_0x359c36['attributes'][_0xc3fe('0x39')]?_0x359c36[_0xc3fe('0x38')]:_0x122633[_0xc3fe('0x32')];if(!_0x18ddd2[_0xc3fe('0x33')]['hasOwnProperty'](_0xc3fe('0x3a'))){_0x359c36[_0xc3fe('0x1e')]=qs[_0xc3fe('0x1e')](_0x18ddd2[_0xc3fe('0x33')][_0xc3fe('0x1e')]);_0x359c36[_0xc3fe('0x1c')]=qs['offset'](_0x18ddd2[_0xc3fe('0x33')][_0xc3fe('0x1c')]);}_0x359c36[_0xc3fe('0x3b')]=qs[_0xc3fe('0x3c')](_0x18ddd2[_0xc3fe('0x33')][_0xc3fe('0x3c')]);_0x359c36['where']=qs[_0xc3fe('0x35')](_[_0xc3fe('0x3d')](_0x18ddd2['query'],_0x122633[_0xc3fe('0x35')]),_0x1eb592);if(_0x18ddd2[_0xc3fe('0x33')]['filter']){_0x359c36['where']=_[_0xc3fe('0x3e')](_0x359c36[_0xc3fe('0x3f')],{'$or':_[_0xc3fe('0x2c')](_0x1eb592,function(_0x5cb6b9){if(_0x5cb6b9[_0xc3fe('0x30')]!==_0xc3fe('0x40')){var _0x5157f9={};_0x5157f9[_0x5cb6b9['name']]={'$like':'%'+_0x18ddd2['query'][_0xc3fe('0x41')]+'%'};return _0x5157f9;}})});}_0x359c36=_[_0xc3fe('0x3e')]({},_0x359c36,_0x18ddd2['options']);var _0xec6df8={'where':_0x359c36[_0xc3fe('0x3f')]};return db[_0xc3fe('0x2d')][_0xc3fe('0x1f')](_0xec6df8)[_0xc3fe('0x26')](function(_0x1a1479){_0x1b5168[_0xc3fe('0x1f')]=_0x1a1479;if(_0x18ddd2[_0xc3fe('0x33')][_0xc3fe('0x42')]){_0x359c36[_0xc3fe('0x43')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xc3fe('0x44')](_0x359c36);})['then'](function(_0x5431f1){_0x1b5168['rows']=_0x5431f1;return _0x1b5168;})[_0xc3fe('0x26')](respondWithFilteredResult(_0x493b85,_0x359c36))['catch'](handleError(_0x493b85,null));};exports['show']=function(_0x18535d,_0xf3621c){var _0xf1df50={'raw':![],'where':{'id':_0x18535d[_0xc3fe('0x45')]['id']}},_0x506d43={};_0x506d43[_0xc3fe('0x32')]=_[_0xc3fe('0x34')](db[_0xc3fe('0x2d')][_0xc3fe('0x2e')]);_0x506d43[_0xc3fe('0x33')]=_[_0xc3fe('0x34')](_0x18535d[_0xc3fe('0x33')]);_0x506d43[_0xc3fe('0x35')]=_[_0xc3fe('0x36')](_0x506d43[_0xc3fe('0x32')],_0x506d43[_0xc3fe('0x33')]);_0xf1df50['attributes']=_[_0xc3fe('0x36')](_0x506d43[_0xc3fe('0x32')],qs[_0xc3fe('0x37')](_0x18535d[_0xc3fe('0x33')][_0xc3fe('0x37')]));_0xf1df50[_0xc3fe('0x38')]=_0xf1df50[_0xc3fe('0x38')][_0xc3fe('0x39')]?_0xf1df50[_0xc3fe('0x38')]:_0x506d43['model'];if(_0x18535d['query']['includeAll']){_0xf1df50['include']=[{'all':!![]}];}_0xf1df50=_[_0xc3fe('0x3e')]({},_0xf1df50,_0x18535d[_0xc3fe('0x46')]);return db['SalesforceConfiguration'][_0xc3fe('0x47')](_0xf1df50)[_0xc3fe('0x26')](handleEntityNotFound(_0xf3621c,null))[_0xc3fe('0x26')](respondWithResult(_0xf3621c,null))['catch'](handleError(_0xf3621c,null));};exports[_0xc3fe('0x48')]=function(_0x158e7d,_0x46d9ac){return db[_0xc3fe('0x2d')]['create'](_0x158e7d[_0xc3fe('0x49')],{})['then'](respondWithResult(_0x46d9ac,0xc9))[_0xc3fe('0x4a')](handleError(_0x46d9ac,null));};exports[_0xc3fe('0x25')]=function(_0x38f670,_0x3b75d9){if(_0x38f670[_0xc3fe('0x49')]['id']){delete _0x38f670['body']['id'];}return db[_0xc3fe('0x2d')][_0xc3fe('0x47')]({'where':{'id':_0x38f670[_0xc3fe('0x45')]['id']}})[_0xc3fe('0x26')](handleEntityNotFound(_0x3b75d9,null))[_0xc3fe('0x26')](saveUpdates(_0x38f670['body'],null))[_0xc3fe('0x26')](respondWithResult(_0x3b75d9,null))[_0xc3fe('0x4a')](handleError(_0x3b75d9,null));};exports['destroy']=function(_0x3e6826,_0x479777){return db[_0xc3fe('0x2d')][_0xc3fe('0x47')]({'where':{'id':_0x3e6826[_0xc3fe('0x45')]['id']}})[_0xc3fe('0x26')](handleEntityNotFound(_0x479777,null))['then'](removeEntity(_0x479777,null))[_0xc3fe('0x4a')](handleError(_0x479777,null));};exports[_0xc3fe('0x4b')]=function(_0x527798,_0x4e7002,_0x41fc94){var _0xf9028d={};var _0xd4c0cd={};var _0x1937f8;var _0x3df525;return db[_0xc3fe('0x2d')][_0xc3fe('0x4c')]({'where':{'id':_0x527798[_0xc3fe('0x45')]['id']}})[_0xc3fe('0x26')](handleEntityNotFound(_0x4e7002,null))['then'](function(_0x3bfa13){if(_0x3bfa13){_0x1937f8=_0x3bfa13;_0xd4c0cd[_0xc3fe('0x32')]=_[_0xc3fe('0x34')](db['SalesforceField'][_0xc3fe('0x2e')]);_0xd4c0cd[_0xc3fe('0x33')]=_['keys'](_0x527798['query']);_0xd4c0cd[_0xc3fe('0x35')]=_[_0xc3fe('0x36')](_0xd4c0cd[_0xc3fe('0x32')],_0xd4c0cd[_0xc3fe('0x33')]);_0xf9028d[_0xc3fe('0x38')]=_[_0xc3fe('0x36')](_0xd4c0cd['model'],qs[_0xc3fe('0x37')](_0x527798[_0xc3fe('0x33')][_0xc3fe('0x37')]));_0xf9028d[_0xc3fe('0x38')]=_0xf9028d[_0xc3fe('0x38')][_0xc3fe('0x39')]?_0xf9028d[_0xc3fe('0x38')]:_0xd4c0cd[_0xc3fe('0x32')];_0xf9028d[_0xc3fe('0x3b')]=qs[_0xc3fe('0x3c')](_0x527798['query'][_0xc3fe('0x3c')]);_0xf9028d[_0xc3fe('0x3f')]=qs['filters'](_['pick'](_0x527798[_0xc3fe('0x33')],_0xd4c0cd[_0xc3fe('0x35')]));if(_0x527798['query']['filter']){_0xf9028d[_0xc3fe('0x3f')]=_[_0xc3fe('0x3e')](_0xf9028d[_0xc3fe('0x3f')],{'$or':_[_0xc3fe('0x2c')](_0xf9028d[_0xc3fe('0x38')],function(_0x58be6e){var _0x480706={};_0x480706[_0x58be6e]={'$like':'%'+_0x527798[_0xc3fe('0x33')][_0xc3fe('0x41')]+'%'};return _0x480706;})});}_0xf9028d=_[_0xc3fe('0x3e')]({},_0xf9028d,_0x527798['options']);return _0x1937f8[_0xc3fe('0x4b')](_0xf9028d);}})[_0xc3fe('0x26')](function(_0x57423e){if(_0x57423e){_0x3df525=_0x57423e[_0xc3fe('0x39')];if(!_0x527798[_0xc3fe('0x33')][_0xc3fe('0x4d')](_0xc3fe('0x3a'))){_0xf9028d[_0xc3fe('0x1e')]=qs[_0xc3fe('0x1e')](_0x527798[_0xc3fe('0x33')][_0xc3fe('0x1e')]);_0xf9028d[_0xc3fe('0x1c')]=qs[_0xc3fe('0x1c')](_0x527798[_0xc3fe('0x33')][_0xc3fe('0x1c')]);}return _0x1937f8[_0xc3fe('0x4b')](_0xf9028d);}})[_0xc3fe('0x26')](function(_0x4f0606){if(_0x4f0606){return _0x4f0606?{'count':_0x3df525,'rows':_0x4f0606}:null;}})[_0xc3fe('0x26')](respondWithResult(_0x4e7002,null))[_0xc3fe('0x4a')](handleError(_0x4e7002,null));};exports[_0xc3fe('0x4e')]=function(_0xeb4f1d,_0x265acf,_0x52f68e){var _0x256811={};var _0x54ce9c={};var _0x2c2a24;var _0x8b0ef5;return db[_0xc3fe('0x2d')][_0xc3fe('0x4c')]({'where':{'id':_0xeb4f1d['params']['id']}})[_0xc3fe('0x26')](handleEntityNotFound(_0x265acf,null))[_0xc3fe('0x26')](function(_0x1c8feb){if(_0x1c8feb){_0x2c2a24=_0x1c8feb;_0x54ce9c[_0xc3fe('0x32')]=_[_0xc3fe('0x34')](db[_0xc3fe('0x4f')][_0xc3fe('0x2e')]);_0x54ce9c['query']=_['keys'](_0xeb4f1d[_0xc3fe('0x33')]);_0x54ce9c[_0xc3fe('0x35')]=_[_0xc3fe('0x36')](_0x54ce9c[_0xc3fe('0x32')],_0x54ce9c[_0xc3fe('0x33')]);_0x256811[_0xc3fe('0x38')]=_['intersection'](_0x54ce9c[_0xc3fe('0x32')],qs[_0xc3fe('0x37')](_0xeb4f1d[_0xc3fe('0x33')][_0xc3fe('0x37')]));_0x256811[_0xc3fe('0x38')]=_0x256811[_0xc3fe('0x38')]['length']?_0x256811[_0xc3fe('0x38')]:_0x54ce9c[_0xc3fe('0x32')];_0x256811['order']=qs[_0xc3fe('0x3c')](_0xeb4f1d[_0xc3fe('0x33')]['sort']);_0x256811[_0xc3fe('0x3f')]=qs[_0xc3fe('0x35')](_['pick'](_0xeb4f1d[_0xc3fe('0x33')],_0x54ce9c[_0xc3fe('0x35')]));if(_0xeb4f1d[_0xc3fe('0x33')]['filter']){_0x256811[_0xc3fe('0x3f')]=_[_0xc3fe('0x3e')](_0x256811[_0xc3fe('0x3f')],{'$or':_[_0xc3fe('0x2c')](_0x256811[_0xc3fe('0x38')],function(_0x4baade){var _0x262797={};_0x262797[_0x4baade]={'$like':'%'+_0xeb4f1d['query']['filter']+'%'};return _0x262797;})});}_0x256811=_[_0xc3fe('0x3e')]({},_0x256811,_0xeb4f1d[_0xc3fe('0x46')]);return _0x2c2a24[_0xc3fe('0x4e')](_0x256811);}})[_0xc3fe('0x26')](function(_0x3e7518){if(_0x3e7518){_0x8b0ef5=_0x3e7518[_0xc3fe('0x39')];if(!_0xeb4f1d['query'][_0xc3fe('0x4d')]('nolimit')){_0x256811[_0xc3fe('0x1e')]=qs[_0xc3fe('0x1e')](_0xeb4f1d[_0xc3fe('0x33')]['limit']);_0x256811[_0xc3fe('0x1c')]=qs[_0xc3fe('0x1c')](_0xeb4f1d['query'][_0xc3fe('0x1c')]);}return _0x2c2a24['getSubjects'](_0x256811);}})['then'](function(_0xe0a9c3){if(_0xe0a9c3){return _0xe0a9c3?{'count':_0x8b0ef5,'rows':_0xe0a9c3}:null;}})[_0xc3fe('0x26')](respondWithResult(_0x265acf,null))[_0xc3fe('0x4a')](handleError(_0x265acf,null));};exports['getDescriptions']=function(_0x1b1160,_0x5ae76c,_0x43471d){var _0x4c9871={};var _0xd09a88={};var _0x295be9;var _0x33df34;return db['SalesforceConfiguration'][_0xc3fe('0x4c')]({'where':{'id':_0x1b1160[_0xc3fe('0x45')]['id']}})[_0xc3fe('0x26')](handleEntityNotFound(_0x5ae76c,null))[_0xc3fe('0x26')](function(_0x295350){if(_0x295350){_0x295be9=_0x295350;_0xd09a88[_0xc3fe('0x32')]=_[_0xc3fe('0x34')](db['SalesforceField']['rawAttributes']);_0xd09a88['query']=_[_0xc3fe('0x34')](_0x1b1160[_0xc3fe('0x33')]);_0xd09a88[_0xc3fe('0x35')]=_[_0xc3fe('0x36')](_0xd09a88[_0xc3fe('0x32')],_0xd09a88['query']);_0x4c9871[_0xc3fe('0x38')]=_[_0xc3fe('0x36')](_0xd09a88[_0xc3fe('0x32')],qs[_0xc3fe('0x37')](_0x1b1160[_0xc3fe('0x33')][_0xc3fe('0x37')]));_0x4c9871[_0xc3fe('0x38')]=_0x4c9871[_0xc3fe('0x38')][_0xc3fe('0x39')]?_0x4c9871[_0xc3fe('0x38')]:_0xd09a88[_0xc3fe('0x32')];_0x4c9871[_0xc3fe('0x3b')]=qs[_0xc3fe('0x3c')](_0x1b1160[_0xc3fe('0x33')][_0xc3fe('0x3c')]);_0x4c9871[_0xc3fe('0x3f')]=qs[_0xc3fe('0x35')](_[_0xc3fe('0x3d')](_0x1b1160[_0xc3fe('0x33')],_0xd09a88[_0xc3fe('0x35')]));if(_0x1b1160[_0xc3fe('0x33')][_0xc3fe('0x41')]){_0x4c9871[_0xc3fe('0x3f')]=_['merge'](_0x4c9871[_0xc3fe('0x3f')],{'$or':_[_0xc3fe('0x2c')](_0x4c9871[_0xc3fe('0x38')],function(_0x39dd90){var _0x2e1a2e={};_0x2e1a2e[_0x39dd90]={'$like':'%'+_0x1b1160['query'][_0xc3fe('0x41')]+'%'};return _0x2e1a2e;})});}_0x4c9871=_[_0xc3fe('0x3e')]({},_0x4c9871,_0x1b1160[_0xc3fe('0x46')]);return _0x295be9['getDescriptions'](_0x4c9871);}})[_0xc3fe('0x26')](function(_0x54dc11){if(_0x54dc11){_0x33df34=_0x54dc11[_0xc3fe('0x39')];if(!_0x1b1160['query'][_0xc3fe('0x4d')]('nolimit')){_0x4c9871[_0xc3fe('0x1e')]=qs[_0xc3fe('0x1e')](_0x1b1160[_0xc3fe('0x33')][_0xc3fe('0x1e')]);_0x4c9871[_0xc3fe('0x1c')]=qs[_0xc3fe('0x1c')](_0x1b1160[_0xc3fe('0x33')]['offset']);}return _0x295be9['getDescriptions'](_0x4c9871);}})[_0xc3fe('0x26')](function(_0x525d94){if(_0x525d94){return _0x525d94?{'count':_0x33df34,'rows':_0x525d94}:null;}})['then'](respondWithResult(_0x5ae76c,null))[_0xc3fe('0x4a')](handleError(_0x5ae76c,null));}; \ No newline at end of file +var _0x78d8=['show','params','rawAttributes','includeAll','catch','create','body','find','getFields','SalesforceField','order','pick','getSubjects','findOne','getDescriptions','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','SalesforceConfiguration','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows'];(function(_0x15d60e,_0x4e846d){var _0x5c6452=function(_0x1ca41c){while(--_0x1ca41c){_0x15d60e['push'](_0x15d60e['shift']());}};_0x5c6452(++_0x4e846d);}(_0x78d8,0x19f));var _0x878d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x78d8[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x878d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x878d('0x1'));var Mustache=require(_0x878d('0x2'));var util=require(_0x878d('0x3'));var path=require('path');var sox=require(_0x878d('0x4'));var csv=require(_0x878d('0x5'));var ejs=require(_0x878d('0x6'));var fs=require('fs');var fs_extra=require(_0x878d('0x7'));var _=require(_0x878d('0x8'));var squel=require('squel');var crypto=require(_0x878d('0x9'));var jsforce=require(_0x878d('0xa'));var deskjs=require(_0x878d('0xb'));var toCsv=require(_0x878d('0x5'));var querystring=require(_0x878d('0xc'));var Papa=require(_0x878d('0xd'));var Redis=require(_0x878d('0xe'));var authService=require(_0x878d('0xf'));var qs=require(_0x878d('0x10'));var as=require(_0x878d('0x11'));var hardwareService=require(_0x878d('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x878d('0x13'));var config=require(_0x878d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x878d('0x15'))['db'];function respondWithStatusCode(_0x5a9cc0,_0x58f2ea){_0x58f2ea=_0x58f2ea||0xcc;return function(_0x3c3c1b){if(_0x3c3c1b){return _0x5a9cc0[_0x878d('0x16')](_0x58f2ea);}return _0x5a9cc0[_0x878d('0x17')](_0x58f2ea)['end']();};}function respondWithResult(_0x3297d8,_0x78ae1c){_0x78ae1c=_0x78ae1c||0xc8;return function(_0x4943e0){if(_0x4943e0){return _0x3297d8[_0x878d('0x17')](_0x78ae1c)[_0x878d('0x18')](_0x4943e0);}};}function respondWithFilteredResult(_0x1234d8,_0xecb6db){return function(_0x13b017){if(_0x13b017){var _0x1db8dc=typeof _0xecb6db[_0x878d('0x19')]===_0x878d('0x1a')&&typeof _0xecb6db[_0x878d('0x1b')]==='undefined';var _0x105038=_0x13b017[_0x878d('0x1c')];var _0x137f56=_0x1db8dc?0x0:_0xecb6db[_0x878d('0x19')];var _0x22e618=_0x1db8dc?_0x13b017['count']:_0xecb6db[_0x878d('0x19')]+_0xecb6db[_0x878d('0x1b')];var _0x34111f;if(_0x22e618>=_0x105038){_0x22e618=_0x105038;_0x34111f=0xc8;}else{_0x34111f=0xce;}_0x1234d8[_0x878d('0x17')](_0x34111f);return _0x1234d8['set']('Content-Range',_0x137f56+'-'+_0x22e618+'/'+_0x105038)[_0x878d('0x18')](_0x13b017);}return null;};}function patchUpdates(_0x2c260a){return function(_0x3be9e4){try{jsonpatch[_0x878d('0x1d')](_0x3be9e4,_0x2c260a,!![]);}catch(_0x405aaf){return BPromise[_0x878d('0x1e')](_0x405aaf);}return _0x3be9e4[_0x878d('0x1f')]();};}function saveUpdates(_0x5544a3,_0x44d4dc){return function(_0x851a6){if(_0x851a6){return _0x851a6[_0x878d('0x20')](_0x5544a3)[_0x878d('0x21')](function(_0x36be01){return _0x36be01;});}return null;};}function removeEntity(_0x1d2706,_0x40659b){return function(_0x51ed04){if(_0x51ed04){return _0x51ed04[_0x878d('0x22')]()['then'](function(){_0x1d2706[_0x878d('0x17')](0xcc)[_0x878d('0x23')]();});}};}function handleEntityNotFound(_0x2e5811,_0x4f4c51){return function(_0x585643){if(!_0x585643){_0x2e5811[_0x878d('0x16')](0x194);}return _0x585643;};}function handleError(_0x25cc36,_0x35863e){_0x35863e=_0x35863e||0x1f4;return function(_0x40290a){logger[_0x878d('0x24')](_0x40290a[_0x878d('0x25')]);if(_0x40290a['name']){delete _0x40290a[_0x878d('0x26')];}_0x25cc36[_0x878d('0x17')](_0x35863e)[_0x878d('0x27')](_0x40290a);};}exports[_0x878d('0x28')]=function(_0x3eaf40,_0x55f0cc){var _0x3e74cd={},_0x7e5481={},_0x1ab3f4={'count':0x0,'rows':[]};var _0x2ae7cb=_['map'](db[_0x878d('0x29')]['rawAttributes'],function(_0x212779){return{'name':_0x212779[_0x878d('0x2a')],'type':_0x212779[_0x878d('0x2b')][_0x878d('0x2c')]};});_0x7e5481[_0x878d('0x2d')]=_[_0x878d('0x2e')](_0x2ae7cb,_0x878d('0x26'));_0x7e5481[_0x878d('0x2f')]=_[_0x878d('0x30')](_0x3eaf40[_0x878d('0x2f')]);_0x7e5481['filters']=_['intersection'](_0x7e5481['model'],_0x7e5481[_0x878d('0x2f')]);_0x3e74cd[_0x878d('0x31')]=_[_0x878d('0x32')](_0x7e5481[_0x878d('0x2d')],qs[_0x878d('0x33')](_0x3eaf40[_0x878d('0x2f')][_0x878d('0x33')]));_0x3e74cd[_0x878d('0x31')]=_0x3e74cd[_0x878d('0x31')][_0x878d('0x34')]?_0x3e74cd[_0x878d('0x31')]:_0x7e5481[_0x878d('0x2d')];if(!_0x3eaf40[_0x878d('0x2f')][_0x878d('0x35')](_0x878d('0x36'))){_0x3e74cd[_0x878d('0x1b')]=qs[_0x878d('0x1b')](_0x3eaf40[_0x878d('0x2f')]['limit']);_0x3e74cd[_0x878d('0x19')]=qs[_0x878d('0x19')](_0x3eaf40[_0x878d('0x2f')][_0x878d('0x19')]);}_0x3e74cd['order']=qs['sort'](_0x3eaf40[_0x878d('0x2f')][_0x878d('0x37')]);_0x3e74cd[_0x878d('0x38')]=qs[_0x878d('0x39')](_['pick'](_0x3eaf40['query'],_0x7e5481['filters']),_0x2ae7cb);if(_0x3eaf40[_0x878d('0x2f')][_0x878d('0x3a')]){_0x3e74cd[_0x878d('0x38')]=_[_0x878d('0x3b')](_0x3e74cd[_0x878d('0x38')],{'$or':_[_0x878d('0x2e')](_0x2ae7cb,function(_0x2b6535){if(_0x2b6535[_0x878d('0x2b')]!==_0x878d('0x3c')){var _0x3c1376={};_0x3c1376[_0x2b6535[_0x878d('0x26')]]={'$like':'%'+_0x3eaf40[_0x878d('0x2f')][_0x878d('0x3a')]+'%'};return _0x3c1376;}})});}_0x3e74cd=_[_0x878d('0x3b')]({},_0x3e74cd,_0x3eaf40[_0x878d('0x3d')]);var _0x136e98={'where':_0x3e74cd['where']};return db[_0x878d('0x29')][_0x878d('0x1c')](_0x136e98)['then'](function(_0x34200c){_0x1ab3f4[_0x878d('0x1c')]=_0x34200c;if(_0x3eaf40[_0x878d('0x2f')]['includeAll']){_0x3e74cd[_0x878d('0x3e')]=[{'all':!![]}];}return db[_0x878d('0x29')][_0x878d('0x3f')](_0x3e74cd);})[_0x878d('0x21')](function(_0x1c3bac){_0x1ab3f4[_0x878d('0x40')]=_0x1c3bac;return _0x1ab3f4;})[_0x878d('0x21')](respondWithFilteredResult(_0x55f0cc,_0x3e74cd))['catch'](handleError(_0x55f0cc,null));};exports[_0x878d('0x41')]=function(_0xf69272,_0x1e89c6){var _0x35748a={'raw':![],'where':{'id':_0xf69272[_0x878d('0x42')]['id']}},_0x161e0e={};_0x161e0e[_0x878d('0x2d')]=_[_0x878d('0x30')](db[_0x878d('0x29')][_0x878d('0x43')]);_0x161e0e['query']=_[_0x878d('0x30')](_0xf69272[_0x878d('0x2f')]);_0x161e0e[_0x878d('0x39')]=_[_0x878d('0x32')](_0x161e0e[_0x878d('0x2d')],_0x161e0e[_0x878d('0x2f')]);_0x35748a[_0x878d('0x31')]=_['intersection'](_0x161e0e[_0x878d('0x2d')],qs[_0x878d('0x33')](_0xf69272[_0x878d('0x2f')][_0x878d('0x33')]));_0x35748a[_0x878d('0x31')]=_0x35748a['attributes'][_0x878d('0x34')]?_0x35748a['attributes']:_0x161e0e['model'];if(_0xf69272[_0x878d('0x2f')][_0x878d('0x44')]){_0x35748a[_0x878d('0x3e')]=[{'all':!![]}];}_0x35748a=_[_0x878d('0x3b')]({},_0x35748a,_0xf69272[_0x878d('0x3d')]);return db[_0x878d('0x29')]['find'](_0x35748a)['then'](handleEntityNotFound(_0x1e89c6,null))['then'](respondWithResult(_0x1e89c6,null))[_0x878d('0x45')](handleError(_0x1e89c6,null));};exports['create']=function(_0x4e81ef,_0x10f798){return db[_0x878d('0x29')][_0x878d('0x46')](_0x4e81ef[_0x878d('0x47')],{})[_0x878d('0x21')](respondWithResult(_0x10f798,0xc9))['catch'](handleError(_0x10f798,null));};exports[_0x878d('0x20')]=function(_0x5c88f6,_0xaeaaf3){if(_0x5c88f6['body']['id']){delete _0x5c88f6[_0x878d('0x47')]['id'];}return db['SalesforceConfiguration'][_0x878d('0x48')]({'where':{'id':_0x5c88f6[_0x878d('0x42')]['id']}})[_0x878d('0x21')](handleEntityNotFound(_0xaeaaf3,null))[_0x878d('0x21')](saveUpdates(_0x5c88f6[_0x878d('0x47')],null))[_0x878d('0x21')](respondWithResult(_0xaeaaf3,null))[_0x878d('0x45')](handleError(_0xaeaaf3,null));};exports[_0x878d('0x22')]=function(_0x363714,_0x4142b1){return db['SalesforceConfiguration']['find']({'where':{'id':_0x363714[_0x878d('0x42')]['id']}})[_0x878d('0x21')](handleEntityNotFound(_0x4142b1,null))[_0x878d('0x21')](removeEntity(_0x4142b1,null))[_0x878d('0x45')](handleError(_0x4142b1,null));};exports[_0x878d('0x49')]=function(_0x14d87e,_0x363299,_0x3b9107){var _0x17e2f3={};var _0x340d50={};var _0x407f35;var _0x49a912;return db[_0x878d('0x29')]['findOne']({'where':{'id':_0x14d87e['params']['id']}})[_0x878d('0x21')](handleEntityNotFound(_0x363299,null))[_0x878d('0x21')](function(_0x3cdbba){if(_0x3cdbba){_0x407f35=_0x3cdbba;_0x340d50[_0x878d('0x2d')]=_['keys'](db[_0x878d('0x4a')][_0x878d('0x43')]);_0x340d50[_0x878d('0x2f')]=_[_0x878d('0x30')](_0x14d87e[_0x878d('0x2f')]);_0x340d50['filters']=_[_0x878d('0x32')](_0x340d50['model'],_0x340d50['query']);_0x17e2f3[_0x878d('0x31')]=_[_0x878d('0x32')](_0x340d50[_0x878d('0x2d')],qs[_0x878d('0x33')](_0x14d87e[_0x878d('0x2f')][_0x878d('0x33')]));_0x17e2f3[_0x878d('0x31')]=_0x17e2f3['attributes']['length']?_0x17e2f3[_0x878d('0x31')]:_0x340d50[_0x878d('0x2d')];_0x17e2f3[_0x878d('0x4b')]=qs[_0x878d('0x37')](_0x14d87e[_0x878d('0x2f')][_0x878d('0x37')]);_0x17e2f3[_0x878d('0x38')]=qs[_0x878d('0x39')](_[_0x878d('0x4c')](_0x14d87e['query'],_0x340d50[_0x878d('0x39')]));if(_0x14d87e[_0x878d('0x2f')][_0x878d('0x3a')]){_0x17e2f3[_0x878d('0x38')]=_[_0x878d('0x3b')](_0x17e2f3[_0x878d('0x38')],{'$or':_[_0x878d('0x2e')](_0x17e2f3['attributes'],function(_0x12073a){var _0x187e4a={};_0x187e4a[_0x12073a]={'$like':'%'+_0x14d87e[_0x878d('0x2f')][_0x878d('0x3a')]+'%'};return _0x187e4a;})});}_0x17e2f3=_[_0x878d('0x3b')]({},_0x17e2f3,_0x14d87e[_0x878d('0x3d')]);return _0x407f35[_0x878d('0x49')](_0x17e2f3);}})[_0x878d('0x21')](function(_0x17ed7e){if(_0x17ed7e){_0x49a912=_0x17ed7e[_0x878d('0x34')];if(!_0x14d87e[_0x878d('0x2f')]['hasOwnProperty'](_0x878d('0x36'))){_0x17e2f3[_0x878d('0x1b')]=qs[_0x878d('0x1b')](_0x14d87e['query'][_0x878d('0x1b')]);_0x17e2f3[_0x878d('0x19')]=qs['offset'](_0x14d87e[_0x878d('0x2f')][_0x878d('0x19')]);}return _0x407f35[_0x878d('0x49')](_0x17e2f3);}})['then'](function(_0x19c370){if(_0x19c370){return _0x19c370?{'count':_0x49a912,'rows':_0x19c370}:null;}})[_0x878d('0x21')](respondWithResult(_0x363299,null))[_0x878d('0x45')](handleError(_0x363299,null));};exports[_0x878d('0x4d')]=function(_0x22784c,_0x4cf24e,_0x3138fe){var _0x5ce922={};var _0x5b38c8={};var _0x388bfa;var _0x897dbf;return db['SalesforceConfiguration'][_0x878d('0x4e')]({'where':{'id':_0x22784c[_0x878d('0x42')]['id']}})['then'](handleEntityNotFound(_0x4cf24e,null))['then'](function(_0xaad4bc){if(_0xaad4bc){_0x388bfa=_0xaad4bc;_0x5b38c8[_0x878d('0x2d')]=_[_0x878d('0x30')](db['SalesforceField'][_0x878d('0x43')]);_0x5b38c8['query']=_['keys'](_0x22784c[_0x878d('0x2f')]);_0x5b38c8[_0x878d('0x39')]=_[_0x878d('0x32')](_0x5b38c8['model'],_0x5b38c8[_0x878d('0x2f')]);_0x5ce922[_0x878d('0x31')]=_[_0x878d('0x32')](_0x5b38c8[_0x878d('0x2d')],qs[_0x878d('0x33')](_0x22784c[_0x878d('0x2f')]['fields']));_0x5ce922[_0x878d('0x31')]=_0x5ce922[_0x878d('0x31')]['length']?_0x5ce922['attributes']:_0x5b38c8[_0x878d('0x2d')];_0x5ce922[_0x878d('0x4b')]=qs[_0x878d('0x37')](_0x22784c[_0x878d('0x2f')]['sort']);_0x5ce922[_0x878d('0x38')]=qs[_0x878d('0x39')](_[_0x878d('0x4c')](_0x22784c[_0x878d('0x2f')],_0x5b38c8['filters']));if(_0x22784c[_0x878d('0x2f')][_0x878d('0x3a')]){_0x5ce922[_0x878d('0x38')]=_[_0x878d('0x3b')](_0x5ce922[_0x878d('0x38')],{'$or':_['map'](_0x5ce922[_0x878d('0x31')],function(_0x532b54){var _0x4e3ec6={};_0x4e3ec6[_0x532b54]={'$like':'%'+_0x22784c['query'][_0x878d('0x3a')]+'%'};return _0x4e3ec6;})});}_0x5ce922=_[_0x878d('0x3b')]({},_0x5ce922,_0x22784c[_0x878d('0x3d')]);return _0x388bfa[_0x878d('0x4d')](_0x5ce922);}})[_0x878d('0x21')](function(_0x4a24d6){if(_0x4a24d6){_0x897dbf=_0x4a24d6['length'];if(!_0x22784c[_0x878d('0x2f')][_0x878d('0x35')](_0x878d('0x36'))){_0x5ce922[_0x878d('0x1b')]=qs['limit'](_0x22784c[_0x878d('0x2f')][_0x878d('0x1b')]);_0x5ce922[_0x878d('0x19')]=qs['offset'](_0x22784c['query']['offset']);}return _0x388bfa[_0x878d('0x4d')](_0x5ce922);}})[_0x878d('0x21')](function(_0x39e269){if(_0x39e269){return _0x39e269?{'count':_0x897dbf,'rows':_0x39e269}:null;}})[_0x878d('0x21')](respondWithResult(_0x4cf24e,null))[_0x878d('0x45')](handleError(_0x4cf24e,null));};exports['getDescriptions']=function(_0x43170f,_0x550c0d,_0x3552a6){var _0x2feba1={};var _0x78b75d={};var _0x173a38;var _0x2ac639;return db['SalesforceConfiguration'][_0x878d('0x4e')]({'where':{'id':_0x43170f[_0x878d('0x42')]['id']}})[_0x878d('0x21')](handleEntityNotFound(_0x550c0d,null))[_0x878d('0x21')](function(_0x7e5bee){if(_0x7e5bee){_0x173a38=_0x7e5bee;_0x78b75d[_0x878d('0x2d')]=_['keys'](db['SalesforceField']['rawAttributes']);_0x78b75d[_0x878d('0x2f')]=_[_0x878d('0x30')](_0x43170f[_0x878d('0x2f')]);_0x78b75d[_0x878d('0x39')]=_[_0x878d('0x32')](_0x78b75d[_0x878d('0x2d')],_0x78b75d[_0x878d('0x2f')]);_0x2feba1[_0x878d('0x31')]=_[_0x878d('0x32')](_0x78b75d['model'],qs[_0x878d('0x33')](_0x43170f[_0x878d('0x2f')][_0x878d('0x33')]));_0x2feba1['attributes']=_0x2feba1['attributes'][_0x878d('0x34')]?_0x2feba1[_0x878d('0x31')]:_0x78b75d[_0x878d('0x2d')];_0x2feba1[_0x878d('0x4b')]=qs[_0x878d('0x37')](_0x43170f[_0x878d('0x2f')]['sort']);_0x2feba1[_0x878d('0x38')]=qs['filters'](_[_0x878d('0x4c')](_0x43170f[_0x878d('0x2f')],_0x78b75d[_0x878d('0x39')]));if(_0x43170f[_0x878d('0x2f')][_0x878d('0x3a')]){_0x2feba1['where']=_[_0x878d('0x3b')](_0x2feba1[_0x878d('0x38')],{'$or':_[_0x878d('0x2e')](_0x2feba1['attributes'],function(_0x464f9e){var _0x26bce4={};_0x26bce4[_0x464f9e]={'$like':'%'+_0x43170f['query'][_0x878d('0x3a')]+'%'};return _0x26bce4;})});}_0x2feba1=_['merge']({},_0x2feba1,_0x43170f[_0x878d('0x3d')]);return _0x173a38[_0x878d('0x4f')](_0x2feba1);}})['then'](function(_0x498695){if(_0x498695){_0x2ac639=_0x498695[_0x878d('0x34')];if(!_0x43170f['query']['hasOwnProperty'](_0x878d('0x36'))){_0x2feba1['limit']=qs[_0x878d('0x1b')](_0x43170f[_0x878d('0x2f')][_0x878d('0x1b')]);_0x2feba1[_0x878d('0x19')]=qs[_0x878d('0x19')](_0x43170f[_0x878d('0x2f')][_0x878d('0x19')]);}return _0x173a38['getDescriptions'](_0x2feba1);}})[_0x878d('0x21')](function(_0x16c24f){if(_0x16c24f){return _0x16c24f?{'count':_0x2ac639,'rows':_0x16c24f}:null;}})[_0x878d('0x21')](respondWithResult(_0x550c0d,null))[_0x878d('0x45')](handleError(_0x550c0d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 39b83c2..0bf8d86 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 _0x1541=['../../config/environment','exports','define','SalesforceConfiguration','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x136e5e,_0x2d5726){var _0x3427c1=function(_0x437cef){while(--_0x437cef){_0x136e5e['push'](_0x136e5e['shift']());}};_0x3427c1(++_0x2d5726);}(_0x1541,0x138));var _0x1154=function(_0x1406ae,_0x292395){_0x1406ae=_0x1406ae-0x0;var _0x23a076=_0x1541[_0x1406ae];return _0x23a076;};'use strict';var _=require(_0x1154('0x0'));var util=require(_0x1154('0x1'));var logger=require(_0x1154('0x2'))(_0x1154('0x3'));var moment=require(_0x1154('0x4'));var BPromise=require(_0x1154('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1154('0x6'));var rimraf=require('rimraf');var config=require(_0x1154('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x1154('0x8')]=function(_0x1e45d4,_0x553b20){return _0x1e45d4[_0x1154('0x9')](_0x1154('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1784=['../../config/environment','./intSalesforceConfiguration.attributes','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x212a37,_0xf35b2e){var _0x5d0bf9=function(_0x51850f){while(--_0x51850f){_0x212a37['push'](_0x212a37['shift']());}};_0x5d0bf9(++_0xf35b2e);}(_0x1784,0x1f0));var _0x4178=function(_0x596684,_0x3e7a0a){_0x596684=_0x596684-0x0;var _0x21d272=_0x1784[_0x596684];return _0x21d272;};'use strict';var _=require(_0x4178('0x0'));var util=require(_0x4178('0x1'));var logger=require(_0x4178('0x2'))('api');var moment=require(_0x4178('0x3'));var BPromise=require(_0x4178('0x4'));var rp=require(_0x4178('0x5'));var fs=require('fs');var path=require(_0x4178('0x6'));var rimraf=require(_0x4178('0x7'));var config=require(_0x4178('0x8'));var attributes=require(_0x4178('0x9'));module['exports']=function(_0x55cf04,_0x316af4){return _0x55cf04['define'](_0x4178('0xa'),attributes,{'tableName':_0x4178('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index fcc7178..95450ee 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 _0x5150=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','client','http','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x562bb5,_0x34fdd4){var _0x34bb21=function(_0x243d79){while(--_0x243d79){_0x562bb5['push'](_0x562bb5['shift']());}};_0x34bb21(++_0x34fdd4);}(_0x5150,0x18e));var _0x0515=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x5150[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var util=require(_0x0515('0x0'));var moment=require(_0x0515('0x1'));var BPromise=require(_0x0515('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0515('0x3'));var db=require(_0x0515('0x4'))['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[_0x0515('0x5')][_0x0515('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4516d5,_0x416018,_0xa4ba55){return new BPromise(function(_0xd8999d,_0x31964e){return client['request'](_0x4516d5,_0xa4ba55)['then'](function(_0x54a10b){logger[_0x0515('0x7')](_0x0515('0x8'),_0x416018,_0x0515('0x9'));logger['debug'](_0x0515('0xa'),_0x416018,'request\x20sent',JSON[_0x0515('0xb')](_0x54a10b));if(_0x54a10b[_0x0515('0xc')]){if(_0x54a10b[_0x0515('0xc')][_0x0515('0xd')]===0x1f4){logger[_0x0515('0xc')](_0x0515('0x8'),_0x416018,_0x54a10b[_0x0515('0xc')][_0x0515('0xe')]);return _0x31964e(_0x54a10b[_0x0515('0xc')][_0x0515('0xe')]);}logger[_0x0515('0xc')](_0x0515('0x8'),_0x416018,_0x54a10b[_0x0515('0xc')][_0x0515('0xe')]);return _0xd8999d(_0x54a10b[_0x0515('0xc')][_0x0515('0xe')]);}else{logger[_0x0515('0x7')]('SalesforceConfiguration,\x20%s,\x20%s',_0x416018,'request\x20sent');_0xd8999d(_0x54a10b[_0x0515('0xf')][_0x0515('0xe')]);}})[_0x0515('0x10')](function(_0x2022c5){logger[_0x0515('0xc')](_0x0515('0x8'),_0x416018,_0x2022c5);_0x31964e(_0x2022c5);});});} \ No newline at end of file +var _0xde99=['bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','SalesforceConfiguration,\x20%s,\x20%s','message','info','result','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xde99,0x1a8));var _0x9de9=function(_0x5e96ee,_0x4a8378){_0x5e96ee=_0x5e96ee-0x0;var _0x4e1744=_0xde99[_0x5e96ee];return _0x4e1744;};'use strict';var _=require(_0x9de9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9de9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9de9('0x2'));var logger=require(_0x9de9('0x3'))(_0x9de9('0x4'));var config=require('../../config/environment');var jayson=require(_0x9de9('0x5'));var client=jayson[_0x9de9('0x6')][_0x9de9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x11643c,_0x5c31f7,_0x1e5a50){return new BPromise(function(_0x11f9a0,_0x56a444){return client[_0x9de9('0x8')](_0x11643c,_0x1e5a50)[_0x9de9('0x9')](function(_0x2240a0){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x5c31f7,'request\x20sent');logger[_0x9de9('0xa')](_0x9de9('0xb'),_0x5c31f7,'request\x20sent',JSON['stringify'](_0x2240a0));if(_0x2240a0[_0x9de9('0xc')]){if(_0x2240a0[_0x9de9('0xc')]['code']===0x1f4){logger['error'](_0x9de9('0xd'),_0x5c31f7,_0x2240a0[_0x9de9('0xc')][_0x9de9('0xe')]);return _0x56a444(_0x2240a0['error']['message']);}logger['error'](_0x9de9('0xd'),_0x5c31f7,_0x2240a0[_0x9de9('0xc')]['message']);return _0x11f9a0(_0x2240a0['error'][_0x9de9('0xe')]);}else{logger[_0x9de9('0xf')](_0x9de9('0xd'),_0x5c31f7,'request\x20sent');_0x11f9a0(_0x2240a0[_0x9de9('0x10')][_0x9de9('0xe')]);}})['catch'](function(_0x49889b){logger[_0x9de9('0xc')](_0x9de9('0xd'),_0x5c31f7,_0x49889b);_0x56a444(_0x49889b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index afc7cc0..a8b83cb 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 _0x40ae=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','create','update'];(function(_0x23445d,_0x371efe){var _0x928037=function(_0x373920){while(--_0x373920){_0x23445d['push'](_0x23445d['shift']());}};_0x928037(++_0x371efe);}(_0x40ae,0xc7));var _0xe40a=function(_0x501851,_0x10a9ee){_0x501851=_0x501851-0x0;var _0x15d0e7=_0x40ae[_0x501851];return _0x15d0e7;};'use strict';var multer=require(_0xe40a('0x0'));var util=require(_0xe40a('0x1'));var path=require(_0xe40a('0x2'));var timeout=require(_0xe40a('0x3'));var express=require(_0xe40a('0x4'));var router=express[_0xe40a('0x5')]();var fs_extra=require(_0xe40a('0x6'));var auth=require(_0xe40a('0x7'));var interaction=require(_0xe40a('0x8'));var config=require(_0xe40a('0x9'));var controller=require(_0xe40a('0xa'));router[_0xe40a('0xb')]('/',auth[_0xe40a('0xc')](),controller[_0xe40a('0xd')]);router['get'](_0xe40a('0xe'),auth[_0xe40a('0xc')](),controller['show']);router['post']('/',auth[_0xe40a('0xc')](),controller[_0xe40a('0xf')]);router['put'](_0xe40a('0xe'),auth[_0xe40a('0xc')](),controller[_0xe40a('0x10')]);router['delete'](_0xe40a('0xe'),auth[_0xe40a('0xc')](),controller[_0xe40a('0x11')]);module['exports']=router; \ No newline at end of file +var _0x70b8=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','/:id','post','create','put','update'];(function(_0x1275bc,_0x2df77d){var _0x2930d0=function(_0x527a2d){while(--_0x527a2d){_0x1275bc['push'](_0x1275bc['shift']());}};_0x2930d0(++_0x2df77d);}(_0x70b8,0xb7));var _0x870b=function(_0x4feeca,_0x2bff67){_0x4feeca=_0x4feeca-0x0;var _0x1135cc=_0x70b8[_0x4feeca];return _0x1135cc;};'use strict';var multer=require(_0x870b('0x0'));var util=require(_0x870b('0x1'));var path=require('path');var timeout=require(_0x870b('0x2'));var express=require(_0x870b('0x3'));var router=express[_0x870b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x870b('0x5'));var interaction=require(_0x870b('0x6'));var config=require('../../config/environment');var controller=require(_0x870b('0x7'));router[_0x870b('0x8')]('/',auth[_0x870b('0x9')](),controller['index']);router['get'](_0x870b('0xa'),auth[_0x870b('0x9')](),controller['show']);router[_0x870b('0xb')]('/',auth['isAuthenticated'](),controller[_0x870b('0xc')]);router[_0x870b('0xd')]('/:id',auth[_0x870b('0x9')](),controller[_0x870b('0xe')]);router[_0x870b('0xf')](_0x870b('0xa'),auth[_0x870b('0x9')](),controller[_0x870b('0x10')]);module[_0x870b('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 fbf7fd5..6acbcf2 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 _0x5f67=['ENUM','string','keyValue','STRING','variable','customVariable'];(function(_0x139f5c,_0x56814f){var _0x24b9c2=function(_0x5eb0bd){while(--_0x5eb0bd){_0x139f5c['push'](_0x139f5c['shift']());}};_0x24b9c2(++_0x56814f);}(_0x5f67,0xae));var _0x75f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f67[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x75f6('0x0')](_0x75f6('0x1'),'variable','customVariable',_0x75f6('0x2'),'picklist'),'defaultValue':_0x75f6('0x1')},'content':{'type':Sequelize[_0x75f6('0x3')]},'key':{'type':Sequelize[_0x75f6('0x3')]},'keyType':{'type':Sequelize[_0x75f6('0x0')](_0x75f6('0x1'),_0x75f6('0x4'),_0x75f6('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x75f6('0x3')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe2f7=['variable','ENUM','string','customVariable','picklist','STRING'];(function(_0x576898,_0x43ab86){var _0x3d1879=function(_0x4be137){while(--_0x4be137){_0x576898['push'](_0x576898['shift']());}};_0x3d1879(++_0x43ab86);}(_0xe2f7,0x127));var _0x7e2f=function(_0x53c3fa,_0xc75d70){_0x53c3fa=_0x53c3fa-0x0;var _0x44e670=_0xe2f7[_0x53c3fa];return _0x44e670;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x7e2f('0x0')](_0x7e2f('0x1'),'variable',_0x7e2f('0x2'),'keyValue',_0x7e2f('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x7e2f('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x7e2f('0x5'),_0x7e2f('0x2'))},'keyContent':{'type':Sequelize[_0x7e2f('0x4')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 2fe5bab..528b8d6 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 _0xd96f=['sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','SalesforceField','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x218bcd,_0xd62bb7){var _0x318e06=function(_0xc011b1){while(--_0xc011b1){_0x218bcd['push'](_0x218bcd['shift']());}};_0x318e06(++_0xd62bb7);}(_0xd96f,0xfd));var _0xfd96=function(_0x31adc3,_0x1015d0){_0x31adc3=_0x31adc3-0x0;var _0x4cee80=_0xd96f[_0x31adc3];return _0x4cee80;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd96('0x0'));var zipdir=require(_0xfd96('0x1'));var jsonpatch=require(_0xfd96('0x2'));var rp=require(_0xfd96('0x3'));var moment=require(_0xfd96('0x4'));var BPromise=require(_0xfd96('0x5'));var Mustache=require(_0xfd96('0x6'));var util=require(_0xfd96('0x7'));var path=require(_0xfd96('0x8'));var sox=require(_0xfd96('0x9'));var csv=require(_0xfd96('0xa'));var ejs=require(_0xfd96('0xb'));var fs=require('fs');var fs_extra=require(_0xfd96('0xc'));var _=require(_0xfd96('0xd'));var squel=require(_0xfd96('0xe'));var crypto=require(_0xfd96('0xf'));var jsforce=require(_0xfd96('0x10'));var deskjs=require(_0xfd96('0x11'));var toCsv=require(_0xfd96('0xa'));var querystring=require(_0xfd96('0x12'));var Papa=require(_0xfd96('0x13'));var Redis=require(_0xfd96('0x14'));var authService=require(_0xfd96('0x15'));var qs=require(_0xfd96('0x16'));var as=require(_0xfd96('0x17'));var hardwareService=require(_0xfd96('0x18'));var logger=require(_0xfd96('0x19'))(_0xfd96('0x1a'));var utils=require(_0xfd96('0x1b'));var config=require(_0xfd96('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd96('0x1d'))['db'];function respondWithStatusCode(_0x368435,_0x4ad3c2){_0x4ad3c2=_0x4ad3c2||0xcc;return function(_0x4d07fb){if(_0x4d07fb){return _0x368435[_0xfd96('0x1e')](_0x4ad3c2);}return _0x368435[_0xfd96('0x1f')](_0x4ad3c2)[_0xfd96('0x20')]();};}function respondWithResult(_0x1b6646,_0x2d5c11){_0x2d5c11=_0x2d5c11||0xc8;return function(_0x1ea0fd){if(_0x1ea0fd){return _0x1b6646[_0xfd96('0x1f')](_0x2d5c11)[_0xfd96('0x21')](_0x1ea0fd);}};}function respondWithFilteredResult(_0x2fb400,_0x302b33){return function(_0x1395e5){if(_0x1395e5){var _0xedbff4=typeof _0x302b33[_0xfd96('0x22')]==='undefined'&&typeof _0x302b33[_0xfd96('0x23')]===_0xfd96('0x24');var _0x4e8795=_0x1395e5[_0xfd96('0x25')];var _0x1d7dca=_0xedbff4?0x0:_0x302b33[_0xfd96('0x22')];var _0x252ef5=_0xedbff4?_0x1395e5['count']:_0x302b33[_0xfd96('0x22')]+_0x302b33[_0xfd96('0x23')];var _0x415e05;if(_0x252ef5>=_0x4e8795){_0x252ef5=_0x4e8795;_0x415e05=0xc8;}else{_0x415e05=0xce;}_0x2fb400['status'](_0x415e05);return _0x2fb400[_0xfd96('0x26')](_0xfd96('0x27'),_0x1d7dca+'-'+_0x252ef5+'/'+_0x4e8795)[_0xfd96('0x21')](_0x1395e5);}return null;};}function patchUpdates(_0x4997e5){return function(_0x3a2618){try{jsonpatch[_0xfd96('0x28')](_0x3a2618,_0x4997e5,!![]);}catch(_0x23a565){return BPromise['reject'](_0x23a565);}return _0x3a2618[_0xfd96('0x29')]();};}function saveUpdates(_0x54598f,_0x88cf1c){return function(_0x3e8344){if(_0x3e8344){return _0x3e8344[_0xfd96('0x2a')](_0x54598f)[_0xfd96('0x2b')](function(_0x554dd1){return _0x554dd1;});}return null;};}function removeEntity(_0x3c62a2,_0x156a72){return function(_0x3c747e){if(_0x3c747e){return _0x3c747e[_0xfd96('0x2c')]()['then'](function(){_0x3c62a2['status'](0xcc)[_0xfd96('0x20')]();});}};}function handleEntityNotFound(_0x5f09c1,_0x459537){return function(_0x16ad25){if(!_0x16ad25){_0x5f09c1['sendStatus'](0x194);}return _0x16ad25;};}function handleError(_0x304386,_0x4176a2){_0x4176a2=_0x4176a2||0x1f4;return function(_0x58ef26){logger[_0xfd96('0x2d')](_0x58ef26['stack']);if(_0x58ef26[_0xfd96('0x2e')]){delete _0x58ef26['name'];}_0x304386['status'](_0x4176a2)[_0xfd96('0x2f')](_0x58ef26);};}exports[_0xfd96('0x30')]=function(_0x253d3d,_0x24b4bd){var _0x501c86={},_0x9c57b1={},_0x470837={'count':0x0,'rows':[]};var _0x348875=_[_0xfd96('0x31')](db[_0xfd96('0x32')]['rawAttributes'],function(_0x3727f4){return{'name':_0x3727f4[_0xfd96('0x33')],'type':_0x3727f4[_0xfd96('0x34')][_0xfd96('0x35')]};});_0x9c57b1[_0xfd96('0x36')]=_[_0xfd96('0x31')](_0x348875,_0xfd96('0x2e'));_0x9c57b1[_0xfd96('0x37')]=_['keys'](_0x253d3d['query']);_0x9c57b1[_0xfd96('0x38')]=_[_0xfd96('0x39')](_0x9c57b1[_0xfd96('0x36')],_0x9c57b1['query']);_0x501c86[_0xfd96('0x3a')]=_[_0xfd96('0x39')](_0x9c57b1['model'],qs[_0xfd96('0x3b')](_0x253d3d['query']['fields']));_0x501c86[_0xfd96('0x3a')]=_0x501c86['attributes']['length']?_0x501c86[_0xfd96('0x3a')]:_0x9c57b1['model'];if(!_0x253d3d['query'][_0xfd96('0x3c')](_0xfd96('0x3d'))){_0x501c86[_0xfd96('0x23')]=qs[_0xfd96('0x23')](_0x253d3d[_0xfd96('0x37')][_0xfd96('0x23')]);_0x501c86['offset']=qs['offset'](_0x253d3d[_0xfd96('0x37')][_0xfd96('0x22')]);}_0x501c86[_0xfd96('0x3e')]=qs['sort'](_0x253d3d[_0xfd96('0x37')][_0xfd96('0x3f')]);_0x501c86[_0xfd96('0x40')]=qs['filters'](_['pick'](_0x253d3d['query'],_0x9c57b1[_0xfd96('0x38')]),_0x348875);if(_0x253d3d[_0xfd96('0x37')][_0xfd96('0x41')]){_0x501c86['where']=_[_0xfd96('0x42')](_0x501c86[_0xfd96('0x40')],{'$or':_[_0xfd96('0x31')](_0x348875,function(_0x4748c2){if(_0x4748c2[_0xfd96('0x34')]!==_0xfd96('0x43')){var _0x14a08f={};_0x14a08f[_0x4748c2[_0xfd96('0x2e')]]={'$like':'%'+_0x253d3d[_0xfd96('0x37')][_0xfd96('0x41')]+'%'};return _0x14a08f;}})});}_0x501c86=_[_0xfd96('0x42')]({},_0x501c86,_0x253d3d[_0xfd96('0x44')]);var _0x3e81ae={'where':_0x501c86['where']};return db['SalesforceField']['count'](_0x3e81ae)[_0xfd96('0x2b')](function(_0x5bfc9b){_0x470837['count']=_0x5bfc9b;if(_0x253d3d[_0xfd96('0x37')]['includeAll']){_0x501c86['include']=[{'all':!![]}];}return db[_0xfd96('0x32')][_0xfd96('0x45')](_0x501c86);})[_0xfd96('0x2b')](function(_0x436d39){_0x470837[_0xfd96('0x46')]=_0x436d39;return _0x470837;})[_0xfd96('0x2b')](respondWithFilteredResult(_0x24b4bd,_0x501c86))[_0xfd96('0x47')](handleError(_0x24b4bd,null));};exports[_0xfd96('0x48')]=function(_0x26110b,_0x29acf0){var _0x31c2c4={'raw':!![],'where':{'id':_0x26110b[_0xfd96('0x49')]['id']}},_0x5c24d4={};_0x5c24d4[_0xfd96('0x36')]=_[_0xfd96('0x4a')](db['SalesforceField']['rawAttributes']);_0x5c24d4[_0xfd96('0x37')]=_['keys'](_0x26110b['query']);_0x5c24d4[_0xfd96('0x38')]=_[_0xfd96('0x39')](_0x5c24d4[_0xfd96('0x36')],_0x5c24d4[_0xfd96('0x37')]);_0x31c2c4[_0xfd96('0x3a')]=_[_0xfd96('0x39')](_0x5c24d4['model'],qs[_0xfd96('0x3b')](_0x26110b[_0xfd96('0x37')][_0xfd96('0x3b')]));_0x31c2c4[_0xfd96('0x3a')]=_0x31c2c4[_0xfd96('0x3a')]['length']?_0x31c2c4[_0xfd96('0x3a')]:_0x5c24d4[_0xfd96('0x36')];if(_0x26110b[_0xfd96('0x37')][_0xfd96('0x4b')]){_0x31c2c4['include']=[{'all':!![]}];}_0x31c2c4=_['merge']({},_0x31c2c4,_0x26110b[_0xfd96('0x44')]);return db['SalesforceField'][_0xfd96('0x4c')](_0x31c2c4)['then'](handleEntityNotFound(_0x29acf0,null))[_0xfd96('0x2b')](respondWithResult(_0x29acf0,null))[_0xfd96('0x47')](handleError(_0x29acf0,null));};exports[_0xfd96('0x4d')]=function(_0x6557af,_0x1b3746){return db[_0xfd96('0x32')][_0xfd96('0x4d')](_0x6557af[_0xfd96('0x4e')],{})[_0xfd96('0x2b')](respondWithResult(_0x1b3746,0xc9))[_0xfd96('0x47')](handleError(_0x1b3746,null));};exports['update']=function(_0x160477,_0x2ad8a8){if(_0x160477['body']['id']){delete _0x160477[_0xfd96('0x4e')]['id'];}return db[_0xfd96('0x32')][_0xfd96('0x4c')]({'where':{'id':_0x160477[_0xfd96('0x49')]['id']}})[_0xfd96('0x2b')](handleEntityNotFound(_0x2ad8a8,null))[_0xfd96('0x2b')](saveUpdates(_0x160477[_0xfd96('0x4e')],null))[_0xfd96('0x2b')](respondWithResult(_0x2ad8a8,null))[_0xfd96('0x47')](handleError(_0x2ad8a8,null));};exports[_0xfd96('0x2c')]=function(_0xd9d7c6,_0x165a88){return db[_0xfd96('0x32')][_0xfd96('0x4c')]({'where':{'id':_0xd9d7c6[_0xfd96('0x49')]['id']}})['then'](handleEntityNotFound(_0x165a88,null))[_0xfd96('0x2b')](removeEntity(_0x165a88,null))[_0xfd96('0x47')](handleError(_0x165a88,null));}; \ No newline at end of file +var _0x9ae0=['error','stack','name','send','SalesforceField','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','keys','length','include','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy'];(function(_0x5d5f40,_0x33be4e){var _0x125e43=function(_0x5636be){while(--_0x5636be){_0x5d5f40['push'](_0x5d5f40['shift']());}};_0x125e43(++_0x33be4e);}(_0x9ae0,0xb4));var _0x09ae=function(_0xa48767,_0x1f5ae8){_0xa48767=_0xa48767-0x0;var _0x4ceb94=_0x9ae0[_0xa48767];return _0x4ceb94;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x09ae('0x0'));var zipdir=require(_0x09ae('0x1'));var jsonpatch=require(_0x09ae('0x2'));var rp=require('request-promise');var moment=require(_0x09ae('0x3'));var BPromise=require(_0x09ae('0x4'));var Mustache=require(_0x09ae('0x5'));var util=require(_0x09ae('0x6'));var path=require(_0x09ae('0x7'));var sox=require(_0x09ae('0x8'));var csv=require('to-csv');var ejs=require(_0x09ae('0x9'));var fs=require('fs');var fs_extra=require(_0x09ae('0xa'));var _=require(_0x09ae('0xb'));var squel=require(_0x09ae('0xc'));var crypto=require(_0x09ae('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x09ae('0xe'));var toCsv=require(_0x09ae('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x09ae('0x10'));var authService=require(_0x09ae('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09ae('0x12'));var logger=require(_0x09ae('0x13'))(_0x09ae('0x14'));var utils=require(_0x09ae('0x15'));var config=require(_0x09ae('0x16'));var licenseUtil=require(_0x09ae('0x17'));var db=require(_0x09ae('0x18'))['db'];function respondWithStatusCode(_0x1972e5,_0x21cf7a){_0x21cf7a=_0x21cf7a||0xcc;return function(_0x2aa95f){if(_0x2aa95f){return _0x1972e5[_0x09ae('0x19')](_0x21cf7a);}return _0x1972e5[_0x09ae('0x1a')](_0x21cf7a)['end']();};}function respondWithResult(_0x131bfe,_0x347342){_0x347342=_0x347342||0xc8;return function(_0x193337){if(_0x193337){return _0x131bfe[_0x09ae('0x1a')](_0x347342)[_0x09ae('0x1b')](_0x193337);}};}function respondWithFilteredResult(_0x3647da,_0x54737){return function(_0x1f801f){if(_0x1f801f){var _0x538fbf=typeof _0x54737[_0x09ae('0x1c')]===_0x09ae('0x1d')&&typeof _0x54737['limit']===_0x09ae('0x1d');var _0x4e4344=_0x1f801f[_0x09ae('0x1e')];var _0x1d5989=_0x538fbf?0x0:_0x54737[_0x09ae('0x1c')];var _0x508d3a=_0x538fbf?_0x1f801f[_0x09ae('0x1e')]:_0x54737['offset']+_0x54737[_0x09ae('0x1f')];var _0x4d8150;if(_0x508d3a>=_0x4e4344){_0x508d3a=_0x4e4344;_0x4d8150=0xc8;}else{_0x4d8150=0xce;}_0x3647da[_0x09ae('0x1a')](_0x4d8150);return _0x3647da[_0x09ae('0x20')](_0x09ae('0x21'),_0x1d5989+'-'+_0x508d3a+'/'+_0x4e4344)[_0x09ae('0x1b')](_0x1f801f);}return null;};}function patchUpdates(_0x102c11){return function(_0x4fa0ac){try{jsonpatch['apply'](_0x4fa0ac,_0x102c11,!![]);}catch(_0x41d1c1){return BPromise[_0x09ae('0x22')](_0x41d1c1);}return _0x4fa0ac[_0x09ae('0x23')]();};}function saveUpdates(_0x56f9f7,_0x592888){return function(_0x29b7bf){if(_0x29b7bf){return _0x29b7bf[_0x09ae('0x24')](_0x56f9f7)[_0x09ae('0x25')](function(_0x3c8b18){return _0x3c8b18;});}return null;};}function removeEntity(_0x34dcc9,_0x113905){return function(_0x52714f){if(_0x52714f){return _0x52714f[_0x09ae('0x26')]()[_0x09ae('0x25')](function(){_0x34dcc9[_0x09ae('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59885b,_0x590048){return function(_0x25c900){if(!_0x25c900){_0x59885b[_0x09ae('0x19')](0x194);}return _0x25c900;};}function handleError(_0x525b00,_0x4631c5){_0x4631c5=_0x4631c5||0x1f4;return function(_0x38a905){logger[_0x09ae('0x27')](_0x38a905[_0x09ae('0x28')]);if(_0x38a905[_0x09ae('0x29')]){delete _0x38a905[_0x09ae('0x29')];}_0x525b00['status'](_0x4631c5)[_0x09ae('0x2a')](_0x38a905);};}exports['index']=function(_0x561242,_0x1dd75b){var _0x558f59={},_0x31dd9e={},_0x1dce27={'count':0x0,'rows':[]};var _0x15825=_['map'](db[_0x09ae('0x2b')][_0x09ae('0x2c')],function(_0x38b45d){return{'name':_0x38b45d[_0x09ae('0x2d')],'type':_0x38b45d['type']['key']};});_0x31dd9e[_0x09ae('0x2e')]=_['map'](_0x15825,_0x09ae('0x29'));_0x31dd9e[_0x09ae('0x2f')]=_['keys'](_0x561242['query']);_0x31dd9e[_0x09ae('0x30')]=_[_0x09ae('0x31')](_0x31dd9e[_0x09ae('0x2e')],_0x31dd9e[_0x09ae('0x2f')]);_0x558f59[_0x09ae('0x32')]=_[_0x09ae('0x31')](_0x31dd9e['model'],qs['fields'](_0x561242[_0x09ae('0x2f')][_0x09ae('0x33')]));_0x558f59[_0x09ae('0x32')]=_0x558f59[_0x09ae('0x32')]['length']?_0x558f59[_0x09ae('0x32')]:_0x31dd9e[_0x09ae('0x2e')];if(!_0x561242[_0x09ae('0x2f')]['hasOwnProperty'](_0x09ae('0x34'))){_0x558f59[_0x09ae('0x1f')]=qs[_0x09ae('0x1f')](_0x561242[_0x09ae('0x2f')][_0x09ae('0x1f')]);_0x558f59[_0x09ae('0x1c')]=qs['offset'](_0x561242[_0x09ae('0x2f')][_0x09ae('0x1c')]);}_0x558f59[_0x09ae('0x35')]=qs[_0x09ae('0x36')](_0x561242[_0x09ae('0x2f')][_0x09ae('0x36')]);_0x558f59[_0x09ae('0x37')]=qs[_0x09ae('0x30')](_[_0x09ae('0x38')](_0x561242[_0x09ae('0x2f')],_0x31dd9e[_0x09ae('0x30')]),_0x15825);if(_0x561242[_0x09ae('0x2f')][_0x09ae('0x39')]){_0x558f59['where']=_[_0x09ae('0x3a')](_0x558f59[_0x09ae('0x37')],{'$or':_['map'](_0x15825,function(_0x2b9eef){if(_0x2b9eef[_0x09ae('0x3b')]!==_0x09ae('0x3c')){var _0x3ec833={};_0x3ec833[_0x2b9eef['name']]={'$like':'%'+_0x561242[_0x09ae('0x2f')][_0x09ae('0x39')]+'%'};return _0x3ec833;}})});}_0x558f59=_[_0x09ae('0x3a')]({},_0x558f59,_0x561242[_0x09ae('0x3d')]);var _0x5002cf={'where':_0x558f59[_0x09ae('0x37')]};return db[_0x09ae('0x2b')]['count'](_0x5002cf)[_0x09ae('0x25')](function(_0x5bc73f){_0x1dce27[_0x09ae('0x1e')]=_0x5bc73f;if(_0x561242['query'][_0x09ae('0x3e')]){_0x558f59['include']=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x558f59);})[_0x09ae('0x25')](function(_0x34ad7e){_0x1dce27[_0x09ae('0x3f')]=_0x34ad7e;return _0x1dce27;})[_0x09ae('0x25')](respondWithFilteredResult(_0x1dd75b,_0x558f59))[_0x09ae('0x40')](handleError(_0x1dd75b,null));};exports[_0x09ae('0x41')]=function(_0x5a0ca3,_0x17890e){var _0x35c72b={'raw':!![],'where':{'id':_0x5a0ca3[_0x09ae('0x42')]['id']}},_0x1ea2e6={};_0x1ea2e6[_0x09ae('0x2e')]=_[_0x09ae('0x43')](db['SalesforceField'][_0x09ae('0x2c')]);_0x1ea2e6['query']=_['keys'](_0x5a0ca3[_0x09ae('0x2f')]);_0x1ea2e6[_0x09ae('0x30')]=_[_0x09ae('0x31')](_0x1ea2e6[_0x09ae('0x2e')],_0x1ea2e6[_0x09ae('0x2f')]);_0x35c72b[_0x09ae('0x32')]=_['intersection'](_0x1ea2e6[_0x09ae('0x2e')],qs['fields'](_0x5a0ca3[_0x09ae('0x2f')][_0x09ae('0x33')]));_0x35c72b[_0x09ae('0x32')]=_0x35c72b[_0x09ae('0x32')][_0x09ae('0x44')]?_0x35c72b[_0x09ae('0x32')]:_0x1ea2e6['model'];if(_0x5a0ca3[_0x09ae('0x2f')]['includeAll']){_0x35c72b[_0x09ae('0x45')]=[{'all':!![]}];}_0x35c72b=_[_0x09ae('0x3a')]({},_0x35c72b,_0x5a0ca3[_0x09ae('0x3d')]);return db[_0x09ae('0x2b')][_0x09ae('0x46')](_0x35c72b)[_0x09ae('0x25')](handleEntityNotFound(_0x17890e,null))[_0x09ae('0x25')](respondWithResult(_0x17890e,null))[_0x09ae('0x40')](handleError(_0x17890e,null));};exports[_0x09ae('0x47')]=function(_0x1ef66e,_0xd986fb){return db[_0x09ae('0x2b')][_0x09ae('0x47')](_0x1ef66e[_0x09ae('0x48')],{})['then'](respondWithResult(_0xd986fb,0xc9))[_0x09ae('0x40')](handleError(_0xd986fb,null));};exports[_0x09ae('0x24')]=function(_0x505579,_0x149049){if(_0x505579['body']['id']){delete _0x505579[_0x09ae('0x48')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x505579[_0x09ae('0x42')]['id']}})['then'](handleEntityNotFound(_0x149049,null))[_0x09ae('0x25')](saveUpdates(_0x505579[_0x09ae('0x48')],null))[_0x09ae('0x25')](respondWithResult(_0x149049,null))['catch'](handleError(_0x149049,null));};exports[_0x09ae('0x26')]=function(_0x4e098e,_0x57ae49){return db[_0x09ae('0x2b')]['find']({'where':{'id':_0x4e098e[_0x09ae('0x42')]['id']}})['then'](handleEntityNotFound(_0x57ae49,null))['then'](removeEntity(_0x57ae49,null))[_0x09ae('0x40')](handleError(_0x57ae49,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 18f87d2..6cf070f 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 _0xc536=['bluebird','request-promise','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x12291d,_0x5031f4){var _0x10eeb9=function(_0x1df29b){while(--_0x1df29b){_0x12291d['push'](_0x12291d['shift']());}};_0x10eeb9(++_0x5031f4);}(_0xc536,0x174));var _0x6c53=function(_0x5560ba,_0x4ea14b){_0x5560ba=_0x5560ba-0x0;var _0x3f9d6e=_0xc536[_0x5560ba];return _0x3f9d6e;};'use strict';var _=require(_0x6c53('0x0'));var util=require(_0x6c53('0x1'));var logger=require(_0x6c53('0x2'))(_0x6c53('0x3'));var moment=require(_0x6c53('0x4'));var BPromise=require(_0x6c53('0x5'));var rp=require(_0x6c53('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6c53('0x7'));module['exports']=function(_0x2c556c,_0x19fd0c){return _0x2c556c[_0x6c53('0x8')](_0x6c53('0x9'),attributes,{'tableName':_0x6c53('0xa'),'paranoid':![],'indexes':[{'name':_0x6c53('0xb'),'fields':['idField',_0x6c53('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc447=['moment','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','api'];(function(_0x2931d6,_0x3eff03){var _0x288cc9=function(_0x165224){while(--_0x165224){_0x2931d6['push'](_0x2931d6['shift']());}};_0x288cc9(++_0x3eff03);}(_0xc447,0x15d));var _0x7c44=function(_0x184d27,_0x159734){_0x184d27=_0x184d27-0x0;var _0x2a7e2c=_0xc447[_0x184d27];return _0x2a7e2c;};'use strict';var _=require(_0x7c44('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7c44('0x1'));var moment=require(_0x7c44('0x2'));var BPromise=require('bluebird');var rp=require(_0x7c44('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c44('0x4'));var config=require(_0x7c44('0x5'));var attributes=require(_0x7c44('0x6'));module[_0x7c44('0x7')]=function(_0x466488,_0x47a46c){return _0x466488[_0x7c44('0x8')](_0x7c44('0x9'),attributes,{'tableName':_0x7c44('0xa'),'paranoid':![],'indexes':[{'name':_0x7c44('0xb'),'fields':['idField',_0x7c44('0xc')],'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 07b0bed..d1ca6ff 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 _0xb969=['request','request\x20sent','debug','stringify','error','code','message','info','SalesforceField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4cb9d1,_0xedd594){var _0x158fb5=function(_0x4b7b3a){while(--_0x4b7b3a){_0x4cb9d1['push'](_0x4cb9d1['shift']());}};_0x158fb5(++_0xedd594);}(_0xb969,0x6f));var _0x9b96=function(_0x50cb59,_0x168c92){_0x50cb59=_0x50cb59-0x0;var _0x14c732=_0xb969[_0x50cb59];return _0x14c732;};'use strict';var _=require(_0x9b96('0x0'));var util=require(_0x9b96('0x1'));var moment=require(_0x9b96('0x2'));var BPromise=require(_0x9b96('0x3'));var rs=require(_0x9b96('0x4'));var fs=require('fs');var Redis=require(_0x9b96('0x5'));var db=require(_0x9b96('0x6'))['db'];var utils=require(_0x9b96('0x7'));var logger=require(_0x9b96('0x8'))(_0x9b96('0x9'));var config=require(_0x9b96('0xa'));var jayson=require(_0x9b96('0xb'));var client=jayson[_0x9b96('0xc')][_0x9b96('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2a9c61,_0x17531b,_0x156966){return new BPromise(function(_0x2d6eb7,_0x57592e){return client[_0x9b96('0xe')](_0x2a9c61,_0x156966)['then'](function(_0x5d899f){logger['info']('SalesforceField,\x20%s,\x20%s',_0x17531b,_0x9b96('0xf'));logger[_0x9b96('0x10')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x17531b,_0x9b96('0xf'),JSON[_0x9b96('0x11')](_0x5d899f));if(_0x5d899f[_0x9b96('0x12')]){if(_0x5d899f[_0x9b96('0x12')][_0x9b96('0x13')]===0x1f4){logger[_0x9b96('0x12')]('SalesforceField,\x20%s,\x20%s',_0x17531b,_0x5d899f[_0x9b96('0x12')][_0x9b96('0x14')]);return _0x57592e(_0x5d899f[_0x9b96('0x12')][_0x9b96('0x14')]);}logger[_0x9b96('0x12')]('SalesforceField,\x20%s,\x20%s',_0x17531b,_0x5d899f['error'][_0x9b96('0x14')]);return _0x2d6eb7(_0x5d899f[_0x9b96('0x12')][_0x9b96('0x14')]);}else{logger[_0x9b96('0x15')](_0x9b96('0x16'),_0x17531b,'request\x20sent');_0x2d6eb7(_0x5d899f[_0x9b96('0x17')]['message']);}})[_0x9b96('0x18')](function(_0x4c566f){logger[_0x9b96('0x12')]('SalesforceField,\x20%s,\x20%s',_0x17531b,_0x4c566f);_0x57592e(_0x4c566f);});});} \ No newline at end of file +var _0x5b3a=['SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5b83b1,_0x3d175a){var _0x1ddca1=function(_0x3a2de4){while(--_0x3a2de4){_0x5b83b1['push'](_0x5b83b1['shift']());}};_0x1ddca1(++_0x3d175a);}(_0x5b3a,0x1c3));var _0xa5b3=function(_0x26114b,_0x32e6d2){_0x26114b=_0x26114b-0x0;var _0x1bdf60=_0x5b3a[_0x26114b];return _0x1bdf60;};'use strict';var _=require(_0xa5b3('0x0'));var util=require(_0xa5b3('0x1'));var moment=require(_0xa5b3('0x2'));var BPromise=require(_0xa5b3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5b3('0x4'));var db=require(_0xa5b3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa5b3('0x6'))(_0xa5b3('0x7'));var config=require(_0xa5b3('0x8'));var jayson=require(_0xa5b3('0x9'));var client=jayson[_0xa5b3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20cfb2,_0x3d92c5,_0x12fd1f){return new BPromise(function(_0x2b1370,_0x4d0879){return client['request'](_0x20cfb2,_0x12fd1f)['then'](function(_0x38fadc){logger['info'](_0xa5b3('0xb'),_0x3d92c5,_0xa5b3('0xc'));logger[_0xa5b3('0xd')](_0xa5b3('0xe'),_0x3d92c5,_0xa5b3('0xc'),JSON[_0xa5b3('0xf')](_0x38fadc));if(_0x38fadc[_0xa5b3('0x10')]){if(_0x38fadc[_0xa5b3('0x10')][_0xa5b3('0x11')]===0x1f4){logger[_0xa5b3('0x10')](_0xa5b3('0xb'),_0x3d92c5,_0x38fadc[_0xa5b3('0x10')]['message']);return _0x4d0879(_0x38fadc[_0xa5b3('0x10')][_0xa5b3('0x12')]);}logger[_0xa5b3('0x10')](_0xa5b3('0xb'),_0x3d92c5,_0x38fadc['error'][_0xa5b3('0x12')]);return _0x2b1370(_0x38fadc[_0xa5b3('0x10')][_0xa5b3('0x12')]);}else{logger[_0xa5b3('0x13')]('SalesforceField,\x20%s,\x20%s',_0x3d92c5,_0xa5b3('0xc'));_0x2b1370(_0x38fadc[_0xa5b3('0x14')][_0xa5b3('0x12')]);}})[_0xa5b3('0x15')](function(_0x4cd253){logger[_0xa5b3('0x10')](_0xa5b3('0xb'),_0x3d92c5,_0x4cd253);_0x4d0879(_0x4cd253);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index c7fa2ff..a03729f 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 _0xc7ea=['../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x3d0193,_0x122288){var _0x3bdef0=function(_0x3dd164){while(--_0x3dd164){_0x3d0193['push'](_0x3d0193['shift']());}};_0x3bdef0(++_0x122288);}(_0xc7ea,0x171));var _0xac7e=function(_0x369458,_0x1d7188){_0x369458=_0x369458-0x0;var _0x5266f9=_0xc7ea[_0x369458];return _0x5266f9;};'use strict';var multer=require(_0xac7e('0x0'));var util=require(_0xac7e('0x1'));var path=require('path');var timeout=require(_0xac7e('0x2'));var express=require(_0xac7e('0x3'));var router=express[_0xac7e('0x4')]();var fs_extra=require(_0xac7e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xac7e('0x6'));var config=require(_0xac7e('0x7'));var controller=require(_0xac7e('0x8'));router[_0xac7e('0x9')]('/',auth[_0xac7e('0xa')](),controller[_0xac7e('0xb')]);router[_0xac7e('0x9')](_0xac7e('0xc'),auth[_0xac7e('0xa')](),controller[_0xac7e('0xd')]);router['get'](_0xac7e('0xe'),auth[_0xac7e('0xa')](),controller[_0xac7e('0xf')]);router[_0xac7e('0x9')](_0xac7e('0x10'),auth[_0xac7e('0xa')](),controller[_0xac7e('0x11')]);router[_0xac7e('0x12')]('/',auth[_0xac7e('0xa')](),controller[_0xac7e('0x13')]);router[_0xac7e('0x12')](_0xac7e('0xe'),auth['isAuthenticated'](),controller[_0xac7e('0x14')]);router[_0xac7e('0x15')]('/:id',auth[_0xac7e('0xa')](),controller[_0xac7e('0x16')]);router[_0xac7e('0x17')](_0xac7e('0xc'),auth[_0xac7e('0xa')](),controller['destroy']);module[_0xac7e('0x18')]=router; \ No newline at end of file +var _0xbb50=['addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x298597,_0x2e839d){var _0x4a92e4=function(_0x31050b){while(--_0x31050b){_0x298597['push'](_0x298597['shift']());}};_0x4a92e4(++_0x2e839d);}(_0xbb50,0x11b));var _0x0bb5=function(_0x2dae0c,_0x3b578c){_0x2dae0c=_0x2dae0c-0x0;var _0x36c35b=_0xbb50[_0x2dae0c];return _0x36c35b;};'use strict';var multer=require(_0x0bb5('0x0'));var util=require(_0x0bb5('0x1'));var path=require(_0x0bb5('0x2'));var timeout=require(_0x0bb5('0x3'));var express=require(_0x0bb5('0x4'));var router=express['Router']();var fs_extra=require(_0x0bb5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0bb5('0x6'));var config=require('../../config/environment');var controller=require(_0x0bb5('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0bb5('0x8')]('/:id',auth[_0x0bb5('0x9')](),controller[_0x0bb5('0xa')]);router[_0x0bb5('0x8')]('/:id/configurations',auth[_0x0bb5('0x9')](),controller[_0x0bb5('0xb')]);router[_0x0bb5('0x8')](_0x0bb5('0xc'),auth[_0x0bb5('0x9')](),controller[_0x0bb5('0xd')]);router[_0x0bb5('0xe')]('/',auth[_0x0bb5('0x9')](),controller[_0x0bb5('0xf')]);router[_0x0bb5('0xe')]('/:id/configurations',auth[_0x0bb5('0x9')](),controller[_0x0bb5('0x10')]);router[_0x0bb5('0x11')](_0x0bb5('0x12'),auth[_0x0bb5('0x9')](),controller[_0x0bb5('0x13')]);router[_0x0bb5('0x14')](_0x0bb5('0x12'),auth['isAuthenticated'](),controller[_0x0bb5('0x15')]);module[_0x0bb5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 5474321..fe74294 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 _0x8d97=['STRING','username','remoteUri','sequelize','exports'];(function(_0x5b5517,_0x4782e0){var _0xd6cae5=function(_0x1421c5){while(--_0x1421c5){_0x5b5517['push'](_0x5b5517['shift']());}};_0xd6cae5(++_0x4782e0);}(_0x8d97,0x17a));var _0x78d9=function(_0x596954,_0x4ccc92){_0x596954=_0x596954-0x0;var _0xebee58=_0x8d97[_0x596954];return _0xebee58;};'use strict';var Sequelize=require(_0x78d9('0x0'));module[_0x78d9('0x1')]={'name':{'type':Sequelize[_0x78d9('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x78d9('0x2')],'unique':_0x78d9('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x78d9('0x2')]},'remoteUri':{'type':Sequelize[_0x78d9('0x2')],'unique':_0x78d9('0x4')},'serverUrl':{'type':Sequelize[_0x78d9('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0329=['sequelize','exports','STRING','remoteUri'];(function(_0x566db6,_0x15baaa){var _0x56c315=function(_0x292cd6){while(--_0x292cd6){_0x566db6['push'](_0x566db6['shift']());}};_0x56c315(++_0x15baaa);}(_0x0329,0xe4));var _0x9032=function(_0x4424d7,_0x518a2c){_0x4424d7=_0x4424d7-0x0;var _0x513d98=_0x0329[_0x4424d7];return _0x513d98;};'use strict';var Sequelize=require(_0x9032('0x0'));module[_0x9032('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9032('0x2')]},'username':{'type':Sequelize[_0x9032('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9032('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x9032('0x3')},'serverUrl':{'type':Sequelize[_0x9032('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 71dce64..549cf68 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 _0x245e=['contact_type','urgency','reassignment_count','comments','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','username','password','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','all','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','test','statusCode','Wrong\x20credentials','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','ServicenowAccount','includeAll','include','findAll','rows','show','params','length','catch','create','body','getConfigurations','findOne','ServicenowConfiguration','rawAttributes','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','subcategory','close_code','notify','severity','category','watch_list','sys_updated_on','hold_reason','approval_history','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','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','resolved_at','approval_set','short_description','delivery_task','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','follow_up','parent_incident','sys_id'];(function(_0x2aeb09,_0x3f9309){var _0x1146ef=function(_0x34a3c0){while(--_0x34a3c0){_0x2aeb09['push'](_0x2aeb09['shift']());}};_0x1146ef(++_0x3f9309);}(_0x245e,0x191));var _0xe245=function(_0x21ee4f,_0x2a5d70){_0x21ee4f=_0x21ee4f-0x0;var _0x240c1b=_0x245e[_0x21ee4f];return _0x240c1b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe245('0x0'));var zipdir=require(_0xe245('0x1'));var jsonpatch=require(_0xe245('0x2'));var rp=require('request-promise');var moment=require(_0xe245('0x3'));var BPromise=require(_0xe245('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe245('0x5'));var csv=require(_0xe245('0x6'));var ejs=require(_0xe245('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe245('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe245('0x9'));var deskjs=require(_0xe245('0xa'));var toCsv=require(_0xe245('0x6'));var querystring=require(_0xe245('0xb'));var Papa=require(_0xe245('0xc'));var Redis=require(_0xe245('0xd'));var authService=require(_0xe245('0xe'));var qs=require(_0xe245('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe245('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe245('0x11'));var db=require(_0xe245('0x12'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x23e8e7,_0x1611fd){_0x1611fd=_0x1611fd||0xcc;return function(_0x24d530){if(_0x24d530){return _0x23e8e7[_0xe245('0x13')](_0x1611fd);}return _0x23e8e7[_0xe245('0x14')](_0x1611fd)[_0xe245('0x15')]();};}function respondWithResult(_0x2fe4f1,_0x30f967){_0x30f967=_0x30f967||0xc8;return function(_0x5a5551){if(_0x5a5551){return _0x2fe4f1['status'](_0x30f967)[_0xe245('0x16')](_0x5a5551);}};}function respondWithFilteredResult(_0x21f7ff,_0x3f6388){return function(_0x136480){if(_0x136480){var _0x473458=typeof _0x3f6388['offset']==='undefined'&&typeof _0x3f6388[_0xe245('0x17')]===_0xe245('0x18');var _0x55fbe6=_0x136480[_0xe245('0x19')];var _0x556504=_0x473458?0x0:_0x3f6388[_0xe245('0x1a')];var _0x2854f9=_0x473458?_0x136480[_0xe245('0x19')]:_0x3f6388[_0xe245('0x1a')]+_0x3f6388[_0xe245('0x17')];var _0x3b3101;if(_0x2854f9>=_0x55fbe6){_0x2854f9=_0x55fbe6;_0x3b3101=0xc8;}else{_0x3b3101=0xce;}_0x21f7ff[_0xe245('0x14')](_0x3b3101);return _0x21f7ff[_0xe245('0x1b')](_0xe245('0x1c'),_0x556504+'-'+_0x2854f9+'/'+_0x55fbe6)['json'](_0x136480);}return null;};}function patchUpdates(_0x442a60){return function(_0x12bd98){try{jsonpatch[_0xe245('0x1d')](_0x12bd98,_0x442a60,!![]);}catch(_0xc4fdeb){return BPromise[_0xe245('0x1e')](_0xc4fdeb);}return _0x12bd98[_0xe245('0x1f')]();};}function saveUpdates(_0x14bdeb,_0x4b18df){return function(_0x269fb1){if(_0x269fb1){return _0x269fb1[_0xe245('0x20')](_0x14bdeb)[_0xe245('0x21')](function(_0x2071a2){return _0x2071a2;});}return null;};}function removeEntity(_0x5bb738,_0x1596bf){return function(_0x3f52a2){if(_0x3f52a2){return _0x3f52a2[_0xe245('0x22')]()['then'](function(){_0x5bb738[_0xe245('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x160f3d,_0x3166a2){return function(_0x5af630){if(!_0x5af630){_0x160f3d['sendStatus'](0x194);}return _0x5af630;};}function handleError(_0x114742,_0x3ba13d){_0x3ba13d=_0x3ba13d||0x1f4;return function(_0x9b1e31){logger[_0xe245('0x23')](_0x9b1e31[_0xe245('0x24')]);if(_0x9b1e31[_0xe245('0x25')]){delete _0x9b1e31['name'];}_0x114742['status'](_0x3ba13d)[_0xe245('0x26')](_0x9b1e31);};}exports[_0xe245('0x27')]=function(_0xb34328,_0x5b55d3){var _0x5427d8={},_0x9fd9db={},_0x27b209={'count':0x0,'rows':[]};var _0x3c3b30=_[_0xe245('0x28')](db['ServicenowAccount']['rawAttributes'],function(_0x2078d8){return{'name':_0x2078d8[_0xe245('0x29')],'type':_0x2078d8['type'][_0xe245('0x2a')]};});_0x9fd9db[_0xe245('0x2b')]=_['map'](_0x3c3b30,_0xe245('0x25'));_0x9fd9db[_0xe245('0x2c')]=_[_0xe245('0x2d')](_0xb34328[_0xe245('0x2c')]);_0x9fd9db[_0xe245('0x2e')]=_[_0xe245('0x2f')](_0x9fd9db[_0xe245('0x2b')],_0x9fd9db[_0xe245('0x2c')]);_0x5427d8[_0xe245('0x30')]=_[_0xe245('0x2f')](_0x9fd9db[_0xe245('0x2b')],qs[_0xe245('0x31')](_0xb34328[_0xe245('0x2c')][_0xe245('0x31')]));_0x5427d8[_0xe245('0x30')]=_0x5427d8['attributes']['length']?_0x5427d8[_0xe245('0x30')]:_0x9fd9db[_0xe245('0x2b')];if(!_0xb34328['query'][_0xe245('0x32')](_0xe245('0x33'))){_0x5427d8['limit']=qs['limit'](_0xb34328['query'][_0xe245('0x17')]);_0x5427d8['offset']=qs[_0xe245('0x1a')](_0xb34328[_0xe245('0x2c')]['offset']);}_0x5427d8[_0xe245('0x34')]=qs[_0xe245('0x35')](_0xb34328[_0xe245('0x2c')]['sort']);_0x5427d8['where']=qs[_0xe245('0x2e')](_[_0xe245('0x36')](_0xb34328[_0xe245('0x2c')],_0x9fd9db[_0xe245('0x2e')]),_0x3c3b30);if(_0xb34328[_0xe245('0x2c')][_0xe245('0x37')]){_0x5427d8[_0xe245('0x38')]=_['merge'](_0x5427d8[_0xe245('0x38')],{'$or':_['map'](_0x3c3b30,function(_0x5879df){if(_0x5879df[_0xe245('0x39')]!==_0xe245('0x3a')){var _0x209455={};_0x209455[_0x5879df['name']]={'$like':'%'+_0xb34328[_0xe245('0x2c')][_0xe245('0x37')]+'%'};return _0x209455;}})});}_0x5427d8=_[_0xe245('0x3b')]({},_0x5427d8,_0xb34328[_0xe245('0x3c')]);var _0x396371={'where':_0x5427d8['where']};return db[_0xe245('0x3d')][_0xe245('0x19')](_0x396371)[_0xe245('0x21')](function(_0x53c173){_0x27b209['count']=_0x53c173;if(_0xb34328[_0xe245('0x2c')][_0xe245('0x3e')]){_0x5427d8[_0xe245('0x3f')]=[{'all':!![]}];}return db[_0xe245('0x3d')][_0xe245('0x40')](_0x5427d8);})[_0xe245('0x21')](function(_0x207434){_0x27b209[_0xe245('0x41')]=_0x207434;return _0x27b209;})['then'](respondWithFilteredResult(_0x5b55d3,_0x5427d8))['catch'](handleError(_0x5b55d3,null));};exports[_0xe245('0x42')]=function(_0x1902b2,_0x4c5dcd){var _0x7cc78b={'raw':![],'where':{'id':_0x1902b2[_0xe245('0x43')]['id']}},_0x3978d={};_0x3978d[_0xe245('0x2b')]=_['keys'](db[_0xe245('0x3d')]['rawAttributes']);_0x3978d['query']=_[_0xe245('0x2d')](_0x1902b2['query']);_0x3978d[_0xe245('0x2e')]=_['intersection'](_0x3978d[_0xe245('0x2b')],_0x3978d['query']);_0x7cc78b['attributes']=_['intersection'](_0x3978d[_0xe245('0x2b')],qs[_0xe245('0x31')](_0x1902b2[_0xe245('0x2c')][_0xe245('0x31')]));_0x7cc78b[_0xe245('0x30')]=_0x7cc78b[_0xe245('0x30')][_0xe245('0x44')]?_0x7cc78b[_0xe245('0x30')]:_0x3978d[_0xe245('0x2b')];if(_0x1902b2[_0xe245('0x2c')][_0xe245('0x3e')]){_0x7cc78b[_0xe245('0x3f')]=[{'all':!![]}];}_0x7cc78b=_[_0xe245('0x3b')]({},_0x7cc78b,_0x1902b2[_0xe245('0x3c')]);return db[_0xe245('0x3d')]['find'](_0x7cc78b)[_0xe245('0x21')](handleEntityNotFound(_0x4c5dcd,null))[_0xe245('0x21')](respondWithResult(_0x4c5dcd,null))[_0xe245('0x45')](handleError(_0x4c5dcd,null));};exports[_0xe245('0x46')]=function(_0x2d3cac,_0x1894ac){return db[_0xe245('0x3d')][_0xe245('0x46')](_0x2d3cac[_0xe245('0x47')],{})['then'](respondWithResult(_0x1894ac,0xc9))[_0xe245('0x45')](handleError(_0x1894ac,null));};exports[_0xe245('0x20')]=function(_0xa4dd22,_0x5eb158){if(_0xa4dd22[_0xe245('0x47')]['id']){delete _0xa4dd22[_0xe245('0x47')]['id'];}return db[_0xe245('0x3d')]['find']({'where':{'id':_0xa4dd22['params']['id']}})[_0xe245('0x21')](handleEntityNotFound(_0x5eb158,null))[_0xe245('0x21')](saveUpdates(_0xa4dd22[_0xe245('0x47')],null))[_0xe245('0x21')](respondWithResult(_0x5eb158,null))[_0xe245('0x45')](handleError(_0x5eb158,null));};exports['destroy']=function(_0x5f5d1d,_0x32b727){return db[_0xe245('0x3d')]['find']({'where':{'id':_0x5f5d1d['params']['id']}})['then'](handleEntityNotFound(_0x32b727,null))['then'](removeEntity(_0x32b727,null))['catch'](handleError(_0x32b727,null));};exports[_0xe245('0x48')]=function(_0x32b459,_0x293348,_0x262ef0){var _0x149f26={};var _0x539a82={};var _0x27327e;var _0x4420d7;return db[_0xe245('0x3d')][_0xe245('0x49')]({'where':{'id':_0x32b459[_0xe245('0x43')]['id']}})[_0xe245('0x21')](handleEntityNotFound(_0x293348,null))[_0xe245('0x21')](function(_0x12af1e){if(_0x12af1e){_0x27327e=_0x12af1e;_0x539a82[_0xe245('0x2b')]=_[_0xe245('0x2d')](db[_0xe245('0x4a')][_0xe245('0x4b')]);_0x539a82[_0xe245('0x2c')]=_['keys'](_0x32b459[_0xe245('0x2c')]);_0x539a82['filters']=_[_0xe245('0x2f')](_0x539a82['model'],_0x539a82[_0xe245('0x2c')]);_0x149f26[_0xe245('0x30')]=_['intersection'](_0x539a82[_0xe245('0x2b')],qs[_0xe245('0x31')](_0x32b459['query'][_0xe245('0x31')]));_0x149f26[_0xe245('0x30')]=_0x149f26[_0xe245('0x30')][_0xe245('0x44')]?_0x149f26[_0xe245('0x30')]:_0x539a82['model'];_0x149f26[_0xe245('0x34')]=qs['sort'](_0x32b459[_0xe245('0x2c')][_0xe245('0x35')]);_0x149f26['where']=qs[_0xe245('0x2e')](_[_0xe245('0x36')](_0x32b459['query'],_0x539a82['filters']));if(_0x32b459['query']['filter']){_0x149f26['where']=_[_0xe245('0x3b')](_0x149f26[_0xe245('0x38')],{'$or':_[_0xe245('0x28')](_0x149f26[_0xe245('0x30')],function(_0x28abc2){var _0x1514f0={};_0x1514f0[_0x28abc2]={'$like':'%'+_0x32b459[_0xe245('0x2c')]['filter']+'%'};return _0x1514f0;})});}_0x149f26=_[_0xe245('0x3b')]({},_0x149f26,_0x32b459[_0xe245('0x3c')]);return _0x27327e[_0xe245('0x48')](_0x149f26);}})[_0xe245('0x21')](function(_0x145f23){if(_0x145f23){_0x4420d7=_0x145f23['length'];if(!_0x32b459[_0xe245('0x2c')]['hasOwnProperty'](_0xe245('0x33'))){_0x149f26[_0xe245('0x17')]=qs[_0xe245('0x17')](_0x32b459[_0xe245('0x2c')][_0xe245('0x17')]);_0x149f26[_0xe245('0x1a')]=qs['offset'](_0x32b459['query'][_0xe245('0x1a')]);}return _0x27327e[_0xe245('0x48')](_0x149f26);}})[_0xe245('0x21')](function(_0x1dc350){if(_0x1dc350){return _0x1dc350?{'count':_0x4420d7,'rows':_0x1dc350}:null;}})[_0xe245('0x21')](respondWithResult(_0x293348,null))[_0xe245('0x45')](handleError(_0x293348,null));};exports[_0xe245('0x4c')]=function(_0x28f8ca,_0x18895a,_0xd86019){if(_0x28f8ca[_0xe245('0x47')]['id']){delete _0x28f8ca['body']['id'];}return db['ServicenowAccount'][_0xe245('0x49')]({'where':{'id':_0x28f8ca[_0xe245('0x43')]['id']}})[_0xe245('0x21')](handleEntityNotFound(_0x18895a,null))['then'](function(_0x5021b1){if(_0x5021b1){_0x28f8ca[_0xe245('0x47')][_0xe245('0x4d')]=_0x5021b1['id'];_0x28f8ca[_0xe245('0x47')][_0xe245('0x4e')]=integrations[_0xe245('0x4f')](_0x28f8ca['body']['channel'],_0x28f8ca[_0xe245('0x47')][_0xe245('0x39')]);_0x28f8ca[_0xe245('0x47')][_0xe245('0x50')]=integrations[_0xe245('0x51')](_0x28f8ca['body'][_0xe245('0x52')],_0x28f8ca[_0xe245('0x47')][_0xe245('0x39')]);return db[_0xe245('0x4a')][_0xe245('0x46')](_0x28f8ca['body'],{'include':[{'model':db[_0xe245('0x53')],'as':_0xe245('0x4e')},{'model':db[_0xe245('0x53')],'as':_0xe245('0x50')}]});}return null;})[_0xe245('0x21')](respondWithResult(_0x18895a,null))[_0xe245('0x45')](handleError(_0x18895a,null));};exports[_0xe245('0x54')]=function(_0x170438,_0x4a34d6,_0x1498e9){var _0x34ec3f=[_0xe245('0x55'),'hold_reason','knowledge',_0xe245('0x56'),_0xe245('0x57'),_0xe245('0x58'),'incident_state',_0xe245('0x59'),_0xe245('0x5a')];var _0x318ae2=['parent',_0xe245('0x55'),'caused_by',_0xe245('0x5b'),'upon_reject',_0xe245('0x5c'),'child_incidents',_0xe245('0x5d'),_0xe245('0x5e'),_0xe245('0x5f'),_0xe245('0x60'),_0xe245('0x61'),_0xe245('0x62'),_0xe245('0x63'),_0xe245('0x64'),_0xe245('0x65'),_0xe245('0x66'),_0xe245('0x67'),_0xe245('0x68'),_0xe245('0x34'),_0xe245('0x69'),_0xe245('0x6a'),_0xe245('0x6b'),_0xe245('0x6c'),_0xe245('0x6d'),'active',_0xe245('0x6e'),_0xe245('0x6f'),_0xe245('0x70'),_0xe245('0x71'),_0xe245('0x72'),_0xe245('0x73'),_0xe245('0x74'),_0xe245('0x75'),_0xe245('0x76'),_0xe245('0x77'),_0xe245('0x78'),'reopened_time',_0xe245('0x79'),'caller_id',_0xe245('0x7a'),_0xe245('0x56'),'work_notes',_0xe245('0x7b'),_0xe245('0x57'),'correlation_display',_0xe245('0x7c'),'work_start',_0xe245('0x7d'),_0xe245('0x7e'),_0xe245('0x7f'),_0xe245('0x80'),'calendar_duration','notify',_0xe245('0x81'),'close_notes','closed_by',_0xe245('0x82'),_0xe245('0x83'),_0xe245('0x84'),_0xe245('0x85'),'reopened_by','incident_state',_0xe245('0x86'),'problem_id','company',_0xe245('0x87'),'activity_due','assigned_to',_0xe245('0x59'),_0xe245('0x88'),'sla_due','approval',_0xe245('0x89'),_0xe245('0x8a'),_0xe245('0x8b'),_0xe245('0x8c'),_0xe245('0x8d'),'escalation',_0xe245('0x8e'),_0xe245('0x8f'),_0xe245('0x90'),_0xe245('0x5a')];var _0x2dac18='';var _0x5e3c9c='';var _0x1e6a62=[];var _0x38ff15='';var _0x16fea7='';var _0x6c03c6=[];var _0x204516='';var _0x27f53d='';var _0x3f1432={};var _0x358cf0='';return db[_0xe245('0x3d')][_0xe245('0x49')]({'where':{'id':_0x170438[_0xe245('0x43')]['id']},'attributes':['id',_0xe245('0x91'),_0xe245('0x92'),'email',_0xe245('0x93'),_0xe245('0x94')]})[_0xe245('0x21')](handleEntityNotFound(_0x4a34d6,null))['then'](function(_0x5a5e51){if(_0x5a5e51){_0x358cf0=_0x5a5e51[_0xe245('0x93')];var _0x1870b3=_0x358cf0[_0xe245('0x95')](-0x1);if(_0x1870b3==='/'){_0x358cf0=_0x358cf0[_0xe245('0x96')](0x0,_0x358cf0['lastIndexOf'](_0x1870b3));}_0x27f53d=util[_0xe245('0x97')](_0xe245('0x98'),_0x358cf0);_0x204516=util[_0xe245('0x97')](_0xe245('0x99'),_0x358cf0);_0x3f1432={'user':_0x5a5e51['username'],'pass':_0x5a5e51['password']};var _0x15d2e9={'method':_0xe245('0x9a'),'uri':_0x27f53d+_0xe245('0x9b'),'auth':_0x3f1432,'json':!![]};return rp(_0x15d2e9);}})[_0xe245('0x21')](function(_0x307c89){if(_0x307c89[_0xe245('0x9c')]['length']>0x0){_0x2dac18=_0x307c89['result'];}console[_0xe245('0x9d')](_0xe245('0x9e'),_0x2dac18);_0x6c03c6=[];_0x5e3c9c=Object[_0xe245('0x9f')]([],_0x2dac18);_['remove'](_0x5e3c9c,function(_0x1e7580){return!_0x34ec3f[_0xe245('0xa0')](_0x1e7580[_0xe245('0x25')]);});_0x5e3c9c[_0xe245('0xa1')](function(_0x397202){var _0x537220=createFieldObject(_0x204516,_0x3f1432,_0x397202[_0xe245('0xa2')],_0x397202[_0xe245('0x25')],_0x397202[_0xe245('0xa3')],![]);_0x6c03c6[_0xe245('0xa4')](_0x537220);});return Promise[_0xe245('0xa5')](_0x6c03c6);})['then'](function(_0x3f3164){_0x1e6a62=_0x3f3164;_0x38ff15=Object[_0xe245('0x9f')]([],_0x2dac18);console[_0xe245('0x9d')]('TCL:\x20_object',_0x2dac18);_[_0xe245('0xa6')](_0x38ff15,function(_0x4487d2){return _0x318ae2[_0xe245('0xa0')](_0x4487d2[_0xe245('0x25')]);});console[_0xe245('0x9d')](_0xe245('0xa7'),_0x38ff15);_0x6c03c6=[];_0x38ff15[_0xe245('0xa1')](function(_0x48e2f9){var _0x232683=createFieldObject(_0x204516,_0x3f1432,_0x48e2f9[_0xe245('0xa2')],_0x48e2f9[_0xe245('0x25')],_0x48e2f9[_0xe245('0xa3')],!![]);_0x6c03c6[_0xe245('0xa4')](_0x232683);});return Promise[_0xe245('0xa5')](_0x6c03c6);})[_0xe245('0x21')](function(_0x1b5940){_0x16fea7=_0x1b5940;var _0x340c70=_0x1e6a62[_0xe245('0xa8')](_0x16fea7);return{'count':_0x340c70[_0xe245('0x44')],'rows':_0x340c70};})[_0xe245('0x21')](respondWithResult(_0x4a34d6,null))[_0xe245('0x45')](function(_0x8d985a){console[_0xe245('0x9d')]('ServiceNow\x20error:\x20'+_0x8d985a);var _0x5bce81=_0x170438[_0xe245('0x2c')][_0xe245('0xa9')]?0x1f4:_0x8d985a[_0xe245('0xaa')]||0x1f4;logger[_0xe245('0x23')](_0x8d985a['stack']);delete _0x8d985a[_0xe245('0x25')];if(_0x5bce81===0x191){_0x5bce81=0x190;}_0x4a34d6[_0xe245('0x14')](_0x5bce81)[_0xe245('0x26')](_0x170438['query'][_0xe245('0xa9')]?{'message':_0xe245('0xab'),'statusCode':_0x8d985a['statusCode']}:_0x8d985a);});};function createFieldObject(_0x598aa8,_0x233c3a,_0x4d7466,_0x44a3ad,_0xa7e378,_0x4cf6da){return new Promise(function(_0x4d2e05,_0x33e5ef){var _0x5d9db={'id':_0x44a3ad,'name':_0xa7e378,'custom':_0x4cf6da};if(_0x4d7466===_0xe245('0xac')){_0x5d9db[_0xe245('0x3c')]=[{'name':'True','value':_0xe245('0xad')},{'name':_0xe245('0xae'),'value':_0xe245('0xaf')}];_0x4d2e05(_0x5d9db);}else{var _0x21445e={'method':_0xe245('0x9a'),'uri':_0x598aa8+_0xe245('0xb0')+_0x44a3ad,'auth':_0x233c3a,'json':!![]};return rp(_0x21445e)['then'](function(_0x531bec){var _0x289569=[];if(_0x531bec['result'][_0xe245('0x44')]>0x0){_0x531bec[_0xe245('0x9c')][_0xe245('0xa1')](function(_0x4b3ba8){if(_0x4b3ba8[_0xe245('0xb1')]==='false'){var _0x47abe7={'name':_0x4b3ba8[_0xe245('0xa3')],'value':_0x4b3ba8['value']};_0x289569[_0xe245('0xa4')](_0x47abe7);}});}_0x5d9db['options']=_0x289569;if(_0x5d9db['options'][_0xe245('0x44')]>0x0){_0x4d2e05(_0x5d9db);}else{if(_0x4cf6da==![]){_0x4d2e05();}else{_0x4d2e05(_0x5d9db);}}});}});} \ No newline at end of file +var _0x3bea=['sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','ServicenowAccount','includeAll','findAll','rows','show','params','catch','create','body','find','getConfigurations','findOne','length','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','parent','caused_by','upon_reject','sys_updated_on','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','work_notes','short_description','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','sys_class_name','close_notes','follow_up','parent_incident','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','escalation','correlation_id','category','username','password','email','remoteUri','serverUrl','slice','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','forEach','internalType','label','push','all','assign','TCL:\x20_object','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','True','False','false'];(function(_0x1408e4,_0x77fddf){var _0x32f115=function(_0xe916b8){while(--_0xe916b8){_0x1408e4['push'](_0x1408e4['shift']());}};_0x32f115(++_0x77fddf);}(_0x3bea,0xb4));var _0xa3be=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x3bea[_0x580576];return _0x3f55a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa3be('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa3be('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa3be('0x2'));var path=require(_0xa3be('0x3'));var sox=require(_0xa3be('0x4'));var csv=require(_0xa3be('0x5'));var ejs=require(_0xa3be('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa3be('0x7'));var squel=require(_0xa3be('0x8'));var crypto=require(_0xa3be('0x9'));var jsforce=require(_0xa3be('0xa'));var deskjs=require(_0xa3be('0xb'));var toCsv=require(_0xa3be('0x5'));var querystring=require(_0xa3be('0xc'));var Papa=require(_0xa3be('0xd'));var Redis=require(_0xa3be('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa3be('0xf'));var as=require(_0xa3be('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3be('0x11'))('api');var utils=require(_0xa3be('0x12'));var config=require(_0xa3be('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa3be('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x14bbd6,_0x42207e){_0x42207e=_0x42207e||0xcc;return function(_0x1d4988){if(_0x1d4988){return _0x14bbd6[_0xa3be('0x15')](_0x42207e);}return _0x14bbd6['status'](_0x42207e)[_0xa3be('0x16')]();};}function respondWithResult(_0xf3e6ed,_0x326a10){_0x326a10=_0x326a10||0xc8;return function(_0x22920a){if(_0x22920a){return _0xf3e6ed[_0xa3be('0x17')](_0x326a10)[_0xa3be('0x18')](_0x22920a);}};}function respondWithFilteredResult(_0x7dbc3f,_0x51267d){return function(_0x29dff4){if(_0x29dff4){var _0x141deb=typeof _0x51267d[_0xa3be('0x19')]==='undefined'&&typeof _0x51267d[_0xa3be('0x1a')]===_0xa3be('0x1b');var _0x2ac363=_0x29dff4[_0xa3be('0x1c')];var _0x370675=_0x141deb?0x0:_0x51267d[_0xa3be('0x19')];var _0x355130=_0x141deb?_0x29dff4[_0xa3be('0x1c')]:_0x51267d[_0xa3be('0x19')]+_0x51267d[_0xa3be('0x1a')];var _0x178707;if(_0x355130>=_0x2ac363){_0x355130=_0x2ac363;_0x178707=0xc8;}else{_0x178707=0xce;}_0x7dbc3f[_0xa3be('0x17')](_0x178707);return _0x7dbc3f[_0xa3be('0x1d')](_0xa3be('0x1e'),_0x370675+'-'+_0x355130+'/'+_0x2ac363)[_0xa3be('0x18')](_0x29dff4);}return null;};}function patchUpdates(_0x150d60){return function(_0x2ed791){try{jsonpatch[_0xa3be('0x1f')](_0x2ed791,_0x150d60,!![]);}catch(_0x5c9ecf){return BPromise[_0xa3be('0x20')](_0x5c9ecf);}return _0x2ed791[_0xa3be('0x21')]();};}function saveUpdates(_0x1211e2,_0x15b494){return function(_0x3c8d8a){if(_0x3c8d8a){return _0x3c8d8a['update'](_0x1211e2)[_0xa3be('0x22')](function(_0x2961f8){return _0x2961f8;});}return null;};}function removeEntity(_0x4841aa,_0x66baf5){return function(_0x242c8d){if(_0x242c8d){return _0x242c8d[_0xa3be('0x23')]()['then'](function(){_0x4841aa[_0xa3be('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa2bec6,_0x1f70e3){return function(_0x544da5){if(!_0x544da5){_0xa2bec6['sendStatus'](0x194);}return _0x544da5;};}function handleError(_0x322153,_0x2c89d0){_0x2c89d0=_0x2c89d0||0x1f4;return function(_0x4c261a){logger['error'](_0x4c261a[_0xa3be('0x24')]);if(_0x4c261a['name']){delete _0x4c261a[_0xa3be('0x25')];}_0x322153['status'](_0x2c89d0)[_0xa3be('0x26')](_0x4c261a);};}exports[_0xa3be('0x27')]=function(_0x564b7b,_0x2a795f){var _0x1f8cc1={},_0x4617ac={},_0x3629ef={'count':0x0,'rows':[]};var _0x5611a6=_[_0xa3be('0x28')](db['ServicenowAccount'][_0xa3be('0x29')],function(_0x4b85ec){return{'name':_0x4b85ec[_0xa3be('0x2a')],'type':_0x4b85ec[_0xa3be('0x2b')][_0xa3be('0x2c')]};});_0x4617ac[_0xa3be('0x2d')]=_[_0xa3be('0x28')](_0x5611a6,_0xa3be('0x25'));_0x4617ac[_0xa3be('0x2e')]=_[_0xa3be('0x2f')](_0x564b7b['query']);_0x4617ac[_0xa3be('0x30')]=_['intersection'](_0x4617ac[_0xa3be('0x2d')],_0x4617ac[_0xa3be('0x2e')]);_0x1f8cc1[_0xa3be('0x31')]=_[_0xa3be('0x32')](_0x4617ac[_0xa3be('0x2d')],qs[_0xa3be('0x33')](_0x564b7b['query'][_0xa3be('0x33')]));_0x1f8cc1[_0xa3be('0x31')]=_0x1f8cc1[_0xa3be('0x31')]['length']?_0x1f8cc1[_0xa3be('0x31')]:_0x4617ac['model'];if(!_0x564b7b['query'][_0xa3be('0x34')]('nolimit')){_0x1f8cc1[_0xa3be('0x1a')]=qs[_0xa3be('0x1a')](_0x564b7b[_0xa3be('0x2e')][_0xa3be('0x1a')]);_0x1f8cc1[_0xa3be('0x19')]=qs['offset'](_0x564b7b[_0xa3be('0x2e')][_0xa3be('0x19')]);}_0x1f8cc1[_0xa3be('0x35')]=qs['sort'](_0x564b7b[_0xa3be('0x2e')][_0xa3be('0x36')]);_0x1f8cc1[_0xa3be('0x37')]=qs[_0xa3be('0x30')](_[_0xa3be('0x38')](_0x564b7b[_0xa3be('0x2e')],_0x4617ac[_0xa3be('0x30')]),_0x5611a6);if(_0x564b7b[_0xa3be('0x2e')][_0xa3be('0x39')]){_0x1f8cc1[_0xa3be('0x37')]=_['merge'](_0x1f8cc1[_0xa3be('0x37')],{'$or':_[_0xa3be('0x28')](_0x5611a6,function(_0x192d0f){if(_0x192d0f[_0xa3be('0x2b')]!==_0xa3be('0x3a')){var _0x534ed8={};_0x534ed8[_0x192d0f[_0xa3be('0x25')]]={'$like':'%'+_0x564b7b[_0xa3be('0x2e')][_0xa3be('0x39')]+'%'};return _0x534ed8;}})});}_0x1f8cc1=_[_0xa3be('0x3b')]({},_0x1f8cc1,_0x564b7b[_0xa3be('0x3c')]);var _0x3bd540={'where':_0x1f8cc1[_0xa3be('0x37')]};return db[_0xa3be('0x3d')][_0xa3be('0x1c')](_0x3bd540)['then'](function(_0x255a21){_0x3629ef[_0xa3be('0x1c')]=_0x255a21;if(_0x564b7b[_0xa3be('0x2e')][_0xa3be('0x3e')]){_0x1f8cc1['include']=[{'all':!![]}];}return db[_0xa3be('0x3d')][_0xa3be('0x3f')](_0x1f8cc1);})['then'](function(_0x34bb7c){_0x3629ef[_0xa3be('0x40')]=_0x34bb7c;return _0x3629ef;})[_0xa3be('0x22')](respondWithFilteredResult(_0x2a795f,_0x1f8cc1))['catch'](handleError(_0x2a795f,null));};exports[_0xa3be('0x41')]=function(_0x5a2b6e,_0x2cccbe){var _0x3635c5={'raw':![],'where':{'id':_0x5a2b6e[_0xa3be('0x42')]['id']}},_0x106ad2={};_0x106ad2['model']=_[_0xa3be('0x2f')](db['ServicenowAccount'][_0xa3be('0x29')]);_0x106ad2[_0xa3be('0x2e')]=_[_0xa3be('0x2f')](_0x5a2b6e[_0xa3be('0x2e')]);_0x106ad2[_0xa3be('0x30')]=_[_0xa3be('0x32')](_0x106ad2[_0xa3be('0x2d')],_0x106ad2[_0xa3be('0x2e')]);_0x3635c5[_0xa3be('0x31')]=_[_0xa3be('0x32')](_0x106ad2[_0xa3be('0x2d')],qs[_0xa3be('0x33')](_0x5a2b6e['query'][_0xa3be('0x33')]));_0x3635c5[_0xa3be('0x31')]=_0x3635c5['attributes']['length']?_0x3635c5['attributes']:_0x106ad2[_0xa3be('0x2d')];if(_0x5a2b6e[_0xa3be('0x2e')]['includeAll']){_0x3635c5['include']=[{'all':!![]}];}_0x3635c5=_['merge']({},_0x3635c5,_0x5a2b6e[_0xa3be('0x3c')]);return db[_0xa3be('0x3d')]['find'](_0x3635c5)[_0xa3be('0x22')](handleEntityNotFound(_0x2cccbe,null))[_0xa3be('0x22')](respondWithResult(_0x2cccbe,null))[_0xa3be('0x43')](handleError(_0x2cccbe,null));};exports[_0xa3be('0x44')]=function(_0x2cc9fd,_0x541e3d){return db['ServicenowAccount'][_0xa3be('0x44')](_0x2cc9fd[_0xa3be('0x45')],{})[_0xa3be('0x22')](respondWithResult(_0x541e3d,0xc9))[_0xa3be('0x43')](handleError(_0x541e3d,null));};exports['update']=function(_0x303828,_0x23da8e){if(_0x303828['body']['id']){delete _0x303828[_0xa3be('0x45')]['id'];}return db[_0xa3be('0x3d')][_0xa3be('0x46')]({'where':{'id':_0x303828[_0xa3be('0x42')]['id']}})[_0xa3be('0x22')](handleEntityNotFound(_0x23da8e,null))[_0xa3be('0x22')](saveUpdates(_0x303828[_0xa3be('0x45')],null))[_0xa3be('0x22')](respondWithResult(_0x23da8e,null))[_0xa3be('0x43')](handleError(_0x23da8e,null));};exports[_0xa3be('0x23')]=function(_0x3384b0,_0x20aa44){return db[_0xa3be('0x3d')][_0xa3be('0x46')]({'where':{'id':_0x3384b0[_0xa3be('0x42')]['id']}})[_0xa3be('0x22')](handleEntityNotFound(_0x20aa44,null))[_0xa3be('0x22')](removeEntity(_0x20aa44,null))[_0xa3be('0x43')](handleError(_0x20aa44,null));};exports[_0xa3be('0x47')]=function(_0x2e9232,_0x4dfc61,_0x9d31da){var _0x4de721={};var _0x8e4a83={};var _0xb1958d;var _0x56dd32;return db['ServicenowAccount'][_0xa3be('0x48')]({'where':{'id':_0x2e9232[_0xa3be('0x42')]['id']}})[_0xa3be('0x22')](handleEntityNotFound(_0x4dfc61,null))[_0xa3be('0x22')](function(_0x5d0c14){if(_0x5d0c14){_0xb1958d=_0x5d0c14;_0x8e4a83[_0xa3be('0x2d')]=_[_0xa3be('0x2f')](db['ServicenowConfiguration'][_0xa3be('0x29')]);_0x8e4a83[_0xa3be('0x2e')]=_['keys'](_0x2e9232['query']);_0x8e4a83['filters']=_[_0xa3be('0x32')](_0x8e4a83[_0xa3be('0x2d')],_0x8e4a83[_0xa3be('0x2e')]);_0x4de721[_0xa3be('0x31')]=_[_0xa3be('0x32')](_0x8e4a83[_0xa3be('0x2d')],qs[_0xa3be('0x33')](_0x2e9232[_0xa3be('0x2e')]['fields']));_0x4de721[_0xa3be('0x31')]=_0x4de721[_0xa3be('0x31')][_0xa3be('0x49')]?_0x4de721[_0xa3be('0x31')]:_0x8e4a83[_0xa3be('0x2d')];_0x4de721[_0xa3be('0x35')]=qs[_0xa3be('0x36')](_0x2e9232[_0xa3be('0x2e')][_0xa3be('0x36')]);_0x4de721[_0xa3be('0x37')]=qs['filters'](_[_0xa3be('0x38')](_0x2e9232[_0xa3be('0x2e')],_0x8e4a83[_0xa3be('0x30')]));if(_0x2e9232[_0xa3be('0x2e')][_0xa3be('0x39')]){_0x4de721[_0xa3be('0x37')]=_['merge'](_0x4de721[_0xa3be('0x37')],{'$or':_[_0xa3be('0x28')](_0x4de721[_0xa3be('0x31')],function(_0x53af4d){var _0x3a802a={};_0x3a802a[_0x53af4d]={'$like':'%'+_0x2e9232[_0xa3be('0x2e')][_0xa3be('0x39')]+'%'};return _0x3a802a;})});}_0x4de721=_['merge']({},_0x4de721,_0x2e9232[_0xa3be('0x3c')]);return _0xb1958d[_0xa3be('0x47')](_0x4de721);}})[_0xa3be('0x22')](function(_0x173efa){if(_0x173efa){_0x56dd32=_0x173efa[_0xa3be('0x49')];if(!_0x2e9232[_0xa3be('0x2e')]['hasOwnProperty']('nolimit')){_0x4de721['limit']=qs[_0xa3be('0x1a')](_0x2e9232['query'][_0xa3be('0x1a')]);_0x4de721[_0xa3be('0x19')]=qs['offset'](_0x2e9232['query'][_0xa3be('0x19')]);}return _0xb1958d['getConfigurations'](_0x4de721);}})['then'](function(_0x11c7b2){if(_0x11c7b2){return _0x11c7b2?{'count':_0x56dd32,'rows':_0x11c7b2}:null;}})[_0xa3be('0x22')](respondWithResult(_0x4dfc61,null))[_0xa3be('0x43')](handleError(_0x4dfc61,null));};exports[_0xa3be('0x4a')]=function(_0x4aaf36,_0x129ede,_0x2728c0){if(_0x4aaf36[_0xa3be('0x45')]['id']){delete _0x4aaf36[_0xa3be('0x45')]['id'];}return db[_0xa3be('0x3d')]['findOne']({'where':{'id':_0x4aaf36[_0xa3be('0x42')]['id']}})[_0xa3be('0x22')](handleEntityNotFound(_0x129ede,null))[_0xa3be('0x22')](function(_0x4978ae){if(_0x4978ae){_0x4aaf36[_0xa3be('0x45')][_0xa3be('0x4b')]=_0x4978ae['id'];_0x4aaf36[_0xa3be('0x45')]['Subjects']=integrations[_0xa3be('0x4c')](_0x4aaf36[_0xa3be('0x45')][_0xa3be('0x4d')],_0x4aaf36[_0xa3be('0x45')][_0xa3be('0x2b')]);_0x4aaf36[_0xa3be('0x45')][_0xa3be('0x4e')]=integrations[_0xa3be('0x4f')](_0x4aaf36['body'][_0xa3be('0x4d')],_0x4aaf36[_0xa3be('0x45')][_0xa3be('0x2b')]);return db['ServicenowConfiguration'][_0xa3be('0x44')](_0x4aaf36[_0xa3be('0x45')],{'include':[{'model':db[_0xa3be('0x50')],'as':_0xa3be('0x51')},{'model':db[_0xa3be('0x50')],'as':_0xa3be('0x4e')}]});}return null;})[_0xa3be('0x22')](respondWithResult(_0x129ede,null))[_0xa3be('0x43')](handleError(_0x129ede,null));};exports['getFields']=function(_0x4b5c58,_0x4666d8,_0x17d56b){var _0x1064dd=[_0xa3be('0x52'),_0xa3be('0x53'),_0xa3be('0x54'),_0xa3be('0x55'),_0xa3be('0x56'),_0xa3be('0x57'),_0xa3be('0x58'),_0xa3be('0x59'),'category'];var _0x21223f=[_0xa3be('0x5a'),_0xa3be('0x52'),_0xa3be('0x5b'),'watch_list',_0xa3be('0x5c'),_0xa3be('0x5d'),'child_incidents','hold_reason',_0xa3be('0x5e'),'number',_0xa3be('0x5f'),_0xa3be('0x60'),_0xa3be('0x61'),_0xa3be('0x62'),_0xa3be('0x63'),_0xa3be('0x64'),_0xa3be('0x65'),'sys_created_by','knowledge','order','calendar_stc',_0xa3be('0x66'),_0xa3be('0x67'),'delivery_plan',_0xa3be('0x68'),_0xa3be('0x69'),_0xa3be('0x6a'),_0xa3be('0x6b'),_0xa3be('0x6c'),_0xa3be('0x6d'),_0xa3be('0x6e'),_0xa3be('0x6f'),_0xa3be('0x70'),'opened_at',_0xa3be('0x71'),_0xa3be('0x72'),_0xa3be('0x73'),_0xa3be('0x74'),_0xa3be('0x75'),_0xa3be('0x76'),'approval_set',_0xa3be('0x55'),_0xa3be('0x77'),_0xa3be('0x78'),_0xa3be('0x56'),_0xa3be('0x79'),_0xa3be('0x7a'),'work_start',_0xa3be('0x7b'),_0xa3be('0x7c'),_0xa3be('0x7d'),'description','calendar_duration',_0xa3be('0x57'),_0xa3be('0x7e'),_0xa3be('0x7f'),'closed_by',_0xa3be('0x80'),_0xa3be('0x81'),'sys_id',_0xa3be('0x82'),_0xa3be('0x83'),_0xa3be('0x58'),_0xa3be('0x84'),_0xa3be('0x85'),'company',_0xa3be('0x86'),_0xa3be('0x87'),'assigned_to',_0xa3be('0x59'),_0xa3be('0x88'),_0xa3be('0x89'),'approval',_0xa3be('0x8a'),_0xa3be('0x8b'),_0xa3be('0x8c'),'reopen_count','sys_tags',_0xa3be('0x8d'),'upon_approval',_0xa3be('0x8e'),'location',_0xa3be('0x8f')];var _0xb391b9='';var _0xf892b2='';var _0x3a302e=[];var _0x56344d='';var _0x32de84='';var _0x5efbe9=[];var _0x3194be='';var _0x3eeca3='';var _0x30cda0={};var _0x23530e='';return db[_0xa3be('0x3d')]['findOne']({'where':{'id':_0x4b5c58[_0xa3be('0x42')]['id']},'attributes':['id',_0xa3be('0x90'),_0xa3be('0x91'),_0xa3be('0x92'),_0xa3be('0x93'),_0xa3be('0x94')]})[_0xa3be('0x22')](handleEntityNotFound(_0x4666d8,null))[_0xa3be('0x22')](function(_0x410790){if(_0x410790){_0x23530e=_0x410790[_0xa3be('0x93')];var _0x282759=_0x23530e[_0xa3be('0x95')](-0x1);if(_0x282759==='/'){_0x23530e=_0x23530e['substring'](0x0,_0x23530e['lastIndexOf'](_0x282759));}_0x3eeca3=util[_0xa3be('0x96')](_0xa3be('0x97'),_0x23530e);_0x3194be=util[_0xa3be('0x96')](_0xa3be('0x98'),_0x23530e);_0x30cda0={'user':_0x410790['username'],'pass':_0x410790[_0xa3be('0x91')]};var _0x2d610b={'method':_0xa3be('0x99'),'uri':_0x3eeca3+_0xa3be('0x9a'),'auth':_0x30cda0,'json':!![]};return rp(_0x2d610b);}})[_0xa3be('0x22')](function(_0x28b2ae){if(_0x28b2ae[_0xa3be('0x9b')]['length']>0x0){_0xb391b9=_0x28b2ae[_0xa3be('0x9b')];}console[_0xa3be('0x9c')](_0xa3be('0x9d'),_0xb391b9);_0x5efbe9=[];_0xf892b2=Object['assign']([],_0xb391b9);_[_0xa3be('0x9e')](_0xf892b2,function(_0x1a7f94){return!_0x1064dd['includes'](_0x1a7f94[_0xa3be('0x25')]);});_0xf892b2[_0xa3be('0x9f')](function(_0x2bc784){var _0x57dc94=createFieldObject(_0x3194be,_0x30cda0,_0x2bc784[_0xa3be('0xa0')],_0x2bc784[_0xa3be('0x25')],_0x2bc784[_0xa3be('0xa1')],![]);_0x5efbe9[_0xa3be('0xa2')](_0x57dc94);});return Promise[_0xa3be('0xa3')](_0x5efbe9);})[_0xa3be('0x22')](function(_0x338f98){_0x3a302e=_0x338f98;_0x56344d=Object[_0xa3be('0xa4')]([],_0xb391b9);console[_0xa3be('0x9c')](_0xa3be('0xa5'),_0xb391b9);_['remove'](_0x56344d,function(_0x63b76e){return _0x21223f['includes'](_0x63b76e['name']);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x56344d);_0x5efbe9=[];_0x56344d[_0xa3be('0x9f')](function(_0x2af493){var _0x40c643=createFieldObject(_0x3194be,_0x30cda0,_0x2af493[_0xa3be('0xa0')],_0x2af493[_0xa3be('0x25')],_0x2af493['label'],!![]);_0x5efbe9['push'](_0x40c643);});return Promise[_0xa3be('0xa3')](_0x5efbe9);})[_0xa3be('0x22')](function(_0x216c76){_0x32de84=_0x216c76;var _0x38bf3c=_0x3a302e[_0xa3be('0xa6')](_0x32de84);return{'count':_0x38bf3c['length'],'rows':_0x38bf3c};})['then'](respondWithResult(_0x4666d8,null))[_0xa3be('0x43')](function(_0x546f43){console[_0xa3be('0x9c')](_0xa3be('0xa7')+_0x546f43);var _0x119039=_0x4b5c58[_0xa3be('0x2e')][_0xa3be('0xa8')]?0x1f4:_0x546f43['statusCode']||0x1f4;logger['error'](_0x546f43[_0xa3be('0x24')]);delete _0x546f43[_0xa3be('0x25')];if(_0x119039===0x191){_0x119039=0x190;}_0x4666d8[_0xa3be('0x17')](_0x119039)['send'](_0x4b5c58[_0xa3be('0x2e')][_0xa3be('0xa8')]?{'message':_0xa3be('0xa9'),'statusCode':_0x546f43[_0xa3be('0xaa')]}:_0x546f43);});};function createFieldObject(_0x1bcd92,_0x3fb9c1,_0x2e931c,_0x5acba1,_0x64f0a9,_0x27b4b7){return new Promise(function(_0x3ee77c,_0x531542){var _0x5aad93={'id':_0x5acba1,'name':_0x64f0a9,'custom':_0x27b4b7};if(_0x2e931c==='boolean'){_0x5aad93[_0xa3be('0x3c')]=[{'name':_0xa3be('0xab'),'value':'true'},{'name':_0xa3be('0xac'),'value':_0xa3be('0xad')}];_0x3ee77c(_0x5aad93);}else{var _0x1ca1d8={'method':_0xa3be('0x99'),'uri':_0x1bcd92+_0xa3be('0xae')+_0x5acba1,'auth':_0x3fb9c1,'json':!![]};return rp(_0x1ca1d8)[_0xa3be('0x22')](function(_0x5c61e7){var _0x25339e=[];if(_0x5c61e7[_0xa3be('0x9b')]['length']>0x0){_0x5c61e7[_0xa3be('0x9b')]['forEach'](function(_0x28a7ba){if(_0x28a7ba[_0xa3be('0xaf')]===_0xa3be('0xad')){var _0x54194f={'name':_0x28a7ba['label'],'value':_0x28a7ba[_0xa3be('0xb0')]};_0x25339e[_0xa3be('0xa2')](_0x54194f);}});}_0x5aad93[_0xa3be('0x3c')]=_0x25339e;if(_0x5aad93['options'][_0xa3be('0x49')]>0x0){_0x3ee77c(_0x5aad93);}else{if(_0x27b4b7==![]){_0x3ee77c();}else{_0x3ee77c(_0x5aad93);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index e07d751..9563822 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 _0x71ab=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','api','bluebird','request-promise'];(function(_0x47d17a,_0x24ae87){var _0x5d801a=function(_0x20e48b){while(--_0x20e48b){_0x47d17a['push'](_0x47d17a['shift']());}};_0x5d801a(++_0x24ae87);}(_0x71ab,0x64));var _0xb71a=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x71ab[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));var integrations=require(_0xb71a('0x8'));module[_0xb71a('0x9')]=function(_0x22c072,_0x35a84e){return _0x22c072[_0xb71a('0xa')](_0xb71a('0xb'),attributes,{'tableName':_0xb71a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eb2=['request-promise','rimraf','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x2e8227,_0x4b004a){var _0x12281f=function(_0x46e488){while(--_0x46e488){_0x2e8227['push'](_0x2e8227['shift']());}};_0x12281f(++_0x4b004a);}(_0x2eb2,0x19f));var _0x22eb=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x2eb2[_0xdc37a1];return _0x99b4fe;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x22eb('0x7'));module[_0x22eb('0x8')]=function(_0x35dd5b,_0x2a9850){return _0x35dd5b[_0x22eb('0x9')](_0x22eb('0xa'),attributes,{'tableName':_0x22eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 1d48cd0..7d3c6ba 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 _0x4eb9=['debug','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','ShowServicenowAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x26fd1e,_0x1113aa){var _0x4ce19a=function(_0x7f2303){while(--_0x7f2303){_0x26fd1e['push'](_0x26fd1e['shift']());}};_0x4ce19a(++_0x1113aa);}(_0x4eb9,0x1da));var _0x94eb=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x4eb9[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require('lodash');var util=require(_0x94eb('0x0'));var moment=require(_0x94eb('0x1'));var BPromise=require(_0x94eb('0x2'));var rs=require(_0x94eb('0x3'));var fs=require('fs');var Redis=require(_0x94eb('0x4'));var db=require(_0x94eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x94eb('0x6'))(_0x94eb('0x7'));var config=require(_0x94eb('0x8'));var jayson=require(_0x94eb('0x9'));var client=jayson['client'][_0x94eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x87fe61,_0xde5a63,_0x29932e){return new BPromise(function(_0x5285d7,_0xeb26c6){return client[_0x94eb('0xb')](_0x87fe61,_0x29932e)[_0x94eb('0xc')](function(_0x5cd651){logger[_0x94eb('0xd')](_0x94eb('0xe'),_0xde5a63,_0x94eb('0xf'));logger[_0x94eb('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0xde5a63,_0x94eb('0xf'),JSON[_0x94eb('0x11')](_0x5cd651));if(_0x5cd651[_0x94eb('0x12')]){if(_0x5cd651[_0x94eb('0x12')][_0x94eb('0x13')]===0x1f4){logger[_0x94eb('0x12')](_0x94eb('0xe'),_0xde5a63,_0x5cd651[_0x94eb('0x12')]['message']);return _0xeb26c6(_0x5cd651['error']['message']);}logger[_0x94eb('0x12')](_0x94eb('0xe'),_0xde5a63,_0x5cd651[_0x94eb('0x12')][_0x94eb('0x14')]);return _0x5285d7(_0x5cd651[_0x94eb('0x12')]['message']);}else{logger['info'](_0x94eb('0xe'),_0xde5a63,'request\x20sent');_0x5285d7(_0x5cd651[_0x94eb('0x15')][_0x94eb('0x14')]);}})[_0x94eb('0x16')](function(_0x13c2ae){logger[_0x94eb('0x12')](_0x94eb('0xe'),_0xde5a63,_0x13c2ae);_0xeb26c6(_0x13c2ae);});});}exports[_0x94eb('0x17')]=function(_0xe5aa54){var _0x524e95=this;return new Promise(function(_0x11bc98,_0x3d87aa){return db[_0x94eb('0x18')][_0x94eb('0x19')]({'raw':_0xe5aa54[_0x94eb('0x1a')]?_0xe5aa54[_0x94eb('0x1a')][_0x94eb('0x1b')]===undefined?!![]:![]:!![],'where':_0xe5aa54['options']?_0xe5aa54[_0x94eb('0x1a')]['where']||null:null,'attributes':_0xe5aa54[_0x94eb('0x1a')]?_0xe5aa54[_0x94eb('0x1a')][_0x94eb('0x1c')]||null:null,'limit':_0xe5aa54[_0x94eb('0x1a')]?_0xe5aa54['options'][_0x94eb('0x1d')]||null:null,'include':_0xe5aa54['options']?_0xe5aa54[_0x94eb('0x1a')][_0x94eb('0x1e')]?_[_0x94eb('0x1f')](_0xe5aa54[_0x94eb('0x1a')][_0x94eb('0x1e')],function(_0x4580aa){return{'model':db[_0x4580aa[_0x94eb('0x20')]],'as':_0x4580aa['as'],'attributes':_0x4580aa[_0x94eb('0x1c')],'include':_0x4580aa[_0x94eb('0x1e')]?_[_0x94eb('0x1f')](_0x4580aa[_0x94eb('0x1e')],function(_0x261b02){return{'model':db[_0x261b02[_0x94eb('0x20')]],'as':_0x261b02['as'],'attributes':_0x261b02[_0x94eb('0x1c')],'include':_0x261b02[_0x94eb('0x1e')]?_[_0x94eb('0x1f')](_0x261b02[_0x94eb('0x1e')],function(_0x647317){return{'model':db[_0x647317[_0x94eb('0x20')]],'as':_0x647317['as'],'attributes':_0x647317['attributes']};}):[]};}):[]};}):[]:[]})[_0x94eb('0xc')](function(_0x31f342){logger[_0x94eb('0xd')](_0x94eb('0x17'),_0xe5aa54);logger[_0x94eb('0x10')](_0x94eb('0x17'),_0xe5aa54,JSON[_0x94eb('0x11')](_0x31f342));_0x11bc98(_0x31f342);})[_0x94eb('0x16')](function(_0x532160){logger[_0x94eb('0x12')](_0x94eb('0x17'),_0x532160[_0x94eb('0x14')],_0xe5aa54);_0x3d87aa(_0x524e95[_0x94eb('0x12')](0x1f4,_0x532160['message']));});});};exports[_0x94eb('0x21')]=function(_0x1d025f){var _0x5dda44=this;return new Promise(function(_0x3a1778,_0x3b4881){return db['ServicenowAccount'][_0x94eb('0x22')]({'raw':_0x1d025f[_0x94eb('0x1a')]?_0x1d025f[_0x94eb('0x1a')][_0x94eb('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d025f['options']?_0x1d025f['options']['where']||null:null,'attributes':_0x1d025f[_0x94eb('0x1a')]?_0x1d025f['options']['attributes']||null:null,'include':_0x1d025f[_0x94eb('0x1a')]?_0x1d025f[_0x94eb('0x1a')][_0x94eb('0x1e')]?_[_0x94eb('0x1f')](_0x1d025f['options'][_0x94eb('0x1e')],function(_0x20aefa){return{'model':db[_0x20aefa[_0x94eb('0x20')]],'as':_0x20aefa['as'],'attributes':_0x20aefa['attributes'],'include':_0x20aefa[_0x94eb('0x1e')]?_[_0x94eb('0x1f')](_0x20aefa[_0x94eb('0x1e')],function(_0x6da481){return{'model':db[_0x6da481[_0x94eb('0x20')]],'as':_0x6da481['as'],'attributes':_0x6da481['attributes'],'include':_0x6da481[_0x94eb('0x1e')]?_[_0x94eb('0x1f')](_0x6da481[_0x94eb('0x1e')],function(_0x1a1974){return{'model':db[_0x1a1974[_0x94eb('0x20')]],'as':_0x1a1974['as'],'attributes':_0x1a1974[_0x94eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x94eb('0xc')](function(_0x3d6962){logger[_0x94eb('0xd')](_0x94eb('0x21'),_0x1d025f);logger[_0x94eb('0x10')](_0x94eb('0x21'),_0x1d025f,JSON['stringify'](_0x3d6962));_0x3a1778(_0x3d6962);})[_0x94eb('0x16')](function(_0x5078fa){logger[_0x94eb('0x12')](_0x94eb('0x21'),_0x5078fa[_0x94eb('0x14')],_0x1d025f);_0x3b4881(_0x5dda44['error'](0x1f4,_0x5078fa[_0x94eb('0x14')]));});});}; \ No newline at end of file +var _0x21d6=['include','map','model','stringify','ShowServicenowAccount','ServicenowAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','code','error','ServicenowAccount,\x20%s,\x20%s','message','catch','GetServicenowAccount','findAll','options','where','attributes'];(function(_0x1331b2,_0x3df22b){var _0x10f741=function(_0x16e85e){while(--_0x16e85e){_0x1331b2['push'](_0x1331b2['shift']());}};_0x10f741(++_0x3df22b);}(_0x21d6,0x120));var _0x621d=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x21d6[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x621d('0x0'));var util=require(_0x621d('0x1'));var moment=require(_0x621d('0x2'));var BPromise=require(_0x621d('0x3'));var rs=require(_0x621d('0x4'));var fs=require('fs');var Redis=require(_0x621d('0x5'));var db=require(_0x621d('0x6'))['db'];var utils=require(_0x621d('0x7'));var logger=require('../../config/logger')(_0x621d('0x8'));var config=require('../../config/environment');var jayson=require(_0x621d('0x9'));var client=jayson[_0x621d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x279b00,_0x3accca,_0x4ddb3b){return new BPromise(function(_0x400894,_0x2d8574){return client[_0x621d('0xb')](_0x279b00,_0x4ddb3b)[_0x621d('0xc')](function(_0x1396c5){logger[_0x621d('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x3accca,_0x621d('0xe'));logger[_0x621d('0xf')](_0x621d('0x10'),_0x3accca,_0x621d('0xe'),JSON['stringify'](_0x1396c5));if(_0x1396c5['error']){if(_0x1396c5['error'][_0x621d('0x11')]===0x1f4){logger[_0x621d('0x12')](_0x621d('0x13'),_0x3accca,_0x1396c5[_0x621d('0x12')]['message']);return _0x2d8574(_0x1396c5[_0x621d('0x12')][_0x621d('0x14')]);}logger[_0x621d('0x12')](_0x621d('0x13'),_0x3accca,_0x1396c5['error'][_0x621d('0x14')]);return _0x400894(_0x1396c5[_0x621d('0x12')][_0x621d('0x14')]);}else{logger[_0x621d('0xd')](_0x621d('0x13'),_0x3accca,'request\x20sent');_0x400894(_0x1396c5['result'][_0x621d('0x14')]);}})[_0x621d('0x15')](function(_0x44a619){logger[_0x621d('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x3accca,_0x44a619);_0x2d8574(_0x44a619);});});}exports[_0x621d('0x16')]=function(_0x10b107){var _0xce1206=this;return new Promise(function(_0x433503,_0x174764){return db['ServicenowAccount'][_0x621d('0x17')]({'raw':_0x10b107[_0x621d('0x18')]?_0x10b107[_0x621d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x10b107[_0x621d('0x18')]?_0x10b107['options'][_0x621d('0x19')]||null:null,'attributes':_0x10b107[_0x621d('0x18')]?_0x10b107['options'][_0x621d('0x1a')]||null:null,'limit':_0x10b107[_0x621d('0x18')]?_0x10b107[_0x621d('0x18')]['limit']||null:null,'include':_0x10b107['options']?_0x10b107[_0x621d('0x18')][_0x621d('0x1b')]?_[_0x621d('0x1c')](_0x10b107[_0x621d('0x18')][_0x621d('0x1b')],function(_0x3415f7){return{'model':db[_0x3415f7[_0x621d('0x1d')]],'as':_0x3415f7['as'],'attributes':_0x3415f7['attributes'],'include':_0x3415f7['include']?_[_0x621d('0x1c')](_0x3415f7['include'],function(_0x5286c3){return{'model':db[_0x5286c3['model']],'as':_0x5286c3['as'],'attributes':_0x5286c3[_0x621d('0x1a')],'include':_0x5286c3[_0x621d('0x1b')]?_[_0x621d('0x1c')](_0x5286c3[_0x621d('0x1b')],function(_0x4c01ce){return{'model':db[_0x4c01ce[_0x621d('0x1d')]],'as':_0x4c01ce['as'],'attributes':_0x4c01ce[_0x621d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x621d('0xc')](function(_0x330d25){logger[_0x621d('0xd')](_0x621d('0x16'),_0x10b107);logger[_0x621d('0xf')](_0x621d('0x16'),_0x10b107,JSON[_0x621d('0x1e')](_0x330d25));_0x433503(_0x330d25);})[_0x621d('0x15')](function(_0x25446f){logger[_0x621d('0x12')](_0x621d('0x16'),_0x25446f[_0x621d('0x14')],_0x10b107);_0x174764(_0xce1206['error'](0x1f4,_0x25446f[_0x621d('0x14')]));});});};exports[_0x621d('0x1f')]=function(_0x39b007){var _0x3aab7c=this;return new Promise(function(_0x179df9,_0x402956){return db[_0x621d('0x20')][_0x621d('0x21')]({'raw':_0x39b007[_0x621d('0x18')]?_0x39b007[_0x621d('0x18')][_0x621d('0x22')]===undefined?!![]:![]:!![],'where':_0x39b007[_0x621d('0x18')]?_0x39b007[_0x621d('0x18')][_0x621d('0x19')]||null:null,'attributes':_0x39b007[_0x621d('0x18')]?_0x39b007['options']['attributes']||null:null,'include':_0x39b007[_0x621d('0x18')]?_0x39b007[_0x621d('0x18')][_0x621d('0x1b')]?_[_0x621d('0x1c')](_0x39b007[_0x621d('0x18')]['include'],function(_0x93b5a9){return{'model':db[_0x93b5a9[_0x621d('0x1d')]],'as':_0x93b5a9['as'],'attributes':_0x93b5a9[_0x621d('0x1a')],'include':_0x93b5a9['include']?_['map'](_0x93b5a9['include'],function(_0x375b7a){return{'model':db[_0x375b7a[_0x621d('0x1d')]],'as':_0x375b7a['as'],'attributes':_0x375b7a[_0x621d('0x1a')],'include':_0x375b7a['include']?_[_0x621d('0x1c')](_0x375b7a[_0x621d('0x1b')],function(_0x35004f){return{'model':db[_0x35004f['model']],'as':_0x35004f['as'],'attributes':_0x35004f[_0x621d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb0f9d1){logger[_0x621d('0xd')](_0x621d('0x1f'),_0x39b007);logger['debug']('ShowServicenowAccount',_0x39b007,JSON[_0x621d('0x1e')](_0xb0f9d1));_0x179df9(_0xb0f9d1);})[_0x621d('0x15')](function(_0x290a02){logger['error'](_0x621d('0x1f'),_0x290a02['message'],_0x39b007);_0x402956(_0x3aab7c['error'](0x1f4,_0x290a02[_0x621d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 0ccb8fc..85cd203 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 _0x8fea=['express','Router','fs-extra','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','multer','util','path','connect-timeout'];(function(_0x27c2ff,_0x5891ed){var _0xd80b7a=function(_0x398a){while(--_0x398a){_0x27c2ff['push'](_0x27c2ff['shift']());}};_0xd80b7a(++_0x5891ed);}(_0x8fea,0x1c4));var _0xa8fe=function(_0x1d14a4,_0x3d0375){_0x1d14a4=_0x1d14a4-0x0;var _0x5cae92=_0x8fea[_0x1d14a4];return _0x5cae92;};'use strict';var multer=require(_0xa8fe('0x0'));var util=require(_0xa8fe('0x1'));var path=require(_0xa8fe('0x2'));var timeout=require(_0xa8fe('0x3'));var express=require(_0xa8fe('0x4'));var router=express[_0xa8fe('0x5')]();var fs_extra=require(_0xa8fe('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa8fe('0x7'));var controller=require(_0xa8fe('0x8'));router['get']('/',auth[_0xa8fe('0x9')](),controller['index']);router[_0xa8fe('0xa')](_0xa8fe('0xb'),auth[_0xa8fe('0x9')](),controller[_0xa8fe('0xc')]);router[_0xa8fe('0xa')](_0xa8fe('0xd'),auth['isAuthenticated'](),controller[_0xa8fe('0xe')]);router[_0xa8fe('0xa')](_0xa8fe('0xf'),auth['isAuthenticated'](),controller[_0xa8fe('0x10')]);router[_0xa8fe('0xa')](_0xa8fe('0x11'),auth[_0xa8fe('0x9')](),controller[_0xa8fe('0x12')]);router[_0xa8fe('0x13')]('/',auth['isAuthenticated'](),controller[_0xa8fe('0x14')]);router[_0xa8fe('0x15')](_0xa8fe('0xb'),auth[_0xa8fe('0x9')](),controller[_0xa8fe('0x16')]);router[_0xa8fe('0x17')](_0xa8fe('0xb'),auth[_0xa8fe('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x38a4=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete'];(function(_0x3fe2be,_0x24cfba){var _0x16b3ca=function(_0x266d1e){while(--_0x266d1e){_0x3fe2be['push'](_0x3fe2be['shift']());}};_0x16b3ca(++_0x24cfba);}(_0x38a4,0x68));var _0x438a=function(_0x430f79,_0x2c2c62){_0x430f79=_0x430f79-0x0;var _0x3f63e0=_0x38a4[_0x430f79];return _0x3f63e0;};'use strict';var multer=require(_0x438a('0x0'));var util=require('util');var path=require(_0x438a('0x1'));var timeout=require(_0x438a('0x2'));var express=require(_0x438a('0x3'));var router=express[_0x438a('0x4')]();var fs_extra=require(_0x438a('0x5'));var auth=require(_0x438a('0x6'));var interaction=require(_0x438a('0x7'));var config=require(_0x438a('0x8'));var controller=require(_0x438a('0x9'));router[_0x438a('0xa')]('/',auth[_0x438a('0xb')](),controller[_0x438a('0xc')]);router[_0x438a('0xa')](_0x438a('0xd'),auth['isAuthenticated'](),controller[_0x438a('0xe')]);router[_0x438a('0xa')](_0x438a('0xf'),auth[_0x438a('0xb')](),controller[_0x438a('0x10')]);router['get'](_0x438a('0x11'),auth['isAuthenticated'](),controller[_0x438a('0x12')]);router[_0x438a('0xa')](_0x438a('0x13'),auth[_0x438a('0xb')](),controller[_0x438a('0x14')]);router[_0x438a('0x15')]('/',auth[_0x438a('0xb')](),controller[_0x438a('0x16')]);router[_0x438a('0x17')]('/:id',auth[_0x438a('0xb')](),controller[_0x438a('0x18')]);router[_0x438a('0x19')](_0x438a('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index aac4657..48417e0 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 _0xfcb2=['STRING','exports'];(function(_0x210da8,_0x170339){var _0x4673d6=function(_0x1e2e17){while(--_0x1e2e17){_0x210da8['push'](_0x210da8['shift']());}};_0x4673d6(++_0x170339);}(_0xfcb2,0xcd));var _0x2fcb=function(_0x2beca6,_0x28a43c){_0x2beca6=_0x2beca6-0x0;var _0x15c61e=_0xfcb2[_0x2beca6];return _0x15c61e;};'use strict';var Sequelize=require('sequelize');module[_0x2fcb('0x0')]={'name':{'type':Sequelize[_0x2fcb('0x1')]},'description':{'type':Sequelize[_0x2fcb('0x1')]}}; \ No newline at end of file +var _0xd923=['STRING','sequelize','exports'];(function(_0x578275,_0xe7ae46){var _0xf78041=function(_0x13148c){while(--_0x13148c){_0x578275['push'](_0x578275['shift']());}};_0xf78041(++_0xe7ae46);}(_0xd923,0x18a));var _0x3d92=function(_0x4a6fba,_0x44078a){_0x4a6fba=_0x4a6fba-0x0;var _0x3a3cca=_0xd923[_0x4a6fba];return _0x3a3cca;};'use strict';var Sequelize=require(_0x3d92('0x0'));module[_0x3d92('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3d92('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 86d709f..4deb042 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 _0xe6ec=['keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','show','length','find','create','catch','update','body','params','getFields','ServicenowField','order','pick','getSubjects','nolimit','getDescriptions','findOne','eml-format','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','then','destroy','stack','name','send','ServicenowConfiguration','rawAttributes','fieldName','model','query'];(function(_0x427c9b,_0x39bd68){var _0x1eed73=function(_0x5a2298){while(--_0x5a2298){_0x427c9b['push'](_0x427c9b['shift']());}};_0x1eed73(++_0x39bd68);}(_0xe6ec,0xfd));var _0xce6e=function(_0x55c918,_0x1db786){_0x55c918=_0x55c918-0x0;var _0x24583d=_0xe6ec[_0x55c918];return _0x24583d;};'use strict';var emlformat=require(_0xce6e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce6e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce6e('0x2'));var moment=require(_0xce6e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xce6e('0x4'));var util=require('util');var path=require(_0xce6e('0x5'));var sox=require(_0xce6e('0x6'));var csv=require(_0xce6e('0x7'));var ejs=require(_0xce6e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce6e('0x9'));var squel=require(_0xce6e('0xa'));var crypto=require(_0xce6e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xce6e('0xc'));var toCsv=require(_0xce6e('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xce6e('0xd'));var authService=require(_0xce6e('0xe'));var qs=require(_0xce6e('0xf'));var as=require(_0xce6e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce6e('0x11'))(_0xce6e('0x12'));var utils=require(_0xce6e('0x13'));var config=require(_0xce6e('0x14'));var licenseUtil=require(_0xce6e('0x15'));var db=require(_0xce6e('0x16'))['db'];function respondWithStatusCode(_0x5091df,_0xcec1cf){_0xcec1cf=_0xcec1cf||0xcc;return function(_0x3fb710){if(_0x3fb710){return _0x5091df[_0xce6e('0x17')](_0xcec1cf);}return _0x5091df['status'](_0xcec1cf)[_0xce6e('0x18')]();};}function respondWithResult(_0x5e8b4a,_0x3e889e){_0x3e889e=_0x3e889e||0xc8;return function(_0x5e012e){if(_0x5e012e){return _0x5e8b4a[_0xce6e('0x19')](_0x3e889e)[_0xce6e('0x1a')](_0x5e012e);}};}function respondWithFilteredResult(_0x44b068,_0x31cef8){return function(_0x2ab2e0){if(_0x2ab2e0){var _0x3b338d=typeof _0x31cef8[_0xce6e('0x1b')]===_0xce6e('0x1c')&&typeof _0x31cef8[_0xce6e('0x1d')]===_0xce6e('0x1c');var _0x5804ff=_0x2ab2e0[_0xce6e('0x1e')];var _0x4e196c=_0x3b338d?0x0:_0x31cef8[_0xce6e('0x1b')];var _0x4c3adb=_0x3b338d?_0x2ab2e0[_0xce6e('0x1e')]:_0x31cef8['offset']+_0x31cef8[_0xce6e('0x1d')];var _0xdcae7f;if(_0x4c3adb>=_0x5804ff){_0x4c3adb=_0x5804ff;_0xdcae7f=0xc8;}else{_0xdcae7f=0xce;}_0x44b068['status'](_0xdcae7f);return _0x44b068[_0xce6e('0x1f')]('Content-Range',_0x4e196c+'-'+_0x4c3adb+'/'+_0x5804ff)['json'](_0x2ab2e0);}return null;};}function patchUpdates(_0x3a1e37){return function(_0x420b2b){try{jsonpatch[_0xce6e('0x20')](_0x420b2b,_0x3a1e37,!![]);}catch(_0x172acd){return BPromise['reject'](_0x172acd);}return _0x420b2b['save']();};}function saveUpdates(_0x2728d0,_0x183c24){return function(_0x59325c){if(_0x59325c){return _0x59325c['update'](_0x2728d0)[_0xce6e('0x21')](function(_0x10960c){return _0x10960c;});}return null;};}function removeEntity(_0x23c820,_0x24a40b){return function(_0x347292){if(_0x347292){return _0x347292[_0xce6e('0x22')]()[_0xce6e('0x21')](function(){_0x23c820[_0xce6e('0x19')](0xcc)[_0xce6e('0x18')]();});}};}function handleEntityNotFound(_0x557671,_0x4a8dd4){return function(_0x56e2c2){if(!_0x56e2c2){_0x557671[_0xce6e('0x17')](0x194);}return _0x56e2c2;};}function handleError(_0x72d47e,_0x419dee){_0x419dee=_0x419dee||0x1f4;return function(_0x18787c){logger['error'](_0x18787c[_0xce6e('0x23')]);if(_0x18787c[_0xce6e('0x24')]){delete _0x18787c[_0xce6e('0x24')];}_0x72d47e[_0xce6e('0x19')](_0x419dee)[_0xce6e('0x25')](_0x18787c);};}exports['index']=function(_0x6e8566,_0x164ee0){var _0x3d5343={},_0x3b7c5a={},_0x52b4d6={'count':0x0,'rows':[]};var _0x46a70b=_['map'](db[_0xce6e('0x26')][_0xce6e('0x27')],function(_0x34772f){return{'name':_0x34772f[_0xce6e('0x28')],'type':_0x34772f['type']['key']};});_0x3b7c5a[_0xce6e('0x29')]=_['map'](_0x46a70b,_0xce6e('0x24'));_0x3b7c5a[_0xce6e('0x2a')]=_[_0xce6e('0x2b')](_0x6e8566[_0xce6e('0x2a')]);_0x3b7c5a[_0xce6e('0x2c')]=_[_0xce6e('0x2d')](_0x3b7c5a['model'],_0x3b7c5a['query']);_0x3d5343['attributes']=_[_0xce6e('0x2d')](_0x3b7c5a[_0xce6e('0x29')],qs[_0xce6e('0x2e')](_0x6e8566['query'][_0xce6e('0x2e')]));_0x3d5343[_0xce6e('0x2f')]=_0x3d5343['attributes']['length']?_0x3d5343[_0xce6e('0x2f')]:_0x3b7c5a[_0xce6e('0x29')];if(!_0x6e8566[_0xce6e('0x2a')][_0xce6e('0x30')]('nolimit')){_0x3d5343[_0xce6e('0x1d')]=qs[_0xce6e('0x1d')](_0x6e8566[_0xce6e('0x2a')][_0xce6e('0x1d')]);_0x3d5343['offset']=qs[_0xce6e('0x1b')](_0x6e8566['query'][_0xce6e('0x1b')]);}_0x3d5343['order']=qs[_0xce6e('0x31')](_0x6e8566['query'][_0xce6e('0x31')]);_0x3d5343[_0xce6e('0x32')]=qs[_0xce6e('0x2c')](_['pick'](_0x6e8566[_0xce6e('0x2a')],_0x3b7c5a[_0xce6e('0x2c')]),_0x46a70b);if(_0x6e8566[_0xce6e('0x2a')][_0xce6e('0x33')]){_0x3d5343[_0xce6e('0x32')]=_[_0xce6e('0x34')](_0x3d5343[_0xce6e('0x32')],{'$or':_[_0xce6e('0x35')](_0x46a70b,function(_0x51c364){if(_0x51c364['type']!==_0xce6e('0x36')){var _0x274ab9={};_0x274ab9[_0x51c364[_0xce6e('0x24')]]={'$like':'%'+_0x6e8566['query'][_0xce6e('0x33')]+'%'};return _0x274ab9;}})});}_0x3d5343=_[_0xce6e('0x34')]({},_0x3d5343,_0x6e8566[_0xce6e('0x37')]);var _0x30229d={'where':_0x3d5343[_0xce6e('0x32')]};return db[_0xce6e('0x26')]['count'](_0x30229d)[_0xce6e('0x21')](function(_0x4c6da6){_0x52b4d6[_0xce6e('0x1e')]=_0x4c6da6;if(_0x6e8566['query'][_0xce6e('0x38')]){_0x3d5343[_0xce6e('0x39')]=[{'all':!![]}];}return db[_0xce6e('0x26')]['findAll'](_0x3d5343);})['then'](function(_0x5f097e){_0x52b4d6['rows']=_0x5f097e;return _0x52b4d6;})['then'](respondWithFilteredResult(_0x164ee0,_0x3d5343))['catch'](handleError(_0x164ee0,null));};exports[_0xce6e('0x3a')]=function(_0x2bcddd,_0x30b8d2){var _0xafc6d8={'raw':![],'where':{'id':_0x2bcddd['params']['id']}},_0x30723a={};_0x30723a['model']=_[_0xce6e('0x2b')](db[_0xce6e('0x26')][_0xce6e('0x27')]);_0x30723a[_0xce6e('0x2a')]=_[_0xce6e('0x2b')](_0x2bcddd[_0xce6e('0x2a')]);_0x30723a['filters']=_[_0xce6e('0x2d')](_0x30723a['model'],_0x30723a[_0xce6e('0x2a')]);_0xafc6d8['attributes']=_[_0xce6e('0x2d')](_0x30723a[_0xce6e('0x29')],qs[_0xce6e('0x2e')](_0x2bcddd[_0xce6e('0x2a')][_0xce6e('0x2e')]));_0xafc6d8[_0xce6e('0x2f')]=_0xafc6d8[_0xce6e('0x2f')][_0xce6e('0x3b')]?_0xafc6d8[_0xce6e('0x2f')]:_0x30723a[_0xce6e('0x29')];if(_0x2bcddd[_0xce6e('0x2a')][_0xce6e('0x38')]){_0xafc6d8[_0xce6e('0x39')]=[{'all':!![]}];}_0xafc6d8=_['merge']({},_0xafc6d8,_0x2bcddd[_0xce6e('0x37')]);return db['ServicenowConfiguration'][_0xce6e('0x3c')](_0xafc6d8)[_0xce6e('0x21')](handleEntityNotFound(_0x30b8d2,null))['then'](respondWithResult(_0x30b8d2,null))['catch'](handleError(_0x30b8d2,null));};exports[_0xce6e('0x3d')]=function(_0x30f764,_0x2c71aa){return db[_0xce6e('0x26')][_0xce6e('0x3d')](_0x30f764['body'],{})['then'](respondWithResult(_0x2c71aa,0xc9))[_0xce6e('0x3e')](handleError(_0x2c71aa,null));};exports[_0xce6e('0x3f')]=function(_0x236f42,_0xc756c9){if(_0x236f42['body']['id']){delete _0x236f42[_0xce6e('0x40')]['id'];}return db['ServicenowConfiguration'][_0xce6e('0x3c')]({'where':{'id':_0x236f42[_0xce6e('0x41')]['id']}})[_0xce6e('0x21')](handleEntityNotFound(_0xc756c9,null))['then'](saveUpdates(_0x236f42[_0xce6e('0x40')],null))[_0xce6e('0x21')](respondWithResult(_0xc756c9,null))['catch'](handleError(_0xc756c9,null));};exports['destroy']=function(_0x417c29,_0x491d8d){return db[_0xce6e('0x26')]['find']({'where':{'id':_0x417c29[_0xce6e('0x41')]['id']}})['then'](handleEntityNotFound(_0x491d8d,null))[_0xce6e('0x21')](removeEntity(_0x491d8d,null))[_0xce6e('0x3e')](handleError(_0x491d8d,null));};exports[_0xce6e('0x42')]=function(_0x377e64,_0x93139a,_0x259743){var _0x5b4671={};var _0x4e4472={};var _0x57ff99;var _0x590564;return db[_0xce6e('0x26')]['findOne']({'where':{'id':_0x377e64[_0xce6e('0x41')]['id']}})['then'](handleEntityNotFound(_0x93139a,null))[_0xce6e('0x21')](function(_0x41ff60){if(_0x41ff60){_0x57ff99=_0x41ff60;_0x4e4472[_0xce6e('0x29')]=_[_0xce6e('0x2b')](db[_0xce6e('0x43')][_0xce6e('0x27')]);_0x4e4472[_0xce6e('0x2a')]=_[_0xce6e('0x2b')](_0x377e64[_0xce6e('0x2a')]);_0x4e4472['filters']=_[_0xce6e('0x2d')](_0x4e4472[_0xce6e('0x29')],_0x4e4472[_0xce6e('0x2a')]);_0x5b4671[_0xce6e('0x2f')]=_[_0xce6e('0x2d')](_0x4e4472[_0xce6e('0x29')],qs['fields'](_0x377e64['query'][_0xce6e('0x2e')]));_0x5b4671[_0xce6e('0x2f')]=_0x5b4671[_0xce6e('0x2f')][_0xce6e('0x3b')]?_0x5b4671[_0xce6e('0x2f')]:_0x4e4472[_0xce6e('0x29')];_0x5b4671[_0xce6e('0x44')]=qs[_0xce6e('0x31')](_0x377e64['query'][_0xce6e('0x31')]);_0x5b4671[_0xce6e('0x32')]=qs['filters'](_[_0xce6e('0x45')](_0x377e64['query'],_0x4e4472[_0xce6e('0x2c')]));if(_0x377e64['query'][_0xce6e('0x33')]){_0x5b4671[_0xce6e('0x32')]=_[_0xce6e('0x34')](_0x5b4671['where'],{'$or':_['map'](_0x5b4671[_0xce6e('0x2f')],function(_0x5253bb){var _0x4d9e9c={};_0x4d9e9c[_0x5253bb]={'$like':'%'+_0x377e64[_0xce6e('0x2a')][_0xce6e('0x33')]+'%'};return _0x4d9e9c;})});}_0x5b4671=_[_0xce6e('0x34')]({},_0x5b4671,_0x377e64[_0xce6e('0x37')]);return _0x57ff99[_0xce6e('0x42')](_0x5b4671);}})[_0xce6e('0x21')](function(_0x507759){if(_0x507759){_0x590564=_0x507759[_0xce6e('0x3b')];if(!_0x377e64[_0xce6e('0x2a')][_0xce6e('0x30')]('nolimit')){_0x5b4671[_0xce6e('0x1d')]=qs[_0xce6e('0x1d')](_0x377e64[_0xce6e('0x2a')][_0xce6e('0x1d')]);_0x5b4671['offset']=qs[_0xce6e('0x1b')](_0x377e64[_0xce6e('0x2a')][_0xce6e('0x1b')]);}return _0x57ff99['getFields'](_0x5b4671);}})[_0xce6e('0x21')](function(_0x3f0946){if(_0x3f0946){return _0x3f0946?{'count':_0x590564,'rows':_0x3f0946}:null;}})[_0xce6e('0x21')](respondWithResult(_0x93139a,null))['catch'](handleError(_0x93139a,null));};exports['getSubjects']=function(_0x145d56,_0x4ba65,_0x4a6b45){var _0x29dbae={};var _0x159121={};var _0x4ded22;var _0x5b4aef;return db[_0xce6e('0x26')]['findOne']({'where':{'id':_0x145d56[_0xce6e('0x41')]['id']}})[_0xce6e('0x21')](handleEntityNotFound(_0x4ba65,null))['then'](function(_0x26089a){if(_0x26089a){_0x4ded22=_0x26089a;_0x159121[_0xce6e('0x29')]=_[_0xce6e('0x2b')](db[_0xce6e('0x43')][_0xce6e('0x27')]);_0x159121[_0xce6e('0x2a')]=_['keys'](_0x145d56['query']);_0x159121[_0xce6e('0x2c')]=_[_0xce6e('0x2d')](_0x159121['model'],_0x159121[_0xce6e('0x2a')]);_0x29dbae[_0xce6e('0x2f')]=_[_0xce6e('0x2d')](_0x159121[_0xce6e('0x29')],qs[_0xce6e('0x2e')](_0x145d56['query'][_0xce6e('0x2e')]));_0x29dbae[_0xce6e('0x2f')]=_0x29dbae[_0xce6e('0x2f')]['length']?_0x29dbae[_0xce6e('0x2f')]:_0x159121['model'];_0x29dbae[_0xce6e('0x44')]=qs[_0xce6e('0x31')](_0x145d56[_0xce6e('0x2a')][_0xce6e('0x31')]);_0x29dbae[_0xce6e('0x32')]=qs[_0xce6e('0x2c')](_[_0xce6e('0x45')](_0x145d56[_0xce6e('0x2a')],_0x159121['filters']));if(_0x145d56['query'][_0xce6e('0x33')]){_0x29dbae[_0xce6e('0x32')]=_[_0xce6e('0x34')](_0x29dbae[_0xce6e('0x32')],{'$or':_['map'](_0x29dbae[_0xce6e('0x2f')],function(_0x8cc10d){var _0x58c6b0={};_0x58c6b0[_0x8cc10d]={'$like':'%'+_0x145d56[_0xce6e('0x2a')]['filter']+'%'};return _0x58c6b0;})});}_0x29dbae=_[_0xce6e('0x34')]({},_0x29dbae,_0x145d56[_0xce6e('0x37')]);return _0x4ded22[_0xce6e('0x46')](_0x29dbae);}})['then'](function(_0x2ba2e8){if(_0x2ba2e8){_0x5b4aef=_0x2ba2e8[_0xce6e('0x3b')];if(!_0x145d56[_0xce6e('0x2a')][_0xce6e('0x30')](_0xce6e('0x47'))){_0x29dbae['limit']=qs['limit'](_0x145d56[_0xce6e('0x2a')][_0xce6e('0x1d')]);_0x29dbae[_0xce6e('0x1b')]=qs['offset'](_0x145d56['query'][_0xce6e('0x1b')]);}return _0x4ded22['getSubjects'](_0x29dbae);}})[_0xce6e('0x21')](function(_0x4e9912){if(_0x4e9912){return _0x4e9912?{'count':_0x5b4aef,'rows':_0x4e9912}:null;}})[_0xce6e('0x21')](respondWithResult(_0x4ba65,null))[_0xce6e('0x3e')](handleError(_0x4ba65,null));};exports[_0xce6e('0x48')]=function(_0x4dce28,_0x93e0be,_0x553f65){var _0x283c5f={};var _0x3ae5f5={};var _0x3a68c9;var _0x29c81c;return db[_0xce6e('0x26')][_0xce6e('0x49')]({'where':{'id':_0x4dce28[_0xce6e('0x41')]['id']}})[_0xce6e('0x21')](handleEntityNotFound(_0x93e0be,null))['then'](function(_0x52e08a){if(_0x52e08a){_0x3a68c9=_0x52e08a;_0x3ae5f5['model']=_[_0xce6e('0x2b')](db['ServicenowField'][_0xce6e('0x27')]);_0x3ae5f5['query']=_[_0xce6e('0x2b')](_0x4dce28['query']);_0x3ae5f5['filters']=_[_0xce6e('0x2d')](_0x3ae5f5[_0xce6e('0x29')],_0x3ae5f5[_0xce6e('0x2a')]);_0x283c5f[_0xce6e('0x2f')]=_[_0xce6e('0x2d')](_0x3ae5f5[_0xce6e('0x29')],qs['fields'](_0x4dce28[_0xce6e('0x2a')][_0xce6e('0x2e')]));_0x283c5f[_0xce6e('0x2f')]=_0x283c5f['attributes'][_0xce6e('0x3b')]?_0x283c5f['attributes']:_0x3ae5f5[_0xce6e('0x29')];_0x283c5f[_0xce6e('0x44')]=qs['sort'](_0x4dce28[_0xce6e('0x2a')][_0xce6e('0x31')]);_0x283c5f[_0xce6e('0x32')]=qs[_0xce6e('0x2c')](_['pick'](_0x4dce28['query'],_0x3ae5f5['filters']));if(_0x4dce28['query'][_0xce6e('0x33')]){_0x283c5f[_0xce6e('0x32')]=_[_0xce6e('0x34')](_0x283c5f[_0xce6e('0x32')],{'$or':_['map'](_0x283c5f[_0xce6e('0x2f')],function(_0x42f969){var _0x56e8cd={};_0x56e8cd[_0x42f969]={'$like':'%'+_0x4dce28[_0xce6e('0x2a')]['filter']+'%'};return _0x56e8cd;})});}_0x283c5f=_[_0xce6e('0x34')]({},_0x283c5f,_0x4dce28[_0xce6e('0x37')]);return _0x3a68c9['getDescriptions'](_0x283c5f);}})[_0xce6e('0x21')](function(_0x28af5e){if(_0x28af5e){_0x29c81c=_0x28af5e[_0xce6e('0x3b')];if(!_0x4dce28[_0xce6e('0x2a')][_0xce6e('0x30')](_0xce6e('0x47'))){_0x283c5f[_0xce6e('0x1d')]=qs[_0xce6e('0x1d')](_0x4dce28[_0xce6e('0x2a')][_0xce6e('0x1d')]);_0x283c5f[_0xce6e('0x1b')]=qs[_0xce6e('0x1b')](_0x4dce28[_0xce6e('0x2a')]['offset']);}return _0x3a68c9['getDescriptions'](_0x283c5f);}})[_0xce6e('0x21')](function(_0x5d966f){if(_0x5d966f){return _0x5d966f?{'count':_0x29c81c,'rows':_0x5d966f}:null;}})[_0xce6e('0x21')](respondWithResult(_0x93e0be,null))['catch'](handleError(_0x93e0be,null));}; \ No newline at end of file +var _0xe4a8=['find','then','create','body','update','findOne','ServicenowField','order','getFields','nolimit','getSubjects','pick','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','offset','count','set','reject','save','destroy','sendStatus','stack','name','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','type','VIRTUAL','options','ServicenowConfiguration','includeAll','include','findAll','rows','catch','show','params','rawAttributes'];(function(_0x141f29,_0x4acdc5){var _0x234a8f=function(_0x4a0905){while(--_0x4a0905){_0x141f29['push'](_0x141f29['shift']());}};_0x234a8f(++_0x4acdc5);}(_0xe4a8,0x1e7));var _0x8e4a=function(_0x10b757,_0x3cf7ca){_0x10b757=_0x10b757-0x0;var _0x5fffd2=_0xe4a8[_0x10b757];return _0x5fffd2;};'use strict';var emlformat=require(_0x8e4a('0x0'));var rimraf=require(_0x8e4a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e4a('0x2'));var rp=require(_0x8e4a('0x3'));var moment=require('moment');var BPromise=require(_0x8e4a('0x4'));var Mustache=require(_0x8e4a('0x5'));var util=require(_0x8e4a('0x6'));var path=require(_0x8e4a('0x7'));var sox=require(_0x8e4a('0x8'));var csv=require('to-csv');var ejs=require(_0x8e4a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8e4a('0xa'));var squel=require(_0x8e4a('0xb'));var crypto=require('crypto');var jsforce=require(_0x8e4a('0xc'));var deskjs=require(_0x8e4a('0xd'));var toCsv=require(_0x8e4a('0xe'));var querystring=require(_0x8e4a('0xf'));var Papa=require(_0x8e4a('0x10'));var Redis=require(_0x8e4a('0x11'));var authService=require(_0x8e4a('0x12'));var qs=require(_0x8e4a('0x13'));var as=require(_0x8e4a('0x14'));var hardwareService=require(_0x8e4a('0x15'));var logger=require(_0x8e4a('0x16'))('api');var utils=require(_0x8e4a('0x17'));var config=require(_0x8e4a('0x18'));var licenseUtil=require(_0x8e4a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x475af3,_0x1718b6){_0x1718b6=_0x1718b6||0xcc;return function(_0x1fb6f9){if(_0x1fb6f9){return _0x475af3['sendStatus'](_0x1718b6);}return _0x475af3[_0x8e4a('0x1a')](_0x1718b6)[_0x8e4a('0x1b')]();};}function respondWithResult(_0x573b3d,_0xd975eb){_0xd975eb=_0xd975eb||0xc8;return function(_0x2720bd){if(_0x2720bd){return _0x573b3d['status'](_0xd975eb)[_0x8e4a('0x1c')](_0x2720bd);}};}function respondWithFilteredResult(_0x379be1,_0x153894){return function(_0x37af77){if(_0x37af77){var _0x4c6c95=typeof _0x153894['offset']===_0x8e4a('0x1d')&&typeof _0x153894[_0x8e4a('0x1e')]===_0x8e4a('0x1d');var _0x361ef6=_0x37af77['count'];var _0x5dec45=_0x4c6c95?0x0:_0x153894[_0x8e4a('0x1f')];var _0x196ce4=_0x4c6c95?_0x37af77[_0x8e4a('0x20')]:_0x153894[_0x8e4a('0x1f')]+_0x153894[_0x8e4a('0x1e')];var _0x34d8b4;if(_0x196ce4>=_0x361ef6){_0x196ce4=_0x361ef6;_0x34d8b4=0xc8;}else{_0x34d8b4=0xce;}_0x379be1['status'](_0x34d8b4);return _0x379be1[_0x8e4a('0x21')]('Content-Range',_0x5dec45+'-'+_0x196ce4+'/'+_0x361ef6)['json'](_0x37af77);}return null;};}function patchUpdates(_0x47a4ea){return function(_0xf504a5){try{jsonpatch['apply'](_0xf504a5,_0x47a4ea,!![]);}catch(_0x830114){return BPromise[_0x8e4a('0x22')](_0x830114);}return _0xf504a5[_0x8e4a('0x23')]();};}function saveUpdates(_0x44ce10,_0x58f329){return function(_0x1524ed){if(_0x1524ed){return _0x1524ed['update'](_0x44ce10)['then'](function(_0x210258){return _0x210258;});}return null;};}function removeEntity(_0x402862,_0x5a8d95){return function(_0x35a1a3){if(_0x35a1a3){return _0x35a1a3[_0x8e4a('0x24')]()['then'](function(){_0x402862['status'](0xcc)[_0x8e4a('0x1b')]();});}};}function handleEntityNotFound(_0x4b12a7,_0x34fea4){return function(_0xd1b7e6){if(!_0xd1b7e6){_0x4b12a7[_0x8e4a('0x25')](0x194);}return _0xd1b7e6;};}function handleError(_0x147a8f,_0x55cd17){_0x55cd17=_0x55cd17||0x1f4;return function(_0x329667){logger['error'](_0x329667[_0x8e4a('0x26')]);if(_0x329667[_0x8e4a('0x27')]){delete _0x329667['name'];}_0x147a8f[_0x8e4a('0x1a')](_0x55cd17)['send'](_0x329667);};}exports['index']=function(_0x50993c,_0xd7ecfc){var _0x2a8aef={},_0x39dece={},_0x194a55={'count':0x0,'rows':[]};var _0x4f8189=_[_0x8e4a('0x28')](db['ServicenowConfiguration']['rawAttributes'],function(_0x39947b){return{'name':_0x39947b['fieldName'],'type':_0x39947b['type']['key']};});_0x39dece['model']=_[_0x8e4a('0x28')](_0x4f8189,_0x8e4a('0x27'));_0x39dece[_0x8e4a('0x29')]=_[_0x8e4a('0x2a')](_0x50993c[_0x8e4a('0x29')]);_0x39dece['filters']=_[_0x8e4a('0x2b')](_0x39dece[_0x8e4a('0x2c')],_0x39dece[_0x8e4a('0x29')]);_0x2a8aef[_0x8e4a('0x2d')]=_[_0x8e4a('0x2b')](_0x39dece[_0x8e4a('0x2c')],qs[_0x8e4a('0x2e')](_0x50993c['query'][_0x8e4a('0x2e')]));_0x2a8aef[_0x8e4a('0x2d')]=_0x2a8aef[_0x8e4a('0x2d')][_0x8e4a('0x2f')]?_0x2a8aef['attributes']:_0x39dece['model'];if(!_0x50993c['query'][_0x8e4a('0x30')]('nolimit')){_0x2a8aef[_0x8e4a('0x1e')]=qs[_0x8e4a('0x1e')](_0x50993c[_0x8e4a('0x29')]['limit']);_0x2a8aef[_0x8e4a('0x1f')]=qs['offset'](_0x50993c[_0x8e4a('0x29')]['offset']);}_0x2a8aef['order']=qs[_0x8e4a('0x31')](_0x50993c[_0x8e4a('0x29')]['sort']);_0x2a8aef[_0x8e4a('0x32')]=qs['filters'](_['pick'](_0x50993c[_0x8e4a('0x29')],_0x39dece[_0x8e4a('0x33')]),_0x4f8189);if(_0x50993c[_0x8e4a('0x29')][_0x8e4a('0x34')]){_0x2a8aef['where']=_[_0x8e4a('0x35')](_0x2a8aef[_0x8e4a('0x32')],{'$or':_['map'](_0x4f8189,function(_0x47f529){if(_0x47f529[_0x8e4a('0x36')]!==_0x8e4a('0x37')){var _0x2097fe={};_0x2097fe[_0x47f529['name']]={'$like':'%'+_0x50993c['query'][_0x8e4a('0x34')]+'%'};return _0x2097fe;}})});}_0x2a8aef=_[_0x8e4a('0x35')]({},_0x2a8aef,_0x50993c[_0x8e4a('0x38')]);var _0x120bc9={'where':_0x2a8aef['where']};return db[_0x8e4a('0x39')][_0x8e4a('0x20')](_0x120bc9)['then'](function(_0xd1d840){_0x194a55['count']=_0xd1d840;if(_0x50993c[_0x8e4a('0x29')][_0x8e4a('0x3a')]){_0x2a8aef[_0x8e4a('0x3b')]=[{'all':!![]}];}return db[_0x8e4a('0x39')][_0x8e4a('0x3c')](_0x2a8aef);})['then'](function(_0x3f5a93){_0x194a55[_0x8e4a('0x3d')]=_0x3f5a93;return _0x194a55;})['then'](respondWithFilteredResult(_0xd7ecfc,_0x2a8aef))[_0x8e4a('0x3e')](handleError(_0xd7ecfc,null));};exports[_0x8e4a('0x3f')]=function(_0x50f4b8,_0x2a2c8d){var _0x24156d={'raw':![],'where':{'id':_0x50f4b8[_0x8e4a('0x40')]['id']}},_0x2913b9={};_0x2913b9['model']=_[_0x8e4a('0x2a')](db[_0x8e4a('0x39')][_0x8e4a('0x41')]);_0x2913b9['query']=_['keys'](_0x50f4b8['query']);_0x2913b9[_0x8e4a('0x33')]=_[_0x8e4a('0x2b')](_0x2913b9['model'],_0x2913b9[_0x8e4a('0x29')]);_0x24156d[_0x8e4a('0x2d')]=_[_0x8e4a('0x2b')](_0x2913b9['model'],qs[_0x8e4a('0x2e')](_0x50f4b8[_0x8e4a('0x29')][_0x8e4a('0x2e')]));_0x24156d[_0x8e4a('0x2d')]=_0x24156d['attributes'][_0x8e4a('0x2f')]?_0x24156d[_0x8e4a('0x2d')]:_0x2913b9[_0x8e4a('0x2c')];if(_0x50f4b8[_0x8e4a('0x29')][_0x8e4a('0x3a')]){_0x24156d['include']=[{'all':!![]}];}_0x24156d=_[_0x8e4a('0x35')]({},_0x24156d,_0x50f4b8['options']);return db['ServicenowConfiguration'][_0x8e4a('0x42')](_0x24156d)[_0x8e4a('0x43')](handleEntityNotFound(_0x2a2c8d,null))['then'](respondWithResult(_0x2a2c8d,null))[_0x8e4a('0x3e')](handleError(_0x2a2c8d,null));};exports[_0x8e4a('0x44')]=function(_0x60ba0,_0x243a91){return db['ServicenowConfiguration'][_0x8e4a('0x44')](_0x60ba0[_0x8e4a('0x45')],{})[_0x8e4a('0x43')](respondWithResult(_0x243a91,0xc9))[_0x8e4a('0x3e')](handleError(_0x243a91,null));};exports[_0x8e4a('0x46')]=function(_0x3d69b3,_0x27139c){if(_0x3d69b3[_0x8e4a('0x45')]['id']){delete _0x3d69b3[_0x8e4a('0x45')]['id'];}return db['ServicenowConfiguration'][_0x8e4a('0x42')]({'where':{'id':_0x3d69b3[_0x8e4a('0x40')]['id']}})[_0x8e4a('0x43')](handleEntityNotFound(_0x27139c,null))['then'](saveUpdates(_0x3d69b3[_0x8e4a('0x45')],null))[_0x8e4a('0x43')](respondWithResult(_0x27139c,null))[_0x8e4a('0x3e')](handleError(_0x27139c,null));};exports['destroy']=function(_0x1f239f,_0x40f7c9){return db[_0x8e4a('0x39')][_0x8e4a('0x42')]({'where':{'id':_0x1f239f[_0x8e4a('0x40')]['id']}})['then'](handleEntityNotFound(_0x40f7c9,null))[_0x8e4a('0x43')](removeEntity(_0x40f7c9,null))[_0x8e4a('0x3e')](handleError(_0x40f7c9,null));};exports['getFields']=function(_0x55d73e,_0x4692ad,_0x276e20){var _0x28b1b1={};var _0xef7674={};var _0x4cb36e;var _0x11766f;return db[_0x8e4a('0x39')][_0x8e4a('0x47')]({'where':{'id':_0x55d73e[_0x8e4a('0x40')]['id']}})[_0x8e4a('0x43')](handleEntityNotFound(_0x4692ad,null))[_0x8e4a('0x43')](function(_0x1e5f76){if(_0x1e5f76){_0x4cb36e=_0x1e5f76;_0xef7674[_0x8e4a('0x2c')]=_['keys'](db[_0x8e4a('0x48')][_0x8e4a('0x41')]);_0xef7674[_0x8e4a('0x29')]=_[_0x8e4a('0x2a')](_0x55d73e[_0x8e4a('0x29')]);_0xef7674[_0x8e4a('0x33')]=_[_0x8e4a('0x2b')](_0xef7674[_0x8e4a('0x2c')],_0xef7674[_0x8e4a('0x29')]);_0x28b1b1[_0x8e4a('0x2d')]=_[_0x8e4a('0x2b')](_0xef7674[_0x8e4a('0x2c')],qs['fields'](_0x55d73e[_0x8e4a('0x29')]['fields']));_0x28b1b1[_0x8e4a('0x2d')]=_0x28b1b1['attributes'][_0x8e4a('0x2f')]?_0x28b1b1[_0x8e4a('0x2d')]:_0xef7674[_0x8e4a('0x2c')];_0x28b1b1[_0x8e4a('0x49')]=qs[_0x8e4a('0x31')](_0x55d73e[_0x8e4a('0x29')][_0x8e4a('0x31')]);_0x28b1b1[_0x8e4a('0x32')]=qs[_0x8e4a('0x33')](_['pick'](_0x55d73e[_0x8e4a('0x29')],_0xef7674[_0x8e4a('0x33')]));if(_0x55d73e[_0x8e4a('0x29')][_0x8e4a('0x34')]){_0x28b1b1[_0x8e4a('0x32')]=_[_0x8e4a('0x35')](_0x28b1b1[_0x8e4a('0x32')],{'$or':_[_0x8e4a('0x28')](_0x28b1b1['attributes'],function(_0x373365){var _0x5da6f3={};_0x5da6f3[_0x373365]={'$like':'%'+_0x55d73e[_0x8e4a('0x29')][_0x8e4a('0x34')]+'%'};return _0x5da6f3;})});}_0x28b1b1=_[_0x8e4a('0x35')]({},_0x28b1b1,_0x55d73e[_0x8e4a('0x38')]);return _0x4cb36e[_0x8e4a('0x4a')](_0x28b1b1);}})[_0x8e4a('0x43')](function(_0x2bbb5a){if(_0x2bbb5a){_0x11766f=_0x2bbb5a[_0x8e4a('0x2f')];if(!_0x55d73e[_0x8e4a('0x29')][_0x8e4a('0x30')](_0x8e4a('0x4b'))){_0x28b1b1[_0x8e4a('0x1e')]=qs['limit'](_0x55d73e[_0x8e4a('0x29')][_0x8e4a('0x1e')]);_0x28b1b1[_0x8e4a('0x1f')]=qs[_0x8e4a('0x1f')](_0x55d73e['query'][_0x8e4a('0x1f')]);}return _0x4cb36e[_0x8e4a('0x4a')](_0x28b1b1);}})[_0x8e4a('0x43')](function(_0x267ad1){if(_0x267ad1){return _0x267ad1?{'count':_0x11766f,'rows':_0x267ad1}:null;}})[_0x8e4a('0x43')](respondWithResult(_0x4692ad,null))[_0x8e4a('0x3e')](handleError(_0x4692ad,null));};exports[_0x8e4a('0x4c')]=function(_0x35267f,_0x13b7aa,_0x53c828){var _0x17b27f={};var _0x4e1de7={};var _0x191681;var _0x4fae89;return db[_0x8e4a('0x39')][_0x8e4a('0x47')]({'where':{'id':_0x35267f[_0x8e4a('0x40')]['id']}})['then'](handleEntityNotFound(_0x13b7aa,null))[_0x8e4a('0x43')](function(_0x25c52f){if(_0x25c52f){_0x191681=_0x25c52f;_0x4e1de7[_0x8e4a('0x2c')]=_[_0x8e4a('0x2a')](db[_0x8e4a('0x48')][_0x8e4a('0x41')]);_0x4e1de7[_0x8e4a('0x29')]=_[_0x8e4a('0x2a')](_0x35267f[_0x8e4a('0x29')]);_0x4e1de7[_0x8e4a('0x33')]=_[_0x8e4a('0x2b')](_0x4e1de7['model'],_0x4e1de7[_0x8e4a('0x29')]);_0x17b27f['attributes']=_[_0x8e4a('0x2b')](_0x4e1de7[_0x8e4a('0x2c')],qs['fields'](_0x35267f[_0x8e4a('0x29')][_0x8e4a('0x2e')]));_0x17b27f[_0x8e4a('0x2d')]=_0x17b27f[_0x8e4a('0x2d')]['length']?_0x17b27f[_0x8e4a('0x2d')]:_0x4e1de7['model'];_0x17b27f[_0x8e4a('0x49')]=qs['sort'](_0x35267f[_0x8e4a('0x29')]['sort']);_0x17b27f[_0x8e4a('0x32')]=qs['filters'](_[_0x8e4a('0x4d')](_0x35267f[_0x8e4a('0x29')],_0x4e1de7[_0x8e4a('0x33')]));if(_0x35267f[_0x8e4a('0x29')][_0x8e4a('0x34')]){_0x17b27f[_0x8e4a('0x32')]=_['merge'](_0x17b27f[_0x8e4a('0x32')],{'$or':_[_0x8e4a('0x28')](_0x17b27f[_0x8e4a('0x2d')],function(_0x2dadb4){var _0x455381={};_0x455381[_0x2dadb4]={'$like':'%'+_0x35267f[_0x8e4a('0x29')]['filter']+'%'};return _0x455381;})});}_0x17b27f=_[_0x8e4a('0x35')]({},_0x17b27f,_0x35267f['options']);return _0x191681[_0x8e4a('0x4c')](_0x17b27f);}})[_0x8e4a('0x43')](function(_0x54069f){if(_0x54069f){_0x4fae89=_0x54069f['length'];if(!_0x35267f[_0x8e4a('0x29')][_0x8e4a('0x30')]('nolimit')){_0x17b27f['limit']=qs['limit'](_0x35267f[_0x8e4a('0x29')][_0x8e4a('0x1e')]);_0x17b27f[_0x8e4a('0x1f')]=qs['offset'](_0x35267f[_0x8e4a('0x29')][_0x8e4a('0x1f')]);}return _0x191681[_0x8e4a('0x4c')](_0x17b27f);}})[_0x8e4a('0x43')](function(_0x5a05af){if(_0x5a05af){return _0x5a05af?{'count':_0x4fae89,'rows':_0x5a05af}:null;}})['then'](respondWithResult(_0x13b7aa,null))[_0x8e4a('0x3e')](handleError(_0x13b7aa,null));};exports[_0x8e4a('0x4e')]=function(_0x15539a,_0x552429,_0x8811ea){var _0x19354f={};var _0x1c1ae5={};var _0x490bba;var _0x15b09e;return db[_0x8e4a('0x39')][_0x8e4a('0x47')]({'where':{'id':_0x15539a[_0x8e4a('0x40')]['id']}})[_0x8e4a('0x43')](handleEntityNotFound(_0x552429,null))[_0x8e4a('0x43')](function(_0x1afb18){if(_0x1afb18){_0x490bba=_0x1afb18;_0x1c1ae5[_0x8e4a('0x2c')]=_[_0x8e4a('0x2a')](db['ServicenowField'][_0x8e4a('0x41')]);_0x1c1ae5[_0x8e4a('0x29')]=_['keys'](_0x15539a[_0x8e4a('0x29')]);_0x1c1ae5[_0x8e4a('0x33')]=_[_0x8e4a('0x2b')](_0x1c1ae5[_0x8e4a('0x2c')],_0x1c1ae5[_0x8e4a('0x29')]);_0x19354f[_0x8e4a('0x2d')]=_['intersection'](_0x1c1ae5[_0x8e4a('0x2c')],qs[_0x8e4a('0x2e')](_0x15539a[_0x8e4a('0x29')][_0x8e4a('0x2e')]));_0x19354f[_0x8e4a('0x2d')]=_0x19354f[_0x8e4a('0x2d')][_0x8e4a('0x2f')]?_0x19354f[_0x8e4a('0x2d')]:_0x1c1ae5[_0x8e4a('0x2c')];_0x19354f[_0x8e4a('0x49')]=qs[_0x8e4a('0x31')](_0x15539a[_0x8e4a('0x29')][_0x8e4a('0x31')]);_0x19354f[_0x8e4a('0x32')]=qs[_0x8e4a('0x33')](_['pick'](_0x15539a['query'],_0x1c1ae5['filters']));if(_0x15539a[_0x8e4a('0x29')][_0x8e4a('0x34')]){_0x19354f[_0x8e4a('0x32')]=_[_0x8e4a('0x35')](_0x19354f['where'],{'$or':_['map'](_0x19354f[_0x8e4a('0x2d')],function(_0x2b0c0e){var _0x58f7e0={};_0x58f7e0[_0x2b0c0e]={'$like':'%'+_0x15539a[_0x8e4a('0x29')]['filter']+'%'};return _0x58f7e0;})});}_0x19354f=_[_0x8e4a('0x35')]({},_0x19354f,_0x15539a[_0x8e4a('0x38')]);return _0x490bba[_0x8e4a('0x4e')](_0x19354f);}})[_0x8e4a('0x43')](function(_0xdcb9cf){if(_0xdcb9cf){_0x15b09e=_0xdcb9cf[_0x8e4a('0x2f')];if(!_0x15539a[_0x8e4a('0x29')][_0x8e4a('0x30')](_0x8e4a('0x4b'))){_0x19354f['limit']=qs[_0x8e4a('0x1e')](_0x15539a[_0x8e4a('0x29')][_0x8e4a('0x1e')]);_0x19354f[_0x8e4a('0x1f')]=qs[_0x8e4a('0x1f')](_0x15539a[_0x8e4a('0x29')]['offset']);}return _0x490bba[_0x8e4a('0x4e')](_0x19354f);}})['then'](function(_0x3f0849){if(_0x3f0849){return _0x3f0849?{'count':_0x15b09e,'rows':_0x3f0849}:null;}})['then'](respondWithResult(_0x552429,null))[_0x8e4a('0x3e')](handleError(_0x552429,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 6073967..e6bf2d3 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 _0x4dd3=['rimraf','../../config/environment','exports','define','ServicenowConfiguration','lodash','util','../../config/logger','bluebird','path'];(function(_0x5cb15c,_0x31bb89){var _0x334c01=function(_0x4a7eac){while(--_0x4a7eac){_0x5cb15c['push'](_0x5cb15c['shift']());}};_0x334c01(++_0x31bb89);}(_0x4dd3,0xf5));var _0x34dd=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0x4dd3[_0x2d994d];return _0xd54be4;};'use strict';var _=require(_0x34dd('0x0'));var util=require(_0x34dd('0x1'));var logger=require(_0x34dd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x34dd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34dd('0x4'));var rimraf=require(_0x34dd('0x5'));var config=require(_0x34dd('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x34dd('0x7')]=function(_0x704165,_0x37ce1d){return _0x704165[_0x34dd('0x8')](_0x34dd('0x9'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0a3=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','util'];(function(_0x4e11d5,_0x1ce514){var _0x5e4e4c=function(_0xbee63d){while(--_0xbee63d){_0x4e11d5['push'](_0x4e11d5['shift']());}};_0x5e4e4c(++_0x1ce514);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x53e93b,_0x792a08){_0x53e93b=_0x53e93b-0x0;var _0x356bad=_0xa0a3[_0x53e93b];return _0x356bad;};'use strict';var _=require('lodash');var util=require(_0x3a0a('0x0'));var logger=require(_0x3a0a('0x1'))('api');var moment=require(_0x3a0a('0x2'));var BPromise=require(_0x3a0a('0x3'));var rp=require(_0x3a0a('0x4'));var fs=require('fs');var path=require(_0x3a0a('0x5'));var rimraf=require(_0x3a0a('0x6'));var config=require(_0x3a0a('0x7'));var attributes=require(_0x3a0a('0x8'));module[_0x3a0a('0x9')]=function(_0xa047cf,_0x3d7dc7){return _0xa047cf[_0x3a0a('0xa')](_0x3a0a('0xb'),attributes,{'tableName':_0x3a0a('0xc'),'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 6ec00aa..5c0ecdd 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 _0xbd5b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','code','error','message','info','catch','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x4bb97d,_0x582088){var _0x4d54a4=function(_0x3c7320){while(--_0x3c7320){_0x4bb97d['push'](_0x4bb97d['shift']());}};_0x4d54a4(++_0x582088);}(_0xbd5b,0x1b8));var _0xbbd5=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xbd5b[_0xe73080];return _0x12cbc4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbbd5('0x0'));var BPromise=require(_0xbbd5('0x1'));var rs=require(_0xbbd5('0x2'));var fs=require('fs');var Redis=require(_0xbbd5('0x3'));var db=require(_0xbbd5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbbd5('0x5'))(_0xbbd5('0x6'));var config=require(_0xbbd5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbbd5('0x8')][_0xbbd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3890b0,_0x3a0526,_0x5ef2c4){return new BPromise(function(_0x3ca3c3,_0x1b091b){return client[_0xbbd5('0xa')](_0x3890b0,_0x5ef2c4)[_0xbbd5('0xb')](function(_0x501fda){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x3a0526,_0xbbd5('0xc'));logger[_0xbbd5('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x3a0526,_0xbbd5('0xc'),JSON['stringify'](_0x501fda));if(_0x501fda['error']){if(_0x501fda['error'][_0xbbd5('0xe')]===0x1f4){logger[_0xbbd5('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3a0526,_0x501fda[_0xbbd5('0xf')]['message']);return _0x1b091b(_0x501fda['error']['message']);}logger[_0xbbd5('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3a0526,_0x501fda['error'][_0xbbd5('0x10')]);return _0x3ca3c3(_0x501fda['error']['message']);}else{logger[_0xbbd5('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3a0526,_0xbbd5('0xc'));_0x3ca3c3(_0x501fda['result']['message']);}})[_0xbbd5('0x12')](function(_0x58d31a){logger['error'](_0xbbd5('0x13'),_0x3a0526,_0x58d31a);_0x1b091b(_0x58d31a);});});} \ No newline at end of file +var _0xf794=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','request\x20sent','result','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0xf794,0x150));var _0x4f79=function(_0x3ce939,_0x2adc64){_0x3ce939=_0x3ce939-0x0;var _0x420ad2=_0xf794[_0x3ce939];return _0x420ad2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4f79('0x0'));var BPromise=require(_0x4f79('0x1'));var rs=require(_0x4f79('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f79('0x3'))['db'];var utils=require(_0x4f79('0x4'));var logger=require(_0x4f79('0x5'))(_0x4f79('0x6'));var config=require(_0x4f79('0x7'));var jayson=require(_0x4f79('0x8'));var client=jayson['client'][_0x4f79('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16bb36,_0x49d46e,_0x50a969){return new BPromise(function(_0x5ba9ea,_0x3000be){return client['request'](_0x16bb36,_0x50a969)[_0x4f79('0xa')](function(_0x3c11de){logger[_0x4f79('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x49d46e,'request\x20sent');logger[_0x4f79('0xc')](_0x4f79('0xd'),_0x49d46e,'request\x20sent',JSON[_0x4f79('0xe')](_0x3c11de));if(_0x3c11de['error']){if(_0x3c11de['error']['code']===0x1f4){logger[_0x4f79('0xf')](_0x4f79('0x10'),_0x49d46e,_0x3c11de[_0x4f79('0xf')][_0x4f79('0x11')]);return _0x3000be(_0x3c11de[_0x4f79('0xf')][_0x4f79('0x11')]);}logger[_0x4f79('0xf')](_0x4f79('0x10'),_0x49d46e,_0x3c11de['error'][_0x4f79('0x11')]);return _0x5ba9ea(_0x3c11de[_0x4f79('0xf')][_0x4f79('0x11')]);}else{logger[_0x4f79('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x49d46e,_0x4f79('0x12'));_0x5ba9ea(_0x3c11de[_0x4f79('0x13')]['message']);}})['catch'](function(_0x1d36d1){logger[_0x4f79('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x49d46e,_0x1d36d1);_0x3000be(_0x1d36d1);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index b46b678..135aae9 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 _0x0fb6=['express','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','isAuthenticated','index','get','/:id','post','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x27f5de,_0x577080){var _0x484149=function(_0x7e9adb){while(--_0x7e9adb){_0x27f5de['push'](_0x27f5de['shift']());}};_0x484149(++_0x577080);}(_0x0fb6,0x19d));var _0x60fb=function(_0x477744,_0x3f7bcb){_0x477744=_0x477744-0x0;var _0x2c838c=_0x0fb6[_0x477744];return _0x2c838c;};'use strict';var multer=require('multer');var util=require(_0x60fb('0x0'));var path=require(_0x60fb('0x1'));var timeout=require(_0x60fb('0x2'));var express=require(_0x60fb('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x60fb('0x4'));var interaction=require(_0x60fb('0x5'));var config=require('../../config/environment');var controller=require(_0x60fb('0x6'));router['get']('/',auth[_0x60fb('0x7')](),controller[_0x60fb('0x8')]);router[_0x60fb('0x9')](_0x60fb('0xa'),auth[_0x60fb('0x7')](),controller['show']);router[_0x60fb('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x60fb('0xa'),auth['isAuthenticated'](),controller[_0x60fb('0xc')]);router[_0x60fb('0xd')]('/:id',auth[_0x60fb('0x7')](),controller[_0x60fb('0xe')]);module[_0x60fb('0xf')]=router; \ No newline at end of file +var _0x67b2=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67b2,0x66));var _0x267b=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0x67b2[_0x1ed116];return _0x574066;};'use strict';var multer=require(_0x267b('0x0'));var util=require(_0x267b('0x1'));var path=require(_0x267b('0x2'));var timeout=require(_0x267b('0x3'));var express=require('express');var router=express[_0x267b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x267b('0x5'));var interaction=require(_0x267b('0x6'));var config=require(_0x267b('0x7'));var controller=require(_0x267b('0x8'));router[_0x267b('0x9')]('/',auth[_0x267b('0xa')](),controller['index']);router[_0x267b('0x9')](_0x267b('0xb'),auth[_0x267b('0xa')](),controller[_0x267b('0xc')]);router[_0x267b('0xd')]('/',auth[_0x267b('0xa')](),controller[_0x267b('0xe')]);router[_0x267b('0xf')](_0x267b('0xb'),auth[_0x267b('0xa')](),controller[_0x267b('0x10')]);router[_0x267b('0x11')](_0x267b('0xb'),auth[_0x267b('0xa')](),controller[_0x267b('0x12')]);module[_0x267b('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 85a70cf..65fcd8c 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 _0x7825=['variable','BOOLEAN','sequelize','exports','string','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x3221e0,_0x230885){var _0x30a500=function(_0x532ebb){while(--_0x532ebb){_0x3221e0['push'](_0x3221e0['shift']());}};_0x30a500(++_0x230885);}(_0x7825,0x1e2));var _0x5782=function(_0x492f45,_0x4bbf55){_0x492f45=_0x492f45-0x0;var _0x297b67=_0x7825[_0x492f45];return _0x297b67;};'use strict';var Sequelize=require(_0x5782('0x0'));module[_0x5782('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5782('0x2'),'variable',_0x5782('0x3'),_0x5782('0x4'),_0x5782('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5782('0x6')]},'key':{'type':Sequelize[_0x5782('0x6')]},'keyType':{'type':Sequelize[_0x5782('0x7')](_0x5782('0x2'),_0x5782('0x8'),_0x5782('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5782('0x6')]},'nameField':{'type':Sequelize[_0x5782('0x6')]},'customField':{'type':Sequelize[_0x5782('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5782('0x6')]}}; \ No newline at end of file +var _0x2f79=['string','sequelize','exports','ENUM','variable','customVariable','STRING'];(function(_0x23e33d,_0x31c8c8){var _0x818fc=function(_0x19f33e){while(--_0x19f33e){_0x23e33d['push'](_0x23e33d['shift']());}};_0x818fc(++_0x31c8c8);}(_0x2f79,0x104));var _0x92f7=function(_0x5bd647,_0x8bad63){_0x5bd647=_0x5bd647-0x0;var _0x3ca6a2=_0x2f79[_0x5bd647];return _0x3ca6a2;};'use strict';var Sequelize=require(_0x92f7('0x0'));module[_0x92f7('0x1')]={'type':{'type':Sequelize[_0x92f7('0x2')]('string',_0x92f7('0x3'),_0x92f7('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x92f7('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x92f7('0x6'),_0x92f7('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x92f7('0x5')]},'idField':{'type':Sequelize[_0x92f7('0x5')]},'nameField':{'type':Sequelize[_0x92f7('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x92f7('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index f89ae05..b394c8f 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 _0x4aa5=['type','VIRTUAL','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','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','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','map','ServicenowField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x1e58a9,_0x39ce5a){var _0x278bb0=function(_0x22a479){while(--_0x22a479){_0x1e58a9['push'](_0x1e58a9['shift']());}};_0x278bb0(++_0x39ce5a);}(_0x4aa5,0x141));var _0x54aa=function(_0x517da2,_0x3be777){_0x517da2=_0x517da2-0x0;var _0x2c1acc=_0x4aa5[_0x517da2];return _0x2c1acc;};'use strict';var emlformat=require(_0x54aa('0x0'));var rimraf=require(_0x54aa('0x1'));var zipdir=require(_0x54aa('0x2'));var jsonpatch=require(_0x54aa('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x54aa('0x4'));var Mustache=require('mustache');var util=require(_0x54aa('0x5'));var path=require(_0x54aa('0x6'));var sox=require('sox');var csv=require(_0x54aa('0x7'));var ejs=require(_0x54aa('0x8'));var fs=require('fs');var fs_extra=require(_0x54aa('0x9'));var _=require(_0x54aa('0xa'));var squel=require(_0x54aa('0xb'));var crypto=require(_0x54aa('0xc'));var jsforce=require(_0x54aa('0xd'));var deskjs=require(_0x54aa('0xe'));var toCsv=require(_0x54aa('0x7'));var querystring=require(_0x54aa('0xf'));var Papa=require('papaparse');var Redis=require(_0x54aa('0x10'));var authService=require(_0x54aa('0x11'));var qs=require(_0x54aa('0x12'));var as=require(_0x54aa('0x13'));var hardwareService=require(_0x54aa('0x14'));var logger=require(_0x54aa('0x15'))(_0x54aa('0x16'));var utils=require(_0x54aa('0x17'));var config=require(_0x54aa('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x54aa('0x19'))['db'];function respondWithStatusCode(_0x432074,_0x25b0f2){_0x25b0f2=_0x25b0f2||0xcc;return function(_0x1f9537){if(_0x1f9537){return _0x432074[_0x54aa('0x1a')](_0x25b0f2);}return _0x432074[_0x54aa('0x1b')](_0x25b0f2)['end']();};}function respondWithResult(_0x4f17d4,_0x5ee54e){_0x5ee54e=_0x5ee54e||0xc8;return function(_0x28675e){if(_0x28675e){return _0x4f17d4['status'](_0x5ee54e)['json'](_0x28675e);}};}function respondWithFilteredResult(_0x141357,_0x23fa67){return function(_0x55c53b){if(_0x55c53b){var _0x1cf6c7=typeof _0x23fa67[_0x54aa('0x1c')]===_0x54aa('0x1d')&&typeof _0x23fa67[_0x54aa('0x1e')]===_0x54aa('0x1d');var _0x2bf0d1=_0x55c53b[_0x54aa('0x1f')];var _0x10b43d=_0x1cf6c7?0x0:_0x23fa67[_0x54aa('0x1c')];var _0x1da582=_0x1cf6c7?_0x55c53b[_0x54aa('0x1f')]:_0x23fa67[_0x54aa('0x1c')]+_0x23fa67[_0x54aa('0x1e')];var _0x4276f5;if(_0x1da582>=_0x2bf0d1){_0x1da582=_0x2bf0d1;_0x4276f5=0xc8;}else{_0x4276f5=0xce;}_0x141357[_0x54aa('0x1b')](_0x4276f5);return _0x141357[_0x54aa('0x20')](_0x54aa('0x21'),_0x10b43d+'-'+_0x1da582+'/'+_0x2bf0d1)[_0x54aa('0x22')](_0x55c53b);}return null;};}function patchUpdates(_0x364666){return function(_0x3a067b){try{jsonpatch[_0x54aa('0x23')](_0x3a067b,_0x364666,!![]);}catch(_0x208ebe){return BPromise[_0x54aa('0x24')](_0x208ebe);}return _0x3a067b['save']();};}function saveUpdates(_0x30ba84,_0x4326ac){return function(_0x12b2c9){if(_0x12b2c9){return _0x12b2c9[_0x54aa('0x25')](_0x30ba84)[_0x54aa('0x26')](function(_0x260769){return _0x260769;});}return null;};}function removeEntity(_0xd638d1,_0x2f880a){return function(_0x1e1716){if(_0x1e1716){return _0x1e1716[_0x54aa('0x27')]()[_0x54aa('0x26')](function(){_0xd638d1[_0x54aa('0x1b')](0xcc)[_0x54aa('0x28')]();});}};}function handleEntityNotFound(_0xa56f3f,_0x388af5){return function(_0x2fb403){if(!_0x2fb403){_0xa56f3f['sendStatus'](0x194);}return _0x2fb403;};}function handleError(_0x2d37f8,_0x32acb6){_0x32acb6=_0x32acb6||0x1f4;return function(_0x15a244){logger[_0x54aa('0x29')](_0x15a244[_0x54aa('0x2a')]);if(_0x15a244['name']){delete _0x15a244[_0x54aa('0x2b')];}_0x2d37f8[_0x54aa('0x1b')](_0x32acb6)['send'](_0x15a244);};}exports['index']=function(_0x1f7969,_0x4a5934){var _0x5f43e4={},_0x2fbda6={},_0x47cb8f={'count':0x0,'rows':[]};var _0x358f13=_[_0x54aa('0x2c')](db[_0x54aa('0x2d')][_0x54aa('0x2e')],function(_0x5904ac){return{'name':_0x5904ac[_0x54aa('0x2f')],'type':_0x5904ac['type'][_0x54aa('0x30')]};});_0x2fbda6[_0x54aa('0x31')]=_['map'](_0x358f13,_0x54aa('0x2b'));_0x2fbda6[_0x54aa('0x32')]=_[_0x54aa('0x33')](_0x1f7969[_0x54aa('0x32')]);_0x2fbda6[_0x54aa('0x34')]=_[_0x54aa('0x35')](_0x2fbda6[_0x54aa('0x31')],_0x2fbda6[_0x54aa('0x32')]);_0x5f43e4[_0x54aa('0x36')]=_['intersection'](_0x2fbda6['model'],qs[_0x54aa('0x37')](_0x1f7969[_0x54aa('0x32')][_0x54aa('0x37')]));_0x5f43e4['attributes']=_0x5f43e4[_0x54aa('0x36')]['length']?_0x5f43e4[_0x54aa('0x36')]:_0x2fbda6[_0x54aa('0x31')];if(!_0x1f7969[_0x54aa('0x32')][_0x54aa('0x38')](_0x54aa('0x39'))){_0x5f43e4[_0x54aa('0x1e')]=qs[_0x54aa('0x1e')](_0x1f7969[_0x54aa('0x32')][_0x54aa('0x1e')]);_0x5f43e4[_0x54aa('0x1c')]=qs['offset'](_0x1f7969[_0x54aa('0x32')][_0x54aa('0x1c')]);}_0x5f43e4[_0x54aa('0x3a')]=qs['sort'](_0x1f7969['query'][_0x54aa('0x3b')]);_0x5f43e4[_0x54aa('0x3c')]=qs[_0x54aa('0x34')](_[_0x54aa('0x3d')](_0x1f7969[_0x54aa('0x32')],_0x2fbda6['filters']),_0x358f13);if(_0x1f7969[_0x54aa('0x32')][_0x54aa('0x3e')]){_0x5f43e4[_0x54aa('0x3c')]=_[_0x54aa('0x3f')](_0x5f43e4[_0x54aa('0x3c')],{'$or':_[_0x54aa('0x2c')](_0x358f13,function(_0x60e4c6){if(_0x60e4c6[_0x54aa('0x40')]!==_0x54aa('0x41')){var _0x418e2f={};_0x418e2f[_0x60e4c6[_0x54aa('0x2b')]]={'$like':'%'+_0x1f7969[_0x54aa('0x32')]['filter']+'%'};return _0x418e2f;}})});}_0x5f43e4=_['merge']({},_0x5f43e4,_0x1f7969['options']);var _0xfb835={'where':_0x5f43e4[_0x54aa('0x3c')]};return db['ServicenowField'][_0x54aa('0x1f')](_0xfb835)[_0x54aa('0x26')](function(_0x35890f){_0x47cb8f[_0x54aa('0x1f')]=_0x35890f;if(_0x1f7969[_0x54aa('0x32')]['includeAll']){_0x5f43e4[_0x54aa('0x42')]=[{'all':!![]}];}return db[_0x54aa('0x2d')][_0x54aa('0x43')](_0x5f43e4);})['then'](function(_0x32e936){_0x47cb8f[_0x54aa('0x44')]=_0x32e936;return _0x47cb8f;})[_0x54aa('0x26')](respondWithFilteredResult(_0x4a5934,_0x5f43e4))['catch'](handleError(_0x4a5934,null));};exports[_0x54aa('0x45')]=function(_0x3ee3df,_0x5f443e){var _0xce4968={'raw':!![],'where':{'id':_0x3ee3df[_0x54aa('0x46')]['id']}},_0x45515c={};_0x45515c[_0x54aa('0x31')]=_[_0x54aa('0x33')](db[_0x54aa('0x2d')][_0x54aa('0x2e')]);_0x45515c[_0x54aa('0x32')]=_['keys'](_0x3ee3df['query']);_0x45515c[_0x54aa('0x34')]=_['intersection'](_0x45515c[_0x54aa('0x31')],_0x45515c['query']);_0xce4968[_0x54aa('0x36')]=_[_0x54aa('0x35')](_0x45515c[_0x54aa('0x31')],qs[_0x54aa('0x37')](_0x3ee3df[_0x54aa('0x32')][_0x54aa('0x37')]));_0xce4968[_0x54aa('0x36')]=_0xce4968[_0x54aa('0x36')]['length']?_0xce4968[_0x54aa('0x36')]:_0x45515c['model'];if(_0x3ee3df[_0x54aa('0x32')][_0x54aa('0x47')]){_0xce4968[_0x54aa('0x42')]=[{'all':!![]}];}_0xce4968=_[_0x54aa('0x3f')]({},_0xce4968,_0x3ee3df[_0x54aa('0x48')]);return db[_0x54aa('0x2d')][_0x54aa('0x49')](_0xce4968)[_0x54aa('0x26')](handleEntityNotFound(_0x5f443e,null))[_0x54aa('0x26')](respondWithResult(_0x5f443e,null))[_0x54aa('0x4a')](handleError(_0x5f443e,null));};exports[_0x54aa('0x4b')]=function(_0xf15608,_0x52e81f){return db[_0x54aa('0x2d')][_0x54aa('0x4b')](_0xf15608[_0x54aa('0x4c')],{})[_0x54aa('0x26')](respondWithResult(_0x52e81f,0xc9))['catch'](handleError(_0x52e81f,null));};exports[_0x54aa('0x25')]=function(_0x57265c,_0x28bfd5){if(_0x57265c[_0x54aa('0x4c')]['id']){delete _0x57265c[_0x54aa('0x4c')]['id'];}return db[_0x54aa('0x2d')][_0x54aa('0x49')]({'where':{'id':_0x57265c[_0x54aa('0x46')]['id']}})[_0x54aa('0x26')](handleEntityNotFound(_0x28bfd5,null))['then'](saveUpdates(_0x57265c[_0x54aa('0x4c')],null))[_0x54aa('0x26')](respondWithResult(_0x28bfd5,null))[_0x54aa('0x4a')](handleError(_0x28bfd5,null));};exports['destroy']=function(_0x1c7237,_0x2a7f32){return db[_0x54aa('0x2d')][_0x54aa('0x49')]({'where':{'id':_0x1c7237[_0x54aa('0x46')]['id']}})[_0x54aa('0x26')](handleEntityNotFound(_0x2a7f32,null))[_0x54aa('0x26')](removeEntity(_0x2a7f32,null))[_0x54aa('0x4a')](handleError(_0x2a7f32,null));}; \ No newline at end of file +var _0xb0d3=['update','then','destroy','end','error','name','send','index','map','ServicenowField','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','rawAttributes','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb0d3,0x108));var _0x3b0d=function(_0x3403d5,_0x3d99fc){_0x3403d5=_0x3403d5-0x0;var _0xf9df4f=_0xb0d3[_0x3403d5];return _0xf9df4f;};'use strict';var emlformat=require(_0x3b0d('0x0'));var rimraf=require(_0x3b0d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3b0d('0x2'));var moment=require(_0x3b0d('0x3'));var BPromise=require(_0x3b0d('0x4'));var Mustache=require(_0x3b0d('0x5'));var util=require(_0x3b0d('0x6'));var path=require(_0x3b0d('0x7'));var sox=require(_0x3b0d('0x8'));var csv=require(_0x3b0d('0x9'));var ejs=require(_0x3b0d('0xa'));var fs=require('fs');var fs_extra=require(_0x3b0d('0xb'));var _=require(_0x3b0d('0xc'));var squel=require(_0x3b0d('0xd'));var crypto=require(_0x3b0d('0xe'));var jsforce=require(_0x3b0d('0xf'));var deskjs=require(_0x3b0d('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3b0d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3b0d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b0d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3b0d('0x14'));var config=require(_0x3b0d('0x15'));var licenseUtil=require(_0x3b0d('0x16'));var db=require(_0x3b0d('0x17'))['db'];function respondWithStatusCode(_0x44e66e,_0xcc488){_0xcc488=_0xcc488||0xcc;return function(_0x5a0080){if(_0x5a0080){return _0x44e66e[_0x3b0d('0x18')](_0xcc488);}return _0x44e66e[_0x3b0d('0x19')](_0xcc488)['end']();};}function respondWithResult(_0x1e4300,_0x479607){_0x479607=_0x479607||0xc8;return function(_0x212f25){if(_0x212f25){return _0x1e4300[_0x3b0d('0x19')](_0x479607)[_0x3b0d('0x1a')](_0x212f25);}};}function respondWithFilteredResult(_0x2c196c,_0x17bfb0){return function(_0x542f93){if(_0x542f93){var _0x16dc67=typeof _0x17bfb0[_0x3b0d('0x1b')]===_0x3b0d('0x1c')&&typeof _0x17bfb0['limit']===_0x3b0d('0x1c');var _0x4520ca=_0x542f93[_0x3b0d('0x1d')];var _0x23b90a=_0x16dc67?0x0:_0x17bfb0[_0x3b0d('0x1b')];var _0x34bdb9=_0x16dc67?_0x542f93[_0x3b0d('0x1d')]:_0x17bfb0[_0x3b0d('0x1b')]+_0x17bfb0[_0x3b0d('0x1e')];var _0x3de670;if(_0x34bdb9>=_0x4520ca){_0x34bdb9=_0x4520ca;_0x3de670=0xc8;}else{_0x3de670=0xce;}_0x2c196c[_0x3b0d('0x19')](_0x3de670);return _0x2c196c[_0x3b0d('0x1f')](_0x3b0d('0x20'),_0x23b90a+'-'+_0x34bdb9+'/'+_0x4520ca)[_0x3b0d('0x1a')](_0x542f93);}return null;};}function patchUpdates(_0x2e89ce){return function(_0x494f8e){try{jsonpatch[_0x3b0d('0x21')](_0x494f8e,_0x2e89ce,!![]);}catch(_0x1296f3){return BPromise[_0x3b0d('0x22')](_0x1296f3);}return _0x494f8e[_0x3b0d('0x23')]();};}function saveUpdates(_0x36ccd6,_0x5daca5){return function(_0x172ded){if(_0x172ded){return _0x172ded[_0x3b0d('0x24')](_0x36ccd6)[_0x3b0d('0x25')](function(_0x2bf25e){return _0x2bf25e;});}return null;};}function removeEntity(_0x3dae31,_0x282c92){return function(_0x340b03){if(_0x340b03){return _0x340b03[_0x3b0d('0x26')]()['then'](function(){_0x3dae31[_0x3b0d('0x19')](0xcc)[_0x3b0d('0x27')]();});}};}function handleEntityNotFound(_0x2de925,_0xe2c7e2){return function(_0x5fbaa1){if(!_0x5fbaa1){_0x2de925[_0x3b0d('0x18')](0x194);}return _0x5fbaa1;};}function handleError(_0x26fd17,_0x367768){_0x367768=_0x367768||0x1f4;return function(_0x59e6d3){logger[_0x3b0d('0x28')](_0x59e6d3['stack']);if(_0x59e6d3[_0x3b0d('0x29')]){delete _0x59e6d3['name'];}_0x26fd17[_0x3b0d('0x19')](_0x367768)[_0x3b0d('0x2a')](_0x59e6d3);};}exports[_0x3b0d('0x2b')]=function(_0x460f0d,_0x9f91a6){var _0xec964={},_0x771867={},_0x2a7aeb={'count':0x0,'rows':[]};var _0x591d6f=_[_0x3b0d('0x2c')](db[_0x3b0d('0x2d')]['rawAttributes'],function(_0x5efdba){return{'name':_0x5efdba['fieldName'],'type':_0x5efdba[_0x3b0d('0x2e')][_0x3b0d('0x2f')]};});_0x771867['model']=_['map'](_0x591d6f,_0x3b0d('0x29'));_0x771867[_0x3b0d('0x30')]=_['keys'](_0x460f0d[_0x3b0d('0x30')]);_0x771867[_0x3b0d('0x31')]=_['intersection'](_0x771867[_0x3b0d('0x32')],_0x771867[_0x3b0d('0x30')]);_0xec964[_0x3b0d('0x33')]=_[_0x3b0d('0x34')](_0x771867[_0x3b0d('0x32')],qs[_0x3b0d('0x35')](_0x460f0d[_0x3b0d('0x30')]['fields']));_0xec964[_0x3b0d('0x33')]=_0xec964[_0x3b0d('0x33')][_0x3b0d('0x36')]?_0xec964[_0x3b0d('0x33')]:_0x771867[_0x3b0d('0x32')];if(!_0x460f0d['query'][_0x3b0d('0x37')](_0x3b0d('0x38'))){_0xec964[_0x3b0d('0x1e')]=qs[_0x3b0d('0x1e')](_0x460f0d[_0x3b0d('0x30')][_0x3b0d('0x1e')]);_0xec964[_0x3b0d('0x1b')]=qs[_0x3b0d('0x1b')](_0x460f0d[_0x3b0d('0x30')]['offset']);}_0xec964[_0x3b0d('0x39')]=qs[_0x3b0d('0x3a')](_0x460f0d[_0x3b0d('0x30')][_0x3b0d('0x3a')]);_0xec964[_0x3b0d('0x3b')]=qs[_0x3b0d('0x31')](_[_0x3b0d('0x3c')](_0x460f0d[_0x3b0d('0x30')],_0x771867[_0x3b0d('0x31')]),_0x591d6f);if(_0x460f0d[_0x3b0d('0x30')][_0x3b0d('0x3d')]){_0xec964['where']=_[_0x3b0d('0x3e')](_0xec964[_0x3b0d('0x3b')],{'$or':_['map'](_0x591d6f,function(_0x3508b6){if(_0x3508b6[_0x3b0d('0x2e')]!==_0x3b0d('0x3f')){var _0x9f337={};_0x9f337[_0x3508b6[_0x3b0d('0x29')]]={'$like':'%'+_0x460f0d['query'][_0x3b0d('0x3d')]+'%'};return _0x9f337;}})});}_0xec964=_[_0x3b0d('0x3e')]({},_0xec964,_0x460f0d[_0x3b0d('0x40')]);var _0x5d71d1={'where':_0xec964['where']};return db[_0x3b0d('0x2d')][_0x3b0d('0x1d')](_0x5d71d1)['then'](function(_0x39be6c){_0x2a7aeb[_0x3b0d('0x1d')]=_0x39be6c;if(_0x460f0d['query'][_0x3b0d('0x41')]){_0xec964[_0x3b0d('0x42')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0xec964);})[_0x3b0d('0x25')](function(_0x21af27){_0x2a7aeb[_0x3b0d('0x43')]=_0x21af27;return _0x2a7aeb;})[_0x3b0d('0x25')](respondWithFilteredResult(_0x9f91a6,_0xec964))[_0x3b0d('0x44')](handleError(_0x9f91a6,null));};exports[_0x3b0d('0x45')]=function(_0xb3ec1b,_0x5a37e9){var _0x2ebf9c={'raw':!![],'where':{'id':_0xb3ec1b['params']['id']}},_0x15156e={};_0x15156e[_0x3b0d('0x32')]=_[_0x3b0d('0x46')](db[_0x3b0d('0x2d')][_0x3b0d('0x47')]);_0x15156e[_0x3b0d('0x30')]=_[_0x3b0d('0x46')](_0xb3ec1b[_0x3b0d('0x30')]);_0x15156e['filters']=_[_0x3b0d('0x34')](_0x15156e[_0x3b0d('0x32')],_0x15156e[_0x3b0d('0x30')]);_0x2ebf9c['attributes']=_['intersection'](_0x15156e[_0x3b0d('0x32')],qs['fields'](_0xb3ec1b[_0x3b0d('0x30')]['fields']));_0x2ebf9c[_0x3b0d('0x33')]=_0x2ebf9c[_0x3b0d('0x33')][_0x3b0d('0x36')]?_0x2ebf9c[_0x3b0d('0x33')]:_0x15156e[_0x3b0d('0x32')];if(_0xb3ec1b['query'][_0x3b0d('0x41')]){_0x2ebf9c[_0x3b0d('0x42')]=[{'all':!![]}];}_0x2ebf9c=_['merge']({},_0x2ebf9c,_0xb3ec1b[_0x3b0d('0x40')]);return db['ServicenowField']['find'](_0x2ebf9c)[_0x3b0d('0x25')](handleEntityNotFound(_0x5a37e9,null))[_0x3b0d('0x25')](respondWithResult(_0x5a37e9,null))['catch'](handleError(_0x5a37e9,null));};exports[_0x3b0d('0x48')]=function(_0x205461,_0x56cad7){return db['ServicenowField'][_0x3b0d('0x48')](_0x205461['body'],{})[_0x3b0d('0x25')](respondWithResult(_0x56cad7,0xc9))['catch'](handleError(_0x56cad7,null));};exports[_0x3b0d('0x24')]=function(_0x19b37e,_0x2c904f){if(_0x19b37e[_0x3b0d('0x49')]['id']){delete _0x19b37e['body']['id'];}return db[_0x3b0d('0x2d')][_0x3b0d('0x4a')]({'where':{'id':_0x19b37e['params']['id']}})[_0x3b0d('0x25')](handleEntityNotFound(_0x2c904f,null))[_0x3b0d('0x25')](saveUpdates(_0x19b37e[_0x3b0d('0x49')],null))['then'](respondWithResult(_0x2c904f,null))[_0x3b0d('0x44')](handleError(_0x2c904f,null));};exports[_0x3b0d('0x26')]=function(_0x23b813,_0x4539c5){return db['ServicenowField']['find']({'where':{'id':_0x23b813['params']['id']}})[_0x3b0d('0x25')](handleEntityNotFound(_0x4539c5,null))[_0x3b0d('0x25')](removeEntity(_0x4539c5,null))[_0x3b0d('0x44')](handleError(_0x4539c5,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index a35dc2b..6428a47 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 _0xe2a1=['../../config/environment','./intServicenowField.attributes','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','rimraf'];(function(_0x4a1fdf,_0xb55e84){var _0x36c819=function(_0x24f505){while(--_0x24f505){_0x4a1fdf['push'](_0x4a1fdf['shift']());}};_0x36c819(++_0xb55e84);}(_0xe2a1,0xeb));var _0x1e2a=function(_0x537d10,_0x11ea5b){_0x537d10=_0x537d10-0x0;var _0x385f90=_0xe2a1[_0x537d10];return _0x385f90;};'use strict';var _=require(_0x1e2a('0x0'));var util=require(_0x1e2a('0x1'));var logger=require(_0x1e2a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1e2a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1e2a('0x4'));var config=require(_0x1e2a('0x5'));var attributes=require(_0x1e2a('0x6'));module['exports']=function(_0x592ee4,_0x3852d8){return _0x592ee4['define'](_0x1e2a('0x7'),attributes,{'tableName':_0x1e2a('0x8'),'paranoid':![],'indexes':[{'name':_0x1e2a('0x9'),'fields':[_0x1e2a('0xa'),_0x1e2a('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x37f8=['exports','int_servicenow_fields','servicenow_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes'];(function(_0xe212f5,_0x304805){var _0xf15f69=function(_0x5f5092){while(--_0x5f5092){_0xe212f5['push'](_0xe212f5['shift']());}};_0xf15f69(++_0x304805);}(_0x37f8,0x18a));var _0x837f=function(_0x1a66e2,_0x52fa50){_0x1a66e2=_0x1a66e2-0x0;var _0x428903=_0x37f8[_0x1a66e2];return _0x428903;};'use strict';var _=require(_0x837f('0x0'));var util=require(_0x837f('0x1'));var logger=require(_0x837f('0x2'))(_0x837f('0x3'));var moment=require(_0x837f('0x4'));var BPromise=require(_0x837f('0x5'));var rp=require(_0x837f('0x6'));var fs=require('fs');var path=require(_0x837f('0x7'));var rimraf=require(_0x837f('0x8'));var config=require(_0x837f('0x9'));var attributes=require(_0x837f('0xa'));module[_0x837f('0xb')]=function(_0x1e0794,_0x422f34){return _0x1e0794['define']('ServicenowField',attributes,{'tableName':_0x837f('0xc'),'paranoid':![],'indexes':[{'name':_0x837f('0xd'),'fields':[_0x837f('0xe'),'FieldId'],'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 1c5f1a8..9a5da03 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 _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x170765,_0xf278c3){var _0x390740=function(_0x219a2e){while(--_0x219a2e){_0x170765['push'](_0x170765['shift']());}};_0x390740(++_0xf278c3);}(_0xe706,0xa3));var _0x6e70=function(_0x52ba3d,_0x3ce09c){_0x52ba3d=_0x52ba3d-0x0;var _0x968ee9=_0xe706[_0x52ba3d];return _0x968ee9;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x70e0=['code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2981b5,_0x10d562){var _0x5606f0=function(_0xa3c347){while(--_0xa3c347){_0x2981b5['push'](_0x2981b5['shift']());}};_0x5606f0(++_0x10d562);}(_0x70e0,0x17b));var _0x070e=function(_0x5ad41e,_0x4530d2){_0x5ad41e=_0x5ad41e-0x0;var _0x294ab6=_0x70e0[_0x5ad41e];return _0x294ab6;};'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')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 05efe0e..c7f9d83 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x15f4b8,_0x3a44b3){var _0x573527=function(_0x373d20){while(--_0x373d20){_0x15f4b8['push'](_0x15f4b8['shift']());}};_0x573527(++_0x3a44b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3dbcc2,_0x9e4c3b){var _0x443068=function(_0x4dd4c3){while(--_0x4dd4c3){_0x3dbcc2['push'](_0x3dbcc2['shift']());}};_0x443068(++_0x9e4c3b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 4cd2986..43a9ca6 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(_0xee6ec8,_0x417498){var _0x47b444=function(_0x5733d9){while(--_0x5733d9){_0xee6ec8['push'](_0xee6ec8['shift']());}};_0x47b444(++_0x417498);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x4cad89,_0x43294f){var _0x3ff6ac=function(_0x2e28f9){while(--_0x2e28f9){_0x4cad89['push'](_0x4cad89['shift']());}};_0x3ff6ac(++_0x43294f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 b3f63fd..cbf7cf8 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 _0x9ec9=['Wrong\x20credentials','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','then','destroy','error','name','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','SugarcrmAccount','includeAll','include','findAll','rows','show','find','catch','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','password','remoteUri','POST','format','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','/service/v4_1/rest.php','get_module_fields','values','module_fields','remove','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test'];(function(_0x1c2384,_0xea7610){var _0x4d6a77=function(_0x40e6fe){while(--_0x40e6fe){_0x1c2384['push'](_0x1c2384['shift']());}};_0x4d6a77(++_0xea7610);}(_0x9ec9,0x15a));var _0x99ec=function(_0x1d8b31,_0xef220e){_0x1d8b31=_0x1d8b31-0x0;var _0x2548ce=_0x9ec9[_0x1d8b31];return _0x2548ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99ec('0x0'));var zipdir=require(_0x99ec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99ec('0x2'));var moment=require('moment');var BPromise=require(_0x99ec('0x3'));var Mustache=require(_0x99ec('0x4'));var util=require(_0x99ec('0x5'));var path=require(_0x99ec('0x6'));var sox=require(_0x99ec('0x7'));var csv=require('to-csv');var ejs=require(_0x99ec('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(_0x99ec('0x9'));var deskjs=require(_0x99ec('0xa'));var toCsv=require(_0x99ec('0xb'));var querystring=require(_0x99ec('0xc'));var Papa=require(_0x99ec('0xd'));var Redis=require(_0x99ec('0xe'));var authService=require(_0x99ec('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x99ec('0x10'));var hardwareService=require(_0x99ec('0x11'));var logger=require(_0x99ec('0x12'))(_0x99ec('0x13'));var utils=require(_0x99ec('0x14'));var config=require(_0x99ec('0x15'));var licenseUtil=require(_0x99ec('0x16'));var db=require(_0x99ec('0x17'))['db'];var integrations=require(_0x99ec('0x18'));function respondWithStatusCode(_0x51622c,_0x469db2){_0x469db2=_0x469db2||0xcc;return function(_0x51ad31){if(_0x51ad31){return _0x51622c[_0x99ec('0x19')](_0x469db2);}return _0x51622c[_0x99ec('0x1a')](_0x469db2)[_0x99ec('0x1b')]();};}function respondWithResult(_0x35da5a,_0x488454){_0x488454=_0x488454||0xc8;return function(_0x4dd296){if(_0x4dd296){return _0x35da5a['status'](_0x488454)[_0x99ec('0x1c')](_0x4dd296);}};}function respondWithFilteredResult(_0x504e0c,_0x2d3dd6){return function(_0x54a0b8){if(_0x54a0b8){var _0x3e3c08=typeof _0x2d3dd6[_0x99ec('0x1d')]===_0x99ec('0x1e')&&typeof _0x2d3dd6[_0x99ec('0x1f')]==='undefined';var _0x111d30=_0x54a0b8['count'];var _0x413f00=_0x3e3c08?0x0:_0x2d3dd6[_0x99ec('0x1d')];var _0x3c288f=_0x3e3c08?_0x54a0b8[_0x99ec('0x20')]:_0x2d3dd6[_0x99ec('0x1d')]+_0x2d3dd6[_0x99ec('0x1f')];var _0x3bee1c;if(_0x3c288f>=_0x111d30){_0x3c288f=_0x111d30;_0x3bee1c=0xc8;}else{_0x3bee1c=0xce;}_0x504e0c[_0x99ec('0x1a')](_0x3bee1c);return _0x504e0c['set'](_0x99ec('0x21'),_0x413f00+'-'+_0x3c288f+'/'+_0x111d30)[_0x99ec('0x1c')](_0x54a0b8);}return null;};}function patchUpdates(_0x44e7fb){return function(_0x48ff58){try{jsonpatch['apply'](_0x48ff58,_0x44e7fb,!![]);}catch(_0x2e7131){return BPromise['reject'](_0x2e7131);}return _0x48ff58[_0x99ec('0x22')]();};}function saveUpdates(_0x5f5907,_0x421f28){return function(_0x451dbe){if(_0x451dbe){return _0x451dbe['update'](_0x5f5907)[_0x99ec('0x23')](function(_0x23d773){return _0x23d773;});}return null;};}function removeEntity(_0x3e2baf,_0x5ec25c){return function(_0x140e10){if(_0x140e10){return _0x140e10[_0x99ec('0x24')]()[_0x99ec('0x23')](function(){_0x3e2baf[_0x99ec('0x1a')](0xcc)[_0x99ec('0x1b')]();});}};}function handleEntityNotFound(_0x2d3e59,_0x15e917){return function(_0x39ad1f){if(!_0x39ad1f){_0x2d3e59[_0x99ec('0x19')](0x194);}return _0x39ad1f;};}function handleError(_0x43ccb6,_0x3e9647){_0x3e9647=_0x3e9647||0x1f4;return function(_0x243f4f){logger[_0x99ec('0x25')](_0x243f4f['stack']);if(_0x243f4f[_0x99ec('0x26')]){delete _0x243f4f['name'];}_0x43ccb6[_0x99ec('0x1a')](_0x3e9647)['send'](_0x243f4f);};}exports['index']=function(_0x5634bb,_0x55f511){var _0x15e903={},_0x1604f1={},_0x1edb3d={'count':0x0,'rows':[]};var _0x103bea=_['map'](db['SugarcrmAccount'][_0x99ec('0x27')],function(_0x3649a2){return{'name':_0x3649a2[_0x99ec('0x28')],'type':_0x3649a2[_0x99ec('0x29')][_0x99ec('0x2a')]};});_0x1604f1['model']=_['map'](_0x103bea,_0x99ec('0x26'));_0x1604f1['query']=_[_0x99ec('0x2b')](_0x5634bb[_0x99ec('0x2c')]);_0x1604f1[_0x99ec('0x2d')]=_[_0x99ec('0x2e')](_0x1604f1[_0x99ec('0x2f')],_0x1604f1[_0x99ec('0x2c')]);_0x15e903[_0x99ec('0x30')]=_[_0x99ec('0x2e')](_0x1604f1[_0x99ec('0x2f')],qs[_0x99ec('0x31')](_0x5634bb[_0x99ec('0x2c')][_0x99ec('0x31')]));_0x15e903[_0x99ec('0x30')]=_0x15e903['attributes'][_0x99ec('0x32')]?_0x15e903[_0x99ec('0x30')]:_0x1604f1[_0x99ec('0x2f')];if(!_0x5634bb[_0x99ec('0x2c')][_0x99ec('0x33')]('nolimit')){_0x15e903[_0x99ec('0x1f')]=qs[_0x99ec('0x1f')](_0x5634bb[_0x99ec('0x2c')][_0x99ec('0x1f')]);_0x15e903[_0x99ec('0x1d')]=qs[_0x99ec('0x1d')](_0x5634bb[_0x99ec('0x2c')][_0x99ec('0x1d')]);}_0x15e903[_0x99ec('0x34')]=qs[_0x99ec('0x35')](_0x5634bb[_0x99ec('0x2c')]['sort']);_0x15e903['where']=qs[_0x99ec('0x2d')](_[_0x99ec('0x36')](_0x5634bb[_0x99ec('0x2c')],_0x1604f1[_0x99ec('0x2d')]),_0x103bea);if(_0x5634bb['query'][_0x99ec('0x37')]){_0x15e903[_0x99ec('0x38')]=_[_0x99ec('0x39')](_0x15e903[_0x99ec('0x38')],{'$or':_[_0x99ec('0x3a')](_0x103bea,function(_0x3a3840){if(_0x3a3840[_0x99ec('0x29')]!==_0x99ec('0x3b')){var _0x11ed33={};_0x11ed33[_0x3a3840[_0x99ec('0x26')]]={'$like':'%'+_0x5634bb[_0x99ec('0x2c')][_0x99ec('0x37')]+'%'};return _0x11ed33;}})});}_0x15e903=_[_0x99ec('0x39')]({},_0x15e903,_0x5634bb[_0x99ec('0x3c')]);var _0x548ee7={'where':_0x15e903['where']};return db[_0x99ec('0x3d')]['count'](_0x548ee7)['then'](function(_0x47ffd6){_0x1edb3d[_0x99ec('0x20')]=_0x47ffd6;if(_0x5634bb[_0x99ec('0x2c')][_0x99ec('0x3e')]){_0x15e903[_0x99ec('0x3f')]=[{'all':!![]}];}return db[_0x99ec('0x3d')][_0x99ec('0x40')](_0x15e903);})[_0x99ec('0x23')](function(_0x466826){_0x1edb3d[_0x99ec('0x41')]=_0x466826;return _0x1edb3d;})[_0x99ec('0x23')](respondWithFilteredResult(_0x55f511,_0x15e903))['catch'](handleError(_0x55f511,null));};exports[_0x99ec('0x42')]=function(_0x200615,_0x2263d7){var _0x310513={'raw':![],'where':{'id':_0x200615['params']['id']}},_0x5da786={};_0x5da786['model']=_[_0x99ec('0x2b')](db[_0x99ec('0x3d')][_0x99ec('0x27')]);_0x5da786[_0x99ec('0x2c')]=_[_0x99ec('0x2b')](_0x200615[_0x99ec('0x2c')]);_0x5da786['filters']=_['intersection'](_0x5da786[_0x99ec('0x2f')],_0x5da786['query']);_0x310513[_0x99ec('0x30')]=_[_0x99ec('0x2e')](_0x5da786['model'],qs[_0x99ec('0x31')](_0x200615[_0x99ec('0x2c')][_0x99ec('0x31')]));_0x310513['attributes']=_0x310513[_0x99ec('0x30')][_0x99ec('0x32')]?_0x310513[_0x99ec('0x30')]:_0x5da786['model'];if(_0x200615[_0x99ec('0x2c')]['includeAll']){_0x310513[_0x99ec('0x3f')]=[{'all':!![]}];}_0x310513=_['merge']({},_0x310513,_0x200615[_0x99ec('0x3c')]);return db['SugarcrmAccount'][_0x99ec('0x43')](_0x310513)[_0x99ec('0x23')](handleEntityNotFound(_0x2263d7,null))[_0x99ec('0x23')](respondWithResult(_0x2263d7,null))[_0x99ec('0x44')](handleError(_0x2263d7,null));};exports[_0x99ec('0x45')]=function(_0x364365,_0x38e914){return db[_0x99ec('0x3d')][_0x99ec('0x45')](_0x364365[_0x99ec('0x46')],{})[_0x99ec('0x23')](respondWithResult(_0x38e914,0xc9))[_0x99ec('0x44')](handleError(_0x38e914,null));};exports['update']=function(_0x263cad,_0x1e3fdb){if(_0x263cad[_0x99ec('0x46')]['id']){delete _0x263cad[_0x99ec('0x46')]['id'];}return db[_0x99ec('0x3d')][_0x99ec('0x43')]({'where':{'id':_0x263cad[_0x99ec('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e3fdb,null))[_0x99ec('0x23')](saveUpdates(_0x263cad[_0x99ec('0x46')],null))[_0x99ec('0x23')](respondWithResult(_0x1e3fdb,null))[_0x99ec('0x44')](handleError(_0x1e3fdb,null));};exports[_0x99ec('0x24')]=function(_0x7d7b16,_0xff6d3f){return db[_0x99ec('0x3d')][_0x99ec('0x43')]({'where':{'id':_0x7d7b16[_0x99ec('0x47')]['id']}})[_0x99ec('0x23')](handleEntityNotFound(_0xff6d3f,null))[_0x99ec('0x23')](removeEntity(_0xff6d3f,null))['catch'](handleError(_0xff6d3f,null));};exports[_0x99ec('0x48')]=function(_0x3e92a7,_0x2b4ccd,_0x154b3a){var _0x48c65f={};var _0x19aeaa={};var _0x2a05bb;var _0x39b16f;return db[_0x99ec('0x3d')][_0x99ec('0x49')]({'where':{'id':_0x3e92a7[_0x99ec('0x47')]['id']}})[_0x99ec('0x23')](handleEntityNotFound(_0x2b4ccd,null))[_0x99ec('0x23')](function(_0x41f5c3){if(_0x41f5c3){_0x2a05bb=_0x41f5c3;_0x19aeaa[_0x99ec('0x2f')]=_[_0x99ec('0x2b')](db[_0x99ec('0x4a')][_0x99ec('0x27')]);_0x19aeaa['query']=_[_0x99ec('0x2b')](_0x3e92a7[_0x99ec('0x2c')]);_0x19aeaa['filters']=_[_0x99ec('0x2e')](_0x19aeaa[_0x99ec('0x2f')],_0x19aeaa['query']);_0x48c65f[_0x99ec('0x30')]=_[_0x99ec('0x2e')](_0x19aeaa[_0x99ec('0x2f')],qs[_0x99ec('0x31')](_0x3e92a7[_0x99ec('0x2c')][_0x99ec('0x31')]));_0x48c65f['attributes']=_0x48c65f[_0x99ec('0x30')]['length']?_0x48c65f[_0x99ec('0x30')]:_0x19aeaa[_0x99ec('0x2f')];_0x48c65f[_0x99ec('0x34')]=qs['sort'](_0x3e92a7[_0x99ec('0x2c')][_0x99ec('0x35')]);_0x48c65f['where']=qs[_0x99ec('0x2d')](_[_0x99ec('0x36')](_0x3e92a7[_0x99ec('0x2c')],_0x19aeaa[_0x99ec('0x2d')]));if(_0x3e92a7[_0x99ec('0x2c')][_0x99ec('0x37')]){_0x48c65f[_0x99ec('0x38')]=_[_0x99ec('0x39')](_0x48c65f['where'],{'$or':_[_0x99ec('0x3a')](_0x48c65f[_0x99ec('0x30')],function(_0x2d87fb){var _0x2104c8={};_0x2104c8[_0x2d87fb]={'$like':'%'+_0x3e92a7['query'][_0x99ec('0x37')]+'%'};return _0x2104c8;})});}_0x48c65f=_['merge']({},_0x48c65f,_0x3e92a7[_0x99ec('0x3c')]);return _0x2a05bb[_0x99ec('0x48')](_0x48c65f);}})[_0x99ec('0x23')](function(_0x5784e9){if(_0x5784e9){_0x39b16f=_0x5784e9[_0x99ec('0x32')];if(!_0x3e92a7['query'][_0x99ec('0x33')]('nolimit')){_0x48c65f[_0x99ec('0x1f')]=qs[_0x99ec('0x1f')](_0x3e92a7[_0x99ec('0x2c')][_0x99ec('0x1f')]);_0x48c65f['offset']=qs[_0x99ec('0x1d')](_0x3e92a7[_0x99ec('0x2c')][_0x99ec('0x1d')]);}return _0x2a05bb['getConfigurations'](_0x48c65f);}})[_0x99ec('0x23')](function(_0x9f22dd){if(_0x9f22dd){return _0x9f22dd?{'count':_0x39b16f,'rows':_0x9f22dd}:null;}})[_0x99ec('0x23')](respondWithResult(_0x2b4ccd,null))[_0x99ec('0x44')](handleError(_0x2b4ccd,null));};exports['addConfiguration']=function(_0x3d0ae9,_0x4d6af3,_0x2bb2d4){if(_0x3d0ae9[_0x99ec('0x46')]['id']){delete _0x3d0ae9['body']['id'];}return db[_0x99ec('0x3d')][_0x99ec('0x49')]({'where':{'id':_0x3d0ae9[_0x99ec('0x47')]['id']}})[_0x99ec('0x23')](handleEntityNotFound(_0x4d6af3,null))[_0x99ec('0x23')](function(_0x5c78ac){if(_0x5c78ac){_0x3d0ae9[_0x99ec('0x46')][_0x99ec('0x4b')]=_0x5c78ac['id'];_0x3d0ae9[_0x99ec('0x46')][_0x99ec('0x4c')]=integrations[_0x99ec('0x4d')](_0x3d0ae9[_0x99ec('0x46')][_0x99ec('0x4e')],_0x3d0ae9['body']['type']);_0x3d0ae9[_0x99ec('0x46')][_0x99ec('0x4f')]=integrations[_0x99ec('0x50')](_0x3d0ae9[_0x99ec('0x46')]['channel'],_0x3d0ae9[_0x99ec('0x46')][_0x99ec('0x29')]);return db['SugarcrmConfiguration'][_0x99ec('0x45')](_0x3d0ae9['body'],{'include':[{'model':db[_0x99ec('0x51')],'as':_0x99ec('0x4c')},{'model':db[_0x99ec('0x51')],'as':_0x99ec('0x4f')}]});}return null;})[_0x99ec('0x23')](respondWithResult(_0x4d6af3,null))['catch'](handleError(_0x4d6af3,null));};exports[_0x99ec('0x52')]=function(_0x4b4fbc,_0x16b05d,_0x5046f3){var _0x3a864c='';var _0x44c8d9=['id',_0x99ec('0x26'),_0x99ec('0x53'),_0x99ec('0x54'),_0x99ec('0x55'),_0x99ec('0x56'),_0x99ec('0x57'),_0x99ec('0x58'),_0x99ec('0x59'),_0x99ec('0x5a'),_0x99ec('0x5b'),'direction'];return db[_0x99ec('0x3d')][_0x99ec('0x49')]({'where':{'id':_0x4b4fbc['params']['id']},'attributes':['id','username',_0x99ec('0x5c'),_0x99ec('0x5d')]})['then'](handleEntityNotFound(_0x16b05d,null))[_0x99ec('0x23')](function(_0x44f191){if(_0x44f191){_0x3a864c=_0x44f191[_0x99ec('0x5d')];var _0x584116=_0x3a864c['slice'](-0x1);if(_0x584116==='/'){_0x3a864c=_0x3a864c['substring'](0x0,_0x3a864c['lastIndexOf'](_0x584116));}return rp({'method':_0x99ec('0x5e'),'uri':util[_0x99ec('0x5f')]('%s%s',_0x3a864c,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x99ec('0x60'),'input_type':_0x99ec('0x61'),'response_type':_0x99ec('0x61'),'rest_data':JSON[_0x99ec('0x62')]({'user_auth':{'user_name':_0x44f191[_0x99ec('0x63')],'password':_0x44f191[_0x99ec('0x5c')],'encryption':_0x99ec('0x64')},'application':_0x99ec('0x65')})}});}})['then'](function(_0x18794){if(_0x18794&&_0x18794[_0x99ec('0x26')]!==_0x99ec('0x66')&&_0x18794[_0x99ec('0x26')]!=='Password\x20Expired'){return rp({'method':_0x99ec('0x5e'),'uri':util['format']('%s%s',_0x3a864c,_0x99ec('0x67')),'json':!![],'form':{'method':_0x99ec('0x68'),'input_type':_0x99ec('0x61'),'response_type':_0x99ec('0x61'),'rest_data':JSON['stringify']({'session':_0x18794['id'],'module_name':'Calls'})}})[_0x99ec('0x23')](function(_0x364212){if(_0x364212){var _0x17f143=_[_0x99ec('0x69')](_0x364212[_0x99ec('0x6a')]);_[_0x99ec('0x6b')](_0x17f143,function(_0x2186a8){return _0x44c8d9['includes'](_0x2186a8[_0x99ec('0x26')]);});return{'count':_0x17f143[_0x99ec('0x32')],'rows':_['map'](_0x17f143,function(_0x4633bf){return{'id':_0x4633bf['name'],'name':_0x4633bf['label'],'custom':_[_0x99ec('0x6c')](_0x4633bf[_0x99ec('0x26')],'_c')?!![]:![],'options':_0x4633bf[_0x99ec('0x3c')]?_[_0x99ec('0x3a')](_[_0x99ec('0x69')](_0x4633bf['options']),function(_0x725ff6){return{'name':_0x725ff6[_0x99ec('0x6d')],'value':_0x725ff6['name']};}):[]};})};}})[_0x99ec('0x23')](respondWithResult(_0x16b05d,null))[_0x99ec('0x44')](function(_0x2e436a){var _0x2b683c=_0x4b4fbc[_0x99ec('0x2c')]['test']?0x1f4:_0x2e436a[_0x99ec('0x6e')]||0x1f4;logger[_0x99ec('0x25')](_0x99ec('0x6f'),'getFields',_0x2b683c,JSON['stringify'](_0x2e436a));delete _0x2e436a[_0x99ec('0x26')];if(_0x2b683c===0x191){_0x2b683c=0x190;}_0x16b05d[_0x99ec('0x1a')](_0x2b683c)[_0x99ec('0x70')](_0x4b4fbc[_0x99ec('0x2c')][_0x99ec('0x71')]?{'message':_0x99ec('0x72'),'statusCode':_0x2e436a['statusCode']}:_0x2e436a);});}else{var _0x14782b=0x1f4;_0x16b05d[_0x99ec('0x1a')](_0x14782b)['send']({'message':_0x99ec('0x72'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xb64e=['%s%s','/service/v4_1/rest.php','login','JSON','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','get_module_fields','stringify','module_fields','remove','includes','endsWith','values','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','options','includeAll','include','findAll','show','params','catch','create','body','find','findOne','SugarcrmConfiguration','pick','getConfigurations','addConfiguration','AccountId','channel','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','lastIndexOf','POST'];(function(_0x309b21,_0x5ec2d8){var _0x56b0e9=function(_0x297d8b){while(--_0x297d8b){_0x309b21['push'](_0x309b21['shift']());}};_0x56b0e9(++_0x5ec2d8);}(_0xb64e,0x89));var _0xeb64=function(_0x135f79,_0x5325b8){_0x135f79=_0x135f79-0x0;var _0x7e9953=_0xb64e[_0x135f79];return _0x7e9953;};'use strict';var emlformat=require(_0xeb64('0x0'));var rimraf=require(_0xeb64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb64('0x2'));var rp=require(_0xeb64('0x3'));var moment=require(_0xeb64('0x4'));var BPromise=require(_0xeb64('0x5'));var Mustache=require(_0xeb64('0x6'));var util=require('util');var path=require('path');var sox=require(_0xeb64('0x7'));var csv=require(_0xeb64('0x8'));var ejs=require(_0xeb64('0x9'));var fs=require('fs');var fs_extra=require(_0xeb64('0xa'));var _=require(_0xeb64('0xb'));var squel=require(_0xeb64('0xc'));var crypto=require(_0xeb64('0xd'));var jsforce=require(_0xeb64('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xeb64('0x8'));var querystring=require('querystring');var Papa=require(_0xeb64('0xf'));var Redis=require('ioredis');var authService=require(_0xeb64('0x10'));var qs=require(_0xeb64('0x11'));var as=require(_0xeb64('0x12'));var hardwareService=require(_0xeb64('0x13'));var logger=require(_0xeb64('0x14'))('api');var utils=require(_0xeb64('0x15'));var config=require(_0xeb64('0x16'));var licenseUtil=require(_0xeb64('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeb64('0x18'));function respondWithStatusCode(_0x4c9b97,_0xa5c3ad){_0xa5c3ad=_0xa5c3ad||0xcc;return function(_0x35a9e1){if(_0x35a9e1){return _0x4c9b97[_0xeb64('0x19')](_0xa5c3ad);}return _0x4c9b97[_0xeb64('0x1a')](_0xa5c3ad)[_0xeb64('0x1b')]();};}function respondWithResult(_0x390bc1,_0x1564ae){_0x1564ae=_0x1564ae||0xc8;return function(_0xebd47e){if(_0xebd47e){return _0x390bc1[_0xeb64('0x1a')](_0x1564ae)[_0xeb64('0x1c')](_0xebd47e);}};}function respondWithFilteredResult(_0x44677e,_0x2d48e1){return function(_0x5b5255){if(_0x5b5255){var _0x4ca119=typeof _0x2d48e1[_0xeb64('0x1d')]===_0xeb64('0x1e')&&typeof _0x2d48e1[_0xeb64('0x1f')]===_0xeb64('0x1e');var _0x24df54=_0x5b5255[_0xeb64('0x20')];var _0x39caf2=_0x4ca119?0x0:_0x2d48e1[_0xeb64('0x1d')];var _0x3a17cd=_0x4ca119?_0x5b5255[_0xeb64('0x20')]:_0x2d48e1[_0xeb64('0x1d')]+_0x2d48e1[_0xeb64('0x1f')];var _0xd05b9f;if(_0x3a17cd>=_0x24df54){_0x3a17cd=_0x24df54;_0xd05b9f=0xc8;}else{_0xd05b9f=0xce;}_0x44677e[_0xeb64('0x1a')](_0xd05b9f);return _0x44677e['set'](_0xeb64('0x21'),_0x39caf2+'-'+_0x3a17cd+'/'+_0x24df54)['json'](_0x5b5255);}return null;};}function patchUpdates(_0x4f4aaa){return function(_0xefa0f9){try{jsonpatch['apply'](_0xefa0f9,_0x4f4aaa,!![]);}catch(_0x3a0f92){return BPromise[_0xeb64('0x22')](_0x3a0f92);}return _0xefa0f9[_0xeb64('0x23')]();};}function saveUpdates(_0x55295d,_0x2e4f6f){return function(_0x598d81){if(_0x598d81){return _0x598d81[_0xeb64('0x24')](_0x55295d)[_0xeb64('0x25')](function(_0x5202a2){return _0x5202a2;});}return null;};}function removeEntity(_0x2b13ca,_0x364728){return function(_0x86b4cf){if(_0x86b4cf){return _0x86b4cf[_0xeb64('0x26')]()[_0xeb64('0x25')](function(){_0x2b13ca[_0xeb64('0x1a')](0xcc)[_0xeb64('0x1b')]();});}};}function handleEntityNotFound(_0x207c15,_0x171b11){return function(_0x17edcb){if(!_0x17edcb){_0x207c15[_0xeb64('0x19')](0x194);}return _0x17edcb;};}function handleError(_0x5922d8,_0x5433ff){_0x5433ff=_0x5433ff||0x1f4;return function(_0x161cc8){logger['error'](_0x161cc8[_0xeb64('0x27')]);if(_0x161cc8[_0xeb64('0x28')]){delete _0x161cc8[_0xeb64('0x28')];}_0x5922d8[_0xeb64('0x1a')](_0x5433ff)[_0xeb64('0x29')](_0x161cc8);};}exports[_0xeb64('0x2a')]=function(_0x344927,_0x5f5832){var _0x5906c6={},_0x3da022={},_0x5d3b45={'count':0x0,'rows':[]};var _0x35ba3a=_[_0xeb64('0x2b')](db[_0xeb64('0x2c')][_0xeb64('0x2d')],function(_0x3fbc06){return{'name':_0x3fbc06[_0xeb64('0x2e')],'type':_0x3fbc06['type'][_0xeb64('0x2f')]};});_0x3da022['model']=_[_0xeb64('0x2b')](_0x35ba3a,_0xeb64('0x28'));_0x3da022[_0xeb64('0x30')]=_[_0xeb64('0x31')](_0x344927['query']);_0x3da022['filters']=_['intersection'](_0x3da022['model'],_0x3da022[_0xeb64('0x30')]);_0x5906c6[_0xeb64('0x32')]=_[_0xeb64('0x33')](_0x3da022[_0xeb64('0x34')],qs['fields'](_0x344927[_0xeb64('0x30')][_0xeb64('0x35')]));_0x5906c6[_0xeb64('0x32')]=_0x5906c6[_0xeb64('0x32')][_0xeb64('0x36')]?_0x5906c6['attributes']:_0x3da022[_0xeb64('0x34')];if(!_0x344927[_0xeb64('0x30')][_0xeb64('0x37')](_0xeb64('0x38'))){_0x5906c6['limit']=qs['limit'](_0x344927[_0xeb64('0x30')][_0xeb64('0x1f')]);_0x5906c6[_0xeb64('0x1d')]=qs[_0xeb64('0x1d')](_0x344927['query'][_0xeb64('0x1d')]);}_0x5906c6[_0xeb64('0x39')]=qs[_0xeb64('0x3a')](_0x344927[_0xeb64('0x30')][_0xeb64('0x3a')]);_0x5906c6[_0xeb64('0x3b')]=qs['filters'](_['pick'](_0x344927[_0xeb64('0x30')],_0x3da022[_0xeb64('0x3c')]),_0x35ba3a);if(_0x344927[_0xeb64('0x30')][_0xeb64('0x3d')]){_0x5906c6[_0xeb64('0x3b')]=_[_0xeb64('0x3e')](_0x5906c6['where'],{'$or':_[_0xeb64('0x2b')](_0x35ba3a,function(_0x4c9aae){if(_0x4c9aae[_0xeb64('0x3f')]!=='VIRTUAL'){var _0x2bba74={};_0x2bba74[_0x4c9aae[_0xeb64('0x28')]]={'$like':'%'+_0x344927[_0xeb64('0x30')][_0xeb64('0x3d')]+'%'};return _0x2bba74;}})});}_0x5906c6=_['merge']({},_0x5906c6,_0x344927[_0xeb64('0x40')]);var _0x182c0c={'where':_0x5906c6[_0xeb64('0x3b')]};return db[_0xeb64('0x2c')][_0xeb64('0x20')](_0x182c0c)[_0xeb64('0x25')](function(_0xe46122){_0x5d3b45[_0xeb64('0x20')]=_0xe46122;if(_0x344927[_0xeb64('0x30')][_0xeb64('0x41')]){_0x5906c6[_0xeb64('0x42')]=[{'all':!![]}];}return db[_0xeb64('0x2c')][_0xeb64('0x43')](_0x5906c6);})[_0xeb64('0x25')](function(_0x587dbf){_0x5d3b45['rows']=_0x587dbf;return _0x5d3b45;})['then'](respondWithFilteredResult(_0x5f5832,_0x5906c6))['catch'](handleError(_0x5f5832,null));};exports[_0xeb64('0x44')]=function(_0x566995,_0x12cc13){var _0x57988e={'raw':![],'where':{'id':_0x566995[_0xeb64('0x45')]['id']}},_0x1fe06c={};_0x1fe06c['model']=_[_0xeb64('0x31')](db['SugarcrmAccount'][_0xeb64('0x2d')]);_0x1fe06c['query']=_[_0xeb64('0x31')](_0x566995[_0xeb64('0x30')]);_0x1fe06c[_0xeb64('0x3c')]=_['intersection'](_0x1fe06c['model'],_0x1fe06c[_0xeb64('0x30')]);_0x57988e[_0xeb64('0x32')]=_['intersection'](_0x1fe06c['model'],qs[_0xeb64('0x35')](_0x566995['query']['fields']));_0x57988e['attributes']=_0x57988e['attributes'][_0xeb64('0x36')]?_0x57988e['attributes']:_0x1fe06c[_0xeb64('0x34')];if(_0x566995['query'][_0xeb64('0x41')]){_0x57988e[_0xeb64('0x42')]=[{'all':!![]}];}_0x57988e=_[_0xeb64('0x3e')]({},_0x57988e,_0x566995['options']);return db[_0xeb64('0x2c')]['find'](_0x57988e)[_0xeb64('0x25')](handleEntityNotFound(_0x12cc13,null))[_0xeb64('0x25')](respondWithResult(_0x12cc13,null))[_0xeb64('0x46')](handleError(_0x12cc13,null));};exports['create']=function(_0x25ebc3,_0x509192){return db['SugarcrmAccount'][_0xeb64('0x47')](_0x25ebc3[_0xeb64('0x48')],{})['then'](respondWithResult(_0x509192,0xc9))[_0xeb64('0x46')](handleError(_0x509192,null));};exports[_0xeb64('0x24')]=function(_0x28093d,_0x4c3a0b){if(_0x28093d[_0xeb64('0x48')]['id']){delete _0x28093d['body']['id'];}return db[_0xeb64('0x2c')][_0xeb64('0x49')]({'where':{'id':_0x28093d[_0xeb64('0x45')]['id']}})[_0xeb64('0x25')](handleEntityNotFound(_0x4c3a0b,null))[_0xeb64('0x25')](saveUpdates(_0x28093d[_0xeb64('0x48')],null))[_0xeb64('0x25')](respondWithResult(_0x4c3a0b,null))[_0xeb64('0x46')](handleError(_0x4c3a0b,null));};exports[_0xeb64('0x26')]=function(_0x5dea19,_0x3a01c1){return db[_0xeb64('0x2c')]['find']({'where':{'id':_0x5dea19['params']['id']}})[_0xeb64('0x25')](handleEntityNotFound(_0x3a01c1,null))['then'](removeEntity(_0x3a01c1,null))[_0xeb64('0x46')](handleError(_0x3a01c1,null));};exports['getConfigurations']=function(_0x216bdd,_0x1187a0,_0x286b54){var _0xb08cad={};var _0x3f59e4={};var _0x282c83;var _0x468bf4;return db[_0xeb64('0x2c')][_0xeb64('0x4a')]({'where':{'id':_0x216bdd['params']['id']}})[_0xeb64('0x25')](handleEntityNotFound(_0x1187a0,null))[_0xeb64('0x25')](function(_0x50b2c8){if(_0x50b2c8){_0x282c83=_0x50b2c8;_0x3f59e4['model']=_[_0xeb64('0x31')](db[_0xeb64('0x4b')][_0xeb64('0x2d')]);_0x3f59e4[_0xeb64('0x30')]=_[_0xeb64('0x31')](_0x216bdd['query']);_0x3f59e4[_0xeb64('0x3c')]=_['intersection'](_0x3f59e4['model'],_0x3f59e4[_0xeb64('0x30')]);_0xb08cad[_0xeb64('0x32')]=_[_0xeb64('0x33')](_0x3f59e4[_0xeb64('0x34')],qs[_0xeb64('0x35')](_0x216bdd[_0xeb64('0x30')][_0xeb64('0x35')]));_0xb08cad[_0xeb64('0x32')]=_0xb08cad[_0xeb64('0x32')][_0xeb64('0x36')]?_0xb08cad['attributes']:_0x3f59e4['model'];_0xb08cad['order']=qs[_0xeb64('0x3a')](_0x216bdd[_0xeb64('0x30')][_0xeb64('0x3a')]);_0xb08cad[_0xeb64('0x3b')]=qs[_0xeb64('0x3c')](_[_0xeb64('0x4c')](_0x216bdd[_0xeb64('0x30')],_0x3f59e4[_0xeb64('0x3c')]));if(_0x216bdd[_0xeb64('0x30')][_0xeb64('0x3d')]){_0xb08cad['where']=_[_0xeb64('0x3e')](_0xb08cad[_0xeb64('0x3b')],{'$or':_['map'](_0xb08cad[_0xeb64('0x32')],function(_0x55e78d){var _0xd32cff={};_0xd32cff[_0x55e78d]={'$like':'%'+_0x216bdd[_0xeb64('0x30')]['filter']+'%'};return _0xd32cff;})});}_0xb08cad=_[_0xeb64('0x3e')]({},_0xb08cad,_0x216bdd[_0xeb64('0x40')]);return _0x282c83[_0xeb64('0x4d')](_0xb08cad);}})[_0xeb64('0x25')](function(_0x5df501){if(_0x5df501){_0x468bf4=_0x5df501[_0xeb64('0x36')];if(!_0x216bdd[_0xeb64('0x30')][_0xeb64('0x37')](_0xeb64('0x38'))){_0xb08cad[_0xeb64('0x1f')]=qs[_0xeb64('0x1f')](_0x216bdd[_0xeb64('0x30')]['limit']);_0xb08cad[_0xeb64('0x1d')]=qs['offset'](_0x216bdd['query'][_0xeb64('0x1d')]);}return _0x282c83[_0xeb64('0x4d')](_0xb08cad);}})[_0xeb64('0x25')](function(_0x2ce0b7){if(_0x2ce0b7){return _0x2ce0b7?{'count':_0x468bf4,'rows':_0x2ce0b7}:null;}})['then'](respondWithResult(_0x1187a0,null))[_0xeb64('0x46')](handleError(_0x1187a0,null));};exports[_0xeb64('0x4e')]=function(_0x758799,_0x32307f,_0x5bc778){if(_0x758799[_0xeb64('0x48')]['id']){delete _0x758799[_0xeb64('0x48')]['id'];}return db[_0xeb64('0x2c')]['findOne']({'where':{'id':_0x758799[_0xeb64('0x45')]['id']}})[_0xeb64('0x25')](handleEntityNotFound(_0x32307f,null))[_0xeb64('0x25')](function(_0x35d6b3){if(_0x35d6b3){_0x758799[_0xeb64('0x48')][_0xeb64('0x4f')]=_0x35d6b3['id'];_0x758799['body']['Subjects']=integrations['getSubjects'](_0x758799[_0xeb64('0x48')]['channel'],_0x758799[_0xeb64('0x48')][_0xeb64('0x3f')]);_0x758799[_0xeb64('0x48')]['Descriptions']=integrations['getDescriptions'](_0x758799['body'][_0xeb64('0x50')],_0x758799[_0xeb64('0x48')]['type']);return db[_0xeb64('0x4b')]['create'](_0x758799[_0xeb64('0x48')],{'include':[{'model':db[_0xeb64('0x51')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0xeb64('0x52')}]});}return null;})[_0xeb64('0x25')](respondWithResult(_0x32307f,null))[_0xeb64('0x46')](handleError(_0x32307f,null));};exports[_0xeb64('0x53')]=function(_0x4307a0,_0x3ec849,_0x1955db){var _0x589267='';var _0x696230=['id',_0xeb64('0x28'),_0xeb64('0x54'),_0xeb64('0x55'),_0xeb64('0x56'),_0xeb64('0x57'),_0xeb64('0x58'),_0xeb64('0x59'),'parent_id',_0xeb64('0x5a'),_0xeb64('0x5b'),_0xeb64('0x5c')];return db[_0xeb64('0x2c')][_0xeb64('0x4a')]({'where':{'id':_0x4307a0[_0xeb64('0x45')]['id']},'attributes':['id',_0xeb64('0x5d'),_0xeb64('0x5e'),'remoteUri']})[_0xeb64('0x25')](handleEntityNotFound(_0x3ec849,null))[_0xeb64('0x25')](function(_0x4f7f99){if(_0x4f7f99){_0x589267=_0x4f7f99['remoteUri'];var _0x19dd8b=_0x589267['slice'](-0x1);if(_0x19dd8b==='/'){_0x589267=_0x589267['substring'](0x0,_0x589267[_0xeb64('0x5f')](_0x19dd8b));}return rp({'method':_0xeb64('0x60'),'uri':util['format'](_0xeb64('0x61'),_0x589267,_0xeb64('0x62')),'json':!![],'form':{'method':_0xeb64('0x63'),'input_type':_0xeb64('0x64'),'response_type':_0xeb64('0x64'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4f7f99[_0xeb64('0x5d')],'password':_0x4f7f99[_0xeb64('0x5e')],'encryption':'PLAIN'},'application':_0xeb64('0x65')})}});}})[_0xeb64('0x25')](function(_0x3fdd7b){if(_0x3fdd7b&&_0x3fdd7b[_0xeb64('0x28')]!==_0xeb64('0x66')&&_0x3fdd7b['name']!==_0xeb64('0x67')){return rp({'method':'POST','uri':util[_0xeb64('0x68')](_0xeb64('0x61'),_0x589267,_0xeb64('0x62')),'json':!![],'form':{'method':_0xeb64('0x69'),'input_type':'JSON','response_type':_0xeb64('0x64'),'rest_data':JSON[_0xeb64('0x6a')]({'session':_0x3fdd7b['id'],'module_name':'Calls'})}})['then'](function(_0x4454b6){if(_0x4454b6){var _0x21c624=_['values'](_0x4454b6[_0xeb64('0x6b')]);_[_0xeb64('0x6c')](_0x21c624,function(_0xa8ce58){return _0x696230[_0xeb64('0x6d')](_0xa8ce58['name']);});return{'count':_0x21c624[_0xeb64('0x36')],'rows':_[_0xeb64('0x2b')](_0x21c624,function(_0x15fc31){return{'id':_0x15fc31[_0xeb64('0x28')],'name':_0x15fc31['label'],'custom':_[_0xeb64('0x6e')](_0x15fc31[_0xeb64('0x28')],'_c')?!![]:![],'options':_0x15fc31[_0xeb64('0x40')]?_['map'](_[_0xeb64('0x6f')](_0x15fc31[_0xeb64('0x40')]),function(_0xf6df1e){return{'name':_0xf6df1e['value'],'value':_0xf6df1e[_0xeb64('0x28')]};}):[]};})};}})[_0xeb64('0x25')](respondWithResult(_0x3ec849,null))[_0xeb64('0x46')](function(_0x4c0912){var _0x2738f7=_0x4307a0[_0xeb64('0x30')][_0xeb64('0x70')]?0x1f4:_0x4c0912[_0xeb64('0x71')]||0x1f4;logger[_0xeb64('0x72')](_0xeb64('0x73'),'getFields',_0x2738f7,JSON[_0xeb64('0x6a')](_0x4c0912));delete _0x4c0912[_0xeb64('0x28')];if(_0x2738f7===0x191){_0x2738f7=0x190;}_0x3ec849[_0xeb64('0x1a')](_0x2738f7)[_0xeb64('0x29')](_0x4307a0[_0xeb64('0x30')][_0xeb64('0x70')]?{'message':_0xeb64('0x74'),'statusCode':_0x4c0912['statusCode']}:_0x4c0912);});}else{var _0x426210=0x1f4;_0x3ec849[_0xeb64('0x1a')](_0x426210)[_0xeb64('0x29')]({'message':_0xeb64('0x74'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 43b6140..0956b23 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 _0x2c5e=['bluebird','request-promise','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','util','../../config/logger','api'];(function(_0x11f249,_0x4ca4a8){var _0x5c3656=function(_0x27c9f8){while(--_0x27c9f8){_0x11f249['push'](_0x11f249['shift']());}};_0x5c3656(++_0x4ca4a8);}(_0x2c5e,0x165));var _0xe2c5=function(_0xb4d2a2,_0x2187c9){_0xb4d2a2=_0xb4d2a2-0x0;var _0x8e6eb9=_0x2c5e[_0xb4d2a2];return _0x8e6eb9;};'use strict';var _=require('lodash');var util=require(_0xe2c5('0x0'));var logger=require(_0xe2c5('0x1'))(_0xe2c5('0x2'));var moment=require('moment');var BPromise=require(_0xe2c5('0x3'));var rp=require(_0xe2c5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe2c5('0x5'));var integrations=require(_0xe2c5('0x6'));module[_0xe2c5('0x7')]=function(_0x146d4b,_0x370889){return _0x146d4b[_0xe2c5('0x8')](_0xe2c5('0x9'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17b3=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','int_sugarcrm_accounts'];(function(_0x3ff9bc,_0x51778d){var _0x4017d6=function(_0x57bb0a){while(--_0x57bb0a){_0x3ff9bc['push'](_0x3ff9bc['shift']());}};_0x4017d6(++_0x51778d);}(_0x17b3,0xd1));var _0x317b=function(_0x23cf4c,_0x5bf068){_0x23cf4c=_0x23cf4c-0x0;var _0x591a89=_0x17b3[_0x23cf4c];return _0x591a89;};'use strict';var _=require('lodash');var util=require(_0x317b('0x0'));var logger=require(_0x317b('0x1'))('api');var moment=require(_0x317b('0x2'));var BPromise=require('bluebird');var rp=require(_0x317b('0x3'));var fs=require('fs');var path=require(_0x317b('0x4'));var rimraf=require(_0x317b('0x5'));var config=require(_0x317b('0x6'));var attributes=require(_0x317b('0x7'));var integrations=require(_0x317b('0x8'));module[_0x317b('0x9')]=function(_0x165d6a,_0x6f5419){return _0x165d6a['define']('SugarcrmAccount',attributes,{'tableName':_0x317b('0xa'),'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 45a67b2..956533c 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 _0xa3a4=['code','message','info','request\x20sent','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','map','model','attributes','stringify','find','ShowSugarcrmAccount','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x3fccde,_0x5bda14){var _0x5e9cd7=function(_0x25014d){while(--_0x25014d){_0x3fccde['push'](_0x3fccde['shift']());}};_0x5e9cd7(++_0x5bda14);}(_0xa3a4,0x193));var _0x4a3a=function(_0x3c40af,_0x5ddde5){_0x3c40af=_0x3c40af-0x0;var _0x11e889=_0xa3a4[_0x3c40af];return _0x11e889;};'use strict';var _=require(_0x4a3a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4a3a('0x1'));var fs=require('fs');var Redis=require(_0x4a3a('0x2'));var db=require(_0x4a3a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a3a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4a3a('0x5'));var client=jayson['client'][_0x4a3a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x37af47,_0x38bbbf,_0x1dae20){return new BPromise(function(_0x3a421e,_0x585b03){return client[_0x4a3a('0x7')](_0x37af47,_0x1dae20)[_0x4a3a('0x8')](function(_0x4583a3){logger['info'](_0x4a3a('0x9'),_0x38bbbf,'request\x20sent');logger[_0x4a3a('0xa')](_0x4a3a('0xb'),_0x38bbbf,'request\x20sent',JSON['stringify'](_0x4583a3));if(_0x4583a3['error']){if(_0x4583a3[_0x4a3a('0xc')][_0x4a3a('0xd')]===0x1f4){logger[_0x4a3a('0xc')](_0x4a3a('0x9'),_0x38bbbf,_0x4583a3[_0x4a3a('0xc')]['message']);return _0x585b03(_0x4583a3['error'][_0x4a3a('0xe')]);}logger[_0x4a3a('0xc')](_0x4a3a('0x9'),_0x38bbbf,_0x4583a3[_0x4a3a('0xc')]['message']);return _0x3a421e(_0x4583a3[_0x4a3a('0xc')][_0x4a3a('0xe')]);}else{logger[_0x4a3a('0xf')](_0x4a3a('0x9'),_0x38bbbf,_0x4a3a('0x10'));_0x3a421e(_0x4583a3['result']['message']);}})[_0x4a3a('0x11')](function(_0x1ddcd6){logger[_0x4a3a('0xc')](_0x4a3a('0x9'),_0x38bbbf,_0x1ddcd6);_0x585b03(_0x1ddcd6);});});}exports[_0x4a3a('0x12')]=function(_0x5eb39f){var _0xec2c08=this;return new Promise(function(_0x4d2dd1,_0x13e04c){return db[_0x4a3a('0x13')][_0x4a3a('0x14')]({'raw':_0x5eb39f['options']?_0x5eb39f[_0x4a3a('0x15')][_0x4a3a('0x16')]===undefined?!![]:![]:!![],'where':_0x5eb39f['options']?_0x5eb39f['options'][_0x4a3a('0x17')]||null:null,'attributes':_0x5eb39f[_0x4a3a('0x15')]?_0x5eb39f[_0x4a3a('0x15')]['attributes']||null:null,'limit':_0x5eb39f[_0x4a3a('0x15')]?_0x5eb39f[_0x4a3a('0x15')][_0x4a3a('0x18')]||null:null,'include':_0x5eb39f[_0x4a3a('0x15')]?_0x5eb39f[_0x4a3a('0x15')][_0x4a3a('0x19')]?_[_0x4a3a('0x1a')](_0x5eb39f[_0x4a3a('0x15')][_0x4a3a('0x19')],function(_0x5db337){return{'model':db[_0x5db337[_0x4a3a('0x1b')]],'as':_0x5db337['as'],'attributes':_0x5db337[_0x4a3a('0x1c')],'include':_0x5db337[_0x4a3a('0x19')]?_[_0x4a3a('0x1a')](_0x5db337[_0x4a3a('0x19')],function(_0x2f6d63){return{'model':db[_0x2f6d63['model']],'as':_0x2f6d63['as'],'attributes':_0x2f6d63[_0x4a3a('0x1c')],'include':_0x2f6d63[_0x4a3a('0x19')]?_[_0x4a3a('0x1a')](_0x2f6d63['include'],function(_0x4bb5d1){return{'model':db[_0x4bb5d1['model']],'as':_0x4bb5d1['as'],'attributes':_0x4bb5d1[_0x4a3a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4a3a('0x8')](function(_0x8fd2cc){logger[_0x4a3a('0xf')](_0x4a3a('0x12'),_0x5eb39f);logger[_0x4a3a('0xa')](_0x4a3a('0x12'),_0x5eb39f,JSON[_0x4a3a('0x1d')](_0x8fd2cc));_0x4d2dd1(_0x8fd2cc);})[_0x4a3a('0x11')](function(_0x1fa18f){logger[_0x4a3a('0xc')](_0x4a3a('0x12'),_0x1fa18f['message'],_0x5eb39f);_0x13e04c(_0xec2c08[_0x4a3a('0xc')](0x1f4,_0x1fa18f[_0x4a3a('0xe')]));});});};exports['ShowSugarcrmAccount']=function(_0x2a9e89){var _0x3805c5=this;return new Promise(function(_0x14b89b,_0x4f77aa){return db['SugarcrmAccount'][_0x4a3a('0x1e')]({'raw':_0x2a9e89[_0x4a3a('0x15')]?_0x2a9e89[_0x4a3a('0x15')][_0x4a3a('0x16')]===undefined?!![]:![]:!![],'where':_0x2a9e89[_0x4a3a('0x15')]?_0x2a9e89[_0x4a3a('0x15')][_0x4a3a('0x17')]||null:null,'attributes':_0x2a9e89[_0x4a3a('0x15')]?_0x2a9e89[_0x4a3a('0x15')][_0x4a3a('0x1c')]||null:null,'include':_0x2a9e89[_0x4a3a('0x15')]?_0x2a9e89[_0x4a3a('0x15')][_0x4a3a('0x19')]?_['map'](_0x2a9e89[_0x4a3a('0x15')]['include'],function(_0x439a2d){return{'model':db[_0x439a2d[_0x4a3a('0x1b')]],'as':_0x439a2d['as'],'attributes':_0x439a2d['attributes'],'include':_0x439a2d[_0x4a3a('0x19')]?_[_0x4a3a('0x1a')](_0x439a2d[_0x4a3a('0x19')],function(_0x10a5c4){return{'model':db[_0x10a5c4[_0x4a3a('0x1b')]],'as':_0x10a5c4['as'],'attributes':_0x10a5c4[_0x4a3a('0x1c')],'include':_0x10a5c4[_0x4a3a('0x19')]?_['map'](_0x10a5c4['include'],function(_0x4d5a91){return{'model':db[_0x4d5a91[_0x4a3a('0x1b')]],'as':_0x4d5a91['as'],'attributes':_0x4d5a91['attributes']};}):[]};}):[]};}):[]:[]})[_0x4a3a('0x8')](function(_0x5b2c01){logger[_0x4a3a('0xf')](_0x4a3a('0x1f'),_0x2a9e89);logger['debug']('ShowSugarcrmAccount',_0x2a9e89,JSON[_0x4a3a('0x1d')](_0x5b2c01));_0x14b89b(_0x5b2c01);})['catch'](function(_0x2d0304){logger['error'](_0x4a3a('0x1f'),_0x2d0304[_0x4a3a('0xe')],_0x2a9e89);_0x4f77aa(_0x3805c5[_0x4a3a('0xc')](0x1f4,_0x2d0304[_0x4a3a('0xe')]));});});}; \ No newline at end of file +var _0xfe95=['request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','options','raw','where','attributes','limit','include','model','map','GetSugarcrmAccount','SugarcrmAccount','find','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x386160,_0x2be73b){var _0x3b1f0a=function(_0x21e718){while(--_0x21e718){_0x386160['push'](_0x386160['shift']());}};_0x3b1f0a(++_0x2be73b);}(_0xfe95,0xea));var _0x5fe9=function(_0x10e1b7,_0x28e02a){_0x10e1b7=_0x10e1b7-0x0;var _0x469e84=_0xfe95[_0x10e1b7];return _0x469e84;};'use strict';var _=require(_0x5fe9('0x0'));var util=require(_0x5fe9('0x1'));var moment=require(_0x5fe9('0x2'));var BPromise=require(_0x5fe9('0x3'));var rs=require(_0x5fe9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5fe9('0x5'))['db'];var utils=require(_0x5fe9('0x6'));var logger=require(_0x5fe9('0x7'))(_0x5fe9('0x8'));var config=require(_0x5fe9('0x9'));var jayson=require(_0x5fe9('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x467e25,_0x139d94,_0x5aafaf){return new BPromise(function(_0x1f69e8,_0x307194){return client[_0x5fe9('0xb')](_0x467e25,_0x5aafaf)[_0x5fe9('0xc')](function(_0x2ce8ab){logger['info'](_0x5fe9('0xd'),_0x139d94,_0x5fe9('0xe'));logger[_0x5fe9('0xf')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x139d94,_0x5fe9('0xe'),JSON[_0x5fe9('0x10')](_0x2ce8ab));if(_0x2ce8ab[_0x5fe9('0x11')]){if(_0x2ce8ab['error'][_0x5fe9('0x12')]===0x1f4){logger[_0x5fe9('0x11')](_0x5fe9('0xd'),_0x139d94,_0x2ce8ab[_0x5fe9('0x11')][_0x5fe9('0x13')]);return _0x307194(_0x2ce8ab['error'][_0x5fe9('0x13')]);}logger[_0x5fe9('0x11')](_0x5fe9('0xd'),_0x139d94,_0x2ce8ab[_0x5fe9('0x11')]['message']);return _0x1f69e8(_0x2ce8ab['error'][_0x5fe9('0x13')]);}else{logger[_0x5fe9('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x139d94,_0x5fe9('0xe'));_0x1f69e8(_0x2ce8ab[_0x5fe9('0x15')][_0x5fe9('0x13')]);}})[_0x5fe9('0x16')](function(_0x251743){logger[_0x5fe9('0x11')](_0x5fe9('0xd'),_0x139d94,_0x251743);_0x307194(_0x251743);});});}exports['GetSugarcrmAccount']=function(_0x586b2d){var _0x51cbd4=this;return new Promise(function(_0xfab1f4,_0x5a9520){return db['SugarcrmAccount']['findAll']({'raw':_0x586b2d[_0x5fe9('0x17')]?_0x586b2d[_0x5fe9('0x17')][_0x5fe9('0x18')]===undefined?!![]:![]:!![],'where':_0x586b2d[_0x5fe9('0x17')]?_0x586b2d[_0x5fe9('0x17')][_0x5fe9('0x19')]||null:null,'attributes':_0x586b2d[_0x5fe9('0x17')]?_0x586b2d[_0x5fe9('0x17')][_0x5fe9('0x1a')]||null:null,'limit':_0x586b2d[_0x5fe9('0x17')]?_0x586b2d[_0x5fe9('0x17')][_0x5fe9('0x1b')]||null:null,'include':_0x586b2d['options']?_0x586b2d[_0x5fe9('0x17')][_0x5fe9('0x1c')]?_['map'](_0x586b2d[_0x5fe9('0x17')][_0x5fe9('0x1c')],function(_0x276ecf){return{'model':db[_0x276ecf[_0x5fe9('0x1d')]],'as':_0x276ecf['as'],'attributes':_0x276ecf[_0x5fe9('0x1a')],'include':_0x276ecf[_0x5fe9('0x1c')]?_[_0x5fe9('0x1e')](_0x276ecf[_0x5fe9('0x1c')],function(_0x5e27aa){return{'model':db[_0x5e27aa['model']],'as':_0x5e27aa['as'],'attributes':_0x5e27aa[_0x5fe9('0x1a')],'include':_0x5e27aa[_0x5fe9('0x1c')]?_['map'](_0x5e27aa['include'],function(_0x44ae4c){return{'model':db[_0x44ae4c['model']],'as':_0x44ae4c['as'],'attributes':_0x44ae4c[_0x5fe9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5fe9('0xc')](function(_0x2a30b){logger[_0x5fe9('0x14')](_0x5fe9('0x1f'),_0x586b2d);logger[_0x5fe9('0xf')]('GetSugarcrmAccount',_0x586b2d,JSON[_0x5fe9('0x10')](_0x2a30b));_0xfab1f4(_0x2a30b);})[_0x5fe9('0x16')](function(_0x551bba){logger['error'](_0x5fe9('0x1f'),_0x551bba[_0x5fe9('0x13')],_0x586b2d);_0x5a9520(_0x51cbd4[_0x5fe9('0x11')](0x1f4,_0x551bba[_0x5fe9('0x13')]));});});};exports['ShowSugarcrmAccount']=function(_0x1b6724){var _0x253d84=this;return new Promise(function(_0x122739,_0x24e016){return db[_0x5fe9('0x20')][_0x5fe9('0x21')]({'raw':_0x1b6724[_0x5fe9('0x17')]?_0x1b6724[_0x5fe9('0x17')][_0x5fe9('0x18')]===undefined?!![]:![]:!![],'where':_0x1b6724['options']?_0x1b6724['options'][_0x5fe9('0x19')]||null:null,'attributes':_0x1b6724[_0x5fe9('0x17')]?_0x1b6724[_0x5fe9('0x17')]['attributes']||null:null,'include':_0x1b6724[_0x5fe9('0x17')]?_0x1b6724[_0x5fe9('0x17')]['include']?_[_0x5fe9('0x1e')](_0x1b6724['options'][_0x5fe9('0x1c')],function(_0x89840e){return{'model':db[_0x89840e[_0x5fe9('0x1d')]],'as':_0x89840e['as'],'attributes':_0x89840e['attributes'],'include':_0x89840e[_0x5fe9('0x1c')]?_[_0x5fe9('0x1e')](_0x89840e['include'],function(_0x2f4331){return{'model':db[_0x2f4331[_0x5fe9('0x1d')]],'as':_0x2f4331['as'],'attributes':_0x2f4331[_0x5fe9('0x1a')],'include':_0x2f4331[_0x5fe9('0x1c')]?_[_0x5fe9('0x1e')](_0x2f4331['include'],function(_0xfb074a){return{'model':db[_0xfb074a[_0x5fe9('0x1d')]],'as':_0xfb074a['as'],'attributes':_0xfb074a[_0x5fe9('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x321887){logger[_0x5fe9('0x14')](_0x5fe9('0x22'),_0x1b6724);logger[_0x5fe9('0xf')](_0x5fe9('0x22'),_0x1b6724,JSON[_0x5fe9('0x10')](_0x321887));_0x122739(_0x321887);})[_0x5fe9('0x16')](function(_0x1f816d){logger[_0x5fe9('0x11')]('ShowSugarcrmAccount',_0x1f816d[_0x5fe9('0x13')],_0x1b6724);_0x24e016(_0x253d84[_0x5fe9('0x11')](0x1f4,_0x1f816d[_0x5fe9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 8eaa35b..06935d4 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 _0xc07c=['/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields'];(function(_0x3549b2,_0x2865a4){var _0x12840a=function(_0x19ca2e){while(--_0x19ca2e){_0x3549b2['push'](_0x3549b2['shift']());}};_0x12840a(++_0x2865a4);}(_0xc07c,0xe2));var _0xcc07=function(_0x3b62f6,_0x3c7767){_0x3b62f6=_0x3b62f6-0x0;var _0x9f60d2=_0xc07c[_0x3b62f6];return _0x9f60d2;};'use strict';var multer=require(_0xcc07('0x0'));var util=require(_0xcc07('0x1'));var path=require(_0xcc07('0x2'));var timeout=require(_0xcc07('0x3'));var express=require(_0xcc07('0x4'));var router=express[_0xcc07('0x5')]();var fs_extra=require(_0xcc07('0x6'));var auth=require(_0xcc07('0x7'));var interaction=require(_0xcc07('0x8'));var config=require(_0xcc07('0x9'));var controller=require(_0xcc07('0xa'));router[_0xcc07('0xb')]('/',auth[_0xcc07('0xc')](),controller[_0xcc07('0xd')]);router[_0xcc07('0xb')]('/:id',auth[_0xcc07('0xc')](),controller[_0xcc07('0xe')]);router[_0xcc07('0xb')](_0xcc07('0xf'),auth['isAuthenticated'](),controller[_0xcc07('0x10')]);router[_0xcc07('0xb')](_0xcc07('0x11'),auth[_0xcc07('0xc')](),controller['getSubjects']);router[_0xcc07('0xb')](_0xcc07('0x12'),auth[_0xcc07('0xc')](),controller[_0xcc07('0x13')]);router[_0xcc07('0x14')]('/',auth[_0xcc07('0xc')](),controller[_0xcc07('0x15')]);router[_0xcc07('0x16')](_0xcc07('0x17'),auth[_0xcc07('0xc')](),controller[_0xcc07('0x18')]);router[_0xcc07('0x19')]('/:id',auth[_0xcc07('0xc')](),controller['destroy']);module[_0xcc07('0x1a')]=router; \ No newline at end of file +var _0x032d=['/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','show'];(function(_0x18a1ed,_0x5c34cd){var _0x2178d2=function(_0xeb9f75){while(--_0xeb9f75){_0x18a1ed['push'](_0x18a1ed['shift']());}};_0x2178d2(++_0x5c34cd);}(_0x032d,0x145));var _0xd032=function(_0x348ecf,_0x5d1f68){_0x348ecf=_0x348ecf-0x0;var _0xb3f3c4=_0x032d[_0x348ecf];return _0xb3f3c4;};'use strict';var multer=require(_0xd032('0x0'));var util=require(_0xd032('0x1'));var path=require(_0xd032('0x2'));var timeout=require(_0xd032('0x3'));var express=require(_0xd032('0x4'));var router=express[_0xd032('0x5')]();var fs_extra=require(_0xd032('0x6'));var auth=require(_0xd032('0x7'));var interaction=require(_0xd032('0x8'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0xd032('0x9')]('/',auth['isAuthenticated'](),controller[_0xd032('0xa')]);router[_0xd032('0x9')]('/:id',auth[_0xd032('0xb')](),controller[_0xd032('0xc')]);router[_0xd032('0x9')](_0xd032('0xd'),auth[_0xd032('0xb')](),controller['getFields']);router['get'](_0xd032('0xe'),auth[_0xd032('0xb')](),controller[_0xd032('0xf')]);router[_0xd032('0x9')](_0xd032('0x10'),auth[_0xd032('0xb')](),controller[_0xd032('0x11')]);router[_0xd032('0x12')]('/',auth[_0xd032('0xb')](),controller[_0xd032('0x13')]);router[_0xd032('0x14')](_0xd032('0x15'),auth['isAuthenticated'](),controller[_0xd032('0x16')]);router[_0xd032('0x17')](_0xd032('0x15'),auth['isAuthenticated'](),controller[_0xd032('0x18')]);module[_0xd032('0x19')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index bfc00fb..6594f6c 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 _0x3f56=['exports','sequelize'];(function(_0x353033,_0x425e11){var _0x33b6c3=function(_0x467f82){while(--_0x467f82){_0x353033['push'](_0x353033['shift']());}};_0x33b6c3(++_0x425e11);}(_0x3f56,0x1cf));var _0x63f5=function(_0x294d78,_0xb25f1a){_0x294d78=_0x294d78-0x0;var _0x413feb=_0x3f56[_0x294d78];return _0x413feb;};'use strict';var Sequelize=require(_0x63f5('0x0'));module[_0x63f5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0ef2=['sequelize','exports','STRING'];(function(_0x222140,_0x555896){var _0x3b3de6=function(_0x14d25b){while(--_0x14d25b){_0x222140['push'](_0x222140['shift']());}};_0x3b3de6(++_0x555896);}(_0x0ef2,0x108));var _0x20ef=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x0ef2[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0x20ef('0x0'));module[_0x20ef('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x20ef('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index d6f420d..4aa9ba5 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 _0x60e8=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','end','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','map','getSubjects','findOne','SugarcrmField','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x1cae51,_0x1747d6){var _0x2c2e81=function(_0x58888f){while(--_0x58888f){_0x1cae51['push'](_0x1cae51['shift']());}};_0x2c2e81(++_0x1747d6);}(_0x60e8,0x12b));var _0x860e=function(_0x3574f8,_0x3e7196){_0x3574f8=_0x3574f8-0x0;var _0x4e7d29=_0x60e8[_0x3574f8];return _0x4e7d29;};'use strict';var emlformat=require(_0x860e('0x0'));var rimraf=require(_0x860e('0x1'));var zipdir=require(_0x860e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x860e('0x3'));var moment=require(_0x860e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x860e('0x5'));var util=require('util');var path=require(_0x860e('0x6'));var sox=require(_0x860e('0x7'));var csv=require('to-csv');var ejs=require(_0x860e('0x8'));var fs=require('fs');var fs_extra=require(_0x860e('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x860e('0xa'));var jsforce=require(_0x860e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x860e('0xc'));var querystring=require(_0x860e('0xd'));var Papa=require(_0x860e('0xe'));var Redis=require(_0x860e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x860e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x860e('0x11'));var logger=require(_0x860e('0x12'))(_0x860e('0x13'));var utils=require('../../config/utils');var config=require(_0x860e('0x14'));var licenseUtil=require(_0x860e('0x15'));var db=require(_0x860e('0x16'))['db'];function respondWithStatusCode(_0x3ce956,_0x1525ae){_0x1525ae=_0x1525ae||0xcc;return function(_0x56b8e3){if(_0x56b8e3){return _0x3ce956[_0x860e('0x17')](_0x1525ae);}return _0x3ce956['status'](_0x1525ae)['end']();};}function respondWithResult(_0x402307,_0x4d30c9){_0x4d30c9=_0x4d30c9||0xc8;return function(_0x55bf3c){if(_0x55bf3c){return _0x402307[_0x860e('0x18')](_0x4d30c9)[_0x860e('0x19')](_0x55bf3c);}};}function respondWithFilteredResult(_0x5800e4,_0x10620e){return function(_0x3490ae){if(_0x3490ae){var _0xb00bc6=typeof _0x10620e[_0x860e('0x1a')]===_0x860e('0x1b')&&typeof _0x10620e[_0x860e('0x1c')]===_0x860e('0x1b');var _0x1b8378=_0x3490ae[_0x860e('0x1d')];var _0x33e457=_0xb00bc6?0x0:_0x10620e['offset'];var _0x58b80f=_0xb00bc6?_0x3490ae[_0x860e('0x1d')]:_0x10620e['offset']+_0x10620e[_0x860e('0x1c')];var _0x261409;if(_0x58b80f>=_0x1b8378){_0x58b80f=_0x1b8378;_0x261409=0xc8;}else{_0x261409=0xce;}_0x5800e4['status'](_0x261409);return _0x5800e4['set']('Content-Range',_0x33e457+'-'+_0x58b80f+'/'+_0x1b8378)[_0x860e('0x19')](_0x3490ae);}return null;};}function patchUpdates(_0x4ca978){return function(_0x76392d){try{jsonpatch[_0x860e('0x1e')](_0x76392d,_0x4ca978,!![]);}catch(_0xd7ed72){return BPromise[_0x860e('0x1f')](_0xd7ed72);}return _0x76392d[_0x860e('0x20')]();};}function saveUpdates(_0x354db5,_0x42a381){return function(_0xfc7569){if(_0xfc7569){return _0xfc7569[_0x860e('0x21')](_0x354db5)[_0x860e('0x22')](function(_0x2eda76){return _0x2eda76;});}return null;};}function removeEntity(_0x2b8bc7,_0x1c2ac3){return function(_0x469369){if(_0x469369){return _0x469369[_0x860e('0x23')]()['then'](function(){_0x2b8bc7[_0x860e('0x18')](0xcc)[_0x860e('0x24')]();});}};}function handleEntityNotFound(_0x20ce47,_0x57464c){return function(_0xec27c7){if(!_0xec27c7){_0x20ce47[_0x860e('0x17')](0x194);}return _0xec27c7;};}function handleError(_0x386fee,_0x223e07){_0x223e07=_0x223e07||0x1f4;return function(_0x235f64){logger['error'](_0x235f64[_0x860e('0x25')]);if(_0x235f64[_0x860e('0x26')]){delete _0x235f64[_0x860e('0x26')];}_0x386fee[_0x860e('0x18')](_0x223e07)['send'](_0x235f64);};}exports[_0x860e('0x27')]=function(_0x1e7d66,_0x119d9c){var _0x192d5a={},_0x15f098={},_0x14631f={'count':0x0,'rows':[]};var _0x55ccff=_['map'](db['SugarcrmConfiguration'][_0x860e('0x28')],function(_0x254087){return{'name':_0x254087[_0x860e('0x29')],'type':_0x254087[_0x860e('0x2a')][_0x860e('0x2b')]};});_0x15f098[_0x860e('0x2c')]=_['map'](_0x55ccff,_0x860e('0x26'));_0x15f098[_0x860e('0x2d')]=_[_0x860e('0x2e')](_0x1e7d66[_0x860e('0x2d')]);_0x15f098[_0x860e('0x2f')]=_[_0x860e('0x30')](_0x15f098[_0x860e('0x2c')],_0x15f098['query']);_0x192d5a['attributes']=_[_0x860e('0x30')](_0x15f098[_0x860e('0x2c')],qs[_0x860e('0x31')](_0x1e7d66['query']['fields']));_0x192d5a[_0x860e('0x32')]=_0x192d5a[_0x860e('0x32')][_0x860e('0x33')]?_0x192d5a[_0x860e('0x32')]:_0x15f098['model'];if(!_0x1e7d66['query'][_0x860e('0x34')](_0x860e('0x35'))){_0x192d5a[_0x860e('0x1c')]=qs['limit'](_0x1e7d66[_0x860e('0x2d')][_0x860e('0x1c')]);_0x192d5a['offset']=qs[_0x860e('0x1a')](_0x1e7d66[_0x860e('0x2d')][_0x860e('0x1a')]);}_0x192d5a[_0x860e('0x36')]=qs[_0x860e('0x37')](_0x1e7d66['query'][_0x860e('0x37')]);_0x192d5a[_0x860e('0x38')]=qs['filters'](_[_0x860e('0x39')](_0x1e7d66[_0x860e('0x2d')],_0x15f098[_0x860e('0x2f')]),_0x55ccff);if(_0x1e7d66[_0x860e('0x2d')][_0x860e('0x3a')]){_0x192d5a[_0x860e('0x38')]=_[_0x860e('0x3b')](_0x192d5a['where'],{'$or':_['map'](_0x55ccff,function(_0x9389b3){if(_0x9389b3[_0x860e('0x2a')]!==_0x860e('0x3c')){var _0x103369={};_0x103369[_0x9389b3[_0x860e('0x26')]]={'$like':'%'+_0x1e7d66[_0x860e('0x2d')][_0x860e('0x3a')]+'%'};return _0x103369;}})});}_0x192d5a=_['merge']({},_0x192d5a,_0x1e7d66[_0x860e('0x3d')]);var _0x32a794={'where':_0x192d5a['where']};return db[_0x860e('0x3e')][_0x860e('0x1d')](_0x32a794)[_0x860e('0x22')](function(_0x2bf5f4){_0x14631f[_0x860e('0x1d')]=_0x2bf5f4;if(_0x1e7d66[_0x860e('0x2d')][_0x860e('0x3f')]){_0x192d5a[_0x860e('0x40')]=[{'all':!![]}];}return db[_0x860e('0x3e')][_0x860e('0x41')](_0x192d5a);})[_0x860e('0x22')](function(_0x3e1372){_0x14631f[_0x860e('0x42')]=_0x3e1372;return _0x14631f;})[_0x860e('0x22')](respondWithFilteredResult(_0x119d9c,_0x192d5a))[_0x860e('0x43')](handleError(_0x119d9c,null));};exports[_0x860e('0x44')]=function(_0x5b68fa,_0x1c46c1){var _0x43ccb4={'raw':![],'where':{'id':_0x5b68fa[_0x860e('0x45')]['id']}},_0x2b0407={};_0x2b0407[_0x860e('0x2c')]=_['keys'](db[_0x860e('0x3e')][_0x860e('0x28')]);_0x2b0407[_0x860e('0x2d')]=_['keys'](_0x5b68fa[_0x860e('0x2d')]);_0x2b0407['filters']=_[_0x860e('0x30')](_0x2b0407['model'],_0x2b0407[_0x860e('0x2d')]);_0x43ccb4[_0x860e('0x32')]=_[_0x860e('0x30')](_0x2b0407[_0x860e('0x2c')],qs[_0x860e('0x31')](_0x5b68fa[_0x860e('0x2d')]['fields']));_0x43ccb4[_0x860e('0x32')]=_0x43ccb4[_0x860e('0x32')][_0x860e('0x33')]?_0x43ccb4[_0x860e('0x32')]:_0x2b0407['model'];if(_0x5b68fa[_0x860e('0x2d')]['includeAll']){_0x43ccb4[_0x860e('0x40')]=[{'all':!![]}];}_0x43ccb4=_[_0x860e('0x3b')]({},_0x43ccb4,_0x5b68fa[_0x860e('0x3d')]);return db[_0x860e('0x3e')][_0x860e('0x46')](_0x43ccb4)[_0x860e('0x22')](handleEntityNotFound(_0x1c46c1,null))[_0x860e('0x22')](respondWithResult(_0x1c46c1,null))['catch'](handleError(_0x1c46c1,null));};exports[_0x860e('0x47')]=function(_0x2328d3,_0x50779d){return db['SugarcrmConfiguration'][_0x860e('0x47')](_0x2328d3['body'],{})[_0x860e('0x22')](respondWithResult(_0x50779d,0xc9))[_0x860e('0x43')](handleError(_0x50779d,null));};exports['update']=function(_0x411c91,_0x157c34){if(_0x411c91[_0x860e('0x48')]['id']){delete _0x411c91[_0x860e('0x48')]['id'];}return db[_0x860e('0x3e')][_0x860e('0x46')]({'where':{'id':_0x411c91[_0x860e('0x45')]['id']}})[_0x860e('0x22')](handleEntityNotFound(_0x157c34,null))['then'](saveUpdates(_0x411c91[_0x860e('0x48')],null))[_0x860e('0x22')](respondWithResult(_0x157c34,null))[_0x860e('0x43')](handleError(_0x157c34,null));};exports[_0x860e('0x23')]=function(_0x20ed9f,_0x28c358){return db[_0x860e('0x3e')]['find']({'where':{'id':_0x20ed9f[_0x860e('0x45')]['id']}})[_0x860e('0x22')](handleEntityNotFound(_0x28c358,null))[_0x860e('0x22')](removeEntity(_0x28c358,null))[_0x860e('0x43')](handleError(_0x28c358,null));};exports[_0x860e('0x49')]=function(_0x526f79,_0x570f05,_0x5b00df){var _0x5934b0={};var _0x588b4d={};var _0xd4849f;var _0x4bb4bf;return db[_0x860e('0x3e')]['findOne']({'where':{'id':_0x526f79[_0x860e('0x45')]['id']}})[_0x860e('0x22')](handleEntityNotFound(_0x570f05,null))['then'](function(_0x163c2c){if(_0x163c2c){_0xd4849f=_0x163c2c;_0x588b4d[_0x860e('0x2c')]=_['keys'](db['SugarcrmField'][_0x860e('0x28')]);_0x588b4d[_0x860e('0x2d')]=_['keys'](_0x526f79[_0x860e('0x2d')]);_0x588b4d[_0x860e('0x2f')]=_[_0x860e('0x30')](_0x588b4d[_0x860e('0x2c')],_0x588b4d['query']);_0x5934b0[_0x860e('0x32')]=_['intersection'](_0x588b4d[_0x860e('0x2c')],qs[_0x860e('0x31')](_0x526f79['query'][_0x860e('0x31')]));_0x5934b0[_0x860e('0x32')]=_0x5934b0[_0x860e('0x32')][_0x860e('0x33')]?_0x5934b0[_0x860e('0x32')]:_0x588b4d['model'];_0x5934b0[_0x860e('0x36')]=qs[_0x860e('0x37')](_0x526f79[_0x860e('0x2d')][_0x860e('0x37')]);_0x5934b0['where']=qs[_0x860e('0x2f')](_['pick'](_0x526f79[_0x860e('0x2d')],_0x588b4d['filters']));if(_0x526f79[_0x860e('0x2d')][_0x860e('0x3a')]){_0x5934b0['where']=_[_0x860e('0x3b')](_0x5934b0[_0x860e('0x38')],{'$or':_[_0x860e('0x4a')](_0x5934b0['attributes'],function(_0x19a879){var _0x45fa16={};_0x45fa16[_0x19a879]={'$like':'%'+_0x526f79[_0x860e('0x2d')][_0x860e('0x3a')]+'%'};return _0x45fa16;})});}_0x5934b0=_[_0x860e('0x3b')]({},_0x5934b0,_0x526f79[_0x860e('0x3d')]);return _0xd4849f[_0x860e('0x49')](_0x5934b0);}})[_0x860e('0x22')](function(_0x58647c){if(_0x58647c){_0x4bb4bf=_0x58647c[_0x860e('0x33')];if(!_0x526f79[_0x860e('0x2d')][_0x860e('0x34')](_0x860e('0x35'))){_0x5934b0[_0x860e('0x1c')]=qs[_0x860e('0x1c')](_0x526f79[_0x860e('0x2d')][_0x860e('0x1c')]);_0x5934b0['offset']=qs[_0x860e('0x1a')](_0x526f79[_0x860e('0x2d')]['offset']);}return _0xd4849f[_0x860e('0x49')](_0x5934b0);}})[_0x860e('0x22')](function(_0x2c0a71){if(_0x2c0a71){return _0x2c0a71?{'count':_0x4bb4bf,'rows':_0x2c0a71}:null;}})[_0x860e('0x22')](respondWithResult(_0x570f05,null))[_0x860e('0x43')](handleError(_0x570f05,null));};exports[_0x860e('0x4b')]=function(_0x1705df,_0x29a007,_0x547654){var _0x1187e0={};var _0x3e35af={};var _0x32dcef;var _0x3ca91c;return db[_0x860e('0x3e')][_0x860e('0x4c')]({'where':{'id':_0x1705df[_0x860e('0x45')]['id']}})[_0x860e('0x22')](handleEntityNotFound(_0x29a007,null))[_0x860e('0x22')](function(_0x38ddf3){if(_0x38ddf3){_0x32dcef=_0x38ddf3;_0x3e35af[_0x860e('0x2c')]=_['keys'](db[_0x860e('0x4d')]['rawAttributes']);_0x3e35af['query']=_['keys'](_0x1705df[_0x860e('0x2d')]);_0x3e35af['filters']=_[_0x860e('0x30')](_0x3e35af[_0x860e('0x2c')],_0x3e35af[_0x860e('0x2d')]);_0x1187e0[_0x860e('0x32')]=_[_0x860e('0x30')](_0x3e35af[_0x860e('0x2c')],qs[_0x860e('0x31')](_0x1705df['query'][_0x860e('0x31')]));_0x1187e0[_0x860e('0x32')]=_0x1187e0[_0x860e('0x32')][_0x860e('0x33')]?_0x1187e0[_0x860e('0x32')]:_0x3e35af[_0x860e('0x2c')];_0x1187e0[_0x860e('0x36')]=qs[_0x860e('0x37')](_0x1705df[_0x860e('0x2d')][_0x860e('0x37')]);_0x1187e0[_0x860e('0x38')]=qs['filters'](_['pick'](_0x1705df['query'],_0x3e35af[_0x860e('0x2f')]));if(_0x1705df[_0x860e('0x2d')][_0x860e('0x3a')]){_0x1187e0[_0x860e('0x38')]=_[_0x860e('0x3b')](_0x1187e0['where'],{'$or':_[_0x860e('0x4a')](_0x1187e0[_0x860e('0x32')],function(_0x3aad7a){var _0x2f0bcf={};_0x2f0bcf[_0x3aad7a]={'$like':'%'+_0x1705df[_0x860e('0x2d')][_0x860e('0x3a')]+'%'};return _0x2f0bcf;})});}_0x1187e0=_[_0x860e('0x3b')]({},_0x1187e0,_0x1705df[_0x860e('0x3d')]);return _0x32dcef[_0x860e('0x4b')](_0x1187e0);}})[_0x860e('0x22')](function(_0x4dba92){if(_0x4dba92){_0x3ca91c=_0x4dba92[_0x860e('0x33')];if(!_0x1705df[_0x860e('0x2d')][_0x860e('0x34')](_0x860e('0x35'))){_0x1187e0['limit']=qs[_0x860e('0x1c')](_0x1705df[_0x860e('0x2d')]['limit']);_0x1187e0[_0x860e('0x1a')]=qs[_0x860e('0x1a')](_0x1705df[_0x860e('0x2d')]['offset']);}return _0x32dcef[_0x860e('0x4b')](_0x1187e0);}})['then'](function(_0x2b6f71){if(_0x2b6f71){return _0x2b6f71?{'count':_0x3ca91c,'rows':_0x2b6f71}:null;}})[_0x860e('0x22')](respondWithResult(_0x29a007,null))[_0x860e('0x43')](handleError(_0x29a007,null));};exports[_0x860e('0x4e')]=function(_0x15ded8,_0xff7c2e,_0x81a9aa){var _0x18432b={};var _0x14740e={};var _0xc65e4e;var _0x5d184a;return db[_0x860e('0x3e')][_0x860e('0x4c')]({'where':{'id':_0x15ded8['params']['id']}})['then'](handleEntityNotFound(_0xff7c2e,null))['then'](function(_0x42469f){if(_0x42469f){_0xc65e4e=_0x42469f;_0x14740e[_0x860e('0x2c')]=_['keys'](db[_0x860e('0x4d')][_0x860e('0x28')]);_0x14740e[_0x860e('0x2d')]=_['keys'](_0x15ded8[_0x860e('0x2d')]);_0x14740e[_0x860e('0x2f')]=_[_0x860e('0x30')](_0x14740e[_0x860e('0x2c')],_0x14740e[_0x860e('0x2d')]);_0x18432b[_0x860e('0x32')]=_[_0x860e('0x30')](_0x14740e[_0x860e('0x2c')],qs[_0x860e('0x31')](_0x15ded8[_0x860e('0x2d')][_0x860e('0x31')]));_0x18432b[_0x860e('0x32')]=_0x18432b[_0x860e('0x32')][_0x860e('0x33')]?_0x18432b[_0x860e('0x32')]:_0x14740e[_0x860e('0x2c')];_0x18432b[_0x860e('0x36')]=qs[_0x860e('0x37')](_0x15ded8[_0x860e('0x2d')][_0x860e('0x37')]);_0x18432b[_0x860e('0x38')]=qs[_0x860e('0x2f')](_[_0x860e('0x39')](_0x15ded8[_0x860e('0x2d')],_0x14740e['filters']));if(_0x15ded8[_0x860e('0x2d')]['filter']){_0x18432b[_0x860e('0x38')]=_[_0x860e('0x3b')](_0x18432b[_0x860e('0x38')],{'$or':_[_0x860e('0x4a')](_0x18432b[_0x860e('0x32')],function(_0x20dd82){var _0x4d13f1={};_0x4d13f1[_0x20dd82]={'$like':'%'+_0x15ded8[_0x860e('0x2d')][_0x860e('0x3a')]+'%'};return _0x4d13f1;})});}_0x18432b=_['merge']({},_0x18432b,_0x15ded8[_0x860e('0x3d')]);return _0xc65e4e[_0x860e('0x4e')](_0x18432b);}})['then'](function(_0x32a303){if(_0x32a303){_0x5d184a=_0x32a303[_0x860e('0x33')];if(!_0x15ded8['query'][_0x860e('0x34')](_0x860e('0x35'))){_0x18432b[_0x860e('0x1c')]=qs[_0x860e('0x1c')](_0x15ded8[_0x860e('0x2d')][_0x860e('0x1c')]);_0x18432b[_0x860e('0x1a')]=qs['offset'](_0x15ded8['query'][_0x860e('0x1a')]);}return _0xc65e4e['getDescriptions'](_0x18432b);}})[_0x860e('0x22')](function(_0x30d244){if(_0x30d244){return _0x30d244?{'count':_0x5d184a,'rows':_0x30d244}:null;}})['then'](respondWithResult(_0xff7c2e,null))[_0x860e('0x43')](handleError(_0xff7c2e,null));}; \ No newline at end of file +var _0xa8d8=['length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','params','includeAll','find','create','body','destroy','findOne','SugarcrmField','pick','hasOwnProperty','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query'];(function(_0x4c66f1,_0xd2975d){var _0x2c6414=function(_0x1466ac){while(--_0x1466ac){_0x4c66f1['push'](_0x4c66f1['shift']());}};_0x2c6414(++_0xd2975d);}(_0xa8d8,0x1b3));var _0x8a8d=function(_0xb260f8,_0xc008c5){_0xb260f8=_0xb260f8-0x0;var _0x63096d=_0xa8d8[_0xb260f8];return _0x63096d;};'use strict';var emlformat=require(_0x8a8d('0x0'));var rimraf=require(_0x8a8d('0x1'));var zipdir=require(_0x8a8d('0x2'));var jsonpatch=require(_0x8a8d('0x3'));var rp=require(_0x8a8d('0x4'));var moment=require(_0x8a8d('0x5'));var BPromise=require(_0x8a8d('0x6'));var Mustache=require(_0x8a8d('0x7'));var util=require(_0x8a8d('0x8'));var path=require(_0x8a8d('0x9'));var sox=require('sox');var csv=require(_0x8a8d('0xa'));var ejs=require(_0x8a8d('0xb'));var fs=require('fs');var fs_extra=require(_0x8a8d('0xc'));var _=require(_0x8a8d('0xd'));var squel=require(_0x8a8d('0xe'));var crypto=require('crypto');var jsforce=require(_0x8a8d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8a8d('0xa'));var querystring=require(_0x8a8d('0x10'));var Papa=require(_0x8a8d('0x11'));var Redis=require(_0x8a8d('0x12'));var authService=require(_0x8a8d('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a8d('0x14'));var logger=require(_0x8a8d('0x15'))(_0x8a8d('0x16'));var utils=require(_0x8a8d('0x17'));var config=require(_0x8a8d('0x18'));var licenseUtil=require(_0x8a8d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5362c7,_0x5124c0){_0x5124c0=_0x5124c0||0xcc;return function(_0x7daefd){if(_0x7daefd){return _0x5362c7[_0x8a8d('0x1a')](_0x5124c0);}return _0x5362c7['status'](_0x5124c0)[_0x8a8d('0x1b')]();};}function respondWithResult(_0x2b0ab5,_0x9ac4be){_0x9ac4be=_0x9ac4be||0xc8;return function(_0x281625){if(_0x281625){return _0x2b0ab5['status'](_0x9ac4be)['json'](_0x281625);}};}function respondWithFilteredResult(_0x1857bf,_0x5d25a4){return function(_0x48b11a){if(_0x48b11a){var _0x585cfd=typeof _0x5d25a4[_0x8a8d('0x1c')]===_0x8a8d('0x1d')&&typeof _0x5d25a4[_0x8a8d('0x1e')]===_0x8a8d('0x1d');var _0x4221f2=_0x48b11a[_0x8a8d('0x1f')];var _0x12ccff=_0x585cfd?0x0:_0x5d25a4[_0x8a8d('0x1c')];var _0x4f2cfe=_0x585cfd?_0x48b11a[_0x8a8d('0x1f')]:_0x5d25a4[_0x8a8d('0x1c')]+_0x5d25a4['limit'];var _0x3c22f1;if(_0x4f2cfe>=_0x4221f2){_0x4f2cfe=_0x4221f2;_0x3c22f1=0xc8;}else{_0x3c22f1=0xce;}_0x1857bf[_0x8a8d('0x20')](_0x3c22f1);return _0x1857bf[_0x8a8d('0x21')](_0x8a8d('0x22'),_0x12ccff+'-'+_0x4f2cfe+'/'+_0x4221f2)['json'](_0x48b11a);}return null;};}function patchUpdates(_0x5d7ed1){return function(_0x304bdf){try{jsonpatch[_0x8a8d('0x23')](_0x304bdf,_0x5d7ed1,!![]);}catch(_0x11390f){return BPromise[_0x8a8d('0x24')](_0x11390f);}return _0x304bdf[_0x8a8d('0x25')]();};}function saveUpdates(_0x164748,_0x11ea58){return function(_0x1fd77d){if(_0x1fd77d){return _0x1fd77d[_0x8a8d('0x26')](_0x164748)[_0x8a8d('0x27')](function(_0x3fae){return _0x3fae;});}return null;};}function removeEntity(_0x1b7df7,_0x40c448){return function(_0xffb0bb){if(_0xffb0bb){return _0xffb0bb['destroy']()[_0x8a8d('0x27')](function(){_0x1b7df7[_0x8a8d('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x137e99,_0x52230e){return function(_0x1d23e6){if(!_0x1d23e6){_0x137e99['sendStatus'](0x194);}return _0x1d23e6;};}function handleError(_0x2b20c4,_0xf27709){_0xf27709=_0xf27709||0x1f4;return function(_0x3d3caf){logger[_0x8a8d('0x28')](_0x3d3caf[_0x8a8d('0x29')]);if(_0x3d3caf[_0x8a8d('0x2a')]){delete _0x3d3caf[_0x8a8d('0x2a')];}_0x2b20c4['status'](_0xf27709)[_0x8a8d('0x2b')](_0x3d3caf);};}exports['index']=function(_0x33742f,_0x317a7e){var _0x1db47f={},_0x29cd0b={},_0x12265e={'count':0x0,'rows':[]};var _0x5aaee7=_[_0x8a8d('0x2c')](db[_0x8a8d('0x2d')][_0x8a8d('0x2e')],function(_0x5e3f41){return{'name':_0x5e3f41[_0x8a8d('0x2f')],'type':_0x5e3f41[_0x8a8d('0x30')][_0x8a8d('0x31')]};});_0x29cd0b[_0x8a8d('0x32')]=_[_0x8a8d('0x2c')](_0x5aaee7,_0x8a8d('0x2a'));_0x29cd0b['query']=_[_0x8a8d('0x33')](_0x33742f['query']);_0x29cd0b[_0x8a8d('0x34')]=_[_0x8a8d('0x35')](_0x29cd0b[_0x8a8d('0x32')],_0x29cd0b['query']);_0x1db47f[_0x8a8d('0x36')]=_[_0x8a8d('0x35')](_0x29cd0b['model'],qs[_0x8a8d('0x37')](_0x33742f[_0x8a8d('0x38')][_0x8a8d('0x37')]));_0x1db47f[_0x8a8d('0x36')]=_0x1db47f[_0x8a8d('0x36')][_0x8a8d('0x39')]?_0x1db47f[_0x8a8d('0x36')]:_0x29cd0b[_0x8a8d('0x32')];if(!_0x33742f[_0x8a8d('0x38')]['hasOwnProperty'](_0x8a8d('0x3a'))){_0x1db47f['limit']=qs['limit'](_0x33742f[_0x8a8d('0x38')][_0x8a8d('0x1e')]);_0x1db47f[_0x8a8d('0x1c')]=qs[_0x8a8d('0x1c')](_0x33742f[_0x8a8d('0x38')][_0x8a8d('0x1c')]);}_0x1db47f[_0x8a8d('0x3b')]=qs[_0x8a8d('0x3c')](_0x33742f[_0x8a8d('0x38')]['sort']);_0x1db47f[_0x8a8d('0x3d')]=qs[_0x8a8d('0x34')](_['pick'](_0x33742f[_0x8a8d('0x38')],_0x29cd0b[_0x8a8d('0x34')]),_0x5aaee7);if(_0x33742f[_0x8a8d('0x38')][_0x8a8d('0x3e')]){_0x1db47f[_0x8a8d('0x3d')]=_[_0x8a8d('0x3f')](_0x1db47f[_0x8a8d('0x3d')],{'$or':_[_0x8a8d('0x2c')](_0x5aaee7,function(_0xc8be8b){if(_0xc8be8b[_0x8a8d('0x30')]!==_0x8a8d('0x40')){var _0x1b9ab8={};_0x1b9ab8[_0xc8be8b[_0x8a8d('0x2a')]]={'$like':'%'+_0x33742f[_0x8a8d('0x38')][_0x8a8d('0x3e')]+'%'};return _0x1b9ab8;}})});}_0x1db47f=_[_0x8a8d('0x3f')]({},_0x1db47f,_0x33742f[_0x8a8d('0x41')]);var _0x4e06ca={'where':_0x1db47f['where']};return db[_0x8a8d('0x2d')][_0x8a8d('0x1f')](_0x4e06ca)['then'](function(_0x523e7a){_0x12265e[_0x8a8d('0x1f')]=_0x523e7a;if(_0x33742f[_0x8a8d('0x38')]['includeAll']){_0x1db47f['include']=[{'all':!![]}];}return db[_0x8a8d('0x2d')][_0x8a8d('0x42')](_0x1db47f);})[_0x8a8d('0x27')](function(_0x89138d){_0x12265e[_0x8a8d('0x43')]=_0x89138d;return _0x12265e;})[_0x8a8d('0x27')](respondWithFilteredResult(_0x317a7e,_0x1db47f))[_0x8a8d('0x44')](handleError(_0x317a7e,null));};exports['show']=function(_0x5f346d,_0x1567ba){var _0x1ba56e={'raw':![],'where':{'id':_0x5f346d[_0x8a8d('0x45')]['id']}},_0x5e4615={};_0x5e4615[_0x8a8d('0x32')]=_[_0x8a8d('0x33')](db[_0x8a8d('0x2d')][_0x8a8d('0x2e')]);_0x5e4615['query']=_[_0x8a8d('0x33')](_0x5f346d['query']);_0x5e4615['filters']=_[_0x8a8d('0x35')](_0x5e4615[_0x8a8d('0x32')],_0x5e4615['query']);_0x1ba56e[_0x8a8d('0x36')]=_[_0x8a8d('0x35')](_0x5e4615[_0x8a8d('0x32')],qs['fields'](_0x5f346d[_0x8a8d('0x38')]['fields']));_0x1ba56e[_0x8a8d('0x36')]=_0x1ba56e['attributes'][_0x8a8d('0x39')]?_0x1ba56e['attributes']:_0x5e4615[_0x8a8d('0x32')];if(_0x5f346d[_0x8a8d('0x38')][_0x8a8d('0x46')]){_0x1ba56e['include']=[{'all':!![]}];}_0x1ba56e=_[_0x8a8d('0x3f')]({},_0x1ba56e,_0x5f346d[_0x8a8d('0x41')]);return db[_0x8a8d('0x2d')][_0x8a8d('0x47')](_0x1ba56e)[_0x8a8d('0x27')](handleEntityNotFound(_0x1567ba,null))[_0x8a8d('0x27')](respondWithResult(_0x1567ba,null))['catch'](handleError(_0x1567ba,null));};exports['create']=function(_0xb00269,_0x5873dd){return db[_0x8a8d('0x2d')][_0x8a8d('0x48')](_0xb00269[_0x8a8d('0x49')],{})['then'](respondWithResult(_0x5873dd,0xc9))[_0x8a8d('0x44')](handleError(_0x5873dd,null));};exports[_0x8a8d('0x26')]=function(_0x498173,_0x4823b5){if(_0x498173[_0x8a8d('0x49')]['id']){delete _0x498173[_0x8a8d('0x49')]['id'];}return db[_0x8a8d('0x2d')][_0x8a8d('0x47')]({'where':{'id':_0x498173[_0x8a8d('0x45')]['id']}})[_0x8a8d('0x27')](handleEntityNotFound(_0x4823b5,null))[_0x8a8d('0x27')](saveUpdates(_0x498173['body'],null))['then'](respondWithResult(_0x4823b5,null))['catch'](handleError(_0x4823b5,null));};exports[_0x8a8d('0x4a')]=function(_0x5d2ae7,_0x5a612e){return db[_0x8a8d('0x2d')][_0x8a8d('0x47')]({'where':{'id':_0x5d2ae7[_0x8a8d('0x45')]['id']}})[_0x8a8d('0x27')](handleEntityNotFound(_0x5a612e,null))[_0x8a8d('0x27')](removeEntity(_0x5a612e,null))['catch'](handleError(_0x5a612e,null));};exports['getFields']=function(_0x24cf5b,_0x5e2a03,_0x1ceb91){var _0x4e76a3={};var _0x143476={};var _0x517d05;var _0x8d5846;return db[_0x8a8d('0x2d')][_0x8a8d('0x4b')]({'where':{'id':_0x24cf5b[_0x8a8d('0x45')]['id']}})['then'](handleEntityNotFound(_0x5e2a03,null))[_0x8a8d('0x27')](function(_0xa19b45){if(_0xa19b45){_0x517d05=_0xa19b45;_0x143476['model']=_[_0x8a8d('0x33')](db[_0x8a8d('0x4c')][_0x8a8d('0x2e')]);_0x143476[_0x8a8d('0x38')]=_[_0x8a8d('0x33')](_0x24cf5b[_0x8a8d('0x38')]);_0x143476[_0x8a8d('0x34')]=_[_0x8a8d('0x35')](_0x143476[_0x8a8d('0x32')],_0x143476[_0x8a8d('0x38')]);_0x4e76a3[_0x8a8d('0x36')]=_['intersection'](_0x143476['model'],qs['fields'](_0x24cf5b['query'][_0x8a8d('0x37')]));_0x4e76a3[_0x8a8d('0x36')]=_0x4e76a3['attributes']['length']?_0x4e76a3[_0x8a8d('0x36')]:_0x143476['model'];_0x4e76a3['order']=qs[_0x8a8d('0x3c')](_0x24cf5b['query'][_0x8a8d('0x3c')]);_0x4e76a3[_0x8a8d('0x3d')]=qs[_0x8a8d('0x34')](_[_0x8a8d('0x4d')](_0x24cf5b[_0x8a8d('0x38')],_0x143476['filters']));if(_0x24cf5b['query'][_0x8a8d('0x3e')]){_0x4e76a3['where']=_[_0x8a8d('0x3f')](_0x4e76a3[_0x8a8d('0x3d')],{'$or':_[_0x8a8d('0x2c')](_0x4e76a3[_0x8a8d('0x36')],function(_0x21d954){var _0x5b75a0={};_0x5b75a0[_0x21d954]={'$like':'%'+_0x24cf5b[_0x8a8d('0x38')][_0x8a8d('0x3e')]+'%'};return _0x5b75a0;})});}_0x4e76a3=_[_0x8a8d('0x3f')]({},_0x4e76a3,_0x24cf5b[_0x8a8d('0x41')]);return _0x517d05['getFields'](_0x4e76a3);}})['then'](function(_0x4403a8){if(_0x4403a8){_0x8d5846=_0x4403a8[_0x8a8d('0x39')];if(!_0x24cf5b[_0x8a8d('0x38')][_0x8a8d('0x4e')]('nolimit')){_0x4e76a3[_0x8a8d('0x1e')]=qs['limit'](_0x24cf5b[_0x8a8d('0x38')]['limit']);_0x4e76a3[_0x8a8d('0x1c')]=qs[_0x8a8d('0x1c')](_0x24cf5b[_0x8a8d('0x38')]['offset']);}return _0x517d05[_0x8a8d('0x4f')](_0x4e76a3);}})['then'](function(_0x5e2855){if(_0x5e2855){return _0x5e2855?{'count':_0x8d5846,'rows':_0x5e2855}:null;}})[_0x8a8d('0x27')](respondWithResult(_0x5e2a03,null))[_0x8a8d('0x44')](handleError(_0x5e2a03,null));};exports[_0x8a8d('0x50')]=function(_0x4f95c4,_0x344929,_0x7b91e1){var _0x2f55b4={};var _0x26067e={};var _0xb65e07;var _0x15aa45;return db[_0x8a8d('0x2d')]['findOne']({'where':{'id':_0x4f95c4[_0x8a8d('0x45')]['id']}})[_0x8a8d('0x27')](handleEntityNotFound(_0x344929,null))[_0x8a8d('0x27')](function(_0x582b32){if(_0x582b32){_0xb65e07=_0x582b32;_0x26067e[_0x8a8d('0x32')]=_[_0x8a8d('0x33')](db[_0x8a8d('0x4c')]['rawAttributes']);_0x26067e[_0x8a8d('0x38')]=_['keys'](_0x4f95c4[_0x8a8d('0x38')]);_0x26067e[_0x8a8d('0x34')]=_[_0x8a8d('0x35')](_0x26067e[_0x8a8d('0x32')],_0x26067e[_0x8a8d('0x38')]);_0x2f55b4['attributes']=_[_0x8a8d('0x35')](_0x26067e[_0x8a8d('0x32')],qs[_0x8a8d('0x37')](_0x4f95c4[_0x8a8d('0x38')][_0x8a8d('0x37')]));_0x2f55b4[_0x8a8d('0x36')]=_0x2f55b4['attributes'][_0x8a8d('0x39')]?_0x2f55b4[_0x8a8d('0x36')]:_0x26067e[_0x8a8d('0x32')];_0x2f55b4[_0x8a8d('0x3b')]=qs[_0x8a8d('0x3c')](_0x4f95c4[_0x8a8d('0x38')][_0x8a8d('0x3c')]);_0x2f55b4['where']=qs['filters'](_[_0x8a8d('0x4d')](_0x4f95c4['query'],_0x26067e[_0x8a8d('0x34')]));if(_0x4f95c4[_0x8a8d('0x38')][_0x8a8d('0x3e')]){_0x2f55b4[_0x8a8d('0x3d')]=_[_0x8a8d('0x3f')](_0x2f55b4[_0x8a8d('0x3d')],{'$or':_[_0x8a8d('0x2c')](_0x2f55b4[_0x8a8d('0x36')],function(_0x28912b){var _0x392462={};_0x392462[_0x28912b]={'$like':'%'+_0x4f95c4[_0x8a8d('0x38')][_0x8a8d('0x3e')]+'%'};return _0x392462;})});}_0x2f55b4=_[_0x8a8d('0x3f')]({},_0x2f55b4,_0x4f95c4[_0x8a8d('0x41')]);return _0xb65e07[_0x8a8d('0x50')](_0x2f55b4);}})['then'](function(_0x5c25e7){if(_0x5c25e7){_0x15aa45=_0x5c25e7[_0x8a8d('0x39')];if(!_0x4f95c4[_0x8a8d('0x38')][_0x8a8d('0x4e')](_0x8a8d('0x3a'))){_0x2f55b4['limit']=qs[_0x8a8d('0x1e')](_0x4f95c4['query'][_0x8a8d('0x1e')]);_0x2f55b4[_0x8a8d('0x1c')]=qs[_0x8a8d('0x1c')](_0x4f95c4[_0x8a8d('0x38')][_0x8a8d('0x1c')]);}return _0xb65e07[_0x8a8d('0x50')](_0x2f55b4);}})[_0x8a8d('0x27')](function(_0x4124f8){if(_0x4124f8){return _0x4124f8?{'count':_0x15aa45,'rows':_0x4124f8}:null;}})[_0x8a8d('0x27')](respondWithResult(_0x344929,null))['catch'](handleError(_0x344929,null));};exports[_0x8a8d('0x51')]=function(_0x23e70c,_0x2e88ad,_0x5a5895){var _0xba4cb3={};var _0x1e57b1={};var _0x4132f8;var _0x498a23;return db[_0x8a8d('0x2d')][_0x8a8d('0x4b')]({'where':{'id':_0x23e70c[_0x8a8d('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e88ad,null))['then'](function(_0x1e543e){if(_0x1e543e){_0x4132f8=_0x1e543e;_0x1e57b1[_0x8a8d('0x32')]=_['keys'](db[_0x8a8d('0x4c')][_0x8a8d('0x2e')]);_0x1e57b1['query']=_[_0x8a8d('0x33')](_0x23e70c[_0x8a8d('0x38')]);_0x1e57b1[_0x8a8d('0x34')]=_['intersection'](_0x1e57b1[_0x8a8d('0x32')],_0x1e57b1['query']);_0xba4cb3['attributes']=_[_0x8a8d('0x35')](_0x1e57b1[_0x8a8d('0x32')],qs[_0x8a8d('0x37')](_0x23e70c[_0x8a8d('0x38')][_0x8a8d('0x37')]));_0xba4cb3['attributes']=_0xba4cb3['attributes'][_0x8a8d('0x39')]?_0xba4cb3['attributes']:_0x1e57b1['model'];_0xba4cb3[_0x8a8d('0x3b')]=qs[_0x8a8d('0x3c')](_0x23e70c[_0x8a8d('0x38')][_0x8a8d('0x3c')]);_0xba4cb3[_0x8a8d('0x3d')]=qs['filters'](_[_0x8a8d('0x4d')](_0x23e70c[_0x8a8d('0x38')],_0x1e57b1['filters']));if(_0x23e70c[_0x8a8d('0x38')][_0x8a8d('0x3e')]){_0xba4cb3[_0x8a8d('0x3d')]=_[_0x8a8d('0x3f')](_0xba4cb3[_0x8a8d('0x3d')],{'$or':_['map'](_0xba4cb3[_0x8a8d('0x36')],function(_0x3bc231){var _0x21ab58={};_0x21ab58[_0x3bc231]={'$like':'%'+_0x23e70c[_0x8a8d('0x38')][_0x8a8d('0x3e')]+'%'};return _0x21ab58;})});}_0xba4cb3=_[_0x8a8d('0x3f')]({},_0xba4cb3,_0x23e70c[_0x8a8d('0x41')]);return _0x4132f8[_0x8a8d('0x51')](_0xba4cb3);}})['then'](function(_0x23d5c2){if(_0x23d5c2){_0x498a23=_0x23d5c2['length'];if(!_0x23e70c[_0x8a8d('0x38')][_0x8a8d('0x4e')](_0x8a8d('0x3a'))){_0xba4cb3[_0x8a8d('0x1e')]=qs['limit'](_0x23e70c['query'][_0x8a8d('0x1e')]);_0xba4cb3['offset']=qs[_0x8a8d('0x1c')](_0x23e70c[_0x8a8d('0x38')][_0x8a8d('0x1c')]);}return _0x4132f8[_0x8a8d('0x51')](_0xba4cb3);}})[_0x8a8d('0x27')](function(_0x3b252d){if(_0x3b252d){return _0x3b252d?{'count':_0x498a23,'rows':_0x3b252d}:null;}})[_0x8a8d('0x27')](respondWithResult(_0x2e88ad,null))['catch'](handleError(_0x2e88ad,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index b3bd4ea..dcaf599 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 _0xf10c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x4fee0b,_0x3f7bba){var _0x2dffe8=function(_0x23002d){while(--_0x23002d){_0x4fee0b['push'](_0x4fee0b['shift']());}};_0x2dffe8(++_0x3f7bba);}(_0xf10c,0x1a3));var _0xcf10=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf10c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcf10('0x0'));var util=require(_0xcf10('0x1'));var logger=require(_0xcf10('0x2'))(_0xcf10('0x3'));var moment=require(_0xcf10('0x4'));var BPromise=require(_0xcf10('0x5'));var rp=require(_0xcf10('0x6'));var fs=require('fs');var path=require(_0xcf10('0x7'));var rimraf=require(_0xcf10('0x8'));var config=require('../../config/environment');var attributes=require(_0xcf10('0x9'));module[_0xcf10('0xa')]=function(_0x1b6c74,_0x229862){return _0x1b6c74[_0xcf10('0xb')](_0xcf10('0xc'),attributes,{'tableName':_0xcf10('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59d5=['request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','bluebird'];(function(_0x1476ab,_0x4bce3b){var _0x2b5fbc=function(_0x3e3103){while(--_0x3e3103){_0x1476ab['push'](_0x1476ab['shift']());}};_0x2b5fbc(++_0x4bce3b);}(_0x59d5,0x6a));var _0x559d=function(_0x57e6c8,_0xfc066e){_0x57e6c8=_0x57e6c8-0x0;var _0x592ecf=_0x59d5[_0x57e6c8];return _0x592ecf;};'use strict';var _=require(_0x559d('0x0'));var util=require(_0x559d('0x1'));var logger=require(_0x559d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x559d('0x3'));var rp=require(_0x559d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x559d('0x5'));var config=require(_0x559d('0x6'));var attributes=require(_0x559d('0x7'));module[_0x559d('0x8')]=function(_0x4314f2,_0x46ed6a){return _0x4314f2['define'](_0x559d('0x9'),attributes,{'tableName':_0x559d('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 27a0d2c..176d378 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 _0xb763=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb763,0xcf));var _0x3b76=function(_0x34efe0,_0x152723){_0x34efe0=_0x34efe0-0x0;var _0x30e933=_0xb763[_0x34efe0];return _0x30e933;};'use strict';var _=require(_0x3b76('0x0'));var util=require(_0x3b76('0x1'));var moment=require('moment');var BPromise=require(_0x3b76('0x2'));var rs=require(_0x3b76('0x3'));var fs=require('fs');var Redis=require(_0x3b76('0x4'));var db=require(_0x3b76('0x5'))['db'];var utils=require(_0x3b76('0x6'));var logger=require(_0x3b76('0x7'))(_0x3b76('0x8'));var config=require(_0x3b76('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3b76('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a306a,_0x3bd71d,_0x42fa28){return new BPromise(function(_0x513e38,_0x5107ed){return client[_0x3b76('0xb')](_0x2a306a,_0x42fa28)[_0x3b76('0xc')](function(_0x2d2897){logger[_0x3b76('0xd')](_0x3b76('0xe'),_0x3bd71d,_0x3b76('0xf'));logger[_0x3b76('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x3bd71d,'request\x20sent',JSON[_0x3b76('0x11')](_0x2d2897));if(_0x2d2897['error']){if(_0x2d2897[_0x3b76('0x12')][_0x3b76('0x13')]===0x1f4){logger['error'](_0x3b76('0xe'),_0x3bd71d,_0x2d2897[_0x3b76('0x12')][_0x3b76('0x14')]);return _0x5107ed(_0x2d2897[_0x3b76('0x12')][_0x3b76('0x14')]);}logger[_0x3b76('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3bd71d,_0x2d2897['error'][_0x3b76('0x14')]);return _0x513e38(_0x2d2897['error'][_0x3b76('0x14')]);}else{logger[_0x3b76('0xd')](_0x3b76('0xe'),_0x3bd71d,_0x3b76('0xf'));_0x513e38(_0x2d2897[_0x3b76('0x15')][_0x3b76('0x14')]);}})[_0x3b76('0x16')](function(_0x59c33d){logger[_0x3b76('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3bd71d,_0x59c33d);_0x5107ed(_0x59c33d);});});} \ No newline at end of file +var _0xd4d2=['SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x578f6f,_0x223fbc){var _0x371f09=function(_0x5a7243){while(--_0x5a7243){_0x578f6f['push'](_0x578f6f['shift']());}};_0x371f09(++_0x223fbc);}(_0xd4d2,0x1a6));var _0x2d4d=function(_0x2762f8,_0x215f83){_0x2762f8=_0x2762f8-0x0;var _0x21ccba=_0xd4d2[_0x2762f8];return _0x21ccba;};'use strict';var _=require('lodash');var util=require(_0x2d4d('0x0'));var moment=require(_0x2d4d('0x1'));var BPromise=require(_0x2d4d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d4d('0x3'))['db'];var utils=require(_0x2d4d('0x4'));var logger=require(_0x2d4d('0x5'))(_0x2d4d('0x6'));var config=require(_0x2d4d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2d4d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48b426,_0x2202c2,_0x4c8ccc){return new BPromise(function(_0x22bf87,_0x35355c){return client[_0x2d4d('0x9')](_0x48b426,_0x4c8ccc)[_0x2d4d('0xa')](function(_0x1e9f6a){logger[_0x2d4d('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2202c2,_0x2d4d('0xc'));logger[_0x2d4d('0xd')](_0x2d4d('0xe'),_0x2202c2,'request\x20sent',JSON[_0x2d4d('0xf')](_0x1e9f6a));if(_0x1e9f6a[_0x2d4d('0x10')]){if(_0x1e9f6a[_0x2d4d('0x10')][_0x2d4d('0x11')]===0x1f4){logger['error'](_0x2d4d('0x12'),_0x2202c2,_0x1e9f6a[_0x2d4d('0x10')][_0x2d4d('0x13')]);return _0x35355c(_0x1e9f6a[_0x2d4d('0x10')][_0x2d4d('0x13')]);}logger[_0x2d4d('0x10')](_0x2d4d('0x12'),_0x2202c2,_0x1e9f6a[_0x2d4d('0x10')][_0x2d4d('0x13')]);return _0x22bf87(_0x1e9f6a[_0x2d4d('0x10')][_0x2d4d('0x13')]);}else{logger[_0x2d4d('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2202c2,_0x2d4d('0xc'));_0x22bf87(_0x1e9f6a[_0x2d4d('0x14')]['message']);}})[_0x2d4d('0x15')](function(_0x178f25){logger[_0x2d4d('0x10')](_0x2d4d('0x12'),_0x2202c2,_0x178f25);_0x35355c(_0x178f25);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index d2f8152..2e4576b 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 _0xbba0=['index','get','/:id','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intSugarcrmField.controller','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbba0,0x104));var _0x0bba=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xbba0[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x0bba('0x0'));var util=require(_0x0bba('0x1'));var path=require(_0x0bba('0x2'));var timeout=require(_0x0bba('0x3'));var express=require(_0x0bba('0x4'));var router=express[_0x0bba('0x5')]();var fs_extra=require(_0x0bba('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0bba('0x7'));var config=require('../../config/environment');var controller=require(_0x0bba('0x8'));router['get']('/',auth[_0x0bba('0x9')](),controller[_0x0bba('0xa')]);router[_0x0bba('0xb')](_0x0bba('0xc'),auth[_0x0bba('0x9')](),controller[_0x0bba('0xd')]);router[_0x0bba('0xe')]('/',auth[_0x0bba('0x9')](),controller['create']);router[_0x0bba('0xf')](_0x0bba('0xc'),auth[_0x0bba('0x9')](),controller[_0x0bba('0x10')]);router['delete'](_0x0bba('0xc'),auth[_0x0bba('0x9')](),controller[_0x0bba('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4cbd=['create','put','update','destroy','exports','multer','util','connect-timeout','Router','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show'];(function(_0xc55a7d,_0x2ebbe8){var _0x58bae7=function(_0x4fc8f6){while(--_0x4fc8f6){_0xc55a7d['push'](_0xc55a7d['shift']());}};_0x58bae7(++_0x2ebbe8);}(_0x4cbd,0x1b5));var _0xd4cb=function(_0x14f9d4,_0x35b621){_0x14f9d4=_0x14f9d4-0x0;var _0x2a8de3=_0x4cbd[_0x14f9d4];return _0x2a8de3;};'use strict';var multer=require(_0xd4cb('0x0'));var util=require(_0xd4cb('0x1'));var path=require('path');var timeout=require(_0xd4cb('0x2'));var express=require('express');var router=express[_0xd4cb('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd4cb('0x4'));var controller=require(_0xd4cb('0x5'));router[_0xd4cb('0x6')]('/',auth[_0xd4cb('0x7')](),controller[_0xd4cb('0x8')]);router[_0xd4cb('0x6')](_0xd4cb('0x9'),auth[_0xd4cb('0x7')](),controller[_0xd4cb('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd4cb('0xb')]);router[_0xd4cb('0xc')](_0xd4cb('0x9'),auth[_0xd4cb('0x7')](),controller[_0xd4cb('0xd')]);router['delete'](_0xd4cb('0x9'),auth['isAuthenticated'](),controller[_0xd4cb('0xe')]);module[_0xd4cb('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 3378ce3..9df9064 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 _0x9b05=['STRING','sequelize','ENUM','variable','keyValue','string','customVariable'];(function(_0xeae324,_0x464ee2){var _0x5c98e4=function(_0x5b05b2){while(--_0x5b05b2){_0xeae324['push'](_0xeae324['shift']());}};_0x5c98e4(++_0x464ee2);}(_0x9b05,0x13c));var _0x59b0=function(_0x2d3d18,_0x475f4c){_0x2d3d18=_0x2d3d18-0x0;var _0x202f49=_0x9b05[_0x2d3d18];return _0x202f49;};'use strict';var Sequelize=require(_0x59b0('0x0'));module['exports']={'type':{'type':Sequelize[_0x59b0('0x1')]('string',_0x59b0('0x2'),'customVariable',_0x59b0('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x59b0('0x4'),_0x59b0('0x2'),_0x59b0('0x5'))},'keyContent':{'type':Sequelize[_0x59b0('0x6')]},'idField':{'type':Sequelize[_0x59b0('0x6')]},'nameField':{'type':Sequelize[_0x59b0('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3503=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x2106e8,_0x260adf){var _0x4c2462=function(_0x8e1770){while(--_0x8e1770){_0x2106e8['push'](_0x2106e8['shift']());}};_0x4c2462(++_0x260adf);}(_0x3503,0x11c));var _0x3350=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x3503[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require(_0x3350('0x0'));module[_0x3350('0x1')]={'type':{'type':Sequelize[_0x3350('0x2')](_0x3350('0x3'),_0x3350('0x4'),_0x3350('0x5'),_0x3350('0x6'),'picklist'),'defaultValue':_0x3350('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3350('0x7')]},'keyType':{'type':Sequelize[_0x3350('0x2')](_0x3350('0x3'),_0x3350('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x3350('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3350('0x7')]},'customField':{'type':Sequelize[_0x3350('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 f0e2ea3..27b1aad 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 _0xf38c=['util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x1c80d3,_0x4e00ab){var _0x3d4ad8=function(_0x13fb7e){while(--_0x13fb7e){_0x1c80d3['push'](_0x1c80d3['shift']());}};_0x3d4ad8(++_0x4e00ab);}(_0xf38c,0x17e));var _0xcf38=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf38c[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xcf38('0x0'));var rimraf=require(_0xcf38('0x1'));var zipdir=require(_0xcf38('0x2'));var jsonpatch=require(_0xcf38('0x3'));var rp=require(_0xcf38('0x4'));var moment=require(_0xcf38('0x5'));var BPromise=require(_0xcf38('0x6'));var Mustache=require(_0xcf38('0x7'));var util=require(_0xcf38('0x8'));var path=require(_0xcf38('0x9'));var sox=require(_0xcf38('0xa'));var csv=require('to-csv');var ejs=require(_0xcf38('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf38('0xc'));var squel=require(_0xcf38('0xd'));var crypto=require(_0xcf38('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xcf38('0xf'));var toCsv=require(_0xcf38('0x10'));var querystring=require('querystring');var Papa=require(_0xcf38('0x11'));var Redis=require(_0xcf38('0x12'));var authService=require(_0xcf38('0x13'));var qs=require(_0xcf38('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf38('0x15'));var logger=require(_0xcf38('0x16'))(_0xcf38('0x17'));var utils=require(_0xcf38('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xcf38('0x19'));var db=require(_0xcf38('0x1a'))['db'];function respondWithStatusCode(_0x4afc66,_0x27d81f){_0x27d81f=_0x27d81f||0xcc;return function(_0x1d4d58){if(_0x1d4d58){return _0x4afc66[_0xcf38('0x1b')](_0x27d81f);}return _0x4afc66[_0xcf38('0x1c')](_0x27d81f)[_0xcf38('0x1d')]();};}function respondWithResult(_0x3d6782,_0x1c580c){_0x1c580c=_0x1c580c||0xc8;return function(_0xa3275a){if(_0xa3275a){return _0x3d6782['status'](_0x1c580c)[_0xcf38('0x1e')](_0xa3275a);}};}function respondWithFilteredResult(_0x3ff42c,_0x703a9a){return function(_0x174399){if(_0x174399){var _0x119f51=typeof _0x703a9a[_0xcf38('0x1f')]===_0xcf38('0x20')&&typeof _0x703a9a['limit']==='undefined';var _0x4c9718=_0x174399[_0xcf38('0x21')];var _0x39d278=_0x119f51?0x0:_0x703a9a['offset'];var _0x2b16a3=_0x119f51?_0x174399[_0xcf38('0x21')]:_0x703a9a[_0xcf38('0x1f')]+_0x703a9a['limit'];var _0x32b08d;if(_0x2b16a3>=_0x4c9718){_0x2b16a3=_0x4c9718;_0x32b08d=0xc8;}else{_0x32b08d=0xce;}_0x3ff42c['status'](_0x32b08d);return _0x3ff42c[_0xcf38('0x22')](_0xcf38('0x23'),_0x39d278+'-'+_0x2b16a3+'/'+_0x4c9718)[_0xcf38('0x1e')](_0x174399);}return null;};}function patchUpdates(_0x1d1893){return function(_0x2cbfa4){try{jsonpatch['apply'](_0x2cbfa4,_0x1d1893,!![]);}catch(_0x2613ff){return BPromise[_0xcf38('0x24')](_0x2613ff);}return _0x2cbfa4[_0xcf38('0x25')]();};}function saveUpdates(_0x19e81f,_0x2e03f9){return function(_0x4a35a7){if(_0x4a35a7){return _0x4a35a7[_0xcf38('0x26')](_0x19e81f)[_0xcf38('0x27')](function(_0x4ea92e){return _0x4ea92e;});}return null;};}function removeEntity(_0x3455be,_0x3bc8e5){return function(_0x2e7b66){if(_0x2e7b66){return _0x2e7b66[_0xcf38('0x28')]()['then'](function(){_0x3455be['status'](0xcc)[_0xcf38('0x1d')]();});}};}function handleEntityNotFound(_0x4314fe,_0x2760f3){return function(_0x37286c){if(!_0x37286c){_0x4314fe[_0xcf38('0x1b')](0x194);}return _0x37286c;};}function handleError(_0x5d7e3f,_0x49077b){_0x49077b=_0x49077b||0x1f4;return function(_0x189f2b){logger[_0xcf38('0x29')](_0x189f2b[_0xcf38('0x2a')]);if(_0x189f2b[_0xcf38('0x2b')]){delete _0x189f2b[_0xcf38('0x2b')];}_0x5d7e3f['status'](_0x49077b)[_0xcf38('0x2c')](_0x189f2b);};}exports[_0xcf38('0x2d')]=function(_0x4790f2,_0x7e5549){var _0x4b0160={},_0x9fef83={},_0x2f3a9e={'count':0x0,'rows':[]};var _0x21a80e=_[_0xcf38('0x2e')](db[_0xcf38('0x2f')][_0xcf38('0x30')],function(_0x49ef24){return{'name':_0x49ef24['fieldName'],'type':_0x49ef24[_0xcf38('0x31')][_0xcf38('0x32')]};});_0x9fef83[_0xcf38('0x33')]=_[_0xcf38('0x2e')](_0x21a80e,_0xcf38('0x2b'));_0x9fef83['query']=_[_0xcf38('0x34')](_0x4790f2[_0xcf38('0x35')]);_0x9fef83[_0xcf38('0x36')]=_['intersection'](_0x9fef83[_0xcf38('0x33')],_0x9fef83[_0xcf38('0x35')]);_0x4b0160[_0xcf38('0x37')]=_[_0xcf38('0x38')](_0x9fef83['model'],qs[_0xcf38('0x39')](_0x4790f2['query']['fields']));_0x4b0160[_0xcf38('0x37')]=_0x4b0160[_0xcf38('0x37')][_0xcf38('0x3a')]?_0x4b0160['attributes']:_0x9fef83[_0xcf38('0x33')];if(!_0x4790f2['query'][_0xcf38('0x3b')]('nolimit')){_0x4b0160[_0xcf38('0x3c')]=qs[_0xcf38('0x3c')](_0x4790f2['query'][_0xcf38('0x3c')]);_0x4b0160[_0xcf38('0x1f')]=qs[_0xcf38('0x1f')](_0x4790f2[_0xcf38('0x35')][_0xcf38('0x1f')]);}_0x4b0160['order']=qs['sort'](_0x4790f2['query'][_0xcf38('0x3d')]);_0x4b0160[_0xcf38('0x3e')]=qs['filters'](_[_0xcf38('0x3f')](_0x4790f2['query'],_0x9fef83[_0xcf38('0x36')]),_0x21a80e);if(_0x4790f2[_0xcf38('0x35')][_0xcf38('0x40')]){_0x4b0160['where']=_[_0xcf38('0x41')](_0x4b0160[_0xcf38('0x3e')],{'$or':_[_0xcf38('0x2e')](_0x21a80e,function(_0x348d51){if(_0x348d51[_0xcf38('0x31')]!==_0xcf38('0x42')){var _0x44901e={};_0x44901e[_0x348d51[_0xcf38('0x2b')]]={'$like':'%'+_0x4790f2[_0xcf38('0x35')][_0xcf38('0x40')]+'%'};return _0x44901e;}})});}_0x4b0160=_[_0xcf38('0x41')]({},_0x4b0160,_0x4790f2[_0xcf38('0x43')]);var _0x57125a={'where':_0x4b0160['where']};return db[_0xcf38('0x2f')]['count'](_0x57125a)[_0xcf38('0x27')](function(_0x44c9a0){_0x2f3a9e[_0xcf38('0x21')]=_0x44c9a0;if(_0x4790f2['query'][_0xcf38('0x44')]){_0x4b0160[_0xcf38('0x45')]=[{'all':!![]}];}return db[_0xcf38('0x2f')][_0xcf38('0x46')](_0x4b0160);})[_0xcf38('0x27')](function(_0x5bbd1c){_0x2f3a9e[_0xcf38('0x47')]=_0x5bbd1c;return _0x2f3a9e;})['then'](respondWithFilteredResult(_0x7e5549,_0x4b0160))[_0xcf38('0x48')](handleError(_0x7e5549,null));};exports[_0xcf38('0x49')]=function(_0x5d86b3,_0x5e451a){var _0xba3078={'raw':!![],'where':{'id':_0x5d86b3[_0xcf38('0x4a')]['id']}},_0x3f91fd={};_0x3f91fd[_0xcf38('0x33')]=_['keys'](db[_0xcf38('0x2f')][_0xcf38('0x30')]);_0x3f91fd[_0xcf38('0x35')]=_[_0xcf38('0x34')](_0x5d86b3[_0xcf38('0x35')]);_0x3f91fd[_0xcf38('0x36')]=_[_0xcf38('0x38')](_0x3f91fd[_0xcf38('0x33')],_0x3f91fd['query']);_0xba3078[_0xcf38('0x37')]=_[_0xcf38('0x38')](_0x3f91fd[_0xcf38('0x33')],qs[_0xcf38('0x39')](_0x5d86b3[_0xcf38('0x35')][_0xcf38('0x39')]));_0xba3078[_0xcf38('0x37')]=_0xba3078[_0xcf38('0x37')][_0xcf38('0x3a')]?_0xba3078[_0xcf38('0x37')]:_0x3f91fd[_0xcf38('0x33')];if(_0x5d86b3[_0xcf38('0x35')][_0xcf38('0x44')]){_0xba3078[_0xcf38('0x45')]=[{'all':!![]}];}_0xba3078=_[_0xcf38('0x41')]({},_0xba3078,_0x5d86b3[_0xcf38('0x43')]);return db[_0xcf38('0x2f')][_0xcf38('0x4b')](_0xba3078)['then'](handleEntityNotFound(_0x5e451a,null))[_0xcf38('0x27')](respondWithResult(_0x5e451a,null))[_0xcf38('0x48')](handleError(_0x5e451a,null));};exports[_0xcf38('0x4c')]=function(_0x441ceb,_0x5e0480){return db[_0xcf38('0x2f')][_0xcf38('0x4c')](_0x441ceb[_0xcf38('0x4d')],{})[_0xcf38('0x27')](respondWithResult(_0x5e0480,0xc9))[_0xcf38('0x48')](handleError(_0x5e0480,null));};exports[_0xcf38('0x26')]=function(_0x1c672b,_0x22546c){if(_0x1c672b[_0xcf38('0x4d')]['id']){delete _0x1c672b['body']['id'];}return db[_0xcf38('0x2f')][_0xcf38('0x4b')]({'where':{'id':_0x1c672b[_0xcf38('0x4a')]['id']}})['then'](handleEntityNotFound(_0x22546c,null))[_0xcf38('0x27')](saveUpdates(_0x1c672b[_0xcf38('0x4d')],null))[_0xcf38('0x27')](respondWithResult(_0x22546c,null))['catch'](handleError(_0x22546c,null));};exports['destroy']=function(_0x4d24c4,_0x2ee4cd){return db[_0xcf38('0x2f')]['find']({'where':{'id':_0x4d24c4['params']['id']}})[_0xcf38('0x27')](handleEntityNotFound(_0x2ee4cd,null))[_0xcf38('0x27')](removeEntity(_0x2ee4cd,null))[_0xcf38('0x48')](handleError(_0x2ee4cd,null));}; \ No newline at end of file +var _0xdc7f=['path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../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','send','index','SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','keys','intersection','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xdc7f,0x1d8));var _0xfdc7=function(_0x3b2d98,_0xaa0b26){_0x3b2d98=_0x3b2d98-0x0;var _0x256bf1=_0xdc7f[_0x3b2d98];return _0x256bf1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfdc7('0x0'));var zipdir=require(_0xfdc7('0x1'));var jsonpatch=require(_0xfdc7('0x2'));var rp=require(_0xfdc7('0x3'));var moment=require(_0xfdc7('0x4'));var BPromise=require(_0xfdc7('0x5'));var Mustache=require(_0xfdc7('0x6'));var util=require(_0xfdc7('0x7'));var path=require(_0xfdc7('0x8'));var sox=require(_0xfdc7('0x9'));var csv=require(_0xfdc7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfdc7('0xb'));var _=require(_0xfdc7('0xc'));var squel=require(_0xfdc7('0xd'));var crypto=require(_0xfdc7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfdc7('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfdc7('0x10'));var Papa=require(_0xfdc7('0x11'));var Redis=require(_0xfdc7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfdc7('0x13'));var as=require(_0xfdc7('0x14'));var hardwareService=require(_0xfdc7('0x15'));var logger=require(_0xfdc7('0x16'))(_0xfdc7('0x17'));var utils=require(_0xfdc7('0x18'));var config=require(_0xfdc7('0x19'));var licenseUtil=require(_0xfdc7('0x1a'));var db=require(_0xfdc7('0x1b'))['db'];function respondWithStatusCode(_0x8a5093,_0x4e8df7){_0x4e8df7=_0x4e8df7||0xcc;return function(_0x59fa59){if(_0x59fa59){return _0x8a5093[_0xfdc7('0x1c')](_0x4e8df7);}return _0x8a5093[_0xfdc7('0x1d')](_0x4e8df7)[_0xfdc7('0x1e')]();};}function respondWithResult(_0x559fba,_0x4fc1cc){_0x4fc1cc=_0x4fc1cc||0xc8;return function(_0x32fd1a){if(_0x32fd1a){return _0x559fba['status'](_0x4fc1cc)[_0xfdc7('0x1f')](_0x32fd1a);}};}function respondWithFilteredResult(_0x22e75f,_0x409dbc){return function(_0x1ac393){if(_0x1ac393){var _0xd49ba7=typeof _0x409dbc[_0xfdc7('0x20')]===_0xfdc7('0x21')&&typeof _0x409dbc[_0xfdc7('0x22')]==='undefined';var _0x526652=_0x1ac393['count'];var _0x1ef30a=_0xd49ba7?0x0:_0x409dbc[_0xfdc7('0x20')];var _0x1f7ecf=_0xd49ba7?_0x1ac393['count']:_0x409dbc[_0xfdc7('0x20')]+_0x409dbc[_0xfdc7('0x22')];var _0x538e40;if(_0x1f7ecf>=_0x526652){_0x1f7ecf=_0x526652;_0x538e40=0xc8;}else{_0x538e40=0xce;}_0x22e75f[_0xfdc7('0x1d')](_0x538e40);return _0x22e75f[_0xfdc7('0x23')](_0xfdc7('0x24'),_0x1ef30a+'-'+_0x1f7ecf+'/'+_0x526652)[_0xfdc7('0x1f')](_0x1ac393);}return null;};}function patchUpdates(_0x4b4034){return function(_0x146559){try{jsonpatch[_0xfdc7('0x25')](_0x146559,_0x4b4034,!![]);}catch(_0x3c854a){return BPromise[_0xfdc7('0x26')](_0x3c854a);}return _0x146559[_0xfdc7('0x27')]();};}function saveUpdates(_0x56f757,_0x573097){return function(_0x56cc85){if(_0x56cc85){return _0x56cc85[_0xfdc7('0x28')](_0x56f757)[_0xfdc7('0x29')](function(_0x214d2f){return _0x214d2f;});}return null;};}function removeEntity(_0x368c6c,_0x11f866){return function(_0x3892b4){if(_0x3892b4){return _0x3892b4[_0xfdc7('0x2a')]()[_0xfdc7('0x29')](function(){_0x368c6c[_0xfdc7('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ecc8c,_0x33ab27){return function(_0x55b71f){if(!_0x55b71f){_0x2ecc8c[_0xfdc7('0x1c')](0x194);}return _0x55b71f;};}function handleError(_0x5a98f1,_0x2e50c2){_0x2e50c2=_0x2e50c2||0x1f4;return function(_0x20ab7e){logger[_0xfdc7('0x2b')](_0x20ab7e[_0xfdc7('0x2c')]);if(_0x20ab7e['name']){delete _0x20ab7e[_0xfdc7('0x2d')];}_0x5a98f1[_0xfdc7('0x1d')](_0x2e50c2)[_0xfdc7('0x2e')](_0x20ab7e);};}exports[_0xfdc7('0x2f')]=function(_0x378273,_0x1bbc72){var _0x4f9e88={},_0x44ebe2={},_0x4962c3={'count':0x0,'rows':[]};var _0x5dabcd=_['map'](db[_0xfdc7('0x30')][_0xfdc7('0x31')],function(_0x55b5bf){return{'name':_0x55b5bf[_0xfdc7('0x32')],'type':_0x55b5bf[_0xfdc7('0x33')][_0xfdc7('0x34')]};});_0x44ebe2[_0xfdc7('0x35')]=_[_0xfdc7('0x36')](_0x5dabcd,_0xfdc7('0x2d'));_0x44ebe2[_0xfdc7('0x37')]=_['keys'](_0x378273[_0xfdc7('0x37')]);_0x44ebe2[_0xfdc7('0x38')]=_['intersection'](_0x44ebe2[_0xfdc7('0x35')],_0x44ebe2[_0xfdc7('0x37')]);_0x4f9e88[_0xfdc7('0x39')]=_['intersection'](_0x44ebe2[_0xfdc7('0x35')],qs[_0xfdc7('0x3a')](_0x378273[_0xfdc7('0x37')][_0xfdc7('0x3a')]));_0x4f9e88[_0xfdc7('0x39')]=_0x4f9e88[_0xfdc7('0x39')][_0xfdc7('0x3b')]?_0x4f9e88[_0xfdc7('0x39')]:_0x44ebe2[_0xfdc7('0x35')];if(!_0x378273[_0xfdc7('0x37')]['hasOwnProperty']('nolimit')){_0x4f9e88['limit']=qs[_0xfdc7('0x22')](_0x378273[_0xfdc7('0x37')]['limit']);_0x4f9e88[_0xfdc7('0x20')]=qs['offset'](_0x378273[_0xfdc7('0x37')][_0xfdc7('0x20')]);}_0x4f9e88[_0xfdc7('0x3c')]=qs[_0xfdc7('0x3d')](_0x378273[_0xfdc7('0x37')][_0xfdc7('0x3d')]);_0x4f9e88['where']=qs['filters'](_[_0xfdc7('0x3e')](_0x378273['query'],_0x44ebe2[_0xfdc7('0x38')]),_0x5dabcd);if(_0x378273['query'][_0xfdc7('0x3f')]){_0x4f9e88[_0xfdc7('0x40')]=_[_0xfdc7('0x41')](_0x4f9e88[_0xfdc7('0x40')],{'$or':_[_0xfdc7('0x36')](_0x5dabcd,function(_0x306eb9){if(_0x306eb9[_0xfdc7('0x33')]!==_0xfdc7('0x42')){var _0x3184a9={};_0x3184a9[_0x306eb9[_0xfdc7('0x2d')]]={'$like':'%'+_0x378273[_0xfdc7('0x37')][_0xfdc7('0x3f')]+'%'};return _0x3184a9;}})});}_0x4f9e88=_[_0xfdc7('0x41')]({},_0x4f9e88,_0x378273[_0xfdc7('0x43')]);var _0x420f0c={'where':_0x4f9e88[_0xfdc7('0x40')]};return db[_0xfdc7('0x30')][_0xfdc7('0x44')](_0x420f0c)[_0xfdc7('0x29')](function(_0x1c6382){_0x4962c3[_0xfdc7('0x44')]=_0x1c6382;if(_0x378273[_0xfdc7('0x37')][_0xfdc7('0x45')]){_0x4f9e88[_0xfdc7('0x46')]=[{'all':!![]}];}return db[_0xfdc7('0x30')][_0xfdc7('0x47')](_0x4f9e88);})[_0xfdc7('0x29')](function(_0x5203f){_0x4962c3['rows']=_0x5203f;return _0x4962c3;})[_0xfdc7('0x29')](respondWithFilteredResult(_0x1bbc72,_0x4f9e88))[_0xfdc7('0x48')](handleError(_0x1bbc72,null));};exports[_0xfdc7('0x49')]=function(_0x476b2f,_0x17b34){var _0x3e2d8a={'raw':!![],'where':{'id':_0x476b2f[_0xfdc7('0x4a')]['id']}},_0x1b398d={};_0x1b398d[_0xfdc7('0x35')]=_[_0xfdc7('0x4b')](db[_0xfdc7('0x30')]['rawAttributes']);_0x1b398d['query']=_[_0xfdc7('0x4b')](_0x476b2f[_0xfdc7('0x37')]);_0x1b398d['filters']=_[_0xfdc7('0x4c')](_0x1b398d['model'],_0x1b398d[_0xfdc7('0x37')]);_0x3e2d8a['attributes']=_['intersection'](_0x1b398d[_0xfdc7('0x35')],qs[_0xfdc7('0x3a')](_0x476b2f[_0xfdc7('0x37')][_0xfdc7('0x3a')]));_0x3e2d8a[_0xfdc7('0x39')]=_0x3e2d8a[_0xfdc7('0x39')]['length']?_0x3e2d8a['attributes']:_0x1b398d[_0xfdc7('0x35')];if(_0x476b2f['query'][_0xfdc7('0x45')]){_0x3e2d8a[_0xfdc7('0x46')]=[{'all':!![]}];}_0x3e2d8a=_[_0xfdc7('0x41')]({},_0x3e2d8a,_0x476b2f[_0xfdc7('0x43')]);return db['SugarcrmField'][_0xfdc7('0x4d')](_0x3e2d8a)[_0xfdc7('0x29')](handleEntityNotFound(_0x17b34,null))['then'](respondWithResult(_0x17b34,null))[_0xfdc7('0x48')](handleError(_0x17b34,null));};exports[_0xfdc7('0x4e')]=function(_0x26b4ec,_0x17b7ee){return db[_0xfdc7('0x30')][_0xfdc7('0x4e')](_0x26b4ec[_0xfdc7('0x4f')],{})[_0xfdc7('0x29')](respondWithResult(_0x17b7ee,0xc9))['catch'](handleError(_0x17b7ee,null));};exports['update']=function(_0x4b4274,_0x3b907a){if(_0x4b4274['body']['id']){delete _0x4b4274[_0xfdc7('0x4f')]['id'];}return db[_0xfdc7('0x30')][_0xfdc7('0x4d')]({'where':{'id':_0x4b4274[_0xfdc7('0x4a')]['id']}})[_0xfdc7('0x29')](handleEntityNotFound(_0x3b907a,null))['then'](saveUpdates(_0x4b4274[_0xfdc7('0x4f')],null))[_0xfdc7('0x29')](respondWithResult(_0x3b907a,null))[_0xfdc7('0x48')](handleError(_0x3b907a,null));};exports[_0xfdc7('0x2a')]=function(_0x667119,_0x2bf55d){return db[_0xfdc7('0x30')][_0xfdc7('0x4d')]({'where':{'id':_0x667119['params']['id']}})[_0xfdc7('0x29')](handleEntityNotFound(_0x2bf55d,null))[_0xfdc7('0x29')](removeEntity(_0x2bf55d,null))[_0xfdc7('0x48')](handleError(_0x2bf55d,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 932c63c..6ad40c9 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 _0x4d6d=['api','request-promise','rimraf','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util'];(function(_0x3da942,_0x3c971e){var _0x114520=function(_0x540a0c){while(--_0x540a0c){_0x3da942['push'](_0x3da942['shift']());}};_0x114520(++_0x3c971e);}(_0x4d6d,0x1ac));var _0xd4d6=function(_0x4f1b4b,_0xce0ec4){_0x4f1b4b=_0x4f1b4b-0x0;var _0x582d34=_0x4d6d[_0x4f1b4b];return _0x582d34;};'use strict';var _=require('lodash');var util=require(_0xd4d6('0x0'));var logger=require('../../config/logger')(_0xd4d6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd4d6('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd4d6('0x3'));var config=require('../../config/environment');var attributes=require(_0xd4d6('0x4'));module['exports']=function(_0x1d05a0,_0xd17ddb){return _0x1d05a0[_0xd4d6('0x5')](_0xd4d6('0x6'),attributes,{'tableName':_0xd4d6('0x7'),'paranoid':![],'indexes':[{'name':_0xd4d6('0x8'),'fields':[_0xd4d6('0x9'),_0xd4d6('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1866=['exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes'];(function(_0x160cea,_0x86307e){var _0x13382b=function(_0x163e09){while(--_0x163e09){_0x160cea['push'](_0x160cea['shift']());}};_0x13382b(++_0x86307e);}(_0x1866,0x106));var _0x6186=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x1866[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x6186('0x0'));var util=require(_0x6186('0x1'));var logger=require(_0x6186('0x2'))(_0x6186('0x3'));var moment=require(_0x6186('0x4'));var BPromise=require(_0x6186('0x5'));var rp=require(_0x6186('0x6'));var fs=require('fs');var path=require(_0x6186('0x7'));var rimraf=require('rimraf');var config=require(_0x6186('0x8'));var attributes=require(_0x6186('0x9'));module[_0x6186('0xa')]=function(_0xc2b08c,_0x1cfd8d){return _0xc2b08c[_0x6186('0xb')](_0x6186('0xc'),attributes,{'tableName':_0x6186('0xd'),'paranoid':![],'indexes':[{'name':_0x6186('0xe'),'fields':[_0x6186('0xf'),_0x6186('0x10')],'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 7e0a828..a9f2c49 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 _0x51dd=['../../config/logger','../../config/environment','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','code','error','message','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x441db3,_0x10f359){var _0x16c05d=function(_0x4c0d4e){while(--_0x4c0d4e){_0x441db3['push'](_0x441db3['shift']());}};_0x16c05d(++_0x10f359);}(_0x51dd,0xaf));var _0xd51d=function(_0x354e9d,_0x297682){_0x354e9d=_0x354e9d-0x0;var _0x56711d=_0x51dd[_0x354e9d];return _0x56711d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd51d('0x0'));var BPromise=require('bluebird');var rs=require(_0xd51d('0x1'));var fs=require('fs');var Redis=require(_0xd51d('0x2'));var db=require(_0xd51d('0x3'))['db'];var utils=require(_0xd51d('0x4'));var logger=require(_0xd51d('0x5'))('rpc');var config=require(_0xd51d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd51d('0x7')][_0xd51d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7dc4f9,_0x5f0c5c,_0x3282f5){return new BPromise(function(_0x86a2c4,_0xb6d4f){return client[_0xd51d('0x9')](_0x7dc4f9,_0x3282f5)[_0xd51d('0xa')](function(_0x554d42){logger[_0xd51d('0xb')](_0xd51d('0xc'),_0x5f0c5c,_0xd51d('0xd'));logger['debug'](_0xd51d('0xe'),_0x5f0c5c,_0xd51d('0xd'),JSON['stringify'](_0x554d42));if(_0x554d42['error']){if(_0x554d42['error'][_0xd51d('0xf')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x5f0c5c,_0x554d42[_0xd51d('0x10')][_0xd51d('0x11')]);return _0xb6d4f(_0x554d42['error'][_0xd51d('0x11')]);}logger['error'](_0xd51d('0xc'),_0x5f0c5c,_0x554d42[_0xd51d('0x10')][_0xd51d('0x11')]);return _0x86a2c4(_0x554d42[_0xd51d('0x10')][_0xd51d('0x11')]);}else{logger[_0xd51d('0xb')](_0xd51d('0xc'),_0x5f0c5c,_0xd51d('0xd'));_0x86a2c4(_0x554d42['result'][_0xd51d('0x11')]);}})['catch'](function(_0x1ac261){logger[_0xd51d('0x10')](_0xd51d('0xc'),_0x5f0c5c,_0x1ac261);_0xb6d4f(_0x1ac261);});});} \ No newline at end of file +var _0x4d8a=['request\x20sent','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x43b791,_0x1d8125){var _0x2c8f2d=function(_0x274cc4){while(--_0x274cc4){_0x43b791['push'](_0x43b791['shift']());}};_0x2c8f2d(++_0x1d8125);}(_0x4d8a,0x196));var _0xa4d8=function(_0x12e931,_0x4582c4){_0x12e931=_0x12e931-0x0;var _0xc64d2d=_0x4d8a[_0x12e931];return _0xc64d2d;};'use strict';var _=require('lodash');var util=require(_0xa4d8('0x0'));var moment=require(_0xa4d8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4d8('0x2'));var db=require(_0xa4d8('0x3'))['db'];var utils=require(_0xa4d8('0x4'));var logger=require(_0xa4d8('0x5'))(_0xa4d8('0x6'));var config=require('../../config/environment');var jayson=require(_0xa4d8('0x7'));var client=jayson[_0xa4d8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40ab64,_0x57db7b,_0x308870){return new BPromise(function(_0x5e46ed,_0x536b43){return client['request'](_0x40ab64,_0x308870)[_0xa4d8('0x9')](function(_0x33abef){logger[_0xa4d8('0xa')](_0xa4d8('0xb'),_0x57db7b,'request\x20sent');logger[_0xa4d8('0xc')](_0xa4d8('0xd'),_0x57db7b,_0xa4d8('0xe'),JSON[_0xa4d8('0xf')](_0x33abef));if(_0x33abef['error']){if(_0x33abef[_0xa4d8('0x10')][_0xa4d8('0x11')]===0x1f4){logger[_0xa4d8('0x10')](_0xa4d8('0xb'),_0x57db7b,_0x33abef['error'][_0xa4d8('0x12')]);return _0x536b43(_0x33abef['error'][_0xa4d8('0x12')]);}logger['error'](_0xa4d8('0xb'),_0x57db7b,_0x33abef[_0xa4d8('0x10')][_0xa4d8('0x12')]);return _0x5e46ed(_0x33abef['error'][_0xa4d8('0x12')]);}else{logger['info'](_0xa4d8('0xb'),_0x57db7b,_0xa4d8('0xe'));_0x5e46ed(_0x33abef[_0xa4d8('0x13')][_0xa4d8('0x12')]);}})[_0xa4d8('0x14')](function(_0x38d5f5){logger['error'](_0xa4d8('0xb'),_0x57db7b,_0x38d5f5);_0x536b43(_0x38d5f5);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 2b91702..10844b0 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 _0x44d5=['show','/:id/configurations','getConfigurations','post','addConfiguration','put','delete','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x31168a,_0x8cc769){var _0x369be2=function(_0x495f3a){while(--_0x495f3a){_0x31168a['push'](_0x31168a['shift']());}};_0x369be2(++_0x8cc769);}(_0x44d5,0x1a5));var _0x544d=function(_0x551bc1,_0x47cff3){_0x551bc1=_0x551bc1-0x0;var _0x12ea5e=_0x44d5[_0x551bc1];return _0x12ea5e;};'use strict';var multer=require(_0x544d('0x0'));var util=require(_0x544d('0x1'));var path=require('path');var timeout=require(_0x544d('0x2'));var express=require('express');var router=express[_0x544d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x544d('0x4'));var interaction=require(_0x544d('0x5'));var config=require(_0x544d('0x6'));var controller=require('./intVtigerAccount.controller');router[_0x544d('0x7')]('/',auth['isAuthenticated'](),controller[_0x544d('0x8')]);router[_0x544d('0x7')](_0x544d('0x9'),auth[_0x544d('0xa')](),controller[_0x544d('0xb')]);router[_0x544d('0x7')](_0x544d('0xc'),auth[_0x544d('0xa')](),controller[_0x544d('0xd')]);router[_0x544d('0x7')]('/:id/fields',auth[_0x544d('0xa')](),controller['getFields']);router[_0x544d('0xe')]('/',auth[_0x544d('0xa')](),controller['create']);router['post']('/:id/configurations',auth[_0x544d('0xa')](),controller[_0x544d('0xf')]);router[_0x544d('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x544d('0x11')](_0x544d('0x9'),auth[_0x544d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0a9a=['create','addConfiguration','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x2b343d,_0x3ac347){var _0x375b5a=function(_0x4e3a54){while(--_0x4e3a54){_0x2b343d['push'](_0x2b343d['shift']());}};_0x375b5a(++_0x3ac347);}(_0x0a9a,0x183));var _0xa0a9=function(_0x309983,_0x4b05f9){_0x309983=_0x309983-0x0;var _0x58afa3=_0x0a9a[_0x309983];return _0x58afa3;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var fs_extra=require(_0xa0a9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var controller=require('./intVtigerAccount.controller');router[_0xa0a9('0x7')]('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x9')]);router[_0xa0a9('0x7')]('/:id',auth[_0xa0a9('0x8')](),controller['show']);router[_0xa0a9('0x7')](_0xa0a9('0xa'),auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xb')]);router['get'](_0xa0a9('0xc'),auth[_0xa0a9('0x8')](),controller['getFields']);router['post']('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xd')]);router['post'](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xe')]);router['put'](_0xa0a9('0xf'),auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x10')]);router[_0xa0a9('0x11')](_0xa0a9('0xf'),auth['isAuthenticated'](),controller[_0xa0a9('0x12')]);module[_0xa0a9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 073c77d..4f6d87e 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 _0x251c=['HelpDesk','sequelize','exports','STRING'];(function(_0xf8f92c,_0x125b89){var _0x2df5a5=function(_0xfadc97){while(--_0xfadc97){_0xf8f92c['push'](_0xf8f92c['shift']());}};_0x2df5a5(++_0x125b89);}(_0x251c,0x101));var _0xc251=function(_0x25fe7d,_0x4208b3){_0x25fe7d=_0x25fe7d-0x0;var _0x3b9a12=_0x251c[_0x25fe7d];return _0x3b9a12;};'use strict';var Sequelize=require(_0xc251('0x0'));module[_0xc251('0x1')]={'name':{'type':Sequelize[_0xc251('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc251('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xc251('0x2')],'allowNull':![],'defaultValue':_0xc251('0x3')},'remoteUri':{'type':Sequelize[_0xc251('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xc251('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xc251('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xdfff=['exports','STRING','HelpDesk','sequelize'];(function(_0x16abcb,_0xa2e27e){var _0x41ab6f=function(_0xa17a1a){while(--_0xa17a1a){_0x16abcb['push'](_0x16abcb['shift']());}};_0x41ab6f(++_0xa2e27e);}(_0xdfff,0x93));var _0xfdff=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdfff[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xfdff('0x0'));module[_0xfdff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xfdff('0x2')],'allowNull':![],'defaultValue':_0xfdff('0x3')},'remoteUri':{'type':Sequelize[_0xfdff('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xfdff('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 dce7234..d8e1a6b 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 _0x345c=['serverUrl','username','accessKey','moduleName','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','describe','sessionName','reference','owner','remove','false','startsWith','cf_','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','name','send','index','VtigerAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','options','count','includeAll','include','findAll','rows','params','find','catch','create','body','order','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','md5','getFields','description','remoteUri'];(function(_0x322a46,_0x4ac56d){var _0xf1913f=function(_0x54879d){while(--_0x54879d){_0x322a46['push'](_0x322a46['shift']());}};_0xf1913f(++_0x4ac56d);}(_0x345c,0x10d));var _0xc345=function(_0x142e72,_0x2dc0b8){_0x142e72=_0x142e72-0x0;var _0x90e075=_0x345c[_0x142e72];return _0x90e075;};'use strict';var emlformat=require(_0xc345('0x0'));var rimraf=require(_0xc345('0x1'));var zipdir=require(_0xc345('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc345('0x3'));var moment=require(_0xc345('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc345('0x5'));var util=require(_0xc345('0x6'));var path=require(_0xc345('0x7'));var sox=require('sox');var csv=require(_0xc345('0x8'));var ejs=require(_0xc345('0x9'));var fs=require('fs');var fs_extra=require(_0xc345('0xa'));var _=require(_0xc345('0xb'));var squel=require(_0xc345('0xc'));var crypto=require(_0xc345('0xd'));var jsforce=require(_0xc345('0xe'));var deskjs=require(_0xc345('0xf'));var toCsv=require(_0xc345('0x8'));var querystring=require('querystring');var Papa=require(_0xc345('0x10'));var Redis=require(_0xc345('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc345('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc345('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xc345('0x14'));function respondWithStatusCode(_0x43a038,_0xd5fc5a){_0xd5fc5a=_0xd5fc5a||0xcc;return function(_0x33677d){if(_0x33677d){return _0x43a038[_0xc345('0x15')](_0xd5fc5a);}return _0x43a038[_0xc345('0x16')](_0xd5fc5a)[_0xc345('0x17')]();};}function respondWithResult(_0x5657b2,_0x48e2a4){_0x48e2a4=_0x48e2a4||0xc8;return function(_0x29f25e){if(_0x29f25e){return _0x5657b2[_0xc345('0x16')](_0x48e2a4)[_0xc345('0x18')](_0x29f25e);}};}function respondWithFilteredResult(_0x32d638,_0x462b07){return function(_0x3b8006){if(_0x3b8006){var _0x3a3c80=typeof _0x462b07[_0xc345('0x19')]===_0xc345('0x1a')&&typeof _0x462b07['limit']===_0xc345('0x1a');var _0x37d0a8=_0x3b8006['count'];var _0xf47cd6=_0x3a3c80?0x0:_0x462b07['offset'];var _0x4734d7=_0x3a3c80?_0x3b8006['count']:_0x462b07[_0xc345('0x19')]+_0x462b07[_0xc345('0x1b')];var _0x4f5956;if(_0x4734d7>=_0x37d0a8){_0x4734d7=_0x37d0a8;_0x4f5956=0xc8;}else{_0x4f5956=0xce;}_0x32d638[_0xc345('0x16')](_0x4f5956);return _0x32d638[_0xc345('0x1c')]('Content-Range',_0xf47cd6+'-'+_0x4734d7+'/'+_0x37d0a8)[_0xc345('0x18')](_0x3b8006);}return null;};}function patchUpdates(_0x4207d8){return function(_0x3b3429){try{jsonpatch[_0xc345('0x1d')](_0x3b3429,_0x4207d8,!![]);}catch(_0x27c04d){return BPromise[_0xc345('0x1e')](_0x27c04d);}return _0x3b3429[_0xc345('0x1f')]();};}function saveUpdates(_0x15b699,_0x17c9d2){return function(_0x498f2e){if(_0x498f2e){return _0x498f2e[_0xc345('0x20')](_0x15b699)[_0xc345('0x21')](function(_0x57bd39){return _0x57bd39;});}return null;};}function removeEntity(_0x3ca6fa,_0x2d8cbb){return function(_0x209200){if(_0x209200){return _0x209200[_0xc345('0x22')]()[_0xc345('0x21')](function(){_0x3ca6fa[_0xc345('0x16')](0xcc)[_0xc345('0x17')]();});}};}function handleEntityNotFound(_0x37af19,_0x135189){return function(_0x5c082e){if(!_0x5c082e){_0x37af19[_0xc345('0x15')](0x194);}return _0x5c082e;};}function handleError(_0x307c11,_0x474934){_0x474934=_0x474934||0x1f4;return function(_0x225167){logger['error'](_0x225167['stack']);if(_0x225167[_0xc345('0x23')]){delete _0x225167[_0xc345('0x23')];}_0x307c11[_0xc345('0x16')](_0x474934)[_0xc345('0x24')](_0x225167);};}exports[_0xc345('0x25')]=function(_0x157821,_0x303703){var _0x3cd91f={},_0x51d2e8={},_0x33332a={'count':0x0,'rows':[]};var _0x337115=_['map'](db[_0xc345('0x26')][_0xc345('0x27')],function(_0x55621f){return{'name':_0x55621f[_0xc345('0x28')],'type':_0x55621f['type'][_0xc345('0x29')]};});_0x51d2e8[_0xc345('0x2a')]=_['map'](_0x337115,'name');_0x51d2e8[_0xc345('0x2b')]=_[_0xc345('0x2c')](_0x157821[_0xc345('0x2b')]);_0x51d2e8['filters']=_[_0xc345('0x2d')](_0x51d2e8[_0xc345('0x2a')],_0x51d2e8[_0xc345('0x2b')]);_0x3cd91f[_0xc345('0x2e')]=_[_0xc345('0x2d')](_0x51d2e8[_0xc345('0x2a')],qs[_0xc345('0x2f')](_0x157821[_0xc345('0x2b')]['fields']));_0x3cd91f['attributes']=_0x3cd91f[_0xc345('0x2e')][_0xc345('0x30')]?_0x3cd91f[_0xc345('0x2e')]:_0x51d2e8['model'];if(!_0x157821[_0xc345('0x2b')][_0xc345('0x31')](_0xc345('0x32'))){_0x3cd91f[_0xc345('0x1b')]=qs[_0xc345('0x1b')](_0x157821['query'][_0xc345('0x1b')]);_0x3cd91f[_0xc345('0x19')]=qs['offset'](_0x157821[_0xc345('0x2b')]['offset']);}_0x3cd91f['order']=qs[_0xc345('0x33')](_0x157821[_0xc345('0x2b')][_0xc345('0x33')]);_0x3cd91f[_0xc345('0x34')]=qs[_0xc345('0x35')](_[_0xc345('0x36')](_0x157821[_0xc345('0x2b')],_0x51d2e8[_0xc345('0x35')]),_0x337115);if(_0x157821[_0xc345('0x2b')][_0xc345('0x37')]){_0x3cd91f[_0xc345('0x34')]=_[_0xc345('0x38')](_0x3cd91f['where'],{'$or':_[_0xc345('0x39')](_0x337115,function(_0x1eb008){if(_0x1eb008[_0xc345('0x3a')]!==_0xc345('0x3b')){var _0x149d6d={};_0x149d6d[_0x1eb008[_0xc345('0x23')]]={'$like':'%'+_0x157821[_0xc345('0x2b')][_0xc345('0x37')]+'%'};return _0x149d6d;}})});}_0x3cd91f=_[_0xc345('0x38')]({},_0x3cd91f,_0x157821[_0xc345('0x3c')]);var _0x189500={'where':_0x3cd91f[_0xc345('0x34')]};return db[_0xc345('0x26')][_0xc345('0x3d')](_0x189500)[_0xc345('0x21')](function(_0xd4ca1a){_0x33332a['count']=_0xd4ca1a;if(_0x157821[_0xc345('0x2b')][_0xc345('0x3e')]){_0x3cd91f[_0xc345('0x3f')]=[{'all':!![]}];}return db[_0xc345('0x26')][_0xc345('0x40')](_0x3cd91f);})[_0xc345('0x21')](function(_0x4351f3){_0x33332a[_0xc345('0x41')]=_0x4351f3;return _0x33332a;})[_0xc345('0x21')](respondWithFilteredResult(_0x303703,_0x3cd91f))['catch'](handleError(_0x303703,null));};exports['show']=function(_0x1951a8,_0x51f08b){var _0x1b74e9={'raw':![],'where':{'id':_0x1951a8[_0xc345('0x42')]['id']}},_0x19f9e9={};_0x19f9e9[_0xc345('0x2a')]=_['keys'](db[_0xc345('0x26')][_0xc345('0x27')]);_0x19f9e9[_0xc345('0x2b')]=_['keys'](_0x1951a8[_0xc345('0x2b')]);_0x19f9e9[_0xc345('0x35')]=_[_0xc345('0x2d')](_0x19f9e9[_0xc345('0x2a')],_0x19f9e9[_0xc345('0x2b')]);_0x1b74e9[_0xc345('0x2e')]=_['intersection'](_0x19f9e9[_0xc345('0x2a')],qs[_0xc345('0x2f')](_0x1951a8['query'][_0xc345('0x2f')]));_0x1b74e9['attributes']=_0x1b74e9[_0xc345('0x2e')][_0xc345('0x30')]?_0x1b74e9[_0xc345('0x2e')]:_0x19f9e9[_0xc345('0x2a')];if(_0x1951a8[_0xc345('0x2b')][_0xc345('0x3e')]){_0x1b74e9[_0xc345('0x3f')]=[{'all':!![]}];}_0x1b74e9=_[_0xc345('0x38')]({},_0x1b74e9,_0x1951a8[_0xc345('0x3c')]);return db[_0xc345('0x26')][_0xc345('0x43')](_0x1b74e9)[_0xc345('0x21')](handleEntityNotFound(_0x51f08b,null))['then'](respondWithResult(_0x51f08b,null))[_0xc345('0x44')](handleError(_0x51f08b,null));};exports[_0xc345('0x45')]=function(_0x32d7b,_0x358a32){return db[_0xc345('0x26')][_0xc345('0x45')](_0x32d7b[_0xc345('0x46')],{})[_0xc345('0x21')](respondWithResult(_0x358a32,0xc9))[_0xc345('0x44')](handleError(_0x358a32,null));};exports[_0xc345('0x20')]=function(_0x40cdcc,_0x4f5d18){if(_0x40cdcc[_0xc345('0x46')]['id']){delete _0x40cdcc[_0xc345('0x46')]['id'];}return db[_0xc345('0x26')][_0xc345('0x43')]({'where':{'id':_0x40cdcc[_0xc345('0x42')]['id']}})[_0xc345('0x21')](handleEntityNotFound(_0x4f5d18,null))[_0xc345('0x21')](saveUpdates(_0x40cdcc['body'],null))['then'](respondWithResult(_0x4f5d18,null))['catch'](handleError(_0x4f5d18,null));};exports[_0xc345('0x22')]=function(_0x4e2dca,_0x51d0a5){return db[_0xc345('0x26')][_0xc345('0x43')]({'where':{'id':_0x4e2dca[_0xc345('0x42')]['id']}})[_0xc345('0x21')](handleEntityNotFound(_0x51d0a5,null))[_0xc345('0x21')](removeEntity(_0x51d0a5,null))[_0xc345('0x44')](handleError(_0x51d0a5,null));};exports['getConfigurations']=function(_0x16deb7,_0x2eb7cb,_0x429bc5){var _0x283edd={};var _0x4c76ca={};var _0x436578;var _0x490458;return db[_0xc345('0x26')]['findOne']({'where':{'id':_0x16deb7[_0xc345('0x42')]['id']}})[_0xc345('0x21')](handleEntityNotFound(_0x2eb7cb,null))[_0xc345('0x21')](function(_0x1fc2eb){if(_0x1fc2eb){_0x436578=_0x1fc2eb;_0x4c76ca[_0xc345('0x2a')]=_[_0xc345('0x2c')](db['VtigerConfiguration'][_0xc345('0x27')]);_0x4c76ca[_0xc345('0x2b')]=_[_0xc345('0x2c')](_0x16deb7[_0xc345('0x2b')]);_0x4c76ca['filters']=_[_0xc345('0x2d')](_0x4c76ca[_0xc345('0x2a')],_0x4c76ca[_0xc345('0x2b')]);_0x283edd['attributes']=_[_0xc345('0x2d')](_0x4c76ca[_0xc345('0x2a')],qs[_0xc345('0x2f')](_0x16deb7[_0xc345('0x2b')][_0xc345('0x2f')]));_0x283edd[_0xc345('0x2e')]=_0x283edd['attributes'][_0xc345('0x30')]?_0x283edd[_0xc345('0x2e')]:_0x4c76ca[_0xc345('0x2a')];_0x283edd[_0xc345('0x47')]=qs[_0xc345('0x33')](_0x16deb7[_0xc345('0x2b')][_0xc345('0x33')]);_0x283edd['where']=qs[_0xc345('0x35')](_[_0xc345('0x36')](_0x16deb7['query'],_0x4c76ca[_0xc345('0x35')]));if(_0x16deb7['query']['filter']){_0x283edd['where']=_[_0xc345('0x38')](_0x283edd[_0xc345('0x34')],{'$or':_['map'](_0x283edd[_0xc345('0x2e')],function(_0x350430){var _0x4d49e8={};_0x4d49e8[_0x350430]={'$like':'%'+_0x16deb7[_0xc345('0x2b')]['filter']+'%'};return _0x4d49e8;})});}_0x283edd=_[_0xc345('0x38')]({},_0x283edd,_0x16deb7['options']);return _0x436578['getConfigurations'](_0x283edd);}})[_0xc345('0x21')](function(_0x49539e){if(_0x49539e){_0x490458=_0x49539e[_0xc345('0x30')];if(!_0x16deb7[_0xc345('0x2b')][_0xc345('0x31')](_0xc345('0x32'))){_0x283edd['limit']=qs[_0xc345('0x1b')](_0x16deb7[_0xc345('0x2b')][_0xc345('0x1b')]);_0x283edd[_0xc345('0x19')]=qs[_0xc345('0x19')](_0x16deb7['query'][_0xc345('0x19')]);}return _0x436578['getConfigurations'](_0x283edd);}})[_0xc345('0x21')](function(_0x1ea599){if(_0x1ea599){return _0x1ea599?{'count':_0x490458,'rows':_0x1ea599}:null;}})[_0xc345('0x21')](respondWithResult(_0x2eb7cb,null))[_0xc345('0x44')](handleError(_0x2eb7cb,null));};exports[_0xc345('0x48')]=function(_0x50fd28,_0x2e35e7,_0xb0521f){if(_0x50fd28[_0xc345('0x46')]['id']){delete _0x50fd28[_0xc345('0x46')]['id'];}return db[_0xc345('0x26')][_0xc345('0x49')]({'where':{'id':_0x50fd28[_0xc345('0x42')]['id']}})[_0xc345('0x21')](handleEntityNotFound(_0x2e35e7,null))['then'](function(_0x1d7041){if(_0x1d7041){_0x50fd28[_0xc345('0x46')][_0xc345('0x4a')]=_0x1d7041['id'];_0x50fd28[_0xc345('0x46')][_0xc345('0x4b')]=integrations[_0xc345('0x4c')](_0x50fd28[_0xc345('0x46')][_0xc345('0x4d')],_0x50fd28[_0xc345('0x46')][_0xc345('0x3a')]);_0x50fd28[_0xc345('0x46')][_0xc345('0x4e')]=integrations[_0xc345('0x4f')](_0x50fd28[_0xc345('0x46')][_0xc345('0x4d')],_0x50fd28[_0xc345('0x46')][_0xc345('0x3a')]);return db[_0xc345('0x50')][_0xc345('0x45')](_0x50fd28[_0xc345('0x46')],{'include':[{'model':db['VtigerField'],'as':_0xc345('0x4b')},{'model':db['VtigerField'],'as':_0xc345('0x4e')}]});}return null;})[_0xc345('0x21')](respondWithResult(_0x2e35e7,null))[_0xc345('0x44')](handleError(_0x2e35e7,null));};var md5=require(_0xc345('0x51'));exports[_0xc345('0x52')]=function(_0x34dc1b,_0x5ce822,_0x5000b3){var _0x3efbf1=null;var _0x10555d=null;var _0xf1dcad=null;var _0xd075c4=null;var _0x5b178a='';return db[_0xc345('0x26')][_0xc345('0x49')]({'where':{'id':_0x34dc1b[_0xc345('0x42')]['id']},'attributes':['id',_0xc345('0x23'),'username',_0xc345('0x53'),'moduleName',_0xc345('0x54'),_0xc345('0x55'),'accessKey']})['then'](handleEntityNotFound(_0x5ce822,null))[_0xc345('0x21')](function(_0x2ab792){if(_0x2ab792){_0x3efbf1=_0x2ab792[_0xc345('0x56')];_0x10555d=_0x2ab792[_0xc345('0x57')];_0xf1dcad=_0x2ab792[_0xc345('0x58')];_0x5b178a=_0x2ab792[_0xc345('0x54')];var _0x4834b4=_0x5b178a[_0xc345('0x59')](-0x1);if(_0x4834b4==='/'){_0x5b178a=_0x5b178a[_0xc345('0x5a')](0x0,_0x5b178a[_0xc345('0x5b')](_0x4834b4));}_0xd075c4=util[_0xc345('0x5c')](_0xc345('0x5d'),_0x5b178a);var _0x5503cf={'method':_0xc345('0x5e'),'uri':_0xd075c4,'qs':{'operation':_0xc345('0x5f'),'username':_0x2ab792[_0xc345('0x56')]},'json':!![]};return rp(_0x5503cf);}})[_0xc345('0x21')](function(_0x1d8809){if(_0x1d8809[_0xc345('0x60')]){var _0x325b31={'method':_0xc345('0x61'),'uri':_0xd075c4,'form':{'operation':_0xc345('0x62'),'username':_0x3efbf1,'accessKey':md5(_0x1d8809[_0xc345('0x63')]['token']+_0x10555d)},'json':!![]};return rp(_0x325b31);}})[_0xc345('0x21')](function(_0x620b40){if(_0x620b40[_0xc345('0x60')]){var _0x5ae1e7={'method':_0xc345('0x5e'),'uri':_0xd075c4,'qs':{'operation':_0xc345('0x64'),'username':_0x3efbf1,'sessionName':_0x620b40[_0xc345('0x63')][_0xc345('0x65')],'elementType':_0xf1dcad},'json':!![]};return rp(_0x5ae1e7);}})['then'](function(_0x42c43a){if(_0x42c43a[_0xc345('0x60')]){var _0x5570ee=['autogenerated',_0xc345('0x66'),_0xc345('0x67')];_[_0xc345('0x68')](_0x42c43a['result'][_0xc345('0x2f')],function(_0x42190d){return _0x5570ee['includes'](_0x42190d[_0xc345('0x3a')]['name']);});_[_0xc345('0x68')](_0x42c43a[_0xc345('0x63')][_0xc345('0x2f')],function(_0x283a82){return _0x283a82['editable']===_0xc345('0x69');});return{'count':_0x42c43a[_0xc345('0x63')][_0xc345('0x2f')][_0xc345('0x30')],'rows':_[_0xc345('0x39')](_0x42c43a[_0xc345('0x63')][_0xc345('0x2f')],function(_0x58b8e9){return{'id':_0x58b8e9[_0xc345('0x23')],'name':_0x58b8e9['label'],'custom':_[_0xc345('0x6a')](_0x58b8e9[_0xc345('0x23')],_0xc345('0x6b'))?!![]:![],'options':_0x58b8e9[_0xc345('0x3a')]['name']==='picklist'&&_0x58b8e9[_0xc345('0x3a')][_0xc345('0x6c')][_0xc345('0x30')]>0x0?_['map'](_0x58b8e9[_0xc345('0x3a')][_0xc345('0x6c')],function(_0x1cbcc8){return{'name':_0x1cbcc8[_0xc345('0x6d')],'value':_0x1cbcc8[_0xc345('0x6e')]};}):[]};})};}})[_0xc345('0x21')](respondWithResult(_0x5ce822,null))[_0xc345('0x44')](function(_0x27abb6){console[_0xc345('0x6f')](_0xc345('0x70')+_0x27abb6);var _0x2b025e=_0x34dc1b[_0xc345('0x2b')][_0xc345('0x71')]?0x1f4:_0x27abb6[_0xc345('0x72')]||0x1f4;logger[_0xc345('0x73')](_0xc345('0x74'),'getFields',_0x2b025e,JSON['stringify'](_0x27abb6));delete _0x27abb6[_0xc345('0x23')];if(_0x2b025e===0x191){_0x2b025e=0x190;}_0x5ce822[_0xc345('0x16')](_0x2b025e)[_0xc345('0x24')](_0x34dc1b[_0xc345('0x2b')][_0xc345('0x71')]?{'message':_0xc345('0x75'),'statusCode':_0x27abb6[_0xc345('0x72')]}:_0x27abb6);});}; \ No newline at end of file +var _0x8b9b=['channel','Descriptions','VtigerField','md5','getFields','remoteUri','accessKey','username','slice','substring','lastIndexOf','%s/webservice.php','getchallenge','success','login','token','GET','describe','sessionName','autogenerated','reference','remove','result','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VtigerAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','getConfigurations','findOne','VtigerConfiguration','order','pick','Subjects','getSubjects'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x8b9b,0x184));var _0xb8b9=function(_0x507458,_0x1096bf){_0x507458=_0x507458-0x0;var _0x5f43ad=_0x8b9b[_0x507458];return _0x5f43ad;};'use strict';var emlformat=require(_0xb8b9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb8b9('0x1'));var rp=require(_0xb8b9('0x2'));var moment=require(_0xb8b9('0x3'));var BPromise=require(_0xb8b9('0x4'));var Mustache=require('mustache');var util=require(_0xb8b9('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xb8b9('0x6'));var ejs=require(_0xb8b9('0x7'));var fs=require('fs');var fs_extra=require(_0xb8b9('0x8'));var _=require(_0xb8b9('0x9'));var squel=require(_0xb8b9('0xa'));var crypto=require('crypto');var jsforce=require(_0xb8b9('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb8b9('0xc'));var Papa=require('papaparse');var Redis=require(_0xb8b9('0xd'));var authService=require(_0xb8b9('0xe'));var qs=require(_0xb8b9('0xf'));var as=require(_0xb8b9('0x10'));var hardwareService=require(_0xb8b9('0x11'));var logger=require(_0xb8b9('0x12'))(_0xb8b9('0x13'));var utils=require(_0xb8b9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb8b9('0x15'));var db=require(_0xb8b9('0x16'))['db'];var integrations=require(_0xb8b9('0x17'));function respondWithStatusCode(_0x159421,_0x2e474d){_0x2e474d=_0x2e474d||0xcc;return function(_0x24ae21){if(_0x24ae21){return _0x159421['sendStatus'](_0x2e474d);}return _0x159421[_0xb8b9('0x18')](_0x2e474d)[_0xb8b9('0x19')]();};}function respondWithResult(_0x21bb79,_0x245114){_0x245114=_0x245114||0xc8;return function(_0x520cb1){if(_0x520cb1){return _0x21bb79[_0xb8b9('0x18')](_0x245114)['json'](_0x520cb1);}};}function respondWithFilteredResult(_0x3bd32f,_0x2cd766){return function(_0x26c8d3){if(_0x26c8d3){var _0x4aa70a=typeof _0x2cd766[_0xb8b9('0x1a')]===_0xb8b9('0x1b')&&typeof _0x2cd766[_0xb8b9('0x1c')]===_0xb8b9('0x1b');var _0x4fc10e=_0x26c8d3['count'];var _0x34fead=_0x4aa70a?0x0:_0x2cd766[_0xb8b9('0x1a')];var _0x35914a=_0x4aa70a?_0x26c8d3[_0xb8b9('0x1d')]:_0x2cd766['offset']+_0x2cd766['limit'];var _0x1cdeaa;if(_0x35914a>=_0x4fc10e){_0x35914a=_0x4fc10e;_0x1cdeaa=0xc8;}else{_0x1cdeaa=0xce;}_0x3bd32f['status'](_0x1cdeaa);return _0x3bd32f['set'](_0xb8b9('0x1e'),_0x34fead+'-'+_0x35914a+'/'+_0x4fc10e)['json'](_0x26c8d3);}return null;};}function patchUpdates(_0x362b88){return function(_0x4e8fd4){try{jsonpatch[_0xb8b9('0x1f')](_0x4e8fd4,_0x362b88,!![]);}catch(_0x55c6c7){return BPromise[_0xb8b9('0x20')](_0x55c6c7);}return _0x4e8fd4[_0xb8b9('0x21')]();};}function saveUpdates(_0x4aa9d3,_0x3cd70b){return function(_0x17ae80){if(_0x17ae80){return _0x17ae80[_0xb8b9('0x22')](_0x4aa9d3)[_0xb8b9('0x23')](function(_0x2d9ce6){return _0x2d9ce6;});}return null;};}function removeEntity(_0xb03c8f,_0x25cb08){return function(_0x59098b){if(_0x59098b){return _0x59098b[_0xb8b9('0x24')]()[_0xb8b9('0x23')](function(){_0xb03c8f[_0xb8b9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc4c1c2,_0x48fada){return function(_0x263fe6){if(!_0x263fe6){_0xc4c1c2[_0xb8b9('0x25')](0x194);}return _0x263fe6;};}function handleError(_0x148339,_0x2a4314){_0x2a4314=_0x2a4314||0x1f4;return function(_0x3f1072){logger[_0xb8b9('0x26')](_0x3f1072[_0xb8b9('0x27')]);if(_0x3f1072[_0xb8b9('0x28')]){delete _0x3f1072['name'];}_0x148339['status'](_0x2a4314)[_0xb8b9('0x29')](_0x3f1072);};}exports[_0xb8b9('0x2a')]=function(_0x527afb,_0x391719){var _0x20e589={},_0x1a89f7={},_0x5c9dd3={'count':0x0,'rows':[]};var _0x5368e=_[_0xb8b9('0x2b')](db[_0xb8b9('0x2c')]['rawAttributes'],function(_0xfb6db6){return{'name':_0xfb6db6[_0xb8b9('0x2d')],'type':_0xfb6db6[_0xb8b9('0x2e')]['key']};});_0x1a89f7[_0xb8b9('0x2f')]=_[_0xb8b9('0x2b')](_0x5368e,'name');_0x1a89f7[_0xb8b9('0x30')]=_[_0xb8b9('0x31')](_0x527afb[_0xb8b9('0x30')]);_0x1a89f7[_0xb8b9('0x32')]=_[_0xb8b9('0x33')](_0x1a89f7['model'],_0x1a89f7['query']);_0x20e589[_0xb8b9('0x34')]=_[_0xb8b9('0x33')](_0x1a89f7[_0xb8b9('0x2f')],qs['fields'](_0x527afb[_0xb8b9('0x30')][_0xb8b9('0x35')]));_0x20e589[_0xb8b9('0x34')]=_0x20e589[_0xb8b9('0x34')][_0xb8b9('0x36')]?_0x20e589[_0xb8b9('0x34')]:_0x1a89f7[_0xb8b9('0x2f')];if(!_0x527afb[_0xb8b9('0x30')][_0xb8b9('0x37')](_0xb8b9('0x38'))){_0x20e589['limit']=qs[_0xb8b9('0x1c')](_0x527afb[_0xb8b9('0x30')][_0xb8b9('0x1c')]);_0x20e589['offset']=qs['offset'](_0x527afb[_0xb8b9('0x30')]['offset']);}_0x20e589['order']=qs[_0xb8b9('0x39')](_0x527afb[_0xb8b9('0x30')][_0xb8b9('0x39')]);_0x20e589[_0xb8b9('0x3a')]=qs[_0xb8b9('0x32')](_['pick'](_0x527afb['query'],_0x1a89f7[_0xb8b9('0x32')]),_0x5368e);if(_0x527afb[_0xb8b9('0x30')]['filter']){_0x20e589['where']=_[_0xb8b9('0x3b')](_0x20e589['where'],{'$or':_[_0xb8b9('0x2b')](_0x5368e,function(_0x10d42c){if(_0x10d42c[_0xb8b9('0x2e')]!==_0xb8b9('0x3c')){var _0x5eb57e={};_0x5eb57e[_0x10d42c[_0xb8b9('0x28')]]={'$like':'%'+_0x527afb[_0xb8b9('0x30')][_0xb8b9('0x3d')]+'%'};return _0x5eb57e;}})});}_0x20e589=_[_0xb8b9('0x3b')]({},_0x20e589,_0x527afb['options']);var _0x32a035={'where':_0x20e589['where']};return db[_0xb8b9('0x2c')][_0xb8b9('0x1d')](_0x32a035)[_0xb8b9('0x23')](function(_0x16e7ae){_0x5c9dd3[_0xb8b9('0x1d')]=_0x16e7ae;if(_0x527afb[_0xb8b9('0x30')][_0xb8b9('0x3e')]){_0x20e589[_0xb8b9('0x3f')]=[{'all':!![]}];}return db['VtigerAccount'][_0xb8b9('0x40')](_0x20e589);})[_0xb8b9('0x23')](function(_0x5bf34e){_0x5c9dd3['rows']=_0x5bf34e;return _0x5c9dd3;})[_0xb8b9('0x23')](respondWithFilteredResult(_0x391719,_0x20e589))[_0xb8b9('0x41')](handleError(_0x391719,null));};exports[_0xb8b9('0x42')]=function(_0x510461,_0x310965){var _0x159196={'raw':![],'where':{'id':_0x510461[_0xb8b9('0x43')]['id']}},_0x493bac={};_0x493bac[_0xb8b9('0x2f')]=_['keys'](db[_0xb8b9('0x2c')][_0xb8b9('0x44')]);_0x493bac[_0xb8b9('0x30')]=_['keys'](_0x510461[_0xb8b9('0x30')]);_0x493bac[_0xb8b9('0x32')]=_[_0xb8b9('0x33')](_0x493bac[_0xb8b9('0x2f')],_0x493bac[_0xb8b9('0x30')]);_0x159196[_0xb8b9('0x34')]=_[_0xb8b9('0x33')](_0x493bac[_0xb8b9('0x2f')],qs['fields'](_0x510461[_0xb8b9('0x30')][_0xb8b9('0x35')]));_0x159196[_0xb8b9('0x34')]=_0x159196[_0xb8b9('0x34')][_0xb8b9('0x36')]?_0x159196[_0xb8b9('0x34')]:_0x493bac[_0xb8b9('0x2f')];if(_0x510461[_0xb8b9('0x30')][_0xb8b9('0x3e')]){_0x159196[_0xb8b9('0x3f')]=[{'all':!![]}];}_0x159196=_[_0xb8b9('0x3b')]({},_0x159196,_0x510461[_0xb8b9('0x45')]);return db[_0xb8b9('0x2c')][_0xb8b9('0x46')](_0x159196)['then'](handleEntityNotFound(_0x310965,null))[_0xb8b9('0x23')](respondWithResult(_0x310965,null))[_0xb8b9('0x41')](handleError(_0x310965,null));};exports['create']=function(_0x509e6b,_0x1896db){return db[_0xb8b9('0x2c')][_0xb8b9('0x47')](_0x509e6b[_0xb8b9('0x48')],{})['then'](respondWithResult(_0x1896db,0xc9))['catch'](handleError(_0x1896db,null));};exports[_0xb8b9('0x22')]=function(_0x2f0903,_0x3595f9){if(_0x2f0903['body']['id']){delete _0x2f0903[_0xb8b9('0x48')]['id'];}return db['VtigerAccount'][_0xb8b9('0x46')]({'where':{'id':_0x2f0903[_0xb8b9('0x43')]['id']}})[_0xb8b9('0x23')](handleEntityNotFound(_0x3595f9,null))[_0xb8b9('0x23')](saveUpdates(_0x2f0903[_0xb8b9('0x48')],null))[_0xb8b9('0x23')](respondWithResult(_0x3595f9,null))[_0xb8b9('0x41')](handleError(_0x3595f9,null));};exports[_0xb8b9('0x24')]=function(_0x6fb688,_0x2f5b68){return db[_0xb8b9('0x2c')][_0xb8b9('0x46')]({'where':{'id':_0x6fb688[_0xb8b9('0x43')]['id']}})[_0xb8b9('0x23')](handleEntityNotFound(_0x2f5b68,null))[_0xb8b9('0x23')](removeEntity(_0x2f5b68,null))[_0xb8b9('0x41')](handleError(_0x2f5b68,null));};exports[_0xb8b9('0x49')]=function(_0x1e3723,_0x338d28,_0x3c721d){var _0x281563={};var _0xc61c54={};var _0x190ee9;var _0x3225bf;return db[_0xb8b9('0x2c')][_0xb8b9('0x4a')]({'where':{'id':_0x1e3723['params']['id']}})[_0xb8b9('0x23')](handleEntityNotFound(_0x338d28,null))[_0xb8b9('0x23')](function(_0xebd946){if(_0xebd946){_0x190ee9=_0xebd946;_0xc61c54['model']=_[_0xb8b9('0x31')](db[_0xb8b9('0x4b')][_0xb8b9('0x44')]);_0xc61c54[_0xb8b9('0x30')]=_['keys'](_0x1e3723[_0xb8b9('0x30')]);_0xc61c54[_0xb8b9('0x32')]=_[_0xb8b9('0x33')](_0xc61c54[_0xb8b9('0x2f')],_0xc61c54['query']);_0x281563[_0xb8b9('0x34')]=_['intersection'](_0xc61c54[_0xb8b9('0x2f')],qs[_0xb8b9('0x35')](_0x1e3723[_0xb8b9('0x30')][_0xb8b9('0x35')]));_0x281563['attributes']=_0x281563[_0xb8b9('0x34')][_0xb8b9('0x36')]?_0x281563['attributes']:_0xc61c54['model'];_0x281563[_0xb8b9('0x4c')]=qs[_0xb8b9('0x39')](_0x1e3723[_0xb8b9('0x30')]['sort']);_0x281563['where']=qs[_0xb8b9('0x32')](_[_0xb8b9('0x4d')](_0x1e3723[_0xb8b9('0x30')],_0xc61c54[_0xb8b9('0x32')]));if(_0x1e3723[_0xb8b9('0x30')][_0xb8b9('0x3d')]){_0x281563[_0xb8b9('0x3a')]=_[_0xb8b9('0x3b')](_0x281563[_0xb8b9('0x3a')],{'$or':_[_0xb8b9('0x2b')](_0x281563[_0xb8b9('0x34')],function(_0xbf577f){var _0x166a4e={};_0x166a4e[_0xbf577f]={'$like':'%'+_0x1e3723[_0xb8b9('0x30')][_0xb8b9('0x3d')]+'%'};return _0x166a4e;})});}_0x281563=_[_0xb8b9('0x3b')]({},_0x281563,_0x1e3723[_0xb8b9('0x45')]);return _0x190ee9['getConfigurations'](_0x281563);}})[_0xb8b9('0x23')](function(_0x254f3){if(_0x254f3){_0x3225bf=_0x254f3[_0xb8b9('0x36')];if(!_0x1e3723[_0xb8b9('0x30')][_0xb8b9('0x37')]('nolimit')){_0x281563['limit']=qs[_0xb8b9('0x1c')](_0x1e3723['query'][_0xb8b9('0x1c')]);_0x281563[_0xb8b9('0x1a')]=qs[_0xb8b9('0x1a')](_0x1e3723[_0xb8b9('0x30')]['offset']);}return _0x190ee9[_0xb8b9('0x49')](_0x281563);}})[_0xb8b9('0x23')](function(_0x5939d4){if(_0x5939d4){return _0x5939d4?{'count':_0x3225bf,'rows':_0x5939d4}:null;}})[_0xb8b9('0x23')](respondWithResult(_0x338d28,null))[_0xb8b9('0x41')](handleError(_0x338d28,null));};exports['addConfiguration']=function(_0x81dffc,_0x5354c9,_0x255e5c){if(_0x81dffc[_0xb8b9('0x48')]['id']){delete _0x81dffc[_0xb8b9('0x48')]['id'];}return db[_0xb8b9('0x2c')][_0xb8b9('0x4a')]({'where':{'id':_0x81dffc['params']['id']}})[_0xb8b9('0x23')](handleEntityNotFound(_0x5354c9,null))['then'](function(_0x167f53){if(_0x167f53){_0x81dffc[_0xb8b9('0x48')]['AccountId']=_0x167f53['id'];_0x81dffc['body'][_0xb8b9('0x4e')]=integrations[_0xb8b9('0x4f')](_0x81dffc[_0xb8b9('0x48')][_0xb8b9('0x50')],_0x81dffc[_0xb8b9('0x48')]['type']);_0x81dffc['body'][_0xb8b9('0x51')]=integrations['getDescriptions'](_0x81dffc[_0xb8b9('0x48')][_0xb8b9('0x50')],_0x81dffc['body'][_0xb8b9('0x2e')]);return db['VtigerConfiguration']['create'](_0x81dffc[_0xb8b9('0x48')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0xb8b9('0x52')],'as':_0xb8b9('0x51')}]});}return null;})[_0xb8b9('0x23')](respondWithResult(_0x5354c9,null))[_0xb8b9('0x41')](handleError(_0x5354c9,null));};var md5=require(_0xb8b9('0x53'));exports[_0xb8b9('0x54')]=function(_0x31a64e,_0x1852ce,_0xd22923){var _0x506e54=null;var _0xa2d8e0=null;var _0x4f9d1f=null;var _0x19f5fb=null;var _0x25ccf8='';return db[_0xb8b9('0x2c')][_0xb8b9('0x4a')]({'where':{'id':_0x31a64e[_0xb8b9('0x43')]['id']},'attributes':['id',_0xb8b9('0x28'),'username','description','moduleName',_0xb8b9('0x55'),'serverUrl',_0xb8b9('0x56')]})['then'](handleEntityNotFound(_0x1852ce,null))[_0xb8b9('0x23')](function(_0x40a209){if(_0x40a209){_0x506e54=_0x40a209[_0xb8b9('0x57')];_0xa2d8e0=_0x40a209[_0xb8b9('0x56')];_0x4f9d1f=_0x40a209['moduleName'];_0x25ccf8=_0x40a209['remoteUri'];var _0x148ebd=_0x25ccf8[_0xb8b9('0x58')](-0x1);if(_0x148ebd==='/'){_0x25ccf8=_0x25ccf8[_0xb8b9('0x59')](0x0,_0x25ccf8[_0xb8b9('0x5a')](_0x148ebd));}_0x19f5fb=util['format'](_0xb8b9('0x5b'),_0x25ccf8);var _0x4f080d={'method':'GET','uri':_0x19f5fb,'qs':{'operation':_0xb8b9('0x5c'),'username':_0x40a209[_0xb8b9('0x57')]},'json':!![]};return rp(_0x4f080d);}})[_0xb8b9('0x23')](function(_0x4ba61c){if(_0x4ba61c[_0xb8b9('0x5d')]){var _0x26ea1d={'method':'POST','uri':_0x19f5fb,'form':{'operation':_0xb8b9('0x5e'),'username':_0x506e54,'accessKey':md5(_0x4ba61c['result'][_0xb8b9('0x5f')]+_0xa2d8e0)},'json':!![]};return rp(_0x26ea1d);}})['then'](function(_0xccf7ed){if(_0xccf7ed['success']){var _0x3db9ff={'method':_0xb8b9('0x60'),'uri':_0x19f5fb,'qs':{'operation':_0xb8b9('0x61'),'username':_0x506e54,'sessionName':_0xccf7ed['result'][_0xb8b9('0x62')],'elementType':_0x4f9d1f},'json':!![]};return rp(_0x3db9ff);}})['then'](function(_0x2920e1){if(_0x2920e1[_0xb8b9('0x5d')]){var _0x51d9f4=[_0xb8b9('0x63'),_0xb8b9('0x64'),'owner'];_[_0xb8b9('0x65')](_0x2920e1[_0xb8b9('0x66')]['fields'],function(_0x216876){return _0x51d9f4[_0xb8b9('0x67')](_0x216876['type'][_0xb8b9('0x28')]);});_[_0xb8b9('0x65')](_0x2920e1[_0xb8b9('0x66')][_0xb8b9('0x35')],function(_0x4fc8c7){return _0x4fc8c7[_0xb8b9('0x68')]===_0xb8b9('0x69');});return{'count':_0x2920e1[_0xb8b9('0x66')][_0xb8b9('0x35')][_0xb8b9('0x36')],'rows':_['map'](_0x2920e1[_0xb8b9('0x66')][_0xb8b9('0x35')],function(_0x42450e){return{'id':_0x42450e[_0xb8b9('0x28')],'name':_0x42450e[_0xb8b9('0x6a')],'custom':_[_0xb8b9('0x6b')](_0x42450e['name'],_0xb8b9('0x6c'))?!![]:![],'options':_0x42450e[_0xb8b9('0x2e')][_0xb8b9('0x28')]===_0xb8b9('0x6d')&&_0x42450e[_0xb8b9('0x2e')][_0xb8b9('0x6e')][_0xb8b9('0x36')]>0x0?_['map'](_0x42450e[_0xb8b9('0x2e')][_0xb8b9('0x6e')],function(_0x566f97){return{'name':_0x566f97['label'],'value':_0x566f97['value']};}):[]};})};}})[_0xb8b9('0x23')](respondWithResult(_0x1852ce,null))['catch'](function(_0x2d2458){console['log'](_0xb8b9('0x6f')+_0x2d2458);var _0x6f02e1=_0x31a64e[_0xb8b9('0x30')]['test']?0x1f4:_0x2d2458[_0xb8b9('0x70')]||0x1f4;logger['error'](_0xb8b9('0x71'),_0xb8b9('0x54'),_0x6f02e1,JSON[_0xb8b9('0x72')](_0x2d2458));delete _0x2d2458[_0xb8b9('0x28')];if(_0x6f02e1===0x191){_0x6f02e1=0x190;}_0x1852ce[_0xb8b9('0x18')](_0x6f02e1)[_0xb8b9('0x29')](_0x31a64e[_0xb8b9('0x30')][_0xb8b9('0x73')]?{'message':_0xb8b9('0x74'),'statusCode':_0x2d2458[_0xb8b9('0x70')]}:_0x2d2458);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 3e4a6e1..ab06cd8 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 _0x3782=['lodash','../../config/logger','api','bluebird','path','../../config/environment','exports','define','VtigerAccount'];(function(_0x335a4b,_0x1b8f1f){var _0x4d5319=function(_0xd91544){while(--_0xd91544){_0x335a4b['push'](_0x335a4b['shift']());}};_0x4d5319(++_0x1b8f1f);}(_0x3782,0x90));var _0x2378=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3782[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2378('0x0'));var util=require('util');var logger=require(_0x2378('0x1'))(_0x2378('0x2'));var moment=require('moment');var BPromise=require(_0x2378('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2378('0x4'));var rimraf=require('rimraf');var config=require(_0x2378('0x5'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x2378('0x6')]=function(_0x3733e0,_0x23e6a7){return _0x3733e0[_0x2378('0x7')](_0x2378('0x8'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c2e=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','define','VtigerAccount','int_vtiger_accounts','lodash'];(function(_0x584bcd,_0x59c4b7){var _0x146bc7=function(_0x20b30d){while(--_0x20b30d){_0x584bcd['push'](_0x584bcd['shift']());}};_0x146bc7(++_0x59c4b7);}(_0x0c2e,0x195));var _0xe0c2=function(_0x4562ac,_0x3df938){_0x4562ac=_0x4562ac-0x0;var _0x484131=_0x0c2e[_0x4562ac];return _0x484131;};'use strict';var _=require(_0xe0c2('0x0'));var util=require(_0xe0c2('0x1'));var logger=require(_0xe0c2('0x2'))(_0xe0c2('0x3'));var moment=require(_0xe0c2('0x4'));var BPromise=require(_0xe0c2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe0c2('0x6'));var rimraf=require(_0xe0c2('0x7'));var config=require(_0xe0c2('0x8'));var attributes=require(_0xe0c2('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xe0c2('0xa')]=function(_0x42a08e,_0x1a8fc5){return _0x42a08e[_0xe0c2('0xb')](_0xe0c2('0xc'),attributes,{'tableName':_0xe0c2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 5f94603..2fff34f 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 _0xbdb7=['model','map','ShowVtigerAccount','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','attributes','limit','include'];(function(_0x239dc7,_0x10df14){var _0x1ee670=function(_0x58a16b){while(--_0x58a16b){_0x239dc7['push'](_0x239dc7['shift']());}};_0x1ee670(++_0x10df14);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5bc4ca,_0x21f738){_0x5bc4ca=_0x5bc4ca-0x0;var _0x12bf3b=_0xbdb7[_0x5bc4ca];return _0x12bf3b;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});}exports[_0x7bdb('0x15')]=function(_0x5723f4){var _0x2aff6a=this;return new Promise(function(_0x4ffd4b,_0x41f540){return db[_0x7bdb('0x16')]['findAll']({'raw':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x18')]===undefined?!![]:![]:!![],'where':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')]['where']||null:null,'attributes':_0x5723f4['options']?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x19')]||null:null,'limit':_0x5723f4['options']?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1a')]||null:null,'include':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1b')]?_['map'](_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1b')],function(_0x40c447){return{'model':db[_0x40c447[_0x7bdb('0x1c')]],'as':_0x40c447['as'],'attributes':_0x40c447['attributes'],'include':_0x40c447['include']?_[_0x7bdb('0x1d')](_0x40c447['include'],function(_0x47abaf){return{'model':db[_0x47abaf['model']],'as':_0x47abaf['as'],'attributes':_0x47abaf[_0x7bdb('0x19')],'include':_0x47abaf['include']?_[_0x7bdb('0x1d')](_0x47abaf[_0x7bdb('0x1b')],function(_0x3ec129){return{'model':db[_0x3ec129[_0x7bdb('0x1c')]],'as':_0x3ec129['as'],'attributes':_0x3ec129[_0x7bdb('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10e818){logger[_0x7bdb('0xb')](_0x7bdb('0x15'),_0x5723f4);logger[_0x7bdb('0xe')](_0x7bdb('0x15'),_0x5723f4,JSON[_0x7bdb('0x10')](_0x10e818));_0x4ffd4b(_0x10e818);})[_0x7bdb('0x14')](function(_0xd2d7be){logger[_0x7bdb('0x11')](_0x7bdb('0x15'),_0xd2d7be[_0x7bdb('0x12')],_0x5723f4);_0x41f540(_0x2aff6a[_0x7bdb('0x11')](0x1f4,_0xd2d7be['message']));});});};exports[_0x7bdb('0x1e')]=function(_0x23fc3a){var _0x8f7672=this;return new Promise(function(_0x9f5c1,_0x29eac5){return db['VtigerAccount'][_0x7bdb('0x1f')]({'raw':_0x23fc3a[_0x7bdb('0x17')]?_0x23fc3a[_0x7bdb('0x17')][_0x7bdb('0x18')]===undefined?!![]:![]:!![],'where':_0x23fc3a['options']?_0x23fc3a['options']['where']||null:null,'attributes':_0x23fc3a[_0x7bdb('0x17')]?_0x23fc3a['options'][_0x7bdb('0x19')]||null:null,'include':_0x23fc3a['options']?_0x23fc3a[_0x7bdb('0x17')][_0x7bdb('0x1b')]?_[_0x7bdb('0x1d')](_0x23fc3a['options'][_0x7bdb('0x1b')],function(_0x514713){return{'model':db[_0x514713['model']],'as':_0x514713['as'],'attributes':_0x514713[_0x7bdb('0x19')],'include':_0x514713['include']?_[_0x7bdb('0x1d')](_0x514713['include'],function(_0x5ee47d){return{'model':db[_0x5ee47d[_0x7bdb('0x1c')]],'as':_0x5ee47d['as'],'attributes':_0x5ee47d[_0x7bdb('0x19')],'include':_0x5ee47d[_0x7bdb('0x1b')]?_[_0x7bdb('0x1d')](_0x5ee47d[_0x7bdb('0x1b')],function(_0x2bb28a){return{'model':db[_0x2bb28a['model']],'as':_0x2bb28a['as'],'attributes':_0x2bb28a[_0x7bdb('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7bdb('0x20')](function(_0x329ecf){logger[_0x7bdb('0xb')](_0x7bdb('0x1e'),_0x23fc3a);logger[_0x7bdb('0xe')](_0x7bdb('0x1e'),_0x23fc3a,JSON[_0x7bdb('0x10')](_0x329ecf));_0x9f5c1(_0x329ecf);})[_0x7bdb('0x14')](function(_0x4e1c97){logger['error'](_0x7bdb('0x1e'),_0x4e1c97[_0x7bdb('0x12')],_0x23fc3a);_0x29eac5(_0x8f7672[_0x7bdb('0x11')](0x1f4,_0x4e1c97[_0x7bdb('0x12')]));});});}; \ No newline at end of file +var _0xe205=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVtigerAccount','VtigerAccount','options','raw','where','include','map','model','attributes','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x243217,_0x522951){var _0x478029=function(_0x18d053){while(--_0x18d053){_0x243217['push'](_0x243217['shift']());}};_0x478029(++_0x522951);}(_0xe205,0xa7));var _0x5e20=function(_0x41e600,_0x5b21ff){_0x41e600=_0x41e600-0x0;var _0x20be14=_0xe205[_0x41e600];return _0x20be14;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var BPromise=require(_0x5e20('0x3'));var rs=require(_0x5e20('0x4'));var fs=require('fs');var Redis=require(_0x5e20('0x5'));var db=require(_0x5e20('0x6'))['db'];var utils=require(_0x5e20('0x7'));var logger=require(_0x5e20('0x8'))('rpc');var config=require(_0x5e20('0x9'));var jayson=require(_0x5e20('0xa'));var client=jayson[_0x5e20('0xb')][_0x5e20('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5eca5c,_0x4cc88d,_0x3a382f){return new BPromise(function(_0x4c9332,_0x533e18){return client[_0x5e20('0xd')](_0x5eca5c,_0x3a382f)[_0x5e20('0xe')](function(_0x5c1eee){logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));logger[_0x5e20('0x12')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4cc88d,_0x5e20('0x11'),JSON[_0x5e20('0x13')](_0x5c1eee));if(_0x5c1eee[_0x5e20('0x14')]){if(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x15')]===0x1f4){logger[_0x5e20('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);return _0x533e18(_0x5c1eee[_0x5e20('0x14')]['message']);}logger[_0x5e20('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')]['message']);return _0x4c9332(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);}else{logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));_0x4c9332(_0x5c1eee['result'][_0x5e20('0x16')]);}})[_0x5e20('0x17')](function(_0x166ffd){logger[_0x5e20('0x14')](_0x5e20('0x10'),_0x4cc88d,_0x166ffd);_0x533e18(_0x166ffd);});});}exports[_0x5e20('0x18')]=function(_0x1cc706){var _0xf3488f=this;return new Promise(function(_0x4d3e4a,_0x434686){return db[_0x5e20('0x19')]['findAll']({'raw':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706['options'][_0x5e20('0x1c')]||null:null,'attributes':_0x1cc706['options']?_0x1cc706['options']['attributes']||null:null,'limit':_0x1cc706['options']?_0x1cc706[_0x5e20('0x1a')]['limit']||null:null,'include':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')],function(_0x4c5732){return{'model':db[_0x4c5732[_0x5e20('0x1f')]],'as':_0x4c5732['as'],'attributes':_0x4c5732['attributes'],'include':_0x4c5732['include']?_[_0x5e20('0x1e')](_0x4c5732[_0x5e20('0x1d')],function(_0x2bae08){return{'model':db[_0x2bae08[_0x5e20('0x1f')]],'as':_0x2bae08['as'],'attributes':_0x2bae08[_0x5e20('0x20')],'include':_0x2bae08[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2bae08['include'],function(_0x3bf4f4){return{'model':db[_0x3bf4f4[_0x5e20('0x1f')]],'as':_0x3bf4f4['as'],'attributes':_0x3bf4f4[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5e20('0xe')](function(_0x4c799d){logger[_0x5e20('0xf')](_0x5e20('0x18'),_0x1cc706);logger[_0x5e20('0x12')](_0x5e20('0x18'),_0x1cc706,JSON[_0x5e20('0x13')](_0x4c799d));_0x4d3e4a(_0x4c799d);})[_0x5e20('0x17')](function(_0x5ec45b){logger[_0x5e20('0x14')](_0x5e20('0x18'),_0x5ec45b['message'],_0x1cc706);_0x434686(_0xf3488f[_0x5e20('0x14')](0x1f4,_0x5ec45b[_0x5e20('0x16')]));});});};exports[_0x5e20('0x21')]=function(_0x4196a3){var _0x1548c8=this;return new Promise(function(_0x395a27,_0x4ff715){return db[_0x5e20('0x19')][_0x5e20('0x22')]({'raw':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1c')]||null:null,'attributes':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x20')]||null:null,'include':_0x4196a3['options']?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x4196a3['options'][_0x5e20('0x1d')],function(_0x2d397b){return{'model':db[_0x2d397b[_0x5e20('0x1f')]],'as':_0x2d397b['as'],'attributes':_0x2d397b[_0x5e20('0x20')],'include':_0x2d397b[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2d397b[_0x5e20('0x1d')],function(_0x173165){return{'model':db[_0x173165[_0x5e20('0x1f')]],'as':_0x173165['as'],'attributes':_0x173165[_0x5e20('0x20')],'include':_0x173165[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x173165[_0x5e20('0x1d')],function(_0x255b67){return{'model':db[_0x255b67['model']],'as':_0x255b67['as'],'attributes':_0x255b67[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x549f01){logger[_0x5e20('0xf')](_0x5e20('0x21'),_0x4196a3);logger['debug'](_0x5e20('0x21'),_0x4196a3,JSON[_0x5e20('0x13')](_0x549f01));_0x395a27(_0x549f01);})['catch'](function(_0x3f3908){logger[_0x5e20('0x14')](_0x5e20('0x21'),_0x3f3908[_0x5e20('0x16')],_0x4196a3);_0x4ff715(_0x1548c8[_0x5e20('0x14')](0x1f4,_0x3f3908[_0x5e20('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 75562ed..8694f51 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 _0x79f9=['delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/subjects','getDescriptions','post','create','put','update'];(function(_0x4390cb,_0x198df3){var _0x1df844=function(_0x588ca6){while(--_0x588ca6){_0x4390cb['push'](_0x4390cb['shift']());}};_0x1df844(++_0x198df3);}(_0x79f9,0x1ca));var _0x979f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x79f9[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x979f('0x0'));var timeout=require(_0x979f('0x1'));var express=require(_0x979f('0x2'));var router=express[_0x979f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x979f('0x4'));var interaction=require(_0x979f('0x5'));var config=require(_0x979f('0x6'));var controller=require('./intVtigerConfiguration.controller');router[_0x979f('0x7')]('/',auth[_0x979f('0x8')](),controller['index']);router['get'](_0x979f('0x9'),auth[_0x979f('0x8')](),controller[_0x979f('0xa')]);router[_0x979f('0x7')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['get'](_0x979f('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x979f('0x7')]('/:id/descriptions',auth[_0x979f('0x8')](),controller[_0x979f('0xc')]);router[_0x979f('0xd')]('/',auth[_0x979f('0x8')](),controller[_0x979f('0xe')]);router[_0x979f('0xf')](_0x979f('0x9'),auth[_0x979f('0x8')](),controller[_0x979f('0x10')]);router[_0x979f('0x11')](_0x979f('0x9'),auth['isAuthenticated'](),controller[_0x979f('0x12')]);module['exports']=router; \ No newline at end of file +var _0x74c2=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','create','put','update','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74c2,0x1e4));var _0x274c=function(_0x5c1dde,_0x314d7b){_0x5c1dde=_0x5c1dde-0x0;var _0x127b53=_0x74c2[_0x5c1dde];return _0x127b53;};'use strict';var multer=require(_0x274c('0x0'));var util=require(_0x274c('0x1'));var path=require(_0x274c('0x2'));var timeout=require(_0x274c('0x3'));var express=require('express');var router=express[_0x274c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x274c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x274c('0x6'));var controller=require(_0x274c('0x7'));router[_0x274c('0x8')]('/',auth[_0x274c('0x9')](),controller[_0x274c('0xa')]);router[_0x274c('0x8')](_0x274c('0xb'),auth[_0x274c('0x9')](),controller['show']);router[_0x274c('0x8')](_0x274c('0xc'),auth[_0x274c('0x9')](),controller[_0x274c('0xd')]);router[_0x274c('0x8')](_0x274c('0xe'),auth[_0x274c('0x9')](),controller['getSubjects']);router['get'](_0x274c('0xf'),auth[_0x274c('0x9')](),controller['getDescriptions']);router[_0x274c('0x10')]('/',auth[_0x274c('0x9')](),controller[_0x274c('0x11')]);router[_0x274c('0x12')](_0x274c('0xb'),auth[_0x274c('0x9')](),controller[_0x274c('0x13')]);router['delete'](_0x274c('0xb'),auth[_0x274c('0x9')](),controller[_0x274c('0x14')]);module[_0x274c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 61ce0ea..0095605 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 _0x2791=['exports','STRING'];(function(_0x33314d,_0x499628){var _0x4ffe8e=function(_0xb1ec35){while(--_0xb1ec35){_0x33314d['push'](_0x33314d['shift']());}};_0x4ffe8e(++_0x499628);}(_0x2791,0x1c6));var _0x1279=function(_0x3459a9,_0x245ed1){_0x3459a9=_0x3459a9-0x0;var _0xa93e60=_0x2791[_0x3459a9];return _0xa93e60;};'use strict';var Sequelize=require('sequelize');module[_0x1279('0x0')]={'name':{'type':Sequelize[_0x1279('0x1')]},'description':{'type':Sequelize[_0x1279('0x1')]}}; \ No newline at end of file +var _0xfcb7=['STRING','sequelize','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xfcb7,0x1c6));var _0x7fcb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfcb7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7fcb('0x0'));module[_0x7fcb('0x1')]={'name':{'type':Sequelize[_0x7fcb('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 4781234..84da144 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 _0x5d21=['then','destroy','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','key','query','filters','model','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','findAll','rows','catch','show','keys','length','includeAll','include','create','body','find','params','getFields','findOne','nolimit','getSubjects','getDescriptions','eml-format','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update'];(function(_0x5d3313,_0x39c46e){var _0x40b46c=function(_0x37e32a){while(--_0x37e32a){_0x5d3313['push'](_0x5d3313['shift']());}};_0x40b46c(++_0x39c46e);}(_0x5d21,0x178));var _0x15d2=function(_0x1c09e8,_0x30cac4){_0x1c09e8=_0x1c09e8-0x0;var _0x431e42=_0x5d21[_0x1c09e8];return _0x431e42;};'use strict';var emlformat=require(_0x15d2('0x0'));var rimraf=require(_0x15d2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x15d2('0x2'));var rp=require(_0x15d2('0x3'));var moment=require(_0x15d2('0x4'));var BPromise=require(_0x15d2('0x5'));var Mustache=require(_0x15d2('0x6'));var util=require(_0x15d2('0x7'));var path=require('path');var sox=require(_0x15d2('0x8'));var csv=require(_0x15d2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x15d2('0xa'));var _=require(_0x15d2('0xb'));var squel=require(_0x15d2('0xc'));var crypto=require(_0x15d2('0xd'));var jsforce=require(_0x15d2('0xe'));var deskjs=require(_0x15d2('0xf'));var toCsv=require(_0x15d2('0x9'));var querystring=require(_0x15d2('0x10'));var Papa=require(_0x15d2('0x11'));var Redis=require(_0x15d2('0x12'));var authService=require(_0x15d2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x15d2('0x14'));var hardwareService=require(_0x15d2('0x15'));var logger=require(_0x15d2('0x16'))(_0x15d2('0x17'));var utils=require('../../config/utils');var config=require(_0x15d2('0x18'));var licenseUtil=require(_0x15d2('0x19'));var db=require(_0x15d2('0x1a'))['db'];function respondWithStatusCode(_0x1461ec,_0x5ec2ff){_0x5ec2ff=_0x5ec2ff||0xcc;return function(_0x4c33d4){if(_0x4c33d4){return _0x1461ec[_0x15d2('0x1b')](_0x5ec2ff);}return _0x1461ec['status'](_0x5ec2ff)[_0x15d2('0x1c')]();};}function respondWithResult(_0x53c8ae,_0x1cbc48){_0x1cbc48=_0x1cbc48||0xc8;return function(_0x24e817){if(_0x24e817){return _0x53c8ae['status'](_0x1cbc48)[_0x15d2('0x1d')](_0x24e817);}};}function respondWithFilteredResult(_0x4d2fe9,_0x5362e4){return function(_0x580335){if(_0x580335){var _0x274c5e=typeof _0x5362e4[_0x15d2('0x1e')]===_0x15d2('0x1f')&&typeof _0x5362e4[_0x15d2('0x20')]===_0x15d2('0x1f');var _0x29846f=_0x580335[_0x15d2('0x21')];var _0x1201d8=_0x274c5e?0x0:_0x5362e4[_0x15d2('0x1e')];var _0x41b590=_0x274c5e?_0x580335[_0x15d2('0x21')]:_0x5362e4[_0x15d2('0x1e')]+_0x5362e4['limit'];var _0x368c63;if(_0x41b590>=_0x29846f){_0x41b590=_0x29846f;_0x368c63=0xc8;}else{_0x368c63=0xce;}_0x4d2fe9[_0x15d2('0x22')](_0x368c63);return _0x4d2fe9['set']('Content-Range',_0x1201d8+'-'+_0x41b590+'/'+_0x29846f)[_0x15d2('0x1d')](_0x580335);}return null;};}function patchUpdates(_0x363321){return function(_0x28387c){try{jsonpatch[_0x15d2('0x23')](_0x28387c,_0x363321,!![]);}catch(_0x197eee){return BPromise[_0x15d2('0x24')](_0x197eee);}return _0x28387c[_0x15d2('0x25')]();};}function saveUpdates(_0x131da3,_0x184b48){return function(_0xd6d54c){if(_0xd6d54c){return _0xd6d54c[_0x15d2('0x26')](_0x131da3)[_0x15d2('0x27')](function(_0x4c0434){return _0x4c0434;});}return null;};}function removeEntity(_0x5544e7,_0x3e67e7){return function(_0x558601){if(_0x558601){return _0x558601[_0x15d2('0x28')]()[_0x15d2('0x27')](function(){_0x5544e7[_0x15d2('0x22')](0xcc)[_0x15d2('0x1c')]();});}};}function handleEntityNotFound(_0xdd608c,_0x4d678d){return function(_0x353cc7){if(!_0x353cc7){_0xdd608c[_0x15d2('0x1b')](0x194);}return _0x353cc7;};}function handleError(_0x256c77,_0x340e6e){_0x340e6e=_0x340e6e||0x1f4;return function(_0x27fb16){logger[_0x15d2('0x29')](_0x27fb16[_0x15d2('0x2a')]);if(_0x27fb16['name']){delete _0x27fb16[_0x15d2('0x2b')];}_0x256c77[_0x15d2('0x22')](_0x340e6e)[_0x15d2('0x2c')](_0x27fb16);};}exports[_0x15d2('0x2d')]=function(_0x551e24,_0x38643e){var _0x5e65d4={},_0x40b5a8={},_0x3c1734={'count':0x0,'rows':[]};var _0x3441ce=_[_0x15d2('0x2e')](db[_0x15d2('0x2f')][_0x15d2('0x30')],function(_0x1ca1fc){return{'name':_0x1ca1fc['fieldName'],'type':_0x1ca1fc[_0x15d2('0x31')][_0x15d2('0x32')]};});_0x40b5a8['model']=_['map'](_0x3441ce,_0x15d2('0x2b'));_0x40b5a8[_0x15d2('0x33')]=_['keys'](_0x551e24[_0x15d2('0x33')]);_0x40b5a8[_0x15d2('0x34')]=_['intersection'](_0x40b5a8[_0x15d2('0x35')],_0x40b5a8[_0x15d2('0x33')]);_0x5e65d4['attributes']=_[_0x15d2('0x36')](_0x40b5a8[_0x15d2('0x35')],qs[_0x15d2('0x37')](_0x551e24[_0x15d2('0x33')]['fields']));_0x5e65d4[_0x15d2('0x38')]=_0x5e65d4[_0x15d2('0x38')]['length']?_0x5e65d4[_0x15d2('0x38')]:_0x40b5a8[_0x15d2('0x35')];if(!_0x551e24[_0x15d2('0x33')][_0x15d2('0x39')]('nolimit')){_0x5e65d4[_0x15d2('0x20')]=qs[_0x15d2('0x20')](_0x551e24[_0x15d2('0x33')][_0x15d2('0x20')]);_0x5e65d4[_0x15d2('0x1e')]=qs[_0x15d2('0x1e')](_0x551e24[_0x15d2('0x33')][_0x15d2('0x1e')]);}_0x5e65d4[_0x15d2('0x3a')]=qs['sort'](_0x551e24[_0x15d2('0x33')][_0x15d2('0x3b')]);_0x5e65d4[_0x15d2('0x3c')]=qs['filters'](_[_0x15d2('0x3d')](_0x551e24['query'],_0x40b5a8['filters']),_0x3441ce);if(_0x551e24['query']['filter']){_0x5e65d4['where']=_['merge'](_0x5e65d4[_0x15d2('0x3c')],{'$or':_[_0x15d2('0x2e')](_0x3441ce,function(_0x4180bb){if(_0x4180bb[_0x15d2('0x31')]!==_0x15d2('0x3e')){var _0x2f6ece={};_0x2f6ece[_0x4180bb[_0x15d2('0x2b')]]={'$like':'%'+_0x551e24['query'][_0x15d2('0x3f')]+'%'};return _0x2f6ece;}})});}_0x5e65d4=_[_0x15d2('0x40')]({},_0x5e65d4,_0x551e24[_0x15d2('0x41')]);var _0xcd059e={'where':_0x5e65d4[_0x15d2('0x3c')]};return db['VtigerConfiguration']['count'](_0xcd059e)[_0x15d2('0x27')](function(_0x34d3f2){_0x3c1734['count']=_0x34d3f2;if(_0x551e24[_0x15d2('0x33')]['includeAll']){_0x5e65d4['include']=[{'all':!![]}];}return db[_0x15d2('0x2f')][_0x15d2('0x42')](_0x5e65d4);})[_0x15d2('0x27')](function(_0x38e226){_0x3c1734[_0x15d2('0x43')]=_0x38e226;return _0x3c1734;})[_0x15d2('0x27')](respondWithFilteredResult(_0x38643e,_0x5e65d4))[_0x15d2('0x44')](handleError(_0x38643e,null));};exports[_0x15d2('0x45')]=function(_0xb83007,_0x63ceb1){var _0x4df938={'raw':![],'where':{'id':_0xb83007['params']['id']}},_0x217e51={};_0x217e51[_0x15d2('0x35')]=_[_0x15d2('0x46')](db[_0x15d2('0x2f')]['rawAttributes']);_0x217e51[_0x15d2('0x33')]=_[_0x15d2('0x46')](_0xb83007[_0x15d2('0x33')]);_0x217e51['filters']=_['intersection'](_0x217e51['model'],_0x217e51[_0x15d2('0x33')]);_0x4df938[_0x15d2('0x38')]=_[_0x15d2('0x36')](_0x217e51['model'],qs[_0x15d2('0x37')](_0xb83007[_0x15d2('0x33')][_0x15d2('0x37')]));_0x4df938['attributes']=_0x4df938['attributes'][_0x15d2('0x47')]?_0x4df938['attributes']:_0x217e51['model'];if(_0xb83007[_0x15d2('0x33')][_0x15d2('0x48')]){_0x4df938[_0x15d2('0x49')]=[{'all':!![]}];}_0x4df938=_[_0x15d2('0x40')]({},_0x4df938,_0xb83007[_0x15d2('0x41')]);return db[_0x15d2('0x2f')]['find'](_0x4df938)['then'](handleEntityNotFound(_0x63ceb1,null))[_0x15d2('0x27')](respondWithResult(_0x63ceb1,null))[_0x15d2('0x44')](handleError(_0x63ceb1,null));};exports[_0x15d2('0x4a')]=function(_0x6e40eb,_0xf3edc0){return db[_0x15d2('0x2f')][_0x15d2('0x4a')](_0x6e40eb[_0x15d2('0x4b')],{})[_0x15d2('0x27')](respondWithResult(_0xf3edc0,0xc9))[_0x15d2('0x44')](handleError(_0xf3edc0,null));};exports[_0x15d2('0x26')]=function(_0x14844d,_0x59e4e8){if(_0x14844d[_0x15d2('0x4b')]['id']){delete _0x14844d[_0x15d2('0x4b')]['id'];}return db[_0x15d2('0x2f')][_0x15d2('0x4c')]({'where':{'id':_0x14844d[_0x15d2('0x4d')]['id']}})[_0x15d2('0x27')](handleEntityNotFound(_0x59e4e8,null))[_0x15d2('0x27')](saveUpdates(_0x14844d[_0x15d2('0x4b')],null))[_0x15d2('0x27')](respondWithResult(_0x59e4e8,null))['catch'](handleError(_0x59e4e8,null));};exports[_0x15d2('0x28')]=function(_0xb7613f,_0x27abc7){return db[_0x15d2('0x2f')][_0x15d2('0x4c')]({'where':{'id':_0xb7613f[_0x15d2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x27abc7,null))['then'](removeEntity(_0x27abc7,null))[_0x15d2('0x44')](handleError(_0x27abc7,null));};exports[_0x15d2('0x4e')]=function(_0x16b941,_0x2815b9,_0x3edbbf){var _0x515168={};var _0x59621b={};var _0x2c7091;var _0x200986;return db['VtigerConfiguration'][_0x15d2('0x4f')]({'where':{'id':_0x16b941['params']['id']}})[_0x15d2('0x27')](handleEntityNotFound(_0x2815b9,null))[_0x15d2('0x27')](function(_0x39dcc9){if(_0x39dcc9){_0x2c7091=_0x39dcc9;_0x59621b[_0x15d2('0x35')]=_[_0x15d2('0x46')](db['VtigerField'][_0x15d2('0x30')]);_0x59621b[_0x15d2('0x33')]=_[_0x15d2('0x46')](_0x16b941[_0x15d2('0x33')]);_0x59621b[_0x15d2('0x34')]=_[_0x15d2('0x36')](_0x59621b[_0x15d2('0x35')],_0x59621b[_0x15d2('0x33')]);_0x515168[_0x15d2('0x38')]=_[_0x15d2('0x36')](_0x59621b['model'],qs[_0x15d2('0x37')](_0x16b941[_0x15d2('0x33')]['fields']));_0x515168[_0x15d2('0x38')]=_0x515168[_0x15d2('0x38')][_0x15d2('0x47')]?_0x515168[_0x15d2('0x38')]:_0x59621b['model'];_0x515168[_0x15d2('0x3a')]=qs[_0x15d2('0x3b')](_0x16b941[_0x15d2('0x33')]['sort']);_0x515168[_0x15d2('0x3c')]=qs[_0x15d2('0x34')](_['pick'](_0x16b941[_0x15d2('0x33')],_0x59621b[_0x15d2('0x34')]));if(_0x16b941[_0x15d2('0x33')]['filter']){_0x515168[_0x15d2('0x3c')]=_[_0x15d2('0x40')](_0x515168[_0x15d2('0x3c')],{'$or':_[_0x15d2('0x2e')](_0x515168['attributes'],function(_0x56c125){var _0x5433c8={};_0x5433c8[_0x56c125]={'$like':'%'+_0x16b941[_0x15d2('0x33')][_0x15d2('0x3f')]+'%'};return _0x5433c8;})});}_0x515168=_[_0x15d2('0x40')]({},_0x515168,_0x16b941[_0x15d2('0x41')]);return _0x2c7091[_0x15d2('0x4e')](_0x515168);}})[_0x15d2('0x27')](function(_0x54d7fe){if(_0x54d7fe){_0x200986=_0x54d7fe[_0x15d2('0x47')];if(!_0x16b941[_0x15d2('0x33')][_0x15d2('0x39')](_0x15d2('0x50'))){_0x515168['limit']=qs['limit'](_0x16b941[_0x15d2('0x33')][_0x15d2('0x20')]);_0x515168[_0x15d2('0x1e')]=qs[_0x15d2('0x1e')](_0x16b941[_0x15d2('0x33')][_0x15d2('0x1e')]);}return _0x2c7091['getFields'](_0x515168);}})[_0x15d2('0x27')](function(_0x39cea6){if(_0x39cea6){return _0x39cea6?{'count':_0x200986,'rows':_0x39cea6}:null;}})['then'](respondWithResult(_0x2815b9,null))['catch'](handleError(_0x2815b9,null));};exports[_0x15d2('0x51')]=function(_0xbb8be5,_0x20f583,_0x24f30a){var _0x4443aa={};var _0x23d07e={};var _0x476341;var _0x3ad1a4;return db[_0x15d2('0x2f')][_0x15d2('0x4f')]({'where':{'id':_0xbb8be5[_0x15d2('0x4d')]['id']}})[_0x15d2('0x27')](handleEntityNotFound(_0x20f583,null))['then'](function(_0x251dab){if(_0x251dab){_0x476341=_0x251dab;_0x23d07e[_0x15d2('0x35')]=_[_0x15d2('0x46')](db['VtigerField'][_0x15d2('0x30')]);_0x23d07e['query']=_[_0x15d2('0x46')](_0xbb8be5[_0x15d2('0x33')]);_0x23d07e['filters']=_['intersection'](_0x23d07e[_0x15d2('0x35')],_0x23d07e['query']);_0x4443aa[_0x15d2('0x38')]=_['intersection'](_0x23d07e[_0x15d2('0x35')],qs[_0x15d2('0x37')](_0xbb8be5['query'][_0x15d2('0x37')]));_0x4443aa['attributes']=_0x4443aa[_0x15d2('0x38')][_0x15d2('0x47')]?_0x4443aa[_0x15d2('0x38')]:_0x23d07e[_0x15d2('0x35')];_0x4443aa[_0x15d2('0x3a')]=qs['sort'](_0xbb8be5[_0x15d2('0x33')][_0x15d2('0x3b')]);_0x4443aa['where']=qs['filters'](_['pick'](_0xbb8be5[_0x15d2('0x33')],_0x23d07e['filters']));if(_0xbb8be5['query'][_0x15d2('0x3f')]){_0x4443aa['where']=_[_0x15d2('0x40')](_0x4443aa[_0x15d2('0x3c')],{'$or':_[_0x15d2('0x2e')](_0x4443aa[_0x15d2('0x38')],function(_0x56e645){var _0x4ff317={};_0x4ff317[_0x56e645]={'$like':'%'+_0xbb8be5[_0x15d2('0x33')]['filter']+'%'};return _0x4ff317;})});}_0x4443aa=_['merge']({},_0x4443aa,_0xbb8be5['options']);return _0x476341[_0x15d2('0x51')](_0x4443aa);}})[_0x15d2('0x27')](function(_0x5d76d9){if(_0x5d76d9){_0x3ad1a4=_0x5d76d9['length'];if(!_0xbb8be5[_0x15d2('0x33')][_0x15d2('0x39')](_0x15d2('0x50'))){_0x4443aa[_0x15d2('0x20')]=qs[_0x15d2('0x20')](_0xbb8be5[_0x15d2('0x33')][_0x15d2('0x20')]);_0x4443aa[_0x15d2('0x1e')]=qs[_0x15d2('0x1e')](_0xbb8be5[_0x15d2('0x33')][_0x15d2('0x1e')]);}return _0x476341['getSubjects'](_0x4443aa);}})[_0x15d2('0x27')](function(_0x4f4428){if(_0x4f4428){return _0x4f4428?{'count':_0x3ad1a4,'rows':_0x4f4428}:null;}})[_0x15d2('0x27')](respondWithResult(_0x20f583,null))['catch'](handleError(_0x20f583,null));};exports['getDescriptions']=function(_0x2c47a4,_0x2b3228,_0x4bfd06){var _0x33c7eb={};var _0x14e88a={};var _0x588a3f;var _0x44c354;return db[_0x15d2('0x2f')][_0x15d2('0x4f')]({'where':{'id':_0x2c47a4['params']['id']}})[_0x15d2('0x27')](handleEntityNotFound(_0x2b3228,null))[_0x15d2('0x27')](function(_0x48fcfe){if(_0x48fcfe){_0x588a3f=_0x48fcfe;_0x14e88a['model']=_[_0x15d2('0x46')](db['VtigerField'][_0x15d2('0x30')]);_0x14e88a['query']=_[_0x15d2('0x46')](_0x2c47a4['query']);_0x14e88a[_0x15d2('0x34')]=_[_0x15d2('0x36')](_0x14e88a[_0x15d2('0x35')],_0x14e88a[_0x15d2('0x33')]);_0x33c7eb[_0x15d2('0x38')]=_['intersection'](_0x14e88a[_0x15d2('0x35')],qs[_0x15d2('0x37')](_0x2c47a4[_0x15d2('0x33')][_0x15d2('0x37')]));_0x33c7eb[_0x15d2('0x38')]=_0x33c7eb[_0x15d2('0x38')][_0x15d2('0x47')]?_0x33c7eb[_0x15d2('0x38')]:_0x14e88a['model'];_0x33c7eb[_0x15d2('0x3a')]=qs[_0x15d2('0x3b')](_0x2c47a4[_0x15d2('0x33')][_0x15d2('0x3b')]);_0x33c7eb['where']=qs['filters'](_[_0x15d2('0x3d')](_0x2c47a4[_0x15d2('0x33')],_0x14e88a[_0x15d2('0x34')]));if(_0x2c47a4['query'][_0x15d2('0x3f')]){_0x33c7eb['where']=_[_0x15d2('0x40')](_0x33c7eb[_0x15d2('0x3c')],{'$or':_[_0x15d2('0x2e')](_0x33c7eb[_0x15d2('0x38')],function(_0xece5d0){var _0x4b46da={};_0x4b46da[_0xece5d0]={'$like':'%'+_0x2c47a4[_0x15d2('0x33')][_0x15d2('0x3f')]+'%'};return _0x4b46da;})});}_0x33c7eb=_[_0x15d2('0x40')]({},_0x33c7eb,_0x2c47a4[_0x15d2('0x41')]);return _0x588a3f['getDescriptions'](_0x33c7eb);}})[_0x15d2('0x27')](function(_0x4855ad){if(_0x4855ad){_0x44c354=_0x4855ad['length'];if(!_0x2c47a4[_0x15d2('0x33')]['hasOwnProperty'](_0x15d2('0x50'))){_0x33c7eb['limit']=qs[_0x15d2('0x20')](_0x2c47a4['query'][_0x15d2('0x20')]);_0x33c7eb[_0x15d2('0x1e')]=qs[_0x15d2('0x1e')](_0x2c47a4['query'][_0x15d2('0x1e')]);}return _0x588a3f[_0x15d2('0x52')](_0x33c7eb);}})[_0x15d2('0x27')](function(_0x47e0ff){if(_0x47e0ff){return _0x47e0ff?{'count':_0x44c354,'rows':_0x47e0ff}:null;}})[_0x15d2('0x27')](respondWithResult(_0x2b3228,null))[_0x15d2('0x44')](handleError(_0x2b3228,null));}; \ No newline at end of file +var _0xd517=['VIRTUAL','options','catch','includeAll','include','find','create','body','params','getFields','VtigerField','nolimit','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','undefined','limit','count','offset','status','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where'];(function(_0x179626,_0x3357b6){var _0x64bd2b=function(_0x44609a){while(--_0x44609a){_0x179626['push'](_0x179626['shift']());}};_0x64bd2b(++_0x3357b6);}(_0xd517,0x1dd));var _0x7d51=function(_0x2211ed,_0x1bca0b){_0x2211ed=_0x2211ed-0x0;var _0x4d78cc=_0xd517[_0x2211ed];return _0x4d78cc;};'use strict';var emlformat=require(_0x7d51('0x0'));var rimraf=require(_0x7d51('0x1'));var zipdir=require(_0x7d51('0x2'));var jsonpatch=require(_0x7d51('0x3'));var rp=require(_0x7d51('0x4'));var moment=require('moment');var BPromise=require(_0x7d51('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7d51('0x6'));var sox=require(_0x7d51('0x7'));var csv=require(_0x7d51('0x8'));var ejs=require(_0x7d51('0x9'));var fs=require('fs');var fs_extra=require(_0x7d51('0xa'));var _=require(_0x7d51('0xb'));var squel=require(_0x7d51('0xc'));var crypto=require(_0x7d51('0xd'));var jsforce=require(_0x7d51('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7d51('0xf'));var Papa=require(_0x7d51('0x10'));var Redis=require(_0x7d51('0x11'));var authService=require(_0x7d51('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d51('0x13'));var logger=require(_0x7d51('0x14'))(_0x7d51('0x15'));var utils=require('../../config/utils');var config=require(_0x7d51('0x16'));var licenseUtil=require(_0x7d51('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x862d23,_0x4d2446){_0x4d2446=_0x4d2446||0xcc;return function(_0x5df8db){if(_0x5df8db){return _0x862d23[_0x7d51('0x18')](_0x4d2446);}return _0x862d23['status'](_0x4d2446)['end']();};}function respondWithResult(_0xdffda4,_0xe77939){_0xe77939=_0xe77939||0xc8;return function(_0xad66fb){if(_0xad66fb){return _0xdffda4['status'](_0xe77939)['json'](_0xad66fb);}};}function respondWithFilteredResult(_0x305c26,_0x1ea497){return function(_0x31c95c){if(_0x31c95c){var _0x102eb7=typeof _0x1ea497['offset']===_0x7d51('0x19')&&typeof _0x1ea497[_0x7d51('0x1a')]==='undefined';var _0x55968a=_0x31c95c[_0x7d51('0x1b')];var _0x2ef330=_0x102eb7?0x0:_0x1ea497[_0x7d51('0x1c')];var _0x48a5e5=_0x102eb7?_0x31c95c[_0x7d51('0x1b')]:_0x1ea497[_0x7d51('0x1c')]+_0x1ea497[_0x7d51('0x1a')];var _0x48b55b;if(_0x48a5e5>=_0x55968a){_0x48a5e5=_0x55968a;_0x48b55b=0xc8;}else{_0x48b55b=0xce;}_0x305c26[_0x7d51('0x1d')](_0x48b55b);return _0x305c26['set'](_0x7d51('0x1e'),_0x2ef330+'-'+_0x48a5e5+'/'+_0x55968a)['json'](_0x31c95c);}return null;};}function patchUpdates(_0x3401f8){return function(_0x401c96){try{jsonpatch[_0x7d51('0x1f')](_0x401c96,_0x3401f8,!![]);}catch(_0x207f3c){return BPromise[_0x7d51('0x20')](_0x207f3c);}return _0x401c96[_0x7d51('0x21')]();};}function saveUpdates(_0x2ebce3,_0x17463e){return function(_0x1d9daf){if(_0x1d9daf){return _0x1d9daf[_0x7d51('0x22')](_0x2ebce3)[_0x7d51('0x23')](function(_0x1f940a){return _0x1f940a;});}return null;};}function removeEntity(_0x44f118,_0x1e1f8c){return function(_0x24bf87){if(_0x24bf87){return _0x24bf87[_0x7d51('0x24')]()[_0x7d51('0x23')](function(){_0x44f118['status'](0xcc)[_0x7d51('0x25')]();});}};}function handleEntityNotFound(_0x9dc472,_0x4d197a){return function(_0x20d785){if(!_0x20d785){_0x9dc472[_0x7d51('0x18')](0x194);}return _0x20d785;};}function handleError(_0xd262e6,_0x12ee8a){_0x12ee8a=_0x12ee8a||0x1f4;return function(_0xf98473){logger[_0x7d51('0x26')](_0xf98473[_0x7d51('0x27')]);if(_0xf98473[_0x7d51('0x28')]){delete _0xf98473[_0x7d51('0x28')];}_0xd262e6[_0x7d51('0x1d')](_0x12ee8a)['send'](_0xf98473);};}exports['index']=function(_0x5029eb,_0x2b5b48){var _0x3e4b64={},_0x34bb5b={},_0x5ae6c6={'count':0x0,'rows':[]};var _0x17e735=_['map'](db[_0x7d51('0x29')][_0x7d51('0x2a')],function(_0x3d8969){return{'name':_0x3d8969[_0x7d51('0x2b')],'type':_0x3d8969[_0x7d51('0x2c')][_0x7d51('0x2d')]};});_0x34bb5b[_0x7d51('0x2e')]=_[_0x7d51('0x2f')](_0x17e735,_0x7d51('0x28'));_0x34bb5b[_0x7d51('0x30')]=_[_0x7d51('0x31')](_0x5029eb[_0x7d51('0x30')]);_0x34bb5b[_0x7d51('0x32')]=_[_0x7d51('0x33')](_0x34bb5b[_0x7d51('0x2e')],_0x34bb5b['query']);_0x3e4b64['attributes']=_[_0x7d51('0x33')](_0x34bb5b['model'],qs[_0x7d51('0x34')](_0x5029eb[_0x7d51('0x30')][_0x7d51('0x34')]));_0x3e4b64['attributes']=_0x3e4b64[_0x7d51('0x35')][_0x7d51('0x36')]?_0x3e4b64[_0x7d51('0x35')]:_0x34bb5b[_0x7d51('0x2e')];if(!_0x5029eb[_0x7d51('0x30')][_0x7d51('0x37')]('nolimit')){_0x3e4b64[_0x7d51('0x1a')]=qs[_0x7d51('0x1a')](_0x5029eb[_0x7d51('0x30')][_0x7d51('0x1a')]);_0x3e4b64['offset']=qs[_0x7d51('0x1c')](_0x5029eb[_0x7d51('0x30')][_0x7d51('0x1c')]);}_0x3e4b64[_0x7d51('0x38')]=qs['sort'](_0x5029eb[_0x7d51('0x30')][_0x7d51('0x39')]);_0x3e4b64['where']=qs['filters'](_[_0x7d51('0x3a')](_0x5029eb[_0x7d51('0x30')],_0x34bb5b[_0x7d51('0x32')]),_0x17e735);if(_0x5029eb[_0x7d51('0x30')][_0x7d51('0x3b')]){_0x3e4b64['where']=_[_0x7d51('0x3c')](_0x3e4b64[_0x7d51('0x3d')],{'$or':_['map'](_0x17e735,function(_0x1e3734){if(_0x1e3734[_0x7d51('0x2c')]!==_0x7d51('0x3e')){var _0x323adb={};_0x323adb[_0x1e3734[_0x7d51('0x28')]]={'$like':'%'+_0x5029eb[_0x7d51('0x30')][_0x7d51('0x3b')]+'%'};return _0x323adb;}})});}_0x3e4b64=_['merge']({},_0x3e4b64,_0x5029eb[_0x7d51('0x3f')]);var _0x27b37b={'where':_0x3e4b64['where']};return db[_0x7d51('0x29')][_0x7d51('0x1b')](_0x27b37b)['then'](function(_0x2ba385){_0x5ae6c6['count']=_0x2ba385;if(_0x5029eb[_0x7d51('0x30')]['includeAll']){_0x3e4b64['include']=[{'all':!![]}];}return db[_0x7d51('0x29')]['findAll'](_0x3e4b64);})[_0x7d51('0x23')](function(_0x3ba4a3){_0x5ae6c6['rows']=_0x3ba4a3;return _0x5ae6c6;})[_0x7d51('0x23')](respondWithFilteredResult(_0x2b5b48,_0x3e4b64))[_0x7d51('0x40')](handleError(_0x2b5b48,null));};exports['show']=function(_0x4819cc,_0x9b98d0){var _0x470859={'raw':![],'where':{'id':_0x4819cc['params']['id']}},_0x54b829={};_0x54b829[_0x7d51('0x2e')]=_[_0x7d51('0x31')](db[_0x7d51('0x29')]['rawAttributes']);_0x54b829[_0x7d51('0x30')]=_[_0x7d51('0x31')](_0x4819cc[_0x7d51('0x30')]);_0x54b829['filters']=_[_0x7d51('0x33')](_0x54b829[_0x7d51('0x2e')],_0x54b829[_0x7d51('0x30')]);_0x470859['attributes']=_[_0x7d51('0x33')](_0x54b829[_0x7d51('0x2e')],qs[_0x7d51('0x34')](_0x4819cc[_0x7d51('0x30')][_0x7d51('0x34')]));_0x470859[_0x7d51('0x35')]=_0x470859[_0x7d51('0x35')][_0x7d51('0x36')]?_0x470859[_0x7d51('0x35')]:_0x54b829[_0x7d51('0x2e')];if(_0x4819cc[_0x7d51('0x30')][_0x7d51('0x41')]){_0x470859[_0x7d51('0x42')]=[{'all':!![]}];}_0x470859=_[_0x7d51('0x3c')]({},_0x470859,_0x4819cc[_0x7d51('0x3f')]);return db[_0x7d51('0x29')][_0x7d51('0x43')](_0x470859)[_0x7d51('0x23')](handleEntityNotFound(_0x9b98d0,null))[_0x7d51('0x23')](respondWithResult(_0x9b98d0,null))[_0x7d51('0x40')](handleError(_0x9b98d0,null));};exports[_0x7d51('0x44')]=function(_0x46ccb5,_0x52969d){return db[_0x7d51('0x29')][_0x7d51('0x44')](_0x46ccb5[_0x7d51('0x45')],{})[_0x7d51('0x23')](respondWithResult(_0x52969d,0xc9))[_0x7d51('0x40')](handleError(_0x52969d,null));};exports[_0x7d51('0x22')]=function(_0x595619,_0x302d4e){if(_0x595619['body']['id']){delete _0x595619['body']['id'];}return db[_0x7d51('0x29')][_0x7d51('0x43')]({'where':{'id':_0x595619[_0x7d51('0x46')]['id']}})[_0x7d51('0x23')](handleEntityNotFound(_0x302d4e,null))[_0x7d51('0x23')](saveUpdates(_0x595619[_0x7d51('0x45')],null))[_0x7d51('0x23')](respondWithResult(_0x302d4e,null))[_0x7d51('0x40')](handleError(_0x302d4e,null));};exports[_0x7d51('0x24')]=function(_0x5b7ad3,_0x31d9d4){return db[_0x7d51('0x29')][_0x7d51('0x43')]({'where':{'id':_0x5b7ad3[_0x7d51('0x46')]['id']}})[_0x7d51('0x23')](handleEntityNotFound(_0x31d9d4,null))[_0x7d51('0x23')](removeEntity(_0x31d9d4,null))['catch'](handleError(_0x31d9d4,null));};exports[_0x7d51('0x47')]=function(_0x37e52c,_0x5a4e37,_0x510ca1){var _0x465259={};var _0x152880={};var _0x2f37ea;var _0xf6e105;return db[_0x7d51('0x29')]['findOne']({'where':{'id':_0x37e52c[_0x7d51('0x46')]['id']}})[_0x7d51('0x23')](handleEntityNotFound(_0x5a4e37,null))[_0x7d51('0x23')](function(_0x35d4e9){if(_0x35d4e9){_0x2f37ea=_0x35d4e9;_0x152880['model']=_[_0x7d51('0x31')](db[_0x7d51('0x48')]['rawAttributes']);_0x152880[_0x7d51('0x30')]=_[_0x7d51('0x31')](_0x37e52c[_0x7d51('0x30')]);_0x152880[_0x7d51('0x32')]=_[_0x7d51('0x33')](_0x152880[_0x7d51('0x2e')],_0x152880[_0x7d51('0x30')]);_0x465259['attributes']=_[_0x7d51('0x33')](_0x152880['model'],qs[_0x7d51('0x34')](_0x37e52c[_0x7d51('0x30')][_0x7d51('0x34')]));_0x465259[_0x7d51('0x35')]=_0x465259[_0x7d51('0x35')][_0x7d51('0x36')]?_0x465259[_0x7d51('0x35')]:_0x152880[_0x7d51('0x2e')];_0x465259[_0x7d51('0x38')]=qs[_0x7d51('0x39')](_0x37e52c[_0x7d51('0x30')][_0x7d51('0x39')]);_0x465259[_0x7d51('0x3d')]=qs[_0x7d51('0x32')](_[_0x7d51('0x3a')](_0x37e52c['query'],_0x152880[_0x7d51('0x32')]));if(_0x37e52c[_0x7d51('0x30')][_0x7d51('0x3b')]){_0x465259[_0x7d51('0x3d')]=_[_0x7d51('0x3c')](_0x465259[_0x7d51('0x3d')],{'$or':_[_0x7d51('0x2f')](_0x465259['attributes'],function(_0x4f5afc){var _0x5e49a8={};_0x5e49a8[_0x4f5afc]={'$like':'%'+_0x37e52c[_0x7d51('0x30')][_0x7d51('0x3b')]+'%'};return _0x5e49a8;})});}_0x465259=_[_0x7d51('0x3c')]({},_0x465259,_0x37e52c[_0x7d51('0x3f')]);return _0x2f37ea[_0x7d51('0x47')](_0x465259);}})[_0x7d51('0x23')](function(_0x11fb28){if(_0x11fb28){_0xf6e105=_0x11fb28[_0x7d51('0x36')];if(!_0x37e52c[_0x7d51('0x30')][_0x7d51('0x37')](_0x7d51('0x49'))){_0x465259[_0x7d51('0x1a')]=qs[_0x7d51('0x1a')](_0x37e52c[_0x7d51('0x30')][_0x7d51('0x1a')]);_0x465259[_0x7d51('0x1c')]=qs['offset'](_0x37e52c[_0x7d51('0x30')][_0x7d51('0x1c')]);}return _0x2f37ea[_0x7d51('0x47')](_0x465259);}})[_0x7d51('0x23')](function(_0x4fc9be){if(_0x4fc9be){return _0x4fc9be?{'count':_0xf6e105,'rows':_0x4fc9be}:null;}})[_0x7d51('0x23')](respondWithResult(_0x5a4e37,null))[_0x7d51('0x40')](handleError(_0x5a4e37,null));};exports[_0x7d51('0x4a')]=function(_0x58c519,_0x1f1aa8,_0x3a7743){var _0x21dfd5={};var _0x207d6e={};var _0x11f4eb;var _0x2104cd;return db[_0x7d51('0x29')]['findOne']({'where':{'id':_0x58c519['params']['id']}})[_0x7d51('0x23')](handleEntityNotFound(_0x1f1aa8,null))[_0x7d51('0x23')](function(_0x10a935){if(_0x10a935){_0x11f4eb=_0x10a935;_0x207d6e[_0x7d51('0x2e')]=_[_0x7d51('0x31')](db[_0x7d51('0x48')][_0x7d51('0x2a')]);_0x207d6e['query']=_[_0x7d51('0x31')](_0x58c519[_0x7d51('0x30')]);_0x207d6e[_0x7d51('0x32')]=_['intersection'](_0x207d6e[_0x7d51('0x2e')],_0x207d6e[_0x7d51('0x30')]);_0x21dfd5[_0x7d51('0x35')]=_[_0x7d51('0x33')](_0x207d6e[_0x7d51('0x2e')],qs[_0x7d51('0x34')](_0x58c519[_0x7d51('0x30')][_0x7d51('0x34')]));_0x21dfd5[_0x7d51('0x35')]=_0x21dfd5[_0x7d51('0x35')]['length']?_0x21dfd5[_0x7d51('0x35')]:_0x207d6e[_0x7d51('0x2e')];_0x21dfd5[_0x7d51('0x38')]=qs[_0x7d51('0x39')](_0x58c519[_0x7d51('0x30')][_0x7d51('0x39')]);_0x21dfd5[_0x7d51('0x3d')]=qs[_0x7d51('0x32')](_['pick'](_0x58c519[_0x7d51('0x30')],_0x207d6e[_0x7d51('0x32')]));if(_0x58c519[_0x7d51('0x30')][_0x7d51('0x3b')]){_0x21dfd5[_0x7d51('0x3d')]=_['merge'](_0x21dfd5[_0x7d51('0x3d')],{'$or':_[_0x7d51('0x2f')](_0x21dfd5[_0x7d51('0x35')],function(_0x34de8f){var _0x4948e1={};_0x4948e1[_0x34de8f]={'$like':'%'+_0x58c519[_0x7d51('0x30')][_0x7d51('0x3b')]+'%'};return _0x4948e1;})});}_0x21dfd5=_['merge']({},_0x21dfd5,_0x58c519[_0x7d51('0x3f')]);return _0x11f4eb[_0x7d51('0x4a')](_0x21dfd5);}})['then'](function(_0x279597){if(_0x279597){_0x2104cd=_0x279597[_0x7d51('0x36')];if(!_0x58c519[_0x7d51('0x30')][_0x7d51('0x37')](_0x7d51('0x49'))){_0x21dfd5[_0x7d51('0x1a')]=qs['limit'](_0x58c519[_0x7d51('0x30')][_0x7d51('0x1a')]);_0x21dfd5['offset']=qs[_0x7d51('0x1c')](_0x58c519[_0x7d51('0x30')][_0x7d51('0x1c')]);}return _0x11f4eb[_0x7d51('0x4a')](_0x21dfd5);}})['then'](function(_0x926724){if(_0x926724){return _0x926724?{'count':_0x2104cd,'rows':_0x926724}:null;}})[_0x7d51('0x23')](respondWithResult(_0x1f1aa8,null))[_0x7d51('0x40')](handleError(_0x1f1aa8,null));};exports[_0x7d51('0x4b')]=function(_0x489265,_0x3aa11f,_0x45ef17){var _0x173de3={};var _0x387f96={};var _0x1af356;var _0x5e313f;return db['VtigerConfiguration'][_0x7d51('0x4c')]({'where':{'id':_0x489265[_0x7d51('0x46')]['id']}})[_0x7d51('0x23')](handleEntityNotFound(_0x3aa11f,null))[_0x7d51('0x23')](function(_0x2b422f){if(_0x2b422f){_0x1af356=_0x2b422f;_0x387f96[_0x7d51('0x2e')]=_[_0x7d51('0x31')](db[_0x7d51('0x48')][_0x7d51('0x2a')]);_0x387f96[_0x7d51('0x30')]=_['keys'](_0x489265[_0x7d51('0x30')]);_0x387f96['filters']=_[_0x7d51('0x33')](_0x387f96[_0x7d51('0x2e')],_0x387f96['query']);_0x173de3[_0x7d51('0x35')]=_[_0x7d51('0x33')](_0x387f96[_0x7d51('0x2e')],qs[_0x7d51('0x34')](_0x489265['query'][_0x7d51('0x34')]));_0x173de3[_0x7d51('0x35')]=_0x173de3[_0x7d51('0x35')][_0x7d51('0x36')]?_0x173de3[_0x7d51('0x35')]:_0x387f96[_0x7d51('0x2e')];_0x173de3[_0x7d51('0x38')]=qs[_0x7d51('0x39')](_0x489265[_0x7d51('0x30')][_0x7d51('0x39')]);_0x173de3[_0x7d51('0x3d')]=qs[_0x7d51('0x32')](_[_0x7d51('0x3a')](_0x489265[_0x7d51('0x30')],_0x387f96[_0x7d51('0x32')]));if(_0x489265[_0x7d51('0x30')][_0x7d51('0x3b')]){_0x173de3[_0x7d51('0x3d')]=_[_0x7d51('0x3c')](_0x173de3[_0x7d51('0x3d')],{'$or':_['map'](_0x173de3[_0x7d51('0x35')],function(_0x252df3){var _0x4ecab2={};_0x4ecab2[_0x252df3]={'$like':'%'+_0x489265[_0x7d51('0x30')][_0x7d51('0x3b')]+'%'};return _0x4ecab2;})});}_0x173de3=_[_0x7d51('0x3c')]({},_0x173de3,_0x489265['options']);return _0x1af356[_0x7d51('0x4b')](_0x173de3);}})[_0x7d51('0x23')](function(_0x567465){if(_0x567465){_0x5e313f=_0x567465[_0x7d51('0x36')];if(!_0x489265[_0x7d51('0x30')][_0x7d51('0x37')](_0x7d51('0x49'))){_0x173de3[_0x7d51('0x1a')]=qs['limit'](_0x489265[_0x7d51('0x30')][_0x7d51('0x1a')]);_0x173de3[_0x7d51('0x1c')]=qs['offset'](_0x489265[_0x7d51('0x30')][_0x7d51('0x1c')]);}return _0x1af356[_0x7d51('0x4b')](_0x173de3);}})[_0x7d51('0x23')](function(_0x180663){if(_0x180663){return _0x180663?{'count':_0x5e313f,'rows':_0x180663}:null;}})['then'](respondWithResult(_0x3aa11f,null))[_0x7d51('0x40')](handleError(_0x3aa11f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 506f4fd..551b642 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 _0x2358=['../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x257268,_0x1d0221){var _0x4812bf=function(_0x4d7ea6){while(--_0x4d7ea6){_0x257268['push'](_0x257268['shift']());}};_0x4812bf(++_0x1d0221);}(_0x2358,0x147));var _0x8235=function(_0x4d682b,_0x2080b5){_0x4d682b=_0x4d682b-0x0;var _0x417378=_0x2358[_0x4d682b];return _0x417378;};'use strict';var _=require(_0x8235('0x0'));var util=require(_0x8235('0x1'));var logger=require(_0x8235('0x2'))(_0x8235('0x3'));var moment=require(_0x8235('0x4'));var BPromise=require(_0x8235('0x5'));var rp=require(_0x8235('0x6'));var fs=require('fs');var path=require(_0x8235('0x7'));var rimraf=require(_0x8235('0x8'));var config=require(_0x8235('0x9'));var attributes=require(_0x8235('0xa'));module[_0x8235('0xb')]=function(_0x459f94,_0x197c01){return _0x459f94['define'](_0x8235('0xc'),attributes,{'tableName':_0x8235('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7ac=['rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4431f1,_0x49a36e){var _0x3acd06=function(_0x182872){while(--_0x182872){_0x4431f1['push'](_0x4431f1['shift']());}};_0x3acd06(++_0x49a36e);}(_0xf7ac,0xbd));var _0xcf7a=function(_0x45bee0,_0x42bf09){_0x45bee0=_0x45bee0-0x0;var _0x1fcfd5=_0xf7ac[_0x45bee0];return _0x1fcfd5;};'use strict';var _=require(_0xcf7a('0x0'));var util=require(_0xcf7a('0x1'));var logger=require(_0xcf7a('0x2'))(_0xcf7a('0x3'));var moment=require('moment');var BPromise=require(_0xcf7a('0x4'));var rp=require(_0xcf7a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf7a('0x6'));var config=require(_0xcf7a('0x7'));var attributes=require(_0xcf7a('0x8'));module[_0xcf7a('0x9')]=function(_0xfba968,_0x162f0b){return _0xfba968[_0xcf7a('0xa')](_0xcf7a('0xb'),attributes,{'tableName':_0xcf7a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 1f06758..a8cf997 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 _0x42cc=['request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x42cc,0x1d4));var _0xc42c=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x42cc[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0xc42c('0x0'));var util=require(_0xc42c('0x1'));var moment=require(_0xc42c('0x2'));var BPromise=require(_0xc42c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc42c('0x4'));var db=require(_0xc42c('0x5'))['db'];var utils=require(_0xc42c('0x6'));var logger=require(_0xc42c('0x7'))(_0xc42c('0x8'));var config=require(_0xc42c('0x9'));var jayson=require(_0xc42c('0xa'));var client=jayson[_0xc42c('0xb')][_0xc42c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3bc7eb,_0x51c376,_0x1d2297){return new BPromise(function(_0x4e468b,_0x4481f1){return client['request'](_0x3bc7eb,_0x1d2297)['then'](function(_0x5659d1){logger[_0xc42c('0xd')](_0xc42c('0xe'),_0x51c376,_0xc42c('0xf'));logger[_0xc42c('0x10')](_0xc42c('0x11'),_0x51c376,'request\x20sent',JSON['stringify'](_0x5659d1));if(_0x5659d1[_0xc42c('0x12')]){if(_0x5659d1[_0xc42c('0x12')][_0xc42c('0x13')]===0x1f4){logger[_0xc42c('0x12')](_0xc42c('0xe'),_0x51c376,_0x5659d1[_0xc42c('0x12')][_0xc42c('0x14')]);return _0x4481f1(_0x5659d1[_0xc42c('0x12')][_0xc42c('0x14')]);}logger[_0xc42c('0x12')](_0xc42c('0xe'),_0x51c376,_0x5659d1['error'][_0xc42c('0x14')]);return _0x4e468b(_0x5659d1[_0xc42c('0x12')][_0xc42c('0x14')]);}else{logger[_0xc42c('0xd')](_0xc42c('0xe'),_0x51c376,'request\x20sent');_0x4e468b(_0x5659d1[_0xc42c('0x15')][_0xc42c('0x14')]);}})[_0xc42c('0x16')](function(_0x83cc64){logger['error'](_0xc42c('0xe'),_0x51c376,_0x83cc64);_0x4481f1(_0x83cc64);});});} \ No newline at end of file +var _0xe890=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','catch','lodash','moment','randomstring'];(function(_0x4a158c,_0x1828d3){var _0x17d061=function(_0x7e1fd3){while(--_0x7e1fd3){_0x4a158c['push'](_0x4a158c['shift']());}};_0x17d061(++_0x1828d3);}(_0xe890,0x1b2));var _0x0e89=function(_0x25c047,_0x3c93f3){_0x25c047=_0x25c047-0x0;var _0x5f222a=_0xe890[_0x25c047];return _0x5f222a;};'use strict';var _=require(_0x0e89('0x0'));var util=require('util');var moment=require(_0x0e89('0x1'));var BPromise=require('bluebird');var rs=require(_0x0e89('0x2'));var fs=require('fs');var Redis=require(_0x0e89('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e89('0x4'));var logger=require(_0x0e89('0x5'))(_0x0e89('0x6'));var config=require(_0x0e89('0x7'));var jayson=require(_0x0e89('0x8'));var client=jayson[_0x0e89('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b3107,_0x4299d4,_0x2eb0ef){return new BPromise(function(_0x1a6d69,_0x498c79){return client[_0x0e89('0xa')](_0x5b3107,_0x2eb0ef)['then'](function(_0x192970){logger[_0x0e89('0xb')](_0x0e89('0xc'),_0x4299d4,_0x0e89('0xd'));logger['debug'](_0x0e89('0xe'),_0x4299d4,_0x0e89('0xd'),JSON['stringify'](_0x192970));if(_0x192970['error']){if(_0x192970['error'][_0x0e89('0xf')]===0x1f4){logger[_0x0e89('0x10')](_0x0e89('0xc'),_0x4299d4,_0x192970[_0x0e89('0x10')][_0x0e89('0x11')]);return _0x498c79(_0x192970[_0x0e89('0x10')]['message']);}logger[_0x0e89('0x10')](_0x0e89('0xc'),_0x4299d4,_0x192970[_0x0e89('0x10')]['message']);return _0x1a6d69(_0x192970[_0x0e89('0x10')][_0x0e89('0x11')]);}else{logger[_0x0e89('0xb')](_0x0e89('0xc'),_0x4299d4,_0x0e89('0xd'));_0x1a6d69(_0x192970['result'][_0x0e89('0x11')]);}})[_0x0e89('0x12')](function(_0x8baf2){logger[_0x0e89('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x4299d4,_0x8baf2);_0x498c79(_0x8baf2);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index be69fd3..046a7b0 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 _0xa202=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x2558b5,_0x4b99e9){var _0xe8e9fa=function(_0x2580b8){while(--_0x2580b8){_0x2558b5['push'](_0x2558b5['shift']());}};_0xe8e9fa(++_0x4b99e9);}(_0xa202,0x90));var _0x2a20=function(_0x33e307,_0x11c495){_0x33e307=_0x33e307-0x0;var _0x2b3ea9=_0xa202[_0x33e307];return _0x2b3ea9;};'use strict';var multer=require(_0x2a20('0x0'));var util=require(_0x2a20('0x1'));var path=require(_0x2a20('0x2'));var timeout=require(_0x2a20('0x3'));var express=require(_0x2a20('0x4'));var router=express[_0x2a20('0x5')]();var fs_extra=require(_0x2a20('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2a20('0x7'));var config=require('../../config/environment');var controller=require(_0x2a20('0x8'));router[_0x2a20('0x9')]('/',auth[_0x2a20('0xa')](),controller[_0x2a20('0xb')]);router[_0x2a20('0x9')](_0x2a20('0xc'),auth[_0x2a20('0xa')](),controller[_0x2a20('0xd')]);router[_0x2a20('0xe')]('/',auth['isAuthenticated'](),controller[_0x2a20('0xf')]);router[_0x2a20('0x10')](_0x2a20('0xc'),auth[_0x2a20('0xa')](),controller['update']);router[_0x2a20('0x11')](_0x2a20('0xc'),auth[_0x2a20('0xa')](),controller[_0x2a20('0x12')]);module[_0x2a20('0x13')]=router; \ No newline at end of file +var _0x092d=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x18931a,_0x59ba22){var _0x22b35d=function(_0x28b627){while(--_0x28b627){_0x18931a['push'](_0x18931a['shift']());}};_0x22b35d(++_0x59ba22);}(_0x092d,0xe4));var _0xd092=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0x092d[_0x2053ea];return _0x2232c4;};'use strict';var multer=require(_0xd092('0x0'));var util=require(_0xd092('0x1'));var path=require(_0xd092('0x2'));var timeout=require(_0xd092('0x3'));var express=require('express');var router=express[_0xd092('0x4')]();var fs_extra=require(_0xd092('0x5'));var auth=require(_0xd092('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd092('0x7'));var controller=require(_0xd092('0x8'));router[_0xd092('0x9')]('/',auth['isAuthenticated'](),controller[_0xd092('0xa')]);router[_0xd092('0x9')]('/:id',auth[_0xd092('0xb')](),controller[_0xd092('0xc')]);router[_0xd092('0xd')]('/',auth[_0xd092('0xb')](),controller[_0xd092('0xe')]);router[_0xd092('0xf')](_0xd092('0x10'),auth[_0xd092('0xb')](),controller[_0xd092('0x11')]);router[_0xd092('0x12')](_0xd092('0x10'),auth[_0xd092('0xb')](),controller[_0xd092('0x13')]);module[_0xd092('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 73647e2..11e18ff 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 _0x1884=['string','customVariable','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x491389,_0x1d769f){var _0x1adb39=function(_0x50b4b2){while(--_0x50b4b2){_0x491389['push'](_0x491389['shift']());}};_0x1adb39(++_0x1d769f);}(_0x1884,0x165));var _0x4188=function(_0x435e61,_0x1cccef){_0x435e61=_0x435e61-0x0;var _0x1cfb71=_0x1884[_0x435e61];return _0x1cfb71;};'use strict';var Sequelize=require(_0x4188('0x0'));module[_0x4188('0x1')]={'type':{'type':Sequelize[_0x4188('0x2')](_0x4188('0x3'),'variable',_0x4188('0x4'),'keyValue','picklist'),'defaultValue':_0x4188('0x3')},'content':{'type':Sequelize[_0x4188('0x5')]},'key':{'type':Sequelize[_0x4188('0x5')]},'keyType':{'type':Sequelize[_0x4188('0x2')](_0x4188('0x3'),_0x4188('0x6'),_0x4188('0x4'))},'keyContent':{'type':Sequelize[_0x4188('0x5')]},'idField':{'type':Sequelize[_0x4188('0x5')]},'nameField':{'type':Sequelize[_0x4188('0x5')]},'customField':{'type':Sequelize[_0x4188('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0c82=['sequelize','variable','keyValue','string','STRING','ENUM','customVariable','BOOLEAN'];(function(_0x352580,_0x40db47){var _0x459385=function(_0x40b0ef){while(--_0x40b0ef){_0x352580['push'](_0x352580['shift']());}};_0x459385(++_0x40db47);}(_0x0c82,0x90));var _0x20c8=function(_0x35c86f,_0x399bc4){_0x35c86f=_0x35c86f-0x0;var _0x28c841=_0x0c82[_0x35c86f];return _0x28c841;};'use strict';var Sequelize=require(_0x20c8('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x20c8('0x1'),'customVariable',_0x20c8('0x2'),'picklist'),'defaultValue':_0x20c8('0x3')},'content':{'type':Sequelize[_0x20c8('0x4')]},'key':{'type':Sequelize[_0x20c8('0x4')]},'keyType':{'type':Sequelize[_0x20c8('0x5')](_0x20c8('0x3'),_0x20c8('0x1'),_0x20c8('0x6'))},'keyContent':{'type':Sequelize[_0x20c8('0x4')]},'idField':{'type':Sequelize[_0x20c8('0x4')]},'nameField':{'type':Sequelize[_0x20c8('0x4')]},'customField':{'type':Sequelize[_0x20c8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x20c8('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 24570ff..b001bfb 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 _0xddaa=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','nolimit','order','where','pick','filters','filter','merge','VIRTUAL','name','options','VtigerField','includeAll','include','rows','catch','show','find','create','body','params','eml-format'];(function(_0x90b03b,_0xf9194f){var _0x391bff=function(_0xcdc247){while(--_0xcdc247){_0x90b03b['push'](_0x90b03b['shift']());}};_0x391bff(++_0xf9194f);}(_0xddaa,0x1bb));var _0xadda=function(_0x12bff9,_0x1cdf47){_0x12bff9=_0x12bff9-0x0;var _0x3f31ba=_0xddaa[_0x12bff9];return _0x3f31ba;};'use strict';var emlformat=require(_0xadda('0x0'));var rimraf=require(_0xadda('0x1'));var zipdir=require(_0xadda('0x2'));var jsonpatch=require(_0xadda('0x3'));var rp=require('request-promise');var moment=require(_0xadda('0x4'));var BPromise=require(_0xadda('0x5'));var Mustache=require(_0xadda('0x6'));var util=require(_0xadda('0x7'));var path=require(_0xadda('0x8'));var sox=require('sox');var csv=require(_0xadda('0x9'));var ejs=require(_0xadda('0xa'));var fs=require('fs');var fs_extra=require(_0xadda('0xb'));var _=require(_0xadda('0xc'));var squel=require(_0xadda('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xadda('0xe'));var toCsv=require(_0xadda('0x9'));var querystring=require(_0xadda('0xf'));var Papa=require('papaparse');var Redis=require(_0xadda('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xadda('0x11'));var as=require(_0xadda('0x12'));var hardwareService=require(_0xadda('0x13'));var logger=require(_0xadda('0x14'))(_0xadda('0x15'));var utils=require(_0xadda('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xadda('0x17'));var db=require(_0xadda('0x18'))['db'];function respondWithStatusCode(_0x15a26d,_0x1a6de5){_0x1a6de5=_0x1a6de5||0xcc;return function(_0x34d7ad){if(_0x34d7ad){return _0x15a26d[_0xadda('0x19')](_0x1a6de5);}return _0x15a26d[_0xadda('0x1a')](_0x1a6de5)[_0xadda('0x1b')]();};}function respondWithResult(_0xfb4e75,_0x1cfe6c){_0x1cfe6c=_0x1cfe6c||0xc8;return function(_0xdbe2c7){if(_0xdbe2c7){return _0xfb4e75[_0xadda('0x1a')](_0x1cfe6c)['json'](_0xdbe2c7);}};}function respondWithFilteredResult(_0x341bb2,_0x4f1278){return function(_0x301da4){if(_0x301da4){var _0x27f210=typeof _0x4f1278[_0xadda('0x1c')]==='undefined'&&typeof _0x4f1278[_0xadda('0x1d')]===_0xadda('0x1e');var _0x5b49c9=_0x301da4[_0xadda('0x1f')];var _0x562c21=_0x27f210?0x0:_0x4f1278[_0xadda('0x1c')];var _0x93cc86=_0x27f210?_0x301da4['count']:_0x4f1278[_0xadda('0x1c')]+_0x4f1278[_0xadda('0x1d')];var _0x3d4421;if(_0x93cc86>=_0x5b49c9){_0x93cc86=_0x5b49c9;_0x3d4421=0xc8;}else{_0x3d4421=0xce;}_0x341bb2[_0xadda('0x1a')](_0x3d4421);return _0x341bb2[_0xadda('0x20')](_0xadda('0x21'),_0x562c21+'-'+_0x93cc86+'/'+_0x5b49c9)[_0xadda('0x22')](_0x301da4);}return null;};}function patchUpdates(_0x38cf6c){return function(_0x412a0e){try{jsonpatch[_0xadda('0x23')](_0x412a0e,_0x38cf6c,!![]);}catch(_0x542eae){return BPromise['reject'](_0x542eae);}return _0x412a0e[_0xadda('0x24')]();};}function saveUpdates(_0x243c8c,_0x87a209){return function(_0x28ca0f){if(_0x28ca0f){return _0x28ca0f[_0xadda('0x25')](_0x243c8c)[_0xadda('0x26')](function(_0x521053){return _0x521053;});}return null;};}function removeEntity(_0x5b08f7,_0x467cec){return function(_0x53aa9e){if(_0x53aa9e){return _0x53aa9e[_0xadda('0x27')]()[_0xadda('0x26')](function(){_0x5b08f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x293106,_0x555fd2){return function(_0x26a500){if(!_0x26a500){_0x293106['sendStatus'](0x194);}return _0x26a500;};}function handleError(_0x235b5e,_0x5cc8b9){_0x5cc8b9=_0x5cc8b9||0x1f4;return function(_0x52b4cf){logger['error'](_0x52b4cf['stack']);if(_0x52b4cf['name']){delete _0x52b4cf['name'];}_0x235b5e[_0xadda('0x1a')](_0x5cc8b9)[_0xadda('0x28')](_0x52b4cf);};}exports[_0xadda('0x29')]=function(_0x1be811,_0x329c26){var _0x46e90f={},_0x5a0747={},_0x6fee12={'count':0x0,'rows':[]};var _0x5f4673=_[_0xadda('0x2a')](db['VtigerField'][_0xadda('0x2b')],function(_0x1004a1){return{'name':_0x1004a1[_0xadda('0x2c')],'type':_0x1004a1[_0xadda('0x2d')][_0xadda('0x2e')]};});_0x5a0747['model']=_['map'](_0x5f4673,'name');_0x5a0747[_0xadda('0x2f')]=_[_0xadda('0x30')](_0x1be811[_0xadda('0x2f')]);_0x5a0747['filters']=_[_0xadda('0x31')](_0x5a0747['model'],_0x5a0747[_0xadda('0x2f')]);_0x46e90f[_0xadda('0x32')]=_[_0xadda('0x31')](_0x5a0747[_0xadda('0x33')],qs[_0xadda('0x34')](_0x1be811[_0xadda('0x2f')][_0xadda('0x34')]));_0x46e90f[_0xadda('0x32')]=_0x46e90f[_0xadda('0x32')][_0xadda('0x35')]?_0x46e90f[_0xadda('0x32')]:_0x5a0747[_0xadda('0x33')];if(!_0x1be811[_0xadda('0x2f')]['hasOwnProperty'](_0xadda('0x36'))){_0x46e90f['limit']=qs[_0xadda('0x1d')](_0x1be811[_0xadda('0x2f')]['limit']);_0x46e90f[_0xadda('0x1c')]=qs[_0xadda('0x1c')](_0x1be811[_0xadda('0x2f')][_0xadda('0x1c')]);}_0x46e90f[_0xadda('0x37')]=qs['sort'](_0x1be811[_0xadda('0x2f')]['sort']);_0x46e90f[_0xadda('0x38')]=qs['filters'](_[_0xadda('0x39')](_0x1be811[_0xadda('0x2f')],_0x5a0747[_0xadda('0x3a')]),_0x5f4673);if(_0x1be811[_0xadda('0x2f')][_0xadda('0x3b')]){_0x46e90f[_0xadda('0x38')]=_[_0xadda('0x3c')](_0x46e90f[_0xadda('0x38')],{'$or':_[_0xadda('0x2a')](_0x5f4673,function(_0x2d17e6){if(_0x2d17e6['type']!==_0xadda('0x3d')){var _0x23035f={};_0x23035f[_0x2d17e6[_0xadda('0x3e')]]={'$like':'%'+_0x1be811[_0xadda('0x2f')][_0xadda('0x3b')]+'%'};return _0x23035f;}})});}_0x46e90f=_[_0xadda('0x3c')]({},_0x46e90f,_0x1be811[_0xadda('0x3f')]);var _0x1437be={'where':_0x46e90f[_0xadda('0x38')]};return db[_0xadda('0x40')][_0xadda('0x1f')](_0x1437be)[_0xadda('0x26')](function(_0x4cd604){_0x6fee12[_0xadda('0x1f')]=_0x4cd604;if(_0x1be811['query'][_0xadda('0x41')]){_0x46e90f[_0xadda('0x42')]=[{'all':!![]}];}return db[_0xadda('0x40')]['findAll'](_0x46e90f);})[_0xadda('0x26')](function(_0xc2f1f2){_0x6fee12[_0xadda('0x43')]=_0xc2f1f2;return _0x6fee12;})[_0xadda('0x26')](respondWithFilteredResult(_0x329c26,_0x46e90f))[_0xadda('0x44')](handleError(_0x329c26,null));};exports[_0xadda('0x45')]=function(_0x1171ad,_0x131279){var _0x2fe876={'raw':!![],'where':{'id':_0x1171ad['params']['id']}},_0x24574c={};_0x24574c['model']=_[_0xadda('0x30')](db[_0xadda('0x40')][_0xadda('0x2b')]);_0x24574c[_0xadda('0x2f')]=_['keys'](_0x1171ad[_0xadda('0x2f')]);_0x24574c['filters']=_[_0xadda('0x31')](_0x24574c[_0xadda('0x33')],_0x24574c[_0xadda('0x2f')]);_0x2fe876['attributes']=_[_0xadda('0x31')](_0x24574c[_0xadda('0x33')],qs[_0xadda('0x34')](_0x1171ad[_0xadda('0x2f')][_0xadda('0x34')]));_0x2fe876[_0xadda('0x32')]=_0x2fe876[_0xadda('0x32')]['length']?_0x2fe876[_0xadda('0x32')]:_0x24574c[_0xadda('0x33')];if(_0x1171ad[_0xadda('0x2f')][_0xadda('0x41')]){_0x2fe876[_0xadda('0x42')]=[{'all':!![]}];}_0x2fe876=_[_0xadda('0x3c')]({},_0x2fe876,_0x1171ad['options']);return db[_0xadda('0x40')][_0xadda('0x46')](_0x2fe876)[_0xadda('0x26')](handleEntityNotFound(_0x131279,null))[_0xadda('0x26')](respondWithResult(_0x131279,null))[_0xadda('0x44')](handleError(_0x131279,null));};exports[_0xadda('0x47')]=function(_0x411236,_0x32457b){return db[_0xadda('0x40')][_0xadda('0x47')](_0x411236[_0xadda('0x48')],{})[_0xadda('0x26')](respondWithResult(_0x32457b,0xc9))[_0xadda('0x44')](handleError(_0x32457b,null));};exports['update']=function(_0x23a660,_0xd7d152){if(_0x23a660[_0xadda('0x48')]['id']){delete _0x23a660['body']['id'];}return db[_0xadda('0x40')][_0xadda('0x46')]({'where':{'id':_0x23a660[_0xadda('0x49')]['id']}})[_0xadda('0x26')](handleEntityNotFound(_0xd7d152,null))['then'](saveUpdates(_0x23a660[_0xadda('0x48')],null))[_0xadda('0x26')](respondWithResult(_0xd7d152,null))['catch'](handleError(_0xd7d152,null));};exports['destroy']=function(_0x30dd67,_0x4d7545){return db[_0xadda('0x40')][_0xadda('0x46')]({'where':{'id':_0x30dd67['params']['id']}})[_0xadda('0x26')](handleEntityNotFound(_0x4d7545,null))['then'](removeEntity(_0x4d7545,null))[_0xadda('0x44')](handleError(_0x4d7545,null));}; \ No newline at end of file +var _0x7d54=['query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','VtigerField','fieldName','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d54,0x140));var _0x47d5=function(_0x168057,_0x18fae0){_0x168057=_0x168057-0x0;var _0x470c2f=_0x7d54[_0x168057];return _0x470c2f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x47d5('0x0'));var zipdir=require(_0x47d5('0x1'));var jsonpatch=require(_0x47d5('0x2'));var rp=require(_0x47d5('0x3'));var moment=require(_0x47d5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47d5('0x5'));var util=require('util');var path=require(_0x47d5('0x6'));var sox=require('sox');var csv=require(_0x47d5('0x7'));var ejs=require(_0x47d5('0x8'));var fs=require('fs');var fs_extra=require(_0x47d5('0x9'));var _=require(_0x47d5('0xa'));var squel=require(_0x47d5('0xb'));var crypto=require('crypto');var jsforce=require(_0x47d5('0xc'));var deskjs=require(_0x47d5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x47d5('0xe'));var Papa=require(_0x47d5('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x47d5('0x10'));var as=require(_0x47d5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x47d5('0x12'))('api');var utils=require(_0x47d5('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x47d5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35acdf,_0xd77965){_0xd77965=_0xd77965||0xcc;return function(_0x2a1488){if(_0x2a1488){return _0x35acdf['sendStatus'](_0xd77965);}return _0x35acdf[_0x47d5('0x15')](_0xd77965)[_0x47d5('0x16')]();};}function respondWithResult(_0x2fdbc4,_0x3ce3ac){_0x3ce3ac=_0x3ce3ac||0xc8;return function(_0x2baff1){if(_0x2baff1){return _0x2fdbc4[_0x47d5('0x15')](_0x3ce3ac)[_0x47d5('0x17')](_0x2baff1);}};}function respondWithFilteredResult(_0x38ccd3,_0x374f69){return function(_0xdfeaae){if(_0xdfeaae){var _0x1d8563=typeof _0x374f69[_0x47d5('0x18')]==='undefined'&&typeof _0x374f69[_0x47d5('0x19')]===_0x47d5('0x1a');var _0x52432a=_0xdfeaae['count'];var _0x553011=_0x1d8563?0x0:_0x374f69[_0x47d5('0x18')];var _0x35d070=_0x1d8563?_0xdfeaae[_0x47d5('0x1b')]:_0x374f69['offset']+_0x374f69[_0x47d5('0x19')];var _0x5df08b;if(_0x35d070>=_0x52432a){_0x35d070=_0x52432a;_0x5df08b=0xc8;}else{_0x5df08b=0xce;}_0x38ccd3[_0x47d5('0x15')](_0x5df08b);return _0x38ccd3[_0x47d5('0x1c')](_0x47d5('0x1d'),_0x553011+'-'+_0x35d070+'/'+_0x52432a)[_0x47d5('0x17')](_0xdfeaae);}return null;};}function patchUpdates(_0x3223eb){return function(_0x2b6a37){try{jsonpatch[_0x47d5('0x1e')](_0x2b6a37,_0x3223eb,!![]);}catch(_0xf54b0c){return BPromise[_0x47d5('0x1f')](_0xf54b0c);}return _0x2b6a37[_0x47d5('0x20')]();};}function saveUpdates(_0x448ce7,_0x511bcd){return function(_0x52bf22){if(_0x52bf22){return _0x52bf22[_0x47d5('0x21')](_0x448ce7)[_0x47d5('0x22')](function(_0x352100){return _0x352100;});}return null;};}function removeEntity(_0x2f6090,_0xe680cd){return function(_0xa73384){if(_0xa73384){return _0xa73384[_0x47d5('0x23')]()['then'](function(){_0x2f6090[_0x47d5('0x15')](0xcc)[_0x47d5('0x16')]();});}};}function handleEntityNotFound(_0x4165ea,_0x335769){return function(_0x8909b0){if(!_0x8909b0){_0x4165ea[_0x47d5('0x24')](0x194);}return _0x8909b0;};}function handleError(_0x25cf8e,_0x217e38){_0x217e38=_0x217e38||0x1f4;return function(_0x16beba){logger[_0x47d5('0x25')](_0x16beba[_0x47d5('0x26')]);if(_0x16beba[_0x47d5('0x27')]){delete _0x16beba[_0x47d5('0x27')];}_0x25cf8e[_0x47d5('0x15')](_0x217e38)['send'](_0x16beba);};}exports[_0x47d5('0x28')]=function(_0x17ec75,_0x3a9042){var _0x3d9747={},_0x5e1c99={},_0x431d48={'count':0x0,'rows':[]};var _0xfea35e=_[_0x47d5('0x29')](db[_0x47d5('0x2a')]['rawAttributes'],function(_0x2cc86f){return{'name':_0x2cc86f[_0x47d5('0x2b')],'type':_0x2cc86f[_0x47d5('0x2c')]['key']};});_0x5e1c99['model']=_[_0x47d5('0x29')](_0xfea35e,_0x47d5('0x27'));_0x5e1c99[_0x47d5('0x2d')]=_[_0x47d5('0x2e')](_0x17ec75[_0x47d5('0x2d')]);_0x5e1c99[_0x47d5('0x2f')]=_[_0x47d5('0x30')](_0x5e1c99['model'],_0x5e1c99[_0x47d5('0x2d')]);_0x3d9747['attributes']=_[_0x47d5('0x30')](_0x5e1c99[_0x47d5('0x31')],qs[_0x47d5('0x32')](_0x17ec75['query'][_0x47d5('0x32')]));_0x3d9747[_0x47d5('0x33')]=_0x3d9747['attributes'][_0x47d5('0x34')]?_0x3d9747[_0x47d5('0x33')]:_0x5e1c99['model'];if(!_0x17ec75[_0x47d5('0x2d')][_0x47d5('0x35')](_0x47d5('0x36'))){_0x3d9747[_0x47d5('0x19')]=qs[_0x47d5('0x19')](_0x17ec75[_0x47d5('0x2d')]['limit']);_0x3d9747[_0x47d5('0x18')]=qs['offset'](_0x17ec75[_0x47d5('0x2d')][_0x47d5('0x18')]);}_0x3d9747[_0x47d5('0x37')]=qs[_0x47d5('0x38')](_0x17ec75[_0x47d5('0x2d')]['sort']);_0x3d9747[_0x47d5('0x39')]=qs[_0x47d5('0x2f')](_[_0x47d5('0x3a')](_0x17ec75[_0x47d5('0x2d')],_0x5e1c99[_0x47d5('0x2f')]),_0xfea35e);if(_0x17ec75['query']['filter']){_0x3d9747[_0x47d5('0x39')]=_[_0x47d5('0x3b')](_0x3d9747[_0x47d5('0x39')],{'$or':_[_0x47d5('0x29')](_0xfea35e,function(_0x585ad7){if(_0x585ad7[_0x47d5('0x2c')]!==_0x47d5('0x3c')){var _0x252853={};_0x252853[_0x585ad7['name']]={'$like':'%'+_0x17ec75[_0x47d5('0x2d')][_0x47d5('0x3d')]+'%'};return _0x252853;}})});}_0x3d9747=_['merge']({},_0x3d9747,_0x17ec75[_0x47d5('0x3e')]);var _0x66b1c9={'where':_0x3d9747[_0x47d5('0x39')]};return db[_0x47d5('0x2a')]['count'](_0x66b1c9)[_0x47d5('0x22')](function(_0x544e9b){_0x431d48['count']=_0x544e9b;if(_0x17ec75[_0x47d5('0x2d')][_0x47d5('0x3f')]){_0x3d9747[_0x47d5('0x40')]=[{'all':!![]}];}return db[_0x47d5('0x2a')]['findAll'](_0x3d9747);})[_0x47d5('0x22')](function(_0x1d2240){_0x431d48[_0x47d5('0x41')]=_0x1d2240;return _0x431d48;})[_0x47d5('0x22')](respondWithFilteredResult(_0x3a9042,_0x3d9747))[_0x47d5('0x42')](handleError(_0x3a9042,null));};exports[_0x47d5('0x43')]=function(_0x26596b,_0x1d162a){var _0x2455af={'raw':!![],'where':{'id':_0x26596b[_0x47d5('0x44')]['id']}},_0x28167a={};_0x28167a['model']=_[_0x47d5('0x2e')](db[_0x47d5('0x2a')][_0x47d5('0x45')]);_0x28167a['query']=_[_0x47d5('0x2e')](_0x26596b['query']);_0x28167a[_0x47d5('0x2f')]=_[_0x47d5('0x30')](_0x28167a[_0x47d5('0x31')],_0x28167a[_0x47d5('0x2d')]);_0x2455af[_0x47d5('0x33')]=_[_0x47d5('0x30')](_0x28167a['model'],qs['fields'](_0x26596b['query'][_0x47d5('0x32')]));_0x2455af[_0x47d5('0x33')]=_0x2455af[_0x47d5('0x33')][_0x47d5('0x34')]?_0x2455af[_0x47d5('0x33')]:_0x28167a[_0x47d5('0x31')];if(_0x26596b[_0x47d5('0x2d')][_0x47d5('0x3f')]){_0x2455af[_0x47d5('0x40')]=[{'all':!![]}];}_0x2455af=_[_0x47d5('0x3b')]({},_0x2455af,_0x26596b['options']);return db[_0x47d5('0x2a')][_0x47d5('0x46')](_0x2455af)[_0x47d5('0x22')](handleEntityNotFound(_0x1d162a,null))[_0x47d5('0x22')](respondWithResult(_0x1d162a,null))['catch'](handleError(_0x1d162a,null));};exports[_0x47d5('0x47')]=function(_0x5bd0d6,_0x934990){return db['VtigerField'][_0x47d5('0x47')](_0x5bd0d6[_0x47d5('0x48')],{})[_0x47d5('0x22')](respondWithResult(_0x934990,0xc9))[_0x47d5('0x42')](handleError(_0x934990,null));};exports[_0x47d5('0x21')]=function(_0x5792c7,_0x1577f5){if(_0x5792c7['body']['id']){delete _0x5792c7['body']['id'];}return db['VtigerField'][_0x47d5('0x46')]({'where':{'id':_0x5792c7[_0x47d5('0x44')]['id']}})[_0x47d5('0x22')](handleEntityNotFound(_0x1577f5,null))['then'](saveUpdates(_0x5792c7[_0x47d5('0x48')],null))[_0x47d5('0x22')](respondWithResult(_0x1577f5,null))['catch'](handleError(_0x1577f5,null));};exports[_0x47d5('0x23')]=function(_0x56ef28,_0x2288c6){return db[_0x47d5('0x2a')][_0x47d5('0x46')]({'where':{'id':_0x56ef28[_0x47d5('0x44')]['id']}})[_0x47d5('0x22')](handleEntityNotFound(_0x2288c6,null))[_0x47d5('0x22')](removeEntity(_0x2288c6,null))[_0x47d5('0x42')](handleError(_0x2288c6,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 170ac5e..cf32821 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 _0x4a0e=['request-promise','path','rimraf','./intVtigerField.attributes','exports','define','vtiger_unique_index','idField','util','../../config/logger','bluebird'];(function(_0x34e819,_0x54d493){var _0x5c7b51=function(_0x2c858d){while(--_0x2c858d){_0x34e819['push'](_0x34e819['shift']());}};_0x5c7b51(++_0x54d493);}(_0x4a0e,0x1aa));var _0xe4a0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4a0e[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xe4a0('0x0'));var logger=require(_0xe4a0('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe4a0('0x2'));var rp=require(_0xe4a0('0x3'));var fs=require('fs');var path=require(_0xe4a0('0x4'));var rimraf=require(_0xe4a0('0x5'));var config=require('../../config/environment');var attributes=require(_0xe4a0('0x6'));module[_0xe4a0('0x7')]=function(_0x589384,_0x6a89c6){return _0x589384[_0xe4a0('0x8')]('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xe4a0('0x9'),'fields':[_0xe4a0('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ab5=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','FieldId'];(function(_0x308f79,_0x121c42){var _0x71490e=function(_0x311a5f){while(--_0x311a5f){_0x308f79['push'](_0x308f79['shift']());}};_0x71490e(++_0x121c42);}(_0x7ab5,0x12c));var _0x57ab=function(_0x314118,_0x344b68){_0x314118=_0x314118-0x0;var _0x37c2fe=_0x7ab5[_0x314118];return _0x37c2fe;};'use strict';var _=require(_0x57ab('0x0'));var util=require(_0x57ab('0x1'));var logger=require(_0x57ab('0x2'))(_0x57ab('0x3'));var moment=require(_0x57ab('0x4'));var BPromise=require(_0x57ab('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x57ab('0x6'));var rimraf=require('rimraf');var config=require(_0x57ab('0x7'));var attributes=require(_0x57ab('0x8'));module[_0x57ab('0x9')]=function(_0x34881c,_0x5f2e0b){return _0x34881c[_0x57ab('0xa')](_0x57ab('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x57ab('0xc'),'fields':[_0x57ab('0xd'),_0x57ab('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 6e970a6..7bb3ea5 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 _0xc3a9=['http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x2f5590,_0x4720f9){var _0x458ef0=function(_0x73fab6){while(--_0x73fab6){_0x2f5590['push'](_0x2f5590['shift']());}};_0x458ef0(++_0x4720f9);}(_0xc3a9,0x6f));var _0x9c3a=function(_0x98e330,_0x77da3f){_0x98e330=_0x98e330-0x0;var _0x4ec0e6=_0xc3a9[_0x98e330];return _0x4ec0e6;};'use strict';var _=require('lodash');var util=require(_0x9c3a('0x0'));var moment=require('moment');var BPromise=require(_0x9c3a('0x1'));var rs=require(_0x9c3a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c3a('0x3'))['db'];var utils=require(_0x9c3a('0x4'));var logger=require(_0x9c3a('0x5'))('rpc');var config=require(_0x9c3a('0x6'));var jayson=require(_0x9c3a('0x7'));var client=jayson[_0x9c3a('0x8')][_0x9c3a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53c1b,_0x3909c8,_0x4d5da5){return new BPromise(function(_0x38215a,_0x298f4d){return client[_0x9c3a('0xa')](_0x53c1b,_0x4d5da5)['then'](function(_0x17bd36){logger[_0x9c3a('0xb')](_0x9c3a('0xc'),_0x3909c8,_0x9c3a('0xd'));logger['debug'](_0x9c3a('0xe'),_0x3909c8,_0x9c3a('0xd'),JSON[_0x9c3a('0xf')](_0x17bd36));if(_0x17bd36[_0x9c3a('0x10')]){if(_0x17bd36[_0x9c3a('0x10')][_0x9c3a('0x11')]===0x1f4){logger[_0x9c3a('0x10')](_0x9c3a('0xc'),_0x3909c8,_0x17bd36[_0x9c3a('0x10')][_0x9c3a('0x12')]);return _0x298f4d(_0x17bd36[_0x9c3a('0x10')][_0x9c3a('0x12')]);}logger[_0x9c3a('0x10')](_0x9c3a('0xc'),_0x3909c8,_0x17bd36[_0x9c3a('0x10')][_0x9c3a('0x12')]);return _0x38215a(_0x17bd36[_0x9c3a('0x10')][_0x9c3a('0x12')]);}else{logger[_0x9c3a('0xb')](_0x9c3a('0xc'),_0x3909c8,_0x9c3a('0xd'));_0x38215a(_0x17bd36[_0x9c3a('0x13')]['message']);}})['catch'](function(_0x12f590){logger[_0x9c3a('0x10')](_0x9c3a('0xc'),_0x3909c8,_0x12f590);_0x298f4d(_0x12f590);});});} \ No newline at end of file +var _0x3436=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x3436,0x1b6));var _0x6343=function(_0x69ec75,_0x878df4){_0x69ec75=_0x69ec75-0x0;var _0xdcec92=_0x3436[_0x69ec75];return _0xdcec92;};'use strict';var _=require(_0x6343('0x0'));var util=require(_0x6343('0x1'));var moment=require(_0x6343('0x2'));var BPromise=require(_0x6343('0x3'));var rs=require(_0x6343('0x4'));var fs=require('fs');var Redis=require(_0x6343('0x5'));var db=require(_0x6343('0x6'))['db'];var utils=require(_0x6343('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6343('0x8'));var jayson=require(_0x6343('0x9'));var client=jayson['client'][_0x6343('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16d117,_0x2f658e,_0x313ee5){return new BPromise(function(_0x1832bd,_0xf57b31){return client[_0x6343('0xb')](_0x16d117,_0x313ee5)[_0x6343('0xc')](function(_0x15ef6e){logger[_0x6343('0xd')](_0x6343('0xe'),_0x2f658e,_0x6343('0xf'));logger[_0x6343('0x10')](_0x6343('0x11'),_0x2f658e,_0x6343('0xf'),JSON[_0x6343('0x12')](_0x15ef6e));if(_0x15ef6e[_0x6343('0x13')]){if(_0x15ef6e[_0x6343('0x13')][_0x6343('0x14')]===0x1f4){logger[_0x6343('0x13')]('VtigerField,\x20%s,\x20%s',_0x2f658e,_0x15ef6e['error'][_0x6343('0x15')]);return _0xf57b31(_0x15ef6e[_0x6343('0x13')]['message']);}logger['error']('VtigerField,\x20%s,\x20%s',_0x2f658e,_0x15ef6e[_0x6343('0x13')][_0x6343('0x15')]);return _0x1832bd(_0x15ef6e[_0x6343('0x13')][_0x6343('0x15')]);}else{logger[_0x6343('0xd')](_0x6343('0xe'),_0x2f658e,_0x6343('0xf'));_0x1832bd(_0x15ef6e[_0x6343('0x16')][_0x6343('0x15')]);}})[_0x6343('0x17')](function(_0x50989e){logger[_0x6343('0x13')]('VtigerField,\x20%s,\x20%s',_0x2f658e,_0x50989e);_0xf57b31(_0x50989e);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 9b07407..e9e55f0 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 _0x543c=['../../config/environment','./intZendeskAccount.controller','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','get','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x52d8cc,_0x1ebea4){var _0x282858=function(_0x42a9fb){while(--_0x42a9fb){_0x52d8cc['push'](_0x52d8cc['shift']());}};_0x282858(++_0x1ebea4);}(_0x543c,0x10f));var _0xc543=function(_0x4828b1,_0x5c8cf3){_0x4828b1=_0x4828b1-0x0;var _0x1fec1b=_0x543c[_0x4828b1];return _0x1fec1b;};'use strict';var multer=require(_0xc543('0x0'));var util=require(_0xc543('0x1'));var path=require('path');var timeout=require(_0xc543('0x2'));var express=require(_0xc543('0x3'));var router=express['Router']();var fs_extra=require(_0xc543('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc543('0x5'));var controller=require(_0xc543('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc543('0x7')]);router['get'](_0xc543('0x8'),auth[_0xc543('0x9')](),controller['show']);router['get'](_0xc543('0xa'),auth[_0xc543('0x9')](),controller[_0xc543('0xb')]);router[_0xc543('0xc')](_0xc543('0xd'),auth[_0xc543('0x9')](),controller[_0xc543('0xe')]);router[_0xc543('0xf')]('/',auth[_0xc543('0x9')](),controller[_0xc543('0x10')]);router['post'](_0xc543('0xa'),auth[_0xc543('0x9')](),controller[_0xc543('0x11')]);router[_0xc543('0x12')]('/:id',auth[_0xc543('0x9')](),controller[_0xc543('0x13')]);router[_0xc543('0x14')]('/:id',auth[_0xc543('0x9')](),controller[_0xc543('0x15')]);module[_0xc543('0x16')]=router; \ No newline at end of file +var _0xe0a8=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','post','create','/:id/configurations','put','update','destroy','multer','path','connect-timeout','Router','fs-extra'];(function(_0xd167bb,_0x3d1cf8){var _0x1bb4c0=function(_0x4888c2){while(--_0x4888c2){_0xd167bb['push'](_0xd167bb['shift']());}};_0x1bb4c0(++_0x3d1cf8);}(_0xe0a8,0xc3));var _0x8e0a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe0a8[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x8e0a('0x0'));var util=require('util');var path=require(_0x8e0a('0x1'));var timeout=require(_0x8e0a('0x2'));var express=require('express');var router=express[_0x8e0a('0x3')]();var fs_extra=require(_0x8e0a('0x4'));var auth=require(_0x8e0a('0x5'));var interaction=require(_0x8e0a('0x6'));var config=require(_0x8e0a('0x7'));var controller=require('./intZendeskAccount.controller');router[_0x8e0a('0x8')]('/',auth[_0x8e0a('0x9')](),controller[_0x8e0a('0xa')]);router['get'](_0x8e0a('0xb'),auth[_0x8e0a('0x9')](),controller[_0x8e0a('0xc')]);router['get']('/:id/configurations',auth[_0x8e0a('0x9')](),controller['getConfigurations']);router[_0x8e0a('0x8')]('/:id/fields',auth[_0x8e0a('0x9')](),controller[_0x8e0a('0xd')]);router[_0x8e0a('0xe')]('/',auth['isAuthenticated'](),controller[_0x8e0a('0xf')]);router[_0x8e0a('0xe')](_0x8e0a('0x10'),auth[_0x8e0a('0x9')](),controller['addConfiguration']);router[_0x8e0a('0x11')](_0x8e0a('0xb'),auth[_0x8e0a('0x9')](),controller[_0x8e0a('0x12')]);router['delete'](_0x8e0a('0xb'),auth['isAuthenticated'](),controller[_0x8e0a('0x13')]);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 7b57a5e..5d89c4e 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 _0x8579=['password','token','ENUM','integrationTab','sequelize','exports','STRING','username'];(function(_0x28d524,_0x241638){var _0x296ae5=function(_0x38777c){while(--_0x38777c){_0x28d524['push'](_0x28d524['shift']());}};_0x296ae5(++_0x241638);}(_0x8579,0x16c));var _0x9857=function(_0x79b8f1,_0x33d97a){_0x79b8f1=_0x79b8f1-0x0;var _0x5c5e53=_0x8579[_0x79b8f1];return _0x5c5e53;};'use strict';var Sequelize=require(_0x9857('0x0'));module[_0x9857('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9857('0x2')]},'username':{'type':Sequelize[_0x9857('0x2')],'unique':_0x9857('0x3')},'password':{'type':Sequelize[_0x9857('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0x9857('0x4'),_0x9857('0x5')),'defaultValue':_0x9857('0x4')},'serverUrl':{'type':Sequelize[_0x9857('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9857('0x6')](_0x9857('0x7'),'newTab'),'defaultValue':_0x9857('0x7')}}; \ No newline at end of file +var _0x5353=['STRING','username','remoteUri','ENUM','password','integrationTab','newTab','sequelize'];(function(_0x411386,_0x269f32){var _0x3b7534=function(_0x34c03e){while(--_0x34c03e){_0x411386['push'](_0x411386['shift']());}};_0x3b7534(++_0x269f32);}(_0x5353,0x12f));var _0x3535=function(_0x33ae17,_0x5df19c){_0x33ae17=_0x33ae17-0x0;var _0x5878ee=_0x5353[_0x33ae17];return _0x5878ee;};'use strict';var Sequelize=require(_0x3535('0x0'));module['exports']={'name':{'type':Sequelize[_0x3535('0x1')]},'description':{'type':Sequelize[_0x3535('0x1')]},'username':{'type':Sequelize[_0x3535('0x1')],'unique':_0x3535('0x2')},'password':{'type':Sequelize[_0x3535('0x1')]},'token':{'type':Sequelize[_0x3535('0x1')]},'remoteUri':{'type':Sequelize[_0x3535('0x1')],'unique':_0x3535('0x3')},'authType':{'type':Sequelize[_0x3535('0x4')](_0x3535('0x5'),'token'),'defaultValue':_0x3535('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3535('0x4')](_0x3535('0x6'),_0x3535('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 714f48f..5cbdbef 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 _0x5ec6=['Sequelize','ValidationError','Unknown\x20authentication\x20type','description','remove','includes','title','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','body','findOne','ZendeskConfiguration','length','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','toString','base64','headers'];(function(_0x1e3ae4,_0x3de661){var _0x182588=function(_0x58978e){while(--_0x58978e){_0x1e3ae4['push'](_0x1e3ae4['shift']());}};_0x182588(++_0x3de661);}(_0x5ec6,0x7f));var _0x65ec=function(_0x5ec308,_0x240a6a){_0x5ec308=_0x5ec308-0x0;var _0x502a65=_0x5ec6[_0x5ec308];return _0x502a65;};'use strict';var emlformat=require(_0x65ec('0x0'));var rimraf=require(_0x65ec('0x1'));var zipdir=require(_0x65ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x65ec('0x3'));var moment=require('moment');var BPromise=require(_0x65ec('0x4'));var Mustache=require('mustache');var util=require(_0x65ec('0x5'));var path=require('path');var sox=require(_0x65ec('0x6'));var csv=require('to-csv');var ejs=require(_0x65ec('0x7'));var fs=require('fs');var fs_extra=require(_0x65ec('0x8'));var _=require('lodash');var squel=require(_0x65ec('0x9'));var crypto=require(_0x65ec('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x65ec('0xb'));var toCsv=require(_0x65ec('0xc'));var querystring=require(_0x65ec('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65ec('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x65ec('0xf'));var hardwareService=require(_0x65ec('0x10'));var logger=require('../../config/logger')(_0x65ec('0x11'));var utils=require(_0x65ec('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x65ec('0x13'));var db=require(_0x65ec('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3e52c8,_0x2af7d6){_0x2af7d6=_0x2af7d6||0xcc;return function(_0x411a7b){if(_0x411a7b){return _0x3e52c8[_0x65ec('0x15')](_0x2af7d6);}return _0x3e52c8[_0x65ec('0x16')](_0x2af7d6)[_0x65ec('0x17')]();};}function respondWithResult(_0x344724,_0x3edbfd){_0x3edbfd=_0x3edbfd||0xc8;return function(_0x58c81f){if(_0x58c81f){return _0x344724[_0x65ec('0x16')](_0x3edbfd)[_0x65ec('0x18')](_0x58c81f);}};}function respondWithFilteredResult(_0x35d06b,_0x4bbe88){return function(_0x5a0442){if(_0x5a0442){var _0x25cdd4=typeof _0x4bbe88[_0x65ec('0x19')]===_0x65ec('0x1a')&&typeof _0x4bbe88['limit']===_0x65ec('0x1a');var _0x286eac=_0x5a0442[_0x65ec('0x1b')];var _0xb4ed90=_0x25cdd4?0x0:_0x4bbe88[_0x65ec('0x19')];var _0xd81ed3=_0x25cdd4?_0x5a0442[_0x65ec('0x1b')]:_0x4bbe88[_0x65ec('0x19')]+_0x4bbe88[_0x65ec('0x1c')];var _0x441ad0;if(_0xd81ed3>=_0x286eac){_0xd81ed3=_0x286eac;_0x441ad0=0xc8;}else{_0x441ad0=0xce;}_0x35d06b[_0x65ec('0x16')](_0x441ad0);return _0x35d06b[_0x65ec('0x1d')](_0x65ec('0x1e'),_0xb4ed90+'-'+_0xd81ed3+'/'+_0x286eac)[_0x65ec('0x18')](_0x5a0442);}return null;};}function patchUpdates(_0x3804a4){return function(_0x1d538c){try{jsonpatch[_0x65ec('0x1f')](_0x1d538c,_0x3804a4,!![]);}catch(_0x130d4e){return BPromise[_0x65ec('0x20')](_0x130d4e);}return _0x1d538c['save']();};}function saveUpdates(_0x170703,_0x297fba){return function(_0x89e640){if(_0x89e640){return _0x89e640[_0x65ec('0x21')](_0x170703)[_0x65ec('0x22')](function(_0x163e55){return _0x163e55;});}return null;};}function removeEntity(_0x47288d,_0x58239f){return function(_0xf1ff97){if(_0xf1ff97){return _0xf1ff97[_0x65ec('0x23')]()[_0x65ec('0x22')](function(){_0x47288d[_0x65ec('0x16')](0xcc)[_0x65ec('0x17')]();});}};}function handleEntityNotFound(_0x156793,_0x21426b){return function(_0xf5adc7){if(!_0xf5adc7){_0x156793[_0x65ec('0x15')](0x194);}return _0xf5adc7;};}function handleError(_0x4c846b,_0x10baef){_0x10baef=_0x10baef||0x1f4;return function(_0x30f0cf){logger[_0x65ec('0x24')](_0x30f0cf[_0x65ec('0x25')]);if(_0x30f0cf['name']){delete _0x30f0cf[_0x65ec('0x26')];}_0x4c846b['status'](_0x10baef)[_0x65ec('0x27')](_0x30f0cf);};}exports[_0x65ec('0x28')]=function(_0x1d0b5c,_0x30366c){var _0x14431d={},_0x46d4c1={},_0x46bf66={'count':0x0,'rows':[]};var _0x39410f=_[_0x65ec('0x29')](db[_0x65ec('0x2a')][_0x65ec('0x2b')],function(_0x4b435c){return{'name':_0x4b435c['fieldName'],'type':_0x4b435c[_0x65ec('0x2c')]['key']};});_0x46d4c1[_0x65ec('0x2d')]=_[_0x65ec('0x29')](_0x39410f,'name');_0x46d4c1[_0x65ec('0x2e')]=_[_0x65ec('0x2f')](_0x1d0b5c[_0x65ec('0x2e')]);_0x46d4c1[_0x65ec('0x30')]=_['intersection'](_0x46d4c1[_0x65ec('0x2d')],_0x46d4c1[_0x65ec('0x2e')]);_0x14431d[_0x65ec('0x31')]=_[_0x65ec('0x32')](_0x46d4c1[_0x65ec('0x2d')],qs[_0x65ec('0x33')](_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x33')]));_0x14431d[_0x65ec('0x31')]=_0x14431d[_0x65ec('0x31')]['length']?_0x14431d[_0x65ec('0x31')]:_0x46d4c1[_0x65ec('0x2d')];if(!_0x1d0b5c['query'][_0x65ec('0x34')](_0x65ec('0x35'))){_0x14431d[_0x65ec('0x1c')]=qs[_0x65ec('0x1c')](_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x1c')]);_0x14431d[_0x65ec('0x19')]=qs['offset'](_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x19')]);}_0x14431d[_0x65ec('0x36')]=qs[_0x65ec('0x37')](_0x1d0b5c['query'][_0x65ec('0x37')]);_0x14431d[_0x65ec('0x38')]=qs[_0x65ec('0x30')](_[_0x65ec('0x39')](_0x1d0b5c['query'],_0x46d4c1['filters']),_0x39410f);if(_0x1d0b5c[_0x65ec('0x2e')]['filter']){_0x14431d[_0x65ec('0x38')]=_[_0x65ec('0x3a')](_0x14431d['where'],{'$or':_[_0x65ec('0x29')](_0x39410f,function(_0x1fbc2b){if(_0x1fbc2b[_0x65ec('0x2c')]!==_0x65ec('0x3b')){var _0x3cffbf={};_0x3cffbf[_0x1fbc2b[_0x65ec('0x26')]]={'$like':'%'+_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x3c')]+'%'};return _0x3cffbf;}})});}_0x14431d=_[_0x65ec('0x3a')]({},_0x14431d,_0x1d0b5c[_0x65ec('0x3d')]);var _0x3561ef={'where':_0x14431d['where']};return db[_0x65ec('0x2a')]['count'](_0x3561ef)[_0x65ec('0x22')](function(_0x278d43){_0x46bf66[_0x65ec('0x1b')]=_0x278d43;if(_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x3e')]){_0x14431d[_0x65ec('0x3f')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x65ec('0x40')](_0x14431d);})['then'](function(_0x5d8d57){_0x46bf66[_0x65ec('0x41')]=_0x5d8d57;return _0x46bf66;})[_0x65ec('0x22')](respondWithFilteredResult(_0x30366c,_0x14431d))[_0x65ec('0x42')](handleError(_0x30366c,null));};exports[_0x65ec('0x43')]=function(_0x1d475e,_0x524235){var _0x4843ca={'raw':![],'where':{'id':_0x1d475e[_0x65ec('0x44')]['id']}},_0x1aef6d={};_0x1aef6d[_0x65ec('0x2d')]=_[_0x65ec('0x2f')](db[_0x65ec('0x2a')]['rawAttributes']);_0x1aef6d['query']=_[_0x65ec('0x2f')](_0x1d475e[_0x65ec('0x2e')]);_0x1aef6d[_0x65ec('0x30')]=_[_0x65ec('0x32')](_0x1aef6d[_0x65ec('0x2d')],_0x1aef6d[_0x65ec('0x2e')]);_0x4843ca[_0x65ec('0x31')]=_['intersection'](_0x1aef6d[_0x65ec('0x2d')],qs[_0x65ec('0x33')](_0x1d475e[_0x65ec('0x2e')]['fields']));_0x4843ca[_0x65ec('0x31')]=_0x4843ca[_0x65ec('0x31')]['length']?_0x4843ca[_0x65ec('0x31')]:_0x1aef6d[_0x65ec('0x2d')];if(_0x1d475e[_0x65ec('0x2e')][_0x65ec('0x3e')]){_0x4843ca[_0x65ec('0x3f')]=[{'all':!![]}];}_0x4843ca=_['merge']({},_0x4843ca,_0x1d475e[_0x65ec('0x3d')]);return db[_0x65ec('0x2a')][_0x65ec('0x45')](_0x4843ca)[_0x65ec('0x22')](handleEntityNotFound(_0x524235,null))['then'](respondWithResult(_0x524235,null))[_0x65ec('0x42')](handleError(_0x524235,null));};exports['create']=function(_0x1ed0f9,_0x169890){return db[_0x65ec('0x2a')]['create'](_0x1ed0f9['body'],{})[_0x65ec('0x22')](respondWithResult(_0x169890,0xc9))[_0x65ec('0x42')](handleError(_0x169890,null));};exports[_0x65ec('0x21')]=function(_0x2111af,_0x1b3732){if(_0x2111af[_0x65ec('0x46')]['id']){delete _0x2111af[_0x65ec('0x46')]['id'];}return db[_0x65ec('0x2a')][_0x65ec('0x45')]({'where':{'id':_0x2111af[_0x65ec('0x44')]['id']}})[_0x65ec('0x22')](handleEntityNotFound(_0x1b3732,null))[_0x65ec('0x22')](saveUpdates(_0x2111af[_0x65ec('0x46')],null))[_0x65ec('0x22')](respondWithResult(_0x1b3732,null))[_0x65ec('0x42')](handleError(_0x1b3732,null));};exports[_0x65ec('0x23')]=function(_0x22c28c,_0x5eb6d3){return db[_0x65ec('0x2a')][_0x65ec('0x45')]({'where':{'id':_0x22c28c['params']['id']}})[_0x65ec('0x22')](handleEntityNotFound(_0x5eb6d3,null))[_0x65ec('0x22')](removeEntity(_0x5eb6d3,null))[_0x65ec('0x42')](handleError(_0x5eb6d3,null));};exports['getConfigurations']=function(_0x3eee1e,_0x2b2756,_0x27843b){var _0x50f1c3={};var _0xabb4e3={};var _0x5e5e48;var _0x4c9905;return db[_0x65ec('0x2a')][_0x65ec('0x47')]({'where':{'id':_0x3eee1e[_0x65ec('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b2756,null))[_0x65ec('0x22')](function(_0x28a686){if(_0x28a686){_0x5e5e48=_0x28a686;_0xabb4e3[_0x65ec('0x2d')]=_[_0x65ec('0x2f')](db[_0x65ec('0x48')][_0x65ec('0x2b')]);_0xabb4e3[_0x65ec('0x2e')]=_[_0x65ec('0x2f')](_0x3eee1e[_0x65ec('0x2e')]);_0xabb4e3['filters']=_['intersection'](_0xabb4e3[_0x65ec('0x2d')],_0xabb4e3['query']);_0x50f1c3[_0x65ec('0x31')]=_['intersection'](_0xabb4e3[_0x65ec('0x2d')],qs[_0x65ec('0x33')](_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x33')]));_0x50f1c3[_0x65ec('0x31')]=_0x50f1c3[_0x65ec('0x31')][_0x65ec('0x49')]?_0x50f1c3['attributes']:_0xabb4e3[_0x65ec('0x2d')];_0x50f1c3[_0x65ec('0x36')]=qs[_0x65ec('0x37')](_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x37')]);_0x50f1c3['where']=qs[_0x65ec('0x30')](_[_0x65ec('0x39')](_0x3eee1e[_0x65ec('0x2e')],_0xabb4e3[_0x65ec('0x30')]));if(_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x3c')]){_0x50f1c3[_0x65ec('0x38')]=_[_0x65ec('0x3a')](_0x50f1c3['where'],{'$or':_[_0x65ec('0x29')](_0x50f1c3[_0x65ec('0x31')],function(_0x12bb9b){var _0x233b9b={};_0x233b9b[_0x12bb9b]={'$like':'%'+_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x3c')]+'%'};return _0x233b9b;})});}_0x50f1c3=_[_0x65ec('0x3a')]({},_0x50f1c3,_0x3eee1e['options']);return _0x5e5e48['getConfigurations'](_0x50f1c3);}})[_0x65ec('0x22')](function(_0x56dd47){if(_0x56dd47){_0x4c9905=_0x56dd47[_0x65ec('0x49')];if(!_0x3eee1e[_0x65ec('0x2e')]['hasOwnProperty'](_0x65ec('0x35'))){_0x50f1c3[_0x65ec('0x1c')]=qs[_0x65ec('0x1c')](_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x1c')]);_0x50f1c3[_0x65ec('0x19')]=qs[_0x65ec('0x19')](_0x3eee1e['query']['offset']);}return _0x5e5e48[_0x65ec('0x4a')](_0x50f1c3);}})[_0x65ec('0x22')](function(_0xd14e5){if(_0xd14e5){return _0xd14e5?{'count':_0x4c9905,'rows':_0xd14e5}:null;}})['then'](respondWithResult(_0x2b2756,null))[_0x65ec('0x42')](handleError(_0x2b2756,null));};exports[_0x65ec('0x4b')]=function(_0x17059d,_0x3d761f,_0x21096d){if(_0x17059d[_0x65ec('0x46')]['id']){delete _0x17059d[_0x65ec('0x46')]['id'];}return db['ZendeskAccount'][_0x65ec('0x47')]({'where':{'id':_0x17059d[_0x65ec('0x44')]['id']}})[_0x65ec('0x22')](handleEntityNotFound(_0x3d761f,null))[_0x65ec('0x22')](function(_0x3da824){if(_0x3da824){_0x17059d[_0x65ec('0x46')][_0x65ec('0x4c')]=_0x3da824['id'];_0x17059d[_0x65ec('0x46')][_0x65ec('0x4d')]=integrations['getSubjects'](_0x17059d['body'][_0x65ec('0x4e')],_0x17059d['body']['type']);_0x17059d[_0x65ec('0x46')][_0x65ec('0x4f')]=integrations[_0x65ec('0x50')](_0x17059d['body']['channel'],_0x17059d[_0x65ec('0x46')]['type']);return db['ZendeskConfiguration']['create'](_0x17059d[_0x65ec('0x46')],{'include':[{'model':db['ZendeskField'],'as':_0x65ec('0x4d')},{'model':db[_0x65ec('0x51')],'as':_0x65ec('0x4f')}]});}return null;})['then'](respondWithResult(_0x3d761f,null))['catch'](handleError(_0x3d761f,null));};exports[_0x65ec('0x52')]=function(_0x54f1cb,_0x244d12,_0x1c2972){var _0xf78f6a='';return db[_0x65ec('0x2a')][_0x65ec('0x47')]({'where':{'id':_0x54f1cb[_0x65ec('0x44')]['id']},'attributes':['id',_0x65ec('0x53'),_0x65ec('0x54'),_0x65ec('0x55'),_0x65ec('0x56'),'remoteUri']})[_0x65ec('0x22')](handleEntityNotFound(_0x244d12,null))['then'](function(_0x46e454){if(_0x46e454){_0xf78f6a=_0x46e454[_0x65ec('0x57')];var _0x292f81=_0xf78f6a[_0x65ec('0x58')](-0x1);if(_0x292f81==='/'){_0xf78f6a=_0xf78f6a['substring'](0x0,_0xf78f6a[_0x65ec('0x59')](_0x292f81));}var _0x556c5e={'method':_0x65ec('0x5a'),'uri':util[_0x65ec('0x5b')](_0x65ec('0x5c'),_0xf78f6a,_0x65ec('0x5d')),'json':!![]};switch(_0x46e454['authType']){case'password':_0x556c5e['headers']={'Authorization':util[_0x65ec('0x5b')](_0x65ec('0x5e'),new Buffer(util[_0x65ec('0x5b')](_0x65ec('0x5f'),_0x46e454[_0x65ec('0x53')],_0x46e454[_0x65ec('0x54')]))[_0x65ec('0x60')](_0x65ec('0x61')))};break;case _0x65ec('0x55'):_0x556c5e[_0x65ec('0x62')]={'Authorization':util[_0x65ec('0x5b')](_0x65ec('0x5e'),new Buffer(util[_0x65ec('0x5b')]('%s/token:%s',_0x46e454[_0x65ec('0x53')],_0x46e454[_0x65ec('0x55')]))[_0x65ec('0x60')](_0x65ec('0x61')))};break;default:throw new db[(_0x65ec('0x63'))][(_0x65ec('0x64'))](_0x65ec('0x65'));}return rp(_0x556c5e);}})[_0x65ec('0x22')](function(_0x3b5640){if(_0x3b5640){var _0x26ac0e=['subject',_0x65ec('0x66'),'group','assignee'];_[_0x65ec('0x67')](_0x3b5640[_0x65ec('0x5d')],function(_0x272432){return _0x26ac0e[_0x65ec('0x68')](_0x272432[_0x65ec('0x2c')]);});return{'count':_0x3b5640[_0x65ec('0x5d')][_0x65ec('0x49')],'rows':_[_0x65ec('0x29')](_0x3b5640['ticket_fields'],function(_0x1f5fe7){return{'id':_0x1f5fe7['id'],'name':_0x1f5fe7['position']>0x7?_0x1f5fe7[_0x65ec('0x69')]:_0x1f5fe7[_0x65ec('0x2c')],'custom':_0x1f5fe7[_0x65ec('0x6a')]>0x7?!![]:![],'options':_0x1f5fe7['system_field_options']?_0x1f5fe7[_0x65ec('0x6b')]:_0x1f5fe7[_0x65ec('0x6c')]?_0x1f5fe7[_0x65ec('0x6c')]:[]};})};}})[_0x65ec('0x22')](respondWithResult(_0x244d12,null))[_0x65ec('0x42')](function(_0x77ebd2){var _0x1172f3=_0x54f1cb['query'][_0x65ec('0x6d')]?0x1f4:_0x77ebd2[_0x65ec('0x6e')]||0x1f4;logger[_0x65ec('0x24')](_0x65ec('0x6f'),'getFields',_0x1172f3,JSON['stringify'](_0x77ebd2));delete _0x77ebd2[_0x65ec('0x26')];if(_0x1172f3===0x191){_0x1172f3=0x190;}_0x244d12[_0x65ec('0x16')](_0x1172f3)[_0x65ec('0x27')](_0x54f1cb[_0x65ec('0x2e')][_0x65ec('0x6d')]?{'message':_0x65ec('0x70'),'statusCode':_0x77ebd2['statusCode']}:_0x77ebd2);});}; \ No newline at end of file +var _0x97c1=['crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','ZendeskAccount','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','findOne','params','ZendeskConfiguration','getConfigurations','addConfiguration','getSubjects','channel','getDescriptions','ZendeskField','Subjects','Descriptions','getFields','authType','remoteUri','slice','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','username','password','base64','token','%s/token:%s','toString','Sequelize','subject','description','group','assignee','remove','position','system_field_options','custom_field_options','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel'];(function(_0x30118d,_0x359098){var _0x3f756c=function(_0x6975b2){while(--_0x6975b2){_0x30118d['push'](_0x30118d['shift']());}};_0x3f756c(++_0x359098);}(_0x97c1,0xdf));var _0x197c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x97c1[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x197c('0x0'));var rimraf=require(_0x197c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x197c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x197c('0x3'));var Mustache=require(_0x197c('0x4'));var util=require(_0x197c('0x5'));var path=require(_0x197c('0x6'));var sox=require(_0x197c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x197c('0x8'));var _=require(_0x197c('0x9'));var squel=require(_0x197c('0xa'));var crypto=require(_0x197c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x197c('0xc'));var querystring=require('querystring');var Papa=require(_0x197c('0xd'));var Redis=require(_0x197c('0xe'));var authService=require(_0x197c('0xf'));var qs=require(_0x197c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x197c('0x11'));var logger=require(_0x197c('0x12'))(_0x197c('0x13'));var utils=require(_0x197c('0x14'));var config=require(_0x197c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x197c('0x16'))['db'];var integrations=require(_0x197c('0x17'));function respondWithStatusCode(_0x27e46f,_0x1adcfa){_0x1adcfa=_0x1adcfa||0xcc;return function(_0x567658){if(_0x567658){return _0x27e46f[_0x197c('0x18')](_0x1adcfa);}return _0x27e46f[_0x197c('0x19')](_0x1adcfa)[_0x197c('0x1a')]();};}function respondWithResult(_0xf735ce,_0x188ff2){_0x188ff2=_0x188ff2||0xc8;return function(_0x109af2){if(_0x109af2){return _0xf735ce['status'](_0x188ff2)['json'](_0x109af2);}};}function respondWithFilteredResult(_0x422dfa,_0x2bc612){return function(_0x2083d4){if(_0x2083d4){var _0x24901f=typeof _0x2bc612[_0x197c('0x1b')]===_0x197c('0x1c')&&typeof _0x2bc612[_0x197c('0x1d')]===_0x197c('0x1c');var _0x47f43b=_0x2083d4[_0x197c('0x1e')];var _0x47aaa9=_0x24901f?0x0:_0x2bc612['offset'];var _0x1725d9=_0x24901f?_0x2083d4[_0x197c('0x1e')]:_0x2bc612[_0x197c('0x1b')]+_0x2bc612[_0x197c('0x1d')];var _0x4a4994;if(_0x1725d9>=_0x47f43b){_0x1725d9=_0x47f43b;_0x4a4994=0xc8;}else{_0x4a4994=0xce;}_0x422dfa[_0x197c('0x19')](_0x4a4994);return _0x422dfa[_0x197c('0x1f')](_0x197c('0x20'),_0x47aaa9+'-'+_0x1725d9+'/'+_0x47f43b)['json'](_0x2083d4);}return null;};}function patchUpdates(_0x1adb43){return function(_0x27b3df){try{jsonpatch[_0x197c('0x21')](_0x27b3df,_0x1adb43,!![]);}catch(_0xf3aeda){return BPromise[_0x197c('0x22')](_0xf3aeda);}return _0x27b3df[_0x197c('0x23')]();};}function saveUpdates(_0x362bbf,_0x2092a0){return function(_0x8963fd){if(_0x8963fd){return _0x8963fd[_0x197c('0x24')](_0x362bbf)[_0x197c('0x25')](function(_0x177bc9){return _0x177bc9;});}return null;};}function removeEntity(_0x174942,_0x2a1310){return function(_0x37b040){if(_0x37b040){return _0x37b040[_0x197c('0x26')]()['then'](function(){_0x174942[_0x197c('0x19')](0xcc)[_0x197c('0x1a')]();});}};}function handleEntityNotFound(_0x2b6319,_0x499051){return function(_0x2c2952){if(!_0x2c2952){_0x2b6319[_0x197c('0x18')](0x194);}return _0x2c2952;};}function handleError(_0x4c3337,_0x5e7bc9){_0x5e7bc9=_0x5e7bc9||0x1f4;return function(_0x12b37b){logger['error'](_0x12b37b[_0x197c('0x27')]);if(_0x12b37b[_0x197c('0x28')]){delete _0x12b37b[_0x197c('0x28')];}_0x4c3337[_0x197c('0x19')](_0x5e7bc9)[_0x197c('0x29')](_0x12b37b);};}exports[_0x197c('0x2a')]=function(_0x2b6154,_0x215df1){var _0x4422d1={},_0x5df39e={},_0x50dea3={'count':0x0,'rows':[]};var _0x574274=_['map'](db[_0x197c('0x2b')]['rawAttributes'],function(_0x252cde){return{'name':_0x252cde[_0x197c('0x2c')],'type':_0x252cde['type'][_0x197c('0x2d')]};});_0x5df39e['model']=_[_0x197c('0x2e')](_0x574274,_0x197c('0x28'));_0x5df39e[_0x197c('0x2f')]=_[_0x197c('0x30')](_0x2b6154[_0x197c('0x2f')]);_0x5df39e[_0x197c('0x31')]=_[_0x197c('0x32')](_0x5df39e[_0x197c('0x33')],_0x5df39e[_0x197c('0x2f')]);_0x4422d1['attributes']=_['intersection'](_0x5df39e[_0x197c('0x33')],qs[_0x197c('0x34')](_0x2b6154[_0x197c('0x2f')][_0x197c('0x34')]));_0x4422d1[_0x197c('0x35')]=_0x4422d1[_0x197c('0x35')][_0x197c('0x36')]?_0x4422d1['attributes']:_0x5df39e['model'];if(!_0x2b6154[_0x197c('0x2f')][_0x197c('0x37')]('nolimit')){_0x4422d1['limit']=qs[_0x197c('0x1d')](_0x2b6154[_0x197c('0x2f')][_0x197c('0x1d')]);_0x4422d1[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x2b6154[_0x197c('0x2f')][_0x197c('0x1b')]);}_0x4422d1[_0x197c('0x38')]=qs[_0x197c('0x39')](_0x2b6154['query'][_0x197c('0x39')]);_0x4422d1[_0x197c('0x3a')]=qs[_0x197c('0x31')](_[_0x197c('0x3b')](_0x2b6154[_0x197c('0x2f')],_0x5df39e[_0x197c('0x31')]),_0x574274);if(_0x2b6154['query'][_0x197c('0x3c')]){_0x4422d1[_0x197c('0x3a')]=_[_0x197c('0x3d')](_0x4422d1['where'],{'$or':_[_0x197c('0x2e')](_0x574274,function(_0x34dabc){if(_0x34dabc[_0x197c('0x3e')]!==_0x197c('0x3f')){var _0x2970b4={};_0x2970b4[_0x34dabc[_0x197c('0x28')]]={'$like':'%'+_0x2b6154[_0x197c('0x2f')][_0x197c('0x3c')]+'%'};return _0x2970b4;}})});}_0x4422d1=_[_0x197c('0x3d')]({},_0x4422d1,_0x2b6154[_0x197c('0x40')]);var _0x4a12fc={'where':_0x4422d1[_0x197c('0x3a')]};return db[_0x197c('0x2b')]['count'](_0x4a12fc)['then'](function(_0xa57083){_0x50dea3[_0x197c('0x1e')]=_0xa57083;if(_0x2b6154[_0x197c('0x2f')][_0x197c('0x41')]){_0x4422d1[_0x197c('0x42')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x197c('0x43')](_0x4422d1);})[_0x197c('0x25')](function(_0x7ed02b){_0x50dea3[_0x197c('0x44')]=_0x7ed02b;return _0x50dea3;})[_0x197c('0x25')](respondWithFilteredResult(_0x215df1,_0x4422d1))['catch'](handleError(_0x215df1,null));};exports[_0x197c('0x45')]=function(_0x37bb94,_0x6d7bda){var _0x197b27={'raw':![],'where':{'id':_0x37bb94['params']['id']}},_0x2f3c4b={};_0x2f3c4b[_0x197c('0x33')]=_[_0x197c('0x30')](db[_0x197c('0x2b')][_0x197c('0x46')]);_0x2f3c4b[_0x197c('0x2f')]=_[_0x197c('0x30')](_0x37bb94[_0x197c('0x2f')]);_0x2f3c4b[_0x197c('0x31')]=_[_0x197c('0x32')](_0x2f3c4b[_0x197c('0x33')],_0x2f3c4b[_0x197c('0x2f')]);_0x197b27['attributes']=_['intersection'](_0x2f3c4b['model'],qs['fields'](_0x37bb94[_0x197c('0x2f')][_0x197c('0x34')]));_0x197b27['attributes']=_0x197b27[_0x197c('0x35')][_0x197c('0x36')]?_0x197b27['attributes']:_0x2f3c4b[_0x197c('0x33')];if(_0x37bb94[_0x197c('0x2f')]['includeAll']){_0x197b27[_0x197c('0x42')]=[{'all':!![]}];}_0x197b27=_[_0x197c('0x3d')]({},_0x197b27,_0x37bb94['options']);return db[_0x197c('0x2b')][_0x197c('0x47')](_0x197b27)[_0x197c('0x25')](handleEntityNotFound(_0x6d7bda,null))['then'](respondWithResult(_0x6d7bda,null))[_0x197c('0x48')](handleError(_0x6d7bda,null));};exports[_0x197c('0x49')]=function(_0x220909,_0x1a92d2){return db['ZendeskAccount'][_0x197c('0x49')](_0x220909[_0x197c('0x4a')],{})[_0x197c('0x25')](respondWithResult(_0x1a92d2,0xc9))['catch'](handleError(_0x1a92d2,null));};exports['update']=function(_0x3a5089,_0x332c75){if(_0x3a5089[_0x197c('0x4a')]['id']){delete _0x3a5089[_0x197c('0x4a')]['id'];}return db[_0x197c('0x2b')][_0x197c('0x47')]({'where':{'id':_0x3a5089['params']['id']}})[_0x197c('0x25')](handleEntityNotFound(_0x332c75,null))['then'](saveUpdates(_0x3a5089[_0x197c('0x4a')],null))[_0x197c('0x25')](respondWithResult(_0x332c75,null))[_0x197c('0x48')](handleError(_0x332c75,null));};exports[_0x197c('0x26')]=function(_0x34a211,_0x2ab21f){return db[_0x197c('0x2b')][_0x197c('0x47')]({'where':{'id':_0x34a211['params']['id']}})[_0x197c('0x25')](handleEntityNotFound(_0x2ab21f,null))[_0x197c('0x25')](removeEntity(_0x2ab21f,null))[_0x197c('0x48')](handleError(_0x2ab21f,null));};exports['getConfigurations']=function(_0x114ef5,_0x495c1d,_0x204592){var _0x1d2a5f={};var _0x1ec51a={};var _0x22a106;var _0x1d7cdd;return db[_0x197c('0x2b')][_0x197c('0x4b')]({'where':{'id':_0x114ef5[_0x197c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x495c1d,null))[_0x197c('0x25')](function(_0x3a9261){if(_0x3a9261){_0x22a106=_0x3a9261;_0x1ec51a[_0x197c('0x33')]=_['keys'](db[_0x197c('0x4d')][_0x197c('0x46')]);_0x1ec51a[_0x197c('0x2f')]=_[_0x197c('0x30')](_0x114ef5[_0x197c('0x2f')]);_0x1ec51a['filters']=_['intersection'](_0x1ec51a[_0x197c('0x33')],_0x1ec51a[_0x197c('0x2f')]);_0x1d2a5f[_0x197c('0x35')]=_[_0x197c('0x32')](_0x1ec51a[_0x197c('0x33')],qs['fields'](_0x114ef5['query'][_0x197c('0x34')]));_0x1d2a5f[_0x197c('0x35')]=_0x1d2a5f['attributes'][_0x197c('0x36')]?_0x1d2a5f[_0x197c('0x35')]:_0x1ec51a[_0x197c('0x33')];_0x1d2a5f[_0x197c('0x38')]=qs[_0x197c('0x39')](_0x114ef5[_0x197c('0x2f')]['sort']);_0x1d2a5f[_0x197c('0x3a')]=qs[_0x197c('0x31')](_['pick'](_0x114ef5['query'],_0x1ec51a[_0x197c('0x31')]));if(_0x114ef5['query'][_0x197c('0x3c')]){_0x1d2a5f[_0x197c('0x3a')]=_[_0x197c('0x3d')](_0x1d2a5f['where'],{'$or':_[_0x197c('0x2e')](_0x1d2a5f[_0x197c('0x35')],function(_0x5585de){var _0x2dcbca={};_0x2dcbca[_0x5585de]={'$like':'%'+_0x114ef5[_0x197c('0x2f')][_0x197c('0x3c')]+'%'};return _0x2dcbca;})});}_0x1d2a5f=_['merge']({},_0x1d2a5f,_0x114ef5[_0x197c('0x40')]);return _0x22a106[_0x197c('0x4e')](_0x1d2a5f);}})['then'](function(_0x570d76){if(_0x570d76){_0x1d7cdd=_0x570d76[_0x197c('0x36')];if(!_0x114ef5[_0x197c('0x2f')][_0x197c('0x37')]('nolimit')){_0x1d2a5f[_0x197c('0x1d')]=qs[_0x197c('0x1d')](_0x114ef5[_0x197c('0x2f')]['limit']);_0x1d2a5f[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x114ef5[_0x197c('0x2f')][_0x197c('0x1b')]);}return _0x22a106[_0x197c('0x4e')](_0x1d2a5f);}})[_0x197c('0x25')](function(_0x8d1f3f){if(_0x8d1f3f){return _0x8d1f3f?{'count':_0x1d7cdd,'rows':_0x8d1f3f}:null;}})[_0x197c('0x25')](respondWithResult(_0x495c1d,null))[_0x197c('0x48')](handleError(_0x495c1d,null));};exports[_0x197c('0x4f')]=function(_0x5ef485,_0x1f7ad0,_0x572649){if(_0x5ef485['body']['id']){delete _0x5ef485['body']['id'];}return db['ZendeskAccount'][_0x197c('0x4b')]({'where':{'id':_0x5ef485[_0x197c('0x4c')]['id']}})[_0x197c('0x25')](handleEntityNotFound(_0x1f7ad0,null))[_0x197c('0x25')](function(_0x55b744){if(_0x55b744){_0x5ef485[_0x197c('0x4a')]['AccountId']=_0x55b744['id'];_0x5ef485[_0x197c('0x4a')]['Subjects']=integrations[_0x197c('0x50')](_0x5ef485['body'][_0x197c('0x51')],_0x5ef485[_0x197c('0x4a')][_0x197c('0x3e')]);_0x5ef485[_0x197c('0x4a')]['Descriptions']=integrations[_0x197c('0x52')](_0x5ef485[_0x197c('0x4a')][_0x197c('0x51')],_0x5ef485['body'][_0x197c('0x3e')]);return db[_0x197c('0x4d')][_0x197c('0x49')](_0x5ef485[_0x197c('0x4a')],{'include':[{'model':db[_0x197c('0x53')],'as':_0x197c('0x54')},{'model':db[_0x197c('0x53')],'as':_0x197c('0x55')}]});}return null;})[_0x197c('0x25')](respondWithResult(_0x1f7ad0,null))[_0x197c('0x48')](handleError(_0x1f7ad0,null));};exports[_0x197c('0x56')]=function(_0x25d3c1,_0x43c0b2,_0x395fce){var _0x2b1c78='';return db[_0x197c('0x2b')][_0x197c('0x4b')]({'where':{'id':_0x25d3c1[_0x197c('0x4c')]['id']},'attributes':['id','username','password','token',_0x197c('0x57'),'remoteUri']})[_0x197c('0x25')](handleEntityNotFound(_0x43c0b2,null))['then'](function(_0x5a601c){if(_0x5a601c){_0x2b1c78=_0x5a601c[_0x197c('0x58')];var _0x2c9746=_0x2b1c78[_0x197c('0x59')](-0x1);if(_0x2c9746==='/'){_0x2b1c78=_0x2b1c78['substring'](0x0,_0x2b1c78[_0x197c('0x5a')](_0x2c9746));}var _0x238092={'method':'GET','uri':util[_0x197c('0x5b')](_0x197c('0x5c'),_0x2b1c78,_0x197c('0x5d')),'json':!![]};switch(_0x5a601c[_0x197c('0x57')]){case'password':_0x238092[_0x197c('0x5e')]={'Authorization':util['format'](_0x197c('0x5f'),new Buffer(util['format'](_0x197c('0x60'),_0x5a601c[_0x197c('0x61')],_0x5a601c[_0x197c('0x62')]))['toString'](_0x197c('0x63')))};break;case _0x197c('0x64'):_0x238092[_0x197c('0x5e')]={'Authorization':util['format'](_0x197c('0x5f'),new Buffer(util[_0x197c('0x5b')](_0x197c('0x65'),_0x5a601c[_0x197c('0x61')],_0x5a601c[_0x197c('0x64')]))[_0x197c('0x66')]('base64'))};break;default:throw new db[(_0x197c('0x67'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x238092);}})[_0x197c('0x25')](function(_0x8c0d4a){if(_0x8c0d4a){var _0x58e708=[_0x197c('0x68'),_0x197c('0x69'),_0x197c('0x6a'),_0x197c('0x6b')];_[_0x197c('0x6c')](_0x8c0d4a['ticket_fields'],function(_0x5da64e){return _0x58e708['includes'](_0x5da64e['type']);});return{'count':_0x8c0d4a[_0x197c('0x5d')][_0x197c('0x36')],'rows':_['map'](_0x8c0d4a['ticket_fields'],function(_0x213e01){return{'id':_0x213e01['id'],'name':_0x213e01['position']>0x7?_0x213e01['title']:_0x213e01[_0x197c('0x3e')],'custom':_0x213e01[_0x197c('0x6d')]>0x7?!![]:![],'options':_0x213e01[_0x197c('0x6e')]?_0x213e01[_0x197c('0x6e')]:_0x213e01[_0x197c('0x6f')]?_0x213e01[_0x197c('0x6f')]:[]};})};}})['then'](respondWithResult(_0x43c0b2,null))[_0x197c('0x48')](function(_0x2321e1){var _0x43fc99=_0x25d3c1[_0x197c('0x2f')][_0x197c('0x70')]?0x1f4:_0x2321e1[_0x197c('0x71')]||0x1f4;logger[_0x197c('0x72')]('getFields,\x20%s,\x20%s,\x20%s',_0x197c('0x56'),_0x43fc99,JSON[_0x197c('0x73')](_0x2321e1));delete _0x2321e1[_0x197c('0x28')];if(_0x43fc99===0x191){_0x43fc99=0x190;}_0x43c0b2[_0x197c('0x19')](_0x43fc99)[_0x197c('0x29')](_0x25d3c1[_0x197c('0x2f')]['test']?{'message':_0x197c('0x74'),'statusCode':_0x2321e1[_0x197c('0x71')]}:_0x2321e1);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index fcaefb5..a6a2a78 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 _0x7672=['../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3a9659,_0x2f921d){var _0x4a89b3=function(_0x4ba8b0){while(--_0x4ba8b0){_0x3a9659['push'](_0x3a9659['shift']());}};_0x4a89b3(++_0x2f921d);}(_0x7672,0x1dd));var _0x2767=function(_0x1c4525,_0x43a49e){_0x1c4525=_0x1c4525-0x0;var _0x37d1d2=_0x7672[_0x1c4525];return _0x37d1d2;};'use strict';var _=require(_0x2767('0x0'));var util=require(_0x2767('0x1'));var logger=require(_0x2767('0x2'))(_0x2767('0x3'));var moment=require(_0x2767('0x4'));var BPromise=require('bluebird');var rp=require(_0x2767('0x5'));var fs=require('fs');var path=require(_0x2767('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x2767('0x7'));module[_0x2767('0x8')]=function(_0xeb8bbb,_0x3ef61e){return _0xeb8bbb[_0x2767('0x9')]('ZendeskAccount',attributes,{'tableName':_0x2767('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8d6=['./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xd8d6,0x13c));var _0x6d8d=function(_0x2d69bb,_0x209bc5){_0x2d69bb=_0x2d69bb-0x0;var _0x5a280d=_0xd8d6[_0x2d69bb];return _0x5a280d;};'use strict';var _=require('lodash');var util=require(_0x6d8d('0x0'));var logger=require(_0x6d8d('0x1'))('api');var moment=require(_0x6d8d('0x2'));var BPromise=require(_0x6d8d('0x3'));var rp=require(_0x6d8d('0x4'));var fs=require('fs');var path=require(_0x6d8d('0x5'));var rimraf=require(_0x6d8d('0x6'));var config=require(_0x6d8d('0x7'));var attributes=require(_0x6d8d('0x8'));var integrations=require(_0x6d8d('0x9'));module['exports']=function(_0x1f5020,_0x17c6db){return _0x1f5020[_0x6d8d('0xa')](_0x6d8d('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index df74988..4547c41 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 _0xdbd7=['map','model','debug','GetZendeskAccount','find','raw','ShowZendeskAccount','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','ZendeskAccount','findAll','options','where','attributes','limit','include'];(function(_0x1d6fd2,_0x3beb12){var _0x24b446=function(_0x51dd65){while(--_0x51dd65){_0x1d6fd2['push'](_0x1d6fd2['shift']());}};_0x24b446(++_0x3beb12);}(_0xdbd7,0x130));var _0x7dbd=function(_0x11a2dd,_0x5bf4bc){_0x11a2dd=_0x11a2dd-0x0;var _0x4bc0e2=_0xdbd7[_0x11a2dd];return _0x4bc0e2;};'use strict';var _=require(_0x7dbd('0x0'));var util=require(_0x7dbd('0x1'));var moment=require(_0x7dbd('0x2'));var BPromise=require('bluebird');var rs=require(_0x7dbd('0x3'));var fs=require('fs');var Redis=require(_0x7dbd('0x4'));var db=require(_0x7dbd('0x5'))['db'];var utils=require(_0x7dbd('0x6'));var logger=require(_0x7dbd('0x7'))(_0x7dbd('0x8'));var config=require(_0x7dbd('0x9'));var jayson=require(_0x7dbd('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x67b05f,_0x5a3dba,_0x37f49f){return new BPromise(function(_0x207fcf,_0x61f033){return client[_0x7dbd('0xb')](_0x67b05f,_0x37f49f)[_0x7dbd('0xc')](function(_0x1e42e5){logger[_0x7dbd('0xd')](_0x7dbd('0xe'),_0x5a3dba,'request\x20sent');logger['debug'](_0x7dbd('0xf'),_0x5a3dba,_0x7dbd('0x10'),JSON[_0x7dbd('0x11')](_0x1e42e5));if(_0x1e42e5[_0x7dbd('0x12')]){if(_0x1e42e5[_0x7dbd('0x12')][_0x7dbd('0x13')]===0x1f4){logger[_0x7dbd('0x12')](_0x7dbd('0xe'),_0x5a3dba,_0x1e42e5[_0x7dbd('0x12')][_0x7dbd('0x14')]);return _0x61f033(_0x1e42e5[_0x7dbd('0x12')][_0x7dbd('0x14')]);}logger[_0x7dbd('0x12')](_0x7dbd('0xe'),_0x5a3dba,_0x1e42e5[_0x7dbd('0x12')][_0x7dbd('0x14')]);return _0x207fcf(_0x1e42e5[_0x7dbd('0x12')][_0x7dbd('0x14')]);}else{logger[_0x7dbd('0xd')](_0x7dbd('0xe'),_0x5a3dba,_0x7dbd('0x10'));_0x207fcf(_0x1e42e5[_0x7dbd('0x15')][_0x7dbd('0x14')]);}})['catch'](function(_0x7308de){logger[_0x7dbd('0x12')](_0x7dbd('0xe'),_0x5a3dba,_0x7308de);_0x61f033(_0x7308de);});});}exports['GetZendeskAccount']=function(_0x5003fa){var _0x2370c=this;return new Promise(function(_0x36f683,_0x22d80a){return db[_0x7dbd('0x16')][_0x7dbd('0x17')]({'raw':_0x5003fa['options']?_0x5003fa[_0x7dbd('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5003fa['options']?_0x5003fa[_0x7dbd('0x18')][_0x7dbd('0x19')]||null:null,'attributes':_0x5003fa[_0x7dbd('0x18')]?_0x5003fa['options'][_0x7dbd('0x1a')]||null:null,'limit':_0x5003fa[_0x7dbd('0x18')]?_0x5003fa[_0x7dbd('0x18')][_0x7dbd('0x1b')]||null:null,'include':_0x5003fa[_0x7dbd('0x18')]?_0x5003fa[_0x7dbd('0x18')][_0x7dbd('0x1c')]?_[_0x7dbd('0x1d')](_0x5003fa[_0x7dbd('0x18')]['include'],function(_0xc1365a){return{'model':db[_0xc1365a['model']],'as':_0xc1365a['as'],'attributes':_0xc1365a[_0x7dbd('0x1a')],'include':_0xc1365a['include']?_[_0x7dbd('0x1d')](_0xc1365a[_0x7dbd('0x1c')],function(_0x98c10){return{'model':db[_0x98c10[_0x7dbd('0x1e')]],'as':_0x98c10['as'],'attributes':_0x98c10[_0x7dbd('0x1a')],'include':_0x98c10[_0x7dbd('0x1c')]?_[_0x7dbd('0x1d')](_0x98c10[_0x7dbd('0x1c')],function(_0x1b9cdb){return{'model':db[_0x1b9cdb['model']],'as':_0x1b9cdb['as'],'attributes':_0x1b9cdb[_0x7dbd('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41a883){logger[_0x7dbd('0xd')]('GetZendeskAccount',_0x5003fa);logger[_0x7dbd('0x1f')](_0x7dbd('0x20'),_0x5003fa,JSON[_0x7dbd('0x11')](_0x41a883));_0x36f683(_0x41a883);})['catch'](function(_0x5a913d){logger[_0x7dbd('0x12')](_0x7dbd('0x20'),_0x5a913d['message'],_0x5003fa);_0x22d80a(_0x2370c[_0x7dbd('0x12')](0x1f4,_0x5a913d['message']));});});};exports['ShowZendeskAccount']=function(_0x469758){var _0x3af0ba=this;return new Promise(function(_0x2c73c3,_0x4ef781){return db[_0x7dbd('0x16')][_0x7dbd('0x21')]({'raw':_0x469758[_0x7dbd('0x18')]?_0x469758[_0x7dbd('0x18')][_0x7dbd('0x22')]===undefined?!![]:![]:!![],'where':_0x469758[_0x7dbd('0x18')]?_0x469758['options'][_0x7dbd('0x19')]||null:null,'attributes':_0x469758[_0x7dbd('0x18')]?_0x469758[_0x7dbd('0x18')][_0x7dbd('0x1a')]||null:null,'include':_0x469758[_0x7dbd('0x18')]?_0x469758[_0x7dbd('0x18')]['include']?_[_0x7dbd('0x1d')](_0x469758[_0x7dbd('0x18')][_0x7dbd('0x1c')],function(_0x59f026){return{'model':db[_0x59f026[_0x7dbd('0x1e')]],'as':_0x59f026['as'],'attributes':_0x59f026[_0x7dbd('0x1a')],'include':_0x59f026['include']?_[_0x7dbd('0x1d')](_0x59f026['include'],function(_0x34cd7b){return{'model':db[_0x34cd7b[_0x7dbd('0x1e')]],'as':_0x34cd7b['as'],'attributes':_0x34cd7b[_0x7dbd('0x1a')],'include':_0x34cd7b['include']?_[_0x7dbd('0x1d')](_0x34cd7b['include'],function(_0xe14b9c){return{'model':db[_0xe14b9c['model']],'as':_0xe14b9c['as'],'attributes':_0xe14b9c['attributes']};}):[]};}):[]};}):[]:[]})[_0x7dbd('0xc')](function(_0x266592){logger[_0x7dbd('0xd')](_0x7dbd('0x23'),_0x469758);logger[_0x7dbd('0x1f')]('ShowZendeskAccount',_0x469758,JSON[_0x7dbd('0x11')](_0x266592));_0x2c73c3(_0x266592);})[_0x7dbd('0x24')](function(_0x415134){logger[_0x7dbd('0x12')](_0x7dbd('0x23'),_0x415134[_0x7dbd('0x14')],_0x469758);_0x4ef781(_0x3af0ba['error'](0x1f4,_0x415134['message']));});});}; \ No newline at end of file +var _0x9e84=['limit','include','map','model','info','debug','stringify','catch','ShowZendeskAccount','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetZendeskAccount','ZendeskAccount','options','raw','where','attributes'];(function(_0x263545,_0xc8dfcd){var _0x50b199=function(_0x5c9e99){while(--_0x5c9e99){_0x263545['push'](_0x263545['shift']());}};_0x50b199(++_0xc8dfcd);}(_0x9e84,0x196));var _0x49e8=function(_0x544099,_0x372b30){_0x544099=_0x544099-0x0;var _0x20ab09=_0x9e84[_0x544099];return _0x20ab09;};'use strict';var _=require(_0x49e8('0x0'));var util=require(_0x49e8('0x1'));var moment=require(_0x49e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x49e8('0x3'));var db=require(_0x49e8('0x4'))['db'];var utils=require(_0x49e8('0x5'));var logger=require(_0x49e8('0x6'))(_0x49e8('0x7'));var config=require('../../config/environment');var jayson=require(_0x49e8('0x8'));var client=jayson[_0x49e8('0x9')][_0x49e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53d2b9,_0x145220,_0x2cd19e){return new BPromise(function(_0x138404,_0x48ccfe){return client[_0x49e8('0xb')](_0x53d2b9,_0x2cd19e)[_0x49e8('0xc')](function(_0x3883b1){logger['info'](_0x49e8('0xd'),_0x145220,'request\x20sent');logger['debug'](_0x49e8('0xe'),_0x145220,_0x49e8('0xf'),JSON['stringify'](_0x3883b1));if(_0x3883b1['error']){if(_0x3883b1[_0x49e8('0x10')][_0x49e8('0x11')]===0x1f4){logger[_0x49e8('0x10')](_0x49e8('0xd'),_0x145220,_0x3883b1[_0x49e8('0x10')][_0x49e8('0x12')]);return _0x48ccfe(_0x3883b1['error'][_0x49e8('0x12')]);}logger[_0x49e8('0x10')](_0x49e8('0xd'),_0x145220,_0x3883b1[_0x49e8('0x10')]['message']);return _0x138404(_0x3883b1[_0x49e8('0x10')][_0x49e8('0x12')]);}else{logger['info'](_0x49e8('0xd'),_0x145220,_0x49e8('0xf'));_0x138404(_0x3883b1[_0x49e8('0x13')][_0x49e8('0x12')]);}})['catch'](function(_0x4741bb){logger[_0x49e8('0x10')](_0x49e8('0xd'),_0x145220,_0x4741bb);_0x48ccfe(_0x4741bb);});});}exports[_0x49e8('0x14')]=function(_0x100e2a){var _0x442371=this;return new Promise(function(_0x3ebfb6,_0x3ddfe7){return db[_0x49e8('0x15')]['findAll']({'raw':_0x100e2a['options']?_0x100e2a[_0x49e8('0x16')][_0x49e8('0x17')]===undefined?!![]:![]:!![],'where':_0x100e2a[_0x49e8('0x16')]?_0x100e2a[_0x49e8('0x16')][_0x49e8('0x18')]||null:null,'attributes':_0x100e2a['options']?_0x100e2a[_0x49e8('0x16')][_0x49e8('0x19')]||null:null,'limit':_0x100e2a[_0x49e8('0x16')]?_0x100e2a[_0x49e8('0x16')][_0x49e8('0x1a')]||null:null,'include':_0x100e2a['options']?_0x100e2a['options'][_0x49e8('0x1b')]?_[_0x49e8('0x1c')](_0x100e2a[_0x49e8('0x16')]['include'],function(_0x5ddd01){return{'model':db[_0x5ddd01[_0x49e8('0x1d')]],'as':_0x5ddd01['as'],'attributes':_0x5ddd01[_0x49e8('0x19')],'include':_0x5ddd01['include']?_[_0x49e8('0x1c')](_0x5ddd01[_0x49e8('0x1b')],function(_0x21149f){return{'model':db[_0x21149f['model']],'as':_0x21149f['as'],'attributes':_0x21149f[_0x49e8('0x19')],'include':_0x21149f[_0x49e8('0x1b')]?_[_0x49e8('0x1c')](_0x21149f[_0x49e8('0x1b')],function(_0x1f16a1){return{'model':db[_0x1f16a1['model']],'as':_0x1f16a1['as'],'attributes':_0x1f16a1[_0x49e8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x49e8('0xc')](function(_0x35a5c4){logger[_0x49e8('0x1e')]('GetZendeskAccount',_0x100e2a);logger[_0x49e8('0x1f')](_0x49e8('0x14'),_0x100e2a,JSON[_0x49e8('0x20')](_0x35a5c4));_0x3ebfb6(_0x35a5c4);})[_0x49e8('0x21')](function(_0x20e2fd){logger['error']('GetZendeskAccount',_0x20e2fd[_0x49e8('0x12')],_0x100e2a);_0x3ddfe7(_0x442371[_0x49e8('0x10')](0x1f4,_0x20e2fd[_0x49e8('0x12')]));});});};exports[_0x49e8('0x22')]=function(_0x85efec){var _0x56f672=this;return new Promise(function(_0x44e32f,_0x202287){return db[_0x49e8('0x15')][_0x49e8('0x23')]({'raw':_0x85efec[_0x49e8('0x16')]?_0x85efec['options']['raw']===undefined?!![]:![]:!![],'where':_0x85efec[_0x49e8('0x16')]?_0x85efec['options'][_0x49e8('0x18')]||null:null,'attributes':_0x85efec[_0x49e8('0x16')]?_0x85efec[_0x49e8('0x16')][_0x49e8('0x19')]||null:null,'include':_0x85efec[_0x49e8('0x16')]?_0x85efec[_0x49e8('0x16')][_0x49e8('0x1b')]?_[_0x49e8('0x1c')](_0x85efec['options']['include'],function(_0x3e0d49){return{'model':db[_0x3e0d49[_0x49e8('0x1d')]],'as':_0x3e0d49['as'],'attributes':_0x3e0d49[_0x49e8('0x19')],'include':_0x3e0d49['include']?_[_0x49e8('0x1c')](_0x3e0d49[_0x49e8('0x1b')],function(_0x1c6e0f){return{'model':db[_0x1c6e0f['model']],'as':_0x1c6e0f['as'],'attributes':_0x1c6e0f[_0x49e8('0x19')],'include':_0x1c6e0f[_0x49e8('0x1b')]?_[_0x49e8('0x1c')](_0x1c6e0f[_0x49e8('0x1b')],function(_0x3cebbe){return{'model':db[_0x3cebbe['model']],'as':_0x3cebbe['as'],'attributes':_0x3cebbe[_0x49e8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x49e8('0xc')](function(_0x4af4cc){logger[_0x49e8('0x1e')](_0x49e8('0x22'),_0x85efec);logger[_0x49e8('0x1f')](_0x49e8('0x22'),_0x85efec,JSON[_0x49e8('0x20')](_0x4af4cc));_0x44e32f(_0x4af4cc);})[_0x49e8('0x21')](function(_0x450f30){logger[_0x49e8('0x10')](_0x49e8('0x22'),_0x450f30[_0x49e8('0x12')],_0x85efec);_0x202287(_0x56f672[_0x49e8('0x10')](0x1f4,_0x450f30['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 6dffd1a..ac4b6b2 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 _0xac4a=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get','show','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x29a134,_0x194c27){var _0x136398=function(_0x1def82){while(--_0x1def82){_0x29a134['push'](_0x29a134['shift']());}};_0x136398(++_0x194c27);}(_0xac4a,0x13f));var _0xaac4=function(_0x76c23,_0x599c6c){_0x76c23=_0x76c23-0x0;var _0x2d67ce=_0xac4a[_0x76c23];return _0x2d67ce;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id/fields',auth[_0xaac4('0x9')](),controller['getFields']);router[_0xaac4('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['get']('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')]('/',auth['isAuthenticated'](),controller[_0xaac4('0x11')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x15')]);router[_0xaac4('0x16')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x17')]);module[_0xaac4('0x18')]=router; \ No newline at end of file +var _0x36ee=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','update','delete','destroy','exports','path','express'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x36ee,0xe8));var _0xe36e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x36ee[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x8')](_0xe36e('0x13'),auth[_0xe36e('0x9')](),controller['getTags']);router[_0xe36e('0x14')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x14')]('/:id/tags',auth[_0xe36e('0x9')](),controller['setTags']);router['put'](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x16')]);router[_0xe36e('0x17')](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x18')]);module[_0xe36e('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index dcbea67..deed440 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 _0x82cd=['sequelize','exports','STRING'];(function(_0x50fedc,_0x479e4f){var _0x1b0386=function(_0x270a7e){while(--_0x270a7e){_0x50fedc['push'](_0x50fedc['shift']());}};_0x1b0386(++_0x479e4f);}(_0x82cd,0x1a4));var _0xd82c=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x82cd[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require(_0xd82c('0x0'));module[_0xd82c('0x1')]={'name':{'type':Sequelize[_0xd82c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8883=['exports','STRING','sequelize'];(function(_0x4f9388,_0x1cb416){var _0x24873e=function(_0x400422){while(--_0x400422){_0x4f9388['push'](_0x4f9388['shift']());}};_0x24873e(++_0x1cb416);}(_0x8883,0xf8));var _0x3888=function(_0x40eea2,_0x158886){_0x40eea2=_0x40eea2-0x0;var _0x296825=_0x8883[_0x40eea2];return _0x296825;};'use strict';var Sequelize=require(_0x3888('0x0'));module[_0x3888('0x1')]={'name':{'type':Sequelize[_0x3888('0x2')]},'description':{'type':Sequelize[_0x3888('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 61884fd..f067905 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 _0x3bb6=['length','nolimit','order','sort','filter','merge','where','map','then','includeAll','findAll','rows','catch','show','include','options','find','create','body','params','getFields','findOne','ZendeskField','pick','hasOwnProperty','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields'];(function(_0x1a5109,_0x3b8698){var _0x4d57fa=function(_0x3b8f34){while(--_0x3b8f34){_0x1a5109['push'](_0x1a5109['shift']());}};_0x4d57fa(++_0x3b8698);}(_0x3bb6,0x16e));var _0x63bb=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3bb6[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x63bb('0x0'));var zipdir=require(_0x63bb('0x1'));var jsonpatch=require(_0x63bb('0x2'));var rp=require('request-promise');var moment=require(_0x63bb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x63bb('0x4'));var util=require(_0x63bb('0x5'));var path=require(_0x63bb('0x6'));var sox=require('sox');var csv=require(_0x63bb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x63bb('0x8'));var _=require(_0x63bb('0x9'));var squel=require(_0x63bb('0xa'));var crypto=require(_0x63bb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x63bb('0xc'));var toCsv=require(_0x63bb('0x7'));var querystring=require(_0x63bb('0xd'));var Papa=require(_0x63bb('0xe'));var Redis=require('ioredis');var authService=require(_0x63bb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x63bb('0x10'));var hardwareService=require(_0x63bb('0x11'));var logger=require(_0x63bb('0x12'))(_0x63bb('0x13'));var utils=require(_0x63bb('0x14'));var config=require(_0x63bb('0x15'));var licenseUtil=require(_0x63bb('0x16'));var db=require(_0x63bb('0x17'))['db'];function respondWithStatusCode(_0x3799ce,_0x43d9b3){_0x43d9b3=_0x43d9b3||0xcc;return function(_0x145177){if(_0x145177){return _0x3799ce[_0x63bb('0x18')](_0x43d9b3);}return _0x3799ce[_0x63bb('0x19')](_0x43d9b3)[_0x63bb('0x1a')]();};}function respondWithResult(_0x4103d8,_0x1562dd){_0x1562dd=_0x1562dd||0xc8;return function(_0xc33ac){if(_0xc33ac){return _0x4103d8[_0x63bb('0x19')](_0x1562dd)['json'](_0xc33ac);}};}function respondWithFilteredResult(_0x1d8fba,_0x451f0f){return function(_0x46a324){if(_0x46a324){var _0x2bb085=typeof _0x451f0f[_0x63bb('0x1b')]==='undefined'&&typeof _0x451f0f[_0x63bb('0x1c')]==='undefined';var _0x1f3cce=_0x46a324[_0x63bb('0x1d')];var _0xd3b85e=_0x2bb085?0x0:_0x451f0f[_0x63bb('0x1b')];var _0x12b732=_0x2bb085?_0x46a324['count']:_0x451f0f['offset']+_0x451f0f[_0x63bb('0x1c')];var _0xa7b2ee;if(_0x12b732>=_0x1f3cce){_0x12b732=_0x1f3cce;_0xa7b2ee=0xc8;}else{_0xa7b2ee=0xce;}_0x1d8fba[_0x63bb('0x19')](_0xa7b2ee);return _0x1d8fba[_0x63bb('0x1e')](_0x63bb('0x1f'),_0xd3b85e+'-'+_0x12b732+'/'+_0x1f3cce)[_0x63bb('0x20')](_0x46a324);}return null;};}function patchUpdates(_0x4f6989){return function(_0x6f555a){try{jsonpatch[_0x63bb('0x21')](_0x6f555a,_0x4f6989,!![]);}catch(_0xd4d12b){return BPromise[_0x63bb('0x22')](_0xd4d12b);}return _0x6f555a[_0x63bb('0x23')]();};}function saveUpdates(_0x4ff883,_0x5e126c){return function(_0x560a81){if(_0x560a81){return _0x560a81[_0x63bb('0x24')](_0x4ff883)['then'](function(_0x57bba2){return _0x57bba2;});}return null;};}function removeEntity(_0x4d276c,_0x66c3ea){return function(_0x254754){if(_0x254754){return _0x254754[_0x63bb('0x25')]()['then'](function(){_0x4d276c[_0x63bb('0x19')](0xcc)[_0x63bb('0x1a')]();});}};}function handleEntityNotFound(_0x365071,_0x3ac89a){return function(_0x639711){if(!_0x639711){_0x365071['sendStatus'](0x194);}return _0x639711;};}function handleError(_0x1115b8,_0x5c9a66){_0x5c9a66=_0x5c9a66||0x1f4;return function(_0x28cc63){logger[_0x63bb('0x26')](_0x28cc63[_0x63bb('0x27')]);if(_0x28cc63[_0x63bb('0x28')]){delete _0x28cc63[_0x63bb('0x28')];}_0x1115b8[_0x63bb('0x19')](_0x5c9a66)[_0x63bb('0x29')](_0x28cc63);};}exports[_0x63bb('0x2a')]=function(_0x4d207f,_0x1d93e7){var _0x77d4a4={},_0xe7f3e7={},_0x30e1a7={'count':0x0,'rows':[]};var _0x5a33e5=_['map'](db[_0x63bb('0x2b')][_0x63bb('0x2c')],function(_0x67a2ec){return{'name':_0x67a2ec[_0x63bb('0x2d')],'type':_0x67a2ec[_0x63bb('0x2e')]['key']};});_0xe7f3e7['model']=_['map'](_0x5a33e5,_0x63bb('0x28'));_0xe7f3e7[_0x63bb('0x2f')]=_[_0x63bb('0x30')](_0x4d207f[_0x63bb('0x2f')]);_0xe7f3e7[_0x63bb('0x31')]=_[_0x63bb('0x32')](_0xe7f3e7[_0x63bb('0x33')],_0xe7f3e7[_0x63bb('0x2f')]);_0x77d4a4[_0x63bb('0x34')]=_[_0x63bb('0x32')](_0xe7f3e7['model'],qs[_0x63bb('0x35')](_0x4d207f[_0x63bb('0x2f')][_0x63bb('0x35')]));_0x77d4a4[_0x63bb('0x34')]=_0x77d4a4[_0x63bb('0x34')][_0x63bb('0x36')]?_0x77d4a4[_0x63bb('0x34')]:_0xe7f3e7[_0x63bb('0x33')];if(!_0x4d207f[_0x63bb('0x2f')]['hasOwnProperty'](_0x63bb('0x37'))){_0x77d4a4['limit']=qs[_0x63bb('0x1c')](_0x4d207f[_0x63bb('0x2f')][_0x63bb('0x1c')]);_0x77d4a4[_0x63bb('0x1b')]=qs[_0x63bb('0x1b')](_0x4d207f[_0x63bb('0x2f')]['offset']);}_0x77d4a4[_0x63bb('0x38')]=qs[_0x63bb('0x39')](_0x4d207f[_0x63bb('0x2f')][_0x63bb('0x39')]);_0x77d4a4['where']=qs[_0x63bb('0x31')](_['pick'](_0x4d207f[_0x63bb('0x2f')],_0xe7f3e7['filters']),_0x5a33e5);if(_0x4d207f[_0x63bb('0x2f')][_0x63bb('0x3a')]){_0x77d4a4['where']=_[_0x63bb('0x3b')](_0x77d4a4[_0x63bb('0x3c')],{'$or':_[_0x63bb('0x3d')](_0x5a33e5,function(_0x4dc965){if(_0x4dc965[_0x63bb('0x2e')]!=='VIRTUAL'){var _0x3303e1={};_0x3303e1[_0x4dc965[_0x63bb('0x28')]]={'$like':'%'+_0x4d207f[_0x63bb('0x2f')]['filter']+'%'};return _0x3303e1;}})});}_0x77d4a4=_['merge']({},_0x77d4a4,_0x4d207f['options']);var _0x296b0a={'where':_0x77d4a4[_0x63bb('0x3c')]};return db['ZendeskConfiguration'][_0x63bb('0x1d')](_0x296b0a)[_0x63bb('0x3e')](function(_0x4f39fe){_0x30e1a7[_0x63bb('0x1d')]=_0x4f39fe;if(_0x4d207f[_0x63bb('0x2f')][_0x63bb('0x3f')]){_0x77d4a4['include']=[{'all':!![]}];}return db[_0x63bb('0x2b')][_0x63bb('0x40')](_0x77d4a4);})[_0x63bb('0x3e')](function(_0x3257f6){_0x30e1a7[_0x63bb('0x41')]=_0x3257f6;return _0x30e1a7;})[_0x63bb('0x3e')](respondWithFilteredResult(_0x1d93e7,_0x77d4a4))[_0x63bb('0x42')](handleError(_0x1d93e7,null));};exports[_0x63bb('0x43')]=function(_0xd95bc,_0xeea950){var _0x3fce31={'raw':![],'where':{'id':_0xd95bc['params']['id']}},_0xdf0e93={};_0xdf0e93['model']=_[_0x63bb('0x30')](db[_0x63bb('0x2b')]['rawAttributes']);_0xdf0e93[_0x63bb('0x2f')]=_[_0x63bb('0x30')](_0xd95bc[_0x63bb('0x2f')]);_0xdf0e93[_0x63bb('0x31')]=_[_0x63bb('0x32')](_0xdf0e93[_0x63bb('0x33')],_0xdf0e93[_0x63bb('0x2f')]);_0x3fce31[_0x63bb('0x34')]=_[_0x63bb('0x32')](_0xdf0e93[_0x63bb('0x33')],qs['fields'](_0xd95bc[_0x63bb('0x2f')][_0x63bb('0x35')]));_0x3fce31[_0x63bb('0x34')]=_0x3fce31[_0x63bb('0x34')][_0x63bb('0x36')]?_0x3fce31[_0x63bb('0x34')]:_0xdf0e93[_0x63bb('0x33')];if(_0xd95bc[_0x63bb('0x2f')]['includeAll']){_0x3fce31[_0x63bb('0x44')]=[{'all':!![]}];}_0x3fce31=_[_0x63bb('0x3b')]({},_0x3fce31,_0xd95bc[_0x63bb('0x45')]);return db[_0x63bb('0x2b')][_0x63bb('0x46')](_0x3fce31)[_0x63bb('0x3e')](handleEntityNotFound(_0xeea950,null))[_0x63bb('0x3e')](respondWithResult(_0xeea950,null))['catch'](handleError(_0xeea950,null));};exports[_0x63bb('0x47')]=function(_0x1cd883,_0xea903b){return db[_0x63bb('0x2b')][_0x63bb('0x47')](_0x1cd883['body'],{})[_0x63bb('0x3e')](respondWithResult(_0xea903b,0xc9))['catch'](handleError(_0xea903b,null));};exports[_0x63bb('0x24')]=function(_0x3e768e,_0x50117c){if(_0x3e768e[_0x63bb('0x48')]['id']){delete _0x3e768e[_0x63bb('0x48')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x3e768e['params']['id']}})['then'](handleEntityNotFound(_0x50117c,null))[_0x63bb('0x3e')](saveUpdates(_0x3e768e[_0x63bb('0x48')],null))[_0x63bb('0x3e')](respondWithResult(_0x50117c,null))[_0x63bb('0x42')](handleError(_0x50117c,null));};exports[_0x63bb('0x25')]=function(_0x5f4eb7,_0x237341){return db[_0x63bb('0x2b')][_0x63bb('0x46')]({'where':{'id':_0x5f4eb7[_0x63bb('0x49')]['id']}})['then'](handleEntityNotFound(_0x237341,null))[_0x63bb('0x3e')](removeEntity(_0x237341,null))['catch'](handleError(_0x237341,null));};exports[_0x63bb('0x4a')]=function(_0x367872,_0x2e9c15,_0x53b4de){var _0x532d14={};var _0x4d7aab={};var _0x2dfbcf;var _0x411c32;return db[_0x63bb('0x2b')][_0x63bb('0x4b')]({'where':{'id':_0x367872[_0x63bb('0x49')]['id']}})[_0x63bb('0x3e')](handleEntityNotFound(_0x2e9c15,null))[_0x63bb('0x3e')](function(_0x57a7be){if(_0x57a7be){_0x2dfbcf=_0x57a7be;_0x4d7aab['model']=_[_0x63bb('0x30')](db[_0x63bb('0x4c')][_0x63bb('0x2c')]);_0x4d7aab['query']=_[_0x63bb('0x30')](_0x367872[_0x63bb('0x2f')]);_0x4d7aab['filters']=_[_0x63bb('0x32')](_0x4d7aab[_0x63bb('0x33')],_0x4d7aab[_0x63bb('0x2f')]);_0x532d14[_0x63bb('0x34')]=_['intersection'](_0x4d7aab[_0x63bb('0x33')],qs[_0x63bb('0x35')](_0x367872[_0x63bb('0x2f')][_0x63bb('0x35')]));_0x532d14['attributes']=_0x532d14[_0x63bb('0x34')][_0x63bb('0x36')]?_0x532d14[_0x63bb('0x34')]:_0x4d7aab[_0x63bb('0x33')];_0x532d14[_0x63bb('0x38')]=qs[_0x63bb('0x39')](_0x367872['query'][_0x63bb('0x39')]);_0x532d14['where']=qs[_0x63bb('0x31')](_[_0x63bb('0x4d')](_0x367872[_0x63bb('0x2f')],_0x4d7aab['filters']));if(_0x367872['query'][_0x63bb('0x3a')]){_0x532d14[_0x63bb('0x3c')]=_['merge'](_0x532d14[_0x63bb('0x3c')],{'$or':_['map'](_0x532d14['attributes'],function(_0x518bc9){var _0x3da4c4={};_0x3da4c4[_0x518bc9]={'$like':'%'+_0x367872[_0x63bb('0x2f')][_0x63bb('0x3a')]+'%'};return _0x3da4c4;})});}_0x532d14=_[_0x63bb('0x3b')]({},_0x532d14,_0x367872['options']);return _0x2dfbcf['getFields'](_0x532d14);}})['then'](function(_0x191443){if(_0x191443){_0x411c32=_0x191443[_0x63bb('0x36')];if(!_0x367872[_0x63bb('0x2f')][_0x63bb('0x4e')](_0x63bb('0x37'))){_0x532d14[_0x63bb('0x1c')]=qs[_0x63bb('0x1c')](_0x367872[_0x63bb('0x2f')][_0x63bb('0x1c')]);_0x532d14[_0x63bb('0x1b')]=qs[_0x63bb('0x1b')](_0x367872[_0x63bb('0x2f')][_0x63bb('0x1b')]);}return _0x2dfbcf['getFields'](_0x532d14);}})[_0x63bb('0x3e')](function(_0x3ebb8f){if(_0x3ebb8f){return _0x3ebb8f?{'count':_0x411c32,'rows':_0x3ebb8f}:null;}})[_0x63bb('0x3e')](respondWithResult(_0x2e9c15,null))['catch'](handleError(_0x2e9c15,null));};exports['getSubjects']=function(_0x263953,_0x449e80,_0x1d57a0){var _0x303123={};var _0x4fa58d={};var _0x2ec4e0;var _0x436e94;return db[_0x63bb('0x2b')][_0x63bb('0x4b')]({'where':{'id':_0x263953[_0x63bb('0x49')]['id']}})[_0x63bb('0x3e')](handleEntityNotFound(_0x449e80,null))[_0x63bb('0x3e')](function(_0x112018){if(_0x112018){_0x2ec4e0=_0x112018;_0x4fa58d['model']=_['keys'](db[_0x63bb('0x4c')][_0x63bb('0x2c')]);_0x4fa58d[_0x63bb('0x2f')]=_[_0x63bb('0x30')](_0x263953['query']);_0x4fa58d[_0x63bb('0x31')]=_[_0x63bb('0x32')](_0x4fa58d[_0x63bb('0x33')],_0x4fa58d[_0x63bb('0x2f')]);_0x303123[_0x63bb('0x34')]=_[_0x63bb('0x32')](_0x4fa58d[_0x63bb('0x33')],qs[_0x63bb('0x35')](_0x263953[_0x63bb('0x2f')][_0x63bb('0x35')]));_0x303123[_0x63bb('0x34')]=_0x303123[_0x63bb('0x34')][_0x63bb('0x36')]?_0x303123[_0x63bb('0x34')]:_0x4fa58d[_0x63bb('0x33')];_0x303123[_0x63bb('0x38')]=qs[_0x63bb('0x39')](_0x263953[_0x63bb('0x2f')]['sort']);_0x303123[_0x63bb('0x3c')]=qs[_0x63bb('0x31')](_[_0x63bb('0x4d')](_0x263953['query'],_0x4fa58d[_0x63bb('0x31')]));if(_0x263953['query']['filter']){_0x303123[_0x63bb('0x3c')]=_[_0x63bb('0x3b')](_0x303123[_0x63bb('0x3c')],{'$or':_[_0x63bb('0x3d')](_0x303123[_0x63bb('0x34')],function(_0x56092f){var _0x3b4b38={};_0x3b4b38[_0x56092f]={'$like':'%'+_0x263953[_0x63bb('0x2f')][_0x63bb('0x3a')]+'%'};return _0x3b4b38;})});}_0x303123=_[_0x63bb('0x3b')]({},_0x303123,_0x263953[_0x63bb('0x45')]);return _0x2ec4e0['getSubjects'](_0x303123);}})[_0x63bb('0x3e')](function(_0x4ef351){if(_0x4ef351){_0x436e94=_0x4ef351[_0x63bb('0x36')];if(!_0x263953[_0x63bb('0x2f')][_0x63bb('0x4e')](_0x63bb('0x37'))){_0x303123[_0x63bb('0x1c')]=qs[_0x63bb('0x1c')](_0x263953[_0x63bb('0x2f')][_0x63bb('0x1c')]);_0x303123[_0x63bb('0x1b')]=qs[_0x63bb('0x1b')](_0x263953[_0x63bb('0x2f')]['offset']);}return _0x2ec4e0[_0x63bb('0x4f')](_0x303123);}})[_0x63bb('0x3e')](function(_0x1daa25){if(_0x1daa25){return _0x1daa25?{'count':_0x436e94,'rows':_0x1daa25}:null;}})[_0x63bb('0x3e')](respondWithResult(_0x449e80,null))[_0x63bb('0x42')](handleError(_0x449e80,null));};exports[_0x63bb('0x50')]=function(_0x21804b,_0x520261,_0x470d7d){var _0x39522e={};var _0x1619af={};var _0x4fdbde;var _0x15745c;return db[_0x63bb('0x2b')][_0x63bb('0x4b')]({'where':{'id':_0x21804b['params']['id']}})[_0x63bb('0x3e')](handleEntityNotFound(_0x520261,null))['then'](function(_0x3a6bd4){if(_0x3a6bd4){_0x4fdbde=_0x3a6bd4;_0x1619af[_0x63bb('0x33')]=_[_0x63bb('0x30')](db['ZendeskField'][_0x63bb('0x2c')]);_0x1619af[_0x63bb('0x2f')]=_[_0x63bb('0x30')](_0x21804b['query']);_0x1619af[_0x63bb('0x31')]=_[_0x63bb('0x32')](_0x1619af[_0x63bb('0x33')],_0x1619af[_0x63bb('0x2f')]);_0x39522e[_0x63bb('0x34')]=_['intersection'](_0x1619af[_0x63bb('0x33')],qs['fields'](_0x21804b[_0x63bb('0x2f')]['fields']));_0x39522e[_0x63bb('0x34')]=_0x39522e[_0x63bb('0x34')]['length']?_0x39522e[_0x63bb('0x34')]:_0x1619af[_0x63bb('0x33')];_0x39522e['order']=qs['sort'](_0x21804b[_0x63bb('0x2f')]['sort']);_0x39522e[_0x63bb('0x3c')]=qs[_0x63bb('0x31')](_['pick'](_0x21804b[_0x63bb('0x2f')],_0x1619af['filters']));if(_0x21804b['query']['filter']){_0x39522e['where']=_['merge'](_0x39522e['where'],{'$or':_[_0x63bb('0x3d')](_0x39522e[_0x63bb('0x34')],function(_0x3d7052){var _0x411db7={};_0x411db7[_0x3d7052]={'$like':'%'+_0x21804b[_0x63bb('0x2f')][_0x63bb('0x3a')]+'%'};return _0x411db7;})});}_0x39522e=_[_0x63bb('0x3b')]({},_0x39522e,_0x21804b[_0x63bb('0x45')]);return _0x4fdbde['getDescriptions'](_0x39522e);}})[_0x63bb('0x3e')](function(_0x29cafb){if(_0x29cafb){_0x15745c=_0x29cafb['length'];if(!_0x21804b[_0x63bb('0x2f')][_0x63bb('0x4e')](_0x63bb('0x37'))){_0x39522e[_0x63bb('0x1c')]=qs['limit'](_0x21804b[_0x63bb('0x2f')][_0x63bb('0x1c')]);_0x39522e[_0x63bb('0x1b')]=qs[_0x63bb('0x1b')](_0x21804b[_0x63bb('0x2f')][_0x63bb('0x1b')]);}return _0x4fdbde[_0x63bb('0x50')](_0x39522e);}})[_0x63bb('0x3e')](function(_0x8e4d72){if(_0x8e4d72){return _0x8e4d72?{'count':_0x15745c,'rows':_0x8e4d72}:null;}})[_0x63bb('0x3e')](respondWithResult(_0x520261,null))[_0x63bb('0x42')](handleError(_0x520261,null));};exports[_0x63bb('0x51')]=function(_0x4f55a4,_0x4c0223,_0x116b9c){var _0x240678={};var _0x1d7e67={};var _0x2b8fe5;var _0x26d262;return db[_0x63bb('0x2b')][_0x63bb('0x4b')]({'where':{'id':_0x4f55a4[_0x63bb('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c0223,null))[_0x63bb('0x3e')](function(_0x228f2a){if(_0x228f2a){_0x2b8fe5=_0x228f2a;_0x1d7e67[_0x63bb('0x33')]=_[_0x63bb('0x30')](db['Tag']['rawAttributes']);_0x1d7e67[_0x63bb('0x2f')]=_[_0x63bb('0x30')](_0x4f55a4[_0x63bb('0x2f')]);_0x1d7e67[_0x63bb('0x31')]=_[_0x63bb('0x32')](_0x1d7e67[_0x63bb('0x33')],_0x1d7e67[_0x63bb('0x2f')]);_0x240678[_0x63bb('0x34')]=_['intersection'](_0x1d7e67['model'],qs[_0x63bb('0x35')](_0x4f55a4[_0x63bb('0x2f')]['fields']));_0x240678[_0x63bb('0x34')]=_0x240678[_0x63bb('0x34')][_0x63bb('0x36')]?_0x240678[_0x63bb('0x34')]:_0x1d7e67['model'];_0x240678[_0x63bb('0x38')]=qs['sort'](_0x4f55a4[_0x63bb('0x2f')]['sort']);_0x240678[_0x63bb('0x3c')]=qs['filters'](_[_0x63bb('0x4d')](_0x4f55a4['query'],_0x1d7e67[_0x63bb('0x31')]));if(_0x4f55a4['query'][_0x63bb('0x3a')]){_0x240678[_0x63bb('0x3c')]=_[_0x63bb('0x3b')](_0x240678[_0x63bb('0x3c')],{'$or':_['map'](_0x240678[_0x63bb('0x34')],function(_0x329a64){var _0x43d5e7={};_0x43d5e7[_0x329a64]={'$like':'%'+_0x4f55a4[_0x63bb('0x2f')][_0x63bb('0x3a')]+'%'};return _0x43d5e7;})});}_0x240678=_[_0x63bb('0x3b')]({},_0x240678,_0x4f55a4[_0x63bb('0x45')]);return _0x2b8fe5[_0x63bb('0x51')](_0x240678);}})['then'](function(_0x1a8067){if(_0x1a8067){_0x26d262=_0x1a8067['length'];if(!_0x4f55a4['query'][_0x63bb('0x4e')](_0x63bb('0x37'))){_0x240678['limit']=qs[_0x63bb('0x1c')](_0x4f55a4[_0x63bb('0x2f')]['limit']);_0x240678[_0x63bb('0x1b')]=qs[_0x63bb('0x1b')](_0x4f55a4[_0x63bb('0x2f')][_0x63bb('0x1b')]);}return _0x2b8fe5[_0x63bb('0x51')](_0x240678);}})[_0x63bb('0x3e')](function(_0x249edd){if(_0x249edd){return _0x249edd?{'count':_0x26d262,'rows':_0x249edd}:null;}})[_0x63bb('0x3e')](respondWithResult(_0x4c0223,null))[_0x63bb('0x42')](handleError(_0x4c0223,null));};exports[_0x63bb('0x52')]=function(_0x3361fd,_0x348566,_0x1b3425){if(_0x3361fd[_0x63bb('0x48')]['id']){delete _0x3361fd['body']['id'];}return db[_0x63bb('0x2b')][_0x63bb('0x4b')]({'where':{'id':_0x3361fd['params']['id']}})['then'](handleEntityNotFound(_0x348566,null))['then'](function(_0x5f0ae3){if(_0x5f0ae3){return _0x5f0ae3['setTags'](_0x3361fd[_0x63bb('0x48')][_0x63bb('0x53')]||[]);}return null;})[_0x63bb('0x3e')](respondWithResult(_0x348566,null))['catch'](handleError(_0x348566,null));}; \ No newline at end of file +var _0x3d0a=['filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','sort','filter','where','options','rows','catch','params','fields','includeAll','include','merge','find','create','body','destroy','getFields','findOne','pick','ZendeskField','order','getSubjects','getDescriptions','getTags','Tag','ids','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','update','then','error','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','key','query','keys'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x3d0a,0x1a2));var _0xa3d0=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x3d0a[_0x58afd5];return _0x3e503b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa3d0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa3d0('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xa3d0('0x2'));var util=require(_0xa3d0('0x3'));var path=require(_0xa3d0('0x4'));var sox=require(_0xa3d0('0x5'));var csv=require(_0xa3d0('0x6'));var ejs=require(_0xa3d0('0x7'));var fs=require('fs');var fs_extra=require(_0xa3d0('0x8'));var _=require(_0xa3d0('0x9'));var squel=require(_0xa3d0('0xa'));var crypto=require(_0xa3d0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa3d0('0xc'));var toCsv=require(_0xa3d0('0x6'));var querystring=require(_0xa3d0('0xd'));var Papa=require(_0xa3d0('0xe'));var Redis=require(_0xa3d0('0xf'));var authService=require(_0xa3d0('0x10'));var qs=require(_0xa3d0('0x11'));var as=require(_0xa3d0('0x12'));var hardwareService=require(_0xa3d0('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa3d0('0x14'));var config=require(_0xa3d0('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa3d0('0x16'))['db'];function respondWithStatusCode(_0x245cb3,_0x39e63e){_0x39e63e=_0x39e63e||0xcc;return function(_0x1a01b){if(_0x1a01b){return _0x245cb3['sendStatus'](_0x39e63e);}return _0x245cb3[_0xa3d0('0x17')](_0x39e63e)[_0xa3d0('0x18')]();};}function respondWithResult(_0x124faf,_0x551105){_0x551105=_0x551105||0xc8;return function(_0x4edb89){if(_0x4edb89){return _0x124faf[_0xa3d0('0x17')](_0x551105)[_0xa3d0('0x19')](_0x4edb89);}};}function respondWithFilteredResult(_0x391f61,_0x2572b4){return function(_0x3a738f){if(_0x3a738f){var _0x19043d=typeof _0x2572b4[_0xa3d0('0x1a')]===_0xa3d0('0x1b')&&typeof _0x2572b4['limit']===_0xa3d0('0x1b');var _0x3a083d=_0x3a738f[_0xa3d0('0x1c')];var _0x2b65ba=_0x19043d?0x0:_0x2572b4[_0xa3d0('0x1a')];var _0x4a2b25=_0x19043d?_0x3a738f[_0xa3d0('0x1c')]:_0x2572b4['offset']+_0x2572b4['limit'];var _0x1952dd;if(_0x4a2b25>=_0x3a083d){_0x4a2b25=_0x3a083d;_0x1952dd=0xc8;}else{_0x1952dd=0xce;}_0x391f61[_0xa3d0('0x17')](_0x1952dd);return _0x391f61[_0xa3d0('0x1d')](_0xa3d0('0x1e'),_0x2b65ba+'-'+_0x4a2b25+'/'+_0x3a083d)[_0xa3d0('0x19')](_0x3a738f);}return null;};}function patchUpdates(_0x163bd6){return function(_0x5a6c3a){try{jsonpatch['apply'](_0x5a6c3a,_0x163bd6,!![]);}catch(_0x2ef599){return BPromise['reject'](_0x2ef599);}return _0x5a6c3a['save']();};}function saveUpdates(_0x567faa,_0x3b37f1){return function(_0x1cbb80){if(_0x1cbb80){return _0x1cbb80[_0xa3d0('0x1f')](_0x567faa)[_0xa3d0('0x20')](function(_0x113c08){return _0x113c08;});}return null;};}function removeEntity(_0x1f6d6a,_0x1cca26){return function(_0x34b404){if(_0x34b404){return _0x34b404['destroy']()[_0xa3d0('0x20')](function(){_0x1f6d6a[_0xa3d0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45bd0b,_0x4109a3){return function(_0x3302d0){if(!_0x3302d0){_0x45bd0b['sendStatus'](0x194);}return _0x3302d0;};}function handleError(_0x81fb2a,_0x2e6ca3){_0x2e6ca3=_0x2e6ca3||0x1f4;return function(_0x5e258b){logger[_0xa3d0('0x21')](_0x5e258b[_0xa3d0('0x22')]);if(_0x5e258b['name']){delete _0x5e258b[_0xa3d0('0x23')];}_0x81fb2a[_0xa3d0('0x17')](_0x2e6ca3)['send'](_0x5e258b);};}exports[_0xa3d0('0x24')]=function(_0x2156d0,_0x59b7b6){var _0x52b393={},_0x462e6b={},_0x1b6821={'count':0x0,'rows':[]};var _0x5b8525=_[_0xa3d0('0x25')](db[_0xa3d0('0x26')][_0xa3d0('0x27')],function(_0xf8a85c){return{'name':_0xf8a85c[_0xa3d0('0x28')],'type':_0xf8a85c['type'][_0xa3d0('0x29')]};});_0x462e6b['model']=_[_0xa3d0('0x25')](_0x5b8525,_0xa3d0('0x23'));_0x462e6b[_0xa3d0('0x2a')]=_[_0xa3d0('0x2b')](_0x2156d0[_0xa3d0('0x2a')]);_0x462e6b[_0xa3d0('0x2c')]=_[_0xa3d0('0x2d')](_0x462e6b[_0xa3d0('0x2e')],_0x462e6b[_0xa3d0('0x2a')]);_0x52b393[_0xa3d0('0x2f')]=_[_0xa3d0('0x2d')](_0x462e6b[_0xa3d0('0x2e')],qs['fields'](_0x2156d0[_0xa3d0('0x2a')]['fields']));_0x52b393[_0xa3d0('0x2f')]=_0x52b393['attributes'][_0xa3d0('0x30')]?_0x52b393[_0xa3d0('0x2f')]:_0x462e6b[_0xa3d0('0x2e')];if(!_0x2156d0[_0xa3d0('0x2a')][_0xa3d0('0x31')](_0xa3d0('0x32'))){_0x52b393[_0xa3d0('0x33')]=qs[_0xa3d0('0x33')](_0x2156d0['query']['limit']);_0x52b393[_0xa3d0('0x1a')]=qs[_0xa3d0('0x1a')](_0x2156d0['query']['offset']);}_0x52b393['order']=qs[_0xa3d0('0x34')](_0x2156d0[_0xa3d0('0x2a')]['sort']);_0x52b393['where']=qs[_0xa3d0('0x2c')](_['pick'](_0x2156d0[_0xa3d0('0x2a')],_0x462e6b[_0xa3d0('0x2c')]),_0x5b8525);if(_0x2156d0[_0xa3d0('0x2a')][_0xa3d0('0x35')]){_0x52b393[_0xa3d0('0x36')]=_['merge'](_0x52b393[_0xa3d0('0x36')],{'$or':_[_0xa3d0('0x25')](_0x5b8525,function(_0x1c9f53){if(_0x1c9f53['type']!=='VIRTUAL'){var _0x17dbe5={};_0x17dbe5[_0x1c9f53[_0xa3d0('0x23')]]={'$like':'%'+_0x2156d0[_0xa3d0('0x2a')]['filter']+'%'};return _0x17dbe5;}})});}_0x52b393=_['merge']({},_0x52b393,_0x2156d0[_0xa3d0('0x37')]);var _0x5768a6={'where':_0x52b393['where']};return db[_0xa3d0('0x26')][_0xa3d0('0x1c')](_0x5768a6)[_0xa3d0('0x20')](function(_0x4cfcc3){_0x1b6821[_0xa3d0('0x1c')]=_0x4cfcc3;if(_0x2156d0[_0xa3d0('0x2a')]['includeAll']){_0x52b393['include']=[{'all':!![]}];}return db[_0xa3d0('0x26')]['findAll'](_0x52b393);})[_0xa3d0('0x20')](function(_0x436c23){_0x1b6821[_0xa3d0('0x38')]=_0x436c23;return _0x1b6821;})[_0xa3d0('0x20')](respondWithFilteredResult(_0x59b7b6,_0x52b393))[_0xa3d0('0x39')](handleError(_0x59b7b6,null));};exports['show']=function(_0x1a7b14,_0x376499){var _0xbdc979={'raw':![],'where':{'id':_0x1a7b14[_0xa3d0('0x3a')]['id']}},_0x13d7cc={};_0x13d7cc['model']=_[_0xa3d0('0x2b')](db[_0xa3d0('0x26')][_0xa3d0('0x27')]);_0x13d7cc['query']=_['keys'](_0x1a7b14[_0xa3d0('0x2a')]);_0x13d7cc[_0xa3d0('0x2c')]=_[_0xa3d0('0x2d')](_0x13d7cc[_0xa3d0('0x2e')],_0x13d7cc[_0xa3d0('0x2a')]);_0xbdc979[_0xa3d0('0x2f')]=_[_0xa3d0('0x2d')](_0x13d7cc[_0xa3d0('0x2e')],qs[_0xa3d0('0x3b')](_0x1a7b14['query'][_0xa3d0('0x3b')]));_0xbdc979[_0xa3d0('0x2f')]=_0xbdc979[_0xa3d0('0x2f')]['length']?_0xbdc979[_0xa3d0('0x2f')]:_0x13d7cc[_0xa3d0('0x2e')];if(_0x1a7b14[_0xa3d0('0x2a')][_0xa3d0('0x3c')]){_0xbdc979[_0xa3d0('0x3d')]=[{'all':!![]}];}_0xbdc979=_[_0xa3d0('0x3e')]({},_0xbdc979,_0x1a7b14[_0xa3d0('0x37')]);return db[_0xa3d0('0x26')][_0xa3d0('0x3f')](_0xbdc979)['then'](handleEntityNotFound(_0x376499,null))['then'](respondWithResult(_0x376499,null))[_0xa3d0('0x39')](handleError(_0x376499,null));};exports[_0xa3d0('0x40')]=function(_0x56dcc8,_0x4319fd){return db[_0xa3d0('0x26')]['create'](_0x56dcc8['body'],{})[_0xa3d0('0x20')](respondWithResult(_0x4319fd,0xc9))[_0xa3d0('0x39')](handleError(_0x4319fd,null));};exports[_0xa3d0('0x1f')]=function(_0xb23314,_0x5a7d42){if(_0xb23314[_0xa3d0('0x41')]['id']){delete _0xb23314[_0xa3d0('0x41')]['id'];}return db[_0xa3d0('0x26')][_0xa3d0('0x3f')]({'where':{'id':_0xb23314[_0xa3d0('0x3a')]['id']}})[_0xa3d0('0x20')](handleEntityNotFound(_0x5a7d42,null))['then'](saveUpdates(_0xb23314[_0xa3d0('0x41')],null))[_0xa3d0('0x20')](respondWithResult(_0x5a7d42,null))[_0xa3d0('0x39')](handleError(_0x5a7d42,null));};exports[_0xa3d0('0x42')]=function(_0xf526bd,_0x5a1121){return db[_0xa3d0('0x26')][_0xa3d0('0x3f')]({'where':{'id':_0xf526bd[_0xa3d0('0x3a')]['id']}})[_0xa3d0('0x20')](handleEntityNotFound(_0x5a1121,null))[_0xa3d0('0x20')](removeEntity(_0x5a1121,null))[_0xa3d0('0x39')](handleError(_0x5a1121,null));};exports[_0xa3d0('0x43')]=function(_0x4f3080,_0xff547b,_0x43316e){var _0x2a7b4f={};var _0x39f260={};var _0x3f37de;var _0x4551d3;return db[_0xa3d0('0x26')][_0xa3d0('0x44')]({'where':{'id':_0x4f3080[_0xa3d0('0x3a')]['id']}})[_0xa3d0('0x20')](handleEntityNotFound(_0xff547b,null))['then'](function(_0x765a0f){if(_0x765a0f){_0x3f37de=_0x765a0f;_0x39f260['model']=_[_0xa3d0('0x2b')](db['ZendeskField']['rawAttributes']);_0x39f260[_0xa3d0('0x2a')]=_['keys'](_0x4f3080[_0xa3d0('0x2a')]);_0x39f260[_0xa3d0('0x2c')]=_[_0xa3d0('0x2d')](_0x39f260[_0xa3d0('0x2e')],_0x39f260[_0xa3d0('0x2a')]);_0x2a7b4f[_0xa3d0('0x2f')]=_[_0xa3d0('0x2d')](_0x39f260[_0xa3d0('0x2e')],qs['fields'](_0x4f3080[_0xa3d0('0x2a')][_0xa3d0('0x3b')]));_0x2a7b4f[_0xa3d0('0x2f')]=_0x2a7b4f[_0xa3d0('0x2f')][_0xa3d0('0x30')]?_0x2a7b4f[_0xa3d0('0x2f')]:_0x39f260['model'];_0x2a7b4f['order']=qs[_0xa3d0('0x34')](_0x4f3080[_0xa3d0('0x2a')]['sort']);_0x2a7b4f[_0xa3d0('0x36')]=qs[_0xa3d0('0x2c')](_[_0xa3d0('0x45')](_0x4f3080[_0xa3d0('0x2a')],_0x39f260['filters']));if(_0x4f3080[_0xa3d0('0x2a')][_0xa3d0('0x35')]){_0x2a7b4f[_0xa3d0('0x36')]=_[_0xa3d0('0x3e')](_0x2a7b4f[_0xa3d0('0x36')],{'$or':_['map'](_0x2a7b4f[_0xa3d0('0x2f')],function(_0x4269d2){var _0x1b6162={};_0x1b6162[_0x4269d2]={'$like':'%'+_0x4f3080['query'][_0xa3d0('0x35')]+'%'};return _0x1b6162;})});}_0x2a7b4f=_['merge']({},_0x2a7b4f,_0x4f3080[_0xa3d0('0x37')]);return _0x3f37de[_0xa3d0('0x43')](_0x2a7b4f);}})[_0xa3d0('0x20')](function(_0x5addee){if(_0x5addee){_0x4551d3=_0x5addee['length'];if(!_0x4f3080[_0xa3d0('0x2a')][_0xa3d0('0x31')](_0xa3d0('0x32'))){_0x2a7b4f[_0xa3d0('0x33')]=qs[_0xa3d0('0x33')](_0x4f3080[_0xa3d0('0x2a')]['limit']);_0x2a7b4f[_0xa3d0('0x1a')]=qs[_0xa3d0('0x1a')](_0x4f3080[_0xa3d0('0x2a')][_0xa3d0('0x1a')]);}return _0x3f37de[_0xa3d0('0x43')](_0x2a7b4f);}})[_0xa3d0('0x20')](function(_0x409f13){if(_0x409f13){return _0x409f13?{'count':_0x4551d3,'rows':_0x409f13}:null;}})[_0xa3d0('0x20')](respondWithResult(_0xff547b,null))[_0xa3d0('0x39')](handleError(_0xff547b,null));};exports['getSubjects']=function(_0x48cf29,_0x2a3c98,_0x162326){var _0x2b74c4={};var _0x1c72b1={};var _0x178648;var _0x12735e;return db[_0xa3d0('0x26')][_0xa3d0('0x44')]({'where':{'id':_0x48cf29[_0xa3d0('0x3a')]['id']}})['then'](handleEntityNotFound(_0x2a3c98,null))[_0xa3d0('0x20')](function(_0x12b4f3){if(_0x12b4f3){_0x178648=_0x12b4f3;_0x1c72b1[_0xa3d0('0x2e')]=_[_0xa3d0('0x2b')](db[_0xa3d0('0x46')][_0xa3d0('0x27')]);_0x1c72b1[_0xa3d0('0x2a')]=_[_0xa3d0('0x2b')](_0x48cf29[_0xa3d0('0x2a')]);_0x1c72b1[_0xa3d0('0x2c')]=_[_0xa3d0('0x2d')](_0x1c72b1[_0xa3d0('0x2e')],_0x1c72b1[_0xa3d0('0x2a')]);_0x2b74c4[_0xa3d0('0x2f')]=_['intersection'](_0x1c72b1[_0xa3d0('0x2e')],qs[_0xa3d0('0x3b')](_0x48cf29[_0xa3d0('0x2a')]['fields']));_0x2b74c4[_0xa3d0('0x2f')]=_0x2b74c4[_0xa3d0('0x2f')][_0xa3d0('0x30')]?_0x2b74c4[_0xa3d0('0x2f')]:_0x1c72b1[_0xa3d0('0x2e')];_0x2b74c4[_0xa3d0('0x47')]=qs[_0xa3d0('0x34')](_0x48cf29[_0xa3d0('0x2a')][_0xa3d0('0x34')]);_0x2b74c4[_0xa3d0('0x36')]=qs[_0xa3d0('0x2c')](_[_0xa3d0('0x45')](_0x48cf29[_0xa3d0('0x2a')],_0x1c72b1[_0xa3d0('0x2c')]));if(_0x48cf29[_0xa3d0('0x2a')][_0xa3d0('0x35')]){_0x2b74c4['where']=_['merge'](_0x2b74c4[_0xa3d0('0x36')],{'$or':_[_0xa3d0('0x25')](_0x2b74c4['attributes'],function(_0xdffecd){var _0xa57da7={};_0xa57da7[_0xdffecd]={'$like':'%'+_0x48cf29[_0xa3d0('0x2a')]['filter']+'%'};return _0xa57da7;})});}_0x2b74c4=_['merge']({},_0x2b74c4,_0x48cf29[_0xa3d0('0x37')]);return _0x178648['getSubjects'](_0x2b74c4);}})[_0xa3d0('0x20')](function(_0x11c1ca){if(_0x11c1ca){_0x12735e=_0x11c1ca['length'];if(!_0x48cf29[_0xa3d0('0x2a')][_0xa3d0('0x31')](_0xa3d0('0x32'))){_0x2b74c4['limit']=qs['limit'](_0x48cf29['query']['limit']);_0x2b74c4[_0xa3d0('0x1a')]=qs[_0xa3d0('0x1a')](_0x48cf29[_0xa3d0('0x2a')][_0xa3d0('0x1a')]);}return _0x178648[_0xa3d0('0x48')](_0x2b74c4);}})[_0xa3d0('0x20')](function(_0x4893e2){if(_0x4893e2){return _0x4893e2?{'count':_0x12735e,'rows':_0x4893e2}:null;}})['then'](respondWithResult(_0x2a3c98,null))[_0xa3d0('0x39')](handleError(_0x2a3c98,null));};exports[_0xa3d0('0x49')]=function(_0x8d98ea,_0x39b09b,_0x38bd29){var _0x57c705={};var _0x34277f={};var _0x3de934;var _0x3ced11;return db[_0xa3d0('0x26')][_0xa3d0('0x44')]({'where':{'id':_0x8d98ea['params']['id']}})[_0xa3d0('0x20')](handleEntityNotFound(_0x39b09b,null))[_0xa3d0('0x20')](function(_0x26f6c5){if(_0x26f6c5){_0x3de934=_0x26f6c5;_0x34277f[_0xa3d0('0x2e')]=_['keys'](db[_0xa3d0('0x46')]['rawAttributes']);_0x34277f[_0xa3d0('0x2a')]=_[_0xa3d0('0x2b')](_0x8d98ea[_0xa3d0('0x2a')]);_0x34277f[_0xa3d0('0x2c')]=_[_0xa3d0('0x2d')](_0x34277f[_0xa3d0('0x2e')],_0x34277f[_0xa3d0('0x2a')]);_0x57c705['attributes']=_[_0xa3d0('0x2d')](_0x34277f[_0xa3d0('0x2e')],qs['fields'](_0x8d98ea[_0xa3d0('0x2a')][_0xa3d0('0x3b')]));_0x57c705[_0xa3d0('0x2f')]=_0x57c705[_0xa3d0('0x2f')][_0xa3d0('0x30')]?_0x57c705[_0xa3d0('0x2f')]:_0x34277f[_0xa3d0('0x2e')];_0x57c705[_0xa3d0('0x47')]=qs[_0xa3d0('0x34')](_0x8d98ea[_0xa3d0('0x2a')][_0xa3d0('0x34')]);_0x57c705['where']=qs[_0xa3d0('0x2c')](_['pick'](_0x8d98ea['query'],_0x34277f[_0xa3d0('0x2c')]));if(_0x8d98ea[_0xa3d0('0x2a')][_0xa3d0('0x35')]){_0x57c705[_0xa3d0('0x36')]=_[_0xa3d0('0x3e')](_0x57c705[_0xa3d0('0x36')],{'$or':_[_0xa3d0('0x25')](_0x57c705[_0xa3d0('0x2f')],function(_0x2c62bb){var _0x23e5d9={};_0x23e5d9[_0x2c62bb]={'$like':'%'+_0x8d98ea[_0xa3d0('0x2a')][_0xa3d0('0x35')]+'%'};return _0x23e5d9;})});}_0x57c705=_[_0xa3d0('0x3e')]({},_0x57c705,_0x8d98ea['options']);return _0x3de934[_0xa3d0('0x49')](_0x57c705);}})['then'](function(_0x4e4478){if(_0x4e4478){_0x3ced11=_0x4e4478[_0xa3d0('0x30')];if(!_0x8d98ea[_0xa3d0('0x2a')]['hasOwnProperty']('nolimit')){_0x57c705[_0xa3d0('0x33')]=qs[_0xa3d0('0x33')](_0x8d98ea[_0xa3d0('0x2a')][_0xa3d0('0x33')]);_0x57c705[_0xa3d0('0x1a')]=qs[_0xa3d0('0x1a')](_0x8d98ea[_0xa3d0('0x2a')][_0xa3d0('0x1a')]);}return _0x3de934[_0xa3d0('0x49')](_0x57c705);}})[_0xa3d0('0x20')](function(_0x54d6c8){if(_0x54d6c8){return _0x54d6c8?{'count':_0x3ced11,'rows':_0x54d6c8}:null;}})[_0xa3d0('0x20')](respondWithResult(_0x39b09b,null))[_0xa3d0('0x39')](handleError(_0x39b09b,null));};exports[_0xa3d0('0x4a')]=function(_0x498e0e,_0x2641bb,_0x4c78c8){var _0x48b49a={};var _0x42ba8a={};var _0x12cabc;var _0x2ca1cb;return db[_0xa3d0('0x26')]['findOne']({'where':{'id':_0x498e0e['params']['id']}})[_0xa3d0('0x20')](handleEntityNotFound(_0x2641bb,null))[_0xa3d0('0x20')](function(_0x27cac1){if(_0x27cac1){_0x12cabc=_0x27cac1;_0x42ba8a['model']=_['keys'](db[_0xa3d0('0x4b')]['rawAttributes']);_0x42ba8a[_0xa3d0('0x2a')]=_[_0xa3d0('0x2b')](_0x498e0e[_0xa3d0('0x2a')]);_0x42ba8a[_0xa3d0('0x2c')]=_[_0xa3d0('0x2d')](_0x42ba8a[_0xa3d0('0x2e')],_0x42ba8a[_0xa3d0('0x2a')]);_0x48b49a[_0xa3d0('0x2f')]=_[_0xa3d0('0x2d')](_0x42ba8a[_0xa3d0('0x2e')],qs[_0xa3d0('0x3b')](_0x498e0e[_0xa3d0('0x2a')]['fields']));_0x48b49a[_0xa3d0('0x2f')]=_0x48b49a['attributes'][_0xa3d0('0x30')]?_0x48b49a[_0xa3d0('0x2f')]:_0x42ba8a[_0xa3d0('0x2e')];_0x48b49a[_0xa3d0('0x47')]=qs[_0xa3d0('0x34')](_0x498e0e[_0xa3d0('0x2a')][_0xa3d0('0x34')]);_0x48b49a[_0xa3d0('0x36')]=qs[_0xa3d0('0x2c')](_[_0xa3d0('0x45')](_0x498e0e[_0xa3d0('0x2a')],_0x42ba8a[_0xa3d0('0x2c')]));if(_0x498e0e[_0xa3d0('0x2a')][_0xa3d0('0x35')]){_0x48b49a[_0xa3d0('0x36')]=_[_0xa3d0('0x3e')](_0x48b49a[_0xa3d0('0x36')],{'$or':_[_0xa3d0('0x25')](_0x48b49a[_0xa3d0('0x2f')],function(_0xe13ed5){var _0x295178={};_0x295178[_0xe13ed5]={'$like':'%'+_0x498e0e[_0xa3d0('0x2a')][_0xa3d0('0x35')]+'%'};return _0x295178;})});}_0x48b49a=_['merge']({},_0x48b49a,_0x498e0e[_0xa3d0('0x37')]);return _0x12cabc[_0xa3d0('0x4a')](_0x48b49a);}})[_0xa3d0('0x20')](function(_0x3fe150){if(_0x3fe150){_0x2ca1cb=_0x3fe150[_0xa3d0('0x30')];if(!_0x498e0e[_0xa3d0('0x2a')][_0xa3d0('0x31')]('nolimit')){_0x48b49a[_0xa3d0('0x33')]=qs[_0xa3d0('0x33')](_0x498e0e[_0xa3d0('0x2a')][_0xa3d0('0x33')]);_0x48b49a[_0xa3d0('0x1a')]=qs[_0xa3d0('0x1a')](_0x498e0e['query'][_0xa3d0('0x1a')]);}return _0x12cabc[_0xa3d0('0x4a')](_0x48b49a);}})[_0xa3d0('0x20')](function(_0x1c3faa){if(_0x1c3faa){return _0x1c3faa?{'count':_0x2ca1cb,'rows':_0x1c3faa}:null;}})[_0xa3d0('0x20')](respondWithResult(_0x2641bb,null))[_0xa3d0('0x39')](handleError(_0x2641bb,null));};exports['setTags']=function(_0x3f788d,_0x140883,_0xa47eda){if(_0x3f788d[_0xa3d0('0x41')]['id']){delete _0x3f788d[_0xa3d0('0x41')]['id'];}return db[_0xa3d0('0x26')][_0xa3d0('0x44')]({'where':{'id':_0x3f788d[_0xa3d0('0x3a')]['id']}})['then'](handleEntityNotFound(_0x140883,null))[_0xa3d0('0x20')](function(_0x5bd27e){if(_0x5bd27e){return _0x5bd27e['setTags'](_0x3f788d[_0xa3d0('0x41')][_0xa3d0('0x4c')]||[]);}return null;})[_0xa3d0('0x20')](respondWithResult(_0x140883,null))[_0xa3d0('0x39')](handleError(_0x140883,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 350c4a2..040c076 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 _0x3266=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','define','int_zendesk_configurations','lodash','util'];(function(_0x10e8ea,_0x8c8d4f){var _0x29d7d8=function(_0x3e124a){while(--_0x3e124a){_0x10e8ea['push'](_0x10e8ea['shift']());}};_0x29d7d8(++_0x8c8d4f);}(_0x3266,0x6a));var _0x6326=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0x3266[_0x59d0cc];return _0x2ae79f;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var logger=require(_0x6326('0x2'))(_0x6326('0x3'));var moment=require(_0x6326('0x4'));var BPromise=require(_0x6326('0x5'));var rp=require(_0x6326('0x6'));var fs=require('fs');var path=require(_0x6326('0x7'));var rimraf=require(_0x6326('0x8'));var config=require('../../config/environment');var attributes=require(_0x6326('0x9'));module['exports']=function(_0x25ecd8,_0x44460c){return _0x25ecd8[_0x6326('0xa')]('ZendeskConfiguration',attributes,{'tableName':_0x6326('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0598=['ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','request-promise','path','exports'];(function(_0x1dd532,_0x36e81c){var _0x3732aa=function(_0x19d50a){while(--_0x19d50a){_0x1dd532['push'](_0x1dd532['shift']());}};_0x3732aa(++_0x36e81c);}(_0x0598,0x92));var _0x8059=function(_0x307ec1,_0x50dd64){_0x307ec1=_0x307ec1-0x0;var _0x10c790=_0x0598[_0x307ec1];return _0x10c790;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var logger=require('../../config/logger')(_0x8059('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8059('0x3'));var fs=require('fs');var path=require(_0x8059('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module[_0x8059('0x5')]=function(_0xa7d7c1,_0x512c0f){return _0xa7d7c1['define'](_0x8059('0x6'),attributes,{'tableName':_0x8059('0x7'),'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 043b97e..de3ef86 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 _0x2e9d=['message','info','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3cb43a,_0x7b8d1d){var _0x1a3d90=function(_0x3d50c6){while(--_0x3d50c6){_0x3cb43a['push'](_0x3cb43a['shift']());}};_0x1a3d90(++_0x7b8d1d);}(_0x2e9d,0x194));var _0xd2e9=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x2e9d[_0x1b4b23];return _0x2a325b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd2e9('0x0'));var BPromise=require('bluebird');var rs=require(_0xd2e9('0x1'));var fs=require('fs');var Redis=require(_0xd2e9('0x2'));var db=require(_0xd2e9('0x3'))['db'];var utils=require(_0xd2e9('0x4'));var logger=require('../../config/logger')(_0xd2e9('0x5'));var config=require(_0xd2e9('0x6'));var jayson=require(_0xd2e9('0x7'));var client=jayson[_0xd2e9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x168ce8,_0x44b422,_0x255b8f){return new BPromise(function(_0x571246,_0x33c712){return client['request'](_0x168ce8,_0x255b8f)[_0xd2e9('0x9')](function(_0x43d525){logger['info'](_0xd2e9('0xa'),_0x44b422,_0xd2e9('0xb'));logger[_0xd2e9('0xc')](_0xd2e9('0xd'),_0x44b422,_0xd2e9('0xb'),JSON['stringify'](_0x43d525));if(_0x43d525[_0xd2e9('0xe')]){if(_0x43d525[_0xd2e9('0xe')][_0xd2e9('0xf')]===0x1f4){logger[_0xd2e9('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x44b422,_0x43d525[_0xd2e9('0xe')][_0xd2e9('0x10')]);return _0x33c712(_0x43d525[_0xd2e9('0xe')][_0xd2e9('0x10')]);}logger[_0xd2e9('0xe')](_0xd2e9('0xa'),_0x44b422,_0x43d525[_0xd2e9('0xe')]['message']);return _0x571246(_0x43d525[_0xd2e9('0xe')][_0xd2e9('0x10')]);}else{logger[_0xd2e9('0x11')](_0xd2e9('0xa'),_0x44b422,_0xd2e9('0xb'));_0x571246(_0x43d525[_0xd2e9('0x12')]['message']);}})[_0xd2e9('0x13')](function(_0x14df8b){logger[_0xd2e9('0xe')](_0xd2e9('0xa'),_0x44b422,_0x14df8b);_0x33c712(_0x14df8b);});});} \ No newline at end of file +var _0x3387=['error','code','message','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','debug'];(function(_0x4704dc,_0x575a5f){var _0x254d81=function(_0x3b135d){while(--_0x3b135d){_0x4704dc['push'](_0x4704dc['shift']());}};_0x254d81(++_0x575a5f);}(_0x3387,0x132));var _0x7338=function(_0x409e8d,_0xe77668){_0x409e8d=_0x409e8d-0x0;var _0x23da8c=_0x3387[_0x409e8d];return _0x23da8c;};'use strict';var _=require('lodash');var util=require(_0x7338('0x0'));var moment=require(_0x7338('0x1'));var BPromise=require(_0x7338('0x2'));var rs=require(_0x7338('0x3'));var fs=require('fs');var Redis=require(_0x7338('0x4'));var db=require(_0x7338('0x5'))['db'];var utils=require(_0x7338('0x6'));var logger=require(_0x7338('0x7'))(_0x7338('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7338('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5edca8,_0x35809f,_0x564a83){return new BPromise(function(_0x23d078,_0xcd2fed){return client[_0x7338('0xa')](_0x5edca8,_0x564a83)[_0x7338('0xb')](function(_0x448091){logger[_0x7338('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x35809f,'request\x20sent');logger[_0x7338('0xd')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x35809f,'request\x20sent',JSON['stringify'](_0x448091));if(_0x448091[_0x7338('0xe')]){if(_0x448091[_0x7338('0xe')][_0x7338('0xf')]===0x1f4){logger[_0x7338('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x35809f,_0x448091[_0x7338('0xe')]['message']);return _0xcd2fed(_0x448091[_0x7338('0xe')][_0x7338('0x10')]);}logger[_0x7338('0xe')](_0x7338('0x11'),_0x35809f,_0x448091[_0x7338('0xe')][_0x7338('0x10')]);return _0x23d078(_0x448091[_0x7338('0xe')][_0x7338('0x10')]);}else{logger[_0x7338('0xc')](_0x7338('0x11'),_0x35809f,_0x7338('0x12'));_0x23d078(_0x448091[_0x7338('0x13')]['message']);}})['catch'](function(_0x2b3641){logger[_0x7338('0xe')](_0x7338('0x11'),_0x35809f,_0x2b3641);_0xcd2fed(_0x2b3641);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 142edac..c91cd7e 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 _0x6c28=['Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x323050,_0x2c4a3a){var _0xe62f56=function(_0x2963b4){while(--_0x2963b4){_0x323050['push'](_0x323050['shift']());}};_0xe62f56(++_0x2c4a3a);}(_0x6c28,0x14b));var _0x86c2=function(_0x3171ae,_0x22d127){_0x3171ae=_0x3171ae-0x0;var _0x1b0f0f=_0x6c28[_0x3171ae];return _0x1b0f0f;};'use strict';var multer=require(_0x86c2('0x0'));var util=require(_0x86c2('0x1'));var path=require(_0x86c2('0x2'));var timeout=require(_0x86c2('0x3'));var express=require(_0x86c2('0x4'));var router=express[_0x86c2('0x5')]();var fs_extra=require(_0x86c2('0x6'));var auth=require(_0x86c2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x86c2('0x8'));var controller=require(_0x86c2('0x9'));router['get']('/',auth[_0x86c2('0xa')](),controller[_0x86c2('0xb')]);router[_0x86c2('0xc')](_0x86c2('0xd'),auth[_0x86c2('0xa')](),controller[_0x86c2('0xe')]);router[_0x86c2('0xf')]('/',auth[_0x86c2('0xa')](),controller[_0x86c2('0x10')]);router[_0x86c2('0x11')](_0x86c2('0xd'),auth[_0x86c2('0xa')](),controller[_0x86c2('0x12')]);router[_0x86c2('0x13')](_0x86c2('0xd'),auth[_0x86c2('0xa')](),controller['destroy']);module[_0x86c2('0x14')]=router; \ No newline at end of file +var _0x4bc9=['put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x3dacb8,_0x48eab5){var _0x16d5a0=function(_0x1397bf){while(--_0x1397bf){_0x3dacb8['push'](_0x3dacb8['shift']());}};_0x16d5a0(++_0x48eab5);}(_0x4bc9,0x135));var _0x94bc=function(_0x57a35a,_0x7eb9b1){_0x57a35a=_0x57a35a-0x0;var _0x4abe87=_0x4bc9[_0x57a35a];return _0x4abe87;};'use strict';var multer=require(_0x94bc('0x0'));var util=require(_0x94bc('0x1'));var path=require(_0x94bc('0x2'));var timeout=require('connect-timeout');var express=require(_0x94bc('0x3'));var router=express[_0x94bc('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x94bc('0x5'));var config=require(_0x94bc('0x6'));var controller=require(_0x94bc('0x7'));router[_0x94bc('0x8')]('/',auth[_0x94bc('0x9')](),controller[_0x94bc('0xa')]);router[_0x94bc('0x8')](_0x94bc('0xb'),auth['isAuthenticated'](),controller[_0x94bc('0xc')]);router['post']('/',auth[_0x94bc('0x9')](),controller[_0x94bc('0xd')]);router[_0x94bc('0xe')](_0x94bc('0xb'),auth['isAuthenticated'](),controller[_0x94bc('0xf')]);router[_0x94bc('0x10')](_0x94bc('0xb'),auth[_0x94bc('0x9')](),controller[_0x94bc('0x11')]);module[_0x94bc('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index a737317..f9b704e 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 _0x56bb=['picklist','STRING','variable','BOOLEAN','ENUM','string','keyValue'];(function(_0x971c6e,_0x5860f9){var _0x19e2a6=function(_0x75f958){while(--_0x75f958){_0x971c6e['push'](_0x971c6e['shift']());}};_0x19e2a6(++_0x5860f9);}(_0x56bb,0xa5));var _0xb56b=function(_0x1871a5,_0x2eab89){_0x1871a5=_0x1871a5-0x0;var _0x10509e=_0x56bb[_0x1871a5];return _0x10509e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb56b('0x0')](_0xb56b('0x1'),'variable','customVariable',_0xb56b('0x2'),_0xb56b('0x3')),'defaultValue':_0xb56b('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb56b('0x4')]},'keyType':{'type':Sequelize[_0xb56b('0x0')]('string',_0xb56b('0x5'),'customVariable')},'keyContent':{'type':Sequelize[_0xb56b('0x4')]},'idField':{'type':Sequelize[_0xb56b('0x4')]},'nameField':{'type':Sequelize[_0xb56b('0x4')]},'customField':{'type':Sequelize[_0xb56b('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb56b('0x4')]}}; \ No newline at end of file +var _0xe58e=['ENUM','string','variable','customVariable','keyValue','STRING','sequelize','exports'];(function(_0x27289f,_0x2c7e98){var _0x45e652=function(_0x4124ea){while(--_0x4124ea){_0x27289f['push'](_0x27289f['shift']());}};_0x45e652(++_0x2c7e98);}(_0xe58e,0x15e));var _0xee58=function(_0x3bc904,_0x4b694a){_0x3bc904=_0x3bc904-0x0;var _0x262536=_0xe58e[_0x3bc904];return _0x262536;};'use strict';var Sequelize=require(_0xee58('0x0'));module[_0xee58('0x1')]={'type':{'type':Sequelize[_0xee58('0x2')](_0xee58('0x3'),_0xee58('0x4'),_0xee58('0x5'),_0xee58('0x6'),'picklist'),'defaultValue':_0xee58('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xee58('0x7')]},'keyType':{'type':Sequelize[_0xee58('0x2')](_0xee58('0x3'),'variable',_0xee58('0x5'))},'keyContent':{'type':Sequelize[_0xee58('0x7')]},'idField':{'type':Sequelize[_0xee58('0x7')]},'nameField':{'type':Sequelize[_0xee58('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xee58('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 1c71716..8318478 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 _0x3306=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','includeAll','include','findAll','rows','catch','show','options','create','body','update','params','eml-format','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x25953b,_0x48121a){var _0x340562=function(_0x39dcad){while(--_0x39dcad){_0x25953b['push'](_0x25953b['shift']());}};_0x340562(++_0x48121a);}(_0x3306,0x1ec));var _0x6330=function(_0x4a5101,_0x22e9e3){_0x4a5101=_0x4a5101-0x0;var _0x33ea5b=_0x3306[_0x4a5101];return _0x33ea5b;};'use strict';var emlformat=require(_0x6330('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6330('0x1'));var rp=require('request-promise');var moment=require(_0x6330('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6330('0x3'));var util=require(_0x6330('0x4'));var path=require('path');var sox=require(_0x6330('0x5'));var csv=require(_0x6330('0x6'));var ejs=require(_0x6330('0x7'));var fs=require('fs');var fs_extra=require(_0x6330('0x8'));var _=require(_0x6330('0x9'));var squel=require(_0x6330('0xa'));var crypto=require(_0x6330('0xb'));var jsforce=require(_0x6330('0xc'));var deskjs=require(_0x6330('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6330('0xe'));var Papa=require('papaparse');var Redis=require(_0x6330('0xf'));var authService=require(_0x6330('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6330('0x11'));var hardwareService=require(_0x6330('0x12'));var logger=require(_0x6330('0x13'))(_0x6330('0x14'));var utils=require(_0x6330('0x15'));var config=require(_0x6330('0x16'));var licenseUtil=require(_0x6330('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1962c9,_0x47f0a5){_0x47f0a5=_0x47f0a5||0xcc;return function(_0x55a31c){if(_0x55a31c){return _0x1962c9[_0x6330('0x18')](_0x47f0a5);}return _0x1962c9[_0x6330('0x19')](_0x47f0a5)['end']();};}function respondWithResult(_0x1788a7,_0x16f5ee){_0x16f5ee=_0x16f5ee||0xc8;return function(_0x4fb14e){if(_0x4fb14e){return _0x1788a7[_0x6330('0x19')](_0x16f5ee)[_0x6330('0x1a')](_0x4fb14e);}};}function respondWithFilteredResult(_0x3b4964,_0x1173c1){return function(_0x52ae91){if(_0x52ae91){var _0x35f02a=typeof _0x1173c1[_0x6330('0x1b')]===_0x6330('0x1c')&&typeof _0x1173c1[_0x6330('0x1d')]===_0x6330('0x1c');var _0x2934ec=_0x52ae91[_0x6330('0x1e')];var _0x3c4c48=_0x35f02a?0x0:_0x1173c1[_0x6330('0x1b')];var _0x32a3ca=_0x35f02a?_0x52ae91['count']:_0x1173c1[_0x6330('0x1b')]+_0x1173c1[_0x6330('0x1d')];var _0x4802c1;if(_0x32a3ca>=_0x2934ec){_0x32a3ca=_0x2934ec;_0x4802c1=0xc8;}else{_0x4802c1=0xce;}_0x3b4964[_0x6330('0x19')](_0x4802c1);return _0x3b4964[_0x6330('0x1f')](_0x6330('0x20'),_0x3c4c48+'-'+_0x32a3ca+'/'+_0x2934ec)['json'](_0x52ae91);}return null;};}function patchUpdates(_0x1bf579){return function(_0x37c8c4){try{jsonpatch[_0x6330('0x21')](_0x37c8c4,_0x1bf579,!![]);}catch(_0x2d02df){return BPromise['reject'](_0x2d02df);}return _0x37c8c4['save']();};}function saveUpdates(_0x53cda1,_0x3f2615){return function(_0x25ecac){if(_0x25ecac){return _0x25ecac['update'](_0x53cda1)[_0x6330('0x22')](function(_0x5553df){return _0x5553df;});}return null;};}function removeEntity(_0x41a355,_0x51a2ce){return function(_0x3fb4ef){if(_0x3fb4ef){return _0x3fb4ef[_0x6330('0x23')]()[_0x6330('0x22')](function(){_0x41a355['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x68096a,_0x368871){return function(_0x5bcd2c){if(!_0x5bcd2c){_0x68096a[_0x6330('0x18')](0x194);}return _0x5bcd2c;};}function handleError(_0x508e41,_0x414e8d){_0x414e8d=_0x414e8d||0x1f4;return function(_0x7e600c){logger[_0x6330('0x24')](_0x7e600c[_0x6330('0x25')]);if(_0x7e600c[_0x6330('0x26')]){delete _0x7e600c['name'];}_0x508e41[_0x6330('0x19')](_0x414e8d)[_0x6330('0x27')](_0x7e600c);};}exports[_0x6330('0x28')]=function(_0x207bf5,_0x2e9201){var _0x45d56b={},_0x388830={},_0x39c205={'count':0x0,'rows':[]};var _0x5841e5=_[_0x6330('0x29')](db[_0x6330('0x2a')][_0x6330('0x2b')],function(_0x16c076){return{'name':_0x16c076[_0x6330('0x2c')],'type':_0x16c076['type'][_0x6330('0x2d')]};});_0x388830['model']=_['map'](_0x5841e5,_0x6330('0x26'));_0x388830[_0x6330('0x2e')]=_[_0x6330('0x2f')](_0x207bf5[_0x6330('0x2e')]);_0x388830[_0x6330('0x30')]=_[_0x6330('0x31')](_0x388830[_0x6330('0x32')],_0x388830['query']);_0x45d56b[_0x6330('0x33')]=_[_0x6330('0x31')](_0x388830[_0x6330('0x32')],qs['fields'](_0x207bf5[_0x6330('0x2e')][_0x6330('0x34')]));_0x45d56b[_0x6330('0x33')]=_0x45d56b[_0x6330('0x33')]['length']?_0x45d56b[_0x6330('0x33')]:_0x388830[_0x6330('0x32')];if(!_0x207bf5[_0x6330('0x2e')][_0x6330('0x35')](_0x6330('0x36'))){_0x45d56b[_0x6330('0x1d')]=qs[_0x6330('0x1d')](_0x207bf5[_0x6330('0x2e')][_0x6330('0x1d')]);_0x45d56b[_0x6330('0x1b')]=qs['offset'](_0x207bf5[_0x6330('0x2e')][_0x6330('0x1b')]);}_0x45d56b[_0x6330('0x37')]=qs[_0x6330('0x38')](_0x207bf5['query'][_0x6330('0x38')]);_0x45d56b[_0x6330('0x39')]=qs['filters'](_['pick'](_0x207bf5[_0x6330('0x2e')],_0x388830[_0x6330('0x30')]),_0x5841e5);if(_0x207bf5[_0x6330('0x2e')][_0x6330('0x3a')]){_0x45d56b[_0x6330('0x39')]=_['merge'](_0x45d56b[_0x6330('0x39')],{'$or':_['map'](_0x5841e5,function(_0x6846d){if(_0x6846d[_0x6330('0x3b')]!=='VIRTUAL'){var _0x30d60e={};_0x30d60e[_0x6846d[_0x6330('0x26')]]={'$like':'%'+_0x207bf5['query']['filter']+'%'};return _0x30d60e;}})});}_0x45d56b=_[_0x6330('0x3c')]({},_0x45d56b,_0x207bf5['options']);var _0x59bb9b={'where':_0x45d56b[_0x6330('0x39')]};return db[_0x6330('0x2a')]['count'](_0x59bb9b)[_0x6330('0x22')](function(_0x388dbf){_0x39c205[_0x6330('0x1e')]=_0x388dbf;if(_0x207bf5[_0x6330('0x2e')][_0x6330('0x3d')]){_0x45d56b[_0x6330('0x3e')]=[{'all':!![]}];}return db[_0x6330('0x2a')][_0x6330('0x3f')](_0x45d56b);})[_0x6330('0x22')](function(_0x45cc6f){_0x39c205[_0x6330('0x40')]=_0x45cc6f;return _0x39c205;})[_0x6330('0x22')](respondWithFilteredResult(_0x2e9201,_0x45d56b))[_0x6330('0x41')](handleError(_0x2e9201,null));};exports[_0x6330('0x42')]=function(_0x418e56,_0x2f8125){var _0x408f79={'raw':!![],'where':{'id':_0x418e56['params']['id']}},_0x324f75={};_0x324f75['model']=_[_0x6330('0x2f')](db[_0x6330('0x2a')]['rawAttributes']);_0x324f75[_0x6330('0x2e')]=_[_0x6330('0x2f')](_0x418e56['query']);_0x324f75[_0x6330('0x30')]=_['intersection'](_0x324f75[_0x6330('0x32')],_0x324f75[_0x6330('0x2e')]);_0x408f79['attributes']=_['intersection'](_0x324f75[_0x6330('0x32')],qs[_0x6330('0x34')](_0x418e56[_0x6330('0x2e')][_0x6330('0x34')]));_0x408f79[_0x6330('0x33')]=_0x408f79[_0x6330('0x33')]['length']?_0x408f79[_0x6330('0x33')]:_0x324f75[_0x6330('0x32')];if(_0x418e56[_0x6330('0x2e')]['includeAll']){_0x408f79['include']=[{'all':!![]}];}_0x408f79=_[_0x6330('0x3c')]({},_0x408f79,_0x418e56[_0x6330('0x43')]);return db[_0x6330('0x2a')]['find'](_0x408f79)['then'](handleEntityNotFound(_0x2f8125,null))['then'](respondWithResult(_0x2f8125,null))['catch'](handleError(_0x2f8125,null));};exports['create']=function(_0x29b7a0,_0x880f7e){return db[_0x6330('0x2a')][_0x6330('0x44')](_0x29b7a0[_0x6330('0x45')],{})['then'](respondWithResult(_0x880f7e,0xc9))['catch'](handleError(_0x880f7e,null));};exports[_0x6330('0x46')]=function(_0x58e119,_0x3f66ef){if(_0x58e119[_0x6330('0x45')]['id']){delete _0x58e119['body']['id'];}return db[_0x6330('0x2a')]['find']({'where':{'id':_0x58e119[_0x6330('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f66ef,null))['then'](saveUpdates(_0x58e119[_0x6330('0x45')],null))[_0x6330('0x22')](respondWithResult(_0x3f66ef,null))[_0x6330('0x41')](handleError(_0x3f66ef,null));};exports[_0x6330('0x23')]=function(_0x28bba4,_0x575f37){return db[_0x6330('0x2a')]['find']({'where':{'id':_0x28bba4[_0x6330('0x47')]['id']}})[_0x6330('0x22')](handleEntityNotFound(_0x575f37,null))[_0x6330('0x22')](removeEntity(_0x575f37,null))['catch'](handleError(_0x575f37,null));}; \ No newline at end of file +var _0xcfef=['findAll','rows','catch','show','params','keys','includeAll','merge','find','create','body','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','name','index','map','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','VIRTUAL','filter','options','ZendeskField','include'];(function(_0x328dfa,_0x12a11c){var _0x20a126=function(_0x38a7f2){while(--_0x38a7f2){_0x328dfa['push'](_0x328dfa['shift']());}};_0x20a126(++_0x12a11c);}(_0xcfef,0x1b5));var _0xfcfe=function(_0x1524b6,_0x13a5ae){_0x1524b6=_0x1524b6-0x0;var _0x352f95=_0xcfef[_0x1524b6];return _0x352f95;};'use strict';var emlformat=require(_0xfcfe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfcfe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfcfe('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfcfe('0x3'));var util=require(_0xfcfe('0x4'));var path=require(_0xfcfe('0x5'));var sox=require(_0xfcfe('0x6'));var csv=require(_0xfcfe('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfcfe('0x8'));var _=require(_0xfcfe('0x9'));var squel=require(_0xfcfe('0xa'));var crypto=require(_0xfcfe('0xb'));var jsforce=require(_0xfcfe('0xc'));var deskjs=require(_0xfcfe('0xd'));var toCsv=require(_0xfcfe('0x7'));var querystring=require(_0xfcfe('0xe'));var Papa=require(_0xfcfe('0xf'));var Redis=require(_0xfcfe('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfcfe('0x11'));var as=require(_0xfcfe('0x12'));var hardwareService=require(_0xfcfe('0x13'));var logger=require(_0xfcfe('0x14'))(_0xfcfe('0x15'));var utils=require(_0xfcfe('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfcfe('0x17'))['db'];function respondWithStatusCode(_0x34951e,_0x98ac0d){_0x98ac0d=_0x98ac0d||0xcc;return function(_0x4c146e){if(_0x4c146e){return _0x34951e[_0xfcfe('0x18')](_0x98ac0d);}return _0x34951e[_0xfcfe('0x19')](_0x98ac0d)[_0xfcfe('0x1a')]();};}function respondWithResult(_0x546028,_0x3704bc){_0x3704bc=_0x3704bc||0xc8;return function(_0xdc15e8){if(_0xdc15e8){return _0x546028[_0xfcfe('0x19')](_0x3704bc)[_0xfcfe('0x1b')](_0xdc15e8);}};}function respondWithFilteredResult(_0x47f60c,_0x2f83e5){return function(_0x4f56c8){if(_0x4f56c8){var _0x54f5db=typeof _0x2f83e5[_0xfcfe('0x1c')]===_0xfcfe('0x1d')&&typeof _0x2f83e5[_0xfcfe('0x1e')]===_0xfcfe('0x1d');var _0x2d8327=_0x4f56c8['count'];var _0x308538=_0x54f5db?0x0:_0x2f83e5[_0xfcfe('0x1c')];var _0x1ee3bf=_0x54f5db?_0x4f56c8[_0xfcfe('0x1f')]:_0x2f83e5[_0xfcfe('0x1c')]+_0x2f83e5[_0xfcfe('0x1e')];var _0x1249ef;if(_0x1ee3bf>=_0x2d8327){_0x1ee3bf=_0x2d8327;_0x1249ef=0xc8;}else{_0x1249ef=0xce;}_0x47f60c[_0xfcfe('0x19')](_0x1249ef);return _0x47f60c[_0xfcfe('0x20')](_0xfcfe('0x21'),_0x308538+'-'+_0x1ee3bf+'/'+_0x2d8327)[_0xfcfe('0x1b')](_0x4f56c8);}return null;};}function patchUpdates(_0x2fbc35){return function(_0x579cf8){try{jsonpatch[_0xfcfe('0x22')](_0x579cf8,_0x2fbc35,!![]);}catch(_0x3e788a){return BPromise[_0xfcfe('0x23')](_0x3e788a);}return _0x579cf8[_0xfcfe('0x24')]();};}function saveUpdates(_0x264c5a,_0x346fb5){return function(_0x35e2b3){if(_0x35e2b3){return _0x35e2b3['update'](_0x264c5a)[_0xfcfe('0x25')](function(_0x53b6f5){return _0x53b6f5;});}return null;};}function removeEntity(_0x33bc0c,_0x823664){return function(_0x444347){if(_0x444347){return _0x444347[_0xfcfe('0x26')]()['then'](function(){_0x33bc0c[_0xfcfe('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3147a9,_0x56a56c){return function(_0x816c78){if(!_0x816c78){_0x3147a9['sendStatus'](0x194);}return _0x816c78;};}function handleError(_0x1b05a2,_0x4a29fd){_0x4a29fd=_0x4a29fd||0x1f4;return function(_0x581943){logger['error'](_0x581943['stack']);if(_0x581943[_0xfcfe('0x27')]){delete _0x581943[_0xfcfe('0x27')];}_0x1b05a2['status'](_0x4a29fd)['send'](_0x581943);};}exports[_0xfcfe('0x28')]=function(_0x573af4,_0x1a8377){var _0xc9ea3a={},_0x581d43={},_0x5abcbf={'count':0x0,'rows':[]};var _0x32ba1c=_[_0xfcfe('0x29')](db['ZendeskField'][_0xfcfe('0x2a')],function(_0x2b5957){return{'name':_0x2b5957['fieldName'],'type':_0x2b5957[_0xfcfe('0x2b')]['key']};});_0x581d43[_0xfcfe('0x2c')]=_['map'](_0x32ba1c,_0xfcfe('0x27'));_0x581d43[_0xfcfe('0x2d')]=_['keys'](_0x573af4[_0xfcfe('0x2d')]);_0x581d43[_0xfcfe('0x2e')]=_[_0xfcfe('0x2f')](_0x581d43[_0xfcfe('0x2c')],_0x581d43[_0xfcfe('0x2d')]);_0xc9ea3a['attributes']=_[_0xfcfe('0x2f')](_0x581d43['model'],qs[_0xfcfe('0x30')](_0x573af4[_0xfcfe('0x2d')]['fields']));_0xc9ea3a[_0xfcfe('0x31')]=_0xc9ea3a['attributes'][_0xfcfe('0x32')]?_0xc9ea3a[_0xfcfe('0x31')]:_0x581d43[_0xfcfe('0x2c')];if(!_0x573af4[_0xfcfe('0x2d')]['hasOwnProperty'](_0xfcfe('0x33'))){_0xc9ea3a[_0xfcfe('0x1e')]=qs['limit'](_0x573af4[_0xfcfe('0x2d')][_0xfcfe('0x1e')]);_0xc9ea3a[_0xfcfe('0x1c')]=qs['offset'](_0x573af4[_0xfcfe('0x2d')][_0xfcfe('0x1c')]);}_0xc9ea3a['order']=qs[_0xfcfe('0x34')](_0x573af4[_0xfcfe('0x2d')]['sort']);_0xc9ea3a[_0xfcfe('0x35')]=qs['filters'](_[_0xfcfe('0x36')](_0x573af4['query'],_0x581d43[_0xfcfe('0x2e')]),_0x32ba1c);if(_0x573af4['query']['filter']){_0xc9ea3a['where']=_['merge'](_0xc9ea3a[_0xfcfe('0x35')],{'$or':_[_0xfcfe('0x29')](_0x32ba1c,function(_0x43e0d7){if(_0x43e0d7['type']!==_0xfcfe('0x37')){var _0x32f5bf={};_0x32f5bf[_0x43e0d7[_0xfcfe('0x27')]]={'$like':'%'+_0x573af4[_0xfcfe('0x2d')][_0xfcfe('0x38')]+'%'};return _0x32f5bf;}})});}_0xc9ea3a=_['merge']({},_0xc9ea3a,_0x573af4[_0xfcfe('0x39')]);var _0x5a4ca5={'where':_0xc9ea3a['where']};return db[_0xfcfe('0x3a')][_0xfcfe('0x1f')](_0x5a4ca5)['then'](function(_0x256da9){_0x5abcbf[_0xfcfe('0x1f')]=_0x256da9;if(_0x573af4['query']['includeAll']){_0xc9ea3a[_0xfcfe('0x3b')]=[{'all':!![]}];}return db[_0xfcfe('0x3a')][_0xfcfe('0x3c')](_0xc9ea3a);})[_0xfcfe('0x25')](function(_0x15c0f3){_0x5abcbf[_0xfcfe('0x3d')]=_0x15c0f3;return _0x5abcbf;})['then'](respondWithFilteredResult(_0x1a8377,_0xc9ea3a))[_0xfcfe('0x3e')](handleError(_0x1a8377,null));};exports[_0xfcfe('0x3f')]=function(_0x278ffb,_0x19f911){var _0x3d00c2={'raw':!![],'where':{'id':_0x278ffb[_0xfcfe('0x40')]['id']}},_0x4a6c9a={};_0x4a6c9a[_0xfcfe('0x2c')]=_[_0xfcfe('0x41')](db['ZendeskField'][_0xfcfe('0x2a')]);_0x4a6c9a['query']=_['keys'](_0x278ffb[_0xfcfe('0x2d')]);_0x4a6c9a[_0xfcfe('0x2e')]=_['intersection'](_0x4a6c9a['model'],_0x4a6c9a[_0xfcfe('0x2d')]);_0x3d00c2[_0xfcfe('0x31')]=_[_0xfcfe('0x2f')](_0x4a6c9a[_0xfcfe('0x2c')],qs['fields'](_0x278ffb['query'][_0xfcfe('0x30')]));_0x3d00c2[_0xfcfe('0x31')]=_0x3d00c2[_0xfcfe('0x31')][_0xfcfe('0x32')]?_0x3d00c2[_0xfcfe('0x31')]:_0x4a6c9a[_0xfcfe('0x2c')];if(_0x278ffb[_0xfcfe('0x2d')][_0xfcfe('0x42')]){_0x3d00c2[_0xfcfe('0x3b')]=[{'all':!![]}];}_0x3d00c2=_[_0xfcfe('0x43')]({},_0x3d00c2,_0x278ffb[_0xfcfe('0x39')]);return db[_0xfcfe('0x3a')][_0xfcfe('0x44')](_0x3d00c2)[_0xfcfe('0x25')](handleEntityNotFound(_0x19f911,null))['then'](respondWithResult(_0x19f911,null))[_0xfcfe('0x3e')](handleError(_0x19f911,null));};exports['create']=function(_0x4ccb95,_0x583f35){return db['ZendeskField'][_0xfcfe('0x45')](_0x4ccb95['body'],{})[_0xfcfe('0x25')](respondWithResult(_0x583f35,0xc9))['catch'](handleError(_0x583f35,null));};exports['update']=function(_0x1afc28,_0x20e185){if(_0x1afc28[_0xfcfe('0x46')]['id']){delete _0x1afc28[_0xfcfe('0x46')]['id'];}return db['ZendeskField'][_0xfcfe('0x44')]({'where':{'id':_0x1afc28['params']['id']}})[_0xfcfe('0x25')](handleEntityNotFound(_0x20e185,null))[_0xfcfe('0x25')](saveUpdates(_0x1afc28[_0xfcfe('0x46')],null))[_0xfcfe('0x25')](respondWithResult(_0x20e185,null))[_0xfcfe('0x3e')](handleError(_0x20e185,null));};exports[_0xfcfe('0x26')]=function(_0x411ed8,_0x43ad0b){return db['ZendeskField'][_0xfcfe('0x44')]({'where':{'id':_0x411ed8[_0xfcfe('0x40')]['id']}})['then'](handleEntityNotFound(_0x43ad0b,null))[_0xfcfe('0x25')](removeEntity(_0x43ad0b,null))[_0xfcfe('0x3e')](handleError(_0x43ad0b,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 0357da1..7cf823a 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 _0xf44a=['idField','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xf44a,0xaa));var _0xaf44=function(_0x16c17e,_0x4afd4f){_0x16c17e=_0x16c17e-0x0;var _0x447c4f=_0xf44a[_0x16c17e];return _0x447c4f;};'use strict';var _=require(_0xaf44('0x0'));var util=require(_0xaf44('0x1'));var logger=require(_0xaf44('0x2'))('api');var moment=require(_0xaf44('0x3'));var BPromise=require('bluebird');var rp=require(_0xaf44('0x4'));var fs=require('fs');var path=require(_0xaf44('0x5'));var rimraf=require('rimraf');var config=require(_0xaf44('0x6'));var attributes=require('./intZendeskField.attributes');module[_0xaf44('0x7')]=function(_0x22212b,_0x33e048){return _0x22212b[_0xaf44('0x8')](_0xaf44('0x9'),attributes,{'tableName':_0xaf44('0xa'),'paranoid':![],'indexes':[{'name':_0xaf44('0xb'),'fields':[_0xaf44('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x07d8=['request-promise','path','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3e6c3f,_0xd65ebf){var _0x3f408d=function(_0x584e77){while(--_0x584e77){_0x3e6c3f['push'](_0x3e6c3f['shift']());}};_0x3f408d(++_0xd65ebf);}(_0x07d8,0x126));var _0x807d=function(_0x35c1db,_0xd75c15){_0x35c1db=_0x35c1db-0x0;var _0x4173ff=_0x07d8[_0x35c1db];return _0x4173ff;};'use strict';var _=require(_0x807d('0x0'));var util=require(_0x807d('0x1'));var logger=require(_0x807d('0x2'))(_0x807d('0x3'));var moment=require(_0x807d('0x4'));var BPromise=require(_0x807d('0x5'));var rp=require(_0x807d('0x6'));var fs=require('fs');var path=require(_0x807d('0x7'));var rimraf=require('rimraf');var config=require(_0x807d('0x8'));var attributes=require(_0x807d('0x9'));module['exports']=function(_0x330f6c,_0x13badd){return _0x330f6c[_0x807d('0xa')](_0x807d('0xb'),attributes,{'tableName':_0x807d('0xc'),'paranoid':![],'indexes':[{'name':_0x807d('0xd'),'fields':['idField',_0x807d('0xe')],'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 f2b6f27..6bc0e64 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 _0xcb1d=['info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','error','message'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xcb1d,0x157));var _0xdcb1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcb1d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xdcb1('0x0'));var util=require(_0xdcb1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdcb1('0x2'));var fs=require('fs');var Redis=require(_0xdcb1('0x3'));var db=require(_0xdcb1('0x4'))['db'];var utils=require(_0xdcb1('0x5'));var logger=require('../../config/logger')(_0xdcb1('0x6'));var config=require(_0xdcb1('0x7'));var jayson=require(_0xdcb1('0x8'));var client=jayson['client'][_0xdcb1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x179a0b,_0x5bf2ae,_0x4bea57){return new BPromise(function(_0x414be8,_0x4e209d){return client[_0xdcb1('0xa')](_0x179a0b,_0x4bea57)[_0xdcb1('0xb')](function(_0x385e8a){logger['info'](_0xdcb1('0xc'),_0x5bf2ae,'request\x20sent');logger[_0xdcb1('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x5bf2ae,_0xdcb1('0xe'),JSON['stringify'](_0x385e8a));if(_0x385e8a[_0xdcb1('0xf')]){if(_0x385e8a[_0xdcb1('0xf')]['code']===0x1f4){logger[_0xdcb1('0xf')](_0xdcb1('0xc'),_0x5bf2ae,_0x385e8a[_0xdcb1('0xf')][_0xdcb1('0x10')]);return _0x4e209d(_0x385e8a[_0xdcb1('0xf')][_0xdcb1('0x10')]);}logger['error'](_0xdcb1('0xc'),_0x5bf2ae,_0x385e8a['error'][_0xdcb1('0x10')]);return _0x414be8(_0x385e8a[_0xdcb1('0xf')][_0xdcb1('0x10')]);}else{logger[_0xdcb1('0x11')](_0xdcb1('0xc'),_0x5bf2ae,_0xdcb1('0xe'));_0x414be8(_0x385e8a[_0xdcb1('0x12')][_0xdcb1('0x10')]);}})[_0xdcb1('0x13')](function(_0x10d285){logger['error'](_0xdcb1('0xc'),_0x5bf2ae,_0x10d285);_0x4e209d(_0x10d285);});});} \ No newline at end of file +var _0x7a46=['ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request'];(function(_0x596c59,_0x517b1d){var _0x1a5185=function(_0x5b5f4d){while(--_0x5b5f4d){_0x596c59['push'](_0x596c59['shift']());}};_0x1a5185(++_0x517b1d);}(_0x7a46,0x139));var _0x67a4=function(_0x2a11d8,_0x4ce142){_0x2a11d8=_0x2a11d8-0x0;var _0x8c72e9=_0x7a46[_0x2a11d8];return _0x8c72e9;};'use strict';var _=require(_0x67a4('0x0'));var util=require('util');var moment=require(_0x67a4('0x1'));var BPromise=require(_0x67a4('0x2'));var rs=require(_0x67a4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67a4('0x4'))['db'];var utils=require(_0x67a4('0x5'));var logger=require('../../config/logger')(_0x67a4('0x6'));var config=require('../../config/environment');var jayson=require(_0x67a4('0x7'));var client=jayson[_0x67a4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xba71a5,_0x402be0,_0x4ca4cb){return new BPromise(function(_0x18da80,_0x13de1a){return client[_0x67a4('0x9')](_0xba71a5,_0x4ca4cb)['then'](function(_0xa84a13){logger['info'](_0x67a4('0xa'),_0x402be0,_0x67a4('0xb'));logger[_0x67a4('0xc')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x402be0,_0x67a4('0xb'),JSON[_0x67a4('0xd')](_0xa84a13));if(_0xa84a13['error']){if(_0xa84a13[_0x67a4('0xe')][_0x67a4('0xf')]===0x1f4){logger[_0x67a4('0xe')](_0x67a4('0xa'),_0x402be0,_0xa84a13['error'][_0x67a4('0x10')]);return _0x13de1a(_0xa84a13[_0x67a4('0xe')][_0x67a4('0x10')]);}logger[_0x67a4('0xe')](_0x67a4('0xa'),_0x402be0,_0xa84a13['error'][_0x67a4('0x10')]);return _0x18da80(_0xa84a13['error'][_0x67a4('0x10')]);}else{logger[_0x67a4('0x11')](_0x67a4('0xa'),_0x402be0,_0x67a4('0xb'));_0x18da80(_0xa84a13['result'][_0x67a4('0x10')]);}})[_0x67a4('0x12')](function(_0x1fb67f){logger[_0x67a4('0xe')]('ZendeskField,\x20%s,\x20%s',_0x402be0,_0x1fb67f);_0x13de1a(_0x1fb67f);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index e6cd252..70229ae 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 _0xf2ca=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x2cae70,_0x572fac){var _0x520939=function(_0x51023d){while(--_0x51023d){_0x2cae70['push'](_0x2cae70['shift']());}};_0x520939(++_0x572fac);}(_0xf2ca,0x16a));var _0xaf2c=function(_0xb37185,_0x3ec508){_0xb37185=_0xb37185-0x0;var _0x575b45=_0xf2ca[_0xb37185];return _0x575b45;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var fs_extra=require(_0xaf2c('0x5'));var auth=require(_0xaf2c('0x6'));var interaction=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var controller=require('./intZohoAccount.controller');router[_0xaf2c('0x9')]('/',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xb')]);router[_0xaf2c('0x9')]('/:id',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xc')]);router['get'](_0xaf2c('0xd'),auth['isAuthenticated'](),controller[_0xaf2c('0xe')]);router['get'](_0xaf2c('0xf'),auth[_0xaf2c('0xa')](),controller[_0xaf2c('0x10')]);router[_0xaf2c('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaf2c('0x11')](_0xaf2c('0xd'),auth[_0xaf2c('0xa')](),controller[_0xaf2c('0x12')]);router[_0xaf2c('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xaf2c('0x14')]);router[_0xaf2c('0x15')](_0xaf2c('0x16'),auth[_0xaf2c('0xa')](),controller[_0xaf2c('0x17')]);module[_0xaf2c('0x18')]=router; \ No newline at end of file +var _0x9804=['isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','update','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get'];(function(_0x205725,_0x582a1b){var _0x4c86ed=function(_0x17abf8){while(--_0x17abf8){_0x205725['push'](_0x205725['shift']());}};_0x4c86ed(++_0x582a1b);}(_0x9804,0x1b9));var _0x4980=function(_0x4c60ca,_0x34c331){_0x4c60ca=_0x4c60ca-0x0;var _0x1087fd=_0x9804[_0x4c60ca];return _0x1087fd;};'use strict';var multer=require('multer');var util=require(_0x4980('0x0'));var path=require(_0x4980('0x1'));var timeout=require('connect-timeout');var express=require(_0x4980('0x2'));var router=express[_0x4980('0x3')]();var fs_extra=require(_0x4980('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4980('0x5'));var config=require(_0x4980('0x6'));var controller=require(_0x4980('0x7'));router[_0x4980('0x8')]('/',auth[_0x4980('0x9')](),controller[_0x4980('0xa')]);router['get'](_0x4980('0xb'),auth[_0x4980('0x9')](),controller['show']);router['get'](_0x4980('0xc'),auth[_0x4980('0x9')](),controller[_0x4980('0xd')]);router['get'](_0x4980('0xe'),auth[_0x4980('0x9')](),controller[_0x4980('0xf')]);router['post']('/',auth[_0x4980('0x9')](),controller['create']);router['post'](_0x4980('0xc'),auth[_0x4980('0x9')](),controller[_0x4980('0x10')]);router['put'](_0x4980('0xb'),auth[_0x4980('0x9')](),controller[_0x4980('0x11')]);router['delete'](_0x4980('0xb'),auth[_0x4980('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index dc6aeda..b578e1d 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99e9=['exports','STRING'];(function(_0x20af0c,_0x21b792){var _0xd86003=function(_0xe8529f){while(--_0xe8529f){_0x20af0c['push'](_0x20af0c['shift']());}};_0xd86003(++_0x21b792);}(_0x99e9,0xb4));var _0x999e=function(_0x558e45,_0x4f5e4f){_0x558e45=_0x558e45-0x0;var _0x3e9075=_0x99e9[_0x558e45];return _0x3e9075;};'use strict';var Sequelize=require('sequelize');module[_0x999e('0x0')]={'name':{'type':Sequelize[_0x999e('0x1')]},'description':{'type':Sequelize[_0x999e('0x1')]},'host':{'type':Sequelize[_0x999e('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x999e('0x1')]},'clientSecret':{'type':Sequelize[_0x999e('0x1')]},'serverUrl':{'type':Sequelize[_0x999e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x999e('0x1')]}}; \ No newline at end of file +var _0x99e9=['exports','STRING'];(function(_0x220774,_0x3926c3){var _0x51c540=function(_0x27fdea){while(--_0x27fdea){_0x220774['push'](_0x220774['shift']());}};_0x51c540(++_0x3926c3);}(_0x99e9,0xb4));var _0x999e=function(_0x44044a,_0x3a0097){_0x44044a=_0x44044a-0x0;var _0x43bb6e=_0x99e9[_0x44044a];return _0x43bb6e;};'use strict';var Sequelize=require('sequelize');module[_0x999e('0x0')]={'name':{'type':Sequelize[_0x999e('0x1')]},'description':{'type':Sequelize[_0x999e('0x1')]},'host':{'type':Sequelize[_0x999e('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x999e('0x1')]},'clientSecret':{'type':Sequelize[_0x999e('0x1')]},'serverUrl':{'type':Sequelize[_0x999e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x999e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index ffaa3fe..e1d9364 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 _0x454d=['mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','apply','reject','update','then','destroy','error','name','send','index','map','ZohoAccount','type','key','model','keys','filters','intersection','query','attributes','fields','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','include','findAll','catch','rawAttributes','length','includeAll','merge','find','create','body','params','getConfigurations','findOne','ZohoConfiguration','options','hasOwnProperty','addConfiguration','AccountId','channel','Descriptions','getDescriptions','ZohoField','Subjects','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','serverUrl','code','host','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','picklist','pick_list_values','getFields','stringify','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1a983d,_0xa72c7b){var _0x58e9a3=function(_0x4b5c45){while(--_0x4b5c45){_0x1a983d['push'](_0x1a983d['shift']());}};_0x58e9a3(++_0xa72c7b);}(_0x454d,0x1e2));var _0xd454=function(_0x175a55,_0x4082fd){_0x175a55=_0x175a55-0x0;var _0x167adf=_0x454d[_0x175a55];return _0x167adf;};'use strict';var emlformat=require(_0xd454('0x0'));var rimraf=require(_0xd454('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd454('0x2'));var rp=require(_0xd454('0x3'));var moment=require(_0xd454('0x4'));var BPromise=require(_0xd454('0x5'));var Mustache=require(_0xd454('0x6'));var util=require(_0xd454('0x7'));var path=require(_0xd454('0x8'));var sox=require(_0xd454('0x9'));var csv=require(_0xd454('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd454('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd454('0xc'));var deskjs=require(_0xd454('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd454('0xe'));var Papa=require(_0xd454('0xf'));var Redis=require(_0xd454('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd454('0x11'));var as=require(_0xd454('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd454('0x13'));var utils=require(_0xd454('0x14'));var config=require(_0xd454('0x15'));var licenseUtil=require(_0xd454('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x13e85a,_0x28800b){_0x28800b=_0x28800b||0xcc;return function(_0x5d24fa){if(_0x5d24fa){return _0x13e85a[_0xd454('0x17')](_0x28800b);}return _0x13e85a[_0xd454('0x18')](_0x28800b)[_0xd454('0x19')]();};}function respondWithResult(_0x2f2894,_0x151dae){_0x151dae=_0x151dae||0xc8;return function(_0x9467a9){if(_0x9467a9){return _0x2f2894[_0xd454('0x18')](_0x151dae)[_0xd454('0x1a')](_0x9467a9);}};}function respondWithFilteredResult(_0x28c137,_0xb67dcf){return function(_0x386ccd){if(_0x386ccd){var _0x2c7361=typeof _0xb67dcf[_0xd454('0x1b')]==='undefined'&&typeof _0xb67dcf['limit']===_0xd454('0x1c');var _0x5f1562=_0x386ccd[_0xd454('0x1d')];var _0x77bccc=_0x2c7361?0x0:_0xb67dcf[_0xd454('0x1b')];var _0x5a4b9f=_0x2c7361?_0x386ccd['count']:_0xb67dcf['offset']+_0xb67dcf['limit'];var _0x188920;if(_0x5a4b9f>=_0x5f1562){_0x5a4b9f=_0x5f1562;_0x188920=0xc8;}else{_0x188920=0xce;}_0x28c137[_0xd454('0x18')](_0x188920);return _0x28c137['set']('Content-Range',_0x77bccc+'-'+_0x5a4b9f+'/'+_0x5f1562)[_0xd454('0x1a')](_0x386ccd);}return null;};}function patchUpdates(_0x66b0fa){return function(_0x344d21){try{jsonpatch[_0xd454('0x1e')](_0x344d21,_0x66b0fa,!![]);}catch(_0x42e9ed){return BPromise[_0xd454('0x1f')](_0x42e9ed);}return _0x344d21['save']();};}function saveUpdates(_0x4e1876,_0x3005c9){return function(_0x308958){if(_0x308958){return _0x308958[_0xd454('0x20')](_0x4e1876)[_0xd454('0x21')](function(_0x18c31b){return _0x18c31b;});}return null;};}function removeEntity(_0x21442a,_0x2ebc42){return function(_0x5a9f92){if(_0x5a9f92){return _0x5a9f92[_0xd454('0x22')]()['then'](function(){_0x21442a[_0xd454('0x18')](0xcc)[_0xd454('0x19')]();});}};}function handleEntityNotFound(_0x594b6d,_0x182d51){return function(_0x4d98ea){if(!_0x4d98ea){_0x594b6d[_0xd454('0x17')](0x194);}return _0x4d98ea;};}function handleError(_0x459f49,_0x1d4321){_0x1d4321=_0x1d4321||0x1f4;return function(_0x370481){logger[_0xd454('0x23')](_0x370481['stack']);if(_0x370481[_0xd454('0x24')]){delete _0x370481[_0xd454('0x24')];}_0x459f49['status'](_0x1d4321)[_0xd454('0x25')](_0x370481);};}exports[_0xd454('0x26')]=function(_0x25f49c,_0x400d54){var _0x42de0c={},_0x2eb53d={},_0x560ec7={'count':0x0,'rows':[]};var _0x5a5bad=_[_0xd454('0x27')](db[_0xd454('0x28')]['rawAttributes'],function(_0x341d33){return{'name':_0x341d33['fieldName'],'type':_0x341d33[_0xd454('0x29')][_0xd454('0x2a')]};});_0x2eb53d[_0xd454('0x2b')]=_['map'](_0x5a5bad,_0xd454('0x24'));_0x2eb53d['query']=_[_0xd454('0x2c')](_0x25f49c['query']);_0x2eb53d[_0xd454('0x2d')]=_[_0xd454('0x2e')](_0x2eb53d[_0xd454('0x2b')],_0x2eb53d[_0xd454('0x2f')]);_0x42de0c[_0xd454('0x30')]=_[_0xd454('0x2e')](_0x2eb53d['model'],qs[_0xd454('0x31')](_0x25f49c[_0xd454('0x2f')][_0xd454('0x31')]));_0x42de0c[_0xd454('0x30')]=_0x42de0c['attributes']['length']?_0x42de0c[_0xd454('0x30')]:_0x2eb53d['model'];if(!_0x25f49c[_0xd454('0x2f')]['hasOwnProperty'](_0xd454('0x32'))){_0x42de0c['limit']=qs[_0xd454('0x33')](_0x25f49c['query']['limit']);_0x42de0c[_0xd454('0x1b')]=qs['offset'](_0x25f49c[_0xd454('0x2f')]['offset']);}_0x42de0c[_0xd454('0x34')]=qs[_0xd454('0x35')](_0x25f49c['query']['sort']);_0x42de0c[_0xd454('0x36')]=qs[_0xd454('0x2d')](_[_0xd454('0x37')](_0x25f49c[_0xd454('0x2f')],_0x2eb53d[_0xd454('0x2d')]),_0x5a5bad);if(_0x25f49c[_0xd454('0x2f')][_0xd454('0x38')]){_0x42de0c[_0xd454('0x36')]=_['merge'](_0x42de0c[_0xd454('0x36')],{'$or':_[_0xd454('0x27')](_0x5a5bad,function(_0x1b11ef){if(_0x1b11ef[_0xd454('0x29')]!==_0xd454('0x39')){var _0x30380f={};_0x30380f[_0x1b11ef[_0xd454('0x24')]]={'$like':'%'+_0x25f49c[_0xd454('0x2f')][_0xd454('0x38')]+'%'};return _0x30380f;}})});}_0x42de0c=_['merge']({},_0x42de0c,_0x25f49c['options']);var _0xc881b3={'where':_0x42de0c[_0xd454('0x36')]};return db['ZohoAccount']['count'](_0xc881b3)[_0xd454('0x21')](function(_0x3167bd){_0x560ec7['count']=_0x3167bd;if(_0x25f49c[_0xd454('0x2f')]['includeAll']){_0x42de0c[_0xd454('0x3a')]=[{'all':!![]}];}return db[_0xd454('0x28')][_0xd454('0x3b')](_0x42de0c);})[_0xd454('0x21')](function(_0x45b733){_0x560ec7['rows']=_0x45b733;return _0x560ec7;})[_0xd454('0x21')](respondWithFilteredResult(_0x400d54,_0x42de0c))[_0xd454('0x3c')](handleError(_0x400d54,null));};exports['show']=function(_0x5dd5b9,_0x1811c7){var _0x289ab0={'raw':![],'where':{'id':_0x5dd5b9['params']['id']}},_0x2ef11a={};_0x2ef11a[_0xd454('0x2b')]=_[_0xd454('0x2c')](db['ZohoAccount'][_0xd454('0x3d')]);_0x2ef11a['query']=_[_0xd454('0x2c')](_0x5dd5b9['query']);_0x2ef11a['filters']=_['intersection'](_0x2ef11a[_0xd454('0x2b')],_0x2ef11a[_0xd454('0x2f')]);_0x289ab0['attributes']=_[_0xd454('0x2e')](_0x2ef11a[_0xd454('0x2b')],qs[_0xd454('0x31')](_0x5dd5b9[_0xd454('0x2f')][_0xd454('0x31')]));_0x289ab0['attributes']=_0x289ab0[_0xd454('0x30')][_0xd454('0x3e')]?_0x289ab0[_0xd454('0x30')]:_0x2ef11a['model'];if(_0x5dd5b9['query'][_0xd454('0x3f')]){_0x289ab0[_0xd454('0x3a')]=[{'all':!![]}];}_0x289ab0=_[_0xd454('0x40')]({},_0x289ab0,_0x5dd5b9['options']);return db['ZohoAccount'][_0xd454('0x41')](_0x289ab0)[_0xd454('0x21')](handleEntityNotFound(_0x1811c7,null))['then'](respondWithResult(_0x1811c7,null))[_0xd454('0x3c')](handleError(_0x1811c7,null));};exports[_0xd454('0x42')]=function(_0x52e21a,_0x592087){return db[_0xd454('0x28')][_0xd454('0x42')](_0x52e21a['body'],{})['then'](respondWithResult(_0x592087,0xc9))[_0xd454('0x3c')](handleError(_0x592087,null));};exports[_0xd454('0x20')]=function(_0x1154d8,_0x1fac36){if(_0x1154d8[_0xd454('0x43')]['id']){delete _0x1154d8[_0xd454('0x43')]['id'];}return db[_0xd454('0x28')][_0xd454('0x41')]({'where':{'id':_0x1154d8[_0xd454('0x44')]['id']}})['then'](handleEntityNotFound(_0x1fac36,null))[_0xd454('0x21')](saveUpdates(_0x1154d8[_0xd454('0x43')],null))[_0xd454('0x21')](respondWithResult(_0x1fac36,null))[_0xd454('0x3c')](handleError(_0x1fac36,null));};exports['destroy']=function(_0x33cbca,_0x250422){return db[_0xd454('0x28')][_0xd454('0x41')]({'where':{'id':_0x33cbca[_0xd454('0x44')]['id']}})[_0xd454('0x21')](handleEntityNotFound(_0x250422,null))[_0xd454('0x21')](removeEntity(_0x250422,null))[_0xd454('0x3c')](handleError(_0x250422,null));};exports[_0xd454('0x45')]=function(_0x1932b2,_0x1a03d9,_0x346cde){var _0x1ffce1={};var _0x25d851={};var _0x562c88;var _0x17d9c8;return db[_0xd454('0x28')][_0xd454('0x46')]({'where':{'id':_0x1932b2[_0xd454('0x44')]['id']}})[_0xd454('0x21')](handleEntityNotFound(_0x1a03d9,null))[_0xd454('0x21')](function(_0x46d027){if(_0x46d027){_0x562c88=_0x46d027;_0x25d851['model']=_['keys'](db[_0xd454('0x47')][_0xd454('0x3d')]);_0x25d851[_0xd454('0x2f')]=_[_0xd454('0x2c')](_0x1932b2['query']);_0x25d851['filters']=_['intersection'](_0x25d851[_0xd454('0x2b')],_0x25d851['query']);_0x1ffce1['attributes']=_[_0xd454('0x2e')](_0x25d851[_0xd454('0x2b')],qs[_0xd454('0x31')](_0x1932b2[_0xd454('0x2f')][_0xd454('0x31')]));_0x1ffce1['attributes']=_0x1ffce1[_0xd454('0x30')][_0xd454('0x3e')]?_0x1ffce1[_0xd454('0x30')]:_0x25d851[_0xd454('0x2b')];_0x1ffce1[_0xd454('0x34')]=qs[_0xd454('0x35')](_0x1932b2[_0xd454('0x2f')][_0xd454('0x35')]);_0x1ffce1['where']=qs[_0xd454('0x2d')](_['pick'](_0x1932b2[_0xd454('0x2f')],_0x25d851['filters']));if(_0x1932b2[_0xd454('0x2f')][_0xd454('0x38')]){_0x1ffce1[_0xd454('0x36')]=_[_0xd454('0x40')](_0x1ffce1[_0xd454('0x36')],{'$or':_[_0xd454('0x27')](_0x1ffce1[_0xd454('0x30')],function(_0x3d2351){var _0xb7ecd3={};_0xb7ecd3[_0x3d2351]={'$like':'%'+_0x1932b2[_0xd454('0x2f')][_0xd454('0x38')]+'%'};return _0xb7ecd3;})});}_0x1ffce1=_['merge']({},_0x1ffce1,_0x1932b2[_0xd454('0x48')]);return _0x562c88[_0xd454('0x45')](_0x1ffce1);}})[_0xd454('0x21')](function(_0x3e16be){if(_0x3e16be){_0x17d9c8=_0x3e16be[_0xd454('0x3e')];if(!_0x1932b2[_0xd454('0x2f')][_0xd454('0x49')]('nolimit')){_0x1ffce1[_0xd454('0x33')]=qs[_0xd454('0x33')](_0x1932b2[_0xd454('0x2f')][_0xd454('0x33')]);_0x1ffce1[_0xd454('0x1b')]=qs[_0xd454('0x1b')](_0x1932b2[_0xd454('0x2f')][_0xd454('0x1b')]);}return _0x562c88[_0xd454('0x45')](_0x1ffce1);}})[_0xd454('0x21')](function(_0x367196){if(_0x367196){return _0x367196?{'count':_0x17d9c8,'rows':_0x367196}:null;}})[_0xd454('0x21')](respondWithResult(_0x1a03d9,null))[_0xd454('0x3c')](handleError(_0x1a03d9,null));};exports[_0xd454('0x4a')]=function(_0x191c80,_0x1a567d,_0x441a68){if(_0x191c80[_0xd454('0x43')]['id']){delete _0x191c80[_0xd454('0x43')]['id'];}return db[_0xd454('0x28')][_0xd454('0x46')]({'where':{'id':_0x191c80['params']['id']}})[_0xd454('0x21')](handleEntityNotFound(_0x1a567d,null))[_0xd454('0x21')](function(_0x1ba8ee){if(_0x1ba8ee){_0x191c80['body'][_0xd454('0x4b')]=_0x1ba8ee['id'];_0x191c80[_0xd454('0x43')]['Subjects']=integrations['getSubjects'](_0x191c80[_0xd454('0x43')][_0xd454('0x4c')],_0x191c80[_0xd454('0x43')][_0xd454('0x29')]);_0x191c80['body'][_0xd454('0x4d')]=integrations[_0xd454('0x4e')](_0x191c80[_0xd454('0x43')]['channel'],_0x191c80[_0xd454('0x43')][_0xd454('0x29')]);return db[_0xd454('0x47')][_0xd454('0x42')](_0x191c80[_0xd454('0x43')],{'include':[{'model':db[_0xd454('0x4f')],'as':_0xd454('0x50')},{'model':db['ZohoField'],'as':_0xd454('0x4d')}]});}return null;})[_0xd454('0x21')](respondWithResult(_0x1a567d,null))[_0xd454('0x3c')](handleError(_0x1a567d,null));};function getAccessToken(_0x491e73){return new Promise(function(_0x199576,_0x490cee){var _0x307b1e;switch(_0x491e73['zone']){case'US':_0x307b1e=_0xd454('0x51');break;case'AU':_0x307b1e='https://accounts.zoho.com.au';break;case'EU':_0x307b1e=_0xd454('0x52');break;case'IN':_0x307b1e=_0xd454('0x53');break;case'CN':_0x307b1e=_0xd454('0x54');break;default:_0x307b1e=_0xd454('0x52');break;}var _0x513986={'method':_0xd454('0x55'),'uri':_0x307b1e+_0xd454('0x56'),'qs':{'refresh_token':_0x491e73[_0xd454('0x57')],'client_id':_0x491e73[_0xd454('0x58')],'client_secret':_0x491e73[_0xd454('0x59')],'grant_type':_0xd454('0x5a')},'json':!![]};return rp(_0x513986)['then'](function(_0x3ed268){if(_0x3ed268['access_token']){_0x199576(_0x3ed268[_0xd454('0x5b')]);}else{_0x490cee(_0xd454('0x5c'));}})['catch'](function(_0x4eb124){_0x490cee(_0x4eb124);});});}exports['getFields']=function(_0x2008bb,_0x865678,_0x589959){var _0x100c00,_0x239cd5,_0x4317ea,_0x56120e,_0x1f9f3b;return db[_0xd454('0x28')][_0xd454('0x46')]({'where':{'id':_0x2008bb[_0xd454('0x44')]['id']},'attributes':['id','host','zone',_0xd454('0x58'),_0xd454('0x59'),_0xd454('0x5d'),_0xd454('0x5e'),'refreshToken']})[_0xd454('0x21')](handleEntityNotFound(_0x865678,null))[_0xd454('0x21')](function(_0x36d2e5){_0x1f9f3b=_0x36d2e5;_0x100c00=_0x1f9f3b[_0xd454('0x5f')];_0x239cd5=_0x100c00==='zoho.eu'?'eu':_0xd454('0x60');_0x4317ea=_0x1f9f3b[_0xd454('0x5d')];var _0x34fd5e=_0x4317ea[_0xd454('0x61')](-0x1);if(_0x34fd5e==='/'||_0x34fd5e==='\x5c'||_0x34fd5e===':'){_0x4317ea=_0x4317ea[_0xd454('0x62')](0x0,_0x4317ea[_0xd454('0x63')](_0x34fd5e));}if(!_0x1f9f3b['refreshToken']){throw new Error(_0xd454('0x64'));}return getAccessToken(_0x1f9f3b);})[_0xd454('0x21')](function(_0x3e5aac){if(_0x3e5aac){return rp({'method':'GET','uri':util[_0xd454('0x65')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x239cd5),'qs':{'module':_0xd454('0x66')},'headers':{'Authorization':_0xd454('0x67')+_0x3e5aac},'json':!![]});}})[_0xd454('0x21')](function(_0x5e2dd6){if(_0x5e2dd6){if(_0x5e2dd6[_0xd454('0x68')]&&_0x5e2dd6['response'][_0xd454('0x23')]){throw new Error(_0x5e2dd6[_0xd454('0x68')][_0xd454('0x23')]['message']);}var _0x45d567=[];var _0x2ea747=[];var _0x4cecb0=[_0xd454('0x69'),_0xd454('0x6a'),'Description',_0xd454('0x6b'),_0xd454('0x6c'),_0xd454('0x6d'),_0xd454('0x6e'),_0xd454('0x6f')];_0x2ea747=_[_0xd454('0x70')](_0x5e2dd6[_0xd454('0x31')],function(_0x148131){return _0x4cecb0[_0xd454('0x71')](_0x148131[_0xd454('0x72')]);});for(var _0x4ab3de=0x0;_0x4ab3de<_0x2ea747[_0xd454('0x3e')];_0x4ab3de++){if(_0x2ea747[_0x4ab3de][_0xd454('0x73')]===![]){_0x45d567['push']({'id':_0x2ea747[_0x4ab3de]['id'],'name':_0x2ea747[_0x4ab3de]['display_label'],'custom':_0x2ea747[_0x4ab3de]['custom_field'],'options':_0x2ea747[_0x4ab3de]['data_type']===_0xd454('0x74')&&_0x2ea747[_0x4ab3de][_0xd454('0x75')][_0xd454('0x3e')]>-0x1?_[_0xd454('0x27')](_0x2ea747[_0x4ab3de][_0xd454('0x75')],function(_0xfecbec){return{'name':_0xfecbec,'value':_0xfecbec};}):[]});}}return{'count':_0x45d567[_0xd454('0x3e')],'rows':_0x45d567};}else{return{'count':0x0,'rows':[]};}})[_0xd454('0x21')](respondWithResult(_0x865678,null))[_0xd454('0x3c')](function(_0x191af7){var _0x3cdb71=_0x2008bb['query']['test']?0x1f4:_0x191af7['statusCode']||0x1f4;logger[_0xd454('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xd454('0x76'),_0x3cdb71,JSON[_0xd454('0x77')](_0x191af7));delete _0x191af7[_0xd454('0x24')];if(_0x3cdb71===0x191){_0x3cdb71=0x190;}_0x865678['status'](_0x3cdb71)[_0xd454('0x25')](_0x2008bb['query'][_0xd454('0x78')]?{'message':_0xd454('0x79'),'statusCode':_0x191af7['statusCode']}:_0x191af7);});}; \ No newline at end of file +var _0xd27c=['clientSecret','refresh_token','access_token','host','serverUrl','code','refreshToken','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Zoho-oauthtoken\x20','response','message','Owner','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','test','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ZohoAccount','includeAll','include','rows','keys','find','catch','create','update','body','params','getConfigurations','ZohoConfiguration','order','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','/oauth/v2/token','clientId'];(function(_0x22a6bd,_0x32b8bf){var _0x484ca8=function(_0x1854b6){while(--_0x1854b6){_0x22a6bd['push'](_0x22a6bd['shift']());}};_0x484ca8(++_0x32b8bf);}(_0xd27c,0xa7));var _0xcd27=function(_0x187790,_0x2a083b){_0x187790=_0x187790-0x0;var _0x472705=_0xd27c[_0x187790];return _0x472705;};'use strict';var emlformat=require(_0xcd27('0x0'));var rimraf=require(_0xcd27('0x1'));var zipdir=require(_0xcd27('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd27('0x3'));var moment=require(_0xcd27('0x4'));var BPromise=require(_0xcd27('0x5'));var Mustache=require('mustache');var util=require(_0xcd27('0x6'));var path=require(_0xcd27('0x7'));var sox=require('sox');var csv=require(_0xcd27('0x8'));var ejs=require(_0xcd27('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd27('0xa'));var squel=require(_0xcd27('0xb'));var crypto=require('crypto');var jsforce=require(_0xcd27('0xc'));var deskjs=require(_0xcd27('0xd'));var toCsv=require(_0xcd27('0x8'));var querystring=require(_0xcd27('0xe'));var Papa=require('papaparse');var Redis=require(_0xcd27('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcd27('0x10'));var as=require(_0xcd27('0x11'));var hardwareService=require(_0xcd27('0x12'));var logger=require(_0xcd27('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xcd27('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xcd27('0x15'));function respondWithStatusCode(_0x5a0620,_0x15b58e){_0x15b58e=_0x15b58e||0xcc;return function(_0x44d1a5){if(_0x44d1a5){return _0x5a0620[_0xcd27('0x16')](_0x15b58e);}return _0x5a0620[_0xcd27('0x17')](_0x15b58e)['end']();};}function respondWithResult(_0x51c67f,_0x2a8151){_0x2a8151=_0x2a8151||0xc8;return function(_0x2fa756){if(_0x2fa756){return _0x51c67f[_0xcd27('0x17')](_0x2a8151)[_0xcd27('0x18')](_0x2fa756);}};}function respondWithFilteredResult(_0x18c771,_0x4b2745){return function(_0x184046){if(_0x184046){var _0xe9faf1=typeof _0x4b2745[_0xcd27('0x19')]===_0xcd27('0x1a')&&typeof _0x4b2745[_0xcd27('0x1b')]===_0xcd27('0x1a');var _0xad2c88=_0x184046[_0xcd27('0x1c')];var _0x5f0640=_0xe9faf1?0x0:_0x4b2745[_0xcd27('0x19')];var _0x91316f=_0xe9faf1?_0x184046['count']:_0x4b2745[_0xcd27('0x19')]+_0x4b2745[_0xcd27('0x1b')];var _0x25ee5a;if(_0x91316f>=_0xad2c88){_0x91316f=_0xad2c88;_0x25ee5a=0xc8;}else{_0x25ee5a=0xce;}_0x18c771[_0xcd27('0x17')](_0x25ee5a);return _0x18c771[_0xcd27('0x1d')](_0xcd27('0x1e'),_0x5f0640+'-'+_0x91316f+'/'+_0xad2c88)[_0xcd27('0x18')](_0x184046);}return null;};}function patchUpdates(_0x3573f1){return function(_0x36a454){try{jsonpatch[_0xcd27('0x1f')](_0x36a454,_0x3573f1,!![]);}catch(_0x4a191f){return BPromise[_0xcd27('0x20')](_0x4a191f);}return _0x36a454[_0xcd27('0x21')]();};}function saveUpdates(_0x20f389,_0x2af751){return function(_0x10921b){if(_0x10921b){return _0x10921b['update'](_0x20f389)[_0xcd27('0x22')](function(_0x3e919e){return _0x3e919e;});}return null;};}function removeEntity(_0x18ce60,_0x13ea1c){return function(_0x323581){if(_0x323581){return _0x323581[_0xcd27('0x23')]()[_0xcd27('0x22')](function(){_0x18ce60[_0xcd27('0x17')](0xcc)[_0xcd27('0x24')]();});}};}function handleEntityNotFound(_0x53bb0b,_0xae4221){return function(_0x490be6){if(!_0x490be6){_0x53bb0b[_0xcd27('0x16')](0x194);}return _0x490be6;};}function handleError(_0x5526de,_0x38075d){_0x38075d=_0x38075d||0x1f4;return function(_0x1874a1){logger[_0xcd27('0x25')](_0x1874a1[_0xcd27('0x26')]);if(_0x1874a1[_0xcd27('0x27')]){delete _0x1874a1['name'];}_0x5526de['status'](_0x38075d)[_0xcd27('0x28')](_0x1874a1);};}exports[_0xcd27('0x29')]=function(_0x11212b,_0x4a50f6){var _0x3d7e3={},_0x54fd28={},_0x359f6f={'count':0x0,'rows':[]};var _0x2fbc59=_[_0xcd27('0x2a')](db['ZohoAccount'][_0xcd27('0x2b')],function(_0xe76a7f){return{'name':_0xe76a7f[_0xcd27('0x2c')],'type':_0xe76a7f[_0xcd27('0x2d')][_0xcd27('0x2e')]};});_0x54fd28[_0xcd27('0x2f')]=_[_0xcd27('0x2a')](_0x2fbc59,_0xcd27('0x27'));_0x54fd28['query']=_['keys'](_0x11212b[_0xcd27('0x30')]);_0x54fd28[_0xcd27('0x31')]=_[_0xcd27('0x32')](_0x54fd28[_0xcd27('0x2f')],_0x54fd28[_0xcd27('0x30')]);_0x3d7e3['attributes']=_['intersection'](_0x54fd28[_0xcd27('0x2f')],qs[_0xcd27('0x33')](_0x11212b['query']['fields']));_0x3d7e3[_0xcd27('0x34')]=_0x3d7e3[_0xcd27('0x34')][_0xcd27('0x35')]?_0x3d7e3[_0xcd27('0x34')]:_0x54fd28[_0xcd27('0x2f')];if(!_0x11212b[_0xcd27('0x30')][_0xcd27('0x36')](_0xcd27('0x37'))){_0x3d7e3[_0xcd27('0x1b')]=qs[_0xcd27('0x1b')](_0x11212b['query'][_0xcd27('0x1b')]);_0x3d7e3[_0xcd27('0x19')]=qs[_0xcd27('0x19')](_0x11212b[_0xcd27('0x30')]['offset']);}_0x3d7e3['order']=qs[_0xcd27('0x38')](_0x11212b[_0xcd27('0x30')][_0xcd27('0x38')]);_0x3d7e3[_0xcd27('0x39')]=qs[_0xcd27('0x31')](_[_0xcd27('0x3a')](_0x11212b[_0xcd27('0x30')],_0x54fd28['filters']),_0x2fbc59);if(_0x11212b['query'][_0xcd27('0x3b')]){_0x3d7e3['where']=_[_0xcd27('0x3c')](_0x3d7e3[_0xcd27('0x39')],{'$or':_[_0xcd27('0x2a')](_0x2fbc59,function(_0x152a9e){if(_0x152a9e['type']!==_0xcd27('0x3d')){var _0x24d3a8={};_0x24d3a8[_0x152a9e[_0xcd27('0x27')]]={'$like':'%'+_0x11212b[_0xcd27('0x30')][_0xcd27('0x3b')]+'%'};return _0x24d3a8;}})});}_0x3d7e3=_[_0xcd27('0x3c')]({},_0x3d7e3,_0x11212b[_0xcd27('0x3e')]);var _0x1d7c58={'where':_0x3d7e3[_0xcd27('0x39')]};return db[_0xcd27('0x3f')][_0xcd27('0x1c')](_0x1d7c58)[_0xcd27('0x22')](function(_0x20a4e6){_0x359f6f['count']=_0x20a4e6;if(_0x11212b[_0xcd27('0x30')][_0xcd27('0x40')]){_0x3d7e3[_0xcd27('0x41')]=[{'all':!![]}];}return db[_0xcd27('0x3f')]['findAll'](_0x3d7e3);})[_0xcd27('0x22')](function(_0xcee780){_0x359f6f[_0xcd27('0x42')]=_0xcee780;return _0x359f6f;})['then'](respondWithFilteredResult(_0x4a50f6,_0x3d7e3))['catch'](handleError(_0x4a50f6,null));};exports['show']=function(_0x20a5c5,_0x40db5b){var _0x80403c={'raw':![],'where':{'id':_0x20a5c5['params']['id']}},_0x102962={};_0x102962['model']=_[_0xcd27('0x43')](db[_0xcd27('0x3f')]['rawAttributes']);_0x102962[_0xcd27('0x30')]=_[_0xcd27('0x43')](_0x20a5c5['query']);_0x102962[_0xcd27('0x31')]=_[_0xcd27('0x32')](_0x102962[_0xcd27('0x2f')],_0x102962['query']);_0x80403c['attributes']=_['intersection'](_0x102962[_0xcd27('0x2f')],qs['fields'](_0x20a5c5['query'][_0xcd27('0x33')]));_0x80403c[_0xcd27('0x34')]=_0x80403c[_0xcd27('0x34')]['length']?_0x80403c['attributes']:_0x102962[_0xcd27('0x2f')];if(_0x20a5c5[_0xcd27('0x30')][_0xcd27('0x40')]){_0x80403c[_0xcd27('0x41')]=[{'all':!![]}];}_0x80403c=_[_0xcd27('0x3c')]({},_0x80403c,_0x20a5c5[_0xcd27('0x3e')]);return db[_0xcd27('0x3f')][_0xcd27('0x44')](_0x80403c)['then'](handleEntityNotFound(_0x40db5b,null))[_0xcd27('0x22')](respondWithResult(_0x40db5b,null))[_0xcd27('0x45')](handleError(_0x40db5b,null));};exports[_0xcd27('0x46')]=function(_0x43972c,_0x25a83e){return db[_0xcd27('0x3f')][_0xcd27('0x46')](_0x43972c['body'],{})[_0xcd27('0x22')](respondWithResult(_0x25a83e,0xc9))[_0xcd27('0x45')](handleError(_0x25a83e,null));};exports[_0xcd27('0x47')]=function(_0x27b165,_0x2316ac){if(_0x27b165[_0xcd27('0x48')]['id']){delete _0x27b165[_0xcd27('0x48')]['id'];}return db[_0xcd27('0x3f')][_0xcd27('0x44')]({'where':{'id':_0x27b165['params']['id']}})['then'](handleEntityNotFound(_0x2316ac,null))[_0xcd27('0x22')](saveUpdates(_0x27b165['body'],null))['then'](respondWithResult(_0x2316ac,null))['catch'](handleError(_0x2316ac,null));};exports[_0xcd27('0x23')]=function(_0x34c777,_0xa55623){return db[_0xcd27('0x3f')][_0xcd27('0x44')]({'where':{'id':_0x34c777[_0xcd27('0x49')]['id']}})[_0xcd27('0x22')](handleEntityNotFound(_0xa55623,null))[_0xcd27('0x22')](removeEntity(_0xa55623,null))['catch'](handleError(_0xa55623,null));};exports[_0xcd27('0x4a')]=function(_0x425f5e,_0x5c031e,_0x12fc36){var _0x151e99={};var _0x37d615={};var _0x135019;var _0x6edb34;return db['ZohoAccount']['findOne']({'where':{'id':_0x425f5e[_0xcd27('0x49')]['id']}})[_0xcd27('0x22')](handleEntityNotFound(_0x5c031e,null))[_0xcd27('0x22')](function(_0x3cf05f){if(_0x3cf05f){_0x135019=_0x3cf05f;_0x37d615[_0xcd27('0x2f')]=_[_0xcd27('0x43')](db[_0xcd27('0x4b')][_0xcd27('0x2b')]);_0x37d615[_0xcd27('0x30')]=_[_0xcd27('0x43')](_0x425f5e[_0xcd27('0x30')]);_0x37d615[_0xcd27('0x31')]=_[_0xcd27('0x32')](_0x37d615[_0xcd27('0x2f')],_0x37d615['query']);_0x151e99[_0xcd27('0x34')]=_[_0xcd27('0x32')](_0x37d615[_0xcd27('0x2f')],qs[_0xcd27('0x33')](_0x425f5e['query'][_0xcd27('0x33')]));_0x151e99[_0xcd27('0x34')]=_0x151e99[_0xcd27('0x34')][_0xcd27('0x35')]?_0x151e99[_0xcd27('0x34')]:_0x37d615[_0xcd27('0x2f')];_0x151e99[_0xcd27('0x4c')]=qs[_0xcd27('0x38')](_0x425f5e[_0xcd27('0x30')]['sort']);_0x151e99[_0xcd27('0x39')]=qs[_0xcd27('0x31')](_[_0xcd27('0x3a')](_0x425f5e[_0xcd27('0x30')],_0x37d615[_0xcd27('0x31')]));if(_0x425f5e[_0xcd27('0x30')][_0xcd27('0x3b')]){_0x151e99[_0xcd27('0x39')]=_[_0xcd27('0x3c')](_0x151e99[_0xcd27('0x39')],{'$or':_[_0xcd27('0x2a')](_0x151e99[_0xcd27('0x34')],function(_0x5acee0){var _0x3ad7cd={};_0x3ad7cd[_0x5acee0]={'$like':'%'+_0x425f5e['query']['filter']+'%'};return _0x3ad7cd;})});}_0x151e99=_[_0xcd27('0x3c')]({},_0x151e99,_0x425f5e[_0xcd27('0x3e')]);return _0x135019[_0xcd27('0x4a')](_0x151e99);}})[_0xcd27('0x22')](function(_0x470262){if(_0x470262){_0x6edb34=_0x470262[_0xcd27('0x35')];if(!_0x425f5e[_0xcd27('0x30')]['hasOwnProperty'](_0xcd27('0x37'))){_0x151e99['limit']=qs[_0xcd27('0x1b')](_0x425f5e[_0xcd27('0x30')][_0xcd27('0x1b')]);_0x151e99[_0xcd27('0x19')]=qs['offset'](_0x425f5e[_0xcd27('0x30')][_0xcd27('0x19')]);}return _0x135019[_0xcd27('0x4a')](_0x151e99);}})[_0xcd27('0x22')](function(_0x32279d){if(_0x32279d){return _0x32279d?{'count':_0x6edb34,'rows':_0x32279d}:null;}})[_0xcd27('0x22')](respondWithResult(_0x5c031e,null))[_0xcd27('0x45')](handleError(_0x5c031e,null));};exports[_0xcd27('0x4d')]=function(_0x5e8622,_0x235c88,_0x4c30c9){if(_0x5e8622[_0xcd27('0x48')]['id']){delete _0x5e8622[_0xcd27('0x48')]['id'];}return db[_0xcd27('0x3f')][_0xcd27('0x4e')]({'where':{'id':_0x5e8622[_0xcd27('0x49')]['id']}})[_0xcd27('0x22')](handleEntityNotFound(_0x235c88,null))['then'](function(_0x150b3d){if(_0x150b3d){_0x5e8622[_0xcd27('0x48')][_0xcd27('0x4f')]=_0x150b3d['id'];_0x5e8622[_0xcd27('0x48')][_0xcd27('0x50')]=integrations[_0xcd27('0x51')](_0x5e8622[_0xcd27('0x48')][_0xcd27('0x52')],_0x5e8622[_0xcd27('0x48')][_0xcd27('0x2d')]);_0x5e8622[_0xcd27('0x48')]['Descriptions']=integrations[_0xcd27('0x53')](_0x5e8622[_0xcd27('0x48')][_0xcd27('0x52')],_0x5e8622[_0xcd27('0x48')]['type']);return db['ZohoConfiguration'][_0xcd27('0x46')](_0x5e8622[_0xcd27('0x48')],{'include':[{'model':db[_0xcd27('0x54')],'as':'Subjects'},{'model':db[_0xcd27('0x54')],'as':_0xcd27('0x55')}]});}return null;})[_0xcd27('0x22')](respondWithResult(_0x235c88,null))[_0xcd27('0x45')](handleError(_0x235c88,null));};function getAccessToken(_0x5a1269){return new Promise(function(_0x18bfc9,_0x49a043){var _0x23cdf1;switch(_0x5a1269[_0xcd27('0x56')]){case'US':_0x23cdf1=_0xcd27('0x57');break;case'AU':_0x23cdf1=_0xcd27('0x58');break;case'EU':_0x23cdf1=_0xcd27('0x59');break;case'IN':_0x23cdf1='https://accounts.zoho.in';break;case'CN':_0x23cdf1=_0xcd27('0x5a');break;default:_0x23cdf1=_0xcd27('0x59');break;}var _0x216620={'method':'POST','uri':_0x23cdf1+_0xcd27('0x5b'),'qs':{'refresh_token':_0x5a1269['refreshToken'],'client_id':_0x5a1269[_0xcd27('0x5c')],'client_secret':_0x5a1269[_0xcd27('0x5d')],'grant_type':_0xcd27('0x5e')},'json':!![]};return rp(_0x216620)['then'](function(_0x393317){if(_0x393317['access_token']){_0x18bfc9(_0x393317[_0xcd27('0x5f')]);}else{_0x49a043('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xcd27('0x45')](function(_0x401d9b){_0x49a043(_0x401d9b);});});}exports['getFields']=function(_0x22d7d6,_0x8a540a,_0x2c090b){var _0x1d9327,_0xc0075,_0x17f1da,_0x253fb2,_0x369076;return db['ZohoAccount'][_0xcd27('0x4e')]({'where':{'id':_0x22d7d6['params']['id']},'attributes':['id',_0xcd27('0x60'),'zone',_0xcd27('0x5c'),_0xcd27('0x5d'),_0xcd27('0x61'),_0xcd27('0x62'),_0xcd27('0x63')]})[_0xcd27('0x22')](handleEntityNotFound(_0x8a540a,null))[_0xcd27('0x22')](function(_0x460928){_0x369076=_0x460928;_0x1d9327=_0x369076[_0xcd27('0x60')];_0xc0075=_0x1d9327===_0xcd27('0x64')?'eu':_0xcd27('0x65');_0x17f1da=_0x369076[_0xcd27('0x61')];var _0x1a3099=_0x17f1da[_0xcd27('0x66')](-0x1);if(_0x1a3099==='/'||_0x1a3099==='\x5c'||_0x1a3099===':'){_0x17f1da=_0x17f1da['substring'](0x0,_0x17f1da[_0xcd27('0x67')](_0x1a3099));}if(!_0x369076[_0xcd27('0x63')]){throw new Error(_0xcd27('0x68'));}return getAccessToken(_0x369076);})[_0xcd27('0x22')](function(_0x16efe3){if(_0x16efe3){return rp({'method':_0xcd27('0x69'),'uri':util[_0xcd27('0x6a')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0xc0075),'qs':{'module':'Calls'},'headers':{'Authorization':_0xcd27('0x6b')+_0x16efe3},'json':!![]});}})[_0xcd27('0x22')](function(_0x3d84a8){if(_0x3d84a8){if(_0x3d84a8[_0xcd27('0x6c')]&&_0x3d84a8[_0xcd27('0x6c')]['error']){throw new Error(_0x3d84a8[_0xcd27('0x6c')]['error'][_0xcd27('0x6d')]);}var _0x11196d=[];var _0x239e55=[];var _0x41e31b=[_0xcd27('0x6e'),'Subject',_0xcd27('0x6f'),'WhoId',_0xcd27('0x70'),_0xcd27('0x71'),_0xcd27('0x72'),_0xcd27('0x73')];_0x239e55=_[_0xcd27('0x74')](_0x3d84a8[_0xcd27('0x33')],function(_0x334d82){return _0x41e31b[_0xcd27('0x75')](_0x334d82[_0xcd27('0x76')]);});for(var _0x413601=0x0;_0x413601<_0x239e55[_0xcd27('0x35')];_0x413601++){if(_0x239e55[_0x413601][_0xcd27('0x77')]===![]){_0x11196d[_0xcd27('0x78')]({'id':_0x239e55[_0x413601]['id'],'name':_0x239e55[_0x413601][_0xcd27('0x79')],'custom':_0x239e55[_0x413601][_0xcd27('0x7a')],'options':_0x239e55[_0x413601][_0xcd27('0x7b')]==='picklist'&&_0x239e55[_0x413601][_0xcd27('0x7c')][_0xcd27('0x35')]>-0x1?_[_0xcd27('0x2a')](_0x239e55[_0x413601][_0xcd27('0x7c')],function(_0x328718){return{'name':_0x328718,'value':_0x328718};}):[]});}}return{'count':_0x11196d['length'],'rows':_0x11196d};}else{return{'count':0x0,'rows':[]};}})[_0xcd27('0x22')](respondWithResult(_0x8a540a,null))[_0xcd27('0x45')](function(_0x41ba68){var _0x57ad9d=_0x22d7d6['query'][_0xcd27('0x7d')]?0x1f4:_0x41ba68['statusCode']||0x1f4;logger[_0xcd27('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xcd27('0x7e'),_0x57ad9d,JSON[_0xcd27('0x7f')](_0x41ba68));delete _0x41ba68[_0xcd27('0x27')];if(_0x57ad9d===0x191){_0x57ad9d=0x190;}_0x8a540a[_0xcd27('0x17')](_0x57ad9d)['send'](_0x22d7d6[_0xcd27('0x30')][_0xcd27('0x7d')]?{'message':_0xcd27('0x80'),'statusCode':_0x41ba68[_0xcd27('0x81')]}:_0x41ba68);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 2074c7f..3b17384 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 _0xf988=['inspect','slice','substring','https://accounts.zoho.com','POST','parse','catch','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','host','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientSecret','code','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','error'];(function(_0x4709c8,_0x3384ca){var _0x478cdd=function(_0x5193ce){while(--_0x5193ce){_0x4709c8['push'](_0x4709c8['shift']());}};_0x478cdd(++_0x3384ca);}(_0xf988,0x193));var _0x8f98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf988[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8f98('0x0'));var util=require(_0x8f98('0x1'));var logger=require('../../config/logger')(_0x8f98('0x2'));var moment=require(_0x8f98('0x3'));var BPromise=require(_0x8f98('0x4'));var rp=require(_0x8f98('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f98('0x6'));var config=require(_0x8f98('0x7'));var attributes=require(_0x8f98('0x8'));var integrations=require(_0x8f98('0x9'));module[_0x8f98('0xa')]=function(_0x4a3706,_0x99fcfa){return _0x4a3706[_0x8f98('0xb')]('ZohoAccount',attributes,{'tableName':_0x8f98('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1f64c7,_0x34bc97,_0x3cc858){if(_0x1f64c7[_0x8f98('0xd')](_0x8f98('0xe'))||_0x1f64c7['changed'](_0x8f98('0xf'))||_0x1f64c7['changed'](_0x8f98('0x10'))||_0x1f64c7[_0x8f98('0xd')]('clientSecret')||_0x1f64c7[_0x8f98('0xd')]('code')||_0x1f64c7[_0x8f98('0xd')](_0x8f98('0x11'))){var _0x2e1534,_0x4ff150;_0x2e1534=_0x1f64c7[_0x8f98('0xf')];var _0x34eb78=_0x2e1534['slice'](-0x1);if(_0x34eb78==='/'||_0x34eb78==='\x5c'||_0x34eb78===':'){_0x2e1534=_0x2e1534['substring'](0x0,_0x2e1534[_0x8f98('0x12')](_0x34eb78));}switch(_0x1f64c7[_0x8f98('0xe')]){case'US':_0x4ff150='https://accounts.zoho.com';break;case'AU':_0x4ff150=_0x8f98('0x13');break;case'IN':_0x4ff150=_0x8f98('0x14');break;case'CN':_0x4ff150=_0x8f98('0x15');break;default:_0x4ff150=_0x8f98('0x16');break;}var _0x2d619a={'method':'POST','uri':_0x4ff150+_0x8f98('0x17'),'form':{'grant_type':_0x8f98('0x18'),'client_id':_0x1f64c7[_0x8f98('0x10')],'client_secret':_0x1f64c7[_0x8f98('0x19')],'redirect_uri':_0x1f64c7['serverUrl'],'code':_0x1f64c7[_0x8f98('0x1a')]},'headers':{'Content-Type':_0x8f98('0x1b')}};return rp(_0x2d619a)[_0x8f98('0x1c')](function(_0xe23a90){var _0x1d7cd6=JSON['parse'](_0xe23a90);if(_0x1d7cd6[_0x8f98('0x1d')]){_0x1f64c7[_0x8f98('0x1e')]=_0x1d7cd6['refresh_token'];logger[_0x8f98('0x1f')](util[_0x8f98('0x20')](_0x8f98('0x21'),_0x1f64c7[_0x8f98('0x22')],_0x1f64c7['id']));}else{logger['error'](util[_0x8f98('0x20')](_0x8f98('0x23'),_0x1f64c7[_0x8f98('0x22')],_0x1f64c7['id']),util['inspect'](_0x1d7cd6,{'showHidden':![],'depth':null}));}return _0x3cc858(null,_0x34bc97);})['catch'](function(_0x332364){logger[_0x8f98('0x24')](util['format'](_0x8f98('0x23'),_0x1f64c7[_0x8f98('0x22')],_0x1f64c7['id']),util[_0x8f98('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x3cc858(_0x332364);});}else{return _0x3cc858(null,_0x34bc97);}},'beforeUpdate':function(_0x4a8b51,_0x8ecc94,_0x4fc370){if(_0x4a8b51[_0x8f98('0xd')]('zone')||_0x4a8b51[_0x8f98('0xd')](_0x8f98('0xf'))||_0x4a8b51[_0x8f98('0xd')]('clientId')||_0x4a8b51[_0x8f98('0xd')](_0x8f98('0x19'))||_0x4a8b51[_0x8f98('0xd')]('code')||_0x4a8b51['changed'](_0x8f98('0x11'))){var _0x37b071,_0x542eaa;_0x37b071=_0x4a8b51[_0x8f98('0xf')];var _0x265cd9=_0x37b071[_0x8f98('0x26')](-0x1);if(_0x265cd9==='/'||_0x265cd9==='\x5c'||_0x265cd9===':'){_0x37b071=_0x37b071[_0x8f98('0x27')](0x0,_0x37b071[_0x8f98('0x12')](_0x265cd9));}switch(_0x4a8b51['zone']){case'US':_0x542eaa=_0x8f98('0x28');break;case'AU':_0x542eaa='https://accounts.zoho.com.au';break;case'IN':_0x542eaa=_0x8f98('0x14');break;case'CN':_0x542eaa=_0x8f98('0x15');break;default:_0x542eaa=_0x8f98('0x16');break;}var _0x42c00d={'method':_0x8f98('0x29'),'uri':_0x542eaa+'/oauth/v2/token','form':{'grant_type':_0x8f98('0x18'),'client_id':_0x4a8b51[_0x8f98('0x10')],'client_secret':_0x4a8b51[_0x8f98('0x19')],'redirect_uri':_0x4a8b51['serverUrl'],'code':_0x4a8b51['code']},'headers':{'Content-Type':_0x8f98('0x1b')}};return rp(_0x42c00d)[_0x8f98('0x1c')](function(_0x1c961a){var _0x3f07ee=JSON[_0x8f98('0x2a')](_0x1c961a);if(_0x3f07ee['refresh_token']){_0x4a8b51[_0x8f98('0x1e')]=_0x3f07ee[_0x8f98('0x1d')];logger[_0x8f98('0x1f')](util[_0x8f98('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4a8b51[_0x8f98('0x22')],_0x4a8b51['id']));}else{logger[_0x8f98('0x24')](util[_0x8f98('0x20')](_0x8f98('0x23'),_0x4a8b51[_0x8f98('0x22')],_0x4a8b51['id']),util[_0x8f98('0x25')](_0x3f07ee,{'showHidden':![],'depth':null}));}return _0x4fc370(null,_0x8ecc94);})[_0x8f98('0x2b')](function(_0xeae1d9){logger[_0x8f98('0x24')](util['format'](_0x8f98('0x23'),_0x4a8b51[_0x8f98('0x22')],_0x4a8b51['id']),util[_0x8f98('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x4fc370(_0xeae1d9);});}else{return _0x4fc370(null,_0x8ecc94);}}}});}; \ No newline at end of file +var _0x20c8=['parse','catch','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','code','serverUrl','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','authorization_code','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','host','slice','https://accounts.zoho.com.au','https://accounts.zoho.eu','/oauth/v2/token','clientSecret'];(function(_0xc0638b,_0x2fccf4){var _0xd57dfa=function(_0x322fba){while(--_0x322fba){_0xc0638b['push'](_0xc0638b['shift']());}};_0xd57dfa(++_0x2fccf4);}(_0x20c8,0xae));var _0x820c=function(_0x23e4e6,_0x26ffea){_0x23e4e6=_0x23e4e6-0x0;var _0x393ec5=_0x20c8[_0x23e4e6];return _0x393ec5;};'use strict';var _=require(_0x820c('0x0'));var util=require('util');var logger=require(_0x820c('0x1'))('api');var moment=require(_0x820c('0x2'));var BPromise=require(_0x820c('0x3'));var rp=require(_0x820c('0x4'));var fs=require('fs');var path=require(_0x820c('0x5'));var rimraf=require('rimraf');var config=require(_0x820c('0x6'));var attributes=require(_0x820c('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x820c('0x8')]=function(_0x12ce89,_0x26220a){return _0x12ce89[_0x820c('0x9')](_0x820c('0xa'),attributes,{'tableName':_0x820c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xc6beda,_0x44f069,_0x44df48){if(_0xc6beda[_0x820c('0xc')](_0x820c('0xd'))||_0xc6beda[_0x820c('0xc')]('serverUrl')||_0xc6beda[_0x820c('0xc')](_0x820c('0xe'))||_0xc6beda[_0x820c('0xc')]('clientSecret')||_0xc6beda[_0x820c('0xc')](_0x820c('0xf'))||_0xc6beda[_0x820c('0xc')]('host')){var _0x3a23e7,_0x194a3f;_0x3a23e7=_0xc6beda[_0x820c('0x10')];var _0x1b8a15=_0x3a23e7['slice'](-0x1);if(_0x1b8a15==='/'||_0x1b8a15==='\x5c'||_0x1b8a15===':'){_0x3a23e7=_0x3a23e7[_0x820c('0x11')](0x0,_0x3a23e7[_0x820c('0x12')](_0x1b8a15));}switch(_0xc6beda[_0x820c('0xd')]){case'US':_0x194a3f=_0x820c('0x13');break;case'AU':_0x194a3f='https://accounts.zoho.com.au';break;case'IN':_0x194a3f=_0x820c('0x14');break;case'CN':_0x194a3f=_0x820c('0x15');break;default:_0x194a3f='https://accounts.zoho.eu';break;}var _0x5dc2d6={'method':_0x820c('0x16'),'uri':_0x194a3f+'/oauth/v2/token','form':{'grant_type':_0x820c('0x17'),'client_id':_0xc6beda[_0x820c('0xe')],'client_secret':_0xc6beda['clientSecret'],'redirect_uri':_0xc6beda['serverUrl'],'code':_0xc6beda[_0x820c('0xf')]},'headers':{'Content-Type':_0x820c('0x18')}};return rp(_0x5dc2d6)[_0x820c('0x19')](function(_0x69d9a6){var _0x3b326d=JSON['parse'](_0x69d9a6);if(_0x3b326d[_0x820c('0x1a')]){_0xc6beda[_0x820c('0x1b')]=_0x3b326d[_0x820c('0x1a')];logger[_0x820c('0x1c')](util[_0x820c('0x1d')](_0x820c('0x1e'),_0xc6beda['name'],_0xc6beda['id']));}else{logger[_0x820c('0x1f')](util[_0x820c('0x1d')](_0x820c('0x20'),_0xc6beda[_0x820c('0x21')],_0xc6beda['id']),util['inspect'](_0x3b326d,{'showHidden':![],'depth':null}));}return _0x44df48(null,_0x44f069);})['catch'](function(_0x50b241){logger[_0x820c('0x1f')](util['format'](_0x820c('0x20'),_0xc6beda[_0x820c('0x21')],_0xc6beda['id']),util[_0x820c('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x44df48(_0x50b241);});}else{return _0x44df48(null,_0x44f069);}},'beforeUpdate':function(_0x5001b1,_0x16ceec,_0x43ad89){if(_0x5001b1[_0x820c('0xc')](_0x820c('0xd'))||_0x5001b1['changed'](_0x820c('0x10'))||_0x5001b1[_0x820c('0xc')](_0x820c('0xe'))||_0x5001b1[_0x820c('0xc')]('clientSecret')||_0x5001b1[_0x820c('0xc')](_0x820c('0xf'))||_0x5001b1['changed'](_0x820c('0x23'))){var _0x43f5ad,_0x21ae4d;_0x43f5ad=_0x5001b1['serverUrl'];var _0x3558c8=_0x43f5ad[_0x820c('0x24')](-0x1);if(_0x3558c8==='/'||_0x3558c8==='\x5c'||_0x3558c8===':'){_0x43f5ad=_0x43f5ad[_0x820c('0x11')](0x0,_0x43f5ad['lastIndexOf'](_0x3558c8));}switch(_0x5001b1[_0x820c('0xd')]){case'US':_0x21ae4d=_0x820c('0x13');break;case'AU':_0x21ae4d=_0x820c('0x25');break;case'IN':_0x21ae4d=_0x820c('0x14');break;case'CN':_0x21ae4d=_0x820c('0x15');break;default:_0x21ae4d=_0x820c('0x26');break;}var _0x53eea5={'method':_0x820c('0x16'),'uri':_0x21ae4d+_0x820c('0x27'),'form':{'grant_type':'authorization_code','client_id':_0x5001b1[_0x820c('0xe')],'client_secret':_0x5001b1[_0x820c('0x28')],'redirect_uri':_0x5001b1[_0x820c('0x10')],'code':_0x5001b1[_0x820c('0xf')]},'headers':{'Content-Type':_0x820c('0x18')}};return rp(_0x53eea5)[_0x820c('0x19')](function(_0x204ae2){var _0x32a92d=JSON[_0x820c('0x29')](_0x204ae2);if(_0x32a92d['refresh_token']){_0x5001b1[_0x820c('0x1b')]=_0x32a92d[_0x820c('0x1a')];logger[_0x820c('0x1c')](util[_0x820c('0x1d')](_0x820c('0x1e'),_0x5001b1[_0x820c('0x21')],_0x5001b1['id']));}else{logger[_0x820c('0x1f')](util[_0x820c('0x1d')](_0x820c('0x20'),_0x5001b1[_0x820c('0x21')],_0x5001b1['id']),util[_0x820c('0x22')](_0x32a92d,{'showHidden':![],'depth':null}));}return _0x43ad89(null,_0x16ceec);})[_0x820c('0x2a')](function(_0x2dd666){logger[_0x820c('0x1f')](util[_0x820c('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5001b1['name'],_0x5001b1['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x43ad89(_0x2dd666);});}else{return _0x43ad89(null,_0x16ceec);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index be78d20..2296134 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 _0x2eba=['where','attributes','limit','map','include','model','ShowZohoAccount','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2eba,0xc7));var _0xa2eb=function(_0x46ff12,_0x1797a1){_0x46ff12=_0x46ff12-0x0;var _0x1d13d0=_0x2eba[_0x46ff12];return _0x1d13d0;};'use strict';var _=require('lodash');var util=require(_0xa2eb('0x0'));var moment=require(_0xa2eb('0x1'));var BPromise=require(_0xa2eb('0x2'));var rs=require(_0xa2eb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa2eb('0x4'));var logger=require('../../config/logger')(_0xa2eb('0x5'));var config=require(_0xa2eb('0x6'));var jayson=require(_0xa2eb('0x7'));var client=jayson[_0xa2eb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x545db3,_0x56b33a,_0x4ed534){return new BPromise(function(_0x550a3c,_0x56408f){return client[_0xa2eb('0x9')](_0x545db3,_0x4ed534)[_0xa2eb('0xa')](function(_0x5480a1){logger['info'](_0xa2eb('0xb'),_0x56b33a,_0xa2eb('0xc'));logger[_0xa2eb('0xd')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x56b33a,_0xa2eb('0xc'),JSON[_0xa2eb('0xe')](_0x5480a1));if(_0x5480a1['error']){if(_0x5480a1[_0xa2eb('0xf')]['code']===0x1f4){logger[_0xa2eb('0xf')](_0xa2eb('0xb'),_0x56b33a,_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);return _0x56408f(_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);}logger['error'](_0xa2eb('0xb'),_0x56b33a,_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);return _0x550a3c(_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);}else{logger[_0xa2eb('0x11')](_0xa2eb('0xb'),_0x56b33a,_0xa2eb('0xc'));_0x550a3c(_0x5480a1[_0xa2eb('0x12')][_0xa2eb('0x10')]);}})[_0xa2eb('0x13')](function(_0x3a02d5){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x56b33a,_0x3a02d5);_0x56408f(_0x3a02d5);});});}exports[_0xa2eb('0x14')]=function(_0xa74836){var _0x18ce2e=this;return new Promise(function(_0xe1c088,_0x273da2){return db[_0xa2eb('0x15')][_0xa2eb('0x16')]({'raw':_0xa74836['options']?_0xa74836[_0xa2eb('0x17')][_0xa2eb('0x18')]===undefined?!![]:![]:!![],'where':_0xa74836[_0xa2eb('0x17')]?_0xa74836[_0xa2eb('0x17')][_0xa2eb('0x19')]||null:null,'attributes':_0xa74836['options']?_0xa74836['options'][_0xa2eb('0x1a')]||null:null,'limit':_0xa74836[_0xa2eb('0x17')]?_0xa74836['options'][_0xa2eb('0x1b')]||null:null,'include':_0xa74836[_0xa2eb('0x17')]?_0xa74836['options']['include']?_[_0xa2eb('0x1c')](_0xa74836[_0xa2eb('0x17')][_0xa2eb('0x1d')],function(_0x1a95f6){return{'model':db[_0x1a95f6[_0xa2eb('0x1e')]],'as':_0x1a95f6['as'],'attributes':_0x1a95f6['attributes'],'include':_0x1a95f6[_0xa2eb('0x1d')]?_[_0xa2eb('0x1c')](_0x1a95f6[_0xa2eb('0x1d')],function(_0x15ca14){return{'model':db[_0x15ca14[_0xa2eb('0x1e')]],'as':_0x15ca14['as'],'attributes':_0x15ca14[_0xa2eb('0x1a')],'include':_0x15ca14['include']?_[_0xa2eb('0x1c')](_0x15ca14['include'],function(_0x16ef8c){return{'model':db[_0x16ef8c[_0xa2eb('0x1e')]],'as':_0x16ef8c['as'],'attributes':_0x16ef8c[_0xa2eb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa2eb('0xa')](function(_0x1890ce){logger['info'](_0xa2eb('0x14'),_0xa74836);logger[_0xa2eb('0xd')](_0xa2eb('0x14'),_0xa74836,JSON[_0xa2eb('0xe')](_0x1890ce));_0xe1c088(_0x1890ce);})[_0xa2eb('0x13')](function(_0x245658){logger[_0xa2eb('0xf')]('GetZohoAccount',_0x245658['message'],_0xa74836);_0x273da2(_0x18ce2e['error'](0x1f4,_0x245658[_0xa2eb('0x10')]));});});};exports[_0xa2eb('0x1f')]=function(_0x51b1e7){var _0x2a28b7=this;return new Promise(function(_0x353b28,_0x56ddc4){return db[_0xa2eb('0x15')]['find']({'raw':_0x51b1e7['options']?_0x51b1e7[_0xa2eb('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x51b1e7[_0xa2eb('0x17')]?_0x51b1e7['options']['where']||null:null,'attributes':_0x51b1e7[_0xa2eb('0x17')]?_0x51b1e7[_0xa2eb('0x17')][_0xa2eb('0x1a')]||null:null,'include':_0x51b1e7[_0xa2eb('0x17')]?_0x51b1e7[_0xa2eb('0x17')][_0xa2eb('0x1d')]?_[_0xa2eb('0x1c')](_0x51b1e7[_0xa2eb('0x17')][_0xa2eb('0x1d')],function(_0x563b17){return{'model':db[_0x563b17[_0xa2eb('0x1e')]],'as':_0x563b17['as'],'attributes':_0x563b17[_0xa2eb('0x1a')],'include':_0x563b17[_0xa2eb('0x1d')]?_[_0xa2eb('0x1c')](_0x563b17[_0xa2eb('0x1d')],function(_0x1d2686){return{'model':db[_0x1d2686[_0xa2eb('0x1e')]],'as':_0x1d2686['as'],'attributes':_0x1d2686[_0xa2eb('0x1a')],'include':_0x1d2686[_0xa2eb('0x1d')]?_['map'](_0x1d2686[_0xa2eb('0x1d')],function(_0x29179f){return{'model':db[_0x29179f['model']],'as':_0x29179f['as'],'attributes':_0x29179f[_0xa2eb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa2eb('0xa')](function(_0x1f87e7){logger[_0xa2eb('0x11')]('ShowZohoAccount',_0x51b1e7);logger[_0xa2eb('0xd')](_0xa2eb('0x1f'),_0x51b1e7,JSON[_0xa2eb('0xe')](_0x1f87e7));_0x353b28(_0x1f87e7);})[_0xa2eb('0x13')](function(_0x322c1b){logger[_0xa2eb('0xf')](_0xa2eb('0x1f'),_0x322c1b[_0xa2eb('0x10')],_0x51b1e7);_0x56ddc4(_0x2a28b7[_0xa2eb('0xf')](0x1f4,_0x322c1b[_0xa2eb('0x10')]));});});}; \ No newline at end of file +var _0xad5f=['rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZohoAccount','findAll','options','attributes','limit','map','include','model','ShowZohoAccount','ZohoAccount','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xad5f,0x1a8));var _0xfad5=function(_0x4c978c,_0xbd7d69){_0x4c978c=_0x4c978c-0x0;var _0x48db9c=_0xad5f[_0x4c978c];return _0x48db9c;};'use strict';var _=require(_0xfad5('0x0'));var util=require(_0xfad5('0x1'));var moment=require(_0xfad5('0x2'));var BPromise=require(_0xfad5('0x3'));var rs=require(_0xfad5('0x4'));var fs=require('fs');var Redis=require(_0xfad5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfad5('0x6'));var logger=require(_0xfad5('0x7'))(_0xfad5('0x8'));var config=require(_0xfad5('0x9'));var jayson=require(_0xfad5('0xa'));var client=jayson[_0xfad5('0xb')][_0xfad5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5811f7,_0xf71084,_0x28566c){return new BPromise(function(_0x39d228,_0xbe8f56){return client['request'](_0x5811f7,_0x28566c)[_0xfad5('0xd')](function(_0xac127d){logger[_0xfad5('0xe')](_0xfad5('0xf'),_0xf71084,_0xfad5('0x10'));logger[_0xfad5('0x11')](_0xfad5('0x12'),_0xf71084,'request\x20sent',JSON[_0xfad5('0x13')](_0xac127d));if(_0xac127d[_0xfad5('0x14')]){if(_0xac127d[_0xfad5('0x14')]['code']===0x1f4){logger['error'](_0xfad5('0xf'),_0xf71084,_0xac127d[_0xfad5('0x14')][_0xfad5('0x15')]);return _0xbe8f56(_0xac127d[_0xfad5('0x14')][_0xfad5('0x15')]);}logger['error'](_0xfad5('0xf'),_0xf71084,_0xac127d[_0xfad5('0x14')][_0xfad5('0x15')]);return _0x39d228(_0xac127d[_0xfad5('0x14')][_0xfad5('0x15')]);}else{logger[_0xfad5('0xe')](_0xfad5('0xf'),_0xf71084,'request\x20sent');_0x39d228(_0xac127d['result'][_0xfad5('0x15')]);}})[_0xfad5('0x16')](function(_0x311e75){logger[_0xfad5('0x14')](_0xfad5('0xf'),_0xf71084,_0x311e75);_0xbe8f56(_0x311e75);});});}exports[_0xfad5('0x17')]=function(_0x10ae77){var _0x2fc3ed=this;return new Promise(function(_0x259766,_0x558590){return db['ZohoAccount'][_0xfad5('0x18')]({'raw':_0x10ae77[_0xfad5('0x19')]?_0x10ae77['options']['raw']===undefined?!![]:![]:!![],'where':_0x10ae77[_0xfad5('0x19')]?_0x10ae77[_0xfad5('0x19')]['where']||null:null,'attributes':_0x10ae77['options']?_0x10ae77[_0xfad5('0x19')][_0xfad5('0x1a')]||null:null,'limit':_0x10ae77[_0xfad5('0x19')]?_0x10ae77[_0xfad5('0x19')][_0xfad5('0x1b')]||null:null,'include':_0x10ae77['options']?_0x10ae77[_0xfad5('0x19')]['include']?_[_0xfad5('0x1c')](_0x10ae77[_0xfad5('0x19')][_0xfad5('0x1d')],function(_0x16e903){return{'model':db[_0x16e903[_0xfad5('0x1e')]],'as':_0x16e903['as'],'attributes':_0x16e903[_0xfad5('0x1a')],'include':_0x16e903[_0xfad5('0x1d')]?_[_0xfad5('0x1c')](_0x16e903[_0xfad5('0x1d')],function(_0x45c149){return{'model':db[_0x45c149[_0xfad5('0x1e')]],'as':_0x45c149['as'],'attributes':_0x45c149['attributes'],'include':_0x45c149[_0xfad5('0x1d')]?_[_0xfad5('0x1c')](_0x45c149[_0xfad5('0x1d')],function(_0xc772e6){return{'model':db[_0xc772e6[_0xfad5('0x1e')]],'as':_0xc772e6['as'],'attributes':_0xc772e6['attributes']};}):[]};}):[]};}):[]:[]})[_0xfad5('0xd')](function(_0x3d9d95){logger[_0xfad5('0xe')]('GetZohoAccount',_0x10ae77);logger[_0xfad5('0x11')]('GetZohoAccount',_0x10ae77,JSON[_0xfad5('0x13')](_0x3d9d95));_0x259766(_0x3d9d95);})[_0xfad5('0x16')](function(_0x30ce5b){logger['error'](_0xfad5('0x17'),_0x30ce5b['message'],_0x10ae77);_0x558590(_0x2fc3ed['error'](0x1f4,_0x30ce5b['message']));});});};exports[_0xfad5('0x1f')]=function(_0x1f5329){var _0x3c3f0f=this;return new Promise(function(_0x1133fd,_0x1e789a){return db[_0xfad5('0x20')][_0xfad5('0x21')]({'raw':_0x1f5329[_0xfad5('0x19')]?_0x1f5329[_0xfad5('0x19')][_0xfad5('0x22')]===undefined?!![]:![]:!![],'where':_0x1f5329['options']?_0x1f5329[_0xfad5('0x19')][_0xfad5('0x23')]||null:null,'attributes':_0x1f5329[_0xfad5('0x19')]?_0x1f5329['options'][_0xfad5('0x1a')]||null:null,'include':_0x1f5329[_0xfad5('0x19')]?_0x1f5329[_0xfad5('0x19')][_0xfad5('0x1d')]?_['map'](_0x1f5329[_0xfad5('0x19')][_0xfad5('0x1d')],function(_0x147aa6){return{'model':db[_0x147aa6[_0xfad5('0x1e')]],'as':_0x147aa6['as'],'attributes':_0x147aa6[_0xfad5('0x1a')],'include':_0x147aa6['include']?_[_0xfad5('0x1c')](_0x147aa6[_0xfad5('0x1d')],function(_0x37fff5){return{'model':db[_0x37fff5['model']],'as':_0x37fff5['as'],'attributes':_0x37fff5[_0xfad5('0x1a')],'include':_0x37fff5[_0xfad5('0x1d')]?_['map'](_0x37fff5['include'],function(_0x334b10){return{'model':db[_0x334b10[_0xfad5('0x1e')]],'as':_0x334b10['as'],'attributes':_0x334b10[_0xfad5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfad5('0xd')](function(_0x232192){logger[_0xfad5('0xe')](_0xfad5('0x1f'),_0x1f5329);logger['debug'](_0xfad5('0x1f'),_0x1f5329,JSON[_0xfad5('0x13')](_0x232192));_0x1133fd(_0x232192);})[_0xfad5('0x16')](function(_0x3aa0e2){logger[_0xfad5('0x14')]('ShowZohoAccount',_0x3aa0e2[_0xfad5('0x15')],_0x1f5329);_0x1e789a(_0x3c3f0f[_0xfad5('0x14')](0x1f4,_0x3aa0e2['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index dc66b8c..c28a2dc 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 _0xf026=['../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x5b7662,_0x5d4c1c){var _0x2d3f4e=function(_0x50a393){while(--_0x50a393){_0x5b7662['push'](_0x5b7662['shift']());}};_0x2d3f4e(++_0x5d4c1c);}(_0xf026,0xc1));var _0x6f02=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0xf026[_0x6e1239];return _0x418150;};'use strict';var multer=require(_0x6f02('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6f02('0x1'));var express=require('express');var router=express[_0x6f02('0x2')]();var fs_extra=require(_0x6f02('0x3'));var auth=require(_0x6f02('0x4'));var interaction=require(_0x6f02('0x5'));var config=require(_0x6f02('0x6'));var controller=require(_0x6f02('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6f02('0x8')](_0x6f02('0x9'),auth[_0x6f02('0xa')](),controller[_0x6f02('0xb')]);router['get'](_0x6f02('0xc'),auth[_0x6f02('0xa')](),controller['getFields']);router[_0x6f02('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x6f02('0xd')]);router[_0x6f02('0x8')](_0x6f02('0xe'),auth[_0x6f02('0xa')](),controller[_0x6f02('0xf')]);router[_0x6f02('0x10')]('/',auth['isAuthenticated'](),controller[_0x6f02('0x11')]);router[_0x6f02('0x12')](_0x6f02('0x9'),auth[_0x6f02('0xa')](),controller[_0x6f02('0x13')]);router[_0x6f02('0x14')](_0x6f02('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x6f02('0x15')]=router; \ No newline at end of file +var _0x9d96=['/:id/descriptions','getDescriptions','post','create','put','delete','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x2deb15,_0x102a17){var _0x1abb33=function(_0x1a1a10){while(--_0x1a1a10){_0x2deb15['push'](_0x2deb15['shift']());}};_0x1abb33(++_0x102a17);}(_0x9d96,0x195));var _0x69d9=function(_0x5aaf56,_0x590a02){_0x5aaf56=_0x5aaf56-0x0;var _0x4e2204=_0x9d96[_0x5aaf56];return _0x4e2204;};'use strict';var multer=require(_0x69d9('0x0'));var util=require(_0x69d9('0x1'));var path=require('path');var timeout=require(_0x69d9('0x2'));var express=require('express');var router=express[_0x69d9('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x69d9('0x4'));var config=require(_0x69d9('0x5'));var controller=require(_0x69d9('0x6'));router[_0x69d9('0x7')]('/',auth[_0x69d9('0x8')](),controller[_0x69d9('0x9')]);router[_0x69d9('0x7')](_0x69d9('0xa'),auth[_0x69d9('0x8')](),controller['show']);router['get'](_0x69d9('0xb'),auth[_0x69d9('0x8')](),controller[_0x69d9('0xc')]);router[_0x69d9('0x7')](_0x69d9('0xd'),auth[_0x69d9('0x8')](),controller[_0x69d9('0xe')]);router['get'](_0x69d9('0xf'),auth[_0x69d9('0x8')](),controller[_0x69d9('0x10')]);router[_0x69d9('0x11')]('/',auth[_0x69d9('0x8')](),controller[_0x69d9('0x12')]);router[_0x69d9('0x13')](_0x69d9('0xa'),auth[_0x69d9('0x8')](),controller['update']);router[_0x69d9('0x14')]('/:id',auth[_0x69d9('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 3e66613..5b018b9 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 _0x9579=['sequelize','STRING','ENUM','contact','lead','contact_lead'];(function(_0x187959,_0x5e56bd){var _0x29cef4=function(_0x55abfa){while(--_0x55abfa){_0x187959['push'](_0x187959['shift']());}};_0x29cef4(++_0x5e56bd);}(_0x9579,0x16e));var _0x9957=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9579[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require(_0x9957('0x0'));module['exports']={'name':{'type':Sequelize[_0x9957('0x1')]},'moduleCreate':{'type':Sequelize[_0x9957('0x2')]('lead',_0x9957('0x3'),'nothing'),'defaultValue':_0x9957('0x4')},'moduleSearch':{'type':Sequelize[_0x9957('0x2')](_0x9957('0x5'),_0x9957('0x3'),_0x9957('0x4')),'defaultValue':_0x9957('0x5')},'description':{'type':Sequelize[_0x9957('0x1')]}}; \ No newline at end of file +var _0x7e17=['contact','nothing','lead','contact_lead','exports','STRING','ENUM'];(function(_0x32729c,_0xf5afd8){var _0x482cfd=function(_0x231471){while(--_0x231471){_0x32729c['push'](_0x32729c['shift']());}};_0x482cfd(++_0xf5afd8);}(_0x7e17,0x89));var _0x77e1=function(_0x2d33c7,_0x20e736){_0x2d33c7=_0x2d33c7-0x0;var _0x3f5a29=_0x7e17[_0x2d33c7];return _0x3f5a29;};'use strict';var Sequelize=require('sequelize');module[_0x77e1('0x0')]={'name':{'type':Sequelize[_0x77e1('0x1')]},'moduleCreate':{'type':Sequelize[_0x77e1('0x2')]('lead',_0x77e1('0x3'),_0x77e1('0x4')),'defaultValue':_0x77e1('0x5')},'moduleSearch':{'type':Sequelize[_0x77e1('0x2')](_0x77e1('0x6'),'contact',_0x77e1('0x5')),'defaultValue':_0x77e1('0x6')},'description':{'type':Sequelize[_0x77e1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index fa10e77..7c64f53 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 _0x359d=['pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','ZohoField','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x359d,0x1f3));var _0xd359=function(_0x3a0863,_0x4cd5ef){_0x3a0863=_0x3a0863-0x0;var _0x85c557=_0x359d[_0x3a0863];return _0x85c557;};'use strict';var emlformat=require(_0xd359('0x0'));var rimraf=require(_0xd359('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd359('0x2'));var rp=require(_0xd359('0x3'));var moment=require(_0xd359('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd359('0x5'));var util=require(_0xd359('0x6'));var path=require(_0xd359('0x7'));var sox=require(_0xd359('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd359('0x9'));var _=require('lodash');var squel=require(_0xd359('0xa'));var crypto=require('crypto');var jsforce=require(_0xd359('0xb'));var deskjs=require(_0xd359('0xc'));var toCsv=require(_0xd359('0xd'));var querystring=require(_0xd359('0xe'));var Papa=require(_0xd359('0xf'));var Redis=require(_0xd359('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd359('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd359('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd359('0x13'));var licenseUtil=require(_0xd359('0x14'));var db=require(_0xd359('0x15'))['db'];function respondWithStatusCode(_0x294784,_0x3b0ebc){_0x3b0ebc=_0x3b0ebc||0xcc;return function(_0x4b3b9f){if(_0x4b3b9f){return _0x294784['sendStatus'](_0x3b0ebc);}return _0x294784['status'](_0x3b0ebc)[_0xd359('0x16')]();};}function respondWithResult(_0x7d81b7,_0x3e1cb8){_0x3e1cb8=_0x3e1cb8||0xc8;return function(_0x4f1dd0){if(_0x4f1dd0){return _0x7d81b7[_0xd359('0x17')](_0x3e1cb8)[_0xd359('0x18')](_0x4f1dd0);}};}function respondWithFilteredResult(_0x534770,_0x55bbb5){return function(_0x557632){if(_0x557632){var _0x3f69f6=typeof _0x55bbb5[_0xd359('0x19')]===_0xd359('0x1a')&&typeof _0x55bbb5[_0xd359('0x1b')]===_0xd359('0x1a');var _0x2f5019=_0x557632[_0xd359('0x1c')];var _0x3f83d4=_0x3f69f6?0x0:_0x55bbb5[_0xd359('0x19')];var _0x39d46f=_0x3f69f6?_0x557632[_0xd359('0x1c')]:_0x55bbb5[_0xd359('0x19')]+_0x55bbb5[_0xd359('0x1b')];var _0x2dcd8a;if(_0x39d46f>=_0x2f5019){_0x39d46f=_0x2f5019;_0x2dcd8a=0xc8;}else{_0x2dcd8a=0xce;}_0x534770[_0xd359('0x17')](_0x2dcd8a);return _0x534770[_0xd359('0x1d')](_0xd359('0x1e'),_0x3f83d4+'-'+_0x39d46f+'/'+_0x2f5019)[_0xd359('0x18')](_0x557632);}return null;};}function patchUpdates(_0x3c317b){return function(_0x4590f7){try{jsonpatch[_0xd359('0x1f')](_0x4590f7,_0x3c317b,!![]);}catch(_0x14fc27){return BPromise[_0xd359('0x20')](_0x14fc27);}return _0x4590f7[_0xd359('0x21')]();};}function saveUpdates(_0x137f5f,_0xb93d28){return function(_0x45e154){if(_0x45e154){return _0x45e154[_0xd359('0x22')](_0x137f5f)[_0xd359('0x23')](function(_0x22e953){return _0x22e953;});}return null;};}function removeEntity(_0x268a00,_0x3fc043){return function(_0x377a30){if(_0x377a30){return _0x377a30[_0xd359('0x24')]()[_0xd359('0x23')](function(){_0x268a00[_0xd359('0x17')](0xcc)[_0xd359('0x16')]();});}};}function handleEntityNotFound(_0x18f7cb,_0x45ff74){return function(_0x19d439){if(!_0x19d439){_0x18f7cb[_0xd359('0x25')](0x194);}return _0x19d439;};}function handleError(_0x1ba8bf,_0x5e1b1c){_0x5e1b1c=_0x5e1b1c||0x1f4;return function(_0x1afe16){logger[_0xd359('0x26')](_0x1afe16[_0xd359('0x27')]);if(_0x1afe16['name']){delete _0x1afe16[_0xd359('0x28')];}_0x1ba8bf[_0xd359('0x17')](_0x5e1b1c)[_0xd359('0x29')](_0x1afe16);};}exports[_0xd359('0x2a')]=function(_0x3d49ae,_0x56e71a){var _0x7a7365={},_0x2a295d={},_0x1d5b36={'count':0x0,'rows':[]};var _0x2c3cf5=_[_0xd359('0x2b')](db[_0xd359('0x2c')][_0xd359('0x2d')],function(_0x48e4f1){return{'name':_0x48e4f1['fieldName'],'type':_0x48e4f1[_0xd359('0x2e')][_0xd359('0x2f')]};});_0x2a295d[_0xd359('0x30')]=_[_0xd359('0x2b')](_0x2c3cf5,_0xd359('0x28'));_0x2a295d[_0xd359('0x31')]=_[_0xd359('0x32')](_0x3d49ae['query']);_0x2a295d[_0xd359('0x33')]=_['intersection'](_0x2a295d[_0xd359('0x30')],_0x2a295d[_0xd359('0x31')]);_0x7a7365['attributes']=_[_0xd359('0x34')](_0x2a295d[_0xd359('0x30')],qs[_0xd359('0x35')](_0x3d49ae['query']['fields']));_0x7a7365['attributes']=_0x7a7365[_0xd359('0x36')][_0xd359('0x37')]?_0x7a7365['attributes']:_0x2a295d['model'];if(!_0x3d49ae[_0xd359('0x31')][_0xd359('0x38')](_0xd359('0x39'))){_0x7a7365[_0xd359('0x1b')]=qs[_0xd359('0x1b')](_0x3d49ae[_0xd359('0x31')][_0xd359('0x1b')]);_0x7a7365[_0xd359('0x19')]=qs[_0xd359('0x19')](_0x3d49ae['query'][_0xd359('0x19')]);}_0x7a7365[_0xd359('0x3a')]=qs[_0xd359('0x3b')](_0x3d49ae[_0xd359('0x31')]['sort']);_0x7a7365[_0xd359('0x3c')]=qs['filters'](_[_0xd359('0x3d')](_0x3d49ae[_0xd359('0x31')],_0x2a295d[_0xd359('0x33')]),_0x2c3cf5);if(_0x3d49ae[_0xd359('0x31')][_0xd359('0x3e')]){_0x7a7365['where']=_[_0xd359('0x3f')](_0x7a7365['where'],{'$or':_[_0xd359('0x2b')](_0x2c3cf5,function(_0x526627){if(_0x526627[_0xd359('0x2e')]!==_0xd359('0x40')){var _0x441273={};_0x441273[_0x526627[_0xd359('0x28')]]={'$like':'%'+_0x3d49ae[_0xd359('0x31')]['filter']+'%'};return _0x441273;}})});}_0x7a7365=_['merge']({},_0x7a7365,_0x3d49ae[_0xd359('0x41')]);var _0x48a9b4={'where':_0x7a7365[_0xd359('0x3c')]};return db[_0xd359('0x2c')][_0xd359('0x1c')](_0x48a9b4)['then'](function(_0x2e2fa9){_0x1d5b36[_0xd359('0x1c')]=_0x2e2fa9;if(_0x3d49ae[_0xd359('0x31')]['includeAll']){_0x7a7365['include']=[{'all':!![]}];}return db[_0xd359('0x2c')][_0xd359('0x42')](_0x7a7365);})[_0xd359('0x23')](function(_0x5ea4cd){_0x1d5b36[_0xd359('0x43')]=_0x5ea4cd;return _0x1d5b36;})[_0xd359('0x23')](respondWithFilteredResult(_0x56e71a,_0x7a7365))[_0xd359('0x44')](handleError(_0x56e71a,null));};exports[_0xd359('0x45')]=function(_0x603964,_0x20a0fb){var _0x1d215d={'raw':![],'where':{'id':_0x603964[_0xd359('0x46')]['id']}},_0x3bc2c3={};_0x3bc2c3[_0xd359('0x30')]=_[_0xd359('0x32')](db[_0xd359('0x2c')]['rawAttributes']);_0x3bc2c3[_0xd359('0x31')]=_['keys'](_0x603964[_0xd359('0x31')]);_0x3bc2c3[_0xd359('0x33')]=_[_0xd359('0x34')](_0x3bc2c3[_0xd359('0x30')],_0x3bc2c3['query']);_0x1d215d[_0xd359('0x36')]=_[_0xd359('0x34')](_0x3bc2c3[_0xd359('0x30')],qs[_0xd359('0x35')](_0x603964[_0xd359('0x31')][_0xd359('0x35')]));_0x1d215d['attributes']=_0x1d215d[_0xd359('0x36')][_0xd359('0x37')]?_0x1d215d[_0xd359('0x36')]:_0x3bc2c3[_0xd359('0x30')];if(_0x603964['query'][_0xd359('0x47')]){_0x1d215d[_0xd359('0x48')]=[{'all':!![]}];}_0x1d215d=_[_0xd359('0x3f')]({},_0x1d215d,_0x603964[_0xd359('0x41')]);return db[_0xd359('0x2c')][_0xd359('0x49')](_0x1d215d)[_0xd359('0x23')](handleEntityNotFound(_0x20a0fb,null))[_0xd359('0x23')](respondWithResult(_0x20a0fb,null))[_0xd359('0x44')](handleError(_0x20a0fb,null));};exports[_0xd359('0x4a')]=function(_0x536ea0,_0x234a23){return db['ZohoConfiguration'][_0xd359('0x4a')](_0x536ea0[_0xd359('0x4b')],{})[_0xd359('0x23')](respondWithResult(_0x234a23,0xc9))['catch'](handleError(_0x234a23,null));};exports[_0xd359('0x22')]=function(_0x2c081a,_0x3c34e7){if(_0x2c081a['body']['id']){delete _0x2c081a[_0xd359('0x4b')]['id'];}return db[_0xd359('0x2c')][_0xd359('0x49')]({'where':{'id':_0x2c081a['params']['id']}})['then'](handleEntityNotFound(_0x3c34e7,null))[_0xd359('0x23')](saveUpdates(_0x2c081a['body'],null))[_0xd359('0x23')](respondWithResult(_0x3c34e7,null))[_0xd359('0x44')](handleError(_0x3c34e7,null));};exports['destroy']=function(_0x3b9bcd,_0x358a42){return db['ZohoConfiguration'][_0xd359('0x49')]({'where':{'id':_0x3b9bcd[_0xd359('0x46')]['id']}})[_0xd359('0x23')](handleEntityNotFound(_0x358a42,null))[_0xd359('0x23')](removeEntity(_0x358a42,null))[_0xd359('0x44')](handleError(_0x358a42,null));};exports['getFields']=function(_0x1bfd56,_0x235a9e,_0x1c9756){var _0x102d55={};var _0xa2d757={};var _0x32ba7f;var _0x199fa6;return db[_0xd359('0x2c')]['findOne']({'where':{'id':_0x1bfd56[_0xd359('0x46')]['id']}})[_0xd359('0x23')](handleEntityNotFound(_0x235a9e,null))[_0xd359('0x23')](function(_0x28ae83){if(_0x28ae83){_0x32ba7f=_0x28ae83;_0xa2d757[_0xd359('0x30')]=_['keys'](db[_0xd359('0x4c')][_0xd359('0x2d')]);_0xa2d757[_0xd359('0x31')]=_['keys'](_0x1bfd56[_0xd359('0x31')]);_0xa2d757[_0xd359('0x33')]=_[_0xd359('0x34')](_0xa2d757[_0xd359('0x30')],_0xa2d757[_0xd359('0x31')]);_0x102d55['attributes']=_[_0xd359('0x34')](_0xa2d757['model'],qs[_0xd359('0x35')](_0x1bfd56[_0xd359('0x31')][_0xd359('0x35')]));_0x102d55[_0xd359('0x36')]=_0x102d55[_0xd359('0x36')][_0xd359('0x37')]?_0x102d55[_0xd359('0x36')]:_0xa2d757[_0xd359('0x30')];_0x102d55[_0xd359('0x3a')]=qs['sort'](_0x1bfd56[_0xd359('0x31')][_0xd359('0x3b')]);_0x102d55[_0xd359('0x3c')]=qs[_0xd359('0x33')](_[_0xd359('0x3d')](_0x1bfd56[_0xd359('0x31')],_0xa2d757[_0xd359('0x33')]));if(_0x1bfd56[_0xd359('0x31')][_0xd359('0x3e')]){_0x102d55[_0xd359('0x3c')]=_['merge'](_0x102d55[_0xd359('0x3c')],{'$or':_['map'](_0x102d55[_0xd359('0x36')],function(_0x5d2ae2){var _0x241238={};_0x241238[_0x5d2ae2]={'$like':'%'+_0x1bfd56['query'][_0xd359('0x3e')]+'%'};return _0x241238;})});}_0x102d55=_[_0xd359('0x3f')]({},_0x102d55,_0x1bfd56[_0xd359('0x41')]);return _0x32ba7f['getFields'](_0x102d55);}})[_0xd359('0x23')](function(_0x1b3238){if(_0x1b3238){_0x199fa6=_0x1b3238[_0xd359('0x37')];if(!_0x1bfd56[_0xd359('0x31')]['hasOwnProperty'](_0xd359('0x39'))){_0x102d55['limit']=qs['limit'](_0x1bfd56['query'][_0xd359('0x1b')]);_0x102d55['offset']=qs[_0xd359('0x19')](_0x1bfd56[_0xd359('0x31')][_0xd359('0x19')]);}return _0x32ba7f['getFields'](_0x102d55);}})[_0xd359('0x23')](function(_0x386d52){if(_0x386d52){return _0x386d52?{'count':_0x199fa6,'rows':_0x386d52}:null;}})[_0xd359('0x23')](respondWithResult(_0x235a9e,null))['catch'](handleError(_0x235a9e,null));};exports[_0xd359('0x4d')]=function(_0x5a3577,_0x451483,_0x528c16){var _0x4e46df={};var _0xb20016={};var _0x40555f;var _0x545705;return db[_0xd359('0x2c')][_0xd359('0x4e')]({'where':{'id':_0x5a3577[_0xd359('0x46')]['id']}})[_0xd359('0x23')](handleEntityNotFound(_0x451483,null))[_0xd359('0x23')](function(_0x1ffacb){if(_0x1ffacb){_0x40555f=_0x1ffacb;_0xb20016['model']=_[_0xd359('0x32')](db[_0xd359('0x4c')][_0xd359('0x2d')]);_0xb20016[_0xd359('0x31')]=_[_0xd359('0x32')](_0x5a3577[_0xd359('0x31')]);_0xb20016[_0xd359('0x33')]=_['intersection'](_0xb20016[_0xd359('0x30')],_0xb20016['query']);_0x4e46df['attributes']=_[_0xd359('0x34')](_0xb20016[_0xd359('0x30')],qs[_0xd359('0x35')](_0x5a3577['query'][_0xd359('0x35')]));_0x4e46df['attributes']=_0x4e46df[_0xd359('0x36')]['length']?_0x4e46df[_0xd359('0x36')]:_0xb20016[_0xd359('0x30')];_0x4e46df['order']=qs['sort'](_0x5a3577[_0xd359('0x31')][_0xd359('0x3b')]);_0x4e46df[_0xd359('0x3c')]=qs[_0xd359('0x33')](_['pick'](_0x5a3577['query'],_0xb20016[_0xd359('0x33')]));if(_0x5a3577[_0xd359('0x31')][_0xd359('0x3e')]){_0x4e46df[_0xd359('0x3c')]=_[_0xd359('0x3f')](_0x4e46df[_0xd359('0x3c')],{'$or':_[_0xd359('0x2b')](_0x4e46df[_0xd359('0x36')],function(_0x165979){var _0x33ad49={};_0x33ad49[_0x165979]={'$like':'%'+_0x5a3577['query']['filter']+'%'};return _0x33ad49;})});}_0x4e46df=_[_0xd359('0x3f')]({},_0x4e46df,_0x5a3577['options']);return _0x40555f[_0xd359('0x4d')](_0x4e46df);}})[_0xd359('0x23')](function(_0x249cef){if(_0x249cef){_0x545705=_0x249cef[_0xd359('0x37')];if(!_0x5a3577[_0xd359('0x31')][_0xd359('0x38')](_0xd359('0x39'))){_0x4e46df[_0xd359('0x1b')]=qs['limit'](_0x5a3577[_0xd359('0x31')][_0xd359('0x1b')]);_0x4e46df['offset']=qs['offset'](_0x5a3577['query'][_0xd359('0x19')]);}return _0x40555f[_0xd359('0x4d')](_0x4e46df);}})['then'](function(_0x5b0c1b){if(_0x5b0c1b){return _0x5b0c1b?{'count':_0x545705,'rows':_0x5b0c1b}:null;}})['then'](respondWithResult(_0x451483,null))[_0xd359('0x44')](handleError(_0x451483,null));};exports[_0xd359('0x4f')]=function(_0x497e1c,_0x2f881d,_0x172f0d){var _0x4ab921={};var _0x4116a5={};var _0xec4171;var _0x12f0d6;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x497e1c[_0xd359('0x46')]['id']}})[_0xd359('0x23')](handleEntityNotFound(_0x2f881d,null))[_0xd359('0x23')](function(_0x906d46){if(_0x906d46){_0xec4171=_0x906d46;_0x4116a5[_0xd359('0x30')]=_[_0xd359('0x32')](db[_0xd359('0x4c')][_0xd359('0x2d')]);_0x4116a5[_0xd359('0x31')]=_[_0xd359('0x32')](_0x497e1c[_0xd359('0x31')]);_0x4116a5[_0xd359('0x33')]=_[_0xd359('0x34')](_0x4116a5[_0xd359('0x30')],_0x4116a5[_0xd359('0x31')]);_0x4ab921[_0xd359('0x36')]=_[_0xd359('0x34')](_0x4116a5[_0xd359('0x30')],qs['fields'](_0x497e1c[_0xd359('0x31')][_0xd359('0x35')]));_0x4ab921[_0xd359('0x36')]=_0x4ab921[_0xd359('0x36')]['length']?_0x4ab921[_0xd359('0x36')]:_0x4116a5[_0xd359('0x30')];_0x4ab921[_0xd359('0x3a')]=qs['sort'](_0x497e1c[_0xd359('0x31')]['sort']);_0x4ab921['where']=qs[_0xd359('0x33')](_[_0xd359('0x3d')](_0x497e1c[_0xd359('0x31')],_0x4116a5[_0xd359('0x33')]));if(_0x497e1c[_0xd359('0x31')][_0xd359('0x3e')]){_0x4ab921['where']=_[_0xd359('0x3f')](_0x4ab921[_0xd359('0x3c')],{'$or':_[_0xd359('0x2b')](_0x4ab921['attributes'],function(_0x3dc243){var _0x5280f6={};_0x5280f6[_0x3dc243]={'$like':'%'+_0x497e1c[_0xd359('0x31')][_0xd359('0x3e')]+'%'};return _0x5280f6;})});}_0x4ab921=_[_0xd359('0x3f')]({},_0x4ab921,_0x497e1c[_0xd359('0x41')]);return _0xec4171[_0xd359('0x4f')](_0x4ab921);}})[_0xd359('0x23')](function(_0x44aab3){if(_0x44aab3){_0x12f0d6=_0x44aab3[_0xd359('0x37')];if(!_0x497e1c['query'][_0xd359('0x38')](_0xd359('0x39'))){_0x4ab921[_0xd359('0x1b')]=qs[_0xd359('0x1b')](_0x497e1c[_0xd359('0x31')][_0xd359('0x1b')]);_0x4ab921[_0xd359('0x19')]=qs[_0xd359('0x19')](_0x497e1c['query'][_0xd359('0x19')]);}return _0xec4171['getDescriptions'](_0x4ab921);}})[_0xd359('0x23')](function(_0x13d7e8){if(_0x13d7e8){return _0x13d7e8?{'count':_0x12f0d6,'rows':_0x13d7e8}:null;}})[_0xd359('0x23')](respondWithResult(_0x2f881d,null))[_0xd359('0x44')](handleError(_0x2f881d,null));}; \ No newline at end of file +var _0xd597=['querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','destroy','then','stack','name','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','order','sort','where','filters','filter','merge','VIRTUAL','options','ZohoConfiguration','count','includeAll','include','findAll','rows','catch','params','find','create','body','findOne','pick','getFields','hasOwnProperty','nolimit','ZohoField','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','jsforce','desk.js'];(function(_0x35c179,_0x2a8da2){var _0x2de3c9=function(_0x36537d){while(--_0x36537d){_0x35c179['push'](_0x35c179['shift']());}};_0x2de3c9(++_0x2a8da2);}(_0xd597,0x115));var _0x7d59=function(_0x96ff1,_0x5c8414){_0x96ff1=_0x96ff1-0x0;var _0x161431=_0xd597[_0x96ff1];return _0x161431;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7d59('0x0'));var jsonpatch=require(_0x7d59('0x1'));var rp=require(_0x7d59('0x2'));var moment=require(_0x7d59('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7d59('0x4'));var path=require(_0x7d59('0x5'));var sox=require(_0x7d59('0x6'));var csv=require(_0x7d59('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d59('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7d59('0x9'));var deskjs=require(_0x7d59('0xa'));var toCsv=require(_0x7d59('0x7'));var querystring=require(_0x7d59('0xb'));var Papa=require('papaparse');var Redis=require(_0x7d59('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x7d59('0xd'));var as=require(_0x7d59('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d59('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x7d59('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x261383,_0x1fcefd){_0x1fcefd=_0x1fcefd||0xcc;return function(_0x3027b9){if(_0x3027b9){return _0x261383[_0x7d59('0x11')](_0x1fcefd);}return _0x261383[_0x7d59('0x12')](_0x1fcefd)[_0x7d59('0x13')]();};}function respondWithResult(_0x1887fb,_0x3f7d7e){_0x3f7d7e=_0x3f7d7e||0xc8;return function(_0x88bd02){if(_0x88bd02){return _0x1887fb[_0x7d59('0x12')](_0x3f7d7e)[_0x7d59('0x14')](_0x88bd02);}};}function respondWithFilteredResult(_0x46d0dc,_0x37c7dd){return function(_0x48c99c){if(_0x48c99c){var _0x35b012=typeof _0x37c7dd[_0x7d59('0x15')]===_0x7d59('0x16')&&typeof _0x37c7dd[_0x7d59('0x17')]===_0x7d59('0x16');var _0x18d33c=_0x48c99c['count'];var _0x27df9c=_0x35b012?0x0:_0x37c7dd[_0x7d59('0x15')];var _0x10eac7=_0x35b012?_0x48c99c['count']:_0x37c7dd[_0x7d59('0x15')]+_0x37c7dd[_0x7d59('0x17')];var _0x1df87f;if(_0x10eac7>=_0x18d33c){_0x10eac7=_0x18d33c;_0x1df87f=0xc8;}else{_0x1df87f=0xce;}_0x46d0dc['status'](_0x1df87f);return _0x46d0dc[_0x7d59('0x18')](_0x7d59('0x19'),_0x27df9c+'-'+_0x10eac7+'/'+_0x18d33c)[_0x7d59('0x14')](_0x48c99c);}return null;};}function patchUpdates(_0x1cd5c8){return function(_0x5efd60){try{jsonpatch['apply'](_0x5efd60,_0x1cd5c8,!![]);}catch(_0x3b0141){return BPromise[_0x7d59('0x1a')](_0x3b0141);}return _0x5efd60[_0x7d59('0x1b')]();};}function saveUpdates(_0x79677b,_0x51e5b4){return function(_0x50a019){if(_0x50a019){return _0x50a019[_0x7d59('0x1c')](_0x79677b)['then'](function(_0xf15a2a){return _0xf15a2a;});}return null;};}function removeEntity(_0x4fa598,_0x439e06){return function(_0x32b7bc){if(_0x32b7bc){return _0x32b7bc[_0x7d59('0x1d')]()[_0x7d59('0x1e')](function(){_0x4fa598['status'](0xcc)[_0x7d59('0x13')]();});}};}function handleEntityNotFound(_0x924953,_0x10f143){return function(_0x50f141){if(!_0x50f141){_0x924953[_0x7d59('0x11')](0x194);}return _0x50f141;};}function handleError(_0x3917d2,_0x1b1ca3){_0x1b1ca3=_0x1b1ca3||0x1f4;return function(_0x2a2501){logger['error'](_0x2a2501[_0x7d59('0x1f')]);if(_0x2a2501['name']){delete _0x2a2501[_0x7d59('0x20')];}_0x3917d2[_0x7d59('0x12')](_0x1b1ca3)['send'](_0x2a2501);};}exports['index']=function(_0x1f90de,_0x3c02d5){var _0x4c4dcd={},_0x5388b8={},_0x3e0ea4={'count':0x0,'rows':[]};var _0x5bd810=_[_0x7d59('0x21')](db['ZohoConfiguration'][_0x7d59('0x22')],function(_0x74b6d1){return{'name':_0x74b6d1[_0x7d59('0x23')],'type':_0x74b6d1[_0x7d59('0x24')][_0x7d59('0x25')]};});_0x5388b8[_0x7d59('0x26')]=_[_0x7d59('0x21')](_0x5bd810,_0x7d59('0x20'));_0x5388b8['query']=_[_0x7d59('0x27')](_0x1f90de[_0x7d59('0x28')]);_0x5388b8['filters']=_[_0x7d59('0x29')](_0x5388b8[_0x7d59('0x26')],_0x5388b8['query']);_0x4c4dcd[_0x7d59('0x2a')]=_[_0x7d59('0x29')](_0x5388b8[_0x7d59('0x26')],qs['fields'](_0x1f90de[_0x7d59('0x28')][_0x7d59('0x2b')]));_0x4c4dcd[_0x7d59('0x2a')]=_0x4c4dcd['attributes'][_0x7d59('0x2c')]?_0x4c4dcd['attributes']:_0x5388b8[_0x7d59('0x26')];if(!_0x1f90de[_0x7d59('0x28')]['hasOwnProperty']('nolimit')){_0x4c4dcd[_0x7d59('0x17')]=qs[_0x7d59('0x17')](_0x1f90de[_0x7d59('0x28')][_0x7d59('0x17')]);_0x4c4dcd[_0x7d59('0x15')]=qs[_0x7d59('0x15')](_0x1f90de[_0x7d59('0x28')][_0x7d59('0x15')]);}_0x4c4dcd[_0x7d59('0x2d')]=qs[_0x7d59('0x2e')](_0x1f90de[_0x7d59('0x28')]['sort']);_0x4c4dcd[_0x7d59('0x2f')]=qs[_0x7d59('0x30')](_['pick'](_0x1f90de[_0x7d59('0x28')],_0x5388b8[_0x7d59('0x30')]),_0x5bd810);if(_0x1f90de['query'][_0x7d59('0x31')]){_0x4c4dcd['where']=_[_0x7d59('0x32')](_0x4c4dcd[_0x7d59('0x2f')],{'$or':_['map'](_0x5bd810,function(_0x3b9794){if(_0x3b9794[_0x7d59('0x24')]!==_0x7d59('0x33')){var _0x5e793a={};_0x5e793a[_0x3b9794[_0x7d59('0x20')]]={'$like':'%'+_0x1f90de[_0x7d59('0x28')][_0x7d59('0x31')]+'%'};return _0x5e793a;}})});}_0x4c4dcd=_['merge']({},_0x4c4dcd,_0x1f90de[_0x7d59('0x34')]);var _0x1b68cd={'where':_0x4c4dcd[_0x7d59('0x2f')]};return db[_0x7d59('0x35')]['count'](_0x1b68cd)[_0x7d59('0x1e')](function(_0x3e15e9){_0x3e0ea4[_0x7d59('0x36')]=_0x3e15e9;if(_0x1f90de[_0x7d59('0x28')][_0x7d59('0x37')]){_0x4c4dcd[_0x7d59('0x38')]=[{'all':!![]}];}return db[_0x7d59('0x35')][_0x7d59('0x39')](_0x4c4dcd);})[_0x7d59('0x1e')](function(_0x9fe7e1){_0x3e0ea4[_0x7d59('0x3a')]=_0x9fe7e1;return _0x3e0ea4;})[_0x7d59('0x1e')](respondWithFilteredResult(_0x3c02d5,_0x4c4dcd))[_0x7d59('0x3b')](handleError(_0x3c02d5,null));};exports['show']=function(_0x5c9594,_0x1c2175){var _0x22630f={'raw':![],'where':{'id':_0x5c9594[_0x7d59('0x3c')]['id']}},_0x54a8a2={};_0x54a8a2[_0x7d59('0x26')]=_['keys'](db['ZohoConfiguration'][_0x7d59('0x22')]);_0x54a8a2[_0x7d59('0x28')]=_['keys'](_0x5c9594[_0x7d59('0x28')]);_0x54a8a2[_0x7d59('0x30')]=_['intersection'](_0x54a8a2[_0x7d59('0x26')],_0x54a8a2[_0x7d59('0x28')]);_0x22630f['attributes']=_['intersection'](_0x54a8a2['model'],qs['fields'](_0x5c9594['query'][_0x7d59('0x2b')]));_0x22630f[_0x7d59('0x2a')]=_0x22630f['attributes'][_0x7d59('0x2c')]?_0x22630f['attributes']:_0x54a8a2[_0x7d59('0x26')];if(_0x5c9594[_0x7d59('0x28')]['includeAll']){_0x22630f[_0x7d59('0x38')]=[{'all':!![]}];}_0x22630f=_['merge']({},_0x22630f,_0x5c9594[_0x7d59('0x34')]);return db['ZohoConfiguration'][_0x7d59('0x3d')](_0x22630f)[_0x7d59('0x1e')](handleEntityNotFound(_0x1c2175,null))[_0x7d59('0x1e')](respondWithResult(_0x1c2175,null))['catch'](handleError(_0x1c2175,null));};exports[_0x7d59('0x3e')]=function(_0x3250c7,_0x3c1933){return db[_0x7d59('0x35')]['create'](_0x3250c7['body'],{})[_0x7d59('0x1e')](respondWithResult(_0x3c1933,0xc9))[_0x7d59('0x3b')](handleError(_0x3c1933,null));};exports[_0x7d59('0x1c')]=function(_0x454713,_0x5a31b9){if(_0x454713[_0x7d59('0x3f')]['id']){delete _0x454713[_0x7d59('0x3f')]['id'];}return db[_0x7d59('0x35')][_0x7d59('0x3d')]({'where':{'id':_0x454713[_0x7d59('0x3c')]['id']}})[_0x7d59('0x1e')](handleEntityNotFound(_0x5a31b9,null))['then'](saveUpdates(_0x454713[_0x7d59('0x3f')],null))['then'](respondWithResult(_0x5a31b9,null))[_0x7d59('0x3b')](handleError(_0x5a31b9,null));};exports[_0x7d59('0x1d')]=function(_0x1824d2,_0x5449eb){return db[_0x7d59('0x35')][_0x7d59('0x3d')]({'where':{'id':_0x1824d2[_0x7d59('0x3c')]['id']}})[_0x7d59('0x1e')](handleEntityNotFound(_0x5449eb,null))[_0x7d59('0x1e')](removeEntity(_0x5449eb,null))['catch'](handleError(_0x5449eb,null));};exports['getFields']=function(_0x5eacf3,_0x50d295,_0x71a39a){var _0x23516c={};var _0x107cce={};var _0x1c1649;var _0x5ed008;return db[_0x7d59('0x35')][_0x7d59('0x40')]({'where':{'id':_0x5eacf3['params']['id']}})[_0x7d59('0x1e')](handleEntityNotFound(_0x50d295,null))['then'](function(_0x5eebf6){if(_0x5eebf6){_0x1c1649=_0x5eebf6;_0x107cce[_0x7d59('0x26')]=_[_0x7d59('0x27')](db['ZohoField'][_0x7d59('0x22')]);_0x107cce['query']=_['keys'](_0x5eacf3['query']);_0x107cce[_0x7d59('0x30')]=_[_0x7d59('0x29')](_0x107cce[_0x7d59('0x26')],_0x107cce[_0x7d59('0x28')]);_0x23516c[_0x7d59('0x2a')]=_['intersection'](_0x107cce[_0x7d59('0x26')],qs['fields'](_0x5eacf3[_0x7d59('0x28')][_0x7d59('0x2b')]));_0x23516c['attributes']=_0x23516c[_0x7d59('0x2a')][_0x7d59('0x2c')]?_0x23516c[_0x7d59('0x2a')]:_0x107cce[_0x7d59('0x26')];_0x23516c[_0x7d59('0x2d')]=qs[_0x7d59('0x2e')](_0x5eacf3['query']['sort']);_0x23516c[_0x7d59('0x2f')]=qs[_0x7d59('0x30')](_[_0x7d59('0x41')](_0x5eacf3[_0x7d59('0x28')],_0x107cce[_0x7d59('0x30')]));if(_0x5eacf3[_0x7d59('0x28')]['filter']){_0x23516c[_0x7d59('0x2f')]=_[_0x7d59('0x32')](_0x23516c[_0x7d59('0x2f')],{'$or':_['map'](_0x23516c[_0x7d59('0x2a')],function(_0x3d393b){var _0x4f6b7c={};_0x4f6b7c[_0x3d393b]={'$like':'%'+_0x5eacf3[_0x7d59('0x28')]['filter']+'%'};return _0x4f6b7c;})});}_0x23516c=_['merge']({},_0x23516c,_0x5eacf3[_0x7d59('0x34')]);return _0x1c1649[_0x7d59('0x42')](_0x23516c);}})['then'](function(_0x6df241){if(_0x6df241){_0x5ed008=_0x6df241['length'];if(!_0x5eacf3[_0x7d59('0x28')][_0x7d59('0x43')](_0x7d59('0x44'))){_0x23516c[_0x7d59('0x17')]=qs[_0x7d59('0x17')](_0x5eacf3[_0x7d59('0x28')][_0x7d59('0x17')]);_0x23516c['offset']=qs[_0x7d59('0x15')](_0x5eacf3[_0x7d59('0x28')]['offset']);}return _0x1c1649[_0x7d59('0x42')](_0x23516c);}})['then'](function(_0xe04858){if(_0xe04858){return _0xe04858?{'count':_0x5ed008,'rows':_0xe04858}:null;}})[_0x7d59('0x1e')](respondWithResult(_0x50d295,null))[_0x7d59('0x3b')](handleError(_0x50d295,null));};exports['getSubjects']=function(_0x29f1c7,_0x510f2a,_0x17bdc6){var _0x3df1b0={};var _0x50211f={};var _0x57a74e;var _0x66f653;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x29f1c7[_0x7d59('0x3c')]['id']}})[_0x7d59('0x1e')](handleEntityNotFound(_0x510f2a,null))['then'](function(_0x560910){if(_0x560910){_0x57a74e=_0x560910;_0x50211f[_0x7d59('0x26')]=_[_0x7d59('0x27')](db[_0x7d59('0x45')][_0x7d59('0x22')]);_0x50211f[_0x7d59('0x28')]=_[_0x7d59('0x27')](_0x29f1c7[_0x7d59('0x28')]);_0x50211f[_0x7d59('0x30')]=_['intersection'](_0x50211f[_0x7d59('0x26')],_0x50211f[_0x7d59('0x28')]);_0x3df1b0['attributes']=_[_0x7d59('0x29')](_0x50211f['model'],qs[_0x7d59('0x2b')](_0x29f1c7['query'][_0x7d59('0x2b')]));_0x3df1b0[_0x7d59('0x2a')]=_0x3df1b0[_0x7d59('0x2a')]['length']?_0x3df1b0[_0x7d59('0x2a')]:_0x50211f[_0x7d59('0x26')];_0x3df1b0[_0x7d59('0x2d')]=qs[_0x7d59('0x2e')](_0x29f1c7['query'][_0x7d59('0x2e')]);_0x3df1b0[_0x7d59('0x2f')]=qs[_0x7d59('0x30')](_[_0x7d59('0x41')](_0x29f1c7['query'],_0x50211f[_0x7d59('0x30')]));if(_0x29f1c7[_0x7d59('0x28')][_0x7d59('0x31')]){_0x3df1b0[_0x7d59('0x2f')]=_[_0x7d59('0x32')](_0x3df1b0[_0x7d59('0x2f')],{'$or':_['map'](_0x3df1b0[_0x7d59('0x2a')],function(_0x6456ae){var _0x1cd7ea={};_0x1cd7ea[_0x6456ae]={'$like':'%'+_0x29f1c7[_0x7d59('0x28')][_0x7d59('0x31')]+'%'};return _0x1cd7ea;})});}_0x3df1b0=_['merge']({},_0x3df1b0,_0x29f1c7['options']);return _0x57a74e[_0x7d59('0x46')](_0x3df1b0);}})[_0x7d59('0x1e')](function(_0x1c1ad6){if(_0x1c1ad6){_0x66f653=_0x1c1ad6[_0x7d59('0x2c')];if(!_0x29f1c7['query'][_0x7d59('0x43')](_0x7d59('0x44'))){_0x3df1b0['limit']=qs['limit'](_0x29f1c7[_0x7d59('0x28')]['limit']);_0x3df1b0['offset']=qs[_0x7d59('0x15')](_0x29f1c7[_0x7d59('0x28')][_0x7d59('0x15')]);}return _0x57a74e[_0x7d59('0x46')](_0x3df1b0);}})['then'](function(_0x19b70c){if(_0x19b70c){return _0x19b70c?{'count':_0x66f653,'rows':_0x19b70c}:null;}})[_0x7d59('0x1e')](respondWithResult(_0x510f2a,null))[_0x7d59('0x3b')](handleError(_0x510f2a,null));};exports[_0x7d59('0x47')]=function(_0x120f19,_0x5b89ef,_0x2cada0){var _0x1b3228={};var _0x4ca5e5={};var _0x282241;var _0x1522c7;return db[_0x7d59('0x35')][_0x7d59('0x40')]({'where':{'id':_0x120f19[_0x7d59('0x3c')]['id']}})[_0x7d59('0x1e')](handleEntityNotFound(_0x5b89ef,null))[_0x7d59('0x1e')](function(_0x4edb20){if(_0x4edb20){_0x282241=_0x4edb20;_0x4ca5e5[_0x7d59('0x26')]=_[_0x7d59('0x27')](db[_0x7d59('0x45')]['rawAttributes']);_0x4ca5e5[_0x7d59('0x28')]=_[_0x7d59('0x27')](_0x120f19['query']);_0x4ca5e5[_0x7d59('0x30')]=_[_0x7d59('0x29')](_0x4ca5e5[_0x7d59('0x26')],_0x4ca5e5[_0x7d59('0x28')]);_0x1b3228['attributes']=_['intersection'](_0x4ca5e5[_0x7d59('0x26')],qs[_0x7d59('0x2b')](_0x120f19[_0x7d59('0x28')][_0x7d59('0x2b')]));_0x1b3228['attributes']=_0x1b3228[_0x7d59('0x2a')]['length']?_0x1b3228['attributes']:_0x4ca5e5['model'];_0x1b3228[_0x7d59('0x2d')]=qs[_0x7d59('0x2e')](_0x120f19[_0x7d59('0x28')][_0x7d59('0x2e')]);_0x1b3228[_0x7d59('0x2f')]=qs[_0x7d59('0x30')](_[_0x7d59('0x41')](_0x120f19[_0x7d59('0x28')],_0x4ca5e5[_0x7d59('0x30')]));if(_0x120f19[_0x7d59('0x28')][_0x7d59('0x31')]){_0x1b3228[_0x7d59('0x2f')]=_['merge'](_0x1b3228[_0x7d59('0x2f')],{'$or':_[_0x7d59('0x21')](_0x1b3228[_0x7d59('0x2a')],function(_0x12ec02){var _0x3ed201={};_0x3ed201[_0x12ec02]={'$like':'%'+_0x120f19[_0x7d59('0x28')][_0x7d59('0x31')]+'%'};return _0x3ed201;})});}_0x1b3228=_[_0x7d59('0x32')]({},_0x1b3228,_0x120f19['options']);return _0x282241[_0x7d59('0x47')](_0x1b3228);}})[_0x7d59('0x1e')](function(_0x53f0de){if(_0x53f0de){_0x1522c7=_0x53f0de[_0x7d59('0x2c')];if(!_0x120f19[_0x7d59('0x28')][_0x7d59('0x43')](_0x7d59('0x44'))){_0x1b3228[_0x7d59('0x17')]=qs['limit'](_0x120f19[_0x7d59('0x28')][_0x7d59('0x17')]);_0x1b3228['offset']=qs[_0x7d59('0x15')](_0x120f19[_0x7d59('0x28')]['offset']);}return _0x282241[_0x7d59('0x47')](_0x1b3228);}})[_0x7d59('0x1e')](function(_0x4ccb0e){if(_0x4ccb0e){return _0x4ccb0e?{'count':_0x1522c7,'rows':_0x4ccb0e}:null;}})[_0x7d59('0x1e')](respondWithResult(_0x5b89ef,null))[_0x7d59('0x3b')](handleError(_0x5b89ef,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index b8415ec..d687b86 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 _0xfb3a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZohoConfiguration','int_zoho_configurations'];(function(_0x1837da,_0x4a12f6){var _0xad5e3f=function(_0x4add85){while(--_0x4add85){_0x1837da['push'](_0x1837da['shift']());}};_0xad5e3f(++_0x4a12f6);}(_0xfb3a,0x70));var _0xafb3=function(_0x26fd5d,_0x42357d){_0x26fd5d=_0x26fd5d-0x0;var _0x2079be=_0xfb3a[_0x26fd5d];return _0x2079be;};'use strict';var _=require(_0xafb3('0x0'));var util=require(_0xafb3('0x1'));var logger=require(_0xafb3('0x2'))(_0xafb3('0x3'));var moment=require(_0xafb3('0x4'));var BPromise=require(_0xafb3('0x5'));var rp=require(_0xafb3('0x6'));var fs=require('fs');var path=require(_0xafb3('0x7'));var rimraf=require(_0xafb3('0x8'));var config=require(_0xafb3('0x9'));var attributes=require('./intZohoConfiguration.attributes');module[_0xafb3('0xa')]=function(_0x94f45,_0x497c27){return _0x94f45[_0xafb3('0xb')](_0xafb3('0xc'),attributes,{'tableName':_0xafb3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf030=['exports','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xf030,0x1bd));var _0x0f03=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf030[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x0f03('0x0'));var util=require(_0x0f03('0x1'));var logger=require(_0x0f03('0x2'))(_0x0f03('0x3'));var moment=require(_0x0f03('0x4'));var BPromise=require(_0x0f03('0x5'));var rp=require(_0x0f03('0x6'));var fs=require('fs');var path=require(_0x0f03('0x7'));var rimraf=require('rimraf');var config=require(_0x0f03('0x8'));var attributes=require(_0x0f03('0x9'));module[_0x0f03('0xa')]=function(_0x1fa66c,_0x44a976){return _0x1fa66c['define'](_0x0f03('0xb'),attributes,{'tableName':_0x0f03('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 7cbaaa1..4ce52f9 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 _0xc750=['error','code','message','result','catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xc750,0x8d));var _0x0c75=function(_0x35763d,_0x5f3a33){_0x35763d=_0x35763d-0x0;var _0xda9fcc=_0xc750[_0x35763d];return _0xda9fcc;};'use strict';var _=require(_0x0c75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0c75('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c75('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c75('0x3'));var logger=require(_0x0c75('0x4'))(_0x0c75('0x5'));var config=require(_0x0c75('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0c75('0x7')][_0x0c75('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5148a4,_0x21e580,_0x203aaf){return new BPromise(function(_0x526862,_0x1c40e8){return client[_0x0c75('0x9')](_0x5148a4,_0x203aaf)['then'](function(_0xdf823d){logger['info'](_0x0c75('0xa'),_0x21e580,_0x0c75('0xb'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x21e580,'request\x20sent',JSON['stringify'](_0xdf823d));if(_0xdf823d[_0x0c75('0xc')]){if(_0xdf823d[_0x0c75('0xc')][_0x0c75('0xd')]===0x1f4){logger[_0x0c75('0xc')](_0x0c75('0xa'),_0x21e580,_0xdf823d[_0x0c75('0xc')]['message']);return _0x1c40e8(_0xdf823d[_0x0c75('0xc')]['message']);}logger[_0x0c75('0xc')](_0x0c75('0xa'),_0x21e580,_0xdf823d[_0x0c75('0xc')][_0x0c75('0xe')]);return _0x526862(_0xdf823d['error']['message']);}else{logger['info'](_0x0c75('0xa'),_0x21e580,_0x0c75('0xb'));_0x526862(_0xdf823d[_0x0c75('0xf')][_0x0c75('0xe')]);}})[_0x0c75('0x10')](function(_0x203038){logger[_0x0c75('0xc')](_0x0c75('0xa'),_0x21e580,_0x203038);_0x1c40e8(_0x203038);});});} \ No newline at end of file +var _0x5794=['jayson/promise','client','http','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2a127f,_0x2b4e71){var _0x2c5268=function(_0x2a5d49){while(--_0x2a5d49){_0x2a127f['push'](_0x2a127f['shift']());}};_0x2c5268(++_0x2b4e71);}(_0x5794,0x108));var _0x4579=function(_0x7fa00a,_0x1c689c){_0x7fa00a=_0x7fa00a-0x0;var _0x1cc856=_0x5794[_0x7fa00a];return _0x1cc856;};'use strict';var _=require('lodash');var util=require(_0x4579('0x0'));var moment=require(_0x4579('0x1'));var BPromise=require(_0x4579('0x2'));var rs=require(_0x4579('0x3'));var fs=require('fs');var Redis=require(_0x4579('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4579('0x5'));var logger=require(_0x4579('0x6'))(_0x4579('0x7'));var config=require(_0x4579('0x8'));var jayson=require(_0x4579('0x9'));var client=jayson[_0x4579('0xa')][_0x4579('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ae904,_0x5479d0,_0x4f0c23){return new BPromise(function(_0x4f614a,_0x262923){return client['request'](_0x1ae904,_0x4f0c23)['then'](function(_0x2f6fd4){logger[_0x4579('0xc')](_0x4579('0xd'),_0x5479d0,_0x4579('0xe'));logger[_0x4579('0xf')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x5479d0,'request\x20sent',JSON['stringify'](_0x2f6fd4));if(_0x2f6fd4[_0x4579('0x10')]){if(_0x2f6fd4[_0x4579('0x10')][_0x4579('0x11')]===0x1f4){logger[_0x4579('0x10')](_0x4579('0xd'),_0x5479d0,_0x2f6fd4['error']['message']);return _0x262923(_0x2f6fd4['error'][_0x4579('0x12')]);}logger['error'](_0x4579('0xd'),_0x5479d0,_0x2f6fd4[_0x4579('0x10')][_0x4579('0x12')]);return _0x4f614a(_0x2f6fd4['error'][_0x4579('0x12')]);}else{logger['info'](_0x4579('0xd'),_0x5479d0,_0x4579('0xe'));_0x4f614a(_0x2f6fd4[_0x4579('0x13')][_0x4579('0x12')]);}})[_0x4579('0x14')](function(_0x55e3f6){logger['error'](_0x4579('0xd'),_0x5479d0,_0x55e3f6);_0x262923(_0x55e3f6);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 2997670..03b652e 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 _0xaf93=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','util','path'];(function(_0x1a2d7e,_0x9a8e1f){var _0x47939a=function(_0x3aa8ce){while(--_0x3aa8ce){_0x1a2d7e['push'](_0x1a2d7e['shift']());}};_0x47939a(++_0x9a8e1f);}(_0xaf93,0x1e3));var _0x3af9=function(_0x307746,_0x3c5f24){_0x307746=_0x307746-0x0;var _0x2cdccb=_0xaf93[_0x307746];return _0x2cdccb;};'use strict';var multer=require(_0x3af9('0x0'));var util=require(_0x3af9('0x1'));var path=require(_0x3af9('0x2'));var timeout=require('connect-timeout');var express=require(_0x3af9('0x3'));var router=express[_0x3af9('0x4')]();var fs_extra=require(_0x3af9('0x5'));var auth=require(_0x3af9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3af9('0x7'));var controller=require('./intZohoField.controller');router[_0x3af9('0x8')]('/',auth[_0x3af9('0x9')](),controller[_0x3af9('0xa')]);router[_0x3af9('0x8')](_0x3af9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x3af9('0xc')]('/',auth['isAuthenticated'](),controller[_0x3af9('0xd')]);router[_0x3af9('0xe')](_0x3af9('0xb'),auth[_0x3af9('0x9')](),controller[_0x3af9('0xf')]);router[_0x3af9('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3af9('0x11')]=router; \ No newline at end of file +var _0xf8b5=['Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x291aae,_0x18ac93){var _0x10bc29=function(_0x3dfe70){while(--_0x3dfe70){_0x291aae['push'](_0x291aae['shift']());}};_0x10bc29(++_0x18ac93);}(_0xf8b5,0x9e));var _0x5f8b=function(_0x394d0f,_0x15b6a5){_0x394d0f=_0x394d0f-0x0;var _0x59a66e=_0xf8b5[_0x394d0f];return _0x59a66e;};'use strict';var multer=require(_0x5f8b('0x0'));var util=require('util');var path=require(_0x5f8b('0x1'));var timeout=require(_0x5f8b('0x2'));var express=require(_0x5f8b('0x3'));var router=express[_0x5f8b('0x4')]();var fs_extra=require(_0x5f8b('0x5'));var auth=require(_0x5f8b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5f8b('0x7'));var controller=require('./intZohoField.controller');router['get']('/',auth[_0x5f8b('0x8')](),controller[_0x5f8b('0x9')]);router[_0x5f8b('0xa')](_0x5f8b('0xb'),auth['isAuthenticated'](),controller[_0x5f8b('0xc')]);router[_0x5f8b('0xd')]('/',auth[_0x5f8b('0x8')](),controller['create']);router[_0x5f8b('0xe')](_0x5f8b('0xb'),auth[_0x5f8b('0x8')](),controller[_0x5f8b('0xf')]);router[_0x5f8b('0x10')](_0x5f8b('0xb'),auth[_0x5f8b('0x8')](),controller[_0x5f8b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 464ec27..8b03ccd 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 _0x4dbc=['keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x387279,_0x20fc9c){var _0x57fa3b=function(_0xfcabe8){while(--_0xfcabe8){_0x387279['push'](_0x387279['shift']());}};_0x57fa3b(++_0x20fc9c);}(_0x4dbc,0x13b));var _0xc4db=function(_0x552b4e,_0x219578){_0x552b4e=_0x552b4e-0x0;var _0x48575c=_0x4dbc[_0x552b4e];return _0x48575c;};'use strict';var Sequelize=require(_0xc4db('0x0'));module[_0xc4db('0x1')]={'type':{'type':Sequelize[_0xc4db('0x2')](_0xc4db('0x3'),_0xc4db('0x4'),'customVariable',_0xc4db('0x5'),_0xc4db('0x6')),'defaultValue':_0xc4db('0x3')},'content':{'type':Sequelize[_0xc4db('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc4db('0x2')](_0xc4db('0x3'),_0xc4db('0x4'),_0xc4db('0x8'))},'keyContent':{'type':Sequelize[_0xc4db('0x7')]},'idField':{'type':Sequelize[_0xc4db('0x7')]},'nameField':{'type':Sequelize[_0xc4db('0x7')]},'customField':{'type':Sequelize[_0xc4db('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc4db('0x7')]}}; \ No newline at end of file +var _0x82fd=['exports','string','customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize'];(function(_0x59c2cb,_0x671ebb){var _0x4d2910=function(_0x50c769){while(--_0x50c769){_0x59c2cb['push'](_0x59c2cb['shift']());}};_0x4d2910(++_0x671ebb);}(_0x82fd,0x6d));var _0xd82f=function(_0x581e56,_0x1a5593){_0x581e56=_0x581e56-0x0;var _0x41b16e=_0x82fd[_0x581e56];return _0x41b16e;};'use strict';var Sequelize=require(_0xd82f('0x0'));module[_0xd82f('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd82f('0x2'),'variable',_0xd82f('0x3'),_0xd82f('0x4'),_0xd82f('0x5')),'defaultValue':_0xd82f('0x2')},'content':{'type':Sequelize[_0xd82f('0x6')]},'key':{'type':Sequelize[_0xd82f('0x6')]},'keyType':{'type':Sequelize[_0xd82f('0x7')]('string',_0xd82f('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0xd82f('0x6')]},'idField':{'type':Sequelize[_0xd82f('0x6')]},'nameField':{'type':Sequelize[_0xd82f('0x6')]},'customField':{'type':Sequelize[_0xd82f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd82f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index a9c8b5a..44bcba3 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 _0x4108=['query','keys','attributes','intersection','fields','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','ZohoField','includeAll','rows','show','length','include','find','catch','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model'];(function(_0x5892ba,_0x22a993){var _0x49b1b4=function(_0x36b143){while(--_0x36b143){_0x5892ba['push'](_0x5892ba['shift']());}};_0x49b1b4(++_0x22a993);}(_0x4108,0x69));var _0x8410=function(_0x272923,_0x40a0ea){_0x272923=_0x272923-0x0;var _0x23e643=_0x4108[_0x272923];return _0x23e643;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8410('0x0'));var zipdir=require(_0x8410('0x1'));var jsonpatch=require(_0x8410('0x2'));var rp=require(_0x8410('0x3'));var moment=require(_0x8410('0x4'));var BPromise=require(_0x8410('0x5'));var Mustache=require(_0x8410('0x6'));var util=require('util');var path=require(_0x8410('0x7'));var sox=require(_0x8410('0x8'));var csv=require('to-csv');var ejs=require(_0x8410('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8410('0xa'));var squel=require(_0x8410('0xb'));var crypto=require(_0x8410('0xc'));var jsforce=require(_0x8410('0xd'));var deskjs=require(_0x8410('0xe'));var toCsv=require(_0x8410('0xf'));var querystring=require(_0x8410('0x10'));var Papa=require(_0x8410('0x11'));var Redis=require(_0x8410('0x12'));var authService=require(_0x8410('0x13'));var qs=require(_0x8410('0x14'));var as=require(_0x8410('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8410('0x16'))(_0x8410('0x17'));var utils=require(_0x8410('0x18'));var config=require(_0x8410('0x19'));var licenseUtil=require(_0x8410('0x1a'));var db=require(_0x8410('0x1b'))['db'];function respondWithStatusCode(_0x4e9018,_0x27e215){_0x27e215=_0x27e215||0xcc;return function(_0x51d049){if(_0x51d049){return _0x4e9018[_0x8410('0x1c')](_0x27e215);}return _0x4e9018[_0x8410('0x1d')](_0x27e215)[_0x8410('0x1e')]();};}function respondWithResult(_0x35d66f,_0x20e3f2){_0x20e3f2=_0x20e3f2||0xc8;return function(_0x37fee9){if(_0x37fee9){return _0x35d66f[_0x8410('0x1d')](_0x20e3f2)[_0x8410('0x1f')](_0x37fee9);}};}function respondWithFilteredResult(_0x22bd82,_0x573608){return function(_0x46a6c7){if(_0x46a6c7){var _0x314ac1=typeof _0x573608[_0x8410('0x20')]==='undefined'&&typeof _0x573608[_0x8410('0x21')]==='undefined';var _0x58bbdb=_0x46a6c7['count'];var _0x7e9652=_0x314ac1?0x0:_0x573608[_0x8410('0x20')];var _0x3f44c6=_0x314ac1?_0x46a6c7[_0x8410('0x22')]:_0x573608[_0x8410('0x20')]+_0x573608[_0x8410('0x21')];var _0x217d4b;if(_0x3f44c6>=_0x58bbdb){_0x3f44c6=_0x58bbdb;_0x217d4b=0xc8;}else{_0x217d4b=0xce;}_0x22bd82[_0x8410('0x1d')](_0x217d4b);return _0x22bd82[_0x8410('0x23')](_0x8410('0x24'),_0x7e9652+'-'+_0x3f44c6+'/'+_0x58bbdb)[_0x8410('0x1f')](_0x46a6c7);}return null;};}function patchUpdates(_0x40957a){return function(_0x34abe0){try{jsonpatch['apply'](_0x34abe0,_0x40957a,!![]);}catch(_0x5c54a9){return BPromise[_0x8410('0x25')](_0x5c54a9);}return _0x34abe0[_0x8410('0x26')]();};}function saveUpdates(_0x43dbeb,_0x1bb44c){return function(_0x2a2123){if(_0x2a2123){return _0x2a2123[_0x8410('0x27')](_0x43dbeb)[_0x8410('0x28')](function(_0x300026){return _0x300026;});}return null;};}function removeEntity(_0x315c0a,_0x2a48e9){return function(_0x169843){if(_0x169843){return _0x169843[_0x8410('0x29')]()[_0x8410('0x28')](function(){_0x315c0a['status'](0xcc)[_0x8410('0x1e')]();});}};}function handleEntityNotFound(_0x517a93,_0x1c9855){return function(_0x1a4334){if(!_0x1a4334){_0x517a93[_0x8410('0x1c')](0x194);}return _0x1a4334;};}function handleError(_0xd16e50,_0x828b6b){_0x828b6b=_0x828b6b||0x1f4;return function(_0x63f8d9){logger[_0x8410('0x2a')](_0x63f8d9[_0x8410('0x2b')]);if(_0x63f8d9[_0x8410('0x2c')]){delete _0x63f8d9['name'];}_0xd16e50['status'](_0x828b6b)[_0x8410('0x2d')](_0x63f8d9);};}exports['index']=function(_0x336416,_0x5ee350){var _0x2900c6={},_0x3bb723={},_0x578c21={'count':0x0,'rows':[]};var _0x4723cf=_[_0x8410('0x2e')](db['ZohoField'][_0x8410('0x2f')],function(_0x5e4725){return{'name':_0x5e4725[_0x8410('0x30')],'type':_0x5e4725['type'][_0x8410('0x31')]};});_0x3bb723[_0x8410('0x32')]=_[_0x8410('0x2e')](_0x4723cf,'name');_0x3bb723[_0x8410('0x33')]=_[_0x8410('0x34')](_0x336416[_0x8410('0x33')]);_0x3bb723['filters']=_['intersection'](_0x3bb723[_0x8410('0x32')],_0x3bb723[_0x8410('0x33')]);_0x2900c6[_0x8410('0x35')]=_[_0x8410('0x36')](_0x3bb723[_0x8410('0x32')],qs[_0x8410('0x37')](_0x336416[_0x8410('0x33')]['fields']));_0x2900c6[_0x8410('0x35')]=_0x2900c6[_0x8410('0x35')]['length']?_0x2900c6[_0x8410('0x35')]:_0x3bb723['model'];if(!_0x336416['query']['hasOwnProperty'](_0x8410('0x38'))){_0x2900c6['limit']=qs[_0x8410('0x21')](_0x336416[_0x8410('0x33')][_0x8410('0x21')]);_0x2900c6['offset']=qs[_0x8410('0x20')](_0x336416['query']['offset']);}_0x2900c6[_0x8410('0x39')]=qs[_0x8410('0x3a')](_0x336416[_0x8410('0x33')][_0x8410('0x3a')]);_0x2900c6[_0x8410('0x3b')]=qs[_0x8410('0x3c')](_[_0x8410('0x3d')](_0x336416['query'],_0x3bb723['filters']),_0x4723cf);if(_0x336416[_0x8410('0x33')]['filter']){_0x2900c6[_0x8410('0x3b')]=_[_0x8410('0x3e')](_0x2900c6[_0x8410('0x3b')],{'$or':_[_0x8410('0x2e')](_0x4723cf,function(_0x2ff14e){if(_0x2ff14e[_0x8410('0x3f')]!==_0x8410('0x40')){var _0x7567f5={};_0x7567f5[_0x2ff14e['name']]={'$like':'%'+_0x336416[_0x8410('0x33')][_0x8410('0x41')]+'%'};return _0x7567f5;}})});}_0x2900c6=_['merge']({},_0x2900c6,_0x336416[_0x8410('0x42')]);var _0x4e63d0={'where':_0x2900c6[_0x8410('0x3b')]};return db[_0x8410('0x43')][_0x8410('0x22')](_0x4e63d0)[_0x8410('0x28')](function(_0x31b862){_0x578c21[_0x8410('0x22')]=_0x31b862;if(_0x336416[_0x8410('0x33')][_0x8410('0x44')]){_0x2900c6['include']=[{'all':!![]}];}return db[_0x8410('0x43')]['findAll'](_0x2900c6);})[_0x8410('0x28')](function(_0x18c999){_0x578c21[_0x8410('0x45')]=_0x18c999;return _0x578c21;})[_0x8410('0x28')](respondWithFilteredResult(_0x5ee350,_0x2900c6))['catch'](handleError(_0x5ee350,null));};exports[_0x8410('0x46')]=function(_0x40c6bc,_0x3fdeb8){var _0x3fa7dd={'raw':!![],'where':{'id':_0x40c6bc['params']['id']}},_0x3012f5={};_0x3012f5[_0x8410('0x32')]=_['keys'](db[_0x8410('0x43')][_0x8410('0x2f')]);_0x3012f5[_0x8410('0x33')]=_[_0x8410('0x34')](_0x40c6bc['query']);_0x3012f5[_0x8410('0x3c')]=_[_0x8410('0x36')](_0x3012f5[_0x8410('0x32')],_0x3012f5[_0x8410('0x33')]);_0x3fa7dd['attributes']=_[_0x8410('0x36')](_0x3012f5[_0x8410('0x32')],qs[_0x8410('0x37')](_0x40c6bc[_0x8410('0x33')]['fields']));_0x3fa7dd[_0x8410('0x35')]=_0x3fa7dd[_0x8410('0x35')][_0x8410('0x47')]?_0x3fa7dd[_0x8410('0x35')]:_0x3012f5[_0x8410('0x32')];if(_0x40c6bc[_0x8410('0x33')]['includeAll']){_0x3fa7dd[_0x8410('0x48')]=[{'all':!![]}];}_0x3fa7dd=_[_0x8410('0x3e')]({},_0x3fa7dd,_0x40c6bc[_0x8410('0x42')]);return db[_0x8410('0x43')][_0x8410('0x49')](_0x3fa7dd)[_0x8410('0x28')](handleEntityNotFound(_0x3fdeb8,null))[_0x8410('0x28')](respondWithResult(_0x3fdeb8,null))[_0x8410('0x4a')](handleError(_0x3fdeb8,null));};exports[_0x8410('0x4b')]=function(_0x33f347,_0x364359){return db['ZohoField'][_0x8410('0x4b')](_0x33f347['body'],{})[_0x8410('0x28')](respondWithResult(_0x364359,0xc9))[_0x8410('0x4a')](handleError(_0x364359,null));};exports[_0x8410('0x27')]=function(_0x5714b4,_0x1146f2){if(_0x5714b4[_0x8410('0x4c')]['id']){delete _0x5714b4[_0x8410('0x4c')]['id'];}return db['ZohoField'][_0x8410('0x49')]({'where':{'id':_0x5714b4[_0x8410('0x4d')]['id']}})[_0x8410('0x28')](handleEntityNotFound(_0x1146f2,null))['then'](saveUpdates(_0x5714b4[_0x8410('0x4c')],null))[_0x8410('0x28')](respondWithResult(_0x1146f2,null))[_0x8410('0x4a')](handleError(_0x1146f2,null));};exports[_0x8410('0x29')]=function(_0x27e374,_0x1bf8dd){return db[_0x8410('0x43')][_0x8410('0x49')]({'where':{'id':_0x27e374[_0x8410('0x4d')]['id']}})[_0x8410('0x28')](handleEntityNotFound(_0x1bf8dd,null))[_0x8410('0x28')](removeEntity(_0x1bf8dd,null))[_0x8410('0x4a')](handleError(_0x1bf8dd,null));}; \ No newline at end of file +var _0x2f87=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZohoField','includeAll','include','findAll','rows','show','params','keys','intersection','find','catch','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x5d6725,_0x3f6ef9){var _0x275399=function(_0x133ac1){while(--_0x133ac1){_0x5d6725['push'](_0x5d6725['shift']());}};_0x275399(++_0x3f6ef9);}(_0x2f87,0xe2));var _0x72f8=function(_0x577ba3,_0xcc7789){_0x577ba3=_0x577ba3-0x0;var _0x5ed224=_0x2f87[_0x577ba3];return _0x5ed224;};'use strict';var emlformat=require(_0x72f8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x72f8('0x1'));var jsonpatch=require(_0x72f8('0x2'));var rp=require('request-promise');var moment=require(_0x72f8('0x3'));var BPromise=require(_0x72f8('0x4'));var Mustache=require(_0x72f8('0x5'));var util=require(_0x72f8('0x6'));var path=require(_0x72f8('0x7'));var sox=require(_0x72f8('0x8'));var csv=require(_0x72f8('0x9'));var ejs=require(_0x72f8('0xa'));var fs=require('fs');var fs_extra=require(_0x72f8('0xb'));var _=require(_0x72f8('0xc'));var squel=require(_0x72f8('0xd'));var crypto=require(_0x72f8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x72f8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x72f8('0x10'));var Papa=require(_0x72f8('0x11'));var Redis=require(_0x72f8('0x12'));var authService=require(_0x72f8('0x13'));var qs=require(_0x72f8('0x14'));var as=require(_0x72f8('0x15'));var hardwareService=require(_0x72f8('0x16'));var logger=require(_0x72f8('0x17'))(_0x72f8('0x18'));var utils=require('../../config/utils');var config=require(_0x72f8('0x19'));var licenseUtil=require(_0x72f8('0x1a'));var db=require(_0x72f8('0x1b'))['db'];function respondWithStatusCode(_0x2e3781,_0x116b9c){_0x116b9c=_0x116b9c||0xcc;return function(_0x19a0ee){if(_0x19a0ee){return _0x2e3781['sendStatus'](_0x116b9c);}return _0x2e3781[_0x72f8('0x1c')](_0x116b9c)[_0x72f8('0x1d')]();};}function respondWithResult(_0x2db2ab,_0x4430ec){_0x4430ec=_0x4430ec||0xc8;return function(_0x2ef441){if(_0x2ef441){return _0x2db2ab[_0x72f8('0x1c')](_0x4430ec)[_0x72f8('0x1e')](_0x2ef441);}};}function respondWithFilteredResult(_0x1244f9,_0x1e0105){return function(_0x34d355){if(_0x34d355){var _0x58071d=typeof _0x1e0105['offset']===_0x72f8('0x1f')&&typeof _0x1e0105['limit']===_0x72f8('0x1f');var _0x5764f5=_0x34d355[_0x72f8('0x20')];var _0x4a641d=_0x58071d?0x0:_0x1e0105['offset'];var _0x477f48=_0x58071d?_0x34d355[_0x72f8('0x20')]:_0x1e0105[_0x72f8('0x21')]+_0x1e0105[_0x72f8('0x22')];var _0x5a13f7;if(_0x477f48>=_0x5764f5){_0x477f48=_0x5764f5;_0x5a13f7=0xc8;}else{_0x5a13f7=0xce;}_0x1244f9['status'](_0x5a13f7);return _0x1244f9[_0x72f8('0x23')](_0x72f8('0x24'),_0x4a641d+'-'+_0x477f48+'/'+_0x5764f5)[_0x72f8('0x1e')](_0x34d355);}return null;};}function patchUpdates(_0x5f4cf6){return function(_0xbb1af8){try{jsonpatch[_0x72f8('0x25')](_0xbb1af8,_0x5f4cf6,!![]);}catch(_0x5d5aac){return BPromise['reject'](_0x5d5aac);}return _0xbb1af8[_0x72f8('0x26')]();};}function saveUpdates(_0x2c6ed0,_0x3bd17d){return function(_0x5f74a2){if(_0x5f74a2){return _0x5f74a2[_0x72f8('0x27')](_0x2c6ed0)['then'](function(_0x3749f8){return _0x3749f8;});}return null;};}function removeEntity(_0x525011,_0xb4fc26){return function(_0x10f19a){if(_0x10f19a){return _0x10f19a[_0x72f8('0x28')]()[_0x72f8('0x29')](function(){_0x525011['status'](0xcc)[_0x72f8('0x1d')]();});}};}function handleEntityNotFound(_0x5c3a9e,_0x2a4c87){return function(_0x2a30e8){if(!_0x2a30e8){_0x5c3a9e['sendStatus'](0x194);}return _0x2a30e8;};}function handleError(_0xb9eb91,_0x917f72){_0x917f72=_0x917f72||0x1f4;return function(_0x48b511){logger[_0x72f8('0x2a')](_0x48b511[_0x72f8('0x2b')]);if(_0x48b511['name']){delete _0x48b511[_0x72f8('0x2c')];}_0xb9eb91[_0x72f8('0x1c')](_0x917f72)[_0x72f8('0x2d')](_0x48b511);};}exports[_0x72f8('0x2e')]=function(_0x12f001,_0x5f12bd){var _0x4115b9={},_0x21a5fa={},_0x377747={'count':0x0,'rows':[]};var _0x46244a=_[_0x72f8('0x2f')](db['ZohoField'][_0x72f8('0x30')],function(_0x1ef18c){return{'name':_0x1ef18c[_0x72f8('0x31')],'type':_0x1ef18c[_0x72f8('0x32')][_0x72f8('0x33')]};});_0x21a5fa[_0x72f8('0x34')]=_[_0x72f8('0x2f')](_0x46244a,_0x72f8('0x2c'));_0x21a5fa['query']=_['keys'](_0x12f001[_0x72f8('0x35')]);_0x21a5fa[_0x72f8('0x36')]=_['intersection'](_0x21a5fa[_0x72f8('0x34')],_0x21a5fa[_0x72f8('0x35')]);_0x4115b9[_0x72f8('0x37')]=_['intersection'](_0x21a5fa[_0x72f8('0x34')],qs['fields'](_0x12f001['query'][_0x72f8('0x38')]));_0x4115b9[_0x72f8('0x37')]=_0x4115b9[_0x72f8('0x37')][_0x72f8('0x39')]?_0x4115b9[_0x72f8('0x37')]:_0x21a5fa['model'];if(!_0x12f001['query'][_0x72f8('0x3a')](_0x72f8('0x3b'))){_0x4115b9[_0x72f8('0x22')]=qs[_0x72f8('0x22')](_0x12f001['query'][_0x72f8('0x22')]);_0x4115b9[_0x72f8('0x21')]=qs[_0x72f8('0x21')](_0x12f001[_0x72f8('0x35')][_0x72f8('0x21')]);}_0x4115b9[_0x72f8('0x3c')]=qs[_0x72f8('0x3d')](_0x12f001['query'][_0x72f8('0x3d')]);_0x4115b9[_0x72f8('0x3e')]=qs[_0x72f8('0x36')](_[_0x72f8('0x3f')](_0x12f001[_0x72f8('0x35')],_0x21a5fa[_0x72f8('0x36')]),_0x46244a);if(_0x12f001[_0x72f8('0x35')][_0x72f8('0x40')]){_0x4115b9[_0x72f8('0x3e')]=_[_0x72f8('0x41')](_0x4115b9[_0x72f8('0x3e')],{'$or':_['map'](_0x46244a,function(_0x4ca43d){if(_0x4ca43d['type']!==_0x72f8('0x42')){var _0x4480cc={};_0x4480cc[_0x4ca43d[_0x72f8('0x2c')]]={'$like':'%'+_0x12f001[_0x72f8('0x35')][_0x72f8('0x40')]+'%'};return _0x4480cc;}})});}_0x4115b9=_['merge']({},_0x4115b9,_0x12f001[_0x72f8('0x43')]);var _0xa097a0={'where':_0x4115b9[_0x72f8('0x3e')]};return db[_0x72f8('0x44')][_0x72f8('0x20')](_0xa097a0)[_0x72f8('0x29')](function(_0x1885b2){_0x377747[_0x72f8('0x20')]=_0x1885b2;if(_0x12f001['query'][_0x72f8('0x45')]){_0x4115b9[_0x72f8('0x46')]=[{'all':!![]}];}return db['ZohoField'][_0x72f8('0x47')](_0x4115b9);})[_0x72f8('0x29')](function(_0x3d1a80){_0x377747[_0x72f8('0x48')]=_0x3d1a80;return _0x377747;})[_0x72f8('0x29')](respondWithFilteredResult(_0x5f12bd,_0x4115b9))['catch'](handleError(_0x5f12bd,null));};exports[_0x72f8('0x49')]=function(_0x42e627,_0x5d137f){var _0xe85838={'raw':!![],'where':{'id':_0x42e627[_0x72f8('0x4a')]['id']}},_0x1dcf58={};_0x1dcf58['model']=_[_0x72f8('0x4b')](db[_0x72f8('0x44')][_0x72f8('0x30')]);_0x1dcf58[_0x72f8('0x35')]=_['keys'](_0x42e627[_0x72f8('0x35')]);_0x1dcf58[_0x72f8('0x36')]=_[_0x72f8('0x4c')](_0x1dcf58[_0x72f8('0x34')],_0x1dcf58[_0x72f8('0x35')]);_0xe85838[_0x72f8('0x37')]=_[_0x72f8('0x4c')](_0x1dcf58[_0x72f8('0x34')],qs[_0x72f8('0x38')](_0x42e627[_0x72f8('0x35')]['fields']));_0xe85838[_0x72f8('0x37')]=_0xe85838[_0x72f8('0x37')][_0x72f8('0x39')]?_0xe85838[_0x72f8('0x37')]:_0x1dcf58[_0x72f8('0x34')];if(_0x42e627['query'][_0x72f8('0x45')]){_0xe85838[_0x72f8('0x46')]=[{'all':!![]}];}_0xe85838=_[_0x72f8('0x41')]({},_0xe85838,_0x42e627['options']);return db[_0x72f8('0x44')][_0x72f8('0x4d')](_0xe85838)[_0x72f8('0x29')](handleEntityNotFound(_0x5d137f,null))[_0x72f8('0x29')](respondWithResult(_0x5d137f,null))[_0x72f8('0x4e')](handleError(_0x5d137f,null));};exports[_0x72f8('0x4f')]=function(_0x1e89af,_0x56bfa4){return db[_0x72f8('0x44')][_0x72f8('0x4f')](_0x1e89af[_0x72f8('0x50')],{})[_0x72f8('0x29')](respondWithResult(_0x56bfa4,0xc9))[_0x72f8('0x4e')](handleError(_0x56bfa4,null));};exports['update']=function(_0x1b8226,_0xa6770){if(_0x1b8226[_0x72f8('0x50')]['id']){delete _0x1b8226['body']['id'];}return db['ZohoField'][_0x72f8('0x4d')]({'where':{'id':_0x1b8226['params']['id']}})[_0x72f8('0x29')](handleEntityNotFound(_0xa6770,null))[_0x72f8('0x29')](saveUpdates(_0x1b8226[_0x72f8('0x50')],null))['then'](respondWithResult(_0xa6770,null))[_0x72f8('0x4e')](handleError(_0xa6770,null));};exports[_0x72f8('0x28')]=function(_0xa7dcf5,_0x2ee94c){return db[_0x72f8('0x44')]['find']({'where':{'id':_0xa7dcf5['params']['id']}})['then'](handleEntityNotFound(_0x2ee94c,null))['then'](removeEntity(_0x2ee94c,null))[_0x72f8('0x4e')](handleError(_0x2ee94c,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 911a2f0..a195149 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 _0x6d38=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','idField','FieldId'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x6d38,0x1ef));var _0x86d3=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x6d38[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));module['exports']=function(_0x2d8272,_0xfbbc15){return _0x2d8272[_0x86d3('0x7')](_0x86d3('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x86d3('0x9'),_0x86d3('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x781d=['rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x781d,0x14a));var _0xd781=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x781d[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd781('0x2'));var BPromise=require(_0xd781('0x3'));var rp=require(_0xd781('0x4'));var fs=require('fs');var path=require(_0xd781('0x5'));var rimraf=require(_0xd781('0x6'));var config=require(_0xd781('0x7'));var attributes=require(_0xd781('0x8'));module[_0xd781('0x9')]=function(_0x830b,_0x2f98ee){return _0x830b['define'](_0xd781('0xa'),attributes,{'tableName':_0xd781('0xb'),'paranoid':![],'indexes':[{'name':_0xd781('0xc'),'fields':[_0xd781('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 80cdb3c..10d9f20 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 _0x3266=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x4387a6,_0x514cbc){var _0x51aecd=function(_0x35475b){while(--_0x35475b){_0x4387a6['push'](_0x4387a6['shift']());}};_0x51aecd(++_0x514cbc);}(_0x3266,0x185));var _0x6326=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x3266[_0x4063a4];return _0x17908d;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var moment=require(_0x6326('0x2'));var BPromise=require(_0x6326('0x3'));var rs=require(_0x6326('0x4'));var fs=require('fs');var Redis=require(_0x6326('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6326('0x6'));var logger=require(_0x6326('0x7'))(_0x6326('0x8'));var config=require(_0x6326('0x9'));var jayson=require(_0x6326('0xa'));var client=jayson[_0x6326('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e530a,_0x42d7eb,_0x3f7a75){return new BPromise(function(_0x34a13d,_0x14af63){return client['request'](_0x5e530a,_0x3f7a75)['then'](function(_0x7ef052){logger[_0x6326('0xc')](_0x6326('0xd'),_0x42d7eb,_0x6326('0xe'));logger[_0x6326('0xf')](_0x6326('0x10'),_0x42d7eb,_0x6326('0xe'),JSON[_0x6326('0x11')](_0x7ef052));if(_0x7ef052[_0x6326('0x12')]){if(_0x7ef052[_0x6326('0x12')][_0x6326('0x13')]===0x1f4){logger[_0x6326('0x12')](_0x6326('0xd'),_0x42d7eb,_0x7ef052[_0x6326('0x12')][_0x6326('0x14')]);return _0x14af63(_0x7ef052[_0x6326('0x12')][_0x6326('0x14')]);}logger[_0x6326('0x12')](_0x6326('0xd'),_0x42d7eb,_0x7ef052['error'][_0x6326('0x14')]);return _0x34a13d(_0x7ef052[_0x6326('0x12')][_0x6326('0x14')]);}else{logger[_0x6326('0xc')](_0x6326('0xd'),_0x42d7eb,_0x6326('0xe'));_0x34a13d(_0x7ef052[_0x6326('0x15')][_0x6326('0x14')]);}})[_0x6326('0x16')](function(_0x117156){logger[_0x6326('0x12')](_0x6326('0xd'),_0x42d7eb,_0x117156);_0x14af63(_0x117156);});});} \ No newline at end of file +var _0x4f0d=['lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0x4f0d,0x7e));var _0xd4f0=function(_0x2ada6a,_0x49cece){_0x2ada6a=_0x2ada6a-0x0;var _0x42b8fa=_0x4f0d[_0x2ada6a];return _0x42b8fa;};'use strict';var _=require(_0xd4f0('0x0'));var util=require('util');var moment=require(_0xd4f0('0x1'));var BPromise=require(_0xd4f0('0x2'));var rs=require(_0xd4f0('0x3'));var fs=require('fs');var Redis=require(_0xd4f0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd4f0('0x5'));var logger=require(_0xd4f0('0x6'))(_0xd4f0('0x7'));var config=require(_0xd4f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd4f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2717f3,_0x157b64,_0x1153f1){return new BPromise(function(_0x46e681,_0x3361e1){return client['request'](_0x2717f3,_0x1153f1)[_0xd4f0('0xa')](function(_0x38076e){logger[_0xd4f0('0xb')](_0xd4f0('0xc'),_0x157b64,_0xd4f0('0xd'));logger[_0xd4f0('0xe')](_0xd4f0('0xf'),_0x157b64,_0xd4f0('0xd'),JSON[_0xd4f0('0x10')](_0x38076e));if(_0x38076e[_0xd4f0('0x11')]){if(_0x38076e[_0xd4f0('0x11')][_0xd4f0('0x12')]===0x1f4){logger[_0xd4f0('0x11')]('ZohoField,\x20%s,\x20%s',_0x157b64,_0x38076e[_0xd4f0('0x11')][_0xd4f0('0x13')]);return _0x3361e1(_0x38076e[_0xd4f0('0x11')][_0xd4f0('0x13')]);}logger[_0xd4f0('0x11')](_0xd4f0('0xc'),_0x157b64,_0x38076e[_0xd4f0('0x11')][_0xd4f0('0x13')]);return _0x46e681(_0x38076e[_0xd4f0('0x11')][_0xd4f0('0x13')]);}else{logger[_0xd4f0('0xb')](_0xd4f0('0xc'),_0x157b64,'request\x20sent');_0x46e681(_0x38076e['result'][_0xd4f0('0x13')]);}})[_0xd4f0('0x14')](function(_0x5b543e){logger['error']('ZohoField,\x20%s,\x20%s',_0x157b64,_0x5b543e);_0x3361e1(_0x5b543e);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 8b28fd7..9b92f95 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x470496,_0x273336){var _0x28b598=function(_0x463c71){while(--_0x463c71){_0x470496['push'](_0x470496['shift']());}};_0x28b598(++_0x273336);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1244f2,_0x353c26){var _0x13e270=function(_0x4941fc){while(--_0x4941fc){_0x1244f2['push'](_0x1244f2['shift']());}};_0x13e270(++_0x353c26);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 8918283..9973277 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 _0x9354=['INTEGER','BOOLEAN','state','exports','STRING','unique_name_and_version','app.js'];(function(_0x1b63e4,_0x5544b9){var _0x2f5ed0=function(_0x40a172){while(--_0x40a172){_0x1b63e4['push'](_0x1b63e4['shift']());}};_0x2f5ed0(++_0x5544b9);}(_0x9354,0x96));var _0x4935=function(_0x3108d9,_0xf08d6){_0x3108d9=_0x3108d9-0x0;var _0x1455e6=_0x9354[_0x3108d9];return _0x1455e6;};'use strict';var Sequelize=require('sequelize');module[_0x4935('0x0')]={'name':{'type':Sequelize[_0x4935('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x4935('0x1')],'allowNull':![],'unique':_0x4935('0x2')},'main':{'type':Sequelize[_0x4935('0x1')],'defaultValue':_0x4935('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x4935('0x1')]},'type':{'type':Sequelize[_0x4935('0x1')]},'size':{'type':Sequelize[_0x4935('0x4')]},'active':{'type':Sequelize[_0x4935('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x4935('0x1')]},'logo':{'type':Sequelize[_0x4935('0x1')]},'state':{'type':Sequelize[_0x4935('0x1')],'unique':_0x4935('0x6')},'description':{'type':Sequelize[_0x4935('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4935('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xcf66=['app.js','INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x11832d,_0xfc910e){var _0x5b08b9=function(_0xdfa9fa){while(--_0xdfa9fa){_0x11832d['push'](_0x11832d['shift']());}};_0x5b08b9(++_0xfc910e);}(_0xcf66,0x11c));var _0x6cf6=function(_0x335d79,_0x388aa3){_0x335d79=_0x335d79-0x0;var _0x269b77=_0xcf66[_0x335d79];return _0x269b77;};'use strict';var Sequelize=require(_0x6cf6('0x0'));module[_0x6cf6('0x1')]={'name':{'type':Sequelize[_0x6cf6('0x2')],'allowNull':![],'unique':_0x6cf6('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x6cf6('0x2')],'defaultValue':_0x6cf6('0x4')},'filename':{'type':Sequelize[_0x6cf6('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6cf6('0x2')]},'size':{'type':Sequelize[_0x6cf6('0x5')]},'active':{'type':Sequelize[_0x6cf6('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x6cf6('0x2')]},'logo':{'type':Sequelize[_0x6cf6('0x2')]},'state':{'type':Sequelize[_0x6cf6('0x2')],'unique':_0x6cf6('0x7')},'description':{'type':Sequelize[_0x6cf6('0x2')]},'title':{'type':Sequelize[_0x6cf6('0x2')]},'remoteUri':{'type':Sequelize[_0x6cf6('0x2')]},'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 670f1c9..1bf4422 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 _0x7096=['offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','Integration','find','catch','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x40132e,_0x395945){var _0xbcaf53=function(_0x81b47e){while(--_0x81b47e){_0x40132e['push'](_0x40132e['shift']());}};_0xbcaf53(++_0x395945);}(_0x7096,0x10c));var _0x6709=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x7096[_0x28947d];return _0x12d2ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['Integration'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['Integration'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['Integration'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['Integration']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['Integration'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));}; \ No newline at end of file +var _0xba34=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','Integration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0xfd7129,_0x1b71b6){var _0x5914a0=function(_0xd3c902){while(--_0xd3c902){_0xfd7129['push'](_0xfd7129['shift']());}};_0x5914a0(++_0x1b71b6);}(_0xba34,0x119));var _0x4ba3=function(_0x26d89c,_0x4af13d){_0x26d89c=_0x26d89c-0x0;var _0x56e542=_0xba34[_0x26d89c];return _0x56e542;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['Integration']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['create']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['create'](_0xa4bbb2[_0x4ba3('0x49')],{})[_0x4ba3('0x26')](respondWithResult(_0x1fe115,0xc9))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports['update']=function(_0x47f588,_0x34dc04){if(_0x47f588['body']['id']){delete _0x47f588[_0x4ba3('0x49')]['id'];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x47f588[_0x4ba3('0x4a')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x26')](saveUpdates(_0x47f588['body'],null))[_0x4ba3('0x26')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x46')](handleError(_0x34dc04,null));};exports['destroy']=function(_0x325475,_0x12ae6f){return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x325475[_0x4ba3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12ae6f,null))[_0x4ba3('0x26')](removeEntity(_0x12ae6f,null))[_0x4ba3('0x46')](handleError(_0x12ae6f,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 30642c3..d220a7f 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 _0x0036=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define'];(function(_0x150c65,_0x303f38){var _0x4ca489=function(_0x2c2e26){while(--_0x2c2e26){_0x150c65['push'](_0x150c65['shift']());}};_0x4ca489(++_0x303f38);}(_0x0036,0x78));var _0x6003=function(_0xc496b9,_0x493da6){_0xc496b9=_0xc496b9-0x0;var _0x1a0044=_0x0036[_0xc496b9];return _0x1a0044;};'use strict';var _=require('lodash');var util=require(_0x6003('0x0'));var logger=require(_0x6003('0x1'))(_0x6003('0x2'));var moment=require(_0x6003('0x3'));var BPromise=require(_0x6003('0x4'));var rp=require(_0x6003('0x5'));var fs=require('fs');var path=require(_0x6003('0x6'));var rimraf=require(_0x6003('0x7'));var config=require(_0x6003('0x8'));var attributes=require(_0x6003('0x9'));module[_0x6003('0xa')]=function(_0x1a0430,_0x210f15){return _0x1a0430[_0x6003('0xb')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaeaf=['lodash','util','moment','bluebird','request-promise','path','rimraf','./integration.attributes','define','integrations'];(function(_0x3509d3,_0x41881b){var _0x1d9d7e=function(_0x11bc29){while(--_0x11bc29){_0x3509d3['push'](_0x3509d3['shift']());}};_0x1d9d7e(++_0x41881b);}(_0xaeaf,0x96));var _0xfaea=function(_0x2649e2,_0x3e73be){_0x2649e2=_0x2649e2-0x0;var _0x4797d4=_0xaeaf[_0x2649e2];return _0x4797d4;};'use strict';var _=require(_0xfaea('0x0'));var util=require(_0xfaea('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfaea('0x2'));var BPromise=require(_0xfaea('0x3'));var rp=require(_0xfaea('0x4'));var fs=require('fs');var path=require(_0xfaea('0x5'));var rimraf=require(_0xfaea('0x6'));var config=require('../../config/environment');var attributes=require(_0xfaea('0x7'));module['exports']=function(_0x5064a0,_0x43b79a){return _0x5064a0[_0xfaea('0x8')]('Integration',attributes,{'tableName':_0xfaea('0x9'),'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 5a19c9b..a5ad572 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 _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2217bd,_0x5aef9b){var _0x4cb89f=function(_0x1412d9){while(--_0x1412d9){_0x2217bd['push'](_0x2217bd['shift']());}};_0x4cb89f(++_0x5aef9b);}(_0x7880,0x1f4));var _0x0788=function(_0x3de6c1,_0x4cb097){_0x3de6c1=_0x3de6c1-0x0;var _0x4453c8=_0x7880[_0x3de6c1];return _0x4453c8;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file +var _0x7a54=['info','Integration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x301ccc,_0x42cb38){_0x301ccc=_0x301ccc-0x0;var _0x3ee659=_0x7a54[_0x301ccc];return _0x3ee659;};'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')]('Integration,\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/integrationReport/index.js b/server/api/integrationReport/index.js index 84a333c..8ad0264 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 _0x57ca=['create','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0xc0174b,_0x5282cd){var _0x28ab53=function(_0x1ca2cb){while(--_0x1ca2cb){_0xc0174b['push'](_0xc0174b['shift']());}};_0x28ab53(++_0x5282cd);}(_0x57ca,0x108));var _0xa57c=function(_0x21930d,_0x4127f8){_0x21930d=_0x21930d-0x0;var _0x5667db=_0x57ca[_0x21930d];return _0x5667db;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0xf')]('/',auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router['put'](_0xa57c('0xd'),auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x11')]('/:id',auth[_0xa57c('0x9')](),controller[_0xa57c('0x12')]);module[_0xa57c('0x13')]=router; \ No newline at end of file +var _0x7880=['Router','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x6a790c,_0x19901b){var _0x16f7b4=function(_0x410505){while(--_0x410505){_0x6a790c['push'](_0x6a790c['shift']());}};_0x16f7b4(++_0x19901b);}(_0x7880,0x1f4));var _0x0788=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0x7880[_0x4350c2];return _0x8b6406;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['get'](_0x0788('0xe'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router['post']('/',auth[_0x0788('0xa')](),controller[_0x0788('0x10')]);router[_0x0788('0x11')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller['update']);router[_0x0788('0x12')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller[_0x0788('0x13')]);module[_0x0788('0x14')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index deb4ee3..299b9e0 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 _0x81ec=['RECEIVED','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING'];(function(_0x51a8ab,_0x18b605){var _0x531fad=function(_0x88f796){while(--_0x88f796){_0x51a8ab['push'](_0x51a8ab['shift']());}};_0x531fad(++_0x18b605);}(_0x81ec,0x1ba));var _0xc81e=function(_0x23b8b8,_0x178355){_0x23b8b8=_0x23b8b8-0x0;var _0x809b82=_0x81ec[_0x23b8b8];return _0x809b82;};'use strict';var Sequelize=require(_0xc81e('0x0'));module['exports']={'integration':{'type':Sequelize[_0xc81e('0x1')]},'eventChannel':{'type':Sequelize[_0xc81e('0x1')]},'exitStatus':{'type':Sequelize[_0xc81e('0x1')]},'ticketId':{'type':Sequelize[_0xc81e('0x1')]},'integrationId':{'type':Sequelize[_0xc81e('0x2')]},'contacts':{'type':Sequelize[_0xc81e('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc81e('0x1')]},'calleridname':{'type':Sequelize[_0xc81e('0x1')]},'queue':{'type':Sequelize[_0xc81e('0x1')]},'interface':{'type':Sequelize[_0xc81e('0x1')]},'membername':{'type':Sequelize[_0xc81e('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xc81e('0x3')]},'holdtime':{'type':Sequelize[_0xc81e('0x2')]},'agentcomplete':{'type':Sequelize[_0xc81e('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xc81e('0x3')]},'talktime':{'type':Sequelize[_0xc81e('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc81e('0x2')]},'reason':{'type':Sequelize[_0xc81e('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xc81e('0x3')]},'agentdump':{'type':Sequelize[_0xc81e('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xc81e('0x3')]},'lastevent':{'type':Sequelize[_0xc81e('0x1')]},'channel':{'type':Sequelize[_0xc81e('0x1')]},'channelstate':{'type':Sequelize[_0xc81e('0x2')]},'channelstatedesc':{'type':Sequelize[_0xc81e('0x1')]},'connectedlinenum':{'type':Sequelize[_0xc81e('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc81e('0x1')]},'accountcode':{'type':Sequelize[_0xc81e('0x1')]},'context':{'type':Sequelize[_0xc81e('0x1')]},'exten':{'type':Sequelize[_0xc81e('0x1')]},'priority':{'type':Sequelize[_0xc81e('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc81e('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xc81e('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc81e('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xc81e('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xc81e('0x1')]},'destaccountcode':{'type':Sequelize[_0xc81e('0x1')]},'destcontext':{'type':Sequelize[_0xc81e('0x1')]},'destexten':{'type':Sequelize[_0xc81e('0x1')]},'destpriority':{'type':Sequelize[_0xc81e('0x1')]},'destuniqueid':{'type':Sequelize[_0xc81e('0x1')]},'messageId':{'type':Sequelize[_0xc81e('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xc81e('0x1')]},'from':{'type':Sequelize[_0xc81e('0x1')]},'to':{'type':Sequelize[_0xc81e('0x1')]},'cc':{'type':Sequelize[_0xc81e('0x1')]},'attachment':{'type':Sequelize[_0xc81e('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xc81e('0x5')]},'status':{'type':Sequelize[_0xc81e('0x6')]('SENT',_0xc81e('0x7'),_0xc81e('0x8'),_0xc81e('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xc81e('0x1')]},'appdata':{'type':Sequelize[_0xc81e('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4b1d=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','FAILED','sequelize','exports','STRING'];(function(_0x6a1c89,_0x5d695b){var _0x3396df=function(_0x1121bb){while(--_0x1121bb){_0x6a1c89['push'](_0x6a1c89['shift']());}};_0x3396df(++_0x5d695b);}(_0x4b1d,0x110));var _0xd4b1=function(_0x320402,_0x33a4b7){_0x320402=_0x320402-0x0;var _0x89f0a=_0x4b1d[_0x320402];return _0x89f0a;};'use strict';var Sequelize=require(_0xd4b1('0x0'));module[_0xd4b1('0x1')]={'integration':{'type':Sequelize[_0xd4b1('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xd4b1('0x2')]},'ticketId':{'type':Sequelize[_0xd4b1('0x2')]},'integrationId':{'type':Sequelize[_0xd4b1('0x3')]},'contacts':{'type':Sequelize[_0xd4b1('0x2')]},'uniqueid':{'type':Sequelize[_0xd4b1('0x2')]},'calleridnum':{'type':Sequelize[_0xd4b1('0x2')]},'calleridname':{'type':Sequelize[_0xd4b1('0x2')]},'queue':{'type':Sequelize[_0xd4b1('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd4b1('0x2')]},'agentcalledAt':{'type':Sequelize[_0xd4b1('0x4')]},'agentconnectAt':{'type':Sequelize[_0xd4b1('0x4')]},'holdtime':{'type':Sequelize[_0xd4b1('0x3')]},'agentcomplete':{'type':Sequelize[_0xd4b1('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xd4b1('0x3')]},'agentacw':{'type':Sequelize[_0xd4b1('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xd4b1('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd4b1('0x4')]},'agentdump':{'type':Sequelize[_0xd4b1('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xd4b1('0x2')]},'channel':{'type':Sequelize[_0xd4b1('0x2')]},'channelstate':{'type':Sequelize[_0xd4b1('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd4b1('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd4b1('0x2')]},'language':{'type':Sequelize[_0xd4b1('0x2')]},'accountcode':{'type':Sequelize[_0xd4b1('0x2')]},'context':{'type':Sequelize[_0xd4b1('0x2')]},'exten':{'type':Sequelize[_0xd4b1('0x2')]},'priority':{'type':Sequelize[_0xd4b1('0x2')]},'destchannel':{'type':Sequelize[_0xd4b1('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd4b1('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xd4b1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd4b1('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xd4b1('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd4b1('0x2')]},'destexten':{'type':Sequelize[_0xd4b1('0x2')]},'destpriority':{'type':Sequelize[_0xd4b1('0x2')]},'destuniqueid':{'type':Sequelize[_0xd4b1('0x2')]},'messageId':{'type':Sequelize[_0xd4b1('0x2')]},'inReplyTo':{'type':Sequelize[_0xd4b1('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xd4b1('0x2')]},'to':{'type':Sequelize[_0xd4b1('0x2')]},'cc':{'type':Sequelize[_0xd4b1('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xd4b1('0x6')]},'text':{'type':Sequelize[_0xd4b1('0x6')]},'status':{'type':Sequelize[_0xd4b1('0x7')](_0xd4b1('0x8'),_0xd4b1('0x9'),'RECEIVED',_0xd4b1('0xa'))},'url':{'type':Sequelize[_0xd4b1('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xd4b1('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index b402deb..c6560fd 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 _0xe996=['find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','name','send','index','map','IntegrationReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','params','includeAll','include'];(function(_0x108e00,_0x3b11f7){var _0x2c6b1d=function(_0x21cf9c){while(--_0x21cf9c){_0x108e00['push'](_0x108e00['shift']());}};_0x2c6b1d(++_0x3b11f7);}(_0xe996,0x96));var _0x6e99=function(_0x4c4674,_0x76c920){_0x4c4674=_0x4c4674-0x0;var _0x48dd75=_0xe996[_0x4c4674];return _0x48dd75;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e99('0x0'));var zipdir=require(_0x6e99('0x1'));var jsonpatch=require(_0x6e99('0x2'));var rp=require(_0x6e99('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6e99('0x4'));var util=require(_0x6e99('0x5'));var path=require(_0x6e99('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6e99('0x7'));var fs=require('fs');var fs_extra=require(_0x6e99('0x8'));var _=require(_0x6e99('0x9'));var squel=require(_0x6e99('0xa'));var crypto=require(_0x6e99('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6e99('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6e99('0xd'));var Redis=require(_0x6e99('0xe'));var authService=require(_0x6e99('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6e99('0x10'));var hardwareService=require(_0x6e99('0x11'));var logger=require(_0x6e99('0x12'))(_0x6e99('0x13'));var utils=require('../../config/utils');var config=require(_0x6e99('0x14'));var licenseUtil=require(_0x6e99('0x15'));var db=require(_0x6e99('0x16'))['db'];function respondWithStatusCode(_0x53d18f,_0x244343){_0x244343=_0x244343||0xcc;return function(_0x198d8c){if(_0x198d8c){return _0x53d18f[_0x6e99('0x17')](_0x244343);}return _0x53d18f[_0x6e99('0x18')](_0x244343)[_0x6e99('0x19')]();};}function respondWithResult(_0x32f0a8,_0x449fb8){_0x449fb8=_0x449fb8||0xc8;return function(_0x398ae2){if(_0x398ae2){return _0x32f0a8[_0x6e99('0x18')](_0x449fb8)[_0x6e99('0x1a')](_0x398ae2);}};}function respondWithFilteredResult(_0x4d9472,_0x4d2d6a){return function(_0x6fa637){if(_0x6fa637){var _0x4ed014=typeof _0x4d2d6a[_0x6e99('0x1b')]===_0x6e99('0x1c')&&typeof _0x4d2d6a[_0x6e99('0x1d')]===_0x6e99('0x1c');var _0x28ce14=_0x6fa637[_0x6e99('0x1e')];var _0x36af2a=_0x4ed014?0x0:_0x4d2d6a['offset'];var _0x42f65d=_0x4ed014?_0x6fa637['count']:_0x4d2d6a[_0x6e99('0x1b')]+_0x4d2d6a[_0x6e99('0x1d')];var _0x367843;if(_0x42f65d>=_0x28ce14){_0x42f65d=_0x28ce14;_0x367843=0xc8;}else{_0x367843=0xce;}_0x4d9472['status'](_0x367843);return _0x4d9472[_0x6e99('0x1f')]('Content-Range',_0x36af2a+'-'+_0x42f65d+'/'+_0x28ce14)[_0x6e99('0x1a')](_0x6fa637);}return null;};}function patchUpdates(_0x16be1f){return function(_0x4d7879){try{jsonpatch[_0x6e99('0x20')](_0x4d7879,_0x16be1f,!![]);}catch(_0x593a04){return BPromise[_0x6e99('0x21')](_0x593a04);}return _0x4d7879[_0x6e99('0x22')]();};}function saveUpdates(_0x1186bf,_0x5ad3ef){return function(_0x46a3ef){if(_0x46a3ef){return _0x46a3ef[_0x6e99('0x23')](_0x1186bf)['then'](function(_0x51680e){return _0x51680e;});}return null;};}function removeEntity(_0x534cf8,_0x462742){return function(_0x37c464){if(_0x37c464){return _0x37c464[_0x6e99('0x24')]()[_0x6e99('0x25')](function(){_0x534cf8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1694fe,_0x32afde){return function(_0x40ec37){if(!_0x40ec37){_0x1694fe[_0x6e99('0x17')](0x194);}return _0x40ec37;};}function handleError(_0x39f44a,_0x300609){_0x300609=_0x300609||0x1f4;return function(_0x416685){logger[_0x6e99('0x26')](_0x416685['stack']);if(_0x416685['name']){delete _0x416685[_0x6e99('0x27')];}_0x39f44a[_0x6e99('0x18')](_0x300609)[_0x6e99('0x28')](_0x416685);};}exports[_0x6e99('0x29')]=function(_0x126376,_0x324694){var _0x1379ac={},_0x1798e1={},_0x1918f5={'count':0x0,'rows':[]};var _0x154853=_[_0x6e99('0x2a')](db[_0x6e99('0x2b')]['rawAttributes'],function(_0xf139f1){return{'name':_0xf139f1[_0x6e99('0x2c')],'type':_0xf139f1[_0x6e99('0x2d')][_0x6e99('0x2e')]};});_0x1798e1['model']=_[_0x6e99('0x2a')](_0x154853,_0x6e99('0x27'));_0x1798e1[_0x6e99('0x2f')]=_[_0x6e99('0x30')](_0x126376[_0x6e99('0x2f')]);_0x1798e1[_0x6e99('0x31')]=_[_0x6e99('0x32')](_0x1798e1[_0x6e99('0x33')],_0x1798e1[_0x6e99('0x2f')]);_0x1379ac['attributes']=_[_0x6e99('0x32')](_0x1798e1['model'],qs['fields'](_0x126376[_0x6e99('0x2f')][_0x6e99('0x34')]));_0x1379ac[_0x6e99('0x35')]=_0x1379ac[_0x6e99('0x35')]['length']?_0x1379ac[_0x6e99('0x35')]:_0x1798e1['model'];if(!_0x126376[_0x6e99('0x2f')][_0x6e99('0x36')](_0x6e99('0x37'))){_0x1379ac[_0x6e99('0x1d')]=qs[_0x6e99('0x1d')](_0x126376[_0x6e99('0x2f')][_0x6e99('0x1d')]);_0x1379ac[_0x6e99('0x1b')]=qs[_0x6e99('0x1b')](_0x126376[_0x6e99('0x2f')][_0x6e99('0x1b')]);}_0x1379ac[_0x6e99('0x38')]=qs[_0x6e99('0x39')](_0x126376[_0x6e99('0x2f')][_0x6e99('0x39')]);_0x1379ac[_0x6e99('0x3a')]=qs[_0x6e99('0x31')](_[_0x6e99('0x3b')](_0x126376[_0x6e99('0x2f')],_0x1798e1[_0x6e99('0x31')]),_0x154853);if(_0x126376[_0x6e99('0x2f')][_0x6e99('0x3c')]){_0x1379ac[_0x6e99('0x3a')]=_[_0x6e99('0x3d')](_0x1379ac[_0x6e99('0x3a')],{'$or':_[_0x6e99('0x2a')](_0x154853,function(_0x1da377){if(_0x1da377['type']!==_0x6e99('0x3e')){var _0x425ac1={};_0x425ac1[_0x1da377[_0x6e99('0x27')]]={'$like':'%'+_0x126376[_0x6e99('0x2f')][_0x6e99('0x3c')]+'%'};return _0x425ac1;}})});}_0x1379ac=_[_0x6e99('0x3d')]({},_0x1379ac,_0x126376[_0x6e99('0x3f')]);var _0x2d16fd={'where':_0x1379ac[_0x6e99('0x3a')]};return db['IntegrationReport'][_0x6e99('0x1e')](_0x2d16fd)[_0x6e99('0x25')](function(_0xc65a4b){_0x1918f5[_0x6e99('0x1e')]=_0xc65a4b;if(_0x126376[_0x6e99('0x2f')]['includeAll']){_0x1379ac['include']=[{'all':!![]}];}return db['IntegrationReport'][_0x6e99('0x40')](_0x1379ac);})['then'](function(_0x1a78f2){_0x1918f5['rows']=_0x1a78f2;return _0x1918f5;})[_0x6e99('0x25')](respondWithFilteredResult(_0x324694,_0x1379ac))[_0x6e99('0x41')](handleError(_0x324694,null));};exports['show']=function(_0x38a5b4,_0x42c7e4){var _0x158e2d={'raw':![],'where':{'id':_0x38a5b4[_0x6e99('0x42')]['id']}},_0x1382d7={};_0x1382d7['model']=_[_0x6e99('0x30')](db[_0x6e99('0x2b')]['rawAttributes']);_0x1382d7['query']=_[_0x6e99('0x30')](_0x38a5b4['query']);_0x1382d7[_0x6e99('0x31')]=_[_0x6e99('0x32')](_0x1382d7[_0x6e99('0x33')],_0x1382d7[_0x6e99('0x2f')]);_0x158e2d[_0x6e99('0x35')]=_[_0x6e99('0x32')](_0x1382d7[_0x6e99('0x33')],qs[_0x6e99('0x34')](_0x38a5b4[_0x6e99('0x2f')][_0x6e99('0x34')]));_0x158e2d[_0x6e99('0x35')]=_0x158e2d['attributes']['length']?_0x158e2d[_0x6e99('0x35')]:_0x1382d7[_0x6e99('0x33')];if(_0x38a5b4[_0x6e99('0x2f')][_0x6e99('0x43')]){_0x158e2d[_0x6e99('0x44')]=[{'all':!![]}];}_0x158e2d=_[_0x6e99('0x3d')]({},_0x158e2d,_0x38a5b4[_0x6e99('0x3f')]);return db[_0x6e99('0x2b')][_0x6e99('0x45')](_0x158e2d)[_0x6e99('0x25')](handleEntityNotFound(_0x42c7e4,null))[_0x6e99('0x25')](respondWithResult(_0x42c7e4,null))[_0x6e99('0x41')](handleError(_0x42c7e4,null));};exports[_0x6e99('0x46')]=function(_0x4ba5de,_0x10d0b0){return db[_0x6e99('0x2b')][_0x6e99('0x46')](_0x4ba5de[_0x6e99('0x47')],{})['then'](respondWithResult(_0x10d0b0,0xc9))['catch'](handleError(_0x10d0b0,null));};exports[_0x6e99('0x23')]=function(_0x59cdd3,_0xc6bc33){if(_0x59cdd3['body']['id']){delete _0x59cdd3[_0x6e99('0x47')]['id'];}return db['IntegrationReport'][_0x6e99('0x45')]({'where':{'id':_0x59cdd3[_0x6e99('0x42')]['id']}})[_0x6e99('0x25')](handleEntityNotFound(_0xc6bc33,null))[_0x6e99('0x25')](saveUpdates(_0x59cdd3[_0x6e99('0x47')],null))[_0x6e99('0x25')](respondWithResult(_0xc6bc33,null))[_0x6e99('0x41')](handleError(_0xc6bc33,null));};exports[_0x6e99('0x24')]=function(_0x4629be,_0x28a3d4){return db[_0x6e99('0x2b')][_0x6e99('0x45')]({'where':{'id':_0x4629be[_0x6e99('0x42')]['id']}})['then'](handleEntityNotFound(_0x28a3d4,null))[_0x6e99('0x25')](removeEntity(_0x28a3d4,null))[_0x6e99('0x41')](handleError(_0x28a3d4,null));};exports[_0x6e99('0x48')]=function(_0x5068e3,_0x364162){return db['IntegrationReport'][_0x6e99('0x48')]()[_0x6e99('0x25')](respondWithResult(_0x364162,null))[_0x6e99('0x41')](handleError(_0x364162,null));}; \ No newline at end of file +var _0x7c78=['Content-Range','apply','save','update','then','stack','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','include','findAll','show','params','includeAll','catch','create','body','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','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','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x4ce336,_0xc6c97c){var _0x4df05c=function(_0x3978af){while(--_0x3978af){_0x4ce336['push'](_0x4ce336['shift']());}};_0x4df05c(++_0xc6c97c);}(_0x7c78,0x1a1));var _0x87c7=function(_0x230951,_0x4dad52){_0x230951=_0x230951-0x0;var _0xeb26b1=_0x7c78[_0x230951];return _0xeb26b1;};'use strict';var emlformat=require(_0x87c7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x87c7('0x1'));var rp=require(_0x87c7('0x2'));var moment=require(_0x87c7('0x3'));var BPromise=require(_0x87c7('0x4'));var Mustache=require(_0x87c7('0x5'));var util=require(_0x87c7('0x6'));var path=require(_0x87c7('0x7'));var sox=require('sox');var csv=require(_0x87c7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x87c7('0x9'));var _=require(_0x87c7('0xa'));var squel=require(_0x87c7('0xb'));var crypto=require('crypto');var jsforce=require(_0x87c7('0xc'));var deskjs=require(_0x87c7('0xd'));var toCsv=require(_0x87c7('0x8'));var querystring=require(_0x87c7('0xe'));var Papa=require(_0x87c7('0xf'));var Redis=require(_0x87c7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x87c7('0x11'));var as=require(_0x87c7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x87c7('0x13'))(_0x87c7('0x14'));var utils=require(_0x87c7('0x15'));var config=require(_0x87c7('0x16'));var licenseUtil=require(_0x87c7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a5fb7,_0x55fc3e){_0x55fc3e=_0x55fc3e||0xcc;return function(_0x3e6c3c){if(_0x3e6c3c){return _0x2a5fb7[_0x87c7('0x18')](_0x55fc3e);}return _0x2a5fb7[_0x87c7('0x19')](_0x55fc3e)[_0x87c7('0x1a')]();};}function respondWithResult(_0x4a6633,_0x2e9f4d){_0x2e9f4d=_0x2e9f4d||0xc8;return function(_0x2466b7){if(_0x2466b7){return _0x4a6633[_0x87c7('0x19')](_0x2e9f4d)[_0x87c7('0x1b')](_0x2466b7);}};}function respondWithFilteredResult(_0x16a7b2,_0x4b6593){return function(_0x40c909){if(_0x40c909){var _0x444737=typeof _0x4b6593[_0x87c7('0x1c')]===_0x87c7('0x1d')&&typeof _0x4b6593[_0x87c7('0x1e')]==='undefined';var _0x3dfab3=_0x40c909[_0x87c7('0x1f')];var _0x2d6a6a=_0x444737?0x0:_0x4b6593['offset'];var _0x472822=_0x444737?_0x40c909[_0x87c7('0x1f')]:_0x4b6593[_0x87c7('0x1c')]+_0x4b6593[_0x87c7('0x1e')];var _0x52c951;if(_0x472822>=_0x3dfab3){_0x472822=_0x3dfab3;_0x52c951=0xc8;}else{_0x52c951=0xce;}_0x16a7b2[_0x87c7('0x19')](_0x52c951);return _0x16a7b2[_0x87c7('0x20')](_0x87c7('0x21'),_0x2d6a6a+'-'+_0x472822+'/'+_0x3dfab3)['json'](_0x40c909);}return null;};}function patchUpdates(_0x598646){return function(_0x258f0a){try{jsonpatch[_0x87c7('0x22')](_0x258f0a,_0x598646,!![]);}catch(_0x41405b){return BPromise['reject'](_0x41405b);}return _0x258f0a[_0x87c7('0x23')]();};}function saveUpdates(_0x4385ae,_0x2aa1c1){return function(_0x383de3){if(_0x383de3){return _0x383de3[_0x87c7('0x24')](_0x4385ae)[_0x87c7('0x25')](function(_0x3cf82a){return _0x3cf82a;});}return null;};}function removeEntity(_0x457d36,_0x53d453){return function(_0x3f07d4){if(_0x3f07d4){return _0x3f07d4['destroy']()[_0x87c7('0x25')](function(){_0x457d36[_0x87c7('0x19')](0xcc)[_0x87c7('0x1a')]();});}};}function handleEntityNotFound(_0x5942d6,_0xf06d36){return function(_0x4c89f7){if(!_0x4c89f7){_0x5942d6[_0x87c7('0x18')](0x194);}return _0x4c89f7;};}function handleError(_0x3db0bf,_0x58e1c4){_0x58e1c4=_0x58e1c4||0x1f4;return function(_0x4e3c71){logger['error'](_0x4e3c71[_0x87c7('0x26')]);if(_0x4e3c71['name']){delete _0x4e3c71['name'];}_0x3db0bf[_0x87c7('0x19')](_0x58e1c4)[_0x87c7('0x27')](_0x4e3c71);};}exports[_0x87c7('0x28')]=function(_0x58f8c7,_0x1034fd){var _0x47aa4f={},_0x38ce94={},_0xfdd8a9={'count':0x0,'rows':[]};var _0x1c5c86=_[_0x87c7('0x29')](db[_0x87c7('0x2a')][_0x87c7('0x2b')],function(_0x23abfa){return{'name':_0x23abfa[_0x87c7('0x2c')],'type':_0x23abfa[_0x87c7('0x2d')]['key']};});_0x38ce94[_0x87c7('0x2e')]=_['map'](_0x1c5c86,'name');_0x38ce94[_0x87c7('0x2f')]=_[_0x87c7('0x30')](_0x58f8c7['query']);_0x38ce94[_0x87c7('0x31')]=_[_0x87c7('0x32')](_0x38ce94[_0x87c7('0x2e')],_0x38ce94[_0x87c7('0x2f')]);_0x47aa4f[_0x87c7('0x33')]=_['intersection'](_0x38ce94[_0x87c7('0x2e')],qs[_0x87c7('0x34')](_0x58f8c7['query'][_0x87c7('0x34')]));_0x47aa4f[_0x87c7('0x33')]=_0x47aa4f[_0x87c7('0x33')][_0x87c7('0x35')]?_0x47aa4f[_0x87c7('0x33')]:_0x38ce94[_0x87c7('0x2e')];if(!_0x58f8c7[_0x87c7('0x2f')][_0x87c7('0x36')](_0x87c7('0x37'))){_0x47aa4f[_0x87c7('0x1e')]=qs[_0x87c7('0x1e')](_0x58f8c7[_0x87c7('0x2f')][_0x87c7('0x1e')]);_0x47aa4f[_0x87c7('0x1c')]=qs[_0x87c7('0x1c')](_0x58f8c7[_0x87c7('0x2f')][_0x87c7('0x1c')]);}_0x47aa4f[_0x87c7('0x38')]=qs[_0x87c7('0x39')](_0x58f8c7[_0x87c7('0x2f')][_0x87c7('0x39')]);_0x47aa4f[_0x87c7('0x3a')]=qs['filters'](_[_0x87c7('0x3b')](_0x58f8c7[_0x87c7('0x2f')],_0x38ce94['filters']),_0x1c5c86);if(_0x58f8c7[_0x87c7('0x2f')][_0x87c7('0x3c')]){_0x47aa4f['where']=_[_0x87c7('0x3d')](_0x47aa4f['where'],{'$or':_['map'](_0x1c5c86,function(_0x527144){if(_0x527144[_0x87c7('0x2d')]!==_0x87c7('0x3e')){var _0x5ad295={};_0x5ad295[_0x527144[_0x87c7('0x3f')]]={'$like':'%'+_0x58f8c7[_0x87c7('0x2f')][_0x87c7('0x3c')]+'%'};return _0x5ad295;}})});}_0x47aa4f=_['merge']({},_0x47aa4f,_0x58f8c7[_0x87c7('0x40')]);var _0xbe2b74={'where':_0x47aa4f[_0x87c7('0x3a')]};return db['IntegrationReport']['count'](_0xbe2b74)[_0x87c7('0x25')](function(_0x145275){_0xfdd8a9[_0x87c7('0x1f')]=_0x145275;if(_0x58f8c7['query']['includeAll']){_0x47aa4f[_0x87c7('0x41')]=[{'all':!![]}];}return db[_0x87c7('0x2a')][_0x87c7('0x42')](_0x47aa4f);})[_0x87c7('0x25')](function(_0x5bc20c){_0xfdd8a9['rows']=_0x5bc20c;return _0xfdd8a9;})[_0x87c7('0x25')](respondWithFilteredResult(_0x1034fd,_0x47aa4f))['catch'](handleError(_0x1034fd,null));};exports[_0x87c7('0x43')]=function(_0x15d392,_0x2af91f){var _0x1e708f={'raw':![],'where':{'id':_0x15d392[_0x87c7('0x44')]['id']}},_0x4c6062={};_0x4c6062[_0x87c7('0x2e')]=_[_0x87c7('0x30')](db[_0x87c7('0x2a')]['rawAttributes']);_0x4c6062[_0x87c7('0x2f')]=_[_0x87c7('0x30')](_0x15d392[_0x87c7('0x2f')]);_0x4c6062['filters']=_[_0x87c7('0x32')](_0x4c6062[_0x87c7('0x2e')],_0x4c6062[_0x87c7('0x2f')]);_0x1e708f[_0x87c7('0x33')]=_[_0x87c7('0x32')](_0x4c6062['model'],qs[_0x87c7('0x34')](_0x15d392[_0x87c7('0x2f')][_0x87c7('0x34')]));_0x1e708f['attributes']=_0x1e708f[_0x87c7('0x33')][_0x87c7('0x35')]?_0x1e708f[_0x87c7('0x33')]:_0x4c6062[_0x87c7('0x2e')];if(_0x15d392['query'][_0x87c7('0x45')]){_0x1e708f[_0x87c7('0x41')]=[{'all':!![]}];}_0x1e708f=_[_0x87c7('0x3d')]({},_0x1e708f,_0x15d392[_0x87c7('0x40')]);return db[_0x87c7('0x2a')]['find'](_0x1e708f)[_0x87c7('0x25')](handleEntityNotFound(_0x2af91f,null))[_0x87c7('0x25')](respondWithResult(_0x2af91f,null))[_0x87c7('0x46')](handleError(_0x2af91f,null));};exports[_0x87c7('0x47')]=function(_0x3f173a,_0x5a3d8e){return db[_0x87c7('0x2a')][_0x87c7('0x47')](_0x3f173a[_0x87c7('0x48')],{})[_0x87c7('0x25')](respondWithResult(_0x5a3d8e,0xc9))[_0x87c7('0x46')](handleError(_0x5a3d8e,null));};exports[_0x87c7('0x24')]=function(_0x39f48d,_0x2a022f){if(_0x39f48d[_0x87c7('0x48')]['id']){delete _0x39f48d[_0x87c7('0x48')]['id'];}return db[_0x87c7('0x2a')][_0x87c7('0x49')]({'where':{'id':_0x39f48d[_0x87c7('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a022f,null))['then'](saveUpdates(_0x39f48d[_0x87c7('0x48')],null))[_0x87c7('0x25')](respondWithResult(_0x2a022f,null))['catch'](handleError(_0x2a022f,null));};exports['destroy']=function(_0x3efa3c,_0x4abca0){return db['IntegrationReport']['find']({'where':{'id':_0x3efa3c[_0x87c7('0x44')]['id']}})[_0x87c7('0x25')](handleEntityNotFound(_0x4abca0,null))['then'](removeEntity(_0x4abca0,null))[_0x87c7('0x46')](handleError(_0x4abca0,null));};exports['describe']=function(_0x34f461,_0x100089){return db['IntegrationReport'][_0x87c7('0x4a')]()[_0x87c7('0x25')](respondWithResult(_0x100089,null))[_0x87c7('0x46')](handleError(_0x100089,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 97b322d..562700d 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 _0xfd64=['define','report_integration','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports'];(function(_0xc2a47b,_0x396652){var _0x1e23b2=function(_0x2934ee){while(--_0x2934ee){_0xc2a47b['push'](_0xc2a47b['shift']());}};_0x1e23b2(++_0x396652);}(_0xfd64,0x19a));var _0x4fd6=function(_0x257d31,_0x3323e3){_0x257d31=_0x257d31-0x0;var _0x1ed1a7=_0xfd64[_0x257d31];return _0x1ed1a7;};'use strict';var _=require(_0x4fd6('0x0'));var util=require(_0x4fd6('0x1'));var logger=require('../../config/logger')(_0x4fd6('0x2'));var moment=require('moment');var BPromise=require(_0x4fd6('0x3'));var rp=require(_0x4fd6('0x4'));var fs=require('fs');var path=require(_0x4fd6('0x5'));var rimraf=require(_0x4fd6('0x6'));var config=require(_0x4fd6('0x7'));var attributes=require(_0x4fd6('0x8'));module[_0x4fd6('0x9')]=function(_0x2dc600,_0x4f92c5){return _0x2dc600[_0x4fd6('0xa')]('IntegrationReport',attributes,{'tableName':_0x4fd6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6df6=['bluebird','path','../../config/environment','./integrationReport.attributes','report_integration','lodash','util','../../config/logger','api','moment'];(function(_0x13bc5e,_0x1713d0){var _0xae6941=function(_0x36c0cc){while(--_0x36c0cc){_0x13bc5e['push'](_0x13bc5e['shift']());}};_0xae6941(++_0x1713d0);}(_0x6df6,0x127));var _0x66df=function(_0x5c1345,_0x40116e){_0x5c1345=_0x5c1345-0x0;var _0x1c070d=_0x6df6[_0x5c1345];return _0x1c070d;};'use strict';var _=require(_0x66df('0x0'));var util=require(_0x66df('0x1'));var logger=require(_0x66df('0x2'))(_0x66df('0x3'));var moment=require(_0x66df('0x4'));var BPromise=require(_0x66df('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x66df('0x6'));var rimraf=require('rimraf');var config=require(_0x66df('0x7'));var attributes=require(_0x66df('0x8'));module['exports']=function(_0xfea7b5,_0x2e5de1){return _0xfea7b5['define']('IntegrationReport',attributes,{'tableName':_0x66df('0x9'),'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 6a2f4ef..576a972 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x1d75c7,_0x44cfc6){var _0x52c160=function(_0x324e67){while(--_0x324e67){_0x1d75c7['push'](_0x1d75c7['shift']());}};_0x52c160(++_0x44cfc6);}(_0xdb28,0x106));var _0x8db2=function(_0x431e9f,_0x281c60){_0x431e9f=_0x431e9f-0x0;var _0x48fbcc=_0xdb28[_0x431e9f];return _0x48fbcc;};'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')]('IntegrationReport,\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 _0x3f8a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x11863a,_0x4f488e){_0x11863a=_0x11863a-0x0;var _0x570d4f=_0x3f8a[_0x11863a];return _0x570d4f;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf895d9,_0xcfea5,_0x268332){return new BPromise(function(_0x2faf2e,_0x2448de){return client[_0xa3f8('0xd')](_0xf895d9,_0x268332)[_0xa3f8('0xe')](function(_0xcdb0d4){logger['info'](_0xa3f8('0xf'),_0xcfea5,_0xa3f8('0x10'));logger[_0xa3f8('0x11')](_0xa3f8('0x12'),_0xcfea5,'request\x20sent',JSON[_0xa3f8('0x13')](_0xcdb0d4));if(_0xcdb0d4[_0xa3f8('0x14')]){if(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x15')]===0x1f4){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);return _0x2448de(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4['error'][_0xa3f8('0x16')]);return _0x2faf2e(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}else{logger[_0xa3f8('0x17')]('IntegrationReport,\x20%s,\x20%s',_0xcfea5,_0xa3f8('0x10'));_0x2faf2e(_0xcdb0d4[_0xa3f8('0x18')][_0xa3f8('0x16')]);}})[_0xa3f8('0x19')](function(_0x45ef64){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0x45ef64);_0x2448de(_0x45ef64);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index d497252..f1e1d62 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 _0x4317=['addIntervals','put','update','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','index','get','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many'];(function(_0x365c7f,_0xa99915){var _0x4a697e=function(_0x3ad4ce){while(--_0x3ad4ce){_0x365c7f['push'](_0x365c7f['shift']());}};_0x4a697e(++_0xa99915);}(_0x4317,0x7c));var _0x7431=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4317[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x7431('0x0'));var path=require(_0x7431('0x1'));var timeout=require(_0x7431('0x2'));var express=require('express');var router=express[_0x7431('0x3')]();var fs_extra=require(_0x7431('0x4'));var auth=require(_0x7431('0x5'));var interaction=require(_0x7431('0x6'));var config=require(_0x7431('0x7'));var controller=require(_0x7431('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7431('0x9')]);router[_0x7431('0xa')](_0x7431('0xb'),auth[_0x7431('0xc')](),controller[_0x7431('0xd')]);router[_0x7431('0xa')](_0x7431('0xe'),auth[_0x7431('0xc')](),controller[_0x7431('0xf')]);router[_0x7431('0x10')]('/',auth[_0x7431('0xc')](),controller[_0x7431('0x11')]);router[_0x7431('0x10')](_0x7431('0xe'),auth[_0x7431('0xc')](),controller[_0x7431('0x12')]);router[_0x7431('0x10')](_0x7431('0x13'),auth[_0x7431('0xc')](),controller[_0x7431('0x14')]);router[_0x7431('0x15')](_0x7431('0xb'),auth[_0x7431('0xc')](),controller[_0x7431('0x16')]);router['delete'](_0x7431('0xb'),auth[_0x7431('0xc')](),controller[_0x7431('0x17')]);module['exports']=router; \ No newline at end of file +var _0x965d=['addIntervals','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','/:id/sub_intervals','isAuthenticated','getIntervals','post','create'];(function(_0x2478b8,_0x40961b){var _0x102501=function(_0x26166c){while(--_0x26166c){_0x2478b8['push'](_0x2478b8['shift']());}};_0x102501(++_0x40961b);}(_0x965d,0x1be));var _0xd965=function(_0x4038d9,_0x9624f6){_0x4038d9=_0x4038d9-0x0;var _0x2f100=_0x965d[_0x4038d9];return _0x2f100;};'use strict';var multer=require(_0xd965('0x0'));var util=require(_0xd965('0x1'));var path=require('path');var timeout=require(_0xd965('0x2'));var express=require(_0xd965('0x3'));var router=express[_0xd965('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd965('0x5'));var interaction=require(_0xd965('0x6'));var config=require(_0xd965('0x7'));var controller=require('./interval.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd965('0x8')](_0xd965('0x9'),auth['isAuthenticated'](),controller[_0xd965('0xa')]);router['get'](_0xd965('0xb'),auth[_0xd965('0xc')](),controller[_0xd965('0xd')]);router[_0xd965('0xe')]('/',auth['isAuthenticated'](),controller[_0xd965('0xf')]);router[_0xd965('0xe')](_0xd965('0xb'),auth['isAuthenticated'](),controller['addInterval']);router['post']('/:id/sub_intervals/create_many',auth[_0xd965('0xc')](),controller[_0xd965('0x10')]);router['put'](_0xd965('0x9'),auth[_0xd965('0xc')](),controller[_0xd965('0x11')]);router[_0xd965('0x12')](_0xd965('0x9'),auth['isAuthenticated'](),controller[_0xd965('0x13')]);module[_0xd965('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 81fa93c..cc99c1c 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 _0xcc06=['STRING'];(function(_0x1ad295,_0x4d6f48){var _0x2ea33b=function(_0x12bae7){while(--_0x12bae7){_0x1ad295['push'](_0x1ad295['shift']());}};_0x2ea33b(++_0x4d6f48);}(_0xcc06,0x98));var _0x6cc0=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xcc06[_0x487b0c];return _0x1adbdc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6cc0('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x22dc=['sequelize','exports','STRING'];(function(_0x5cac1a,_0x276239){var _0x607a7a=function(_0x2dc925){while(--_0x2dc925){_0x5cac1a['push'](_0x5cac1a['shift']());}};_0x607a7a(++_0x276239);}(_0x22dc,0x1c5));var _0xc22d=function(_0x181566,_0x14f9ad){_0x181566=_0x181566-0x0;var _0x52a4a9=_0x22dc[_0x181566];return _0x52a4a9;};'use strict';var Sequelize=require(_0xc22d('0x0'));module[_0xc22d('0x1')]={'name':{'type':Sequelize[_0xc22d('0x2')]},'description':{'type':Sequelize[_0xc22d('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 7fb4d81..b6cffac 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 _0x4ebb=['findOne','sort','hasOwnProperty','sequelize','transaction','bulkCreate','findAll','eml-format','rimraf','zip-dir','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','UserProfileResource','end','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','Intervals','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals'];(function(_0x9d5a92,_0x34875d){var _0x3d84f2=function(_0x4bde89){while(--_0x4bde89){_0x9d5a92['push'](_0x9d5a92['shift']());}};_0x3d84f2(++_0x34875d);}(_0x4ebb,0x177));var _0xb4eb=function(_0x1f3f5b,_0x2346c8){_0x1f3f5b=_0x1f3f5b-0x0;var _0x5b0fce=_0x4ebb[_0x1f3f5b];return _0x5b0fce;};'use strict';var emlformat=require(_0xb4eb('0x0'));var rimraf=require(_0xb4eb('0x1'));var zipdir=require(_0xb4eb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb4eb('0x3'));var moment=require(_0xb4eb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb4eb('0x5'));var ejs=require(_0xb4eb('0x6'));var fs=require('fs');var fs_extra=require(_0xb4eb('0x7'));var _=require(_0xb4eb('0x8'));var squel=require(_0xb4eb('0x9'));var crypto=require('crypto');var jsforce=require(_0xb4eb('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xb4eb('0x5'));var querystring=require(_0xb4eb('0xb'));var Papa=require(_0xb4eb('0xc'));var Redis=require('ioredis');var authService=require(_0xb4eb('0xd'));var qs=require(_0xb4eb('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb4eb('0xf'));var logger=require(_0xb4eb('0x10'))(_0xb4eb('0x11'));var utils=require(_0xb4eb('0x12'));var config=require(_0xb4eb('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xb4eb('0x14'))['db'];var extensions=require(_0xb4eb('0x15'));function respondWithStatusCode(_0x4ed17a,_0x5de743){_0x5de743=_0x5de743||0xcc;return function(_0x59edc5){if(_0x59edc5){return _0x4ed17a[_0xb4eb('0x16')](_0x5de743);}return _0x4ed17a['status'](_0x5de743)['end']();};}function respondWithResult(_0x5d09df,_0x33254c){_0x33254c=_0x33254c||0xc8;return function(_0x1f71f6){if(_0x1f71f6){return _0x5d09df[_0xb4eb('0x17')](_0x33254c)[_0xb4eb('0x18')](_0x1f71f6);}};}function respondWithFilteredResult(_0x386ac8,_0x4194ae){return function(_0x18e3e4){if(_0x18e3e4){var _0x1a20c1=typeof _0x4194ae[_0xb4eb('0x19')]===_0xb4eb('0x1a')&&typeof _0x4194ae[_0xb4eb('0x1b')]===_0xb4eb('0x1a');var _0x3b5690=_0x18e3e4[_0xb4eb('0x1c')];var _0x5163e8=_0x1a20c1?0x0:_0x4194ae[_0xb4eb('0x19')];var _0x101cea=_0x1a20c1?_0x18e3e4['count']:_0x4194ae[_0xb4eb('0x19')]+_0x4194ae[_0xb4eb('0x1b')];var _0x5f0735;if(_0x101cea>=_0x3b5690){_0x101cea=_0x3b5690;_0x5f0735=0xc8;}else{_0x5f0735=0xce;}_0x386ac8[_0xb4eb('0x17')](_0x5f0735);return _0x386ac8[_0xb4eb('0x1d')](_0xb4eb('0x1e'),_0x5163e8+'-'+_0x101cea+'/'+_0x3b5690)['json'](_0x18e3e4);}return null;};}function patchUpdates(_0x1498e4){return function(_0x1ee5a2){try{jsonpatch[_0xb4eb('0x1f')](_0x1ee5a2,_0x1498e4,!![]);}catch(_0x1a99bd){return BPromise[_0xb4eb('0x20')](_0x1a99bd);}return _0x1ee5a2['save']();};}function saveUpdates(_0x1573c1,_0x566ee4){return function(_0x252f14){if(_0x252f14){return _0x252f14[_0xb4eb('0x21')](_0x1573c1)['then'](function(_0x3e4e81){return _0x3e4e81;});}return null;};}function removeEntity(_0x13a830,_0x2edcaa){return function(_0x7219cc){if(_0x7219cc){return _0x7219cc[_0xb4eb('0x22')]()[_0xb4eb('0x23')](function(){var _0xc431aa=_0x7219cc['get']({'plain':!![]});var _0x446f51='Intervals';return db[_0xb4eb('0x24')]['destroy']({'where':{'type':_0x446f51,'resourceId':_0xc431aa['id']}})[_0xb4eb('0x23')](function(){return _0x7219cc;});})[_0xb4eb('0x23')](function(){_0x13a830[_0xb4eb('0x17')](0xcc)[_0xb4eb('0x25')]();});}};}function handleEntityNotFound(_0x4dd997,_0x1242b4){return function(_0xce4285){if(!_0xce4285){_0x4dd997[_0xb4eb('0x16')](0x194);}return _0xce4285;};}function handleError(_0x3a65d4,_0x2e2a3b){_0x2e2a3b=_0x2e2a3b||0x1f4;return function(_0x3ddd90){logger[_0xb4eb('0x26')](_0x3ddd90[_0xb4eb('0x27')]);if(_0x3ddd90['name']){delete _0x3ddd90[_0xb4eb('0x28')];}_0x3a65d4[_0xb4eb('0x17')](_0x2e2a3b)[_0xb4eb('0x29')](_0x3ddd90);};}exports[_0xb4eb('0x2a')]=function(_0x115ebb,_0x47a336){var _0x3e9874={},_0x56f588={},_0x3e2713={'count':0x0,'rows':[]};var _0x4b3fa9=_[_0xb4eb('0x2b')](db[_0xb4eb('0x2c')][_0xb4eb('0x2d')],function(_0x56609f){return{'name':_0x56609f[_0xb4eb('0x2e')],'type':_0x56609f[_0xb4eb('0x2f')][_0xb4eb('0x30')]};});_0x56f588[_0xb4eb('0x31')]=_[_0xb4eb('0x2b')](_0x4b3fa9,_0xb4eb('0x28'));_0x56f588[_0xb4eb('0x32')]=_[_0xb4eb('0x33')](_0x115ebb['query']);_0x56f588[_0xb4eb('0x34')]=_[_0xb4eb('0x35')](_0x56f588[_0xb4eb('0x31')],_0x56f588[_0xb4eb('0x32')]);_0x3e9874[_0xb4eb('0x36')]=_[_0xb4eb('0x35')](_0x56f588[_0xb4eb('0x31')],qs[_0xb4eb('0x37')](_0x115ebb['query']['fields']));_0x3e9874['attributes']=_0x3e9874[_0xb4eb('0x36')][_0xb4eb('0x38')]?_0x3e9874['attributes']:_0x56f588[_0xb4eb('0x31')];if(!_0x115ebb['query']['hasOwnProperty'](_0xb4eb('0x39'))){_0x3e9874[_0xb4eb('0x1b')]=qs[_0xb4eb('0x1b')](_0x115ebb[_0xb4eb('0x32')][_0xb4eb('0x1b')]);_0x3e9874[_0xb4eb('0x19')]=qs[_0xb4eb('0x19')](_0x115ebb[_0xb4eb('0x32')]['offset']);}_0x3e9874[_0xb4eb('0x3a')]=qs['sort'](_0x115ebb[_0xb4eb('0x32')]['sort']);_0x3e9874['where']=qs['filters'](_[_0xb4eb('0x3b')](_0x115ebb[_0xb4eb('0x32')],_0x56f588[_0xb4eb('0x34')]),_0x4b3fa9);if(_0x115ebb[_0xb4eb('0x32')][_0xb4eb('0x3c')]){_0x3e9874[_0xb4eb('0x3d')]=_[_0xb4eb('0x3e')](_0x3e9874['where'],{'$or':_[_0xb4eb('0x2b')](_0x4b3fa9,function(_0x230930){if(_0x230930[_0xb4eb('0x2f')]!==_0xb4eb('0x3f')){var _0x31b5a7={};_0x31b5a7[_0x230930[_0xb4eb('0x28')]]={'$like':'%'+_0x115ebb[_0xb4eb('0x32')]['filter']+'%'};return _0x31b5a7;}})});}_0x3e9874=_[_0xb4eb('0x3e')]({},_0x3e9874,_0x115ebb[_0xb4eb('0x40')]);var _0x13bd88={'where':_0x3e9874[_0xb4eb('0x3d')]};return db[_0xb4eb('0x2c')][_0xb4eb('0x1c')](_0x13bd88)['then'](function(_0x434f2c){_0x3e2713[_0xb4eb('0x1c')]=_0x434f2c;if(_0x115ebb[_0xb4eb('0x32')][_0xb4eb('0x41')]){_0x3e9874['include']=[{'all':!![]}];}return db[_0xb4eb('0x2c')]['findAll'](_0x3e9874);})[_0xb4eb('0x23')](function(_0x5ead4e){_0x3e2713[_0xb4eb('0x42')]=_0x5ead4e;return _0x3e2713;})[_0xb4eb('0x23')](respondWithFilteredResult(_0x47a336,_0x3e9874))[_0xb4eb('0x43')](handleError(_0x47a336,null));};exports[_0xb4eb('0x44')]=function(_0x4d0b12,_0x2ccf1d){var _0x2b3b8f={'raw':!![],'where':{'id':_0x4d0b12[_0xb4eb('0x45')]['id']}},_0x3a1d7d={};_0x3a1d7d[_0xb4eb('0x31')]=_[_0xb4eb('0x33')](db[_0xb4eb('0x2c')][_0xb4eb('0x2d')]);_0x3a1d7d[_0xb4eb('0x32')]=_[_0xb4eb('0x33')](_0x4d0b12[_0xb4eb('0x32')]);_0x3a1d7d['filters']=_[_0xb4eb('0x35')](_0x3a1d7d[_0xb4eb('0x31')],_0x3a1d7d[_0xb4eb('0x32')]);_0x2b3b8f['attributes']=_[_0xb4eb('0x35')](_0x3a1d7d['model'],qs[_0xb4eb('0x37')](_0x4d0b12[_0xb4eb('0x32')][_0xb4eb('0x37')]));_0x2b3b8f['attributes']=_0x2b3b8f[_0xb4eb('0x36')][_0xb4eb('0x38')]?_0x2b3b8f['attributes']:_0x3a1d7d[_0xb4eb('0x31')];if(_0x4d0b12[_0xb4eb('0x32')][_0xb4eb('0x41')]){_0x2b3b8f['include']=[{'all':!![]}];}_0x2b3b8f=_[_0xb4eb('0x3e')]({},_0x2b3b8f,_0x4d0b12['options']);return db[_0xb4eb('0x2c')][_0xb4eb('0x46')](_0x2b3b8f)['then'](handleEntityNotFound(_0x2ccf1d,null))[_0xb4eb('0x23')](respondWithResult(_0x2ccf1d,null))[_0xb4eb('0x43')](handleError(_0x2ccf1d,null));};exports[_0xb4eb('0x47')]=function(_0x1edb36,_0x322630){return db[_0xb4eb('0x2c')][_0xb4eb('0x47')](_0x1edb36[_0xb4eb('0x48')],{})['then'](function(_0x17d758){var _0x4f1e0c=_0x1edb36['user']['get']({'plain':!![]});if(!_0x4f1e0c)throw new Error(_0xb4eb('0x49'));if(_0x4f1e0c[_0xb4eb('0x4a')]===_0xb4eb('0x4b')){var _0x47ddc7=_0x17d758[_0xb4eb('0x4c')]({'plain':!![]});var _0x281b0f=_0xb4eb('0x4d');return db[_0xb4eb('0x4e')]['find']({'where':{'name':_0x281b0f,'userProfileId':_0x4f1e0c[_0xb4eb('0x4f')]},'raw':!![]})[_0xb4eb('0x23')](function(_0x2f7b8d){if(_0x2f7b8d&&_0x2f7b8d[_0xb4eb('0x50')]===0x0){return db[_0xb4eb('0x24')]['create']({'name':_0x47ddc7[_0xb4eb('0x28')],'resourceId':_0x47ddc7['id'],'type':_0x2f7b8d[_0xb4eb('0x28')],'sectionId':_0x2f7b8d['id']},{})['then'](function(){return _0x17d758;});}else{return _0x17d758;}})[_0xb4eb('0x43')](function(_0x1593eb){logger[_0xb4eb('0x26')](_0xb4eb('0x51'),_0x1593eb);throw _0x1593eb;});}return _0x17d758;})[_0xb4eb('0x23')](respondWithResult(_0x322630,0xc9))[_0xb4eb('0x43')](handleError(_0x322630,null));};exports[_0xb4eb('0x21')]=function(_0x1e8f7a,_0x5231a5){if(_0x1e8f7a['body']['id']){delete _0x1e8f7a[_0xb4eb('0x48')]['id'];}return db[_0xb4eb('0x2c')][_0xb4eb('0x46')]({'where':{'id':_0x1e8f7a[_0xb4eb('0x45')]['id']}})[_0xb4eb('0x23')](handleEntityNotFound(_0x5231a5,null))[_0xb4eb('0x23')](saveUpdates(_0x1e8f7a['body'],null))[_0xb4eb('0x23')](respondWithResult(_0x5231a5,null))[_0xb4eb('0x43')](handleError(_0x5231a5,null));};exports[_0xb4eb('0x22')]=function(_0x1e2563,_0xa5cff6){return db['Interval'][_0xb4eb('0x46')]({'where':{'id':_0x1e2563['params']['id']}})['then'](handleEntityNotFound(_0xa5cff6,null))[_0xb4eb('0x23')](removeEntity(_0xa5cff6,null))[_0xb4eb('0x43')](handleError(_0xa5cff6,null));};exports[_0xb4eb('0x52')]=function(_0x55f580,_0x545b7f,_0x45c831){if(_0x55f580[_0xb4eb('0x48')]['id']){delete _0x55f580[_0xb4eb('0x48')]['id'];}return db['Interval'][_0xb4eb('0x46')]({'where':{'id':_0x55f580[_0xb4eb('0x45')]['id']}})[_0xb4eb('0x23')](handleEntityNotFound(_0x545b7f,null))[_0xb4eb('0x23')](function(_0x5cf26a){if(_0x5cf26a){_0x55f580['body'][_0xb4eb('0x53')]=_0x5cf26a['id'];return db[_0xb4eb('0x2c')][_0xb4eb('0x47')](_0x55f580[_0xb4eb('0x48')]);}})[_0xb4eb('0x23')](respondWithResult(_0x545b7f,null))[_0xb4eb('0x43')](handleError(_0x545b7f,null));};exports[_0xb4eb('0x54')]=function(_0x4a87dd,_0x36c080,_0x50d2b9){var _0x2032fb={};var _0x58077c={};var _0x35a2d7;var _0x50a3c0;return db[_0xb4eb('0x2c')][_0xb4eb('0x55')]({'where':{'id':_0x4a87dd['params']['id']}})[_0xb4eb('0x23')](handleEntityNotFound(_0x36c080,null))['then'](function(_0x192a3c){if(_0x192a3c){_0x35a2d7=_0x192a3c;_0x58077c[_0xb4eb('0x31')]=_['keys'](db['Interval']['rawAttributes']);_0x58077c['query']=_[_0xb4eb('0x33')](_0x4a87dd[_0xb4eb('0x32')]);_0x58077c['filters']=_[_0xb4eb('0x35')](_0x58077c['model'],_0x58077c[_0xb4eb('0x32')]);_0x2032fb[_0xb4eb('0x36')]=_[_0xb4eb('0x35')](_0x58077c[_0xb4eb('0x31')],qs[_0xb4eb('0x37')](_0x4a87dd[_0xb4eb('0x32')][_0xb4eb('0x37')]));_0x2032fb[_0xb4eb('0x36')]=_0x2032fb[_0xb4eb('0x36')][_0xb4eb('0x38')]?_0x2032fb[_0xb4eb('0x36')]:_0x58077c[_0xb4eb('0x31')];_0x2032fb[_0xb4eb('0x3a')]=qs[_0xb4eb('0x56')](_0x4a87dd[_0xb4eb('0x32')][_0xb4eb('0x56')]);_0x2032fb['where']=qs[_0xb4eb('0x34')](_['pick'](_0x4a87dd[_0xb4eb('0x32')],_0x58077c[_0xb4eb('0x34')]));if(_0x4a87dd[_0xb4eb('0x32')][_0xb4eb('0x3c')]){_0x2032fb[_0xb4eb('0x3d')]=_['merge'](_0x2032fb[_0xb4eb('0x3d')],{'$or':_[_0xb4eb('0x2b')](_0x2032fb[_0xb4eb('0x36')],function(_0x401ddf){var _0x521a22={};_0x521a22[_0x401ddf]={'$like':'%'+_0x4a87dd[_0xb4eb('0x32')]['filter']+'%'};return _0x521a22;})});}_0x2032fb=_[_0xb4eb('0x3e')]({},_0x2032fb,_0x4a87dd[_0xb4eb('0x40')]);return _0x35a2d7['getIntervals'](_0x2032fb);}})[_0xb4eb('0x23')](function(_0x59ceda){if(_0x59ceda){_0x50a3c0=_0x59ceda[_0xb4eb('0x38')];if(!_0x4a87dd['query'][_0xb4eb('0x57')](_0xb4eb('0x39'))){_0x2032fb[_0xb4eb('0x1b')]=qs[_0xb4eb('0x1b')](_0x4a87dd['query']['limit']);_0x2032fb[_0xb4eb('0x19')]=qs[_0xb4eb('0x19')](_0x4a87dd[_0xb4eb('0x32')][_0xb4eb('0x19')]);}return _0x35a2d7['getIntervals'](_0x2032fb);}})[_0xb4eb('0x23')](function(_0x57267b){if(_0x57267b){return _0x57267b?{'count':_0x50a3c0,'rows':_0x57267b}:null;}})['then'](respondWithResult(_0x36c080,null))['catch'](handleError(_0x36c080,null));};exports['addIntervals']=function(_0x2d4682,_0x524e5,_0x218fc5){return db['Interval'][_0xb4eb('0x55')]({'where':{'id':_0x2d4682['params']['id']}})[_0xb4eb('0x23')](handleEntityNotFound(_0x524e5,null))['then'](function(_0x2d80de){if(_0x2d80de){return db[_0xb4eb('0x58')][_0xb4eb('0x59')](function(_0x21f1ea){return db[_0xb4eb('0x2c')][_0xb4eb('0x22')]({'where':{'IntervalId':_0x2d4682[_0xb4eb('0x45')]['id']},'transaction':_0x21f1ea})[_0xb4eb('0x23')](function(_0x5536e1){var _0x62e235=_['map'](_0x2d4682[_0xb4eb('0x48')],function(_0x44a620){delete _0x44a620['id'];_0x44a620[_0xb4eb('0x53')]=_0x2d4682[_0xb4eb('0x45')]['id'];return _0x44a620;});return db[_0xb4eb('0x2c')][_0xb4eb('0x5a')](_0x62e235,{'transaction':_0x21f1ea});});})['then'](function(){return db['Interval'][_0xb4eb('0x5b')]({'where':{'IntervalId':_0x2d4682[_0xb4eb('0x45')]['id']}});});}})[_0xb4eb('0x23')](respondWithResult(_0x524e5,null))[_0xb4eb('0x43')](handleError(_0x524e5,null));}; \ No newline at end of file +var _0x1265=['transaction','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Interval','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','findOne','sequelize'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x1265,0x182));var _0x5126=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1265[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x5126('0x0'));var rimraf=require(_0x5126('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5126('0x2'));var rp=require(_0x5126('0x3'));var moment=require('moment');var BPromise=require(_0x5126('0x4'));var Mustache=require(_0x5126('0x5'));var util=require(_0x5126('0x6'));var path=require(_0x5126('0x7'));var sox=require(_0x5126('0x8'));var csv=require(_0x5126('0x9'));var ejs=require(_0x5126('0xa'));var fs=require('fs');var fs_extra=require(_0x5126('0xb'));var _=require(_0x5126('0xc'));var squel=require(_0x5126('0xd'));var crypto=require(_0x5126('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5126('0xf'));var toCsv=require(_0x5126('0x9'));var querystring=require('querystring');var Papa=require(_0x5126('0x10'));var Redis=require('ioredis');var authService=require(_0x5126('0x11'));var qs=require(_0x5126('0x12'));var as=require(_0x5126('0x13'));var hardwareService=require(_0x5126('0x14'));var logger=require(_0x5126('0x15'))(_0x5126('0x16'));var utils=require(_0x5126('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5126('0x18'));var db=require('../../mysqldb')['db'];var extensions=require(_0x5126('0x19'));function respondWithStatusCode(_0x36eb63,_0x34b310){_0x34b310=_0x34b310||0xcc;return function(_0x37fbb5){if(_0x37fbb5){return _0x36eb63[_0x5126('0x1a')](_0x34b310);}return _0x36eb63[_0x5126('0x1b')](_0x34b310)[_0x5126('0x1c')]();};}function respondWithResult(_0x380f0b,_0x363a9e){_0x363a9e=_0x363a9e||0xc8;return function(_0x13a8e3){if(_0x13a8e3){return _0x380f0b[_0x5126('0x1b')](_0x363a9e)[_0x5126('0x1d')](_0x13a8e3);}};}function respondWithFilteredResult(_0x367344,_0x41c8a0){return function(_0x3f1299){if(_0x3f1299){var _0x178582=typeof _0x41c8a0['offset']===_0x5126('0x1e')&&typeof _0x41c8a0[_0x5126('0x1f')]===_0x5126('0x1e');var _0x317944=_0x3f1299[_0x5126('0x20')];var _0x54053c=_0x178582?0x0:_0x41c8a0[_0x5126('0x21')];var _0x3f7cbb=_0x178582?_0x3f1299[_0x5126('0x20')]:_0x41c8a0[_0x5126('0x21')]+_0x41c8a0[_0x5126('0x1f')];var _0x52bdfa;if(_0x3f7cbb>=_0x317944){_0x3f7cbb=_0x317944;_0x52bdfa=0xc8;}else{_0x52bdfa=0xce;}_0x367344[_0x5126('0x1b')](_0x52bdfa);return _0x367344[_0x5126('0x22')](_0x5126('0x23'),_0x54053c+'-'+_0x3f7cbb+'/'+_0x317944)[_0x5126('0x1d')](_0x3f1299);}return null;};}function patchUpdates(_0x2e25f1){return function(_0x2066db){try{jsonpatch[_0x5126('0x24')](_0x2066db,_0x2e25f1,!![]);}catch(_0x2e8bce){return BPromise[_0x5126('0x25')](_0x2e8bce);}return _0x2066db[_0x5126('0x26')]();};}function saveUpdates(_0x1fcbb1,_0x10f434){return function(_0x5bdced){if(_0x5bdced){return _0x5bdced['update'](_0x1fcbb1)[_0x5126('0x27')](function(_0x379ea8){return _0x379ea8;});}return null;};}function removeEntity(_0x57b624,_0x43e595){return function(_0x969979){if(_0x969979){return _0x969979[_0x5126('0x28')]()[_0x5126('0x27')](function(){var _0x587033=_0x969979[_0x5126('0x29')]({'plain':!![]});var _0x501159=_0x5126('0x2a');return db[_0x5126('0x2b')][_0x5126('0x28')]({'where':{'type':_0x501159,'resourceId':_0x587033['id']}})[_0x5126('0x27')](function(){return _0x969979;});})[_0x5126('0x27')](function(){_0x57b624[_0x5126('0x1b')](0xcc)[_0x5126('0x1c')]();});}};}function handleEntityNotFound(_0x6e969d,_0x4b16c9){return function(_0xaf7b64){if(!_0xaf7b64){_0x6e969d[_0x5126('0x1a')](0x194);}return _0xaf7b64;};}function handleError(_0xabc384,_0x5b6429){_0x5b6429=_0x5b6429||0x1f4;return function(_0x2f8480){logger[_0x5126('0x2c')](_0x2f8480[_0x5126('0x2d')]);if(_0x2f8480[_0x5126('0x2e')]){delete _0x2f8480[_0x5126('0x2e')];}_0xabc384[_0x5126('0x1b')](_0x5b6429)[_0x5126('0x2f')](_0x2f8480);};}exports[_0x5126('0x30')]=function(_0x4eac33,_0x43060a){var _0x59e955={},_0x516b27={},_0x17153b={'count':0x0,'rows':[]};var _0x38f627=_[_0x5126('0x31')](db['Interval'][_0x5126('0x32')],function(_0x5e7137){return{'name':_0x5e7137[_0x5126('0x33')],'type':_0x5e7137[_0x5126('0x34')][_0x5126('0x35')]};});_0x516b27[_0x5126('0x36')]=_['map'](_0x38f627,'name');_0x516b27[_0x5126('0x37')]=_[_0x5126('0x38')](_0x4eac33[_0x5126('0x37')]);_0x516b27['filters']=_[_0x5126('0x39')](_0x516b27[_0x5126('0x36')],_0x516b27[_0x5126('0x37')]);_0x59e955[_0x5126('0x3a')]=_[_0x5126('0x39')](_0x516b27[_0x5126('0x36')],qs[_0x5126('0x3b')](_0x4eac33[_0x5126('0x37')]['fields']));_0x59e955[_0x5126('0x3a')]=_0x59e955[_0x5126('0x3a')]['length']?_0x59e955[_0x5126('0x3a')]:_0x516b27[_0x5126('0x36')];if(!_0x4eac33['query'][_0x5126('0x3c')](_0x5126('0x3d'))){_0x59e955[_0x5126('0x1f')]=qs['limit'](_0x4eac33[_0x5126('0x37')][_0x5126('0x1f')]);_0x59e955['offset']=qs[_0x5126('0x21')](_0x4eac33[_0x5126('0x37')][_0x5126('0x21')]);}_0x59e955[_0x5126('0x3e')]=qs[_0x5126('0x3f')](_0x4eac33[_0x5126('0x37')]['sort']);_0x59e955[_0x5126('0x40')]=qs[_0x5126('0x41')](_[_0x5126('0x42')](_0x4eac33[_0x5126('0x37')],_0x516b27[_0x5126('0x41')]),_0x38f627);if(_0x4eac33[_0x5126('0x37')][_0x5126('0x43')]){_0x59e955['where']=_[_0x5126('0x44')](_0x59e955[_0x5126('0x40')],{'$or':_['map'](_0x38f627,function(_0x4f8cd0){if(_0x4f8cd0[_0x5126('0x34')]!==_0x5126('0x45')){var _0x404783={};_0x404783[_0x4f8cd0[_0x5126('0x2e')]]={'$like':'%'+_0x4eac33[_0x5126('0x37')][_0x5126('0x43')]+'%'};return _0x404783;}})});}_0x59e955=_[_0x5126('0x44')]({},_0x59e955,_0x4eac33[_0x5126('0x46')]);var _0x279506={'where':_0x59e955[_0x5126('0x40')]};return db[_0x5126('0x47')][_0x5126('0x20')](_0x279506)[_0x5126('0x27')](function(_0x678b8a){_0x17153b[_0x5126('0x20')]=_0x678b8a;if(_0x4eac33['query'][_0x5126('0x48')]){_0x59e955['include']=[{'all':!![]}];}return db['Interval'][_0x5126('0x49')](_0x59e955);})[_0x5126('0x27')](function(_0x4de31d){_0x17153b[_0x5126('0x4a')]=_0x4de31d;return _0x17153b;})[_0x5126('0x27')](respondWithFilteredResult(_0x43060a,_0x59e955))[_0x5126('0x4b')](handleError(_0x43060a,null));};exports[_0x5126('0x4c')]=function(_0x525592,_0x3ff9d1){var _0x571fd5={'raw':!![],'where':{'id':_0x525592[_0x5126('0x4d')]['id']}},_0x55063f={};_0x55063f[_0x5126('0x36')]=_['keys'](db[_0x5126('0x47')]['rawAttributes']);_0x55063f[_0x5126('0x37')]=_['keys'](_0x525592['query']);_0x55063f[_0x5126('0x41')]=_[_0x5126('0x39')](_0x55063f[_0x5126('0x36')],_0x55063f[_0x5126('0x37')]);_0x571fd5['attributes']=_[_0x5126('0x39')](_0x55063f[_0x5126('0x36')],qs[_0x5126('0x3b')](_0x525592['query']['fields']));_0x571fd5[_0x5126('0x3a')]=_0x571fd5[_0x5126('0x3a')][_0x5126('0x4e')]?_0x571fd5['attributes']:_0x55063f[_0x5126('0x36')];if(_0x525592['query'][_0x5126('0x48')]){_0x571fd5[_0x5126('0x4f')]=[{'all':!![]}];}_0x571fd5=_[_0x5126('0x44')]({},_0x571fd5,_0x525592[_0x5126('0x46')]);return db['Interval'][_0x5126('0x50')](_0x571fd5)[_0x5126('0x27')](handleEntityNotFound(_0x3ff9d1,null))[_0x5126('0x27')](respondWithResult(_0x3ff9d1,null))[_0x5126('0x4b')](handleError(_0x3ff9d1,null));};exports['create']=function(_0x20ec39,_0x1317b0){return db[_0x5126('0x47')][_0x5126('0x51')](_0x20ec39[_0x5126('0x52')],{})[_0x5126('0x27')](function(_0x2ea8ef){var _0x278858=_0x20ec39[_0x5126('0x53')][_0x5126('0x29')]({'plain':!![]});if(!_0x278858)throw new Error(_0x5126('0x54'));if(_0x278858[_0x5126('0x55')]==='user'){var _0x56be0d=_0x2ea8ef['get']({'plain':!![]});var _0x82f47a=_0x5126('0x2a');return db['UserProfileSection'][_0x5126('0x50')]({'where':{'name':_0x82f47a,'userProfileId':_0x278858['userProfileId']},'raw':!![]})[_0x5126('0x27')](function(_0x24d734){if(_0x24d734&&_0x24d734[_0x5126('0x56')]===0x0){return db[_0x5126('0x2b')][_0x5126('0x51')]({'name':_0x56be0d[_0x5126('0x2e')],'resourceId':_0x56be0d['id'],'type':_0x24d734[_0x5126('0x2e')],'sectionId':_0x24d734['id']},{})[_0x5126('0x27')](function(){return _0x2ea8ef;});}else{return _0x2ea8ef;}})[_0x5126('0x4b')](function(_0x2babe9){logger['error'](_0x5126('0x57'),_0x2babe9);throw _0x2babe9;});}return _0x2ea8ef;})[_0x5126('0x27')](respondWithResult(_0x1317b0,0xc9))[_0x5126('0x4b')](handleError(_0x1317b0,null));};exports[_0x5126('0x58')]=function(_0x5c6626,_0x3394c8){if(_0x5c6626[_0x5126('0x52')]['id']){delete _0x5c6626[_0x5126('0x52')]['id'];}return db[_0x5126('0x47')]['find']({'where':{'id':_0x5c6626[_0x5126('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3394c8,null))[_0x5126('0x27')](saveUpdates(_0x5c6626[_0x5126('0x52')],null))[_0x5126('0x27')](respondWithResult(_0x3394c8,null))[_0x5126('0x4b')](handleError(_0x3394c8,null));};exports['destroy']=function(_0x5d2d11,_0xd9fe66){return db[_0x5126('0x47')][_0x5126('0x50')]({'where':{'id':_0x5d2d11[_0x5126('0x4d')]['id']}})[_0x5126('0x27')](handleEntityNotFound(_0xd9fe66,null))[_0x5126('0x27')](removeEntity(_0xd9fe66,null))[_0x5126('0x4b')](handleError(_0xd9fe66,null));};exports[_0x5126('0x59')]=function(_0x21edd7,_0x59a2fd,_0x1d5706){if(_0x21edd7[_0x5126('0x52')]['id']){delete _0x21edd7[_0x5126('0x52')]['id'];}return db[_0x5126('0x47')][_0x5126('0x50')]({'where':{'id':_0x21edd7[_0x5126('0x4d')]['id']}})[_0x5126('0x27')](handleEntityNotFound(_0x59a2fd,null))[_0x5126('0x27')](function(_0x56fabb){if(_0x56fabb){_0x21edd7[_0x5126('0x52')][_0x5126('0x5a')]=_0x56fabb['id'];return db['Interval'][_0x5126('0x51')](_0x21edd7[_0x5126('0x52')]);}})[_0x5126('0x27')](respondWithResult(_0x59a2fd,null))[_0x5126('0x4b')](handleError(_0x59a2fd,null));};exports[_0x5126('0x5b')]=function(_0x301308,_0x5cdc24,_0x4c0134){var _0x4c36a4={};var _0x2cb7b0={};var _0x4e10fb;var _0x179d55;return db[_0x5126('0x47')]['findOne']({'where':{'id':_0x301308['params']['id']}})[_0x5126('0x27')](handleEntityNotFound(_0x5cdc24,null))[_0x5126('0x27')](function(_0x401a9e){if(_0x401a9e){_0x4e10fb=_0x401a9e;_0x2cb7b0[_0x5126('0x36')]=_['keys'](db['Interval'][_0x5126('0x32')]);_0x2cb7b0[_0x5126('0x37')]=_[_0x5126('0x38')](_0x301308[_0x5126('0x37')]);_0x2cb7b0['filters']=_[_0x5126('0x39')](_0x2cb7b0[_0x5126('0x36')],_0x2cb7b0['query']);_0x4c36a4[_0x5126('0x3a')]=_[_0x5126('0x39')](_0x2cb7b0[_0x5126('0x36')],qs[_0x5126('0x3b')](_0x301308['query'][_0x5126('0x3b')]));_0x4c36a4['attributes']=_0x4c36a4[_0x5126('0x3a')][_0x5126('0x4e')]?_0x4c36a4['attributes']:_0x2cb7b0[_0x5126('0x36')];_0x4c36a4[_0x5126('0x3e')]=qs[_0x5126('0x3f')](_0x301308[_0x5126('0x37')][_0x5126('0x3f')]);_0x4c36a4['where']=qs['filters'](_['pick'](_0x301308[_0x5126('0x37')],_0x2cb7b0[_0x5126('0x41')]));if(_0x301308[_0x5126('0x37')][_0x5126('0x43')]){_0x4c36a4['where']=_[_0x5126('0x44')](_0x4c36a4[_0x5126('0x40')],{'$or':_['map'](_0x4c36a4[_0x5126('0x3a')],function(_0x3300af){var _0x371317={};_0x371317[_0x3300af]={'$like':'%'+_0x301308[_0x5126('0x37')][_0x5126('0x43')]+'%'};return _0x371317;})});}_0x4c36a4=_['merge']({},_0x4c36a4,_0x301308[_0x5126('0x46')]);return _0x4e10fb['getIntervals'](_0x4c36a4);}})[_0x5126('0x27')](function(_0x2501ab){if(_0x2501ab){_0x179d55=_0x2501ab[_0x5126('0x4e')];if(!_0x301308[_0x5126('0x37')][_0x5126('0x3c')](_0x5126('0x3d'))){_0x4c36a4[_0x5126('0x1f')]=qs[_0x5126('0x1f')](_0x301308[_0x5126('0x37')][_0x5126('0x1f')]);_0x4c36a4[_0x5126('0x21')]=qs[_0x5126('0x21')](_0x301308['query'][_0x5126('0x21')]);}return _0x4e10fb['getIntervals'](_0x4c36a4);}})['then'](function(_0xcfa614){if(_0xcfa614){return _0xcfa614?{'count':_0x179d55,'rows':_0xcfa614}:null;}})['then'](respondWithResult(_0x5cdc24,null))[_0x5126('0x4b')](handleError(_0x5cdc24,null));};exports['addIntervals']=function(_0x219f72,_0x3088ba,_0x58e58e){return db['Interval'][_0x5126('0x5c')]({'where':{'id':_0x219f72['params']['id']}})[_0x5126('0x27')](handleEntityNotFound(_0x3088ba,null))[_0x5126('0x27')](function(_0x373fe2){if(_0x373fe2){return db[_0x5126('0x5d')][_0x5126('0x5e')](function(_0x263994){return db['Interval']['destroy']({'where':{'IntervalId':_0x219f72['params']['id']},'transaction':_0x263994})[_0x5126('0x27')](function(_0x1034e3){var _0x53a2e3=_[_0x5126('0x31')](_0x219f72['body'],function(_0x102cf3){delete _0x102cf3['id'];_0x102cf3[_0x5126('0x5a')]=_0x219f72[_0x5126('0x4d')]['id'];return _0x102cf3;});return db[_0x5126('0x47')][_0x5126('0x5f')](_0x53a2e3,{'transaction':_0x263994});});})[_0x5126('0x27')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x219f72[_0x5126('0x4d')]['id']}});});}})[_0x5126('0x27')](respondWithResult(_0x3088ba,null))['catch'](handleError(_0x3088ba,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 208c6ff..110e735 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 _0xe2db=['../../components/extensions/rewrite','exports','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./interval.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe2db,0x149));var _0xbe2d=function(_0x4fc8f1,_0x38256c){_0x4fc8f1=_0x4fc8f1-0x0;var _0x3f9bb8=_0xe2db[_0x4fc8f1];return _0x3f9bb8;};'use strict';var _=require(_0xbe2d('0x0'));var util=require(_0xbe2d('0x1'));var logger=require(_0xbe2d('0x2'))(_0xbe2d('0x3'));var moment=require(_0xbe2d('0x4'));var BPromise=require(_0xbe2d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbe2d('0x6'));var config=require(_0xbe2d('0x7'));var attributes=require(_0xbe2d('0x8'));var extensions=require(_0xbe2d('0x9'));module[_0xbe2d('0xa')]=function(_0x45bc1a,_0x189f5a){return _0x45bc1a['define']('Interval',attributes,{'tableName':_0xbe2d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d7ffb,_0xc9315){extensions[_0xbe2d('0xc')](_0x45bc1a,_0x5d7ffb);},'afterBulkCreate':function(_0x36aa22,_0x218203,_0x42e36c){_0x42e36c();extensions[_0xbe2d('0xc')](_0x45bc1a,_0x36aa22[0x0]);},'afterUpdate':function(_0xb04b66,_0x2f8667){extensions['rewrite'](_0x45bc1a,_0xb04b66);},'afterDestroy':function(_0x1e121c,_0x15742e){extensions[_0xbe2d('0xc')](_0x45bc1a,_0x1e121c);}}});}; \ No newline at end of file +var _0xbb48=['rewrite','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./interval.attributes','exports','define'];(function(_0x2d61ac,_0x18ff36){var _0x3f7d3c=function(_0x2ba7e5){while(--_0x2ba7e5){_0x2d61ac['push'](_0x2d61ac['shift']());}};_0x3f7d3c(++_0x18ff36);}(_0xbb48,0x9b));var _0x8bb4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbb48[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x8bb4('0x0'));var util=require(_0x8bb4('0x1'));var logger=require(_0x8bb4('0x2'))(_0x8bb4('0x3'));var moment=require('moment');var BPromise=require(_0x8bb4('0x4'));var rp=require(_0x8bb4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8bb4('0x6'));var attributes=require(_0x8bb4('0x7'));var extensions=require('../../components/extensions/rewrite');module[_0x8bb4('0x8')]=function(_0x1cbe01,_0x3a8cfa){return _0x1cbe01[_0x8bb4('0x9')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5011a2,_0x555a1c){extensions['rewrite'](_0x1cbe01,_0x5011a2);},'afterBulkCreate':function(_0x30c783,_0xaad904,_0xed2b7e){_0xed2b7e();extensions[_0x8bb4('0xa')](_0x1cbe01,_0x30c783[0x0]);},'afterUpdate':function(_0x4e1ca5,_0x274204){extensions[_0x8bb4('0xa')](_0x1cbe01,_0x4e1ca5);},'afterDestroy':function(_0xbed9c,_0x1e5fc3){extensions[_0x8bb4('0xa')](_0x1cbe01,_0xbed9c);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index a3fc17f..46aece7 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(_0x5805d7,_0x3d584a){var _0x170fe4=function(_0x3b9b73){while(--_0x3b9b73){_0x5805d7['push'](_0x5805d7['shift']());}};_0x170fe4(++_0x3d584a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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(_0x11f0e3,_0x5170bc){var _0x2892e8=function(_0x3292b2){while(--_0x3292b2){_0x11f0e3['push'](_0x11f0e3['shift']());}};_0x2892e8(++_0x5170bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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 1f56d28..735fedb 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 _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x41f5dc,_0xc7b5e2){var _0x307419=function(_0x4aca9d){while(--_0x4aca9d){_0x41f5dc['push'](_0x41f5dc['shift']());}};_0x307419(++_0xc7b5e2);}(_0xdb28,0x106));var _0x8db2=function(_0x4cf84a,_0x646ff4){_0x4cf84a=_0x4cf84a-0x0;var _0x2b66cd=_0xdb28[_0x4cf84a];return _0x2b66cd;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file +var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'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 8965f99..b20dd8d 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 _0xebe9=['utf8','data','end','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','body','headers','x-forwarded-for','connection','remoteAddress','bluebird','https','api','support','MOTGUI','summary','Report','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','request'];(function(_0x462fe4,_0x394d3e){var _0x82b23a=function(_0x2c071f){while(--_0x2c071f){_0x462fe4['push'](_0x462fe4['shift']());}};_0x82b23a(++_0x394d3e);}(_0xebe9,0xdc));var _0x9ebe=function(_0x290eef,_0x4635a3){_0x290eef=_0x290eef-0x0;var _0x21c635=_0xebe9[_0x290eef];return _0x21c635;};'use strict';var BPromise=require(_0x9ebe('0x0'));var https=require(_0x9ebe('0x1'));var logger=require('../../config/logger')(_0x9ebe('0x2'));var USERNAME=_0x9ebe('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x4b8737,_0x1bbef8){var _0x4e95f4={'fields':{'project':{'key':_0x4b8737['key']||_0x9ebe('0x4')},'summary':(_0x4b8737[_0x9ebe('0x5')]||_0x9ebe('0x6'))+'\x20from\x20'+_0x4b8737['ip'],'description':_0x4b8737[_0x9ebe('0x7')]||JSON[_0x9ebe('0x8')](_0x4b8737),'issuetype':{'name':_0x4b8737[_0x9ebe('0x9')]||_0x9ebe('0xa')}}};_0x4e95f4[_0x9ebe('0xb')][_0x9ebe('0xc')]=_0x4b8737[_0x9ebe('0xd')];_0x4e95f4[_0x9ebe('0xb')][_0x9ebe('0xe')]=_0x4b8737[_0x9ebe('0xf')];_0x4e95f4['fields']['customfield_11502']=_0x4b8737[_0x9ebe('0x10')];_0x4e95f4[_0x9ebe('0xb')][_0x9ebe('0x11')]=_0x4b8737['name'];_0x4e95f4[_0x9ebe('0xb')][_0x9ebe('0x12')]=_0x4b8737[_0x9ebe('0x13')];_0x4e95f4[_0x9ebe('0xb')][_0x9ebe('0x14')]=_0x4b8737['ip'];var _0x383e92={'host':_0x9ebe('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x9ebe('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x9ebe('0x17'),'Authorization':_0x9ebe('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x2d3c3e=JSON[_0x9ebe('0x8')](_0x4e95f4);var _0x2d211e=https[_0x9ebe('0x19')](_0x383e92,function(_0x51a2de){_0x51a2de['setEncoding'](_0x9ebe('0x1a'));var _0x20189f='';_0x51a2de['on'](_0x9ebe('0x1b'),function(_0x59f463){_0x20189f+=_0x59f463;});_0x51a2de['on'](_0x9ebe('0x1c'),function(){if(_0x1bbef8){return _0x1bbef8['status'](_0x51a2de[_0x9ebe('0x1d')])[_0x9ebe('0x1e')](JSON[_0x9ebe('0x1f')](_0x20189f));}});});_0x2d211e['on'](_0x9ebe('0x20'),function(_0x530174){if(_0x1bbef8){return _0x1bbef8['status'](0x1f4)['json']({'errors':[{'message':_0x9ebe('0x21'),'type':_0x9ebe('0x22')}]});}});_0x2d211e[_0x9ebe('0x23')](_0x2d3c3e);_0x2d211e[_0x9ebe('0x1c')]();}exports['openIssue']=openIssue;exports['send']=function(_0x2f6c2a,_0x19cbcc){_0x2f6c2a[_0x9ebe('0x24')]['ip']=_0x2f6c2a[_0x9ebe('0x25')][_0x9ebe('0x26')]||_0x2f6c2a[_0x9ebe('0x27')][_0x9ebe('0x28')]||_0x2f6c2a['socket']['remoteAddress']||_0x2f6c2a['connection']['socket'][_0x9ebe('0x28')];return openIssue(_0x2f6c2a[_0x9ebe('0x24')],_0x19cbcc);}; \ No newline at end of file +var _0x0c12=['socket','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','oldToken','newToken','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','request','setEncoding','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','send','x-forwarded-for','connection','remoteAddress'];(function(_0x70246c,_0x3019f3){var _0x1e7061=function(_0x5d1a5f){while(--_0x5d1a5f){_0x70246c['push'](_0x70246c['shift']());}};_0x1e7061(++_0x3019f3);}(_0x0c12,0xc9));var _0x20c1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0c12[_0x57b54c];return _0x59cc19;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require('../../config/logger')(_0x20c1('0x0'));var USERNAME=_0x20c1('0x1');var PASSWORD=_0x20c1('0x2');function openIssue(_0x1fe6aa,_0x220c2b){var _0x4f9e8a={'fields':{'project':{'key':_0x1fe6aa[_0x20c1('0x3')]||_0x20c1('0x4')},'summary':(_0x1fe6aa[_0x20c1('0x5')]||_0x20c1('0x6'))+_0x20c1('0x7')+_0x1fe6aa['ip'],'description':_0x1fe6aa[_0x20c1('0x8')]||JSON[_0x20c1('0x9')](_0x1fe6aa),'issuetype':{'name':_0x1fe6aa[_0x20c1('0xa')]||_0x20c1('0xb')}}};_0x4f9e8a[_0x20c1('0xc')][_0x20c1('0xd')]=_0x1fe6aa['email'];_0x4f9e8a[_0x20c1('0xc')]['customfield_11501']=_0x1fe6aa[_0x20c1('0xe')];_0x4f9e8a[_0x20c1('0xc')]['customfield_11502']=_0x1fe6aa[_0x20c1('0xf')];_0x4f9e8a[_0x20c1('0xc')]['customfield_11503']=_0x1fe6aa[_0x20c1('0x10')];_0x4f9e8a['fields'][_0x20c1('0x11')]=_0x1fe6aa['reason'];_0x4f9e8a[_0x20c1('0xc')][_0x20c1('0x12')]=_0x1fe6aa['ip'];var _0x2730dc={'host':_0x20c1('0x13'),'port':0x1bb,'path':_0x20c1('0x14'),'method':_0x20c1('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x20c1('0x16'),'Authorization':_0x20c1('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x20c1('0x18')]('base64')}};var _0x16978f=JSON[_0x20c1('0x9')](_0x4f9e8a);var _0x1a5afd=https[_0x20c1('0x19')](_0x2730dc,function(_0x1046fc){_0x1046fc[_0x20c1('0x1a')]('utf8');var _0x348fa3='';_0x1046fc['on'](_0x20c1('0x1b'),function(_0x4e7764){_0x348fa3+=_0x4e7764;});_0x1046fc['on'](_0x20c1('0x1c'),function(){if(_0x220c2b){return _0x220c2b[_0x20c1('0x1d')](_0x1046fc[_0x20c1('0x1e')])[_0x20c1('0x1f')](JSON[_0x20c1('0x20')](_0x348fa3));}});});_0x1a5afd['on'](_0x20c1('0x21'),function(_0xc59b6a){if(_0x220c2b){return _0x220c2b[_0x20c1('0x1d')](0x1f4)[_0x20c1('0x1f')]({'errors':[{'message':_0x20c1('0x22'),'type':'api.jira'}]});}});_0x1a5afd['write'](_0x16978f);_0x1a5afd[_0x20c1('0x1c')]();}exports['openIssue']=openIssue;exports[_0x20c1('0x23')]=function(_0x5e74d5,_0x251179){_0x5e74d5['body']['ip']=_0x5e74d5['headers'][_0x20c1('0x24')]||_0x5e74d5[_0x20c1('0x25')][_0x20c1('0x26')]||_0x5e74d5[_0x20c1('0x27')][_0x20c1('0x26')]||_0x5e74d5[_0x20c1('0x25')][_0x20c1('0x27')][_0x20c1('0x26')];return openIssue(_0x5e74d5['body'],_0x251179);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index c95330b..08f97b1 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 _0x41bb=['show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id'];(function(_0x11ac8f,_0x1a010d){var _0x17f138=function(_0x69ec14){while(--_0x69ec14){_0x11ac8f['push'](_0x11ac8f['shift']());}};_0x17f138(++_0x1a010d);}(_0x41bb,0xc5));var _0xb41b=function(_0x3390c4,_0x4a23ca){_0x3390c4=_0x3390c4-0x0;var _0x214582=_0x41bb[_0x3390c4];return _0x214582;};'use strict';var multer=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var path=require('path');var timeout=require(_0xb41b('0x2'));var express=require('express');var router=express[_0xb41b('0x3')]();var fs_extra=require(_0xb41b('0x4'));var auth=require(_0xb41b('0x5'));var interaction=require(_0xb41b('0x6'));var config=require('../../config/environment');var controller=require(_0xb41b('0x7'));router[_0xb41b('0x8')]('/',auth[_0xb41b('0x9')](),controller['index']);router['get']('/describe',auth[_0xb41b('0x9')](),controller[_0xb41b('0xa')]);router['get'](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xc')]);router[_0xb41b('0xd')]('/',auth[_0xb41b('0x9')](),controller[_0xb41b('0xe')]);router[_0xb41b('0xf')]('/:id',auth[_0xb41b('0x9')](),controller['update']);router[_0xb41b('0x10')](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0x11')]);module[_0xb41b('0x12')]=router; \ No newline at end of file +var _0x0a9a=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','destroy','util','connect-timeout','express'];(function(_0x26f4f5,_0x53419e){var _0x91bf0a=function(_0x144da0){while(--_0x144da0){_0x26f4f5['push'](_0x26f4f5['shift']());}};_0x91bf0a(++_0x53419e);}(_0x0a9a,0x183));var _0xa0a9=function(_0x38042c,_0x2d4ad8){_0x38042c=_0x38042c-0x0;var _0x4207f5=_0x0a9a[_0x38042c];return _0x4207f5;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var fs_extra=require(_0xa0a9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0xa0a9('0x7')]('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x9')]);router[_0xa0a9('0x7')]('/describe',auth[_0xa0a9('0x8')](),controller['describe']);router[_0xa0a9('0x7')](_0xa0a9('0xa'),auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xb')]);router['post']('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xc')]);router['put']('/:id',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xd')]);router['delete'](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 98d4fc9..12c537d 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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x1a1225,_0x3333b4){_0x1a1225=_0x1a1225-0x0;var _0x388cbd=_0x7a54[_0x1a1225];return _0x388cbd;};'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(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7a54,0x106));var _0x47a5=function(_0x429d23,_0x217743){_0x429d23=_0x429d23-0x0;var _0xf7d9f=_0x7a54[_0x429d23];return _0xf7d9f;};'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 418a4ef..5e090a1 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 _0x7a08=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service'];(function(_0x321ae5,_0x470a4a){var _0x3140df=function(_0x44052e){while(--_0x44052e){_0x321ae5['push'](_0x321ae5['shift']());}};_0x3140df(++_0x470a4a);}(_0x7a08,0x11e));var _0x87a0=function(_0x14d382,_0x54b6bd){_0x14d382=_0x14d382-0x0;var _0x31c6a7=_0x7a08[_0x14d382];return _0x31c6a7;};'use strict';var emlformat=require(_0x87a0('0x0'));var rimraf=require(_0x87a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x87a0('0x2'));var moment=require(_0x87a0('0x3'));var BPromise=require(_0x87a0('0x4'));var Mustache=require(_0x87a0('0x5'));var util=require(_0x87a0('0x6'));var path=require(_0x87a0('0x7'));var sox=require(_0x87a0('0x8'));var csv=require(_0x87a0('0x9'));var ejs=require(_0x87a0('0xa'));var fs=require('fs');var fs_extra=require(_0x87a0('0xb'));var _=require(_0x87a0('0xc'));var squel=require('squel');var crypto=require(_0x87a0('0xd'));var jsforce=require(_0x87a0('0xe'));var deskjs=require(_0x87a0('0xf'));var toCsv=require(_0x87a0('0x9'));var querystring=require(_0x87a0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x87a0('0x11'));var qs=require(_0x87a0('0x12'));var as=require(_0x87a0('0x13'));var hardwareService=require(_0x87a0('0x14'));var logger=require(_0x87a0('0x15'))('api');var utils=require(_0x87a0('0x16'));var config=require(_0x87a0('0x17'));var licenseUtil=require(_0x87a0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54cdf,_0x2bd845){_0x2bd845=_0x2bd845||0xcc;return function(_0x12e8c7){if(_0x12e8c7){return _0x54cdf[_0x87a0('0x19')](_0x2bd845);}return _0x54cdf['status'](_0x2bd845)[_0x87a0('0x1a')]();};}function respondWithResult(_0x288747,_0x290a29){_0x290a29=_0x290a29||0xc8;return function(_0x583bdd){if(_0x583bdd){return _0x288747[_0x87a0('0x1b')](_0x290a29)[_0x87a0('0x1c')](_0x583bdd);}};}function respondWithFilteredResult(_0x3f69f3,_0x35f9a8){return function(_0x4acba8){if(_0x4acba8){var _0x394291=typeof _0x35f9a8['offset']===_0x87a0('0x1d')&&typeof _0x35f9a8[_0x87a0('0x1e')]===_0x87a0('0x1d');var _0x26a72e=_0x4acba8[_0x87a0('0x1f')];var _0x4f695b=_0x394291?0x0:_0x35f9a8[_0x87a0('0x20')];var _0x57bf72=_0x394291?_0x4acba8['count']:_0x35f9a8[_0x87a0('0x20')]+_0x35f9a8[_0x87a0('0x1e')];var _0x2a42ea;if(_0x57bf72>=_0x26a72e){_0x57bf72=_0x26a72e;_0x2a42ea=0xc8;}else{_0x2a42ea=0xce;}_0x3f69f3['status'](_0x2a42ea);return _0x3f69f3[_0x87a0('0x21')]('Content-Range',_0x4f695b+'-'+_0x57bf72+'/'+_0x26a72e)['json'](_0x4acba8);}return null;};}function patchUpdates(_0x1c3b20){return function(_0x237192){try{jsonpatch[_0x87a0('0x22')](_0x237192,_0x1c3b20,!![]);}catch(_0x390bb2){return BPromise[_0x87a0('0x23')](_0x390bb2);}return _0x237192[_0x87a0('0x24')]();};}function saveUpdates(_0x59e839,_0x25ed19){return function(_0x1f59f7){if(_0x1f59f7){return _0x1f59f7['update'](_0x59e839)[_0x87a0('0x25')](function(_0x1cd50c){return _0x1cd50c;});}return null;};}function removeEntity(_0x48dfe2,_0x373507){return function(_0x4fb8d8){if(_0x4fb8d8){return _0x4fb8d8[_0x87a0('0x26')]()[_0x87a0('0x25')](function(){_0x48dfe2[_0x87a0('0x1b')](0xcc)[_0x87a0('0x1a')]();});}};}function handleEntityNotFound(_0x3bb9c0,_0x3f282d){return function(_0x3ae0c0){if(!_0x3ae0c0){_0x3bb9c0[_0x87a0('0x19')](0x194);}return _0x3ae0c0;};}function handleError(_0xae4ee9,_0x3c0a46){_0x3c0a46=_0x3c0a46||0x1f4;return function(_0x51313f){logger[_0x87a0('0x27')](_0x51313f[_0x87a0('0x28')]);if(_0x51313f[_0x87a0('0x29')]){delete _0x51313f[_0x87a0('0x29')];}_0xae4ee9[_0x87a0('0x1b')](_0x3c0a46)[_0x87a0('0x2a')](_0x51313f);};}exports[_0x87a0('0x2b')]=function(_0x55dbf7,_0x27ce99){var _0x24f8c0={},_0x712a00={},_0x380587={'count':0x0,'rows':[]};var _0x482f6b=_[_0x87a0('0x2c')](db[_0x87a0('0x2d')]['rawAttributes'],function(_0x23f59e){return{'name':_0x23f59e[_0x87a0('0x2e')],'type':_0x23f59e[_0x87a0('0x2f')]['key']};});_0x712a00[_0x87a0('0x30')]=_[_0x87a0('0x2c')](_0x482f6b,_0x87a0('0x29'));_0x712a00[_0x87a0('0x31')]=_[_0x87a0('0x32')](_0x55dbf7['query']);_0x712a00[_0x87a0('0x33')]=_[_0x87a0('0x34')](_0x712a00[_0x87a0('0x30')],_0x712a00[_0x87a0('0x31')]);_0x24f8c0[_0x87a0('0x35')]=_[_0x87a0('0x34')](_0x712a00[_0x87a0('0x30')],qs[_0x87a0('0x36')](_0x55dbf7['query'][_0x87a0('0x36')]));_0x24f8c0[_0x87a0('0x35')]=_0x24f8c0['attributes']['length']?_0x24f8c0['attributes']:_0x712a00[_0x87a0('0x30')];if(!_0x55dbf7[_0x87a0('0x31')]['hasOwnProperty'](_0x87a0('0x37'))){_0x24f8c0[_0x87a0('0x1e')]=qs[_0x87a0('0x1e')](_0x55dbf7[_0x87a0('0x31')][_0x87a0('0x1e')]);_0x24f8c0[_0x87a0('0x20')]=qs[_0x87a0('0x20')](_0x55dbf7[_0x87a0('0x31')][_0x87a0('0x20')]);}_0x24f8c0[_0x87a0('0x38')]=qs[_0x87a0('0x39')](_0x55dbf7['query'][_0x87a0('0x39')]);_0x24f8c0[_0x87a0('0x3a')]=qs[_0x87a0('0x33')](_[_0x87a0('0x3b')](_0x55dbf7[_0x87a0('0x31')],_0x712a00[_0x87a0('0x33')]),_0x482f6b);if(_0x55dbf7[_0x87a0('0x31')][_0x87a0('0x3c')]){_0x24f8c0[_0x87a0('0x3a')]=_[_0x87a0('0x3d')](_0x24f8c0[_0x87a0('0x3a')],{'$or':_[_0x87a0('0x2c')](_0x482f6b,function(_0x1f11d1){if(_0x1f11d1['type']!==_0x87a0('0x3e')){var _0x164e92={};_0x164e92[_0x1f11d1[_0x87a0('0x29')]]={'$like':'%'+_0x55dbf7[_0x87a0('0x31')]['filter']+'%'};return _0x164e92;}})});}_0x24f8c0=_[_0x87a0('0x3d')]({},_0x24f8c0,_0x55dbf7['options']);var _0x2ce7aa={'where':_0x24f8c0['where']};return db['JscriptyAnswerReport'][_0x87a0('0x1f')](_0x2ce7aa)[_0x87a0('0x25')](function(_0x109eb3){_0x380587[_0x87a0('0x1f')]=_0x109eb3;if(_0x55dbf7[_0x87a0('0x31')][_0x87a0('0x3f')]){_0x24f8c0[_0x87a0('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x87a0('0x41')](_0x24f8c0);})[_0x87a0('0x25')](function(_0x4319bd){_0x380587[_0x87a0('0x42')]=_0x4319bd;return _0x380587;})['then'](respondWithFilteredResult(_0x27ce99,_0x24f8c0))[_0x87a0('0x43')](handleError(_0x27ce99,null));};exports[_0x87a0('0x44')]=function(_0x2c280d,_0x1c73ac){var _0x5a942a={'raw':!![],'where':{'id':_0x2c280d[_0x87a0('0x45')]['id']}},_0xbac9={};_0xbac9[_0x87a0('0x30')]=_[_0x87a0('0x32')](db[_0x87a0('0x2d')][_0x87a0('0x46')]);_0xbac9['query']=_[_0x87a0('0x32')](_0x2c280d[_0x87a0('0x31')]);_0xbac9[_0x87a0('0x33')]=_[_0x87a0('0x34')](_0xbac9['model'],_0xbac9[_0x87a0('0x31')]);_0x5a942a['attributes']=_[_0x87a0('0x34')](_0xbac9['model'],qs['fields'](_0x2c280d[_0x87a0('0x31')]['fields']));_0x5a942a[_0x87a0('0x35')]=_0x5a942a[_0x87a0('0x35')][_0x87a0('0x47')]?_0x5a942a['attributes']:_0xbac9['model'];if(_0x2c280d[_0x87a0('0x31')][_0x87a0('0x3f')]){_0x5a942a[_0x87a0('0x40')]=[{'all':!![]}];}_0x5a942a=_['merge']({},_0x5a942a,_0x2c280d['options']);return db['JscriptyAnswerReport'][_0x87a0('0x48')](_0x5a942a)[_0x87a0('0x25')](handleEntityNotFound(_0x1c73ac,null))[_0x87a0('0x25')](respondWithResult(_0x1c73ac,null))[_0x87a0('0x43')](handleError(_0x1c73ac,null));};exports[_0x87a0('0x49')]=function(_0x232c00,_0x26c0b8){return db[_0x87a0('0x2d')][_0x87a0('0x49')](_0x232c00[_0x87a0('0x4a')],{})[_0x87a0('0x25')](respondWithResult(_0x26c0b8,0xc9))[_0x87a0('0x43')](handleError(_0x26c0b8,null));};exports['update']=function(_0x3e5c65,_0x1f236e){if(_0x3e5c65[_0x87a0('0x4a')]['id']){delete _0x3e5c65['body']['id'];}return db[_0x87a0('0x2d')][_0x87a0('0x48')]({'where':{'id':_0x3e5c65[_0x87a0('0x45')]['id']}})[_0x87a0('0x25')](handleEntityNotFound(_0x1f236e,null))[_0x87a0('0x25')](saveUpdates(_0x3e5c65['body'],null))[_0x87a0('0x25')](respondWithResult(_0x1f236e,null))[_0x87a0('0x43')](handleError(_0x1f236e,null));};exports['destroy']=function(_0x4a144f,_0xa90662){return db[_0x87a0('0x2d')][_0x87a0('0x48')]({'where':{'id':_0x4a144f['params']['id']}})[_0x87a0('0x25')](handleEntityNotFound(_0xa90662,null))[_0x87a0('0x25')](removeEntity(_0xa90662,null))[_0x87a0('0x43')](handleError(_0xa90662,null));};exports[_0x87a0('0x4b')]=function(_0x3ad13b,_0x13bfdb){return db[_0x87a0('0x2d')][_0x87a0('0x4b')]()[_0x87a0('0x25')](respondWithResult(_0x13bfdb,null))['catch'](handleError(_0x13bfdb,null));}; \ No newline at end of file +var _0x0763=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','JscriptyAnswerReport','rawAttributes','fieldName','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0763,0x87));var _0x3076=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0x0763[_0x2d4421];return _0x2d3b01;};'use strict';var emlformat=require(_0x3076('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3076('0x1'));var jsonpatch=require(_0x3076('0x2'));var rp=require('request-promise');var moment=require(_0x3076('0x3'));var BPromise=require(_0x3076('0x4'));var Mustache=require(_0x3076('0x5'));var util=require(_0x3076('0x6'));var path=require('path');var sox=require(_0x3076('0x7'));var csv=require(_0x3076('0x8'));var ejs=require(_0x3076('0x9'));var fs=require('fs');var fs_extra=require(_0x3076('0xa'));var _=require(_0x3076('0xb'));var squel=require(_0x3076('0xc'));var crypto=require(_0x3076('0xd'));var jsforce=require(_0x3076('0xe'));var deskjs=require(_0x3076('0xf'));var toCsv=require(_0x3076('0x8'));var querystring=require('querystring');var Papa=require(_0x3076('0x10'));var Redis=require(_0x3076('0x11'));var authService=require(_0x3076('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3076('0x13'));var logger=require(_0x3076('0x14'))(_0x3076('0x15'));var utils=require(_0x3076('0x16'));var config=require(_0x3076('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3076('0x18'))['db'];function respondWithStatusCode(_0x209fc0,_0x2fe9d1){_0x2fe9d1=_0x2fe9d1||0xcc;return function(_0xc917fd){if(_0xc917fd){return _0x209fc0[_0x3076('0x19')](_0x2fe9d1);}return _0x209fc0[_0x3076('0x1a')](_0x2fe9d1)[_0x3076('0x1b')]();};}function respondWithResult(_0x3a6f74,_0x54ff6a){_0x54ff6a=_0x54ff6a||0xc8;return function(_0x5542c7){if(_0x5542c7){return _0x3a6f74[_0x3076('0x1a')](_0x54ff6a)[_0x3076('0x1c')](_0x5542c7);}};}function respondWithFilteredResult(_0x3bc84d,_0x1b2256){return function(_0x5a2088){if(_0x5a2088){var _0x5bf9ec=typeof _0x1b2256[_0x3076('0x1d')]===_0x3076('0x1e')&&typeof _0x1b2256[_0x3076('0x1f')]===_0x3076('0x1e');var _0x3d56fe=_0x5a2088[_0x3076('0x20')];var _0x21c242=_0x5bf9ec?0x0:_0x1b2256[_0x3076('0x1d')];var _0x1880b8=_0x5bf9ec?_0x5a2088[_0x3076('0x20')]:_0x1b2256[_0x3076('0x1d')]+_0x1b2256[_0x3076('0x1f')];var _0x4e441d;if(_0x1880b8>=_0x3d56fe){_0x1880b8=_0x3d56fe;_0x4e441d=0xc8;}else{_0x4e441d=0xce;}_0x3bc84d[_0x3076('0x1a')](_0x4e441d);return _0x3bc84d[_0x3076('0x21')]('Content-Range',_0x21c242+'-'+_0x1880b8+'/'+_0x3d56fe)[_0x3076('0x1c')](_0x5a2088);}return null;};}function patchUpdates(_0x50f366){return function(_0x34c831){try{jsonpatch[_0x3076('0x22')](_0x34c831,_0x50f366,!![]);}catch(_0x1f8914){return BPromise['reject'](_0x1f8914);}return _0x34c831[_0x3076('0x23')]();};}function saveUpdates(_0x250cc4,_0x2398f4){return function(_0x9b4bec){if(_0x9b4bec){return _0x9b4bec[_0x3076('0x24')](_0x250cc4)[_0x3076('0x25')](function(_0x1a2131){return _0x1a2131;});}return null;};}function removeEntity(_0xa975bc,_0x195606){return function(_0x39a33c){if(_0x39a33c){return _0x39a33c['destroy']()[_0x3076('0x25')](function(){_0xa975bc['status'](0xcc)[_0x3076('0x1b')]();});}};}function handleEntityNotFound(_0x4f4bdc,_0x53b45d){return function(_0x41ecf4){if(!_0x41ecf4){_0x4f4bdc[_0x3076('0x19')](0x194);}return _0x41ecf4;};}function handleError(_0x2f0848,_0x1b169b){_0x1b169b=_0x1b169b||0x1f4;return function(_0x28d834){logger[_0x3076('0x26')](_0x28d834[_0x3076('0x27')]);if(_0x28d834[_0x3076('0x28')]){delete _0x28d834[_0x3076('0x28')];}_0x2f0848[_0x3076('0x1a')](_0x1b169b)[_0x3076('0x29')](_0x28d834);};}exports['index']=function(_0x181591,_0x45805e){var _0x32bdbd={},_0x5af88e={},_0x330365={'count':0x0,'rows':[]};var _0x332a3b=_['map'](db[_0x3076('0x2a')][_0x3076('0x2b')],function(_0x5480eb){return{'name':_0x5480eb[_0x3076('0x2c')],'type':_0x5480eb['type']['key']};});_0x5af88e[_0x3076('0x2d')]=_[_0x3076('0x2e')](_0x332a3b,_0x3076('0x28'));_0x5af88e['query']=_[_0x3076('0x2f')](_0x181591[_0x3076('0x30')]);_0x5af88e[_0x3076('0x31')]=_[_0x3076('0x32')](_0x5af88e['model'],_0x5af88e[_0x3076('0x30')]);_0x32bdbd[_0x3076('0x33')]=_[_0x3076('0x32')](_0x5af88e[_0x3076('0x2d')],qs[_0x3076('0x34')](_0x181591['query'][_0x3076('0x34')]));_0x32bdbd[_0x3076('0x33')]=_0x32bdbd[_0x3076('0x33')][_0x3076('0x35')]?_0x32bdbd[_0x3076('0x33')]:_0x5af88e[_0x3076('0x2d')];if(!_0x181591['query'][_0x3076('0x36')]('nolimit')){_0x32bdbd[_0x3076('0x1f')]=qs[_0x3076('0x1f')](_0x181591[_0x3076('0x30')][_0x3076('0x1f')]);_0x32bdbd[_0x3076('0x1d')]=qs[_0x3076('0x1d')](_0x181591[_0x3076('0x30')][_0x3076('0x1d')]);}_0x32bdbd[_0x3076('0x37')]=qs[_0x3076('0x38')](_0x181591[_0x3076('0x30')][_0x3076('0x38')]);_0x32bdbd[_0x3076('0x39')]=qs[_0x3076('0x31')](_[_0x3076('0x3a')](_0x181591[_0x3076('0x30')],_0x5af88e[_0x3076('0x31')]),_0x332a3b);if(_0x181591[_0x3076('0x30')][_0x3076('0x3b')]){_0x32bdbd[_0x3076('0x39')]=_[_0x3076('0x3c')](_0x32bdbd[_0x3076('0x39')],{'$or':_[_0x3076('0x2e')](_0x332a3b,function(_0x852954){if(_0x852954[_0x3076('0x3d')]!==_0x3076('0x3e')){var _0x45ac78={};_0x45ac78[_0x852954['name']]={'$like':'%'+_0x181591[_0x3076('0x30')][_0x3076('0x3b')]+'%'};return _0x45ac78;}})});}_0x32bdbd=_[_0x3076('0x3c')]({},_0x32bdbd,_0x181591[_0x3076('0x3f')]);var _0x5b794a={'where':_0x32bdbd[_0x3076('0x39')]};return db[_0x3076('0x2a')][_0x3076('0x20')](_0x5b794a)[_0x3076('0x25')](function(_0x1d400c){_0x330365['count']=_0x1d400c;if(_0x181591[_0x3076('0x30')][_0x3076('0x40')]){_0x32bdbd[_0x3076('0x41')]=[{'all':!![]}];}return db[_0x3076('0x2a')]['findAll'](_0x32bdbd);})[_0x3076('0x25')](function(_0x526ad1){_0x330365[_0x3076('0x42')]=_0x526ad1;return _0x330365;})[_0x3076('0x25')](respondWithFilteredResult(_0x45805e,_0x32bdbd))[_0x3076('0x43')](handleError(_0x45805e,null));};exports[_0x3076('0x44')]=function(_0x3475f7,_0x2f4479){var _0x5b6d81={'raw':!![],'where':{'id':_0x3475f7[_0x3076('0x45')]['id']}},_0x5e0820={};_0x5e0820[_0x3076('0x2d')]=_['keys'](db['JscriptyAnswerReport'][_0x3076('0x2b')]);_0x5e0820[_0x3076('0x30')]=_[_0x3076('0x2f')](_0x3475f7[_0x3076('0x30')]);_0x5e0820['filters']=_[_0x3076('0x32')](_0x5e0820[_0x3076('0x2d')],_0x5e0820[_0x3076('0x30')]);_0x5b6d81['attributes']=_[_0x3076('0x32')](_0x5e0820[_0x3076('0x2d')],qs['fields'](_0x3475f7['query']['fields']));_0x5b6d81['attributes']=_0x5b6d81[_0x3076('0x33')]['length']?_0x5b6d81[_0x3076('0x33')]:_0x5e0820['model'];if(_0x3475f7['query'][_0x3076('0x40')]){_0x5b6d81[_0x3076('0x41')]=[{'all':!![]}];}_0x5b6d81=_[_0x3076('0x3c')]({},_0x5b6d81,_0x3475f7[_0x3076('0x3f')]);return db[_0x3076('0x2a')][_0x3076('0x46')](_0x5b6d81)[_0x3076('0x25')](handleEntityNotFound(_0x2f4479,null))[_0x3076('0x25')](respondWithResult(_0x2f4479,null))[_0x3076('0x43')](handleError(_0x2f4479,null));};exports[_0x3076('0x47')]=function(_0x36970c,_0x46fdf0){return db['JscriptyAnswerReport'][_0x3076('0x47')](_0x36970c['body'],{})[_0x3076('0x25')](respondWithResult(_0x46fdf0,0xc9))[_0x3076('0x43')](handleError(_0x46fdf0,null));};exports['update']=function(_0x5a7b95,_0x431a9e){if(_0x5a7b95[_0x3076('0x48')]['id']){delete _0x5a7b95[_0x3076('0x48')]['id'];}return db[_0x3076('0x2a')]['find']({'where':{'id':_0x5a7b95[_0x3076('0x45')]['id']}})[_0x3076('0x25')](handleEntityNotFound(_0x431a9e,null))['then'](saveUpdates(_0x5a7b95[_0x3076('0x48')],null))['then'](respondWithResult(_0x431a9e,null))['catch'](handleError(_0x431a9e,null));};exports[_0x3076('0x49')]=function(_0x6e5a16,_0x1c985d){return db[_0x3076('0x2a')][_0x3076('0x46')]({'where':{'id':_0x6e5a16[_0x3076('0x45')]['id']}})[_0x3076('0x25')](handleEntityNotFound(_0x1c985d,null))['then'](removeEntity(_0x1c985d,null))[_0x3076('0x43')](handleError(_0x1c985d,null));};exports['describe']=function(_0xa0e598,_0x382dd0){return db['JscriptyAnswerReport']['describe']()['then'](respondWithResult(_0x382dd0,null))[_0x3076('0x43')](handleError(_0x382dd0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 51b17fa..9f649ef 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 _0xb773=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport'];(function(_0xab7bfa,_0x4c7410){var _0x3af2d5=function(_0x5da84a){while(--_0x5da84a){_0xab7bfa['push'](_0xab7bfa['shift']());}};_0x3af2d5(++_0x4c7410);}(_0xb773,0x186));var _0x3b77=function(_0x4d4a74,_0x344a11){_0x4d4a74=_0x4d4a74-0x0;var _0x5491d8=_0xb773[_0x4d4a74];return _0x5491d8;};'use strict';var _=require(_0x3b77('0x0'));var util=require(_0x3b77('0x1'));var logger=require(_0x3b77('0x2'))('api');var moment=require(_0x3b77('0x3'));var BPromise=require(_0x3b77('0x4'));var rp=require(_0x3b77('0x5'));var fs=require('fs');var path=require(_0x3b77('0x6'));var rimraf=require(_0x3b77('0x7'));var config=require(_0x3b77('0x8'));var attributes=require(_0x3b77('0x9'));module[_0x3b77('0xa')]=function(_0xe4ae7b,_0x168283){return _0xe4ae7b[_0x3b77('0xb')](_0x3b77('0xc'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe544=['path','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0xb405ce,_0xfa2ec3){var _0x34097c=function(_0x383ab7){while(--_0x383ab7){_0xb405ce['push'](_0xb405ce['shift']());}};_0x34097c(++_0xfa2ec3);}(_0xe544,0xcb));var _0x4e54=function(_0x5986e0,_0x354432){_0x5986e0=_0x5986e0-0x0;var _0x161284=_0xe544[_0x5986e0];return _0x161284;};'use strict';var _=require(_0x4e54('0x0'));var util=require('util');var logger=require(_0x4e54('0x1'))('api');var moment=require(_0x4e54('0x2'));var BPromise=require(_0x4e54('0x3'));var rp=require(_0x4e54('0x4'));var fs=require('fs');var path=require(_0x4e54('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x204fdb,_0x26c88c){return _0x204fdb['define'](_0x4e54('0x6'),attributes,{'tableName':_0x4e54('0x7'),'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 f3df4dc..8335131 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 _0x8f96=['code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','then','info','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x53814c,_0x25a944){var _0x1be846=function(_0x357c9f){while(--_0x357c9f){_0x53814c['push'](_0x53814c['shift']());}};_0x1be846(++_0x25a944);}(_0x8f96,0x1a3));var _0x68f9=function(_0x56f0e0,_0x22803a){_0x56f0e0=_0x56f0e0-0x0;var _0x4ef3e1=_0x8f96[_0x56f0e0];return _0x4ef3e1;};'use strict';var _=require(_0x68f9('0x0'));var util=require(_0x68f9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x68f9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68f9('0x3'))['db'];var utils=require(_0x68f9('0x4'));var logger=require('../../config/logger')(_0x68f9('0x5'));var config=require('../../config/environment');var jayson=require(_0x68f9('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49c280,_0x1e0b31,_0x139021){return new BPromise(function(_0x3fc26c,_0x558ae4){return client['request'](_0x49c280,_0x139021)[_0x68f9('0x7')](function(_0x1e566f){logger[_0x68f9('0x8')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1e0b31,'request\x20sent');logger['debug'](_0x68f9('0x9'),_0x1e0b31,_0x68f9('0xa'),JSON[_0x68f9('0xb')](_0x1e566f));if(_0x1e566f[_0x68f9('0xc')]){if(_0x1e566f[_0x68f9('0xc')][_0x68f9('0xd')]===0x1f4){logger['error'](_0x68f9('0xe'),_0x1e0b31,_0x1e566f[_0x68f9('0xc')][_0x68f9('0xf')]);return _0x558ae4(_0x1e566f[_0x68f9('0xc')][_0x68f9('0xf')]);}logger[_0x68f9('0xc')](_0x68f9('0xe'),_0x1e0b31,_0x1e566f[_0x68f9('0xc')][_0x68f9('0xf')]);return _0x3fc26c(_0x1e566f[_0x68f9('0xc')][_0x68f9('0xf')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x1e0b31,_0x68f9('0xa'));_0x3fc26c(_0x1e566f[_0x68f9('0x10')][_0x68f9('0xf')]);}})[_0x68f9('0x11')](function(_0x8553ed){logger['error'](_0x68f9('0xe'),_0x1e0b31,_0x8553ed);_0x558ae4(_0x8553ed);});});} \ No newline at end of file +var _0x7a52=['request\x20sent','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x47f719,_0x2e559d){var _0x407f4e=function(_0x2be03a){while(--_0x2be03a){_0x47f719['push'](_0x47f719['shift']());}};_0x407f4e(++_0x2e559d);}(_0x7a52,0x1bd));var _0x27a5=function(_0x44772d,_0x640e50){_0x44772d=_0x44772d-0x0;var _0x482a5f=_0x7a52[_0x44772d];return _0x482a5f;};'use strict';var _=require(_0x27a5('0x0'));var util=require('util');var moment=require(_0x27a5('0x1'));var BPromise=require(_0x27a5('0x2'));var rs=require(_0x27a5('0x3'));var fs=require('fs');var Redis=require(_0x27a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x27a5('0x5'));var logger=require(_0x27a5('0x6'))(_0x27a5('0x7'));var config=require(_0x27a5('0x8'));var jayson=require(_0x27a5('0x9'));var client=jayson[_0x27a5('0xa')][_0x27a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x568bbe,_0x26ddd,_0x2c49fe){return new BPromise(function(_0x4b6ef0,_0x47ab24){return client[_0x27a5('0xc')](_0x568bbe,_0x2c49fe)['then'](function(_0x2e1fe4){logger[_0x27a5('0xd')](_0x27a5('0xe'),_0x26ddd,'request\x20sent');logger[_0x27a5('0xf')](_0x27a5('0x10'),_0x26ddd,_0x27a5('0x11'),JSON['stringify'](_0x2e1fe4));if(_0x2e1fe4['error']){if(_0x2e1fe4[_0x27a5('0x12')]['code']===0x1f4){logger['error'](_0x27a5('0xe'),_0x26ddd,_0x2e1fe4[_0x27a5('0x12')][_0x27a5('0x13')]);return _0x47ab24(_0x2e1fe4[_0x27a5('0x12')][_0x27a5('0x13')]);}logger[_0x27a5('0x12')](_0x27a5('0xe'),_0x26ddd,_0x2e1fe4['error'][_0x27a5('0x13')]);return _0x4b6ef0(_0x2e1fe4[_0x27a5('0x12')][_0x27a5('0x13')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x26ddd,_0x27a5('0x11'));_0x4b6ef0(_0x2e1fe4[_0x27a5('0x14')][_0x27a5('0x13')]);}})[_0x27a5('0x15')](function(_0x398354){logger[_0x27a5('0x12')](_0x27a5('0xe'),_0x26ddd,_0x398354);_0x47ab24(_0x398354);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index ccdf63b..1d86904 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 _0xe089=['isAuthenticated','index','getSessions','/:id/answers','getAnswers','getSummary','post','/:id/clone','clone','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get'];(function(_0x42f9ef,_0x52c879){var _0x39d5d9=function(_0x34a1f9){while(--_0x34a1f9){_0x42f9ef['push'](_0x42f9ef['shift']());}};_0x39d5d9(++_0x52c879);}(_0xe089,0xae));var _0x9e08=function(_0x33d12f,_0x10183e){_0x33d12f=_0x33d12f-0x0;var _0x251ee0=_0xe089[_0x33d12f];return _0x251ee0;};'use strict';var multer=require(_0x9e08('0x0'));var util=require(_0x9e08('0x1'));var path=require(_0x9e08('0x2'));var timeout=require(_0x9e08('0x3'));var express=require('express');var router=express[_0x9e08('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9e08('0x5'));var interaction=require(_0x9e08('0x6'));var config=require(_0x9e08('0x7'));var controller=require(_0x9e08('0x8'));router[_0x9e08('0x9')]('/',auth[_0x9e08('0xa')](),controller[_0x9e08('0xb')]);router[_0x9e08('0x9')]('/:id',auth[_0x9e08('0xa')](),controller['show']);router['get']('/:id/sessions',auth[_0x9e08('0xa')](),controller[_0x9e08('0xc')]);router['get'](_0x9e08('0xd'),auth['isAuthenticated'](),controller[_0x9e08('0xe')]);router[_0x9e08('0x9')]('/:id/summary',auth[_0x9e08('0xa')](),timeout('30s'),controller[_0x9e08('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9e08('0x10')](_0x9e08('0x11'),auth[_0x9e08('0xa')](),controller[_0x9e08('0x12')]);router[_0x9e08('0x13')]('/:id',auth[_0x9e08('0xa')](),controller['update']);router[_0x9e08('0x14')]('/:id',auth[_0x9e08('0xa')](),controller[_0x9e08('0x15')]);module[_0x9e08('0x16')]=router; \ No newline at end of file +var _0x74ae=['/:id/summary','30s','post','create','/:id/clone','clone','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74ae,0x118));var _0xe74a=function(_0x13e360,_0x287387){_0x13e360=_0x13e360-0x0;var _0x1674f4=_0x74ae[_0x13e360];return _0x1674f4;};'use strict';var multer=require(_0xe74a('0x0'));var util=require(_0xe74a('0x1'));var path=require(_0xe74a('0x2'));var timeout=require('connect-timeout');var express=require(_0xe74a('0x3'));var router=express[_0xe74a('0x4')]();var fs_extra=require(_0xe74a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe74a('0x6'));var config=require(_0xe74a('0x7'));var controller=require(_0xe74a('0x8'));router[_0xe74a('0x9')]('/',auth[_0xe74a('0xa')](),controller[_0xe74a('0xb')]);router[_0xe74a('0x9')](_0xe74a('0xc'),auth[_0xe74a('0xa')](),controller[_0xe74a('0xd')]);router[_0xe74a('0x9')]('/:id/sessions',auth[_0xe74a('0xa')](),controller[_0xe74a('0xe')]);router[_0xe74a('0x9')](_0xe74a('0xf'),auth['isAuthenticated'](),controller[_0xe74a('0x10')]);router[_0xe74a('0x9')](_0xe74a('0x11'),auth[_0xe74a('0xa')](),timeout(_0xe74a('0x12')),controller['getSummary']);router[_0xe74a('0x13')]('/',auth[_0xe74a('0xa')](),controller[_0xe74a('0x14')]);router[_0xe74a('0x13')](_0xe74a('0x15'),auth[_0xe74a('0xa')](),controller[_0xe74a('0x16')]);router[_0xe74a('0x17')]('/:id',auth[_0xe74a('0xa')](),controller[_0xe74a('0x18')]);router[_0xe74a('0x19')](_0xe74a('0xc'),auth[_0xe74a('0xa')](),controller[_0xe74a('0x1a')]);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 78f83ad..aa6e3a4 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 _0x0ae7=['isObjectLike','formData','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','BOOLEAN','sequelize','lodash','exports','STRING','TEXT'];(function(_0x2cbadc,_0x84c74f){var _0x544ef6=function(_0x8deed1){while(--_0x8deed1){_0x2cbadc['push'](_0x2cbadc['shift']());}};_0x544ef6(++_0x84c74f);}(_0x0ae7,0xbf));var _0x70ae=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x0ae7[_0x4bb66f];return _0xf2772f;};'use strict';var Sequelize=require(_0x70ae('0x0'));var _=require(_0x70ae('0x1'));var util=require('util');module[_0x70ae('0x2')]={'name':{'type':Sequelize[_0x70ae('0x3')],'unique':'name'},'description':{'type':Sequelize[_0x70ae('0x3')]},'formData':{'type':Sequelize[_0x70ae('0x4')]('long'),'set':function(_0x29b880){if(_[_0x70ae('0x5')](_0x29b880)){this['setDataValue'](_0x70ae('0x6'),JSON['stringify'](_0x29b880));}else if(_[_0x70ae('0x7')](_0x29b880)){this[_0x70ae('0x8')]('formData',_0x29b880);}else{this[_0x70ae('0x8')](_0x70ae('0x6'),util[_0x70ae('0x9')](_0x70ae('0xa'),this[_0x70ae('0xb')](_0x70ae('0xc'))||'',this[_0x70ae('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x70ae('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x70ae('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0xf7c4=['exports','name','STRING','isObjectLike','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','util'];(function(_0x455cd3,_0x12bf3f){var _0x1aaaff=function(_0x39b92b){while(--_0x39b92b){_0x455cd3['push'](_0x455cd3['shift']());}};_0x1aaaff(++_0x12bf3f);}(_0xf7c4,0x124));var _0x4f7c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf7c4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4f7c('0x0'));var _=require('lodash');var util=require(_0x4f7c('0x1'));module[_0x4f7c('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x4f7c('0x3')},'description':{'type':Sequelize[_0x4f7c('0x4')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x4960c2){if(_[_0x4f7c('0x5')](_0x4960c2)){this[_0x4f7c('0x6')](_0x4f7c('0x7'),JSON[_0x4f7c('0x8')](_0x4960c2));}else if(_['isString'](_0x4960c2)){this[_0x4f7c('0x6')](_0x4f7c('0x7'),_0x4960c2);}else{this['setDataValue'](_0x4f7c('0x7'),util[_0x4f7c('0x9')](_0x4f7c('0xa'),this[_0x4f7c('0xb')](_0x4f7c('0x3'))||'',this['getDataValue'](_0x4f7c('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x4f7c('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 9685a60..2076bc6 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 _0x3166=['length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','JscriptyProject','catch','show','params','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','include','createdAt','body','omit','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','JscriptySessionReport','ProjectId','getAnswers','findOne','JscriptyAnswerReport','findAll','rows','number','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x3166,0xbb));var _0x6316=function(_0x3f4f15,_0x48b3c1){_0x3f4f15=_0x3f4f15-0x0;var _0xc83967=_0x3166[_0x3f4f15];return _0xc83967;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6316('0x0'));var zipdir=require(_0x6316('0x1'));var jsonpatch=require(_0x6316('0x2'));var rp=require('request-promise');var moment=require(_0x6316('0x3'));var BPromise=require(_0x6316('0x4'));var Mustache=require('mustache');var util=require(_0x6316('0x5'));var path=require(_0x6316('0x6'));var sox=require('sox');var csv=require(_0x6316('0x7'));var ejs=require(_0x6316('0x8'));var fs=require('fs');var fs_extra=require(_0x6316('0x9'));var _=require(_0x6316('0xa'));var squel=require('squel');var crypto=require(_0x6316('0xb'));var jsforce=require(_0x6316('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6316('0x7'));var querystring=require(_0x6316('0xd'));var Papa=require(_0x6316('0xe'));var Redis=require(_0x6316('0xf'));var authService=require(_0x6316('0x10'));var qs=require(_0x6316('0x11'));var as=require(_0x6316('0x12'));var hardwareService=require(_0x6316('0x13'));var logger=require(_0x6316('0x14'))(_0x6316('0x15'));var utils=require(_0x6316('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6316('0x17'));var db=require(_0x6316('0x18'))['db'];function respondWithStatusCode(_0x1a1c46,_0x34898b){_0x34898b=_0x34898b||0xcc;return function(_0x468c19){if(_0x468c19){return _0x1a1c46[_0x6316('0x19')](_0x34898b);}return _0x1a1c46['status'](_0x34898b)[_0x6316('0x1a')]();};}function respondWithResult(_0x6261d5,_0x15b8bb){_0x15b8bb=_0x15b8bb||0xc8;return function(_0xcba5ff){if(_0xcba5ff){return _0x6261d5['status'](_0x15b8bb)[_0x6316('0x1b')](_0xcba5ff);}};}function respondWithFilteredResult(_0x46022e,_0x2e1d48){return function(_0x493139){if(_0x493139){var _0x22348f=typeof _0x2e1d48[_0x6316('0x1c')]==='undefined'&&typeof _0x2e1d48[_0x6316('0x1d')]===_0x6316('0x1e');var _0x3f9e07=_0x493139[_0x6316('0x1f')];var _0x569db2=_0x22348f?0x0:_0x2e1d48['offset'];var _0x2eecb9=_0x22348f?_0x493139[_0x6316('0x1f')]:_0x2e1d48[_0x6316('0x1c')]+_0x2e1d48[_0x6316('0x1d')];var _0x22cd6e;if(_0x2eecb9>=_0x3f9e07){_0x2eecb9=_0x3f9e07;_0x22cd6e=0xc8;}else{_0x22cd6e=0xce;}_0x46022e[_0x6316('0x20')](_0x22cd6e);return _0x46022e[_0x6316('0x21')](_0x6316('0x22'),_0x569db2+'-'+_0x2eecb9+'/'+_0x3f9e07)[_0x6316('0x1b')](_0x493139);}return null;};}function patchUpdates(_0x3e4543){return function(_0x36db62){try{jsonpatch['apply'](_0x36db62,_0x3e4543,!![]);}catch(_0x1ed2d2){return BPromise[_0x6316('0x23')](_0x1ed2d2);}return _0x36db62[_0x6316('0x24')]();};}function saveUpdates(_0x156065,_0x3cfc43){return function(_0x236256){if(_0x236256){return _0x236256[_0x6316('0x25')](_0x156065)[_0x6316('0x26')](function(_0x59000b){return _0x59000b;});}return null;};}function removeEntity(_0x4063e3,_0x46e2c1){return function(_0x3206ef){if(_0x3206ef){return _0x3206ef[_0x6316('0x27')]()['then'](function(){var _0x434706=_0x3206ef[_0x6316('0x28')]({'plain':!![]});var _0x11a2b1='Projects';return db[_0x6316('0x29')][_0x6316('0x27')]({'where':{'type':_0x11a2b1,'resourceId':_0x434706['id']}})[_0x6316('0x26')](function(){return _0x3206ef;});})[_0x6316('0x26')](function(){_0x4063e3[_0x6316('0x20')](0xcc)[_0x6316('0x1a')]();});}};}function handleEntityNotFound(_0x39dd2d,_0x40b04f){return function(_0xed60e){if(!_0xed60e){_0x39dd2d['sendStatus'](0x194);}return _0xed60e;};}function handleError(_0x7315dc,_0x6fc86a){_0x6fc86a=_0x6fc86a||0x1f4;return function(_0x546eae){logger[_0x6316('0x2a')](_0x546eae['stack']);if(_0x546eae[_0x6316('0x2b')]){delete _0x546eae[_0x6316('0x2b')];}_0x7315dc['status'](_0x6fc86a)['send'](_0x546eae);};}exports[_0x6316('0x2c')]=function(_0x4f97fc,_0x528f8d){var _0x48d6f6={},_0x5616e2={},_0x14f449={'count':0x0,'rows':[]};var _0x1adbce=_[_0x6316('0x2d')](db['JscriptyProject'][_0x6316('0x2e')],function(_0x459c66){return{'name':_0x459c66[_0x6316('0x2f')],'type':_0x459c66[_0x6316('0x30')][_0x6316('0x31')]};});_0x5616e2[_0x6316('0x32')]=_[_0x6316('0x2d')](_0x1adbce,_0x6316('0x2b'));_0x5616e2['query']=_[_0x6316('0x33')](_0x4f97fc[_0x6316('0x34')]);_0x5616e2[_0x6316('0x35')]=_[_0x6316('0x36')](_0x5616e2[_0x6316('0x32')],_0x5616e2['query']);_0x48d6f6[_0x6316('0x37')]=_[_0x6316('0x36')](_0x5616e2['model'],qs[_0x6316('0x38')](_0x4f97fc[_0x6316('0x34')][_0x6316('0x38')]));_0x48d6f6[_0x6316('0x37')]=_0x48d6f6['attributes'][_0x6316('0x39')]?_0x48d6f6[_0x6316('0x37')]:_0x5616e2['model'];if(!_0x4f97fc[_0x6316('0x34')][_0x6316('0x3a')](_0x6316('0x3b'))){_0x48d6f6[_0x6316('0x1d')]=qs[_0x6316('0x1d')](_0x4f97fc[_0x6316('0x34')][_0x6316('0x1d')]);_0x48d6f6['offset']=qs[_0x6316('0x1c')](_0x4f97fc[_0x6316('0x34')][_0x6316('0x1c')]);}_0x48d6f6[_0x6316('0x3c')]=qs[_0x6316('0x3d')](_0x4f97fc['query'][_0x6316('0x3d')]);_0x48d6f6[_0x6316('0x3e')]=qs[_0x6316('0x35')](_[_0x6316('0x3f')](_0x4f97fc[_0x6316('0x34')],_0x5616e2['filters']),_0x1adbce);if(_0x4f97fc[_0x6316('0x34')]['filter']){_0x48d6f6['where']=_['merge'](_0x48d6f6[_0x6316('0x3e')],{'$or':_['map'](_0x1adbce,function(_0x5d7115){if(_0x5d7115[_0x6316('0x30')]!==_0x6316('0x40')){var _0x16f4b4={};_0x16f4b4[_0x5d7115['name']]={'$like':'%'+_0x4f97fc[_0x6316('0x34')][_0x6316('0x41')]+'%'};return _0x16f4b4;}})});}_0x48d6f6=_[_0x6316('0x42')]({},_0x48d6f6,_0x4f97fc[_0x6316('0x43')]);var _0xab5550={'where':_0x48d6f6[_0x6316('0x3e')]};return db['JscriptyProject'][_0x6316('0x1f')](_0xab5550)['then'](function(_0x446a1f){_0x14f449[_0x6316('0x1f')]=_0x446a1f;if(_0x4f97fc[_0x6316('0x34')]['includeAll']){_0x48d6f6['include']=[{'all':!![]}];}return db[_0x6316('0x44')]['findAll'](_0x48d6f6);})[_0x6316('0x26')](function(_0x4ed79c){_0x14f449['rows']=_0x4ed79c;return _0x14f449;})['then'](respondWithFilteredResult(_0x528f8d,_0x48d6f6))[_0x6316('0x45')](handleError(_0x528f8d,null));};exports[_0x6316('0x46')]=function(_0x560b2e,_0x384e65){var _0x34b69e={'raw':![],'where':{'id':_0x560b2e[_0x6316('0x47')]['id']}},_0x2f594b={};_0x2f594b[_0x6316('0x32')]=_[_0x6316('0x33')](db['JscriptyProject']['rawAttributes']);_0x2f594b[_0x6316('0x34')]=_[_0x6316('0x33')](_0x560b2e[_0x6316('0x34')]);_0x2f594b[_0x6316('0x35')]=_[_0x6316('0x36')](_0x2f594b[_0x6316('0x32')],_0x2f594b[_0x6316('0x34')]);_0x34b69e[_0x6316('0x37')]=_[_0x6316('0x36')](_0x2f594b[_0x6316('0x32')],qs[_0x6316('0x38')](_0x560b2e['query']['fields']));_0x34b69e[_0x6316('0x37')]=_0x34b69e[_0x6316('0x37')][_0x6316('0x39')]?_0x34b69e['attributes']:_0x2f594b['model'];if(_0x560b2e[_0x6316('0x34')]['includeAll']){_0x34b69e['include']=[{'all':!![]}];}_0x34b69e=_[_0x6316('0x42')]({},_0x34b69e,_0x560b2e['options']);return db[_0x6316('0x44')][_0x6316('0x48')](_0x34b69e)[_0x6316('0x26')](handleEntityNotFound(_0x384e65,null))[_0x6316('0x26')](respondWithResult(_0x384e65,null))['catch'](handleError(_0x384e65,null));};exports[_0x6316('0x49')]=function(_0x73cf7b,_0x253ded){return db[_0x6316('0x44')][_0x6316('0x49')](_0x73cf7b['body'],{})['then'](function(_0x32bf74){var _0x3d1ae2=_0x73cf7b[_0x6316('0x4a')][_0x6316('0x28')]({'plain':!![]});if(!_0x3d1ae2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d1ae2[_0x6316('0x4b')]===_0x6316('0x4a')){var _0x81538d=_0x32bf74['get']({'plain':!![]});var _0x3a2579='Projects';return db[_0x6316('0x4c')][_0x6316('0x48')]({'where':{'name':_0x3a2579,'userProfileId':_0x3d1ae2[_0x6316('0x4d')]},'raw':!![]})['then'](function(_0x3c51df){if(_0x3c51df&&_0x3c51df[_0x6316('0x4e')]===0x0){return db['UserProfileResource'][_0x6316('0x49')]({'name':_0x81538d[_0x6316('0x2b')],'resourceId':_0x81538d['id'],'type':_0x3c51df[_0x6316('0x2b')],'sectionId':_0x3c51df['id']},{})[_0x6316('0x26')](function(){return _0x32bf74;});}else{return _0x32bf74;}})['catch'](function(_0x596c14){logger[_0x6316('0x2a')](_0x6316('0x4f'),_0x596c14);throw _0x596c14;});}return _0x32bf74;})[_0x6316('0x26')](respondWithResult(_0x253ded,0xc9))[_0x6316('0x45')](handleError(_0x253ded,null));};exports[_0x6316('0x50')]=function(_0x179e50,_0x28f2c7){var _0x5723ff={'where':{'id':_0x179e50['params']['id']}},_0x3250d8={};_0x3250d8[_0x6316('0x32')]=_[_0x6316('0x33')](db[_0x6316('0x44')][_0x6316('0x2e')]);_0x5723ff[_0x6316('0x37')]=_['intersection'](_0x3250d8[_0x6316('0x32')],qs['fields'](_0x179e50[_0x6316('0x34')][_0x6316('0x38')]));_0x5723ff[_0x6316('0x37')]=_0x5723ff[_0x6316('0x37')]['length']?_0x5723ff[_0x6316('0x37')]:_0x3250d8[_0x6316('0x32')];if(_0x179e50['query'][_0x6316('0x51')]){_0x5723ff[_0x6316('0x52')]=[{'all':!![]}];}_0x5723ff=_[_0x6316('0x42')]({},_0x5723ff,_0x179e50[_0x6316('0x43')]);return db[_0x6316('0x44')][_0x6316('0x48')](_0x5723ff)[_0x6316('0x26')](handleEntityNotFound(_0x28f2c7,null))['then'](function(_0x54e536){if(_0x54e536){var _0x2eef96=_0x54e536[_0x6316('0x28')]({'plain':!![]});_0x2eef96=qs['omit'](_0x2eef96,['id',_0x6316('0x53'),'updatedAt']);_0x179e50[_0x6316('0x54')]=_[_0x6316('0x55')](_0x179e50[_0x6316('0x54')],['id','createdAt',_0x6316('0x56')]);return db[_0x6316('0x44')][_0x6316('0x49')](_[_0x6316('0x42')](_0x2eef96,_0x179e50['body']),{'include':_0x179e50[_0x6316('0x34')][_0x6316('0x51')]?[{'all':!![]}]:undefined})['then'](function(_0x566ba1){var _0x34edb5=_0x179e50[_0x6316('0x4a')][_0x6316('0x28')]({'plain':!![]});if(!_0x34edb5)throw new Error(_0x6316('0x57'));if(_0x34edb5[_0x6316('0x4b')]==='user'){var _0xb95aa9=_0x566ba1[_0x6316('0x28')]({'plain':!![]});var _0x1125b7=_0x6316('0x58');return db[_0x6316('0x4c')][_0x6316('0x48')]({'where':{'name':_0x1125b7,'userProfileId':_0x34edb5[_0x6316('0x4d')]},'raw':!![]})['then'](function(_0x1cb112){if(_0x1cb112&&_0x1cb112[_0x6316('0x4e')]===0x0){return db[_0x6316('0x29')][_0x6316('0x49')]({'name':_0xb95aa9[_0x6316('0x2b')],'resourceId':_0xb95aa9['id'],'type':_0x1cb112[_0x6316('0x2b')],'sectionId':_0x1cb112['id']},{})['then'](function(){return _0x566ba1;});}else{return _0x566ba1;}})[_0x6316('0x45')](function(_0x21ee71){logger[_0x6316('0x2a')](_0x6316('0x4f'),_0x21ee71);throw _0x21ee71;});}return _0x566ba1;});}})[_0x6316('0x26')](respondWithResult(_0x28f2c7,0xc9))['catch'](handleError(_0x28f2c7,null));};exports[_0x6316('0x25')]=function(_0x4a9b5e,_0x3b2cfb){if(_0x4a9b5e['body']['id']){delete _0x4a9b5e['body']['id'];}return db[_0x6316('0x44')][_0x6316('0x48')]({'where':{'id':_0x4a9b5e[_0x6316('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b2cfb,null))[_0x6316('0x26')](saveUpdates(_0x4a9b5e['body'],null))[_0x6316('0x26')](respondWithResult(_0x3b2cfb,null))[_0x6316('0x45')](handleError(_0x3b2cfb,null));};exports[_0x6316('0x27')]=function(_0x4bf592,_0x71f8af){return db[_0x6316('0x44')][_0x6316('0x48')]({'where':{'id':_0x4bf592['params']['id']}})[_0x6316('0x26')](handleEntityNotFound(_0x71f8af,null))[_0x6316('0x26')](removeEntity(_0x71f8af,null))[_0x6316('0x45')](handleError(_0x71f8af,null));};exports['getSessions']=function(_0x41850a,_0x255cd3,_0x5c8f5c){var _0x201b83={'raw':!![],'where':{}};var _0x337cb4={};var _0x246024={'count':0x0,'rows':[]};return db[_0x6316('0x44')]['findOne']({'where':{'id':_0x41850a[_0x6316('0x47')]['id']}})[_0x6316('0x26')](handleEntityNotFound(_0x255cd3,null))[_0x6316('0x26')](function(_0x3ec534){if(_0x3ec534){_0x337cb4[_0x6316('0x32')]=_[_0x6316('0x33')](db[_0x6316('0x59')][_0x6316('0x2e')]);_0x337cb4['query']=_[_0x6316('0x33')](_0x41850a[_0x6316('0x34')]);_0x337cb4[_0x6316('0x35')]=_[_0x6316('0x36')](_0x337cb4[_0x6316('0x32')],_0x337cb4[_0x6316('0x34')]);_0x201b83['attributes']=_[_0x6316('0x36')](_0x337cb4['model'],qs[_0x6316('0x38')](_0x41850a[_0x6316('0x34')]['fields']));_0x201b83['attributes']=_0x201b83[_0x6316('0x37')][_0x6316('0x39')]?_0x201b83['attributes']:_0x337cb4['model'];if(!_0x41850a[_0x6316('0x34')]['hasOwnProperty'](_0x6316('0x3b'))){_0x201b83[_0x6316('0x1d')]=qs['limit'](_0x41850a['query'][_0x6316('0x1d')]);_0x201b83[_0x6316('0x1c')]=qs[_0x6316('0x1c')](_0x41850a[_0x6316('0x34')]['offset']);}_0x201b83[_0x6316('0x3c')]=qs[_0x6316('0x3d')](_0x41850a['query'][_0x6316('0x3d')]);_0x201b83['where']=qs['filters'](_[_0x6316('0x3f')](_0x41850a[_0x6316('0x34')],_0x337cb4['filters']));_0x201b83[_0x6316('0x3e')][_0x6316('0x5a')]=_0x3ec534['id'];if(_0x41850a[_0x6316('0x34')][_0x6316('0x41')]){_0x201b83[_0x6316('0x3e')]=_['merge'](_0x201b83['where'],{'$or':_['map'](_0x201b83[_0x6316('0x37')],function(_0x1792a9){var _0x24c45f={};_0x24c45f[_0x1792a9]={'$like':'%'+_0x41850a[_0x6316('0x34')][_0x6316('0x41')]+'%'};return _0x24c45f;})});}_0x201b83=_[_0x6316('0x42')]({},_0x201b83,_0x41850a[_0x6316('0x43')]);return db[_0x6316('0x59')]['count']({'where':_0x201b83[_0x6316('0x3e')]})[_0x6316('0x26')](function(_0xd8154d){_0x246024[_0x6316('0x1f')]=_0xd8154d;if(_0x41850a[_0x6316('0x34')][_0x6316('0x51')]){_0x201b83[_0x6316('0x52')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x201b83);})['then'](function(_0x44715e){_0x246024['rows']=_0x44715e;return _0x246024;});}})[_0x6316('0x26')](respondWithFilteredResult(_0x255cd3,_0x201b83))['catch'](handleError(_0x255cd3,null));};exports[_0x6316('0x5b')]=function(_0x5aee31,_0x1ccfef,_0x2c8461){var _0x59d39f={'raw':!![],'where':{}};var _0x3f84f6={};var _0x3e6464={'count':0x0,'rows':[]};return db[_0x6316('0x44')][_0x6316('0x5c')]({'where':{'id':_0x5aee31[_0x6316('0x47')]['id']}})[_0x6316('0x26')](handleEntityNotFound(_0x1ccfef,null))[_0x6316('0x26')](function(_0x44345a){if(_0x44345a){_0x3f84f6[_0x6316('0x32')]=_[_0x6316('0x33')](db[_0x6316('0x5d')][_0x6316('0x2e')]);_0x3f84f6[_0x6316('0x34')]=_[_0x6316('0x33')](_0x5aee31[_0x6316('0x34')]);_0x3f84f6['filters']=_[_0x6316('0x36')](_0x3f84f6['model'],_0x3f84f6[_0x6316('0x34')]);_0x59d39f['attributes']=_[_0x6316('0x36')](_0x3f84f6['model'],qs[_0x6316('0x38')](_0x5aee31[_0x6316('0x34')][_0x6316('0x38')]));_0x59d39f['attributes']=_0x59d39f['attributes']['length']?_0x59d39f[_0x6316('0x37')]:_0x3f84f6[_0x6316('0x32')];if(!_0x5aee31[_0x6316('0x34')][_0x6316('0x3a')](_0x6316('0x3b'))){_0x59d39f[_0x6316('0x1d')]=qs[_0x6316('0x1d')](_0x5aee31['query'][_0x6316('0x1d')]);_0x59d39f[_0x6316('0x1c')]=qs[_0x6316('0x1c')](_0x5aee31[_0x6316('0x34')][_0x6316('0x1c')]);}_0x59d39f['order']=qs[_0x6316('0x3d')](_0x5aee31[_0x6316('0x34')][_0x6316('0x3d')]);_0x59d39f[_0x6316('0x3e')]=qs[_0x6316('0x35')](_['pick'](_0x5aee31['query'],_0x3f84f6[_0x6316('0x35')]));_0x59d39f[_0x6316('0x3e')][_0x6316('0x5a')]=_0x44345a['id'];if(_0x5aee31[_0x6316('0x34')][_0x6316('0x41')]){_0x59d39f[_0x6316('0x3e')]=_[_0x6316('0x42')](_0x59d39f[_0x6316('0x3e')],{'$or':_[_0x6316('0x2d')](_0x59d39f['attributes'],function(_0x6b3b11){var _0x288327={};_0x288327[_0x6b3b11]={'$like':'%'+_0x5aee31[_0x6316('0x34')][_0x6316('0x41')]+'%'};return _0x288327;})});}_0x59d39f=_[_0x6316('0x42')]({},_0x59d39f,_0x5aee31[_0x6316('0x43')]);return db[_0x6316('0x5d')][_0x6316('0x1f')]({'where':_0x59d39f['where']})[_0x6316('0x26')](function(_0x490422){_0x3e6464[_0x6316('0x1f')]=_0x490422;if(_0x5aee31[_0x6316('0x34')]['includeAll']){_0x59d39f[_0x6316('0x52')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x6316('0x5e')](_0x59d39f);})['then'](function(_0x45e291){_0x3e6464[_0x6316('0x5f')]=_0x45e291;return _0x3e6464;});}})[_0x6316('0x26')](respondWithFilteredResult(_0x1ccfef,_0x59d39f))[_0x6316('0x45')](handleError(_0x1ccfef,null));};function char(_0x424718){return _0x6316('0x60')===typeof _0x424718?String[_0x6316('0x61')][_0x6316('0x62')](null,arguments):_0x424718;}function needsEncapsulation(_0x2ec830){return!!_0x2ec830&&(_0x2ec830[_0x6316('0x63')]()[_0x6316('0x64')](char(0xd))>=0x0||_0x2ec830[_0x6316('0x63')]()[_0x6316('0x64')](char(0xa))>=0x0||_0x2ec830[_0x6316('0x63')]()[_0x6316('0x64')](char(0x2c))>=0x0||_0x2ec830[_0x6316('0x63')]()[_0x6316('0x64')](char(0x22))>=0x0);}function encapsulate(_0x53721c){var _0x4ed949=char(0x22),_0x5e57ad='\x5c'+char(0x22),_0x308b17=_0x53721c[_0x6316('0x63')]()[_0x6316('0x65')](new RegExp(_0x4ed949,'g'),_0x5e57ad);return _0x4ed949+_0x308b17+_0x4ed949;}exports[_0x6316('0x66')]=function(_0x550822,_0x28f200,_0x2d9eef){var _0x4174af,_0x142f07;var _0x6e64ce={'where':{'ProjectId':_0x550822[_0x6316('0x47')]['id']}};if(_0x550822['query'][_0x6316('0x67')]){_0x6e64ce['where'][_0x6316('0x68')]=JSON[_0x6316('0x69')](_0x550822[_0x6316('0x34')]['startTime']);}return db[_0x6316('0x59')][_0x6316('0x5e')](_0x6e64ce)[_0x6316('0x26')](handleEntityNotFound(_0x28f200,null))['then'](function(_0x320c34){if(_0x320c34){_0x4174af=_0x320c34;return db[_0x6316('0x6a')][_0x6316('0x5e')]({'where':{'SessionId':{'$in':_[_0x6316('0x2d')](_0x4174af,'id')},'ProjectId':_0x550822[_0x6316('0x47')]['id']},'order':'-createdAt'});}})[_0x6316('0x26')](handleEntityNotFound(_0x28f200,null))[_0x6316('0x26')](function(_0x2636a9){if(_0x2636a9){_0x142f07=_0x2636a9;var _0x1e6a38={};for(var _0x30692e=0x0,_0x8c599e=_0x142f07[_0x6316('0x39')];_0x30692e<_0x8c599e;_0x30692e++){if(!_0x1e6a38[_0x6316('0x3a')](_0x142f07[_0x30692e][_0x6316('0x6b')])){_0x1e6a38[_0x142f07[_0x30692e]['questionId']]=needsEncapsulation(_0x142f07[_0x30692e]['question'])?encapsulate(_0x142f07[_0x30692e][_0x6316('0x6c')]):_0x142f07[_0x30692e][_0x6316('0x6c')];}}var _0x348155=[],_0x13cfe6={};for(var _0x4c5e5b=0x0,_0x5cd73b=_0x4174af['length'];_0x4c5e5b<_0x5cd73b;_0x4c5e5b++){_0x13cfe6={'ProjectId':_0x550822[_0x6316('0x47')]['id'],'SessionId':_0x4174af[_0x4c5e5b]['id'],'StartTime':moment(_0x4174af[_0x4c5e5b][_0x6316('0x68')])[_0x6316('0x6d')](_0x6316('0x6e'))};for(var _0x265706=0x0,_0x2af6ce=_0x142f07[_0x6316('0x39')];_0x265706<_0x2af6ce;_0x265706++){if(_0x142f07[_0x265706][_0x6316('0x6f')]==_0x4174af[_0x4c5e5b]['id']&&_0x1e6a38[_0x6316('0x3a')](_0x142f07[_0x265706][_0x6316('0x6b')])){_0x13cfe6[_0x1e6a38[_0x142f07[_0x265706]['questionId']]]=_0x142f07[_0x265706][_0x6316('0x70')];}}for(var _0x3e2714 in _0x1e6a38){if(!_0x13cfe6[_0x6316('0x3a')](_0x1e6a38[_0x3e2714])){_0x13cfe6[_0x1e6a38[_0x3e2714]]=null;}}_0x348155[_0x6316('0x71')](_0x13cfe6);}return _0x348155;}})[_0x6316('0x26')](function(_0x49cdb6){if(!_[_0x6316('0x72')](_0x49cdb6)){var _0x54c393=toCsv(_0x49cdb6);var _0x3c485f=Date['now']();fs[_0x6316('0x73')](util['format'](_0x6316('0x74'),_0x550822['params']['id'],_0x3c485f),_0x54c393);_0x28f200[_0x6316('0x75')]('Content-disposition',_0x6316('0x76')+util[_0x6316('0x6d')](_0x6316('0x77'),_0x550822[_0x6316('0x47')]['id'],_0x3c485f));_0x28f200['setHeader'](_0x6316('0x78'),_0x6316('0x79'));return _0x28f200['download'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x550822['params']['id'],_0x3c485f));}else{return _0x28f200['sendStatus'](0xcc);}})['catch'](handleError(_0x28f200,null));}; \ No newline at end of file +var _0x57ef=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Projects','UserProfileResource','error','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','include','findAll','catch','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','getSessions','findOne','JscriptySessionReport','nolimit','ProjectId','rows','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x26bd8e,_0x2a9fdf){var _0x3a659d=function(_0x1b82cd){while(--_0x1b82cd){_0x26bd8e['push'](_0x26bd8e['shift']());}};_0x3a659d(++_0x2a9fdf);}(_0x57ef,0xdb));var _0xf57e=function(_0xc2cb9e,_0x818fbe){_0xc2cb9e=_0xc2cb9e-0x0;var _0x194de3=_0x57ef[_0xc2cb9e];return _0x194de3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf57e('0x0'));var zipdir=require(_0xf57e('0x1'));var jsonpatch=require(_0xf57e('0x2'));var rp=require(_0xf57e('0x3'));var moment=require(_0xf57e('0x4'));var BPromise=require(_0xf57e('0x5'));var Mustache=require(_0xf57e('0x6'));var util=require('util');var path=require(_0xf57e('0x7'));var sox=require(_0xf57e('0x8'));var csv=require(_0xf57e('0x9'));var ejs=require(_0xf57e('0xa'));var fs=require('fs');var fs_extra=require(_0xf57e('0xb'));var _=require(_0xf57e('0xc'));var squel=require(_0xf57e('0xd'));var crypto=require(_0xf57e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf57e('0xf'));var toCsv=require(_0xf57e('0x9'));var querystring=require(_0xf57e('0x10'));var Papa=require(_0xf57e('0x11'));var Redis=require(_0xf57e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf57e('0x13'));var as=require(_0xf57e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf57e('0x15'))(_0xf57e('0x16'));var utils=require(_0xf57e('0x17'));var config=require(_0xf57e('0x18'));var licenseUtil=require(_0xf57e('0x19'));var db=require(_0xf57e('0x1a'))['db'];function respondWithStatusCode(_0x4e3b57,_0x1b6e4f){_0x1b6e4f=_0x1b6e4f||0xcc;return function(_0x379b53){if(_0x379b53){return _0x4e3b57[_0xf57e('0x1b')](_0x1b6e4f);}return _0x4e3b57[_0xf57e('0x1c')](_0x1b6e4f)[_0xf57e('0x1d')]();};}function respondWithResult(_0x3ffeee,_0x1f2f5e){_0x1f2f5e=_0x1f2f5e||0xc8;return function(_0x2f0d23){if(_0x2f0d23){return _0x3ffeee[_0xf57e('0x1c')](_0x1f2f5e)[_0xf57e('0x1e')](_0x2f0d23);}};}function respondWithFilteredResult(_0x150b80,_0x2a6ff7){return function(_0x3bf629){if(_0x3bf629){var _0x302c46=typeof _0x2a6ff7[_0xf57e('0x1f')]===_0xf57e('0x20')&&typeof _0x2a6ff7[_0xf57e('0x21')]===_0xf57e('0x20');var _0x236c0f=_0x3bf629[_0xf57e('0x22')];var _0x186f69=_0x302c46?0x0:_0x2a6ff7[_0xf57e('0x1f')];var _0x588ec8=_0x302c46?_0x3bf629['count']:_0x2a6ff7[_0xf57e('0x1f')]+_0x2a6ff7['limit'];var _0x3100ce;if(_0x588ec8>=_0x236c0f){_0x588ec8=_0x236c0f;_0x3100ce=0xc8;}else{_0x3100ce=0xce;}_0x150b80['status'](_0x3100ce);return _0x150b80[_0xf57e('0x23')](_0xf57e('0x24'),_0x186f69+'-'+_0x588ec8+'/'+_0x236c0f)[_0xf57e('0x1e')](_0x3bf629);}return null;};}function patchUpdates(_0xa8476e){return function(_0x571e57){try{jsonpatch[_0xf57e('0x25')](_0x571e57,_0xa8476e,!![]);}catch(_0x582ca5){return BPromise[_0xf57e('0x26')](_0x582ca5);}return _0x571e57[_0xf57e('0x27')]();};}function saveUpdates(_0x4eac1f,_0x49b80c){return function(_0x2068bc){if(_0x2068bc){return _0x2068bc[_0xf57e('0x28')](_0x4eac1f)[_0xf57e('0x29')](function(_0x297b2f){return _0x297b2f;});}return null;};}function removeEntity(_0x5d0f7f,_0x134557){return function(_0x1cd065){if(_0x1cd065){return _0x1cd065['destroy']()[_0xf57e('0x29')](function(){var _0x2d5893=_0x1cd065[_0xf57e('0x2a')]({'plain':!![]});var _0xa3072d=_0xf57e('0x2b');return db[_0xf57e('0x2c')]['destroy']({'where':{'type':_0xa3072d,'resourceId':_0x2d5893['id']}})[_0xf57e('0x29')](function(){return _0x1cd065;});})['then'](function(){_0x5d0f7f[_0xf57e('0x1c')](0xcc)[_0xf57e('0x1d')]();});}};}function handleEntityNotFound(_0x1b7f19,_0x4df26d){return function(_0x52147d){if(!_0x52147d){_0x1b7f19[_0xf57e('0x1b')](0x194);}return _0x52147d;};}function handleError(_0x22aeb6,_0x4f4c73){_0x4f4c73=_0x4f4c73||0x1f4;return function(_0x468048){logger[_0xf57e('0x2d')](_0x468048['stack']);if(_0x468048['name']){delete _0x468048[_0xf57e('0x2e')];}_0x22aeb6['status'](_0x4f4c73)[_0xf57e('0x2f')](_0x468048);};}exports[_0xf57e('0x30')]=function(_0x93f436,_0x27ee9f){var _0x502211={},_0x4e5ec2={},_0xc821b7={'count':0x0,'rows':[]};var _0x4bfefb=_[_0xf57e('0x31')](db[_0xf57e('0x32')][_0xf57e('0x33')],function(_0x488fb0){return{'name':_0x488fb0[_0xf57e('0x34')],'type':_0x488fb0[_0xf57e('0x35')]['key']};});_0x4e5ec2['model']=_[_0xf57e('0x31')](_0x4bfefb,'name');_0x4e5ec2[_0xf57e('0x36')]=_[_0xf57e('0x37')](_0x93f436['query']);_0x4e5ec2['filters']=_[_0xf57e('0x38')](_0x4e5ec2[_0xf57e('0x39')],_0x4e5ec2[_0xf57e('0x36')]);_0x502211[_0xf57e('0x3a')]=_['intersection'](_0x4e5ec2['model'],qs[_0xf57e('0x3b')](_0x93f436[_0xf57e('0x36')][_0xf57e('0x3b')]));_0x502211[_0xf57e('0x3a')]=_0x502211[_0xf57e('0x3a')]['length']?_0x502211[_0xf57e('0x3a')]:_0x4e5ec2['model'];if(!_0x93f436['query'][_0xf57e('0x3c')]('nolimit')){_0x502211[_0xf57e('0x21')]=qs[_0xf57e('0x21')](_0x93f436['query'][_0xf57e('0x21')]);_0x502211[_0xf57e('0x1f')]=qs[_0xf57e('0x1f')](_0x93f436[_0xf57e('0x36')][_0xf57e('0x1f')]);}_0x502211[_0xf57e('0x3d')]=qs[_0xf57e('0x3e')](_0x93f436[_0xf57e('0x36')][_0xf57e('0x3e')]);_0x502211[_0xf57e('0x3f')]=qs[_0xf57e('0x40')](_[_0xf57e('0x41')](_0x93f436[_0xf57e('0x36')],_0x4e5ec2[_0xf57e('0x40')]),_0x4bfefb);if(_0x93f436['query'][_0xf57e('0x42')]){_0x502211['where']=_['merge'](_0x502211['where'],{'$or':_[_0xf57e('0x31')](_0x4bfefb,function(_0x16da7f){if(_0x16da7f['type']!=='VIRTUAL'){var _0x526a62={};_0x526a62[_0x16da7f[_0xf57e('0x2e')]]={'$like':'%'+_0x93f436[_0xf57e('0x36')][_0xf57e('0x42')]+'%'};return _0x526a62;}})});}_0x502211=_[_0xf57e('0x43')]({},_0x502211,_0x93f436[_0xf57e('0x44')]);var _0x55ad0d={'where':_0x502211[_0xf57e('0x3f')]};return db[_0xf57e('0x32')][_0xf57e('0x22')](_0x55ad0d)['then'](function(_0x2de3c7){_0xc821b7['count']=_0x2de3c7;if(_0x93f436['query']['includeAll']){_0x502211[_0xf57e('0x45')]=[{'all':!![]}];}return db[_0xf57e('0x32')][_0xf57e('0x46')](_0x502211);})['then'](function(_0x48d305){_0xc821b7['rows']=_0x48d305;return _0xc821b7;})[_0xf57e('0x29')](respondWithFilteredResult(_0x27ee9f,_0x502211))[_0xf57e('0x47')](handleError(_0x27ee9f,null));};exports['show']=function(_0x41aff1,_0x17cf8d){var _0x1c6fb8={'raw':![],'where':{'id':_0x41aff1[_0xf57e('0x48')]['id']}},_0x2afd40={};_0x2afd40['model']=_[_0xf57e('0x37')](db['JscriptyProject']['rawAttributes']);_0x2afd40[_0xf57e('0x36')]=_[_0xf57e('0x37')](_0x41aff1[_0xf57e('0x36')]);_0x2afd40[_0xf57e('0x40')]=_[_0xf57e('0x38')](_0x2afd40['model'],_0x2afd40['query']);_0x1c6fb8[_0xf57e('0x3a')]=_[_0xf57e('0x38')](_0x2afd40[_0xf57e('0x39')],qs[_0xf57e('0x3b')](_0x41aff1[_0xf57e('0x36')][_0xf57e('0x3b')]));_0x1c6fb8['attributes']=_0x1c6fb8[_0xf57e('0x3a')][_0xf57e('0x49')]?_0x1c6fb8[_0xf57e('0x3a')]:_0x2afd40[_0xf57e('0x39')];if(_0x41aff1[_0xf57e('0x36')][_0xf57e('0x4a')]){_0x1c6fb8[_0xf57e('0x45')]=[{'all':!![]}];}_0x1c6fb8=_[_0xf57e('0x43')]({},_0x1c6fb8,_0x41aff1['options']);return db[_0xf57e('0x32')][_0xf57e('0x4b')](_0x1c6fb8)['then'](handleEntityNotFound(_0x17cf8d,null))[_0xf57e('0x29')](respondWithResult(_0x17cf8d,null))[_0xf57e('0x47')](handleError(_0x17cf8d,null));};exports[_0xf57e('0x4c')]=function(_0x31b625,_0x12aeac){return db[_0xf57e('0x32')][_0xf57e('0x4c')](_0x31b625[_0xf57e('0x4d')],{})['then'](function(_0x104aa2){var _0x177963=_0x31b625[_0xf57e('0x4e')][_0xf57e('0x2a')]({'plain':!![]});if(!_0x177963)throw new Error(_0xf57e('0x4f'));if(_0x177963[_0xf57e('0x50')]==='user'){var _0x1f3d55=_0x104aa2[_0xf57e('0x2a')]({'plain':!![]});var _0x3bcff1=_0xf57e('0x2b');return db[_0xf57e('0x51')][_0xf57e('0x4b')]({'where':{'name':_0x3bcff1,'userProfileId':_0x177963['userProfileId']},'raw':!![]})[_0xf57e('0x29')](function(_0x202628){if(_0x202628&&_0x202628[_0xf57e('0x52')]===0x0){return db['UserProfileResource'][_0xf57e('0x4c')]({'name':_0x1f3d55['name'],'resourceId':_0x1f3d55['id'],'type':_0x202628['name'],'sectionId':_0x202628['id']},{})[_0xf57e('0x29')](function(){return _0x104aa2;});}else{return _0x104aa2;}})[_0xf57e('0x47')](function(_0x12d614){logger[_0xf57e('0x2d')](_0xf57e('0x53'),_0x12d614);throw _0x12d614;});}return _0x104aa2;})[_0xf57e('0x29')](respondWithResult(_0x12aeac,0xc9))[_0xf57e('0x47')](handleError(_0x12aeac,null));};exports[_0xf57e('0x54')]=function(_0x5afd66,_0x2beccd){var _0x2a8edb={'where':{'id':_0x5afd66[_0xf57e('0x48')]['id']}},_0x22e1dc={};_0x22e1dc[_0xf57e('0x39')]=_[_0xf57e('0x37')](db[_0xf57e('0x32')][_0xf57e('0x33')]);_0x2a8edb[_0xf57e('0x3a')]=_[_0xf57e('0x38')](_0x22e1dc[_0xf57e('0x39')],qs[_0xf57e('0x3b')](_0x5afd66[_0xf57e('0x36')][_0xf57e('0x3b')]));_0x2a8edb[_0xf57e('0x3a')]=_0x2a8edb[_0xf57e('0x3a')]['length']?_0x2a8edb['attributes']:_0x22e1dc[_0xf57e('0x39')];if(_0x5afd66[_0xf57e('0x36')][_0xf57e('0x4a')]){_0x2a8edb[_0xf57e('0x45')]=[{'all':!![]}];}_0x2a8edb=_['merge']({},_0x2a8edb,_0x5afd66[_0xf57e('0x44')]);return db['JscriptyProject']['find'](_0x2a8edb)[_0xf57e('0x29')](handleEntityNotFound(_0x2beccd,null))[_0xf57e('0x29')](function(_0x577d73){if(_0x577d73){var _0x47750a=_0x577d73[_0xf57e('0x2a')]({'plain':!![]});_0x47750a=qs[_0xf57e('0x55')](_0x47750a,['id',_0xf57e('0x56'),_0xf57e('0x57')]);_0x5afd66[_0xf57e('0x4d')]=_[_0xf57e('0x55')](_0x5afd66[_0xf57e('0x4d')],['id','createdAt',_0xf57e('0x57')]);return db[_0xf57e('0x32')]['create'](_['merge'](_0x47750a,_0x5afd66[_0xf57e('0x4d')]),{'include':_0x5afd66[_0xf57e('0x36')]['includeAll']?[{'all':!![]}]:undefined})[_0xf57e('0x29')](function(_0x1eb283){var _0x5c6e70=_0x5afd66[_0xf57e('0x4e')][_0xf57e('0x2a')]({'plain':!![]});if(!_0x5c6e70)throw new Error(_0xf57e('0x4f'));if(_0x5c6e70[_0xf57e('0x50')]===_0xf57e('0x4e')){var _0x5a63a2=_0x1eb283['get']({'plain':!![]});var _0x2aadb8='Projects';return db[_0xf57e('0x51')][_0xf57e('0x4b')]({'where':{'name':_0x2aadb8,'userProfileId':_0x5c6e70[_0xf57e('0x58')]},'raw':!![]})[_0xf57e('0x29')](function(_0x56c21e){if(_0x56c21e&&_0x56c21e[_0xf57e('0x52')]===0x0){return db['UserProfileResource'][_0xf57e('0x4c')]({'name':_0x5a63a2[_0xf57e('0x2e')],'resourceId':_0x5a63a2['id'],'type':_0x56c21e['name'],'sectionId':_0x56c21e['id']},{})[_0xf57e('0x29')](function(){return _0x1eb283;});}else{return _0x1eb283;}})['catch'](function(_0x6e0d02){logger['error'](_0xf57e('0x53'),_0x6e0d02);throw _0x6e0d02;});}return _0x1eb283;});}})[_0xf57e('0x29')](respondWithResult(_0x2beccd,0xc9))[_0xf57e('0x47')](handleError(_0x2beccd,null));};exports[_0xf57e('0x28')]=function(_0x7fcd52,_0x1f1746){if(_0x7fcd52[_0xf57e('0x4d')]['id']){delete _0x7fcd52[_0xf57e('0x4d')]['id'];}return db[_0xf57e('0x32')]['find']({'where':{'id':_0x7fcd52[_0xf57e('0x48')]['id']}})[_0xf57e('0x29')](handleEntityNotFound(_0x1f1746,null))[_0xf57e('0x29')](saveUpdates(_0x7fcd52[_0xf57e('0x4d')],null))['then'](respondWithResult(_0x1f1746,null))[_0xf57e('0x47')](handleError(_0x1f1746,null));};exports['destroy']=function(_0x366256,_0x3df6a7){return db['JscriptyProject'][_0xf57e('0x4b')]({'where':{'id':_0x366256[_0xf57e('0x48')]['id']}})[_0xf57e('0x29')](handleEntityNotFound(_0x3df6a7,null))[_0xf57e('0x29')](removeEntity(_0x3df6a7,null))[_0xf57e('0x47')](handleError(_0x3df6a7,null));};exports[_0xf57e('0x59')]=function(_0x40647f,_0x5258d1,_0x25745f){var _0x2276ba={'raw':!![],'where':{}};var _0xb67029={};var _0x2cf9f7={'count':0x0,'rows':[]};return db[_0xf57e('0x32')][_0xf57e('0x5a')]({'where':{'id':_0x40647f['params']['id']}})[_0xf57e('0x29')](handleEntityNotFound(_0x5258d1,null))[_0xf57e('0x29')](function(_0x440778){if(_0x440778){_0xb67029[_0xf57e('0x39')]=_[_0xf57e('0x37')](db[_0xf57e('0x5b')][_0xf57e('0x33')]);_0xb67029[_0xf57e('0x36')]=_[_0xf57e('0x37')](_0x40647f[_0xf57e('0x36')]);_0xb67029['filters']=_['intersection'](_0xb67029[_0xf57e('0x39')],_0xb67029[_0xf57e('0x36')]);_0x2276ba[_0xf57e('0x3a')]=_[_0xf57e('0x38')](_0xb67029[_0xf57e('0x39')],qs[_0xf57e('0x3b')](_0x40647f[_0xf57e('0x36')][_0xf57e('0x3b')]));_0x2276ba[_0xf57e('0x3a')]=_0x2276ba[_0xf57e('0x3a')][_0xf57e('0x49')]?_0x2276ba[_0xf57e('0x3a')]:_0xb67029[_0xf57e('0x39')];if(!_0x40647f[_0xf57e('0x36')]['hasOwnProperty'](_0xf57e('0x5c'))){_0x2276ba[_0xf57e('0x21')]=qs['limit'](_0x40647f[_0xf57e('0x36')][_0xf57e('0x21')]);_0x2276ba['offset']=qs[_0xf57e('0x1f')](_0x40647f[_0xf57e('0x36')][_0xf57e('0x1f')]);}_0x2276ba['order']=qs[_0xf57e('0x3e')](_0x40647f[_0xf57e('0x36')][_0xf57e('0x3e')]);_0x2276ba[_0xf57e('0x3f')]=qs[_0xf57e('0x40')](_[_0xf57e('0x41')](_0x40647f[_0xf57e('0x36')],_0xb67029[_0xf57e('0x40')]));_0x2276ba[_0xf57e('0x3f')][_0xf57e('0x5d')]=_0x440778['id'];if(_0x40647f[_0xf57e('0x36')][_0xf57e('0x42')]){_0x2276ba[_0xf57e('0x3f')]=_['merge'](_0x2276ba[_0xf57e('0x3f')],{'$or':_['map'](_0x2276ba[_0xf57e('0x3a')],function(_0x550b7d){var _0x21b8e7={};_0x21b8e7[_0x550b7d]={'$like':'%'+_0x40647f['query'][_0xf57e('0x42')]+'%'};return _0x21b8e7;})});}_0x2276ba=_['merge']({},_0x2276ba,_0x40647f['options']);return db[_0xf57e('0x5b')][_0xf57e('0x22')]({'where':_0x2276ba[_0xf57e('0x3f')]})['then'](function(_0x2c63d2){_0x2cf9f7[_0xf57e('0x22')]=_0x2c63d2;if(_0x40647f[_0xf57e('0x36')][_0xf57e('0x4a')]){_0x2276ba[_0xf57e('0x45')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xf57e('0x46')](_0x2276ba);})[_0xf57e('0x29')](function(_0x3f7336){_0x2cf9f7[_0xf57e('0x5e')]=_0x3f7336;return _0x2cf9f7;});}})[_0xf57e('0x29')](respondWithFilteredResult(_0x5258d1,_0x2276ba))[_0xf57e('0x47')](handleError(_0x5258d1,null));};exports['getAnswers']=function(_0x4463e2,_0x2977d1,_0x599cdd){var _0x148ab0={'raw':!![],'where':{}};var _0x577640={};var _0x135c04={'count':0x0,'rows':[]};return db[_0xf57e('0x32')][_0xf57e('0x5a')]({'where':{'id':_0x4463e2['params']['id']}})[_0xf57e('0x29')](handleEntityNotFound(_0x2977d1,null))['then'](function(_0x3d3fa4){if(_0x3d3fa4){_0x577640[_0xf57e('0x39')]=_[_0xf57e('0x37')](db[_0xf57e('0x5f')][_0xf57e('0x33')]);_0x577640[_0xf57e('0x36')]=_[_0xf57e('0x37')](_0x4463e2[_0xf57e('0x36')]);_0x577640[_0xf57e('0x40')]=_['intersection'](_0x577640[_0xf57e('0x39')],_0x577640[_0xf57e('0x36')]);_0x148ab0[_0xf57e('0x3a')]=_[_0xf57e('0x38')](_0x577640[_0xf57e('0x39')],qs[_0xf57e('0x3b')](_0x4463e2[_0xf57e('0x36')][_0xf57e('0x3b')]));_0x148ab0[_0xf57e('0x3a')]=_0x148ab0[_0xf57e('0x3a')][_0xf57e('0x49')]?_0x148ab0[_0xf57e('0x3a')]:_0x577640[_0xf57e('0x39')];if(!_0x4463e2[_0xf57e('0x36')][_0xf57e('0x3c')]('nolimit')){_0x148ab0[_0xf57e('0x21')]=qs[_0xf57e('0x21')](_0x4463e2[_0xf57e('0x36')][_0xf57e('0x21')]);_0x148ab0[_0xf57e('0x1f')]=qs[_0xf57e('0x1f')](_0x4463e2[_0xf57e('0x36')][_0xf57e('0x1f')]);}_0x148ab0['order']=qs[_0xf57e('0x3e')](_0x4463e2['query'][_0xf57e('0x3e')]);_0x148ab0[_0xf57e('0x3f')]=qs[_0xf57e('0x40')](_['pick'](_0x4463e2['query'],_0x577640[_0xf57e('0x40')]));_0x148ab0['where']['ProjectId']=_0x3d3fa4['id'];if(_0x4463e2['query'][_0xf57e('0x42')]){_0x148ab0[_0xf57e('0x3f')]=_[_0xf57e('0x43')](_0x148ab0[_0xf57e('0x3f')],{'$or':_[_0xf57e('0x31')](_0x148ab0['attributes'],function(_0x2ee2f2){var _0x2b5b60={};_0x2b5b60[_0x2ee2f2]={'$like':'%'+_0x4463e2[_0xf57e('0x36')]['filter']+'%'};return _0x2b5b60;})});}_0x148ab0=_['merge']({},_0x148ab0,_0x4463e2['options']);return db[_0xf57e('0x5f')][_0xf57e('0x22')]({'where':_0x148ab0[_0xf57e('0x3f')]})[_0xf57e('0x29')](function(_0x336916){_0x135c04[_0xf57e('0x22')]=_0x336916;if(_0x4463e2[_0xf57e('0x36')][_0xf57e('0x4a')]){_0x148ab0[_0xf57e('0x45')]=[{'all':!![]}];}return db[_0xf57e('0x5f')][_0xf57e('0x46')](_0x148ab0);})[_0xf57e('0x29')](function(_0x548c73){_0x135c04[_0xf57e('0x5e')]=_0x548c73;return _0x135c04;});}})[_0xf57e('0x29')](respondWithFilteredResult(_0x2977d1,_0x148ab0))[_0xf57e('0x47')](handleError(_0x2977d1,null));};function char(_0x355950){return _0xf57e('0x60')===typeof _0x355950?String[_0xf57e('0x61')][_0xf57e('0x25')](null,arguments):_0x355950;}function needsEncapsulation(_0x2657ac){return!!_0x2657ac&&(_0x2657ac[_0xf57e('0x62')]()[_0xf57e('0x63')](char(0xd))>=0x0||_0x2657ac['toString']()['indexOf'](char(0xa))>=0x0||_0x2657ac[_0xf57e('0x62')]()[_0xf57e('0x63')](char(0x2c))>=0x0||_0x2657ac[_0xf57e('0x62')]()[_0xf57e('0x63')](char(0x22))>=0x0);}function encapsulate(_0xd4e041){var _0x4f351e=char(0x22),_0x3c3652='\x5c'+char(0x22),_0x58bbea=_0xd4e041[_0xf57e('0x62')]()[_0xf57e('0x64')](new RegExp(_0x4f351e,'g'),_0x3c3652);return _0x4f351e+_0x58bbea+_0x4f351e;}exports[_0xf57e('0x65')]=function(_0x2e875c,_0x13922a,_0x71d92b){var _0x136876,_0x147b03;var _0x423a0c={'where':{'ProjectId':_0x2e875c[_0xf57e('0x48')]['id']}};if(_0x2e875c[_0xf57e('0x36')][_0xf57e('0x66')]){_0x423a0c['where'][_0xf57e('0x67')]=JSON[_0xf57e('0x68')](_0x2e875c[_0xf57e('0x36')][_0xf57e('0x66')]);}return db['JscriptySessionReport'][_0xf57e('0x46')](_0x423a0c)[_0xf57e('0x29')](handleEntityNotFound(_0x13922a,null))['then'](function(_0x57ae70){if(_0x57ae70){_0x136876=_0x57ae70;return db[_0xf57e('0x69')][_0xf57e('0x46')]({'where':{'SessionId':{'$in':_[_0xf57e('0x31')](_0x136876,'id')},'ProjectId':_0x2e875c['params']['id']},'order':'-createdAt'});}})[_0xf57e('0x29')](handleEntityNotFound(_0x13922a,null))[_0xf57e('0x29')](function(_0x26416a){if(_0x26416a){_0x147b03=_0x26416a;var _0x48bb5e={};for(var _0x1f1633=0x0,_0x38659d=_0x147b03[_0xf57e('0x49')];_0x1f1633<_0x38659d;_0x1f1633++){if(!_0x48bb5e[_0xf57e('0x3c')](_0x147b03[_0x1f1633][_0xf57e('0x6a')])){_0x48bb5e[_0x147b03[_0x1f1633][_0xf57e('0x6a')]]=needsEncapsulation(_0x147b03[_0x1f1633][_0xf57e('0x6b')])?encapsulate(_0x147b03[_0x1f1633][_0xf57e('0x6b')]):_0x147b03[_0x1f1633][_0xf57e('0x6b')];}}var _0x48620f=[],_0x32c943={};for(var _0x598788=0x0,_0xe72919=_0x136876[_0xf57e('0x49')];_0x598788<_0xe72919;_0x598788++){_0x32c943={'ProjectId':_0x2e875c[_0xf57e('0x48')]['id'],'SessionId':_0x136876[_0x598788]['id'],'StartTime':moment(_0x136876[_0x598788][_0xf57e('0x67')])[_0xf57e('0x6c')](_0xf57e('0x6d'))};for(var _0x2aae9d=0x0,_0x993872=_0x147b03[_0xf57e('0x49')];_0x2aae9d<_0x993872;_0x2aae9d++){if(_0x147b03[_0x2aae9d][_0xf57e('0x6e')]==_0x136876[_0x598788]['id']&&_0x48bb5e[_0xf57e('0x3c')](_0x147b03[_0x2aae9d][_0xf57e('0x6a')])){_0x32c943[_0x48bb5e[_0x147b03[_0x2aae9d][_0xf57e('0x6a')]]]=_0x147b03[_0x2aae9d][_0xf57e('0x6f')];}}for(var _0x2a32af in _0x48bb5e){if(!_0x32c943[_0xf57e('0x3c')](_0x48bb5e[_0x2a32af])){_0x32c943[_0x48bb5e[_0x2a32af]]=null;}}_0x48620f[_0xf57e('0x70')](_0x32c943);}return _0x48620f;}})['then'](function(_0x473288){if(!_[_0xf57e('0x71')](_0x473288)){var _0x569ec3=toCsv(_0x473288);var _0x28e958=Date[_0xf57e('0x72')]();fs['writeFileSync'](util['format'](_0xf57e('0x73'),_0x2e875c[_0xf57e('0x48')]['id'],_0x28e958),_0x569ec3);_0x13922a[_0xf57e('0x74')](_0xf57e('0x75'),_0xf57e('0x76')+util[_0xf57e('0x6c')]('Jscripty_Project_%d_Summary_%s.csv',_0x2e875c[_0xf57e('0x48')]['id'],_0x28e958));_0x13922a[_0xf57e('0x74')](_0xf57e('0x77'),'text/csv');return _0x13922a[_0xf57e('0x78')](util[_0xf57e('0x6c')](_0xf57e('0x73'),_0x2e875c[_0xf57e('0x48')]['id'],_0x28e958));}else{return _0x13922a[_0xf57e('0x1b')](0xcc);}})[_0xf57e('0x47')](handleError(_0x13922a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 4a06e8b..7170ebf 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 _0x3c7b=['../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment'];(function(_0x375eb8,_0x47bb77){var _0x452d7c=function(_0xe70e6b){while(--_0xe70e6b){_0x375eb8['push'](_0x375eb8['shift']());}};_0x452d7c(++_0x47bb77);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x96d72d,_0x1a3ea0){_0x96d72d=_0x96d72d-0x0;var _0x5c9230=_0x3c7b[_0x96d72d];return _0x5c9230;};'use strict';var _=require(_0xb3c7('0x0'));var util=require(_0xb3c7('0x1'));var logger=require(_0xb3c7('0x2'))(_0xb3c7('0x3'));var moment=require(_0xb3c7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb3c7('0x5'));var attributes=require(_0xb3c7('0x6'));module['exports']=function(_0x396a46,_0x5b810b){return _0x396a46[_0xb3c7('0x7')](_0xb3c7('0x8'),attributes,{'tableName':_0xb3c7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51f2=['jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptyProject.attributes','exports','define'];(function(_0x5179a5,_0x419746){var _0x15c8ce=function(_0x1b13c4){while(--_0x1b13c4){_0x5179a5['push'](_0x5179a5['shift']());}};_0x15c8ce(++_0x419746);}(_0x51f2,0xeb));var _0x251f=function(_0x788920,_0x265a25){_0x788920=_0x788920-0x0;var _0x207f54=_0x51f2[_0x788920];return _0x207f54;};'use strict';var _=require(_0x251f('0x0'));var util=require(_0x251f('0x1'));var logger=require(_0x251f('0x2'))(_0x251f('0x3'));var moment=require(_0x251f('0x4'));var BPromise=require(_0x251f('0x5'));var rp=require(_0x251f('0x6'));var fs=require('fs');var path=require(_0x251f('0x7'));var rimraf=require(_0x251f('0x8'));var config=require('../../config/environment');var attributes=require(_0x251f('0x9'));module[_0x251f('0xa')]=function(_0x145630,_0xd9d8e1){return _0x145630[_0x251f('0xb')]('JscriptyProject',attributes,{'tableName':_0x251f('0xc'),'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 1c481fb..4e2792e 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 _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x56fb1a,_0x38167a){var _0x2f78c0=function(_0x435fd6){while(--_0x435fd6){_0x56fb1a['push'](_0x56fb1a['shift']());}};_0x2f78c0(++_0x38167a);}(_0xe706,0xa3));var _0x6e70=function(_0x470d13,_0x3f22fa){_0x470d13=_0x470d13-0x0;var _0x18cc32=_0xe706[_0x470d13];return _0x18cc32;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x499210,_0x325b29){var _0x2e153d=function(_0x951263){while(--_0x951263){_0x499210['push'](_0x499210['shift']());}};_0x2e153d(++_0x325b29);}(_0xda3f,0xec));var _0xfda3=function(_0x3c5564,_0x1e121a){_0x3c5564=_0x3c5564-0x0;var _0x569dcf=_0xda3f[_0x3c5564];return _0x569dcf;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index b69af36..cefc440 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 _0x1ba4=['isAuthenticated','index','describe','/:id','create','put','delete','destroy','exports','multer','path','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x19baaa,_0x17a509){var _0x550579=function(_0x5c1a84){while(--_0x5c1a84){_0x19baaa['push'](_0x19baaa['shift']());}};_0x550579(++_0x17a509);}(_0x1ba4,0x171));var _0x41ba=function(_0x27dfb2,_0x59b146){_0x27dfb2=_0x27dfb2-0x0;var _0x52c5be=_0x1ba4[_0x27dfb2];return _0x52c5be;};'use strict';var multer=require(_0x41ba('0x0'));var util=require('util');var path=require(_0x41ba('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x41ba('0x2'));var auth=require(_0x41ba('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x41ba('0x4'));var controller=require('./jscriptyQuestionReport.controller');router[_0x41ba('0x5')]('/',auth[_0x41ba('0x6')](),controller[_0x41ba('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x41ba('0x8')]);router[_0x41ba('0x5')](_0x41ba('0x9'),auth[_0x41ba('0x6')](),controller['show']);router['post']('/',auth[_0x41ba('0x6')](),controller[_0x41ba('0xa')]);router[_0x41ba('0xb')](_0x41ba('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x41ba('0xc')](_0x41ba('0x9'),auth[_0x41ba('0x6')](),controller[_0x41ba('0xd')]);module[_0x41ba('0xe')]=router; \ No newline at end of file +var _0x5b61=['destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x480dd7,_0x5836e0){var _0x3bc2aa=function(_0x3dfe04){while(--_0x3dfe04){_0x480dd7['push'](_0x480dd7['shift']());}};_0x3bc2aa(++_0x5836e0);}(_0x5b61,0xe6));var _0x15b6=function(_0x69a451,_0x49fd37){_0x69a451=_0x69a451-0x0;var _0x3d6ef5=_0x5b61[_0x69a451];return _0x3d6ef5;};'use strict';var multer=require(_0x15b6('0x0'));var util=require(_0x15b6('0x1'));var path=require(_0x15b6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x15b6('0x3')]();var fs_extra=require(_0x15b6('0x4'));var auth=require(_0x15b6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x15b6('0x6'));var controller=require(_0x15b6('0x7'));router[_0x15b6('0x8')]('/',auth[_0x15b6('0x9')](),controller[_0x15b6('0xa')]);router[_0x15b6('0x8')]('/describe',auth[_0x15b6('0x9')](),controller['describe']);router['get'](_0x15b6('0xb'),auth[_0x15b6('0x9')](),controller[_0x15b6('0xc')]);router[_0x15b6('0xd')]('/',auth[_0x15b6('0x9')](),controller[_0x15b6('0xe')]);router[_0x15b6('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x15b6('0x10')](_0x15b6('0xb'),auth['isAuthenticated'](),controller[_0x15b6('0x11')]);module[_0x15b6('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 5155120..b0deec1 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(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7a54,0x106));var _0x47a5=function(_0x1a78a0,_0x3e5f10){_0x1a78a0=_0x1a78a0-0x0;var _0x2abda9=_0x7a54[_0x1a78a0];return _0x2abda9;};'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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7a54,0x106));var _0x47a5=function(_0x441b28,_0x427859){_0x441b28=_0x441b28-0x0;var _0x1c1e58=_0x7a54[_0x441b28];return _0x1c1e58;};'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 2584800..1bd30a7 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 _0x771c=['name','send','index','map','JscriptyQuestionReport','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','create','update','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack'];(function(_0x1d90f5,_0xd7cd8d){var _0x57f943=function(_0x293768){while(--_0x293768){_0x1d90f5['push'](_0x1d90f5['shift']());}};_0x57f943(++_0xd7cd8d);}(_0x771c,0xbb));var _0xc771=function(_0x540157,_0x41a0a3){_0x540157=_0x540157-0x0;var _0x4e70dc=_0x771c[_0x540157];return _0x4e70dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc771('0x0'));var zipdir=require(_0xc771('0x1'));var jsonpatch=require(_0xc771('0x2'));var rp=require(_0xc771('0x3'));var moment=require(_0xc771('0x4'));var BPromise=require(_0xc771('0x5'));var Mustache=require(_0xc771('0x6'));var util=require(_0xc771('0x7'));var path=require(_0xc771('0x8'));var sox=require(_0xc771('0x9'));var csv=require(_0xc771('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc771('0xb'));var crypto=require(_0xc771('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc771('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc771('0xe'));var Papa=require('papaparse');var Redis=require(_0xc771('0xf'));var authService=require(_0xc771('0x10'));var qs=require(_0xc771('0x11'));var as=require(_0xc771('0x12'));var hardwareService=require(_0xc771('0x13'));var logger=require(_0xc771('0x14'))(_0xc771('0x15'));var utils=require(_0xc771('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc771('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30fd82,_0xdb2ac3){_0xdb2ac3=_0xdb2ac3||0xcc;return function(_0x3049d4){if(_0x3049d4){return _0x30fd82[_0xc771('0x18')](_0xdb2ac3);}return _0x30fd82[_0xc771('0x19')](_0xdb2ac3)[_0xc771('0x1a')]();};}function respondWithResult(_0x204219,_0x3ba320){_0x3ba320=_0x3ba320||0xc8;return function(_0x58b803){if(_0x58b803){return _0x204219['status'](_0x3ba320)[_0xc771('0x1b')](_0x58b803);}};}function respondWithFilteredResult(_0x5569d8,_0x5a813c){return function(_0x52ff91){if(_0x52ff91){var _0x4b642d=typeof _0x5a813c[_0xc771('0x1c')]===_0xc771('0x1d')&&typeof _0x5a813c[_0xc771('0x1e')]===_0xc771('0x1d');var _0x497cf8=_0x52ff91[_0xc771('0x1f')];var _0x3fe34a=_0x4b642d?0x0:_0x5a813c[_0xc771('0x1c')];var _0xb80dab=_0x4b642d?_0x52ff91[_0xc771('0x1f')]:_0x5a813c[_0xc771('0x1c')]+_0x5a813c[_0xc771('0x1e')];var _0x460fca;if(_0xb80dab>=_0x497cf8){_0xb80dab=_0x497cf8;_0x460fca=0xc8;}else{_0x460fca=0xce;}_0x5569d8['status'](_0x460fca);return _0x5569d8[_0xc771('0x20')](_0xc771('0x21'),_0x3fe34a+'-'+_0xb80dab+'/'+_0x497cf8)['json'](_0x52ff91);}return null;};}function patchUpdates(_0x4e3c46){return function(_0x13cc22){try{jsonpatch[_0xc771('0x22')](_0x13cc22,_0x4e3c46,!![]);}catch(_0x3d1f90){return BPromise[_0xc771('0x23')](_0x3d1f90);}return _0x13cc22[_0xc771('0x24')]();};}function saveUpdates(_0x21d822,_0x26e036){return function(_0x2aca51){if(_0x2aca51){return _0x2aca51['update'](_0x21d822)['then'](function(_0x29bc1d){return _0x29bc1d;});}return null;};}function removeEntity(_0x10d5be,_0x16af81){return function(_0xa03888){if(_0xa03888){return _0xa03888[_0xc771('0x25')]()[_0xc771('0x26')](function(){_0x10d5be[_0xc771('0x19')](0xcc)[_0xc771('0x1a')]();});}};}function handleEntityNotFound(_0x1f08aa,_0x53d3d8){return function(_0x57d571){if(!_0x57d571){_0x1f08aa[_0xc771('0x18')](0x194);}return _0x57d571;};}function handleError(_0x4a1630,_0x3b8c75){_0x3b8c75=_0x3b8c75||0x1f4;return function(_0xef87c9){logger[_0xc771('0x27')](_0xef87c9[_0xc771('0x28')]);if(_0xef87c9[_0xc771('0x29')]){delete _0xef87c9['name'];}_0x4a1630[_0xc771('0x19')](_0x3b8c75)[_0xc771('0x2a')](_0xef87c9);};}exports[_0xc771('0x2b')]=function(_0x546bbc,_0x15d1c6){var _0x3a4510={},_0x2a63f5={},_0x18475e={'count':0x0,'rows':[]};var _0x13ea80=_[_0xc771('0x2c')](db[_0xc771('0x2d')][_0xc771('0x2e')],function(_0x20ba6c){return{'name':_0x20ba6c['fieldName'],'type':_0x20ba6c['type'][_0xc771('0x2f')]};});_0x2a63f5[_0xc771('0x30')]=_['map'](_0x13ea80,_0xc771('0x29'));_0x2a63f5[_0xc771('0x31')]=_[_0xc771('0x32')](_0x546bbc[_0xc771('0x31')]);_0x2a63f5['filters']=_[_0xc771('0x33')](_0x2a63f5[_0xc771('0x30')],_0x2a63f5[_0xc771('0x31')]);_0x3a4510['attributes']=_[_0xc771('0x33')](_0x2a63f5[_0xc771('0x30')],qs[_0xc771('0x34')](_0x546bbc[_0xc771('0x31')]['fields']));_0x3a4510[_0xc771('0x35')]=_0x3a4510[_0xc771('0x35')][_0xc771('0x36')]?_0x3a4510[_0xc771('0x35')]:_0x2a63f5[_0xc771('0x30')];if(!_0x546bbc[_0xc771('0x31')]['hasOwnProperty'](_0xc771('0x37'))){_0x3a4510['limit']=qs[_0xc771('0x1e')](_0x546bbc[_0xc771('0x31')][_0xc771('0x1e')]);_0x3a4510['offset']=qs['offset'](_0x546bbc[_0xc771('0x31')][_0xc771('0x1c')]);}_0x3a4510[_0xc771('0x38')]=qs['sort'](_0x546bbc[_0xc771('0x31')][_0xc771('0x39')]);_0x3a4510['where']=qs[_0xc771('0x3a')](_['pick'](_0x546bbc[_0xc771('0x31')],_0x2a63f5['filters']),_0x13ea80);if(_0x546bbc['query'][_0xc771('0x3b')]){_0x3a4510[_0xc771('0x3c')]=_[_0xc771('0x3d')](_0x3a4510[_0xc771('0x3c')],{'$or':_[_0xc771('0x2c')](_0x13ea80,function(_0x24c67f){if(_0x24c67f[_0xc771('0x3e')]!==_0xc771('0x3f')){var _0x39b457={};_0x39b457[_0x24c67f[_0xc771('0x29')]]={'$like':'%'+_0x546bbc[_0xc771('0x31')][_0xc771('0x3b')]+'%'};return _0x39b457;}})});}_0x3a4510=_[_0xc771('0x3d')]({},_0x3a4510,_0x546bbc[_0xc771('0x40')]);var _0x29ba8f={'where':_0x3a4510[_0xc771('0x3c')]};return db[_0xc771('0x2d')][_0xc771('0x1f')](_0x29ba8f)['then'](function(_0x12a205){_0x18475e['count']=_0x12a205;if(_0x546bbc[_0xc771('0x31')][_0xc771('0x41')]){_0x3a4510[_0xc771('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xc771('0x43')](_0x3a4510);})[_0xc771('0x26')](function(_0x1baf4b){_0x18475e[_0xc771('0x44')]=_0x1baf4b;return _0x18475e;})['then'](respondWithFilteredResult(_0x15d1c6,_0x3a4510))['catch'](handleError(_0x15d1c6,null));};exports['show']=function(_0x176c62,_0x1cf143){var _0x23b36c={'raw':!![],'where':{'id':_0x176c62['params']['id']}},_0x17feae={};_0x17feae['model']=_['keys'](db[_0xc771('0x2d')][_0xc771('0x2e')]);_0x17feae[_0xc771('0x31')]=_[_0xc771('0x32')](_0x176c62['query']);_0x17feae[_0xc771('0x3a')]=_['intersection'](_0x17feae[_0xc771('0x30')],_0x17feae[_0xc771('0x31')]);_0x23b36c['attributes']=_[_0xc771('0x33')](_0x17feae['model'],qs['fields'](_0x176c62['query'][_0xc771('0x34')]));_0x23b36c[_0xc771('0x35')]=_0x23b36c[_0xc771('0x35')]['length']?_0x23b36c['attributes']:_0x17feae['model'];if(_0x176c62[_0xc771('0x31')]['includeAll']){_0x23b36c['include']=[{'all':!![]}];}_0x23b36c=_[_0xc771('0x3d')]({},_0x23b36c,_0x176c62['options']);return db[_0xc771('0x2d')][_0xc771('0x45')](_0x23b36c)[_0xc771('0x26')](handleEntityNotFound(_0x1cf143,null))['then'](respondWithResult(_0x1cf143,null))[_0xc771('0x46')](handleError(_0x1cf143,null));};exports[_0xc771('0x47')]=function(_0xc1ade5,_0x575664){return db['JscriptyQuestionReport'][_0xc771('0x47')](_0xc1ade5['body'],{})[_0xc771('0x26')](respondWithResult(_0x575664,0xc9))[_0xc771('0x46')](handleError(_0x575664,null));};exports[_0xc771('0x48')]=function(_0x46f8ed,_0x233281){if(_0x46f8ed[_0xc771('0x49')]['id']){delete _0x46f8ed[_0xc771('0x49')]['id'];}return db[_0xc771('0x2d')]['find']({'where':{'id':_0x46f8ed[_0xc771('0x4a')]['id']}})[_0xc771('0x26')](handleEntityNotFound(_0x233281,null))[_0xc771('0x26')](saveUpdates(_0x46f8ed[_0xc771('0x49')],null))['then'](respondWithResult(_0x233281,null))[_0xc771('0x46')](handleError(_0x233281,null));};exports[_0xc771('0x25')]=function(_0x6e6b75,_0x5643ce){return db['JscriptyQuestionReport'][_0xc771('0x45')]({'where':{'id':_0x6e6b75[_0xc771('0x4a')]['id']}})[_0xc771('0x26')](handleEntityNotFound(_0x5643ce,null))[_0xc771('0x26')](removeEntity(_0x5643ce,null))['catch'](handleError(_0x5643ce,null));};exports['describe']=function(_0x2472e9,_0x251fa7){return db[_0xc771('0x2d')][_0xc771('0x4b')]()[_0xc771('0x26')](respondWithResult(_0x251fa7,null))[_0xc771('0x46')](handleError(_0x251fa7,null));}; \ No newline at end of file +var _0xf51d=['params','describe','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','end','error','stack','send','JscriptyQuestionReport','rawAttributes','map','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','find','create','body'];(function(_0x9192e6,_0x206608){var _0x394628=function(_0x1e39be){while(--_0x1e39be){_0x9192e6['push'](_0x9192e6['shift']());}};_0x394628(++_0x206608);}(_0xf51d,0x94));var _0xdf51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf51d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf51('0x0'));var zipdir=require(_0xdf51('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf51('0x2'));var moment=require('moment');var BPromise=require(_0xdf51('0x3'));var Mustache=require('mustache');var util=require(_0xdf51('0x4'));var path=require(_0xdf51('0x5'));var sox=require(_0xdf51('0x6'));var csv=require(_0xdf51('0x7'));var ejs=require(_0xdf51('0x8'));var fs=require('fs');var fs_extra=require(_0xdf51('0x9'));var _=require(_0xdf51('0xa'));var squel=require(_0xdf51('0xb'));var crypto=require(_0xdf51('0xc'));var jsforce=require(_0xdf51('0xd'));var deskjs=require(_0xdf51('0xe'));var toCsv=require(_0xdf51('0x7'));var querystring=require(_0xdf51('0xf'));var Papa=require('papaparse');var Redis=require(_0xdf51('0x10'));var authService=require(_0xdf51('0x11'));var qs=require(_0xdf51('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf51('0x13'));var logger=require('../../config/logger')(_0xdf51('0x14'));var utils=require(_0xdf51('0x15'));var config=require(_0xdf51('0x16'));var licenseUtil=require(_0xdf51('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e6791,_0x3da3fc){_0x3da3fc=_0x3da3fc||0xcc;return function(_0x19c686){if(_0x19c686){return _0x2e6791[_0xdf51('0x18')](_0x3da3fc);}return _0x2e6791[_0xdf51('0x19')](_0x3da3fc)['end']();};}function respondWithResult(_0x211bbb,_0x551123){_0x551123=_0x551123||0xc8;return function(_0x4c307c){if(_0x4c307c){return _0x211bbb[_0xdf51('0x19')](_0x551123)[_0xdf51('0x1a')](_0x4c307c);}};}function respondWithFilteredResult(_0x5c6820,_0x92a588){return function(_0x220105){if(_0x220105){var _0x353786=typeof _0x92a588['offset']===_0xdf51('0x1b')&&typeof _0x92a588[_0xdf51('0x1c')]===_0xdf51('0x1b');var _0x290c31=_0x220105['count'];var _0x518bb1=_0x353786?0x0:_0x92a588['offset'];var _0x4e1a09=_0x353786?_0x220105[_0xdf51('0x1d')]:_0x92a588[_0xdf51('0x1e')]+_0x92a588['limit'];var _0x1d5b71;if(_0x4e1a09>=_0x290c31){_0x4e1a09=_0x290c31;_0x1d5b71=0xc8;}else{_0x1d5b71=0xce;}_0x5c6820[_0xdf51('0x19')](_0x1d5b71);return _0x5c6820[_0xdf51('0x1f')](_0xdf51('0x20'),_0x518bb1+'-'+_0x4e1a09+'/'+_0x290c31)[_0xdf51('0x1a')](_0x220105);}return null;};}function patchUpdates(_0x12d906){return function(_0x21c619){try{jsonpatch['apply'](_0x21c619,_0x12d906,!![]);}catch(_0x4458f9){return BPromise[_0xdf51('0x21')](_0x4458f9);}return _0x21c619[_0xdf51('0x22')]();};}function saveUpdates(_0x49179f,_0x274ae3){return function(_0x2b4396){if(_0x2b4396){return _0x2b4396[_0xdf51('0x23')](_0x49179f)[_0xdf51('0x24')](function(_0x28aaf2){return _0x28aaf2;});}return null;};}function removeEntity(_0x7aae47,_0x5d6193){return function(_0x54e4cd){if(_0x54e4cd){return _0x54e4cd[_0xdf51('0x25')]()['then'](function(){_0x7aae47[_0xdf51('0x19')](0xcc)[_0xdf51('0x26')]();});}};}function handleEntityNotFound(_0x33a176,_0x1cfc1b){return function(_0x2d6b0a){if(!_0x2d6b0a){_0x33a176[_0xdf51('0x18')](0x194);}return _0x2d6b0a;};}function handleError(_0x2eecff,_0x7b721d){_0x7b721d=_0x7b721d||0x1f4;return function(_0x772bb9){logger[_0xdf51('0x27')](_0x772bb9[_0xdf51('0x28')]);if(_0x772bb9['name']){delete _0x772bb9['name'];}_0x2eecff['status'](_0x7b721d)[_0xdf51('0x29')](_0x772bb9);};}exports['index']=function(_0x1d9b6f,_0x4630a8){var _0x1874ef={},_0x54db83={},_0x34cca2={'count':0x0,'rows':[]};var _0x582aa6=_['map'](db[_0xdf51('0x2a')][_0xdf51('0x2b')],function(_0x3f68f2){return{'name':_0x3f68f2['fieldName'],'type':_0x3f68f2['type']['key']};});_0x54db83['model']=_[_0xdf51('0x2c')](_0x582aa6,_0xdf51('0x2d'));_0x54db83[_0xdf51('0x2e')]=_[_0xdf51('0x2f')](_0x1d9b6f[_0xdf51('0x2e')]);_0x54db83[_0xdf51('0x30')]=_[_0xdf51('0x31')](_0x54db83[_0xdf51('0x32')],_0x54db83['query']);_0x1874ef[_0xdf51('0x33')]=_[_0xdf51('0x31')](_0x54db83['model'],qs[_0xdf51('0x34')](_0x1d9b6f['query'][_0xdf51('0x34')]));_0x1874ef[_0xdf51('0x33')]=_0x1874ef[_0xdf51('0x33')][_0xdf51('0x35')]?_0x1874ef['attributes']:_0x54db83[_0xdf51('0x32')];if(!_0x1d9b6f[_0xdf51('0x2e')][_0xdf51('0x36')](_0xdf51('0x37'))){_0x1874ef[_0xdf51('0x1c')]=qs[_0xdf51('0x1c')](_0x1d9b6f['query'][_0xdf51('0x1c')]);_0x1874ef[_0xdf51('0x1e')]=qs[_0xdf51('0x1e')](_0x1d9b6f[_0xdf51('0x2e')][_0xdf51('0x1e')]);}_0x1874ef[_0xdf51('0x38')]=qs[_0xdf51('0x39')](_0x1d9b6f[_0xdf51('0x2e')][_0xdf51('0x39')]);_0x1874ef[_0xdf51('0x3a')]=qs[_0xdf51('0x30')](_['pick'](_0x1d9b6f[_0xdf51('0x2e')],_0x54db83[_0xdf51('0x30')]),_0x582aa6);if(_0x1d9b6f[_0xdf51('0x2e')][_0xdf51('0x3b')]){_0x1874ef[_0xdf51('0x3a')]=_[_0xdf51('0x3c')](_0x1874ef[_0xdf51('0x3a')],{'$or':_[_0xdf51('0x2c')](_0x582aa6,function(_0x288f11){if(_0x288f11[_0xdf51('0x3d')]!==_0xdf51('0x3e')){var _0x1bd5af={};_0x1bd5af[_0x288f11[_0xdf51('0x2d')]]={'$like':'%'+_0x1d9b6f[_0xdf51('0x2e')][_0xdf51('0x3b')]+'%'};return _0x1bd5af;}})});}_0x1874ef=_[_0xdf51('0x3c')]({},_0x1874ef,_0x1d9b6f['options']);var _0x4b3a12={'where':_0x1874ef[_0xdf51('0x3a')]};return db['JscriptyQuestionReport'][_0xdf51('0x1d')](_0x4b3a12)[_0xdf51('0x24')](function(_0xf09a68){_0x34cca2[_0xdf51('0x1d')]=_0xf09a68;if(_0x1d9b6f['query'][_0xdf51('0x3f')]){_0x1874ef[_0xdf51('0x40')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xdf51('0x41')](_0x1874ef);})[_0xdf51('0x24')](function(_0x2ff58d){_0x34cca2[_0xdf51('0x42')]=_0x2ff58d;return _0x34cca2;})[_0xdf51('0x24')](respondWithFilteredResult(_0x4630a8,_0x1874ef))[_0xdf51('0x43')](handleError(_0x4630a8,null));};exports['show']=function(_0x2220bb,_0x2dd46a){var _0x3f459e={'raw':!![],'where':{'id':_0x2220bb['params']['id']}},_0x9225b5={};_0x9225b5[_0xdf51('0x32')]=_[_0xdf51('0x2f')](db[_0xdf51('0x2a')][_0xdf51('0x2b')]);_0x9225b5[_0xdf51('0x2e')]=_[_0xdf51('0x2f')](_0x2220bb[_0xdf51('0x2e')]);_0x9225b5[_0xdf51('0x30')]=_[_0xdf51('0x31')](_0x9225b5[_0xdf51('0x32')],_0x9225b5[_0xdf51('0x2e')]);_0x3f459e[_0xdf51('0x33')]=_[_0xdf51('0x31')](_0x9225b5[_0xdf51('0x32')],qs['fields'](_0x2220bb[_0xdf51('0x2e')][_0xdf51('0x34')]));_0x3f459e['attributes']=_0x3f459e[_0xdf51('0x33')]['length']?_0x3f459e[_0xdf51('0x33')]:_0x9225b5[_0xdf51('0x32')];if(_0x2220bb['query'][_0xdf51('0x3f')]){_0x3f459e['include']=[{'all':!![]}];}_0x3f459e=_[_0xdf51('0x3c')]({},_0x3f459e,_0x2220bb['options']);return db[_0xdf51('0x2a')][_0xdf51('0x44')](_0x3f459e)['then'](handleEntityNotFound(_0x2dd46a,null))['then'](respondWithResult(_0x2dd46a,null))[_0xdf51('0x43')](handleError(_0x2dd46a,null));};exports[_0xdf51('0x45')]=function(_0x5c66cb,_0x56f765){return db[_0xdf51('0x2a')]['create'](_0x5c66cb[_0xdf51('0x46')],{})[_0xdf51('0x24')](respondWithResult(_0x56f765,0xc9))[_0xdf51('0x43')](handleError(_0x56f765,null));};exports[_0xdf51('0x23')]=function(_0x20a285,_0x5e5e46){if(_0x20a285[_0xdf51('0x46')]['id']){delete _0x20a285[_0xdf51('0x46')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x20a285[_0xdf51('0x47')]['id']}})[_0xdf51('0x24')](handleEntityNotFound(_0x5e5e46,null))['then'](saveUpdates(_0x20a285['body'],null))[_0xdf51('0x24')](respondWithResult(_0x5e5e46,null))['catch'](handleError(_0x5e5e46,null));};exports['destroy']=function(_0x2fed2f,_0x2b7d31){return db[_0xdf51('0x2a')][_0xdf51('0x44')]({'where':{'id':_0x2fed2f[_0xdf51('0x47')]['id']}})[_0xdf51('0x24')](handleEntityNotFound(_0x2b7d31,null))['then'](removeEntity(_0x2b7d31,null))[_0xdf51('0x43')](handleError(_0x2b7d31,null));};exports[_0xdf51('0x48')]=function(_0x12b25a,_0x34bd17){return db[_0xdf51('0x2a')][_0xdf51('0x48')]()[_0xdf51('0x24')](respondWithResult(_0x34bd17,null))[_0xdf51('0x43')](handleError(_0x34bd17,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index fb6c404..b1e166b 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 _0xd609=['report_jscripty_questions','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x43b2aa,_0x38c827){var _0x1765da=function(_0x29e14c){while(--_0x29e14c){_0x43b2aa['push'](_0x43b2aa['shift']());}};_0x1765da(++_0x38c827);}(_0xd609,0x1c9));var _0x9d60=function(_0x53dbb4,_0x148a94){_0x53dbb4=_0x53dbb4-0x0;var _0x588358=_0xd609[_0x53dbb4];return _0x588358;};'use strict';var _=require('lodash');var util=require(_0x9d60('0x0'));var logger=require(_0x9d60('0x1'))(_0x9d60('0x2'));var moment=require('moment');var BPromise=require(_0x9d60('0x3'));var rp=require(_0x9d60('0x4'));var fs=require('fs');var path=require(_0x9d60('0x5'));var rimraf=require('rimraf');var config=require(_0x9d60('0x6'));var attributes=require(_0x9d60('0x7'));module[_0x9d60('0x8')]=function(_0x101325,_0xe313dd){return _0x101325[_0x9d60('0x9')](_0x9d60('0xa'),attributes,{'tableName':_0x9d60('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4c1=['exports','define','JscriptyQuestionReport','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x4dfe12,_0x59c69f){var _0x465909=function(_0x140308){while(--_0x140308){_0x4dfe12['push'](_0x4dfe12['shift']());}};_0x465909(++_0x59c69f);}(_0xd4c1,0xdb));var _0x1d4c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4c1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1d4c('0x0'));var util=require(_0x1d4c('0x1'));var logger=require(_0x1d4c('0x2'))(_0x1d4c('0x3'));var moment=require('moment');var BPromise=require(_0x1d4c('0x4'));var rp=require(_0x1d4c('0x5'));var fs=require('fs');var path=require(_0x1d4c('0x6'));var rimraf=require('rimraf');var config=require(_0x1d4c('0x7'));var attributes=require(_0x1d4c('0x8'));module[_0x1d4c('0x9')]=function(_0x4cf3d8,_0x5e427f){return _0x4cf3d8[_0x1d4c('0xa')](_0x1d4c('0xb'),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 c4ab427..5a8bd63 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 _0x26f5=['jayson/promise','request','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3221be,_0x3ae273){var _0x1d68c6=function(_0x4136af){while(--_0x4136af){_0x3221be['push'](_0x3221be['shift']());}};_0x1d68c6(++_0x3ae273);}(_0x26f5,0xdf));var _0x526f=function(_0x1f4746,_0x42f608){_0x1f4746=_0x1f4746-0x0;var _0xe263d2=_0x26f5[_0x1f4746];return _0xe263d2;};'use strict';var _=require(_0x526f('0x0'));var util=require(_0x526f('0x1'));var moment=require('moment');var BPromise=require(_0x526f('0x2'));var rs=require(_0x526f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x526f('0x4'))['db'];var utils=require(_0x526f('0x5'));var logger=require('../../config/logger')(_0x526f('0x6'));var config=require(_0x526f('0x7'));var jayson=require(_0x526f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32c741,_0x240c9e,_0x274960){return new BPromise(function(_0x5e3678,_0x1d6585){return client[_0x526f('0x9')](_0x32c741,_0x274960)['then'](function(_0x7fcb9a){logger[_0x526f('0xa')](_0x526f('0xb'),_0x240c9e,'request\x20sent');logger[_0x526f('0xc')](_0x526f('0xd'),_0x240c9e,_0x526f('0xe'),JSON[_0x526f('0xf')](_0x7fcb9a));if(_0x7fcb9a['error']){if(_0x7fcb9a[_0x526f('0x10')][_0x526f('0x11')]===0x1f4){logger[_0x526f('0x10')](_0x526f('0xb'),_0x240c9e,_0x7fcb9a[_0x526f('0x10')][_0x526f('0x12')]);return _0x1d6585(_0x7fcb9a[_0x526f('0x10')]['message']);}logger[_0x526f('0x10')](_0x526f('0xb'),_0x240c9e,_0x7fcb9a[_0x526f('0x10')][_0x526f('0x12')]);return _0x5e3678(_0x7fcb9a[_0x526f('0x10')][_0x526f('0x12')]);}else{logger['info'](_0x526f('0xb'),_0x240c9e,_0x526f('0xe'));_0x5e3678(_0x7fcb9a[_0x526f('0x13')][_0x526f('0x12')]);}})[_0x526f('0x14')](function(_0x23243d){logger[_0x526f('0x10')](_0x526f('0xb'),_0x240c9e,_0x23243d);_0x1d6585(_0x23243d);});});} \ No newline at end of file +var _0x2b14=['info','result','catch','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x2b14,0x1cf));var _0x42b1=function(_0x16275f,_0x566e5f){_0x16275f=_0x16275f-0x0;var _0x569c51=_0x2b14[_0x16275f];return _0x569c51;};'use strict';var _=require(_0x42b1('0x0'));var util=require(_0x42b1('0x1'));var moment=require(_0x42b1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x42b1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x42b1('0x4'))(_0x42b1('0x5'));var config=require(_0x42b1('0x6'));var jayson=require(_0x42b1('0x7'));var client=jayson[_0x42b1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41c62e,_0x3e434c,_0x3740df){return new BPromise(function(_0x176c4d,_0x4cf7ca){return client['request'](_0x41c62e,_0x3740df)['then'](function(_0x5bf178){logger['info'](_0x42b1('0x9'),_0x3e434c,_0x42b1('0xa'));logger[_0x42b1('0xb')](_0x42b1('0xc'),_0x3e434c,_0x42b1('0xa'),JSON[_0x42b1('0xd')](_0x5bf178));if(_0x5bf178[_0x42b1('0xe')]){if(_0x5bf178['error'][_0x42b1('0xf')]===0x1f4){logger[_0x42b1('0xe')](_0x42b1('0x9'),_0x3e434c,_0x5bf178['error'][_0x42b1('0x10')]);return _0x4cf7ca(_0x5bf178[_0x42b1('0xe')][_0x42b1('0x10')]);}logger['error'](_0x42b1('0x9'),_0x3e434c,_0x5bf178[_0x42b1('0xe')][_0x42b1('0x10')]);return _0x176c4d(_0x5bf178['error'][_0x42b1('0x10')]);}else{logger[_0x42b1('0x11')](_0x42b1('0x9'),_0x3e434c,'request\x20sent');_0x176c4d(_0x5bf178[_0x42b1('0x12')]['message']);}})[_0x42b1('0x13')](function(_0x35fd74){logger['error'](_0x42b1('0x9'),_0x3e434c,_0x35fd74);_0x4cf7ca(_0x35fd74);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index fea2937..ca6bede 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 _0xa311=['put','update','delete','destroy','exports','multer','path','express','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','/describe','describe','/:id','show','get','/:id/questions','getQuestions','post'];(function(_0x558eb1,_0x502908){var _0x2f0b9e=function(_0x1e01f1){while(--_0x1e01f1){_0x558eb1['push'](_0x558eb1['shift']());}};_0x2f0b9e(++_0x502908);}(_0xa311,0x1be));var _0x1a31=function(_0x24fa1a,_0x16d9c2){_0x24fa1a=_0x24fa1a-0x0;var _0xc5621f=_0xa311[_0x24fa1a];return _0xc5621f;};'use strict';var multer=require(_0x1a31('0x0'));var util=require('util');var path=require(_0x1a31('0x1'));var timeout=require('connect-timeout');var express=require(_0x1a31('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1a31('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1a31('0x4'));var controller=require(_0x1a31('0x5'));router['get']('/',auth[_0x1a31('0x6')](),controller[_0x1a31('0x7')]);router['get'](_0x1a31('0x8'),auth[_0x1a31('0x6')](),controller[_0x1a31('0x9')]);router['get'](_0x1a31('0xa'),auth[_0x1a31('0x6')](),controller[_0x1a31('0xb')]);router[_0x1a31('0xc')](_0x1a31('0xd'),auth[_0x1a31('0x6')](),controller[_0x1a31('0xe')]);router[_0x1a31('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1a31('0x10')](_0x1a31('0xa'),auth[_0x1a31('0x6')](),controller[_0x1a31('0x11')]);router[_0x1a31('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x1a31('0x13')]);module[_0x1a31('0x14')]=router; \ No newline at end of file +var _0x7861=['get','isAuthenticated','index','/describe','/:id','/:id/questions','post','create','put','update','delete','destroy','exports','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller'];(function(_0x3d0855,_0x10957f){var _0x2d90d4=function(_0x1cbaf0){while(--_0x1cbaf0){_0x3d0855['push'](_0x3d0855['shift']());}};_0x2d90d4(++_0x10957f);}(_0x7861,0x175));var _0x1786=function(_0x4e14bc,_0x4dc1c6){_0x4e14bc=_0x4e14bc-0x0;var _0x569489=_0x7861[_0x4e14bc];return _0x569489;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1786('0x0'));var router=express['Router']();var fs_extra=require(_0x1786('0x1'));var auth=require(_0x1786('0x2'));var interaction=require(_0x1786('0x3'));var config=require('../../config/environment');var controller=require(_0x1786('0x4'));router[_0x1786('0x5')]('/',auth[_0x1786('0x6')](),controller[_0x1786('0x7')]);router[_0x1786('0x5')](_0x1786('0x8'),auth[_0x1786('0x6')](),controller['describe']);router['get'](_0x1786('0x9'),auth[_0x1786('0x6')](),controller['show']);router[_0x1786('0x5')](_0x1786('0xa'),auth[_0x1786('0x6')](),controller['getQuestions']);router[_0x1786('0xb')]('/',auth['isAuthenticated'](),controller[_0x1786('0xc')]);router[_0x1786('0xd')](_0x1786('0x9'),auth[_0x1786('0x6')](),controller[_0x1786('0xe')]);router[_0x1786('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x1786('0x10')]);module[_0x1786('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 86301f2..139ab37 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 _0x2272=['moment','sequelize','exports','DATE','starttime','setDataValue','endtime','STRING','BOOLEAN'];(function(_0x3ea24d,_0x42821a){var _0x5098ef=function(_0x12564c){while(--_0x12564c){_0x3ea24d['push'](_0x3ea24d['shift']());}};_0x5098ef(++_0x42821a);}(_0x2272,0xd8));var _0x2227=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2272[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x2227('0x0'));var Sequelize=require(_0x2227('0x1'));module[_0x2227('0x2')]={'starttime':{'type':Sequelize[_0x2227('0x3')],'set':function(_0x42152f){this['setDataValue'](_0x2227('0x4'),_0x42152f);this[_0x2227('0x5')](_0x2227('0x6'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x2227('0x3')]},'membername':{'type':Sequelize[_0x2227('0x7')]},'projectname':{'type':Sequelize[_0x2227('0x7')]},'queue':{'type':Sequelize[_0x2227('0x7')]},'uniqueid':{'type':Sequelize[_0x2227('0x7')]},'calleridname':{'type':Sequelize[_0x2227('0x7')]},'calleridnum':{'type':Sequelize[_0x2227('0x7')]},'completed':{'type':Sequelize[_0x2227('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x15e9=['DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x15e9,0xd6));var _0x915e=function(_0xbd8612,_0x4684bd){_0xbd8612=_0xbd8612-0x0;var _0x51aa1c=_0x15e9[_0xbd8612];return _0x51aa1c;};'use strict';var moment=require(_0x915e('0x0'));var Sequelize=require(_0x915e('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x915e('0x2')],'set':function(_0x28a224){this[_0x915e('0x3')](_0x915e('0x4'),_0x28a224);this[_0x915e('0x3')](_0x915e('0x5'),moment()['format'](_0x915e('0x6')));}},'endtime':{'type':Sequelize[_0x915e('0x2')]},'membername':{'type':Sequelize[_0x915e('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x915e('0x7')]},'uniqueid':{'type':Sequelize[_0x915e('0x7')]},'calleridname':{'type':Sequelize[_0x915e('0x7')]},'calleridnum':{'type':Sequelize[_0x915e('0x7')]},'completed':{'type':Sequelize[_0x915e('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 896f0cf..4038501 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 _0x49e0=['query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','JscriptySessionReport','includeAll','include','rows','catch','show','length','find','create','body','update','params','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x2cbc53,_0x3237ea){var _0x262f5c=function(_0x1046c0){while(--_0x1046c0){_0x2cbc53['push'](_0x2cbc53['shift']());}};_0x262f5c(++_0x3237ea);}(_0x49e0,0xca));var _0x049e=function(_0x3900d1,_0x82a7ac){_0x3900d1=_0x3900d1-0x0;var _0x229de2=_0x49e0[_0x3900d1];return _0x229de2;};'use strict';var emlformat=require(_0x049e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x049e('0x1'));var jsonpatch=require(_0x049e('0x2'));var rp=require(_0x049e('0x3'));var moment=require(_0x049e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x049e('0x5'));var util=require(_0x049e('0x6'));var path=require(_0x049e('0x7'));var sox=require(_0x049e('0x8'));var csv=require(_0x049e('0x9'));var ejs=require(_0x049e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x049e('0xb'));var squel=require(_0x049e('0xc'));var crypto=require(_0x049e('0xd'));var jsforce=require(_0x049e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x049e('0x9'));var querystring=require('querystring');var Papa=require(_0x049e('0xf'));var Redis=require(_0x049e('0x10'));var authService=require(_0x049e('0x11'));var qs=require(_0x049e('0x12'));var as=require(_0x049e('0x13'));var hardwareService=require(_0x049e('0x14'));var logger=require(_0x049e('0x15'))(_0x049e('0x16'));var utils=require(_0x049e('0x17'));var config=require(_0x049e('0x18'));var licenseUtil=require(_0x049e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43f48b,_0x263994){_0x263994=_0x263994||0xcc;return function(_0x1eb402){if(_0x1eb402){return _0x43f48b[_0x049e('0x1a')](_0x263994);}return _0x43f48b['status'](_0x263994)[_0x049e('0x1b')]();};}function respondWithResult(_0xa20537,_0x30994c){_0x30994c=_0x30994c||0xc8;return function(_0x2f123f){if(_0x2f123f){return _0xa20537[_0x049e('0x1c')](_0x30994c)[_0x049e('0x1d')](_0x2f123f);}};}function respondWithFilteredResult(_0x48f93c,_0x209db3){return function(_0x473241){if(_0x473241){var _0x3ddd89=typeof _0x209db3[_0x049e('0x1e')]===_0x049e('0x1f')&&typeof _0x209db3['limit']===_0x049e('0x1f');var _0x4691dc=_0x473241[_0x049e('0x20')];var _0x459cc9=_0x3ddd89?0x0:_0x209db3[_0x049e('0x1e')];var _0x42d052=_0x3ddd89?_0x473241[_0x049e('0x20')]:_0x209db3[_0x049e('0x1e')]+_0x209db3[_0x049e('0x21')];var _0x5c90c4;if(_0x42d052>=_0x4691dc){_0x42d052=_0x4691dc;_0x5c90c4=0xc8;}else{_0x5c90c4=0xce;}_0x48f93c[_0x049e('0x1c')](_0x5c90c4);return _0x48f93c[_0x049e('0x22')](_0x049e('0x23'),_0x459cc9+'-'+_0x42d052+'/'+_0x4691dc)[_0x049e('0x1d')](_0x473241);}return null;};}function patchUpdates(_0x83c428){return function(_0x145d5c){try{jsonpatch[_0x049e('0x24')](_0x145d5c,_0x83c428,!![]);}catch(_0x4a3542){return BPromise[_0x049e('0x25')](_0x4a3542);}return _0x145d5c[_0x049e('0x26')]();};}function saveUpdates(_0x20af71,_0x5279a4){return function(_0x5e7f73){if(_0x5e7f73){return _0x5e7f73['update'](_0x20af71)[_0x049e('0x27')](function(_0x150ac7){return _0x150ac7;});}return null;};}function removeEntity(_0x27b213,_0x46089d){return function(_0x28aa9d){if(_0x28aa9d){return _0x28aa9d[_0x049e('0x28')]()[_0x049e('0x27')](function(){_0x27b213[_0x049e('0x1c')](0xcc)[_0x049e('0x1b')]();});}};}function handleEntityNotFound(_0x273897,_0x477299){return function(_0x1e8489){if(!_0x1e8489){_0x273897[_0x049e('0x1a')](0x194);}return _0x1e8489;};}function handleError(_0x2fa79d,_0x26d2a1){_0x26d2a1=_0x26d2a1||0x1f4;return function(_0xcdc93e){logger['error'](_0xcdc93e[_0x049e('0x29')]);if(_0xcdc93e[_0x049e('0x2a')]){delete _0xcdc93e[_0x049e('0x2a')];}_0x2fa79d[_0x049e('0x1c')](_0x26d2a1)[_0x049e('0x2b')](_0xcdc93e);};}exports[_0x049e('0x2c')]=function(_0xc35dd1,_0x579606){var _0x1c0ef4={},_0x1f0487={},_0x51c46a={'count':0x0,'rows':[]};var _0x28c366=_[_0x049e('0x2d')](db['JscriptySessionReport'][_0x049e('0x2e')],function(_0x4b94f0){return{'name':_0x4b94f0[_0x049e('0x2f')],'type':_0x4b94f0[_0x049e('0x30')][_0x049e('0x31')]};});_0x1f0487['model']=_['map'](_0x28c366,'name');_0x1f0487[_0x049e('0x32')]=_[_0x049e('0x33')](_0xc35dd1[_0x049e('0x32')]);_0x1f0487['filters']=_[_0x049e('0x34')](_0x1f0487[_0x049e('0x35')],_0x1f0487[_0x049e('0x32')]);_0x1c0ef4[_0x049e('0x36')]=_[_0x049e('0x34')](_0x1f0487['model'],qs[_0x049e('0x37')](_0xc35dd1[_0x049e('0x32')][_0x049e('0x37')]));_0x1c0ef4[_0x049e('0x36')]=_0x1c0ef4['attributes']['length']?_0x1c0ef4[_0x049e('0x36')]:_0x1f0487[_0x049e('0x35')];if(!_0xc35dd1[_0x049e('0x32')][_0x049e('0x38')](_0x049e('0x39'))){_0x1c0ef4[_0x049e('0x21')]=qs['limit'](_0xc35dd1[_0x049e('0x32')][_0x049e('0x21')]);_0x1c0ef4[_0x049e('0x1e')]=qs[_0x049e('0x1e')](_0xc35dd1[_0x049e('0x32')]['offset']);}_0x1c0ef4[_0x049e('0x3a')]=qs[_0x049e('0x3b')](_0xc35dd1['query'][_0x049e('0x3b')]);_0x1c0ef4[_0x049e('0x3c')]=qs[_0x049e('0x3d')](_[_0x049e('0x3e')](_0xc35dd1[_0x049e('0x32')],_0x1f0487[_0x049e('0x3d')]),_0x28c366);if(_0xc35dd1['query']['filter']){_0x1c0ef4[_0x049e('0x3c')]=_[_0x049e('0x3f')](_0x1c0ef4[_0x049e('0x3c')],{'$or':_['map'](_0x28c366,function(_0x5b9ce7){if(_0x5b9ce7['type']!==_0x049e('0x40')){var _0x5b4e25={};_0x5b4e25[_0x5b9ce7['name']]={'$like':'%'+_0xc35dd1[_0x049e('0x32')][_0x049e('0x41')]+'%'};return _0x5b4e25;}})});}_0x1c0ef4=_['merge']({},_0x1c0ef4,_0xc35dd1[_0x049e('0x42')]);var _0x4a05e0={'where':_0x1c0ef4['where']};return db[_0x049e('0x43')][_0x049e('0x20')](_0x4a05e0)['then'](function(_0x3b324b){_0x51c46a[_0x049e('0x20')]=_0x3b324b;if(_0xc35dd1[_0x049e('0x32')][_0x049e('0x44')]){_0x1c0ef4[_0x049e('0x45')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x1c0ef4);})[_0x049e('0x27')](function(_0x9d34b8){_0x51c46a[_0x049e('0x46')]=_0x9d34b8;return _0x51c46a;})[_0x049e('0x27')](respondWithFilteredResult(_0x579606,_0x1c0ef4))[_0x049e('0x47')](handleError(_0x579606,null));};exports[_0x049e('0x48')]=function(_0x3d9261,_0x8d9a72){var _0x1915f8={'raw':!![],'where':{'id':_0x3d9261['params']['id']}},_0x5e885b={};_0x5e885b[_0x049e('0x35')]=_[_0x049e('0x33')](db[_0x049e('0x43')]['rawAttributes']);_0x5e885b[_0x049e('0x32')]=_['keys'](_0x3d9261[_0x049e('0x32')]);_0x5e885b[_0x049e('0x3d')]=_['intersection'](_0x5e885b[_0x049e('0x35')],_0x5e885b['query']);_0x1915f8[_0x049e('0x36')]=_['intersection'](_0x5e885b[_0x049e('0x35')],qs[_0x049e('0x37')](_0x3d9261['query'][_0x049e('0x37')]));_0x1915f8['attributes']=_0x1915f8['attributes'][_0x049e('0x49')]?_0x1915f8[_0x049e('0x36')]:_0x5e885b['model'];if(_0x3d9261[_0x049e('0x32')][_0x049e('0x44')]){_0x1915f8[_0x049e('0x45')]=[{'all':!![]}];}_0x1915f8=_[_0x049e('0x3f')]({},_0x1915f8,_0x3d9261[_0x049e('0x42')]);return db[_0x049e('0x43')][_0x049e('0x4a')](_0x1915f8)[_0x049e('0x27')](handleEntityNotFound(_0x8d9a72,null))[_0x049e('0x27')](respondWithResult(_0x8d9a72,null))[_0x049e('0x47')](handleError(_0x8d9a72,null));};exports[_0x049e('0x4b')]=function(_0x244b7c,_0x534550){return db[_0x049e('0x43')][_0x049e('0x4b')](_0x244b7c[_0x049e('0x4c')],{})[_0x049e('0x27')](respondWithResult(_0x534550,0xc9))[_0x049e('0x47')](handleError(_0x534550,null));};exports[_0x049e('0x4d')]=function(_0x1a96c4,_0x5c4f72){if(_0x1a96c4[_0x049e('0x4c')]['id']){delete _0x1a96c4[_0x049e('0x4c')]['id'];}return db[_0x049e('0x43')][_0x049e('0x4a')]({'where':{'id':_0x1a96c4[_0x049e('0x4e')]['id']}})[_0x049e('0x27')](handleEntityNotFound(_0x5c4f72,null))[_0x049e('0x27')](saveUpdates(_0x1a96c4[_0x049e('0x4c')],null))[_0x049e('0x27')](respondWithResult(_0x5c4f72,null))[_0x049e('0x47')](handleError(_0x5c4f72,null));};exports[_0x049e('0x28')]=function(_0x12c615,_0x5bc74f){return db[_0x049e('0x43')][_0x049e('0x4a')]({'where':{'id':_0x12c615[_0x049e('0x4e')]['id']}})[_0x049e('0x27')](handleEntityNotFound(_0x5bc74f,null))['then'](removeEntity(_0x5bc74f,null))[_0x049e('0x47')](handleError(_0x5bc74f,null));};exports[_0x049e('0x4f')]=function(_0x5e68e7,_0xc3ece6){return db[_0x049e('0x43')]['describe']()[_0x049e('0x27')](respondWithResult(_0xc3ece6,null))['catch'](handleError(_0xc3ece6,null));};exports[_0x049e('0x50')]=function(_0x4cbb83,_0x2ca46c,_0x3c8472){var _0x3e9a47={'raw':!![],'where':{}};var _0x1543dc={};var _0xaebdfa={'count':0x0,'rows':[]};return db[_0x049e('0x43')][_0x049e('0x51')]({'where':{'id':_0x4cbb83[_0x049e('0x4e')]['id']}})[_0x049e('0x27')](handleEntityNotFound(_0x2ca46c,null))['then'](function(_0x1691d0){if(_0x1691d0){_0x1543dc[_0x049e('0x35')]=_[_0x049e('0x33')](db[_0x049e('0x52')][_0x049e('0x2e')]);_0x1543dc['query']=_[_0x049e('0x33')](_0x4cbb83[_0x049e('0x32')]);_0x1543dc[_0x049e('0x3d')]=_['intersection'](_0x1543dc['model'],_0x1543dc['query']);_0x3e9a47[_0x049e('0x36')]=_['intersection'](_0x1543dc[_0x049e('0x35')],qs['fields'](_0x4cbb83['query'][_0x049e('0x37')]));_0x3e9a47[_0x049e('0x36')]=_0x3e9a47['attributes'][_0x049e('0x49')]?_0x3e9a47['attributes']:_0x1543dc[_0x049e('0x35')];if(!_0x4cbb83[_0x049e('0x32')][_0x049e('0x38')](_0x049e('0x39'))){_0x3e9a47[_0x049e('0x21')]=qs[_0x049e('0x21')](_0x4cbb83[_0x049e('0x32')][_0x049e('0x21')]);_0x3e9a47[_0x049e('0x1e')]=qs[_0x049e('0x1e')](_0x4cbb83['query'][_0x049e('0x1e')]);}_0x3e9a47[_0x049e('0x3a')]=qs['sort'](_0x4cbb83[_0x049e('0x32')][_0x049e('0x3b')]);_0x3e9a47[_0x049e('0x3c')]=qs['filters'](_[_0x049e('0x3e')](_0x4cbb83[_0x049e('0x32')],_0x1543dc[_0x049e('0x3d')]));_0x3e9a47[_0x049e('0x3c')][_0x049e('0x53')]=_0x1691d0['id'];if(_0x4cbb83[_0x049e('0x32')][_0x049e('0x41')]){_0x3e9a47[_0x049e('0x3c')]=_[_0x049e('0x3f')](_0x3e9a47['where'],{'$or':_[_0x049e('0x2d')](_0x3e9a47[_0x049e('0x36')],function(_0x518b57){var _0x35804e={};_0x35804e[_0x518b57]={'$like':'%'+_0x4cbb83['query'][_0x049e('0x41')]+'%'};return _0x35804e;})});}_0x3e9a47=_[_0x049e('0x3f')]({},_0x3e9a47,_0x4cbb83[_0x049e('0x42')]);return db[_0x049e('0x52')]['count']({'where':_0x3e9a47[_0x049e('0x3c')]})[_0x049e('0x27')](function(_0x56fa52){_0xaebdfa[_0x049e('0x20')]=_0x56fa52;if(_0x4cbb83[_0x049e('0x32')][_0x049e('0x44')]){_0x3e9a47[_0x049e('0x45')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x3e9a47);})[_0x049e('0x27')](function(_0x373f2d){_0xaebdfa[_0x049e('0x46')]=_0x373f2d;return _0xaebdfa;});}})[_0x049e('0x27')](respondWithFilteredResult(_0x2ca46c,_0x3e9a47))[_0x049e('0x47')](handleError(_0x2ca46c,null));}; \ No newline at end of file +var _0x7ef4=['find','body','describe','JscriptyQuestionReport','hasOwnProperty','sort','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','JscriptySessionReport','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','options','count','include','findAll','rows','catch','show','params','keys','includeAll'];(function(_0x13189b,_0x31d86a){var _0x1ec58b=function(_0x5a9a81){while(--_0x5a9a81){_0x13189b['push'](_0x13189b['shift']());}};_0x1ec58b(++_0x31d86a);}(_0x7ef4,0xea));var _0x47ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7ef4[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x47ef('0x0'));var rimraf=require(_0x47ef('0x1'));var zipdir=require(_0x47ef('0x2'));var jsonpatch=require(_0x47ef('0x3'));var rp=require(_0x47ef('0x4'));var moment=require(_0x47ef('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x47ef('0x6'));var sox=require(_0x47ef('0x7'));var csv=require(_0x47ef('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47ef('0x9'));var _=require(_0x47ef('0xa'));var squel=require(_0x47ef('0xb'));var crypto=require(_0x47ef('0xc'));var jsforce=require(_0x47ef('0xd'));var deskjs=require(_0x47ef('0xe'));var toCsv=require('to-csv');var querystring=require(_0x47ef('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x47ef('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x47ef('0x11'));var hardwareService=require(_0x47ef('0x12'));var logger=require(_0x47ef('0x13'))(_0x47ef('0x14'));var utils=require('../../config/utils');var config=require(_0x47ef('0x15'));var licenseUtil=require(_0x47ef('0x16'));var db=require(_0x47ef('0x17'))['db'];function respondWithStatusCode(_0x155256,_0x4e47b9){_0x4e47b9=_0x4e47b9||0xcc;return function(_0x4cd882){if(_0x4cd882){return _0x155256[_0x47ef('0x18')](_0x4e47b9);}return _0x155256[_0x47ef('0x19')](_0x4e47b9)[_0x47ef('0x1a')]();};}function respondWithResult(_0x3a8f6b,_0x2d4e0a){_0x2d4e0a=_0x2d4e0a||0xc8;return function(_0x1b12dc){if(_0x1b12dc){return _0x3a8f6b[_0x47ef('0x19')](_0x2d4e0a)['json'](_0x1b12dc);}};}function respondWithFilteredResult(_0x5549d5,_0x46466c){return function(_0x3a213f){if(_0x3a213f){var _0x33c386=typeof _0x46466c[_0x47ef('0x1b')]===_0x47ef('0x1c')&&typeof _0x46466c[_0x47ef('0x1d')]==='undefined';var _0x2386f5=_0x3a213f['count'];var _0x2f26a6=_0x33c386?0x0:_0x46466c[_0x47ef('0x1b')];var _0x1bb17c=_0x33c386?_0x3a213f['count']:_0x46466c[_0x47ef('0x1b')]+_0x46466c[_0x47ef('0x1d')];var _0x31f4d8;if(_0x1bb17c>=_0x2386f5){_0x1bb17c=_0x2386f5;_0x31f4d8=0xc8;}else{_0x31f4d8=0xce;}_0x5549d5['status'](_0x31f4d8);return _0x5549d5[_0x47ef('0x1e')]('Content-Range',_0x2f26a6+'-'+_0x1bb17c+'/'+_0x2386f5)[_0x47ef('0x1f')](_0x3a213f);}return null;};}function patchUpdates(_0x52a820){return function(_0x446f2e){try{jsonpatch[_0x47ef('0x20')](_0x446f2e,_0x52a820,!![]);}catch(_0x1283c3){return BPromise[_0x47ef('0x21')](_0x1283c3);}return _0x446f2e[_0x47ef('0x22')]();};}function saveUpdates(_0x47c84a,_0x1aae61){return function(_0x1dfca9){if(_0x1dfca9){return _0x1dfca9[_0x47ef('0x23')](_0x47c84a)[_0x47ef('0x24')](function(_0x424536){return _0x424536;});}return null;};}function removeEntity(_0x21b722,_0x2a66bd){return function(_0x48ac5f){if(_0x48ac5f){return _0x48ac5f[_0x47ef('0x25')]()[_0x47ef('0x24')](function(){_0x21b722[_0x47ef('0x19')](0xcc)[_0x47ef('0x1a')]();});}};}function handleEntityNotFound(_0xb99a3f,_0x287a3a){return function(_0x2f4893){if(!_0x2f4893){_0xb99a3f[_0x47ef('0x18')](0x194);}return _0x2f4893;};}function handleError(_0x5d8bd5,_0x1c5bf5){_0x1c5bf5=_0x1c5bf5||0x1f4;return function(_0x5e4205){logger[_0x47ef('0x26')](_0x5e4205[_0x47ef('0x27')]);if(_0x5e4205[_0x47ef('0x28')]){delete _0x5e4205[_0x47ef('0x28')];}_0x5d8bd5[_0x47ef('0x19')](_0x1c5bf5)[_0x47ef('0x29')](_0x5e4205);};}exports['index']=function(_0x517f2b,_0x4619f1){var _0x27e17e={},_0xe1e8c2={},_0x1b313c={'count':0x0,'rows':[]};var _0x5a9f8e=_['map'](db[_0x47ef('0x2a')][_0x47ef('0x2b')],function(_0x13492e){return{'name':_0x13492e['fieldName'],'type':_0x13492e[_0x47ef('0x2c')][_0x47ef('0x2d')]};});_0xe1e8c2[_0x47ef('0x2e')]=_[_0x47ef('0x2f')](_0x5a9f8e,'name');_0xe1e8c2[_0x47ef('0x30')]=_['keys'](_0x517f2b[_0x47ef('0x30')]);_0xe1e8c2[_0x47ef('0x31')]=_[_0x47ef('0x32')](_0xe1e8c2[_0x47ef('0x2e')],_0xe1e8c2['query']);_0x27e17e[_0x47ef('0x33')]=_['intersection'](_0xe1e8c2[_0x47ef('0x2e')],qs[_0x47ef('0x34')](_0x517f2b[_0x47ef('0x30')]['fields']));_0x27e17e['attributes']=_0x27e17e[_0x47ef('0x33')][_0x47ef('0x35')]?_0x27e17e[_0x47ef('0x33')]:_0xe1e8c2[_0x47ef('0x2e')];if(!_0x517f2b['query']['hasOwnProperty'](_0x47ef('0x36'))){_0x27e17e[_0x47ef('0x1d')]=qs['limit'](_0x517f2b[_0x47ef('0x30')][_0x47ef('0x1d')]);_0x27e17e[_0x47ef('0x1b')]=qs[_0x47ef('0x1b')](_0x517f2b[_0x47ef('0x30')][_0x47ef('0x1b')]);}_0x27e17e[_0x47ef('0x37')]=qs['sort'](_0x517f2b[_0x47ef('0x30')]['sort']);_0x27e17e[_0x47ef('0x38')]=qs['filters'](_[_0x47ef('0x39')](_0x517f2b['query'],_0xe1e8c2[_0x47ef('0x31')]),_0x5a9f8e);if(_0x517f2b['query'][_0x47ef('0x3a')]){_0x27e17e[_0x47ef('0x38')]=_[_0x47ef('0x3b')](_0x27e17e[_0x47ef('0x38')],{'$or':_[_0x47ef('0x2f')](_0x5a9f8e,function(_0xb755f){if(_0xb755f[_0x47ef('0x2c')]!=='VIRTUAL'){var _0x42d659={};_0x42d659[_0xb755f['name']]={'$like':'%'+_0x517f2b[_0x47ef('0x30')][_0x47ef('0x3a')]+'%'};return _0x42d659;}})});}_0x27e17e=_[_0x47ef('0x3b')]({},_0x27e17e,_0x517f2b[_0x47ef('0x3c')]);var _0x50f243={'where':_0x27e17e[_0x47ef('0x38')]};return db[_0x47ef('0x2a')]['count'](_0x50f243)[_0x47ef('0x24')](function(_0x57b403){_0x1b313c[_0x47ef('0x3d')]=_0x57b403;if(_0x517f2b[_0x47ef('0x30')]['includeAll']){_0x27e17e[_0x47ef('0x3e')]=[{'all':!![]}];}return db[_0x47ef('0x2a')][_0x47ef('0x3f')](_0x27e17e);})['then'](function(_0x300854){_0x1b313c[_0x47ef('0x40')]=_0x300854;return _0x1b313c;})[_0x47ef('0x24')](respondWithFilteredResult(_0x4619f1,_0x27e17e))[_0x47ef('0x41')](handleError(_0x4619f1,null));};exports[_0x47ef('0x42')]=function(_0x801bcd,_0x1cd5b7){var _0x55d1d3={'raw':!![],'where':{'id':_0x801bcd[_0x47ef('0x43')]['id']}},_0x124978={};_0x124978[_0x47ef('0x2e')]=_[_0x47ef('0x44')](db[_0x47ef('0x2a')][_0x47ef('0x2b')]);_0x124978['query']=_['keys'](_0x801bcd[_0x47ef('0x30')]);_0x124978[_0x47ef('0x31')]=_[_0x47ef('0x32')](_0x124978[_0x47ef('0x2e')],_0x124978[_0x47ef('0x30')]);_0x55d1d3[_0x47ef('0x33')]=_['intersection'](_0x124978['model'],qs['fields'](_0x801bcd[_0x47ef('0x30')][_0x47ef('0x34')]));_0x55d1d3[_0x47ef('0x33')]=_0x55d1d3[_0x47ef('0x33')][_0x47ef('0x35')]?_0x55d1d3[_0x47ef('0x33')]:_0x124978[_0x47ef('0x2e')];if(_0x801bcd[_0x47ef('0x30')][_0x47ef('0x45')]){_0x55d1d3[_0x47ef('0x3e')]=[{'all':!![]}];}_0x55d1d3=_[_0x47ef('0x3b')]({},_0x55d1d3,_0x801bcd[_0x47ef('0x3c')]);return db[_0x47ef('0x2a')][_0x47ef('0x46')](_0x55d1d3)['then'](handleEntityNotFound(_0x1cd5b7,null))['then'](respondWithResult(_0x1cd5b7,null))[_0x47ef('0x41')](handleError(_0x1cd5b7,null));};exports['create']=function(_0xa3134d,_0x496e9d){return db[_0x47ef('0x2a')]['create'](_0xa3134d[_0x47ef('0x47')],{})[_0x47ef('0x24')](respondWithResult(_0x496e9d,0xc9))[_0x47ef('0x41')](handleError(_0x496e9d,null));};exports[_0x47ef('0x23')]=function(_0x303146,_0x443eaf){if(_0x303146['body']['id']){delete _0x303146['body']['id'];}return db['JscriptySessionReport'][_0x47ef('0x46')]({'where':{'id':_0x303146['params']['id']}})[_0x47ef('0x24')](handleEntityNotFound(_0x443eaf,null))[_0x47ef('0x24')](saveUpdates(_0x303146['body'],null))[_0x47ef('0x24')](respondWithResult(_0x443eaf,null))['catch'](handleError(_0x443eaf,null));};exports[_0x47ef('0x25')]=function(_0x14481d,_0x280fd1){return db[_0x47ef('0x2a')][_0x47ef('0x46')]({'where':{'id':_0x14481d[_0x47ef('0x43')]['id']}})[_0x47ef('0x24')](handleEntityNotFound(_0x280fd1,null))[_0x47ef('0x24')](removeEntity(_0x280fd1,null))['catch'](handleError(_0x280fd1,null));};exports['describe']=function(_0x26d0ec,_0x378be3){return db[_0x47ef('0x2a')][_0x47ef('0x48')]()[_0x47ef('0x24')](respondWithResult(_0x378be3,null))['catch'](handleError(_0x378be3,null));};exports['getQuestions']=function(_0x477cd5,_0x1d3806,_0x4d730e){var _0x165aba={'raw':!![],'where':{}};var _0x14b7fa={};var _0x1dc09c={'count':0x0,'rows':[]};return db[_0x47ef('0x2a')]['findOne']({'where':{'id':_0x477cd5[_0x47ef('0x43')]['id']}})['then'](handleEntityNotFound(_0x1d3806,null))[_0x47ef('0x24')](function(_0x35d0b6){if(_0x35d0b6){_0x14b7fa[_0x47ef('0x2e')]=_[_0x47ef('0x44')](db[_0x47ef('0x49')][_0x47ef('0x2b')]);_0x14b7fa[_0x47ef('0x30')]=_['keys'](_0x477cd5['query']);_0x14b7fa[_0x47ef('0x31')]=_[_0x47ef('0x32')](_0x14b7fa[_0x47ef('0x2e')],_0x14b7fa[_0x47ef('0x30')]);_0x165aba['attributes']=_[_0x47ef('0x32')](_0x14b7fa[_0x47ef('0x2e')],qs[_0x47ef('0x34')](_0x477cd5[_0x47ef('0x30')][_0x47ef('0x34')]));_0x165aba[_0x47ef('0x33')]=_0x165aba['attributes'][_0x47ef('0x35')]?_0x165aba[_0x47ef('0x33')]:_0x14b7fa['model'];if(!_0x477cd5['query'][_0x47ef('0x4a')](_0x47ef('0x36'))){_0x165aba[_0x47ef('0x1d')]=qs[_0x47ef('0x1d')](_0x477cd5[_0x47ef('0x30')]['limit']);_0x165aba[_0x47ef('0x1b')]=qs['offset'](_0x477cd5[_0x47ef('0x30')][_0x47ef('0x1b')]);}_0x165aba['order']=qs[_0x47ef('0x4b')](_0x477cd5[_0x47ef('0x30')][_0x47ef('0x4b')]);_0x165aba[_0x47ef('0x38')]=qs['filters'](_[_0x47ef('0x39')](_0x477cd5['query'],_0x14b7fa[_0x47ef('0x31')]));_0x165aba[_0x47ef('0x38')]['SessionId']=_0x35d0b6['id'];if(_0x477cd5[_0x47ef('0x30')][_0x47ef('0x3a')]){_0x165aba[_0x47ef('0x38')]=_[_0x47ef('0x3b')](_0x165aba['where'],{'$or':_['map'](_0x165aba[_0x47ef('0x33')],function(_0x10ed1f){var _0x45e9d1={};_0x45e9d1[_0x10ed1f]={'$like':'%'+_0x477cd5['query']['filter']+'%'};return _0x45e9d1;})});}_0x165aba=_[_0x47ef('0x3b')]({},_0x165aba,_0x477cd5[_0x47ef('0x3c')]);return db['JscriptyQuestionReport'][_0x47ef('0x3d')]({'where':_0x165aba['where']})[_0x47ef('0x24')](function(_0x403c7e){_0x1dc09c[_0x47ef('0x3d')]=_0x403c7e;if(_0x477cd5[_0x47ef('0x30')]['includeAll']){_0x165aba[_0x47ef('0x3e')]=[{'all':!![]}];}return db[_0x47ef('0x49')][_0x47ef('0x3f')](_0x165aba);})[_0x47ef('0x24')](function(_0x574003){_0x1dc09c[_0x47ef('0x40')]=_0x574003;return _0x1dc09c;});}})[_0x47ef('0x24')](respondWithFilteredResult(_0x1d3806,_0x165aba))[_0x47ef('0x41')](handleError(_0x1d3806,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 5740785..dac7a36 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 _0xe015=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','report_jscripty_sessions'];(function(_0x2297f6,_0x586cd6){var _0x2925f2=function(_0x514605){while(--_0x514605){_0x2297f6['push'](_0x2297f6['shift']());}};_0x2925f2(++_0x586cd6);}(_0xe015,0x13b));var _0x5e01=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe015[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var logger=require(_0x5e01('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e01('0x4'));var rimraf=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var attributes=require(_0x5e01('0x7'));module['exports']=function(_0x1814cb,_0x3d2da2){return _0x1814cb['define']('JscriptySessionReport',attributes,{'tableName':_0x5e01('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1883=['../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x71e58f,_0x4d233b){var _0x47471a=function(_0x350bc1){while(--_0x350bc1){_0x71e58f['push'](_0x71e58f['shift']());}};_0x47471a(++_0x4d233b);}(_0x1883,0xab));var _0x3188=function(_0x140ede,_0x4abc15){_0x140ede=_0x140ede-0x0;var _0x5c316f=_0x1883[_0x140ede];return _0x5c316f;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));module[_0x3188('0xb')]=function(_0x408ae0,_0x33b62d){return _0x408ae0[_0x3188('0xc')](_0x3188('0xd'),attributes,{'tableName':_0x3188('0xe'),'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 84ea52e..0884055 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 _0x4888=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x201042,_0x50bd0a){var _0x17f363=function(_0x4d7519){while(--_0x4d7519){_0x201042['push'](_0x201042['shift']());}};_0x17f363(++_0x50bd0a);}(_0x4888,0x198));var _0x8488=function(_0xcdfdb2,_0x151157){_0xcdfdb2=_0xcdfdb2-0x0;var _0x21f715=_0x4888[_0xcdfdb2];return _0x21f715;};'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});function respondWithRpcPromise(_0x19e508,_0x5250a1,_0x5b30a7){return new BPromise(function(_0x56aad0,_0x568a82){return client[_0x8488('0xc')](_0x19e508,_0x5b30a7)[_0x8488('0xd')](function(_0x542bd8){logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));logger[_0x8488('0x11')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x5250a1,_0x8488('0x10'),JSON[_0x8488('0x12')](_0x542bd8));if(_0x542bd8[_0x8488('0x13')]){if(_0x542bd8[_0x8488('0x13')][_0x8488('0x14')]===0x1f4){logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8[_0x8488('0x13')]['message']);return _0x568a82(_0x542bd8['error'][_0x8488('0x15')]);}logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8['error']['message']);return _0x56aad0(_0x542bd8[_0x8488('0x13')][_0x8488('0x15')]);}else{logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));_0x56aad0(_0x542bd8[_0x8488('0x16')][_0x8488('0x15')]);}})['catch'](function(_0x3dad45){logger[_0x8488('0x13')](_0x8488('0xf'),_0x5250a1,_0x3dad45);_0x568a82(_0x3dad45);});});} \ No newline at end of file +var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x450076,_0x10983b){var _0x2029cc=function(_0x4a5e76){while(--_0x4a5e76){_0x450076['push'](_0x450076['shift']());}};_0x2029cc(++_0x10983b);}(_0x524e,0x15e));var _0xe524=function(_0x464d51,_0x59329c){_0x464d51=_0x464d51-0x0;var _0x20126e=_0x524e[_0x464d51];return _0x20126e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index c961b76..01b2399 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 _0x2ae9=['../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','update','/download_log_file','isAuthenticated','downloadLogFile','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x40c778,_0x471c5d){var _0x42127f=function(_0x414ec7){while(--_0x414ec7){_0x40c778['push'](_0x40c778['shift']());}};_0x42127f(++_0x471c5d);}(_0x2ae9,0x13e));var _0x92ae=function(_0x2f2d88,_0x32815c){_0x2f2d88=_0x2f2d88-0x0;var _0x4742ee=_0x2ae9[_0x2f2d88];return _0x4742ee;};'use strict';var multer=require(_0x92ae('0x0'));var util=require('util');var path=require(_0x92ae('0x1'));var timeout=require(_0x92ae('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x92ae('0x3'));var auth=require(_0x92ae('0x4'));var interaction=require(_0x92ae('0x5'));var config=require(_0x92ae('0x6'));var controller=require(_0x92ae('0x7'));router[_0x92ae('0x8')]('/',controller[_0x92ae('0x9')]);router[_0x92ae('0xa')](_0x92ae('0xb'),auth['isAuthenticated'](),controller[_0x92ae('0xc')]);router[_0x92ae('0x8')](_0x92ae('0xd'),auth[_0x92ae('0xe')](),controller[_0x92ae('0xf')]);module[_0x92ae('0x10')]=router; \ No newline at end of file +var _0x5c60=['./license.controller','get','isAuthenticated','/download_log_file','downloadLogFile','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x7abd7,_0x1ca3f9){var _0x3a2577=function(_0x18456d){while(--_0x18456d){_0x7abd7['push'](_0x7abd7['shift']());}};_0x3a2577(++_0x1ca3f9);}(_0x5c60,0x19c));var _0x05c6=function(_0x5ed886,_0x4cbe13){_0x5ed886=_0x5ed886-0x0;var _0x25a29f=_0x5c60[_0x5ed886];return _0x25a29f;};'use strict';var multer=require('multer');var util=require(_0x05c6('0x0'));var path=require(_0x05c6('0x1'));var timeout=require(_0x05c6('0x2'));var express=require(_0x05c6('0x3'));var router=express[_0x05c6('0x4')]();var fs_extra=require(_0x05c6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x05c6('0x6'));var config=require(_0x05c6('0x7'));var controller=require(_0x05c6('0x8'));router[_0x05c6('0x9')]('/',controller['index']);router['put']('/:id',auth[_0x05c6('0xa')](),controller['update']);router[_0x05c6('0x9')](_0x05c6('0xb'),auth[_0x05c6('0xa')](),controller[_0x05c6('0xc')]);module[_0x05c6('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 1fd75db..6a9ec92 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 _0x855e=['sequelize','exports','TEXT','STRING','INTEGER'];(function(_0x5cb475,_0x234940){var _0xe9706b=function(_0x297895){while(--_0x297895){_0x5cb475['push'](_0x5cb475['shift']());}};_0xe9706b(++_0x234940);}(_0x855e,0xd7));var _0xe855=function(_0x15794e,_0x23524f){_0x15794e=_0x15794e-0x0;var _0x7e22d6=_0x855e[_0x15794e];return _0x7e22d6;};'use strict';var Sequelize=require(_0xe855('0x0'));module[_0xe855('0x1')]={'license':{'type':Sequelize[_0xe855('0x2')]},'data1':{'type':Sequelize[_0xe855('0x3')]},'data2':{'type':Sequelize[_0xe855('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xe855('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2744=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x10aa73,_0xc744f4){var _0x3496d9=function(_0x71c780){while(--_0x71c780){_0x10aa73['push'](_0x10aa73['shift']());}};_0x3496d9(++_0xc744f4);}(_0x2744,0x175));var _0x4274=function(_0x22cb0e,_0x190ba9){_0x22cb0e=_0x22cb0e-0x0;var _0x10b1ed=_0x2744[_0x22cb0e];return _0x10b1ed;};'use strict';var Sequelize=require(_0x4274('0x0'));module[_0x4274('0x1')]={'license':{'type':Sequelize[_0x4274('0x2')]},'data1':{'type':Sequelize[_0x4274('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x4274('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 19b0ffe..5f2babc 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 _0xf9d0=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','model','License','rawAttributes','keys','filters','query','attributes','intersection','fields','length','merge','options','getLicense','catch','body','get','checkLicense','demo','downloadLogFile','license-info.log','/var','log','xcally','setHeader','Content-disposition','Content-Type','download','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x90e97b,_0x1377f6){var _0x518984=function(_0x2b7202){while(--_0x2b7202){_0x90e97b['push'](_0x90e97b['shift']());}};_0x518984(++_0x1377f6);}(_0xf9d0,0x192));var _0x0f9d=function(_0x3a17ec,_0x29fbd9){_0x3a17ec=_0x3a17ec-0x0;var _0x4ea7dc=_0xf9d0[_0x3a17ec];return _0x4ea7dc;};'use strict';var emlformat=require(_0x0f9d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f9d('0x1'));var jsonpatch=require(_0x0f9d('0x2'));var rp=require('request-promise');var moment=require(_0x0f9d('0x3'));var BPromise=require(_0x0f9d('0x4'));var Mustache=require(_0x0f9d('0x5'));var util=require(_0x0f9d('0x6'));var path=require('path');var sox=require(_0x0f9d('0x7'));var csv=require(_0x0f9d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f9d('0x9'));var _=require('lodash');var squel=require(_0x0f9d('0xa'));var crypto=require(_0x0f9d('0xb'));var jsforce=require(_0x0f9d('0xc'));var deskjs=require(_0x0f9d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0f9d('0xe'));var Papa=require(_0x0f9d('0xf'));var Redis=require('ioredis');var authService=require(_0x0f9d('0x10'));var qs=require(_0x0f9d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f9d('0x12'));var logger=require('../../config/logger')(_0x0f9d('0x13'));var utils=require(_0x0f9d('0x14'));var config=require(_0x0f9d('0x15'));var licenseUtil=require(_0x0f9d('0x16'));var db=require(_0x0f9d('0x17'))['db'];function respondWithStatusCode(_0x31957b,_0x16ee7a){_0x16ee7a=_0x16ee7a||0xcc;return function(_0x246aff){if(_0x246aff){return _0x31957b['sendStatus'](_0x16ee7a);}return _0x31957b[_0x0f9d('0x18')](_0x16ee7a)[_0x0f9d('0x19')]();};}function respondWithResult(_0x37d73f,_0x45140b){_0x45140b=_0x45140b||0xc8;return function(_0x29aa65){if(_0x29aa65){return _0x37d73f[_0x0f9d('0x18')](_0x45140b)['json'](_0x29aa65);}};}function respondWithFilteredResult(_0x45ea79,_0x554a85){return function(_0x5d4762){if(_0x5d4762){var _0x381f80=typeof _0x554a85['offset']===_0x0f9d('0x1a')&&typeof _0x554a85['limit']===_0x0f9d('0x1a');var _0x3d43e2=_0x5d4762['count'];var _0x541ecf=_0x381f80?0x0:_0x554a85['offset'];var _0x1770bb=_0x381f80?_0x5d4762[_0x0f9d('0x1b')]:_0x554a85[_0x0f9d('0x1c')]+_0x554a85[_0x0f9d('0x1d')];var _0x47abea;if(_0x1770bb>=_0x3d43e2){_0x1770bb=_0x3d43e2;_0x47abea=0xc8;}else{_0x47abea=0xce;}_0x45ea79['status'](_0x47abea);return _0x45ea79[_0x0f9d('0x1e')]('Content-Range',_0x541ecf+'-'+_0x1770bb+'/'+_0x3d43e2)['json'](_0x5d4762);}return null;};}function patchUpdates(_0x356b7e){return function(_0x30c916){try{jsonpatch[_0x0f9d('0x1f')](_0x30c916,_0x356b7e,!![]);}catch(_0x5701a7){return BPromise[_0x0f9d('0x20')](_0x5701a7);}return _0x30c916[_0x0f9d('0x21')]();};}function saveUpdates(_0x5da77b,_0x3b51d6){return function(_0x25c981){if(_0x25c981){return _0x25c981[_0x0f9d('0x22')](_0x5da77b)[_0x0f9d('0x23')](function(_0x4b343e){return _0x4b343e;});}return null;};}function removeEntity(_0x5b1d08,_0x2ceba6){return function(_0x21f087){if(_0x21f087){return _0x21f087[_0x0f9d('0x24')]()[_0x0f9d('0x23')](function(){_0x5b1d08['status'](0xcc)[_0x0f9d('0x19')]();});}};}function handleEntityNotFound(_0x1fe464,_0x18a853){return function(_0x32c160){if(!_0x32c160){_0x1fe464[_0x0f9d('0x25')](0x194);}return _0x32c160;};}function handleError(_0x4d5441,_0x45a8dc){_0x45a8dc=_0x45a8dc||0x1f4;return function(_0x20c2ed){logger[_0x0f9d('0x26')](_0x20c2ed[_0x0f9d('0x27')]);if(_0x20c2ed[_0x0f9d('0x28')]){delete _0x20c2ed[_0x0f9d('0x28')];}_0x4d5441['status'](_0x45a8dc)[_0x0f9d('0x29')](_0x20c2ed);};}var utilLicense=require(_0x0f9d('0x16'));exports[_0x0f9d('0x2a')]=function(_0x1552eb,_0x2b045f){var _0x5a0d06={'raw':!![],'where':{'id':0x1}},_0x5bcb38={};_0x5bcb38[_0x0f9d('0x2b')]=_['keys'](db[_0x0f9d('0x2c')][_0x0f9d('0x2d')]);_0x5bcb38['query']=_[_0x0f9d('0x2e')](_0x1552eb['query']);_0x5bcb38[_0x0f9d('0x2f')]=_['intersection'](_0x5bcb38['model'],_0x5bcb38[_0x0f9d('0x30')]);_0x5a0d06[_0x0f9d('0x31')]=_[_0x0f9d('0x32')](_0x5bcb38['model'],qs['fields'](_0x1552eb['query'][_0x0f9d('0x33')]));_0x5a0d06[_0x0f9d('0x31')]=_0x5a0d06[_0x0f9d('0x31')][_0x0f9d('0x34')]?_0x5a0d06[_0x0f9d('0x31')]:_0x5bcb38[_0x0f9d('0x2b')];_0x5a0d06=_[_0x0f9d('0x35')]({},_0x5a0d06,_0x1552eb[_0x0f9d('0x36')]);return utilLicense[_0x0f9d('0x37')](_0x5a0d06)[_0x0f9d('0x23')](respondWithResult(_0x2b045f,null))[_0x0f9d('0x38')](handleError(_0x2b045f,null));};exports['update']=function(_0x581412,_0x5ecd4c){if(_0x581412['body']['id']){delete _0x581412[_0x0f9d('0x39')]['id'];}return db[_0x0f9d('0x2c')]['find']({'where':{'id':_0x581412['params']['id']}})['then'](handleEntityNotFound(_0x5ecd4c,null))['then'](function(_0x53935a){var _0x25139a=_0x53935a[_0x0f9d('0x3a')]({'plain':!![]});return utilLicense[_0x0f9d('0x3b')](_0x25139a,_0x581412[_0x0f9d('0x39')]['key']);})[_0x0f9d('0x23')](function(_0x309920){if(!_0x309920[_0x0f9d('0x3c')]){return saveUpdates(_0x581412[_0x0f9d('0x39')],null);}return _0x309920;})[_0x0f9d('0x23')](respondWithResult(_0x5ecd4c,null))[_0x0f9d('0x38')](handleError(_0x5ecd4c,null));};exports[_0x0f9d('0x3d')]=function(_0x5b3bae,_0x3c115b){var _0x4841d8=_0x0f9d('0x3e');var _0x4140b3=path['join'](_0x0f9d('0x3f'),_0x0f9d('0x40'),_0x0f9d('0x41'),_0x4841d8);_0x3c115b[_0x0f9d('0x42')](_0x0f9d('0x43'),'attachment;\x20filename='+_0x4841d8);_0x3c115b[_0x0f9d('0x1e')](_0x0f9d('0x44'),'text/plain');_0x3c115b[_0x0f9d('0x45')](_0x4140b3);}; \ No newline at end of file +var _0x17c8=['sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','model','keys','License','query','filters','intersection','attributes','fields','getLicense','body','find','key','demo','catch','license-info.log','join','/var','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x56df4b,_0x4f70db){var _0x42100a=function(_0x14e72){while(--_0x14e72){_0x56df4b['push'](_0x56df4b['shift']());}};_0x42100a(++_0x4f70db);}(_0x17c8,0x12e));var _0x817c=function(_0x5e0758,_0x5d2e35){_0x5e0758=_0x5e0758-0x0;var _0xfc2326=_0x17c8[_0x5e0758];return _0xfc2326;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x817c('0x0'));var zipdir=require(_0x817c('0x1'));var jsonpatch=require(_0x817c('0x2'));var rp=require(_0x817c('0x3'));var moment=require(_0x817c('0x4'));var BPromise=require(_0x817c('0x5'));var Mustache=require('mustache');var util=require(_0x817c('0x6'));var path=require(_0x817c('0x7'));var sox=require('sox');var csv=require(_0x817c('0x8'));var ejs=require(_0x817c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x817c('0xa'));var squel=require(_0x817c('0xb'));var crypto=require(_0x817c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x817c('0x8'));var querystring=require(_0x817c('0xd'));var Papa=require('papaparse');var Redis=require(_0x817c('0xe'));var authService=require(_0x817c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x817c('0x10'));var hardwareService=require(_0x817c('0x11'));var logger=require(_0x817c('0x12'))(_0x817c('0x13'));var utils=require(_0x817c('0x14'));var config=require(_0x817c('0x15'));var licenseUtil=require(_0x817c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2240f5,_0x223291){_0x223291=_0x223291||0xcc;return function(_0x8df7d8){if(_0x8df7d8){return _0x2240f5[_0x817c('0x17')](_0x223291);}return _0x2240f5[_0x817c('0x18')](_0x223291)[_0x817c('0x19')]();};}function respondWithResult(_0x16bc08,_0x3e513a){_0x3e513a=_0x3e513a||0xc8;return function(_0x380ca0){if(_0x380ca0){return _0x16bc08[_0x817c('0x18')](_0x3e513a)['json'](_0x380ca0);}};}function respondWithFilteredResult(_0x43c3f4,_0x355f91){return function(_0xdc6863){if(_0xdc6863){var _0xc94bff=typeof _0x355f91[_0x817c('0x1a')]===_0x817c('0x1b')&&typeof _0x355f91['limit']===_0x817c('0x1b');var _0x32d639=_0xdc6863[_0x817c('0x1c')];var _0x1a2353=_0xc94bff?0x0:_0x355f91[_0x817c('0x1a')];var _0x54fbbc=_0xc94bff?_0xdc6863[_0x817c('0x1c')]:_0x355f91['offset']+_0x355f91[_0x817c('0x1d')];var _0x35cfa4;if(_0x54fbbc>=_0x32d639){_0x54fbbc=_0x32d639;_0x35cfa4=0xc8;}else{_0x35cfa4=0xce;}_0x43c3f4[_0x817c('0x18')](_0x35cfa4);return _0x43c3f4[_0x817c('0x1e')](_0x817c('0x1f'),_0x1a2353+'-'+_0x54fbbc+'/'+_0x32d639)['json'](_0xdc6863);}return null;};}function patchUpdates(_0x5ae9af){return function(_0x45eb0b){try{jsonpatch[_0x817c('0x20')](_0x45eb0b,_0x5ae9af,!![]);}catch(_0xb21195){return BPromise[_0x817c('0x21')](_0xb21195);}return _0x45eb0b[_0x817c('0x22')]();};}function saveUpdates(_0x48d9fb,_0x1b1493){return function(_0x5c1d0d){if(_0x5c1d0d){return _0x5c1d0d[_0x817c('0x23')](_0x48d9fb)[_0x817c('0x24')](function(_0x4b1a67){return _0x4b1a67;});}return null;};}function removeEntity(_0x2c4001,_0x4c2a38){return function(_0x6edeeb){if(_0x6edeeb){return _0x6edeeb[_0x817c('0x25')]()['then'](function(){_0x2c4001[_0x817c('0x18')](0xcc)[_0x817c('0x19')]();});}};}function handleEntityNotFound(_0x44276d,_0x47f3a2){return function(_0x3be0fd){if(!_0x3be0fd){_0x44276d[_0x817c('0x17')](0x194);}return _0x3be0fd;};}function handleError(_0x44e319,_0x5cde2c){_0x5cde2c=_0x5cde2c||0x1f4;return function(_0x522ef9){logger[_0x817c('0x26')](_0x522ef9[_0x817c('0x27')]);if(_0x522ef9[_0x817c('0x28')]){delete _0x522ef9[_0x817c('0x28')];}_0x44e319[_0x817c('0x18')](_0x5cde2c)[_0x817c('0x29')](_0x522ef9);};}var utilLicense=require(_0x817c('0x16'));exports[_0x817c('0x2a')]=function(_0x30560d,_0x4ed891){var _0x1da6e9={'raw':!![],'where':{'id':0x1}},_0x4f0cd5={};_0x4f0cd5[_0x817c('0x2b')]=_[_0x817c('0x2c')](db[_0x817c('0x2d')]['rawAttributes']);_0x4f0cd5[_0x817c('0x2e')]=_[_0x817c('0x2c')](_0x30560d[_0x817c('0x2e')]);_0x4f0cd5[_0x817c('0x2f')]=_[_0x817c('0x30')](_0x4f0cd5[_0x817c('0x2b')],_0x4f0cd5[_0x817c('0x2e')]);_0x1da6e9[_0x817c('0x31')]=_['intersection'](_0x4f0cd5[_0x817c('0x2b')],qs[_0x817c('0x32')](_0x30560d[_0x817c('0x2e')]['fields']));_0x1da6e9[_0x817c('0x31')]=_0x1da6e9[_0x817c('0x31')]['length']?_0x1da6e9['attributes']:_0x4f0cd5[_0x817c('0x2b')];_0x1da6e9=_['merge']({},_0x1da6e9,_0x30560d['options']);return utilLicense[_0x817c('0x33')](_0x1da6e9)['then'](respondWithResult(_0x4ed891,null))['catch'](handleError(_0x4ed891,null));};exports[_0x817c('0x23')]=function(_0x4c38a5,_0x473621){if(_0x4c38a5[_0x817c('0x34')]['id']){delete _0x4c38a5[_0x817c('0x34')]['id'];}return db[_0x817c('0x2d')][_0x817c('0x35')]({'where':{'id':_0x4c38a5['params']['id']}})[_0x817c('0x24')](handleEntityNotFound(_0x473621,null))[_0x817c('0x24')](function(_0x1f177d){var _0x2a9944=_0x1f177d['get']({'plain':!![]});return utilLicense['checkLicense'](_0x2a9944,_0x4c38a5['body'][_0x817c('0x36')]);})['then'](function(_0xe9f390){if(!_0xe9f390[_0x817c('0x37')]){return saveUpdates(_0x4c38a5[_0x817c('0x34')],null);}return _0xe9f390;})['then'](respondWithResult(_0x473621,null))[_0x817c('0x38')](handleError(_0x473621,null));};exports['downloadLogFile']=function(_0x48d7b5,_0x39f1a9){var _0x4f5a63=_0x817c('0x39');var _0x284b62=path[_0x817c('0x3a')](_0x817c('0x3b'),'log','xcally',_0x4f5a63);_0x39f1a9['setHeader'](_0x817c('0x3c'),_0x817c('0x3d')+_0x4f5a63);_0x39f1a9[_0x817c('0x1e')](_0x817c('0x3e'),_0x817c('0x3f'));_0x39f1a9[_0x817c('0x40')](_0x284b62);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 180bfe2..87ee230 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 _0xa37c=['moment','bluebird','path','rimraf','../../config/environment','License','license','util','../../config/logger','api'];(function(_0x163285,_0x20656e){var _0x495c2f=function(_0x16b423){while(--_0x16b423){_0x163285['push'](_0x163285['shift']());}};_0x495c2f(++_0x20656e);}(_0xa37c,0x101));var _0xca37=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xa37c[_0x36884e];return _0x1cc367;};'use strict';var _=require('lodash');var util=require(_0xca37('0x0'));var logger=require(_0xca37('0x1'))(_0xca37('0x2'));var moment=require(_0xca37('0x3'));var BPromise=require(_0xca37('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xca37('0x5'));var rimraf=require(_0xca37('0x6'));var config=require(_0xca37('0x7'));var attributes=require('./license.attributes');module['exports']=function(_0x405280,_0x32e700){return _0x405280['define'](_0xca37('0x8'),attributes,{'tableName':_0xca37('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12c8=['./license.attributes','exports','License','license','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x100b9c,_0x118bf2){var _0x446a40=function(_0x159cca){while(--_0x159cca){_0x100b9c['push'](_0x100b9c['shift']());}};_0x446a40(++_0x118bf2);}(_0x12c8,0x1d0));var _0x812c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12c8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x812c('0x0'))(_0x812c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x812c('0x2'));var fs=require('fs');var path=require(_0x812c('0x3'));var rimraf=require(_0x812c('0x4'));var config=require(_0x812c('0x5'));var attributes=require(_0x812c('0x6'));module[_0x812c('0x7')]=function(_0x4187b8,_0x5c27e4){return _0x4187b8['define'](_0x812c('0x8'),attributes,{'tableName':_0x812c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 040eae1..1bdf890 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 _0xb22b=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird'];(function(_0x1b6b77,_0x5d13fc){var _0x5d4582=function(_0x7006db){while(--_0x7006db){_0x1b6b77['push'](_0x1b6b77['shift']());}};_0x5d4582(++_0x5d13fc);}(_0xb22b,0xd9));var _0xbb22=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb22b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xbb22('0x0'));var moment=require(_0xbb22('0x1'));var BPromise=require(_0xbb22('0x2'));var rs=require(_0xbb22('0x3'));var fs=require('fs');var Redis=require(_0xbb22('0x4'));var db=require(_0xbb22('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb22('0x6'))(_0xbb22('0x7'));var config=require(_0xbb22('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbb22('0x9')][_0xbb22('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d2180,_0x5b5395,_0x47c440){return new BPromise(function(_0x583174,_0x140042){return client[_0xbb22('0xb')](_0x4d2180,_0x47c440)[_0xbb22('0xc')](function(_0x3998df){logger['info'](_0xbb22('0xd'),_0x5b5395,'request\x20sent');logger[_0xbb22('0xe')](_0xbb22('0xf'),_0x5b5395,'request\x20sent',JSON[_0xbb22('0x10')](_0x3998df));if(_0x3998df[_0xbb22('0x11')]){if(_0x3998df[_0xbb22('0x11')][_0xbb22('0x12')]===0x1f4){logger[_0xbb22('0x11')](_0xbb22('0xd'),_0x5b5395,_0x3998df[_0xbb22('0x11')]['message']);return _0x140042(_0x3998df[_0xbb22('0x11')][_0xbb22('0x13')]);}logger[_0xbb22('0x11')]('License,\x20%s,\x20%s',_0x5b5395,_0x3998df[_0xbb22('0x11')]['message']);return _0x583174(_0x3998df[_0xbb22('0x11')][_0xbb22('0x13')]);}else{logger[_0xbb22('0x14')](_0xbb22('0xd'),_0x5b5395,'request\x20sent');_0x583174(_0x3998df['result'][_0xbb22('0x13')]);}})[_0xbb22('0x15')](function(_0x2d969c){logger[_0xbb22('0x11')](_0xbb22('0xd'),_0x5b5395,_0x2d969c);_0x140042(_0x2d969c);});});} \ No newline at end of file +var _0xe4a8=['stringify','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s'];(function(_0x5d6efd,_0x168419){var _0x34fb11=function(_0x38de32){while(--_0x38de32){_0x5d6efd['push'](_0x5d6efd['shift']());}};_0x34fb11(++_0x168419);}(_0xe4a8,0x1d5));var _0x8e4a=function(_0x237f8b,_0xc5eddb){_0x237f8b=_0x237f8b-0x0;var _0x423f94=_0xe4a8[_0x237f8b];return _0x423f94;};'use strict';var _=require(_0x8e4a('0x0'));var util=require(_0x8e4a('0x1'));var moment=require('moment');var BPromise=require(_0x8e4a('0x2'));var rs=require(_0x8e4a('0x3'));var fs=require('fs');var Redis=require(_0x8e4a('0x4'));var db=require(_0x8e4a('0x5'))['db'];var utils=require(_0x8e4a('0x6'));var logger=require('../../config/logger')(_0x8e4a('0x7'));var config=require(_0x8e4a('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49066c,_0x21fe75,_0x175754){return new BPromise(function(_0x268176,_0x3aca82){return client['request'](_0x49066c,_0x175754)[_0x8e4a('0x9')](function(_0x2a55ea){logger[_0x8e4a('0xa')]('License,\x20%s,\x20%s',_0x21fe75,_0x8e4a('0xb'));logger[_0x8e4a('0xc')](_0x8e4a('0xd'),_0x21fe75,_0x8e4a('0xb'),JSON[_0x8e4a('0xe')](_0x2a55ea));if(_0x2a55ea['error']){if(_0x2a55ea[_0x8e4a('0xf')][_0x8e4a('0x10')]===0x1f4){logger[_0x8e4a('0xf')](_0x8e4a('0x11'),_0x21fe75,_0x2a55ea[_0x8e4a('0xf')][_0x8e4a('0x12')]);return _0x3aca82(_0x2a55ea[_0x8e4a('0xf')][_0x8e4a('0x12')]);}logger[_0x8e4a('0xf')]('License,\x20%s,\x20%s',_0x21fe75,_0x2a55ea[_0x8e4a('0xf')][_0x8e4a('0x12')]);return _0x268176(_0x2a55ea[_0x8e4a('0xf')][_0x8e4a('0x12')]);}else{logger['info']('License,\x20%s,\x20%s',_0x21fe75,_0x8e4a('0xb'));_0x268176(_0x2a55ea[_0x8e4a('0x13')][_0x8e4a('0x12')]);}})[_0x8e4a('0x14')](function(_0x3fe67d){logger[_0x8e4a('0xf')](_0x8e4a('0x11'),_0x21fe75,_0x3fe67d);_0x3aca82(_0x3fe67d);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 61bc5a8..f96f280 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 _0x262e=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','/:id/in_servers','addInteraction','addApplications','/:id/send','addAgents','update','delete','removeDispositions','removeImap','removeSmtp','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0x262e,0xd9));var _0xe262=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x262e[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xe262('0x0'));var util=require(_0xe262('0x1'));var path=require('path');var timeout=require(_0xe262('0x2'));var express=require(_0xe262('0x3'));var router=express['Router']();var fs_extra=require(_0xe262('0x4'));var auth=require(_0xe262('0x5'));var interaction=require(_0xe262('0x6'));var config=require(_0xe262('0x7'));var controller=require('./mailAccount.controller');router[_0xe262('0x8')]('/',auth[_0xe262('0x9')](),controller[_0xe262('0xa')]);router[_0xe262('0x8')](_0xe262('0xb'),auth[_0xe262('0x9')](),controller[_0xe262('0xc')]);router[_0xe262('0x8')](_0xe262('0xd'),auth[_0xe262('0x9')](),controller[_0xe262('0xe')]);router[_0xe262('0x8')](_0xe262('0xf'),auth[_0xe262('0x9')](),controller['getDispositions']);router[_0xe262('0x8')](_0xe262('0x10'),auth[_0xe262('0x9')](),controller[_0xe262('0x11')]);router[_0xe262('0x8')]('/:id/in_servers',auth[_0xe262('0x9')](),controller[_0xe262('0x12')]);router[_0xe262('0x8')](_0xe262('0x13'),auth['isAuthenticated'](),controller[_0xe262('0x14')]);router[_0xe262('0x8')](_0xe262('0x15'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xe262('0x8')](_0xe262('0x16'),auth[_0xe262('0x9')](),controller[_0xe262('0x17')]);router['get']('/:id/messages',auth[_0xe262('0x9')](),controller[_0xe262('0x18')]);router[_0xe262('0x8')](_0xe262('0x19'),auth[_0xe262('0x9')](),controller[_0xe262('0x1a')]);router[_0xe262('0x8')](_0xe262('0x1b'),auth[_0xe262('0x9')](),controller[_0xe262('0x1c')]);router[_0xe262('0x1d')](_0xe262('0xf'),auth['isAuthenticated'](),controller[_0xe262('0x1e')]);router['post'](_0xe262('0x10'),auth[_0xe262('0x9')](),controller[_0xe262('0x1f')]);router[_0xe262('0x1d')]('/',auth['isAuthenticated'](),controller[_0xe262('0x20')]);router[_0xe262('0x1d')](_0xe262('0x21'),auth[_0xe262('0x9')](),controller['addImap']);router[_0xe262('0x1d')]('/:id/out_servers',auth[_0xe262('0x9')](),controller['addSmtp']);router[_0xe262('0x1d')](_0xe262('0x15'),auth[_0xe262('0x9')](),controller[_0xe262('0x22')]);router['post'](_0xe262('0x16'),auth[_0xe262('0x9')](),controller[_0xe262('0x23')]);router[_0xe262('0x1d')](_0xe262('0x24'),auth[_0xe262('0x9')](),controller['send']);router[_0xe262('0x1d')]('/:id/users',auth[_0xe262('0x9')](),controller[_0xe262('0x25')]);router['put'](_0xe262('0xd'),auth['isAuthenticated'](),controller[_0xe262('0x26')]);router[_0xe262('0x27')]('/:id/dispositions',auth[_0xe262('0x9')](),controller[_0xe262('0x28')]);router[_0xe262('0x27')]('/:id/canned_answers',auth[_0xe262('0x9')](),controller['removeAnswers']);router[_0xe262('0x27')]('/:id/in_servers',auth[_0xe262('0x9')](),controller[_0xe262('0x29')]);router[_0xe262('0x27')](_0xe262('0x13'),auth['isAuthenticated'](),controller[_0xe262('0x2a')]);router[_0xe262('0x27')](_0xe262('0xd'),auth[_0xe262('0x9')](),controller[_0xe262('0x2b')]);router['delete']('/:id/users',auth[_0xe262('0x9')](),controller['removeAgents']);module[_0xe262('0x2c')]=router; \ No newline at end of file +var _0x7b34=['/:id/messages','verifySmtp','getAgents','addDisposition','post','addAnswer','addSmtp','addInteraction','addApplications','send','/:id/users','addAgents','update','delete','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications'];(function(_0xd550da,_0x35f59c){var _0x553963=function(_0x1d857a){while(--_0x1d857a){_0xd550da['push'](_0xd550da['shift']());}};_0x553963(++_0x35f59c);}(_0x7b34,0x154));var _0x47b3=function(_0x33411e,_0x2ca6ae){_0x33411e=_0x33411e-0x0;var _0x27089c=_0x7b34[_0x33411e];return _0x27089c;};'use strict';var multer=require(_0x47b3('0x0'));var util=require(_0x47b3('0x1'));var path=require(_0x47b3('0x2'));var timeout=require(_0x47b3('0x3'));var express=require('express');var router=express[_0x47b3('0x4')]();var fs_extra=require(_0x47b3('0x5'));var auth=require(_0x47b3('0x6'));var interaction=require(_0x47b3('0x7'));var config=require(_0x47b3('0x8'));var controller=require(_0x47b3('0x9'));router['get']('/',auth[_0x47b3('0xa')](),controller[_0x47b3('0xb')]);router[_0x47b3('0xc')](_0x47b3('0xd'),auth['isAuthenticated'](),controller[_0x47b3('0xe')]);router[_0x47b3('0xc')](_0x47b3('0xf'),auth[_0x47b3('0xa')](),controller[_0x47b3('0x10')]);router[_0x47b3('0xc')](_0x47b3('0x11'),auth[_0x47b3('0xa')](),controller[_0x47b3('0x12')]);router[_0x47b3('0xc')](_0x47b3('0x13'),auth[_0x47b3('0xa')](),controller['getAnswers']);router['get'](_0x47b3('0x14'),auth['isAuthenticated'](),controller[_0x47b3('0x15')]);router['get'](_0x47b3('0x16'),auth[_0x47b3('0xa')](),controller[_0x47b3('0x17')]);router['get'](_0x47b3('0x18'),auth[_0x47b3('0xa')](),controller[_0x47b3('0x19')]);router[_0x47b3('0xc')](_0x47b3('0x1a'),auth[_0x47b3('0xa')](),controller[_0x47b3('0x1b')]);router[_0x47b3('0xc')](_0x47b3('0x1c'),auth[_0x47b3('0xa')](),controller['getMessages']);router[_0x47b3('0xc')]('/:id/verify',auth[_0x47b3('0xa')](),controller[_0x47b3('0x1d')]);router[_0x47b3('0xc')]('/:id/users',auth[_0x47b3('0xa')](),controller[_0x47b3('0x1e')]);router['post'](_0x47b3('0x11'),auth['isAuthenticated'](),controller[_0x47b3('0x1f')]);router[_0x47b3('0x20')]('/:id/canned_answers',auth[_0x47b3('0xa')](),controller[_0x47b3('0x21')]);router[_0x47b3('0x20')]('/',auth[_0x47b3('0xa')](),controller['create']);router['post']('/:id/in_servers',auth['isAuthenticated'](),controller['addImap']);router[_0x47b3('0x20')](_0x47b3('0x16'),auth[_0x47b3('0xa')](),controller[_0x47b3('0x22')]);router[_0x47b3('0x20')](_0x47b3('0x18'),auth[_0x47b3('0xa')](),controller[_0x47b3('0x23')]);router[_0x47b3('0x20')](_0x47b3('0x1a'),auth[_0x47b3('0xa')](),controller[_0x47b3('0x24')]);router[_0x47b3('0x20')]('/:id/send',auth[_0x47b3('0xa')](),controller[_0x47b3('0x25')]);router['post'](_0x47b3('0x26'),auth['isAuthenticated'](),controller[_0x47b3('0x27')]);router['put'](_0x47b3('0xf'),auth['isAuthenticated'](),controller[_0x47b3('0x28')]);router[_0x47b3('0x29')](_0x47b3('0x11'),auth[_0x47b3('0xa')](),controller['removeDispositions']);router['delete'](_0x47b3('0x13'),auth[_0x47b3('0xa')](),controller['removeAnswers']);router['delete'](_0x47b3('0x14'),auth[_0x47b3('0xa')](),controller['removeImap']);router[_0x47b3('0x29')](_0x47b3('0x16'),auth[_0x47b3('0xa')](),controller[_0x47b3('0x2a')]);router[_0x47b3('0x29')](_0x47b3('0xf'),auth['isAuthenticated'](),controller[_0x47b3('0x2b')]);router[_0x47b3('0x29')]('/:id/users',auth[_0x47b3('0xa')](),controller[_0x47b3('0x2c')]);module[_0x47b3('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index e82cc94..e49cf09 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 _0x2a25=['mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x2e1e0a,_0x3a4581){var _0x504f9e=function(_0x412979){while(--_0x412979){_0x2e1e0a['push'](_0x2e1e0a['shift']());}};_0x504f9e(++_0x3a4581);}(_0x2a25,0x1ea));var _0x52a2=function(_0x47408c,_0x14fd3a){_0x47408c=_0x47408c-0x0;var _0x420293=_0x2a25[_0x47408c];return _0x420293;};'use strict';var Sequelize=require(_0x52a2('0x0'));module['exports']={'description':{'type':Sequelize[_0x52a2('0x1')]},'name':{'type':Sequelize[_0x52a2('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x52a2('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x52a2('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x52a2('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x52a2('0x3')]},'markAsUnread':{'type':Sequelize[_0x52a2('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x52a2('0x1')],'allowNull':![],'defaultValue':_0x52a2('0x4')},'fontSize':{'type':Sequelize[_0x52a2('0x5')](0x2)[_0x52a2('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x52a2('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x52a2('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x52a2('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x52a2('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x52a2('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x52a2('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x52a2('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x52a2('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x52a2('0x2')],'defaultValue':![],'comment':_0x52a2('0x8'),'set':function(_0x3033df){if(!_0x3033df)this[_0x52a2('0x9')](_0x52a2('0xa'),null);this[_0x52a2('0x9')](_0x52a2('0xb'),_0x3033df);}},'provider':{'type':Sequelize[_0x52a2('0xc')](_0x52a2('0xd'),_0x52a2('0xe'),_0x52a2('0xf'),_0x52a2('0x10')),'defaultValue':null,'get':function(){if(!this[_0x52a2('0x11')](_0x52a2('0x12')))return _0x52a2('0x13');return this[_0x52a2('0x11')](_0x52a2('0x12'));},'set':function(_0x2e2c65){if(_0x2e2c65==='custom')_0x2e2c65=null;return this[_0x52a2('0x9')](_0x52a2('0x12'),_0x2e2c65);}}}; \ No newline at end of file +var _0x94e0=['mandatoryDisposition','ENUM','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x94e0,0x1ac));var _0x094e=function(_0x365296,_0x4a8e50){_0x365296=_0x365296-0x0;var _0x205033=_0x94e0[_0x365296];return _0x205033;};'use strict';var Sequelize=require(_0x094e('0x0'));module[_0x094e('0x1')]={'description':{'type':Sequelize[_0x094e('0x2')]},'name':{'type':Sequelize[_0x094e('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x094e('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x094e('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x094e('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x094e('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x094e('0x4')]},'markAsUnread':{'type':Sequelize[_0x094e('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x094e('0x2')],'allowNull':![],'defaultValue':_0x094e('0x5')},'fontSize':{'type':Sequelize[_0x094e('0x6')](0x2)[_0x094e('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x094e('0x4')],'defaultValue':function(){return _0x094e('0x8');}},'notificationSound':{'type':Sequelize[_0x094e('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x094e('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x094e('0x6')],'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[_0x094e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x094e('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x094e('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x094e('0x3')],'defaultValue':![],'comment':_0x094e('0xa'),'set':function(_0x54adbc){if(!_0x54adbc)this[_0x094e('0xb')]('mandatoryDispositionPauseId',null);this[_0x094e('0xb')](_0x094e('0xc'),_0x54adbc);}},'provider':{'type':Sequelize[_0x094e('0xd')]('gmail',_0x094e('0xe'),_0x094e('0xf'),_0x094e('0x10')),'defaultValue':null,'get':function(){if(!this[_0x094e('0x11')](_0x094e('0x12')))return'custom';return this[_0x094e('0x11')](_0x094e('0x12'));},'set':function(_0x260e10){if(_0x260e10===_0x094e('0x13'))_0x260e10=null;return this[_0x094e('0xb')](_0x094e('0x12'),_0x260e10);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 74c90ed..075c2c6 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 _0x2c92=['Unknown\x20email\x20service\x20provider','smtp.gmail.com','hotmail','smtp-mail.outlook.com','smtp.office365.com','user','username','pass','password','modernAuthentication','CloudProviderId','port','host','secure','service','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','MailAccount','findAll','rows','show','find','body','custom','provider','params','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','create','getDispositions','findOne','Disposition','ids','addAnswer','CannedAnswer','removeAnswers','email','ListId','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','fullname','internal','Tag','Tags','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','MailMessage','$gte','split','format','inlineCss','true','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','removeAgents','emit','userMailAccount:remove','getAgents','User','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','sendStatus','stack','name','send','gmail','imap.gmail.com','yahoo','imap-mail.outlook.com','outlook365','outlook.office365.com'];(function(_0x5b1b34,_0x164d41){var _0x4254bc=function(_0x4fce4b){while(--_0x4fce4b){_0x5b1b34['push'](_0x5b1b34['shift']());}};_0x4254bc(++_0x164d41);}(_0x2c92,0x93));var _0x22c9=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x2c92[_0x373dee];return _0x46798f;};'use strict';var moment=require('moment');var BPromise=require(_0x22c9('0x0'));var util=require(_0x22c9('0x1'));var path=require(_0x22c9('0x2'));var _=require(_0x22c9('0x3'));var juice=require(_0x22c9('0x4'));var Redis=require(_0x22c9('0x5'));var qs=require(_0x22c9('0x6'));var logger=require('../../config/logger')(_0x22c9('0x7'));var config=require(_0x22c9('0x8'));var db=require(_0x22c9('0x9'))['db'];config[_0x22c9('0xa')]=_[_0x22c9('0xb')](config[_0x22c9('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x22c9('0xc'))(new Redis(config[_0x22c9('0xa')]));require(_0x22c9('0xd'))[_0x22c9('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x22c9('0xf')][_0x22c9('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x386100,_0x4dc0a9,_0x2784fd,_0x4e30c5){return new BPromise(function(_0x476ccd,_0x245e32){var _0x23ead0=_0x4e30c5||client;return _0x23ead0[_0x22c9('0x11')](_0x386100,_0x2784fd)[_0x22c9('0x12')](function(_0x55e548){logger[_0x22c9('0x13')](_0x22c9('0x14'),_0x4dc0a9,'request\x20sent');logger[_0x22c9('0x15')](_0x22c9('0x16'),_0x4dc0a9,_0x22c9('0x17'),JSON[_0x22c9('0x18')](_0x55e548));if(_0x55e548[_0x22c9('0x19')]){if(_0x55e548[_0x22c9('0x19')]['code']===0x1f4){logger['error'](_0x22c9('0x14'),_0x4dc0a9,_0x55e548[_0x22c9('0x19')][_0x22c9('0x1a')]);return _0x245e32(_0x55e548[_0x22c9('0x19')][_0x22c9('0x1a')]);}logger[_0x22c9('0x19')](_0x22c9('0x14'),_0x4dc0a9,_0x55e548[_0x22c9('0x19')]['message']);return _0x476ccd(_0x55e548[_0x22c9('0x19')][_0x22c9('0x1a')]);}else{logger[_0x22c9('0x13')]('MailAccount,\x20%s,\x20%s',_0x4dc0a9,_0x22c9('0x17'));_0x476ccd(_0x55e548[_0x22c9('0x1b')][_0x22c9('0x1a')]);}})[_0x22c9('0x1c')](function(_0x362a62){logger[_0x22c9('0x19')](_0x22c9('0x14'),_0x4dc0a9,_0x362a62);_0x245e32(_0x362a62);});});}function respondWithStatusCode(_0x39db09,_0x3262fe){_0x3262fe=_0x3262fe||0xcc;return function(_0x437875){if(_0x437875){return _0x39db09['sendStatus'](_0x3262fe);}return _0x39db09[_0x22c9('0x1d')](_0x3262fe)[_0x22c9('0x1e')]();};}function respondWithResult(_0x59a65b,_0x21681a){_0x21681a=_0x21681a||0xc8;return function(_0x53f82c){if(_0x53f82c){return _0x59a65b['status'](_0x21681a)[_0x22c9('0x1f')](_0x53f82c);}};}function respondWithFilteredResult(_0x43f686,_0x3f4209){return function(_0xd9eb42){if(_0xd9eb42){var _0x360e58=typeof _0x3f4209[_0x22c9('0x20')]==='undefined'&&typeof _0x3f4209[_0x22c9('0x21')]===_0x22c9('0x22');var _0x4b8cb8=_0xd9eb42[_0x22c9('0x23')];var _0x3a38bb=_0x360e58?0x0:_0x3f4209[_0x22c9('0x20')];var _0x355c25=_0x360e58?_0xd9eb42[_0x22c9('0x23')]:_0x3f4209[_0x22c9('0x20')]+_0x3f4209[_0x22c9('0x21')];var _0x52029c;if(_0x355c25>=_0x4b8cb8){_0x355c25=_0x4b8cb8;_0x52029c=0xc8;}else{_0x52029c=0xce;}_0x43f686[_0x22c9('0x1d')](_0x52029c);return _0x43f686[_0x22c9('0x24')](_0x22c9('0x25'),_0x3a38bb+'-'+_0x355c25+'/'+_0x4b8cb8)[_0x22c9('0x1f')](_0xd9eb42);}return null;};}function saveUpdates(_0x5e171d){return function(_0x47313e){if(_0x47313e){return _0x47313e[_0x22c9('0x26')](_0x5e171d)['then'](function(_0x56c0b2){return _0x56c0b2;});}return null;};}function removeEntity(_0xda0dba){return function(_0x397cae){if(_0x397cae){return _0x397cae[_0x22c9('0x27')]()[_0x22c9('0x12')](function(){var _0xa654ae=_0x397cae['get']({'plain':!![]});var _0x31f037='MailAccounts';return db['UserProfileResource'][_0x22c9('0x27')]({'where':{'type':_0x31f037,'resourceId':_0xa654ae['id']}})[_0x22c9('0x12')](function(){return _0x397cae;});})['then'](function(){_0xda0dba[_0x22c9('0x1d')](0xcc)[_0x22c9('0x1e')]();});}};}function handleEntityNotFound(_0x4ffea9){return function(_0x53431e){if(!_0x53431e){_0x4ffea9[_0x22c9('0x28')](0x194);}return _0x53431e;};}function handleError(_0x12be8f,_0x5b1c52){_0x5b1c52=_0x5b1c52||0x1f4;return function(_0x4b1dc6){logger[_0x22c9('0x19')](_0x4b1dc6[_0x22c9('0x29')]);if(_0x4b1dc6['name']){delete _0x4b1dc6[_0x22c9('0x2a')];}_0x12be8f[_0x22c9('0x1d')](_0x5b1c52)[_0x22c9('0x2b')](_0x4b1dc6);};}function getImapHost(_0x55ae5e){switch(_0x55ae5e){case _0x22c9('0x2c'):return _0x22c9('0x2d');case _0x22c9('0x2e'):return'imap.mail.yahoo.com';case'hotmail':return _0x22c9('0x2f');case _0x22c9('0x30'):return _0x22c9('0x31');}throw new Error(_0x22c9('0x32'),_0x55ae5e);}function getSmtpHost(_0x4f6d7e){switch(_0x4f6d7e){case _0x22c9('0x2c'):return _0x22c9('0x33');case _0x22c9('0x2e'):return'smtp.mail.yahoo.com';case _0x22c9('0x34'):return _0x22c9('0x35');case _0x22c9('0x30'):return _0x22c9('0x36');}throw new Error(_0x22c9('0x32'),_0x4f6d7e);}function getAuthenticationOptions(_0x1d9fe7,_0x540c1a){var _0x2f552d={};var _0x46522d={};if(_0x1d9fe7){_0x2f552d[_0x22c9('0x37')]=_0x46522d['user']=_0x540c1a[_0x22c9('0x38')];_0x2f552d['password']=_0x46522d[_0x22c9('0x39')]=_0x540c1a[_0x22c9('0x3a')];if(_0x540c1a[_0x22c9('0x3b')]){_0x2f552d['modernAuthentication']=_0x46522d[_0x22c9('0x3b')]=!![];_0x2f552d['CloudProviderId']=_0x46522d['CloudProviderId']=_0x540c1a[_0x22c9('0x3c')];_0x2f552d[_0x22c9('0x3a')]=_0x46522d['pass']=null;}else{_0x2f552d['CloudProviderId']=_0x46522d['CloudProviderId']=null;}_0x2f552d['host']=getImapHost(_0x1d9fe7);_0x2f552d[_0x22c9('0x3d')]=0x3e1;_0x46522d[_0x22c9('0x3e')]=getSmtpHost(_0x1d9fe7);_0x46522d[_0x22c9('0x3d')]=0x24b;_0x46522d[_0x22c9('0x3f')]=![];_0x2f552d[_0x22c9('0x40')]=_0x46522d[_0x22c9('0x40')]=null;}else{if(_0x540c1a['authentication']){_0x2f552d[_0x22c9('0x37')]=_0x46522d[_0x22c9('0x37')]=_0x540c1a['username'];_0x2f552d['password']=_0x46522d[_0x22c9('0x39')]=_0x540c1a[_0x22c9('0x3a')];}else{_0x2f552d['authentication']=_0x46522d['authentication']=![];_0x2f552d['user']=_0x46522d[_0x22c9('0x37')]=null;_0x2f552d[_0x22c9('0x3a')]=_0x46522d['pass']=null;}_0x2f552d[_0x22c9('0x3e')]=_0x540c1a[_0x22c9('0x41')][_0x22c9('0x3e')];_0x2f552d[_0x22c9('0x3d')]=_0x540c1a[_0x22c9('0x41')]['port'];_0x46522d[_0x22c9('0x3e')]=_0x540c1a[_0x22c9('0x42')]['host'];_0x46522d[_0x22c9('0x3d')]=_0x540c1a['Smtp'][_0x22c9('0x3d')];}return{'Imap':_0x2f552d,'Smtp':_0x46522d};}exports[_0x22c9('0x43')]=function(_0x3edaf8,_0x123a09){var _0x5c6c8c={'include':[{'model':db[_0x22c9('0x44')],'as':_0x22c9('0x41')},{'model':db[_0x22c9('0x45')],'as':_0x22c9('0x42')},{'model':db[_0x22c9('0x46')],'as':_0x22c9('0x47')}]},_0x291fc7={},_0x14f7c4={'count':0x0,'rows':[]};var _0x3003ab=_[_0x22c9('0x48')](db['MailAccount'][_0x22c9('0x49')],function(_0x320d5b){return{'name':_0x320d5b[_0x22c9('0x4a')],'type':_0x320d5b[_0x22c9('0x4b')][_0x22c9('0x4c')]};});_0x291fc7[_0x22c9('0x4d')]=_[_0x22c9('0x48')](_0x3003ab,'name');_0x291fc7[_0x22c9('0x4e')]=_[_0x22c9('0x4f')](_0x3edaf8[_0x22c9('0x4e')]);_0x291fc7[_0x22c9('0x50')]=_[_0x22c9('0x51')](_0x291fc7['model'],_0x291fc7[_0x22c9('0x4e')]);_0x5c6c8c[_0x22c9('0x52')]=_['intersection'](_0x291fc7[_0x22c9('0x4d')],qs[_0x22c9('0x53')](_0x3edaf8[_0x22c9('0x4e')]['fields']));_0x5c6c8c[_0x22c9('0x52')]=_0x5c6c8c[_0x22c9('0x52')][_0x22c9('0x54')]?_0x5c6c8c['attributes']:_0x291fc7[_0x22c9('0x4d')];if(!_0x3edaf8[_0x22c9('0x4e')][_0x22c9('0x55')](_0x22c9('0x56'))){_0x5c6c8c[_0x22c9('0x21')]=qs[_0x22c9('0x21')](_0x3edaf8['query'][_0x22c9('0x21')]);_0x5c6c8c[_0x22c9('0x20')]=qs[_0x22c9('0x20')](_0x3edaf8[_0x22c9('0x4e')][_0x22c9('0x20')]);}_0x5c6c8c[_0x22c9('0x57')]=qs[_0x22c9('0x58')](_0x3edaf8['query']['sort']);_0x5c6c8c[_0x22c9('0x59')]=qs[_0x22c9('0x50')](_[_0x22c9('0x5a')](_0x3edaf8[_0x22c9('0x4e')],_0x291fc7[_0x22c9('0x50')]),_0x3003ab);if(_0x3edaf8[_0x22c9('0x4e')][_0x22c9('0x5b')]){_0x5c6c8c['where']=_[_0x22c9('0x5c')](_0x5c6c8c[_0x22c9('0x59')],{'$or':_[_0x22c9('0x48')](_0x3003ab,function(_0x8c6266){if(_0x8c6266[_0x22c9('0x4b')]!=='VIRTUAL'){var _0x318c19={};_0x318c19[_0x8c6266['name']]={'$like':'%'+_0x3edaf8['query']['filter']+'%'};return _0x318c19;}})});}_0x5c6c8c=_[_0x22c9('0x5c')]({},_0x5c6c8c,_0x3edaf8[_0x22c9('0x5d')]);var _0xe0d614={'where':_0x5c6c8c[_0x22c9('0x59')]};return db['MailAccount'][_0x22c9('0x23')](_0xe0d614)[_0x22c9('0x12')](function(_0x1d5711){_0x14f7c4[_0x22c9('0x23')]=_0x1d5711;if(_0x3edaf8['query'][_0x22c9('0x5e')]){_0x5c6c8c[_0x22c9('0x5f')]=[{'all':!![]}];}return db[_0x22c9('0x60')][_0x22c9('0x61')](_0x5c6c8c);})[_0x22c9('0x12')](function(_0x31b4d1){_0x14f7c4[_0x22c9('0x62')]=_0x31b4d1;return _0x14f7c4;})['then'](respondWithFilteredResult(_0x123a09,_0x5c6c8c))[_0x22c9('0x1c')](handleError(_0x123a09,null));};exports[_0x22c9('0x63')]=function(_0x2c3a79,_0x2fed24){var _0x15462d={'raw':![],'where':{'id':_0x2c3a79['params']['id']},'include':[{'model':db[_0x22c9('0x44')],'as':_0x22c9('0x41')},{'model':db[_0x22c9('0x45')],'as':_0x22c9('0x42')},{'model':db[_0x22c9('0x46')],'as':_0x22c9('0x47')}]},_0x415761={};_0x415761['model']=_[_0x22c9('0x4f')](db[_0x22c9('0x60')]['rawAttributes']);_0x415761['query']=_[_0x22c9('0x4f')](_0x2c3a79[_0x22c9('0x4e')]);_0x415761['filters']=_[_0x22c9('0x51')](_0x415761[_0x22c9('0x4d')],_0x415761[_0x22c9('0x4e')]);_0x15462d[_0x22c9('0x52')]=_[_0x22c9('0x51')](_0x415761['model'],qs[_0x22c9('0x53')](_0x2c3a79[_0x22c9('0x4e')]['fields']));_0x15462d['attributes']=_0x15462d[_0x22c9('0x52')][_0x22c9('0x54')]?_0x15462d[_0x22c9('0x52')]:_0x415761[_0x22c9('0x4d')];if(_0x2c3a79[_0x22c9('0x4e')][_0x22c9('0x5e')]){_0x15462d[_0x22c9('0x5f')]=[{'all':!![]}];}_0x15462d=_[_0x22c9('0x5c')]({},_0x15462d,_0x2c3a79['options']);return db['MailAccount'][_0x22c9('0x64')](_0x15462d)['then'](handleEntityNotFound(_0x2fed24,null))['then'](respondWithResult(_0x2fed24,null))[_0x22c9('0x1c')](handleError(_0x2fed24,null));};exports[_0x22c9('0x26')]=function(_0x2888a5,_0x537222){if(_0x2888a5[_0x22c9('0x65')]['id']){delete _0x2888a5[_0x22c9('0x65')]['id'];}var _0x5583ef=_0x2888a5[_0x22c9('0x65')]['provider']===_0x22c9('0x66')?null:_0x2888a5[_0x22c9('0x65')][_0x22c9('0x67')];var _0x18b667=_0x2888a5[_0x22c9('0x65')][_0x22c9('0x41')]||{};var _0x2e60a7=_0x2888a5['body'][_0x22c9('0x42')]||{};if(_0x5583ef){_0x18b667[_0x22c9('0x3e')]=getImapHost(_0x5583ef);_0x18b667[_0x22c9('0x3d')]=0x3e1;_0x2e60a7['host']=getSmtpHost(_0x5583ef);_0x2e60a7[_0x22c9('0x3d')]=0x24b;_0x2e60a7[_0x22c9('0x3f')]=![];}if(_0x2e60a7['modernAuthentication']){_0x2e60a7['secure']=![];}else{_0x2e60a7[_0x22c9('0x3c')]=null;}if(!_0x18b667['modernAuthentication'])_0x18b667[_0x22c9('0x3c')]=null;_0x2888a5[_0x22c9('0x65')][_0x22c9('0x41')]=_0x18b667;_0x2888a5[_0x22c9('0x65')]['Smtp']=_0x2e60a7;return db[_0x22c9('0x60')][_0x22c9('0x64')]({'where':{'id':_0x2888a5[_0x22c9('0x68')]['id']},'include':[{'model':db[_0x22c9('0x44')],'as':_0x22c9('0x41')},{'model':db[_0x22c9('0x45')],'as':_0x22c9('0x42')},{'model':db[_0x22c9('0x46')],'as':_0x22c9('0x47')}]})['then'](handleEntityNotFound(_0x537222,null))[_0x22c9('0x12')](function(_0x350b0f){if(!_0x350b0f)throw new Error(_0x22c9('0x69'));if(_0x350b0f[_0x22c9('0x40')])delete _0x2888a5[_0x22c9('0x65')][_0x22c9('0x41')];return _0x350b0f;})[_0x22c9('0x12')](saveUpdates(_0x2888a5[_0x22c9('0x65')],null))[_0x22c9('0x12')](function(_0x2b8446){if(!_0x2888a5[_0x22c9('0x65')][_0x22c9('0x41')])return _0x2b8446;return db[_0x22c9('0x44')][_0x22c9('0x26')](_0x2888a5['body'][_0x22c9('0x41')],{'where':{'MailAccountId':_0x2b8446['id']}})[_0x22c9('0x12')](function(){return _0x2b8446;});})[_0x22c9('0x12')](function(_0x1a8a97){if(!_0x2888a5[_0x22c9('0x65')][_0x22c9('0x42')])return _0x1a8a97;return db[_0x22c9('0x45')]['update'](_0x2888a5[_0x22c9('0x65')][_0x22c9('0x42')],{'where':{'MailAccountId':_0x1a8a97['id']}})[_0x22c9('0x12')](function(){return _0x1a8a97;});})[_0x22c9('0x12')](respondWithResult(_0x537222,null))[_0x22c9('0x1c')](handleError(_0x537222,null));};exports['describe']=function(_0x3f1eed,_0xf7b528){return db[_0x22c9('0x60')][_0x22c9('0x6a')]()['then'](respondWithResult(_0xf7b528,null))[_0x22c9('0x1c')](handleError(_0xf7b528,null));};exports[_0x22c9('0x6b')]=function(_0x4058f0,_0x16f311){if(_0x4058f0['body']['id']){delete _0x4058f0[_0x22c9('0x65')]['id'];}return db['MailAccount'][_0x22c9('0x64')]({'where':{'id':_0x4058f0['params']['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x16f311,null))[_0x22c9('0x12')](function(_0x264605){if(_0x264605){_0x4058f0[_0x22c9('0x65')][_0x22c9('0x6c')]=_0x264605['id'];return db['Disposition'][_0x22c9('0x6d')](_0x4058f0[_0x22c9('0x65')]);}})[_0x22c9('0x12')](respondWithResult(_0x16f311,null))[_0x22c9('0x1c')](handleError(_0x16f311,null));};exports[_0x22c9('0x6e')]=function(_0x5d8b56,_0x5c1c81){var _0x1ab266={'raw':![],'where':{}};var _0xda8f37={};var _0x551762={'count':0x0,'rows':[]};return db[_0x22c9('0x60')][_0x22c9('0x6f')]({'where':{'id':_0x5d8b56['params']['id']}})['then'](handleEntityNotFound(_0x5c1c81,null))[_0x22c9('0x12')](function(_0x122993){if(_0x122993){_0xda8f37[_0x22c9('0x4d')]=_['keys'](db[_0x22c9('0x70')][_0x22c9('0x49')]);_0xda8f37[_0x22c9('0x4e')]=_['keys'](_0x5d8b56[_0x22c9('0x4e')]);_0xda8f37['filters']=_[_0x22c9('0x51')](_0xda8f37[_0x22c9('0x4d')],_0xda8f37['query']);_0x1ab266['attributes']=_[_0x22c9('0x51')](_0xda8f37['model'],qs[_0x22c9('0x53')](_0x5d8b56[_0x22c9('0x4e')][_0x22c9('0x53')]));_0x1ab266[_0x22c9('0x52')]=_0x1ab266[_0x22c9('0x52')][_0x22c9('0x54')]?_0x1ab266[_0x22c9('0x52')]:_0xda8f37[_0x22c9('0x4d')];if(!_0x5d8b56[_0x22c9('0x4e')][_0x22c9('0x55')](_0x22c9('0x56'))){_0x1ab266[_0x22c9('0x21')]=qs[_0x22c9('0x21')](_0x5d8b56[_0x22c9('0x4e')][_0x22c9('0x21')]);_0x1ab266[_0x22c9('0x20')]=qs[_0x22c9('0x20')](_0x5d8b56[_0x22c9('0x4e')][_0x22c9('0x20')]);}_0x1ab266[_0x22c9('0x57')]=qs[_0x22c9('0x58')](_0x5d8b56['query']['sort']);_0x1ab266[_0x22c9('0x59')]=qs['filters'](_['pick'](_0x5d8b56['query'],_0xda8f37[_0x22c9('0x50')]));_0x1ab266['where'][_0x22c9('0x6c')]=_0x122993['id'];if(_0x5d8b56[_0x22c9('0x4e')][_0x22c9('0x5b')]){_0x1ab266['where']=_['merge'](_0x1ab266[_0x22c9('0x59')],{'$or':_[_0x22c9('0x48')](_0x1ab266[_0x22c9('0x52')],function(_0x5f417e){var _0x4d569a={};_0x4d569a[_0x5f417e]={'$like':'%'+_0x5d8b56['query'][_0x22c9('0x5b')]+'%'};return _0x4d569a;})});}_0x1ab266=_[_0x22c9('0x5c')]({},_0x1ab266,_0x5d8b56[_0x22c9('0x5d')]);return db['Disposition'][_0x22c9('0x23')]({'where':_0x1ab266['where']})['then'](function(_0x211cc8){_0x551762[_0x22c9('0x23')]=_0x211cc8;if(_0x5d8b56[_0x22c9('0x4e')][_0x22c9('0x5e')]){_0x1ab266[_0x22c9('0x5f')]=[{'all':!![]}];}return db[_0x22c9('0x70')][_0x22c9('0x61')](_0x1ab266);})[_0x22c9('0x12')](function(_0x28b838){_0x551762['rows']=_0x28b838;return _0x551762;});}})[_0x22c9('0x12')](respondWithFilteredResult(_0x5c1c81,_0x1ab266))[_0x22c9('0x1c')](handleError(_0x5c1c81,null));};exports['removeDispositions']=function(_0x473c25,_0x2ccf30){return db['MailAccount'][_0x22c9('0x64')]({'where':{'id':_0x473c25[_0x22c9('0x68')]['id']}})['then'](handleEntityNotFound(_0x2ccf30,null))[_0x22c9('0x12')](function(_0x380b43){if(_0x380b43){return _0x380b43['removeDispositions'](_0x473c25['query'][_0x22c9('0x71')]);}})[_0x22c9('0x12')](respondWithStatusCode(_0x2ccf30,null))[_0x22c9('0x1c')](handleError(_0x2ccf30,null));};exports[_0x22c9('0x72')]=function(_0x28fc96,_0x2509d7){if(_0x28fc96['body']['id']){delete _0x28fc96[_0x22c9('0x65')]['id'];}return db[_0x22c9('0x60')][_0x22c9('0x64')]({'where':{'id':_0x28fc96['params']['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x2509d7,null))['then'](function(_0x40f771){if(_0x40f771){_0x28fc96[_0x22c9('0x65')]['MailAccountId']=_0x40f771['id'];return db[_0x22c9('0x73')][_0x22c9('0x6d')](_0x28fc96[_0x22c9('0x65')]);}})[_0x22c9('0x12')](respondWithResult(_0x2509d7,null))[_0x22c9('0x1c')](handleError(_0x2509d7,null));};exports['getAnswers']=function(_0x20b1b1,_0xa79515){var _0x560d5d={'raw':![],'where':{}};var _0x35c69c={};var _0x4c08f={'count':0x0,'rows':[]};return db[_0x22c9('0x60')][_0x22c9('0x6f')]({'where':{'id':_0x20b1b1['params']['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0xa79515,null))[_0x22c9('0x12')](function(_0x23b705){if(_0x23b705){_0x35c69c[_0x22c9('0x4d')]=_[_0x22c9('0x4f')](db['CannedAnswer'][_0x22c9('0x49')]);_0x35c69c[_0x22c9('0x4e')]=_[_0x22c9('0x4f')](_0x20b1b1[_0x22c9('0x4e')]);_0x35c69c[_0x22c9('0x50')]=_['intersection'](_0x35c69c[_0x22c9('0x4d')],_0x35c69c['query']);_0x560d5d[_0x22c9('0x52')]=_[_0x22c9('0x51')](_0x35c69c[_0x22c9('0x4d')],qs[_0x22c9('0x53')](_0x20b1b1[_0x22c9('0x4e')][_0x22c9('0x53')]));_0x560d5d[_0x22c9('0x52')]=_0x560d5d[_0x22c9('0x52')]['length']?_0x560d5d[_0x22c9('0x52')]:_0x35c69c['model'];if(!_0x20b1b1[_0x22c9('0x4e')][_0x22c9('0x55')](_0x22c9('0x56'))){_0x560d5d[_0x22c9('0x21')]=qs['limit'](_0x20b1b1[_0x22c9('0x4e')][_0x22c9('0x21')]);_0x560d5d[_0x22c9('0x20')]=qs[_0x22c9('0x20')](_0x20b1b1['query'][_0x22c9('0x20')]);}_0x560d5d[_0x22c9('0x57')]=qs[_0x22c9('0x58')](_0x20b1b1[_0x22c9('0x4e')][_0x22c9('0x58')]);_0x560d5d[_0x22c9('0x59')]=qs[_0x22c9('0x50')](_[_0x22c9('0x5a')](_0x20b1b1[_0x22c9('0x4e')],_0x35c69c['filters']));_0x560d5d['where'][_0x22c9('0x6c')]=_0x23b705['id'];if(_0x20b1b1[_0x22c9('0x4e')][_0x22c9('0x5b')]){_0x560d5d[_0x22c9('0x59')]=_[_0x22c9('0x5c')](_0x560d5d[_0x22c9('0x59')],{'$or':_['map'](_0x560d5d[_0x22c9('0x52')],function(_0xe733b0){var _0xa1ce4={};_0xa1ce4[_0xe733b0]={'$like':'%'+_0x20b1b1[_0x22c9('0x4e')][_0x22c9('0x5b')]+'%'};return _0xa1ce4;})});}_0x560d5d=_[_0x22c9('0x5c')]({},_0x560d5d,_0x20b1b1['options']);return db[_0x22c9('0x73')][_0x22c9('0x23')]({'where':_0x560d5d['where']})[_0x22c9('0x12')](function(_0x1538c9){_0x4c08f['count']=_0x1538c9;if(_0x20b1b1[_0x22c9('0x4e')][_0x22c9('0x5e')]){_0x560d5d['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x22c9('0x61')](_0x560d5d);})['then'](function(_0x1827ff){_0x4c08f[_0x22c9('0x62')]=_0x1827ff;return _0x4c08f;});}})[_0x22c9('0x12')](respondWithFilteredResult(_0xa79515,_0x560d5d))[_0x22c9('0x1c')](handleError(_0xa79515,null));};exports[_0x22c9('0x74')]=function(_0x41f985,_0x2a1300){return db['MailAccount']['find']({'where':{'id':_0x41f985[_0x22c9('0x68')]['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x2a1300,null))[_0x22c9('0x12')](function(_0x135838){if(_0x135838){return _0x135838[_0x22c9('0x74')](_0x41f985['query'][_0x22c9('0x71')]);}})[_0x22c9('0x12')](respondWithStatusCode(_0x2a1300,null))[_0x22c9('0x1c')](handleError(_0x2a1300,null));};exports[_0x22c9('0x6d')]=function(_0x40022c,_0x1a2ab8){var _0x967e53={'name':_0x40022c['body']['name'],'key':_0x40022c[_0x22c9('0x65')][_0x22c9('0x4c')],'provider':_0x40022c['body'][_0x22c9('0x67')]===_0x22c9('0x66')?null:_0x40022c[_0x22c9('0x65')]['provider'],'email':_0x40022c[_0x22c9('0x65')][_0x22c9('0x75')],'ListId':_0x40022c[_0x22c9('0x65')][_0x22c9('0x76')],'active':!_['isNil'](_0x40022c[_0x22c9('0x65')][_0x22c9('0x77')])?_0x40022c['body'][_0x22c9('0x77')]:!![],'description':_0x40022c[_0x22c9('0x65')][_0x22c9('0x78')]||null};var _0x31d72c=getAuthenticationOptions(_0x967e53[_0x22c9('0x67')],_0x40022c[_0x22c9('0x65')]);_0x967e53['Imap']=_0x31d72c[_0x22c9('0x41')];_0x967e53[_0x22c9('0x42')]=_0x31d72c[_0x22c9('0x42')];return db[_0x22c9('0x60')][_0x22c9('0x6d')](_0x967e53,{'include':[{'model':db[_0x22c9('0x45')],'as':'Smtp'},{'model':db[_0x22c9('0x44')],'as':_0x22c9('0x41')}]})[_0x22c9('0x12')](function(_0x32ed26){var _0x527959=_0x40022c[_0x22c9('0x37')]['get']({'plain':!![]});if(!_0x527959)throw new Error(_0x22c9('0x79'));if(_0x527959[_0x22c9('0x7a')]===_0x22c9('0x37')){var _0x8da1af=_0x32ed26[_0x22c9('0x7b')]({'plain':!![]});return db[_0x22c9('0x7c')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x527959[_0x22c9('0x7d')]},'raw':!![]})['then'](function(_0x4684ab){if(_0x4684ab&&_0x4684ab[_0x22c9('0x7e')]===0x0){return db[_0x22c9('0x7f')]['create']({'name':_0x8da1af[_0x22c9('0x2a')],'resourceId':_0x8da1af['id'],'type':_0x4684ab[_0x22c9('0x2a')],'sectionId':_0x4684ab['id']},{})['then'](function(){return _0x32ed26;});}else{return _0x32ed26;}})[_0x22c9('0x1c')](function(_0x4069ca){logger[_0x22c9('0x19')](_0x22c9('0x80'),_0x4069ca);throw _0x4069ca;});}return _0x32ed26;})['then'](respondWithResult(_0x1a2ab8,0xc9))[_0x22c9('0x1c')](handleError(_0x1a2ab8,null));};exports[_0x22c9('0x81')]=function(_0x19b84d,_0x117f85){return db[_0x22c9('0x60')][_0x22c9('0x6f')]({'where':{'id':_0x19b84d[_0x22c9('0x68')]['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x117f85,null))['then'](function(_0x42e857){if(_0x42e857){return _0x42e857['getImap']();}return null;})[_0x22c9('0x12')](respondWithResult(_0x117f85,null))[_0x22c9('0x1c')](handleError(_0x117f85,null));};exports[_0x22c9('0x82')]=function(_0x198293,_0x59ffc9){if(_0x198293['body']['id']){delete _0x198293[_0x22c9('0x65')]['id'];}return db[_0x22c9('0x60')][_0x22c9('0x64')]({'where':{'id':_0x198293['params']['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x59ffc9,null))[_0x22c9('0x12')](function(_0x363727){if(_0x363727){_0x198293[_0x22c9('0x65')][_0x22c9('0x6c')]=_0x363727['id'];return db[_0x22c9('0x44')][_0x22c9('0x6d')](_0x198293[_0x22c9('0x65')]);}})['then'](respondWithResult(_0x59ffc9,null))[_0x22c9('0x1c')](handleError(_0x59ffc9,null));};exports[_0x22c9('0x83')]=function(_0x41cb86,_0x45b7b5){return db[_0x22c9('0x60')][_0x22c9('0x6f')]({'where':{'id':_0x41cb86['params']['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x45b7b5,null))[_0x22c9('0x12')](function(_0x6ce906){if(_0x6ce906){return _0x6ce906[_0x22c9('0x84')](null);}return null;})[_0x22c9('0x12')](respondWithStatusCode(_0x45b7b5,null))['catch'](handleError(_0x45b7b5,null));};exports['getSmtp']=function(_0x42e61c,_0x47360a){return db[_0x22c9('0x60')][_0x22c9('0x6f')]({'where':{'id':_0x42e61c[_0x22c9('0x68')]['id']}})['then'](handleEntityNotFound(_0x47360a,null))[_0x22c9('0x12')](function(_0x5de493){if(_0x5de493){return _0x5de493[_0x22c9('0x85')]();}return null;})['then'](respondWithResult(_0x47360a,null))[_0x22c9('0x1c')](handleError(_0x47360a,null));};exports[_0x22c9('0x86')]=function(_0x3cd2f4,_0x454127){if(_0x3cd2f4['body']['id']){delete _0x3cd2f4[_0x22c9('0x65')]['id'];}return db[_0x22c9('0x60')]['find']({'where':{'id':_0x3cd2f4[_0x22c9('0x68')]['id']}})['then'](handleEntityNotFound(_0x454127,null))[_0x22c9('0x12')](function(_0xa84f83){if(_0xa84f83){_0x3cd2f4[_0x22c9('0x65')][_0x22c9('0x6c')]=_0xa84f83['id'];return db[_0x22c9('0x45')]['create'](_0x3cd2f4['body']);}})[_0x22c9('0x12')](respondWithResult(_0x454127,null))['catch'](handleError(_0x454127,null));};exports[_0x22c9('0x87')]=function(_0xafdacc,_0x4093bb){return db[_0x22c9('0x60')]['findOne']({'where':{'id':_0xafdacc[_0x22c9('0x68')]['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x4093bb,null))[_0x22c9('0x12')](function(_0x2f676b){if(_0x2f676b){return _0x2f676b[_0x22c9('0x88')](null);}return null;})[_0x22c9('0x12')](respondWithStatusCode(_0x4093bb,null))[_0x22c9('0x1c')](handleError(_0x4093bb,null));};exports[_0x22c9('0x89')]=function(_0xf15a1f,_0x26a812){return db[_0x22c9('0x8a')][_0x22c9('0x64')]({'where':{'id':_0xf15a1f[_0x22c9('0x68')]['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x26a812,null))[_0x22c9('0x12')](function(_0x20cf1e){if(_0x20cf1e){return _0x20cf1e[_0x22c9('0x89')](_0xf15a1f[_0x22c9('0x65')]['ids'],_[_0x22c9('0x8b')](_0xf15a1f[_0x22c9('0x65')],[_0x22c9('0x71'),'id'])||{});}})['then'](respondWithResult(_0x26a812,null))[_0x22c9('0x1c')](handleError(_0x26a812,null));};exports[_0x22c9('0x8c')]=function(_0x1c0026,_0x3e6457){var _0x817667={'raw':![],'where':{}};var _0x3cbfc3={};var _0x690cd0={'count':0x0,'rows':[]};return db[_0x22c9('0x60')][_0x22c9('0x6f')]({'where':{'id':_0x1c0026[_0x22c9('0x68')]['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x3e6457,null))[_0x22c9('0x12')](function(_0xa7258f){if(_0xa7258f){_0x3cbfc3[_0x22c9('0x4d')]=_[_0x22c9('0x4f')](db[_0x22c9('0x8a')][_0x22c9('0x49')]);_0x3cbfc3[_0x22c9('0x4e')]=_[_0x22c9('0x4f')](_0x1c0026[_0x22c9('0x4e')]);_0x3cbfc3[_0x22c9('0x50')]=_['intersection'](_0x3cbfc3[_0x22c9('0x4d')],_0x3cbfc3[_0x22c9('0x4e')]);_0x817667[_0x22c9('0x52')]=_[_0x22c9('0x51')](_0x3cbfc3[_0x22c9('0x4d')],qs[_0x22c9('0x53')](_0x1c0026[_0x22c9('0x4e')][_0x22c9('0x53')]));_0x817667['attributes']=_0x817667['attributes'][_0x22c9('0x54')]?_0x817667['attributes']:_0x3cbfc3['model'];if(!_0x1c0026[_0x22c9('0x4e')][_0x22c9('0x55')](_0x22c9('0x56'))){_0x817667[_0x22c9('0x21')]=qs['limit'](_0x1c0026[_0x22c9('0x4e')][_0x22c9('0x21')]);_0x817667[_0x22c9('0x20')]=qs[_0x22c9('0x20')](_0x1c0026['query']['offset']);}_0x817667['order']=qs[_0x22c9('0x58')](_0x1c0026[_0x22c9('0x4e')]['sort']);_0x817667[_0x22c9('0x59')]=qs[_0x22c9('0x50')](_[_0x22c9('0x5a')](_0x1c0026[_0x22c9('0x4e')],_0x3cbfc3[_0x22c9('0x50')]));_0x817667[_0x22c9('0x59')][_0x22c9('0x6c')]=_0xa7258f['id'];if(_0x1c0026[_0x22c9('0x4e')][_0x22c9('0x5b')]){_0x817667[_0x22c9('0x59')]=_[_0x22c9('0x5c')](_0x817667['where'],{'$or':_[_0x22c9('0x48')](_0x817667[_0x22c9('0x52')],function(_0x39e22e){var _0x1f799c={};_0x1f799c[_0x39e22e]={'$like':'%'+_0x1c0026['query'][_0x22c9('0x5b')]+'%'};return _0x1f799c;})});}_0x817667=_['merge']({},_0x817667,_0x1c0026[_0x22c9('0x5d')]);return db[_0x22c9('0x8a')][_0x22c9('0x23')]({'where':_0x817667[_0x22c9('0x59')]})[_0x22c9('0x12')](function(_0x32da2a){_0x690cd0[_0x22c9('0x23')]=_0x32da2a;if(_0x1c0026[_0x22c9('0x4e')][_0x22c9('0x5e')]){_0x817667['include']=[{'model':db[_0x22c9('0x8d')],'as':_0x22c9('0x8e'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x22c9('0x2a'),_0x22c9('0x8f'),_0x22c9('0x90')],'required':![]},{'model':db[_0x22c9('0x91')],'as':_0x22c9('0x92'),'attributes':['id',_0x22c9('0x2a'),'color'],'where':_0x1c0026[_0x22c9('0x4e')][_0x22c9('0x93')]?{'id':_0x1c0026[_0x22c9('0x4e')]['tag']}:undefined,'required':_0x1c0026[_0x22c9('0x4e')][_0x22c9('0x93')]?!![]:![]}];}return db[_0x22c9('0x8a')][_0x22c9('0x61')](_0x817667);})[_0x22c9('0x12')](function(_0x27f946){_0x690cd0['rows']=_0x27f946;return _0x690cd0;});}})[_0x22c9('0x12')](respondWithFilteredResult(_0x3e6457,_0x817667))[_0x22c9('0x1c')](handleError(_0x3e6457,null));};exports[_0x22c9('0x94')]=function addApplications(_0x221a45,_0xeaf766){var _0x46ff96=_0x221a45[_0x22c9('0x68')]['id'];var _0x214059=_0x221a45[_0x22c9('0x65')];var _0x23c229=0xc8;var _0xe14ce0=null;return db[_0x22c9('0x95')]['transaction']({'isolationLevel':db[_0x22c9('0x95')][_0x22c9('0x96')][_0x22c9('0x97')][_0x22c9('0x98')]},function(_0x26a2f7){return db[_0x22c9('0x60')][_0x22c9('0x6f')]({'where':{'id':_0x46ff96},'transaction':_0x26a2f7})[_0x22c9('0x12')](function(_0x5c310f){if(_0x5c310f){return db[_0x22c9('0x99')][_0x22c9('0x27')]({'where':{'MailAccountId':_0x46ff96},'transaction':_0x26a2f7})[_0x22c9('0x12')](function(){var _0x2485c2=_['map'](_0x214059,function(_0x4fa0ee){_0x4fa0ee[_0x22c9('0x6c')]=_0x46ff96;return _0x4fa0ee;});return db[_0x22c9('0x99')][_0x22c9('0x9a')](_0x2485c2,{'transaction':_0x26a2f7});});}else{_0x23c229=0x194;_0xe14ce0=[];}});})['then'](function(){if(_0x23c229!==0x194){return db[_0x22c9('0x99')][_0x22c9('0x9b')]({'where':{'MailAccountId':_0x46ff96},'order':'priority'})[_0x22c9('0x12')](function(_0x399900){_0xe14ce0=_0x399900;});}})['catch'](function(_0x3edf3f){_0x23c229=0x1f4;logger[_0x22c9('0x19')](_0x3edf3f['stack']);if(_0x3edf3f[_0x22c9('0x2a')]){delete _0x3edf3f[_0x22c9('0x2a')];}_0xe14ce0=_0x3edf3f;})[_0x22c9('0x9c')](function(){if(_0xe14ce0===null){_0xeaf766[_0x22c9('0x28')](_0x23c229);}else{if(_0x23c229===0x1f4){_0xeaf766[_0x22c9('0x1d')](_0x23c229)[_0x22c9('0x2b')](_0xe14ce0);}else{_0xeaf766[_0x22c9('0x1d')](_0x23c229)['json'](_0xe14ce0);}}});};exports[_0x22c9('0x9d')]=function(_0x13fe9f,_0x1475a2){var _0x2e68d8={};var _0x2de164={};var _0x29d9c7;var _0x28c0b7;return db[_0x22c9('0x60')]['findOne']({'where':{'id':_0x13fe9f[_0x22c9('0x68')]['id']}})['then'](handleEntityNotFound(_0x1475a2,null))['then'](function(_0x403d29){if(_0x403d29){_0x29d9c7=_0x403d29;_0x2de164[_0x22c9('0x4d')]=_[_0x22c9('0x4f')](db['MailApplication']['rawAttributes']);_0x2de164[_0x22c9('0x4e')]=_[_0x22c9('0x4f')](_0x13fe9f[_0x22c9('0x4e')]);_0x2de164[_0x22c9('0x50')]=_[_0x22c9('0x51')](_0x2de164[_0x22c9('0x4d')],_0x2de164[_0x22c9('0x4e')]);_0x2e68d8['attributes']=_[_0x22c9('0x51')](_0x2de164[_0x22c9('0x4d')],qs[_0x22c9('0x53')](_0x13fe9f[_0x22c9('0x4e')]['fields']));_0x2e68d8[_0x22c9('0x52')]=_0x2e68d8['attributes'][_0x22c9('0x54')]?_0x2e68d8['attributes']:_0x2de164[_0x22c9('0x4d')];_0x2e68d8['order']=qs['sort'](_0x13fe9f[_0x22c9('0x4e')][_0x22c9('0x58')]);_0x2e68d8[_0x22c9('0x59')]=qs[_0x22c9('0x50')](_[_0x22c9('0x5a')](_0x13fe9f[_0x22c9('0x4e')],_0x2de164['filters']));if(_0x13fe9f[_0x22c9('0x4e')][_0x22c9('0x5b')]){_0x2e68d8[_0x22c9('0x59')]=_['merge'](_0x2e68d8[_0x22c9('0x59')],{'$or':_[_0x22c9('0x48')](_0x2e68d8[_0x22c9('0x52')],function(_0x4cd355){var _0x431163={};_0x431163[_0x4cd355]={'$like':'%'+_0x13fe9f[_0x22c9('0x4e')][_0x22c9('0x5b')]+'%'};return _0x431163;})});}_0x2e68d8=_[_0x22c9('0x5c')]({},_0x2e68d8,_0x13fe9f['options']);return _0x29d9c7[_0x22c9('0x9d')](_0x2e68d8);}})[_0x22c9('0x12')](function(_0xac2dba){if(_0xac2dba){_0x28c0b7=_0xac2dba[_0x22c9('0x54')];if(!_0x13fe9f[_0x22c9('0x4e')]['hasOwnProperty'](_0x22c9('0x56'))){_0x2e68d8[_0x22c9('0x21')]=qs['limit'](_0x13fe9f[_0x22c9('0x4e')][_0x22c9('0x21')]);_0x2e68d8[_0x22c9('0x20')]=qs['offset'](_0x13fe9f[_0x22c9('0x4e')][_0x22c9('0x20')]);}return _0x29d9c7[_0x22c9('0x9d')](_0x2e68d8);}})[_0x22c9('0x12')](function(_0x3be156){if(_0x3be156){return _0x3be156?{'count':_0x28c0b7,'rows':_0x3be156}:null;}})[_0x22c9('0x12')](respondWithResult(_0x1475a2,null))[_0x22c9('0x1c')](handleError(_0x1475a2,null));};exports['getMessages']=function(_0x2e0a54,_0x5f2b30){var _0xc0f296={'raw':!![],'where':{}};var _0x1b912b={};var _0x5bf827={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x2e0a54['params']['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x5f2b30,null))[_0x22c9('0x12')](function(_0x35cf06){if(_0x35cf06){_0x1b912b[_0x22c9('0x4d')]=_['keys'](db[_0x22c9('0x9e')][_0x22c9('0x49')]);_0x1b912b['query']=_['keys'](_0x2e0a54[_0x22c9('0x4e')]);_0x1b912b['filters']=_[_0x22c9('0x51')](_0x1b912b['model'],_0x1b912b[_0x22c9('0x4e')]);_0xc0f296['attributes']=_['intersection'](_0x1b912b[_0x22c9('0x4d')],qs['fields'](_0x2e0a54[_0x22c9('0x4e')]['fields']));_0xc0f296[_0x22c9('0x52')]=_0xc0f296['attributes'][_0x22c9('0x54')]?_0xc0f296[_0x22c9('0x52')]:_0x1b912b[_0x22c9('0x4d')];if(!_0x2e0a54[_0x22c9('0x4e')][_0x22c9('0x55')](_0x22c9('0x56'))){_0xc0f296[_0x22c9('0x21')]=qs[_0x22c9('0x21')](_0x2e0a54[_0x22c9('0x4e')]['limit']);_0xc0f296[_0x22c9('0x20')]=qs[_0x22c9('0x20')](_0x2e0a54[_0x22c9('0x4e')][_0x22c9('0x20')]);}_0xc0f296[_0x22c9('0x57')]=qs['sort'](_0x2e0a54[_0x22c9('0x4e')][_0x22c9('0x58')]);_0xc0f296[_0x22c9('0x59')]=qs[_0x22c9('0x50')](_['pick'](_0x2e0a54[_0x22c9('0x4e')],_0x1b912b['filters']));_0xc0f296[_0x22c9('0x59')][_0x22c9('0x6c')]=_0x35cf06['id'];if(_0x2e0a54[_0x22c9('0x4e')][_0x22c9('0x5b')]){_0xc0f296['where']=_['merge'](_0xc0f296[_0x22c9('0x59')],{'$or':_[_0x22c9('0x48')](_0xc0f296[_0x22c9('0x52')],function(_0x30c856){var _0x5dd407={};_0x5dd407[_0x30c856]={'$like':'%'+_0x2e0a54[_0x22c9('0x4e')][_0x22c9('0x5b')]+'%'};return _0x5dd407;})});}if(_0x2e0a54[_0x22c9('0x4e')][_0x22c9('0x9f')]){var _0x4f0b29=_0x2e0a54[_0x22c9('0x4e')][_0x22c9('0x9f')][_0x22c9('0xa0')](',');var _0x2f9c85={};_0x2f9c85[_0x4f0b29[0x0]]={'$gte':moment(_0x4f0b29[0x1])[_0x22c9('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')};_0xc0f296[_0x22c9('0x59')]=_[_0x22c9('0x5c')](_0xc0f296[_0x22c9('0x59')],_0x2f9c85);}_0xc0f296=_[_0x22c9('0x5c')]({},_0xc0f296,_0x2e0a54[_0x22c9('0x5d')]);return db[_0x22c9('0x9e')]['count']({'where':_0xc0f296[_0x22c9('0x59')]})['then'](function(_0x4f72e6){_0x5bf827[_0x22c9('0x23')]=_0x4f72e6;if(_0x2e0a54[_0x22c9('0x4e')][_0x22c9('0x5e')]){_0xc0f296[_0x22c9('0x5f')]=[{'all':!![]}];}return db[_0x22c9('0x9e')][_0x22c9('0x61')](_0xc0f296);})[_0x22c9('0x12')](function(_0x5f3e78){if(_0x2e0a54[_0x22c9('0x4e')][_0x22c9('0xa2')]===_0x22c9('0xa3')){for(var _0x3b890d=0x0;_0x3b890d<_0x5f3e78[_0x22c9('0x54')];_0x3b890d++){_0x5f3e78[_0x3b890d][_0x22c9('0x65')]=juice(_0x5f3e78[_0x3b890d][_0x22c9('0x65')]);}}_0x5bf827[_0x22c9('0x62')]=_0x5f3e78;return _0x5bf827;});}})[_0x22c9('0x12')](respondWithFilteredResult(_0x5f2b30,_0xc0f296))[_0x22c9('0x1c')](handleError(_0x5f2b30,null));};exports[_0x22c9('0x2b')]=function(_0x42e937,_0x5ecf58){var _0x3c259a,_0x49806b={},_0x3b81ac;if(_0x42e937[_0x22c9('0x65')]['to']){_0x3b81ac=_0x42e937[_0x22c9('0x65')]['to'][_0x22c9('0xa0')](',')[0x0];}return db['MailAccount'][_0x22c9('0x64')]({'where':{'id':_0x42e937[_0x22c9('0x68')]['id']},'include':[{'model':db['CmList'],'as':_0x22c9('0xa4'),'include':[{'model':db[_0x22c9('0x8d')],'as':_0x22c9('0xa5'),'where':{'email':_0x3b81ac},'limit':0x1,'order':[[_0x22c9('0xa6'),_0x22c9('0xa7')]]}]},{'model':db[_0x22c9('0x45')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x22c9('0xa8'),'raw':!![]}]}]})[_0x22c9('0x12')](handleEntityNotFound(_0x5ecf58,null))[_0x22c9('0x12')](function(_0x59ebca){if(!_0x59ebca)return;_0x3c259a=_0x59ebca;if(!_0x59ebca['Smtp'])throw new Error(_0x22c9('0xa9'));if(_[_0x22c9('0xaa')](_0x42e937[_0x22c9('0x65')][_0x22c9('0xab')])){_0x42e937[_0x22c9('0x65')][_0x22c9('0xab')]=util[_0x22c9('0xa1')]('%s\x20<%s>',_0x59ebca[_0x22c9('0x2a')],_0x59ebca['email']||_0x59ebca[_0x22c9('0x42')][_0x22c9('0x37')]);}if(_0x42e937[_0x22c9('0x65')]['attachments']&&_0x42e937[_0x22c9('0x65')][_0x22c9('0xac')][_0x22c9('0x54')]){for(var _0x2aa3ca=0x0;_0x2aa3ca<_0x42e937['body'][_0x22c9('0xac')][_0x22c9('0x54')];_0x2aa3ca+=0x1){_0x42e937[_0x22c9('0x65')][_0x22c9('0xac')][_0x2aa3ca]={'filename':_0x42e937[_0x22c9('0x65')][_0x22c9('0xac')][_0x2aa3ca][_0x22c9('0x2a')],'path':path[_0x22c9('0xad')](config[_0x22c9('0xae')],_0x22c9('0xaf'),_0x42e937[_0x22c9('0x65')][_0x22c9('0xac')][_0x2aa3ca][_0x22c9('0xb0')])};}}var _0x41608b=_0x59ebca[_0x22c9('0xb1')]();return respondWithRpcPromise(_0x22c9('0xb2'),'sendMail',{'account':_0x41608b,'message':_0x42e937['body']});})[_0x22c9('0x12')](function(_0x58a607){if(!_0x58a607)return;_0x49806b=_0x58a607;if(!_0x3c259a[_0x22c9('0xa4')])throw new Error(_0x22c9('0xb3'));if(_0x3c259a[_0x22c9('0xa4')][_0x22c9('0xa5')][_0x22c9('0x54')])return _0x3c259a[_0x22c9('0xa4')][_0x22c9('0xa5')][0x0];return db['CmContact']['create'](_['defaults'](_0x42e937[_0x22c9('0x65')],{'firstName':_0x42e937[_0x22c9('0x65')]['to'],'email':_0x42e937[_0x22c9('0x65')]['to'],'phone':_0x42e937[_0x22c9('0x65')]['to'],'ListId':_0x3c259a[_0x22c9('0x76')]}));})['then'](function(_0x587e88){if(!_0x587e88)return;var _0x1db98c={'UserId':_0x42e937['user']['id'],'ContactId':_0x587e88['id'],'MailAccountId':_0x3c259a['id'],'inReplyTo':_0x49806b[_0x22c9('0xb4')],'to':_0x42e937[_0x22c9('0x65')][_0x22c9('0xab')],'cc':_0x42e937['body']['cc'],'subject':_0x42e937[_0x22c9('0x65')][_0x22c9('0xb5')],'attach':_0x42e937['body'][_0x22c9('0xb6')],'firstMsgDirection':_0x22c9('0xb7'),'lastMsgAt':moment()[_0x22c9('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x22c9('0xb7'),'Messages':[_[_0x22c9('0x5c')](_0x42e937[_0x22c9('0x65')],{'messageId':_0x49806b[_0x22c9('0xb4')],'sentAt':moment()[_0x22c9('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x3c259a['id'],'UserId':_0x42e937[_0x22c9('0x37')]['id'],'ContactId':_0x587e88['id']})]};if(_0x42e937['body']['Interaction']){_0x1db98c=_[_0x22c9('0x5c')](_0x1db98c,_0x42e937[_0x22c9('0x65')][_0x22c9('0xb8')]);}return db[_0x22c9('0x8a')]['create'](_0x1db98c,{'include':[{'model':db[_0x22c9('0x9e')],'as':_0x22c9('0xb9')}]});})[_0x22c9('0x12')](respondWithResult(_0x5ecf58,null))[_0x22c9('0x1c')](handleError(_0x5ecf58,null));};exports[_0x22c9('0xba')]=function(_0x1bec44,_0x2539dc){return db[_0x22c9('0x60')][_0x22c9('0x64')]({'where':{'id':_0x1bec44[_0x22c9('0x68')]['id']},'include':[{'model':db[_0x22c9('0x45')],'as':_0x22c9('0x42'),'raw':!![],'include':[{'model':db[_0x22c9('0xa8')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x2539dc,null))['then'](function(_0xb69aaf){if(!_0xb69aaf['Smtp'])return;var _0x515d55=_0xb69aaf['getSmtpOptions']();return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x515d55});})[_0x22c9('0x12')](respondWithResult(_0x2539dc,null))[_0x22c9('0x1c')](handleError(_0x2539dc,null));};exports['destroy']=function(_0x3de68d,_0x426ede){return db[_0x22c9('0x60')][_0x22c9('0x64')]({'where':{'id':_0x3de68d[_0x22c9('0x68')]['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x426ede,null))[_0x22c9('0x12')](function(_0x3d59b4){if(_0x3d59b4&&_0x3d59b4[_0x22c9('0x40')]){throw new db[(_0x22c9('0xbb'))][(_0x22c9('0xbc'))](_0x22c9('0xbd'));}return _0x3d59b4;})[_0x22c9('0x12')](removeEntity(_0x426ede,null))[_0x22c9('0x1c')](handleError(_0x426ede,null));};exports[_0x22c9('0xbe')]=function(_0x102fb6,_0x4a9148){return db[_0x22c9('0x60')][_0x22c9('0x64')]({'where':{'id':_0x102fb6[_0x22c9('0x68')]['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x4a9148,null))['then'](function(_0x433ee1){if(_0x433ee1){return _0x433ee1[_0x22c9('0xbe')](_0x102fb6[_0x22c9('0x65')][_0x22c9('0x71')],_[_0x22c9('0x8b')](_0x102fb6[_0x22c9('0x65')],[_0x22c9('0x71'),'id'])||{})[_0x22c9('0xbf')](function(_0x27feed){for(var _0x28dc3b=0x0;_0x28dc3b<_0x102fb6['body']['ids'][_0x22c9('0x54')];_0x28dc3b+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x102fb6[_0x22c9('0x65')]['ids'][_0x28dc3b]),'MailAccountId':Number(_0x102fb6[_0x22c9('0x68')]['id'])});}return _0x27feed;});}})[_0x22c9('0x12')](respondWithResult(_0x4a9148,null))[_0x22c9('0x1c')](handleError(_0x4a9148,null));};exports[_0x22c9('0xc0')]=function(_0x102a8b,_0x328882){return db[_0x22c9('0x60')][_0x22c9('0x64')]({'where':{'id':_0x102a8b[_0x22c9('0x68')]['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x328882,null))[_0x22c9('0x12')](function(_0x53598e){if(_0x53598e){return _0x53598e[_0x22c9('0xc0')](_0x102a8b[_0x22c9('0x4e')][_0x22c9('0x71')])['then'](function(){if(_['isArray'](_0x102a8b[_0x22c9('0x4e')][_0x22c9('0x71')])){for(var _0x4a4648=0x0;_0x4a4648<_0x102a8b[_0x22c9('0x4e')][_0x22c9('0x71')][_0x22c9('0x54')];_0x4a4648+=0x1){socket[_0x22c9('0xc1')]('userMailAccount:remove',{'UserId':Number(_0x102a8b[_0x22c9('0x4e')][_0x22c9('0x71')][_0x4a4648]),'MailAccountId':Number(_0x102a8b[_0x22c9('0x68')]['id'])});}}else{socket[_0x22c9('0xc1')](_0x22c9('0xc2'),{'UserId':Number(_0x102a8b[_0x22c9('0x4e')][_0x22c9('0x71')]),'MailAccountId':Number(_0x102a8b[_0x22c9('0x68')]['id'])});}});}})[_0x22c9('0x12')](respondWithStatusCode(_0x328882,null))[_0x22c9('0x1c')](handleError(_0x328882,null));};exports[_0x22c9('0xc3')]=function(_0x1a8314,_0x102e3f){var _0x41698a={};var _0x47ec82={};var _0xd5a75c;var _0x233dfc;return db[_0x22c9('0x60')][_0x22c9('0x6f')]({'where':{'id':_0x1a8314[_0x22c9('0x68')]['id']}})[_0x22c9('0x12')](handleEntityNotFound(_0x102e3f,null))[_0x22c9('0x12')](function(_0x4f45d4){if(_0x4f45d4){_0xd5a75c=_0x4f45d4;_0x47ec82[_0x22c9('0x4d')]=_['keys'](db[_0x22c9('0xc4')][_0x22c9('0x49')]);_0x47ec82[_0x22c9('0x4e')]=_[_0x22c9('0x4f')](_0x1a8314[_0x22c9('0x4e')]);_0x47ec82[_0x22c9('0x50')]=_[_0x22c9('0x51')](_0x47ec82[_0x22c9('0x4d')],_0x47ec82['query']);_0x41698a[_0x22c9('0x52')]=_[_0x22c9('0x51')](_0x47ec82[_0x22c9('0x4d')],qs[_0x22c9('0x53')](_0x1a8314[_0x22c9('0x4e')][_0x22c9('0x53')]));_0x41698a[_0x22c9('0x52')]=_0x41698a[_0x22c9('0x52')][_0x22c9('0x54')]?_0x41698a[_0x22c9('0x52')]:_0x47ec82[_0x22c9('0x4d')];_0x41698a[_0x22c9('0x57')]=qs['sort'](_0x1a8314[_0x22c9('0x4e')]['sort']);_0x41698a['where']=qs[_0x22c9('0x50')](_['pick'](_0x1a8314[_0x22c9('0x4e')],_0x47ec82[_0x22c9('0x50')]));if(_0x1a8314['query'][_0x22c9('0x5b')]){_0x41698a['where']=_[_0x22c9('0x5c')](_0x41698a[_0x22c9('0x59')],{'$or':_[_0x22c9('0x48')](_0x41698a['attributes'],function(_0xd738d5){var _0x8da21={};_0x8da21[_0xd738d5]={'$like':'%'+_0x1a8314['query']['filter']+'%'};return _0x8da21;})});}_0x41698a=_[_0x22c9('0x5c')]({},_0x41698a,_0x1a8314[_0x22c9('0x5d')]);return _0xd5a75c[_0x22c9('0xc3')](_0x41698a);}})[_0x22c9('0x12')](function(_0x4e3cdc){if(_0x4e3cdc){_0x233dfc=_0x4e3cdc[_0x22c9('0x54')];if(!_0x1a8314[_0x22c9('0x4e')][_0x22c9('0x55')](_0x22c9('0x56'))){_0x41698a[_0x22c9('0x21')]=qs['limit'](_0x1a8314[_0x22c9('0x4e')][_0x22c9('0x21')]);_0x41698a['offset']=qs[_0x22c9('0x20')](_0x1a8314[_0x22c9('0x4e')]['offset']);}return _0xd5a75c[_0x22c9('0xc3')](_0x41698a);}})['then'](function(_0x1e7d93){if(_0x1e7d93){return _0x1e7d93?{'count':_0x233dfc,'rows':_0x1e7d93}:null;}})[_0x22c9('0x12')](respondWithResult(_0x102e3f,null))[_0x22c9('0x1c')](handleError(_0x102e3f,null));}; \ No newline at end of file +var _0x421c=['lodash','ioredis','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','MailAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','update','get','MailAccounts','destroy','end','name','gmail','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','Unknown\x20email\x20service\x20provider','user','password','modernAuthentication','CloudProviderId','host','port','service','authentication','username','pass','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','map','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','MailServerIn','find','body','custom','provider','params','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','create','getDispositions','nolimit','pick','MailAccountId','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','getApplications','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','send','split','List','Contacts','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','VerifySmtp','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util'];(function(_0xc29f07,_0x3eb526){var _0x18d0c0=function(_0x16675d){while(--_0x16675d){_0xc29f07['push'](_0xc29f07['shift']());}};_0x18d0c0(++_0x3eb526);}(_0x421c,0xbb));var _0xc421=function(_0x38f24d,_0x4423fa){_0x38f24d=_0x38f24d-0x0;var _0x392a87=_0x421c[_0x38f24d];return _0x392a87;};'use strict';var moment=require(_0xc421('0x0'));var BPromise=require(_0xc421('0x1'));var util=require(_0xc421('0x2'));var path=require('path');var _=require(_0xc421('0x3'));var juice=require('juice');var Redis=require(_0xc421('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xc421('0x5'));var config=require(_0xc421('0x6'));var db=require(_0xc421('0x7'))['db'];config['redis']=_[_0xc421('0x8')](config[_0xc421('0x9')],{'host':_0xc421('0xa'),'port':0x18eb});var socket=require(_0xc421('0xb'))(new Redis(config[_0xc421('0x9')]));require(_0xc421('0xc'))[_0xc421('0xd')](socket);var jayson=require(_0xc421('0xe'));var client=jayson[_0xc421('0xf')][_0xc421('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x684d7c,_0x398b27,_0x9e2dbd,_0x14fbae){return new BPromise(function(_0xc4c67f,_0x97d765){var _0x245447=_0x14fbae||client;return _0x245447['request'](_0x684d7c,_0x9e2dbd)[_0xc421('0x11')](function(_0x4c9553){logger[_0xc421('0x12')]('MailAccount,\x20%s,\x20%s',_0x398b27,_0xc421('0x13'));logger[_0xc421('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x398b27,_0xc421('0x13'),JSON[_0xc421('0x15')](_0x4c9553));if(_0x4c9553[_0xc421('0x16')]){if(_0x4c9553[_0xc421('0x16')]['code']===0x1f4){logger[_0xc421('0x16')]('MailAccount,\x20%s,\x20%s',_0x398b27,_0x4c9553[_0xc421('0x16')]['message']);return _0x97d765(_0x4c9553[_0xc421('0x16')]['message']);}logger[_0xc421('0x16')](_0xc421('0x17'),_0x398b27,_0x4c9553[_0xc421('0x16')][_0xc421('0x18')]);return _0xc4c67f(_0x4c9553['error'][_0xc421('0x18')]);}else{logger[_0xc421('0x12')](_0xc421('0x17'),_0x398b27,'request\x20sent');_0xc4c67f(_0x4c9553['result'][_0xc421('0x18')]);}})[_0xc421('0x19')](function(_0xc14b52){logger['error'](_0xc421('0x17'),_0x398b27,_0xc14b52);_0x97d765(_0xc14b52);});});}function respondWithStatusCode(_0x348218,_0x466faa){_0x466faa=_0x466faa||0xcc;return function(_0xe7f7f3){if(_0xe7f7f3){return _0x348218[_0xc421('0x1a')](_0x466faa);}return _0x348218[_0xc421('0x1b')](_0x466faa)['end']();};}function respondWithResult(_0x1bfc94,_0x46057c){_0x46057c=_0x46057c||0xc8;return function(_0xa1353c){if(_0xa1353c){return _0x1bfc94[_0xc421('0x1b')](_0x46057c)[_0xc421('0x1c')](_0xa1353c);}};}function respondWithFilteredResult(_0x1a8296,_0x3fd859){return function(_0x510aa8){if(_0x510aa8){var _0x148eca=typeof _0x3fd859['offset']===_0xc421('0x1d')&&typeof _0x3fd859[_0xc421('0x1e')]===_0xc421('0x1d');var _0x1e774c=_0x510aa8['count'];var _0x3b40ac=_0x148eca?0x0:_0x3fd859[_0xc421('0x1f')];var _0x3c5428=_0x148eca?_0x510aa8[_0xc421('0x20')]:_0x3fd859['offset']+_0x3fd859[_0xc421('0x1e')];var _0x563ee5;if(_0x3c5428>=_0x1e774c){_0x3c5428=_0x1e774c;_0x563ee5=0xc8;}else{_0x563ee5=0xce;}_0x1a8296[_0xc421('0x1b')](_0x563ee5);return _0x1a8296[_0xc421('0x21')](_0xc421('0x22'),_0x3b40ac+'-'+_0x3c5428+'/'+_0x1e774c)[_0xc421('0x1c')](_0x510aa8);}return null;};}function saveUpdates(_0x5bbf0){return function(_0x4471ad){if(_0x4471ad){return _0x4471ad[_0xc421('0x23')](_0x5bbf0)[_0xc421('0x11')](function(_0x2fdd7b){return _0x2fdd7b;});}return null;};}function removeEntity(_0x35585e){return function(_0x452512){if(_0x452512){return _0x452512['destroy']()[_0xc421('0x11')](function(){var _0x5d8c36=_0x452512[_0xc421('0x24')]({'plain':!![]});var _0x55f498=_0xc421('0x25');return db['UserProfileResource'][_0xc421('0x26')]({'where':{'type':_0x55f498,'resourceId':_0x5d8c36['id']}})[_0xc421('0x11')](function(){return _0x452512;});})[_0xc421('0x11')](function(){_0x35585e['status'](0xcc)[_0xc421('0x27')]();});}};}function handleEntityNotFound(_0x3d8c96){return function(_0x1287b7){if(!_0x1287b7){_0x3d8c96[_0xc421('0x1a')](0x194);}return _0x1287b7;};}function handleError(_0x1cfeeb,_0xbf9eb2){_0xbf9eb2=_0xbf9eb2||0x1f4;return function(_0x31f83c){logger[_0xc421('0x16')](_0x31f83c['stack']);if(_0x31f83c['name']){delete _0x31f83c[_0xc421('0x28')];}_0x1cfeeb['status'](_0xbf9eb2)['send'](_0x31f83c);};}function getImapHost(_0x219aab){switch(_0x219aab){case _0xc421('0x29'):return'imap.gmail.com';case _0xc421('0x2a'):return'imap.mail.yahoo.com';case _0xc421('0x2b'):return _0xc421('0x2c');case _0xc421('0x2d'):return _0xc421('0x2e');}throw new Error('Unknown\x20email\x20service\x20provider',_0x219aab);}function getSmtpHost(_0x122ff7){switch(_0x122ff7){case _0xc421('0x29'):return _0xc421('0x2f');case _0xc421('0x2a'):return _0xc421('0x30');case'hotmail':return'smtp-mail.outlook.com';case _0xc421('0x2d'):return'smtp.office365.com';}throw new Error(_0xc421('0x31'),_0x122ff7);}function getAuthenticationOptions(_0x45f8c1,_0x3de6cf){var _0x19055e={};var _0x28be42={};if(_0x45f8c1){_0x19055e[_0xc421('0x32')]=_0x28be42[_0xc421('0x32')]=_0x3de6cf['username'];_0x19055e[_0xc421('0x33')]=_0x28be42['pass']=_0x3de6cf['password'];if(_0x3de6cf[_0xc421('0x34')]){_0x19055e[_0xc421('0x34')]=_0x28be42['modernAuthentication']=!![];_0x19055e['CloudProviderId']=_0x28be42[_0xc421('0x35')]=_0x3de6cf[_0xc421('0x35')];_0x19055e['password']=_0x28be42['pass']=null;}else{_0x19055e[_0xc421('0x35')]=_0x28be42[_0xc421('0x35')]=null;}_0x19055e[_0xc421('0x36')]=getImapHost(_0x45f8c1);_0x19055e[_0xc421('0x37')]=0x3e1;_0x28be42['host']=getSmtpHost(_0x45f8c1);_0x28be42[_0xc421('0x37')]=0x24b;_0x28be42['secure']=![];_0x19055e[_0xc421('0x38')]=_0x28be42[_0xc421('0x38')]=null;}else{if(_0x3de6cf[_0xc421('0x39')]){_0x19055e[_0xc421('0x32')]=_0x28be42[_0xc421('0x32')]=_0x3de6cf[_0xc421('0x3a')];_0x19055e[_0xc421('0x33')]=_0x28be42[_0xc421('0x3b')]=_0x3de6cf[_0xc421('0x33')];}else{_0x19055e[_0xc421('0x39')]=_0x28be42[_0xc421('0x39')]=![];_0x19055e[_0xc421('0x32')]=_0x28be42[_0xc421('0x32')]=null;_0x19055e['password']=_0x28be42[_0xc421('0x3b')]=null;}_0x19055e[_0xc421('0x36')]=_0x3de6cf[_0xc421('0x3c')][_0xc421('0x36')];_0x19055e[_0xc421('0x37')]=_0x3de6cf[_0xc421('0x3c')][_0xc421('0x37')];_0x28be42[_0xc421('0x36')]=_0x3de6cf['Smtp'][_0xc421('0x36')];_0x28be42[_0xc421('0x37')]=_0x3de6cf[_0xc421('0x3d')][_0xc421('0x37')];}return{'Imap':_0x19055e,'Smtp':_0x28be42};}exports[_0xc421('0x3e')]=function(_0x25c71b,_0x284957){var _0xda3138={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xc421('0x3f')],'as':_0xc421('0x3d')},{'model':db[_0xc421('0x40')],'as':_0xc421('0x41')}]},_0x50def7={},_0x1d73a5={'count':0x0,'rows':[]};var _0x2bbb32=_['map'](db[_0xc421('0x42')][_0xc421('0x43')],function(_0x1528c3){return{'name':_0x1528c3[_0xc421('0x44')],'type':_0x1528c3[_0xc421('0x45')][_0xc421('0x46')]};});_0x50def7['model']=_[_0xc421('0x47')](_0x2bbb32,_0xc421('0x28'));_0x50def7['query']=_[_0xc421('0x48')](_0x25c71b['query']);_0x50def7[_0xc421('0x49')]=_[_0xc421('0x4a')](_0x50def7[_0xc421('0x4b')],_0x50def7[_0xc421('0x4c')]);_0xda3138['attributes']=_[_0xc421('0x4a')](_0x50def7[_0xc421('0x4b')],qs[_0xc421('0x4d')](_0x25c71b[_0xc421('0x4c')][_0xc421('0x4d')]));_0xda3138[_0xc421('0x4e')]=_0xda3138[_0xc421('0x4e')][_0xc421('0x4f')]?_0xda3138[_0xc421('0x4e')]:_0x50def7[_0xc421('0x4b')];if(!_0x25c71b[_0xc421('0x4c')][_0xc421('0x50')]('nolimit')){_0xda3138[_0xc421('0x1e')]=qs['limit'](_0x25c71b[_0xc421('0x4c')][_0xc421('0x1e')]);_0xda3138['offset']=qs['offset'](_0x25c71b[_0xc421('0x4c')][_0xc421('0x1f')]);}_0xda3138[_0xc421('0x51')]=qs['sort'](_0x25c71b[_0xc421('0x4c')][_0xc421('0x52')]);_0xda3138[_0xc421('0x53')]=qs[_0xc421('0x49')](_['pick'](_0x25c71b[_0xc421('0x4c')],_0x50def7[_0xc421('0x49')]),_0x2bbb32);if(_0x25c71b['query'][_0xc421('0x54')]){_0xda3138['where']=_['merge'](_0xda3138[_0xc421('0x53')],{'$or':_['map'](_0x2bbb32,function(_0x53ca58){if(_0x53ca58[_0xc421('0x45')]!==_0xc421('0x55')){var _0xdd3f6c={};_0xdd3f6c[_0x53ca58[_0xc421('0x28')]]={'$like':'%'+_0x25c71b[_0xc421('0x4c')]['filter']+'%'};return _0xdd3f6c;}})});}_0xda3138=_[_0xc421('0x56')]({},_0xda3138,_0x25c71b[_0xc421('0x57')]);var _0x188d4c={'where':_0xda3138[_0xc421('0x53')]};return db[_0xc421('0x42')][_0xc421('0x20')](_0x188d4c)[_0xc421('0x11')](function(_0x4dc91a){_0x1d73a5['count']=_0x4dc91a;if(_0x25c71b[_0xc421('0x4c')][_0xc421('0x58')]){_0xda3138[_0xc421('0x59')]=[{'all':!![]}];}return db[_0xc421('0x42')][_0xc421('0x5a')](_0xda3138);})[_0xc421('0x11')](function(_0x258fb9){_0x1d73a5[_0xc421('0x5b')]=_0x258fb9;return _0x1d73a5;})[_0xc421('0x11')](respondWithFilteredResult(_0x284957,_0xda3138))[_0xc421('0x19')](handleError(_0x284957,null));};exports['show']=function(_0x1236ab,_0x3465fc){var _0x25548a={'raw':![],'where':{'id':_0x1236ab['params']['id']},'include':[{'model':db[_0xc421('0x5c')],'as':_0xc421('0x3c')},{'model':db[_0xc421('0x3f')],'as':_0xc421('0x3d')},{'model':db[_0xc421('0x40')],'as':_0xc421('0x41')}]},_0xb5ea32={};_0xb5ea32[_0xc421('0x4b')]=_['keys'](db[_0xc421('0x42')][_0xc421('0x43')]);_0xb5ea32['query']=_[_0xc421('0x48')](_0x1236ab[_0xc421('0x4c')]);_0xb5ea32[_0xc421('0x49')]=_[_0xc421('0x4a')](_0xb5ea32['model'],_0xb5ea32['query']);_0x25548a[_0xc421('0x4e')]=_[_0xc421('0x4a')](_0xb5ea32[_0xc421('0x4b')],qs['fields'](_0x1236ab[_0xc421('0x4c')]['fields']));_0x25548a[_0xc421('0x4e')]=_0x25548a[_0xc421('0x4e')][_0xc421('0x4f')]?_0x25548a[_0xc421('0x4e')]:_0xb5ea32[_0xc421('0x4b')];if(_0x1236ab[_0xc421('0x4c')]['includeAll']){_0x25548a[_0xc421('0x59')]=[{'all':!![]}];}_0x25548a=_['merge']({},_0x25548a,_0x1236ab[_0xc421('0x57')]);return db[_0xc421('0x42')][_0xc421('0x5d')](_0x25548a)[_0xc421('0x11')](handleEntityNotFound(_0x3465fc,null))[_0xc421('0x11')](respondWithResult(_0x3465fc,null))[_0xc421('0x19')](handleError(_0x3465fc,null));};exports[_0xc421('0x23')]=function(_0x4f4b0a,_0x4218cb){if(_0x4f4b0a[_0xc421('0x5e')]['id']){delete _0x4f4b0a['body']['id'];}var _0x4e8e37=_0x4f4b0a[_0xc421('0x5e')]['provider']===_0xc421('0x5f')?null:_0x4f4b0a['body'][_0xc421('0x60')];var _0x2b1e71=_0x4f4b0a[_0xc421('0x5e')][_0xc421('0x3c')]||{};var _0x373f23=_0x4f4b0a['body']['Smtp']||{};if(_0x4e8e37){_0x2b1e71[_0xc421('0x36')]=getImapHost(_0x4e8e37);_0x2b1e71[_0xc421('0x37')]=0x3e1;_0x373f23[_0xc421('0x36')]=getSmtpHost(_0x4e8e37);_0x373f23['port']=0x24b;_0x373f23['secure']=![];}if(_0x373f23[_0xc421('0x34')]){_0x373f23['secure']=![];}else{_0x373f23[_0xc421('0x35')]=null;}if(!_0x2b1e71[_0xc421('0x34')])_0x2b1e71[_0xc421('0x35')]=null;_0x4f4b0a['body'][_0xc421('0x3c')]=_0x2b1e71;_0x4f4b0a[_0xc421('0x5e')][_0xc421('0x3d')]=_0x373f23;return db['MailAccount'][_0xc421('0x5d')]({'where':{'id':_0x4f4b0a[_0xc421('0x61')]['id']},'include':[{'model':db[_0xc421('0x5c')],'as':_0xc421('0x3c')},{'model':db[_0xc421('0x3f')],'as':_0xc421('0x3d')},{'model':db[_0xc421('0x40')],'as':'mandatoryDispositionPause'}]})[_0xc421('0x11')](handleEntityNotFound(_0x4218cb,null))[_0xc421('0x11')](function(_0x38fcc5){if(!_0x38fcc5)throw new Error(_0xc421('0x62'));if(_0x38fcc5[_0xc421('0x38')])delete _0x4f4b0a[_0xc421('0x5e')][_0xc421('0x3c')];return _0x38fcc5;})[_0xc421('0x11')](saveUpdates(_0x4f4b0a[_0xc421('0x5e')],null))[_0xc421('0x11')](function(_0x54873c){if(!_0x4f4b0a[_0xc421('0x5e')][_0xc421('0x3c')])return _0x54873c;return db[_0xc421('0x5c')][_0xc421('0x23')](_0x4f4b0a[_0xc421('0x5e')][_0xc421('0x3c')],{'where':{'MailAccountId':_0x54873c['id']}})['then'](function(){return _0x54873c;});})[_0xc421('0x11')](function(_0x5a1c9d){if(!_0x4f4b0a[_0xc421('0x5e')][_0xc421('0x3d')])return _0x5a1c9d;return db[_0xc421('0x3f')][_0xc421('0x23')](_0x4f4b0a['body']['Smtp'],{'where':{'MailAccountId':_0x5a1c9d['id']}})[_0xc421('0x11')](function(){return _0x5a1c9d;});})[_0xc421('0x11')](respondWithResult(_0x4218cb,null))['catch'](handleError(_0x4218cb,null));};exports[_0xc421('0x63')]=function(_0x625230,_0x14a1df){return db[_0xc421('0x42')][_0xc421('0x63')]()[_0xc421('0x11')](respondWithResult(_0x14a1df,null))[_0xc421('0x19')](handleError(_0x14a1df,null));};exports[_0xc421('0x64')]=function(_0x39e0dc,_0x22f9d4){if(_0x39e0dc[_0xc421('0x5e')]['id']){delete _0x39e0dc[_0xc421('0x5e')]['id'];}return db[_0xc421('0x42')][_0xc421('0x5d')]({'where':{'id':_0x39e0dc['params']['id']}})['then'](handleEntityNotFound(_0x22f9d4,null))[_0xc421('0x11')](function(_0x2fa4ae){if(_0x2fa4ae){_0x39e0dc[_0xc421('0x5e')]['MailAccountId']=_0x2fa4ae['id'];return db[_0xc421('0x65')][_0xc421('0x66')](_0x39e0dc[_0xc421('0x5e')]);}})['then'](respondWithResult(_0x22f9d4,null))[_0xc421('0x19')](handleError(_0x22f9d4,null));};exports[_0xc421('0x67')]=function(_0x4cc512,_0x365998){var _0x30afce={'raw':![],'where':{}};var _0x55c560={};var _0x2d0f76={'count':0x0,'rows':[]};return db[_0xc421('0x42')]['findOne']({'where':{'id':_0x4cc512[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x365998,null))[_0xc421('0x11')](function(_0x3e8611){if(_0x3e8611){_0x55c560['model']=_[_0xc421('0x48')](db[_0xc421('0x65')][_0xc421('0x43')]);_0x55c560[_0xc421('0x4c')]=_[_0xc421('0x48')](_0x4cc512[_0xc421('0x4c')]);_0x55c560['filters']=_['intersection'](_0x55c560[_0xc421('0x4b')],_0x55c560[_0xc421('0x4c')]);_0x30afce['attributes']=_[_0xc421('0x4a')](_0x55c560[_0xc421('0x4b')],qs['fields'](_0x4cc512['query'][_0xc421('0x4d')]));_0x30afce[_0xc421('0x4e')]=_0x30afce[_0xc421('0x4e')]['length']?_0x30afce[_0xc421('0x4e')]:_0x55c560['model'];if(!_0x4cc512['query']['hasOwnProperty'](_0xc421('0x68'))){_0x30afce[_0xc421('0x1e')]=qs[_0xc421('0x1e')](_0x4cc512[_0xc421('0x4c')][_0xc421('0x1e')]);_0x30afce[_0xc421('0x1f')]=qs['offset'](_0x4cc512[_0xc421('0x4c')][_0xc421('0x1f')]);}_0x30afce[_0xc421('0x51')]=qs['sort'](_0x4cc512[_0xc421('0x4c')][_0xc421('0x52')]);_0x30afce[_0xc421('0x53')]=qs['filters'](_[_0xc421('0x69')](_0x4cc512[_0xc421('0x4c')],_0x55c560[_0xc421('0x49')]));_0x30afce[_0xc421('0x53')][_0xc421('0x6a')]=_0x3e8611['id'];if(_0x4cc512['query']['filter']){_0x30afce[_0xc421('0x53')]=_[_0xc421('0x56')](_0x30afce[_0xc421('0x53')],{'$or':_[_0xc421('0x47')](_0x30afce[_0xc421('0x4e')],function(_0x47f172){var _0x5a9da2={};_0x5a9da2[_0x47f172]={'$like':'%'+_0x4cc512['query']['filter']+'%'};return _0x5a9da2;})});}_0x30afce=_[_0xc421('0x56')]({},_0x30afce,_0x4cc512[_0xc421('0x57')]);return db[_0xc421('0x65')][_0xc421('0x20')]({'where':_0x30afce[_0xc421('0x53')]})[_0xc421('0x11')](function(_0x476b91){_0x2d0f76['count']=_0x476b91;if(_0x4cc512['query'][_0xc421('0x58')]){_0x30afce[_0xc421('0x59')]=[{'all':!![]}];}return db[_0xc421('0x65')][_0xc421('0x5a')](_0x30afce);})[_0xc421('0x11')](function(_0x52ddbb){_0x2d0f76[_0xc421('0x5b')]=_0x52ddbb;return _0x2d0f76;});}})[_0xc421('0x11')](respondWithFilteredResult(_0x365998,_0x30afce))[_0xc421('0x19')](handleError(_0x365998,null));};exports[_0xc421('0x6b')]=function(_0x3150a0,_0x3d68ba){return db[_0xc421('0x42')][_0xc421('0x5d')]({'where':{'id':_0x3150a0[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x3d68ba,null))[_0xc421('0x11')](function(_0x3e9bf5){if(_0x3e9bf5){return _0x3e9bf5[_0xc421('0x6b')](_0x3150a0[_0xc421('0x4c')][_0xc421('0x6c')]);}})[_0xc421('0x11')](respondWithStatusCode(_0x3d68ba,null))[_0xc421('0x19')](handleError(_0x3d68ba,null));};exports['addAnswer']=function(_0x5f196a,_0x528464){if(_0x5f196a[_0xc421('0x5e')]['id']){delete _0x5f196a[_0xc421('0x5e')]['id'];}return db[_0xc421('0x42')][_0xc421('0x5d')]({'where':{'id':_0x5f196a[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x528464,null))['then'](function(_0x4ce078){if(_0x4ce078){_0x5f196a[_0xc421('0x5e')][_0xc421('0x6a')]=_0x4ce078['id'];return db[_0xc421('0x6d')][_0xc421('0x66')](_0x5f196a[_0xc421('0x5e')]);}})['then'](respondWithResult(_0x528464,null))[_0xc421('0x19')](handleError(_0x528464,null));};exports[_0xc421('0x6e')]=function(_0x5b9377,_0x29ac9e){var _0x1ef204={'raw':![],'where':{}};var _0x23d8bc={};var _0x27738c={'count':0x0,'rows':[]};return db[_0xc421('0x42')][_0xc421('0x6f')]({'where':{'id':_0x5b9377[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x29ac9e,null))['then'](function(_0x5424a3){if(_0x5424a3){_0x23d8bc[_0xc421('0x4b')]=_[_0xc421('0x48')](db[_0xc421('0x6d')][_0xc421('0x43')]);_0x23d8bc[_0xc421('0x4c')]=_[_0xc421('0x48')](_0x5b9377[_0xc421('0x4c')]);_0x23d8bc[_0xc421('0x49')]=_[_0xc421('0x4a')](_0x23d8bc[_0xc421('0x4b')],_0x23d8bc[_0xc421('0x4c')]);_0x1ef204['attributes']=_[_0xc421('0x4a')](_0x23d8bc[_0xc421('0x4b')],qs['fields'](_0x5b9377[_0xc421('0x4c')]['fields']));_0x1ef204['attributes']=_0x1ef204[_0xc421('0x4e')][_0xc421('0x4f')]?_0x1ef204[_0xc421('0x4e')]:_0x23d8bc[_0xc421('0x4b')];if(!_0x5b9377['query'][_0xc421('0x50')](_0xc421('0x68'))){_0x1ef204[_0xc421('0x1e')]=qs[_0xc421('0x1e')](_0x5b9377[_0xc421('0x4c')][_0xc421('0x1e')]);_0x1ef204[_0xc421('0x1f')]=qs[_0xc421('0x1f')](_0x5b9377[_0xc421('0x4c')][_0xc421('0x1f')]);}_0x1ef204[_0xc421('0x51')]=qs[_0xc421('0x52')](_0x5b9377[_0xc421('0x4c')][_0xc421('0x52')]);_0x1ef204[_0xc421('0x53')]=qs[_0xc421('0x49')](_[_0xc421('0x69')](_0x5b9377[_0xc421('0x4c')],_0x23d8bc[_0xc421('0x49')]));_0x1ef204['where']['MailAccountId']=_0x5424a3['id'];if(_0x5b9377[_0xc421('0x4c')]['filter']){_0x1ef204[_0xc421('0x53')]=_[_0xc421('0x56')](_0x1ef204[_0xc421('0x53')],{'$or':_['map'](_0x1ef204['attributes'],function(_0x53bbc1){var _0x4bb355={};_0x4bb355[_0x53bbc1]={'$like':'%'+_0x5b9377['query'][_0xc421('0x54')]+'%'};return _0x4bb355;})});}_0x1ef204=_[_0xc421('0x56')]({},_0x1ef204,_0x5b9377[_0xc421('0x57')]);return db[_0xc421('0x6d')][_0xc421('0x20')]({'where':_0x1ef204[_0xc421('0x53')]})[_0xc421('0x11')](function(_0x1fed9d){_0x27738c[_0xc421('0x20')]=_0x1fed9d;if(_0x5b9377['query'][_0xc421('0x58')]){_0x1ef204[_0xc421('0x59')]=[{'all':!![]}];}return db[_0xc421('0x6d')]['findAll'](_0x1ef204);})['then'](function(_0x13b0bb){_0x27738c[_0xc421('0x5b')]=_0x13b0bb;return _0x27738c;});}})[_0xc421('0x11')](respondWithFilteredResult(_0x29ac9e,_0x1ef204))[_0xc421('0x19')](handleError(_0x29ac9e,null));};exports['removeAnswers']=function(_0x59fe76,_0x2e05d4){return db['MailAccount'][_0xc421('0x5d')]({'where':{'id':_0x59fe76[_0xc421('0x61')]['id']}})['then'](handleEntityNotFound(_0x2e05d4,null))['then'](function(_0x538a5c){if(_0x538a5c){return _0x538a5c[_0xc421('0x70')](_0x59fe76[_0xc421('0x4c')][_0xc421('0x6c')]);}})[_0xc421('0x11')](respondWithStatusCode(_0x2e05d4,null))[_0xc421('0x19')](handleError(_0x2e05d4,null));};exports[_0xc421('0x66')]=function(_0x5d3e34,_0x5254d8){var _0x553271={'name':_0x5d3e34[_0xc421('0x5e')][_0xc421('0x28')],'key':_0x5d3e34[_0xc421('0x5e')][_0xc421('0x46')],'provider':_0x5d3e34[_0xc421('0x5e')][_0xc421('0x60')]===_0xc421('0x5f')?null:_0x5d3e34[_0xc421('0x5e')][_0xc421('0x60')],'email':_0x5d3e34[_0xc421('0x5e')][_0xc421('0x71')],'ListId':_0x5d3e34['body'][_0xc421('0x72')],'active':!_[_0xc421('0x73')](_0x5d3e34[_0xc421('0x5e')][_0xc421('0x74')])?_0x5d3e34[_0xc421('0x5e')][_0xc421('0x74')]:!![],'description':_0x5d3e34[_0xc421('0x5e')][_0xc421('0x75')]||null};var _0x27b7be=getAuthenticationOptions(_0x553271[_0xc421('0x60')],_0x5d3e34[_0xc421('0x5e')]);_0x553271[_0xc421('0x3c')]=_0x27b7be[_0xc421('0x3c')];_0x553271[_0xc421('0x3d')]=_0x27b7be[_0xc421('0x3d')];return db[_0xc421('0x42')][_0xc421('0x66')](_0x553271,{'include':[{'model':db[_0xc421('0x3f')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0xc421('0x3c')}]})[_0xc421('0x11')](function(_0x606d40){var _0x30d9f3=_0x5d3e34[_0xc421('0x32')]['get']({'plain':!![]});if(!_0x30d9f3)throw new Error(_0xc421('0x76'));if(_0x30d9f3[_0xc421('0x77')]===_0xc421('0x32')){var _0x5b0450=_0x606d40['get']({'plain':!![]});return db[_0xc421('0x78')][_0xc421('0x5d')]({'where':{'name':_0xc421('0x25'),'userProfileId':_0x30d9f3[_0xc421('0x79')]},'raw':!![]})['then'](function(_0x15b46b){if(_0x15b46b&&_0x15b46b[_0xc421('0x7a')]===0x0){return db['UserProfileResource'][_0xc421('0x66')]({'name':_0x5b0450[_0xc421('0x28')],'resourceId':_0x5b0450['id'],'type':_0x15b46b[_0xc421('0x28')],'sectionId':_0x15b46b['id']},{})[_0xc421('0x11')](function(){return _0x606d40;});}else{return _0x606d40;}})['catch'](function(_0x28981d){logger['error'](_0xc421('0x7b'),_0x28981d);throw _0x28981d;});}return _0x606d40;})[_0xc421('0x11')](respondWithResult(_0x5254d8,0xc9))['catch'](handleError(_0x5254d8,null));};exports['getImap']=function(_0x296e44,_0x1f4df4){return db[_0xc421('0x42')]['findOne']({'where':{'id':_0x296e44[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x1f4df4,null))[_0xc421('0x11')](function(_0x2cf4cf){if(_0x2cf4cf){return _0x2cf4cf[_0xc421('0x7c')]();}return null;})['then'](respondWithResult(_0x1f4df4,null))['catch'](handleError(_0x1f4df4,null));};exports[_0xc421('0x7d')]=function(_0x44cb8c,_0x474e8f){if(_0x44cb8c[_0xc421('0x5e')]['id']){delete _0x44cb8c[_0xc421('0x5e')]['id'];}return db[_0xc421('0x42')][_0xc421('0x5d')]({'where':{'id':_0x44cb8c[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x474e8f,null))[_0xc421('0x11')](function(_0x5c8d18){if(_0x5c8d18){_0x44cb8c[_0xc421('0x5e')][_0xc421('0x6a')]=_0x5c8d18['id'];return db[_0xc421('0x5c')][_0xc421('0x66')](_0x44cb8c[_0xc421('0x5e')]);}})[_0xc421('0x11')](respondWithResult(_0x474e8f,null))[_0xc421('0x19')](handleError(_0x474e8f,null));};exports['removeImap']=function(_0x1a5d10,_0xb83634){return db['MailAccount'][_0xc421('0x6f')]({'where':{'id':_0x1a5d10[_0xc421('0x61')]['id']}})['then'](handleEntityNotFound(_0xb83634,null))[_0xc421('0x11')](function(_0x40e452){if(_0x40e452){return _0x40e452[_0xc421('0x7e')](null);}return null;})[_0xc421('0x11')](respondWithStatusCode(_0xb83634,null))[_0xc421('0x19')](handleError(_0xb83634,null));};exports[_0xc421('0x7f')]=function(_0x559baf,_0x26b5a7){return db[_0xc421('0x42')][_0xc421('0x6f')]({'where':{'id':_0x559baf[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x26b5a7,null))['then'](function(_0x2c44c8){if(_0x2c44c8){return _0x2c44c8[_0xc421('0x7f')]();}return null;})[_0xc421('0x11')](respondWithResult(_0x26b5a7,null))[_0xc421('0x19')](handleError(_0x26b5a7,null));};exports['addSmtp']=function(_0x39cc62,_0x245cdf){if(_0x39cc62[_0xc421('0x5e')]['id']){delete _0x39cc62['body']['id'];}return db[_0xc421('0x42')][_0xc421('0x5d')]({'where':{'id':_0x39cc62[_0xc421('0x61')]['id']}})['then'](handleEntityNotFound(_0x245cdf,null))[_0xc421('0x11')](function(_0x1b81d5){if(_0x1b81d5){_0x39cc62['body']['MailAccountId']=_0x1b81d5['id'];return db[_0xc421('0x3f')][_0xc421('0x66')](_0x39cc62[_0xc421('0x5e')]);}})[_0xc421('0x11')](respondWithResult(_0x245cdf,null))[_0xc421('0x19')](handleError(_0x245cdf,null));};exports['removeSmtp']=function(_0xc17ff,_0x26238a){return db['MailAccount'][_0xc421('0x6f')]({'where':{'id':_0xc17ff[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x26238a,null))['then'](function(_0x1e1839){if(_0x1e1839){return _0x1e1839[_0xc421('0x80')](null);}return null;})['then'](respondWithStatusCode(_0x26238a,null))[_0xc421('0x19')](handleError(_0x26238a,null));};exports[_0xc421('0x81')]=function(_0x440689,_0x26381c){return db[_0xc421('0x82')]['find']({'where':{'id':_0x440689[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x26381c,null))[_0xc421('0x11')](function(_0x5a00d7){if(_0x5a00d7){return _0x5a00d7['addInteraction'](_0x440689['body'][_0xc421('0x6c')],_[_0xc421('0x83')](_0x440689['body'],[_0xc421('0x6c'),'id'])||{});}})[_0xc421('0x11')](respondWithResult(_0x26381c,null))['catch'](handleError(_0x26381c,null));};exports[_0xc421('0x84')]=function(_0x1f7c38,_0x3e0d63){var _0x288020={'raw':![],'where':{}};var _0x5303c1={};var _0x2392a0={'count':0x0,'rows':[]};return db[_0xc421('0x42')]['findOne']({'where':{'id':_0x1f7c38[_0xc421('0x61')]['id']}})['then'](handleEntityNotFound(_0x3e0d63,null))[_0xc421('0x11')](function(_0x58bb88){if(_0x58bb88){_0x5303c1[_0xc421('0x4b')]=_['keys'](db[_0xc421('0x82')][_0xc421('0x43')]);_0x5303c1[_0xc421('0x4c')]=_[_0xc421('0x48')](_0x1f7c38[_0xc421('0x4c')]);_0x5303c1[_0xc421('0x49')]=_[_0xc421('0x4a')](_0x5303c1[_0xc421('0x4b')],_0x5303c1[_0xc421('0x4c')]);_0x288020[_0xc421('0x4e')]=_[_0xc421('0x4a')](_0x5303c1[_0xc421('0x4b')],qs[_0xc421('0x4d')](_0x1f7c38[_0xc421('0x4c')][_0xc421('0x4d')]));_0x288020[_0xc421('0x4e')]=_0x288020[_0xc421('0x4e')][_0xc421('0x4f')]?_0x288020[_0xc421('0x4e')]:_0x5303c1['model'];if(!_0x1f7c38[_0xc421('0x4c')][_0xc421('0x50')](_0xc421('0x68'))){_0x288020[_0xc421('0x1e')]=qs[_0xc421('0x1e')](_0x1f7c38[_0xc421('0x4c')][_0xc421('0x1e')]);_0x288020['offset']=qs['offset'](_0x1f7c38[_0xc421('0x4c')][_0xc421('0x1f')]);}_0x288020[_0xc421('0x51')]=qs['sort'](_0x1f7c38['query'][_0xc421('0x52')]);_0x288020[_0xc421('0x53')]=qs[_0xc421('0x49')](_[_0xc421('0x69')](_0x1f7c38[_0xc421('0x4c')],_0x5303c1[_0xc421('0x49')]));_0x288020[_0xc421('0x53')][_0xc421('0x6a')]=_0x58bb88['id'];if(_0x1f7c38[_0xc421('0x4c')][_0xc421('0x54')]){_0x288020['where']=_['merge'](_0x288020[_0xc421('0x53')],{'$or':_['map'](_0x288020['attributes'],function(_0x16f53a){var _0x23b0f8={};_0x23b0f8[_0x16f53a]={'$like':'%'+_0x1f7c38[_0xc421('0x4c')]['filter']+'%'};return _0x23b0f8;})});}_0x288020=_[_0xc421('0x56')]({},_0x288020,_0x1f7c38[_0xc421('0x57')]);return db['MailInteraction'][_0xc421('0x20')]({'where':_0x288020[_0xc421('0x53')]})[_0xc421('0x11')](function(_0x1f90ef){_0x2392a0[_0xc421('0x20')]=_0x1f90ef;if(_0x1f7c38['query'][_0xc421('0x58')]){_0x288020[_0xc421('0x59')]=[{'model':db[_0xc421('0x85')],'as':_0xc421('0x86'),'required':![]},{'model':db[_0xc421('0x87')],'as':_0xc421('0x88'),'attributes':[_0xc421('0x28'),_0xc421('0x89'),'internal'],'required':![]},{'model':db[_0xc421('0x8a')],'as':'Tags','attributes':['id','name',_0xc421('0x8b')],'where':_0x1f7c38['query']['tag']?{'id':_0x1f7c38['query'][_0xc421('0x8c')]}:undefined,'required':_0x1f7c38[_0xc421('0x4c')][_0xc421('0x8c')]?!![]:![]}];}return db[_0xc421('0x82')][_0xc421('0x5a')](_0x288020);})[_0xc421('0x11')](function(_0x11dc54){_0x2392a0['rows']=_0x11dc54;return _0x2392a0;});}})[_0xc421('0x11')](respondWithFilteredResult(_0x3e0d63,_0x288020))[_0xc421('0x19')](handleError(_0x3e0d63,null));};exports[_0xc421('0x8d')]=function addApplications(_0x185293,_0x16a132){var _0x1e9d8c=_0x185293[_0xc421('0x61')]['id'];var _0xe25cf5=_0x185293[_0xc421('0x5e')];var _0x4def5f=0xc8;var _0x4c9ae4=null;return db[_0xc421('0x8e')][_0xc421('0x8f')]({'isolationLevel':db[_0xc421('0x8e')][_0xc421('0x90')][_0xc421('0x91')][_0xc421('0x92')]},function(_0x1d3c01){return db[_0xc421('0x42')][_0xc421('0x6f')]({'where':{'id':_0x1e9d8c},'transaction':_0x1d3c01})[_0xc421('0x11')](function(_0x4ba7a0){if(_0x4ba7a0){return db[_0xc421('0x93')][_0xc421('0x26')]({'where':{'MailAccountId':_0x1e9d8c},'transaction':_0x1d3c01})[_0xc421('0x11')](function(){var _0x13a9a2=_['map'](_0xe25cf5,function(_0x1b663e){_0x1b663e['MailAccountId']=_0x1e9d8c;return _0x1b663e;});return db['MailApplication']['bulkCreate'](_0x13a9a2,{'transaction':_0x1d3c01});});}else{_0x4def5f=0x194;_0x4c9ae4=[];}});})[_0xc421('0x11')](function(){if(_0x4def5f!==0x194){return db[_0xc421('0x93')][_0xc421('0x94')]({'where':{'MailAccountId':_0x1e9d8c},'order':_0xc421('0x95')})[_0xc421('0x11')](function(_0x4af8ad){_0x4c9ae4=_0x4af8ad;});}})[_0xc421('0x19')](function(_0x51ca56){_0x4def5f=0x1f4;logger[_0xc421('0x16')](_0x51ca56['stack']);if(_0x51ca56['name']){delete _0x51ca56['name'];}_0x4c9ae4=_0x51ca56;})['finally'](function(){if(_0x4c9ae4===null){_0x16a132[_0xc421('0x1a')](_0x4def5f);}else{if(_0x4def5f===0x1f4){_0x16a132[_0xc421('0x1b')](_0x4def5f)['send'](_0x4c9ae4);}else{_0x16a132[_0xc421('0x1b')](_0x4def5f)[_0xc421('0x1c')](_0x4c9ae4);}}});};exports[_0xc421('0x96')]=function(_0x3d6685,_0x19afd3){var _0x2988b2={};var _0x4b1ae9={};var _0x86a5c4;var _0x563ac5;return db[_0xc421('0x42')]['findOne']({'where':{'id':_0x3d6685[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x19afd3,null))[_0xc421('0x11')](function(_0x2ddde1){if(_0x2ddde1){_0x86a5c4=_0x2ddde1;_0x4b1ae9[_0xc421('0x4b')]=_[_0xc421('0x48')](db[_0xc421('0x93')][_0xc421('0x43')]);_0x4b1ae9[_0xc421('0x4c')]=_['keys'](_0x3d6685[_0xc421('0x4c')]);_0x4b1ae9[_0xc421('0x49')]=_[_0xc421('0x4a')](_0x4b1ae9[_0xc421('0x4b')],_0x4b1ae9[_0xc421('0x4c')]);_0x2988b2[_0xc421('0x4e')]=_['intersection'](_0x4b1ae9[_0xc421('0x4b')],qs[_0xc421('0x4d')](_0x3d6685[_0xc421('0x4c')]['fields']));_0x2988b2[_0xc421('0x4e')]=_0x2988b2[_0xc421('0x4e')][_0xc421('0x4f')]?_0x2988b2[_0xc421('0x4e')]:_0x4b1ae9[_0xc421('0x4b')];_0x2988b2['order']=qs[_0xc421('0x52')](_0x3d6685[_0xc421('0x4c')][_0xc421('0x52')]);_0x2988b2[_0xc421('0x53')]=qs[_0xc421('0x49')](_[_0xc421('0x69')](_0x3d6685['query'],_0x4b1ae9['filters']));if(_0x3d6685[_0xc421('0x4c')]['filter']){_0x2988b2['where']=_['merge'](_0x2988b2[_0xc421('0x53')],{'$or':_['map'](_0x2988b2[_0xc421('0x4e')],function(_0x2051d0){var _0x4e43b1={};_0x4e43b1[_0x2051d0]={'$like':'%'+_0x3d6685[_0xc421('0x4c')][_0xc421('0x54')]+'%'};return _0x4e43b1;})});}_0x2988b2=_['merge']({},_0x2988b2,_0x3d6685[_0xc421('0x57')]);return _0x86a5c4[_0xc421('0x96')](_0x2988b2);}})[_0xc421('0x11')](function(_0x212d6a){if(_0x212d6a){_0x563ac5=_0x212d6a['length'];if(!_0x3d6685['query'][_0xc421('0x50')](_0xc421('0x68'))){_0x2988b2[_0xc421('0x1e')]=qs[_0xc421('0x1e')](_0x3d6685['query']['limit']);_0x2988b2[_0xc421('0x1f')]=qs[_0xc421('0x1f')](_0x3d6685[_0xc421('0x4c')][_0xc421('0x1f')]);}return _0x86a5c4[_0xc421('0x96')](_0x2988b2);}})[_0xc421('0x11')](function(_0x259f8f){if(_0x259f8f){return _0x259f8f?{'count':_0x563ac5,'rows':_0x259f8f}:null;}})[_0xc421('0x11')](respondWithResult(_0x19afd3,null))['catch'](handleError(_0x19afd3,null));};exports['getMessages']=function(_0x2fc9bb,_0x2c85b1){var _0x3c1ade={'raw':!![],'where':{}};var _0x1b61ea={};var _0x491c34={'count':0x0,'rows':[]};return db[_0xc421('0x42')][_0xc421('0x6f')]({'where':{'id':_0x2fc9bb[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x2c85b1,null))[_0xc421('0x11')](function(_0x3eaa8c){if(_0x3eaa8c){_0x1b61ea[_0xc421('0x4b')]=_[_0xc421('0x48')](db[_0xc421('0x97')][_0xc421('0x43')]);_0x1b61ea[_0xc421('0x4c')]=_['keys'](_0x2fc9bb['query']);_0x1b61ea[_0xc421('0x49')]=_[_0xc421('0x4a')](_0x1b61ea['model'],_0x1b61ea['query']);_0x3c1ade[_0xc421('0x4e')]=_['intersection'](_0x1b61ea[_0xc421('0x4b')],qs[_0xc421('0x4d')](_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x4d')]));_0x3c1ade[_0xc421('0x4e')]=_0x3c1ade[_0xc421('0x4e')]['length']?_0x3c1ade[_0xc421('0x4e')]:_0x1b61ea[_0xc421('0x4b')];if(!_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x50')]('nolimit')){_0x3c1ade[_0xc421('0x1e')]=qs[_0xc421('0x1e')](_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x1e')]);_0x3c1ade[_0xc421('0x1f')]=qs[_0xc421('0x1f')](_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x1f')]);}_0x3c1ade['order']=qs[_0xc421('0x52')](_0x2fc9bb['query'][_0xc421('0x52')]);_0x3c1ade[_0xc421('0x53')]=qs[_0xc421('0x49')](_[_0xc421('0x69')](_0x2fc9bb[_0xc421('0x4c')],_0x1b61ea[_0xc421('0x49')]));_0x3c1ade[_0xc421('0x53')][_0xc421('0x6a')]=_0x3eaa8c['id'];if(_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x54')]){_0x3c1ade[_0xc421('0x53')]=_[_0xc421('0x56')](_0x3c1ade[_0xc421('0x53')],{'$or':_[_0xc421('0x47')](_0x3c1ade['attributes'],function(_0x4e65e0){var _0x2aeea0={};_0x2aeea0[_0x4e65e0]={'$like':'%'+_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x54')]+'%'};return _0x2aeea0;})});}if(_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x98')]){var _0x22450c=_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x98')]['split'](',');var _0x2800f5={};_0x2800f5[_0x22450c[0x0]]={'$gte':moment(_0x22450c[0x1])[_0xc421('0x99')](_0xc421('0x9a'))};_0x3c1ade[_0xc421('0x53')]=_[_0xc421('0x56')](_0x3c1ade[_0xc421('0x53')],_0x2800f5);}_0x3c1ade=_[_0xc421('0x56')]({},_0x3c1ade,_0x2fc9bb['options']);return db['MailMessage'][_0xc421('0x20')]({'where':_0x3c1ade[_0xc421('0x53')]})[_0xc421('0x11')](function(_0x2195f3){_0x491c34[_0xc421('0x20')]=_0x2195f3;if(_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x58')]){_0x3c1ade[_0xc421('0x59')]=[{'all':!![]}];}return db[_0xc421('0x97')][_0xc421('0x5a')](_0x3c1ade);})[_0xc421('0x11')](function(_0x151b52){if(_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x9b')]==='true'){for(var _0x2d821d=0x0;_0x2d821d<_0x151b52[_0xc421('0x4f')];_0x2d821d++){_0x151b52[_0x2d821d][_0xc421('0x5e')]=juice(_0x151b52[_0x2d821d][_0xc421('0x5e')]);}}_0x491c34[_0xc421('0x5b')]=_0x151b52;return _0x491c34;});}})[_0xc421('0x11')](respondWithFilteredResult(_0x2c85b1,_0x3c1ade))['catch'](handleError(_0x2c85b1,null));};exports[_0xc421('0x9c')]=function(_0x3aad27,_0x1ff74d){var _0x555c7b,_0xe3b623={},_0x56f239;if(_0x3aad27[_0xc421('0x5e')]['to']){_0x56f239=_0x3aad27[_0xc421('0x5e')]['to'][_0xc421('0x9d')](',')[0x0];}return db['MailAccount'][_0xc421('0x5d')]({'where':{'id':_0x3aad27[_0xc421('0x61')]['id']},'include':[{'model':db['CmList'],'as':_0xc421('0x9e'),'include':[{'model':db[_0xc421('0x85')],'as':_0xc421('0x9f'),'where':{'email':_0x56f239},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailServerOut'],'as':_0xc421('0x3d'),'raw':!![],'include':[{'model':db[_0xc421('0xa0')],'as':_0xc421('0xa0'),'raw':!![]}]}]})[_0xc421('0x11')](handleEntityNotFound(_0x1ff74d,null))[_0xc421('0x11')](function(_0x2e3bcf){if(!_0x2e3bcf)return;_0x555c7b=_0x2e3bcf;if(!_0x2e3bcf['Smtp'])throw new Error(_0xc421('0xa1'));if(_[_0xc421('0x73')](_0x3aad27['body'][_0xc421('0xa2')])){_0x3aad27[_0xc421('0x5e')][_0xc421('0xa2')]=util['format'](_0xc421('0xa3'),_0x2e3bcf[_0xc421('0x28')],_0x2e3bcf[_0xc421('0x71')]||_0x2e3bcf[_0xc421('0x3d')][_0xc421('0x32')]);}if(_0x3aad27[_0xc421('0x5e')][_0xc421('0xa4')]&&_0x3aad27['body'][_0xc421('0xa4')][_0xc421('0x4f')]){for(var _0x9a4216=0x0;_0x9a4216<_0x3aad27['body'][_0xc421('0xa4')][_0xc421('0x4f')];_0x9a4216+=0x1){_0x3aad27[_0xc421('0x5e')][_0xc421('0xa4')][_0x9a4216]={'filename':_0x3aad27['body'][_0xc421('0xa4')][_0x9a4216][_0xc421('0x28')],'path':path[_0xc421('0xa5')](config[_0xc421('0xa6')],_0xc421('0xa7'),_0x3aad27[_0xc421('0x5e')][_0xc421('0xa4')][_0x9a4216][_0xc421('0xa8')])};}}var _0x521262=_0x2e3bcf[_0xc421('0xa9')]();return respondWithRpcPromise(_0xc421('0xaa'),_0xc421('0xab'),{'account':_0x521262,'message':_0x3aad27[_0xc421('0x5e')]});})['then'](function(_0xc17ef3){if(!_0xc17ef3)return;_0xe3b623=_0xc17ef3;if(!_0x555c7b[_0xc421('0x9e')])throw new Error(_0xc421('0xac'));if(_0x555c7b['List']['Contacts'][_0xc421('0x4f')])return _0x555c7b[_0xc421('0x9e')][_0xc421('0x9f')][0x0];return db[_0xc421('0x85')]['create'](_[_0xc421('0x8')](_0x3aad27[_0xc421('0x5e')],{'firstName':_0x3aad27[_0xc421('0x5e')]['to'],'email':_0x3aad27[_0xc421('0x5e')]['to'],'phone':_0x3aad27[_0xc421('0x5e')]['to'],'ListId':_0x555c7b['ListId']}));})[_0xc421('0x11')](function(_0x2a5d5b){if(!_0x2a5d5b)return;var _0x31a5a6={'UserId':_0x3aad27[_0xc421('0x32')]['id'],'ContactId':_0x2a5d5b['id'],'MailAccountId':_0x555c7b['id'],'inReplyTo':_0xe3b623[_0xc421('0xad')],'to':_0x3aad27[_0xc421('0x5e')][_0xc421('0xa2')],'cc':_0x3aad27['body']['cc'],'subject':_0x3aad27['body'][_0xc421('0xae')],'attach':_0x3aad27['body'][_0xc421('0xaf')],'firstMsgDirection':_0xc421('0xb0'),'lastMsgAt':moment()[_0xc421('0x99')](_0xc421('0x9a')),'lastMsgDirection':_0xc421('0xb0'),'Messages':[_[_0xc421('0x56')](_0x3aad27[_0xc421('0x5e')],{'messageId':_0xe3b623[_0xc421('0xad')],'sentAt':moment()[_0xc421('0x99')](_0xc421('0x9a')),'read':!![],'MailAccountId':_0x555c7b['id'],'UserId':_0x3aad27[_0xc421('0x32')]['id'],'ContactId':_0x2a5d5b['id']})]};if(_0x3aad27[_0xc421('0x5e')][_0xc421('0xb1')]){_0x31a5a6=_[_0xc421('0x56')](_0x31a5a6,_0x3aad27['body'][_0xc421('0xb1')]);}return db[_0xc421('0x82')][_0xc421('0x66')](_0x31a5a6,{'include':[{'model':db[_0xc421('0x97')],'as':_0xc421('0xb2')}]});})[_0xc421('0x11')](respondWithResult(_0x1ff74d,null))['catch'](handleError(_0x1ff74d,null));};exports['verifySmtp']=function(_0x1870d0,_0x4969c3){return db[_0xc421('0x42')][_0xc421('0x5d')]({'where':{'id':_0x1870d0[_0xc421('0x61')]['id']},'include':[{'model':db[_0xc421('0x3f')],'as':_0xc421('0x3d'),'raw':!![],'include':[{'model':db[_0xc421('0xa0')],'as':'CloudProvider','raw':!![]}]}]})[_0xc421('0x11')](handleEntityNotFound(_0x4969c3,null))[_0xc421('0x11')](function(_0x5ea163){if(!_0x5ea163[_0xc421('0x3d')])return;var _0x459a39=_0x5ea163[_0xc421('0xa9')]();return respondWithRpcPromise(_0xc421('0xb3'),_0xc421('0xb4'),{'account':_0x459a39});})['then'](respondWithResult(_0x4969c3,null))[_0xc421('0x19')](handleError(_0x4969c3,null));};exports[_0xc421('0x26')]=function(_0x157291,_0x45d601){return db[_0xc421('0x42')]['find']({'where':{'id':_0x157291['params']['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x45d601,null))['then'](function(_0x31fdc2){if(_0x31fdc2&&_0x31fdc2['service']){throw new db['Sequelize'][(_0xc421('0xb5'))](_0xc421('0xb6'));}return _0x31fdc2;})[_0xc421('0x11')](removeEntity(_0x45d601,null))[_0xc421('0x19')](handleError(_0x45d601,null));};exports[_0xc421('0xb7')]=function(_0x110661,_0x574d04){return db['MailAccount'][_0xc421('0x5d')]({'where':{'id':_0x110661[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x574d04,null))['then'](function(_0x423bd9){if(_0x423bd9){return _0x423bd9['addAgents'](_0x110661[_0xc421('0x5e')][_0xc421('0x6c')],_[_0xc421('0x83')](_0x110661[_0xc421('0x5e')],['ids','id'])||{})[_0xc421('0xb8')](function(_0x1de13d){for(var _0x228e96=0x0;_0x228e96<_0x110661[_0xc421('0x5e')][_0xc421('0x6c')][_0xc421('0x4f')];_0x228e96+=0x1){socket[_0xc421('0xb9')]('userMailAccount:save',{'UserId':Number(_0x110661[_0xc421('0x5e')][_0xc421('0x6c')][_0x228e96]),'MailAccountId':Number(_0x110661[_0xc421('0x61')]['id'])});}return _0x1de13d;});}})[_0xc421('0x11')](respondWithResult(_0x574d04,null))[_0xc421('0x19')](handleError(_0x574d04,null));};exports['removeAgents']=function(_0x3e9358,_0x515e21){return db[_0xc421('0x42')][_0xc421('0x5d')]({'where':{'id':_0x3e9358[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x515e21,null))[_0xc421('0x11')](function(_0x5c8953){if(_0x5c8953){return _0x5c8953[_0xc421('0xba')](_0x3e9358[_0xc421('0x4c')][_0xc421('0x6c')])['then'](function(){if(_[_0xc421('0xbb')](_0x3e9358[_0xc421('0x4c')][_0xc421('0x6c')])){for(var _0x1ed7d6=0x0;_0x1ed7d6<_0x3e9358[_0xc421('0x4c')][_0xc421('0x6c')][_0xc421('0x4f')];_0x1ed7d6+=0x1){socket[_0xc421('0xb9')](_0xc421('0xbc'),{'UserId':Number(_0x3e9358[_0xc421('0x4c')][_0xc421('0x6c')][_0x1ed7d6]),'MailAccountId':Number(_0x3e9358[_0xc421('0x61')]['id'])});}}else{socket[_0xc421('0xb9')]('userMailAccount:remove',{'UserId':Number(_0x3e9358[_0xc421('0x4c')][_0xc421('0x6c')]),'MailAccountId':Number(_0x3e9358[_0xc421('0x61')]['id'])});}});}})[_0xc421('0x11')](respondWithStatusCode(_0x515e21,null))[_0xc421('0x19')](handleError(_0x515e21,null));};exports['getAgents']=function(_0x3716f2,_0x21fe01){var _0x4a945b={};var _0x437eef={};var _0x1a187e;var _0x401a17;return db[_0xc421('0x42')][_0xc421('0x6f')]({'where':{'id':_0x3716f2[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x21fe01,null))['then'](function(_0x8578f7){if(_0x8578f7){_0x1a187e=_0x8578f7;_0x437eef[_0xc421('0x4b')]=_['keys'](db[_0xc421('0x87')][_0xc421('0x43')]);_0x437eef['query']=_[_0xc421('0x48')](_0x3716f2[_0xc421('0x4c')]);_0x437eef[_0xc421('0x49')]=_[_0xc421('0x4a')](_0x437eef[_0xc421('0x4b')],_0x437eef['query']);_0x4a945b['attributes']=_[_0xc421('0x4a')](_0x437eef[_0xc421('0x4b')],qs[_0xc421('0x4d')](_0x3716f2[_0xc421('0x4c')][_0xc421('0x4d')]));_0x4a945b['attributes']=_0x4a945b[_0xc421('0x4e')][_0xc421('0x4f')]?_0x4a945b[_0xc421('0x4e')]:_0x437eef['model'];_0x4a945b[_0xc421('0x51')]=qs[_0xc421('0x52')](_0x3716f2['query'][_0xc421('0x52')]);_0x4a945b[_0xc421('0x53')]=qs['filters'](_['pick'](_0x3716f2[_0xc421('0x4c')],_0x437eef['filters']));if(_0x3716f2['query']['filter']){_0x4a945b[_0xc421('0x53')]=_[_0xc421('0x56')](_0x4a945b['where'],{'$or':_[_0xc421('0x47')](_0x4a945b[_0xc421('0x4e')],function(_0x491b0a){var _0x54fcfb={};_0x54fcfb[_0x491b0a]={'$like':'%'+_0x3716f2[_0xc421('0x4c')]['filter']+'%'};return _0x54fcfb;})});}_0x4a945b=_[_0xc421('0x56')]({},_0x4a945b,_0x3716f2['options']);return _0x1a187e[_0xc421('0xbd')](_0x4a945b);}})[_0xc421('0x11')](function(_0x5a9bb){if(_0x5a9bb){_0x401a17=_0x5a9bb['length'];if(!_0x3716f2[_0xc421('0x4c')][_0xc421('0x50')](_0xc421('0x68'))){_0x4a945b['limit']=qs['limit'](_0x3716f2[_0xc421('0x4c')]['limit']);_0x4a945b['offset']=qs[_0xc421('0x1f')](_0x3716f2[_0xc421('0x4c')]['offset']);}return _0x1a187e[_0xc421('0xbd')](_0x4a945b);}})[_0xc421('0x11')](function(_0x3244dc){if(_0x3244dc){return _0x3244dc?{'count':_0x401a17,'rows':_0x3244dc}:null;}})['then'](respondWithResult(_0x21fe01,null))[_0xc421('0x19')](handleError(_0x21fe01,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index d6e72f3..feb0a13 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 _0xa49e=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update'];(function(_0x815012,_0xcdd478){var _0x500529=function(_0x202751){while(--_0x202751){_0x815012['push'](_0x815012['shift']());}};_0x500529(++_0xcdd478);}(_0xa49e,0x1de));var _0xea49=function(_0x1f8057,_0x29937c){_0x1f8057=_0x1f8057-0x0;var _0x530ae5=_0xa49e[_0x1f8057];return _0x530ae5;};'use strict';var EventEmitter=require(_0xea49('0x0'));var MailAccount=require(_0xea49('0x1'))['db'][_0xea49('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xea49('0x3')](0x0);var events={'afterCreate':_0xea49('0x4'),'afterUpdate':_0xea49('0x5'),'afterDestroy':_0xea49('0x6')};function emitEvent(_0x228052){return function(_0x5e12d0,_0x2ef1ec,_0x439b3d){MailAccountEvents[_0xea49('0x7')](_0x228052+':'+_0x5e12d0['id'],_0x5e12d0);MailAccountEvents['emit'](_0x228052,_0x5e12d0);_0x439b3d(null);};}for(var e in events){if(events[_0xea49('0x8')](e)){var event=events[e];MailAccount[_0xea49('0x9')](e,emitEvent(event));}}module[_0xea49('0xa')]=MailAccountEvents; \ No newline at end of file +var _0xb53e=['exports','events','../../mysqldb','setMaxListeners','save','remove','hasOwnProperty','hook'];(function(_0x19aa25,_0x16019f){var _0x1b6a40=function(_0x2c1a2d){while(--_0x2c1a2d){_0x19aa25['push'](_0x19aa25['shift']());}};_0x1b6a40(++_0x16019f);}(_0xb53e,0xa9));var _0xeb53=function(_0xb4fb5e,_0x1c3cde){_0xb4fb5e=_0xb4fb5e-0x0;var _0x3ffbf8=_0xb53e[_0xb4fb5e];return _0x3ffbf8;};'use strict';var EventEmitter=require(_0xeb53('0x0'));var MailAccount=require(_0xeb53('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xeb53('0x2')](0x0);var events={'afterCreate':_0xeb53('0x3'),'afterUpdate':'update','afterDestroy':_0xeb53('0x4')};function emitEvent(_0xbce00b){return function(_0x526b45,_0x21ce3d,_0x3b4dd3){MailAccountEvents['emit'](_0xbce00b+':'+_0x526b45['id'],_0x526b45);MailAccountEvents['emit'](_0xbce00b,_0x526b45);_0x3b4dd3(null);};}for(var e in events){if(events[_0xeb53('0x5')](e)){var event=events[e];MailAccount[_0xeb53('0x6')](e,emitEvent(event));}}module[_0xeb53('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 b8bb483..9630bd3 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 _0x59c4=['provider','custom','service','host','port','Smtp','secure','authentication','modernAuthentication','auth','OAuth2','user','CloudProvider','data5','pass','./mailAccount.attributes','exports','mail_accounts'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x59c4,0x9f));var _0x459c=function(_0xeb45bf,_0xb9e836){_0xeb45bf=_0xeb45bf-0x0;var _0x17f563=_0x59c4[_0xeb45bf];return _0x17f563;};'use strict';var attributes=require(_0x459c('0x0'));module[_0x459c('0x1')]=function(_0x1e3a77){return _0x1e3a77['define']('MailAccount',attributes,{'tableName':_0x459c('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x5bfa3b=this;var _0x2b7d0c={'id':_0x5bfa3b['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5bfa3b[_0x459c('0x3')]!==_0x459c('0x4')){_0x2b7d0c[_0x459c('0x5')]=_0x5bfa3b[_0x459c('0x3')];}else{_0x2b7d0c[_0x459c('0x6')]=_0x5bfa3b['Smtp'][_0x459c('0x6')];_0x2b7d0c[_0x459c('0x7')]=_0x5bfa3b[_0x459c('0x8')][_0x459c('0x7')];_0x2b7d0c[_0x459c('0x9')]=_0x5bfa3b[_0x459c('0x8')]['secure'];}if(_0x5bfa3b[_0x459c('0x8')][_0x459c('0xa')]){if(_0x5bfa3b[_0x459c('0x8')][_0x459c('0xb')]){if(!_0x5bfa3b['Smtp']['CloudProvider'])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x2b7d0c[_0x459c('0xc')]={'type':_0x459c('0xd'),'user':_0x5bfa3b[_0x459c('0x8')][_0x459c('0xe')],'accessToken':_0x5bfa3b['Smtp'][_0x459c('0xf')][_0x459c('0x10')]};}else{_0x2b7d0c[_0x459c('0xc')]={'user':_0x5bfa3b[_0x459c('0x8')][_0x459c('0xe')],'pass':_0x5bfa3b[_0x459c('0x8')][_0x459c('0x11')]};}}return _0x2b7d0c;}}});}; \ No newline at end of file +var _0x804d=['Smtp','host','port','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','exports','define','MailAccount','mail_accounts','provider','custom','service'];(function(_0x4f2b8c,_0x4012c8){var _0x1226ae=function(_0x495689){while(--_0x495689){_0x4f2b8c['push'](_0x4f2b8c['shift']());}};_0x1226ae(++_0x4012c8);}(_0x804d,0x185));var _0xd804=function(_0x3cb979,_0x21bbfd){_0x3cb979=_0x3cb979-0x0;var _0x3a5e5f=_0x804d[_0x3cb979];return _0x3a5e5f;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xd804('0x0')]=function(_0x217d80){return _0x217d80[_0xd804('0x1')](_0xd804('0x2'),attributes,{'tableName':_0xd804('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x329c1f=this;var _0x10d729={'id':_0x329c1f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x329c1f[_0xd804('0x4')]!==_0xd804('0x5')){_0x10d729[_0xd804('0x6')]=_0x329c1f['provider'];}else{_0x10d729['host']=_0x329c1f[_0xd804('0x7')][_0xd804('0x8')];_0x10d729['port']=_0x329c1f[_0xd804('0x7')][_0xd804('0x9')];_0x10d729[_0xd804('0xa')]=_0x329c1f[_0xd804('0x7')]['secure'];}if(_0x329c1f[_0xd804('0x7')][_0xd804('0xb')]){if(_0x329c1f[_0xd804('0x7')][_0xd804('0xc')]){if(!_0x329c1f[_0xd804('0x7')]['CloudProvider'])throw new Error(_0xd804('0xd'));_0x10d729[_0xd804('0xe')]={'type':_0xd804('0xf'),'user':_0x329c1f[_0xd804('0x7')][_0xd804('0x10')],'accessToken':_0x329c1f[_0xd804('0x7')]['CloudProvider'][_0xd804('0x11')]};}else{_0x10d729[_0xd804('0xe')]={'user':_0x329c1f[_0xd804('0x7')][_0xd804('0x10')],'pass':_0x329c1f['Smtp']['pass']};}}return _0x10d729;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 1be7af8..39e507c 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(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0x2542,0x169));var _0x2254=function(_0x3a29b4,_0x2f9cc5){_0x3a29b4=_0x3a29b4-0x0;var _0x5f538b=_0x2542[_0x3a29b4];return _0x5f538b;};'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 _0x4137=['Smtp','CloudProvider','get','omit','Applications','applications','priority','asc','push','length','Contacts','create','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Contact\x20not\x20found','spread','update','interaction','created','MailMessage','originTo','originCc','bcc','originChannel','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','*,*,*,*','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','request\x20sent','debug','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','mail','difference','keys','CmContact','createdAt','CompanyId','ListId','body','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','DESC','MailServerOut'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x4137,0xf8));var _0x7413=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4137[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x7413('0x0'));var moment=require(_0x7413('0x1'));var BPromise=require(_0x7413('0x2'));var rs=require(_0x7413('0x3'));var Redis=require(_0x7413('0x4'));var db=require(_0x7413('0x5'))['db'];var logger=require(_0x7413('0x6'))(_0x7413('0x7'));var config=require(_0x7413('0x8'));var jayson=require(_0x7413('0x9'));var client=jayson[_0x7413('0xa')][_0x7413('0xb')]({'port':0x232c});config['redis']=_[_0x7413('0xc')](config[_0x7413('0xd')],{'host':_0x7413('0xe'),'port':0x18eb});var socket=require(_0x7413('0xf'))(new Redis(config['redis']));require(_0x7413('0x10'))[_0x7413('0x11')](socket);function respondWithRpcPromise(_0x4e320b,_0x422bf5,_0x2f4b54){return new BPromise(function(_0x50fde0,_0x29f124){return client[_0x7413('0x12')](_0x4e320b,_0x2f4b54)[_0x7413('0x13')](function(_0x3e026b){logger[_0x7413('0x14')]('MailAccount,\x20%s,\x20%s',_0x422bf5,_0x7413('0x15'));logger[_0x7413('0x16')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x422bf5,_0x7413('0x15'),JSON[_0x7413('0x17')](_0x3e026b));if(_0x3e026b[_0x7413('0x18')]){if(_0x3e026b['error']['code']===0x1f4){logger['error'](_0x7413('0x19'),_0x422bf5,_0x3e026b[_0x7413('0x18')]['message']);return _0x29f124(_0x3e026b[_0x7413('0x18')][_0x7413('0x1a')]);}logger['error'](_0x7413('0x19'),_0x422bf5,_0x3e026b['error']['message']);return _0x50fde0(_0x3e026b[_0x7413('0x18')]['message']);}else{logger[_0x7413('0x14')]('MailAccount,\x20%s,\x20%s',_0x422bf5,_0x7413('0x15'));_0x50fde0(_0x3e026b[_0x7413('0x1b')][_0x7413('0x1a')]);}})[_0x7413('0x1c')](function(_0x2a3417){logger[_0x7413('0x18')]('MailAccount,\x20%s,\x20%s',_0x422bf5,_0x2a3417);_0x29f124(_0x2a3417);});});}exports[_0x7413('0x1d')]=function(_0x17c062){var _0x11f8a1=this;return new Promise(function(_0xfe5b8c,_0x5bee15){return db[_0x7413('0x1e')][_0x7413('0x1f')]({'raw':_0x17c062[_0x7413('0x20')]?_0x17c062[_0x7413('0x20')][_0x7413('0x21')]===undefined?!![]:![]:!![],'where':_0x17c062[_0x7413('0x20')]?_0x17c062[_0x7413('0x20')][_0x7413('0x22')]||null:null,'attributes':_0x17c062['options']?_0x17c062['options'][_0x7413('0x23')]||null:null,'limit':_0x17c062['options']?_0x17c062[_0x7413('0x20')][_0x7413('0x24')]||null:null,'include':_0x17c062[_0x7413('0x20')]?_0x17c062[_0x7413('0x20')][_0x7413('0x25')]?_[_0x7413('0x26')](_0x17c062[_0x7413('0x20')][_0x7413('0x25')],function(_0x1d455b){return{'model':db[_0x1d455b['model']],'as':_0x1d455b['as'],'attributes':_0x1d455b['attributes'],'include':_0x1d455b[_0x7413('0x25')]?_['map'](_0x1d455b[_0x7413('0x25')],function(_0x71cbb4){return{'model':db[_0x71cbb4[_0x7413('0x27')]],'as':_0x71cbb4['as'],'attributes':_0x71cbb4['attributes'],'include':_0x71cbb4[_0x7413('0x25')]?_[_0x7413('0x26')](_0x71cbb4[_0x7413('0x25')],function(_0x4843fd){return{'model':db[_0x4843fd[_0x7413('0x27')]],'as':_0x4843fd['as'],'attributes':_0x4843fd[_0x7413('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24dce7){logger['info'](_0x7413('0x1d'),_0x17c062);logger[_0x7413('0x16')](_0x7413('0x1d'),_0x17c062,JSON[_0x7413('0x17')](_0x24dce7));_0xfe5b8c(_0x24dce7);})[_0x7413('0x1c')](function(_0x2004ea){logger['error'](_0x7413('0x1d'),_0x2004ea[_0x7413('0x1a')],_0x17c062);_0x5bee15(_0x11f8a1[_0x7413('0x18')](0x1f4,_0x2004ea[_0x7413('0x1a')]));});});};exports[_0x7413('0x28')]=function(_0x256395){var _0x185cfe=this;return new Promise(function(_0x5b4426,_0xd763f9){return db[_0x7413('0x1e')][_0x7413('0x29')]({'raw':_0x256395[_0x7413('0x20')]?_0x256395[_0x7413('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x256395[_0x7413('0x20')]?_0x256395['options'][_0x7413('0x22')]||null:null,'attributes':_0x256395[_0x7413('0x20')]?_0x256395[_0x7413('0x20')]['attributes']||null:null,'include':_0x256395[_0x7413('0x20')]?_0x256395['options'][_0x7413('0x25')]?_[_0x7413('0x26')](_0x256395['options']['include'],function(_0x440bfe){return{'model':db[_0x440bfe[_0x7413('0x27')]],'as':_0x440bfe['as'],'attributes':_0x440bfe[_0x7413('0x23')],'include':_0x440bfe['include']?_['map'](_0x440bfe[_0x7413('0x25')],function(_0x5a92ab){return{'model':db[_0x5a92ab['model']],'as':_0x5a92ab['as'],'attributes':_0x5a92ab[_0x7413('0x23')],'include':_0x5a92ab['include']?_[_0x7413('0x26')](_0x5a92ab[_0x7413('0x25')],function(_0xf34b21){return{'model':db[_0xf34b21[_0x7413('0x27')]],'as':_0xf34b21['as'],'attributes':_0xf34b21[_0x7413('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa58bd2){if(_0x256395[_0x7413('0x20')][_0x7413('0x2a')]===!![])_0xa58bd2[_0x7413('0x2b')](_0x7413('0x2c'),_0xa58bd2[_0x7413('0x2d')]());logger[_0x7413('0x14')](_0x7413('0x28'),_0x256395);logger[_0x7413('0x16')](_0x7413('0x28'),_0x256395,JSON[_0x7413('0x17')](_0xa58bd2));_0x5b4426(_0xa58bd2);})[_0x7413('0x1c')](function(_0x5a9791){logger[_0x7413('0x18')]('ShowMailAccount',_0x5a9791['message'],_0x256395);_0xd763f9(_0x185cfe['error'](0x1f4,_0x5a9791['message']));});});};exports['NotifyMailAccount']=function(_0x44af7d){var _0x4c1770=this;return new Promise(function(_0x535e49,_0x5dc077){var _0x4d0008={'body':_0x44af7d['body'],'channel':_0x7413('0x2e')};var _0x32f1e8=_[_0x7413('0x2f')](_[_0x7413('0x30')](db[_0x7413('0x31')]['rawAttributes']),[_0x7413('0x32'),'updatedAt',_0x7413('0x33'),_0x7413('0x34')]);var _0xa063d1=![];if(_0x44af7d[_0x7413('0x35')]['id']){delete _0x44af7d[_0x7413('0x35')]['id'];}if(_[_0x7413('0x36')](_0x44af7d[_0x7413('0x35')][_0x7413('0x37')])){return _0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x7413('0x38')));}if(_[_0x7413('0x36')](_0x44af7d[_0x7413('0x35')][_0x7413('0x35')])||_0x44af7d['body'][_0x7413('0x35')]===''){return _0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x7413('0x39')));}if(_[_0x7413('0x36')](_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')])){return _0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x7413('0x3b')+_0x32f1e8));}if(!_[_0x7413('0x3c')](_0x32f1e8,_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')])){return _0x5dc077(_0x4c1770['error'](0x1f4,_0x7413('0x3d')+_0x32f1e8));}var _0x52a088={};_0x52a088[_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')]]=_0x44af7d[_0x7413('0x35')][_0x7413('0x37')];return db[_0x7413('0x1e')][_0x7413('0x29')]({'where':{'id':_0x44af7d[_0x7413('0x3e')]['id']},'include':[{'model':db[_0x7413('0x3f')],'as':_0x7413('0x40'),'include':[{'model':db[_0x7413('0x31')],'as':'Contacts','where':_0x52a088,'limit':0x1,'order':[['updatedAt',_0x7413('0x41')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0x7413('0x42')],'as':_0x7413('0x43'),'include':[{'model':db['CloudProvider'],'as':_0x7413('0x44')}]}]})['then'](function(_0x562bae){if(_0x562bae&&_0x562bae[_0x7413('0x40')]){var _0x5f263e=_0x562bae[_0x7413('0x45')]({'plain':!![]});_0x4d0008[_0x7413('0x3e')]=_[_0x7413('0x46')](_0x5f263e,[_0x7413('0x47'),_0x7413('0x40')]);_0x4d0008[_0x7413('0x3e')][_0x7413('0x2c')]=_0x562bae[_0x7413('0x2d')]();_0x4d0008[_0x7413('0x48')]=_0x5f263e[_0x7413('0x47')];_0x4d0008['list']=_0x5f263e[_0x7413('0x40')];_0x4d0008['applications']=_['orderBy'](_0x4d0008['applications'],[_0x7413('0x49')],[_0x7413('0x4a')]);if(_0x4d0008[_0x7413('0x3e')]&&_0x4d0008[_0x7413('0x3e')]['autoclose']){_0x4d0008['applications'][_0x7413('0x4b')]({'id':0x0,'priority':_0x4d0008['applications'][_0x7413('0x4c')]+0x1,'app':'close','appdata':'autoclose','interval':'*,*,*,*'});}if(_0x4d0008['account']['Applications']){delete _0x4d0008[_0x7413('0x3e')][_0x7413('0x47')];}if(_0x4d0008[_0x7413('0x3e')][_0x7413('0x40')]){delete _0x4d0008[_0x7413('0x3e')]['List'];}if(_0x5f263e[_0x7413('0x40')][_0x7413('0x4d')][_0x7413('0x4c')]){return _0x5f263e['List'][_0x7413('0x4d')][0x0];}var _0x5c3324=_['defaults'](_0x44af7d[_0x7413('0x35')],{'firstName':_0x44af7d[_0x7413('0x35')][_0x7413('0x37')],'ListId':_0x5f263e[_0x7413('0x34')]});_0x5c3324[_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')]]=_0x44af7d['body'][_0x7413('0x37')];return db['CmContact'][_0x7413('0x4e')](_0x5c3324);}else{throw new Error('List\x20not\x20found');}})[_0x7413('0x13')](function(_0x4d4faa){_0x4d0008[_0x7413('0x4f')]=_0x4d4faa;if(_0x4d4faa){if(!_0x44af7d[_0x7413('0x35')]['message'][_0x7413('0x50')]){_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x50')]=rs['generate']()+'\x20'+_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['from'];}var _0x3ce34c={'ContactId':_0x4d4faa['id'],'MailAccountId':_0x44af7d[_0x7413('0x3e')]['id'],'inReplyTo':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x50')],'to':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x37')],'cc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['cc'],'subject':_0x44af7d[_0x7413('0x35')]['message'][_0x7413('0x51')],'attach':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x52')],'lastMsgAt':moment()[_0x7413('0x53')](_0x7413('0x54')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x44af7d['account']['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x7413('0x50')],'where':{'messageId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['inReplyTo']}}]})[_0x7413('0x13')](function(_0xb7dd83){if(_0xb7dd83){return[_0xb7dd83,![]];}return db[_0x7413('0x55')][_0x7413('0x4e')](_0x3ce34c)[_0x7413('0x13')](function(_0x3db284){return[_0x3db284,!![]];});});}else{throw new Error(_0x7413('0x56'));}})[_0x7413('0x57')](function(_0x1ec131,_0x47512d){if(_0x1ec131){_0xa063d1=_0x47512d;if(!_0x47512d){return _0x1ec131[_0x7413('0x58')]({'inReplyTo':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['messageId'],'to':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['from'],'cc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['cc'],'subject':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x51')],'attach':_0x1ec131[_0x7413('0x52')]?_0x1ec131['attach']:_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['attach'],'substatus':null,'substatusAt':moment()[_0x7413('0x53')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x7413('0x54')),'lastMsgDirection':'in'});}else{return _0x1ec131;}}})[_0x7413('0x13')](function(_0x167c6b){_0x4d0008[_0x7413('0x59')]=_0x167c6b[_0x7413('0x45')]({'plain':!![]});_0x4d0008[_0x7413('0x59')][_0x7413('0x5a')]=_0xa063d1;return db[_0x7413('0x5b')]['create']({'body':_0x44af7d[_0x7413('0x35')]['body'],'MailAccountId':_0x44af7d[_0x7413('0x3e')]['id'],'MailInteractionId':_0x167c6b['id'],'direction':'in','ContactId':_0x4d0008[_0x7413('0x4f')]['id'],'messageId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x50')],'from':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x37')],'to':_0x44af7d[_0x7413('0x35')]['message']['to'],'cc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['cc'],'subject':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x51')],'attach':_0x44af7d['body'][_0x7413('0x1a')]['attach'],'Attachments':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['attachments'],'originTo':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x5c')],'originCc':_0x44af7d[_0x7413('0x35')]['message'][_0x7413('0x5d')],'bcc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x5e')],'ChatWebsiteId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['ChatWebsiteId']||null,'originChannel':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x5f')]||'Email','ChatOfflineMessageId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x60')]||null},{'include':[{'model':db[_0x7413('0x61')],'as':_0x7413('0x62')}]});})[_0x7413('0x13')](function(_0x46e9f8){_0x4d0008[_0x7413('0x1a')]=_0x46e9f8;if(_0x4d0008[_0x7413('0x59')]['UserId']){return db[_0x7413('0x63')][_0x7413('0x29')]({'attributes':['id',_0x7413('0x64')],'where':{'id':_0x4d0008[_0x7413('0x59')][_0x7413('0x65')]}})[_0x7413('0x13')](function(_0x4c9d1b){if(_0x4c9d1b){_0x4d0008[_0x7413('0x48')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4c9d1b[_0x7413('0x64')]+','+(_0x4d0008[_0x7413('0x3e')]['waitForTheAssignedAgent']||0xa),'interval':_0x7413('0x66')});}return respondWithRpcPromise(_0x7413('0x67'),_0x7413('0x68'),_0x4d0008);});}return respondWithRpcPromise(_0x7413('0x67'),_0x7413('0x68'),_0x4d0008);})[_0x7413('0x13')](function(_0x2d361c){_0x535e49(_0x2d361c);})[_0x7413('0x1c')](function(_0x5f4765){_0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x5f4765['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 1c98b8a..a2ae837 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 _0x7551=['save','remove','update','emit','removeListener','register','./mailAccount.events'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x7551,0x1a3));var _0x1755=function(_0x3e31e4,_0x1c6ae7){_0x3e31e4=_0x3e31e4-0x0;var _0x252fd5=_0x7551[_0x3e31e4];return _0x252fd5;};'use strict';var MailAccountEvents=require(_0x1755('0x0'));var events=[_0x1755('0x1'),_0x1755('0x2'),_0x1755('0x3')];function createListener(_0x231c83,_0x49d52d){return function(_0x279ef1){_0x49d52d[_0x1755('0x4')](_0x231c83,_0x279ef1);};}function removeListener(_0x46b0a1,_0x4d343d){return function(){MailAccountEvents[_0x1755('0x5')](_0x46b0a1,_0x4d343d);};}exports[_0x1755('0x6')]=function(_0x256e45){for(var _0x36aa5e=0x0,_0x21a4f0=events['length'];_0x36aa5e<_0x21a4f0;_0x36aa5e++){var _0x49015d=events[_0x36aa5e];var _0x44cebf=createListener('mailAccount:'+_0x49015d,_0x256e45);MailAccountEvents['on'](_0x49015d,_0x44cebf);}}; \ No newline at end of file +var _0x1c2e=['removeListener','register','length','mailAccount:','save','emit'];(function(_0x48d033,_0x31fbbe){var _0x5464ed=function(_0x4ccc1f){while(--_0x4ccc1f){_0x48d033['push'](_0x48d033['shift']());}};_0x5464ed(++_0x31fbbe);}(_0x1c2e,0xb8));var _0xe1c2=function(_0x3059f7,_0x967d6){_0x3059f7=_0x3059f7-0x0;var _0xe56aa3=_0x1c2e[_0x3059f7];return _0xe56aa3;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xe1c2('0x0'),'remove','update'];function createListener(_0x4a9deb,_0x39685f){return function(_0x51a89f){_0x39685f[_0xe1c2('0x1')](_0x4a9deb,_0x51a89f);};}function removeListener(_0x3ef607,_0x2cdeab){return function(){MailAccountEvents[_0xe1c2('0x2')](_0x3ef607,_0x2cdeab);};}exports[_0xe1c2('0x3')]=function(_0x32d4b0){for(var _0x5dac40=0x0,_0xe035ab=events[_0xe1c2('0x4')];_0x5dac40<_0xe035ab;_0x5dac40++){var _0xae7ba=events[_0x5dac40];var _0x4c6b9b=createListener(_0xe1c2('0x5')+_0xae7ba,_0x32d4b0);MailAccountEvents['on'](_0xae7ba,_0x4c6b9b);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index ba0f9b7..826b6c6 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 _0x678d=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','/:id','isAuthenticated','show'];(function(_0x46ab1c,_0x46e561){var _0x3fb929=function(_0xa5f65e){while(--_0xa5f65e){_0x46ab1c['push'](_0x46ab1c['shift']());}};_0x3fb929(++_0x46e561);}(_0x678d,0xe5));var _0xd678=function(_0x126967,_0x5fb1b4){_0x126967=_0x126967-0x0;var _0x2410ca=_0x678d[_0x126967];return _0x2410ca;};'use strict';var multer=require(_0xd678('0x0'));var util=require(_0xd678('0x1'));var path=require(_0xd678('0x2'));var timeout=require(_0xd678('0x3'));var express=require(_0xd678('0x4'));var router=express['Router']();var fs_extra=require(_0xd678('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd678('0x6'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0xd678('0x7')](_0xd678('0x8'),auth[_0xd678('0x9')](),controller[_0xd678('0xa')]);router[_0xd678('0xb')](_0xd678('0x8'),auth['isAuthenticated'](),controller[_0xd678('0xc')]);router[_0xd678('0xd')](_0xd678('0x8'),auth[_0xd678('0x9')](),controller[_0xd678('0xe')]);module[_0xd678('0xf')]=router; \ No newline at end of file +var _0x5e2b=['destroy','exports','multer','util','express','Router','fs-extra','../../config/environment','./mailApplication.controller','get','isAuthenticated','show','/:id','update','delete'];(function(_0xd679d7,_0x183013){var _0x747d4b=function(_0x10468e){while(--_0x10468e){_0xd679d7['push'](_0xd679d7['shift']());}};_0x747d4b(++_0x183013);}(_0x5e2b,0x110));var _0xb5e2=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x5e2b[_0x725b8e];return _0x43ac45;};'use strict';var multer=require(_0xb5e2('0x0'));var util=require(_0xb5e2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb5e2('0x2'));var router=express[_0xb5e2('0x3')]();var fs_extra=require(_0xb5e2('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb5e2('0x5'));var controller=require(_0xb5e2('0x6'));router[_0xb5e2('0x7')]('/:id',auth[_0xb5e2('0x8')](),controller[_0xb5e2('0x9')]);router['put'](_0xb5e2('0xa'),auth[_0xb5e2('0x8')](),controller[_0xb5e2('0xb')]);router[_0xb5e2('0xc')](_0xb5e2('0xa'),auth['isAuthenticated'](),controller[_0xb5e2('0xd')]);module[_0xb5e2('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 17a5373..36bc41a 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 _0x3107=['*,*,*,*','INTEGER','STRING','noop'];(function(_0x54ce38,_0x97bbb0){var _0x133572=function(_0x416951){while(--_0x416951){_0x54ce38['push'](_0x54ce38['shift']());}};_0x133572(++_0x97bbb0);}(_0x3107,0x115));var _0x7310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3107[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x7310('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x7310('0x1')],'allowNull':![],'defaultValue':_0x7310('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7310('0x1')]},'interval':{'type':Sequelize[_0x7310('0x1')],'defaultValue':_0x7310('0x3')}}; \ No newline at end of file +var _0x7079=['*,*,*,*','sequelize','INTEGER','TEXT','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7079,0x1a5));var _0x9707=function(_0x9eb785,_0x3b26b6){_0x9eb785=_0x9eb785-0x0;var _0x5d5201=_0x7079[_0x9eb785];return _0x5d5201;};'use strict';var Sequelize=require(_0x9707('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9707('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9707('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9707('0x3')],'defaultValue':_0x9707('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 1f236ea..0e8bf0c 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(_0x2eda7d,_0x162382){var _0x2fd21d=function(_0x3bf4d0){while(--_0x3bf4d0){_0x2eda7d['push'](_0x2eda7d['shift']());}};_0x2fd21d(++_0x162382);}(_0x70e0,0x17b));var _0x070e=function(_0x47d6a9,_0x32de4b){_0x47d6a9=_0x47d6a9-0x0;var _0x11c430=_0x70e0[_0x47d6a9];return _0x11c430;};'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 _0x54ef=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','MailApplication','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x40bbce,_0x1541b9){var _0xb24be4=function(_0x9eb45d){while(--_0x9eb45d){_0x40bbce['push'](_0x40bbce['shift']());}};_0xb24be4(++_0x1541b9);}(_0x54ef,0x112));var _0xf54e=function(_0x51e767,_0x5993f0){_0x51e767=_0x51e767-0x0;var _0x4d947c=_0x54ef[_0x51e767];return _0x4d947c;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x160160,_0x1e08d1){return function(_0x43488d){if(!_0x43488d){_0x160160[_0xf54e('0x19')](0x194);}return _0x43488d;};}function handleError(_0x33457f,_0xf6cdd7){_0xf6cdd7=_0xf6cdd7||0x1f4;return function(_0x39c0ae){logger[_0xf54e('0x28')](_0x39c0ae['stack']);if(_0x39c0ae[_0xf54e('0x29')]){delete _0x39c0ae['name'];}_0x33457f[_0xf54e('0x1a')](_0xf6cdd7)['send'](_0x39c0ae);};}exports[_0xf54e('0x2a')]=function(_0x269f47,_0x21ba00){var _0xa13cd0={'raw':!![],'where':{'id':_0x269f47[_0xf54e('0x2b')]['id']}},_0x25b643={};_0x25b643[_0xf54e('0x2c')]=_['keys'](db['MailApplication'][_0xf54e('0x2d')]);_0x25b643[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0x269f47[_0xf54e('0x2e')]);_0x25b643[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x25b643[_0xf54e('0x2c')],_0x25b643[_0xf54e('0x2e')]);_0xa13cd0[_0xf54e('0x32')]=_[_0xf54e('0x31')](_0x25b643['model'],qs['fields'](_0x269f47[_0xf54e('0x2e')][_0xf54e('0x33')]));_0xa13cd0['attributes']=_0xa13cd0[_0xf54e('0x32')][_0xf54e('0x34')]?_0xa13cd0[_0xf54e('0x32')]:_0x25b643[_0xf54e('0x2c')];if(_0x269f47['query']['includeAll']){_0xa13cd0['include']=[{'all':!![]}];}_0xa13cd0=_[_0xf54e('0x35')]({},_0xa13cd0,_0x269f47[_0xf54e('0x36')]);return db[_0xf54e('0x37')][_0xf54e('0x38')](_0xa13cd0)[_0xf54e('0x26')](handleEntityNotFound(_0x21ba00,null))[_0xf54e('0x26')](respondWithResult(_0x21ba00,null))['catch'](handleError(_0x21ba00,null));};exports['update']=function(_0x530cee,_0xc04e04){if(_0x530cee[_0xf54e('0x39')]['id']){delete _0x530cee['body']['id'];}return db['MailApplication'][_0xf54e('0x38')]({'where':{'id':_0x530cee[_0xf54e('0x2b')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0xc04e04,null))['then'](saveUpdates(_0x530cee[_0xf54e('0x39')],null))[_0xf54e('0x26')](respondWithResult(_0xc04e04,null))['catch'](handleError(_0xc04e04,null));};exports[_0xf54e('0x27')]=function(_0x6e5bdf,_0x5af03){return db[_0xf54e('0x37')][_0xf54e('0x38')]({'where':{'id':_0x6e5bdf[_0xf54e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5af03,null))['then'](removeEntity(_0x5af03,null))[_0xf54e('0x3a')](handleError(_0x5af03,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index e73429b..f3ad695 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 _0x2ba1=['bluebird','request-promise','path','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment'];(function(_0x304b67,_0x31cb39){var _0x493afb=function(_0x21dce3){while(--_0x21dce3){_0x304b67['push'](_0x304b67['shift']());}};_0x493afb(++_0x31cb39);}(_0x2ba1,0x128));var _0x12ba=function(_0x1b0f2b,_0x7c3048){_0x1b0f2b=_0x1b0f2b-0x0;var _0x50ad9d=_0x2ba1[_0x1b0f2b];return _0x50ad9d;};'use strict';var _=require(_0x12ba('0x0'));var util=require('util');var logger=require(_0x12ba('0x1'))('api');var moment=require(_0x12ba('0x2'));var BPromise=require(_0x12ba('0x3'));var rp=require(_0x12ba('0x4'));var fs=require('fs');var path=require(_0x12ba('0x5'));var rimraf=require('rimraf');var config=require(_0x12ba('0x6'));var attributes=require(_0x12ba('0x7'));module[_0x12ba('0x8')]=function(_0x22277f,_0x1aff7f){return _0x22277f[_0x12ba('0x9')](_0x12ba('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x12ba('0xb'),'collate':_0x12ba('0xc')});}; \ No newline at end of file +var _0xa305=['path','rimraf','../../config/environment','exports','MailApplication','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x171896,_0x1a6ffd){var _0x5d8636=function(_0x53d97f){while(--_0x53d97f){_0x171896['push'](_0x171896['shift']());}};_0x5d8636(++_0x1a6ffd);}(_0xa305,0x1aa));var _0x5a30=function(_0x34ca50,_0x168ad8){_0x34ca50=_0x34ca50-0x0;var _0x2a72dd=_0xa305[_0x34ca50];return _0x2a72dd;};'use strict';var _=require(_0x5a30('0x0'));var util=require(_0x5a30('0x1'));var logger=require(_0x5a30('0x2'))(_0x5a30('0x3'));var moment=require(_0x5a30('0x4'));var BPromise=require(_0x5a30('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a30('0x6'));var rimraf=require(_0x5a30('0x7'));var config=require(_0x5a30('0x8'));var attributes=require('./mailApplication.attributes');module[_0x5a30('0x9')]=function(_0x2bdf99,_0x605347){return _0x2bdf99['define'](_0x5a30('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5a30('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 23620a4..6ca6abd 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 _0x7505=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','UpdateMailApplication','MailApplication','update','options','raw','attributes','limit','lodash','util','moment','randomstring'];(function(_0x202f66,_0x3ee5aa){var _0x58448d=function(_0x45f67d){while(--_0x45f67d){_0x202f66['push'](_0x202f66['shift']());}};_0x58448d(++_0x3ee5aa);}(_0x7505,0x1cc));var _0x5750=function(_0x3f904f,_0x26ad0c){_0x3f904f=_0x3f904f-0x0;var _0x35058b=_0x7505[_0x3f904f];return _0x35058b;};'use strict';var _=require(_0x5750('0x0'));var util=require(_0x5750('0x1'));var moment=require(_0x5750('0x2'));var BPromise=require('bluebird');var rs=require(_0x5750('0x3'));var fs=require('fs');var Redis=require(_0x5750('0x4'));var db=require(_0x5750('0x5'))['db'];var utils=require(_0x5750('0x6'));var logger=require(_0x5750('0x7'))('rpc');var config=require(_0x5750('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5750('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34bfe1,_0x4ebbf4,_0x53bbaf){return new BPromise(function(_0x1301e0,_0x1a80e7){return client['request'](_0x34bfe1,_0x53bbaf)[_0x5750('0xa')](function(_0x135344){logger[_0x5750('0xb')](_0x5750('0xc'),_0x4ebbf4,_0x5750('0xd'));logger[_0x5750('0xe')](_0x5750('0xf'),_0x4ebbf4,'request\x20sent',JSON[_0x5750('0x10')](_0x135344));if(_0x135344['error']){if(_0x135344['error'][_0x5750('0x11')]===0x1f4){logger['error'](_0x5750('0xc'),_0x4ebbf4,_0x135344[_0x5750('0x12')]['message']);return _0x1a80e7(_0x135344[_0x5750('0x12')][_0x5750('0x13')]);}logger[_0x5750('0x12')]('MailApplication,\x20%s,\x20%s',_0x4ebbf4,_0x135344[_0x5750('0x12')][_0x5750('0x13')]);return _0x1301e0(_0x135344['error'][_0x5750('0x13')]);}else{logger['info'](_0x5750('0xc'),_0x4ebbf4,'request\x20sent');_0x1301e0(_0x135344[_0x5750('0x14')][_0x5750('0x13')]);}})[_0x5750('0x15')](function(_0x43edc4){logger[_0x5750('0x12')](_0x5750('0xc'),_0x4ebbf4,_0x43edc4);_0x1a80e7(_0x43edc4);});});}exports[_0x5750('0x16')]=function(_0x95a8ca){var _0x1b0e24=this;return new Promise(function(_0x265f12,_0x5d909c){return db[_0x5750('0x17')][_0x5750('0x18')](_0x95a8ca['body'],{'raw':_0x95a8ca['options']?_0x95a8ca[_0x5750('0x19')][_0x5750('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x95a8ca[_0x5750('0x19')]?_0x95a8ca['options']['where']||null:null,'attributes':_0x95a8ca[_0x5750('0x19')]?_0x95a8ca[_0x5750('0x19')][_0x5750('0x1b')]||null:null,'limit':_0x95a8ca['options']?_0x95a8ca[_0x5750('0x19')][_0x5750('0x1c')]||null:null})[_0x5750('0xa')](function(_0x63fd5f){logger[_0x5750('0xb')]('UpdateMailApplication',_0x95a8ca);logger[_0x5750('0xe')]('UpdateMailApplication',_0x95a8ca,JSON[_0x5750('0x10')](_0x63fd5f));_0x265f12(_0x63fd5f);})[_0x5750('0x15')](function(_0x4f6a8b){logger[_0x5750('0x12')](_0x5750('0x16'),_0x4f6a8b['message'],_0x95a8ca);_0x5d909c(_0x1b0e24[_0x5750('0x12')](0x1f4,_0x4f6a8b[_0x5750('0x13')]));});});}; \ No newline at end of file +var _0x3ce8=['limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw'];(function(_0x15a569,_0x4ad6a1){var _0x536d3b=function(_0x1228fd){while(--_0x1228fd){_0x15a569['push'](_0x15a569['shift']());}};_0x536d3b(++_0x4ad6a1);}(_0x3ce8,0xdb));var _0x83ce=function(_0x5179c5,_0x47c3e1){_0x5179c5=_0x5179c5-0x0;var _0x25436c=_0x3ce8[_0x5179c5];return _0x25436c;};'use strict';var _=require(_0x83ce('0x0'));var util=require(_0x83ce('0x1'));var moment=require(_0x83ce('0x2'));var BPromise=require(_0x83ce('0x3'));var rs=require(_0x83ce('0x4'));var fs=require('fs');var Redis=require(_0x83ce('0x5'));var db=require(_0x83ce('0x6'))['db'];var utils=require(_0x83ce('0x7'));var logger=require(_0x83ce('0x8'))(_0x83ce('0x9'));var config=require('../../config/environment');var jayson=require(_0x83ce('0xa'));var client=jayson[_0x83ce('0xb')][_0x83ce('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd0a97d,_0x146418,_0x50a91d){return new BPromise(function(_0x20ee8a,_0x39ded9){return client[_0x83ce('0xd')](_0xd0a97d,_0x50a91d)['then'](function(_0x275af4){logger['info'](_0x83ce('0xe'),_0x146418,'request\x20sent');logger['debug'](_0x83ce('0xf'),_0x146418,_0x83ce('0x10'),JSON[_0x83ce('0x11')](_0x275af4));if(_0x275af4[_0x83ce('0x12')]){if(_0x275af4[_0x83ce('0x12')][_0x83ce('0x13')]===0x1f4){logger[_0x83ce('0x12')](_0x83ce('0xe'),_0x146418,_0x275af4[_0x83ce('0x12')][_0x83ce('0x14')]);return _0x39ded9(_0x275af4[_0x83ce('0x12')]['message']);}logger[_0x83ce('0x12')]('MailApplication,\x20%s,\x20%s',_0x146418,_0x275af4[_0x83ce('0x12')][_0x83ce('0x14')]);return _0x20ee8a(_0x275af4['error'][_0x83ce('0x14')]);}else{logger['info'](_0x83ce('0xe'),_0x146418,_0x83ce('0x10'));_0x20ee8a(_0x275af4[_0x83ce('0x15')][_0x83ce('0x14')]);}})[_0x83ce('0x16')](function(_0x4b9460){logger['error'](_0x83ce('0xe'),_0x146418,_0x4b9460);_0x39ded9(_0x4b9460);});});}exports[_0x83ce('0x17')]=function(_0x23fd56){var _0x3bc675=this;return new Promise(function(_0x3a629a,_0x36def0){return db[_0x83ce('0x18')][_0x83ce('0x19')](_0x23fd56[_0x83ce('0x1a')],{'raw':_0x23fd56[_0x83ce('0x1b')]?_0x23fd56[_0x83ce('0x1b')][_0x83ce('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23fd56['options']?_0x23fd56[_0x83ce('0x1b')]['where']||null:null,'attributes':_0x23fd56[_0x83ce('0x1b')]?_0x23fd56[_0x83ce('0x1b')]['attributes']||null:null,'limit':_0x23fd56['options']?_0x23fd56[_0x83ce('0x1b')][_0x83ce('0x1d')]||null:null})[_0x83ce('0x1e')](function(_0x2b0749){logger['info']('UpdateMailApplication',_0x23fd56);logger['debug'](_0x83ce('0x17'),_0x23fd56,JSON['stringify'](_0x2b0749));_0x3a629a(_0x2b0749);})[_0x83ce('0x16')](function(_0x864012){logger['error'](_0x83ce('0x17'),_0x864012[_0x83ce('0x14')],_0x23fd56);_0x36def0(_0x3bc675[_0x83ce('0x12')](0x1f4,_0x864012['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 8b4da8f..0b1b1dd 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 _0x05bf=['/:id','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','tracked','mailinteraction:addtags','mailinteraction:update','update','delete','mail','mailinteraction:destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x1275e,_0x2191d4){var _0x5f345f=function(_0x3245b1){while(--_0x3245b1){_0x1275e['push'](_0x1275e['shift']());}};_0x5f345f(++_0x2191d4);}(_0x05bf,0xe0));var _0xf05b=function(_0x580127,_0x370644){_0x580127=_0x580127-0x0;var _0x1384d2=_0x05bf[_0x580127];return _0x1384d2;};'use strict';var express=require(_0xf05b('0x0'));var router=express[_0xf05b('0x1')]();var auth=require(_0xf05b('0x2'));var interaction=require(_0xf05b('0x3'));var controller=require(_0xf05b('0x4'));router['get']('/',auth[_0xf05b('0x5')](),controller[_0xf05b('0x6')]);router[_0xf05b('0x7')](_0xf05b('0x8'),auth['isAuthenticated'](),controller[_0xf05b('0x9')]);router[_0xf05b('0x7')](_0xf05b('0xa'),auth[_0xf05b('0x5')](),controller['show']);router['get'](_0xf05b('0xb'),auth[_0xf05b('0x5')](),controller['getMessages']);router['get'](_0xf05b('0xc'),auth['isAuthenticated'](),controller[_0xf05b('0xd')]);router[_0xf05b('0xe')]('/',auth[_0xf05b('0x5')](),controller['create']);router['post'](_0xf05b('0xb'),auth[_0xf05b('0x5')](),controller[_0xf05b('0xf')]);router[_0xf05b('0xe')](_0xf05b('0x10'),auth[_0xf05b('0x5')](),interaction[_0xf05b('0x11')]('mail',_0xf05b('0x12')),controller['addTags']);router['put'](_0xf05b('0xa'),auth[_0xf05b('0x5')](),interaction[_0xf05b('0x11')]('mail',_0xf05b('0x13')),controller[_0xf05b('0x14')]);router[_0xf05b('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0xf05b('0x11')](_0xf05b('0x16'),_0xf05b('0x17')),controller['destroy']);router[_0xf05b('0x15')](_0xf05b('0x10'),auth[_0xf05b('0x5')](),controller[_0xf05b('0x18')]);module[_0xf05b('0x19')]=router; \ No newline at end of file +var _0x61bb=['/describe','describe','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index'];(function(_0x515685,_0x4724ea){var _0x5b2d62=function(_0x3f53ea){while(--_0x3f53ea){_0x515685['push'](_0x515685['shift']());}};_0x5b2d62(++_0x4724ea);}(_0x61bb,0x89));var _0xb61b=function(_0x3f6d5b,_0x4ab947){_0x3f6d5b=_0x3f6d5b-0x0;var _0x5aceed=_0x61bb[_0x3f6d5b];return _0x5aceed;};'use strict';var express=require(_0xb61b('0x0'));var router=express[_0xb61b('0x1')]();var auth=require(_0xb61b('0x2'));var interaction=require(_0xb61b('0x3'));var controller=require(_0xb61b('0x4'));router[_0xb61b('0x5')]('/',auth[_0xb61b('0x6')](),controller[_0xb61b('0x7')]);router[_0xb61b('0x5')](_0xb61b('0x8'),auth['isAuthenticated'](),controller[_0xb61b('0x9')]);router[_0xb61b('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xb61b('0xa')]);router[_0xb61b('0x5')](_0xb61b('0xb'),auth[_0xb61b('0x6')](),controller[_0xb61b('0xc')]);router['get']('/:id/download',auth[_0xb61b('0x6')](),controller[_0xb61b('0xd')]);router['post']('/',auth[_0xb61b('0x6')](),controller['create']);router[_0xb61b('0xe')](_0xb61b('0xb'),auth[_0xb61b('0x6')](),controller[_0xb61b('0xf')]);router['post'](_0xb61b('0x10'),auth['isAuthenticated'](),interaction[_0xb61b('0x11')](_0xb61b('0x12'),_0xb61b('0x13')),controller[_0xb61b('0x14')]);router[_0xb61b('0x15')]('/:id',auth[_0xb61b('0x6')](),interaction[_0xb61b('0x11')]('mail',_0xb61b('0x16')),controller[_0xb61b('0x17')]);router[_0xb61b('0x18')]('/:id',auth[_0xb61b('0x6')](),interaction[_0xb61b('0x11')]('mail',_0xb61b('0x19')),controller[_0xb61b('0x1a')]);router[_0xb61b('0x18')]('/:id/tags',auth[_0xb61b('0x6')](),controller[_0xb61b('0x1b')]);module[_0xb61b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 9305036..18810b3 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 _0xe105=['STRING','TEXT','DATE','ENUM','out','sequelize'];(function(_0x34ed72,_0x57c63f){var _0x3312c5=function(_0x44c5c5){while(--_0x44c5c5){_0x34ed72['push'](_0x34ed72['shift']());}};_0x3312c5(++_0x57c63f);}(_0xe105,0xef));var _0x5e10=function(_0x2f4317,_0x2be0f8){_0x2f4317=_0x2f4317-0x0;var _0x4aad6a=_0xe105[_0x2f4317];return _0x4aad6a;};'use strict';var Sequelize=require(_0x5e10('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x5e10('0x1')]},'secondDisposition':{'type':Sequelize[_0x5e10('0x1')]},'thirdDisposition':{'type':Sequelize[_0x5e10('0x1')]},'note':{'type':Sequelize[_0x5e10('0x1')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x5e10('0x1')]},'cc':{'type':Sequelize[_0x5e10('0x2')]('long')},'subject':{'type':Sequelize[_0x5e10('0x2')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x5e10('0x1')](0x3c)},'substatusAt':{'type':Sequelize[_0x5e10('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5e10('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5e10('0x4')]('in',_0x5e10('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1a14=['DATE','STRING','TEXT','long','ENUM','out','sequelize','iconv','exports','BOOLEAN'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x1a14,0xce));var _0x41a1=function(_0x359a87,_0x457515){_0x359a87=_0x359a87-0x0;var _0x4c5fa9=_0x1a14[_0x359a87];return _0x4c5fa9;};'use strict';var Sequelize=require(_0x41a1('0x0'));var iconv=require(_0x41a1('0x1'));module[_0x41a1('0x2')]={'closed':{'type':Sequelize[_0x41a1('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x41a1('0x4')]},'disposition':{'type':Sequelize[_0x41a1('0x5')]},'secondDisposition':{'type':Sequelize[_0x41a1('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x41a1('0x5')]},'inReplyTo':{'type':Sequelize[_0x41a1('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x41a1('0x6')](_0x41a1('0x7'))},'subject':{'type':Sequelize[_0x41a1('0x6')]()},'attach':{'type':Sequelize[_0x41a1('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x41a1('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x41a1('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x41a1('0x8')]('in',_0x41a1('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x41a1('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x41a1('0x8')]('in',_0x41a1('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x41a1('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 53721bc..cad8cc8 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 _0x1e14=['build','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','moment','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','status','offset','undefined','limit','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','findAll','mail','query','user','catch','show','model','keys','intersection','attributes','length','includeAll','find','create','body','params','describe','addMessage','ids','getMessages','findOne','filters','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','MailMessage','count','include','inlineCss','true','rows','addTags','omit','spread','Tag','color','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','from','subject','createdAt','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','basename','existsSync','push','readFileSync'];(function(_0xa23c8b,_0x379417){var _0xf8135e=function(_0x59d167){while(--_0x59d167){_0xa23c8b['push'](_0xa23c8b['shift']());}};_0xf8135e(++_0x379417);}(_0x1e14,0xef));var _0x41e1=function(_0x1138e4,_0x3b12b7){_0x1138e4=_0x1138e4-0x0;var _0x2aaa6c=_0x1e14[_0x1138e4];return _0x2aaa6c;};'use strict';var emlformat=require(_0x41e1('0x0'));var rimraf=require(_0x41e1('0x1'));var zipdir=require(_0x41e1('0x2'));var moment=require(_0x41e1('0x3'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x41e1('0x4'));var juice=require('juice');var Redis=require(_0x41e1('0x5'));var interaction=require(_0x41e1('0x6'));var qs=require(_0x41e1('0x7'));var logger=require(_0x41e1('0x8'))(_0x41e1('0x9'));var config=require(_0x41e1('0xa'));var db=require(_0x41e1('0xb'))['db'];var htmlEntities=require(_0x41e1('0xc'));config[_0x41e1('0xd')]=_[_0x41e1('0xe')](config[_0x41e1('0xd')],{'host':_0x41e1('0xf'),'port':0x18eb});var socket=require(_0x41e1('0x10'))(new Redis(config['redis']));require(_0x41e1('0x11'))[_0x41e1('0x12')](socket);function respondWithStatusCode(_0x33db39,_0xaefd72){_0xaefd72=_0xaefd72||0xcc;return function(_0x15a684){if(_0x15a684){return _0x33db39['sendStatus'](_0xaefd72);}return _0x33db39['status'](_0xaefd72)['end']();};}function respondWithResult(_0x532f95,_0x79b098){_0x79b098=_0x79b098||0xc8;return function(_0x58ad33){if(_0x58ad33){return _0x532f95[_0x41e1('0x13')](_0x79b098)['json'](_0x58ad33);}};}function respondWithFilteredResult(_0x31aad2,_0x461829){return function(_0x581023){if(_0x581023){var _0x3f7fb3=typeof _0x461829[_0x41e1('0x14')]===_0x41e1('0x15')&&typeof _0x461829['limit']==='undefined';var _0x104b36=_0x581023['count'];var _0x2aa097=_0x3f7fb3?0x0:_0x461829[_0x41e1('0x14')];var _0x4a52e2=_0x3f7fb3?_0x581023['count']:_0x461829[_0x41e1('0x14')]+_0x461829[_0x41e1('0x16')];var _0x3c4297;if(_0x4a52e2>=_0x104b36){_0x4a52e2=_0x104b36;_0x3c4297=0xc8;}else{_0x3c4297=0xce;}_0x31aad2[_0x41e1('0x13')](_0x3c4297);return _0x31aad2[_0x41e1('0x17')](_0x41e1('0x18'),_0x2aa097+'-'+_0x4a52e2+'/'+_0x104b36)['json'](_0x581023);}return null;};}function saveUpdates(_0x47fa57){return function(_0x9da56){if(_0x9da56){return _0x9da56[_0x41e1('0x19')](_0x47fa57)[_0x41e1('0x1a')](function(_0xd97378){return _0xd97378;});}return null;};}function removeEntity(_0x3774e9){return function(_0x4a65ff){if(_0x4a65ff){return _0x4a65ff[_0x41e1('0x1b')]()[_0x41e1('0x1a')](function(){_0x3774e9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb3fc9){return function(_0x121d62){if(!_0x121d62){_0xb3fc9[_0x41e1('0x1c')](0x194);}return _0x121d62;};}function handleError(_0x2025a1,_0x451bd7){_0x451bd7=_0x451bd7||0x1f4;return function(_0xf96cf8){logger[_0x41e1('0x1d')](_0xf96cf8[_0x41e1('0x1e')]);if(_0xf96cf8['name']){delete _0xf96cf8[_0x41e1('0x1f')];}_0x2025a1[_0x41e1('0x13')](_0x451bd7)[_0x41e1('0x20')](_0xf96cf8);};}exports[_0x41e1('0x21')]=function(_0x449143,_0x1aa113){var _0x4fa4af={};var _0x30942a=_[_0x41e1('0x22')](db[_0x41e1('0x23')][_0x41e1('0x24')],function(_0x275a22){return{'name':_0x275a22[_0x41e1('0x25')],'type':_0x275a22[_0x41e1('0x26')][_0x41e1('0x27')]};});_0x4fa4af=qs['getOptions'](_0x30942a,_0x449143);return interaction[_0x41e1('0x28')](_0x41e1('0x29'),_0x449143[_0x41e1('0x2a')],_0x449143[_0x41e1('0x2b')],_0x4fa4af,_0x30942a)[_0x41e1('0x1a')](respondWithFilteredResult(_0x1aa113,_0x4fa4af))[_0x41e1('0x2c')](handleError(_0x1aa113,null));};exports[_0x41e1('0x2d')]=function(_0x438d20,_0x1b7b1b){var _0x12fef2={'raw':![],'where':{'id':_0x438d20['params']['id']}},_0x4e000a={};_0x4e000a[_0x41e1('0x2e')]=_[_0x41e1('0x2f')](db[_0x41e1('0x23')][_0x41e1('0x24')]);_0x4e000a['query']=_['keys'](_0x438d20['query']);_0x4e000a['filters']=_[_0x41e1('0x30')](_0x4e000a['model'],_0x4e000a['query']);_0x12fef2[_0x41e1('0x31')]=_[_0x41e1('0x30')](_0x4e000a[_0x41e1('0x2e')],qs['fields'](_0x438d20[_0x41e1('0x2a')]['fields']));_0x12fef2[_0x41e1('0x31')]=_0x12fef2[_0x41e1('0x31')][_0x41e1('0x32')]?_0x12fef2[_0x41e1('0x31')]:_0x4e000a[_0x41e1('0x2e')];if(_0x438d20['query'][_0x41e1('0x33')]){_0x12fef2['include']=[{'all':!![]}];}_0x12fef2=_['merge']({},_0x12fef2,_0x438d20['options']);return db[_0x41e1('0x23')][_0x41e1('0x34')](_0x12fef2)['then'](handleEntityNotFound(_0x1b7b1b,null))['then'](respondWithResult(_0x1b7b1b,null))[_0x41e1('0x2c')](handleError(_0x1b7b1b,null));};exports['create']=function(_0x6e0fc2,_0x4d6163){return db[_0x41e1('0x23')][_0x41e1('0x35')](_0x6e0fc2[_0x41e1('0x36')],{})[_0x41e1('0x1a')](respondWithResult(_0x4d6163,0xc9))[_0x41e1('0x2c')](handleError(_0x4d6163,null));};exports['update']=function(_0x40e36e,_0x272c66){if(_0x40e36e[_0x41e1('0x36')]['id']){delete _0x40e36e[_0x41e1('0x36')]['id'];}return db[_0x41e1('0x23')][_0x41e1('0x34')]({'where':{'id':_0x40e36e['params']['id']}})[_0x41e1('0x1a')](handleEntityNotFound(_0x272c66,null))['then'](saveUpdates(_0x40e36e[_0x41e1('0x36')],null))['then'](respondWithResult(_0x272c66,null))[_0x41e1('0x2c')](handleError(_0x272c66,null));};exports[_0x41e1('0x1b')]=function(_0x16a9b1,_0x1df96e){return db[_0x41e1('0x23')][_0x41e1('0x34')]({'where':{'id':_0x16a9b1[_0x41e1('0x37')]['id']}})[_0x41e1('0x1a')](handleEntityNotFound(_0x1df96e,null))[_0x41e1('0x1a')](removeEntity(_0x1df96e,null))[_0x41e1('0x2c')](handleError(_0x1df96e,null));};exports['describe']=function(_0x55b675,_0x207e36){return db[_0x41e1('0x23')][_0x41e1('0x38')]()[_0x41e1('0x1a')](respondWithResult(_0x207e36,null))[_0x41e1('0x2c')](handleError(_0x207e36,null));};exports[_0x41e1('0x39')]=function(_0x2b2090,_0x14b1d8){return db['MailMessage']['find']({'where':{'id':_0x2b2090[_0x41e1('0x37')]['id']}})['then'](handleEntityNotFound(_0x14b1d8,null))['then'](function(_0x4e102d){if(_0x4e102d){return _0x4e102d[_0x41e1('0x39')](_0x2b2090['body'][_0x41e1('0x3a')],_['omit'](_0x2b2090[_0x41e1('0x36')],['ids','id'])||{});}})['then'](respondWithResult(_0x14b1d8,null))[_0x41e1('0x2c')](handleError(_0x14b1d8,null));};exports[_0x41e1('0x3b')]=function(_0x406865,_0x1463b2){var _0x529a9d={'raw':![],'where':{}};var _0x4cf11a={};var _0x13364e={'count':0x0,'rows':[]};return db['MailInteraction'][_0x41e1('0x3c')]({'where':{'id':_0x406865[_0x41e1('0x37')]['id']}})[_0x41e1('0x1a')](handleEntityNotFound(_0x1463b2,null))[_0x41e1('0x1a')](function(_0x3ef3e7){if(_0x3ef3e7){_0x4cf11a['model']=_['keys'](db['MailMessage'][_0x41e1('0x24')]);_0x4cf11a[_0x41e1('0x2a')]=_[_0x41e1('0x2f')](_0x406865['query']);_0x4cf11a[_0x41e1('0x3d')]=_['intersection'](_0x4cf11a[_0x41e1('0x2e')],_0x4cf11a['query']);_0x529a9d[_0x41e1('0x31')]=_[_0x41e1('0x30')](_0x4cf11a[_0x41e1('0x2e')],qs[_0x41e1('0x3e')](_0x406865[_0x41e1('0x2a')]['fields']));_0x529a9d['attributes']=_0x529a9d['attributes'][_0x41e1('0x32')]?_0x529a9d[_0x41e1('0x31')]:_0x4cf11a[_0x41e1('0x2e')];if(!_0x406865[_0x41e1('0x2a')][_0x41e1('0x3f')](_0x41e1('0x40'))){_0x529a9d[_0x41e1('0x16')]=qs[_0x41e1('0x16')](_0x406865[_0x41e1('0x2a')]['limit']);_0x529a9d['offset']=qs['offset'](_0x406865['query'][_0x41e1('0x14')]);}_0x529a9d['order']=qs[_0x41e1('0x41')](_0x406865[_0x41e1('0x2a')]['sort']);_0x529a9d[_0x41e1('0x42')]=qs[_0x41e1('0x3d')](_[_0x41e1('0x43')](_0x406865['query'],_0x4cf11a[_0x41e1('0x3d')]));_0x529a9d[_0x41e1('0x42')]['MailInteractionId']=_0x3ef3e7['id'];if(_0x406865[_0x41e1('0x2a')]['filter']){_0x529a9d['where']=_[_0x41e1('0x44')](_0x529a9d[_0x41e1('0x42')],{'$or':_[_0x41e1('0x22')](_0x529a9d[_0x41e1('0x31')],function(_0x534931){var _0x5cda91={};_0x5cda91[_0x534931]={'$like':'%'+_0x406865[_0x41e1('0x2a')][_0x41e1('0x45')]+'%'};return _0x5cda91;})});}if(_0x406865[_0x41e1('0x2a')][_0x41e1('0x46')]){var _0x4c1d79=_0x406865['query'][_0x41e1('0x46')][_0x41e1('0x47')](',');var _0x564a3b={};_0x564a3b[_0x4c1d79[0x0]]={'$gte':moment(_0x4c1d79[0x1])[_0x41e1('0x48')](_0x41e1('0x49'))};_0x529a9d[_0x41e1('0x42')]=_['merge'](_0x529a9d[_0x41e1('0x42')],_0x564a3b);}_0x529a9d=_[_0x41e1('0x44')]({},_0x529a9d,_0x406865[_0x41e1('0x4a')]);return db[_0x41e1('0x4b')][_0x41e1('0x4c')]({'where':_0x529a9d[_0x41e1('0x42')]})[_0x41e1('0x1a')](function(_0x2a0356){_0x13364e[_0x41e1('0x4c')]=_0x2a0356;if(_0x406865[_0x41e1('0x2a')][_0x41e1('0x33')]){_0x529a9d[_0x41e1('0x4d')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x529a9d);})[_0x41e1('0x1a')](function(_0x1a2dd1){if(_0x406865[_0x41e1('0x2a')][_0x41e1('0x4e')]===_0x41e1('0x4f')){for(var _0x143512=0x0;_0x143512<_0x1a2dd1['length'];_0x143512++){_0x1a2dd1[_0x143512][_0x41e1('0x36')]=juice(_0x1a2dd1[_0x143512][_0x41e1('0x36')]);}}_0x13364e[_0x41e1('0x50')]=_0x1a2dd1;return _0x13364e;});}})[_0x41e1('0x1a')](respondWithFilteredResult(_0x1463b2,_0x529a9d))['catch'](handleError(_0x1463b2,null));};exports[_0x41e1('0x51')]=function(_0x5b91bb,_0x3e655a){return db[_0x41e1('0x23')][_0x41e1('0x34')]({'where':{'id':_0x5b91bb[_0x41e1('0x37')]['id']}})[_0x41e1('0x1a')](handleEntityNotFound(_0x3e655a,null))[_0x41e1('0x1a')](function(_0x821718){if(_0x821718){return _0x821718['setTags'](_0x5b91bb[_0x41e1('0x36')][_0x41e1('0x3a')],_[_0x41e1('0x52')](_0x5b91bb[_0x41e1('0x36')],['ids','id'])||{})[_0x41e1('0x53')](function(){return db[_0x41e1('0x54')][_0x41e1('0x28')]({'attributes':['id',_0x41e1('0x1f'),_0x41e1('0x55')],'where':{'id':_0x5b91bb['body']['ids']}});})[_0x41e1('0x1a')](function(_0x572bc5){socket['emit'](_0x41e1('0x56'),{'id':Number(_0x5b91bb[_0x41e1('0x37')]['id']),'tags':_0x572bc5||[]});return{'id':Number(_0x5b91bb['params']['id']),'tags':_0x572bc5||[]};});}})['then'](respondWithResult(_0x3e655a,null))[_0x41e1('0x2c')](handleError(_0x3e655a,null));};exports['removeTags']=function(_0x495aaf,_0x3b0661){return db[_0x41e1('0x23')][_0x41e1('0x34')]({'where':{'id':_0x495aaf['params']['id']}})[_0x41e1('0x1a')](handleEntityNotFound(_0x3b0661,null))[_0x41e1('0x1a')](function(_0xc570d7){if(_0xc570d7){return _0xc570d7[_0x41e1('0x57')](_0x495aaf['query'][_0x41e1('0x3a')]);}})[_0x41e1('0x1a')](respondWithStatusCode(_0x3b0661,null))[_0x41e1('0x2c')](handleError(_0x3b0661,null));};exports[_0x41e1('0x58')]=function(_0x527e3b,_0x2a1c41){var _0x161390=moment()[_0x41e1('0x59')]()[_0x41e1('0x5a')]();var _0x3650fc=path[_0x41e1('0x5b')](config[_0x41e1('0x5c')],_0x41e1('0x5d'),_0x41e1('0x5e'),_0x41e1('0x5f'));var _0x443740=path[_0x41e1('0x5b')](config['root'],_0x41e1('0x5d'),'files',_0x41e1('0x60'));var _0x24067b=path[_0x41e1('0x5b')](_0x3650fc,_0x161390);var _0xe26aa9=util['format'](_0x41e1('0x61'),_0x527e3b['params']['id'],_0x161390);var _0x534a58=path[_0x41e1('0x5b')](_0x3650fc,_0xe26aa9);var _0xe00b53=[];if(_0x527e3b[_0x41e1('0x2a')][_0x41e1('0x60')]){_0xe00b53['push']({'model':db[_0x41e1('0x62')],'as':_0x41e1('0x63'),'raw':!![]});}var _0xfd551f=[{'model':db['MailMessage'],'as':_0x41e1('0x64'),'attributes':['id',_0x41e1('0x36'),_0x41e1('0x65'),'to','cc','bcc',_0x41e1('0x66'),_0x41e1('0x67')],'where':{'secret':![]},'order':qs[_0x41e1('0x41')]('id'),'include':_0xe00b53}];return db['MailInteraction']['find']({'where':{'id':_0x527e3b[_0x41e1('0x37')]['id']},'include':_0xfd551f})['then'](handleEntityNotFound(_0x2a1c41,null))[_0x41e1('0x1a')](function(_0x1dce6a){if(_0x1dce6a&&_0x1dce6a[_0x41e1('0x64')]){var _0xab6569=_0x1dce6a[_0x41e1('0x68')]({'plain':!![]});fs[_0x41e1('0x69')](_0x24067b);return BPromise[_0x41e1('0x6a')](_0xab6569[_0x41e1('0x64')],function(_0xb8510c,_0x27333f){var _0x2faa14={'from':_0xb8510c[_0x41e1('0x65')],'to':_0xb8510c['to'],'subject':_0xb8510c[_0x41e1('0x66')],'html':htmlEntities[_0x41e1('0x6b')](_0xb8510c[_0x41e1('0x36')]),'headers':{'Date':moment(_0xb8510c['createdAt'])[_0x41e1('0x48')](_0x41e1('0x6c'))},'attachments':[]};if(_0xb8510c['cc']){_0x2faa14[_0x41e1('0x6d')]['Cc']=_0xb8510c['cc'];}if(_0xb8510c[_0x41e1('0x6e')]){_0x2faa14[_0x41e1('0x6d')]['Bcc']=_0xb8510c[_0x41e1('0x6e')];}return new BPromise(function(_0x5cb1a7,_0x311c58){if(_0xb8510c[_0x41e1('0x63')]){for(var _0x46061e=0x0;_0x46061e<_0xb8510c[_0x41e1('0x63')]['length'];_0x46061e++){var _0x55ec41=_0xb8510c[_0x41e1('0x63')][_0x46061e];var _0x48de50=path['join'](_0x443740,_0x55ec41[_0x41e1('0x6f')]);if(fs[_0x41e1('0x70')](_0x48de50)){_0x2faa14[_0x41e1('0x60')][_0x41e1('0x71')]({'name':_0x55ec41[_0x41e1('0x1f')],'contentType':_0x55ec41[_0x41e1('0x26')],'data':fs[_0x41e1('0x72')](_0x48de50)});}}}emlformat[_0x41e1('0x73')](_0x2faa14,function(_0x5b83d8,_0x6bc9c1){if(_0x5b83d8)return _0x311c58(_0x5b83d8);fs[_0x41e1('0x74')](path[_0x41e1('0x5b')](_0x24067b,util[_0x41e1('0x48')](_0x41e1('0x75'),_0x27333f)),_0x6bc9c1);return _0x5cb1a7(_0x6bc9c1);});});})[_0x41e1('0x1a')](function(){return new BPromise(function(_0x593258,_0x322c14){zipdir(_0x24067b,{'saveTo':_0x534a58},function(_0x435c2f,_0x655426){if(_0x435c2f)return _0x322c14(_0x435c2f);return _0x593258(_0x655426);});})[_0x41e1('0x1a')](function(){return new BPromise(function(_0x3f16aa,_0x42ccd6){rimraf(_0x24067b,function(_0x889eee){if(_0x889eee)_0x42ccd6(_0x889eee);return _0x3f16aa();});});})[_0x41e1('0x1a')](function(){return _0x2a1c41[_0x41e1('0x58')](_0x534a58,_0xe26aa9,function(_0x19e0e6){if(!_0x19e0e6)fs['unlinkSync'](_0x534a58);});});});}else{return _0x2a1c41[_0x41e1('0x1c')](0xc8);}})[_0x41e1('0x2c')](handleError(_0x2a1c41,null));}; \ No newline at end of file +var _0xe5f7=['rows','addTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','unix','toString','join','server','files','tmp','root','attachments','format','transcript-%d-%s.zip','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','push','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','path','lodash','juice','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','stack','name','map','MailInteraction','rawAttributes','key','getOptions','findAll','mail','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','describe','addMessage','omit','ids','getMessages','findOne','MailMessage','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','length'];(function(_0x5d8792,_0x4f5438){var _0x986d0e=function(_0x1d4b83){while(--_0x1d4b83){_0x5d8792['push'](_0x5d8792['shift']());}};_0x986d0e(++_0x4f5438);}(_0xe5f7,0x178));var _0x7e5f=function(_0x1dddce,_0x3182e2){_0x1dddce=_0x1dddce-0x0;var _0x5ccb42=_0xe5f7[_0x1dddce];return _0x5ccb42;};'use strict';var emlformat=require(_0x7e5f('0x0'));var rimraf=require(_0x7e5f('0x1'));var zipdir=require(_0x7e5f('0x2'));var moment=require(_0x7e5f('0x3'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x7e5f('0x4'));var fs=require('fs');var _=require(_0x7e5f('0x5'));var juice=require(_0x7e5f('0x6'));var Redis=require('ioredis');var interaction=require(_0x7e5f('0x7'));var qs=require(_0x7e5f('0x8'));var logger=require('../../config/logger')(_0x7e5f('0x9'));var config=require(_0x7e5f('0xa'));var db=require(_0x7e5f('0xb'))['db'];var htmlEntities=require(_0x7e5f('0xc'));config[_0x7e5f('0xd')]=_[_0x7e5f('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7e5f('0xf'))(new Redis(config[_0x7e5f('0xd')]));require(_0x7e5f('0x10'))[_0x7e5f('0x11')](socket);function respondWithStatusCode(_0x3844af,_0x218e50){_0x218e50=_0x218e50||0xcc;return function(_0x182035){if(_0x182035){return _0x3844af[_0x7e5f('0x12')](_0x218e50);}return _0x3844af[_0x7e5f('0x13')](_0x218e50)[_0x7e5f('0x14')]();};}function respondWithResult(_0x5bc453,_0x3dc3c8){_0x3dc3c8=_0x3dc3c8||0xc8;return function(_0x505fbb){if(_0x505fbb){return _0x5bc453[_0x7e5f('0x13')](_0x3dc3c8)[_0x7e5f('0x15')](_0x505fbb);}};}function respondWithFilteredResult(_0x14e2fe,_0x449e60){return function(_0x23e241){if(_0x23e241){var _0x282866=typeof _0x449e60[_0x7e5f('0x16')]===_0x7e5f('0x17')&&typeof _0x449e60[_0x7e5f('0x18')]===_0x7e5f('0x17');var _0x5ba25b=_0x23e241[_0x7e5f('0x19')];var _0x39b644=_0x282866?0x0:_0x449e60[_0x7e5f('0x16')];var _0x62cdf5=_0x282866?_0x23e241['count']:_0x449e60['offset']+_0x449e60['limit'];var _0x44e284;if(_0x62cdf5>=_0x5ba25b){_0x62cdf5=_0x5ba25b;_0x44e284=0xc8;}else{_0x44e284=0xce;}_0x14e2fe[_0x7e5f('0x13')](_0x44e284);return _0x14e2fe['set'](_0x7e5f('0x1a'),_0x39b644+'-'+_0x62cdf5+'/'+_0x5ba25b)[_0x7e5f('0x15')](_0x23e241);}return null;};}function saveUpdates(_0x30802b){return function(_0xd97c29){if(_0xd97c29){return _0xd97c29[_0x7e5f('0x1b')](_0x30802b)[_0x7e5f('0x1c')](function(_0x2e2385){return _0x2e2385;});}return null;};}function removeEntity(_0x5481c7){return function(_0x38bd30){if(_0x38bd30){return _0x38bd30['destroy']()[_0x7e5f('0x1c')](function(){_0x5481c7[_0x7e5f('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x892c6f){return function(_0x4c81d5){if(!_0x4c81d5){_0x892c6f['sendStatus'](0x194);}return _0x4c81d5;};}function handleError(_0x273c9b,_0x5b4aaa){_0x5b4aaa=_0x5b4aaa||0x1f4;return function(_0x196d5b){logger['error'](_0x196d5b[_0x7e5f('0x1d')]);if(_0x196d5b[_0x7e5f('0x1e')]){delete _0x196d5b[_0x7e5f('0x1e')];}_0x273c9b['status'](_0x5b4aaa)['send'](_0x196d5b);};}exports['index']=function(_0x33b4f6,_0x3e7191){var _0x372eb9={};var _0x2f250d=_[_0x7e5f('0x1f')](db[_0x7e5f('0x20')][_0x7e5f('0x21')],function(_0x39522f){return{'name':_0x39522f['fieldName'],'type':_0x39522f['type'][_0x7e5f('0x22')]};});_0x372eb9=qs[_0x7e5f('0x23')](_0x2f250d,_0x33b4f6);return interaction[_0x7e5f('0x24')](_0x7e5f('0x25'),_0x33b4f6[_0x7e5f('0x26')],_0x33b4f6[_0x7e5f('0x27')],_0x372eb9,_0x2f250d)[_0x7e5f('0x1c')](respondWithFilteredResult(_0x3e7191,_0x372eb9))[_0x7e5f('0x28')](handleError(_0x3e7191,null));};exports[_0x7e5f('0x29')]=function(_0x3b73c6,_0x142134){var _0x69cd03={'raw':![],'where':{'id':_0x3b73c6[_0x7e5f('0x2a')]['id']}},_0x453f0f={};_0x453f0f[_0x7e5f('0x2b')]=_[_0x7e5f('0x2c')](db['MailInteraction'][_0x7e5f('0x21')]);_0x453f0f[_0x7e5f('0x26')]=_[_0x7e5f('0x2c')](_0x3b73c6[_0x7e5f('0x26')]);_0x453f0f[_0x7e5f('0x2d')]=_[_0x7e5f('0x2e')](_0x453f0f['model'],_0x453f0f['query']);_0x69cd03[_0x7e5f('0x2f')]=_[_0x7e5f('0x2e')](_0x453f0f[_0x7e5f('0x2b')],qs[_0x7e5f('0x30')](_0x3b73c6[_0x7e5f('0x26')][_0x7e5f('0x30')]));_0x69cd03[_0x7e5f('0x2f')]=_0x69cd03[_0x7e5f('0x2f')]['length']?_0x69cd03[_0x7e5f('0x2f')]:_0x453f0f[_0x7e5f('0x2b')];if(_0x3b73c6[_0x7e5f('0x26')][_0x7e5f('0x31')]){_0x69cd03[_0x7e5f('0x32')]=[{'all':!![]}];}_0x69cd03=_[_0x7e5f('0x33')]({},_0x69cd03,_0x3b73c6[_0x7e5f('0x34')]);return db[_0x7e5f('0x20')][_0x7e5f('0x35')](_0x69cd03)[_0x7e5f('0x1c')](handleEntityNotFound(_0x142134,null))[_0x7e5f('0x1c')](respondWithResult(_0x142134,null))[_0x7e5f('0x28')](handleError(_0x142134,null));};exports['create']=function(_0x194879,_0x5dac2c){return db[_0x7e5f('0x20')][_0x7e5f('0x36')](_0x194879[_0x7e5f('0x37')],{})[_0x7e5f('0x1c')](respondWithResult(_0x5dac2c,0xc9))[_0x7e5f('0x28')](handleError(_0x5dac2c,null));};exports[_0x7e5f('0x1b')]=function(_0x1910d2,_0x16d0b6){if(_0x1910d2[_0x7e5f('0x37')]['id']){delete _0x1910d2[_0x7e5f('0x37')]['id'];}return db[_0x7e5f('0x20')][_0x7e5f('0x35')]({'where':{'id':_0x1910d2['params']['id']}})[_0x7e5f('0x1c')](handleEntityNotFound(_0x16d0b6,null))[_0x7e5f('0x1c')](saveUpdates(_0x1910d2[_0x7e5f('0x37')],null))[_0x7e5f('0x1c')](respondWithResult(_0x16d0b6,null))['catch'](handleError(_0x16d0b6,null));};exports['destroy']=function(_0x1b5e2a,_0x7abca4){return db[_0x7e5f('0x20')][_0x7e5f('0x35')]({'where':{'id':_0x1b5e2a[_0x7e5f('0x2a')]['id']}})[_0x7e5f('0x1c')](handleEntityNotFound(_0x7abca4,null))[_0x7e5f('0x1c')](removeEntity(_0x7abca4,null))[_0x7e5f('0x28')](handleError(_0x7abca4,null));};exports[_0x7e5f('0x38')]=function(_0x311c96,_0x370265){return db[_0x7e5f('0x20')][_0x7e5f('0x38')]()['then'](respondWithResult(_0x370265,null))[_0x7e5f('0x28')](handleError(_0x370265,null));};exports[_0x7e5f('0x39')]=function(_0xd3a9c2,_0x3dd373){return db['MailMessage'][_0x7e5f('0x35')]({'where':{'id':_0xd3a9c2['params']['id']}})[_0x7e5f('0x1c')](handleEntityNotFound(_0x3dd373,null))[_0x7e5f('0x1c')](function(_0x127a87){if(_0x127a87){return _0x127a87[_0x7e5f('0x39')](_0xd3a9c2[_0x7e5f('0x37')]['ids'],_[_0x7e5f('0x3a')](_0xd3a9c2[_0x7e5f('0x37')],[_0x7e5f('0x3b'),'id'])||{});}})[_0x7e5f('0x1c')](respondWithResult(_0x3dd373,null))['catch'](handleError(_0x3dd373,null));};exports[_0x7e5f('0x3c')]=function(_0x3dc064,_0x3f8562){var _0x30c54f={'raw':![],'where':{}};var _0x532eff={};var _0x37bf6a={'count':0x0,'rows':[]};return db['MailInteraction'][_0x7e5f('0x3d')]({'where':{'id':_0x3dc064['params']['id']}})[_0x7e5f('0x1c')](handleEntityNotFound(_0x3f8562,null))[_0x7e5f('0x1c')](function(_0x330a7c){if(_0x330a7c){_0x532eff['model']=_[_0x7e5f('0x2c')](db[_0x7e5f('0x3e')][_0x7e5f('0x21')]);_0x532eff[_0x7e5f('0x26')]=_[_0x7e5f('0x2c')](_0x3dc064[_0x7e5f('0x26')]);_0x532eff[_0x7e5f('0x2d')]=_[_0x7e5f('0x2e')](_0x532eff['model'],_0x532eff[_0x7e5f('0x26')]);_0x30c54f['attributes']=_[_0x7e5f('0x2e')](_0x532eff[_0x7e5f('0x2b')],qs[_0x7e5f('0x30')](_0x3dc064[_0x7e5f('0x26')][_0x7e5f('0x30')]));_0x30c54f[_0x7e5f('0x2f')]=_0x30c54f[_0x7e5f('0x2f')]['length']?_0x30c54f[_0x7e5f('0x2f')]:_0x532eff[_0x7e5f('0x2b')];if(!_0x3dc064['query'][_0x7e5f('0x3f')](_0x7e5f('0x40'))){_0x30c54f[_0x7e5f('0x18')]=qs[_0x7e5f('0x18')](_0x3dc064[_0x7e5f('0x26')][_0x7e5f('0x18')]);_0x30c54f[_0x7e5f('0x16')]=qs[_0x7e5f('0x16')](_0x3dc064['query']['offset']);}_0x30c54f['order']=qs[_0x7e5f('0x41')](_0x3dc064['query'][_0x7e5f('0x41')]);_0x30c54f[_0x7e5f('0x42')]=qs['filters'](_[_0x7e5f('0x43')](_0x3dc064[_0x7e5f('0x26')],_0x532eff['filters']));_0x30c54f[_0x7e5f('0x42')][_0x7e5f('0x44')]=_0x330a7c['id'];if(_0x3dc064[_0x7e5f('0x26')]['filter']){_0x30c54f[_0x7e5f('0x42')]=_[_0x7e5f('0x33')](_0x30c54f['where'],{'$or':_[_0x7e5f('0x1f')](_0x30c54f[_0x7e5f('0x2f')],function(_0x4b662c){var _0x106f93={};_0x106f93[_0x4b662c]={'$like':'%'+_0x3dc064[_0x7e5f('0x26')][_0x7e5f('0x45')]+'%'};return _0x106f93;})});}if(_0x3dc064['query'][_0x7e5f('0x46')]){var _0x520163=_0x3dc064[_0x7e5f('0x26')][_0x7e5f('0x46')][_0x7e5f('0x47')](',');var _0xb41d9d={};_0xb41d9d[_0x520163[0x0]]={'$gte':moment(_0x520163[0x1])['format'](_0x7e5f('0x48'))};_0x30c54f[_0x7e5f('0x42')]=_[_0x7e5f('0x33')](_0x30c54f['where'],_0xb41d9d);}_0x30c54f=_['merge']({},_0x30c54f,_0x3dc064[_0x7e5f('0x34')]);return db[_0x7e5f('0x3e')]['count']({'where':_0x30c54f[_0x7e5f('0x42')]})[_0x7e5f('0x1c')](function(_0x1940e3){_0x37bf6a['count']=_0x1940e3;if(_0x3dc064['query'][_0x7e5f('0x31')]){_0x30c54f['include']=[{'all':!![]}];}return db['MailMessage'][_0x7e5f('0x24')](_0x30c54f);})[_0x7e5f('0x1c')](function(_0x4050fb){if(_0x3dc064['query'][_0x7e5f('0x49')]===_0x7e5f('0x4a')){for(var _0x2f06de=0x0;_0x2f06de<_0x4050fb[_0x7e5f('0x4b')];_0x2f06de++){_0x4050fb[_0x2f06de][_0x7e5f('0x37')]=juice(_0x4050fb[_0x2f06de][_0x7e5f('0x37')]);}}_0x37bf6a[_0x7e5f('0x4c')]=_0x4050fb;return _0x37bf6a;});}})['then'](respondWithFilteredResult(_0x3f8562,_0x30c54f))[_0x7e5f('0x28')](handleError(_0x3f8562,null));};exports[_0x7e5f('0x4d')]=function(_0x3adc96,_0x3a3584){return db[_0x7e5f('0x20')][_0x7e5f('0x35')]({'where':{'id':_0x3adc96[_0x7e5f('0x2a')]['id']}})[_0x7e5f('0x1c')](handleEntityNotFound(_0x3a3584,null))[_0x7e5f('0x1c')](function(_0x1a01d9){if(_0x1a01d9){return _0x1a01d9['setTags'](_0x3adc96[_0x7e5f('0x37')][_0x7e5f('0x3b')],_['omit'](_0x3adc96[_0x7e5f('0x37')],['ids','id'])||{})[_0x7e5f('0x4e')](function(){return db[_0x7e5f('0x4f')]['findAll']({'attributes':['id','name',_0x7e5f('0x50')],'where':{'id':_0x3adc96[_0x7e5f('0x37')][_0x7e5f('0x3b')]}});})['then'](function(_0x5ec8ae){socket[_0x7e5f('0x51')](_0x7e5f('0x52'),{'id':Number(_0x3adc96['params']['id']),'tags':_0x5ec8ae||[]});return{'id':Number(_0x3adc96[_0x7e5f('0x2a')]['id']),'tags':_0x5ec8ae||[]};});}})[_0x7e5f('0x1c')](respondWithResult(_0x3a3584,null))['catch'](handleError(_0x3a3584,null));};exports[_0x7e5f('0x53')]=function(_0x59c07e,_0x23eda1){return db[_0x7e5f('0x20')][_0x7e5f('0x35')]({'where':{'id':_0x59c07e['params']['id']}})[_0x7e5f('0x1c')](handleEntityNotFound(_0x23eda1,null))['then'](function(_0x59a9ff){if(_0x59a9ff){return _0x59a9ff[_0x7e5f('0x53')](_0x59c07e[_0x7e5f('0x26')][_0x7e5f('0x3b')]);}})[_0x7e5f('0x1c')](respondWithStatusCode(_0x23eda1,null))['catch'](handleError(_0x23eda1,null));};exports['download']=function(_0x4f4a54,_0x19ea27){var _0x4a9bbf=moment()[_0x7e5f('0x54')]()[_0x7e5f('0x55')]();var _0xa26a59=path[_0x7e5f('0x56')](config['root'],_0x7e5f('0x57'),_0x7e5f('0x58'),_0x7e5f('0x59'));var _0x5d603b=path['join'](config[_0x7e5f('0x5a')],_0x7e5f('0x57'),_0x7e5f('0x58'),_0x7e5f('0x5b'));var _0x489e54=path[_0x7e5f('0x56')](_0xa26a59,_0x4a9bbf);var _0x58528e=util[_0x7e5f('0x5c')](_0x7e5f('0x5d'),_0x4f4a54[_0x7e5f('0x2a')]['id'],_0x4a9bbf);var _0x357578=path['join'](_0xa26a59,_0x58528e);var _0x30e0f5=[];if(_0x4f4a54[_0x7e5f('0x26')][_0x7e5f('0x5b')]){_0x30e0f5['push']({'model':db[_0x7e5f('0x5e')],'as':_0x7e5f('0x5f'),'raw':!![]});}var _0x5eca72=[{'model':db[_0x7e5f('0x3e')],'as':_0x7e5f('0x60'),'attributes':['id',_0x7e5f('0x37'),_0x7e5f('0x61'),'to','cc',_0x7e5f('0x62'),_0x7e5f('0x63'),_0x7e5f('0x64')],'where':{'secret':![]},'order':qs[_0x7e5f('0x41')]('id'),'include':_0x30e0f5}];return db[_0x7e5f('0x20')]['find']({'where':{'id':_0x4f4a54['params']['id']},'include':_0x5eca72})[_0x7e5f('0x1c')](handleEntityNotFound(_0x19ea27,null))['then'](function(_0x313c62){if(_0x313c62&&_0x313c62['Messages']){var _0x41234b=_0x313c62[_0x7e5f('0x65')]({'plain':!![]});fs['mkdirSync'](_0x489e54);return BPromise[_0x7e5f('0x66')](_0x41234b[_0x7e5f('0x60')],function(_0x45c6ac,_0x5c687d){var _0x489d2d={'from':_0x45c6ac[_0x7e5f('0x61')],'to':_0x45c6ac['to'],'subject':_0x45c6ac['subject'],'html':htmlEntities[_0x7e5f('0x67')](_0x45c6ac['body']),'headers':{'Date':moment(_0x45c6ac[_0x7e5f('0x64')])[_0x7e5f('0x5c')](_0x7e5f('0x68'))},'attachments':[]};if(_0x45c6ac['cc']){_0x489d2d['headers']['Cc']=_0x45c6ac['cc'];}if(_0x45c6ac[_0x7e5f('0x62')]){_0x489d2d[_0x7e5f('0x69')][_0x7e5f('0x6a')]=_0x45c6ac[_0x7e5f('0x62')];}return new BPromise(function(_0xd7376e,_0x4576c9){if(_0x45c6ac['Attachments']){for(var _0x40a213=0x0;_0x40a213<_0x45c6ac[_0x7e5f('0x5f')][_0x7e5f('0x4b')];_0x40a213++){var _0x8c3661=_0x45c6ac['Attachments'][_0x40a213];var _0x5a8acd=path[_0x7e5f('0x56')](_0x5d603b,_0x8c3661[_0x7e5f('0x6b')]);if(fs['existsSync'](_0x5a8acd)){_0x489d2d['attachments'][_0x7e5f('0x6c')]({'name':_0x8c3661[_0x7e5f('0x1e')],'contentType':_0x8c3661['type'],'data':fs[_0x7e5f('0x6d')](_0x5a8acd)});}}}emlformat['build'](_0x489d2d,function(_0x5290db,_0x467b85){if(_0x5290db)return _0x4576c9(_0x5290db);fs[_0x7e5f('0x6e')](path[_0x7e5f('0x56')](_0x489e54,util[_0x7e5f('0x5c')](_0x7e5f('0x6f'),_0x5c687d)),_0x467b85);return _0xd7376e(_0x467b85);});});})['then'](function(){return new BPromise(function(_0x2d8f12,_0x9b53ca){zipdir(_0x489e54,{'saveTo':_0x357578},function(_0x191fba,_0x5565df){if(_0x191fba)return _0x9b53ca(_0x191fba);return _0x2d8f12(_0x5565df);});})['then'](function(){return new BPromise(function(_0x3b03dd,_0x4f336a){rimraf(_0x489e54,function(_0xef6fb7){if(_0xef6fb7)_0x4f336a(_0xef6fb7);return _0x3b03dd();});});})[_0x7e5f('0x1c')](function(){return _0x19ea27['download'](_0x357578,_0x58528e,function(_0x5bd7be){if(!_0x5bd7be)fs[_0x7e5f('0x70')](_0x357578);});});});}else{return _0x19ea27[_0x7e5f('0x12')](0xc8);}})[_0x7e5f('0x28')](handleError(_0x19ea27,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 5d5386e..924cc63 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 _0x087d=['events','../../mysqldb','MailMessage','setMaxListeners','save','update','then','setDataValue','Users','map','unreadMessages','emit','catch','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x087d,0x10a));var _0xd087=function(_0x44cd5a,_0x2651f5){_0x44cd5a=_0x44cd5a-0x0;var _0x19507a=_0x087d[_0x44cd5a];return _0x19507a;};'use strict';var EventEmitter=require(_0xd087('0x0'));var MailInteraction=require(_0xd087('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xd087('0x1'))['db'][_0xd087('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xd087('0x3')](0x0);var events={'afterCreate':_0xd087('0x4'),'afterUpdate':_0xd087('0x5'),'afterDestroy':'remove'};function emitEvent(_0x159dbb){return function(_0x2159d2,_0x1379bb,_0x7de1a0){_0x2159d2['getUsers']({'attributes':['id'],'raw':!![]})[_0xd087('0x6')](function(_0x576127){_0x2159d2[_0xd087('0x7')](_0xd087('0x8'),_0x576127[_0xd087('0x9')](function(_0x1d1674){return{'id':_0x1d1674['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x2159d2['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4edc25){_0x2159d2[_0xd087('0x7')](_0xd087('0xa'),_0x4edc25['length']);MailInteractionEvents['emit'](_0x159dbb+':'+_0x2159d2['id'],_0x2159d2);MailInteractionEvents[_0xd087('0xb')](_0x159dbb,_0x2159d2);_0x7de1a0(null);})[_0xd087('0xc')](_0x7de1a0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xd087('0xd')]=MailInteractionEvents; \ No newline at end of file +var _0x4fc5=['length','emit','hasOwnProperty','exports','events','../../mysqldb','MailInteraction','setMaxListeners','save','update','then','setDataValue','findAll','unreadMessages'];(function(_0x470f0b,_0x11cfba){var _0x1f999d=function(_0x4c7922){while(--_0x4c7922){_0x470f0b['push'](_0x470f0b['shift']());}};_0x1f999d(++_0x11cfba);}(_0x4fc5,0xd6));var _0x54fc=function(_0x1ef0bc,_0x6e3409){_0x1ef0bc=_0x1ef0bc-0x0;var _0x2e52ed=_0x4fc5[_0x1ef0bc];return _0x2e52ed;};'use strict';var EventEmitter=require(_0x54fc('0x0'));var MailInteraction=require(_0x54fc('0x1'))['db'][_0x54fc('0x2')];var MailMessage=require(_0x54fc('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x54fc('0x3')](0x0);var events={'afterCreate':_0x54fc('0x4'),'afterUpdate':_0x54fc('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4c20fc){return function(_0x50798e,_0x4c6d7d,_0x23a0c3){_0x50798e['getUsers']({'attributes':['id'],'raw':!![]})[_0x54fc('0x6')](function(_0x175b23){_0x50798e[_0x54fc('0x7')]('Users',_0x175b23['map'](function(_0x52e535){return{'id':_0x52e535['id']};}));return MailMessage[_0x54fc('0x8')]({'where':{'MailInteractionId':_0x50798e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x54fc('0x6')](function(_0x4e1543){_0x50798e[_0x54fc('0x7')](_0x54fc('0x9'),_0x4e1543[_0x54fc('0xa')]);MailInteractionEvents[_0x54fc('0xb')](_0x4c20fc+':'+_0x50798e['id'],_0x50798e);MailInteractionEvents[_0x54fc('0xb')](_0x4c20fc,_0x50798e);_0x23a0c3(null);})['catch'](_0x23a0c3(null));};}for(var e in events){if(events[_0x54fc('0xc')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x54fc('0xd')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index f2bd939..f173499 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 _0x862b=['changed','substatus','closed','get','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','subject','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closedAt','format'];(function(_0xb5fb77,_0x2ec122){var _0x3f4101=function(_0x25b782){while(--_0x25b782){_0xb5fb77['push'](_0xb5fb77['shift']());}};_0x3f4101(++_0x2ec122);}(_0x862b,0x175));var _0xb862=function(_0xf23728,_0x3229ec){_0xf23728=_0xf23728-0x0;var _0x10f550=_0x862b[_0xf23728];return _0x10f550;};'use strict';var _=require('lodash');var util=require(_0xb862('0x0'));var logger=require(_0xb862('0x1'))('api');var moment=require(_0xb862('0x2'));var BPromise=require(_0xb862('0x3'));var rp=require(_0xb862('0x4'));var fs=require('fs');var path=require(_0xb862('0x5'));var rimraf=require(_0xb862('0x6'));var config=require(_0xb862('0x7'));var attributes=require(_0xb862('0x8'));module[_0xb862('0x9')]=function(_0x3d7363,_0x17bd4d){return _0x3d7363[_0xb862('0xa')](_0xb862('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xb862('0xc'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1faefa,_0x254592,_0x55a25a){if(_0x1faefa['substatus']){_0x1faefa[_0xb862('0xd')]=moment()['format'](_0xb862('0xe'));}if(_0x1faefa['closed']){_0x1faefa[_0xb862('0xf')]=moment()[_0xb862('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x55a25a(null,_0x254592);},'beforeUpdate':function(_0x328b24,_0x2bcf22,_0x3d09ba){if(_0x328b24[_0xb862('0x11')](_0xb862('0x12'))){_0x328b24[_0xb862('0xd')]=_0x328b24[_0xb862('0x12')]?moment()['format'](_0xb862('0xe')):null;}if(_0x328b24[_0xb862('0x11')](_0xb862('0x13'))){_0x328b24[_0xb862('0xf')]=moment()[_0xb862('0x10')](_0xb862('0xe'));_0x328b24[_0xb862('0x12')]=null;_0x328b24[_0xb862('0xd')]=null;}_0x3d09ba(null,_0x328b24);},'afterUpdate':function(_0x5b61b0,_0x5cac29,_0x40a85c){var _0x256850=_0x3d7363['models'];var _0x4bc97a=_0x5b61b0[_0xb862('0x14')]({'plain':!![]});if(_0x4bc97a[_0xb862('0x13')]){return _0x256850[_0xb862('0x15')][_0xb862('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x4bc97a['id']}})['then'](function(){_0x40a85c();})[_0xb862('0x17')](function(_0x5a4fcd){_0x40a85c(_0x5a4fcd);});}else{_0x40a85c();}}},'charset':_0xb862('0x18'),'collate':_0xb862('0x19')});}; \ No newline at end of file +var _0xce75=['bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','FULLTEXT','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','substatus','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x5cf6cd,_0x17ec58){var _0x4f1e41=function(_0x561b88){while(--_0x561b88){_0x5cf6cd['push'](_0x5cf6cd['shift']());}};_0x4f1e41(++_0x17ec58);}(_0xce75,0x1be));var _0x5ce7=function(_0x30310e,_0x1f511d){_0x30310e=_0x30310e-0x0;var _0x39e1ec=_0xce75[_0x30310e];return _0x39e1ec;};'use strict';var _=require(_0x5ce7('0x0'));var util=require(_0x5ce7('0x1'));var logger=require(_0x5ce7('0x2'))(_0x5ce7('0x3'));var moment=require('moment');var BPromise=require(_0x5ce7('0x4'));var rp=require(_0x5ce7('0x5'));var fs=require('fs');var path=require(_0x5ce7('0x6'));var rimraf=require(_0x5ce7('0x7'));var config=require(_0x5ce7('0x8'));var attributes=require(_0x5ce7('0x9'));module[_0x5ce7('0xa')]=function(_0x162935,_0x3b4d20){return _0x162935[_0x5ce7('0xb')]('MailInteraction',attributes,{'tableName':_0x5ce7('0xc'),'paranoid':![],'indexes':[{'name':_0x5ce7('0xd'),'fields':['subject','to'],'type':_0x5ce7('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x53691e,_0x3f6e89,_0x3b6e26){if(_0x53691e['substatus']){_0x53691e[_0x5ce7('0xf')]=moment()[_0x5ce7('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x53691e[_0x5ce7('0x11')]){_0x53691e[_0x5ce7('0x12')]=moment()[_0x5ce7('0x10')](_0x5ce7('0x13'));}_0x3b6e26(null,_0x3f6e89);},'beforeUpdate':function(_0x2279d8,_0x197c51,_0x28b403){if(_0x2279d8[_0x5ce7('0x14')](_0x5ce7('0x15'))){_0x2279d8['substatusAt']=_0x2279d8['substatus']?moment()[_0x5ce7('0x10')](_0x5ce7('0x13')):null;}if(_0x2279d8[_0x5ce7('0x14')](_0x5ce7('0x11'))){_0x2279d8[_0x5ce7('0x12')]=moment()[_0x5ce7('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x2279d8['substatus']=null;_0x2279d8[_0x5ce7('0xf')]=null;}_0x28b403(null,_0x2279d8);},'afterUpdate':function(_0x5bc103,_0x5d991a,_0x14015a){var _0x51be92=_0x162935[_0x5ce7('0x16')];var _0x43798a=_0x5bc103[_0x5ce7('0x17')]({'plain':!![]});if(_0x43798a[_0x5ce7('0x11')]){return _0x51be92[_0x5ce7('0x18')][_0x5ce7('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x43798a['id']}})[_0x5ce7('0x1a')](function(){_0x14015a();})[_0x5ce7('0x1b')](function(_0x39fafd){_0x14015a(_0x39fafd);});}else{_0x14015a();}}},'charset':_0x5ce7('0x1c'),'collate':_0x5ce7('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 0e17dfc..07768d3 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 _0x4b57=['where','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./mailInteraction.socket','request','then','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailInteraction,\x20%s,\x20%s','info','result','catch','UpdateMailInteraction','MailInteraction','update','options','attributes','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b57,0xaa));var _0x74b5=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x4b57[_0x1a72f3];return _0x57ef47;};'use strict';var _=require(_0x74b5('0x0'));var util=require(_0x74b5('0x1'));var moment=require(_0x74b5('0x2'));var BPromise=require(_0x74b5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74b5('0x4'));var db=require(_0x74b5('0x5'))['db'];var utils=require(_0x74b5('0x6'));var logger=require(_0x74b5('0x7'))(_0x74b5('0x8'));var config=require('../../config/environment');var jayson=require(_0x74b5('0x9'));var client=jayson[_0x74b5('0xa')]['http']({'port':0x232a});config['redis']=_[_0x74b5('0xb')](config['redis'],{'host':_0x74b5('0xc'),'port':0x18eb});var socket=require(_0x74b5('0xd'))(new Redis(config[_0x74b5('0xe')]));require(_0x74b5('0xf'))['register'](socket);function respondWithRpcPromise(_0x4e9840,_0x3c8b85,_0x241d95){return new BPromise(function(_0x2129ee,_0x300fd2){return client[_0x74b5('0x10')](_0x4e9840,_0x241d95)[_0x74b5('0x11')](function(_0x426900){logger['info']('MailInteraction,\x20%s,\x20%s',_0x3c8b85,_0x74b5('0x12'));logger[_0x74b5('0x13')](_0x74b5('0x14'),_0x3c8b85,_0x74b5('0x12'),JSON[_0x74b5('0x15')](_0x426900));if(_0x426900[_0x74b5('0x16')]){if(_0x426900['error'][_0x74b5('0x17')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x3c8b85,_0x426900[_0x74b5('0x16')][_0x74b5('0x18')]);return _0x300fd2(_0x426900['error']['message']);}logger[_0x74b5('0x16')](_0x74b5('0x19'),_0x3c8b85,_0x426900[_0x74b5('0x16')][_0x74b5('0x18')]);return _0x2129ee(_0x426900[_0x74b5('0x16')]['message']);}else{logger[_0x74b5('0x1a')](_0x74b5('0x19'),_0x3c8b85,_0x74b5('0x12'));_0x2129ee(_0x426900[_0x74b5('0x1b')][_0x74b5('0x18')]);}})[_0x74b5('0x1c')](function(_0x275e8d){logger[_0x74b5('0x16')](_0x74b5('0x19'),_0x3c8b85,_0x275e8d);_0x300fd2(_0x275e8d);});});}exports[_0x74b5('0x1d')]=function(_0x19d90a){var _0x2f45b9=this;return new Promise(function(_0x9ce273,_0x20adda){return db[_0x74b5('0x1e')][_0x74b5('0x1f')](_0x19d90a['body'],{'raw':_0x19d90a[_0x74b5('0x20')]?_0x19d90a[_0x74b5('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19d90a[_0x74b5('0x20')]?_0x19d90a[_0x74b5('0x20')]['where']||null:null,'attributes':_0x19d90a[_0x74b5('0x20')]?_0x19d90a[_0x74b5('0x20')][_0x74b5('0x21')]||null:null,'limit':_0x19d90a[_0x74b5('0x20')]?_0x19d90a[_0x74b5('0x20')][_0x74b5('0x22')]||null:null})['then'](function(_0x3f9e8a){logger[_0x74b5('0x1a')]('UpdateMailInteraction',_0x19d90a);logger[_0x74b5('0x13')](_0x74b5('0x1d'),_0x19d90a,JSON['stringify'](_0x3f9e8a));_0x9ce273(_0x3f9e8a);})['catch'](function(_0x53321d){logger[_0x74b5('0x16')](_0x74b5('0x1d'),_0x53321d['message'],_0x19d90a);_0x20adda(_0x2f45b9['error'](0x1f4,_0x53321d[_0x74b5('0x18')]));});});};exports['AddTagsToMailInteraction']=function(_0x426d9d){return new Promise(function(_0x48be21,_0x2cbf4f){return db[_0x74b5('0x1e')]['find']({'where':_0x426d9d[_0x74b5('0x20')]?_0x426d9d[_0x74b5('0x20')][_0x74b5('0x23')]||null:null})['then'](function(_0x34fa13){if(_0x34fa13){return _0x34fa13[_0x74b5('0x24')](_0x426d9d[_0x74b5('0x25')][_0x74b5('0x26')],_['omit'](_0x426d9d[_0x74b5('0x25')],[_0x74b5('0x26'),'id'])||{});}})[_0x74b5('0x27')](function(_0x3bb74e){logger['info'](_0x74b5('0x28'),_0x426d9d);logger[_0x74b5('0x13')](_0x74b5('0x28'),_0x426d9d,JSON[_0x74b5('0x15')](_0x3bb74e));_0x48be21(_0x3bb74e);})['catch'](function(_0x56cdd7){logger[_0x74b5('0x16')](_0x74b5('0x28'),_0x56cdd7[_0x74b5('0x18')],_0x426d9d);_0x2cbf4f(_this[_0x74b5('0x16')](0x1f4,_0x56cdd7[_0x74b5('0x18')]));});});}; \ No newline at end of file +var _0xbe2c=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateMailInteraction','MailInteraction','body','options','where','attributes','debug','stringify','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash'];(function(_0xe90877,_0x9d238d){var _0x52f473=function(_0xbf227a){while(--_0xbf227a){_0xe90877['push'](_0xe90877['shift']());}};_0x52f473(++_0x9d238d);}(_0xbe2c,0x18f));var _0xcbe2=function(_0x3f9ff2,_0x5037f2){_0x3f9ff2=_0x3f9ff2-0x0;var _0x447161=_0xbe2c[_0x3f9ff2];return _0x447161;};'use strict';var _=require(_0xcbe2('0x0'));var util=require(_0xcbe2('0x1'));var moment=require('moment');var BPromise=require(_0xcbe2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbe2('0x3'));var db=require(_0xcbe2('0x4'))['db'];var utils=require(_0xcbe2('0x5'));var logger=require(_0xcbe2('0x6'))(_0xcbe2('0x7'));var config=require('../../config/environment');var jayson=require(_0xcbe2('0x8'));var client=jayson[_0xcbe2('0x9')]['http']({'port':0x232a});config[_0xcbe2('0xa')]=_[_0xcbe2('0xb')](config[_0xcbe2('0xa')],{'host':_0xcbe2('0xc'),'port':0x18eb});var socket=require(_0xcbe2('0xd'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0xcbe2('0xe')](socket);function respondWithRpcPromise(_0x335234,_0x675278,_0x1b67af){return new BPromise(function(_0x4af901,_0x5d2a45){return client[_0xcbe2('0xf')](_0x335234,_0x1b67af)[_0xcbe2('0x10')](function(_0x3b050b){logger[_0xcbe2('0x11')](_0xcbe2('0x12'),_0x675278,_0xcbe2('0x13'));logger['debug'](_0xcbe2('0x14'),_0x675278,_0xcbe2('0x13'),JSON['stringify'](_0x3b050b));if(_0x3b050b[_0xcbe2('0x15')]){if(_0x3b050b['error'][_0xcbe2('0x16')]===0x1f4){logger['error'](_0xcbe2('0x12'),_0x675278,_0x3b050b['error']['message']);return _0x5d2a45(_0x3b050b[_0xcbe2('0x15')]['message']);}logger[_0xcbe2('0x15')](_0xcbe2('0x12'),_0x675278,_0x3b050b[_0xcbe2('0x15')][_0xcbe2('0x17')]);return _0x4af901(_0x3b050b[_0xcbe2('0x15')][_0xcbe2('0x17')]);}else{logger[_0xcbe2('0x11')]('MailInteraction,\x20%s,\x20%s',_0x675278,_0xcbe2('0x13'));_0x4af901(_0x3b050b['result'][_0xcbe2('0x17')]);}})[_0xcbe2('0x18')](function(_0x31b49c){logger[_0xcbe2('0x15')]('MailInteraction,\x20%s,\x20%s',_0x675278,_0x31b49c);_0x5d2a45(_0x31b49c);});});}exports[_0xcbe2('0x19')]=function(_0x4cba2b){var _0x552a9a=this;return new Promise(function(_0x14d64d,_0x208863){return db[_0xcbe2('0x1a')]['update'](_0x4cba2b[_0xcbe2('0x1b')],{'raw':_0x4cba2b[_0xcbe2('0x1c')]?_0x4cba2b[_0xcbe2('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cba2b[_0xcbe2('0x1c')]?_0x4cba2b[_0xcbe2('0x1c')][_0xcbe2('0x1d')]||null:null,'attributes':_0x4cba2b[_0xcbe2('0x1c')]?_0x4cba2b[_0xcbe2('0x1c')][_0xcbe2('0x1e')]||null:null,'limit':_0x4cba2b[_0xcbe2('0x1c')]?_0x4cba2b[_0xcbe2('0x1c')]['limit']||null:null})[_0xcbe2('0x10')](function(_0x416361){logger['info'](_0xcbe2('0x19'),_0x4cba2b);logger[_0xcbe2('0x1f')](_0xcbe2('0x19'),_0x4cba2b,JSON[_0xcbe2('0x20')](_0x416361));_0x14d64d(_0x416361);})[_0xcbe2('0x18')](function(_0x4833cd){logger[_0xcbe2('0x15')](_0xcbe2('0x19'),_0x4833cd['message'],_0x4cba2b);_0x208863(_0x552a9a[_0xcbe2('0x15')](0x1f4,_0x4833cd['message']));});});};exports[_0xcbe2('0x21')]=function(_0x340a96){return new Promise(function(_0x4191b4,_0x431631){return db['MailInteraction'][_0xcbe2('0x22')]({'where':_0x340a96[_0xcbe2('0x1c')]?_0x340a96['options'][_0xcbe2('0x1d')]||null:null})[_0xcbe2('0x10')](function(_0x2def48){if(_0x2def48){return _0x2def48[_0xcbe2('0x23')](_0x340a96[_0xcbe2('0x1b')][_0xcbe2('0x24')],_[_0xcbe2('0x25')](_0x340a96[_0xcbe2('0x1b')],[_0xcbe2('0x24'),'id'])||{});}})[_0xcbe2('0x26')](function(_0x247650){logger[_0xcbe2('0x11')](_0xcbe2('0x27'),_0x340a96);logger['debug'](_0xcbe2('0x27'),_0x340a96,JSON[_0xcbe2('0x20')](_0x247650));_0x4191b4(_0x247650);})['catch'](function(_0x555e91){logger[_0xcbe2('0x15')]('AddTags',_0x555e91[_0xcbe2('0x17')],_0x340a96);_0x431631(_this[_0xcbe2('0x15')](0x1f4,_0x555e91[_0xcbe2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 50a06ae..40b5a3a 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 _0xbf85=['remove','update','emit','removeListener','./mailInteraction.events'];(function(_0x388dc4,_0x10ef93){var _0x372b1b=function(_0x23fada){while(--_0x23fada){_0x388dc4['push'](_0x388dc4['shift']());}};_0x372b1b(++_0x10ef93);}(_0xbf85,0x7c));var _0x5bf8=function(_0x16c81a,_0x409366){_0x16c81a=_0x16c81a-0x0;var _0x261858=_0xbf85[_0x16c81a];return _0x261858;};'use strict';var MailInteractionEvents=require(_0x5bf8('0x0'));var events=['save',_0x5bf8('0x1'),_0x5bf8('0x2')];function createListener(_0x1a360e,_0x2c876e){return function(_0x4a985a){_0x2c876e[_0x5bf8('0x3')](_0x1a360e,_0x4a985a);};}function removeListener(_0x468e65,_0x6b4360){return function(){MailInteractionEvents[_0x5bf8('0x4')](_0x468e65,_0x6b4360);};}exports['register']=function(_0x496cdb){for(var _0x4831bb=0x0,_0x56259f=events['length'];_0x4831bb<_0x56259f;_0x4831bb++){var _0x5be6f0=events[_0x4831bb];var _0x47df9a=createListener('mailInteraction:'+_0x5be6f0,_0x496cdb);MailInteractionEvents['on'](_0x5be6f0,_0x47df9a);}}; \ No newline at end of file +var _0xe2f7=['mailInteraction:','./mailInteraction.events','save','remove','update','emit','register','length'];(function(_0x2bf1c0,_0x44a3e6){var _0x1e9bce=function(_0x1c250b){while(--_0x1c250b){_0x2bf1c0['push'](_0x2bf1c0['shift']());}};_0x1e9bce(++_0x44a3e6);}(_0xe2f7,0x111));var _0x7e2f=function(_0x3b907f,_0x17eae9){_0x3b907f=_0x3b907f-0x0;var _0x48950d=_0xe2f7[_0x3b907f];return _0x48950d;};'use strict';var MailInteractionEvents=require(_0x7e2f('0x0'));var events=[_0x7e2f('0x1'),_0x7e2f('0x2'),_0x7e2f('0x3')];function createListener(_0x4e45d7,_0xa079aa){return function(_0x3c28de){_0xa079aa[_0x7e2f('0x4')](_0x4e45d7,_0x3c28de);};}function removeListener(_0x1f9a7c,_0x809776){return function(){MailInteractionEvents['removeListener'](_0x1f9a7c,_0x809776);};}exports[_0x7e2f('0x5')]=function(_0x3a50e3){for(var _0x267f71=0x0,_0x453e83=events[_0x7e2f('0x6')];_0x267f71<_0x453e83;_0x267f71++){var _0x44fbe6=events[_0x267f71];var _0xba3188=createListener(_0x7e2f('0x7')+_0x44fbe6,_0x3a50e3);MailInteractionEvents['on'](_0x44fbe6,_0xba3188);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index cc48196..bf1a4a9 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 _0x6d4a=['/:id','update','put','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','post','mail','mailmessage:create','create'];(function(_0x12abdd,_0x40c627){var _0x24df07=function(_0x9f44eb){while(--_0x9f44eb){_0x12abdd['push'](_0x12abdd['shift']());}};_0x24df07(++_0x40c627);}(_0x6d4a,0x117));var _0xa6d4=function(_0x575907,_0x1d3402){_0x575907=_0x575907-0x0;var _0x208b83=_0x6d4a[_0x575907];return _0x208b83;};'use strict';var multer=require(_0xa6d4('0x0'));var util=require('util');var path=require(_0xa6d4('0x1'));var timeout=require(_0xa6d4('0x2'));var express=require(_0xa6d4('0x3'));var router=express[_0xa6d4('0x4')]();var fs_extra=require(_0xa6d4('0x5'));var auth=require(_0xa6d4('0x6'));var interaction=require(_0xa6d4('0x7'));var config=require(_0xa6d4('0x8'));var controller=require(_0xa6d4('0x9'));router[_0xa6d4('0xa')]('/',auth[_0xa6d4('0xb')](),controller[_0xa6d4('0xc')]);router[_0xa6d4('0xa')](_0xa6d4('0xd'),auth['isAuthenticated'](),controller[_0xa6d4('0xe')]);router[_0xa6d4('0xa')]('/:id',auth[_0xa6d4('0xb')](),controller[_0xa6d4('0xf')]);router[_0xa6d4('0xa')](_0xa6d4('0x10'),auth[_0xa6d4('0xb')](),controller['download']);router[_0xa6d4('0x11')]('/',auth[_0xa6d4('0xb')](),interaction['tracked'](_0xa6d4('0x12'),_0xa6d4('0x13')),controller[_0xa6d4('0x14')]);router['put'](_0xa6d4('0x15'),auth['isAuthenticated'](),controller[_0xa6d4('0x16')]);router[_0xa6d4('0x17')]('/:id/accept',auth[_0xa6d4('0xb')](),controller[_0xa6d4('0x18')]);router[_0xa6d4('0x17')](_0xa6d4('0x19'),auth[_0xa6d4('0xb')](),controller[_0xa6d4('0x1a')]);router[_0xa6d4('0x1b')](_0xa6d4('0x15'),auth[_0xa6d4('0xb')](),controller[_0xa6d4('0x1c')]);module[_0xa6d4('0x1d')]=router; \ No newline at end of file +var _0x902b=['update','accept','/:id/reject','reject','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/download','download','post','tracked','mail','mailmessage:create','put'];(function(_0x29fd1f,_0x3d3730){var _0x15849d=function(_0x26316d){while(--_0x26316d){_0x29fd1f['push'](_0x29fd1f['shift']());}};_0x15849d(++_0x3d3730);}(_0x902b,0x6a));var _0xb902=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x902b[_0x1ccdf7];return _0x52a0ae;};'use strict';var multer=require(_0xb902('0x0'));var util=require('util');var path=require(_0xb902('0x1'));var timeout=require(_0xb902('0x2'));var express=require(_0xb902('0x3'));var router=express[_0xb902('0x4')]();var fs_extra=require(_0xb902('0x5'));var auth=require(_0xb902('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb902('0x7'));var controller=require('./mailMessage.controller');router[_0xb902('0x8')]('/',auth['isAuthenticated'](),controller[_0xb902('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xb902('0xa'),auth[_0xb902('0xb')](),controller['show']);router['get'](_0xb902('0xc'),auth[_0xb902('0xb')](),controller[_0xb902('0xd')]);router[_0xb902('0xe')]('/',auth[_0xb902('0xb')](),interaction[_0xb902('0xf')](_0xb902('0x10'),_0xb902('0x11')),controller['create']);router[_0xb902('0x12')](_0xb902('0xa'),auth[_0xb902('0xb')](),controller[_0xb902('0x13')]);router['put']('/:id/accept',auth[_0xb902('0xb')](),controller[_0xb902('0x14')]);router['put'](_0xb902('0x15'),auth[_0xb902('0xb')](),controller[_0xb902('0x16')]);router[_0xb902('0x17')](_0xb902('0xa'),auth[_0xb902('0xb')](),controller['destroy']);module[_0xb902('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 81ff81b..291565a 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 _0x66e2=['INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','out','STRING','DATE'];(function(_0x3be470,_0x4f5286){var _0x43aefa=function(_0x1dd96c){while(--_0x1dd96c){_0x3be470['push'](_0x3be470['shift']());}};_0x43aefa(++_0x4f5286);}(_0x66e2,0xfa));var _0x266e=function(_0x41476c,_0x91403){_0x41476c=_0x41476c-0x0;var _0x367e81=_0x66e2[_0x41476c];return _0x367e81;};'use strict';var Sequelize=require(_0x266e('0x0'));var _=require(_0x266e('0x1'));module[_0x266e('0x2')]={'body':{'type':Sequelize[_0x266e('0x3')](_0x266e('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x266e('0x3')](_0x266e('0x5'))},'read':{'type':Sequelize[_0x266e('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x266e('0x7')),'defaultValue':_0x266e('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x266e('0x8')](0x1fe)},'from':{'type':Sequelize[_0x266e('0x8')]},'to':{'type':Sequelize[_0x266e('0x3')](_0x266e('0x4'))},'cc':{'type':Sequelize[_0x266e('0x3')](_0x266e('0x4'))},'bcc':{'type':Sequelize[_0x266e('0x3')]('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x266e('0x9')]},'attach':{'type':Sequelize[_0x266e('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x266e('0x3')](_0x266e('0x4'))},'originCc':{'type':Sequelize[_0x266e('0x3')](_0x266e('0x4'))},'originChannel':{'type':Sequelize['ENUM'](_0x266e('0xb'),_0x266e('0xc')),'defaultValue':_0x266e('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x0a06=['BOOLEAN','ENUM','out','long','DATE','INTEGER','Email','sequelize','lodash','exports','TEXT','medium'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0a06,0xaf));var _0x60a0=function(_0xadd0d2,_0x3bf5b9){_0xadd0d2=_0xadd0d2-0x0;var _0x2d564c=_0x0a06[_0xadd0d2];return _0x2d564c;};'use strict';var Sequelize=require(_0x60a0('0x0'));var _=require(_0x60a0('0x1'));module[_0x60a0('0x2')]={'body':{'type':Sequelize[_0x60a0('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x60a0('0x3')](_0x60a0('0x4'))},'read':{'type':Sequelize[_0x60a0('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x60a0('0x6')]('in','out'),'defaultValue':_0x60a0('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x60a0('0x3')](_0x60a0('0x8'))},'cc':{'type':Sequelize[_0x60a0('0x3')]('long')},'bcc':{'type':Sequelize['TEXT'](_0x60a0('0x8'))},'subject':{'type':Sequelize[_0x60a0('0x3')]},'sentAt':{'type':Sequelize[_0x60a0('0x9')]},'attach':{'type':Sequelize[_0x60a0('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x60a0('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x60a0('0x9')]},'originTo':{'type':Sequelize[_0x60a0('0x3')](_0x60a0('0x8'))},'originCc':{'type':Sequelize[_0x60a0('0x3')](_0x60a0('0x8'))},'originChannel':{'type':Sequelize[_0x60a0('0x6')](_0x60a0('0xb'),'Chat'),'defaultValue':_0x60a0('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index be6f6ad..63600e7 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 _0x3405=['accept','mail','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','Sequelize','SELECT','contact','User','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','fullname','email','rejectmessage','unix','toString','join','server','files','message-%s.eml','bcc','subject','Attachment','Attachments','from','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','ioredis','html-to-text','../../config/logger','api','mail-interactions','../../mysqldb','defaults','localhost','socket.io-emitter','redis','html-entities','./mailMessage.socket','jayson/promise','client','http','request','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','MailMessage,\x20%s,\x20%s','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','end','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','MailMessage','includeAll','include','findAll','rows','show','params','find','body','describe','create','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','length','attachments','root','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4728f8,_0x5ed9e7){var _0x58951e=function(_0x50dab7){while(--_0x50dab7){_0x4728f8['push'](_0x4728f8['shift']());}};_0x58951e(++_0x5ed9e7);}(_0x3405,0x186));var _0x5340=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x3405[_0x2112d4];return _0x434972;};'use strict';var emlformat=require(_0x5340('0x0'));var moment=require(_0x5340('0x1'));var BPromise=require(_0x5340('0x2'));var util=require(_0x5340('0x3'));var path=require(_0x5340('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x5340('0x5'));var htmlToText=require(_0x5340('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x5340('0x7'))(_0x5340('0x8'));var interaction_log=require(_0x5340('0x7'))(_0x5340('0x9'));var config=require('../../config/environment');var db=require(_0x5340('0xa'))['db'];config['redis']=_[_0x5340('0xb')](config['redis'],{'host':_0x5340('0xc'),'port':0x18eb});var socket=require(_0x5340('0xd'))(new Redis(config[_0x5340('0xe')]));var htmlEntities=require(_0x5340('0xf'));require(_0x5340('0x10'))['register'](socket);var jayson=require(_0x5340('0x11'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0x5340('0x12')]['http']({'port':0x232b});var client9002=jayson[_0x5340('0x12')][_0x5340('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x6852dc,_0x119697,_0x54bc04,_0xc876f){return new BPromise(function(_0x5a89f9,_0x11b8c1){var _0x355b3f=_0xc876f||client;return _0x355b3f[_0x5340('0x14')](_0x6852dc,_0x54bc04)[_0x5340('0x15')](function(_0x956482){logger[_0x5340('0x16')]('MailMessage,\x20%s,\x20%s',_0x119697,'request\x20sent');logger[_0x5340('0x17')](_0x5340('0x18'),_0x119697,_0x5340('0x19'),JSON[_0x5340('0x1a')](_0x956482));if(_0x956482['error']){if(_0x956482['error']['code']===0x1f4){logger[_0x5340('0x1b')]('MailMessage,\x20%s,\x20%s',_0x119697,_0x956482['error'][_0x5340('0x1c')]);return _0x11b8c1(_0x956482[_0x5340('0x1b')][_0x5340('0x1c')]);}logger[_0x5340('0x1b')](_0x5340('0x1d'),_0x119697,_0x956482[_0x5340('0x1b')]['message']);return _0x5a89f9(_0x956482[_0x5340('0x1b')][_0x5340('0x1c')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x119697,_0x5340('0x19'));_0x5a89f9(_0x956482[_0x5340('0x1e')]['message']);}})[_0x5340('0x1f')](function(_0x529084){logger[_0x5340('0x1b')](_0x5340('0x1d'),_0x119697,_0x529084);_0x11b8c1(_0x529084);});});}function respondWithResult(_0x2344cd,_0x1c8a96){_0x1c8a96=_0x1c8a96||0xc8;return function(_0x48a444){if(_0x48a444){return _0x2344cd['status'](_0x1c8a96)[_0x5340('0x20')](_0x48a444);}};}function respondWithFilteredResult(_0x1a752d,_0x386303){return function(_0x561f65){if(_0x561f65){var _0x3e110c=typeof _0x386303[_0x5340('0x21')]===_0x5340('0x22')&&typeof _0x386303[_0x5340('0x23')]===_0x5340('0x22');var _0x19550b=_0x561f65[_0x5340('0x24')];var _0xb51698=_0x3e110c?0x0:_0x386303[_0x5340('0x21')];var _0x5c20ed=_0x3e110c?_0x561f65[_0x5340('0x24')]:_0x386303[_0x5340('0x21')]+_0x386303[_0x5340('0x23')];var _0x2a931a;if(_0x5c20ed>=_0x19550b){_0x5c20ed=_0x19550b;_0x2a931a=0xc8;}else{_0x2a931a=0xce;}_0x1a752d[_0x5340('0x25')](_0x2a931a);return _0x1a752d[_0x5340('0x26')](_0x5340('0x27'),_0xb51698+'-'+_0x5c20ed+'/'+_0x19550b)[_0x5340('0x20')](_0x561f65);}return null;};}function saveUpdates(_0x511a55){return function(_0x2d848b){if(_0x2d848b){return _0x2d848b[_0x5340('0x28')](_0x511a55)[_0x5340('0x15')](function(_0x135b5e){return _0x135b5e;});}return null;};}function removeEntity(_0x3e9793){return function(_0xe95f45){if(_0xe95f45){return _0xe95f45['destroy']()[_0x5340('0x15')](function(){_0x3e9793[_0x5340('0x25')](0xcc)[_0x5340('0x29')]();});}};}function handleEntityNotFound(_0x5cf874){return function(_0x36f498){if(!_0x36f498){_0x5cf874[_0x5340('0x2a')](0x194);}return _0x36f498;};}function handleError(_0x53d4af,_0x39e368){_0x39e368=_0x39e368||0x1f4;return function(_0x24a424){logger['error'](_0x24a424[_0x5340('0x2b')]);if(_0x24a424[_0x5340('0x2c')]){delete _0x24a424['name'];}_0x53d4af[_0x5340('0x25')](_0x39e368)[_0x5340('0x2d')](_0x24a424);};}exports['index']=function(_0x280cd3,_0x1d9838){var _0x40ab3d={},_0x452ef9={},_0x752ee4={'count':0x0,'rows':[]};var _0x2f6ef1=_[_0x5340('0x2e')](db['MailMessage'][_0x5340('0x2f')],function(_0x208e52){return{'name':_0x208e52[_0x5340('0x30')],'type':_0x208e52[_0x5340('0x31')]['key']};});_0x452ef9[_0x5340('0x32')]=_[_0x5340('0x2e')](_0x2f6ef1,_0x5340('0x2c'));_0x452ef9['query']=_[_0x5340('0x33')](_0x280cd3[_0x5340('0x34')]);_0x452ef9[_0x5340('0x35')]=_[_0x5340('0x36')](_0x452ef9[_0x5340('0x32')],_0x452ef9[_0x5340('0x34')]);_0x40ab3d[_0x5340('0x37')]=_[_0x5340('0x36')](_0x452ef9[_0x5340('0x32')],qs['fields'](_0x280cd3[_0x5340('0x34')][_0x5340('0x38')]));_0x40ab3d[_0x5340('0x37')]=_0x40ab3d[_0x5340('0x37')]['length']?_0x40ab3d[_0x5340('0x37')]:_0x452ef9['model'];if(!_0x280cd3['query'][_0x5340('0x39')](_0x5340('0x3a'))){_0x40ab3d['limit']=qs[_0x5340('0x23')](_0x280cd3[_0x5340('0x34')][_0x5340('0x23')]);_0x40ab3d[_0x5340('0x21')]=qs[_0x5340('0x21')](_0x280cd3[_0x5340('0x34')][_0x5340('0x21')]);}_0x40ab3d[_0x5340('0x3b')]=qs['sort'](_0x280cd3['query']['sort']);_0x40ab3d[_0x5340('0x3c')]=qs[_0x5340('0x35')](_['pick'](_0x280cd3['query'],_0x452ef9[_0x5340('0x35')]),_0x2f6ef1);if(_0x280cd3[_0x5340('0x34')][_0x5340('0x3d')]){_0x40ab3d[_0x5340('0x3c')]=_[_0x5340('0x3e')](_0x40ab3d[_0x5340('0x3c')],{'$or':_['map'](_0x2f6ef1,function(_0x43a67b){if(_0x43a67b[_0x5340('0x31')]!==_0x5340('0x3f')){var _0x39a223={};_0x39a223[_0x43a67b[_0x5340('0x2c')]]={'$like':'%'+_0x280cd3['query']['filter']+'%'};return _0x39a223;}})});}_0x40ab3d=_[_0x5340('0x3e')]({},_0x40ab3d,_0x280cd3[_0x5340('0x40')]);var _0x132011={'where':_0x40ab3d[_0x5340('0x3c')]};return db[_0x5340('0x41')][_0x5340('0x24')](_0x132011)['then'](function(_0x2ea7de){_0x752ee4[_0x5340('0x24')]=_0x2ea7de;if(_0x280cd3[_0x5340('0x34')][_0x5340('0x42')]){_0x40ab3d[_0x5340('0x43')]=[{'all':!![]}];}return db[_0x5340('0x41')][_0x5340('0x44')](_0x40ab3d);})[_0x5340('0x15')](function(_0x987455){_0x752ee4[_0x5340('0x45')]=_0x987455;return _0x752ee4;})[_0x5340('0x15')](respondWithFilteredResult(_0x1d9838,_0x40ab3d))[_0x5340('0x1f')](handleError(_0x1d9838,null));};exports[_0x5340('0x46')]=function(_0x5356ce,_0x52e534){var _0x216d8f={'raw':!![],'where':{'id':_0x5356ce[_0x5340('0x47')]['id']}},_0x42ba61={};_0x42ba61['model']=_[_0x5340('0x33')](db[_0x5340('0x41')]['rawAttributes']);_0x42ba61['query']=_[_0x5340('0x33')](_0x5356ce[_0x5340('0x34')]);_0x42ba61[_0x5340('0x35')]=_['intersection'](_0x42ba61[_0x5340('0x32')],_0x42ba61[_0x5340('0x34')]);_0x216d8f[_0x5340('0x37')]=_[_0x5340('0x36')](_0x42ba61['model'],qs[_0x5340('0x38')](_0x5356ce['query'][_0x5340('0x38')]));_0x216d8f['attributes']=_0x216d8f[_0x5340('0x37')]['length']?_0x216d8f[_0x5340('0x37')]:_0x42ba61[_0x5340('0x32')];if(_0x5356ce[_0x5340('0x34')][_0x5340('0x42')]){_0x216d8f[_0x5340('0x43')]=[{'all':!![]}];}_0x216d8f=_['merge']({},_0x216d8f,_0x5356ce['options']);return db[_0x5340('0x41')][_0x5340('0x48')](_0x216d8f)[_0x5340('0x15')](handleEntityNotFound(_0x52e534,null))['then'](respondWithResult(_0x52e534,null))[_0x5340('0x1f')](handleError(_0x52e534,null));};exports['update']=function(_0x2b79fe,_0x515085){if(_0x2b79fe[_0x5340('0x49')]['id']){delete _0x2b79fe[_0x5340('0x49')]['id'];}return db[_0x5340('0x41')]['find']({'where':{'id':_0x2b79fe[_0x5340('0x47')]['id']}})[_0x5340('0x15')](handleEntityNotFound(_0x515085,null))[_0x5340('0x15')](saveUpdates(_0x2b79fe[_0x5340('0x49')],null))[_0x5340('0x15')](respondWithResult(_0x515085,null))['catch'](handleError(_0x515085,null));};exports['destroy']=function(_0x542721,_0x502026){return db[_0x5340('0x41')][_0x5340('0x48')]({'where':{'id':_0x542721['params']['id']}})[_0x5340('0x15')](handleEntityNotFound(_0x502026,null))[_0x5340('0x15')](removeEntity(_0x502026,null))['catch'](handleError(_0x502026,null));};exports['describe']=function(_0x30226d,_0x2dd598){return db[_0x5340('0x41')][_0x5340('0x4a')]()[_0x5340('0x15')](respondWithResult(_0x2dd598,null))['catch'](handleError(_0x2dd598,null));};exports[_0x5340('0x4b')]=function(_0x49444c,_0x535c26){return db[_0x5340('0x41')][_0x5340('0x4b')](_0x49444c['body'])[_0x5340('0x15')](function(_0x3c6b11){if(_0x3c6b11){if(_0x3c6b11['direction']===_0x5340('0x4c')&&!_0x3c6b11[_0x5340('0x4d')]){var _0x29684a,_0x5b5993,_0x5b9022;if(_0x49444c[_0x5340('0x49')]['to']){_0x5b5993=_0x49444c[_0x5340('0x49')]['to'][_0x5340('0x4e')](',')[0x0];}return db[_0x5340('0x4f')][_0x5340('0x50')]({'where':{'id':_0x3c6b11[_0x5340('0x51')]},'include':[{'model':db[_0x5340('0x52')],'as':_0x5340('0x53'),'include':[{'model':db[_0x5340('0x54')],'as':'Contacts','where':{'email':_0x5b5993},'limit':0x1,'order':[[_0x5340('0x55'),'DESC']]}]},{'model':db[_0x5340('0x56')],'as':_0x5340('0x57'),'raw':!![],'include':[{'model':db[_0x5340('0x58')],'as':_0x5340('0x58'),'raw':!![]}]}]})[_0x5340('0x15')](function(_0x24b88f){_0x29684a=_0x24b88f;if(!_0x29684a||!_0x29684a[_0x5340('0x57')])return;var _0x37c36f=_0x29684a[_0x5340('0x59')]();if(_0x49444c['body']['attachments']&&_0x49444c[_0x5340('0x49')]['attachments'][_0x5340('0x5a')]){for(var _0x1ab05e=0x0;_0x1ab05e<_0x49444c[_0x5340('0x49')]['attachments'][_0x5340('0x5a')];_0x1ab05e+=0x1){_0x49444c[_0x5340('0x49')][_0x5340('0x5b')][_0x1ab05e]={'filename':_0x49444c[_0x5340('0x49')]['attachments'][_0x1ab05e][_0x5340('0x2c')],'path':path['join'](config[_0x5340('0x5c')],_0x5340('0x5d'),_0x49444c[_0x5340('0x49')]['attachments'][_0x1ab05e][_0x5340('0x5e')])};}}_0x5b9022={'account':_0x37c36f,'message':_0x49444c[_0x5340('0x49')]};return;})[_0x5340('0x15')](function(){if(_0x29684a[_0x5340('0x53')]){if(_0x29684a[_0x5340('0x53')][_0x5340('0x5f')][_0x5340('0x5a')]){return _0x29684a[_0x5340('0x53')]['Contacts'][0x0];}else{return db[_0x5340('0x54')]['create'](_[_0x5340('0xb')](_0x49444c['body'],{'firstName':_0x49444c[_0x5340('0x49')]['to'],'email':_0x49444c[_0x5340('0x49')]['to'],'phone':_0x49444c[_0x5340('0x49')]['to'],'ListId':_0x29684a[_0x5340('0x60')]}));}}else{throw new Error(_0x5340('0x61'));}})[_0x5340('0x15')](function(){if(_0x5b9022){return respondWithRpcPromise(_0x5340('0x62'),'sendMail',_0x5b9022,client9003)['then'](function(_0x1db355){return _0x3c6b11[_0x5340('0x28')]({'read':!![],'messageId':_0x1db355[_0x5340('0x63')],'sentAt':moment()[_0x5340('0x64')](_0x5340('0x65'))});})[_0x5340('0x1f')](function(_0x5ec013){logger[_0x5340('0x1b')]('%s',JSON[_0x5340('0x1a')](_0x5ec013));return _0x3c6b11;});}return _0x3c6b11;});}return _0x3c6b11;}})[_0x5340('0x15')](respondWithResult(_0x535c26,0xc9))['catch'](handleError(_0x535c26,null));};exports[_0x5340('0x66')]=function(_0x58e667,_0xf59831){var _0x246162={'agent':{},'channel':_0x5340('0x67')};if(_0x58e667[_0x5340('0x49')]['id']){delete _0x58e667['body']['id'];}_0x58e667[_0x5340('0x49')][_0x5340('0x68')]=!![];_0x58e667['body'][_0x5340('0x69')]=moment()[_0x5340('0x64')](_0x5340('0x65'));_0x58e667[_0x5340('0x49')]['UserId']=_0x58e667[_0x5340('0x49')][_0x5340('0x6a')]||_0x58e667['user']['id'];_0x246162[_0x5340('0x6b')]['id']=_0x58e667[_0x5340('0x49')][_0x5340('0x6a')];return db[_0x5340('0x41')][_0x5340('0x48')]({'where':{'id':_0x58e667[_0x5340('0x47')]['id'],'UserId':null}})[_0x5340('0x15')](handleEntityNotFound(_0xf59831,null))['then'](saveUpdates(_0x58e667[_0x5340('0x49')],null))[_0x5340('0x15')](function(_0x2783fd){if(_0x2783fd){_0x246162[_0x5340('0x1c')]=_0x2783fd[_0x5340('0x6c')]({'plain':!![]});return db[_0x5340('0x6d')][_0x5340('0x48')]({'where':{'id':_0x2783fd[_0x5340('0x6e')]}});}return null;})['then'](handleEntityNotFound(_0xf59831,null))[_0x5340('0x15')](function(_0x3affec){if(_0x3affec){return _0x3affec[_0x5340('0x28')]({'UserId':_0x58e667[_0x5340('0x49')][_0x5340('0x6a')],'read1stAt':_[_0x5340('0x6f')](_0x3affec[_0x5340('0x70')])?moment()[_0x5340('0x64')](_0x5340('0x65')):undefined});}return null;})[_0x5340('0x15')](function(_0xf0583b){if(_0xf0583b){_0x246162[_0x5340('0x71')]=_0xf0583b[_0x5340('0x6c')]({'plain':!![]});interaction_log[_0x5340('0x16')](_0x5340('0x72'),_0x58e667['user']['id'],_0x58e667[_0x5340('0x73')][_0x5340('0x2c')],_0x58e667['user'][_0x5340('0x74')],_0x246162[_0x5340('0x71')]['id'],_0x58e667['body']?JSON['stringify'](_0x58e667[_0x5340('0x49')]):_0x5340('0x75'));return respondWithRpcPromise(_0x5340('0x76'),_0x5340('0x77'),_0x246162);}return null;})[_0x5340('0x15')](function(_0x171401){var _0x444d6c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x171401[_0x5340('0x1c')]['ContactId'];return db['sequelize'][_0x5340('0x34')](_0x444d6c,{'type':db[_0x5340('0x78')]['QueryTypes'][_0x5340('0x79')],'raw':!![]})[_0x5340('0x15')](function(_0x214725){return _0x214725;});})[_0x5340('0x15')](function(_0x477edb){if(_0x477edb){_0x246162[_0x5340('0x1c')][_0x5340('0x7a')]=_0x477edb[0x0];if(!_0x58e667['body']['UserId'])return;return db[_0x5340('0x7b')][_0x5340('0x48')]({'where':{'id':_0x58e667['body'][_0x5340('0x6a')],'role':_0x5340('0x6b')},'attributes':['id',_0x5340('0x2c'),'fullname','email',_0x5340('0x7c')],'raw':!![]});}return null;})[_0x5340('0x15')](function(_0x54bb9a){if(!_0x54bb9a)return null;_0x246162['message'][_0x5340('0x6b')]=_0x54bb9a;return _0x246162;})[_0x5340('0x15')](function(_0x48939c){if(_0x48939c){if(_0x58e667[_0x5340('0x49')][_0x5340('0x7d')]){_0x246162['message'][_0x5340('0x7e')]=util[_0x5340('0x64')](_0x5340('0x7f'),_0x58e667[_0x5340('0x73')][_0x5340('0x2c')]);_0x246162[_0x5340('0x1c')]['channel']=_0x246162[_0x5340('0x80')];_0x246162['message'][_0x5340('0x81')]=_0x246162[_0x5340('0x80')];_0x246162['message'][_0x5340('0x82')]='accept';_0x246162[_0x5340('0x1c')][_0x5340('0x49')]=htmlToText[_0x5340('0x83')](_0x246162[_0x5340('0x1c')]['body']);return respondWithRpcPromise(_0x5340('0x84'),_0x5340('0x84'),{'event':_0x5340('0x85'),'message':_0x246162[_0x5340('0x1c')]},client9002)[_0x5340('0x15')](function(){return _0x246162;});}return _0x246162;}return null;})[_0x5340('0x15')](respondWithResult(_0xf59831,null))[_0x5340('0x1f')](handleError(_0xf59831,null));};exports[_0x5340('0x86')]=function(_0x1256b6,_0x2bffb3){var _0x4362af={'agent':{},'channel':_0x5340('0x67')};if(_0x1256b6[_0x5340('0x49')]['id']){delete _0x1256b6[_0x5340('0x49')]['id'];}_0x1256b6[_0x5340('0x49')]['UserId']=_0x1256b6[_0x5340('0x49')]['UserId']||_0x1256b6[_0x5340('0x73')]['id'];_0x4362af[_0x5340('0x6b')]['id']=_0x1256b6[_0x5340('0x49')]['UserId'];return db[_0x5340('0x41')][_0x5340('0x48')]({'where':{'id':_0x1256b6[_0x5340('0x47')]['id'],'UserId':null}})[_0x5340('0x15')](handleEntityNotFound(_0x2bffb3,null))[_0x5340('0x15')](function(_0x1d47e6){if(_0x1d47e6){_0x4362af[_0x5340('0x1c')]=_0x1d47e6['get']({'plain':!![]});return db[_0x5340('0x6d')][_0x5340('0x48')]({'where':{'id':_0x1d47e6[_0x5340('0x6e')]}});}return null;})[_0x5340('0x15')](handleEntityNotFound(_0x2bffb3,null))[_0x5340('0x15')](function(_0x3e8572){if(_0x3e8572){_0x4362af[_0x5340('0x71')]=_0x3e8572[_0x5340('0x6c')]({'plain':!![]});interaction_log[_0x5340('0x16')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1256b6[_0x5340('0x73')]['id'],_0x1256b6[_0x5340('0x73')][_0x5340('0x2c')],_0x1256b6[_0x5340('0x73')][_0x5340('0x74')],_0x4362af[_0x5340('0x71')]['id'],_0x1256b6[_0x5340('0x49')]?JSON[_0x5340('0x1a')](_0x1256b6['body']):_0x5340('0x75'));return respondWithRpcPromise(_0x5340('0x87'),_0x5340('0x88'),_0x4362af);}return null;})[_0x5340('0x15')](function(_0x5b2f7a){var _0x19e54e=_0x5340('0x89')+_0x5b2f7a[_0x5340('0x1c')][_0x5340('0x8a')];return db[_0x5340('0x8b')][_0x5340('0x34')](_0x19e54e,{'type':db['Sequelize'][_0x5340('0x8c')][_0x5340('0x79')],'raw':!![]})['then'](function(_0x40b591){return _0x40b591;});})[_0x5340('0x15')](function(_0x3610ee){if(_0x3610ee){_0x4362af['message'][_0x5340('0x7a')]=_0x3610ee[0x0];if(!_0x1256b6[_0x5340('0x49')][_0x5340('0x6a')])return;return db['User'][_0x5340('0x48')]({'where':{'id':_0x1256b6['body'][_0x5340('0x6a')],'role':_0x5340('0x6b')},'attributes':['id',_0x5340('0x2c'),_0x5340('0x8d'),_0x5340('0x8e'),_0x5340('0x7c')],'raw':!![]});}return null;})[_0x5340('0x15')](function(_0x2fd674){if(!_0x2fd674)return null;_0x4362af[_0x5340('0x1c')][_0x5340('0x6b')]=_0x2fd674;return _0x4362af;})[_0x5340('0x15')](function(_0x28a1ce){if(_0x28a1ce){_0x28a1ce[_0x5340('0x1c')][_0x5340('0x7e')]=util['format'](_0x5340('0x7f'),_0x1256b6[_0x5340('0x73')][_0x5340('0x2c')]);_0x28a1ce[_0x5340('0x1c')][_0x5340('0x80')]=_0x4362af['channel'];_0x28a1ce[_0x5340('0x1c')][_0x5340('0x81')]=_0x4362af[_0x5340('0x80')];_0x28a1ce[_0x5340('0x1c')]['event']=_0x5340('0x86');_0x28a1ce['message']['body']=htmlToText['fromString'](_0x4362af[_0x5340('0x1c')][_0x5340('0x49')]);respondWithRpcPromise(_0x5340('0x84'),_0x5340('0x84'),{'event':_0x5340('0x8f'),'message':_0x28a1ce[_0x5340('0x1c')]},client9002);return _0x4362af;}return null;})[_0x5340('0x15')](respondWithResult(_0x2bffb3,null))['catch'](handleError(_0x2bffb3,null));};exports['download']=function(_0x152693,_0x579b9c){var _0x43cf08=moment()[_0x5340('0x90')]()[_0x5340('0x91')]();var _0x3a07f9=path[_0x5340('0x92')](config[_0x5340('0x5c')],_0x5340('0x93'),_0x5340('0x94'),'tmp');var _0x5c2a64=path[_0x5340('0x92')](config[_0x5340('0x5c')],'server',_0x5340('0x94'),_0x5340('0x5b'));var _0x37eabb=util['format'](_0x5340('0x95'),_0x43cf08);return db[_0x5340('0x41')][_0x5340('0x48')]({'where':{'id':_0x152693[_0x5340('0x47')]['id']},'attributes':['id',_0x5340('0x49'),'from','to','cc',_0x5340('0x96'),_0x5340('0x97'),'createdAt'],'include':_0x152693[_0x5340('0x34')][_0x5340('0x5b')]?[{'model':db[_0x5340('0x98')],'as':_0x5340('0x99')}]:undefined})[_0x5340('0x15')](handleEntityNotFound(_0x579b9c,null))[_0x5340('0x15')](function(_0x26142e){if(_0x26142e){var _0x37d7ac=_0x26142e;var _0x305de0={'from':_0x37d7ac[_0x5340('0x9a')],'to':_0x37d7ac['to'],'subject':_0x37d7ac['subject'],'html':htmlEntities['decode'](_0x37d7ac['body']),'headers':{'Date':moment(_0x37d7ac[_0x5340('0x9b')])[_0x5340('0x64')](_0x5340('0x9c'))},'attachments':[]};if(_0x26142e['cc']){_0x305de0[_0x5340('0x9d')]['Cc']=_0x26142e['cc'];}if(_0x26142e[_0x5340('0x96')]){_0x305de0[_0x5340('0x9d')][_0x5340('0x9e')]=_0x26142e[_0x5340('0x96')];}return new BPromise(function(_0x496cfb,_0x3146f8){if(_0x26142e[_0x5340('0x99')]){for(var _0x2bc34d=0x0;_0x2bc34d<_0x26142e[_0x5340('0x99')][_0x5340('0x5a')];_0x2bc34d++){var _0x4d95b3=_0x26142e['Attachments'][_0x2bc34d];var _0x1448da=path[_0x5340('0x92')](_0x5c2a64,_0x4d95b3[_0x5340('0x5e')]);if(fs[_0x5340('0x9f')](_0x1448da)){_0x305de0[_0x5340('0x5b')]['push']({'name':_0x4d95b3['name'],'contentType':_0x4d95b3[_0x5340('0x31')],'data':fs[_0x5340('0xa0')](_0x1448da)});}}}emlformat[_0x5340('0xa1')](_0x305de0,function(_0x1da1b4,_0x33c8e8){if(_0x1da1b4)return _0x3146f8(_0x1da1b4);fs[_0x5340('0xa2')](path[_0x5340('0x92')](_0x3a07f9,_0x37eabb),_0x33c8e8);return _0x496cfb(_0x33c8e8);});});}})[_0x5340('0x15')](function(_0x212b32){if(_0x212b32){return _0x579b9c['download'](path[_0x5340('0x92')](_0x3a07f9,_0x37eabb),_0x37eabb,function(_0x4e6c7a){if(!_0x4e6c7a)fs[_0x5340('0xa3')](path[_0x5340('0x92')](_0x3a07f9,_0x37eabb));});}})[_0x5340('0x1f')](handleError(_0x579b9c,null));}; \ No newline at end of file +var _0x6599=['eml-format','bluebird','util','path','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','MailMessage','findAll','filters','include','options','find','params','body','describe','create','MailAccount','MailAccountId','CmList','List','CmContact','Contacts','DESC','Smtp','attachments','root','basename','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','UserId','user','agent','get','MailInteraction','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','download','toString','join','server','files','message-%s.eml','from','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','existsSync','writeFileSync'];(function(_0x4a0a7f,_0x403791){var _0x18c10f=function(_0x43ec84){while(--_0x43ec84){_0x4a0a7f['push'](_0x4a0a7f['shift']());}};_0x18c10f(++_0x403791);}(_0x6599,0x95));var _0x9659=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x6599[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0x9659('0x0'));var moment=require('moment');var BPromise=require(_0x9659('0x1'));var util=require(_0x9659('0x2'));var path=require(_0x9659('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var htmlToText=require(_0x9659('0x4'));var qs=require(_0x9659('0x5'));var logger=require(_0x9659('0x6'))(_0x9659('0x7'));var interaction_log=require(_0x9659('0x6'))(_0x9659('0x8'));var config=require('../../config/environment');var db=require(_0x9659('0x9'))['db'];config[_0x9659('0xa')]=_['defaults'](config['redis'],{'host':_0x9659('0xb'),'port':0x18eb});var socket=require(_0x9659('0xc'))(new Redis(config[_0x9659('0xa')]));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0x9659('0xd')](socket);var jayson=require(_0x9659('0xe'));var client=jayson[_0x9659('0xf')][_0x9659('0x10')]({'port':0x232c});var client9003=jayson[_0x9659('0xf')][_0x9659('0x10')]({'port':0x232b});var client9002=jayson['client'][_0x9659('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x5dbc3d,_0x8da465,_0x1f80bd,_0x5385c4){return new BPromise(function(_0x5a5b8a,_0x328b24){var _0x240e6c=_0x5385c4||client;return _0x240e6c[_0x9659('0x11')](_0x5dbc3d,_0x1f80bd)['then'](function(_0x338ad5){logger[_0x9659('0x12')](_0x9659('0x13'),_0x8da465,'request\x20sent');logger[_0x9659('0x14')](_0x9659('0x15'),_0x8da465,_0x9659('0x16'),JSON[_0x9659('0x17')](_0x338ad5));if(_0x338ad5['error']){if(_0x338ad5[_0x9659('0x18')][_0x9659('0x19')]===0x1f4){logger[_0x9659('0x18')]('MailMessage,\x20%s,\x20%s',_0x8da465,_0x338ad5['error']['message']);return _0x328b24(_0x338ad5['error'][_0x9659('0x1a')]);}logger[_0x9659('0x18')](_0x9659('0x13'),_0x8da465,_0x338ad5[_0x9659('0x18')][_0x9659('0x1a')]);return _0x5a5b8a(_0x338ad5['error'][_0x9659('0x1a')]);}else{logger[_0x9659('0x12')](_0x9659('0x13'),_0x8da465,'request\x20sent');_0x5a5b8a(_0x338ad5[_0x9659('0x1b')][_0x9659('0x1a')]);}})[_0x9659('0x1c')](function(_0x3794de){logger[_0x9659('0x18')]('MailMessage,\x20%s,\x20%s',_0x8da465,_0x3794de);_0x328b24(_0x3794de);});});}function respondWithResult(_0x1acc43,_0x122286){_0x122286=_0x122286||0xc8;return function(_0x199d0a){if(_0x199d0a){return _0x1acc43[_0x9659('0x1d')](_0x122286)[_0x9659('0x1e')](_0x199d0a);}};}function respondWithFilteredResult(_0x495919,_0x3033bb){return function(_0x4d8d27){if(_0x4d8d27){var _0x3708bf=typeof _0x3033bb['offset']===_0x9659('0x1f')&&typeof _0x3033bb[_0x9659('0x20')]==='undefined';var _0x338388=_0x4d8d27[_0x9659('0x21')];var _0x25634c=_0x3708bf?0x0:_0x3033bb[_0x9659('0x22')];var _0x5cdfd6=_0x3708bf?_0x4d8d27[_0x9659('0x21')]:_0x3033bb[_0x9659('0x22')]+_0x3033bb[_0x9659('0x20')];var _0x3ff79a;if(_0x5cdfd6>=_0x338388){_0x5cdfd6=_0x338388;_0x3ff79a=0xc8;}else{_0x3ff79a=0xce;}_0x495919[_0x9659('0x1d')](_0x3ff79a);return _0x495919[_0x9659('0x23')](_0x9659('0x24'),_0x25634c+'-'+_0x5cdfd6+'/'+_0x338388)[_0x9659('0x1e')](_0x4d8d27);}return null;};}function saveUpdates(_0x45312d){return function(_0x40a41d){if(_0x40a41d){return _0x40a41d[_0x9659('0x25')](_0x45312d)[_0x9659('0x26')](function(_0x5630a8){return _0x5630a8;});}return null;};}function removeEntity(_0x486965){return function(_0x46e3be){if(_0x46e3be){return _0x46e3be[_0x9659('0x27')]()[_0x9659('0x26')](function(){_0x486965[_0x9659('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11f241){return function(_0x43b6ff){if(!_0x43b6ff){_0x11f241[_0x9659('0x28')](0x194);}return _0x43b6ff;};}function handleError(_0x2b8241,_0x58e204){_0x58e204=_0x58e204||0x1f4;return function(_0x126f26){logger[_0x9659('0x18')](_0x126f26[_0x9659('0x29')]);if(_0x126f26[_0x9659('0x2a')]){delete _0x126f26[_0x9659('0x2a')];}_0x2b8241[_0x9659('0x1d')](_0x58e204)[_0x9659('0x2b')](_0x126f26);};}exports[_0x9659('0x2c')]=function(_0x1c6d35,_0x1fe045){var _0x3a2801={},_0x44f622={},_0x38f58e={'count':0x0,'rows':[]};var _0x794b18=_[_0x9659('0x2d')](db['MailMessage'][_0x9659('0x2e')],function(_0x2023b5){return{'name':_0x2023b5[_0x9659('0x2f')],'type':_0x2023b5['type'][_0x9659('0x30')]};});_0x44f622[_0x9659('0x31')]=_[_0x9659('0x2d')](_0x794b18,_0x9659('0x2a'));_0x44f622[_0x9659('0x32')]=_[_0x9659('0x33')](_0x1c6d35[_0x9659('0x32')]);_0x44f622['filters']=_[_0x9659('0x34')](_0x44f622[_0x9659('0x31')],_0x44f622[_0x9659('0x32')]);_0x3a2801[_0x9659('0x35')]=_[_0x9659('0x34')](_0x44f622[_0x9659('0x31')],qs['fields'](_0x1c6d35[_0x9659('0x32')][_0x9659('0x36')]));_0x3a2801['attributes']=_0x3a2801[_0x9659('0x35')][_0x9659('0x37')]?_0x3a2801['attributes']:_0x44f622[_0x9659('0x31')];if(!_0x1c6d35['query'][_0x9659('0x38')](_0x9659('0x39'))){_0x3a2801[_0x9659('0x20')]=qs['limit'](_0x1c6d35['query'][_0x9659('0x20')]);_0x3a2801[_0x9659('0x22')]=qs[_0x9659('0x22')](_0x1c6d35[_0x9659('0x32')][_0x9659('0x22')]);}_0x3a2801[_0x9659('0x3a')]=qs[_0x9659('0x3b')](_0x1c6d35[_0x9659('0x32')][_0x9659('0x3b')]);_0x3a2801[_0x9659('0x3c')]=qs['filters'](_[_0x9659('0x3d')](_0x1c6d35['query'],_0x44f622['filters']),_0x794b18);if(_0x1c6d35['query'][_0x9659('0x3e')]){_0x3a2801[_0x9659('0x3c')]=_[_0x9659('0x3f')](_0x3a2801[_0x9659('0x3c')],{'$or':_[_0x9659('0x2d')](_0x794b18,function(_0x36a3f6){if(_0x36a3f6[_0x9659('0x40')]!==_0x9659('0x41')){var _0x26b257={};_0x26b257[_0x36a3f6[_0x9659('0x2a')]]={'$like':'%'+_0x1c6d35[_0x9659('0x32')][_0x9659('0x3e')]+'%'};return _0x26b257;}})});}_0x3a2801=_[_0x9659('0x3f')]({},_0x3a2801,_0x1c6d35['options']);var _0x176cc0={'where':_0x3a2801[_0x9659('0x3c')]};return db['MailMessage']['count'](_0x176cc0)[_0x9659('0x26')](function(_0xee81ef){_0x38f58e[_0x9659('0x21')]=_0xee81ef;if(_0x1c6d35[_0x9659('0x32')][_0x9659('0x42')]){_0x3a2801['include']=[{'all':!![]}];}return db[_0x9659('0x43')][_0x9659('0x44')](_0x3a2801);})['then'](function(_0x351d93){_0x38f58e['rows']=_0x351d93;return _0x38f58e;})[_0x9659('0x26')](respondWithFilteredResult(_0x1fe045,_0x3a2801))[_0x9659('0x1c')](handleError(_0x1fe045,null));};exports['show']=function(_0x1c5dc1,_0x2c31bc){var _0x174986={'raw':!![],'where':{'id':_0x1c5dc1['params']['id']}},_0xe78823={};_0xe78823[_0x9659('0x31')]=_[_0x9659('0x33')](db[_0x9659('0x43')][_0x9659('0x2e')]);_0xe78823[_0x9659('0x32')]=_[_0x9659('0x33')](_0x1c5dc1[_0x9659('0x32')]);_0xe78823[_0x9659('0x45')]=_[_0x9659('0x34')](_0xe78823[_0x9659('0x31')],_0xe78823[_0x9659('0x32')]);_0x174986[_0x9659('0x35')]=_[_0x9659('0x34')](_0xe78823[_0x9659('0x31')],qs[_0x9659('0x36')](_0x1c5dc1[_0x9659('0x32')][_0x9659('0x36')]));_0x174986[_0x9659('0x35')]=_0x174986[_0x9659('0x35')]['length']?_0x174986[_0x9659('0x35')]:_0xe78823[_0x9659('0x31')];if(_0x1c5dc1[_0x9659('0x32')][_0x9659('0x42')]){_0x174986[_0x9659('0x46')]=[{'all':!![]}];}_0x174986=_[_0x9659('0x3f')]({},_0x174986,_0x1c5dc1[_0x9659('0x47')]);return db[_0x9659('0x43')][_0x9659('0x48')](_0x174986)[_0x9659('0x26')](handleEntityNotFound(_0x2c31bc,null))['then'](respondWithResult(_0x2c31bc,null))[_0x9659('0x1c')](handleError(_0x2c31bc,null));};exports[_0x9659('0x25')]=function(_0x542f28,_0x2cca24){if(_0x542f28['body']['id']){delete _0x542f28['body']['id'];}return db[_0x9659('0x43')][_0x9659('0x48')]({'where':{'id':_0x542f28[_0x9659('0x49')]['id']}})['then'](handleEntityNotFound(_0x2cca24,null))[_0x9659('0x26')](saveUpdates(_0x542f28[_0x9659('0x4a')],null))[_0x9659('0x26')](respondWithResult(_0x2cca24,null))[_0x9659('0x1c')](handleError(_0x2cca24,null));};exports[_0x9659('0x27')]=function(_0x4844da,_0x446b29){return db[_0x9659('0x43')][_0x9659('0x48')]({'where':{'id':_0x4844da['params']['id']}})['then'](handleEntityNotFound(_0x446b29,null))[_0x9659('0x26')](removeEntity(_0x446b29,null))['catch'](handleError(_0x446b29,null));};exports[_0x9659('0x4b')]=function(_0x27a709,_0x22e4c3){return db[_0x9659('0x43')][_0x9659('0x4b')]()[_0x9659('0x26')](respondWithResult(_0x22e4c3,null))['catch'](handleError(_0x22e4c3,null));};exports[_0x9659('0x4c')]=function(_0x4b7c29,_0x4b9bfd){return db['MailMessage'][_0x9659('0x4c')](_0x4b7c29[_0x9659('0x4a')])[_0x9659('0x26')](function(_0x495cbe){if(_0x495cbe){if(_0x495cbe['direction']==='out'&&!_0x495cbe['secret']){var _0x144190,_0x56db0d,_0x4ed1f6;if(_0x4b7c29[_0x9659('0x4a')]['to']){_0x56db0d=_0x4b7c29[_0x9659('0x4a')]['to']['split'](',')[0x0];}return db[_0x9659('0x4d')]['findOne']({'where':{'id':_0x495cbe[_0x9659('0x4e')]},'include':[{'model':db[_0x9659('0x4f')],'as':_0x9659('0x50'),'include':[{'model':db[_0x9659('0x51')],'as':_0x9659('0x52'),'where':{'email':_0x56db0d},'limit':0x1,'order':[['updatedAt',_0x9659('0x53')]]}]},{'model':db['MailServerOut'],'as':_0x9659('0x54'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x105241){_0x144190=_0x105241;if(!_0x144190||!_0x144190['Smtp'])return;var _0x318ae6=_0x144190['getSmtpOptions']();if(_0x4b7c29['body']['attachments']&&_0x4b7c29[_0x9659('0x4a')][_0x9659('0x55')][_0x9659('0x37')]){for(var _0x41e337=0x0;_0x41e337<_0x4b7c29[_0x9659('0x4a')][_0x9659('0x55')]['length'];_0x41e337+=0x1){_0x4b7c29[_0x9659('0x4a')][_0x9659('0x55')][_0x41e337]={'filename':_0x4b7c29[_0x9659('0x4a')][_0x9659('0x55')][_0x41e337][_0x9659('0x2a')],'path':path['join'](config[_0x9659('0x56')],'server/files/attachments',_0x4b7c29[_0x9659('0x4a')][_0x9659('0x55')][_0x41e337][_0x9659('0x57')])};}}_0x4ed1f6={'account':_0x318ae6,'message':_0x4b7c29[_0x9659('0x4a')]};return;})[_0x9659('0x26')](function(){if(_0x144190[_0x9659('0x50')]){if(_0x144190[_0x9659('0x50')][_0x9659('0x52')][_0x9659('0x37')]){return _0x144190['List'][_0x9659('0x52')][0x0];}else{return db[_0x9659('0x51')][_0x9659('0x4c')](_['defaults'](_0x4b7c29[_0x9659('0x4a')],{'firstName':_0x4b7c29[_0x9659('0x4a')]['to'],'email':_0x4b7c29['body']['to'],'phone':_0x4b7c29[_0x9659('0x4a')]['to'],'ListId':_0x144190[_0x9659('0x58')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x9659('0x26')](function(){if(_0x4ed1f6){return respondWithRpcPromise(_0x9659('0x59'),_0x9659('0x5a'),_0x4ed1f6,client9003)[_0x9659('0x26')](function(_0x1544df){return _0x495cbe[_0x9659('0x25')]({'read':!![],'messageId':_0x1544df[_0x9659('0x5b')],'sentAt':moment()[_0x9659('0x5c')](_0x9659('0x5d'))});})['catch'](function(_0x25be13){logger[_0x9659('0x18')]('%s',JSON[_0x9659('0x17')](_0x25be13));return _0x495cbe;});}return _0x495cbe;});}return _0x495cbe;}})[_0x9659('0x26')](respondWithResult(_0x4b9bfd,0xc9))[_0x9659('0x1c')](handleError(_0x4b9bfd,null));};exports[_0x9659('0x5e')]=function(_0x3deaf3,_0x1e7ef8){var _0x1c6f4e={'agent':{},'channel':'mail'};if(_0x3deaf3[_0x9659('0x4a')]['id']){delete _0x3deaf3['body']['id'];}_0x3deaf3[_0x9659('0x4a')][_0x9659('0x5f')]=!![];_0x3deaf3[_0x9659('0x4a')][_0x9659('0x60')]=moment()[_0x9659('0x5c')](_0x9659('0x5d'));_0x3deaf3[_0x9659('0x4a')]['UserId']=_0x3deaf3[_0x9659('0x4a')][_0x9659('0x61')]||_0x3deaf3[_0x9659('0x62')]['id'];_0x1c6f4e[_0x9659('0x63')]['id']=_0x3deaf3[_0x9659('0x4a')]['UserId'];return db[_0x9659('0x43')][_0x9659('0x48')]({'where':{'id':_0x3deaf3['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1e7ef8,null))[_0x9659('0x26')](saveUpdates(_0x3deaf3[_0x9659('0x4a')],null))['then'](function(_0x580df7){if(_0x580df7){_0x1c6f4e['message']=_0x580df7[_0x9659('0x64')]({'plain':!![]});return db[_0x9659('0x65')][_0x9659('0x48')]({'where':{'id':_0x580df7['MailInteractionId']}});}return null;})[_0x9659('0x26')](handleEntityNotFound(_0x1e7ef8,null))[_0x9659('0x26')](function(_0x4d38ef){if(_0x4d38ef){return _0x4d38ef[_0x9659('0x25')]({'UserId':_0x3deaf3[_0x9659('0x4a')][_0x9659('0x61')],'read1stAt':_[_0x9659('0x66')](_0x4d38ef[_0x9659('0x67')])?moment()['format'](_0x9659('0x5d')):undefined});}return null;})[_0x9659('0x26')](function(_0x147336){if(_0x147336){_0x1c6f4e[_0x9659('0x68')]=_0x147336[_0x9659('0x64')]({'plain':!![]});interaction_log[_0x9659('0x12')](_0x9659('0x69'),_0x3deaf3[_0x9659('0x62')]['id'],_0x3deaf3[_0x9659('0x62')]['name'],_0x3deaf3[_0x9659('0x62')][_0x9659('0x6a')],_0x1c6f4e[_0x9659('0x68')]['id'],_0x3deaf3[_0x9659('0x4a')]?JSON['stringify'](_0x3deaf3[_0x9659('0x4a')]):_0x9659('0x6b'));return respondWithRpcPromise(_0x9659('0x6c'),_0x9659('0x6d'),_0x1c6f4e);}return null;})['then'](function(_0x119581){var _0x2c3e23='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x119581[_0x9659('0x1a')][_0x9659('0x6e')];return db[_0x9659('0x6f')]['query'](_0x2c3e23,{'type':db[_0x9659('0x70')][_0x9659('0x71')][_0x9659('0x72')],'raw':!![]})['then'](function(_0x394832){return _0x394832;});})[_0x9659('0x26')](function(_0x175323){if(_0x175323){_0x1c6f4e[_0x9659('0x1a')][_0x9659('0x73')]=_0x175323[0x0];if(!_0x3deaf3['body'][_0x9659('0x61')])return;return db[_0x9659('0x74')]['find']({'where':{'id':_0x3deaf3[_0x9659('0x4a')][_0x9659('0x61')],'role':'agent'},'attributes':['id',_0x9659('0x2a'),_0x9659('0x75'),_0x9659('0x76'),_0x9659('0x77')],'raw':!![]});}return null;})[_0x9659('0x26')](function(_0x1faf73){if(!_0x1faf73)return null;_0x1c6f4e['message']['agent']=_0x1faf73;return _0x1c6f4e;})[_0x9659('0x26')](function(_0x5243bb){if(_0x5243bb){if(_0x3deaf3['body'][_0x9659('0x78')]){_0x1c6f4e[_0x9659('0x1a')]['interface']=util[_0x9659('0x5c')](_0x9659('0x79'),_0x3deaf3['user']['name']);_0x1c6f4e[_0x9659('0x1a')][_0x9659('0x7a')]=_0x1c6f4e[_0x9659('0x7a')];_0x1c6f4e[_0x9659('0x1a')][_0x9659('0x7b')]=_0x1c6f4e['channel'];_0x1c6f4e[_0x9659('0x1a')][_0x9659('0x7c')]=_0x9659('0x5e');_0x1c6f4e[_0x9659('0x1a')][_0x9659('0x4a')]=htmlToText[_0x9659('0x7d')](_0x1c6f4e[_0x9659('0x1a')][_0x9659('0x4a')]);return respondWithRpcPromise('EventManager',_0x9659('0x7e'),{'event':_0x9659('0x7f'),'message':_0x1c6f4e['message']},client9002)[_0x9659('0x26')](function(){return _0x1c6f4e;});}return _0x1c6f4e;}return null;})[_0x9659('0x26')](respondWithResult(_0x1e7ef8,null))[_0x9659('0x1c')](handleError(_0x1e7ef8,null));};exports[_0x9659('0x80')]=function(_0x4b2e3f,_0x3e45e7){var _0x4a3594={'agent':{},'channel':'mail'};if(_0x4b2e3f['body']['id']){delete _0x4b2e3f[_0x9659('0x4a')]['id'];}_0x4b2e3f['body'][_0x9659('0x61')]=_0x4b2e3f[_0x9659('0x4a')][_0x9659('0x61')]||_0x4b2e3f[_0x9659('0x62')]['id'];_0x4a3594[_0x9659('0x63')]['id']=_0x4b2e3f[_0x9659('0x4a')]['UserId'];return db[_0x9659('0x43')][_0x9659('0x48')]({'where':{'id':_0x4b2e3f[_0x9659('0x49')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3e45e7,null))[_0x9659('0x26')](function(_0x4ed6ea){if(_0x4ed6ea){_0x4a3594[_0x9659('0x1a')]=_0x4ed6ea[_0x9659('0x64')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x4ed6ea['MailInteractionId']}});}return null;})[_0x9659('0x26')](handleEntityNotFound(_0x3e45e7,null))[_0x9659('0x26')](function(_0x5d0f9f){if(_0x5d0f9f){_0x4a3594['interaction']=_0x5d0f9f[_0x9659('0x64')]({'plain':!![]});interaction_log['info'](_0x9659('0x81'),_0x4b2e3f['user']['id'],_0x4b2e3f['user'][_0x9659('0x2a')],_0x4b2e3f[_0x9659('0x62')][_0x9659('0x6a')],_0x4a3594[_0x9659('0x68')]['id'],_0x4b2e3f[_0x9659('0x4a')]?JSON[_0x9659('0x17')](_0x4b2e3f[_0x9659('0x4a')]):_0x9659('0x6b'));return respondWithRpcPromise('RejectMessage',_0x9659('0x82'),_0x4a3594);}return null;})[_0x9659('0x26')](function(_0x1b5cee){var _0xc51fb8=_0x9659('0x83')+_0x1b5cee[_0x9659('0x1a')][_0x9659('0x6e')];return db[_0x9659('0x6f')][_0x9659('0x32')](_0xc51fb8,{'type':db[_0x9659('0x70')][_0x9659('0x71')][_0x9659('0x72')],'raw':!![]})[_0x9659('0x26')](function(_0x4ba2c6){return _0x4ba2c6;});})[_0x9659('0x26')](function(_0x585dbc){if(_0x585dbc){_0x4a3594['message'][_0x9659('0x73')]=_0x585dbc[0x0];if(!_0x4b2e3f[_0x9659('0x4a')][_0x9659('0x61')])return;return db['User'][_0x9659('0x48')]({'where':{'id':_0x4b2e3f['body'][_0x9659('0x61')],'role':_0x9659('0x63')},'attributes':['id',_0x9659('0x2a'),'fullname',_0x9659('0x76'),_0x9659('0x77')],'raw':!![]});}return null;})[_0x9659('0x26')](function(_0x5ae470){if(!_0x5ae470)return null;_0x4a3594['message']['agent']=_0x5ae470;return _0x4a3594;})[_0x9659('0x26')](function(_0x575b71){if(_0x575b71){_0x575b71[_0x9659('0x1a')]['interface']=util['format'](_0x9659('0x79'),_0x4b2e3f[_0x9659('0x62')][_0x9659('0x2a')]);_0x575b71[_0x9659('0x1a')][_0x9659('0x7a')]=_0x4a3594[_0x9659('0x7a')];_0x575b71['message'][_0x9659('0x7b')]=_0x4a3594[_0x9659('0x7a')];_0x575b71['message']['event']=_0x9659('0x80');_0x575b71[_0x9659('0x1a')]['body']=htmlToText['fromString'](_0x4a3594[_0x9659('0x1a')][_0x9659('0x4a')]);respondWithRpcPromise('EventManager',_0x9659('0x7e'),{'event':'rejectmessage','message':_0x575b71[_0x9659('0x1a')]},client9002);return _0x4a3594;}return null;})[_0x9659('0x26')](respondWithResult(_0x3e45e7,null))['catch'](handleError(_0x3e45e7,null));};exports[_0x9659('0x84')]=function(_0x54f88e,_0x15945f){var _0x4bc07e=moment()['unix']()[_0x9659('0x85')]();var _0x52dd39=path[_0x9659('0x86')](config[_0x9659('0x56')],_0x9659('0x87'),_0x9659('0x88'),'tmp');var _0x5f52d0=path[_0x9659('0x86')](config[_0x9659('0x56')],_0x9659('0x87'),_0x9659('0x88'),'attachments');var _0x2c06ff=util[_0x9659('0x5c')](_0x9659('0x89'),_0x4bc07e);return db['MailMessage']['find']({'where':{'id':_0x54f88e[_0x9659('0x49')]['id']},'attributes':['id',_0x9659('0x4a'),_0x9659('0x8a'),'to','cc','bcc',_0x9659('0x8b'),_0x9659('0x8c')],'include':_0x54f88e[_0x9659('0x32')][_0x9659('0x55')]?[{'model':db[_0x9659('0x8d')],'as':_0x9659('0x8e')}]:undefined})[_0x9659('0x26')](handleEntityNotFound(_0x15945f,null))[_0x9659('0x26')](function(_0x50699c){if(_0x50699c){var _0x580262=_0x50699c;var _0x10e9cd={'from':_0x580262[_0x9659('0x8a')],'to':_0x580262['to'],'subject':_0x580262[_0x9659('0x8b')],'html':htmlEntities[_0x9659('0x8f')](_0x580262[_0x9659('0x4a')]),'headers':{'Date':moment(_0x580262[_0x9659('0x8c')])[_0x9659('0x5c')](_0x9659('0x90'))},'attachments':[]};if(_0x50699c['cc']){_0x10e9cd[_0x9659('0x91')]['Cc']=_0x50699c['cc'];}if(_0x50699c[_0x9659('0x92')]){_0x10e9cd[_0x9659('0x91')]['Bcc']=_0x50699c[_0x9659('0x92')];}return new BPromise(function(_0x381321,_0x5788bd){if(_0x50699c[_0x9659('0x8e')]){for(var _0x39aa89=0x0;_0x39aa89<_0x50699c[_0x9659('0x8e')][_0x9659('0x37')];_0x39aa89++){var _0xafbd51=_0x50699c[_0x9659('0x8e')][_0x39aa89];var _0x8b9016=path[_0x9659('0x86')](_0x5f52d0,_0xafbd51['basename']);if(fs[_0x9659('0x93')](_0x8b9016)){_0x10e9cd[_0x9659('0x55')]['push']({'name':_0xafbd51[_0x9659('0x2a')],'contentType':_0xafbd51['type'],'data':fs['readFileSync'](_0x8b9016)});}}}emlformat['build'](_0x10e9cd,function(_0x7280f6,_0x33eaf2){if(_0x7280f6)return _0x5788bd(_0x7280f6);fs[_0x9659('0x94')](path['join'](_0x52dd39,_0x2c06ff),_0x33eaf2);return _0x381321(_0x33eaf2);});});}})[_0x9659('0x26')](function(_0x38d980){if(_0x38d980){return _0x15945f[_0x9659('0x84')](path[_0x9659('0x86')](_0x52dd39,_0x2c06ff),_0x2c06ff,function(_0x4caa22){if(!_0x4caa22)fs['unlinkSync'](path[_0x9659('0x86')](_0x52dd39,_0x2c06ff));});}})[_0x9659('0x1c')](handleError(_0x15945f,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index d0efb90..86d7c5a 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 _0xfeb7=['remove','emit','hasOwnProperty','hook','exports','events','MailMessage','setMaxListeners','save'];(function(_0xa8369a,_0x3d2319){var _0x4b74b7=function(_0x11d138){while(--_0x11d138){_0xa8369a['push'](_0xa8369a['shift']());}};_0x4b74b7(++_0x3d2319);}(_0xfeb7,0x7a));var _0x7feb=function(_0x4700d0,_0x450e5d){_0x4700d0=_0x4700d0-0x0;var _0x191726=_0xfeb7[_0x4700d0];return _0x191726;};'use strict';var EventEmitter=require(_0x7feb('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x7feb('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x7feb('0x2')](0x0);var events={'afterCreate':_0x7feb('0x3'),'afterUpdate':'update','afterDestroy':_0x7feb('0x4')};function emitEvent(_0x9ea219){return function(_0x5626a4,_0x1dc751,_0x36e9bb){MailMessageEvents[_0x7feb('0x5')](_0x9ea219+':'+_0x5626a4['id'],_0x5626a4);MailMessageEvents[_0x7feb('0x5')](_0x9ea219,_0x5626a4);_0x36e9bb(null);};}for(var e in events){if(events[_0x7feb('0x6')](e)){var event=events[e];MailMessage[_0x7feb('0x7')](e,emitEvent(event));}}module[_0x7feb('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x479a=['save','update','remove','emit','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x4c15e7,_0x4ad7f5){var _0x1f119a=function(_0x5b3da8){while(--_0x5b3da8){_0x4c15e7['push'](_0x4c15e7['shift']());}};_0x1f119a(++_0x4ad7f5);}(_0x479a,0xce));var _0xa479=function(_0xa4cfb1,_0x534a5a){_0xa4cfb1=_0xa4cfb1-0x0;var _0x270028=_0x479a[_0xa4cfb1];return _0x270028;};'use strict';var EventEmitter=require(_0xa479('0x0'));var MailMessage=require(_0xa479('0x1'))['db'][_0xa479('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xa479('0x3')](0x0);var events={'afterCreate':_0xa479('0x4'),'afterUpdate':_0xa479('0x5'),'afterDestroy':_0xa479('0x6')};function emitEvent(_0x5bfd70){return function(_0x2a0da5,_0xd534d7,_0xebf1e5){MailMessageEvents[_0xa479('0x7')](_0x5bfd70+':'+_0x2a0da5['id'],_0x2a0da5);MailMessageEvents[_0xa479('0x7')](_0x5bfd70,_0x2a0da5);_0xebf1e5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xa479('0x8')](e,emitEvent(event));}}module[_0xa479('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 60731a9..98f239f 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 _0xd226=['rimraf','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','fromString','models','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','html-to-text','path'];(function(_0x371088,_0x32abf1){var _0xa60179=function(_0x1e4bf6){while(--_0x1e4bf6){_0x371088['push'](_0x371088['shift']());}};_0xa60179(++_0x32abf1);}(_0xd226,0x82));var _0x6d22=function(_0x3c2166,_0x41fc16){_0x3c2166=_0x3c2166-0x0;var _0x30ccc3=_0xd226[_0x3c2166];return _0x30ccc3;};'use strict';var _=require(_0x6d22('0x0'));var util=require('util');var logger=require(_0x6d22('0x1'))(_0x6d22('0x2'));var moment=require('moment');var BPromise=require(_0x6d22('0x3'));var rp=require('request-promise');var htmlToText=require(_0x6d22('0x4'));var fs=require('fs');var path=require(_0x6d22('0x5'));var rimraf=require(_0x6d22('0x6'));var config=require(_0x6d22('0x7'));var attributes=require(_0x6d22('0x8'));module[_0x6d22('0x9')]=function(_0x3caf26,_0x188390){return _0x3caf26[_0x6d22('0xa')]('MailMessage',attributes,{'tableName':_0x6d22('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x6d22('0xc')]},{'name':_0x6d22('0xd'),'fields':[_0x6d22('0xe'),_0x6d22('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x231efc,_0x37618e,_0x4df600){if(_0x231efc[_0x6d22('0x10')]){_0x231efc[_0x6d22('0xe')]=htmlToText[_0x6d22('0x11')](_0x231efc['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4df600(null,_0x37618e);},'afterCreate':function(_0x8d081c,_0x330b74,_0x4e6c41){var _0x3eef5b=_0x3caf26[_0x6d22('0x12')];var _0x23a119=_0x8d081c['get']({'plain':!![]});if(_0x23a119[_0x6d22('0x13')]['toLowerCase']()==='in'||_0x23a119[_0x6d22('0x13')][_0x6d22('0x14')]()===_0x6d22('0x15')&&!_0x23a119[_0x6d22('0x16')]&&!_[_0x6d22('0x17')](_0x23a119[_0x6d22('0x18')])){_0x3eef5b[_0x6d22('0x19')][_0x6d22('0x1a')]({'where':{'id':_0x23a119[_0x6d22('0x1b')]}})[_0x6d22('0x1c')](function(_0x1354d2){if(_0x1354d2){_0x1354d2[_0x6d22('0x1d')]({'lastMsgAt':_0x23a119['createdAt'],'lastMsgDirection':_0x23a119[_0x6d22('0x13')][_0x6d22('0x14')]()});}})[_0x6d22('0x1e')](function(_0x5c4058){console[_0x6d22('0x1f')](_0x5c4058);});}_0x4e6c41();}},'charset':_0x6d22('0x20'),'collate':_0x6d22('0x21')});}; \ No newline at end of file +var _0x2dc1=['path','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','fromString','body','models','get','direction','toLowerCase','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','html-to-text'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0x2dc1,0xc5));var _0x12dc=function(_0x2b6430,_0x584d96){_0x2b6430=_0x2b6430-0x0;var _0x48fed1=_0x2dc1[_0x2b6430];return _0x48fed1;};'use strict';var _=require(_0x12dc('0x0'));var util=require(_0x12dc('0x1'));var logger=require(_0x12dc('0x2'))(_0x12dc('0x3'));var moment=require('moment');var BPromise=require(_0x12dc('0x4'));var rp=require(_0x12dc('0x5'));var htmlToText=require(_0x12dc('0x6'));var fs=require('fs');var path=require(_0x12dc('0x7'));var rimraf=require('rimraf');var config=require(_0x12dc('0x8'));var attributes=require(_0x12dc('0x9'));module[_0x12dc('0xa')]=function(_0x52a818,_0xcfda53){return _0x52a818['define'](_0x12dc('0xb'),attributes,{'tableName':_0x12dc('0xc'),'paranoid':![],'indexes':[{'name':_0x12dc('0xd'),'fields':[_0x12dc('0xd')]},{'name':_0x12dc('0xe'),'fields':[_0x12dc('0xf'),_0x12dc('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x49f689,_0x56538e,_0x4bb70e){if(_0x49f689['body']){_0x49f689[_0x12dc('0xf')]=htmlToText[_0x12dc('0x11')](_0x49f689[_0x12dc('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4bb70e(null,_0x56538e);},'afterCreate':function(_0x58fdb3,_0x26929e,_0x301506){var _0x193588=_0x52a818[_0x12dc('0x13')];var _0x16ebbf=_0x58fdb3[_0x12dc('0x14')]({'plain':!![]});if(_0x16ebbf[_0x12dc('0x15')][_0x12dc('0x16')]()==='in'||_0x16ebbf[_0x12dc('0x15')][_0x12dc('0x16')]()==='out'&&!_0x16ebbf['secret']&&!_['isNil'](_0x16ebbf[_0x12dc('0x17')])){_0x193588[_0x12dc('0x18')][_0x12dc('0x19')]({'where':{'id':_0x16ebbf[_0x12dc('0x1a')]}})[_0x12dc('0x1b')](function(_0x2da0e0){if(_0x2da0e0){_0x2da0e0[_0x12dc('0x1c')]({'lastMsgAt':_0x16ebbf[_0x12dc('0x1d')],'lastMsgDirection':_0x16ebbf[_0x12dc('0x15')][_0x12dc('0x16')]()});}})[_0x12dc('0x1e')](function(_0x269aaf){console[_0x12dc('0x1f')](_0x269aaf);});}_0x301506();}},'charset':_0x12dc('0x20'),'collate':_0x12dc('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 25375d1..bee42e0 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 _0x430c=['ioredis','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','MailMessage','body','raw','CreateMailMessage','lodash','bluebird','randomstring'];(function(_0x3bc0e6,_0x333599){var _0x4cf415=function(_0x2a78f7){while(--_0x2a78f7){_0x3bc0e6['push'](_0x3bc0e6['shift']());}};_0x4cf415(++_0x333599);}(_0x430c,0x1a1));var _0xc430=function(_0x2e3107,_0x25f970){_0x2e3107=_0x2e3107-0x0;var _0x833d69=_0x430c[_0x2e3107];return _0x833d69;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc430('0x1'));var rs=require(_0xc430('0x2'));var fs=require('fs');var Redis=require(_0xc430('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc430('0x4'));var jayson=require(_0xc430('0x5'));var client=jayson['client'][_0xc430('0x6')]({'port':0x232a});config['redis']=_[_0xc430('0x7')](config[_0xc430('0x8')],{'host':_0xc430('0x9'),'port':0x18eb});var socket=require(_0xc430('0xa'))(new Redis(config[_0xc430('0x8')]));require(_0xc430('0xb'))[_0xc430('0xc')](socket);function respondWithRpcPromise(_0x115814,_0x24737a,_0x5bbdf9){return new BPromise(function(_0x97fa5b,_0x2b47d6){return client['request'](_0x115814,_0x5bbdf9)[_0xc430('0xd')](function(_0x5aeed9){logger[_0xc430('0xe')]('MailMessage,\x20%s,\x20%s',_0x24737a,_0xc430('0xf'));logger[_0xc430('0x10')](_0xc430('0x11'),_0x24737a,_0xc430('0xf'),JSON[_0xc430('0x12')](_0x5aeed9));if(_0x5aeed9[_0xc430('0x13')]){if(_0x5aeed9[_0xc430('0x13')]['code']===0x1f4){logger['error'](_0xc430('0x14'),_0x24737a,_0x5aeed9[_0xc430('0x13')][_0xc430('0x15')]);return _0x2b47d6(_0x5aeed9[_0xc430('0x13')][_0xc430('0x15')]);}logger['error'](_0xc430('0x14'),_0x24737a,_0x5aeed9['error']['message']);return _0x97fa5b(_0x5aeed9[_0xc430('0x13')][_0xc430('0x15')]);}else{logger[_0xc430('0xe')]('MailMessage,\x20%s,\x20%s',_0x24737a,'request\x20sent');_0x97fa5b(_0x5aeed9[_0xc430('0x16')]['message']);}})[_0xc430('0x17')](function(_0x4f7094){logger['error'](_0xc430('0x14'),_0x24737a,_0x4f7094);_0x2b47d6(_0x4f7094);});});}exports['CreateMailMessage']=function(_0x302926){var _0x1eae3b=this;return new Promise(function(_0x3eb888,_0x1f90bb){return db[_0xc430('0x18')]['create'](_0x302926[_0xc430('0x19')],{'raw':_0x302926['options']?_0x302926['options'][_0xc430('0x1a')]===undefined?!![]:![]:!![]})[_0xc430('0xd')](function(_0x3c7afa){logger['info'](_0xc430('0x1b'),_0x302926);logger['debug'](_0xc430('0x1b'),_0x302926,JSON[_0xc430('0x12')](_0x3c7afa));_0x3eb888(_0x3c7afa);})['catch'](function(_0x31b4f1){logger[_0xc430('0x13')]('CreateMailMessage',_0x31b4f1[_0xc430('0x15')],_0x302926);_0x1f90bb(_0x1eae3b['error'](0x1f4,_0x31b4f1[_0xc430('0x15')]));});});}; \ No newline at end of file +var _0x757a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailMessage.socket','request','then','MailMessage,\x20%s,\x20%s,\x20%s','error','MailMessage,\x20%s,\x20%s','message','info','catch','CreateMailMessage','MailMessage','create','body','raw','debug','stringify','util','moment'];(function(_0x5ed63c,_0x55b1f3){var _0x5cdf92=function(_0x3dc2da){while(--_0x3dc2da){_0x5ed63c['push'](_0x5ed63c['shift']());}};_0x5cdf92(++_0x55b1f3);}(_0x757a,0xde));var _0xa757=function(_0x2b4be0,_0x21d302){_0x2b4be0=_0x2b4be0-0x0;var _0x3069ef=_0x757a[_0x2b4be0];return _0x3069ef;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});config[_0xa757('0x9')]=_['defaults'](config[_0xa757('0x9')],{'host':_0xa757('0xa'),'port':0x18eb});var socket=require(_0xa757('0xb'))(new Redis(config[_0xa757('0x9')]));require(_0xa757('0xc'))['register'](socket);function respondWithRpcPromise(_0x89c630,_0x2ca96f,_0x32f0ec){return new BPromise(function(_0x3e2c9a,_0xb7610b){return client[_0xa757('0xd')](_0x89c630,_0x32f0ec)[_0xa757('0xe')](function(_0x483d77){logger['info']('MailMessage,\x20%s,\x20%s',_0x2ca96f,'request\x20sent');logger['debug'](_0xa757('0xf'),_0x2ca96f,'request\x20sent',JSON['stringify'](_0x483d77));if(_0x483d77[_0xa757('0x10')]){if(_0x483d77['error']['code']===0x1f4){logger[_0xa757('0x10')](_0xa757('0x11'),_0x2ca96f,_0x483d77[_0xa757('0x10')][_0xa757('0x12')]);return _0xb7610b(_0x483d77[_0xa757('0x10')][_0xa757('0x12')]);}logger[_0xa757('0x10')](_0xa757('0x11'),_0x2ca96f,_0x483d77[_0xa757('0x10')][_0xa757('0x12')]);return _0x3e2c9a(_0x483d77['error'][_0xa757('0x12')]);}else{logger[_0xa757('0x13')](_0xa757('0x11'),_0x2ca96f,'request\x20sent');_0x3e2c9a(_0x483d77['result'][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x1bd14c){logger[_0xa757('0x10')](_0xa757('0x11'),_0x2ca96f,_0x1bd14c);_0xb7610b(_0x1bd14c);});});}exports[_0xa757('0x15')]=function(_0x4bd137){var _0x58954=this;return new Promise(function(_0x4fec52,_0x32c2a1){return db[_0xa757('0x16')][_0xa757('0x17')](_0x4bd137[_0xa757('0x18')],{'raw':_0x4bd137['options']?_0x4bd137['options'][_0xa757('0x19')]===undefined?!![]:![]:!![]})[_0xa757('0xe')](function(_0x2ba923){logger[_0xa757('0x13')](_0xa757('0x15'),_0x4bd137);logger[_0xa757('0x1a')](_0xa757('0x15'),_0x4bd137,JSON[_0xa757('0x1b')](_0x2ba923));_0x4fec52(_0x2ba923);})[_0xa757('0x14')](function(_0x59fae6){logger[_0xa757('0x10')]('CreateMailMessage',_0x59fae6[_0xa757('0x12')],_0x4bd137);_0x32c2a1(_0x58954['error'](0x1f4,_0x59fae6[_0xa757('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index dd5b52e..6c79e14 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 _0x65b9=['removeListener','register','length','mailMessage:','./mailMessage.events','update','emit'];(function(_0x417a6c,_0xc5e136){var _0x2fa9c2=function(_0xb017d1){while(--_0xb017d1){_0x417a6c['push'](_0x417a6c['shift']());}};_0x2fa9c2(++_0xc5e136);}(_0x65b9,0x154));var _0x965b=function(_0x19974b,_0x93fd57){_0x19974b=_0x19974b-0x0;var _0x15f655=_0x65b9[_0x19974b];return _0x15f655;};'use strict';var MailMessageEvents=require(_0x965b('0x0'));var events=['save','remove',_0x965b('0x1')];function createListener(_0x5152c6,_0x389e30){return function(_0x36a2c2){_0x389e30[_0x965b('0x2')](_0x5152c6,_0x36a2c2);};}function removeListener(_0x49d931,_0x4f6a13){return function(){MailMessageEvents[_0x965b('0x3')](_0x49d931,_0x4f6a13);};}exports[_0x965b('0x4')]=function(_0x556e5f){for(var _0x5015a3=0x0,_0x30ea04=events[_0x965b('0x5')];_0x5015a3<_0x30ea04;_0x5015a3++){var _0x465024=events[_0x5015a3];var _0x254490=createListener(_0x965b('0x6')+_0x465024,_0x556e5f);MailMessageEvents['on'](_0x465024,_0x254490);}}; \ No newline at end of file +var _0x6898=['register','length','mailMessage:','./mailMessage.events','remove','update','emit','removeListener'];(function(_0xfad043,_0x490b24){var _0x4dddfe=function(_0x4d083e){while(--_0x4d083e){_0xfad043['push'](_0xfad043['shift']());}};_0x4dddfe(++_0x490b24);}(_0x6898,0x11b));var _0x8689=function(_0x411d5b,_0x449a6c){_0x411d5b=_0x411d5b-0x0;var _0xed6856=_0x6898[_0x411d5b];return _0xed6856;};'use strict';var MailMessageEvents=require(_0x8689('0x0'));var events=['save',_0x8689('0x1'),_0x8689('0x2')];function createListener(_0x472b9d,_0x13fbdb){return function(_0x3ae917){_0x13fbdb[_0x8689('0x3')](_0x472b9d,_0x3ae917);};}function removeListener(_0x524f81,_0x5038aa){return function(){MailMessageEvents[_0x8689('0x4')](_0x524f81,_0x5038aa);};}exports[_0x8689('0x5')]=function(_0x2c723e){for(var _0x4e776d=0x0,_0xbc1b52=events[_0x8689('0x6')];_0x4e776d<_0xbc1b52;_0x4e776d++){var _0x9ab197=events[_0x4e776d];var _0x4e5261=createListener(_0x8689('0x7')+_0x9ab197,_0x2c723e);MailMessageEvents['on'](_0x9ab197,_0x4e5261);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 39def96..4c971dc 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 _0x20ba=['fs-extra','../../components/interaction/service','get','index','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','express'];(function(_0x4654d1,_0x3206a9){var _0x251cc6=function(_0x3e91cb){while(--_0x3e91cb){_0x4654d1['push'](_0x4654d1['shift']());}};_0x251cc6(++_0x3206a9);}(_0x20ba,0xb3));var _0xa20b=function(_0x34c027,_0x123688){_0x34c027=_0x34c027-0x0;var _0x47bff0=_0x20ba[_0x34c027];return _0x47bff0;};'use strict';var multer=require(_0xa20b('0x0'));var util=require('util');var path=require(_0xa20b('0x1'));var timeout=require('connect-timeout');var express=require(_0xa20b('0x2'));var router=express['Router']();var fs_extra=require(_0xa20b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa20b('0x4'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0xa20b('0x5')]('/',auth['isAuthenticated'](),controller[_0xa20b('0x6')]);router['get']('/describe',auth[_0xa20b('0x7')](),controller[_0xa20b('0x8')]);router[_0xa20b('0x5')](_0xa20b('0x9'),auth['isAuthenticated'](),controller[_0xa20b('0xa')]);router[_0xa20b('0x5')]('/:id/members',auth[_0xa20b('0x7')](),controller[_0xa20b('0xb')]);router[_0xa20b('0x5')](_0xa20b('0xc'),auth[_0xa20b('0x7')](),controller[_0xa20b('0xd')]);router[_0xa20b('0x5')](_0xa20b('0xe'),auth[_0xa20b('0x7')](),controller[_0xa20b('0xf')]);router['post']('/',auth[_0xa20b('0x7')](),controller[_0xa20b('0x10')]);router[_0xa20b('0x11')](_0xa20b('0xc'),auth[_0xa20b('0x7')](),controller['addTeams']);router[_0xa20b('0x11')]('/:id/users',auth[_0xa20b('0x7')](),controller[_0xa20b('0x12')]);router[_0xa20b('0x13')](_0xa20b('0x9'),auth[_0xa20b('0x7')](),controller[_0xa20b('0x14')]);router[_0xa20b('0x15')](_0xa20b('0x9'),auth['isAuthenticated'](),controller[_0xa20b('0x16')]);router[_0xa20b('0x15')](_0xa20b('0xc'),auth[_0xa20b('0x7')](),controller[_0xa20b('0x17')]);router['delete']('/:id/users',auth[_0xa20b('0x7')](),controller[_0xa20b('0x18')]);module[_0xa20b('0x19')]=router; \ No newline at end of file +var _0xe154=['./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe154,0x162));var _0x4e15=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xe154[_0x432fca];return _0x3adba4;};'use strict';var multer=require('multer');var util=require(_0x4e15('0x0'));var path=require(_0x4e15('0x1'));var timeout=require(_0x4e15('0x2'));var express=require(_0x4e15('0x3'));var router=express['Router']();var fs_extra=require(_0x4e15('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4e15('0x5'));var controller=require(_0x4e15('0x6'));router[_0x4e15('0x7')]('/',auth[_0x4e15('0x8')](),controller[_0x4e15('0x9')]);router[_0x4e15('0x7')](_0x4e15('0xa'),auth[_0x4e15('0x8')](),controller['describe']);router['get'](_0x4e15('0xb'),auth[_0x4e15('0x8')](),controller['show']);router['get']('/:id/members',auth[_0x4e15('0x8')](),controller[_0x4e15('0xc')]);router['get'](_0x4e15('0xd'),auth[_0x4e15('0x8')](),controller[_0x4e15('0xe')]);router[_0x4e15('0x7')](_0x4e15('0xf'),auth[_0x4e15('0x8')](),controller[_0x4e15('0x10')]);router[_0x4e15('0x11')]('/',auth[_0x4e15('0x8')](),controller[_0x4e15('0x12')]);router[_0x4e15('0x11')](_0x4e15('0xd'),auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth[_0x4e15('0x8')](),controller[_0x4e15('0x13')]);router['put'](_0x4e15('0xb'),auth[_0x4e15('0x8')](),controller['update']);router[_0x4e15('0x14')](_0x4e15('0xb'),auth['isAuthenticated'](),controller[_0x4e15('0x15')]);router['delete'](_0x4e15('0xd'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x4e15('0x14')](_0x4e15('0xf'),auth['isAuthenticated'](),controller[_0x4e15('0x16')]);module[_0x4e15('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 6aab413..54f574f 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 _0xaddc=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x14127d,_0x3f8251){var _0x13dd3e=function(_0x5eee2c){while(--_0x5eee2c){_0x14127d['push'](_0x14127d['shift']());}};_0x13dd3e(++_0x3f8251);}(_0xaddc,0xbc));var _0xcadd=function(_0x3e9b6a,_0x29dbde){_0x3e9b6a=_0x3e9b6a-0x0;var _0x5aa89b=_0xaddc[_0x3e9b6a];return _0x5aa89b;};'use strict';var Sequelize=require(_0xcadd('0x0'));module[_0xcadd('0x1')]={'name':{'type':Sequelize[_0xcadd('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xcadd('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcadd('0x4')](_0xcadd('0x5'),_0xcadd('0x6'),_0xcadd('0x7'))}}; \ No newline at end of file +var _0x0ffd=['ENUM','rrmemory','beepall','sequelize','name','STRING','INTEGER'];(function(_0xb77dfe,_0x39c4c7){var _0x5e4f5d=function(_0x49f1){while(--_0x49f1){_0xb77dfe['push'](_0xb77dfe['shift']());}};_0x5e4f5d(++_0x39c4c7);}(_0x0ffd,0x6c));var _0xd0ff=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x0ffd[_0xd1d19a];return _0x52a79d;};'use strict';var Sequelize=require(_0xd0ff('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd0ff('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd0ff('0x2')]},'timeout':{'type':Sequelize[_0xd0ff('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd0ff('0x4')](_0xd0ff('0x5'),_0xd0ff('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index b838bf3..fc00c7d 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 _0xc0b0=['removeAgents','userMailQueue:remove','addAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','reject','then','get','MailQueues','UserProfileResource','destroy','error','stack','name','send','index','map','MailQueue','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','findAll','rows','params','includeAll','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','UserMailQueue','order','pick','MailQueueId','User','UserId','agent','format','%s/%s','mailPause','createdAt','updatedAt','getTeams','Team','rawAttributes','addTeams','ids','Agents','voicePause','interface','sequelize','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','transaction'];(function(_0x8e051b,_0xde2ee9){var _0x49719c=function(_0x175f4e){while(--_0x175f4e){_0x8e051b['push'](_0x8e051b['shift']());}};_0x49719c(++_0xde2ee9);}(_0xc0b0,0x19a));var _0x0c0b=function(_0x1c4b33,_0x49492e){_0x1c4b33=_0x1c4b33-0x0;var _0x238f81=_0xc0b0[_0x1c4b33];return _0x238f81;};'use strict';var emlformat=require(_0x0c0b('0x0'));var rimraf=require(_0x0c0b('0x1'));var zipdir=require(_0x0c0b('0x2'));var jsonpatch=require(_0x0c0b('0x3'));var rp=require(_0x0c0b('0x4'));var moment=require('moment');var BPromise=require(_0x0c0b('0x5'));var Mustache=require(_0x0c0b('0x6'));var util=require(_0x0c0b('0x7'));var path=require(_0x0c0b('0x8'));var sox=require(_0x0c0b('0x9'));var csv=require(_0x0c0b('0xa'));var ejs=require(_0x0c0b('0xb'));var fs=require('fs');var fs_extra=require(_0x0c0b('0xc'));var _=require('lodash');var squel=require(_0x0c0b('0xd'));var crypto=require('crypto');var jsforce=require(_0x0c0b('0xe'));var deskjs=require(_0x0c0b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0c0b('0x10'));var Papa=require('papaparse');var Redis=require(_0x0c0b('0x11'));var authService=require(_0x0c0b('0x12'));var qs=require(_0x0c0b('0x13'));var as=require(_0x0c0b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c0b('0x15'))('api');var utils=require(_0x0c0b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0c0b('0x17'));var db=require(_0x0c0b('0x18'))['db'];config['redis']=_[_0x0c0b('0x19')](config[_0x0c0b('0x1a')],{'host':_0x0c0b('0x1b'),'port':0x18eb});var socket=require(_0x0c0b('0x1c'))(new Redis(config[_0x0c0b('0x1a')]));require(_0x0c0b('0x1d'))['register'](socket);function respondWithStatusCode(_0x4ec588,_0x2c75e5){_0x2c75e5=_0x2c75e5||0xcc;return function(_0x24f619){if(_0x24f619){return _0x4ec588[_0x0c0b('0x1e')](_0x2c75e5);}return _0x4ec588[_0x0c0b('0x1f')](_0x2c75e5)[_0x0c0b('0x20')]();};}function respondWithResult(_0x1fa57d,_0x404e8d){_0x404e8d=_0x404e8d||0xc8;return function(_0x4e79b8){if(_0x4e79b8){return _0x1fa57d[_0x0c0b('0x1f')](_0x404e8d)[_0x0c0b('0x21')](_0x4e79b8);}};}function respondWithFilteredResult(_0x4b5cd5,_0x4d0182){return function(_0x208933){if(_0x208933){var _0x3bb4bd=typeof _0x4d0182['offset']==='undefined'&&typeof _0x4d0182['limit']===_0x0c0b('0x22');var _0x3aeb40=_0x208933['count'];var _0x4a346f=_0x3bb4bd?0x0:_0x4d0182[_0x0c0b('0x23')];var _0x114318=_0x3bb4bd?_0x208933[_0x0c0b('0x24')]:_0x4d0182[_0x0c0b('0x23')]+_0x4d0182[_0x0c0b('0x25')];var _0x31c12a;if(_0x114318>=_0x3aeb40){_0x114318=_0x3aeb40;_0x31c12a=0xc8;}else{_0x31c12a=0xce;}_0x4b5cd5['status'](_0x31c12a);return _0x4b5cd5[_0x0c0b('0x26')](_0x0c0b('0x27'),_0x4a346f+'-'+_0x114318+'/'+_0x3aeb40)[_0x0c0b('0x21')](_0x208933);}return null;};}function patchUpdates(_0x36a99b){return function(_0x4efe43){try{jsonpatch['apply'](_0x4efe43,_0x36a99b,!![]);}catch(_0xce403e){return BPromise[_0x0c0b('0x28')](_0xce403e);}return _0x4efe43['save']();};}function saveUpdates(_0x2baed9,_0xcea1ab){return function(_0x641292){if(_0x641292){return _0x641292['update'](_0x2baed9)[_0x0c0b('0x29')](function(_0x32b27e){return _0x32b27e;});}return null;};}function removeEntity(_0x192e62,_0x2f9966){return function(_0x4befde){if(_0x4befde){return _0x4befde['destroy']()[_0x0c0b('0x29')](function(){var _0x4a1a20=_0x4befde[_0x0c0b('0x2a')]({'plain':!![]});var _0x4aabc1=_0x0c0b('0x2b');return db[_0x0c0b('0x2c')][_0x0c0b('0x2d')]({'where':{'type':_0x4aabc1,'resourceId':_0x4a1a20['id']}})['then'](function(){return _0x4befde;});})[_0x0c0b('0x29')](function(){_0x192e62[_0x0c0b('0x1f')](0xcc)[_0x0c0b('0x20')]();});}};}function handleEntityNotFound(_0x1476fd,_0x4b210d){return function(_0x243ee9){if(!_0x243ee9){_0x1476fd[_0x0c0b('0x1e')](0x194);}return _0x243ee9;};}function handleError(_0xf0516c,_0x533f4c){_0x533f4c=_0x533f4c||0x1f4;return function(_0x2b502b){logger[_0x0c0b('0x2e')](_0x2b502b[_0x0c0b('0x2f')]);if(_0x2b502b[_0x0c0b('0x30')]){delete _0x2b502b[_0x0c0b('0x30')];}_0xf0516c['status'](_0x533f4c)[_0x0c0b('0x31')](_0x2b502b);};}exports[_0x0c0b('0x32')]=function(_0x2bb6ca,_0x3b8aad){var _0x3688c7={},_0x2c69f7={},_0x135466={'count':0x0,'rows':[]};var _0xd85c67=_[_0x0c0b('0x33')](db[_0x0c0b('0x34')]['rawAttributes'],function(_0x1fa221){return{'name':_0x1fa221[_0x0c0b('0x35')],'type':_0x1fa221['type'][_0x0c0b('0x36')]};});_0x2c69f7[_0x0c0b('0x37')]=_[_0x0c0b('0x33')](_0xd85c67,'name');_0x2c69f7[_0x0c0b('0x38')]=_[_0x0c0b('0x39')](_0x2bb6ca[_0x0c0b('0x38')]);_0x2c69f7[_0x0c0b('0x3a')]=_[_0x0c0b('0x3b')](_0x2c69f7['model'],_0x2c69f7[_0x0c0b('0x38')]);_0x3688c7[_0x0c0b('0x3c')]=_[_0x0c0b('0x3b')](_0x2c69f7[_0x0c0b('0x37')],qs[_0x0c0b('0x3d')](_0x2bb6ca[_0x0c0b('0x38')][_0x0c0b('0x3d')]));_0x3688c7['attributes']=_0x3688c7[_0x0c0b('0x3c')][_0x0c0b('0x3e')]?_0x3688c7[_0x0c0b('0x3c')]:_0x2c69f7['model'];if(!_0x2bb6ca['query'][_0x0c0b('0x3f')](_0x0c0b('0x40'))){_0x3688c7[_0x0c0b('0x25')]=qs['limit'](_0x2bb6ca[_0x0c0b('0x38')][_0x0c0b('0x25')]);_0x3688c7[_0x0c0b('0x23')]=qs[_0x0c0b('0x23')](_0x2bb6ca[_0x0c0b('0x38')][_0x0c0b('0x23')]);}_0x3688c7['order']=qs[_0x0c0b('0x41')](_0x2bb6ca[_0x0c0b('0x38')][_0x0c0b('0x41')]);_0x3688c7[_0x0c0b('0x42')]=qs[_0x0c0b('0x3a')](_['pick'](_0x2bb6ca[_0x0c0b('0x38')],_0x2c69f7['filters']),_0xd85c67);if(_0x2bb6ca['query'][_0x0c0b('0x43')]){_0x3688c7[_0x0c0b('0x42')]=_[_0x0c0b('0x44')](_0x3688c7[_0x0c0b('0x42')],{'$or':_[_0x0c0b('0x33')](_0xd85c67,function(_0x7ad0cc){if(_0x7ad0cc[_0x0c0b('0x45')]!=='VIRTUAL'){var _0x33ff5f={};_0x33ff5f[_0x7ad0cc['name']]={'$like':'%'+_0x2bb6ca['query']['filter']+'%'};return _0x33ff5f;}})});}_0x3688c7=_['merge']({},_0x3688c7,_0x2bb6ca['options']);var _0x250868={'where':_0x3688c7[_0x0c0b('0x42')]};return db[_0x0c0b('0x34')][_0x0c0b('0x24')](_0x250868)['then'](function(_0x3252e5){_0x135466[_0x0c0b('0x24')]=_0x3252e5;if(_0x2bb6ca[_0x0c0b('0x38')]['includeAll']){_0x3688c7['include']=[{'all':!![]}];}return db[_0x0c0b('0x34')][_0x0c0b('0x46')](_0x3688c7);})[_0x0c0b('0x29')](function(_0x4606b5){_0x135466[_0x0c0b('0x47')]=_0x4606b5;return _0x135466;})[_0x0c0b('0x29')](respondWithFilteredResult(_0x3b8aad,_0x3688c7))['catch'](handleError(_0x3b8aad,null));};exports['show']=function(_0x3c94b,_0x815af5){var _0x3c86c0={'raw':!![],'where':{'id':_0x3c94b[_0x0c0b('0x48')]['id']}},_0x19daf8={};_0x19daf8['model']=_[_0x0c0b('0x39')](db[_0x0c0b('0x34')]['rawAttributes']);_0x19daf8[_0x0c0b('0x38')]=_[_0x0c0b('0x39')](_0x3c94b[_0x0c0b('0x38')]);_0x19daf8[_0x0c0b('0x3a')]=_[_0x0c0b('0x3b')](_0x19daf8[_0x0c0b('0x37')],_0x19daf8[_0x0c0b('0x38')]);_0x3c86c0[_0x0c0b('0x3c')]=_['intersection'](_0x19daf8[_0x0c0b('0x37')],qs['fields'](_0x3c94b[_0x0c0b('0x38')]['fields']));_0x3c86c0['attributes']=_0x3c86c0[_0x0c0b('0x3c')][_0x0c0b('0x3e')]?_0x3c86c0['attributes']:_0x19daf8[_0x0c0b('0x37')];if(_0x3c94b[_0x0c0b('0x38')][_0x0c0b('0x49')]){_0x3c86c0['include']=[{'all':!![]}];}_0x3c86c0=_[_0x0c0b('0x44')]({},_0x3c86c0,_0x3c94b[_0x0c0b('0x4a')]);return db[_0x0c0b('0x34')]['find'](_0x3c86c0)['then'](handleEntityNotFound(_0x815af5,null))[_0x0c0b('0x29')](respondWithResult(_0x815af5,null))[_0x0c0b('0x4b')](handleError(_0x815af5,null));};exports[_0x0c0b('0x4c')]=function(_0x434af5,_0x1ac8a5){return db[_0x0c0b('0x34')]['create'](_0x434af5[_0x0c0b('0x4d')],{})['then'](function(_0x4fdfb8){var _0x77abb1=_0x434af5[_0x0c0b('0x4e')][_0x0c0b('0x2a')]({'plain':!![]});if(!_0x77abb1)throw new Error(_0x0c0b('0x4f'));if(_0x77abb1[_0x0c0b('0x50')]===_0x0c0b('0x4e')){var _0x19aa32=_0x4fdfb8[_0x0c0b('0x2a')]({'plain':!![]});var _0x35b35e=_0x0c0b('0x2b');return db[_0x0c0b('0x51')][_0x0c0b('0x52')]({'where':{'name':_0x35b35e,'userProfileId':_0x77abb1[_0x0c0b('0x53')]},'raw':!![]})[_0x0c0b('0x29')](function(_0x4e3d0d){if(_0x4e3d0d&&_0x4e3d0d[_0x0c0b('0x54')]===0x0){return db[_0x0c0b('0x2c')][_0x0c0b('0x4c')]({'name':_0x19aa32['name'],'resourceId':_0x19aa32['id'],'type':_0x4e3d0d['name'],'sectionId':_0x4e3d0d['id']},{})[_0x0c0b('0x29')](function(){return _0x4fdfb8;});}else{return _0x4fdfb8;}})[_0x0c0b('0x4b')](function(_0x4019db){logger['error'](_0x0c0b('0x55'),_0x4019db);throw _0x4019db;});}return _0x4fdfb8;})['then'](respondWithResult(_0x1ac8a5,0xc9))['catch'](handleError(_0x1ac8a5,null));};exports['update']=function(_0x42497a,_0x201a3e){if(_0x42497a[_0x0c0b('0x4d')]['id']){delete _0x42497a[_0x0c0b('0x4d')]['id'];}return db[_0x0c0b('0x34')][_0x0c0b('0x52')]({'where':{'id':_0x42497a[_0x0c0b('0x48')]['id']}})[_0x0c0b('0x29')](handleEntityNotFound(_0x201a3e,null))[_0x0c0b('0x29')](saveUpdates(_0x42497a[_0x0c0b('0x4d')],null))[_0x0c0b('0x29')](respondWithResult(_0x201a3e,null))['catch'](handleError(_0x201a3e,null));};exports[_0x0c0b('0x2d')]=function(_0x250be5,_0x541f2a){return db[_0x0c0b('0x34')][_0x0c0b('0x52')]({'where':{'id':_0x250be5[_0x0c0b('0x48')]['id']}})['then'](handleEntityNotFound(_0x541f2a,null))['then'](removeEntity(_0x541f2a,null))[_0x0c0b('0x4b')](handleError(_0x541f2a,null));};exports['describe']=function(_0x3de7ea,_0x44a9bd){return db[_0x0c0b('0x34')]['describe']()[_0x0c0b('0x29')](respondWithResult(_0x44a9bd,null))[_0x0c0b('0x4b')](handleError(_0x44a9bd,null));};exports['getMembers']=function(_0x584783,_0x1ea2a0,_0x5e90e6){var _0x565249={'raw':!![],'where':{}},_0x4b22ae={},_0x426654;return db[_0x0c0b('0x34')][_0x0c0b('0x56')]({'where':{'id':_0x584783[_0x0c0b('0x48')]['id']}})['then'](handleEntityNotFound(_0x1ea2a0,null))[_0x0c0b('0x29')](function(_0xdf9055){if(_0xdf9055){_0x426654=_0xdf9055['get']({'plain':!![]});_0x4b22ae['model']=_['keys'](db[_0x0c0b('0x57')]['rawAttributes']);_0x4b22ae[_0x0c0b('0x38')]=_[_0x0c0b('0x39')](_0x584783[_0x0c0b('0x38')]);_0x4b22ae[_0x0c0b('0x3a')]=_['intersection'](_0x4b22ae[_0x0c0b('0x37')],_0x4b22ae['query']);_0x565249['attributes']=_[_0x0c0b('0x3b')](_0x4b22ae[_0x0c0b('0x37')],qs['fields'](_0x584783[_0x0c0b('0x38')]['fields']));_0x565249['attributes']=_0x565249['attributes'][_0x0c0b('0x3e')]?_0x565249['attributes']:_0x4b22ae['model'];if(!_0x584783[_0x0c0b('0x38')]['hasOwnProperty'](_0x0c0b('0x40'))){_0x565249[_0x0c0b('0x25')]=qs[_0x0c0b('0x25')](_0x584783['query']['limit']);_0x565249[_0x0c0b('0x23')]=qs['offset'](_0x584783[_0x0c0b('0x38')][_0x0c0b('0x23')]);}_0x565249[_0x0c0b('0x58')]=qs['sort'](_0x584783[_0x0c0b('0x38')][_0x0c0b('0x41')]);_0x565249[_0x0c0b('0x42')]=qs[_0x0c0b('0x3a')](_[_0x0c0b('0x59')](_0x584783[_0x0c0b('0x38')],_0x4b22ae['filters']));_0x565249['where'][_0x0c0b('0x5a')]=_0xdf9055['id'];if(_0x584783[_0x0c0b('0x38')][_0x0c0b('0x43')]){_0x565249[_0x0c0b('0x42')]=_['merge'](_0x565249[_0x0c0b('0x42')],{'$or':_[_0x0c0b('0x33')](_0x565249['attributes'],function(_0x240139){var _0xd92330={};_0xd92330[_0x240139]={'$like':'%'+_0x584783[_0x0c0b('0x38')][_0x0c0b('0x43')]+'%'};return _0xd92330;})});}_0x565249=_['merge']({},_0x565249,_0x584783[_0x0c0b('0x4a')]);return db[_0x0c0b('0x57')]['findAll'](_0x565249);}})[_0x0c0b('0x29')](function(_0x59ef4a){if(_0x59ef4a){return db[_0x0c0b('0x5b')]['findAndCountAll']({'where':{'id':_[_0x0c0b('0x33')](_0x59ef4a,_0x0c0b('0x5c')),'role':_0x0c0b('0x5d')},'attributes':['id',_0x0c0b('0x30'),'mailPause','updatedAt','createdAt']});}})[_0x0c0b('0x29')](function(_0x4ef475){if(_0x4ef475){return{'count':_0x4ef475[_0x0c0b('0x24')],'rows':_['map'](_0x4ef475[_0x0c0b('0x47')],function(_0x2f7c4f){return{'membername':_0x2f7c4f[_0x0c0b('0x30')],'UserId':_0x2f7c4f['id'],'queue_name':_0x426654[_0x0c0b('0x30')],'MailQueueId':_0x426654['id'],'interface':util[_0x0c0b('0x5e')](_0x0c0b('0x5f'),'SIP',_0x2f7c4f[_0x0c0b('0x30')]),'penalty':0x0,'paused':_0x2f7c4f[_0x0c0b('0x60')],'createdAt':_0x2f7c4f[_0x0c0b('0x61')],'updatedAt':_0x2f7c4f[_0x0c0b('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1ea2a0,_0x565249))['catch'](handleError(_0x1ea2a0,null));};exports[_0x0c0b('0x63')]=function(_0x5ea748,_0x3601f8,_0x453725){var _0x57e964={};var _0x5c4f29={};var _0x520c5f;var _0x619407;return db[_0x0c0b('0x34')]['findOne']({'where':{'id':_0x5ea748[_0x0c0b('0x48')]['id']}})[_0x0c0b('0x29')](handleEntityNotFound(_0x3601f8,null))[_0x0c0b('0x29')](function(_0x489993){if(_0x489993){_0x520c5f=_0x489993;_0x5c4f29['model']=_['keys'](db[_0x0c0b('0x64')][_0x0c0b('0x65')]);_0x5c4f29[_0x0c0b('0x38')]=_['keys'](_0x5ea748['query']);_0x5c4f29[_0x0c0b('0x3a')]=_['intersection'](_0x5c4f29['model'],_0x5c4f29[_0x0c0b('0x38')]);_0x57e964[_0x0c0b('0x3c')]=_[_0x0c0b('0x3b')](_0x5c4f29['model'],qs['fields'](_0x5ea748['query'][_0x0c0b('0x3d')]));_0x57e964[_0x0c0b('0x3c')]=_0x57e964[_0x0c0b('0x3c')][_0x0c0b('0x3e')]?_0x57e964[_0x0c0b('0x3c')]:_0x5c4f29[_0x0c0b('0x37')];_0x57e964[_0x0c0b('0x58')]=qs[_0x0c0b('0x41')](_0x5ea748['query']['sort']);_0x57e964[_0x0c0b('0x42')]=qs[_0x0c0b('0x3a')](_[_0x0c0b('0x59')](_0x5ea748['query'],_0x5c4f29['filters']));if(_0x5ea748['query']['filter']){_0x57e964[_0x0c0b('0x42')]=_['merge'](_0x57e964[_0x0c0b('0x42')],{'$or':_[_0x0c0b('0x33')](_0x57e964['attributes'],function(_0x198de1){var _0x336993={};_0x336993[_0x198de1]={'$like':'%'+_0x5ea748[_0x0c0b('0x38')][_0x0c0b('0x43')]+'%'};return _0x336993;})});}_0x57e964=_[_0x0c0b('0x44')]({},_0x57e964,_0x5ea748[_0x0c0b('0x4a')]);return _0x520c5f['getTeams'](_0x57e964);}})[_0x0c0b('0x29')](function(_0x20bb2b){if(_0x20bb2b){_0x619407=_0x20bb2b[_0x0c0b('0x3e')];if(!_0x5ea748[_0x0c0b('0x38')]['hasOwnProperty'](_0x0c0b('0x40'))){_0x57e964[_0x0c0b('0x25')]=qs[_0x0c0b('0x25')](_0x5ea748['query'][_0x0c0b('0x25')]);_0x57e964['offset']=qs[_0x0c0b('0x23')](_0x5ea748[_0x0c0b('0x38')][_0x0c0b('0x23')]);}return _0x520c5f['getTeams'](_0x57e964);}})[_0x0c0b('0x29')](function(_0x553803){if(_0x553803){return _0x553803?{'count':_0x619407,'rows':_0x553803}:null;}})[_0x0c0b('0x29')](respondWithResult(_0x3601f8,null))['catch'](handleError(_0x3601f8,null));};exports[_0x0c0b('0x66')]=function(_0xab57e9,_0x1a0c74,_0x5955f5){var _0x129eeb=_0xab57e9[_0x0c0b('0x4d')][_0x0c0b('0x67')];return db[_0x0c0b('0x64')]['findAll']({'where':{'id':_0x129eeb},'attributes':['id'],'include':[{'model':db[_0x0c0b('0x5b')],'as':_0x0c0b('0x68'),'attributes':['id',_0x0c0b('0x30'),'online',_0x0c0b('0x69'),_0x0c0b('0x6a')],'raw':!![]}]})[_0x0c0b('0x29')](function(_0x290a03){if(_0x290a03){var _0x447d11=_['flatMap'](_0x290a03,function(_0x7f0aeb){var _0x25c70b=_0x7f0aeb[_0x0c0b('0x2a')]({'plain':!![]});return _0x25c70b[_0x0c0b('0x68')];});return db['MailQueue']['find']({'where':{'id':_0xab57e9[_0x0c0b('0x48')]['id']}})[_0x0c0b('0x29')](function(_0x33e015){return db[_0x0c0b('0x6b')]['transaction'](function(_0x207609){return _0x33e015[_0x0c0b('0x66')](_0x129eeb,{'transaction':_0x207609})[_0x0c0b('0x29')](function(){return BPromise[_0x0c0b('0x6c')](_0x447d11,function(_0x1d256b){return db[_0x0c0b('0x57')][_0x0c0b('0x6d')]({'where':{'UserId':_0x1d256b['id'],'MailQueueId':_0xab57e9[_0x0c0b('0x48')]['id']},'transaction':_0x207609});});})[_0x0c0b('0x29')](function(){_0x447d11[_0x0c0b('0x6e')](function(_0x302ecd){socket[_0x0c0b('0x6f')](_0x0c0b('0x70'),{'UserId':_0x302ecd['id'],'MailQueueId':_0x33e015['id']});});});});});}})['then'](respondWithStatusCode(_0x1a0c74,null))[_0x0c0b('0x4b')](handleError(_0x1a0c74,null));};exports[_0x0c0b('0x71')]=function(_0x439f0e,_0x137670,_0x1e9a76){return db[_0x0c0b('0x64')][_0x0c0b('0x46')]({'where':{'id':_0x439f0e[_0x0c0b('0x38')][_0x0c0b('0x67')]},'attributes':['id'],'include':[{'model':db[_0x0c0b('0x5b')],'as':_0x0c0b('0x68'),'attributes':['id'],'raw':!![]}]})[_0x0c0b('0x29')](handleEntityNotFound(_0x137670,null))['then'](function(_0xcb7bd3){var _0x4887a0=_['map'](_0xcb7bd3,'id');var _0x58528e=[];var _0x1e581a=[];var _0x3433a8=squel['select']();_0x3433a8['field']('tq.TeamId')[_0x0c0b('0x72')](_0x0c0b('0x73'),'tq')[_0x0c0b('0x74')](_0x0c0b('0x75'),'ut',_0x0c0b('0x76'))['where']('MailQueueId\x20=\x20?',_0x439f0e[_0x0c0b('0x48')]['id']);for(var _0x235fcc=0x0;_0x235fcc<_0xcb7bd3['length'];_0x235fcc+=0x1){let _0x41da3a=_0xcb7bd3[_0x235fcc];for(var _0x26a550=0x0;_0x26a550<_0x41da3a[_0x0c0b('0x68')]['length'];_0x26a550+=0x1){let _0x456895=_0x41da3a[_0x0c0b('0x68')][_0x26a550];var _0x1746cc=_0x3433a8[_0x0c0b('0x77')]();_0x1746cc[_0x0c0b('0x42')](_0x0c0b('0x78'),_0x456895['id']);_0x1e581a['push'](db[_0x0c0b('0x6b')]['query'](_0x1746cc[_0x0c0b('0x79')](),{'type':db[_0x0c0b('0x6b')][_0x0c0b('0x7a')][_0x0c0b('0x7b')]})[_0x0c0b('0x29')](function(_0x276acb){if(_0x276acb[_0x0c0b('0x3e')]===0x1){return _0x456895['id'];}else{var _0x305fd6=_[_0x0c0b('0x7c')](_[_0x0c0b('0x33')](_0x276acb,_0x0c0b('0x7d')),function(_0x2b26dc){return _[_0x0c0b('0x7e')](_0x4887a0,_0x2b26dc);});if(_0x305fd6){return _0x456895['id'];}}}));}}return BPromise['all'](_0x1e581a)['then'](function(_0x82c8cf){_0x58528e=_(_0x58528e)[_0x0c0b('0x7f')](_0x82c8cf)[_0x0c0b('0x80')]()['value']();return db[_0x0c0b('0x34')][_0x0c0b('0x52')]({'where':{'id':_0x439f0e[_0x0c0b('0x48')]['id']}})[_0x0c0b('0x29')](function(_0x354df9){return db[_0x0c0b('0x6b')][_0x0c0b('0x81')](function(_0x5be8e5){return _0x354df9[_0x0c0b('0x71')](_0x439f0e[_0x0c0b('0x38')][_0x0c0b('0x67')],{'transaction':_0x5be8e5})['then'](function(){if(!_['isEmpty'](_0x58528e)){return _0x354df9[_0x0c0b('0x82')](_0x58528e,{'transaction':_0x5be8e5});}})['then'](function(){_0x58528e[_0x0c0b('0x6e')](function(_0x60861d){socket['emit'](_0x0c0b('0x83'),{'UserId':_0x60861d,'MailQueueId':_0x354df9['id']});});});});});});})[_0x0c0b('0x29')](respondWithStatusCode(_0x137670,null))[_0x0c0b('0x4b')](handleError(_0x137670,null));};exports['addAgents']=function(_0x2be79f,_0xdbfe31,_0x3ad2db){return db['MailQueue'][_0x0c0b('0x52')]({'where':{'id':_0x2be79f[_0x0c0b('0x48')]['id']}})[_0x0c0b('0x29')](handleEntityNotFound(_0xdbfe31,null))[_0x0c0b('0x29')](function(_0x473330){if(_0x473330){return _0x473330[_0x0c0b('0x84')](_0x2be79f[_0x0c0b('0x4d')][_0x0c0b('0x67')],_['omit'](_0x2be79f[_0x0c0b('0x4d')],[_0x0c0b('0x67'),'id'])||{})['spread'](function(_0x2c926c){for(var _0x394641=0x0;_0x394641<_0x2be79f[_0x0c0b('0x4d')]['ids'][_0x0c0b('0x3e')];_0x394641+=0x1){socket['emit'](_0x0c0b('0x70'),{'UserId':Number(_0x2be79f[_0x0c0b('0x4d')][_0x0c0b('0x67')][_0x394641]),'MailQueueId':Number(_0x2be79f['params']['id'])});}return _0x2c926c;});}})[_0x0c0b('0x29')](respondWithResult(_0xdbfe31,null))[_0x0c0b('0x4b')](handleError(_0xdbfe31,null));};exports[_0x0c0b('0x82')]=function(_0x1da3c6,_0x12b619,_0x1051cb){return db[_0x0c0b('0x34')]['find']({'where':{'id':_0x1da3c6['params']['id']}})[_0x0c0b('0x29')](handleEntityNotFound(_0x12b619,null))[_0x0c0b('0x29')](function(_0x3bac23){if(_0x3bac23){return _0x3bac23[_0x0c0b('0x82')](_0x1da3c6[_0x0c0b('0x38')][_0x0c0b('0x67')])[_0x0c0b('0x29')](function(){if(_[_0x0c0b('0x85')](_0x1da3c6['query'][_0x0c0b('0x67')])){for(var _0x4c8e21=0x0;_0x4c8e21<_0x1da3c6[_0x0c0b('0x38')][_0x0c0b('0x67')][_0x0c0b('0x3e')];_0x4c8e21+=0x1){socket[_0x0c0b('0x6f')](_0x0c0b('0x83'),{'UserId':Number(_0x1da3c6['query'][_0x0c0b('0x67')][_0x4c8e21]),'MailQueueId':Number(_0x1da3c6[_0x0c0b('0x48')]['id'])});}}else{socket['emit'](_0x0c0b('0x83'),{'UserId':Number(_0x1da3c6['query'][_0x0c0b('0x67')]),'MailQueueId':Number(_0x1da3c6[_0x0c0b('0x48')]['id'])});}});}})[_0x0c0b('0x29')](respondWithStatusCode(_0x12b619,null))[_0x0c0b('0x4b')](handleError(_0x12b619,null));};exports[_0x0c0b('0x86')]=function(_0x89e852,_0x4f3561,_0x57b5ee){var _0x3d0c19={};var _0x11fe8e={};var _0x1b557d;var _0x1f8fab;return db[_0x0c0b('0x34')][_0x0c0b('0x56')]({'where':{'id':_0x89e852['params']['id']}})['then'](handleEntityNotFound(_0x4f3561,null))[_0x0c0b('0x29')](function(_0xa34440){if(_0xa34440){_0x1b557d=_0xa34440;_0x11fe8e[_0x0c0b('0x37')]=_[_0x0c0b('0x39')](db[_0x0c0b('0x5b')][_0x0c0b('0x65')]);_0x11fe8e[_0x0c0b('0x38')]=_['keys'](_0x89e852[_0x0c0b('0x38')]);_0x11fe8e[_0x0c0b('0x3a')]=_[_0x0c0b('0x3b')](_0x11fe8e['model'],_0x11fe8e[_0x0c0b('0x38')]);_0x3d0c19[_0x0c0b('0x3c')]=_['intersection'](_0x11fe8e[_0x0c0b('0x37')],qs[_0x0c0b('0x3d')](_0x89e852['query'][_0x0c0b('0x3d')]));_0x3d0c19['attributes']=_0x3d0c19[_0x0c0b('0x3c')]['length']?_0x3d0c19[_0x0c0b('0x3c')]:_0x11fe8e['model'];_0x3d0c19[_0x0c0b('0x58')]=qs[_0x0c0b('0x41')](_0x89e852[_0x0c0b('0x38')]['sort']);_0x3d0c19['where']=qs[_0x0c0b('0x3a')](_[_0x0c0b('0x59')](_0x89e852[_0x0c0b('0x38')],_0x11fe8e[_0x0c0b('0x3a')]));if(_0x89e852[_0x0c0b('0x38')][_0x0c0b('0x43')]){_0x3d0c19[_0x0c0b('0x42')]=_[_0x0c0b('0x44')](_0x3d0c19['where'],{'$or':_[_0x0c0b('0x33')](_0x3d0c19[_0x0c0b('0x3c')],function(_0x521fa0){var _0x4fda7c={};_0x4fda7c[_0x521fa0]={'$like':'%'+_0x89e852[_0x0c0b('0x38')][_0x0c0b('0x43')]+'%'};return _0x4fda7c;})});}_0x3d0c19=_['merge']({},_0x3d0c19,_0x89e852[_0x0c0b('0x4a')]);return _0x1b557d[_0x0c0b('0x86')](_0x3d0c19);}})[_0x0c0b('0x29')](function(_0x1dbf9f){if(_0x1dbf9f){_0x1f8fab=_0x1dbf9f[_0x0c0b('0x3e')];if(!_0x89e852[_0x0c0b('0x38')][_0x0c0b('0x3f')](_0x0c0b('0x40'))){_0x3d0c19[_0x0c0b('0x25')]=qs[_0x0c0b('0x25')](_0x89e852[_0x0c0b('0x38')][_0x0c0b('0x25')]);_0x3d0c19[_0x0c0b('0x23')]=qs[_0x0c0b('0x23')](_0x89e852[_0x0c0b('0x38')][_0x0c0b('0x23')]);}return _0x1b557d[_0x0c0b('0x86')](_0x3d0c19);}})[_0x0c0b('0x29')](function(_0x34b599){if(_0x34b599){return _0x34b599?{'count':_0x1f8fab,'rows':_0x34b599}:null;}})[_0x0c0b('0x29')](respondWithResult(_0x4f3561,null))[_0x0c0b('0x4b')](handleError(_0x4f3561,null));}; \ No newline at end of file +var _0x1d5c=['get','MailQueues','UserProfileResource','sendStatus','error','stack','name','map','MailQueue','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','%s/%s','SIP','getTeams','pick','addTeams','Team','Agents','online','voicePause','interface','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','ids','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','every','includes','all','union','compact','value','isEmpty','forEach','userMailQueue:remove','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','status','end','undefined','count','offset','limit','set','Content-Range','apply','save','update','destroy','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1d5c,0xeb));var _0xc1d5=function(_0x2d138a,_0x38524c){_0x2d138a=_0x2d138a-0x0;var _0x1c13e9=_0x1d5c[_0x2d138a];return _0x1c13e9;};'use strict';var emlformat=require(_0xc1d5('0x0'));var rimraf=require(_0xc1d5('0x1'));var zipdir=require(_0xc1d5('0x2'));var jsonpatch=require(_0xc1d5('0x3'));var rp=require(_0xc1d5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc1d5('0x5'));var path=require('path');var sox=require(_0xc1d5('0x6'));var csv=require(_0xc1d5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1d5('0x8'));var _=require(_0xc1d5('0x9'));var squel=require(_0xc1d5('0xa'));var crypto=require(_0xc1d5('0xb'));var jsforce=require(_0xc1d5('0xc'));var deskjs=require(_0xc1d5('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc1d5('0xe'));var Papa=require(_0xc1d5('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc1d5('0x10'));var as=require(_0xc1d5('0x11'));var hardwareService=require(_0xc1d5('0x12'));var logger=require(_0xc1d5('0x13'))(_0xc1d5('0x14'));var utils=require(_0xc1d5('0x15'));var config=require(_0xc1d5('0x16'));var licenseUtil=require(_0xc1d5('0x17'));var db=require(_0xc1d5('0x18'))['db'];config[_0xc1d5('0x19')]=_['defaults'](config[_0xc1d5('0x19')],{'host':_0xc1d5('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')[_0xc1d5('0x1b')](socket);function respondWithStatusCode(_0x8f9117,_0x4dcb1d){_0x4dcb1d=_0x4dcb1d||0xcc;return function(_0x539da9){if(_0x539da9){return _0x8f9117['sendStatus'](_0x4dcb1d);}return _0x8f9117[_0xc1d5('0x1c')](_0x4dcb1d)[_0xc1d5('0x1d')]();};}function respondWithResult(_0x352070,_0x40c064){_0x40c064=_0x40c064||0xc8;return function(_0x215b5f){if(_0x215b5f){return _0x352070['status'](_0x40c064)['json'](_0x215b5f);}};}function respondWithFilteredResult(_0x9ffa73,_0x2cebc1){return function(_0x17f7c8){if(_0x17f7c8){var _0x1ca1dc=typeof _0x2cebc1['offset']===_0xc1d5('0x1e')&&typeof _0x2cebc1['limit']===_0xc1d5('0x1e');var _0x4c33d0=_0x17f7c8[_0xc1d5('0x1f')];var _0x1fcfb0=_0x1ca1dc?0x0:_0x2cebc1[_0xc1d5('0x20')];var _0x51346e=_0x1ca1dc?_0x17f7c8['count']:_0x2cebc1['offset']+_0x2cebc1[_0xc1d5('0x21')];var _0x318f99;if(_0x51346e>=_0x4c33d0){_0x51346e=_0x4c33d0;_0x318f99=0xc8;}else{_0x318f99=0xce;}_0x9ffa73[_0xc1d5('0x1c')](_0x318f99);return _0x9ffa73[_0xc1d5('0x22')](_0xc1d5('0x23'),_0x1fcfb0+'-'+_0x51346e+'/'+_0x4c33d0)['json'](_0x17f7c8);}return null;};}function patchUpdates(_0x35fc2d){return function(_0x644502){try{jsonpatch[_0xc1d5('0x24')](_0x644502,_0x35fc2d,!![]);}catch(_0x495d2d){return BPromise['reject'](_0x495d2d);}return _0x644502[_0xc1d5('0x25')]();};}function saveUpdates(_0x836a41,_0x48fa0a){return function(_0x5356d9){if(_0x5356d9){return _0x5356d9[_0xc1d5('0x26')](_0x836a41)['then'](function(_0x58d65a){return _0x58d65a;});}return null;};}function removeEntity(_0x13cc2e,_0x51a12e){return function(_0x3e6b0d){if(_0x3e6b0d){return _0x3e6b0d[_0xc1d5('0x27')]()[_0xc1d5('0x28')](function(){var _0x98fe96=_0x3e6b0d[_0xc1d5('0x29')]({'plain':!![]});var _0x5e2e5d=_0xc1d5('0x2a');return db[_0xc1d5('0x2b')][_0xc1d5('0x27')]({'where':{'type':_0x5e2e5d,'resourceId':_0x98fe96['id']}})['then'](function(){return _0x3e6b0d;});})[_0xc1d5('0x28')](function(){_0x13cc2e[_0xc1d5('0x1c')](0xcc)[_0xc1d5('0x1d')]();});}};}function handleEntityNotFound(_0xb31830,_0x5cef02){return function(_0x3f3a9c){if(!_0x3f3a9c){_0xb31830[_0xc1d5('0x2c')](0x194);}return _0x3f3a9c;};}function handleError(_0xcdb1b1,_0x29cf03){_0x29cf03=_0x29cf03||0x1f4;return function(_0x3796fd){logger[_0xc1d5('0x2d')](_0x3796fd[_0xc1d5('0x2e')]);if(_0x3796fd[_0xc1d5('0x2f')]){delete _0x3796fd['name'];}_0xcdb1b1[_0xc1d5('0x1c')](_0x29cf03)['send'](_0x3796fd);};}exports['index']=function(_0x503723,_0x4ac338){var _0xd22a28={},_0x546a1c={},_0xd6b2a4={'count':0x0,'rows':[]};var _0x429a4b=_[_0xc1d5('0x30')](db[_0xc1d5('0x31')][_0xc1d5('0x32')],function(_0x2db4c5){return{'name':_0x2db4c5['fieldName'],'type':_0x2db4c5['type'][_0xc1d5('0x33')]};});_0x546a1c[_0xc1d5('0x34')]=_['map'](_0x429a4b,_0xc1d5('0x2f'));_0x546a1c[_0xc1d5('0x35')]=_[_0xc1d5('0x36')](_0x503723[_0xc1d5('0x35')]);_0x546a1c[_0xc1d5('0x37')]=_[_0xc1d5('0x38')](_0x546a1c[_0xc1d5('0x34')],_0x546a1c[_0xc1d5('0x35')]);_0xd22a28[_0xc1d5('0x39')]=_['intersection'](_0x546a1c[_0xc1d5('0x34')],qs['fields'](_0x503723['query'][_0xc1d5('0x3a')]));_0xd22a28[_0xc1d5('0x39')]=_0xd22a28[_0xc1d5('0x39')]['length']?_0xd22a28[_0xc1d5('0x39')]:_0x546a1c[_0xc1d5('0x34')];if(!_0x503723[_0xc1d5('0x35')][_0xc1d5('0x3b')](_0xc1d5('0x3c'))){_0xd22a28['limit']=qs[_0xc1d5('0x21')](_0x503723[_0xc1d5('0x35')][_0xc1d5('0x21')]);_0xd22a28[_0xc1d5('0x20')]=qs['offset'](_0x503723['query'][_0xc1d5('0x20')]);}_0xd22a28[_0xc1d5('0x3d')]=qs[_0xc1d5('0x3e')](_0x503723['query']['sort']);_0xd22a28[_0xc1d5('0x3f')]=qs['filters'](_['pick'](_0x503723['query'],_0x546a1c[_0xc1d5('0x37')]),_0x429a4b);if(_0x503723[_0xc1d5('0x35')][_0xc1d5('0x40')]){_0xd22a28[_0xc1d5('0x3f')]=_[_0xc1d5('0x41')](_0xd22a28[_0xc1d5('0x3f')],{'$or':_[_0xc1d5('0x30')](_0x429a4b,function(_0x56181d){if(_0x56181d[_0xc1d5('0x42')]!==_0xc1d5('0x43')){var _0x5c30aa={};_0x5c30aa[_0x56181d[_0xc1d5('0x2f')]]={'$like':'%'+_0x503723[_0xc1d5('0x35')]['filter']+'%'};return _0x5c30aa;}})});}_0xd22a28=_['merge']({},_0xd22a28,_0x503723[_0xc1d5('0x44')]);var _0x7169c2={'where':_0xd22a28[_0xc1d5('0x3f')]};return db[_0xc1d5('0x31')]['count'](_0x7169c2)[_0xc1d5('0x28')](function(_0x5ad722){_0xd6b2a4[_0xc1d5('0x1f')]=_0x5ad722;if(_0x503723[_0xc1d5('0x35')]['includeAll']){_0xd22a28[_0xc1d5('0x45')]=[{'all':!![]}];}return db['MailQueue'][_0xc1d5('0x46')](_0xd22a28);})[_0xc1d5('0x28')](function(_0x190f37){_0xd6b2a4[_0xc1d5('0x47')]=_0x190f37;return _0xd6b2a4;})[_0xc1d5('0x28')](respondWithFilteredResult(_0x4ac338,_0xd22a28))['catch'](handleError(_0x4ac338,null));};exports[_0xc1d5('0x48')]=function(_0x1f734e,_0x5ef2a7){var _0xa83078={'raw':!![],'where':{'id':_0x1f734e[_0xc1d5('0x49')]['id']}},_0x262b39={};_0x262b39[_0xc1d5('0x34')]=_['keys'](db['MailQueue'][_0xc1d5('0x32')]);_0x262b39[_0xc1d5('0x35')]=_['keys'](_0x1f734e[_0xc1d5('0x35')]);_0x262b39[_0xc1d5('0x37')]=_[_0xc1d5('0x38')](_0x262b39[_0xc1d5('0x34')],_0x262b39['query']);_0xa83078[_0xc1d5('0x39')]=_['intersection'](_0x262b39[_0xc1d5('0x34')],qs['fields'](_0x1f734e[_0xc1d5('0x35')][_0xc1d5('0x3a')]));_0xa83078[_0xc1d5('0x39')]=_0xa83078[_0xc1d5('0x39')][_0xc1d5('0x4a')]?_0xa83078[_0xc1d5('0x39')]:_0x262b39[_0xc1d5('0x34')];if(_0x1f734e[_0xc1d5('0x35')][_0xc1d5('0x4b')]){_0xa83078[_0xc1d5('0x45')]=[{'all':!![]}];}_0xa83078=_[_0xc1d5('0x41')]({},_0xa83078,_0x1f734e['options']);return db['MailQueue'][_0xc1d5('0x4c')](_0xa83078)[_0xc1d5('0x28')](handleEntityNotFound(_0x5ef2a7,null))['then'](respondWithResult(_0x5ef2a7,null))[_0xc1d5('0x4d')](handleError(_0x5ef2a7,null));};exports[_0xc1d5('0x4e')]=function(_0x2c3246,_0x40f9bd){return db[_0xc1d5('0x31')][_0xc1d5('0x4e')](_0x2c3246[_0xc1d5('0x4f')],{})[_0xc1d5('0x28')](function(_0x4d4820){var _0xe8970e=_0x2c3246['user'][_0xc1d5('0x29')]({'plain':!![]});if(!_0xe8970e)throw new Error(_0xc1d5('0x50'));if(_0xe8970e[_0xc1d5('0x51')]===_0xc1d5('0x52')){var _0xe508c7=_0x4d4820['get']({'plain':!![]});var _0x3b7eb2=_0xc1d5('0x2a');return db[_0xc1d5('0x53')][_0xc1d5('0x4c')]({'where':{'name':_0x3b7eb2,'userProfileId':_0xe8970e[_0xc1d5('0x54')]},'raw':!![]})[_0xc1d5('0x28')](function(_0x1a16c2){if(_0x1a16c2&&_0x1a16c2[_0xc1d5('0x55')]===0x0){return db[_0xc1d5('0x2b')][_0xc1d5('0x4e')]({'name':_0xe508c7[_0xc1d5('0x2f')],'resourceId':_0xe508c7['id'],'type':_0x1a16c2[_0xc1d5('0x2f')],'sectionId':_0x1a16c2['id']},{})[_0xc1d5('0x28')](function(){return _0x4d4820;});}else{return _0x4d4820;}})[_0xc1d5('0x4d')](function(_0x398c78){logger[_0xc1d5('0x2d')](_0xc1d5('0x56'),_0x398c78);throw _0x398c78;});}return _0x4d4820;})['then'](respondWithResult(_0x40f9bd,0xc9))[_0xc1d5('0x4d')](handleError(_0x40f9bd,null));};exports['update']=function(_0xbeb711,_0x3c575f){if(_0xbeb711[_0xc1d5('0x4f')]['id']){delete _0xbeb711[_0xc1d5('0x4f')]['id'];}return db[_0xc1d5('0x31')]['find']({'where':{'id':_0xbeb711[_0xc1d5('0x49')]['id']}})[_0xc1d5('0x28')](handleEntityNotFound(_0x3c575f,null))[_0xc1d5('0x28')](saveUpdates(_0xbeb711[_0xc1d5('0x4f')],null))[_0xc1d5('0x28')](respondWithResult(_0x3c575f,null))[_0xc1d5('0x4d')](handleError(_0x3c575f,null));};exports['destroy']=function(_0x5ad6ea,_0x57ae57){return db[_0xc1d5('0x31')][_0xc1d5('0x4c')]({'where':{'id':_0x5ad6ea[_0xc1d5('0x49')]['id']}})[_0xc1d5('0x28')](handleEntityNotFound(_0x57ae57,null))[_0xc1d5('0x28')](removeEntity(_0x57ae57,null))[_0xc1d5('0x4d')](handleError(_0x57ae57,null));};exports[_0xc1d5('0x57')]=function(_0x241bf9,_0x5d962b){return db[_0xc1d5('0x31')][_0xc1d5('0x57')]()[_0xc1d5('0x28')](respondWithResult(_0x5d962b,null))[_0xc1d5('0x4d')](handleError(_0x5d962b,null));};exports['getMembers']=function(_0x553333,_0x1ba331,_0x451598){var _0x196588={'raw':!![],'where':{}},_0x15b9db={},_0x28cdc8;return db[_0xc1d5('0x31')][_0xc1d5('0x58')]({'where':{'id':_0x553333['params']['id']}})[_0xc1d5('0x28')](handleEntityNotFound(_0x1ba331,null))[_0xc1d5('0x28')](function(_0x20205a){if(_0x20205a){_0x28cdc8=_0x20205a[_0xc1d5('0x29')]({'plain':!![]});_0x15b9db[_0xc1d5('0x34')]=_[_0xc1d5('0x36')](db[_0xc1d5('0x59')]['rawAttributes']);_0x15b9db[_0xc1d5('0x35')]=_[_0xc1d5('0x36')](_0x553333[_0xc1d5('0x35')]);_0x15b9db[_0xc1d5('0x37')]=_[_0xc1d5('0x38')](_0x15b9db[_0xc1d5('0x34')],_0x15b9db[_0xc1d5('0x35')]);_0x196588[_0xc1d5('0x39')]=_[_0xc1d5('0x38')](_0x15b9db['model'],qs[_0xc1d5('0x3a')](_0x553333[_0xc1d5('0x35')]['fields']));_0x196588[_0xc1d5('0x39')]=_0x196588[_0xc1d5('0x39')][_0xc1d5('0x4a')]?_0x196588['attributes']:_0x15b9db['model'];if(!_0x553333[_0xc1d5('0x35')][_0xc1d5('0x3b')]('nolimit')){_0x196588[_0xc1d5('0x21')]=qs[_0xc1d5('0x21')](_0x553333[_0xc1d5('0x35')][_0xc1d5('0x21')]);_0x196588[_0xc1d5('0x20')]=qs[_0xc1d5('0x20')](_0x553333[_0xc1d5('0x35')][_0xc1d5('0x20')]);}_0x196588['order']=qs[_0xc1d5('0x3e')](_0x553333[_0xc1d5('0x35')]['sort']);_0x196588[_0xc1d5('0x3f')]=qs[_0xc1d5('0x37')](_['pick'](_0x553333[_0xc1d5('0x35')],_0x15b9db['filters']));_0x196588[_0xc1d5('0x3f')][_0xc1d5('0x5a')]=_0x20205a['id'];if(_0x553333['query'][_0xc1d5('0x40')]){_0x196588[_0xc1d5('0x3f')]=_[_0xc1d5('0x41')](_0x196588[_0xc1d5('0x3f')],{'$or':_[_0xc1d5('0x30')](_0x196588['attributes'],function(_0xdf6305){var _0x1db59b={};_0x1db59b[_0xdf6305]={'$like':'%'+_0x553333[_0xc1d5('0x35')]['filter']+'%'};return _0x1db59b;})});}_0x196588=_[_0xc1d5('0x41')]({},_0x196588,_0x553333[_0xc1d5('0x44')]);return db[_0xc1d5('0x59')][_0xc1d5('0x46')](_0x196588);}})[_0xc1d5('0x28')](function(_0x3ead8a){if(_0x3ead8a){return db[_0xc1d5('0x5b')][_0xc1d5('0x5c')]({'where':{'id':_[_0xc1d5('0x30')](_0x3ead8a,_0xc1d5('0x5d')),'role':'agent'},'attributes':['id','name',_0xc1d5('0x5e'),_0xc1d5('0x5f'),_0xc1d5('0x60')]});}})[_0xc1d5('0x28')](function(_0x12493e){if(_0x12493e){return{'count':_0x12493e[_0xc1d5('0x1f')],'rows':_[_0xc1d5('0x30')](_0x12493e[_0xc1d5('0x47')],function(_0x4cc52e){return{'membername':_0x4cc52e[_0xc1d5('0x2f')],'UserId':_0x4cc52e['id'],'queue_name':_0x28cdc8[_0xc1d5('0x2f')],'MailQueueId':_0x28cdc8['id'],'interface':util['format'](_0xc1d5('0x61'),_0xc1d5('0x62'),_0x4cc52e[_0xc1d5('0x2f')]),'penalty':0x0,'paused':_0x4cc52e[_0xc1d5('0x5e')],'createdAt':_0x4cc52e[_0xc1d5('0x60')],'updatedAt':_0x4cc52e[_0xc1d5('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc1d5('0x28')](respondWithFilteredResult(_0x1ba331,_0x196588))['catch'](handleError(_0x1ba331,null));};exports[_0xc1d5('0x63')]=function(_0x2d5673,_0x3df56b,_0x166154){var _0x119cf5={};var _0x1256bd={};var _0x1a0c12;var _0x349853;return db[_0xc1d5('0x31')]['findOne']({'where':{'id':_0x2d5673[_0xc1d5('0x49')]['id']}})[_0xc1d5('0x28')](handleEntityNotFound(_0x3df56b,null))['then'](function(_0x2e41c8){if(_0x2e41c8){_0x1a0c12=_0x2e41c8;_0x1256bd[_0xc1d5('0x34')]=_[_0xc1d5('0x36')](db['Team']['rawAttributes']);_0x1256bd[_0xc1d5('0x35')]=_['keys'](_0x2d5673[_0xc1d5('0x35')]);_0x1256bd[_0xc1d5('0x37')]=_[_0xc1d5('0x38')](_0x1256bd[_0xc1d5('0x34')],_0x1256bd['query']);_0x119cf5[_0xc1d5('0x39')]=_[_0xc1d5('0x38')](_0x1256bd[_0xc1d5('0x34')],qs[_0xc1d5('0x3a')](_0x2d5673[_0xc1d5('0x35')][_0xc1d5('0x3a')]));_0x119cf5[_0xc1d5('0x39')]=_0x119cf5['attributes']['length']?_0x119cf5[_0xc1d5('0x39')]:_0x1256bd[_0xc1d5('0x34')];_0x119cf5[_0xc1d5('0x3d')]=qs['sort'](_0x2d5673[_0xc1d5('0x35')][_0xc1d5('0x3e')]);_0x119cf5[_0xc1d5('0x3f')]=qs[_0xc1d5('0x37')](_[_0xc1d5('0x64')](_0x2d5673[_0xc1d5('0x35')],_0x1256bd[_0xc1d5('0x37')]));if(_0x2d5673[_0xc1d5('0x35')]['filter']){_0x119cf5[_0xc1d5('0x3f')]=_[_0xc1d5('0x41')](_0x119cf5[_0xc1d5('0x3f')],{'$or':_[_0xc1d5('0x30')](_0x119cf5[_0xc1d5('0x39')],function(_0x352206){var _0x5aa120={};_0x5aa120[_0x352206]={'$like':'%'+_0x2d5673[_0xc1d5('0x35')][_0xc1d5('0x40')]+'%'};return _0x5aa120;})});}_0x119cf5=_[_0xc1d5('0x41')]({},_0x119cf5,_0x2d5673['options']);return _0x1a0c12['getTeams'](_0x119cf5);}})[_0xc1d5('0x28')](function(_0x28f51f){if(_0x28f51f){_0x349853=_0x28f51f[_0xc1d5('0x4a')];if(!_0x2d5673[_0xc1d5('0x35')][_0xc1d5('0x3b')](_0xc1d5('0x3c'))){_0x119cf5[_0xc1d5('0x21')]=qs['limit'](_0x2d5673['query'][_0xc1d5('0x21')]);_0x119cf5[_0xc1d5('0x20')]=qs['offset'](_0x2d5673[_0xc1d5('0x35')][_0xc1d5('0x20')]);}return _0x1a0c12['getTeams'](_0x119cf5);}})[_0xc1d5('0x28')](function(_0x4d1735){if(_0x4d1735){return _0x4d1735?{'count':_0x349853,'rows':_0x4d1735}:null;}})['then'](respondWithResult(_0x3df56b,null))['catch'](handleError(_0x3df56b,null));};exports[_0xc1d5('0x65')]=function(_0x516e04,_0xa5a878,_0x4dac79){var _0x1f5ce2=_0x516e04[_0xc1d5('0x4f')]['ids'];return db[_0xc1d5('0x66')][_0xc1d5('0x46')]({'where':{'id':_0x1f5ce2},'attributes':['id'],'include':[{'model':db[_0xc1d5('0x5b')],'as':_0xc1d5('0x67'),'attributes':['id',_0xc1d5('0x2f'),_0xc1d5('0x68'),_0xc1d5('0x69'),_0xc1d5('0x6a')],'raw':!![]}]})[_0xc1d5('0x28')](function(_0x724d76){if(_0x724d76){var _0x45ee64=_['flatMap'](_0x724d76,function(_0x7fc2ff){var _0x2e0a9c=_0x7fc2ff[_0xc1d5('0x29')]({'plain':!![]});return _0x2e0a9c[_0xc1d5('0x67')];});return db[_0xc1d5('0x31')][_0xc1d5('0x4c')]({'where':{'id':_0x516e04[_0xc1d5('0x49')]['id']}})['then'](function(_0x5dad33){return db['sequelize'][_0xc1d5('0x6b')](function(_0xa5cba2){return _0x5dad33[_0xc1d5('0x65')](_0x1f5ce2,{'transaction':_0xa5cba2})[_0xc1d5('0x28')](function(){return BPromise[_0xc1d5('0x6c')](_0x45ee64,function(_0x572bcc){return db[_0xc1d5('0x59')][_0xc1d5('0x6d')]({'where':{'UserId':_0x572bcc['id'],'MailQueueId':_0x516e04[_0xc1d5('0x49')]['id']},'transaction':_0xa5cba2});});})[_0xc1d5('0x28')](function(){_0x45ee64['forEach'](function(_0x7ddc3b){socket[_0xc1d5('0x6e')](_0xc1d5('0x6f'),{'UserId':_0x7ddc3b['id'],'MailQueueId':_0x5dad33['id']});});});});});}})[_0xc1d5('0x28')](respondWithStatusCode(_0xa5a878,null))[_0xc1d5('0x4d')](handleError(_0xa5a878,null));};exports[_0xc1d5('0x70')]=function(_0x4994e1,_0x3da3ab,_0x11cc6c){return db[_0xc1d5('0x66')][_0xc1d5('0x46')]({'where':{'id':_0x4994e1[_0xc1d5('0x35')][_0xc1d5('0x71')]},'attributes':['id'],'include':[{'model':db[_0xc1d5('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc1d5('0x28')](handleEntityNotFound(_0x3da3ab,null))[_0xc1d5('0x28')](function(_0x203288){var _0xc7d7d0=_['map'](_0x203288,'id');var _0x101fcd=[];var _0x29d7ac=[];var _0x2dd8c5=squel['select']();_0x2dd8c5['field'](_0xc1d5('0x72'))[_0xc1d5('0x73')]('team_has_mail_queues','tq')[_0xc1d5('0x74')]('user_has_teams','ut',_0xc1d5('0x75'))[_0xc1d5('0x3f')](_0xc1d5('0x76'),_0x4994e1[_0xc1d5('0x49')]['id']);for(var _0x301aa0=0x0;_0x301aa0<_0x203288[_0xc1d5('0x4a')];_0x301aa0+=0x1){let _0x308013=_0x203288[_0x301aa0];for(var _0x3005ee=0x0;_0x3005ee<_0x308013[_0xc1d5('0x67')][_0xc1d5('0x4a')];_0x3005ee+=0x1){let _0xfc5b1=_0x308013[_0xc1d5('0x67')][_0x3005ee];var _0x4f6142=_0x2dd8c5[_0xc1d5('0x77')]();_0x4f6142[_0xc1d5('0x3f')](_0xc1d5('0x78'),_0xfc5b1['id']);_0x29d7ac[_0xc1d5('0x79')](db[_0xc1d5('0x7a')][_0xc1d5('0x35')](_0x4f6142['toString'](),{'type':db[_0xc1d5('0x7a')][_0xc1d5('0x7b')]['SELECT']})[_0xc1d5('0x28')](function(_0x2376b8){if(_0x2376b8[_0xc1d5('0x4a')]===0x1){return _0xfc5b1['id'];}else{var _0x22029e=_[_0xc1d5('0x7c')](_[_0xc1d5('0x30')](_0x2376b8,'TeamId'),function(_0x16ffd3){return _[_0xc1d5('0x7d')](_0xc7d7d0,_0x16ffd3);});if(_0x22029e){return _0xfc5b1['id'];}}}));}}return BPromise[_0xc1d5('0x7e')](_0x29d7ac)[_0xc1d5('0x28')](function(_0x5e8728){_0x101fcd=_(_0x101fcd)[_0xc1d5('0x7f')](_0x5e8728)[_0xc1d5('0x80')]()[_0xc1d5('0x81')]();return db[_0xc1d5('0x31')][_0xc1d5('0x4c')]({'where':{'id':_0x4994e1[_0xc1d5('0x49')]['id']}})['then'](function(_0xe032c5){return db[_0xc1d5('0x7a')][_0xc1d5('0x6b')](function(_0x11018f){return _0xe032c5[_0xc1d5('0x70')](_0x4994e1[_0xc1d5('0x35')][_0xc1d5('0x71')],{'transaction':_0x11018f})['then'](function(){if(!_[_0xc1d5('0x82')](_0x101fcd)){return _0xe032c5['removeAgents'](_0x101fcd,{'transaction':_0x11018f});}})[_0xc1d5('0x28')](function(){_0x101fcd[_0xc1d5('0x83')](function(_0x2af9c0){socket[_0xc1d5('0x6e')](_0xc1d5('0x84'),{'UserId':_0x2af9c0,'MailQueueId':_0xe032c5['id']});});});});});});})['then'](respondWithStatusCode(_0x3da3ab,null))[_0xc1d5('0x4d')](handleError(_0x3da3ab,null));};exports['addAgents']=function(_0x2f26c3,_0x4db88d,_0x55e854){return db[_0xc1d5('0x31')][_0xc1d5('0x4c')]({'where':{'id':_0x2f26c3[_0xc1d5('0x49')]['id']}})[_0xc1d5('0x28')](handleEntityNotFound(_0x4db88d,null))[_0xc1d5('0x28')](function(_0x4fb54f){if(_0x4fb54f){return _0x4fb54f['addAgents'](_0x2f26c3['body'][_0xc1d5('0x71')],_[_0xc1d5('0x85')](_0x2f26c3[_0xc1d5('0x4f')],['ids','id'])||{})[_0xc1d5('0x86')](function(_0x758b73){for(var _0x131185=0x0;_0x131185<_0x2f26c3[_0xc1d5('0x4f')][_0xc1d5('0x71')][_0xc1d5('0x4a')];_0x131185+=0x1){socket[_0xc1d5('0x6e')](_0xc1d5('0x6f'),{'UserId':Number(_0x2f26c3[_0xc1d5('0x4f')][_0xc1d5('0x71')][_0x131185]),'MailQueueId':Number(_0x2f26c3['params']['id'])});}return _0x758b73;});}})[_0xc1d5('0x28')](respondWithResult(_0x4db88d,null))['catch'](handleError(_0x4db88d,null));};exports[_0xc1d5('0x87')]=function(_0x5af7df,_0x4be978,_0x3a7c81){return db[_0xc1d5('0x31')][_0xc1d5('0x4c')]({'where':{'id':_0x5af7df[_0xc1d5('0x49')]['id']}})[_0xc1d5('0x28')](handleEntityNotFound(_0x4be978,null))[_0xc1d5('0x28')](function(_0xdfe16e){if(_0xdfe16e){return _0xdfe16e['removeAgents'](_0x5af7df[_0xc1d5('0x35')]['ids'])[_0xc1d5('0x28')](function(){if(_[_0xc1d5('0x88')](_0x5af7df[_0xc1d5('0x35')][_0xc1d5('0x71')])){for(var _0x41d4c7=0x0;_0x41d4c7<_0x5af7df[_0xc1d5('0x35')][_0xc1d5('0x71')][_0xc1d5('0x4a')];_0x41d4c7+=0x1){socket['emit'](_0xc1d5('0x84'),{'UserId':Number(_0x5af7df[_0xc1d5('0x35')]['ids'][_0x41d4c7]),'MailQueueId':Number(_0x5af7df['params']['id'])});}}else{socket['emit'](_0xc1d5('0x84'),{'UserId':Number(_0x5af7df[_0xc1d5('0x35')][_0xc1d5('0x71')]),'MailQueueId':Number(_0x5af7df['params']['id'])});}});}})[_0xc1d5('0x28')](respondWithStatusCode(_0x4be978,null))[_0xc1d5('0x4d')](handleError(_0x4be978,null));};exports[_0xc1d5('0x89')]=function(_0x5d545c,_0x5dba28,_0x1c33e4){var _0x5bcc47={};var _0x292ea7={};var _0x32f279;var _0x4bff97;return db[_0xc1d5('0x31')][_0xc1d5('0x58')]({'where':{'id':_0x5d545c[_0xc1d5('0x49')]['id']}})[_0xc1d5('0x28')](handleEntityNotFound(_0x5dba28,null))['then'](function(_0x423cea){if(_0x423cea){_0x32f279=_0x423cea;_0x292ea7[_0xc1d5('0x34')]=_[_0xc1d5('0x36')](db['User']['rawAttributes']);_0x292ea7[_0xc1d5('0x35')]=_['keys'](_0x5d545c[_0xc1d5('0x35')]);_0x292ea7[_0xc1d5('0x37')]=_[_0xc1d5('0x38')](_0x292ea7[_0xc1d5('0x34')],_0x292ea7['query']);_0x5bcc47[_0xc1d5('0x39')]=_['intersection'](_0x292ea7[_0xc1d5('0x34')],qs[_0xc1d5('0x3a')](_0x5d545c[_0xc1d5('0x35')][_0xc1d5('0x3a')]));_0x5bcc47[_0xc1d5('0x39')]=_0x5bcc47[_0xc1d5('0x39')][_0xc1d5('0x4a')]?_0x5bcc47[_0xc1d5('0x39')]:_0x292ea7[_0xc1d5('0x34')];_0x5bcc47[_0xc1d5('0x3d')]=qs['sort'](_0x5d545c['query'][_0xc1d5('0x3e')]);_0x5bcc47[_0xc1d5('0x3f')]=qs['filters'](_['pick'](_0x5d545c[_0xc1d5('0x35')],_0x292ea7[_0xc1d5('0x37')]));if(_0x5d545c[_0xc1d5('0x35')][_0xc1d5('0x40')]){_0x5bcc47[_0xc1d5('0x3f')]=_[_0xc1d5('0x41')](_0x5bcc47['where'],{'$or':_[_0xc1d5('0x30')](_0x5bcc47[_0xc1d5('0x39')],function(_0x7bf23c){var _0x2e7f8f={};_0x2e7f8f[_0x7bf23c]={'$like':'%'+_0x5d545c[_0xc1d5('0x35')][_0xc1d5('0x40')]+'%'};return _0x2e7f8f;})});}_0x5bcc47=_['merge']({},_0x5bcc47,_0x5d545c[_0xc1d5('0x44')]);return _0x32f279[_0xc1d5('0x89')](_0x5bcc47);}})[_0xc1d5('0x28')](function(_0x2cde2b){if(_0x2cde2b){_0x4bff97=_0x2cde2b[_0xc1d5('0x4a')];if(!_0x5d545c[_0xc1d5('0x35')][_0xc1d5('0x3b')]('nolimit')){_0x5bcc47[_0xc1d5('0x21')]=qs[_0xc1d5('0x21')](_0x5d545c[_0xc1d5('0x35')][_0xc1d5('0x21')]);_0x5bcc47['offset']=qs['offset'](_0x5d545c[_0xc1d5('0x35')]['offset']);}return _0x32f279[_0xc1d5('0x89')](_0x5bcc47);}})[_0xc1d5('0x28')](function(_0x1b4f13){if(_0x1b4f13){return _0x1b4f13?{'count':_0x4bff97,'rows':_0x1b4f13}:null;}})[_0xc1d5('0x28')](respondWithResult(_0x5dba28,null))[_0xc1d5('0x4d')](handleError(_0x5dba28,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 645e9ac..5e2d4d2 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 _0xf5dc=['exports','events','../../mysqldb','MailQueue','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf5dc,0x189));var _0xcf5d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf5dc[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0xcf5d('0x0'));var MailQueue=require(_0xcf5d('0x1'))['db'][_0xcf5d('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xcf5d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcf5d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x161535){return function(_0xf3792d,_0x3c9981,_0x53da0a){MailQueueEvents[_0xcf5d('0x5')](_0x161535+':'+_0xf3792d['id'],_0xf3792d);MailQueueEvents[_0xcf5d('0x5')](_0x161535,_0xf3792d);_0x53da0a(null);};}for(var e in events){if(events[_0xcf5d('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xcf5d('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x83c2=['MailQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x360f23,_0x17f555){var _0x21b7e0=function(_0x8eec){while(--_0x8eec){_0x360f23['push'](_0x360f23['shift']());}};_0x21b7e0(++_0x17f555);}(_0x83c2,0x1e5));var _0x283c=function(_0x3c7d53,_0x2826d0){_0x3c7d53=_0x3c7d53-0x0;var _0x2c8387=_0x83c2[_0x3c7d53];return _0x2c8387;};'use strict';var EventEmitter=require(_0x283c('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x283c('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x283c('0x2')](0x0);var events={'afterCreate':_0x283c('0x3'),'afterUpdate':_0x283c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x227a5a){return function(_0x21d27d,_0x1943be,_0x1dad89){MailQueueEvents[_0x283c('0x5')](_0x227a5a+':'+_0x21d27d['id'],_0x21d27d);MailQueueEvents[_0x283c('0x5')](_0x227a5a,_0x21d27d);_0x1dad89(null);};}for(var e in events){if(events[_0x283c('0x6')](e)){var event=events[e];MailQueue[_0x283c('0x7')](e,emitEvent(event));}}module[_0x283c('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 4926556..83559e5 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 _0xa488=['path','exports','define','mail_queues','lodash','util','../../config/logger','api','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa488,0x13f));var _0x8a48=function(_0x466611,_0x421a63){_0x466611=_0x466611-0x0;var _0x4112c4=_0xa488[_0x466611];return _0x4112c4;};'use strict';var _=require(_0x8a48('0x0'));var util=require(_0x8a48('0x1'));var logger=require(_0x8a48('0x2'))(_0x8a48('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8a48('0x4'));var fs=require('fs');var path=require(_0x8a48('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x8a48('0x6')]=function(_0x25601b,_0x63be2b){return _0x25601b[_0x8a48('0x7')]('MailQueue',attributes,{'tableName':_0x8a48('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd779=['define','MailQueue','mail_queues','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd779,0xab));var _0x9d77=function(_0x37b5be,_0x2832df){_0x37b5be=_0x37b5be-0x0;var _0x4f3b33=_0xd779[_0x37b5be];return _0x4f3b33;};'use strict';var _=require('lodash');var util=require(_0x9d77('0x0'));var logger=require(_0x9d77('0x1'))('api');var moment=require(_0x9d77('0x2'));var BPromise=require(_0x9d77('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d77('0x4'));var rimraf=require(_0x9d77('0x5'));var config=require(_0x9d77('0x6'));var attributes=require(_0x9d77('0x7'));module[_0x9d77('0x8')]=function(_0x246a8d,_0x2bac4e){return _0x246a8d[_0x9d77('0x9')](_0x9d77('0xa'),attributes,{'tableName':_0x9d77('0xb'),'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 3cbda89..0e5a16d 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 _0xfaf0=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','find','ShowMailQueue','stringify'];(function(_0x29b141,_0xb9462){var _0x51e016=function(_0x112679){while(--_0x112679){_0x29b141['push'](_0x29b141['shift']());}};_0x51e016(++_0xb9462);}(_0xfaf0,0x1b8));var _0x0faf=function(_0x1bab51,_0x576951){_0x1bab51=_0x1bab51-0x0;var _0x3b39fa=_0xfaf0[_0x1bab51];return _0x3b39fa;};'use strict';var _=require(_0x0faf('0x0'));var util=require('util');var moment=require(_0x0faf('0x1'));var BPromise=require(_0x0faf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0faf('0x3'));var db=require(_0x0faf('0x4'))['db'];var utils=require(_0x0faf('0x5'));var logger=require('../../config/logger')(_0x0faf('0x6'));var config=require('../../config/environment');var jayson=require(_0x0faf('0x7'));var client=jayson[_0x0faf('0x8')][_0x0faf('0x9')]({'port':0x232a});config[_0x0faf('0xa')]=_['defaults'](config['redis'],{'host':_0x0faf('0xb'),'port':0x18eb});var socket=require(_0x0faf('0xc'))(new Redis(config[_0x0faf('0xa')]));require('./mailQueue.socket')[_0x0faf('0xd')](socket);function respondWithRpcPromise(_0x1fded9,_0x48bc6a,_0xd19f3){return new BPromise(function(_0x416f71,_0x1bd8b2){return client[_0x0faf('0xe')](_0x1fded9,_0xd19f3)['then'](function(_0x54e802){logger[_0x0faf('0xf')](_0x0faf('0x10'),_0x48bc6a,'request\x20sent');logger[_0x0faf('0x11')](_0x0faf('0x12'),_0x48bc6a,_0x0faf('0x13'),JSON['stringify'](_0x54e802));if(_0x54e802[_0x0faf('0x14')]){if(_0x54e802['error'][_0x0faf('0x15')]===0x1f4){logger[_0x0faf('0x14')]('MailQueue,\x20%s,\x20%s',_0x48bc6a,_0x54e802['error'][_0x0faf('0x16')]);return _0x1bd8b2(_0x54e802[_0x0faf('0x14')][_0x0faf('0x16')]);}logger[_0x0faf('0x14')](_0x0faf('0x10'),_0x48bc6a,_0x54e802[_0x0faf('0x14')][_0x0faf('0x16')]);return _0x416f71(_0x54e802['error']['message']);}else{logger[_0x0faf('0xf')](_0x0faf('0x10'),_0x48bc6a,_0x0faf('0x13'));_0x416f71(_0x54e802[_0x0faf('0x17')][_0x0faf('0x16')]);}})[_0x0faf('0x18')](function(_0x1d2e69){logger[_0x0faf('0x14')]('MailQueue,\x20%s,\x20%s',_0x48bc6a,_0x1d2e69);_0x1bd8b2(_0x1d2e69);});});}exports[_0x0faf('0x19')]=function(_0x1401b4){var _0x59801a=this;return new Promise(function(_0x626ea4,_0x3817ce){return db[_0x0faf('0x1a')][_0x0faf('0x1b')]({'raw':_0x1401b4[_0x0faf('0x1c')]?_0x1401b4[_0x0faf('0x1c')][_0x0faf('0x1d')]===undefined?!![]:![]:!![],'where':_0x1401b4['options']?_0x1401b4['options'][_0x0faf('0x1e')]||null:null,'attributes':_0x1401b4[_0x0faf('0x1c')]?_0x1401b4[_0x0faf('0x1c')][_0x0faf('0x1f')]||null:null,'limit':_0x1401b4[_0x0faf('0x1c')]?_0x1401b4[_0x0faf('0x1c')][_0x0faf('0x20')]||null:null,'include':_0x1401b4[_0x0faf('0x1c')]?_0x1401b4['options'][_0x0faf('0x21')]?_[_0x0faf('0x22')](_0x1401b4[_0x0faf('0x1c')][_0x0faf('0x21')],function(_0x5d9b39){return{'model':db[_0x5d9b39[_0x0faf('0x23')]],'as':_0x5d9b39['as'],'attributes':_0x5d9b39[_0x0faf('0x1f')],'include':_0x5d9b39[_0x0faf('0x21')]?_[_0x0faf('0x22')](_0x5d9b39[_0x0faf('0x21')],function(_0x3ca2d3){return{'model':db[_0x3ca2d3[_0x0faf('0x23')]],'as':_0x3ca2d3['as'],'attributes':_0x3ca2d3[_0x0faf('0x1f')],'include':_0x3ca2d3[_0x0faf('0x21')]?_[_0x0faf('0x22')](_0x3ca2d3['include'],function(_0xd2ad1a){return{'model':db[_0xd2ad1a[_0x0faf('0x23')]],'as':_0xd2ad1a['as'],'attributes':_0xd2ad1a[_0x0faf('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0faf('0x24')](function(_0x143a96){logger[_0x0faf('0xf')]('GetMailQueue',_0x1401b4);logger[_0x0faf('0x11')]('GetMailQueue',_0x1401b4,JSON['stringify'](_0x143a96));_0x626ea4(_0x143a96);})['catch'](function(_0x3eaed6){logger[_0x0faf('0x14')]('GetMailQueue',_0x3eaed6[_0x0faf('0x16')],_0x1401b4);_0x3817ce(_0x59801a['error'](0x1f4,_0x3eaed6['message']));});});};exports['ShowMailQueue']=function(_0x275249){var _0x2b78ee=this;return new Promise(function(_0x128dd5,_0xd27097){return db['MailQueue'][_0x0faf('0x25')]({'raw':_0x275249[_0x0faf('0x1c')]?_0x275249['options'][_0x0faf('0x1d')]===undefined?!![]:![]:!![],'where':_0x275249[_0x0faf('0x1c')]?_0x275249[_0x0faf('0x1c')][_0x0faf('0x1e')]||null:null,'attributes':_0x275249[_0x0faf('0x1c')]?_0x275249[_0x0faf('0x1c')]['attributes']||null:null,'include':_0x275249[_0x0faf('0x1c')]?_0x275249[_0x0faf('0x1c')][_0x0faf('0x21')]?_['map'](_0x275249['options'][_0x0faf('0x21')],function(_0x1d2cb8){return{'model':db[_0x1d2cb8[_0x0faf('0x23')]],'as':_0x1d2cb8['as'],'attributes':_0x1d2cb8['attributes'],'include':_0x1d2cb8[_0x0faf('0x21')]?_[_0x0faf('0x22')](_0x1d2cb8[_0x0faf('0x21')],function(_0x570551){return{'model':db[_0x570551[_0x0faf('0x23')]],'as':_0x570551['as'],'attributes':_0x570551[_0x0faf('0x1f')],'include':_0x570551[_0x0faf('0x21')]?_['map'](_0x570551[_0x0faf('0x21')],function(_0x3bf560){return{'model':db[_0x3bf560[_0x0faf('0x23')]],'as':_0x3bf560['as'],'attributes':_0x3bf560[_0x0faf('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0faf('0x24')](function(_0x4a7237){logger[_0x0faf('0xf')](_0x0faf('0x26'),_0x275249);logger[_0x0faf('0x11')]('ShowMailQueue',_0x275249,JSON[_0x0faf('0x27')](_0x4a7237));_0x128dd5(_0x4a7237);})[_0x0faf('0x18')](function(_0x59d028){logger['error'](_0x0faf('0x26'),_0x59d028[_0x0faf('0x16')],_0x275249);_0xd27097(_0x2b78ee[_0x0faf('0x14')](0x1f4,_0x59d028[_0x0faf('0x16')]));});});}; \ No newline at end of file +var _0x534f=['error','message','MailQueue,\x20%s,\x20%s','info','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','debug','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','request\x20sent','stringify'];(function(_0x1e52ef,_0x14b9cf){var _0x51567c=function(_0x1f2780){while(--_0x1f2780){_0x1e52ef['push'](_0x1e52ef['shift']());}};_0x51567c(++_0x14b9cf);}(_0x534f,0x1a3));var _0xf534=function(_0x2eddfe,_0x3a123f){_0x2eddfe=_0x2eddfe-0x0;var _0x4043ac=_0x534f[_0x2eddfe];return _0x4043ac;};'use strict';var _=require(_0xf534('0x0'));var util=require(_0xf534('0x1'));var moment=require(_0xf534('0x2'));var BPromise=require(_0xf534('0x3'));var rs=require(_0xf534('0x4'));var fs=require('fs');var Redis=require(_0xf534('0x5'));var db=require(_0xf534('0x6'))['db'];var utils=require(_0xf534('0x7'));var logger=require(_0xf534('0x8'))(_0xf534('0x9'));var config=require('../../config/environment');var jayson=require(_0xf534('0xa'));var client=jayson[_0xf534('0xb')]['http']({'port':0x232a});config[_0xf534('0xc')]=_[_0xf534('0xd')](config[_0xf534('0xc')],{'host':_0xf534('0xe'),'port':0x18eb});var socket=require(_0xf534('0xf'))(new Redis(config[_0xf534('0xc')]));require(_0xf534('0x10'))[_0xf534('0x11')](socket);function respondWithRpcPromise(_0x3189e3,_0x5650f2,_0x5f0c21){return new BPromise(function(_0x59bc7c,_0x44493e){return client[_0xf534('0x12')](_0x3189e3,_0x5f0c21)['then'](function(_0x2cd464){logger['info']('MailQueue,\x20%s,\x20%s',_0x5650f2,_0xf534('0x13'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x5650f2,_0xf534('0x13'),JSON[_0xf534('0x14')](_0x2cd464));if(_0x2cd464[_0xf534('0x15')]){if(_0x2cd464[_0xf534('0x15')]['code']===0x1f4){logger[_0xf534('0x15')]('MailQueue,\x20%s,\x20%s',_0x5650f2,_0x2cd464['error'][_0xf534('0x16')]);return _0x44493e(_0x2cd464['error'][_0xf534('0x16')]);}logger[_0xf534('0x15')](_0xf534('0x17'),_0x5650f2,_0x2cd464[_0xf534('0x15')]['message']);return _0x59bc7c(_0x2cd464['error']['message']);}else{logger[_0xf534('0x18')](_0xf534('0x17'),_0x5650f2,_0xf534('0x13'));_0x59bc7c(_0x2cd464['result'][_0xf534('0x16')]);}})[_0xf534('0x19')](function(_0x169d96){logger[_0xf534('0x15')]('MailQueue,\x20%s,\x20%s',_0x5650f2,_0x169d96);_0x44493e(_0x169d96);});});}exports[_0xf534('0x1a')]=function(_0x52995d){var _0x234055=this;return new Promise(function(_0xc9e2f4,_0x2598cf){return db[_0xf534('0x1b')][_0xf534('0x1c')]({'raw':_0x52995d['options']?_0x52995d[_0xf534('0x1d')][_0xf534('0x1e')]===undefined?!![]:![]:!![],'where':_0x52995d[_0xf534('0x1d')]?_0x52995d[_0xf534('0x1d')][_0xf534('0x1f')]||null:null,'attributes':_0x52995d[_0xf534('0x1d')]?_0x52995d[_0xf534('0x1d')][_0xf534('0x20')]||null:null,'limit':_0x52995d[_0xf534('0x1d')]?_0x52995d['options'][_0xf534('0x21')]||null:null,'include':_0x52995d['options']?_0x52995d[_0xf534('0x1d')][_0xf534('0x22')]?_['map'](_0x52995d[_0xf534('0x1d')][_0xf534('0x22')],function(_0x1ccdca){return{'model':db[_0x1ccdca[_0xf534('0x23')]],'as':_0x1ccdca['as'],'attributes':_0x1ccdca['attributes'],'include':_0x1ccdca['include']?_[_0xf534('0x24')](_0x1ccdca[_0xf534('0x22')],function(_0x4161e1){return{'model':db[_0x4161e1[_0xf534('0x23')]],'as':_0x4161e1['as'],'attributes':_0x4161e1['attributes'],'include':_0x4161e1['include']?_[_0xf534('0x24')](_0x4161e1[_0xf534('0x22')],function(_0x3c9932){return{'model':db[_0x3c9932[_0xf534('0x23')]],'as':_0x3c9932['as'],'attributes':_0x3c9932[_0xf534('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf534('0x25')](function(_0x1fde23){logger['info'](_0xf534('0x1a'),_0x52995d);logger[_0xf534('0x26')](_0xf534('0x1a'),_0x52995d,JSON[_0xf534('0x14')](_0x1fde23));_0xc9e2f4(_0x1fde23);})[_0xf534('0x19')](function(_0x23fead){logger[_0xf534('0x15')](_0xf534('0x1a'),_0x23fead[_0xf534('0x16')],_0x52995d);_0x2598cf(_0x234055[_0xf534('0x15')](0x1f4,_0x23fead[_0xf534('0x16')]));});});};exports[_0xf534('0x27')]=function(_0x56fcb6){var _0x297e9b=this;return new Promise(function(_0x4e901e,_0x2354f6){return db[_0xf534('0x1b')]['find']({'raw':_0x56fcb6[_0xf534('0x1d')]?_0x56fcb6[_0xf534('0x1d')][_0xf534('0x1e')]===undefined?!![]:![]:!![],'where':_0x56fcb6['options']?_0x56fcb6[_0xf534('0x1d')]['where']||null:null,'attributes':_0x56fcb6[_0xf534('0x1d')]?_0x56fcb6[_0xf534('0x1d')][_0xf534('0x20')]||null:null,'include':_0x56fcb6[_0xf534('0x1d')]?_0x56fcb6[_0xf534('0x1d')][_0xf534('0x22')]?_[_0xf534('0x24')](_0x56fcb6[_0xf534('0x1d')][_0xf534('0x22')],function(_0x4edc53){return{'model':db[_0x4edc53[_0xf534('0x23')]],'as':_0x4edc53['as'],'attributes':_0x4edc53['attributes'],'include':_0x4edc53[_0xf534('0x22')]?_[_0xf534('0x24')](_0x4edc53['include'],function(_0x59ca7c){return{'model':db[_0x59ca7c[_0xf534('0x23')]],'as':_0x59ca7c['as'],'attributes':_0x59ca7c['attributes'],'include':_0x59ca7c[_0xf534('0x22')]?_[_0xf534('0x24')](_0x59ca7c[_0xf534('0x22')],function(_0x2fcb75){return{'model':db[_0x2fcb75['model']],'as':_0x2fcb75['as'],'attributes':_0x2fcb75[_0xf534('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x203868){logger['info'](_0xf534('0x27'),_0x56fcb6);logger[_0xf534('0x26')](_0xf534('0x27'),_0x56fcb6,JSON[_0xf534('0x14')](_0x203868));_0x4e901e(_0x203868);})[_0xf534('0x19')](function(_0x259de6){logger[_0xf534('0x15')]('ShowMailQueue',_0x259de6[_0xf534('0x16')],_0x56fcb6);_0x2354f6(_0x297e9b[_0xf534('0x15')](0x1f4,_0x259de6[_0xf534('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index df08a65..7498975 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 _0x90f7=['save','remove','update','emit','length'];(function(_0x26d7e3,_0x4d5ad8){var _0x5f3ee1=function(_0x399660){while(--_0x399660){_0x26d7e3['push'](_0x26d7e3['shift']());}};_0x5f3ee1(++_0x4d5ad8);}(_0x90f7,0x1d6));var _0x790f=function(_0x13f5a2,_0x435893){_0x13f5a2=_0x13f5a2-0x0;var _0x1c2719=_0x90f7[_0x13f5a2];return _0x1c2719;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x790f('0x0'),_0x790f('0x1'),_0x790f('0x2')];function createListener(_0x2f48a7,_0x2d7e28){return function(_0x448f97){_0x2d7e28[_0x790f('0x3')](_0x2f48a7,_0x448f97);};}function removeListener(_0x1772df,_0x22917c){return function(){MailQueueEvents['removeListener'](_0x1772df,_0x22917c);};}exports['register']=function(_0x2a31d9){for(var _0x3f2d0b=0x0,_0x35ac08=events[_0x790f('0x4')];_0x3f2d0b<_0x35ac08;_0x3f2d0b++){var _0x59de47=events[_0x3f2d0b];var _0x2205ae=createListener('mailQueue:'+_0x59de47,_0x2a31d9);MailQueueEvents['on'](_0x59de47,_0x2205ae);}}; \ No newline at end of file +var _0x43b7=['register','length','./mailQueue.events','update','removeListener'];(function(_0x367448,_0x3e9deb){var _0x28b046=function(_0x2c9ff8){while(--_0x2c9ff8){_0x367448['push'](_0x367448['shift']());}};_0x28b046(++_0x3e9deb);}(_0x43b7,0x183));var _0x743b=function(_0x401e27,_0xd6af56){_0x401e27=_0x401e27-0x0;var _0x56d460=_0x43b7[_0x401e27];return _0x56d460;};'use strict';var MailQueueEvents=require(_0x743b('0x0'));var events=['save','remove',_0x743b('0x1')];function createListener(_0x56d9c3,_0x2e177a){return function(_0x320b11){_0x2e177a['emit'](_0x56d9c3,_0x320b11);};}function removeListener(_0x5f0319,_0x45a9a7){return function(){MailQueueEvents[_0x743b('0x2')](_0x5f0319,_0x45a9a7);};}exports[_0x743b('0x3')]=function(_0x2e8cd2){for(var _0x8d405=0x0,_0x1b25ec=events[_0x743b('0x4')];_0x8d405<_0x1b25ec;_0x8d405++){var _0x515ed3=events[_0x8d405];var _0x542c29=createListener('mailQueue:'+_0x515ed3,_0x2e8cd2);MailQueueEvents['on'](_0x515ed3,_0x542c29);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 9163451..b943c3d 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 _0xea88=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','multer','express','fs-extra'];(function(_0xa220ed,_0x309883){var _0x5e34e6=function(_0x2edb93){while(--_0x2edb93){_0xa220ed['push'](_0xa220ed['shift']());}};_0x5e34e6(++_0x309883);}(_0xea88,0x189));var _0x8ea8=function(_0x1be76d,_0xcd36b){_0x1be76d=_0x1be76d-0x0;var _0x53f003=_0xea88[_0x1be76d];return _0x53f003;};'use strict';var multer=require(_0x8ea8('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8ea8('0x1'));var router=express['Router']();var fs_extra=require(_0x8ea8('0x2'));var auth=require(_0x8ea8('0x3'));var interaction=require(_0x8ea8('0x4'));var config=require(_0x8ea8('0x5'));var controller=require(_0x8ea8('0x6'));router[_0x8ea8('0x7')]('/',auth['isAuthenticated'](),controller[_0x8ea8('0x8')]);router[_0x8ea8('0x7')](_0x8ea8('0x9'),auth[_0x8ea8('0xa')](),controller[_0x8ea8('0xb')]);router['get'](_0x8ea8('0xc'),auth[_0x8ea8('0xa')](),controller['show']);router[_0x8ea8('0xd')]('/',auth[_0x8ea8('0xa')](),controller[_0x8ea8('0xe')]);router[_0x8ea8('0xf')](_0x8ea8('0xc'),auth['isAuthenticated'](),controller[_0x8ea8('0x10')]);router[_0x8ea8('0x11')](_0x8ea8('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf7e9=['show','post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe'];(function(_0x4a2c56,_0x387e2c){var _0x5adfca=function(_0x560da0){while(--_0x560da0){_0x4a2c56['push'](_0x4a2c56['shift']());}};_0x5adfca(++_0x387e2c);}(_0xf7e9,0x143));var _0x9f7e=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xf7e9[_0xef8146];return _0x5a6cb0;};'use strict';var multer=require(_0x9f7e('0x0'));var util=require(_0x9f7e('0x1'));var path=require('path');var timeout=require(_0x9f7e('0x2'));var express=require(_0x9f7e('0x3'));var router=express[_0x9f7e('0x4')]();var fs_extra=require(_0x9f7e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9f7e('0x6'));var config=require(_0x9f7e('0x7'));var controller=require(_0x9f7e('0x8'));router[_0x9f7e('0x9')]('/',auth[_0x9f7e('0xa')](),controller[_0x9f7e('0xb')]);router[_0x9f7e('0x9')]('/describe',auth[_0x9f7e('0xa')](),controller[_0x9f7e('0xc')]);router[_0x9f7e('0x9')]('/:id',auth[_0x9f7e('0xa')](),controller[_0x9f7e('0xd')]);router[_0x9f7e('0xe')]('/',auth['isAuthenticated'](),controller[_0x9f7e('0xf')]);router['put'](_0x9f7e('0x10'),auth['isAuthenticated'](),controller[_0x9f7e('0x11')]);router[_0x9f7e('0x12')](_0x9f7e('0x10'),auth[_0x9f7e('0xa')](),controller[_0x9f7e('0x13')]);module[_0x9f7e('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 99e86d7..2b4e25c 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 _0x0e4f=['STRING','DATE','moment','exports'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x0e4f,0xca));var _0xf0e4=function(_0xf6c153,_0x39b8aa){_0xf6c153=_0xf6c153-0x0;var _0x10c11d=_0x0e4f[_0xf6c153];return _0x10c11d;};'use strict';var moment=require(_0xf0e4('0x0'));var Sequelize=require('sequelize');module[_0xf0e4('0x1')]={'uniqueid':{'type':Sequelize[_0xf0e4('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf0e4('0x3')]},'leaveAt':{'type':Sequelize[_0xf0e4('0x3')]},'acceptAt':{'type':Sequelize[_0xf0e4('0x3')]},'exitAt':{'type':Sequelize[_0xf0e4('0x3')]},'reason':{'type':Sequelize[_0xf0e4('0x2')]}}; \ No newline at end of file +var _0x1d8a=['DATE','sequelize','exports','STRING'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x1d8a,0x1f1));var _0xa1d8=function(_0xeef39f,_0x3add43){_0xeef39f=_0xeef39f-0x0;var _0x4ed8a8=_0x1d8a[_0xeef39f];return _0x4ed8a8;};'use strict';var moment=require('moment');var Sequelize=require(_0xa1d8('0x0'));module[_0xa1d8('0x1')]={'uniqueid':{'type':Sequelize[_0xa1d8('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa1d8('0x3')]},'leaveAt':{'type':Sequelize[_0xa1d8('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa1d8('0x3')]},'reason':{'type':Sequelize[_0xa1d8('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 5ec0e8c..320b181 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 _0x5430=['update','then','destroy','stack','name','send','index','MailQueueReport','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(_0xe017f7,_0x3725ba){var _0x3f2d4e=function(_0xcf0577){while(--_0xcf0577){_0xe017f7['push'](_0xe017f7['shift']());}};_0x3f2d4e(++_0x3725ba);}(_0x5430,0x10c));var _0x0543=function(_0x3a9f18,_0x1ec7d2){_0x3a9f18=_0x3a9f18-0x0;var _0x125b32=_0x5430[_0x3a9f18];return _0x125b32;};'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['MailQueueReport']['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 _0x6050=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','name','send','index','map','MailQueueReport','rawAttributes','type','key','model','query','keys'];(function(_0x583737,_0x1dffb1){var _0x552844=function(_0x2246c0){while(--_0x2246c0){_0x583737['push'](_0x583737['shift']());}};_0x552844(++_0x1dffb1);}(_0x6050,0x196));var _0x0605=function(_0x45dc33,_0x524b5f){_0x45dc33=_0x45dc33-0x0;var _0x398f42=_0x6050[_0x45dc33];return _0x398f42;};'use strict';var emlformat=require(_0x0605('0x0'));var rimraf=require(_0x0605('0x1'));var zipdir=require(_0x0605('0x2'));var jsonpatch=require(_0x0605('0x3'));var rp=require(_0x0605('0x4'));var moment=require(_0x0605('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0605('0x6'));var util=require(_0x0605('0x7'));var path=require(_0x0605('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0605('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0605('0xa'));var deskjs=require(_0x0605('0xb'));var toCsv=require(_0x0605('0xc'));var querystring=require(_0x0605('0xd'));var Papa=require(_0x0605('0xe'));var Redis=require('ioredis');var authService=require(_0x0605('0xf'));var qs=require(_0x0605('0x10'));var as=require(_0x0605('0x11'));var hardwareService=require(_0x0605('0x12'));var logger=require(_0x0605('0x13'))(_0x0605('0x14'));var utils=require(_0x0605('0x15'));var config=require(_0x0605('0x16'));var licenseUtil=require(_0x0605('0x17'));var db=require(_0x0605('0x18'))['db'];function respondWithStatusCode(_0xd22e35,_0x39e288){_0x39e288=_0x39e288||0xcc;return function(_0x34c9e6){if(_0x34c9e6){return _0xd22e35[_0x0605('0x19')](_0x39e288);}return _0xd22e35[_0x0605('0x1a')](_0x39e288)[_0x0605('0x1b')]();};}function respondWithResult(_0x169a70,_0x65a20b){_0x65a20b=_0x65a20b||0xc8;return function(_0x1b944f){if(_0x1b944f){return _0x169a70['status'](_0x65a20b)[_0x0605('0x1c')](_0x1b944f);}};}function respondWithFilteredResult(_0x1a802b,_0x4993ab){return function(_0x5ce56a){if(_0x5ce56a){var _0x4eefe9=typeof _0x4993ab[_0x0605('0x1d')]===_0x0605('0x1e')&&typeof _0x4993ab[_0x0605('0x1f')]===_0x0605('0x1e');var _0xefc557=_0x5ce56a[_0x0605('0x20')];var _0x2b7b5a=_0x4eefe9?0x0:_0x4993ab[_0x0605('0x1d')];var _0x193520=_0x4eefe9?_0x5ce56a[_0x0605('0x20')]:_0x4993ab[_0x0605('0x1d')]+_0x4993ab[_0x0605('0x1f')];var _0x2e2204;if(_0x193520>=_0xefc557){_0x193520=_0xefc557;_0x2e2204=0xc8;}else{_0x2e2204=0xce;}_0x1a802b[_0x0605('0x1a')](_0x2e2204);return _0x1a802b['set'](_0x0605('0x21'),_0x2b7b5a+'-'+_0x193520+'/'+_0xefc557)[_0x0605('0x1c')](_0x5ce56a);}return null;};}function patchUpdates(_0x430f28){return function(_0x443326){try{jsonpatch[_0x0605('0x22')](_0x443326,_0x430f28,!![]);}catch(_0x90b2e1){return BPromise[_0x0605('0x23')](_0x90b2e1);}return _0x443326[_0x0605('0x24')]();};}function saveUpdates(_0x226ef5,_0x5b0d44){return function(_0xc334b8){if(_0xc334b8){return _0xc334b8['update'](_0x226ef5)[_0x0605('0x25')](function(_0x118e9c){return _0x118e9c;});}return null;};}function removeEntity(_0x110098,_0xf182c4){return function(_0x10c575){if(_0x10c575){return _0x10c575[_0x0605('0x26')]()[_0x0605('0x25')](function(){_0x110098[_0x0605('0x1a')](0xcc)[_0x0605('0x1b')]();});}};}function handleEntityNotFound(_0x2896d7,_0x9f2833){return function(_0x1c3722){if(!_0x1c3722){_0x2896d7['sendStatus'](0x194);}return _0x1c3722;};}function handleError(_0x6bc204,_0x3c8e36){_0x3c8e36=_0x3c8e36||0x1f4;return function(_0x4b1e0c){logger['error'](_0x4b1e0c['stack']);if(_0x4b1e0c[_0x0605('0x27')]){delete _0x4b1e0c[_0x0605('0x27')];}_0x6bc204[_0x0605('0x1a')](_0x3c8e36)[_0x0605('0x28')](_0x4b1e0c);};}exports[_0x0605('0x29')]=function(_0x4554df,_0x4e32ef){var _0x34f25d={},_0x5daef6={},_0xa836f2={'count':0x0,'rows':[]};var _0x3640b9=_[_0x0605('0x2a')](db[_0x0605('0x2b')][_0x0605('0x2c')],function(_0x352dd6){return{'name':_0x352dd6['fieldName'],'type':_0x352dd6[_0x0605('0x2d')][_0x0605('0x2e')]};});_0x5daef6[_0x0605('0x2f')]=_[_0x0605('0x2a')](_0x3640b9,_0x0605('0x27'));_0x5daef6[_0x0605('0x30')]=_[_0x0605('0x31')](_0x4554df[_0x0605('0x30')]);_0x5daef6[_0x0605('0x32')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],_0x5daef6[_0x0605('0x30')]);_0x34f25d[_0x0605('0x34')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x4554df[_0x0605('0x30')][_0x0605('0x35')]));_0x34f25d[_0x0605('0x34')]=_0x34f25d[_0x0605('0x34')][_0x0605('0x36')]?_0x34f25d[_0x0605('0x34')]:_0x5daef6[_0x0605('0x2f')];if(!_0x4554df[_0x0605('0x30')][_0x0605('0x37')](_0x0605('0x38'))){_0x34f25d[_0x0605('0x1f')]=qs['limit'](_0x4554df[_0x0605('0x30')][_0x0605('0x1f')]);_0x34f25d['offset']=qs[_0x0605('0x1d')](_0x4554df[_0x0605('0x30')]['offset']);}_0x34f25d[_0x0605('0x39')]=qs[_0x0605('0x3a')](_0x4554df[_0x0605('0x30')][_0x0605('0x3a')]);_0x34f25d[_0x0605('0x3b')]=qs[_0x0605('0x32')](_['pick'](_0x4554df['query'],_0x5daef6[_0x0605('0x32')]),_0x3640b9);if(_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]){_0x34f25d['where']=_[_0x0605('0x3d')](_0x34f25d['where'],{'$or':_[_0x0605('0x2a')](_0x3640b9,function(_0x1e98f6){if(_0x1e98f6[_0x0605('0x2d')]!==_0x0605('0x3e')){var _0x42f7ce={};_0x42f7ce[_0x1e98f6[_0x0605('0x27')]]={'$like':'%'+_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]+'%'};return _0x42f7ce;}})});}_0x34f25d=_[_0x0605('0x3d')]({},_0x34f25d,_0x4554df[_0x0605('0x3f')]);var _0x57aa15={'where':_0x34f25d[_0x0605('0x3b')]};return db['MailQueueReport'][_0x0605('0x20')](_0x57aa15)[_0x0605('0x25')](function(_0x45787e){_0xa836f2['count']=_0x45787e;if(_0x4554df['query'][_0x0605('0x40')]){_0x34f25d['include']=[{'all':!![]}];}return db[_0x0605('0x2b')][_0x0605('0x41')](_0x34f25d);})[_0x0605('0x25')](function(_0x3de34a){_0xa836f2[_0x0605('0x42')]=_0x3de34a;return _0xa836f2;})[_0x0605('0x25')](respondWithFilteredResult(_0x4e32ef,_0x34f25d))[_0x0605('0x43')](handleError(_0x4e32ef,null));};exports[_0x0605('0x44')]=function(_0x3fa553,_0x10bb36){var _0x18d3ce={'raw':!![],'where':{'id':_0x3fa553[_0x0605('0x45')]['id']}},_0x3616a3={};_0x3616a3['model']=_['keys'](db[_0x0605('0x2b')]['rawAttributes']);_0x3616a3[_0x0605('0x30')]=_[_0x0605('0x31')](_0x3fa553['query']);_0x3616a3[_0x0605('0x32')]=_[_0x0605('0x33')](_0x3616a3['model'],_0x3616a3[_0x0605('0x30')]);_0x18d3ce[_0x0605('0x34')]=_['intersection'](_0x3616a3[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x3fa553['query'][_0x0605('0x35')]));_0x18d3ce['attributes']=_0x18d3ce['attributes'][_0x0605('0x36')]?_0x18d3ce[_0x0605('0x34')]:_0x3616a3[_0x0605('0x2f')];if(_0x3fa553[_0x0605('0x30')][_0x0605('0x40')]){_0x18d3ce[_0x0605('0x46')]=[{'all':!![]}];}_0x18d3ce=_[_0x0605('0x3d')]({},_0x18d3ce,_0x3fa553[_0x0605('0x3f')]);return db['MailQueueReport'][_0x0605('0x47')](_0x18d3ce)[_0x0605('0x25')](handleEntityNotFound(_0x10bb36,null))[_0x0605('0x25')](respondWithResult(_0x10bb36,null))['catch'](handleError(_0x10bb36,null));};exports[_0x0605('0x48')]=function(_0x1fb70b,_0x45cc1a){return db[_0x0605('0x2b')][_0x0605('0x48')](_0x1fb70b[_0x0605('0x49')],{})[_0x0605('0x25')](respondWithResult(_0x45cc1a,0xc9))[_0x0605('0x43')](handleError(_0x45cc1a,null));};exports[_0x0605('0x4a')]=function(_0x4bc55e,_0x3c597c){if(_0x4bc55e[_0x0605('0x49')]['id']){delete _0x4bc55e[_0x0605('0x49')]['id'];}return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4bc55e[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x3c597c,null))[_0x0605('0x25')](saveUpdates(_0x4bc55e[_0x0605('0x49')],null))[_0x0605('0x25')](respondWithResult(_0x3c597c,null))['catch'](handleError(_0x3c597c,null));};exports['destroy']=function(_0x4876c7,_0x2687a8){return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4876c7[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x2687a8,null))[_0x0605('0x25')](removeEntity(_0x2687a8,null))['catch'](handleError(_0x2687a8,null));};exports[_0x0605('0x4b')]=function(_0x286485,_0x184232){return db[_0x0605('0x2b')]['describe']()[_0x0605('0x25')](respondWithResult(_0x184232,null))[_0x0605('0x43')](handleError(_0x184232,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 8790383..a5ca37a 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 _0x0b4a=['moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','../../config/logger','api'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x0b4a,0x1c6));var _0xa0b4=function(_0x2b24db,_0x39ced1){_0x2b24db=_0x2b24db-0x0;var _0x5ad545=_0x0b4a[_0x2b24db];return _0x5ad545;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa0b4('0x0'))(_0xa0b4('0x1'));var moment=require(_0xa0b4('0x2'));var BPromise=require(_0xa0b4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0b4('0x4'));var rimraf=require(_0xa0b4('0x5'));var config=require(_0xa0b4('0x6'));var attributes=require(_0xa0b4('0x7'));module[_0xa0b4('0x8')]=function(_0xec55c6,_0x5cfd89){return _0xec55c6['define'](_0xa0b4('0x9'),attributes,{'tableName':_0xa0b4('0xa'),'paranoid':![],'indexes':[{'name':_0xa0b4('0xb'),'fields':[_0xa0b4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fcc=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','uniqueid','lodash'];(function(_0x4a4713,_0x12dcd0){var _0x2e5ae8=function(_0x5a5693){while(--_0x5a5693){_0x4a4713['push'](_0x4a4713['shift']());}};_0x2e5ae8(++_0x12dcd0);}(_0x7fcc,0x8b));var _0xc7fc=function(_0x3bee46,_0x5970e7){_0x3bee46=_0x3bee46-0x0;var _0x41adc7=_0x7fcc[_0x3bee46];return _0x41adc7;};'use strict';var _=require(_0xc7fc('0x0'));var util=require(_0xc7fc('0x1'));var logger=require(_0xc7fc('0x2'))(_0xc7fc('0x3'));var moment=require(_0xc7fc('0x4'));var BPromise=require(_0xc7fc('0x5'));var rp=require(_0xc7fc('0x6'));var fs=require('fs');var path=require(_0xc7fc('0x7'));var rimraf=require(_0xc7fc('0x8'));var config=require(_0xc7fc('0x9'));var attributes=require(_0xc7fc('0xa'));module['exports']=function(_0x4b1d93,_0x41fb12){return _0x4b1d93[_0xc7fc('0xb')](_0xc7fc('0xc'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xc7fc('0xd'),'fields':[_0xc7fc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 71c1e24..82c3171 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 _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x3e5bf1,_0x3f764f){var _0x13da95=function(_0x1f34da){while(--_0x1f34da){_0x3e5bf1['push'](_0x3e5bf1['shift']());}};_0x13da95(++_0x3f764f);}(_0x7a54,0x106));var _0x47a5=function(_0x357699,_0x4dccc5){_0x357699=_0x357699-0x0;var _0xc4bda=_0x7a54[_0x357699];return _0xc4bda;};'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')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x5e70f0,_0x3481e1){var _0x3d8a82=function(_0x4d5649){while(--_0x4d5649){_0x5e70f0['push'](_0x5e70f0['shift']());}};_0x3d8a82(++_0x3481e1);}(_0x7a54,0x106));var _0x47a5=function(_0x2e4c27,_0x312d69){_0x2e4c27=_0x2e4c27-0x0;var _0x2e3714=_0x7a54[_0x2e4c27];return _0x2e3714;};'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')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index d264b1b..84b7eea 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x463e4d,_0x3607f5){var _0x20185c=function(_0x53b50a){while(--_0x53b50a){_0x463e4d['push'](_0x463e4d['shift']());}};_0x20185c(++_0x3607f5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4aec87,_0x271913){var _0x3d4bdb=function(_0x27bb78){while(--_0x27bb78){_0x4aec87['push'](_0x4aec87['shift']());}};_0x3d4bdb(++_0x271913);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0xcb91[_0x1064bc];return _0x5edc45;};'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 e24c183..9c1657e 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 _0x29b1=['INBOX','BOOLEAN','exports','STRING','INTEGER'];(function(_0x560539,_0x5d73f3){var _0x52ad14=function(_0x268077){while(--_0x268077){_0x560539['push'](_0x560539['shift']());}};_0x52ad14(++_0x5d73f3);}(_0x29b1,0xbb));var _0x129b=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x29b1[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require('sequelize');module[_0x129b('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x129b('0x1')]},'password':{'type':Sequelize[_0x129b('0x1')]},'port':{'type':Sequelize[_0x129b('0x2')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x129b('0x1')],'defaultValue':_0x129b('0x3')},'connTimeout':{'type':Sequelize[_0x129b('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x129b('0x2')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x129b('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x9275=['BOOLEAN','INTEGER','INBOX','exports','STRING'];(function(_0x475b28,_0x5b644){var _0x531cfd=function(_0x2b8732){while(--_0x2b8732){_0x475b28['push'](_0x475b28['shift']());}};_0x531cfd(++_0x5b644);}(_0x9275,0x170));var _0x5927=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0x9275[_0x5d5bcb];return _0x4ea5eb;};'use strict';var Sequelize=require('sequelize');module[_0x5927('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x5927('0x1')]},'authentication':{'type':Sequelize[_0x5927('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x5927('0x1')]},'password':{'type':Sequelize[_0x5927('0x1')]},'port':{'type':Sequelize[_0x5927('0x3')]},'tls':{'type':Sequelize[_0x5927('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x5927('0x4')},'connTimeout':{'type':Sequelize[_0x5927('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x5927('0x1')]},'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 7df52be..4352dd9 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 _0xdf35=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailServerIn','mail_servers_in','util','../../config/logger'];(function(_0x3f4564,_0x5b4427){var _0x3c560f=function(_0x465009){while(--_0x465009){_0x3f4564['push'](_0x3f4564['shift']());}};_0x3c560f(++_0x5b4427);}(_0xdf35,0x8d));var _0x5df3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xdf35[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x5df3('0x0'));var logger=require(_0x5df3('0x1'))(_0x5df3('0x2'));var moment=require(_0x5df3('0x3'));var BPromise=require(_0x5df3('0x4'));var rp=require(_0x5df3('0x5'));var fs=require('fs');var path=require(_0x5df3('0x6'));var rimraf=require(_0x5df3('0x7'));var config=require(_0x5df3('0x8'));var attributes=require('./mailServerIn.attributes');module[_0x5df3('0x9')]=function(_0x1c14ea,_0x5562cc){return _0x1c14ea[_0x5df3('0xa')](_0x5df3('0xb'),attributes,{'tableName':_0x5df3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb35e=['../../config/logger','api','bluebird','path','rimraf','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash'];(function(_0x1283ea,_0x1eeb8c){var _0x21bb56=function(_0x3f4009){while(--_0x3f4009){_0x1283ea['push'](_0x1283ea['shift']());}};_0x21bb56(++_0x1eeb8c);}(_0xb35e,0x15d));var _0xeb35=function(_0x25a1c4,_0xd8aaa6){_0x25a1c4=_0x25a1c4-0x0;var _0x470c9a=_0xb35e[_0x25a1c4];return _0x470c9a;};'use strict';var _=require(_0xeb35('0x0'));var util=require('util');var logger=require(_0xeb35('0x1'))(_0xeb35('0x2'));var moment=require('moment');var BPromise=require(_0xeb35('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb35('0x4'));var rimraf=require(_0xeb35('0x5'));var config=require('../../config/environment');var attributes=require(_0xeb35('0x6'));module[_0xeb35('0x7')]=function(_0x2951c6,_0x2e4aa8){return _0x2951c6['define'](_0xeb35('0x8'),attributes,{'tableName':_0xeb35('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 1387b46..575b951 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 _0x6865=['../../config/environment','jayson/promise','client','http','request','then','info','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','limit','include','map','model','attributes','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x58bba8,_0x213d48){var _0x110a16=function(_0x5af1c7){while(--_0x5af1c7){_0x58bba8['push'](_0x58bba8['shift']());}};_0x110a16(++_0x213d48);}(_0x6865,0xa7));var _0x5686=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6865[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x5686('0x0'));var moment=require(_0x5686('0x1'));var BPromise=require(_0x5686('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5686('0x3'));var db=require(_0x5686('0x4'))['db'];var utils=require(_0x5686('0x5'));var logger=require(_0x5686('0x6'))(_0x5686('0x7'));var config=require(_0x5686('0x8'));var jayson=require(_0x5686('0x9'));var client=jayson[_0x5686('0xa')][_0x5686('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f86db,_0x53ff16,_0x2a15c9){return new BPromise(function(_0x3371e9,_0x272ccc){return client[_0x5686('0xc')](_0x4f86db,_0x2a15c9)[_0x5686('0xd')](function(_0x4104ac){logger[_0x5686('0xe')]('MailServerIn,\x20%s,\x20%s',_0x53ff16,'request\x20sent');logger[_0x5686('0xf')](_0x5686('0x10'),_0x53ff16,_0x5686('0x11'),JSON['stringify'](_0x4104ac));if(_0x4104ac[_0x5686('0x12')]){if(_0x4104ac[_0x5686('0x12')][_0x5686('0x13')]===0x1f4){logger['error'](_0x5686('0x14'),_0x53ff16,_0x4104ac[_0x5686('0x12')][_0x5686('0x15')]);return _0x272ccc(_0x4104ac[_0x5686('0x12')][_0x5686('0x15')]);}logger['error'](_0x5686('0x14'),_0x53ff16,_0x4104ac['error'][_0x5686('0x15')]);return _0x3371e9(_0x4104ac[_0x5686('0x12')][_0x5686('0x15')]);}else{logger[_0x5686('0xe')](_0x5686('0x14'),_0x53ff16,_0x5686('0x11'));_0x3371e9(_0x4104ac[_0x5686('0x16')][_0x5686('0x15')]);}})[_0x5686('0x17')](function(_0x23c453){logger['error'](_0x5686('0x14'),_0x53ff16,_0x23c453);_0x272ccc(_0x23c453);});});}exports[_0x5686('0x18')]=function(_0x14c19e){var _0x40c2e6=this;return new Promise(function(_0x32fe3a,_0x364e78){return db[_0x5686('0x19')][_0x5686('0x1a')]({'raw':_0x14c19e['options']?_0x14c19e[_0x5686('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x14c19e['options']?_0x14c19e[_0x5686('0x1b')][_0x5686('0x1c')]||null:null,'attributes':_0x14c19e[_0x5686('0x1b')]?_0x14c19e[_0x5686('0x1b')]['attributes']||null:null,'limit':_0x14c19e[_0x5686('0x1b')]?_0x14c19e[_0x5686('0x1b')][_0x5686('0x1d')]||null:null,'include':_0x14c19e[_0x5686('0x1b')]?_0x14c19e[_0x5686('0x1b')][_0x5686('0x1e')]?_[_0x5686('0x1f')](_0x14c19e[_0x5686('0x1b')][_0x5686('0x1e')],function(_0x36c1e3){return{'model':db[_0x36c1e3[_0x5686('0x20')]],'as':_0x36c1e3['as'],'attributes':_0x36c1e3[_0x5686('0x21')],'include':_0x36c1e3[_0x5686('0x1e')]?_[_0x5686('0x1f')](_0x36c1e3[_0x5686('0x1e')],function(_0x516e46){return{'model':db[_0x516e46[_0x5686('0x20')]],'as':_0x516e46['as'],'attributes':_0x516e46['attributes'],'include':_0x516e46[_0x5686('0x1e')]?_[_0x5686('0x1f')](_0x516e46[_0x5686('0x1e')],function(_0x3d50bd){return{'model':db[_0x3d50bd[_0x5686('0x20')]],'as':_0x3d50bd['as'],'attributes':_0x3d50bd[_0x5686('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5686('0xd')](function(_0x1d18ff){logger[_0x5686('0xe')](_0x5686('0x18'),_0x14c19e);logger[_0x5686('0xf')](_0x5686('0x18'),_0x14c19e,JSON[_0x5686('0x22')](_0x1d18ff));_0x32fe3a(_0x1d18ff);})[_0x5686('0x17')](function(_0x2184e3){logger[_0x5686('0x12')]('GetMailServerIn',_0x2184e3[_0x5686('0x15')],_0x14c19e);_0x364e78(_0x40c2e6[_0x5686('0x12')](0x1f4,_0x2184e3[_0x5686('0x15')]));});});}; \ No newline at end of file +var _0x1317=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetMailServerIn','MailServerIn','findAll','options','raw','attributes','limit','include','map','model','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x1317,0xa3));var _0x7131=function(_0x4ddb0c,_0x1bba02){_0x4ddb0c=_0x4ddb0c-0x0;var _0x554e87=_0x1317[_0x4ddb0c];return _0x554e87;};'use strict';var _=require(_0x7131('0x0'));var util=require('util');var moment=require(_0x7131('0x1'));var BPromise=require('bluebird');var rs=require(_0x7131('0x2'));var fs=require('fs');var Redis=require(_0x7131('0x3'));var db=require(_0x7131('0x4'))['db'];var utils=require(_0x7131('0x5'));var logger=require(_0x7131('0x6'))(_0x7131('0x7'));var config=require(_0x7131('0x8'));var jayson=require(_0x7131('0x9'));var client=jayson[_0x7131('0xa')][_0x7131('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd2844c,_0x55f1ad,_0xb3285d){return new BPromise(function(_0x5a000d,_0x5eb292){return client[_0x7131('0xc')](_0xd2844c,_0xb3285d)[_0x7131('0xd')](function(_0xb52b80){logger[_0x7131('0xe')](_0x7131('0xf'),_0x55f1ad,_0x7131('0x10'));logger['debug'](_0x7131('0x11'),_0x55f1ad,_0x7131('0x10'),JSON[_0x7131('0x12')](_0xb52b80));if(_0xb52b80['error']){if(_0xb52b80['error'][_0x7131('0x13')]===0x1f4){logger[_0x7131('0x14')](_0x7131('0xf'),_0x55f1ad,_0xb52b80[_0x7131('0x14')]['message']);return _0x5eb292(_0xb52b80[_0x7131('0x14')]['message']);}logger['error'](_0x7131('0xf'),_0x55f1ad,_0xb52b80[_0x7131('0x14')][_0x7131('0x15')]);return _0x5a000d(_0xb52b80[_0x7131('0x14')][_0x7131('0x15')]);}else{logger[_0x7131('0xe')]('MailServerIn,\x20%s,\x20%s',_0x55f1ad,_0x7131('0x10'));_0x5a000d(_0xb52b80[_0x7131('0x16')][_0x7131('0x15')]);}})['catch'](function(_0x5f10ad){logger['error'](_0x7131('0xf'),_0x55f1ad,_0x5f10ad);_0x5eb292(_0x5f10ad);});});}exports[_0x7131('0x17')]=function(_0x209800){var _0x60f266=this;return new Promise(function(_0x9b940d,_0xfbb29a){return db[_0x7131('0x18')][_0x7131('0x19')]({'raw':_0x209800[_0x7131('0x1a')]?_0x209800[_0x7131('0x1a')][_0x7131('0x1b')]===undefined?!![]:![]:!![],'where':_0x209800[_0x7131('0x1a')]?_0x209800[_0x7131('0x1a')]['where']||null:null,'attributes':_0x209800['options']?_0x209800[_0x7131('0x1a')][_0x7131('0x1c')]||null:null,'limit':_0x209800['options']?_0x209800[_0x7131('0x1a')][_0x7131('0x1d')]||null:null,'include':_0x209800[_0x7131('0x1a')]?_0x209800['options'][_0x7131('0x1e')]?_[_0x7131('0x1f')](_0x209800[_0x7131('0x1a')]['include'],function(_0x5a6940){return{'model':db[_0x5a6940[_0x7131('0x20')]],'as':_0x5a6940['as'],'attributes':_0x5a6940[_0x7131('0x1c')],'include':_0x5a6940[_0x7131('0x1e')]?_[_0x7131('0x1f')](_0x5a6940[_0x7131('0x1e')],function(_0x2a39e5){return{'model':db[_0x2a39e5[_0x7131('0x20')]],'as':_0x2a39e5['as'],'attributes':_0x2a39e5[_0x7131('0x1c')],'include':_0x2a39e5['include']?_['map'](_0x2a39e5[_0x7131('0x1e')],function(_0x2d16b9){return{'model':db[_0x2d16b9[_0x7131('0x20')]],'as':_0x2d16b9['as'],'attributes':_0x2d16b9['attributes']};}):[]};}):[]};}):[]:[]})[_0x7131('0xd')](function(_0x5c79e4){logger[_0x7131('0xe')](_0x7131('0x17'),_0x209800);logger[_0x7131('0x21')](_0x7131('0x17'),_0x209800,JSON[_0x7131('0x12')](_0x5c79e4));_0x9b940d(_0x5c79e4);})['catch'](function(_0x15b18a){logger['error'](_0x7131('0x17'),_0x15b18a['message'],_0x209800);_0xfbb29a(_0x60f266[_0x7131('0x14')](0x1f4,_0x15b18a[_0x7131('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 2498b07..ef06900 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 _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(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x7a54,0x106));var _0x47a5=function(_0x22a281,_0x21f9fa){_0x22a281=_0x22a281-0x0;var _0x374286=_0x7a54[_0x22a281];return _0x374286;};'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 +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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x5d3769,_0x11d817){_0x5d3769=_0x5d3769-0x0;var _0x11dcf2=_0x7a54[_0x5d3769];return _0x11dcf2;};'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 802f6ad..bd08963 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 _0xc788=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x204178,_0x5d30a7){var _0x460ba5=function(_0x49e957){while(--_0x49e957){_0x204178['push'](_0x204178['shift']());}};_0x460ba5(++_0x5d30a7);}(_0xc788,0xc4));var _0x8c78=function(_0x19017b,_0x56d52c){_0x19017b=_0x19017b-0x0;var _0x3becdc=_0xc788[_0x19017b];return _0x3becdc;};'use strict';var Sequelize=require(_0x8c78('0x0'));module[_0x8c78('0x1')]={'description':{'type':Sequelize[_0x8c78('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x8c78('0x2')]},'port':{'type':Sequelize[_0x8c78('0x3')]},'secure':{'type':Sequelize[_0x8c78('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x8c78('0x2')]},'authentication':{'type':Sequelize[_0x8c78('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa571=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x316844,_0x3e0c2a){var _0x13d10b=function(_0x5b40c7){while(--_0x5b40c7){_0x316844['push'](_0x316844['shift']());}};_0x13d10b(++_0x3e0c2a);}(_0xa571,0x107));var _0x1a57=function(_0x3a23b4,_0x49d839){_0x3a23b4=_0x3a23b4-0x0;var _0x302bca=_0xa571[_0x3a23b4];return _0x302bca;};'use strict';var Sequelize=require(_0x1a57('0x0'));module[_0x1a57('0x1')]={'description':{'type':Sequelize[_0x1a57('0x2')]},'host':{'type':Sequelize[_0x1a57('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x1a57('0x2')]},'port':{'type':Sequelize[_0x1a57('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x1a57('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 24168d8..ff9321a 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 _0xbe3c=['name','index','MailServerOut','fieldName','type','key','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','destroy','find','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack'];(function(_0x1229fc,_0x32fd1d){var _0x5148b6=function(_0x34e7df){while(--_0x34e7df){_0x1229fc['push'](_0x1229fc['shift']());}};_0x5148b6(++_0x32fd1d);}(_0xbe3c,0xbd));var _0xcbe3=function(_0x464e74,_0x583c17){_0x464e74=_0x464e74-0x0;var _0x439c03=_0xbe3c[_0x464e74];return _0x439c03;};'use strict';var emlformat=require(_0xcbe3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcbe3('0x1'));var jsonpatch=require(_0xcbe3('0x2'));var rp=require(_0xcbe3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcbe3('0x4'));var util=require(_0xcbe3('0x5'));var path=require(_0xcbe3('0x6'));var sox=require(_0xcbe3('0x7'));var csv=require('to-csv');var ejs=require(_0xcbe3('0x8'));var fs=require('fs');var fs_extra=require(_0xcbe3('0x9'));var _=require(_0xcbe3('0xa'));var squel=require('squel');var crypto=require(_0xcbe3('0xb'));var jsforce=require(_0xcbe3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcbe3('0xd'));var querystring=require(_0xcbe3('0xe'));var Papa=require(_0xcbe3('0xf'));var Redis=require(_0xcbe3('0x10'));var authService=require(_0xcbe3('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcbe3('0x12'));var logger=require('../../config/logger')(_0xcbe3('0x13'));var utils=require(_0xcbe3('0x14'));var config=require(_0xcbe3('0x15'));var licenseUtil=require(_0xcbe3('0x16'));var db=require(_0xcbe3('0x17'))['db'];function respondWithStatusCode(_0xb5396c,_0x211f57){_0x211f57=_0x211f57||0xcc;return function(_0x5acb4c){if(_0x5acb4c){return _0xb5396c['sendStatus'](_0x211f57);}return _0xb5396c[_0xcbe3('0x18')](_0x211f57)[_0xcbe3('0x19')]();};}function respondWithResult(_0x4e6ea3,_0x540bb5){_0x540bb5=_0x540bb5||0xc8;return function(_0x4e8dfd){if(_0x4e8dfd){return _0x4e6ea3[_0xcbe3('0x18')](_0x540bb5)[_0xcbe3('0x1a')](_0x4e8dfd);}};}function respondWithFilteredResult(_0x2f4cdc,_0x2bf2e6){return function(_0x5eb9e8){if(_0x5eb9e8){var _0x3b3fad=typeof _0x2bf2e6[_0xcbe3('0x1b')]===_0xcbe3('0x1c')&&typeof _0x2bf2e6[_0xcbe3('0x1d')]===_0xcbe3('0x1c');var _0x573975=_0x5eb9e8['count'];var _0x90bad3=_0x3b3fad?0x0:_0x2bf2e6[_0xcbe3('0x1b')];var _0x24f175=_0x3b3fad?_0x5eb9e8[_0xcbe3('0x1e')]:_0x2bf2e6[_0xcbe3('0x1b')]+_0x2bf2e6[_0xcbe3('0x1d')];var _0x21a0c1;if(_0x24f175>=_0x573975){_0x24f175=_0x573975;_0x21a0c1=0xc8;}else{_0x21a0c1=0xce;}_0x2f4cdc['status'](_0x21a0c1);return _0x2f4cdc['set'](_0xcbe3('0x1f'),_0x90bad3+'-'+_0x24f175+'/'+_0x573975)[_0xcbe3('0x1a')](_0x5eb9e8);}return null;};}function patchUpdates(_0x3262dd){return function(_0x1692e1){try{jsonpatch[_0xcbe3('0x20')](_0x1692e1,_0x3262dd,!![]);}catch(_0x544807){return BPromise[_0xcbe3('0x21')](_0x544807);}return _0x1692e1[_0xcbe3('0x22')]();};}function saveUpdates(_0x179371,_0x237496){return function(_0x55ba5c){if(_0x55ba5c){return _0x55ba5c[_0xcbe3('0x23')](_0x179371)['then'](function(_0x1a8fce){return _0x1a8fce;});}return null;};}function removeEntity(_0x51e865,_0x1d55ef){return function(_0x2ec8ac){if(_0x2ec8ac){return _0x2ec8ac['destroy']()[_0xcbe3('0x24')](function(){_0x51e865[_0xcbe3('0x18')](0xcc)[_0xcbe3('0x19')]();});}};}function handleEntityNotFound(_0x8206ca,_0x2835e6){return function(_0x2be85d){if(!_0x2be85d){_0x8206ca['sendStatus'](0x194);}return _0x2be85d;};}function handleError(_0x56279c,_0x3ac32a){_0x3ac32a=_0x3ac32a||0x1f4;return function(_0x184689){logger[_0xcbe3('0x25')](_0x184689[_0xcbe3('0x26')]);if(_0x184689[_0xcbe3('0x27')]){delete _0x184689[_0xcbe3('0x27')];}_0x56279c[_0xcbe3('0x18')](_0x3ac32a)['send'](_0x184689);};}exports[_0xcbe3('0x28')]=function(_0x3a0221,_0x3a8595){var _0x328d70={},_0x245cdc={},_0x33487a={'count':0x0,'rows':[]};var _0x12217f=_['map'](db[_0xcbe3('0x29')]['rawAttributes'],function(_0x3680b1){return{'name':_0x3680b1[_0xcbe3('0x2a')],'type':_0x3680b1[_0xcbe3('0x2b')][_0xcbe3('0x2c')]};});_0x245cdc[_0xcbe3('0x2d')]=_[_0xcbe3('0x2e')](_0x12217f,_0xcbe3('0x27'));_0x245cdc['query']=_[_0xcbe3('0x2f')](_0x3a0221[_0xcbe3('0x30')]);_0x245cdc['filters']=_['intersection'](_0x245cdc[_0xcbe3('0x2d')],_0x245cdc[_0xcbe3('0x30')]);_0x328d70[_0xcbe3('0x31')]=_[_0xcbe3('0x32')](_0x245cdc[_0xcbe3('0x2d')],qs[_0xcbe3('0x33')](_0x3a0221[_0xcbe3('0x30')][_0xcbe3('0x33')]));_0x328d70[_0xcbe3('0x31')]=_0x328d70[_0xcbe3('0x31')][_0xcbe3('0x34')]?_0x328d70['attributes']:_0x245cdc[_0xcbe3('0x2d')];if(!_0x3a0221[_0xcbe3('0x30')][_0xcbe3('0x35')](_0xcbe3('0x36'))){_0x328d70[_0xcbe3('0x1d')]=qs[_0xcbe3('0x1d')](_0x3a0221[_0xcbe3('0x30')][_0xcbe3('0x1d')]);_0x328d70['offset']=qs[_0xcbe3('0x1b')](_0x3a0221[_0xcbe3('0x30')][_0xcbe3('0x1b')]);}_0x328d70[_0xcbe3('0x37')]=qs[_0xcbe3('0x38')](_0x3a0221['query']['sort']);_0x328d70[_0xcbe3('0x39')]=qs['filters'](_[_0xcbe3('0x3a')](_0x3a0221['query'],_0x245cdc[_0xcbe3('0x3b')]),_0x12217f);if(_0x3a0221[_0xcbe3('0x30')][_0xcbe3('0x3c')]){_0x328d70['where']=_[_0xcbe3('0x3d')](_0x328d70[_0xcbe3('0x39')],{'$or':_[_0xcbe3('0x2e')](_0x12217f,function(_0x5c58b3){if(_0x5c58b3['type']!==_0xcbe3('0x3e')){var _0x56dd94={};_0x56dd94[_0x5c58b3['name']]={'$like':'%'+_0x3a0221[_0xcbe3('0x30')][_0xcbe3('0x3c')]+'%'};return _0x56dd94;}})});}_0x328d70=_[_0xcbe3('0x3d')]({},_0x328d70,_0x3a0221[_0xcbe3('0x3f')]);var _0x19962c={'where':_0x328d70[_0xcbe3('0x39')]};return db[_0xcbe3('0x29')]['count'](_0x19962c)[_0xcbe3('0x24')](function(_0x440702){_0x33487a[_0xcbe3('0x1e')]=_0x440702;if(_0x3a0221['query'][_0xcbe3('0x40')]){_0x328d70['include']=[{'all':!![]}];}return db[_0xcbe3('0x29')][_0xcbe3('0x41')](_0x328d70);})['then'](function(_0xc8e86){_0x33487a[_0xcbe3('0x42')]=_0xc8e86;return _0x33487a;})['then'](respondWithFilteredResult(_0x3a8595,_0x328d70))[_0xcbe3('0x43')](handleError(_0x3a8595,null));};exports[_0xcbe3('0x44')]=function(_0x22c8fa,_0x23bdd0){var _0x37af49={'raw':!![],'where':{'id':_0x22c8fa[_0xcbe3('0x45')]['id']}},_0x3d70f8={};_0x3d70f8[_0xcbe3('0x2d')]=_['keys'](db[_0xcbe3('0x29')][_0xcbe3('0x46')]);_0x3d70f8['query']=_[_0xcbe3('0x2f')](_0x22c8fa[_0xcbe3('0x30')]);_0x3d70f8[_0xcbe3('0x3b')]=_[_0xcbe3('0x32')](_0x3d70f8[_0xcbe3('0x2d')],_0x3d70f8[_0xcbe3('0x30')]);_0x37af49['attributes']=_[_0xcbe3('0x32')](_0x3d70f8[_0xcbe3('0x2d')],qs[_0xcbe3('0x33')](_0x22c8fa[_0xcbe3('0x30')]['fields']));_0x37af49[_0xcbe3('0x31')]=_0x37af49['attributes'][_0xcbe3('0x34')]?_0x37af49[_0xcbe3('0x31')]:_0x3d70f8[_0xcbe3('0x2d')];if(_0x22c8fa[_0xcbe3('0x30')][_0xcbe3('0x40')]){_0x37af49[_0xcbe3('0x47')]=[{'all':!![]}];}_0x37af49=_[_0xcbe3('0x3d')]({},_0x37af49,_0x22c8fa['options']);return db['MailServerOut']['find'](_0x37af49)['then'](handleEntityNotFound(_0x23bdd0,null))[_0xcbe3('0x24')](respondWithResult(_0x23bdd0,null))[_0xcbe3('0x43')](handleError(_0x23bdd0,null));};exports[_0xcbe3('0x48')]=function(_0xe5246,_0x5397ba){return db[_0xcbe3('0x29')][_0xcbe3('0x48')](_0xe5246['body'],{})['then'](respondWithResult(_0x5397ba,0xc9))[_0xcbe3('0x43')](handleError(_0x5397ba,null));};exports['update']=function(_0x475ab1,_0x35433a){if(_0x475ab1[_0xcbe3('0x49')]['id']){delete _0x475ab1[_0xcbe3('0x49')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x475ab1[_0xcbe3('0x45')]['id']}})[_0xcbe3('0x24')](handleEntityNotFound(_0x35433a,null))[_0xcbe3('0x24')](saveUpdates(_0x475ab1[_0xcbe3('0x49')],null))['then'](respondWithResult(_0x35433a,null))[_0xcbe3('0x43')](handleError(_0x35433a,null));};exports[_0xcbe3('0x4a')]=function(_0x2b63c4,_0x2b1dc7){return db[_0xcbe3('0x29')][_0xcbe3('0x4b')]({'where':{'id':_0x2b63c4['params']['id']}})[_0xcbe3('0x24')](handleEntityNotFound(_0x2b1dc7,null))[_0xcbe3('0x24')](removeEntity(_0x2b1dc7,null))['catch'](handleError(_0x2b1dc7,null));}; \ No newline at end of file +var _0xd382=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','destroy','then','end','error','stack','name','send','index','map','MailServerOut','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','update','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x4479f0,_0x3ea727){var _0x51961c=function(_0x516aa4){while(--_0x516aa4){_0x4479f0['push'](_0x4479f0['shift']());}};_0x51961c(++_0x3ea727);}(_0xd382,0xcc));var _0x2d38=function(_0x2cc212,_0x583180){_0x2cc212=_0x2cc212-0x0;var _0xff497a=_0xd382[_0x2cc212];return _0xff497a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2d38('0x0'));var jsonpatch=require(_0x2d38('0x1'));var rp=require(_0x2d38('0x2'));var moment=require('moment');var BPromise=require(_0x2d38('0x3'));var Mustache=require(_0x2d38('0x4'));var util=require(_0x2d38('0x5'));var path=require(_0x2d38('0x6'));var sox=require(_0x2d38('0x7'));var csv=require(_0x2d38('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d38('0x9'));var _=require(_0x2d38('0xa'));var squel=require(_0x2d38('0xb'));var crypto=require(_0x2d38('0xc'));var jsforce=require(_0x2d38('0xd'));var deskjs=require(_0x2d38('0xe'));var toCsv=require(_0x2d38('0x8'));var querystring=require('querystring');var Papa=require(_0x2d38('0xf'));var Redis=require(_0x2d38('0x10'));var authService=require(_0x2d38('0x11'));var qs=require(_0x2d38('0x12'));var as=require(_0x2d38('0x13'));var hardwareService=require(_0x2d38('0x14'));var logger=require(_0x2d38('0x15'))(_0x2d38('0x16'));var utils=require('../../config/utils');var config=require(_0x2d38('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc1f49d,_0x11a3ee){_0x11a3ee=_0x11a3ee||0xcc;return function(_0x46b772){if(_0x46b772){return _0xc1f49d[_0x2d38('0x18')](_0x11a3ee);}return _0xc1f49d[_0x2d38('0x19')](_0x11a3ee)['end']();};}function respondWithResult(_0x52f481,_0x98bd4e){_0x98bd4e=_0x98bd4e||0xc8;return function(_0x325484){if(_0x325484){return _0x52f481[_0x2d38('0x19')](_0x98bd4e)[_0x2d38('0x1a')](_0x325484);}};}function respondWithFilteredResult(_0xfa286,_0x1ed483){return function(_0x6b5f03){if(_0x6b5f03){var _0x684a82=typeof _0x1ed483['offset']===_0x2d38('0x1b')&&typeof _0x1ed483[_0x2d38('0x1c')]===_0x2d38('0x1b');var _0x40cba7=_0x6b5f03['count'];var _0x4b65ff=_0x684a82?0x0:_0x1ed483['offset'];var _0x207b1c=_0x684a82?_0x6b5f03[_0x2d38('0x1d')]:_0x1ed483[_0x2d38('0x1e')]+_0x1ed483[_0x2d38('0x1c')];var _0x3306c4;if(_0x207b1c>=_0x40cba7){_0x207b1c=_0x40cba7;_0x3306c4=0xc8;}else{_0x3306c4=0xce;}_0xfa286[_0x2d38('0x19')](_0x3306c4);return _0xfa286[_0x2d38('0x1f')]('Content-Range',_0x4b65ff+'-'+_0x207b1c+'/'+_0x40cba7)[_0x2d38('0x1a')](_0x6b5f03);}return null;};}function patchUpdates(_0x4d5323){return function(_0x6836c5){try{jsonpatch[_0x2d38('0x20')](_0x6836c5,_0x4d5323,!![]);}catch(_0xab4834){return BPromise[_0x2d38('0x21')](_0xab4834);}return _0x6836c5[_0x2d38('0x22')]();};}function saveUpdates(_0x535810,_0x514913){return function(_0x7c0329){if(_0x7c0329){return _0x7c0329['update'](_0x535810)['then'](function(_0x2f23bb){return _0x2f23bb;});}return null;};}function removeEntity(_0x48ddb,_0x1ede78){return function(_0x2cc3a5){if(_0x2cc3a5){return _0x2cc3a5[_0x2d38('0x23')]()[_0x2d38('0x24')](function(){_0x48ddb['status'](0xcc)[_0x2d38('0x25')]();});}};}function handleEntityNotFound(_0x468b69,_0x5b78d1){return function(_0x4166f7){if(!_0x4166f7){_0x468b69['sendStatus'](0x194);}return _0x4166f7;};}function handleError(_0x5d192c,_0x121be3){_0x121be3=_0x121be3||0x1f4;return function(_0x419312){logger[_0x2d38('0x26')](_0x419312[_0x2d38('0x27')]);if(_0x419312[_0x2d38('0x28')]){delete _0x419312[_0x2d38('0x28')];}_0x5d192c[_0x2d38('0x19')](_0x121be3)[_0x2d38('0x29')](_0x419312);};}exports[_0x2d38('0x2a')]=function(_0x5a2918,_0x22d6b9){var _0x396cad={},_0x5e971={},_0x3b0611={'count':0x0,'rows':[]};var _0xda2f7b=_[_0x2d38('0x2b')](db[_0x2d38('0x2c')][_0x2d38('0x2d')],function(_0x14a828){return{'name':_0x14a828['fieldName'],'type':_0x14a828['type']['key']};});_0x5e971[_0x2d38('0x2e')]=_['map'](_0xda2f7b,_0x2d38('0x28'));_0x5e971[_0x2d38('0x2f')]=_[_0x2d38('0x30')](_0x5a2918[_0x2d38('0x2f')]);_0x5e971[_0x2d38('0x31')]=_[_0x2d38('0x32')](_0x5e971['model'],_0x5e971[_0x2d38('0x2f')]);_0x396cad[_0x2d38('0x33')]=_[_0x2d38('0x32')](_0x5e971[_0x2d38('0x2e')],qs[_0x2d38('0x34')](_0x5a2918[_0x2d38('0x2f')][_0x2d38('0x34')]));_0x396cad[_0x2d38('0x33')]=_0x396cad[_0x2d38('0x33')][_0x2d38('0x35')]?_0x396cad[_0x2d38('0x33')]:_0x5e971[_0x2d38('0x2e')];if(!_0x5a2918[_0x2d38('0x2f')]['hasOwnProperty'](_0x2d38('0x36'))){_0x396cad[_0x2d38('0x1c')]=qs['limit'](_0x5a2918[_0x2d38('0x2f')][_0x2d38('0x1c')]);_0x396cad[_0x2d38('0x1e')]=qs[_0x2d38('0x1e')](_0x5a2918[_0x2d38('0x2f')][_0x2d38('0x1e')]);}_0x396cad[_0x2d38('0x37')]=qs[_0x2d38('0x38')](_0x5a2918['query'][_0x2d38('0x38')]);_0x396cad[_0x2d38('0x39')]=qs['filters'](_[_0x2d38('0x3a')](_0x5a2918[_0x2d38('0x2f')],_0x5e971[_0x2d38('0x31')]),_0xda2f7b);if(_0x5a2918[_0x2d38('0x2f')]['filter']){_0x396cad['where']=_[_0x2d38('0x3b')](_0x396cad[_0x2d38('0x39')],{'$or':_[_0x2d38('0x2b')](_0xda2f7b,function(_0x1fc4e0){if(_0x1fc4e0[_0x2d38('0x3c')]!==_0x2d38('0x3d')){var _0x50ddf7={};_0x50ddf7[_0x1fc4e0[_0x2d38('0x28')]]={'$like':'%'+_0x5a2918['query']['filter']+'%'};return _0x50ddf7;}})});}_0x396cad=_[_0x2d38('0x3b')]({},_0x396cad,_0x5a2918[_0x2d38('0x3e')]);var _0x1865a3={'where':_0x396cad['where']};return db['MailServerOut']['count'](_0x1865a3)[_0x2d38('0x24')](function(_0x11aa03){_0x3b0611[_0x2d38('0x1d')]=_0x11aa03;if(_0x5a2918[_0x2d38('0x2f')][_0x2d38('0x3f')]){_0x396cad[_0x2d38('0x40')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x396cad);})[_0x2d38('0x24')](function(_0x3f0db7){_0x3b0611[_0x2d38('0x41')]=_0x3f0db7;return _0x3b0611;})[_0x2d38('0x24')](respondWithFilteredResult(_0x22d6b9,_0x396cad))[_0x2d38('0x42')](handleError(_0x22d6b9,null));};exports['show']=function(_0x5119ca,_0x12b5db){var _0x3dab27={'raw':!![],'where':{'id':_0x5119ca[_0x2d38('0x43')]['id']}},_0x2f9dac={};_0x2f9dac[_0x2d38('0x2e')]=_[_0x2d38('0x30')](db[_0x2d38('0x2c')]['rawAttributes']);_0x2f9dac[_0x2d38('0x2f')]=_['keys'](_0x5119ca[_0x2d38('0x2f')]);_0x2f9dac[_0x2d38('0x31')]=_[_0x2d38('0x32')](_0x2f9dac[_0x2d38('0x2e')],_0x2f9dac[_0x2d38('0x2f')]);_0x3dab27[_0x2d38('0x33')]=_[_0x2d38('0x32')](_0x2f9dac[_0x2d38('0x2e')],qs[_0x2d38('0x34')](_0x5119ca[_0x2d38('0x2f')]['fields']));_0x3dab27[_0x2d38('0x33')]=_0x3dab27['attributes'][_0x2d38('0x35')]?_0x3dab27['attributes']:_0x2f9dac[_0x2d38('0x2e')];if(_0x5119ca[_0x2d38('0x2f')][_0x2d38('0x3f')]){_0x3dab27[_0x2d38('0x40')]=[{'all':!![]}];}_0x3dab27=_[_0x2d38('0x3b')]({},_0x3dab27,_0x5119ca[_0x2d38('0x3e')]);return db[_0x2d38('0x2c')][_0x2d38('0x44')](_0x3dab27)[_0x2d38('0x24')](handleEntityNotFound(_0x12b5db,null))[_0x2d38('0x24')](respondWithResult(_0x12b5db,null))[_0x2d38('0x42')](handleError(_0x12b5db,null));};exports[_0x2d38('0x45')]=function(_0x4494c7,_0x189519){return db[_0x2d38('0x2c')][_0x2d38('0x45')](_0x4494c7[_0x2d38('0x46')],{})[_0x2d38('0x24')](respondWithResult(_0x189519,0xc9))['catch'](handleError(_0x189519,null));};exports[_0x2d38('0x47')]=function(_0x241a40,_0x5c157c){if(_0x241a40[_0x2d38('0x46')]['id']){delete _0x241a40[_0x2d38('0x46')]['id'];}return db[_0x2d38('0x2c')]['find']({'where':{'id':_0x241a40[_0x2d38('0x43')]['id']}})[_0x2d38('0x24')](handleEntityNotFound(_0x5c157c,null))[_0x2d38('0x24')](saveUpdates(_0x241a40[_0x2d38('0x46')],null))[_0x2d38('0x24')](respondWithResult(_0x5c157c,null))['catch'](handleError(_0x5c157c,null));};exports[_0x2d38('0x23')]=function(_0x597cce,_0x4d9429){return db[_0x2d38('0x2c')]['find']({'where':{'id':_0x597cce[_0x2d38('0x43')]['id']}})[_0x2d38('0x24')](handleEntityNotFound(_0x4d9429,null))[_0x2d38('0x24')](removeEntity(_0x4d9429,null))[_0x2d38('0x42')](handleError(_0x4d9429,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 1574b34..c639964 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 _0x268b=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash'];(function(_0x3746e8,_0xcb6757){var _0x2cbdba=function(_0x39ba21){while(--_0x39ba21){_0x3746e8['push'](_0x3746e8['shift']());}};_0x2cbdba(++_0xcb6757);}(_0x268b,0xe9));var _0xb268=function(_0x53f0db,_0x35c67c){_0x53f0db=_0x53f0db-0x0;var _0xae0a5c=_0x268b[_0x53f0db];return _0xae0a5c;};'use strict';var _=require(_0xb268('0x0'));var util=require(_0xb268('0x1'));var logger=require(_0xb268('0x2'))(_0xb268('0x3'));var moment=require(_0xb268('0x4'));var BPromise=require(_0xb268('0x5'));var rp=require(_0xb268('0x6'));var fs=require('fs');var path=require(_0xb268('0x7'));var rimraf=require('rimraf');var config=require(_0xb268('0x8'));var attributes=require(_0xb268('0x9'));module[_0xb268('0xa')]=function(_0x21e897,_0x22bdda){return _0x21e897['define'](_0xb268('0xb'),attributes,{'tableName':_0xb268('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b38=['request-promise','path','../../config/environment','exports','define','mail_servers_out','lodash','util','api','moment','bluebird'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x9b38,0x7f));var _0x89b3=function(_0x5914a5,_0x1300e3){_0x5914a5=_0x5914a5-0x0;var _0x32922e=_0x9b38[_0x5914a5];return _0x32922e;};'use strict';var _=require(_0x89b3('0x0'));var util=require(_0x89b3('0x1'));var logger=require('../../config/logger')(_0x89b3('0x2'));var moment=require(_0x89b3('0x3'));var BPromise=require(_0x89b3('0x4'));var rp=require(_0x89b3('0x5'));var fs=require('fs');var path=require(_0x89b3('0x6'));var rimraf=require('rimraf');var config=require(_0x89b3('0x7'));var attributes=require('./mailServerOut.attributes');module[_0x89b3('0x8')]=function(_0x447b62,_0x279974){return _0x447b62[_0x89b3('0x9')]('MailServerOut',attributes,{'tableName':_0x89b3('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 248284b..61d556d 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 _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x2ce4fb,_0x10aa86){_0x2ce4fb=_0x2ce4fb-0x0;var _0xe62586=_0x7a54[_0x2ce4fb];return _0xe62586;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +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(_0x4ddef8,_0x3c78fe){var _0x456403=function(_0x439273){while(--_0x439273){_0x4ddef8['push'](_0x4ddef8['shift']());}};_0x456403(++_0x3c78fe);}(_0x2ef3,0xba));var _0x32ef=function(_0x42dcca,_0x1638d5){_0x42dcca=_0x42dcca-0x0;var _0x38e78a=_0x2ef3[_0x42dcca];return _0x38e78a;};'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 d07e5b0..b5c4d1a 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 _0x2341=['post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','index','get','/describe','isAuthenticated','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2341,0x1aa));var _0x1234=function(_0x1b337b,_0x11c511){_0x1b337b=_0x1b337b-0x0;var _0x497ab2=_0x2341[_0x1b337b];return _0x497ab2;};'use strict';var multer=require(_0x1234('0x0'));var util=require(_0x1234('0x1'));var path=require(_0x1234('0x2'));var timeout=require(_0x1234('0x3'));var express=require(_0x1234('0x4'));var router=express[_0x1234('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1234('0x6'));var interaction=require(_0x1234('0x7'));var config=require('../../config/environment');var controller=require(_0x1234('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1234('0x9')]);router[_0x1234('0xa')](_0x1234('0xb'),auth[_0x1234('0xc')](),controller['describe']);router[_0x1234('0xa')]('/:id',auth[_0x1234('0xc')](),controller[_0x1234('0xd')]);router[_0x1234('0xe')]('/',auth[_0x1234('0xc')](),controller[_0x1234('0xf')]);router['put'](_0x1234('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x1234('0x11')](_0x1234('0x10'),auth['isAuthenticated'](),controller[_0x1234('0x12')]);module[_0x1234('0x13')]=router; \ No newline at end of file +var _0xdc4d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout'];(function(_0x360731,_0x58e409){var _0x13d84a=function(_0xaff662){while(--_0xaff662){_0x360731['push'](_0x360731['shift']());}};_0x13d84a(++_0x58e409);}(_0xdc4d,0x172));var _0xddc4=function(_0x1935a3,_0x2a23b4){_0x1935a3=_0x1935a3-0x0;var _0xf8d54c=_0xdc4d[_0x1935a3];return _0xf8d54c;};'use strict';var multer=require(_0xddc4('0x0'));var util=require(_0xddc4('0x1'));var path=require(_0xddc4('0x2'));var timeout=require(_0xddc4('0x3'));var express=require(_0xddc4('0x4'));var router=express[_0xddc4('0x5')]();var fs_extra=require(_0xddc4('0x6'));var auth=require(_0xddc4('0x7'));var interaction=require(_0xddc4('0x8'));var config=require(_0xddc4('0x9'));var controller=require('./mailSubstatus.controller');router[_0xddc4('0xa')]('/',auth['isAuthenticated'](),controller[_0xddc4('0xb')]);router[_0xddc4('0xa')](_0xddc4('0xc'),auth[_0xddc4('0xd')](),controller[_0xddc4('0xe')]);router['get']('/:id',auth[_0xddc4('0xd')](),controller[_0xddc4('0xf')]);router[_0xddc4('0x10')]('/',auth[_0xddc4('0xd')](),controller[_0xddc4('0x11')]);router[_0xddc4('0x12')](_0xddc4('0x13'),auth['isAuthenticated'](),controller[_0xddc4('0x14')]);router['delete'](_0xddc4('0x13'),auth['isAuthenticated'](),controller[_0xddc4('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 471bc7e..3ea5078 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 _0x41fe=['name','sequelize','exports','STRING'];(function(_0x928aa1,_0x16bd67){var _0x37b02b=function(_0x740f9e){while(--_0x740f9e){_0x928aa1['push'](_0x928aa1['shift']());}};_0x37b02b(++_0x16bd67);}(_0x41fe,0xd1));var _0xe41f=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x41fe[_0x34eb31];return _0x254994;};'use strict';var Sequelize=require(_0xe41f('0x0'));module[_0xe41f('0x1')]={'name':{'type':Sequelize[_0xe41f('0x2')],'unique':_0xe41f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe41f('0x2')]}}; \ No newline at end of file +var _0xacf4=['name','STRING'];(function(_0x27031e,_0x1eb8cd){var _0xfd46b3=function(_0x9fdcf8){while(--_0x9fdcf8){_0x27031e['push'](_0x27031e['shift']());}};_0xfd46b3(++_0x1eb8cd);}(_0xacf4,0xe7));var _0x4acf=function(_0x41c358,_0xb928de){_0x41c358=_0x41c358-0x0;var _0x25a609=_0xacf4[_0x41c358];return _0x25a609;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4acf('0x0')],'unique':_0x4acf('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4acf('0x0')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 8b32031..a341cd5 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 _0xe87d=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','catch','rawAttributes','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../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','then','error','stack','name','send','index','map','MailSubstatus'];(function(_0x6484d9,_0x211ccd){var _0xa14b86=function(_0x3ee46b){while(--_0x3ee46b){_0x6484d9['push'](_0x6484d9['shift']());}};_0xa14b86(++_0x211ccd);}(_0xe87d,0x198));var _0xde87=function(_0x1c7359,_0x32c4b8){_0x1c7359=_0x1c7359-0x0;var _0x40c051=_0xe87d[_0x1c7359];return _0x40c051;};'use strict';var emlformat=require(_0xde87('0x0'));var rimraf=require(_0xde87('0x1'));var zipdir=require(_0xde87('0x2'));var jsonpatch=require(_0xde87('0x3'));var rp=require(_0xde87('0x4'));var moment=require(_0xde87('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xde87('0x6'));var util=require(_0xde87('0x7'));var path=require(_0xde87('0x8'));var sox=require(_0xde87('0x9'));var csv=require(_0xde87('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde87('0xb'));var _=require(_0xde87('0xc'));var squel=require(_0xde87('0xd'));var crypto=require(_0xde87('0xe'));var jsforce=require(_0xde87('0xf'));var deskjs=require(_0xde87('0x10'));var toCsv=require(_0xde87('0xa'));var querystring=require(_0xde87('0x11'));var Papa=require(_0xde87('0x12'));var Redis=require(_0xde87('0x13'));var authService=require(_0xde87('0x14'));var qs=require(_0xde87('0x15'));var as=require(_0xde87('0x16'));var hardwareService=require(_0xde87('0x17'));var logger=require('../../config/logger')(_0xde87('0x18'));var utils=require(_0xde87('0x19'));var config=require(_0xde87('0x1a'));var licenseUtil=require(_0xde87('0x1b'));var db=require(_0xde87('0x1c'))['db'];function respondWithStatusCode(_0x354af7,_0x2be4f8){_0x2be4f8=_0x2be4f8||0xcc;return function(_0x126c47){if(_0x126c47){return _0x354af7[_0xde87('0x1d')](_0x2be4f8);}return _0x354af7[_0xde87('0x1e')](_0x2be4f8)['end']();};}function respondWithResult(_0x48922c,_0x2aea76){_0x2aea76=_0x2aea76||0xc8;return function(_0x157243){if(_0x157243){return _0x48922c[_0xde87('0x1e')](_0x2aea76)[_0xde87('0x1f')](_0x157243);}};}function respondWithFilteredResult(_0x541ec5,_0x2f7a4a){return function(_0x56f69b){if(_0x56f69b){var _0x59bde5=typeof _0x2f7a4a[_0xde87('0x20')]===_0xde87('0x21')&&typeof _0x2f7a4a['limit']==='undefined';var _0x1efbea=_0x56f69b[_0xde87('0x22')];var _0x389ff2=_0x59bde5?0x0:_0x2f7a4a[_0xde87('0x20')];var _0x5d44ac=_0x59bde5?_0x56f69b[_0xde87('0x22')]:_0x2f7a4a[_0xde87('0x20')]+_0x2f7a4a[_0xde87('0x23')];var _0x44d8e9;if(_0x5d44ac>=_0x1efbea){_0x5d44ac=_0x1efbea;_0x44d8e9=0xc8;}else{_0x44d8e9=0xce;}_0x541ec5['status'](_0x44d8e9);return _0x541ec5[_0xde87('0x24')](_0xde87('0x25'),_0x389ff2+'-'+_0x5d44ac+'/'+_0x1efbea)[_0xde87('0x1f')](_0x56f69b);}return null;};}function patchUpdates(_0x347d18){return function(_0x1cee2a){try{jsonpatch[_0xde87('0x26')](_0x1cee2a,_0x347d18,!![]);}catch(_0xff120d){return BPromise[_0xde87('0x27')](_0xff120d);}return _0x1cee2a['save']();};}function saveUpdates(_0x62fe2f,_0x4ffb80){return function(_0x4acd3f){if(_0x4acd3f){return _0x4acd3f['update'](_0x62fe2f)[_0xde87('0x28')](function(_0x3c1eef){return _0x3c1eef;});}return null;};}function removeEntity(_0x1eedce,_0x188a90){return function(_0x2d8abf){if(_0x2d8abf){return _0x2d8abf['destroy']()['then'](function(){_0x1eedce['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53daa4,_0x37ccf9){return function(_0x207b3e){if(!_0x207b3e){_0x53daa4[_0xde87('0x1d')](0x194);}return _0x207b3e;};}function handleError(_0x3726ed,_0x346f2e){_0x346f2e=_0x346f2e||0x1f4;return function(_0x585338){logger[_0xde87('0x29')](_0x585338[_0xde87('0x2a')]);if(_0x585338[_0xde87('0x2b')]){delete _0x585338[_0xde87('0x2b')];}_0x3726ed[_0xde87('0x1e')](_0x346f2e)[_0xde87('0x2c')](_0x585338);};}exports[_0xde87('0x2d')]=function(_0x164176,_0x17fffe){var _0x31de09={},_0x4bc297={},_0x5a461a={'count':0x0,'rows':[]};var _0x5c173e=_[_0xde87('0x2e')](db[_0xde87('0x2f')]['rawAttributes'],function(_0xdb113a){return{'name':_0xdb113a['fieldName'],'type':_0xdb113a['type'][_0xde87('0x30')]};});_0x4bc297[_0xde87('0x31')]=_['map'](_0x5c173e,'name');_0x4bc297[_0xde87('0x32')]=_[_0xde87('0x33')](_0x164176[_0xde87('0x32')]);_0x4bc297[_0xde87('0x34')]=_[_0xde87('0x35')](_0x4bc297[_0xde87('0x31')],_0x4bc297['query']);_0x31de09[_0xde87('0x36')]=_['intersection'](_0x4bc297[_0xde87('0x31')],qs[_0xde87('0x37')](_0x164176['query'][_0xde87('0x37')]));_0x31de09['attributes']=_0x31de09[_0xde87('0x36')][_0xde87('0x38')]?_0x31de09[_0xde87('0x36')]:_0x4bc297[_0xde87('0x31')];if(!_0x164176['query'][_0xde87('0x39')](_0xde87('0x3a'))){_0x31de09[_0xde87('0x23')]=qs['limit'](_0x164176[_0xde87('0x32')][_0xde87('0x23')]);_0x31de09['offset']=qs[_0xde87('0x20')](_0x164176[_0xde87('0x32')][_0xde87('0x20')]);}_0x31de09[_0xde87('0x3b')]=qs[_0xde87('0x3c')](_0x164176[_0xde87('0x32')][_0xde87('0x3c')]);_0x31de09[_0xde87('0x3d')]=qs['filters'](_['pick'](_0x164176[_0xde87('0x32')],_0x4bc297[_0xde87('0x34')]),_0x5c173e);if(_0x164176[_0xde87('0x32')][_0xde87('0x3e')]){_0x31de09[_0xde87('0x3d')]=_['merge'](_0x31de09[_0xde87('0x3d')],{'$or':_[_0xde87('0x2e')](_0x5c173e,function(_0x5e9edb){if(_0x5e9edb[_0xde87('0x3f')]!==_0xde87('0x40')){var _0x5a2341={};_0x5a2341[_0x5e9edb[_0xde87('0x2b')]]={'$like':'%'+_0x164176[_0xde87('0x32')][_0xde87('0x3e')]+'%'};return _0x5a2341;}})});}_0x31de09=_[_0xde87('0x41')]({},_0x31de09,_0x164176[_0xde87('0x42')]);var _0x3cca67={'where':_0x31de09[_0xde87('0x3d')]};return db[_0xde87('0x2f')]['count'](_0x3cca67)[_0xde87('0x28')](function(_0x2a59de){_0x5a461a[_0xde87('0x22')]=_0x2a59de;if(_0x164176[_0xde87('0x32')][_0xde87('0x43')]){_0x31de09['include']=[{'all':!![]}];}return db[_0xde87('0x2f')]['findAll'](_0x31de09);})['then'](function(_0x18c3d3){_0x5a461a['rows']=_0x18c3d3;return _0x5a461a;})[_0xde87('0x28')](respondWithFilteredResult(_0x17fffe,_0x31de09))[_0xde87('0x44')](handleError(_0x17fffe,null));};exports['show']=function(_0x3b070b,_0x2da4f4){var _0xbb03e4={'raw':!![],'where':{'id':_0x3b070b['params']['id']}},_0x566eb8={};_0x566eb8[_0xde87('0x31')]=_[_0xde87('0x33')](db[_0xde87('0x2f')][_0xde87('0x45')]);_0x566eb8[_0xde87('0x32')]=_[_0xde87('0x33')](_0x3b070b[_0xde87('0x32')]);_0x566eb8[_0xde87('0x34')]=_[_0xde87('0x35')](_0x566eb8['model'],_0x566eb8[_0xde87('0x32')]);_0xbb03e4[_0xde87('0x36')]=_[_0xde87('0x35')](_0x566eb8[_0xde87('0x31')],qs[_0xde87('0x37')](_0x3b070b[_0xde87('0x32')][_0xde87('0x37')]));_0xbb03e4[_0xde87('0x36')]=_0xbb03e4[_0xde87('0x36')]['length']?_0xbb03e4[_0xde87('0x36')]:_0x566eb8[_0xde87('0x31')];if(_0x3b070b[_0xde87('0x32')][_0xde87('0x43')]){_0xbb03e4['include']=[{'all':!![]}];}_0xbb03e4=_[_0xde87('0x41')]({},_0xbb03e4,_0x3b070b[_0xde87('0x42')]);return db[_0xde87('0x2f')][_0xde87('0x46')](_0xbb03e4)['then'](handleEntityNotFound(_0x2da4f4,null))[_0xde87('0x28')](respondWithResult(_0x2da4f4,null))[_0xde87('0x44')](handleError(_0x2da4f4,null));};exports[_0xde87('0x47')]=function(_0x5a3d0d,_0x19a73b){return db[_0xde87('0x2f')][_0xde87('0x47')](_0x5a3d0d[_0xde87('0x48')],{})[_0xde87('0x28')](respondWithResult(_0x19a73b,0xc9))['catch'](handleError(_0x19a73b,null));};exports['update']=function(_0x4ea4a1,_0x50eaeb){if(_0x4ea4a1['body']['id']){delete _0x4ea4a1['body']['id'];}return db[_0xde87('0x2f')][_0xde87('0x46')]({'where':{'id':_0x4ea4a1[_0xde87('0x49')]['id']}})[_0xde87('0x28')](handleEntityNotFound(_0x50eaeb,null))[_0xde87('0x28')](saveUpdates(_0x4ea4a1['body'],null))['then'](respondWithResult(_0x50eaeb,null))['catch'](handleError(_0x50eaeb,null));};exports[_0xde87('0x4a')]=function(_0xbb7d8d,_0x1b6412){return db[_0xde87('0x2f')]['find']({'where':{'id':_0xbb7d8d[_0xde87('0x49')]['id']}})[_0xde87('0x28')](handleEntityNotFound(_0x1b6412,null))[_0xde87('0x28')](removeEntity(_0x1b6412,null))[_0xde87('0x44')](handleError(_0x1b6412,null));};exports[_0xde87('0x4b')]=function(_0x44a23c,_0x1e31d5){return db[_0xde87('0x2f')][_0xde87('0x4b')]()['then'](respondWithResult(_0x1e31d5,null))['catch'](handleError(_0x1e31d5,null));}; \ No newline at end of file +var _0x6e1e=['reject','save','update','then','destroy','error','stack','name','send','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range'];(function(_0x57fe33,_0x2769c0){var _0x3d2a5b=function(_0x198aa7){while(--_0x198aa7){_0x57fe33['push'](_0x57fe33['shift']());}};_0x3d2a5b(++_0x2769c0);}(_0x6e1e,0x10a));var _0xe6e1=function(_0x263de9,_0x433882){_0x263de9=_0x263de9-0x0;var _0x2707f8=_0x6e1e[_0x263de9];return _0x2707f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe6e1('0x0'));var zipdir=require(_0xe6e1('0x1'));var jsonpatch=require(_0xe6e1('0x2'));var rp=require('request-promise');var moment=require(_0xe6e1('0x3'));var BPromise=require(_0xe6e1('0x4'));var Mustache=require('mustache');var util=require(_0xe6e1('0x5'));var path=require(_0xe6e1('0x6'));var sox=require(_0xe6e1('0x7'));var csv=require(_0xe6e1('0x8'));var ejs=require(_0xe6e1('0x9'));var fs=require('fs');var fs_extra=require(_0xe6e1('0xa'));var _=require(_0xe6e1('0xb'));var squel=require(_0xe6e1('0xc'));var crypto=require('crypto');var jsforce=require(_0xe6e1('0xd'));var deskjs=require(_0xe6e1('0xe'));var toCsv=require(_0xe6e1('0x8'));var querystring=require(_0xe6e1('0xf'));var Papa=require(_0xe6e1('0x10'));var Redis=require(_0xe6e1('0x11'));var authService=require(_0xe6e1('0x12'));var qs=require(_0xe6e1('0x13'));var as=require(_0xe6e1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe6e1('0x15'))(_0xe6e1('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe6e1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ef476,_0x8cccf){_0x8cccf=_0x8cccf||0xcc;return function(_0x78a9bf){if(_0x78a9bf){return _0x4ef476[_0xe6e1('0x18')](_0x8cccf);}return _0x4ef476['status'](_0x8cccf)[_0xe6e1('0x19')]();};}function respondWithResult(_0x32435c,_0x55e90a){_0x55e90a=_0x55e90a||0xc8;return function(_0x103475){if(_0x103475){return _0x32435c['status'](_0x55e90a)[_0xe6e1('0x1a')](_0x103475);}};}function respondWithFilteredResult(_0x420b94,_0x14ecd8){return function(_0x23c4b0){if(_0x23c4b0){var _0x5af81c=typeof _0x14ecd8[_0xe6e1('0x1b')]===_0xe6e1('0x1c')&&typeof _0x14ecd8[_0xe6e1('0x1d')]===_0xe6e1('0x1c');var _0x3a2e9e=_0x23c4b0[_0xe6e1('0x1e')];var _0x4b422d=_0x5af81c?0x0:_0x14ecd8[_0xe6e1('0x1b')];var _0x115322=_0x5af81c?_0x23c4b0['count']:_0x14ecd8[_0xe6e1('0x1b')]+_0x14ecd8['limit'];var _0x89cfcd;if(_0x115322>=_0x3a2e9e){_0x115322=_0x3a2e9e;_0x89cfcd=0xc8;}else{_0x89cfcd=0xce;}_0x420b94[_0xe6e1('0x1f')](_0x89cfcd);return _0x420b94[_0xe6e1('0x20')](_0xe6e1('0x21'),_0x4b422d+'-'+_0x115322+'/'+_0x3a2e9e)[_0xe6e1('0x1a')](_0x23c4b0);}return null;};}function patchUpdates(_0x37d454){return function(_0x1793ef){try{jsonpatch['apply'](_0x1793ef,_0x37d454,!![]);}catch(_0x88d38){return BPromise[_0xe6e1('0x22')](_0x88d38);}return _0x1793ef[_0xe6e1('0x23')]();};}function saveUpdates(_0x2bede9,_0x2ebf5a){return function(_0x50cc78){if(_0x50cc78){return _0x50cc78[_0xe6e1('0x24')](_0x2bede9)[_0xe6e1('0x25')](function(_0x346b1d){return _0x346b1d;});}return null;};}function removeEntity(_0x551cc5,_0x152fa7){return function(_0x13bd04){if(_0x13bd04){return _0x13bd04[_0xe6e1('0x26')]()[_0xe6e1('0x25')](function(){_0x551cc5[_0xe6e1('0x1f')](0xcc)[_0xe6e1('0x19')]();});}};}function handleEntityNotFound(_0x469949,_0x4fa47e){return function(_0x32fd7d){if(!_0x32fd7d){_0x469949['sendStatus'](0x194);}return _0x32fd7d;};}function handleError(_0x28da84,_0x33302a){_0x33302a=_0x33302a||0x1f4;return function(_0xfe0007){logger[_0xe6e1('0x27')](_0xfe0007[_0xe6e1('0x28')]);if(_0xfe0007[_0xe6e1('0x29')]){delete _0xfe0007[_0xe6e1('0x29')];}_0x28da84[_0xe6e1('0x1f')](_0x33302a)[_0xe6e1('0x2a')](_0xfe0007);};}exports['index']=function(_0x346f63,_0x954baf){var _0x5bff19={},_0x21f596={},_0x34bace={'count':0x0,'rows':[]};var _0x24a508=_['map'](db[_0xe6e1('0x2b')][_0xe6e1('0x2c')],function(_0x2cb50f){return{'name':_0x2cb50f[_0xe6e1('0x2d')],'type':_0x2cb50f[_0xe6e1('0x2e')][_0xe6e1('0x2f')]};});_0x21f596[_0xe6e1('0x30')]=_['map'](_0x24a508,_0xe6e1('0x29'));_0x21f596[_0xe6e1('0x31')]=_[_0xe6e1('0x32')](_0x346f63[_0xe6e1('0x31')]);_0x21f596[_0xe6e1('0x33')]=_['intersection'](_0x21f596[_0xe6e1('0x30')],_0x21f596['query']);_0x5bff19['attributes']=_[_0xe6e1('0x34')](_0x21f596[_0xe6e1('0x30')],qs[_0xe6e1('0x35')](_0x346f63[_0xe6e1('0x31')][_0xe6e1('0x35')]));_0x5bff19[_0xe6e1('0x36')]=_0x5bff19[_0xe6e1('0x36')][_0xe6e1('0x37')]?_0x5bff19['attributes']:_0x21f596[_0xe6e1('0x30')];if(!_0x346f63[_0xe6e1('0x31')]['hasOwnProperty']('nolimit')){_0x5bff19['limit']=qs[_0xe6e1('0x1d')](_0x346f63[_0xe6e1('0x31')][_0xe6e1('0x1d')]);_0x5bff19[_0xe6e1('0x1b')]=qs[_0xe6e1('0x1b')](_0x346f63[_0xe6e1('0x31')][_0xe6e1('0x1b')]);}_0x5bff19[_0xe6e1('0x38')]=qs[_0xe6e1('0x39')](_0x346f63[_0xe6e1('0x31')][_0xe6e1('0x39')]);_0x5bff19['where']=qs[_0xe6e1('0x33')](_[_0xe6e1('0x3a')](_0x346f63['query'],_0x21f596['filters']),_0x24a508);if(_0x346f63[_0xe6e1('0x31')][_0xe6e1('0x3b')]){_0x5bff19[_0xe6e1('0x3c')]=_['merge'](_0x5bff19['where'],{'$or':_[_0xe6e1('0x3d')](_0x24a508,function(_0x30ee93){if(_0x30ee93[_0xe6e1('0x2e')]!==_0xe6e1('0x3e')){var _0x1ccd3b={};_0x1ccd3b[_0x30ee93['name']]={'$like':'%'+_0x346f63['query'][_0xe6e1('0x3b')]+'%'};return _0x1ccd3b;}})});}_0x5bff19=_['merge']({},_0x5bff19,_0x346f63[_0xe6e1('0x3f')]);var _0x1f12ed={'where':_0x5bff19[_0xe6e1('0x3c')]};return db[_0xe6e1('0x2b')][_0xe6e1('0x1e')](_0x1f12ed)[_0xe6e1('0x25')](function(_0x5656fa){_0x34bace[_0xe6e1('0x1e')]=_0x5656fa;if(_0x346f63[_0xe6e1('0x31')][_0xe6e1('0x40')]){_0x5bff19[_0xe6e1('0x41')]=[{'all':!![]}];}return db[_0xe6e1('0x2b')][_0xe6e1('0x42')](_0x5bff19);})[_0xe6e1('0x25')](function(_0x2b95c0){_0x34bace[_0xe6e1('0x43')]=_0x2b95c0;return _0x34bace;})['then'](respondWithFilteredResult(_0x954baf,_0x5bff19))['catch'](handleError(_0x954baf,null));};exports[_0xe6e1('0x44')]=function(_0x32f2f1,_0x1e269a){var _0x3d8c16={'raw':!![],'where':{'id':_0x32f2f1[_0xe6e1('0x45')]['id']}},_0x24d744={};_0x24d744['model']=_[_0xe6e1('0x32')](db[_0xe6e1('0x2b')][_0xe6e1('0x2c')]);_0x24d744[_0xe6e1('0x31')]=_[_0xe6e1('0x32')](_0x32f2f1[_0xe6e1('0x31')]);_0x24d744[_0xe6e1('0x33')]=_['intersection'](_0x24d744[_0xe6e1('0x30')],_0x24d744['query']);_0x3d8c16[_0xe6e1('0x36')]=_[_0xe6e1('0x34')](_0x24d744[_0xe6e1('0x30')],qs[_0xe6e1('0x35')](_0x32f2f1[_0xe6e1('0x31')]['fields']));_0x3d8c16['attributes']=_0x3d8c16[_0xe6e1('0x36')]['length']?_0x3d8c16[_0xe6e1('0x36')]:_0x24d744[_0xe6e1('0x30')];if(_0x32f2f1[_0xe6e1('0x31')][_0xe6e1('0x40')]){_0x3d8c16['include']=[{'all':!![]}];}_0x3d8c16=_[_0xe6e1('0x46')]({},_0x3d8c16,_0x32f2f1[_0xe6e1('0x3f')]);return db[_0xe6e1('0x2b')]['find'](_0x3d8c16)[_0xe6e1('0x25')](handleEntityNotFound(_0x1e269a,null))[_0xe6e1('0x25')](respondWithResult(_0x1e269a,null))['catch'](handleError(_0x1e269a,null));};exports[_0xe6e1('0x47')]=function(_0x5290e0,_0x2513df){return db[_0xe6e1('0x2b')][_0xe6e1('0x47')](_0x5290e0['body'],{})['then'](respondWithResult(_0x2513df,0xc9))['catch'](handleError(_0x2513df,null));};exports['update']=function(_0x3e4ba6,_0xf3193c){if(_0x3e4ba6[_0xe6e1('0x48')]['id']){delete _0x3e4ba6['body']['id'];}return db[_0xe6e1('0x2b')]['find']({'where':{'id':_0x3e4ba6[_0xe6e1('0x45')]['id']}})['then'](handleEntityNotFound(_0xf3193c,null))[_0xe6e1('0x25')](saveUpdates(_0x3e4ba6[_0xe6e1('0x48')],null))[_0xe6e1('0x25')](respondWithResult(_0xf3193c,null))['catch'](handleError(_0xf3193c,null));};exports[_0xe6e1('0x26')]=function(_0x35758b,_0x57c1ea){return db[_0xe6e1('0x2b')]['find']({'where':{'id':_0x35758b[_0xe6e1('0x45')]['id']}})['then'](handleEntityNotFound(_0x57c1ea,null))[_0xe6e1('0x25')](removeEntity(_0x57c1ea,null))[_0xe6e1('0x49')](handleError(_0x57c1ea,null));};exports[_0xe6e1('0x4a')]=function(_0x196c0d,_0x1bafaf){return db[_0xe6e1('0x2b')][_0xe6e1('0x4a')]()[_0xe6e1('0x25')](respondWithResult(_0x1bafaf,null))[_0xe6e1('0x49')](handleError(_0x1bafaf,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 68be0da..f24369e 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 _0x6440=['emit','exports','../../mysqldb','MailSubstatus','setMaxListeners','update'];(function(_0x333e43,_0x6db023){var _0x5569e4=function(_0xfbfd32){while(--_0xfbfd32){_0x333e43['push'](_0x333e43['shift']());}};_0x5569e4(++_0x6db023);}(_0x6440,0x9e));var _0x0644=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6440[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x0644('0x0'))['db'][_0x0644('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x0644('0x2')](0x0);var events={'afterUpdate':_0x0644('0x3')};function emitEvent(_0x5685f3){return function(_0x301810,_0x2d10a1,_0x1b3a38){MailSubstatusEvents['emit'](_0x5685f3+':'+_0x301810['id'],_0x301810);MailSubstatusEvents[_0x0644('0x4')](_0x5685f3,_0x301810);_0x1b3a38(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x0644('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0x4bf6=['hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit'];(function(_0x3a239d,_0x1413d9){var _0x1825cd=function(_0x3024d2){while(--_0x3024d2){_0x3a239d['push'](_0x3a239d['shift']());}};_0x1825cd(++_0x1413d9);}(_0x4bf6,0x17d));var _0x64bf=function(_0x56f571,_0x4ebb61){_0x56f571=_0x56f571-0x0;var _0x591cc0=_0x4bf6[_0x56f571];return _0x591cc0;};'use strict';var EventEmitter=require(_0x64bf('0x0'));var MailSubstatus=require(_0x64bf('0x1'))['db'][_0x64bf('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x64bf('0x3')](0x0);var events={'afterUpdate':_0x64bf('0x4')};function emitEvent(_0x41be04){return function(_0x2dea11,_0x2bb298,_0x4a1ed3){MailSubstatusEvents[_0x64bf('0x5')](_0x41be04+':'+_0x2dea11['id'],_0x2dea11);MailSubstatusEvents[_0x64bf('0x5')](_0x41be04,_0x2dea11);_0x4a1ed3(null);};}for(var e in events){if(events[_0x64bf('0x6')](e)){var event=events[e];MailSubstatus[_0x64bf('0x7')](e,emitEvent(event));}}module[_0x64bf('0x8')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 66828ba..05eaaec 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 _0x20d4=['./mailSubstatus.attributes','exports','models','define','MailSubstatus','update','name','mailSubstatus','_previousDataValues','catch'];(function(_0x474872,_0x227eab){var _0x3f47f5=function(_0x320938){while(--_0x320938){_0x474872['push'](_0x474872['shift']());}};_0x3f47f5(++_0x227eab);}(_0x20d4,0xdc));var _0x420d=function(_0xb82a3a,_0x55a2cc){_0xb82a3a=_0xb82a3a-0x0;var _0xa71dbc=_0x20d4[_0xb82a3a];return _0xa71dbc;};'use strict';var attributes=require(_0x420d('0x0'));module[_0x420d('0x1')]=function(_0x103e31){var _0x1c29e4=_0x103e31[_0x420d('0x2')];return _0x103e31[_0x420d('0x3')](_0x420d('0x4'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x19f7d4,_0x130cfd,_0x48b149){return _0x1c29e4['Condition'][_0x420d('0x5')]({'value':_0x19f7d4[_0x420d('0x6')]},{'where':{'field':_0x420d('0x7'),'value':_0x19f7d4[_0x420d('0x8')][_0x420d('0x6')]}})['then'](function(){_0x48b149();})[_0x420d('0x9')](function(_0x1526d4){_0x48b149(_0x1526d4);});}}});}; \ No newline at end of file +var _0xfee2=['define','name','mailSubstatus','_previousDataValues','then','catch'];(function(_0xe1441d,_0x36fb8e){var _0x2ef242=function(_0x52bf2d){while(--_0x52bf2d){_0xe1441d['push'](_0xe1441d['shift']());}};_0x2ef242(++_0x36fb8e);}(_0xfee2,0x1ec));var _0x2fee=function(_0x238d10,_0x18534e){_0x238d10=_0x238d10-0x0;var _0x4d5b76=_0xfee2[_0x238d10];return _0x4d5b76;};'use strict';var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0xafdaf6){var _0xdc4ed2=_0xafdaf6['models'];return _0xafdaf6[_0x2fee('0x0')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x53932a,_0x2323da,_0x4964c1){return _0xdc4ed2['Condition']['update']({'value':_0x53932a[_0x2fee('0x1')]},{'where':{'field':_0x2fee('0x2'),'value':_0x53932a[_0x2fee('0x3')]['name']}})[_0x2fee('0x4')](function(){_0x4964c1();})[_0x2fee('0x5')](function(_0x122758){_0x4964c1(_0x122758);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index abff4ec..53ec843 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 _0x4062=['message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3e01c8,_0x30ec78){var _0x2a6804=function(_0x499374){while(--_0x499374){_0x3e01c8['push'](_0x3e01c8['shift']());}};_0x2a6804(++_0x30ec78);}(_0x4062,0x1b6));var _0x2406=function(_0x2389ac,_0x4844e7){_0x2389ac=_0x2389ac-0x0;var _0x2d0ed8=_0x4062[_0x2389ac];return _0x2d0ed8;};'use strict';var _=require(_0x2406('0x0'));var util=require(_0x2406('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2406('0x2'));var fs=require('fs');var Redis=require(_0x2406('0x3'));var db=require(_0x2406('0x4'))['db'];var utils=require(_0x2406('0x5'));var logger=require(_0x2406('0x6'))(_0x2406('0x7'));var config=require(_0x2406('0x8'));var jayson=require(_0x2406('0x9'));var client=jayson['client'][_0x2406('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34b0e7,_0x3901d0,_0xf9b297){return new BPromise(function(_0x435538,_0x1436f4){return client['request'](_0x34b0e7,_0xf9b297)[_0x2406('0xb')](function(_0x896dc9){logger['info'](_0x2406('0xc'),_0x3901d0,_0x2406('0xd'));logger[_0x2406('0xe')](_0x2406('0xf'),_0x3901d0,_0x2406('0xd'),JSON['stringify'](_0x896dc9));if(_0x896dc9[_0x2406('0x10')]){if(_0x896dc9[_0x2406('0x10')][_0x2406('0x11')]===0x1f4){logger[_0x2406('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x3901d0,_0x896dc9['error'][_0x2406('0x12')]);return _0x1436f4(_0x896dc9[_0x2406('0x10')][_0x2406('0x12')]);}logger['error'](_0x2406('0xc'),_0x3901d0,_0x896dc9[_0x2406('0x10')]['message']);return _0x435538(_0x896dc9[_0x2406('0x10')]['message']);}else{logger['info'](_0x2406('0xc'),_0x3901d0,_0x2406('0xd'));_0x435538(_0x896dc9['result'][_0x2406('0x12')]);}})['catch'](function(_0x4a9fc8){logger[_0x2406('0x10')](_0x2406('0xc'),_0x3901d0,_0x4a9fc8);_0x1436f4(_0x4a9fc8);});});} \ No newline at end of file +var _0xab29=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x47669f,_0x494537){var _0x165ec9=function(_0x182d44){while(--_0x182d44){_0x47669f['push'](_0x47669f['shift']());}};_0x165ec9(++_0x494537);}(_0xab29,0x145));var _0x9ab2=function(_0xadfffd,_0x401102){_0xadfffd=_0xadfffd-0x0;var _0x3597e8=_0xab29[_0xadfffd];return _0x3597e8;};'use strict';var _=require(_0x9ab2('0x0'));var util=require(_0x9ab2('0x1'));var moment=require(_0x9ab2('0x2'));var BPromise=require(_0x9ab2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ab2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ab2('0x5'));var logger=require(_0x9ab2('0x6'))(_0x9ab2('0x7'));var config=require(_0x9ab2('0x8'));var jayson=require(_0x9ab2('0x9'));var client=jayson['client'][_0x9ab2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3739c8,_0x42d544,_0x3c73e5){return new BPromise(function(_0x3a3553,_0x564109){return client[_0x9ab2('0xb')](_0x3739c8,_0x3c73e5)[_0x9ab2('0xc')](function(_0x398547){logger[_0x9ab2('0xd')](_0x9ab2('0xe'),_0x42d544,_0x9ab2('0xf'));logger[_0x9ab2('0x10')](_0x9ab2('0x11'),_0x42d544,_0x9ab2('0xf'),JSON['stringify'](_0x398547));if(_0x398547[_0x9ab2('0x12')]){if(_0x398547[_0x9ab2('0x12')]['code']===0x1f4){logger['error'](_0x9ab2('0xe'),_0x42d544,_0x398547[_0x9ab2('0x12')][_0x9ab2('0x13')]);return _0x564109(_0x398547['error'][_0x9ab2('0x13')]);}logger[_0x9ab2('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x42d544,_0x398547[_0x9ab2('0x12')][_0x9ab2('0x13')]);return _0x3a3553(_0x398547[_0x9ab2('0x12')][_0x9ab2('0x13')]);}else{logger[_0x9ab2('0xd')](_0x9ab2('0xe'),_0x42d544,_0x9ab2('0xf'));_0x3a3553(_0x398547[_0x9ab2('0x14')]['message']);}})[_0x9ab2('0x15')](function(_0x273e07){logger[_0x9ab2('0x12')](_0x9ab2('0xe'),_0x42d544,_0x273e07);_0x564109(_0x273e07);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 0964fbf..18ff454 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 _0x0a3f=['describe','/:id','show','post','create','update','delete','destroy','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe'];(function(_0xdc81d7,_0x5b9182){var _0x41ddc6=function(_0x56b0e3){while(--_0x56b0e3){_0xdc81d7['push'](_0xdc81d7['shift']());}};_0x41ddc6(++_0x5b9182);}(_0x0a3f,0x1e3));var _0xf0a3=function(_0x22fdea,_0x1aee37){_0x22fdea=_0x22fdea-0x0;var _0x56803d=_0x0a3f[_0x22fdea];return _0x56803d;};'use strict';var multer=require(_0xf0a3('0x0'));var util=require(_0xf0a3('0x1'));var path=require(_0xf0a3('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0a3('0x3'));var router=express['Router']();var fs_extra=require(_0xf0a3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf0a3('0x5'));var config=require(_0xf0a3('0x6'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0xf0a3('0x7')](),controller[_0xf0a3('0x8')]);router[_0xf0a3('0x9')](_0xf0a3('0xa'),auth[_0xf0a3('0x7')](),controller[_0xf0a3('0xb')]);router[_0xf0a3('0x9')](_0xf0a3('0xc'),auth[_0xf0a3('0x7')](),controller[_0xf0a3('0xd')]);router[_0xf0a3('0xe')]('/',auth[_0xf0a3('0x7')](),controller[_0xf0a3('0xf')]);router['put'](_0xf0a3('0xc'),auth[_0xf0a3('0x7')](),controller[_0xf0a3('0x10')]);router[_0xf0a3('0x11')]('/:id',auth[_0xf0a3('0x7')](),controller[_0xf0a3('0x12')]);module['exports']=router; \ No newline at end of file +var _0x11f0=['connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','exports','multer','util','path'];(function(_0x5ec841,_0x313346){var _0x2b18d9=function(_0x193c85){while(--_0x193c85){_0x5ec841['push'](_0x5ec841['shift']());}};_0x2b18d9(++_0x313346);}(_0x11f0,0x165));var _0x011f=function(_0x59841f,_0x44be67){_0x59841f=_0x59841f-0x0;var _0x5933b0=_0x11f0[_0x59841f];return _0x5933b0;};'use strict';var multer=require(_0x011f('0x0'));var util=require(_0x011f('0x1'));var path=require(_0x011f('0x2'));var timeout=require(_0x011f('0x3'));var express=require(_0x011f('0x4'));var router=express[_0x011f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x011f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0x011f('0x7')]('/',auth[_0x011f('0x8')](),controller[_0x011f('0x9')]);router['get'](_0x011f('0xa'),auth['isAuthenticated'](),controller[_0x011f('0xb')]);router[_0x011f('0x7')]('/:id',auth[_0x011f('0x8')](),controller[_0x011f('0xc')]);router[_0x011f('0xd')]('/',auth['isAuthenticated'](),controller[_0x011f('0xe')]);router[_0x011f('0xf')]('/:id',auth[_0x011f('0x8')](),controller[_0x011f('0x10')]);router[_0x011f('0x11')](_0x011f('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x011f('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 763656c..79771b7 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x26239f,_0x16743f){var _0x429132=function(_0x177c58){while(--_0x177c58){_0x26239f['push'](_0x26239f['shift']());}};_0x429132(++_0x16743f);}(_0x70e0,0x17b));var _0x070e=function(_0xe753e7,_0x42bb6c){_0xe753e7=_0xe753e7-0x0;var _0x3f99e6=_0x70e0[_0xe753e7];return _0x3f99e6;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x3e41df,_0x529094){var _0x38d62c=function(_0x25f232){while(--_0x25f232){_0x3e41df['push'](_0x3e41df['shift']());}};_0x38d62c(++_0x529094);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x495e9f,_0x1b1d80){_0x495e9f=_0x495e9f-0x0;var _0xb249d2=_0xcb91[_0x495e9f];return _0xb249d2;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 09a0a78..7a8f90e 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 _0x3f5c=['stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','type','merge','options','MailTransferReport','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end'];(function(_0x57cc22,_0x2d351f){var _0x6f7bdc=function(_0x4935b5){while(--_0x4935b5){_0x57cc22['push'](_0x57cc22['shift']());}};_0x6f7bdc(++_0x2d351f);}(_0x3f5c,0xba));var _0xc3f5=function(_0x1fe052,_0xa2ee39){_0x1fe052=_0x1fe052-0x0;var _0xbf1886=_0x3f5c[_0x1fe052];return _0xbf1886;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3f5('0x0'));var jsonpatch=require(_0xc3f5('0x1'));var rp=require(_0xc3f5('0x2'));var moment=require(_0xc3f5('0x3'));var BPromise=require(_0xc3f5('0x4'));var Mustache=require(_0xc3f5('0x5'));var util=require(_0xc3f5('0x6'));var path=require(_0xc3f5('0x7'));var sox=require(_0xc3f5('0x8'));var csv=require(_0xc3f5('0x9'));var ejs=require(_0xc3f5('0xa'));var fs=require('fs');var fs_extra=require(_0xc3f5('0xb'));var _=require(_0xc3f5('0xc'));var squel=require(_0xc3f5('0xd'));var crypto=require(_0xc3f5('0xe'));var jsforce=require(_0xc3f5('0xf'));var deskjs=require(_0xc3f5('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc3f5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f5('0x12'));var logger=require('../../config/logger')(_0xc3f5('0x13'));var utils=require(_0xc3f5('0x14'));var config=require(_0xc3f5('0x15'));var licenseUtil=require(_0xc3f5('0x16'));var db=require(_0xc3f5('0x17'))['db'];function respondWithStatusCode(_0xadc372,_0xe3cf23){_0xe3cf23=_0xe3cf23||0xcc;return function(_0xfbd401){if(_0xfbd401){return _0xadc372[_0xc3f5('0x18')](_0xe3cf23);}return _0xadc372[_0xc3f5('0x19')](_0xe3cf23)['end']();};}function respondWithResult(_0x3b9bc1,_0x9ffdde){_0x9ffdde=_0x9ffdde||0xc8;return function(_0x176d77){if(_0x176d77){return _0x3b9bc1[_0xc3f5('0x19')](_0x9ffdde)[_0xc3f5('0x1a')](_0x176d77);}};}function respondWithFilteredResult(_0x39621c,_0x228ea6){return function(_0x28b6f4){if(_0x28b6f4){var _0x1da511=typeof _0x228ea6[_0xc3f5('0x1b')]===_0xc3f5('0x1c')&&typeof _0x228ea6[_0xc3f5('0x1d')]==='undefined';var _0x56c99f=_0x28b6f4[_0xc3f5('0x1e')];var _0x156da0=_0x1da511?0x0:_0x228ea6[_0xc3f5('0x1b')];var _0x2dbab4=_0x1da511?_0x28b6f4['count']:_0x228ea6[_0xc3f5('0x1b')]+_0x228ea6[_0xc3f5('0x1d')];var _0x31a929;if(_0x2dbab4>=_0x56c99f){_0x2dbab4=_0x56c99f;_0x31a929=0xc8;}else{_0x31a929=0xce;}_0x39621c[_0xc3f5('0x19')](_0x31a929);return _0x39621c[_0xc3f5('0x1f')]('Content-Range',_0x156da0+'-'+_0x2dbab4+'/'+_0x56c99f)[_0xc3f5('0x1a')](_0x28b6f4);}return null;};}function patchUpdates(_0x183b4f){return function(_0x645d77){try{jsonpatch[_0xc3f5('0x20')](_0x645d77,_0x183b4f,!![]);}catch(_0x930d34){return BPromise[_0xc3f5('0x21')](_0x930d34);}return _0x645d77[_0xc3f5('0x22')]();};}function saveUpdates(_0x370b52,_0x101330){return function(_0x321c08){if(_0x321c08){return _0x321c08[_0xc3f5('0x23')](_0x370b52)['then'](function(_0x3f316a){return _0x3f316a;});}return null;};}function removeEntity(_0x200d66,_0xbf32d7){return function(_0x4a8288){if(_0x4a8288){return _0x4a8288[_0xc3f5('0x24')]()[_0xc3f5('0x25')](function(){_0x200d66[_0xc3f5('0x19')](0xcc)[_0xc3f5('0x26')]();});}};}function handleEntityNotFound(_0x484af9,_0x24c361){return function(_0x534285){if(!_0x534285){_0x484af9['sendStatus'](0x194);}return _0x534285;};}function handleError(_0x123b95,_0x1fc40e){_0x1fc40e=_0x1fc40e||0x1f4;return function(_0xf21d3b){logger['error'](_0xf21d3b[_0xc3f5('0x27')]);if(_0xf21d3b[_0xc3f5('0x28')]){delete _0xf21d3b[_0xc3f5('0x28')];}_0x123b95[_0xc3f5('0x19')](_0x1fc40e)[_0xc3f5('0x29')](_0xf21d3b);};}exports[_0xc3f5('0x2a')]=function(_0x48af19,_0xaae9d2){var _0x258a56={},_0x3a0190={},_0xfa733a={'count':0x0,'rows':[]};var _0x1b29b2=_[_0xc3f5('0x2b')](db['MailTransferReport'][_0xc3f5('0x2c')],function(_0x12a1b8){return{'name':_0x12a1b8[_0xc3f5('0x2d')],'type':_0x12a1b8['type'][_0xc3f5('0x2e')]};});_0x3a0190['model']=_[_0xc3f5('0x2b')](_0x1b29b2,_0xc3f5('0x28'));_0x3a0190[_0xc3f5('0x2f')]=_['keys'](_0x48af19[_0xc3f5('0x2f')]);_0x3a0190[_0xc3f5('0x30')]=_[_0xc3f5('0x31')](_0x3a0190[_0xc3f5('0x32')],_0x3a0190[_0xc3f5('0x2f')]);_0x258a56[_0xc3f5('0x33')]=_[_0xc3f5('0x31')](_0x3a0190['model'],qs[_0xc3f5('0x34')](_0x48af19[_0xc3f5('0x2f')][_0xc3f5('0x34')]));_0x258a56[_0xc3f5('0x33')]=_0x258a56[_0xc3f5('0x33')][_0xc3f5('0x35')]?_0x258a56[_0xc3f5('0x33')]:_0x3a0190[_0xc3f5('0x32')];if(!_0x48af19['query']['hasOwnProperty'](_0xc3f5('0x36'))){_0x258a56[_0xc3f5('0x1d')]=qs[_0xc3f5('0x1d')](_0x48af19['query'][_0xc3f5('0x1d')]);_0x258a56[_0xc3f5('0x1b')]=qs[_0xc3f5('0x1b')](_0x48af19['query'][_0xc3f5('0x1b')]);}_0x258a56[_0xc3f5('0x37')]=qs['sort'](_0x48af19[_0xc3f5('0x2f')][_0xc3f5('0x38')]);_0x258a56[_0xc3f5('0x39')]=qs[_0xc3f5('0x30')](_['pick'](_0x48af19['query'],_0x3a0190[_0xc3f5('0x30')]),_0x1b29b2);if(_0x48af19[_0xc3f5('0x2f')][_0xc3f5('0x3a')]){_0x258a56['where']=_['merge'](_0x258a56['where'],{'$or':_['map'](_0x1b29b2,function(_0x1aff9a){if(_0x1aff9a[_0xc3f5('0x3b')]!=='VIRTUAL'){var _0x30ba99={};_0x30ba99[_0x1aff9a['name']]={'$like':'%'+_0x48af19['query']['filter']+'%'};return _0x30ba99;}})});}_0x258a56=_[_0xc3f5('0x3c')]({},_0x258a56,_0x48af19[_0xc3f5('0x3d')]);var _0x417c84={'where':_0x258a56[_0xc3f5('0x39')]};return db[_0xc3f5('0x3e')][_0xc3f5('0x1e')](_0x417c84)[_0xc3f5('0x25')](function(_0x5a6722){_0xfa733a[_0xc3f5('0x1e')]=_0x5a6722;if(_0x48af19['query']['includeAll']){_0x258a56['include']=[{'all':!![]}];}return db[_0xc3f5('0x3e')][_0xc3f5('0x3f')](_0x258a56);})[_0xc3f5('0x25')](function(_0x1fe450){_0xfa733a[_0xc3f5('0x40')]=_0x1fe450;return _0xfa733a;})['then'](respondWithFilteredResult(_0xaae9d2,_0x258a56))[_0xc3f5('0x41')](handleError(_0xaae9d2,null));};exports[_0xc3f5('0x42')]=function(_0x30fc3d,_0x5d08fa){var _0x495bc7={'raw':!![],'where':{'id':_0x30fc3d[_0xc3f5('0x43')]['id']}},_0x10c8b4={};_0x10c8b4[_0xc3f5('0x32')]=_[_0xc3f5('0x44')](db['MailTransferReport'][_0xc3f5('0x2c')]);_0x10c8b4['query']=_['keys'](_0x30fc3d[_0xc3f5('0x2f')]);_0x10c8b4[_0xc3f5('0x30')]=_['intersection'](_0x10c8b4[_0xc3f5('0x32')],_0x10c8b4['query']);_0x495bc7[_0xc3f5('0x33')]=_[_0xc3f5('0x31')](_0x10c8b4['model'],qs['fields'](_0x30fc3d['query'][_0xc3f5('0x34')]));_0x495bc7[_0xc3f5('0x33')]=_0x495bc7[_0xc3f5('0x33')][_0xc3f5('0x35')]?_0x495bc7['attributes']:_0x10c8b4[_0xc3f5('0x32')];if(_0x30fc3d[_0xc3f5('0x2f')][_0xc3f5('0x45')]){_0x495bc7[_0xc3f5('0x46')]=[{'all':!![]}];}_0x495bc7=_['merge']({},_0x495bc7,_0x30fc3d[_0xc3f5('0x3d')]);return db[_0xc3f5('0x3e')][_0xc3f5('0x47')](_0x495bc7)[_0xc3f5('0x25')](handleEntityNotFound(_0x5d08fa,null))[_0xc3f5('0x25')](respondWithResult(_0x5d08fa,null))[_0xc3f5('0x41')](handleError(_0x5d08fa,null));};exports[_0xc3f5('0x48')]=function(_0x14e94d,_0x5c9da0){return db[_0xc3f5('0x3e')][_0xc3f5('0x48')](_0x14e94d['body'],{})['then'](respondWithResult(_0x5c9da0,0xc9))[_0xc3f5('0x41')](handleError(_0x5c9da0,null));};exports[_0xc3f5('0x23')]=function(_0x5d2221,_0x2c0c2f){if(_0x5d2221[_0xc3f5('0x49')]['id']){delete _0x5d2221[_0xc3f5('0x49')]['id'];}return db['MailTransferReport'][_0xc3f5('0x47')]({'where':{'id':_0x5d2221['params']['id']}})[_0xc3f5('0x25')](handleEntityNotFound(_0x2c0c2f,null))[_0xc3f5('0x25')](saveUpdates(_0x5d2221[_0xc3f5('0x49')],null))['then'](respondWithResult(_0x2c0c2f,null))[_0xc3f5('0x41')](handleError(_0x2c0c2f,null));};exports[_0xc3f5('0x24')]=function(_0xb53132,_0x2b0dab){return db[_0xc3f5('0x3e')][_0xc3f5('0x47')]({'where':{'id':_0xb53132[_0xc3f5('0x43')]['id']}})['then'](handleEntityNotFound(_0x2b0dab,null))[_0xc3f5('0x25')](removeEntity(_0x2b0dab,null))[_0xc3f5('0x41')](handleError(_0x2b0dab,null));};exports[_0xc3f5('0x4a')]=function(_0xf95fa5,_0x808439){return db[_0xc3f5('0x3e')]['describe']()[_0xc3f5('0x25')](respondWithResult(_0x808439,null))[_0xc3f5('0x41')](handleError(_0x808439,null));}; \ No newline at end of file +var _0xf6d7=['rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','merge','options','includeAll','rows','catch','show','params','keys','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','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','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','end','error','stack','name','send','index','map','MailTransferReport'];(function(_0x49a500,_0x5c4bc1){var _0x28c568=function(_0x4a6a7c){while(--_0x4a6a7c){_0x49a500['push'](_0x49a500['shift']());}};_0x28c568(++_0x5c4bc1);}(_0xf6d7,0x102));var _0x7f6d=function(_0x330740,_0x58c0c0){_0x330740=_0x330740-0x0;var _0x1cb5f2=_0xf6d7[_0x330740];return _0x1cb5f2;};'use strict';var emlformat=require(_0x7f6d('0x0'));var rimraf=require(_0x7f6d('0x1'));var zipdir=require(_0x7f6d('0x2'));var jsonpatch=require(_0x7f6d('0x3'));var rp=require('request-promise');var moment=require(_0x7f6d('0x4'));var BPromise=require(_0x7f6d('0x5'));var Mustache=require(_0x7f6d('0x6'));var util=require('util');var path=require(_0x7f6d('0x7'));var sox=require('sox');var csv=require(_0x7f6d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f6d('0x9'));var _=require(_0x7f6d('0xa'));var squel=require(_0x7f6d('0xb'));var crypto=require(_0x7f6d('0xc'));var jsforce=require(_0x7f6d('0xd'));var deskjs=require(_0x7f6d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7f6d('0xf'));var Papa=require(_0x7f6d('0x10'));var Redis=require(_0x7f6d('0x11'));var authService=require(_0x7f6d('0x12'));var qs=require(_0x7f6d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f6d('0x14'));var logger=require('../../config/logger')(_0x7f6d('0x15'));var utils=require(_0x7f6d('0x16'));var config=require(_0x7f6d('0x17'));var licenseUtil=require(_0x7f6d('0x18'));var db=require(_0x7f6d('0x19'))['db'];function respondWithStatusCode(_0x36e5fb,_0x3ffd9e){_0x3ffd9e=_0x3ffd9e||0xcc;return function(_0x51b5fc){if(_0x51b5fc){return _0x36e5fb[_0x7f6d('0x1a')](_0x3ffd9e);}return _0x36e5fb[_0x7f6d('0x1b')](_0x3ffd9e)['end']();};}function respondWithResult(_0x4b549a,_0x2ac7ca){_0x2ac7ca=_0x2ac7ca||0xc8;return function(_0x10ed9e){if(_0x10ed9e){return _0x4b549a['status'](_0x2ac7ca)[_0x7f6d('0x1c')](_0x10ed9e);}};}function respondWithFilteredResult(_0x29e722,_0x7c1abb){return function(_0xd52177){if(_0xd52177){var _0xafb70=typeof _0x7c1abb[_0x7f6d('0x1d')]===_0x7f6d('0x1e')&&typeof _0x7c1abb[_0x7f6d('0x1f')]===_0x7f6d('0x1e');var _0x11fab5=_0xd52177[_0x7f6d('0x20')];var _0x5c2109=_0xafb70?0x0:_0x7c1abb['offset'];var _0x6583e1=_0xafb70?_0xd52177[_0x7f6d('0x20')]:_0x7c1abb[_0x7f6d('0x1d')]+_0x7c1abb[_0x7f6d('0x1f')];var _0x593a99;if(_0x6583e1>=_0x11fab5){_0x6583e1=_0x11fab5;_0x593a99=0xc8;}else{_0x593a99=0xce;}_0x29e722[_0x7f6d('0x1b')](_0x593a99);return _0x29e722[_0x7f6d('0x21')]('Content-Range',_0x5c2109+'-'+_0x6583e1+'/'+_0x11fab5)[_0x7f6d('0x1c')](_0xd52177);}return null;};}function patchUpdates(_0x391a76){return function(_0x26e388){try{jsonpatch[_0x7f6d('0x22')](_0x26e388,_0x391a76,!![]);}catch(_0x385d24){return BPromise[_0x7f6d('0x23')](_0x385d24);}return _0x26e388['save']();};}function saveUpdates(_0x238009,_0x52d5b6){return function(_0x1e6efd){if(_0x1e6efd){return _0x1e6efd[_0x7f6d('0x24')](_0x238009)[_0x7f6d('0x25')](function(_0xa23e96){return _0xa23e96;});}return null;};}function removeEntity(_0x44ae5b,_0xd91efe){return function(_0x5914d5){if(_0x5914d5){return _0x5914d5['destroy']()[_0x7f6d('0x25')](function(){_0x44ae5b[_0x7f6d('0x1b')](0xcc)[_0x7f6d('0x26')]();});}};}function handleEntityNotFound(_0x4358df,_0x4a16b6){return function(_0x3441f7){if(!_0x3441f7){_0x4358df[_0x7f6d('0x1a')](0x194);}return _0x3441f7;};}function handleError(_0xf9dedb,_0x18b02f){_0x18b02f=_0x18b02f||0x1f4;return function(_0x24cba6){logger[_0x7f6d('0x27')](_0x24cba6[_0x7f6d('0x28')]);if(_0x24cba6[_0x7f6d('0x29')]){delete _0x24cba6[_0x7f6d('0x29')];}_0xf9dedb['status'](_0x18b02f)[_0x7f6d('0x2a')](_0x24cba6);};}exports[_0x7f6d('0x2b')]=function(_0x5a0c76,_0x472e64){var _0x4ef6e1={},_0x25cd24={},_0x4ff8ec={'count':0x0,'rows':[]};var _0x21ae79=_[_0x7f6d('0x2c')](db[_0x7f6d('0x2d')][_0x7f6d('0x2e')],function(_0x10687f){return{'name':_0x10687f[_0x7f6d('0x2f')],'type':_0x10687f[_0x7f6d('0x30')][_0x7f6d('0x31')]};});_0x25cd24[_0x7f6d('0x32')]=_[_0x7f6d('0x2c')](_0x21ae79,_0x7f6d('0x29'));_0x25cd24[_0x7f6d('0x33')]=_['keys'](_0x5a0c76[_0x7f6d('0x33')]);_0x25cd24[_0x7f6d('0x34')]=_['intersection'](_0x25cd24[_0x7f6d('0x32')],_0x25cd24[_0x7f6d('0x33')]);_0x4ef6e1[_0x7f6d('0x35')]=_[_0x7f6d('0x36')](_0x25cd24[_0x7f6d('0x32')],qs[_0x7f6d('0x37')](_0x5a0c76[_0x7f6d('0x33')][_0x7f6d('0x37')]));_0x4ef6e1[_0x7f6d('0x35')]=_0x4ef6e1[_0x7f6d('0x35')][_0x7f6d('0x38')]?_0x4ef6e1[_0x7f6d('0x35')]:_0x25cd24[_0x7f6d('0x32')];if(!_0x5a0c76['query'][_0x7f6d('0x39')](_0x7f6d('0x3a'))){_0x4ef6e1[_0x7f6d('0x1f')]=qs[_0x7f6d('0x1f')](_0x5a0c76['query'][_0x7f6d('0x1f')]);_0x4ef6e1[_0x7f6d('0x1d')]=qs[_0x7f6d('0x1d')](_0x5a0c76['query'][_0x7f6d('0x1d')]);}_0x4ef6e1['order']=qs['sort'](_0x5a0c76['query'][_0x7f6d('0x3b')]);_0x4ef6e1[_0x7f6d('0x3c')]=qs[_0x7f6d('0x34')](_['pick'](_0x5a0c76[_0x7f6d('0x33')],_0x25cd24[_0x7f6d('0x34')]),_0x21ae79);if(_0x5a0c76[_0x7f6d('0x33')]['filter']){_0x4ef6e1[_0x7f6d('0x3c')]=_['merge'](_0x4ef6e1[_0x7f6d('0x3c')],{'$or':_[_0x7f6d('0x2c')](_0x21ae79,function(_0x10e851){if(_0x10e851[_0x7f6d('0x30')]!==_0x7f6d('0x3d')){var _0x12f40b={};_0x12f40b[_0x10e851[_0x7f6d('0x29')]]={'$like':'%'+_0x5a0c76[_0x7f6d('0x33')]['filter']+'%'};return _0x12f40b;}})});}_0x4ef6e1=_[_0x7f6d('0x3e')]({},_0x4ef6e1,_0x5a0c76[_0x7f6d('0x3f')]);var _0x30da86={'where':_0x4ef6e1[_0x7f6d('0x3c')]};return db['MailTransferReport'][_0x7f6d('0x20')](_0x30da86)[_0x7f6d('0x25')](function(_0x41764d){_0x4ff8ec[_0x7f6d('0x20')]=_0x41764d;if(_0x5a0c76[_0x7f6d('0x33')][_0x7f6d('0x40')]){_0x4ef6e1['include']=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x4ef6e1);})[_0x7f6d('0x25')](function(_0x4459c1){_0x4ff8ec[_0x7f6d('0x41')]=_0x4459c1;return _0x4ff8ec;})[_0x7f6d('0x25')](respondWithFilteredResult(_0x472e64,_0x4ef6e1))[_0x7f6d('0x42')](handleError(_0x472e64,null));};exports[_0x7f6d('0x43')]=function(_0x355887,_0x270828){var _0x2be16d={'raw':!![],'where':{'id':_0x355887[_0x7f6d('0x44')]['id']}},_0x3ae1f7={};_0x3ae1f7[_0x7f6d('0x32')]=_['keys'](db[_0x7f6d('0x2d')]['rawAttributes']);_0x3ae1f7[_0x7f6d('0x33')]=_[_0x7f6d('0x45')](_0x355887[_0x7f6d('0x33')]);_0x3ae1f7[_0x7f6d('0x34')]=_[_0x7f6d('0x36')](_0x3ae1f7['model'],_0x3ae1f7[_0x7f6d('0x33')]);_0x2be16d[_0x7f6d('0x35')]=_[_0x7f6d('0x36')](_0x3ae1f7[_0x7f6d('0x32')],qs['fields'](_0x355887[_0x7f6d('0x33')]['fields']));_0x2be16d[_0x7f6d('0x35')]=_0x2be16d['attributes'][_0x7f6d('0x38')]?_0x2be16d[_0x7f6d('0x35')]:_0x3ae1f7[_0x7f6d('0x32')];if(_0x355887[_0x7f6d('0x33')][_0x7f6d('0x40')]){_0x2be16d[_0x7f6d('0x46')]=[{'all':!![]}];}_0x2be16d=_[_0x7f6d('0x3e')]({},_0x2be16d,_0x355887['options']);return db[_0x7f6d('0x2d')][_0x7f6d('0x47')](_0x2be16d)[_0x7f6d('0x25')](handleEntityNotFound(_0x270828,null))[_0x7f6d('0x25')](respondWithResult(_0x270828,null))[_0x7f6d('0x42')](handleError(_0x270828,null));};exports[_0x7f6d('0x48')]=function(_0x2f30ff,_0x9d647b){return db[_0x7f6d('0x2d')][_0x7f6d('0x48')](_0x2f30ff[_0x7f6d('0x49')],{})[_0x7f6d('0x25')](respondWithResult(_0x9d647b,0xc9))['catch'](handleError(_0x9d647b,null));};exports[_0x7f6d('0x24')]=function(_0x2f4451,_0x5db078){if(_0x2f4451[_0x7f6d('0x49')]['id']){delete _0x2f4451[_0x7f6d('0x49')]['id'];}return db[_0x7f6d('0x2d')][_0x7f6d('0x47')]({'where':{'id':_0x2f4451[_0x7f6d('0x44')]['id']}})[_0x7f6d('0x25')](handleEntityNotFound(_0x5db078,null))[_0x7f6d('0x25')](saveUpdates(_0x2f4451['body'],null))[_0x7f6d('0x25')](respondWithResult(_0x5db078,null))[_0x7f6d('0x42')](handleError(_0x5db078,null));};exports[_0x7f6d('0x4a')]=function(_0x5a65ca,_0x2f4514){return db[_0x7f6d('0x2d')]['find']({'where':{'id':_0x5a65ca['params']['id']}})[_0x7f6d('0x25')](handleEntityNotFound(_0x2f4514,null))[_0x7f6d('0x25')](removeEntity(_0x2f4514,null))['catch'](handleError(_0x2f4514,null));};exports[_0x7f6d('0x4b')]=function(_0x4b57f6,_0x2e4241){return db[_0x7f6d('0x2d')]['describe']()[_0x7f6d('0x25')](respondWithResult(_0x2e4241,null))[_0x7f6d('0x42')](handleError(_0x2e4241,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index e6579d7..e83209d 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 _0xa41a=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','report_mail_transfer','uniqueid','lodash'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xa41a,0x6b));var _0xaa41=function(_0x3bc9e0,_0x11d9e8){_0x3bc9e0=_0x3bc9e0-0x0;var _0x5c51fc=_0xa41a[_0x3bc9e0];return _0x5c51fc;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('MailTransferReport',attributes,{'tableName':_0xaa41('0xa'),'paranoid':![],'indexes':[{'name':_0xaa41('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x18d6=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','report_mail_transfer','uniqueid','lodash','util'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0x18d6,0x166));var _0x618d=function(_0x2d5a9d,_0x499b8c){_0x2d5a9d=_0x2d5a9d-0x0;var _0x40fd1f=_0x18d6[_0x2d5a9d];return _0x40fd1f;};'use strict';var _=require(_0x618d('0x0'));var util=require(_0x618d('0x1'));var logger=require('../../config/logger')(_0x618d('0x2'));var moment=require(_0x618d('0x3'));var BPromise=require(_0x618d('0x4'));var rp=require(_0x618d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x618d('0x6'));var config=require(_0x618d('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0x618d('0x8')]=function(_0x55caad,_0xa89cff){return _0x55caad[_0x618d('0x9')]('MailTransferReport',attributes,{'tableName':_0x618d('0xa'),'paranoid':![],'indexes':[{'name':_0x618d('0xb'),'fields':[_0x618d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 6d2d0ee..71dd6db 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 _0x7037=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','randomstring','ioredis'];(function(_0x171bef,_0x4cba08){var _0x28828a=function(_0x19d85c){while(--_0x19d85c){_0x171bef['push'](_0x171bef['shift']());}};_0x28828a(++_0x4cba08);}(_0x7037,0xed));var _0x7703=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7037[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0x7703('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7703('0x1'));var fs=require('fs');var Redis=require(_0x7703('0x2'));var db=require(_0x7703('0x3'))['db'];var utils=require(_0x7703('0x4'));var logger=require('../../config/logger')(_0x7703('0x5'));var config=require(_0x7703('0x6'));var jayson=require(_0x7703('0x7'));var client=jayson[_0x7703('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36e3b1,_0x5b480f,_0x1cbf03){return new BPromise(function(_0xb977b,_0x837bc8){return client[_0x7703('0x9')](_0x36e3b1,_0x1cbf03)['then'](function(_0xe7b77){logger[_0x7703('0xa')](_0x7703('0xb'),_0x5b480f,_0x7703('0xc'));logger[_0x7703('0xd')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x5b480f,_0x7703('0xc'),JSON[_0x7703('0xe')](_0xe7b77));if(_0xe7b77[_0x7703('0xf')]){if(_0xe7b77[_0x7703('0xf')][_0x7703('0x10')]===0x1f4){logger[_0x7703('0xf')](_0x7703('0xb'),_0x5b480f,_0xe7b77[_0x7703('0xf')]['message']);return _0x837bc8(_0xe7b77[_0x7703('0xf')][_0x7703('0x11')]);}logger[_0x7703('0xf')](_0x7703('0xb'),_0x5b480f,_0xe7b77['error'][_0x7703('0x11')]);return _0xb977b(_0xe7b77[_0x7703('0xf')]['message']);}else{logger[_0x7703('0xa')](_0x7703('0xb'),_0x5b480f,'request\x20sent');_0xb977b(_0xe7b77[_0x7703('0x12')][_0x7703('0x11')]);}})[_0x7703('0x13')](function(_0x2ac49d){logger[_0x7703('0xf')](_0x7703('0xb'),_0x5b480f,_0x2ac49d);_0x837bc8(_0x2ac49d);});});} \ No newline at end of file +var _0xbdbb=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','moment','bluebird','randomstring','../../config/logger'];(function(_0xba1dde,_0x16202d){var _0x30dfc0=function(_0x5aff98){while(--_0x5aff98){_0xba1dde['push'](_0xba1dde['shift']());}};_0x30dfc0(++_0x16202d);}(_0xbdbb,0x1e9));var _0xbbdb=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xbdbb[_0x5f0089];return _0x193892;};'use strict';var _=require(_0xbbdb('0x0'));var util=require('util');var moment=require(_0xbbdb('0x1'));var BPromise=require(_0xbbdb('0x2'));var rs=require(_0xbbdb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbbdb('0x4'))(_0xbbdb('0x5'));var config=require(_0xbbdb('0x6'));var jayson=require(_0xbbdb('0x7'));var client=jayson[_0xbbdb('0x8')][_0xbbdb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dd8d2,_0x732e31,_0x1c1a02){return new BPromise(function(_0x5200f1,_0x32d74e){return client[_0xbbdb('0xa')](_0x2dd8d2,_0x1c1a02)[_0xbbdb('0xb')](function(_0x49166e){logger[_0xbbdb('0xc')](_0xbbdb('0xd'),_0x732e31,_0xbbdb('0xe'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x732e31,_0xbbdb('0xe'),JSON['stringify'](_0x49166e));if(_0x49166e[_0xbbdb('0xf')]){if(_0x49166e[_0xbbdb('0xf')]['code']===0x1f4){logger[_0xbbdb('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x732e31,_0x49166e['error'][_0xbbdb('0x10')]);return _0x32d74e(_0x49166e[_0xbbdb('0xf')][_0xbbdb('0x10')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x732e31,_0x49166e[_0xbbdb('0xf')][_0xbbdb('0x10')]);return _0x5200f1(_0x49166e[_0xbbdb('0xf')][_0xbbdb('0x10')]);}else{logger[_0xbbdb('0xc')](_0xbbdb('0xd'),_0x732e31,_0xbbdb('0xe'));_0x5200f1(_0x49166e[_0xbbdb('0x11')][_0xbbdb('0x10')]);}})[_0xbbdb('0x12')](function(_0x64265b){logger[_0xbbdb('0xf')](_0xbbdb('0xd'),_0x732e31,_0x64265b);_0x32d74e(_0x64265b);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 2a64025..fc1dbc7 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 _0x3905=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x7fb522,_0x5adcba){var _0x1b4e93=function(_0x2c77cf){while(--_0x2c77cf){_0x7fb522['push'](_0x7fb522['shift']());}};_0x1b4e93(++_0x5adcba);}(_0x3905,0x19f));var _0x5390=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0x3905[_0x326e79];return _0x37eb89;};'use strict';var multer=require(_0x5390('0x0'));var util=require(_0x5390('0x1'));var path=require(_0x5390('0x2'));var timeout=require(_0x5390('0x3'));var express=require(_0x5390('0x4'));var router=express['Router']();var fs_extra=require(_0x5390('0x5'));var auth=require(_0x5390('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5390('0x7'));var controller=require(_0x5390('0x8'));router[_0x5390('0x9')]('/',auth[_0x5390('0xa')](),controller['index']);router[_0x5390('0x9')](_0x5390('0xb'),auth['isAuthenticated'](),controller[_0x5390('0xc')]);router[_0x5390('0x9')](_0x5390('0xd'),auth[_0x5390('0xa')](),controller[_0x5390('0xe')]);router[_0x5390('0xf')]('/',auth[_0x5390('0xa')](),controller[_0x5390('0x10')]);router[_0x5390('0x11')](_0x5390('0xd'),auth['isAuthenticated'](),controller[_0x5390('0x12')]);router[_0x5390('0x13')](_0x5390('0xd'),auth[_0x5390('0xa')](),controller[_0x5390('0x14')]);module[_0x5390('0x15')]=router; \ No newline at end of file +var _0x93b9=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','index','/describe','describe'];(function(_0x1df9b0,_0x51f028){var _0x34c490=function(_0x515975){while(--_0x515975){_0x1df9b0['push'](_0x1df9b0['shift']());}};_0x34c490(++_0x51f028);}(_0x93b9,0xe6));var _0x993b=function(_0x6dfbaa,_0x31eede){_0x6dfbaa=_0x6dfbaa-0x0;var _0xfbe02=_0x93b9[_0x6dfbaa];return _0xfbe02;};'use strict';var multer=require('multer');var util=require(_0x993b('0x0'));var path=require(_0x993b('0x1'));var timeout=require(_0x993b('0x2'));var express=require('express');var router=express[_0x993b('0x3')]();var fs_extra=require(_0x993b('0x4'));var auth=require(_0x993b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x993b('0x6'));var controller=require(_0x993b('0x7'));router[_0x993b('0x8')]('/',auth['isAuthenticated'](),controller[_0x993b('0x9')]);router[_0x993b('0x8')](_0x993b('0xa'),auth['isAuthenticated'](),controller[_0x993b('0xb')]);router['get'](_0x993b('0xc'),auth['isAuthenticated'](),controller[_0x993b('0xd')]);router[_0x993b('0xe')]('/',auth[_0x993b('0xf')](),controller[_0x993b('0x10')]);router[_0x993b('0x11')]('/:id',auth[_0x993b('0xf')](),controller[_0x993b('0x12')]);router[_0x993b('0x13')](_0x993b('0xc'),auth[_0x993b('0xf')](),controller[_0x993b('0x14')]);module[_0x993b('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index ee47f78..0c1e9f1 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 _0x311e=['talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x311e,0xc0));var _0xe311=function(_0x53fc2d,_0x5195db){_0x53fc2d=_0x53fc2d-0x0;var _0x5dde27=_0x311e[_0x53fc2d];return _0x5dde27;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe311('0x0'));module[_0xe311('0x1')]={'channel':{'type':Sequelize[_0xe311('0x2')]},'membername':{'type':Sequelize[_0xe311('0x2')]},'interface':{'type':Sequelize[_0xe311('0x2')]},'type':{'type':Sequelize[_0xe311('0x2')],'defaultValue':_0xe311('0x3'),'comment':_0xe311('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe311('0x5')],'set':function(_0x309187){var _0x24f938=moment(_0x309187);var _0x1dea76=moment(this[_0xe311('0x6')](_0xe311('0x7')));var _0x2d9add=_0x24f938[_0xe311('0x8')](_0x1dea76,_0xe311('0x9'));this[_0xe311('0xa')]('exitAt',_0x309187);this[_0xe311('0xa')](_0xe311('0xb'),_0x2d9add>=0x0?_0x2d9add:null);}},'data1':{'type':Sequelize[_0xe311('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0xe311('0xc')},'data3':{'type':Sequelize['STRING'],'comment':_0xe311('0xd')},'data4':{'type':Sequelize[_0xe311('0x2')],'comment':_0xe311('0xe')},'data5':{'type':Sequelize[_0xe311('0x2')],'comment':_0xe311('0xf')},'role':{'type':Sequelize[_0xe311('0x2')]},'internal':{'type':Sequelize[_0xe311('0x10')]},'uniqueid':{'type':Sequelize[_0xe311('0x2')]}}; \ No newline at end of file +var _0x9e9e=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','moment','exports','STRING','DEFAULT\x20PAUSE','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','duration'];(function(_0x54f0b2,_0xe2655b){var _0x54dd1b=function(_0x2cbb9c){while(--_0x2cbb9c){_0x54f0b2['push'](_0x54f0b2['shift']());}};_0x54dd1b(++_0xe2655b);}(_0x9e9e,0x7d));var _0xe9e9=function(_0x27bcf5,_0x236765){_0x27bcf5=_0x27bcf5-0x0;var _0x4ce4cf=_0x9e9e[_0x27bcf5];return _0x4ce4cf;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe9e9('0x0'));module[_0xe9e9('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xe9e9('0x2')]},'interface':{'type':Sequelize[_0xe9e9('0x2')]},'type':{'type':Sequelize[_0xe9e9('0x2')],'defaultValue':_0xe9e9('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe9e9('0x4')],'set':function(_0x233f5e){var _0x3bec7a=moment(_0x233f5e);var _0xc43a70=moment(this[_0xe9e9('0x5')](_0xe9e9('0x6')));var _0x36fa1b=_0x3bec7a['diff'](_0xc43a70,_0xe9e9('0x7'));this[_0xe9e9('0x8')](_0xe9e9('0x9'),_0x233f5e);this[_0xe9e9('0x8')](_0xe9e9('0xa'),_0x36fa1b>=0x0?_0x36fa1b:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xe9e9('0xb')},'data2':{'type':Sequelize[_0xe9e9('0x2')],'comment':_0xe9e9('0xc')},'data3':{'type':Sequelize[_0xe9e9('0x2')],'comment':_0xe9e9('0xd')},'data4':{'type':Sequelize[_0xe9e9('0x2')],'comment':_0xe9e9('0xe')},'data5':{'type':Sequelize[_0xe9e9('0x2')],'comment':_0xe9e9('0xf')},'role':{'type':Sequelize[_0xe9e9('0x2')]},'internal':{'type':Sequelize[_0xe9e9('0x10')]},'uniqueid':{'type':Sequelize[_0xe9e9('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 02e79ba..428931a 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 _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x4f41fb,_0x252161){var _0x333d7a=function(_0x473be3){while(--_0x473be3){_0x4f41fb['push'](_0x4f41fb['shift']());}};_0x333d7a(++_0x252161);}(_0x3e74,0x175));var _0x43e7=function(_0x3cb1c5,_0x28c1fb){_0x3cb1c5=_0x3cb1c5-0x0;var _0x463f8f=_0x3e74[_0x3cb1c5];return _0x463f8f;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x59be7f,_0x3647aa){var _0x13cbf1=function(_0x5b2c16){while(--_0x5b2c16){_0x59be7f['push'](_0x59be7f['shift']());}};_0x13cbf1(++_0x3647aa);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 716fed2..174f8a8 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 _0x34be=['interface','util','rimraf','../../config/environment','exports','MemberReport','membername_interface','membername'];(function(_0x7729b1,_0x468322){var _0x349504=function(_0x401cee){while(--_0x401cee){_0x7729b1['push'](_0x7729b1['shift']());}};_0x349504(++_0x468322);}(_0x34be,0x139));var _0xe34b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x34be[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0xe34b('0x0'));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('path');var rimraf=require(_0xe34b('0x1'));var config=require(_0xe34b('0x2'));var attributes=require('./memberReport.attributes');module[_0xe34b('0x3')]=function(_0x5f4c78,_0x2c7e9d){return _0x5f4c78['define'](_0xe34b('0x4'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xe34b('0x5'),'fields':[_0xe34b('0x6'),_0xe34b('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x30d7=['path','rimraf','../../config/environment','./memberReport.attributes','report_member','membername','interface','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x30bd66,_0x36a93d){var _0x74c9dd=function(_0x2cd660){while(--_0x2cd660){_0x30bd66['push'](_0x30bd66['shift']());}};_0x74c9dd(++_0x36a93d);}(_0x30d7,0x173));var _0x730d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x730d('0x0'));var util=require(_0x730d('0x1'));var logger=require(_0x730d('0x2'))(_0x730d('0x3'));var moment=require(_0x730d('0x4'));var BPromise=require('bluebird');var rp=require(_0x730d('0x5'));var fs=require('fs');var path=require(_0x730d('0x6'));var rimraf=require(_0x730d('0x7'));var config=require(_0x730d('0x8'));var attributes=require(_0x730d('0x9'));module['exports']=function(_0x18cfa8,_0x5bc4bf){return _0x18cfa8['define']('MemberReport',attributes,{'tableName':_0x730d('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x730d('0xb'),_0x730d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 4bc7149..1ceb099 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 _0x1203=['error','code','message','result','GetMemberReport','MemberReport','options','raw','attributes','limit','include','model','map','then','catch','CreateMemberReport','create','UpdateMemberReport','update','body','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x1203,0x8c));var _0x3120=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1203[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3120('0x0'));var util=require(_0x3120('0x1'));var moment=require(_0x3120('0x2'));var BPromise=require(_0x3120('0x3'));var rs=require(_0x3120('0x4'));var fs=require('fs');var Redis=require(_0x3120('0x5'));var db=require(_0x3120('0x6'))['db'];var utils=require(_0x3120('0x7'));var logger=require(_0x3120('0x8'))(_0x3120('0x9'));var config=require(_0x3120('0xa'));var jayson=require(_0x3120('0xb'));var client=jayson[_0x3120('0xc')][_0x3120('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2ac620,_0x1f1c97,_0x5e9785){return new BPromise(function(_0x1fa4b8,_0x513da6){return client['request'](_0x2ac620,_0x5e9785)['then'](function(_0x580f86){logger[_0x3120('0xe')](_0x3120('0xf'),_0x1f1c97,'request\x20sent');logger[_0x3120('0x10')](_0x3120('0x11'),_0x1f1c97,_0x3120('0x12'),JSON[_0x3120('0x13')](_0x580f86));if(_0x580f86['error']){if(_0x580f86[_0x3120('0x14')][_0x3120('0x15')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x1f1c97,_0x580f86[_0x3120('0x14')][_0x3120('0x16')]);return _0x513da6(_0x580f86[_0x3120('0x14')][_0x3120('0x16')]);}logger[_0x3120('0x14')](_0x3120('0xf'),_0x1f1c97,_0x580f86[_0x3120('0x14')]['message']);return _0x1fa4b8(_0x580f86[_0x3120('0x14')][_0x3120('0x16')]);}else{logger[_0x3120('0xe')](_0x3120('0xf'),_0x1f1c97,_0x3120('0x12'));_0x1fa4b8(_0x580f86[_0x3120('0x17')][_0x3120('0x16')]);}})['catch'](function(_0x308873){logger['error'](_0x3120('0xf'),_0x1f1c97,_0x308873);_0x513da6(_0x308873);});});}exports[_0x3120('0x18')]=function(_0x2bbdb7){var _0x1a513c=this;return new Promise(function(_0x3c8c9b,_0x3af913){return db[_0x3120('0x19')]['findAll']({'raw':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7['options'][_0x3120('0x1b')]===undefined?!![]:![]:!![],'where':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7[_0x3120('0x1a')]['where']||null:null,'attributes':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7['options'][_0x3120('0x1c')]||null:null,'limit':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7['options'][_0x3120('0x1d')]||null:null,'include':_0x2bbdb7[_0x3120('0x1a')]?_0x2bbdb7[_0x3120('0x1a')][_0x3120('0x1e')]?_['map'](_0x2bbdb7[_0x3120('0x1a')]['include'],function(_0x444b3b){return{'model':db[_0x444b3b[_0x3120('0x1f')]],'as':_0x444b3b['as'],'attributes':_0x444b3b[_0x3120('0x1c')],'include':_0x444b3b['include']?_['map'](_0x444b3b[_0x3120('0x1e')],function(_0x7d0b5f){return{'model':db[_0x7d0b5f['model']],'as':_0x7d0b5f['as'],'attributes':_0x7d0b5f[_0x3120('0x1c')],'include':_0x7d0b5f[_0x3120('0x1e')]?_[_0x3120('0x20')](_0x7d0b5f['include'],function(_0x2636b5){return{'model':db[_0x2636b5[_0x3120('0x1f')]],'as':_0x2636b5['as'],'attributes':_0x2636b5[_0x3120('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3120('0x21')](function(_0x4b343b){logger['info']('GetMemberReport',_0x2bbdb7);logger[_0x3120('0x10')]('GetMemberReport',_0x2bbdb7,JSON[_0x3120('0x13')](_0x4b343b));_0x3c8c9b(_0x4b343b);})[_0x3120('0x22')](function(_0x3de290){logger[_0x3120('0x14')](_0x3120('0x18'),_0x3de290[_0x3120('0x16')],_0x2bbdb7);_0x3af913(_0x1a513c['error'](0x1f4,_0x3de290[_0x3120('0x16')]));});});};exports[_0x3120('0x23')]=function(_0x1471de){var _0x1ee7bc=this;return new Promise(function(_0x6ba5,_0x35e69f){return db[_0x3120('0x19')][_0x3120('0x24')](_0x1471de['body'],{'raw':_0x1471de['options']?_0x1471de[_0x3120('0x1a')][_0x3120('0x1b')]===undefined?!![]:![]:!![]})[_0x3120('0x21')](function(_0x34beab){logger[_0x3120('0xe')](_0x3120('0x23'),_0x1471de);logger['debug'](_0x3120('0x23'),_0x1471de,JSON[_0x3120('0x13')](_0x34beab));_0x6ba5(_0x34beab);})[_0x3120('0x22')](function(_0x2d786a){logger[_0x3120('0x14')](_0x3120('0x23'),_0x2d786a[_0x3120('0x16')],_0x1471de);_0x35e69f(_0x1ee7bc['error'](0x1f4,_0x2d786a[_0x3120('0x16')]));});});};exports[_0x3120('0x25')]=function(_0x2d6b82){var _0x2f80f1=this;return new Promise(function(_0x3067ca,_0x3d0d05){return db[_0x3120('0x19')][_0x3120('0x26')](_0x2d6b82[_0x3120('0x27')],{'raw':_0x2d6b82[_0x3120('0x1a')]?_0x2d6b82[_0x3120('0x1a')][_0x3120('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d6b82[_0x3120('0x1a')]?_0x2d6b82['options']['where']||null:null,'attributes':_0x2d6b82[_0x3120('0x1a')]?_0x2d6b82[_0x3120('0x1a')][_0x3120('0x1c')]||null:null,'limit':_0x2d6b82['options']?_0x2d6b82[_0x3120('0x1a')][_0x3120('0x1d')]||null:null})[_0x3120('0x21')](function(_0x5d414e){logger[_0x3120('0xe')](_0x3120('0x25'),_0x2d6b82);logger[_0x3120('0x10')](_0x3120('0x25'),_0x2d6b82,JSON[_0x3120('0x13')](_0x5d414e));_0x3067ca(_0x5d414e);})[_0x3120('0x22')](function(_0x4bbc5d){logger['error']('UpdateMemberReport',_0x4bbc5d[_0x3120('0x16')],_0x2d6b82);_0x3d0d05(_0x2f80f1['error'](0x1f4,_0x4bbc5d[_0x3120('0x16')]));});});}; \ No newline at end of file +var _0x22da=['GetMemberReport','MemberReport','findAll','options','raw','attributes','include','model','map','then','CreateMemberReport','create','body','stringify','update','where','UpdateMemberReport','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','MemberReport,\x20%s,\x20%s','message','result','catch'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x22da,0x80));var _0xa22d=function(_0x3afba0,_0x26e10f){_0x3afba0=_0x3afba0-0x0;var _0x13ca03=_0x22da[_0x3afba0];return _0x13ca03;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa22d('0x0'));var BPromise=require(_0xa22d('0x1'));var rs=require(_0xa22d('0x2'));var fs=require('fs');var Redis=require(_0xa22d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa22d('0x4'));var logger=require(_0xa22d('0x5'))(_0xa22d('0x6'));var config=require(_0xa22d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa22d('0x8')][_0xa22d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c67ad,_0x215529,_0x44a5c7){return new BPromise(function(_0x5678bc,_0x186e5c){return client['request'](_0x4c67ad,_0x44a5c7)['then'](function(_0x15f0bd){logger[_0xa22d('0xa')]('MemberReport,\x20%s,\x20%s',_0x215529,_0xa22d('0xb'));logger[_0xa22d('0xc')](_0xa22d('0xd'),_0x215529,_0xa22d('0xb'),JSON['stringify'](_0x15f0bd));if(_0x15f0bd['error']){if(_0x15f0bd[_0xa22d('0xe')][_0xa22d('0xf')]===0x1f4){logger['error'](_0xa22d('0x10'),_0x215529,_0x15f0bd['error'][_0xa22d('0x11')]);return _0x186e5c(_0x15f0bd[_0xa22d('0xe')][_0xa22d('0x11')]);}logger['error'](_0xa22d('0x10'),_0x215529,_0x15f0bd[_0xa22d('0xe')][_0xa22d('0x11')]);return _0x5678bc(_0x15f0bd[_0xa22d('0xe')][_0xa22d('0x11')]);}else{logger['info'](_0xa22d('0x10'),_0x215529,_0xa22d('0xb'));_0x5678bc(_0x15f0bd[_0xa22d('0x12')][_0xa22d('0x11')]);}})[_0xa22d('0x13')](function(_0x2159e1){logger[_0xa22d('0xe')](_0xa22d('0x10'),_0x215529,_0x2159e1);_0x186e5c(_0x2159e1);});});}exports[_0xa22d('0x14')]=function(_0x3d78b9){var _0xf50354=this;return new Promise(function(_0x1ed22e,_0x39c2bf){return db[_0xa22d('0x15')][_0xa22d('0x16')]({'raw':_0x3d78b9[_0xa22d('0x17')]?_0x3d78b9['options'][_0xa22d('0x18')]===undefined?!![]:![]:!![],'where':_0x3d78b9[_0xa22d('0x17')]?_0x3d78b9[_0xa22d('0x17')]['where']||null:null,'attributes':_0x3d78b9['options']?_0x3d78b9['options'][_0xa22d('0x19')]||null:null,'limit':_0x3d78b9[_0xa22d('0x17')]?_0x3d78b9[_0xa22d('0x17')]['limit']||null:null,'include':_0x3d78b9[_0xa22d('0x17')]?_0x3d78b9[_0xa22d('0x17')][_0xa22d('0x1a')]?_['map'](_0x3d78b9[_0xa22d('0x17')][_0xa22d('0x1a')],function(_0x502219){return{'model':db[_0x502219[_0xa22d('0x1b')]],'as':_0x502219['as'],'attributes':_0x502219[_0xa22d('0x19')],'include':_0x502219[_0xa22d('0x1a')]?_[_0xa22d('0x1c')](_0x502219[_0xa22d('0x1a')],function(_0x1c83e8){return{'model':db[_0x1c83e8[_0xa22d('0x1b')]],'as':_0x1c83e8['as'],'attributes':_0x1c83e8['attributes'],'include':_0x1c83e8['include']?_[_0xa22d('0x1c')](_0x1c83e8[_0xa22d('0x1a')],function(_0x2fe9e0){return{'model':db[_0x2fe9e0[_0xa22d('0x1b')]],'as':_0x2fe9e0['as'],'attributes':_0x2fe9e0[_0xa22d('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa22d('0x1d')](function(_0x2ff235){logger[_0xa22d('0xa')](_0xa22d('0x14'),_0x3d78b9);logger[_0xa22d('0xc')](_0xa22d('0x14'),_0x3d78b9,JSON['stringify'](_0x2ff235));_0x1ed22e(_0x2ff235);})[_0xa22d('0x13')](function(_0x4d460f){logger['error'](_0xa22d('0x14'),_0x4d460f[_0xa22d('0x11')],_0x3d78b9);_0x39c2bf(_0xf50354[_0xa22d('0xe')](0x1f4,_0x4d460f[_0xa22d('0x11')]));});});};exports[_0xa22d('0x1e')]=function(_0x1892f8){var _0x1ef634=this;return new Promise(function(_0x384a4e,_0x5d9cc6){return db[_0xa22d('0x15')][_0xa22d('0x1f')](_0x1892f8[_0xa22d('0x20')],{'raw':_0x1892f8[_0xa22d('0x17')]?_0x1892f8[_0xa22d('0x17')][_0xa22d('0x18')]===undefined?!![]:![]:!![]})[_0xa22d('0x1d')](function(_0x70f222){logger[_0xa22d('0xa')](_0xa22d('0x1e'),_0x1892f8);logger['debug'](_0xa22d('0x1e'),_0x1892f8,JSON[_0xa22d('0x21')](_0x70f222));_0x384a4e(_0x70f222);})[_0xa22d('0x13')](function(_0x3977ef){logger[_0xa22d('0xe')](_0xa22d('0x1e'),_0x3977ef['message'],_0x1892f8);_0x5d9cc6(_0x1ef634[_0xa22d('0xe')](0x1f4,_0x3977ef[_0xa22d('0x11')]));});});};exports['UpdateMemberReport']=function(_0xd95fe4){var _0x4eb40d=this;return new Promise(function(_0x3e8859,_0x51b9a3){return db['MemberReport'][_0xa22d('0x22')](_0xd95fe4['body'],{'raw':_0xd95fe4[_0xa22d('0x17')]?_0xd95fe4[_0xa22d('0x17')][_0xa22d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd95fe4[_0xa22d('0x17')]?_0xd95fe4[_0xa22d('0x17')][_0xa22d('0x23')]||null:null,'attributes':_0xd95fe4[_0xa22d('0x17')]?_0xd95fe4[_0xa22d('0x17')]['attributes']||null:null,'limit':_0xd95fe4[_0xa22d('0x17')]?_0xd95fe4[_0xa22d('0x17')]['limit']||null:null})[_0xa22d('0x1d')](function(_0x33c0d0){logger['info']('UpdateMemberReport',_0xd95fe4);logger[_0xa22d('0xc')](_0xa22d('0x24'),_0xd95fe4,JSON[_0xa22d('0x21')](_0x33c0d0));_0x3e8859(_0x33c0d0);})[_0xa22d('0x13')](function(_0x265536){logger[_0xa22d('0xe')](_0xa22d('0x24'),_0x265536[_0xa22d('0x11')],_0xd95fe4);_0x51b9a3(_0x4eb40d[_0xa22d('0xe')](0x1f4,_0x265536[_0xa22d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 7fd5bc0..d5fa8ee 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 _0xdadf=['get','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x23094d,_0x5b0e1d){var _0x479e8e=function(_0x13279e){while(--_0x13279e){_0x23094d['push'](_0x23094d['shift']());}};_0x479e8e(++_0x5b0e1d);}(_0xdadf,0xc8));var _0xfdad=function(_0x1d67d8,_0x48d186){_0x1d67d8=_0x1d67d8-0x0;var _0x1ff88f=_0xdadf[_0x1d67d8];return _0x1ff88f;};'use strict';var multer=require(_0xfdad('0x0'));var util=require('util');var path=require(_0xfdad('0x1'));var timeout=require(_0xfdad('0x2'));var express=require('express');var router=express[_0xfdad('0x3')]();var fs_extra=require(_0xfdad('0x4'));var auth=require(_0xfdad('0x5'));var interaction=require(_0xfdad('0x6'));var config=require(_0xfdad('0x7'));var controller=require(_0xfdad('0x8'));router[_0xfdad('0x9')]('/',controller['index']);module[_0xfdad('0xa')]=router; \ No newline at end of file +var _0xd825=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0xd825,0xb4));var _0x5d82=function(_0x537c8c,_0x5751c1){_0x537c8c=_0x537c8c-0x0;var _0x3133a3=_0xd825[_0x537c8c];return _0x3133a3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5d82('0x0'));var timeout=require(_0x5d82('0x1'));var express=require(_0x5d82('0x2'));var router=express[_0x5d82('0x3')]();var fs_extra=require(_0x5d82('0x4'));var auth=require(_0x5d82('0x5'));var interaction=require(_0x5d82('0x6'));var config=require('../../config/environment');var controller=require(_0x5d82('0x7'));router[_0x5d82('0x8')]('/',controller[_0x5d82('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 081bade..8249e00 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 _0xbd30=['sequelize','STRING'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xbd30,0x9e));var _0x0bd3=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xbd30[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require(_0x0bd3('0x0'));module['exports']={'version':{'type':Sequelize[_0x0bd3('0x1')],'unique':'version'}}; \ No newline at end of file +var _0xcdde=['sequelize','exports','version'];(function(_0x36c525,_0x1a32de){var _0xacfb50=function(_0x581743){while(--_0x581743){_0x36c525['push'](_0x36c525['shift']());}};_0xacfb50(++_0x1a32de);}(_0xcdde,0x126));var _0xecdd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xcdde[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xecdd('0x0'));module[_0xecdd('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0xecdd('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 449fa3d..66b3e2c 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 _0x8809=['Migration','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','findAll','then','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','error','stack','name','index'];(function(_0xa2f2c0,_0x1bd315){var _0x3f2623=function(_0x38ff37){while(--_0x38ff37){_0xa2f2c0['push'](_0xa2f2c0['shift']());}};_0x3f2623(++_0x1bd315);}(_0x8809,0x171));var _0x9880=function(_0x299d27,_0x4cbc19){_0x299d27=_0x299d27-0x0;var _0x5692a1=_0x8809[_0x299d27];return _0x5692a1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9880('0x0'));var zipdir=require(_0x9880('0x1'));var jsonpatch=require(_0x9880('0x2'));var rp=require(_0x9880('0x3'));var moment=require(_0x9880('0x4'));var BPromise=require(_0x9880('0x5'));var Mustache=require(_0x9880('0x6'));var util=require(_0x9880('0x7'));var path=require(_0x9880('0x8'));var sox=require(_0x9880('0x9'));var csv=require(_0x9880('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9880('0xb'));var _=require(_0x9880('0xc'));var squel=require(_0x9880('0xd'));var crypto=require(_0x9880('0xe'));var jsforce=require(_0x9880('0xf'));var deskjs=require(_0x9880('0x10'));var toCsv=require(_0x9880('0xa'));var querystring=require(_0x9880('0x11'));var Papa=require(_0x9880('0x12'));var Redis=require(_0x9880('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9880('0x14'));var as=require(_0x9880('0x15'));var hardwareService=require(_0x9880('0x16'));var logger=require(_0x9880('0x17'))(_0x9880('0x18'));var utils=require(_0x9880('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x9880('0x1a'));var db=require(_0x9880('0x1b'))['db'];function respondWithStatusCode(_0x2a8aa9,_0x16f0b7){_0x16f0b7=_0x16f0b7||0xcc;return function(_0x12697b){if(_0x12697b){return _0x2a8aa9[_0x9880('0x1c')](_0x16f0b7);}return _0x2a8aa9['status'](_0x16f0b7)[_0x9880('0x1d')]();};}function respondWithResult(_0x2eb6af,_0x1d0a1f){_0x1d0a1f=_0x1d0a1f||0xc8;return function(_0x15e8d4){if(_0x15e8d4){return _0x2eb6af[_0x9880('0x1e')](_0x1d0a1f)[_0x9880('0x1f')](_0x15e8d4);}};}function respondWithFilteredResult(_0x5a6cb6,_0x5efd6e){return function(_0x3f967d){if(_0x3f967d){var _0x3e92e3=typeof _0x5efd6e[_0x9880('0x20')]===_0x9880('0x21')&&typeof _0x5efd6e[_0x9880('0x22')]==='undefined';var _0x1d9108=_0x3f967d['count'];var _0x66bba0=_0x3e92e3?0x0:_0x5efd6e[_0x9880('0x20')];var _0x59d4bf=_0x3e92e3?_0x3f967d[_0x9880('0x23')]:_0x5efd6e[_0x9880('0x20')]+_0x5efd6e[_0x9880('0x22')];var _0x2edcd8;if(_0x59d4bf>=_0x1d9108){_0x59d4bf=_0x1d9108;_0x2edcd8=0xc8;}else{_0x2edcd8=0xce;}_0x5a6cb6[_0x9880('0x1e')](_0x2edcd8);return _0x5a6cb6[_0x9880('0x24')](_0x9880('0x25'),_0x66bba0+'-'+_0x59d4bf+'/'+_0x1d9108)[_0x9880('0x1f')](_0x3f967d);}return null;};}function patchUpdates(_0x486cec){return function(_0x384077){try{jsonpatch['apply'](_0x384077,_0x486cec,!![]);}catch(_0x1b9ddf){return BPromise[_0x9880('0x26')](_0x1b9ddf);}return _0x384077['save']();};}function saveUpdates(_0x1a5e72,_0x18dce5){return function(_0x49620c){if(_0x49620c){return _0x49620c[_0x9880('0x27')](_0x1a5e72)['then'](function(_0x5f1e8f){return _0x5f1e8f;});}return null;};}function removeEntity(_0x162766,_0x3235fb){return function(_0x42e673){if(_0x42e673){return _0x42e673[_0x9880('0x28')]()['then'](function(){_0x162766['status'](0xcc)[_0x9880('0x1d')]();});}};}function handleEntityNotFound(_0x5d7216,_0x391f48){return function(_0x5b94cd){if(!_0x5b94cd){_0x5d7216['sendStatus'](0x194);}return _0x5b94cd;};}function handleError(_0x5c4ac9,_0x1ae548){_0x1ae548=_0x1ae548||0x1f4;return function(_0xe883eb){logger[_0x9880('0x29')](_0xe883eb[_0x9880('0x2a')]);if(_0xe883eb[_0x9880('0x2b')]){delete _0xe883eb['name'];}_0x5c4ac9['status'](_0x1ae548)['send'](_0xe883eb);};}exports[_0x9880('0x2c')]=function(_0x4de96f,_0x21d4ef){var _0x1e9844={},_0x5697ff={},_0x396e42={'count':0x0,'rows':[]};var _0x3ea403=_['map'](db[_0x9880('0x2d')][_0x9880('0x2e')],function(_0x1232c0){return{'name':_0x1232c0[_0x9880('0x2f')],'type':_0x1232c0[_0x9880('0x30')]['key']};});_0x5697ff['model']=_['map'](_0x3ea403,'name');_0x5697ff[_0x9880('0x31')]=_[_0x9880('0x32')](_0x4de96f['query']);_0x5697ff[_0x9880('0x33')]=_[_0x9880('0x34')](_0x5697ff['model'],_0x5697ff[_0x9880('0x31')]);_0x1e9844[_0x9880('0x35')]=_[_0x9880('0x34')](_0x5697ff[_0x9880('0x36')],qs[_0x9880('0x37')](_0x4de96f[_0x9880('0x31')][_0x9880('0x37')]));_0x1e9844['attributes']=_0x1e9844[_0x9880('0x35')]['length']?_0x1e9844[_0x9880('0x35')]:_0x5697ff[_0x9880('0x36')];if(!_0x4de96f[_0x9880('0x31')][_0x9880('0x38')](_0x9880('0x39'))){_0x1e9844[_0x9880('0x22')]=qs[_0x9880('0x22')](_0x4de96f[_0x9880('0x31')][_0x9880('0x22')]);_0x1e9844[_0x9880('0x20')]=qs[_0x9880('0x20')](_0x4de96f[_0x9880('0x31')][_0x9880('0x20')]);}_0x1e9844[_0x9880('0x3a')]=qs[_0x9880('0x3b')](_0x4de96f[_0x9880('0x31')][_0x9880('0x3b')]);_0x1e9844[_0x9880('0x3c')]=qs[_0x9880('0x33')](_[_0x9880('0x3d')](_0x4de96f['query'],_0x5697ff['filters']),_0x3ea403);if(_0x4de96f[_0x9880('0x31')][_0x9880('0x3e')]){_0x1e9844['where']=_[_0x9880('0x3f')](_0x1e9844[_0x9880('0x3c')],{'$or':_[_0x9880('0x40')](_0x3ea403,function(_0x25461a){if(_0x25461a['type']!=='VIRTUAL'){var _0x1bd918={};_0x1bd918[_0x25461a['name']]={'$like':'%'+_0x4de96f[_0x9880('0x31')][_0x9880('0x3e')]+'%'};return _0x1bd918;}})});}_0x1e9844=_['merge']({},_0x1e9844,_0x4de96f[_0x9880('0x41')]);var _0x40ab46={'where':_0x1e9844[_0x9880('0x3c')]};return db[_0x9880('0x2d')]['count'](_0x40ab46)['then'](function(_0x57132f){_0x396e42['count']=_0x57132f;if(_0x4de96f[_0x9880('0x31')]['includeAll']){_0x1e9844['include']=[{'all':!![]}];}return db['Migration'][_0x9880('0x42')](_0x1e9844);})[_0x9880('0x43')](function(_0x38fdf2){_0x396e42['rows']=_0x38fdf2;return _0x396e42;})[_0x9880('0x43')](respondWithFilteredResult(_0x21d4ef,_0x1e9844))[_0x9880('0x44')](handleError(_0x21d4ef,null));}; \ No newline at end of file +var _0xdbb3=['hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','rows','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','Content-Range','save','destroy','error','name','status','send','index','Migration','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','length'];(function(_0x11304d,_0x4352b5){var _0x4475f2=function(_0x4c78f8){while(--_0x4c78f8){_0x11304d['push'](_0x11304d['shift']());}};_0x4475f2(++_0x4352b5);}(_0xdbb3,0x1dc));var _0x3dbb=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xdbb3[_0x397cfb];return _0x15fed9;};'use strict';var emlformat=require(_0x3dbb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3dbb('0x1'));var jsonpatch=require(_0x3dbb('0x2'));var rp=require(_0x3dbb('0x3'));var moment=require(_0x3dbb('0x4'));var BPromise=require(_0x3dbb('0x5'));var Mustache=require(_0x3dbb('0x6'));var util=require(_0x3dbb('0x7'));var path=require(_0x3dbb('0x8'));var sox=require(_0x3dbb('0x9'));var csv=require(_0x3dbb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3dbb('0xb'));var _=require(_0x3dbb('0xc'));var squel=require('squel');var crypto=require(_0x3dbb('0xd'));var jsforce=require(_0x3dbb('0xe'));var deskjs=require(_0x3dbb('0xf'));var toCsv=require(_0x3dbb('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3dbb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3dbb('0x11'));var as=require(_0x3dbb('0x12'));var hardwareService=require(_0x3dbb('0x13'));var logger=require(_0x3dbb('0x14'))(_0x3dbb('0x15'));var utils=require(_0x3dbb('0x16'));var config=require(_0x3dbb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3dbb('0x18'))['db'];function respondWithStatusCode(_0x16821e,_0x238c41){_0x238c41=_0x238c41||0xcc;return function(_0x1be731){if(_0x1be731){return _0x16821e[_0x3dbb('0x19')](_0x238c41);}return _0x16821e['status'](_0x238c41)[_0x3dbb('0x1a')]();};}function respondWithResult(_0x3b8d0d,_0xe49a38){_0xe49a38=_0xe49a38||0xc8;return function(_0x5720f9){if(_0x5720f9){return _0x3b8d0d['status'](_0xe49a38)[_0x3dbb('0x1b')](_0x5720f9);}};}function respondWithFilteredResult(_0x2182f2,_0x14e7d0){return function(_0x3f9a24){if(_0x3f9a24){var _0x5d34f4=typeof _0x14e7d0['offset']===_0x3dbb('0x1c')&&typeof _0x14e7d0[_0x3dbb('0x1d')]==='undefined';var _0x5ca2f1=_0x3f9a24[_0x3dbb('0x1e')];var _0x2db58c=_0x5d34f4?0x0:_0x14e7d0[_0x3dbb('0x1f')];var _0x2e93f7=_0x5d34f4?_0x3f9a24[_0x3dbb('0x1e')]:_0x14e7d0[_0x3dbb('0x1f')]+_0x14e7d0[_0x3dbb('0x1d')];var _0x5ddc6a;if(_0x2e93f7>=_0x5ca2f1){_0x2e93f7=_0x5ca2f1;_0x5ddc6a=0xc8;}else{_0x5ddc6a=0xce;}_0x2182f2['status'](_0x5ddc6a);return _0x2182f2['set'](_0x3dbb('0x20'),_0x2db58c+'-'+_0x2e93f7+'/'+_0x5ca2f1)[_0x3dbb('0x1b')](_0x3f9a24);}return null;};}function patchUpdates(_0x43fe82){return function(_0x22921f){try{jsonpatch['apply'](_0x22921f,_0x43fe82,!![]);}catch(_0x12f8b7){return BPromise['reject'](_0x12f8b7);}return _0x22921f[_0x3dbb('0x21')]();};}function saveUpdates(_0x16a267,_0x41712d){return function(_0x15c4f1){if(_0x15c4f1){return _0x15c4f1['update'](_0x16a267)['then'](function(_0x2b4a38){return _0x2b4a38;});}return null;};}function removeEntity(_0x58ba6b,_0x4f79ae){return function(_0x37b13b){if(_0x37b13b){return _0x37b13b[_0x3dbb('0x22')]()['then'](function(){_0x58ba6b['status'](0xcc)[_0x3dbb('0x1a')]();});}};}function handleEntityNotFound(_0x5374d2,_0x1069ba){return function(_0x68b288){if(!_0x68b288){_0x5374d2[_0x3dbb('0x19')](0x194);}return _0x68b288;};}function handleError(_0x93cd8f,_0x3addcb){_0x3addcb=_0x3addcb||0x1f4;return function(_0x2bda24){logger[_0x3dbb('0x23')](_0x2bda24['stack']);if(_0x2bda24[_0x3dbb('0x24')]){delete _0x2bda24[_0x3dbb('0x24')];}_0x93cd8f[_0x3dbb('0x25')](_0x3addcb)[_0x3dbb('0x26')](_0x2bda24);};}exports[_0x3dbb('0x27')]=function(_0x2b9f49,_0x4f3c4f){var _0x44865b={},_0x25f83e={},_0xa1ade4={'count':0x0,'rows':[]};var _0x231e23=_['map'](db[_0x3dbb('0x28')][_0x3dbb('0x29')],function(_0x411dc7){return{'name':_0x411dc7[_0x3dbb('0x2a')],'type':_0x411dc7[_0x3dbb('0x2b')][_0x3dbb('0x2c')]};});_0x25f83e[_0x3dbb('0x2d')]=_[_0x3dbb('0x2e')](_0x231e23,'name');_0x25f83e[_0x3dbb('0x2f')]=_['keys'](_0x2b9f49[_0x3dbb('0x2f')]);_0x25f83e[_0x3dbb('0x30')]=_['intersection'](_0x25f83e[_0x3dbb('0x2d')],_0x25f83e['query']);_0x44865b[_0x3dbb('0x31')]=_['intersection'](_0x25f83e[_0x3dbb('0x2d')],qs[_0x3dbb('0x32')](_0x2b9f49[_0x3dbb('0x2f')][_0x3dbb('0x32')]));_0x44865b[_0x3dbb('0x31')]=_0x44865b['attributes'][_0x3dbb('0x33')]?_0x44865b[_0x3dbb('0x31')]:_0x25f83e[_0x3dbb('0x2d')];if(!_0x2b9f49[_0x3dbb('0x2f')][_0x3dbb('0x34')](_0x3dbb('0x35'))){_0x44865b[_0x3dbb('0x1d')]=qs[_0x3dbb('0x1d')](_0x2b9f49[_0x3dbb('0x2f')][_0x3dbb('0x1d')]);_0x44865b[_0x3dbb('0x1f')]=qs[_0x3dbb('0x1f')](_0x2b9f49[_0x3dbb('0x2f')][_0x3dbb('0x1f')]);}_0x44865b[_0x3dbb('0x36')]=qs[_0x3dbb('0x37')](_0x2b9f49[_0x3dbb('0x2f')][_0x3dbb('0x37')]);_0x44865b['where']=qs[_0x3dbb('0x30')](_[_0x3dbb('0x38')](_0x2b9f49[_0x3dbb('0x2f')],_0x25f83e['filters']),_0x231e23);if(_0x2b9f49[_0x3dbb('0x2f')][_0x3dbb('0x39')]){_0x44865b[_0x3dbb('0x3a')]=_[_0x3dbb('0x3b')](_0x44865b[_0x3dbb('0x3a')],{'$or':_[_0x3dbb('0x2e')](_0x231e23,function(_0x112d01){if(_0x112d01['type']!==_0x3dbb('0x3c')){var _0x3ee252={};_0x3ee252[_0x112d01['name']]={'$like':'%'+_0x2b9f49[_0x3dbb('0x2f')][_0x3dbb('0x39')]+'%'};return _0x3ee252;}})});}_0x44865b=_[_0x3dbb('0x3b')]({},_0x44865b,_0x2b9f49[_0x3dbb('0x3d')]);var _0x4d65e8={'where':_0x44865b[_0x3dbb('0x3a')]};return db['Migration'][_0x3dbb('0x1e')](_0x4d65e8)[_0x3dbb('0x3e')](function(_0xe3bb98){_0xa1ade4[_0x3dbb('0x1e')]=_0xe3bb98;if(_0x2b9f49['query'][_0x3dbb('0x3f')]){_0x44865b[_0x3dbb('0x40')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x44865b);})[_0x3dbb('0x3e')](function(_0x192774){_0xa1ade4[_0x3dbb('0x41')]=_0x192774;return _0xa1ade4;})[_0x3dbb('0x3e')](respondWithFilteredResult(_0x4f3c4f,_0x44865b))['catch'](handleError(_0x4f3c4f,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 4895a43..0f48118 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 _0xf9ef=['rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','util','../../config/logger','api','moment','bluebird','path'];(function(_0x1f058b,_0x4a47cf){var _0x5c5232=function(_0x11eee8){while(--_0x11eee8){_0x1f058b['push'](_0x1f058b['shift']());}};_0x5c5232(++_0x4a47cf);}(_0xf9ef,0x10b));var _0xff9e=function(_0xbeaf26,_0x4bd9a7){_0xbeaf26=_0xbeaf26-0x0;var _0x53d7b4=_0xf9ef[_0xbeaf26];return _0x53d7b4;};'use strict';var _=require('lodash');var util=require(_0xff9e('0x0'));var logger=require(_0xff9e('0x1'))(_0xff9e('0x2'));var moment=require(_0xff9e('0x3'));var BPromise=require(_0xff9e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xff9e('0x5'));var rimraf=require(_0xff9e('0x6'));var config=require(_0xff9e('0x7'));var attributes=require(_0xff9e('0x8'));module[_0xff9e('0x9')]=function(_0x1abd43,_0x19f926){return _0x1abd43[_0xff9e('0xa')](_0xff9e('0xb'),attributes,{'tableName':_0xff9e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae4f=['bluebird','request-promise','path','rimraf','./migration.attributes','exports','Migration','migrations','lodash','util','../../config/logger','api','moment'];(function(_0x895213,_0x46c7b0){var _0x4c2c65=function(_0x176f40){while(--_0x176f40){_0x895213['push'](_0x895213['shift']());}};_0x4c2c65(++_0x46c7b0);}(_0xae4f,0x1e9));var _0xfae4=function(_0x11ef08,_0x5d550f){_0x11ef08=_0x11ef08-0x0;var _0x5e7855=_0xae4f[_0x11ef08];return _0x5e7855;};'use strict';var _=require(_0xfae4('0x0'));var util=require(_0xfae4('0x1'));var logger=require(_0xfae4('0x2'))(_0xfae4('0x3'));var moment=require(_0xfae4('0x4'));var BPromise=require(_0xfae4('0x5'));var rp=require(_0xfae4('0x6'));var fs=require('fs');var path=require(_0xfae4('0x7'));var rimraf=require(_0xfae4('0x8'));var config=require('../../config/environment');var attributes=require(_0xfae4('0x9'));module[_0xfae4('0xa')]=function(_0x26eec6,_0x190583){return _0x26eec6['define'](_0xfae4('0xb'),attributes,{'tableName':_0xfae4('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 418eb31..65c5aa7 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 _0x7eb9=['Migration,\x20%s,\x20%s','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info'];(function(_0x62ae2a,_0x5c01f2){var _0x390d90=function(_0x5e9a78){while(--_0x5e9a78){_0x62ae2a['push'](_0x62ae2a['shift']());}};_0x390d90(++_0x5c01f2);}(_0x7eb9,0xd9));var _0x97eb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7eb9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x97eb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x97eb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97eb('0x2'));var db=require(_0x97eb('0x3'))['db'];var utils=require(_0x97eb('0x4'));var logger=require(_0x97eb('0x5'))('rpc');var config=require(_0x97eb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x97eb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44595e,_0x4a8f26,_0x5227f4){return new BPromise(function(_0x429ed6,_0x5af402){return client[_0x97eb('0x8')](_0x44595e,_0x5227f4)[_0x97eb('0x9')](function(_0x10eba2){logger[_0x97eb('0xa')](_0x97eb('0xb'),_0x4a8f26,'request\x20sent');logger['debug'](_0x97eb('0xc'),_0x4a8f26,_0x97eb('0xd'),JSON[_0x97eb('0xe')](_0x10eba2));if(_0x10eba2[_0x97eb('0xf')]){if(_0x10eba2[_0x97eb('0xf')][_0x97eb('0x10')]===0x1f4){logger[_0x97eb('0xf')](_0x97eb('0xb'),_0x4a8f26,_0x10eba2[_0x97eb('0xf')][_0x97eb('0x11')]);return _0x5af402(_0x10eba2[_0x97eb('0xf')][_0x97eb('0x11')]);}logger[_0x97eb('0xf')](_0x97eb('0xb'),_0x4a8f26,_0x10eba2['error'][_0x97eb('0x11')]);return _0x429ed6(_0x10eba2[_0x97eb('0xf')][_0x97eb('0x11')]);}else{logger['info'](_0x97eb('0xb'),_0x4a8f26,_0x97eb('0xd'));_0x429ed6(_0x10eba2[_0x97eb('0x12')]['message']);}})['catch'](function(_0x42efe3){logger[_0x97eb('0xf')](_0x97eb('0xb'),_0x4a8f26,_0x42efe3);_0x5af402(_0x42efe3);});});} \ No newline at end of file +var _0xfc65=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x463ae2,_0x572a04){var _0x3c842e=function(_0x2ad2b8){while(--_0x2ad2b8){_0x463ae2['push'](_0x463ae2['shift']());}};_0x3c842e(++_0x572a04);}(_0xfc65,0x1b4));var _0x5fc6=function(_0x1b3e3e,_0x4d76af){_0x1b3e3e=_0x1b3e3e-0x0;var _0x5f2b6b=_0xfc65[_0x1b3e3e];return _0x5f2b6b;};'use strict';var _=require(_0x5fc6('0x0'));var util=require(_0x5fc6('0x1'));var moment=require(_0x5fc6('0x2'));var BPromise=require(_0x5fc6('0x3'));var rs=require(_0x5fc6('0x4'));var fs=require('fs');var Redis=require(_0x5fc6('0x5'));var db=require(_0x5fc6('0x6'))['db'];var utils=require(_0x5fc6('0x7'));var logger=require(_0x5fc6('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5fc6('0x9'));var client=jayson[_0x5fc6('0xa')][_0x5fc6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26d89e,_0x1360cb,_0x5c93f7){return new BPromise(function(_0x5a47c1,_0x467f6b){return client[_0x5fc6('0xc')](_0x26d89e,_0x5c93f7)[_0x5fc6('0xd')](function(_0x52f28c){logger[_0x5fc6('0xe')](_0x5fc6('0xf'),_0x1360cb,'request\x20sent');logger[_0x5fc6('0x10')](_0x5fc6('0x11'),_0x1360cb,'request\x20sent',JSON['stringify'](_0x52f28c));if(_0x52f28c[_0x5fc6('0x12')]){if(_0x52f28c[_0x5fc6('0x12')][_0x5fc6('0x13')]===0x1f4){logger['error'](_0x5fc6('0xf'),_0x1360cb,_0x52f28c[_0x5fc6('0x12')][_0x5fc6('0x14')]);return _0x467f6b(_0x52f28c[_0x5fc6('0x12')][_0x5fc6('0x14')]);}logger[_0x5fc6('0x12')]('Migration,\x20%s,\x20%s',_0x1360cb,_0x52f28c[_0x5fc6('0x12')]['message']);return _0x5a47c1(_0x52f28c[_0x5fc6('0x12')][_0x5fc6('0x14')]);}else{logger[_0x5fc6('0xe')](_0x5fc6('0xf'),_0x1360cb,'request\x20sent');_0x5a47c1(_0x52f28c[_0x5fc6('0x15')]['message']);}})[_0x5fc6('0x16')](function(_0x585f13){logger['error'](_0x5fc6('0xf'),_0x1360cb,_0x585f13);_0x467f6b(_0x585f13);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index f71cef8..824f821 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 _0x4b24=['../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x5de5a5,_0x25ba48){var _0x5d5bfa=function(_0x81d0f2){while(--_0x81d0f2){_0x5de5a5['push'](_0x5de5a5['shift']());}};_0x5d5bfa(++_0x25ba48);}(_0x4b24,0x8a));var _0x44b2=function(_0x48459a,_0x4773ff){_0x48459a=_0x48459a-0x0;var _0x31e404=_0x4b24[_0x48459a];return _0x31e404;};'use strict';var multer=require(_0x44b2('0x0'));var util=require(_0x44b2('0x1'));var path=require(_0x44b2('0x2'));var timeout=require(_0x44b2('0x3'));var express=require(_0x44b2('0x4'));var router=express['Router']();var fs_extra=require(_0x44b2('0x5'));var auth=require(_0x44b2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x44b2('0x7'));var controller=require('./network.controller');router[_0x44b2('0x8')]('/',auth['isAuthenticated'](),controller[_0x44b2('0x9')]);router[_0x44b2('0x8')](_0x44b2('0xa'),auth[_0x44b2('0xb')](),controller['show']);router[_0x44b2('0xc')]('/',auth[_0x44b2('0xb')](),controller['create']);router[_0x44b2('0xd')](_0x44b2('0xa'),auth[_0x44b2('0xb')](),controller[_0x44b2('0xe')]);router[_0x44b2('0xf')](_0x44b2('0xa'),auth[_0x44b2('0xb')](),controller[_0x44b2('0x10')]);module[_0x44b2('0x11')]=router; \ No newline at end of file +var _0xe14a=['isAuthenticated','index','/:id','show','post','create','update','delete','Router','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','get'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe14a,0x94));var _0xae14=function(_0x428543,_0x5de030){_0x428543=_0x428543-0x0;var _0x5e4468=_0xe14a[_0x428543];return _0x5e4468;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xae14('0x0')]();var fs_extra=require(_0xae14('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0xae14('0x2'));var config=require(_0xae14('0x3'));var controller=require(_0xae14('0x4'));router[_0xae14('0x5')]('/',auth[_0xae14('0x6')](),controller[_0xae14('0x7')]);router[_0xae14('0x5')](_0xae14('0x8'),auth[_0xae14('0x6')](),controller[_0xae14('0x9')]);router[_0xae14('0xa')]('/',auth[_0xae14('0x6')](),controller[_0xae14('0xb')]);router['put']('/:id',auth[_0xae14('0x6')](),controller[_0xae14('0xc')]);router[_0xae14('0xd')](_0xae14('0x8'),auth[_0xae14('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 6be9193..b3066af 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 _0x5efc=['stun','turn','STRING','sequelize','ENUM','externip'];(function(_0x3a1c2e,_0x58c14d){var _0x1096cd=function(_0x5c385e){while(--_0x5c385e){_0x3a1c2e['push'](_0x3a1c2e['shift']());}};_0x1096cd(++_0x58c14d);}(_0x5efc,0x11d));var _0xc5ef=function(_0xa9b9f7,_0x5b0151){_0xa9b9f7=_0xa9b9f7-0x0;var _0x4637b2=_0x5efc[_0xa9b9f7];return _0x4637b2;};'use strict';var Sequelize=require(_0xc5ef('0x0'));module['exports']={'type':{'type':Sequelize[_0xc5ef('0x1')]('localnet',_0xc5ef('0x2'),_0xc5ef('0x3'),_0xc5ef('0x4'))},'value':{'type':Sequelize[_0xc5ef('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xadc6=['STRING','sequelize','ENUM','externip','stun','turn'];(function(_0x583922,_0x1af506){var _0x46d2b9=function(_0x31630f){while(--_0x31630f){_0x583922['push'](_0x583922['shift']());}};_0x46d2b9(++_0x1af506);}(_0xadc6,0x1ed));var _0x6adc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xadc6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6adc('0x0'));module['exports']={'type':{'type':Sequelize[_0x6adc('0x1')]('localnet',_0x6adc('0x2'),_0x6adc('0x3'),_0x6adc('0x4'))},'value':{'type':Sequelize[_0x6adc('0x5')]},'username':{'type':Sequelize[_0x6adc('0x5')]},'password':{'type':Sequelize[_0x6adc('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 5a10602..8dc52d9 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 _0x9a91=['includeAll','include','findAll','rows','show','params','keys','length','find','create','body','readFileSync','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','join','root','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','server/files/templates/turn_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','STUN','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','undefined','count','offset','limit','set','Content-Range','json','update','destroy','end','stack','name','send','index','map','Network','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','order','sort','where','filter','VIRTUAL','merge'];(function(_0x559f6c,_0x4b6a27){var _0x1ca9b1=function(_0x3b22f6){while(--_0x3b22f6){_0x559f6c['push'](_0x559f6c['shift']());}};_0x1ca9b1(++_0x4b6a27);}(_0x9a91,0x1d2));var _0x19a9=function(_0x5f559a,_0x2780ff){_0x5f559a=_0x5f559a-0x0;var _0x3d287=_0x9a91[_0x5f559a];return _0x3d287;};'use strict';var util=require(_0x19a9('0x0'));var path=require(_0x19a9('0x1'));var ejs=require(_0x19a9('0x2'));var fs=require('fs');var _=require(_0x19a9('0x3'));var qs=require(_0x19a9('0x4'));var logger=require(_0x19a9('0x5'))(_0x19a9('0x6'));var config=require(_0x19a9('0x7'));var db=require(_0x19a9('0x8'))['db'];var jayson=require(_0x19a9('0x9'));var client=jayson[_0x19a9('0xa')][_0x19a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22159d,_0x31c86e,_0x530ae5,_0x4bea8e){return new Promise(function(_0x4aedb8,_0x244ba0){var _0x203282=_0x4bea8e||client;return _0x203282[_0x19a9('0xc')](_0x22159d,_0x530ae5)[_0x19a9('0xd')](function(_0x2aca6f){logger['info'](_0x19a9('0xe'),_0x31c86e,_0x19a9('0xf'));logger[_0x19a9('0x10')]('Network,\x20%s,\x20%s,\x20%s',_0x31c86e,_0x19a9('0xf'),JSON[_0x19a9('0x11')](_0x2aca6f));if(_0x2aca6f[_0x19a9('0x12')]){if(_0x2aca6f[_0x19a9('0x12')][_0x19a9('0x13')]===0x1f4){logger['error'](_0x19a9('0xe'),_0x31c86e,_0x2aca6f[_0x19a9('0x12')][_0x19a9('0x14')]);return _0x244ba0(_0x2aca6f[_0x19a9('0x12')][_0x19a9('0x14')]);}logger[_0x19a9('0x12')](_0x19a9('0xe'),_0x31c86e,_0x2aca6f[_0x19a9('0x12')][_0x19a9('0x14')]);return _0x4aedb8(_0x2aca6f[_0x19a9('0x12')]['message']);}else{logger[_0x19a9('0x15')](_0x19a9('0xe'),_0x31c86e,_0x19a9('0xf'));_0x4aedb8(_0x2aca6f[_0x19a9('0x16')][_0x19a9('0x14')]);}})[_0x19a9('0x17')](function(_0x40aee2){logger[_0x19a9('0x12')]('Network,\x20%s,\x20%s',_0x31c86e,_0x40aee2);_0x244ba0(_0x40aee2);});});}function respondWithResult(_0x262a1d,_0x4c8a02){_0x4c8a02=_0x4c8a02||0xc8;return function(_0xd86324){if(_0xd86324){return _0x262a1d[_0x19a9('0x18')](_0x4c8a02)['json'](_0xd86324);}};}function respondWithFilteredResult(_0x562c48,_0x556fd1){return function(_0x3e66e9){if(_0x3e66e9){var _0x16d1b5=typeof _0x556fd1['offset']===_0x19a9('0x19')&&typeof _0x556fd1['limit']==='undefined';var _0x8ff61f=_0x3e66e9[_0x19a9('0x1a')];var _0x23fcac=_0x16d1b5?0x0:_0x556fd1[_0x19a9('0x1b')];var _0x1e47d8=_0x16d1b5?_0x3e66e9[_0x19a9('0x1a')]:_0x556fd1[_0x19a9('0x1b')]+_0x556fd1[_0x19a9('0x1c')];var _0x5c2f0a;if(_0x1e47d8>=_0x8ff61f){_0x1e47d8=_0x8ff61f;_0x5c2f0a=0xc8;}else{_0x5c2f0a=0xce;}_0x562c48[_0x19a9('0x18')](_0x5c2f0a);return _0x562c48[_0x19a9('0x1d')](_0x19a9('0x1e'),_0x23fcac+'-'+_0x1e47d8+'/'+_0x8ff61f)[_0x19a9('0x1f')](_0x3e66e9);}return null;};}function saveUpdates(_0x543011){return function(_0x198956){if(_0x198956){return _0x198956[_0x19a9('0x20')](_0x543011)['then'](function(_0x4a77ab){return _0x4a77ab;});}return null;};}function removeEntity(_0x3bbd2b){return function(_0x492a2c){if(_0x492a2c){return _0x492a2c[_0x19a9('0x21')]()[_0x19a9('0xd')](function(){_0x3bbd2b[_0x19a9('0x18')](0xcc)[_0x19a9('0x22')]();});}};}function handleEntityNotFound(_0x52d7f6){return function(_0x5c9228){if(!_0x5c9228){_0x52d7f6['sendStatus'](0x194);}return _0x5c9228;};}function handleError(_0x5bb57f,_0x3d44fd){_0x3d44fd=_0x3d44fd||0x1f4;return function(_0x384ee9){logger[_0x19a9('0x12')](_0x384ee9[_0x19a9('0x23')]);if(_0x384ee9[_0x19a9('0x24')]){delete _0x384ee9[_0x19a9('0x24')];}_0x5bb57f[_0x19a9('0x18')](_0x3d44fd)[_0x19a9('0x25')](_0x384ee9);};}exports[_0x19a9('0x26')]=function(_0x5ad971,_0x75235a){var _0x24ab37={},_0x210045={},_0x352f96={'count':0x0,'rows':[]};var _0xdeef3a=_[_0x19a9('0x27')](db[_0x19a9('0x28')][_0x19a9('0x29')],function(_0x5362e4){return{'name':_0x5362e4[_0x19a9('0x2a')],'type':_0x5362e4[_0x19a9('0x2b')]['key']};});_0x210045[_0x19a9('0x2c')]=_[_0x19a9('0x27')](_0xdeef3a,'name');_0x210045[_0x19a9('0x2d')]=_['keys'](_0x5ad971[_0x19a9('0x2d')]);_0x210045[_0x19a9('0x2e')]=_[_0x19a9('0x2f')](_0x210045[_0x19a9('0x2c')],_0x210045[_0x19a9('0x2d')]);_0x24ab37[_0x19a9('0x30')]=_[_0x19a9('0x2f')](_0x210045[_0x19a9('0x2c')],qs['fields'](_0x5ad971[_0x19a9('0x2d')][_0x19a9('0x31')]));_0x24ab37[_0x19a9('0x30')]=_0x24ab37['attributes']['length']?_0x24ab37[_0x19a9('0x30')]:_0x210045['model'];if(!_0x5ad971[_0x19a9('0x2d')]['hasOwnProperty']('nolimit')){_0x24ab37[_0x19a9('0x1c')]=qs['limit'](_0x5ad971[_0x19a9('0x2d')][_0x19a9('0x1c')]);_0x24ab37[_0x19a9('0x1b')]=qs[_0x19a9('0x1b')](_0x5ad971[_0x19a9('0x2d')][_0x19a9('0x1b')]);}_0x24ab37[_0x19a9('0x32')]=qs[_0x19a9('0x33')](_0x5ad971['query'][_0x19a9('0x33')]);_0x24ab37[_0x19a9('0x34')]=qs[_0x19a9('0x2e')](_['pick'](_0x5ad971['query'],_0x210045[_0x19a9('0x2e')]),_0xdeef3a);if(_0x5ad971[_0x19a9('0x2d')][_0x19a9('0x35')]){_0x24ab37['where']=_['merge'](_0x24ab37[_0x19a9('0x34')],{'$or':_['map'](_0xdeef3a,function(_0x303381){if(_0x303381[_0x19a9('0x2b')]!==_0x19a9('0x36')){var _0x41a71d={};_0x41a71d[_0x303381['name']]={'$like':'%'+_0x5ad971['query'][_0x19a9('0x35')]+'%'};return _0x41a71d;}})});}_0x24ab37=_[_0x19a9('0x37')]({},_0x24ab37,_0x5ad971['options']);var _0x564cba={'where':_0x24ab37[_0x19a9('0x34')]};return db[_0x19a9('0x28')]['count'](_0x564cba)[_0x19a9('0xd')](function(_0x2a5093){_0x352f96['count']=_0x2a5093;if(_0x5ad971[_0x19a9('0x2d')][_0x19a9('0x38')]){_0x24ab37[_0x19a9('0x39')]=[{'all':!![]}];}return db[_0x19a9('0x28')][_0x19a9('0x3a')](_0x24ab37);})['then'](function(_0x182d78){_0x352f96[_0x19a9('0x3b')]=_0x182d78;return _0x352f96;})['then'](respondWithFilteredResult(_0x75235a,_0x24ab37))['catch'](handleError(_0x75235a,null));};exports[_0x19a9('0x3c')]=function(_0x54a3f2,_0x42242f){var _0x572ad0={'raw':!![],'where':{'id':_0x54a3f2[_0x19a9('0x3d')]['id']}},_0x34c88b={};_0x34c88b['model']=_['keys'](db[_0x19a9('0x28')]['rawAttributes']);_0x34c88b[_0x19a9('0x2d')]=_[_0x19a9('0x3e')](_0x54a3f2[_0x19a9('0x2d')]);_0x34c88b[_0x19a9('0x2e')]=_['intersection'](_0x34c88b['model'],_0x34c88b[_0x19a9('0x2d')]);_0x572ad0[_0x19a9('0x30')]=_[_0x19a9('0x2f')](_0x34c88b[_0x19a9('0x2c')],qs[_0x19a9('0x31')](_0x54a3f2[_0x19a9('0x2d')]['fields']));_0x572ad0[_0x19a9('0x30')]=_0x572ad0['attributes'][_0x19a9('0x3f')]?_0x572ad0[_0x19a9('0x30')]:_0x34c88b[_0x19a9('0x2c')];if(_0x54a3f2[_0x19a9('0x2d')]['includeAll']){_0x572ad0[_0x19a9('0x39')]=[{'all':!![]}];}_0x572ad0=_[_0x19a9('0x37')]({},_0x572ad0,_0x54a3f2['options']);return db[_0x19a9('0x28')][_0x19a9('0x40')](_0x572ad0)['then'](handleEntityNotFound(_0x42242f,null))[_0x19a9('0xd')](respondWithResult(_0x42242f,null))['catch'](handleError(_0x42242f,null));};exports[_0x19a9('0x41')]=function(_0x29829c,_0xac9ee5){var _0x13cf8f;return db[_0x19a9('0x28')]['create'](_0x29829c[_0x19a9('0x42')],{'raw':!![]})[_0x19a9('0xd')](function(_0xe52e1e){_0x13cf8f=_0xe52e1e;return db[_0x19a9('0x28')]['findAll']({'where':{'type':_0x29829c[_0x19a9('0x42')][_0x19a9('0x2b')]},'raw':!![]});})[_0x19a9('0xd')](function(_0x758d37){if(_0x13cf8f[_0x19a9('0x2b')]['toUpperCase']()=='STUN'){var _0x54b1e9=fs[_0x19a9('0x43')](path['join'](config['root'],_0x19a9('0x44')),_0x19a9('0x45'));var _0x1df3a4=ejs['render'](_0x54b1e9,{'networks':_0x758d37||[]});fs[_0x19a9('0x46')](_0x19a9('0x47'),_0x1df3a4);return respondWithRpcPromise(_0x19a9('0x48'),_0x19a9('0x41'),{'module':_0x19a9('0x49')});}else if(_0x13cf8f[_0x19a9('0x2b')][_0x19a9('0x4a')]()==_0x19a9('0x4b')){var _0x3d0f60=fs[_0x19a9('0x43')](path[_0x19a9('0x4c')](config[_0x19a9('0x4d')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x8a4cb6=ejs[_0x19a9('0x4e')](_0x3d0f60,{'networks':_0x758d37||[]});fs[_0x19a9('0x46')](_0x19a9('0x4f'),_0x8a4cb6);return respondWithRpcPromise('Reload',_0x19a9('0x41'),{'module':_0x19a9('0x49')});}else{var _0x332510=fs[_0x19a9('0x43')](path[_0x19a9('0x4c')](config[_0x19a9('0x4d')],_0x19a9('0x50')),'utf8');var _0x15dc2f=ejs[_0x19a9('0x4e')](_0x332510,{'networks':_0x758d37||[]});fs[_0x19a9('0x46')](util[_0x19a9('0x51')]('/etc/asterisk/sip_xcally_%s.conf',_0x29829c[_0x19a9('0x42')]['type'][_0x19a9('0x52')]()),_0x15dc2f);return respondWithRpcPromise(_0x19a9('0x48'),_0x19a9('0x41'),{'module':_0x19a9('0x53')});}})[_0x19a9('0xd')](function(){return _0x13cf8f;})[_0x19a9('0xd')](respondWithResult(_0xac9ee5,0xc9))[_0x19a9('0x17')](handleError(_0xac9ee5,null));};exports[_0x19a9('0x20')]=function(_0x1365d2,_0x44fa14){var _0x4f2787;return db[_0x19a9('0x28')][_0x19a9('0x40')]({'where':{'id':_0x1365d2[_0x19a9('0x3d')]['id']}})[_0x19a9('0xd')](handleEntityNotFound(_0x44fa14,null))[_0x19a9('0xd')](saveUpdates(_0x1365d2[_0x19a9('0x42')],null))['then'](function(_0x23c935){if(_0x23c935){_0x4f2787=_0x23c935;return db[_0x19a9('0x28')]['findAll']({'where':{'type':_0x4f2787[_0x19a9('0x2b')]},'raw':!![]});}return null;})[_0x19a9('0xd')](function(_0x150e87){if(_0x4f2787['type'][_0x19a9('0x4a')]()=='STUN'){var _0xc43839=fs[_0x19a9('0x43')](path[_0x19a9('0x4c')](config[_0x19a9('0x4d')],_0x19a9('0x44')),'utf8');var _0x45180b=ejs[_0x19a9('0x4e')](_0xc43839,{'networks':_0x150e87||[]});fs['writeFileSync'](_0x19a9('0x47'),_0x45180b);return respondWithRpcPromise(_0x19a9('0x48'),_0x19a9('0x20'),{'module':_0x19a9('0x49')});}else if(_0x4f2787[_0x19a9('0x2b')][_0x19a9('0x4a')]()=='TURN'){var _0x53446a=fs[_0x19a9('0x43')](path[_0x19a9('0x4c')](config[_0x19a9('0x4d')],_0x19a9('0x54')),_0x19a9('0x45'));var _0x51bc91=ejs[_0x19a9('0x4e')](_0x53446a,{'networks':_0x150e87||[]});fs[_0x19a9('0x46')](_0x19a9('0x4f'),_0x51bc91);return respondWithRpcPromise('Reload',_0x19a9('0x20'),{'module':'res_stun_monitor.so'});}else{var _0x2a547e=fs['readFileSync'](path[_0x19a9('0x4c')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x14c8d4=ejs[_0x19a9('0x4e')](_0x2a547e,{'networks':_0x150e87||[]});fs['writeFileSync'](util[_0x19a9('0x51')](_0x19a9('0x55'),_0x1365d2[_0x19a9('0x42')][_0x19a9('0x2b')][_0x19a9('0x52')]()),_0x14c8d4);return respondWithRpcPromise(_0x19a9('0x48'),_0x19a9('0x20'),{'module':'chan_sip.so'});}})['then'](function(_0xb72289){if(_0xb72289){return _0x4f2787;}return null;})[_0x19a9('0xd')](respondWithResult(_0x44fa14,null))['catch'](handleError(_0x44fa14,null));};exports[_0x19a9('0x21')]=function(_0x5f4c49,_0x119284){var _0x32b4e8;return db['Network'][_0x19a9('0x40')]({'where':{'id':_0x5f4c49['params']['id']}})['then'](function(_0x35f760){_0x32b4e8=_0x35f760;return _0x35f760;})['then'](handleEntityNotFound(_0x119284,null))['then'](removeEntity(_0x119284,null))['then'](function(){if(_0x32b4e8){return db[_0x19a9('0x28')]['findAll']({'where':{'type':_0x32b4e8[_0x19a9('0x2b')]},'raw':!![]});}})[_0x19a9('0xd')](function(_0x30f9a2){if(_0x32b4e8[_0x19a9('0x2b')][_0x19a9('0x4a')]()==_0x19a9('0x56')){var _0x2320f2=fs[_0x19a9('0x43')](path['join'](config[_0x19a9('0x4d')],_0x19a9('0x44')),_0x19a9('0x45'));var _0x5b12ac=ejs['render'](_0x2320f2,{'networks':_0x30f9a2||[]});fs[_0x19a9('0x46')](_0x19a9('0x47'),_0x5b12ac);return respondWithRpcPromise(_0x19a9('0x48'),_0x19a9('0x21'),{'module':'res_stun_monitor.so'});}else if(_0x32b4e8[_0x19a9('0x2b')]['toUpperCase']()==_0x19a9('0x4b')){var _0x51f355=fs['readFileSync'](path[_0x19a9('0x4c')](config[_0x19a9('0x4d')],_0x19a9('0x54')),'utf8');var _0x219488=ejs['render'](_0x51f355,{'networks':_0x30f9a2||[]});fs['writeFileSync'](_0x19a9('0x4f'),_0x219488);return respondWithRpcPromise(_0x19a9('0x48'),_0x19a9('0x21'),{'module':_0x19a9('0x49')});}else{var _0x538b56=fs[_0x19a9('0x43')](path[_0x19a9('0x4c')](config['root'],_0x19a9('0x50')),_0x19a9('0x45'));var _0x278cf7=ejs[_0x19a9('0x4e')](_0x538b56,{'networks':_0x30f9a2||[]});fs[_0x19a9('0x46')](util[_0x19a9('0x51')]('/etc/asterisk/sip_xcally_%s.conf',_0x32b4e8[_0x19a9('0x2b')][_0x19a9('0x52')]()),_0x278cf7);return respondWithRpcPromise(_0x19a9('0x48'),'destroy',{'module':_0x19a9('0x53')});}})['catch'](handleError(_0x119284,null));}; \ No newline at end of file +var _0x7c25=['Network','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','findAll','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','Reload','TURN','root','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','/etc/asterisk/stun_xcally.conf','util','path','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','request','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Network,\x20%s,\x20%s','message','result','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','end','sendStatus','stack','name','send','index','map'];(function(_0x1ceceb,_0x4b74d3){var _0x5c541e=function(_0x5d36fa){while(--_0x5d36fa){_0x1ceceb['push'](_0x1ceceb['shift']());}};_0x5c541e(++_0x4b74d3);}(_0x7c25,0x138));var _0x57c2=function(_0x3cd40d,_0x220f25){_0x3cd40d=_0x3cd40d-0x0;var _0x572d71=_0x7c25[_0x3cd40d];return _0x572d71;};'use strict';var util=require(_0x57c2('0x0'));var path=require(_0x57c2('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x57c2('0x2'))('api');var config=require(_0x57c2('0x3'));var db=require(_0x57c2('0x4'))['db'];var jayson=require(_0x57c2('0x5'));var client=jayson[_0x57c2('0x6')][_0x57c2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1d8c97,_0xbafa2e,_0x41897b,_0x52de9b){return new Promise(function(_0x133386,_0x58b9b6){var _0x379758=_0x52de9b||client;return _0x379758[_0x57c2('0x8')](_0x1d8c97,_0x41897b)['then'](function(_0x24bcc2){logger['info']('Network,\x20%s,\x20%s',_0xbafa2e,'request\x20sent');logger[_0x57c2('0x9')](_0x57c2('0xa'),_0xbafa2e,_0x57c2('0xb'),JSON[_0x57c2('0xc')](_0x24bcc2));if(_0x24bcc2[_0x57c2('0xd')]){if(_0x24bcc2[_0x57c2('0xd')][_0x57c2('0xe')]===0x1f4){logger[_0x57c2('0xd')](_0x57c2('0xf'),_0xbafa2e,_0x24bcc2['error'][_0x57c2('0x10')]);return _0x58b9b6(_0x24bcc2[_0x57c2('0xd')][_0x57c2('0x10')]);}logger[_0x57c2('0xd')]('Network,\x20%s,\x20%s',_0xbafa2e,_0x24bcc2[_0x57c2('0xd')]['message']);return _0x133386(_0x24bcc2[_0x57c2('0xd')][_0x57c2('0x10')]);}else{logger['info']('Network,\x20%s,\x20%s',_0xbafa2e,_0x57c2('0xb'));_0x133386(_0x24bcc2[_0x57c2('0x11')][_0x57c2('0x10')]);}})['catch'](function(_0x44f820){logger['error'](_0x57c2('0xf'),_0xbafa2e,_0x44f820);_0x58b9b6(_0x44f820);});});}function respondWithResult(_0x4e1fc3,_0x3c1049){_0x3c1049=_0x3c1049||0xc8;return function(_0x5293cc){if(_0x5293cc){return _0x4e1fc3[_0x57c2('0x12')](_0x3c1049)['json'](_0x5293cc);}};}function respondWithFilteredResult(_0xb1a184,_0x3ee74c){return function(_0x3a3585){if(_0x3a3585){var _0x2be300=typeof _0x3ee74c[_0x57c2('0x13')]===_0x57c2('0x14')&&typeof _0x3ee74c[_0x57c2('0x15')]===_0x57c2('0x14');var _0x364291=_0x3a3585[_0x57c2('0x16')];var _0x475594=_0x2be300?0x0:_0x3ee74c[_0x57c2('0x13')];var _0x430bda=_0x2be300?_0x3a3585[_0x57c2('0x16')]:_0x3ee74c[_0x57c2('0x13')]+_0x3ee74c['limit'];var _0x5da671;if(_0x430bda>=_0x364291){_0x430bda=_0x364291;_0x5da671=0xc8;}else{_0x5da671=0xce;}_0xb1a184[_0x57c2('0x12')](_0x5da671);return _0xb1a184[_0x57c2('0x17')](_0x57c2('0x18'),_0x475594+'-'+_0x430bda+'/'+_0x364291)[_0x57c2('0x19')](_0x3a3585);}return null;};}function saveUpdates(_0x373e17){return function(_0x443357){if(_0x443357){return _0x443357[_0x57c2('0x1a')](_0x373e17)[_0x57c2('0x1b')](function(_0x5c85cf){return _0x5c85cf;});}return null;};}function removeEntity(_0x20c18a){return function(_0x1efd23){if(_0x1efd23){return _0x1efd23[_0x57c2('0x1c')]()[_0x57c2('0x1b')](function(){_0x20c18a[_0x57c2('0x12')](0xcc)[_0x57c2('0x1d')]();});}};}function handleEntityNotFound(_0x1eac77){return function(_0x51d7b3){if(!_0x51d7b3){_0x1eac77[_0x57c2('0x1e')](0x194);}return _0x51d7b3;};}function handleError(_0x59b6d8,_0x5db01b){_0x5db01b=_0x5db01b||0x1f4;return function(_0x5ddaaa){logger['error'](_0x5ddaaa[_0x57c2('0x1f')]);if(_0x5ddaaa[_0x57c2('0x20')]){delete _0x5ddaaa[_0x57c2('0x20')];}_0x59b6d8[_0x57c2('0x12')](_0x5db01b)[_0x57c2('0x21')](_0x5ddaaa);};}exports[_0x57c2('0x22')]=function(_0x5df6e1,_0x48588c){var _0x28946b={},_0x47baed={},_0x1e2743={'count':0x0,'rows':[]};var _0x18f927=_[_0x57c2('0x23')](db[_0x57c2('0x24')][_0x57c2('0x25')],function(_0x3050c0){return{'name':_0x3050c0[_0x57c2('0x26')],'type':_0x3050c0[_0x57c2('0x27')]['key']};});_0x47baed[_0x57c2('0x28')]=_[_0x57c2('0x23')](_0x18f927,_0x57c2('0x20'));_0x47baed[_0x57c2('0x29')]=_[_0x57c2('0x2a')](_0x5df6e1[_0x57c2('0x29')]);_0x47baed[_0x57c2('0x2b')]=_[_0x57c2('0x2c')](_0x47baed[_0x57c2('0x28')],_0x47baed[_0x57c2('0x29')]);_0x28946b[_0x57c2('0x2d')]=_[_0x57c2('0x2c')](_0x47baed['model'],qs[_0x57c2('0x2e')](_0x5df6e1[_0x57c2('0x29')][_0x57c2('0x2e')]));_0x28946b[_0x57c2('0x2d')]=_0x28946b[_0x57c2('0x2d')][_0x57c2('0x2f')]?_0x28946b[_0x57c2('0x2d')]:_0x47baed['model'];if(!_0x5df6e1[_0x57c2('0x29')][_0x57c2('0x30')](_0x57c2('0x31'))){_0x28946b['limit']=qs[_0x57c2('0x15')](_0x5df6e1[_0x57c2('0x29')]['limit']);_0x28946b[_0x57c2('0x13')]=qs[_0x57c2('0x13')](_0x5df6e1[_0x57c2('0x29')]['offset']);}_0x28946b['order']=qs[_0x57c2('0x32')](_0x5df6e1['query'][_0x57c2('0x32')]);_0x28946b[_0x57c2('0x33')]=qs['filters'](_[_0x57c2('0x34')](_0x5df6e1[_0x57c2('0x29')],_0x47baed[_0x57c2('0x2b')]),_0x18f927);if(_0x5df6e1[_0x57c2('0x29')]['filter']){_0x28946b['where']=_[_0x57c2('0x35')](_0x28946b['where'],{'$or':_['map'](_0x18f927,function(_0xcf08c8){if(_0xcf08c8['type']!==_0x57c2('0x36')){var _0xfa5aa1={};_0xfa5aa1[_0xcf08c8['name']]={'$like':'%'+_0x5df6e1['query'][_0x57c2('0x37')]+'%'};return _0xfa5aa1;}})});}_0x28946b=_[_0x57c2('0x35')]({},_0x28946b,_0x5df6e1[_0x57c2('0x38')]);var _0x42398d={'where':_0x28946b[_0x57c2('0x33')]};return db[_0x57c2('0x24')][_0x57c2('0x16')](_0x42398d)[_0x57c2('0x1b')](function(_0x2b93f3){_0x1e2743[_0x57c2('0x16')]=_0x2b93f3;if(_0x5df6e1['query'][_0x57c2('0x39')]){_0x28946b[_0x57c2('0x3a')]=[{'all':!![]}];}return db[_0x57c2('0x24')]['findAll'](_0x28946b);})[_0x57c2('0x1b')](function(_0x5b002e){_0x1e2743[_0x57c2('0x3b')]=_0x5b002e;return _0x1e2743;})[_0x57c2('0x1b')](respondWithFilteredResult(_0x48588c,_0x28946b))[_0x57c2('0x3c')](handleError(_0x48588c,null));};exports[_0x57c2('0x3d')]=function(_0x3fe9a0,_0x3231d1){var _0x503712={'raw':!![],'where':{'id':_0x3fe9a0[_0x57c2('0x3e')]['id']}},_0x1e58cc={};_0x1e58cc[_0x57c2('0x28')]=_[_0x57c2('0x2a')](db[_0x57c2('0x24')][_0x57c2('0x25')]);_0x1e58cc['query']=_[_0x57c2('0x2a')](_0x3fe9a0[_0x57c2('0x29')]);_0x1e58cc[_0x57c2('0x2b')]=_[_0x57c2('0x2c')](_0x1e58cc['model'],_0x1e58cc[_0x57c2('0x29')]);_0x503712['attributes']=_[_0x57c2('0x2c')](_0x1e58cc[_0x57c2('0x28')],qs[_0x57c2('0x2e')](_0x3fe9a0[_0x57c2('0x29')][_0x57c2('0x2e')]));_0x503712[_0x57c2('0x2d')]=_0x503712[_0x57c2('0x2d')]['length']?_0x503712[_0x57c2('0x2d')]:_0x1e58cc[_0x57c2('0x28')];if(_0x3fe9a0['query'][_0x57c2('0x39')]){_0x503712[_0x57c2('0x3a')]=[{'all':!![]}];}_0x503712=_['merge']({},_0x503712,_0x3fe9a0[_0x57c2('0x38')]);return db[_0x57c2('0x24')][_0x57c2('0x3f')](_0x503712)['then'](handleEntityNotFound(_0x3231d1,null))['then'](respondWithResult(_0x3231d1,null))['catch'](handleError(_0x3231d1,null));};exports[_0x57c2('0x40')]=function(_0x39f829,_0x570976){var _0x3f490d;return db[_0x57c2('0x24')]['create'](_0x39f829[_0x57c2('0x41')],{'raw':!![]})['then'](function(_0x16cc0f){_0x3f490d=_0x16cc0f;return db[_0x57c2('0x24')][_0x57c2('0x42')]({'where':{'type':_0x39f829[_0x57c2('0x41')][_0x57c2('0x27')]},'raw':!![]});})[_0x57c2('0x1b')](function(_0x53fce9){if(_0x3f490d[_0x57c2('0x27')][_0x57c2('0x43')]()==_0x57c2('0x44')){var _0x4a1f4e=fs[_0x57c2('0x45')](path[_0x57c2('0x46')](config['root'],_0x57c2('0x47')),_0x57c2('0x48'));var _0x5df926=ejs['render'](_0x4a1f4e,{'networks':_0x53fce9||[]});fs[_0x57c2('0x49')]('/etc/asterisk/stun_xcally.conf',_0x5df926);return respondWithRpcPromise(_0x57c2('0x4a'),_0x57c2('0x40'),{'module':'res_stun_monitor.so'});}else if(_0x3f490d[_0x57c2('0x27')][_0x57c2('0x43')]()==_0x57c2('0x4b')){var _0x576b5f=fs[_0x57c2('0x45')](path[_0x57c2('0x46')](config[_0x57c2('0x4c')],_0x57c2('0x4d')),_0x57c2('0x48'));var _0x510d39=ejs[_0x57c2('0x4e')](_0x576b5f,{'networks':_0x53fce9||[]});fs['writeFileSync'](_0x57c2('0x4f'),_0x510d39);return respondWithRpcPromise(_0x57c2('0x4a'),_0x57c2('0x40'),{'module':_0x57c2('0x50')});}else{var _0xa5053d=fs[_0x57c2('0x45')](path[_0x57c2('0x46')](config[_0x57c2('0x4c')],_0x57c2('0x51')),'utf8');var _0x468980=ejs[_0x57c2('0x4e')](_0xa5053d,{'networks':_0x53fce9||[]});fs[_0x57c2('0x49')](util[_0x57c2('0x52')](_0x57c2('0x53'),_0x39f829['body'][_0x57c2('0x27')][_0x57c2('0x54')]()),_0x468980);return respondWithRpcPromise(_0x57c2('0x4a'),_0x57c2('0x40'),{'module':_0x57c2('0x55')});}})[_0x57c2('0x1b')](function(){return _0x3f490d;})[_0x57c2('0x1b')](respondWithResult(_0x570976,0xc9))[_0x57c2('0x3c')](handleError(_0x570976,null));};exports['update']=function(_0x1b97fe,_0x3209ab){var _0x345108;return db['Network'][_0x57c2('0x3f')]({'where':{'id':_0x1b97fe[_0x57c2('0x3e')]['id']}})[_0x57c2('0x1b')](handleEntityNotFound(_0x3209ab,null))[_0x57c2('0x1b')](saveUpdates(_0x1b97fe[_0x57c2('0x41')],null))['then'](function(_0x3b6398){if(_0x3b6398){_0x345108=_0x3b6398;return db[_0x57c2('0x24')]['findAll']({'where':{'type':_0x345108[_0x57c2('0x27')]},'raw':!![]});}return null;})[_0x57c2('0x1b')](function(_0x4862f2){if(_0x345108[_0x57c2('0x27')][_0x57c2('0x43')]()==_0x57c2('0x44')){var _0x39f8ee=fs['readFileSync'](path[_0x57c2('0x46')](config[_0x57c2('0x4c')],_0x57c2('0x47')),_0x57c2('0x48'));var _0x12c0c2=ejs[_0x57c2('0x4e')](_0x39f8ee,{'networks':_0x4862f2||[]});fs[_0x57c2('0x49')](_0x57c2('0x56'),_0x12c0c2);return respondWithRpcPromise(_0x57c2('0x4a'),_0x57c2('0x1a'),{'module':_0x57c2('0x50')});}else if(_0x345108[_0x57c2('0x27')]['toUpperCase']()==_0x57c2('0x4b')){var _0x21465=fs['readFileSync'](path['join'](config[_0x57c2('0x4c')],_0x57c2('0x4d')),_0x57c2('0x48'));var _0x17abc3=ejs[_0x57c2('0x4e')](_0x21465,{'networks':_0x4862f2||[]});fs[_0x57c2('0x49')](_0x57c2('0x4f'),_0x17abc3);return respondWithRpcPromise(_0x57c2('0x4a'),'update',{'module':_0x57c2('0x50')});}else{var _0xfa9a2e=fs[_0x57c2('0x45')](path[_0x57c2('0x46')](config[_0x57c2('0x4c')],_0x57c2('0x51')),'utf8');var _0x2227d6=ejs['render'](_0xfa9a2e,{'networks':_0x4862f2||[]});fs[_0x57c2('0x49')](util[_0x57c2('0x52')](_0x57c2('0x53'),_0x1b97fe[_0x57c2('0x41')]['type']['toLowerCase']()),_0x2227d6);return respondWithRpcPromise(_0x57c2('0x4a'),'update',{'module':'chan_sip.so'});}})['then'](function(_0x41d959){if(_0x41d959){return _0x345108;}return null;})[_0x57c2('0x1b')](respondWithResult(_0x3209ab,null))['catch'](handleError(_0x3209ab,null));};exports[_0x57c2('0x1c')]=function(_0xb50870,_0x13691c){var _0x16efe0;return db[_0x57c2('0x24')][_0x57c2('0x3f')]({'where':{'id':_0xb50870[_0x57c2('0x3e')]['id']}})[_0x57c2('0x1b')](function(_0x1dd8a6){_0x16efe0=_0x1dd8a6;return _0x1dd8a6;})[_0x57c2('0x1b')](handleEntityNotFound(_0x13691c,null))[_0x57c2('0x1b')](removeEntity(_0x13691c,null))[_0x57c2('0x1b')](function(){if(_0x16efe0){return db['Network'][_0x57c2('0x42')]({'where':{'type':_0x16efe0['type']},'raw':!![]});}})[_0x57c2('0x1b')](function(_0x303c14){if(_0x16efe0[_0x57c2('0x27')][_0x57c2('0x43')]()==_0x57c2('0x44')){var _0x5096f1=fs[_0x57c2('0x45')](path[_0x57c2('0x46')](config[_0x57c2('0x4c')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x495d5c=ejs[_0x57c2('0x4e')](_0x5096f1,{'networks':_0x303c14||[]});fs[_0x57c2('0x49')]('/etc/asterisk/stun_xcally.conf',_0x495d5c);return respondWithRpcPromise('Reload',_0x57c2('0x1c'),{'module':_0x57c2('0x50')});}else if(_0x16efe0[_0x57c2('0x27')][_0x57c2('0x43')]()==_0x57c2('0x4b')){var _0x4b4fa9=fs[_0x57c2('0x45')](path[_0x57c2('0x46')](config['root'],_0x57c2('0x4d')),_0x57c2('0x48'));var _0xe09917=ejs[_0x57c2('0x4e')](_0x4b4fa9,{'networks':_0x303c14||[]});fs[_0x57c2('0x49')]('/etc/asterisk/turn_xcally.conf',_0xe09917);return respondWithRpcPromise('Reload',_0x57c2('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x18a7bb=fs[_0x57c2('0x45')](path['join'](config[_0x57c2('0x4c')],'server/files/templates/network.ejs'),'utf8');var _0x585c47=ejs[_0x57c2('0x4e')](_0x18a7bb,{'networks':_0x303c14||[]});fs[_0x57c2('0x49')](util[_0x57c2('0x52')](_0x57c2('0x53'),_0x16efe0[_0x57c2('0x27')][_0x57c2('0x54')]()),_0x585c47);return respondWithRpcPromise(_0x57c2('0x4a'),'destroy',{'module':_0x57c2('0x55')});}})[_0x57c2('0x3c')](handleError(_0x13691c,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index f2e7661..b63eb21 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 _0xc36d=['rimraf','./network.attributes','exports','define','network','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x17bbe5,_0x1ad283){var _0x3fd973=function(_0x49105b){while(--_0x49105b){_0x17bbe5['push'](_0x17bbe5['shift']());}};_0x3fd973(++_0x1ad283);}(_0xc36d,0x7d));var _0xdc36=function(_0x378752,_0x158b32){_0x378752=_0x378752-0x0;var _0xd5a262=_0xc36d[_0x378752];return _0xd5a262;};'use strict';var _=require(_0xdc36('0x0'));var util=require(_0xdc36('0x1'));var logger=require(_0xdc36('0x2'))(_0xdc36('0x3'));var moment=require(_0xdc36('0x4'));var BPromise=require(_0xdc36('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc36('0x6'));var rimraf=require(_0xdc36('0x7'));var config=require('../../config/environment');var attributes=require(_0xdc36('0x8'));module[_0xdc36('0x9')]=function(_0x186c58,_0x11ad3b){return _0x186c58[_0xdc36('0xa')]('Network',attributes,{'tableName':_0xdc36('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a2c=['path','rimraf','../../config/environment','exports','network','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2ff972,_0x38a7b7){var _0x2ca507=function(_0x5593e8){while(--_0x5593e8){_0x2ff972['push'](_0x2ff972['shift']());}};_0x2ca507(++_0x38a7b7);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x319f86,_0x5784c1){_0x319f86=_0x319f86-0x0;var _0x5df682=_0x7a2c[_0x319f86];return _0x5df682;};'use strict';var _=require(_0xc7a2('0x0'));var util=require('util');var logger=require(_0xc7a2('0x1'))(_0xc7a2('0x2'));var moment=require(_0xc7a2('0x3'));var BPromise=require(_0xc7a2('0x4'));var rp=require(_0xc7a2('0x5'));var fs=require('fs');var path=require(_0xc7a2('0x6'));var rimraf=require(_0xc7a2('0x7'));var config=require(_0xc7a2('0x8'));var attributes=require('./network.attributes');module[_0xc7a2('0x9')]=function(_0x1ddbae,_0x5f334e){return _0x1ddbae['define']('Network',attributes,{'tableName':_0xc7a2('0xa'),'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 181395b..e9613cf 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(_0x3c8ee1,_0x420e21){var _0x3fb9bf=function(_0x1fa660){while(--_0x1fa660){_0x3c8ee1['push'](_0x3c8ee1['shift']());}};_0x3fb9bf(++_0x420e21);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x46ae0c,_0x12d1f9){_0x46ae0c=_0x46ae0c-0x0;var _0x30086c=_0x7a54[_0x46ae0c];return _0x30086c;};'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 155f366..01192ea 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 _0x19e9=['/:id/users','getAgents','post','create','/:id/notify','notify','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x19e9,0xac));var _0x919e=function(_0x223dd8,_0x5d003b){_0x223dd8=_0x223dd8-0x0;var _0xb8f09a=_0x19e9[_0x223dd8];return _0xb8f09a;};'use strict';var multer=require(_0x919e('0x0'));var util=require(_0x919e('0x1'));var path=require(_0x919e('0x2'));var timeout=require('connect-timeout');var express=require(_0x919e('0x3'));var router=express[_0x919e('0x4')]();var fs_extra=require(_0x919e('0x5'));var auth=require(_0x919e('0x6'));var interaction=require(_0x919e('0x7'));var config=require(_0x919e('0x8'));var controller=require(_0x919e('0x9'));router[_0x919e('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x919e('0xa')](_0x919e('0xb'),auth[_0x919e('0xc')](),controller[_0x919e('0xd')]);router[_0x919e('0xa')](_0x919e('0xe'),auth[_0x919e('0xc')](),controller[_0x919e('0xf')]);router[_0x919e('0xa')](_0x919e('0x10'),auth[_0x919e('0xc')](),controller[_0x919e('0x11')]);router['get'](_0x919e('0x12'),auth[_0x919e('0xc')](),controller['getAnswers']);router['get'](_0x919e('0x13'),auth[_0x919e('0xc')](),controller[_0x919e('0x14')]);router[_0x919e('0xa')](_0x919e('0x15'),auth[_0x919e('0xc')](),controller[_0x919e('0x16')]);router[_0x919e('0xa')](_0x919e('0x17'),auth[_0x919e('0xc')](),controller[_0x919e('0x18')]);router[_0x919e('0x19')]('/',auth[_0x919e('0xc')](),controller[_0x919e('0x1a')]);router[_0x919e('0x19')]('/:id/dispositions',auth[_0x919e('0xc')](),controller['addDisposition']);router['post'](_0x919e('0x12'),auth[_0x919e('0xc')](),controller['addAnswer']);router[_0x919e('0x19')](_0x919e('0x1b'),controller[_0x919e('0x1c')]);router[_0x919e('0x19')](_0x919e('0x13'),auth['isAuthenticated'](),controller['addApplications']);router['post']('/:id/users',auth[_0x919e('0xc')](),controller[_0x919e('0x1d')]);router['post'](_0x919e('0x1e'),auth[_0x919e('0xc')](),controller[_0x919e('0x1f')]);router[_0x919e('0x20')](_0x919e('0xe'),auth[_0x919e('0xc')](),controller[_0x919e('0x21')]);router[_0x919e('0x22')](_0x919e('0xe'),auth[_0x919e('0xc')](),controller[_0x919e('0x23')]);router['delete'](_0x919e('0x10'),auth['isAuthenticated'](),controller[_0x919e('0x24')]);router['delete'](_0x919e('0x12'),auth['isAuthenticated'](),controller[_0x919e('0x25')]);router[_0x919e('0x22')](_0x919e('0x17'),auth[_0x919e('0xc')](),controller[_0x919e('0x26')]);module['exports']=router; \ No newline at end of file +var _0xbdea=['connect-timeout','express','fs-extra','../../components/auth/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','getInteractions','/:id/users','create','post','addDisposition','addAnswer','notify','send','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x42dc1e,_0x42d851){var _0x522504=function(_0xf3c953){while(--_0xf3c953){_0x42dc1e['push'](_0x42dc1e['shift']());}};_0x522504(++_0x42d851);}(_0xbdea,0x15b));var _0xabde=function(_0x49d931,_0x121258){_0x49d931=_0x49d931-0x0;var _0x491a2a=_0xbdea[_0x49d931];return _0x491a2a;};'use strict';var multer=require(_0xabde('0x0'));var util=require(_0xabde('0x1'));var path=require(_0xabde('0x2'));var timeout=require(_0xabde('0x3'));var express=require(_0xabde('0x4'));var router=express['Router']();var fs_extra=require(_0xabde('0x5'));var auth=require(_0xabde('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xabde('0x7'));router[_0xabde('0x8')]('/',auth[_0xabde('0x9')](),controller[_0xabde('0xa')]);router[_0xabde('0x8')](_0xabde('0xb'),auth[_0xabde('0x9')](),controller[_0xabde('0xc')]);router[_0xabde('0x8')](_0xabde('0xd'),auth[_0xabde('0x9')](),controller[_0xabde('0xe')]);router[_0xabde('0x8')](_0xabde('0xf'),auth[_0xabde('0x9')](),controller[_0xabde('0x10')]);router[_0xabde('0x8')](_0xabde('0x11'),auth['isAuthenticated'](),controller[_0xabde('0x12')]);router[_0xabde('0x8')]('/:id/applications',auth[_0xabde('0x9')](),controller[_0xabde('0x13')]);router[_0xabde('0x8')]('/:id/interactions',auth[_0xabde('0x9')](),controller[_0xabde('0x14')]);router[_0xabde('0x8')](_0xabde('0x15'),auth[_0xabde('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xabde('0x16')]);router[_0xabde('0x17')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xabde('0x18')]);router[_0xabde('0x17')](_0xabde('0x11'),auth[_0xabde('0x9')](),controller[_0xabde('0x19')]);router[_0xabde('0x17')]('/:id/notify',controller[_0xabde('0x1a')]);router[_0xabde('0x17')]('/:id/applications',auth[_0xabde('0x9')](),controller['addApplications']);router[_0xabde('0x17')](_0xabde('0x15'),auth[_0xabde('0x9')](),controller['addAgents']);router[_0xabde('0x17')]('/:id/send',auth[_0xabde('0x9')](),controller[_0xabde('0x1b')]);router[_0xabde('0x1c')](_0xabde('0xd'),auth[_0xabde('0x9')](),controller[_0xabde('0x1d')]);router['delete'](_0xabde('0xd'),auth[_0xabde('0x9')](),controller['destroy']);router[_0xabde('0x1e')](_0xabde('0xf'),auth[_0xabde('0x9')](),controller[_0xabde('0x1f')]);router[_0xabde('0x1e')](_0xabde('0x11'),auth['isAuthenticated'](),controller[_0xabde('0x20')]);router[_0xabde('0x1e')]('/:id/users',auth[_0xabde('0x9')](),controller[_0xabde('0x21')]);module[_0xabde('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 6ff01d9..e15a153 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 _0xdbf8=['exports','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x5a778b,_0x717daa){var _0x32f0da=function(_0x546db4){while(--_0x546db4){_0x5a778b['push'](_0x5a778b['shift']());}};_0x32f0da(++_0x717daa);}(_0xdbf8,0x1d4));var _0x8dbf=function(_0x14b938,_0x19a5f9){_0x14b938=_0x14b938-0x0;var _0xc02464=_0xdbf8[_0x14b938];return _0xc02464;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x8dbf('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x8dbf('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x8dbf('0x2')],'defaultValue':function(){return rs[_0x8dbf('0x3')]();}},'replyUri':{'type':Sequelize[_0x8dbf('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x8dbf('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8dbf('0x4')],'defaultValue':function(){return _0x8dbf('0x5');}},'notificationSound':{'type':Sequelize[_0x8dbf('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8dbf('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x8dbf('0x2')]},'queueTransfer':{'type':Sequelize[_0x8dbf('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8dbf('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8dbf('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8dbf('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8dbf('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x8dbf('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x8dbf('0x6')],'defaultValue':![],'comment':_0x8dbf('0x9'),'set':function(_0x44d8d9){if(!_0x44d8d9)this[_0x8dbf('0xa')](_0x8dbf('0xb'),null);this[_0x8dbf('0xa')](_0x8dbf('0xc'),_0x44d8d9);}}}; \ No newline at end of file +var _0x0124=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x20c836,_0x44bfa5){var _0x25f8e1=function(_0x38ec16){while(--_0x38ec16){_0x20c836['push'](_0x20c836['shift']());}};_0x25f8e1(++_0x44bfa5);}(_0x0124,0x1bd));var _0x4012=function(_0x3de447,_0x147ccd){_0x3de447=_0x3de447-0x0;var _0x29870a=_0x0124[_0x3de447];return _0x29870a;};'use strict';var Sequelize=require(_0x4012('0x0'));var rs=require(_0x4012('0x1'));module['exports']={'name':{'type':Sequelize[_0x4012('0x2')],'unique':_0x4012('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x4012('0x2')]},'token':{'type':Sequelize[_0x4012('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4012('0x4')],'defaultValue':function(){return _0x4012('0x5');}},'notificationSound':{'type':Sequelize[_0x4012('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4012('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4012('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x4012('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4012('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4012('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4012('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x4012('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x4012('0x6')],'defaultValue':![],'comment':_0x4012('0x9'),'set':function(_0x1e4fff){if(!_0x1e4fff)this[_0x4012('0xa')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x1e4fff);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 902af9b..9289267 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 _0x165d=['set','Content-Range','reject','then','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','OpenchannelAccount','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','pick','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','nolimit','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','DESC','Applications','account','applications','orderBy','priority','asc','Contacts','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','Tag','color','tag','addAgents','spread','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','user','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./openchannelAccount.socket','register','client','http','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x165d,0x14a));var _0xd165=function(_0x58ced0,_0x43cfa7){_0x58ced0=_0x58ced0-0x0;var _0xe49850=_0x165d[_0x58ced0];return _0xe49850;};'use strict';var emlformat=require(_0xd165('0x0'));var rimraf=require(_0xd165('0x1'));var zipdir=require(_0xd165('0x2'));var jsonpatch=require(_0xd165('0x3'));var rp=require(_0xd165('0x4'));var moment=require(_0xd165('0x5'));var BPromise=require(_0xd165('0x6'));var Mustache=require('mustache');var util=require(_0xd165('0x7'));var path=require(_0xd165('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd165('0x9'));var _=require(_0xd165('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd165('0xb'));var deskjs=require(_0xd165('0xc'));var toCsv=require(_0xd165('0xd'));var querystring=require(_0xd165('0xe'));var Papa=require(_0xd165('0xf'));var Redis=require(_0xd165('0x10'));var authService=require(_0xd165('0x11'));var qs=require(_0xd165('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd165('0x13'));var logger=require(_0xd165('0x14'))(_0xd165('0x15'));var utils=require('../../config/utils');var config=require(_0xd165('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd165('0x17'))['db'];config[_0xd165('0x18')]=_[_0xd165('0x19')](config[_0xd165('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd165('0x18')]));require(_0xd165('0x1a'))[_0xd165('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xd165('0x1c')][_0xd165('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4c86c6,_0x170839,_0x1bbcb9,_0x535950){return new BPromise(function(_0x522b83,_0x2acf24){var _0x30378f=_0x535950||client;return _0x30378f['request'](_0x4c86c6,_0x1bbcb9)['then'](function(_0x596a74){logger['info'](_0xd165('0x1e'),_0x170839,_0xd165('0x1f'));logger[_0xd165('0x20')](_0xd165('0x21'),_0x170839,_0xd165('0x1f'),JSON[_0xd165('0x22')](_0x596a74));if(_0x596a74[_0xd165('0x23')]){if(_0x596a74[_0xd165('0x23')][_0xd165('0x24')]===0x1f4){logger['error'](_0xd165('0x1e'),_0x170839,_0x596a74['error'][_0xd165('0x25')]);return _0x2acf24(_0x596a74[_0xd165('0x23')]['message']);}logger[_0xd165('0x23')](_0xd165('0x1e'),_0x170839,_0x596a74['error'][_0xd165('0x25')]);return _0x522b83(_0x596a74[_0xd165('0x23')][_0xd165('0x25')]);}else{logger['info'](_0xd165('0x1e'),_0x170839,_0xd165('0x1f'));_0x522b83(_0x596a74[_0xd165('0x26')][_0xd165('0x25')]);}})[_0xd165('0x27')](function(_0x21a42e){logger['error'](_0xd165('0x1e'),_0x170839,_0x21a42e);_0x2acf24(_0x21a42e);});});}function respondWithStatusCode(_0x3a9baa,_0x3c80b7){_0x3c80b7=_0x3c80b7||0xcc;return function(_0x11167c){if(_0x11167c){return _0x3a9baa[_0xd165('0x28')](_0x3c80b7);}return _0x3a9baa[_0xd165('0x29')](_0x3c80b7)[_0xd165('0x2a')]();};}function respondWithResult(_0x4c9b4e,_0x431992){_0x431992=_0x431992||0xc8;return function(_0x5c5907){if(_0x5c5907){return _0x4c9b4e[_0xd165('0x29')](_0x431992)[_0xd165('0x2b')](_0x5c5907);}};}function respondWithFilteredResult(_0xeefe8,_0x4c503a){return function(_0x2e71e3){if(_0x2e71e3){var _0x33ef5f=typeof _0x4c503a[_0xd165('0x2c')]===_0xd165('0x2d')&&typeof _0x4c503a['limit']===_0xd165('0x2d');var _0x2b4b62=_0x2e71e3[_0xd165('0x2e')];var _0x132ac2=_0x33ef5f?0x0:_0x4c503a[_0xd165('0x2c')];var _0x4235af=_0x33ef5f?_0x2e71e3['count']:_0x4c503a[_0xd165('0x2c')]+_0x4c503a[_0xd165('0x2f')];var _0x4becdf;if(_0x4235af>=_0x2b4b62){_0x4235af=_0x2b4b62;_0x4becdf=0xc8;}else{_0x4becdf=0xce;}_0xeefe8[_0xd165('0x29')](_0x4becdf);return _0xeefe8[_0xd165('0x30')](_0xd165('0x31'),_0x132ac2+'-'+_0x4235af+'/'+_0x2b4b62)[_0xd165('0x2b')](_0x2e71e3);}return null;};}function patchUpdates(_0x3090d9){return function(_0x342476){try{jsonpatch['apply'](_0x342476,_0x3090d9,!![]);}catch(_0x51f38d){return BPromise[_0xd165('0x32')](_0x51f38d);}return _0x342476['save']();};}function saveUpdates(_0x36b821,_0x50cbf0){return function(_0x2a20c2){if(_0x2a20c2){return _0x2a20c2['update'](_0x36b821)[_0xd165('0x33')](function(_0x39404e){return _0x39404e;});}return null;};}function removeEntity(_0xf86728,_0x256112){return function(_0x3175f4){if(_0x3175f4){return _0x3175f4[_0xd165('0x34')]()[_0xd165('0x33')](function(){var _0x27c347=_0x3175f4[_0xd165('0x35')]({'plain':!![]});var _0x34eafb=_0xd165('0x36');return db[_0xd165('0x37')][_0xd165('0x34')]({'where':{'type':_0x34eafb,'resourceId':_0x27c347['id']}})[_0xd165('0x33')](function(){return _0x3175f4;});})['then'](function(){_0xf86728[_0xd165('0x29')](0xcc)[_0xd165('0x2a')]();});}};}function handleEntityNotFound(_0x447a01,_0x2aba2e){return function(_0x545160){if(!_0x545160){_0x447a01['sendStatus'](0x194);}return _0x545160;};}function handleError(_0x5c239c,_0x5a48e4){_0x5a48e4=_0x5a48e4||0x1f4;return function(_0x30b2e1){logger[_0xd165('0x23')](_0x30b2e1[_0xd165('0x38')]);if(_0x30b2e1[_0xd165('0x39')]){delete _0x30b2e1[_0xd165('0x39')];}_0x5c239c[_0xd165('0x29')](_0x5a48e4)[_0xd165('0x3a')](_0x30b2e1);};}exports[_0xd165('0x3b')]=function(_0x22f68f,_0x1a2e19){var _0x3ecede={'include':[{'model':db[_0xd165('0x3c')],'as':_0xd165('0x3d')}]},_0x5b73cf={},_0x30961f={'count':0x0,'rows':[]};var _0xcafb72=_[_0xd165('0x3e')](db['OpenchannelAccount'][_0xd165('0x3f')],function(_0x2e0989){return{'name':_0x2e0989['fieldName'],'type':_0x2e0989[_0xd165('0x40')][_0xd165('0x41')]};});_0x5b73cf[_0xd165('0x42')]=_[_0xd165('0x3e')](_0xcafb72,_0xd165('0x39'));_0x5b73cf[_0xd165('0x43')]=_['keys'](_0x22f68f['query']);_0x5b73cf[_0xd165('0x44')]=_[_0xd165('0x45')](_0x5b73cf[_0xd165('0x42')],_0x5b73cf[_0xd165('0x43')]);_0x3ecede[_0xd165('0x46')]=_[_0xd165('0x45')](_0x5b73cf[_0xd165('0x42')],qs[_0xd165('0x47')](_0x22f68f['query'][_0xd165('0x47')]));_0x3ecede['attributes']=_0x3ecede[_0xd165('0x46')][_0xd165('0x48')]?_0x3ecede[_0xd165('0x46')]:_0x5b73cf[_0xd165('0x42')];if(!_0x22f68f[_0xd165('0x43')][_0xd165('0x49')]('nolimit')){_0x3ecede[_0xd165('0x2f')]=qs[_0xd165('0x2f')](_0x22f68f[_0xd165('0x43')]['limit']);_0x3ecede[_0xd165('0x2c')]=qs['offset'](_0x22f68f[_0xd165('0x43')][_0xd165('0x2c')]);}_0x3ecede[_0xd165('0x4a')]=qs[_0xd165('0x4b')](_0x22f68f[_0xd165('0x43')][_0xd165('0x4b')]);_0x3ecede[_0xd165('0x4c')]=qs['filters'](_['pick'](_0x22f68f['query'],_0x5b73cf['filters']),_0xcafb72);if(_0x22f68f['query'][_0xd165('0x4d')]){_0x3ecede[_0xd165('0x4c')]=_[_0xd165('0x4e')](_0x3ecede[_0xd165('0x4c')],{'$or':_[_0xd165('0x3e')](_0xcafb72,function(_0x37f1bf){if(_0x37f1bf['type']!=='VIRTUAL'){var _0x11c864={};_0x11c864[_0x37f1bf[_0xd165('0x39')]]={'$like':'%'+_0x22f68f[_0xd165('0x43')][_0xd165('0x4d')]+'%'};return _0x11c864;}})});}_0x3ecede=_[_0xd165('0x4e')]({},_0x3ecede,_0x22f68f['options']);var _0x54f064={'where':_0x3ecede[_0xd165('0x4c')]};return db[_0xd165('0x4f')]['count'](_0x54f064)[_0xd165('0x33')](function(_0x252805){_0x30961f[_0xd165('0x2e')]=_0x252805;if(_0x22f68f[_0xd165('0x43')][_0xd165('0x50')]){_0x3ecede[_0xd165('0x51')]=[{'all':!![]}];}return db[_0xd165('0x4f')][_0xd165('0x52')](_0x3ecede);})[_0xd165('0x33')](function(_0x1dc329){_0x30961f[_0xd165('0x53')]=_0x1dc329;return _0x30961f;})['then'](respondWithFilteredResult(_0x1a2e19,_0x3ecede))[_0xd165('0x27')](handleError(_0x1a2e19,null));};exports[_0xd165('0x54')]=function(_0x51fb80,_0x5ab530){var _0x63b247={'raw':![],'where':{'id':_0x51fb80[_0xd165('0x55')]['id']},'include':[{'model':db[_0xd165('0x3c')],'as':'mandatoryDispositionPause'}]},_0x3d4976={};_0x3d4976[_0xd165('0x42')]=_[_0xd165('0x56')](db[_0xd165('0x4f')][_0xd165('0x3f')]);_0x3d4976['query']=_['keys'](_0x51fb80['query']);_0x3d4976[_0xd165('0x44')]=_['intersection'](_0x3d4976[_0xd165('0x42')],_0x3d4976[_0xd165('0x43')]);_0x63b247['attributes']=_['intersection'](_0x3d4976['model'],qs['fields'](_0x51fb80[_0xd165('0x43')][_0xd165('0x47')]));_0x63b247[_0xd165('0x46')]=_0x63b247[_0xd165('0x46')]['length']?_0x63b247[_0xd165('0x46')]:_0x3d4976[_0xd165('0x42')];if(_0x51fb80['query'][_0xd165('0x50')]){_0x63b247[_0xd165('0x51')]=[{'all':!![]}];}_0x63b247=_['merge']({},_0x63b247,_0x51fb80[_0xd165('0x57')]);return db[_0xd165('0x4f')][_0xd165('0x58')](_0x63b247)[_0xd165('0x33')](handleEntityNotFound(_0x5ab530,null))[_0xd165('0x33')](respondWithResult(_0x5ab530,null))[_0xd165('0x27')](handleError(_0x5ab530,null));};exports[_0xd165('0x59')]=function(_0x5e4586,_0x571255){return db['OpenchannelAccount'][_0xd165('0x59')](_0x5e4586[_0xd165('0x5a')],{})['then'](function(_0x5b039e){var _0x5b3c65=_0x5e4586['user']['get']({'plain':!![]});if(!_0x5b3c65)throw new Error(_0xd165('0x5b'));if(_0x5b3c65[_0xd165('0x5c')]==='user'){var _0x5c8ac4=_0x5b039e[_0xd165('0x35')]({'plain':!![]});var _0x5ae334='OpenchannelAccounts';return db[_0xd165('0x5d')][_0xd165('0x58')]({'where':{'name':_0x5ae334,'userProfileId':_0x5b3c65[_0xd165('0x5e')]},'raw':!![]})['then'](function(_0x4111a4){if(_0x4111a4&&_0x4111a4['autoAssociation']===0x0){return db['UserProfileResource'][_0xd165('0x59')]({'name':_0x5c8ac4[_0xd165('0x39')],'resourceId':_0x5c8ac4['id'],'type':_0x4111a4[_0xd165('0x39')],'sectionId':_0x4111a4['id']},{})[_0xd165('0x33')](function(){return _0x5b039e;});}else{return _0x5b039e;}})[_0xd165('0x27')](function(_0x48629c){logger[_0xd165('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48629c);throw _0x48629c;});}return _0x5b039e;})['then'](respondWithResult(_0x571255,0xc9))[_0xd165('0x27')](handleError(_0x571255,null));};exports[_0xd165('0x5f')]=function(_0x5a8992,_0x416592){if(_0x5a8992['body']['id']){delete _0x5a8992[_0xd165('0x5a')]['id'];}return db[_0xd165('0x4f')][_0xd165('0x58')]({'where':{'id':_0x5a8992['params']['id']},'include':[{'model':db[_0xd165('0x3c')],'as':_0xd165('0x3d')}]})[_0xd165('0x33')](handleEntityNotFound(_0x416592,null))[_0xd165('0x33')](saveUpdates(_0x5a8992[_0xd165('0x5a')],null))[_0xd165('0x33')](respondWithResult(_0x416592,null))[_0xd165('0x27')](handleError(_0x416592,null));};exports[_0xd165('0x34')]=function(_0x2b07e5,_0x4d1575){return db[_0xd165('0x4f')][_0xd165('0x58')]({'where':{'id':_0x2b07e5['params']['id']}})[_0xd165('0x33')](handleEntityNotFound(_0x4d1575,null))[_0xd165('0x33')](removeEntity(_0x4d1575,null))[_0xd165('0x27')](handleError(_0x4d1575,null));};exports['describe']=function(_0x4c6d8f,_0x31b50a){return db['OpenchannelAccount'][_0xd165('0x60')]()[_0xd165('0x33')](respondWithResult(_0x31b50a,null))[_0xd165('0x27')](handleError(_0x31b50a,null));};exports[_0xd165('0x61')]=function(_0x22c6a9,_0x2358f1,_0x360099){if(_0x22c6a9[_0xd165('0x5a')]['id']){delete _0x22c6a9[_0xd165('0x5a')]['id'];}return db[_0xd165('0x4f')][_0xd165('0x58')]({'where':{'id':_0x22c6a9[_0xd165('0x55')]['id']}})['then'](handleEntityNotFound(_0x2358f1,null))[_0xd165('0x33')](function(_0x3d789f){if(_0x3d789f){_0x22c6a9[_0xd165('0x5a')][_0xd165('0x62')]=_0x3d789f['id'];return db['Disposition'][_0xd165('0x59')](_0x22c6a9[_0xd165('0x5a')]);}})[_0xd165('0x33')](respondWithResult(_0x2358f1,null))[_0xd165('0x27')](handleError(_0x2358f1,null));};exports[_0xd165('0x63')]=function(_0x224016,_0x49762a,_0x27c0db){var _0x27cab1={'raw':![],'where':{}};var _0x360f27={};var _0x1c7f91={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xd165('0x64')]({'where':{'id':_0x224016[_0xd165('0x55')]['id']}})[_0xd165('0x33')](handleEntityNotFound(_0x49762a,null))[_0xd165('0x33')](function(_0x5844e3){if(_0x5844e3){_0x360f27['model']=_[_0xd165('0x56')](db[_0xd165('0x65')][_0xd165('0x3f')]);_0x360f27['query']=_['keys'](_0x224016[_0xd165('0x43')]);_0x360f27['filters']=_[_0xd165('0x45')](_0x360f27['model'],_0x360f27[_0xd165('0x43')]);_0x27cab1[_0xd165('0x46')]=_[_0xd165('0x45')](_0x360f27[_0xd165('0x42')],qs[_0xd165('0x47')](_0x224016[_0xd165('0x43')][_0xd165('0x47')]));_0x27cab1['attributes']=_0x27cab1[_0xd165('0x46')][_0xd165('0x48')]?_0x27cab1[_0xd165('0x46')]:_0x360f27[_0xd165('0x42')];if(!_0x224016[_0xd165('0x43')]['hasOwnProperty']('nolimit')){_0x27cab1[_0xd165('0x2f')]=qs[_0xd165('0x2f')](_0x224016['query'][_0xd165('0x2f')]);_0x27cab1['offset']=qs['offset'](_0x224016[_0xd165('0x43')][_0xd165('0x2c')]);}_0x27cab1['order']=qs[_0xd165('0x4b')](_0x224016[_0xd165('0x43')][_0xd165('0x4b')]);_0x27cab1['where']=qs['filters'](_[_0xd165('0x66')](_0x224016[_0xd165('0x43')],_0x360f27[_0xd165('0x44')]));_0x27cab1['where'][_0xd165('0x62')]=_0x5844e3['id'];if(_0x224016[_0xd165('0x43')][_0xd165('0x4d')]){_0x27cab1[_0xd165('0x4c')]=_[_0xd165('0x4e')](_0x27cab1['where'],{'$or':_[_0xd165('0x3e')](_0x27cab1[_0xd165('0x46')],function(_0x186c90){var _0x3d018f={};_0x3d018f[_0x186c90]={'$like':'%'+_0x224016['query'][_0xd165('0x4d')]+'%'};return _0x3d018f;})});}_0x27cab1=_[_0xd165('0x4e')]({},_0x27cab1,_0x224016['options']);return db[_0xd165('0x65')][_0xd165('0x2e')]({'where':_0x27cab1[_0xd165('0x4c')]})[_0xd165('0x33')](function(_0x247f44){_0x1c7f91[_0xd165('0x2e')]=_0x247f44;if(_0x224016[_0xd165('0x43')]['includeAll']){_0x27cab1[_0xd165('0x51')]=[{'all':!![]}];}return db[_0xd165('0x65')][_0xd165('0x52')](_0x27cab1);})[_0xd165('0x33')](function(_0x5b7ecf){_0x1c7f91[_0xd165('0x53')]=_0x5b7ecf;return _0x1c7f91;});}})[_0xd165('0x33')](respondWithFilteredResult(_0x49762a,_0x27cab1))['catch'](handleError(_0x49762a,null));};exports['removeDispositions']=function(_0x1d3a2d,_0x46b5d4,_0x207f82){return db['OpenchannelAccount'][_0xd165('0x58')]({'where':{'id':_0x1d3a2d[_0xd165('0x55')]['id']}})[_0xd165('0x33')](handleEntityNotFound(_0x46b5d4,null))['then'](function(_0x368652){if(_0x368652){return _0x368652[_0xd165('0x67')](_0x1d3a2d['query'][_0xd165('0x68')]);}})['then'](respondWithStatusCode(_0x46b5d4,null))[_0xd165('0x27')](handleError(_0x46b5d4,null));};exports[_0xd165('0x69')]=function(_0x595650,_0x35fe4f,_0x4c94b4){if(_0x595650['body']['id']){delete _0x595650['body']['id'];}return db[_0xd165('0x4f')][_0xd165('0x58')]({'where':{'id':_0x595650[_0xd165('0x55')]['id']}})[_0xd165('0x33')](handleEntityNotFound(_0x35fe4f,null))[_0xd165('0x33')](function(_0x28422f){if(_0x28422f){_0x595650[_0xd165('0x5a')][_0xd165('0x62')]=_0x28422f['id'];return db['CannedAnswer'][_0xd165('0x59')](_0x595650[_0xd165('0x5a')]);}})['then'](respondWithResult(_0x35fe4f,null))[_0xd165('0x27')](handleError(_0x35fe4f,null));};exports[_0xd165('0x6a')]=function(_0x1d62ab,_0x4f80e5,_0x40a32d){var _0x590888={'raw':![],'where':{}};var _0x3f8677={};var _0x33b5e3={'count':0x0,'rows':[]};return db[_0xd165('0x4f')]['findOne']({'where':{'id':_0x1d62ab[_0xd165('0x55')]['id']}})['then'](handleEntityNotFound(_0x4f80e5,null))[_0xd165('0x33')](function(_0x23407e){if(_0x23407e){_0x3f8677[_0xd165('0x42')]=_[_0xd165('0x56')](db[_0xd165('0x6b')][_0xd165('0x3f')]);_0x3f8677[_0xd165('0x43')]=_[_0xd165('0x56')](_0x1d62ab[_0xd165('0x43')]);_0x3f8677[_0xd165('0x44')]=_['intersection'](_0x3f8677['model'],_0x3f8677['query']);_0x590888[_0xd165('0x46')]=_['intersection'](_0x3f8677['model'],qs['fields'](_0x1d62ab[_0xd165('0x43')][_0xd165('0x47')]));_0x590888[_0xd165('0x46')]=_0x590888[_0xd165('0x46')][_0xd165('0x48')]?_0x590888[_0xd165('0x46')]:_0x3f8677[_0xd165('0x42')];if(!_0x1d62ab[_0xd165('0x43')][_0xd165('0x49')](_0xd165('0x6c'))){_0x590888['limit']=qs['limit'](_0x1d62ab['query'][_0xd165('0x2f')]);_0x590888[_0xd165('0x2c')]=qs['offset'](_0x1d62ab[_0xd165('0x43')][_0xd165('0x2c')]);}_0x590888[_0xd165('0x4a')]=qs[_0xd165('0x4b')](_0x1d62ab[_0xd165('0x43')][_0xd165('0x4b')]);_0x590888[_0xd165('0x4c')]=qs['filters'](_[_0xd165('0x66')](_0x1d62ab['query'],_0x3f8677['filters']));_0x590888[_0xd165('0x4c')][_0xd165('0x62')]=_0x23407e['id'];if(_0x1d62ab[_0xd165('0x43')][_0xd165('0x4d')]){_0x590888[_0xd165('0x4c')]=_[_0xd165('0x4e')](_0x590888[_0xd165('0x4c')],{'$or':_[_0xd165('0x3e')](_0x590888[_0xd165('0x46')],function(_0x491bb6){var _0x438ba8={};_0x438ba8[_0x491bb6]={'$like':'%'+_0x1d62ab[_0xd165('0x43')][_0xd165('0x4d')]+'%'};return _0x438ba8;})});}_0x590888=_[_0xd165('0x4e')]({},_0x590888,_0x1d62ab[_0xd165('0x57')]);return db[_0xd165('0x6b')]['count']({'where':_0x590888[_0xd165('0x4c')]})[_0xd165('0x33')](function(_0x118b93){_0x33b5e3['count']=_0x118b93;if(_0x1d62ab['query'][_0xd165('0x50')]){_0x590888[_0xd165('0x51')]=[{'all':!![]}];}return db[_0xd165('0x6b')][_0xd165('0x52')](_0x590888);})[_0xd165('0x33')](function(_0x15da10){_0x33b5e3[_0xd165('0x53')]=_0x15da10;return _0x33b5e3;});}})[_0xd165('0x33')](respondWithFilteredResult(_0x4f80e5,_0x590888))[_0xd165('0x27')](handleError(_0x4f80e5,null));};exports['removeAnswers']=function(_0x25150f,_0x21ffbd,_0x2bc19e){return db['OpenchannelAccount'][_0xd165('0x58')]({'where':{'id':_0x25150f[_0xd165('0x55')]['id']}})['then'](handleEntityNotFound(_0x21ffbd,null))[_0xd165('0x33')](function(_0x2e00a3){if(_0x2e00a3){return _0x2e00a3[_0xd165('0x6d')](_0x25150f['query']['ids']);}})[_0xd165('0x33')](respondWithStatusCode(_0x21ffbd,null))[_0xd165('0x27')](handleError(_0x21ffbd,null));};exports['notify']=function(_0x26ed22,_0x1acd42,_0x365ff7){var _0x3eadbf={'body':_0x26ed22['body'],'channel':_0xd165('0x6e')};var _0x13c7d7=[];var _0x423427=[];var _0x209f6b={};var _0x45bd61=![];return db[_0xd165('0x6f')]['describe']()['then'](function(_0x11533e){if(!_0x11533e){throw new db[(_0xd165('0x70'))][(_0xd165('0x71'))](_0xd165('0x72'));}_0x13c7d7=_[_0xd165('0x73')](_[_0xd165('0x56')](_0x11533e),[_0xd165('0x74'),_0xd165('0x75')]);_0x423427=_[_0xd165('0x73')](_[_0xd165('0x56')](_0x11533e),[_0xd165('0x74'),'updatedAt','CompanyId','ListId']);if(_0x26ed22[_0xd165('0x5a')]['id']){delete _0x26ed22['body']['id'];}if(_[_0xd165('0x76')](_0x26ed22[_0xd165('0x5a')]['from'])){throw new db[(_0xd165('0x70'))][(_0xd165('0x71'))](_0xd165('0x77'));}if(_[_0xd165('0x76')](_0x26ed22[_0xd165('0x5a')][_0xd165('0x5a')])||_0x26ed22['body']['body']===''){throw new db['Sequelize'][(_0xd165('0x71'))](_0xd165('0x78'));}if(_[_0xd165('0x76')](_0x26ed22[_0xd165('0x5a')][_0xd165('0x79')])){throw new db[(_0xd165('0x70'))]['ValidationError'](_0xd165('0x7a')+_0x423427);}if(!_['includes'](_0x423427,_0x26ed22['body'][_0xd165('0x79')])){throw new db['Sequelize'][(_0xd165('0x71'))](_0xd165('0x7b')+_0x423427);}_0x209f6b[_0x26ed22[_0xd165('0x5a')]['mapKey']]=_0x26ed22[_0xd165('0x5a')][_0xd165('0x7c')];})['then'](function(){return db[_0xd165('0x4f')]['find']({'where':{'id':_0x26ed22[_0xd165('0x55')]['id']},'include':[{'model':db[_0xd165('0x7d')],'as':_0xd165('0x7e'),'include':[{'model':db[_0xd165('0x6f')],'as':'Contacts','where':_0x209f6b,'limit':0x1,'order':[[_0xd165('0x75'),_0xd165('0x7f')]]}]},{'model':db['OpenchannelApplication'],'as':_0xd165('0x80')}]});})[_0xd165('0x33')](handleEntityNotFound(_0x1acd42,null))[_0xd165('0x33')](function(_0x56c1c2){if(_0x56c1c2&&_0x56c1c2[_0xd165('0x7e')]){_0x3eadbf[_0xd165('0x81')]=_0x56c1c2;_0x3eadbf[_0xd165('0x82')]=_0x56c1c2[_0xd165('0x80')];_0x3eadbf['list']=_0x56c1c2[_0xd165('0x7e')];_0x3eadbf['applications']=_[_0xd165('0x83')](_0x3eadbf[_0xd165('0x82')],[_0xd165('0x84')],[_0xd165('0x85')]);if(_0x3eadbf['account'][_0xd165('0x80')]){delete _0x3eadbf[_0xd165('0x81')]['Applications'];}if(_0x3eadbf[_0xd165('0x81')][_0xd165('0x7e')]&&_0x3eadbf[_0xd165('0x81')]['List'][_0xd165('0x86')][_0xd165('0x48')]){return _0x3eadbf[_0xd165('0x81')][_0xd165('0x7e')][_0xd165('0x86')][0x0];}var _0x25491d=_['defaults'](_0x26ed22['body'],{'firstName':_0x26ed22[_0xd165('0x5a')][_0xd165('0x7c')],'ListId':_0x56c1c2[_0xd165('0x87')]});_0x25491d[_0x26ed22[_0xd165('0x5a')][_0xd165('0x79')]]=_0x26ed22[_0xd165('0x5a')][_0xd165('0x7c')];return db[_0xd165('0x6f')][_0xd165('0x59')](_0x25491d,{'fields':_0x13c7d7,'raw':!![]});}})[_0xd165('0x33')](handleEntityNotFound(_0x1acd42,null))['then'](function(_0x22da67){_0x3eadbf[_0xd165('0x88')]=_0x22da67;if(_0x22da67){var _0x298525={'ContactId':_0x22da67['id'],'OpenchannelAccountId':_0x26ed22[_0xd165('0x55')]['id'],'from':(_0x22da67[_0xd165('0x89')]||'')+'\x20'+(_0x22da67[_0xd165('0x8a')]||'')};var _0x72d20c={'OpenchannelAccountId':_0x26ed22['params']['id'],'closed':![]};if(_0x26ed22['body'][_0xd165('0x8b')]){_0x72d20c[_0xd165('0x8b')]=_0x26ed22['body'][_0xd165('0x8b')];return db[_0xd165('0x8c')][_0xd165('0x58')]({'where':_0x72d20c})[_0xd165('0x33')](function(_0x1c9b5c){if(_0x1c9b5c){return[_0x1c9b5c,![]];}_0x298525[_0xd165('0x8b')]=_0x26ed22[_0xd165('0x5a')]['threadId'];_0x298525[_0xd165('0x8d')]=_0x26ed22[_0xd165('0x5a')]['externalUrl'];return db[_0xd165('0x8c')]['create'](_0x298525)[_0xd165('0x33')](function(_0x577a7b){return[_0x577a7b,!![]];});});}else{_0x72d20c[_0xd165('0x8b')]=null;}_0x72d20c[_0xd165('0x8e')]=_0x22da67['id'];return db[_0xd165('0x8c')][_0xd165('0x58')]({'where':_0x72d20c})['then'](function(_0x32844e){if(_0x32844e){return[_0x32844e,![]];}return db[_0xd165('0x8c')][_0xd165('0x59')](_0x298525)[_0xd165('0x33')](function(_0x2492a7){return[_0x2492a7,!![]];});});}})['spread'](function(_0x43b1a7,_0x45fe97){if(_0x43b1a7){_0x45bd61=_0x45fe97;if(!_0x45fe97){var _0x318129={'from':(_0x3eadbf[_0xd165('0x88')][_0xd165('0x89')]||'')+'\x20'+(_0x3eadbf[_0xd165('0x88')][_0xd165('0x8a')]||'')};if(_0x26ed22[_0xd165('0x5a')][_0xd165('0x8b')]&&_0x26ed22[_0xd165('0x5a')][_0xd165('0x8f')]&&_0x26ed22[_0xd165('0x5a')]['threadId']!=_0x26ed22['body']['messageId']){_0x318129[_0xd165('0x8b')]=_0x26ed22['body'][_0xd165('0x8f')];}return _0x43b1a7[_0xd165('0x5f')](_0x318129);}else{return _0x43b1a7;}}})[_0xd165('0x33')](function(_0x546c42){_0x3eadbf[_0xd165('0x90')]=_0x546c42[_0xd165('0x35')]({'plain':!![]});_0x3eadbf['interaction'][_0xd165('0x91')]=_0x45bd61;if(_0x3eadbf[_0xd165('0x90')][_0xd165('0x91')]){if(_0x3eadbf[_0xd165('0x81')][_0xd165('0x92')]){_0x3eadbf[_0xd165('0x82')][_0xd165('0x93')]({'id':0x0,'priority':_0x3eadbf[_0xd165('0x82')]['length']+0x1,'app':'close','appdata':_0xd165('0x94'),'interval':_0xd165('0x95')});}}return db[_0xd165('0x96')][_0xd165('0x59')]({'body':_0x26ed22[_0xd165('0x5a')][_0xd165('0x5a')],'OpenchannelAccountId':_0x26ed22['params']['id'],'OpenchannelInteractionId':_0x546c42['id'],'direction':'in','ContactId':_0x3eadbf['contact']['id'],'AttachmentId':_0x26ed22['body']['AttachmentId']});})['then'](function(_0x46b312){_0x3eadbf[_0xd165('0x25')]=_0x46b312;if(_0x3eadbf[_0xd165('0x90')][_0xd165('0x97')]){return db[_0xd165('0x98')][_0xd165('0x58')]({'attributes':['id',_0xd165('0x39')],'where':{'id':_0x3eadbf[_0xd165('0x90')][_0xd165('0x97')]}})[_0xd165('0x33')](function(_0x50e5f7){if(_0x50e5f7){_0x3eadbf[_0xd165('0x82')][_0xd165('0x99')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x50e5f7[_0xd165('0x39')]+','+(_0x3eadbf[_0xd165('0x81')][_0xd165('0x9a')]||0xa),'interval':_0xd165('0x95')});_0x3eadbf[_0xd165('0x9b')]=![];}return respondWithRpcPromise(_0xd165('0x9c'),_0xd165('0x9d'),_0x3eadbf);});}return respondWithRpcPromise(_0xd165('0x9c'),_0xd165('0x9d'),_0x3eadbf);})[_0xd165('0x33')](function(_0x144537){respondWithRpcPromise(_0xd165('0x9e'),_0xd165('0x9e'),{'event':_0xd165('0x9f'),'message':_0x144537},client9002);return _0x144537;})['then'](respondWithResult(_0x1acd42,null))[_0xd165('0x27')](handleError(_0x1acd42,null));};exports[_0xd165('0xa0')]=function(_0x3daeb2,_0x55a8ef){var _0x4008f6=_0x3daeb2[_0xd165('0x55')]['id'];var _0x4b0415=_0x3daeb2[_0xd165('0x5a')];var _0x50c431=0xc8;var _0x3c803e=null;return db[_0xd165('0xa1')]['transaction']({'isolationLevel':db['sequelize'][_0xd165('0xa2')][_0xd165('0xa3')][_0xd165('0xa4')]},function(_0x5a6bcc){return db[_0xd165('0x4f')][_0xd165('0x64')]({'where':{'id':_0x4008f6},'transaction':_0x5a6bcc})[_0xd165('0x33')](function(_0x3f7ae6){if(_0x3f7ae6){return db[_0xd165('0xa5')][_0xd165('0x34')]({'where':{'OpenchannelAccountId':_0x4008f6},'transaction':_0x5a6bcc})[_0xd165('0x33')](function(){var _0x43b88b=_['map'](_0x4b0415,function(_0x111656){_0x111656[_0xd165('0x62')]=_0x4008f6;return _0x111656;});return db['OpenchannelApplication'][_0xd165('0xa6')](_0x43b88b,{'transaction':_0x5a6bcc});});}else{_0x50c431=0x194;_0x3c803e=[];}});})[_0xd165('0x33')](function(){if(_0x50c431!==0x194){return db[_0xd165('0xa5')][_0xd165('0xa7')]({'where':{'OpenchannelAccountId':_0x4008f6},'order':_0xd165('0x84')})[_0xd165('0x33')](function(_0x169a33){_0x3c803e=_0x169a33;});}})[_0xd165('0x27')](function(_0x1ab57f){_0x50c431=0x1f4;logger[_0xd165('0x23')](_0x1ab57f['stack']);if(_0x1ab57f['name']){delete _0x1ab57f[_0xd165('0x39')];}_0x3c803e=_0x1ab57f;})[_0xd165('0xa8')](function(){if(_0x3c803e===null){_0x55a8ef[_0xd165('0x28')](_0x50c431);}else{if(_0x50c431===0x1f4){_0x55a8ef[_0xd165('0x29')](_0x50c431)['send'](_0x3c803e);}else{_0x55a8ef[_0xd165('0x29')](_0x50c431)[_0xd165('0x2b')](_0x3c803e);}}});};exports[_0xd165('0xa9')]=function(_0x3e0c36,_0x1433ec,_0x4e013b){var _0x20cb35={};var _0x5ed505={};var _0x481b77;var _0x5880ad;return db[_0xd165('0x4f')][_0xd165('0x64')]({'where':{'id':_0x3e0c36['params']['id']}})[_0xd165('0x33')](handleEntityNotFound(_0x1433ec,null))['then'](function(_0x356bd4){if(_0x356bd4){_0x481b77=_0x356bd4;_0x5ed505[_0xd165('0x42')]=_[_0xd165('0x56')](db['OpenchannelApplication'][_0xd165('0x3f')]);_0x5ed505[_0xd165('0x43')]=_['keys'](_0x3e0c36[_0xd165('0x43')]);_0x5ed505[_0xd165('0x44')]=_[_0xd165('0x45')](_0x5ed505[_0xd165('0x42')],_0x5ed505['query']);_0x20cb35[_0xd165('0x46')]=_[_0xd165('0x45')](_0x5ed505[_0xd165('0x42')],qs['fields'](_0x3e0c36[_0xd165('0x43')][_0xd165('0x47')]));_0x20cb35['attributes']=_0x20cb35[_0xd165('0x46')]['length']?_0x20cb35['attributes']:_0x5ed505['model'];_0x20cb35[_0xd165('0x4a')]=qs['sort'](_0x3e0c36['query'][_0xd165('0x4b')]);_0x20cb35[_0xd165('0x4c')]=qs[_0xd165('0x44')](_['pick'](_0x3e0c36['query'],_0x5ed505[_0xd165('0x44')]));if(_0x3e0c36[_0xd165('0x43')][_0xd165('0x4d')]){_0x20cb35[_0xd165('0x4c')]=_[_0xd165('0x4e')](_0x20cb35[_0xd165('0x4c')],{'$or':_[_0xd165('0x3e')](_0x20cb35[_0xd165('0x46')],function(_0x5183f7){var _0x1a09e6={};_0x1a09e6[_0x5183f7]={'$like':'%'+_0x3e0c36['query'][_0xd165('0x4d')]+'%'};return _0x1a09e6;})});}_0x20cb35=_[_0xd165('0x4e')]({},_0x20cb35,_0x3e0c36['options']);return _0x481b77[_0xd165('0xa9')](_0x20cb35);}})['then'](function(_0x26cf76){if(_0x26cf76){_0x5880ad=_0x26cf76[_0xd165('0x48')];if(!_0x3e0c36['query']['hasOwnProperty'](_0xd165('0x6c'))){_0x20cb35['limit']=qs[_0xd165('0x2f')](_0x3e0c36['query']['limit']);_0x20cb35[_0xd165('0x2c')]=qs['offset'](_0x3e0c36[_0xd165('0x43')][_0xd165('0x2c')]);}return _0x481b77[_0xd165('0xa9')](_0x20cb35);}})[_0xd165('0x33')](function(_0x2492aa){if(_0x2492aa){return _0x2492aa?{'count':_0x5880ad,'rows':_0x2492aa}:null;}})[_0xd165('0x33')](respondWithResult(_0x1433ec,null))['catch'](handleError(_0x1433ec,null));};exports[_0xd165('0xaa')]=function(_0x5a3de0,_0x4e8478,_0x42d645){var _0x3bba37={'raw':![],'where':{}};var _0x292190={};var _0x224b93={'count':0x0,'rows':[]};return db[_0xd165('0x4f')][_0xd165('0x64')]({'where':{'id':_0x5a3de0[_0xd165('0x55')]['id']}})[_0xd165('0x33')](handleEntityNotFound(_0x4e8478,null))[_0xd165('0x33')](function(_0x499215){if(_0x499215){_0x292190[_0xd165('0x42')]=_['keys'](db[_0xd165('0x8c')][_0xd165('0x3f')]);_0x292190[_0xd165('0x43')]=_['keys'](_0x5a3de0[_0xd165('0x43')]);_0x292190[_0xd165('0x44')]=_[_0xd165('0x45')](_0x292190['model'],_0x292190['query']);_0x3bba37['attributes']=_[_0xd165('0x45')](_0x292190[_0xd165('0x42')],qs[_0xd165('0x47')](_0x5a3de0['query'][_0xd165('0x47')]));_0x3bba37['attributes']=_0x3bba37[_0xd165('0x46')][_0xd165('0x48')]?_0x3bba37['attributes']:_0x292190['model'];if(!_0x5a3de0[_0xd165('0x43')]['hasOwnProperty'](_0xd165('0x6c'))){_0x3bba37[_0xd165('0x2f')]=qs[_0xd165('0x2f')](_0x5a3de0['query'][_0xd165('0x2f')]);_0x3bba37['offset']=qs[_0xd165('0x2c')](_0x5a3de0[_0xd165('0x43')][_0xd165('0x2c')]);}_0x3bba37[_0xd165('0x4a')]=qs[_0xd165('0x4b')](_0x5a3de0[_0xd165('0x43')][_0xd165('0x4b')]);_0x3bba37['where']=qs[_0xd165('0x44')](_[_0xd165('0x66')](_0x5a3de0[_0xd165('0x43')],_0x292190[_0xd165('0x44')]));_0x3bba37[_0xd165('0x4c')][_0xd165('0x62')]=_0x499215['id'];if(_0x5a3de0[_0xd165('0x43')]['filter']){_0x3bba37[_0xd165('0x4c')]=_[_0xd165('0x4e')](_0x3bba37[_0xd165('0x4c')],{'$or':_[_0xd165('0x3e')](_0x3bba37[_0xd165('0x46')],function(_0x385a5b){var _0x870017={};_0x870017[_0x385a5b]={'$like':'%'+_0x5a3de0[_0xd165('0x43')][_0xd165('0x4d')]+'%'};return _0x870017;})});}_0x3bba37=_['merge']({},_0x3bba37,_0x5a3de0[_0xd165('0x57')]);return db[_0xd165('0x8c')][_0xd165('0x2e')]({'where':_0x3bba37[_0xd165('0x4c')]})[_0xd165('0x33')](function(_0x2885cb){_0x224b93['count']=_0x2885cb;if(_0x5a3de0[_0xd165('0x43')][_0xd165('0x50')]){_0x3bba37[_0xd165('0x51')]=[{'model':db[_0xd165('0x6f')],'as':_0xd165('0xab'),'required':![]},{'model':db[_0xd165('0x98')],'as':_0xd165('0xac'),'attributes':[_0xd165('0x39'),_0xd165('0xad'),'internal'],'required':![]},{'model':db[_0xd165('0xae')],'as':'Tags','attributes':['id','name',_0xd165('0xaf')],'where':_0x5a3de0[_0xd165('0x43')][_0xd165('0xb0')]?{'id':_0x5a3de0[_0xd165('0x43')][_0xd165('0xb0')]}:undefined,'required':_0x5a3de0[_0xd165('0x43')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xd165('0x52')](_0x3bba37);})[_0xd165('0x33')](function(_0x300338){_0x224b93[_0xd165('0x53')]=_0x300338;return _0x224b93;});}})[_0xd165('0x33')](respondWithFilteredResult(_0x4e8478,_0x3bba37))['catch'](handleError(_0x4e8478,null));};exports[_0xd165('0xb1')]=function(_0x1e8a78,_0x569192,_0xfc782d){return db[_0xd165('0x4f')]['find']({'where':{'id':_0x1e8a78['params']['id']}})[_0xd165('0x33')](handleEntityNotFound(_0x569192,null))[_0xd165('0x33')](function(_0x1a7a1b){if(_0x1a7a1b){return _0x1a7a1b[_0xd165('0xb1')](_0x1e8a78[_0xd165('0x5a')][_0xd165('0x68')],_['omit'](_0x1e8a78[_0xd165('0x5a')],[_0xd165('0x68'),'id'])||{})[_0xd165('0xb2')](function(_0x489129){for(var _0x2fca94=0x0;_0x2fca94<_0x1e8a78[_0xd165('0x5a')]['ids'][_0xd165('0x48')];_0x2fca94+=0x1){socket['emit'](_0xd165('0xb3'),{'UserId':Number(_0x1e8a78[_0xd165('0x5a')][_0xd165('0x68')][_0x2fca94]),'OpenchannelAccountId':Number(_0x1e8a78[_0xd165('0x55')]['id'])});}return _0x489129;});}})['then'](respondWithResult(_0x569192,null))['catch'](handleError(_0x569192,null));};exports[_0xd165('0xb4')]=function(_0x270be9,_0xb76ac,_0x34e4f0){return db[_0xd165('0x4f')][_0xd165('0x58')]({'where':{'id':_0x270be9[_0xd165('0x55')]['id']}})[_0xd165('0x33')](handleEntityNotFound(_0xb76ac,null))[_0xd165('0x33')](function(_0x3402f0){if(_0x3402f0){return _0x3402f0[_0xd165('0xb4')](_0x270be9['query'][_0xd165('0x68')])[_0xd165('0x33')](function(){if(_[_0xd165('0xb5')](_0x270be9[_0xd165('0x43')][_0xd165('0x68')])){for(var _0x1a0ef3=0x0;_0x1a0ef3<_0x270be9['query']['ids'][_0xd165('0x48')];_0x1a0ef3+=0x1){socket[_0xd165('0xb6')](_0xd165('0xb7'),{'UserId':Number(_0x270be9[_0xd165('0x43')][_0xd165('0x68')][_0x1a0ef3]),'OpenchannelAccountId':Number(_0x270be9[_0xd165('0x55')]['id'])});}}else{socket[_0xd165('0xb6')]('userOpenchannelAccount:remove',{'UserId':Number(_0x270be9[_0xd165('0x43')][_0xd165('0x68')]),'OpenchannelAccountId':Number(_0x270be9[_0xd165('0x55')]['id'])});}});}})[_0xd165('0x33')](respondWithStatusCode(_0xb76ac,null))['catch'](handleError(_0xb76ac,null));};exports['getAgents']=function(_0x40b1e5,_0x19f4f7,_0x5db29a){var _0x1df5e4={};var _0x13948b={};var _0x38b89c;var _0x542a33;return db[_0xd165('0x4f')][_0xd165('0x64')]({'where':{'id':_0x40b1e5[_0xd165('0x55')]['id']}})[_0xd165('0x33')](handleEntityNotFound(_0x19f4f7,null))[_0xd165('0x33')](function(_0x25c111){if(_0x25c111){_0x38b89c=_0x25c111;_0x13948b[_0xd165('0x42')]=_['keys'](db[_0xd165('0x98')][_0xd165('0x3f')]);_0x13948b[_0xd165('0x43')]=_[_0xd165('0x56')](_0x40b1e5[_0xd165('0x43')]);_0x13948b[_0xd165('0x44')]=_[_0xd165('0x45')](_0x13948b[_0xd165('0x42')],_0x13948b[_0xd165('0x43')]);_0x1df5e4[_0xd165('0x46')]=_[_0xd165('0x45')](_0x13948b[_0xd165('0x42')],qs[_0xd165('0x47')](_0x40b1e5[_0xd165('0x43')][_0xd165('0x47')]));_0x1df5e4[_0xd165('0x46')]=_0x1df5e4[_0xd165('0x46')][_0xd165('0x48')]?_0x1df5e4['attributes']:_0x13948b[_0xd165('0x42')];_0x1df5e4[_0xd165('0x4a')]=qs['sort'](_0x40b1e5[_0xd165('0x43')]['sort']);_0x1df5e4['where']=qs['filters'](_[_0xd165('0x66')](_0x40b1e5[_0xd165('0x43')],_0x13948b[_0xd165('0x44')]));if(_0x40b1e5[_0xd165('0x43')][_0xd165('0x4d')]){_0x1df5e4[_0xd165('0x4c')]=_['merge'](_0x1df5e4[_0xd165('0x4c')],{'$or':_[_0xd165('0x3e')](_0x1df5e4[_0xd165('0x46')],function(_0x100f02){var _0x2a2533={};_0x2a2533[_0x100f02]={'$like':'%'+_0x40b1e5[_0xd165('0x43')]['filter']+'%'};return _0x2a2533;})});}_0x1df5e4=_[_0xd165('0x4e')]({},_0x1df5e4,_0x40b1e5[_0xd165('0x57')]);return _0x38b89c[_0xd165('0xb8')](_0x1df5e4);}})['then'](function(_0x70f151){if(_0x70f151){_0x542a33=_0x70f151[_0xd165('0x48')];if(!_0x40b1e5[_0xd165('0x43')][_0xd165('0x49')](_0xd165('0x6c'))){_0x1df5e4[_0xd165('0x2f')]=qs['limit'](_0x40b1e5[_0xd165('0x43')][_0xd165('0x2f')]);_0x1df5e4[_0xd165('0x2c')]=qs[_0xd165('0x2c')](_0x40b1e5['query']['offset']);}return _0x38b89c[_0xd165('0xb8')](_0x1df5e4);}})['then'](function(_0x108681){if(_0x108681){return _0x108681?{'count':_0x542a33,'rows':_0x108681}:null;}})[_0xd165('0x33')](respondWithResult(_0x19f4f7,null))[_0xd165('0x27')](handleError(_0x19f4f7,null));};exports[_0xd165('0x3a')]=function(_0x362c40,_0x1cf98e,_0x34373e){var _0x36e04b,_0x5395f1,_0x59db36;if(_[_0xd165('0x76')](_0x362c40['body'][_0xd165('0x5a')])||_0x362c40[_0xd165('0x5a')][_0xd165('0x5a')]===''){throw new db['Sequelize'][(_0xd165('0x71'))](_0xd165('0x78'));}if(_[_0xd165('0x76')](_0x362c40[_0xd165('0x5a')]['to'])){}_0x36e04b=_0x362c40[_0xd165('0x5a')]['to'];return db['OpenchannelAccount'][_0xd165('0x64')]({'where':{'id':_0x362c40[_0xd165('0x55')]['id']}})[_0xd165('0x33')](handleEntityNotFound(_0x1cf98e,null))['then'](function(_0x4ce6d8){if(_0x4ce6d8){return db[_0xd165('0x4f')][_0xd165('0x58')]({'where':{'id':_0x4ce6d8['id']},'include':[{'model':db[_0xd165('0x7d')],'as':_0xd165('0x7e'),'include':[{'model':db[_0xd165('0x6f')],'as':_0xd165('0x86'),'where':{[_0x4ce6d8[_0xd165('0x79')]]:_0x36e04b},'limit':0x1,'order':[[_0xd165('0x75'),_0xd165('0x7f')]]}]}]})[_0xd165('0x33')](handleEntityNotFound(_0x1cf98e,null))['then'](function(_0x50644b){if(_0x50644b&&_0x50644b[_0xd165('0x7e')]){_0x5395f1=_0x50644b[_0xd165('0x35')]({'plain':!![]});if(_0x5395f1[_0xd165('0x7e')]&&_0x5395f1[_0xd165('0x7e')][_0xd165('0x86')][_0xd165('0x48')]){return _0x5395f1['List'][_0xd165('0x86')][0x0];}return db[_0xd165('0x6f')][_0xd165('0x59')](_[_0xd165('0x19')](_0x362c40['body'],{'firstName':_0x36e04b,[_0x50644b[_0xd165('0x79')]]:_0x36e04b,'phone':_0x36e04b,'ListId':_0x5395f1[_0xd165('0x87')]}));}})[_0xd165('0x33')](handleEntityNotFound(_0x1cf98e,null))[_0xd165('0x33')](function(_0x5b63c9){if(_0x5b63c9){_0x59db36=_0x5b63c9;return db[_0xd165('0x8c')]['find']({'where':{'ContactId':_0x59db36['id'],'closed':![],'OpenchannelAccountId':_0x5395f1['id']}})[_0xd165('0x33')](function(_0x4515ff){if(_0x4515ff){return[_0x4515ff,![]];}return db[_0xd165('0x8c')]['create']({'UserId':_0x362c40[_0xd165('0xb9')]['id'],'ContactId':_0x59db36['id'],'OpenchannelAccountId':_0x5395f1['id'],'lastMsgDirection':_0xd165('0xba'),'firstMsgDirection':'out','Messages':[_[_0xd165('0x4e')](_0x362c40['body'],{'read':![],'body':_0x362c40[_0xd165('0x5a')]['body'],'OpenchannelAccountId':_0x5395f1['id'],'UserId':_0x362c40[_0xd165('0xb9')]['id'],'ContactId':_0x59db36['id']})]},{'include':[{'model':db[_0xd165('0x96')],'as':'Messages'}]})[_0xd165('0x33')](function(_0x3f4fa8){return[_0x3f4fa8,!![]];});});}})[_0xd165('0xb2')](function(_0x206a3e,_0x11cfad){if(_0x11cfad){return _0x206a3e;}return db[_0xd165('0x96')]['create'](_['merge'](_0x362c40['body'],{'read':![],'body':_0x362c40[_0xd165('0x5a')][_0xd165('0x5a')],'OpenchannelAccountId':_0x5395f1['id'],'OpenchannelInteractionId':_0x206a3e['id'],'UserId':_0x362c40['user']['id'],'ContactId':_0x59db36['id']}))[_0xd165('0x33')](function(_0x425330){_0x206a3e[_0xd165('0xbb')]['Messages']=[];_0x206a3e['dataValues'][_0xd165('0xbc')]['push'](_0x425330[_0xd165('0xbb')]);return _0x206a3e;});});}})[_0xd165('0x33')](respondWithResult(_0x1cf98e,null))[_0xd165('0x27')](handleError(_0x1cf98e,null));}; \ No newline at end of file +var _0xf53f=['limit','count','set','Content-Range','json','apply','reject','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','index','Pause','OpenchannelAccount','rawAttributes','fieldName','type','key','map','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','keys','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','describe','addDisposition','OpenchannelAccountId','getDispositions','order','Disposition','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','difference','createdAt','CompanyId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','updatedAt','DESC','OpenchannelApplication','Applications','account','applications','list','priority','asc','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','close','*,*,*,*','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','bulkCreate','finally','getApplications','getInteractions','Contact','internal','Tag','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','http','client','request','then','info','debug','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined'];(function(_0x5906a5,_0x48af0a){var _0x1b9a31=function(_0x4b72ac){while(--_0x4b72ac){_0x5906a5['push'](_0x5906a5['shift']());}};_0x1b9a31(++_0x48af0a);}(_0xf53f,0x8d));var _0xff53=function(_0x25d70f,_0x324ce1){_0x25d70f=_0x25d70f-0x0;var _0x331d46=_0xf53f[_0x25d70f];return _0x331d46;};'use strict';var emlformat=require(_0xff53('0x0'));var rimraf=require(_0xff53('0x1'));var zipdir=require(_0xff53('0x2'));var jsonpatch=require(_0xff53('0x3'));var rp=require(_0xff53('0x4'));var moment=require(_0xff53('0x5'));var BPromise=require(_0xff53('0x6'));var Mustache=require(_0xff53('0x7'));var util=require(_0xff53('0x8'));var path=require(_0xff53('0x9'));var sox=require(_0xff53('0xa'));var csv=require(_0xff53('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff53('0xc'));var squel=require('squel');var crypto=require(_0xff53('0xd'));var jsforce=require(_0xff53('0xe'));var deskjs=require(_0xff53('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xff53('0x10'));var Redis=require('ioredis');var authService=require(_0xff53('0x11'));var qs=require(_0xff53('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff53('0x13'));var logger=require(_0xff53('0x14'))('api');var utils=require(_0xff53('0x15'));var config=require(_0xff53('0x16'));var licenseUtil=require(_0xff53('0x17'));var db=require('../../mysqldb')['db'];config[_0xff53('0x18')]=_[_0xff53('0x19')](config[_0xff53('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xff53('0x1a'))(new Redis(config[_0xff53('0x18')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xff53('0x1b')]({'port':0x232c});var client9002=jayson[_0xff53('0x1c')][_0xff53('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5561ec,_0x37f680,_0x5d7dbd,_0x49949a){return new BPromise(function(_0x12e90b,_0x23caea){var _0x4eea1b=_0x49949a||client;return _0x4eea1b[_0xff53('0x1d')](_0x5561ec,_0x5d7dbd)[_0xff53('0x1e')](function(_0x319ce5){logger[_0xff53('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x37f680,'request\x20sent');logger[_0xff53('0x20')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x37f680,_0xff53('0x21'),JSON[_0xff53('0x22')](_0x319ce5));if(_0x319ce5[_0xff53('0x23')]){if(_0x319ce5[_0xff53('0x23')][_0xff53('0x24')]===0x1f4){logger[_0xff53('0x23')](_0xff53('0x25'),_0x37f680,_0x319ce5[_0xff53('0x23')][_0xff53('0x26')]);return _0x23caea(_0x319ce5['error'][_0xff53('0x26')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x37f680,_0x319ce5['error']['message']);return _0x12e90b(_0x319ce5[_0xff53('0x23')][_0xff53('0x26')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x37f680,_0xff53('0x21'));_0x12e90b(_0x319ce5[_0xff53('0x27')][_0xff53('0x26')]);}})[_0xff53('0x28')](function(_0x462a03){logger[_0xff53('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x37f680,_0x462a03);_0x23caea(_0x462a03);});});}function respondWithStatusCode(_0x4240af,_0x49da9f){_0x49da9f=_0x49da9f||0xcc;return function(_0xbf83e0){if(_0xbf83e0){return _0x4240af[_0xff53('0x29')](_0x49da9f);}return _0x4240af[_0xff53('0x2a')](_0x49da9f)[_0xff53('0x2b')]();};}function respondWithResult(_0x1b7a35,_0x37e39a){_0x37e39a=_0x37e39a||0xc8;return function(_0x43b400){if(_0x43b400){return _0x1b7a35[_0xff53('0x2a')](_0x37e39a)['json'](_0x43b400);}};}function respondWithFilteredResult(_0xe9031f,_0x579164){return function(_0x4b202b){if(_0x4b202b){var _0x25c661=typeof _0x579164[_0xff53('0x2c')]===_0xff53('0x2d')&&typeof _0x579164[_0xff53('0x2e')]===_0xff53('0x2d');var _0x4d870b=_0x4b202b[_0xff53('0x2f')];var _0x5b9661=_0x25c661?0x0:_0x579164[_0xff53('0x2c')];var _0x20e60a=_0x25c661?_0x4b202b[_0xff53('0x2f')]:_0x579164['offset']+_0x579164['limit'];var _0x44170f;if(_0x20e60a>=_0x4d870b){_0x20e60a=_0x4d870b;_0x44170f=0xc8;}else{_0x44170f=0xce;}_0xe9031f[_0xff53('0x2a')](_0x44170f);return _0xe9031f[_0xff53('0x30')](_0xff53('0x31'),_0x5b9661+'-'+_0x20e60a+'/'+_0x4d870b)[_0xff53('0x32')](_0x4b202b);}return null;};}function patchUpdates(_0x380275){return function(_0x539b4d){try{jsonpatch[_0xff53('0x33')](_0x539b4d,_0x380275,!![]);}catch(_0x560623){return BPromise[_0xff53('0x34')](_0x560623);}return _0x539b4d['save']();};}function saveUpdates(_0x2a4d2e,_0x3f6e44){return function(_0x2f34e2){if(_0x2f34e2){return _0x2f34e2[_0xff53('0x35')](_0x2a4d2e)['then'](function(_0x41464a){return _0x41464a;});}return null;};}function removeEntity(_0x134997,_0x18cf7f){return function(_0xad08ab){if(_0xad08ab){return _0xad08ab[_0xff53('0x36')]()[_0xff53('0x1e')](function(){var _0x3a68ac=_0xad08ab[_0xff53('0x37')]({'plain':!![]});var _0x1a9701=_0xff53('0x38');return db[_0xff53('0x39')][_0xff53('0x36')]({'where':{'type':_0x1a9701,'resourceId':_0x3a68ac['id']}})['then'](function(){return _0xad08ab;});})[_0xff53('0x1e')](function(){_0x134997[_0xff53('0x2a')](0xcc)[_0xff53('0x2b')]();});}};}function handleEntityNotFound(_0x237756,_0x1b0731){return function(_0x9ad6f0){if(!_0x9ad6f0){_0x237756[_0xff53('0x29')](0x194);}return _0x9ad6f0;};}function handleError(_0x37dfc3,_0x2b74e5){_0x2b74e5=_0x2b74e5||0x1f4;return function(_0x59847d){logger['error'](_0x59847d[_0xff53('0x3a')]);if(_0x59847d[_0xff53('0x3b')]){delete _0x59847d[_0xff53('0x3b')];}_0x37dfc3['status'](_0x2b74e5)['send'](_0x59847d);};}exports[_0xff53('0x3c')]=function(_0x35e9f9,_0x535d29){var _0x39f6d0={'include':[{'model':db[_0xff53('0x3d')],'as':'mandatoryDispositionPause'}]},_0x25e94b={},_0x34607b={'count':0x0,'rows':[]};var _0xc645b7=_['map'](db[_0xff53('0x3e')][_0xff53('0x3f')],function(_0x299cfd){return{'name':_0x299cfd[_0xff53('0x40')],'type':_0x299cfd[_0xff53('0x41')][_0xff53('0x42')]};});_0x25e94b['model']=_[_0xff53('0x43')](_0xc645b7,'name');_0x25e94b['query']=_['keys'](_0x35e9f9['query']);_0x25e94b[_0xff53('0x44')]=_[_0xff53('0x45')](_0x25e94b[_0xff53('0x46')],_0x25e94b[_0xff53('0x47')]);_0x39f6d0[_0xff53('0x48')]=_['intersection'](_0x25e94b[_0xff53('0x46')],qs[_0xff53('0x49')](_0x35e9f9['query']['fields']));_0x39f6d0[_0xff53('0x48')]=_0x39f6d0[_0xff53('0x48')][_0xff53('0x4a')]?_0x39f6d0['attributes']:_0x25e94b[_0xff53('0x46')];if(!_0x35e9f9['query'][_0xff53('0x4b')](_0xff53('0x4c'))){_0x39f6d0['limit']=qs['limit'](_0x35e9f9['query'][_0xff53('0x2e')]);_0x39f6d0[_0xff53('0x2c')]=qs[_0xff53('0x2c')](_0x35e9f9[_0xff53('0x47')][_0xff53('0x2c')]);}_0x39f6d0['order']=qs[_0xff53('0x4d')](_0x35e9f9[_0xff53('0x47')][_0xff53('0x4d')]);_0x39f6d0[_0xff53('0x4e')]=qs[_0xff53('0x44')](_[_0xff53('0x4f')](_0x35e9f9['query'],_0x25e94b[_0xff53('0x44')]),_0xc645b7);if(_0x35e9f9[_0xff53('0x47')][_0xff53('0x50')]){_0x39f6d0[_0xff53('0x4e')]=_[_0xff53('0x51')](_0x39f6d0[_0xff53('0x4e')],{'$or':_[_0xff53('0x43')](_0xc645b7,function(_0x133ee3){if(_0x133ee3[_0xff53('0x41')]!==_0xff53('0x52')){var _0x2c5fc3={};_0x2c5fc3[_0x133ee3['name']]={'$like':'%'+_0x35e9f9['query'][_0xff53('0x50')]+'%'};return _0x2c5fc3;}})});}_0x39f6d0=_['merge']({},_0x39f6d0,_0x35e9f9[_0xff53('0x53')]);var _0x419eaa={'where':_0x39f6d0[_0xff53('0x4e')]};return db['OpenchannelAccount'][_0xff53('0x2f')](_0x419eaa)['then'](function(_0x2ded5c){_0x34607b[_0xff53('0x2f')]=_0x2ded5c;if(_0x35e9f9[_0xff53('0x47')][_0xff53('0x54')]){_0x39f6d0[_0xff53('0x55')]=[{'all':!![]}];}return db[_0xff53('0x3e')][_0xff53('0x56')](_0x39f6d0);})['then'](function(_0x3a83b5){_0x34607b[_0xff53('0x57')]=_0x3a83b5;return _0x34607b;})['then'](respondWithFilteredResult(_0x535d29,_0x39f6d0))[_0xff53('0x28')](handleError(_0x535d29,null));};exports[_0xff53('0x58')]=function(_0x4254a5,_0x14e2b9){var _0x2daa89={'raw':![],'where':{'id':_0x4254a5[_0xff53('0x59')]['id']},'include':[{'model':db[_0xff53('0x3d')],'as':_0xff53('0x5a')}]},_0x19ea66={};_0x19ea66['model']=_[_0xff53('0x5b')](db[_0xff53('0x3e')][_0xff53('0x3f')]);_0x19ea66[_0xff53('0x47')]=_[_0xff53('0x5b')](_0x4254a5[_0xff53('0x47')]);_0x19ea66[_0xff53('0x44')]=_[_0xff53('0x45')](_0x19ea66[_0xff53('0x46')],_0x19ea66[_0xff53('0x47')]);_0x2daa89[_0xff53('0x48')]=_[_0xff53('0x45')](_0x19ea66[_0xff53('0x46')],qs[_0xff53('0x49')](_0x4254a5['query'][_0xff53('0x49')]));_0x2daa89[_0xff53('0x48')]=_0x2daa89[_0xff53('0x48')][_0xff53('0x4a')]?_0x2daa89[_0xff53('0x48')]:_0x19ea66[_0xff53('0x46')];if(_0x4254a5[_0xff53('0x47')]['includeAll']){_0x2daa89[_0xff53('0x55')]=[{'all':!![]}];}_0x2daa89=_[_0xff53('0x51')]({},_0x2daa89,_0x4254a5[_0xff53('0x53')]);return db[_0xff53('0x3e')][_0xff53('0x5c')](_0x2daa89)[_0xff53('0x1e')](handleEntityNotFound(_0x14e2b9,null))[_0xff53('0x1e')](respondWithResult(_0x14e2b9,null))[_0xff53('0x28')](handleError(_0x14e2b9,null));};exports['create']=function(_0x524067,_0x4ce20e){return db['OpenchannelAccount']['create'](_0x524067[_0xff53('0x5d')],{})[_0xff53('0x1e')](function(_0x470c84){var _0x21e3f5=_0x524067[_0xff53('0x5e')][_0xff53('0x37')]({'plain':!![]});if(!_0x21e3f5)throw new Error(_0xff53('0x5f'));if(_0x21e3f5[_0xff53('0x60')]==='user'){var _0xc8fc7=_0x470c84['get']({'plain':!![]});var _0x46484b=_0xff53('0x38');return db['UserProfileSection']['find']({'where':{'name':_0x46484b,'userProfileId':_0x21e3f5[_0xff53('0x61')]},'raw':!![]})[_0xff53('0x1e')](function(_0xafa098){if(_0xafa098&&_0xafa098[_0xff53('0x62')]===0x0){return db[_0xff53('0x39')][_0xff53('0x63')]({'name':_0xc8fc7['name'],'resourceId':_0xc8fc7['id'],'type':_0xafa098[_0xff53('0x3b')],'sectionId':_0xafa098['id']},{})[_0xff53('0x1e')](function(){return _0x470c84;});}else{return _0x470c84;}})[_0xff53('0x28')](function(_0x4ed1a7){logger[_0xff53('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ed1a7);throw _0x4ed1a7;});}return _0x470c84;})['then'](respondWithResult(_0x4ce20e,0xc9))[_0xff53('0x28')](handleError(_0x4ce20e,null));};exports[_0xff53('0x35')]=function(_0x881621,_0x3cbd1e){if(_0x881621[_0xff53('0x5d')]['id']){delete _0x881621['body']['id'];}return db[_0xff53('0x3e')][_0xff53('0x5c')]({'where':{'id':_0x881621[_0xff53('0x59')]['id']},'include':[{'model':db[_0xff53('0x3d')],'as':_0xff53('0x5a')}]})['then'](handleEntityNotFound(_0x3cbd1e,null))[_0xff53('0x1e')](saveUpdates(_0x881621[_0xff53('0x5d')],null))['then'](respondWithResult(_0x3cbd1e,null))[_0xff53('0x28')](handleError(_0x3cbd1e,null));};exports[_0xff53('0x36')]=function(_0x578f5d,_0x86076b){return db[_0xff53('0x3e')][_0xff53('0x5c')]({'where':{'id':_0x578f5d['params']['id']}})['then'](handleEntityNotFound(_0x86076b,null))[_0xff53('0x1e')](removeEntity(_0x86076b,null))[_0xff53('0x28')](handleError(_0x86076b,null));};exports[_0xff53('0x64')]=function(_0x2ca224,_0x28891d){return db['OpenchannelAccount'][_0xff53('0x64')]()[_0xff53('0x1e')](respondWithResult(_0x28891d,null))[_0xff53('0x28')](handleError(_0x28891d,null));};exports[_0xff53('0x65')]=function(_0x3eaf71,_0x91b7c5,_0x1ae1bb){if(_0x3eaf71[_0xff53('0x5d')]['id']){delete _0x3eaf71['body']['id'];}return db[_0xff53('0x3e')][_0xff53('0x5c')]({'where':{'id':_0x3eaf71[_0xff53('0x59')]['id']}})[_0xff53('0x1e')](handleEntityNotFound(_0x91b7c5,null))[_0xff53('0x1e')](function(_0x11e298){if(_0x11e298){_0x3eaf71[_0xff53('0x5d')][_0xff53('0x66')]=_0x11e298['id'];return db['Disposition'][_0xff53('0x63')](_0x3eaf71[_0xff53('0x5d')]);}})['then'](respondWithResult(_0x91b7c5,null))[_0xff53('0x28')](handleError(_0x91b7c5,null));};exports[_0xff53('0x67')]=function(_0xb55631,_0xe874a2,_0x16c705){var _0x2e3206={'raw':![],'where':{}};var _0x56af21={};var _0x310ee3={'count':0x0,'rows':[]};return db[_0xff53('0x3e')]['findOne']({'where':{'id':_0xb55631[_0xff53('0x59')]['id']}})[_0xff53('0x1e')](handleEntityNotFound(_0xe874a2,null))[_0xff53('0x1e')](function(_0x4e5891){if(_0x4e5891){_0x56af21[_0xff53('0x46')]=_[_0xff53('0x5b')](db['Disposition'][_0xff53('0x3f')]);_0x56af21[_0xff53('0x47')]=_[_0xff53('0x5b')](_0xb55631[_0xff53('0x47')]);_0x56af21[_0xff53('0x44')]=_[_0xff53('0x45')](_0x56af21[_0xff53('0x46')],_0x56af21['query']);_0x2e3206['attributes']=_[_0xff53('0x45')](_0x56af21[_0xff53('0x46')],qs[_0xff53('0x49')](_0xb55631[_0xff53('0x47')][_0xff53('0x49')]));_0x2e3206[_0xff53('0x48')]=_0x2e3206[_0xff53('0x48')][_0xff53('0x4a')]?_0x2e3206[_0xff53('0x48')]:_0x56af21[_0xff53('0x46')];if(!_0xb55631[_0xff53('0x47')]['hasOwnProperty'](_0xff53('0x4c'))){_0x2e3206[_0xff53('0x2e')]=qs['limit'](_0xb55631[_0xff53('0x47')][_0xff53('0x2e')]);_0x2e3206['offset']=qs[_0xff53('0x2c')](_0xb55631['query'][_0xff53('0x2c')]);}_0x2e3206[_0xff53('0x68')]=qs[_0xff53('0x4d')](_0xb55631[_0xff53('0x47')][_0xff53('0x4d')]);_0x2e3206['where']=qs[_0xff53('0x44')](_['pick'](_0xb55631[_0xff53('0x47')],_0x56af21[_0xff53('0x44')]));_0x2e3206['where']['OpenchannelAccountId']=_0x4e5891['id'];if(_0xb55631[_0xff53('0x47')][_0xff53('0x50')]){_0x2e3206[_0xff53('0x4e')]=_[_0xff53('0x51')](_0x2e3206[_0xff53('0x4e')],{'$or':_[_0xff53('0x43')](_0x2e3206[_0xff53('0x48')],function(_0x13aa77){var _0x57b1f9={};_0x57b1f9[_0x13aa77]={'$like':'%'+_0xb55631[_0xff53('0x47')][_0xff53('0x50')]+'%'};return _0x57b1f9;})});}_0x2e3206=_['merge']({},_0x2e3206,_0xb55631['options']);return db[_0xff53('0x69')][_0xff53('0x2f')]({'where':_0x2e3206[_0xff53('0x4e')]})['then'](function(_0xffd7c1){_0x310ee3[_0xff53('0x2f')]=_0xffd7c1;if(_0xb55631[_0xff53('0x47')]['includeAll']){_0x2e3206['include']=[{'all':!![]}];}return db[_0xff53('0x69')][_0xff53('0x56')](_0x2e3206);})[_0xff53('0x1e')](function(_0x2f0df2){_0x310ee3[_0xff53('0x57')]=_0x2f0df2;return _0x310ee3;});}})[_0xff53('0x1e')](respondWithFilteredResult(_0xe874a2,_0x2e3206))[_0xff53('0x28')](handleError(_0xe874a2,null));};exports[_0xff53('0x6a')]=function(_0x59b962,_0x2951d8,_0x19522b){return db[_0xff53('0x3e')][_0xff53('0x5c')]({'where':{'id':_0x59b962[_0xff53('0x59')]['id']}})['then'](handleEntityNotFound(_0x2951d8,null))[_0xff53('0x1e')](function(_0x35b7eb){if(_0x35b7eb){return _0x35b7eb[_0xff53('0x6a')](_0x59b962[_0xff53('0x47')]['ids']);}})[_0xff53('0x1e')](respondWithStatusCode(_0x2951d8,null))[_0xff53('0x28')](handleError(_0x2951d8,null));};exports[_0xff53('0x6b')]=function(_0x20715d,_0x1e7eb0,_0x1ae09d){if(_0x20715d[_0xff53('0x5d')]['id']){delete _0x20715d[_0xff53('0x5d')]['id'];}return db[_0xff53('0x3e')][_0xff53('0x5c')]({'where':{'id':_0x20715d[_0xff53('0x59')]['id']}})[_0xff53('0x1e')](handleEntityNotFound(_0x1e7eb0,null))[_0xff53('0x1e')](function(_0x5d0773){if(_0x5d0773){_0x20715d[_0xff53('0x5d')][_0xff53('0x66')]=_0x5d0773['id'];return db[_0xff53('0x6c')][_0xff53('0x63')](_0x20715d[_0xff53('0x5d')]);}})[_0xff53('0x1e')](respondWithResult(_0x1e7eb0,null))[_0xff53('0x28')](handleError(_0x1e7eb0,null));};exports[_0xff53('0x6d')]=function(_0x3a138c,_0x4e558c,_0x5cabc2){var _0x559db0={'raw':![],'where':{}};var _0x47a031={};var _0x59f354={'count':0x0,'rows':[]};return db[_0xff53('0x3e')]['findOne']({'where':{'id':_0x3a138c[_0xff53('0x59')]['id']}})['then'](handleEntityNotFound(_0x4e558c,null))[_0xff53('0x1e')](function(_0x103d15){if(_0x103d15){_0x47a031[_0xff53('0x46')]=_[_0xff53('0x5b')](db[_0xff53('0x6c')]['rawAttributes']);_0x47a031[_0xff53('0x47')]=_['keys'](_0x3a138c[_0xff53('0x47')]);_0x47a031[_0xff53('0x44')]=_['intersection'](_0x47a031['model'],_0x47a031[_0xff53('0x47')]);_0x559db0['attributes']=_[_0xff53('0x45')](_0x47a031[_0xff53('0x46')],qs[_0xff53('0x49')](_0x3a138c[_0xff53('0x47')]['fields']));_0x559db0['attributes']=_0x559db0[_0xff53('0x48')][_0xff53('0x4a')]?_0x559db0[_0xff53('0x48')]:_0x47a031[_0xff53('0x46')];if(!_0x3a138c[_0xff53('0x47')][_0xff53('0x4b')](_0xff53('0x4c'))){_0x559db0['limit']=qs[_0xff53('0x2e')](_0x3a138c[_0xff53('0x47')][_0xff53('0x2e')]);_0x559db0[_0xff53('0x2c')]=qs[_0xff53('0x2c')](_0x3a138c[_0xff53('0x47')][_0xff53('0x2c')]);}_0x559db0[_0xff53('0x68')]=qs[_0xff53('0x4d')](_0x3a138c[_0xff53('0x47')][_0xff53('0x4d')]);_0x559db0[_0xff53('0x4e')]=qs[_0xff53('0x44')](_['pick'](_0x3a138c[_0xff53('0x47')],_0x47a031['filters']));_0x559db0[_0xff53('0x4e')][_0xff53('0x66')]=_0x103d15['id'];if(_0x3a138c[_0xff53('0x47')]['filter']){_0x559db0[_0xff53('0x4e')]=_[_0xff53('0x51')](_0x559db0[_0xff53('0x4e')],{'$or':_['map'](_0x559db0[_0xff53('0x48')],function(_0x338326){var _0x28af69={};_0x28af69[_0x338326]={'$like':'%'+_0x3a138c['query'][_0xff53('0x50')]+'%'};return _0x28af69;})});}_0x559db0=_[_0xff53('0x51')]({},_0x559db0,_0x3a138c['options']);return db[_0xff53('0x6c')][_0xff53('0x2f')]({'where':_0x559db0['where']})[_0xff53('0x1e')](function(_0x110da5){_0x59f354[_0xff53('0x2f')]=_0x110da5;if(_0x3a138c[_0xff53('0x47')]['includeAll']){_0x559db0[_0xff53('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0xff53('0x56')](_0x559db0);})[_0xff53('0x1e')](function(_0x131986){_0x59f354[_0xff53('0x57')]=_0x131986;return _0x59f354;});}})[_0xff53('0x1e')](respondWithFilteredResult(_0x4e558c,_0x559db0))[_0xff53('0x28')](handleError(_0x4e558c,null));};exports[_0xff53('0x6e')]=function(_0x46078a,_0x58f0bd,_0x56fd70){return db[_0xff53('0x3e')][_0xff53('0x5c')]({'where':{'id':_0x46078a[_0xff53('0x59')]['id']}})[_0xff53('0x1e')](handleEntityNotFound(_0x58f0bd,null))[_0xff53('0x1e')](function(_0x691472){if(_0x691472){return _0x691472[_0xff53('0x6e')](_0x46078a[_0xff53('0x47')][_0xff53('0x6f')]);}})[_0xff53('0x1e')](respondWithStatusCode(_0x58f0bd,null))[_0xff53('0x28')](handleError(_0x58f0bd,null));};exports[_0xff53('0x70')]=function(_0x581894,_0x863e3e,_0x518c3b){var _0x126331={'body':_0x581894[_0xff53('0x5d')],'channel':_0xff53('0x71')};var _0x3e92e0=[];var _0x31f9e4=[];var _0x291965={};var _0x4a0d60=![];return db[_0xff53('0x72')][_0xff53('0x64')]()[_0xff53('0x1e')](function(_0x17a99d){if(!_0x17a99d){throw new db[(_0xff53('0x73'))][(_0xff53('0x74'))]('no\x20available\x20attributes');}_0x3e92e0=_[_0xff53('0x75')](_[_0xff53('0x5b')](_0x17a99d),[_0xff53('0x76'),'updatedAt']);_0x31f9e4=_[_0xff53('0x75')](_[_0xff53('0x5b')](_0x17a99d),[_0xff53('0x76'),'updatedAt',_0xff53('0x77'),'ListId']);if(_0x581894[_0xff53('0x5d')]['id']){delete _0x581894[_0xff53('0x5d')]['id'];}if(_[_0xff53('0x78')](_0x581894[_0xff53('0x5d')][_0xff53('0x79')])){throw new db['Sequelize']['ValidationError'](_0xff53('0x7a'));}if(_[_0xff53('0x78')](_0x581894['body']['body'])||_0x581894[_0xff53('0x5d')][_0xff53('0x5d')]===''){throw new db[(_0xff53('0x73'))][(_0xff53('0x74'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xff53('0x78')](_0x581894['body'][_0xff53('0x7b')])){throw new db[(_0xff53('0x73'))]['ValidationError'](_0xff53('0x7c')+_0x31f9e4);}if(!_[_0xff53('0x7d')](_0x31f9e4,_0x581894['body']['mapKey'])){throw new db[(_0xff53('0x73'))][(_0xff53('0x74'))](_0xff53('0x7e')+_0x31f9e4);}_0x291965[_0x581894[_0xff53('0x5d')][_0xff53('0x7b')]]=_0x581894[_0xff53('0x5d')][_0xff53('0x79')];})['then'](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x581894[_0xff53('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0xff53('0x7f'),'include':[{'model':db[_0xff53('0x72')],'as':_0xff53('0x80'),'where':_0x291965,'limit':0x1,'order':[[_0xff53('0x81'),_0xff53('0x82')]]}]},{'model':db[_0xff53('0x83')],'as':_0xff53('0x84')}]});})[_0xff53('0x1e')](handleEntityNotFound(_0x863e3e,null))[_0xff53('0x1e')](function(_0x4e3a7f){if(_0x4e3a7f&&_0x4e3a7f[_0xff53('0x7f')]){_0x126331[_0xff53('0x85')]=_0x4e3a7f;_0x126331[_0xff53('0x86')]=_0x4e3a7f['Applications'];_0x126331[_0xff53('0x87')]=_0x4e3a7f[_0xff53('0x7f')];_0x126331['applications']=_['orderBy'](_0x126331['applications'],[_0xff53('0x88')],[_0xff53('0x89')]);if(_0x126331[_0xff53('0x85')][_0xff53('0x84')]){delete _0x126331[_0xff53('0x85')][_0xff53('0x84')];}if(_0x126331[_0xff53('0x85')][_0xff53('0x7f')]&&_0x126331[_0xff53('0x85')][_0xff53('0x7f')][_0xff53('0x80')][_0xff53('0x4a')]){return _0x126331[_0xff53('0x85')]['List']['Contacts'][0x0];}var _0x3a5e67=_[_0xff53('0x19')](_0x581894['body'],{'firstName':_0x581894[_0xff53('0x5d')][_0xff53('0x79')],'ListId':_0x4e3a7f[_0xff53('0x8a')]});_0x3a5e67[_0x581894[_0xff53('0x5d')][_0xff53('0x7b')]]=_0x581894[_0xff53('0x5d')][_0xff53('0x79')];return db[_0xff53('0x72')][_0xff53('0x63')](_0x3a5e67,{'fields':_0x3e92e0,'raw':!![]});}})[_0xff53('0x1e')](handleEntityNotFound(_0x863e3e,null))[_0xff53('0x1e')](function(_0x2e4e0b){_0x126331[_0xff53('0x8b')]=_0x2e4e0b;if(_0x2e4e0b){var _0x125d60={'ContactId':_0x2e4e0b['id'],'OpenchannelAccountId':_0x581894[_0xff53('0x59')]['id'],'from':(_0x2e4e0b[_0xff53('0x8c')]||'')+'\x20'+(_0x2e4e0b[_0xff53('0x8d')]||'')};var _0x4f15e1={'OpenchannelAccountId':_0x581894['params']['id'],'closed':![]};if(_0x581894[_0xff53('0x5d')]['threadId']){_0x4f15e1[_0xff53('0x8e')]=_0x581894[_0xff53('0x5d')][_0xff53('0x8e')];return db[_0xff53('0x8f')][_0xff53('0x5c')]({'where':_0x4f15e1})[_0xff53('0x1e')](function(_0x560b4e){if(_0x560b4e){return[_0x560b4e,![]];}_0x125d60['threadId']=_0x581894[_0xff53('0x5d')][_0xff53('0x8e')];_0x125d60['externalUrl']=_0x581894['body'][_0xff53('0x90')];return db[_0xff53('0x8f')][_0xff53('0x63')](_0x125d60)[_0xff53('0x1e')](function(_0x590a43){return[_0x590a43,!![]];});});}else{_0x4f15e1[_0xff53('0x8e')]=null;}_0x4f15e1['ContactId']=_0x2e4e0b['id'];return db[_0xff53('0x8f')][_0xff53('0x5c')]({'where':_0x4f15e1})['then'](function(_0x16dc09){if(_0x16dc09){return[_0x16dc09,![]];}return db[_0xff53('0x8f')][_0xff53('0x63')](_0x125d60)[_0xff53('0x1e')](function(_0x17f170){return[_0x17f170,!![]];});});}})[_0xff53('0x91')](function(_0xf7200e,_0x2a9b82){if(_0xf7200e){_0x4a0d60=_0x2a9b82;if(!_0x2a9b82){var _0x25b173={'from':(_0x126331[_0xff53('0x8b')][_0xff53('0x8c')]||'')+'\x20'+(_0x126331['contact'][_0xff53('0x8d')]||'')};if(_0x581894['body'][_0xff53('0x8e')]&&_0x581894[_0xff53('0x5d')][_0xff53('0x92')]&&_0x581894[_0xff53('0x5d')][_0xff53('0x8e')]!=_0x581894[_0xff53('0x5d')]['messageId']){_0x25b173['threadId']=_0x581894['body']['messageId'];}return _0xf7200e['update'](_0x25b173);}else{return _0xf7200e;}}})['then'](function(_0x33d207){_0x126331[_0xff53('0x93')]=_0x33d207[_0xff53('0x37')]({'plain':!![]});_0x126331[_0xff53('0x93')]['created']=_0x4a0d60;if(_0x126331['interaction']['created']){if(_0x126331[_0xff53('0x85')]['autoclose']){_0x126331[_0xff53('0x86')]['push']({'id':0x0,'priority':_0x126331[_0xff53('0x86')][_0xff53('0x4a')]+0x1,'app':_0xff53('0x94'),'appdata':'unmanaged','interval':_0xff53('0x95')});}}return db['OpenchannelMessage'][_0xff53('0x63')]({'body':_0x581894['body'][_0xff53('0x5d')],'OpenchannelAccountId':_0x581894[_0xff53('0x59')]['id'],'OpenchannelInteractionId':_0x33d207['id'],'direction':'in','ContactId':_0x126331['contact']['id'],'AttachmentId':_0x581894[_0xff53('0x5d')][_0xff53('0x96')]});})[_0xff53('0x1e')](function(_0x3f4470){_0x126331[_0xff53('0x26')]=_0x3f4470;if(_0x126331['interaction'][_0xff53('0x97')]){return db[_0xff53('0x98')][_0xff53('0x5c')]({'attributes':['id',_0xff53('0x3b')],'where':{'id':_0x126331[_0xff53('0x93')][_0xff53('0x97')]}})[_0xff53('0x1e')](function(_0x3722bf){if(_0x3722bf){_0x126331['applications'][_0xff53('0x99')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3722bf[_0xff53('0x3b')]+','+(_0x126331[_0xff53('0x85')][_0xff53('0x9a')]||0xa),'interval':_0xff53('0x95')});_0x126331['forcedOwnership']=![];}return respondWithRpcPromise(_0xff53('0x9b'),_0xff53('0x9c'),_0x126331);});}return respondWithRpcPromise(_0xff53('0x9b'),_0xff53('0x9c'),_0x126331);})[_0xff53('0x1e')](function(_0x264b34){respondWithRpcPromise('EventManager','EventManager',{'event':_0xff53('0x70'),'message':_0x264b34},client9002);return _0x264b34;})[_0xff53('0x1e')](respondWithResult(_0x863e3e,null))[_0xff53('0x28')](handleError(_0x863e3e,null));};exports[_0xff53('0x9d')]=function(_0x2df1fe,_0x42a875){var _0x23c87f=_0x2df1fe[_0xff53('0x59')]['id'];var _0x120a10=_0x2df1fe['body'];var _0x4efdf0=0xc8;var _0x49c933=null;return db[_0xff53('0x9e')][_0xff53('0x9f')]({'isolationLevel':db[_0xff53('0x9e')][_0xff53('0xa0')][_0xff53('0xa1')][_0xff53('0xa2')]},function(_0x3b9eca){return db[_0xff53('0x3e')][_0xff53('0xa3')]({'where':{'id':_0x23c87f},'transaction':_0x3b9eca})[_0xff53('0x1e')](function(_0x340476){if(_0x340476){return db[_0xff53('0x83')]['destroy']({'where':{'OpenchannelAccountId':_0x23c87f},'transaction':_0x3b9eca})[_0xff53('0x1e')](function(){var _0x418e53=_[_0xff53('0x43')](_0x120a10,function(_0x3331a3){_0x3331a3[_0xff53('0x66')]=_0x23c87f;return _0x3331a3;});return db['OpenchannelApplication'][_0xff53('0xa4')](_0x418e53,{'transaction':_0x3b9eca});});}else{_0x4efdf0=0x194;_0x49c933=[];}});})[_0xff53('0x1e')](function(){if(_0x4efdf0!==0x194){return db[_0xff53('0x83')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x23c87f},'order':_0xff53('0x88')})[_0xff53('0x1e')](function(_0x42939a){_0x49c933=_0x42939a;});}})[_0xff53('0x28')](function(_0x4334a8){_0x4efdf0=0x1f4;logger[_0xff53('0x23')](_0x4334a8[_0xff53('0x3a')]);if(_0x4334a8[_0xff53('0x3b')]){delete _0x4334a8[_0xff53('0x3b')];}_0x49c933=_0x4334a8;})[_0xff53('0xa5')](function(){if(_0x49c933===null){_0x42a875[_0xff53('0x29')](_0x4efdf0);}else{if(_0x4efdf0===0x1f4){_0x42a875['status'](_0x4efdf0)['send'](_0x49c933);}else{_0x42a875[_0xff53('0x2a')](_0x4efdf0)[_0xff53('0x32')](_0x49c933);}}});};exports[_0xff53('0xa6')]=function(_0x1f2562,_0x297c0a,_0x48f8d1){var _0x40bcca={};var _0x223610={};var _0x448baf;var _0x4c52b4;return db[_0xff53('0x3e')][_0xff53('0xa3')]({'where':{'id':_0x1f2562[_0xff53('0x59')]['id']}})[_0xff53('0x1e')](handleEntityNotFound(_0x297c0a,null))[_0xff53('0x1e')](function(_0x44bcb0){if(_0x44bcb0){_0x448baf=_0x44bcb0;_0x223610['model']=_[_0xff53('0x5b')](db[_0xff53('0x83')]['rawAttributes']);_0x223610[_0xff53('0x47')]=_[_0xff53('0x5b')](_0x1f2562[_0xff53('0x47')]);_0x223610[_0xff53('0x44')]=_[_0xff53('0x45')](_0x223610[_0xff53('0x46')],_0x223610[_0xff53('0x47')]);_0x40bcca[_0xff53('0x48')]=_[_0xff53('0x45')](_0x223610[_0xff53('0x46')],qs[_0xff53('0x49')](_0x1f2562['query'][_0xff53('0x49')]));_0x40bcca[_0xff53('0x48')]=_0x40bcca[_0xff53('0x48')]['length']?_0x40bcca[_0xff53('0x48')]:_0x223610['model'];_0x40bcca[_0xff53('0x68')]=qs['sort'](_0x1f2562[_0xff53('0x47')][_0xff53('0x4d')]);_0x40bcca[_0xff53('0x4e')]=qs[_0xff53('0x44')](_[_0xff53('0x4f')](_0x1f2562['query'],_0x223610[_0xff53('0x44')]));if(_0x1f2562[_0xff53('0x47')][_0xff53('0x50')]){_0x40bcca[_0xff53('0x4e')]=_[_0xff53('0x51')](_0x40bcca[_0xff53('0x4e')],{'$or':_[_0xff53('0x43')](_0x40bcca[_0xff53('0x48')],function(_0x1c059a){var _0x5b319d={};_0x5b319d[_0x1c059a]={'$like':'%'+_0x1f2562[_0xff53('0x47')][_0xff53('0x50')]+'%'};return _0x5b319d;})});}_0x40bcca=_[_0xff53('0x51')]({},_0x40bcca,_0x1f2562[_0xff53('0x53')]);return _0x448baf[_0xff53('0xa6')](_0x40bcca);}})[_0xff53('0x1e')](function(_0x54cddc){if(_0x54cddc){_0x4c52b4=_0x54cddc[_0xff53('0x4a')];if(!_0x1f2562['query'][_0xff53('0x4b')](_0xff53('0x4c'))){_0x40bcca['limit']=qs[_0xff53('0x2e')](_0x1f2562[_0xff53('0x47')][_0xff53('0x2e')]);_0x40bcca[_0xff53('0x2c')]=qs[_0xff53('0x2c')](_0x1f2562[_0xff53('0x47')][_0xff53('0x2c')]);}return _0x448baf[_0xff53('0xa6')](_0x40bcca);}})[_0xff53('0x1e')](function(_0x501da9){if(_0x501da9){return _0x501da9?{'count':_0x4c52b4,'rows':_0x501da9}:null;}})[_0xff53('0x1e')](respondWithResult(_0x297c0a,null))[_0xff53('0x28')](handleError(_0x297c0a,null));};exports[_0xff53('0xa7')]=function(_0xadbb0a,_0x17127a,_0xf2c647){var _0x4dc3cd={'raw':![],'where':{}};var _0x54bc0a={};var _0x5adc47={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xff53('0xa3')]({'where':{'id':_0xadbb0a['params']['id']}})[_0xff53('0x1e')](handleEntityNotFound(_0x17127a,null))[_0xff53('0x1e')](function(_0x4aec18){if(_0x4aec18){_0x54bc0a['model']=_['keys'](db[_0xff53('0x8f')]['rawAttributes']);_0x54bc0a[_0xff53('0x47')]=_['keys'](_0xadbb0a[_0xff53('0x47')]);_0x54bc0a[_0xff53('0x44')]=_['intersection'](_0x54bc0a['model'],_0x54bc0a['query']);_0x4dc3cd[_0xff53('0x48')]=_[_0xff53('0x45')](_0x54bc0a['model'],qs['fields'](_0xadbb0a[_0xff53('0x47')][_0xff53('0x49')]));_0x4dc3cd[_0xff53('0x48')]=_0x4dc3cd[_0xff53('0x48')][_0xff53('0x4a')]?_0x4dc3cd[_0xff53('0x48')]:_0x54bc0a[_0xff53('0x46')];if(!_0xadbb0a[_0xff53('0x47')][_0xff53('0x4b')](_0xff53('0x4c'))){_0x4dc3cd[_0xff53('0x2e')]=qs[_0xff53('0x2e')](_0xadbb0a['query'][_0xff53('0x2e')]);_0x4dc3cd['offset']=qs[_0xff53('0x2c')](_0xadbb0a[_0xff53('0x47')][_0xff53('0x2c')]);}_0x4dc3cd[_0xff53('0x68')]=qs['sort'](_0xadbb0a[_0xff53('0x47')][_0xff53('0x4d')]);_0x4dc3cd['where']=qs['filters'](_[_0xff53('0x4f')](_0xadbb0a[_0xff53('0x47')],_0x54bc0a[_0xff53('0x44')]));_0x4dc3cd['where'][_0xff53('0x66')]=_0x4aec18['id'];if(_0xadbb0a[_0xff53('0x47')][_0xff53('0x50')]){_0x4dc3cd['where']=_['merge'](_0x4dc3cd[_0xff53('0x4e')],{'$or':_[_0xff53('0x43')](_0x4dc3cd[_0xff53('0x48')],function(_0xf5cd1a){var _0x404841={};_0x404841[_0xf5cd1a]={'$like':'%'+_0xadbb0a['query'][_0xff53('0x50')]+'%'};return _0x404841;})});}_0x4dc3cd=_['merge']({},_0x4dc3cd,_0xadbb0a[_0xff53('0x53')]);return db[_0xff53('0x8f')][_0xff53('0x2f')]({'where':_0x4dc3cd[_0xff53('0x4e')]})[_0xff53('0x1e')](function(_0x2c90b9){_0x5adc47[_0xff53('0x2f')]=_0x2c90b9;if(_0xadbb0a[_0xff53('0x47')][_0xff53('0x54')]){_0x4dc3cd[_0xff53('0x55')]=[{'model':db[_0xff53('0x72')],'as':_0xff53('0xa8'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name','fullname',_0xff53('0xa9')],'required':![]},{'model':db[_0xff53('0xaa')],'as':'Tags','attributes':['id',_0xff53('0x3b'),'color'],'where':_0xadbb0a[_0xff53('0x47')][_0xff53('0xab')]?{'id':_0xadbb0a['query'][_0xff53('0xab')]}:undefined,'required':_0xadbb0a[_0xff53('0x47')][_0xff53('0xab')]?!![]:![]}];}return db[_0xff53('0x8f')]['findAll'](_0x4dc3cd);})[_0xff53('0x1e')](function(_0x294a5c){_0x5adc47[_0xff53('0x57')]=_0x294a5c;return _0x5adc47;});}})[_0xff53('0x1e')](respondWithFilteredResult(_0x17127a,_0x4dc3cd))[_0xff53('0x28')](handleError(_0x17127a,null));};exports[_0xff53('0xac')]=function(_0x19fcc1,_0x493ab3,_0x24c036){return db['OpenchannelAccount']['find']({'where':{'id':_0x19fcc1[_0xff53('0x59')]['id']}})[_0xff53('0x1e')](handleEntityNotFound(_0x493ab3,null))['then'](function(_0x36a412){if(_0x36a412){return _0x36a412[_0xff53('0xac')](_0x19fcc1['body'][_0xff53('0x6f')],_[_0xff53('0xad')](_0x19fcc1[_0xff53('0x5d')],[_0xff53('0x6f'),'id'])||{})[_0xff53('0x91')](function(_0x83ac1a){for(var _0x1afb1e=0x0;_0x1afb1e<_0x19fcc1['body'][_0xff53('0x6f')]['length'];_0x1afb1e+=0x1){socket[_0xff53('0xae')](_0xff53('0xaf'),{'UserId':Number(_0x19fcc1['body'][_0xff53('0x6f')][_0x1afb1e]),'OpenchannelAccountId':Number(_0x19fcc1[_0xff53('0x59')]['id'])});}return _0x83ac1a;});}})[_0xff53('0x1e')](respondWithResult(_0x493ab3,null))[_0xff53('0x28')](handleError(_0x493ab3,null));};exports[_0xff53('0xb0')]=function(_0x1fbd5e,_0x1d1223,_0x554f05){return db[_0xff53('0x3e')][_0xff53('0x5c')]({'where':{'id':_0x1fbd5e[_0xff53('0x59')]['id']}})[_0xff53('0x1e')](handleEntityNotFound(_0x1d1223,null))[_0xff53('0x1e')](function(_0x188b75){if(_0x188b75){return _0x188b75[_0xff53('0xb0')](_0x1fbd5e[_0xff53('0x47')][_0xff53('0x6f')])[_0xff53('0x1e')](function(){if(_[_0xff53('0xb1')](_0x1fbd5e[_0xff53('0x47')][_0xff53('0x6f')])){for(var _0xb3918=0x0;_0xb3918<_0x1fbd5e[_0xff53('0x47')][_0xff53('0x6f')][_0xff53('0x4a')];_0xb3918+=0x1){socket[_0xff53('0xae')](_0xff53('0xb2'),{'UserId':Number(_0x1fbd5e[_0xff53('0x47')][_0xff53('0x6f')][_0xb3918]),'OpenchannelAccountId':Number(_0x1fbd5e[_0xff53('0x59')]['id'])});}}else{socket[_0xff53('0xae')](_0xff53('0xb2'),{'UserId':Number(_0x1fbd5e['query'][_0xff53('0x6f')]),'OpenchannelAccountId':Number(_0x1fbd5e[_0xff53('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x1d1223,null))[_0xff53('0x28')](handleError(_0x1d1223,null));};exports[_0xff53('0xb3')]=function(_0x1051a4,_0x24ca00,_0x24511e){var _0x510b11={};var _0x4e1171={};var _0x416caf;var _0x5d8f40;return db[_0xff53('0x3e')][_0xff53('0xa3')]({'where':{'id':_0x1051a4[_0xff53('0x59')]['id']}})['then'](handleEntityNotFound(_0x24ca00,null))['then'](function(_0x4d6ae7){if(_0x4d6ae7){_0x416caf=_0x4d6ae7;_0x4e1171[_0xff53('0x46')]=_[_0xff53('0x5b')](db[_0xff53('0x98')][_0xff53('0x3f')]);_0x4e1171['query']=_[_0xff53('0x5b')](_0x1051a4['query']);_0x4e1171[_0xff53('0x44')]=_[_0xff53('0x45')](_0x4e1171[_0xff53('0x46')],_0x4e1171[_0xff53('0x47')]);_0x510b11['attributes']=_[_0xff53('0x45')](_0x4e1171[_0xff53('0x46')],qs[_0xff53('0x49')](_0x1051a4['query']['fields']));_0x510b11[_0xff53('0x48')]=_0x510b11[_0xff53('0x48')][_0xff53('0x4a')]?_0x510b11[_0xff53('0x48')]:_0x4e1171[_0xff53('0x46')];_0x510b11[_0xff53('0x68')]=qs[_0xff53('0x4d')](_0x1051a4['query'][_0xff53('0x4d')]);_0x510b11[_0xff53('0x4e')]=qs[_0xff53('0x44')](_[_0xff53('0x4f')](_0x1051a4['query'],_0x4e1171[_0xff53('0x44')]));if(_0x1051a4[_0xff53('0x47')][_0xff53('0x50')]){_0x510b11[_0xff53('0x4e')]=_[_0xff53('0x51')](_0x510b11[_0xff53('0x4e')],{'$or':_[_0xff53('0x43')](_0x510b11[_0xff53('0x48')],function(_0x23a6b9){var _0x3fa29d={};_0x3fa29d[_0x23a6b9]={'$like':'%'+_0x1051a4[_0xff53('0x47')][_0xff53('0x50')]+'%'};return _0x3fa29d;})});}_0x510b11=_[_0xff53('0x51')]({},_0x510b11,_0x1051a4[_0xff53('0x53')]);return _0x416caf[_0xff53('0xb3')](_0x510b11);}})['then'](function(_0x1b6c34){if(_0x1b6c34){_0x5d8f40=_0x1b6c34[_0xff53('0x4a')];if(!_0x1051a4[_0xff53('0x47')]['hasOwnProperty'](_0xff53('0x4c'))){_0x510b11[_0xff53('0x2e')]=qs[_0xff53('0x2e')](_0x1051a4[_0xff53('0x47')][_0xff53('0x2e')]);_0x510b11[_0xff53('0x2c')]=qs[_0xff53('0x2c')](_0x1051a4[_0xff53('0x47')]['offset']);}return _0x416caf[_0xff53('0xb3')](_0x510b11);}})[_0xff53('0x1e')](function(_0xf2ca7c){if(_0xf2ca7c){return _0xf2ca7c?{'count':_0x5d8f40,'rows':_0xf2ca7c}:null;}})[_0xff53('0x1e')](respondWithResult(_0x24ca00,null))[_0xff53('0x28')](handleError(_0x24ca00,null));};exports[_0xff53('0xb4')]=function(_0x2c1aee,_0x3abc19,_0x34ab7a){var _0x2ee3f9,_0x26e7d9,_0x57b3a8;if(_['isNil'](_0x2c1aee[_0xff53('0x5d')][_0xff53('0x5d')])||_0x2c1aee[_0xff53('0x5d')]['body']===''){throw new db[(_0xff53('0x73'))][(_0xff53('0x74'))](_0xff53('0xb5'));}if(_[_0xff53('0x78')](_0x2c1aee[_0xff53('0x5d')]['to'])){}_0x2ee3f9=_0x2c1aee[_0xff53('0x5d')]['to'];return db[_0xff53('0x3e')][_0xff53('0xa3')]({'where':{'id':_0x2c1aee[_0xff53('0x59')]['id']}})[_0xff53('0x1e')](handleEntityNotFound(_0x3abc19,null))[_0xff53('0x1e')](function(_0xe4f204){if(_0xe4f204){return db[_0xff53('0x3e')][_0xff53('0x5c')]({'where':{'id':_0xe4f204['id']},'include':[{'model':db[_0xff53('0xb6')],'as':_0xff53('0x7f'),'include':[{'model':db[_0xff53('0x72')],'as':_0xff53('0x80'),'where':{[_0xe4f204[_0xff53('0x7b')]]:_0x2ee3f9},'limit':0x1,'order':[[_0xff53('0x81'),_0xff53('0x82')]]}]}]})['then'](handleEntityNotFound(_0x3abc19,null))[_0xff53('0x1e')](function(_0x48da57){if(_0x48da57&&_0x48da57[_0xff53('0x7f')]){_0x26e7d9=_0x48da57[_0xff53('0x37')]({'plain':!![]});if(_0x26e7d9[_0xff53('0x7f')]&&_0x26e7d9[_0xff53('0x7f')][_0xff53('0x80')][_0xff53('0x4a')]){return _0x26e7d9[_0xff53('0x7f')]['Contacts'][0x0];}return db[_0xff53('0x72')]['create'](_[_0xff53('0x19')](_0x2c1aee[_0xff53('0x5d')],{'firstName':_0x2ee3f9,[_0x48da57['mapKey']]:_0x2ee3f9,'phone':_0x2ee3f9,'ListId':_0x26e7d9['ListId']}));}})['then'](handleEntityNotFound(_0x3abc19,null))['then'](function(_0x1429bd){if(_0x1429bd){_0x57b3a8=_0x1429bd;return db[_0xff53('0x8f')][_0xff53('0x5c')]({'where':{'ContactId':_0x57b3a8['id'],'closed':![],'OpenchannelAccountId':_0x26e7d9['id']}})[_0xff53('0x1e')](function(_0x272a35){if(_0x272a35){return[_0x272a35,![]];}return db[_0xff53('0x8f')]['create']({'UserId':_0x2c1aee[_0xff53('0x5e')]['id'],'ContactId':_0x57b3a8['id'],'OpenchannelAccountId':_0x26e7d9['id'],'lastMsgDirection':_0xff53('0xb7'),'firstMsgDirection':_0xff53('0xb7'),'Messages':[_['merge'](_0x2c1aee[_0xff53('0x5d')],{'read':![],'body':_0x2c1aee['body'][_0xff53('0x5d')],'OpenchannelAccountId':_0x26e7d9['id'],'UserId':_0x2c1aee[_0xff53('0x5e')]['id'],'ContactId':_0x57b3a8['id']})]},{'include':[{'model':db[_0xff53('0xb8')],'as':_0xff53('0xb9')}]})['then'](function(_0x36975f){return[_0x36975f,!![]];});});}})[_0xff53('0x91')](function(_0x45e87a,_0x18f933){if(_0x18f933){return _0x45e87a;}return db['OpenchannelMessage'][_0xff53('0x63')](_['merge'](_0x2c1aee['body'],{'read':![],'body':_0x2c1aee['body'][_0xff53('0x5d')],'OpenchannelAccountId':_0x26e7d9['id'],'OpenchannelInteractionId':_0x45e87a['id'],'UserId':_0x2c1aee[_0xff53('0x5e')]['id'],'ContactId':_0x57b3a8['id']}))[_0xff53('0x1e')](function(_0x5d1518){_0x45e87a['dataValues'][_0xff53('0xb9')]=[];_0x45e87a[_0xff53('0xba')][_0xff53('0xb9')]['push'](_0x5d1518[_0xff53('0xba')]);return _0x45e87a;});});}})[_0xff53('0x1e')](respondWithResult(_0x3abc19,null))[_0xff53('0x28')](handleError(_0x3abc19,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 9e53e03..ad43ed5 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ff3=['emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','update','remove'];(function(_0x25b145,_0x235d47){var _0x481e11=function(_0x5e76f1){while(--_0x5e76f1){_0x25b145['push'](_0x25b145['shift']());}};_0x481e11(++_0x235d47);}(_0x5ff3,0x17d));var _0x35ff=function(_0x58ea84,_0x1d7804){_0x58ea84=_0x58ea84-0x0;var _0x38380a=_0x5ff3[_0x58ea84];return _0x38380a;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x35ff('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x35ff('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x35ff('0x2'),'afterDestroy':_0x35ff('0x3')};function emitEvent(_0x3bd66a){return function(_0xd0846d,_0x551514,_0x2fcb74){OpenchannelAccountEvents[_0x35ff('0x4')](_0x3bd66a+':'+_0xd0846d['id'],_0xd0846d);OpenchannelAccountEvents[_0x35ff('0x4')](_0x3bd66a,_0xd0846d);_0x2fcb74(null);};}for(var e in events){if(events[_0x35ff('0x5')](e)){var event=events[e];OpenchannelAccount[_0x35ff('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xda3f=['exports','../../mysqldb','OpenchannelAccount','remove','emit'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0xda3f,0xec));var _0xfda3=function(_0x30579a,_0xa0ba88){_0x30579a=_0x30579a-0x0;var _0x218543=_0xda3f[_0x30579a];return _0x218543;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xfda3('0x0'))['db'][_0xfda3('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfda3('0x2')};function emitEvent(_0x581693){return function(_0x36dc71,_0x22187d,_0x516500){OpenchannelAccountEvents[_0xfda3('0x3')](_0x581693+':'+_0x36dc71['id'],_0x36dc71);OpenchannelAccountEvents[_0xfda3('0x3')](_0x581693,_0x36dc71);_0x516500(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xfda3('0x4')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 1dea9e1..db95957 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(_0x529677,_0x4198c0){var _0x5796ce=function(_0x4ac7ef){while(--_0x4ac7ef){_0x529677['push'](_0x529677['shift']());}};_0x5796ce(++_0x4198c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x1a1e92,_0x36cffd){var _0x11f385=function(_0x57cb45){while(--_0x57cb45){_0x1a1e92['push'](_0x1a1e92['shift']());}};_0x11f385(++_0x36cffd);}(_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 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 1734d4a..df26b47 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 _0x8580=['http','redis','defaults','localhost','socket.io-emitter','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x1bf75d,_0x1d3920){var _0x5cce12=function(_0x5b5170){while(--_0x5b5170){_0x1bf75d['push'](_0x1bf75d['shift']());}};_0x5cce12(++_0x1d3920);}(_0x8580,0x1c7));var _0x0858=function(_0x4f8335,_0x50fa6a){_0x4f8335=_0x4f8335-0x0;var _0x24080a=_0x8580[_0x4f8335];return _0x24080a;};'use strict';var _=require('lodash');var util=require(_0x0858('0x0'));var moment=require('moment');var BPromise=require(_0x0858('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0858('0x2'))['db'];var utils=require(_0x0858('0x3'));var logger=require('../../config/logger')(_0x0858('0x4'));var config=require(_0x0858('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0858('0x6')][_0x0858('0x7')]({'port':0x232a});config[_0x0858('0x8')]=_[_0x0858('0x9')](config['redis'],{'host':_0x0858('0xa'),'port':0x18eb});var socket=require(_0x0858('0xb'))(new Redis(config[_0x0858('0x8')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x470459,_0x4b5072,_0x24996d){return new BPromise(function(_0x1c214c,_0x38371f){return client[_0x0858('0xc')](_0x470459,_0x24996d)[_0x0858('0xd')](function(_0x207cda){logger[_0x0858('0xe')](_0x0858('0xf'),_0x4b5072,'request\x20sent');logger['debug'](_0x0858('0x10'),_0x4b5072,'request\x20sent',JSON['stringify'](_0x207cda));if(_0x207cda['error']){if(_0x207cda[_0x0858('0x11')][_0x0858('0x12')]===0x1f4){logger['error'](_0x0858('0xf'),_0x4b5072,_0x207cda[_0x0858('0x11')][_0x0858('0x13')]);return _0x38371f(_0x207cda[_0x0858('0x11')][_0x0858('0x13')]);}logger[_0x0858('0x11')](_0x0858('0xf'),_0x4b5072,_0x207cda[_0x0858('0x11')][_0x0858('0x13')]);return _0x1c214c(_0x207cda[_0x0858('0x11')][_0x0858('0x13')]);}else{logger[_0x0858('0xe')]('OpenchannelAccount,\x20%s,\x20%s',_0x4b5072,_0x0858('0x14'));_0x1c214c(_0x207cda['result'][_0x0858('0x13')]);}})[_0x0858('0x15')](function(_0x3a2d96){logger[_0x0858('0x11')](_0x0858('0xf'),_0x4b5072,_0x3a2d96);_0x38371f(_0x3a2d96);});});} \ No newline at end of file +var _0x4058=['request','then','debug','code','error','message','OpenchannelAccount,\x20%s,\x20%s','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket'];(function(_0x5d971b,_0x385f6b){var _0x705338=function(_0x2171b5){while(--_0x2171b5){_0x5d971b['push'](_0x5d971b['shift']());}};_0x705338(++_0x385f6b);}(_0x4058,0x129));var _0x8405=function(_0x4b993d,_0x12c3cb){_0x4b993d=_0x4b993d-0x0;var _0x211966=_0x4058[_0x4b993d];return _0x211966;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var moment=require(_0x8405('0x2'));var BPromise=require(_0x8405('0x3'));var rs=require(_0x8405('0x4'));var fs=require('fs');var Redis=require(_0x8405('0x5'));var db=require(_0x8405('0x6'))['db'];var utils=require(_0x8405('0x7'));var logger=require(_0x8405('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8405('0x9')][_0x8405('0xa')]({'port':0x232a});config[_0x8405('0xb')]=_[_0x8405('0xc')](config[_0x8405('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8405('0xd'))(new Redis(config[_0x8405('0xb')]));require(_0x8405('0xe'))['register'](socket);function respondWithRpcPromise(_0x30705f,_0x5e132b,_0x6979fd){return new BPromise(function(_0xb442,_0x50344e){return client[_0x8405('0xf')](_0x30705f,_0x6979fd)[_0x8405('0x10')](function(_0x5b94d5){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x5e132b,'request\x20sent');logger[_0x8405('0x11')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5e132b,'request\x20sent',JSON['stringify'](_0x5b94d5));if(_0x5b94d5['error']){if(_0x5b94d5['error'][_0x8405('0x12')]===0x1f4){logger[_0x8405('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x5e132b,_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);return _0x50344e(_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);}logger['error'](_0x8405('0x15'),_0x5e132b,_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);return _0xb442(_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);}else{logger[_0x8405('0x16')](_0x8405('0x15'),_0x5e132b,_0x8405('0x17'));_0xb442(_0x5b94d5[_0x8405('0x18')][_0x8405('0x14')]);}})[_0x8405('0x19')](function(_0x21376d){logger[_0x8405('0x13')](_0x8405('0x15'),_0x5e132b,_0x21376d);_0x50344e(_0x21376d);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 220df4a..0246f27 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 _0x1da1=['./openchannelAccount.events','save','remove','update','emit','register'];(function(_0x5f16c7,_0x431912){var _0x467699=function(_0x2add21){while(--_0x2add21){_0x5f16c7['push'](_0x5f16c7['shift']());}};_0x467699(++_0x431912);}(_0x1da1,0x1a4));var _0x11da=function(_0x4e6bfc,_0x45a89f){_0x4e6bfc=_0x4e6bfc-0x0;var _0x9cedec=_0x1da1[_0x4e6bfc];return _0x9cedec;};'use strict';var OpenchannelAccountEvents=require(_0x11da('0x0'));var events=[_0x11da('0x1'),_0x11da('0x2'),_0x11da('0x3')];function createListener(_0x46896e,_0x5b0fe4){return function(_0x55af86){_0x5b0fe4[_0x11da('0x4')](_0x46896e,_0x55af86);};}function removeListener(_0x1beca5,_0x3d6bd5){return function(){OpenchannelAccountEvents['removeListener'](_0x1beca5,_0x3d6bd5);};}exports[_0x11da('0x5')]=function(_0x209cbb){for(var _0x15c324=0x0,_0x5ecc27=events['length'];_0x15c324<_0x5ecc27;_0x15c324++){var _0x287653=events[_0x15c324];var _0x109f4b=createListener('openchannelAccount:'+_0x287653,_0x209cbb);OpenchannelAccountEvents['on'](_0x287653,_0x109f4b);}}; \ No newline at end of file +var _0x130d=['remove','emit','removeListener','register','length','./openchannelAccount.events'];(function(_0x31ba0e,_0xa5d5c9){var _0xc37b80=function(_0x3d37f3){while(--_0x3d37f3){_0x31ba0e['push'](_0x31ba0e['shift']());}};_0xc37b80(++_0xa5d5c9);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelAccountEvents=require(_0xd130('0x0'));var events=['save',_0xd130('0x1'),'update'];function createListener(_0x45f869,_0x389725){return function(_0x3591d2){_0x389725[_0xd130('0x2')](_0x45f869,_0x3591d2);};}function removeListener(_0x321e49,_0x2bc19d){return function(){OpenchannelAccountEvents[_0xd130('0x3')](_0x321e49,_0x2bc19d);};}exports[_0xd130('0x4')]=function(_0x287e61){for(var _0x4689a8=0x0,_0x44c215=events[_0xd130('0x5')];_0x4689a8<_0x44c215;_0x4689a8++){var _0x3f77e1=events[_0x4689a8];var _0x1b9875=createListener('openchannelAccount:'+_0x3f77e1,_0x287e61);OpenchannelAccountEvents['on'](_0x3f77e1,_0x1b9875);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index c4d5eb3..f3f025c 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 _0x743a=['show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/:id'];(function(_0x7b198b,_0x493bbf){var _0x5503a3=function(_0xa993d){while(--_0xa993d){_0x7b198b['push'](_0x7b198b['shift']());}};_0x5503a3(++_0x493bbf);}(_0x743a,0xd3));var _0xa743=function(_0x5b9a52,_0x407826){_0x5b9a52=_0x5b9a52-0x0;var _0x55bc4c=_0x743a[_0x5b9a52];return _0x55bc4c;};'use strict';var multer=require('multer');var util=require(_0xa743('0x0'));var path=require(_0xa743('0x1'));var timeout=require(_0xa743('0x2'));var express=require(_0xa743('0x3'));var router=express[_0xa743('0x4')]();var fs_extra=require(_0xa743('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa743('0x6'));var controller=require('./openchannelApplication.controller');router[_0xa743('0x7')]('/',auth[_0xa743('0x8')](),controller['index']);router[_0xa743('0x7')](_0xa743('0x9'),auth[_0xa743('0x8')](),controller[_0xa743('0xa')]);router[_0xa743('0xb')]('/',auth[_0xa743('0x8')](),controller[_0xa743('0xc')]);router[_0xa743('0xd')]('/:id',auth[_0xa743('0x8')](),controller[_0xa743('0xe')]);router[_0xa743('0xf')](_0xa743('0x9'),auth[_0xa743('0x8')](),controller[_0xa743('0x10')]);module['exports']=router; \ No newline at end of file +var _0xab74=['/:id','show','post','create','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index'];(function(_0x2a0cf5,_0x106165){var _0x2aaf66=function(_0x39620e){while(--_0x39620e){_0x2a0cf5['push'](_0x2a0cf5['shift']());}};_0x2aaf66(++_0x106165);}(_0xab74,0x15d));var _0x4ab7=function(_0x2ee8a8,_0x373bd4){_0x2ee8a8=_0x2ee8a8-0x0;var _0x5c9add=_0xab74[_0x2ee8a8];return _0x5c9add;};'use strict';var multer=require(_0x4ab7('0x0'));var util=require('util');var path=require(_0x4ab7('0x1'));var timeout=require(_0x4ab7('0x2'));var express=require(_0x4ab7('0x3'));var router=express[_0x4ab7('0x4')]();var fs_extra=require(_0x4ab7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4ab7('0x6'));var config=require(_0x4ab7('0x7'));var controller=require(_0x4ab7('0x8'));router[_0x4ab7('0x9')]('/',auth[_0x4ab7('0xa')](),controller[_0x4ab7('0xb')]);router['get'](_0x4ab7('0xc'),auth[_0x4ab7('0xa')](),controller[_0x4ab7('0xd')]);router[_0x4ab7('0xe')]('/',auth[_0x4ab7('0xa')](),controller[_0x4ab7('0xf')]);router['put']('/:id',auth[_0x4ab7('0xa')](),controller[_0x4ab7('0x10')]);router[_0x4ab7('0x11')]('/:id',auth[_0x4ab7('0xa')](),controller[_0x4ab7('0x12')]);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 85d9b23..710fa3a 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 _0xbb4b=['*,*,*,*','exports','INTEGER','TEXT','STRING'];(function(_0x23ff58,_0x165758){var _0x3771c6=function(_0x173c35){while(--_0x173c35){_0x23ff58['push'](_0x23ff58['shift']());}};_0x3771c6(++_0x165758);}(_0xbb4b,0x15a));var _0xbbb4=function(_0x2f43ae,_0x24f967){_0x2f43ae=_0x2f43ae-0x0;var _0x454655=_0xbb4b[_0x2f43ae];return _0x454655;};'use strict';var Sequelize=require('sequelize');module[_0xbbb4('0x0')]={'priority':{'type':Sequelize[_0xbbb4('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xbbb4('0x2')]()},'description':{'type':Sequelize[_0xbbb4('0x3')]},'interval':{'type':Sequelize[_0xbbb4('0x3')],'defaultValue':_0xbbb4('0x4')}}; \ No newline at end of file +var _0x7d0a=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x3099f4,_0x43c358){var _0x6fba4f=function(_0x3ee9dd){while(--_0x3ee9dd){_0x3099f4['push'](_0x3099f4['shift']());}};_0x6fba4f(++_0x43c358);}(_0x7d0a,0x1a3));var _0xa7d0=function(_0x5cfa35,_0x5eb7f0){_0x5cfa35=_0x5cfa35-0x0;var _0xf7dffb=_0x7d0a[_0x5cfa35];return _0xf7dffb;};'use strict';var Sequelize=require(_0xa7d0('0x0'));module[_0xa7d0('0x1')]={'priority':{'type':Sequelize[_0xa7d0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa7d0('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa7d0('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa7d0('0x3')],'defaultValue':_0xa7d0('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 06f51fe..5a4e901 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 _0xf6dd=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','end','error','stack','name','send','index','map','OpenchannelApplication','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','length','find','create','body','destroy','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xf6dd,0x1e1));var _0xdf6d=function(_0x32fe02,_0x5e75b6){_0x32fe02=_0x32fe02-0x0;var _0xac08aa=_0xf6dd[_0x32fe02];return _0xac08aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf6d('0x0'));var zipdir=require(_0xdf6d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf6d('0x2'));var moment=require(_0xdf6d('0x3'));var BPromise=require(_0xdf6d('0x4'));var Mustache=require(_0xdf6d('0x5'));var util=require(_0xdf6d('0x6'));var path=require(_0xdf6d('0x7'));var sox=require(_0xdf6d('0x8'));var csv=require(_0xdf6d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdf6d('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdf6d('0xb'));var toCsv=require(_0xdf6d('0x9'));var querystring=require(_0xdf6d('0xc'));var Papa=require(_0xdf6d('0xd'));var Redis=require(_0xdf6d('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdf6d('0xf'));var hardwareService=require(_0xdf6d('0x10'));var logger=require(_0xdf6d('0x11'))(_0xdf6d('0x12'));var utils=require(_0xdf6d('0x13'));var config=require(_0xdf6d('0x14'));var licenseUtil=require(_0xdf6d('0x15'));var db=require(_0xdf6d('0x16'))['db'];function respondWithStatusCode(_0x26aba0,_0x1841c2){_0x1841c2=_0x1841c2||0xcc;return function(_0x5ef9ac){if(_0x5ef9ac){return _0x26aba0[_0xdf6d('0x17')](_0x1841c2);}return _0x26aba0[_0xdf6d('0x18')](_0x1841c2)['end']();};}function respondWithResult(_0xb1718,_0x81c3cd){_0x81c3cd=_0x81c3cd||0xc8;return function(_0x5638cd){if(_0x5638cd){return _0xb1718[_0xdf6d('0x18')](_0x81c3cd)[_0xdf6d('0x19')](_0x5638cd);}};}function respondWithFilteredResult(_0x2b515c,_0x3614a9){return function(_0x3c7baf){if(_0x3c7baf){var _0xc8371=typeof _0x3614a9[_0xdf6d('0x1a')]===_0xdf6d('0x1b')&&typeof _0x3614a9[_0xdf6d('0x1c')]===_0xdf6d('0x1b');var _0x1e7fa7=_0x3c7baf[_0xdf6d('0x1d')];var _0x5278b9=_0xc8371?0x0:_0x3614a9[_0xdf6d('0x1a')];var _0x40c824=_0xc8371?_0x3c7baf[_0xdf6d('0x1d')]:_0x3614a9[_0xdf6d('0x1a')]+_0x3614a9['limit'];var _0x2c3dd8;if(_0x40c824>=_0x1e7fa7){_0x40c824=_0x1e7fa7;_0x2c3dd8=0xc8;}else{_0x2c3dd8=0xce;}_0x2b515c[_0xdf6d('0x18')](_0x2c3dd8);return _0x2b515c[_0xdf6d('0x1e')](_0xdf6d('0x1f'),_0x5278b9+'-'+_0x40c824+'/'+_0x1e7fa7)[_0xdf6d('0x19')](_0x3c7baf);}return null;};}function patchUpdates(_0x567778){return function(_0xa66bd5){try{jsonpatch['apply'](_0xa66bd5,_0x567778,!![]);}catch(_0xf87b7e){return BPromise['reject'](_0xf87b7e);}return _0xa66bd5[_0xdf6d('0x20')]();};}function saveUpdates(_0x1c3a7f,_0x19ea69){return function(_0x19fddb){if(_0x19fddb){return _0x19fddb[_0xdf6d('0x21')](_0x1c3a7f)[_0xdf6d('0x22')](function(_0x5280b1){return _0x5280b1;});}return null;};}function removeEntity(_0x5d7e16,_0x165592){return function(_0x5065d2){if(_0x5065d2){return _0x5065d2['destroy']()[_0xdf6d('0x22')](function(){_0x5d7e16['status'](0xcc)[_0xdf6d('0x23')]();});}};}function handleEntityNotFound(_0x422bc7,_0x13c382){return function(_0x635acd){if(!_0x635acd){_0x422bc7['sendStatus'](0x194);}return _0x635acd;};}function handleError(_0x12bf08,_0x1e7d55){_0x1e7d55=_0x1e7d55||0x1f4;return function(_0x8de975){logger[_0xdf6d('0x24')](_0x8de975[_0xdf6d('0x25')]);if(_0x8de975['name']){delete _0x8de975[_0xdf6d('0x26')];}_0x12bf08['status'](_0x1e7d55)[_0xdf6d('0x27')](_0x8de975);};}exports[_0xdf6d('0x28')]=function(_0x431064,_0x5e14af){var _0x30c4aa={},_0x208aa7={},_0x20c8b7={'count':0x0,'rows':[]};var _0x5d9f89=_[_0xdf6d('0x29')](db[_0xdf6d('0x2a')]['rawAttributes'],function(_0x33f92e){return{'name':_0x33f92e[_0xdf6d('0x2b')],'type':_0x33f92e[_0xdf6d('0x2c')][_0xdf6d('0x2d')]};});_0x208aa7[_0xdf6d('0x2e')]=_[_0xdf6d('0x29')](_0x5d9f89,_0xdf6d('0x26'));_0x208aa7[_0xdf6d('0x2f')]=_['keys'](_0x431064[_0xdf6d('0x2f')]);_0x208aa7[_0xdf6d('0x30')]=_['intersection'](_0x208aa7[_0xdf6d('0x2e')],_0x208aa7[_0xdf6d('0x2f')]);_0x30c4aa['attributes']=_[_0xdf6d('0x31')](_0x208aa7['model'],qs[_0xdf6d('0x32')](_0x431064[_0xdf6d('0x2f')]['fields']));_0x30c4aa[_0xdf6d('0x33')]=_0x30c4aa[_0xdf6d('0x33')]['length']?_0x30c4aa[_0xdf6d('0x33')]:_0x208aa7[_0xdf6d('0x2e')];if(!_0x431064[_0xdf6d('0x2f')]['hasOwnProperty'](_0xdf6d('0x34'))){_0x30c4aa['limit']=qs[_0xdf6d('0x1c')](_0x431064[_0xdf6d('0x2f')]['limit']);_0x30c4aa['offset']=qs[_0xdf6d('0x1a')](_0x431064['query']['offset']);}_0x30c4aa['order']=qs[_0xdf6d('0x35')](_0x431064[_0xdf6d('0x2f')]['sort']);_0x30c4aa[_0xdf6d('0x36')]=qs[_0xdf6d('0x30')](_[_0xdf6d('0x37')](_0x431064['query'],_0x208aa7['filters']),_0x5d9f89);if(_0x431064[_0xdf6d('0x2f')]['filter']){_0x30c4aa[_0xdf6d('0x36')]=_[_0xdf6d('0x38')](_0x30c4aa[_0xdf6d('0x36')],{'$or':_['map'](_0x5d9f89,function(_0x8d1def){if(_0x8d1def[_0xdf6d('0x2c')]!==_0xdf6d('0x39')){var _0x312e1c={};_0x312e1c[_0x8d1def[_0xdf6d('0x26')]]={'$like':'%'+_0x431064[_0xdf6d('0x2f')][_0xdf6d('0x3a')]+'%'};return _0x312e1c;}})});}_0x30c4aa=_[_0xdf6d('0x38')]({},_0x30c4aa,_0x431064[_0xdf6d('0x3b')]);var _0x33c8f1={'where':_0x30c4aa[_0xdf6d('0x36')]};return db[_0xdf6d('0x2a')][_0xdf6d('0x1d')](_0x33c8f1)[_0xdf6d('0x22')](function(_0x45989a){_0x20c8b7['count']=_0x45989a;if(_0x431064[_0xdf6d('0x2f')][_0xdf6d('0x3c')]){_0x30c4aa[_0xdf6d('0x3d')]=[{'all':!![]}];}return db[_0xdf6d('0x2a')]['findAll'](_0x30c4aa);})[_0xdf6d('0x22')](function(_0x16241f){_0x20c8b7[_0xdf6d('0x3e')]=_0x16241f;return _0x20c8b7;})[_0xdf6d('0x22')](respondWithFilteredResult(_0x5e14af,_0x30c4aa))[_0xdf6d('0x3f')](handleError(_0x5e14af,null));};exports[_0xdf6d('0x40')]=function(_0x44af7d,_0x22063){var _0x537c58={'raw':!![],'where':{'id':_0x44af7d[_0xdf6d('0x41')]['id']}},_0x3212c1={};_0x3212c1[_0xdf6d('0x2e')]=_[_0xdf6d('0x42')](db[_0xdf6d('0x2a')]['rawAttributes']);_0x3212c1[_0xdf6d('0x2f')]=_[_0xdf6d('0x42')](_0x44af7d[_0xdf6d('0x2f')]);_0x3212c1[_0xdf6d('0x30')]=_[_0xdf6d('0x31')](_0x3212c1[_0xdf6d('0x2e')],_0x3212c1['query']);_0x537c58[_0xdf6d('0x33')]=_[_0xdf6d('0x31')](_0x3212c1[_0xdf6d('0x2e')],qs[_0xdf6d('0x32')](_0x44af7d[_0xdf6d('0x2f')][_0xdf6d('0x32')]));_0x537c58[_0xdf6d('0x33')]=_0x537c58[_0xdf6d('0x33')][_0xdf6d('0x43')]?_0x537c58[_0xdf6d('0x33')]:_0x3212c1[_0xdf6d('0x2e')];if(_0x44af7d[_0xdf6d('0x2f')][_0xdf6d('0x3c')]){_0x537c58[_0xdf6d('0x3d')]=[{'all':!![]}];}_0x537c58=_[_0xdf6d('0x38')]({},_0x537c58,_0x44af7d[_0xdf6d('0x3b')]);return db[_0xdf6d('0x2a')][_0xdf6d('0x44')](_0x537c58)[_0xdf6d('0x22')](handleEntityNotFound(_0x22063,null))[_0xdf6d('0x22')](respondWithResult(_0x22063,null))[_0xdf6d('0x3f')](handleError(_0x22063,null));};exports[_0xdf6d('0x45')]=function(_0x5ba55c,_0x3706a2){return db['OpenchannelApplication'][_0xdf6d('0x45')](_0x5ba55c[_0xdf6d('0x46')],{})[_0xdf6d('0x22')](respondWithResult(_0x3706a2,0xc9))[_0xdf6d('0x3f')](handleError(_0x3706a2,null));};exports['update']=function(_0x23e097,_0x55f0aa){if(_0x23e097['body']['id']){delete _0x23e097['body']['id'];}return db[_0xdf6d('0x2a')][_0xdf6d('0x44')]({'where':{'id':_0x23e097[_0xdf6d('0x41')]['id']}})[_0xdf6d('0x22')](handleEntityNotFound(_0x55f0aa,null))[_0xdf6d('0x22')](saveUpdates(_0x23e097[_0xdf6d('0x46')],null))[_0xdf6d('0x22')](respondWithResult(_0x55f0aa,null))[_0xdf6d('0x3f')](handleError(_0x55f0aa,null));};exports[_0xdf6d('0x47')]=function(_0x2eade0,_0x22a708){return db[_0xdf6d('0x2a')][_0xdf6d('0x44')]({'where':{'id':_0x2eade0[_0xdf6d('0x41')]['id']}})['then'](handleEntityNotFound(_0x22a708,null))['then'](removeEntity(_0x22a708,null))[_0xdf6d('0x3f')](handleError(_0x22a708,null));}; \ No newline at end of file +var _0x8c68=['VIRTUAL','merge','options','include','findAll','show','fields','includeAll','find','create','body','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','pick','filter','where'];(function(_0x4d319c,_0x446ee7){var _0x5e3419=function(_0x46e059){while(--_0x46e059){_0x4d319c['push'](_0x4d319c['shift']());}};_0x5e3419(++_0x446ee7);}(_0x8c68,0xfa));var _0x88c6=function(_0x506970,_0x1810b5){_0x506970=_0x506970-0x0;var _0x598791=_0x8c68[_0x506970];return _0x598791;};'use strict';var emlformat=require(_0x88c6('0x0'));var rimraf=require(_0x88c6('0x1'));var zipdir=require(_0x88c6('0x2'));var jsonpatch=require(_0x88c6('0x3'));var rp=require(_0x88c6('0x4'));var moment=require(_0x88c6('0x5'));var BPromise=require(_0x88c6('0x6'));var Mustache=require('mustache');var util=require(_0x88c6('0x7'));var path=require(_0x88c6('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x88c6('0x9'));var fs=require('fs');var fs_extra=require(_0x88c6('0xa'));var _=require(_0x88c6('0xb'));var squel=require(_0x88c6('0xc'));var crypto=require(_0x88c6('0xd'));var jsforce=require(_0x88c6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x88c6('0xf'));var querystring=require(_0x88c6('0x10'));var Papa=require(_0x88c6('0x11'));var Redis=require(_0x88c6('0x12'));var authService=require(_0x88c6('0x13'));var qs=require(_0x88c6('0x14'));var as=require(_0x88c6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88c6('0x16'))(_0x88c6('0x17'));var utils=require(_0x88c6('0x18'));var config=require(_0x88c6('0x19'));var licenseUtil=require(_0x88c6('0x1a'));var db=require(_0x88c6('0x1b'))['db'];function respondWithStatusCode(_0x2483df,_0x3e9937){_0x3e9937=_0x3e9937||0xcc;return function(_0xe66943){if(_0xe66943){return _0x2483df[_0x88c6('0x1c')](_0x3e9937);}return _0x2483df['status'](_0x3e9937)['end']();};}function respondWithResult(_0x4b4764,_0x311b2c){_0x311b2c=_0x311b2c||0xc8;return function(_0x496944){if(_0x496944){return _0x4b4764[_0x88c6('0x1d')](_0x311b2c)[_0x88c6('0x1e')](_0x496944);}};}function respondWithFilteredResult(_0x3a8c19,_0x5318fe){return function(_0x5428e1){if(_0x5428e1){var _0x530174=typeof _0x5318fe[_0x88c6('0x1f')]===_0x88c6('0x20')&&typeof _0x5318fe[_0x88c6('0x21')]===_0x88c6('0x20');var _0x2fad97=_0x5428e1['count'];var _0x1c3c8b=_0x530174?0x0:_0x5318fe[_0x88c6('0x1f')];var _0x52e31f=_0x530174?_0x5428e1[_0x88c6('0x22')]:_0x5318fe['offset']+_0x5318fe[_0x88c6('0x21')];var _0x8f3143;if(_0x52e31f>=_0x2fad97){_0x52e31f=_0x2fad97;_0x8f3143=0xc8;}else{_0x8f3143=0xce;}_0x3a8c19[_0x88c6('0x1d')](_0x8f3143);return _0x3a8c19[_0x88c6('0x23')](_0x88c6('0x24'),_0x1c3c8b+'-'+_0x52e31f+'/'+_0x2fad97)[_0x88c6('0x1e')](_0x5428e1);}return null;};}function patchUpdates(_0x5ec092){return function(_0x4570a2){try{jsonpatch[_0x88c6('0x25')](_0x4570a2,_0x5ec092,!![]);}catch(_0xf4fa66){return BPromise[_0x88c6('0x26')](_0xf4fa66);}return _0x4570a2[_0x88c6('0x27')]();};}function saveUpdates(_0x45d977,_0x512e62){return function(_0x41b0cb){if(_0x41b0cb){return _0x41b0cb[_0x88c6('0x28')](_0x45d977)['then'](function(_0x308303){return _0x308303;});}return null;};}function removeEntity(_0xee40df,_0x36939c){return function(_0x110de4){if(_0x110de4){return _0x110de4[_0x88c6('0x29')]()[_0x88c6('0x2a')](function(){_0xee40df[_0x88c6('0x1d')](0xcc)[_0x88c6('0x2b')]();});}};}function handleEntityNotFound(_0x252763,_0x4b5e37){return function(_0x1c592f){if(!_0x1c592f){_0x252763[_0x88c6('0x1c')](0x194);}return _0x1c592f;};}function handleError(_0x268b7e,_0x13f369){_0x13f369=_0x13f369||0x1f4;return function(_0x246b54){logger['error'](_0x246b54[_0x88c6('0x2c')]);if(_0x246b54[_0x88c6('0x2d')]){delete _0x246b54[_0x88c6('0x2d')];}_0x268b7e[_0x88c6('0x1d')](_0x13f369)[_0x88c6('0x2e')](_0x246b54);};}exports[_0x88c6('0x2f')]=function(_0x469a41,_0x5aab1a){var _0x32d53a={},_0x2a6e78={},_0xd41887={'count':0x0,'rows':[]};var _0x4dec43=_[_0x88c6('0x30')](db[_0x88c6('0x31')][_0x88c6('0x32')],function(_0x35e4e0){return{'name':_0x35e4e0[_0x88c6('0x33')],'type':_0x35e4e0[_0x88c6('0x34')]['key']};});_0x2a6e78['model']=_['map'](_0x4dec43,_0x88c6('0x2d'));_0x2a6e78['query']=_[_0x88c6('0x35')](_0x469a41[_0x88c6('0x36')]);_0x2a6e78[_0x88c6('0x37')]=_[_0x88c6('0x38')](_0x2a6e78[_0x88c6('0x39')],_0x2a6e78[_0x88c6('0x36')]);_0x32d53a[_0x88c6('0x3a')]=_[_0x88c6('0x38')](_0x2a6e78[_0x88c6('0x39')],qs['fields'](_0x469a41[_0x88c6('0x36')]['fields']));_0x32d53a['attributes']=_0x32d53a[_0x88c6('0x3a')][_0x88c6('0x3b')]?_0x32d53a[_0x88c6('0x3a')]:_0x2a6e78['model'];if(!_0x469a41['query'][_0x88c6('0x3c')]('nolimit')){_0x32d53a[_0x88c6('0x21')]=qs['limit'](_0x469a41['query'][_0x88c6('0x21')]);_0x32d53a[_0x88c6('0x1f')]=qs[_0x88c6('0x1f')](_0x469a41[_0x88c6('0x36')][_0x88c6('0x1f')]);}_0x32d53a[_0x88c6('0x3d')]=qs[_0x88c6('0x3e')](_0x469a41['query'][_0x88c6('0x3e')]);_0x32d53a['where']=qs[_0x88c6('0x37')](_[_0x88c6('0x3f')](_0x469a41[_0x88c6('0x36')],_0x2a6e78['filters']),_0x4dec43);if(_0x469a41[_0x88c6('0x36')][_0x88c6('0x40')]){_0x32d53a['where']=_['merge'](_0x32d53a[_0x88c6('0x41')],{'$or':_[_0x88c6('0x30')](_0x4dec43,function(_0x318ce5){if(_0x318ce5[_0x88c6('0x34')]!==_0x88c6('0x42')){var _0x204340={};_0x204340[_0x318ce5[_0x88c6('0x2d')]]={'$like':'%'+_0x469a41['query']['filter']+'%'};return _0x204340;}})});}_0x32d53a=_[_0x88c6('0x43')]({},_0x32d53a,_0x469a41[_0x88c6('0x44')]);var _0x59e5bd={'where':_0x32d53a[_0x88c6('0x41')]};return db[_0x88c6('0x31')]['count'](_0x59e5bd)[_0x88c6('0x2a')](function(_0x3c436b){_0xd41887[_0x88c6('0x22')]=_0x3c436b;if(_0x469a41[_0x88c6('0x36')]['includeAll']){_0x32d53a[_0x88c6('0x45')]=[{'all':!![]}];}return db[_0x88c6('0x31')][_0x88c6('0x46')](_0x32d53a);})[_0x88c6('0x2a')](function(_0x3a57bd){_0xd41887['rows']=_0x3a57bd;return _0xd41887;})[_0x88c6('0x2a')](respondWithFilteredResult(_0x5aab1a,_0x32d53a))['catch'](handleError(_0x5aab1a,null));};exports[_0x88c6('0x47')]=function(_0x109b9f,_0x114dcb){var _0x149670={'raw':!![],'where':{'id':_0x109b9f['params']['id']}},_0x5ba434={};_0x5ba434[_0x88c6('0x39')]=_[_0x88c6('0x35')](db[_0x88c6('0x31')][_0x88c6('0x32')]);_0x5ba434[_0x88c6('0x36')]=_[_0x88c6('0x35')](_0x109b9f['query']);_0x5ba434[_0x88c6('0x37')]=_[_0x88c6('0x38')](_0x5ba434[_0x88c6('0x39')],_0x5ba434['query']);_0x149670[_0x88c6('0x3a')]=_[_0x88c6('0x38')](_0x5ba434[_0x88c6('0x39')],qs[_0x88c6('0x48')](_0x109b9f['query']['fields']));_0x149670[_0x88c6('0x3a')]=_0x149670[_0x88c6('0x3a')]['length']?_0x149670[_0x88c6('0x3a')]:_0x5ba434[_0x88c6('0x39')];if(_0x109b9f[_0x88c6('0x36')][_0x88c6('0x49')]){_0x149670[_0x88c6('0x45')]=[{'all':!![]}];}_0x149670=_[_0x88c6('0x43')]({},_0x149670,_0x109b9f[_0x88c6('0x44')]);return db[_0x88c6('0x31')][_0x88c6('0x4a')](_0x149670)['then'](handleEntityNotFound(_0x114dcb,null))[_0x88c6('0x2a')](respondWithResult(_0x114dcb,null))['catch'](handleError(_0x114dcb,null));};exports[_0x88c6('0x4b')]=function(_0x503372,_0x390dc4){return db[_0x88c6('0x31')][_0x88c6('0x4b')](_0x503372[_0x88c6('0x4c')],{})[_0x88c6('0x2a')](respondWithResult(_0x390dc4,0xc9))[_0x88c6('0x4d')](handleError(_0x390dc4,null));};exports[_0x88c6('0x28')]=function(_0x2af00c,_0x1ee5a0){if(_0x2af00c['body']['id']){delete _0x2af00c[_0x88c6('0x4c')]['id'];}return db[_0x88c6('0x31')][_0x88c6('0x4a')]({'where':{'id':_0x2af00c[_0x88c6('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1ee5a0,null))[_0x88c6('0x2a')](saveUpdates(_0x2af00c[_0x88c6('0x4c')],null))[_0x88c6('0x2a')](respondWithResult(_0x1ee5a0,null))[_0x88c6('0x4d')](handleError(_0x1ee5a0,null));};exports[_0x88c6('0x29')]=function(_0x28fa13,_0x527555){return db[_0x88c6('0x31')][_0x88c6('0x4a')]({'where':{'id':_0x28fa13[_0x88c6('0x4e')]['id']}})[_0x88c6('0x2a')](handleEntityNotFound(_0x527555,null))[_0x88c6('0x2a')](removeEntity(_0x527555,null))['catch'](handleError(_0x527555,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index fd77d36..7738071 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 _0x4851=['api','moment','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger'];(function(_0x313600,_0x10a50d){var _0x85ba4f=function(_0x4603fb){while(--_0x4603fb){_0x313600['push'](_0x313600['shift']());}};_0x85ba4f(++_0x10a50d);}(_0x4851,0x15f));var _0x1485=function(_0x438788,_0x17ff59){_0x438788=_0x438788-0x0;var _0x56b974=_0x4851[_0x438788];return _0x56b974;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1485('0x0'))(_0x1485('0x1'));var moment=require(_0x1485('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1485('0x3'));var config=require(_0x1485('0x4'));var attributes=require(_0x1485('0x5'));module[_0x1485('0x6')]=function(_0x47f2a8,_0x3f7e77){return _0x47f2a8[_0x1485('0x7')]('OpenchannelApplication',attributes,{'tableName':_0x1485('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1485('0x9'),'collate':_0x1485('0xa')});}; \ No newline at end of file +var _0x4d21=['moment','bluebird','request-promise','path','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','../../config/logger'];(function(_0x34e7c3,_0x30513f){var _0x879a78=function(_0x2a6e5c){while(--_0x2a6e5c){_0x34e7c3['push'](_0x34e7c3['shift']());}};_0x879a78(++_0x30513f);}(_0x4d21,0x1ae));var _0x14d2=function(_0x556a79,_0x36f191){_0x556a79=_0x556a79-0x0;var _0x27f52b=_0x4d21[_0x556a79];return _0x27f52b;};'use strict';var _=require(_0x14d2('0x0'));var util=require('util');var logger=require(_0x14d2('0x1'))('api');var moment=require(_0x14d2('0x2'));var BPromise=require(_0x14d2('0x3'));var rp=require(_0x14d2('0x4'));var fs=require('fs');var path=require(_0x14d2('0x5'));var rimraf=require('rimraf');var config=require(_0x14d2('0x6'));var attributes=require('./openchannelApplication.attributes');module[_0x14d2('0x7')]=function(_0x14ebb8,_0x893c8){return _0x14ebb8[_0x14d2('0x8')](_0x14d2('0x9'),attributes,{'tableName':_0x14d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x14d2('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index a82b6fa..6391504 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 _0x86aa=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','debug','lodash','bluebird','randomstring'];(function(_0x56c250,_0x22aefd){var _0x168d8b=function(_0xe515ea){while(--_0xe515ea){_0x56c250['push'](_0x56c250['shift']());}};_0x168d8b(++_0x22aefd);}(_0x86aa,0x1af));var _0xa86a=function(_0x4d3460,_0x4488eb){_0x4d3460=_0x4d3460-0x0;var _0x19bd8e=_0x86aa[_0x4d3460];return _0x19bd8e;};'use strict';var _=require(_0xa86a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa86a('0x1'));var rs=require(_0xa86a('0x2'));var fs=require('fs');var Redis=require(_0xa86a('0x3'));var db=require(_0xa86a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa86a('0x5'))(_0xa86a('0x6'));var config=require(_0xa86a('0x7'));var jayson=require(_0xa86a('0x8'));var client=jayson[_0xa86a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29d80a,_0x30c168,_0x51c11d){return new BPromise(function(_0x34bafb,_0x300c66){return client[_0xa86a('0xa')](_0x29d80a,_0x51c11d)[_0xa86a('0xb')](function(_0x281a1f){logger[_0xa86a('0xc')](_0xa86a('0xd'),_0x30c168,_0xa86a('0xe'));logger['debug'](_0xa86a('0xf'),_0x30c168,_0xa86a('0xe'),JSON[_0xa86a('0x10')](_0x281a1f));if(_0x281a1f['error']){if(_0x281a1f[_0xa86a('0x11')][_0xa86a('0x12')]===0x1f4){logger[_0xa86a('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x30c168,_0x281a1f['error']['message']);return _0x300c66(_0x281a1f['error']['message']);}logger[_0xa86a('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x30c168,_0x281a1f[_0xa86a('0x11')][_0xa86a('0x13')]);return _0x34bafb(_0x281a1f[_0xa86a('0x11')][_0xa86a('0x13')]);}else{logger[_0xa86a('0xc')](_0xa86a('0xd'),_0x30c168,_0xa86a('0xe'));_0x34bafb(_0x281a1f['result'][_0xa86a('0x13')]);}})[_0xa86a('0x14')](function(_0x43770f){logger[_0xa86a('0x11')](_0xa86a('0xd'),_0x30c168,_0x43770f);_0x300c66(_0x43770f);});});}exports[_0xa86a('0x15')]=function(_0x3f49c5){var _0x5661a2=this;return new Promise(function(_0x599082,_0x3c3f3c){return db[_0xa86a('0x16')][_0xa86a('0x17')](_0x3f49c5[_0xa86a('0x18')],{'raw':_0x3f49c5[_0xa86a('0x19')]?_0x3f49c5[_0xa86a('0x19')][_0xa86a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f49c5['options']?_0x3f49c5[_0xa86a('0x19')][_0xa86a('0x1b')]||null:null,'attributes':_0x3f49c5[_0xa86a('0x19')]?_0x3f49c5[_0xa86a('0x19')][_0xa86a('0x1c')]||null:null,'limit':_0x3f49c5['options']?_0x3f49c5[_0xa86a('0x19')][_0xa86a('0x1d')]||null:null})[_0xa86a('0xb')](function(_0x4128ed){logger[_0xa86a('0xc')](_0xa86a('0x15'),_0x3f49c5);logger[_0xa86a('0x1e')](_0xa86a('0x15'),_0x3f49c5,JSON[_0xa86a('0x10')](_0x4128ed));_0x599082(_0x4128ed);})['catch'](function(_0x18a971){logger[_0xa86a('0x11')](_0xa86a('0x15'),_0x18a971[_0xa86a('0x13')],_0x3f49c5);_0x3c3f3c(_0x5661a2[_0xa86a('0x11')](0x1f4,_0x18a971[_0xa86a('0x13')]));});});}; \ No newline at end of file +var _0x08c2=['info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0xf3d537,_0x269aa4){var _0x5079fa=function(_0xf714fb){while(--_0xf714fb){_0xf3d537['push'](_0xf3d537['shift']());}};_0x5079fa(++_0x269aa4);}(_0x08c2,0x112));var _0x208c=function(_0x43139e,_0x762629){_0x43139e=_0x43139e-0x0;var _0x2bc838=_0x08c2[_0x43139e];return _0x2bc838;};'use strict';var _=require(_0x208c('0x0'));var util=require(_0x208c('0x1'));var moment=require(_0x208c('0x2'));var BPromise=require(_0x208c('0x3'));var rs=require(_0x208c('0x4'));var fs=require('fs');var Redis=require(_0x208c('0x5'));var db=require(_0x208c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x208c('0x7'))(_0x208c('0x8'));var config=require(_0x208c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x208c('0xa')][_0x208c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ea1b,_0x2abdb4,_0x3e954a){return new BPromise(function(_0x1ec0d1,_0x3a8a9d){return client[_0x208c('0xc')](_0x47ea1b,_0x3e954a)[_0x208c('0xd')](function(_0x2b75c4){logger[_0x208c('0xe')](_0x208c('0xf'),_0x2abdb4,_0x208c('0x10'));logger[_0x208c('0x11')](_0x208c('0x12'),_0x2abdb4,_0x208c('0x10'),JSON[_0x208c('0x13')](_0x2b75c4));if(_0x2b75c4[_0x208c('0x14')]){if(_0x2b75c4[_0x208c('0x14')][_0x208c('0x15')]===0x1f4){logger[_0x208c('0x14')](_0x208c('0xf'),_0x2abdb4,_0x2b75c4[_0x208c('0x14')]['message']);return _0x3a8a9d(_0x2b75c4[_0x208c('0x14')]['message']);}logger[_0x208c('0x14')](_0x208c('0xf'),_0x2abdb4,_0x2b75c4['error'][_0x208c('0x16')]);return _0x1ec0d1(_0x2b75c4[_0x208c('0x14')][_0x208c('0x16')]);}else{logger[_0x208c('0xe')](_0x208c('0xf'),_0x2abdb4,_0x208c('0x10'));_0x1ec0d1(_0x2b75c4[_0x208c('0x17')][_0x208c('0x16')]);}})[_0x208c('0x18')](function(_0x193b5d){logger[_0x208c('0x14')](_0x208c('0xf'),_0x2abdb4,_0x193b5d);_0x3a8a9d(_0x193b5d);});});}exports[_0x208c('0x19')]=function(_0x54c15a){var _0xaa257=this;return new Promise(function(_0x532367,_0x340433){return db[_0x208c('0x1a')]['update'](_0x54c15a['body'],{'raw':_0x54c15a[_0x208c('0x1b')]?_0x54c15a[_0x208c('0x1b')][_0x208c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54c15a[_0x208c('0x1b')]?_0x54c15a[_0x208c('0x1b')][_0x208c('0x1d')]||null:null,'attributes':_0x54c15a['options']?_0x54c15a[_0x208c('0x1b')][_0x208c('0x1e')]||null:null,'limit':_0x54c15a[_0x208c('0x1b')]?_0x54c15a[_0x208c('0x1b')][_0x208c('0x1f')]||null:null})[_0x208c('0xd')](function(_0x3e0900){logger[_0x208c('0xe')]('UpdateOpenchannelApplication',_0x54c15a);logger[_0x208c('0x11')](_0x208c('0x19'),_0x54c15a,JSON[_0x208c('0x13')](_0x3e0900));_0x532367(_0x3e0900);})[_0x208c('0x18')](function(_0x1da4a7){logger[_0x208c('0x14')](_0x208c('0x19'),_0x1da4a7[_0x208c('0x16')],_0x54c15a);_0x340433(_0xaa257['error'](0x1f4,_0x1da4a7[_0x208c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 1193b74..3a0c08b 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 _0xd23a=['update','openchannelinteraction:destroy','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update'];(function(_0xda0c6a,_0x4e0eb5){var _0x16395e=function(_0x12c783){while(--_0x12c783){_0xda0c6a['push'](_0xda0c6a['shift']());}};_0x16395e(++_0x4e0eb5);}(_0xd23a,0xe4));var _0xad23=function(_0x302734,_0x581530){_0x302734=_0x302734-0x0;var _0x57abb0=_0xd23a[_0x302734];return _0x57abb0;};'use strict';var multer=require(_0xad23('0x0'));var util=require(_0xad23('0x1'));var path=require(_0xad23('0x2'));var timeout=require('connect-timeout');var express=require(_0xad23('0x3'));var router=express[_0xad23('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xad23('0x5'));var interaction=require(_0xad23('0x6'));var config=require(_0xad23('0x7'));var controller=require(_0xad23('0x8'));router[_0xad23('0x9')]('/',auth[_0xad23('0xa')](),controller[_0xad23('0xb')]);router[_0xad23('0x9')](_0xad23('0xc'),auth[_0xad23('0xa')](),controller[_0xad23('0xd')]);router[_0xad23('0x9')](_0xad23('0xe'),auth['isAuthenticated'](),controller[_0xad23('0xf')]);router[_0xad23('0x9')](_0xad23('0x10'),auth[_0xad23('0xa')](),controller[_0xad23('0x11')]);router[_0xad23('0x9')](_0xad23('0x12'),auth[_0xad23('0xa')](),controller[_0xad23('0x13')]);router['post']('/',auth[_0xad23('0xa')](),controller['create']);router[_0xad23('0x14')](_0xad23('0x10'),auth[_0xad23('0xa')](),controller[_0xad23('0x15')]);router[_0xad23('0x14')](_0xad23('0x16'),auth[_0xad23('0xa')](),interaction[_0xad23('0x17')](_0xad23('0x18'),_0xad23('0x19')),controller[_0xad23('0x1a')]);router['put'](_0xad23('0xe'),auth[_0xad23('0xa')](),interaction[_0xad23('0x17')](_0xad23('0x18'),_0xad23('0x1b')),controller[_0xad23('0x1c')]);router['delete'](_0xad23('0xe'),auth[_0xad23('0xa')](),interaction[_0xad23('0x17')](_0xad23('0x18'),_0xad23('0x1d')),controller[_0xad23('0x1e')]);router['delete'](_0xad23('0x16'),auth['isAuthenticated'](),controller['removeTags']);module[_0xad23('0x1f')]=router; \ No newline at end of file +var _0x6d25=['delete','openchannelinteraction:destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/:id/messages','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','/:id','update'];(function(_0x4897d3,_0x1a6bb3){var _0x4f92e9=function(_0xcac1a0){while(--_0xcac1a0){_0x4897d3['push'](_0x4897d3['shift']());}};_0x4f92e9(++_0x1a6bb3);}(_0x6d25,0xb8));var _0x56d2=function(_0x2037fc,_0xec2955){_0x2037fc=_0x2037fc-0x0;var _0x234698=_0x6d25[_0x2037fc];return _0x234698;};'use strict';var multer=require('multer');var util=require(_0x56d2('0x0'));var path=require(_0x56d2('0x1'));var timeout=require(_0x56d2('0x2'));var express=require(_0x56d2('0x3'));var router=express[_0x56d2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x56d2('0x5'));var interaction=require(_0x56d2('0x6'));var config=require(_0x56d2('0x7'));var controller=require(_0x56d2('0x8'));router[_0x56d2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x56d2('0xa')](),controller['describe']);router['get']('/:id',auth[_0x56d2('0xa')](),controller['show']);router[_0x56d2('0x9')](_0x56d2('0xb'),auth[_0x56d2('0xa')](),controller['getMessages']);router[_0x56d2('0x9')]('/:id/download',auth[_0x56d2('0xa')](),controller[_0x56d2('0xc')]);router[_0x56d2('0xd')]('/',auth['isAuthenticated'](),controller[_0x56d2('0xe')]);router['post'](_0x56d2('0xb'),auth[_0x56d2('0xa')](),controller[_0x56d2('0xf')]);router['post'](_0x56d2('0x10'),auth['isAuthenticated'](),interaction[_0x56d2('0x11')](_0x56d2('0x12'),_0x56d2('0x13')),controller[_0x56d2('0x14')]);router[_0x56d2('0x15')](_0x56d2('0x16'),auth['isAuthenticated'](),interaction[_0x56d2('0x11')](_0x56d2('0x12'),'openchannelinteraction:update'),controller[_0x56d2('0x17')]);router[_0x56d2('0x18')](_0x56d2('0x16'),auth[_0x56d2('0xa')](),interaction[_0x56d2('0x11')](_0x56d2('0x12'),_0x56d2('0x19')),controller['destroy']);router['delete'](_0x56d2('0x10'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 9276d40..6bff734 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 _0xc524=['ENUM','out','BOOLEAN','DATE','STRING'];(function(_0x2ead6b,_0x1c7f76){var _0x598be5=function(_0x4203e2){while(--_0x4203e2){_0x2ead6b['push'](_0x2ead6b['shift']());}};_0x598be5(++_0x1c7f76);}(_0xc524,0x1bf));var _0x4c52=function(_0x532139,_0x4719e0){_0x532139=_0x532139-0x0;var _0x1a2561=_0xc524[_0x532139];return _0x1a2561;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x4c52('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4c52('0x1')]},'disposition':{'type':Sequelize[_0x4c52('0x2')]},'secondDisposition':{'type':Sequelize[_0x4c52('0x2')]},'thirdDisposition':{'type':Sequelize[_0x4c52('0x2')]},'note':{'type':Sequelize[_0x4c52('0x2')]},'read1stAt':{'type':Sequelize[_0x4c52('0x1')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x4c52('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x4c52('0x3')]('in',_0x4c52('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x4c52('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x4c52('0x0')],'defaultValue':![]}}; \ No newline at end of file +var _0xfa2b=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x214228,_0x1ae71e){var _0x291593=function(_0xdbaed0){while(--_0xdbaed0){_0x214228['push'](_0x214228['shift']());}};_0x291593(++_0x1ae71e);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x52955e,_0x4b988d){_0x52955e=_0x52955e-0x0;var _0x8993b8=_0xfa2b[_0x52955e];return _0x8993b8;};'use strict';var Sequelize=require(_0xbfa2('0x0'));module[_0xbfa2('0x1')]={'closed':{'type':Sequelize[_0xbfa2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbfa2('0x3')]},'disposition':{'type':Sequelize[_0xbfa2('0x4')]},'secondDisposition':{'type':Sequelize[_0xbfa2('0x4')]},'thirdDisposition':{'type':Sequelize[_0xbfa2('0x4')]},'note':{'type':Sequelize[_0xbfa2('0x4')]},'read1stAt':{'type':Sequelize[_0xbfa2('0x3')]},'threadId':{'type':Sequelize[_0xbfa2('0x4')]},'externalUrl':{'type':Sequelize[_0xbfa2('0x4')]},'lastMsgAt':{'type':Sequelize[_0xbfa2('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xbfa2('0x5')]('in',_0xbfa2('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xbfa2('0x5')]('in',_0xbfa2('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xbfa2('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 5285a13..d93075f 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 _0xc124=['catch','show','query','from','params','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','create','body','update','destroy','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','attachments','join','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','OpenchannelAccount','Openchannel','Account','Owner','N.A.','createdAt','closed','closedAt','disposition','threadId','Public','basename','existsSync','createReadStream','createWriteStream','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','sendStatus','rimraf','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','end','status','json','offset','undefined','limit','count','set','Content-Range','then','error','name','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','user'];(function(_0x130976,_0x137060){var _0x1d110a=function(_0x16b4d7){while(--_0x16b4d7){_0x130976['push'](_0x130976['shift']());}};_0x1d110a(++_0x137060);}(_0xc124,0x1e3));var _0x4c12=function(_0x2f608b,_0x23c090){_0x2f608b=_0x2f608b-0x0;var _0x48c492=_0xc124[_0x2f608b];return _0x48c492;};'use strict';var rimraf=require(_0x4c12('0x0'));var zipdir=require('zip-dir');var moment=require(_0x4c12('0x1'));var util=require(_0x4c12('0x2'));var path=require('path');var ejs=require(_0x4c12('0x3'));var fs=require('fs');var _=require(_0x4c12('0x4'));var Redis=require(_0x4c12('0x5'));var interaction=require(_0x4c12('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0x4c12('0x7'));var logger=require(_0x4c12('0x8'))('api');var config=require(_0x4c12('0x9'));var db=require(_0x4c12('0xa'))['db'];config['redis']=_['defaults'](config[_0x4c12('0xb')],{'host':_0x4c12('0xc'),'port':0x18eb});var socket=require(_0x4c12('0xd'))(new Redis(config['redis']));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x211c7c,_0x3cb98f){_0x3cb98f=_0x3cb98f||0xcc;return function(_0x3693fb){if(_0x3693fb){return _0x211c7c['sendStatus'](_0x3cb98f);}return _0x211c7c['status'](_0x3cb98f)[_0x4c12('0xe')]();};}function respondWithResult(_0x5d45cd,_0x599498){_0x599498=_0x599498||0xc8;return function(_0x24fbe5){if(_0x24fbe5){return _0x5d45cd[_0x4c12('0xf')](_0x599498)[_0x4c12('0x10')](_0x24fbe5);}};}function respondWithFilteredResult(_0x560055,_0x149af5){return function(_0x56f251){if(_0x56f251){var _0x105c0d=typeof _0x149af5[_0x4c12('0x11')]===_0x4c12('0x12')&&typeof _0x149af5[_0x4c12('0x13')]===_0x4c12('0x12');var _0x43a8ef=_0x56f251[_0x4c12('0x14')];var _0x20f30f=_0x105c0d?0x0:_0x149af5['offset'];var _0x124d71=_0x105c0d?_0x56f251[_0x4c12('0x14')]:_0x149af5[_0x4c12('0x11')]+_0x149af5['limit'];var _0x300dd1;if(_0x124d71>=_0x43a8ef){_0x124d71=_0x43a8ef;_0x300dd1=0xc8;}else{_0x300dd1=0xce;}_0x560055[_0x4c12('0xf')](_0x300dd1);return _0x560055[_0x4c12('0x15')](_0x4c12('0x16'),_0x20f30f+'-'+_0x124d71+'/'+_0x43a8ef)[_0x4c12('0x10')](_0x56f251);}return null;};}function saveUpdates(_0x25be5e){return function(_0x10a9c5){if(_0x10a9c5){return _0x10a9c5['update'](_0x25be5e)[_0x4c12('0x17')](function(_0x458cfd){return _0x458cfd;});}return null;};}function removeEntity(_0xf65391){return function(_0x33d9b6){if(_0x33d9b6){return _0x33d9b6['destroy']()[_0x4c12('0x17')](function(){_0xf65391[_0x4c12('0xf')](0xcc)[_0x4c12('0xe')]();});}};}function handleEntityNotFound(_0x536558){return function(_0x5ecab0){if(!_0x5ecab0){_0x536558['sendStatus'](0x194);}return _0x5ecab0;};}function handleError(_0x4aba42,_0x2a30b5){_0x2a30b5=_0x2a30b5||0x1f4;return function(_0x5c2d79){logger[_0x4c12('0x18')](_0x5c2d79['stack']);if(_0x5c2d79[_0x4c12('0x19')]){delete _0x5c2d79[_0x4c12('0x19')];}_0x4aba42[_0x4c12('0xf')](_0x2a30b5)['send'](_0x5c2d79);};}exports[_0x4c12('0x1a')]=function(_0x225716,_0x2308a0){var _0x38c2af={};var _0x35571f=_[_0x4c12('0x1b')](db[_0x4c12('0x1c')][_0x4c12('0x1d')],function(_0x4a5c62){return{'name':_0x4a5c62[_0x4c12('0x1e')],'type':_0x4a5c62[_0x4c12('0x1f')][_0x4c12('0x20')]};});_0x38c2af=qs[_0x4c12('0x21')](_0x35571f,_0x225716);return interaction[_0x4c12('0x22')](_0x4c12('0x23'),_0x225716['query'],_0x225716[_0x4c12('0x24')],_0x38c2af,_0x35571f)[_0x4c12('0x17')](respondWithFilteredResult(_0x2308a0,_0x38c2af))[_0x4c12('0x25')](handleError(_0x2308a0,null));};exports[_0x4c12('0x26')]=function(_0x5d9f6c,_0x2cddfe){var _0x41110c={};if(_0x5d9f6c[_0x4c12('0x27')][_0x4c12('0x1f')]&&_0x5d9f6c[_0x4c12('0x27')][_0x4c12('0x1f')]==='from'){_0x41110c[_0x4c12('0x28')]=_0x5d9f6c[_0x4c12('0x29')]['id'];}else{_0x41110c['id']=_0x5d9f6c[_0x4c12('0x29')]['id'];}var _0x559a24={'raw':![],'where':_0x41110c},_0x29d709={};_0x29d709['model']=_[_0x4c12('0x2a')](db['OpenchannelInteraction'][_0x4c12('0x1d')]);_0x29d709[_0x4c12('0x27')]=_[_0x4c12('0x2a')](_0x5d9f6c['query']);_0x29d709[_0x4c12('0x2b')]=_[_0x4c12('0x2c')](_0x29d709[_0x4c12('0x2d')],_0x29d709['query']);_0x559a24['attributes']=_[_0x4c12('0x2c')](_0x29d709['model'],qs[_0x4c12('0x2e')](_0x5d9f6c[_0x4c12('0x27')]['fields']));_0x559a24[_0x4c12('0x2f')]=_0x559a24['attributes'][_0x4c12('0x30')]?_0x559a24[_0x4c12('0x2f')]:_0x29d709['model'];if(_0x5d9f6c['query'][_0x4c12('0x31')]){_0x559a24[_0x4c12('0x32')]=[{'all':!![]}];}_0x559a24=_[_0x4c12('0x33')]({},_0x559a24,_0x5d9f6c[_0x4c12('0x34')]);return db[_0x4c12('0x1c')][_0x4c12('0x35')](_0x559a24)[_0x4c12('0x17')](handleEntityNotFound(_0x2cddfe,null))['then'](respondWithResult(_0x2cddfe,null))[_0x4c12('0x25')](handleError(_0x2cddfe,null));};exports[_0x4c12('0x36')]=function(_0x56d075,_0x3237d8){return db[_0x4c12('0x1c')][_0x4c12('0x36')](_0x56d075[_0x4c12('0x37')],{})[_0x4c12('0x17')](respondWithResult(_0x3237d8,0xc9))[_0x4c12('0x25')](handleError(_0x3237d8,null));};exports[_0x4c12('0x38')]=function(_0x31f6af,_0x228d37){if(_0x31f6af['body']['id']){delete _0x31f6af['body']['id'];}return db[_0x4c12('0x1c')][_0x4c12('0x35')]({'where':{'id':_0x31f6af[_0x4c12('0x29')]['id']}})['then'](handleEntityNotFound(_0x228d37,null))[_0x4c12('0x17')](saveUpdates(_0x31f6af[_0x4c12('0x37')],null))[_0x4c12('0x17')](respondWithResult(_0x228d37,null))['catch'](handleError(_0x228d37,null));};exports[_0x4c12('0x39')]=function(_0x55195b,_0x12c897){return db[_0x4c12('0x1c')]['find']({'where':{'id':_0x55195b[_0x4c12('0x29')]['id']}})['then'](handleEntityNotFound(_0x12c897,null))[_0x4c12('0x17')](removeEntity(_0x12c897,null))['catch'](handleError(_0x12c897,null));};exports[_0x4c12('0x3a')]=function(_0x200a17,_0xed9105){return db[_0x4c12('0x1c')][_0x4c12('0x3a')]()['then'](respondWithResult(_0xed9105,null))[_0x4c12('0x25')](handleError(_0xed9105,null));};exports[_0x4c12('0x3b')]=function(_0x2e781a,_0x4634c5){return db[_0x4c12('0x3c')]['find']({'where':{'id':_0x2e781a[_0x4c12('0x29')]['id']}})[_0x4c12('0x17')](handleEntityNotFound(_0x4634c5,null))['then'](function(_0x261289){if(_0x261289){return _0x261289[_0x4c12('0x3b')](_0x2e781a[_0x4c12('0x37')]['ids'],_[_0x4c12('0x3d')](_0x2e781a['body'],[_0x4c12('0x3e'),'id'])||{});}})[_0x4c12('0x17')](respondWithResult(_0x4634c5,null))['catch'](handleError(_0x4634c5,null));};exports[_0x4c12('0x3f')]=function(_0x440dfa,_0x12d1eb){var _0xe402d4={'raw':![],'where':{}};var _0x11ca6f={};var _0x164e95={'count':0x0,'rows':[]};return db[_0x4c12('0x1c')][_0x4c12('0x40')]({'where':{'id':_0x440dfa['params']['id']}})[_0x4c12('0x17')](handleEntityNotFound(_0x12d1eb,null))['then'](function(_0x5cb193){if(_0x5cb193){_0x11ca6f[_0x4c12('0x2d')]=_[_0x4c12('0x2a')](db[_0x4c12('0x3c')][_0x4c12('0x1d')]);_0x11ca6f[_0x4c12('0x27')]=_[_0x4c12('0x2a')](_0x440dfa[_0x4c12('0x27')]);_0x11ca6f[_0x4c12('0x2b')]=_['intersection'](_0x11ca6f[_0x4c12('0x2d')],_0x11ca6f['query']);_0xe402d4[_0x4c12('0x2f')]=_[_0x4c12('0x2c')](_0x11ca6f[_0x4c12('0x2d')],qs[_0x4c12('0x2e')](_0x440dfa[_0x4c12('0x27')][_0x4c12('0x2e')]));_0xe402d4[_0x4c12('0x2f')]=_0xe402d4[_0x4c12('0x2f')]['length']?_0xe402d4[_0x4c12('0x2f')]:_0x11ca6f[_0x4c12('0x2d')];if(!_0x440dfa[_0x4c12('0x27')][_0x4c12('0x41')](_0x4c12('0x42'))){_0xe402d4[_0x4c12('0x13')]=qs[_0x4c12('0x13')](_0x440dfa[_0x4c12('0x27')][_0x4c12('0x13')]);_0xe402d4['offset']=qs['offset'](_0x440dfa[_0x4c12('0x27')][_0x4c12('0x11')]);}_0xe402d4[_0x4c12('0x43')]=qs[_0x4c12('0x44')](_0x440dfa[_0x4c12('0x27')][_0x4c12('0x44')]);_0xe402d4[_0x4c12('0x45')]=qs[_0x4c12('0x2b')](_[_0x4c12('0x46')](_0x440dfa[_0x4c12('0x27')],_0x11ca6f[_0x4c12('0x2b')]));_0xe402d4['where'][_0x4c12('0x47')]=_0x5cb193['id'];if(_0x440dfa['query'][_0x4c12('0x48')]){_0xe402d4['where']=_[_0x4c12('0x33')](_0xe402d4[_0x4c12('0x45')],{'$or':_[_0x4c12('0x1b')](_0xe402d4[_0x4c12('0x2f')],function(_0x568b13){var _0x16f280={};_0x16f280[_0x568b13]={'$like':'%'+_0x440dfa['query']['filter']+'%'};return _0x16f280;})});}if(_0x440dfa[_0x4c12('0x27')]['$gte']){var _0x11b535=_0x440dfa[_0x4c12('0x27')][_0x4c12('0x49')][_0x4c12('0x4a')](',');var _0x4e948f={};_0x4e948f[_0x11b535[0x0]]={'$gte':moment(_0x11b535[0x1])[_0x4c12('0x4b')](_0x4c12('0x4c'))};_0xe402d4[_0x4c12('0x45')]=_[_0x4c12('0x33')](_0xe402d4['where'],_0x4e948f);}_0xe402d4=_[_0x4c12('0x33')]({},_0xe402d4,_0x440dfa[_0x4c12('0x34')]);return db[_0x4c12('0x3c')][_0x4c12('0x14')]({'where':_0xe402d4['where']})[_0x4c12('0x17')](function(_0x12afb2){_0x164e95[_0x4c12('0x14')]=_0x12afb2;if(_0x440dfa[_0x4c12('0x27')][_0x4c12('0x31')]){_0xe402d4[_0x4c12('0x32')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0xe402d4);})[_0x4c12('0x17')](function(_0x44ba3c){_0x164e95['rows']=_0x44ba3c;return _0x164e95;});}})[_0x4c12('0x17')](respondWithFilteredResult(_0x12d1eb,_0xe402d4))[_0x4c12('0x25')](handleError(_0x12d1eb,null));};exports[_0x4c12('0x4d')]=function(_0xc6edd4,_0x43cc69){return db[_0x4c12('0x1c')]['find']({'where':{'id':_0xc6edd4[_0x4c12('0x29')]['id']}})[_0x4c12('0x17')](handleEntityNotFound(_0x43cc69,null))[_0x4c12('0x17')](function(_0x5702f8){if(_0x5702f8){return _0x5702f8[_0x4c12('0x4e')](_0xc6edd4['body'][_0x4c12('0x3e')],_[_0x4c12('0x3d')](_0xc6edd4[_0x4c12('0x37')],[_0x4c12('0x3e'),'id'])||{})[_0x4c12('0x4f')](function(){return db[_0x4c12('0x50')]['findAll']({'attributes':['id',_0x4c12('0x19'),'color'],'where':{'id':_0xc6edd4['body']['ids']}});})['then'](function(_0x56c418){socket[_0x4c12('0x51')](_0x4c12('0x52'),{'id':Number(_0xc6edd4[_0x4c12('0x29')]['id']),'tags':_0x56c418||[]});return{'id':Number(_0xc6edd4[_0x4c12('0x29')]['id']),'tags':_0x56c418||[]};});}})[_0x4c12('0x17')](respondWithResult(_0x43cc69,null))['catch'](handleError(_0x43cc69,null));};exports[_0x4c12('0x53')]=function(_0x50d980,_0x1fb522){return db[_0x4c12('0x1c')][_0x4c12('0x35')]({'where':{'id':_0x50d980[_0x4c12('0x29')]['id']}})[_0x4c12('0x17')](handleEntityNotFound(_0x1fb522,null))['then'](function(_0x1eb71c){if(_0x1eb71c){return _0x1eb71c[_0x4c12('0x53')](_0x50d980[_0x4c12('0x27')][_0x4c12('0x3e')]);}})[_0x4c12('0x17')](respondWithStatusCode(_0x1fb522,null))['catch'](handleError(_0x1fb522,null));};exports[_0x4c12('0x54')]=function(_0x29c4ae,_0x3ebb8c){var _0x5737c0=moment()[_0x4c12('0x55')]()[_0x4c12('0x56')]();var _0xefe2a=path['join'](config[_0x4c12('0x57')],_0x4c12('0x58'),_0x4c12('0x59'),_0x4c12('0x5a'));var _0x18aea5=path['join'](config['root'],_0x4c12('0x58'),_0x4c12('0x59'),_0x4c12('0x5b'));var _0x598e3f=path[_0x4c12('0x5c')](_0xefe2a,_0x5737c0);var _0x4ef2a3=util[_0x4c12('0x4b')]('transcript-%d-%s.zip',_0x29c4ae[_0x4c12('0x29')]['id'],_0x5737c0);var _0x13906e=path[_0x4c12('0x5c')](_0xefe2a,_0x4ef2a3);var _0x2e87d2=[];_0x2e87d2[_0x4c12('0x5d')]({'model':db[_0x4c12('0x5e')],'as':_0x4c12('0x5e'),'attributes':['id',_0x4c12('0x5f')],'raw':!![]});_0x2e87d2['push']({'model':db[_0x4c12('0x60')],'as':_0x4c12('0x61'),'attributes':['id',_0x4c12('0x62'),_0x4c12('0x63')],'raw':!![]});if(_0x29c4ae[_0x4c12('0x27')][_0x4c12('0x5b')]){_0x2e87d2[_0x4c12('0x5d')]({'model':db[_0x4c12('0x64')],'as':'Attachment','raw':!![]});}var _0x3aa2cd=[{'model':db[_0x4c12('0x3c')],'as':_0x4c12('0x65'),'attributes':['id',_0x4c12('0x37'),'createdAt',_0x4c12('0x66'),_0x4c12('0x67'),_0x4c12('0x68')],'include':_0x2e87d2}];_0x3aa2cd[_0x4c12('0x5d')]({'model':db[_0x4c12('0x69')],'as':'Account','attributes':['id',_0x4c12('0x19')]});_0x3aa2cd['push']({'model':db[_0x4c12('0x5e')],'as':'Owner','attributes':['id',_0x4c12('0x5f')]});return db[_0x4c12('0x1c')][_0x4c12('0x35')]({'where':{'id':_0x29c4ae[_0x4c12('0x29')]['id']},'include':_0x3aa2cd})['then'](handleEntityNotFound(_0x3ebb8c,null))[_0x4c12('0x17')](function(_0x20f0fc){if(_0x20f0fc){var _0x1a6a3f=_0x20f0fc['get']({'plain':!![]});fs['mkdirSync'](_0x598e3f);var _0x1e33e9={'channel':_0x4c12('0x6a'),'account':_0x1a6a3f[_0x4c12('0x6b')]['name'],'agent':_0x1a6a3f[_0x4c12('0x6c')]?_0x1a6a3f[_0x4c12('0x6c')][_0x4c12('0x5f')]:_0x4c12('0x6d'),'createdAt':moment(_0x1a6a3f[_0x4c12('0x6e')])['format'](_0x4c12('0x4c'))[_0x4c12('0x56')](),'closedAt':_0x1a6a3f[_0x4c12('0x6f')]?moment(_0x1a6a3f[_0x4c12('0x70')])[_0x4c12('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4c12('0x56')]():'','disposition':_0x1a6a3f[_0x4c12('0x71')],'visibility':_0x1a6a3f[_0x4c12('0x72')]?_0x4c12('0x73'):'Private','messages':_(_0x1a6a3f['Messages'])[_0x4c12('0x48')]({'secret':![]})[_0x4c12('0x1b')](function(_0x1e9331){if(_0x1e9331['Attachment']){var _0x3f5707=path['join'](_0x18aea5,_0x1e9331[_0x4c12('0x64')][_0x4c12('0x74')]);if(fs[_0x4c12('0x75')](_0x3f5707)){fs[_0x4c12('0x76')](_0x3f5707)['pipe'](fs[_0x4c12('0x77')](path[_0x4c12('0x5c')](_0x598e3f,_0x1e9331[_0x4c12('0x64')][_0x4c12('0x74')])));}}return{'date':moment(_0x1e9331[_0x4c12('0x6e')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x1e9331[_0x4c12('0x66')]===_0x4c12('0x78')?_0x1e9331[_0x4c12('0x5e')]?_0x1e9331[_0x4c12('0x5e')][_0x4c12('0x5f')]:_0x4c12('0x79'):_0x1e9331['Contact'][_0x4c12('0x62')]+(_0x1e9331[_0x4c12('0x61')][_0x4c12('0x63')]?'\x20'+_0x1e9331[_0x4c12('0x61')][_0x4c12('0x63')]:''),'body':_0x1e9331['Attachment']?_0x1e9331[_0x4c12('0x64')][_0x4c12('0x74')]:_0x1e9331[_0x4c12('0x37')],'direction':_0x1e9331[_0x4c12('0x66')]===_0x4c12('0x78')?'A':'C','secret':_0x1e9331[_0x4c12('0x67')],'read':_0x1e9331[_0x4c12('0x68')],'attachment':_0x1e9331[_0x4c12('0x64')]};})['value']()};return ejs[_0x4c12('0x7a')](path[_0x4c12('0x5c')](config[_0x4c12('0x57')],'server',_0x4c12('0x7b'),_0x4c12('0x7c')),{'interaction':_0x1e33e9})[_0x4c12('0x17')](function(_0x44423a){var _0x54ce68=path[_0x4c12('0x5c')](_0x598e3f,_0x4c12('0x7d')+_0x1a6a3f['id']+'-'+_0x5737c0+_0x4c12('0x7e'));var _0x3484c7={'path':_0x54ce68,'channel':_0x4c12('0x6a'),'interactionId':_0x1a6a3f['id']};return pdf[_0x4c12('0x7f')](_0x44423a,_0x3484c7);})['then'](function(){return new Promise(function(_0x36caca,_0x1e1ac9){zipdir(_0x598e3f,{'saveTo':_0x13906e},function(_0x4f6b42,_0x2ddde9){if(_0x4f6b42)return _0x1e1ac9(_0x4f6b42);return _0x36caca(_0x2ddde9);});})[_0x4c12('0x17')](function(){return new Promise(function(_0x14822d,_0x3f9633){rimraf(_0x598e3f,function(_0x404a1f){if(_0x404a1f)_0x3f9633(_0x404a1f);return _0x14822d();});});})['then'](function(){return _0x3ebb8c['download'](_0x13906e,_0x4ef2a3,function(_0x36b7e3){if(_0x36b7e3){logger[_0x4c12('0x18')](_0x4c12('0x80'),_0x36b7e3);}else{fs['unlinkSync'](_0x13906e);}});});});}else{return _0x3ebb8c[_0x4c12('0x81')](0xc8);}})[_0x4c12('0x25')](handleError(_0x3ebb8c,null));}; \ No newline at end of file +var _0xe8a4=['length','hasOwnProperty','sort','where','pick','OpenchannelInteractionId','filter','$gte','format','includeAll','include','rows','ids','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','transcript-%d-%s.zip','push','User','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','Openchannel','fullname','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Public','Private','basename','createWriteStream','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','show','from','params','OpenchannelInteraction','keys','filters','intersection','model','attributes','fields','merge','options','find','create','catch','body','describe','OpenchannelMessage','addMessage','omit','getMessages','findOne'];(function(_0x313f89,_0x393815){var _0x197008=function(_0x3da224){while(--_0x3da224){_0x313f89['push'](_0x313f89['shift']());}};_0x197008(++_0x393815);}(_0xe8a4,0xc1));var _0x4e8a=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0xe8a4[_0x34021d];return _0x16597b;};'use strict';var rimraf=require(_0x4e8a('0x0'));var zipdir=require(_0x4e8a('0x1'));var moment=require('moment');var util=require(_0x4e8a('0x2'));var path=require(_0x4e8a('0x3'));var ejs=require(_0x4e8a('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x4e8a('0x5'));var interaction=require(_0x4e8a('0x6'));var qs=require(_0x4e8a('0x7'));var pdf=require(_0x4e8a('0x8'));var logger=require('../../config/logger')(_0x4e8a('0x9'));var config=require(_0x4e8a('0xa'));var db=require(_0x4e8a('0xb'))['db'];config['redis']=_[_0x4e8a('0xc')](config[_0x4e8a('0xd')],{'host':_0x4e8a('0xe'),'port':0x18eb});var socket=require(_0x4e8a('0xf'))(new Redis(config[_0x4e8a('0xd')]));require(_0x4e8a('0x10'))[_0x4e8a('0x11')](socket);function respondWithStatusCode(_0x39c624,_0x3a9ff4){_0x3a9ff4=_0x3a9ff4||0xcc;return function(_0x460800){if(_0x460800){return _0x39c624[_0x4e8a('0x12')](_0x3a9ff4);}return _0x39c624[_0x4e8a('0x13')](_0x3a9ff4)['end']();};}function respondWithResult(_0x1c896d,_0x201485){_0x201485=_0x201485||0xc8;return function(_0x46c413){if(_0x46c413){return _0x1c896d[_0x4e8a('0x13')](_0x201485)[_0x4e8a('0x14')](_0x46c413);}};}function respondWithFilteredResult(_0x1e648a,_0x30b5f7){return function(_0x3dcdda){if(_0x3dcdda){var _0x25739a=typeof _0x30b5f7[_0x4e8a('0x15')]===_0x4e8a('0x16')&&typeof _0x30b5f7[_0x4e8a('0x17')]===_0x4e8a('0x16');var _0xf9e9bd=_0x3dcdda[_0x4e8a('0x18')];var _0x2d773f=_0x25739a?0x0:_0x30b5f7['offset'];var _0x29a5b8=_0x25739a?_0x3dcdda['count']:_0x30b5f7[_0x4e8a('0x15')]+_0x30b5f7[_0x4e8a('0x17')];var _0x3d5ab0;if(_0x29a5b8>=_0xf9e9bd){_0x29a5b8=_0xf9e9bd;_0x3d5ab0=0xc8;}else{_0x3d5ab0=0xce;}_0x1e648a['status'](_0x3d5ab0);return _0x1e648a[_0x4e8a('0x19')]('Content-Range',_0x2d773f+'-'+_0x29a5b8+'/'+_0xf9e9bd)[_0x4e8a('0x14')](_0x3dcdda);}return null;};}function saveUpdates(_0x51275f){return function(_0x1abb53){if(_0x1abb53){return _0x1abb53[_0x4e8a('0x1a')](_0x51275f)[_0x4e8a('0x1b')](function(_0x25afd1){return _0x25afd1;});}return null;};}function removeEntity(_0x4284d3){return function(_0x3e63c2){if(_0x3e63c2){return _0x3e63c2[_0x4e8a('0x1c')]()[_0x4e8a('0x1b')](function(){_0x4284d3[_0x4e8a('0x13')](0xcc)[_0x4e8a('0x1d')]();});}};}function handleEntityNotFound(_0x4abe55){return function(_0x1ac0b0){if(!_0x1ac0b0){_0x4abe55[_0x4e8a('0x12')](0x194);}return _0x1ac0b0;};}function handleError(_0x457697,_0x573a47){_0x573a47=_0x573a47||0x1f4;return function(_0x3e645b){logger[_0x4e8a('0x1e')](_0x3e645b[_0x4e8a('0x1f')]);if(_0x3e645b[_0x4e8a('0x20')]){delete _0x3e645b[_0x4e8a('0x20')];}_0x457697[_0x4e8a('0x13')](_0x573a47)[_0x4e8a('0x21')](_0x3e645b);};}exports[_0x4e8a('0x22')]=function(_0x2b5355,_0x4baa7b){var _0x49b5e8={};var _0x135153=_[_0x4e8a('0x23')](db['OpenchannelInteraction'][_0x4e8a('0x24')],function(_0x37e09b){return{'name':_0x37e09b[_0x4e8a('0x25')],'type':_0x37e09b[_0x4e8a('0x26')][_0x4e8a('0x27')]};});_0x49b5e8=qs[_0x4e8a('0x28')](_0x135153,_0x2b5355);return interaction[_0x4e8a('0x29')](_0x4e8a('0x2a'),_0x2b5355[_0x4e8a('0x2b')],_0x2b5355[_0x4e8a('0x2c')],_0x49b5e8,_0x135153)[_0x4e8a('0x1b')](respondWithFilteredResult(_0x4baa7b,_0x49b5e8))['catch'](handleError(_0x4baa7b,null));};exports[_0x4e8a('0x2d')]=function(_0x86e8c6,_0x167644){var _0x3cf0a2={};if(_0x86e8c6['query'][_0x4e8a('0x26')]&&_0x86e8c6[_0x4e8a('0x2b')][_0x4e8a('0x26')]===_0x4e8a('0x2e')){_0x3cf0a2[_0x4e8a('0x2e')]=_0x86e8c6[_0x4e8a('0x2f')]['id'];}else{_0x3cf0a2['id']=_0x86e8c6['params']['id'];}var _0x412e73={'raw':![],'where':_0x3cf0a2},_0x4163bc={};_0x4163bc['model']=_['keys'](db[_0x4e8a('0x30')][_0x4e8a('0x24')]);_0x4163bc[_0x4e8a('0x2b')]=_[_0x4e8a('0x31')](_0x86e8c6['query']);_0x4163bc[_0x4e8a('0x32')]=_[_0x4e8a('0x33')](_0x4163bc[_0x4e8a('0x34')],_0x4163bc[_0x4e8a('0x2b')]);_0x412e73[_0x4e8a('0x35')]=_[_0x4e8a('0x33')](_0x4163bc[_0x4e8a('0x34')],qs[_0x4e8a('0x36')](_0x86e8c6[_0x4e8a('0x2b')]['fields']));_0x412e73[_0x4e8a('0x35')]=_0x412e73[_0x4e8a('0x35')]['length']?_0x412e73[_0x4e8a('0x35')]:_0x4163bc[_0x4e8a('0x34')];if(_0x86e8c6[_0x4e8a('0x2b')]['includeAll']){_0x412e73['include']=[{'all':!![]}];}_0x412e73=_[_0x4e8a('0x37')]({},_0x412e73,_0x86e8c6[_0x4e8a('0x38')]);return db[_0x4e8a('0x30')][_0x4e8a('0x39')](_0x412e73)[_0x4e8a('0x1b')](handleEntityNotFound(_0x167644,null))['then'](respondWithResult(_0x167644,null))['catch'](handleError(_0x167644,null));};exports[_0x4e8a('0x3a')]=function(_0x18682c,_0x60f516){return db['OpenchannelInteraction'][_0x4e8a('0x3a')](_0x18682c['body'],{})[_0x4e8a('0x1b')](respondWithResult(_0x60f516,0xc9))[_0x4e8a('0x3b')](handleError(_0x60f516,null));};exports[_0x4e8a('0x1a')]=function(_0x45c34e,_0x4aa96b){if(_0x45c34e['body']['id']){delete _0x45c34e[_0x4e8a('0x3c')]['id'];}return db[_0x4e8a('0x30')][_0x4e8a('0x39')]({'where':{'id':_0x45c34e[_0x4e8a('0x2f')]['id']}})[_0x4e8a('0x1b')](handleEntityNotFound(_0x4aa96b,null))[_0x4e8a('0x1b')](saveUpdates(_0x45c34e['body'],null))[_0x4e8a('0x1b')](respondWithResult(_0x4aa96b,null))[_0x4e8a('0x3b')](handleError(_0x4aa96b,null));};exports['destroy']=function(_0x22067e,_0x22e84d){return db[_0x4e8a('0x30')][_0x4e8a('0x39')]({'where':{'id':_0x22067e[_0x4e8a('0x2f')]['id']}})['then'](handleEntityNotFound(_0x22e84d,null))[_0x4e8a('0x1b')](removeEntity(_0x22e84d,null))[_0x4e8a('0x3b')](handleError(_0x22e84d,null));};exports[_0x4e8a('0x3d')]=function(_0x40a563,_0x29b20c){return db['OpenchannelInteraction'][_0x4e8a('0x3d')]()[_0x4e8a('0x1b')](respondWithResult(_0x29b20c,null))[_0x4e8a('0x3b')](handleError(_0x29b20c,null));};exports['addMessage']=function(_0x4fa0ec,_0x315c66){return db[_0x4e8a('0x3e')]['find']({'where':{'id':_0x4fa0ec['params']['id']}})[_0x4e8a('0x1b')](handleEntityNotFound(_0x315c66,null))[_0x4e8a('0x1b')](function(_0x5aea0d){if(_0x5aea0d){return _0x5aea0d[_0x4e8a('0x3f')](_0x4fa0ec['body']['ids'],_[_0x4e8a('0x40')](_0x4fa0ec[_0x4e8a('0x3c')],['ids','id'])||{});}})[_0x4e8a('0x1b')](respondWithResult(_0x315c66,null))[_0x4e8a('0x3b')](handleError(_0x315c66,null));};exports[_0x4e8a('0x41')]=function(_0x5b5faf,_0x3e09ca){var _0x5e6597={'raw':![],'where':{}};var _0x42dbd5={};var _0x51814f={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x4e8a('0x42')]({'where':{'id':_0x5b5faf[_0x4e8a('0x2f')]['id']}})['then'](handleEntityNotFound(_0x3e09ca,null))[_0x4e8a('0x1b')](function(_0x4e66ed){if(_0x4e66ed){_0x42dbd5['model']=_['keys'](db['OpenchannelMessage'][_0x4e8a('0x24')]);_0x42dbd5[_0x4e8a('0x2b')]=_['keys'](_0x5b5faf[_0x4e8a('0x2b')]);_0x42dbd5[_0x4e8a('0x32')]=_[_0x4e8a('0x33')](_0x42dbd5['model'],_0x42dbd5[_0x4e8a('0x2b')]);_0x5e6597['attributes']=_[_0x4e8a('0x33')](_0x42dbd5['model'],qs[_0x4e8a('0x36')](_0x5b5faf[_0x4e8a('0x2b')][_0x4e8a('0x36')]));_0x5e6597[_0x4e8a('0x35')]=_0x5e6597[_0x4e8a('0x35')][_0x4e8a('0x43')]?_0x5e6597[_0x4e8a('0x35')]:_0x42dbd5['model'];if(!_0x5b5faf[_0x4e8a('0x2b')][_0x4e8a('0x44')]('nolimit')){_0x5e6597[_0x4e8a('0x17')]=qs[_0x4e8a('0x17')](_0x5b5faf[_0x4e8a('0x2b')][_0x4e8a('0x17')]);_0x5e6597[_0x4e8a('0x15')]=qs['offset'](_0x5b5faf[_0x4e8a('0x2b')]['offset']);}_0x5e6597['order']=qs[_0x4e8a('0x45')](_0x5b5faf['query'][_0x4e8a('0x45')]);_0x5e6597[_0x4e8a('0x46')]=qs[_0x4e8a('0x32')](_[_0x4e8a('0x47')](_0x5b5faf[_0x4e8a('0x2b')],_0x42dbd5['filters']));_0x5e6597[_0x4e8a('0x46')][_0x4e8a('0x48')]=_0x4e66ed['id'];if(_0x5b5faf[_0x4e8a('0x2b')][_0x4e8a('0x49')]){_0x5e6597[_0x4e8a('0x46')]=_[_0x4e8a('0x37')](_0x5e6597[_0x4e8a('0x46')],{'$or':_['map'](_0x5e6597[_0x4e8a('0x35')],function(_0xc1ccf1){var _0x38a21d={};_0x38a21d[_0xc1ccf1]={'$like':'%'+_0x5b5faf[_0x4e8a('0x2b')][_0x4e8a('0x49')]+'%'};return _0x38a21d;})});}if(_0x5b5faf['query'][_0x4e8a('0x4a')]){var _0xa547d1=_0x5b5faf[_0x4e8a('0x2b')][_0x4e8a('0x4a')]['split'](',');var _0x178a9f={};_0x178a9f[_0xa547d1[0x0]]={'$gte':moment(_0xa547d1[0x1])[_0x4e8a('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5e6597[_0x4e8a('0x46')]=_['merge'](_0x5e6597[_0x4e8a('0x46')],_0x178a9f);}_0x5e6597=_[_0x4e8a('0x37')]({},_0x5e6597,_0x5b5faf[_0x4e8a('0x38')]);return db['OpenchannelMessage'][_0x4e8a('0x18')]({'where':_0x5e6597['where']})['then'](function(_0x5c91b5){_0x51814f['count']=_0x5c91b5;if(_0x5b5faf[_0x4e8a('0x2b')][_0x4e8a('0x4c')]){_0x5e6597[_0x4e8a('0x4d')]=[{'all':!![]}];}return db[_0x4e8a('0x3e')]['findAll'](_0x5e6597);})['then'](function(_0x2238b5){_0x51814f[_0x4e8a('0x4e')]=_0x2238b5;return _0x51814f;});}})[_0x4e8a('0x1b')](respondWithFilteredResult(_0x3e09ca,_0x5e6597))[_0x4e8a('0x3b')](handleError(_0x3e09ca,null));};exports['addTags']=function(_0x5155b8,_0x54a246){return db[_0x4e8a('0x30')]['find']({'where':{'id':_0x5155b8['params']['id']}})['then'](handleEntityNotFound(_0x54a246,null))['then'](function(_0x49ccad){if(_0x49ccad){return _0x49ccad['setTags'](_0x5155b8[_0x4e8a('0x3c')][_0x4e8a('0x4f')],_[_0x4e8a('0x40')](_0x5155b8['body'],[_0x4e8a('0x4f'),'id'])||{})[_0x4e8a('0x50')](function(){return db[_0x4e8a('0x51')][_0x4e8a('0x29')]({'attributes':['id',_0x4e8a('0x20'),_0x4e8a('0x52')],'where':{'id':_0x5155b8['body']['ids']}});})[_0x4e8a('0x1b')](function(_0x1f9919){socket[_0x4e8a('0x53')](_0x4e8a('0x54'),{'id':Number(_0x5155b8[_0x4e8a('0x2f')]['id']),'tags':_0x1f9919||[]});return{'id':Number(_0x5155b8[_0x4e8a('0x2f')]['id']),'tags':_0x1f9919||[]};});}})[_0x4e8a('0x1b')](respondWithResult(_0x54a246,null))[_0x4e8a('0x3b')](handleError(_0x54a246,null));};exports[_0x4e8a('0x55')]=function(_0x4cbb8b,_0x58cc52){return db[_0x4e8a('0x30')][_0x4e8a('0x39')]({'where':{'id':_0x4cbb8b[_0x4e8a('0x2f')]['id']}})[_0x4e8a('0x1b')](handleEntityNotFound(_0x58cc52,null))['then'](function(_0x2d7c4b){if(_0x2d7c4b){return _0x2d7c4b[_0x4e8a('0x55')](_0x4cbb8b['query']['ids']);}})[_0x4e8a('0x1b')](respondWithStatusCode(_0x58cc52,null))[_0x4e8a('0x3b')](handleError(_0x58cc52,null));};exports[_0x4e8a('0x56')]=function(_0x432c09,_0x4ec915){var _0x134441=moment()[_0x4e8a('0x57')]()[_0x4e8a('0x58')]();var _0x2ddbf8=path['join'](config[_0x4e8a('0x59')],_0x4e8a('0x5a'),_0x4e8a('0x5b'),_0x4e8a('0x5c'));var _0x3ff2d8=path[_0x4e8a('0x5d')](config[_0x4e8a('0x59')],_0x4e8a('0x5a'),_0x4e8a('0x5b'),'attachments');var _0x37191a=path[_0x4e8a('0x5d')](_0x2ddbf8,_0x134441);var _0x11eaa3=util['format'](_0x4e8a('0x5e'),_0x432c09['params']['id'],_0x134441);var _0x200d53=path[_0x4e8a('0x5d')](_0x2ddbf8,_0x11eaa3);var _0xab849d=[];_0xab849d[_0x4e8a('0x5f')]({'model':db[_0x4e8a('0x60')],'as':_0x4e8a('0x60'),'attributes':['id','fullname'],'raw':!![]});_0xab849d[_0x4e8a('0x5f')]({'model':db['CmContact'],'as':_0x4e8a('0x61'),'attributes':['id',_0x4e8a('0x62'),_0x4e8a('0x63')],'raw':!![]});if(_0x432c09['query']['attachments']){_0xab849d[_0x4e8a('0x5f')]({'model':db[_0x4e8a('0x64')],'as':_0x4e8a('0x64'),'raw':!![]});}var _0x5388c1=[{'model':db['OpenchannelMessage'],'as':_0x4e8a('0x65'),'attributes':['id',_0x4e8a('0x3c'),_0x4e8a('0x66'),_0x4e8a('0x67'),_0x4e8a('0x68'),_0x4e8a('0x69')],'include':_0xab849d}];_0x5388c1[_0x4e8a('0x5f')]({'model':db[_0x4e8a('0x6a')],'as':_0x4e8a('0x6b'),'attributes':['id',_0x4e8a('0x20')]});_0x5388c1[_0x4e8a('0x5f')]({'model':db[_0x4e8a('0x60')],'as':_0x4e8a('0x6c'),'attributes':['id','fullname']});return db[_0x4e8a('0x30')][_0x4e8a('0x39')]({'where':{'id':_0x432c09[_0x4e8a('0x2f')]['id']},'include':_0x5388c1})[_0x4e8a('0x1b')](handleEntityNotFound(_0x4ec915,null))[_0x4e8a('0x1b')](function(_0x498521){if(_0x498521){var _0x2e6434=_0x498521['get']({'plain':!![]});fs['mkdirSync'](_0x37191a);var _0x4ddfa2={'channel':_0x4e8a('0x6d'),'account':_0x2e6434['Account'][_0x4e8a('0x20')],'agent':_0x2e6434[_0x4e8a('0x6c')]?_0x2e6434['Owner'][_0x4e8a('0x6e')]:_0x4e8a('0x6f'),'createdAt':moment(_0x2e6434[_0x4e8a('0x66')])[_0x4e8a('0x4b')](_0x4e8a('0x70'))[_0x4e8a('0x58')](),'closedAt':_0x2e6434[_0x4e8a('0x71')]?moment(_0x2e6434[_0x4e8a('0x72')])[_0x4e8a('0x4b')](_0x4e8a('0x70'))['toString']():'','disposition':_0x2e6434[_0x4e8a('0x73')],'visibility':_0x2e6434['threadId']?_0x4e8a('0x74'):_0x4e8a('0x75'),'messages':_(_0x2e6434[_0x4e8a('0x65')])[_0x4e8a('0x49')]({'secret':![]})[_0x4e8a('0x23')](function(_0x18578a){if(_0x18578a['Attachment']){var _0x204164=path[_0x4e8a('0x5d')](_0x3ff2d8,_0x18578a[_0x4e8a('0x64')][_0x4e8a('0x76')]);if(fs['existsSync'](_0x204164)){fs['createReadStream'](_0x204164)['pipe'](fs[_0x4e8a('0x77')](path['join'](_0x37191a,_0x18578a[_0x4e8a('0x64')][_0x4e8a('0x76')])));}}return{'date':moment(_0x18578a[_0x4e8a('0x66')])[_0x4e8a('0x4b')](_0x4e8a('0x70'))[_0x4e8a('0x58')](),'sender':_0x18578a[_0x4e8a('0x67')]===_0x4e8a('0x78')?_0x18578a[_0x4e8a('0x60')]?_0x18578a[_0x4e8a('0x60')]['fullname']:_0x4e8a('0x79'):_0x18578a[_0x4e8a('0x61')]['firstName']+(_0x18578a[_0x4e8a('0x61')]['lastName']?'\x20'+_0x18578a[_0x4e8a('0x61')][_0x4e8a('0x63')]:''),'body':_0x18578a[_0x4e8a('0x64')]?_0x18578a[_0x4e8a('0x64')][_0x4e8a('0x76')]:_0x18578a[_0x4e8a('0x3c')],'direction':_0x18578a['direction']===_0x4e8a('0x78')?'A':'C','secret':_0x18578a['secret'],'read':_0x18578a[_0x4e8a('0x69')],'attachment':_0x18578a[_0x4e8a('0x64')]};})['value']()};return ejs[_0x4e8a('0x7a')](path[_0x4e8a('0x5d')](config['root'],'server',_0x4e8a('0x7b'),_0x4e8a('0x7c')),{'interaction':_0x4ddfa2})[_0x4e8a('0x1b')](function(_0x411f09){var _0x43184e=path['join'](_0x37191a,_0x4e8a('0x7d')+_0x2e6434['id']+'-'+_0x134441+_0x4e8a('0x7e'));var _0x355bb4={'path':_0x43184e,'channel':_0x4e8a('0x6d'),'interactionId':_0x2e6434['id']};return pdf[_0x4e8a('0x7f')](_0x411f09,_0x355bb4);})[_0x4e8a('0x1b')](function(){return new Promise(function(_0x39455d,_0x3734ec){zipdir(_0x37191a,{'saveTo':_0x200d53},function(_0x456a4a,_0x208b31){if(_0x456a4a)return _0x3734ec(_0x456a4a);return _0x39455d(_0x208b31);});})[_0x4e8a('0x1b')](function(){return new Promise(function(_0x3c5a95,_0x4d5bf9){rimraf(_0x37191a,function(_0x36d5b1){if(_0x36d5b1)_0x4d5bf9(_0x36d5b1);return _0x3c5a95();});});})[_0x4e8a('0x1b')](function(){return _0x4ec915[_0x4e8a('0x56')](_0x200d53,_0x11eaa3,function(_0x507fb0){if(_0x507fb0){logger['error'](_0x4e8a('0x80'),_0x507fb0);}else{fs[_0x4e8a('0x81')](_0x200d53);}});});});}else{return _0x4ec915['sendStatus'](0xc8);}})[_0x4e8a('0x3b')](handleError(_0x4ec915,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 71fc9dd..dcfff7e 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 _0xbc2f=['OpenchannelMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0xbc2f,0x1a0));var _0xfbc2=function(_0x1036e7,_0x32fc34){_0x1036e7=_0x1036e7-0x0;var _0x156760=_0xbc2f[_0x1036e7];return _0x156760;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xfbc2('0x0'))['db'][_0xfbc2('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xfbc2('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xfbc2('0x3')](0x0);var events={'afterCreate':_0xfbc2('0x4'),'afterUpdate':_0xfbc2('0x5'),'afterDestroy':_0xfbc2('0x6')};function emitEvent(_0x34223a){return function(_0xccae2b,_0x25b5ec,_0x1d2d88){_0xccae2b['getUsers']({'attributes':['id'],'raw':!![]})[_0xfbc2('0x7')](function(_0x512a5a){_0xccae2b[_0xfbc2('0x8')](_0xfbc2('0x9'),_0x512a5a[_0xfbc2('0xa')](function(_0xbd976c){return{'id':_0xbd976c['id']};}));return OpenchannelMessage[_0xfbc2('0xb')]({'where':{'OpenchannelInteractionId':_0xccae2b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5baa95){_0xccae2b[_0xfbc2('0x8')](_0xfbc2('0xc'),_0x5baa95[_0xfbc2('0xd')]);OpenchannelInteractionEvents[_0xfbc2('0xe')](_0x34223a+':'+_0xccae2b['id'],_0xccae2b);OpenchannelInteractionEvents[_0xfbc2('0xe')](_0x34223a,_0xccae2b);_0x1d2d88(null);})[_0xfbc2('0xf')](_0x1d2d88(null));};}for(var e in events){if(events[_0xfbc2('0x10')](e)){var event=events[e];OpenchannelInteraction[_0xfbc2('0x11')](e,emitEvent(event));}}module[_0xfbc2('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x7f84=['Users','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove','then','setDataValue'];(function(_0xc1d2ea,_0x4e719d){var _0x5f2388=function(_0xc86808){while(--_0xc86808){_0xc1d2ea['push'](_0xc1d2ea['shift']());}};_0x5f2388(++_0x4e719d);}(_0x7f84,0x128));var _0x47f8=function(_0x3c161f,_0x1accc1){_0x3c161f=_0x3c161f-0x0;var _0x46ec04=_0x7f84[_0x3c161f];return _0x46ec04;};'use strict';var EventEmitter=require(_0x47f8('0x0'));var OpenchannelInteraction=require(_0x47f8('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x47f8('0x1'))['db'][_0x47f8('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x47f8('0x3')](0x0);var events={'afterCreate':_0x47f8('0x4'),'afterUpdate':'update','afterDestroy':_0x47f8('0x5')};function emitEvent(_0x394066){return function(_0x548af5,_0x16ea4e,_0x2eeefd){_0x548af5['getUsers']({'attributes':['id'],'raw':!![]})[_0x47f8('0x6')](function(_0x4fbd80){_0x548af5[_0x47f8('0x7')](_0x47f8('0x8'),_0x4fbd80['map'](function(_0x43544b){return{'id':_0x43544b['id']};}));return OpenchannelMessage[_0x47f8('0x9')]({'where':{'OpenchannelInteractionId':_0x548af5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x47f8('0x6')](function(_0x5265b1){_0x548af5[_0x47f8('0x7')](_0x47f8('0xa'),_0x5265b1['length']);OpenchannelInteractionEvents[_0x47f8('0xb')](_0x394066+':'+_0x548af5['id'],_0x548af5);OpenchannelInteractionEvents[_0x47f8('0xb')](_0x394066,_0x548af5);_0x2eeefd(null);})[_0x47f8('0xc')](_0x2eeefd(null));};}for(var e in events){if(events[_0x47f8('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x47f8('0xe')](e,emitEvent(event));}}module[_0x47f8('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 6eddd69..9b86f60 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 _0x64b5=['lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','define','openchannel_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x397c80,_0x3f9b05){var _0x4c822e=function(_0x4095ed){while(--_0x4095ed){_0x397c80['push'](_0x397c80['shift']());}};_0x4c822e(++_0x3f9b05);}(_0x64b5,0x168));var _0x564b=function(_0x52c4e7,_0x22b847){_0x52c4e7=_0x52c4e7-0x0;var _0x506c49=_0x64b5[_0x52c4e7];return _0x506c49;};'use strict';var _=require(_0x564b('0x0'));var util=require(_0x564b('0x1'));var logger=require(_0x564b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x564b('0x3'));var rp=require(_0x564b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x564b('0x5'));var config=require(_0x564b('0x6'));var attributes=require(_0x564b('0x7'));module['exports']=function(_0x30e31f,_0x400c66){return _0x30e31f[_0x564b('0x8')]('OpenchannelInteraction',attributes,{'tableName':_0x564b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x51dc1b,_0x50185a,_0x238671){if(_0x51dc1b[_0x564b('0xa')](_0x564b('0xb'))){_0x51dc1b[_0x564b('0xc')]=moment()[_0x564b('0xd')](_0x564b('0xe'));}_0x238671(null,_0x51dc1b);}}});}; \ No newline at end of file +var _0xedc4=['openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xedc4,0x1c9));var _0x4edc=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xedc4[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x4edc('0x0'));var util=require(_0x4edc('0x1'));var logger=require(_0x4edc('0x2'))(_0x4edc('0x3'));var moment=require(_0x4edc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4edc('0x5'));var rimraf=require(_0x4edc('0x6'));var config=require(_0x4edc('0x7'));var attributes=require(_0x4edc('0x8'));module[_0x4edc('0x9')]=function(_0xc388a4,_0x5948bf){return _0xc388a4['define'](_0x4edc('0xa'),attributes,{'tableName':_0x4edc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4edc('0xc'),'collate':_0x4edc('0xd'),'hooks':{'beforeUpdate':function(_0x10bad0,_0x51d4ff,_0x40cb89){if(_0x10bad0[_0x4edc('0xe')]('closed')){_0x10bad0[_0x4edc('0xf')]=moment()[_0x4edc('0x10')](_0x4edc('0x11'));}_0x40cb89(null,_0x10bad0);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 782d876..4ec56cc 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 _0x0f55=['request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelInteraction,\x20%s,\x20%s','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','raw','options','where','limit','then','AddTagsToOpenchannelInteraction','addTags','body','omit','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','info'];(function(_0x59a3dd,_0xad48e3){var _0x18aec7=function(_0xdfb2e1){while(--_0xdfb2e1){_0x59a3dd['push'](_0x59a3dd['shift']());}};_0x18aec7(++_0xad48e3);}(_0x0f55,0xbc));var _0x50f5=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0x0f55[_0x4d7a61];return _0x186f73;};'use strict';var _=require(_0x50f5('0x0'));var util=require(_0x50f5('0x1'));var moment=require(_0x50f5('0x2'));var BPromise=require('bluebird');var rs=require(_0x50f5('0x3'));var fs=require('fs');var Redis=require(_0x50f5('0x4'));var db=require(_0x50f5('0x5'))['db'];var utils=require(_0x50f5('0x6'));var logger=require(_0x50f5('0x7'))('rpc');var config=require(_0x50f5('0x8'));var jayson=require(_0x50f5('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x50f5('0xa')]=_[_0x50f5('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x50f5('0xc'))(new Redis(config[_0x50f5('0xa')]));require(_0x50f5('0xd'))[_0x50f5('0xe')](socket);function respondWithRpcPromise(_0x28e5a2,_0xd2420e,_0x43a430){return new BPromise(function(_0x204be9,_0x529449){return client[_0x50f5('0xf')](_0x28e5a2,_0x43a430)['then'](function(_0x1ad0e2){logger[_0x50f5('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0xd2420e,_0x50f5('0x11'));logger[_0x50f5('0x12')](_0x50f5('0x13'),_0xd2420e,_0x50f5('0x11'),JSON[_0x50f5('0x14')](_0x1ad0e2));if(_0x1ad0e2[_0x50f5('0x15')]){if(_0x1ad0e2[_0x50f5('0x15')]['code']===0x1f4){logger[_0x50f5('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0xd2420e,_0x1ad0e2[_0x50f5('0x15')]['message']);return _0x529449(_0x1ad0e2[_0x50f5('0x15')][_0x50f5('0x16')]);}logger[_0x50f5('0x15')](_0x50f5('0x17'),_0xd2420e,_0x1ad0e2['error'][_0x50f5('0x16')]);return _0x204be9(_0x1ad0e2['error'][_0x50f5('0x16')]);}else{logger[_0x50f5('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0xd2420e,_0x50f5('0x11'));_0x204be9(_0x1ad0e2[_0x50f5('0x18')][_0x50f5('0x16')]);}})[_0x50f5('0x19')](function(_0x54bb41){logger[_0x50f5('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0xd2420e,_0x54bb41);_0x529449(_0x54bb41);});});}exports[_0x50f5('0x1a')]=function(_0x4abb65){var _0x40e865=this;return new Promise(function(_0x1afed5,_0x4aa29e){return db[_0x50f5('0x1b')][_0x50f5('0x1c')](_0x4abb65['body'],{'raw':_0x4abb65['options']?_0x4abb65['options'][_0x50f5('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4abb65[_0x50f5('0x1e')]?_0x4abb65[_0x50f5('0x1e')][_0x50f5('0x1f')]||null:null,'attributes':_0x4abb65[_0x50f5('0x1e')]?_0x4abb65[_0x50f5('0x1e')]['attributes']||null:null,'limit':_0x4abb65[_0x50f5('0x1e')]?_0x4abb65[_0x50f5('0x1e')][_0x50f5('0x20')]||null:null})[_0x50f5('0x21')](function(_0x525bd0){logger[_0x50f5('0x10')]('UpdateOpenchannelInteraction',_0x4abb65);logger[_0x50f5('0x12')](_0x50f5('0x1a'),_0x4abb65,JSON['stringify'](_0x525bd0));_0x1afed5(_0x525bd0);})[_0x50f5('0x19')](function(_0x56648a){logger[_0x50f5('0x15')](_0x50f5('0x1a'),_0x56648a[_0x50f5('0x16')],_0x4abb65);_0x4aa29e(_0x40e865['error'](0x1f4,_0x56648a['message']));});});};exports[_0x50f5('0x22')]=function(_0x2565b4){return new Promise(function(_0x73cea8,_0x5e4a17){return db[_0x50f5('0x1b')]['find']({'where':_0x2565b4[_0x50f5('0x1e')]?_0x2565b4[_0x50f5('0x1e')][_0x50f5('0x1f')]||null:null})['then'](function(_0x48e224){if(_0x48e224){return _0x48e224[_0x50f5('0x23')](_0x2565b4[_0x50f5('0x24')]['ids'],_[_0x50f5('0x25')](_0x2565b4[_0x50f5('0x24')],[_0x50f5('0x26'),'id'])||{});}})[_0x50f5('0x27')](function(_0x368980){logger['info']('AddTags',_0x2565b4);logger['debug'](_0x50f5('0x28'),_0x2565b4,JSON['stringify'](_0x368980));_0x73cea8(_0x368980);})[_0x50f5('0x19')](function(_0x5207a1){logger['error'](_0x50f5('0x28'),_0x5207a1[_0x50f5('0x16')],_0x2565b4);_0x5e4a17(_this['error'](0x1f4,_0x5207a1[_0x50f5('0x16')]));});});}; \ No newline at end of file +var _0xda13=['bluebird','ioredis','../../config/logger','jayson/promise','client','redis','socket.io-emitter','./openchannelInteraction.socket','register','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','OpenchannelInteraction','update','body','options','where','attributes','then','UpdateOpenchannelInteraction','catch','AddTagsToOpenchannelInteraction','omit','AddTags','lodash','moment'];(function(_0x386710,_0x490427){var _0x5df359=function(_0x5d9df4){while(--_0x5d9df4){_0x386710['push'](_0x386710['shift']());}};_0x5df359(++_0x490427);}(_0xda13,0xd7));var _0x3da1=function(_0x4459b8,_0x3271b8){_0x4459b8=_0x4459b8-0x0;var _0x4a4b07=_0xda13[_0x4459b8];return _0x4a4b07;};'use strict';var _=require(_0x3da1('0x0'));var util=require('util');var moment=require(_0x3da1('0x1'));var BPromise=require(_0x3da1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3da1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3da1('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3da1('0x5'));var client=jayson[_0x3da1('0x6')]['http']({'port':0x232a});config[_0x3da1('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3da1('0x8'))(new Redis(config[_0x3da1('0x7')]));require(_0x3da1('0x9'))[_0x3da1('0xa')](socket);function respondWithRpcPromise(_0x6b41f,_0x4f4be4,_0x3b0787){return new BPromise(function(_0x1d3f8c,_0x549249){return client['request'](_0x6b41f,_0x3b0787)['then'](function(_0x23b892){logger['info'](_0x3da1('0xb'),_0x4f4be4,_0x3da1('0xc'));logger[_0x3da1('0xd')](_0x3da1('0xe'),_0x4f4be4,_0x3da1('0xc'),JSON[_0x3da1('0xf')](_0x23b892));if(_0x23b892[_0x3da1('0x10')]){if(_0x23b892[_0x3da1('0x10')]['code']===0x1f4){logger[_0x3da1('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4f4be4,_0x23b892[_0x3da1('0x10')][_0x3da1('0x11')]);return _0x549249(_0x23b892[_0x3da1('0x10')][_0x3da1('0x11')]);}logger[_0x3da1('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4f4be4,_0x23b892[_0x3da1('0x10')]['message']);return _0x1d3f8c(_0x23b892['error'][_0x3da1('0x11')]);}else{logger[_0x3da1('0x12')](_0x3da1('0xb'),_0x4f4be4,_0x3da1('0xc'));_0x1d3f8c(_0x23b892['result'][_0x3da1('0x11')]);}})['catch'](function(_0x191b45){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x4f4be4,_0x191b45);_0x549249(_0x191b45);});});}exports['UpdateOpenchannelInteraction']=function(_0x153742){var _0xb6fe07=this;return new Promise(function(_0x2f5056,_0x345a55){return db[_0x3da1('0x13')][_0x3da1('0x14')](_0x153742[_0x3da1('0x15')],{'raw':_0x153742[_0x3da1('0x16')]?_0x153742[_0x3da1('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x153742['options']?_0x153742[_0x3da1('0x16')][_0x3da1('0x17')]||null:null,'attributes':_0x153742['options']?_0x153742[_0x3da1('0x16')][_0x3da1('0x18')]||null:null,'limit':_0x153742[_0x3da1('0x16')]?_0x153742[_0x3da1('0x16')]['limit']||null:null})[_0x3da1('0x19')](function(_0x35d6a5){logger['info'](_0x3da1('0x1a'),_0x153742);logger['debug'](_0x3da1('0x1a'),_0x153742,JSON[_0x3da1('0xf')](_0x35d6a5));_0x2f5056(_0x35d6a5);})[_0x3da1('0x1b')](function(_0x2eb294){logger[_0x3da1('0x10')]('UpdateOpenchannelInteraction',_0x2eb294[_0x3da1('0x11')],_0x153742);_0x345a55(_0xb6fe07['error'](0x1f4,_0x2eb294[_0x3da1('0x11')]));});});};exports[_0x3da1('0x1c')]=function(_0x5b31c0){return new Promise(function(_0x4082c3,_0x54e9f0){return db[_0x3da1('0x13')]['find']({'where':_0x5b31c0[_0x3da1('0x16')]?_0x5b31c0[_0x3da1('0x16')][_0x3da1('0x17')]||null:null})[_0x3da1('0x19')](function(_0x3841d4){if(_0x3841d4){return _0x3841d4['addTags'](_0x5b31c0[_0x3da1('0x15')]['ids'],_[_0x3da1('0x1d')](_0x5b31c0['body'],['ids','id'])||{});}})['spread'](function(_0x159b84){logger[_0x3da1('0x12')]('AddTags',_0x5b31c0);logger['debug'](_0x3da1('0x1e'),_0x5b31c0,JSON[_0x3da1('0xf')](_0x159b84));_0x4082c3(_0x159b84);})[_0x3da1('0x1b')](function(_0x5443c1){logger[_0x3da1('0x10')](_0x3da1('0x1e'),_0x5443c1[_0x3da1('0x11')],_0x5b31c0);_0x54e9f0(_this[_0x3da1('0x10')](0x1f4,_0x5443c1[_0x3da1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 7fa0a10..b8b2d3f 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 _0x19bd=['save','remove','emit','removeListener','register'];(function(_0x17c0fa,_0x3a47d6){var _0x44746d=function(_0x557f0f){while(--_0x557f0f){_0x17c0fa['push'](_0x17c0fa['shift']());}};_0x44746d(++_0x3a47d6);}(_0x19bd,0x1ef));var _0xd19b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x19bd[_0x2dafbe];return _0x58a45a;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xd19b('0x0'),_0xd19b('0x1'),'update'];function createListener(_0x1ad1ce,_0x3fbe29){return function(_0xff1995){_0x3fbe29[_0xd19b('0x2')](_0x1ad1ce,_0xff1995);};}function removeListener(_0x49be9,_0x27f482){return function(){OpenchannelInteractionEvents[_0xd19b('0x3')](_0x49be9,_0x27f482);};}exports[_0xd19b('0x4')]=function(_0x3ad628){for(var _0x12576f=0x0,_0x3839ee=events['length'];_0x12576f<_0x3839ee;_0x12576f++){var _0x29906c=events[_0x12576f];var _0x29865e=createListener('openchannelInteraction:'+_0x29906c,_0x3ad628);OpenchannelInteractionEvents['on'](_0x29906c,_0x29865e);}}; \ No newline at end of file +var _0x549f=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','removeListener','register'];(function(_0x43aea5,_0x2eca2d){var _0x433040=function(_0x3a2d6e){while(--_0x3a2d6e){_0x43aea5['push'](_0x43aea5['shift']());}};_0x433040(++_0x2eca2d);}(_0x549f,0xaa));var _0xf549=function(_0x143ee4,_0x1fd2ec){_0x143ee4=_0x143ee4-0x0;var _0x23f17f=_0x549f[_0x143ee4];return _0x23f17f;};'use strict';var OpenchannelInteractionEvents=require(_0xf549('0x0'));var events=[_0xf549('0x1'),_0xf549('0x2'),'update'];function createListener(_0x3e0521,_0x52f838){return function(_0x15a7d0){_0x52f838['emit'](_0x3e0521,_0x15a7d0);};}function removeListener(_0x3f31e9,_0x511417){return function(){OpenchannelInteractionEvents[_0xf549('0x3')](_0x3f31e9,_0x511417);};}exports[_0xf549('0x4')]=function(_0x424e5b){for(var _0x3345bf=0x0,_0x22df60=events[_0xf549('0x5')];_0x3345bf<_0x22df60;_0x3345bf++){var _0x2a2776=events[_0x3345bf];var _0x194822=createListener(_0xf549('0x6')+_0x2a2776,_0x424e5b);OpenchannelInteractionEvents['on'](_0x2a2776,_0x194822);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 4f22d7c..b01aee5 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(_0x31597a,_0xab4ca4){var _0x546775=function(_0x3bea90){while(--_0x3bea90){_0x31597a['push'](_0x31597a['shift']());}};_0x546775(++_0xab4ca4);}(_0xe706,0xa3));var _0x6e70=function(_0x1bb0b8,_0x24add2){_0x1bb0b8=_0x1bb0b8-0x0;var _0x22fc67=_0xe706[_0x1bb0b8];return _0x22fc67;};'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 _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x53e26e,_0x4a5f9c){var _0xf87fd2=function(_0x1d5bdb){while(--_0x1d5bdb){_0x53e26e['push'](_0x53e26e['shift']());}};_0xf87fd2(++_0x4a5f9c);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 3ed7138..1435176 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 _0x3c66=['BOOLEAN','ENUM','out','DATE','STRING','TEXT','medium'];(function(_0x4307e1,_0x1335bc){var _0xef6ef2=function(_0x47ddbe){while(--_0x47ddbe){_0x4307e1['push'](_0x4307e1['shift']());}};_0xef6ef2(++_0x1335bc);}(_0x3c66,0x8b));var _0x63c6=function(_0x2da413,_0xdf7b98){_0x2da413=_0x2da413-0x0;var _0xdc3b79=_0x3c66[_0x2da413];return _0xdc3b79;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x63c6('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0x63c6('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x63c6('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x63c6('0x2')]('in',_0x63c6('0x3')),'defaultValue':_0x63c6('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x63c6('0x4')]},'providerName':{'type':Sequelize[_0x63c6('0x5')]},'providerResponse':{'type':Sequelize[_0x63c6('0x6')]}}; \ No newline at end of file +var _0x30fc=['TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x30fc,0x64));var _0xc30f=function(_0x16fe01,_0x5039e1){_0x16fe01=_0x16fe01-0x0;var _0x56c48a=_0x30fc[_0x16fe01];return _0x56c48a;};'use strict';var Sequelize=require(_0xc30f('0x0'));module[_0xc30f('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc30f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc30f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc30f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc30f('0x4')]('in','out'),'defaultValue':_0xc30f('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc30f('0x6')]},'providerName':{'type':Sequelize[_0xc30f('0x7')]},'providerResponse':{'type':Sequelize[_0xc30f('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index c4cec67..c54d90a 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 _0x1db9=['request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','stack','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','model','name','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','length','find','create','body','describe','../../config/logger','openchannel-interactions','accept','readAt','format','UserId','user','agent','OpenchannelInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel','get','OpenchannelInteractionId','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1db9,0x176));var _0x91db=function(_0xb29cae,_0x5a000f){_0xb29cae=_0xb29cae-0x0;var _0x564b02=_0x1db9[_0xb29cae];return _0x564b02;};'use strict';var emlformat=require(_0x91db('0x0'));var rimraf=require(_0x91db('0x1'));var zipdir=require(_0x91db('0x2'));var jsonpatch=require(_0x91db('0x3'));var rp=require(_0x91db('0x4'));var moment=require(_0x91db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x91db('0x6'));var util=require(_0x91db('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x91db('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91db('0x9'));var squel=require(_0x91db('0xa'));var crypto=require(_0x91db('0xb'));var jsforce=require(_0x91db('0xc'));var deskjs=require(_0x91db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x91db('0xe'));var Papa=require('papaparse');var Redis=require(_0x91db('0xf'));var authService=require(_0x91db('0x10'));var qs=require(_0x91db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91db('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x91db('0x13'));var licenseUtil=require(_0x91db('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x91db('0x15')](config[_0x91db('0x16')],{'host':_0x91db('0x17'),'port':0x18eb});var socket=require(_0x91db('0x18'))(new Redis(config[_0x91db('0x16')]));require('./openchannelMessage.socket')[_0x91db('0x19')](socket);var jayson=require(_0x91db('0x1a'));var client=jayson[_0x91db('0x1b')][_0x91db('0x1c')]({'port':0x232c});var client9002=jayson[_0x91db('0x1b')][_0x91db('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x260b56,_0x143bc4,_0x675bd,_0x26d10c){return new BPromise(function(_0x1e9679,_0x12416f){var _0x5f5440=_0x26d10c||client;return _0x5f5440[_0x91db('0x1d')](_0x260b56,_0x675bd)[_0x91db('0x1e')](function(_0x39480f){logger[_0x91db('0x1f')](_0x91db('0x20'),_0x143bc4,_0x91db('0x21'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x143bc4,_0x91db('0x21'),JSON[_0x91db('0x22')](_0x39480f));if(_0x39480f[_0x91db('0x23')]){if(_0x39480f[_0x91db('0x23')]['code']===0x1f4){logger[_0x91db('0x23')](_0x91db('0x20'),_0x143bc4,_0x39480f[_0x91db('0x23')][_0x91db('0x24')]);return _0x12416f(_0x39480f[_0x91db('0x23')][_0x91db('0x24')]);}logger[_0x91db('0x23')](_0x91db('0x20'),_0x143bc4,_0x39480f[_0x91db('0x23')][_0x91db('0x24')]);return _0x1e9679(_0x39480f['error']['message']);}else{logger[_0x91db('0x1f')](_0x91db('0x20'),_0x143bc4,'request\x20sent');_0x1e9679(_0x39480f[_0x91db('0x25')][_0x91db('0x24')]);}})[_0x91db('0x26')](function(_0x6e3a9c){logger[_0x91db('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x143bc4,_0x6e3a9c);_0x12416f(_0x6e3a9c);});});}function respondWithStatusCode(_0x51664d,_0x42e53f){_0x42e53f=_0x42e53f||0xcc;return function(_0x2f0b86){if(_0x2f0b86){return _0x51664d[_0x91db('0x27')](_0x42e53f);}return _0x51664d['status'](_0x42e53f)[_0x91db('0x28')]();};}function respondWithResult(_0x3c31ea,_0x46c0e8){_0x46c0e8=_0x46c0e8||0xc8;return function(_0x1bb4f8){if(_0x1bb4f8){return _0x3c31ea['status'](_0x46c0e8)[_0x91db('0x29')](_0x1bb4f8);}};}function respondWithFilteredResult(_0x2a00d1,_0x1805ef){return function(_0x49c504){if(_0x49c504){var _0x2ff6c8=typeof _0x1805ef[_0x91db('0x2a')]===_0x91db('0x2b')&&typeof _0x1805ef[_0x91db('0x2c')]===_0x91db('0x2b');var _0x1e865e=_0x49c504[_0x91db('0x2d')];var _0x1b5a7b=_0x2ff6c8?0x0:_0x1805ef[_0x91db('0x2a')];var _0x1b27f9=_0x2ff6c8?_0x49c504[_0x91db('0x2d')]:_0x1805ef[_0x91db('0x2a')]+_0x1805ef[_0x91db('0x2c')];var _0x105c01;if(_0x1b27f9>=_0x1e865e){_0x1b27f9=_0x1e865e;_0x105c01=0xc8;}else{_0x105c01=0xce;}_0x2a00d1['status'](_0x105c01);return _0x2a00d1[_0x91db('0x2e')](_0x91db('0x2f'),_0x1b5a7b+'-'+_0x1b27f9+'/'+_0x1e865e)[_0x91db('0x29')](_0x49c504);}return null;};}function patchUpdates(_0x431bf6){return function(_0x370934){try{jsonpatch['apply'](_0x370934,_0x431bf6,!![]);}catch(_0x2c5e5e){return BPromise[_0x91db('0x30')](_0x2c5e5e);}return _0x370934[_0x91db('0x31')]();};}function saveUpdates(_0x4fada9,_0x2a456d){return function(_0x55d40b){if(_0x55d40b){return _0x55d40b[_0x91db('0x32')](_0x4fada9)[_0x91db('0x1e')](function(_0xb0e74b){return _0xb0e74b;});}return null;};}function removeEntity(_0x322cac,_0x569a70){return function(_0xaa578c){if(_0xaa578c){return _0xaa578c[_0x91db('0x33')]()[_0x91db('0x1e')](function(){_0x322cac['status'](0xcc)[_0x91db('0x28')]();});}};}function handleEntityNotFound(_0x39b87d,_0x4f3e8d){return function(_0x451639){if(!_0x451639){_0x39b87d[_0x91db('0x27')](0x194);}return _0x451639;};}function handleError(_0x57dc00,_0x39ba97){_0x39ba97=_0x39ba97||0x1f4;return function(_0x4f609c){logger[_0x91db('0x23')](_0x4f609c[_0x91db('0x34')]);if(_0x4f609c['name']){delete _0x4f609c['name'];}_0x57dc00['status'](_0x39ba97)[_0x91db('0x35')](_0x4f609c);};}exports[_0x91db('0x36')]=function(_0x5ce345,_0x1cda26){var _0xb651c6={},_0x1a0703={},_0x26511c={'count':0x0,'rows':[]};var _0xbb7289=_[_0x91db('0x37')](db[_0x91db('0x38')][_0x91db('0x39')],function(_0xcdc472){return{'name':_0xcdc472[_0x91db('0x3a')],'type':_0xcdc472[_0x91db('0x3b')]['key']};});_0x1a0703[_0x91db('0x3c')]=_['map'](_0xbb7289,_0x91db('0x3d'));_0x1a0703[_0x91db('0x3e')]=_['keys'](_0x5ce345[_0x91db('0x3e')]);_0x1a0703[_0x91db('0x3f')]=_[_0x91db('0x40')](_0x1a0703[_0x91db('0x3c')],_0x1a0703[_0x91db('0x3e')]);_0xb651c6['attributes']=_[_0x91db('0x40')](_0x1a0703[_0x91db('0x3c')],qs[_0x91db('0x41')](_0x5ce345['query'][_0x91db('0x41')]));_0xb651c6[_0x91db('0x42')]=_0xb651c6[_0x91db('0x42')]['length']?_0xb651c6[_0x91db('0x42')]:_0x1a0703[_0x91db('0x3c')];if(!_0x5ce345[_0x91db('0x3e')][_0x91db('0x43')](_0x91db('0x44'))){_0xb651c6['limit']=qs[_0x91db('0x2c')](_0x5ce345['query'][_0x91db('0x2c')]);_0xb651c6[_0x91db('0x2a')]=qs[_0x91db('0x2a')](_0x5ce345[_0x91db('0x3e')][_0x91db('0x2a')]);}_0xb651c6[_0x91db('0x45')]=qs[_0x91db('0x46')](_0x5ce345[_0x91db('0x3e')][_0x91db('0x46')]);_0xb651c6[_0x91db('0x47')]=qs[_0x91db('0x3f')](_['pick'](_0x5ce345['query'],_0x1a0703[_0x91db('0x3f')]),_0xbb7289);if(_0x5ce345[_0x91db('0x3e')][_0x91db('0x48')]){_0xb651c6['where']=_[_0x91db('0x49')](_0xb651c6[_0x91db('0x47')],{'$or':_[_0x91db('0x37')](_0xbb7289,function(_0x35ffaf){if(_0x35ffaf[_0x91db('0x3b')]!=='VIRTUAL'){var _0x16c50c={};_0x16c50c[_0x35ffaf['name']]={'$like':'%'+_0x5ce345[_0x91db('0x3e')][_0x91db('0x48')]+'%'};return _0x16c50c;}})});}_0xb651c6=_[_0x91db('0x49')]({},_0xb651c6,_0x5ce345[_0x91db('0x4a')]);var _0x3c3568={'where':_0xb651c6[_0x91db('0x47')]};return db[_0x91db('0x38')][_0x91db('0x2d')](_0x3c3568)[_0x91db('0x1e')](function(_0x4fb60e){_0x26511c['count']=_0x4fb60e;if(_0x5ce345[_0x91db('0x3e')][_0x91db('0x4b')]){_0xb651c6[_0x91db('0x4c')]=[{'all':!![]}];}return db[_0x91db('0x38')][_0x91db('0x4d')](_0xb651c6);})['then'](function(_0x272657){_0x26511c[_0x91db('0x4e')]=_0x272657;return _0x26511c;})[_0x91db('0x1e')](respondWithFilteredResult(_0x1cda26,_0xb651c6))[_0x91db('0x26')](handleError(_0x1cda26,null));};exports[_0x91db('0x4f')]=function(_0x51a75b,_0xf90032){var _0x1da3dc={'raw':!![],'where':{'id':_0x51a75b[_0x91db('0x50')]['id']}},_0xb60404={};_0xb60404[_0x91db('0x3c')]=_[_0x91db('0x51')](db['OpenchannelMessage']['rawAttributes']);_0xb60404[_0x91db('0x3e')]=_['keys'](_0x51a75b[_0x91db('0x3e')]);_0xb60404['filters']=_['intersection'](_0xb60404[_0x91db('0x3c')],_0xb60404[_0x91db('0x3e')]);_0x1da3dc[_0x91db('0x42')]=_['intersection'](_0xb60404[_0x91db('0x3c')],qs[_0x91db('0x41')](_0x51a75b[_0x91db('0x3e')]['fields']));_0x1da3dc['attributes']=_0x1da3dc[_0x91db('0x42')][_0x91db('0x52')]?_0x1da3dc['attributes']:_0xb60404[_0x91db('0x3c')];if(_0x51a75b['query'][_0x91db('0x4b')]){_0x1da3dc[_0x91db('0x4c')]=[{'all':!![]}];}_0x1da3dc=_[_0x91db('0x49')]({},_0x1da3dc,_0x51a75b[_0x91db('0x4a')]);return db['OpenchannelMessage'][_0x91db('0x53')](_0x1da3dc)[_0x91db('0x1e')](handleEntityNotFound(_0xf90032,null))[_0x91db('0x1e')](respondWithResult(_0xf90032,null))[_0x91db('0x26')](handleError(_0xf90032,null));};exports[_0x91db('0x54')]=function(_0x3c8dec,_0x176a7e){return db[_0x91db('0x38')][_0x91db('0x54')](_0x3c8dec[_0x91db('0x55')],{})['then'](respondWithResult(_0x176a7e,0xc9))[_0x91db('0x26')](handleError(_0x176a7e,null));};exports[_0x91db('0x32')]=function(_0x445c2b,_0x276bc7){if(_0x445c2b[_0x91db('0x55')]['id']){delete _0x445c2b['body']['id'];}return db[_0x91db('0x38')]['find']({'where':{'id':_0x445c2b[_0x91db('0x50')]['id']}})[_0x91db('0x1e')](handleEntityNotFound(_0x276bc7,null))['then'](saveUpdates(_0x445c2b['body'],null))[_0x91db('0x1e')](respondWithResult(_0x276bc7,null))[_0x91db('0x26')](handleError(_0x276bc7,null));};exports[_0x91db('0x33')]=function(_0x51324a,_0x14a150){return db[_0x91db('0x38')][_0x91db('0x53')]({'where':{'id':_0x51324a[_0x91db('0x50')]['id']}})[_0x91db('0x1e')](handleEntityNotFound(_0x14a150,null))[_0x91db('0x1e')](removeEntity(_0x14a150,null))['catch'](handleError(_0x14a150,null));};exports[_0x91db('0x56')]=function(_0x469e1e,_0x335b44){return db[_0x91db('0x38')][_0x91db('0x56')]()[_0x91db('0x1e')](respondWithResult(_0x335b44,null))[_0x91db('0x26')](handleError(_0x335b44,null));};var interaction_log=require(_0x91db('0x57'))(_0x91db('0x58'));exports[_0x91db('0x59')]=function(_0x3dfd79,_0x505639,_0x186835){var _0x1faa56={'agent':{},'channel':'openchannel'};if(_0x3dfd79['body']['id']){delete _0x3dfd79[_0x91db('0x55')]['id'];}_0x3dfd79[_0x91db('0x55')]['read']=!![];_0x3dfd79['body'][_0x91db('0x5a')]=moment()[_0x91db('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x3dfd79[_0x91db('0x55')][_0x91db('0x5c')]=_0x3dfd79[_0x91db('0x55')]['UserId']||_0x3dfd79[_0x91db('0x5d')]['id'];_0x1faa56[_0x91db('0x5e')]['id']=_0x3dfd79['body']['UserId'];return db[_0x91db('0x38')]['find']({'where':{'id':_0x3dfd79[_0x91db('0x50')]['id'],'UserId':null}})[_0x91db('0x1e')](handleEntityNotFound(_0x505639,null))[_0x91db('0x1e')](saveUpdates(_0x3dfd79[_0x91db('0x55')],null))[_0x91db('0x1e')](function(_0x361498){if(_0x361498){_0x1faa56[_0x91db('0x24')]=_0x361498['get']({'plain':!![]});return db[_0x91db('0x5f')][_0x91db('0x53')]({'where':{'id':_0x361498['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x505639,null))[_0x91db('0x1e')](function(_0x3444d9){if(_0x3444d9){return _0x3444d9[_0x91db('0x32')]({'UserId':_0x3dfd79[_0x91db('0x55')]['UserId'],'read1stAt':_[_0x91db('0x60')](_0x3444d9[_0x91db('0x61')])?moment()['format'](_0x91db('0x62')):undefined});}return null;})[_0x91db('0x1e')](function(_0x2880fe){if(_0x2880fe){_0x1faa56[_0x91db('0x63')]=_0x2880fe['get']({'plain':!![]});interaction_log[_0x91db('0x1f')](_0x91db('0x64'),_0x3dfd79[_0x91db('0x5d')]['id'],_0x3dfd79['user'][_0x91db('0x3d')],_0x3dfd79[_0x91db('0x5d')]['role'],_0x1faa56[_0x91db('0x63')]['id'],_0x3dfd79[_0x91db('0x55')]?JSON[_0x91db('0x22')](_0x3dfd79[_0x91db('0x55')]):_0x91db('0x65'));return respondWithRpcPromise('AcceptMessage',_0x91db('0x66'),_0x1faa56);}return null;})[_0x91db('0x1e')](function(_0x43bc6e){var _0x4f1a27='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x43bc6e[_0x91db('0x24')][_0x91db('0x67')];return db[_0x91db('0x68')][_0x91db('0x3e')](_0x4f1a27,{'type':db[_0x91db('0x69')][_0x91db('0x6a')][_0x91db('0x6b')],'raw':!![]})['then'](function(_0xc484d1){return _0xc484d1;});})[_0x91db('0x1e')](function(_0x7f2f12){if(_0x7f2f12){_0x1faa56['message']['contact']=_0x7f2f12[0x0];if(!_0x3dfd79[_0x91db('0x55')][_0x91db('0x5c')])return;return db[_0x91db('0x6c')]['find']({'where':{'id':_0x3dfd79[_0x91db('0x55')][_0x91db('0x5c')],'role':_0x91db('0x5e')},'attributes':['id',_0x91db('0x3d'),_0x91db('0x6d'),_0x91db('0x6e'),_0x91db('0x6f')],'raw':!![]});}return null;})[_0x91db('0x1e')](function(_0x4b80ad){if(!_0x4b80ad)return null;_0x1faa56[_0x91db('0x24')][_0x91db('0x5e')]=_0x4b80ad;return _0x1faa56;})[_0x91db('0x1e')](function(_0xe4a61d){if(_0xe4a61d){if(_0x3dfd79['body'][_0x91db('0x70')]){_0x1faa56['message'][_0x91db('0x71')]=util[_0x91db('0x5b')](_0x91db('0x72'),_0x3dfd79[_0x91db('0x5d')][_0x91db('0x3d')]);_0x1faa56[_0x91db('0x24')]['channel']=_0x1faa56[_0x91db('0x73')];_0x1faa56['message'][_0x91db('0x74')]=_0x1faa56['channel'];_0x1faa56[_0x91db('0x24')][_0x91db('0x75')]=_0x91db('0x59');return respondWithRpcPromise('EventManager',_0x91db('0x76'),{'event':_0x91db('0x77'),'message':_0x1faa56[_0x91db('0x24')]},client9002)[_0x91db('0x1e')](function(){return _0x1faa56;});}return _0x1faa56;}return null;})[_0x91db('0x1e')](respondWithResult(_0x505639,null))[_0x91db('0x26')](handleError(_0x505639,null));};var interaction_log=require(_0x91db('0x57'))(_0x91db('0x58'));exports[_0x91db('0x30')]=function(_0x1e1d71,_0x4de398,_0x221b63){var _0x26b168={'agent':{},'channel':_0x91db('0x78')};if(_0x1e1d71[_0x91db('0x55')]['id']){delete _0x1e1d71[_0x91db('0x55')]['id'];}_0x1e1d71['body'][_0x91db('0x5c')]=_0x1e1d71[_0x91db('0x55')][_0x91db('0x5c')]||_0x1e1d71[_0x91db('0x5d')]['id'];_0x26b168[_0x91db('0x5e')]['id']=_0x1e1d71[_0x91db('0x55')][_0x91db('0x5c')];return db[_0x91db('0x38')][_0x91db('0x53')]({'where':{'id':_0x1e1d71[_0x91db('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4de398,null))['then'](function(_0x373888){if(_0x373888){_0x26b168[_0x91db('0x24')]=_0x373888[_0x91db('0x79')]({'plain':!![]});return db['OpenchannelInteraction'][_0x91db('0x53')]({'where':{'id':_0x373888[_0x91db('0x7a')]}});}return null;})[_0x91db('0x1e')](handleEntityNotFound(_0x4de398,null))[_0x91db('0x1e')](function(_0x5231e9){if(_0x5231e9){_0x26b168['interaction']=_0x5231e9['get']({'plain':!![]});interaction_log[_0x91db('0x1f')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1e1d71[_0x91db('0x5d')]['id'],_0x1e1d71[_0x91db('0x5d')][_0x91db('0x3d')],_0x1e1d71[_0x91db('0x5d')]['role'],_0x26b168[_0x91db('0x63')]['id'],_0x1e1d71[_0x91db('0x55')]?JSON[_0x91db('0x22')](_0x1e1d71[_0x91db('0x55')]):_0x91db('0x65'));return respondWithRpcPromise(_0x91db('0x7b'),_0x91db('0x7c'),_0x26b168);}return null;})[_0x91db('0x1e')](function(_0x55e395){var _0x394a0f=_0x91db('0x7d')+_0x55e395[_0x91db('0x24')][_0x91db('0x67')];return db[_0x91db('0x68')][_0x91db('0x3e')](_0x394a0f,{'type':db[_0x91db('0x69')][_0x91db('0x6a')][_0x91db('0x6b')],'raw':!![]})[_0x91db('0x1e')](function(_0x1c98e1){return _0x1c98e1;});})[_0x91db('0x1e')](function(_0x20ceb4){if(_0x20ceb4){_0x26b168[_0x91db('0x24')]['contact']=_0x20ceb4[0x0];if(!_0x1e1d71[_0x91db('0x55')]['UserId'])return;return db[_0x91db('0x6c')][_0x91db('0x53')]({'where':{'id':_0x1e1d71[_0x91db('0x55')][_0x91db('0x5c')],'role':_0x91db('0x5e')},'attributes':['id','name',_0x91db('0x6d'),'email','internal'],'raw':!![]});}return null;})[_0x91db('0x1e')](function(_0x2f9145){if(!_0x2f9145)return null;_0x26b168[_0x91db('0x24')][_0x91db('0x5e')]=_0x2f9145;return _0x26b168;})[_0x91db('0x1e')](function(_0x5dcf6e){if(_0x5dcf6e){_0x5dcf6e[_0x91db('0x24')]['interface']=util[_0x91db('0x5b')](_0x91db('0x72'),_0x1e1d71[_0x91db('0x5d')][_0x91db('0x3d')]);_0x5dcf6e['message'][_0x91db('0x73')]=_0x26b168['channel'];_0x5dcf6e[_0x91db('0x24')]['motionChannel']=_0x26b168[_0x91db('0x73')];_0x5dcf6e[_0x91db('0x24')]['event']=_0x91db('0x30');respondWithRpcPromise(_0x91db('0x76'),'EventManager',{'event':'rejectmessage','message':_0x5dcf6e[_0x91db('0x24')]},client9002);return _0x26b168;}return null;})[_0x91db('0x1e')](respondWithResult(_0x4de398,null))[_0x91db('0x26')](handleError(_0x4de398,null));}; \ No newline at end of file +var _0x5e8d=['openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','index','map','OpenchannelMessage','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','show','params','include','find','create','body','update','describe','openchannel-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','user','role','null','AcceptMessage','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage'];(function(_0x53ee43,_0x2a63ec){var _0x58b2ca=function(_0x35e8a0){while(--_0x35e8a0){_0x53ee43['push'](_0x53ee43['shift']());}};_0x58b2ca(++_0x2a63ec);}(_0x5e8d,0x11a));var _0xd5e8=function(_0x1ff090,_0x574ab0){_0x1ff090=_0x1ff090-0x0;var _0x5d665c=_0x5e8d[_0x1ff090];return _0x5d665c;};'use strict';var emlformat=require(_0xd5e8('0x0'));var rimraf=require(_0xd5e8('0x1'));var zipdir=require(_0xd5e8('0x2'));var jsonpatch=require(_0xd5e8('0x3'));var rp=require(_0xd5e8('0x4'));var moment=require(_0xd5e8('0x5'));var BPromise=require(_0xd5e8('0x6'));var Mustache=require('mustache');var util=require(_0xd5e8('0x7'));var path=require(_0xd5e8('0x8'));var sox=require('sox');var csv=require(_0xd5e8('0x9'));var ejs=require(_0xd5e8('0xa'));var fs=require('fs');var fs_extra=require(_0xd5e8('0xb'));var _=require('lodash');var squel=require(_0xd5e8('0xc'));var crypto=require(_0xd5e8('0xd'));var jsforce=require(_0xd5e8('0xe'));var deskjs=require(_0xd5e8('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd5e8('0x10'));var Redis=require(_0xd5e8('0x11'));var authService=require(_0xd5e8('0x12'));var qs=require(_0xd5e8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd5e8('0x14'));var logger=require(_0xd5e8('0x15'))('api');var utils=require(_0xd5e8('0x16'));var config=require(_0xd5e8('0x17'));var licenseUtil=require(_0xd5e8('0x18'));var db=require(_0xd5e8('0x19'))['db'];config[_0xd5e8('0x1a')]=_[_0xd5e8('0x1b')](config[_0xd5e8('0x1a')],{'host':_0xd5e8('0x1c'),'port':0x18eb});var socket=require(_0xd5e8('0x1d'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0xd5e8('0x1e')](socket);var jayson=require(_0xd5e8('0x1f'));var client=jayson[_0xd5e8('0x20')][_0xd5e8('0x21')]({'port':0x232c});var client9002=jayson[_0xd5e8('0x20')][_0xd5e8('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x489a8e,_0x2ef357,_0x18c61f,_0x282ce2){return new BPromise(function(_0x2dfd4a,_0x5dc327){var _0x3daf6a=_0x282ce2||client;return _0x3daf6a[_0xd5e8('0x22')](_0x489a8e,_0x18c61f)['then'](function(_0x4b89e9){logger[_0xd5e8('0x23')](_0xd5e8('0x24'),_0x2ef357,_0xd5e8('0x25'));logger[_0xd5e8('0x26')](_0xd5e8('0x27'),_0x2ef357,_0xd5e8('0x25'),JSON[_0xd5e8('0x28')](_0x4b89e9));if(_0x4b89e9['error']){if(_0x4b89e9[_0xd5e8('0x29')][_0xd5e8('0x2a')]===0x1f4){logger[_0xd5e8('0x29')](_0xd5e8('0x24'),_0x2ef357,_0x4b89e9[_0xd5e8('0x29')][_0xd5e8('0x2b')]);return _0x5dc327(_0x4b89e9[_0xd5e8('0x29')][_0xd5e8('0x2b')]);}logger[_0xd5e8('0x29')](_0xd5e8('0x24'),_0x2ef357,_0x4b89e9[_0xd5e8('0x29')][_0xd5e8('0x2b')]);return _0x2dfd4a(_0x4b89e9[_0xd5e8('0x29')]['message']);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2ef357,'request\x20sent');_0x2dfd4a(_0x4b89e9[_0xd5e8('0x2c')]['message']);}})[_0xd5e8('0x2d')](function(_0x3b1a69){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x2ef357,_0x3b1a69);_0x5dc327(_0x3b1a69);});});}function respondWithStatusCode(_0x29d415,_0xfaad96){_0xfaad96=_0xfaad96||0xcc;return function(_0x2e220b){if(_0x2e220b){return _0x29d415[_0xd5e8('0x2e')](_0xfaad96);}return _0x29d415[_0xd5e8('0x2f')](_0xfaad96)[_0xd5e8('0x30')]();};}function respondWithResult(_0x3cb0ea,_0x2b7244){_0x2b7244=_0x2b7244||0xc8;return function(_0x45bf59){if(_0x45bf59){return _0x3cb0ea['status'](_0x2b7244)[_0xd5e8('0x31')](_0x45bf59);}};}function respondWithFilteredResult(_0x570e6a,_0x2aa786){return function(_0x24f7e1){if(_0x24f7e1){var _0x38414b=typeof _0x2aa786[_0xd5e8('0x32')]===_0xd5e8('0x33')&&typeof _0x2aa786['limit']===_0xd5e8('0x33');var _0x3d2e7b=_0x24f7e1['count'];var _0x315955=_0x38414b?0x0:_0x2aa786['offset'];var _0x3980a1=_0x38414b?_0x24f7e1[_0xd5e8('0x34')]:_0x2aa786[_0xd5e8('0x32')]+_0x2aa786[_0xd5e8('0x35')];var _0x14d8c6;if(_0x3980a1>=_0x3d2e7b){_0x3980a1=_0x3d2e7b;_0x14d8c6=0xc8;}else{_0x14d8c6=0xce;}_0x570e6a[_0xd5e8('0x2f')](_0x14d8c6);return _0x570e6a[_0xd5e8('0x36')](_0xd5e8('0x37'),_0x315955+'-'+_0x3980a1+'/'+_0x3d2e7b)['json'](_0x24f7e1);}return null;};}function patchUpdates(_0x40ab71){return function(_0x3ff7f5){try{jsonpatch[_0xd5e8('0x38')](_0x3ff7f5,_0x40ab71,!![]);}catch(_0x22a9c1){return BPromise[_0xd5e8('0x39')](_0x22a9c1);}return _0x3ff7f5[_0xd5e8('0x3a')]();};}function saveUpdates(_0x3ee3bb,_0xde1d49){return function(_0x5c086d){if(_0x5c086d){return _0x5c086d['update'](_0x3ee3bb)['then'](function(_0x306593){return _0x306593;});}return null;};}function removeEntity(_0x3c4e8c,_0x429921){return function(_0x1508ee){if(_0x1508ee){return _0x1508ee[_0xd5e8('0x3b')]()[_0xd5e8('0x3c')](function(){_0x3c4e8c[_0xd5e8('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56fb62,_0xc1fe5f){return function(_0x256812){if(!_0x256812){_0x56fb62[_0xd5e8('0x2e')](0x194);}return _0x256812;};}function handleError(_0x2f00b4,_0x216a82){_0x216a82=_0x216a82||0x1f4;return function(_0x37b5c5){logger[_0xd5e8('0x29')](_0x37b5c5[_0xd5e8('0x3d')]);if(_0x37b5c5[_0xd5e8('0x3e')]){delete _0x37b5c5[_0xd5e8('0x3e')];}_0x2f00b4[_0xd5e8('0x2f')](_0x216a82)['send'](_0x37b5c5);};}exports[_0xd5e8('0x3f')]=function(_0x569f00,_0x2e469a){var _0x561717={},_0x1e3182={},_0x53531d={'count':0x0,'rows':[]};var _0x1a7f59=_[_0xd5e8('0x40')](db[_0xd5e8('0x41')][_0xd5e8('0x42')],function(_0x39655c){return{'name':_0x39655c[_0xd5e8('0x43')],'type':_0x39655c['type']['key']};});_0x1e3182[_0xd5e8('0x44')]=_[_0xd5e8('0x40')](_0x1a7f59,'name');_0x1e3182['query']=_[_0xd5e8('0x45')](_0x569f00[_0xd5e8('0x46')]);_0x1e3182[_0xd5e8('0x47')]=_[_0xd5e8('0x48')](_0x1e3182[_0xd5e8('0x44')],_0x1e3182[_0xd5e8('0x46')]);_0x561717['attributes']=_['intersection'](_0x1e3182[_0xd5e8('0x44')],qs[_0xd5e8('0x49')](_0x569f00['query'][_0xd5e8('0x49')]));_0x561717[_0xd5e8('0x4a')]=_0x561717[_0xd5e8('0x4a')][_0xd5e8('0x4b')]?_0x561717[_0xd5e8('0x4a')]:_0x1e3182[_0xd5e8('0x44')];if(!_0x569f00['query'][_0xd5e8('0x4c')](_0xd5e8('0x4d'))){_0x561717['limit']=qs['limit'](_0x569f00[_0xd5e8('0x46')][_0xd5e8('0x35')]);_0x561717[_0xd5e8('0x32')]=qs['offset'](_0x569f00['query'][_0xd5e8('0x32')]);}_0x561717[_0xd5e8('0x4e')]=qs['sort'](_0x569f00[_0xd5e8('0x46')][_0xd5e8('0x4f')]);_0x561717[_0xd5e8('0x50')]=qs[_0xd5e8('0x47')](_[_0xd5e8('0x51')](_0x569f00[_0xd5e8('0x46')],_0x1e3182[_0xd5e8('0x47')]),_0x1a7f59);if(_0x569f00['query'][_0xd5e8('0x52')]){_0x561717[_0xd5e8('0x50')]=_[_0xd5e8('0x53')](_0x561717[_0xd5e8('0x50')],{'$or':_[_0xd5e8('0x40')](_0x1a7f59,function(_0x460943){if(_0x460943[_0xd5e8('0x54')]!==_0xd5e8('0x55')){var _0x58e0d2={};_0x58e0d2[_0x460943[_0xd5e8('0x3e')]]={'$like':'%'+_0x569f00[_0xd5e8('0x46')][_0xd5e8('0x52')]+'%'};return _0x58e0d2;}})});}_0x561717=_[_0xd5e8('0x53')]({},_0x561717,_0x569f00[_0xd5e8('0x56')]);var _0x4db32f={'where':_0x561717[_0xd5e8('0x50')]};return db[_0xd5e8('0x41')][_0xd5e8('0x34')](_0x4db32f)[_0xd5e8('0x3c')](function(_0x5c8de6){_0x53531d[_0xd5e8('0x34')]=_0x5c8de6;if(_0x569f00[_0xd5e8('0x46')][_0xd5e8('0x57')]){_0x561717['include']=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x561717);})['then'](function(_0x234529){_0x53531d[_0xd5e8('0x58')]=_0x234529;return _0x53531d;})[_0xd5e8('0x3c')](respondWithFilteredResult(_0x2e469a,_0x561717))['catch'](handleError(_0x2e469a,null));};exports[_0xd5e8('0x59')]=function(_0x19b810,_0x5a99b2){var _0x565cdd={'raw':!![],'where':{'id':_0x19b810[_0xd5e8('0x5a')]['id']}},_0x4a35ca={};_0x4a35ca[_0xd5e8('0x44')]=_[_0xd5e8('0x45')](db[_0xd5e8('0x41')]['rawAttributes']);_0x4a35ca[_0xd5e8('0x46')]=_[_0xd5e8('0x45')](_0x19b810[_0xd5e8('0x46')]);_0x4a35ca[_0xd5e8('0x47')]=_[_0xd5e8('0x48')](_0x4a35ca[_0xd5e8('0x44')],_0x4a35ca[_0xd5e8('0x46')]);_0x565cdd['attributes']=_[_0xd5e8('0x48')](_0x4a35ca[_0xd5e8('0x44')],qs['fields'](_0x19b810[_0xd5e8('0x46')][_0xd5e8('0x49')]));_0x565cdd['attributes']=_0x565cdd[_0xd5e8('0x4a')]['length']?_0x565cdd[_0xd5e8('0x4a')]:_0x4a35ca[_0xd5e8('0x44')];if(_0x19b810['query']['includeAll']){_0x565cdd[_0xd5e8('0x5b')]=[{'all':!![]}];}_0x565cdd=_[_0xd5e8('0x53')]({},_0x565cdd,_0x19b810['options']);return db[_0xd5e8('0x41')][_0xd5e8('0x5c')](_0x565cdd)['then'](handleEntityNotFound(_0x5a99b2,null))[_0xd5e8('0x3c')](respondWithResult(_0x5a99b2,null))[_0xd5e8('0x2d')](handleError(_0x5a99b2,null));};exports[_0xd5e8('0x5d')]=function(_0x24f57c,_0x29a8ec){return db['OpenchannelMessage']['create'](_0x24f57c[_0xd5e8('0x5e')],{})[_0xd5e8('0x3c')](respondWithResult(_0x29a8ec,0xc9))[_0xd5e8('0x2d')](handleError(_0x29a8ec,null));};exports[_0xd5e8('0x5f')]=function(_0xc07558,_0x4eb31d){if(_0xc07558['body']['id']){delete _0xc07558[_0xd5e8('0x5e')]['id'];}return db[_0xd5e8('0x41')][_0xd5e8('0x5c')]({'where':{'id':_0xc07558[_0xd5e8('0x5a')]['id']}})[_0xd5e8('0x3c')](handleEntityNotFound(_0x4eb31d,null))[_0xd5e8('0x3c')](saveUpdates(_0xc07558['body'],null))[_0xd5e8('0x3c')](respondWithResult(_0x4eb31d,null))[_0xd5e8('0x2d')](handleError(_0x4eb31d,null));};exports[_0xd5e8('0x3b')]=function(_0x4017a3,_0x1d4fee){return db[_0xd5e8('0x41')][_0xd5e8('0x5c')]({'where':{'id':_0x4017a3[_0xd5e8('0x5a')]['id']}})[_0xd5e8('0x3c')](handleEntityNotFound(_0x1d4fee,null))[_0xd5e8('0x3c')](removeEntity(_0x1d4fee,null))[_0xd5e8('0x2d')](handleError(_0x1d4fee,null));};exports['describe']=function(_0x1fe64d,_0x26c26f){return db[_0xd5e8('0x41')][_0xd5e8('0x60')]()['then'](respondWithResult(_0x26c26f,null))[_0xd5e8('0x2d')](handleError(_0x26c26f,null));};var interaction_log=require('../../config/logger')(_0xd5e8('0x61'));exports[_0xd5e8('0x62')]=function(_0x4ce82c,_0x594835,_0x4d98ac){var _0x13549b={'agent':{},'channel':'openchannel'};if(_0x4ce82c[_0xd5e8('0x5e')]['id']){delete _0x4ce82c[_0xd5e8('0x5e')]['id'];}_0x4ce82c['body']['read']=!![];_0x4ce82c[_0xd5e8('0x5e')][_0xd5e8('0x63')]=moment()[_0xd5e8('0x64')](_0xd5e8('0x65'));_0x4ce82c[_0xd5e8('0x5e')][_0xd5e8('0x66')]=_0x4ce82c[_0xd5e8('0x5e')][_0xd5e8('0x66')]||_0x4ce82c['user']['id'];_0x13549b[_0xd5e8('0x67')]['id']=_0x4ce82c[_0xd5e8('0x5e')][_0xd5e8('0x66')];return db[_0xd5e8('0x41')][_0xd5e8('0x5c')]({'where':{'id':_0x4ce82c[_0xd5e8('0x5a')]['id'],'UserId':null}})[_0xd5e8('0x3c')](handleEntityNotFound(_0x594835,null))['then'](saveUpdates(_0x4ce82c[_0xd5e8('0x5e')],null))[_0xd5e8('0x3c')](function(_0x5b7d35){if(_0x5b7d35){_0x13549b[_0xd5e8('0x2b')]=_0x5b7d35[_0xd5e8('0x68')]({'plain':!![]});return db[_0xd5e8('0x69')][_0xd5e8('0x5c')]({'where':{'id':_0x5b7d35[_0xd5e8('0x6a')]}});}return null;})[_0xd5e8('0x3c')](handleEntityNotFound(_0x594835,null))[_0xd5e8('0x3c')](function(_0x4d94c4){if(_0x4d94c4){return _0x4d94c4[_0xd5e8('0x5f')]({'UserId':_0x4ce82c[_0xd5e8('0x5e')]['UserId'],'read1stAt':_[_0xd5e8('0x6b')](_0x4d94c4[_0xd5e8('0x6c')])?moment()[_0xd5e8('0x64')](_0xd5e8('0x65')):undefined});}return null;})['then'](function(_0x297fa6){if(_0x297fa6){_0x13549b[_0xd5e8('0x6d')]=_0x297fa6[_0xd5e8('0x68')]({'plain':!![]});interaction_log[_0xd5e8('0x23')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4ce82c[_0xd5e8('0x6e')]['id'],_0x4ce82c['user'][_0xd5e8('0x3e')],_0x4ce82c[_0xd5e8('0x6e')][_0xd5e8('0x6f')],_0x13549b[_0xd5e8('0x6d')]['id'],_0x4ce82c['body']?JSON['stringify'](_0x4ce82c[_0xd5e8('0x5e')]):_0xd5e8('0x70'));return respondWithRpcPromise(_0xd5e8('0x71'),'acceptMessage',_0x13549b);}return null;})[_0xd5e8('0x3c')](function(_0xea8dba){var _0x2fb610='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xea8dba['message'][_0xd5e8('0x72')];return db['sequelize'][_0xd5e8('0x46')](_0x2fb610,{'type':db[_0xd5e8('0x73')][_0xd5e8('0x74')][_0xd5e8('0x75')],'raw':!![]})[_0xd5e8('0x3c')](function(_0x80530f){return _0x80530f;});})['then'](function(_0x21bceb){if(_0x21bceb){_0x13549b[_0xd5e8('0x2b')]['contact']=_0x21bceb[0x0];if(!_0x4ce82c[_0xd5e8('0x5e')][_0xd5e8('0x66')])return;return db[_0xd5e8('0x76')][_0xd5e8('0x5c')]({'where':{'id':_0x4ce82c[_0xd5e8('0x5e')][_0xd5e8('0x66')],'role':'agent'},'attributes':['id',_0xd5e8('0x3e'),_0xd5e8('0x77'),_0xd5e8('0x78'),_0xd5e8('0x79')],'raw':!![]});}return null;})[_0xd5e8('0x3c')](function(_0x42ce26){if(!_0x42ce26)return null;_0x13549b[_0xd5e8('0x2b')][_0xd5e8('0x67')]=_0x42ce26;return _0x13549b;})[_0xd5e8('0x3c')](function(_0x2af521){if(_0x2af521){if(_0x4ce82c[_0xd5e8('0x5e')][_0xd5e8('0x7a')]){_0x13549b['message'][_0xd5e8('0x7b')]=util[_0xd5e8('0x64')](_0xd5e8('0x7c'),_0x4ce82c[_0xd5e8('0x6e')][_0xd5e8('0x3e')]);_0x13549b[_0xd5e8('0x2b')][_0xd5e8('0x7d')]=_0x13549b[_0xd5e8('0x7d')];_0x13549b[_0xd5e8('0x2b')][_0xd5e8('0x7e')]=_0x13549b['channel'];_0x13549b[_0xd5e8('0x2b')]['event']=_0xd5e8('0x62');return respondWithRpcPromise(_0xd5e8('0x7f'),_0xd5e8('0x7f'),{'event':_0xd5e8('0x80'),'message':_0x13549b[_0xd5e8('0x2b')]},client9002)['then'](function(){return _0x13549b;});}return _0x13549b;}return null;})[_0xd5e8('0x3c')](respondWithResult(_0x594835,null))[_0xd5e8('0x2d')](handleError(_0x594835,null));};var interaction_log=require(_0xd5e8('0x15'))(_0xd5e8('0x61'));exports[_0xd5e8('0x39')]=function(_0x2592bd,_0xf6835d,_0x2764ee){var _0x1b69d4={'agent':{},'channel':_0xd5e8('0x81')};if(_0x2592bd[_0xd5e8('0x5e')]['id']){delete _0x2592bd[_0xd5e8('0x5e')]['id'];}_0x2592bd['body'][_0xd5e8('0x66')]=_0x2592bd[_0xd5e8('0x5e')][_0xd5e8('0x66')]||_0x2592bd[_0xd5e8('0x6e')]['id'];_0x1b69d4[_0xd5e8('0x67')]['id']=_0x2592bd[_0xd5e8('0x5e')][_0xd5e8('0x66')];return db[_0xd5e8('0x41')][_0xd5e8('0x5c')]({'where':{'id':_0x2592bd['params']['id'],'UserId':null}})[_0xd5e8('0x3c')](handleEntityNotFound(_0xf6835d,null))[_0xd5e8('0x3c')](function(_0x5c20bd){if(_0x5c20bd){_0x1b69d4[_0xd5e8('0x2b')]=_0x5c20bd['get']({'plain':!![]});return db[_0xd5e8('0x69')][_0xd5e8('0x5c')]({'where':{'id':_0x5c20bd[_0xd5e8('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0xf6835d,null))[_0xd5e8('0x3c')](function(_0x55bcc5){if(_0x55bcc5){_0x1b69d4[_0xd5e8('0x6d')]=_0x55bcc5[_0xd5e8('0x68')]({'plain':!![]});interaction_log[_0xd5e8('0x23')](_0xd5e8('0x82'),_0x2592bd[_0xd5e8('0x6e')]['id'],_0x2592bd[_0xd5e8('0x6e')]['name'],_0x2592bd[_0xd5e8('0x6e')][_0xd5e8('0x6f')],_0x1b69d4[_0xd5e8('0x6d')]['id'],_0x2592bd[_0xd5e8('0x5e')]?JSON[_0xd5e8('0x28')](_0x2592bd[_0xd5e8('0x5e')]):'null');return respondWithRpcPromise(_0xd5e8('0x83'),_0xd5e8('0x84'),_0x1b69d4);}return null;})[_0xd5e8('0x3c')](function(_0x13c7ea){var _0x3690cf=_0xd5e8('0x85')+_0x13c7ea['message'][_0xd5e8('0x72')];return db[_0xd5e8('0x86')][_0xd5e8('0x46')](_0x3690cf,{'type':db[_0xd5e8('0x73')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x598df2){return _0x598df2;});})[_0xd5e8('0x3c')](function(_0x25449f){if(_0x25449f){_0x1b69d4[_0xd5e8('0x2b')]['contact']=_0x25449f[0x0];if(!_0x2592bd['body'][_0xd5e8('0x66')])return;return db[_0xd5e8('0x76')][_0xd5e8('0x5c')]({'where':{'id':_0x2592bd[_0xd5e8('0x5e')][_0xd5e8('0x66')],'role':'agent'},'attributes':['id','name',_0xd5e8('0x77'),_0xd5e8('0x78'),_0xd5e8('0x79')],'raw':!![]});}return null;})[_0xd5e8('0x3c')](function(_0xc075a5){if(!_0xc075a5)return null;_0x1b69d4[_0xd5e8('0x2b')][_0xd5e8('0x67')]=_0xc075a5;return _0x1b69d4;})[_0xd5e8('0x3c')](function(_0x3b9b63){if(_0x3b9b63){_0x3b9b63[_0xd5e8('0x2b')][_0xd5e8('0x7b')]=util[_0xd5e8('0x64')]('SIP/%s',_0x2592bd['user']['name']);_0x3b9b63['message']['channel']=_0x1b69d4[_0xd5e8('0x7d')];_0x3b9b63[_0xd5e8('0x2b')][_0xd5e8('0x7e')]=_0x1b69d4[_0xd5e8('0x7d')];_0x3b9b63['message'][_0xd5e8('0x87')]=_0xd5e8('0x39');respondWithRpcPromise('EventManager',_0xd5e8('0x7f'),{'event':_0xd5e8('0x88'),'message':_0x3b9b63[_0xd5e8('0x2b')]},client9002);return _0x1b69d4;}return null;})[_0xd5e8('0x3c')](respondWithResult(_0xf6835d,null))[_0xd5e8('0x2d')](handleError(_0xf6835d,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index b32db29..0823334 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 _0x491b=['hook','exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x491b,0x17c));var _0xb491=function(_0x1899e9,_0x142665){_0x1899e9=_0x1899e9-0x0;var _0x399a45=_0x491b[_0x1899e9];return _0x399a45;};'use strict';var EventEmitter=require(_0xb491('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xb491('0x1')](0x0);var events={'afterCreate':_0xb491('0x2'),'afterUpdate':_0xb491('0x3'),'afterDestroy':_0xb491('0x4')};function emitEvent(_0x100939){return function(_0x729bb,_0x214671,_0x5aab1d){OpenchannelMessageEvents['emit'](_0x100939+':'+_0x729bb['id'],_0x729bb);OpenchannelMessageEvents[_0xb491('0x5')](_0x100939,_0x729bb);_0x5aab1d(null);};}for(var e in events){if(events[_0xb491('0x6')](e)){var event=events[e];OpenchannelMessage[_0xb491('0x7')](e,emitEvent(event));}}module[_0xb491('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xbbc0=['hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0xbbc0,0xec));var _0x0bbc=function(_0x637800,_0x336c24){_0x637800=_0x637800-0x0;var _0x28ad13=_0xbbc0[_0x637800];return _0x28ad13;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x0bbc('0x0'))['db'][_0x0bbc('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x0bbc('0x2')](0x0);var events={'afterCreate':_0x0bbc('0x3'),'afterUpdate':_0x0bbc('0x4'),'afterDestroy':_0x0bbc('0x5')};function emitEvent(_0x384076){return function(_0x47342f,_0x314337,_0x358ade){OpenchannelMessageEvents[_0x0bbc('0x6')](_0x384076+':'+_0x47342f['id'],_0x47342f);OpenchannelMessageEvents[_0x0bbc('0x6')](_0x384076,_0x47342f);_0x358ade(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x0bbc('0x7')](e,emitEvent(event));}}module[_0x0bbc('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index b47e7c3..cbfa361 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 _0x442c=['models','get','direction','out','secret','UserId','OpenchannelInteraction','findOne','then','update','toLowerCase','catch','CmContact','describe','OpenchannelAccount','Interactions','OpenchannelInteractionId','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','length','Interaction','omit','Contact','POST','method','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','finally','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','body'];(function(_0x3ed388,_0x423fd6){var _0x5af25e=function(_0x406f3d){while(--_0x406f3d){_0x3ed388['push'](_0x3ed388['shift']());}};_0x5af25e(++_0x423fd6);}(_0x442c,0x1a3));var _0xc442=function(_0x1a3a63,_0x424db7){_0x1a3a63=_0x1a3a63-0x0;var _0x20e253=_0x442c[_0x1a3a63];return _0x20e253;};'use strict';var _=require('lodash');var util=require(_0xc442('0x0'));var logger=require(_0xc442('0x1'))('api');var moment=require(_0xc442('0x2'));var BPromise=require(_0xc442('0x3'));var rp=require(_0xc442('0x4'));var fs=require('fs');var path=require(_0xc442('0x5'));var rimraf=require(_0xc442('0x6'));var config=require(_0xc442('0x7'));var attributes=require(_0xc442('0x8'));module[_0xc442('0x9')]=function(_0x4734df,_0x1e5719){return _0x4734df[_0xc442('0xa')]('OpenchannelMessage',attributes,{'tableName':_0xc442('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xc442('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4136ac,_0x36d956,_0x4392c4){var _0x32885c=_0x4734df[_0xc442('0xd')];var _0x5f5852=_0x4136ac[_0xc442('0xe')]({'plain':!![]});if(_0x5f5852[_0xc442('0xf')]['toLowerCase']()==='in'||_0x5f5852[_0xc442('0xf')]['toLowerCase']()===_0xc442('0x10')&&!_0x5f5852[_0xc442('0x11')]&&!_['isNil'](_0x5f5852[_0xc442('0x12')])){_0x32885c[_0xc442('0x13')][_0xc442('0x14')]({'where':{'id':_0x5f5852['OpenchannelInteractionId']}})[_0xc442('0x15')](function(_0x4f7f42){if(_0x4f7f42){_0x4f7f42[_0xc442('0x16')]({'lastMsgAt':_0x5f5852['createdAt'],'lastMsgDirection':_0x5f5852['direction'][_0xc442('0x17')]()});}})[_0xc442('0x18')](function(_0x38cbac){console['error'](_0x38cbac);});}if(_0x5f5852[_0xc442('0xf')]===_0xc442('0x10')&&!_0x5f5852['secret']){var _0x4f2471;_0x32885c[_0xc442('0x19')][_0xc442('0x1a')]()['then'](function(_0x9c2121){return _0x32885c[_0xc442('0x1b')]['find']({'where':{'id':_0x5f5852['OpenchannelAccountId']},'include':[{'model':_0x32885c[_0xc442('0x13')],'as':_0xc442('0x1c'),'where':{'id':_0x5f5852[_0xc442('0x1d')]},'limit':0x1,'include':[{'model':_0x32885c[_0xc442('0x19')],'as':'Contact','attributes':_['keys'](_0x9c2121)}]}]});})[_0xc442('0x15')](function(_0x8963f2){_0x4f2471=_0x8963f2['get']({'plain':!![]});if(_0x4f2471&&_0x4f2471[_0xc442('0x1e')]){logger[_0xc442('0x1f')](_0xc442('0x20'),'afterCreate',util[_0xc442('0x21')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x5f5852['id'],_0x4f2471[_0xc442('0x1e')]));if(_0x4f2471[_0xc442('0x1c')]&&_0x4f2471[_0xc442('0x1c')][_0xc442('0x22')]){_0x5f5852[_0xc442('0x23')]=_[_0xc442('0x24')](_0x4f2471[_0xc442('0x1c')][0x0],_0xc442('0x25'));_0x5f5852[_0xc442('0x25')]=_0x4f2471[_0xc442('0x1c')][0x0][_0xc442('0x25')];}var _0x36d956={'method':_0xc442('0x26'),'uri':encodeURI(_0x4f2471[_0xc442('0x1e')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x36d956[_0xc442('0x27')]){case _0xc442('0x28'):_0x36d956['qs']=_0x5f5852;break;case _0xc442('0x26'):_0x36d956['body']=_0x5f5852;break;}return rp(_0x36d956)[_0xc442('0x15')](function(_0x407a6f){logger[_0xc442('0x1f')](_0xc442('0x20'),_0xc442('0x29'),util['format'](_0xc442('0x2a'),_0x5f5852['id'],_0x4f2471['replyUri']));if(_0x407a6f[_0xc442('0xc')][_0xc442('0x2b')]&&_0x407a6f[_0xc442('0xc')][_0xc442('0x2b')]!=_0x5f5852['Interaction'][_0xc442('0x2b')]){return _0x32885c['OpenchannelInteraction'][_0xc442('0x16')]({'threadId':_0x407a6f['body'][_0xc442('0x2b')]},{'where':{'id':_0x5f5852[_0xc442('0x23')]['id']}});}else{return;}})[_0xc442('0x15')](function(){return _0x4136ac[_0xc442('0x16')]({'read':!![]});})[_0xc442('0x18')](function(_0x30b66a){logger[_0xc442('0x2c')](_0xc442('0x20'),_0xc442('0x29'),util[_0xc442('0x2d')](_0x30b66a,{'showHidden':![],'depth':null}));_0x4392c4();});}else{_0x4392c4();}})[_0xc442('0x2e')](function(){_0x4392c4();});}else{_0x4392c4();}}},'charset':'utf8mb4','collate':_0xc442('0x2f')});}; \ No newline at end of file +var _0xcda0=['format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','GET','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','body','threadId','Interaction','error','inspect','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','FULLTEXT','get','direction','toLowerCase','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','out','CmContact','OpenchannelAccount','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info'];(function(_0x416f54,_0x14e69a){var _0x46a554=function(_0x4064c4){while(--_0x4064c4){_0x416f54['push'](_0x416f54['shift']());}};_0x46a554(++_0x14e69a);}(_0xcda0,0xcb));var _0x0cda=function(_0x1fc52c,_0x13ca67){_0x1fc52c=_0x1fc52c-0x0;var _0x286f5b=_0xcda0[_0x1fc52c];return _0x286f5b;};'use strict';var _=require('lodash');var util=require(_0x0cda('0x0'));var logger=require('../../config/logger')(_0x0cda('0x1'));var moment=require('moment');var BPromise=require(_0x0cda('0x2'));var rp=require(_0x0cda('0x3'));var fs=require('fs');var path=require(_0x0cda('0x4'));var rimraf=require('rimraf');var config=require(_0x0cda('0x5'));var attributes=require(_0x0cda('0x6'));module[_0x0cda('0x7')]=function(_0xf1de88,_0x2506ca){return _0xf1de88[_0x0cda('0x8')]('OpenchannelMessage',attributes,{'tableName':_0x0cda('0x9'),'paranoid':![],'indexes':[{'name':_0x0cda('0xa'),'fields':['body'],'type':_0x0cda('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x20c163,_0x36a70a,_0x262f65){var _0x2011d1=_0xf1de88['models'];var _0xb0248c=_0x20c163[_0x0cda('0xc')]({'plain':!![]});if(_0xb0248c[_0x0cda('0xd')][_0x0cda('0xe')]()==='in'||_0xb0248c['direction']['toLowerCase']()==='out'&&!_0xb0248c['secret']&&!_[_0x0cda('0xf')](_0xb0248c[_0x0cda('0x10')])){_0x2011d1[_0x0cda('0x11')][_0x0cda('0x12')]({'where':{'id':_0xb0248c[_0x0cda('0x13')]}})[_0x0cda('0x14')](function(_0x296cfb){if(_0x296cfb){_0x296cfb[_0x0cda('0x15')]({'lastMsgAt':_0xb0248c['createdAt'],'lastMsgDirection':_0xb0248c[_0x0cda('0xd')][_0x0cda('0xe')]()});}})[_0x0cda('0x16')](function(_0x23c5be){console['error'](_0x23c5be);});}if(_0xb0248c['direction']===_0x0cda('0x17')&&!_0xb0248c['secret']){var _0x2b6fa3;_0x2011d1[_0x0cda('0x18')]['describe']()[_0x0cda('0x14')](function(_0x3d9a83){return _0x2011d1[_0x0cda('0x19')]['find']({'where':{'id':_0xb0248c[_0x0cda('0x1a')]},'include':[{'model':_0x2011d1[_0x0cda('0x11')],'as':_0x0cda('0x1b'),'where':{'id':_0xb0248c[_0x0cda('0x13')]},'limit':0x1,'include':[{'model':_0x2011d1['CmContact'],'as':_0x0cda('0x1c'),'attributes':_[_0x0cda('0x1d')](_0x3d9a83)}]}]});})[_0x0cda('0x14')](function(_0x24f5c8){_0x2b6fa3=_0x24f5c8[_0x0cda('0xc')]({'plain':!![]});if(_0x2b6fa3&&_0x2b6fa3[_0x0cda('0x1e')]){logger[_0x0cda('0x1f')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x0cda('0x20')](_0x0cda('0x21'),_0xb0248c['id'],_0x2b6fa3[_0x0cda('0x1e')]));if(_0x2b6fa3['Interactions']&&_0x2b6fa3[_0x0cda('0x1b')][_0x0cda('0x22')]){_0xb0248c['Interaction']=_[_0x0cda('0x23')](_0x2b6fa3[_0x0cda('0x1b')][0x0],'Contact');_0xb0248c['Contact']=_0x2b6fa3[_0x0cda('0x1b')][0x0][_0x0cda('0x1c')];}var _0x36a70a={'method':'POST','uri':encodeURI(_0x2b6fa3['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x36a70a['method']){case _0x0cda('0x24'):_0x36a70a['qs']=_0xb0248c;break;case'POST':_0x36a70a['body']=_0xb0248c;break;}return rp(_0x36a70a)[_0x0cda('0x14')](function(_0x232532){logger['info'](_0x0cda('0x25'),_0x0cda('0x26'),util[_0x0cda('0x20')](_0x0cda('0x27'),_0xb0248c['id'],_0x2b6fa3[_0x0cda('0x1e')]));if(_0x232532[_0x0cda('0x28')]['threadId']&&_0x232532['body'][_0x0cda('0x29')]!=_0xb0248c[_0x0cda('0x2a')]['threadId']){return _0x2011d1[_0x0cda('0x11')]['update']({'threadId':_0x232532[_0x0cda('0x28')]['threadId']},{'where':{'id':_0xb0248c['Interaction']['id']}});}else{return;}})[_0x0cda('0x14')](function(){return _0x20c163['update']({'read':!![]});})[_0x0cda('0x16')](function(_0x3b8779){logger[_0x0cda('0x2b')]('OpenchannelMessage,\x20%s,\x20%s',_0x0cda('0x26'),util[_0x0cda('0x2c')](_0x3b8779,{'showHidden':![],'depth':null}));_0x262f65();});}else{_0x262f65();}})['finally'](function(){_0x262f65();});}else{_0x262f65();}}},'charset':_0x0cda('0x2d'),'collate':_0x0cda('0x2e')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 7d72989..4a57744 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(_0xea4e51,_0x4ae384){var _0x3a1583=function(_0x119b6f){while(--_0x119b6f){_0xea4e51['push'](_0xea4e51['shift']());}};_0x3a1583(++_0x4ae384);}(_0x7a54,0x106));var _0x47a5=function(_0xab7a58,_0x189898){_0xab7a58=_0xab7a58-0x0;var _0x597aac=_0x7a54[_0xab7a58];return _0x597aac;};'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 _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x3ce71c,_0x2b3392){var _0x339fcd=function(_0x511964){while(--_0x511964){_0x3ce71c['push'](_0x3ce71c['shift']());}};_0x339fcd(++_0x2b3392);}(_0x0b0e,0x187));var _0xe0b0=function(_0x450f09,_0x59561d){_0x450f09=_0x450f09-0x0;var _0x4e22ec=_0x0b0e[_0x450f09];return _0x4e22ec;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 19a7b56..cd178ab 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 _0x425d=['save','remove','update','emit','removeListener','length','./openchannelMessage.events'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x425d,0x179));var _0xd425=function(_0x1ccda4,_0x1647d3){_0x1ccda4=_0x1ccda4-0x0;var _0x334196=_0x425d[_0x1ccda4];return _0x334196;};'use strict';var OpenchannelMessageEvents=require(_0xd425('0x0'));var events=[_0xd425('0x1'),_0xd425('0x2'),_0xd425('0x3')];function createListener(_0x22f12f,_0x50eee4){return function(_0x1f10db){_0x50eee4[_0xd425('0x4')](_0x22f12f,_0x1f10db);};}function removeListener(_0x1a8186,_0x5127d8){return function(){OpenchannelMessageEvents[_0xd425('0x5')](_0x1a8186,_0x5127d8);};}exports['register']=function(_0x4377e9){for(var _0x3b6510=0x0,_0x4c7ed5=events[_0xd425('0x6')];_0x3b6510<_0x4c7ed5;_0x3b6510++){var _0x37cda8=events[_0x3b6510];var _0x3a047c=createListener('openchannelMessage:'+_0x37cda8,_0x4377e9);OpenchannelMessageEvents['on'](_0x37cda8,_0x3a047c);}}; \ No newline at end of file +var _0x204b=['save','remove','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x4889a2,_0x688e52){var _0x260d45=function(_0x28fa2b){while(--_0x28fa2b){_0x4889a2['push'](_0x4889a2['shift']());}};_0x260d45(++_0x688e52);}(_0x204b,0x6f));var _0xb204=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x204b[_0xaa1b3e];return _0x454d7d;};'use strict';var OpenchannelMessageEvents=require(_0xb204('0x0'));var events=[_0xb204('0x1'),_0xb204('0x2'),'update'];function createListener(_0x309253,_0x3f774b){return function(_0x2d718b){_0x3f774b[_0xb204('0x3')](_0x309253,_0x2d718b);};}function removeListener(_0x17d454,_0x58e5b4){return function(){OpenchannelMessageEvents[_0xb204('0x4')](_0x17d454,_0x58e5b4);};}exports['register']=function(_0xf41dce){for(var _0xf5a78e=0x0,_0xe05676=events[_0xb204('0x5')];_0xf5a78e<_0xe05676;_0xf5a78e++){var _0x337618=events[_0xf5a78e];var _0x3932ad=createListener(_0xb204('0x6')+_0x337618,_0xf41dce);OpenchannelMessageEvents['on'](_0x337618,_0x3932ad);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index ead3859..779cfad 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 _0x9848=['removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','index','get','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','delete','destroy'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9848,0x14d));var _0x8984=function(_0x53df47,_0x5b8326){_0x53df47=_0x53df47-0x0;var _0x2fb0f2=_0x9848[_0x53df47];return _0x2fb0f2;};'use strict';var multer=require('multer');var util=require(_0x8984('0x0'));var path=require(_0x8984('0x1'));var timeout=require(_0x8984('0x2'));var express=require(_0x8984('0x3'));var router=express[_0x8984('0x4')]();var fs_extra=require(_0x8984('0x5'));var auth=require(_0x8984('0x6'));var interaction=require(_0x8984('0x7'));var config=require(_0x8984('0x8'));var controller=require(_0x8984('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8984('0xa')]);router[_0x8984('0xb')]('/describe',auth[_0x8984('0xc')](),controller[_0x8984('0xd')]);router[_0x8984('0xb')](_0x8984('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x8984('0xb')](_0x8984('0xf'),auth['isAuthenticated'](),controller[_0x8984('0x10')]);router['get'](_0x8984('0x11'),auth[_0x8984('0xc')](),controller[_0x8984('0x12')]);router['get'](_0x8984('0x13'),auth[_0x8984('0xc')](),controller[_0x8984('0x14')]);router[_0x8984('0x15')]('/',auth[_0x8984('0xc')](),controller[_0x8984('0x16')]);router[_0x8984('0x15')](_0x8984('0x11'),auth[_0x8984('0xc')](),controller[_0x8984('0x17')]);router[_0x8984('0x15')](_0x8984('0x13'),auth[_0x8984('0xc')](),controller['addAgents']);router[_0x8984('0x18')](_0x8984('0xe'),auth[_0x8984('0xc')](),controller['update']);router[_0x8984('0x19')](_0x8984('0xe'),auth[_0x8984('0xc')](),controller[_0x8984('0x1a')]);router[_0x8984('0x19')](_0x8984('0x11'),auth['isAuthenticated'](),controller[_0x8984('0x1b')]);router[_0x8984('0x19')](_0x8984('0x13'),auth[_0x8984('0xc')](),controller[_0x8984('0x1c')]);module[_0x8984('0x1d')]=router; \ No newline at end of file +var _0xf777=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','destroy','removeTeams','removeAgents','exports','multer'];(function(_0x5b1780,_0x1493a4){var _0x4c0324=function(_0x585178){while(--_0x585178){_0x5b1780['push'](_0x5b1780['shift']());}};_0x4c0324(++_0x1493a4);}(_0xf777,0x1af));var _0x7f77=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf777[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7f77('0x0'));var util=require(_0x7f77('0x1'));var path=require(_0x7f77('0x2'));var timeout=require(_0x7f77('0x3'));var express=require(_0x7f77('0x4'));var router=express['Router']();var fs_extra=require(_0x7f77('0x5'));var auth=require(_0x7f77('0x6'));var interaction=require(_0x7f77('0x7'));var config=require(_0x7f77('0x8'));var controller=require('./openchannelQueue.controller');router[_0x7f77('0x9')]('/',auth[_0x7f77('0xa')](),controller[_0x7f77('0xb')]);router['get']('/describe',auth[_0x7f77('0xa')](),controller[_0x7f77('0xc')]);router[_0x7f77('0x9')](_0x7f77('0xd'),auth[_0x7f77('0xa')](),controller[_0x7f77('0xe')]);router[_0x7f77('0x9')](_0x7f77('0xf'),auth[_0x7f77('0xa')](),controller['getMembers']);router[_0x7f77('0x9')](_0x7f77('0x10'),auth[_0x7f77('0xa')](),controller[_0x7f77('0x11')]);router[_0x7f77('0x9')](_0x7f77('0x12'),auth[_0x7f77('0xa')](),controller[_0x7f77('0x13')]);router[_0x7f77('0x14')]('/',auth[_0x7f77('0xa')](),controller['create']);router[_0x7f77('0x14')]('/:id/teams',auth[_0x7f77('0xa')](),controller['addTeams']);router[_0x7f77('0x14')](_0x7f77('0x12'),auth[_0x7f77('0xa')](),controller[_0x7f77('0x15')]);router[_0x7f77('0x16')]('/:id',auth[_0x7f77('0xa')](),controller['update']);router['delete'](_0x7f77('0xd'),auth[_0x7f77('0xa')](),controller[_0x7f77('0x17')]);router['delete'](_0x7f77('0x10'),auth[_0x7f77('0xa')](),controller[_0x7f77('0x18')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x7f77('0x19')]);module[_0x7f77('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 440bb3f..66479e5 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 _0xe669=['exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x459879,_0x16b25d){var _0xa84228=function(_0x28d85b){while(--_0x28d85b){_0x459879['push'](_0x459879['shift']());}};_0xa84228(++_0x16b25d);}(_0xe669,0x137));var _0x9e66=function(_0x553150,_0x589ff3){_0x553150=_0x553150-0x0;var _0x18193d=_0xe669[_0x553150];return _0x18193d;};'use strict';var Sequelize=require(_0x9e66('0x0'));module[_0x9e66('0x1')]={'name':{'type':Sequelize[_0x9e66('0x2')],'unique':_0x9e66('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x9e66('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9e66('0x5'),_0x9e66('0x6'),_0x9e66('0x7'))}}; \ No newline at end of file +var _0x8fc0=['rrmemory','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x7775a3,_0xa2b8cd){var _0x26ea39=function(_0x1bb2e4){while(--_0x1bb2e4){_0x7775a3['push'](_0x7775a3['shift']());}};_0x26ea39(++_0xa2b8cd);}(_0x8fc0,0x1bb));var _0x08fc=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x8fc0[_0x616290];return _0x453879;};'use strict';var Sequelize=require(_0x08fc('0x0'));module['exports']={'name':{'type':Sequelize[_0x08fc('0x1')],'unique':_0x08fc('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x08fc('0x1')]},'timeout':{'type':Sequelize[_0x08fc('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x08fc('0x4')](_0x08fc('0x5'),'beepall',_0x08fc('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 6ac9ead..d68ec8b 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 _0x9805=['status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','get','OpenchannelQueues','UserProfileResource','stack','name','send','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','OpenchannelQueue','includeAll','include','findAll','catch','show','params','filters','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','error','destroy','describe','findOne','UserOpenchannelQueue','hasOwnProperty','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','select','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x9805,0xfd));var _0x5980=function(_0x4aace4,_0x2c2119){_0x4aace4=_0x4aace4-0x0;var _0x15b47c=_0x9805[_0x4aace4];return _0x15b47c;};'use strict';var emlformat=require(_0x5980('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5980('0x1'));var jsonpatch=require(_0x5980('0x2'));var rp=require('request-promise');var moment=require(_0x5980('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5980('0x4'));var util=require(_0x5980('0x5'));var path=require(_0x5980('0x6'));var sox=require(_0x5980('0x7'));var csv=require('to-csv');var ejs=require(_0x5980('0x8'));var fs=require('fs');var fs_extra=require(_0x5980('0x9'));var _=require(_0x5980('0xa'));var squel=require(_0x5980('0xb'));var crypto=require(_0x5980('0xc'));var jsforce=require(_0x5980('0xd'));var deskjs=require(_0x5980('0xe'));var toCsv=require(_0x5980('0xf'));var querystring=require(_0x5980('0x10'));var Papa=require(_0x5980('0x11'));var Redis=require('ioredis');var authService=require(_0x5980('0x12'));var qs=require(_0x5980('0x13'));var as=require(_0x5980('0x14'));var hardwareService=require(_0x5980('0x15'));var logger=require(_0x5980('0x16'))(_0x5980('0x17'));var utils=require(_0x5980('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5980('0x19'));var db=require(_0x5980('0x1a'))['db'];config[_0x5980('0x1b')]=_[_0x5980('0x1c')](config['redis'],{'host':_0x5980('0x1d'),'port':0x18eb});var socket=require(_0x5980('0x1e'))(new Redis(config[_0x5980('0x1b')]));require(_0x5980('0x1f'))['register'](socket);function respondWithStatusCode(_0x1ebc4b,_0x41a3a5){_0x41a3a5=_0x41a3a5||0xcc;return function(_0x4334d0){if(_0x4334d0){return _0x1ebc4b[_0x5980('0x20')](_0x41a3a5);}return _0x1ebc4b[_0x5980('0x21')](_0x41a3a5)[_0x5980('0x22')]();};}function respondWithResult(_0x57d39c,_0x4cdb64){_0x4cdb64=_0x4cdb64||0xc8;return function(_0x3aca49){if(_0x3aca49){return _0x57d39c['status'](_0x4cdb64)[_0x5980('0x23')](_0x3aca49);}};}function respondWithFilteredResult(_0x137932,_0x119b7f){return function(_0x2af8c9){if(_0x2af8c9){var _0xb98c7e=typeof _0x119b7f[_0x5980('0x24')]===_0x5980('0x25')&&typeof _0x119b7f[_0x5980('0x26')]===_0x5980('0x25');var _0xbe08e1=_0x2af8c9[_0x5980('0x27')];var _0x1bcc3b=_0xb98c7e?0x0:_0x119b7f['offset'];var _0x962163=_0xb98c7e?_0x2af8c9['count']:_0x119b7f[_0x5980('0x24')]+_0x119b7f[_0x5980('0x26')];var _0x305bb1;if(_0x962163>=_0xbe08e1){_0x962163=_0xbe08e1;_0x305bb1=0xc8;}else{_0x305bb1=0xce;}_0x137932[_0x5980('0x21')](_0x305bb1);return _0x137932['set'](_0x5980('0x28'),_0x1bcc3b+'-'+_0x962163+'/'+_0xbe08e1)[_0x5980('0x23')](_0x2af8c9);}return null;};}function patchUpdates(_0x5e40a6){return function(_0x58b651){try{jsonpatch['apply'](_0x58b651,_0x5e40a6,!![]);}catch(_0x293cef){return BPromise[_0x5980('0x29')](_0x293cef);}return _0x58b651[_0x5980('0x2a')]();};}function saveUpdates(_0xe6b0b3,_0x4e067b){return function(_0x15bcf){if(_0x15bcf){return _0x15bcf[_0x5980('0x2b')](_0xe6b0b3)[_0x5980('0x2c')](function(_0x52e24b){return _0x52e24b;});}return null;};}function removeEntity(_0x413b86,_0x179afa){return function(_0x36ca19){if(_0x36ca19){return _0x36ca19['destroy']()[_0x5980('0x2c')](function(){var _0x1d5897=_0x36ca19[_0x5980('0x2d')]({'plain':!![]});var _0xdd7b58=_0x5980('0x2e');return db[_0x5980('0x2f')]['destroy']({'where':{'type':_0xdd7b58,'resourceId':_0x1d5897['id']}})[_0x5980('0x2c')](function(){return _0x36ca19;});})[_0x5980('0x2c')](function(){_0x413b86[_0x5980('0x21')](0xcc)[_0x5980('0x22')]();});}};}function handleEntityNotFound(_0x3f8714,_0xc61c10){return function(_0x4bc697){if(!_0x4bc697){_0x3f8714[_0x5980('0x20')](0x194);}return _0x4bc697;};}function handleError(_0x2ff342,_0x2d28f3){_0x2d28f3=_0x2d28f3||0x1f4;return function(_0x183f15){logger['error'](_0x183f15[_0x5980('0x30')]);if(_0x183f15[_0x5980('0x31')]){delete _0x183f15[_0x5980('0x31')];}_0x2ff342[_0x5980('0x21')](_0x2d28f3)[_0x5980('0x32')](_0x183f15);};}exports['index']=function(_0x192ad0,_0x29c843){var _0x3143bd={},_0x231f0f={},_0x1015cd={'count':0x0,'rows':[]};var _0x430651=_['map'](db['OpenchannelQueue'][_0x5980('0x33')],function(_0x592f1a){return{'name':_0x592f1a['fieldName'],'type':_0x592f1a[_0x5980('0x34')][_0x5980('0x35')]};});_0x231f0f[_0x5980('0x36')]=_[_0x5980('0x37')](_0x430651,_0x5980('0x31'));_0x231f0f[_0x5980('0x38')]=_[_0x5980('0x39')](_0x192ad0['query']);_0x231f0f['filters']=_[_0x5980('0x3a')](_0x231f0f[_0x5980('0x36')],_0x231f0f['query']);_0x3143bd[_0x5980('0x3b')]=_[_0x5980('0x3a')](_0x231f0f['model'],qs[_0x5980('0x3c')](_0x192ad0[_0x5980('0x38')]['fields']));_0x3143bd[_0x5980('0x3b')]=_0x3143bd['attributes']['length']?_0x3143bd[_0x5980('0x3b')]:_0x231f0f[_0x5980('0x36')];if(!_0x192ad0[_0x5980('0x38')]['hasOwnProperty'](_0x5980('0x3d'))){_0x3143bd[_0x5980('0x26')]=qs['limit'](_0x192ad0[_0x5980('0x38')]['limit']);_0x3143bd[_0x5980('0x24')]=qs[_0x5980('0x24')](_0x192ad0[_0x5980('0x38')]['offset']);}_0x3143bd[_0x5980('0x3e')]=qs['sort'](_0x192ad0[_0x5980('0x38')][_0x5980('0x3f')]);_0x3143bd[_0x5980('0x40')]=qs['filters'](_[_0x5980('0x41')](_0x192ad0[_0x5980('0x38')],_0x231f0f['filters']),_0x430651);if(_0x192ad0[_0x5980('0x38')][_0x5980('0x42')]){_0x3143bd['where']=_[_0x5980('0x43')](_0x3143bd[_0x5980('0x40')],{'$or':_[_0x5980('0x37')](_0x430651,function(_0x3df510){if(_0x3df510[_0x5980('0x34')]!=='VIRTUAL'){var _0x423f49={};_0x423f49[_0x3df510['name']]={'$like':'%'+_0x192ad0[_0x5980('0x38')][_0x5980('0x42')]+'%'};return _0x423f49;}})});}_0x3143bd=_[_0x5980('0x43')]({},_0x3143bd,_0x192ad0[_0x5980('0x44')]);var _0x5cebfc={'where':_0x3143bd[_0x5980('0x40')]};return db[_0x5980('0x45')][_0x5980('0x27')](_0x5cebfc)['then'](function(_0x1925da){_0x1015cd[_0x5980('0x27')]=_0x1925da;if(_0x192ad0[_0x5980('0x38')][_0x5980('0x46')]){_0x3143bd[_0x5980('0x47')]=[{'all':!![]}];}return db[_0x5980('0x45')][_0x5980('0x48')](_0x3143bd);})[_0x5980('0x2c')](function(_0x3cc1c5){_0x1015cd['rows']=_0x3cc1c5;return _0x1015cd;})[_0x5980('0x2c')](respondWithFilteredResult(_0x29c843,_0x3143bd))[_0x5980('0x49')](handleError(_0x29c843,null));};exports[_0x5980('0x4a')]=function(_0x33e8d0,_0x34e958){var _0x99b169={'raw':!![],'where':{'id':_0x33e8d0[_0x5980('0x4b')]['id']}},_0x343366={};_0x343366[_0x5980('0x36')]=_[_0x5980('0x39')](db[_0x5980('0x45')][_0x5980('0x33')]);_0x343366[_0x5980('0x38')]=_[_0x5980('0x39')](_0x33e8d0['query']);_0x343366[_0x5980('0x4c')]=_[_0x5980('0x3a')](_0x343366[_0x5980('0x36')],_0x343366[_0x5980('0x38')]);_0x99b169[_0x5980('0x3b')]=_[_0x5980('0x3a')](_0x343366[_0x5980('0x36')],qs[_0x5980('0x3c')](_0x33e8d0[_0x5980('0x38')][_0x5980('0x3c')]));_0x99b169['attributes']=_0x99b169['attributes'][_0x5980('0x4d')]?_0x99b169[_0x5980('0x3b')]:_0x343366[_0x5980('0x36')];if(_0x33e8d0[_0x5980('0x38')][_0x5980('0x46')]){_0x99b169[_0x5980('0x47')]=[{'all':!![]}];}_0x99b169=_[_0x5980('0x43')]({},_0x99b169,_0x33e8d0[_0x5980('0x44')]);return db[_0x5980('0x45')]['find'](_0x99b169)[_0x5980('0x2c')](handleEntityNotFound(_0x34e958,null))[_0x5980('0x2c')](respondWithResult(_0x34e958,null))[_0x5980('0x49')](handleError(_0x34e958,null));};exports['create']=function(_0x717eab,_0x4d60bc){return db[_0x5980('0x45')][_0x5980('0x4e')](_0x717eab[_0x5980('0x4f')],{})['then'](function(_0x5039be){var _0x1e494b=_0x717eab['user'][_0x5980('0x2d')]({'plain':!![]});if(!_0x1e494b)throw new Error(_0x5980('0x50'));if(_0x1e494b[_0x5980('0x51')]===_0x5980('0x52')){var _0x1bd679=_0x5039be['get']({'plain':!![]});var _0x48813d=_0x5980('0x2e');return db['UserProfileSection'][_0x5980('0x53')]({'where':{'name':_0x48813d,'userProfileId':_0x1e494b[_0x5980('0x54')]},'raw':!![]})[_0x5980('0x2c')](function(_0x4c5ec7){if(_0x4c5ec7&&_0x4c5ec7[_0x5980('0x55')]===0x0){return db[_0x5980('0x2f')][_0x5980('0x4e')]({'name':_0x1bd679['name'],'resourceId':_0x1bd679['id'],'type':_0x4c5ec7[_0x5980('0x31')],'sectionId':_0x4c5ec7['id']},{})[_0x5980('0x2c')](function(){return _0x5039be;});}else{return _0x5039be;}})[_0x5980('0x49')](function(_0x2eee58){logger[_0x5980('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2eee58);throw _0x2eee58;});}return _0x5039be;})[_0x5980('0x2c')](respondWithResult(_0x4d60bc,0xc9))['catch'](handleError(_0x4d60bc,null));};exports[_0x5980('0x2b')]=function(_0x38fdbb,_0x47a48d){if(_0x38fdbb[_0x5980('0x4f')]['id']){delete _0x38fdbb[_0x5980('0x4f')]['id'];}return db[_0x5980('0x45')][_0x5980('0x53')]({'where':{'id':_0x38fdbb[_0x5980('0x4b')]['id']}})[_0x5980('0x2c')](handleEntityNotFound(_0x47a48d,null))[_0x5980('0x2c')](saveUpdates(_0x38fdbb[_0x5980('0x4f')],null))['then'](respondWithResult(_0x47a48d,null))['catch'](handleError(_0x47a48d,null));};exports[_0x5980('0x57')]=function(_0x580b9e,_0x4483b0){return db[_0x5980('0x45')]['find']({'where':{'id':_0x580b9e[_0x5980('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4483b0,null))[_0x5980('0x2c')](removeEntity(_0x4483b0,null))[_0x5980('0x49')](handleError(_0x4483b0,null));};exports[_0x5980('0x58')]=function(_0x34521f,_0x92072b){return db[_0x5980('0x45')]['describe']()[_0x5980('0x2c')](respondWithResult(_0x92072b,null))['catch'](handleError(_0x92072b,null));};exports['getMembers']=function(_0x5c37b4,_0xeb5efc,_0xd80ffe){var _0xa68f39={'raw':!![],'where':{}},_0x57a0fb={},_0xf677c9;return db[_0x5980('0x45')][_0x5980('0x59')]({'where':{'id':_0x5c37b4['params']['id']}})[_0x5980('0x2c')](handleEntityNotFound(_0xeb5efc,null))[_0x5980('0x2c')](function(_0x1a5e9d){if(_0x1a5e9d){_0xf677c9=_0x1a5e9d[_0x5980('0x2d')]({'plain':!![]});_0x57a0fb['model']=_['keys'](db[_0x5980('0x5a')][_0x5980('0x33')]);_0x57a0fb[_0x5980('0x38')]=_[_0x5980('0x39')](_0x5c37b4[_0x5980('0x38')]);_0x57a0fb['filters']=_['intersection'](_0x57a0fb[_0x5980('0x36')],_0x57a0fb[_0x5980('0x38')]);_0xa68f39['attributes']=_[_0x5980('0x3a')](_0x57a0fb[_0x5980('0x36')],qs[_0x5980('0x3c')](_0x5c37b4[_0x5980('0x38')][_0x5980('0x3c')]));_0xa68f39[_0x5980('0x3b')]=_0xa68f39[_0x5980('0x3b')][_0x5980('0x4d')]?_0xa68f39[_0x5980('0x3b')]:_0x57a0fb[_0x5980('0x36')];if(!_0x5c37b4[_0x5980('0x38')][_0x5980('0x5b')]('nolimit')){_0xa68f39[_0x5980('0x26')]=qs[_0x5980('0x26')](_0x5c37b4[_0x5980('0x38')][_0x5980('0x26')]);_0xa68f39[_0x5980('0x24')]=qs[_0x5980('0x24')](_0x5c37b4['query'][_0x5980('0x24')]);}_0xa68f39[_0x5980('0x3e')]=qs[_0x5980('0x3f')](_0x5c37b4[_0x5980('0x38')][_0x5980('0x3f')]);_0xa68f39['where']=qs[_0x5980('0x4c')](_[_0x5980('0x41')](_0x5c37b4[_0x5980('0x38')],_0x57a0fb[_0x5980('0x4c')]));_0xa68f39[_0x5980('0x40')]['OpenchannelQueueId']=_0x1a5e9d['id'];if(_0x5c37b4[_0x5980('0x38')]['filter']){_0xa68f39['where']=_[_0x5980('0x43')](_0xa68f39[_0x5980('0x40')],{'$or':_[_0x5980('0x37')](_0xa68f39['attributes'],function(_0x3ebf2f){var _0x405fe8={};_0x405fe8[_0x3ebf2f]={'$like':'%'+_0x5c37b4[_0x5980('0x38')][_0x5980('0x42')]+'%'};return _0x405fe8;})});}_0xa68f39=_[_0x5980('0x43')]({},_0xa68f39,_0x5c37b4[_0x5980('0x44')]);return db[_0x5980('0x5a')][_0x5980('0x48')](_0xa68f39);}})[_0x5980('0x2c')](function(_0x480153){if(_0x480153){return db[_0x5980('0x5c')][_0x5980('0x5d')]({'where':{'id':_[_0x5980('0x37')](_0x480153,_0x5980('0x5e')),'role':_0x5980('0x5f')},'attributes':['id',_0x5980('0x31'),_0x5980('0x60'),_0x5980('0x61'),_0x5980('0x62')]});}})['then'](function(_0x3738f4){if(_0x3738f4){return{'count':_0x3738f4[_0x5980('0x27')],'rows':_[_0x5980('0x37')](_0x3738f4['rows'],function(_0x4bb53a){return{'membername':_0x4bb53a[_0x5980('0x31')],'UserId':_0x4bb53a['id'],'queue_name':_0xf677c9[_0x5980('0x31')],'OpenchannelQueueId':_0xf677c9['id'],'interface':util[_0x5980('0x63')](_0x5980('0x64'),_0x5980('0x65'),_0x4bb53a[_0x5980('0x31')]),'penalty':0x0,'paused':_0x4bb53a[_0x5980('0x60')],'createdAt':_0x4bb53a[_0x5980('0x62')],'updatedAt':_0x4bb53a[_0x5980('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5980('0x2c')](respondWithFilteredResult(_0xeb5efc,_0xa68f39))['catch'](handleError(_0xeb5efc,null));};exports['getTeams']=function(_0x11873a,_0x26b030,_0x8e75a3){var _0xef9082={};var _0x2197ca={};var _0x23322d;var _0x3335ad;return db[_0x5980('0x45')]['findOne']({'where':{'id':_0x11873a[_0x5980('0x4b')]['id']}})[_0x5980('0x2c')](handleEntityNotFound(_0x26b030,null))['then'](function(_0x54ec0b){if(_0x54ec0b){_0x23322d=_0x54ec0b;_0x2197ca[_0x5980('0x36')]=_[_0x5980('0x39')](db[_0x5980('0x66')][_0x5980('0x33')]);_0x2197ca[_0x5980('0x38')]=_[_0x5980('0x39')](_0x11873a[_0x5980('0x38')]);_0x2197ca['filters']=_[_0x5980('0x3a')](_0x2197ca[_0x5980('0x36')],_0x2197ca[_0x5980('0x38')]);_0xef9082[_0x5980('0x3b')]=_[_0x5980('0x3a')](_0x2197ca[_0x5980('0x36')],qs[_0x5980('0x3c')](_0x11873a['query'][_0x5980('0x3c')]));_0xef9082['attributes']=_0xef9082['attributes'][_0x5980('0x4d')]?_0xef9082[_0x5980('0x3b')]:_0x2197ca[_0x5980('0x36')];_0xef9082['order']=qs[_0x5980('0x3f')](_0x11873a[_0x5980('0x38')]['sort']);_0xef9082[_0x5980('0x40')]=qs[_0x5980('0x4c')](_['pick'](_0x11873a['query'],_0x2197ca['filters']));if(_0x11873a[_0x5980('0x38')][_0x5980('0x42')]){_0xef9082[_0x5980('0x40')]=_['merge'](_0xef9082['where'],{'$or':_[_0x5980('0x37')](_0xef9082['attributes'],function(_0x45bebf){var _0x42ad75={};_0x42ad75[_0x45bebf]={'$like':'%'+_0x11873a[_0x5980('0x38')][_0x5980('0x42')]+'%'};return _0x42ad75;})});}_0xef9082=_[_0x5980('0x43')]({},_0xef9082,_0x11873a[_0x5980('0x44')]);return _0x23322d[_0x5980('0x67')](_0xef9082);}})['then'](function(_0x36cf75){if(_0x36cf75){_0x3335ad=_0x36cf75[_0x5980('0x4d')];if(!_0x11873a[_0x5980('0x38')][_0x5980('0x5b')](_0x5980('0x3d'))){_0xef9082[_0x5980('0x26')]=qs['limit'](_0x11873a[_0x5980('0x38')][_0x5980('0x26')]);_0xef9082[_0x5980('0x24')]=qs['offset'](_0x11873a[_0x5980('0x38')][_0x5980('0x24')]);}return _0x23322d[_0x5980('0x67')](_0xef9082);}})[_0x5980('0x2c')](function(_0x5f2780){if(_0x5f2780){return _0x5f2780?{'count':_0x3335ad,'rows':_0x5f2780}:null;}})['then'](respondWithResult(_0x26b030,null))['catch'](handleError(_0x26b030,null));};exports[_0x5980('0x68')]=function(_0x2d0558,_0x19dcf4,_0x33f0f1){var _0x56fc0b=_0x2d0558[_0x5980('0x4f')][_0x5980('0x69')];return db[_0x5980('0x66')][_0x5980('0x48')]({'where':{'id':_0x56fc0b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5980('0x6a'),'attributes':['id',_0x5980('0x31'),_0x5980('0x6b'),_0x5980('0x6c'),'interface'],'raw':!![]}]})[_0x5980('0x2c')](function(_0x324803){if(_0x324803){var _0x4d8cac=_[_0x5980('0x6d')](_0x324803,function(_0x59410a){var _0x4fb8f4=_0x59410a[_0x5980('0x2d')]({'plain':!![]});return _0x4fb8f4[_0x5980('0x6a')];});return db[_0x5980('0x45')][_0x5980('0x53')]({'where':{'id':_0x2d0558['params']['id']}})[_0x5980('0x2c')](function(_0x111471){return db[_0x5980('0x6e')][_0x5980('0x6f')](function(_0x5239f3){return _0x111471['addTeams'](_0x56fc0b,{'transaction':_0x5239f3})[_0x5980('0x2c')](function(){return BPromise[_0x5980('0x70')](_0x4d8cac,function(_0x59fe25){return db[_0x5980('0x5a')]['findOrCreate']({'where':{'UserId':_0x59fe25['id'],'OpenchannelQueueId':_0x2d0558['params']['id']},'transaction':_0x5239f3});});})[_0x5980('0x2c')](function(){_0x4d8cac[_0x5980('0x71')](function(_0x4d0f69){socket[_0x5980('0x72')](_0x5980('0x73'),{'UserId':_0x4d0f69['id'],'OpenchannelQueueId':_0x111471['id']});});});});});}})[_0x5980('0x2c')](respondWithStatusCode(_0x19dcf4,null))['catch'](handleError(_0x19dcf4,null));};exports['removeTeams']=function(_0x357274,_0x578c26,_0x54603b){return db[_0x5980('0x66')][_0x5980('0x48')]({'where':{'id':_0x357274[_0x5980('0x38')][_0x5980('0x69')]},'attributes':['id'],'include':[{'model':db[_0x5980('0x5c')],'as':_0x5980('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x5980('0x2c')](handleEntityNotFound(_0x578c26,null))['then'](function(_0x7e80f3){var _0x2ea175=_['map'](_0x7e80f3,'id');var _0x3cf38e=[];var _0x3e7a93=[];var _0x2752cc=squel[_0x5980('0x74')]();_0x2752cc['field'](_0x5980('0x75'))[_0x5980('0x76')](_0x5980('0x77'),'tq')[_0x5980('0x78')]('user_has_teams','ut',_0x5980('0x79'))['where'](_0x5980('0x7a'),_0x357274[_0x5980('0x4b')]['id']);for(var _0x59aa74=0x0;_0x59aa74<_0x7e80f3[_0x5980('0x4d')];_0x59aa74+=0x1){let _0x402da1=_0x7e80f3[_0x59aa74];for(var _0x5400ff=0x0;_0x5400ff<_0x402da1[_0x5980('0x6a')][_0x5980('0x4d')];_0x5400ff+=0x1){let _0x3f169d=_0x402da1[_0x5980('0x6a')][_0x5400ff];var _0x379d69=_0x2752cc['clone']();_0x379d69['where'](_0x5980('0x7b'),_0x3f169d['id']);_0x3e7a93[_0x5980('0x7c')](db[_0x5980('0x6e')]['query'](_0x379d69[_0x5980('0x7d')](),{'type':db[_0x5980('0x6e')][_0x5980('0x7e')]['SELECT']})['then'](function(_0x29b1f5){if(_0x29b1f5['length']===0x1){return _0x3f169d['id'];}else{var _0x1a178b=_[_0x5980('0x7f')](_[_0x5980('0x37')](_0x29b1f5,_0x5980('0x80')),function(_0x42ba98){return _[_0x5980('0x81')](_0x2ea175,_0x42ba98);});if(_0x1a178b){return _0x3f169d['id'];}}}));}}return BPromise[_0x5980('0x82')](_0x3e7a93)[_0x5980('0x2c')](function(_0x1c5c61){_0x3cf38e=_(_0x3cf38e)[_0x5980('0x83')](_0x1c5c61)[_0x5980('0x84')]()[_0x5980('0x85')]();return db['OpenchannelQueue'][_0x5980('0x53')]({'where':{'id':_0x357274[_0x5980('0x4b')]['id']}})[_0x5980('0x2c')](function(_0x8f93e6){return db[_0x5980('0x6e')]['transaction'](function(_0x4b3474){return _0x8f93e6[_0x5980('0x86')](_0x357274['query'][_0x5980('0x69')],{'transaction':_0x4b3474})['then'](function(){if(!_[_0x5980('0x87')](_0x3cf38e)){return _0x8f93e6[_0x5980('0x88')](_0x3cf38e,{'transaction':_0x4b3474});}})[_0x5980('0x2c')](function(){_0x3cf38e[_0x5980('0x71')](function(_0x54ac34){socket['emit'](_0x5980('0x89'),{'UserId':_0x54ac34,'OpenchannelQueueId':_0x8f93e6['id']});});});});});});})[_0x5980('0x2c')](respondWithStatusCode(_0x578c26,null))[_0x5980('0x49')](handleError(_0x578c26,null));};exports[_0x5980('0x8a')]=function(_0x57c20a,_0x4b2f6a,_0x21b3df){return db[_0x5980('0x45')]['find']({'where':{'id':_0x57c20a['params']['id']}})[_0x5980('0x2c')](handleEntityNotFound(_0x4b2f6a,null))['then'](function(_0x315bff){if(_0x315bff){return _0x315bff[_0x5980('0x8a')](_0x57c20a[_0x5980('0x4f')][_0x5980('0x69')],_[_0x5980('0x8b')](_0x57c20a[_0x5980('0x4f')],[_0x5980('0x69'),'id'])||{})[_0x5980('0x8c')](function(_0x174bb8){for(var _0x9433c4=0x0;_0x9433c4<_0x57c20a['body'][_0x5980('0x69')][_0x5980('0x4d')];_0x9433c4+=0x1){socket[_0x5980('0x72')](_0x5980('0x73'),{'UserId':Number(_0x57c20a[_0x5980('0x4f')][_0x5980('0x69')][_0x9433c4]),'OpenchannelQueueId':Number(_0x57c20a['params']['id'])});}return _0x174bb8;});}})[_0x5980('0x2c')](respondWithResult(_0x4b2f6a,null))[_0x5980('0x49')](handleError(_0x4b2f6a,null));};exports[_0x5980('0x88')]=function(_0x406cde,_0x4e6dc1,_0x955979){return db[_0x5980('0x45')]['find']({'where':{'id':_0x406cde[_0x5980('0x4b')]['id']}})[_0x5980('0x2c')](handleEntityNotFound(_0x4e6dc1,null))[_0x5980('0x2c')](function(_0x1ddcd9){if(_0x1ddcd9){return _0x1ddcd9[_0x5980('0x88')](_0x406cde[_0x5980('0x38')][_0x5980('0x69')])[_0x5980('0x2c')](function(){if(_[_0x5980('0x8d')](_0x406cde[_0x5980('0x38')][_0x5980('0x69')])){for(var _0x588cdf=0x0;_0x588cdf<_0x406cde[_0x5980('0x38')][_0x5980('0x69')][_0x5980('0x4d')];_0x588cdf+=0x1){socket[_0x5980('0x72')](_0x5980('0x89'),{'UserId':Number(_0x406cde[_0x5980('0x38')][_0x5980('0x69')][_0x588cdf]),'OpenchannelQueueId':Number(_0x406cde[_0x5980('0x4b')]['id'])});}}else{socket[_0x5980('0x72')]('userOpenchannelQueue:remove',{'UserId':Number(_0x406cde[_0x5980('0x38')][_0x5980('0x69')]),'OpenchannelQueueId':Number(_0x406cde[_0x5980('0x4b')]['id'])});}});}})[_0x5980('0x2c')](respondWithStatusCode(_0x4e6dc1,null))[_0x5980('0x49')](handleError(_0x4e6dc1,null));};exports[_0x5980('0x8e')]=function(_0x5976b1,_0x4eefc2,_0x2375a6){var _0x2eb70c={};var _0x42388b={};var _0x2c0036;var _0x20776e;return db[_0x5980('0x45')][_0x5980('0x59')]({'where':{'id':_0x5976b1[_0x5980('0x4b')]['id']}})[_0x5980('0x2c')](handleEntityNotFound(_0x4eefc2,null))[_0x5980('0x2c')](function(_0x37e6be){if(_0x37e6be){_0x2c0036=_0x37e6be;_0x42388b[_0x5980('0x36')]=_[_0x5980('0x39')](db[_0x5980('0x5c')][_0x5980('0x33')]);_0x42388b[_0x5980('0x38')]=_[_0x5980('0x39')](_0x5976b1[_0x5980('0x38')]);_0x42388b[_0x5980('0x4c')]=_[_0x5980('0x3a')](_0x42388b[_0x5980('0x36')],_0x42388b[_0x5980('0x38')]);_0x2eb70c['attributes']=_[_0x5980('0x3a')](_0x42388b[_0x5980('0x36')],qs[_0x5980('0x3c')](_0x5976b1['query']['fields']));_0x2eb70c[_0x5980('0x3b')]=_0x2eb70c[_0x5980('0x3b')][_0x5980('0x4d')]?_0x2eb70c[_0x5980('0x3b')]:_0x42388b[_0x5980('0x36')];_0x2eb70c[_0x5980('0x3e')]=qs['sort'](_0x5976b1[_0x5980('0x38')][_0x5980('0x3f')]);_0x2eb70c['where']=qs[_0x5980('0x4c')](_['pick'](_0x5976b1[_0x5980('0x38')],_0x42388b[_0x5980('0x4c')]));if(_0x5976b1[_0x5980('0x38')][_0x5980('0x42')]){_0x2eb70c[_0x5980('0x40')]=_[_0x5980('0x43')](_0x2eb70c[_0x5980('0x40')],{'$or':_[_0x5980('0x37')](_0x2eb70c['attributes'],function(_0x57f76b){var _0x419ce0={};_0x419ce0[_0x57f76b]={'$like':'%'+_0x5976b1['query'][_0x5980('0x42')]+'%'};return _0x419ce0;})});}_0x2eb70c=_['merge']({},_0x2eb70c,_0x5976b1[_0x5980('0x44')]);return _0x2c0036[_0x5980('0x8e')](_0x2eb70c);}})['then'](function(_0x56961d){if(_0x56961d){_0x20776e=_0x56961d[_0x5980('0x4d')];if(!_0x5976b1[_0x5980('0x38')][_0x5980('0x5b')](_0x5980('0x3d'))){_0x2eb70c['limit']=qs[_0x5980('0x26')](_0x5976b1[_0x5980('0x38')]['limit']);_0x2eb70c['offset']=qs[_0x5980('0x24')](_0x5976b1[_0x5980('0x38')][_0x5980('0x24')]);}return _0x2c0036['getAgents'](_0x2eb70c);}})[_0x5980('0x2c')](function(_0x1b8770){if(_0x1b8770){return _0x1b8770?{'count':_0x20776e,'rows':_0x1b8770}:null;}})[_0x5980('0x2c')](respondWithResult(_0x4eefc2,null))[_0x5980('0x49')](handleError(_0x4eefc2,null));}; \ No newline at end of file +var _0xda38=['path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','get','OpenchannelQueues','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','getMembers','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','User','findAndCountAll','agent','createdAt','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','Agents','voicePause','flatMap','sequelize','transaction','each','forEach','userOpenchannelQueue:save','removeTeams','ids','field','tq.TeamId','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','union','compact','value','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util'];(function(_0x4503df,_0xfec122){var _0x3f1b2b=function(_0x32b1de){while(--_0x32b1de){_0x4503df['push'](_0x4503df['shift']());}};_0x3f1b2b(++_0xfec122);}(_0xda38,0x105));var _0x8da3=function(_0x24ccd7,_0x2eeca9){_0x24ccd7=_0x24ccd7-0x0;var _0x26aa79=_0xda38[_0x24ccd7];return _0x26aa79;};'use strict';var emlformat=require(_0x8da3('0x0'));var rimraf=require(_0x8da3('0x1'));var zipdir=require(_0x8da3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8da3('0x3'));var moment=require(_0x8da3('0x4'));var BPromise=require(_0x8da3('0x5'));var Mustache=require('mustache');var util=require(_0x8da3('0x6'));var path=require(_0x8da3('0x7'));var sox=require(_0x8da3('0x8'));var csv=require('to-csv');var ejs=require(_0x8da3('0x9'));var fs=require('fs');var fs_extra=require(_0x8da3('0xa'));var _=require(_0x8da3('0xb'));var squel=require(_0x8da3('0xc'));var crypto=require(_0x8da3('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8da3('0xe'));var querystring=require(_0x8da3('0xf'));var Papa=require(_0x8da3('0x10'));var Redis=require(_0x8da3('0x11'));var authService=require(_0x8da3('0x12'));var qs=require(_0x8da3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8da3('0x14'));var utils=require('../../config/utils');var config=require(_0x8da3('0x15'));var licenseUtil=require(_0x8da3('0x16'));var db=require(_0x8da3('0x17'))['db'];config[_0x8da3('0x18')]=_['defaults'](config[_0x8da3('0x18')],{'host':_0x8da3('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8da3('0x18')]));require('./openchannelQueue.socket')[_0x8da3('0x1a')](socket);function respondWithStatusCode(_0x2524b5,_0xaf18ff){_0xaf18ff=_0xaf18ff||0xcc;return function(_0x376bb8){if(_0x376bb8){return _0x2524b5[_0x8da3('0x1b')](_0xaf18ff);}return _0x2524b5[_0x8da3('0x1c')](_0xaf18ff)[_0x8da3('0x1d')]();};}function respondWithResult(_0x300821,_0x57fac9){_0x57fac9=_0x57fac9||0xc8;return function(_0x3bd35d){if(_0x3bd35d){return _0x300821[_0x8da3('0x1c')](_0x57fac9)[_0x8da3('0x1e')](_0x3bd35d);}};}function respondWithFilteredResult(_0x2a3b4e,_0x443871){return function(_0x41455c){if(_0x41455c){var _0x4ee54a=typeof _0x443871['offset']===_0x8da3('0x1f')&&typeof _0x443871[_0x8da3('0x20')]===_0x8da3('0x1f');var _0x578087=_0x41455c[_0x8da3('0x21')];var _0x599dce=_0x4ee54a?0x0:_0x443871['offset'];var _0x3209d5=_0x4ee54a?_0x41455c[_0x8da3('0x21')]:_0x443871[_0x8da3('0x22')]+_0x443871['limit'];var _0x48bce3;if(_0x3209d5>=_0x578087){_0x3209d5=_0x578087;_0x48bce3=0xc8;}else{_0x48bce3=0xce;}_0x2a3b4e[_0x8da3('0x1c')](_0x48bce3);return _0x2a3b4e['set'](_0x8da3('0x23'),_0x599dce+'-'+_0x3209d5+'/'+_0x578087)[_0x8da3('0x1e')](_0x41455c);}return null;};}function patchUpdates(_0xe1ffbd){return function(_0x3a118f){try{jsonpatch['apply'](_0x3a118f,_0xe1ffbd,!![]);}catch(_0x584dc3){return BPromise[_0x8da3('0x24')](_0x584dc3);}return _0x3a118f[_0x8da3('0x25')]();};}function saveUpdates(_0x189bac,_0x309dbe){return function(_0x4ad979){if(_0x4ad979){return _0x4ad979[_0x8da3('0x26')](_0x189bac)[_0x8da3('0x27')](function(_0x201b69){return _0x201b69;});}return null;};}function removeEntity(_0xbb236c,_0x1c97b7){return function(_0x493324){if(_0x493324){return _0x493324[_0x8da3('0x28')]()[_0x8da3('0x27')](function(){var _0x48496f=_0x493324[_0x8da3('0x29')]({'plain':!![]});var _0x571f05=_0x8da3('0x2a');return db['UserProfileResource'][_0x8da3('0x28')]({'where':{'type':_0x571f05,'resourceId':_0x48496f['id']}})[_0x8da3('0x27')](function(){return _0x493324;});})['then'](function(){_0xbb236c[_0x8da3('0x1c')](0xcc)[_0x8da3('0x1d')]();});}};}function handleEntityNotFound(_0x3872b1,_0x2fe16d){return function(_0x4f8027){if(!_0x4f8027){_0x3872b1[_0x8da3('0x1b')](0x194);}return _0x4f8027;};}function handleError(_0x5b0b90,_0x26ffa2){_0x26ffa2=_0x26ffa2||0x1f4;return function(_0x454ca9){logger['error'](_0x454ca9['stack']);if(_0x454ca9[_0x8da3('0x2b')]){delete _0x454ca9[_0x8da3('0x2b')];}_0x5b0b90[_0x8da3('0x1c')](_0x26ffa2)[_0x8da3('0x2c')](_0x454ca9);};}exports[_0x8da3('0x2d')]=function(_0x55f3d6,_0x4c6ee5){var _0x18eb39={},_0x949a01={},_0x3b61de={'count':0x0,'rows':[]};var _0x31c976=_[_0x8da3('0x2e')](db[_0x8da3('0x2f')][_0x8da3('0x30')],function(_0x3ea86e){return{'name':_0x3ea86e[_0x8da3('0x31')],'type':_0x3ea86e[_0x8da3('0x32')][_0x8da3('0x33')]};});_0x949a01['model']=_[_0x8da3('0x2e')](_0x31c976,_0x8da3('0x2b'));_0x949a01[_0x8da3('0x34')]=_[_0x8da3('0x35')](_0x55f3d6[_0x8da3('0x34')]);_0x949a01[_0x8da3('0x36')]=_[_0x8da3('0x37')](_0x949a01[_0x8da3('0x38')],_0x949a01[_0x8da3('0x34')]);_0x18eb39[_0x8da3('0x39')]=_['intersection'](_0x949a01[_0x8da3('0x38')],qs[_0x8da3('0x3a')](_0x55f3d6['query'][_0x8da3('0x3a')]));_0x18eb39['attributes']=_0x18eb39[_0x8da3('0x39')][_0x8da3('0x3b')]?_0x18eb39[_0x8da3('0x39')]:_0x949a01['model'];if(!_0x55f3d6[_0x8da3('0x34')][_0x8da3('0x3c')](_0x8da3('0x3d'))){_0x18eb39[_0x8da3('0x20')]=qs['limit'](_0x55f3d6['query'][_0x8da3('0x20')]);_0x18eb39['offset']=qs[_0x8da3('0x22')](_0x55f3d6[_0x8da3('0x34')][_0x8da3('0x22')]);}_0x18eb39[_0x8da3('0x3e')]=qs[_0x8da3('0x3f')](_0x55f3d6[_0x8da3('0x34')]['sort']);_0x18eb39[_0x8da3('0x40')]=qs[_0x8da3('0x36')](_['pick'](_0x55f3d6[_0x8da3('0x34')],_0x949a01[_0x8da3('0x36')]),_0x31c976);if(_0x55f3d6[_0x8da3('0x34')]['filter']){_0x18eb39[_0x8da3('0x40')]=_[_0x8da3('0x41')](_0x18eb39['where'],{'$or':_['map'](_0x31c976,function(_0x316e60){if(_0x316e60['type']!==_0x8da3('0x42')){var _0x45a16e={};_0x45a16e[_0x316e60[_0x8da3('0x2b')]]={'$like':'%'+_0x55f3d6[_0x8da3('0x34')][_0x8da3('0x43')]+'%'};return _0x45a16e;}})});}_0x18eb39=_['merge']({},_0x18eb39,_0x55f3d6['options']);var _0x36ea66={'where':_0x18eb39[_0x8da3('0x40')]};return db[_0x8da3('0x2f')][_0x8da3('0x21')](_0x36ea66)['then'](function(_0x59c279){_0x3b61de['count']=_0x59c279;if(_0x55f3d6[_0x8da3('0x34')]['includeAll']){_0x18eb39[_0x8da3('0x44')]=[{'all':!![]}];}return db[_0x8da3('0x2f')][_0x8da3('0x45')](_0x18eb39);})['then'](function(_0x2bbf5f){_0x3b61de[_0x8da3('0x46')]=_0x2bbf5f;return _0x3b61de;})[_0x8da3('0x27')](respondWithFilteredResult(_0x4c6ee5,_0x18eb39))[_0x8da3('0x47')](handleError(_0x4c6ee5,null));};exports[_0x8da3('0x48')]=function(_0x329394,_0x58cd02){var _0x55df6d={'raw':!![],'where':{'id':_0x329394[_0x8da3('0x49')]['id']}},_0x2a29a1={};_0x2a29a1[_0x8da3('0x38')]=_[_0x8da3('0x35')](db[_0x8da3('0x2f')][_0x8da3('0x30')]);_0x2a29a1[_0x8da3('0x34')]=_[_0x8da3('0x35')](_0x329394[_0x8da3('0x34')]);_0x2a29a1[_0x8da3('0x36')]=_[_0x8da3('0x37')](_0x2a29a1[_0x8da3('0x38')],_0x2a29a1[_0x8da3('0x34')]);_0x55df6d[_0x8da3('0x39')]=_[_0x8da3('0x37')](_0x2a29a1[_0x8da3('0x38')],qs[_0x8da3('0x3a')](_0x329394[_0x8da3('0x34')]['fields']));_0x55df6d[_0x8da3('0x39')]=_0x55df6d['attributes'][_0x8da3('0x3b')]?_0x55df6d[_0x8da3('0x39')]:_0x2a29a1[_0x8da3('0x38')];if(_0x329394['query'][_0x8da3('0x4a')]){_0x55df6d[_0x8da3('0x44')]=[{'all':!![]}];}_0x55df6d=_[_0x8da3('0x41')]({},_0x55df6d,_0x329394[_0x8da3('0x4b')]);return db[_0x8da3('0x2f')]['find'](_0x55df6d)[_0x8da3('0x27')](handleEntityNotFound(_0x58cd02,null))[_0x8da3('0x27')](respondWithResult(_0x58cd02,null))['catch'](handleError(_0x58cd02,null));};exports[_0x8da3('0x4c')]=function(_0x4d73e2,_0x52e6ff){return db['OpenchannelQueue'][_0x8da3('0x4c')](_0x4d73e2[_0x8da3('0x4d')],{})[_0x8da3('0x27')](function(_0x5828f8){var _0x407f0e=_0x4d73e2[_0x8da3('0x4e')][_0x8da3('0x29')]({'plain':!![]});if(!_0x407f0e)throw new Error(_0x8da3('0x4f'));if(_0x407f0e[_0x8da3('0x50')]===_0x8da3('0x4e')){var _0xe92f3b=_0x5828f8[_0x8da3('0x29')]({'plain':!![]});var _0x11f854=_0x8da3('0x2a');return db[_0x8da3('0x51')]['find']({'where':{'name':_0x11f854,'userProfileId':_0x407f0e[_0x8da3('0x52')]},'raw':!![]})[_0x8da3('0x27')](function(_0x538425){if(_0x538425&&_0x538425['autoAssociation']===0x0){return db[_0x8da3('0x53')][_0x8da3('0x4c')]({'name':_0xe92f3b[_0x8da3('0x2b')],'resourceId':_0xe92f3b['id'],'type':_0x538425[_0x8da3('0x2b')],'sectionId':_0x538425['id']},{})['then'](function(){return _0x5828f8;});}else{return _0x5828f8;}})[_0x8da3('0x47')](function(_0x4f2b77){logger['error'](_0x8da3('0x54'),_0x4f2b77);throw _0x4f2b77;});}return _0x5828f8;})[_0x8da3('0x27')](respondWithResult(_0x52e6ff,0xc9))[_0x8da3('0x47')](handleError(_0x52e6ff,null));};exports[_0x8da3('0x26')]=function(_0x1d3cb3,_0x4f7821){if(_0x1d3cb3['body']['id']){delete _0x1d3cb3[_0x8da3('0x4d')]['id'];}return db[_0x8da3('0x2f')][_0x8da3('0x55')]({'where':{'id':_0x1d3cb3[_0x8da3('0x49')]['id']}})[_0x8da3('0x27')](handleEntityNotFound(_0x4f7821,null))[_0x8da3('0x27')](saveUpdates(_0x1d3cb3[_0x8da3('0x4d')],null))['then'](respondWithResult(_0x4f7821,null))[_0x8da3('0x47')](handleError(_0x4f7821,null));};exports[_0x8da3('0x28')]=function(_0x5caa01,_0x4f17b2){return db['OpenchannelQueue'][_0x8da3('0x55')]({'where':{'id':_0x5caa01[_0x8da3('0x49')]['id']}})[_0x8da3('0x27')](handleEntityNotFound(_0x4f17b2,null))[_0x8da3('0x27')](removeEntity(_0x4f17b2,null))['catch'](handleError(_0x4f17b2,null));};exports['describe']=function(_0x3ce91e,_0x1c4d07){return db['OpenchannelQueue']['describe']()[_0x8da3('0x27')](respondWithResult(_0x1c4d07,null))['catch'](handleError(_0x1c4d07,null));};exports[_0x8da3('0x56')]=function(_0xff7997,_0xe61eba,_0x53d946){var _0x1d7ddc={'raw':!![],'where':{}},_0x5a03d5={},_0x212505;return db[_0x8da3('0x2f')][_0x8da3('0x57')]({'where':{'id':_0xff7997[_0x8da3('0x49')]['id']}})[_0x8da3('0x27')](handleEntityNotFound(_0xe61eba,null))[_0x8da3('0x27')](function(_0x1c7b8a){if(_0x1c7b8a){_0x212505=_0x1c7b8a[_0x8da3('0x29')]({'plain':!![]});_0x5a03d5['model']=_[_0x8da3('0x35')](db[_0x8da3('0x58')]['rawAttributes']);_0x5a03d5[_0x8da3('0x34')]=_[_0x8da3('0x35')](_0xff7997[_0x8da3('0x34')]);_0x5a03d5[_0x8da3('0x36')]=_['intersection'](_0x5a03d5['model'],_0x5a03d5['query']);_0x1d7ddc['attributes']=_[_0x8da3('0x37')](_0x5a03d5['model'],qs[_0x8da3('0x3a')](_0xff7997['query'][_0x8da3('0x3a')]));_0x1d7ddc[_0x8da3('0x39')]=_0x1d7ddc[_0x8da3('0x39')][_0x8da3('0x3b')]?_0x1d7ddc['attributes']:_0x5a03d5[_0x8da3('0x38')];if(!_0xff7997[_0x8da3('0x34')]['hasOwnProperty']('nolimit')){_0x1d7ddc['limit']=qs[_0x8da3('0x20')](_0xff7997[_0x8da3('0x34')]['limit']);_0x1d7ddc[_0x8da3('0x22')]=qs[_0x8da3('0x22')](_0xff7997[_0x8da3('0x34')]['offset']);}_0x1d7ddc[_0x8da3('0x3e')]=qs[_0x8da3('0x3f')](_0xff7997['query'][_0x8da3('0x3f')]);_0x1d7ddc[_0x8da3('0x40')]=qs[_0x8da3('0x36')](_[_0x8da3('0x59')](_0xff7997[_0x8da3('0x34')],_0x5a03d5[_0x8da3('0x36')]));_0x1d7ddc['where'][_0x8da3('0x5a')]=_0x1c7b8a['id'];if(_0xff7997['query'][_0x8da3('0x43')]){_0x1d7ddc[_0x8da3('0x40')]=_[_0x8da3('0x41')](_0x1d7ddc[_0x8da3('0x40')],{'$or':_[_0x8da3('0x2e')](_0x1d7ddc['attributes'],function(_0x5211bc){var _0x32d395={};_0x32d395[_0x5211bc]={'$like':'%'+_0xff7997[_0x8da3('0x34')]['filter']+'%'};return _0x32d395;})});}_0x1d7ddc=_[_0x8da3('0x41')]({},_0x1d7ddc,_0xff7997[_0x8da3('0x4b')]);return db[_0x8da3('0x58')][_0x8da3('0x45')](_0x1d7ddc);}})[_0x8da3('0x27')](function(_0x592b9c){if(_0x592b9c){return db[_0x8da3('0x5b')][_0x8da3('0x5c')]({'where':{'id':_[_0x8da3('0x2e')](_0x592b9c,'UserId'),'role':_0x8da3('0x5d')},'attributes':['id',_0x8da3('0x2b'),'openchannelPause','updatedAt',_0x8da3('0x5e')]});}})[_0x8da3('0x27')](function(_0x8b2cd){if(_0x8b2cd){return{'count':_0x8b2cd[_0x8da3('0x21')],'rows':_[_0x8da3('0x2e')](_0x8b2cd[_0x8da3('0x46')],function(_0x1785fc){return{'membername':_0x1785fc[_0x8da3('0x2b')],'UserId':_0x1785fc['id'],'queue_name':_0x212505[_0x8da3('0x2b')],'OpenchannelQueueId':_0x212505['id'],'interface':util['format'](_0x8da3('0x5f'),_0x8da3('0x60'),_0x1785fc[_0x8da3('0x2b')]),'penalty':0x0,'paused':_0x1785fc['openchannelPause'],'createdAt':_0x1785fc[_0x8da3('0x5e')],'updatedAt':_0x1785fc[_0x8da3('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8da3('0x27')](respondWithFilteredResult(_0xe61eba,_0x1d7ddc))[_0x8da3('0x47')](handleError(_0xe61eba,null));};exports['getTeams']=function(_0x205218,_0x5cad4d,_0x3c31bc){var _0x5e813d={};var _0x2d67f3={};var _0x2deb72;var _0x5d8627;return db[_0x8da3('0x2f')]['findOne']({'where':{'id':_0x205218[_0x8da3('0x49')]['id']}})[_0x8da3('0x27')](handleEntityNotFound(_0x5cad4d,null))[_0x8da3('0x27')](function(_0x1a7609){if(_0x1a7609){_0x2deb72=_0x1a7609;_0x2d67f3[_0x8da3('0x38')]=_[_0x8da3('0x35')](db[_0x8da3('0x62')][_0x8da3('0x30')]);_0x2d67f3[_0x8da3('0x34')]=_['keys'](_0x205218[_0x8da3('0x34')]);_0x2d67f3[_0x8da3('0x36')]=_['intersection'](_0x2d67f3[_0x8da3('0x38')],_0x2d67f3[_0x8da3('0x34')]);_0x5e813d['attributes']=_[_0x8da3('0x37')](_0x2d67f3[_0x8da3('0x38')],qs['fields'](_0x205218['query'][_0x8da3('0x3a')]));_0x5e813d[_0x8da3('0x39')]=_0x5e813d[_0x8da3('0x39')][_0x8da3('0x3b')]?_0x5e813d[_0x8da3('0x39')]:_0x2d67f3[_0x8da3('0x38')];_0x5e813d['order']=qs[_0x8da3('0x3f')](_0x205218[_0x8da3('0x34')]['sort']);_0x5e813d['where']=qs[_0x8da3('0x36')](_[_0x8da3('0x59')](_0x205218[_0x8da3('0x34')],_0x2d67f3['filters']));if(_0x205218[_0x8da3('0x34')][_0x8da3('0x43')]){_0x5e813d['where']=_[_0x8da3('0x41')](_0x5e813d['where'],{'$or':_[_0x8da3('0x2e')](_0x5e813d['attributes'],function(_0xf3fe28){var _0x3b9d83={};_0x3b9d83[_0xf3fe28]={'$like':'%'+_0x205218[_0x8da3('0x34')]['filter']+'%'};return _0x3b9d83;})});}_0x5e813d=_[_0x8da3('0x41')]({},_0x5e813d,_0x205218[_0x8da3('0x4b')]);return _0x2deb72['getTeams'](_0x5e813d);}})[_0x8da3('0x27')](function(_0x11dcd3){if(_0x11dcd3){_0x5d8627=_0x11dcd3[_0x8da3('0x3b')];if(!_0x205218[_0x8da3('0x34')]['hasOwnProperty'](_0x8da3('0x3d'))){_0x5e813d['limit']=qs[_0x8da3('0x20')](_0x205218[_0x8da3('0x34')][_0x8da3('0x20')]);_0x5e813d[_0x8da3('0x22')]=qs['offset'](_0x205218['query'][_0x8da3('0x22')]);}return _0x2deb72[_0x8da3('0x63')](_0x5e813d);}})[_0x8da3('0x27')](function(_0x25ae68){if(_0x25ae68){return _0x25ae68?{'count':_0x5d8627,'rows':_0x25ae68}:null;}})[_0x8da3('0x27')](respondWithResult(_0x5cad4d,null))['catch'](handleError(_0x5cad4d,null));};exports[_0x8da3('0x64')]=function(_0x882a1,_0x1b77e5,_0x302ef4){var _0x13ecf3=_0x882a1[_0x8da3('0x4d')]['ids'];return db[_0x8da3('0x62')][_0x8da3('0x45')]({'where':{'id':_0x13ecf3},'attributes':['id'],'include':[{'model':db[_0x8da3('0x5b')],'as':_0x8da3('0x65'),'attributes':['id','name','online',_0x8da3('0x66'),'interface'],'raw':!![]}]})[_0x8da3('0x27')](function(_0x4233fb){if(_0x4233fb){var _0x415d0f=_[_0x8da3('0x67')](_0x4233fb,function(_0x295a2d){var _0x491e85=_0x295a2d[_0x8da3('0x29')]({'plain':!![]});return _0x491e85[_0x8da3('0x65')];});return db[_0x8da3('0x2f')][_0x8da3('0x55')]({'where':{'id':_0x882a1[_0x8da3('0x49')]['id']}})[_0x8da3('0x27')](function(_0x46fdc7){return db[_0x8da3('0x68')][_0x8da3('0x69')](function(_0x17829e){return _0x46fdc7[_0x8da3('0x64')](_0x13ecf3,{'transaction':_0x17829e})[_0x8da3('0x27')](function(){return BPromise[_0x8da3('0x6a')](_0x415d0f,function(_0x3588f1){return db[_0x8da3('0x58')]['findOrCreate']({'where':{'UserId':_0x3588f1['id'],'OpenchannelQueueId':_0x882a1[_0x8da3('0x49')]['id']},'transaction':_0x17829e});});})[_0x8da3('0x27')](function(){_0x415d0f[_0x8da3('0x6b')](function(_0x58c4d1){socket['emit'](_0x8da3('0x6c'),{'UserId':_0x58c4d1['id'],'OpenchannelQueueId':_0x46fdc7['id']});});});});});}})[_0x8da3('0x27')](respondWithStatusCode(_0x1b77e5,null))['catch'](handleError(_0x1b77e5,null));};exports[_0x8da3('0x6d')]=function(_0x372f49,_0x215249,_0x56abcd){return db[_0x8da3('0x62')][_0x8da3('0x45')]({'where':{'id':_0x372f49['query'][_0x8da3('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x8da3('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8da3('0x27')](handleEntityNotFound(_0x215249,null))[_0x8da3('0x27')](function(_0x3747ba){var _0x376d74=_[_0x8da3('0x2e')](_0x3747ba,'id');var _0x2ed956=[];var _0x31b281=[];var _0x3162c1=squel['select']();_0x3162c1[_0x8da3('0x6f')](_0x8da3('0x70'))['from'](_0x8da3('0x71'),'tq')[_0x8da3('0x72')]('user_has_teams','ut',_0x8da3('0x73'))[_0x8da3('0x40')](_0x8da3('0x74'),_0x372f49[_0x8da3('0x49')]['id']);for(var _0x554f43=0x0;_0x554f43<_0x3747ba[_0x8da3('0x3b')];_0x554f43+=0x1){let _0x4b5134=_0x3747ba[_0x554f43];for(var _0x4d075b=0x0;_0x4d075b<_0x4b5134[_0x8da3('0x65')][_0x8da3('0x3b')];_0x4d075b+=0x1){let _0x16052c=_0x4b5134[_0x8da3('0x65')][_0x4d075b];var _0x370144=_0x3162c1[_0x8da3('0x75')]();_0x370144['where']('ut.UserId\x20=\x20?',_0x16052c['id']);_0x31b281['push'](db[_0x8da3('0x68')][_0x8da3('0x34')](_0x370144[_0x8da3('0x76')](),{'type':db['sequelize'][_0x8da3('0x77')][_0x8da3('0x78')]})[_0x8da3('0x27')](function(_0x3ab172){if(_0x3ab172[_0x8da3('0x3b')]===0x1){return _0x16052c['id'];}else{var _0x3b8330=_[_0x8da3('0x79')](_[_0x8da3('0x2e')](_0x3ab172,_0x8da3('0x7a')),function(_0x562b0f){return _['includes'](_0x376d74,_0x562b0f);});if(_0x3b8330){return _0x16052c['id'];}}}));}}return BPromise['all'](_0x31b281)[_0x8da3('0x27')](function(_0x14b813){_0x2ed956=_(_0x2ed956)[_0x8da3('0x7b')](_0x14b813)[_0x8da3('0x7c')]()[_0x8da3('0x7d')]();return db['OpenchannelQueue'][_0x8da3('0x55')]({'where':{'id':_0x372f49[_0x8da3('0x49')]['id']}})[_0x8da3('0x27')](function(_0x232d13){return db['sequelize'][_0x8da3('0x69')](function(_0x137454){return _0x232d13['removeTeams'](_0x372f49[_0x8da3('0x34')][_0x8da3('0x6e')],{'transaction':_0x137454})[_0x8da3('0x27')](function(){if(!_['isEmpty'](_0x2ed956)){return _0x232d13[_0x8da3('0x7e')](_0x2ed956,{'transaction':_0x137454});}})[_0x8da3('0x27')](function(){_0x2ed956[_0x8da3('0x6b')](function(_0x406d33){socket[_0x8da3('0x7f')](_0x8da3('0x80'),{'UserId':_0x406d33,'OpenchannelQueueId':_0x232d13['id']});});});});});});})['then'](respondWithStatusCode(_0x215249,null))[_0x8da3('0x47')](handleError(_0x215249,null));};exports[_0x8da3('0x81')]=function(_0x3b06fd,_0x1df1aa,_0x3aab38){return db[_0x8da3('0x2f')]['find']({'where':{'id':_0x3b06fd[_0x8da3('0x49')]['id']}})[_0x8da3('0x27')](handleEntityNotFound(_0x1df1aa,null))['then'](function(_0x260ee9){if(_0x260ee9){return _0x260ee9[_0x8da3('0x81')](_0x3b06fd[_0x8da3('0x4d')][_0x8da3('0x6e')],_[_0x8da3('0x82')](_0x3b06fd[_0x8da3('0x4d')],['ids','id'])||{})[_0x8da3('0x83')](function(_0xe48de3){for(var _0x55387e=0x0;_0x55387e<_0x3b06fd[_0x8da3('0x4d')][_0x8da3('0x6e')]['length'];_0x55387e+=0x1){socket[_0x8da3('0x7f')](_0x8da3('0x6c'),{'UserId':Number(_0x3b06fd[_0x8da3('0x4d')][_0x8da3('0x6e')][_0x55387e]),'OpenchannelQueueId':Number(_0x3b06fd['params']['id'])});}return _0xe48de3;});}})[_0x8da3('0x27')](respondWithResult(_0x1df1aa,null))[_0x8da3('0x47')](handleError(_0x1df1aa,null));};exports[_0x8da3('0x7e')]=function(_0x25dc35,_0x2300ee,_0x4a48af){return db[_0x8da3('0x2f')][_0x8da3('0x55')]({'where':{'id':_0x25dc35['params']['id']}})[_0x8da3('0x27')](handleEntityNotFound(_0x2300ee,null))[_0x8da3('0x27')](function(_0x499b18){if(_0x499b18){return _0x499b18['removeAgents'](_0x25dc35[_0x8da3('0x34')][_0x8da3('0x6e')])[_0x8da3('0x27')](function(){if(_[_0x8da3('0x84')](_0x25dc35[_0x8da3('0x34')][_0x8da3('0x6e')])){for(var _0x8a3a24=0x0;_0x8a3a24<_0x25dc35['query'][_0x8da3('0x6e')][_0x8da3('0x3b')];_0x8a3a24+=0x1){socket[_0x8da3('0x7f')](_0x8da3('0x80'),{'UserId':Number(_0x25dc35[_0x8da3('0x34')][_0x8da3('0x6e')][_0x8a3a24]),'OpenchannelQueueId':Number(_0x25dc35['params']['id'])});}}else{socket[_0x8da3('0x7f')]('userOpenchannelQueue:remove',{'UserId':Number(_0x25dc35[_0x8da3('0x34')]['ids']),'OpenchannelQueueId':Number(_0x25dc35[_0x8da3('0x49')]['id'])});}});}})[_0x8da3('0x27')](respondWithStatusCode(_0x2300ee,null))[_0x8da3('0x47')](handleError(_0x2300ee,null));};exports[_0x8da3('0x85')]=function(_0x44be7b,_0xf5fa55,_0x3adafc){var _0x5d5dd8={};var _0x14eeb2={};var _0x2c0fec;var _0x36a16b;return db[_0x8da3('0x2f')][_0x8da3('0x57')]({'where':{'id':_0x44be7b[_0x8da3('0x49')]['id']}})[_0x8da3('0x27')](handleEntityNotFound(_0xf5fa55,null))[_0x8da3('0x27')](function(_0x57f2db){if(_0x57f2db){_0x2c0fec=_0x57f2db;_0x14eeb2[_0x8da3('0x38')]=_[_0x8da3('0x35')](db[_0x8da3('0x5b')][_0x8da3('0x30')]);_0x14eeb2[_0x8da3('0x34')]=_['keys'](_0x44be7b[_0x8da3('0x34')]);_0x14eeb2[_0x8da3('0x36')]=_[_0x8da3('0x37')](_0x14eeb2[_0x8da3('0x38')],_0x14eeb2[_0x8da3('0x34')]);_0x5d5dd8[_0x8da3('0x39')]=_[_0x8da3('0x37')](_0x14eeb2[_0x8da3('0x38')],qs['fields'](_0x44be7b[_0x8da3('0x34')]['fields']));_0x5d5dd8[_0x8da3('0x39')]=_0x5d5dd8[_0x8da3('0x39')][_0x8da3('0x3b')]?_0x5d5dd8['attributes']:_0x14eeb2[_0x8da3('0x38')];_0x5d5dd8[_0x8da3('0x3e')]=qs[_0x8da3('0x3f')](_0x44be7b['query'][_0x8da3('0x3f')]);_0x5d5dd8[_0x8da3('0x40')]=qs['filters'](_[_0x8da3('0x59')](_0x44be7b['query'],_0x14eeb2[_0x8da3('0x36')]));if(_0x44be7b['query'][_0x8da3('0x43')]){_0x5d5dd8[_0x8da3('0x40')]=_[_0x8da3('0x41')](_0x5d5dd8['where'],{'$or':_[_0x8da3('0x2e')](_0x5d5dd8[_0x8da3('0x39')],function(_0x3c3700){var _0x512274={};_0x512274[_0x3c3700]={'$like':'%'+_0x44be7b[_0x8da3('0x34')][_0x8da3('0x43')]+'%'};return _0x512274;})});}_0x5d5dd8=_[_0x8da3('0x41')]({},_0x5d5dd8,_0x44be7b[_0x8da3('0x4b')]);return _0x2c0fec[_0x8da3('0x85')](_0x5d5dd8);}})[_0x8da3('0x27')](function(_0x856c8d){if(_0x856c8d){_0x36a16b=_0x856c8d['length'];if(!_0x44be7b[_0x8da3('0x34')][_0x8da3('0x3c')](_0x8da3('0x3d'))){_0x5d5dd8[_0x8da3('0x20')]=qs[_0x8da3('0x20')](_0x44be7b['query'][_0x8da3('0x20')]);_0x5d5dd8[_0x8da3('0x22')]=qs[_0x8da3('0x22')](_0x44be7b[_0x8da3('0x34')]['offset']);}return _0x2c0fec[_0x8da3('0x85')](_0x5d5dd8);}})[_0x8da3('0x27')](function(_0x3db61b){if(_0x3db61b){return _0x3db61b?{'count':_0x36a16b,'rows':_0x3db61b}:null;}})[_0x8da3('0x27')](respondWithResult(_0xf5fa55,null))[_0x8da3('0x47')](handleError(_0xf5fa55,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 02fcd12..6574fb2 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 _0x6c9d=['exports','events','OpenchannelQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x6c9d,0xac));var _0xd6c9=function(_0x229a95,_0x292d4f){_0x229a95=_0x229a95-0x0;var _0x2c74e7=_0x6c9d[_0x229a95];return _0x2c74e7;};'use strict';var EventEmitter=require(_0xd6c9('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xd6c9('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd6c9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd6c9('0x3'),'afterDestroy':_0xd6c9('0x4')};function emitEvent(_0x423c23){return function(_0x1dcfab,_0x243797,_0x3a389a){OpenchannelQueueEvents[_0xd6c9('0x5')](_0x423c23+':'+_0x1dcfab['id'],_0x1dcfab);OpenchannelQueueEvents[_0xd6c9('0x5')](_0x423c23,_0x1dcfab);_0x3a389a(null);};}for(var e in events){if(events[_0xd6c9('0x6')](e)){var event=events[e];OpenchannelQueue[_0xd6c9('0x7')](e,emitEvent(event));}}module[_0xd6c9('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x7d84=['hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x7d84,0x178));var _0x47d8=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x7d84[_0x599e60];return _0x468e19;};'use strict';var EventEmitter=require(_0x47d8('0x0'));var OpenchannelQueue=require(_0x47d8('0x1'))['db'][_0x47d8('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x47d8('0x3')](0x0);var events={'afterCreate':_0x47d8('0x4'),'afterUpdate':_0x47d8('0x5'),'afterDestroy':_0x47d8('0x6')};function emitEvent(_0x48045f){return function(_0x82a782,_0x46965c,_0x3477ed){OpenchannelQueueEvents[_0x47d8('0x7')](_0x48045f+':'+_0x82a782['id'],_0x82a782);OpenchannelQueueEvents[_0x47d8('0x7')](_0x48045f,_0x82a782);_0x3477ed(null);};}for(var e in events){if(events[_0x47d8('0x8')](e)){var event=events[e];OpenchannelQueue[_0x47d8('0x9')](e,emitEvent(event));}}module[_0x47d8('0xa')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index deadacf..25989bf 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 _0x2e58=['define','OpenchannelQueue','openchannel_queues','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueue.attributes','exports'];(function(_0x25c8ae,_0x3c677f){var _0x491010=function(_0x35c0d7){while(--_0x35c0d7){_0x25c8ae['push'](_0x25c8ae['shift']());}};_0x491010(++_0x3c677f);}(_0x2e58,0xf5));var _0x82e5=function(_0x4d3bf5,_0x5720af){_0x4d3bf5=_0x4d3bf5-0x0;var _0x4ea3b3=_0x2e58[_0x4d3bf5];return _0x4ea3b3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x82e5('0x0'))(_0x82e5('0x1'));var moment=require(_0x82e5('0x2'));var BPromise=require(_0x82e5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x82e5('0x4'));var rimraf=require(_0x82e5('0x5'));var config=require('../../config/environment');var attributes=require(_0x82e5('0x6'));module[_0x82e5('0x7')]=function(_0x374093,_0x3eb8cb){return _0x374093[_0x82e5('0x8')](_0x82e5('0x9'),attributes,{'tableName':_0x82e5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x337a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger'];(function(_0x4ae0f8,_0x481211){var _0xcd39f7=function(_0x2a4134){while(--_0x2a4134){_0x4ae0f8['push'](_0x4ae0f8['shift']());}};_0xcd39f7(++_0x481211);}(_0x337a,0x193));var _0xa337=function(_0x1164cc,_0x485249){_0x1164cc=_0x1164cc-0x0;var _0x15e297=_0x337a[_0x1164cc];return _0x15e297;};'use strict';var _=require(_0xa337('0x0'));var util=require(_0xa337('0x1'));var logger=require(_0xa337('0x2'))(_0xa337('0x3'));var moment=require(_0xa337('0x4'));var BPromise=require(_0xa337('0x5'));var rp=require(_0xa337('0x6'));var fs=require('fs');var path=require(_0xa337('0x7'));var rimraf=require(_0xa337('0x8'));var config=require(_0xa337('0x9'));var attributes=require('./openchannelQueue.attributes');module[_0xa337('0xa')]=function(_0x15b9a4,_0xfd074d){return _0x15b9a4[_0xa337('0xb')](_0xa337('0xc'),attributes,{'tableName':_0xa337('0xd'),'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 875c3e9..d4864f1 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 _0xfd06=['OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowOpenchannelQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./openchannelQueue.socket','register','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetOpenchannelQueue'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0xfd06,0xd4));var _0x6fd0=function(_0x3eed3f,_0x5253b5){_0x3eed3f=_0x3eed3f-0x0;var _0xd68fd8=_0xfd06[_0x3eed3f];return _0xd68fd8;};'use strict';var _=require(_0x6fd0('0x0'));var util=require(_0x6fd0('0x1'));var moment=require(_0x6fd0('0x2'));var BPromise=require(_0x6fd0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6fd0('0x4'));var db=require(_0x6fd0('0x5'))['db'];var utils=require(_0x6fd0('0x6'));var logger=require(_0x6fd0('0x7'))(_0x6fd0('0x8'));var config=require(_0x6fd0('0x9'));var jayson=require(_0x6fd0('0xa'));var client=jayson[_0x6fd0('0xb')][_0x6fd0('0xc')]({'port':0x232a});config[_0x6fd0('0xd')]=_['defaults'](config[_0x6fd0('0xd')],{'host':_0x6fd0('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6fd0('0xf'))[_0x6fd0('0x10')](socket);function respondWithRpcPromise(_0x30a193,_0x290189,_0x35d812){return new BPromise(function(_0x438ac8,_0x5188a8){return client['request'](_0x30a193,_0x35d812)[_0x6fd0('0x11')](function(_0x3f27d7){logger['info'](_0x6fd0('0x12'),_0x290189,_0x6fd0('0x13'));logger[_0x6fd0('0x14')](_0x6fd0('0x15'),_0x290189,'request\x20sent',JSON['stringify'](_0x3f27d7));if(_0x3f27d7[_0x6fd0('0x16')]){if(_0x3f27d7[_0x6fd0('0x16')]['code']===0x1f4){logger[_0x6fd0('0x16')](_0x6fd0('0x12'),_0x290189,_0x3f27d7['error'][_0x6fd0('0x17')]);return _0x5188a8(_0x3f27d7[_0x6fd0('0x16')][_0x6fd0('0x17')]);}logger[_0x6fd0('0x16')](_0x6fd0('0x12'),_0x290189,_0x3f27d7[_0x6fd0('0x16')][_0x6fd0('0x17')]);return _0x438ac8(_0x3f27d7[_0x6fd0('0x16')][_0x6fd0('0x17')]);}else{logger[_0x6fd0('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x290189,'request\x20sent');_0x438ac8(_0x3f27d7[_0x6fd0('0x19')]['message']);}})[_0x6fd0('0x1a')](function(_0x46b825){logger[_0x6fd0('0x16')](_0x6fd0('0x12'),_0x290189,_0x46b825);_0x5188a8(_0x46b825);});});}exports[_0x6fd0('0x1b')]=function(_0x3dde64){var _0x1c1f18=this;return new Promise(function(_0x58e95d,_0x5d7b30){return db[_0x6fd0('0x1c')][_0x6fd0('0x1d')]({'raw':_0x3dde64['options']?_0x3dde64[_0x6fd0('0x1e')][_0x6fd0('0x1f')]===undefined?!![]:![]:!![],'where':_0x3dde64[_0x6fd0('0x1e')]?_0x3dde64[_0x6fd0('0x1e')][_0x6fd0('0x20')]||null:null,'attributes':_0x3dde64[_0x6fd0('0x1e')]?_0x3dde64[_0x6fd0('0x1e')][_0x6fd0('0x21')]||null:null,'limit':_0x3dde64[_0x6fd0('0x1e')]?_0x3dde64['options'][_0x6fd0('0x22')]||null:null,'include':_0x3dde64[_0x6fd0('0x1e')]?_0x3dde64[_0x6fd0('0x1e')][_0x6fd0('0x23')]?_['map'](_0x3dde64[_0x6fd0('0x1e')]['include'],function(_0x373ba5){return{'model':db[_0x373ba5[_0x6fd0('0x24')]],'as':_0x373ba5['as'],'attributes':_0x373ba5['attributes'],'include':_0x373ba5['include']?_[_0x6fd0('0x25')](_0x373ba5[_0x6fd0('0x23')],function(_0x5670b7){return{'model':db[_0x5670b7[_0x6fd0('0x24')]],'as':_0x5670b7['as'],'attributes':_0x5670b7[_0x6fd0('0x21')],'include':_0x5670b7[_0x6fd0('0x23')]?_['map'](_0x5670b7[_0x6fd0('0x23')],function(_0x175b46){return{'model':db[_0x175b46[_0x6fd0('0x24')]],'as':_0x175b46['as'],'attributes':_0x175b46['attributes']};}):[]};}):[]};}):[]:[]})[_0x6fd0('0x11')](function(_0x443708){logger[_0x6fd0('0x18')](_0x6fd0('0x1b'),_0x3dde64);logger['debug'](_0x6fd0('0x1b'),_0x3dde64,JSON[_0x6fd0('0x26')](_0x443708));_0x58e95d(_0x443708);})[_0x6fd0('0x1a')](function(_0x117755){logger[_0x6fd0('0x16')](_0x6fd0('0x1b'),_0x117755[_0x6fd0('0x17')],_0x3dde64);_0x5d7b30(_0x1c1f18[_0x6fd0('0x16')](0x1f4,_0x117755[_0x6fd0('0x17')]));});});};exports['ShowOpenchannelQueue']=function(_0x357d34){var _0x578d70=this;return new Promise(function(_0x16cb67,_0x3374ae){return db['OpenchannelQueue']['find']({'raw':_0x357d34[_0x6fd0('0x1e')]?_0x357d34[_0x6fd0('0x1e')][_0x6fd0('0x1f')]===undefined?!![]:![]:!![],'where':_0x357d34[_0x6fd0('0x1e')]?_0x357d34[_0x6fd0('0x1e')][_0x6fd0('0x20')]||null:null,'attributes':_0x357d34[_0x6fd0('0x1e')]?_0x357d34['options'][_0x6fd0('0x21')]||null:null,'include':_0x357d34[_0x6fd0('0x1e')]?_0x357d34[_0x6fd0('0x1e')]['include']?_[_0x6fd0('0x25')](_0x357d34['options'][_0x6fd0('0x23')],function(_0x6539a7){return{'model':db[_0x6539a7[_0x6fd0('0x24')]],'as':_0x6539a7['as'],'attributes':_0x6539a7[_0x6fd0('0x21')],'include':_0x6539a7[_0x6fd0('0x23')]?_[_0x6fd0('0x25')](_0x6539a7[_0x6fd0('0x23')],function(_0xbd638f){return{'model':db[_0xbd638f[_0x6fd0('0x24')]],'as':_0xbd638f['as'],'attributes':_0xbd638f[_0x6fd0('0x21')],'include':_0xbd638f[_0x6fd0('0x23')]?_[_0x6fd0('0x25')](_0xbd638f[_0x6fd0('0x23')],function(_0x112650){return{'model':db[_0x112650['model']],'as':_0x112650['as'],'attributes':_0x112650[_0x6fd0('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6fd0('0x11')](function(_0x2a90bf){logger['info'](_0x6fd0('0x27'),_0x357d34);logger[_0x6fd0('0x14')](_0x6fd0('0x27'),_0x357d34,JSON[_0x6fd0('0x26')](_0x2a90bf));_0x16cb67(_0x2a90bf);})[_0x6fd0('0x1a')](function(_0x18ba05){logger[_0x6fd0('0x16')](_0x6fd0('0x27'),_0x18ba05['message'],_0x357d34);_0x3374ae(_0x578d70['error'](0x1f4,_0x18ba05['message']));});});}; \ No newline at end of file +var _0x4013=['./openchannelQueue.socket','register','then','info','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','attributes','limit','include','model','map','ShowOpenchannelQueue','where','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x562447,_0x4f70cf){var _0x26397f=function(_0x755064){while(--_0x755064){_0x562447['push'](_0x562447['shift']());}};_0x26397f(++_0x4f70cf);}(_0x4013,0x8e));var _0x3401=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4013[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x3401('0x0'));var util=require(_0x3401('0x1'));var moment=require('moment');var BPromise=require(_0x3401('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3401('0x3'));var db=require(_0x3401('0x4'))['db'];var utils=require(_0x3401('0x5'));var logger=require(_0x3401('0x6'))(_0x3401('0x7'));var config=require('../../config/environment');var jayson=require(_0x3401('0x8'));var client=jayson[_0x3401('0x9')][_0x3401('0xa')]({'port':0x232a});config[_0x3401('0xb')]=_[_0x3401('0xc')](config[_0x3401('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3401('0xd'))(new Redis(config[_0x3401('0xb')]));require(_0x3401('0xe'))[_0x3401('0xf')](socket);function respondWithRpcPromise(_0x354ef5,_0x589240,_0x51de00){return new BPromise(function(_0x1dbfa6,_0x7adced){return client['request'](_0x354ef5,_0x51de00)[_0x3401('0x10')](function(_0x480b76){logger[_0x3401('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x589240,_0x3401('0x12'));logger['debug'](_0x3401('0x13'),_0x589240,'request\x20sent',JSON[_0x3401('0x14')](_0x480b76));if(_0x480b76['error']){if(_0x480b76[_0x3401('0x15')][_0x3401('0x16')]===0x1f4){logger[_0x3401('0x15')](_0x3401('0x17'),_0x589240,_0x480b76[_0x3401('0x15')][_0x3401('0x18')]);return _0x7adced(_0x480b76[_0x3401('0x15')][_0x3401('0x18')]);}logger[_0x3401('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x589240,_0x480b76['error'][_0x3401('0x18')]);return _0x1dbfa6(_0x480b76['error'][_0x3401('0x18')]);}else{logger[_0x3401('0x11')](_0x3401('0x17'),_0x589240,'request\x20sent');_0x1dbfa6(_0x480b76[_0x3401('0x19')][_0x3401('0x18')]);}})[_0x3401('0x1a')](function(_0x365cc9){logger['error'](_0x3401('0x17'),_0x589240,_0x365cc9);_0x7adced(_0x365cc9);});});}exports[_0x3401('0x1b')]=function(_0x6e970e){var _0x3a9ccd=this;return new Promise(function(_0x5c67f4,_0x297a8a){return db[_0x3401('0x1c')]['findAll']({'raw':_0x6e970e[_0x3401('0x1d')]?_0x6e970e[_0x3401('0x1d')][_0x3401('0x1e')]===undefined?!![]:![]:!![],'where':_0x6e970e[_0x3401('0x1d')]?_0x6e970e['options']['where']||null:null,'attributes':_0x6e970e[_0x3401('0x1d')]?_0x6e970e[_0x3401('0x1d')][_0x3401('0x1f')]||null:null,'limit':_0x6e970e['options']?_0x6e970e['options'][_0x3401('0x20')]||null:null,'include':_0x6e970e[_0x3401('0x1d')]?_0x6e970e[_0x3401('0x1d')]['include']?_['map'](_0x6e970e['options'][_0x3401('0x21')],function(_0x5da916){return{'model':db[_0x5da916[_0x3401('0x22')]],'as':_0x5da916['as'],'attributes':_0x5da916[_0x3401('0x1f')],'include':_0x5da916['include']?_['map'](_0x5da916['include'],function(_0x209f18){return{'model':db[_0x209f18[_0x3401('0x22')]],'as':_0x209f18['as'],'attributes':_0x209f18[_0x3401('0x1f')],'include':_0x209f18['include']?_[_0x3401('0x23')](_0x209f18['include'],function(_0x5d24e5){return{'model':db[_0x5d24e5['model']],'as':_0x5d24e5['as'],'attributes':_0x5d24e5[_0x3401('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3401('0x10')](function(_0x20b404){logger[_0x3401('0x11')](_0x3401('0x1b'),_0x6e970e);logger['debug']('GetOpenchannelQueue',_0x6e970e,JSON[_0x3401('0x14')](_0x20b404));_0x5c67f4(_0x20b404);})[_0x3401('0x1a')](function(_0x5034e2){logger[_0x3401('0x15')](_0x3401('0x1b'),_0x5034e2[_0x3401('0x18')],_0x6e970e);_0x297a8a(_0x3a9ccd[_0x3401('0x15')](0x1f4,_0x5034e2[_0x3401('0x18')]));});});};exports[_0x3401('0x24')]=function(_0x5afdbe){var _0x2c9f8a=this;return new Promise(function(_0x3cfcaf,_0x563170){return db[_0x3401('0x1c')]['find']({'raw':_0x5afdbe[_0x3401('0x1d')]?_0x5afdbe[_0x3401('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5afdbe[_0x3401('0x1d')]?_0x5afdbe[_0x3401('0x1d')][_0x3401('0x25')]||null:null,'attributes':_0x5afdbe[_0x3401('0x1d')]?_0x5afdbe[_0x3401('0x1d')][_0x3401('0x1f')]||null:null,'include':_0x5afdbe[_0x3401('0x1d')]?_0x5afdbe[_0x3401('0x1d')]['include']?_[_0x3401('0x23')](_0x5afdbe[_0x3401('0x1d')]['include'],function(_0x51d4bf){return{'model':db[_0x51d4bf[_0x3401('0x22')]],'as':_0x51d4bf['as'],'attributes':_0x51d4bf['attributes'],'include':_0x51d4bf[_0x3401('0x21')]?_[_0x3401('0x23')](_0x51d4bf[_0x3401('0x21')],function(_0x3b9b54){return{'model':db[_0x3b9b54[_0x3401('0x22')]],'as':_0x3b9b54['as'],'attributes':_0x3b9b54[_0x3401('0x1f')],'include':_0x3b9b54['include']?_[_0x3401('0x23')](_0x3b9b54['include'],function(_0x45e2d8){return{'model':db[_0x45e2d8['model']],'as':_0x45e2d8['as'],'attributes':_0x45e2d8[_0x3401('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3401('0x10')](function(_0xcad69e){logger[_0x3401('0x11')]('ShowOpenchannelQueue',_0x5afdbe);logger[_0x3401('0x26')]('ShowOpenchannelQueue',_0x5afdbe,JSON[_0x3401('0x14')](_0xcad69e));_0x3cfcaf(_0xcad69e);})[_0x3401('0x1a')](function(_0xf11102){logger[_0x3401('0x15')](_0x3401('0x24'),_0xf11102['message'],_0x5afdbe);_0x563170(_0x2c9f8a[_0x3401('0x15')](0x1f4,_0xf11102[_0x3401('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 913054a..50059f8 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 _0xebdd=['remove','update','emit','removeListener','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0xebdd,0x1be));var _0xdebd=function(_0x4c2dfc,_0x4814c0){_0x4c2dfc=_0x4c2dfc-0x0;var _0xfd728d=_0xebdd[_0x4c2dfc];return _0xfd728d;};'use strict';var OpenchannelQueueEvents=require(_0xdebd('0x0'));var events=[_0xdebd('0x1'),_0xdebd('0x2'),_0xdebd('0x3')];function createListener(_0x180d50,_0x48e1be){return function(_0x2e78c2){_0x48e1be[_0xdebd('0x4')](_0x180d50,_0x2e78c2);};}function removeListener(_0x4b3fc2,_0x441873){return function(){OpenchannelQueueEvents[_0xdebd('0x5')](_0x4b3fc2,_0x441873);};}exports['register']=function(_0x3e8c91){for(var _0x5a49b9=0x0,_0x1cd7f4=events[_0xdebd('0x6')];_0x5a49b9<_0x1cd7f4;_0x5a49b9++){var _0x22fe3e=events[_0x5a49b9];var _0x2a8a12=createListener(_0xdebd('0x7')+_0x22fe3e,_0x3e8c91);OpenchannelQueueEvents['on'](_0x22fe3e,_0x2a8a12);}}; \ No newline at end of file +var _0xc8e9=['update','emit','removeListener','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc8e9,0x19a));var _0x9c8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc8e9[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelQueueEvents=require(_0x9c8e('0x0'));var events=[_0x9c8e('0x1'),_0x9c8e('0x2'),_0x9c8e('0x3')];function createListener(_0x37a02b,_0x53824f){return function(_0xe466d4){_0x53824f[_0x9c8e('0x4')](_0x37a02b,_0xe466d4);};}function removeListener(_0x5e293d,_0x49da9e){return function(){OpenchannelQueueEvents[_0x9c8e('0x5')](_0x5e293d,_0x49da9e);};}exports['register']=function(_0x2d2729){for(var _0xa9cfc4=0x0,_0x42194d=events['length'];_0xa9cfc4<_0x42194d;_0xa9cfc4++){var _0x5264ab=events[_0xa9cfc4];var _0x5bc919=createListener(_0x9c8e('0x6')+_0x5264ab,_0x2d2729);OpenchannelQueueEvents['on'](_0x5264ab,_0x5bc919);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index b83a8a2..d7e0ac2 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 _0xc5be=['/:id','show','post','create','put','update','delete','exports','util','path','express','Router','fs-extra','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x3a1248,_0x2872d6){var _0x5ac675=function(_0x99f629){while(--_0x99f629){_0x3a1248['push'](_0x3a1248['shift']());}};_0x5ac675(++_0x2872d6);}(_0xc5be,0x1e3));var _0xec5b=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xc5be[_0x47fd36];return _0x21a0fc;};'use strict';var multer=require('multer');var util=require(_0xec5b('0x0'));var path=require(_0xec5b('0x1'));var timeout=require('connect-timeout');var express=require(_0xec5b('0x2'));var router=express[_0xec5b('0x3')]();var fs_extra=require(_0xec5b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xec5b('0x5'));var controller=require(_0xec5b('0x6'));router[_0xec5b('0x7')]('/',auth[_0xec5b('0x8')](),controller['index']);router[_0xec5b('0x7')](_0xec5b('0x9'),auth[_0xec5b('0x8')](),controller[_0xec5b('0xa')]);router[_0xec5b('0x7')](_0xec5b('0xb'),auth[_0xec5b('0x8')](),controller[_0xec5b('0xc')]);router[_0xec5b('0xd')]('/',auth[_0xec5b('0x8')](),controller[_0xec5b('0xe')]);router[_0xec5b('0xf')](_0xec5b('0xb'),auth[_0xec5b('0x8')](),controller[_0xec5b('0x10')]);router[_0xec5b('0x11')](_0xec5b('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xec5b('0x12')]=router; \ No newline at end of file +var _0x1f85=['path','connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0xd4b73a,_0x59b90a){var _0x68173d=function(_0x158d8b){while(--_0x158d8b){_0xd4b73a['push'](_0xd4b73a['shift']());}};_0x68173d(++_0x59b90a);}(_0x1f85,0x1a2));var _0x51f8=function(_0x41648c,_0x262b89){_0x41648c=_0x41648c-0x0;var _0x49ffc6=_0x1f85[_0x41648c];return _0x49ffc6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51f8('0x0'));var timeout=require(_0x51f8('0x1'));var express=require(_0x51f8('0x2'));var router=express[_0x51f8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x51f8('0x4'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0x51f8('0x5')](),controller[_0x51f8('0x6')]);router[_0x51f8('0x7')](_0x51f8('0x8'),auth['isAuthenticated'](),controller[_0x51f8('0x9')]);router[_0x51f8('0x7')]('/:id',auth[_0x51f8('0x5')](),controller[_0x51f8('0xa')]);router[_0x51f8('0xb')]('/',auth['isAuthenticated'](),controller[_0x51f8('0xc')]);router[_0x51f8('0xd')](_0x51f8('0xe'),auth[_0x51f8('0x5')](),controller[_0x51f8('0xf')]);router[_0x51f8('0x10')]('/:id',auth[_0x51f8('0x5')](),controller[_0x51f8('0x11')]);module[_0x51f8('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 94ca4ce..ed37650 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 _0x14f8=['STRING','DATE','sequelize','exports'];(function(_0x567eba,_0x20baf4){var _0x5c97fc=function(_0x3cb458){while(--_0x3cb458){_0x567eba['push'](_0x567eba['shift']());}};_0x5c97fc(++_0x20baf4);}(_0x14f8,0x66));var _0x814f=function(_0x4aa58b,_0x17e87a){_0x4aa58b=_0x4aa58b-0x0;var _0x4f50f8=_0x14f8[_0x4aa58b];return _0x4f50f8;};'use strict';var moment=require('moment');var Sequelize=require(_0x814f('0x0'));module[_0x814f('0x1')]={'uniqueid':{'type':Sequelize[_0x814f('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x814f('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x814f('0x3')]},'reason':{'type':Sequelize[_0x814f('0x2')]}}; \ No newline at end of file +var _0xc45f=['sequelize','STRING','DATE','moment'];(function(_0x1ba4bd,_0x2c8a44){var _0x59e274=function(_0x1d6858){while(--_0x1d6858){_0x1ba4bd['push'](_0x1ba4bd['shift']());}};_0x59e274(++_0x2c8a44);}(_0xc45f,0xfb));var _0xfc45=function(_0x3885ae,_0x2514e2){_0x3885ae=_0x3885ae-0x0;var _0xc12345=_0xc45f[_0x3885ae];return _0xc12345;};'use strict';var moment=require(_0xfc45('0x0'));var Sequelize=require(_0xfc45('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xfc45('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xfc45('0x2')]},'joinAt':{'type':Sequelize[_0xfc45('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xfc45('0x3')]},'exitAt':{'type':Sequelize[_0xfc45('0x3')]},'reason':{'type':Sequelize[_0xfc45('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index ca4d704..034d90c 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 _0x61f5=['filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','filters','include','find','create','body','params','destroy','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','limit','count','status','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick'];(function(_0x26dde3,_0x1d07d9){var _0x251970=function(_0x46e745){while(--_0x46e745){_0x26dde3['push'](_0x26dde3['shift']());}};_0x251970(++_0x1d07d9);}(_0x61f5,0x193));var _0x561f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x61f5[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x561f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x561f('0x1'));var rp=require('request-promise');var moment=require(_0x561f('0x2'));var BPromise=require(_0x561f('0x3'));var Mustache=require(_0x561f('0x4'));var util=require(_0x561f('0x5'));var path=require(_0x561f('0x6'));var sox=require(_0x561f('0x7'));var csv=require(_0x561f('0x8'));var ejs=require(_0x561f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x561f('0xa'));var squel=require(_0x561f('0xb'));var crypto=require(_0x561f('0xc'));var jsforce=require(_0x561f('0xd'));var deskjs=require(_0x561f('0xe'));var toCsv=require(_0x561f('0x8'));var querystring=require('querystring');var Papa=require(_0x561f('0xf'));var Redis=require(_0x561f('0x10'));var authService=require(_0x561f('0x11'));var qs=require(_0x561f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x561f('0x13'));var logger=require(_0x561f('0x14'))(_0x561f('0x15'));var utils=require(_0x561f('0x16'));var config=require(_0x561f('0x17'));var licenseUtil=require(_0x561f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11c347,_0x524f9c){_0x524f9c=_0x524f9c||0xcc;return function(_0x447e87){if(_0x447e87){return _0x11c347[_0x561f('0x19')](_0x524f9c);}return _0x11c347['status'](_0x524f9c)[_0x561f('0x1a')]();};}function respondWithResult(_0x552d50,_0x1e54fd){_0x1e54fd=_0x1e54fd||0xc8;return function(_0x369e8b){if(_0x369e8b){return _0x552d50['status'](_0x1e54fd)['json'](_0x369e8b);}};}function respondWithFilteredResult(_0x5192b5,_0x428133){return function(_0x31591a){if(_0x31591a){var _0x2ee690=typeof _0x428133[_0x561f('0x1b')]==='undefined'&&typeof _0x428133[_0x561f('0x1c')]==='undefined';var _0x38b871=_0x31591a[_0x561f('0x1d')];var _0x3758c1=_0x2ee690?0x0:_0x428133[_0x561f('0x1b')];var _0x48512c=_0x2ee690?_0x31591a[_0x561f('0x1d')]:_0x428133[_0x561f('0x1b')]+_0x428133['limit'];var _0x3a8f3a;if(_0x48512c>=_0x38b871){_0x48512c=_0x38b871;_0x3a8f3a=0xc8;}else{_0x3a8f3a=0xce;}_0x5192b5[_0x561f('0x1e')](_0x3a8f3a);return _0x5192b5['set'](_0x561f('0x1f'),_0x3758c1+'-'+_0x48512c+'/'+_0x38b871)[_0x561f('0x20')](_0x31591a);}return null;};}function patchUpdates(_0xcef299){return function(_0x21d7d8){try{jsonpatch[_0x561f('0x21')](_0x21d7d8,_0xcef299,!![]);}catch(_0x55c9fc){return BPromise[_0x561f('0x22')](_0x55c9fc);}return _0x21d7d8[_0x561f('0x23')]();};}function saveUpdates(_0x1082d5,_0x447202){return function(_0x741fdb){if(_0x741fdb){return _0x741fdb[_0x561f('0x24')](_0x1082d5)['then'](function(_0x2877cf){return _0x2877cf;});}return null;};}function removeEntity(_0x44ee76,_0x23eff3){return function(_0x162eec){if(_0x162eec){return _0x162eec['destroy']()[_0x561f('0x25')](function(){_0x44ee76[_0x561f('0x1e')](0xcc)[_0x561f('0x1a')]();});}};}function handleEntityNotFound(_0x1d6549,_0x1ffab3){return function(_0xc46011){if(!_0xc46011){_0x1d6549[_0x561f('0x19')](0x194);}return _0xc46011;};}function handleError(_0x5f055d,_0x31a037){_0x31a037=_0x31a037||0x1f4;return function(_0xa2f424){logger[_0x561f('0x26')](_0xa2f424[_0x561f('0x27')]);if(_0xa2f424[_0x561f('0x28')]){delete _0xa2f424[_0x561f('0x28')];}_0x5f055d[_0x561f('0x1e')](_0x31a037)[_0x561f('0x29')](_0xa2f424);};}exports[_0x561f('0x2a')]=function(_0x2f2469,_0x4a3f72){var _0x48ef47={},_0x37670d={},_0x5f4a9e={'count':0x0,'rows':[]};var _0xd1d195=_[_0x561f('0x2b')](db[_0x561f('0x2c')][_0x561f('0x2d')],function(_0xe8a928){return{'name':_0xe8a928[_0x561f('0x2e')],'type':_0xe8a928['type'][_0x561f('0x2f')]};});_0x37670d[_0x561f('0x30')]=_[_0x561f('0x2b')](_0xd1d195,_0x561f('0x28'));_0x37670d[_0x561f('0x31')]=_[_0x561f('0x32')](_0x2f2469[_0x561f('0x31')]);_0x37670d['filters']=_[_0x561f('0x33')](_0x37670d[_0x561f('0x30')],_0x37670d['query']);_0x48ef47['attributes']=_[_0x561f('0x33')](_0x37670d[_0x561f('0x30')],qs['fields'](_0x2f2469['query'][_0x561f('0x34')]));_0x48ef47['attributes']=_0x48ef47[_0x561f('0x35')][_0x561f('0x36')]?_0x48ef47[_0x561f('0x35')]:_0x37670d['model'];if(!_0x2f2469[_0x561f('0x31')][_0x561f('0x37')](_0x561f('0x38'))){_0x48ef47[_0x561f('0x1c')]=qs[_0x561f('0x1c')](_0x2f2469[_0x561f('0x31')][_0x561f('0x1c')]);_0x48ef47[_0x561f('0x1b')]=qs[_0x561f('0x1b')](_0x2f2469[_0x561f('0x31')][_0x561f('0x1b')]);}_0x48ef47[_0x561f('0x39')]=qs['sort'](_0x2f2469['query']['sort']);_0x48ef47['where']=qs['filters'](_[_0x561f('0x3a')](_0x2f2469['query'],_0x37670d['filters']),_0xd1d195);if(_0x2f2469[_0x561f('0x31')][_0x561f('0x3b')]){_0x48ef47[_0x561f('0x3c')]=_['merge'](_0x48ef47[_0x561f('0x3c')],{'$or':_[_0x561f('0x2b')](_0xd1d195,function(_0x31a215){if(_0x31a215[_0x561f('0x3d')]!==_0x561f('0x3e')){var _0x1983f8={};_0x1983f8[_0x31a215[_0x561f('0x28')]]={'$like':'%'+_0x2f2469[_0x561f('0x31')]['filter']+'%'};return _0x1983f8;}})});}_0x48ef47=_[_0x561f('0x3f')]({},_0x48ef47,_0x2f2469[_0x561f('0x40')]);var _0x2170fe={'where':_0x48ef47[_0x561f('0x3c')]};return db[_0x561f('0x2c')][_0x561f('0x1d')](_0x2170fe)['then'](function(_0x1ad1c5){_0x5f4a9e[_0x561f('0x1d')]=_0x1ad1c5;if(_0x2f2469[_0x561f('0x31')][_0x561f('0x41')]){_0x48ef47['include']=[{'all':!![]}];}return db[_0x561f('0x2c')][_0x561f('0x42')](_0x48ef47);})['then'](function(_0x55d21b){_0x5f4a9e[_0x561f('0x43')]=_0x55d21b;return _0x5f4a9e;})['then'](respondWithFilteredResult(_0x4a3f72,_0x48ef47))[_0x561f('0x44')](handleError(_0x4a3f72,null));};exports[_0x561f('0x45')]=function(_0xef61d7,_0x39e8bc){var _0x47fda9={'raw':!![],'where':{'id':_0xef61d7['params']['id']}},_0x499add={};_0x499add['model']=_['keys'](db[_0x561f('0x2c')][_0x561f('0x2d')]);_0x499add[_0x561f('0x31')]=_[_0x561f('0x32')](_0xef61d7[_0x561f('0x31')]);_0x499add[_0x561f('0x46')]=_[_0x561f('0x33')](_0x499add[_0x561f('0x30')],_0x499add[_0x561f('0x31')]);_0x47fda9[_0x561f('0x35')]=_['intersection'](_0x499add[_0x561f('0x30')],qs[_0x561f('0x34')](_0xef61d7[_0x561f('0x31')][_0x561f('0x34')]));_0x47fda9[_0x561f('0x35')]=_0x47fda9['attributes']['length']?_0x47fda9['attributes']:_0x499add[_0x561f('0x30')];if(_0xef61d7['query'][_0x561f('0x41')]){_0x47fda9[_0x561f('0x47')]=[{'all':!![]}];}_0x47fda9=_[_0x561f('0x3f')]({},_0x47fda9,_0xef61d7[_0x561f('0x40')]);return db[_0x561f('0x2c')][_0x561f('0x48')](_0x47fda9)['then'](handleEntityNotFound(_0x39e8bc,null))[_0x561f('0x25')](respondWithResult(_0x39e8bc,null))[_0x561f('0x44')](handleError(_0x39e8bc,null));};exports[_0x561f('0x49')]=function(_0x7d26a3,_0xacd59e){return db[_0x561f('0x2c')][_0x561f('0x49')](_0x7d26a3['body'],{})[_0x561f('0x25')](respondWithResult(_0xacd59e,0xc9))[_0x561f('0x44')](handleError(_0xacd59e,null));};exports[_0x561f('0x24')]=function(_0x279a4e,_0xb5e67c){if(_0x279a4e[_0x561f('0x4a')]['id']){delete _0x279a4e[_0x561f('0x4a')]['id'];}return db[_0x561f('0x2c')][_0x561f('0x48')]({'where':{'id':_0x279a4e[_0x561f('0x4b')]['id']}})[_0x561f('0x25')](handleEntityNotFound(_0xb5e67c,null))[_0x561f('0x25')](saveUpdates(_0x279a4e[_0x561f('0x4a')],null))[_0x561f('0x25')](respondWithResult(_0xb5e67c,null))[_0x561f('0x44')](handleError(_0xb5e67c,null));};exports[_0x561f('0x4c')]=function(_0x291871,_0x56d920){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x291871[_0x561f('0x4b')]['id']}})[_0x561f('0x25')](handleEntityNotFound(_0x56d920,null))[_0x561f('0x25')](removeEntity(_0x56d920,null))[_0x561f('0x44')](handleError(_0x56d920,null));};exports['describe']=function(_0x540d7c,_0x369855){return db['OpenchannelQueueReport']['describe']()[_0x561f('0x25')](respondWithResult(_0x369855,null))[_0x561f('0x44')](handleError(_0x369855,null));}; \ No newline at end of file +var _0xe706=['limit','count','set','reject','update','then','error','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','find','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x366ce0,_0x4c3fad){var _0x5ae1c0=function(_0x6a4ad6){while(--_0x6a4ad6){_0x366ce0['push'](_0x366ce0['shift']());}};_0x5ae1c0(++_0x4c3fad);}(_0xe706,0x1a3));var _0x6e70=function(_0x2831cf,_0x24babf){_0x2831cf=_0x2831cf-0x0;var _0x5ec206=_0xe706[_0x2831cf];return _0x5ec206;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e70('0x1'));var jsonpatch=require(_0x6e70('0x2'));var rp=require('request-promise');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var Mustache=require('mustache');var util=require(_0x6e70('0x5'));var path=require(_0x6e70('0x6'));var sox=require(_0x6e70('0x7'));var csv=require(_0x6e70('0x8'));var ejs=require(_0x6e70('0x9'));var fs=require('fs');var fs_extra=require(_0x6e70('0xa'));var _=require('lodash');var squel=require(_0x6e70('0xb'));var crypto=require(_0x6e70('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6e70('0xd'));var toCsv=require(_0x6e70('0x8'));var querystring=require(_0x6e70('0xe'));var Papa=require(_0x6e70('0xf'));var Redis=require(_0x6e70('0x10'));var authService=require(_0x6e70('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e70('0x12'));var logger=require(_0x6e70('0x13'))(_0x6e70('0x14'));var utils=require(_0x6e70('0x15'));var config=require(_0x6e70('0x16'));var licenseUtil=require(_0x6e70('0x17'));var db=require(_0x6e70('0x18'))['db'];function respondWithStatusCode(_0x5ebe67,_0x41c51a){_0x41c51a=_0x41c51a||0xcc;return function(_0x448f21){if(_0x448f21){return _0x5ebe67[_0x6e70('0x19')](_0x41c51a);}return _0x5ebe67[_0x6e70('0x1a')](_0x41c51a)[_0x6e70('0x1b')]();};}function respondWithResult(_0x270b6b,_0x3bdfb9){_0x3bdfb9=_0x3bdfb9||0xc8;return function(_0x4641cd){if(_0x4641cd){return _0x270b6b[_0x6e70('0x1a')](_0x3bdfb9)[_0x6e70('0x1c')](_0x4641cd);}};}function respondWithFilteredResult(_0x23ee4e,_0x59794a){return function(_0x1e2c2e){if(_0x1e2c2e){var _0x30f770=typeof _0x59794a[_0x6e70('0x1d')]===_0x6e70('0x1e')&&typeof _0x59794a[_0x6e70('0x1f')]==='undefined';var _0x1c91ff=_0x1e2c2e[_0x6e70('0x20')];var _0x2c6b60=_0x30f770?0x0:_0x59794a['offset'];var _0x49c8ec=_0x30f770?_0x1e2c2e[_0x6e70('0x20')]:_0x59794a[_0x6e70('0x1d')]+_0x59794a['limit'];var _0x3b1ac7;if(_0x49c8ec>=_0x1c91ff){_0x49c8ec=_0x1c91ff;_0x3b1ac7=0xc8;}else{_0x3b1ac7=0xce;}_0x23ee4e[_0x6e70('0x1a')](_0x3b1ac7);return _0x23ee4e[_0x6e70('0x21')]('Content-Range',_0x2c6b60+'-'+_0x49c8ec+'/'+_0x1c91ff)[_0x6e70('0x1c')](_0x1e2c2e);}return null;};}function patchUpdates(_0x3b1afe){return function(_0x555b19){try{jsonpatch['apply'](_0x555b19,_0x3b1afe,!![]);}catch(_0x39866a){return BPromise[_0x6e70('0x22')](_0x39866a);}return _0x555b19['save']();};}function saveUpdates(_0x3e3f1d,_0x27dfa7){return function(_0x4685d8){if(_0x4685d8){return _0x4685d8[_0x6e70('0x23')](_0x3e3f1d)[_0x6e70('0x24')](function(_0x5b5b2f){return _0x5b5b2f;});}return null;};}function removeEntity(_0x18c913,_0x649d65){return function(_0x569955){if(_0x569955){return _0x569955['destroy']()[_0x6e70('0x24')](function(){_0x18c913[_0x6e70('0x1a')](0xcc)[_0x6e70('0x1b')]();});}};}function handleEntityNotFound(_0x12ca0,_0x3c30fe){return function(_0x1da867){if(!_0x1da867){_0x12ca0[_0x6e70('0x19')](0x194);}return _0x1da867;};}function handleError(_0x35e776,_0x14bdb4){_0x14bdb4=_0x14bdb4||0x1f4;return function(_0x450c3c){logger[_0x6e70('0x25')](_0x450c3c['stack']);if(_0x450c3c[_0x6e70('0x26')]){delete _0x450c3c[_0x6e70('0x26')];}_0x35e776[_0x6e70('0x1a')](_0x14bdb4)[_0x6e70('0x27')](_0x450c3c);};}exports[_0x6e70('0x28')]=function(_0x1d8a1c,_0x568e10){var _0x1a7c23={},_0x2de9bb={},_0x4e227e={'count':0x0,'rows':[]};var _0x6c102d=_[_0x6e70('0x29')](db[_0x6e70('0x2a')][_0x6e70('0x2b')],function(_0x413c2d){return{'name':_0x413c2d[_0x6e70('0x2c')],'type':_0x413c2d[_0x6e70('0x2d')][_0x6e70('0x2e')]};});_0x2de9bb[_0x6e70('0x2f')]=_[_0x6e70('0x29')](_0x6c102d,'name');_0x2de9bb[_0x6e70('0x30')]=_[_0x6e70('0x31')](_0x1d8a1c['query']);_0x2de9bb[_0x6e70('0x32')]=_[_0x6e70('0x33')](_0x2de9bb[_0x6e70('0x2f')],_0x2de9bb[_0x6e70('0x30')]);_0x1a7c23[_0x6e70('0x34')]=_[_0x6e70('0x33')](_0x2de9bb[_0x6e70('0x2f')],qs[_0x6e70('0x35')](_0x1d8a1c[_0x6e70('0x30')]['fields']));_0x1a7c23[_0x6e70('0x34')]=_0x1a7c23[_0x6e70('0x34')][_0x6e70('0x36')]?_0x1a7c23[_0x6e70('0x34')]:_0x2de9bb[_0x6e70('0x2f')];if(!_0x1d8a1c[_0x6e70('0x30')][_0x6e70('0x37')](_0x6e70('0x38'))){_0x1a7c23[_0x6e70('0x1f')]=qs[_0x6e70('0x1f')](_0x1d8a1c[_0x6e70('0x30')]['limit']);_0x1a7c23['offset']=qs[_0x6e70('0x1d')](_0x1d8a1c[_0x6e70('0x30')]['offset']);}_0x1a7c23[_0x6e70('0x39')]=qs[_0x6e70('0x3a')](_0x1d8a1c[_0x6e70('0x30')]['sort']);_0x1a7c23[_0x6e70('0x3b')]=qs['filters'](_[_0x6e70('0x3c')](_0x1d8a1c['query'],_0x2de9bb[_0x6e70('0x32')]),_0x6c102d);if(_0x1d8a1c['query'][_0x6e70('0x3d')]){_0x1a7c23[_0x6e70('0x3b')]=_['merge'](_0x1a7c23['where'],{'$or':_['map'](_0x6c102d,function(_0x3e6e74){if(_0x3e6e74[_0x6e70('0x2d')]!==_0x6e70('0x3e')){var _0x4f658c={};_0x4f658c[_0x3e6e74['name']]={'$like':'%'+_0x1d8a1c[_0x6e70('0x30')][_0x6e70('0x3d')]+'%'};return _0x4f658c;}})});}_0x1a7c23=_[_0x6e70('0x3f')]({},_0x1a7c23,_0x1d8a1c[_0x6e70('0x40')]);var _0x3ad54d={'where':_0x1a7c23[_0x6e70('0x3b')]};return db[_0x6e70('0x2a')][_0x6e70('0x20')](_0x3ad54d)['then'](function(_0x55a9bb){_0x4e227e[_0x6e70('0x20')]=_0x55a9bb;if(_0x1d8a1c[_0x6e70('0x30')][_0x6e70('0x41')]){_0x1a7c23[_0x6e70('0x42')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x6e70('0x43')](_0x1a7c23);})[_0x6e70('0x24')](function(_0x531247){_0x4e227e['rows']=_0x531247;return _0x4e227e;})[_0x6e70('0x24')](respondWithFilteredResult(_0x568e10,_0x1a7c23))[_0x6e70('0x44')](handleError(_0x568e10,null));};exports['show']=function(_0x16f389,_0x293110){var _0x4a534b={'raw':!![],'where':{'id':_0x16f389['params']['id']}},_0x267fdd={};_0x267fdd[_0x6e70('0x2f')]=_[_0x6e70('0x31')](db[_0x6e70('0x2a')]['rawAttributes']);_0x267fdd['query']=_['keys'](_0x16f389[_0x6e70('0x30')]);_0x267fdd['filters']=_['intersection'](_0x267fdd['model'],_0x267fdd[_0x6e70('0x30')]);_0x4a534b['attributes']=_[_0x6e70('0x33')](_0x267fdd[_0x6e70('0x2f')],qs[_0x6e70('0x35')](_0x16f389['query'][_0x6e70('0x35')]));_0x4a534b['attributes']=_0x4a534b[_0x6e70('0x34')][_0x6e70('0x36')]?_0x4a534b[_0x6e70('0x34')]:_0x267fdd[_0x6e70('0x2f')];if(_0x16f389['query'][_0x6e70('0x41')]){_0x4a534b[_0x6e70('0x42')]=[{'all':!![]}];}_0x4a534b=_[_0x6e70('0x3f')]({},_0x4a534b,_0x16f389[_0x6e70('0x40')]);return db[_0x6e70('0x2a')][_0x6e70('0x45')](_0x4a534b)[_0x6e70('0x24')](handleEntityNotFound(_0x293110,null))[_0x6e70('0x24')](respondWithResult(_0x293110,null))[_0x6e70('0x44')](handleError(_0x293110,null));};exports['create']=function(_0x3acd1e,_0x12e0e7){return db['OpenchannelQueueReport'][_0x6e70('0x46')](_0x3acd1e[_0x6e70('0x47')],{})[_0x6e70('0x24')](respondWithResult(_0x12e0e7,0xc9))[_0x6e70('0x44')](handleError(_0x12e0e7,null));};exports[_0x6e70('0x23')]=function(_0x2a6b82,_0x10f6c1){if(_0x2a6b82[_0x6e70('0x47')]['id']){delete _0x2a6b82[_0x6e70('0x47')]['id'];}return db[_0x6e70('0x2a')][_0x6e70('0x45')]({'where':{'id':_0x2a6b82[_0x6e70('0x48')]['id']}})['then'](handleEntityNotFound(_0x10f6c1,null))['then'](saveUpdates(_0x2a6b82['body'],null))[_0x6e70('0x24')](respondWithResult(_0x10f6c1,null))['catch'](handleError(_0x10f6c1,null));};exports[_0x6e70('0x49')]=function(_0x4f47a6,_0x28775b){return db[_0x6e70('0x2a')][_0x6e70('0x45')]({'where':{'id':_0x4f47a6[_0x6e70('0x48')]['id']}})['then'](handleEntityNotFound(_0x28775b,null))[_0x6e70('0x24')](removeEntity(_0x28775b,null))[_0x6e70('0x44')](handleError(_0x28775b,null));};exports['describe']=function(_0x3b3f36,_0x4ecef3){return db[_0x6e70('0x2a')][_0x6e70('0x4a')]()['then'](respondWithResult(_0x4ecef3,null))[_0x6e70('0x44')](handleError(_0x4ecef3,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 7e09c09..41bd241 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x814b,0x1a2));var _0xb814=function(_0x2b3478,_0x58afd7){_0x2b3478=_0x2b3478-0x0;var _0x1c106f=_0x814b[_0x2b3478];return _0x1c106f;};'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 +var _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0xdee10d,_0x57d73d){var _0x55c181=function(_0x198091){while(--_0x198091){_0xdee10d['push'](_0xdee10d['shift']());}};_0x55c181(++_0x57d73d);}(_0xe14b,0x93));var _0xbe14=function(_0x4b0437,_0x57dcf4){_0x4b0437=_0x4b0437-0x0;var _0x2d5505=_0xe14b[_0x4b0437];return _0x2d5505;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 8c937c1..3dc6396 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 _0xed3c=['then','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','options','raw'];(function(_0xd0b9ff,_0x26bc08){var _0x160dbf=function(_0x7d597e){while(--_0x7d597e){_0xd0b9ff['push'](_0xd0b9ff['shift']());}};_0x160dbf(++_0x26bc08);}(_0xed3c,0x1a6));var _0xced3=function(_0x5ed7af,_0x422676){_0x5ed7af=_0x5ed7af-0x0;var _0x29a495=_0xed3c[_0x5ed7af];return _0x29a495;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var moment=require(_0xced3('0x2'));var BPromise=require(_0xced3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xced3('0x4'));var db=require(_0xced3('0x5'))['db'];var utils=require(_0xced3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xced3('0x7'));var jayson=require(_0xced3('0x8'));var client=jayson[_0xced3('0x9')][_0xced3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4795cd,_0x510164,_0x5ca701){return new BPromise(function(_0x851bd3,_0x5f2f90){return client['request'](_0x4795cd,_0x5ca701)['then'](function(_0x19a727){logger[_0xced3('0xb')](_0xced3('0xc'),_0x510164,_0xced3('0xd'));logger[_0xced3('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x510164,_0xced3('0xd'),JSON[_0xced3('0xf')](_0x19a727));if(_0x19a727[_0xced3('0x10')]){if(_0x19a727['error'][_0xced3('0x11')]===0x1f4){logger[_0xced3('0x10')](_0xced3('0xc'),_0x510164,_0x19a727[_0xced3('0x10')][_0xced3('0x12')]);return _0x5f2f90(_0x19a727[_0xced3('0x10')][_0xced3('0x12')]);}logger['error'](_0xced3('0xc'),_0x510164,_0x19a727['error'][_0xced3('0x12')]);return _0x851bd3(_0x19a727[_0xced3('0x10')][_0xced3('0x12')]);}else{logger[_0xced3('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x510164,_0xced3('0xd'));_0x851bd3(_0x19a727[_0xced3('0x13')]['message']);}})[_0xced3('0x14')](function(_0x37e2d5){logger[_0xced3('0x10')](_0xced3('0xc'),_0x510164,_0x37e2d5);_0x5f2f90(_0x37e2d5);});});}exports['CreateOpenchannelQueueReport']=function(_0x4569af){var _0x4a3afe=this;return new Promise(function(_0x353580,_0x4480a6){return db[_0xced3('0x15')][_0xced3('0x16')](_0x4569af[_0xced3('0x17')],{'raw':_0x4569af[_0xced3('0x18')]?_0x4569af[_0xced3('0x18')][_0xced3('0x19')]===undefined?!![]:![]:!![]})[_0xced3('0x1a')](function(_0x17c011){logger[_0xced3('0xb')]('CreateOpenchannelQueueReport',_0x4569af);logger['debug']('CreateOpenchannelQueueReport',_0x4569af,JSON[_0xced3('0xf')](_0x17c011));_0x353580(_0x17c011);})[_0xced3('0x14')](function(_0x21e074){logger['error'](_0xced3('0x1b'),_0x21e074[_0xced3('0x12')],_0x4569af);_0x4480a6(_0x4a3afe['error'](0x1f4,_0x21e074['message']));});});};exports[_0xced3('0x1c')]=function(_0x101708){var _0x219fa8=this;return new Promise(function(_0x15c6c5,_0x50f7c1){return db[_0xced3('0x15')][_0xced3('0x1d')](_0x101708['body'],{'raw':_0x101708[_0xced3('0x18')]?_0x101708['options'][_0xced3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x101708[_0xced3('0x18')]?_0x101708[_0xced3('0x18')][_0xced3('0x1e')]||null:null,'attributes':_0x101708[_0xced3('0x18')]?_0x101708['options']['attributes']||null:null,'limit':_0x101708[_0xced3('0x18')]?_0x101708['options'][_0xced3('0x1f')]||null:null})[_0xced3('0x1a')](function(_0x4a8e85){logger[_0xced3('0xb')](_0xced3('0x1c'),_0x101708);logger[_0xced3('0xe')](_0xced3('0x1c'),_0x101708,JSON[_0xced3('0xf')](_0x4a8e85));_0x15c6c5(_0x4a8e85);})[_0xced3('0x14')](function(_0x895a32){logger[_0xced3('0x10')](_0xced3('0x1c'),_0x895a32['message'],_0x101708);_0x50f7c1(_0x219fa8[_0xced3('0x10')](0x1f4,_0x895a32[_0xced3('0x12')]));});});}; \ No newline at end of file +var _0x47c5=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x497bde,_0x3a3778){var _0x59b581=function(_0x22f4ab){while(--_0x22f4ab){_0x497bde['push'](_0x497bde['shift']());}};_0x59b581(++_0x3a3778);}(_0x47c5,0x165));var _0x547c=function(_0x36da00,_0x5b533b){_0x36da00=_0x36da00-0x0;var _0x4b72c5=_0x47c5[_0x36da00];return _0x4b72c5;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});}exports['CreateOpenchannelQueueReport']=function(_0x23fa9e){var _0x199e4f=this;return new Promise(function(_0xeb059e,_0x4a8901){return db[_0x547c('0x18')][_0x547c('0x19')](_0x23fa9e[_0x547c('0x1a')],{'raw':_0x23fa9e['options']?_0x23fa9e[_0x547c('0x1b')][_0x547c('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5453f9){logger[_0x547c('0xd')](_0x547c('0x1d'),_0x23fa9e);logger['debug'](_0x547c('0x1d'),_0x23fa9e,JSON[_0x547c('0x12')](_0x5453f9));_0xeb059e(_0x5453f9);})['catch'](function(_0x2e317a){logger[_0x547c('0x13')](_0x547c('0x1d'),_0x2e317a['message'],_0x23fa9e);_0x4a8901(_0x199e4f[_0x547c('0x13')](0x1f4,_0x2e317a[_0x547c('0x15')]));});});};exports[_0x547c('0x1e')]=function(_0x26823c){var _0x1f3581=this;return new Promise(function(_0x2663bc,_0x2ab2cc){return db[_0x547c('0x18')]['update'](_0x26823c[_0x547c('0x1a')],{'raw':_0x26823c['options']?_0x26823c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26823c['options']?_0x26823c[_0x547c('0x1b')]['where']||null:null,'attributes':_0x26823c[_0x547c('0x1b')]?_0x26823c['options'][_0x547c('0x1f')]||null:null,'limit':_0x26823c['options']?_0x26823c[_0x547c('0x1b')][_0x547c('0x20')]||null:null})[_0x547c('0xc')](function(_0x30a96c){logger[_0x547c('0xd')]('UpdateOpenchannelQueueReport',_0x26823c);logger['debug'](_0x547c('0x1e'),_0x26823c,JSON['stringify'](_0x30a96c));_0x2663bc(_0x30a96c);})[_0x547c('0x17')](function(_0xed2d39){logger[_0x547c('0x13')](_0x547c('0x1e'),_0xed2d39[_0x547c('0x15')],_0x26823c);_0x2ab2cc(_0x1f3581[_0x547c('0x13')](0x1f4,_0xed2d39[_0x547c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 774de22..38f8c25 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 _0xd3de=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3de,0xac));var _0xed3d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3de[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xed3d('0x0'));var util=require(_0xed3d('0x1'));var path=require(_0xed3d('0x2'));var timeout=require(_0xed3d('0x3'));var express=require(_0xed3d('0x4'));var router=express['Router']();var fs_extra=require(_0xed3d('0x5'));var auth=require(_0xed3d('0x6'));var interaction=require(_0xed3d('0x7'));var config=require(_0xed3d('0x8'));var controller=require(_0xed3d('0x9'));router[_0xed3d('0xa')]('/',auth[_0xed3d('0xb')](),controller[_0xed3d('0xc')]);router['get'](_0xed3d('0xd'),auth[_0xed3d('0xb')](),controller['describe']);router[_0xed3d('0xa')]('/:id',auth[_0xed3d('0xb')](),controller[_0xed3d('0xe')]);router[_0xed3d('0xf')]('/',auth['isAuthenticated'](),controller[_0xed3d('0x10')]);router[_0xed3d('0x11')](_0xed3d('0x12'),auth[_0xed3d('0xb')](),controller[_0xed3d('0x13')]);router['delete']('/:id',auth[_0xed3d('0xb')](),controller[_0xed3d('0x14')]);module[_0xed3d('0x15')]=router; \ No newline at end of file +var _0xdb66=['put','update','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id','post','create'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xdb66,0xe8));var _0x6db6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xdb66[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x6db6('0x0'));var util=require('util');var path=require(_0x6db6('0x1'));var timeout=require('connect-timeout');var express=require(_0x6db6('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6db6('0x3'));var interaction=require(_0x6db6('0x4'));var config=require(_0x6db6('0x5'));var controller=require(_0x6db6('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x6db6('0x7')]);router[_0x6db6('0x8')](_0x6db6('0x9'),auth[_0x6db6('0xa')](),controller[_0x6db6('0xb')]);router[_0x6db6('0x8')](_0x6db6('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6db6('0xd')]('/',auth[_0x6db6('0xa')](),controller[_0x6db6('0xe')]);router[_0x6db6('0xf')](_0x6db6('0xc'),auth[_0x6db6('0xa')](),controller[_0x6db6('0x10')]);router['delete'](_0x6db6('0xc'),auth[_0x6db6('0xa')](),controller[_0x6db6('0x11')]);module[_0x6db6('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 02b7f2c..27731e1 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0xa0e21f,_0x34add3){var _0x192cfe=function(_0x52c40a){while(--_0x52c40a){_0xa0e21f['push'](_0xa0e21f['shift']());}};_0x192cfe(++_0x34add3);}(_0x70e0,0x17b));var _0x070e=function(_0x6a1b28,_0x11a9f3){_0x6a1b28=_0x6a1b28-0x0;var _0x1f7247=_0x70e0[_0x6a1b28];return _0x1f7247;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x73b767,_0x43b382){var _0x4953c1=function(_0x1cb815){while(--_0x1cb815){_0x73b767['push'](_0x73b767['shift']());}};_0x4953c1(++_0x43b382);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x00bb[_0x4fc9e6];return _0x551d28;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 8f94377..ee0220b 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 _0x2c82=['end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','then','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','fields','attributes','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','OpenchannelTransferReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5c6a66,_0x539212){var _0x4fe981=function(_0x4392ed){while(--_0x4392ed){_0x5c6a66['push'](_0x5c6a66['shift']());}};_0x4fe981(++_0x539212);}(_0x2c82,0x1b4));var _0x22c8=function(_0x4d3187,_0x267c51){_0x4d3187=_0x4d3187-0x0;var _0x107906=_0x2c82[_0x4d3187];return _0x107906;};'use strict';var emlformat=require(_0x22c8('0x0'));var rimraf=require(_0x22c8('0x1'));var zipdir=require(_0x22c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x22c8('0x3'));var moment=require(_0x22c8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x22c8('0x5'));var util=require(_0x22c8('0x6'));var path=require(_0x22c8('0x7'));var sox=require('sox');var csv=require(_0x22c8('0x8'));var ejs=require(_0x22c8('0x9'));var fs=require('fs');var fs_extra=require(_0x22c8('0xa'));var _=require(_0x22c8('0xb'));var squel=require('squel');var crypto=require(_0x22c8('0xc'));var jsforce=require(_0x22c8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x22c8('0x8'));var querystring=require(_0x22c8('0xe'));var Papa=require('papaparse');var Redis=require(_0x22c8('0xf'));var authService=require(_0x22c8('0x10'));var qs=require(_0x22c8('0x11'));var as=require(_0x22c8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x22c8('0x13'))(_0x22c8('0x14'));var utils=require(_0x22c8('0x15'));var config=require(_0x22c8('0x16'));var licenseUtil=require(_0x22c8('0x17'));var db=require(_0x22c8('0x18'))['db'];function respondWithStatusCode(_0x18a779,_0x6632fc){_0x6632fc=_0x6632fc||0xcc;return function(_0x4e678a){if(_0x4e678a){return _0x18a779[_0x22c8('0x19')](_0x6632fc);}return _0x18a779['status'](_0x6632fc)[_0x22c8('0x1a')]();};}function respondWithResult(_0x2b2170,_0x56c11e){_0x56c11e=_0x56c11e||0xc8;return function(_0x13c12a){if(_0x13c12a){return _0x2b2170['status'](_0x56c11e)[_0x22c8('0x1b')](_0x13c12a);}};}function respondWithFilteredResult(_0x54e959,_0x50a6bf){return function(_0x25fac0){if(_0x25fac0){var _0x29090a=typeof _0x50a6bf[_0x22c8('0x1c')]===_0x22c8('0x1d')&&typeof _0x50a6bf[_0x22c8('0x1e')]==='undefined';var _0x29d4fd=_0x25fac0[_0x22c8('0x1f')];var _0x3eb56d=_0x29090a?0x0:_0x50a6bf[_0x22c8('0x1c')];var _0x1b239d=_0x29090a?_0x25fac0[_0x22c8('0x1f')]:_0x50a6bf['offset']+_0x50a6bf['limit'];var _0x2b2137;if(_0x1b239d>=_0x29d4fd){_0x1b239d=_0x29d4fd;_0x2b2137=0xc8;}else{_0x2b2137=0xce;}_0x54e959[_0x22c8('0x20')](_0x2b2137);return _0x54e959['set'](_0x22c8('0x21'),_0x3eb56d+'-'+_0x1b239d+'/'+_0x29d4fd)[_0x22c8('0x1b')](_0x25fac0);}return null;};}function patchUpdates(_0x3d9766){return function(_0x5f57af){try{jsonpatch[_0x22c8('0x22')](_0x5f57af,_0x3d9766,!![]);}catch(_0x34e7c8){return BPromise[_0x22c8('0x23')](_0x34e7c8);}return _0x5f57af[_0x22c8('0x24')]();};}function saveUpdates(_0x5de1fe,_0x254587){return function(_0x41ad4d){if(_0x41ad4d){return _0x41ad4d['update'](_0x5de1fe)['then'](function(_0x352f93){return _0x352f93;});}return null;};}function removeEntity(_0x85ed93,_0x4e8993){return function(_0x4cb3da){if(_0x4cb3da){return _0x4cb3da['destroy']()[_0x22c8('0x25')](function(){_0x85ed93[_0x22c8('0x20')](0xcc)[_0x22c8('0x1a')]();});}};}function handleEntityNotFound(_0x180afa,_0x5b2972){return function(_0x253e7b){if(!_0x253e7b){_0x180afa[_0x22c8('0x19')](0x194);}return _0x253e7b;};}function handleError(_0x5de1ab,_0x1c6ba9){_0x1c6ba9=_0x1c6ba9||0x1f4;return function(_0x1f49f3){logger['error'](_0x1f49f3[_0x22c8('0x26')]);if(_0x1f49f3[_0x22c8('0x27')]){delete _0x1f49f3[_0x22c8('0x27')];}_0x5de1ab[_0x22c8('0x20')](_0x1c6ba9)[_0x22c8('0x28')](_0x1f49f3);};}exports[_0x22c8('0x29')]=function(_0x590460,_0x3ef5ed){var _0x162a54={},_0x27f130={},_0x5b76c7={'count':0x0,'rows':[]};var _0x40b417=_['map'](db['OpenchannelTransferReport'][_0x22c8('0x2a')],function(_0xf974b9){return{'name':_0xf974b9[_0x22c8('0x2b')],'type':_0xf974b9[_0x22c8('0x2c')][_0x22c8('0x2d')]};});_0x27f130[_0x22c8('0x2e')]=_[_0x22c8('0x2f')](_0x40b417,_0x22c8('0x27'));_0x27f130['query']=_[_0x22c8('0x30')](_0x590460['query']);_0x27f130[_0x22c8('0x31')]=_[_0x22c8('0x32')](_0x27f130[_0x22c8('0x2e')],_0x27f130[_0x22c8('0x33')]);_0x162a54['attributes']=_[_0x22c8('0x32')](_0x27f130['model'],qs['fields'](_0x590460[_0x22c8('0x33')][_0x22c8('0x34')]));_0x162a54[_0x22c8('0x35')]=_0x162a54[_0x22c8('0x35')][_0x22c8('0x36')]?_0x162a54[_0x22c8('0x35')]:_0x27f130[_0x22c8('0x2e')];if(!_0x590460[_0x22c8('0x33')]['hasOwnProperty'](_0x22c8('0x37'))){_0x162a54[_0x22c8('0x1e')]=qs['limit'](_0x590460['query'][_0x22c8('0x1e')]);_0x162a54['offset']=qs['offset'](_0x590460[_0x22c8('0x33')][_0x22c8('0x1c')]);}_0x162a54[_0x22c8('0x38')]=qs[_0x22c8('0x39')](_0x590460[_0x22c8('0x33')][_0x22c8('0x39')]);_0x162a54['where']=qs['filters'](_['pick'](_0x590460[_0x22c8('0x33')],_0x27f130[_0x22c8('0x31')]),_0x40b417);if(_0x590460[_0x22c8('0x33')][_0x22c8('0x3a')]){_0x162a54[_0x22c8('0x3b')]=_[_0x22c8('0x3c')](_0x162a54['where'],{'$or':_[_0x22c8('0x2f')](_0x40b417,function(_0x1537c3){if(_0x1537c3[_0x22c8('0x2c')]!==_0x22c8('0x3d')){var _0x233e6f={};_0x233e6f[_0x1537c3[_0x22c8('0x27')]]={'$like':'%'+_0x590460[_0x22c8('0x33')][_0x22c8('0x3a')]+'%'};return _0x233e6f;}})});}_0x162a54=_['merge']({},_0x162a54,_0x590460[_0x22c8('0x3e')]);var _0x59839d={'where':_0x162a54[_0x22c8('0x3b')]};return db[_0x22c8('0x3f')][_0x22c8('0x1f')](_0x59839d)['then'](function(_0x47cf79){_0x5b76c7[_0x22c8('0x1f')]=_0x47cf79;if(_0x590460[_0x22c8('0x33')][_0x22c8('0x40')]){_0x162a54[_0x22c8('0x41')]=[{'all':!![]}];}return db[_0x22c8('0x3f')][_0x22c8('0x42')](_0x162a54);})['then'](function(_0x1baaab){_0x5b76c7[_0x22c8('0x43')]=_0x1baaab;return _0x5b76c7;})[_0x22c8('0x25')](respondWithFilteredResult(_0x3ef5ed,_0x162a54))[_0x22c8('0x44')](handleError(_0x3ef5ed,null));};exports[_0x22c8('0x45')]=function(_0x5650bd,_0x5cbc5a){var _0x170c0c={'raw':!![],'where':{'id':_0x5650bd[_0x22c8('0x46')]['id']}},_0x34f334={};_0x34f334[_0x22c8('0x2e')]=_[_0x22c8('0x30')](db[_0x22c8('0x3f')]['rawAttributes']);_0x34f334[_0x22c8('0x33')]=_[_0x22c8('0x30')](_0x5650bd[_0x22c8('0x33')]);_0x34f334['filters']=_[_0x22c8('0x32')](_0x34f334[_0x22c8('0x2e')],_0x34f334[_0x22c8('0x33')]);_0x170c0c['attributes']=_['intersection'](_0x34f334[_0x22c8('0x2e')],qs['fields'](_0x5650bd[_0x22c8('0x33')][_0x22c8('0x34')]));_0x170c0c[_0x22c8('0x35')]=_0x170c0c[_0x22c8('0x35')][_0x22c8('0x36')]?_0x170c0c[_0x22c8('0x35')]:_0x34f334[_0x22c8('0x2e')];if(_0x5650bd[_0x22c8('0x33')][_0x22c8('0x40')]){_0x170c0c[_0x22c8('0x41')]=[{'all':!![]}];}_0x170c0c=_['merge']({},_0x170c0c,_0x5650bd[_0x22c8('0x3e')]);return db[_0x22c8('0x3f')][_0x22c8('0x47')](_0x170c0c)[_0x22c8('0x25')](handleEntityNotFound(_0x5cbc5a,null))[_0x22c8('0x25')](respondWithResult(_0x5cbc5a,null))[_0x22c8('0x44')](handleError(_0x5cbc5a,null));};exports['create']=function(_0x10e753,_0x5e3691){return db[_0x22c8('0x3f')][_0x22c8('0x48')](_0x10e753[_0x22c8('0x49')],{})[_0x22c8('0x25')](respondWithResult(_0x5e3691,0xc9))['catch'](handleError(_0x5e3691,null));};exports[_0x22c8('0x4a')]=function(_0x1c793c,_0x4df6a1){if(_0x1c793c[_0x22c8('0x49')]['id']){delete _0x1c793c[_0x22c8('0x49')]['id'];}return db[_0x22c8('0x3f')][_0x22c8('0x47')]({'where':{'id':_0x1c793c['params']['id']}})['then'](handleEntityNotFound(_0x4df6a1,null))['then'](saveUpdates(_0x1c793c['body'],null))[_0x22c8('0x25')](respondWithResult(_0x4df6a1,null))[_0x22c8('0x44')](handleError(_0x4df6a1,null));};exports[_0x22c8('0x4b')]=function(_0x280b5b,_0x1edc57){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x280b5b[_0x22c8('0x46')]['id']}})[_0x22c8('0x25')](handleEntityNotFound(_0x1edc57,null))[_0x22c8('0x25')](removeEntity(_0x1edc57,null))[_0x22c8('0x44')](handleError(_0x1edc57,null));};exports['describe']=function(_0x44855d,_0x187533){return db[_0x22c8('0x3f')][_0x22c8('0x4c')]()['then'](respondWithResult(_0x187533,null))['catch'](handleError(_0x187533,null));}; \ No newline at end of file +var _0x0ff0=['send','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','order','sort','where','VIRTUAL','filter','options','findAll','rows','show','params','include','merge','create','body','catch','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','stack','name'];(function(_0x3a7b71,_0x135bad){var _0x2fdef7=function(_0x365c64){while(--_0x365c64){_0x3a7b71['push'](_0x3a7b71['shift']());}};_0x2fdef7(++_0x135bad);}(_0x0ff0,0x140));var _0x00ff=function(_0x427793,_0x2b2019){_0x427793=_0x427793-0x0;var _0x3dd19a=_0x0ff0[_0x427793];return _0x3dd19a;};'use strict';var emlformat=require(_0x00ff('0x0'));var rimraf=require(_0x00ff('0x1'));var zipdir=require(_0x00ff('0x2'));var jsonpatch=require(_0x00ff('0x3'));var rp=require(_0x00ff('0x4'));var moment=require(_0x00ff('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x00ff('0x6'));var util=require('util');var path=require('path');var sox=require(_0x00ff('0x7'));var csv=require(_0x00ff('0x8'));var ejs=require(_0x00ff('0x9'));var fs=require('fs');var fs_extra=require(_0x00ff('0xa'));var _=require('lodash');var squel=require(_0x00ff('0xb'));var crypto=require(_0x00ff('0xc'));var jsforce=require(_0x00ff('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x00ff('0xe'));var authService=require(_0x00ff('0xf'));var qs=require(_0x00ff('0x10'));var as=require(_0x00ff('0x11'));var hardwareService=require(_0x00ff('0x12'));var logger=require('../../config/logger')(_0x00ff('0x13'));var utils=require(_0x00ff('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x00ff('0x15'));var db=require(_0x00ff('0x16'))['db'];function respondWithStatusCode(_0xd6ee3e,_0x2cdafb){_0x2cdafb=_0x2cdafb||0xcc;return function(_0xe893d5){if(_0xe893d5){return _0xd6ee3e['sendStatus'](_0x2cdafb);}return _0xd6ee3e[_0x00ff('0x17')](_0x2cdafb)[_0x00ff('0x18')]();};}function respondWithResult(_0x29f354,_0x23e51d){_0x23e51d=_0x23e51d||0xc8;return function(_0x65b707){if(_0x65b707){return _0x29f354[_0x00ff('0x17')](_0x23e51d)['json'](_0x65b707);}};}function respondWithFilteredResult(_0x3dfa25,_0x5cd681){return function(_0x1b1ac4){if(_0x1b1ac4){var _0x5b27a8=typeof _0x5cd681['offset']===_0x00ff('0x19')&&typeof _0x5cd681[_0x00ff('0x1a')]==='undefined';var _0x3105e2=_0x1b1ac4['count'];var _0x57f2a5=_0x5b27a8?0x0:_0x5cd681[_0x00ff('0x1b')];var _0x2efce9=_0x5b27a8?_0x1b1ac4[_0x00ff('0x1c')]:_0x5cd681[_0x00ff('0x1b')]+_0x5cd681['limit'];var _0x5abba4;if(_0x2efce9>=_0x3105e2){_0x2efce9=_0x3105e2;_0x5abba4=0xc8;}else{_0x5abba4=0xce;}_0x3dfa25[_0x00ff('0x17')](_0x5abba4);return _0x3dfa25['set'](_0x00ff('0x1d'),_0x57f2a5+'-'+_0x2efce9+'/'+_0x3105e2)[_0x00ff('0x1e')](_0x1b1ac4);}return null;};}function patchUpdates(_0x3b3c8b){return function(_0x4ed6f0){try{jsonpatch[_0x00ff('0x1f')](_0x4ed6f0,_0x3b3c8b,!![]);}catch(_0x3409b3){return BPromise[_0x00ff('0x20')](_0x3409b3);}return _0x4ed6f0[_0x00ff('0x21')]();};}function saveUpdates(_0x37b778,_0x16f5e7){return function(_0x183a40){if(_0x183a40){return _0x183a40[_0x00ff('0x22')](_0x37b778)['then'](function(_0x21a1fb){return _0x21a1fb;});}return null;};}function removeEntity(_0xcfcb37,_0x46214b){return function(_0x12df12){if(_0x12df12){return _0x12df12[_0x00ff('0x23')]()[_0x00ff('0x24')](function(){_0xcfcb37[_0x00ff('0x17')](0xcc)[_0x00ff('0x18')]();});}};}function handleEntityNotFound(_0x54740d,_0x11e552){return function(_0x36caa2){if(!_0x36caa2){_0x54740d[_0x00ff('0x25')](0x194);}return _0x36caa2;};}function handleError(_0x2c859e,_0x30665b){_0x30665b=_0x30665b||0x1f4;return function(_0x52bc19){logger['error'](_0x52bc19[_0x00ff('0x26')]);if(_0x52bc19[_0x00ff('0x27')]){delete _0x52bc19[_0x00ff('0x27')];}_0x2c859e[_0x00ff('0x17')](_0x30665b)[_0x00ff('0x28')](_0x52bc19);};}exports['index']=function(_0x1797b4,_0x3facb0){var _0x118e84={},_0x2683a7={},_0x184c9a={'count':0x0,'rows':[]};var _0x322634=_['map'](db[_0x00ff('0x29')][_0x00ff('0x2a')],function(_0x5465f8){return{'name':_0x5465f8[_0x00ff('0x2b')],'type':_0x5465f8[_0x00ff('0x2c')][_0x00ff('0x2d')]};});_0x2683a7[_0x00ff('0x2e')]=_[_0x00ff('0x2f')](_0x322634,_0x00ff('0x27'));_0x2683a7[_0x00ff('0x30')]=_[_0x00ff('0x31')](_0x1797b4[_0x00ff('0x30')]);_0x2683a7[_0x00ff('0x32')]=_['intersection'](_0x2683a7['model'],_0x2683a7['query']);_0x118e84[_0x00ff('0x33')]=_[_0x00ff('0x34')](_0x2683a7['model'],qs[_0x00ff('0x35')](_0x1797b4[_0x00ff('0x30')]['fields']));_0x118e84['attributes']=_0x118e84[_0x00ff('0x33')][_0x00ff('0x36')]?_0x118e84[_0x00ff('0x33')]:_0x2683a7[_0x00ff('0x2e')];if(!_0x1797b4[_0x00ff('0x30')]['hasOwnProperty']('nolimit')){_0x118e84[_0x00ff('0x1a')]=qs[_0x00ff('0x1a')](_0x1797b4[_0x00ff('0x30')][_0x00ff('0x1a')]);_0x118e84[_0x00ff('0x1b')]=qs['offset'](_0x1797b4[_0x00ff('0x30')][_0x00ff('0x1b')]);}_0x118e84[_0x00ff('0x37')]=qs[_0x00ff('0x38')](_0x1797b4[_0x00ff('0x30')][_0x00ff('0x38')]);_0x118e84[_0x00ff('0x39')]=qs[_0x00ff('0x32')](_['pick'](_0x1797b4[_0x00ff('0x30')],_0x2683a7['filters']),_0x322634);if(_0x1797b4[_0x00ff('0x30')]['filter']){_0x118e84[_0x00ff('0x39')]=_['merge'](_0x118e84[_0x00ff('0x39')],{'$or':_[_0x00ff('0x2f')](_0x322634,function(_0x2c8663){if(_0x2c8663['type']!==_0x00ff('0x3a')){var _0x4b64b4={};_0x4b64b4[_0x2c8663[_0x00ff('0x27')]]={'$like':'%'+_0x1797b4[_0x00ff('0x30')][_0x00ff('0x3b')]+'%'};return _0x4b64b4;}})});}_0x118e84=_['merge']({},_0x118e84,_0x1797b4[_0x00ff('0x3c')]);var _0x54cd0c={'where':_0x118e84[_0x00ff('0x39')]};return db[_0x00ff('0x29')][_0x00ff('0x1c')](_0x54cd0c)[_0x00ff('0x24')](function(_0x3fa4e3){_0x184c9a[_0x00ff('0x1c')]=_0x3fa4e3;if(_0x1797b4['query']['includeAll']){_0x118e84['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x00ff('0x3d')](_0x118e84);})[_0x00ff('0x24')](function(_0x398075){_0x184c9a[_0x00ff('0x3e')]=_0x398075;return _0x184c9a;})['then'](respondWithFilteredResult(_0x3facb0,_0x118e84))['catch'](handleError(_0x3facb0,null));};exports[_0x00ff('0x3f')]=function(_0x2dd440,_0x1dbb0c){var _0x127b0b={'raw':!![],'where':{'id':_0x2dd440[_0x00ff('0x40')]['id']}},_0x4b43cc={};_0x4b43cc[_0x00ff('0x2e')]=_[_0x00ff('0x31')](db[_0x00ff('0x29')][_0x00ff('0x2a')]);_0x4b43cc[_0x00ff('0x30')]=_[_0x00ff('0x31')](_0x2dd440[_0x00ff('0x30')]);_0x4b43cc[_0x00ff('0x32')]=_[_0x00ff('0x34')](_0x4b43cc['model'],_0x4b43cc[_0x00ff('0x30')]);_0x127b0b[_0x00ff('0x33')]=_[_0x00ff('0x34')](_0x4b43cc[_0x00ff('0x2e')],qs[_0x00ff('0x35')](_0x2dd440[_0x00ff('0x30')][_0x00ff('0x35')]));_0x127b0b[_0x00ff('0x33')]=_0x127b0b['attributes'][_0x00ff('0x36')]?_0x127b0b[_0x00ff('0x33')]:_0x4b43cc[_0x00ff('0x2e')];if(_0x2dd440[_0x00ff('0x30')]['includeAll']){_0x127b0b[_0x00ff('0x41')]=[{'all':!![]}];}_0x127b0b=_[_0x00ff('0x42')]({},_0x127b0b,_0x2dd440[_0x00ff('0x3c')]);return db['OpenchannelTransferReport']['find'](_0x127b0b)[_0x00ff('0x24')](handleEntityNotFound(_0x1dbb0c,null))[_0x00ff('0x24')](respondWithResult(_0x1dbb0c,null))['catch'](handleError(_0x1dbb0c,null));};exports[_0x00ff('0x43')]=function(_0x2bce8e,_0xf2a18d){return db['OpenchannelTransferReport']['create'](_0x2bce8e[_0x00ff('0x44')],{})[_0x00ff('0x24')](respondWithResult(_0xf2a18d,0xc9))[_0x00ff('0x45')](handleError(_0xf2a18d,null));};exports[_0x00ff('0x22')]=function(_0x3e40df,_0x431c64){if(_0x3e40df[_0x00ff('0x44')]['id']){delete _0x3e40df[_0x00ff('0x44')]['id'];}return db[_0x00ff('0x29')]['find']({'where':{'id':_0x3e40df[_0x00ff('0x40')]['id']}})[_0x00ff('0x24')](handleEntityNotFound(_0x431c64,null))['then'](saveUpdates(_0x3e40df[_0x00ff('0x44')],null))[_0x00ff('0x24')](respondWithResult(_0x431c64,null))[_0x00ff('0x45')](handleError(_0x431c64,null));};exports[_0x00ff('0x23')]=function(_0x59743e,_0x5b9b95){return db[_0x00ff('0x29')][_0x00ff('0x46')]({'where':{'id':_0x59743e[_0x00ff('0x40')]['id']}})[_0x00ff('0x24')](handleEntityNotFound(_0x5b9b95,null))[_0x00ff('0x24')](removeEntity(_0x5b9b95,null))[_0x00ff('0x45')](handleError(_0x5b9b95,null));};exports[_0x00ff('0x47')]=function(_0x23e1ba,_0x2959e8){return db['OpenchannelTransferReport'][_0x00ff('0x47')]()[_0x00ff('0x24')](respondWithResult(_0x2959e8,null))[_0x00ff('0x45')](handleError(_0x2959e8,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index c1b1091..c02dd8a 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 _0x8137=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x2b5714,_0x45d508){var _0x274eac=function(_0x113091){while(--_0x113091){_0x2b5714['push'](_0x2b5714['shift']());}};_0x274eac(++_0x45d508);}(_0x8137,0x1aa));var _0x7813=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x8137[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0x7813('0x0'));var util=require(_0x7813('0x1'));var logger=require(_0x7813('0x2'))(_0x7813('0x3'));var moment=require(_0x7813('0x4'));var BPromise=require(_0x7813('0x5'));var rp=require(_0x7813('0x6'));var fs=require('fs');var path=require(_0x7813('0x7'));var rimraf=require(_0x7813('0x8'));var config=require(_0x7813('0x9'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x519b13,_0x5ca775){return _0x519b13['define'](_0x7813('0xa'),attributes,{'tableName':_0x7813('0xb'),'paranoid':![],'indexes':[{'name':_0x7813('0xc'),'fields':[_0x7813('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d48=['exports','define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x209e4c,_0x27199c){var _0x453986=function(_0x2bf57){while(--_0x2bf57){_0x209e4c['push'](_0x209e4c['shift']());}};_0x453986(++_0x27199c);}(_0x6d48,0x1d2));var _0x86d4=function(_0x36c230,_0x1c7cfd){_0x36c230=_0x36c230-0x0;var _0x321e0e=_0x6d48[_0x36c230];return _0x321e0e;};'use strict';var _=require(_0x86d4('0x0'));var util=require(_0x86d4('0x1'));var logger=require(_0x86d4('0x2'))(_0x86d4('0x3'));var moment=require('moment');var BPromise=require(_0x86d4('0x4'));var rp=require(_0x86d4('0x5'));var fs=require('fs');var path=require(_0x86d4('0x6'));var rimraf=require(_0x86d4('0x7'));var config=require(_0x86d4('0x8'));var attributes=require(_0x86d4('0x9'));module[_0x86d4('0xa')]=function(_0x168701,_0x562be7){return _0x168701[_0x86d4('0xb')]('OpenchannelTransferReport',attributes,{'tableName':_0x86d4('0xc'),'paranoid':![],'indexes':[{'name':_0x86d4('0xd'),'fields':[_0x86d4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index b9db4ea..01bb368 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 _0xdc59=['catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5ecb21,_0x4ea672){var _0x4c925d=function(_0x54a5f4){while(--_0x54a5f4){_0x5ecb21['push'](_0x5ecb21['shift']());}};_0x4c925d(++_0x4ea672);}(_0xdc59,0x12c));var _0x9dc5=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0xdc59[_0x46ae5a];return _0x434986;};'use strict';var _=require(_0x9dc5('0x0'));var util=require(_0x9dc5('0x1'));var moment=require(_0x9dc5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dc5('0x3'));var db=require(_0x9dc5('0x4'))['db'];var utils=require(_0x9dc5('0x5'));var logger=require(_0x9dc5('0x6'))(_0x9dc5('0x7'));var config=require(_0x9dc5('0x8'));var jayson=require(_0x9dc5('0x9'));var client=jayson[_0x9dc5('0xa')][_0x9dc5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48beee,_0x42941b,_0x10b268){return new BPromise(function(_0x202a8a,_0x3729b6){return client[_0x9dc5('0xc')](_0x48beee,_0x10b268)[_0x9dc5('0xd')](function(_0x174835){logger[_0x9dc5('0xe')](_0x9dc5('0xf'),_0x42941b,_0x9dc5('0x10'));logger['debug'](_0x9dc5('0x11'),_0x42941b,_0x9dc5('0x10'),JSON[_0x9dc5('0x12')](_0x174835));if(_0x174835[_0x9dc5('0x13')]){if(_0x174835['error'][_0x9dc5('0x14')]===0x1f4){logger[_0x9dc5('0x13')](_0x9dc5('0xf'),_0x42941b,_0x174835['error'][_0x9dc5('0x15')]);return _0x3729b6(_0x174835[_0x9dc5('0x13')][_0x9dc5('0x15')]);}logger[_0x9dc5('0x13')](_0x9dc5('0xf'),_0x42941b,_0x174835[_0x9dc5('0x13')][_0x9dc5('0x15')]);return _0x202a8a(_0x174835[_0x9dc5('0x13')][_0x9dc5('0x15')]);}else{logger[_0x9dc5('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x42941b,_0x9dc5('0x10'));_0x202a8a(_0x174835['result'][_0x9dc5('0x15')]);}})[_0x9dc5('0x16')](function(_0x5a9ffb){logger[_0x9dc5('0x13')](_0x9dc5('0xf'),_0x42941b,_0x5a9ffb);_0x3729b6(_0x5a9ffb);});});} \ No newline at end of file +var _0xf95f=['../../config/logger','../../config/environment','client','request','then','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x145c99,_0x3fdb01){var _0x52a05f=function(_0x36feb0){while(--_0x36feb0){_0x145c99['push'](_0x145c99['shift']());}};_0x52a05f(++_0x3fdb01);}(_0xf95f,0x142));var _0xff95=function(_0x49f30e,_0xf28439){_0x49f30e=_0x49f30e-0x0;var _0x2cafd5=_0xf95f[_0x49f30e];return _0x2cafd5;};'use strict';var _=require(_0xff95('0x0'));var util=require(_0xff95('0x1'));var moment=require(_0xff95('0x2'));var BPromise=require(_0xff95('0x3'));var rs=require(_0xff95('0x4'));var fs=require('fs');var Redis=require(_0xff95('0x5'));var db=require(_0xff95('0x6'))['db'];var utils=require(_0xff95('0x7'));var logger=require(_0xff95('0x8'))('rpc');var config=require(_0xff95('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xff95('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x314fb4,_0x781e05,_0x2b9ce9){return new BPromise(function(_0x1a42b2,_0x198a51){return client[_0xff95('0xb')](_0x314fb4,_0x2b9ce9)[_0xff95('0xc')](function(_0xa2a50d){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x781e05,_0xff95('0xd'));logger[_0xff95('0xe')](_0xff95('0xf'),_0x781e05,_0xff95('0xd'),JSON[_0xff95('0x10')](_0xa2a50d));if(_0xa2a50d[_0xff95('0x11')]){if(_0xa2a50d[_0xff95('0x11')]['code']===0x1f4){logger['error'](_0xff95('0x12'),_0x781e05,_0xa2a50d[_0xff95('0x11')]['message']);return _0x198a51(_0xa2a50d[_0xff95('0x11')]['message']);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x781e05,_0xa2a50d[_0xff95('0x11')][_0xff95('0x13')]);return _0x1a42b2(_0xa2a50d[_0xff95('0x11')][_0xff95('0x13')]);}else{logger[_0xff95('0x14')](_0xff95('0x12'),_0x781e05,'request\x20sent');_0x1a42b2(_0xa2a50d['result'][_0xff95('0x13')]);}})[_0xff95('0x15')](function(_0x83e644){logger[_0xff95('0x11')](_0xff95('0x12'),_0x781e05,_0x83e644);_0x198a51(_0x83e644);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 328e8f1..95f6522 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 _0xf150=['get','/:id','isAuthenticated','show','put','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x54ee75,_0x5aa2a5){var _0x190beb=function(_0x25441a){while(--_0x25441a){_0x54ee75['push'](_0x54ee75['shift']());}};_0x190beb(++_0x5aa2a5);}(_0xf150,0x106));var _0x0f15=function(_0x2940e9,_0x43b3b4){_0x2940e9=_0x2940e9-0x0;var _0x20ca59=_0xf150[_0x2940e9];return _0x20ca59;};'use strict';var multer=require(_0x0f15('0x0'));var util=require(_0x0f15('0x1'));var path=require(_0x0f15('0x2'));var timeout=require('connect-timeout');var express=require(_0x0f15('0x3'));var router=express[_0x0f15('0x4')]();var fs_extra=require(_0x0f15('0x5'));var auth=require(_0x0f15('0x6'));var interaction=require(_0x0f15('0x7'));var config=require(_0x0f15('0x8'));var controller=require(_0x0f15('0x9'));router[_0x0f15('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0f15('0xa')](_0x0f15('0xb'),auth[_0x0f15('0xc')](),controller[_0x0f15('0xd')]);router['post']('/',auth[_0x0f15('0xc')](),controller['create']);router[_0x0f15('0xe')](_0x0f15('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0f15('0xf')](_0x0f15('0xb'),auth[_0x0f15('0xc')](),controller['destroy']);module[_0x0f15('0x10')]=router; \ No newline at end of file +var _0x8f09=['get','isAuthenticated','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./pause.controller'];(function(_0x29b762,_0x24fa32){var _0x3af2af=function(_0x30a4fd){while(--_0x30a4fd){_0x29b762['push'](_0x29b762['shift']());}};_0x3af2af(++_0x24fa32);}(_0x8f09,0x19c));var _0x98f0=function(_0x3c60f2,_0x3ad2fa){_0x3c60f2=_0x3c60f2-0x0;var _0x2aff17=_0x8f09[_0x3c60f2];return _0x2aff17;};'use strict';var multer=require(_0x98f0('0x0'));var util=require(_0x98f0('0x1'));var path=require('path');var timeout=require(_0x98f0('0x2'));var express=require(_0x98f0('0x3'));var router=express['Router']();var fs_extra=require(_0x98f0('0x4'));var auth=require(_0x98f0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x98f0('0x6'));var controller=require(_0x98f0('0x7'));router[_0x98f0('0x8')]('/',auth[_0x98f0('0x9')](),controller['index']);router[_0x98f0('0x8')](_0x98f0('0xa'),auth[_0x98f0('0x9')](),controller['show']);router['post']('/',auth[_0x98f0('0x9')](),controller['create']);router['put'](_0x98f0('0xa'),auth[_0x98f0('0x9')](),controller[_0x98f0('0xb')]);router[_0x98f0('0xc')](_0x98f0('0xa'),auth[_0x98f0('0x9')](),controller[_0x98f0('0xd')]);module[_0x98f0('0xe')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 4cad531..0acb0b6 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 _0xbca9=['STRING','name','sequelize','exports'];(function(_0x3f44bf,_0x3b816a){var _0x4fa0a2=function(_0x381c84){while(--_0x381c84){_0x3f44bf['push'](_0x3f44bf['shift']());}};_0x4fa0a2(++_0x3b816a);}(_0xbca9,0x1aa));var _0x9bca=function(_0x29aca3,_0x440fe5){_0x29aca3=_0x29aca3-0x0;var _0x373249=_0xbca9[_0x29aca3];return _0x373249;};'use strict';var Sequelize=require(_0x9bca('0x0'));module[_0x9bca('0x1')]={'name':{'type':Sequelize[_0x9bca('0x2')],'unique':_0x9bca('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3f96=['sequelize','STRING'];(function(_0x268c3f,_0x59e89f){var _0x191caa=function(_0x7b277d){while(--_0x7b277d){_0x268c3f['push'](_0x268c3f['shift']());}};_0x191caa(++_0x59e89f);}(_0x3f96,0x120));var _0x63f9=function(_0x35b969,_0x3f2d65){_0x35b969=_0x35b969-0x0;var _0x731384=_0x3f96[_0x35b969];return _0x731384;};'use strict';var Sequelize=require(_0x63f9('0x0'));module['exports']={'name':{'type':Sequelize[_0x63f9('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x63f9('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index ebf8189..a721761 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 _0x63fd=['save','update','then','destroy','get','end','sendStatus','stack','name','send','index','map','Pause','fieldName','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x63fd,0xe9));var _0xd63f=function(_0x9c0671,_0x5b5a02){_0x9c0671=_0x9c0671-0x0;var _0x544284=_0x63fd[_0x9c0671];return _0x544284;};'use strict';var emlformat=require(_0xd63f('0x0'));var rimraf=require(_0xd63f('0x1'));var zipdir=require(_0xd63f('0x2'));var jsonpatch=require(_0xd63f('0x3'));var rp=require(_0xd63f('0x4'));var moment=require(_0xd63f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd63f('0x6'));var util=require(_0xd63f('0x7'));var path=require(_0xd63f('0x8'));var sox=require(_0xd63f('0x9'));var csv=require(_0xd63f('0xa'));var ejs=require(_0xd63f('0xb'));var fs=require('fs');var fs_extra=require(_0xd63f('0xc'));var _=require(_0xd63f('0xd'));var squel=require(_0xd63f('0xe'));var crypto=require(_0xd63f('0xf'));var jsforce=require(_0xd63f('0x10'));var deskjs=require(_0xd63f('0x11'));var toCsv=require(_0xd63f('0xa'));var querystring=require(_0xd63f('0x12'));var Papa=require(_0xd63f('0x13'));var Redis=require(_0xd63f('0x14'));var authService=require(_0xd63f('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd63f('0x16'))(_0xd63f('0x17'));var utils=require(_0xd63f('0x18'));var config=require(_0xd63f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd63f('0x1a'))['db'];function respondWithStatusCode(_0x3a6789,_0x1e631e){_0x1e631e=_0x1e631e||0xcc;return function(_0x3c60e6){if(_0x3c60e6){return _0x3a6789['sendStatus'](_0x1e631e);}return _0x3a6789[_0xd63f('0x1b')](_0x1e631e)['end']();};}function respondWithResult(_0x23ede3,_0x4c604a){_0x4c604a=_0x4c604a||0xc8;return function(_0x5ecc18){if(_0x5ecc18){return _0x23ede3['status'](_0x4c604a)[_0xd63f('0x1c')](_0x5ecc18);}};}function respondWithFilteredResult(_0x12b769,_0x5b9765){return function(_0xbab725){if(_0xbab725){var _0x16640b=typeof _0x5b9765['offset']==='undefined'&&typeof _0x5b9765[_0xd63f('0x1d')]===_0xd63f('0x1e');var _0x9c105e=_0xbab725[_0xd63f('0x1f')];var _0x2c5d62=_0x16640b?0x0:_0x5b9765[_0xd63f('0x20')];var _0x2698fe=_0x16640b?_0xbab725[_0xd63f('0x1f')]:_0x5b9765[_0xd63f('0x20')]+_0x5b9765['limit'];var _0x155bfa;if(_0x2698fe>=_0x9c105e){_0x2698fe=_0x9c105e;_0x155bfa=0xc8;}else{_0x155bfa=0xce;}_0x12b769['status'](_0x155bfa);return _0x12b769[_0xd63f('0x21')](_0xd63f('0x22'),_0x2c5d62+'-'+_0x2698fe+'/'+_0x9c105e)[_0xd63f('0x1c')](_0xbab725);}return null;};}function patchUpdates(_0x3fc177){return function(_0x37c91c){try{jsonpatch[_0xd63f('0x23')](_0x37c91c,_0x3fc177,!![]);}catch(_0x5458c7){return BPromise[_0xd63f('0x24')](_0x5458c7);}return _0x37c91c[_0xd63f('0x25')]();};}function saveUpdates(_0x1ef2dd,_0x28f5f8){return function(_0x2471ae){if(_0x2471ae){return _0x2471ae[_0xd63f('0x26')](_0x1ef2dd)[_0xd63f('0x27')](function(_0x2e92d4){return _0x2e92d4;});}return null;};}function removeEntity(_0x314aad,_0x3f89c7){return function(_0x548df4){if(_0x548df4){return _0x548df4[_0xd63f('0x28')]()[_0xd63f('0x27')](function(){var _0x9e101f=_0x548df4[_0xd63f('0x29')]({'plain':!![]});var _0x9775cb='Pauses';return db['UserProfileResource'][_0xd63f('0x28')]({'where':{'type':_0x9775cb,'resourceId':_0x9e101f['id']}})[_0xd63f('0x27')](function(){return _0x548df4;});})[_0xd63f('0x27')](function(){_0x314aad['status'](0xcc)[_0xd63f('0x2a')]();});}};}function handleEntityNotFound(_0x405850,_0xb77a3d){return function(_0x36541d){if(!_0x36541d){_0x405850[_0xd63f('0x2b')](0x194);}return _0x36541d;};}function handleError(_0x349834,_0x2123ae){_0x2123ae=_0x2123ae||0x1f4;return function(_0x9cfd75){logger['error'](_0x9cfd75[_0xd63f('0x2c')]);if(_0x9cfd75[_0xd63f('0x2d')]){delete _0x9cfd75[_0xd63f('0x2d')];}_0x349834[_0xd63f('0x1b')](_0x2123ae)[_0xd63f('0x2e')](_0x9cfd75);};}exports[_0xd63f('0x2f')]=function(_0x1cb0ca,_0x164472){var _0x29c767={},_0x552b74={},_0x45aac8={'count':0x0,'rows':[]};var _0x4df06c=_[_0xd63f('0x30')](db[_0xd63f('0x31')]['rawAttributes'],function(_0x5df2b3){return{'name':_0x5df2b3[_0xd63f('0x32')],'type':_0x5df2b3[_0xd63f('0x33')][_0xd63f('0x34')]};});_0x552b74[_0xd63f('0x35')]=_[_0xd63f('0x30')](_0x4df06c,_0xd63f('0x2d'));_0x552b74[_0xd63f('0x36')]=_[_0xd63f('0x37')](_0x1cb0ca[_0xd63f('0x36')]);_0x552b74[_0xd63f('0x38')]=_['intersection'](_0x552b74[_0xd63f('0x35')],_0x552b74['query']);_0x29c767['attributes']=_['intersection'](_0x552b74[_0xd63f('0x35')],qs[_0xd63f('0x39')](_0x1cb0ca[_0xd63f('0x36')]['fields']));_0x29c767['attributes']=_0x29c767[_0xd63f('0x3a')]['length']?_0x29c767['attributes']:_0x552b74['model'];if(!_0x1cb0ca[_0xd63f('0x36')][_0xd63f('0x3b')](_0xd63f('0x3c'))){_0x29c767[_0xd63f('0x1d')]=qs['limit'](_0x1cb0ca['query'][_0xd63f('0x1d')]);_0x29c767[_0xd63f('0x20')]=qs[_0xd63f('0x20')](_0x1cb0ca[_0xd63f('0x36')][_0xd63f('0x20')]);}_0x29c767[_0xd63f('0x3d')]=qs[_0xd63f('0x3e')](_0x1cb0ca[_0xd63f('0x36')][_0xd63f('0x3e')]);_0x29c767[_0xd63f('0x3f')]=qs[_0xd63f('0x38')](_[_0xd63f('0x40')](_0x1cb0ca[_0xd63f('0x36')],_0x552b74[_0xd63f('0x38')]),_0x4df06c);if(_0x1cb0ca[_0xd63f('0x36')][_0xd63f('0x41')]){_0x29c767[_0xd63f('0x3f')]=_['merge'](_0x29c767[_0xd63f('0x3f')],{'$or':_[_0xd63f('0x30')](_0x4df06c,function(_0x91526){if(_0x91526[_0xd63f('0x33')]!=='VIRTUAL'){var _0x197ff4={};_0x197ff4[_0x91526['name']]={'$like':'%'+_0x1cb0ca[_0xd63f('0x36')][_0xd63f('0x41')]+'%'};return _0x197ff4;}})});}_0x29c767=_[_0xd63f('0x42')]({},_0x29c767,_0x1cb0ca[_0xd63f('0x43')]);var _0x3ea77c={'where':_0x29c767[_0xd63f('0x3f')]};return db[_0xd63f('0x31')][_0xd63f('0x1f')](_0x3ea77c)['then'](function(_0x43f487){_0x45aac8[_0xd63f('0x1f')]=_0x43f487;if(_0x1cb0ca[_0xd63f('0x36')][_0xd63f('0x44')]){_0x29c767[_0xd63f('0x45')]=[{'all':!![]}];}return db[_0xd63f('0x31')][_0xd63f('0x46')](_0x29c767);})[_0xd63f('0x27')](function(_0x524bbf){_0x45aac8[_0xd63f('0x47')]=_0x524bbf;return _0x45aac8;})[_0xd63f('0x27')](respondWithFilteredResult(_0x164472,_0x29c767))[_0xd63f('0x48')](handleError(_0x164472,null));};exports[_0xd63f('0x49')]=function(_0x3fb976,_0x19caf3){var _0x5b7059={'raw':!![],'where':{'id':_0x3fb976[_0xd63f('0x4a')]['id']}},_0x1382b1={};_0x1382b1[_0xd63f('0x35')]=_[_0xd63f('0x37')](db[_0xd63f('0x31')][_0xd63f('0x4b')]);_0x1382b1[_0xd63f('0x36')]=_[_0xd63f('0x37')](_0x3fb976['query']);_0x1382b1[_0xd63f('0x38')]=_[_0xd63f('0x4c')](_0x1382b1[_0xd63f('0x35')],_0x1382b1[_0xd63f('0x36')]);_0x5b7059[_0xd63f('0x3a')]=_[_0xd63f('0x4c')](_0x1382b1[_0xd63f('0x35')],qs[_0xd63f('0x39')](_0x3fb976['query'][_0xd63f('0x39')]));_0x5b7059['attributes']=_0x5b7059[_0xd63f('0x3a')][_0xd63f('0x4d')]?_0x5b7059[_0xd63f('0x3a')]:_0x1382b1[_0xd63f('0x35')];if(_0x3fb976[_0xd63f('0x36')]['includeAll']){_0x5b7059[_0xd63f('0x45')]=[{'all':!![]}];}_0x5b7059=_[_0xd63f('0x42')]({},_0x5b7059,_0x3fb976['options']);return db[_0xd63f('0x31')][_0xd63f('0x4e')](_0x5b7059)[_0xd63f('0x27')](handleEntityNotFound(_0x19caf3,null))[_0xd63f('0x27')](respondWithResult(_0x19caf3,null))[_0xd63f('0x48')](handleError(_0x19caf3,null));};exports[_0xd63f('0x4f')]=function(_0x734204,_0x18772e){return db['Pause'][_0xd63f('0x4f')](_0x734204[_0xd63f('0x50')],{})['then'](function(_0x359e1c){var _0x4cd67b=_0x734204['user']['get']({'plain':!![]});if(!_0x4cd67b)throw new Error(_0xd63f('0x51'));if(_0x4cd67b[_0xd63f('0x52')]==='user'){var _0x2baeb0=_0x359e1c['get']({'plain':!![]});var _0x1fce83=_0xd63f('0x53');return db[_0xd63f('0x54')][_0xd63f('0x4e')]({'where':{'name':_0x1fce83,'userProfileId':_0x4cd67b[_0xd63f('0x55')]},'raw':!![]})[_0xd63f('0x27')](function(_0x2769b6){if(_0x2769b6&&_0x2769b6[_0xd63f('0x56')]===0x0){return db[_0xd63f('0x57')][_0xd63f('0x4f')]({'name':_0x2baeb0[_0xd63f('0x2d')],'resourceId':_0x2baeb0['id'],'type':_0x2769b6[_0xd63f('0x2d')],'sectionId':_0x2769b6['id']},{})[_0xd63f('0x27')](function(){return _0x359e1c;});}else{return _0x359e1c;}})[_0xd63f('0x48')](function(_0x511e74){logger[_0xd63f('0x58')](_0xd63f('0x59'),_0x511e74);throw _0x511e74;});}return _0x359e1c;})[_0xd63f('0x27')](respondWithResult(_0x18772e,0xc9))['catch'](handleError(_0x18772e,null));};exports[_0xd63f('0x26')]=function(_0x37afe5,_0x5cb160){if(_0x37afe5['body']['id']){delete _0x37afe5[_0xd63f('0x50')]['id'];}return db[_0xd63f('0x31')]['find']({'where':{'id':_0x37afe5[_0xd63f('0x4a')]['id']}})[_0xd63f('0x27')](handleEntityNotFound(_0x5cb160,null))['then'](saveUpdates(_0x37afe5['body'],null))[_0xd63f('0x27')](respondWithResult(_0x5cb160,null))[_0xd63f('0x48')](handleError(_0x5cb160,null));};exports[_0xd63f('0x28')]=function(_0x5bb668,_0x3ba607){return db['Pause'][_0xd63f('0x4e')]({'where':{'id':_0x5bb668['params']['id']}})[_0xd63f('0x27')](handleEntityNotFound(_0x3ba607,null))[_0xd63f('0x27')](removeEntity(_0x3ba607,null))[_0xd63f('0x48')](handleError(_0x3ba607,null));}; \ No newline at end of file +var _0x6743=['undefined','count','offset','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','include','catch','show','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Pauses','UserProfileSection','autoAssociation','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','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','api','../../config/environment','sendStatus','status','limit'];(function(_0x2002b3,_0x11e91c){var _0x2756f0=function(_0x4bf0b3){while(--_0x4bf0b3){_0x2002b3['push'](_0x2002b3['shift']());}};_0x2756f0(++_0x11e91c);}(_0x6743,0x82));var _0x3674=function(_0x3b56c0,_0xe100d8){_0x3b56c0=_0x3b56c0-0x0;var _0x377efe=_0x6743[_0x3b56c0];return _0x377efe;};'use strict';var emlformat=require(_0x3674('0x0'));var rimraf=require(_0x3674('0x1'));var zipdir=require(_0x3674('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3674('0x3'));var moment=require(_0x3674('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3674('0x5'));var util=require(_0x3674('0x6'));var path=require('path');var sox=require(_0x3674('0x7'));var csv=require(_0x3674('0x8'));var ejs=require(_0x3674('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3674('0xa'));var squel=require('squel');var crypto=require(_0x3674('0xb'));var jsforce=require(_0x3674('0xc'));var deskjs=require(_0x3674('0xd'));var toCsv=require(_0x3674('0x8'));var querystring=require(_0x3674('0xe'));var Papa=require(_0x3674('0xf'));var Redis=require('ioredis');var authService=require(_0x3674('0x10'));var qs=require(_0x3674('0x11'));var as=require(_0x3674('0x12'));var hardwareService=require(_0x3674('0x13'));var logger=require(_0x3674('0x14'))(_0x3674('0x15'));var utils=require('../../config/utils');var config=require(_0x3674('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xda4612,_0x32cf23){_0x32cf23=_0x32cf23||0xcc;return function(_0x3dceb8){if(_0x3dceb8){return _0xda4612[_0x3674('0x17')](_0x32cf23);}return _0xda4612[_0x3674('0x18')](_0x32cf23)['end']();};}function respondWithResult(_0x5b23c7,_0xbf8db3){_0xbf8db3=_0xbf8db3||0xc8;return function(_0x4e75d5){if(_0x4e75d5){return _0x5b23c7['status'](_0xbf8db3)['json'](_0x4e75d5);}};}function respondWithFilteredResult(_0x23b471,_0x19253a){return function(_0x503ca9){if(_0x503ca9){var _0xffd669=typeof _0x19253a['offset']==='undefined'&&typeof _0x19253a[_0x3674('0x19')]===_0x3674('0x1a');var _0x157288=_0x503ca9[_0x3674('0x1b')];var _0x4b2a6b=_0xffd669?0x0:_0x19253a[_0x3674('0x1c')];var _0x4c233d=_0xffd669?_0x503ca9[_0x3674('0x1b')]:_0x19253a[_0x3674('0x1c')]+_0x19253a['limit'];var _0x191508;if(_0x4c233d>=_0x157288){_0x4c233d=_0x157288;_0x191508=0xc8;}else{_0x191508=0xce;}_0x23b471[_0x3674('0x18')](_0x191508);return _0x23b471['set'](_0x3674('0x1d'),_0x4b2a6b+'-'+_0x4c233d+'/'+_0x157288)[_0x3674('0x1e')](_0x503ca9);}return null;};}function patchUpdates(_0x39ad13){return function(_0x2cbc07){try{jsonpatch[_0x3674('0x1f')](_0x2cbc07,_0x39ad13,!![]);}catch(_0x102ac9){return BPromise['reject'](_0x102ac9);}return _0x2cbc07[_0x3674('0x20')]();};}function saveUpdates(_0x3a34fd,_0x4e8101){return function(_0x46bafa){if(_0x46bafa){return _0x46bafa[_0x3674('0x21')](_0x3a34fd)[_0x3674('0x22')](function(_0x11b691){return _0x11b691;});}return null;};}function removeEntity(_0x4af1b7,_0x3a1b1d){return function(_0x5a507a){if(_0x5a507a){return _0x5a507a[_0x3674('0x23')]()[_0x3674('0x22')](function(){var _0x49df02=_0x5a507a[_0x3674('0x24')]({'plain':!![]});var _0x1a5b71='Pauses';return db[_0x3674('0x25')]['destroy']({'where':{'type':_0x1a5b71,'resourceId':_0x49df02['id']}})[_0x3674('0x22')](function(){return _0x5a507a;});})['then'](function(){_0x4af1b7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbaf257,_0x53bfe1){return function(_0x3ced5d){if(!_0x3ced5d){_0xbaf257['sendStatus'](0x194);}return _0x3ced5d;};}function handleError(_0x26b4cd,_0x371741){_0x371741=_0x371741||0x1f4;return function(_0x4de792){logger[_0x3674('0x26')](_0x4de792[_0x3674('0x27')]);if(_0x4de792[_0x3674('0x28')]){delete _0x4de792[_0x3674('0x28')];}_0x26b4cd[_0x3674('0x18')](_0x371741)[_0x3674('0x29')](_0x4de792);};}exports['index']=function(_0x3a7ce6,_0x375603){var _0xd21373={},_0x5275fa={},_0x271a6f={'count':0x0,'rows':[]};var _0x1af5cd=_[_0x3674('0x2a')](db[_0x3674('0x2b')][_0x3674('0x2c')],function(_0x510318){return{'name':_0x510318[_0x3674('0x2d')],'type':_0x510318[_0x3674('0x2e')][_0x3674('0x2f')]};});_0x5275fa[_0x3674('0x30')]=_['map'](_0x1af5cd,_0x3674('0x28'));_0x5275fa[_0x3674('0x31')]=_[_0x3674('0x32')](_0x3a7ce6[_0x3674('0x31')]);_0x5275fa['filters']=_[_0x3674('0x33')](_0x5275fa[_0x3674('0x30')],_0x5275fa['query']);_0xd21373[_0x3674('0x34')]=_[_0x3674('0x33')](_0x5275fa[_0x3674('0x30')],qs[_0x3674('0x35')](_0x3a7ce6[_0x3674('0x31')][_0x3674('0x35')]));_0xd21373['attributes']=_0xd21373['attributes']['length']?_0xd21373['attributes']:_0x5275fa[_0x3674('0x30')];if(!_0x3a7ce6[_0x3674('0x31')][_0x3674('0x36')]('nolimit')){_0xd21373['limit']=qs[_0x3674('0x19')](_0x3a7ce6['query'][_0x3674('0x19')]);_0xd21373[_0x3674('0x1c')]=qs['offset'](_0x3a7ce6['query']['offset']);}_0xd21373[_0x3674('0x37')]=qs[_0x3674('0x38')](_0x3a7ce6[_0x3674('0x31')][_0x3674('0x38')]);_0xd21373['where']=qs[_0x3674('0x39')](_[_0x3674('0x3a')](_0x3a7ce6['query'],_0x5275fa['filters']),_0x1af5cd);if(_0x3a7ce6[_0x3674('0x31')][_0x3674('0x3b')]){_0xd21373[_0x3674('0x3c')]=_['merge'](_0xd21373[_0x3674('0x3c')],{'$or':_[_0x3674('0x2a')](_0x1af5cd,function(_0x5804a4){if(_0x5804a4[_0x3674('0x2e')]!==_0x3674('0x3d')){var _0x32cdce={};_0x32cdce[_0x5804a4['name']]={'$like':'%'+_0x3a7ce6[_0x3674('0x31')][_0x3674('0x3b')]+'%'};return _0x32cdce;}})});}_0xd21373=_[_0x3674('0x3e')]({},_0xd21373,_0x3a7ce6[_0x3674('0x3f')]);var _0x397a90={'where':_0xd21373[_0x3674('0x3c')]};return db[_0x3674('0x2b')]['count'](_0x397a90)[_0x3674('0x22')](function(_0x4de021){_0x271a6f[_0x3674('0x1b')]=_0x4de021;if(_0x3a7ce6[_0x3674('0x31')]['includeAll']){_0xd21373[_0x3674('0x40')]=[{'all':!![]}];}return db[_0x3674('0x2b')]['findAll'](_0xd21373);})[_0x3674('0x22')](function(_0x4f76a6){_0x271a6f['rows']=_0x4f76a6;return _0x271a6f;})['then'](respondWithFilteredResult(_0x375603,_0xd21373))[_0x3674('0x41')](handleError(_0x375603,null));};exports[_0x3674('0x42')]=function(_0x6345e5,_0x199084){var _0x2af476={'raw':!![],'where':{'id':_0x6345e5['params']['id']}},_0x4858f4={};_0x4858f4[_0x3674('0x30')]=_['keys'](db['Pause']['rawAttributes']);_0x4858f4[_0x3674('0x31')]=_[_0x3674('0x32')](_0x6345e5[_0x3674('0x31')]);_0x4858f4[_0x3674('0x39')]=_[_0x3674('0x33')](_0x4858f4[_0x3674('0x30')],_0x4858f4[_0x3674('0x31')]);_0x2af476[_0x3674('0x34')]=_[_0x3674('0x33')](_0x4858f4[_0x3674('0x30')],qs[_0x3674('0x35')](_0x6345e5[_0x3674('0x31')][_0x3674('0x35')]));_0x2af476[_0x3674('0x34')]=_0x2af476['attributes'][_0x3674('0x43')]?_0x2af476[_0x3674('0x34')]:_0x4858f4['model'];if(_0x6345e5[_0x3674('0x31')][_0x3674('0x44')]){_0x2af476[_0x3674('0x40')]=[{'all':!![]}];}_0x2af476=_[_0x3674('0x3e')]({},_0x2af476,_0x6345e5[_0x3674('0x3f')]);return db[_0x3674('0x2b')][_0x3674('0x45')](_0x2af476)[_0x3674('0x22')](handleEntityNotFound(_0x199084,null))[_0x3674('0x22')](respondWithResult(_0x199084,null))[_0x3674('0x41')](handleError(_0x199084,null));};exports[_0x3674('0x46')]=function(_0xc899f4,_0x11ef09){return db[_0x3674('0x2b')][_0x3674('0x46')](_0xc899f4[_0x3674('0x47')],{})[_0x3674('0x22')](function(_0x4f2a75){var _0x351042=_0xc899f4[_0x3674('0x48')]['get']({'plain':!![]});if(!_0x351042)throw new Error(_0x3674('0x49'));if(_0x351042['role']==='user'){var _0x4ac7c1=_0x4f2a75[_0x3674('0x24')]({'plain':!![]});var _0x3be3ad=_0x3674('0x4a');return db[_0x3674('0x4b')][_0x3674('0x45')]({'where':{'name':_0x3be3ad,'userProfileId':_0x351042['userProfileId']},'raw':!![]})[_0x3674('0x22')](function(_0x1d3757){if(_0x1d3757&&_0x1d3757[_0x3674('0x4c')]===0x0){return db[_0x3674('0x25')]['create']({'name':_0x4ac7c1['name'],'resourceId':_0x4ac7c1['id'],'type':_0x1d3757['name'],'sectionId':_0x1d3757['id']},{})[_0x3674('0x22')](function(){return _0x4f2a75;});}else{return _0x4f2a75;}})['catch'](function(_0xf58264){logger[_0x3674('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf58264);throw _0xf58264;});}return _0x4f2a75;})[_0x3674('0x22')](respondWithResult(_0x11ef09,0xc9))[_0x3674('0x41')](handleError(_0x11ef09,null));};exports['update']=function(_0x81cee,_0x4e8926){if(_0x81cee[_0x3674('0x47')]['id']){delete _0x81cee[_0x3674('0x47')]['id'];}return db['Pause'][_0x3674('0x45')]({'where':{'id':_0x81cee[_0x3674('0x4d')]['id']}})[_0x3674('0x22')](handleEntityNotFound(_0x4e8926,null))['then'](saveUpdates(_0x81cee[_0x3674('0x47')],null))[_0x3674('0x22')](respondWithResult(_0x4e8926,null))[_0x3674('0x41')](handleError(_0x4e8926,null));};exports[_0x3674('0x23')]=function(_0x24d77d,_0x559c5e){return db[_0x3674('0x2b')]['find']({'where':{'id':_0x24d77d[_0x3674('0x4d')]['id']}})[_0x3674('0x22')](handleEntityNotFound(_0x559c5e,null))['then'](removeEntity(_0x559c5e,null))[_0x3674('0x41')](handleError(_0x559c5e,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 2828ce7..acf1d7a 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5bc158,_0x20ba90){_0x5bc158=_0x5bc158-0x0;var _0x288d43=_0x7fbe[_0x5bc158];return _0x288d43;};'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':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x23aa97,_0xe78aac){var _0xe50c39=function(_0x12208c){while(--_0x12208c){_0x23aa97['push'](_0x23aa97['shift']());}};_0xe50c39(++_0xe78aac);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2d6197,_0x82ebfb){_0x2d6197=_0x2d6197-0x0;var _0x4d0e75=_0x5fc3[_0x2d6197];return _0x4d0e75;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('Pause',attributes,{'tableName':_0x35fc('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 647eac1..2e595a5 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x320687,_0x14ecb9){var _0x3bdebc=function(_0x5b073a){while(--_0x5b073a){_0x320687['push'](_0x320687['shift']());}};_0x3bdebc(++_0x14ecb9);}(_0x7a54,0x106));var _0x47a5=function(_0x2d06ce,_0x1002f5){_0x2d06ce=_0x2d06ce-0x0;var _0x4a3d19=_0x7a54[_0x2d06ce];return _0x4a3d19;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0xedec4b,_0x560710){var _0x41a5bf=function(_0x20938b){while(--_0x20938b){_0xedec4b['push'](_0xedec4b['shift']());}};_0x41a5bf(++_0x560710);}(_0xb10b,0x12a));var _0xbb10=function(_0x3903ef,_0x30063f){_0x3903ef=_0x3903ef-0x0;var _0x5a340b=_0xb10b[_0x3903ef];return _0x5a340b;};'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 e0089d0..e812870 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 _0x2dae=['put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated','show','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','post','file','upload'];(function(_0x1ad756,_0x43f2d1){var _0x4e76b9=function(_0x3705d6){while(--_0x3705d6){_0x1ad756['push'](_0x1ad756['shift']());}};_0x4e76b9(++_0x43f2d1);}(_0x2dae,0xc3));var _0xe2da=function(_0x305486,_0x24acd4){_0x305486=_0x305486-0x0;var _0xa04940=_0x2dae[_0x305486];return _0xa04940;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),controller[_0xe2da('0xc')]);router[_0xe2da('0x9')](_0xe2da('0xd'),auth[_0xe2da('0xe')](),controller[_0xe2da('0xf')]);router[_0xe2da('0x9')]('/:id/download',auth[_0xe2da('0xe')](),controller[_0xe2da('0x10')]);var upload=multer({'storage':multer[_0xe2da('0x11')]({'destination':function(_0x17086c,_0x3c1309,_0x44ec3e){_0x44ec3e(null,path[_0xe2da('0x12')](config[_0xe2da('0x13')],'server/files/plugins'));},'filename':function(_0xb98909,_0x5200b1,_0x4377c6){_0x5200b1[_0xe2da('0x14')]=_0x5200b1[_0xe2da('0x14')][_0xe2da('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4377c6(null,util[_0xe2da('0x16')](_0xe2da('0x17'),path[_0xe2da('0x18')](_0x5200b1['originalname'],path[_0xe2da('0x19')](_0x5200b1['originalname'])),Date['now'](),path[_0xe2da('0x19')](_0x5200b1[_0xe2da('0x14')])));}})});router[_0xe2da('0x1a')]('/',upload['single'](_0xe2da('0x1b')),controller[_0xe2da('0x1c')]);router[_0xe2da('0x1a')](_0xe2da('0xb'),controller['webhookPost']);router[_0xe2da('0x1d')](_0xe2da('0xd'),auth[_0xe2da('0xe')](),controller[_0xe2da('0x1e')]);router[_0xe2da('0x1f')]('/:id',auth[_0xe2da('0xe')](),controller[_0xe2da('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x0faf=['extname','now','post','single','file','webhookPost','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','basename'];(function(_0x2ade6c,_0x2d42f2){var _0x2cb372=function(_0x477d8a){while(--_0x477d8a){_0x2ade6c['push'](_0x2ade6c['shift']());}};_0x2cb372(++_0x2d42f2);}(_0x0faf,0x132));var _0xf0fa=function(_0x275caa,_0x166d5e){_0x275caa=_0x275caa-0x0;var _0x28d670=_0x0faf[_0x275caa];return _0x28d670;};'use strict';var multer=require(_0xf0fa('0x0'));var util=require('util');var path=require(_0xf0fa('0x1'));var timeout=require(_0xf0fa('0x2'));var express=require(_0xf0fa('0x3'));var router=express[_0xf0fa('0x4')]();var fs_extra=require(_0xf0fa('0x5'));var auth=require(_0xf0fa('0x6'));var interaction=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var controller=require(_0xf0fa('0x9'));router['get']('/',auth[_0xf0fa('0xa')](),controller[_0xf0fa('0xb')]);router[_0xf0fa('0xc')](_0xf0fa('0xd'),controller[_0xf0fa('0xe')]);router['get'](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller['show']);router['get'](_0xf0fa('0x10'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x11')]);var upload=multer({'storage':multer[_0xf0fa('0x12')]({'destination':function(_0x2bd807,_0x1151ea,_0x379ff6){_0x379ff6(null,path[_0xf0fa('0x13')](config['root'],_0xf0fa('0x14')));},'filename':function(_0x5b38fa,_0x2f46ff,_0x521034){_0x2f46ff[_0xf0fa('0x15')]=_0x2f46ff[_0xf0fa('0x15')][_0xf0fa('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x521034(null,util['format']('%s-%s%s',path[_0xf0fa('0x17')](_0x2f46ff['originalname'],path[_0xf0fa('0x18')](_0x2f46ff[_0xf0fa('0x15')])),Date[_0xf0fa('0x19')](),path[_0xf0fa('0x18')](_0x2f46ff[_0xf0fa('0x15')])));}})});router[_0xf0fa('0x1a')]('/',upload[_0xf0fa('0x1b')](_0xf0fa('0x1c')),controller['upload']);router[_0xf0fa('0x1a')](_0xf0fa('0xd'),controller[_0xf0fa('0x1d')]);router[_0xf0fa('0x1e')](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller['update']);router['delete'](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x1f')]);module[_0xf0fa('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index e9835cb..c67b889 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 _0xc474=['never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','ENUM','adminOnly','agentOnly','always'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc474,0x147));var _0x4c47=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xc474[_0x4b7895];return _0x264180;};'use strict';var Sequelize=require(_0x4c47('0x0'));module[_0x4c47('0x1')]={'name':{'type':Sequelize[_0x4c47('0x2')]},'type':{'type':Sequelize['ENUM'](_0x4c47('0x3'),_0x4c47('0x4'))},'description':{'type':Sequelize[_0x4c47('0x5')]},'version':{'type':Sequelize[_0x4c47('0x5')]},'path':{'type':Sequelize[_0x4c47('0x2')],'comment':_0x4c47('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x4c47('0x7')](_0x4c47('0x8'),_0x4c47('0x9'),_0x4c47('0xa'),_0x4c47('0xb')),'defaultValue':_0x4c47('0xa'),'comment':_0x4c47('0xc')},'icon':{'type':Sequelize[_0x4c47('0x2')]},'adminUrl':{'type':Sequelize[_0x4c47('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x4c47('0x2')]},'scriptPath':{'type':Sequelize[_0x4c47('0x2')]}}; \ No newline at end of file +var _0xcd96=['agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','sequelize','exports','ENUM','html','script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly'];(function(_0x2e0e7b,_0x55d8b2){var _0xbad498=function(_0xf21e2a){while(--_0xf21e2a){_0x2e0e7b['push'](_0x2e0e7b['shift']());}};_0xbad498(++_0x55d8b2);}(_0xcd96,0x178));var _0x6cd9=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0xcd96[_0x479160];return _0x47ac6d;};'use strict';var Sequelize=require(_0x6cd9('0x0'));module[_0x6cd9('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6cd9('0x2')](_0x6cd9('0x3'),_0x6cd9('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x6cd9('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x6cd9('0x6')},'sidebar':{'type':Sequelize['ENUM'](_0x6cd9('0x7'),_0x6cd9('0x8'),_0x6cd9('0x9'),'never'),'defaultValue':'always','comment':_0x6cd9('0xa')},'icon':{'type':Sequelize[_0x6cd9('0xb')]},'adminUrl':{'type':Sequelize[_0x6cd9('0xb')]},'agentUrl':{'type':Sequelize[_0x6cd9('0xb')]},'scriptName':{'type':Sequelize[_0x6cd9('0xb')]},'scriptPath':{'type':Sequelize[_0x6cd9('0xb')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index d1d4c43..dcd97d4 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 _0x6dfb=['get','UserProfileResource','stack','name','send','map','Plugin','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','catch','show','params','include','find','download','root','server/files/plugins','format','%s.zip','basename','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','join','dirname','attachments/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','extname','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','error','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','parameters','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptPath','description','sidebar','always','icon','icon-apps','version','html','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','scriptName','test','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Plugins','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6dfb,0x7c));var _0xb6df=function(_0x948cc8,_0x4fea10){_0x948cc8=_0x948cc8-0x0;var _0x109cb4=_0x6dfb[_0x948cc8];return _0x109cb4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb6df('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb6df('0x1'));var rp=require(_0xb6df('0x2'));var moment=require(_0xb6df('0x3'));var BPromise=require(_0xb6df('0x4'));var Mustache=require(_0xb6df('0x5'));var util=require(_0xb6df('0x6'));var path=require(_0xb6df('0x7'));var sox=require(_0xb6df('0x8'));var csv=require(_0xb6df('0x9'));var ejs=require(_0xb6df('0xa'));var fs=require('fs');var fs_extra=require(_0xb6df('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb6df('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb6df('0xd'));var toCsv=require(_0xb6df('0x9'));var querystring=require(_0xb6df('0xe'));var Papa=require(_0xb6df('0xf'));var extract=require(_0xb6df('0x10'));var rimraf=require(_0xb6df('0x0'));var archiver=require(_0xb6df('0x11'));var Redis=require(_0xb6df('0x12'));var authService=require(_0xb6df('0x13'));var qs=require(_0xb6df('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb6df('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xb6df('0x16'));var config=require(_0xb6df('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb6df('0x18')]=_[_0xb6df('0x19')](config[_0xb6df('0x18')],{'host':_0xb6df('0x1a'),'port':0x18eb});var socket=require(_0xb6df('0x1b'))(new Redis(config['redis']));require(_0xb6df('0x1c'))['register'](socket);function respondWithStatusCode(_0x5173f9,_0x743b95){_0x743b95=_0x743b95||0xcc;return function(_0x2bffc4){if(_0x2bffc4){return _0x5173f9[_0xb6df('0x1d')](_0x743b95);}return _0x5173f9[_0xb6df('0x1e')](_0x743b95)[_0xb6df('0x1f')]();};}function respondWithResult(_0x1fc901,_0x4fb6db){_0x4fb6db=_0x4fb6db||0xc8;return function(_0x4ffa78){if(_0x4ffa78){return _0x1fc901['status'](_0x4fb6db)[_0xb6df('0x20')](_0x4ffa78);}};}function respondWithFilteredResult(_0x350713,_0x3f2466){return function(_0x279e49){if(_0x279e49){var _0x4d9673=typeof _0x3f2466['offset']===_0xb6df('0x21')&&typeof _0x3f2466[_0xb6df('0x22')]===_0xb6df('0x21');var _0x57e641=_0x279e49[_0xb6df('0x23')];var _0x300462=_0x4d9673?0x0:_0x3f2466[_0xb6df('0x24')];var _0x4205f8=_0x4d9673?_0x279e49[_0xb6df('0x23')]:_0x3f2466[_0xb6df('0x24')]+_0x3f2466['limit'];var _0x360a47;if(_0x4205f8>=_0x57e641){_0x4205f8=_0x57e641;_0x360a47=0xc8;}else{_0x360a47=0xce;}_0x350713['status'](_0x360a47);return _0x350713[_0xb6df('0x25')](_0xb6df('0x26'),_0x300462+'-'+_0x4205f8+'/'+_0x57e641)[_0xb6df('0x20')](_0x279e49);}return null;};}function patchUpdates(_0x37f0a3){return function(_0x3667e7){try{jsonpatch[_0xb6df('0x27')](_0x3667e7,_0x37f0a3,!![]);}catch(_0x3daa72){return BPromise['reject'](_0x3daa72);}return _0x3667e7[_0xb6df('0x28')]();};}function saveUpdates(_0xdae3bd,_0xef020){return function(_0x302020){if(_0x302020){return _0x302020[_0xb6df('0x29')](_0xdae3bd)[_0xb6df('0x2a')](function(_0x3ee320){return _0x3ee320;});}return null;};}function removeEntity(_0x4c633f,_0x3671eb){return function(_0x17f959){if(_0x17f959){return _0x17f959[_0xb6df('0x2b')]()['then'](function(){var _0x5cb67d=_0x17f959[_0xb6df('0x2c')]({'plain':!![]});var _0x5df030='Plugins';return db[_0xb6df('0x2d')][_0xb6df('0x2b')]({'where':{'type':_0x5df030,'resourceId':_0x5cb67d['id']}})[_0xb6df('0x2a')](function(){return _0x17f959;});})[_0xb6df('0x2a')](function(){_0x4c633f[_0xb6df('0x1e')](0xcc)[_0xb6df('0x1f')]();});}};}function handleEntityNotFound(_0x441cec,_0x1aece0){return function(_0xb41df3){if(!_0xb41df3){_0x441cec[_0xb6df('0x1d')](0x194);}return _0xb41df3;};}function handleError(_0x4df25d,_0x59a9a8){_0x59a9a8=_0x59a9a8||0x1f4;return function(_0x3efc66){logger['error'](_0x3efc66[_0xb6df('0x2e')]);if(_0x3efc66[_0xb6df('0x2f')]){delete _0x3efc66[_0xb6df('0x2f')];}_0x4df25d[_0xb6df('0x1e')](_0x59a9a8)[_0xb6df('0x30')](_0x3efc66);};}exports['index']=function(_0x4af67c,_0x301762){var _0x122e15={},_0x5c3305={},_0x5acbec={'count':0x0,'rows':[]};var _0x18c4aa=_[_0xb6df('0x31')](db[_0xb6df('0x32')][_0xb6df('0x33')],function(_0x2c7382){return{'name':_0x2c7382[_0xb6df('0x34')],'type':_0x2c7382['type'][_0xb6df('0x35')]};});_0x5c3305[_0xb6df('0x36')]=_[_0xb6df('0x31')](_0x18c4aa,_0xb6df('0x2f'));_0x5c3305[_0xb6df('0x37')]=_[_0xb6df('0x38')](_0x4af67c[_0xb6df('0x37')]);_0x5c3305[_0xb6df('0x39')]=_[_0xb6df('0x3a')](_0x5c3305['model'],_0x5c3305[_0xb6df('0x37')]);_0x122e15[_0xb6df('0x3b')]=_['intersection'](_0x5c3305[_0xb6df('0x36')],qs[_0xb6df('0x3c')](_0x4af67c[_0xb6df('0x37')][_0xb6df('0x3c')]));_0x122e15[_0xb6df('0x3b')]=_0x122e15['attributes'][_0xb6df('0x3d')]?_0x122e15['attributes']:_0x5c3305[_0xb6df('0x36')];if(!_0x4af67c['query'][_0xb6df('0x3e')]('nolimit')){_0x122e15[_0xb6df('0x22')]=qs[_0xb6df('0x22')](_0x4af67c[_0xb6df('0x37')][_0xb6df('0x22')]);_0x122e15['offset']=qs[_0xb6df('0x24')](_0x4af67c['query']['offset']);}_0x122e15[_0xb6df('0x3f')]=qs[_0xb6df('0x40')](_0x4af67c[_0xb6df('0x37')][_0xb6df('0x40')]);_0x122e15[_0xb6df('0x41')]=qs['filters'](_['pick'](_0x4af67c[_0xb6df('0x37')],_0x5c3305[_0xb6df('0x39')]),_0x18c4aa);if(_0x4af67c[_0xb6df('0x37')][_0xb6df('0x42')]){_0x122e15[_0xb6df('0x41')]=_[_0xb6df('0x43')](_0x122e15[_0xb6df('0x41')],{'$or':_['map'](_0x18c4aa,function(_0x306ff4){if(_0x306ff4[_0xb6df('0x44')]!==_0xb6df('0x45')){var _0x6acc09={};_0x6acc09[_0x306ff4[_0xb6df('0x2f')]]={'$like':'%'+_0x4af67c[_0xb6df('0x37')][_0xb6df('0x42')]+'%'};return _0x6acc09;}})});}_0x122e15=_[_0xb6df('0x43')]({},_0x122e15,_0x4af67c[_0xb6df('0x46')]);var _0x396dcb={'where':_0x122e15[_0xb6df('0x41')]};return db[_0xb6df('0x32')]['count'](_0x396dcb)[_0xb6df('0x2a')](function(_0x2230c9){_0x5acbec['count']=_0x2230c9;if(_0x4af67c['query'][_0xb6df('0x47')]){_0x122e15['include']=[{'all':!![]}];}return db[_0xb6df('0x32')]['findAll'](_0x122e15);})[_0xb6df('0x2a')](function(_0x3c695e){_0x5acbec['rows']=_0x3c695e;return _0x5acbec;})['then'](respondWithFilteredResult(_0x301762,_0x122e15))[_0xb6df('0x48')](handleError(_0x301762,null));};exports[_0xb6df('0x49')]=function(_0x343ac2,_0x35957f){var _0x20d137={'raw':!![],'where':{'id':_0x343ac2[_0xb6df('0x4a')]['id']}},_0xc577b5={};_0xc577b5[_0xb6df('0x36')]=_['keys'](db[_0xb6df('0x32')]['rawAttributes']);_0xc577b5['query']=_[_0xb6df('0x38')](_0x343ac2[_0xb6df('0x37')]);_0xc577b5[_0xb6df('0x39')]=_[_0xb6df('0x3a')](_0xc577b5['model'],_0xc577b5[_0xb6df('0x37')]);_0x20d137['attributes']=_[_0xb6df('0x3a')](_0xc577b5[_0xb6df('0x36')],qs[_0xb6df('0x3c')](_0x343ac2[_0xb6df('0x37')][_0xb6df('0x3c')]));_0x20d137['attributes']=_0x20d137[_0xb6df('0x3b')][_0xb6df('0x3d')]?_0x20d137[_0xb6df('0x3b')]:_0xc577b5['model'];if(_0x343ac2['query']['includeAll']){_0x20d137[_0xb6df('0x4b')]=[{'all':!![]}];}_0x20d137=_[_0xb6df('0x43')]({},_0x20d137,_0x343ac2[_0xb6df('0x46')]);return db[_0xb6df('0x32')][_0xb6df('0x4c')](_0x20d137)[_0xb6df('0x2a')](handleEntityNotFound(_0x35957f,null))[_0xb6df('0x2a')](respondWithResult(_0x35957f,null))['catch'](handleError(_0x35957f,null));};exports[_0xb6df('0x4d')]=function(_0xd77ac7,_0x42b54b,_0x5b62bc){return db[_0xb6df('0x32')][_0xb6df('0x4c')]({'where':{'id':_0xd77ac7[_0xb6df('0x4a')]['id']},'attributes':[_0xb6df('0x2f'),'path'],'raw':!![]})[_0xb6df('0x2a')](handleEntityNotFound(_0x42b54b,null))[_0xb6df('0x2a')](function(_0x3f8278){if(_0x3f8278){var _0x535636=path['join'](config[_0xb6df('0x4e')],_0xb6df('0x4f'),util[_0xb6df('0x50')](_0xb6df('0x51'),path[_0xb6df('0x52')](_0x3f8278[_0xb6df('0x7')])));var _0x3f41b1=fs['createWriteStream'](_0x535636);var _0x5e99a7=archiver(_0xb6df('0x53'),{'zlib':{'level':0x9}});_0x5e99a7['on']('warning',function(_0x51a775){if(_0x51a775[_0xb6df('0x54')]===_0xb6df('0x55')){logger['error'](_0x51a775);}else{throw new db[(_0xb6df('0x56'))][(_0xb6df('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x5e99a7['on']('error',function(_0x539f48){throw new db[(_0xb6df('0x56'))][(_0xb6df('0x57'))](_0xb6df('0x58'));});_0x5e99a7[_0xb6df('0x59')](_0x3f41b1);_0x5e99a7['glob'](_0xb6df('0x5a'),{'cwd':path[_0xb6df('0x5b')](config[_0xb6df('0x4e')],_0xb6df('0x4f'),path[_0xb6df('0x5c')](_0x3f8278[_0xb6df('0x7')])),'ignore':[path[_0xb6df('0x5b')](path[_0xb6df('0x52')](_0x3f8278[_0xb6df('0x7')]),'node_modules/**/*'),path[_0xb6df('0x5b')](path[_0xb6df('0x52')](_0x3f8278['path']),_0xb6df('0x5d'))],'nodir':!![]})[_0xb6df('0x5e')]();_0x3f41b1['on'](_0xb6df('0x5f'),function(){if(!fs['existsSync'](_0x535636)){throw new db[(_0xb6df('0x56'))][(_0xb6df('0x57'))](_0xb6df('0x60'));}return _0x42b54b[_0xb6df('0x4d')](_0x535636,util[_0xb6df('0x50')](_0xb6df('0x51'),path[_0xb6df('0x52')](_0x3f8278[_0xb6df('0x7')])),function(_0x55fd03){if(_0x55fd03){throw new db[(_0xb6df('0x56'))][(_0xb6df('0x57'))](_0xb6df('0x61'));}fs[_0xb6df('0x62')](_0x535636);logger[_0xb6df('0x63')](_0xb6df('0x64'));logger['info'](_0xb6df('0x65'));});});}return null;})[_0xb6df('0x48')](handleError(_0x42b54b,null));};exports['upload']=function(_0x2d16cc,_0x407ea4,_0xc519e4){var _0x7bf787=path['basename'](_0x2d16cc[_0xb6df('0x66')]['filename'],path[_0xb6df('0x67')](_0x2d16cc[_0xb6df('0x66')][_0xb6df('0x68')]));var _0x243a44=path['join'](config[_0xb6df('0x4e')],_0xb6df('0x4f'),_0x2d16cc[_0xb6df('0x66')][_0xb6df('0x68')]);var _0x4c4c7e=path[_0xb6df('0x5b')](config['root'],_0xb6df('0x4f'),_0x7bf787);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x243a44);logger['info'](_0xb6df('0x69'),_0x4c4c7e);try{fs[_0xb6df('0x6a')](_0x243a44,parseInt(_0xb6df('0x6b'),0x8));extract(_0x243a44,{'dir':_0x4c4c7e},function(_0x50f2ce){if(_0x50f2ce){logger[_0xb6df('0x6c')](_0x50f2ce);handleError(_0x50f2ce,!![]);};var _0xdf54a5=fs[_0xb6df('0x6d')](_0x4c4c7e);if(_0xdf54a5[_0xb6df('0x3d')]>0x1){removeReferences(_0x243a44,_0x4c4c7e);logger[_0xb6df('0x6c')](_0xb6df('0x6e'));return _0xc519e4(new Error(_0xb6df('0x6e')));}var _0x2514ee=fs[_0xb6df('0x6f')](path[_0xb6df('0x5b')](_0x4c4c7e,_0xdf54a5[0x0]));if(_0x2514ee[_0xb6df('0x70')]()){removeReferences(_0x243a44,_0x4c4c7e);logger[_0xb6df('0x6c')](_0xb6df('0x6e'));return _0xc519e4(new Error(_0xb6df('0x6e')));}if(_0x2514ee[_0xb6df('0x71')]()){var _0x49ef23=fs[_0xb6df('0x6d')](path[_0xb6df('0x5b')](_0x4c4c7e,_0xdf54a5[0x0]));if(_0x49ef23['length']===0x0){removeReferences(_0x243a44,_0x4c4c7e);logger['error'](_0xb6df('0x6e'));return _0xc519e4(new Error(_0xb6df('0x6e')));}var _0x18bdc3=_0x49ef23[_0xb6df('0x72')](function(_0x2a7c08){return _0x2a7c08==='manifest.json';});if(!_0x18bdc3){return _0xc519e4(new Error(_0xb6df('0x73')));}var _0x376ca0=fs[_0xb6df('0x74')](path[_0xb6df('0x5b')](_0x4c4c7e,_0xdf54a5[0x0],'manifest.json'));var _0x26a51b=JSON[_0xb6df('0x75')](_0x376ca0);if('undefined'==typeof _0x26a51b[_0xb6df('0x2f')]){return _0xc519e4(new Error(_0xb6df('0x76')));}if(_0xb6df('0x21')==typeof _0x26a51b[_0xb6df('0x44')]){return _0xc519e4(new Error(_0xb6df('0x77')));}if(_0xb6df('0x21')==typeof _0x26a51b['version']){return _0xc519e4(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xb6df('0x21')==typeof _0x26a51b['parameters']){return _0xc519e4(new Error(_0xb6df('0x78')));}if(_0x26a51b['type']==='html'){if(_0xb6df('0x21')==typeof _0x26a51b['parameters'][_0xb6df('0x79')]){return _0xc519e4(new Error(_0xb6df('0x7a')));}if(_0xb6df('0x21')==typeof _0x26a51b[_0xb6df('0x7b')]['views'][_0xb6df('0x7c')]&&'undefined'==typeof _0x26a51b['parameters'][_0xb6df('0x79')][_0xb6df('0x7d')]){return _0xc519e4(new Error(_0xb6df('0x7e')));}}else if(_0x26a51b[_0xb6df('0x44')]==='script'){if(_0xb6df('0x21')==typeof _0x26a51b[_0xb6df('0x7b')]['scriptName']){return _0xc519e4(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xb6df('0x21')==typeof _0x26a51b['parameters'][_0xb6df('0x7f')]){return _0xc519e4(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0xc519e4(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x2944c6=_0x26a51b['name'];var _0x50721d=_0x26a51b[_0xb6df('0x80')];var _0x4ef442=_0x26a51b[_0xb6df('0x44')];var _0x4d88e3=_0x26a51b['sidebar']?_0x26a51b[_0xb6df('0x81')]:_0xb6df('0x82');var _0x552b84=_0x26a51b['icon']?_0x26a51b[_0xb6df('0x83')]:_0xb6df('0x84');var _0x4967a9='';var _0x4d20dd='';var _0x2e0447='';var _0x1655b9='';var _0x21044f=_0x26a51b[_0xb6df('0x85')];if(_0x4ef442===_0xb6df('0x86')){if(_0xb6df('0x21')!=typeof _0x26a51b['parameters'][_0xb6df('0x79')][_0xb6df('0x7c')]){var _0x15f443=_0x26a51b[_0xb6df('0x7b')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x15f443)){_0x4967a9=path[_0xb6df('0x5b')](_0xb6df('0x87'),_0x7bf787,_0xdf54a5[0x0],_0x15f443);}else{_0x4967a9=_0x15f443;}}else{logger[_0xb6df('0x63')](_0xb6df('0x88'));}if('undefined'!=typeof _0x26a51b[_0xb6df('0x7b')][_0xb6df('0x79')][_0xb6df('0x7d')]){var _0x4467e2=_0x26a51b[_0xb6df('0x7b')]['views'][_0xb6df('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4467e2)){_0x4d20dd=path[_0xb6df('0x5b')]('plugins',_0x7bf787,_0xdf54a5[0x0],_0x4467e2);}else{_0x4d20dd=_0x4467e2;}}else{logger[_0xb6df('0x63')](_0xb6df('0x89'));}}else if(_0x4ef442===_0xb6df('0x8a')){_0x2e0447=_0x26a51b[_0xb6df('0x7b')][_0xb6df('0x8b')];_0x1655b9=_0x26a51b[_0xb6df('0x7b')][_0xb6df('0x7f')];if(_0xb6df('0x21')!=typeof _0x26a51b[_0xb6df('0x7b')][_0xb6df('0x79')]){if(_0xb6df('0x21')!=typeof _0x26a51b[_0xb6df('0x7b')]['views']['admin']){var _0x15f443=_0x26a51b['parameters'][_0xb6df('0x79')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xb6df('0x8c')](_0x15f443)){_0x4967a9=path[_0xb6df('0x5b')](_0xb6df('0x87'),_0x7bf787,_0xdf54a5[0x0],_0x15f443);}else{_0x4967a9=_0x15f443;}}if(_0xb6df('0x21')!=typeof _0x26a51b[_0xb6df('0x7b')][_0xb6df('0x79')][_0xb6df('0x7d')]){var _0x4467e2=_0x26a51b['parameters'][_0xb6df('0x79')][_0xb6df('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xb6df('0x8c')](_0x4467e2)){_0x4d20dd=path[_0xb6df('0x5b')](_0xb6df('0x87'),_0x7bf787,_0xdf54a5[0x0],_0x4467e2);}else{_0x4d20dd=_0x4467e2;}}}}var _0x26be7a={'name':_0x2944c6,'description':_0x50721d,'path':path[_0xb6df('0x5b')](_0x7bf787,_0xdf54a5[0x0]),'type':_0x4ef442,'sidebar':_0x4d88e3,'icon':_0x552b84,'adminUrl':_0x4967a9,'agentUrl':_0x4d20dd,'scriptName':_0x2e0447,'scriptPath':_0x1655b9,'version':_0x21044f};removeReferences(_0x243a44,null);return db[_0xb6df('0x32')]['create'](_0x26be7a)['then'](function(_0x21eac1){var _0x3c46a={'role':_0x2d16cc[_0xb6df('0x8d')][_0xb6df('0x8e')],'userProfileId':_0x2d16cc[_0xb6df('0x8d')][_0xb6df('0x8f')]};if(!_0x3c46a)throw new Error(_0xb6df('0x90'));if(_0x3c46a[_0xb6df('0x8e')]==='user'){var _0x507ded=_0x21eac1[_0xb6df('0x2c')]({'plain':!![]});return db[_0xb6df('0x91')][_0xb6df('0x4c')]({'where':{'name':_0xb6df('0x92'),'userProfileId':_0x3c46a[_0xb6df('0x8f')]},'raw':!![]})[_0xb6df('0x2a')](function(_0x24564a){if(_0x24564a&&_0x24564a[_0xb6df('0x93')]===0x0){return db[_0xb6df('0x2d')][_0xb6df('0x94')]({'name':_0x507ded[_0xb6df('0x2f')],'resourceId':_0x507ded['id'],'type':_0x24564a[_0xb6df('0x2f')],'sectionId':_0x24564a['id']},{})[_0xb6df('0x2a')](function(){return _0x21eac1;});}else{return _0x21eac1;}})[_0xb6df('0x48')](function(_0x535a26){logger['error'](_0xb6df('0x95'),_0x535a26);throw _0x535a26;});}return _0x21eac1;})['then'](respondWithResult(_0x407ea4,null))[_0xb6df('0x48')](handleError(_0x407ea4,null));}});}catch(_0x562bc1){_0x407ea4[_0xb6df('0x1e')](0x1f4)[_0xb6df('0x30')](_0x562bc1);}};function removeReferences(_0x1f4b4e,_0x3c5018){try{if(_0x1f4b4e){fs[_0xb6df('0x62')](_0x1f4b4e);logger[_0xb6df('0x63')](_0xb6df('0x96'));}if(_0x3c5018){rimraf(_0x3c5018,function(){});logger[_0xb6df('0x63')](_0xb6df('0x97'));}}catch(_0x30b36e){logger[_0xb6df('0x6c')](_0x30b36e);}}exports[_0xb6df('0x29')]=function(_0x384eb1,_0x4507a4,_0x342d5d){return db[_0xb6df('0x32')][_0xb6df('0x4c')]({'where':{'id':_0x384eb1[_0xb6df('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4507a4,null))[_0xb6df('0x2a')](saveUpdates(_0x384eb1[_0xb6df('0x8d')],null))[_0xb6df('0x2a')](respondWithResult(_0x4507a4,null))[_0xb6df('0x48')](handleError(_0x4507a4,null));};exports[_0xb6df('0x98')]=function(_0x4c73eb,_0x1ed43b,_0x1a971c){return db[_0xb6df('0x32')][_0xb6df('0x4c')]({'where':{'id':_0x4c73eb[_0xb6df('0x4a')]['id']}})[_0xb6df('0x2a')](function(_0x2a3047){if(_0x2a3047){return _0x2a3047[_0xb6df('0x2b')]();}})[_0xb6df('0x2a')](function(_0x3f1d3e){rimraf(path['join'](config[_0xb6df('0x4e')],_0xb6df('0x4f'),path[_0xb6df('0x5c')](_0x3f1d3e[_0xb6df('0x7')])),function(){});return _0x3f1d3e;})[_0xb6df('0x2a')](handleEntityNotFound(_0x1ed43b,null))[_0xb6df('0x2a')](respondWithStatusCode(_0x1ed43b,null))[_0xb6df('0x48')](handleError(_0x1ed43b,null));};exports['webhookGet']=function(_0x5ecd5d,_0x5a918c,_0x49605e){return BPromise[_0xb6df('0x99')]()[_0xb6df('0x2a')](function(){if(!_0x5ecd5d['query'][_0xb6df('0x7')]){throw new Error(_0xb6df('0x9a'));}if(!_0x5ecd5d['query'][_0xb6df('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x388236=_0x5ecd5d[_0xb6df('0x37')]['hostname']?_0x5ecd5d[_0xb6df('0x37')][_0xb6df('0x9c')]+':'+_0x5ecd5d[_0xb6df('0x37')]['port']:_0xb6df('0x9d')+_0x5ecd5d[_0xb6df('0x37')][_0xb6df('0x9b')];var _0x741b3=_0x5ecd5d[_0xb6df('0x37')][_0xb6df('0x20')]?_0x5ecd5d[_0xb6df('0x37')][_0xb6df('0x20')]:!![];var _0x1ce902=_0x5ecd5d['query']['encoding']?_0x5ecd5d[_0xb6df('0x37')][_0xb6df('0x9e')]:null;var _0x32f26a={'method':_0x5ecd5d[_0xb6df('0x9f')],'uri':util[_0xb6df('0x50')](_0xb6df('0xa0'),_0x388236,_0x5ecd5d['query'][_0xb6df('0x7')]),'json':_0x741b3,'resolveWithFullResponse':!![],'encoding':_0x1ce902,'qs':_0x5ecd5d['query']};if(_0x5ecd5d[_0xb6df('0xa1')]){_0x32f26a[_0xb6df('0xa1')]=_0x5ecd5d[_0xb6df('0xa1')];if(_0x32f26a['headers'][_0xb6df('0xa2')]){delete _0x32f26a[_0xb6df('0xa1')]['content-length'];}}if(_0x32f26a[_0xb6df('0xa1')][_0xb6df('0xa3')]){delete _0x32f26a[_0xb6df('0xa1')][_0xb6df('0xa3')];}return rp(_0x32f26a);})['then'](function(_0x3d6cf1){if(_0x3d6cf1){_0x5a918c[_0xb6df('0x25')](_0x3d6cf1['headers']);logger[_0xb6df('0x63')](_0x3d6cf1[_0xb6df('0x8d')]);if(_[_0xb6df('0xa4')](_0x5ecd5d[_0xb6df('0x37')][_0xb6df('0x7')],_0xb6df('0x4d'))&&_0x3d6cf1['statusCode']==0x1f4){return _0x5a918c[_0xb6df('0x1d')](_0x3d6cf1[_0xb6df('0xa5')]);}else{return _0x5a918c[_0xb6df('0x1e')](_0x3d6cf1['statusCode'])[_0xb6df('0x30')](_0x3d6cf1[_0xb6df('0x8d')]);}}else{return _0x5a918c[_0xb6df('0x1d')](0xc8);}})['catch'](handleError(_0x5a918c,null));};exports[_0xb6df('0xa6')]=function(_0x1f238f,_0x26cfea,_0x34f10a){return BPromise['resolve']()['then'](function(){if(!_0x1f238f[_0xb6df('0x37')][_0xb6df('0x7')]){throw new Error(_0xb6df('0x9a'));}if(!_0x1f238f[_0xb6df('0x37')][_0xb6df('0x9b')]){throw new Error(_0xb6df('0xa7'));}var _0x4fe309=_0x1f238f[_0xb6df('0x37')][_0xb6df('0x9c')]?_0x1f238f['query'][_0xb6df('0x9c')]+':'+_0x1f238f[_0xb6df('0x37')][_0xb6df('0x9b')]:_0xb6df('0x9d')+_0x1f238f[_0xb6df('0x37')][_0xb6df('0x9b')];var _0x545e37=_0x1f238f[_0xb6df('0x37')][_0xb6df('0x20')]?_0x1f238f[_0xb6df('0x37')][_0xb6df('0x20')]:!![];var _0x5d83fd=_0x1f238f[_0xb6df('0x37')]['encoding']?_0x1f238f[_0xb6df('0x37')][_0xb6df('0x9e')]:null;var _0x283cea={'method':_0x1f238f[_0xb6df('0x9f')],'uri':util['format']('%s%s',_0x4fe309,_0x1f238f[_0xb6df('0x37')]['path']),'json':_0x545e37,'resolveWithFullResponse':!![],'encoding':_0x5d83fd,'body':_0x1f238f[_0xb6df('0x8d')]};if(_0x1f238f[_0xb6df('0xa1')]){_0x283cea[_0xb6df('0xa1')]=_0x1f238f['headers'];if(_0x283cea[_0xb6df('0xa1')]['content-length']){delete _0x283cea[_0xb6df('0xa1')][_0xb6df('0xa2')];}}if(_0x283cea[_0xb6df('0xa1')]['content-type']){delete _0x283cea[_0xb6df('0xa1')][_0xb6df('0xa3')];}return rp(_0x283cea);})['then'](function(_0x574981){if(_0x574981){_0x26cfea[_0xb6df('0x25')](_0x574981[_0xb6df('0xa1')]);logger['info'](_0x574981['body']);return _0x26cfea[_0xb6df('0x1e')](_0x574981[_0xb6df('0xa5')])[_0xb6df('0x30')](_0x574981[_0xb6df('0x8d')]);}else{return _0x26cfea[_0xb6df('0x1d')](0xc8);}})['catch'](handleError(_0x26cfea,null));}; \ No newline at end of file +var _0x7cff=['icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','endsWith','statusCode','content-type','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','Plugin','include','findAll','params','includeAll','options','find','catch','download','join','root','server/files/plugins','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','extname','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','readdirSync','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon'];(function(_0x50cbab,_0x1c8b8a){var _0x19e6d3=function(_0x26e14c){while(--_0x26e14c){_0x50cbab['push'](_0x50cbab['shift']());}};_0x19e6d3(++_0x1c8b8a);}(_0x7cff,0x179));var _0xf7cf=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7cff[_0x465a0c];return _0x1e202e;};'use strict';var emlformat=require(_0xf7cf('0x0'));var rimraf=require(_0xf7cf('0x1'));var zipdir=require(_0xf7cf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7cf('0x3'));var moment=require(_0xf7cf('0x4'));var BPromise=require(_0xf7cf('0x5'));var Mustache=require(_0xf7cf('0x6'));var util=require(_0xf7cf('0x7'));var path=require(_0xf7cf('0x8'));var sox=require(_0xf7cf('0x9'));var csv=require(_0xf7cf('0xa'));var ejs=require(_0xf7cf('0xb'));var fs=require('fs');var fs_extra=require(_0xf7cf('0xc'));var _=require('lodash');var squel=require(_0xf7cf('0xd'));var crypto=require('crypto');var jsforce=require(_0xf7cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf7cf('0xa'));var querystring=require(_0xf7cf('0xf'));var Papa=require('papaparse');var extract=require(_0xf7cf('0x10'));var rimraf=require(_0xf7cf('0x1'));var archiver=require(_0xf7cf('0x11'));var Redis=require(_0xf7cf('0x12'));var authService=require(_0xf7cf('0x13'));var qs=require(_0xf7cf('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7cf('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xf7cf('0x16'));var config=require(_0xf7cf('0x17'));var licenseUtil=require(_0xf7cf('0x18'));var db=require(_0xf7cf('0x19'))['db'];config['redis']=_[_0xf7cf('0x1a')](config[_0xf7cf('0x1b')],{'host':_0xf7cf('0x1c'),'port':0x18eb});var socket=require(_0xf7cf('0x1d'))(new Redis(config[_0xf7cf('0x1b')]));require('./plugin.socket')[_0xf7cf('0x1e')](socket);function respondWithStatusCode(_0xf3b66d,_0xa943b6){_0xa943b6=_0xa943b6||0xcc;return function(_0x36eb14){if(_0x36eb14){return _0xf3b66d[_0xf7cf('0x1f')](_0xa943b6);}return _0xf3b66d[_0xf7cf('0x20')](_0xa943b6)[_0xf7cf('0x21')]();};}function respondWithResult(_0x19553c,_0x2e44cf){_0x2e44cf=_0x2e44cf||0xc8;return function(_0x229935){if(_0x229935){return _0x19553c[_0xf7cf('0x20')](_0x2e44cf)[_0xf7cf('0x22')](_0x229935);}};}function respondWithFilteredResult(_0x4d360c,_0x3ea4a2){return function(_0x3e6472){if(_0x3e6472){var _0x107c17=typeof _0x3ea4a2['offset']===_0xf7cf('0x23')&&typeof _0x3ea4a2[_0xf7cf('0x24')]==='undefined';var _0x56dfe2=_0x3e6472['count'];var _0x41c01f=_0x107c17?0x0:_0x3ea4a2['offset'];var _0x40465d=_0x107c17?_0x3e6472[_0xf7cf('0x25')]:_0x3ea4a2['offset']+_0x3ea4a2[_0xf7cf('0x24')];var _0x25f02a;if(_0x40465d>=_0x56dfe2){_0x40465d=_0x56dfe2;_0x25f02a=0xc8;}else{_0x25f02a=0xce;}_0x4d360c[_0xf7cf('0x20')](_0x25f02a);return _0x4d360c[_0xf7cf('0x26')]('Content-Range',_0x41c01f+'-'+_0x40465d+'/'+_0x56dfe2)[_0xf7cf('0x22')](_0x3e6472);}return null;};}function patchUpdates(_0x5cd9b9){return function(_0x190aa3){try{jsonpatch[_0xf7cf('0x27')](_0x190aa3,_0x5cd9b9,!![]);}catch(_0x8599ae){return BPromise[_0xf7cf('0x28')](_0x8599ae);}return _0x190aa3[_0xf7cf('0x29')]();};}function saveUpdates(_0x182972,_0x196ffb){return function(_0x1414c3){if(_0x1414c3){return _0x1414c3[_0xf7cf('0x2a')](_0x182972)[_0xf7cf('0x2b')](function(_0x33ac4a){return _0x33ac4a;});}return null;};}function removeEntity(_0x5637d1,_0x4b5f22){return function(_0x4d6be7){if(_0x4d6be7){return _0x4d6be7[_0xf7cf('0x2c')]()[_0xf7cf('0x2b')](function(){var _0x275019=_0x4d6be7[_0xf7cf('0x2d')]({'plain':!![]});var _0x3d29ac=_0xf7cf('0x2e');return db[_0xf7cf('0x2f')][_0xf7cf('0x2c')]({'where':{'type':_0x3d29ac,'resourceId':_0x275019['id']}})['then'](function(){return _0x4d6be7;});})[_0xf7cf('0x2b')](function(){_0x5637d1[_0xf7cf('0x20')](0xcc)[_0xf7cf('0x21')]();});}};}function handleEntityNotFound(_0x2fbf91,_0xc14d3d){return function(_0x57ba29){if(!_0x57ba29){_0x2fbf91[_0xf7cf('0x1f')](0x194);}return _0x57ba29;};}function handleError(_0x409b86,_0x5a5db5){_0x5a5db5=_0x5a5db5||0x1f4;return function(_0x587e90){logger[_0xf7cf('0x30')](_0x587e90[_0xf7cf('0x31')]);if(_0x587e90[_0xf7cf('0x32')]){delete _0x587e90[_0xf7cf('0x32')];}_0x409b86['status'](_0x5a5db5)[_0xf7cf('0x33')](_0x587e90);};}exports[_0xf7cf('0x34')]=function(_0x5dbb75,_0x24f9ad){var _0x2c457e={},_0x56966b={},_0x5c7c26={'count':0x0,'rows':[]};var _0x39260b=_[_0xf7cf('0x35')](db['Plugin'][_0xf7cf('0x36')],function(_0x394ee1){return{'name':_0x394ee1[_0xf7cf('0x37')],'type':_0x394ee1[_0xf7cf('0x38')][_0xf7cf('0x39')]};});_0x56966b[_0xf7cf('0x3a')]=_['map'](_0x39260b,_0xf7cf('0x32'));_0x56966b[_0xf7cf('0x3b')]=_[_0xf7cf('0x3c')](_0x5dbb75[_0xf7cf('0x3b')]);_0x56966b['filters']=_[_0xf7cf('0x3d')](_0x56966b[_0xf7cf('0x3a')],_0x56966b['query']);_0x2c457e[_0xf7cf('0x3e')]=_[_0xf7cf('0x3d')](_0x56966b[_0xf7cf('0x3a')],qs[_0xf7cf('0x3f')](_0x5dbb75[_0xf7cf('0x3b')]['fields']));_0x2c457e[_0xf7cf('0x3e')]=_0x2c457e[_0xf7cf('0x3e')][_0xf7cf('0x40')]?_0x2c457e[_0xf7cf('0x3e')]:_0x56966b['model'];if(!_0x5dbb75[_0xf7cf('0x3b')][_0xf7cf('0x41')](_0xf7cf('0x42'))){_0x2c457e[_0xf7cf('0x24')]=qs['limit'](_0x5dbb75[_0xf7cf('0x3b')]['limit']);_0x2c457e['offset']=qs[_0xf7cf('0x43')](_0x5dbb75[_0xf7cf('0x3b')][_0xf7cf('0x43')]);}_0x2c457e[_0xf7cf('0x44')]=qs[_0xf7cf('0x45')](_0x5dbb75['query'][_0xf7cf('0x45')]);_0x2c457e[_0xf7cf('0x46')]=qs[_0xf7cf('0x47')](_[_0xf7cf('0x48')](_0x5dbb75['query'],_0x56966b[_0xf7cf('0x47')]),_0x39260b);if(_0x5dbb75[_0xf7cf('0x3b')][_0xf7cf('0x49')]){_0x2c457e[_0xf7cf('0x46')]=_[_0xf7cf('0x4a')](_0x2c457e['where'],{'$or':_[_0xf7cf('0x35')](_0x39260b,function(_0x228f3c){if(_0x228f3c[_0xf7cf('0x38')]!==_0xf7cf('0x4b')){var _0x279874={};_0x279874[_0x228f3c['name']]={'$like':'%'+_0x5dbb75[_0xf7cf('0x3b')]['filter']+'%'};return _0x279874;}})});}_0x2c457e=_[_0xf7cf('0x4a')]({},_0x2c457e,_0x5dbb75['options']);var _0x336460={'where':_0x2c457e['where']};return db[_0xf7cf('0x4c')][_0xf7cf('0x25')](_0x336460)[_0xf7cf('0x2b')](function(_0x4a5785){_0x5c7c26['count']=_0x4a5785;if(_0x5dbb75[_0xf7cf('0x3b')]['includeAll']){_0x2c457e[_0xf7cf('0x4d')]=[{'all':!![]}];}return db[_0xf7cf('0x4c')][_0xf7cf('0x4e')](_0x2c457e);})['then'](function(_0x5e728c){_0x5c7c26['rows']=_0x5e728c;return _0x5c7c26;})[_0xf7cf('0x2b')](respondWithFilteredResult(_0x24f9ad,_0x2c457e))['catch'](handleError(_0x24f9ad,null));};exports['show']=function(_0x18396e,_0x511e5b){var _0x1428cd={'raw':!![],'where':{'id':_0x18396e[_0xf7cf('0x4f')]['id']}},_0x5db75e={};_0x5db75e['model']=_[_0xf7cf('0x3c')](db['Plugin'][_0xf7cf('0x36')]);_0x5db75e[_0xf7cf('0x3b')]=_[_0xf7cf('0x3c')](_0x18396e[_0xf7cf('0x3b')]);_0x5db75e[_0xf7cf('0x47')]=_[_0xf7cf('0x3d')](_0x5db75e[_0xf7cf('0x3a')],_0x5db75e[_0xf7cf('0x3b')]);_0x1428cd['attributes']=_['intersection'](_0x5db75e[_0xf7cf('0x3a')],qs[_0xf7cf('0x3f')](_0x18396e['query'][_0xf7cf('0x3f')]));_0x1428cd[_0xf7cf('0x3e')]=_0x1428cd[_0xf7cf('0x3e')]['length']?_0x1428cd[_0xf7cf('0x3e')]:_0x5db75e[_0xf7cf('0x3a')];if(_0x18396e[_0xf7cf('0x3b')][_0xf7cf('0x50')]){_0x1428cd['include']=[{'all':!![]}];}_0x1428cd=_['merge']({},_0x1428cd,_0x18396e[_0xf7cf('0x51')]);return db[_0xf7cf('0x4c')][_0xf7cf('0x52')](_0x1428cd)['then'](handleEntityNotFound(_0x511e5b,null))[_0xf7cf('0x2b')](respondWithResult(_0x511e5b,null))[_0xf7cf('0x53')](handleError(_0x511e5b,null));};exports[_0xf7cf('0x54')]=function(_0xd92dd9,_0x265ffe,_0x19a653){return db[_0xf7cf('0x4c')][_0xf7cf('0x52')]({'where':{'id':_0xd92dd9[_0xf7cf('0x4f')]['id']},'attributes':[_0xf7cf('0x32'),'path'],'raw':!![]})[_0xf7cf('0x2b')](handleEntityNotFound(_0x265ffe,null))[_0xf7cf('0x2b')](function(_0x4efc69){if(_0x4efc69){var _0x454e68=path[_0xf7cf('0x55')](config[_0xf7cf('0x56')],_0xf7cf('0x57'),util['format'](_0xf7cf('0x58'),path[_0xf7cf('0x59')](_0x4efc69['path'])));var _0x5845f7=fs[_0xf7cf('0x5a')](_0x454e68);var _0x2c999f=archiver('zip',{'zlib':{'level':0x9}});_0x2c999f['on'](_0xf7cf('0x5b'),function(_0x598aaf){if(_0x598aaf[_0xf7cf('0x5c')]===_0xf7cf('0x5d')){logger[_0xf7cf('0x30')](_0x598aaf);}else{throw new db[(_0xf7cf('0x5e'))][(_0xf7cf('0x5f'))](_0xf7cf('0x60'));}});_0x2c999f['on'](_0xf7cf('0x30'),function(_0x220e3d){throw new db[(_0xf7cf('0x5e'))][(_0xf7cf('0x5f'))](_0xf7cf('0x60'));});_0x2c999f[_0xf7cf('0x61')](_0x5845f7);_0x2c999f[_0xf7cf('0x62')](_0xf7cf('0x63'),{'cwd':path[_0xf7cf('0x55')](config['root'],_0xf7cf('0x57'),path['dirname'](_0x4efc69['path'])),'ignore':[path[_0xf7cf('0x55')](path['basename'](_0x4efc69[_0xf7cf('0x8')]),_0xf7cf('0x64')),path[_0xf7cf('0x55')](path['basename'](_0x4efc69['path']),_0xf7cf('0x65'))],'nodir':!![]})[_0xf7cf('0x66')]();_0x5845f7['on']('close',function(){if(!fs[_0xf7cf('0x67')](_0x454e68)){throw new db[(_0xf7cf('0x5e'))]['Error'](_0xf7cf('0x68'));}return _0x265ffe['download'](_0x454e68,util[_0xf7cf('0x69')](_0xf7cf('0x58'),path['basename'](_0x4efc69[_0xf7cf('0x8')])),function(_0x7b2278){if(_0x7b2278){throw new db['Sequelize'][(_0xf7cf('0x5f'))](_0xf7cf('0x6a'));}fs[_0xf7cf('0x6b')](_0x454e68);logger['info']('Download\x20completed');logger[_0xf7cf('0x6c')](_0xf7cf('0x6d'));});});}return null;})[_0xf7cf('0x53')](handleError(_0x265ffe,null));};exports[_0xf7cf('0x6e')]=function(_0x8f98c7,_0x39b86d,_0x504682){var _0x5cd237=path['basename'](_0x8f98c7['file']['filename'],path[_0xf7cf('0x6f')](_0x8f98c7[_0xf7cf('0x70')][_0xf7cf('0x71')]));var _0x497cb3=path['join'](config[_0xf7cf('0x56')],_0xf7cf('0x57'),_0x8f98c7[_0xf7cf('0x70')][_0xf7cf('0x71')]);var _0x1763b0=path[_0xf7cf('0x55')](config[_0xf7cf('0x56')],_0xf7cf('0x57'),_0x5cd237);logger[_0xf7cf('0x6c')](_0xf7cf('0x72'),_0x497cb3);logger[_0xf7cf('0x6c')](_0xf7cf('0x73'),_0x1763b0);try{fs[_0xf7cf('0x74')](_0x497cb3,parseInt(_0xf7cf('0x75'),0x8));extract(_0x497cb3,{'dir':_0x1763b0},function(_0x2ee484){if(_0x2ee484){logger['error'](_0x2ee484);handleError(_0x2ee484,!![]);};var _0x539895=fs['readdirSync'](_0x1763b0);if(_0x539895['length']>0x1){removeReferences(_0x497cb3,_0x1763b0);logger[_0xf7cf('0x30')](_0xf7cf('0x76'));return _0x504682(new Error('Invalid\x20plugin\x20structure'));}var _0x12bcfd=fs[_0xf7cf('0x77')](path[_0xf7cf('0x55')](_0x1763b0,_0x539895[0x0]));if(_0x12bcfd[_0xf7cf('0x78')]()){removeReferences(_0x497cb3,_0x1763b0);logger[_0xf7cf('0x30')](_0xf7cf('0x76'));return _0x504682(new Error(_0xf7cf('0x76')));}if(_0x12bcfd['isDirectory']()){var _0x2185c3=fs[_0xf7cf('0x79')](path[_0xf7cf('0x55')](_0x1763b0,_0x539895[0x0]));if(_0x2185c3['length']===0x0){removeReferences(_0x497cb3,_0x1763b0);logger[_0xf7cf('0x30')](_0xf7cf('0x76'));return _0x504682(new Error(_0xf7cf('0x76')));}var _0x2dc404=_0x2185c3['some'](function(_0x2b4695){return _0x2b4695===_0xf7cf('0x7a');});if(!_0x2dc404){return _0x504682(new Error(_0xf7cf('0x7b')));}var _0x4a526d=fs['readFileSync'](path[_0xf7cf('0x55')](_0x1763b0,_0x539895[0x0],_0xf7cf('0x7a')));var _0x4900db=JSON[_0xf7cf('0x7c')](_0x4a526d);if(_0xf7cf('0x23')==typeof _0x4900db[_0xf7cf('0x32')]){return _0x504682(new Error(_0xf7cf('0x7d')));}if(_0xf7cf('0x23')==typeof _0x4900db[_0xf7cf('0x38')]){return _0x504682(new Error(_0xf7cf('0x7e')));}if(_0xf7cf('0x23')==typeof _0x4900db[_0xf7cf('0x7f')]){return _0x504682(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xf7cf('0x23')==typeof _0x4900db[_0xf7cf('0x80')]){return _0x504682(new Error(_0xf7cf('0x81')));}if(_0x4900db[_0xf7cf('0x38')]===_0xf7cf('0x82')){if(_0xf7cf('0x23')==typeof _0x4900db[_0xf7cf('0x80')][_0xf7cf('0x83')]){return _0x504682(new Error(_0xf7cf('0x84')));}if('undefined'==typeof _0x4900db['parameters'][_0xf7cf('0x83')][_0xf7cf('0x85')]&&_0xf7cf('0x23')==typeof _0x4900db['parameters'][_0xf7cf('0x83')][_0xf7cf('0x86')]){return _0x504682(new Error(_0xf7cf('0x87')));}}else if(_0x4900db[_0xf7cf('0x38')]===_0xf7cf('0x88')){if(_0xf7cf('0x23')==typeof _0x4900db[_0xf7cf('0x80')][_0xf7cf('0x89')]){return _0x504682(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xf7cf('0x23')==typeof _0x4900db['parameters'][_0xf7cf('0x8a')]){return _0x504682(new Error(_0xf7cf('0x8b')));}}else{return _0x504682(new Error(_0xf7cf('0x8c')));}var _0x171f63=_0x4900db[_0xf7cf('0x32')];var _0xb54e90=_0x4900db[_0xf7cf('0x8d')];var _0x1d9c76=_0x4900db['type'];var _0x419092=_0x4900db[_0xf7cf('0x8e')]?_0x4900db['sidebar']:_0xf7cf('0x8f');var _0x2105a9=_0x4900db[_0xf7cf('0x90')]?_0x4900db[_0xf7cf('0x90')]:_0xf7cf('0x91');var _0x29a2e9='';var _0x2ed671='';var _0x4207cc='';var _0x49bd83='';var _0x51121d=_0x4900db[_0xf7cf('0x7f')];if(_0x1d9c76==='html'){if(_0xf7cf('0x23')!=typeof _0x4900db['parameters'][_0xf7cf('0x83')][_0xf7cf('0x85')]){var _0x3f9926=_0x4900db[_0xf7cf('0x80')][_0xf7cf('0x83')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xf7cf('0x92')](_0x3f9926)){_0x29a2e9=path[_0xf7cf('0x55')](_0xf7cf('0x93'),_0x5cd237,_0x539895[0x0],_0x3f9926);}else{_0x29a2e9=_0x3f9926;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xf7cf('0x23')!=typeof _0x4900db['parameters'][_0xf7cf('0x83')]['agent']){var _0x1d820e=_0x4900db['parameters'][_0xf7cf('0x83')][_0xf7cf('0x86')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1d820e)){_0x2ed671=path[_0xf7cf('0x55')](_0xf7cf('0x93'),_0x5cd237,_0x539895[0x0],_0x1d820e);}else{_0x2ed671=_0x1d820e;}}else{logger['info'](_0xf7cf('0x94'));}}else if(_0x1d9c76===_0xf7cf('0x88')){_0x4207cc=_0x4900db[_0xf7cf('0x80')]['scriptName'];_0x49bd83=_0x4900db[_0xf7cf('0x80')][_0xf7cf('0x8a')];if(_0xf7cf('0x23')!=typeof _0x4900db['parameters'][_0xf7cf('0x83')]){if(_0xf7cf('0x23')!=typeof _0x4900db['parameters']['views'][_0xf7cf('0x85')]){var _0x3f9926=_0x4900db['parameters'][_0xf7cf('0x83')][_0xf7cf('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3f9926)){_0x29a2e9=path[_0xf7cf('0x55')](_0xf7cf('0x93'),_0x5cd237,_0x539895[0x0],_0x3f9926);}else{_0x29a2e9=_0x3f9926;}}if(_0xf7cf('0x23')!=typeof _0x4900db[_0xf7cf('0x80')]['views'][_0xf7cf('0x86')]){var _0x1d820e=_0x4900db[_0xf7cf('0x80')][_0xf7cf('0x83')][_0xf7cf('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xf7cf('0x92')](_0x1d820e)){_0x2ed671=path[_0xf7cf('0x55')]('plugins',_0x5cd237,_0x539895[0x0],_0x1d820e);}else{_0x2ed671=_0x1d820e;}}}}var _0x12c09e={'name':_0x171f63,'description':_0xb54e90,'path':path[_0xf7cf('0x55')](_0x5cd237,_0x539895[0x0]),'type':_0x1d9c76,'sidebar':_0x419092,'icon':_0x2105a9,'adminUrl':_0x29a2e9,'agentUrl':_0x2ed671,'scriptName':_0x4207cc,'scriptPath':_0x49bd83,'version':_0x51121d};removeReferences(_0x497cb3,null);return db[_0xf7cf('0x4c')][_0xf7cf('0x95')](_0x12c09e)['then'](function(_0x58fd73){var _0xe026dc={'role':_0x8f98c7[_0xf7cf('0x96')][_0xf7cf('0x97')],'userProfileId':_0x8f98c7['body'][_0xf7cf('0x98')]};if(!_0xe026dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe026dc[_0xf7cf('0x97')]===_0xf7cf('0x99')){var _0x488c67=_0x58fd73['get']({'plain':!![]});return db['UserProfileSection'][_0xf7cf('0x52')]({'where':{'name':_0xf7cf('0x2e'),'userProfileId':_0xe026dc[_0xf7cf('0x98')]},'raw':!![]})[_0xf7cf('0x2b')](function(_0x3ee42c){if(_0x3ee42c&&_0x3ee42c[_0xf7cf('0x9a')]===0x0){return db[_0xf7cf('0x2f')]['create']({'name':_0x488c67[_0xf7cf('0x32')],'resourceId':_0x488c67['id'],'type':_0x3ee42c['name'],'sectionId':_0x3ee42c['id']},{})[_0xf7cf('0x2b')](function(){return _0x58fd73;});}else{return _0x58fd73;}})[_0xf7cf('0x53')](function(_0x1d7070){logger[_0xf7cf('0x30')](_0xf7cf('0x9b'),_0x1d7070);throw _0x1d7070;});}return _0x58fd73;})[_0xf7cf('0x2b')](respondWithResult(_0x39b86d,null))[_0xf7cf('0x53')](handleError(_0x39b86d,null));}});}catch(_0x1dbe2c){_0x39b86d[_0xf7cf('0x20')](0x1f4)[_0xf7cf('0x33')](_0x1dbe2c);}};function removeReferences(_0x27eeb1,_0x2088f6){try{if(_0x27eeb1){fs[_0xf7cf('0x6b')](_0x27eeb1);logger['info'](_0xf7cf('0x9c'));}if(_0x2088f6){rimraf(_0x2088f6,function(){});logger[_0xf7cf('0x6c')](_0xf7cf('0x9d'));}}catch(_0x4a0387){logger[_0xf7cf('0x30')](_0x4a0387);}}exports[_0xf7cf('0x2a')]=function(_0x3fe93a,_0x19d33f,_0x3f38be){return db[_0xf7cf('0x4c')][_0xf7cf('0x52')]({'where':{'id':_0x3fe93a['params']['id']}})[_0xf7cf('0x2b')](handleEntityNotFound(_0x19d33f,null))[_0xf7cf('0x2b')](saveUpdates(_0x3fe93a[_0xf7cf('0x96')],null))['then'](respondWithResult(_0x19d33f,null))[_0xf7cf('0x53')](handleError(_0x19d33f,null));};exports[_0xf7cf('0x9e')]=function(_0x39f384,_0x379e2b,_0x54bf16){return db[_0xf7cf('0x4c')][_0xf7cf('0x52')]({'where':{'id':_0x39f384[_0xf7cf('0x4f')]['id']}})[_0xf7cf('0x2b')](function(_0x40d0f6){if(_0x40d0f6){return _0x40d0f6[_0xf7cf('0x2c')]();}})[_0xf7cf('0x2b')](function(_0x4b4a90){rimraf(path[_0xf7cf('0x55')](config[_0xf7cf('0x56')],_0xf7cf('0x57'),path['dirname'](_0x4b4a90[_0xf7cf('0x8')])),function(){});return _0x4b4a90;})[_0xf7cf('0x2b')](handleEntityNotFound(_0x379e2b,null))[_0xf7cf('0x2b')](respondWithStatusCode(_0x379e2b,null))['catch'](handleError(_0x379e2b,null));};exports[_0xf7cf('0x9f')]=function(_0x1bd94e,_0x4fdfbc,_0x44163e){return BPromise[_0xf7cf('0xa0')]()[_0xf7cf('0x2b')](function(){if(!_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0x8')]){throw new Error(_0xf7cf('0xa1'));}if(!_0x1bd94e[_0xf7cf('0x3b')]['port']){throw new Error(_0xf7cf('0xa2'));}var _0x707265=_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0xa3')]?_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0xa3')]+':'+_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0xa4')]:_0xf7cf('0xa5')+_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0xa4')];var _0x405129=_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0x22')]?_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0x22')]:!![];var _0xf29598=_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0xa6')]?_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0xa6')]:null;var _0x1ecb62={'method':_0x1bd94e[_0xf7cf('0xa7')],'uri':util['format'](_0xf7cf('0xa8'),_0x707265,_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0x8')]),'json':_0x405129,'resolveWithFullResponse':!![],'encoding':_0xf29598,'qs':_0x1bd94e[_0xf7cf('0x3b')]};if(_0x1bd94e[_0xf7cf('0xa9')]){_0x1ecb62['headers']=_0x1bd94e[_0xf7cf('0xa9')];if(_0x1ecb62[_0xf7cf('0xa9')][_0xf7cf('0xaa')]){delete _0x1ecb62[_0xf7cf('0xa9')][_0xf7cf('0xaa')];}}if(_0x1ecb62[_0xf7cf('0xa9')]['content-type']){delete _0x1ecb62['headers']['content-type'];}return rp(_0x1ecb62);})['then'](function(_0x501403){if(_0x501403){_0x4fdfbc[_0xf7cf('0x26')](_0x501403[_0xf7cf('0xa9')]);logger['info'](_0x501403[_0xf7cf('0x96')]);if(_[_0xf7cf('0xab')](_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0x8')],'download')&&_0x501403[_0xf7cf('0xac')]==0x1f4){return _0x4fdfbc[_0xf7cf('0x1f')](_0x501403[_0xf7cf('0xac')]);}else{return _0x4fdfbc[_0xf7cf('0x20')](_0x501403[_0xf7cf('0xac')])[_0xf7cf('0x33')](_0x501403[_0xf7cf('0x96')]);}}else{return _0x4fdfbc[_0xf7cf('0x1f')](0xc8);}})[_0xf7cf('0x53')](handleError(_0x4fdfbc,null));};exports['webhookPost']=function(_0xcce96c,_0x3fca48,_0x55011b){return BPromise[_0xf7cf('0xa0')]()[_0xf7cf('0x2b')](function(){if(!_0xcce96c['query']['path']){throw new Error(_0xf7cf('0xa1'));}if(!_0xcce96c[_0xf7cf('0x3b')][_0xf7cf('0xa4')]){throw new Error(_0xf7cf('0xa2'));}var _0x2970c7=_0xcce96c[_0xf7cf('0x3b')][_0xf7cf('0xa3')]?_0xcce96c[_0xf7cf('0x3b')]['hostname']+':'+_0xcce96c[_0xf7cf('0x3b')][_0xf7cf('0xa4')]:_0xf7cf('0xa5')+_0xcce96c[_0xf7cf('0x3b')][_0xf7cf('0xa4')];var _0x14056f=_0xcce96c[_0xf7cf('0x3b')]['json']?_0xcce96c['query'][_0xf7cf('0x22')]:!![];var _0x122054=_0xcce96c[_0xf7cf('0x3b')][_0xf7cf('0xa6')]?_0xcce96c[_0xf7cf('0x3b')][_0xf7cf('0xa6')]:null;var _0x1e3ec6={'method':_0xcce96c['method'],'uri':util[_0xf7cf('0x69')]('%s%s',_0x2970c7,_0xcce96c[_0xf7cf('0x3b')][_0xf7cf('0x8')]),'json':_0x14056f,'resolveWithFullResponse':!![],'encoding':_0x122054,'body':_0xcce96c[_0xf7cf('0x96')]};if(_0xcce96c[_0xf7cf('0xa9')]){_0x1e3ec6[_0xf7cf('0xa9')]=_0xcce96c['headers'];if(_0x1e3ec6[_0xf7cf('0xa9')]['content-length']){delete _0x1e3ec6[_0xf7cf('0xa9')][_0xf7cf('0xaa')];}}if(_0x1e3ec6['headers'][_0xf7cf('0xad')]){delete _0x1e3ec6['headers'][_0xf7cf('0xad')];}return rp(_0x1e3ec6);})['then'](function(_0x437784){if(_0x437784){_0x3fca48[_0xf7cf('0x26')](_0x437784[_0xf7cf('0xa9')]);logger['info'](_0x437784[_0xf7cf('0x96')]);return _0x3fca48['status'](_0x437784[_0xf7cf('0xac')])[_0xf7cf('0x33')](_0x437784[_0xf7cf('0x96')]);}else{return _0x3fca48[_0xf7cf('0x1f')](0xc8);}})[_0xf7cf('0x53')](handleError(_0x3fca48,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 239bbb6..e9bc7ff 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 _0x3595=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin'];(function(_0x597529,_0x174d44){var _0x25a47e=function(_0xf124c6){while(--_0xf124c6){_0x597529['push'](_0x597529['shift']());}};_0x25a47e(++_0x174d44);}(_0x3595,0x147));var _0x5359=function(_0x50b48d,_0x47aea2){_0x50b48d=_0x50b48d-0x0;var _0x42fcb5=_0x3595[_0x50b48d];return _0x42fcb5;};'use strict';var EventEmitter=require(_0x5359('0x0'));var Plugin=require(_0x5359('0x1'))['db'][_0x5359('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5359('0x3'),'afterUpdate':_0x5359('0x4'),'afterDestroy':_0x5359('0x5')};function emitEvent(_0x3fd018){return function(_0x1fa814,_0x125c76,_0x4e42e0){PluginEvents['emit'](_0x3fd018+':'+_0x1fa814['id'],_0x1fa814);PluginEvents[_0x5359('0x6')](_0x3fd018,_0x1fa814);_0x4e42e0(null);};}for(var e in events){if(events[_0x5359('0x7')](e)){var event=events[e];Plugin[_0x5359('0x8')](e,emitEvent(event));}}module[_0x5359('0x9')]=PluginEvents; \ No newline at end of file +var _0x2a9a=['hasOwnProperty','hook','events','Plugin','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a9a,0x64));var _0xa2a9=function(_0xb447f5,_0x40e178){_0xb447f5=_0xb447f5-0x0;var _0x44e395=_0x2a9a[_0xb447f5];return _0x44e395;};'use strict';var EventEmitter=require(_0xa2a9('0x0'));var Plugin=require('../../mysqldb')['db'][_0xa2a9('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa2a9('0x2'),'afterDestroy':_0xa2a9('0x3')};function emitEvent(_0x39eca6){return function(_0x1a817a,_0x593d5c,_0x55dc29){PluginEvents[_0xa2a9('0x4')](_0x39eca6+':'+_0x1a817a['id'],_0x1a817a);PluginEvents[_0xa2a9('0x4')](_0x39eca6,_0x1a817a);_0x55dc29(null);};}for(var e in events){if(events[_0xa2a9('0x5')](e)){var event=events[e];Plugin[_0xa2a9('0x6')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 4727558..bb9fc18 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 _0xfb06=['../../config/environment','./plugin.attributes','exports','define','plugins','util','api','bluebird','request-promise','path','rimraf'];(function(_0x487f47,_0x32b30b){var _0x35988b=function(_0x589ef6){while(--_0x589ef6){_0x487f47['push'](_0x487f47['shift']());}};_0x35988b(++_0x32b30b);}(_0xfb06,0x118));var _0x6fb0=function(_0x556a99,_0x3d0574){_0x556a99=_0x556a99-0x0;var _0x45a65a=_0xfb06[_0x556a99];return _0x45a65a;};'use strict';var _=require('lodash');var util=require(_0x6fb0('0x0'));var logger=require('../../config/logger')(_0x6fb0('0x1'));var moment=require('moment');var BPromise=require(_0x6fb0('0x2'));var rp=require(_0x6fb0('0x3'));var fs=require('fs');var path=require(_0x6fb0('0x4'));var rimraf=require(_0x6fb0('0x5'));var config=require(_0x6fb0('0x6'));var attributes=require(_0x6fb0('0x7'));module[_0x6fb0('0x8')]=function(_0x50019c,_0x5cd903){return _0x50019c[_0x6fb0('0x9')]('Plugin',attributes,{'tableName':_0x6fb0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64c4=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash','util','../../config/logger'];(function(_0x2695ab,_0x3f4b39){var _0x3eaf50=function(_0x2ada55){while(--_0x2ada55){_0x2695ab['push'](_0x2695ab['shift']());}};_0x3eaf50(++_0x3f4b39);}(_0x64c4,0x11b));var _0x464c=function(_0x4cc883,_0x813627){_0x4cc883=_0x4cc883-0x0;var _0x174736=_0x64c4[_0x4cc883];return _0x174736;};'use strict';var _=require(_0x464c('0x0'));var util=require(_0x464c('0x1'));var logger=require(_0x464c('0x2'))(_0x464c('0x3'));var moment=require(_0x464c('0x4'));var BPromise=require(_0x464c('0x5'));var rp=require(_0x464c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x464c('0x7'));var config=require(_0x464c('0x8'));var attributes=require(_0x464c('0x9'));module['exports']=function(_0x50f541,_0x1ddd0b){return _0x50f541[_0x464c('0xa')](_0x464c('0xb'),attributes,{'tableName':_0x464c('0xc'),'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 5dfdb94..c6b18fc 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 _0xac0b=['../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','CreatePlugin','lodash','util','moment','ioredis'];(function(_0x4d0ff8,_0x2b79fb){var _0x389288=function(_0x446bbc){while(--_0x446bbc){_0x4d0ff8['push'](_0x4d0ff8['shift']());}};_0x389288(++_0x2b79fb);}(_0xac0b,0x164));var _0xbac0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xac0b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbac0('0x0'));var util=require(_0xbac0('0x1'));var moment=require(_0xbac0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbac0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbac0('0x4'));var logger=require(_0xbac0('0x5'))(_0xbac0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbac0('0x7')]({'port':0x232a});config[_0xbac0('0x8')]=_[_0xbac0('0x9')](config[_0xbac0('0x8')],{'host':_0xbac0('0xa'),'port':0x18eb});var socket=require(_0xbac0('0xb'))(new Redis(config[_0xbac0('0x8')]));require(_0xbac0('0xc'))[_0xbac0('0xd')](socket);function respondWithRpcPromise(_0x127a59,_0x2041b7,_0x51458f){return new BPromise(function(_0x3ebb77,_0x83bb22){return client[_0xbac0('0xe')](_0x127a59,_0x51458f)[_0xbac0('0xf')](function(_0x184019){logger[_0xbac0('0x10')](_0xbac0('0x11'),_0x2041b7,_0xbac0('0x12'));logger[_0xbac0('0x13')](_0xbac0('0x14'),_0x2041b7,'request\x20sent',JSON[_0xbac0('0x15')](_0x184019));if(_0x184019[_0xbac0('0x16')]){if(_0x184019[_0xbac0('0x16')][_0xbac0('0x17')]===0x1f4){logger['error'](_0xbac0('0x11'),_0x2041b7,_0x184019[_0xbac0('0x16')][_0xbac0('0x18')]);return _0x83bb22(_0x184019[_0xbac0('0x16')]['message']);}logger[_0xbac0('0x16')](_0xbac0('0x11'),_0x2041b7,_0x184019[_0xbac0('0x16')][_0xbac0('0x18')]);return _0x3ebb77(_0x184019[_0xbac0('0x16')][_0xbac0('0x18')]);}else{logger[_0xbac0('0x10')](_0xbac0('0x11'),_0x2041b7,_0xbac0('0x12'));_0x3ebb77(_0x184019['result']['message']);}})[_0xbac0('0x19')](function(_0x3f4287){logger['error']('Plugin,\x20%s,\x20%s',_0x2041b7,_0x3f4287);_0x83bb22(_0x3f4287);});});}exports['CreatePlugin']=function(_0x4e2079){var _0x1144e8=this;return new Promise(function(_0x17ddb3,_0xe10b53){return db['Plugin'][_0xbac0('0x1a')](_0x4e2079[_0xbac0('0x1b')],{'raw':_0x4e2079[_0xbac0('0x1c')]?_0x4e2079[_0xbac0('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xbac0('0xf')](function(_0x3a3f1d){logger[_0xbac0('0x10')](_0xbac0('0x1d'),_0x4e2079);logger['debug'](_0xbac0('0x1d'),_0x4e2079,JSON['stringify'](_0x3a3f1d));_0x17ddb3(_0x3a3f1d);})['catch'](function(_0x37e0ed){logger[_0xbac0('0x16')]('CreatePlugin',_0x37e0ed[_0xbac0('0x18')],_0x4e2079);_0xe10b53(_0x1144e8[_0xbac0('0x16')](0x1f4,_0x37e0ed[_0xbac0('0x18')]));});});}; \ No newline at end of file +var _0x9893=['Plugin','body','options','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreatePlugin'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x9893,0x1c6));var _0x3989=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9893[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3989('0x0'));var BPromise=require(_0x3989('0x1'));var rs=require(_0x3989('0x2'));var fs=require('fs');var Redis=require(_0x3989('0x3'));var db=require(_0x3989('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3989('0x5'))(_0x3989('0x6'));var config=require(_0x3989('0x7'));var jayson=require(_0x3989('0x8'));var client=jayson[_0x3989('0x9')]['http']({'port':0x232a});config[_0x3989('0xa')]=_[_0x3989('0xb')](config[_0x3989('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3989('0xc'))(new Redis(config[_0x3989('0xa')]));require(_0x3989('0xd'))[_0x3989('0xe')](socket);function respondWithRpcPromise(_0x19bccf,_0x5356a9,_0x2c70f5){return new BPromise(function(_0x459edf,_0x4b9145){return client['request'](_0x19bccf,_0x2c70f5)[_0x3989('0xf')](function(_0x431da6){logger[_0x3989('0x10')](_0x3989('0x11'),_0x5356a9,_0x3989('0x12'));logger[_0x3989('0x13')](_0x3989('0x14'),_0x5356a9,_0x3989('0x12'),JSON[_0x3989('0x15')](_0x431da6));if(_0x431da6[_0x3989('0x16')]){if(_0x431da6[_0x3989('0x16')]['code']===0x1f4){logger['error'](_0x3989('0x11'),_0x5356a9,_0x431da6[_0x3989('0x16')][_0x3989('0x17')]);return _0x4b9145(_0x431da6[_0x3989('0x16')][_0x3989('0x17')]);}logger[_0x3989('0x16')](_0x3989('0x11'),_0x5356a9,_0x431da6[_0x3989('0x16')][_0x3989('0x17')]);return _0x459edf(_0x431da6['error'][_0x3989('0x17')]);}else{logger[_0x3989('0x10')]('Plugin,\x20%s,\x20%s',_0x5356a9,_0x3989('0x12'));_0x459edf(_0x431da6[_0x3989('0x18')]['message']);}})['catch'](function(_0x22d5de){logger[_0x3989('0x16')]('Plugin,\x20%s,\x20%s',_0x5356a9,_0x22d5de);_0x4b9145(_0x22d5de);});});}exports[_0x3989('0x19')]=function(_0x3124a6){var _0x162047=this;return new Promise(function(_0x2ce29b,_0x437260){return db[_0x3989('0x1a')]['create'](_0x3124a6[_0x3989('0x1b')],{'raw':_0x3124a6['options']?_0x3124a6[_0x3989('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x3989('0xf')](function(_0x2df4ce){logger['info']('CreatePlugin',_0x3124a6);logger[_0x3989('0x13')](_0x3989('0x19'),_0x3124a6,JSON[_0x3989('0x15')](_0x2df4ce));_0x2ce29b(_0x2df4ce);})[_0x3989('0x1d')](function(_0x5b0940){logger[_0x3989('0x16')](_0x3989('0x19'),_0x5b0940[_0x3989('0x17')],_0x3124a6);_0x437260(_0x162047[_0x3989('0x16')](0x1f4,_0x5b0940['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 9c41a61..2bae1af 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 _0x65fb=['length','plugin:','./plugin.events','update','emit','removeListener','register'];(function(_0x18caeb,_0x1b8f97){var _0x455aca=function(_0x2cde20){while(--_0x2cde20){_0x18caeb['push'](_0x18caeb['shift']());}};_0x455aca(++_0x1b8f97);}(_0x65fb,0xaa));var _0xb65f=function(_0x400766,_0x368660){_0x400766=_0x400766-0x0;var _0x3ae58b=_0x65fb[_0x400766];return _0x3ae58b;};'use strict';var PluginEvents=require(_0xb65f('0x0'));var events=['save','remove',_0xb65f('0x1')];function createListener(_0x21098b,_0x20f93d){return function(_0x33af1a){_0x20f93d[_0xb65f('0x2')](_0x21098b,_0x33af1a);};}function removeListener(_0x7c31f7,_0x52f142){return function(){PluginEvents[_0xb65f('0x3')](_0x7c31f7,_0x52f142);};}exports[_0xb65f('0x4')]=function(_0x3b7893){for(var _0x1caed4=0x0,_0x4131b2=events[_0xb65f('0x5')];_0x1caed4<_0x4131b2;_0x1caed4++){var _0x45c938=events[_0x1caed4];var _0x55d231=createListener(_0xb65f('0x6')+_0x45c938,_0x3b7893);PluginEvents['on'](_0x45c938,_0x55d231);}}; \ No newline at end of file +var _0x7bb6=['length','./plugin.events','save','remove','update','emit','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7bb6,0x1d1));var _0x67bb=function(_0x89e27f,_0x19ff50){_0x89e27f=_0x89e27f-0x0;var _0x6559f=_0x7bb6[_0x89e27f];return _0x6559f;};'use strict';var PluginEvents=require(_0x67bb('0x0'));var events=[_0x67bb('0x1'),_0x67bb('0x2'),_0x67bb('0x3')];function createListener(_0x1e9fb2,_0x401368){return function(_0x3175c5){_0x401368[_0x67bb('0x4')](_0x1e9fb2,_0x3175c5);};}function removeListener(_0x1338ba,_0x49a964){return function(){PluginEvents[_0x67bb('0x5')](_0x1338ba,_0x49a964);};}exports[_0x67bb('0x6')]=function(_0x5a3d47){for(var _0x272fa0=0x0,_0x4ca196=events[_0x67bb('0x7')];_0x272fa0<_0x4ca196;_0x272fa0++){var _0x39b8c5=events[_0x272fa0];var _0x2f15ad=createListener('plugin:'+_0x39b8c5,_0x5a3d47);PluginEvents['on'](_0x39b8c5,_0x2f15ad);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 3f0852f..876cc2c 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(_0x283adc,_0x443066){var _0x518cfa=function(_0x42ecc8){while(--_0x42ecc8){_0x283adc['push'](_0x283adc['shift']());}};_0x518cfa(++_0x443066);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x291cd4,_0x44288d){var _0x3bc45c=function(_0x8011cc){while(--_0x8011cc){_0x291cd4['push'](_0x291cd4['shift']());}};_0x3bc45c(++_0x44288d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 20dcb5a..2478d5c 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 _0xd404=['stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','api','path','exec','bluebird','sendStatus','json','name','status','send','npm\x20install','info','error','index','list','then','express','motion2','length','catch','show','describe','params','body','join','script','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart'];(function(_0x3f10b0,_0x44451b){var _0x1f4fee=function(_0x37d752){while(--_0x37d752){_0x3f10b0['push'](_0x3f10b0['shift']());}};_0x1f4fee(++_0x44451b);}(_0xd404,0x15b));var _0x4d40=function(_0x174cc7,_0x1b0b06){_0x174cc7=_0x174cc7-0x0;var _0x4055b6=_0xd404[_0x174cc7];return _0x4055b6;};'use strict';var _=require(_0x4d40('0x0'));var pm2=require(_0x4d40('0x1'));var logger=require('../../config/logger')(_0x4d40('0x2'));var path=require(_0x4d40('0x3'));var exec=require('child_process')[_0x4d40('0x4')];var BPromise=require(_0x4d40('0x5'));function handleEntityNotFound(_0xba821,_0x8bde12){return function(_0xbfb4c6){if(!_0xbfb4c6){_0xba821[_0x4d40('0x6')](0x194);;}return _0xbfb4c6;};}function respondWithResult(_0xc2a9db,_0x24a237){_0x24a237=_0x24a237||0xc8;return function(_0x2e4bd8){if(_0x2e4bd8){return _0xc2a9db['status'](_0x24a237)[_0x4d40('0x7')](_0x2e4bd8);}return null;};}function handleError(_0x116941,_0x5a23a2){_0x5a23a2=_0x5a23a2||0x1f4;return function(_0x3bf81a){logger['error'](_0x3bf81a['stack']);if(_0x3bf81a[_0x4d40('0x8')]){delete _0x3bf81a[_0x4d40('0x8')];}_0x116941[_0x4d40('0x9')](_0x5a23a2)[_0x4d40('0xa')](_0x3bf81a);};}function execChildProcess(){return new BPromise(function(_0x1d00cf,_0x357abf){exec(_0x4d40('0xb'),function(_0x2eab7a,_0x1e18bc,_0x3f5c29){logger[_0x4d40('0xc')](_0x1e18bc);logger[_0x4d40('0xc')](_0x3f5c29);if(_0x2eab7a){logger[_0x4d40('0xd')](_0x2eab7a);return _0x357abf(_0x2eab7a);}return _0x1d00cf(_0x1e18bc);});});}exports[_0x4d40('0xe')]=function(_0x5162f9,_0xa644d2){return pm2[_0x4d40('0xf')]()[_0x4d40('0x10')](function(_0x2083bd){if(_0x2083bd){var _0x477a91=_['reject'](_0x2083bd,function(_0x23de7b){return _0x23de7b[_0x4d40('0x8')]===_0x4d40('0x11')||_0x23de7b[_0x4d40('0x8')]===_0x4d40('0x12');});return{'rows':_0x477a91,'count':_0x477a91[_0x4d40('0x13')]};}return null;})[_0x4d40('0x10')](respondWithResult(_0xa644d2,null))[_0x4d40('0x14')](handleError(_0xa644d2,null));};exports[_0x4d40('0x15')]=function(_0x4b5d23,_0x535989){return pm2[_0x4d40('0x16')](_0x4b5d23[_0x4d40('0x17')]['id'])['then'](respondWithResult(_0x535989,null))[_0x4d40('0x10')](handleEntityNotFound(_0x535989,null))[_0x4d40('0x14')](handleError(_0x535989,null));};exports['create']=function(_0x36d031,_0x5a77e0){if(_0x36d031[_0x4d40('0x18')][_0x4d40('0x8')]&&_0x36d031['body']['script']){var _0x375ce0=path[_0x4d40('0x19')](__dirname,'../../files/plugins',_0x36d031[_0x4d40('0x18')][_0x4d40('0x1a')]);var _0x30f058=process['cwd']();process[_0x4d40('0x1b')](path[_0x4d40('0x1c')](_0x375ce0));return execChildProcess()[_0x4d40('0x10')](function(_0x5ca0a0){process['chdir'](_0x30f058);return pm2[_0x4d40('0x1d')]({'name':_0x36d031[_0x4d40('0x18')][_0x4d40('0x8')],'script':_0x375ce0});})[_0x4d40('0x10')](function(_0x4677c9){pm2['dump']();return _0x4677c9[0x0];})[_0x4d40('0x10')](respondWithResult(_0x5a77e0,0xc9))[_0x4d40('0x14')](handleError(_0x5a77e0,null));}else{return _0x5a77e0['status'](0x1f4)['send']({'message':_0x4d40('0x1e')});}};exports[_0x4d40('0x1f')]=function(_0x3fa83e,_0x3ad1d7){if(_0x3fa83e[_0x4d40('0x18')]['id']){delete _0x3fa83e[_0x4d40('0x18')]['id'];}var _0x105635={'online':_0x4d40('0x20'),'stopped':_0x4d40('0x21')};if(_0x105635[_0x4d40('0x22')](_0x3fa83e[_0x4d40('0x18')]['status'])){return pm2[_0x105635[_0x3fa83e['body']['status']]](_0x3fa83e[_0x4d40('0x17')]['id'])[_0x4d40('0x10')](respondWithResult(_0x3ad1d7,0xc8))[_0x4d40('0x14')](handleError(_0x3ad1d7,null));}else{return _0x3ad1d7[_0x4d40('0x9')](0x1f4)['send']({'message':_0x4d40('0x23')});}};exports[_0x4d40('0x24')]=function(_0x429da9,_0x5a6aff){if(_0x429da9[_0x4d40('0x18')]['id']){delete _0x429da9[_0x4d40('0x18')]['id'];}if(_0x429da9[_0x4d40('0x17')]['id']){return pm2[_0x4d40('0x25')](_0x429da9[_0x4d40('0x17')]['id'])['then'](function(_0x2f4b22){pm2['dump']();return _0x2f4b22[0x0];})[_0x4d40('0x10')](respondWithResult(_0x5a6aff,null))[_0x4d40('0x14')](handleError(_0x5a6aff,null));}else{return _0x5a6aff[_0x4d40('0x9')](0x1f4)[_0x4d40('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x0565=['script','../../files/plugins','cwd','chdir','send','update','restart','stop','hasOwnProperty','params','Unknown\x20status','delete','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','error','stack','name','status','npm\x20install','index','list','then','reject','express','length','catch','show','describe','body'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x0565,0xf2));var _0x5056=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x0565[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x5056('0x0'));var pm2=require(_0x5056('0x1'));var logger=require(_0x5056('0x2'))(_0x5056('0x3'));var path=require(_0x5056('0x4'));var exec=require(_0x5056('0x5'))[_0x5056('0x6')];var BPromise=require(_0x5056('0x7'));function handleEntityNotFound(_0x3657a8,_0x2b0883){return function(_0x554040){if(!_0x554040){_0x3657a8[_0x5056('0x8')](0x194);;}return _0x554040;};}function respondWithResult(_0x105ea8,_0x1143df){_0x1143df=_0x1143df||0xc8;return function(_0x22afb7){if(_0x22afb7){return _0x105ea8['status'](_0x1143df)['json'](_0x22afb7);}return null;};}function handleError(_0x38f74,_0x223c92){_0x223c92=_0x223c92||0x1f4;return function(_0x417065){logger[_0x5056('0x9')](_0x417065[_0x5056('0xa')]);if(_0x417065[_0x5056('0xb')]){delete _0x417065[_0x5056('0xb')];}_0x38f74[_0x5056('0xc')](_0x223c92)['send'](_0x417065);};}function execChildProcess(){return new BPromise(function(_0x78f7e4,_0xf04ea3){exec(_0x5056('0xd'),function(_0x5ab4b2,_0x4c0255,_0x17f43e){logger['info'](_0x4c0255);logger['info'](_0x17f43e);if(_0x5ab4b2){logger['error'](_0x5ab4b2);return _0xf04ea3(_0x5ab4b2);}return _0x78f7e4(_0x4c0255);});});}exports[_0x5056('0xe')]=function(_0x4b183a,_0x3e523b){return pm2[_0x5056('0xf')]()[_0x5056('0x10')](function(_0x543cee){if(_0x543cee){var _0x1e8b64=_[_0x5056('0x11')](_0x543cee,function(_0x15f52d){return _0x15f52d[_0x5056('0xb')]===_0x5056('0x12')||_0x15f52d[_0x5056('0xb')]==='motion2';});return{'rows':_0x1e8b64,'count':_0x1e8b64[_0x5056('0x13')]};}return null;})['then'](respondWithResult(_0x3e523b,null))[_0x5056('0x14')](handleError(_0x3e523b,null));};exports[_0x5056('0x15')]=function(_0x1c0ee9,_0x1f2ac6){return pm2[_0x5056('0x16')](_0x1c0ee9['params']['id'])[_0x5056('0x10')](respondWithResult(_0x1f2ac6,null))[_0x5056('0x10')](handleEntityNotFound(_0x1f2ac6,null))['catch'](handleError(_0x1f2ac6,null));};exports['create']=function(_0x20776c,_0x517bf3){if(_0x20776c[_0x5056('0x17')][_0x5056('0xb')]&&_0x20776c[_0x5056('0x17')][_0x5056('0x18')]){var _0x33035c=path['join'](__dirname,_0x5056('0x19'),_0x20776c[_0x5056('0x17')]['script']);var _0x271efc=process[_0x5056('0x1a')]();process[_0x5056('0x1b')](path['dirname'](_0x33035c));return execChildProcess()[_0x5056('0x10')](function(_0x26a3c2){process['chdir'](_0x271efc);return pm2['start']({'name':_0x20776c[_0x5056('0x17')][_0x5056('0xb')],'script':_0x33035c});})[_0x5056('0x10')](function(_0x37f7b5){pm2['dump']();return _0x37f7b5[0x0];})[_0x5056('0x10')](respondWithResult(_0x517bf3,0xc9))[_0x5056('0x14')](handleError(_0x517bf3,null));}else{return _0x517bf3['status'](0x1f4)[_0x5056('0x1c')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x5056('0x1d')]=function(_0x39d539,_0x1106e5){if(_0x39d539[_0x5056('0x17')]['id']){delete _0x39d539[_0x5056('0x17')]['id'];}var _0x50f2a8={'online':_0x5056('0x1e'),'stopped':_0x5056('0x1f')};if(_0x50f2a8[_0x5056('0x20')](_0x39d539[_0x5056('0x17')]['status'])){return pm2[_0x50f2a8[_0x39d539[_0x5056('0x17')]['status']]](_0x39d539[_0x5056('0x21')]['id'])['then'](respondWithResult(_0x1106e5,0xc8))['catch'](handleError(_0x1106e5,null));}else{return _0x1106e5['status'](0x1f4)[_0x5056('0x1c')]({'message':_0x5056('0x22')});}};exports['destroy']=function(_0x27f4be,_0x2c5728){if(_0x27f4be[_0x5056('0x17')]['id']){delete _0x27f4be[_0x5056('0x17')]['id'];}if(_0x27f4be[_0x5056('0x21')]['id']){return pm2[_0x5056('0x23')](_0x27f4be[_0x5056('0x21')]['id'])[_0x5056('0x10')](function(_0xd1aa24){pm2[_0x5056('0x24')]();return _0xd1aa24[0x0];})[_0x5056('0x10')](respondWithResult(_0x2c5728,null))['catch'](handleError(_0x2c5728,null));}else{return _0x2c5728['status'](0x1f4)[_0x5056('0x1c')]({'message':_0x5056('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 2dc4ab8..3f06ab1 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 _0x4842=['getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents'];(function(_0x30ebed,_0x42b3f9){var _0x3d0417=function(_0x396de8){while(--_0x396de8){_0x30ebed['push'](_0x30ebed['shift']());}};_0x3d0417(++_0x42b3f9);}(_0x4842,0x1ec));var _0x2484=function(_0x1a5da0,_0x5806a1){_0x1a5da0=_0x1a5da0-0x0;var _0x178f5a=_0x4842[_0x1a5da0];return _0x178f5a;};'use strict';var express=require(_0x2484('0x0'));var router=express[_0x2484('0x1')]();var auth=require(_0x2484('0x2'));var controller=require(_0x2484('0x3'));router[_0x2484('0x4')](_0x2484('0x5'),auth[_0x2484('0x6')](),controller[_0x2484('0x7')]);router[_0x2484('0x4')]('/queues',auth[_0x2484('0x6')](),controller[_0x2484('0x8')]);module[_0x2484('0x9')]=router; \ No newline at end of file +var _0x503c=['express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','getQueues','exports'];(function(_0x274e0e,_0x2e7080){var _0x4c370f=function(_0x1fedd9){while(--_0x1fedd9){_0x274e0e['push'](_0x274e0e['shift']());}};_0x4c370f(++_0x2e7080);}(_0x503c,0x10e));var _0xc503=function(_0x253804,_0x4101e2){_0x253804=_0x253804-0x0;var _0x26cb31=_0x503c[_0x253804];return _0x26cb31;};'use strict';var express=require(_0xc503('0x0'));var router=express[_0xc503('0x1')]();var auth=require(_0xc503('0x2'));var controller=require(_0xc503('0x3'));router[_0xc503('0x4')](_0xc503('0x5'),auth[_0xc503('0x6')](),controller[_0xc503('0x7')]);router['get']('/queues',auth[_0xc503('0x6')](),controller[_0xc503('0x8')]);module[_0xc503('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 460c27a..0ac1046 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 _0x8541=['validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','map','fieldName','key','role','agent','getOptions','sequelize','literal','forEach','Pause','where','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','rows','getAgentStatus','Status','sortAgentsByStatus','getQueues','resolve','rawAttributes','type','QueueCampaigns','UserProfile','all','util','lodash','../../components/parsers/qs','../../config/utils','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','json','name','send','voice','request','startCase','Queues','then','catch','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','result','waiting','paused','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','get','agents','loggedInDb','loggedIn','talking','busy','outbound','find','merge','pick','queue','length','some','internal','toString','UserId','online','User','Queue','findAll','push','includes','Invalid\x20channel','toLowerCase','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','channel','sort','globalStatus'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x8541,0x9e));var _0x1854=function(_0x5b44f8,_0x4972e3){_0x5b44f8=_0x5b44f8-0x0;var _0x2483e0=_0x8541[_0x5b44f8];return _0x2483e0;};'use strict';var util=require(_0x1854('0x0'));var _=require(_0x1854('0x1'));var jayson=require('jayson/promise');var rta=require('../../components/realtime/agents');var qs=require(_0x1854('0x2'));var utils=require(_0x1854('0x3'));var logger=require(_0x1854('0x4'))(_0x1854('0x5'));var db=require(_0x1854('0x6'))['db'];var amiClient=jayson[_0x1854('0x7')][_0x1854('0x8')]({'port':0x232a});var routingClient=jayson['client'][_0x1854('0x8')]({'port':0x232c});function respondWithFilteredResult(_0x36bad1,_0x477042){return function(_0x49dc4e){if(_0x49dc4e){var _0x3bcb3a=typeof _0x477042[_0x1854('0x9')]===_0x1854('0xa')&&typeof _0x477042[_0x1854('0xb')]==='undefined';var _0x10684d=_0x49dc4e[_0x1854('0xc')];var _0x1bc922=_0x3bcb3a?0x0:_0x477042[_0x1854('0x9')];var _0x4efc8e=_0x3bcb3a?_0x49dc4e['count']:_0x477042[_0x1854('0x9')]+_0x477042[_0x1854('0xb')];var _0x46e665;if(_0x4efc8e>=_0x10684d){_0x4efc8e=_0x10684d;_0x46e665=0xc8;}else{_0x46e665=0xce;}_0x36bad1[_0x1854('0xd')](_0x46e665);return _0x36bad1[_0x1854('0xe')](_0x1854('0xf'),_0x1bc922+'-'+_0x4efc8e+'/'+_0x10684d)[_0x1854('0x10')](_0x49dc4e);}return null;};}function handleError(_0x3b928e,_0x2dc6fb){_0x2dc6fb=_0x2dc6fb||0x1f4;return function(_0x31ead2){logger['error'](_0x31ead2['stack']);if(_0x31ead2[_0x1854('0x11')]){delete _0x31ead2[_0x1854('0x11')];}_0x3b928e[_0x1854('0xd')](_0x2dc6fb)[_0x1854('0x12')](_0x31ead2);};}function getRealtimeQueues(_0x43f1dd,_0x46cb2e){return new Promise(function(_0x33cb82,_0x4ae798){var _0x4e7d9d=_0x46cb2e===_0x1854('0x13')?amiClient:routingClient;return _0x4e7d9d[_0x1854('0x14')](_[_0x1854('0x15')](_0x46cb2e)+_0x1854('0x16'),_0x43f1dd)[_0x1854('0x17')](function(_0x1c8303){if(_0x1c8303['error'])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x46cb2e));return _0x33cb82(_0x1c8303['result']);})[_0x1854('0x18')](function(_0x39b322){_0x4ae798(_0x39b322);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x221ff0,_0x3bf681){return amiClient[_0x1854('0x14')]('VoiceQueuesChannels',{})[_0x1854('0x17')](function(_0x1ad4f9){if(_0x1ad4f9['error'])throw new Error(_0x1854('0x19'));return _0x221ff0(_0x1ad4f9[_0x1854('0x1a')]);})[_0x1854('0x18')](function(_0x1a1647){_0x3bf681(_0x1a1647);});});}function initializeQueues(_0x48415e,_0x54ec3c,_0x46ab21,_0x1af846){var _0x58a5cc=['loggedIn','available',_0x1854('0x1b'),'talking',_0x1854('0x1c')];if(_0x46ab21===_0x1854('0x13')&&_0x1af846==='outbound'){_0x58a5cc['push'](_0x1854('0x1d'),_0x1854('0x1e'),_0x1854('0x1f'),_0x1854('0x20'),_0x1854('0x21'),_0x1854('0x22'),_0x1854('0x23'),_0x1854('0x24'),_0x1854('0x25'),_0x1854('0x26'),_0x1854('0x27'),_0x1854('0x28'),_0x1854('0x29'),_0x1854('0x2a'),_0x1854('0x2b'),_0x1854('0x2c'),_0x1854('0x2d'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0x1854('0x2e'),_0x1854('0x2f'),_0x1854('0x30'));}return _0x48415e['map'](function(_0x714865){var _0x97cb79=_0x714865[_0x1854('0x31')]({'plain':!![]});_0x97cb79[_0x1854('0x32')]=[];_0x97cb79[_0x1854('0x1c')]=0x0;_0x97cb79[_0x1854('0x33')]=0x0;_0x97cb79[_0x1854('0x34')]=0x0;_0x97cb79['available']=0x0;_0x97cb79[_0x1854('0x1b')]=0x0;if(_0x46ab21==='voice'){_0x97cb79[_0x1854('0x35')]=0x0;_0x97cb79[_0x1854('0x36')]=0x0;if(_0x1af846===_0x1854('0x37')){_0x97cb79[_0x1854('0x1d')]=0x0;_0x97cb79['originated']=0x0;}}var _0x226f2a=_[_0x1854('0x38')](_0x54ec3c,['id',_0x97cb79['id']]);if(_0x226f2a)_[_0x1854('0x39')](_0x97cb79,_[_0x1854('0x3a')](_0x226f2a,_0x58a5cc));return _0x97cb79;});}function updateAgentVoiceStatus(_0x2d942a,_0x355c5c,_0x376f9c){var _0x43152a=_['filter'](_0x376f9c,[_0x1854('0x3b'),_0x355c5c['name']]);if(_0x43152a[_0x1854('0x3c')]===0x0)return _0x2d942a[_0x1854('0x36')]=!![];if(_[_0x1854('0x3d')](_0x43152a,['connectedlinenum',_0x2d942a[_0x1854('0x3e')][_0x1854('0x3f')]()]))return _0x2d942a[_0x1854('0x35')]=!![];if(!_0x2d942a[_0x1854('0x35')])return _0x2d942a['busy']=!![];}function getVoiceQueueAgents(_0x16ffc2,_0x46ae8d,_0xbdc8c9,_0x5d37ad){var _0x451f85=_[_0x1854('0x38')](_0x46ae8d,['id',_0x16ffc2['id']]);if(!_0x451f85)return _0x16ffc2;return _0x451f85['getMembers']({'raw':!![]})[_0x1854('0x17')](function(_0x1f0728){for(var _0x584376=0x0;_0x584376<_0x1f0728[_0x1854('0x3c')];_0x584376++){var _0x5e6270=_[_0x1854('0x38')](_0xbdc8c9,['id',_0x1f0728[_0x584376][_0x1854('0x40')]]);if(!_0x5e6270){_0x5e6270={'id':_0x1f0728[_0x584376][_0x1854('0x40')],'name':_0x1f0728[_0x584376][_0x1854('0x40')],'accountcode':'','online':![]};}var _0x2cbcb5={'id':_0x5e6270['id'],'name':_0x5e6270[_0x1854('0x11')],'internal':_0x5e6270['accountcode'],'online':Boolean(_0x5e6270[_0x1854('0x41')]),'paused':Boolean(_0x1f0728[_0x584376][_0x1854('0x1c')])};if(_0x5e6270['voiceStatus']===_0x1854('0x35'))updateAgentVoiceStatus(_0x2cbcb5,_0x16ffc2,_0x5d37ad);if(_0x2cbcb5[_0x1854('0x41')])_0x16ffc2[_0x1854('0x33')]++;if(_0x2cbcb5[_0x1854('0x36')])_0x16ffc2[_0x1854('0x36')]++;if(_0x2cbcb5[_0x1854('0x1c')]&&!_0x2cbcb5[_0x1854('0x36')]&&!_0x2cbcb5[_0x1854('0x35')])_0x16ffc2['paused']++;_0x16ffc2[_0x1854('0x32')]['push'](_0x2cbcb5);}return _0x16ffc2;});}function getQueueAgents(_0x165ce0,_0x3a0f32,_0x1049d5){var _0x391752=_0x1854('0x42')+_[_0x1854('0x15')](_0x1049d5)+_0x1854('0x43');var _0x4b6f47=_0x1049d5+'Pause';return db[_0x391752][_0x1854('0x44')]({'where':{[_[_0x1854('0x15')](_0x1049d5)+'QueueId']:_0x165ce0['id']},'raw':!![]})['then'](function(_0x40dae0){for(var _0x1b5b7c=0x0;_0x1b5b7c<_0x40dae0[_0x1854('0x3c')];_0x1b5b7c++){var _0x55c053=_[_0x1854('0x38')](_0x3a0f32,['id',_0x40dae0[_0x1b5b7c][_0x1854('0x40')]]);if(!_0x55c053){_0x55c053={'id':_0x40dae0[_0x1b5b7c][_0x1854('0x40')],'name':_0x40dae0[_0x1b5b7c][_0x1854('0x40')],'online':![],['pauseField']:![]};}var _0x3193b6={'id':_0x55c053['id'],'name':_0x55c053[_0x1854('0x11')],'online':Boolean(_0x55c053[_0x1854('0x41')]),'paused':Boolean(_0x55c053[_0x4b6f47])};if(_0x3193b6[_0x1854('0x41')])_0x165ce0[_0x1854('0x33')]++;_0x165ce0['agents'][_0x1854('0x45')](_0x3193b6);}return _0x165ce0;});}function validateChannel(_0x58552f){var _0xb428f7=utils['getChannels']();if(!_[_0x1854('0x46')](_0xb428f7,_0x58552f['toLowerCase']()))throw new Error(_0x1854('0x47'));return _0x58552f[_0x1854('0x48')]();}exports[_0x1854('0x49')]=function(_0x1cb758,_0x14e23e){var _0x4cbd49={'count':0x0,'rows':[]};var _0x40bd4e={};var _0x2dcac5;var _0x35490b;var _0x3e184a;var _0x25e818;var _0x2dbcf7=utils[_0x1854('0x4a')]();var _0x5514c4=_0x1cb758[_0x1854('0x4b')][_0x1854('0x4c')];var _0x472c21=_0x1cb758[_0x1854('0x4b')][_0x1854('0x4d')];var _0x13e1fb=_0x1cb758[_0x1854('0x4b')][_0x1854('0x4e')];var _0x276f83=_0x472c21===_0x1854('0x4f')||_0x472c21===_0x1854('0x50')?!![]:![];var _0x3b79bc=[];var _0x2c1efe;Promise['resolve']()['then'](function(){if(_0x1cb758['query']['channel']){_0x2dcac5=validateChannel(_0x1cb758[_0x1854('0x4b')][_0x1854('0x51')]);}if(!_0x1cb758[_0x1854('0x4b')][_0x1854('0x52')]||!_0x1cb758[_0x1854('0x4b')]['sort']['includes'](_0x1854('0x53'))){_0x1cb758[_0x1854('0x4b')][_0x1854('0x52')]=rta[_0x1854('0x54')](_0x1cb758[_0x1854('0x4b')][_0x1854('0x52')]);return;}var _0xfcb14f=rta[_0x1854('0x55')](_0x1cb758[_0x1854('0x4b')][_0x1854('0x52')]);_0x1cb758[_0x1854('0x4b')][_0x1854('0x52')]=_0xfcb14f[_0x1854('0x56')][_0x1854('0x57')](',');_0x35490b=_0xfcb14f[_0x1854('0x58')];})[_0x1854('0x17')](function(){if(!_0x5514c4){return[];}return rta[_0x1854('0x59')](_0x5514c4,_0x2dcac5);})[_0x1854('0x17')](function(_0x347426){_0x3b79bc=_0x347426;return rta[_0x1854('0x5a')]();})[_0x1854('0x17')](function(_0x2edde0){_0x25e818=_0x2edde0['rows'];if((!_0x472c21||_0x276f83)&&!_0x35490b){return _0x3b79bc;}if(_0x35490b&&!_0x472c21){return rta[_0x1854('0x5b')](_0x25e818,_0x3b79bc,_0x35490b);}else{return rta['getAgentIdsByStatus'](_0x25e818,_0x3b79bc,_0x472c21);}})[_0x1854('0x17')](function(_0x270816){_0x3b79bc=_0x270816;var _0x5691ba=![];if(_0x3b79bc[_0x1854('0x3c')]===0x0){if(_0x5514c4||_0x472c21){_0x5691ba=!![];}if(_0x276f83){_0x5691ba=![];}}if(_0x5691ba){return _0x4cbd49;}var _0xce4a82=_[_0x1854('0x5c')](db[_0x1854('0x42')]['rawAttributes'],function(_0x50297e){return{'name':_0x50297e[_0x1854('0x5d')],'type':_0x50297e['type'][_0x1854('0x5e')]};});_0x1cb758[_0x1854('0x4b')][_0x1854('0x5f')]=_0x1854('0x60');_0x1cb758[_0x1854('0x4b')][_0x1854('0x41')]=!![];_0x40bd4e=qs[_0x1854('0x61')](_0xce4a82,_0x1cb758);_0x40bd4e['raw']=!![];var _0x584f0b=[];if(_0x3b79bc[_0x1854('0x3c')]>0x0){_0x584f0b[_0x1854('0x45')]({'id':{'$in':_0x3b79bc}});if(_0x35490b&&!_0x472c21){_0x2c1efe=[db[_0x1854('0x62')][_0x1854('0x63')]('FIELD(id,'+_0x3b79bc+')')];_0x40bd4e[_0x1854('0x58')]=_0x2c1efe;}}if(_0x276f83){_0x2dbcf7[_0x1854('0x64')](function(_0x72ee71){var _0x38c4bc=!![];if(_0x472c21===_0x1854('0x50')&&_0x2dcac5!==_0x72ee71){_0x38c4bc=![];}_0x584f0b[_0x1854('0x45')]({[_0x72ee71+_0x1854('0x65')]:_0x38c4bc});});if(_0x13e1fb){_0x584f0b['push']({'pauseType':_0x13e1fb});}}else if(_0x472c21){_0x2dbcf7[_0x1854('0x64')](function(_0x2e7a4c){_0x584f0b[_0x1854('0x45')]({[_0x2e7a4c+_0x1854('0x65')]:![]});});}_0x40bd4e[_0x1854('0x66')]=_[_0x1854('0x39')](_0x40bd4e[_0x1854('0x66')],{'$and':_0x584f0b});if(_0x1cb758[_0x1854('0x67')]['role']===_0x1854('0x67')){var _0x196267={'params':{'id':_0x1cb758['user'][_0x1854('0x68')]},'query':{'section':_0x1854('0x69'),'role':_0x1854('0x60'),'online':!![],'raw':!![],'ids':_0x3b79bc,'customSorting':_0x2c1efe}};if(_0x276f83){_0x196267[_0x1854('0x4b')][_0x1854('0x6a')]=_0x584f0b;}_0x196267['query']=Object[_0x1854('0x6b')](_0x196267['query'],_0x1cb758[_0x1854('0x4b')]);delete _0x196267['query']['id'];return db['UserProfile'][_0x1854('0x6c')](_0x196267);}return db[_0x1854('0x42')][_0x1854('0x6d')](_0x40bd4e);})[_0x1854('0x17')](function(_0x63342b){_0x4cbd49['count']=_0x63342b[_0x1854('0xc')];_0x3e184a=_0x63342b[_0x1854('0x6e')];return _0x3e184a[_0x1854('0x5c')](function(_0x5e06c1){var _0x3ca969=_[_0x1854('0x38')](_0x25e818,['id',_0x5e06c1['id']]);if(_0x3ca969){var _0x29b8a6=rta['filterAgentAttributes'](_0x3ca969);_[_0x1854('0x39')](_0x5e06c1,_0x29b8a6);}_0x5e06c1['globalStatus']=rta[_0x1854('0x6f')](_0x5e06c1);if(_0x5e06c1[_0x1854('0x53')][_0x1854('0x46')](_0x1854('0x4f'))){_0x2dbcf7[_0x1854('0x64')](function(_0x512f6c){if(_0x5e06c1[_0x512f6c+'Pause']){_0x5e06c1[_0x512f6c+_0x1854('0x70')]='pause';}});}return _0x5e06c1;});})[_0x1854('0x17')](function(_0x3d37e6){if(!_0x35490b||_0x2c1efe){return _0x3d37e6;}return rta[_0x1854('0x71')](_0x3d37e6,_0x35490b);})[_0x1854('0x17')](function(_0x354aa6){_0x4cbd49[_0x1854('0x6e')]=_0x354aa6;return _0x4cbd49;})[_0x1854('0x17')](respondWithFilteredResult(_0x14e23e,_0x40bd4e))[_0x1854('0x18')](handleError(_0x14e23e,null));};exports[_0x1854('0x72')]=function(_0x1cf078,_0x1baeb4){var _0x4888a0={'count':0x0,'rows':[]},_0x1fa8d6={},_0x39fc38,_0x277f3a,_0x8c6289,_0xfe5a81,_0x51de46;Promise[_0x1854('0x73')]()[_0x1854('0x17')](function(){if(_0x1cf078[_0x1854('0x4b')][_0x1854('0x51')])_0x39fc38=validateChannel(_0x1cf078[_0x1854('0x4b')][_0x1854('0x51')]);var _0x5ddf9e=_[_0x1854('0x15')](_0x39fc38)+_0x1854('0x43');var _0x4aa6af=_[_0x1854('0x5c')](db[_0x5ddf9e][_0x1854('0x74')],function(_0x439548){return{'name':_0x439548['fieldName'],'type':_0x439548[_0x1854('0x75')]['key']};});_0x1fa8d6=qs[_0x1854('0x61')](_0x4aa6af,_0x1cf078);if(_0x1cf078[_0x1854('0x67')][_0x1854('0x5f')]===_0x1854('0x67')){var _0x2b0d72={'params':{'id':_0x1cf078[_0x1854('0x67')][_0x1854('0x68')]},'query':{'section':_0x39fc38==='voice'&&_0x1cf078[_0x1854('0x4b')]['type']==='outbound'?_0x1854('0x76'):_[_0x1854('0x15')](_0x39fc38)+_0x1854('0x16'),'type':_0x1cf078[_0x1854('0x4b')]['type'],'nolimit':!![],'sort':'name','filter':_0x1cf078[_0x1854('0x4b')]['filter']}};return db[_0x1854('0x77')][_0x1854('0x6c')](_0x2b0d72);}return db[_0x5ddf9e][_0x1854('0x6d')](_0x1fa8d6);})[_0x1854('0x17')](function(_0x1f44a5){_0x4888a0[_0x1854('0xc')]=_0x1f44a5[_0x1854('0xc')];_0x277f3a=_0x1f44a5['rows'];return getRealtimeQueues(_0x1cf078,_0x39fc38);})[_0x1854('0x17')](function(_0x148d9b){_0xfe5a81=_0x148d9b['rows'];return rta[_0x1854('0x5a')]();})[_0x1854('0x17')](function(_0x2e3680){_0x8c6289=_0x2e3680[_0x1854('0x6e')];if(_0x39fc38!=_0x1854('0x13'))return;return getRealtimeVoiceQueueChannels();})[_0x1854('0x17')](function(_0x1a1ad2){_0x51de46=_0x1a1ad2?_0x1a1ad2[_0x1854('0x6e')]:[];return initializeQueues(_0x277f3a,_0xfe5a81,_0x39fc38,_0x1cf078[_0x1854('0x4b')][_0x1854('0x75')]);})[_0x1854('0x17')](function(_0x4b8090){var _0x582b79=_0x4b8090[_0x1854('0x5c')](function(_0x37c8d3){if(_0x39fc38===_0x1854('0x13'))return getVoiceQueueAgents(_0x37c8d3,_0x277f3a,_0x8c6289,_0x51de46);else return getQueueAgents(_0x37c8d3,_0x8c6289,_0x39fc38);});return Promise[_0x1854('0x78')](_0x582b79);})[_0x1854('0x17')](function(_0x402fd3){_0x4888a0[_0x1854('0x6e')]=_0x402fd3;return _0x4888a0;})[_0x1854('0x17')](respondWithFilteredResult(_0x1baeb4,_0x1fa8d6))['catch'](handleError(_0x1baeb4,null));}; \ No newline at end of file +var _0xbc0b=['predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','map','get','agents','loggedInDb','busy','outbound','find','merge','pick','filter','some','connectedlinenum','internal','toString','getMembers','length','UserId','accountcode','online','User','Queue','Pause','findAll','QueueId','getChannels','includes','toLowerCase','Invalid\x20channel','getAgents','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','*pause','resolve','channel','sort','validateSortParameter','getUpdatedSortOptions','fields','join','order','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','rawAttributes','fieldName','key','role','getOptions','sequelize','FIELD(id,','forEach','where','user','Agents','agent','assign','UserProfile','filterAgentAttributes','getAgentStatus','globalStatus','pause','Status','sortAgentsByStatus','getQueues','type','QueueCampaigns','findAndCountAll','all','jayson/promise','../../components/realtime/agents','../../config/utils','../../config/logger','api','../../mysqldb','client','http','offset','undefined','count','limit','status','set','Content-Range','stack','name','send','voice','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','request','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','talking','paused','push','pTalking','originated','message','dialActive','dialMethod','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0xbc0b,0x1b1));var _0xbbc0=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xbc0b[_0x4fbfd9];return _0x31dc94;};'use strict';var util=require('util');var _=require('lodash');var jayson=require(_0xbbc0('0x0'));var rta=require(_0xbbc0('0x1'));var qs=require('../../components/parsers/qs');var utils=require(_0xbbc0('0x2'));var logger=require(_0xbbc0('0x3'))(_0xbbc0('0x4'));var db=require(_0xbbc0('0x5'))['db'];var amiClient=jayson[_0xbbc0('0x6')]['http']({'port':0x232a});var routingClient=jayson[_0xbbc0('0x6')][_0xbbc0('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x34c343,_0x46e9e3){return function(_0x438b0d){if(_0x438b0d){var _0x159c00=typeof _0x46e9e3[_0xbbc0('0x8')]===_0xbbc0('0x9')&&typeof _0x46e9e3['limit']===_0xbbc0('0x9');var _0x28aabb=_0x438b0d[_0xbbc0('0xa')];var _0x38351a=_0x159c00?0x0:_0x46e9e3[_0xbbc0('0x8')];var _0x3c2295=_0x159c00?_0x438b0d[_0xbbc0('0xa')]:_0x46e9e3[_0xbbc0('0x8')]+_0x46e9e3[_0xbbc0('0xb')];var _0x3052a2;if(_0x3c2295>=_0x28aabb){_0x3c2295=_0x28aabb;_0x3052a2=0xc8;}else{_0x3052a2=0xce;}_0x34c343[_0xbbc0('0xc')](_0x3052a2);return _0x34c343[_0xbbc0('0xd')](_0xbbc0('0xe'),_0x38351a+'-'+_0x3c2295+'/'+_0x28aabb)['json'](_0x438b0d);}return null;};}function handleError(_0x50f50e,_0x1f3657){_0x1f3657=_0x1f3657||0x1f4;return function(_0x2df96e){logger['error'](_0x2df96e[_0xbbc0('0xf')]);if(_0x2df96e[_0xbbc0('0x10')]){delete _0x2df96e[_0xbbc0('0x10')];}_0x50f50e[_0xbbc0('0xc')](_0x1f3657)[_0xbbc0('0x11')](_0x2df96e);};}function getRealtimeQueues(_0x240190,_0x29d795){return new Promise(function(_0x1bc94a,_0x15beed){var _0x5da46b=_0x29d795===_0xbbc0('0x12')?amiClient:routingClient;return _0x5da46b['request'](_[_0xbbc0('0x13')](_0x29d795)+_0xbbc0('0x14'),_0x240190)[_0xbbc0('0x15')](function(_0x2bf9ba){if(_0x2bf9ba[_0xbbc0('0x16')])throw new Error(util[_0xbbc0('0x17')](_0xbbc0('0x18'),_0x29d795));return _0x1bc94a(_0x2bf9ba[_0xbbc0('0x19')]);})[_0xbbc0('0x1a')](function(_0x45e2c5){_0x15beed(_0x45e2c5);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x54aa1b,_0x5b7684){return amiClient[_0xbbc0('0x1b')](_0xbbc0('0x1c'),{})[_0xbbc0('0x15')](function(_0x1a2077){if(_0x1a2077[_0xbbc0('0x16')])throw new Error(_0xbbc0('0x1d'));return _0x54aa1b(_0x1a2077[_0xbbc0('0x19')]);})[_0xbbc0('0x1a')](function(_0x185194){_0x5b7684(_0x185194);});});}function initializeQueues(_0x1e1350,_0x421e03,_0x1a2279,_0x14279d){var _0x4579dd=[_0xbbc0('0x1e'),'available','waiting',_0xbbc0('0x1f'),_0xbbc0('0x20')];if(_0x1a2279===_0xbbc0('0x12')&&_0x14279d==='outbound'){_0x4579dd[_0xbbc0('0x21')](_0xbbc0('0x22'),_0xbbc0('0x23'),_0xbbc0('0x24'),_0xbbc0('0x25'),_0xbbc0('0x26'),'Trunk','startPredictive',_0xbbc0('0x27'),_0xbbc0('0x28'),_0xbbc0('0x29'),_0xbbc0('0x2a'),_0xbbc0('0x2b'),_0xbbc0('0x2c'),_0xbbc0('0x2d'),_0xbbc0('0x2e'),'predictiveIntervalAvailable','predictiveIntervalTotalCalls',_0xbbc0('0x2f'),'predictiveIntervalDroppedCallsTimeout',_0xbbc0('0x30'),_0xbbc0('0x31'),'predictiveIntervalAvgTalktime');}return _0x1e1350[_0xbbc0('0x32')](function(_0x114799){var _0x5ca29b=_0x114799[_0xbbc0('0x33')]({'plain':!![]});_0x5ca29b[_0xbbc0('0x34')]=[];_0x5ca29b['paused']=0x0;_0x5ca29b[_0xbbc0('0x35')]=0x0;_0x5ca29b[_0xbbc0('0x1e')]=0x0;_0x5ca29b['available']=0x0;_0x5ca29b['waiting']=0x0;if(_0x1a2279==='voice'){_0x5ca29b[_0xbbc0('0x1f')]=0x0;_0x5ca29b[_0xbbc0('0x36')]=0x0;if(_0x14279d===_0xbbc0('0x37')){_0x5ca29b[_0xbbc0('0x22')]=0x0;_0x5ca29b[_0xbbc0('0x23')]=0x0;}}var _0x29783f=_[_0xbbc0('0x38')](_0x421e03,['id',_0x5ca29b['id']]);if(_0x29783f)_[_0xbbc0('0x39')](_0x5ca29b,_[_0xbbc0('0x3a')](_0x29783f,_0x4579dd));return _0x5ca29b;});}function updateAgentVoiceStatus(_0x1d05cb,_0x25eaef,_0x3cd852){var _0xd27498=_[_0xbbc0('0x3b')](_0x3cd852,['queue',_0x25eaef[_0xbbc0('0x10')]]);if(_0xd27498['length']===0x0)return _0x1d05cb['busy']=!![];if(_[_0xbbc0('0x3c')](_0xd27498,[_0xbbc0('0x3d'),_0x1d05cb[_0xbbc0('0x3e')][_0xbbc0('0x3f')]()]))return _0x1d05cb[_0xbbc0('0x1f')]=!![];if(!_0x1d05cb[_0xbbc0('0x1f')])return _0x1d05cb[_0xbbc0('0x36')]=!![];}function getVoiceQueueAgents(_0x3dea47,_0x4b1210,_0x5afe76,_0x340c67){var _0x5cf812=_['find'](_0x4b1210,['id',_0x3dea47['id']]);if(!_0x5cf812)return _0x3dea47;return _0x5cf812[_0xbbc0('0x40')]({'raw':!![]})[_0xbbc0('0x15')](function(_0x614e63){for(var _0x173134=0x0;_0x173134<_0x614e63[_0xbbc0('0x41')];_0x173134++){var _0x3409bd=_[_0xbbc0('0x38')](_0x5afe76,['id',_0x614e63[_0x173134][_0xbbc0('0x42')]]);if(!_0x3409bd){_0x3409bd={'id':_0x614e63[_0x173134]['UserId'],'name':_0x614e63[_0x173134][_0xbbc0('0x42')],'accountcode':'','online':![]};}var _0x1a57f3={'id':_0x3409bd['id'],'name':_0x3409bd[_0xbbc0('0x10')],'internal':_0x3409bd[_0xbbc0('0x43')],'online':Boolean(_0x3409bd['online']),'paused':Boolean(_0x614e63[_0x173134][_0xbbc0('0x20')])};if(_0x3409bd['voiceStatus']===_0xbbc0('0x1f'))updateAgentVoiceStatus(_0x1a57f3,_0x3dea47,_0x340c67);if(_0x1a57f3[_0xbbc0('0x44')])_0x3dea47[_0xbbc0('0x35')]++;if(_0x1a57f3['busy'])_0x3dea47[_0xbbc0('0x36')]++;if(_0x1a57f3['paused']&&!_0x1a57f3['busy']&&!_0x1a57f3[_0xbbc0('0x1f')])_0x3dea47['paused']++;_0x3dea47[_0xbbc0('0x34')]['push'](_0x1a57f3);}return _0x3dea47;});}function getQueueAgents(_0x2be8ef,_0x277876,_0x2fc97e){var _0x44ee30=_0xbbc0('0x45')+_['startCase'](_0x2fc97e)+_0xbbc0('0x46');var _0x20315c=_0x2fc97e+_0xbbc0('0x47');return db[_0x44ee30][_0xbbc0('0x48')]({'where':{[_[_0xbbc0('0x13')](_0x2fc97e)+_0xbbc0('0x49')]:_0x2be8ef['id']},'raw':!![]})[_0xbbc0('0x15')](function(_0x56ad73){for(var _0x43113f=0x0;_0x43113f<_0x56ad73[_0xbbc0('0x41')];_0x43113f++){var _0x27952f=_[_0xbbc0('0x38')](_0x277876,['id',_0x56ad73[_0x43113f]['UserId']]);if(!_0x27952f){_0x27952f={'id':_0x56ad73[_0x43113f][_0xbbc0('0x42')],'name':_0x56ad73[_0x43113f][_0xbbc0('0x42')],'online':![],['pauseField']:![]};}var _0x244c4f={'id':_0x27952f['id'],'name':_0x27952f[_0xbbc0('0x10')],'online':Boolean(_0x27952f['online']),'paused':Boolean(_0x27952f[_0x20315c])};if(_0x244c4f[_0xbbc0('0x44')])_0x2be8ef[_0xbbc0('0x35')]++;_0x2be8ef[_0xbbc0('0x34')][_0xbbc0('0x21')](_0x244c4f);}return _0x2be8ef;});}function validateChannel(_0x1bd5b4){var _0x49cd97=utils[_0xbbc0('0x4a')]();if(!_[_0xbbc0('0x4b')](_0x49cd97,_0x1bd5b4[_0xbbc0('0x4c')]()))throw new Error(_0xbbc0('0x4d'));return _0x1bd5b4[_0xbbc0('0x4c')]();}exports[_0xbbc0('0x4e')]=function(_0x1266db,_0x8ce4cf){var _0x23ee68={'count':0x0,'rows':[]};var _0x2771cd={};var _0x23e9ee;var _0x526a3a;var _0x17cb6c;var _0x365fed;var _0x37e53e=utils[_0xbbc0('0x4a')]();var _0x4a4e12=_0x1266db['query'][_0xbbc0('0x4f')];var _0x2366a7=_0x1266db[_0xbbc0('0x50')][_0xbbc0('0x51')];var _0x3db93b=_0x1266db[_0xbbc0('0x50')][_0xbbc0('0x52')];var _0x47b464=_0x2366a7==='pause'||_0x2366a7===_0xbbc0('0x53')?!![]:![];var _0x332975=[];var _0x394fe5;Promise[_0xbbc0('0x54')]()['then'](function(){if(_0x1266db['query'][_0xbbc0('0x55')]){_0x23e9ee=validateChannel(_0x1266db['query'][_0xbbc0('0x55')]);}if(!_0x1266db['query'][_0xbbc0('0x56')]||!_0x1266db[_0xbbc0('0x50')]['sort'][_0xbbc0('0x4b')]('globalStatus')){_0x1266db[_0xbbc0('0x50')][_0xbbc0('0x56')]=rta[_0xbbc0('0x57')](_0x1266db[_0xbbc0('0x50')]['sort']);return;}var _0x234a84=rta[_0xbbc0('0x58')](_0x1266db[_0xbbc0('0x50')][_0xbbc0('0x56')]);_0x1266db[_0xbbc0('0x50')]['sort']=_0x234a84[_0xbbc0('0x59')][_0xbbc0('0x5a')](',');_0x526a3a=_0x234a84[_0xbbc0('0x5b')];})[_0xbbc0('0x15')](function(){if(!_0x4a4e12){return[];}return rta['getAgentIdsByQueues'](_0x4a4e12,_0x23e9ee);})['then'](function(_0x3c8597){_0x332975=_0x3c8597;return rta[_0xbbc0('0x5c')]();})[_0xbbc0('0x15')](function(_0x48a61c){_0x365fed=_0x48a61c[_0xbbc0('0x5d')];if((!_0x2366a7||_0x47b464)&&!_0x526a3a){return _0x332975;}if(_0x526a3a&&!_0x2366a7){return rta[_0xbbc0('0x5e')](_0x365fed,_0x332975,_0x526a3a);}else{return rta['getAgentIdsByStatus'](_0x365fed,_0x332975,_0x2366a7);}})[_0xbbc0('0x15')](function(_0x181f4d){_0x332975=_0x181f4d;var _0x5e0d88=![];if(_0x332975[_0xbbc0('0x41')]===0x0){if(_0x4a4e12||_0x2366a7){_0x5e0d88=!![];}if(_0x47b464){_0x5e0d88=![];}}if(_0x5e0d88){return _0x23ee68;}var _0x5cd70b=_[_0xbbc0('0x32')](db[_0xbbc0('0x45')][_0xbbc0('0x5f')],function(_0x1cdf53){return{'name':_0x1cdf53[_0xbbc0('0x60')],'type':_0x1cdf53['type'][_0xbbc0('0x61')]};});_0x1266db[_0xbbc0('0x50')][_0xbbc0('0x62')]='agent';_0x1266db[_0xbbc0('0x50')][_0xbbc0('0x44')]=!![];_0x2771cd=qs[_0xbbc0('0x63')](_0x5cd70b,_0x1266db);_0x2771cd['raw']=!![];var _0x45f8ab=[];if(_0x332975['length']>0x0){_0x45f8ab['push']({'id':{'$in':_0x332975}});if(_0x526a3a&&!_0x2366a7){_0x394fe5=[db[_0xbbc0('0x64')]['literal'](_0xbbc0('0x65')+_0x332975+')')];_0x2771cd[_0xbbc0('0x5b')]=_0x394fe5;}}if(_0x47b464){_0x37e53e['forEach'](function(_0x31ec8d){var _0x20a870=!![];if(_0x2366a7===_0xbbc0('0x53')&&_0x23e9ee!==_0x31ec8d){_0x20a870=![];}_0x45f8ab[_0xbbc0('0x21')]({[_0x31ec8d+_0xbbc0('0x47')]:_0x20a870});});if(_0x3db93b){_0x45f8ab[_0xbbc0('0x21')]({'pauseType':_0x3db93b});}}else if(_0x2366a7){_0x37e53e[_0xbbc0('0x66')](function(_0x12d0ad){_0x45f8ab['push']({[_0x12d0ad+_0xbbc0('0x47')]:![]});});}_0x2771cd[_0xbbc0('0x67')]=_['merge'](_0x2771cd['where'],{'$and':_0x45f8ab});if(_0x1266db[_0xbbc0('0x68')]['role']===_0xbbc0('0x68')){var _0x5a5793={'params':{'id':_0x1266db[_0xbbc0('0x68')]['userProfileId']},'query':{'section':_0xbbc0('0x69'),'role':_0xbbc0('0x6a'),'online':!![],'raw':!![],'ids':_0x332975,'customSorting':_0x394fe5}};if(_0x47b464){_0x5a5793[_0xbbc0('0x50')]['extraQueryConditions']=_0x45f8ab;}_0x5a5793[_0xbbc0('0x50')]=Object[_0xbbc0('0x6b')](_0x5a5793['query'],_0x1266db[_0xbbc0('0x50')]);delete _0x5a5793[_0xbbc0('0x50')]['id'];return db[_0xbbc0('0x6c')]['getResources'](_0x5a5793);}return db['User']['findAndCountAll'](_0x2771cd);})[_0xbbc0('0x15')](function(_0x5e3e63){_0x23ee68[_0xbbc0('0xa')]=_0x5e3e63[_0xbbc0('0xa')];_0x17cb6c=_0x5e3e63[_0xbbc0('0x5d')];return _0x17cb6c[_0xbbc0('0x32')](function(_0x42129c){var _0x2138e7=_[_0xbbc0('0x38')](_0x365fed,['id',_0x42129c['id']]);if(_0x2138e7){var _0x4af54a=rta[_0xbbc0('0x6d')](_0x2138e7);_[_0xbbc0('0x39')](_0x42129c,_0x4af54a);}_0x42129c['globalStatus']=rta[_0xbbc0('0x6e')](_0x42129c);if(_0x42129c[_0xbbc0('0x6f')][_0xbbc0('0x4b')](_0xbbc0('0x70'))){_0x37e53e[_0xbbc0('0x66')](function(_0x1a141c){if(_0x42129c[_0x1a141c+'Pause']){_0x42129c[_0x1a141c+_0xbbc0('0x71')]=_0xbbc0('0x70');}});}return _0x42129c;});})[_0xbbc0('0x15')](function(_0x20b84e){if(!_0x526a3a||_0x394fe5){return _0x20b84e;}return rta[_0xbbc0('0x72')](_0x20b84e,_0x526a3a);})[_0xbbc0('0x15')](function(_0x4a422c){_0x23ee68[_0xbbc0('0x5d')]=_0x4a422c;return _0x23ee68;})[_0xbbc0('0x15')](respondWithFilteredResult(_0x8ce4cf,_0x2771cd))[_0xbbc0('0x1a')](handleError(_0x8ce4cf,null));};exports[_0xbbc0('0x73')]=function(_0x22722c,_0x530c60){var _0x184f73={'count':0x0,'rows':[]},_0xcbd7ca={},_0x4d8006,_0x11078a,_0x374ba3,_0x2f42e3,_0x1f1675;Promise['resolve']()[_0xbbc0('0x15')](function(){if(_0x22722c[_0xbbc0('0x50')][_0xbbc0('0x55')])_0x4d8006=validateChannel(_0x22722c[_0xbbc0('0x50')][_0xbbc0('0x55')]);var _0x25c02e=_['startCase'](_0x4d8006)+'Queue';var _0x5afabe=_[_0xbbc0('0x32')](db[_0x25c02e][_0xbbc0('0x5f')],function(_0x2e64f0){return{'name':_0x2e64f0[_0xbbc0('0x60')],'type':_0x2e64f0[_0xbbc0('0x74')][_0xbbc0('0x61')]};});_0xcbd7ca=qs[_0xbbc0('0x63')](_0x5afabe,_0x22722c);if(_0x22722c[_0xbbc0('0x68')][_0xbbc0('0x62')]===_0xbbc0('0x68')){var _0x2393e3={'params':{'id':_0x22722c[_0xbbc0('0x68')]['userProfileId']},'query':{'section':_0x4d8006===_0xbbc0('0x12')&&_0x22722c[_0xbbc0('0x50')][_0xbbc0('0x74')]===_0xbbc0('0x37')?_0xbbc0('0x75'):_['startCase'](_0x4d8006)+'Queues','type':_0x22722c['query'][_0xbbc0('0x74')],'nolimit':!![],'sort':_0xbbc0('0x10'),'filter':_0x22722c[_0xbbc0('0x50')][_0xbbc0('0x3b')]}};return db[_0xbbc0('0x6c')]['getResources'](_0x2393e3);}return db[_0x25c02e][_0xbbc0('0x76')](_0xcbd7ca);})[_0xbbc0('0x15')](function(_0x19f11b){_0x184f73[_0xbbc0('0xa')]=_0x19f11b[_0xbbc0('0xa')];_0x11078a=_0x19f11b[_0xbbc0('0x5d')];return getRealtimeQueues(_0x22722c,_0x4d8006);})['then'](function(_0x548cf1){_0x2f42e3=_0x548cf1['rows'];return rta['getRealtimeAgents']();})[_0xbbc0('0x15')](function(_0x792898){_0x374ba3=_0x792898[_0xbbc0('0x5d')];if(_0x4d8006!=_0xbbc0('0x12'))return;return getRealtimeVoiceQueueChannels();})[_0xbbc0('0x15')](function(_0x28800b){_0x1f1675=_0x28800b?_0x28800b[_0xbbc0('0x5d')]:[];return initializeQueues(_0x11078a,_0x2f42e3,_0x4d8006,_0x22722c[_0xbbc0('0x50')]['type']);})['then'](function(_0x62b69d){var _0x2eee29=_0x62b69d[_0xbbc0('0x32')](function(_0x28e0ff){if(_0x4d8006===_0xbbc0('0x12'))return getVoiceQueueAgents(_0x28e0ff,_0x11078a,_0x374ba3,_0x1f1675);else return getQueueAgents(_0x28e0ff,_0x374ba3,_0x4d8006);});return Promise[_0xbbc0('0x77')](_0x2eee29);})['then'](function(_0x1829f1){_0x184f73[_0xbbc0('0x5d')]=_0x1829f1;return _0x184f73;})['then'](respondWithFilteredResult(_0x530c60,_0xcbd7ca))[_0xbbc0('0x1a')](handleError(_0x530c60,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 7f8c2e9..a71c6c1 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(_0x45ff81,_0x3cb624){var _0x1abf39=function(_0x118836){while(--_0x118836){_0x45ff81['push'](_0x45ff81['shift']());}};_0x1abf39(++_0x3cb624);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=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(_0x39ff71,_0x8e6288){var _0x3965bd=function(_0x3b7a67){while(--_0x3b7a67){_0x39ff71['push'](_0x39ff71['shift']());}};_0x3965bd(++_0x8e6288);}(_0xedd9,0xfc));var _0x9edd=function(_0x5773ef,_0x44c95e){_0x5773ef=_0x5773ef-0x0;var _0x5b20a3=_0xedd9[_0x5773ef];return _0x5b20a3;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 8eff2ef..23ee4c6 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 _0x8085=['STRING','DATE','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8085,0x71));var _0x5808=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x8085[_0x313c96];return _0x522f53;};'use strict';var Sequelize=require(_0x5808('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x5808('0x1')]},'scheduledat':{'type':Sequelize[_0x5808('0x2')]},'uniqueid':{'type':Sequelize[_0x5808('0x1')]},'starttime':{'type':Sequelize[_0x5808('0x2')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5808('0x1')]},'campaigntype':{'type':Sequelize[_0x5808('0x1')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x744c=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x744c,0xa0));var _0xc744=function(_0x449607,_0x287561){_0x449607=_0x449607-0x0;var _0x972d5=_0x744c[_0x449607];return _0x972d5;};'use strict';var Sequelize=require(_0xc744('0x0'));module[_0xc744('0x1')]={'state':{'type':Sequelize[_0xc744('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xc744('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xc744('0x3')]},'starttime':{'type':Sequelize[_0xc744('0x4')]},'responsetime':{'type':Sequelize[_0xc744('0x4')]},'ringtime':{'type':Sequelize[_0xc744('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc744('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 40962bd..85d42d9 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 _0x5106=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','exports','report_agent_preview','lodash'];(function(_0x3876f9,_0x30a8f4){var _0x5797ce=function(_0x18278e){while(--_0x18278e){_0x3876f9['push'](_0x3876f9['shift']());}};_0x5797ce(++_0x30a8f4);}(_0x5106,0x197));var _0x6510=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5106[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6510('0x0'));var util=require(_0x6510('0x1'));var logger=require(_0x6510('0x2'))(_0x6510('0x3'));var moment=require(_0x6510('0x4'));var BPromise=require(_0x6510('0x5'));var rp=require(_0x6510('0x6'));var fs=require('fs');var path=require(_0x6510('0x7'));var rimraf=require('rimraf');var config=require(_0x6510('0x8'));var attributes=require(_0x6510('0x9'));module[_0x6510('0xa')]=function(_0x44bc3a,_0x2d7fd4){return _0x44bc3a['define']('ReportAgentPreview',attributes,{'tableName':_0x6510('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8035=['rimraf','../../config/environment','exports','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2d2949,_0x24c559){var _0x4bb11f=function(_0x2a75d7){while(--_0x2a75d7){_0x2d2949['push'](_0x2d2949['shift']());}};_0x4bb11f(++_0x24c559);}(_0x8035,0xa3));var _0x5803=function(_0x46c1d5,_0x5ca335){_0x46c1d5=_0x46c1d5-0x0;var _0x40fe7b=_0x8035[_0x46c1d5];return _0x40fe7b;};'use strict';var _=require('lodash');var util=require(_0x5803('0x0'));var logger=require(_0x5803('0x1'))(_0x5803('0x2'));var moment=require(_0x5803('0x3'));var BPromise=require(_0x5803('0x4'));var rp=require(_0x5803('0x5'));var fs=require('fs');var path=require(_0x5803('0x6'));var rimraf=require(_0x5803('0x7'));var config=require(_0x5803('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0x5803('0x9')]=function(_0x41e174,_0x520db7){return _0x41e174['define']('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index c2dc3d3..b630291 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 _0x5190=['request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x312b8a,_0x3b75c2){var _0x3ab5f8=function(_0x466cfd){while(--_0x466cfd){_0x312b8a['push'](_0x312b8a['shift']());}};_0x3ab5f8(++_0x3b75c2);}(_0x5190,0x17a));var _0x0519=function(_0x37c07d,_0xdbdb5f){_0x37c07d=_0x37c07d-0x0;var _0x10dadc=_0x5190[_0x37c07d];return _0x10dadc;};'use strict';var _=require(_0x0519('0x0'));var util=require(_0x0519('0x1'));var moment=require(_0x0519('0x2'));var BPromise=require(_0x0519('0x3'));var rs=require(_0x0519('0x4'));var fs=require('fs');var Redis=require(_0x0519('0x5'));var db=require(_0x0519('0x6'))['db'];var utils=require(_0x0519('0x7'));var logger=require('../../config/logger')(_0x0519('0x8'));var config=require('../../config/environment');var jayson=require(_0x0519('0x9'));var client=jayson[_0x0519('0xa')][_0x0519('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3759a6,_0x175252,_0x1d8b73){return new BPromise(function(_0x1fcd6a,_0x32aa2a){return client[_0x0519('0xc')](_0x3759a6,_0x1d8b73)[_0x0519('0xd')](function(_0x6e76a7){logger[_0x0519('0xe')](_0x0519('0xf'),_0x175252,_0x0519('0x10'));logger[_0x0519('0x11')](_0x0519('0x12'),_0x175252,'request\x20sent',JSON[_0x0519('0x13')](_0x6e76a7));if(_0x6e76a7['error']){if(_0x6e76a7[_0x0519('0x14')][_0x0519('0x15')]===0x1f4){logger[_0x0519('0x14')](_0x0519('0xf'),_0x175252,_0x6e76a7[_0x0519('0x14')][_0x0519('0x16')]);return _0x32aa2a(_0x6e76a7[_0x0519('0x14')][_0x0519('0x16')]);}logger[_0x0519('0x14')](_0x0519('0xf'),_0x175252,_0x6e76a7[_0x0519('0x14')][_0x0519('0x16')]);return _0x1fcd6a(_0x6e76a7[_0x0519('0x14')]['message']);}else{logger[_0x0519('0xe')](_0x0519('0xf'),_0x175252,_0x0519('0x10'));_0x1fcd6a(_0x6e76a7[_0x0519('0x17')]['message']);}})[_0x0519('0x18')](function(_0x34d892){logger[_0x0519('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x175252,_0x34d892);_0x32aa2a(_0x34d892);});});}exports[_0x0519('0x19')]=function(_0x2ceb4d){var _0x59e454=this;return new Promise(function(_0x6bb44,_0x39d9a9){return db[_0x0519('0x1a')]['create'](_0x2ceb4d[_0x0519('0x1b')],{'raw':_0x2ceb4d['options']?_0x2ceb4d[_0x0519('0x1c')][_0x0519('0x1d')]===undefined?!![]:![]:!![]})[_0x0519('0xd')](function(_0x127589){logger[_0x0519('0xe')](_0x0519('0x19'),_0x2ceb4d);logger[_0x0519('0x11')]('CreateReportAgentPreview',_0x2ceb4d,JSON[_0x0519('0x13')](_0x127589));_0x6bb44(_0x127589);})[_0x0519('0x18')](function(_0x24297f){logger[_0x0519('0x14')](_0x0519('0x19'),_0x24297f[_0x0519('0x16')],_0x2ceb4d);_0x39d9a9(_0x59e454[_0x0519('0x14')](0x1f4,_0x24297f[_0x0519('0x16')]));});});}; \ No newline at end of file +var _0x27bc=['ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','debug','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x27bc,0x131));var _0xc27b=function(_0x507f1d,_0x4c14b6){_0x507f1d=_0x507f1d-0x0;var _0x8d6e46=_0x27bc[_0x507f1d];return _0x8d6e46;};'use strict';var _=require(_0xc27b('0x0'));var util=require(_0xc27b('0x1'));var moment=require('moment');var BPromise=require(_0xc27b('0x2'));var rs=require(_0xc27b('0x3'));var fs=require('fs');var Redis=require(_0xc27b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc27b('0x5'));var logger=require(_0xc27b('0x6'))(_0xc27b('0x7'));var config=require(_0xc27b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc27b('0x9')][_0xc27b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x429bd8,_0x3e0d6d,_0x21cdb6){return new BPromise(function(_0x3db9fa,_0x10bc91){return client[_0xc27b('0xb')](_0x429bd8,_0x21cdb6)[_0xc27b('0xc')](function(_0x33b0d1){logger[_0xc27b('0xd')](_0xc27b('0xe'),_0x3e0d6d,_0xc27b('0xf'));logger['debug'](_0xc27b('0x10'),_0x3e0d6d,_0xc27b('0xf'),JSON[_0xc27b('0x11')](_0x33b0d1));if(_0x33b0d1[_0xc27b('0x12')]){if(_0x33b0d1[_0xc27b('0x12')][_0xc27b('0x13')]===0x1f4){logger[_0xc27b('0x12')](_0xc27b('0xe'),_0x3e0d6d,_0x33b0d1[_0xc27b('0x12')][_0xc27b('0x14')]);return _0x10bc91(_0x33b0d1[_0xc27b('0x12')][_0xc27b('0x14')]);}logger[_0xc27b('0x12')](_0xc27b('0xe'),_0x3e0d6d,_0x33b0d1[_0xc27b('0x12')]['message']);return _0x3db9fa(_0x33b0d1['error'][_0xc27b('0x14')]);}else{logger['info'](_0xc27b('0xe'),_0x3e0d6d,_0xc27b('0xf'));_0x3db9fa(_0x33b0d1['result'][_0xc27b('0x14')]);}})[_0xc27b('0x15')](function(_0x30fdf0){logger[_0xc27b('0x12')](_0xc27b('0xe'),_0x3e0d6d,_0x30fdf0);_0x10bc91(_0x30fdf0);});});}exports[_0xc27b('0x16')]=function(_0x266de1){var _0x3ca39a=this;return new Promise(function(_0x5718ca,_0x5c0970){return db[_0xc27b('0x17')][_0xc27b('0x18')](_0x266de1[_0xc27b('0x19')],{'raw':_0x266de1[_0xc27b('0x1a')]?_0x266de1[_0xc27b('0x1a')][_0xc27b('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4e0bd6){logger[_0xc27b('0xd')](_0xc27b('0x16'),_0x266de1);logger[_0xc27b('0x1c')](_0xc27b('0x16'),_0x266de1,JSON[_0xc27b('0x11')](_0x4e0bd6));_0x5718ca(_0x4e0bd6);})[_0xc27b('0x15')](function(_0x162977){logger[_0xc27b('0x12')](_0xc27b('0x16'),_0x162977['message'],_0x266de1);_0x5c0970(_0x3ca39a[_0xc27b('0x12')](0x1f4,_0x162977[_0xc27b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 18fee73..a3e9abc 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 _0x4163=['/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','outboundChannels','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','post','queueNotify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts'];(function(_0xe6d1b1,_0x5c4bcc){var _0x484e49=function(_0x16cdcb){while(--_0x16cdcb){_0xe6d1b1['push'](_0xe6d1b1['shift']());}};_0x484e49(++_0x5c4bcc);}(_0x4163,0xee));var _0x3416=function(_0x4acf6f,_0x5072e5){_0x4acf6f=_0x4acf6f-0x0;var _0x3c6d3a=_0x4163[_0x4acf6f];return _0x3c6d3a;};'use strict';var multer=require(_0x3416('0x0'));var util=require(_0x3416('0x1'));var path=require(_0x3416('0x2'));var express=require(_0x3416('0x3'));var router=express['Router']();var auth=require(_0x3416('0x4'));var controller=require(_0x3416('0x5'));router[_0x3416('0x6')](_0x3416('0x7'),auth[_0x3416('0x8')](),controller[_0x3416('0x9')]);router['get'](_0x3416('0xa'),auth[_0x3416('0x8')](),controller[_0x3416('0xb')]);router[_0x3416('0x6')](_0x3416('0xc'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0x3416('0x6')](_0x3416('0xd'),auth['isAuthenticated'](),controller[_0x3416('0xe')]);router[_0x3416('0x6')](_0x3416('0xf'),auth['isAuthenticated'](),controller[_0x3416('0x10')]);router[_0x3416('0x6')](_0x3416('0x11'),auth[_0x3416('0x8')](),controller[_0x3416('0x12')]);router[_0x3416('0x6')]('/mail/accounts',auth[_0x3416('0x8')](),controller[_0x3416('0x13')]);router[_0x3416('0x6')](_0x3416('0x14'),auth['isAuthenticated'](),controller[_0x3416('0x15')]);router[_0x3416('0x6')](_0x3416('0x16'),auth['isAuthenticated'](),controller[_0x3416('0x17')]);router[_0x3416('0x6')](_0x3416('0x18'),auth[_0x3416('0x8')](),controller['whatsappQueues']);router[_0x3416('0x6')](_0x3416('0x19'),auth[_0x3416('0x8')](),controller[_0x3416('0x1a')]);router[_0x3416('0x6')](_0x3416('0x1b'),auth['isAuthenticated'](),controller[_0x3416('0x1c')]);router[_0x3416('0x6')](_0x3416('0x1d'),auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0x3416('0x6')](_0x3416('0x1e'),auth[_0x3416('0x8')](),controller['voiceQueuesChannel']);router[_0x3416('0x6')](_0x3416('0x1f'),auth[_0x3416('0x8')](),controller[_0x3416('0x20')]);router['get'](_0x3416('0x21'),auth[_0x3416('0x8')](),controller[_0x3416('0x22')]);router[_0x3416('0x6')]('/voice/queues/:id',auth[_0x3416('0x8')](),controller[_0x3416('0x23')]);router['put'](_0x3416('0x24'),auth[_0x3416('0x8')](),controller[_0x3416('0x25')]);router[_0x3416('0x6')](_0x3416('0x26'),auth[_0x3416('0x8')](),controller[_0x3416('0x27')]);router[_0x3416('0x6')]('/outbound/channels',auth[_0x3416('0x8')](),controller[_0x3416('0x28')]);router[_0x3416('0x6')]('/agents',auth['isAuthenticated'](),controller[_0x3416('0x29')]);router[_0x3416('0x2a')](_0x3416('0x2b'),auth[_0x3416('0x8')](),controller[_0x3416('0x2c')]);router[_0x3416('0x6')](_0x3416('0x2d'),auth[_0x3416('0x8')](),controller[_0x3416('0x2e')]);router[_0x3416('0x6')]('/trunks',auth[_0x3416('0x8')](),controller[_0x3416('0x2f')]);router[_0x3416('0x6')](_0x3416('0x30'),auth[_0x3416('0x8')](),controller[_0x3416('0x31')]);router[_0x3416('0x6')](_0x3416('0x32'),auth['isAuthenticated'](),controller[_0x3416('0x33')]);router['get'](_0x3416('0x34'),auth[_0x3416('0x8')](),controller[_0x3416('0x35')]);router[_0x3416('0x6')]('/mail/queues/waitinginteractions',auth[_0x3416('0x8')](),controller[_0x3416('0x36')]);router['get']('/openchannel/queues/waitinginteractions',auth[_0x3416('0x8')](),controller[_0x3416('0x37')]);router['get'](_0x3416('0x38'),auth[_0x3416('0x8')](),controller[_0x3416('0x39')]);router['get']('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router[_0x3416('0x6')](_0x3416('0x3a'),auth[_0x3416('0x8')](),controller[_0x3416('0x3b')]);router[_0x3416('0x6')](_0x3416('0x3c'),auth[_0x3416('0x8')](),controller['faxQueuesWaitingInteractions']);router['post'](_0x3416('0x3d'),auth['isAuthenticated'](),controller['queueNotify'](_0x3416('0x3e')));router[_0x3416('0x6')](_0x3416('0x3f'),auth[_0x3416('0x8')](),controller[_0x3416('0x40')]);router[_0x3416('0x41')]('/chat/queues/:id/notify',auth[_0x3416('0x8')](),controller[_0x3416('0x42')](_0x3416('0x43')));router[_0x3416('0x6')](_0x3416('0x44'),auth[_0x3416('0x8')](),controller[_0x3416('0x45')]);router[_0x3416('0x41')]('/fax/queues/:id/notify',auth[_0x3416('0x8')](),controller[_0x3416('0x42')](_0x3416('0x46')));router[_0x3416('0x6')](_0x3416('0x47'),auth[_0x3416('0x8')](),controller[_0x3416('0x48')]);router[_0x3416('0x41')](_0x3416('0x49'),auth[_0x3416('0x8')](),controller[_0x3416('0x42')](_0x3416('0x4a')));router[_0x3416('0x6')](_0x3416('0x4b'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0x3416('0x41')](_0x3416('0x4c'),auth['isAuthenticated'](),controller[_0x3416('0x42')]('sms'));router[_0x3416('0x41')](_0x3416('0x4d'),auth['isAuthenticated'](),controller[_0x3416('0x42')](_0x3416('0x4e')));router['get'](_0x3416('0x4f'),auth[_0x3416('0x8')](),controller[_0x3416('0x50')]);router[_0x3416('0x6')](_0x3416('0x51'),auth[_0x3416('0x8')](),controller[_0x3416('0x52')]);router['post'](_0x3416('0x53'),auth[_0x3416('0x8')](),controller[_0x3416('0x54')]);module[_0x3416('0x55')]=router; \ No newline at end of file +var _0x13fb=['isAuthenticated','voiceChannelMixMonitor','get','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','/campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','Router','./rpc.controller','/voice/channels','/voice/channels/:uniqueid/mixmonitor'];(function(_0x1778a8,_0x471207){var _0x59a0fb=function(_0x58146a){while(--_0x58146a){_0x1778a8['push'](_0x1778a8['shift']());}};_0x59a0fb(++_0x471207);}(_0x13fb,0xa0));var _0xb13f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x13fb[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xb13f('0x0'));var util=require(_0xb13f('0x1'));var path=require('path');var express=require('express');var router=express[_0xb13f('0x2')]();var auth=require('../../components/auth/service');var controller=require(_0xb13f('0x3'));router['get'](_0xb13f('0x4'),auth['isAuthenticated'](),controller['voiceChannels']);router['get'](_0xb13f('0x5'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x7')]);router[_0xb13f('0x8')](_0xb13f('0x9'),auth[_0xb13f('0x6')](),controller[_0xb13f('0xa')]);router['get'](_0xb13f('0xb'),auth[_0xb13f('0x6')](),controller['voiceQueues']);router[_0xb13f('0x8')](_0xb13f('0xc'),auth[_0xb13f('0x6')](),controller[_0xb13f('0xd')]);router[_0xb13f('0x8')](_0xb13f('0xe'),auth[_0xb13f('0x6')](),controller[_0xb13f('0xf')]);router[_0xb13f('0x8')](_0xb13f('0x10'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x11')]);router[_0xb13f('0x8')](_0xb13f('0x12'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x13')]);router['get'](_0xb13f('0x14'),auth[_0xb13f('0x6')](),controller['smsQueues']);router[_0xb13f('0x8')](_0xb13f('0x15'),auth[_0xb13f('0x6')](),controller['whatsappQueues']);router['get'](_0xb13f('0x16'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x17')]);router[_0xb13f('0x8')](_0xb13f('0x18'),auth['isAuthenticated'](),controller[_0xb13f('0x19')]);router[_0xb13f('0x8')](_0xb13f('0x1a'),auth['isAuthenticated'](),controller[_0xb13f('0x1b')]);router[_0xb13f('0x8')](_0xb13f('0x1c'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0xb13f('0x8')](_0xb13f('0x1d'),auth[_0xb13f('0x6')](),controller['voiceQueuesChannelHangup']);router['get'](_0xb13f('0x1e'),auth['isAuthenticated'](),controller[_0xb13f('0x1f')]);router[_0xb13f('0x8')](_0xb13f('0x20'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0xb13f('0x21')]('/voice/queues/:id',auth[_0xb13f('0x6')](),controller[_0xb13f('0x22')]);router[_0xb13f('0x8')](_0xb13f('0x23'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x24')]);router[_0xb13f('0x8')](_0xb13f('0x25'),auth[_0xb13f('0x6')](),controller['outboundChannels']);router[_0xb13f('0x8')](_0xb13f('0x26'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x27')]);router[_0xb13f('0x21')](_0xb13f('0x28'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x29')]);router[_0xb13f('0x8')](_0xb13f('0x2a'),auth['isAuthenticated'](),controller['telephones']);router['get'](_0xb13f('0x2b'),auth[_0xb13f('0x6')](),controller['trunks']);router[_0xb13f('0x8')](_0xb13f('0x2c'),auth[_0xb13f('0x6')](),controller['campaigns']);router['get'](_0xb13f('0x2d'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x2e')]);router[_0xb13f('0x8')]('/chat/queues/waitinginteractions',auth[_0xb13f('0x6')](),controller[_0xb13f('0x2f')]);router[_0xb13f('0x8')](_0xb13f('0x30'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x31')]);router[_0xb13f('0x8')](_0xb13f('0x32'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x33')]);router[_0xb13f('0x8')](_0xb13f('0x34'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x35')]);router[_0xb13f('0x8')](_0xb13f('0x36'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x37')]);router['get'](_0xb13f('0x38'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x39')]);router[_0xb13f('0x8')](_0xb13f('0x3a'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x3b')]);router[_0xb13f('0x3c')](_0xb13f('0x3d'),auth['isAuthenticated'](),controller[_0xb13f('0x3e')](_0xb13f('0x3f')));router[_0xb13f('0x8')](_0xb13f('0x40'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x41')]);router[_0xb13f('0x3c')](_0xb13f('0x42'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x3e')]('chat'));router[_0xb13f('0x8')](_0xb13f('0x43'),auth['isAuthenticated'](),controller[_0xb13f('0x44')]);router[_0xb13f('0x3c')](_0xb13f('0x45'),auth['isAuthenticated'](),controller[_0xb13f('0x3e')]('fax'));router['get']('/fax/queues/:id',auth[_0xb13f('0x6')](),controller[_0xb13f('0x46')]);router[_0xb13f('0x3c')](_0xb13f('0x47'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x3e')](_0xb13f('0x48')));router[_0xb13f('0x8')](_0xb13f('0x49'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x4a')]);router[_0xb13f('0x3c')](_0xb13f('0x4b'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x3e')](_0xb13f('0x4c')));router[_0xb13f('0x3c')](_0xb13f('0x4d'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x3e')]('whatsapp'));router[_0xb13f('0x8')](_0xb13f('0x4e'),auth[_0xb13f('0x6')](),controller['showSmsQueues']);router[_0xb13f('0x8')](_0xb13f('0x4f'),auth['isAuthenticated'](),controller[_0xb13f('0x50')]);router[_0xb13f('0x3c')](_0xb13f('0x51'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x52')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 1d17d06..2f39b25 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd51=['chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','value','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','create','Start','queue','*,*,*,*','Channel\x20field\x20is\x20mandatory','channel','capitalize','Agent\x20not\x20found','TransferReport','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','client','http','request','error','code','message','catch','status','json','stack','send','isNil','rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','interaction','user','name','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','interface','SIP/%s','agent','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts'];(function(_0x3070d5,_0x1d3284){var _0x2067e6=function(_0x15fe16){while(--_0x15fe16){_0x3070d5['push'](_0x3070d5['shift']());}};_0x2067e6(++_0x1d3284);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x18a6f9,_0x4834f5){_0x18a6f9=_0x18a6f9-0x0;var _0x762792=_0xbd51[_0x18a6f9];return _0x762792;};'use strict';var BPromise=require(_0x1bd5('0x0'));var moment=require('moment');var _=require(_0x1bd5('0x1'));var util=require(_0x1bd5('0x2'));var db=require(_0x1bd5('0x3'))['db'];var logger=require(_0x1bd5('0x4'))('api');var jayson=require('jayson/promise');var amiClient=jayson['client']['http']({'port':0x232a});var mailClient=jayson[_0x1bd5('0x5')][_0x1bd5('0x6')]({'port':0x232b});var routingClient=jayson[_0x1bd5('0x5')]['http']({'port':0x232c});function respondWithRpcPromise(_0x29abea,_0x30a385,_0x19077c){return new BPromise(function(_0x27d58f,_0xd8418f){var _0x4a7f90=_0x19077c?_0x19077c:amiClient;return _0x4a7f90[_0x1bd5('0x7')](_0x29abea,_0x30a385)['then'](function(_0x2bd975){if(_0x2bd975[_0x1bd5('0x8')]){if(_0x2bd975[_0x1bd5('0x8')][_0x1bd5('0x9')]===0x1f4){return _0xd8418f(_0x2bd975[_0x1bd5('0x8')][_0x1bd5('0xa')]);}return _0x27d58f(_0x2bd975['error'][_0x1bd5('0xa')]);}else{_0x27d58f(_0x2bd975['result']);}})[_0x1bd5('0xb')](function(_0x24e38c){_0xd8418f(_0x24e38c);});});}function respondWithResult(_0x37e8e1,_0x14606b){_0x14606b=_0x14606b||0xc8;return function(_0x177be0){if(_0x177be0){return _0x37e8e1[_0x1bd5('0xc')](_0x14606b)[_0x1bd5('0xd')](_0x177be0);}return _0x37e8e1['sendStatus'](0x194);};}function handleError(_0x5650b5,_0x8b2390){_0x8b2390=_0x8b2390||0x1f4;return function(_0x6d2c40){logger[_0x1bd5('0x8')](_0x6d2c40[_0x1bd5('0xe')]);if(_0x6d2c40['name']){delete _0x6d2c40['name'];}_0x5650b5[_0x1bd5('0xc')](_0x8b2390)[_0x1bd5('0xf')](_0x6d2c40);};}function findById(_0x2b2c57){return function(_0x4793dd){if(!_[_0x1bd5('0x10')](_0x2b2c57)&&!_[_0x1bd5('0x10')](_0x4793dd)&&!_[_0x1bd5('0x10')](_0x4793dd[_0x1bd5('0x11')])){return _[_0x1bd5('0x12')](_0x4793dd['rows'],function(_0x53ad5e){return _0x53ad5e['id']==_0x2b2c57;});}return null;};}exports[_0x1bd5('0x13')]=function(_0x260827,_0x476bd1){return respondWithRpcPromise(_0x1bd5('0x14'),_0x260827[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x476bd1,null))[_0x1bd5('0xb')](handleError(_0x476bd1,null));};exports[_0x1bd5('0x17')]=function(_0x456051,_0xb1ac1e){return respondWithRpcPromise(_0x1bd5('0x18'),_[_0x1bd5('0x19')](_0x456051[_0x1bd5('0x15')],_0x456051[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0xb1ac1e,null))[_0x1bd5('0xb')](handleError(_0xb1ac1e,null));};exports[_0x1bd5('0x1b')]=function(_0x29c340,_0x5567c9){return respondWithRpcPromise(_0x1bd5('0x1c'),_['merge'](_0x29c340[_0x1bd5('0x15')],_0x29c340[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x5567c9,null))['catch'](handleError(_0x5567c9,null));};exports[_0x1bd5('0x1d')]=function(_0x4fa37c,_0x2ed551){return respondWithRpcPromise(_0x1bd5('0x1e'),_0x4fa37c[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x2ed551,null))['catch'](handleError(_0x2ed551,null));};exports[_0x1bd5('0x1f')]=function(_0x69bb17,_0x20245c){return respondWithRpcPromise(_0x1bd5('0x1e'),_0x69bb17['query'])[_0x1bd5('0x16')](findById(_0x69bb17[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x20245c,null))[_0x1bd5('0xb')](handleError(_0x20245c,null));};exports[_0x1bd5('0x20')]=function(_0xc73670,_0x4e72b2){return respondWithRpcPromise(_0x1bd5('0x21'),_[_0x1bd5('0x19')](_0xc73670[_0x1bd5('0x22')],_0xc73670['params']))[_0x1bd5('0x16')](respondWithResult(_0x4e72b2,null))[_0x1bd5('0xb')](handleError(_0x4e72b2,null));};exports[_0x1bd5('0x23')]=function(_0x3430bf,_0x1f4456){return respondWithRpcPromise(_0x1bd5('0x24'),_['merge'](_0x3430bf['query'],_0x3430bf[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x1f4456,null))['catch'](handleError(_0x1f4456,null));};exports[_0x1bd5('0x25')]=function(_0x198b88,_0x1efa8c){return respondWithRpcPromise(_0x1bd5('0x26'),_0x198b88['query'])[_0x1bd5('0x16')](respondWithResult(_0x1efa8c,null))[_0x1bd5('0xb')](handleError(_0x1efa8c,null));};exports[_0x1bd5('0x27')]=function(_0x233743,_0x209ce1){return respondWithRpcPromise(_0x1bd5('0x28'),_[_0x1bd5('0x19')](_0x233743[_0x1bd5('0x15')],_0x233743['params']))[_0x1bd5('0x16')](respondWithResult(_0x209ce1,null))[_0x1bd5('0xb')](handleError(_0x209ce1,null));};exports[_0x1bd5('0x29')]=function(_0x24c92e,_0x11a6d2){return respondWithRpcPromise(_0x1bd5('0x2a'),_[_0x1bd5('0x19')](_0x24c92e['query'],_0x24c92e[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x11a6d2,null))[_0x1bd5('0xb')](handleError(_0x11a6d2,null));};exports[_0x1bd5('0x2b')]=function(_0x3cf898,_0x192ca7){return respondWithRpcPromise(_0x1bd5('0x2c'),_['merge'](_0x3cf898['query'],_0x3cf898[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x192ca7,null))[_0x1bd5('0xb')](handleError(_0x192ca7,null));};exports['outbound']=function(_0x4595a0,_0x5af974){return respondWithRpcPromise(_0x1bd5('0x2d'),_0x4595a0[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x5af974,null))[_0x1bd5('0xb')](handleError(_0x5af974,null));};exports[_0x1bd5('0x2e')]=function(_0x2470ec,_0x41096d){return respondWithRpcPromise(_0x1bd5('0x2f'),_0x2470ec['query'])[_0x1bd5('0x16')](respondWithResult(_0x41096d,null))[_0x1bd5('0xb')](handleError(_0x41096d,null));};exports['agents']=function(_0x3b5a0d,_0x77ebcf){var _0x20b25c;return respondWithRpcPromise('Agents',_0x3b5a0d[_0x1bd5('0x15')])[_0x1bd5('0x16')](function(_0x2997a2){_0x20b25c=_0x2997a2;return respondWithRpcPromise(_0x1bd5('0x30'),_0x3b5a0d['query'],routingClient);})[_0x1bd5('0x16')](function(_0x22f437){return _[_0x1bd5('0x19')]({},_0x22f437,_0x20b25c);})[_0x1bd5('0x16')](respondWithResult(_0x77ebcf,null))['catch'](handleError(_0x77ebcf,null));};exports['agentCapacity']=function(_0x40eeff,_0x35afc7){if(_0x40eeff[_0x1bd5('0x22')]&&_0x40eeff['body'][_0x1bd5('0x31')]&&_0x40eeff[_0x1bd5('0x32')]&&_0x40eeff['user'][_0x1bd5('0x33')]){for(var _0x5761b8 in _0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')]){if(_0x40eeff['body'][_0x1bd5('0x31')][_0x1bd5('0x34')](_0x5761b8)){db[_0x1bd5('0x35')][_0x1bd5('0x36')]({'where':{'channel':_0x5761b8,'membername':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')],'type':_0x1bd5('0x37'),'exitAt':null,'uniqueid':_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8]&&_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8][_0x1bd5('0x38')]?{'$notIn':_0x40eeff['body'][_0x1bd5('0x31')][_0x5761b8]}:{'$ne':null}}})[_0x1bd5('0x16')](function(_0x335125){var _0x52ade4=moment()[_0x1bd5('0x39')](_0x1bd5('0x3a'));for(var _0x5bb8a6=0x0,_0x1dbde9=_0x335125['length'];_0x5bb8a6<_0x1dbde9;_0x5bb8a6+=0x1){_0x335125[_0x5bb8a6][_0x1bd5('0x3b')]({'exitAt':_0x52ade4});}});for(var _0x558fec=0x0;_0x558fec<_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8]['length'];_0x558fec+=0x1){db[_0x1bd5('0x35')]['findOrCreate']({'where':{'channel':_0x5761b8,'membername':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')],'type':_0x1bd5('0x37'),'uniqueid':_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8][_0x558fec],'exitAt':null},'defaults':{'channel':_0x5761b8,'membername':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')],'interface':_[_0x1bd5('0x10')](_0x40eeff['user'][_0x1bd5('0x3c')])?util[_0x1bd5('0x39')](_0x1bd5('0x3d'),_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')]):_0x40eeff[_0x1bd5('0x32')]['interface'],'type':_0x1bd5('0x37'),'enterAt':moment()[_0x1bd5('0x39')](_0x1bd5('0x3a')),'role':_0x1bd5('0x3e'),'internal':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x3f')],'uniqueid':_0x40eeff[_0x1bd5('0x22')]['interaction'][_0x5761b8][_0x558fec]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x40eeff[_0x1bd5('0x1a')]['id'],'capacity':_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x40')]},routingClient)['then'](respondWithResult(_0x35afc7,null))[_0x1bd5('0xb')](handleError(_0x35afc7,null));};exports[_0x1bd5('0x41')]=function(_0x1ad2ff,_0x1f2d7e){return respondWithRpcPromise(_0x1bd5('0x42'),_0x1ad2ff[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x1f2d7e,null))['catch'](handleError(_0x1f2d7e,null));};exports[_0x1bd5('0x43')]=function(_0x2bcd23,_0x4f2d91){return respondWithRpcPromise(_0x1bd5('0x44'),_0x2bcd23['query'])[_0x1bd5('0x16')](respondWithResult(_0x4f2d91,null))['catch'](handleError(_0x4f2d91,null));};exports[_0x1bd5('0x45')]=function(_0x555ba1,_0x5a011e){return respondWithRpcPromise(_0x1bd5('0x46'),_0x555ba1[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x5a011e,null))[_0x1bd5('0xb')](handleError(_0x5a011e,null));};exports[_0x1bd5('0x47')]=function(_0x33f011,_0x35c478){return respondWithRpcPromise('ChatQueues',_0x33f011[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x35c478,null))[_0x1bd5('0xb')](handleError(_0x35c478,null));};exports[_0x1bd5('0x48')]=function(_0x2cc5ba,_0x5a8132){return respondWithRpcPromise('ChatQueues',_0x2cc5ba[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0x2cc5ba[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x5a8132,null))[_0x1bd5('0xb')](handleError(_0x5a8132,null));};exports[_0x1bd5('0x49')]=function(_0x46e36c,_0x383a68){return respondWithRpcPromise(_0x1bd5('0x4a'),_0x46e36c[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x383a68,null))[_0x1bd5('0xb')](handleError(_0x383a68,null));};exports['showMailQueues']=function(_0x2fe8f4,_0x34d93b){return respondWithRpcPromise(_0x1bd5('0x4a'),_0x2fe8f4['query'],routingClient)[_0x1bd5('0x16')](findById(_0x2fe8f4[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x34d93b,null))['catch'](handleError(_0x34d93b,null));};exports[_0x1bd5('0x4b')]=function(_0x10103a,_0x39f973){return respondWithRpcPromise(_0x1bd5('0x4c'),_0x10103a['query'],mailClient)['then'](respondWithResult(_0x39f973,null))[_0x1bd5('0xb')](handleError(_0x39f973,null));};exports[_0x1bd5('0x4d')]=function(_0x1790af,_0x54a8c4){return respondWithRpcPromise('OpenchannelQueues',_0x1790af[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x54a8c4,null))[_0x1bd5('0xb')](handleError(_0x54a8c4,null));};exports[_0x1bd5('0x4e')]=function(_0x5068ae,_0x32f646){return respondWithRpcPromise('OpenchannelQueues',_0x5068ae[_0x1bd5('0x15')],routingClient)['then'](findById(_0x5068ae[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x32f646,null))['catch'](handleError(_0x32f646,null));};exports[_0x1bd5('0x4f')]=function(_0x19f765,_0x47ca3f){return respondWithRpcPromise('SmsQueues',_0x19f765[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x47ca3f,null))['catch'](handleError(_0x47ca3f,null));};exports[_0x1bd5('0x50')]=function(_0x40b508,_0x5da595){return respondWithRpcPromise('SmsQueues',_0x40b508[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0x40b508[_0x1bd5('0x1a')]['id']))['then'](respondWithResult(_0x5da595,null))[_0x1bd5('0xb')](handleError(_0x5da595,null));};exports[_0x1bd5('0x51')]=function(_0x5c1db7,_0x4b317d){return respondWithRpcPromise(_0x1bd5('0x52'),_0x5c1db7[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x4b317d,null))[_0x1bd5('0xb')](handleError(_0x4b317d,null));};exports[_0x1bd5('0x53')]=function(_0x53c6de,_0x3827d7){return respondWithRpcPromise('WhatsappQueues',_0x53c6de[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0x53c6de[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x3827d7,null))['catch'](handleError(_0x3827d7,null));};exports['faxQueues']=function(_0x3a7dd6,_0x36d62e){return respondWithRpcPromise(_0x1bd5('0x54'),_0x3a7dd6[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x36d62e,null))[_0x1bd5('0xb')](handleError(_0x36d62e,null));};exports[_0x1bd5('0x55')]=function(_0xc080d5,_0x1a35cf){return respondWithRpcPromise(_0x1bd5('0x54'),_0xc080d5[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0xc080d5[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x1a35cf,null))[_0x1bd5('0xb')](handleError(_0x1a35cf,null));};exports[_0x1bd5('0x56')]=function(_0x1b99ff,_0x195176){return respondWithRpcPromise(_0x1bd5('0x57'),_0x1b99ff[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x195176,null))[_0x1bd5('0xb')](handleError(_0x195176,null));};exports[_0x1bd5('0x58')]=function(_0x3ddf27,_0x56e99c){return respondWithRpcPromise(_0x1bd5('0x59'),_0x3ddf27[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x56e99c,null))[_0x1bd5('0xb')](handleError(_0x56e99c,null));};exports[_0x1bd5('0x5a')]=function(_0x37a6f3,_0x1e282c){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x37a6f3[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x1e282c,null))[_0x1bd5('0xb')](handleError(_0x1e282c,null));};exports[_0x1bd5('0x5b')]=function(_0x590b3d,_0x2ed59d){return respondWithRpcPromise(_0x1bd5('0x5c'),_0x590b3d[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x2ed59d,null))[_0x1bd5('0xb')](handleError(_0x2ed59d,null));};exports[_0x1bd5('0x5d')]=function(_0x32a878,_0x4cc7a5){return respondWithRpcPromise(_0x1bd5('0x5c'),_0x32a878['query'],routingClient)['then'](function(_0x34f98c){if(_0x32a878['query'][_0x1bd5('0x5e')]!==undefined){var _0x1a4ee6=_(_0x34f98c['rows'])[_0x1bd5('0x5f')]([_0x32a878[_0x1bd5('0x15')][_0x1bd5('0x5e')],_0x32a878[_0x1bd5('0x1a')]['id']])[_0x1bd5('0x60')](_0x1bd5('0x61'))['uniq']()[_0x1bd5('0x62')]();return _0x34f98c[_0x1bd5('0x11')][_0x1bd5('0x5f')](function(_0x1c9cec){return _0x1a4ee6['indexOf'](_0x1c9cec['queue_id'])>-0x1;});}else{return _0x34f98c[_0x1bd5('0x11')][_0x1bd5('0x5f')](function(_0x2fe037){return _0x2fe037[_0x1bd5('0x61')]===parseInt(_0x32a878['params']['id']);});}})[_0x1bd5('0x16')](respondWithResult(_0x4cc7a5,null))['catch'](handleError(_0x4cc7a5,null));};exports['smsQueuesWaitingInteractions']=function(_0x3a203f,_0x5045f9){return respondWithRpcPromise(_0x1bd5('0x63'),_0x3a203f[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x5045f9,null))[_0x1bd5('0xb')](handleError(_0x5045f9,null));};exports[_0x1bd5('0x64')]=function(_0xab4ed6,_0x232077){return respondWithRpcPromise(_0x1bd5('0x65'),_0xab4ed6[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x232077,null))[_0x1bd5('0xb')](handleError(_0x232077,null));};exports['faxQueuesWaitingInteractions']=function(_0x58c715,_0x59b491){return respondWithRpcPromise(_0x1bd5('0x66'),_0x58c715['query'],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x59b491,null))[_0x1bd5('0xb')](handleError(_0x59b491,null));};exports[_0x1bd5('0x67')]=function(_0x4a3f74){return function(_0x201968,_0x91bcf8){var _0x3410f8,_0x52cd5f;var _0xfc9282=_['capitalize'](_0x4a3f74);var _0x327eb6=_0x4a3f74===_0x1bd5('0x68')?_0x1bd5('0x69'):'Account';return db[_0xfc9282+'Queue'][_0x1bd5('0x6a')]({'raw':!![],'where':{'id':_0x201968['params']['id']}})[_0x1bd5('0x16')](function(_0x53be05){if(_[_0x1bd5('0x10')](_0x53be05)){throw new Error(_0xfc9282+_0x1bd5('0x6b'));}_0x3410f8=_0x53be05;return db[_0xfc9282+_0x1bd5('0x6c')][_0x1bd5('0x6a')]({'where':{'id':_0x201968[_0x1bd5('0x22')][_0x1bd5('0x6d')]},'include':[{'model':db[_0xfc9282+_0x1bd5('0x6e')],'as':_0x1bd5('0x6e')},{'model':db[_0xfc9282+_0x327eb6],'as':_0x1bd5('0x6f')}]});})[_0x1bd5('0x16')](function(_0x3c90dc){if(_[_0x1bd5('0x10')](_0x3c90dc)){throw new Error(_0xfc9282+_0x1bd5('0x70'));}_0x52cd5f=_0x3c90dc;return _0x3c90dc[_0x1bd5('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2a1b4a={'uniqueid':_0x4a3f74+'.'+_0x52cd5f['id']+'.'+_0x52cd5f[_0x1bd5('0x6e')]['id'],'FromUserId':_0x201968[_0x1bd5('0x32')]['id'],'type':'queue'};_0x2a1b4a[_0xfc9282+_0x1bd5('0x72')]=_0x52cd5f['id'];_0x2a1b4a[_0xfc9282+_0x1bd5('0x73')]=_0x52cd5f['Interaction']['id'];_0x2a1b4a[_0x1bd5('0x74')+_0xfc9282+_0x327eb6+'Id']=_0x52cd5f[_0x1bd5('0x6f')]['id'];_0x2a1b4a['To'+_0xfc9282+_0x1bd5('0x75')]=_0x3410f8['id'];return db[_0xfc9282+'TransferReport'][_0x1bd5('0x76')](_0x2a1b4a);})[_0x1bd5('0x16')](function(){return respondWithRpcPromise(_0x1bd5('0x77'),{'channel':_0x4a3f74,'interaction':_0x52cd5f[_0x1bd5('0x6e')],'message':_0x52cd5f,'account':_0x52cd5f['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x1bd5('0x78'),'appdata':_0x3410f8[_0x1bd5('0x33')]+','+(_0x52cd5f[_0x1bd5('0x6f')]['queueTransferTimeout']||0x12c),'interval':_0x1bd5('0x79')}]},routingClient);})[_0x1bd5('0x16')](respondWithResult(_0x91bcf8,null))['catch'](handleError(_0x91bcf8,null));};};exports['agentNotify']=function(_0x4230e9,_0x182d75){var _0x5c9098,_0x5d6b17;if(_[_0x1bd5('0x10')](_0x4230e9['body']['channel'])){throw new Error(_0x1bd5('0x7a'));}var _0x5cb13d=_0x4230e9[_0x1bd5('0x22')][_0x1bd5('0x7b')];var _0x5df043=_[_0x1bd5('0x7c')](_0x5cb13d);var _0x254c8d=_0x5cb13d===_0x1bd5('0x68')?'Website':_0x1bd5('0x6f');return db['User'][_0x1bd5('0x6a')]({'raw':!![],'where':{'id':_0x4230e9[_0x1bd5('0x1a')]['id'],'role':_0x1bd5('0x3e')}})[_0x1bd5('0x16')](function(_0x2f9dff){if(_['isNil'](_0x2f9dff)){throw new Error(_0x1bd5('0x7d'));}_0x5c9098=_0x2f9dff;return db[_0x5df043+'Message'][_0x1bd5('0x6a')]({'where':{'id':_0x4230e9['body']['messageId']},'include':[{'model':db[_0x5df043+_0x1bd5('0x6e')],'as':_0x1bd5('0x6e')},{'model':db[_0x5df043+_0x254c8d],'as':_0x1bd5('0x6f')}]});})[_0x1bd5('0x16')](function(_0x4c9931){if(_[_0x1bd5('0x10')](_0x4c9931)){throw new Error(_0x5df043+_0x1bd5('0x70'));}_0x5d6b17=_0x4c9931;return _0x4c9931[_0x1bd5('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x1bd5('0x16')](function(){var _0x15e584={'uniqueid':_0x5cb13d+'.'+_0x5d6b17['id']+'.'+_0x5d6b17[_0x1bd5('0x6e')]['id'],'FromUserId':_0x4230e9[_0x1bd5('0x32')]['id'],'type':_0x1bd5('0x78'),'ToUserId':_0x5c9098['id']};_0x15e584[_0x5df043+_0x1bd5('0x72')]=_0x5d6b17['id'];_0x15e584[_0x5df043+_0x1bd5('0x73')]=_0x5d6b17[_0x1bd5('0x6e')]['id'];_0x15e584[_0x1bd5('0x74')+_0x5df043+_0x254c8d+'Id']=_0x5d6b17[_0x1bd5('0x6f')]['id'];return db[_0x5df043+_0x1bd5('0x7e')]['create'](_0x15e584);})[_0x1bd5('0x16')](function(){return respondWithRpcPromise(_0x1bd5('0x77'),{'channel':_0x5cb13d,'interaction':_0x5d6b17[_0x1bd5('0x6e')],'message':_0x5d6b17,'account':_0x5d6b17[_0x1bd5('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1bd5('0x3e'),'appdata':_0x5c9098[_0x1bd5('0x33')]+','+(_0x5d6b17[_0x1bd5('0x6f')][_0x1bd5('0x7f')]||0x12c),'interval':_0x1bd5('0x79')}]},routingClient);})[_0x1bd5('0x16')](respondWithResult(_0x182d75,null))[_0x1bd5('0xb')](handleError(_0x182d75,null));}; \ No newline at end of file +var _0x038b=['\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','TransferReport','create','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','update','Start','agentTransferTimeout','moment','lodash','util','../../config/logger','jayson/promise','client','http','request','error','message','result','catch','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','then','voiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','agentCapacity','interaction','user','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','agent','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','showOpenchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne'];(function(_0x58fc97,_0x2a5958){var _0x929e2=function(_0x270ba0){while(--_0x270ba0){_0x58fc97['push'](_0x58fc97['shift']());}};_0x929e2(++_0x2a5958);}(_0x038b,0x114));var _0xb038=function(_0x1d5122,_0x495639){_0x1d5122=_0x1d5122-0x0;var _0x245c74=_0x038b[_0x1d5122];return _0x245c74;};'use strict';var BPromise=require('bluebird');var moment=require(_0xb038('0x0'));var _=require(_0xb038('0x1'));var util=require(_0xb038('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xb038('0x3'))('api');var jayson=require(_0xb038('0x4'));var amiClient=jayson[_0xb038('0x5')]['http']({'port':0x232a});var mailClient=jayson[_0xb038('0x5')][_0xb038('0x6')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x2e3e64,_0x1b077a,_0x1534a9){return new BPromise(function(_0x4b4085,_0x48a4d7){var _0x462e8f=_0x1534a9?_0x1534a9:amiClient;return _0x462e8f[_0xb038('0x7')](_0x2e3e64,_0x1b077a)['then'](function(_0x53bcc0){if(_0x53bcc0[_0xb038('0x8')]){if(_0x53bcc0[_0xb038('0x8')]['code']===0x1f4){return _0x48a4d7(_0x53bcc0[_0xb038('0x8')][_0xb038('0x9')]);}return _0x4b4085(_0x53bcc0[_0xb038('0x8')][_0xb038('0x9')]);}else{_0x4b4085(_0x53bcc0[_0xb038('0xa')]);}})[_0xb038('0xb')](function(_0x1e6474){_0x48a4d7(_0x1e6474);});});}function respondWithResult(_0x439751,_0x16e4a3){_0x16e4a3=_0x16e4a3||0xc8;return function(_0x57acd8){if(_0x57acd8){return _0x439751[_0xb038('0xc')](_0x16e4a3)[_0xb038('0xd')](_0x57acd8);}return _0x439751[_0xb038('0xe')](0x194);};}function handleError(_0x3cc717,_0x3a71a6){_0x3a71a6=_0x3a71a6||0x1f4;return function(_0x13acc7){logger[_0xb038('0x8')](_0x13acc7['stack']);if(_0x13acc7[_0xb038('0xf')]){delete _0x13acc7[_0xb038('0xf')];}_0x3cc717[_0xb038('0xc')](_0x3a71a6)[_0xb038('0x10')](_0x13acc7);};}function findById(_0xdef213){return function(_0x2b4173){if(!_['isNil'](_0xdef213)&&!_[_0xb038('0x11')](_0x2b4173)&&!_[_0xb038('0x11')](_0x2b4173[_0xb038('0x12')])){return _[_0xb038('0x13')](_0x2b4173['rows'],function(_0x49b237){return _0x49b237['id']==_0xdef213;});}return null;};}exports[_0xb038('0x14')]=function(_0x3f48e6,_0x3e06ef){return respondWithRpcPromise(_0xb038('0x15'),_0x3f48e6['query'])[_0xb038('0x16')](respondWithResult(_0x3e06ef,null))[_0xb038('0xb')](handleError(_0x3e06ef,null));};exports[_0xb038('0x17')]=function(_0x33a377,_0xc6cd61){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xb038('0x18')](_0x33a377[_0xb038('0x19')],_0x33a377[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0xc6cd61,null))['catch'](handleError(_0xc6cd61,null));};exports[_0xb038('0x1b')]=function(_0x1b7505,_0x4bbf38){return respondWithRpcPromise(_0xb038('0x1c'),_[_0xb038('0x18')](_0x1b7505['query'],_0x1b7505[_0xb038('0x1a')]))['then'](respondWithResult(_0x4bbf38,null))[_0xb038('0xb')](handleError(_0x4bbf38,null));};exports[_0xb038('0x1d')]=function(_0x27ff21,_0x1df7c4){return respondWithRpcPromise(_0xb038('0x1e'),_0x27ff21[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x1df7c4,null))['catch'](handleError(_0x1df7c4,null));};exports[_0xb038('0x1f')]=function(_0x33cf3c,_0x226631){return respondWithRpcPromise('VoiceQueues',_0x33cf3c[_0xb038('0x19')])[_0xb038('0x16')](findById(_0x33cf3c[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x226631,null))[_0xb038('0xb')](handleError(_0x226631,null));};exports[_0xb038('0x20')]=function(_0x28a6a9,_0x12b3b6){return respondWithRpcPromise(_0xb038('0x21'),_['merge'](_0x28a6a9[_0xb038('0x22')],_0x28a6a9[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0x12b3b6,null))[_0xb038('0xb')](handleError(_0x12b3b6,null));};exports[_0xb038('0x23')]=function(_0xbc8958,_0x29a0d7){return respondWithRpcPromise(_0xb038('0x24'),_[_0xb038('0x18')](_0xbc8958[_0xb038('0x19')],_0xbc8958[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0x29a0d7,null))[_0xb038('0xb')](handleError(_0x29a0d7,null));};exports['voiceQueuesChannels']=function(_0x1d807a,_0x598554){return respondWithRpcPromise(_0xb038('0x25'),_0x1d807a[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x598554,null))[_0xb038('0xb')](handleError(_0x598554,null));};exports[_0xb038('0x26')]=function(_0x424b81,_0x3a393d){return respondWithRpcPromise(_0xb038('0x27'),_[_0xb038('0x18')](_0x424b81[_0xb038('0x19')],_0x424b81['params']))[_0xb038('0x16')](respondWithResult(_0x3a393d,null))[_0xb038('0xb')](handleError(_0x3a393d,null));};exports[_0xb038('0x28')]=function(_0x560342,_0x51e649){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xb038('0x18')](_0x560342[_0xb038('0x19')],_0x560342[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0x51e649,null))[_0xb038('0xb')](handleError(_0x51e649,null));};exports[_0xb038('0x29')]=function(_0x48f777,_0x16abea){return respondWithRpcPromise(_0xb038('0x2a'),_[_0xb038('0x18')](_0x48f777[_0xb038('0x19')],_0x48f777['params']))[_0xb038('0x16')](respondWithResult(_0x16abea,null))[_0xb038('0xb')](handleError(_0x16abea,null));};exports['outbound']=function(_0x5cb40c,_0x26c769){return respondWithRpcPromise(_0xb038('0x2b'),_0x5cb40c[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x26c769,null))[_0xb038('0xb')](handleError(_0x26c769,null));};exports['outboundChannels']=function(_0x404f82,_0x125d2a){return respondWithRpcPromise(_0xb038('0x2c'),_0x404f82[_0xb038('0x19')])['then'](respondWithResult(_0x125d2a,null))[_0xb038('0xb')](handleError(_0x125d2a,null));};exports[_0xb038('0x2d')]=function(_0x7d2f79,_0x573426){var _0x412d71;return respondWithRpcPromise('Agents',_0x7d2f79[_0xb038('0x19')])[_0xb038('0x16')](function(_0x3ac1db){_0x412d71=_0x3ac1db;return respondWithRpcPromise('Agents',_0x7d2f79[_0xb038('0x19')],routingClient);})[_0xb038('0x16')](function(_0x4e0533){return _['merge']({},_0x4e0533,_0x412d71);})[_0xb038('0x16')](respondWithResult(_0x573426,null))[_0xb038('0xb')](handleError(_0x573426,null));};exports[_0xb038('0x2e')]=function(_0x3c291e,_0x5ad462){if(_0x3c291e[_0xb038('0x22')]&&_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')]&&_0x3c291e[_0xb038('0x30')]&&_0x3c291e['user'][_0xb038('0xf')]){for(var _0x269c7d in _0x3c291e['body'][_0xb038('0x2f')]){if(_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')]['hasOwnProperty'](_0x269c7d)){db[_0xb038('0x31')][_0xb038('0x32')]({'where':{'channel':_0x269c7d,'membername':_0x3c291e['user']['name'],'type':_0xb038('0x33'),'exitAt':null,'uniqueid':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d]&&_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d][_0xb038('0x34')]?{'$notIn':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d]}:{'$ne':null}}})['then'](function(_0x5f0d9d){var _0x5e8383=moment()[_0xb038('0x35')](_0xb038('0x36'));for(var _0x52f0b8=0x0,_0x46a724=_0x5f0d9d[_0xb038('0x34')];_0x52f0b8<_0x46a724;_0x52f0b8+=0x1){_0x5f0d9d[_0x52f0b8][_0xb038('0x37')]({'exitAt':_0x5e8383});}});for(var _0x5f24cd=0x0;_0x5f24cd<_0x3c291e[_0xb038('0x22')]['interaction'][_0x269c7d]['length'];_0x5f24cd+=0x1){db[_0xb038('0x31')][_0xb038('0x38')]({'where':{'channel':_0x269c7d,'membername':_0x3c291e[_0xb038('0x30')][_0xb038('0xf')],'type':_0xb038('0x33'),'uniqueid':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d][_0x5f24cd],'exitAt':null},'defaults':{'channel':_0x269c7d,'membername':_0x3c291e[_0xb038('0x30')][_0xb038('0xf')],'interface':_[_0xb038('0x11')](_0x3c291e['user'][_0xb038('0x39')])?util[_0xb038('0x35')]('SIP/%s',_0x3c291e[_0xb038('0x30')][_0xb038('0xf')]):_0x3c291e['user'][_0xb038('0x39')],'type':_0xb038('0x33'),'enterAt':moment()[_0xb038('0x35')](_0xb038('0x36')),'role':_0xb038('0x3a'),'internal':_0x3c291e[_0xb038('0x30')][_0xb038('0x3b')],'uniqueid':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d][_0x5f24cd]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3c291e[_0xb038('0x1a')]['id'],'capacity':_0x3c291e[_0xb038('0x22')][_0xb038('0x3c')]},routingClient)[_0xb038('0x16')](respondWithResult(_0x5ad462,null))[_0xb038('0xb')](handleError(_0x5ad462,null));};exports[_0xb038('0x3d')]=function(_0x591077,_0x1f4997){return respondWithRpcPromise(_0xb038('0x3e'),_0x591077[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x1f4997,null))[_0xb038('0xb')](handleError(_0x1f4997,null));};exports[_0xb038('0x3f')]=function(_0xd7a862,_0x5b82f4){return respondWithRpcPromise(_0xb038('0x40'),_0xd7a862['query'])[_0xb038('0x16')](respondWithResult(_0x5b82f4,null))[_0xb038('0xb')](handleError(_0x5b82f4,null));};exports[_0xb038('0x41')]=function(_0x998fe3,_0x1518c4){return respondWithRpcPromise('Campaigns',_0x998fe3['query'])['then'](respondWithResult(_0x1518c4,null))[_0xb038('0xb')](handleError(_0x1518c4,null));};exports[_0xb038('0x42')]=function(_0x276fac,_0x218368){return respondWithRpcPromise(_0xb038('0x43'),_0x276fac[_0xb038('0x19')],routingClient)['then'](respondWithResult(_0x218368,null))[_0xb038('0xb')](handleError(_0x218368,null));};exports[_0xb038('0x44')]=function(_0x5b2cbb,_0x5b27d3){return respondWithRpcPromise(_0xb038('0x43'),_0x5b2cbb['query'],routingClient)[_0xb038('0x16')](findById(_0x5b2cbb['params']['id']))[_0xb038('0x16')](respondWithResult(_0x5b27d3,null))[_0xb038('0xb')](handleError(_0x5b27d3,null));};exports[_0xb038('0x45')]=function(_0x4300e9,_0x4ee38b){return respondWithRpcPromise(_0xb038('0x46'),_0x4300e9[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x4ee38b,null))[_0xb038('0xb')](handleError(_0x4ee38b,null));};exports[_0xb038('0x47')]=function(_0x1246c8,_0x14a553){return respondWithRpcPromise(_0xb038('0x46'),_0x1246c8[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x1246c8[_0xb038('0x1a')]['id']))[_0xb038('0x16')](respondWithResult(_0x14a553,null))['catch'](handleError(_0x14a553,null));};exports[_0xb038('0x48')]=function(_0x2fc38d,_0x438e7e){return respondWithRpcPromise(_0xb038('0x49'),_0x2fc38d[_0xb038('0x19')],mailClient)['then'](respondWithResult(_0x438e7e,null))[_0xb038('0xb')](handleError(_0x438e7e,null));};exports['openchannelQueues']=function(_0xfb3ce6,_0x170a7e){return respondWithRpcPromise('OpenchannelQueues',_0xfb3ce6[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x170a7e,null))[_0xb038('0xb')](handleError(_0x170a7e,null));};exports[_0xb038('0x4a')]=function(_0x120cc7,_0x2f01c0){return respondWithRpcPromise(_0xb038('0x4b'),_0x120cc7[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x120cc7[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x2f01c0,null))[_0xb038('0xb')](handleError(_0x2f01c0,null));};exports['smsQueues']=function(_0x189894,_0x37e445){return respondWithRpcPromise(_0xb038('0x4c'),_0x189894[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x37e445,null))[_0xb038('0xb')](handleError(_0x37e445,null));};exports[_0xb038('0x4d')]=function(_0x4c23b2,_0x572ad4){return respondWithRpcPromise(_0xb038('0x4c'),_0x4c23b2[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x4c23b2['params']['id']))['then'](respondWithResult(_0x572ad4,null))[_0xb038('0xb')](handleError(_0x572ad4,null));};exports['whatsappQueues']=function(_0x35da9e,_0x50e078){return respondWithRpcPromise(_0xb038('0x4e'),_0x35da9e['query'],routingClient)[_0xb038('0x16')](respondWithResult(_0x50e078,null))[_0xb038('0xb')](handleError(_0x50e078,null));};exports[_0xb038('0x4f')]=function(_0x112d77,_0x2c57b9){return respondWithRpcPromise(_0xb038('0x4e'),_0x112d77['query'],routingClient)['then'](findById(_0x112d77[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x2c57b9,null))[_0xb038('0xb')](handleError(_0x2c57b9,null));};exports[_0xb038('0x50')]=function(_0x2f4650,_0x538690){return respondWithRpcPromise(_0xb038('0x51'),_0x2f4650['query'],routingClient)[_0xb038('0x16')](respondWithResult(_0x538690,null))[_0xb038('0xb')](handleError(_0x538690,null));};exports[_0xb038('0x52')]=function(_0x4a417a,_0x40abb7){return respondWithRpcPromise(_0xb038('0x51'),_0x4a417a[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x4a417a[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x40abb7,null))['catch'](handleError(_0x40abb7,null));};exports['faxAccounts']=function(_0x609caf,_0x4efa0f){return respondWithRpcPromise(_0xb038('0x53'),_0x609caf['query'])[_0xb038('0x16')](respondWithResult(_0x4efa0f,null))[_0xb038('0xb')](handleError(_0x4efa0f,null));};exports[_0xb038('0x54')]=function(_0x1294d7,_0x7c8d01){return respondWithRpcPromise(_0xb038('0x55'),_0x1294d7[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x7c8d01,null))[_0xb038('0xb')](handleError(_0x7c8d01,null));};exports[_0xb038('0x56')]=function(_0x1db407,_0x1a5cf6){return respondWithRpcPromise(_0xb038('0x57'),_0x1db407[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x1a5cf6,null))[_0xb038('0xb')](handleError(_0x1a5cf6,null));};exports[_0xb038('0x58')]=function(_0x123e31,_0x1f9a30){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x123e31[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x1f9a30,null))[_0xb038('0xb')](handleError(_0x1f9a30,null));};exports[_0xb038('0x59')]=function(_0xdaacfe,_0x5ead21){return respondWithRpcPromise(_0xb038('0x5a'),_0xdaacfe[_0xb038('0x19')],routingClient)[_0xb038('0x16')](function(_0x80d720){if(_0xdaacfe[_0xb038('0x19')][_0xb038('0x5b')]!==undefined){var _0x2acbf6=_(_0x80d720[_0xb038('0x12')])[_0xb038('0x5c')]([_0xdaacfe['query']['type'],_0xdaacfe[_0xb038('0x1a')]['id']])['map'](_0xb038('0x5d'))['uniq']()['value']();return _0x80d720['rows'][_0xb038('0x5c')](function(_0x463ae6){return _0x2acbf6['indexOf'](_0x463ae6[_0xb038('0x5d')])>-0x1;});}else{return _0x80d720[_0xb038('0x12')][_0xb038('0x5c')](function(_0x31ccf7){return _0x31ccf7[_0xb038('0x5d')]===parseInt(_0xdaacfe[_0xb038('0x1a')]['id']);});}})[_0xb038('0x16')](respondWithResult(_0x5ead21,null))[_0xb038('0xb')](handleError(_0x5ead21,null));};exports[_0xb038('0x5e')]=function(_0xde487d,_0x4b15b7){return respondWithRpcPromise(_0xb038('0x5f'),_0xde487d[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x4b15b7,null))[_0xb038('0xb')](handleError(_0x4b15b7,null));};exports[_0xb038('0x60')]=function(_0x222e90,_0x425854){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x222e90[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x425854,null))[_0xb038('0xb')](handleError(_0x425854,null));};exports['faxQueuesWaitingInteractions']=function(_0x551fcc,_0x2adf3b){return respondWithRpcPromise(_0xb038('0x61'),_0x551fcc[_0xb038('0x19')],routingClient)['then'](respondWithResult(_0x2adf3b,null))[_0xb038('0xb')](handleError(_0x2adf3b,null));};exports[_0xb038('0x62')]=function(_0x5b003a){return function(_0x2e6db4,_0x1d5640){var _0x240d06,_0x2a41c8;var _0x24f810=_[_0xb038('0x63')](_0x5b003a);var _0x1ea747=_0x5b003a===_0xb038('0x64')?_0xb038('0x65'):_0xb038('0x66');return db[_0x24f810+_0xb038('0x67')][_0xb038('0x68')]({'raw':!![],'where':{'id':_0x2e6db4[_0xb038('0x1a')]['id']}})[_0xb038('0x16')](function(_0x5d1410){if(_[_0xb038('0x11')](_0x5d1410)){throw new Error(_0x24f810+_0xb038('0x69'));}_0x240d06=_0x5d1410;return db[_0x24f810+_0xb038('0x6a')][_0xb038('0x68')]({'where':{'id':_0x2e6db4[_0xb038('0x22')][_0xb038('0x6b')]},'include':[{'model':db[_0x24f810+_0xb038('0x6c')],'as':_0xb038('0x6c')},{'model':db[_0x24f810+_0x1ea747],'as':'Account'}]});})[_0xb038('0x16')](function(_0x3e01ce){if(_['isNil'](_0x3e01ce)){throw new Error(_0x24f810+_0xb038('0x6d'));}_0x2a41c8=_0x3e01ce;return _0x3e01ce['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x38a4d3={'uniqueid':_0x5b003a+'.'+_0x2a41c8['id']+'.'+_0x2a41c8['Interaction']['id'],'FromUserId':_0x2e6db4[_0xb038('0x30')]['id'],'type':'queue'};_0x38a4d3[_0x24f810+_0xb038('0x6e')]=_0x2a41c8['id'];_0x38a4d3[_0x24f810+_0xb038('0x6f')]=_0x2a41c8[_0xb038('0x6c')]['id'];_0x38a4d3[_0xb038('0x70')+_0x24f810+_0x1ea747+'Id']=_0x2a41c8[_0xb038('0x66')]['id'];_0x38a4d3['To'+_0x24f810+_0xb038('0x71')]=_0x240d06['id'];return db[_0x24f810+_0xb038('0x72')][_0xb038('0x73')](_0x38a4d3);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x5b003a,'interaction':_0x2a41c8[_0xb038('0x6c')],'message':_0x2a41c8,'account':_0x2a41c8[_0xb038('0x66')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb038('0x74'),'appdata':_0x240d06[_0xb038('0xf')]+','+(_0x2a41c8['Account'][_0xb038('0x75')]||0x12c),'interval':_0xb038('0x76')}]},routingClient);})[_0xb038('0x16')](respondWithResult(_0x1d5640,null))[_0xb038('0xb')](handleError(_0x1d5640,null));};};exports[_0xb038('0x77')]=function(_0x139ffa,_0x208cdd){var _0x2ee9bd,_0x32ee35;if(_[_0xb038('0x11')](_0x139ffa['body']['channel'])){throw new Error(_0xb038('0x78'));}var _0xb7f025=_0x139ffa[_0xb038('0x22')][_0xb038('0x79')];var _0x3ee569=_[_0xb038('0x63')](_0xb7f025);var _0x3e129d=_0xb7f025==='chat'?_0xb038('0x65'):_0xb038('0x66');return db[_0xb038('0x7a')][_0xb038('0x68')]({'raw':!![],'where':{'id':_0x139ffa[_0xb038('0x1a')]['id'],'role':_0xb038('0x3a')}})['then'](function(_0x451fe5){if(_[_0xb038('0x11')](_0x451fe5)){throw new Error(_0xb038('0x7b'));}_0x2ee9bd=_0x451fe5;return db[_0x3ee569+_0xb038('0x6a')][_0xb038('0x68')]({'where':{'id':_0x139ffa[_0xb038('0x22')][_0xb038('0x6b')]},'include':[{'model':db[_0x3ee569+_0xb038('0x6c')],'as':_0xb038('0x6c')},{'model':db[_0x3ee569+_0x3e129d],'as':_0xb038('0x66')}]});})[_0xb038('0x16')](function(_0x22e0bd){if(_[_0xb038('0x11')](_0x22e0bd)){throw new Error(_0x3ee569+_0xb038('0x6d'));}_0x32ee35=_0x22e0bd;return _0x22e0bd[_0xb038('0x7c')]({'read':0x0,'readAt':null,'UserId':null});})[_0xb038('0x16')](function(){var _0x5448e3={'uniqueid':_0xb7f025+'.'+_0x32ee35['id']+'.'+_0x32ee35['Interaction']['id'],'FromUserId':_0x139ffa[_0xb038('0x30')]['id'],'type':_0xb038('0x74'),'ToUserId':_0x2ee9bd['id']};_0x5448e3[_0x3ee569+_0xb038('0x6e')]=_0x32ee35['id'];_0x5448e3[_0x3ee569+'InteractionId']=_0x32ee35[_0xb038('0x6c')]['id'];_0x5448e3[_0xb038('0x70')+_0x3ee569+_0x3e129d+'Id']=_0x32ee35[_0xb038('0x66')]['id'];return db[_0x3ee569+_0xb038('0x72')]['create'](_0x5448e3);})['then'](function(){return respondWithRpcPromise(_0xb038('0x7d'),{'channel':_0xb7f025,'interaction':_0x32ee35[_0xb038('0x6c')],'message':_0x32ee35,'account':_0x32ee35['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xb038('0x3a'),'appdata':_0x2ee9bd[_0xb038('0xf')]+','+(_0x32ee35[_0xb038('0x66')][_0xb038('0x7e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xb038('0x16')](respondWithResult(_0x208cdd,null))[_0xb038('0xb')](handleError(_0x208cdd,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index d9f5f9a..1e36fd8 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 _0x3f1a=['express','Router','fs-extra','./schedule.controller','get','isAuthenticated','show','run','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x1cd203,_0x3b71e0){var _0x35cd4=function(_0x340360){while(--_0x340360){_0x1cd203['push'](_0x1cd203['shift']());}};_0x35cd4(++_0x3b71e0);}(_0x3f1a,0x1eb));var _0xa3f1=function(_0x274ccc,_0x3c34d3){_0x274ccc=_0x274ccc-0x0;var _0x20c108=_0x3f1a[_0x274ccc];return _0x20c108;};'use strict';var multer=require(_0xa3f1('0x0'));var util=require(_0xa3f1('0x1'));var path=require('path');var timeout=require(_0xa3f1('0x2'));var express=require(_0xa3f1('0x3'));var router=express[_0xa3f1('0x4')]();var fs_extra=require(_0xa3f1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa3f1('0x6'));router[_0xa3f1('0x7')]('/',auth[_0xa3f1('0x8')](),controller['index']);router[_0xa3f1('0x7')]('/:id',auth[_0xa3f1('0x8')](),controller[_0xa3f1('0x9')]);router[_0xa3f1('0x7')]('/:id/run',auth[_0xa3f1('0x8')](),controller[_0xa3f1('0xa')]);router[_0xa3f1('0xb')]('/',auth[_0xa3f1('0x8')](),controller[_0xa3f1('0xc')]);router[_0xa3f1('0xd')](_0xa3f1('0xe'),auth[_0xa3f1('0x8')](),controller[_0xa3f1('0xf')]);router[_0xa3f1('0x10')]('/:id',auth[_0xa3f1('0x8')](),controller[_0xa3f1('0x11')]);module[_0xa3f1('0x12')]=router; \ No newline at end of file +var _0x33fc=['/:id','isAuthenticated','show','/:id/run','run','delete','destroy','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','index','get'];(function(_0x469d87,_0x541092){var _0x49f6ac=function(_0x5a59ce){while(--_0x5a59ce){_0x469d87['push'](_0x469d87['shift']());}};_0x49f6ac(++_0x541092);}(_0x33fc,0x107));var _0xc33f=function(_0x409c75,_0x50c9aa){_0x409c75=_0x409c75-0x0;var _0x38a7f3=_0x33fc[_0x409c75];return _0x38a7f3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc33f('0x0'));var router=express[_0xc33f('0x1')]();var fs_extra=require(_0xc33f('0x2'));var auth=require(_0xc33f('0x3'));var interaction=require(_0xc33f('0x4'));var config=require(_0xc33f('0x5'));var controller=require(_0xc33f('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc33f('0x7')]);router[_0xc33f('0x8')](_0xc33f('0x9'),auth[_0xc33f('0xa')](),controller[_0xc33f('0xb')]);router[_0xc33f('0x8')](_0xc33f('0xc'),auth[_0xc33f('0xa')](),controller[_0xc33f('0xd')]);router['post']('/',auth[_0xc33f('0xa')](),controller['create']);router['put'](_0xc33f('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xc33f('0xe')](_0xc33f('0x9'),auth['isAuthenticated'](),controller[_0xc33f('0xf')]);module[_0xc33f('0x10')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 6addecd..d064274 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 _0x872c=['sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','months','weeks','days','hours','minutes','csv','pdf','xlsx','ENUM','custom','default','TEXT','BOOLEAN'];(function(_0x2e4f49,_0x622233){var _0xd3d791=function(_0x24031f){while(--_0x24031f){_0x2e4f49['push'](_0x2e4f49['shift']());}};_0xd3d791(++_0x622233);}(_0x872c,0xf7));var _0xc872=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x872c[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xc872('0x0'));module[_0xc872('0x1')]={'name':{'type':Sequelize[_0xc872('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc872('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc872('0x3')},'startAt':{'type':Sequelize[_0xc872('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xc872('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc872('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years','quarters',_0xc872('0x6'),_0xc872('0x7'),_0xc872('0x8'),_0xc872('0x9'),_0xc872('0xa')),'allowNull':![],'defaultValue':_0xc872('0x8')},'output':{'type':Sequelize['ENUM'](_0xc872('0xb'),_0xc872('0xc'),_0xc872('0xd')),'allowNull':![],'defaultValue':_0xc872('0xb')},'type':{'type':Sequelize[_0xc872('0xe')](_0xc872('0xf'),_0xc872('0x10')),'allowNull':![],'defaultValue':_0xc872('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xc872('0x2')]},'cc':{'type':Sequelize[_0xc872('0x11')]},'bcc':{'type':Sequelize[_0xc872('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xc872('0x12')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa934=['quarters','weeks','days','hours','minutes','csv','pdf','custom','default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years'];(function(_0x51a6af,_0x219d20){var _0x190e2c=function(_0x1f391b){while(--_0x1f391b){_0x51a6af['push'](_0x51a6af['shift']());}};_0x190e2c(++_0x219d20);}(_0xa934,0xbe));var _0x4a93=function(_0x17f3b5,_0x511a3b){_0x17f3b5=_0x17f3b5-0x0;var _0x38f79c=_0xa934[_0x17f3b5];return _0x38f79c;};'use strict';var Sequelize=require(_0x4a93('0x0'));module['exports']={'name':{'type':Sequelize[_0x4a93('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4a93('0x1')]},'active':{'type':Sequelize[_0x4a93('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x4a93('0x1')],'allowNull':![],'defaultValue':_0x4a93('0x3')},'startAt':{'type':Sequelize[_0x4a93('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x4a93('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x4a93('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x4a93('0x6')](_0x4a93('0x7'),_0x4a93('0x8'),'months',_0x4a93('0x9'),_0x4a93('0xa'),_0x4a93('0xb'),_0x4a93('0xc')),'allowNull':![],'defaultValue':_0x4a93('0xa')},'output':{'type':Sequelize[_0x4a93('0x6')](_0x4a93('0xd'),_0x4a93('0xe'),'xlsx'),'allowNull':![],'defaultValue':_0x4a93('0xd')},'type':{'type':Sequelize[_0x4a93('0x6')](_0x4a93('0xf'),_0x4a93('0x10')),'allowNull':![],'defaultValue':_0x4a93('0xf')},'sendMail':{'type':Sequelize[_0x4a93('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x4a93('0x1')]},'cc':{'type':Sequelize[_0x4a93('0x11')]},'bcc':{'type':Sequelize[_0x4a93('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x4a93('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 56ce598..0527238 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 _0xbac5=['fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','zip-dir','fast-json-patch','moment','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','reject','save','then','get','Scheduler','UserProfileResource','destroy','error','name','send','map','Schedule'];(function(_0x592416,_0x2c75e9){var _0x3005fa=function(_0x21d0dd){while(--_0x21d0dd){_0x592416['push'](_0x592416['shift']());}};_0x3005fa(++_0x2c75e9);}(_0xbac5,0x7a));var _0x5bac=function(_0x207d2f,_0x44400f){_0x207d2f=_0x207d2f-0x0;var _0x3c3498=_0xbac5[_0x207d2f];return _0x3c3498;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5bac('0x0'));var jsonpatch=require(_0x5bac('0x1'));var rp=require('request-promise');var moment=require(_0x5bac('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5bac('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5bac('0x4'));var fs=require('fs');var fs_extra=require(_0x5bac('0x5'));var _=require(_0x5bac('0x6'));var squel=require(_0x5bac('0x7'));var crypto=require('crypto');var jsforce=require(_0x5bac('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x5bac('0x9'));var querystring=require(_0x5bac('0xa'));var Papa=require(_0x5bac('0xb'));var Redis=require(_0x5bac('0xc'));var authService=require(_0x5bac('0xd'));var qs=require(_0x5bac('0xe'));var as=require(_0x5bac('0xf'));var hardwareService=require(_0x5bac('0x10'));var logger=require('../../config/logger')(_0x5bac('0x11'));var utils=require(_0x5bac('0x12'));var config=require(_0x5bac('0x13'));var licenseUtil=require(_0x5bac('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10d2d7,_0x372d83){_0x372d83=_0x372d83||0xcc;return function(_0x29a2df){if(_0x29a2df){return _0x10d2d7[_0x5bac('0x15')](_0x372d83);}return _0x10d2d7[_0x5bac('0x16')](_0x372d83)[_0x5bac('0x17')]();};}function respondWithResult(_0x2e8482,_0x4494ef){_0x4494ef=_0x4494ef||0xc8;return function(_0x1439bd){if(_0x1439bd){return _0x2e8482[_0x5bac('0x16')](_0x4494ef)[_0x5bac('0x18')](_0x1439bd);}};}function respondWithFilteredResult(_0x2b1662,_0x49f0e1){return function(_0x19bbc5){if(_0x19bbc5){var _0x35c2ca=typeof _0x49f0e1['offset']===_0x5bac('0x19')&&typeof _0x49f0e1['limit']===_0x5bac('0x19');var _0x196f49=_0x19bbc5['count'];var _0x4e349d=_0x35c2ca?0x0:_0x49f0e1[_0x5bac('0x1a')];var _0x5cecd4=_0x35c2ca?_0x19bbc5[_0x5bac('0x1b')]:_0x49f0e1[_0x5bac('0x1a')]+_0x49f0e1[_0x5bac('0x1c')];var _0x4a1037;if(_0x5cecd4>=_0x196f49){_0x5cecd4=_0x196f49;_0x4a1037=0xc8;}else{_0x4a1037=0xce;}_0x2b1662[_0x5bac('0x16')](_0x4a1037);return _0x2b1662['set'](_0x5bac('0x1d'),_0x4e349d+'-'+_0x5cecd4+'/'+_0x196f49)[_0x5bac('0x18')](_0x19bbc5);}return null;};}function patchUpdates(_0x574eb0){return function(_0x3a0c5f){try{jsonpatch['apply'](_0x3a0c5f,_0x574eb0,!![]);}catch(_0x1fcf65){return BPromise[_0x5bac('0x1e')](_0x1fcf65);}return _0x3a0c5f[_0x5bac('0x1f')]();};}function saveUpdates(_0x4a9bac,_0x39dae4){return function(_0x2c0ca5){if(_0x2c0ca5){return _0x2c0ca5['update'](_0x4a9bac)['then'](function(_0x282339){return _0x282339;});}return null;};}function removeEntity(_0x115f56,_0x6c4803){return function(_0x3ea80e){if(_0x3ea80e){return _0x3ea80e['destroy']()[_0x5bac('0x20')](function(){var _0x5a14bd=_0x3ea80e[_0x5bac('0x21')]({'plain':!![]});var _0x21aaa5=_0x5bac('0x22');return db[_0x5bac('0x23')][_0x5bac('0x24')]({'where':{'type':_0x21aaa5,'resourceId':_0x5a14bd['id']}})[_0x5bac('0x20')](function(){return _0x3ea80e;});})[_0x5bac('0x20')](function(){_0x115f56[_0x5bac('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d8bca,_0x7525dd){return function(_0x1cef32){if(!_0x1cef32){_0x5d8bca[_0x5bac('0x15')](0x194);}return _0x1cef32;};}function handleError(_0x2d6650,_0xd41388){_0xd41388=_0xd41388||0x1f4;return function(_0x422bdf){logger[_0x5bac('0x25')](_0x422bdf['stack']);if(_0x422bdf[_0x5bac('0x26')]){delete _0x422bdf[_0x5bac('0x26')];}_0x2d6650[_0x5bac('0x16')](_0xd41388)[_0x5bac('0x27')](_0x422bdf);};}exports['index']=function(_0x339f41,_0x422dc1){var _0x136566={},_0x337fd4={},_0x35f502={'count':0x0,'rows':[]};var _0x566aba=_[_0x5bac('0x28')](db[_0x5bac('0x29')]['rawAttributes'],function(_0x485943){return{'name':_0x485943[_0x5bac('0x2a')],'type':_0x485943['type'][_0x5bac('0x2b')]};});_0x337fd4['model']=_[_0x5bac('0x28')](_0x566aba,_0x5bac('0x26'));_0x337fd4[_0x5bac('0x2c')]=_['keys'](_0x339f41['query']);_0x337fd4[_0x5bac('0x2d')]=_[_0x5bac('0x2e')](_0x337fd4[_0x5bac('0x2f')],_0x337fd4['query']);_0x136566[_0x5bac('0x30')]=_[_0x5bac('0x2e')](_0x337fd4['model'],qs[_0x5bac('0x31')](_0x339f41[_0x5bac('0x2c')][_0x5bac('0x31')]));_0x136566[_0x5bac('0x30')]=_0x136566[_0x5bac('0x30')][_0x5bac('0x32')]?_0x136566['attributes']:_0x337fd4['model'];if(!_0x339f41[_0x5bac('0x2c')][_0x5bac('0x33')](_0x5bac('0x34'))){_0x136566['limit']=qs['limit'](_0x339f41[_0x5bac('0x2c')][_0x5bac('0x1c')]);_0x136566[_0x5bac('0x1a')]=qs[_0x5bac('0x1a')](_0x339f41[_0x5bac('0x2c')]['offset']);}_0x136566[_0x5bac('0x35')]=qs[_0x5bac('0x36')](_0x339f41['query'][_0x5bac('0x36')]);_0x136566[_0x5bac('0x37')]=qs['filters'](_[_0x5bac('0x38')](_0x339f41['query'],_0x337fd4[_0x5bac('0x2d')]),_0x566aba);if(_0x339f41['query'][_0x5bac('0x39')]){_0x136566['where']=_[_0x5bac('0x3a')](_0x136566['where'],{'$or':_[_0x5bac('0x28')](_0x566aba,function(_0x2e08ac){if(_0x2e08ac[_0x5bac('0x3b')]!==_0x5bac('0x3c')){var _0x12671c={};_0x12671c[_0x2e08ac['name']]={'$like':'%'+_0x339f41[_0x5bac('0x2c')]['filter']+'%'};return _0x12671c;}})});}_0x136566=_[_0x5bac('0x3a')]({},_0x136566,_0x339f41[_0x5bac('0x3d')]);var _0x3654a0={'where':_0x136566[_0x5bac('0x37')]};return db[_0x5bac('0x29')][_0x5bac('0x1b')](_0x3654a0)[_0x5bac('0x20')](function(_0x42976e){_0x35f502[_0x5bac('0x1b')]=_0x42976e;if(_0x339f41[_0x5bac('0x2c')][_0x5bac('0x3e')]){_0x136566[_0x5bac('0x3f')]=[{'all':!![]}];}return db['Schedule'][_0x5bac('0x40')](_0x136566);})[_0x5bac('0x20')](function(_0x54424b){_0x35f502[_0x5bac('0x41')]=_0x54424b;return _0x35f502;})[_0x5bac('0x20')](respondWithFilteredResult(_0x422dc1,_0x136566))[_0x5bac('0x42')](handleError(_0x422dc1,null));};exports[_0x5bac('0x43')]=function(_0x15dbd7,_0xf62601){var _0xb46fd7={'raw':![],'where':{'id':_0x15dbd7[_0x5bac('0x44')]['id']}},_0x298ccb={};_0x298ccb[_0x5bac('0x2f')]=_['keys'](db[_0x5bac('0x29')][_0x5bac('0x45')]);_0x298ccb[_0x5bac('0x2c')]=_[_0x5bac('0x46')](_0x15dbd7[_0x5bac('0x2c')]);_0x298ccb[_0x5bac('0x2d')]=_[_0x5bac('0x2e')](_0x298ccb[_0x5bac('0x2f')],_0x298ccb[_0x5bac('0x2c')]);_0xb46fd7[_0x5bac('0x30')]=_['intersection'](_0x298ccb[_0x5bac('0x2f')],qs['fields'](_0x15dbd7[_0x5bac('0x2c')][_0x5bac('0x31')]));_0xb46fd7[_0x5bac('0x30')]=_0xb46fd7[_0x5bac('0x30')][_0x5bac('0x32')]?_0xb46fd7['attributes']:_0x298ccb[_0x5bac('0x2f')];if(_0x15dbd7[_0x5bac('0x2c')][_0x5bac('0x3e')]){_0xb46fd7[_0x5bac('0x3f')]=[{'all':!![]}];}_0xb46fd7=_[_0x5bac('0x3a')]({},_0xb46fd7,_0x15dbd7[_0x5bac('0x3d')]);return db[_0x5bac('0x29')][_0x5bac('0x47')](_0xb46fd7)[_0x5bac('0x20')](handleEntityNotFound(_0xf62601,null))[_0x5bac('0x20')](respondWithResult(_0xf62601,null))[_0x5bac('0x42')](handleError(_0xf62601,null));};exports[_0x5bac('0x48')]=function(_0x541043,_0x4eab72){return db[_0x5bac('0x29')][_0x5bac('0x48')](_0x541043[_0x5bac('0x49')],{})[_0x5bac('0x20')](function(_0x3d361c){var _0x17f73e=_0x541043[_0x5bac('0x4a')]['get']({'plain':!![]});if(!_0x17f73e)throw new Error(_0x5bac('0x4b'));if(_0x17f73e[_0x5bac('0x4c')]==='user'){var _0x4e391a=_0x3d361c[_0x5bac('0x21')]({'plain':!![]});var _0x4c56c3=_0x5bac('0x22');return db[_0x5bac('0x4d')][_0x5bac('0x47')]({'where':{'name':_0x4c56c3,'userProfileId':_0x17f73e[_0x5bac('0x4e')]},'raw':!![]})[_0x5bac('0x20')](function(_0x27df42){if(_0x27df42&&_0x27df42[_0x5bac('0x4f')]===0x0){return db[_0x5bac('0x23')][_0x5bac('0x48')]({'name':_0x4e391a['name'],'resourceId':_0x4e391a['id'],'type':_0x27df42[_0x5bac('0x26')],'sectionId':_0x27df42['id']},{})['then'](function(){return _0x3d361c;});}else{return _0x3d361c;}})[_0x5bac('0x42')](function(_0x12f879){logger[_0x5bac('0x25')](_0x5bac('0x50'),_0x12f879);throw _0x12f879;});}return _0x3d361c;})[_0x5bac('0x20')](respondWithResult(_0x4eab72,0xc9))[_0x5bac('0x42')](handleError(_0x4eab72,null));};exports[_0x5bac('0x51')]=function(_0x133b90,_0x4872db){if(_0x133b90[_0x5bac('0x49')]['id']){delete _0x133b90[_0x5bac('0x49')]['id'];}return db['Schedule'][_0x5bac('0x47')]({'where':{'id':_0x133b90[_0x5bac('0x44')]['id']}})[_0x5bac('0x20')](handleEntityNotFound(_0x4872db,null))[_0x5bac('0x20')](saveUpdates(_0x133b90[_0x5bac('0x49')],null))['then'](respondWithResult(_0x4872db,null))[_0x5bac('0x42')](handleError(_0x4872db,null));};exports[_0x5bac('0x24')]=function(_0x22173,_0x5cdbc2){return db['Schedule'][_0x5bac('0x47')]({'where':{'id':_0x22173[_0x5bac('0x44')]['id']}})[_0x5bac('0x20')](handleEntityNotFound(_0x5cdbc2,null))[_0x5bac('0x20')](removeEntity(_0x5cdbc2,null))[_0x5bac('0x42')](handleError(_0x5cdbc2,null));};exports['run']=function(_0x7dfb3,_0x2615a4,_0x5c135){var _0x353650=require('../../config/schedule');return db[_0x5bac('0x29')][_0x5bac('0x47')]({'where':{'id':_0x7dfb3['params']['id']},'raw':!![]})[_0x5bac('0x20')](handleEntityNotFound(_0x2615a4,null))[_0x5bac('0x20')](function(){_0x353650['run'](_0x7dfb3[_0x5bac('0x44')]['id']);})[_0x5bac('0x20')](respondWithStatusCode(_0x2615a4,null))['catch'](handleError(_0x2615a4,null));}; \ No newline at end of file +var _0x0e85=['eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Schedule','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','rawAttributes','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run'];(function(_0x5d6694,_0xf02a3a){var _0x5a20d0=function(_0x137bb1){while(--_0x137bb1){_0x5d6694['push'](_0x5d6694['shift']());}};_0x5a20d0(++_0xf02a3a);}(_0x0e85,0x1a9));var _0x50e8=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x0e85[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x50e8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x50e8('0x2'));var moment=require('moment');var BPromise=require(_0x50e8('0x3'));var Mustache=require(_0x50e8('0x4'));var util=require(_0x50e8('0x5'));var path=require(_0x50e8('0x6'));var sox=require(_0x50e8('0x7'));var csv=require('to-csv');var ejs=require(_0x50e8('0x8'));var fs=require('fs');var fs_extra=require(_0x50e8('0x9'));var _=require(_0x50e8('0xa'));var squel=require(_0x50e8('0xb'));var crypto=require(_0x50e8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x50e8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x50e8('0xe'));var Papa=require(_0x50e8('0xf'));var Redis=require(_0x50e8('0x10'));var authService=require(_0x50e8('0x11'));var qs=require(_0x50e8('0x12'));var as=require(_0x50e8('0x13'));var hardwareService=require(_0x50e8('0x14'));var logger=require(_0x50e8('0x15'))(_0x50e8('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x17'))['db'];function respondWithStatusCode(_0x41ddd1,_0x4334ee){_0x4334ee=_0x4334ee||0xcc;return function(_0x7ee4c9){if(_0x7ee4c9){return _0x41ddd1['sendStatus'](_0x4334ee);}return _0x41ddd1[_0x50e8('0x18')](_0x4334ee)['end']();};}function respondWithResult(_0x22096d,_0x5e3de6){_0x5e3de6=_0x5e3de6||0xc8;return function(_0x69c05b){if(_0x69c05b){return _0x22096d['status'](_0x5e3de6)[_0x50e8('0x19')](_0x69c05b);}};}function respondWithFilteredResult(_0x58cfcb,_0x1b97e6){return function(_0x34713e){if(_0x34713e){var _0x2cd902=typeof _0x1b97e6[_0x50e8('0x1a')]===_0x50e8('0x1b')&&typeof _0x1b97e6[_0x50e8('0x1c')]==='undefined';var _0x4b56fc=_0x34713e[_0x50e8('0x1d')];var _0x17c5ea=_0x2cd902?0x0:_0x1b97e6[_0x50e8('0x1a')];var _0x4cc498=_0x2cd902?_0x34713e['count']:_0x1b97e6['offset']+_0x1b97e6[_0x50e8('0x1c')];var _0x432507;if(_0x4cc498>=_0x4b56fc){_0x4cc498=_0x4b56fc;_0x432507=0xc8;}else{_0x432507=0xce;}_0x58cfcb[_0x50e8('0x18')](_0x432507);return _0x58cfcb[_0x50e8('0x1e')](_0x50e8('0x1f'),_0x17c5ea+'-'+_0x4cc498+'/'+_0x4b56fc)['json'](_0x34713e);}return null;};}function patchUpdates(_0x15f50e){return function(_0x33102a){try{jsonpatch[_0x50e8('0x20')](_0x33102a,_0x15f50e,!![]);}catch(_0x1bc715){return BPromise[_0x50e8('0x21')](_0x1bc715);}return _0x33102a['save']();};}function saveUpdates(_0x518612,_0x207d6d){return function(_0x3fa902){if(_0x3fa902){return _0x3fa902[_0x50e8('0x22')](_0x518612)[_0x50e8('0x23')](function(_0x4cceef){return _0x4cceef;});}return null;};}function removeEntity(_0xd5d659,_0x4a7d1f){return function(_0x4d5b4e){if(_0x4d5b4e){return _0x4d5b4e[_0x50e8('0x24')]()[_0x50e8('0x23')](function(){var _0x14b736=_0x4d5b4e[_0x50e8('0x25')]({'plain':!![]});var _0x477859='Scheduler';return db[_0x50e8('0x26')][_0x50e8('0x24')]({'where':{'type':_0x477859,'resourceId':_0x14b736['id']}})['then'](function(){return _0x4d5b4e;});})[_0x50e8('0x23')](function(){_0xd5d659['status'](0xcc)[_0x50e8('0x27')]();});}};}function handleEntityNotFound(_0x20a035,_0x12063b){return function(_0x378a61){if(!_0x378a61){_0x20a035[_0x50e8('0x28')](0x194);}return _0x378a61;};}function handleError(_0x358a50,_0x4da52b){_0x4da52b=_0x4da52b||0x1f4;return function(_0x33f50){logger[_0x50e8('0x29')](_0x33f50[_0x50e8('0x2a')]);if(_0x33f50[_0x50e8('0x2b')]){delete _0x33f50[_0x50e8('0x2b')];}_0x358a50[_0x50e8('0x18')](_0x4da52b)[_0x50e8('0x2c')](_0x33f50);};}exports[_0x50e8('0x2d')]=function(_0x5b3262,_0x1cc01f){var _0x4c8893={},_0x42e514={},_0x57c05b={'count':0x0,'rows':[]};var _0x4ac85e=_[_0x50e8('0x2e')](db[_0x50e8('0x2f')]['rawAttributes'],function(_0x11a54a){return{'name':_0x11a54a[_0x50e8('0x30')],'type':_0x11a54a['type'][_0x50e8('0x31')]};});_0x42e514[_0x50e8('0x32')]=_[_0x50e8('0x2e')](_0x4ac85e,'name');_0x42e514[_0x50e8('0x33')]=_[_0x50e8('0x34')](_0x5b3262['query']);_0x42e514['filters']=_[_0x50e8('0x35')](_0x42e514[_0x50e8('0x32')],_0x42e514['query']);_0x4c8893[_0x50e8('0x36')]=_[_0x50e8('0x35')](_0x42e514[_0x50e8('0x32')],qs['fields'](_0x5b3262[_0x50e8('0x33')][_0x50e8('0x37')]));_0x4c8893[_0x50e8('0x36')]=_0x4c8893[_0x50e8('0x36')][_0x50e8('0x38')]?_0x4c8893[_0x50e8('0x36')]:_0x42e514[_0x50e8('0x32')];if(!_0x5b3262['query'][_0x50e8('0x39')](_0x50e8('0x3a'))){_0x4c8893[_0x50e8('0x1c')]=qs[_0x50e8('0x1c')](_0x5b3262[_0x50e8('0x33')][_0x50e8('0x1c')]);_0x4c8893[_0x50e8('0x1a')]=qs[_0x50e8('0x1a')](_0x5b3262[_0x50e8('0x33')][_0x50e8('0x1a')]);}_0x4c8893['order']=qs[_0x50e8('0x3b')](_0x5b3262[_0x50e8('0x33')][_0x50e8('0x3b')]);_0x4c8893['where']=qs[_0x50e8('0x3c')](_[_0x50e8('0x3d')](_0x5b3262[_0x50e8('0x33')],_0x42e514[_0x50e8('0x3c')]),_0x4ac85e);if(_0x5b3262[_0x50e8('0x33')]['filter']){_0x4c8893[_0x50e8('0x3e')]=_[_0x50e8('0x3f')](_0x4c8893[_0x50e8('0x3e')],{'$or':_[_0x50e8('0x2e')](_0x4ac85e,function(_0xf51e87){if(_0xf51e87['type']!==_0x50e8('0x40')){var _0x472cff={};_0x472cff[_0xf51e87['name']]={'$like':'%'+_0x5b3262[_0x50e8('0x33')][_0x50e8('0x41')]+'%'};return _0x472cff;}})});}_0x4c8893=_[_0x50e8('0x3f')]({},_0x4c8893,_0x5b3262[_0x50e8('0x42')]);var _0x16cd46={'where':_0x4c8893[_0x50e8('0x3e')]};return db['Schedule'][_0x50e8('0x1d')](_0x16cd46)[_0x50e8('0x23')](function(_0x3a660a){_0x57c05b['count']=_0x3a660a;if(_0x5b3262[_0x50e8('0x33')][_0x50e8('0x43')]){_0x4c8893[_0x50e8('0x44')]=[{'all':!![]}];}return db[_0x50e8('0x2f')][_0x50e8('0x45')](_0x4c8893);})[_0x50e8('0x23')](function(_0x3a3bd3){_0x57c05b['rows']=_0x3a3bd3;return _0x57c05b;})[_0x50e8('0x23')](respondWithFilteredResult(_0x1cc01f,_0x4c8893))['catch'](handleError(_0x1cc01f,null));};exports[_0x50e8('0x46')]=function(_0x2b56ea,_0x3c6398){var _0x18ec53={'raw':![],'where':{'id':_0x2b56ea['params']['id']}},_0x321562={};_0x321562[_0x50e8('0x32')]=_['keys'](db[_0x50e8('0x2f')][_0x50e8('0x47')]);_0x321562[_0x50e8('0x33')]=_['keys'](_0x2b56ea[_0x50e8('0x33')]);_0x321562[_0x50e8('0x3c')]=_['intersection'](_0x321562[_0x50e8('0x32')],_0x321562[_0x50e8('0x33')]);_0x18ec53['attributes']=_[_0x50e8('0x35')](_0x321562[_0x50e8('0x32')],qs['fields'](_0x2b56ea[_0x50e8('0x33')][_0x50e8('0x37')]));_0x18ec53[_0x50e8('0x36')]=_0x18ec53[_0x50e8('0x36')][_0x50e8('0x38')]?_0x18ec53[_0x50e8('0x36')]:_0x321562['model'];if(_0x2b56ea[_0x50e8('0x33')][_0x50e8('0x43')]){_0x18ec53[_0x50e8('0x44')]=[{'all':!![]}];}_0x18ec53=_[_0x50e8('0x3f')]({},_0x18ec53,_0x2b56ea[_0x50e8('0x42')]);return db[_0x50e8('0x2f')][_0x50e8('0x48')](_0x18ec53)['then'](handleEntityNotFound(_0x3c6398,null))[_0x50e8('0x23')](respondWithResult(_0x3c6398,null))[_0x50e8('0x49')](handleError(_0x3c6398,null));};exports[_0x50e8('0x4a')]=function(_0x156e68,_0x4e0de2){return db[_0x50e8('0x2f')][_0x50e8('0x4a')](_0x156e68[_0x50e8('0x4b')],{})[_0x50e8('0x23')](function(_0x565499){var _0x527f05=_0x156e68['user'][_0x50e8('0x25')]({'plain':!![]});if(!_0x527f05)throw new Error(_0x50e8('0x4c'));if(_0x527f05[_0x50e8('0x4d')]==='user'){var _0x806acd=_0x565499['get']({'plain':!![]});var _0x3ad557=_0x50e8('0x4e');return db[_0x50e8('0x4f')][_0x50e8('0x48')]({'where':{'name':_0x3ad557,'userProfileId':_0x527f05[_0x50e8('0x50')]},'raw':!![]})[_0x50e8('0x23')](function(_0x309dce){if(_0x309dce&&_0x309dce[_0x50e8('0x51')]===0x0){return db[_0x50e8('0x26')][_0x50e8('0x4a')]({'name':_0x806acd[_0x50e8('0x2b')],'resourceId':_0x806acd['id'],'type':_0x309dce[_0x50e8('0x2b')],'sectionId':_0x309dce['id']},{})[_0x50e8('0x23')](function(){return _0x565499;});}else{return _0x565499;}})[_0x50e8('0x49')](function(_0x433a5a){logger[_0x50e8('0x29')](_0x50e8('0x52'),_0x433a5a);throw _0x433a5a;});}return _0x565499;})[_0x50e8('0x23')](respondWithResult(_0x4e0de2,0xc9))[_0x50e8('0x49')](handleError(_0x4e0de2,null));};exports['update']=function(_0x594cd8,_0x34299f){if(_0x594cd8[_0x50e8('0x4b')]['id']){delete _0x594cd8[_0x50e8('0x4b')]['id'];}return db['Schedule']['find']({'where':{'id':_0x594cd8[_0x50e8('0x53')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x34299f,null))[_0x50e8('0x23')](saveUpdates(_0x594cd8['body'],null))[_0x50e8('0x23')](respondWithResult(_0x34299f,null))[_0x50e8('0x49')](handleError(_0x34299f,null));};exports['destroy']=function(_0x11b0fb,_0x5c7081){return db[_0x50e8('0x2f')]['find']({'where':{'id':_0x11b0fb[_0x50e8('0x53')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x5c7081,null))[_0x50e8('0x23')](removeEntity(_0x5c7081,null))[_0x50e8('0x49')](handleError(_0x5c7081,null));};exports[_0x50e8('0x54')]=function(_0x691e6d,_0x410c34,_0x40bcd2){var _0x2f2801=require('../../config/schedule');return db[_0x50e8('0x2f')][_0x50e8('0x48')]({'where':{'id':_0x691e6d[_0x50e8('0x53')]['id']},'raw':!![]})[_0x50e8('0x23')](handleEntityNotFound(_0x410c34,null))[_0x50e8('0x23')](function(){_0x2f2801['run'](_0x691e6d[_0x50e8('0x53')]['id']);})[_0x50e8('0x23')](respondWithStatusCode(_0x410c34,null))[_0x50e8('0x49')](handleError(_0x410c34,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 42878b8..3e051dd 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 _0x4b5b=['define','tools_schedules','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports'];(function(_0xe1ab3a,_0x5b6175){var _0x55c798=function(_0x13ea69){while(--_0x13ea69){_0xe1ab3a['push'](_0xe1ab3a['shift']());}};_0x55c798(++_0x5b6175);}(_0x4b5b,0x146));var _0xb4b5=function(_0x54e4eb,_0x4c8d50){_0x54e4eb=_0x54e4eb-0x0;var _0xeec1fe=_0x4b5b[_0x54e4eb];return _0xeec1fe;};'use strict';var _=require(_0xb4b5('0x0'));var util=require('util');var logger=require(_0xb4b5('0x1'))(_0xb4b5('0x2'));var moment=require('moment');var BPromise=require(_0xb4b5('0x3'));var rp=require(_0xb4b5('0x4'));var fs=require('fs');var path=require(_0xb4b5('0x5'));var rimraf=require(_0xb4b5('0x6'));var config=require(_0xb4b5('0x7'));var attributes=require(_0xb4b5('0x8'));module[_0xb4b5('0x9')]=function(_0x52dca3,_0x24618a){return _0x52dca3[_0xb4b5('0xa')]('Schedule',attributes,{'tableName':_0xb4b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb580=['bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules','lodash','util','../../config/logger','moment'];(function(_0x465abe,_0x584de5){var _0x5d9bcc=function(_0x103e6f){while(--_0x103e6f){_0x465abe['push'](_0x465abe['shift']());}};_0x5d9bcc(++_0x584de5);}(_0xb580,0x104));var _0x0b58=function(_0x2f44a3,_0x3fcbcc){_0x2f44a3=_0x2f44a3-0x0;var _0x3df76c=_0xb580[_0x2f44a3];return _0x3df76c;};'use strict';var _=require(_0x0b58('0x0'));var util=require(_0x0b58('0x1'));var logger=require(_0x0b58('0x2'))('api');var moment=require(_0x0b58('0x3'));var BPromise=require(_0x0b58('0x4'));var rp=require(_0x0b58('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b58('0x6'));var config=require(_0x0b58('0x7'));var attributes=require(_0x0b58('0x8'));module[_0x0b58('0x9')]=function(_0x3a8d78,_0x108d55){return _0x3a8d78[_0x0b58('0xa')]('Schedule',attributes,{'tableName':_0x0b58('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 6c695c1..2b5ef4d 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 _0x9634=['Schedule,\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','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent'];(function(_0x3248a3,_0x5d63c7){var _0x3ed7e0=function(_0x3602b1){while(--_0x3602b1){_0x3248a3['push'](_0x3248a3['shift']());}};_0x3ed7e0(++_0x5d63c7);}(_0x9634,0xa7));var _0x4963=function(_0x5cc79d,_0x2a58f1){_0x5cc79d=_0x5cc79d-0x0;var _0x588954=_0x9634[_0x5cc79d];return _0x588954;};'use strict';var _=require(_0x4963('0x0'));var util=require(_0x4963('0x1'));var moment=require(_0x4963('0x2'));var BPromise=require(_0x4963('0x3'));var rs=require(_0x4963('0x4'));var fs=require('fs');var Redis=require(_0x4963('0x5'));var db=require(_0x4963('0x6'))['db'];var utils=require(_0x4963('0x7'));var logger=require(_0x4963('0x8'))(_0x4963('0x9'));var config=require(_0x4963('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4963('0xb')][_0x4963('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x521d3e,_0x3f2654,_0x24f53b){return new BPromise(function(_0x3d6dd8,_0x3ff752){return client[_0x4963('0xd')](_0x521d3e,_0x24f53b)[_0x4963('0xe')](function(_0x29612a){logger['info'](_0x4963('0xf'),_0x3f2654,_0x4963('0x10'));logger['debug'](_0x4963('0x11'),_0x3f2654,_0x4963('0x10'),JSON[_0x4963('0x12')](_0x29612a));if(_0x29612a[_0x4963('0x13')]){if(_0x29612a[_0x4963('0x13')][_0x4963('0x14')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x3f2654,_0x29612a[_0x4963('0x13')]['message']);return _0x3ff752(_0x29612a[_0x4963('0x13')][_0x4963('0x15')]);}logger[_0x4963('0x13')]('Schedule,\x20%s,\x20%s',_0x3f2654,_0x29612a[_0x4963('0x13')]['message']);return _0x3d6dd8(_0x29612a['error'][_0x4963('0x15')]);}else{logger['info'](_0x4963('0xf'),_0x3f2654,_0x4963('0x10'));_0x3d6dd8(_0x29612a[_0x4963('0x16')]['message']);}})['catch'](function(_0x4a9126){logger[_0x4963('0x13')]('Schedule,\x20%s,\x20%s',_0x3f2654,_0x4a9126);_0x3ff752(_0x4a9126);});});} \ No newline at end of file +var _0xdf9c=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird'];(function(_0x176d6e,_0x5a2d05){var _0x650fe6=function(_0x2664b1){while(--_0x2664b1){_0x176d6e['push'](_0x176d6e['shift']());}};_0x650fe6(++_0x5a2d05);}(_0xdf9c,0xa4));var _0xcdf9=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xdf9c[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xcdf9('0x0'));var util=require(_0xcdf9('0x1'));var moment=require(_0xcdf9('0x2'));var BPromise=require(_0xcdf9('0x3'));var rs=require(_0xcdf9('0x4'));var fs=require('fs');var Redis=require(_0xcdf9('0x5'));var db=require(_0xcdf9('0x6'))['db'];var utils=require(_0xcdf9('0x7'));var logger=require('../../config/logger')(_0xcdf9('0x8'));var config=require(_0xcdf9('0x9'));var jayson=require(_0xcdf9('0xa'));var client=jayson[_0xcdf9('0xb')][_0xcdf9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59b293,_0x171e27,_0x5cd62d){return new BPromise(function(_0xcb27af,_0x4d53d7){return client[_0xcdf9('0xd')](_0x59b293,_0x5cd62d)['then'](function(_0x4f0011){logger['info']('Schedule,\x20%s,\x20%s',_0x171e27,_0xcdf9('0xe'));logger[_0xcdf9('0xf')](_0xcdf9('0x10'),_0x171e27,_0xcdf9('0xe'),JSON[_0xcdf9('0x11')](_0x4f0011));if(_0x4f0011[_0xcdf9('0x12')]){if(_0x4f0011['error'][_0xcdf9('0x13')]===0x1f4){logger[_0xcdf9('0x12')](_0xcdf9('0x14'),_0x171e27,_0x4f0011[_0xcdf9('0x12')][_0xcdf9('0x15')]);return _0x4d53d7(_0x4f0011[_0xcdf9('0x12')][_0xcdf9('0x15')]);}logger['error'](_0xcdf9('0x14'),_0x171e27,_0x4f0011[_0xcdf9('0x12')]['message']);return _0xcb27af(_0x4f0011['error'][_0xcdf9('0x15')]);}else{logger[_0xcdf9('0x16')]('Schedule,\x20%s,\x20%s',_0x171e27,'request\x20sent');_0xcb27af(_0x4f0011[_0xcdf9('0x17')][_0xcdf9('0x15')]);}})['catch'](function(_0x4698e5){logger[_0xcdf9('0x12')](_0xcdf9('0x14'),_0x171e27,_0x4698e5);_0x4d53d7(_0x4698e5);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 56dfd17..3e3d3de 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 _0x6d67=['update','delete','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','describe','/:id','show','get','download','post','create','put'];(function(_0x33593e,_0x22ddd3){var _0x53db1a=function(_0x499ee5){while(--_0x499ee5){_0x33593e['push'](_0x33593e['shift']());}};_0x53db1a(++_0x22ddd3);}(_0x6d67,0x156));var _0x76d6=function(_0x3fd0f5,_0x41f452){_0x3fd0f5=_0x3fd0f5-0x0;var _0x2bed8f=_0x6d67[_0x3fd0f5];return _0x2bed8f;};'use strict';var multer=require(_0x76d6('0x0'));var util=require('util');var path=require(_0x76d6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x76d6('0x2')]();var fs_extra=require(_0x76d6('0x3'));var auth=require(_0x76d6('0x4'));var interaction=require(_0x76d6('0x5'));var config=require(_0x76d6('0x6'));var controller=require(_0x76d6('0x7'));router['get']('/',auth[_0x76d6('0x8')](),controller[_0x76d6('0x9')]);router['get']('/describe',auth[_0x76d6('0x8')](),controller[_0x76d6('0xa')]);router['get'](_0x76d6('0xb'),auth[_0x76d6('0x8')](),controller[_0x76d6('0xc')]);router[_0x76d6('0xd')]('/:id/download',auth[_0x76d6('0x8')](),controller[_0x76d6('0xe')]);router[_0x76d6('0xf')]('/',auth[_0x76d6('0x8')](),controller[_0x76d6('0x10')]);router[_0x76d6('0x11')](_0x76d6('0xb'),auth[_0x76d6('0x8')](),controller[_0x76d6('0x12')]);router[_0x76d6('0x13')](_0x76d6('0xb'),auth[_0x76d6('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd74b=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/download','download','create','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd74b,0x191));var _0xbd74=function(_0x3a311f,_0x3b317f){_0x3a311f=_0x3a311f-0x0;var _0x49aa74=_0xd74b[_0x3a311f];return _0x49aa74;};'use strict';var multer=require(_0xbd74('0x0'));var util=require(_0xbd74('0x1'));var path=require(_0xbd74('0x2'));var timeout=require(_0xbd74('0x3'));var express=require(_0xbd74('0x4'));var router=express[_0xbd74('0x5')]();var fs_extra=require(_0xbd74('0x6'));var auth=require(_0xbd74('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbd74('0x8'));var controller=require('./screenRecording.controller');router[_0xbd74('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xbd74('0xa')](),controller[_0xbd74('0xb')]);router[_0xbd74('0x9')](_0xbd74('0xc'),auth['isAuthenticated'](),controller[_0xbd74('0xd')]);router[_0xbd74('0x9')](_0xbd74('0xe'),auth[_0xbd74('0xa')](),controller[_0xbd74('0xf')]);router['post']('/',auth[_0xbd74('0xa')](),controller[_0xbd74('0x10')]);router[_0xbd74('0x11')](_0xbd74('0xc'),auth[_0xbd74('0xa')](),controller[_0xbd74('0x12')]);router['delete'](_0xbd74('0xc'),auth[_0xbd74('0xa')](),controller[_0xbd74('0x13')]);module[_0xbd74('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index eadce51..e1c8d69 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 _0xfb11=['subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize','path','../../config/environment','VIRTUAL','value','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt'];(function(_0xde0a7f,_0x33437f){var _0x1b5b69=function(_0x5d9805){while(--_0x5d9805){_0xde0a7f['push'](_0xde0a7f['shift']());}};_0x1b5b69(++_0x33437f);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xfb11[_0x363ef8];return _0x148822;};'use strict';var Sequelize=require(_0x1fb1('0x0'));var moment=require('moment');var path=require(_0x1fb1('0x1'));var config=require(_0x1fb1('0x2'));module['exports']={'format':{'type':Sequelize[_0x1fb1('0x3')],'get':function(){return this['getDataValue'](_0x1fb1('0x4'))?path['extname'](this[_0x1fb1('0x5')](_0x1fb1('0x4'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1fb1('0x6')]},'value':{'type':Sequelize[_0x1fb1('0x6')],'set':function(_0x4c098d){var _0x1859da=_0x4c098d[_0x1fb1('0x7')](/\\/g,'/');this[_0x1fb1('0x8')](_0x1fb1('0x4'),_0x1859da);}},'rating':{'type':Sequelize[_0x1fb1('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x1fb1('0x9')],'set':function(_0x438d15){this[_0x1fb1('0x8')](_0x1fb1('0xa'),moment()[_0x1fb1('0xb')](_0x438d15,'ms'));this['setDataValue'](_0x1fb1('0xc'),moment());this['setDataValue'](_0x1fb1('0xd'),_0x438d15);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x1fb1('0x5')](_0x1fb1('0xa')))[_0x1fb1('0xe')](_0x1fb1('0xf'))[_0x1fb1('0x10')]();}},'closedAt':{'type':Sequelize[_0x1fb1('0x11')],'get':function(){return moment(this['getDataValue'](_0x1fb1('0xc')))[_0x1fb1('0xe')](_0x1fb1('0xf'))[_0x1fb1('0x10')]();}},'createdAt':{'type':Sequelize[_0x1fb1('0x11')],'get':function(){return moment(this[_0x1fb1('0x5')](_0x1fb1('0x12')))[_0x1fb1('0xe')](_0x1fb1('0xf'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x1fb1('0x5')](_0x1fb1('0x13')))[_0x1fb1('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x1fb1('0x10')]();}}}; \ No newline at end of file +var _0x457b=['replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','toString','format','createdAt','updatedAt','MM-DD-YYYY\x20HH:mm','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING'];(function(_0x16154d,_0x12c711){var _0x36a45c=function(_0x2e34a8){while(--_0x2e34a8){_0x16154d['push'](_0x16154d['shift']());}};_0x36a45c(++_0x12c711);}(_0x457b,0xca));var _0xb457=function(_0xf8973d,_0x56a803){_0xf8973d=_0xf8973d-0x0;var _0x1c46bc=_0x457b[_0xf8973d];return _0x1c46bc;};'use strict';var Sequelize=require(_0xb457('0x0'));var moment=require(_0xb457('0x1'));var path=require('path');var config=require(_0xb457('0x2'));module[_0xb457('0x3')]={'format':{'type':Sequelize[_0xb457('0x4')],'get':function(){return this[_0xb457('0x5')](_0xb457('0x6'))?path['extname'](this[_0xb457('0x5')](_0xb457('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xb457('0x7')]},'channel':{'type':Sequelize[_0xb457('0x7')]},'value':{'type':Sequelize[_0xb457('0x7')],'set':function(_0x523e05){var _0x5b8ba2=_0x523e05[_0xb457('0x8')](/\\/g,'/');this[_0xb457('0x9')]('value',_0x5b8ba2);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb457('0xa')],'set':function(_0x3baee8){this[_0xb457('0x9')](_0xb457('0xb'),moment()[_0xb457('0xc')](_0x3baee8,'ms'));this[_0xb457('0x9')](_0xb457('0xd'),moment());this[_0xb457('0x9')](_0xb457('0xe'),_0x3baee8);}},'startedAt':{'type':Sequelize[_0xb457('0xf')],'get':function(){return moment(this[_0xb457('0x5')](_0xb457('0xb')))['format']('MM-DD-YYYY\x20HH:mm')[_0xb457('0x10')]();}},'closedAt':{'type':Sequelize[_0xb457('0xf')],'get':function(){return moment(this[_0xb457('0x5')](_0xb457('0xd')))[_0xb457('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0xb457('0xf')],'get':function(){return moment(this[_0xb457('0x5')](_0xb457('0x12')))[_0xb457('0x11')]('MM-DD-YYYY\x20HH:mm')[_0xb457('0x10')]();}},'updatedAt':{'type':Sequelize[_0xb457('0xf')],'get':function(){return moment(this[_0xb457('0x5')](_0xb457('0x13')))[_0xb457('0x11')](_0xb457('0x14'))[_0xb457('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 9c54c81..6e8b3fd 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 _0x6aa7=['fieldName','type','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','find','catch','create','body','duration','createdAt','closedAt','params','describe','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','secrets','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','download','message','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','rawAttributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6aa7,0x178));var _0x76aa=function(_0x49a200,_0x437c97){_0x49a200=_0x49a200-0x0;var _0x4900b4=_0x6aa7[_0x49a200];return _0x4900b4;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x19')](_0x5df49c);}return _0x112c39[_0x76aa('0x1a')](_0x5df49c)[_0x76aa('0x1b')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x1a')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=typeof _0x319bf1['offset']===_0x76aa('0x1c')&&typeof _0x319bf1['limit']===_0x76aa('0x1c');var _0x413cf6=_0x5cf594[_0x76aa('0x1d')];var _0x21c16d=_0x2111c7?0x0:_0x319bf1[_0x76aa('0x1e')];var _0x3ead3f=_0x2111c7?_0x5cf594['count']:_0x319bf1['offset']+_0x319bf1[_0x76aa('0x1f')];var _0x454dd3;if(_0x3ead3f>=_0x413cf6){_0x3ead3f=_0x413cf6;_0x454dd3=0xc8;}else{_0x454dd3=0xce;}_0x180d92[_0x76aa('0x1a')](_0x454dd3);return _0x180d92[_0x76aa('0x20')](_0x76aa('0x21'),_0x21c16d+'-'+_0x3ead3f+'/'+_0x413cf6)[_0x76aa('0x22')](_0x5cf594);}return null;};}function patchUpdates(_0x19af92){return function(_0x2eaf48){try{jsonpatch[_0x76aa('0x23')](_0x2eaf48,_0x19af92,!![]);}catch(_0x5990c1){return BPromise[_0x76aa('0x24')](_0x5990c1);}return _0x2eaf48[_0x76aa('0x25')]();};}function saveUpdates(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x26')](_0x338a6b)[_0x76aa('0x27')](function(_0x2bd2c6){return _0x2bd2c6;});}return null;};}function removeEntity(_0x29c50c,_0xc1044c){return function(_0x3cd039){if(_0x3cd039){return _0x3cd039[_0x76aa('0x28')]()[_0x76aa('0x27')](function(){_0x29c50c[_0x76aa('0x1a')](0xcc)[_0x76aa('0x1b')]();});}};}function handleEntityNotFound(_0x26b75e,_0x3599a9){return function(_0x4ef9b0){if(!_0x4ef9b0){_0x26b75e[_0x76aa('0x19')](0x194);}return _0x4ef9b0;};}function handleError(_0x1d6d15,_0x25c614){_0x25c614=_0x25c614||0x1f4;return function(_0x2e7ab4){logger[_0x76aa('0x29')](_0x2e7ab4[_0x76aa('0x2a')]);if(_0x2e7ab4[_0x76aa('0x2b')]){delete _0x2e7ab4[_0x76aa('0x2b')];}_0x1d6d15[_0x76aa('0x1a')](_0x25c614)[_0x76aa('0x2c')](_0x2e7ab4);};}exports['index']=function(_0x3fcb7f,_0x5a8030){var _0x994550={},_0x365ff8={},_0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x2d')](db[_0x76aa('0x2e')][_0x76aa('0x2f')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x30')],'type':_0x3827ec[_0x76aa('0x31')]['key']};});_0x365ff8[_0x76aa('0x32')]=_[_0x76aa('0x33')](_[_0x76aa('0x2d')](_0x1e90b9,_0x76aa('0x2b')),[_0x76aa('0x34')]);_0x365ff8[_0x76aa('0x35')]=_[_0x76aa('0x36')](_0x3fcb7f['query']);_0x365ff8[_0x76aa('0x37')]=_[_0x76aa('0x38')](_0x365ff8['model'],_0x365ff8[_0x76aa('0x35')]);_0x994550['attributes']=_[_0x76aa('0x38')](_0x365ff8['model'],qs[_0x76aa('0x39')](_0x3fcb7f['query']['fields']));_0x994550[_0x76aa('0x3a')]=_0x994550[_0x76aa('0x3a')][_0x76aa('0x3b')]?_0x994550[_0x76aa('0x3a')]:_0x365ff8['model'];if(!_0x3fcb7f['query'][_0x76aa('0x3c')](_0x76aa('0x3d'))){_0x994550[_0x76aa('0x1f')]=qs[_0x76aa('0x1f')](_0x3fcb7f[_0x76aa('0x35')]['limit']);_0x994550[_0x76aa('0x1e')]=qs['offset'](_0x3fcb7f['query'][_0x76aa('0x1e')]);}_0x994550[_0x76aa('0x3e')]=qs[_0x76aa('0x3f')](_0x3fcb7f[_0x76aa('0x35')]['sort']);_0x994550[_0x76aa('0x40')]=qs[_0x76aa('0x37')](_[_0x76aa('0x41')](_0x3fcb7f['query'],_0x365ff8[_0x76aa('0x37')]),_0x1e90b9);if(_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x42')]){_0x994550[_0x76aa('0x40')]=_[_0x76aa('0x43')](_0x994550[_0x76aa('0x40')],{'$or':_[_0x76aa('0x2d')](_0x1e90b9,function(_0x307d67){if(_0x307d67[_0x76aa('0x31')]!=='VIRTUAL'){var _0x1525cb={};_0x1525cb[_0x307d67[_0x76aa('0x2b')]]={'$like':'%'+_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x42')]+'%'};return _0x1525cb;}})});}_0x994550=_[_0x76aa('0x43')]({},_0x994550,_0x3fcb7f[_0x76aa('0x44')]);var _0x572fdb={'where':_0x994550['where']};return db[_0x76aa('0x2e')][_0x76aa('0x1d')](_0x572fdb)[_0x76aa('0x27')](function(_0x365612){_0x2dec94['count']=_0x365612;if(_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x45')]){_0x994550[_0x76aa('0x46')]=[{'all':!![]}];}return db[_0x76aa('0x2e')][_0x76aa('0x47')](_0x994550);})['then'](function(_0x13dafe){_0x2dec94['rows']=_0x13dafe;return _0x2dec94;})[_0x76aa('0x27')](respondWithFilteredResult(_0x5a8030,_0x994550))['catch'](handleError(_0x5a8030,null));};exports['show']=function(_0x4f7f3a,_0x144f0a){var _0x541594={'raw':![],'where':{'id':_0x4f7f3a['params']['id']}},_0x5cf314={};_0x5cf314[_0x76aa('0x32')]=_[_0x76aa('0x36')](db[_0x76aa('0x2e')][_0x76aa('0x2f')]);_0x5cf314[_0x76aa('0x35')]=_['keys'](_0x4f7f3a[_0x76aa('0x35')]);_0x5cf314[_0x76aa('0x37')]=_[_0x76aa('0x38')](_0x5cf314[_0x76aa('0x32')],_0x5cf314[_0x76aa('0x35')]);_0x541594['attributes']=_[_0x76aa('0x38')](_0x5cf314[_0x76aa('0x32')],qs['fields'](_0x4f7f3a[_0x76aa('0x35')]['fields']));_0x541594[_0x76aa('0x3a')]=_0x541594[_0x76aa('0x3a')][_0x76aa('0x3b')]?_0x541594[_0x76aa('0x3a')]:_0x5cf314[_0x76aa('0x32')];if(_0x4f7f3a[_0x76aa('0x35')][_0x76aa('0x45')]){_0x541594[_0x76aa('0x46')]=[{'all':!![]}];}_0x541594=_[_0x76aa('0x43')]({},_0x541594,_0x4f7f3a[_0x76aa('0x44')]);return db['ScreenRecording'][_0x76aa('0x48')](_0x541594)['then'](handleEntityNotFound(_0x144f0a,null))[_0x76aa('0x27')](respondWithResult(_0x144f0a,null))[_0x76aa('0x49')](handleError(_0x144f0a,null));};exports[_0x76aa('0x4a')]=function(_0x156d4e,_0x5ca721){return db['ScreenRecording'][_0x76aa('0x4a')](_0x156d4e['body'],{})[_0x76aa('0x27')](respondWithResult(_0x5ca721,0xc9))[_0x76aa('0x49')](handleError(_0x5ca721,null));};exports[_0x76aa('0x26')]=function(_0x2e5633,_0x30c577){if(_0x2e5633[_0x76aa('0x4b')]['id']){delete _0x2e5633['body']['id'];}delete _0x2e5633['body'][_0x76aa('0x4c')];delete _0x2e5633[_0x76aa('0x4b')][_0x76aa('0x4d')];delete _0x2e5633[_0x76aa('0x4b')][_0x76aa('0x4e')];delete _0x2e5633[_0x76aa('0x4b')]['value'];return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':{'id':_0x2e5633[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x30c577,null))[_0x76aa('0x27')](saveUpdates(_0x2e5633['body'],null))[_0x76aa('0x27')](respondWithResult(_0x30c577,null))['catch'](handleError(_0x30c577,null));};exports[_0x76aa('0x50')]=function(_0x4449c1,_0x3c63e5){return db[_0x76aa('0x2e')][_0x76aa('0x50')]()[_0x76aa('0x27')](respondWithResult(_0x3c63e5,null))[_0x76aa('0x49')](handleError(_0x3c63e5,null));};exports['download']=function(_0x186654,_0x5eeaa5,_0x3ee32){var _0x311bd5=require(_0x76aa('0x51'));var _0x53be10=![];var _0x3fa7ec={};if(_0x186654[_0x76aa('0x35')][_0x76aa('0x31')]&&_0x186654['query'][_0x76aa('0x31')]===_0x76aa('0x52')){_0x3fa7ec[_0x76aa('0x52')]=_0x186654[_0x76aa('0x4f')]['id'];}else{_0x3fa7ec['id']=_0x186654['params']['id'];}return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':_0x3fa7ec,'attributes':['id',_0x76aa('0x53')],'raw':!![]})[_0x76aa('0x27')](handleEntityNotFound(_0x5eeaa5,null))[_0x76aa('0x27')](function(_0xf7732){if(_0xf7732){var _0x4e6c09=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0xf7732[_0x76aa('0x53')]);var _0x3967f3=util[_0x76aa('0x34')](_0x76aa('0x57'),_0x4e6c09);if(fs['existsSync'](_0x3967f3)){_0x53be10=!![];return _0x311bd5['decryptFile'](_0x3967f3,_0x4e6c09,config[_0x76aa('0x58')][_0x76aa('0x59')])['then'](function(){return _0xf7732;});}return _0xf7732;}})[_0x76aa('0x27')](function(_0x1e6f3c){if(_0x1e6f3c){var _0x4f832d=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0x1e6f3c[_0x76aa('0x53')]);if(!fs[_0x76aa('0x5a')](_0x4f832d)){throw new db[(_0x76aa('0x5b'))][(_0x76aa('0x5c'))](_0x76aa('0x5d'));}if(_0x1e6f3c[_0x76aa('0x5e')]){return _0x5eeaa5['download'](_0x4f832d,_0x1e6f3c[_0x76aa('0x5e')]+path['extname'](_0x4f832d),function(){if(_0x53be10){fs[_0x76aa('0x5f')](_0x4f832d);}});}else{return _0x5eeaa5[_0x76aa('0x60')](_0x4f832d,function(_0x2fef92){if(_0x53be10){fs[_0x76aa('0x5f')](_0x4f832d);}});}}})[_0x76aa('0x49')](function(_0x260ad2){if(_0x260ad2[_0x76aa('0x61')]===_0x76aa('0x5d')){_0x5eeaa5[_0x76aa('0x1a')](0x194)['send'](_0x76aa('0x62'));}else{return handleError(_0x5eeaa5,null);}});};exports[_0x76aa('0x28')]=function(_0x5c542b,_0xe5957d){return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':{'id':_0x5c542b[_0x76aa('0x4f')]['id']}})[_0x76aa('0x27')](function(_0x5546b6){if(_[_0x76aa('0x63')](_0x5546b6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5546b6;})[_0x76aa('0x27')](function(_0x35881c){var _0x3e97f8=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0x35881c[_0x76aa('0x53')]);logger['info'](_0x76aa('0x64'),_0x3e97f8);if(!_[_0x76aa('0x63')](_0x35881c['value'])&&fs['existsSync'](_0x3e97f8)){logger[_0x76aa('0x65')](_0x76aa('0x66')+_0x3e97f8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x76aa('0x67')](_0x3e97f8);}_0x3e97f8=_0x3e97f8+_0x76aa('0x68');if(!_[_0x76aa('0x63')](_0x35881c['value'])&&fs[_0x76aa('0x5a')](_0x3e97f8)){logger['info'](_0x76aa('0x66')+_0x3e97f8+_0x76aa('0x69'));fs[_0x76aa('0x67')](_0x3e97f8);}return _0x35881c;})[_0x76aa('0x27')](function(_0x55ca84){if(!_0x55ca84)throw new InternalError();return _0x55ca84['destroy']();})[_0x76aa('0x27')](function(){_0xe5957d['status'](0xcc)[_0x76aa('0x1b')]();})[_0x76aa('0x49')](handleError(_0xe5957d,null));}; \ No newline at end of file +var _0xdc97=['join','root','%s.cypher','existsSync','decryptFile','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','sendStatus','error','name','send','index','map','format','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','options','ScreenRecording','includeAll','rows','catch','show','params','include','find','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid'];(function(_0x1884c5,_0x4b73c7){var _0x2adc00=function(_0x1122c){while(--_0x1122c){_0x1884c5['push'](_0x1884c5['shift']());}};_0x2adc00(++_0x4b73c7);}(_0xdc97,0x13b));var _0x7dc9=function(_0x5833ff,_0x2a1a7e){_0x5833ff=_0x5833ff-0x0;var _0x2096d0=_0xdc97[_0x5833ff];return _0x2096d0;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){_0xffc080[_0x7dc9('0x16')](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x55a482,_0x48c6bc){return function(_0x4b9ba6){if(!_0x4b9ba6){_0x55a482[_0x7dc9('0x22')](0x194);}return _0x4b9ba6;};}function handleError(_0x32d032,_0x5843bf){_0x5843bf=_0x5843bf||0x1f4;return function(_0x585eef){logger[_0x7dc9('0x23')](_0x585eef['stack']);if(_0x585eef[_0x7dc9('0x24')]){delete _0x585eef[_0x7dc9('0x24')];}_0x32d032[_0x7dc9('0x16')](_0x5843bf)[_0x7dc9('0x25')](_0x585eef);};}exports[_0x7dc9('0x26')]=function(_0x450124,_0x236d42){var _0x229f8e={},_0x1fcf0e={},_0x3c4379={'count':0x0,'rows':[]};var _0x14083d=_[_0x7dc9('0x27')](db['ScreenRecording']['rawAttributes'],function(_0x513dd6){return{'name':_0x513dd6['fieldName'],'type':_0x513dd6['type']['key']};});_0x1fcf0e['model']=_['differenceBy'](_[_0x7dc9('0x27')](_0x14083d,_0x7dc9('0x24')),[_0x7dc9('0x28')]);_0x1fcf0e[_0x7dc9('0x29')]=_[_0x7dc9('0x2a')](_0x450124[_0x7dc9('0x29')]);_0x1fcf0e['filters']=_['intersection'](_0x1fcf0e['model'],_0x1fcf0e[_0x7dc9('0x29')]);_0x229f8e['attributes']=_[_0x7dc9('0x2b')](_0x1fcf0e[_0x7dc9('0x2c')],qs[_0x7dc9('0x2d')](_0x450124[_0x7dc9('0x29')][_0x7dc9('0x2d')]));_0x229f8e[_0x7dc9('0x2e')]=_0x229f8e[_0x7dc9('0x2e')][_0x7dc9('0x2f')]?_0x229f8e['attributes']:_0x1fcf0e[_0x7dc9('0x2c')];if(!_0x450124['query'][_0x7dc9('0x30')](_0x7dc9('0x31'))){_0x229f8e[_0x7dc9('0x1a')]=qs[_0x7dc9('0x1a')](_0x450124['query'][_0x7dc9('0x1a')]);_0x229f8e['offset']=qs[_0x7dc9('0x18')](_0x450124['query']['offset']);}_0x229f8e[_0x7dc9('0x32')]=qs[_0x7dc9('0x33')](_0x450124[_0x7dc9('0x29')][_0x7dc9('0x33')]);_0x229f8e['where']=qs[_0x7dc9('0x34')](_[_0x7dc9('0x35')](_0x450124[_0x7dc9('0x29')],_0x1fcf0e[_0x7dc9('0x34')]),_0x14083d);if(_0x450124[_0x7dc9('0x29')][_0x7dc9('0x36')]){_0x229f8e[_0x7dc9('0x37')]=_[_0x7dc9('0x38')](_0x229f8e[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x27')](_0x14083d,function(_0x452aed){if(_0x452aed[_0x7dc9('0x39')]!=='VIRTUAL'){var _0x34b5c9={};_0x34b5c9[_0x452aed[_0x7dc9('0x24')]]={'$like':'%'+_0x450124[_0x7dc9('0x29')][_0x7dc9('0x36')]+'%'};return _0x34b5c9;}})});}_0x229f8e=_['merge']({},_0x229f8e,_0x450124[_0x7dc9('0x3a')]);var _0x89db0e={'where':_0x229f8e[_0x7dc9('0x37')]};return db[_0x7dc9('0x3b')][_0x7dc9('0x1b')](_0x89db0e)[_0x7dc9('0x21')](function(_0x5a1201){_0x3c4379['count']=_0x5a1201;if(_0x450124[_0x7dc9('0x29')][_0x7dc9('0x3c')]){_0x229f8e['include']=[{'all':!![]}];}return db[_0x7dc9('0x3b')]['findAll'](_0x229f8e);})[_0x7dc9('0x21')](function(_0x2a91fe){_0x3c4379[_0x7dc9('0x3d')]=_0x2a91fe;return _0x3c4379;})['then'](respondWithFilteredResult(_0x236d42,_0x229f8e))[_0x7dc9('0x3e')](handleError(_0x236d42,null));};exports[_0x7dc9('0x3f')]=function(_0x1929b6,_0x95513c){var _0x28ffc0={'raw':![],'where':{'id':_0x1929b6[_0x7dc9('0x40')]['id']}},_0x23499a={};_0x23499a['model']=_[_0x7dc9('0x2a')](db['ScreenRecording']['rawAttributes']);_0x23499a[_0x7dc9('0x29')]=_[_0x7dc9('0x2a')](_0x1929b6[_0x7dc9('0x29')]);_0x23499a[_0x7dc9('0x34')]=_[_0x7dc9('0x2b')](_0x23499a[_0x7dc9('0x2c')],_0x23499a[_0x7dc9('0x29')]);_0x28ffc0[_0x7dc9('0x2e')]=_[_0x7dc9('0x2b')](_0x23499a['model'],qs[_0x7dc9('0x2d')](_0x1929b6[_0x7dc9('0x29')][_0x7dc9('0x2d')]));_0x28ffc0[_0x7dc9('0x2e')]=_0x28ffc0[_0x7dc9('0x2e')][_0x7dc9('0x2f')]?_0x28ffc0['attributes']:_0x23499a[_0x7dc9('0x2c')];if(_0x1929b6[_0x7dc9('0x29')]['includeAll']){_0x28ffc0[_0x7dc9('0x41')]=[{'all':!![]}];}_0x28ffc0=_[_0x7dc9('0x38')]({},_0x28ffc0,_0x1929b6[_0x7dc9('0x3a')]);return db['ScreenRecording'][_0x7dc9('0x42')](_0x28ffc0)['then'](handleEntityNotFound(_0x95513c,null))['then'](respondWithResult(_0x95513c,null))[_0x7dc9('0x3e')](handleError(_0x95513c,null));};exports[_0x7dc9('0x43')]=function(_0x36d591,_0x5e0dc5){return db['ScreenRecording'][_0x7dc9('0x43')](_0x36d591['body'],{})[_0x7dc9('0x21')](respondWithResult(_0x5e0dc5,0xc9))[_0x7dc9('0x3e')](handleError(_0x5e0dc5,null));};exports['update']=function(_0x24ccce,_0x1d6c0a){if(_0x24ccce[_0x7dc9('0x44')]['id']){delete _0x24ccce[_0x7dc9('0x44')]['id'];}delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x45')];delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x46')];delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x47')];delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x48')];return db[_0x7dc9('0x3b')]['find']({'where':{'id':_0x24ccce[_0x7dc9('0x40')]['id']}})['then'](handleEntityNotFound(_0x1d6c0a,null))['then'](saveUpdates(_0x24ccce[_0x7dc9('0x44')],null))[_0x7dc9('0x21')](respondWithResult(_0x1d6c0a,null))[_0x7dc9('0x3e')](handleError(_0x1d6c0a,null));};exports[_0x7dc9('0x49')]=function(_0x346d27,_0x510e2a){return db[_0x7dc9('0x3b')][_0x7dc9('0x49')]()[_0x7dc9('0x21')](respondWithResult(_0x510e2a,null))['catch'](handleError(_0x510e2a,null));};exports[_0x7dc9('0x4a')]=function(_0x3fc164,_0x2cf133,_0x32bc31){var _0xf41b8c=require(_0x7dc9('0x4b'));var _0x593132=![];var _0x366b8b={};if(_0x3fc164[_0x7dc9('0x29')][_0x7dc9('0x39')]&&_0x3fc164[_0x7dc9('0x29')][_0x7dc9('0x39')]===_0x7dc9('0x4c')){_0x366b8b[_0x7dc9('0x4c')]=_0x3fc164[_0x7dc9('0x40')]['id'];}else{_0x366b8b['id']=_0x3fc164[_0x7dc9('0x40')]['id'];}return db[_0x7dc9('0x3b')][_0x7dc9('0x42')]({'where':_0x366b8b,'attributes':['id',_0x7dc9('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x2cf133,null))[_0x7dc9('0x21')](function(_0x39be46){if(_0x39be46){var _0x38df9a=path[_0x7dc9('0x4d')](config[_0x7dc9('0x4e')],'server/files/screen_recordings',_0x39be46[_0x7dc9('0x48')]);var _0xd8d327=util[_0x7dc9('0x28')](_0x7dc9('0x4f'),_0x38df9a);if(fs[_0x7dc9('0x50')](_0xd8d327)){_0x593132=!![];return _0xf41b8c[_0x7dc9('0x51')](_0xd8d327,_0x38df9a,config['secrets']['recording'])['then'](function(){return _0x39be46;});}return _0x39be46;}})[_0x7dc9('0x21')](function(_0x3daf33){if(_0x3daf33){var _0x32a64f=path[_0x7dc9('0x4d')](config['root'],'server/files/screen_recordings',_0x3daf33[_0x7dc9('0x48')]);if(!fs[_0x7dc9('0x50')](_0x32a64f)){throw new db[(_0x7dc9('0x52'))][(_0x7dc9('0x53'))](_0x7dc9('0x54'));}if(_0x3daf33[_0x7dc9('0x55')]){return _0x2cf133[_0x7dc9('0x4a')](_0x32a64f,_0x3daf33['filename']+path[_0x7dc9('0x56')](_0x32a64f),function(){if(_0x593132){fs[_0x7dc9('0x57')](_0x32a64f);}});}else{return _0x2cf133[_0x7dc9('0x4a')](_0x32a64f,function(_0x1dad95){if(_0x593132){fs[_0x7dc9('0x57')](_0x32a64f);}});}}})['catch'](function(_0x175858){if(_0x175858[_0x7dc9('0x58')]===_0x7dc9('0x54')){_0x2cf133[_0x7dc9('0x16')](0x194)[_0x7dc9('0x25')](_0x7dc9('0x59'));}else{return handleError(_0x2cf133,null);}});};exports[_0x7dc9('0x5a')]=function(_0x2a02ed,_0x3463e4){return db[_0x7dc9('0x3b')][_0x7dc9('0x42')]({'where':{'id':_0x2a02ed[_0x7dc9('0x40')]['id']}})[_0x7dc9('0x21')](function(_0x5eee27){if(_[_0x7dc9('0x5b')](_0x5eee27)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5eee27;})[_0x7dc9('0x21')](function(_0x15cf19){var _0x48ea37=path[_0x7dc9('0x4d')](config[_0x7dc9('0x4e')],'server/files/screen_recordings',_0x15cf19[_0x7dc9('0x48')]);logger[_0x7dc9('0x5c')](_0x7dc9('0x5d'),_0x48ea37);if(!_['isNil'](_0x15cf19['value'])&&fs[_0x7dc9('0x50')](_0x48ea37)){logger[_0x7dc9('0x5c')](_0x7dc9('0x5e')+_0x48ea37+_0x7dc9('0x5f'));fs[_0x7dc9('0x60')](_0x48ea37);}_0x48ea37=_0x48ea37+_0x7dc9('0x61');if(!_[_0x7dc9('0x5b')](_0x15cf19[_0x7dc9('0x48')])&&fs[_0x7dc9('0x50')](_0x48ea37)){logger['info'](_0x7dc9('0x5e')+_0x48ea37+_0x7dc9('0x5f'));fs[_0x7dc9('0x60')](_0x48ea37);}return _0x15cf19;})['then'](function(_0x4f80bd){if(!_0x4f80bd)throw new InternalError();return _0x4f80bd[_0x7dc9('0x5a')]();})[_0x7dc9('0x21')](function(){_0x3463e4[_0x7dc9('0x16')](0xcc)[_0x7dc9('0x17')]();})['catch'](handleError(_0x3463e4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 1d83d14..b3d77cc 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 _0x867d=['./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x867d,0xcb));var _0xd867=function(_0x4a5562,_0x29c485){_0x4a5562=_0x4a5562-0x0;var _0x5c2d32=_0x867d[_0x4a5562];return _0x5c2d32;};'use strict';var _=require(_0xd867('0x0'));var util=require(_0xd867('0x1'));var logger=require(_0xd867('0x2'))(_0xd867('0x3'));var moment=require('moment');var BPromise=require(_0xd867('0x4'));var rp=require(_0xd867('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd867('0x6'));module[_0xd867('0x7')]=function(_0x14b3db,_0xd6ffb6){return _0x14b3db[_0xd867('0x8')]('ScreenRecording',attributes,{'tableName':_0xd867('0x9'),'paranoid':![],'indexes':[{'name':_0xd867('0xa'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7746=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util'];(function(_0xee588,_0x368239){var _0x58dd1a=function(_0x3fd2b1){while(--_0x3fd2b1){_0xee588['push'](_0xee588['shift']());}};_0x58dd1a(++_0x368239);}(_0x7746,0x1de));var _0x6774=function(_0x85359b,_0x591cb7){_0x85359b=_0x85359b-0x0;var _0x2d2156=_0x7746[_0x85359b];return _0x2d2156;};'use strict';var _=require(_0x6774('0x0'));var util=require(_0x6774('0x1'));var logger=require(_0x6774('0x2'))('api');var moment=require(_0x6774('0x3'));var BPromise=require(_0x6774('0x4'));var rp=require(_0x6774('0x5'));var fs=require('fs');var path=require(_0x6774('0x6'));var rimraf=require(_0x6774('0x7'));var config=require(_0x6774('0x8'));var attributes=require(_0x6774('0x9'));module[_0x6774('0xa')]=function(_0xbdf9f,_0x4f0de9){return _0xbdf9f[_0x6774('0xb')](_0x6774('0xc'),attributes,{'tableName':_0x6774('0xd'),'paranoid':![],'indexes':[{'name':_0x6774('0xe'),'fields':[_0x6774('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 7e67165..d393c7c 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 _0xbd44=['rpc','client','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2bae67,_0x1077b2){var _0x5f29ed=function(_0xa01841){while(--_0xa01841){_0x2bae67['push'](_0x2bae67['shift']());}};_0x5f29ed(++_0x1077b2);}(_0xbd44,0x14e));var _0x4bd4=function(_0x1e15e1,_0x45f4c3){_0x1e15e1=_0x1e15e1-0x0;var _0x4ab625=_0xbd44[_0x1e15e1];return _0x4ab625;};'use strict';var _=require(_0x4bd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4bd4('0x1'));var rs=require(_0x4bd4('0x2'));var fs=require('fs');var Redis=require(_0x4bd4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4bd4('0x4'));var logger=require(_0x4bd4('0x5'))(_0x4bd4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4bd4('0x7')][_0x4bd4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b77ba,_0x29981b,_0x56bf71){return new BPromise(function(_0x6ad64a,_0x46dd14){return client[_0x4bd4('0x9')](_0x3b77ba,_0x56bf71)[_0x4bd4('0xa')](function(_0x5ec716){logger['info'](_0x4bd4('0xb'),_0x29981b,_0x4bd4('0xc'));logger['debug'](_0x4bd4('0xd'),_0x29981b,'request\x20sent',JSON[_0x4bd4('0xe')](_0x5ec716));if(_0x5ec716[_0x4bd4('0xf')]){if(_0x5ec716['error'][_0x4bd4('0x10')]===0x1f4){logger[_0x4bd4('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x29981b,_0x5ec716[_0x4bd4('0xf')]['message']);return _0x46dd14(_0x5ec716[_0x4bd4('0xf')][_0x4bd4('0x11')]);}logger['error'](_0x4bd4('0xb'),_0x29981b,_0x5ec716[_0x4bd4('0xf')][_0x4bd4('0x11')]);return _0x6ad64a(_0x5ec716[_0x4bd4('0xf')][_0x4bd4('0x11')]);}else{logger['info'](_0x4bd4('0xb'),_0x29981b,_0x4bd4('0xc'));_0x6ad64a(_0x5ec716[_0x4bd4('0x12')][_0x4bd4('0x11')]);}})[_0x4bd4('0x13')](function(_0xaf40fb){logger['error'](_0x4bd4('0xb'),_0x29981b,_0xaf40fb);_0x46dd14(_0xaf40fb);});});} \ No newline at end of file +var _0x4414=['error','code','message','result','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3a698f,_0x1e1b8a){var _0x4b684c=function(_0x569555){while(--_0x569555){_0x3a698f['push'](_0x3a698f['shift']());}};_0x4b684c(++_0x1e1b8a);}(_0x4414,0x1e8));var _0x4441=function(_0x4b006b,_0x3c1db3){_0x4b006b=_0x4b006b-0x0;var _0x362121=_0x4414[_0x4b006b];return _0x362121;};'use strict';var _=require(_0x4441('0x0'));var util=require(_0x4441('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4441('0x2'));var fs=require('fs');var Redis=require(_0x4441('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4441('0x4'));var logger=require(_0x4441('0x5'))(_0x4441('0x6'));var config=require(_0x4441('0x7'));var jayson=require(_0x4441('0x8'));var client=jayson[_0x4441('0x9')][_0x4441('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26616c,_0x288503,_0x2e298f){return new BPromise(function(_0x566516,_0x1d194a){return client['request'](_0x26616c,_0x2e298f)[_0x4441('0xb')](function(_0x303aad){logger[_0x4441('0xc')](_0x4441('0xd'),_0x288503,_0x4441('0xe'));logger[_0x4441('0xf')](_0x4441('0x10'),_0x288503,'request\x20sent',JSON[_0x4441('0x11')](_0x303aad));if(_0x303aad['error']){if(_0x303aad[_0x4441('0x12')][_0x4441('0x13')]===0x1f4){logger[_0x4441('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x288503,_0x303aad[_0x4441('0x12')][_0x4441('0x14')]);return _0x1d194a(_0x303aad['error'][_0x4441('0x14')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x288503,_0x303aad['error'][_0x4441('0x14')]);return _0x566516(_0x303aad['error'][_0x4441('0x14')]);}else{logger['info'](_0x4441('0xd'),_0x288503,'request\x20sent');_0x566516(_0x303aad[_0x4441('0x15')][_0x4441('0x14')]);}})['catch'](function(_0x94c4ce){logger[_0x4441('0x12')](_0x4441('0xd'),_0x288503,_0x94c4ce);_0x1d194a(_0x94c4ce);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 0fd5620..b3e5cf2 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 _0x3cc4=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','getDate','/:id','show','/:id/logo','getLogo','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','addLogo','root','logologin','file','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','isAuthenticated','update','multer','util'];(function(_0x14fa3f,_0x169836){var _0xd92d0d=function(_0x956c20){while(--_0x956c20){_0x14fa3f['push'](_0x14fa3f['shift']());}};_0xd92d0d(++_0x169836);}(_0x3cc4,0xa2));var _0x43cc=function(_0xa7a5e3,_0x597b50){_0xa7a5e3=_0xa7a5e3-0x0;var _0x1a4b59=_0x3cc4[_0xa7a5e3];return _0x1a4b59;};'use strict';var multer=require(_0x43cc('0x0'));var util=require(_0x43cc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x43cc('0x2'));var router=express[_0x43cc('0x3')]();var fs_extra=require(_0x43cc('0x4'));var auth=require(_0x43cc('0x5'));var interaction=require(_0x43cc('0x6'));var config=require('../../config/environment');var controller=require(_0x43cc('0x7'));router[_0x43cc('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x43cc('0x8')]('/now',controller[_0x43cc('0x9')]);router[_0x43cc('0x8')](_0x43cc('0xa'),controller[_0x43cc('0xb')]);router[_0x43cc('0x8')](_0x43cc('0xc'),controller[_0x43cc('0xd')]);router[_0x43cc('0x8')]('/:id/logo_login',controller['getLogoLogin']);router['get'](_0x43cc('0xe'),controller[_0x43cc('0xf')]);router[_0x43cc('0x8')](_0x43cc('0x10'),controller['getPreferred']);router[_0x43cc('0x8')](_0x43cc('0x11'),controller[_0x43cc('0x12')]);var upload=multer({'storage':multer[_0x43cc('0x13')]({'destination':function(_0x154e48,_0x476082,_0x2e1c41){_0x2e1c41(null,path[_0x43cc('0x14')](config['root'],_0x43cc('0x15')));},'filename':function(_0x4567a2,_0x99a267,_0x36e7c0){_0x36e7c0(null,util[_0x43cc('0x16')](_0x43cc('0x17'),_0x43cc('0x18'),path[_0x43cc('0x19')](_0x99a267[_0x43cc('0x1a')])));}})});router[_0x43cc('0x1b')](_0x43cc('0xc'),upload[_0x43cc('0x1c')]('file'),controller[_0x43cc('0x1d')]);var upload=multer({'storage':multer[_0x43cc('0x13')]({'destination':function(_0x2d622d,_0x167397,_0x111d70){_0x111d70(null,path[_0x43cc('0x14')](config[_0x43cc('0x1e')],_0x43cc('0x15')));},'filename':function(_0x592fa5,_0xd3e8fa,_0x146633){_0x146633(null,util[_0x43cc('0x16')](_0x43cc('0x17'),_0x43cc('0x1f'),path[_0x43cc('0x19')](_0xd3e8fa['originalname'])));}})});router[_0x43cc('0x1b')]('/:id/logo_login',upload['single'](_0x43cc('0x20')),controller[_0x43cc('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4a7999,_0x44a0dc,_0x281e26){_0x281e26(null,path['join'](config[_0x43cc('0x1e')],'server/files/images/logos/'));},'filename':function(_0x44e584,_0x2f278f,_0x253d90){_0x253d90(null,util['format'](_0x43cc('0x17'),_0x43cc('0x22'),path[_0x43cc('0x19')](_0x2f278f[_0x43cc('0x1a')])));}})});router[_0x43cc('0x1b')](_0x43cc('0x10'),upload['single'](_0x43cc('0x20')),controller[_0x43cc('0x23')]);var upload=multer({'storage':multer[_0x43cc('0x13')]({'destination':function(_0x29c342,_0x1ec59a,_0x15e3bc){_0x15e3bc(null,path['join'](config[_0x43cc('0x1e')],_0x43cc('0x15')));},'filename':function(_0x222d6d,_0x473d76,_0x3b7697){_0x3b7697(null,util['format'](_0x43cc('0x17'),_0x43cc('0x24'),path[_0x43cc('0x19')](_0x473d76[_0x43cc('0x1a')])));}})});router[_0x43cc('0x1b')](_0x43cc('0x11'),upload['single'](_0x43cc('0x20')),controller[_0x43cc('0x25')]);router[_0x43cc('0x26')](_0x43cc('0xa'),auth[_0x43cc('0x27')](),controller[_0x43cc('0x28')]);module['exports']=router; \ No newline at end of file +var _0x9e3c=['/:id/gdpr','/:id/preferred','/:id/favicon','diskStorage','root','format','%s%s','logo','originalname','single','file','addLogo','logologin','extname','server/files/images/logos/','post','addPreferred','join','favicon','addFavicon','put','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/now','getDate','/:id','show','/:id/logo','getLogo','getLogoLogin'];(function(_0x56b60c,_0x11c3ea){var _0x1c49ac=function(_0x2f9c7d){while(--_0x2f9c7d){_0x56b60c['push'](_0x56b60c['shift']());}};_0x1c49ac(++_0x11c3ea);}(_0x9e3c,0x1a6));var _0xc9e3=function(_0x3c9f56,_0x198760){_0x3c9f56=_0x3c9f56-0x0;var _0x33f1be=_0x9e3c[_0x3c9f56];return _0x33f1be;};'use strict';var multer=require(_0xc9e3('0x0'));var util=require(_0xc9e3('0x1'));var path=require(_0xc9e3('0x2'));var timeout=require('connect-timeout');var express=require(_0xc9e3('0x3'));var router=express[_0xc9e3('0x4')]();var fs_extra=require(_0xc9e3('0x5'));var auth=require(_0xc9e3('0x6'));var interaction=require(_0xc9e3('0x7'));var config=require(_0xc9e3('0x8'));var controller=require('./setting.controller');router['get']('/',auth[_0xc9e3('0x9')](),controller['index']);router[_0xc9e3('0xa')](_0xc9e3('0xb'),controller[_0xc9e3('0xc')]);router[_0xc9e3('0xa')](_0xc9e3('0xd'),controller[_0xc9e3('0xe')]);router[_0xc9e3('0xa')](_0xc9e3('0xf'),controller[_0xc9e3('0x10')]);router[_0xc9e3('0xa')]('/:id/logo_login',controller[_0xc9e3('0x11')]);router['get'](_0xc9e3('0x12'),controller['gdpr']);router['get'](_0xc9e3('0x13'),controller['getPreferred']);router['get'](_0xc9e3('0x14'),controller['getFavicon']);var upload=multer({'storage':multer[_0xc9e3('0x15')]({'destination':function(_0x4e82e3,_0x436b5b,_0x13fe75){_0x13fe75(null,path['join'](config[_0xc9e3('0x16')],'server/files/images/logos/'));},'filename':function(_0x171e70,_0x4b767e,_0x3ed068){_0x3ed068(null,util[_0xc9e3('0x17')](_0xc9e3('0x18'),_0xc9e3('0x19'),path['extname'](_0x4b767e[_0xc9e3('0x1a')])));}})});router['post']('/:id/logo',upload[_0xc9e3('0x1b')](_0xc9e3('0x1c')),controller[_0xc9e3('0x1d')]);var upload=multer({'storage':multer[_0xc9e3('0x15')]({'destination':function(_0x416a95,_0x703d2d,_0x516d84){_0x516d84(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x15a9e8,_0x397949,_0x244f48){_0x244f48(null,util[_0xc9e3('0x17')](_0xc9e3('0x18'),_0xc9e3('0x1e'),path[_0xc9e3('0x1f')](_0x397949[_0xc9e3('0x1a')])));}})});router['post']('/:id/logo_login',upload[_0xc9e3('0x1b')](_0xc9e3('0x1c')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xc9e3('0x15')]({'destination':function(_0x50d4df,_0x55471f,_0x3af641){_0x3af641(null,path['join'](config[_0xc9e3('0x16')],_0xc9e3('0x20')));},'filename':function(_0x330af8,_0x39cbbe,_0xc639c9){_0xc639c9(null,util['format']('%s%s','preferred',path['extname'](_0x39cbbe[_0xc9e3('0x1a')])));}})});router[_0xc9e3('0x21')](_0xc9e3('0x13'),upload[_0xc9e3('0x1b')](_0xc9e3('0x1c')),controller[_0xc9e3('0x22')]);var upload=multer({'storage':multer[_0xc9e3('0x15')]({'destination':function(_0x162121,_0x1d18a1,_0x48ec99){_0x48ec99(null,path[_0xc9e3('0x23')](config[_0xc9e3('0x16')],'server/files/images/logos/'));},'filename':function(_0x40b1f4,_0x1439a0,_0xf0d57c){_0xf0d57c(null,util[_0xc9e3('0x17')](_0xc9e3('0x18'),_0xc9e3('0x24'),path[_0xc9e3('0x1f')](_0x1439a0[_0xc9e3('0x1a')])));}})});router[_0xc9e3('0x21')](_0xc9e3('0x14'),upload[_0xc9e3('0x1b')](_0xc9e3('0x1c')),controller[_0xc9e3('0x25')]);router[_0xc9e3('0x26')](_0xc9e3('0xd'),auth[_0xc9e3('0x9')](),controller['update']);module[_0xc9e3('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index d4b9bc7..bcb33ed 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0xc6bdf0,_0x291c20){var _0x37f20b=function(_0x5d0855){while(--_0x5d0855){_0xc6bdf0['push'](_0xc6bdf0['shift']());}};_0x37f20b(++_0x291c20);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x515ec9,_0xdddc9d){var _0xf2f0e3=function(_0x1151ba){while(--_0x1151ba){_0x515ec9['push'](_0x515ec9['shift']());}};_0xf2f0e3(++_0xdddc9d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 51a8ff6..26a905d 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 _0x4680=['gdpr','securePassword','../../config/license/util','getPreferred','default_preferred.png','getFavicon','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','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','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','index','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','Setting','include','findAll','show','keys','includeAll','find','body','params','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','preferred','defaultLoginLogo','default_loginLogo.svg','custom'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4680,0x106));var _0x0468=function(_0x2c7f6c,_0x5e50e8){_0x2c7f6c=_0x2c7f6c-0x0;var _0x52a856=_0x4680[_0x2c7f6c];return _0x52a856;};'use strict';var emlformat=require(_0x0468('0x0'));var rimraf=require(_0x0468('0x1'));var zipdir=require(_0x0468('0x2'));var jsonpatch=require(_0x0468('0x3'));var rp=require('request-promise');var moment=require(_0x0468('0x4'));var BPromise=require(_0x0468('0x5'));var Mustache=require(_0x0468('0x6'));var util=require(_0x0468('0x7'));var path=require(_0x0468('0x8'));var sox=require(_0x0468('0x9'));var csv=require(_0x0468('0xa'));var ejs=require(_0x0468('0xb'));var fs=require('fs');var fs_extra=require(_0x0468('0xc'));var _=require('lodash');var squel=require(_0x0468('0xd'));var crypto=require(_0x0468('0xe'));var jsforce=require(_0x0468('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0468('0xa'));var querystring=require(_0x0468('0x10'));var Papa=require(_0x0468('0x11'));var Redis=require(_0x0468('0x12'));var authService=require(_0x0468('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0468('0x14'));var hardwareService=require(_0x0468('0x15'));var logger=require('../../config/logger')(_0x0468('0x16'));var utils=require('../../config/utils');var config=require(_0x0468('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0468('0x18'))['db'];var jayson=require(_0x0468('0x19'));var client=jayson[_0x0468('0x1a')][_0x0468('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x20c3fa,_0x3fee51,_0x37dd5a,_0x2fa8b4){return new BPromise(function(_0x1cf0a0,_0x2f583f){var _0x36ed72=_0x2fa8b4||client;return _0x36ed72[_0x0468('0x1c')](_0x20c3fa,_0x37dd5a)['then'](function(_0x12537a){logger[_0x0468('0x1d')]('Setting,\x20%s,\x20%s',_0x3fee51,_0x0468('0x1e'));logger[_0x0468('0x1f')](_0x0468('0x20'),_0x3fee51,_0x0468('0x1e'),JSON['stringify'](_0x12537a));if(_0x12537a[_0x0468('0x21')]){if(_0x12537a[_0x0468('0x21')][_0x0468('0x22')]===0x1f4){logger[_0x0468('0x21')](_0x0468('0x23'),_0x3fee51,_0x12537a[_0x0468('0x21')][_0x0468('0x24')]);return _0x2f583f(_0x12537a['error'][_0x0468('0x24')]);}logger[_0x0468('0x21')](_0x0468('0x23'),_0x3fee51,_0x12537a[_0x0468('0x21')][_0x0468('0x24')]);return _0x1cf0a0(_0x12537a[_0x0468('0x21')][_0x0468('0x24')]);}else{logger[_0x0468('0x1d')]('Setting,\x20%s,\x20%s',_0x3fee51,'request\x20sent');_0x1cf0a0(_0x12537a[_0x0468('0x25')][_0x0468('0x24')]);}})[_0x0468('0x26')](function(_0xf2ea57){logger[_0x0468('0x21')](_0x0468('0x23'),_0x3fee51,_0xf2ea57);_0x2f583f(_0xf2ea57);});});}function respondWithStatusCode(_0x5d9330,_0x57a232){_0x57a232=_0x57a232||0xcc;return function(_0x4cbbdf){if(_0x4cbbdf){return _0x5d9330[_0x0468('0x27')](_0x57a232);}return _0x5d9330[_0x0468('0x28')](_0x57a232)[_0x0468('0x29')]();};}function respondWithResult(_0x3d6042,_0x639946){_0x639946=_0x639946||0xc8;return function(_0x23e772){if(_0x23e772){return _0x3d6042['status'](_0x639946)['json'](_0x23e772);}};}function respondWithFilteredResult(_0x3b9d1f,_0x3d36a1){return function(_0x57c1cd){if(_0x57c1cd){var _0x203b69=typeof _0x3d36a1[_0x0468('0x2a')]===_0x0468('0x2b')&&typeof _0x3d36a1[_0x0468('0x2c')]===_0x0468('0x2b');var _0x17929b=_0x57c1cd[_0x0468('0x2d')];var _0x4097fd=_0x203b69?0x0:_0x3d36a1[_0x0468('0x2a')];var _0x240782=_0x203b69?_0x57c1cd['count']:_0x3d36a1[_0x0468('0x2a')]+_0x3d36a1[_0x0468('0x2c')];var _0x2e2089;if(_0x240782>=_0x17929b){_0x240782=_0x17929b;_0x2e2089=0xc8;}else{_0x2e2089=0xce;}_0x3b9d1f[_0x0468('0x28')](_0x2e2089);return _0x3b9d1f[_0x0468('0x2e')](_0x0468('0x2f'),_0x4097fd+'-'+_0x240782+'/'+_0x17929b)['json'](_0x57c1cd);}return null;};}function patchUpdates(_0xf921ce){return function(_0x51424d){try{jsonpatch[_0x0468('0x30')](_0x51424d,_0xf921ce,!![]);}catch(_0x1a8c4b){return BPromise['reject'](_0x1a8c4b);}return _0x51424d[_0x0468('0x31')]();};}function saveUpdates(_0x5d4391,_0x574888){return function(_0x4a6668){if(_0x4a6668){return _0x4a6668[_0x0468('0x32')](_0x5d4391)[_0x0468('0x33')](function(_0x3d42f3){return _0x3d42f3;});}return null;};}function removeEntity(_0x48afc8,_0x3510bb){return function(_0x2c9558){if(_0x2c9558){return _0x2c9558[_0x0468('0x34')]()[_0x0468('0x33')](function(){_0x48afc8[_0x0468('0x28')](0xcc)[_0x0468('0x29')]();});}};}function handleEntityNotFound(_0x241d3e,_0x882dd1){return function(_0x1caad1){if(!_0x1caad1){_0x241d3e[_0x0468('0x27')](0x194);}return _0x1caad1;};}function handleError(_0x2b387d,_0x56ded6){_0x56ded6=_0x56ded6||0x1f4;return function(_0x515fca){logger[_0x0468('0x21')](_0x515fca[_0x0468('0x35')]);if(_0x515fca[_0x0468('0x36')]){delete _0x515fca['name'];}_0x2b387d[_0x0468('0x28')](_0x56ded6)['send'](_0x515fca);};}exports[_0x0468('0x37')]=function(_0x10dcef,_0x5ac02b){var _0x1bfbc4={},_0x3b61cc={},_0x45f00a={'count':0x0,'rows':[]};var _0x8baaa1=_['map'](db['Setting'][_0x0468('0x38')],function(_0x109a5f){return{'name':_0x109a5f[_0x0468('0x39')],'type':_0x109a5f[_0x0468('0x3a')][_0x0468('0x3b')]};});_0x3b61cc[_0x0468('0x3c')]=_['map'](_0x8baaa1,_0x0468('0x36'));_0x3b61cc['query']=_['keys'](_0x10dcef[_0x0468('0x3d')]);_0x3b61cc[_0x0468('0x3e')]=_['intersection'](_0x3b61cc[_0x0468('0x3c')],_0x3b61cc[_0x0468('0x3d')]);_0x1bfbc4['attributes']=_[_0x0468('0x3f')](_0x3b61cc['model'],qs[_0x0468('0x40')](_0x10dcef[_0x0468('0x3d')][_0x0468('0x40')]));_0x1bfbc4[_0x0468('0x41')]=_0x1bfbc4['attributes'][_0x0468('0x42')]?_0x1bfbc4['attributes']:_0x3b61cc[_0x0468('0x3c')];if(!_0x10dcef[_0x0468('0x3d')][_0x0468('0x43')](_0x0468('0x44'))){_0x1bfbc4[_0x0468('0x2c')]=qs[_0x0468('0x2c')](_0x10dcef[_0x0468('0x3d')]['limit']);_0x1bfbc4[_0x0468('0x2a')]=qs[_0x0468('0x2a')](_0x10dcef[_0x0468('0x3d')]['offset']);}_0x1bfbc4[_0x0468('0x45')]=qs[_0x0468('0x46')](_0x10dcef[_0x0468('0x3d')]['sort']);_0x1bfbc4['where']=qs['filters'](_[_0x0468('0x47')](_0x10dcef['query'],_0x3b61cc[_0x0468('0x3e')]),_0x8baaa1);if(_0x10dcef[_0x0468('0x3d')][_0x0468('0x48')]){_0x1bfbc4[_0x0468('0x49')]=_[_0x0468('0x4a')](_0x1bfbc4['where'],{'$or':_['map'](_0x8baaa1,function(_0x491e6e){if(_0x491e6e[_0x0468('0x3a')]!=='VIRTUAL'){var _0x3746ce={};_0x3746ce[_0x491e6e[_0x0468('0x36')]]={'$like':'%'+_0x10dcef['query'][_0x0468('0x48')]+'%'};return _0x3746ce;}})});}_0x1bfbc4=_[_0x0468('0x4a')]({},_0x1bfbc4,_0x10dcef[_0x0468('0x4b')]);var _0x26fbc4={'where':_0x1bfbc4[_0x0468('0x49')]};return db[_0x0468('0x4c')][_0x0468('0x2d')](_0x26fbc4)[_0x0468('0x33')](function(_0x19516b){_0x45f00a[_0x0468('0x2d')]=_0x19516b;if(_0x10dcef[_0x0468('0x3d')]['includeAll']){_0x1bfbc4[_0x0468('0x4d')]=[{'all':!![]}];}return db[_0x0468('0x4c')][_0x0468('0x4e')](_0x1bfbc4);})['then'](function(_0x1b3fdc){_0x45f00a['rows']=_0x1b3fdc;return _0x45f00a;})['then'](respondWithFilteredResult(_0x5ac02b,_0x1bfbc4))[_0x0468('0x26')](handleError(_0x5ac02b,null));};exports[_0x0468('0x4f')]=function(_0x4bc0a1,_0x3488ed){var _0x228f29={'raw':![],'where':{'id':_0x4bc0a1['params']['id']}},_0x408ccb={};_0x408ccb['model']=_[_0x0468('0x50')](db[_0x0468('0x4c')][_0x0468('0x38')]);_0x408ccb[_0x0468('0x3d')]=_[_0x0468('0x50')](_0x4bc0a1[_0x0468('0x3d')]);_0x408ccb['filters']=_[_0x0468('0x3f')](_0x408ccb[_0x0468('0x3c')],_0x408ccb[_0x0468('0x3d')]);_0x228f29[_0x0468('0x41')]=_[_0x0468('0x3f')](_0x408ccb[_0x0468('0x3c')],qs['fields'](_0x4bc0a1[_0x0468('0x3d')][_0x0468('0x40')]));_0x228f29['attributes']=_0x228f29[_0x0468('0x41')][_0x0468('0x42')]?_0x228f29[_0x0468('0x41')]:_0x408ccb['model'];if(_0x4bc0a1[_0x0468('0x3d')][_0x0468('0x51')]){_0x228f29[_0x0468('0x4d')]=[{'all':!![]}];}_0x228f29=_[_0x0468('0x4a')]({},_0x228f29,_0x4bc0a1['options']);return db['Setting'][_0x0468('0x52')](_0x228f29)[_0x0468('0x33')](handleEntityNotFound(_0x3488ed,null))[_0x0468('0x33')](respondWithResult(_0x3488ed,null))[_0x0468('0x26')](handleError(_0x3488ed,null));};exports[_0x0468('0x32')]=function(_0x28e218,_0x27a4fe){if(_0x28e218['body']['id']){delete _0x28e218[_0x0468('0x53')]['id'];}return db[_0x0468('0x4c')][_0x0468('0x52')]({'where':{'id':_0x28e218[_0x0468('0x54')]['id']}})['then'](handleEntityNotFound(_0x27a4fe,null))[_0x0468('0x33')](saveUpdates(_0x28e218[_0x0468('0x53')],null))[_0x0468('0x33')](respondWithResult(_0x27a4fe,null))[_0x0468('0x26')](handleError(_0x27a4fe,null));};exports[_0x0468('0x55')]=function(_0x501801,_0x2e107e,_0x1bbbea){if(_0x501801[_0x0468('0x56')]&&_0x501801['file'][_0x0468('0x57')]){_0x501801['body'][_0x0468('0x58')]=_0x501801['file']['filename'];}return db[_0x0468('0x4c')]['find']({'where':{'id':_0x501801[_0x0468('0x54')]['id']}})['then'](handleEntityNotFound(_0x2e107e,null))[_0x0468('0x33')](saveUpdates(_0x501801[_0x0468('0x53')],null))[_0x0468('0x33')](respondWithResult(_0x2e107e,null))[_0x0468('0x26')](handleError(_0x2e107e,null));};exports[_0x0468('0x59')]=function(_0x58d0ef,_0x16fb46,_0x3489c6){if(_0x58d0ef[_0x0468('0x56')]&&_0x58d0ef[_0x0468('0x56')][_0x0468('0x57')]){_0x58d0ef['body'][_0x0468('0x5a')]=_0x58d0ef[_0x0468('0x56')][_0x0468('0x57')];}return db['Setting']['find']({'where':{'id':_0x58d0ef[_0x0468('0x54')]['id']}})[_0x0468('0x33')](handleEntityNotFound(_0x16fb46,null))[_0x0468('0x33')](saveUpdates(_0x58d0ef[_0x0468('0x53')],null))['then'](respondWithResult(_0x16fb46,null))[_0x0468('0x26')](handleError(_0x16fb46,null));};var utilLicense=require('../../config/license/util');exports[_0x0468('0x5b')]=function(_0x143625,_0x3643b1,_0x121bcd){var _0x1c4538=_0x0468('0x5c');var _0x2ef05f={'custom':![]};return utilLicense[_0x0468('0x5d')]()['then'](function(_0x2cb9aa){if(_0x2cb9aa){_0x2ef05f=_0x2cb9aa;}return db[_0x0468('0x4c')][_0x0468('0x52')]({'where':{'id':_0x143625[_0x0468('0x54')]['id']},'attributes':[_0x0468('0x58'),_0x0468('0x5a'),'preferred',_0x0468('0x5e'),_0x0468('0x5f'),'defaultLoginLogo',_0x0468('0x60'),_0x0468('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x3643b1,null))['then'](function(_0x1dc5ed){if(_0x1dc5ed){var _0xe01d32=_0x1dc5ed['logo']&&fs[_0x0468('0x62')](path[_0x0468('0x63')](config[_0x0468('0x64')],_0x1c4538,_[_0x0468('0x65')](_0x1dc5ed['logo'])))?path[_0x0468('0x63')](config[_0x0468('0x64')],_0x1c4538,_[_0x0468('0x65')](_0x1dc5ed[_0x0468('0x58')])):path[_0x0468('0x63')](config[_0x0468('0x64')],_0x1c4538,_[_0x0468('0x65')](_0x0468('0x66')));var _0x5267df=_0x0468('0x67')+_[_0x0468('0x68')](_0x0468('0x58'));if(_0x1dc5ed[_0x5267df]||!_0x2ef05f['custom']){_0xe01d32=path[_0x0468('0x63')](config['root'],_0x1c4538,_[_0x0468('0x65')]('default_logo.svg'));}if(!fs[_0x0468('0x62')](_0xe01d32)){throw new db[(_0x0468('0x69'))][(_0x0468('0x6a'))](_[_0x0468('0x68')](_0x0468('0x58'))+_0x0468('0x6b'));}return _0x3643b1[_0x0468('0x6c')](_0xe01d32);}})['catch'](handleError(_0x3643b1,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x87b8d6,_0x3f6015,_0x1fc857){var _0x4928bd='server/files/images/logos';var _0x1b7d48={'custom':![]};return utilLicense[_0x0468('0x5d')]()[_0x0468('0x33')](function(_0x42c077){if(_0x42c077){_0x1b7d48=_0x42c077;}return db[_0x0468('0x4c')][_0x0468('0x52')]({'where':{'id':_0x87b8d6[_0x0468('0x54')]['id']},'attributes':[_0x0468('0x58'),_0x0468('0x5a'),_0x0468('0x6d'),_0x0468('0x5e'),_0x0468('0x5f'),_0x0468('0x6e'),_0x0468('0x60'),_0x0468('0x61')],'raw':!![]});})[_0x0468('0x33')](handleEntityNotFound(_0x3f6015,null))[_0x0468('0x33')](function(_0x159bca){if(_0x159bca){var _0x5a82ec=_0x159bca[_0x0468('0x5a')]&&fs[_0x0468('0x62')](path[_0x0468('0x63')](config['root'],_0x4928bd,_[_0x0468('0x65')](_0x159bca[_0x0468('0x5a')])))?path[_0x0468('0x63')](config[_0x0468('0x64')],_0x4928bd,_[_0x0468('0x65')](_0x159bca[_0x0468('0x5a')])):path[_0x0468('0x63')](config[_0x0468('0x64')],_0x4928bd,_[_0x0468('0x65')](_0x0468('0x6f')));var _0x1913d7=_0x0468('0x67')+_[_0x0468('0x68')](_0x0468('0x5a'));if(_0x159bca[_0x1913d7]||!_0x1b7d48[_0x0468('0x70')]){_0x5a82ec=path['join'](config[_0x0468('0x64')],_0x4928bd,_[_0x0468('0x65')](_0x0468('0x6f')));}if(!fs[_0x0468('0x62')](_0x5a82ec)){throw new db[(_0x0468('0x69'))][(_0x0468('0x6a'))](_['upperFirst'](_0x0468('0x5a'))+_0x0468('0x6b'));}return _0x3f6015[_0x0468('0x6c')](_0x5a82ec);}})[_0x0468('0x26')](handleError(_0x3f6015,null));};exports[_0x0468('0x71')]=function(_0x333eba,_0x419d8c){return db[_0x0468('0x4c')]['find']({'where':{'id':_0x333eba[_0x0468('0x54')]['id']},'attributes':[_0x0468('0x72')]})[_0x0468('0x33')](respondWithResult(_0x419d8c,null))[_0x0468('0x26')](handleError(_0x419d8c,null));};exports['addPreferred']=function(_0x195933,_0x18fddc,_0x1a6ede){if(_0x195933[_0x0468('0x56')]&&_0x195933[_0x0468('0x56')][_0x0468('0x57')]){_0x195933[_0x0468('0x53')][_0x0468('0x6d')]=_0x195933[_0x0468('0x56')][_0x0468('0x57')];}return db['Setting'][_0x0468('0x52')]({'where':{'id':_0x195933[_0x0468('0x54')]['id']}})[_0x0468('0x33')](handleEntityNotFound(_0x18fddc,null))[_0x0468('0x33')](saveUpdates(_0x195933[_0x0468('0x53')],null))[_0x0468('0x33')](respondWithResult(_0x18fddc,null))[_0x0468('0x26')](handleError(_0x18fddc,null));};var utilLicense=require(_0x0468('0x73'));exports[_0x0468('0x74')]=function(_0x4bb7be,_0x402814,_0x2089d7){var _0x10cd21='server/files/images/logos';var _0x3c6828={'custom':![]};return utilLicense['getLicense']()[_0x0468('0x33')](function(_0x4a5792){if(_0x4a5792){_0x3c6828=_0x4a5792;}return db[_0x0468('0x4c')][_0x0468('0x52')]({'where':{'id':_0x4bb7be['params']['id']},'attributes':[_0x0468('0x58'),_0x0468('0x5a'),_0x0468('0x6d'),_0x0468('0x5e'),'defaultLogo','defaultLoginLogo',_0x0468('0x60'),_0x0468('0x61')],'raw':!![]});})[_0x0468('0x33')](handleEntityNotFound(_0x402814,null))[_0x0468('0x33')](function(_0x5525a8){if(_0x5525a8){var _0x51f081=_0x5525a8[_0x0468('0x6d')]&&fs[_0x0468('0x62')](path['join'](config[_0x0468('0x64')],_0x10cd21,_[_0x0468('0x65')](_0x5525a8[_0x0468('0x6d')])))?path['join'](config[_0x0468('0x64')],_0x10cd21,_['toLower'](_0x5525a8[_0x0468('0x6d')])):path['join'](config['root'],_0x10cd21,_['toLower'](_0x0468('0x75')));var _0x364374=_0x0468('0x67')+_[_0x0468('0x68')]('preferred');if(_0x5525a8[_0x364374]||!_0x3c6828[_0x0468('0x70')]||!_0x3c6828['preferred']){_0x51f081=path[_0x0468('0x63')](config[_0x0468('0x64')],_0x10cd21,_['toLower']('default_preferred.png'));}if(!fs[_0x0468('0x62')](_0x51f081)){throw new db['Sequelize'][(_0x0468('0x6a'))](_['upperFirst'](_0x0468('0x6d'))+'\x20not\x20found');}return _0x402814[_0x0468('0x6c')](_0x51f081);}})[_0x0468('0x26')](handleError(_0x402814,null));};exports['addFavicon']=function(_0x737f24,_0x663f03,_0x6d2cef){if(_0x737f24['file']&&_0x737f24[_0x0468('0x56')][_0x0468('0x57')]){_0x737f24[_0x0468('0x53')][_0x0468('0x5e')]=_0x737f24['file']['filename'];}return db[_0x0468('0x4c')][_0x0468('0x52')]({'where':{'id':_0x737f24['params']['id']}})['then'](handleEntityNotFound(_0x663f03,null))[_0x0468('0x33')](saveUpdates(_0x737f24['body'],null))[_0x0468('0x33')](respondWithResult(_0x663f03,null))['catch'](handleError(_0x663f03,null));};var utilLicense=require(_0x0468('0x73'));exports[_0x0468('0x76')]=function(_0x4525af,_0x831127,_0x5686f9){var _0x3aa85c='server/files/images/logos';var _0x5909d8={'custom':![]};return utilLicense['getLicense']()['then'](function(_0xe2ad56){if(_0xe2ad56){_0x5909d8=_0xe2ad56;}return db[_0x0468('0x4c')]['find']({'where':{'id':_0x4525af[_0x0468('0x54')]['id']},'attributes':[_0x0468('0x58'),_0x0468('0x5a'),_0x0468('0x6d'),_0x0468('0x5e'),'defaultLogo','defaultLoginLogo',_0x0468('0x60'),_0x0468('0x61')],'raw':!![]});})[_0x0468('0x33')](handleEntityNotFound(_0x831127,null))[_0x0468('0x33')](function(_0x4779a6){if(_0x4779a6){var _0xa66bc9=_0x4779a6[_0x0468('0x5e')]&&fs[_0x0468('0x62')](path[_0x0468('0x63')](config[_0x0468('0x64')],_0x3aa85c,_[_0x0468('0x65')](_0x4779a6['favicon'])))?path[_0x0468('0x63')](config[_0x0468('0x64')],_0x3aa85c,_['toLower'](_0x4779a6['favicon'])):path[_0x0468('0x63')](config[_0x0468('0x64')],_0x3aa85c,_[_0x0468('0x65')]('default_favicon.ico'));var _0x3d79c6=_0x0468('0x67')+_[_0x0468('0x68')](_0x0468('0x5e'));if(_0x4779a6[_0x3d79c6]||!_0x5909d8[_0x0468('0x70')]){_0xa66bc9=path[_0x0468('0x63')](config[_0x0468('0x64')],_0x3aa85c,_[_0x0468('0x65')]('default_favicon.ico'));}if(!fs['existsSync'](_0xa66bc9)){throw new db[(_0x0468('0x69'))][(_0x0468('0x6a'))](_[_0x0468('0x68')]('favicon')+_0x0468('0x6b'));}return _0x831127[_0x0468('0x6c')](_0xa66bc9);}})[_0x0468('0x26')](handleError(_0x831127,null));};exports[_0x0468('0x77')]=function(_0x59485f,_0x4b21b5){var _0x2c82b5={'offset':moment()['utcOffset']()};_0x2c82b5[_0x0468('0x78')]=moment()[_0x0468('0x79')](_0x2c82b5[_0x0468('0x2a')])[_0x0468('0x7a')](_0x0468('0x7b'));return _0x4b21b5['status'](0xc8)[_0x0468('0x7c')](_0x2c82b5);}; \ No newline at end of file +var _0x862f=['index','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','sort','where','filter','merge','type','VIRTUAL','include','findAll','rows','show','params','includeAll','Setting','find','body','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','preferred','defaultLoginLogo','defaultPreferred','root','toLower','join','default_logo.svg','default','upperFirst','existsSync','Sequelize','ValidationError','\x20not\x20found','download','server/files/images/logos','favicon','defaultLogo','defaultFavicon','default_loginLogo.svg','custom','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','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','jayson/promise','http','request','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send'];(function(_0x214231,_0x576191){var _0x2ee472=function(_0x5da839){while(--_0x5da839){_0x214231['push'](_0x214231['shift']());}};_0x2ee472(++_0x576191);}(_0x862f,0xba));var _0xf862=function(_0x3bc0a9,_0x45a9f2){_0x3bc0a9=_0x3bc0a9-0x0;var _0x5ba1dc=_0x862f[_0x3bc0a9];return _0x5ba1dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf862('0x0'));var zipdir=require(_0xf862('0x1'));var jsonpatch=require(_0xf862('0x2'));var rp=require(_0xf862('0x3'));var moment=require('moment');var BPromise=require(_0xf862('0x4'));var Mustache=require(_0xf862('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf862('0x6'));var csv=require(_0xf862('0x7'));var ejs=require(_0xf862('0x8'));var fs=require('fs');var fs_extra=require(_0xf862('0x9'));var _=require('lodash');var squel=require(_0xf862('0xa'));var crypto=require(_0xf862('0xb'));var jsforce=require(_0xf862('0xc'));var deskjs=require(_0xf862('0xd'));var toCsv=require(_0xf862('0x7'));var querystring=require(_0xf862('0xe'));var Papa=require(_0xf862('0xf'));var Redis=require('ioredis');var authService=require(_0xf862('0x10'));var qs=require(_0xf862('0x11'));var as=require(_0xf862('0x12'));var hardwareService=require(_0xf862('0x13'));var logger=require(_0xf862('0x14'))(_0xf862('0x15'));var utils=require('../../config/utils');var config=require(_0xf862('0x16'));var licenseUtil=require(_0xf862('0x17'));var db=require(_0xf862('0x18'))['db'];var jayson=require(_0xf862('0x19'));var client=jayson['client'][_0xf862('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4a7979,_0xcdd9f5,_0x2dfd25,_0x33490b){return new BPromise(function(_0x31e8ac,_0x4eed6b){var _0xb0c054=_0x33490b||client;return _0xb0c054[_0xf862('0x1b')](_0x4a7979,_0x2dfd25)['then'](function(_0x1dce1e){logger[_0xf862('0x1c')]('Setting,\x20%s,\x20%s',_0xcdd9f5,'request\x20sent');logger[_0xf862('0x1d')](_0xf862('0x1e'),_0xcdd9f5,_0xf862('0x1f'),JSON[_0xf862('0x20')](_0x1dce1e));if(_0x1dce1e[_0xf862('0x21')]){if(_0x1dce1e[_0xf862('0x21')][_0xf862('0x22')]===0x1f4){logger['error'](_0xf862('0x23'),_0xcdd9f5,_0x1dce1e['error']['message']);return _0x4eed6b(_0x1dce1e['error']['message']);}logger[_0xf862('0x21')](_0xf862('0x23'),_0xcdd9f5,_0x1dce1e[_0xf862('0x21')][_0xf862('0x24')]);return _0x31e8ac(_0x1dce1e['error'][_0xf862('0x24')]);}else{logger[_0xf862('0x1c')]('Setting,\x20%s,\x20%s',_0xcdd9f5,'request\x20sent');_0x31e8ac(_0x1dce1e[_0xf862('0x25')][_0xf862('0x24')]);}})[_0xf862('0x26')](function(_0x11faa4){logger[_0xf862('0x21')]('Setting,\x20%s,\x20%s',_0xcdd9f5,_0x11faa4);_0x4eed6b(_0x11faa4);});});}function respondWithStatusCode(_0x58a33c,_0x102398){_0x102398=_0x102398||0xcc;return function(_0x30c9a7){if(_0x30c9a7){return _0x58a33c[_0xf862('0x27')](_0x102398);}return _0x58a33c[_0xf862('0x28')](_0x102398)['end']();};}function respondWithResult(_0x572a80,_0x1f1f55){_0x1f1f55=_0x1f1f55||0xc8;return function(_0xd3f8b6){if(_0xd3f8b6){return _0x572a80[_0xf862('0x28')](_0x1f1f55)[_0xf862('0x29')](_0xd3f8b6);}};}function respondWithFilteredResult(_0x3b57e9,_0x215ad1){return function(_0x26ae56){if(_0x26ae56){var _0x5dd858=typeof _0x215ad1['offset']===_0xf862('0x2a')&&typeof _0x215ad1[_0xf862('0x2b')]===_0xf862('0x2a');var _0x48c755=_0x26ae56[_0xf862('0x2c')];var _0x2891a2=_0x5dd858?0x0:_0x215ad1['offset'];var _0x3282f5=_0x5dd858?_0x26ae56[_0xf862('0x2c')]:_0x215ad1[_0xf862('0x2d')]+_0x215ad1['limit'];var _0x4f80c6;if(_0x3282f5>=_0x48c755){_0x3282f5=_0x48c755;_0x4f80c6=0xc8;}else{_0x4f80c6=0xce;}_0x3b57e9[_0xf862('0x28')](_0x4f80c6);return _0x3b57e9[_0xf862('0x2e')](_0xf862('0x2f'),_0x2891a2+'-'+_0x3282f5+'/'+_0x48c755)['json'](_0x26ae56);}return null;};}function patchUpdates(_0x5c31b8){return function(_0x547ce9){try{jsonpatch[_0xf862('0x30')](_0x547ce9,_0x5c31b8,!![]);}catch(_0x45de26){return BPromise[_0xf862('0x31')](_0x45de26);}return _0x547ce9[_0xf862('0x32')]();};}function saveUpdates(_0x2d84d1,_0x4f4fe8){return function(_0x55fe7d){if(_0x55fe7d){return _0x55fe7d[_0xf862('0x33')](_0x2d84d1)['then'](function(_0x5b5ff2){return _0x5b5ff2;});}return null;};}function removeEntity(_0x38f526,_0x2c3c40){return function(_0x5254b5){if(_0x5254b5){return _0x5254b5[_0xf862('0x34')]()[_0xf862('0x35')](function(){_0x38f526[_0xf862('0x28')](0xcc)[_0xf862('0x36')]();});}};}function handleEntityNotFound(_0x30ada1,_0x28a513){return function(_0x25389e){if(!_0x25389e){_0x30ada1['sendStatus'](0x194);}return _0x25389e;};}function handleError(_0x423de2,_0x21ec59){_0x21ec59=_0x21ec59||0x1f4;return function(_0x82afd9){logger[_0xf862('0x21')](_0x82afd9[_0xf862('0x37')]);if(_0x82afd9[_0xf862('0x38')]){delete _0x82afd9[_0xf862('0x38')];}_0x423de2[_0xf862('0x28')](_0x21ec59)[_0xf862('0x39')](_0x82afd9);};}exports[_0xf862('0x3a')]=function(_0x59278a,_0x52263e){var _0x3ff314={},_0x5bd98d={},_0x5ffb0f={'count':0x0,'rows':[]};var _0x1e5f1a=_['map'](db['Setting'][_0xf862('0x3b')],function(_0x89c571){return{'name':_0x89c571[_0xf862('0x3c')],'type':_0x89c571['type']['key']};});_0x5bd98d[_0xf862('0x3d')]=_[_0xf862('0x3e')](_0x1e5f1a,'name');_0x5bd98d[_0xf862('0x3f')]=_[_0xf862('0x40')](_0x59278a[_0xf862('0x3f')]);_0x5bd98d[_0xf862('0x41')]=_[_0xf862('0x42')](_0x5bd98d[_0xf862('0x3d')],_0x5bd98d[_0xf862('0x3f')]);_0x3ff314[_0xf862('0x43')]=_[_0xf862('0x42')](_0x5bd98d[_0xf862('0x3d')],qs[_0xf862('0x44')](_0x59278a[_0xf862('0x3f')][_0xf862('0x44')]));_0x3ff314[_0xf862('0x43')]=_0x3ff314[_0xf862('0x43')][_0xf862('0x45')]?_0x3ff314[_0xf862('0x43')]:_0x5bd98d[_0xf862('0x3d')];if(!_0x59278a['query']['hasOwnProperty']('nolimit')){_0x3ff314[_0xf862('0x2b')]=qs['limit'](_0x59278a[_0xf862('0x3f')]['limit']);_0x3ff314[_0xf862('0x2d')]=qs[_0xf862('0x2d')](_0x59278a[_0xf862('0x3f')][_0xf862('0x2d')]);}_0x3ff314['order']=qs['sort'](_0x59278a[_0xf862('0x3f')][_0xf862('0x46')]);_0x3ff314[_0xf862('0x47')]=qs[_0xf862('0x41')](_['pick'](_0x59278a[_0xf862('0x3f')],_0x5bd98d['filters']),_0x1e5f1a);if(_0x59278a['query'][_0xf862('0x48')]){_0x3ff314['where']=_[_0xf862('0x49')](_0x3ff314['where'],{'$or':_[_0xf862('0x3e')](_0x1e5f1a,function(_0x499d93){if(_0x499d93[_0xf862('0x4a')]!==_0xf862('0x4b')){var _0x1b14fc={};_0x1b14fc[_0x499d93[_0xf862('0x38')]]={'$like':'%'+_0x59278a['query'][_0xf862('0x48')]+'%'};return _0x1b14fc;}})});}_0x3ff314=_[_0xf862('0x49')]({},_0x3ff314,_0x59278a['options']);var _0x2cba51={'where':_0x3ff314[_0xf862('0x47')]};return db['Setting']['count'](_0x2cba51)[_0xf862('0x35')](function(_0x54be21){_0x5ffb0f['count']=_0x54be21;if(_0x59278a[_0xf862('0x3f')]['includeAll']){_0x3ff314[_0xf862('0x4c')]=[{'all':!![]}];}return db['Setting'][_0xf862('0x4d')](_0x3ff314);})[_0xf862('0x35')](function(_0x4bccf0){_0x5ffb0f[_0xf862('0x4e')]=_0x4bccf0;return _0x5ffb0f;})['then'](respondWithFilteredResult(_0x52263e,_0x3ff314))[_0xf862('0x26')](handleError(_0x52263e,null));};exports[_0xf862('0x4f')]=function(_0x46c0f2,_0xe395d6){var _0x18d322={'raw':![],'where':{'id':_0x46c0f2[_0xf862('0x50')]['id']}},_0x36a544={};_0x36a544[_0xf862('0x3d')]=_['keys'](db['Setting'][_0xf862('0x3b')]);_0x36a544[_0xf862('0x3f')]=_[_0xf862('0x40')](_0x46c0f2[_0xf862('0x3f')]);_0x36a544['filters']=_[_0xf862('0x42')](_0x36a544[_0xf862('0x3d')],_0x36a544[_0xf862('0x3f')]);_0x18d322[_0xf862('0x43')]=_[_0xf862('0x42')](_0x36a544[_0xf862('0x3d')],qs[_0xf862('0x44')](_0x46c0f2['query'][_0xf862('0x44')]));_0x18d322['attributes']=_0x18d322['attributes'][_0xf862('0x45')]?_0x18d322[_0xf862('0x43')]:_0x36a544['model'];if(_0x46c0f2[_0xf862('0x3f')][_0xf862('0x51')]){_0x18d322[_0xf862('0x4c')]=[{'all':!![]}];}_0x18d322=_[_0xf862('0x49')]({},_0x18d322,_0x46c0f2['options']);return db[_0xf862('0x52')][_0xf862('0x53')](_0x18d322)[_0xf862('0x35')](handleEntityNotFound(_0xe395d6,null))['then'](respondWithResult(_0xe395d6,null))[_0xf862('0x26')](handleError(_0xe395d6,null));};exports[_0xf862('0x33')]=function(_0x45782d,_0x305cee){if(_0x45782d[_0xf862('0x54')]['id']){delete _0x45782d[_0xf862('0x54')]['id'];}return db['Setting'][_0xf862('0x53')]({'where':{'id':_0x45782d[_0xf862('0x50')]['id']}})['then'](handleEntityNotFound(_0x305cee,null))['then'](saveUpdates(_0x45782d[_0xf862('0x54')],null))['then'](respondWithResult(_0x305cee,null))[_0xf862('0x26')](handleError(_0x305cee,null));};exports['addLogo']=function(_0x5238e4,_0x35c1c0,_0x3639bd){if(_0x5238e4['file']&&_0x5238e4[_0xf862('0x55')][_0xf862('0x56')]){_0x5238e4[_0xf862('0x54')][_0xf862('0x57')]=_0x5238e4[_0xf862('0x55')][_0xf862('0x56')];}return db[_0xf862('0x52')][_0xf862('0x53')]({'where':{'id':_0x5238e4[_0xf862('0x50')]['id']}})['then'](handleEntityNotFound(_0x35c1c0,null))[_0xf862('0x35')](saveUpdates(_0x5238e4[_0xf862('0x54')],null))[_0xf862('0x35')](respondWithResult(_0x35c1c0,null))[_0xf862('0x26')](handleError(_0x35c1c0,null));};exports[_0xf862('0x58')]=function(_0x5c5d13,_0x575e00,_0x11c927){if(_0x5c5d13[_0xf862('0x55')]&&_0x5c5d13[_0xf862('0x55')][_0xf862('0x56')]){_0x5c5d13[_0xf862('0x54')][_0xf862('0x59')]=_0x5c5d13[_0xf862('0x55')][_0xf862('0x56')];}return db['Setting'][_0xf862('0x53')]({'where':{'id':_0x5c5d13[_0xf862('0x50')]['id']}})[_0xf862('0x35')](handleEntityNotFound(_0x575e00,null))[_0xf862('0x35')](saveUpdates(_0x5c5d13[_0xf862('0x54')],null))[_0xf862('0x35')](respondWithResult(_0x575e00,null))['catch'](handleError(_0x575e00,null));};var utilLicense=require(_0xf862('0x17'));exports[_0xf862('0x5a')]=function(_0x49bc1e,_0x5c8cf8,_0x54d59c){var _0x13feb6='server/files/images/logos';var _0x25d730={'custom':![]};return utilLicense[_0xf862('0x5b')]()[_0xf862('0x35')](function(_0x432f78){if(_0x432f78){_0x25d730=_0x432f78;}return db[_0xf862('0x52')][_0xf862('0x53')]({'where':{'id':_0x49bc1e[_0xf862('0x50')]['id']},'attributes':['logo',_0xf862('0x59'),_0xf862('0x5c'),'favicon','defaultLogo',_0xf862('0x5d'),_0xf862('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xf862('0x35')](handleEntityNotFound(_0x5c8cf8,null))[_0xf862('0x35')](function(_0x4853cd){if(_0x4853cd){var _0x47534e=_0x4853cd[_0xf862('0x57')]&&fs['existsSync'](path['join'](config[_0xf862('0x5f')],_0x13feb6,_[_0xf862('0x60')](_0x4853cd[_0xf862('0x57')])))?path[_0xf862('0x61')](config['root'],_0x13feb6,_[_0xf862('0x60')](_0x4853cd[_0xf862('0x57')])):path[_0xf862('0x61')](config['root'],_0x13feb6,_['toLower'](_0xf862('0x62')));var _0x5470d3=_0xf862('0x63')+_[_0xf862('0x64')](_0xf862('0x57'));if(_0x4853cd[_0x5470d3]||!_0x25d730['custom']){_0x47534e=path[_0xf862('0x61')](config['root'],_0x13feb6,_['toLower'](_0xf862('0x62')));}if(!fs[_0xf862('0x65')](_0x47534e)){throw new db[(_0xf862('0x66'))][(_0xf862('0x67'))](_['upperFirst'](_0xf862('0x57'))+_0xf862('0x68'));}return _0x5c8cf8[_0xf862('0x69')](_0x47534e);}})[_0xf862('0x26')](handleError(_0x5c8cf8,null));};var utilLicense=require(_0xf862('0x17'));exports['getLogoLogin']=function(_0x223b40,_0x1ff407,_0x1caf6e){var _0x17761a=_0xf862('0x6a');var _0x1fd540={'custom':![]};return utilLicense[_0xf862('0x5b')]()[_0xf862('0x35')](function(_0xac2b8f){if(_0xac2b8f){_0x1fd540=_0xac2b8f;}return db[_0xf862('0x52')]['find']({'where':{'id':_0x223b40[_0xf862('0x50')]['id']},'attributes':[_0xf862('0x57'),_0xf862('0x59'),_0xf862('0x5c'),_0xf862('0x6b'),_0xf862('0x6c'),_0xf862('0x5d'),_0xf862('0x5e'),_0xf862('0x6d')],'raw':!![]});})[_0xf862('0x35')](handleEntityNotFound(_0x1ff407,null))['then'](function(_0x45ec49){if(_0x45ec49){var _0x338729=_0x45ec49[_0xf862('0x59')]&&fs[_0xf862('0x65')](path[_0xf862('0x61')](config[_0xf862('0x5f')],_0x17761a,_[_0xf862('0x60')](_0x45ec49[_0xf862('0x59')])))?path['join'](config[_0xf862('0x5f')],_0x17761a,_[_0xf862('0x60')](_0x45ec49[_0xf862('0x59')])):path[_0xf862('0x61')](config[_0xf862('0x5f')],_0x17761a,_[_0xf862('0x60')](_0xf862('0x6e')));var _0x1b8c05=_0xf862('0x63')+_[_0xf862('0x64')]('loginLogo');if(_0x45ec49[_0x1b8c05]||!_0x1fd540[_0xf862('0x6f')]){_0x338729=path[_0xf862('0x61')](config['root'],_0x17761a,_[_0xf862('0x60')](_0xf862('0x6e')));}if(!fs['existsSync'](_0x338729)){throw new db['Sequelize'][(_0xf862('0x67'))](_['upperFirst']('loginLogo')+_0xf862('0x68'));}return _0x1ff407[_0xf862('0x69')](_0x338729);}})['catch'](handleError(_0x1ff407,null));};exports[_0xf862('0x70')]=function(_0x24fd84,_0xf8e1d5){return db[_0xf862('0x52')][_0xf862('0x53')]({'where':{'id':_0x24fd84[_0xf862('0x50')]['id']},'attributes':[_0xf862('0x71')]})[_0xf862('0x35')](respondWithResult(_0xf8e1d5,null))['catch'](handleError(_0xf8e1d5,null));};exports[_0xf862('0x72')]=function(_0x3ca7c4,_0x55f806,_0x15ebd1){if(_0x3ca7c4['file']&&_0x3ca7c4['file']['filename']){_0x3ca7c4[_0xf862('0x54')]['preferred']=_0x3ca7c4['file']['filename'];}return db['Setting'][_0xf862('0x53')]({'where':{'id':_0x3ca7c4['params']['id']}})['then'](handleEntityNotFound(_0x55f806,null))[_0xf862('0x35')](saveUpdates(_0x3ca7c4['body'],null))[_0xf862('0x35')](respondWithResult(_0x55f806,null))[_0xf862('0x26')](handleError(_0x55f806,null));};var utilLicense=require(_0xf862('0x17'));exports['getPreferred']=function(_0x478f7a,_0xf3aa22,_0x514f22){var _0x5b04f2=_0xf862('0x6a');var _0x5bb5e2={'custom':![]};return utilLicense[_0xf862('0x5b')]()[_0xf862('0x35')](function(_0x9ddd33){if(_0x9ddd33){_0x5bb5e2=_0x9ddd33;}return db[_0xf862('0x52')][_0xf862('0x53')]({'where':{'id':_0x478f7a['params']['id']},'attributes':[_0xf862('0x57'),_0xf862('0x59'),_0xf862('0x5c'),'favicon',_0xf862('0x6c'),_0xf862('0x5d'),_0xf862('0x5e'),_0xf862('0x6d')],'raw':!![]});})['then'](handleEntityNotFound(_0xf3aa22,null))[_0xf862('0x35')](function(_0xde27d3){if(_0xde27d3){var _0x59c4ab=_0xde27d3[_0xf862('0x5c')]&&fs[_0xf862('0x65')](path[_0xf862('0x61')](config[_0xf862('0x5f')],_0x5b04f2,_['toLower'](_0xde27d3['preferred'])))?path[_0xf862('0x61')](config[_0xf862('0x5f')],_0x5b04f2,_['toLower'](_0xde27d3[_0xf862('0x5c')])):path[_0xf862('0x61')](config[_0xf862('0x5f')],_0x5b04f2,_[_0xf862('0x60')](_0xf862('0x73')));var _0x464745='default'+_['upperFirst'](_0xf862('0x5c'));if(_0xde27d3[_0x464745]||!_0x5bb5e2['custom']||!_0x5bb5e2[_0xf862('0x5c')]){_0x59c4ab=path[_0xf862('0x61')](config[_0xf862('0x5f')],_0x5b04f2,_[_0xf862('0x60')](_0xf862('0x73')));}if(!fs[_0xf862('0x65')](_0x59c4ab)){throw new db[(_0xf862('0x66'))][(_0xf862('0x67'))](_[_0xf862('0x64')](_0xf862('0x5c'))+'\x20not\x20found');}return _0xf3aa22['download'](_0x59c4ab);}})[_0xf862('0x26')](handleError(_0xf3aa22,null));};exports[_0xf862('0x74')]=function(_0xb1037f,_0x24cac8,_0x2b1ee0){if(_0xb1037f[_0xf862('0x55')]&&_0xb1037f[_0xf862('0x55')][_0xf862('0x56')]){_0xb1037f[_0xf862('0x54')][_0xf862('0x6b')]=_0xb1037f['file'][_0xf862('0x56')];}return db[_0xf862('0x52')][_0xf862('0x53')]({'where':{'id':_0xb1037f[_0xf862('0x50')]['id']}})[_0xf862('0x35')](handleEntityNotFound(_0x24cac8,null))['then'](saveUpdates(_0xb1037f[_0xf862('0x54')],null))['then'](respondWithResult(_0x24cac8,null))[_0xf862('0x26')](handleError(_0x24cac8,null));};var utilLicense=require(_0xf862('0x17'));exports[_0xf862('0x75')]=function(_0x2fe08f,_0x2365f5,_0x453e09){var _0x35294c=_0xf862('0x6a');var _0x5ba94a={'custom':![]};return utilLicense[_0xf862('0x5b')]()['then'](function(_0x4bd347){if(_0x4bd347){_0x5ba94a=_0x4bd347;}return db[_0xf862('0x52')]['find']({'where':{'id':_0x2fe08f['params']['id']},'attributes':['logo','loginLogo',_0xf862('0x5c'),_0xf862('0x6b'),_0xf862('0x6c'),'defaultLoginLogo','defaultPreferred',_0xf862('0x6d')],'raw':!![]});})[_0xf862('0x35')](handleEntityNotFound(_0x2365f5,null))[_0xf862('0x35')](function(_0xfbf9e3){if(_0xfbf9e3){var _0x261d74=_0xfbf9e3[_0xf862('0x6b')]&&fs[_0xf862('0x65')](path[_0xf862('0x61')](config[_0xf862('0x5f')],_0x35294c,_[_0xf862('0x60')](_0xfbf9e3[_0xf862('0x6b')])))?path[_0xf862('0x61')](config['root'],_0x35294c,_['toLower'](_0xfbf9e3[_0xf862('0x6b')])):path[_0xf862('0x61')](config['root'],_0x35294c,_[_0xf862('0x60')](_0xf862('0x76')));var _0x2c18c4=_0xf862('0x63')+_[_0xf862('0x64')](_0xf862('0x6b'));if(_0xfbf9e3[_0x2c18c4]||!_0x5ba94a[_0xf862('0x6f')]){_0x261d74=path[_0xf862('0x61')](config[_0xf862('0x5f')],_0x35294c,_[_0xf862('0x60')](_0xf862('0x76')));}if(!fs['existsSync'](_0x261d74)){throw new db[(_0xf862('0x66'))][(_0xf862('0x67'))](_[_0xf862('0x64')]('favicon')+_0xf862('0x68'));}return _0x2365f5[_0xf862('0x69')](_0x261d74);}})[_0xf862('0x26')](handleError(_0x2365f5,null));};exports[_0xf862('0x77')]=function(_0x135db4,_0x5d3ceb){var _0x443414={'offset':moment()['utcOffset']()};_0x443414['now']=moment()[_0xf862('0x78')](_0x443414[_0xf862('0x2d')])[_0xf862('0x79')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x5d3ceb['status'](0xc8)['send'](_0x443414);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 830c5f8..1c7a434 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x55ca,0x126));var _0xa55c=function(_0x3dbd6d,_0x3ee9d7){_0x3dbd6d=_0x3dbd6d-0x0;var _0x1216f1=_0x55ca[_0x3dbd6d];return _0x1216f1;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3e85a4,_0x18c3a9){var _0x21e7d1=function(_0x48457d){while(--_0x48457d){_0x3e85a4['push'](_0x3e85a4['shift']());}};_0x21e7d1(++_0x18c3a9);}(_0x7217,0x19e));var _0x7721=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7217[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 6ca91cc..bc615f5 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 _0xb39c=['map','model','attributes','then','stringify','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSetting','Setting','find','options','raw','where','include'];(function(_0x256684,_0x529c1e){var _0x37a0c9=function(_0x4b431b){while(--_0x4b431b){_0x256684['push'](_0x256684['shift']());}};_0x37a0c9(++_0x529c1e);}(_0xb39c,0xec));var _0xcb39=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb39c[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xcb39('0x0'));var moment=require('moment');var BPromise=require(_0xcb39('0x1'));var rs=require(_0xcb39('0x2'));var fs=require('fs');var Redis=require(_0xcb39('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb39('0x4'));var logger=require(_0xcb39('0x5'))(_0xcb39('0x6'));var config=require(_0xcb39('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcb39('0x8')][_0xcb39('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x253b0c,_0x1773eb,_0x1f85cb){return new BPromise(function(_0x36cc06,_0x56ef9b){return client[_0xcb39('0xa')](_0x253b0c,_0x1f85cb)['then'](function(_0x3f1a9b){logger[_0xcb39('0xb')](_0xcb39('0xc'),_0x1773eb,_0xcb39('0xd'));logger[_0xcb39('0xe')](_0xcb39('0xf'),_0x1773eb,_0xcb39('0xd'),JSON['stringify'](_0x3f1a9b));if(_0x3f1a9b['error']){if(_0x3f1a9b[_0xcb39('0x10')][_0xcb39('0x11')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x1773eb,_0x3f1a9b[_0xcb39('0x10')][_0xcb39('0x12')]);return _0x56ef9b(_0x3f1a9b[_0xcb39('0x10')][_0xcb39('0x12')]);}logger[_0xcb39('0x10')](_0xcb39('0xc'),_0x1773eb,_0x3f1a9b[_0xcb39('0x10')]['message']);return _0x36cc06(_0x3f1a9b[_0xcb39('0x10')][_0xcb39('0x12')]);}else{logger[_0xcb39('0xb')]('Setting,\x20%s,\x20%s',_0x1773eb,_0xcb39('0xd'));_0x36cc06(_0x3f1a9b[_0xcb39('0x13')]['message']);}})[_0xcb39('0x14')](function(_0x3215c9){logger[_0xcb39('0x10')](_0xcb39('0xc'),_0x1773eb,_0x3215c9);_0x56ef9b(_0x3215c9);});});}exports[_0xcb39('0x15')]=function(_0x28b759){var _0x1e5d0e=this;return new Promise(function(_0x5a4770,_0x4ffaed){return db[_0xcb39('0x16')][_0xcb39('0x17')]({'raw':_0x28b759[_0xcb39('0x18')]?_0x28b759[_0xcb39('0x18')][_0xcb39('0x19')]===undefined?!![]:![]:!![],'where':_0x28b759[_0xcb39('0x18')]?_0x28b759[_0xcb39('0x18')][_0xcb39('0x1a')]||null:null,'attributes':_0x28b759[_0xcb39('0x18')]?_0x28b759[_0xcb39('0x18')]['attributes']||null:null,'include':_0x28b759[_0xcb39('0x18')]?_0x28b759[_0xcb39('0x18')][_0xcb39('0x1b')]?_[_0xcb39('0x1c')](_0x28b759[_0xcb39('0x18')][_0xcb39('0x1b')],function(_0x4fa7b0){return{'model':db[_0x4fa7b0[_0xcb39('0x1d')]],'as':_0x4fa7b0['as'],'attributes':_0x4fa7b0[_0xcb39('0x1e')],'include':_0x4fa7b0[_0xcb39('0x1b')]?_[_0xcb39('0x1c')](_0x4fa7b0[_0xcb39('0x1b')],function(_0x12d6e7){return{'model':db[_0x12d6e7[_0xcb39('0x1d')]],'as':_0x12d6e7['as'],'attributes':_0x12d6e7[_0xcb39('0x1e')],'include':_0x12d6e7[_0xcb39('0x1b')]?_[_0xcb39('0x1c')](_0x12d6e7[_0xcb39('0x1b')],function(_0x3804b5){return{'model':db[_0x3804b5[_0xcb39('0x1d')]],'as':_0x3804b5['as'],'attributes':_0x3804b5[_0xcb39('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcb39('0x1f')](function(_0x59a72a){logger['info']('ShowSetting',_0x28b759);logger[_0xcb39('0xe')](_0xcb39('0x15'),_0x28b759,JSON[_0xcb39('0x20')](_0x59a72a));_0x5a4770(_0x59a72a);})['catch'](function(_0x4d86e5){logger['error']('ShowSetting',_0x4d86e5[_0xcb39('0x12')],_0x28b759);_0x4ffaed(_0x1e5d0e[_0xcb39('0x10')](0x1f4,_0x4d86e5['message']));});});}; \ No newline at end of file +var _0x7566=['../../config/environment','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowSetting','Setting','options','where','attributes','include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7566,0xd0));var _0x6756=function(_0x2a238a,_0x1d5054){_0x2a238a=_0x2a238a-0x0;var _0xeef802=_0x7566[_0x2a238a];return _0xeef802;};'use strict';var _=require(_0x6756('0x0'));var util=require('util');var moment=require(_0x6756('0x1'));var BPromise=require(_0x6756('0x2'));var rs=require(_0x6756('0x3'));var fs=require('fs');var Redis=require(_0x6756('0x4'));var db=require(_0x6756('0x5'))['db'];var utils=require(_0x6756('0x6'));var logger=require(_0x6756('0x7'))(_0x6756('0x8'));var config=require(_0x6756('0x9'));var jayson=require(_0x6756('0xa'));var client=jayson[_0x6756('0xb')][_0x6756('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd4f7b8,_0x2bbfae,_0xd1aba6){return new BPromise(function(_0x5cc042,_0x43f023){return client[_0x6756('0xd')](_0xd4f7b8,_0xd1aba6)['then'](function(_0x2f44d0){logger[_0x6756('0xe')](_0x6756('0xf'),_0x2bbfae,_0x6756('0x10'));logger['debug'](_0x6756('0x11'),_0x2bbfae,_0x6756('0x10'),JSON[_0x6756('0x12')](_0x2f44d0));if(_0x2f44d0[_0x6756('0x13')]){if(_0x2f44d0['error'][_0x6756('0x14')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x2bbfae,_0x2f44d0['error'][_0x6756('0x15')]);return _0x43f023(_0x2f44d0[_0x6756('0x13')][_0x6756('0x15')]);}logger[_0x6756('0x13')](_0x6756('0xf'),_0x2bbfae,_0x2f44d0[_0x6756('0x13')][_0x6756('0x15')]);return _0x5cc042(_0x2f44d0['error'][_0x6756('0x15')]);}else{logger[_0x6756('0xe')](_0x6756('0xf'),_0x2bbfae,_0x6756('0x10'));_0x5cc042(_0x2f44d0['result'][_0x6756('0x15')]);}})['catch'](function(_0x3b1f1b){logger['error'](_0x6756('0xf'),_0x2bbfae,_0x3b1f1b);_0x43f023(_0x3b1f1b);});});}exports[_0x6756('0x16')]=function(_0xd3a3a8){var _0x2dc5d1=this;return new Promise(function(_0x34089c,_0x2e297d){return db[_0x6756('0x17')]['find']({'raw':_0xd3a3a8[_0x6756('0x18')]?_0xd3a3a8[_0x6756('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xd3a3a8[_0x6756('0x18')]?_0xd3a3a8[_0x6756('0x18')][_0x6756('0x19')]||null:null,'attributes':_0xd3a3a8[_0x6756('0x18')]?_0xd3a3a8['options'][_0x6756('0x1a')]||null:null,'include':_0xd3a3a8[_0x6756('0x18')]?_0xd3a3a8['options'][_0x6756('0x1b')]?_[_0x6756('0x1c')](_0xd3a3a8[_0x6756('0x18')][_0x6756('0x1b')],function(_0x4b4a47){return{'model':db[_0x4b4a47[_0x6756('0x1d')]],'as':_0x4b4a47['as'],'attributes':_0x4b4a47['attributes'],'include':_0x4b4a47['include']?_[_0x6756('0x1c')](_0x4b4a47['include'],function(_0x416401){return{'model':db[_0x416401[_0x6756('0x1d')]],'as':_0x416401['as'],'attributes':_0x416401['attributes'],'include':_0x416401[_0x6756('0x1b')]?_[_0x6756('0x1c')](_0x416401[_0x6756('0x1b')],function(_0x26835e){return{'model':db[_0x26835e[_0x6756('0x1d')]],'as':_0x26835e['as'],'attributes':_0x26835e[_0x6756('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6756('0x1e')](function(_0x7b8351){logger[_0x6756('0xe')](_0x6756('0x16'),_0xd3a3a8);logger['debug']('ShowSetting',_0xd3a3a8,JSON[_0x6756('0x12')](_0x7b8351));_0x34089c(_0x7b8351);})['catch'](function(_0x11d3c4){logger[_0x6756('0x13')]('ShowSetting',_0x11d3c4[_0x6756('0x15')],_0xd3a3a8);_0x2e297d(_0x2dc5d1[_0x6756('0x13')](0x1f4,_0x11d3c4['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 9a7a298..55d057e 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 _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0xccc236,_0x3b75d7){var _0x45767f=function(_0x4d000e){while(--_0x4d000e){_0xccc236['push'](_0xccc236['shift']());}};_0x45767f(++_0x3b75d7);}(_0x6aa7,0x178));var _0x76aa=function(_0x3077dc,_0x17cc4d){_0x3077dc=_0x3077dc-0x0;var _0x4afba7=_0x6aa7[_0x3077dc];return _0x4afba7;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('0x27')]=router; \ No newline at end of file +var _0x814b=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/send','status','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated'];(function(_0x90dfad,_0x4d127a){var _0x8cdcc7=function(_0x34b6e1){while(--_0x34b6e1){_0x90dfad['push'](_0x90dfad['shift']());}};_0x8cdcc7(++_0x4d127a);}(_0x814b,0x1a2));var _0xb814=function(_0x4df69e,_0x5131d5){_0x4df69e=_0x4df69e-0x0;var _0x1f9041=_0x814b[_0x4df69e];return _0x1f9041;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0xa')](_0xb814('0x16'),auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0xa')](_0xb814('0x18'),controller[_0xb814('0x19')]);router[_0xb814('0xa')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router[_0xb814('0x1c')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x1e')]);router['post'](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x1f')]);router[_0xb814('0x1c')]('/:id/notify',controller['notify']);router['post'](_0xb814('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0xb814('0x1c')](_0xb814('0x20'),auth[_0xb814('0xb')](),controller['send']);router[_0xb814('0x1c')]('/:id/status',controller[_0xb814('0x21')]);router[_0xb814('0x1c')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x22')]);router[_0xb814('0x23')](_0xb814('0xe'),auth['isAuthenticated'](),controller[_0xb814('0x24')]);router['delete'](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x25')]);router[_0xb814('0x26')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x27')]);router['delete'](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x28')]);router[_0xb814('0x26')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x29')]);module[_0xb814('0x2a')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 08c39b6..52265f2 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 _0xfb2f=['connectel','clicksend','plivo','clickatell','bandwidth','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','twilio','skebby'];(function(_0x78373d,_0x2507db){var _0x5f3a5d=function(_0x373255){while(--_0x373255){_0x78373d['push'](_0x78373d['shift']());}};_0x5f3a5d(++_0x2507db);}(_0xfb2f,0x13d));var _0xffb2=function(_0x5880a5,_0x4a52d6){_0x5880a5=_0x5880a5-0x0;var _0xa2818d=_0xfb2f[_0x5880a5];return _0xa2818d;};'use strict';var Sequelize=require(_0xffb2('0x0'));var rs=require('randomstring');module[_0xffb2('0x1')]={'name':{'type':Sequelize[_0xffb2('0x2')],'unique':_0xffb2('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xffb2('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xffb2('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xffb2('0x2')]},'type':{'type':Sequelize[_0xffb2('0x4')](_0xffb2('0x5'),_0xffb2('0x6'),_0xffb2('0x7'),_0xffb2('0x8'),_0xffb2('0x9'),_0xffb2('0xa'),_0xffb2('0xb'),'csc','infobip','intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xffb2('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xffb2('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xffb2('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xffb2('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xffb2('0x2')]},'senderString':{'type':Sequelize[_0xffb2('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xffb2('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xffb2('0xc');}},'notificationSound':{'type':Sequelize[_0xffb2('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xffb2('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xffb2('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xffb2('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xffb2('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xffb2('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xffb2('0xe')],'comment':_0xffb2('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x32ef5f){if(!_0x32ef5f)this[_0xffb2('0x10')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xffb2('0x11'),_0x32ef5f);}}}; \ No newline at end of file +var _0x96f2=['mandatoryDisposition','sequelize','randomstring','exports','name','STRING','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','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'];(function(_0x173fef,_0xc5680e){var _0x43b4a4=function(_0x316f64){while(--_0x316f64){_0x173fef['push'](_0x173fef['shift']());}};_0x43b4a4(++_0xc5680e);}(_0x96f2,0x1b6));var _0x296f=function(_0x485fd4,_0x5821cc){_0x485fd4=_0x485fd4-0x0;var _0x257a58=_0x96f2[_0x485fd4];return _0x257a58;};'use strict';var Sequelize=require(_0x296f('0x0'));var rs=require(_0x296f('0x1'));module[_0x296f('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x296f('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x296f('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x296f('0x4')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x296f('0x5')](_0x296f('0x6'),_0x296f('0x7'),_0x296f('0x8'),_0x296f('0x9'),_0x296f('0xa'),_0x296f('0xb'),'bandwidth',_0x296f('0xc'),_0x296f('0xd'),_0x296f('0xe'))},'accountSid':{'type':Sequelize[_0x296f('0x4')]},'authId':{'type':Sequelize[_0x296f('0x4')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x296f('0x4')]},'password':{'type':Sequelize[_0x296f('0x4')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x296f('0x4')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x296f('0x4')]},'notificationTemplate':{'type':Sequelize[_0x296f('0xf')],'defaultValue':function(){return _0x296f('0x10');}},'notificationSound':{'type':Sequelize[_0x296f('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x296f('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x296f('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x296f('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x296f('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x296f('0x12')],'comment':_0x296f('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x296f('0x11')],'defaultValue':![],'comment':_0x296f('0x14'),'set':function(_0x37155c){if(!_0x37155c)this[_0x296f('0x15')]('mandatoryDispositionPauseId',null);this[_0x296f('0x15')](_0x296f('0x16'),_0x37155c);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 3ca9cca..40d2e14 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 _0xf42c=['CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','twilio','From','Body','messageId','MessageSid','skebby','from','sender','text','connectel','clicksend','message_id','plivo','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','Sequelize','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','omit','contact','SmsInteraction','spread','interaction','created','autoclose','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','Content-Type','addApplications','sequelize','transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','send','getApplications','Contact','User','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','clickatell','redif','infobip','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','./smsAccount.socket','register','client','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','get','SmsAccounts','destroy','stack','name','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','findAll','rows','show','params','fields','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','update','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','order','pick','SmsAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','SmsApplication','account','applications','orderBy','Applications','asc'];(function(_0x3bbb16,_0x238a54){var _0x134e7a=function(_0x447fba){while(--_0x447fba){_0x3bbb16['push'](_0x3bbb16['shift']());}};_0x134e7a(++_0x238a54);}(_0xf42c,0x6a));var _0xcf42=function(_0x29b564,_0x2d95bd){_0x29b564=_0x29b564-0x0;var _0xae0676=_0xf42c[_0x29b564];return _0xae0676;};'use strict';var emlformat=require(_0xcf42('0x0'));var rimraf=require(_0xcf42('0x1'));var zipdir=require(_0xcf42('0x2'));var jsonpatch=require(_0xcf42('0x3'));var rp=require(_0xcf42('0x4'));var moment=require('moment');var BPromise=require(_0xcf42('0x5'));var Mustache=require(_0xcf42('0x6'));var util=require(_0xcf42('0x7'));var path=require(_0xcf42('0x8'));var sox=require('sox');var csv=require(_0xcf42('0x9'));var ejs=require(_0xcf42('0xa'));var fs=require('fs');var fs_extra=require(_0xcf42('0xb'));var _=require(_0xcf42('0xc'));var squel=require(_0xcf42('0xd'));var crypto=require(_0xcf42('0xe'));var jsforce=require(_0xcf42('0xf'));var deskjs=require(_0xcf42('0x10'));var toCsv=require(_0xcf42('0x9'));var querystring=require(_0xcf42('0x11'));var Papa=require(_0xcf42('0x12'));var Redis=require(_0xcf42('0x13'));var authService=require(_0xcf42('0x14'));var qs=require(_0xcf42('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf42('0x16'))(_0xcf42('0x17'));var utils=require(_0xcf42('0x18'));var config=require(_0xcf42('0x19'));var licenseUtil=require(_0xcf42('0x1a'));var db=require(_0xcf42('0x1b'))['db'];config['redis']=_[_0xcf42('0x1c')](config['redis'],{'host':_0xcf42('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcf42('0x1e'))[_0xcf42('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0xcf42('0x20')]['http']({'port':0x232c});function respondWithRpcPromise(_0x54e2f3,_0x300d0d,_0x20367f,_0x365b5e){return new BPromise(function(_0x15f88f,_0xb12fd){var _0x4b9714=_0x365b5e||client;return _0x4b9714[_0xcf42('0x21')](_0x54e2f3,_0x20367f)['then'](function(_0x491bd7){logger[_0xcf42('0x22')](_0xcf42('0x23'),_0x300d0d,_0xcf42('0x24'));logger[_0xcf42('0x25')](_0xcf42('0x26'),_0x300d0d,_0xcf42('0x24'),JSON[_0xcf42('0x27')](_0x491bd7));if(_0x491bd7[_0xcf42('0x28')]){if(_0x491bd7[_0xcf42('0x28')][_0xcf42('0x29')]===0x1f4){logger[_0xcf42('0x28')](_0xcf42('0x23'),_0x300d0d,_0x491bd7[_0xcf42('0x28')]['message']);return _0xb12fd(_0x491bd7['error'][_0xcf42('0x2a')]);}logger[_0xcf42('0x28')]('SmsAccount,\x20%s,\x20%s',_0x300d0d,_0x491bd7['error'][_0xcf42('0x2a')]);return _0x15f88f(_0x491bd7['error'][_0xcf42('0x2a')]);}else{logger[_0xcf42('0x22')]('SmsAccount,\x20%s,\x20%s',_0x300d0d,_0xcf42('0x24'));_0x15f88f(_0x491bd7['result']['message']);}})[_0xcf42('0x2b')](function(_0x3788cb){logger[_0xcf42('0x28')](_0xcf42('0x23'),_0x300d0d,_0x3788cb);_0xb12fd(_0x3788cb);});});}function respondWithStatusCode(_0x4e9771,_0x3d4f0c){_0x3d4f0c=_0x3d4f0c||0xcc;return function(_0x1ddb6c){if(_0x1ddb6c){return _0x4e9771['sendStatus'](_0x3d4f0c);}return _0x4e9771[_0xcf42('0x2c')](_0x3d4f0c)[_0xcf42('0x2d')]();};}function respondWithResult(_0x2f7aad,_0x5ad0fc){_0x5ad0fc=_0x5ad0fc||0xc8;return function(_0x2d51a0){if(_0x2d51a0){return _0x2f7aad[_0xcf42('0x2c')](_0x5ad0fc)[_0xcf42('0x2e')](_0x2d51a0);}};}function respondWithFilteredResult(_0xaa22ed,_0x3d122b){return function(_0x28822a){if(_0x28822a){var _0x28ea1e=typeof _0x3d122b[_0xcf42('0x2f')]===_0xcf42('0x30')&&typeof _0x3d122b[_0xcf42('0x31')]===_0xcf42('0x30');var _0x437d74=_0x28822a['count'];var _0x48a13a=_0x28ea1e?0x0:_0x3d122b[_0xcf42('0x2f')];var _0x188c8c=_0x28ea1e?_0x28822a[_0xcf42('0x32')]:_0x3d122b['offset']+_0x3d122b[_0xcf42('0x31')];var _0x374c24;if(_0x188c8c>=_0x437d74){_0x188c8c=_0x437d74;_0x374c24=0xc8;}else{_0x374c24=0xce;}_0xaa22ed[_0xcf42('0x2c')](_0x374c24);return _0xaa22ed[_0xcf42('0x33')](_0xcf42('0x34'),_0x48a13a+'-'+_0x188c8c+'/'+_0x437d74)[_0xcf42('0x2e')](_0x28822a);}return null;};}function patchUpdates(_0x1bb1a0){return function(_0x12a3bb){try{jsonpatch['apply'](_0x12a3bb,_0x1bb1a0,!![]);}catch(_0x29e2c5){return BPromise[_0xcf42('0x35')](_0x29e2c5);}return _0x12a3bb[_0xcf42('0x36')]();};}function saveUpdates(_0x19d5b5,_0x553f55){return function(_0x479abb){if(_0x479abb){return _0x479abb['update'](_0x19d5b5)[_0xcf42('0x37')](function(_0x54a3c6){return _0x54a3c6;});}return null;};}function removeEntity(_0x340241,_0x3b4e01){return function(_0x270ea5){if(_0x270ea5){return _0x270ea5['destroy']()['then'](function(){var _0xe5400b=_0x270ea5[_0xcf42('0x38')]({'plain':!![]});var _0x35311b=_0xcf42('0x39');return db['UserProfileResource'][_0xcf42('0x3a')]({'where':{'type':_0x35311b,'resourceId':_0xe5400b['id']}})[_0xcf42('0x37')](function(){return _0x270ea5;});})[_0xcf42('0x37')](function(){_0x340241[_0xcf42('0x2c')](0xcc)[_0xcf42('0x2d')]();});}};}function handleEntityNotFound(_0x25cc69,_0x36c85e){return function(_0x282eb2){if(!_0x282eb2){_0x25cc69['sendStatus'](0x194);}return _0x282eb2;};}function handleError(_0x4f3c1d,_0x51f9cd){_0x51f9cd=_0x51f9cd||0x1f4;return function(_0x43f2f7){logger['error'](_0x43f2f7[_0xcf42('0x3b')]);if(_0x43f2f7['name']){delete _0x43f2f7[_0xcf42('0x3c')];}_0x4f3c1d['status'](_0x51f9cd)['send'](_0x43f2f7);};}exports['index']=function(_0x5ed910,_0x2a20c2){var _0x33d248={'include':[{'model':db[_0xcf42('0x3d')],'as':_0xcf42('0x3e')}]},_0x104a04={},_0x2c0b97={'count':0x0,'rows':[]};var _0x3592ba=_[_0xcf42('0x3f')](db[_0xcf42('0x40')][_0xcf42('0x41')],function(_0x24f4cc){return{'name':_0x24f4cc[_0xcf42('0x42')],'type':_0x24f4cc[_0xcf42('0x43')]['key']};});_0x104a04[_0xcf42('0x44')]=_[_0xcf42('0x3f')](_0x3592ba,_0xcf42('0x3c'));_0x104a04[_0xcf42('0x45')]=_[_0xcf42('0x46')](_0x5ed910[_0xcf42('0x45')]);_0x104a04[_0xcf42('0x47')]=_[_0xcf42('0x48')](_0x104a04[_0xcf42('0x44')],_0x104a04[_0xcf42('0x45')]);_0x33d248[_0xcf42('0x49')]=_[_0xcf42('0x48')](_0x104a04[_0xcf42('0x44')],qs['fields'](_0x5ed910[_0xcf42('0x45')]['fields']));_0x33d248['attributes']=_0x33d248[_0xcf42('0x49')][_0xcf42('0x4a')]?_0x33d248[_0xcf42('0x49')]:_0x104a04[_0xcf42('0x44')];if(!_0x5ed910[_0xcf42('0x45')][_0xcf42('0x4b')]('nolimit')){_0x33d248[_0xcf42('0x31')]=qs[_0xcf42('0x31')](_0x5ed910[_0xcf42('0x45')][_0xcf42('0x31')]);_0x33d248[_0xcf42('0x2f')]=qs[_0xcf42('0x2f')](_0x5ed910[_0xcf42('0x45')][_0xcf42('0x2f')]);}_0x33d248['order']=qs[_0xcf42('0x4c')](_0x5ed910[_0xcf42('0x45')][_0xcf42('0x4c')]);_0x33d248[_0xcf42('0x4d')]=qs[_0xcf42('0x47')](_['pick'](_0x5ed910[_0xcf42('0x45')],_0x104a04[_0xcf42('0x47')]),_0x3592ba);if(_0x5ed910[_0xcf42('0x45')][_0xcf42('0x4e')]){_0x33d248[_0xcf42('0x4d')]=_[_0xcf42('0x4f')](_0x33d248[_0xcf42('0x4d')],{'$or':_['map'](_0x3592ba,function(_0x39c34c){if(_0x39c34c[_0xcf42('0x43')]!=='VIRTUAL'){var _0x59e9ab={};_0x59e9ab[_0x39c34c['name']]={'$like':'%'+_0x5ed910['query'][_0xcf42('0x4e')]+'%'};return _0x59e9ab;}})});}_0x33d248=_[_0xcf42('0x4f')]({},_0x33d248,_0x5ed910[_0xcf42('0x50')]);var _0x5ace06={'where':_0x33d248[_0xcf42('0x4d')]};return db[_0xcf42('0x40')][_0xcf42('0x32')](_0x5ace06)[_0xcf42('0x37')](function(_0x50ae45){_0x2c0b97[_0xcf42('0x32')]=_0x50ae45;if(_0x5ed910[_0xcf42('0x45')][_0xcf42('0x51')]){_0x33d248['include']=[{'all':!![]}];}return db[_0xcf42('0x40')][_0xcf42('0x52')](_0x33d248);})['then'](function(_0x267226){_0x2c0b97[_0xcf42('0x53')]=_0x267226;return _0x2c0b97;})[_0xcf42('0x37')](respondWithFilteredResult(_0x2a20c2,_0x33d248))[_0xcf42('0x2b')](handleError(_0x2a20c2,null));};exports[_0xcf42('0x54')]=function(_0x437a46,_0x597bb9){var _0x16de6c={'raw':![],'where':{'id':_0x437a46[_0xcf42('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xcf42('0x3e')}]},_0x1d4269={};_0x1d4269[_0xcf42('0x44')]=_[_0xcf42('0x46')](db[_0xcf42('0x40')][_0xcf42('0x41')]);_0x1d4269[_0xcf42('0x45')]=_[_0xcf42('0x46')](_0x437a46[_0xcf42('0x45')]);_0x1d4269[_0xcf42('0x47')]=_[_0xcf42('0x48')](_0x1d4269[_0xcf42('0x44')],_0x1d4269[_0xcf42('0x45')]);_0x16de6c[_0xcf42('0x49')]=_[_0xcf42('0x48')](_0x1d4269[_0xcf42('0x44')],qs[_0xcf42('0x56')](_0x437a46[_0xcf42('0x45')][_0xcf42('0x56')]));_0x16de6c['attributes']=_0x16de6c[_0xcf42('0x49')]['length']?_0x16de6c[_0xcf42('0x49')]:_0x1d4269[_0xcf42('0x44')];if(_0x437a46[_0xcf42('0x45')][_0xcf42('0x51')]){_0x16de6c[_0xcf42('0x57')]=[{'all':!![]}];}_0x16de6c=_[_0xcf42('0x4f')]({},_0x16de6c,_0x437a46['options']);return db['SmsAccount'][_0xcf42('0x58')](_0x16de6c)[_0xcf42('0x37')](handleEntityNotFound(_0x597bb9,null))[_0xcf42('0x37')](respondWithResult(_0x597bb9,null))['catch'](handleError(_0x597bb9,null));};exports[_0xcf42('0x59')]=function(_0x8b98ce,_0x28e2dc){return db['SmsAccount'][_0xcf42('0x59')](_0x8b98ce[_0xcf42('0x5a')],{})[_0xcf42('0x37')](function(_0x41ff12){var _0x3b038e=_0x8b98ce['user'][_0xcf42('0x38')]({'plain':!![]});if(!_0x3b038e)throw new Error(_0xcf42('0x5b'));if(_0x3b038e[_0xcf42('0x5c')]===_0xcf42('0x5d')){var _0x30f8c4=_0x41ff12[_0xcf42('0x38')]({'plain':!![]});var _0x49136a='SmsAccounts';return db[_0xcf42('0x5e')][_0xcf42('0x58')]({'where':{'name':_0x49136a,'userProfileId':_0x3b038e['userProfileId']},'raw':!![]})['then'](function(_0x115cde){if(_0x115cde&&_0x115cde[_0xcf42('0x5f')]===0x0){return db[_0xcf42('0x60')][_0xcf42('0x59')]({'name':_0x30f8c4[_0xcf42('0x3c')],'resourceId':_0x30f8c4['id'],'type':_0x115cde[_0xcf42('0x3c')],'sectionId':_0x115cde['id']},{})[_0xcf42('0x37')](function(){return _0x41ff12;});}else{return _0x41ff12;}})[_0xcf42('0x2b')](function(_0x2a78fa){logger[_0xcf42('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a78fa);throw _0x2a78fa;});}return _0x41ff12;})[_0xcf42('0x37')](respondWithResult(_0x28e2dc,0xc9))[_0xcf42('0x2b')](handleError(_0x28e2dc,null));};exports[_0xcf42('0x61')]=function(_0x14b9c4,_0x204a6e){if(_0x14b9c4[_0xcf42('0x5a')]['id']){delete _0x14b9c4[_0xcf42('0x5a')]['id'];}return db[_0xcf42('0x40')][_0xcf42('0x58')]({'where':{'id':_0x14b9c4[_0xcf42('0x55')]['id']},'include':[{'model':db[_0xcf42('0x3d')],'as':_0xcf42('0x3e')}]})[_0xcf42('0x37')](handleEntityNotFound(_0x204a6e,null))[_0xcf42('0x37')](saveUpdates(_0x14b9c4[_0xcf42('0x5a')],null))[_0xcf42('0x37')](respondWithResult(_0x204a6e,null))['catch'](handleError(_0x204a6e,null));};exports[_0xcf42('0x3a')]=function(_0x176255,_0x24ddc2){return db[_0xcf42('0x40')]['find']({'where':{'id':_0x176255[_0xcf42('0x55')]['id']}})['then'](handleEntityNotFound(_0x24ddc2,null))[_0xcf42('0x37')](removeEntity(_0x24ddc2,null))[_0xcf42('0x2b')](handleError(_0x24ddc2,null));};exports[_0xcf42('0x62')]=function(_0x4ee85e,_0x493a62){return db[_0xcf42('0x40')]['describe']()['then'](respondWithResult(_0x493a62,null))[_0xcf42('0x2b')](handleError(_0x493a62,null));};exports[_0xcf42('0x63')]=function(_0x355b9e,_0x22cd7f,_0x216808){if(_0x355b9e['body']['id']){delete _0x355b9e[_0xcf42('0x5a')]['id'];}return db[_0xcf42('0x40')][_0xcf42('0x58')]({'where':{'id':_0x355b9e['params']['id']}})[_0xcf42('0x37')](handleEntityNotFound(_0x22cd7f,null))['then'](function(_0x2e6cfb){if(_0x2e6cfb){_0x355b9e[_0xcf42('0x5a')]['SmsAccountId']=_0x2e6cfb['id'];return db[_0xcf42('0x64')][_0xcf42('0x59')](_0x355b9e['body']);}})[_0xcf42('0x37')](respondWithResult(_0x22cd7f,null))['catch'](handleError(_0x22cd7f,null));};exports[_0xcf42('0x65')]=function(_0x1ba19b,_0x1ac1d0,_0x25be0a){var _0x46d165={'raw':![],'where':{}};var _0x4dcb3d={};var _0x11ad83={'count':0x0,'rows':[]};return db[_0xcf42('0x40')][_0xcf42('0x66')]({'where':{'id':_0x1ba19b[_0xcf42('0x55')]['id']}})[_0xcf42('0x37')](handleEntityNotFound(_0x1ac1d0,null))[_0xcf42('0x37')](function(_0x270dd9){if(_0x270dd9){_0x4dcb3d[_0xcf42('0x44')]=_[_0xcf42('0x46')](db[_0xcf42('0x64')]['rawAttributes']);_0x4dcb3d[_0xcf42('0x45')]=_[_0xcf42('0x46')](_0x1ba19b[_0xcf42('0x45')]);_0x4dcb3d['filters']=_[_0xcf42('0x48')](_0x4dcb3d['model'],_0x4dcb3d[_0xcf42('0x45')]);_0x46d165['attributes']=_[_0xcf42('0x48')](_0x4dcb3d[_0xcf42('0x44')],qs[_0xcf42('0x56')](_0x1ba19b['query'][_0xcf42('0x56')]));_0x46d165['attributes']=_0x46d165[_0xcf42('0x49')][_0xcf42('0x4a')]?_0x46d165[_0xcf42('0x49')]:_0x4dcb3d[_0xcf42('0x44')];if(!_0x1ba19b[_0xcf42('0x45')]['hasOwnProperty'](_0xcf42('0x67'))){_0x46d165[_0xcf42('0x31')]=qs[_0xcf42('0x31')](_0x1ba19b[_0xcf42('0x45')][_0xcf42('0x31')]);_0x46d165[_0xcf42('0x2f')]=qs[_0xcf42('0x2f')](_0x1ba19b[_0xcf42('0x45')][_0xcf42('0x2f')]);}_0x46d165[_0xcf42('0x68')]=qs[_0xcf42('0x4c')](_0x1ba19b[_0xcf42('0x45')]['sort']);_0x46d165[_0xcf42('0x4d')]=qs[_0xcf42('0x47')](_[_0xcf42('0x69')](_0x1ba19b[_0xcf42('0x45')],_0x4dcb3d[_0xcf42('0x47')]));_0x46d165[_0xcf42('0x4d')][_0xcf42('0x6a')]=_0x270dd9['id'];if(_0x1ba19b[_0xcf42('0x45')][_0xcf42('0x4e')]){_0x46d165[_0xcf42('0x4d')]=_[_0xcf42('0x4f')](_0x46d165[_0xcf42('0x4d')],{'$or':_[_0xcf42('0x3f')](_0x46d165[_0xcf42('0x49')],function(_0x4fb6e1){var _0x3471c0={};_0x3471c0[_0x4fb6e1]={'$like':'%'+_0x1ba19b[_0xcf42('0x45')][_0xcf42('0x4e')]+'%'};return _0x3471c0;})});}_0x46d165=_['merge']({},_0x46d165,_0x1ba19b[_0xcf42('0x50')]);return db['Disposition'][_0xcf42('0x32')]({'where':_0x46d165[_0xcf42('0x4d')]})[_0xcf42('0x37')](function(_0x10dfaf){_0x11ad83[_0xcf42('0x32')]=_0x10dfaf;if(_0x1ba19b['query'][_0xcf42('0x51')]){_0x46d165[_0xcf42('0x57')]=[{'all':!![]}];}return db[_0xcf42('0x64')]['findAll'](_0x46d165);})[_0xcf42('0x37')](function(_0x236a80){_0x11ad83[_0xcf42('0x53')]=_0x236a80;return _0x11ad83;});}})['then'](respondWithFilteredResult(_0x1ac1d0,_0x46d165))[_0xcf42('0x2b')](handleError(_0x1ac1d0,null));};exports[_0xcf42('0x6b')]=function(_0x3d65de,_0x239409,_0x40acf6){return db['SmsAccount'][_0xcf42('0x58')]({'where':{'id':_0x3d65de[_0xcf42('0x55')]['id']}})['then'](handleEntityNotFound(_0x239409,null))['then'](function(_0x2622c2){if(_0x2622c2){return _0x2622c2[_0xcf42('0x6b')](_0x3d65de[_0xcf42('0x45')][_0xcf42('0x6c')]);}})['then'](respondWithStatusCode(_0x239409,null))[_0xcf42('0x2b')](handleError(_0x239409,null));};exports[_0xcf42('0x6d')]=function(_0x47ae15,_0x271f5b,_0x3b3aeb){if(_0x47ae15[_0xcf42('0x5a')]['id']){delete _0x47ae15['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x47ae15[_0xcf42('0x55')]['id']}})[_0xcf42('0x37')](handleEntityNotFound(_0x271f5b,null))[_0xcf42('0x37')](function(_0x33bdc5){if(_0x33bdc5){_0x47ae15['body'][_0xcf42('0x6a')]=_0x33bdc5['id'];return db['CannedAnswer'][_0xcf42('0x59')](_0x47ae15[_0xcf42('0x5a')]);}})[_0xcf42('0x37')](respondWithResult(_0x271f5b,null))[_0xcf42('0x2b')](handleError(_0x271f5b,null));};exports[_0xcf42('0x6e')]=function(_0x308acd,_0x520083,_0x3bd2a1){var _0x3e17aa={'raw':![],'where':{}};var _0x37efa3={};var _0x2555ce={'count':0x0,'rows':[]};return db[_0xcf42('0x40')][_0xcf42('0x66')]({'where':{'id':_0x308acd[_0xcf42('0x55')]['id']}})[_0xcf42('0x37')](handleEntityNotFound(_0x520083,null))['then'](function(_0x3404d7){if(_0x3404d7){_0x37efa3[_0xcf42('0x44')]=_[_0xcf42('0x46')](db[_0xcf42('0x6f')][_0xcf42('0x41')]);_0x37efa3[_0xcf42('0x45')]=_[_0xcf42('0x46')](_0x308acd[_0xcf42('0x45')]);_0x37efa3[_0xcf42('0x47')]=_[_0xcf42('0x48')](_0x37efa3[_0xcf42('0x44')],_0x37efa3['query']);_0x3e17aa[_0xcf42('0x49')]=_['intersection'](_0x37efa3[_0xcf42('0x44')],qs[_0xcf42('0x56')](_0x308acd[_0xcf42('0x45')][_0xcf42('0x56')]));_0x3e17aa[_0xcf42('0x49')]=_0x3e17aa[_0xcf42('0x49')]['length']?_0x3e17aa['attributes']:_0x37efa3[_0xcf42('0x44')];if(!_0x308acd[_0xcf42('0x45')][_0xcf42('0x4b')](_0xcf42('0x67'))){_0x3e17aa['limit']=qs[_0xcf42('0x31')](_0x308acd[_0xcf42('0x45')][_0xcf42('0x31')]);_0x3e17aa[_0xcf42('0x2f')]=qs['offset'](_0x308acd[_0xcf42('0x45')][_0xcf42('0x2f')]);}_0x3e17aa[_0xcf42('0x68')]=qs[_0xcf42('0x4c')](_0x308acd[_0xcf42('0x45')][_0xcf42('0x4c')]);_0x3e17aa[_0xcf42('0x4d')]=qs[_0xcf42('0x47')](_[_0xcf42('0x69')](_0x308acd[_0xcf42('0x45')],_0x37efa3['filters']));_0x3e17aa['where'][_0xcf42('0x6a')]=_0x3404d7['id'];if(_0x308acd[_0xcf42('0x45')][_0xcf42('0x4e')]){_0x3e17aa[_0xcf42('0x4d')]=_[_0xcf42('0x4f')](_0x3e17aa[_0xcf42('0x4d')],{'$or':_['map'](_0x3e17aa[_0xcf42('0x49')],function(_0x4dbdc4){var _0x4d4674={};_0x4d4674[_0x4dbdc4]={'$like':'%'+_0x308acd[_0xcf42('0x45')]['filter']+'%'};return _0x4d4674;})});}_0x3e17aa=_[_0xcf42('0x4f')]({},_0x3e17aa,_0x308acd[_0xcf42('0x50')]);return db['CannedAnswer']['count']({'where':_0x3e17aa[_0xcf42('0x4d')]})[_0xcf42('0x37')](function(_0x455c27){_0x2555ce[_0xcf42('0x32')]=_0x455c27;if(_0x308acd[_0xcf42('0x45')][_0xcf42('0x51')]){_0x3e17aa[_0xcf42('0x57')]=[{'all':!![]}];}return db[_0xcf42('0x6f')][_0xcf42('0x52')](_0x3e17aa);})[_0xcf42('0x37')](function(_0x1b827c){_0x2555ce['rows']=_0x1b827c;return _0x2555ce;});}})['then'](respondWithFilteredResult(_0x520083,_0x3e17aa))[_0xcf42('0x2b')](handleError(_0x520083,null));};exports['removeAnswers']=function(_0x825e7a,_0x44086a,_0x53ea6d){return db[_0xcf42('0x40')][_0xcf42('0x58')]({'where':{'id':_0x825e7a[_0xcf42('0x55')]['id']}})['then'](handleEntityNotFound(_0x44086a,null))[_0xcf42('0x37')](function(_0x1ebe37){if(_0x1ebe37){return _0x1ebe37[_0xcf42('0x70')](_0x825e7a[_0xcf42('0x45')][_0xcf42('0x6c')]);}})['then'](respondWithStatusCode(_0x44086a,null))[_0xcf42('0x2b')](handleError(_0x44086a,null));};exports[_0xcf42('0x71')]=function(_0x21cbc3,_0x2472b1,_0x182293){var _0xb9f732={'channel':'sms'};var _0x373576=[];var _0x23ee1c=[];var _0x802bcd={};return db[_0xcf42('0x40')][_0xcf42('0x58')]({'where':{'id':_0x21cbc3[_0xcf42('0x55')]['id']},'include':[{'model':db[_0xcf42('0x72')],'as':'Applications'}]})[_0xcf42('0x37')](handleEntityNotFound(_0x2472b1,null))['then'](function(_0x29bb7d){_0xb9f732[_0xcf42('0x73')]=_0x29bb7d;_0xb9f732[_0xcf42('0x74')]=_[_0xcf42('0x75')](_0x29bb7d[_0xcf42('0x76')],['priority'],[_0xcf42('0x77')]);if(_0xb9f732[_0xcf42('0x73')][_0xcf42('0x76')]){delete _0xb9f732['account'][_0xcf42('0x76')];}return db[_0xcf42('0x78')][_0xcf42('0x62')]();})[_0xcf42('0x37')](function(_0xa37ff4){if(!_0xa37ff4){throw new db['Sequelize'][(_0xcf42('0x79'))](_0xcf42('0x7a'));}_0x373576=_[_0xcf42('0x7b')](_['keys'](_0xa37ff4),['createdAt',_0xcf42('0x7c')]);_0x23ee1c=_['difference'](_['keys'](_0xa37ff4),[_0xcf42('0x7d'),'updatedAt','CompanyId',_0xcf42('0x7e')]);_0xb9f732[_0xcf42('0x5a')]={'mapKey':'mobile'};if(_0xb9f732[_0xcf42('0x73')][_0xcf42('0x43')]){switch(_0xb9f732[_0xcf42('0x73')][_0xcf42('0x43')]){case _0xcf42('0x7f'):_0xb9f732[_0xcf42('0x5a')]['from']=_0x21cbc3['body'][_0xcf42('0x80')];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x5a')]=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x81')];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x82')]=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x83')];break;case _0xcf42('0x84'):_0xb9f732['body'][_0xcf42('0x85')]='+'+_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x86')];_0xb9f732[_0xcf42('0x5a')]['body']=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x87')];break;case _0xcf42('0x88'):_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')]=_0x21cbc3['body'][_0xcf42('0x85')];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x5a')]=_0x21cbc3['body']['message'];break;case _0xcf42('0x89'):_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')]=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x85')];_0xb9f732['body']['body']=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x5a')];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x82')]=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x8a')];break;case _0xcf42('0x8b'):_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')]=_0x21cbc3[_0xcf42('0x5a')]['From'];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x5a')]=_0x21cbc3[_0xcf42('0x5a')]['Text'];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x82')]=_0x21cbc3[_0xcf42('0x5a')]['MessageUUID'];break;case'infobip':_0xb9f732['body'][_0xcf42('0x85')]='+'+_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x8c')][0x0][_0xcf42('0x85')];_0xb9f732['body'][_0xcf42('0x5a')]=_0x21cbc3['body']['results'][0x0][_0xcf42('0x87')];_0xb9f732['body'][_0xcf42('0x82')]=_0x21cbc3['body'][_0xcf42('0x8c')][0x0][_0xcf42('0x82')];break;case _0xcf42('0x8d'):_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')]=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x8e')];_0xb9f732['body'][_0xcf42('0x5a')]=_0x21cbc3['body'][_0xcf42('0x8f')][_0xcf42('0x2a')];break;case'clickatell':_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')]=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x90')];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x5a')]=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x87')];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x82')]=_0x21cbc3['body'][_0xcf42('0x91')];break;case _0xcf42('0x92'):_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x82')]=_0x21cbc3['body'][0x0]['message']['id'];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')]=_0x21cbc3[_0xcf42('0x5a')][0x0][_0xcf42('0x2a')][_0xcf42('0x85')];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x5a')]=_0x21cbc3['body'][0x0][_0xcf42('0x2a')]['text'];break;case _0xcf42('0x93'):_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')]=_0x21cbc3['body'][_0xcf42('0x85')];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x5a')]=_0x21cbc3[_0xcf42('0x5a')][_0xcf42('0x2a')];_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x82')]=_0x21cbc3[_0xcf42('0x5a')]['refid'];break;}}if(_0xb9f732[_0xcf42('0x5a')]['id']){delete _0xb9f732[_0xcf42('0x5a')]['id'];}if(_['isNil'](_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')])){throw new db[(_0xcf42('0x94'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xcf42('0x95')](_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x5a')])||_0xb9f732[_0xcf42('0x5a')]['body']===''){throw new db[(_0xcf42('0x94'))][(_0xcf42('0x79'))](_0xcf42('0x96'));}if(_['isNil'](_0xb9f732['body']['mapKey'])){throw new db[(_0xcf42('0x94'))][(_0xcf42('0x79'))](_0xcf42('0x97')+_0x23ee1c);}if(!_[_0xcf42('0x98')](_0x23ee1c,_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x99')])){throw new db[(_0xcf42('0x94'))]['ValidationError'](_0xcf42('0x9a')+_0x23ee1c);}_0x802bcd[_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x99')]]=_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')];return db[_0xcf42('0x9b')][_0xcf42('0x58')]({'where':{'id':_0xb9f732['account'][_0xcf42('0x7e')]},'include':[{'model':db['CmContact'],'as':_0xcf42('0x9c'),'where':_0x802bcd,'limit':0x1,'order':[[_0xcf42('0x7c'),_0xcf42('0x9d')]]}]});})[_0xcf42('0x37')](handleEntityNotFound(_0x2472b1,null))[_0xcf42('0x37')](function(_0x47c204){if(_0x47c204){_0xb9f732['list']=_[_0xcf42('0x9e')](_0x47c204,['Contacts']);if(_0x47c204[_0xcf42('0x9c')]['length']){return _0x47c204[_0xcf42('0x9c')][0x0];}var _0x59d365=_[_0xcf42('0x1c')](_0xb9f732['body'],{'firstName':_0xb9f732[_0xcf42('0x5a')]['from'],'ListId':_0x47c204['id']});_0x59d365[_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x99')]]=_0xb9f732['body'][_0xcf42('0x85')];return db['CmContact'][_0xcf42('0x59')](_0x59d365,{'fields':_0x373576,'raw':!![]});}})[_0xcf42('0x37')](handleEntityNotFound(_0x2472b1,null))['then'](function(_0x234df0){if(_0x234df0){_0xb9f732[_0xcf42('0x9f')]=_0x234df0;var _0x5104e9={'ContactId':_0x234df0['id'],'phone':_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x85')],'SmsAccountId':_0x21cbc3[_0xcf42('0x55')]['id']};var _0x3f523a={'ContactId':_0x234df0['id'],'SmsAccountId':_0x21cbc3[_0xcf42('0x55')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x3f523a})[_0xcf42('0x37')](function(_0x303c60){if(_0x303c60){return[_0x303c60,![]];}return db[_0xcf42('0xa0')]['create'](_0x5104e9)['then'](function(_0x487cc9){return[_0x487cc9,!![]];});});}})[_0xcf42('0xa1')](function(_0x2e223d,_0x4fea8d){_0xb9f732[_0xcf42('0xa2')]=_0x2e223d['get']({'plain':!![]});_0xb9f732[_0xcf42('0xa2')][_0xcf42('0xa3')]=![];if(_0x4fea8d){if(_0xb9f732[_0xcf42('0x73')][_0xcf42('0xa4')]){_0xb9f732[_0xcf42('0x74')]['push']({'id':0x0,'priority':_0xb9f732[_0xcf42('0x74')][_0xcf42('0x4a')]+0x1,'app':_0xcf42('0xa5'),'appdata':_0xcf42('0xa6'),'interval':_0xcf42('0xa7')});}_0xb9f732[_0xcf42('0xa2')][_0xcf42('0xa3')]=!![];}return db[_0xcf42('0xa8')][_0xcf42('0x59')]({'phone':_0xb9f732['body']['from'],'messageId':_0xb9f732[_0xcf42('0x5a')]['messageId'],'body':_0xb9f732[_0xcf42('0x5a')][_0xcf42('0x5a')],'SmsAccountId':_0x21cbc3['params']['id'],'SmsInteractionId':_0x2e223d['id'],'direction':'in','ContactId':_0x2e223d[_0xcf42('0xa9')],'AttachmentId':_0xb9f732['body'][_0xcf42('0xaa')]});})['then'](function(_0x200b4f){_0xb9f732[_0xcf42('0x2a')]=_0x200b4f;if(_0xb9f732[_0xcf42('0xa2')]['UserId']){return db['User'][_0xcf42('0x58')]({'attributes':['id',_0xcf42('0x3c')],'where':{'id':_0xb9f732[_0xcf42('0xa2')][_0xcf42('0xab')]}})[_0xcf42('0x37')](function(_0x4282ca){if(_0x4282ca){_0xb9f732[_0xcf42('0x74')]['unshift']({'id':0x0,'priority':0x0,'app':_0xcf42('0xac'),'appdata':_0x4282ca[_0xcf42('0x3c')]+','+(_0xb9f732[_0xcf42('0x73')][_0xcf42('0xad')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xcf42('0xae'),_0xb9f732);});}return respondWithRpcPromise(_0xcf42('0xaf'),_0xcf42('0xae'),_0xb9f732);})[_0xcf42('0x37')](function(_0x270210){if(_0x270210){var _0x3f1b49=0xc8;var _0x4a16e1=_0xcf42('0xb0');logger['info'](_0xcf42('0x26'),_0x4a16e1,_0x3f1b49,_0xcf42('0xb1'));logger[_0xcf42('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4a16e1,_0x3f1b49,_0xcf42('0xb1'),JSON['stringify'](_0x270210));if(_0xb9f732[_0xcf42('0x73')][_0xcf42('0x43')]===_0xcf42('0x7f')){return _0x2472b1[_0xcf42('0x2c')](_0x3f1b49)[_0xcf42('0x33')](_0xcf42('0xb2'),'text/xml')['send']('\x0a');}else{return _0x2472b1[_0xcf42('0x2c')](_0x3f1b49)['json'](_0x270210);}}})[_0xcf42('0x2b')](handleError(_0x2472b1,null));};exports[_0xcf42('0xb3')]=function(_0x583538,_0x5083c0){var _0x302563=_0x583538[_0xcf42('0x55')]['id'];var _0x5ad8a8=_0x583538[_0xcf42('0x5a')];var _0x117198=0xc8;var _0x2f20ff=null;return db[_0xcf42('0xb4')][_0xcf42('0xb5')]({'isolationLevel':db[_0xcf42('0xb4')]['Transaction'][_0xcf42('0xb6')]['READ_COMMITTED']},function(_0x3908fc){return db[_0xcf42('0x40')]['findOne']({'where':{'id':_0x302563},'transaction':_0x3908fc})['then'](function(_0x2cf989){if(_0x2cf989){return db[_0xcf42('0x72')][_0xcf42('0x3a')]({'where':{'SmsAccountId':_0x302563},'transaction':_0x3908fc})[_0xcf42('0x37')](function(){var _0x2cd9d8=_['map'](_0x5ad8a8,function(_0x140e12){_0x140e12[_0xcf42('0x6a')]=_0x302563;return _0x140e12;});return db[_0xcf42('0x72')][_0xcf42('0xb7')](_0x2cd9d8,{'transaction':_0x3908fc});});}else{_0x117198=0x194;_0x2f20ff=[];}});})[_0xcf42('0x37')](function(){if(_0x117198!==0x194){return db[_0xcf42('0x72')][_0xcf42('0xb8')]({'where':{'SmsAccountId':_0x302563},'order':'priority'})[_0xcf42('0x37')](function(_0x49d47a){_0x2f20ff=_0x49d47a;});}})[_0xcf42('0x2b')](function(_0xb7aba5){_0x117198=0x1f4;logger[_0xcf42('0x28')](_0xb7aba5[_0xcf42('0x3b')]);if(_0xb7aba5[_0xcf42('0x3c')]){delete _0xb7aba5[_0xcf42('0x3c')];}_0x2f20ff=_0xb7aba5;})[_0xcf42('0xb9')](function(){if(_0x2f20ff===null){_0x5083c0['sendStatus'](_0x117198);}else{if(_0x117198===0x1f4){_0x5083c0['status'](_0x117198)[_0xcf42('0xba')](_0x2f20ff);}else{_0x5083c0['status'](_0x117198)[_0xcf42('0x2e')](_0x2f20ff);}}});};exports['getApplications']=function(_0x56d2b0,_0x34a12e,_0x1de694){var _0x43bfcb={};var _0x377f9b={};var _0x21896a;var _0x250485;return db[_0xcf42('0x40')][_0xcf42('0x66')]({'where':{'id':_0x56d2b0[_0xcf42('0x55')]['id']}})[_0xcf42('0x37')](handleEntityNotFound(_0x34a12e,null))[_0xcf42('0x37')](function(_0x13e998){if(_0x13e998){_0x21896a=_0x13e998;_0x377f9b['model']=_[_0xcf42('0x46')](db['SmsApplication'][_0xcf42('0x41')]);_0x377f9b['query']=_[_0xcf42('0x46')](_0x56d2b0[_0xcf42('0x45')]);_0x377f9b['filters']=_[_0xcf42('0x48')](_0x377f9b[_0xcf42('0x44')],_0x377f9b[_0xcf42('0x45')]);_0x43bfcb[_0xcf42('0x49')]=_[_0xcf42('0x48')](_0x377f9b[_0xcf42('0x44')],qs[_0xcf42('0x56')](_0x56d2b0[_0xcf42('0x45')][_0xcf42('0x56')]));_0x43bfcb[_0xcf42('0x49')]=_0x43bfcb[_0xcf42('0x49')]['length']?_0x43bfcb[_0xcf42('0x49')]:_0x377f9b[_0xcf42('0x44')];_0x43bfcb[_0xcf42('0x68')]=qs[_0xcf42('0x4c')](_0x56d2b0[_0xcf42('0x45')][_0xcf42('0x4c')]);_0x43bfcb[_0xcf42('0x4d')]=qs[_0xcf42('0x47')](_[_0xcf42('0x69')](_0x56d2b0[_0xcf42('0x45')],_0x377f9b[_0xcf42('0x47')]));if(_0x56d2b0[_0xcf42('0x45')][_0xcf42('0x4e')]){_0x43bfcb[_0xcf42('0x4d')]=_[_0xcf42('0x4f')](_0x43bfcb[_0xcf42('0x4d')],{'$or':_[_0xcf42('0x3f')](_0x43bfcb['attributes'],function(_0x10bd71){var _0x4d8262={};_0x4d8262[_0x10bd71]={'$like':'%'+_0x56d2b0['query'][_0xcf42('0x4e')]+'%'};return _0x4d8262;})});}_0x43bfcb=_['merge']({},_0x43bfcb,_0x56d2b0[_0xcf42('0x50')]);return _0x21896a[_0xcf42('0xbb')](_0x43bfcb);}})[_0xcf42('0x37')](function(_0x4faca0){if(_0x4faca0){_0x250485=_0x4faca0[_0xcf42('0x4a')];if(!_0x56d2b0[_0xcf42('0x45')][_0xcf42('0x4b')]('nolimit')){_0x43bfcb[_0xcf42('0x31')]=qs[_0xcf42('0x31')](_0x56d2b0[_0xcf42('0x45')][_0xcf42('0x31')]);_0x43bfcb[_0xcf42('0x2f')]=qs[_0xcf42('0x2f')](_0x56d2b0[_0xcf42('0x45')][_0xcf42('0x2f')]);}return _0x21896a[_0xcf42('0xbb')](_0x43bfcb);}})['then'](function(_0x3f45ee){if(_0x3f45ee){return _0x3f45ee?{'count':_0x250485,'rows':_0x3f45ee}:null;}})[_0xcf42('0x37')](respondWithResult(_0x34a12e,null))[_0xcf42('0x2b')](handleError(_0x34a12e,null));};exports['getInteractions']=function(_0x3abcf7,_0x5769eb,_0x843d9d){var _0x71accb={'raw':![],'where':{}};var _0x130b0e={};var _0x546d0a={'count':0x0,'rows':[]};return db[_0xcf42('0x40')]['findOne']({'where':{'id':_0x3abcf7[_0xcf42('0x55')]['id']}})[_0xcf42('0x37')](handleEntityNotFound(_0x5769eb,null))['then'](function(_0x2eab26){if(_0x2eab26){_0x130b0e[_0xcf42('0x44')]=_[_0xcf42('0x46')](db[_0xcf42('0xa0')][_0xcf42('0x41')]);_0x130b0e[_0xcf42('0x45')]=_[_0xcf42('0x46')](_0x3abcf7[_0xcf42('0x45')]);_0x130b0e[_0xcf42('0x47')]=_[_0xcf42('0x48')](_0x130b0e[_0xcf42('0x44')],_0x130b0e['query']);_0x71accb[_0xcf42('0x49')]=_['intersection'](_0x130b0e['model'],qs[_0xcf42('0x56')](_0x3abcf7['query'][_0xcf42('0x56')]));_0x71accb[_0xcf42('0x49')]=_0x71accb[_0xcf42('0x49')][_0xcf42('0x4a')]?_0x71accb[_0xcf42('0x49')]:_0x130b0e[_0xcf42('0x44')];if(!_0x3abcf7['query'][_0xcf42('0x4b')](_0xcf42('0x67'))){_0x71accb[_0xcf42('0x31')]=qs[_0xcf42('0x31')](_0x3abcf7['query'][_0xcf42('0x31')]);_0x71accb[_0xcf42('0x2f')]=qs[_0xcf42('0x2f')](_0x3abcf7[_0xcf42('0x45')][_0xcf42('0x2f')]);}_0x71accb['order']=qs['sort'](_0x3abcf7[_0xcf42('0x45')][_0xcf42('0x4c')]);_0x71accb[_0xcf42('0x4d')]=qs['filters'](_[_0xcf42('0x69')](_0x3abcf7['query'],_0x130b0e['filters']));_0x71accb[_0xcf42('0x4d')][_0xcf42('0x6a')]=_0x2eab26['id'];if(_0x3abcf7['query'][_0xcf42('0x4e')]){_0x71accb[_0xcf42('0x4d')]=_['merge'](_0x71accb['where'],{'$or':_[_0xcf42('0x3f')](_0x71accb[_0xcf42('0x49')],function(_0x1628af){var _0x4ea4b5={};_0x4ea4b5[_0x1628af]={'$like':'%'+_0x3abcf7[_0xcf42('0x45')][_0xcf42('0x4e')]+'%'};return _0x4ea4b5;})});}_0x71accb=_[_0xcf42('0x4f')]({},_0x71accb,_0x3abcf7[_0xcf42('0x50')]);return db[_0xcf42('0xa0')]['count']({'where':_0x71accb[_0xcf42('0x4d')]})[_0xcf42('0x37')](function(_0x42ea69){_0x546d0a[_0xcf42('0x32')]=_0x42ea69;if(_0x3abcf7['query'][_0xcf42('0x51')]){_0x71accb[_0xcf42('0x57')]=[{'model':db['CmContact'],'as':_0xcf42('0xbc'),'required':![]},{'model':db[_0xcf42('0xbd')],'as':'Owner','attributes':[_0xcf42('0x3c'),_0xcf42('0xbe'),_0xcf42('0xbf')],'required':![]},{'model':db[_0xcf42('0xc0')],'as':_0xcf42('0xc1'),'attributes':['id','name',_0xcf42('0xc2')],'where':_0x3abcf7[_0xcf42('0x45')][_0xcf42('0xc3')]?{'id':_0x3abcf7['query'][_0xcf42('0xc3')]}:undefined,'required':_0x3abcf7[_0xcf42('0x45')]['tag']?!![]:![]}];}return db[_0xcf42('0xa0')][_0xcf42('0x52')](_0x71accb);})['then'](function(_0x4f9252){_0x546d0a[_0xcf42('0x53')]=_0x4f9252;return _0x546d0a;});}})[_0xcf42('0x37')](respondWithFilteredResult(_0x5769eb,_0x71accb))['catch'](handleError(_0x5769eb,null));};exports[_0xcf42('0xba')]=function(_0x26ba8d,_0x7cd9d5,_0x14d261){var _0x5207e6,_0x52c3f2,_0x422e52;if(_['isNil'](_0x26ba8d[_0xcf42('0x5a')][_0xcf42('0x5a')])||_0x26ba8d[_0xcf42('0x5a')]['body']===''){throw new db[(_0xcf42('0x94'))][(_0xcf42('0x79'))](_0xcf42('0x96'));}if(_[_0xcf42('0x95')](_0x26ba8d[_0xcf42('0x5a')]['to'])){throw new db[(_0xcf42('0x94'))]['ValidationError'](_0xcf42('0xc4'));}_0x5207e6=_0x26ba8d[_0xcf42('0x5a')]['to'];return db[_0xcf42('0x40')][_0xcf42('0x58')]({'where':{'id':_0x26ba8d[_0xcf42('0x55')]['id']},'include':[{'model':db[_0xcf42('0x9b')],'as':_0xcf42('0xc5'),'include':[{'model':db[_0xcf42('0x78')],'as':_0xcf42('0x9c'),'where':{'mobile':_0x5207e6},'limit':0x1,'order':[[_0xcf42('0x7c'),'DESC']]}]}]})[_0xcf42('0x37')](handleEntityNotFound(_0x7cd9d5,null))['then'](function(_0x5613a9){if(_0x5613a9&&_0x5613a9[_0xcf42('0xc5')]){_0x52c3f2=_0x5613a9[_0xcf42('0x38')]({'plain':!![]});if(_0x52c3f2[_0xcf42('0xc5')]&&_0x52c3f2[_0xcf42('0xc5')][_0xcf42('0x9c')][_0xcf42('0x4a')]){return _0x52c3f2[_0xcf42('0xc5')][_0xcf42('0x9c')][0x0];}return db[_0xcf42('0x78')][_0xcf42('0x59')](_[_0xcf42('0x1c')](_0x26ba8d['body'],{'firstName':_0x5207e6,'mobile':_0x5207e6,'phone':_0x5207e6,'ListId':_0x52c3f2['ListId']}));}})[_0xcf42('0x37')](handleEntityNotFound(_0x7cd9d5,null))[_0xcf42('0x37')](function(_0x23c828){if(_0x23c828){_0x422e52=_0x23c828;return db[_0xcf42('0xa0')][_0xcf42('0x58')]({'where':{'ContactId':_0x422e52['id'],'closed':![],'SmsAccountId':_0x52c3f2['id']}})[_0xcf42('0x37')](function(_0x446e1b){if(_0x446e1b){return[_0x446e1b,![]];}return db[_0xcf42('0xa0')][_0xcf42('0x59')]({'UserId':_0x26ba8d[_0xcf42('0x5d')]['id'],'ContactId':_0x422e52['id'],'SmsAccountId':_0x52c3f2['id'],'phone':_0x5207e6,'firstMsgDirection':_0xcf42('0xc6'),'Messages':[_[_0xcf42('0x4f')](_0x26ba8d['body'],{'read':![],'body':_0x26ba8d[_0xcf42('0x5a')][_0xcf42('0x5a')],'phone':_0x5207e6,'SmsAccountId':_0x52c3f2['id'],'UserId':_0x26ba8d[_0xcf42('0x5d')]['id'],'ContactId':_0x422e52['id']})]},{'include':[{'model':db[_0xcf42('0xa8')],'as':_0xcf42('0xc7')}]})[_0xcf42('0x37')](function(_0x1c5410){return[_0x1c5410,!![]];});});}})[_0xcf42('0xa1')](function(_0xc3952a,_0x314643){if(_0x314643){return _0xc3952a;}return db['SmsMessage'][_0xcf42('0x59')](_[_0xcf42('0x4f')](_0x26ba8d[_0xcf42('0x5a')],{'read':![],'body':_0x26ba8d[_0xcf42('0x5a')][_0xcf42('0x5a')],'phone':_0x5207e6,'SmsAccountId':_0x52c3f2['id'],'SmsInteractionId':_0xc3952a['id'],'UserId':_0x26ba8d['user']['id'],'ContactId':_0x422e52['id']}))[_0xcf42('0x37')](function(_0x1c5200){_0xc3952a[_0xcf42('0xc8')][_0xcf42('0xc7')]=[];_0xc3952a[_0xcf42('0xc8')][_0xcf42('0xc7')][_0xcf42('0xc9')](_0x1c5200['dataValues']);return _0xc3952a;});})['then'](respondWithResult(_0x7cd9d5,null))[_0xcf42('0x2b')](handleError(_0x7cd9d5,null));};exports[_0xcf42('0x2c')]=function(_0x388953,_0x48a8e5,_0x422523){if(_0x388953[_0xcf42('0x5a')]['id']){delete _0x388953[_0xcf42('0x5a')]['id'];}var _0x3a1701,_0x44f92f,_0x14d617;return db[_0xcf42('0x40')][_0xcf42('0x58')]({'where':{'id':_0x388953[_0xcf42('0x55')]['id']}})['then'](handleEntityNotFound(_0x48a8e5,null))['then'](function(_0xc3750a){if(_0xc3750a){_0x14d617=_0xc3750a;logger[_0xcf42('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcf42('0x2c'),_0xcf42('0xca'),_0xc3750a[_0xcf42('0x43')],util[_0xcf42('0xcb')](_0x388953[_0xcf42('0x5a')],{'showHidden':![],'depth':null}));switch(_0xc3750a['type']){case _0xcf42('0x84'):if(_0x388953['body'][_0xcf42('0xcc')]&&_0x388953[_0xcf42('0x5a')]['status']){_0x44f92f=_0x388953[_0xcf42('0x5a')]['status'];return db['SmsMessage'][_0xcf42('0x58')]({'where':{'messageId':_0x388953[_0xcf42('0x5a')][_0xcf42('0xcc')]}});}break;case _0xcf42('0x88'):if(_0x388953[_0xcf42('0x5a')][_0xcf42('0xcd')]&&_0x388953[_0xcf42('0x5a')][_0xcf42('0xce')]){_0x44f92f=_0x388953['body']['statusInt'];return db[_0xcf42('0xa8')][_0xcf42('0x58')]({'where':{'messageId':_0x388953[_0xcf42('0x5a')]['requestid']}});}break;case _0xcf42('0x89'):if(_0x388953[_0xcf42('0x5a')][_0xcf42('0x8a')]&&_0x388953[_0xcf42('0x5a')][_0xcf42('0xcf')]){_0x44f92f=_0x388953['body']['status_code'];return db[_0xcf42('0xa8')][_0xcf42('0x58')]({'where':{'messageId':_0x388953[_0xcf42('0x5a')][_0xcf42('0x8a')]}});}break;case'infobip':var _0x1a4d26=_0x388953[_0xcf42('0x5a')][_0xcf42('0x8c')][0x0];if(_0x1a4d26[_0xcf42('0x82')]&&_0x1a4d26[_0xcf42('0x2c')][_0xcf42('0xd0')]===_0xcf42('0xd1')){_0x44f92f=_0x1a4d26[_0xcf42('0x2c')][_0xcf42('0xd0')];return db[_0xcf42('0xa8')][_0xcf42('0x58')]({'where':{'messageId':_0x1a4d26['messageId']}});}break;case _0xcf42('0xd2'):if(_0x388953['body'][_0xcf42('0x82')]&&_0x388953[_0xcf42('0x5a')][_0xcf42('0x2c')]){_0x44f92f=_0x388953[_0xcf42('0x5a')][_0xcf42('0x2c')];return db[_0xcf42('0xa8')][_0xcf42('0x58')]({'where':{'messageId':_0x388953[_0xcf42('0x5a')][_0xcf42('0x82')]}});}break;case _0xcf42('0x92'):if(_0x388953[_0xcf42('0x5a')][0x0][_0xcf42('0x2a')]['id']){_0x44f92f=_0x388953[_0xcf42('0x5a')][0x0][_0xcf42('0x43')];return db[_0xcf42('0xa8')][_0xcf42('0x58')]({'where':{'messageId':_0x388953[_0xcf42('0x5a')][0x0][_0xcf42('0x2a')]['id']}});}break;case _0xcf42('0x93'):if(_0x388953['body'][_0xcf42('0xd3')]&&_0x388953[_0xcf42('0x5a')][_0xcf42('0x2c')]){_0x44f92f=_0x388953[_0xcf42('0x5a')]['status'];return db[_0xcf42('0xa8')][_0xcf42('0x58')]({'where':{'messageId':_0x388953[_0xcf42('0x5a')][_0xcf42('0xd3')]}});}break;}}})[_0xcf42('0x37')](handleEntityNotFound(_0x48a8e5,null))[_0xcf42('0x37')](function(_0x5ca913){if(_0x5ca913){_0x3a1701=_0x5ca913;switch(_0x14d617[_0xcf42('0x43')]){case'skebby':if(_0x44f92f==='DELIVERED'){return _0x3a1701[_0xcf42('0x61')]({'read':!![]});}else{logger[_0xcf42('0x28')](_0xcf42('0x26'),_0xcf42('0x2c'),_0xcf42('0x84'),util[_0xcf42('0xcb')](_0x388953[_0xcf42('0x5a')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x44f92f==='1'){return _0x3a1701['update']({'read':!![]});}else{logger[_0xcf42('0x28')](_0xcf42('0x26'),_0xcf42('0x2c'),_0xcf42('0x84'),util['inspect'](_0x388953[_0xcf42('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xcf42('0x89'):if(!_0x388953[_0xcf42('0x5a')]['error_code']&&_0x44f92f>=0xc8&&_0x44f92f<=0xce){return _0x3a1701[_0xcf42('0x61')]({'read':!![]});}else{logger[_0xcf42('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcf42('0x2c'),_0xcf42('0x89'),util[_0xcf42('0xcb')](_0x388953['body'],{'showHidden':![],'depth':null}));}break;case _0xcf42('0xd4'):var _0x15b858=_0x388953['body']['results'][0x0];if(_0x15b858[_0xcf42('0x2c')][_0xcf42('0xd0')]===_0xcf42('0xd1')){return _0x3a1701['update']({'read':!![]});}else{logger[_0xcf42('0x28')](_0xcf42('0x26'),_0xcf42('0x2c'),_0xcf42('0xd4'),util[_0xcf42('0xcb')](_0x388953[_0xcf42('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xcf42('0xd2'):if(_0x44f92f==_0xcf42('0xd5')||_0x44f92f==_0xcf42('0xd6')){return _0x3a1701['update']({'read':!![]});}else{logger[_0xcf42('0x28')](_0xcf42('0x26'),_0xcf42('0x2c'),_0xcf42('0xd2'),util[_0xcf42('0xcb')](_0x388953[_0xcf42('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xcf42('0x92'):if(_0x44f92f=='message-delivered'){return _0x3a1701['update']({'read':!![]});}else{logger['error'](_0xcf42('0x26'),_0xcf42('0x2c'),_0xcf42('0x92'),util['inspect'](_0x388953[_0xcf42('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xcf42('0x93'):if(_0x44f92f===_0xcf42('0xd7')||_0x44f92f===_0xcf42('0xd8')){return _0x3a1701[_0xcf42('0x61')]({'read':!![]});}else{logger[_0xcf42('0x28')](_0xcf42('0x26'),'status',_0xcf42('0x93'),util[_0xcf42('0xcb')](_0x388953[_0xcf42('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x3a1701;}})[_0xcf42('0x37')](respondWithResult(_0x48a8e5,null))[_0xcf42('0x2b')](handleError(_0x48a8e5,null));};exports[_0xcf42('0xd9')]=function(_0x586ac0,_0x1631b6,_0x1e71e7){var _0x5c1902,_0x46f054,_0x36849b;return db[_0xcf42('0x40')][_0xcf42('0x58')]({'where':{'id':_0x586ac0[_0xcf42('0x55')]['id']}})[_0xcf42('0x37')](handleEntityNotFound(_0x1631b6,null))[_0xcf42('0x37')](function(_0xa9e48c){if(_0xa9e48c){_0x36849b=_0xa9e48c;logger[_0xcf42('0x25')](_0xcf42('0x26'),_0xcf42('0x2c'),'received\x20delivery\x20report\x20from',_0xa9e48c[_0xcf42('0x43')],util[_0xcf42('0xcb')](_0x586ac0[_0xcf42('0x45')],{'showHidden':![],'depth':null}));switch(_0xa9e48c['type']){case _0xcf42('0x8d'):if(_0x586ac0[_0xcf42('0x45')]['message-id']&&_0x586ac0[_0xcf42('0x45')][_0xcf42('0xda')]){_0x46f054=_0x586ac0[_0xcf42('0x45')][_0xcf42('0xda')];return db[_0xcf42('0xa8')][_0xcf42('0x58')]({'where':{'messageId':_0x586ac0[_0xcf42('0x45')]['message-id']}});}break;}}})[_0xcf42('0x37')](handleEntityNotFound(_0x1631b6,null))[_0xcf42('0x37')](function(_0x563eba){if(_0x563eba){_0x5c1902=_0x563eba;switch(_0x36849b[_0xcf42('0x43')]){case _0xcf42('0x8d'):if(_0x46f054==='2'||_0x46f054==='6'){return _0x5c1902[_0xcf42('0x61')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xcf42('0x8d'),util[_0xcf42('0xcb')](_0x586ac0['query'],{'showHidden':![],'depth':null}));};break;}return _0x5c1902;}})[_0xcf42('0x37')](respondWithResult(_0x1631b6,null))[_0xcf42('0x2b')](handleError(_0x1631b6,null));};exports[_0xcf42('0xdb')]=function(_0x5eb3d9,_0x277b7a,_0x36d012){return db[_0xcf42('0x40')][_0xcf42('0x58')]({'where':{'id':_0x5eb3d9[_0xcf42('0x55')]['id']}})[_0xcf42('0x37')](handleEntityNotFound(_0x277b7a,null))['then'](function(_0x3fa36b){if(_0x3fa36b){return _0x3fa36b[_0xcf42('0xdb')](_0x5eb3d9[_0xcf42('0x5a')][_0xcf42('0x6c')],_[_0xcf42('0x9e')](_0x5eb3d9[_0xcf42('0x5a')],['ids','id'])||{})[_0xcf42('0xa1')](function(_0x48409b){for(var _0x3dc6a1=0x0;_0x3dc6a1<_0x5eb3d9[_0xcf42('0x5a')]['ids'][_0xcf42('0x4a')];_0x3dc6a1+=0x1){socket[_0xcf42('0xdc')](_0xcf42('0xdd'),{'UserId':Number(_0x5eb3d9[_0xcf42('0x5a')][_0xcf42('0x6c')][_0x3dc6a1]),'SmsAccountId':Number(_0x5eb3d9[_0xcf42('0x55')]['id'])});}return _0x48409b;});}})[_0xcf42('0x37')](respondWithResult(_0x277b7a,null))['catch'](handleError(_0x277b7a,null));};exports['removeAgents']=function(_0x481b3b,_0x5ae993,_0x31409e){return db['SmsAccount'][_0xcf42('0x58')]({'where':{'id':_0x481b3b[_0xcf42('0x55')]['id']}})['then'](handleEntityNotFound(_0x5ae993,null))[_0xcf42('0x37')](function(_0x58dd30){if(_0x58dd30){return _0x58dd30[_0xcf42('0xde')](_0x481b3b[_0xcf42('0x45')]['ids'])['then'](function(){if(_[_0xcf42('0xdf')](_0x481b3b[_0xcf42('0x45')][_0xcf42('0x6c')])){for(var _0x271731=0x0;_0x271731<_0x481b3b[_0xcf42('0x45')][_0xcf42('0x6c')][_0xcf42('0x4a')];_0x271731+=0x1){socket['emit'](_0xcf42('0xe0'),{'UserId':Number(_0x481b3b[_0xcf42('0x45')]['ids'][_0x271731]),'SmsAccountId':Number(_0x481b3b[_0xcf42('0x55')]['id'])});}}else{socket[_0xcf42('0xdc')](_0xcf42('0xe0'),{'UserId':Number(_0x481b3b[_0xcf42('0x45')][_0xcf42('0x6c')]),'SmsAccountId':Number(_0x481b3b['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5ae993,null))[_0xcf42('0x2b')](handleError(_0x5ae993,null));};exports[_0xcf42('0xe1')]=function(_0x25a201,_0x1f4f61,_0x2743e4){var _0x379c0c={};var _0x46e20e={};var _0x3eab73;var _0x4054fe;return db[_0xcf42('0x40')][_0xcf42('0x66')]({'where':{'id':_0x25a201[_0xcf42('0x55')]['id']}})[_0xcf42('0x37')](handleEntityNotFound(_0x1f4f61,null))[_0xcf42('0x37')](function(_0x3b60aa){if(_0x3b60aa){_0x3eab73=_0x3b60aa;_0x46e20e[_0xcf42('0x44')]=_['keys'](db[_0xcf42('0xbd')][_0xcf42('0x41')]);_0x46e20e[_0xcf42('0x45')]=_[_0xcf42('0x46')](_0x25a201['query']);_0x46e20e[_0xcf42('0x47')]=_['intersection'](_0x46e20e[_0xcf42('0x44')],_0x46e20e['query']);_0x379c0c[_0xcf42('0x49')]=_[_0xcf42('0x48')](_0x46e20e[_0xcf42('0x44')],qs[_0xcf42('0x56')](_0x25a201[_0xcf42('0x45')][_0xcf42('0x56')]));_0x379c0c[_0xcf42('0x49')]=_0x379c0c['attributes'][_0xcf42('0x4a')]?_0x379c0c[_0xcf42('0x49')]:_0x46e20e[_0xcf42('0x44')];_0x379c0c[_0xcf42('0x68')]=qs[_0xcf42('0x4c')](_0x25a201['query'][_0xcf42('0x4c')]);_0x379c0c[_0xcf42('0x4d')]=qs[_0xcf42('0x47')](_[_0xcf42('0x69')](_0x25a201['query'],_0x46e20e[_0xcf42('0x47')]));if(_0x25a201['query'][_0xcf42('0x4e')]){_0x379c0c['where']=_[_0xcf42('0x4f')](_0x379c0c[_0xcf42('0x4d')],{'$or':_['map'](_0x379c0c[_0xcf42('0x49')],function(_0x3b6c37){var _0x41fc27={};_0x41fc27[_0x3b6c37]={'$like':'%'+_0x25a201[_0xcf42('0x45')][_0xcf42('0x4e')]+'%'};return _0x41fc27;})});}_0x379c0c=_['merge']({},_0x379c0c,_0x25a201[_0xcf42('0x50')]);return _0x3eab73[_0xcf42('0xe1')](_0x379c0c);}})[_0xcf42('0x37')](function(_0x42ddca){if(_0x42ddca){_0x4054fe=_0x42ddca['length'];if(!_0x25a201[_0xcf42('0x45')][_0xcf42('0x4b')](_0xcf42('0x67'))){_0x379c0c['limit']=qs['limit'](_0x25a201[_0xcf42('0x45')][_0xcf42('0x31')]);_0x379c0c[_0xcf42('0x2f')]=qs['offset'](_0x25a201[_0xcf42('0x45')][_0xcf42('0x2f')]);}return _0x3eab73[_0xcf42('0xe1')](_0x379c0c);}})[_0xcf42('0x37')](function(_0xe8a62f){if(_0xe8a62f){return _0xe8a62f?{'count':_0x4054fe,'rows':_0xe8a62f}:null;}})[_0xcf42('0x37')](respondWithResult(_0x1f4f61,null))['catch'](handleError(_0x1f4f61,null));}; \ No newline at end of file +var _0x8c76=['text/xml','\x0a','addApplications','sequelize','Transaction','READ_COMMITTED','bulkCreate','send','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','clicksend','status_code','infobip','DELIVERED','groupName','clickatell','redif','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','User','eml-format','rimraf','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','get','SmsAccounts','UserProfileResource','destroy','stack','name','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','Pause','intersection','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addDisposition','SmsAccountId','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','asc','Sequelize','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','mobile','from','From','skebby','sender','text','message_id','plivo','Text','messageId','MessageUUID','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','CmContact','Contacts','DESC','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio'];(function(_0x488f79,_0x305b4b){var _0x102892=function(_0x1af782){while(--_0x1af782){_0x488f79['push'](_0x488f79['shift']());}};_0x102892(++_0x305b4b);}(_0x8c76,0x117));var _0x68c7=function(_0x42d842,_0x5f5063){_0x42d842=_0x42d842-0x0;var _0x41bb03=_0x8c76[_0x42d842];return _0x41bb03;};'use strict';var emlformat=require(_0x68c7('0x0'));var rimraf=require(_0x68c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x68c7('0x2'));var moment=require(_0x68c7('0x3'));var BPromise=require(_0x68c7('0x4'));var Mustache=require('mustache');var util=require(_0x68c7('0x5'));var path=require('path');var sox=require(_0x68c7('0x6'));var csv=require('to-csv');var ejs=require(_0x68c7('0x7'));var fs=require('fs');var fs_extra=require(_0x68c7('0x8'));var _=require(_0x68c7('0x9'));var squel=require(_0x68c7('0xa'));var crypto=require('crypto');var jsforce=require(_0x68c7('0xb'));var deskjs=require(_0x68c7('0xc'));var toCsv=require(_0x68c7('0xd'));var querystring=require('querystring');var Papa=require(_0x68c7('0xe'));var Redis=require('ioredis');var authService=require(_0x68c7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x68c7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x68c7('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x68c7('0x12'));var licenseUtil=require(_0x68c7('0x13'));var db=require(_0x68c7('0x14'))['db'];config[_0x68c7('0x15')]=_[_0x68c7('0x16')](config[_0x68c7('0x15')],{'host':_0x68c7('0x17'),'port':0x18eb});var socket=require(_0x68c7('0x18'))(new Redis(config[_0x68c7('0x15')]));require(_0x68c7('0x19'))['register'](socket);var jayson=require(_0x68c7('0x1a'));var client=jayson[_0x68c7('0x1b')]['http']({'port':0x232c});function respondWithRpcPromise(_0x227787,_0x3b20b9,_0x35e0a7,_0x2b82ce){return new BPromise(function(_0x36e372,_0x3c9174){var _0x5cb84a=_0x2b82ce||client;return _0x5cb84a['request'](_0x227787,_0x35e0a7)[_0x68c7('0x1c')](function(_0x1cb5ba){logger[_0x68c7('0x1d')](_0x68c7('0x1e'),_0x3b20b9,_0x68c7('0x1f'));logger[_0x68c7('0x20')](_0x68c7('0x21'),_0x3b20b9,_0x68c7('0x1f'),JSON[_0x68c7('0x22')](_0x1cb5ba));if(_0x1cb5ba[_0x68c7('0x23')]){if(_0x1cb5ba['error'][_0x68c7('0x24')]===0x1f4){logger[_0x68c7('0x23')](_0x68c7('0x1e'),_0x3b20b9,_0x1cb5ba[_0x68c7('0x23')][_0x68c7('0x25')]);return _0x3c9174(_0x1cb5ba[_0x68c7('0x23')][_0x68c7('0x25')]);}logger['error'](_0x68c7('0x1e'),_0x3b20b9,_0x1cb5ba[_0x68c7('0x23')][_0x68c7('0x25')]);return _0x36e372(_0x1cb5ba[_0x68c7('0x23')][_0x68c7('0x25')]);}else{logger[_0x68c7('0x1d')](_0x68c7('0x1e'),_0x3b20b9,'request\x20sent');_0x36e372(_0x1cb5ba[_0x68c7('0x26')][_0x68c7('0x25')]);}})[_0x68c7('0x27')](function(_0x1eecd6){logger[_0x68c7('0x23')](_0x68c7('0x1e'),_0x3b20b9,_0x1eecd6);_0x3c9174(_0x1eecd6);});});}function respondWithStatusCode(_0x1848f0,_0x44dd08){_0x44dd08=_0x44dd08||0xcc;return function(_0x175c91){if(_0x175c91){return _0x1848f0[_0x68c7('0x28')](_0x44dd08);}return _0x1848f0['status'](_0x44dd08)[_0x68c7('0x29')]();};}function respondWithResult(_0x579e73,_0xc83077){_0xc83077=_0xc83077||0xc8;return function(_0x1b0c85){if(_0x1b0c85){return _0x579e73[_0x68c7('0x2a')](_0xc83077)[_0x68c7('0x2b')](_0x1b0c85);}};}function respondWithFilteredResult(_0x3e32a0,_0x5c446c){return function(_0x4cc79e){if(_0x4cc79e){var _0x22ccfc=typeof _0x5c446c[_0x68c7('0x2c')]===_0x68c7('0x2d')&&typeof _0x5c446c[_0x68c7('0x2e')]==='undefined';var _0x2a363a=_0x4cc79e[_0x68c7('0x2f')];var _0x5be58d=_0x22ccfc?0x0:_0x5c446c[_0x68c7('0x2c')];var _0x3bd661=_0x22ccfc?_0x4cc79e[_0x68c7('0x2f')]:_0x5c446c[_0x68c7('0x2c')]+_0x5c446c['limit'];var _0xb7f91b;if(_0x3bd661>=_0x2a363a){_0x3bd661=_0x2a363a;_0xb7f91b=0xc8;}else{_0xb7f91b=0xce;}_0x3e32a0[_0x68c7('0x2a')](_0xb7f91b);return _0x3e32a0['set']('Content-Range',_0x5be58d+'-'+_0x3bd661+'/'+_0x2a363a)[_0x68c7('0x2b')](_0x4cc79e);}return null;};}function patchUpdates(_0x3365b6){return function(_0x3ebc35){try{jsonpatch[_0x68c7('0x30')](_0x3ebc35,_0x3365b6,!![]);}catch(_0x55fdd6){return BPromise[_0x68c7('0x31')](_0x55fdd6);}return _0x3ebc35[_0x68c7('0x32')]();};}function saveUpdates(_0x54ba61,_0x309f82){return function(_0x59fc84){if(_0x59fc84){return _0x59fc84[_0x68c7('0x33')](_0x54ba61)[_0x68c7('0x1c')](function(_0x25e742){return _0x25e742;});}return null;};}function removeEntity(_0x2fab79,_0x2f24c3){return function(_0x1d515b){if(_0x1d515b){return _0x1d515b['destroy']()['then'](function(){var _0x1df7f1=_0x1d515b[_0x68c7('0x34')]({'plain':!![]});var _0x5078ae=_0x68c7('0x35');return db[_0x68c7('0x36')][_0x68c7('0x37')]({'where':{'type':_0x5078ae,'resourceId':_0x1df7f1['id']}})['then'](function(){return _0x1d515b;});})[_0x68c7('0x1c')](function(){_0x2fab79['status'](0xcc)[_0x68c7('0x29')]();});}};}function handleEntityNotFound(_0x333feb,_0x20be02){return function(_0x137f79){if(!_0x137f79){_0x333feb['sendStatus'](0x194);}return _0x137f79;};}function handleError(_0x3e7463,_0x5d15fc){_0x5d15fc=_0x5d15fc||0x1f4;return function(_0x5b864f){logger[_0x68c7('0x23')](_0x5b864f[_0x68c7('0x38')]);if(_0x5b864f[_0x68c7('0x39')]){delete _0x5b864f['name'];}_0x3e7463['status'](_0x5d15fc)['send'](_0x5b864f);};}exports[_0x68c7('0x3a')]=function(_0x22ffa2,_0x11dd18){var _0x4b1001={'include':[{'model':db['Pause'],'as':_0x68c7('0x3b')}]},_0x343770={},_0xf674c0={'count':0x0,'rows':[]};var _0x117d2e=_[_0x68c7('0x3c')](db[_0x68c7('0x3d')][_0x68c7('0x3e')],function(_0x1d6b58){return{'name':_0x1d6b58[_0x68c7('0x3f')],'type':_0x1d6b58[_0x68c7('0x40')]['key']};});_0x343770[_0x68c7('0x41')]=_[_0x68c7('0x3c')](_0x117d2e,'name');_0x343770[_0x68c7('0x42')]=_[_0x68c7('0x43')](_0x22ffa2[_0x68c7('0x42')]);_0x343770[_0x68c7('0x44')]=_['intersection'](_0x343770[_0x68c7('0x41')],_0x343770['query']);_0x4b1001[_0x68c7('0x45')]=_['intersection'](_0x343770[_0x68c7('0x41')],qs['fields'](_0x22ffa2[_0x68c7('0x42')][_0x68c7('0x46')]));_0x4b1001[_0x68c7('0x45')]=_0x4b1001[_0x68c7('0x45')][_0x68c7('0x47')]?_0x4b1001[_0x68c7('0x45')]:_0x343770[_0x68c7('0x41')];if(!_0x22ffa2[_0x68c7('0x42')][_0x68c7('0x48')](_0x68c7('0x49'))){_0x4b1001[_0x68c7('0x2e')]=qs['limit'](_0x22ffa2[_0x68c7('0x42')][_0x68c7('0x2e')]);_0x4b1001[_0x68c7('0x2c')]=qs['offset'](_0x22ffa2[_0x68c7('0x42')]['offset']);}_0x4b1001[_0x68c7('0x4a')]=qs[_0x68c7('0x4b')](_0x22ffa2[_0x68c7('0x42')]['sort']);_0x4b1001['where']=qs[_0x68c7('0x44')](_['pick'](_0x22ffa2[_0x68c7('0x42')],_0x343770[_0x68c7('0x44')]),_0x117d2e);if(_0x22ffa2[_0x68c7('0x42')][_0x68c7('0x4c')]){_0x4b1001[_0x68c7('0x4d')]=_[_0x68c7('0x4e')](_0x4b1001[_0x68c7('0x4d')],{'$or':_[_0x68c7('0x3c')](_0x117d2e,function(_0x4e6b54){if(_0x4e6b54['type']!==_0x68c7('0x4f')){var _0x41f0a5={};_0x41f0a5[_0x4e6b54[_0x68c7('0x39')]]={'$like':'%'+_0x22ffa2[_0x68c7('0x42')]['filter']+'%'};return _0x41f0a5;}})});}_0x4b1001=_[_0x68c7('0x4e')]({},_0x4b1001,_0x22ffa2[_0x68c7('0x50')]);var _0x24fc09={'where':_0x4b1001[_0x68c7('0x4d')]};return db[_0x68c7('0x3d')][_0x68c7('0x2f')](_0x24fc09)['then'](function(_0x887177){_0xf674c0[_0x68c7('0x2f')]=_0x887177;if(_0x22ffa2[_0x68c7('0x42')][_0x68c7('0x51')]){_0x4b1001['include']=[{'all':!![]}];}return db['SmsAccount'][_0x68c7('0x52')](_0x4b1001);})[_0x68c7('0x1c')](function(_0x3fcfd3){_0xf674c0[_0x68c7('0x53')]=_0x3fcfd3;return _0xf674c0;})[_0x68c7('0x1c')](respondWithFilteredResult(_0x11dd18,_0x4b1001))[_0x68c7('0x27')](handleError(_0x11dd18,null));};exports[_0x68c7('0x54')]=function(_0x1e0cf0,_0x2da4f2){var _0x54641d={'raw':![],'where':{'id':_0x1e0cf0[_0x68c7('0x55')]['id']},'include':[{'model':db[_0x68c7('0x56')],'as':_0x68c7('0x3b')}]},_0x538349={};_0x538349['model']=_[_0x68c7('0x43')](db[_0x68c7('0x3d')][_0x68c7('0x3e')]);_0x538349[_0x68c7('0x42')]=_[_0x68c7('0x43')](_0x1e0cf0['query']);_0x538349['filters']=_[_0x68c7('0x57')](_0x538349['model'],_0x538349['query']);_0x54641d[_0x68c7('0x45')]=_['intersection'](_0x538349['model'],qs[_0x68c7('0x46')](_0x1e0cf0[_0x68c7('0x42')][_0x68c7('0x46')]));_0x54641d[_0x68c7('0x45')]=_0x54641d[_0x68c7('0x45')]['length']?_0x54641d['attributes']:_0x538349[_0x68c7('0x41')];if(_0x1e0cf0[_0x68c7('0x42')][_0x68c7('0x51')]){_0x54641d[_0x68c7('0x58')]=[{'all':!![]}];}_0x54641d=_[_0x68c7('0x4e')]({},_0x54641d,_0x1e0cf0[_0x68c7('0x50')]);return db[_0x68c7('0x3d')][_0x68c7('0x59')](_0x54641d)['then'](handleEntityNotFound(_0x2da4f2,null))['then'](respondWithResult(_0x2da4f2,null))[_0x68c7('0x27')](handleError(_0x2da4f2,null));};exports[_0x68c7('0x5a')]=function(_0x498db2,_0x3d1e3e){return db[_0x68c7('0x3d')][_0x68c7('0x5a')](_0x498db2['body'],{})[_0x68c7('0x1c')](function(_0x534cc8){var _0x2af087=_0x498db2['user'][_0x68c7('0x34')]({'plain':!![]});if(!_0x2af087)throw new Error(_0x68c7('0x5b'));if(_0x2af087[_0x68c7('0x5c')]===_0x68c7('0x5d')){var _0x26fc02=_0x534cc8[_0x68c7('0x34')]({'plain':!![]});var _0x501230='SmsAccounts';return db['UserProfileSection'][_0x68c7('0x59')]({'where':{'name':_0x501230,'userProfileId':_0x2af087['userProfileId']},'raw':!![]})[_0x68c7('0x1c')](function(_0x15f18f){if(_0x15f18f&&_0x15f18f[_0x68c7('0x5e')]===0x0){return db[_0x68c7('0x36')][_0x68c7('0x5a')]({'name':_0x26fc02[_0x68c7('0x39')],'resourceId':_0x26fc02['id'],'type':_0x15f18f['name'],'sectionId':_0x15f18f['id']},{})[_0x68c7('0x1c')](function(){return _0x534cc8;});}else{return _0x534cc8;}})[_0x68c7('0x27')](function(_0x4b2eca){logger[_0x68c7('0x23')](_0x68c7('0x5f'),_0x4b2eca);throw _0x4b2eca;});}return _0x534cc8;})[_0x68c7('0x1c')](respondWithResult(_0x3d1e3e,0xc9))[_0x68c7('0x27')](handleError(_0x3d1e3e,null));};exports[_0x68c7('0x33')]=function(_0x4286c1,_0x9e7738){if(_0x4286c1['body']['id']){delete _0x4286c1['body']['id'];}return db[_0x68c7('0x3d')]['find']({'where':{'id':_0x4286c1['params']['id']},'include':[{'model':db[_0x68c7('0x56')],'as':'mandatoryDispositionPause'}]})[_0x68c7('0x1c')](handleEntityNotFound(_0x9e7738,null))['then'](saveUpdates(_0x4286c1[_0x68c7('0x60')],null))[_0x68c7('0x1c')](respondWithResult(_0x9e7738,null))[_0x68c7('0x27')](handleError(_0x9e7738,null));};exports[_0x68c7('0x37')]=function(_0x53b9e1,_0x2d09ef){return db[_0x68c7('0x3d')][_0x68c7('0x59')]({'where':{'id':_0x53b9e1[_0x68c7('0x55')]['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0x2d09ef,null))['then'](removeEntity(_0x2d09ef,null))[_0x68c7('0x27')](handleError(_0x2d09ef,null));};exports['describe']=function(_0x1d2d96,_0x4e96dd){return db['SmsAccount']['describe']()['then'](respondWithResult(_0x4e96dd,null))[_0x68c7('0x27')](handleError(_0x4e96dd,null));};exports[_0x68c7('0x61')]=function(_0x56c0da,_0x3e94f8,_0x357590){if(_0x56c0da[_0x68c7('0x60')]['id']){delete _0x56c0da[_0x68c7('0x60')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x56c0da[_0x68c7('0x55')]['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0x3e94f8,null))[_0x68c7('0x1c')](function(_0x466a4c){if(_0x466a4c){_0x56c0da[_0x68c7('0x60')][_0x68c7('0x62')]=_0x466a4c['id'];return db['Disposition'][_0x68c7('0x5a')](_0x56c0da[_0x68c7('0x60')]);}})[_0x68c7('0x1c')](respondWithResult(_0x3e94f8,null))['catch'](handleError(_0x3e94f8,null));};exports['getDispositions']=function(_0x536d01,_0x39d227,_0x15e6a3){var _0x114c43={'raw':![],'where':{}};var _0x37106c={};var _0x95f6bc={'count':0x0,'rows':[]};return db[_0x68c7('0x3d')][_0x68c7('0x63')]({'where':{'id':_0x536d01[_0x68c7('0x55')]['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0x39d227,null))[_0x68c7('0x1c')](function(_0x2a31c9){if(_0x2a31c9){_0x37106c[_0x68c7('0x41')]=_['keys'](db[_0x68c7('0x64')][_0x68c7('0x3e')]);_0x37106c[_0x68c7('0x42')]=_['keys'](_0x536d01[_0x68c7('0x42')]);_0x37106c[_0x68c7('0x44')]=_['intersection'](_0x37106c[_0x68c7('0x41')],_0x37106c[_0x68c7('0x42')]);_0x114c43['attributes']=_['intersection'](_0x37106c[_0x68c7('0x41')],qs[_0x68c7('0x46')](_0x536d01[_0x68c7('0x42')][_0x68c7('0x46')]));_0x114c43['attributes']=_0x114c43['attributes'][_0x68c7('0x47')]?_0x114c43['attributes']:_0x37106c[_0x68c7('0x41')];if(!_0x536d01['query'][_0x68c7('0x48')](_0x68c7('0x49'))){_0x114c43[_0x68c7('0x2e')]=qs[_0x68c7('0x2e')](_0x536d01['query'][_0x68c7('0x2e')]);_0x114c43['offset']=qs[_0x68c7('0x2c')](_0x536d01[_0x68c7('0x42')][_0x68c7('0x2c')]);}_0x114c43['order']=qs['sort'](_0x536d01[_0x68c7('0x42')][_0x68c7('0x4b')]);_0x114c43[_0x68c7('0x4d')]=qs[_0x68c7('0x44')](_['pick'](_0x536d01[_0x68c7('0x42')],_0x37106c['filters']));_0x114c43[_0x68c7('0x4d')][_0x68c7('0x62')]=_0x2a31c9['id'];if(_0x536d01[_0x68c7('0x42')][_0x68c7('0x4c')]){_0x114c43[_0x68c7('0x4d')]=_['merge'](_0x114c43[_0x68c7('0x4d')],{'$or':_[_0x68c7('0x3c')](_0x114c43[_0x68c7('0x45')],function(_0x35bf15){var _0x257cff={};_0x257cff[_0x35bf15]={'$like':'%'+_0x536d01[_0x68c7('0x42')][_0x68c7('0x4c')]+'%'};return _0x257cff;})});}_0x114c43=_['merge']({},_0x114c43,_0x536d01['options']);return db[_0x68c7('0x64')][_0x68c7('0x2f')]({'where':_0x114c43['where']})[_0x68c7('0x1c')](function(_0x3c0dfb){_0x95f6bc[_0x68c7('0x2f')]=_0x3c0dfb;if(_0x536d01['query'][_0x68c7('0x51')]){_0x114c43['include']=[{'all':!![]}];}return db[_0x68c7('0x64')][_0x68c7('0x52')](_0x114c43);})['then'](function(_0x47b603){_0x95f6bc[_0x68c7('0x53')]=_0x47b603;return _0x95f6bc;});}})[_0x68c7('0x1c')](respondWithFilteredResult(_0x39d227,_0x114c43))[_0x68c7('0x27')](handleError(_0x39d227,null));};exports[_0x68c7('0x65')]=function(_0x457540,_0x4430c1,_0x321313){return db[_0x68c7('0x3d')][_0x68c7('0x59')]({'where':{'id':_0x457540['params']['id']}})['then'](handleEntityNotFound(_0x4430c1,null))['then'](function(_0x48c5a4){if(_0x48c5a4){return _0x48c5a4[_0x68c7('0x65')](_0x457540[_0x68c7('0x42')][_0x68c7('0x66')]);}})[_0x68c7('0x1c')](respondWithStatusCode(_0x4430c1,null))[_0x68c7('0x27')](handleError(_0x4430c1,null));};exports[_0x68c7('0x67')]=function(_0x59a8fd,_0x232fdb,_0x1b5edc){if(_0x59a8fd[_0x68c7('0x60')]['id']){delete _0x59a8fd[_0x68c7('0x60')]['id'];}return db[_0x68c7('0x3d')][_0x68c7('0x59')]({'where':{'id':_0x59a8fd[_0x68c7('0x55')]['id']}})['then'](handleEntityNotFound(_0x232fdb,null))[_0x68c7('0x1c')](function(_0x50f4ef){if(_0x50f4ef){_0x59a8fd[_0x68c7('0x60')]['SmsAccountId']=_0x50f4ef['id'];return db[_0x68c7('0x68')][_0x68c7('0x5a')](_0x59a8fd[_0x68c7('0x60')]);}})[_0x68c7('0x1c')](respondWithResult(_0x232fdb,null))[_0x68c7('0x27')](handleError(_0x232fdb,null));};exports[_0x68c7('0x69')]=function(_0x492163,_0x3c033c,_0x5030c4){var _0x10b178={'raw':![],'where':{}};var _0x4d8109={};var _0x12f4e4={'count':0x0,'rows':[]};return db['SmsAccount'][_0x68c7('0x63')]({'where':{'id':_0x492163[_0x68c7('0x55')]['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0x3c033c,null))[_0x68c7('0x1c')](function(_0x1bf664){if(_0x1bf664){_0x4d8109[_0x68c7('0x41')]=_[_0x68c7('0x43')](db[_0x68c7('0x68')][_0x68c7('0x3e')]);_0x4d8109[_0x68c7('0x42')]=_[_0x68c7('0x43')](_0x492163[_0x68c7('0x42')]);_0x4d8109[_0x68c7('0x44')]=_[_0x68c7('0x57')](_0x4d8109[_0x68c7('0x41')],_0x4d8109['query']);_0x10b178['attributes']=_[_0x68c7('0x57')](_0x4d8109[_0x68c7('0x41')],qs['fields'](_0x492163['query'][_0x68c7('0x46')]));_0x10b178[_0x68c7('0x45')]=_0x10b178[_0x68c7('0x45')][_0x68c7('0x47')]?_0x10b178[_0x68c7('0x45')]:_0x4d8109['model'];if(!_0x492163[_0x68c7('0x42')]['hasOwnProperty'](_0x68c7('0x49'))){_0x10b178[_0x68c7('0x2e')]=qs[_0x68c7('0x2e')](_0x492163[_0x68c7('0x42')][_0x68c7('0x2e')]);_0x10b178[_0x68c7('0x2c')]=qs[_0x68c7('0x2c')](_0x492163[_0x68c7('0x42')][_0x68c7('0x2c')]);}_0x10b178[_0x68c7('0x4a')]=qs[_0x68c7('0x4b')](_0x492163[_0x68c7('0x42')][_0x68c7('0x4b')]);_0x10b178['where']=qs[_0x68c7('0x44')](_[_0x68c7('0x6a')](_0x492163['query'],_0x4d8109['filters']));_0x10b178[_0x68c7('0x4d')][_0x68c7('0x62')]=_0x1bf664['id'];if(_0x492163[_0x68c7('0x42')][_0x68c7('0x4c')]){_0x10b178['where']=_[_0x68c7('0x4e')](_0x10b178['where'],{'$or':_[_0x68c7('0x3c')](_0x10b178[_0x68c7('0x45')],function(_0x8b539f){var _0x59ef8e={};_0x59ef8e[_0x8b539f]={'$like':'%'+_0x492163[_0x68c7('0x42')][_0x68c7('0x4c')]+'%'};return _0x59ef8e;})});}_0x10b178=_['merge']({},_0x10b178,_0x492163[_0x68c7('0x50')]);return db[_0x68c7('0x68')][_0x68c7('0x2f')]({'where':_0x10b178[_0x68c7('0x4d')]})[_0x68c7('0x1c')](function(_0x4ad247){_0x12f4e4[_0x68c7('0x2f')]=_0x4ad247;if(_0x492163[_0x68c7('0x42')][_0x68c7('0x51')]){_0x10b178[_0x68c7('0x58')]=[{'all':!![]}];}return db[_0x68c7('0x68')][_0x68c7('0x52')](_0x10b178);})[_0x68c7('0x1c')](function(_0x304d1d){_0x12f4e4[_0x68c7('0x53')]=_0x304d1d;return _0x12f4e4;});}})['then'](respondWithFilteredResult(_0x3c033c,_0x10b178))[_0x68c7('0x27')](handleError(_0x3c033c,null));};exports[_0x68c7('0x6b')]=function(_0x59c724,_0x29b06a,_0x55e044){return db[_0x68c7('0x3d')]['find']({'where':{'id':_0x59c724[_0x68c7('0x55')]['id']}})['then'](handleEntityNotFound(_0x29b06a,null))['then'](function(_0x193ccc){if(_0x193ccc){return _0x193ccc['removeAnswers'](_0x59c724[_0x68c7('0x42')][_0x68c7('0x66')]);}})['then'](respondWithStatusCode(_0x29b06a,null))[_0x68c7('0x27')](handleError(_0x29b06a,null));};exports[_0x68c7('0x6c')]=function(_0x2e5cc2,_0xf5d897,_0xfe51a4){var _0x245e16={'channel':_0x68c7('0x6d')};var _0x30bf09=[];var _0x54d3d6=[];var _0x18eb00={};return db[_0x68c7('0x3d')][_0x68c7('0x59')]({'where':{'id':_0x2e5cc2['params']['id']},'include':[{'model':db[_0x68c7('0x6e')],'as':_0x68c7('0x6f')}]})[_0x68c7('0x1c')](handleEntityNotFound(_0xf5d897,null))[_0x68c7('0x1c')](function(_0x5e331e){_0x245e16[_0x68c7('0x70')]=_0x5e331e;_0x245e16[_0x68c7('0x71')]=_['orderBy'](_0x5e331e[_0x68c7('0x6f')],[_0x68c7('0x72')],[_0x68c7('0x73')]);if(_0x245e16[_0x68c7('0x70')]['Applications']){delete _0x245e16[_0x68c7('0x70')][_0x68c7('0x6f')];}return db['CmContact']['describe']();})[_0x68c7('0x1c')](function(_0x23a47d){if(!_0x23a47d){throw new db[(_0x68c7('0x74'))]['ValidationError'](_0x68c7('0x75'));}_0x30bf09=_['difference'](_[_0x68c7('0x43')](_0x23a47d),[_0x68c7('0x76'),'updatedAt']);_0x54d3d6=_[_0x68c7('0x77')](_[_0x68c7('0x43')](_0x23a47d),[_0x68c7('0x76'),_0x68c7('0x78'),_0x68c7('0x79'),_0x68c7('0x7a')]);_0x245e16[_0x68c7('0x60')]={'mapKey':_0x68c7('0x7b')};if(_0x245e16[_0x68c7('0x70')][_0x68c7('0x40')]){switch(_0x245e16['account']['type']){case'twilio':_0x245e16[_0x68c7('0x60')][_0x68c7('0x7c')]=_0x2e5cc2['body'][_0x68c7('0x7d')];_0x245e16[_0x68c7('0x60')][_0x68c7('0x60')]=_0x2e5cc2[_0x68c7('0x60')]['Body'];_0x245e16[_0x68c7('0x60')]['messageId']=_0x2e5cc2['body']['MessageSid'];break;case _0x68c7('0x7e'):_0x245e16[_0x68c7('0x60')][_0x68c7('0x7c')]='+'+_0x2e5cc2['body'][_0x68c7('0x7f')];_0x245e16[_0x68c7('0x60')][_0x68c7('0x60')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x80')];break;case'connectel':_0x245e16['body'][_0x68c7('0x7c')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x7c')];_0x245e16[_0x68c7('0x60')][_0x68c7('0x60')]=_0x2e5cc2[_0x68c7('0x60')]['message'];break;case'clicksend':_0x245e16[_0x68c7('0x60')]['from']=_0x2e5cc2[_0x68c7('0x60')]['from'];_0x245e16[_0x68c7('0x60')]['body']=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x60')];_0x245e16[_0x68c7('0x60')]['messageId']=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x81')];break;case _0x68c7('0x82'):_0x245e16[_0x68c7('0x60')]['from']=_0x2e5cc2['body'][_0x68c7('0x7d')];_0x245e16[_0x68c7('0x60')][_0x68c7('0x60')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x83')];_0x245e16[_0x68c7('0x60')][_0x68c7('0x84')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x85')];break;case'infobip':_0x245e16[_0x68c7('0x60')][_0x68c7('0x7c')]='+'+_0x2e5cc2['body']['results'][0x0][_0x68c7('0x7c')];_0x245e16[_0x68c7('0x60')][_0x68c7('0x60')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x86')][0x0]['text'];_0x245e16['body'][_0x68c7('0x84')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x86')][0x0]['messageId'];break;case _0x68c7('0x87'):_0x245e16['body'][_0x68c7('0x7c')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x88')];_0x245e16['body']['body']=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x89')]['message'];break;case'clickatell':_0x245e16[_0x68c7('0x60')][_0x68c7('0x7c')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x8a')];_0x245e16[_0x68c7('0x60')]['body']=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x80')];_0x245e16[_0x68c7('0x60')][_0x68c7('0x84')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x8b')];break;case _0x68c7('0x8c'):_0x245e16['body']['messageId']=_0x2e5cc2[_0x68c7('0x60')][0x0][_0x68c7('0x25')]['id'];_0x245e16[_0x68c7('0x60')]['from']=_0x2e5cc2[_0x68c7('0x60')][0x0][_0x68c7('0x25')][_0x68c7('0x7c')];_0x245e16['body'][_0x68c7('0x60')]=_0x2e5cc2[_0x68c7('0x60')][0x0][_0x68c7('0x25')]['text'];break;case _0x68c7('0x8d'):_0x245e16['body']['from']=_0x2e5cc2['body'][_0x68c7('0x7c')];_0x245e16[_0x68c7('0x60')][_0x68c7('0x60')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x25')];_0x245e16[_0x68c7('0x60')][_0x68c7('0x84')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x8e')];break;}}if(_0x245e16[_0x68c7('0x60')]['id']){delete _0x245e16['body']['id'];}if(_[_0x68c7('0x8f')](_0x245e16['body'][_0x68c7('0x7c')])){throw new db['Sequelize']['ValidationError'](_0x68c7('0x90'));}if(_[_0x68c7('0x8f')](_0x245e16[_0x68c7('0x60')][_0x68c7('0x60')])||_0x245e16['body']['body']===''){throw new db[(_0x68c7('0x74'))][(_0x68c7('0x91'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x68c7('0x8f')](_0x245e16[_0x68c7('0x60')]['mapKey'])){throw new db[(_0x68c7('0x74'))][(_0x68c7('0x91'))](_0x68c7('0x92')+_0x54d3d6);}if(!_[_0x68c7('0x93')](_0x54d3d6,_0x245e16[_0x68c7('0x60')][_0x68c7('0x94')])){throw new db[(_0x68c7('0x74'))][(_0x68c7('0x91'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x54d3d6);}_0x18eb00[_0x245e16[_0x68c7('0x60')][_0x68c7('0x94')]]=_0x245e16[_0x68c7('0x60')][_0x68c7('0x7c')];return db[_0x68c7('0x95')][_0x68c7('0x59')]({'where':{'id':_0x245e16[_0x68c7('0x70')]['ListId']},'include':[{'model':db[_0x68c7('0x96')],'as':_0x68c7('0x97'),'where':_0x18eb00,'limit':0x1,'order':[[_0x68c7('0x78'),_0x68c7('0x98')]]}]});})[_0x68c7('0x1c')](handleEntityNotFound(_0xf5d897,null))['then'](function(_0x196bbc){if(_0x196bbc){_0x245e16['list']=_[_0x68c7('0x99')](_0x196bbc,[_0x68c7('0x97')]);if(_0x196bbc['Contacts'][_0x68c7('0x47')]){return _0x196bbc[_0x68c7('0x97')][0x0];}var _0xf0ed2e=_['defaults'](_0x245e16[_0x68c7('0x60')],{'firstName':_0x245e16[_0x68c7('0x60')]['from'],'ListId':_0x196bbc['id']});_0xf0ed2e[_0x245e16[_0x68c7('0x60')][_0x68c7('0x94')]]=_0x245e16[_0x68c7('0x60')]['from'];return db['CmContact'][_0x68c7('0x5a')](_0xf0ed2e,{'fields':_0x30bf09,'raw':!![]});}})[_0x68c7('0x1c')](handleEntityNotFound(_0xf5d897,null))[_0x68c7('0x1c')](function(_0x1e0232){if(_0x1e0232){_0x245e16[_0x68c7('0x9a')]=_0x1e0232;var _0x5dfad7={'ContactId':_0x1e0232['id'],'phone':_0x245e16[_0x68c7('0x60')][_0x68c7('0x7c')],'SmsAccountId':_0x2e5cc2['params']['id']};var _0x5e6ac8={'ContactId':_0x1e0232['id'],'SmsAccountId':_0x2e5cc2[_0x68c7('0x55')]['id'],'closed':![]};return db[_0x68c7('0x9b')][_0x68c7('0x59')]({'where':_0x5e6ac8})[_0x68c7('0x1c')](function(_0x2a2b20){if(_0x2a2b20){return[_0x2a2b20,![]];}return db[_0x68c7('0x9b')][_0x68c7('0x5a')](_0x5dfad7)['then'](function(_0x1a117d){return[_0x1a117d,!![]];});});}})[_0x68c7('0x9c')](function(_0x53011a,_0x54caf0){_0x245e16[_0x68c7('0x9d')]=_0x53011a[_0x68c7('0x34')]({'plain':!![]});_0x245e16[_0x68c7('0x9d')][_0x68c7('0x9e')]=![];if(_0x54caf0){if(_0x245e16['account'][_0x68c7('0x9f')]){_0x245e16['applications'][_0x68c7('0xa0')]({'id':0x0,'priority':_0x245e16['applications'][_0x68c7('0x47')]+0x1,'app':_0x68c7('0xa1'),'appdata':_0x68c7('0xa2'),'interval':'*,*,*,*'});}_0x245e16[_0x68c7('0x9d')][_0x68c7('0x9e')]=!![];}return db['SmsMessage'][_0x68c7('0x5a')]({'phone':_0x245e16[_0x68c7('0x60')][_0x68c7('0x7c')],'messageId':_0x245e16[_0x68c7('0x60')][_0x68c7('0x84')],'body':_0x245e16[_0x68c7('0x60')][_0x68c7('0x60')],'SmsAccountId':_0x2e5cc2[_0x68c7('0x55')]['id'],'SmsInteractionId':_0x53011a['id'],'direction':'in','ContactId':_0x53011a[_0x68c7('0xa3')],'AttachmentId':_0x245e16[_0x68c7('0x60')][_0x68c7('0xa4')]});})[_0x68c7('0x1c')](function(_0x3f8d15){_0x245e16['message']=_0x3f8d15;if(_0x245e16[_0x68c7('0x9d')][_0x68c7('0xa5')]){return db['User']['find']({'attributes':['id',_0x68c7('0x39')],'where':{'id':_0x245e16['interaction']['UserId']}})[_0x68c7('0x1c')](function(_0x37db10){if(_0x37db10){_0x245e16['applications'][_0x68c7('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x37db10[_0x68c7('0x39')]+','+(_0x245e16[_0x68c7('0x70')][_0x68c7('0xa7')]||0xa),'interval':_0x68c7('0xa8')});}return respondWithRpcPromise('Start',_0x68c7('0xa9'),_0x245e16);});}return respondWithRpcPromise(_0x68c7('0xaa'),_0x68c7('0xa9'),_0x245e16);})[_0x68c7('0x1c')](function(_0x16c120){if(_0x16c120){var _0x424e91=0xc8;var _0xc517a0=_0x68c7('0xab');logger['info'](_0x68c7('0x21'),_0xc517a0,_0x424e91,_0x68c7('0xac'));logger[_0x68c7('0x20')](_0x68c7('0xad'),_0xc517a0,_0x424e91,_0x68c7('0xac'),JSON[_0x68c7('0x22')](_0x16c120));if(_0x245e16[_0x68c7('0x70')][_0x68c7('0x40')]===_0x68c7('0xae')){return _0xf5d897[_0x68c7('0x2a')](_0x424e91)['set']('Content-Type',_0x68c7('0xaf'))['send'](_0x68c7('0xb0'));}else{return _0xf5d897['status'](_0x424e91)['json'](_0x16c120);}}})[_0x68c7('0x27')](handleError(_0xf5d897,null));};exports[_0x68c7('0xb1')]=function(_0x3708a6,_0x596d1c){var _0x249765=_0x3708a6['params']['id'];var _0x4c4029=_0x3708a6[_0x68c7('0x60')];var _0x508cc2=0xc8;var _0x24b5b4=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x68c7('0xb2')][_0x68c7('0xb3')]['ISOLATION_LEVELS'][_0x68c7('0xb4')]},function(_0x1be971){return db[_0x68c7('0x3d')][_0x68c7('0x63')]({'where':{'id':_0x249765},'transaction':_0x1be971})[_0x68c7('0x1c')](function(_0x1755ed){if(_0x1755ed){return db[_0x68c7('0x6e')]['destroy']({'where':{'SmsAccountId':_0x249765},'transaction':_0x1be971})[_0x68c7('0x1c')](function(){var _0x36ff25=_[_0x68c7('0x3c')](_0x4c4029,function(_0x99127f){_0x99127f['SmsAccountId']=_0x249765;return _0x99127f;});return db[_0x68c7('0x6e')][_0x68c7('0xb5')](_0x36ff25,{'transaction':_0x1be971});});}else{_0x508cc2=0x194;_0x24b5b4=[];}});})['then'](function(){if(_0x508cc2!==0x194){return db[_0x68c7('0x6e')]['findAndCountAll']({'where':{'SmsAccountId':_0x249765},'order':'priority'})[_0x68c7('0x1c')](function(_0x11dbc2){_0x24b5b4=_0x11dbc2;});}})[_0x68c7('0x27')](function(_0x270350){_0x508cc2=0x1f4;logger[_0x68c7('0x23')](_0x270350[_0x68c7('0x38')]);if(_0x270350[_0x68c7('0x39')]){delete _0x270350[_0x68c7('0x39')];}_0x24b5b4=_0x270350;})['finally'](function(){if(_0x24b5b4===null){_0x596d1c[_0x68c7('0x28')](_0x508cc2);}else{if(_0x508cc2===0x1f4){_0x596d1c[_0x68c7('0x2a')](_0x508cc2)[_0x68c7('0xb6')](_0x24b5b4);}else{_0x596d1c[_0x68c7('0x2a')](_0x508cc2)['json'](_0x24b5b4);}}});};exports['getApplications']=function(_0x8e013a,_0x370597,_0x2864a3){var _0x46a60b={};var _0x8b222e={};var _0x435c59;var _0x16d0b0;return db[_0x68c7('0x3d')][_0x68c7('0x63')]({'where':{'id':_0x8e013a[_0x68c7('0x55')]['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0x370597,null))['then'](function(_0x2b6335){if(_0x2b6335){_0x435c59=_0x2b6335;_0x8b222e[_0x68c7('0x41')]=_[_0x68c7('0x43')](db['SmsApplication'][_0x68c7('0x3e')]);_0x8b222e[_0x68c7('0x42')]=_['keys'](_0x8e013a[_0x68c7('0x42')]);_0x8b222e[_0x68c7('0x44')]=_['intersection'](_0x8b222e[_0x68c7('0x41')],_0x8b222e[_0x68c7('0x42')]);_0x46a60b[_0x68c7('0x45')]=_[_0x68c7('0x57')](_0x8b222e[_0x68c7('0x41')],qs['fields'](_0x8e013a[_0x68c7('0x42')]['fields']));_0x46a60b['attributes']=_0x46a60b[_0x68c7('0x45')][_0x68c7('0x47')]?_0x46a60b['attributes']:_0x8b222e[_0x68c7('0x41')];_0x46a60b['order']=qs[_0x68c7('0x4b')](_0x8e013a[_0x68c7('0x42')]['sort']);_0x46a60b[_0x68c7('0x4d')]=qs[_0x68c7('0x44')](_[_0x68c7('0x6a')](_0x8e013a[_0x68c7('0x42')],_0x8b222e[_0x68c7('0x44')]));if(_0x8e013a[_0x68c7('0x42')]['filter']){_0x46a60b[_0x68c7('0x4d')]=_[_0x68c7('0x4e')](_0x46a60b[_0x68c7('0x4d')],{'$or':_[_0x68c7('0x3c')](_0x46a60b[_0x68c7('0x45')],function(_0x2638fd){var _0xbf6432={};_0xbf6432[_0x2638fd]={'$like':'%'+_0x8e013a['query']['filter']+'%'};return _0xbf6432;})});}_0x46a60b=_['merge']({},_0x46a60b,_0x8e013a[_0x68c7('0x50')]);return _0x435c59[_0x68c7('0xb7')](_0x46a60b);}})[_0x68c7('0x1c')](function(_0x54ba19){if(_0x54ba19){_0x16d0b0=_0x54ba19[_0x68c7('0x47')];if(!_0x8e013a[_0x68c7('0x42')][_0x68c7('0x48')]('nolimit')){_0x46a60b['limit']=qs[_0x68c7('0x2e')](_0x8e013a[_0x68c7('0x42')][_0x68c7('0x2e')]);_0x46a60b[_0x68c7('0x2c')]=qs[_0x68c7('0x2c')](_0x8e013a['query'][_0x68c7('0x2c')]);}return _0x435c59['getApplications'](_0x46a60b);}})[_0x68c7('0x1c')](function(_0x50f1b3){if(_0x50f1b3){return _0x50f1b3?{'count':_0x16d0b0,'rows':_0x50f1b3}:null;}})[_0x68c7('0x1c')](respondWithResult(_0x370597,null))[_0x68c7('0x27')](handleError(_0x370597,null));};exports[_0x68c7('0xb8')]=function(_0x3bb124,_0x3c72e1,_0x5d53f5){var _0x5db3d8={'raw':![],'where':{}};var _0x19dbeb={};var _0x5ebfcc={'count':0x0,'rows':[]};return db[_0x68c7('0x3d')][_0x68c7('0x63')]({'where':{'id':_0x3bb124[_0x68c7('0x55')]['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0x3c72e1,null))[_0x68c7('0x1c')](function(_0x5da704){if(_0x5da704){_0x19dbeb[_0x68c7('0x41')]=_[_0x68c7('0x43')](db[_0x68c7('0x9b')]['rawAttributes']);_0x19dbeb['query']=_['keys'](_0x3bb124[_0x68c7('0x42')]);_0x19dbeb[_0x68c7('0x44')]=_[_0x68c7('0x57')](_0x19dbeb[_0x68c7('0x41')],_0x19dbeb['query']);_0x5db3d8[_0x68c7('0x45')]=_[_0x68c7('0x57')](_0x19dbeb['model'],qs[_0x68c7('0x46')](_0x3bb124[_0x68c7('0x42')]['fields']));_0x5db3d8[_0x68c7('0x45')]=_0x5db3d8[_0x68c7('0x45')][_0x68c7('0x47')]?_0x5db3d8[_0x68c7('0x45')]:_0x19dbeb[_0x68c7('0x41')];if(!_0x3bb124['query'][_0x68c7('0x48')](_0x68c7('0x49'))){_0x5db3d8[_0x68c7('0x2e')]=qs['limit'](_0x3bb124[_0x68c7('0x42')]['limit']);_0x5db3d8[_0x68c7('0x2c')]=qs[_0x68c7('0x2c')](_0x3bb124['query'][_0x68c7('0x2c')]);}_0x5db3d8[_0x68c7('0x4a')]=qs[_0x68c7('0x4b')](_0x3bb124[_0x68c7('0x42')]['sort']);_0x5db3d8[_0x68c7('0x4d')]=qs[_0x68c7('0x44')](_[_0x68c7('0x6a')](_0x3bb124[_0x68c7('0x42')],_0x19dbeb[_0x68c7('0x44')]));_0x5db3d8[_0x68c7('0x4d')][_0x68c7('0x62')]=_0x5da704['id'];if(_0x3bb124[_0x68c7('0x42')]['filter']){_0x5db3d8[_0x68c7('0x4d')]=_[_0x68c7('0x4e')](_0x5db3d8[_0x68c7('0x4d')],{'$or':_['map'](_0x5db3d8[_0x68c7('0x45')],function(_0x4a131f){var _0x5ec63={};_0x5ec63[_0x4a131f]={'$like':'%'+_0x3bb124['query']['filter']+'%'};return _0x5ec63;})});}_0x5db3d8=_[_0x68c7('0x4e')]({},_0x5db3d8,_0x3bb124[_0x68c7('0x50')]);return db[_0x68c7('0x9b')][_0x68c7('0x2f')]({'where':_0x5db3d8[_0x68c7('0x4d')]})['then'](function(_0x583404){_0x5ebfcc['count']=_0x583404;if(_0x3bb124[_0x68c7('0x42')][_0x68c7('0x51')]){_0x5db3d8[_0x68c7('0x58')]=[{'model':db[_0x68c7('0x96')],'as':_0x68c7('0xb9'),'required':![]},{'model':db['User'],'as':_0x68c7('0xba'),'attributes':[_0x68c7('0x39'),_0x68c7('0xbb'),'internal'],'required':![]},{'model':db[_0x68c7('0xbc')],'as':_0x68c7('0xbd'),'attributes':['id',_0x68c7('0x39'),_0x68c7('0xbe')],'where':_0x3bb124[_0x68c7('0x42')][_0x68c7('0xbf')]?{'id':_0x3bb124[_0x68c7('0x42')][_0x68c7('0xbf')]}:undefined,'required':_0x3bb124[_0x68c7('0x42')][_0x68c7('0xbf')]?!![]:![]}];}return db[_0x68c7('0x9b')]['findAll'](_0x5db3d8);})[_0x68c7('0x1c')](function(_0x40d9ce){_0x5ebfcc['rows']=_0x40d9ce;return _0x5ebfcc;});}})[_0x68c7('0x1c')](respondWithFilteredResult(_0x3c72e1,_0x5db3d8))[_0x68c7('0x27')](handleError(_0x3c72e1,null));};exports[_0x68c7('0xb6')]=function(_0x1c34cf,_0x528649,_0x459e82){var _0x538aed,_0x1e81df,_0x9152e8;if(_['isNil'](_0x1c34cf[_0x68c7('0x60')][_0x68c7('0x60')])||_0x1c34cf[_0x68c7('0x60')][_0x68c7('0x60')]===''){throw new db['Sequelize'][(_0x68c7('0x91'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x68c7('0x8f')](_0x1c34cf['body']['to'])){throw new db[(_0x68c7('0x74'))][(_0x68c7('0x91'))](_0x68c7('0xc0'));}_0x538aed=_0x1c34cf[_0x68c7('0x60')]['to'];return db[_0x68c7('0x3d')]['find']({'where':{'id':_0x1c34cf['params']['id']},'include':[{'model':db[_0x68c7('0x95')],'as':'List','include':[{'model':db['CmContact'],'as':_0x68c7('0x97'),'where':{'mobile':_0x538aed},'limit':0x1,'order':[[_0x68c7('0x78'),_0x68c7('0x98')]]}]}]})['then'](handleEntityNotFound(_0x528649,null))[_0x68c7('0x1c')](function(_0x137831){if(_0x137831&&_0x137831[_0x68c7('0xc1')]){_0x1e81df=_0x137831[_0x68c7('0x34')]({'plain':!![]});if(_0x1e81df[_0x68c7('0xc1')]&&_0x1e81df['List'][_0x68c7('0x97')]['length']){return _0x1e81df['List'][_0x68c7('0x97')][0x0];}return db[_0x68c7('0x96')]['create'](_['defaults'](_0x1c34cf['body'],{'firstName':_0x538aed,'mobile':_0x538aed,'phone':_0x538aed,'ListId':_0x1e81df[_0x68c7('0x7a')]}));}})['then'](handleEntityNotFound(_0x528649,null))[_0x68c7('0x1c')](function(_0x578e4c){if(_0x578e4c){_0x9152e8=_0x578e4c;return db[_0x68c7('0x9b')][_0x68c7('0x59')]({'where':{'ContactId':_0x9152e8['id'],'closed':![],'SmsAccountId':_0x1e81df['id']}})['then'](function(_0x2bb290){if(_0x2bb290){return[_0x2bb290,![]];}return db[_0x68c7('0x9b')]['create']({'UserId':_0x1c34cf[_0x68c7('0x5d')]['id'],'ContactId':_0x9152e8['id'],'SmsAccountId':_0x1e81df['id'],'phone':_0x538aed,'firstMsgDirection':_0x68c7('0xc2'),'Messages':[_['merge'](_0x1c34cf['body'],{'read':![],'body':_0x1c34cf[_0x68c7('0x60')]['body'],'phone':_0x538aed,'SmsAccountId':_0x1e81df['id'],'UserId':_0x1c34cf['user']['id'],'ContactId':_0x9152e8['id']})]},{'include':[{'model':db[_0x68c7('0xc3')],'as':_0x68c7('0xc4')}]})['then'](function(_0x3e6759){return[_0x3e6759,!![]];});});}})['spread'](function(_0xe96788,_0x3ecaf1){if(_0x3ecaf1){return _0xe96788;}return db[_0x68c7('0xc3')][_0x68c7('0x5a')](_[_0x68c7('0x4e')](_0x1c34cf[_0x68c7('0x60')],{'read':![],'body':_0x1c34cf[_0x68c7('0x60')][_0x68c7('0x60')],'phone':_0x538aed,'SmsAccountId':_0x1e81df['id'],'SmsInteractionId':_0xe96788['id'],'UserId':_0x1c34cf['user']['id'],'ContactId':_0x9152e8['id']}))[_0x68c7('0x1c')](function(_0x3e734c){_0xe96788[_0x68c7('0xc5')]['Messages']=[];_0xe96788['dataValues'][_0x68c7('0xc4')][_0x68c7('0xa0')](_0x3e734c[_0x68c7('0xc5')]);return _0xe96788;});})[_0x68c7('0x1c')](respondWithResult(_0x528649,null))['catch'](handleError(_0x528649,null));};exports[_0x68c7('0x2a')]=function(_0x2a341a,_0xe373d2,_0xf435b2){if(_0x2a341a[_0x68c7('0x60')]['id']){delete _0x2a341a[_0x68c7('0x60')]['id'];}var _0x54563a,_0x395761,_0x3f0d2c;return db[_0x68c7('0x3d')][_0x68c7('0x59')]({'where':{'id':_0x2a341a[_0x68c7('0x55')]['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0xe373d2,null))[_0x68c7('0x1c')](function(_0x56d11c){if(_0x56d11c){_0x3f0d2c=_0x56d11c;logger[_0x68c7('0x20')](_0x68c7('0x21'),_0x68c7('0x2a'),_0x68c7('0xc6'),_0x56d11c[_0x68c7('0x40')],util[_0x68c7('0xc7')](_0x2a341a[_0x68c7('0x60')],{'showHidden':![],'depth':null}));switch(_0x56d11c[_0x68c7('0x40')]){case _0x68c7('0x7e'):if(_0x2a341a['body']['skebby_dispatch_id']&&_0x2a341a[_0x68c7('0x60')][_0x68c7('0x2a')]){_0x395761=_0x2a341a[_0x68c7('0x60')][_0x68c7('0x2a')];return db[_0x68c7('0xc3')][_0x68c7('0x59')]({'where':{'messageId':_0x2a341a['body'][_0x68c7('0xc8')]}});}break;case _0x68c7('0xc9'):if(_0x2a341a[_0x68c7('0x60')][_0x68c7('0xca')]&&_0x2a341a[_0x68c7('0x60')]['statusInt']){_0x395761=_0x2a341a[_0x68c7('0x60')][_0x68c7('0xcb')];return db[_0x68c7('0xc3')]['find']({'where':{'messageId':_0x2a341a[_0x68c7('0x60')][_0x68c7('0xca')]}});}break;case _0x68c7('0xcc'):if(_0x2a341a[_0x68c7('0x60')][_0x68c7('0x81')]&&_0x2a341a['body'][_0x68c7('0xcd')]){_0x395761=_0x2a341a[_0x68c7('0x60')]['status_code'];return db[_0x68c7('0xc3')][_0x68c7('0x59')]({'where':{'messageId':_0x2a341a['body']['message_id']}});}break;case _0x68c7('0xce'):var _0x55549f=_0x2a341a[_0x68c7('0x60')]['results'][0x0];if(_0x55549f['messageId']&&_0x55549f[_0x68c7('0x2a')]['groupName']===_0x68c7('0xcf')){_0x395761=_0x55549f[_0x68c7('0x2a')][_0x68c7('0xd0')];return db[_0x68c7('0xc3')][_0x68c7('0x59')]({'where':{'messageId':_0x55549f[_0x68c7('0x84')]}});}break;case _0x68c7('0xd1'):if(_0x2a341a[_0x68c7('0x60')][_0x68c7('0x84')]&&_0x2a341a[_0x68c7('0x60')][_0x68c7('0x2a')]){_0x395761=_0x2a341a[_0x68c7('0x60')][_0x68c7('0x2a')];return db['SmsMessage'][_0x68c7('0x59')]({'where':{'messageId':_0x2a341a['body'][_0x68c7('0x84')]}});}break;case _0x68c7('0x8c'):if(_0x2a341a[_0x68c7('0x60')][0x0]['message']['id']){_0x395761=_0x2a341a[_0x68c7('0x60')][0x0]['type'];return db['SmsMessage'][_0x68c7('0x59')]({'where':{'messageId':_0x2a341a['body'][0x0][_0x68c7('0x25')]['id']}});}break;case _0x68c7('0x8d'):if(_0x2a341a[_0x68c7('0x60')][_0x68c7('0xd2')]&&_0x2a341a[_0x68c7('0x60')]['status']){_0x395761=_0x2a341a[_0x68c7('0x60')][_0x68c7('0x2a')];return db['SmsMessage'][_0x68c7('0x59')]({'where':{'messageId':_0x2a341a[_0x68c7('0x60')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0xe373d2,null))[_0x68c7('0x1c')](function(_0x2721d2){if(_0x2721d2){_0x54563a=_0x2721d2;switch(_0x3f0d2c[_0x68c7('0x40')]){case'skebby':if(_0x395761==='DELIVERED'){return _0x54563a[_0x68c7('0x33')]({'read':!![]});}else{logger[_0x68c7('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x68c7('0x2a'),_0x68c7('0x7e'),util[_0x68c7('0xc7')](_0x2a341a['body'],{'showHidden':![],'depth':null}));}break;case _0x68c7('0xc9'):if(_0x395761==='1'){return _0x54563a[_0x68c7('0x33')]({'read':!![]});}else{logger[_0x68c7('0x23')](_0x68c7('0x21'),'status',_0x68c7('0x7e'),util[_0x68c7('0xc7')](_0x2a341a['body'],{'showHidden':![],'depth':null}));}break;case _0x68c7('0xcc'):if(!_0x2a341a[_0x68c7('0x60')][_0x68c7('0xd3')]&&_0x395761>=0xc8&&_0x395761<=0xce){return _0x54563a[_0x68c7('0x33')]({'read':!![]});}else{logger[_0x68c7('0x23')](_0x68c7('0x21'),_0x68c7('0x2a'),_0x68c7('0xcc'),util[_0x68c7('0xc7')](_0x2a341a[_0x68c7('0x60')],{'showHidden':![],'depth':null}));}break;case _0x68c7('0xce'):var _0x415dc4=_0x2a341a[_0x68c7('0x60')][_0x68c7('0x86')][0x0];if(_0x415dc4[_0x68c7('0x2a')][_0x68c7('0xd0')]==='DELIVERED'){return _0x54563a[_0x68c7('0x33')]({'read':!![]});}else{logger[_0x68c7('0x23')](_0x68c7('0x21'),_0x68c7('0x2a'),_0x68c7('0xce'),util[_0x68c7('0xc7')](_0x2a341a[_0x68c7('0x60')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x395761=='DELIVERED_TO_GATEWAY'||_0x395761==_0x68c7('0xd4')){return _0x54563a[_0x68c7('0x33')]({'read':!![]});}else{logger[_0x68c7('0x23')](_0x68c7('0x21'),_0x68c7('0x2a'),_0x68c7('0xd1'),util[_0x68c7('0xc7')](_0x2a341a['body'],{'showHidden':![],'depth':null}));}break;case _0x68c7('0x8c'):if(_0x395761==_0x68c7('0xd5')){return _0x54563a[_0x68c7('0x33')]({'read':!![]});}else{logger[_0x68c7('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','bandwidth',util[_0x68c7('0xc7')](_0x2a341a[_0x68c7('0x60')],{'showHidden':![],'depth':null}));}break;case _0x68c7('0x8d'):if(_0x395761===_0x68c7('0xd6')||_0x395761===_0x68c7('0xd7')){return _0x54563a[_0x68c7('0x33')]({'read':!![]});}else{logger[_0x68c7('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x68c7('0x8d'),util[_0x68c7('0xc7')](_0x2a341a[_0x68c7('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x54563a;}})['then'](respondWithResult(_0xe373d2,null))[_0x68c7('0x27')](handleError(_0xe373d2,null));};exports[_0x68c7('0xd8')]=function(_0x4faed6,_0x20e976,_0x209ee2){var _0x5934fc,_0x2fd19b,_0x563e22;return db[_0x68c7('0x3d')][_0x68c7('0x59')]({'where':{'id':_0x4faed6['params']['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0x20e976,null))[_0x68c7('0x1c')](function(_0x287046){if(_0x287046){_0x563e22=_0x287046;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x68c7('0x2a'),_0x68c7('0xc6'),_0x287046[_0x68c7('0x40')],util[_0x68c7('0xc7')](_0x4faed6[_0x68c7('0x42')],{'showHidden':![],'depth':null}));switch(_0x287046[_0x68c7('0x40')]){case _0x68c7('0x87'):if(_0x4faed6[_0x68c7('0x42')][_0x68c7('0xd9')]&&_0x4faed6[_0x68c7('0x42')][_0x68c7('0xda')]){_0x2fd19b=_0x4faed6[_0x68c7('0x42')][_0x68c7('0xda')];return db[_0x68c7('0xc3')][_0x68c7('0x59')]({'where':{'messageId':_0x4faed6[_0x68c7('0x42')][_0x68c7('0xd9')]}});}break;}}})[_0x68c7('0x1c')](handleEntityNotFound(_0x20e976,null))[_0x68c7('0x1c')](function(_0xb7f89c){if(_0xb7f89c){_0x5934fc=_0xb7f89c;switch(_0x563e22[_0x68c7('0x40')]){case _0x68c7('0x87'):if(_0x2fd19b==='2'||_0x2fd19b==='6'){return _0x5934fc[_0x68c7('0x33')]({'read':!![]});}else{logger[_0x68c7('0x23')](_0x68c7('0x21'),_0x68c7('0x2a'),_0x68c7('0x87'),util[_0x68c7('0xc7')](_0x4faed6[_0x68c7('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x5934fc;}})[_0x68c7('0x1c')](respondWithResult(_0x20e976,null))[_0x68c7('0x27')](handleError(_0x20e976,null));};exports[_0x68c7('0xdb')]=function(_0x150e63,_0x2fefb1,_0x506ace){return db['SmsAccount'][_0x68c7('0x59')]({'where':{'id':_0x150e63['params']['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0x2fefb1,null))[_0x68c7('0x1c')](function(_0x441ddb){if(_0x441ddb){return _0x441ddb[_0x68c7('0xdb')](_0x150e63[_0x68c7('0x60')][_0x68c7('0x66')],_['omit'](_0x150e63[_0x68c7('0x60')],['ids','id'])||{})[_0x68c7('0x9c')](function(_0x304931){for(var _0x2cf803=0x0;_0x2cf803<_0x150e63[_0x68c7('0x60')]['ids']['length'];_0x2cf803+=0x1){socket[_0x68c7('0xdc')](_0x68c7('0xdd'),{'UserId':Number(_0x150e63[_0x68c7('0x60')][_0x68c7('0x66')][_0x2cf803]),'SmsAccountId':Number(_0x150e63[_0x68c7('0x55')]['id'])});}return _0x304931;});}})[_0x68c7('0x1c')](respondWithResult(_0x2fefb1,null))[_0x68c7('0x27')](handleError(_0x2fefb1,null));};exports[_0x68c7('0xde')]=function(_0x4063ff,_0xe5bcbc,_0x16dabb){return db['SmsAccount']['find']({'where':{'id':_0x4063ff[_0x68c7('0x55')]['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0xe5bcbc,null))[_0x68c7('0x1c')](function(_0x577bda){if(_0x577bda){return _0x577bda[_0x68c7('0xde')](_0x4063ff[_0x68c7('0x42')][_0x68c7('0x66')])[_0x68c7('0x1c')](function(){if(_[_0x68c7('0xdf')](_0x4063ff['query']['ids'])){for(var _0x4ec0a1=0x0;_0x4ec0a1<_0x4063ff[_0x68c7('0x42')][_0x68c7('0x66')][_0x68c7('0x47')];_0x4ec0a1+=0x1){socket['emit'](_0x68c7('0xe0'),{'UserId':Number(_0x4063ff['query'][_0x68c7('0x66')][_0x4ec0a1]),'SmsAccountId':Number(_0x4063ff[_0x68c7('0x55')]['id'])});}}else{socket[_0x68c7('0xdc')](_0x68c7('0xe0'),{'UserId':Number(_0x4063ff[_0x68c7('0x42')][_0x68c7('0x66')]),'SmsAccountId':Number(_0x4063ff['params']['id'])});}});}})[_0x68c7('0x1c')](respondWithStatusCode(_0xe5bcbc,null))[_0x68c7('0x27')](handleError(_0xe5bcbc,null));};exports[_0x68c7('0xe1')]=function(_0xf4caf2,_0x23ecf5,_0x5bc875){var _0x136d2e={};var _0x5c0590={};var _0xab363a;var _0x4aad75;return db[_0x68c7('0x3d')][_0x68c7('0x63')]({'where':{'id':_0xf4caf2[_0x68c7('0x55')]['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0x23ecf5,null))['then'](function(_0x31a943){if(_0x31a943){_0xab363a=_0x31a943;_0x5c0590[_0x68c7('0x41')]=_[_0x68c7('0x43')](db[_0x68c7('0xe2')][_0x68c7('0x3e')]);_0x5c0590[_0x68c7('0x42')]=_['keys'](_0xf4caf2[_0x68c7('0x42')]);_0x5c0590['filters']=_['intersection'](_0x5c0590[_0x68c7('0x41')],_0x5c0590['query']);_0x136d2e[_0x68c7('0x45')]=_[_0x68c7('0x57')](_0x5c0590[_0x68c7('0x41')],qs['fields'](_0xf4caf2[_0x68c7('0x42')][_0x68c7('0x46')]));_0x136d2e['attributes']=_0x136d2e[_0x68c7('0x45')]['length']?_0x136d2e['attributes']:_0x5c0590['model'];_0x136d2e[_0x68c7('0x4a')]=qs['sort'](_0xf4caf2[_0x68c7('0x42')][_0x68c7('0x4b')]);_0x136d2e[_0x68c7('0x4d')]=qs[_0x68c7('0x44')](_[_0x68c7('0x6a')](_0xf4caf2[_0x68c7('0x42')],_0x5c0590[_0x68c7('0x44')]));if(_0xf4caf2[_0x68c7('0x42')]['filter']){_0x136d2e[_0x68c7('0x4d')]=_['merge'](_0x136d2e[_0x68c7('0x4d')],{'$or':_['map'](_0x136d2e[_0x68c7('0x45')],function(_0x54ebef){var _0x10668c={};_0x10668c[_0x54ebef]={'$like':'%'+_0xf4caf2[_0x68c7('0x42')][_0x68c7('0x4c')]+'%'};return _0x10668c;})});}_0x136d2e=_[_0x68c7('0x4e')]({},_0x136d2e,_0xf4caf2[_0x68c7('0x50')]);return _0xab363a['getAgents'](_0x136d2e);}})[_0x68c7('0x1c')](function(_0x5998bc){if(_0x5998bc){_0x4aad75=_0x5998bc[_0x68c7('0x47')];if(!_0xf4caf2['query']['hasOwnProperty'](_0x68c7('0x49'))){_0x136d2e[_0x68c7('0x2e')]=qs[_0x68c7('0x2e')](_0xf4caf2['query'][_0x68c7('0x2e')]);_0x136d2e['offset']=qs['offset'](_0xf4caf2[_0x68c7('0x42')]['offset']);}return _0xab363a[_0x68c7('0xe1')](_0x136d2e);}})[_0x68c7('0x1c')](function(_0x2d6fad){if(_0x2d6fad){return _0x2d6fad?{'count':_0x4aad75,'rows':_0x2d6fad}:null;}})[_0x68c7('0x1c')](respondWithResult(_0x23ecf5,null))[_0x68c7('0x27')](handleError(_0x23ecf5,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index d449d31..a868497 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 _0x9df1=['remove','emit','events','SmsAccount','setMaxListeners','save','update'];(function(_0x992616,_0x237351){var _0x1fe0f5=function(_0x4c5e06){while(--_0x4c5e06){_0x992616['push'](_0x992616['shift']());}};_0x1fe0f5(++_0x237351);}(_0x9df1,0x1a6));var _0x19df=function(_0x18e403,_0x2bbc79){_0x18e403=_0x18e403-0x0;var _0x4dbca8=_0x9df1[_0x18e403];return _0x4dbca8;};'use strict';var EventEmitter=require(_0x19df('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x19df('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x19df('0x2')](0x0);var events={'afterCreate':_0x19df('0x3'),'afterUpdate':_0x19df('0x4'),'afterDestroy':_0x19df('0x5')};function emitEvent(_0x548b6a){return function(_0x2d0d0e,_0x3b7ce4,_0x658137){SmsAccountEvents[_0x19df('0x6')](_0x548b6a+':'+_0x2d0d0e['id'],_0x2d0d0e);SmsAccountEvents[_0x19df('0x6')](_0x548b6a,_0x2d0d0e);_0x658137(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xa7ed=['emit','hasOwnProperty','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','remove'];(function(_0x5f1f63,_0x158cae){var _0x23b60b=function(_0x5e4048){while(--_0x5e4048){_0x5f1f63['push'](_0x5f1f63['shift']());}};_0x23b60b(++_0x158cae);}(_0xa7ed,0xae));var _0xda7e=function(_0xb0726a,_0x151a13){_0xb0726a=_0xb0726a-0x0;var _0xd6ab02=_0xa7ed[_0xb0726a];return _0xd6ab02;};'use strict';var EventEmitter=require(_0xda7e('0x0'));var SmsAccount=require(_0xda7e('0x1'))['db'][_0xda7e('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xda7e('0x3')](0x0);var events={'afterCreate':_0xda7e('0x4'),'afterUpdate':'update','afterDestroy':_0xda7e('0x5')};function emitEvent(_0x3953d0){return function(_0x2641ad,_0xb7f5a,_0x485b69){SmsAccountEvents[_0xda7e('0x6')](_0x3953d0+':'+_0x2641ad['id'],_0x2641ad);SmsAccountEvents[_0xda7e('0x6')](_0x3953d0,_0x2641ad);_0x485b69(null);};}for(var e in events){if(events[_0xda7e('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xda7e('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index a2025bc..f164ea1 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 _0xd6ac=['./smsAccount.attributes','exports','define','sms_accounts','lodash','util','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x1ea5a5,_0x22e0d9){var _0x317464=function(_0x1cc220){while(--_0x1cc220){_0x1ea5a5['push'](_0x1ea5a5['shift']());}};_0x317464(++_0x22e0d9);}(_0xd6ac,0x1c7));var _0xcd6a=function(_0x173dec,_0x4e1613){_0x173dec=_0x173dec-0x0;var _0x99b13b=_0xd6ac[_0x173dec];return _0x99b13b;};'use strict';var _=require(_0xcd6a('0x0'));var util=require(_0xcd6a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcd6a('0x2'));var BPromise=require(_0xcd6a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd6a('0x4'));var rimraf=require(_0xcd6a('0x5'));var config=require(_0xcd6a('0x6'));var attributes=require(_0xcd6a('0x7'));module[_0xcd6a('0x8')]=function(_0xf8ab0d,_0xda72e){return _0xf8ab0d[_0xcd6a('0x9')]('SmsAccount',attributes,{'tableName':_0xcd6a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc3b=['api','moment','bluebird','request-promise','path','rimraf','./smsAccount.attributes','exports','define','sms_accounts','lodash','../../config/logger'];(function(_0x2fc6c8,_0x458af3){var _0x5d89e1=function(_0x24e57){while(--_0x24e57){_0x2fc6c8['push'](_0x2fc6c8['shift']());}};_0x5d89e1(++_0x458af3);}(_0xdc3b,0x1ae));var _0xbdc3=function(_0x355353,_0x53c2aa){_0x355353=_0x355353-0x0;var _0x2091d3=_0xdc3b[_0x355353];return _0x2091d3;};'use strict';var _=require(_0xbdc3('0x0'));var util=require('util');var logger=require(_0xbdc3('0x1'))(_0xbdc3('0x2'));var moment=require(_0xbdc3('0x3'));var BPromise=require(_0xbdc3('0x4'));var rp=require(_0xbdc3('0x5'));var fs=require('fs');var path=require(_0xbdc3('0x6'));var rimraf=require(_0xbdc3('0x7'));var config=require('../../config/environment');var attributes=require(_0xbdc3('0x8'));module[_0xbdc3('0x9')]=function(_0x4bd66d,_0x5ab9ea){return _0x4bd66d[_0xbdc3('0xa')]('SmsAccount',attributes,{'tableName':_0xbdc3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index bfcf2c2..400dc70 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 _0x501f=['message','SmsAccount,\x20%s,\x20%s','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model','map','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x8c0bf5,_0x2456ab){var _0x447387=function(_0x4c2469){while(--_0x4c2469){_0x8c0bf5['push'](_0x8c0bf5['shift']());}};_0x447387(++_0x2456ab);}(_0x501f,0xa2));var _0xf501=function(_0x3ebc72,_0x5f14de){_0x3ebc72=_0x3ebc72-0x0;var _0x562eb8=_0x501f[_0x3ebc72];return _0x562eb8;};'use strict';var _=require(_0xf501('0x0'));var util=require(_0xf501('0x1'));var moment=require(_0xf501('0x2'));var BPromise=require(_0xf501('0x3'));var rs=require(_0xf501('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf501('0x5'));var logger=require(_0xf501('0x6'))('rpc');var config=require(_0xf501('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf501('0x8')]({'port':0x232a});config[_0xf501('0x9')]=_[_0xf501('0xa')](config[_0xf501('0x9')],{'host':_0xf501('0xb'),'port':0x18eb});var socket=require(_0xf501('0xc'))(new Redis(config[_0xf501('0x9')]));require(_0xf501('0xd'))[_0xf501('0xe')](socket);function respondWithRpcPromise(_0x541280,_0x1ecce2,_0x30afdd){return new BPromise(function(_0x212c83,_0x4689b6){return client[_0xf501('0xf')](_0x541280,_0x30afdd)[_0xf501('0x10')](function(_0x1521c1){logger[_0xf501('0x11')]('SmsAccount,\x20%s,\x20%s',_0x1ecce2,_0xf501('0x12'));logger['debug'](_0xf501('0x13'),_0x1ecce2,_0xf501('0x12'),JSON[_0xf501('0x14')](_0x1521c1));if(_0x1521c1[_0xf501('0x15')]){if(_0x1521c1[_0xf501('0x15')][_0xf501('0x16')]===0x1f4){logger[_0xf501('0x15')]('SmsAccount,\x20%s,\x20%s',_0x1ecce2,_0x1521c1[_0xf501('0x15')][_0xf501('0x17')]);return _0x4689b6(_0x1521c1['error']['message']);}logger[_0xf501('0x15')](_0xf501('0x18'),_0x1ecce2,_0x1521c1['error'][_0xf501('0x17')]);return _0x212c83(_0x1521c1[_0xf501('0x15')][_0xf501('0x17')]);}else{logger[_0xf501('0x11')]('SmsAccount,\x20%s,\x20%s',_0x1ecce2,_0xf501('0x12'));_0x212c83(_0x1521c1['result'][_0xf501('0x17')]);}})[_0xf501('0x19')](function(_0x793042){logger[_0xf501('0x15')](_0xf501('0x18'),_0x1ecce2,_0x793042);_0x4689b6(_0x793042);});});}exports[_0xf501('0x1a')]=function(_0x36178b){var _0x516f67=this;return new Promise(function(_0x7f4448,_0x755eba){return db[_0xf501('0x1b')][_0xf501('0x1c')]({'raw':_0x36178b[_0xf501('0x1d')]?_0x36178b[_0xf501('0x1d')][_0xf501('0x1e')]===undefined?!![]:![]:!![],'where':_0x36178b[_0xf501('0x1d')]?_0x36178b[_0xf501('0x1d')][_0xf501('0x1f')]||null:null,'attributes':_0x36178b['options']?_0x36178b['options'][_0xf501('0x20')]||null:null,'include':_0x36178b[_0xf501('0x1d')]?_0x36178b['options'][_0xf501('0x21')]?_['map'](_0x36178b[_0xf501('0x1d')]['include'],function(_0x1fe3d5){return{'model':db[_0x1fe3d5[_0xf501('0x22')]],'as':_0x1fe3d5['as'],'attributes':_0x1fe3d5[_0xf501('0x20')],'include':_0x1fe3d5[_0xf501('0x21')]?_[_0xf501('0x23')](_0x1fe3d5[_0xf501('0x21')],function(_0x308784){return{'model':db[_0x308784[_0xf501('0x22')]],'as':_0x308784['as'],'attributes':_0x308784[_0xf501('0x20')],'include':_0x308784[_0xf501('0x21')]?_['map'](_0x308784[_0xf501('0x21')],function(_0x3b9800){return{'model':db[_0x3b9800[_0xf501('0x22')]],'as':_0x3b9800['as'],'attributes':_0x3b9800['attributes']};}):[]};}):[]};}):[]:[]})[_0xf501('0x10')](function(_0x4bd131){logger[_0xf501('0x11')](_0xf501('0x1a'),_0x36178b);logger[_0xf501('0x24')](_0xf501('0x1a'),_0x36178b,JSON['stringify'](_0x4bd131));_0x7f4448(_0x4bd131);})[_0xf501('0x19')](function(_0x522153){logger[_0xf501('0x15')]('ShowSmsAccount',_0x522153['message'],_0x36178b);_0x755eba(_0x516f67[_0xf501('0x15')](0x1f4,_0x522153[_0xf501('0x17')]));});});}; \ No newline at end of file +var _0x1986=['debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model','map','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x3cac67,_0x438f03){var _0x508db9=function(_0xc11ec4){while(--_0xc11ec4){_0x3cac67['push'](_0x3cac67['shift']());}};_0x508db9(++_0x438f03);}(_0x1986,0x10e));var _0x6198=function(_0x2b31df,_0x39fd87){_0x2b31df=_0x2b31df-0x0;var _0x411b73=_0x1986[_0x2b31df];return _0x411b73;};'use strict';var _=require('lodash');var util=require(_0x6198('0x0'));var moment=require(_0x6198('0x1'));var BPromise=require(_0x6198('0x2'));var rs=require(_0x6198('0x3'));var fs=require('fs');var Redis=require(_0x6198('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6198('0x5'));var logger=require(_0x6198('0x6'))(_0x6198('0x7'));var config=require('../../config/environment');var jayson=require(_0x6198('0x8'));var client=jayson['client'][_0x6198('0x9')]({'port':0x232a});config[_0x6198('0xa')]=_['defaults'](config[_0x6198('0xa')],{'host':_0x6198('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6198('0xc'))[_0x6198('0xd')](socket);function respondWithRpcPromise(_0x33a2fe,_0xd82342,_0x587d36){return new BPromise(function(_0x14f8b7,_0x2dcfe1){return client['request'](_0x33a2fe,_0x587d36)[_0x6198('0xe')](function(_0x1fa6eb){logger[_0x6198('0xf')](_0x6198('0x10'),_0xd82342,_0x6198('0x11'));logger[_0x6198('0x12')](_0x6198('0x13'),_0xd82342,_0x6198('0x11'),JSON[_0x6198('0x14')](_0x1fa6eb));if(_0x1fa6eb['error']){if(_0x1fa6eb[_0x6198('0x15')][_0x6198('0x16')]===0x1f4){logger[_0x6198('0x15')](_0x6198('0x10'),_0xd82342,_0x1fa6eb[_0x6198('0x15')][_0x6198('0x17')]);return _0x2dcfe1(_0x1fa6eb[_0x6198('0x15')]['message']);}logger[_0x6198('0x15')](_0x6198('0x10'),_0xd82342,_0x1fa6eb[_0x6198('0x15')][_0x6198('0x17')]);return _0x14f8b7(_0x1fa6eb['error'][_0x6198('0x17')]);}else{logger['info'](_0x6198('0x10'),_0xd82342,'request\x20sent');_0x14f8b7(_0x1fa6eb[_0x6198('0x18')][_0x6198('0x17')]);}})[_0x6198('0x19')](function(_0x4f3183){logger['error'](_0x6198('0x10'),_0xd82342,_0x4f3183);_0x2dcfe1(_0x4f3183);});});}exports[_0x6198('0x1a')]=function(_0x3b0dba){var _0x2cb2e9=this;return new Promise(function(_0x15c2ff,_0x5036bf){return db[_0x6198('0x1b')][_0x6198('0x1c')]({'raw':_0x3b0dba[_0x6198('0x1d')]?_0x3b0dba[_0x6198('0x1d')][_0x6198('0x1e')]===undefined?!![]:![]:!![],'where':_0x3b0dba['options']?_0x3b0dba[_0x6198('0x1d')][_0x6198('0x1f')]||null:null,'attributes':_0x3b0dba[_0x6198('0x1d')]?_0x3b0dba['options'][_0x6198('0x20')]||null:null,'include':_0x3b0dba[_0x6198('0x1d')]?_0x3b0dba[_0x6198('0x1d')][_0x6198('0x21')]?_['map'](_0x3b0dba[_0x6198('0x1d')][_0x6198('0x21')],function(_0x2089ba){return{'model':db[_0x2089ba[_0x6198('0x22')]],'as':_0x2089ba['as'],'attributes':_0x2089ba[_0x6198('0x20')],'include':_0x2089ba[_0x6198('0x21')]?_[_0x6198('0x23')](_0x2089ba[_0x6198('0x21')],function(_0x6ac644){return{'model':db[_0x6ac644[_0x6198('0x22')]],'as':_0x6ac644['as'],'attributes':_0x6ac644[_0x6198('0x20')],'include':_0x6ac644[_0x6198('0x21')]?_[_0x6198('0x23')](_0x6ac644[_0x6198('0x21')],function(_0x2ee05d){return{'model':db[_0x2ee05d[_0x6198('0x22')]],'as':_0x2ee05d['as'],'attributes':_0x2ee05d[_0x6198('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6198('0xe')](function(_0x37520a){logger['info'](_0x6198('0x1a'),_0x3b0dba);logger['debug']('ShowSmsAccount',_0x3b0dba,JSON[_0x6198('0x14')](_0x37520a));_0x15c2ff(_0x37520a);})[_0x6198('0x19')](function(_0x845be4){logger[_0x6198('0x15')](_0x6198('0x1a'),_0x845be4['message'],_0x3b0dba);_0x5036bf(_0x2cb2e9[_0x6198('0x15')](0x1f4,_0x845be4[_0x6198('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index f97320a..2c27651 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 e503406..53c0885 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(_0x474c00,_0x26d9c4){var _0x593bce=function(_0x3103ae){while(--_0x3103ae){_0x474c00['push'](_0x474c00['shift']());}};_0x593bce(++_0x26d9c4);}(_0xedd9,0xfc));var _0x9edd=function(_0x339d0a,_0x152d67){_0x339d0a=_0x339d0a-0x0;var _0x7f1818=_0xedd9[_0x339d0a];return _0x7f1818;};'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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 7cf1ce3..18b9c97 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 _0xdd94=['*,*,*,*','sequelize','exports','noop','STRING'];(function(_0x11263d,_0x2a5701){var _0x850a0d=function(_0x307832){while(--_0x307832){_0x11263d['push'](_0x11263d['shift']());}};_0x850a0d(++_0x2a5701);}(_0xdd94,0x1c8));var _0x4dd9=function(_0x1bc32c,_0x5d267e){_0x1bc32c=_0x1bc32c-0x0;var _0x380aeb=_0xdd94[_0x1bc32c];return _0x380aeb;};'use strict';var Sequelize=require(_0x4dd9('0x0'));module[_0x4dd9('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4dd9('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4dd9('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x4dd9('0x4')}}; \ No newline at end of file +var _0x208f=['TEXT','sequelize','exports','STRING'];(function(_0x407a3e,_0x15acb0){var _0x129fe3=function(_0x124c2f){while(--_0x124c2f){_0x407a3e['push'](_0x407a3e['shift']());}};_0x129fe3(++_0x15acb0);}(_0x208f,0x7d));var _0xf208=function(_0x28e9d7,_0x5b4d79){_0x28e9d7=_0x28e9d7-0x0;var _0x256323=_0x208f[_0x28e9d7];return _0x256323;};'use strict';var Sequelize=require(_0xf208('0x0'));module[_0xf208('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf208('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf208('0x3')]()},'description':{'type':Sequelize[_0xf208('0x2')]},'interval':{'type':Sequelize[_0xf208('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 5f13ae8..dd348ed 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 _0xeff7=['map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','SmsApplication','includeAll','include','findAll','options','find','catch','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model'];(function(_0x194c71,_0x529556){var _0x4f360e=function(_0x57b958){while(--_0x57b958){_0x194c71['push'](_0x194c71['shift']());}};_0x4f360e(++_0x529556);}(_0xeff7,0x145));var _0x7eff=function(_0x551131,_0x52cb34){_0x551131=_0x551131-0x0;var _0x1e00c7=_0xeff7[_0x551131];return _0x1e00c7;};'use strict';var emlformat=require(_0x7eff('0x0'));var rimraf=require(_0x7eff('0x1'));var zipdir=require(_0x7eff('0x2'));var jsonpatch=require(_0x7eff('0x3'));var rp=require(_0x7eff('0x4'));var moment=require(_0x7eff('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7eff('0x6'));var path=require(_0x7eff('0x7'));var sox=require(_0x7eff('0x8'));var csv=require(_0x7eff('0x9'));var ejs=require(_0x7eff('0xa'));var fs=require('fs');var fs_extra=require(_0x7eff('0xb'));var _=require(_0x7eff('0xc'));var squel=require(_0x7eff('0xd'));var crypto=require(_0x7eff('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7eff('0x9'));var querystring=require(_0x7eff('0xf'));var Papa=require(_0x7eff('0x10'));var Redis=require(_0x7eff('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7eff('0x12'));var as=require(_0x7eff('0x13'));var hardwareService=require(_0x7eff('0x14'));var logger=require(_0x7eff('0x15'))(_0x7eff('0x16'));var utils=require('../../config/utils');var config=require(_0x7eff('0x17'));var licenseUtil=require(_0x7eff('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xafd5b7,_0x280189){_0x280189=_0x280189||0xcc;return function(_0x5a64aa){if(_0x5a64aa){return _0xafd5b7[_0x7eff('0x19')](_0x280189);}return _0xafd5b7[_0x7eff('0x1a')](_0x280189)[_0x7eff('0x1b')]();};}function respondWithResult(_0x92d879,_0x2af7dd){_0x2af7dd=_0x2af7dd||0xc8;return function(_0x26830f){if(_0x26830f){return _0x92d879[_0x7eff('0x1a')](_0x2af7dd)[_0x7eff('0x1c')](_0x26830f);}};}function respondWithFilteredResult(_0x470570,_0x21a617){return function(_0x11e397){if(_0x11e397){var _0x246b3e=typeof _0x21a617[_0x7eff('0x1d')]===_0x7eff('0x1e')&&typeof _0x21a617['limit']==='undefined';var _0x159db4=_0x11e397[_0x7eff('0x1f')];var _0x3e3f29=_0x246b3e?0x0:_0x21a617['offset'];var _0x6dbf26=_0x246b3e?_0x11e397[_0x7eff('0x1f')]:_0x21a617['offset']+_0x21a617[_0x7eff('0x20')];var _0x191028;if(_0x6dbf26>=_0x159db4){_0x6dbf26=_0x159db4;_0x191028=0xc8;}else{_0x191028=0xce;}_0x470570['status'](_0x191028);return _0x470570[_0x7eff('0x21')](_0x7eff('0x22'),_0x3e3f29+'-'+_0x6dbf26+'/'+_0x159db4)[_0x7eff('0x1c')](_0x11e397);}return null;};}function patchUpdates(_0x2e6108){return function(_0x116eaf){try{jsonpatch[_0x7eff('0x23')](_0x116eaf,_0x2e6108,!![]);}catch(_0x465a4f){return BPromise[_0x7eff('0x24')](_0x465a4f);}return _0x116eaf[_0x7eff('0x25')]();};}function saveUpdates(_0x5bd3bd,_0x57f842){return function(_0x46b5ca){if(_0x46b5ca){return _0x46b5ca['update'](_0x5bd3bd)[_0x7eff('0x26')](function(_0xd88d3f){return _0xd88d3f;});}return null;};}function removeEntity(_0x26874a,_0x538855){return function(_0x2886b6){if(_0x2886b6){return _0x2886b6[_0x7eff('0x27')]()[_0x7eff('0x26')](function(){_0x26874a[_0x7eff('0x1a')](0xcc)[_0x7eff('0x1b')]();});}};}function handleEntityNotFound(_0x2eaa71,_0x5f490a){return function(_0x15d052){if(!_0x15d052){_0x2eaa71[_0x7eff('0x19')](0x194);}return _0x15d052;};}function handleError(_0x37b3c5,_0x44b1d9){_0x44b1d9=_0x44b1d9||0x1f4;return function(_0x5cee76){logger[_0x7eff('0x28')](_0x5cee76[_0x7eff('0x29')]);if(_0x5cee76['name']){delete _0x5cee76[_0x7eff('0x2a')];}_0x37b3c5[_0x7eff('0x1a')](_0x44b1d9)[_0x7eff('0x2b')](_0x5cee76);};}exports[_0x7eff('0x2c')]=function(_0x3085b8,_0x4c7672){var _0x2d5603={},_0x10066d={},_0x173548={'count':0x0,'rows':[]};var _0x3c54b3=_['map'](db['SmsApplication'][_0x7eff('0x2d')],function(_0x149f8d){return{'name':_0x149f8d[_0x7eff('0x2e')],'type':_0x149f8d[_0x7eff('0x2f')][_0x7eff('0x30')]};});_0x10066d[_0x7eff('0x31')]=_[_0x7eff('0x32')](_0x3c54b3,_0x7eff('0x2a'));_0x10066d[_0x7eff('0x33')]=_[_0x7eff('0x34')](_0x3085b8[_0x7eff('0x33')]);_0x10066d[_0x7eff('0x35')]=_[_0x7eff('0x36')](_0x10066d['model'],_0x10066d[_0x7eff('0x33')]);_0x2d5603[_0x7eff('0x37')]=_['intersection'](_0x10066d['model'],qs[_0x7eff('0x38')](_0x3085b8[_0x7eff('0x33')][_0x7eff('0x38')]));_0x2d5603[_0x7eff('0x37')]=_0x2d5603['attributes'][_0x7eff('0x39')]?_0x2d5603[_0x7eff('0x37')]:_0x10066d[_0x7eff('0x31')];if(!_0x3085b8[_0x7eff('0x33')][_0x7eff('0x3a')]('nolimit')){_0x2d5603['limit']=qs[_0x7eff('0x20')](_0x3085b8[_0x7eff('0x33')]['limit']);_0x2d5603[_0x7eff('0x1d')]=qs[_0x7eff('0x1d')](_0x3085b8[_0x7eff('0x33')]['offset']);}_0x2d5603['order']=qs[_0x7eff('0x3b')](_0x3085b8[_0x7eff('0x33')]['sort']);_0x2d5603['where']=qs[_0x7eff('0x35')](_['pick'](_0x3085b8[_0x7eff('0x33')],_0x10066d[_0x7eff('0x35')]),_0x3c54b3);if(_0x3085b8['query'][_0x7eff('0x3c')]){_0x2d5603[_0x7eff('0x3d')]=_[_0x7eff('0x3e')](_0x2d5603['where'],{'$or':_[_0x7eff('0x32')](_0x3c54b3,function(_0x3ddfed){if(_0x3ddfed[_0x7eff('0x2f')]!==_0x7eff('0x3f')){var _0x527a07={};_0x527a07[_0x3ddfed[_0x7eff('0x2a')]]={'$like':'%'+_0x3085b8['query'][_0x7eff('0x3c')]+'%'};return _0x527a07;}})});}_0x2d5603=_[_0x7eff('0x3e')]({},_0x2d5603,_0x3085b8['options']);var _0x4e6268={'where':_0x2d5603[_0x7eff('0x3d')]};return db[_0x7eff('0x40')][_0x7eff('0x1f')](_0x4e6268)[_0x7eff('0x26')](function(_0x3db13b){_0x173548['count']=_0x3db13b;if(_0x3085b8[_0x7eff('0x33')][_0x7eff('0x41')]){_0x2d5603[_0x7eff('0x42')]=[{'all':!![]}];}return db['SmsApplication'][_0x7eff('0x43')](_0x2d5603);})[_0x7eff('0x26')](function(_0x5b0a26){_0x173548['rows']=_0x5b0a26;return _0x173548;})['then'](respondWithFilteredResult(_0x4c7672,_0x2d5603))['catch'](handleError(_0x4c7672,null));};exports['show']=function(_0xf59b88,_0xfa37c9){var _0x6de01a={'raw':!![],'where':{'id':_0xf59b88['params']['id']}},_0x41d511={};_0x41d511['model']=_[_0x7eff('0x34')](db[_0x7eff('0x40')]['rawAttributes']);_0x41d511[_0x7eff('0x33')]=_[_0x7eff('0x34')](_0xf59b88[_0x7eff('0x33')]);_0x41d511['filters']=_[_0x7eff('0x36')](_0x41d511[_0x7eff('0x31')],_0x41d511[_0x7eff('0x33')]);_0x6de01a[_0x7eff('0x37')]=_[_0x7eff('0x36')](_0x41d511['model'],qs['fields'](_0xf59b88['query'][_0x7eff('0x38')]));_0x6de01a[_0x7eff('0x37')]=_0x6de01a['attributes'][_0x7eff('0x39')]?_0x6de01a['attributes']:_0x41d511['model'];if(_0xf59b88[_0x7eff('0x33')][_0x7eff('0x41')]){_0x6de01a['include']=[{'all':!![]}];}_0x6de01a=_[_0x7eff('0x3e')]({},_0x6de01a,_0xf59b88[_0x7eff('0x44')]);return db[_0x7eff('0x40')][_0x7eff('0x45')](_0x6de01a)[_0x7eff('0x26')](handleEntityNotFound(_0xfa37c9,null))[_0x7eff('0x26')](respondWithResult(_0xfa37c9,null))[_0x7eff('0x46')](handleError(_0xfa37c9,null));};exports['create']=function(_0xb57596,_0x389a55){return db[_0x7eff('0x40')][_0x7eff('0x47')](_0xb57596[_0x7eff('0x48')],{})[_0x7eff('0x26')](respondWithResult(_0x389a55,0xc9))[_0x7eff('0x46')](handleError(_0x389a55,null));};exports[_0x7eff('0x49')]=function(_0x1b4203,_0x1c6dca){if(_0x1b4203[_0x7eff('0x48')]['id']){delete _0x1b4203[_0x7eff('0x48')]['id'];}return db[_0x7eff('0x40')][_0x7eff('0x45')]({'where':{'id':_0x1b4203[_0x7eff('0x4a')]['id']}})[_0x7eff('0x26')](handleEntityNotFound(_0x1c6dca,null))[_0x7eff('0x26')](saveUpdates(_0x1b4203['body'],null))[_0x7eff('0x26')](respondWithResult(_0x1c6dca,null))[_0x7eff('0x46')](handleError(_0x1c6dca,null));};exports[_0x7eff('0x27')]=function(_0x49a4a8,_0x29ada5){return db[_0x7eff('0x40')]['find']({'where':{'id':_0x49a4a8['params']['id']}})['then'](handleEntityNotFound(_0x29ada5,null))[_0x7eff('0x26')](removeEntity(_0x29ada5,null))['catch'](handleError(_0x29ada5,null));}; \ No newline at end of file +var _0x8a65=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','params','keys','includeAll','options','find','create','body','catch','update','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','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','offset','undefined','count','limit','set','Content-Range','json','reject','save','then','end','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','type','model','query','intersection'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x8a65,0x1dc));var _0x58a6=function(_0x49dba5,_0x1086fd){_0x49dba5=_0x49dba5-0x0;var _0x495fc6=_0x8a65[_0x49dba5];return _0x495fc6;};'use strict';var emlformat=require(_0x58a6('0x0'));var rimraf=require(_0x58a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x58a6('0x2'));var rp=require(_0x58a6('0x3'));var moment=require(_0x58a6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x58a6('0x5'));var util=require(_0x58a6('0x6'));var path=require(_0x58a6('0x7'));var sox=require('sox');var csv=require(_0x58a6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x58a6('0x9'));var _=require(_0x58a6('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x58a6('0xb'));var deskjs=require(_0x58a6('0xc'));var toCsv=require(_0x58a6('0x8'));var querystring=require(_0x58a6('0xd'));var Papa=require(_0x58a6('0xe'));var Redis=require(_0x58a6('0xf'));var authService=require(_0x58a6('0x10'));var qs=require(_0x58a6('0x11'));var as=require(_0x58a6('0x12'));var hardwareService=require(_0x58a6('0x13'));var logger=require('../../config/logger')(_0x58a6('0x14'));var utils=require(_0x58a6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x58a6('0x16'));var db=require(_0x58a6('0x17'))['db'];function respondWithStatusCode(_0x1d68ad,_0x2089b3){_0x2089b3=_0x2089b3||0xcc;return function(_0x3fadba){if(_0x3fadba){return _0x1d68ad[_0x58a6('0x18')](_0x2089b3);}return _0x1d68ad[_0x58a6('0x19')](_0x2089b3)['end']();};}function respondWithResult(_0x328ab0,_0x1664fa){_0x1664fa=_0x1664fa||0xc8;return function(_0x37f5a9){if(_0x37f5a9){return _0x328ab0[_0x58a6('0x19')](_0x1664fa)['json'](_0x37f5a9);}};}function respondWithFilteredResult(_0x495904,_0x1a4953){return function(_0x137698){if(_0x137698){var _0x2f9518=typeof _0x1a4953[_0x58a6('0x1a')]===_0x58a6('0x1b')&&typeof _0x1a4953['limit']===_0x58a6('0x1b');var _0x159ca3=_0x137698[_0x58a6('0x1c')];var _0x5515c3=_0x2f9518?0x0:_0x1a4953[_0x58a6('0x1a')];var _0x3dc5f3=_0x2f9518?_0x137698[_0x58a6('0x1c')]:_0x1a4953[_0x58a6('0x1a')]+_0x1a4953[_0x58a6('0x1d')];var _0x1c43c9;if(_0x3dc5f3>=_0x159ca3){_0x3dc5f3=_0x159ca3;_0x1c43c9=0xc8;}else{_0x1c43c9=0xce;}_0x495904['status'](_0x1c43c9);return _0x495904[_0x58a6('0x1e')](_0x58a6('0x1f'),_0x5515c3+'-'+_0x3dc5f3+'/'+_0x159ca3)[_0x58a6('0x20')](_0x137698);}return null;};}function patchUpdates(_0x44b8b1){return function(_0x38865d){try{jsonpatch['apply'](_0x38865d,_0x44b8b1,!![]);}catch(_0x283b8a){return BPromise[_0x58a6('0x21')](_0x283b8a);}return _0x38865d[_0x58a6('0x22')]();};}function saveUpdates(_0x5d37c0,_0x53b1f7){return function(_0x6b76d9){if(_0x6b76d9){return _0x6b76d9['update'](_0x5d37c0)[_0x58a6('0x23')](function(_0x21fd0a){return _0x21fd0a;});}return null;};}function removeEntity(_0x264d64,_0xa07407){return function(_0xf88b6c){if(_0xf88b6c){return _0xf88b6c['destroy']()[_0x58a6('0x23')](function(){_0x264d64['status'](0xcc)[_0x58a6('0x24')]();});}};}function handleEntityNotFound(_0x4cb5d1,_0x243c9d){return function(_0x2a7591){if(!_0x2a7591){_0x4cb5d1[_0x58a6('0x18')](0x194);}return _0x2a7591;};}function handleError(_0x420b14,_0x556319){_0x556319=_0x556319||0x1f4;return function(_0x3740bf){logger[_0x58a6('0x25')](_0x3740bf[_0x58a6('0x26')]);if(_0x3740bf['name']){delete _0x3740bf[_0x58a6('0x27')];}_0x420b14[_0x58a6('0x19')](_0x556319)[_0x58a6('0x28')](_0x3740bf);};}exports['index']=function(_0x560de3,_0x1db7bb){var _0x4f969f={},_0x312304={},_0x3f58e6={'count':0x0,'rows':[]};var _0x195e21=_[_0x58a6('0x29')](db[_0x58a6('0x2a')][_0x58a6('0x2b')],function(_0x433d57){return{'name':_0x433d57[_0x58a6('0x2c')],'type':_0x433d57[_0x58a6('0x2d')]['key']};});_0x312304[_0x58a6('0x2e')]=_[_0x58a6('0x29')](_0x195e21,_0x58a6('0x27'));_0x312304[_0x58a6('0x2f')]=_['keys'](_0x560de3['query']);_0x312304['filters']=_[_0x58a6('0x30')](_0x312304[_0x58a6('0x2e')],_0x312304[_0x58a6('0x2f')]);_0x4f969f['attributes']=_[_0x58a6('0x30')](_0x312304['model'],qs[_0x58a6('0x31')](_0x560de3[_0x58a6('0x2f')]['fields']));_0x4f969f[_0x58a6('0x32')]=_0x4f969f[_0x58a6('0x32')][_0x58a6('0x33')]?_0x4f969f[_0x58a6('0x32')]:_0x312304['model'];if(!_0x560de3[_0x58a6('0x2f')][_0x58a6('0x34')](_0x58a6('0x35'))){_0x4f969f[_0x58a6('0x1d')]=qs[_0x58a6('0x1d')](_0x560de3['query'][_0x58a6('0x1d')]);_0x4f969f[_0x58a6('0x1a')]=qs[_0x58a6('0x1a')](_0x560de3[_0x58a6('0x2f')][_0x58a6('0x1a')]);}_0x4f969f[_0x58a6('0x36')]=qs[_0x58a6('0x37')](_0x560de3[_0x58a6('0x2f')][_0x58a6('0x37')]);_0x4f969f[_0x58a6('0x38')]=qs[_0x58a6('0x39')](_[_0x58a6('0x3a')](_0x560de3['query'],_0x312304['filters']),_0x195e21);if(_0x560de3[_0x58a6('0x2f')][_0x58a6('0x3b')]){_0x4f969f[_0x58a6('0x38')]=_[_0x58a6('0x3c')](_0x4f969f[_0x58a6('0x38')],{'$or':_[_0x58a6('0x29')](_0x195e21,function(_0x17d923){if(_0x17d923['type']!==_0x58a6('0x3d')){var _0x521d46={};_0x521d46[_0x17d923[_0x58a6('0x27')]]={'$like':'%'+_0x560de3[_0x58a6('0x2f')][_0x58a6('0x3b')]+'%'};return _0x521d46;}})});}_0x4f969f=_[_0x58a6('0x3c')]({},_0x4f969f,_0x560de3['options']);var _0x5d8b9d={'where':_0x4f969f[_0x58a6('0x38')]};return db[_0x58a6('0x2a')]['count'](_0x5d8b9d)[_0x58a6('0x23')](function(_0x4772f4){_0x3f58e6[_0x58a6('0x1c')]=_0x4772f4;if(_0x560de3[_0x58a6('0x2f')]['includeAll']){_0x4f969f[_0x58a6('0x3e')]=[{'all':!![]}];}return db[_0x58a6('0x2a')][_0x58a6('0x3f')](_0x4f969f);})[_0x58a6('0x23')](function(_0x5d8300){_0x3f58e6[_0x58a6('0x40')]=_0x5d8300;return _0x3f58e6;})[_0x58a6('0x23')](respondWithFilteredResult(_0x1db7bb,_0x4f969f))['catch'](handleError(_0x1db7bb,null));};exports['show']=function(_0x1bd0ac,_0xa837e0){var _0x483fe7={'raw':!![],'where':{'id':_0x1bd0ac[_0x58a6('0x41')]['id']}},_0x411555={};_0x411555[_0x58a6('0x2e')]=_[_0x58a6('0x42')](db[_0x58a6('0x2a')][_0x58a6('0x2b')]);_0x411555[_0x58a6('0x2f')]=_[_0x58a6('0x42')](_0x1bd0ac['query']);_0x411555[_0x58a6('0x39')]=_[_0x58a6('0x30')](_0x411555[_0x58a6('0x2e')],_0x411555[_0x58a6('0x2f')]);_0x483fe7[_0x58a6('0x32')]=_[_0x58a6('0x30')](_0x411555['model'],qs[_0x58a6('0x31')](_0x1bd0ac['query'][_0x58a6('0x31')]));_0x483fe7['attributes']=_0x483fe7[_0x58a6('0x32')][_0x58a6('0x33')]?_0x483fe7['attributes']:_0x411555[_0x58a6('0x2e')];if(_0x1bd0ac[_0x58a6('0x2f')][_0x58a6('0x43')]){_0x483fe7[_0x58a6('0x3e')]=[{'all':!![]}];}_0x483fe7=_[_0x58a6('0x3c')]({},_0x483fe7,_0x1bd0ac[_0x58a6('0x44')]);return db[_0x58a6('0x2a')][_0x58a6('0x45')](_0x483fe7)[_0x58a6('0x23')](handleEntityNotFound(_0xa837e0,null))['then'](respondWithResult(_0xa837e0,null))['catch'](handleError(_0xa837e0,null));};exports[_0x58a6('0x46')]=function(_0x3deca6,_0x45bcba){return db[_0x58a6('0x2a')][_0x58a6('0x46')](_0x3deca6[_0x58a6('0x47')],{})[_0x58a6('0x23')](respondWithResult(_0x45bcba,0xc9))[_0x58a6('0x48')](handleError(_0x45bcba,null));};exports[_0x58a6('0x49')]=function(_0x5504f0,_0x3d54b9){if(_0x5504f0['body']['id']){delete _0x5504f0[_0x58a6('0x47')]['id'];}return db[_0x58a6('0x2a')][_0x58a6('0x45')]({'where':{'id':_0x5504f0[_0x58a6('0x41')]['id']}})[_0x58a6('0x23')](handleEntityNotFound(_0x3d54b9,null))[_0x58a6('0x23')](saveUpdates(_0x5504f0['body'],null))[_0x58a6('0x23')](respondWithResult(_0x3d54b9,null))['catch'](handleError(_0x3d54b9,null));};exports[_0x58a6('0x4a')]=function(_0x25f6b2,_0x42dbb6){return db[_0x58a6('0x2a')][_0x58a6('0x45')]({'where':{'id':_0x25f6b2[_0x58a6('0x41')]['id']}})[_0x58a6('0x23')](handleEntityNotFound(_0x42dbb6,null))['then'](removeEntity(_0x42dbb6,null))[_0x58a6('0x48')](handleError(_0x42dbb6,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 7441447..c004e1d 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 _0x3aea=['moment','request-promise','path','../../config/environment','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x1a9c75,_0xa83750){var _0xb2f37e=function(_0x2b90f6){while(--_0x2b90f6){_0x1a9c75['push'](_0x1a9c75['shift']());}};_0xb2f37e(++_0xa83750);}(_0x3aea,0xc9));var _0xa3ae=function(_0xf5a6f,_0x3d3933){_0xf5a6f=_0xf5a6f-0x0;var _0x5d6f31=_0x3aea[_0xf5a6f];return _0x5d6f31;};'use strict';var _=require(_0xa3ae('0x0'));var util=require('util');var logger=require(_0xa3ae('0x1'))(_0xa3ae('0x2'));var moment=require(_0xa3ae('0x3'));var BPromise=require('bluebird');var rp=require(_0xa3ae('0x4'));var fs=require('fs');var path=require(_0xa3ae('0x5'));var rimraf=require('rimraf');var config=require(_0xa3ae('0x6'));var attributes=require('./smsApplication.attributes');module[_0xa3ae('0x7')]=function(_0x2f1c79,_0x4b5cf2){return _0x2f1c79[_0xa3ae('0x8')]('SmsApplication',attributes,{'tableName':_0xa3ae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa3ae('0xa'),'collate':_0xa3ae('0xb')});}; \ No newline at end of file +var _0xe713=['rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','lodash','util','api','bluebird'];(function(_0x4a47e1,_0x28b1ca){var _0x3f321d=function(_0x5316d7){while(--_0x5316d7){_0x4a47e1['push'](_0x4a47e1['shift']());}};_0x3f321d(++_0x28b1ca);}(_0xe713,0x1dc));var _0x3e71=function(_0x512c83,_0x42a67a){_0x512c83=_0x512c83-0x0;var _0x1f7f25=_0xe713[_0x512c83];return _0x1f7f25;};'use strict';var _=require(_0x3e71('0x0'));var util=require(_0x3e71('0x1'));var logger=require('../../config/logger')(_0x3e71('0x2'));var moment=require('moment');var BPromise=require(_0x3e71('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3e71('0x4'));var config=require(_0x3e71('0x5'));var attributes=require(_0x3e71('0x6'));module[_0x3e71('0x7')]=function(_0x46cf5c,_0x52752c){return _0x46cf5c[_0x3e71('0x8')](_0x3e71('0x9'),attributes,{'tableName':_0x3e71('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3e71('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 f215c5b..3805317 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 _0xf5b6=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x2866b5,_0x438eaf){var _0x4deabd=function(_0x5cdbc3){while(--_0x5cdbc3){_0x2866b5['push'](_0x2866b5['shift']());}};_0x4deabd(++_0x438eaf);}(_0xf5b6,0x1b4));var _0x6f5b=function(_0x3887f1,_0x51d317){_0x3887f1=_0x3887f1-0x0;var _0x280933=_0xf5b6[_0x3887f1];return _0x280933;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f5b('0x0'));var BPromise=require(_0x6f5b('0x1'));var rs=require(_0x6f5b('0x2'));var fs=require('fs');var Redis=require(_0x6f5b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f5b('0x4'));var logger=require(_0x6f5b('0x5'))(_0x6f5b('0x6'));var config=require(_0x6f5b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6f5b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5cf395,_0x58899e,_0x4a8fe8){return new BPromise(function(_0x437f27,_0x5b97a4){return client[_0x6f5b('0x9')](_0x5cf395,_0x4a8fe8)[_0x6f5b('0xa')](function(_0x17692b){logger['info'](_0x6f5b('0xb'),_0x58899e,'request\x20sent');logger[_0x6f5b('0xc')](_0x6f5b('0xd'),_0x58899e,_0x6f5b('0xe'),JSON[_0x6f5b('0xf')](_0x17692b));if(_0x17692b[_0x6f5b('0x10')]){if(_0x17692b['error'][_0x6f5b('0x11')]===0x1f4){logger[_0x6f5b('0x10')](_0x6f5b('0xb'),_0x58899e,_0x17692b['error']['message']);return _0x5b97a4(_0x17692b[_0x6f5b('0x10')][_0x6f5b('0x12')]);}logger[_0x6f5b('0x10')](_0x6f5b('0xb'),_0x58899e,_0x17692b[_0x6f5b('0x10')][_0x6f5b('0x12')]);return _0x437f27(_0x17692b[_0x6f5b('0x10')]['message']);}else{logger[_0x6f5b('0x13')](_0x6f5b('0xb'),_0x58899e,'request\x20sent');_0x437f27(_0x17692b[_0x6f5b('0x14')][_0x6f5b('0x12')]);}})[_0x6f5b('0x15')](function(_0x344cf6){logger[_0x6f5b('0x10')](_0x6f5b('0xb'),_0x58899e,_0x344cf6);_0x5b97a4(_0x344cf6);});});} \ No newline at end of file +var _0x3a15=['code','error','message','SmsApplication,\x20%s,\x20%s','info','catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','http','request','then','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x5c2e5e,_0x2bc00e){var _0x46a5da=function(_0xf0fa38){while(--_0xf0fa38){_0x5c2e5e['push'](_0x5c2e5e['shift']());}};_0x46a5da(++_0x2bc00e);}(_0x3a15,0xde));var _0x53a1=function(_0x98020e,_0x109498){_0x98020e=_0x98020e-0x0;var _0x355f5e=_0x3a15[_0x98020e];return _0x355f5e;};'use strict';var _=require(_0x53a1('0x0'));var util=require('util');var moment=require(_0x53a1('0x1'));var BPromise=require('bluebird');var rs=require(_0x53a1('0x2'));var fs=require('fs');var Redis=require(_0x53a1('0x3'));var db=require(_0x53a1('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x53a1('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x53a1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a0168,_0x457bf4,_0x2ec206){return new BPromise(function(_0x439447,_0x5252d4){return client[_0x53a1('0x7')](_0x5a0168,_0x2ec206)[_0x53a1('0x8')](function(_0x49e45a){logger['info']('SmsApplication,\x20%s,\x20%s',_0x457bf4,_0x53a1('0x9'));logger[_0x53a1('0xa')](_0x53a1('0xb'),_0x457bf4,_0x53a1('0x9'),JSON['stringify'](_0x49e45a));if(_0x49e45a['error']){if(_0x49e45a['error'][_0x53a1('0xc')]===0x1f4){logger[_0x53a1('0xd')]('SmsApplication,\x20%s,\x20%s',_0x457bf4,_0x49e45a[_0x53a1('0xd')][_0x53a1('0xe')]);return _0x5252d4(_0x49e45a[_0x53a1('0xd')]['message']);}logger[_0x53a1('0xd')](_0x53a1('0xf'),_0x457bf4,_0x49e45a[_0x53a1('0xd')][_0x53a1('0xe')]);return _0x439447(_0x49e45a[_0x53a1('0xd')][_0x53a1('0xe')]);}else{logger[_0x53a1('0x10')](_0x53a1('0xf'),_0x457bf4,_0x53a1('0x9'));_0x439447(_0x49e45a['result'][_0x53a1('0xe')]);}})[_0x53a1('0x11')](function(_0x1793e0){logger[_0x53a1('0xd')](_0x53a1('0xf'),_0x457bf4,_0x1793e0);_0x5252d4(_0x1793e0);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 85cb2e2..9d18e26 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 _0x1775=['/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var fs_extra=require(_0x5177('0x5'));var auth=require(_0x5177('0x6'));var interaction=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var controller=require(_0x5177('0x9'));router[_0x5177('0xa')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0xc')]);router[_0x5177('0xa')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0xe')]);router[_0x5177('0xa')](_0x5177('0xf'),auth[_0x5177('0xb')](),controller[_0x5177('0x10')]);router[_0x5177('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0x5177('0x11')]);router[_0x5177('0xa')](_0x5177('0x12'),auth[_0x5177('0xb')](),controller[_0x5177('0x13')]);router['post']('/',auth[_0x5177('0xb')](),controller[_0x5177('0x14')]);router[_0x5177('0x15')](_0x5177('0x16'),auth[_0x5177('0xb')](),controller[_0x5177('0x17')]);router[_0x5177('0x15')](_0x5177('0x18'),auth[_0x5177('0xb')](),interaction[_0x5177('0x19')](_0x5177('0x1a'),_0x5177('0x1b')),controller[_0x5177('0x1c')]);router[_0x5177('0x1d')](_0x5177('0xf'),auth[_0x5177('0xb')](),interaction[_0x5177('0x19')](_0x5177('0x1a'),_0x5177('0x1e')),controller['update']);router[_0x5177('0x1f')](_0x5177('0xf'),auth[_0x5177('0xb')](),interaction[_0x5177('0x19')]('sms',_0x5177('0x20')),controller[_0x5177('0x21')]);router[_0x5177('0x1f')]('/:id/tags',auth[_0x5177('0xb')](),controller['removeTags']);module[_0x5177('0x22')]=router; \ No newline at end of file +var _0x0713=['put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','smsinteraction:addtags','addTags'];(function(_0x552bf3,_0x948538){var _0xa22eec=function(_0x5a4936){while(--_0x5a4936){_0x552bf3['push'](_0x552bf3['shift']());}};_0xa22eec(++_0x948538);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/download',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x11')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0x12')]);router['post']('/:id/messages',auth[_0x3071('0x9')](),controller['addMessage']);router[_0x3071('0x11')](_0x3071('0x13'),auth['isAuthenticated'](),interaction[_0x3071('0x14')]('sms',_0x3071('0x15')),controller[_0x3071('0x16')]);router[_0x3071('0x17')](_0x3071('0xd'),auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x19')),controller[_0x3071('0x1a')]);router[_0x3071('0x1b')]('/:id',auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x1c')),controller[_0x3071('0x1d')]);router[_0x3071('0x1b')](_0x3071('0x13'),auth[_0x3071('0x9')](),controller['removeTags']);module[_0x3071('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 0442630..170184e 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 _0x5e11=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x1132f9,_0x15d882){var _0x5c96bf=function(_0xe833bc){while(--_0xe833bc){_0x1132f9['push'](_0x1132f9['shift']());}};_0x5c96bf(++_0x15d882);}(_0x5e11,0x1c3));var _0x15e1=function(_0x3bb5b4,_0x128455){_0x3bb5b4=_0x3bb5b4-0x0;var _0x586c60=_0x5e11[_0x3bb5b4];return _0x586c60;};'use strict';var Sequelize=require(_0x15e1('0x0'));var moment=require('moment');module[_0x15e1('0x1')]={'closed':{'type':Sequelize[_0x15e1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x15e1('0x3')]},'disposition':{'type':Sequelize[_0x15e1('0x4')]},'secondDisposition':{'type':Sequelize[_0x15e1('0x4')]},'thirdDisposition':{'type':Sequelize[_0x15e1('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x15e1('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x15e1('0x5')]('in',_0x15e1('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x15e1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x15e1('0x5')]('in',_0x15e1('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x39b3=['DATE','ENUM','out','sequelize','BOOLEAN','STRING'];(function(_0x58035f,_0x4db6fe){var _0x230bf4=function(_0x38af0b){while(--_0x38af0b){_0x58035f['push'](_0x58035f['shift']());}};_0x230bf4(++_0x4db6fe);}(_0x39b3,0xc9));var _0x339b=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x39b3[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require(_0x339b('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x339b('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x339b('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x339b('0x2')]},'note':{'type':Sequelize[_0x339b('0x2')]},'phone':{'type':Sequelize[_0x339b('0x2')]},'read1stAt':{'type':Sequelize[_0x339b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x339b('0x4')]('in',_0x339b('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x339b('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x339b('0x4')]('in',_0x339b('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x339b('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 449e427..06e78be 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 _0x6e43=['filters','nolimit','order','sort','where','SmsInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','Tag','color','emit','unix','toString','join','server','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closed','closedAt','disposition','out','System','secret','value','renderFile','root','views','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','error','name','send','map','SmsInteraction','fieldName','key','getOptions','sms','query','user','catch','model','keys','rawAttributes','attributes','intersection','fields','length','includeAll','include','merge','options','body','find','params','destroy','describe','addMessage','SmsMessage','ids','omit','findOne'];(function(_0x386c54,_0x1ffdaf){var _0x263222=function(_0x13c615){while(--_0x13c615){_0x386c54['push'](_0x386c54['shift']());}};_0x263222(++_0x1ffdaf);}(_0x6e43,0x127));var _0x36e4=function(_0x582b25,_0x3a9182){_0x582b25=_0x582b25-0x0;var _0x1dba1f=_0x6e43[_0x582b25];return _0x1dba1f;};'use strict';var rimraf=require(_0x36e4('0x0'));var zipdir=require(_0x36e4('0x1'));var moment=require('moment');var BPromise=require(_0x36e4('0x2'));var util=require(_0x36e4('0x3'));var path=require(_0x36e4('0x4'));var ejs=require(_0x36e4('0x5'));var fs=require('fs');var _=require(_0x36e4('0x6'));var Redis=require(_0x36e4('0x7'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x36e4('0x8'));var logger=require(_0x36e4('0x9'))('api');var config=require(_0x36e4('0xa'));var db=require(_0x36e4('0xb'))['db'];config[_0x36e4('0xc')]=_[_0x36e4('0xd')](config['redis'],{'host':_0x36e4('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x36e4('0xc')]));require(_0x36e4('0xf'))[_0x36e4('0x10')](socket);function respondWithStatusCode(_0x35dfa5,_0xa676aa){_0xa676aa=_0xa676aa||0xcc;return function(_0x8b2e6){if(_0x8b2e6){return _0x35dfa5[_0x36e4('0x11')](_0xa676aa);}return _0x35dfa5[_0x36e4('0x12')](_0xa676aa)['end']();};}function respondWithResult(_0x1d3a9a,_0x5135dd){_0x5135dd=_0x5135dd||0xc8;return function(_0x482211){if(_0x482211){return _0x1d3a9a[_0x36e4('0x12')](_0x5135dd)[_0x36e4('0x13')](_0x482211);}};}function respondWithFilteredResult(_0x1657c1,_0x16490a){return function(_0x556e4f){if(_0x556e4f){var _0x12dd5c=typeof _0x16490a[_0x36e4('0x14')]===_0x36e4('0x15')&&typeof _0x16490a[_0x36e4('0x16')]===_0x36e4('0x15');var _0x5c354b=_0x556e4f[_0x36e4('0x17')];var _0x8e98ad=_0x12dd5c?0x0:_0x16490a[_0x36e4('0x14')];var _0x5513bd=_0x12dd5c?_0x556e4f['count']:_0x16490a['offset']+_0x16490a[_0x36e4('0x16')];var _0x4f291b;if(_0x5513bd>=_0x5c354b){_0x5513bd=_0x5c354b;_0x4f291b=0xc8;}else{_0x4f291b=0xce;}_0x1657c1[_0x36e4('0x12')](_0x4f291b);return _0x1657c1[_0x36e4('0x18')](_0x36e4('0x19'),_0x8e98ad+'-'+_0x5513bd+'/'+_0x5c354b)[_0x36e4('0x13')](_0x556e4f);}return null;};}function saveUpdates(_0x7e48c9){return function(_0x4a3fe8){if(_0x4a3fe8){return _0x4a3fe8[_0x36e4('0x1a')](_0x7e48c9)[_0x36e4('0x1b')](function(_0x29c7e6){return _0x29c7e6;});}return null;};}function removeEntity(_0x55859b){return function(_0x4fa6f8){if(_0x4fa6f8){return _0x4fa6f8['destroy']()[_0x36e4('0x1b')](function(){_0x55859b[_0x36e4('0x12')](0xcc)[_0x36e4('0x1c')]();});}};}function handleEntityNotFound(_0x5d4755){return function(_0x355254){if(!_0x355254){_0x5d4755[_0x36e4('0x11')](0x194);}return _0x355254;};}function handleError(_0x1270a5,_0x30a2ea){_0x30a2ea=_0x30a2ea||0x1f4;return function(_0x31ce12){logger[_0x36e4('0x1d')](_0x31ce12['stack']);if(_0x31ce12[_0x36e4('0x1e')]){delete _0x31ce12[_0x36e4('0x1e')];}_0x1270a5['status'](_0x30a2ea)[_0x36e4('0x1f')](_0x31ce12);};}exports['index']=function(_0x22457d,_0x5c5c0e){var _0x4a8fe6={};var _0x51043c=_[_0x36e4('0x20')](db[_0x36e4('0x21')]['rawAttributes'],function(_0x47b1ee){return{'name':_0x47b1ee[_0x36e4('0x22')],'type':_0x47b1ee['type'][_0x36e4('0x23')]};});_0x4a8fe6=qs[_0x36e4('0x24')](_0x51043c,_0x22457d);return interaction['findAll'](_0x36e4('0x25'),_0x22457d[_0x36e4('0x26')],_0x22457d[_0x36e4('0x27')],_0x4a8fe6,_0x51043c)[_0x36e4('0x1b')](respondWithFilteredResult(_0x5c5c0e,_0x4a8fe6))[_0x36e4('0x28')](handleError(_0x5c5c0e,null));};exports['show']=function(_0x5d17a8,_0x10dcbc){var _0x36ca6d={'raw':![],'where':{'id':_0x5d17a8['params']['id']}},_0x500c6e={};_0x500c6e[_0x36e4('0x29')]=_[_0x36e4('0x2a')](db[_0x36e4('0x21')][_0x36e4('0x2b')]);_0x500c6e[_0x36e4('0x26')]=_[_0x36e4('0x2a')](_0x5d17a8[_0x36e4('0x26')]);_0x500c6e['filters']=_['intersection'](_0x500c6e[_0x36e4('0x29')],_0x500c6e[_0x36e4('0x26')]);_0x36ca6d[_0x36e4('0x2c')]=_[_0x36e4('0x2d')](_0x500c6e['model'],qs[_0x36e4('0x2e')](_0x5d17a8[_0x36e4('0x26')][_0x36e4('0x2e')]));_0x36ca6d['attributes']=_0x36ca6d[_0x36e4('0x2c')][_0x36e4('0x2f')]?_0x36ca6d['attributes']:_0x500c6e[_0x36e4('0x29')];if(_0x5d17a8['query'][_0x36e4('0x30')]){_0x36ca6d[_0x36e4('0x31')]=[{'all':!![]}];}_0x36ca6d=_[_0x36e4('0x32')]({},_0x36ca6d,_0x5d17a8[_0x36e4('0x33')]);return db[_0x36e4('0x21')]['find'](_0x36ca6d)[_0x36e4('0x1b')](handleEntityNotFound(_0x10dcbc,null))[_0x36e4('0x1b')](respondWithResult(_0x10dcbc,null))[_0x36e4('0x28')](handleError(_0x10dcbc,null));};exports['create']=function(_0x1b1642,_0x889fc3){return db['SmsInteraction']['create'](_0x1b1642[_0x36e4('0x34')],{})[_0x36e4('0x1b')](respondWithResult(_0x889fc3,0xc9))[_0x36e4('0x28')](handleError(_0x889fc3,null));};exports[_0x36e4('0x1a')]=function(_0x2356fe,_0x224cff){if(_0x2356fe[_0x36e4('0x34')]['id']){delete _0x2356fe['body']['id'];}return db[_0x36e4('0x21')][_0x36e4('0x35')]({'where':{'id':_0x2356fe[_0x36e4('0x36')]['id']}})[_0x36e4('0x1b')](handleEntityNotFound(_0x224cff,null))['then'](saveUpdates(_0x2356fe[_0x36e4('0x34')],null))[_0x36e4('0x1b')](respondWithResult(_0x224cff,null))[_0x36e4('0x28')](handleError(_0x224cff,null));};exports[_0x36e4('0x37')]=function(_0x5836ac,_0x36660a){return db[_0x36e4('0x21')][_0x36e4('0x35')]({'where':{'id':_0x5836ac[_0x36e4('0x36')]['id']}})['then'](handleEntityNotFound(_0x36660a,null))[_0x36e4('0x1b')](removeEntity(_0x36660a,null))[_0x36e4('0x28')](handleError(_0x36660a,null));};exports[_0x36e4('0x38')]=function(_0x1e0c42,_0x15cb97){return db[_0x36e4('0x21')][_0x36e4('0x38')]()[_0x36e4('0x1b')](respondWithResult(_0x15cb97,null))[_0x36e4('0x28')](handleError(_0x15cb97,null));};exports[_0x36e4('0x39')]=function(_0x57c734,_0x51d655){return db[_0x36e4('0x3a')]['find']({'where':{'id':_0x57c734[_0x36e4('0x36')]['id']}})[_0x36e4('0x1b')](handleEntityNotFound(_0x51d655,null))['then'](function(_0xa58d28){if(_0xa58d28){return _0xa58d28[_0x36e4('0x39')](_0x57c734[_0x36e4('0x34')][_0x36e4('0x3b')],_[_0x36e4('0x3c')](_0x57c734[_0x36e4('0x34')],[_0x36e4('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x51d655,null))['catch'](handleError(_0x51d655,null));};exports['getMessages']=function(_0x43fa1,_0x219a76){var _0x39ac78={'raw':![],'where':{}};var _0x34aa69={};var _0x36fb9f={'count':0x0,'rows':[]};return db[_0x36e4('0x21')][_0x36e4('0x3d')]({'where':{'id':_0x43fa1['params']['id']}})[_0x36e4('0x1b')](handleEntityNotFound(_0x219a76,null))['then'](function(_0x13bcea){if(_0x13bcea){_0x34aa69[_0x36e4('0x29')]=_[_0x36e4('0x2a')](db[_0x36e4('0x3a')]['rawAttributes']);_0x34aa69[_0x36e4('0x26')]=_[_0x36e4('0x2a')](_0x43fa1[_0x36e4('0x26')]);_0x34aa69[_0x36e4('0x3e')]=_['intersection'](_0x34aa69['model'],_0x34aa69[_0x36e4('0x26')]);_0x39ac78[_0x36e4('0x2c')]=_[_0x36e4('0x2d')](_0x34aa69['model'],qs[_0x36e4('0x2e')](_0x43fa1['query'][_0x36e4('0x2e')]));_0x39ac78[_0x36e4('0x2c')]=_0x39ac78[_0x36e4('0x2c')]['length']?_0x39ac78[_0x36e4('0x2c')]:_0x34aa69['model'];if(!_0x43fa1[_0x36e4('0x26')]['hasOwnProperty'](_0x36e4('0x3f'))){_0x39ac78['limit']=qs['limit'](_0x43fa1[_0x36e4('0x26')]['limit']);_0x39ac78[_0x36e4('0x14')]=qs[_0x36e4('0x14')](_0x43fa1[_0x36e4('0x26')]['offset']);}_0x39ac78[_0x36e4('0x40')]=qs[_0x36e4('0x41')](_0x43fa1['query'][_0x36e4('0x41')]);_0x39ac78[_0x36e4('0x42')]=qs[_0x36e4('0x3e')](_['pick'](_0x43fa1[_0x36e4('0x26')],_0x34aa69[_0x36e4('0x3e')]));_0x39ac78[_0x36e4('0x42')][_0x36e4('0x43')]=_0x13bcea['id'];if(_0x43fa1[_0x36e4('0x26')][_0x36e4('0x44')]){_0x39ac78[_0x36e4('0x42')]=_['merge'](_0x39ac78['where'],{'$or':_['map'](_0x39ac78[_0x36e4('0x2c')],function(_0x57267a){var _0x1c96f7={};_0x1c96f7[_0x57267a]={'$like':'%'+_0x43fa1[_0x36e4('0x26')][_0x36e4('0x44')]+'%'};return _0x1c96f7;})});}if(_0x43fa1[_0x36e4('0x26')]['$gte']){var _0xfcd63a=_0x43fa1[_0x36e4('0x26')][_0x36e4('0x45')]['split'](',');var _0x318676={};_0x318676[_0xfcd63a[0x0]]={'$gte':moment(_0xfcd63a[0x1])[_0x36e4('0x46')](_0x36e4('0x47'))};_0x39ac78[_0x36e4('0x42')]=_[_0x36e4('0x32')](_0x39ac78[_0x36e4('0x42')],_0x318676);}_0x39ac78=_['merge']({},_0x39ac78,_0x43fa1[_0x36e4('0x33')]);return db['SmsMessage']['count']({'where':_0x39ac78[_0x36e4('0x42')]})[_0x36e4('0x1b')](function(_0x44eb3a){_0x36fb9f[_0x36e4('0x17')]=_0x44eb3a;if(_0x43fa1[_0x36e4('0x26')][_0x36e4('0x30')]){_0x39ac78[_0x36e4('0x31')]=[{'all':!![]}];}return db[_0x36e4('0x3a')][_0x36e4('0x48')](_0x39ac78);})['then'](function(_0xa714aa){_0x36fb9f['rows']=_0xa714aa;return _0x36fb9f;});}})[_0x36e4('0x1b')](respondWithFilteredResult(_0x219a76,_0x39ac78))[_0x36e4('0x28')](handleError(_0x219a76,null));};exports[_0x36e4('0x49')]=function(_0x1d858d,_0x19846f){return db[_0x36e4('0x21')][_0x36e4('0x35')]({'where':{'id':_0x1d858d['params']['id']}})[_0x36e4('0x1b')](handleEntityNotFound(_0x19846f,null))['then'](function(_0x42a4e8){if(_0x42a4e8){return _0x42a4e8[_0x36e4('0x4a')](_0x1d858d[_0x36e4('0x34')][_0x36e4('0x3b')],_['omit'](_0x1d858d[_0x36e4('0x34')],[_0x36e4('0x3b'),'id'])||{})[_0x36e4('0x4b')](function(){return db[_0x36e4('0x4c')][_0x36e4('0x48')]({'attributes':['id',_0x36e4('0x1e'),_0x36e4('0x4d')],'where':{'id':_0x1d858d[_0x36e4('0x34')][_0x36e4('0x3b')]}});})[_0x36e4('0x1b')](function(_0x4eb3c4){socket[_0x36e4('0x4e')]('smsInteractionTags:save',{'id':Number(_0x1d858d[_0x36e4('0x36')]['id']),'tags':_0x4eb3c4||[]});return{'id':Number(_0x1d858d[_0x36e4('0x36')]['id']),'tags':_0x4eb3c4||[]};});}})['then'](respondWithResult(_0x19846f,null))['catch'](handleError(_0x19846f,null));};exports['removeTags']=function(_0xeede78,_0x2674f5){return db[_0x36e4('0x21')][_0x36e4('0x35')]({'where':{'id':_0xeede78[_0x36e4('0x36')]['id']}})[_0x36e4('0x1b')](handleEntityNotFound(_0x2674f5,null))[_0x36e4('0x1b')](function(_0x341d31){if(_0x341d31){return _0x341d31['removeTags'](_0xeede78[_0x36e4('0x26')][_0x36e4('0x3b')]);}})[_0x36e4('0x1b')](respondWithStatusCode(_0x2674f5,null))[_0x36e4('0x28')](handleError(_0x2674f5,null));};exports['download']=function(_0x1b79b4,_0x34ae37){var _0x397f02=moment()[_0x36e4('0x4f')]()[_0x36e4('0x50')]();var _0x4c3be9=path[_0x36e4('0x51')](config['root'],_0x36e4('0x52'),'files','tmp');var _0x41a534=path[_0x36e4('0x51')](_0x4c3be9,_0x397f02);var _0x321e94=util[_0x36e4('0x46')](_0x36e4('0x53'),_0x1b79b4[_0x36e4('0x36')]['id'],_0x397f02);var _0x189501=path[_0x36e4('0x51')](_0x4c3be9,_0x321e94);var _0x3e90e7=[];_0x3e90e7[_0x36e4('0x54')]({'model':db[_0x36e4('0x55')],'as':_0x36e4('0x55'),'attributes':['id',_0x36e4('0x56')],'raw':!![]});_0x3e90e7[_0x36e4('0x54')]({'model':db[_0x36e4('0x57')],'as':_0x36e4('0x58'),'attributes':['id',_0x36e4('0x59'),_0x36e4('0x5a')],'raw':!![]});var _0x12e271=[{'model':db[_0x36e4('0x3a')],'as':_0x36e4('0x5b'),'attributes':['id','body',_0x36e4('0x5c'),_0x36e4('0x5d'),'secret',_0x36e4('0x5e')],'include':_0x3e90e7}];_0x12e271[_0x36e4('0x54')]({'model':db[_0x36e4('0x5f')],'as':_0x36e4('0x60'),'attributes':['id',_0x36e4('0x1e')]});_0x12e271[_0x36e4('0x54')]({'model':db[_0x36e4('0x55')],'as':_0x36e4('0x61'),'attributes':['id',_0x36e4('0x56')]});return db['SmsInteraction']['find']({'where':{'id':_0x1b79b4[_0x36e4('0x36')]['id']},'include':_0x12e271})[_0x36e4('0x1b')](handleEntityNotFound(_0x34ae37,null))[_0x36e4('0x1b')](function(_0x916d25){if(_0x916d25){var _0x179f65=_0x916d25[_0x36e4('0x62')]({'plain':!![]});fs[_0x36e4('0x63')](_0x41a534);var _0x306cf4={'channel':_0x36e4('0x64'),'account':_0x179f65[_0x36e4('0x60')][_0x36e4('0x1e')],'agent':_0x179f65['Owner']?_0x179f65[_0x36e4('0x61')][_0x36e4('0x56')]:_0x36e4('0x65'),'createdAt':moment(_0x179f65[_0x36e4('0x5c')])[_0x36e4('0x46')](_0x36e4('0x47'))[_0x36e4('0x50')](),'closedAt':_0x179f65[_0x36e4('0x66')]?moment(_0x179f65[_0x36e4('0x67')])[_0x36e4('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0x36e4('0x50')]():'','disposition':_0x179f65[_0x36e4('0x68')],'messages':_(_0x179f65[_0x36e4('0x5b')])[_0x36e4('0x44')]({'secret':![]})['map'](function(_0x32e7a4){return{'date':moment(_0x32e7a4[_0x36e4('0x5c')])[_0x36e4('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0x36e4('0x50')](),'sender':_0x32e7a4[_0x36e4('0x5d')]===_0x36e4('0x69')?_0x32e7a4[_0x36e4('0x55')]?_0x32e7a4[_0x36e4('0x55')][_0x36e4('0x56')]:_0x36e4('0x6a'):_0x32e7a4[_0x36e4('0x58')][_0x36e4('0x59')]+(_0x32e7a4[_0x36e4('0x58')][_0x36e4('0x5a')]?'\x20'+_0x32e7a4['Contact'][_0x36e4('0x5a')]:''),'body':_0x32e7a4['body'],'direction':_0x32e7a4[_0x36e4('0x5d')]===_0x36e4('0x69')?'A':'C','secret':_0x32e7a4[_0x36e4('0x6b')],'read':_0x32e7a4[_0x36e4('0x5e')]};})[_0x36e4('0x6c')]()};return ejs[_0x36e4('0x6d')](path[_0x36e4('0x51')](config[_0x36e4('0x6e')],'server',_0x36e4('0x6f'),'downloadInteraction.ejs'),{'interaction':_0x306cf4})[_0x36e4('0x1b')](function(_0x296304){var _0x694c8a=path[_0x36e4('0x51')](_0x41a534,_0x36e4('0x70')+_0x179f65['id']+'-'+_0x397f02+_0x36e4('0x71'));var _0x5ada12={'path':_0x694c8a,'channel':_0x36e4('0x64'),'interactionId':_0x179f65['id']};return pdf[_0x36e4('0x72')](_0x296304,_0x5ada12);})['then'](function(){return new BPromise(function(_0x348711,_0x1335a3){zipdir(_0x41a534,{'saveTo':_0x189501},function(_0x2ee5e6,_0x4d7de7){if(_0x2ee5e6)return _0x1335a3(_0x2ee5e6);return _0x348711(_0x4d7de7);});})[_0x36e4('0x1b')](function(){return new BPromise(function(_0x4ccfb0,_0x71519d){rimraf(_0x41a534,function(_0x4e9b33){if(_0x4e9b33)_0x71519d(_0x4e9b33);return _0x4ccfb0();});});})[_0x36e4('0x1b')](function(){return _0x34ae37[_0x36e4('0x73')](_0x189501,_0x321e94,function(_0x55fd65){if(_0x55fd65){console[_0x36e4('0x74')](_0x36e4('0x75'),_0x55fd65);}else{fs[_0x36e4('0x76')](_0x189501);}});});});}else{return _0x34ae37[_0x36e4('0x11')](0xc8);}})[_0x36e4('0x28')](handleError(_0x34ae37,null));}; \ No newline at end of file +var _0x044e=['transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Owner','get','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','bluebird','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','update','then','destroy','end','error','stack','name','index','SmsInteraction','fieldName','type','key','findAll','sms','query','user','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','create','body','find','describe','addMessage','SmsMessage','ids','omit','findOne','rawAttributes','limit','sort','where','SmsInteractionId','filter','map','$gte','addTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','server','files','tmp','format'];(function(_0x53a1e8,_0x182a82){var _0x51c12c=function(_0x4f7c5e){while(--_0x4f7c5e){_0x53a1e8['push'](_0x53a1e8['shift']());}};_0x51c12c(++_0x182a82);}(_0x044e,0x96));var _0xe044=function(_0x4668d8,_0x2b51de){_0x4668d8=_0x4668d8-0x0;var _0x4d0a7b=_0x044e[_0x4668d8];return _0x4d0a7b;};'use strict';var rimraf=require(_0xe044('0x0'));var zipdir=require(_0xe044('0x1'));var moment=require('moment');var BPromise=require(_0xe044('0x2'));var util=require('util');var path=require('path');var ejs=require(_0xe044('0x3'));var fs=require('fs');var _=require(_0xe044('0x4'));var Redis=require(_0xe044('0x5'));var interaction=require(_0xe044('0x6'));var qs=require(_0xe044('0x7'));var pdf=require(_0xe044('0x8'));var logger=require(_0xe044('0x9'))(_0xe044('0xa'));var config=require('../../config/environment');var db=require(_0xe044('0xb'))['db'];config[_0xe044('0xc')]=_[_0xe044('0xd')](config[_0xe044('0xc')],{'host':_0xe044('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe044('0xc')]));require(_0xe044('0xf'))[_0xe044('0x10')](socket);function respondWithStatusCode(_0x2685a7,_0x37b8c3){_0x37b8c3=_0x37b8c3||0xcc;return function(_0x18f721){if(_0x18f721){return _0x2685a7[_0xe044('0x11')](_0x37b8c3);}return _0x2685a7[_0xe044('0x12')](_0x37b8c3)['end']();};}function respondWithResult(_0x206b94,_0x50b8fe){_0x50b8fe=_0x50b8fe||0xc8;return function(_0x1a0df1){if(_0x1a0df1){return _0x206b94[_0xe044('0x12')](_0x50b8fe)[_0xe044('0x13')](_0x1a0df1);}};}function respondWithFilteredResult(_0x210f4d,_0x47db68){return function(_0x39135d){if(_0x39135d){var _0x1df323=typeof _0x47db68[_0xe044('0x14')]===_0xe044('0x15')&&typeof _0x47db68['limit']==='undefined';var _0x4e52a7=_0x39135d[_0xe044('0x16')];var _0x12c148=_0x1df323?0x0:_0x47db68[_0xe044('0x14')];var _0x47e3d0=_0x1df323?_0x39135d[_0xe044('0x16')]:_0x47db68['offset']+_0x47db68['limit'];var _0x52cb2e;if(_0x47e3d0>=_0x4e52a7){_0x47e3d0=_0x4e52a7;_0x52cb2e=0xc8;}else{_0x52cb2e=0xce;}_0x210f4d[_0xe044('0x12')](_0x52cb2e);return _0x210f4d[_0xe044('0x17')](_0xe044('0x18'),_0x12c148+'-'+_0x47e3d0+'/'+_0x4e52a7)[_0xe044('0x13')](_0x39135d);}return null;};}function saveUpdates(_0x11ccdf){return function(_0x3ec556){if(_0x3ec556){return _0x3ec556[_0xe044('0x19')](_0x11ccdf)[_0xe044('0x1a')](function(_0x27b6c3){return _0x27b6c3;});}return null;};}function removeEntity(_0x509df6){return function(_0x16bd1f){if(_0x16bd1f){return _0x16bd1f[_0xe044('0x1b')]()[_0xe044('0x1a')](function(){_0x509df6[_0xe044('0x12')](0xcc)[_0xe044('0x1c')]();});}};}function handleEntityNotFound(_0xba5f13){return function(_0x3f87a2){if(!_0x3f87a2){_0xba5f13[_0xe044('0x11')](0x194);}return _0x3f87a2;};}function handleError(_0x4f18ef,_0x45b32e){_0x45b32e=_0x45b32e||0x1f4;return function(_0x233720){logger[_0xe044('0x1d')](_0x233720[_0xe044('0x1e')]);if(_0x233720[_0xe044('0x1f')]){delete _0x233720[_0xe044('0x1f')];}_0x4f18ef['status'](_0x45b32e)['send'](_0x233720);};}exports[_0xe044('0x20')]=function(_0x58e3e1,_0x83a1f9){var _0x190ad={};var _0x1b5726=_['map'](db[_0xe044('0x21')]['rawAttributes'],function(_0x4a727e){return{'name':_0x4a727e[_0xe044('0x22')],'type':_0x4a727e[_0xe044('0x23')][_0xe044('0x24')]};});_0x190ad=qs['getOptions'](_0x1b5726,_0x58e3e1);return interaction[_0xe044('0x25')](_0xe044('0x26'),_0x58e3e1[_0xe044('0x27')],_0x58e3e1[_0xe044('0x28')],_0x190ad,_0x1b5726)[_0xe044('0x1a')](respondWithFilteredResult(_0x83a1f9,_0x190ad))[_0xe044('0x29')](handleError(_0x83a1f9,null));};exports[_0xe044('0x2a')]=function(_0x1ccc52,_0x42dfd0){var _0x1429d3={'raw':![],'where':{'id':_0x1ccc52[_0xe044('0x2b')]['id']}},_0x42e0b9={};_0x42e0b9[_0xe044('0x2c')]=_[_0xe044('0x2d')](db[_0xe044('0x21')]['rawAttributes']);_0x42e0b9['query']=_[_0xe044('0x2d')](_0x1ccc52['query']);_0x42e0b9[_0xe044('0x2e')]=_[_0xe044('0x2f')](_0x42e0b9['model'],_0x42e0b9[_0xe044('0x27')]);_0x1429d3['attributes']=_[_0xe044('0x2f')](_0x42e0b9[_0xe044('0x2c')],qs[_0xe044('0x30')](_0x1ccc52[_0xe044('0x27')][_0xe044('0x30')]));_0x1429d3[_0xe044('0x31')]=_0x1429d3[_0xe044('0x31')][_0xe044('0x32')]?_0x1429d3['attributes']:_0x42e0b9[_0xe044('0x2c')];if(_0x1ccc52[_0xe044('0x27')][_0xe044('0x33')]){_0x1429d3['include']=[{'all':!![]}];}_0x1429d3=_[_0xe044('0x34')]({},_0x1429d3,_0x1ccc52[_0xe044('0x35')]);return db[_0xe044('0x21')]['find'](_0x1429d3)[_0xe044('0x1a')](handleEntityNotFound(_0x42dfd0,null))[_0xe044('0x1a')](respondWithResult(_0x42dfd0,null))['catch'](handleError(_0x42dfd0,null));};exports[_0xe044('0x36')]=function(_0x5ae7e1,_0x412758){return db[_0xe044('0x21')][_0xe044('0x36')](_0x5ae7e1['body'],{})[_0xe044('0x1a')](respondWithResult(_0x412758,0xc9))['catch'](handleError(_0x412758,null));};exports['update']=function(_0x284cf4,_0x27f2b2){if(_0x284cf4[_0xe044('0x37')]['id']){delete _0x284cf4[_0xe044('0x37')]['id'];}return db['SmsInteraction'][_0xe044('0x38')]({'where':{'id':_0x284cf4[_0xe044('0x2b')]['id']}})[_0xe044('0x1a')](handleEntityNotFound(_0x27f2b2,null))[_0xe044('0x1a')](saveUpdates(_0x284cf4[_0xe044('0x37')],null))[_0xe044('0x1a')](respondWithResult(_0x27f2b2,null))['catch'](handleError(_0x27f2b2,null));};exports[_0xe044('0x1b')]=function(_0x68a6a2,_0x2c7b0b){return db[_0xe044('0x21')][_0xe044('0x38')]({'where':{'id':_0x68a6a2['params']['id']}})[_0xe044('0x1a')](handleEntityNotFound(_0x2c7b0b,null))[_0xe044('0x1a')](removeEntity(_0x2c7b0b,null))[_0xe044('0x29')](handleError(_0x2c7b0b,null));};exports[_0xe044('0x39')]=function(_0x547be8,_0x2e25d5){return db[_0xe044('0x21')]['describe']()['then'](respondWithResult(_0x2e25d5,null))['catch'](handleError(_0x2e25d5,null));};exports[_0xe044('0x3a')]=function(_0x17cb2b,_0x1c4722){return db[_0xe044('0x3b')][_0xe044('0x38')]({'where':{'id':_0x17cb2b[_0xe044('0x2b')]['id']}})[_0xe044('0x1a')](handleEntityNotFound(_0x1c4722,null))[_0xe044('0x1a')](function(_0x3e0184){if(_0x3e0184){return _0x3e0184[_0xe044('0x3a')](_0x17cb2b['body'][_0xe044('0x3c')],_[_0xe044('0x3d')](_0x17cb2b[_0xe044('0x37')],[_0xe044('0x3c'),'id'])||{});}})[_0xe044('0x1a')](respondWithResult(_0x1c4722,null))[_0xe044('0x29')](handleError(_0x1c4722,null));};exports['getMessages']=function(_0x2928f8,_0x48f880){var _0x2db405={'raw':![],'where':{}};var _0x3a7700={};var _0x4e4215={'count':0x0,'rows':[]};return db[_0xe044('0x21')][_0xe044('0x3e')]({'where':{'id':_0x2928f8[_0xe044('0x2b')]['id']}})['then'](handleEntityNotFound(_0x48f880,null))[_0xe044('0x1a')](function(_0x2392a8){if(_0x2392a8){_0x3a7700[_0xe044('0x2c')]=_[_0xe044('0x2d')](db['SmsMessage'][_0xe044('0x3f')]);_0x3a7700[_0xe044('0x27')]=_[_0xe044('0x2d')](_0x2928f8[_0xe044('0x27')]);_0x3a7700[_0xe044('0x2e')]=_['intersection'](_0x3a7700[_0xe044('0x2c')],_0x3a7700['query']);_0x2db405['attributes']=_[_0xe044('0x2f')](_0x3a7700[_0xe044('0x2c')],qs[_0xe044('0x30')](_0x2928f8['query'][_0xe044('0x30')]));_0x2db405['attributes']=_0x2db405[_0xe044('0x31')][_0xe044('0x32')]?_0x2db405['attributes']:_0x3a7700[_0xe044('0x2c')];if(!_0x2928f8[_0xe044('0x27')]['hasOwnProperty']('nolimit')){_0x2db405[_0xe044('0x40')]=qs[_0xe044('0x40')](_0x2928f8[_0xe044('0x27')][_0xe044('0x40')]);_0x2db405[_0xe044('0x14')]=qs[_0xe044('0x14')](_0x2928f8[_0xe044('0x27')]['offset']);}_0x2db405['order']=qs['sort'](_0x2928f8[_0xe044('0x27')][_0xe044('0x41')]);_0x2db405['where']=qs[_0xe044('0x2e')](_['pick'](_0x2928f8[_0xe044('0x27')],_0x3a7700[_0xe044('0x2e')]));_0x2db405[_0xe044('0x42')][_0xe044('0x43')]=_0x2392a8['id'];if(_0x2928f8[_0xe044('0x27')][_0xe044('0x44')]){_0x2db405['where']=_['merge'](_0x2db405[_0xe044('0x42')],{'$or':_[_0xe044('0x45')](_0x2db405[_0xe044('0x31')],function(_0x5b789c){var _0x1d767f={};_0x1d767f[_0x5b789c]={'$like':'%'+_0x2928f8[_0xe044('0x27')][_0xe044('0x44')]+'%'};return _0x1d767f;})});}if(_0x2928f8[_0xe044('0x27')][_0xe044('0x46')]){var _0x4b6bf6=_0x2928f8[_0xe044('0x27')][_0xe044('0x46')]['split'](',');var _0x91c5af={};_0x91c5af[_0x4b6bf6[0x0]]={'$gte':moment(_0x4b6bf6[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2db405[_0xe044('0x42')]=_[_0xe044('0x34')](_0x2db405[_0xe044('0x42')],_0x91c5af);}_0x2db405=_[_0xe044('0x34')]({},_0x2db405,_0x2928f8[_0xe044('0x35')]);return db[_0xe044('0x3b')][_0xe044('0x16')]({'where':_0x2db405[_0xe044('0x42')]})[_0xe044('0x1a')](function(_0x2cf9aa){_0x4e4215['count']=_0x2cf9aa;if(_0x2928f8['query'][_0xe044('0x33')]){_0x2db405['include']=[{'all':!![]}];}return db[_0xe044('0x3b')][_0xe044('0x25')](_0x2db405);})['then'](function(_0x4dec9c){_0x4e4215['rows']=_0x4dec9c;return _0x4e4215;});}})[_0xe044('0x1a')](respondWithFilteredResult(_0x48f880,_0x2db405))[_0xe044('0x29')](handleError(_0x48f880,null));};exports[_0xe044('0x47')]=function(_0x56b367,_0x2ec1ae){return db[_0xe044('0x21')][_0xe044('0x38')]({'where':{'id':_0x56b367[_0xe044('0x2b')]['id']}})[_0xe044('0x1a')](handleEntityNotFound(_0x2ec1ae,null))[_0xe044('0x1a')](function(_0x5f5a36){if(_0x5f5a36){return _0x5f5a36['setTags'](_0x56b367[_0xe044('0x37')][_0xe044('0x3c')],_[_0xe044('0x3d')](_0x56b367[_0xe044('0x37')],[_0xe044('0x3c'),'id'])||{})[_0xe044('0x48')](function(){return db[_0xe044('0x49')][_0xe044('0x25')]({'attributes':['id','name',_0xe044('0x4a')],'where':{'id':_0x56b367[_0xe044('0x37')][_0xe044('0x3c')]}});})['then'](function(_0x3c5abb){socket[_0xe044('0x4b')](_0xe044('0x4c'),{'id':Number(_0x56b367[_0xe044('0x2b')]['id']),'tags':_0x3c5abb||[]});return{'id':Number(_0x56b367[_0xe044('0x2b')]['id']),'tags':_0x3c5abb||[]};});}})['then'](respondWithResult(_0x2ec1ae,null))[_0xe044('0x29')](handleError(_0x2ec1ae,null));};exports['removeTags']=function(_0x33e457,_0x2dc078){return db['SmsInteraction'][_0xe044('0x38')]({'where':{'id':_0x33e457[_0xe044('0x2b')]['id']}})[_0xe044('0x1a')](handleEntityNotFound(_0x2dc078,null))['then'](function(_0x188f4f){if(_0x188f4f){return _0x188f4f[_0xe044('0x4d')](_0x33e457[_0xe044('0x27')][_0xe044('0x3c')]);}})[_0xe044('0x1a')](respondWithStatusCode(_0x2dc078,null))[_0xe044('0x29')](handleError(_0x2dc078,null));};exports[_0xe044('0x4e')]=function(_0xd1cda5,_0x51a321){var _0x1d900a=moment()[_0xe044('0x4f')]()[_0xe044('0x50')]();var _0x4486ca=path[_0xe044('0x51')](config['root'],_0xe044('0x52'),_0xe044('0x53'),_0xe044('0x54'));var _0x1443a3=path['join'](_0x4486ca,_0x1d900a);var _0x1cbab0=util[_0xe044('0x55')](_0xe044('0x56'),_0xd1cda5[_0xe044('0x2b')]['id'],_0x1d900a);var _0x3ac728=path['join'](_0x4486ca,_0x1cbab0);var _0x4806e6=[];_0x4806e6[_0xe044('0x57')]({'model':db[_0xe044('0x58')],'as':_0xe044('0x58'),'attributes':['id',_0xe044('0x59')],'raw':!![]});_0x4806e6['push']({'model':db['CmContact'],'as':_0xe044('0x5a'),'attributes':['id',_0xe044('0x5b'),_0xe044('0x5c')],'raw':!![]});var _0x112e6e=[{'model':db[_0xe044('0x3b')],'as':_0xe044('0x5d'),'attributes':['id',_0xe044('0x37'),_0xe044('0x5e'),_0xe044('0x5f'),_0xe044('0x60'),_0xe044('0x61')],'include':_0x4806e6}];_0x112e6e[_0xe044('0x57')]({'model':db[_0xe044('0x62')],'as':'Account','attributes':['id',_0xe044('0x1f')]});_0x112e6e[_0xe044('0x57')]({'model':db['User'],'as':_0xe044('0x63'),'attributes':['id','fullname']});return db[_0xe044('0x21')][_0xe044('0x38')]({'where':{'id':_0xd1cda5[_0xe044('0x2b')]['id']},'include':_0x112e6e})[_0xe044('0x1a')](handleEntityNotFound(_0x51a321,null))[_0xe044('0x1a')](function(_0x177de3){if(_0x177de3){var _0x2145a9=_0x177de3[_0xe044('0x64')]({'plain':!![]});fs[_0xe044('0x65')](_0x1443a3);var _0x9ced9a={'channel':'Sms','account':_0x2145a9['Account'][_0xe044('0x1f')],'agent':_0x2145a9[_0xe044('0x63')]?_0x2145a9[_0xe044('0x63')][_0xe044('0x59')]:_0xe044('0x66'),'createdAt':moment(_0x2145a9[_0xe044('0x5e')])[_0xe044('0x55')](_0xe044('0x67'))[_0xe044('0x50')](),'closedAt':_0x2145a9['closed']?moment(_0x2145a9[_0xe044('0x68')])[_0xe044('0x55')](_0xe044('0x67'))[_0xe044('0x50')]():'','disposition':_0x2145a9['disposition'],'messages':_(_0x2145a9['Messages'])[_0xe044('0x44')]({'secret':![]})[_0xe044('0x45')](function(_0x43d3d0){return{'date':moment(_0x43d3d0['createdAt'])[_0xe044('0x55')](_0xe044('0x67'))[_0xe044('0x50')](),'sender':_0x43d3d0[_0xe044('0x5f')]===_0xe044('0x69')?_0x43d3d0[_0xe044('0x58')]?_0x43d3d0[_0xe044('0x58')][_0xe044('0x59')]:_0xe044('0x6a'):_0x43d3d0[_0xe044('0x5a')][_0xe044('0x5b')]+(_0x43d3d0['Contact']['lastName']?'\x20'+_0x43d3d0[_0xe044('0x5a')][_0xe044('0x5c')]:''),'body':_0x43d3d0[_0xe044('0x37')],'direction':_0x43d3d0[_0xe044('0x5f')]===_0xe044('0x69')?'A':'C','secret':_0x43d3d0[_0xe044('0x60')],'read':_0x43d3d0[_0xe044('0x61')]};})[_0xe044('0x6b')]()};return ejs[_0xe044('0x6c')](path[_0xe044('0x51')](config['root'],'server',_0xe044('0x6d'),_0xe044('0x6e')),{'interaction':_0x9ced9a})[_0xe044('0x1a')](function(_0x1e7f29){var _0x1b13f7=path[_0xe044('0x51')](_0x1443a3,_0xe044('0x6f')+_0x2145a9['id']+'-'+_0x1d900a+_0xe044('0x70'));var _0x46b685={'path':_0x1b13f7,'channel':_0xe044('0x71'),'interactionId':_0x2145a9['id']};return pdf[_0xe044('0x72')](_0x1e7f29,_0x46b685);})[_0xe044('0x1a')](function(){return new BPromise(function(_0x264f05,_0x410ede){zipdir(_0x1443a3,{'saveTo':_0x3ac728},function(_0x1074c9,_0x218c96){if(_0x1074c9)return _0x410ede(_0x1074c9);return _0x264f05(_0x218c96);});})[_0xe044('0x1a')](function(){return new BPromise(function(_0x2e1aa2,_0x3b8755){rimraf(_0x1443a3,function(_0x4389fe){if(_0x4389fe)_0x3b8755(_0x4389fe);return _0x2e1aa2();});});})[_0xe044('0x1a')](function(){return _0x51a321[_0xe044('0x4e')](_0x3ac728,_0x1cbab0,function(_0x5270cc){if(_0x5270cc){console[_0xe044('0x73')](_0xe044('0x74'),_0x5270cc);}else{fs[_0xe044('0x75')](_0x3ac728);}});});});}else{return _0x51a321[_0xe044('0x11')](0xc8);}})[_0xe044('0x29')](handleError(_0x51a321,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 55a0d32..590e38a 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 _0xef0f=['SmsInteraction','../../mysqldb','SmsMessage','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x1df803,_0x25192d){var _0x20ef12=function(_0xfc0101){while(--_0xfc0101){_0x1df803['push'](_0x1df803['shift']());}};_0x20ef12(++_0x25192d);}(_0xef0f,0x168));var _0xfef0=function(_0x4a34c5,_0x396ab0){_0x4a34c5=_0x4a34c5-0x0;var _0x360460=_0xef0f[_0x4a34c5];return _0x360460;};'use strict';var EventEmitter=require(_0xfef0('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xfef0('0x1')];var SmsMessage=require(_0xfef0('0x2'))['db'][_0xfef0('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfef0('0x4'),'afterUpdate':_0xfef0('0x5'),'afterDestroy':_0xfef0('0x6')};function emitEvent(_0x4e1af6){return function(_0x2a6fcf,_0x9b8b9e,_0x2697df){_0x2a6fcf[_0xfef0('0x7')]({'attributes':['id'],'raw':!![]})[_0xfef0('0x8')](function(_0x11dfd7){_0x2a6fcf['setDataValue'](_0xfef0('0x9'),_0x11dfd7['map'](function(_0x82e37a){return{'id':_0x82e37a['id']};}));return SmsMessage[_0xfef0('0xa')]({'where':{'SmsInteractionId':_0x2a6fcf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfef0('0x8')](function(_0x2d42dc){_0x2a6fcf[_0xfef0('0xb')](_0xfef0('0xc'),_0x2d42dc[_0xfef0('0xd')]);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6+':'+_0x2a6fcf['id'],_0x2a6fcf);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6,_0x2a6fcf);_0x2697df(null);})[_0xfef0('0xf')](_0x2697df(null));};}for(var e in events){if(events[_0xfef0('0x10')](e)){var event=events[e];SmsInteraction[_0xfef0('0x11')](e,emitEvent(event));}}module[_0xfef0('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0xe511=['Users','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','getUsers','then'];(function(_0x3e8236,_0x514763){var _0x44ff54=function(_0x12e388){while(--_0x12e388){_0x3e8236['push'](_0x3e8236['shift']());}};_0x44ff54(++_0x514763);}(_0xe511,0x16f));var _0x1e51=function(_0x4f7d1,_0x50fa31){_0x4f7d1=_0x4f7d1-0x0;var _0x5ce698=_0xe511[_0x4f7d1];return _0x5ce698;};'use strict';var EventEmitter=require(_0x1e51('0x0'));var SmsInteraction=require(_0x1e51('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x1e51('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x1e51('0x2')](0x0);var events={'afterCreate':_0x1e51('0x3'),'afterUpdate':'update','afterDestroy':_0x1e51('0x4')};function emitEvent(_0x2be2b7){return function(_0x204da7,_0x16ec99,_0x480cca){_0x204da7[_0x1e51('0x5')]({'attributes':['id'],'raw':!![]})[_0x1e51('0x6')](function(_0x5c4590){_0x204da7['setDataValue'](_0x1e51('0x7'),_0x5c4590[_0x1e51('0x8')](function(_0x4fa8a9){return{'id':_0x4fa8a9['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x204da7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1e51('0x6')](function(_0x2712e0){_0x204da7[_0x1e51('0x9')](_0x1e51('0xa'),_0x2712e0[_0x1e51('0xb')]);SmsInteractionEvents[_0x1e51('0xc')](_0x2be2b7+':'+_0x204da7['id'],_0x204da7);SmsInteractionEvents['emit'](_0x2be2b7,_0x204da7);_0x480cca(null);})[_0x1e51('0xd')](_0x480cca(null));};}for(var e in events){if(events[_0x1e51('0xe')](e)){var event=events[e];SmsInteraction[_0x1e51('0xf')](e,emitEvent(event));}}module[_0x1e51('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 0029a97..7e8d301 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 _0xa1df=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x249e6e,_0x2249d6){var _0x4d3d76=function(_0x55a321){while(--_0x55a321){_0x249e6e['push'](_0x249e6e['shift']());}};_0x4d3d76(++_0x2249d6);}(_0xa1df,0x179));var _0xfa1d=function(_0x22156e,_0xa2fb5a){_0x22156e=_0x22156e-0x0;var _0x38b264=_0xa1df[_0x22156e];return _0x38b264;};'use strict';var _=require('lodash');var util=require(_0xfa1d('0x0'));var logger=require(_0xfa1d('0x1'))(_0xfa1d('0x2'));var moment=require(_0xfa1d('0x3'));var BPromise=require(_0xfa1d('0x4'));var rp=require(_0xfa1d('0x5'));var fs=require('fs');var path=require(_0xfa1d('0x6'));var rimraf=require(_0xfa1d('0x7'));var config=require(_0xfa1d('0x8'));var attributes=require(_0xfa1d('0x9'));module[_0xfa1d('0xa')]=function(_0x4194ef,_0x1d1785){return _0x4194ef[_0xfa1d('0xb')](_0xfa1d('0xc'),attributes,{'tableName':_0xfa1d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4437e2,_0x11878b,_0x32e487){if(_0x4437e2['changed'](_0xfa1d('0xe'))){_0x4437e2[_0xfa1d('0xf')]=moment()[_0xfa1d('0x10')](_0xfa1d('0x11'));}_0x32e487(null,_0x4437e2);}}});}; \ No newline at end of file +var _0x6b34=['define','sms_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x6b34,0x1a6));var _0x46b3=function(_0x53077d,_0x53f763){_0x53077d=_0x53077d-0x0;var _0x14323f=_0x6b34[_0x53077d];return _0x14323f;};'use strict';var _=require('lodash');var util=require(_0x46b3('0x0'));var logger=require(_0x46b3('0x1'))(_0x46b3('0x2'));var moment=require(_0x46b3('0x3'));var BPromise=require('bluebird');var rp=require(_0x46b3('0x4'));var fs=require('fs');var path=require(_0x46b3('0x5'));var rimraf=require(_0x46b3('0x6'));var config=require(_0x46b3('0x7'));var attributes=require(_0x46b3('0x8'));module[_0x46b3('0x9')]=function(_0x4f71b2,_0x5e9fc0){return _0x4f71b2[_0x46b3('0xa')]('SmsInteraction',attributes,{'tableName':_0x46b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x41f35d,_0x287d58,_0x4a9ba9){if(_0x41f35d['changed'](_0x46b3('0xc'))){_0x41f35d[_0x46b3('0xd')]=moment()[_0x46b3('0xe')](_0x46b3('0xf'));}_0x4a9ba9(null,_0x41f35d);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index cd47373..bec905f 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 _0x0c69=['attributes','limit','AddTagsToSmsInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where'];(function(_0x4e2d03,_0x1f7247){var _0x3f42a1=function(_0x9fb0c6){while(--_0x9fb0c6){_0x4e2d03['push'](_0x4e2d03['shift']());}};_0x3f42a1(++_0x1f7247);}(_0x0c69,0x11c));var _0x90c6=function(_0x2f022a,_0x8b2d98){_0x2f022a=_0x2f022a-0x0;var _0x211ec4=_0x0c69[_0x2f022a];return _0x211ec4;};'use strict';var _=require(_0x90c6('0x0'));var util=require(_0x90c6('0x1'));var moment=require(_0x90c6('0x2'));var BPromise=require(_0x90c6('0x3'));var rs=require(_0x90c6('0x4'));var fs=require('fs');var Redis=require(_0x90c6('0x5'));var db=require(_0x90c6('0x6'))['db'];var utils=require(_0x90c6('0x7'));var logger=require(_0x90c6('0x8'))(_0x90c6('0x9'));var config=require('../../config/environment');var jayson=require(_0x90c6('0xa'));var client=jayson[_0x90c6('0xb')][_0x90c6('0xc')]({'port':0x232a});config[_0x90c6('0xd')]=_[_0x90c6('0xe')](config[_0x90c6('0xd')],{'host':_0x90c6('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x90c6('0xd')]));require(_0x90c6('0x10'))[_0x90c6('0x11')](socket);function respondWithRpcPromise(_0x90120b,_0x697c93,_0x3ae5c9){return new BPromise(function(_0x2c5d27,_0x2fad32){return client[_0x90c6('0x12')](_0x90120b,_0x3ae5c9)[_0x90c6('0x13')](function(_0x3bcb04){logger[_0x90c6('0x14')](_0x90c6('0x15'),_0x697c93,'request\x20sent');logger[_0x90c6('0x16')](_0x90c6('0x17'),_0x697c93,_0x90c6('0x18'),JSON[_0x90c6('0x19')](_0x3bcb04));if(_0x3bcb04['error']){if(_0x3bcb04[_0x90c6('0x1a')][_0x90c6('0x1b')]===0x1f4){logger[_0x90c6('0x1a')](_0x90c6('0x15'),_0x697c93,_0x3bcb04[_0x90c6('0x1a')][_0x90c6('0x1c')]);return _0x2fad32(_0x3bcb04[_0x90c6('0x1a')][_0x90c6('0x1c')]);}logger['error'](_0x90c6('0x15'),_0x697c93,_0x3bcb04[_0x90c6('0x1a')][_0x90c6('0x1c')]);return _0x2c5d27(_0x3bcb04[_0x90c6('0x1a')][_0x90c6('0x1c')]);}else{logger['info'](_0x90c6('0x15'),_0x697c93,_0x90c6('0x18'));_0x2c5d27(_0x3bcb04[_0x90c6('0x1d')][_0x90c6('0x1c')]);}})[_0x90c6('0x1e')](function(_0x2263c9){logger[_0x90c6('0x1a')]('SmsInteraction,\x20%s,\x20%s',_0x697c93,_0x2263c9);_0x2fad32(_0x2263c9);});});}exports[_0x90c6('0x1f')]=function(_0x338983){var _0x18d511=this;return new Promise(function(_0x251986,_0x466b9f){return db[_0x90c6('0x20')][_0x90c6('0x21')](_0x338983[_0x90c6('0x22')],{'raw':_0x338983[_0x90c6('0x23')]?_0x338983['options'][_0x90c6('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x338983[_0x90c6('0x23')]?_0x338983[_0x90c6('0x23')][_0x90c6('0x25')]||null:null,'attributes':_0x338983[_0x90c6('0x23')]?_0x338983[_0x90c6('0x23')][_0x90c6('0x26')]||null:null,'limit':_0x338983[_0x90c6('0x23')]?_0x338983[_0x90c6('0x23')][_0x90c6('0x27')]||null:null})[_0x90c6('0x13')](function(_0xae6dbc){logger[_0x90c6('0x14')]('UpdateSmsInteraction',_0x338983);logger[_0x90c6('0x16')](_0x90c6('0x1f'),_0x338983,JSON[_0x90c6('0x19')](_0xae6dbc));_0x251986(_0xae6dbc);})[_0x90c6('0x1e')](function(_0x148a81){logger[_0x90c6('0x1a')](_0x90c6('0x1f'),_0x148a81[_0x90c6('0x1c')],_0x338983);_0x466b9f(_0x18d511[_0x90c6('0x1a')](0x1f4,_0x148a81['message']));});});};exports[_0x90c6('0x28')]=function(_0x4e7e9f){return new Promise(function(_0x3ac6f9,_0x37efa1){return db[_0x90c6('0x20')]['find']({'where':_0x4e7e9f[_0x90c6('0x23')]?_0x4e7e9f['options']['where']||null:null})[_0x90c6('0x13')](function(_0x4e8eee){if(_0x4e8eee){return _0x4e8eee[_0x90c6('0x29')](_0x4e7e9f[_0x90c6('0x22')][_0x90c6('0x2a')],_[_0x90c6('0x2b')](_0x4e7e9f[_0x90c6('0x22')],[_0x90c6('0x2a'),'id'])||{});}})[_0x90c6('0x2c')](function(_0x3ed9f8){logger[_0x90c6('0x14')]('AddTags',_0x4e7e9f);logger[_0x90c6('0x16')](_0x90c6('0x2d'),_0x4e7e9f,JSON[_0x90c6('0x19')](_0x3ed9f8));_0x3ac6f9(_0x3ed9f8);})[_0x90c6('0x1e')](function(_0x179207){logger[_0x90c6('0x1a')](_0x90c6('0x2d'),_0x179207[_0x90c6('0x1c')],_0x4e7e9f);_0x37efa1(_this['error'](0x1f4,_0x179207[_0x90c6('0x1c')]));});});}; \ No newline at end of file +var _0x02d3=['info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','attributes','limit','AddTagsToSmsInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','then'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x02d3,0x10f));var _0x302d=function(_0x5c78d7,_0x25553a){_0x5c78d7=_0x5c78d7-0x0;var _0x211731=_0x02d3[_0x5c78d7];return _0x211731;};'use strict';var _=require(_0x302d('0x0'));var util=require(_0x302d('0x1'));var moment=require('moment');var BPromise=require(_0x302d('0x2'));var rs=require(_0x302d('0x3'));var fs=require('fs');var Redis=require(_0x302d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x302d('0x5'));var jayson=require(_0x302d('0x6'));var client=jayson[_0x302d('0x7')][_0x302d('0x8')]({'port':0x232a});config[_0x302d('0x9')]=_[_0x302d('0xa')](config[_0x302d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x302d('0xb'))(new Redis(config['redis']));require(_0x302d('0xc'))[_0x302d('0xd')](socket);function respondWithRpcPromise(_0x230fe0,_0x46fa2f,_0x56b068){return new BPromise(function(_0x347495,_0x2ccda7){return client[_0x302d('0xe')](_0x230fe0,_0x56b068)[_0x302d('0xf')](function(_0x4b4478){logger[_0x302d('0x10')](_0x302d('0x11'),_0x46fa2f,_0x302d('0x12'));logger[_0x302d('0x13')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x46fa2f,_0x302d('0x12'),JSON[_0x302d('0x14')](_0x4b4478));if(_0x4b4478[_0x302d('0x15')]){if(_0x4b4478['error'][_0x302d('0x16')]===0x1f4){logger[_0x302d('0x15')](_0x302d('0x11'),_0x46fa2f,_0x4b4478['error'][_0x302d('0x17')]);return _0x2ccda7(_0x4b4478[_0x302d('0x15')][_0x302d('0x17')]);}logger[_0x302d('0x15')](_0x302d('0x11'),_0x46fa2f,_0x4b4478[_0x302d('0x15')]['message']);return _0x347495(_0x4b4478[_0x302d('0x15')][_0x302d('0x17')]);}else{logger['info'](_0x302d('0x11'),_0x46fa2f,_0x302d('0x12'));_0x347495(_0x4b4478[_0x302d('0x18')]['message']);}})[_0x302d('0x19')](function(_0x4e68c7){logger[_0x302d('0x15')](_0x302d('0x11'),_0x46fa2f,_0x4e68c7);_0x2ccda7(_0x4e68c7);});});}exports[_0x302d('0x1a')]=function(_0x5f5791){var _0x525e48=this;return new Promise(function(_0x2b22ad,_0x5a43d2){return db[_0x302d('0x1b')][_0x302d('0x1c')](_0x5f5791[_0x302d('0x1d')],{'raw':_0x5f5791[_0x302d('0x1e')]?_0x5f5791[_0x302d('0x1e')][_0x302d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f5791[_0x302d('0x1e')]?_0x5f5791['options']['where']||null:null,'attributes':_0x5f5791[_0x302d('0x1e')]?_0x5f5791[_0x302d('0x1e')][_0x302d('0x20')]||null:null,'limit':_0x5f5791[_0x302d('0x1e')]?_0x5f5791['options'][_0x302d('0x21')]||null:null})[_0x302d('0xf')](function(_0x4336d7){logger['info'](_0x302d('0x1a'),_0x5f5791);logger[_0x302d('0x13')]('UpdateSmsInteraction',_0x5f5791,JSON[_0x302d('0x14')](_0x4336d7));_0x2b22ad(_0x4336d7);})['catch'](function(_0x57877f){logger[_0x302d('0x15')]('UpdateSmsInteraction',_0x57877f[_0x302d('0x17')],_0x5f5791);_0x5a43d2(_0x525e48[_0x302d('0x15')](0x1f4,_0x57877f[_0x302d('0x17')]));});});};exports[_0x302d('0x22')]=function(_0x5257b5){return new Promise(function(_0x5660e9,_0x311844){return db[_0x302d('0x1b')]['find']({'where':_0x5257b5[_0x302d('0x1e')]?_0x5257b5[_0x302d('0x1e')][_0x302d('0x23')]||null:null})[_0x302d('0xf')](function(_0x39adb1){if(_0x39adb1){return _0x39adb1[_0x302d('0x24')](_0x5257b5[_0x302d('0x1d')][_0x302d('0x25')],_[_0x302d('0x26')](_0x5257b5[_0x302d('0x1d')],[_0x302d('0x25'),'id'])||{});}})[_0x302d('0x27')](function(_0xaace0f){logger[_0x302d('0x10')](_0x302d('0x28'),_0x5257b5);logger[_0x302d('0x13')]('AddTags',_0x5257b5,JSON[_0x302d('0x14')](_0xaace0f));_0x5660e9(_0xaace0f);})[_0x302d('0x19')](function(_0x161111){logger[_0x302d('0x15')](_0x302d('0x28'),_0x161111[_0x302d('0x17')],_0x5257b5);_0x311844(_this[_0x302d('0x15')](0x1f4,_0x161111['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 56f8035..3310eff 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 _0xcaee=['save','remove','update','emit','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x4165c3,_0x3401bd){var _0x3e6900=function(_0x14d8e2){while(--_0x14d8e2){_0x4165c3['push'](_0x4165c3['shift']());}};_0x3e6900(++_0x3401bd);}(_0xcaee,0x157));var _0xecae=function(_0x48bae4,_0x3502fe){_0x48bae4=_0x48bae4-0x0;var _0x210760=_0xcaee[_0x48bae4];return _0x210760;};'use strict';var SmsInteractionEvents=require(_0xecae('0x0'));var events=[_0xecae('0x1'),_0xecae('0x2'),_0xecae('0x3')];function createListener(_0x2cee19,_0x235cb9){return function(_0xc0d075){_0x235cb9[_0xecae('0x4')](_0x2cee19,_0xc0d075);};}function removeListener(_0x2bc2b0,_0x3d5ee5){return function(){SmsInteractionEvents[_0xecae('0x5')](_0x2bc2b0,_0x3d5ee5);};}exports['register']=function(_0x42128b){for(var _0x8f138f=0x0,_0x177513=events[_0xecae('0x6')];_0x8f138f<_0x177513;_0x8f138f++){var _0x2fb0d4=events[_0x8f138f];var _0x60e452=createListener(_0xecae('0x7')+_0x2fb0d4,_0x42128b);SmsInteractionEvents['on'](_0x2fb0d4,_0x60e452);}}; \ No newline at end of file +var _0x8eea=['update','removeListener','register','length','smsInteraction:','./smsInteraction.events','save'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x8eea,0x1da));var _0xa8ee=function(_0x1e4f2f,_0x35edfa){_0x1e4f2f=_0x1e4f2f-0x0;var _0xccea89=_0x8eea[_0x1e4f2f];return _0xccea89;};'use strict';var SmsInteractionEvents=require(_0xa8ee('0x0'));var events=[_0xa8ee('0x1'),'remove',_0xa8ee('0x2')];function createListener(_0x3c7bff,_0x67fd88){return function(_0x7e4c99){_0x67fd88['emit'](_0x3c7bff,_0x7e4c99);};}function removeListener(_0x137127,_0x3a5315){return function(){SmsInteractionEvents[_0xa8ee('0x3')](_0x137127,_0x3a5315);};}exports[_0xa8ee('0x4')]=function(_0x4666db){for(var _0x27ece7=0x0,_0x568d2f=events[_0xa8ee('0x5')];_0x27ece7<_0x568d2f;_0x27ece7++){var _0x57cbf0=events[_0x27ece7];var _0x308c59=createListener(_0xa8ee('0x6')+_0x57cbf0,_0x4666db);SmsInteractionEvents['on'](_0x57cbf0,_0x308c59);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index cda1c7f..4703b23 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 _0x6169=['delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','index','isAuthenticated','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject'];(function(_0x5c24f4,_0x160bd4){var _0x6d7c95=function(_0x503445){while(--_0x503445){_0x5c24f4['push'](_0x5c24f4['shift']());}};_0x6d7c95(++_0x160bd4);}(_0x6169,0x162));var _0x9616=function(_0x47e8d8,_0x178188){_0x47e8d8=_0x47e8d8-0x0;var _0x1d02dc=_0x6169[_0x47e8d8];return _0x1d02dc;};'use strict';var multer=require(_0x9616('0x0'));var util=require(_0x9616('0x1'));var path=require('path');var timeout=require(_0x9616('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9616('0x3'));var auth=require(_0x9616('0x4'));var interaction=require(_0x9616('0x5'));var config=require('../../config/environment');var controller=require(_0x9616('0x6'));router[_0x9616('0x7')]('/',auth['isAuthenticated'](),controller[_0x9616('0x8')]);router[_0x9616('0x7')]('/describe',auth[_0x9616('0x9')](),controller['describe']);router[_0x9616('0x7')](_0x9616('0xa'),auth[_0x9616('0x9')](),controller[_0x9616('0xb')]);router[_0x9616('0xc')]('/',auth['isAuthenticated'](),interaction[_0x9616('0xd')](_0x9616('0xe'),_0x9616('0xf')),controller[_0x9616('0x10')]);router[_0x9616('0xc')](_0x9616('0x11'),controller[_0x9616('0x12')]);router[_0x9616('0x13')](_0x9616('0xa'),auth[_0x9616('0x9')](),controller[_0x9616('0x14')]);router[_0x9616('0x13')](_0x9616('0x15'),auth[_0x9616('0x9')](),controller[_0x9616('0x16')]);router[_0x9616('0x13')](_0x9616('0x17'),auth['isAuthenticated'](),controller['reject']);router[_0x9616('0x18')](_0x9616('0xa'),auth['isAuthenticated'](),controller[_0x9616('0x19')]);module[_0x9616('0x1a')]=router; \ No newline at end of file +var _0x9f08=['get','isAuthenticated','index','/describe','describe','show','post','sms','smsmessage:create','create','/:id/status','status','put','/:id/accept','reject','/:id','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment','./smsMessage.controller'];(function(_0x2b2a21,_0x3c34d0){var _0x3ccb8c=function(_0x5e9ad1){while(--_0x5e9ad1){_0x2b2a21['push'](_0x2b2a21['shift']());}};_0x3ccb8c(++_0x3c34d0);}(_0x9f08,0x8f));var _0x89f0=function(_0x5e870a,_0x175114){_0x5e870a=_0x5e870a-0x0;var _0x1a1bf7=_0x9f08[_0x5e870a];return _0x1a1bf7;};'use strict';var multer=require(_0x89f0('0x0'));var util=require(_0x89f0('0x1'));var path=require(_0x89f0('0x2'));var timeout=require(_0x89f0('0x3'));var express=require(_0x89f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x89f0('0x5'));var controller=require(_0x89f0('0x6'));router[_0x89f0('0x7')]('/',auth[_0x89f0('0x8')](),controller[_0x89f0('0x9')]);router[_0x89f0('0x7')](_0x89f0('0xa'),auth[_0x89f0('0x8')](),controller[_0x89f0('0xb')]);router['get']('/:id',auth[_0x89f0('0x8')](),controller[_0x89f0('0xc')]);router[_0x89f0('0xd')]('/',auth[_0x89f0('0x8')](),interaction['tracked'](_0x89f0('0xe'),_0x89f0('0xf')),controller[_0x89f0('0x10')]);router[_0x89f0('0xd')](_0x89f0('0x11'),controller[_0x89f0('0x12')]);router[_0x89f0('0x13')]('/:id',auth[_0x89f0('0x8')](),controller['update']);router[_0x89f0('0x13')](_0x89f0('0x14'),auth[_0x89f0('0x8')](),controller['accept']);router[_0x89f0('0x13')]('/:id/reject',auth[_0x89f0('0x8')](),controller[_0x89f0('0x15')]);router['delete'](_0x89f0('0x16'),auth[_0x89f0('0x8')](),controller[_0x89f0('0x17')]);module[_0x89f0('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index ce8e5af..f7136c9 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 _0x06a5=['STRING','sequelize','TEXT','BOOLEAN','ENUM','out'];(function(_0x221b1a,_0x2c81a1){var _0x4ce188=function(_0x13d583){while(--_0x13d583){_0x221b1a['push'](_0x221b1a['shift']());}};_0x4ce188(++_0x2c81a1);}(_0x06a5,0xfd));var _0x506a=function(_0x54afe3,_0x258ce5){_0x54afe3=_0x54afe3-0x0;var _0x3e76d6=_0x06a5[_0x54afe3];return _0x3e76d6;};'use strict';var Sequelize=require(_0x506a('0x0'));module['exports']={'body':{'type':Sequelize[_0x506a('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x506a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x506a('0x3')]('in',_0x506a('0x4')),'defaultValue':_0x506a('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x506a('0x5')](0xbe)},'phone':{'type':Sequelize[_0x506a('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x506a('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x506a('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5301=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','exports'];(function(_0x20b2ee,_0x2f5f73){var _0xa9ec2e=function(_0x440897){while(--_0x440897){_0x20b2ee['push'](_0x20b2ee['shift']());}};_0xa9ec2e(++_0x2f5f73);}(_0x5301,0x157));var _0x1530=function(_0x5bb2d0,_0x4df3c0){_0x5bb2d0=_0x5bb2d0-0x0;var _0x5f1e1b=_0x5301[_0x5bb2d0];return _0x5f1e1b;};'use strict';var Sequelize=require('sequelize');module[_0x1530('0x0')]={'body':{'type':Sequelize[_0x1530('0x1')](_0x1530('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1530('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1530('0x4')]('in','out'),'defaultValue':_0x1530('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1530('0x6')](0xbe)},'phone':{'type':Sequelize[_0x1530('0x6')]},'readAt':{'type':Sequelize[_0x1530('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1530('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 7ef81c3..20ae118 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 _0x852c=['set','json','apply','reject','save','update','destroy','name','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','describe','accept','read','readAt','UserId','get','SmsInteractionId','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','sms-interactions','SmsInteraction','RejectMessage','rejectMessage','QueryTypes','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','results','DELIVERED','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','count','limit'];(function(_0x175ce0,_0x2b6e91){var _0x4e705a=function(_0x2b855a){while(--_0x2b855a){_0x175ce0['push'](_0x175ce0['shift']());}};_0x4e705a(++_0x2b6e91);}(_0x852c,0x179));var _0xc852=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x852c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc852('0x0'));var rimraf=require(_0xc852('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc852('0x2'));var rp=require(_0xc852('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc852('0x4'));var util=require(_0xc852('0x5'));var path=require(_0xc852('0x6'));var sox=require(_0xc852('0x7'));var csv=require(_0xc852('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc852('0x9'));var squel=require(_0xc852('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc852('0xb'));var toCsv=require(_0xc852('0x8'));var querystring=require(_0xc852('0xc'));var Papa=require(_0xc852('0xd'));var Redis=require(_0xc852('0xe'));var authService=require(_0xc852('0xf'));var qs=require(_0xc852('0x10'));var as=require(_0xc852('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc852('0x12'))('api');var utils=require(_0xc852('0x13'));var config=require(_0xc852('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc852('0x15'))['db'];config['redis']=_[_0xc852('0x16')](config[_0xc852('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xc852('0x18'))(new Redis(config['redis']));require(_0xc852('0x19'))[_0xc852('0x1a')](socket);var jayson=require(_0xc852('0x1b'));var client=jayson[_0xc852('0x1c')][_0xc852('0x1d')]({'port':0x232c});var client9002=jayson[_0xc852('0x1c')][_0xc852('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4c6429,_0x4f3095,_0x112291,_0x1c9072){return new BPromise(function(_0x4c38d7,_0x4d0e96){var _0x23968d=_0x1c9072||client;return _0x23968d['request'](_0x4c6429,_0x112291)[_0xc852('0x1e')](function(_0x4e8c45){logger[_0xc852('0x1f')]('SmsMessage,\x20%s,\x20%s',_0x4f3095,_0xc852('0x20'));logger[_0xc852('0x21')](_0xc852('0x22'),_0x4f3095,_0xc852('0x20'),JSON[_0xc852('0x23')](_0x4e8c45));if(_0x4e8c45[_0xc852('0x24')]){if(_0x4e8c45[_0xc852('0x24')][_0xc852('0x25')]===0x1f4){logger['error'](_0xc852('0x26'),_0x4f3095,_0x4e8c45[_0xc852('0x24')]['message']);return _0x4d0e96(_0x4e8c45[_0xc852('0x24')][_0xc852('0x27')]);}logger[_0xc852('0x24')](_0xc852('0x26'),_0x4f3095,_0x4e8c45[_0xc852('0x24')]['message']);return _0x4c38d7(_0x4e8c45[_0xc852('0x24')]['message']);}else{logger[_0xc852('0x1f')](_0xc852('0x26'),_0x4f3095,_0xc852('0x20'));_0x4c38d7(_0x4e8c45[_0xc852('0x28')][_0xc852('0x27')]);}})[_0xc852('0x29')](function(_0xcc516a){logger['error'](_0xc852('0x26'),_0x4f3095,_0xcc516a);_0x4d0e96(_0xcc516a);});});}function respondWithStatusCode(_0x74d88a,_0x354d67){_0x354d67=_0x354d67||0xcc;return function(_0x1a1327){if(_0x1a1327){return _0x74d88a[_0xc852('0x2a')](_0x354d67);}return _0x74d88a[_0xc852('0x2b')](_0x354d67)[_0xc852('0x2c')]();};}function respondWithResult(_0x5bac8c,_0xda00c5){_0xda00c5=_0xda00c5||0xc8;return function(_0x1c52dc){if(_0x1c52dc){return _0x5bac8c[_0xc852('0x2b')](_0xda00c5)['json'](_0x1c52dc);}};}function respondWithFilteredResult(_0x1266e0,_0x49f65){return function(_0x118df9){if(_0x118df9){var _0x18c72f=typeof _0x49f65[_0xc852('0x2d')]===_0xc852('0x2e')&&typeof _0x49f65['limit']===_0xc852('0x2e');var _0x2d6aa7=_0x118df9[_0xc852('0x2f')];var _0x53d5a1=_0x18c72f?0x0:_0x49f65[_0xc852('0x2d')];var _0x1895e0=_0x18c72f?_0x118df9['count']:_0x49f65[_0xc852('0x2d')]+_0x49f65[_0xc852('0x30')];var _0x428702;if(_0x1895e0>=_0x2d6aa7){_0x1895e0=_0x2d6aa7;_0x428702=0xc8;}else{_0x428702=0xce;}_0x1266e0[_0xc852('0x2b')](_0x428702);return _0x1266e0[_0xc852('0x31')]('Content-Range',_0x53d5a1+'-'+_0x1895e0+'/'+_0x2d6aa7)[_0xc852('0x32')](_0x118df9);}return null;};}function patchUpdates(_0x20da7f){return function(_0x47e04d){try{jsonpatch[_0xc852('0x33')](_0x47e04d,_0x20da7f,!![]);}catch(_0xbba04e){return BPromise[_0xc852('0x34')](_0xbba04e);}return _0x47e04d[_0xc852('0x35')]();};}function saveUpdates(_0x5c0a99,_0x4c6c06){return function(_0x1a86b8){if(_0x1a86b8){return _0x1a86b8[_0xc852('0x36')](_0x5c0a99)['then'](function(_0x6ef3f2){return _0x6ef3f2;});}return null;};}function removeEntity(_0x48704d,_0x5f1754){return function(_0xc16ad5){if(_0xc16ad5){return _0xc16ad5[_0xc852('0x37')]()[_0xc852('0x1e')](function(){_0x48704d['status'](0xcc)[_0xc852('0x2c')]();});}};}function handleEntityNotFound(_0x555cd1,_0x5547bf){return function(_0x23440a){if(!_0x23440a){_0x555cd1[_0xc852('0x2a')](0x194);}return _0x23440a;};}function handleError(_0x3acdbe,_0x4d606e){_0x4d606e=_0x4d606e||0x1f4;return function(_0x2d6b0c){logger[_0xc852('0x24')](_0x2d6b0c['stack']);if(_0x2d6b0c[_0xc852('0x38')]){delete _0x2d6b0c[_0xc852('0x38')];}_0x3acdbe[_0xc852('0x2b')](_0x4d606e)['send'](_0x2d6b0c);};}exports[_0xc852('0x39')]=function(_0x1b610d,_0x1001db){var _0x2cb3e0={},_0x2ed2cc={},_0x93ec8e={'count':0x0,'rows':[]};var _0x1f9c48=_[_0xc852('0x3a')](db[_0xc852('0x3b')][_0xc852('0x3c')],function(_0x17c543){return{'name':_0x17c543[_0xc852('0x3d')],'type':_0x17c543[_0xc852('0x3e')][_0xc852('0x3f')]};});_0x2ed2cc[_0xc852('0x40')]=_[_0xc852('0x3a')](_0x1f9c48,_0xc852('0x38'));_0x2ed2cc['query']=_[_0xc852('0x41')](_0x1b610d['query']);_0x2ed2cc[_0xc852('0x42')]=_[_0xc852('0x43')](_0x2ed2cc[_0xc852('0x40')],_0x2ed2cc[_0xc852('0x44')]);_0x2cb3e0[_0xc852('0x45')]=_['intersection'](_0x2ed2cc[_0xc852('0x40')],qs[_0xc852('0x46')](_0x1b610d['query'][_0xc852('0x46')]));_0x2cb3e0[_0xc852('0x45')]=_0x2cb3e0[_0xc852('0x45')][_0xc852('0x47')]?_0x2cb3e0['attributes']:_0x2ed2cc[_0xc852('0x40')];if(!_0x1b610d[_0xc852('0x44')][_0xc852('0x48')](_0xc852('0x49'))){_0x2cb3e0['limit']=qs[_0xc852('0x30')](_0x1b610d[_0xc852('0x44')][_0xc852('0x30')]);_0x2cb3e0[_0xc852('0x2d')]=qs[_0xc852('0x2d')](_0x1b610d[_0xc852('0x44')][_0xc852('0x2d')]);}_0x2cb3e0['order']=qs['sort'](_0x1b610d['query'][_0xc852('0x4a')]);_0x2cb3e0[_0xc852('0x4b')]=qs[_0xc852('0x42')](_[_0xc852('0x4c')](_0x1b610d[_0xc852('0x44')],_0x2ed2cc[_0xc852('0x42')]),_0x1f9c48);if(_0x1b610d[_0xc852('0x44')][_0xc852('0x4d')]){_0x2cb3e0[_0xc852('0x4b')]=_[_0xc852('0x4e')](_0x2cb3e0[_0xc852('0x4b')],{'$or':_['map'](_0x1f9c48,function(_0x428286){if(_0x428286[_0xc852('0x3e')]!==_0xc852('0x4f')){var _0x11fc77={};_0x11fc77[_0x428286[_0xc852('0x38')]]={'$like':'%'+_0x1b610d[_0xc852('0x44')][_0xc852('0x4d')]+'%'};return _0x11fc77;}})});}_0x2cb3e0=_[_0xc852('0x4e')]({},_0x2cb3e0,_0x1b610d[_0xc852('0x50')]);var _0x351f4f={'where':_0x2cb3e0[_0xc852('0x4b')]};return db[_0xc852('0x3b')][_0xc852('0x2f')](_0x351f4f)[_0xc852('0x1e')](function(_0x5b9164){_0x93ec8e[_0xc852('0x2f')]=_0x5b9164;if(_0x1b610d[_0xc852('0x44')][_0xc852('0x51')]){_0x2cb3e0[_0xc852('0x52')]=[{'all':!![]}];}return db[_0xc852('0x3b')]['findAll'](_0x2cb3e0);})[_0xc852('0x1e')](function(_0x96abea){_0x93ec8e[_0xc852('0x53')]=_0x96abea;return _0x93ec8e;})[_0xc852('0x1e')](respondWithFilteredResult(_0x1001db,_0x2cb3e0))[_0xc852('0x29')](handleError(_0x1001db,null));};exports[_0xc852('0x54')]=function(_0x2cbc92,_0x181752){var _0x4331e7={'raw':!![],'where':{'id':_0x2cbc92[_0xc852('0x55')]['id']}},_0xcbb110={};_0xcbb110['model']=_[_0xc852('0x41')](db[_0xc852('0x3b')]['rawAttributes']);_0xcbb110[_0xc852('0x44')]=_[_0xc852('0x41')](_0x2cbc92['query']);_0xcbb110[_0xc852('0x42')]=_[_0xc852('0x43')](_0xcbb110['model'],_0xcbb110[_0xc852('0x44')]);_0x4331e7[_0xc852('0x45')]=_['intersection'](_0xcbb110[_0xc852('0x40')],qs[_0xc852('0x46')](_0x2cbc92['query'][_0xc852('0x46')]));_0x4331e7[_0xc852('0x45')]=_0x4331e7[_0xc852('0x45')][_0xc852('0x47')]?_0x4331e7[_0xc852('0x45')]:_0xcbb110[_0xc852('0x40')];if(_0x2cbc92[_0xc852('0x44')]['includeAll']){_0x4331e7[_0xc852('0x52')]=[{'all':!![]}];}_0x4331e7=_[_0xc852('0x4e')]({},_0x4331e7,_0x2cbc92[_0xc852('0x50')]);return db[_0xc852('0x3b')][_0xc852('0x56')](_0x4331e7)[_0xc852('0x1e')](handleEntityNotFound(_0x181752,null))[_0xc852('0x1e')](respondWithResult(_0x181752,null))[_0xc852('0x29')](handleError(_0x181752,null));};exports[_0xc852('0x57')]=function(_0x1d5fd1,_0x40c171){return db[_0xc852('0x3b')][_0xc852('0x57')](_0x1d5fd1[_0xc852('0x58')],{})['then'](respondWithResult(_0x40c171,0xc9))[_0xc852('0x29')](handleError(_0x40c171,null));};exports['update']=function(_0x427f1b,_0x45af4c){if(_0x427f1b[_0xc852('0x58')]['id']){delete _0x427f1b[_0xc852('0x58')]['id'];}return db['SmsMessage']['find']({'where':{'id':_0x427f1b['params']['id']}})[_0xc852('0x1e')](handleEntityNotFound(_0x45af4c,null))[_0xc852('0x1e')](saveUpdates(_0x427f1b['body'],null))[_0xc852('0x1e')](respondWithResult(_0x45af4c,null))['catch'](handleError(_0x45af4c,null));};exports[_0xc852('0x37')]=function(_0x558b73,_0x2dcd68){return db[_0xc852('0x3b')]['find']({'where':{'id':_0x558b73[_0xc852('0x55')]['id']}})[_0xc852('0x1e')](handleEntityNotFound(_0x2dcd68,null))[_0xc852('0x1e')](removeEntity(_0x2dcd68,null))[_0xc852('0x29')](handleError(_0x2dcd68,null));};exports['describe']=function(_0x5ae986,_0x32f5ec){return db[_0xc852('0x3b')][_0xc852('0x59')]()['then'](respondWithResult(_0x32f5ec,null))[_0xc852('0x29')](handleError(_0x32f5ec,null));};var interaction_log=require(_0xc852('0x12'))('sms-interactions');exports[_0xc852('0x5a')]=function(_0x2738c1,_0x489e33,_0xde481d){var _0x4897eb={'agent':{},'channel':'sms'};if(_0x2738c1[_0xc852('0x58')]['id']){delete _0x2738c1[_0xc852('0x58')]['id'];}_0x2738c1[_0xc852('0x58')][_0xc852('0x5b')]=!![];_0x2738c1[_0xc852('0x58')][_0xc852('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2738c1[_0xc852('0x58')][_0xc852('0x5d')]=_0x2738c1[_0xc852('0x58')][_0xc852('0x5d')]||_0x2738c1['user']['id'];_0x4897eb['agent']['id']=_0x2738c1[_0xc852('0x58')][_0xc852('0x5d')];return db[_0xc852('0x3b')]['find']({'where':{'id':_0x2738c1[_0xc852('0x55')]['id'],'UserId':null}})[_0xc852('0x1e')](handleEntityNotFound(_0x489e33,null))['then'](saveUpdates(_0x2738c1['body'],null))[_0xc852('0x1e')](function(_0x4fcfea){if(_0x4fcfea){_0x4897eb[_0xc852('0x27')]=_0x4fcfea[_0xc852('0x5e')]({'plain':!![]});return db['SmsInteraction'][_0xc852('0x56')]({'where':{'id':_0x4fcfea[_0xc852('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x489e33,null))[_0xc852('0x1e')](function(_0x31ef41){if(_0x31ef41){return _0x31ef41[_0xc852('0x36')]({'UserId':_0x2738c1[_0xc852('0x58')][_0xc852('0x5d')],'read1stAt':_['isNil'](_0x31ef41[_0xc852('0x60')])?moment()[_0xc852('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xc852('0x1e')](function(_0x119cb5){if(_0x119cb5){_0x4897eb[_0xc852('0x62')]=_0x119cb5['get']({'plain':!![]});interaction_log[_0xc852('0x1f')](_0xc852('0x63'),_0x2738c1[_0xc852('0x64')]['id'],_0x2738c1['user'][_0xc852('0x38')],_0x2738c1['user'][_0xc852('0x65')],_0x4897eb[_0xc852('0x62')]['id'],_0x2738c1[_0xc852('0x58')]?JSON['stringify'](_0x2738c1[_0xc852('0x58')]):_0xc852('0x66'));return respondWithRpcPromise(_0xc852('0x67'),'acceptMessage',_0x4897eb);}return null;})['then'](function(_0x4fa9b6){var _0xc106a5=_0xc852('0x68')+_0x4fa9b6['message'][_0xc852('0x69')];return db[_0xc852('0x6a')][_0xc852('0x44')](_0xc106a5,{'type':db[_0xc852('0x6b')]['QueryTypes'][_0xc852('0x6c')],'raw':!![]})[_0xc852('0x1e')](function(_0x5cfff0){return _0x5cfff0;});})[_0xc852('0x1e')](function(_0x1cc613){if(_0x1cc613){_0x4897eb[_0xc852('0x27')][_0xc852('0x6d')]=_0x1cc613[0x0];if(!_0x2738c1[_0xc852('0x58')][_0xc852('0x5d')])return;return db[_0xc852('0x6e')]['find']({'where':{'id':_0x2738c1[_0xc852('0x58')]['UserId'],'role':_0xc852('0x6f')},'attributes':['id',_0xc852('0x38'),_0xc852('0x70'),_0xc852('0x71'),_0xc852('0x72')],'raw':!![]});}return null;})[_0xc852('0x1e')](function(_0x1811ea){if(!_0x1811ea)return null;_0x4897eb[_0xc852('0x27')][_0xc852('0x6f')]=_0x1811ea;return _0x4897eb;})[_0xc852('0x1e')](function(_0x6cbcbd){if(_0x6cbcbd){if(_0x2738c1['body']['manual']){_0x4897eb[_0xc852('0x27')][_0xc852('0x73')]=util[_0xc852('0x61')](_0xc852('0x74'),_0x2738c1[_0xc852('0x64')][_0xc852('0x38')]);_0x4897eb[_0xc852('0x27')]['channel']=_0x4897eb[_0xc852('0x75')];_0x4897eb['message'][_0xc852('0x76')]=_0x4897eb['channel'];_0x4897eb['message'][_0xc852('0x77')]=_0xc852('0x5a');return respondWithRpcPromise(_0xc852('0x78'),_0xc852('0x78'),{'event':'acceptmessage','message':_0x4897eb[_0xc852('0x27')]},client9002)[_0xc852('0x1e')](function(){return _0x4897eb;});}return _0x4897eb;}return null;})[_0xc852('0x1e')](respondWithResult(_0x489e33,null))['catch'](handleError(_0x489e33,null));};var interaction_log=require('../../config/logger')(_0xc852('0x79'));exports[_0xc852('0x34')]=function(_0x312b8a,_0x6eefe0,_0x16cbed){var _0x21ac24={'agent':{},'channel':'sms'};if(_0x312b8a[_0xc852('0x58')]['id']){delete _0x312b8a['body']['id'];}_0x312b8a[_0xc852('0x58')]['UserId']=_0x312b8a['body']['UserId']||_0x312b8a[_0xc852('0x64')]['id'];_0x21ac24[_0xc852('0x6f')]['id']=_0x312b8a[_0xc852('0x58')][_0xc852('0x5d')];return db[_0xc852('0x3b')][_0xc852('0x56')]({'where':{'id':_0x312b8a['params']['id'],'UserId':null}})[_0xc852('0x1e')](handleEntityNotFound(_0x6eefe0,null))[_0xc852('0x1e')](function(_0xcdb4d1){if(_0xcdb4d1){_0x21ac24[_0xc852('0x27')]=_0xcdb4d1[_0xc852('0x5e')]({'plain':!![]});return db[_0xc852('0x7a')][_0xc852('0x56')]({'where':{'id':_0xcdb4d1['SmsInteractionId']}});}return null;})[_0xc852('0x1e')](handleEntityNotFound(_0x6eefe0,null))['then'](function(_0x3cdf8f){if(_0x3cdf8f){_0x21ac24[_0xc852('0x62')]=_0x3cdf8f['get']({'plain':!![]});interaction_log[_0xc852('0x1f')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x312b8a[_0xc852('0x64')]['id'],_0x312b8a[_0xc852('0x64')][_0xc852('0x38')],_0x312b8a[_0xc852('0x64')][_0xc852('0x65')],_0x21ac24['interaction']['id'],_0x312b8a[_0xc852('0x58')]?JSON[_0xc852('0x23')](_0x312b8a[_0xc852('0x58')]):'null');return respondWithRpcPromise(_0xc852('0x7b'),_0xc852('0x7c'),_0x21ac24);}return null;})['then'](function(_0xd5dac2){var _0x373b14=_0xc852('0x68')+_0xd5dac2[_0xc852('0x27')]['ContactId'];return db['sequelize'][_0xc852('0x44')](_0x373b14,{'type':db[_0xc852('0x6b')][_0xc852('0x7d')][_0xc852('0x6c')],'raw':!![]})[_0xc852('0x1e')](function(_0x18ea1a){return _0x18ea1a;});})[_0xc852('0x1e')](function(_0x5f061c){if(_0x5f061c){_0x21ac24[_0xc852('0x27')][_0xc852('0x6d')]=_0x5f061c[0x0];if(!_0x312b8a[_0xc852('0x58')][_0xc852('0x5d')])return;return db[_0xc852('0x6e')][_0xc852('0x56')]({'where':{'id':_0x312b8a[_0xc852('0x58')][_0xc852('0x5d')],'role':_0xc852('0x6f')},'attributes':['id','name',_0xc852('0x70'),_0xc852('0x71'),_0xc852('0x72')],'raw':!![]});}return null;})['then'](function(_0x5cfbde){if(!_0x5cfbde)return null;_0x21ac24[_0xc852('0x27')][_0xc852('0x6f')]=_0x5cfbde;return _0x21ac24;})[_0xc852('0x1e')](function(_0x13d36c){if(_0x13d36c){_0x13d36c['message'][_0xc852('0x73')]=util[_0xc852('0x61')](_0xc852('0x74'),_0x312b8a[_0xc852('0x64')][_0xc852('0x38')]);_0x13d36c[_0xc852('0x27')]['channel']=_0x21ac24[_0xc852('0x75')];_0x13d36c['message']['motionChannel']=_0x21ac24[_0xc852('0x75')];_0x13d36c[_0xc852('0x27')][_0xc852('0x77')]=_0xc852('0x34');respondWithRpcPromise(_0xc852('0x78'),_0xc852('0x78'),{'event':_0xc852('0x7e'),'message':_0x13d36c[_0xc852('0x27')]},client9002);return _0x21ac24;}return null;})['then'](respondWithResult(_0x6eefe0,null))[_0xc852('0x29')](handleError(_0x6eefe0,null));};exports[_0xc852('0x2b')]=function(_0x50b582,_0x2ea5f8,_0x41bb7d){if(_0x50b582['body']['id']){delete _0x50b582[_0xc852('0x58')]['id'];}var _0x581397;return db[_0xc852('0x3b')][_0xc852('0x56')]({'where':{'id':_0x50b582[_0xc852('0x55')]['id']}})[_0xc852('0x1e')](handleEntityNotFound(_0x2ea5f8,null))['then'](function(_0x33f7cd){if(_0x33f7cd){_0x581397=_0x33f7cd;return db[_0xc852('0x7f')]['find']({'where':{'id':_0x33f7cd['SmsAccountId']}});}})[_0xc852('0x1e')](handleEntityNotFound(_0x2ea5f8,null))[_0xc852('0x1e')](function(_0x16b9cf){if(_0x16b9cf){logger[_0xc852('0x21')](_0xc852('0x22'),_0xc852('0x2b'),_0xc852('0x80'),_0x16b9cf[_0xc852('0x3e')],util[_0xc852('0x81')](_0x50b582['body'],{'showHidden':![],'depth':null}));switch(_0x16b9cf[_0xc852('0x3e')]){case _0xc852('0x82'):if(_0x50b582[_0xc852('0x58')][_0xc852('0x83')]&&_0x50b582[_0xc852('0x58')][_0xc852('0x83')]===_0x581397['messageId']){return _0x581397[_0xc852('0x36')]({'read':!![]});}else{logger[_0xc852('0x24')](_0xc852('0x84'),_0xc852('0x2b'),'twilio',util[_0xc852('0x81')](_0x50b582[_0xc852('0x58')],{'showHidden':![],'depth':null}));}break;case _0xc852('0x85'):if(_0x50b582[_0xc852('0x58')][_0xc852('0x86')]&&_0x50b582[_0xc852('0x58')][_0xc852('0x86')]===_0x581397[_0xc852('0x87')]&&_[_0xc852('0x88')]([_0xc852('0x89'),_0xc852('0x8a')],_0x50b582['body'][_0xc852('0x8b')])>=0x0){return _0x581397['update']({'read':!![]});}else{logger[_0xc852('0x24')](_0xc852('0x84'),_0xc852('0x2b'),'plivio',util[_0xc852('0x81')](_0x50b582[_0xc852('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4c4ae5=_0x50b582[_0xc852('0x58')][_0xc852('0x8c')][0x0];if(_0x4c4ae5['status']['groupName']===_0xc852('0x8d')){return _0x581397[_0xc852('0x36')]({'read':!![]});}else{logger[_0xc852('0x24')](_0xc852('0x84'),'status','infobip',util[_0xc852('0x81')](_0x50b582[_0xc852('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x581397;}})[_0xc852('0x1e')](respondWithResult(_0x2ea5f8,null))[_0xc852('0x29')](handleError(_0x2ea5f8,null));}; \ No newline at end of file +var _0x09d2=['MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','sent','delivered','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','client','http','then','info','debug','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','count','set','Content-Range','reject','update','destroy','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','show','include','options','create','body','find','params','describe','sms-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','EventManager','acceptmessage','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','QueryTypes','motionChannel','event','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','type','inspect'];(function(_0x532e7e,_0x59b026){var _0x99b592=function(_0x50e0f9){while(--_0x50e0f9){_0x532e7e['push'](_0x532e7e['shift']());}};_0x99b592(++_0x59b026);}(_0x09d2,0x1d2));var _0x209d=function(_0x512ffb,_0x1bd7e5){_0x512ffb=_0x512ffb-0x0;var _0x5e76cc=_0x09d2[_0x512ffb];return _0x5e76cc;};'use strict';var emlformat=require(_0x209d('0x0'));var rimraf=require(_0x209d('0x1'));var zipdir=require(_0x209d('0x2'));var jsonpatch=require(_0x209d('0x3'));var rp=require(_0x209d('0x4'));var moment=require(_0x209d('0x5'));var BPromise=require(_0x209d('0x6'));var Mustache=require(_0x209d('0x7'));var util=require(_0x209d('0x8'));var path=require(_0x209d('0x9'));var sox=require('sox');var csv=require(_0x209d('0xa'));var ejs=require(_0x209d('0xb'));var fs=require('fs');var fs_extra=require(_0x209d('0xc'));var _=require(_0x209d('0xd'));var squel=require(_0x209d('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x209d('0xf'));var toCsv=require(_0x209d('0xa'));var querystring=require(_0x209d('0x10'));var Papa=require('papaparse');var Redis=require(_0x209d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x209d('0x12'));var as=require(_0x209d('0x13'));var hardwareService=require(_0x209d('0x14'));var logger=require(_0x209d('0x15'))(_0x209d('0x16'));var utils=require(_0x209d('0x17'));var config=require(_0x209d('0x18'));var licenseUtil=require(_0x209d('0x19'));var db=require(_0x209d('0x1a'))['db'];config[_0x209d('0x1b')]=_[_0x209d('0x1c')](config[_0x209d('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x209d('0x1d'))(new Redis(config[_0x209d('0x1b')]));require(_0x209d('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x209d('0x1f')]['http']({'port':0x232c});var client9002=jayson['client'][_0x209d('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x434fef,_0x2dd027,_0x546766,_0x129797){return new BPromise(function(_0xe0721,_0x1bff51){var _0x1ed340=_0x129797||client;return _0x1ed340['request'](_0x434fef,_0x546766)[_0x209d('0x21')](function(_0x437f76){logger[_0x209d('0x22')]('SmsMessage,\x20%s,\x20%s',_0x2dd027,'request\x20sent');logger[_0x209d('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2dd027,_0x209d('0x24'),JSON[_0x209d('0x25')](_0x437f76));if(_0x437f76[_0x209d('0x26')]){if(_0x437f76[_0x209d('0x26')][_0x209d('0x27')]===0x1f4){logger[_0x209d('0x26')](_0x209d('0x28'),_0x2dd027,_0x437f76[_0x209d('0x26')][_0x209d('0x29')]);return _0x1bff51(_0x437f76[_0x209d('0x26')][_0x209d('0x29')]);}logger[_0x209d('0x26')](_0x209d('0x28'),_0x2dd027,_0x437f76[_0x209d('0x26')][_0x209d('0x29')]);return _0xe0721(_0x437f76[_0x209d('0x26')][_0x209d('0x29')]);}else{logger[_0x209d('0x22')](_0x209d('0x28'),_0x2dd027,_0x209d('0x24'));_0xe0721(_0x437f76[_0x209d('0x2a')]['message']);}})[_0x209d('0x2b')](function(_0x44ef65){logger['error'](_0x209d('0x28'),_0x2dd027,_0x44ef65);_0x1bff51(_0x44ef65);});});}function respondWithStatusCode(_0x561ad6,_0x396500){_0x396500=_0x396500||0xcc;return function(_0x15b8c7){if(_0x15b8c7){return _0x561ad6[_0x209d('0x2c')](_0x396500);}return _0x561ad6[_0x209d('0x2d')](_0x396500)[_0x209d('0x2e')]();};}function respondWithResult(_0x819a15,_0x5399e3){_0x5399e3=_0x5399e3||0xc8;return function(_0x182d8b){if(_0x182d8b){return _0x819a15[_0x209d('0x2d')](_0x5399e3)['json'](_0x182d8b);}};}function respondWithFilteredResult(_0x2f1b01,_0x14dc18){return function(_0x21899a){if(_0x21899a){var _0x28750e=typeof _0x14dc18[_0x209d('0x2f')]===_0x209d('0x30')&&typeof _0x14dc18['limit']==='undefined';var _0x46b3ef=_0x21899a['count'];var _0x3a69da=_0x28750e?0x0:_0x14dc18['offset'];var _0x1fbdba=_0x28750e?_0x21899a[_0x209d('0x31')]:_0x14dc18['offset']+_0x14dc18['limit'];var _0x48e200;if(_0x1fbdba>=_0x46b3ef){_0x1fbdba=_0x46b3ef;_0x48e200=0xc8;}else{_0x48e200=0xce;}_0x2f1b01[_0x209d('0x2d')](_0x48e200);return _0x2f1b01[_0x209d('0x32')](_0x209d('0x33'),_0x3a69da+'-'+_0x1fbdba+'/'+_0x46b3ef)['json'](_0x21899a);}return null;};}function patchUpdates(_0x182525){return function(_0x3fafab){try{jsonpatch['apply'](_0x3fafab,_0x182525,!![]);}catch(_0x4860f5){return BPromise[_0x209d('0x34')](_0x4860f5);}return _0x3fafab['save']();};}function saveUpdates(_0x36d058,_0x16b1d4){return function(_0x26f697){if(_0x26f697){return _0x26f697[_0x209d('0x35')](_0x36d058)[_0x209d('0x21')](function(_0x4471c1){return _0x4471c1;});}return null;};}function removeEntity(_0x2953aa,_0x4d8542){return function(_0x3546b0){if(_0x3546b0){return _0x3546b0[_0x209d('0x36')]()[_0x209d('0x21')](function(){_0x2953aa[_0x209d('0x2d')](0xcc)[_0x209d('0x2e')]();});}};}function handleEntityNotFound(_0x1442bf,_0x200c6b){return function(_0x29ece2){if(!_0x29ece2){_0x1442bf[_0x209d('0x2c')](0x194);}return _0x29ece2;};}function handleError(_0x454003,_0x130008){_0x130008=_0x130008||0x1f4;return function(_0x28a5cc){logger[_0x209d('0x26')](_0x28a5cc['stack']);if(_0x28a5cc[_0x209d('0x37')]){delete _0x28a5cc['name'];}_0x454003[_0x209d('0x2d')](_0x130008)[_0x209d('0x38')](_0x28a5cc);};}exports[_0x209d('0x39')]=function(_0x507c4c,_0x489746){var _0x40919e={},_0x2e3726={},_0x151753={'count':0x0,'rows':[]};var _0x38d6e4=_[_0x209d('0x3a')](db[_0x209d('0x3b')][_0x209d('0x3c')],function(_0x1581d7){return{'name':_0x1581d7[_0x209d('0x3d')],'type':_0x1581d7['type'][_0x209d('0x3e')]};});_0x2e3726[_0x209d('0x3f')]=_[_0x209d('0x3a')](_0x38d6e4,_0x209d('0x37'));_0x2e3726[_0x209d('0x40')]=_[_0x209d('0x41')](_0x507c4c[_0x209d('0x40')]);_0x2e3726[_0x209d('0x42')]=_[_0x209d('0x43')](_0x2e3726[_0x209d('0x3f')],_0x2e3726['query']);_0x40919e[_0x209d('0x44')]=_[_0x209d('0x43')](_0x2e3726[_0x209d('0x3f')],qs[_0x209d('0x45')](_0x507c4c['query'][_0x209d('0x45')]));_0x40919e[_0x209d('0x44')]=_0x40919e['attributes'][_0x209d('0x46')]?_0x40919e[_0x209d('0x44')]:_0x2e3726[_0x209d('0x3f')];if(!_0x507c4c['query']['hasOwnProperty'](_0x209d('0x47'))){_0x40919e[_0x209d('0x48')]=qs[_0x209d('0x48')](_0x507c4c[_0x209d('0x40')][_0x209d('0x48')]);_0x40919e['offset']=qs[_0x209d('0x2f')](_0x507c4c['query']['offset']);}_0x40919e[_0x209d('0x49')]=qs[_0x209d('0x4a')](_0x507c4c[_0x209d('0x40')][_0x209d('0x4a')]);_0x40919e[_0x209d('0x4b')]=qs[_0x209d('0x42')](_[_0x209d('0x4c')](_0x507c4c[_0x209d('0x40')],_0x2e3726[_0x209d('0x42')]),_0x38d6e4);if(_0x507c4c['query'][_0x209d('0x4d')]){_0x40919e[_0x209d('0x4b')]=_[_0x209d('0x4e')](_0x40919e[_0x209d('0x4b')],{'$or':_[_0x209d('0x3a')](_0x38d6e4,function(_0x39f36e){if(_0x39f36e['type']!==_0x209d('0x4f')){var _0x45dc3b={};_0x45dc3b[_0x39f36e['name']]={'$like':'%'+_0x507c4c[_0x209d('0x40')][_0x209d('0x4d')]+'%'};return _0x45dc3b;}})});}_0x40919e=_[_0x209d('0x4e')]({},_0x40919e,_0x507c4c['options']);var _0x3a6972={'where':_0x40919e[_0x209d('0x4b')]};return db[_0x209d('0x3b')][_0x209d('0x31')](_0x3a6972)[_0x209d('0x21')](function(_0x19c234){_0x151753['count']=_0x19c234;if(_0x507c4c['query'][_0x209d('0x50')]){_0x40919e['include']=[{'all':!![]}];}return db[_0x209d('0x3b')][_0x209d('0x51')](_0x40919e);})[_0x209d('0x21')](function(_0xacc1ca){_0x151753['rows']=_0xacc1ca;return _0x151753;})[_0x209d('0x21')](respondWithFilteredResult(_0x489746,_0x40919e))['catch'](handleError(_0x489746,null));};exports[_0x209d('0x52')]=function(_0x1503bd,_0x580bc5){var _0x26c63c={'raw':!![],'where':{'id':_0x1503bd['params']['id']}},_0x32cba3={};_0x32cba3[_0x209d('0x3f')]=_[_0x209d('0x41')](db['SmsMessage'][_0x209d('0x3c')]);_0x32cba3[_0x209d('0x40')]=_[_0x209d('0x41')](_0x1503bd[_0x209d('0x40')]);_0x32cba3[_0x209d('0x42')]=_[_0x209d('0x43')](_0x32cba3['model'],_0x32cba3[_0x209d('0x40')]);_0x26c63c[_0x209d('0x44')]=_['intersection'](_0x32cba3[_0x209d('0x3f')],qs[_0x209d('0x45')](_0x1503bd[_0x209d('0x40')][_0x209d('0x45')]));_0x26c63c['attributes']=_0x26c63c['attributes'][_0x209d('0x46')]?_0x26c63c[_0x209d('0x44')]:_0x32cba3['model'];if(_0x1503bd[_0x209d('0x40')][_0x209d('0x50')]){_0x26c63c[_0x209d('0x53')]=[{'all':!![]}];}_0x26c63c=_[_0x209d('0x4e')]({},_0x26c63c,_0x1503bd[_0x209d('0x54')]);return db[_0x209d('0x3b')]['find'](_0x26c63c)[_0x209d('0x21')](handleEntityNotFound(_0x580bc5,null))[_0x209d('0x21')](respondWithResult(_0x580bc5,null))[_0x209d('0x2b')](handleError(_0x580bc5,null));};exports[_0x209d('0x55')]=function(_0x2d4a5e,_0x532ba5){return db['SmsMessage'][_0x209d('0x55')](_0x2d4a5e[_0x209d('0x56')],{})['then'](respondWithResult(_0x532ba5,0xc9))[_0x209d('0x2b')](handleError(_0x532ba5,null));};exports[_0x209d('0x35')]=function(_0x65f8a,_0x25eb7b){if(_0x65f8a[_0x209d('0x56')]['id']){delete _0x65f8a['body']['id'];}return db['SmsMessage'][_0x209d('0x57')]({'where':{'id':_0x65f8a['params']['id']}})[_0x209d('0x21')](handleEntityNotFound(_0x25eb7b,null))[_0x209d('0x21')](saveUpdates(_0x65f8a[_0x209d('0x56')],null))[_0x209d('0x21')](respondWithResult(_0x25eb7b,null))[_0x209d('0x2b')](handleError(_0x25eb7b,null));};exports[_0x209d('0x36')]=function(_0x48f0e6,_0x12229c){return db[_0x209d('0x3b')][_0x209d('0x57')]({'where':{'id':_0x48f0e6[_0x209d('0x58')]['id']}})['then'](handleEntityNotFound(_0x12229c,null))['then'](removeEntity(_0x12229c,null))[_0x209d('0x2b')](handleError(_0x12229c,null));};exports[_0x209d('0x59')]=function(_0x24cbf9,_0x30a815){return db['SmsMessage']['describe']()['then'](respondWithResult(_0x30a815,null))[_0x209d('0x2b')](handleError(_0x30a815,null));};var interaction_log=require(_0x209d('0x15'))(_0x209d('0x5a'));exports[_0x209d('0x5b')]=function(_0x31f076,_0x4de4fa,_0x5e9d45){var _0x3d0403={'agent':{},'channel':'sms'};if(_0x31f076['body']['id']){delete _0x31f076[_0x209d('0x56')]['id'];}_0x31f076[_0x209d('0x56')]['read']=!![];_0x31f076[_0x209d('0x56')][_0x209d('0x5c')]=moment()[_0x209d('0x5d')](_0x209d('0x5e'));_0x31f076[_0x209d('0x56')]['UserId']=_0x31f076['body'][_0x209d('0x5f')]||_0x31f076[_0x209d('0x60')]['id'];_0x3d0403[_0x209d('0x61')]['id']=_0x31f076[_0x209d('0x56')]['UserId'];return db[_0x209d('0x3b')][_0x209d('0x57')]({'where':{'id':_0x31f076[_0x209d('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4de4fa,null))['then'](saveUpdates(_0x31f076[_0x209d('0x56')],null))[_0x209d('0x21')](function(_0x3b68eb){if(_0x3b68eb){_0x3d0403[_0x209d('0x29')]=_0x3b68eb[_0x209d('0x62')]({'plain':!![]});return db[_0x209d('0x63')][_0x209d('0x57')]({'where':{'id':_0x3b68eb[_0x209d('0x64')]}});}return null;})[_0x209d('0x21')](handleEntityNotFound(_0x4de4fa,null))[_0x209d('0x21')](function(_0x520995){if(_0x520995){return _0x520995[_0x209d('0x35')]({'UserId':_0x31f076[_0x209d('0x56')][_0x209d('0x5f')],'read1stAt':_[_0x209d('0x65')](_0x520995[_0x209d('0x66')])?moment()[_0x209d('0x5d')](_0x209d('0x5e')):undefined});}return null;})[_0x209d('0x21')](function(_0x1b9a13){if(_0x1b9a13){_0x3d0403[_0x209d('0x67')]=_0x1b9a13[_0x209d('0x62')]({'plain':!![]});interaction_log[_0x209d('0x22')](_0x209d('0x68'),_0x31f076[_0x209d('0x60')]['id'],_0x31f076['user']['name'],_0x31f076[_0x209d('0x60')][_0x209d('0x69')],_0x3d0403[_0x209d('0x67')]['id'],_0x31f076[_0x209d('0x56')]?JSON[_0x209d('0x25')](_0x31f076[_0x209d('0x56')]):'null');return respondWithRpcPromise(_0x209d('0x6a'),_0x209d('0x6b'),_0x3d0403);}return null;})[_0x209d('0x21')](function(_0xd745c7){var _0x85a029=_0x209d('0x6c')+_0xd745c7[_0x209d('0x29')][_0x209d('0x6d')];return db[_0x209d('0x6e')][_0x209d('0x40')](_0x85a029,{'type':db[_0x209d('0x6f')]['QueryTypes'][_0x209d('0x70')],'raw':!![]})['then'](function(_0x5daf79){return _0x5daf79;});})[_0x209d('0x21')](function(_0xa9b3f8){if(_0xa9b3f8){_0x3d0403[_0x209d('0x29')][_0x209d('0x71')]=_0xa9b3f8[0x0];if(!_0x31f076[_0x209d('0x56')][_0x209d('0x5f')])return;return db[_0x209d('0x72')][_0x209d('0x57')]({'where':{'id':_0x31f076['body'][_0x209d('0x5f')],'role':_0x209d('0x61')},'attributes':['id','name',_0x209d('0x73'),_0x209d('0x74'),_0x209d('0x75')],'raw':!![]});}return null;})[_0x209d('0x21')](function(_0x49260f){if(!_0x49260f)return null;_0x3d0403['message']['agent']=_0x49260f;return _0x3d0403;})[_0x209d('0x21')](function(_0x2d5901){if(_0x2d5901){if(_0x31f076[_0x209d('0x56')][_0x209d('0x76')]){_0x3d0403[_0x209d('0x29')][_0x209d('0x77')]=util['format'](_0x209d('0x78'),_0x31f076[_0x209d('0x60')][_0x209d('0x37')]);_0x3d0403['message']['channel']=_0x3d0403[_0x209d('0x79')];_0x3d0403['message']['motionChannel']=_0x3d0403['channel'];_0x3d0403[_0x209d('0x29')]['event']=_0x209d('0x5b');return respondWithRpcPromise('EventManager',_0x209d('0x7a'),{'event':_0x209d('0x7b'),'message':_0x3d0403[_0x209d('0x29')]},client9002)[_0x209d('0x21')](function(){return _0x3d0403;});}return _0x3d0403;}return null;})['then'](respondWithResult(_0x4de4fa,null))[_0x209d('0x2b')](handleError(_0x4de4fa,null));};var interaction_log=require(_0x209d('0x15'))('sms-interactions');exports[_0x209d('0x34')]=function(_0x195b46,_0x83df1b,_0x1fa82e){var _0x2bba8c={'agent':{},'channel':_0x209d('0x7c')};if(_0x195b46['body']['id']){delete _0x195b46[_0x209d('0x56')]['id'];}_0x195b46['body'][_0x209d('0x5f')]=_0x195b46[_0x209d('0x56')][_0x209d('0x5f')]||_0x195b46['user']['id'];_0x2bba8c[_0x209d('0x61')]['id']=_0x195b46[_0x209d('0x56')][_0x209d('0x5f')];return db['SmsMessage'][_0x209d('0x57')]({'where':{'id':_0x195b46[_0x209d('0x58')]['id'],'UserId':null}})[_0x209d('0x21')](handleEntityNotFound(_0x83df1b,null))[_0x209d('0x21')](function(_0x417c19){if(_0x417c19){_0x2bba8c[_0x209d('0x29')]=_0x417c19[_0x209d('0x62')]({'plain':!![]});return db[_0x209d('0x63')][_0x209d('0x57')]({'where':{'id':_0x417c19['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x83df1b,null))['then'](function(_0x4756ef){if(_0x4756ef){_0x2bba8c[_0x209d('0x67')]=_0x4756ef['get']({'plain':!![]});interaction_log[_0x209d('0x22')](_0x209d('0x7d'),_0x195b46[_0x209d('0x60')]['id'],_0x195b46['user']['name'],_0x195b46[_0x209d('0x60')]['role'],_0x2bba8c[_0x209d('0x67')]['id'],_0x195b46['body']?JSON['stringify'](_0x195b46[_0x209d('0x56')]):_0x209d('0x7e'));return respondWithRpcPromise(_0x209d('0x7f'),_0x209d('0x80'),_0x2bba8c);}return null;})[_0x209d('0x21')](function(_0x495921){var _0x510884=_0x209d('0x6c')+_0x495921[_0x209d('0x29')]['ContactId'];return db[_0x209d('0x6e')]['query'](_0x510884,{'type':db['Sequelize'][_0x209d('0x81')][_0x209d('0x70')],'raw':!![]})[_0x209d('0x21')](function(_0x42f5e5){return _0x42f5e5;});})[_0x209d('0x21')](function(_0x195a7d){if(_0x195a7d){_0x2bba8c[_0x209d('0x29')][_0x209d('0x71')]=_0x195a7d[0x0];if(!_0x195b46['body'][_0x209d('0x5f')])return;return db[_0x209d('0x72')][_0x209d('0x57')]({'where':{'id':_0x195b46[_0x209d('0x56')][_0x209d('0x5f')],'role':_0x209d('0x61')},'attributes':['id','name',_0x209d('0x73'),_0x209d('0x74'),_0x209d('0x75')],'raw':!![]});}return null;})['then'](function(_0x226045){if(!_0x226045)return null;_0x2bba8c['message']['agent']=_0x226045;return _0x2bba8c;})[_0x209d('0x21')](function(_0x3b24e4){if(_0x3b24e4){_0x3b24e4[_0x209d('0x29')][_0x209d('0x77')]=util[_0x209d('0x5d')](_0x209d('0x78'),_0x195b46[_0x209d('0x60')]['name']);_0x3b24e4[_0x209d('0x29')][_0x209d('0x79')]=_0x2bba8c[_0x209d('0x79')];_0x3b24e4[_0x209d('0x29')][_0x209d('0x82')]=_0x2bba8c['channel'];_0x3b24e4['message'][_0x209d('0x83')]=_0x209d('0x34');respondWithRpcPromise(_0x209d('0x7a'),_0x209d('0x7a'),{'event':_0x209d('0x84'),'message':_0x3b24e4[_0x209d('0x29')]},client9002);return _0x2bba8c;}return null;})[_0x209d('0x21')](respondWithResult(_0x83df1b,null))[_0x209d('0x2b')](handleError(_0x83df1b,null));};exports[_0x209d('0x2d')]=function(_0x22451e,_0x2f606c,_0x4bb216){if(_0x22451e[_0x209d('0x56')]['id']){delete _0x22451e[_0x209d('0x56')]['id'];}var _0x30f5f4;return db[_0x209d('0x3b')][_0x209d('0x57')]({'where':{'id':_0x22451e[_0x209d('0x58')]['id']}})[_0x209d('0x21')](handleEntityNotFound(_0x2f606c,null))[_0x209d('0x21')](function(_0x55e51f){if(_0x55e51f){_0x30f5f4=_0x55e51f;return db[_0x209d('0x85')]['find']({'where':{'id':_0x55e51f[_0x209d('0x86')]}});}})['then'](handleEntityNotFound(_0x2f606c,null))[_0x209d('0x21')](function(_0x54ed52){if(_0x54ed52){logger[_0x209d('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x209d('0x2d'),_0x209d('0x87'),_0x54ed52[_0x209d('0x88')],util[_0x209d('0x89')](_0x22451e[_0x209d('0x56')],{'showHidden':![],'depth':null}));switch(_0x54ed52[_0x209d('0x88')]){case'twilio':if(_0x22451e[_0x209d('0x56')][_0x209d('0x8a')]&&_0x22451e[_0x209d('0x56')]['MessageSid']===_0x30f5f4[_0x209d('0x8b')]){return _0x30f5f4['update']({'read':!![]});}else{logger['error'](_0x209d('0x8c'),_0x209d('0x2d'),_0x209d('0x8d'),util[_0x209d('0x89')](_0x22451e[_0x209d('0x56')],{'showHidden':![],'depth':null}));}break;case _0x209d('0x8e'):if(_0x22451e[_0x209d('0x56')]['MessageUUID']&&_0x22451e[_0x209d('0x56')][_0x209d('0x8f')]===_0x30f5f4['messageId']&&_['indexOf']([_0x209d('0x90'),_0x209d('0x91')],_0x22451e[_0x209d('0x56')]['Status'])>=0x0){return _0x30f5f4[_0x209d('0x35')]({'read':!![]});}else{logger['error'](_0x209d('0x8c'),_0x209d('0x2d'),_0x209d('0x92'),util[_0x209d('0x89')](_0x22451e[_0x209d('0x56')],{'showHidden':![],'depth':null}));}break;case _0x209d('0x93'):var _0x325f65=_0x22451e['body'][_0x209d('0x94')][0x0];if(_0x325f65[_0x209d('0x2d')][_0x209d('0x95')]===_0x209d('0x96')){return _0x30f5f4[_0x209d('0x35')]({'read':!![]});}else{logger[_0x209d('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x209d('0x93'),util['inspect'](_0x22451e[_0x209d('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x30f5f4;}})[_0x209d('0x21')](respondWithResult(_0x2f606c,null))[_0x209d('0x2b')](handleError(_0x2f606c,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 306cea0..9a8b185 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 _0xc2dc=['../../mysqldb','setMaxListeners','save','remove','emit','exports','events'];(function(_0x4aa6bb,_0x544026){var _0x236352=function(_0x2be211){while(--_0x2be211){_0x4aa6bb['push'](_0x4aa6bb['shift']());}};_0x236352(++_0x544026);}(_0xc2dc,0xa7));var _0xcc2d=function(_0x400f2a,_0x52a559){_0x400f2a=_0x400f2a-0x0;var _0x3dd8d1=_0xc2dc[_0x400f2a];return _0x3dd8d1;};'use strict';var EventEmitter=require(_0xcc2d('0x0'));var SmsMessage=require(_0xcc2d('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xcc2d('0x2')](0x0);var events={'afterCreate':_0xcc2d('0x3'),'afterUpdate':'update','afterDestroy':_0xcc2d('0x4')};function emitEvent(_0xfc5195){return function(_0x3925c5,_0x4c86a7,_0xad3843){SmsMessageEvents[_0xcc2d('0x5')](_0xfc5195+':'+_0x3925c5['id'],_0x3925c5);SmsMessageEvents[_0xcc2d('0x5')](_0xfc5195,_0x3925c5);_0xad3843(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xcc2d('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0xe500=['emit','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe500,0x153));var _0x0e50=function(_0x15a634,_0x4feb86){_0x15a634=_0x15a634-0x0;var _0xf4f7a0=_0xe500[_0x15a634];return _0xf4f7a0;};'use strict';var EventEmitter=require(_0x0e50('0x0'));var SmsMessage=require(_0x0e50('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x0e50('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0e50('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4cffbc){return function(_0x43272f,_0x45c15b,_0x1e9a21){SmsMessageEvents[_0x0e50('0x4')](_0x4cffbc+':'+_0x43272f['id'],_0x43272f);SmsMessageEvents['emit'](_0x4cffbc,_0x43272f);_0x1e9a21(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x0e50('0x5')](e,emitEvent(event));}}module[_0x0e50('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 997bafd..d1ae19d 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 _0x99d0=['path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','UserId','isNil','SmsInteraction','findOne','then','update','createdAt','error','out','secret','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','session_key','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','authId','message_uuid','plivo','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','text','keys','length','apiKey','createHash','digest','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x99d0,0x1e8));var _0x099d=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0x99d0[_0xffa198];return _0x1e4b50;};'use strict';var _=require(_0x099d('0x0'));var util=require('util');var logger=require(_0x099d('0x1'))('api');var moment=require(_0x099d('0x2'));var BPromise=require('bluebird');var rp=require(_0x099d('0x3'));var fs=require('fs');var path=require(_0x099d('0x4'));var rimraf=require(_0x099d('0x5'));var config=require(_0x099d('0x6'));var attributes=require(_0x099d('0x7'));module[_0x099d('0x8')]=function(_0x49293d,_0x46faf8){return _0x49293d[_0x099d('0x9')](_0x099d('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x099d('0xb')]},{'name':_0x099d('0xc'),'fields':[_0x099d('0xd')],'type':_0x099d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4063e0,_0x5ab3bf,_0x3438f3){var _0x20f953=_0x49293d[_0x099d('0xf')];var _0x3cc3e4=_0x4063e0[_0x099d('0x10')]({'plain':!![]});if(_0x3cc3e4[_0x099d('0x11')][_0x099d('0x12')]()==='in'||_0x3cc3e4['direction'][_0x099d('0x12')]()==='out'&&!_0x3cc3e4['secret']&&!_['isNil'](_0x3cc3e4[_0x099d('0x13')])&&!_[_0x099d('0x14')](_0x3cc3e4['SmsInteractionId'])){_0x20f953[_0x099d('0x15')][_0x099d('0x16')]({'where':{'id':_0x3cc3e4['SmsInteractionId']}})[_0x099d('0x17')](function(_0x44fc09){if(_0x44fc09){_0x44fc09[_0x099d('0x18')]({'lastMsgAt':_0x3cc3e4[_0x099d('0x19')],'lastMsgDirection':_0x3cc3e4['direction']['toLowerCase']()});}})['catch'](function(_0x47430d){console[_0x099d('0x1a')](_0x47430d);});}if(_0x3cc3e4['direction']===_0x099d('0x1b')&&!_0x3cc3e4[_0x099d('0x1c')]){var _0xd17093;_0x20f953[_0x099d('0x1d')]['find']({'where':{'id':_0x3cc3e4[_0x099d('0x1e')]},'raw':!![]})[_0x099d('0x17')](function(_0x3716b4){_0xd17093=_0x3716b4;if(_0xd17093&&_0xd17093['type']){switch(_0xd17093[_0x099d('0x1f')]){case _0x099d('0x20'):var _0x15b2a9=require(_0x099d('0x20'));if(_0xd17093[_0x099d('0x21')]&&_0xd17093[_0x099d('0x22')]&&_0xd17093[_0x099d('0x23')]){var _0x475b5d=new _0x15b2a9(_0xd17093[_0x099d('0x21')],_0xd17093[_0x099d('0x22')]);_0x475b5d[_0x099d('0x24')][_0x099d('0x25')]({'body':_0x3cc3e4[_0x099d('0xd')],'to':_0x3cc3e4['phone'],'from':_0xd17093['phone'],'statusCallback':_0xd17093[_0x099d('0x26')]+_0x099d('0x27')+_0x3cc3e4['id']+_0x099d('0x28')+_0xd17093['token']})[_0x099d('0x17')](function(_0x30cee){if(_0x30cee['sid']){return _0x4063e0['update']({'messageId':_0x30cee[_0x099d('0x29')]});}})[_0x099d('0x2a')](function(_0x25994e){logger[_0x099d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x099d('0x20'),util['inspect'](_0x25994e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x20'),_0x099d('0x2d'));}break;case _0x099d('0x2e'):var _0x580525=_0x099d('0x2f');if(_0xd17093[_0x099d('0x30')]&&_0xd17093[_0x099d('0x31')]){var _0x2bbb5d={'recipient':[_0x3cc3e4['phone']],'message':_0x3cc3e4[_0x099d('0xd')],'message_type':_0xd17093['smsMethod']};if(_0xd17093[_0x099d('0x32')]&&_0xd17093[_0x099d('0x32')]!=='SI'){_0x2bbb5d[_0x099d('0x33')]=_0xd17093['phone'];}var _0x2fb786={'url':_0x580525+_0x099d('0x34')+_0xd17093['username']+_0x099d('0x35')+_0xd17093['password'],'method':_0x099d('0x36')};rp(_0x2fb786)[_0x099d('0x17')](function(_0x1c3497){var _0x276583=_0x1c3497[_0x099d('0x37')](';');var _0x39c434={'user_key':_0x276583[0x0],'session_key':_0x276583[0x1]};_0x2fb786={'url':_0x580525+_0x099d('0x38'),'method':_0x099d('0x39'),'headers':{'user_key':_0x39c434['user_key'],'Session_key':_0x39c434[_0x099d('0x3a')]},'json':!![],'body':_0x2bbb5d};return rp(_0x2fb786);})[_0x099d('0x17')](function(_0x5901f7){if(_0x5901f7['total_sent']>=0x1){var _0x510dad={'messageId':_0x5901f7['internal_order_id']};if(_0xd17093['smsMethod']!=='GP'||!_0xd17093[_0x099d('0x3b')]){_0x510dad[_0x099d('0x3c')]=!![];}return _0x4063e0[_0x099d('0x18')](_0x510dad);}else{return logger[_0x099d('0x1a')](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x2e'),util[_0x099d('0x3d')](_0x5901f7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1d5f4e){return logger[_0x099d('0x1a')](_0x099d('0x2b'),_0x099d('0x2c'),'skebby',util['inspect'](_0x1d5f4e,{'showHidden':![],'depth':null}));});}else{logger[_0x099d('0x1a')](_0x099d('0x2b'),_0x099d('0x2c'),'skebby',_0x099d('0x3e'));}break;case _0x099d('0x3f'):if(_0xd17093[_0x099d('0x22')]){var _0x2ba21a={'recipient':_0x3cc3e4[_0x099d('0x23')],'message':_0x3cc3e4[_0x099d('0xd')],'sender':_0xd17093[_0x099d('0x40')]||_0xd17093[_0x099d('0x23')],'authorization':_0xd17093[_0x099d('0x22')]};var _0x5ab3bf={'method':_0x099d('0x39'),'uri':_0x099d('0x41'),'body':_0x2ba21a,'json':!![]};rp(_0x5ab3bf)[_0x099d('0x17')](function(_0x430656){var _0x519d24={'messageId':_0x430656[_0x099d('0x42')]};if(!_0xd17093[_0x099d('0x3b')]){_0x519d24[_0x099d('0x3c')]=!![];}return _0x4063e0[_0x099d('0x18')](_0x519d24);})[_0x099d('0x2a')](function(_0x3f0d72){logger[_0x099d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x099d('0x2c'),_0x099d('0x3f'),util[_0x099d('0x3d')](_0x3f0d72,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x3f'),_0x099d('0x43'));}break;case'clicksend':if(_0xd17093[_0x099d('0x30')]&&_0xd17093['password']){var _0x2ba21a={'messages':[{'source':_0x099d('0x44'),'to':_0x3cc3e4[_0x099d('0x23')],'body':_0x3cc3e4['body'],'from':_0xd17093['senderString']||_0xd17093[_0x099d('0x23')]}]};var _0x543a7f=util[_0x099d('0x45')](_0x099d('0x46'),_0xd17093[_0x099d('0x30')],_0xd17093[_0x099d('0x31')]);var _0x5ab3bf={'method':'POST','uri':_0x099d('0x47'),'body':_0x2ba21a,'headers':{'Authorization':util['format'](_0x099d('0x48'),new Buffer(_0x543a7f)[_0x099d('0x49')](_0x099d('0x4a')))},'json':!![]};rp(_0x5ab3bf)[_0x099d('0x17')](function(_0x39e9c0){if(_0x39e9c0[_0x099d('0x4b')]>=0xc8&&_0x39e9c0[_0x099d('0x4b')]<=0xce){if(_0x39e9c0[_0x099d('0x4c')]&&_0x39e9c0[_0x099d('0x4c')][_0x099d('0x4d')]>0x0){var _0x29443f=_['head'](_0x39e9c0[_0x099d('0x4c')][_0x099d('0x24')]);var _0x18528a={'messageId':_0x29443f[_0x099d('0x4e')]};if(!_0xd17093[_0x099d('0x3b')]){_0x18528a['read']=!![];}return _0x4063e0['update'](_0x18528a);}else{logger['error'](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x4f'),util[_0x099d('0x3d')](_0x39e9c0,{'showHidden':![],'depth':null}));}}else{logger[_0x099d('0x1a')](_0x099d('0x2b'),_0x099d('0x2c'),'clickSend',util[_0x099d('0x3d')](_0x39e9c0,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3c1a40){logger[_0x099d('0x1a')](_0x099d('0x2b'),_0x099d('0x2c'),'clickSend',util[_0x099d('0x3d')](_0x3c1a40,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x099d('0x2b'),'afterCreate',_0x099d('0x4f'),_0x099d('0x3e'));}break;case'plivo':if(_0xd17093[_0x099d('0x50')]&&_0xd17093[_0x099d('0x22')]){var _0x2ba21a={'dst':_0x3cc3e4[_0x099d('0x23')],'text':_0x3cc3e4[_0x099d('0xd')],'src':_0xd17093['senderString']||_0xd17093[_0x099d('0x23')],'url':_0xd17093[_0x099d('0x26')]+_0x099d('0x27')+_0x3cc3e4['id']+_0x099d('0x28')+_0xd17093['token']};var _0x543a7f=util[_0x099d('0x45')](_0x099d('0x46'),_0xd17093[_0x099d('0x50')],_0xd17093['authToken']);var _0x5ab3bf={'method':_0x099d('0x39'),'uri':util[_0x099d('0x45')]('https://api.plivo.com/v1/Account/%s/Message/',_0xd17093[_0x099d('0x50')]),'body':_0x2ba21a,'headers':{'Authorization':util[_0x099d('0x45')](_0x099d('0x48'),new Buffer(_0x543a7f)[_0x099d('0x49')](_0x099d('0x4a')))},'json':!![]};rp(_0x5ab3bf)[_0x099d('0x17')](function(_0x553385){var _0x15111c={'messageId':_0x553385[_0x099d('0x51')][0x0]};return _0x4063e0['update'](_0x15111c);})[_0x099d('0x2a')](function(_0x1d3586){logger['error'](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x52'),util[_0x099d('0x3d')](_0x1d3586,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x52'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x099d('0x53'):if(_0xd17093[_0x099d('0x30')]&&_0xd17093[_0x099d('0x31')]){if(_0xd17093[_0x099d('0x54')]){var _0x4c583b={'method':_0x099d('0x39'),'uri':_0xd17093[_0x099d('0x54')]+_0x099d('0x55'),'body':{'username':_0xd17093[_0x099d('0x30')],'password':_0xd17093[_0x099d('0x31')]},'json':!![]};return rp(_0x4c583b)['then'](function(_0x28d515){var _0x1a29cf={'method':'POST','uri':_0xd17093[_0x099d('0x54')]+_0x099d('0x56'),'body':{'messages':[{'from':_0xd17093[_0x099d('0x23')],'destinations':[{'to':_0x3cc3e4['phone']}],'text':_0x3cc3e4['body'],'notifyUrl':_0xd17093[_0x099d('0x26')]+_0x099d('0x27')+_0x3cc3e4['id']+'/status?token='+_0xd17093['token'],'notifyContentType':_0x099d('0x57'),'callbackData':_0xd17093[_0x099d('0x23')]+';'+_0x3cc3e4[_0x099d('0xd')]}]},'headers':{'Authorization':_0x099d('0x58')+_0x28d515['token']},'json':!![]};return rp(_0x1a29cf)[_0x099d('0x17')](function(_0x46aafe){if(_0x46aafe['messages']){var _0x5a2599={'messageId':_0x46aafe[_0x099d('0x24')][0x0][_0x099d('0xb')]};if(!_0xd17093[_0x099d('0x3b')]){_0x5a2599[_0x099d('0x3c')]=!![];}return _0x4063e0[_0x099d('0x18')](_0x5a2599);}else{return logger[_0x099d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x099d('0x2c'),_0x099d('0x53'),util[_0x099d('0x3d')](_0x46aafe,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x21daa7){return logger['error'](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x53'),util[_0x099d('0x3d')](_0x21daa7,{'showHidden':![],'depth':null}));});}else{logger[_0x099d('0x1a')](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x53'),_0x099d('0x59'));}}else{logger[_0x099d('0x1a')](_0x099d('0x2b'),'afterCreate',_0x099d('0x53'),_0x099d('0x3e'));}break;case _0x099d('0x5a'):var _0x7f62b3=require(_0x099d('0x5b'));if(_0xd17093['apiKey']){var _0x474dbf={};_0x474dbf['login']=_0xd17093[_0x099d('0x30')];_0x474dbf[_0x099d('0x23')]=_0x3cc3e4['phone'];_0x474dbf[_0x099d('0x33')]=_0xd17093[_0x099d('0x23')];_0x474dbf[_0x099d('0x5c')]=_0x3cc3e4[_0x099d('0xd')];_0x474dbf['timestamp']=+new Date();var _0xf1119c='';var _0x4bcbb8='';var _0x510add=Object[_0x099d('0x5d')](_0x474dbf);_0x510add['sort']();for(var _0x535d13=0x0;_0x535d13<_0x510add[_0x099d('0x5e')];_0x535d13++){if(_0xf1119c!=''){_0xf1119c+='&';}_0xf1119c+=_0x510add[_0x535d13]+'='+encodeURIComponent(_0x474dbf[_0x510add[_0x535d13]]);_0x4bcbb8+=_0x474dbf[_0x510add[_0x535d13]];}_0x4bcbb8+=_0xd17093[_0x099d('0x5f')];_0x4bcbb8=_0x7f62b3[_0x099d('0x60')]('md5')[_0x099d('0x18')](_0x4bcbb8)[_0x099d('0x61')](_0x099d('0x62'));if(_0xf1119c!==''){_0xf1119c+='&';}_0xf1119c+=_0x099d('0x63')+_0x4bcbb8;var _0x2fb786={'method':'GET','uri':_0xd17093[_0x099d('0x54')]+'/external/get/send.php?'+_0xf1119c,'json':!![]};return rp(_0x2fb786)['then'](function(_0x585538){var _0x4cd4e0=Object['keys'](_0x585538);if(_0x585538[_0x4cd4e0[0x0]][_0x099d('0x1a')]&&parseInt(_0x585538[_0x4cd4e0[0x0]][_0x099d('0x1a')])===0x0){var _0x2ea3fc={'messageId':_0x585538[_0x4cd4e0[0x0]][_0x099d('0x64')]};if(!_0xd17093[_0x099d('0x3b')]){_0x2ea3fc[_0x099d('0x3c')]=!![];}return _0x4063e0['update'](_0x2ea3fc);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x099d('0x2c'),_0x099d('0x5a'),util[_0x099d('0x3d')](_0x585538['error'],{'showHidden':![],'depth':null}));}})[_0x099d('0x2a')](function(_0x579165){return logger[_0x099d('0x1a')](_0x099d('0x2b'),_0x099d('0x2c'),'csc',util['inspect'](_0x579165,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x5a'),_0x099d('0x65'));}break;case _0x099d('0x66'):if(_0xd17093['apiKey']){var _0x13a7cd={'method':_0x099d('0x39'),'uri':_0x099d('0x67'),'headers':{'Authorization':_0xd17093[_0x099d('0x5f')]},'body':{'content':_0x3cc3e4[_0x099d('0xd')],'to':[_0x3cc3e4[_0x099d('0x23')]],'from':_0xd17093[_0x099d('0x23')],'binary':![],'clientMessageId':'uuid','charset':_0x099d('0x68')},'json':!![]};rp(_0x13a7cd)['then'](function(_0x477a63){if(!_0x477a63[_0x099d('0x1a')]){var _0x21b369={'messageId':_0x477a63[_0x099d('0x24')][0x0][_0x099d('0x69')]};if(!_0xd17093[_0x099d('0x3b')]){_0x21b369[_0x099d('0x3c')]=!![];}return _0x4063e0[_0x099d('0x18')](_0x21b369);}else{return logger[_0x099d('0x1a')](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x66'),util[_0x099d('0x3d')](_0x477a63['error'],{'showHidden':![],'depth':null}));}})[_0x099d('0x2a')](function(_0x229b06){return logger['error'](_0x099d('0x2b'),'afterCreate',_0x099d('0x66'),util['inspect'](_0x229b06,{'showHidden':![],'depth':null}));});}else{logger[_0x099d('0x1a')](_0x099d('0x2b'),'afterCreate',_0x099d('0x66'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0xd17093[_0x099d('0x30')]&&_0xd17093['password']){var _0x543a7f=util[_0x099d('0x45')](_0x099d('0x46'),_0xd17093[_0x099d('0x30')],_0xd17093[_0x099d('0x31')]);var _0x5ab3bf={'method':'POST','uri':_0x099d('0x6a')+_0xd17093[_0x099d('0x6b')]+_0x099d('0x6c'),'body':{'to':[_0x3cc3e4[_0x099d('0x23')]],'text':_0x3cc3e4['body'],'from':_0xd17093[_0x099d('0x23')],'applicationId':_0xd17093[_0x099d('0x6d')]},'headers':{'Authorization':util[_0x099d('0x45')](_0x099d('0x48'),new Buffer(_0x543a7f)[_0x099d('0x49')](_0x099d('0x4a')))},'json':!![]};rp(_0x5ab3bf)[_0x099d('0x17')](function(_0x43444d){if(_0x43444d['id']){var _0x18a2a6={'messageId':_0x43444d['id']};return _0x4063e0['update'](_0x18a2a6);}else{logger[_0x099d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x099d('0x2c'),'bandwidth',util[_0x099d('0x3d')](_0x43444d,{'showHidden':![],'depth':null}));}})[_0x099d('0x2a')](function(_0x46b88f){logger['error'](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x6e'),util[_0x099d('0x3d')](_0x46b88f,{'showHidden':![],'depth':null}));});}else{logger[_0x099d('0x1a')](_0x099d('0x2b'),_0x099d('0x2c'),_0x099d('0x6e'),_0x099d('0x3e'));}break;case _0x099d('0x6f'):if(_0xd17093[_0x099d('0x5f')]){var _0xef0e3e={};var _0x2fb786={'method':_0x099d('0x39'),'uri':_0x099d('0x70'),'headers':{'Authorization':_0x099d('0x71')+_0xd17093[_0x099d('0x5f')],'Content-Type':_0x099d('0x57')},'body':{'from':_0xd17093[_0x099d('0x23')],'to':_0x3cc3e4[_0x099d('0x23')],'text':_0x3cc3e4[_0x099d('0xd')]},'json':!![]};return rp(_0x2fb786)['then'](function(_0x21b3f8){if(_0x21b3f8[_0x099d('0x72')]==0xca){_0xef0e3e[_0x099d('0x73')]=_0x21b3f8;var _0x549264={'method':_0x099d('0x39'),'uri':_0x099d('0x74'),'headers':{'Authorization':_0x099d('0x71')+_0xd17093['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0xef0e3e[_0x099d('0x73')][_0x099d('0x75')]},'json':!![]};return rp(_0x549264)[_0x099d('0x17')](function(_0x13396a){_0xef0e3e[_0x099d('0x76')]=_0x13396a;var _0x21309a={'messageId':_0xef0e3e[_0x099d('0x73')]['refid'],'read':!![]};return _0x4063e0['update'](_0x21309a);});}else{return logger[_0x099d('0x1a')](_0x099d('0x2b'),'afterCreate',_0x099d('0x6f'),util[_0x099d('0x3d')](_0x21b3f8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x207f87){return logger[_0x099d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x099d('0x6f'),util['inspect'](_0x207f87,{'showHidden':![],'depth':null}));});}else{return logger[_0x099d('0x1a')](_0x099d('0x2b'),'afterCreate',_0x099d('0x6f'),_0x099d('0x77'));}break;}}})[_0x099d('0x78')](function(){_0x3438f3();});}else{_0x3438f3();}}},'charset':_0x099d('0x79'),'collate':_0x099d('0x7a')});}; \ No newline at end of file +var _0x21b8=['https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','define','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','isNil','findOne','update','createdAt','catch','SmsAccount','SmsAccountId','then','type','twilio','authToken','phone','messages','create','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','error','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','user_key','deliveryReport','read','afterCreate','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','requestid','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','Basic\x20%s','base64','http_code','queued_count','head','data','message_id','clickSend','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','login','sort','createHash','md5','hex','/external/get/send.php?','keys','id_sms','csc','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer'];(function(_0x1be05d,_0x16412a){var _0x4c869f=function(_0x4a43de){while(--_0x4a43de){_0x1be05d['push'](_0x1be05d['shift']());}};_0x4c869f(++_0x16412a);}(_0x21b8,0x1eb));var _0x821b=function(_0x2c2ff4,_0x2e365d){_0x2c2ff4=_0x2c2ff4-0x0;var _0x8f9e95=_0x21b8[_0x2c2ff4];return _0x8f9e95;};'use strict';var _=require(_0x821b('0x0'));var util=require(_0x821b('0x1'));var logger=require(_0x821b('0x2'))(_0x821b('0x3'));var moment=require('moment');var BPromise=require(_0x821b('0x4'));var rp=require(_0x821b('0x5'));var fs=require('fs');var path=require(_0x821b('0x6'));var rimraf=require(_0x821b('0x7'));var config=require(_0x821b('0x8'));var attributes=require(_0x821b('0x9'));module['exports']=function(_0x2a3cf7,_0x448f79){return _0x2a3cf7[_0x821b('0xa')]('SmsMessage',attributes,{'tableName':_0x821b('0xb'),'paranoid':![],'indexes':[{'name':_0x821b('0xc'),'fields':[_0x821b('0xc')]},{'name':_0x821b('0xd'),'fields':[_0x821b('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x45cdf4,_0x319db9,_0x5e9953){var _0x3328be=_0x2a3cf7[_0x821b('0xf')];var _0x75fb89=_0x45cdf4[_0x821b('0x10')]({'plain':!![]});if(_0x75fb89[_0x821b('0x11')][_0x821b('0x12')]()==='in'||_0x75fb89[_0x821b('0x11')][_0x821b('0x12')]()===_0x821b('0x13')&&!_0x75fb89[_0x821b('0x14')]&&!_[_0x821b('0x15')](_0x75fb89['UserId'])&&!_['isNil'](_0x75fb89['SmsInteractionId'])){_0x3328be['SmsInteraction'][_0x821b('0x16')]({'where':{'id':_0x75fb89['SmsInteractionId']}})['then'](function(_0x1cbc47){if(_0x1cbc47){_0x1cbc47[_0x821b('0x17')]({'lastMsgAt':_0x75fb89[_0x821b('0x18')],'lastMsgDirection':_0x75fb89[_0x821b('0x11')][_0x821b('0x12')]()});}})[_0x821b('0x19')](function(_0x51c400){console['error'](_0x51c400);});}if(_0x75fb89[_0x821b('0x11')]===_0x821b('0x13')&&!_0x75fb89[_0x821b('0x14')]){var _0x4be4f4;_0x3328be[_0x821b('0x1a')]['find']({'where':{'id':_0x75fb89[_0x821b('0x1b')]},'raw':!![]})[_0x821b('0x1c')](function(_0x32f857){_0x4be4f4=_0x32f857;if(_0x4be4f4&&_0x4be4f4[_0x821b('0x1d')]){switch(_0x4be4f4[_0x821b('0x1d')]){case _0x821b('0x1e'):var _0x2140a2=require(_0x821b('0x1e'));if(_0x4be4f4['accountSid']&&_0x4be4f4[_0x821b('0x1f')]&&_0x4be4f4[_0x821b('0x20')]){var _0x234be4=new _0x2140a2(_0x4be4f4['accountSid'],_0x4be4f4['authToken']);_0x234be4[_0x821b('0x21')][_0x821b('0x22')]({'body':_0x75fb89[_0x821b('0xe')],'to':_0x75fb89[_0x821b('0x20')],'from':_0x4be4f4[_0x821b('0x20')],'statusCallback':_0x4be4f4[_0x821b('0x23')]+_0x821b('0x24')+_0x75fb89['id']+'/status?token='+_0x4be4f4[_0x821b('0x25')]})[_0x821b('0x1c')](function(_0x48102e){if(_0x48102e[_0x821b('0x26')]){return _0x45cdf4[_0x821b('0x17')]({'messageId':_0x48102e[_0x821b('0x26')]});}})[_0x821b('0x19')](function(_0x199ef3){logger['error'](_0x821b('0x27'),'afterCreate',_0x821b('0x1e'),util['inspect'](_0x199ef3,{'showHidden':![],'depth':null}));});}else{logger[_0x821b('0x28')](_0x821b('0x27'),'afterCreate',_0x821b('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x821b('0x29'):var _0x4aa48f=_0x821b('0x2a');if(_0x4be4f4[_0x821b('0x2b')]&&_0x4be4f4[_0x821b('0x2c')]){var _0xf8dd9a={'recipient':[_0x75fb89[_0x821b('0x20')]],'message':_0x75fb89[_0x821b('0xe')],'message_type':_0x4be4f4['smsMethod']};if(_0x4be4f4['smsMethod']&&_0x4be4f4[_0x821b('0x2d')]!=='SI'){_0xf8dd9a[_0x821b('0x2e')]=_0x4be4f4[_0x821b('0x20')];}var _0x3cdea7={'url':_0x4aa48f+_0x821b('0x2f')+_0x4be4f4['username']+_0x821b('0x30')+_0x4be4f4['password'],'method':_0x821b('0x31')};rp(_0x3cdea7)[_0x821b('0x1c')](function(_0x1fc7f9){var _0x28cd28=_0x1fc7f9[_0x821b('0x32')](';');var _0x58d71e={'user_key':_0x28cd28[0x0],'session_key':_0x28cd28[0x1]};_0x3cdea7={'url':_0x4aa48f+_0x821b('0x33'),'method':'POST','headers':{'user_key':_0x58d71e[_0x821b('0x34')],'Session_key':_0x58d71e['session_key']},'json':!![],'body':_0xf8dd9a};return rp(_0x3cdea7);})[_0x821b('0x1c')](function(_0x21c5b1){if(_0x21c5b1['total_sent']>=0x1){var _0x4725ba={'messageId':_0x21c5b1['internal_order_id']};if(_0x4be4f4[_0x821b('0x2d')]!=='GP'||!_0x4be4f4[_0x821b('0x35')]){_0x4725ba[_0x821b('0x36')]=!![];}return _0x45cdf4['update'](_0x4725ba);}else{return logger['error'](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x29'),util['inspect'](_0x21c5b1,{'showHidden':![],'depth':null}));}})[_0x821b('0x19')](function(_0x36bba2){return logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),'skebby',util[_0x821b('0x38')](_0x36bba2,{'showHidden':![],'depth':null}));});}else{logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x29'),_0x821b('0x39'));}break;case _0x821b('0x3a'):if(_0x4be4f4[_0x821b('0x1f')]){var _0x3cd2df={'recipient':_0x75fb89['phone'],'message':_0x75fb89[_0x821b('0xe')],'sender':_0x4be4f4[_0x821b('0x3b')]||_0x4be4f4['phone'],'authorization':_0x4be4f4[_0x821b('0x1f')]};var _0x319db9={'method':_0x821b('0x3c'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x3cd2df,'json':!![]};rp(_0x319db9)[_0x821b('0x1c')](function(_0xcb5cdc){var _0x421ebd={'messageId':_0xcb5cdc[_0x821b('0x3d')]};if(!_0x4be4f4[_0x821b('0x35')]){_0x421ebd[_0x821b('0x36')]=!![];}return _0x45cdf4[_0x821b('0x17')](_0x421ebd);})['catch'](function(_0x48118c){logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),'connectel',util[_0x821b('0x38')](_0x48118c,{'showHidden':![],'depth':null}));});}else{logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x3a'),_0x821b('0x3e'));}break;case _0x821b('0x3f'):if(_0x4be4f4[_0x821b('0x2b')]&&_0x4be4f4['password']){var _0x3cd2df={'messages':[{'source':'xCALLY\x20Motion','to':_0x75fb89['phone'],'body':_0x75fb89[_0x821b('0xe')],'from':_0x4be4f4['senderString']||_0x4be4f4[_0x821b('0x20')]}]};var _0x733e2f=util[_0x821b('0x40')](_0x821b('0x41'),_0x4be4f4[_0x821b('0x2b')],_0x4be4f4[_0x821b('0x2c')]);var _0x319db9={'method':_0x821b('0x3c'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x3cd2df,'headers':{'Authorization':util[_0x821b('0x40')](_0x821b('0x42'),new Buffer(_0x733e2f)['toString'](_0x821b('0x43')))},'json':!![]};rp(_0x319db9)[_0x821b('0x1c')](function(_0x36d5ae){if(_0x36d5ae[_0x821b('0x44')]>=0xc8&&_0x36d5ae[_0x821b('0x44')]<=0xce){if(_0x36d5ae['data']&&_0x36d5ae['data'][_0x821b('0x45')]>0x0){var _0x867c53=_[_0x821b('0x46')](_0x36d5ae[_0x821b('0x47')][_0x821b('0x21')]);var _0x519bc6={'messageId':_0x867c53[_0x821b('0x48')]};if(!_0x4be4f4['deliveryReport']){_0x519bc6['read']=!![];}return _0x45cdf4[_0x821b('0x17')](_0x519bc6);}else{logger[_0x821b('0x28')](_0x821b('0x27'),'afterCreate',_0x821b('0x49'),util[_0x821b('0x38')](_0x36d5ae,{'showHidden':![],'depth':null}));}}else{logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x49'),util[_0x821b('0x38')](_0x36d5ae,{'showHidden':![],'depth':null}));}})[_0x821b('0x19')](function(_0x4026e7){logger[_0x821b('0x28')](_0x821b('0x27'),'afterCreate',_0x821b('0x49'),util['inspect'](_0x4026e7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x49'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x4be4f4[_0x821b('0x4a')]&&_0x4be4f4[_0x821b('0x1f')]){var _0x3cd2df={'dst':_0x75fb89['phone'],'text':_0x75fb89[_0x821b('0xe')],'src':_0x4be4f4['senderString']||_0x4be4f4['phone'],'url':_0x4be4f4[_0x821b('0x23')]+_0x821b('0x24')+_0x75fb89['id']+_0x821b('0x4b')+_0x4be4f4[_0x821b('0x25')]};var _0x733e2f=util['format'](_0x821b('0x41'),_0x4be4f4[_0x821b('0x4a')],_0x4be4f4[_0x821b('0x1f')]);var _0x319db9={'method':_0x821b('0x3c'),'uri':util[_0x821b('0x40')](_0x821b('0x4c'),_0x4be4f4[_0x821b('0x4a')]),'body':_0x3cd2df,'headers':{'Authorization':util['format'](_0x821b('0x42'),new Buffer(_0x733e2f)[_0x821b('0x4d')]('base64'))},'json':!![]};rp(_0x319db9)[_0x821b('0x1c')](function(_0x7a4e86){var _0x4c2d20={'messageId':_0x7a4e86[_0x821b('0x4e')][0x0]};return _0x45cdf4[_0x821b('0x17')](_0x4c2d20);})[_0x821b('0x19')](function(_0x49ed03){logger['error'](_0x821b('0x27'),'afterCreate',_0x821b('0x4f'),util[_0x821b('0x38')](_0x49ed03,{'showHidden':![],'depth':null}));});}else{logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x4f'),_0x821b('0x50'));}break;case _0x821b('0x51'):if(_0x4be4f4['username']&&_0x4be4f4[_0x821b('0x2c')]){if(_0x4be4f4['baseUrl']){var _0x13150e={'method':'POST','uri':_0x4be4f4['baseUrl']+'/auth/1/session','body':{'username':_0x4be4f4[_0x821b('0x2b')],'password':_0x4be4f4[_0x821b('0x2c')]},'json':!![]};return rp(_0x13150e)[_0x821b('0x1c')](function(_0x77e8df){var _0x317e7c={'method':'POST','uri':_0x4be4f4[_0x821b('0x52')]+_0x821b('0x53'),'body':{'messages':[{'from':_0x4be4f4[_0x821b('0x20')],'destinations':[{'to':_0x75fb89[_0x821b('0x20')]}],'text':_0x75fb89[_0x821b('0xe')],'notifyUrl':_0x4be4f4['remote']+'/api/sms/messages/'+_0x75fb89['id']+_0x821b('0x4b')+_0x4be4f4[_0x821b('0x25')],'notifyContentType':'application/json','callbackData':_0x4be4f4[_0x821b('0x20')]+';'+_0x75fb89[_0x821b('0xe')]}]},'headers':{'Authorization':_0x821b('0x54')+_0x77e8df[_0x821b('0x25')]},'json':!![]};return rp(_0x317e7c)[_0x821b('0x1c')](function(_0x374cdf){if(_0x374cdf[_0x821b('0x21')]){var _0x38bc41={'messageId':_0x374cdf[_0x821b('0x21')][0x0][_0x821b('0xc')]};if(!_0x4be4f4[_0x821b('0x35')]){_0x38bc41[_0x821b('0x36')]=!![];}return _0x45cdf4[_0x821b('0x17')](_0x38bc41);}else{return logger[_0x821b('0x28')](_0x821b('0x27'),'afterCreate',_0x821b('0x51'),util['inspect'](_0x374cdf,{'showHidden':![],'depth':null}));}});})[_0x821b('0x19')](function(_0x342f0f){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x821b('0x37'),_0x821b('0x51'),util[_0x821b('0x38')](_0x342f0f,{'showHidden':![],'depth':null}));});}else{logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),'infobip',_0x821b('0x55'));}}else{logger['error'](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x51'),_0x821b('0x39'));}break;case'csc':var _0x393cfb=require(_0x821b('0x56'));if(_0x4be4f4[_0x821b('0x57')]){var _0x16f863={};_0x16f863[_0x821b('0x58')]=_0x4be4f4[_0x821b('0x2b')];_0x16f863[_0x821b('0x20')]=_0x75fb89[_0x821b('0x20')];_0x16f863[_0x821b('0x2e')]=_0x4be4f4[_0x821b('0x20')];_0x16f863['text']=_0x75fb89['body'];_0x16f863['timestamp']=+new Date();var _0x1100c5='';var _0x5124e1='';var _0xa0503d=Object['keys'](_0x16f863);_0xa0503d[_0x821b('0x59')]();for(var _0x54179c=0x0;_0x54179c<_0xa0503d['length'];_0x54179c++){if(_0x1100c5!=''){_0x1100c5+='&';}_0x1100c5+=_0xa0503d[_0x54179c]+'='+encodeURIComponent(_0x16f863[_0xa0503d[_0x54179c]]);_0x5124e1+=_0x16f863[_0xa0503d[_0x54179c]];}_0x5124e1+=_0x4be4f4['apiKey'];_0x5124e1=_0x393cfb[_0x821b('0x5a')](_0x821b('0x5b'))['update'](_0x5124e1)['digest'](_0x821b('0x5c'));if(_0x1100c5!==''){_0x1100c5+='&';}_0x1100c5+='signature='+_0x5124e1;var _0x3cdea7={'method':'GET','uri':_0x4be4f4[_0x821b('0x52')]+_0x821b('0x5d')+_0x1100c5,'json':!![]};return rp(_0x3cdea7)['then'](function(_0x421ed6){var _0x54ea63=Object[_0x821b('0x5e')](_0x421ed6);if(_0x421ed6[_0x54ea63[0x0]]['error']&&parseInt(_0x421ed6[_0x54ea63[0x0]][_0x821b('0x28')])===0x0){var _0x582eb5={'messageId':_0x421ed6[_0x54ea63[0x0]][_0x821b('0x5f')]};if(!_0x4be4f4[_0x821b('0x35')]){_0x582eb5[_0x821b('0x36')]=!![];}return _0x45cdf4[_0x821b('0x17')](_0x582eb5);}else{return logger[_0x821b('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x821b('0x37'),_0x821b('0x60'),util[_0x821b('0x38')](_0x421ed6[_0x821b('0x28')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x338d68){return logger[_0x821b('0x28')](_0x821b('0x27'),'afterCreate',_0x821b('0x60'),util[_0x821b('0x38')](_0x338d68,{'showHidden':![],'depth':null}));});}else{logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x60'),_0x821b('0x61'));}break;case'clickatell':if(_0x4be4f4[_0x821b('0x57')]){var _0x1820f3={'method':'POST','uri':_0x821b('0x62'),'headers':{'Authorization':_0x4be4f4[_0x821b('0x57')]},'body':{'content':_0x75fb89[_0x821b('0xe')],'to':[_0x75fb89[_0x821b('0x20')]],'from':_0x4be4f4['phone'],'binary':![],'clientMessageId':_0x821b('0x63'),'charset':_0x821b('0x64')},'json':!![]};rp(_0x1820f3)[_0x821b('0x1c')](function(_0x4650a4){if(!_0x4650a4[_0x821b('0x28')]){var _0x44e888={'messageId':_0x4650a4[_0x821b('0x21')][0x0][_0x821b('0x65')]};if(!_0x4be4f4['deliveryReport']){_0x44e888[_0x821b('0x36')]=!![];}return _0x45cdf4['update'](_0x44e888);}else{return logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x66'),util[_0x821b('0x38')](_0x4650a4[_0x821b('0x28')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1ba9ae){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x821b('0x37'),_0x821b('0x66'),util[_0x821b('0x38')](_0x1ba9ae,{'showHidden':![],'depth':null}));});}else{logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x66'),_0x821b('0x61'));}break;case _0x821b('0x67'):if(_0x4be4f4[_0x821b('0x2b')]&&_0x4be4f4[_0x821b('0x2c')]){var _0x733e2f=util[_0x821b('0x40')](_0x821b('0x41'),_0x4be4f4[_0x821b('0x2b')],_0x4be4f4[_0x821b('0x2c')]);var _0x319db9={'method':_0x821b('0x3c'),'uri':_0x821b('0x68')+_0x4be4f4[_0x821b('0x69')]+_0x821b('0x6a'),'body':{'to':[_0x75fb89[_0x821b('0x20')]],'text':_0x75fb89[_0x821b('0xe')],'from':_0x4be4f4[_0x821b('0x20')],'applicationId':_0x4be4f4[_0x821b('0x6b')]},'headers':{'Authorization':util[_0x821b('0x40')](_0x821b('0x42'),new Buffer(_0x733e2f)[_0x821b('0x4d')](_0x821b('0x43')))},'json':!![]};rp(_0x319db9)[_0x821b('0x1c')](function(_0x10b8be){if(_0x10b8be['id']){var _0x21f7c3={'messageId':_0x10b8be['id']};return _0x45cdf4[_0x821b('0x17')](_0x21f7c3);}else{logger[_0x821b('0x28')](_0x821b('0x27'),'afterCreate',_0x821b('0x67'),util[_0x821b('0x38')](_0x10b8be,{'showHidden':![],'depth':null}));}})[_0x821b('0x19')](function(_0x20b68e){logger['error'](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x67'),util['inspect'](_0x20b68e,{'showHidden':![],'depth':null}));});}else{logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),'bandwidth',_0x821b('0x39'));}break;case _0x821b('0x6c'):if(_0x4be4f4['apiKey']){var _0x1f3eb2={};var _0x3cdea7={'method':_0x821b('0x3c'),'uri':_0x821b('0x6d'),'headers':{'Authorization':'Bearer\x20'+_0x4be4f4[_0x821b('0x57')],'Content-Type':_0x821b('0x6e')},'body':{'from':_0x4be4f4['phone'],'to':_0x75fb89['phone'],'text':_0x75fb89[_0x821b('0xe')]},'json':!![]};return rp(_0x3cdea7)[_0x821b('0x1c')](function(_0x255138){if(_0x255138[_0x821b('0x6f')]==0xca){_0x1f3eb2['message']=_0x255138;var _0x2c50cf={'method':_0x821b('0x3c'),'uri':_0x821b('0x70'),'headers':{'Authorization':'Bearer\x20'+_0x4be4f4[_0x821b('0x57')],'Content-Type':_0x821b('0x6e')},'body':{'refid':_0x1f3eb2[_0x821b('0x71')][_0x821b('0x72')]},'json':!![]};return rp(_0x2c50cf)['then'](function(_0x35a981){_0x1f3eb2[_0x821b('0x73')]=_0x35a981;var _0x576b5b={'messageId':_0x1f3eb2[_0x821b('0x71')][_0x821b('0x72')],'read':!![]};return _0x45cdf4[_0x821b('0x17')](_0x576b5b);});}else{return logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x6c'),util[_0x821b('0x38')](_0x255138,{'showHidden':![],'depth':null}));}})['catch'](function(_0x465973){return logger[_0x821b('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x821b('0x37'),_0x821b('0x6c'),util[_0x821b('0x38')](_0x465973,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x6c'),_0x821b('0x74'));}break;}}})[_0x821b('0x75')](function(){_0x5e9953();});}else{_0x5e9953();}}},'charset':_0x821b('0x76'),'collate':_0x821b('0x77')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 00a4846..2ac9ef9 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 _0x64f6=['CreateSmsMessage','create','body','options','raw','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','register','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x12f108,_0x2f976c){var _0xa6ca6b=function(_0x21967c){while(--_0x21967c){_0x12f108['push'](_0x12f108['shift']());}};_0xa6ca6b(++_0x2f976c);}(_0x64f6,0x13b));var _0x664f=function(_0x5b0369,_0x16e522){_0x5b0369=_0x5b0369-0x0;var _0x4c1547=_0x64f6[_0x5b0369];return _0x4c1547;};'use strict';var _=require(_0x664f('0x0'));var util=require('util');var moment=require(_0x664f('0x1'));var BPromise=require(_0x664f('0x2'));var rs=require(_0x664f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x664f('0x4'));var logger=require(_0x664f('0x5'))('rpc');var config=require(_0x664f('0x6'));var jayson=require(_0x664f('0x7'));var client=jayson[_0x664f('0x8')][_0x664f('0x9')]({'port':0x232a});config[_0x664f('0xa')]=_[_0x664f('0xb')](config[_0x664f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x664f('0xc'))(new Redis(config[_0x664f('0xa')]));require(_0x664f('0xd'))[_0x664f('0xe')](socket);function respondWithRpcPromise(_0x506c62,_0x362637,_0xc4e116){return new BPromise(function(_0x1e56c6,_0x11ed46){return client['request'](_0x506c62,_0xc4e116)[_0x664f('0xf')](function(_0x36bcd8){logger['info'](_0x664f('0x10'),_0x362637,_0x664f('0x11'));logger[_0x664f('0x12')](_0x664f('0x13'),_0x362637,'request\x20sent',JSON[_0x664f('0x14')](_0x36bcd8));if(_0x36bcd8[_0x664f('0x15')]){if(_0x36bcd8['error'][_0x664f('0x16')]===0x1f4){logger[_0x664f('0x15')](_0x664f('0x10'),_0x362637,_0x36bcd8[_0x664f('0x15')][_0x664f('0x17')]);return _0x11ed46(_0x36bcd8['error'][_0x664f('0x17')]);}logger[_0x664f('0x15')](_0x664f('0x10'),_0x362637,_0x36bcd8[_0x664f('0x15')]['message']);return _0x1e56c6(_0x36bcd8['error'][_0x664f('0x17')]);}else{logger[_0x664f('0x18')]('SmsMessage,\x20%s,\x20%s',_0x362637,_0x664f('0x11'));_0x1e56c6(_0x36bcd8[_0x664f('0x19')][_0x664f('0x17')]);}})['catch'](function(_0x29f007){logger[_0x664f('0x15')](_0x664f('0x10'),_0x362637,_0x29f007);_0x11ed46(_0x29f007);});});}exports[_0x664f('0x1a')]=function(_0x256a92){var _0x573f80=this;return new Promise(function(_0x253df2,_0x147644){return db['SmsMessage'][_0x664f('0x1b')](_0x256a92[_0x664f('0x1c')],{'raw':_0x256a92['options']?_0x256a92[_0x664f('0x1d')][_0x664f('0x1e')]===undefined?!![]:![]:!![]})[_0x664f('0xf')](function(_0x5f0c2d){logger[_0x664f('0x18')](_0x664f('0x1a'),_0x256a92);logger[_0x664f('0x12')](_0x664f('0x1a'),_0x256a92,JSON[_0x664f('0x14')](_0x5f0c2d));_0x253df2(_0x5f0c2d);})['catch'](function(_0x2b9910){logger[_0x664f('0x15')](_0x664f('0x1a'),_0x2b9910[_0x664f('0x17')],_0x256a92);_0x147644(_0x573f80[_0x664f('0x15')](0x1f4,_0x2b9910[_0x664f('0x17')]));});});}; \ No newline at end of file +var _0x1192=['then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','debug','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','./smsMessage.socket','request'];(function(_0x3ea84c,_0x3b2d0c){var _0x3826ce=function(_0x1a8ed5){while(--_0x1a8ed5){_0x3ea84c['push'](_0x3ea84c['shift']());}};_0x3826ce(++_0x3b2d0c);}(_0x1192,0x9d));var _0x2119=function(_0x37a4cc,_0x1531a8){_0x37a4cc=_0x37a4cc-0x0;var _0x4ffbbf=_0x1192[_0x37a4cc];return _0x4ffbbf;};'use strict';var _=require(_0x2119('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2119('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2119('0x2'))['db'];var utils=require(_0x2119('0x3'));var logger=require(_0x2119('0x4'))(_0x2119('0x5'));var config=require(_0x2119('0x6'));var jayson=require(_0x2119('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x2119('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2119('0x8')]));require(_0x2119('0x9'))['register'](socket);function respondWithRpcPromise(_0x1ff1dc,_0x4f2fde,_0x55f1b4){return new BPromise(function(_0x107a07,_0x5bff06){return client[_0x2119('0xa')](_0x1ff1dc,_0x55f1b4)[_0x2119('0xb')](function(_0x396d06){logger[_0x2119('0xc')](_0x2119('0xd'),_0x4f2fde,'request\x20sent');logger['debug'](_0x2119('0xe'),_0x4f2fde,_0x2119('0xf'),JSON[_0x2119('0x10')](_0x396d06));if(_0x396d06[_0x2119('0x11')]){if(_0x396d06[_0x2119('0x11')][_0x2119('0x12')]===0x1f4){logger['error'](_0x2119('0xd'),_0x4f2fde,_0x396d06['error'][_0x2119('0x13')]);return _0x5bff06(_0x396d06[_0x2119('0x11')][_0x2119('0x13')]);}logger[_0x2119('0x11')](_0x2119('0xd'),_0x4f2fde,_0x396d06['error'][_0x2119('0x13')]);return _0x107a07(_0x396d06[_0x2119('0x11')][_0x2119('0x13')]);}else{logger[_0x2119('0xc')](_0x2119('0xd'),_0x4f2fde,_0x2119('0xf'));_0x107a07(_0x396d06[_0x2119('0x14')][_0x2119('0x13')]);}})[_0x2119('0x15')](function(_0x49af43){logger[_0x2119('0x11')]('SmsMessage,\x20%s,\x20%s',_0x4f2fde,_0x49af43);_0x5bff06(_0x49af43);});});}exports[_0x2119('0x16')]=function(_0x1c535f){var _0x15f026=this;return new Promise(function(_0x396a05,_0x2c9f75){return db[_0x2119('0x17')][_0x2119('0x18')](_0x1c535f[_0x2119('0x19')],{'raw':_0x1c535f['options']?_0x1c535f[_0x2119('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x2119('0xb')](function(_0x4d9d7b){logger[_0x2119('0xc')](_0x2119('0x16'),_0x1c535f);logger[_0x2119('0x1b')](_0x2119('0x16'),_0x1c535f,JSON[_0x2119('0x10')](_0x4d9d7b));_0x396a05(_0x4d9d7b);})[_0x2119('0x15')](function(_0x1c9594){logger[_0x2119('0x11')](_0x2119('0x16'),_0x1c9594[_0x2119('0x13')],_0x1c535f);_0x2c9f75(_0x15f026[_0x2119('0x11')](0x1f4,_0x1c9594['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index b02a676..54618dc 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 _0x0d0f=['length','smsMessage:','save','emit','removeListener','register'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0d0f,0x194));var _0xf0d0=function(_0x1ac090,_0x9a266f){_0x1ac090=_0x1ac090-0x0;var _0x105ebd=_0x0d0f[_0x1ac090];return _0x105ebd;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xf0d0('0x0'),'remove','update'];function createListener(_0x3ad43c,_0x4e27ab){return function(_0x50eba6){_0x4e27ab[_0xf0d0('0x1')](_0x3ad43c,_0x50eba6);};}function removeListener(_0x483833,_0x16d00e){return function(){SmsMessageEvents[_0xf0d0('0x2')](_0x483833,_0x16d00e);};}exports[_0xf0d0('0x3')]=function(_0x5ca0bc){for(var _0x191e22=0x0,_0x148b52=events[_0xf0d0('0x4')];_0x191e22<_0x148b52;_0x191e22++){var _0xbe1dd0=events[_0x191e22];var _0x3dd04f=createListener(_0xf0d0('0x5')+_0xbe1dd0,_0x5ca0bc);SmsMessageEvents['on'](_0xbe1dd0,_0x3dd04f);}}; \ No newline at end of file +var _0x1eed=['emit','removeListener','register','length','smsMessage:','save','remove','update'];(function(_0x5b48ea,_0x10b0d1){var _0x2b9222=function(_0x14f737){while(--_0x14f737){_0x5b48ea['push'](_0x5b48ea['shift']());}};_0x2b9222(++_0x10b0d1);}(_0x1eed,0x1b5));var _0xd1ee=function(_0x22182f,_0x2bad5d){_0x22182f=_0x22182f-0x0;var _0x276276=_0x1eed[_0x22182f];return _0x276276;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xd1ee('0x0'),_0xd1ee('0x1'),_0xd1ee('0x2')];function createListener(_0x138321,_0x19999d){return function(_0x2b7194){_0x19999d[_0xd1ee('0x3')](_0x138321,_0x2b7194);};}function removeListener(_0x506a6f,_0x2b4f2f){return function(){SmsMessageEvents[_0xd1ee('0x4')](_0x506a6f,_0x2b4f2f);};}exports[_0xd1ee('0x5')]=function(_0xf0361){for(var _0x1abdf5=0x0,_0x4fd403=events[_0xd1ee('0x6')];_0x1abdf5<_0x4fd403;_0x1abdf5++){var _0x28a605=events[_0x1abdf5];var _0x1ff674=createListener(_0xd1ee('0x7')+_0x28a605,_0xf0361);SmsMessageEvents['on'](_0x28a605,_0x1ff674);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 6b5e29a..579f4cc 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 _0x9f19=['describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','update','delete','destroy','removeAgents','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe'];(function(_0x594edd,_0x44edc0){var _0x468af5=function(_0x3541ff){while(--_0x3541ff){_0x594edd['push'](_0x594edd['shift']());}};_0x468af5(++_0x44edc0);}(_0x9f19,0x17c));var _0x99f1=function(_0x13f461,_0x5298dd){_0x13f461=_0x13f461-0x0;var _0x5c4848=_0x9f19[_0x13f461];return _0x5c4848;};'use strict';var multer=require('multer');var util=require(_0x99f1('0x0'));var path=require('path');var timeout=require(_0x99f1('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x99f1('0x2'));var auth=require(_0x99f1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x99f1('0x4'));var controller=require(_0x99f1('0x5'));router['get']('/',auth[_0x99f1('0x6')](),controller[_0x99f1('0x7')]);router[_0x99f1('0x8')](_0x99f1('0x9'),auth[_0x99f1('0x6')](),controller[_0x99f1('0xa')]);router[_0x99f1('0x8')](_0x99f1('0xb'),auth[_0x99f1('0x6')](),controller['show']);router['get'](_0x99f1('0xc'),auth[_0x99f1('0x6')](),controller[_0x99f1('0xd')]);router[_0x99f1('0x8')](_0x99f1('0xe'),auth[_0x99f1('0x6')](),controller[_0x99f1('0xf')]);router['get']('/:id/users',auth[_0x99f1('0x6')](),controller[_0x99f1('0x10')]);router[_0x99f1('0x11')]('/',auth[_0x99f1('0x6')](),controller[_0x99f1('0x12')]);router[_0x99f1('0x11')]('/:id/teams',auth[_0x99f1('0x6')](),controller[_0x99f1('0x13')]);router['post'](_0x99f1('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0x99f1('0x6')](),controller[_0x99f1('0x15')]);router[_0x99f1('0x16')](_0x99f1('0xb'),auth[_0x99f1('0x6')](),controller[_0x99f1('0x17')]);router[_0x99f1('0x16')](_0x99f1('0xe'),auth[_0x99f1('0x6')](),controller['removeTeams']);router[_0x99f1('0x16')](_0x99f1('0x14'),auth['isAuthenticated'](),controller[_0x99f1('0x18')]);module[_0x99f1('0x19')]=router; \ No newline at end of file +var _0xb002=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x368576,_0x2d15f6){var _0x43169e=function(_0xf18cc5){while(--_0xf18cc5){_0x368576['push'](_0x368576['shift']());}};_0x43169e(++_0x2d15f6);}(_0xb002,0xbc));var _0x2b00=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb002[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x2b00('0x0'));var util=require(_0x2b00('0x1'));var path=require(_0x2b00('0x2'));var timeout=require(_0x2b00('0x3'));var express=require(_0x2b00('0x4'));var router=express[_0x2b00('0x5')]();var fs_extra=require(_0x2b00('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2b00('0x7'));var config=require(_0x2b00('0x8'));var controller=require(_0x2b00('0x9'));router[_0x2b00('0xa')]('/',auth[_0x2b00('0xb')](),controller[_0x2b00('0xc')]);router[_0x2b00('0xa')](_0x2b00('0xd'),auth[_0x2b00('0xb')](),controller[_0x2b00('0xe')]);router['get'](_0x2b00('0xf'),auth[_0x2b00('0xb')](),controller[_0x2b00('0x10')]);router[_0x2b00('0xa')](_0x2b00('0x11'),auth[_0x2b00('0xb')](),controller[_0x2b00('0x12')]);router['get'](_0x2b00('0x13'),auth[_0x2b00('0xb')](),controller[_0x2b00('0x14')]);router['get'](_0x2b00('0x15'),auth[_0x2b00('0xb')](),controller['getAgents']);router[_0x2b00('0x16')]('/',auth[_0x2b00('0xb')](),controller[_0x2b00('0x17')]);router[_0x2b00('0x16')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x2b00('0x16')](_0x2b00('0x15'),auth[_0x2b00('0xb')](),controller[_0x2b00('0x18')]);router[_0x2b00('0x19')](_0x2b00('0xf'),auth[_0x2b00('0xb')](),controller[_0x2b00('0x1a')]);router[_0x2b00('0x1b')](_0x2b00('0xf'),auth[_0x2b00('0xb')](),controller['destroy']);router['delete'](_0x2b00('0x13'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x2b00('0x1b')](_0x2b00('0x15'),auth[_0x2b00('0xb')](),controller['removeAgents']);module[_0x2b00('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 96b2fb2..7010749 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 _0x79dc=['beepall','roundrobin','exports','name','STRING','INTEGER','ENUM'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x79dc,0x1c2));var _0xc79d=function(_0x4e1ef5,_0x4c94cd){_0x4e1ef5=_0x4e1ef5-0x0;var _0x58afa8=_0x79dc[_0x4e1ef5];return _0x58afa8;};'use strict';var Sequelize=require('sequelize');module[_0xc79d('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xc79d('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc79d('0x2')]},'timeout':{'type':Sequelize[_0xc79d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc79d('0x4')]('rrmemory',_0xc79d('0x5'),_0xc79d('0x6'))}}; \ No newline at end of file +var _0x706f=['roundrobin','sequelize','STRING','name','ENUM','rrmemory'];(function(_0x337627,_0x5f0682){var _0x1457ed=function(_0x1aab34){while(--_0x1aab34){_0x337627['push'](_0x337627['shift']());}};_0x1457ed(++_0x5f0682);}(_0x706f,0x1bd));var _0xf706=function(_0x5bfb92,_0x54a474){_0x5bfb92=_0x5bfb92-0x0;var _0x19e5fa=_0x706f[_0x5bfb92];return _0x19e5fa;};'use strict';var Sequelize=require(_0xf706('0x0'));module['exports']={'name':{'type':Sequelize[_0xf706('0x1')],'unique':_0xf706('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf706('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf706('0x3')](_0xf706('0x4'),'beepall',_0xf706('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 5a13856..fa81ecf 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 _0xf8f2=['describe','findOne','UserSmsQueue','order','sort','pick','SmsQueueId','User','findAndCountAll','UserId','smsPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','all','compact','value','removeAgents','userSmsQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','apply','reject','save','update','then','destroy','SmsQueues','end','stack','name','send','index','map','SmsQueue','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation'];(function(_0x38deb8,_0x572466){var _0xae0a3b=function(_0x31a67b){while(--_0x31a67b){_0x38deb8['push'](_0x38deb8['shift']());}};_0xae0a3b(++_0x572466);}(_0xf8f2,0xc2));var _0x2f8f=function(_0x140fae,_0xac5e4a){_0x140fae=_0x140fae-0x0;var _0x5eac87=_0xf8f2[_0x140fae];return _0x5eac87;};'use strict';var emlformat=require(_0x2f8f('0x0'));var rimraf=require(_0x2f8f('0x1'));var zipdir=require(_0x2f8f('0x2'));var jsonpatch=require(_0x2f8f('0x3'));var rp=require('request-promise');var moment=require(_0x2f8f('0x4'));var BPromise=require(_0x2f8f('0x5'));var Mustache=require(_0x2f8f('0x6'));var util=require(_0x2f8f('0x7'));var path=require(_0x2f8f('0x8'));var sox=require('sox');var csv=require(_0x2f8f('0x9'));var ejs=require(_0x2f8f('0xa'));var fs=require('fs');var fs_extra=require(_0x2f8f('0xb'));var _=require(_0x2f8f('0xc'));var squel=require(_0x2f8f('0xd'));var crypto=require(_0x2f8f('0xe'));var jsforce=require(_0x2f8f('0xf'));var deskjs=require(_0x2f8f('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2f8f('0x11'));var Papa=require(_0x2f8f('0x12'));var Redis=require(_0x2f8f('0x13'));var authService=require(_0x2f8f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2f8f('0x15'));var hardwareService=require(_0x2f8f('0x16'));var logger=require('../../config/logger')(_0x2f8f('0x17'));var utils=require(_0x2f8f('0x18'));var config=require(_0x2f8f('0x19'));var licenseUtil=require(_0x2f8f('0x1a'));var db=require('../../mysqldb')['db'];config[_0x2f8f('0x1b')]=_[_0x2f8f('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2f8f('0x1d'))(new Redis(config[_0x2f8f('0x1b')]));require('./smsQueue.socket')[_0x2f8f('0x1e')](socket);function respondWithStatusCode(_0x3c8461,_0xd55a01){_0xd55a01=_0xd55a01||0xcc;return function(_0x3c3b3c){if(_0x3c3b3c){return _0x3c8461[_0x2f8f('0x1f')](_0xd55a01);}return _0x3c8461['status'](_0xd55a01)['end']();};}function respondWithResult(_0x5d7dfa,_0x566025){_0x566025=_0x566025||0xc8;return function(_0x1e34bd){if(_0x1e34bd){return _0x5d7dfa[_0x2f8f('0x20')](_0x566025)[_0x2f8f('0x21')](_0x1e34bd);}};}function respondWithFilteredResult(_0x98a34c,_0x15ceea){return function(_0x54a5d2){if(_0x54a5d2){var _0x581d39=typeof _0x15ceea[_0x2f8f('0x22')]==='undefined'&&typeof _0x15ceea['limit']===_0x2f8f('0x23');var _0x100344=_0x54a5d2[_0x2f8f('0x24')];var _0xe816fd=_0x581d39?0x0:_0x15ceea[_0x2f8f('0x22')];var _0x261a5a=_0x581d39?_0x54a5d2[_0x2f8f('0x24')]:_0x15ceea[_0x2f8f('0x22')]+_0x15ceea['limit'];var _0x2e94df;if(_0x261a5a>=_0x100344){_0x261a5a=_0x100344;_0x2e94df=0xc8;}else{_0x2e94df=0xce;}_0x98a34c[_0x2f8f('0x20')](_0x2e94df);return _0x98a34c['set']('Content-Range',_0xe816fd+'-'+_0x261a5a+'/'+_0x100344)[_0x2f8f('0x21')](_0x54a5d2);}return null;};}function patchUpdates(_0x44fba4){return function(_0x17c862){try{jsonpatch[_0x2f8f('0x25')](_0x17c862,_0x44fba4,!![]);}catch(_0x2cc09e){return BPromise[_0x2f8f('0x26')](_0x2cc09e);}return _0x17c862[_0x2f8f('0x27')]();};}function saveUpdates(_0x3cf648,_0xcb3156){return function(_0x2202e5){if(_0x2202e5){return _0x2202e5[_0x2f8f('0x28')](_0x3cf648)[_0x2f8f('0x29')](function(_0x1bef3c){return _0x1bef3c;});}return null;};}function removeEntity(_0x55b591,_0x38a16a){return function(_0x16dc27){if(_0x16dc27){return _0x16dc27[_0x2f8f('0x2a')]()[_0x2f8f('0x29')](function(){var _0x286fb2=_0x16dc27['get']({'plain':!![]});var _0x378cdd=_0x2f8f('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x378cdd,'resourceId':_0x286fb2['id']}})['then'](function(){return _0x16dc27;});})[_0x2f8f('0x29')](function(){_0x55b591['status'](0xcc)[_0x2f8f('0x2c')]();});}};}function handleEntityNotFound(_0x1f9ad1,_0x125ed5){return function(_0x12924d){if(!_0x12924d){_0x1f9ad1[_0x2f8f('0x1f')](0x194);}return _0x12924d;};}function handleError(_0x4cb570,_0x180da7){_0x180da7=_0x180da7||0x1f4;return function(_0x2af7e4){logger['error'](_0x2af7e4[_0x2f8f('0x2d')]);if(_0x2af7e4[_0x2f8f('0x2e')]){delete _0x2af7e4[_0x2f8f('0x2e')];}_0x4cb570[_0x2f8f('0x20')](_0x180da7)[_0x2f8f('0x2f')](_0x2af7e4);};}exports[_0x2f8f('0x30')]=function(_0x37ed3e,_0x372fdd){var _0x3477ca={},_0x561c3a={},_0x21dcfb={'count':0x0,'rows':[]};var _0x6b35c6=_[_0x2f8f('0x31')](db[_0x2f8f('0x32')]['rawAttributes'],function(_0x413020){return{'name':_0x413020[_0x2f8f('0x33')],'type':_0x413020[_0x2f8f('0x34')][_0x2f8f('0x35')]};});_0x561c3a[_0x2f8f('0x36')]=_[_0x2f8f('0x31')](_0x6b35c6,'name');_0x561c3a[_0x2f8f('0x37')]=_[_0x2f8f('0x38')](_0x37ed3e[_0x2f8f('0x37')]);_0x561c3a[_0x2f8f('0x39')]=_[_0x2f8f('0x3a')](_0x561c3a[_0x2f8f('0x36')],_0x561c3a['query']);_0x3477ca['attributes']=_['intersection'](_0x561c3a['model'],qs[_0x2f8f('0x3b')](_0x37ed3e[_0x2f8f('0x37')][_0x2f8f('0x3b')]));_0x3477ca[_0x2f8f('0x3c')]=_0x3477ca[_0x2f8f('0x3c')][_0x2f8f('0x3d')]?_0x3477ca[_0x2f8f('0x3c')]:_0x561c3a['model'];if(!_0x37ed3e[_0x2f8f('0x37')][_0x2f8f('0x3e')](_0x2f8f('0x3f'))){_0x3477ca[_0x2f8f('0x40')]=qs['limit'](_0x37ed3e[_0x2f8f('0x37')]['limit']);_0x3477ca['offset']=qs['offset'](_0x37ed3e[_0x2f8f('0x37')][_0x2f8f('0x22')]);}_0x3477ca['order']=qs['sort'](_0x37ed3e[_0x2f8f('0x37')]['sort']);_0x3477ca[_0x2f8f('0x41')]=qs['filters'](_['pick'](_0x37ed3e[_0x2f8f('0x37')],_0x561c3a['filters']),_0x6b35c6);if(_0x37ed3e['query'][_0x2f8f('0x42')]){_0x3477ca[_0x2f8f('0x41')]=_[_0x2f8f('0x43')](_0x3477ca['where'],{'$or':_[_0x2f8f('0x31')](_0x6b35c6,function(_0x3d8873){if(_0x3d8873[_0x2f8f('0x34')]!==_0x2f8f('0x44')){var _0x3bd513={};_0x3bd513[_0x3d8873[_0x2f8f('0x2e')]]={'$like':'%'+_0x37ed3e[_0x2f8f('0x37')][_0x2f8f('0x42')]+'%'};return _0x3bd513;}})});}_0x3477ca=_[_0x2f8f('0x43')]({},_0x3477ca,_0x37ed3e[_0x2f8f('0x45')]);var _0x4e4a12={'where':_0x3477ca[_0x2f8f('0x41')]};return db['SmsQueue']['count'](_0x4e4a12)[_0x2f8f('0x29')](function(_0x5d665b){_0x21dcfb['count']=_0x5d665b;if(_0x37ed3e[_0x2f8f('0x37')]['includeAll']){_0x3477ca[_0x2f8f('0x46')]=[{'all':!![]}];}return db[_0x2f8f('0x32')][_0x2f8f('0x47')](_0x3477ca);})[_0x2f8f('0x29')](function(_0x13d5ed){_0x21dcfb[_0x2f8f('0x48')]=_0x13d5ed;return _0x21dcfb;})[_0x2f8f('0x29')](respondWithFilteredResult(_0x372fdd,_0x3477ca))[_0x2f8f('0x49')](handleError(_0x372fdd,null));};exports[_0x2f8f('0x4a')]=function(_0x320d65,_0x335468){var _0x1c290f={'raw':!![],'where':{'id':_0x320d65[_0x2f8f('0x4b')]['id']}},_0x3ad52b={};_0x3ad52b[_0x2f8f('0x36')]=_[_0x2f8f('0x38')](db[_0x2f8f('0x32')][_0x2f8f('0x4c')]);_0x3ad52b[_0x2f8f('0x37')]=_[_0x2f8f('0x38')](_0x320d65[_0x2f8f('0x37')]);_0x3ad52b[_0x2f8f('0x39')]=_['intersection'](_0x3ad52b['model'],_0x3ad52b[_0x2f8f('0x37')]);_0x1c290f['attributes']=_[_0x2f8f('0x3a')](_0x3ad52b[_0x2f8f('0x36')],qs['fields'](_0x320d65['query']['fields']));_0x1c290f[_0x2f8f('0x3c')]=_0x1c290f[_0x2f8f('0x3c')][_0x2f8f('0x3d')]?_0x1c290f['attributes']:_0x3ad52b[_0x2f8f('0x36')];if(_0x320d65[_0x2f8f('0x37')][_0x2f8f('0x4d')]){_0x1c290f[_0x2f8f('0x46')]=[{'all':!![]}];}_0x1c290f=_[_0x2f8f('0x43')]({},_0x1c290f,_0x320d65[_0x2f8f('0x45')]);return db['SmsQueue']['find'](_0x1c290f)['then'](handleEntityNotFound(_0x335468,null))[_0x2f8f('0x29')](respondWithResult(_0x335468,null))[_0x2f8f('0x49')](handleError(_0x335468,null));};exports[_0x2f8f('0x4e')]=function(_0xd51df4,_0x42b573){return db[_0x2f8f('0x32')][_0x2f8f('0x4e')](_0xd51df4[_0x2f8f('0x4f')],{})[_0x2f8f('0x29')](function(_0x34bcdc){var _0x1b1ab2=_0xd51df4[_0x2f8f('0x50')][_0x2f8f('0x51')]({'plain':!![]});if(!_0x1b1ab2)throw new Error(_0x2f8f('0x52'));if(_0x1b1ab2['role']===_0x2f8f('0x50')){var _0x514bf6=_0x34bcdc['get']({'plain':!![]});var _0x231ae9=_0x2f8f('0x2b');return db[_0x2f8f('0x53')][_0x2f8f('0x54')]({'where':{'name':_0x231ae9,'userProfileId':_0x1b1ab2['userProfileId']},'raw':!![]})[_0x2f8f('0x29')](function(_0x4c2918){if(_0x4c2918&&_0x4c2918[_0x2f8f('0x55')]===0x0){return db['UserProfileResource'][_0x2f8f('0x4e')]({'name':_0x514bf6[_0x2f8f('0x2e')],'resourceId':_0x514bf6['id'],'type':_0x4c2918[_0x2f8f('0x2e')],'sectionId':_0x4c2918['id']},{})[_0x2f8f('0x29')](function(){return _0x34bcdc;});}else{return _0x34bcdc;}})[_0x2f8f('0x49')](function(_0x5b6e62){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b6e62);throw _0x5b6e62;});}return _0x34bcdc;})[_0x2f8f('0x29')](respondWithResult(_0x42b573,0xc9))[_0x2f8f('0x49')](handleError(_0x42b573,null));};exports[_0x2f8f('0x28')]=function(_0x3410bd,_0x2884fc){if(_0x3410bd[_0x2f8f('0x4f')]['id']){delete _0x3410bd['body']['id'];}return db[_0x2f8f('0x32')]['find']({'where':{'id':_0x3410bd[_0x2f8f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2884fc,null))[_0x2f8f('0x29')](saveUpdates(_0x3410bd[_0x2f8f('0x4f')],null))[_0x2f8f('0x29')](respondWithResult(_0x2884fc,null))['catch'](handleError(_0x2884fc,null));};exports[_0x2f8f('0x2a')]=function(_0x33a731,_0x43ca3d){return db['SmsQueue'][_0x2f8f('0x54')]({'where':{'id':_0x33a731[_0x2f8f('0x4b')]['id']}})[_0x2f8f('0x29')](handleEntityNotFound(_0x43ca3d,null))[_0x2f8f('0x29')](removeEntity(_0x43ca3d,null))[_0x2f8f('0x49')](handleError(_0x43ca3d,null));};exports[_0x2f8f('0x56')]=function(_0x2b7060,_0x41bcca){return db['SmsQueue'][_0x2f8f('0x56')]()[_0x2f8f('0x29')](respondWithResult(_0x41bcca,null))['catch'](handleError(_0x41bcca,null));};exports['getMembers']=function(_0x423b87,_0x4c1b15,_0x44921c){var _0x7c737={'raw':!![],'where':{}},_0x565896={},_0x34332b;return db[_0x2f8f('0x32')][_0x2f8f('0x57')]({'where':{'id':_0x423b87[_0x2f8f('0x4b')]['id']}})[_0x2f8f('0x29')](handleEntityNotFound(_0x4c1b15,null))[_0x2f8f('0x29')](function(_0x40d45c){if(_0x40d45c){_0x34332b=_0x40d45c[_0x2f8f('0x51')]({'plain':!![]});_0x565896[_0x2f8f('0x36')]=_[_0x2f8f('0x38')](db[_0x2f8f('0x58')][_0x2f8f('0x4c')]);_0x565896[_0x2f8f('0x37')]=_[_0x2f8f('0x38')](_0x423b87[_0x2f8f('0x37')]);_0x565896[_0x2f8f('0x39')]=_[_0x2f8f('0x3a')](_0x565896[_0x2f8f('0x36')],_0x565896['query']);_0x7c737['attributes']=_['intersection'](_0x565896['model'],qs[_0x2f8f('0x3b')](_0x423b87[_0x2f8f('0x37')][_0x2f8f('0x3b')]));_0x7c737[_0x2f8f('0x3c')]=_0x7c737['attributes'][_0x2f8f('0x3d')]?_0x7c737[_0x2f8f('0x3c')]:_0x565896[_0x2f8f('0x36')];if(!_0x423b87[_0x2f8f('0x37')]['hasOwnProperty'](_0x2f8f('0x3f'))){_0x7c737[_0x2f8f('0x40')]=qs['limit'](_0x423b87['query'][_0x2f8f('0x40')]);_0x7c737[_0x2f8f('0x22')]=qs[_0x2f8f('0x22')](_0x423b87['query']['offset']);}_0x7c737[_0x2f8f('0x59')]=qs[_0x2f8f('0x5a')](_0x423b87[_0x2f8f('0x37')][_0x2f8f('0x5a')]);_0x7c737[_0x2f8f('0x41')]=qs['filters'](_[_0x2f8f('0x5b')](_0x423b87['query'],_0x565896[_0x2f8f('0x39')]));_0x7c737[_0x2f8f('0x41')][_0x2f8f('0x5c')]=_0x40d45c['id'];if(_0x423b87['query'][_0x2f8f('0x42')]){_0x7c737[_0x2f8f('0x41')]=_[_0x2f8f('0x43')](_0x7c737['where'],{'$or':_[_0x2f8f('0x31')](_0x7c737['attributes'],function(_0x15c8b7){var _0x1da2c2={};_0x1da2c2[_0x15c8b7]={'$like':'%'+_0x423b87[_0x2f8f('0x37')][_0x2f8f('0x42')]+'%'};return _0x1da2c2;})});}_0x7c737=_[_0x2f8f('0x43')]({},_0x7c737,_0x423b87['options']);return db[_0x2f8f('0x58')][_0x2f8f('0x47')](_0x7c737);}})[_0x2f8f('0x29')](function(_0x4675b9){if(_0x4675b9){return db[_0x2f8f('0x5d')][_0x2f8f('0x5e')]({'where':{'id':_[_0x2f8f('0x31')](_0x4675b9,_0x2f8f('0x5f')),'role':'agent'},'attributes':['id','name',_0x2f8f('0x60'),_0x2f8f('0x61'),'createdAt']});}})[_0x2f8f('0x29')](function(_0x1b8906){if(_0x1b8906){return{'count':_0x1b8906[_0x2f8f('0x24')],'rows':_[_0x2f8f('0x31')](_0x1b8906['rows'],function(_0x201e31){return{'membername':_0x201e31[_0x2f8f('0x2e')],'UserId':_0x201e31['id'],'queue_name':_0x34332b[_0x2f8f('0x2e')],'SmsQueueId':_0x34332b['id'],'interface':util[_0x2f8f('0x62')](_0x2f8f('0x63'),_0x2f8f('0x64'),_0x201e31[_0x2f8f('0x2e')]),'penalty':0x0,'paused':_0x201e31[_0x2f8f('0x60')],'createdAt':_0x201e31[_0x2f8f('0x65')],'updatedAt':_0x201e31[_0x2f8f('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4c1b15,_0x7c737))['catch'](handleError(_0x4c1b15,null));};exports[_0x2f8f('0x66')]=function(_0x4799ad,_0x118d18,_0x511da4){var _0x185b8a={};var _0x509a27={};var _0x45546d;var _0x37b3e9;return db[_0x2f8f('0x32')]['findOne']({'where':{'id':_0x4799ad[_0x2f8f('0x4b')]['id']}})[_0x2f8f('0x29')](handleEntityNotFound(_0x118d18,null))[_0x2f8f('0x29')](function(_0x2a9486){if(_0x2a9486){_0x45546d=_0x2a9486;_0x509a27['model']=_['keys'](db['Team']['rawAttributes']);_0x509a27[_0x2f8f('0x37')]=_[_0x2f8f('0x38')](_0x4799ad['query']);_0x509a27[_0x2f8f('0x39')]=_[_0x2f8f('0x3a')](_0x509a27['model'],_0x509a27[_0x2f8f('0x37')]);_0x185b8a[_0x2f8f('0x3c')]=_[_0x2f8f('0x3a')](_0x509a27[_0x2f8f('0x36')],qs['fields'](_0x4799ad[_0x2f8f('0x37')][_0x2f8f('0x3b')]));_0x185b8a[_0x2f8f('0x3c')]=_0x185b8a[_0x2f8f('0x3c')][_0x2f8f('0x3d')]?_0x185b8a['attributes']:_0x509a27[_0x2f8f('0x36')];_0x185b8a['order']=qs[_0x2f8f('0x5a')](_0x4799ad[_0x2f8f('0x37')]['sort']);_0x185b8a[_0x2f8f('0x41')]=qs['filters'](_['pick'](_0x4799ad[_0x2f8f('0x37')],_0x509a27['filters']));if(_0x4799ad[_0x2f8f('0x37')][_0x2f8f('0x42')]){_0x185b8a[_0x2f8f('0x41')]=_[_0x2f8f('0x43')](_0x185b8a[_0x2f8f('0x41')],{'$or':_['map'](_0x185b8a[_0x2f8f('0x3c')],function(_0x2dfac2){var _0x941c55={};_0x941c55[_0x2dfac2]={'$like':'%'+_0x4799ad['query'][_0x2f8f('0x42')]+'%'};return _0x941c55;})});}_0x185b8a=_[_0x2f8f('0x43')]({},_0x185b8a,_0x4799ad[_0x2f8f('0x45')]);return _0x45546d[_0x2f8f('0x66')](_0x185b8a);}})[_0x2f8f('0x29')](function(_0xea224b){if(_0xea224b){_0x37b3e9=_0xea224b[_0x2f8f('0x3d')];if(!_0x4799ad[_0x2f8f('0x37')][_0x2f8f('0x3e')](_0x2f8f('0x3f'))){_0x185b8a[_0x2f8f('0x40')]=qs[_0x2f8f('0x40')](_0x4799ad['query'][_0x2f8f('0x40')]);_0x185b8a[_0x2f8f('0x22')]=qs[_0x2f8f('0x22')](_0x4799ad[_0x2f8f('0x37')][_0x2f8f('0x22')]);}return _0x45546d[_0x2f8f('0x66')](_0x185b8a);}})['then'](function(_0x1a893d){if(_0x1a893d){return _0x1a893d?{'count':_0x37b3e9,'rows':_0x1a893d}:null;}})[_0x2f8f('0x29')](respondWithResult(_0x118d18,null))[_0x2f8f('0x49')](handleError(_0x118d18,null));};exports[_0x2f8f('0x67')]=function(_0x4f3f8e,_0x129deb,_0x4b267c){var _0x1e942b=_0x4f3f8e['body'][_0x2f8f('0x68')];return db[_0x2f8f('0x69')]['findAll']({'where':{'id':_0x1e942b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2f8f('0x6a'),'attributes':['id',_0x2f8f('0x2e'),_0x2f8f('0x6b'),_0x2f8f('0x6c'),_0x2f8f('0x6d')],'raw':!![]}]})[_0x2f8f('0x29')](function(_0x33fb9d){if(_0x33fb9d){var _0x350b4f=_['flatMap'](_0x33fb9d,function(_0x208305){var _0x494085=_0x208305[_0x2f8f('0x51')]({'plain':!![]});return _0x494085[_0x2f8f('0x6a')];});return db['SmsQueue'][_0x2f8f('0x54')]({'where':{'id':_0x4f3f8e[_0x2f8f('0x4b')]['id']}})[_0x2f8f('0x29')](function(_0x18877c){return db[_0x2f8f('0x6e')][_0x2f8f('0x6f')](function(_0x5b8c07){return _0x18877c[_0x2f8f('0x67')](_0x1e942b,{'transaction':_0x5b8c07})['then'](function(){return BPromise[_0x2f8f('0x70')](_0x350b4f,function(_0x155a39){return db[_0x2f8f('0x58')][_0x2f8f('0x71')]({'where':{'UserId':_0x155a39['id'],'SmsQueueId':_0x4f3f8e[_0x2f8f('0x4b')]['id']},'transaction':_0x5b8c07});});})[_0x2f8f('0x29')](function(){_0x350b4f[_0x2f8f('0x72')](function(_0x17d5b1){socket[_0x2f8f('0x73')](_0x2f8f('0x74'),{'UserId':_0x17d5b1['id'],'SmsQueueId':_0x18877c['id']});});});});});}})[_0x2f8f('0x29')](respondWithStatusCode(_0x129deb,null))[_0x2f8f('0x49')](handleError(_0x129deb,null));};exports[_0x2f8f('0x75')]=function(_0x2aa4f4,_0x5492b9,_0x3ca61a){return db[_0x2f8f('0x69')][_0x2f8f('0x47')]({'where':{'id':_0x2aa4f4[_0x2f8f('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2f8f('0x5d')],'as':_0x2f8f('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x2f8f('0x29')](handleEntityNotFound(_0x5492b9,null))[_0x2f8f('0x29')](function(_0x1ff9b0){var _0x1847f0=_['map'](_0x1ff9b0,'id');var _0x30b96c=[];var _0x28b9fa=[];var _0x50a752=squel[_0x2f8f('0x76')]();_0x50a752['field'](_0x2f8f('0x77'))[_0x2f8f('0x78')](_0x2f8f('0x79'),'tq')[_0x2f8f('0x7a')]('user_has_teams','ut',_0x2f8f('0x7b'))['where'](_0x2f8f('0x7c'),_0x2aa4f4[_0x2f8f('0x4b')]['id']);for(var _0x3c78a5=0x0;_0x3c78a5<_0x1ff9b0[_0x2f8f('0x3d')];_0x3c78a5+=0x1){let _0x112911=_0x1ff9b0[_0x3c78a5];for(var _0x1e841f=0x0;_0x1e841f<_0x112911[_0x2f8f('0x6a')][_0x2f8f('0x3d')];_0x1e841f+=0x1){let _0xb5e3c=_0x112911['Agents'][_0x1e841f];var _0x3c275b=_0x50a752[_0x2f8f('0x7d')]();_0x3c275b[_0x2f8f('0x41')](_0x2f8f('0x7e'),_0xb5e3c['id']);_0x28b9fa['push'](db['sequelize']['query'](_0x3c275b[_0x2f8f('0x7f')](),{'type':db[_0x2f8f('0x6e')]['QueryTypes']['SELECT']})[_0x2f8f('0x29')](function(_0x4847e0){if(_0x4847e0[_0x2f8f('0x3d')]===0x1){return _0xb5e3c['id'];}else{var _0x4c2bbf=_[_0x2f8f('0x80')](_['map'](_0x4847e0,_0x2f8f('0x81')),function(_0x2c7681){return _[_0x2f8f('0x82')](_0x1847f0,_0x2c7681);});if(_0x4c2bbf){return _0xb5e3c['id'];}}}));}}return BPromise[_0x2f8f('0x83')](_0x28b9fa)[_0x2f8f('0x29')](function(_0x541540){_0x30b96c=_(_0x30b96c)['union'](_0x541540)[_0x2f8f('0x84')]()[_0x2f8f('0x85')]();return db['SmsQueue']['find']({'where':{'id':_0x2aa4f4[_0x2f8f('0x4b')]['id']}})['then'](function(_0x11c71b){return db[_0x2f8f('0x6e')][_0x2f8f('0x6f')](function(_0x43b22f){return _0x11c71b[_0x2f8f('0x75')](_0x2aa4f4[_0x2f8f('0x37')]['ids'],{'transaction':_0x43b22f})['then'](function(){if(!_['isEmpty'](_0x30b96c)){return _0x11c71b[_0x2f8f('0x86')](_0x30b96c,{'transaction':_0x43b22f});}})[_0x2f8f('0x29')](function(){_0x30b96c[_0x2f8f('0x72')](function(_0x266d7c){socket[_0x2f8f('0x73')](_0x2f8f('0x87'),{'UserId':_0x266d7c,'SmsQueueId':_0x11c71b['id']});});});});});});})['then'](respondWithStatusCode(_0x5492b9,null))[_0x2f8f('0x49')](handleError(_0x5492b9,null));};exports[_0x2f8f('0x88')]=function(_0x39efd9,_0x279f67,_0x332f92){return db[_0x2f8f('0x32')][_0x2f8f('0x54')]({'where':{'id':_0x39efd9[_0x2f8f('0x4b')]['id']}})[_0x2f8f('0x29')](handleEntityNotFound(_0x279f67,null))['then'](function(_0x1f7a03){if(_0x1f7a03){return _0x1f7a03[_0x2f8f('0x88')](_0x39efd9[_0x2f8f('0x4f')][_0x2f8f('0x68')],_[_0x2f8f('0x89')](_0x39efd9['body'],['ids','id'])||{})['spread'](function(_0x5e06c3){for(var _0x250e89=0x0;_0x250e89<_0x39efd9[_0x2f8f('0x4f')]['ids'][_0x2f8f('0x3d')];_0x250e89+=0x1){socket[_0x2f8f('0x73')](_0x2f8f('0x74'),{'UserId':Number(_0x39efd9[_0x2f8f('0x4f')]['ids'][_0x250e89]),'SmsQueueId':Number(_0x39efd9[_0x2f8f('0x4b')]['id'])});}return _0x5e06c3;});}})[_0x2f8f('0x29')](respondWithResult(_0x279f67,null))[_0x2f8f('0x49')](handleError(_0x279f67,null));};exports[_0x2f8f('0x86')]=function(_0x4f51d1,_0x429a69,_0x280d8d){return db['SmsQueue'][_0x2f8f('0x54')]({'where':{'id':_0x4f51d1[_0x2f8f('0x4b')]['id']}})[_0x2f8f('0x29')](handleEntityNotFound(_0x429a69,null))[_0x2f8f('0x29')](function(_0x552b37){if(_0x552b37){return _0x552b37[_0x2f8f('0x86')](_0x4f51d1[_0x2f8f('0x37')][_0x2f8f('0x68')])[_0x2f8f('0x29')](function(){if(_[_0x2f8f('0x8a')](_0x4f51d1['query'][_0x2f8f('0x68')])){for(var _0x159200=0x0;_0x159200<_0x4f51d1[_0x2f8f('0x37')]['ids']['length'];_0x159200+=0x1){socket[_0x2f8f('0x73')](_0x2f8f('0x87'),{'UserId':Number(_0x4f51d1[_0x2f8f('0x37')]['ids'][_0x159200]),'SmsQueueId':Number(_0x4f51d1[_0x2f8f('0x4b')]['id'])});}}else{socket['emit'](_0x2f8f('0x87'),{'UserId':Number(_0x4f51d1[_0x2f8f('0x37')]['ids']),'SmsQueueId':Number(_0x4f51d1[_0x2f8f('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x429a69,null))[_0x2f8f('0x49')](handleError(_0x429a69,null));};exports[_0x2f8f('0x8b')]=function(_0x308c02,_0xf9a828,_0x4bb46c){var _0x746c77={};var _0x455627={};var _0x1fb608;var _0x3ccd18;return db[_0x2f8f('0x32')][_0x2f8f('0x57')]({'where':{'id':_0x308c02[_0x2f8f('0x4b')]['id']}})[_0x2f8f('0x29')](handleEntityNotFound(_0xf9a828,null))[_0x2f8f('0x29')](function(_0x274a84){if(_0x274a84){_0x1fb608=_0x274a84;_0x455627[_0x2f8f('0x36')]=_[_0x2f8f('0x38')](db['User']['rawAttributes']);_0x455627[_0x2f8f('0x37')]=_[_0x2f8f('0x38')](_0x308c02[_0x2f8f('0x37')]);_0x455627[_0x2f8f('0x39')]=_[_0x2f8f('0x3a')](_0x455627[_0x2f8f('0x36')],_0x455627['query']);_0x746c77['attributes']=_[_0x2f8f('0x3a')](_0x455627['model'],qs['fields'](_0x308c02['query']['fields']));_0x746c77['attributes']=_0x746c77[_0x2f8f('0x3c')][_0x2f8f('0x3d')]?_0x746c77['attributes']:_0x455627['model'];_0x746c77['order']=qs[_0x2f8f('0x5a')](_0x308c02[_0x2f8f('0x37')]['sort']);_0x746c77[_0x2f8f('0x41')]=qs[_0x2f8f('0x39')](_[_0x2f8f('0x5b')](_0x308c02[_0x2f8f('0x37')],_0x455627['filters']));if(_0x308c02[_0x2f8f('0x37')][_0x2f8f('0x42')]){_0x746c77[_0x2f8f('0x41')]=_[_0x2f8f('0x43')](_0x746c77[_0x2f8f('0x41')],{'$or':_['map'](_0x746c77[_0x2f8f('0x3c')],function(_0x4ba756){var _0x23fe19={};_0x23fe19[_0x4ba756]={'$like':'%'+_0x308c02[_0x2f8f('0x37')][_0x2f8f('0x42')]+'%'};return _0x23fe19;})});}_0x746c77=_[_0x2f8f('0x43')]({},_0x746c77,_0x308c02['options']);return _0x1fb608[_0x2f8f('0x8b')](_0x746c77);}})[_0x2f8f('0x29')](function(_0x32275e){if(_0x32275e){_0x3ccd18=_0x32275e['length'];if(!_0x308c02[_0x2f8f('0x37')][_0x2f8f('0x3e')](_0x2f8f('0x3f'))){_0x746c77[_0x2f8f('0x40')]=qs[_0x2f8f('0x40')](_0x308c02['query'][_0x2f8f('0x40')]);_0x746c77[_0x2f8f('0x22')]=qs['offset'](_0x308c02[_0x2f8f('0x37')]['offset']);}return _0x1fb608['getAgents'](_0x746c77);}})[_0x2f8f('0x29')](function(_0x5877ee){if(_0x5877ee){return _0x5877ee?{'count':_0x3ccd18,'rows':_0x5877ee}:null;}})[_0x2f8f('0x29')](respondWithResult(_0xf9a828,null))[_0x2f8f('0x49')](handleError(_0xf9a828,null));}; \ No newline at end of file +var _0xd11c=['reject','update','then','destroy','get','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','role','user','SmsQueues','UserProfileSection','userProfileId','UserProfileResource','body','describe','findOne','UserSmsQueue','pick','SmsQueueId','findAndCountAll','smsPause','updatedAt','format','%s/%s','getTeams','Team','addTeams','User','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userSmsQueue:save','ids','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','Agents','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply'];(function(_0x29631f,_0xdb767){var _0x486d87=function(_0x33a1bb){while(--_0x33a1bb){_0x29631f['push'](_0x29631f['shift']());}};_0x486d87(++_0xdb767);}(_0xd11c,0x64));var _0xcd11=function(_0x220e36,_0x416c65){_0x220e36=_0x220e36-0x0;var _0x404680=_0xd11c[_0x220e36];return _0x404680;};'use strict';var emlformat=require(_0xcd11('0x0'));var rimraf=require(_0xcd11('0x1'));var zipdir=require(_0xcd11('0x2'));var jsonpatch=require(_0xcd11('0x3'));var rp=require('request-promise');var moment=require(_0xcd11('0x4'));var BPromise=require(_0xcd11('0x5'));var Mustache=require('mustache');var util=require(_0xcd11('0x6'));var path=require('path');var sox=require(_0xcd11('0x7'));var csv=require(_0xcd11('0x8'));var ejs=require(_0xcd11('0x9'));var fs=require('fs');var fs_extra=require(_0xcd11('0xa'));var _=require('lodash');var squel=require(_0xcd11('0xb'));var crypto=require(_0xcd11('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcd11('0xd'));var authService=require(_0xcd11('0xe'));var qs=require(_0xcd11('0xf'));var as=require(_0xcd11('0x10'));var hardwareService=require(_0xcd11('0x11'));var logger=require(_0xcd11('0x12'))(_0xcd11('0x13'));var utils=require(_0xcd11('0x14'));var config=require(_0xcd11('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xcd11('0x16')]=_[_0xcd11('0x17')](config[_0xcd11('0x16')],{'host':_0xcd11('0x18'),'port':0x18eb});var socket=require(_0xcd11('0x19'))(new Redis(config[_0xcd11('0x16')]));require('./smsQueue.socket')[_0xcd11('0x1a')](socket);function respondWithStatusCode(_0xc2072b,_0x4eac50){_0x4eac50=_0x4eac50||0xcc;return function(_0x1adf86){if(_0x1adf86){return _0xc2072b[_0xcd11('0x1b')](_0x4eac50);}return _0xc2072b[_0xcd11('0x1c')](_0x4eac50)[_0xcd11('0x1d')]();};}function respondWithResult(_0x48d514,_0x472754){_0x472754=_0x472754||0xc8;return function(_0x1de35f){if(_0x1de35f){return _0x48d514['status'](_0x472754)[_0xcd11('0x1e')](_0x1de35f);}};}function respondWithFilteredResult(_0x34bc1c,_0x5219ba){return function(_0x404948){if(_0x404948){var _0xf32d94=typeof _0x5219ba[_0xcd11('0x1f')]===_0xcd11('0x20')&&typeof _0x5219ba['limit']===_0xcd11('0x20');var _0x12e9b6=_0x404948[_0xcd11('0x21')];var _0x3587ca=_0xf32d94?0x0:_0x5219ba[_0xcd11('0x1f')];var _0x31ad3b=_0xf32d94?_0x404948['count']:_0x5219ba[_0xcd11('0x1f')]+_0x5219ba[_0xcd11('0x22')];var _0x3f0b36;if(_0x31ad3b>=_0x12e9b6){_0x31ad3b=_0x12e9b6;_0x3f0b36=0xc8;}else{_0x3f0b36=0xce;}_0x34bc1c[_0xcd11('0x1c')](_0x3f0b36);return _0x34bc1c[_0xcd11('0x23')]('Content-Range',_0x3587ca+'-'+_0x31ad3b+'/'+_0x12e9b6)[_0xcd11('0x1e')](_0x404948);}return null;};}function patchUpdates(_0x584070){return function(_0x293a13){try{jsonpatch[_0xcd11('0x24')](_0x293a13,_0x584070,!![]);}catch(_0x3b4850){return BPromise[_0xcd11('0x25')](_0x3b4850);}return _0x293a13['save']();};}function saveUpdates(_0x2bd1d8,_0x598483){return function(_0xe32181){if(_0xe32181){return _0xe32181[_0xcd11('0x26')](_0x2bd1d8)[_0xcd11('0x27')](function(_0x4166a2){return _0x4166a2;});}return null;};}function removeEntity(_0x5ce02c,_0x230f27){return function(_0x59585b){if(_0x59585b){return _0x59585b[_0xcd11('0x28')]()[_0xcd11('0x27')](function(){var _0x47820d=_0x59585b[_0xcd11('0x29')]({'plain':!![]});var _0x1387a0='SmsQueues';return db['UserProfileResource'][_0xcd11('0x28')]({'where':{'type':_0x1387a0,'resourceId':_0x47820d['id']}})[_0xcd11('0x27')](function(){return _0x59585b;});})[_0xcd11('0x27')](function(){_0x5ce02c['status'](0xcc)[_0xcd11('0x1d')]();});}};}function handleEntityNotFound(_0xbdda18,_0x4cbf62){return function(_0xfe86d3){if(!_0xfe86d3){_0xbdda18['sendStatus'](0x194);}return _0xfe86d3;};}function handleError(_0x1809f1,_0x3a0145){_0x3a0145=_0x3a0145||0x1f4;return function(_0x2e4b2e){logger[_0xcd11('0x2a')](_0x2e4b2e[_0xcd11('0x2b')]);if(_0x2e4b2e[_0xcd11('0x2c')]){delete _0x2e4b2e[_0xcd11('0x2c')];}_0x1809f1[_0xcd11('0x1c')](_0x3a0145)[_0xcd11('0x2d')](_0x2e4b2e);};}exports[_0xcd11('0x2e')]=function(_0x3030fc,_0x1fa23b){var _0x3eaf20={},_0x11bfc0={},_0x35a354={'count':0x0,'rows':[]};var _0x43e7bc=_[_0xcd11('0x2f')](db[_0xcd11('0x30')][_0xcd11('0x31')],function(_0x51160c){return{'name':_0x51160c[_0xcd11('0x32')],'type':_0x51160c[_0xcd11('0x33')][_0xcd11('0x34')]};});_0x11bfc0[_0xcd11('0x35')]=_[_0xcd11('0x2f')](_0x43e7bc,_0xcd11('0x2c'));_0x11bfc0[_0xcd11('0x36')]=_[_0xcd11('0x37')](_0x3030fc[_0xcd11('0x36')]);_0x11bfc0[_0xcd11('0x38')]=_[_0xcd11('0x39')](_0x11bfc0[_0xcd11('0x35')],_0x11bfc0[_0xcd11('0x36')]);_0x3eaf20[_0xcd11('0x3a')]=_[_0xcd11('0x39')](_0x11bfc0[_0xcd11('0x35')],qs[_0xcd11('0x3b')](_0x3030fc[_0xcd11('0x36')][_0xcd11('0x3b')]));_0x3eaf20[_0xcd11('0x3a')]=_0x3eaf20[_0xcd11('0x3a')][_0xcd11('0x3c')]?_0x3eaf20['attributes']:_0x11bfc0['model'];if(!_0x3030fc['query'][_0xcd11('0x3d')](_0xcd11('0x3e'))){_0x3eaf20[_0xcd11('0x22')]=qs['limit'](_0x3030fc['query']['limit']);_0x3eaf20['offset']=qs[_0xcd11('0x1f')](_0x3030fc[_0xcd11('0x36')][_0xcd11('0x1f')]);}_0x3eaf20[_0xcd11('0x3f')]=qs[_0xcd11('0x40')](_0x3030fc[_0xcd11('0x36')][_0xcd11('0x40')]);_0x3eaf20[_0xcd11('0x41')]=qs[_0xcd11('0x38')](_['pick'](_0x3030fc[_0xcd11('0x36')],_0x11bfc0[_0xcd11('0x38')]),_0x43e7bc);if(_0x3030fc[_0xcd11('0x36')][_0xcd11('0x42')]){_0x3eaf20[_0xcd11('0x41')]=_[_0xcd11('0x43')](_0x3eaf20[_0xcd11('0x41')],{'$or':_[_0xcd11('0x2f')](_0x43e7bc,function(_0x2eb9d4){if(_0x2eb9d4['type']!=='VIRTUAL'){var _0x346683={};_0x346683[_0x2eb9d4[_0xcd11('0x2c')]]={'$like':'%'+_0x3030fc[_0xcd11('0x36')]['filter']+'%'};return _0x346683;}})});}_0x3eaf20=_[_0xcd11('0x43')]({},_0x3eaf20,_0x3030fc[_0xcd11('0x44')]);var _0x182b50={'where':_0x3eaf20[_0xcd11('0x41')]};return db[_0xcd11('0x30')][_0xcd11('0x21')](_0x182b50)[_0xcd11('0x27')](function(_0x2c4e86){_0x35a354['count']=_0x2c4e86;if(_0x3030fc[_0xcd11('0x36')][_0xcd11('0x45')]){_0x3eaf20[_0xcd11('0x46')]=[{'all':!![]}];}return db['SmsQueue'][_0xcd11('0x47')](_0x3eaf20);})[_0xcd11('0x27')](function(_0x48e855){_0x35a354[_0xcd11('0x48')]=_0x48e855;return _0x35a354;})['then'](respondWithFilteredResult(_0x1fa23b,_0x3eaf20))[_0xcd11('0x49')](handleError(_0x1fa23b,null));};exports[_0xcd11('0x4a')]=function(_0x59ce8c,_0x853ef1){var _0xd6ac3a={'raw':!![],'where':{'id':_0x59ce8c[_0xcd11('0x4b')]['id']}},_0xe53d52={};_0xe53d52[_0xcd11('0x35')]=_[_0xcd11('0x37')](db[_0xcd11('0x30')][_0xcd11('0x31')]);_0xe53d52[_0xcd11('0x36')]=_[_0xcd11('0x37')](_0x59ce8c[_0xcd11('0x36')]);_0xe53d52[_0xcd11('0x38')]=_[_0xcd11('0x39')](_0xe53d52[_0xcd11('0x35')],_0xe53d52[_0xcd11('0x36')]);_0xd6ac3a['attributes']=_[_0xcd11('0x39')](_0xe53d52[_0xcd11('0x35')],qs[_0xcd11('0x3b')](_0x59ce8c[_0xcd11('0x36')]['fields']));_0xd6ac3a['attributes']=_0xd6ac3a['attributes'][_0xcd11('0x3c')]?_0xd6ac3a[_0xcd11('0x3a')]:_0xe53d52['model'];if(_0x59ce8c[_0xcd11('0x36')][_0xcd11('0x45')]){_0xd6ac3a[_0xcd11('0x46')]=[{'all':!![]}];}_0xd6ac3a=_['merge']({},_0xd6ac3a,_0x59ce8c[_0xcd11('0x44')]);return db[_0xcd11('0x30')][_0xcd11('0x4c')](_0xd6ac3a)[_0xcd11('0x27')](handleEntityNotFound(_0x853ef1,null))[_0xcd11('0x27')](respondWithResult(_0x853ef1,null))[_0xcd11('0x49')](handleError(_0x853ef1,null));};exports[_0xcd11('0x4d')]=function(_0x3607f4,_0x4c506f){return db[_0xcd11('0x30')][_0xcd11('0x4d')](_0x3607f4['body'],{})['then'](function(_0x3a37f0){var _0x70692d=_0x3607f4['user'][_0xcd11('0x29')]({'plain':!![]});if(!_0x70692d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x70692d[_0xcd11('0x4e')]===_0xcd11('0x4f')){var _0x5ad84f=_0x3a37f0[_0xcd11('0x29')]({'plain':!![]});var _0x4280c5=_0xcd11('0x50');return db[_0xcd11('0x51')][_0xcd11('0x4c')]({'where':{'name':_0x4280c5,'userProfileId':_0x70692d[_0xcd11('0x52')]},'raw':!![]})[_0xcd11('0x27')](function(_0x3c673d){if(_0x3c673d&&_0x3c673d['autoAssociation']===0x0){return db[_0xcd11('0x53')][_0xcd11('0x4d')]({'name':_0x5ad84f['name'],'resourceId':_0x5ad84f['id'],'type':_0x3c673d[_0xcd11('0x2c')],'sectionId':_0x3c673d['id']},{})[_0xcd11('0x27')](function(){return _0x3a37f0;});}else{return _0x3a37f0;}})['catch'](function(_0x309e4c){logger[_0xcd11('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x309e4c);throw _0x309e4c;});}return _0x3a37f0;})[_0xcd11('0x27')](respondWithResult(_0x4c506f,0xc9))['catch'](handleError(_0x4c506f,null));};exports['update']=function(_0x186da1,_0x37765b){if(_0x186da1[_0xcd11('0x54')]['id']){delete _0x186da1[_0xcd11('0x54')]['id'];}return db['SmsQueue'][_0xcd11('0x4c')]({'where':{'id':_0x186da1[_0xcd11('0x4b')]['id']}})[_0xcd11('0x27')](handleEntityNotFound(_0x37765b,null))[_0xcd11('0x27')](saveUpdates(_0x186da1['body'],null))['then'](respondWithResult(_0x37765b,null))[_0xcd11('0x49')](handleError(_0x37765b,null));};exports['destroy']=function(_0x120290,_0x1c2e7c){return db[_0xcd11('0x30')][_0xcd11('0x4c')]({'where':{'id':_0x120290[_0xcd11('0x4b')]['id']}})[_0xcd11('0x27')](handleEntityNotFound(_0x1c2e7c,null))[_0xcd11('0x27')](removeEntity(_0x1c2e7c,null))['catch'](handleError(_0x1c2e7c,null));};exports['describe']=function(_0x3aaf50,_0x1a9e4e){return db[_0xcd11('0x30')][_0xcd11('0x55')]()['then'](respondWithResult(_0x1a9e4e,null))[_0xcd11('0x49')](handleError(_0x1a9e4e,null));};exports['getMembers']=function(_0x3fbf9a,_0x167c25,_0x12b4a0){var _0x1f3b20={'raw':!![],'where':{}},_0x5ec37d={},_0x24d889;return db['SmsQueue'][_0xcd11('0x56')]({'where':{'id':_0x3fbf9a['params']['id']}})[_0xcd11('0x27')](handleEntityNotFound(_0x167c25,null))[_0xcd11('0x27')](function(_0x19d3b6){if(_0x19d3b6){_0x24d889=_0x19d3b6[_0xcd11('0x29')]({'plain':!![]});_0x5ec37d['model']=_[_0xcd11('0x37')](db[_0xcd11('0x57')]['rawAttributes']);_0x5ec37d[_0xcd11('0x36')]=_[_0xcd11('0x37')](_0x3fbf9a[_0xcd11('0x36')]);_0x5ec37d['filters']=_['intersection'](_0x5ec37d[_0xcd11('0x35')],_0x5ec37d['query']);_0x1f3b20[_0xcd11('0x3a')]=_[_0xcd11('0x39')](_0x5ec37d[_0xcd11('0x35')],qs['fields'](_0x3fbf9a[_0xcd11('0x36')][_0xcd11('0x3b')]));_0x1f3b20['attributes']=_0x1f3b20[_0xcd11('0x3a')][_0xcd11('0x3c')]?_0x1f3b20['attributes']:_0x5ec37d['model'];if(!_0x3fbf9a[_0xcd11('0x36')][_0xcd11('0x3d')](_0xcd11('0x3e'))){_0x1f3b20[_0xcd11('0x22')]=qs['limit'](_0x3fbf9a[_0xcd11('0x36')][_0xcd11('0x22')]);_0x1f3b20[_0xcd11('0x1f')]=qs[_0xcd11('0x1f')](_0x3fbf9a[_0xcd11('0x36')][_0xcd11('0x1f')]);}_0x1f3b20[_0xcd11('0x3f')]=qs[_0xcd11('0x40')](_0x3fbf9a['query'][_0xcd11('0x40')]);_0x1f3b20[_0xcd11('0x41')]=qs[_0xcd11('0x38')](_[_0xcd11('0x58')](_0x3fbf9a[_0xcd11('0x36')],_0x5ec37d[_0xcd11('0x38')]));_0x1f3b20[_0xcd11('0x41')][_0xcd11('0x59')]=_0x19d3b6['id'];if(_0x3fbf9a[_0xcd11('0x36')][_0xcd11('0x42')]){_0x1f3b20[_0xcd11('0x41')]=_[_0xcd11('0x43')](_0x1f3b20[_0xcd11('0x41')],{'$or':_['map'](_0x1f3b20[_0xcd11('0x3a')],function(_0x30c15c){var _0x4ed29e={};_0x4ed29e[_0x30c15c]={'$like':'%'+_0x3fbf9a[_0xcd11('0x36')][_0xcd11('0x42')]+'%'};return _0x4ed29e;})});}_0x1f3b20=_[_0xcd11('0x43')]({},_0x1f3b20,_0x3fbf9a['options']);return db[_0xcd11('0x57')][_0xcd11('0x47')](_0x1f3b20);}})[_0xcd11('0x27')](function(_0x1bc744){if(_0x1bc744){return db['User'][_0xcd11('0x5a')]({'where':{'id':_[_0xcd11('0x2f')](_0x1bc744,'UserId'),'role':'agent'},'attributes':['id',_0xcd11('0x2c'),_0xcd11('0x5b'),_0xcd11('0x5c'),'createdAt']});}})[_0xcd11('0x27')](function(_0x379fe2){if(_0x379fe2){return{'count':_0x379fe2[_0xcd11('0x21')],'rows':_[_0xcd11('0x2f')](_0x379fe2[_0xcd11('0x48')],function(_0x18abf5){return{'membername':_0x18abf5[_0xcd11('0x2c')],'UserId':_0x18abf5['id'],'queue_name':_0x24d889['name'],'SmsQueueId':_0x24d889['id'],'interface':util[_0xcd11('0x5d')](_0xcd11('0x5e'),'SIP',_0x18abf5[_0xcd11('0x2c')]),'penalty':0x0,'paused':_0x18abf5[_0xcd11('0x5b')],'createdAt':_0x18abf5['createdAt'],'updatedAt':_0x18abf5[_0xcd11('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcd11('0x27')](respondWithFilteredResult(_0x167c25,_0x1f3b20))[_0xcd11('0x49')](handleError(_0x167c25,null));};exports[_0xcd11('0x5f')]=function(_0x4d521a,_0x293485,_0x11ec9f){var _0x4ddc07={};var _0x10c248={};var _0x38e5bb;var _0x70f609;return db[_0xcd11('0x30')][_0xcd11('0x56')]({'where':{'id':_0x4d521a[_0xcd11('0x4b')]['id']}})[_0xcd11('0x27')](handleEntityNotFound(_0x293485,null))[_0xcd11('0x27')](function(_0x263466){if(_0x263466){_0x38e5bb=_0x263466;_0x10c248[_0xcd11('0x35')]=_['keys'](db[_0xcd11('0x60')][_0xcd11('0x31')]);_0x10c248[_0xcd11('0x36')]=_[_0xcd11('0x37')](_0x4d521a[_0xcd11('0x36')]);_0x10c248['filters']=_[_0xcd11('0x39')](_0x10c248[_0xcd11('0x35')],_0x10c248[_0xcd11('0x36')]);_0x4ddc07['attributes']=_[_0xcd11('0x39')](_0x10c248[_0xcd11('0x35')],qs[_0xcd11('0x3b')](_0x4d521a['query'][_0xcd11('0x3b')]));_0x4ddc07[_0xcd11('0x3a')]=_0x4ddc07[_0xcd11('0x3a')][_0xcd11('0x3c')]?_0x4ddc07[_0xcd11('0x3a')]:_0x10c248[_0xcd11('0x35')];_0x4ddc07[_0xcd11('0x3f')]=qs['sort'](_0x4d521a[_0xcd11('0x36')][_0xcd11('0x40')]);_0x4ddc07[_0xcd11('0x41')]=qs[_0xcd11('0x38')](_[_0xcd11('0x58')](_0x4d521a[_0xcd11('0x36')],_0x10c248[_0xcd11('0x38')]));if(_0x4d521a['query'][_0xcd11('0x42')]){_0x4ddc07[_0xcd11('0x41')]=_[_0xcd11('0x43')](_0x4ddc07[_0xcd11('0x41')],{'$or':_[_0xcd11('0x2f')](_0x4ddc07[_0xcd11('0x3a')],function(_0x1cd68b){var _0x18a72f={};_0x18a72f[_0x1cd68b]={'$like':'%'+_0x4d521a[_0xcd11('0x36')]['filter']+'%'};return _0x18a72f;})});}_0x4ddc07=_[_0xcd11('0x43')]({},_0x4ddc07,_0x4d521a[_0xcd11('0x44')]);return _0x38e5bb[_0xcd11('0x5f')](_0x4ddc07);}})[_0xcd11('0x27')](function(_0x133c35){if(_0x133c35){_0x70f609=_0x133c35[_0xcd11('0x3c')];if(!_0x4d521a['query'][_0xcd11('0x3d')](_0xcd11('0x3e'))){_0x4ddc07[_0xcd11('0x22')]=qs['limit'](_0x4d521a['query'][_0xcd11('0x22')]);_0x4ddc07[_0xcd11('0x1f')]=qs[_0xcd11('0x1f')](_0x4d521a[_0xcd11('0x36')][_0xcd11('0x1f')]);}return _0x38e5bb['getTeams'](_0x4ddc07);}})[_0xcd11('0x27')](function(_0x102b0c){if(_0x102b0c){return _0x102b0c?{'count':_0x70f609,'rows':_0x102b0c}:null;}})[_0xcd11('0x27')](respondWithResult(_0x293485,null))['catch'](handleError(_0x293485,null));};exports[_0xcd11('0x61')]=function(_0x272226,_0x5beaa8,_0x4250e9){var _0x505464=_0x272226[_0xcd11('0x54')]['ids'];return db[_0xcd11('0x60')][_0xcd11('0x47')]({'where':{'id':_0x505464},'attributes':['id'],'include':[{'model':db[_0xcd11('0x62')],'as':'Agents','attributes':['id','name',_0xcd11('0x63'),_0xcd11('0x64'),_0xcd11('0x65')],'raw':!![]}]})['then'](function(_0x1dff32){if(_0x1dff32){var _0x213d7f=_[_0xcd11('0x66')](_0x1dff32,function(_0x8f76bb){var _0x3554d1=_0x8f76bb['get']({'plain':!![]});return _0x3554d1['Agents'];});return db[_0xcd11('0x30')][_0xcd11('0x4c')]({'where':{'id':_0x272226[_0xcd11('0x4b')]['id']}})[_0xcd11('0x27')](function(_0x55b488){return db[_0xcd11('0x67')][_0xcd11('0x68')](function(_0x3f4e36){return _0x55b488['addTeams'](_0x505464,{'transaction':_0x3f4e36})[_0xcd11('0x27')](function(){return BPromise[_0xcd11('0x69')](_0x213d7f,function(_0x4ba7a2){return db[_0xcd11('0x57')][_0xcd11('0x6a')]({'where':{'UserId':_0x4ba7a2['id'],'SmsQueueId':_0x272226[_0xcd11('0x4b')]['id']},'transaction':_0x3f4e36});});})[_0xcd11('0x27')](function(){_0x213d7f[_0xcd11('0x6b')](function(_0x43aa0c){socket['emit'](_0xcd11('0x6c'),{'UserId':_0x43aa0c['id'],'SmsQueueId':_0x55b488['id']});});});});});}})[_0xcd11('0x27')](respondWithStatusCode(_0x5beaa8,null))['catch'](handleError(_0x5beaa8,null));};exports['removeTeams']=function(_0x3b981d,_0x1a7c30,_0x373d0e){return db[_0xcd11('0x60')][_0xcd11('0x47')]({'where':{'id':_0x3b981d['query'][_0xcd11('0x6d')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xcd11('0x27')](handleEntityNotFound(_0x1a7c30,null))[_0xcd11('0x27')](function(_0x38dbbd){var _0x2b139b=_['map'](_0x38dbbd,'id');var _0xaa904b=[];var _0x31865c=[];var _0x50c7b4=squel['select']();_0x50c7b4[_0xcd11('0x6e')](_0xcd11('0x6f'))[_0xcd11('0x70')](_0xcd11('0x71'),'tq')[_0xcd11('0x72')](_0xcd11('0x73'),'ut',_0xcd11('0x74'))[_0xcd11('0x41')]('SmsQueueId\x20=\x20?',_0x3b981d[_0xcd11('0x4b')]['id']);for(var _0x23c0f1=0x0;_0x23c0f1<_0x38dbbd[_0xcd11('0x3c')];_0x23c0f1+=0x1){let _0x34f2ba=_0x38dbbd[_0x23c0f1];for(var _0xeba205=0x0;_0xeba205<_0x34f2ba[_0xcd11('0x75')]['length'];_0xeba205+=0x1){let _0x1084f7=_0x34f2ba[_0xcd11('0x75')][_0xeba205];var _0x138535=_0x50c7b4['clone']();_0x138535['where'](_0xcd11('0x76'),_0x1084f7['id']);_0x31865c[_0xcd11('0x77')](db[_0xcd11('0x67')][_0xcd11('0x36')](_0x138535['toString'](),{'type':db[_0xcd11('0x67')][_0xcd11('0x78')][_0xcd11('0x79')]})['then'](function(_0x55bf4c){if(_0x55bf4c[_0xcd11('0x3c')]===0x1){return _0x1084f7['id'];}else{var _0x53d6f1=_[_0xcd11('0x7a')](_[_0xcd11('0x2f')](_0x55bf4c,_0xcd11('0x7b')),function(_0x24e142){return _['includes'](_0x2b139b,_0x24e142);});if(_0x53d6f1){return _0x1084f7['id'];}}}));}}return BPromise[_0xcd11('0x7c')](_0x31865c)[_0xcd11('0x27')](function(_0x5ebdea){_0xaa904b=_(_0xaa904b)[_0xcd11('0x7d')](_0x5ebdea)[_0xcd11('0x7e')]()[_0xcd11('0x7f')]();return db['SmsQueue'][_0xcd11('0x4c')]({'where':{'id':_0x3b981d['params']['id']}})[_0xcd11('0x27')](function(_0x3b9aed){return db[_0xcd11('0x67')][_0xcd11('0x68')](function(_0x4d1d59){return _0x3b9aed['removeTeams'](_0x3b981d[_0xcd11('0x36')][_0xcd11('0x6d')],{'transaction':_0x4d1d59})[_0xcd11('0x27')](function(){if(!_[_0xcd11('0x80')](_0xaa904b)){return _0x3b9aed[_0xcd11('0x81')](_0xaa904b,{'transaction':_0x4d1d59});}})[_0xcd11('0x27')](function(){_0xaa904b[_0xcd11('0x6b')](function(_0x3f32f2){socket['emit'](_0xcd11('0x82'),{'UserId':_0x3f32f2,'SmsQueueId':_0x3b9aed['id']});});});});});});})['then'](respondWithStatusCode(_0x1a7c30,null))['catch'](handleError(_0x1a7c30,null));};exports[_0xcd11('0x83')]=function(_0x154e5d,_0x5002b6,_0x372ac8){return db['SmsQueue'][_0xcd11('0x4c')]({'where':{'id':_0x154e5d[_0xcd11('0x4b')]['id']}})[_0xcd11('0x27')](handleEntityNotFound(_0x5002b6,null))[_0xcd11('0x27')](function(_0x19b074){if(_0x19b074){return _0x19b074[_0xcd11('0x83')](_0x154e5d[_0xcd11('0x54')][_0xcd11('0x6d')],_[_0xcd11('0x84')](_0x154e5d[_0xcd11('0x54')],[_0xcd11('0x6d'),'id'])||{})[_0xcd11('0x85')](function(_0x251215){for(var _0x10e85e=0x0;_0x10e85e<_0x154e5d[_0xcd11('0x54')][_0xcd11('0x6d')][_0xcd11('0x3c')];_0x10e85e+=0x1){socket[_0xcd11('0x86')](_0xcd11('0x6c'),{'UserId':Number(_0x154e5d[_0xcd11('0x54')][_0xcd11('0x6d')][_0x10e85e]),'SmsQueueId':Number(_0x154e5d[_0xcd11('0x4b')]['id'])});}return _0x251215;});}})[_0xcd11('0x27')](respondWithResult(_0x5002b6,null))[_0xcd11('0x49')](handleError(_0x5002b6,null));};exports[_0xcd11('0x81')]=function(_0x2ade4d,_0x1295cd,_0x29d625){return db[_0xcd11('0x30')]['find']({'where':{'id':_0x2ade4d[_0xcd11('0x4b')]['id']}})[_0xcd11('0x27')](handleEntityNotFound(_0x1295cd,null))[_0xcd11('0x27')](function(_0x559718){if(_0x559718){return _0x559718['removeAgents'](_0x2ade4d[_0xcd11('0x36')]['ids'])[_0xcd11('0x27')](function(){if(_[_0xcd11('0x87')](_0x2ade4d['query']['ids'])){for(var _0x4e0919=0x0;_0x4e0919<_0x2ade4d[_0xcd11('0x36')][_0xcd11('0x6d')]['length'];_0x4e0919+=0x1){socket[_0xcd11('0x86')]('userSmsQueue:remove',{'UserId':Number(_0x2ade4d[_0xcd11('0x36')]['ids'][_0x4e0919]),'SmsQueueId':Number(_0x2ade4d[_0xcd11('0x4b')]['id'])});}}else{socket[_0xcd11('0x86')](_0xcd11('0x82'),{'UserId':Number(_0x2ade4d[_0xcd11('0x36')]['ids']),'SmsQueueId':Number(_0x2ade4d[_0xcd11('0x4b')]['id'])});}});}})[_0xcd11('0x27')](respondWithStatusCode(_0x1295cd,null))[_0xcd11('0x49')](handleError(_0x1295cd,null));};exports['getAgents']=function(_0x23f788,_0x28f63f,_0x59451d){var _0x242981={};var _0x5b23c0={};var _0x4f41b5;var _0x3779eb;return db[_0xcd11('0x30')][_0xcd11('0x56')]({'where':{'id':_0x23f788[_0xcd11('0x4b')]['id']}})[_0xcd11('0x27')](handleEntityNotFound(_0x28f63f,null))[_0xcd11('0x27')](function(_0x5d6b2c){if(_0x5d6b2c){_0x4f41b5=_0x5d6b2c;_0x5b23c0[_0xcd11('0x35')]=_[_0xcd11('0x37')](db[_0xcd11('0x62')][_0xcd11('0x31')]);_0x5b23c0['query']=_[_0xcd11('0x37')](_0x23f788[_0xcd11('0x36')]);_0x5b23c0[_0xcd11('0x38')]=_['intersection'](_0x5b23c0[_0xcd11('0x35')],_0x5b23c0[_0xcd11('0x36')]);_0x242981['attributes']=_[_0xcd11('0x39')](_0x5b23c0['model'],qs[_0xcd11('0x3b')](_0x23f788['query'][_0xcd11('0x3b')]));_0x242981[_0xcd11('0x3a')]=_0x242981['attributes']['length']?_0x242981['attributes']:_0x5b23c0[_0xcd11('0x35')];_0x242981[_0xcd11('0x3f')]=qs[_0xcd11('0x40')](_0x23f788[_0xcd11('0x36')][_0xcd11('0x40')]);_0x242981[_0xcd11('0x41')]=qs[_0xcd11('0x38')](_[_0xcd11('0x58')](_0x23f788['query'],_0x5b23c0['filters']));if(_0x23f788[_0xcd11('0x36')][_0xcd11('0x42')]){_0x242981['where']=_[_0xcd11('0x43')](_0x242981[_0xcd11('0x41')],{'$or':_[_0xcd11('0x2f')](_0x242981[_0xcd11('0x3a')],function(_0x13afb2){var _0x1c279f={};_0x1c279f[_0x13afb2]={'$like':'%'+_0x23f788[_0xcd11('0x36')][_0xcd11('0x42')]+'%'};return _0x1c279f;})});}_0x242981=_[_0xcd11('0x43')]({},_0x242981,_0x23f788[_0xcd11('0x44')]);return _0x4f41b5['getAgents'](_0x242981);}})[_0xcd11('0x27')](function(_0x2c5f68){if(_0x2c5f68){_0x3779eb=_0x2c5f68['length'];if(!_0x23f788[_0xcd11('0x36')][_0xcd11('0x3d')]('nolimit')){_0x242981['limit']=qs[_0xcd11('0x22')](_0x23f788[_0xcd11('0x36')][_0xcd11('0x22')]);_0x242981[_0xcd11('0x1f')]=qs[_0xcd11('0x1f')](_0x23f788['query'][_0xcd11('0x1f')]);}return _0x4f41b5[_0xcd11('0x88')](_0x242981);}})[_0xcd11('0x27')](function(_0x5d96bb){if(_0x5d96bb){return _0x5d96bb?{'count':_0x3779eb,'rows':_0x5d96bb}:null;}})['then'](respondWithResult(_0x28f63f,null))[_0xcd11('0x49')](handleError(_0x28f63f,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index a88f97d..6b78899 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 _0x1635=['hasOwnProperty','hook','events','../../mysqldb','save','update','remove','emit'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0x1635,0xea));var _0x5163=function(_0x32b153,_0x41d2ec){_0x32b153=_0x32b153-0x0;var _0x118dbd=_0x1635[_0x32b153];return _0x118dbd;};'use strict';var EventEmitter=require(_0x5163('0x0'));var SmsQueue=require(_0x5163('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5163('0x2'),'afterUpdate':_0x5163('0x3'),'afterDestroy':_0x5163('0x4')};function emitEvent(_0x415367){return function(_0x5b9a8e,_0x18245c,_0x58f37a){SmsQueueEvents[_0x5163('0x5')](_0x415367+':'+_0x5b9a8e['id'],_0x5b9a8e);SmsQueueEvents['emit'](_0x415367,_0x5b9a8e);_0x58f37a(null);};}for(var e in events){if(events[_0x5163('0x6')](e)){var event=events[e];SmsQueue[_0x5163('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xaba1=['save','update','remove','emit','hasOwnProperty','exports','events','SmsQueue','setMaxListeners'];(function(_0x39e069,_0x397588){var _0x17b2e7=function(_0x2e951f){while(--_0x2e951f){_0x39e069['push'](_0x39e069['shift']());}};_0x17b2e7(++_0x397588);}(_0xaba1,0x192));var _0x1aba=function(_0x4ee3b0,_0x499ed4){_0x4ee3b0=_0x4ee3b0-0x0;var _0x5839b6=_0xaba1[_0x4ee3b0];return _0x5839b6;};'use strict';var EventEmitter=require(_0x1aba('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x1aba('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1aba('0x2')](0x0);var events={'afterCreate':_0x1aba('0x3'),'afterUpdate':_0x1aba('0x4'),'afterDestroy':_0x1aba('0x5')};function emitEvent(_0x2650ce){return function(_0x35718e,_0xebc087,_0x9ef63b){SmsQueueEvents[_0x1aba('0x6')](_0x2650ce+':'+_0x35718e['id'],_0x35718e);SmsQueueEvents[_0x1aba('0x6')](_0x2650ce,_0x35718e);_0x9ef63b(null);};}for(var e in events){if(events[_0x1aba('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x1aba('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 5c797f6..5116eb4 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 _0x8461=['bluebird','request-promise','path','../../config/environment','exports','define','sms_queues','lodash','util','../../config/logger','moment'];(function(_0x26742c,_0xe241ee){var _0x4d9df4=function(_0x5bf307){while(--_0x5bf307){_0x26742c['push'](_0x26742c['shift']());}};_0x4d9df4(++_0xe241ee);}(_0x8461,0x193));var _0x1846=function(_0x3d538a,_0x2dc2a6){_0x3d538a=_0x3d538a-0x0;var _0x4fae2a=_0x8461[_0x3d538a];return _0x4fae2a;};'use strict';var _=require(_0x1846('0x0'));var util=require(_0x1846('0x1'));var logger=require(_0x1846('0x2'))('api');var moment=require(_0x1846('0x3'));var BPromise=require(_0x1846('0x4'));var rp=require(_0x1846('0x5'));var fs=require('fs');var path=require(_0x1846('0x6'));var rimraf=require('rimraf');var config=require(_0x1846('0x7'));var attributes=require('./smsQueue.attributes');module[_0x1846('0x8')]=function(_0x131f0d,_0x1d858c){return _0x131f0d[_0x1846('0x9')]('SmsQueue',attributes,{'tableName':_0x1846('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9218=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','lodash','util'];(function(_0x300816,_0x2ac15c){var _0x20a7e4=function(_0x5522de){while(--_0x5522de){_0x300816['push'](_0x300816['shift']());}};_0x20a7e4(++_0x2ac15c);}(_0x9218,0x6a));var _0x8921=function(_0xc979f9,_0x34d85f){_0xc979f9=_0xc979f9-0x0;var _0x18da50=_0x9218[_0xc979f9];return _0x18da50;};'use strict';var _=require(_0x8921('0x0'));var util=require(_0x8921('0x1'));var logger=require(_0x8921('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8921('0x3'));var rp=require(_0x8921('0x4'));var fs=require('fs');var path=require(_0x8921('0x5'));var rimraf=require(_0x8921('0x6'));var config=require(_0x8921('0x7'));var attributes=require(_0x8921('0x8'));module[_0x8921('0x9')]=function(_0xeff42e,_0x45d1c2){return _0xeff42e[_0x8921('0xa')](_0x8921('0xb'),attributes,{'tableName':'sms_queues','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 7c400e9..8a9784b 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 _0x4b99=['defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','options','where','attributes','limit','map','include','model','then','ShowSmsQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4b99,0x96));var _0x94b9=function(_0x4c7297,_0x29260c){_0x4c7297=_0x4c7297-0x0;var _0x496d14=_0x4b99[_0x4c7297];return _0x496d14;};'use strict';var _=require(_0x94b9('0x0'));var util=require(_0x94b9('0x1'));var moment=require(_0x94b9('0x2'));var BPromise=require(_0x94b9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x94b9('0x4'));var db=require(_0x94b9('0x5'))['db'];var utils=require(_0x94b9('0x6'));var logger=require(_0x94b9('0x7'))(_0x94b9('0x8'));var config=require(_0x94b9('0x9'));var jayson=require(_0x94b9('0xa'));var client=jayson[_0x94b9('0xb')][_0x94b9('0xc')]({'port':0x232a});config[_0x94b9('0xd')]=_[_0x94b9('0xe')](config[_0x94b9('0xd')],{'host':_0x94b9('0xf'),'port':0x18eb});var socket=require(_0x94b9('0x10'))(new Redis(config[_0x94b9('0xd')]));require(_0x94b9('0x11'))[_0x94b9('0x12')](socket);function respondWithRpcPromise(_0x137308,_0x4101b7,_0x2f0dfd){return new BPromise(function(_0x20499c,_0x270d36){return client[_0x94b9('0x13')](_0x137308,_0x2f0dfd)['then'](function(_0x3da901){logger[_0x94b9('0x14')](_0x94b9('0x15'),_0x4101b7,_0x94b9('0x16'));logger[_0x94b9('0x17')](_0x94b9('0x18'),_0x4101b7,_0x94b9('0x16'),JSON[_0x94b9('0x19')](_0x3da901));if(_0x3da901['error']){if(_0x3da901[_0x94b9('0x1a')][_0x94b9('0x1b')]===0x1f4){logger[_0x94b9('0x1a')](_0x94b9('0x15'),_0x4101b7,_0x3da901[_0x94b9('0x1a')][_0x94b9('0x1c')]);return _0x270d36(_0x3da901[_0x94b9('0x1a')][_0x94b9('0x1c')]);}logger[_0x94b9('0x1a')](_0x94b9('0x15'),_0x4101b7,_0x3da901['error'][_0x94b9('0x1c')]);return _0x20499c(_0x3da901[_0x94b9('0x1a')]['message']);}else{logger[_0x94b9('0x14')](_0x94b9('0x15'),_0x4101b7,'request\x20sent');_0x20499c(_0x3da901[_0x94b9('0x1d')][_0x94b9('0x1c')]);}})[_0x94b9('0x1e')](function(_0x5f19c6){logger[_0x94b9('0x1a')]('SmsQueue,\x20%s,\x20%s',_0x4101b7,_0x5f19c6);_0x270d36(_0x5f19c6);});});}exports[_0x94b9('0x1f')]=function(_0xa985cd){var _0xcc4dc8=this;return new Promise(function(_0x5b8d95,_0x41041e){return db['SmsQueue']['findAll']({'raw':_0xa985cd[_0x94b9('0x20')]?_0xa985cd[_0x94b9('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0xa985cd['options']?_0xa985cd['options'][_0x94b9('0x21')]||null:null,'attributes':_0xa985cd[_0x94b9('0x20')]?_0xa985cd[_0x94b9('0x20')][_0x94b9('0x22')]||null:null,'limit':_0xa985cd[_0x94b9('0x20')]?_0xa985cd[_0x94b9('0x20')][_0x94b9('0x23')]||null:null,'include':_0xa985cd[_0x94b9('0x20')]?_0xa985cd[_0x94b9('0x20')]['include']?_[_0x94b9('0x24')](_0xa985cd[_0x94b9('0x20')][_0x94b9('0x25')],function(_0x54d5a0){return{'model':db[_0x54d5a0[_0x94b9('0x26')]],'as':_0x54d5a0['as'],'attributes':_0x54d5a0[_0x94b9('0x22')],'include':_0x54d5a0[_0x94b9('0x25')]?_[_0x94b9('0x24')](_0x54d5a0['include'],function(_0x5926f7){return{'model':db[_0x5926f7['model']],'as':_0x5926f7['as'],'attributes':_0x5926f7['attributes'],'include':_0x5926f7[_0x94b9('0x25')]?_[_0x94b9('0x24')](_0x5926f7[_0x94b9('0x25')],function(_0x184192){return{'model':db[_0x184192[_0x94b9('0x26')]],'as':_0x184192['as'],'attributes':_0x184192[_0x94b9('0x22')]};}):[]};}):[]};}):[]:[]})[_0x94b9('0x27')](function(_0x4a738e){logger['info'](_0x94b9('0x1f'),_0xa985cd);logger['debug']('GetSmsQueue',_0xa985cd,JSON[_0x94b9('0x19')](_0x4a738e));_0x5b8d95(_0x4a738e);})[_0x94b9('0x1e')](function(_0x59532d){logger[_0x94b9('0x1a')]('GetSmsQueue',_0x59532d[_0x94b9('0x1c')],_0xa985cd);_0x41041e(_0xcc4dc8['error'](0x1f4,_0x59532d[_0x94b9('0x1c')]));});});};exports['ShowSmsQueue']=function(_0x507bab){var _0x352e0d=this;return new Promise(function(_0x1365bf,_0x59598d){return db['SmsQueue']['find']({'raw':_0x507bab[_0x94b9('0x20')]?_0x507bab[_0x94b9('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x507bab[_0x94b9('0x20')]?_0x507bab[_0x94b9('0x20')][_0x94b9('0x21')]||null:null,'attributes':_0x507bab[_0x94b9('0x20')]?_0x507bab[_0x94b9('0x20')][_0x94b9('0x22')]||null:null,'include':_0x507bab[_0x94b9('0x20')]?_0x507bab[_0x94b9('0x20')][_0x94b9('0x25')]?_[_0x94b9('0x24')](_0x507bab['options'][_0x94b9('0x25')],function(_0x1133b6){return{'model':db[_0x1133b6[_0x94b9('0x26')]],'as':_0x1133b6['as'],'attributes':_0x1133b6[_0x94b9('0x22')],'include':_0x1133b6['include']?_[_0x94b9('0x24')](_0x1133b6[_0x94b9('0x25')],function(_0x90c1ed){return{'model':db[_0x90c1ed[_0x94b9('0x26')]],'as':_0x90c1ed['as'],'attributes':_0x90c1ed[_0x94b9('0x22')],'include':_0x90c1ed[_0x94b9('0x25')]?_[_0x94b9('0x24')](_0x90c1ed[_0x94b9('0x25')],function(_0x29e7bd){return{'model':db[_0x29e7bd[_0x94b9('0x26')]],'as':_0x29e7bd['as'],'attributes':_0x29e7bd[_0x94b9('0x22')]};}):[]};}):[]};}):[]:[]})[_0x94b9('0x27')](function(_0x2e3d21){logger[_0x94b9('0x14')]('ShowSmsQueue',_0x507bab);logger[_0x94b9('0x17')](_0x94b9('0x28'),_0x507bab,JSON[_0x94b9('0x19')](_0x2e3d21));_0x1365bf(_0x2e3d21);})[_0x94b9('0x1e')](function(_0x16042e){logger['error']('ShowSmsQueue',_0x16042e[_0x94b9('0x1c')],_0x507bab);_0x59598d(_0x352e0d['error'](0x1f4,_0x16042e[_0x94b9('0x1c')]));});});}; \ No newline at end of file +var _0xfa50=['debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsQueue','findAll','options','raw','where','limit','include','map','model','attributes','GetSmsQueue','ShowSmsQueue','find','lodash','util','moment','bluebird','../../config/utils','rpc','jayson/promise','redis','defaults','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x2f78bd,_0x3c4b24){var _0x48383e=function(_0x293c8d){while(--_0x293c8d){_0x2f78bd['push'](_0x2f78bd['shift']());}};_0x48383e(++_0x3c4b24);}(_0xfa50,0x84));var _0x0fa5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa50[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0fa5('0x0'));var util=require(_0x0fa5('0x1'));var moment=require(_0x0fa5('0x2'));var BPromise=require(_0x0fa5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0fa5('0x4'));var logger=require('../../config/logger')(_0x0fa5('0x5'));var config=require('../../config/environment');var jayson=require(_0x0fa5('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x0fa5('0x7')]=_[_0x0fa5('0x8')](config[_0x0fa5('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fa5('0x9'))(new Redis(config[_0x0fa5('0x7')]));require('./smsQueue.socket')[_0x0fa5('0xa')](socket);function respondWithRpcPromise(_0x371be2,_0x3b44c0,_0xb75782){return new BPromise(function(_0x38680e,_0x437ec8){return client[_0x0fa5('0xb')](_0x371be2,_0xb75782)[_0x0fa5('0xc')](function(_0x35dba5){logger[_0x0fa5('0xd')](_0x0fa5('0xe'),_0x3b44c0,_0x0fa5('0xf'));logger[_0x0fa5('0x10')](_0x0fa5('0x11'),_0x3b44c0,'request\x20sent',JSON[_0x0fa5('0x12')](_0x35dba5));if(_0x35dba5[_0x0fa5('0x13')]){if(_0x35dba5[_0x0fa5('0x13')][_0x0fa5('0x14')]===0x1f4){logger[_0x0fa5('0x13')]('SmsQueue,\x20%s,\x20%s',_0x3b44c0,_0x35dba5[_0x0fa5('0x13')][_0x0fa5('0x15')]);return _0x437ec8(_0x35dba5['error'][_0x0fa5('0x15')]);}logger['error'](_0x0fa5('0xe'),_0x3b44c0,_0x35dba5[_0x0fa5('0x13')][_0x0fa5('0x15')]);return _0x38680e(_0x35dba5[_0x0fa5('0x13')][_0x0fa5('0x15')]);}else{logger[_0x0fa5('0xd')](_0x0fa5('0xe'),_0x3b44c0,_0x0fa5('0xf'));_0x38680e(_0x35dba5[_0x0fa5('0x16')][_0x0fa5('0x15')]);}})[_0x0fa5('0x17')](function(_0x2be1e5){logger[_0x0fa5('0x13')](_0x0fa5('0xe'),_0x3b44c0,_0x2be1e5);_0x437ec8(_0x2be1e5);});});}exports['GetSmsQueue']=function(_0x28b7f3){var _0x2c83a0=this;return new Promise(function(_0x5c8c2f,_0x10fb18){return db[_0x0fa5('0x18')][_0x0fa5('0x19')]({'raw':_0x28b7f3[_0x0fa5('0x1a')]?_0x28b7f3[_0x0fa5('0x1a')][_0x0fa5('0x1b')]===undefined?!![]:![]:!![],'where':_0x28b7f3[_0x0fa5('0x1a')]?_0x28b7f3[_0x0fa5('0x1a')][_0x0fa5('0x1c')]||null:null,'attributes':_0x28b7f3[_0x0fa5('0x1a')]?_0x28b7f3[_0x0fa5('0x1a')]['attributes']||null:null,'limit':_0x28b7f3[_0x0fa5('0x1a')]?_0x28b7f3[_0x0fa5('0x1a')][_0x0fa5('0x1d')]||null:null,'include':_0x28b7f3['options']?_0x28b7f3[_0x0fa5('0x1a')][_0x0fa5('0x1e')]?_[_0x0fa5('0x1f')](_0x28b7f3[_0x0fa5('0x1a')]['include'],function(_0x28188c){return{'model':db[_0x28188c[_0x0fa5('0x20')]],'as':_0x28188c['as'],'attributes':_0x28188c[_0x0fa5('0x21')],'include':_0x28188c[_0x0fa5('0x1e')]?_['map'](_0x28188c[_0x0fa5('0x1e')],function(_0x25ac10){return{'model':db[_0x25ac10[_0x0fa5('0x20')]],'as':_0x25ac10['as'],'attributes':_0x25ac10['attributes'],'include':_0x25ac10[_0x0fa5('0x1e')]?_[_0x0fa5('0x1f')](_0x25ac10[_0x0fa5('0x1e')],function(_0x4d2a90){return{'model':db[_0x4d2a90['model']],'as':_0x4d2a90['as'],'attributes':_0x4d2a90[_0x0fa5('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0fa5('0xc')](function(_0x2496ac){logger[_0x0fa5('0xd')]('GetSmsQueue',_0x28b7f3);logger[_0x0fa5('0x10')]('GetSmsQueue',_0x28b7f3,JSON['stringify'](_0x2496ac));_0x5c8c2f(_0x2496ac);})[_0x0fa5('0x17')](function(_0x358031){logger['error'](_0x0fa5('0x22'),_0x358031[_0x0fa5('0x15')],_0x28b7f3);_0x10fb18(_0x2c83a0['error'](0x1f4,_0x358031[_0x0fa5('0x15')]));});});};exports[_0x0fa5('0x23')]=function(_0x404b2c){var _0xd9950e=this;return new Promise(function(_0x2304e6,_0x5b715f){return db[_0x0fa5('0x18')][_0x0fa5('0x24')]({'raw':_0x404b2c['options']?_0x404b2c[_0x0fa5('0x1a')][_0x0fa5('0x1b')]===undefined?!![]:![]:!![],'where':_0x404b2c['options']?_0x404b2c[_0x0fa5('0x1a')][_0x0fa5('0x1c')]||null:null,'attributes':_0x404b2c[_0x0fa5('0x1a')]?_0x404b2c[_0x0fa5('0x1a')]['attributes']||null:null,'include':_0x404b2c[_0x0fa5('0x1a')]?_0x404b2c[_0x0fa5('0x1a')][_0x0fa5('0x1e')]?_[_0x0fa5('0x1f')](_0x404b2c[_0x0fa5('0x1a')][_0x0fa5('0x1e')],function(_0x2d4cff){return{'model':db[_0x2d4cff['model']],'as':_0x2d4cff['as'],'attributes':_0x2d4cff['attributes'],'include':_0x2d4cff['include']?_['map'](_0x2d4cff[_0x0fa5('0x1e')],function(_0xe4d66){return{'model':db[_0xe4d66[_0x0fa5('0x20')]],'as':_0xe4d66['as'],'attributes':_0xe4d66[_0x0fa5('0x21')],'include':_0xe4d66['include']?_[_0x0fa5('0x1f')](_0xe4d66[_0x0fa5('0x1e')],function(_0x264b3b){return{'model':db[_0x264b3b[_0x0fa5('0x20')]],'as':_0x264b3b['as'],'attributes':_0x264b3b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x15af5a){logger[_0x0fa5('0xd')](_0x0fa5('0x23'),_0x404b2c);logger['debug'](_0x0fa5('0x23'),_0x404b2c,JSON[_0x0fa5('0x12')](_0x15af5a));_0x2304e6(_0x15af5a);})[_0x0fa5('0x17')](function(_0x4da0b9){logger[_0x0fa5('0x13')](_0x0fa5('0x23'),_0x4da0b9[_0x0fa5('0x15')],_0x404b2c);_0x5b715f(_0xd9950e[_0x0fa5('0x13')](0x1f4,_0x4da0b9[_0x0fa5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 7eadabd..ef394d1 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 _0x47e8=['update','emit','removeListener','register','length','smsQueue:','save','remove'];(function(_0xfe5403,_0x1628b1){var _0x2d1e48=function(_0x71342){while(--_0x71342){_0xfe5403['push'](_0xfe5403['shift']());}};_0x2d1e48(++_0x1628b1);}(_0x47e8,0x76));var _0x847e=function(_0x4dfa20,_0x35afb5){_0x4dfa20=_0x4dfa20-0x0;var _0x146afc=_0x47e8[_0x4dfa20];return _0x146afc;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x847e('0x0'),_0x847e('0x1'),_0x847e('0x2')];function createListener(_0x52d32d,_0x77dff0){return function(_0x2757b6){_0x77dff0[_0x847e('0x3')](_0x52d32d,_0x2757b6);};}function removeListener(_0x1f084f,_0x2a5dca){return function(){SmsQueueEvents[_0x847e('0x4')](_0x1f084f,_0x2a5dca);};}exports[_0x847e('0x5')]=function(_0x196861){for(var _0x583044=0x0,_0x35ec6e=events[_0x847e('0x6')];_0x583044<_0x35ec6e;_0x583044++){var _0x1c0189=events[_0x583044];var _0x138b6f=createListener(_0x847e('0x7')+_0x1c0189,_0x196861);SmsQueueEvents['on'](_0x1c0189,_0x138b6f);}}; \ No newline at end of file +var _0xc684=['register','length','smsQueue:','./smsQueue.events','save','update','emit'];(function(_0xd9418f,_0xf52b3a){var _0x5f4b79=function(_0x1a93b1){while(--_0x1a93b1){_0xd9418f['push'](_0xd9418f['shift']());}};_0x5f4b79(++_0xf52b3a);}(_0xc684,0x96));var _0x4c68=function(_0x510ed7,_0x133634){_0x510ed7=_0x510ed7-0x0;var _0x63c5b4=_0xc684[_0x510ed7];return _0x63c5b4;};'use strict';var SmsQueueEvents=require(_0x4c68('0x0'));var events=[_0x4c68('0x1'),'remove',_0x4c68('0x2')];function createListener(_0x3b4891,_0x4c11a9){return function(_0x4ea34e){_0x4c11a9[_0x4c68('0x3')](_0x3b4891,_0x4ea34e);};}function removeListener(_0x41c3f2,_0xcdb19){return function(){SmsQueueEvents['removeListener'](_0x41c3f2,_0xcdb19);};}exports[_0x4c68('0x4')]=function(_0xc18c92){for(var _0x3e9a80=0x0,_0xdb775a=events[_0x4c68('0x5')];_0x3e9a80<_0xdb775a;_0x3e9a80++){var _0x1571aa=events[_0x3e9a80];var _0xc47fa9=createListener(_0x4c68('0x6')+_0x1571aa,_0xc18c92);SmsQueueEvents['on'](_0x1571aa,_0xc47fa9);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 3fb3b72..95e50b5 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 _0x99e0=['/describe','describe','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x99e0,0xd0));var _0x099e=function(_0x1ed68f,_0x7e2383){_0x1ed68f=_0x1ed68f-0x0;var _0x195c18=_0x99e0[_0x1ed68f];return _0x195c18;};'use strict';var multer=require(_0x099e('0x0'));var util=require(_0x099e('0x1'));var path=require(_0x099e('0x2'));var timeout=require(_0x099e('0x3'));var express=require(_0x099e('0x4'));var router=express['Router']();var fs_extra=require(_0x099e('0x5'));var auth=require(_0x099e('0x6'));var interaction=require(_0x099e('0x7'));var config=require(_0x099e('0x8'));var controller=require(_0x099e('0x9'));router[_0x099e('0xa')]('/',auth['isAuthenticated'](),controller[_0x099e('0xb')]);router[_0x099e('0xa')](_0x099e('0xc'),auth['isAuthenticated'](),controller[_0x099e('0xd')]);router[_0x099e('0xa')](_0x099e('0xe'),auth[_0x099e('0xf')](),controller['show']);router['post']('/',auth[_0x099e('0xf')](),controller[_0x099e('0x10')]);router[_0x099e('0x11')](_0x099e('0xe'),auth[_0x099e('0xf')](),controller[_0x099e('0x12')]);router[_0x099e('0x13')](_0x099e('0xe'),auth['isAuthenticated'](),controller[_0x099e('0x14')]);module[_0x099e('0x15')]=router; \ No newline at end of file +var _0x9677=['../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x83139e,_0x1060f9){var _0x7e5730=function(_0xcf8019){while(--_0xcf8019){_0x83139e['push'](_0x83139e['shift']());}};_0x7e5730(++_0x1060f9);}(_0x9677,0xc2));var _0x7967=function(_0x3a8b9b,_0x4b1728){_0x3a8b9b=_0x3a8b9b-0x0;var _0x1a3bba=_0x9677[_0x3a8b9b];return _0x1a3bba;};'use strict';var multer=require(_0x7967('0x0'));var util=require(_0x7967('0x1'));var path=require(_0x7967('0x2'));var timeout=require(_0x7967('0x3'));var express=require('express');var router=express[_0x7967('0x4')]();var fs_extra=require(_0x7967('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7967('0x6'));var controller=require('./smsQueueReport.controller');router[_0x7967('0x7')]('/',auth[_0x7967('0x8')](),controller[_0x7967('0x9')]);router[_0x7967('0x7')]('/describe',auth[_0x7967('0x8')](),controller[_0x7967('0xa')]);router[_0x7967('0x7')](_0x7967('0xb'),auth[_0x7967('0x8')](),controller[_0x7967('0xc')]);router[_0x7967('0xd')]('/',auth[_0x7967('0x8')](),controller[_0x7967('0xe')]);router[_0x7967('0xf')](_0x7967('0xb'),auth['isAuthenticated'](),controller[_0x7967('0x10')]);router[_0x7967('0x11')](_0x7967('0xb'),auth[_0x7967('0x8')](),controller[_0x7967('0x12')]);module[_0x7967('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index bf5025c..96b7c6e 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 _0xd814=['DATE','sequelize','STRING'];(function(_0x13c47b,_0x5b5505){var _0x485110=function(_0x20886e){while(--_0x20886e){_0x13c47b['push'](_0x13c47b['shift']());}};_0x485110(++_0x5b5505);}(_0xd814,0x187));var _0x4d81=function(_0x5ed0e5,_0x3c77da){_0x5ed0e5=_0x5ed0e5-0x0;var _0x603b7d=_0xd814[_0x5ed0e5];return _0x603b7d;};'use strict';var moment=require('moment');var Sequelize=require(_0x4d81('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4d81('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x4d81('0x1')]},'joinAt':{'type':Sequelize[_0x4d81('0x2')]},'leaveAt':{'type':Sequelize[_0x4d81('0x2')]},'acceptAt':{'type':Sequelize[_0x4d81('0x2')]},'exitAt':{'type':Sequelize[_0x4d81('0x2')]},'reason':{'type':Sequelize[_0x4d81('0x1')]}}; \ No newline at end of file +var _0xcad5=['moment','sequelize','exports','STRING','DATE'];(function(_0x1399d6,_0x2c1661){var _0x4a9db4=function(_0x4666b8){while(--_0x4666b8){_0x1399d6['push'](_0x1399d6['shift']());}};_0x4a9db4(++_0x2c1661);}(_0xcad5,0x1ae));var _0x5cad=function(_0x147e3e,_0x5d008d){_0x147e3e=_0x147e3e-0x0;var _0x201f52=_0xcad5[_0x147e3e];return _0x201f52;};'use strict';var moment=require(_0x5cad('0x0'));var Sequelize=require(_0x5cad('0x1'));module[_0x5cad('0x2')]={'uniqueid':{'type':Sequelize[_0x5cad('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5cad('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5cad('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5cad('0x4')]},'reason':{'type':Sequelize[_0x5cad('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index fc18f83..f7412c2 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 _0x5b2d=['../../config/environment','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','map','SmsQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x424357,_0x9ebe3e){var _0x29c68e=function(_0x663b5d){while(--_0x663b5d){_0x424357['push'](_0x424357['shift']());}};_0x29c68e(++_0x9ebe3e);}(_0x5b2d,0x185));var _0xd5b2=function(_0x5a6702,_0x37df17){_0x5a6702=_0x5a6702-0x0;var _0x131772=_0x5b2d[_0x5a6702];return _0x131772;};'use strict';var emlformat=require(_0xd5b2('0x0'));var rimraf=require(_0xd5b2('0x1'));var zipdir=require(_0xd5b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd5b2('0x3'));var moment=require(_0xd5b2('0x4'));var BPromise=require(_0xd5b2('0x5'));var Mustache=require(_0xd5b2('0x6'));var util=require(_0xd5b2('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd5b2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5b2('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd5b2('0xa'));var toCsv=require(_0xd5b2('0x8'));var querystring=require(_0xd5b2('0xb'));var Papa=require('papaparse');var Redis=require(_0xd5b2('0xc'));var authService=require(_0xd5b2('0xd'));var qs=require(_0xd5b2('0xe'));var as=require(_0xd5b2('0xf'));var hardwareService=require(_0xd5b2('0x10'));var logger=require(_0xd5b2('0x11'))('api');var utils=require(_0xd5b2('0x12'));var config=require(_0xd5b2('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12a23b,_0x284212){_0x284212=_0x284212||0xcc;return function(_0x4c6cc9){if(_0x4c6cc9){return _0x12a23b['sendStatus'](_0x284212);}return _0x12a23b[_0xd5b2('0x14')](_0x284212)[_0xd5b2('0x15')]();};}function respondWithResult(_0x5d6edc,_0x31febd){_0x31febd=_0x31febd||0xc8;return function(_0x5801fb){if(_0x5801fb){return _0x5d6edc[_0xd5b2('0x14')](_0x31febd)[_0xd5b2('0x16')](_0x5801fb);}};}function respondWithFilteredResult(_0x4d1197,_0x34d02d){return function(_0x3334a5){if(_0x3334a5){var _0xaa8852=typeof _0x34d02d[_0xd5b2('0x17')]===_0xd5b2('0x18')&&typeof _0x34d02d[_0xd5b2('0x19')]===_0xd5b2('0x18');var _0x1535d4=_0x3334a5[_0xd5b2('0x1a')];var _0x2aeb15=_0xaa8852?0x0:_0x34d02d['offset'];var _0x292643=_0xaa8852?_0x3334a5[_0xd5b2('0x1a')]:_0x34d02d[_0xd5b2('0x17')]+_0x34d02d[_0xd5b2('0x19')];var _0x4d2380;if(_0x292643>=_0x1535d4){_0x292643=_0x1535d4;_0x4d2380=0xc8;}else{_0x4d2380=0xce;}_0x4d1197[_0xd5b2('0x14')](_0x4d2380);return _0x4d1197['set'](_0xd5b2('0x1b'),_0x2aeb15+'-'+_0x292643+'/'+_0x1535d4)[_0xd5b2('0x16')](_0x3334a5);}return null;};}function patchUpdates(_0x59198c){return function(_0x2242e3){try{jsonpatch['apply'](_0x2242e3,_0x59198c,!![]);}catch(_0x2fa404){return BPromise[_0xd5b2('0x1c')](_0x2fa404);}return _0x2242e3['save']();};}function saveUpdates(_0x56ec7a,_0x3c066d){return function(_0x585901){if(_0x585901){return _0x585901[_0xd5b2('0x1d')](_0x56ec7a)[_0xd5b2('0x1e')](function(_0x3e2f8e){return _0x3e2f8e;});}return null;};}function removeEntity(_0xbf0e17,_0x51be2b){return function(_0x40f7a8){if(_0x40f7a8){return _0x40f7a8[_0xd5b2('0x1f')]()[_0xd5b2('0x1e')](function(){_0xbf0e17[_0xd5b2('0x14')](0xcc)[_0xd5b2('0x15')]();});}};}function handleEntityNotFound(_0x3ddfed,_0x61cf3c){return function(_0x1096ae){if(!_0x1096ae){_0x3ddfed[_0xd5b2('0x20')](0x194);}return _0x1096ae;};}function handleError(_0x3f3ef1,_0x1af4cd){_0x1af4cd=_0x1af4cd||0x1f4;return function(_0x570347){logger[_0xd5b2('0x21')](_0x570347[_0xd5b2('0x22')]);if(_0x570347['name']){delete _0x570347[_0xd5b2('0x23')];}_0x3f3ef1[_0xd5b2('0x14')](_0x1af4cd)[_0xd5b2('0x24')](_0x570347);};}exports['index']=function(_0x3b26bc,_0x3558f5){var _0x39a43c={},_0x5c52c2={},_0x30e731={'count':0x0,'rows':[]};var _0x2acc64=_[_0xd5b2('0x25')](db[_0xd5b2('0x26')][_0xd5b2('0x27')],function(_0x46cc80){return{'name':_0x46cc80[_0xd5b2('0x28')],'type':_0x46cc80[_0xd5b2('0x29')]['key']};});_0x5c52c2[_0xd5b2('0x2a')]=_[_0xd5b2('0x25')](_0x2acc64,_0xd5b2('0x23'));_0x5c52c2[_0xd5b2('0x2b')]=_[_0xd5b2('0x2c')](_0x3b26bc[_0xd5b2('0x2b')]);_0x5c52c2[_0xd5b2('0x2d')]=_[_0xd5b2('0x2e')](_0x5c52c2[_0xd5b2('0x2a')],_0x5c52c2[_0xd5b2('0x2b')]);_0x39a43c['attributes']=_['intersection'](_0x5c52c2['model'],qs[_0xd5b2('0x2f')](_0x3b26bc[_0xd5b2('0x2b')][_0xd5b2('0x2f')]));_0x39a43c['attributes']=_0x39a43c[_0xd5b2('0x30')][_0xd5b2('0x31')]?_0x39a43c[_0xd5b2('0x30')]:_0x5c52c2[_0xd5b2('0x2a')];if(!_0x3b26bc[_0xd5b2('0x2b')][_0xd5b2('0x32')]('nolimit')){_0x39a43c[_0xd5b2('0x19')]=qs[_0xd5b2('0x19')](_0x3b26bc['query'][_0xd5b2('0x19')]);_0x39a43c['offset']=qs[_0xd5b2('0x17')](_0x3b26bc[_0xd5b2('0x2b')][_0xd5b2('0x17')]);}_0x39a43c[_0xd5b2('0x33')]=qs[_0xd5b2('0x34')](_0x3b26bc['query'][_0xd5b2('0x34')]);_0x39a43c[_0xd5b2('0x35')]=qs[_0xd5b2('0x2d')](_[_0xd5b2('0x36')](_0x3b26bc['query'],_0x5c52c2['filters']),_0x2acc64);if(_0x3b26bc[_0xd5b2('0x2b')]['filter']){_0x39a43c[_0xd5b2('0x35')]=_['merge'](_0x39a43c['where'],{'$or':_['map'](_0x2acc64,function(_0x188667){if(_0x188667['type']!==_0xd5b2('0x37')){var _0xfe3043={};_0xfe3043[_0x188667['name']]={'$like':'%'+_0x3b26bc[_0xd5b2('0x2b')]['filter']+'%'};return _0xfe3043;}})});}_0x39a43c=_[_0xd5b2('0x38')]({},_0x39a43c,_0x3b26bc[_0xd5b2('0x39')]);var _0x299266={'where':_0x39a43c[_0xd5b2('0x35')]};return db[_0xd5b2('0x26')][_0xd5b2('0x1a')](_0x299266)[_0xd5b2('0x1e')](function(_0x3529ac){_0x30e731[_0xd5b2('0x1a')]=_0x3529ac;if(_0x3b26bc[_0xd5b2('0x2b')][_0xd5b2('0x3a')]){_0x39a43c[_0xd5b2('0x3b')]=[{'all':!![]}];}return db[_0xd5b2('0x26')]['findAll'](_0x39a43c);})[_0xd5b2('0x1e')](function(_0x118b85){_0x30e731[_0xd5b2('0x3c')]=_0x118b85;return _0x30e731;})[_0xd5b2('0x1e')](respondWithFilteredResult(_0x3558f5,_0x39a43c))['catch'](handleError(_0x3558f5,null));};exports[_0xd5b2('0x3d')]=function(_0x4b1ae8,_0x3f60c4){var _0x57dc5b={'raw':!![],'where':{'id':_0x4b1ae8[_0xd5b2('0x3e')]['id']}},_0x10e251={};_0x10e251['model']=_[_0xd5b2('0x2c')](db[_0xd5b2('0x26')][_0xd5b2('0x27')]);_0x10e251[_0xd5b2('0x2b')]=_[_0xd5b2('0x2c')](_0x4b1ae8[_0xd5b2('0x2b')]);_0x10e251[_0xd5b2('0x2d')]=_[_0xd5b2('0x2e')](_0x10e251[_0xd5b2('0x2a')],_0x10e251[_0xd5b2('0x2b')]);_0x57dc5b[_0xd5b2('0x30')]=_[_0xd5b2('0x2e')](_0x10e251[_0xd5b2('0x2a')],qs[_0xd5b2('0x2f')](_0x4b1ae8[_0xd5b2('0x2b')]['fields']));_0x57dc5b[_0xd5b2('0x30')]=_0x57dc5b['attributes'][_0xd5b2('0x31')]?_0x57dc5b['attributes']:_0x10e251[_0xd5b2('0x2a')];if(_0x4b1ae8[_0xd5b2('0x2b')]['includeAll']){_0x57dc5b[_0xd5b2('0x3b')]=[{'all':!![]}];}_0x57dc5b=_[_0xd5b2('0x38')]({},_0x57dc5b,_0x4b1ae8[_0xd5b2('0x39')]);return db[_0xd5b2('0x26')][_0xd5b2('0x3f')](_0x57dc5b)[_0xd5b2('0x1e')](handleEntityNotFound(_0x3f60c4,null))[_0xd5b2('0x1e')](respondWithResult(_0x3f60c4,null))[_0xd5b2('0x40')](handleError(_0x3f60c4,null));};exports[_0xd5b2('0x41')]=function(_0x15a3ce,_0x290793){return db[_0xd5b2('0x26')][_0xd5b2('0x41')](_0x15a3ce[_0xd5b2('0x42')],{})[_0xd5b2('0x1e')](respondWithResult(_0x290793,0xc9))[_0xd5b2('0x40')](handleError(_0x290793,null));};exports['update']=function(_0x23b8d8,_0x456983){if(_0x23b8d8['body']['id']){delete _0x23b8d8['body']['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x23b8d8[_0xd5b2('0x3e')]['id']}})[_0xd5b2('0x1e')](handleEntityNotFound(_0x456983,null))[_0xd5b2('0x1e')](saveUpdates(_0x23b8d8[_0xd5b2('0x42')],null))[_0xd5b2('0x1e')](respondWithResult(_0x456983,null))[_0xd5b2('0x40')](handleError(_0x456983,null));};exports[_0xd5b2('0x1f')]=function(_0x4f427d,_0x5c3165){return db[_0xd5b2('0x26')][_0xd5b2('0x3f')]({'where':{'id':_0x4f427d[_0xd5b2('0x3e')]['id']}})[_0xd5b2('0x1e')](handleEntityNotFound(_0x5c3165,null))[_0xd5b2('0x1e')](removeEntity(_0x5c3165,null))[_0xd5b2('0x40')](handleError(_0x5c3165,null));};exports[_0xd5b2('0x43')]=function(_0x1a74bb,_0xe75d53){return db[_0xd5b2('0x26')][_0xd5b2('0x43')]()['then'](respondWithResult(_0xe75d53,null))[_0xd5b2('0x40')](handleError(_0xe75d53,null));}; \ No newline at end of file +var _0xa6f9=['limit','count','set','apply','reject','save','update','then','sendStatus','name','send','index','map','SmsQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x363150,_0x1d1aac){var _0x546cef=function(_0x43cdbf){while(--_0x43cdbf){_0x363150['push'](_0x363150['shift']());}};_0x546cef(++_0x1d1aac);}(_0xa6f9,0x75));var _0x9a6f=function(_0x53894a,_0x50dfb7){_0x53894a=_0x53894a-0x0;var _0x439324=_0xa6f9[_0x53894a];return _0x439324;};'use strict';var emlformat=require(_0x9a6f('0x0'));var rimraf=require(_0x9a6f('0x1'));var zipdir=require(_0x9a6f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9a6f('0x3'));var moment=require('moment');var BPromise=require(_0x9a6f('0x4'));var Mustache=require(_0x9a6f('0x5'));var util=require(_0x9a6f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9a6f('0x7'));var ejs=require(_0x9a6f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a6f('0x9'));var squel=require(_0x9a6f('0xa'));var crypto=require('crypto');var jsforce=require(_0x9a6f('0xb'));var deskjs=require(_0x9a6f('0xc'));var toCsv=require(_0x9a6f('0x7'));var querystring=require('querystring');var Papa=require(_0x9a6f('0xd'));var Redis=require(_0x9a6f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9a6f('0xf'));var as=require(_0x9a6f('0x10'));var hardwareService=require(_0x9a6f('0x11'));var logger=require(_0x9a6f('0x12'))('api');var utils=require(_0x9a6f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9a6f('0x14'));var db=require(_0x9a6f('0x15'))['db'];function respondWithStatusCode(_0x2ac76c,_0x3eee06){_0x3eee06=_0x3eee06||0xcc;return function(_0x42c928){if(_0x42c928){return _0x2ac76c['sendStatus'](_0x3eee06);}return _0x2ac76c[_0x9a6f('0x16')](_0x3eee06)[_0x9a6f('0x17')]();};}function respondWithResult(_0x122891,_0x47b7ad){_0x47b7ad=_0x47b7ad||0xc8;return function(_0x211f55){if(_0x211f55){return _0x122891[_0x9a6f('0x16')](_0x47b7ad)[_0x9a6f('0x18')](_0x211f55);}};}function respondWithFilteredResult(_0x4f54eb,_0x55c9b2){return function(_0x548f05){if(_0x548f05){var _0xb343c2=typeof _0x55c9b2[_0x9a6f('0x19')]===_0x9a6f('0x1a')&&typeof _0x55c9b2[_0x9a6f('0x1b')]===_0x9a6f('0x1a');var _0x40697e=_0x548f05[_0x9a6f('0x1c')];var _0x4ce0aa=_0xb343c2?0x0:_0x55c9b2[_0x9a6f('0x19')];var _0x20caf9=_0xb343c2?_0x548f05[_0x9a6f('0x1c')]:_0x55c9b2[_0x9a6f('0x19')]+_0x55c9b2[_0x9a6f('0x1b')];var _0x853956;if(_0x20caf9>=_0x40697e){_0x20caf9=_0x40697e;_0x853956=0xc8;}else{_0x853956=0xce;}_0x4f54eb[_0x9a6f('0x16')](_0x853956);return _0x4f54eb[_0x9a6f('0x1d')]('Content-Range',_0x4ce0aa+'-'+_0x20caf9+'/'+_0x40697e)[_0x9a6f('0x18')](_0x548f05);}return null;};}function patchUpdates(_0x1bec8c){return function(_0x105d67){try{jsonpatch[_0x9a6f('0x1e')](_0x105d67,_0x1bec8c,!![]);}catch(_0x7c2664){return BPromise[_0x9a6f('0x1f')](_0x7c2664);}return _0x105d67[_0x9a6f('0x20')]();};}function saveUpdates(_0x2e04f6,_0x1bdbec){return function(_0x6c341f){if(_0x6c341f){return _0x6c341f[_0x9a6f('0x21')](_0x2e04f6)[_0x9a6f('0x22')](function(_0xcd2dc5){return _0xcd2dc5;});}return null;};}function removeEntity(_0x116099,_0x474f36){return function(_0x3484c8){if(_0x3484c8){return _0x3484c8['destroy']()[_0x9a6f('0x22')](function(){_0x116099[_0x9a6f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52dbdb,_0x4ed794){return function(_0x38518c){if(!_0x38518c){_0x52dbdb[_0x9a6f('0x23')](0x194);}return _0x38518c;};}function handleError(_0x1e9f21,_0x2e587e){_0x2e587e=_0x2e587e||0x1f4;return function(_0x56e39c){logger['error'](_0x56e39c['stack']);if(_0x56e39c[_0x9a6f('0x24')]){delete _0x56e39c[_0x9a6f('0x24')];}_0x1e9f21[_0x9a6f('0x16')](_0x2e587e)[_0x9a6f('0x25')](_0x56e39c);};}exports[_0x9a6f('0x26')]=function(_0x69043c,_0x2c0199){var _0x2dc232={},_0x2594e6={},_0x17b50a={'count':0x0,'rows':[]};var _0x276df1=_[_0x9a6f('0x27')](db[_0x9a6f('0x28')]['rawAttributes'],function(_0xdd15b7){return{'name':_0xdd15b7[_0x9a6f('0x29')],'type':_0xdd15b7[_0x9a6f('0x2a')][_0x9a6f('0x2b')]};});_0x2594e6[_0x9a6f('0x2c')]=_[_0x9a6f('0x27')](_0x276df1,_0x9a6f('0x24'));_0x2594e6[_0x9a6f('0x2d')]=_[_0x9a6f('0x2e')](_0x69043c[_0x9a6f('0x2d')]);_0x2594e6[_0x9a6f('0x2f')]=_[_0x9a6f('0x30')](_0x2594e6[_0x9a6f('0x2c')],_0x2594e6[_0x9a6f('0x2d')]);_0x2dc232[_0x9a6f('0x31')]=_['intersection'](_0x2594e6[_0x9a6f('0x2c')],qs[_0x9a6f('0x32')](_0x69043c[_0x9a6f('0x2d')][_0x9a6f('0x32')]));_0x2dc232[_0x9a6f('0x31')]=_0x2dc232[_0x9a6f('0x31')][_0x9a6f('0x33')]?_0x2dc232['attributes']:_0x2594e6[_0x9a6f('0x2c')];if(!_0x69043c[_0x9a6f('0x2d')][_0x9a6f('0x34')](_0x9a6f('0x35'))){_0x2dc232['limit']=qs[_0x9a6f('0x1b')](_0x69043c[_0x9a6f('0x2d')]['limit']);_0x2dc232[_0x9a6f('0x19')]=qs[_0x9a6f('0x19')](_0x69043c[_0x9a6f('0x2d')][_0x9a6f('0x19')]);}_0x2dc232[_0x9a6f('0x36')]=qs[_0x9a6f('0x37')](_0x69043c[_0x9a6f('0x2d')][_0x9a6f('0x37')]);_0x2dc232[_0x9a6f('0x38')]=qs[_0x9a6f('0x2f')](_['pick'](_0x69043c[_0x9a6f('0x2d')],_0x2594e6[_0x9a6f('0x2f')]),_0x276df1);if(_0x69043c[_0x9a6f('0x2d')]['filter']){_0x2dc232[_0x9a6f('0x38')]=_[_0x9a6f('0x39')](_0x2dc232[_0x9a6f('0x38')],{'$or':_[_0x9a6f('0x27')](_0x276df1,function(_0x2e2603){if(_0x2e2603[_0x9a6f('0x2a')]!==_0x9a6f('0x3a')){var _0x52a201={};_0x52a201[_0x2e2603['name']]={'$like':'%'+_0x69043c[_0x9a6f('0x2d')]['filter']+'%'};return _0x52a201;}})});}_0x2dc232=_[_0x9a6f('0x39')]({},_0x2dc232,_0x69043c['options']);var _0x32a1a1={'where':_0x2dc232[_0x9a6f('0x38')]};return db['SmsQueueReport']['count'](_0x32a1a1)[_0x9a6f('0x22')](function(_0xc8b03c){_0x17b50a['count']=_0xc8b03c;if(_0x69043c[_0x9a6f('0x2d')]['includeAll']){_0x2dc232[_0x9a6f('0x3b')]=[{'all':!![]}];}return db[_0x9a6f('0x28')][_0x9a6f('0x3c')](_0x2dc232);})['then'](function(_0x5217c0){_0x17b50a[_0x9a6f('0x3d')]=_0x5217c0;return _0x17b50a;})[_0x9a6f('0x22')](respondWithFilteredResult(_0x2c0199,_0x2dc232))[_0x9a6f('0x3e')](handleError(_0x2c0199,null));};exports[_0x9a6f('0x3f')]=function(_0x1d57b8,_0xbd69a1){var _0x52b731={'raw':!![],'where':{'id':_0x1d57b8[_0x9a6f('0x40')]['id']}},_0x48914b={};_0x48914b[_0x9a6f('0x2c')]=_[_0x9a6f('0x2e')](db[_0x9a6f('0x28')][_0x9a6f('0x41')]);_0x48914b[_0x9a6f('0x2d')]=_[_0x9a6f('0x2e')](_0x1d57b8['query']);_0x48914b[_0x9a6f('0x2f')]=_[_0x9a6f('0x30')](_0x48914b[_0x9a6f('0x2c')],_0x48914b[_0x9a6f('0x2d')]);_0x52b731[_0x9a6f('0x31')]=_[_0x9a6f('0x30')](_0x48914b[_0x9a6f('0x2c')],qs['fields'](_0x1d57b8[_0x9a6f('0x2d')]['fields']));_0x52b731[_0x9a6f('0x31')]=_0x52b731[_0x9a6f('0x31')][_0x9a6f('0x33')]?_0x52b731[_0x9a6f('0x31')]:_0x48914b['model'];if(_0x1d57b8[_0x9a6f('0x2d')][_0x9a6f('0x42')]){_0x52b731[_0x9a6f('0x3b')]=[{'all':!![]}];}_0x52b731=_[_0x9a6f('0x39')]({},_0x52b731,_0x1d57b8['options']);return db[_0x9a6f('0x28')]['find'](_0x52b731)['then'](handleEntityNotFound(_0xbd69a1,null))[_0x9a6f('0x22')](respondWithResult(_0xbd69a1,null))[_0x9a6f('0x3e')](handleError(_0xbd69a1,null));};exports['create']=function(_0x267516,_0x1e54bb){return db[_0x9a6f('0x28')][_0x9a6f('0x43')](_0x267516[_0x9a6f('0x44')],{})[_0x9a6f('0x22')](respondWithResult(_0x1e54bb,0xc9))[_0x9a6f('0x3e')](handleError(_0x1e54bb,null));};exports[_0x9a6f('0x21')]=function(_0x256733,_0x505c5b){if(_0x256733[_0x9a6f('0x44')]['id']){delete _0x256733['body']['id'];}return db[_0x9a6f('0x28')][_0x9a6f('0x45')]({'where':{'id':_0x256733['params']['id']}})[_0x9a6f('0x22')](handleEntityNotFound(_0x505c5b,null))[_0x9a6f('0x22')](saveUpdates(_0x256733[_0x9a6f('0x44')],null))[_0x9a6f('0x22')](respondWithResult(_0x505c5b,null))['catch'](handleError(_0x505c5b,null));};exports[_0x9a6f('0x46')]=function(_0x1ad79b,_0x486c9a){return db[_0x9a6f('0x28')]['find']({'where':{'id':_0x1ad79b[_0x9a6f('0x40')]['id']}})['then'](handleEntityNotFound(_0x486c9a,null))[_0x9a6f('0x22')](removeEntity(_0x486c9a,null))['catch'](handleError(_0x486c9a,null));};exports[_0x9a6f('0x47')]=function(_0xdb15e,_0x549f72){return db[_0x9a6f('0x28')][_0x9a6f('0x47')]()['then'](respondWithResult(_0x549f72,null))[_0x9a6f('0x3e')](handleError(_0x549f72,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 31b1826..e8e8b38 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x303707,_0x2c5aed){var _0x5694c7=function(_0x31d8de){while(--_0x31d8de){_0x303707['push'](_0x303707['shift']());}};_0x5694c7(++_0x2c5aed);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x2a8b5c,_0x429c22){var _0x3bbefe=function(_0xb97fd2){while(--_0xb97fd2){_0x2a8b5c['push'](_0x2a8b5c['shift']());}};_0x3bbefe(++_0x429c22);}(_0xe706,0xa3));var _0x6e70=function(_0x48ea38,_0xb5b397){_0x48ea38=_0x48ea38-0x0;var _0xa6780=_0xe706[_0x48ea38];return _0xa6780;};'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/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 73805e3..ca8d78d 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 _0x2273=['options','raw','debug','UpdateSmsQueueReport','update','where','attributes','limit','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','create','body'];(function(_0x224292,_0xdc571){var _0x4994dc=function(_0x2982ba){while(--_0x2982ba){_0x224292['push'](_0x224292['shift']());}};_0x4994dc(++_0xdc571);}(_0x2273,0x13b));var _0x3227=function(_0x2d9d04,_0x2e3be0){_0x2d9d04=_0x2d9d04-0x0;var _0x2c54b9=_0x2273[_0x2d9d04];return _0x2c54b9;};'use strict';var _=require(_0x3227('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3227('0x1'));var rs=require(_0x3227('0x2'));var fs=require('fs');var Redis=require(_0x3227('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3227('0x4'));var logger=require(_0x3227('0x5'))(_0x3227('0x6'));var config=require(_0x3227('0x7'));var jayson=require(_0x3227('0x8'));var client=jayson[_0x3227('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d0931,_0x3aed05,_0x3549d5){return new BPromise(function(_0x8971f7,_0x67a6b6){return client[_0x3227('0xa')](_0x3d0931,_0x3549d5)[_0x3227('0xb')](function(_0x3d4d1e){logger[_0x3227('0xc')](_0x3227('0xd'),_0x3aed05,_0x3227('0xe'));logger['debug'](_0x3227('0xf'),_0x3aed05,_0x3227('0xe'),JSON[_0x3227('0x10')](_0x3d4d1e));if(_0x3d4d1e['error']){if(_0x3d4d1e[_0x3227('0x11')][_0x3227('0x12')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x3aed05,_0x3d4d1e[_0x3227('0x11')][_0x3227('0x13')]);return _0x67a6b6(_0x3d4d1e[_0x3227('0x11')]['message']);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x3aed05,_0x3d4d1e[_0x3227('0x11')][_0x3227('0x13')]);return _0x8971f7(_0x3d4d1e[_0x3227('0x11')][_0x3227('0x13')]);}else{logger[_0x3227('0xc')](_0x3227('0xd'),_0x3aed05,_0x3227('0xe'));_0x8971f7(_0x3d4d1e[_0x3227('0x14')]['message']);}})['catch'](function(_0x413d9f){logger[_0x3227('0x11')](_0x3227('0xd'),_0x3aed05,_0x413d9f);_0x67a6b6(_0x413d9f);});});}exports[_0x3227('0x15')]=function(_0x233419){var _0x2cdf4c=this;return new Promise(function(_0x5eb133,_0x22a89e){return db[_0x3227('0x16')][_0x3227('0x17')](_0x233419[_0x3227('0x18')],{'raw':_0x233419[_0x3227('0x19')]?_0x233419[_0x3227('0x19')][_0x3227('0x1a')]===undefined?!![]:![]:!![]})[_0x3227('0xb')](function(_0x39238e){logger[_0x3227('0xc')](_0x3227('0x15'),_0x233419);logger[_0x3227('0x1b')](_0x3227('0x15'),_0x233419,JSON[_0x3227('0x10')](_0x39238e));_0x5eb133(_0x39238e);})['catch'](function(_0x3a1268){logger[_0x3227('0x11')](_0x3227('0x15'),_0x3a1268[_0x3227('0x13')],_0x233419);_0x22a89e(_0x2cdf4c['error'](0x1f4,_0x3a1268[_0x3227('0x13')]));});});};exports[_0x3227('0x1c')]=function(_0xf16517){var _0x449435=this;return new Promise(function(_0x5bed6f,_0x44f994){return db[_0x3227('0x16')][_0x3227('0x1d')](_0xf16517['body'],{'raw':_0xf16517[_0x3227('0x19')]?_0xf16517[_0x3227('0x19')][_0x3227('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf16517[_0x3227('0x19')]?_0xf16517['options'][_0x3227('0x1e')]||null:null,'attributes':_0xf16517[_0x3227('0x19')]?_0xf16517['options'][_0x3227('0x1f')]||null:null,'limit':_0xf16517['options']?_0xf16517[_0x3227('0x19')][_0x3227('0x20')]||null:null})[_0x3227('0xb')](function(_0x50a0ca){logger[_0x3227('0xc')](_0x3227('0x1c'),_0xf16517);logger[_0x3227('0x1b')](_0x3227('0x1c'),_0xf16517,JSON[_0x3227('0x10')](_0x50a0ca));_0x5bed6f(_0x50a0ca);})[_0x3227('0x21')](function(_0x32d4a1){logger[_0x3227('0x11')](_0x3227('0x1c'),_0x32d4a1['message'],_0xf16517);_0x44f994(_0x449435['error'](0x1f4,_0x32d4a1[_0x3227('0x13')]));});});}; \ No newline at end of file +var _0x4dd4=['catch','CreateSmsQueueReport','SmsQueueReport','options','stringify','UpdateSmsQueueReport','update','where','attributes','lodash','moment','randomstring','../../config/utils','../../config/environment','jayson/promise','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x1c9b98,_0x309a1a){var _0x3bf5ca=function(_0x4d9516){while(--_0x4d9516){_0x1c9b98['push'](_0x1c9b98['shift']());}};_0x3bf5ca(++_0x309a1a);}(_0x4dd4,0x1c3));var _0x44dd=function(_0x3bf780,_0x2a43ee){_0x3bf780=_0x3bf780-0x0;var _0x113541=_0x4dd4[_0x3bf780];return _0x113541;};'use strict';var _=require(_0x44dd('0x0'));var util=require('util');var moment=require(_0x44dd('0x1'));var BPromise=require('bluebird');var rs=require(_0x44dd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44dd('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x44dd('0x4'));var jayson=require(_0x44dd('0x5'));var client=jayson['client'][_0x44dd('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1dcd88,_0x11de22,_0x1280af){return new BPromise(function(_0xf0d004,_0x3bca4d){return client['request'](_0x1dcd88,_0x1280af)[_0x44dd('0x7')](function(_0x588b5c){logger[_0x44dd('0x8')](_0x44dd('0x9'),_0x11de22,_0x44dd('0xa'));logger[_0x44dd('0xb')](_0x44dd('0xc'),_0x11de22,_0x44dd('0xa'),JSON['stringify'](_0x588b5c));if(_0x588b5c[_0x44dd('0xd')]){if(_0x588b5c[_0x44dd('0xd')][_0x44dd('0xe')]===0x1f4){logger[_0x44dd('0xd')](_0x44dd('0x9'),_0x11de22,_0x588b5c[_0x44dd('0xd')]['message']);return _0x3bca4d(_0x588b5c['error'][_0x44dd('0xf')]);}logger[_0x44dd('0xd')](_0x44dd('0x9'),_0x11de22,_0x588b5c[_0x44dd('0xd')][_0x44dd('0xf')]);return _0xf0d004(_0x588b5c['error'][_0x44dd('0xf')]);}else{logger[_0x44dd('0x8')](_0x44dd('0x9'),_0x11de22,_0x44dd('0xa'));_0xf0d004(_0x588b5c[_0x44dd('0x10')][_0x44dd('0xf')]);}})[_0x44dd('0x11')](function(_0x374f4b){logger[_0x44dd('0xd')](_0x44dd('0x9'),_0x11de22,_0x374f4b);_0x3bca4d(_0x374f4b);});});}exports[_0x44dd('0x12')]=function(_0x1e2cce){var _0x14290a=this;return new Promise(function(_0x20a565,_0x4daea0){return db[_0x44dd('0x13')]['create'](_0x1e2cce['body'],{'raw':_0x1e2cce[_0x44dd('0x14')]?_0x1e2cce[_0x44dd('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x44dd('0x7')](function(_0x49e06a){logger['info'](_0x44dd('0x12'),_0x1e2cce);logger[_0x44dd('0xb')]('CreateSmsQueueReport',_0x1e2cce,JSON[_0x44dd('0x15')](_0x49e06a));_0x20a565(_0x49e06a);})['catch'](function(_0x9eab3d){logger[_0x44dd('0xd')](_0x44dd('0x12'),_0x9eab3d[_0x44dd('0xf')],_0x1e2cce);_0x4daea0(_0x14290a[_0x44dd('0xd')](0x1f4,_0x9eab3d[_0x44dd('0xf')]));});});};exports[_0x44dd('0x16')]=function(_0x44e630){var _0x3c1879=this;return new Promise(function(_0x5de9c0,_0x2956a4){return db[_0x44dd('0x13')][_0x44dd('0x17')](_0x44e630['body'],{'raw':_0x44e630['options']?_0x44e630[_0x44dd('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44e630['options']?_0x44e630[_0x44dd('0x14')][_0x44dd('0x18')]||null:null,'attributes':_0x44e630[_0x44dd('0x14')]?_0x44e630[_0x44dd('0x14')][_0x44dd('0x19')]||null:null,'limit':_0x44e630['options']?_0x44e630[_0x44dd('0x14')]['limit']||null:null})[_0x44dd('0x7')](function(_0x1cd245){logger[_0x44dd('0x8')]('UpdateSmsQueueReport',_0x44e630);logger[_0x44dd('0xb')](_0x44dd('0x16'),_0x44e630,JSON[_0x44dd('0x15')](_0x1cd245));_0x5de9c0(_0x1cd245);})['catch'](function(_0xa07d57){logger[_0x44dd('0xd')](_0x44dd('0x16'),_0xa07d57['message'],_0x44e630);_0x2956a4(_0x3c1879[_0x44dd('0xd')](0x1f4,_0xa07d57['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 9c1942d..32b4fb7 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 _0xa7e6=['get','index','/describe','isAuthenticated','describe','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller'];(function(_0xfdc413,_0x2178ec){var _0x3dd0f0=function(_0x1f703a){while(--_0x1f703a){_0xfdc413['push'](_0xfdc413['shift']());}};_0x3dd0f0(++_0x2178ec);}(_0xa7e6,0x74));var _0x6a7e=function(_0x2e80b3,_0x1f73e2){_0x2e80b3=_0x2e80b3-0x0;var _0x1269b5=_0xa7e6[_0x2e80b3];return _0x1269b5;};'use strict';var multer=require(_0x6a7e('0x0'));var util=require(_0x6a7e('0x1'));var path=require(_0x6a7e('0x2'));var timeout=require(_0x6a7e('0x3'));var express=require(_0x6a7e('0x4'));var router=express[_0x6a7e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6a7e('0x6'));var interaction=require(_0x6a7e('0x7'));var config=require(_0x6a7e('0x8'));var controller=require(_0x6a7e('0x9'));router[_0x6a7e('0xa')]('/',auth['isAuthenticated'](),controller[_0x6a7e('0xb')]);router[_0x6a7e('0xa')](_0x6a7e('0xc'),auth[_0x6a7e('0xd')](),controller[_0x6a7e('0xe')]);router[_0x6a7e('0xa')](_0x6a7e('0xf'),auth[_0x6a7e('0xd')](),controller[_0x6a7e('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6a7e('0xf'),auth[_0x6a7e('0xd')](),controller[_0x6a7e('0x11')]);router[_0x6a7e('0x12')](_0x6a7e('0xf'),auth['isAuthenticated'](),controller[_0x6a7e('0x13')]);module[_0x6a7e('0x14')]=router; \ No newline at end of file +var _0x7d9f=['isAuthenticated','describe','/:id','show','post','put','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','index','get'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x6f114,_0x2ac0f9){_0x6f114=_0x6f114-0x0;var _0x40546b=_0x7d9f[_0x6f114];return _0x40546b;};'use strict';var multer=require(_0xf7d9('0x0'));var util=require(_0xf7d9('0x1'));var path=require(_0xf7d9('0x2'));var timeout=require(_0xf7d9('0x3'));var express=require(_0xf7d9('0x4'));var router=express['Router']();var fs_extra=require(_0xf7d9('0x5'));var auth=require(_0xf7d9('0x6'));var interaction=require(_0xf7d9('0x7'));var config=require(_0xf7d9('0x8'));var controller=require(_0xf7d9('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf7d9('0xa')]);router[_0xf7d9('0xb')]('/describe',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0xd')]);router['get'](_0xf7d9('0xe'),auth['isAuthenticated'](),controller[_0xf7d9('0xf')]);router[_0xf7d9('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf7d9('0x11')](_0xf7d9('0xe'),auth[_0xf7d9('0xc')](),controller['update']);router['delete'](_0xf7d9('0xe'),auth[_0xf7d9('0xc')](),controller[_0xf7d9('0x12')]);module[_0xf7d9('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 ebb6caf..66ac4a8 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(_0x1a1ba8,_0x52a437){var _0x3c5118=function(_0x34821f){while(--_0x34821f){_0x1a1ba8['push'](_0x1a1ba8['shift']());}};_0x3c5118(++_0x52a437);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x2d9f26,_0x10e8dd){var _0x5c7562=function(_0xc15ae9){while(--_0xc15ae9){_0x2d9f26['push'](_0x2d9f26['shift']());}};_0x5c7562(++_0x10e8dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index abee2bf..5dacb47 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 _0x958d=['mustache','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','index','SmsTransferReport','fieldName','map','keys','intersection','model','attributes','fields','length','nolimit','query','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','rows','show','params','rawAttributes','includeAll','include','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x499082,_0x13bd03){var _0xf85f30=function(_0x3078aa){while(--_0x3078aa){_0x499082['push'](_0x499082['shift']());}};_0xf85f30(++_0x13bd03);}(_0x958d,0x1ab));var _0xd958=function(_0x11e08b,_0x186a25){_0x11e08b=_0x11e08b-0x0;var _0x54fb1b=_0x958d[_0x11e08b];return _0x54fb1b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd958('0x0'));var zipdir=require(_0xd958('0x1'));var jsonpatch=require(_0xd958('0x2'));var rp=require(_0xd958('0x3'));var moment=require('moment');var BPromise=require(_0xd958('0x4'));var Mustache=require(_0xd958('0x5'));var util=require('util');var path=require(_0xd958('0x6'));var sox=require(_0xd958('0x7'));var csv=require(_0xd958('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd958('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd958('0xa'));var jsforce=require(_0xd958('0xb'));var deskjs=require(_0xd958('0xc'));var toCsv=require(_0xd958('0x8'));var querystring=require(_0xd958('0xd'));var Papa=require(_0xd958('0xe'));var Redis=require(_0xd958('0xf'));var authService=require(_0xd958('0x10'));var qs=require(_0xd958('0x11'));var as=require(_0xd958('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd958('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd958('0x14'))['db'];function respondWithStatusCode(_0xd2ea4d,_0x524e37){_0x524e37=_0x524e37||0xcc;return function(_0x59b0c8){if(_0x59b0c8){return _0xd2ea4d[_0xd958('0x15')](_0x524e37);}return _0xd2ea4d[_0xd958('0x16')](_0x524e37)['end']();};}function respondWithResult(_0x38791b,_0x3c9ae2){_0x3c9ae2=_0x3c9ae2||0xc8;return function(_0x57bfff){if(_0x57bfff){return _0x38791b[_0xd958('0x16')](_0x3c9ae2)['json'](_0x57bfff);}};}function respondWithFilteredResult(_0x4e1a3f,_0x1a3a72){return function(_0x2c3f12){if(_0x2c3f12){var _0x421bc5=typeof _0x1a3a72[_0xd958('0x17')]===_0xd958('0x18')&&typeof _0x1a3a72[_0xd958('0x19')]===_0xd958('0x18');var _0x1492c7=_0x2c3f12[_0xd958('0x1a')];var _0xf29b79=_0x421bc5?0x0:_0x1a3a72[_0xd958('0x17')];var _0x17fa10=_0x421bc5?_0x2c3f12[_0xd958('0x1a')]:_0x1a3a72[_0xd958('0x17')]+_0x1a3a72[_0xd958('0x19')];var _0x1938a9;if(_0x17fa10>=_0x1492c7){_0x17fa10=_0x1492c7;_0x1938a9=0xc8;}else{_0x1938a9=0xce;}_0x4e1a3f[_0xd958('0x16')](_0x1938a9);return _0x4e1a3f['set'](_0xd958('0x1b'),_0xf29b79+'-'+_0x17fa10+'/'+_0x1492c7)[_0xd958('0x1c')](_0x2c3f12);}return null;};}function patchUpdates(_0x3ba0af){return function(_0x441787){try{jsonpatch[_0xd958('0x1d')](_0x441787,_0x3ba0af,!![]);}catch(_0x302046){return BPromise[_0xd958('0x1e')](_0x302046);}return _0x441787[_0xd958('0x1f')]();};}function saveUpdates(_0x3110e7,_0x147a4f){return function(_0x3714f3){if(_0x3714f3){return _0x3714f3[_0xd958('0x20')](_0x3110e7)[_0xd958('0x21')](function(_0x410716){return _0x410716;});}return null;};}function removeEntity(_0x5ca65a,_0x5420f1){return function(_0x25274b){if(_0x25274b){return _0x25274b[_0xd958('0x22')]()[_0xd958('0x21')](function(){_0x5ca65a[_0xd958('0x16')](0xcc)[_0xd958('0x23')]();});}};}function handleEntityNotFound(_0x1ab194,_0x270e0f){return function(_0x4fac2c){if(!_0x4fac2c){_0x1ab194[_0xd958('0x15')](0x194);}return _0x4fac2c;};}function handleError(_0xb365c,_0x33b36f){_0x33b36f=_0x33b36f||0x1f4;return function(_0x244d83){logger['error'](_0x244d83[_0xd958('0x24')]);if(_0x244d83[_0xd958('0x25')]){delete _0x244d83[_0xd958('0x25')];}_0xb365c[_0xd958('0x16')](_0x33b36f)[_0xd958('0x26')](_0x244d83);};}exports[_0xd958('0x27')]=function(_0x1cf2a6,_0x292d1d){var _0x215508={},_0x11515e={},_0x8f9728={'count':0x0,'rows':[]};var _0x2fea1c=_['map'](db[_0xd958('0x28')]['rawAttributes'],function(_0x5757a1){return{'name':_0x5757a1[_0xd958('0x29')],'type':_0x5757a1['type']['key']};});_0x11515e['model']=_[_0xd958('0x2a')](_0x2fea1c,_0xd958('0x25'));_0x11515e['query']=_[_0xd958('0x2b')](_0x1cf2a6['query']);_0x11515e['filters']=_[_0xd958('0x2c')](_0x11515e[_0xd958('0x2d')],_0x11515e['query']);_0x215508[_0xd958('0x2e')]=_[_0xd958('0x2c')](_0x11515e[_0xd958('0x2d')],qs[_0xd958('0x2f')](_0x1cf2a6['query'][_0xd958('0x2f')]));_0x215508['attributes']=_0x215508[_0xd958('0x2e')][_0xd958('0x30')]?_0x215508[_0xd958('0x2e')]:_0x11515e[_0xd958('0x2d')];if(!_0x1cf2a6['query']['hasOwnProperty'](_0xd958('0x31'))){_0x215508[_0xd958('0x19')]=qs[_0xd958('0x19')](_0x1cf2a6[_0xd958('0x32')][_0xd958('0x19')]);_0x215508[_0xd958('0x17')]=qs[_0xd958('0x17')](_0x1cf2a6[_0xd958('0x32')]['offset']);}_0x215508[_0xd958('0x33')]=qs['sort'](_0x1cf2a6[_0xd958('0x32')][_0xd958('0x34')]);_0x215508['where']=qs['filters'](_[_0xd958('0x35')](_0x1cf2a6[_0xd958('0x32')],_0x11515e[_0xd958('0x36')]),_0x2fea1c);if(_0x1cf2a6[_0xd958('0x32')][_0xd958('0x37')]){_0x215508[_0xd958('0x38')]=_[_0xd958('0x39')](_0x215508[_0xd958('0x38')],{'$or':_[_0xd958('0x2a')](_0x2fea1c,function(_0x581332){if(_0x581332[_0xd958('0x3a')]!==_0xd958('0x3b')){var _0x4be2a0={};_0x4be2a0[_0x581332[_0xd958('0x25')]]={'$like':'%'+_0x1cf2a6['query'][_0xd958('0x37')]+'%'};return _0x4be2a0;}})});}_0x215508=_[_0xd958('0x39')]({},_0x215508,_0x1cf2a6[_0xd958('0x3c')]);var _0x1bded7={'where':_0x215508[_0xd958('0x38')]};return db[_0xd958('0x28')][_0xd958('0x1a')](_0x1bded7)[_0xd958('0x21')](function(_0x21b102){_0x8f9728[_0xd958('0x1a')]=_0x21b102;if(_0x1cf2a6['query']['includeAll']){_0x215508['include']=[{'all':!![]}];}return db[_0xd958('0x28')]['findAll'](_0x215508);})['then'](function(_0x4b1b28){_0x8f9728[_0xd958('0x3d')]=_0x4b1b28;return _0x8f9728;})[_0xd958('0x21')](respondWithFilteredResult(_0x292d1d,_0x215508))['catch'](handleError(_0x292d1d,null));};exports[_0xd958('0x3e')]=function(_0x4653d8,_0x3ce6a2){var _0x387a07={'raw':!![],'where':{'id':_0x4653d8[_0xd958('0x3f')]['id']}},_0x3461e7={};_0x3461e7[_0xd958('0x2d')]=_['keys'](db[_0xd958('0x28')][_0xd958('0x40')]);_0x3461e7['query']=_['keys'](_0x4653d8['query']);_0x3461e7[_0xd958('0x36')]=_[_0xd958('0x2c')](_0x3461e7[_0xd958('0x2d')],_0x3461e7[_0xd958('0x32')]);_0x387a07[_0xd958('0x2e')]=_[_0xd958('0x2c')](_0x3461e7[_0xd958('0x2d')],qs[_0xd958('0x2f')](_0x4653d8[_0xd958('0x32')][_0xd958('0x2f')]));_0x387a07['attributes']=_0x387a07[_0xd958('0x2e')][_0xd958('0x30')]?_0x387a07[_0xd958('0x2e')]:_0x3461e7['model'];if(_0x4653d8[_0xd958('0x32')][_0xd958('0x41')]){_0x387a07[_0xd958('0x42')]=[{'all':!![]}];}_0x387a07=_[_0xd958('0x39')]({},_0x387a07,_0x4653d8['options']);return db[_0xd958('0x28')][_0xd958('0x43')](_0x387a07)[_0xd958('0x21')](handleEntityNotFound(_0x3ce6a2,null))[_0xd958('0x21')](respondWithResult(_0x3ce6a2,null))['catch'](handleError(_0x3ce6a2,null));};exports[_0xd958('0x44')]=function(_0x3e033d,_0x441946){return db[_0xd958('0x28')][_0xd958('0x44')](_0x3e033d[_0xd958('0x45')],{})[_0xd958('0x21')](respondWithResult(_0x441946,0xc9))[_0xd958('0x46')](handleError(_0x441946,null));};exports['update']=function(_0x50da1b,_0x1c9c80){if(_0x50da1b['body']['id']){delete _0x50da1b[_0xd958('0x45')]['id'];}return db[_0xd958('0x28')][_0xd958('0x43')]({'where':{'id':_0x50da1b[_0xd958('0x3f')]['id']}})[_0xd958('0x21')](handleEntityNotFound(_0x1c9c80,null))[_0xd958('0x21')](saveUpdates(_0x50da1b['body'],null))['then'](respondWithResult(_0x1c9c80,null))[_0xd958('0x46')](handleError(_0x1c9c80,null));};exports[_0xd958('0x22')]=function(_0x75b8e0,_0x294262){return db[_0xd958('0x28')][_0xd958('0x43')]({'where':{'id':_0x75b8e0[_0xd958('0x3f')]['id']}})[_0xd958('0x21')](handleEntityNotFound(_0x294262,null))[_0xd958('0x21')](removeEntity(_0x294262,null))[_0xd958('0x46')](handleError(_0x294262,null));};exports[_0xd958('0x47')]=function(_0x1d231e,_0x36d12b){return db[_0xd958('0x28')][_0xd958('0x47')]()[_0xd958('0x21')](respondWithResult(_0x36d12b,null))[_0xd958('0x46')](handleError(_0x36d12b,null));}; \ No newline at end of file +var _0xd5bc=['key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','includeAll','include','findAll','rows','length','catch','create','body','find','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','SmsTransferReport','rawAttributes','type'];(function(_0x14d250,_0x4b2e12){var _0xb991d8=function(_0x4ea76d){while(--_0x4ea76d){_0x14d250['push'](_0x14d250['shift']());}};_0xb991d8(++_0x4b2e12);}(_0xd5bc,0x1e2));var _0xcd5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd5bc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcd5b('0x0'));var jsonpatch=require(_0xcd5b('0x1'));var rp=require(_0xcd5b('0x2'));var moment=require(_0xcd5b('0x3'));var BPromise=require(_0xcd5b('0x4'));var Mustache=require(_0xcd5b('0x5'));var util=require(_0xcd5b('0x6'));var path=require(_0xcd5b('0x7'));var sox=require(_0xcd5b('0x8'));var csv=require(_0xcd5b('0x9'));var ejs=require(_0xcd5b('0xa'));var fs=require('fs');var fs_extra=require(_0xcd5b('0xb'));var _=require(_0xcd5b('0xc'));var squel=require(_0xcd5b('0xd'));var crypto=require(_0xcd5b('0xe'));var jsforce=require(_0xcd5b('0xf'));var deskjs=require(_0xcd5b('0x10'));var toCsv=require(_0xcd5b('0x9'));var querystring=require(_0xcd5b('0x11'));var Papa=require(_0xcd5b('0x12'));var Redis=require('ioredis');var authService=require(_0xcd5b('0x13'));var qs=require(_0xcd5b('0x14'));var as=require(_0xcd5b('0x15'));var hardwareService=require(_0xcd5b('0x16'));var logger=require(_0xcd5b('0x17'))('api');var utils=require(_0xcd5b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xcd5b('0x19'));var db=require(_0xcd5b('0x1a'))['db'];function respondWithStatusCode(_0x27c2b0,_0x229bf3){_0x229bf3=_0x229bf3||0xcc;return function(_0x1e989a){if(_0x1e989a){return _0x27c2b0[_0xcd5b('0x1b')](_0x229bf3);}return _0x27c2b0[_0xcd5b('0x1c')](_0x229bf3)[_0xcd5b('0x1d')]();};}function respondWithResult(_0x5b16bc,_0x5eef08){_0x5eef08=_0x5eef08||0xc8;return function(_0x447b76){if(_0x447b76){return _0x5b16bc[_0xcd5b('0x1c')](_0x5eef08)[_0xcd5b('0x1e')](_0x447b76);}};}function respondWithFilteredResult(_0x5d491f,_0x50b2d1){return function(_0x3e4501){if(_0x3e4501){var _0x5b531a=typeof _0x50b2d1[_0xcd5b('0x1f')]==='undefined'&&typeof _0x50b2d1[_0xcd5b('0x20')]===_0xcd5b('0x21');var _0x426a65=_0x3e4501[_0xcd5b('0x22')];var _0x487a25=_0x5b531a?0x0:_0x50b2d1[_0xcd5b('0x1f')];var _0x546210=_0x5b531a?_0x3e4501['count']:_0x50b2d1['offset']+_0x50b2d1['limit'];var _0x36469d;if(_0x546210>=_0x426a65){_0x546210=_0x426a65;_0x36469d=0xc8;}else{_0x36469d=0xce;}_0x5d491f[_0xcd5b('0x1c')](_0x36469d);return _0x5d491f[_0xcd5b('0x23')](_0xcd5b('0x24'),_0x487a25+'-'+_0x546210+'/'+_0x426a65)[_0xcd5b('0x1e')](_0x3e4501);}return null;};}function patchUpdates(_0x63f7fe){return function(_0x486c83){try{jsonpatch[_0xcd5b('0x25')](_0x486c83,_0x63f7fe,!![]);}catch(_0x207760){return BPromise[_0xcd5b('0x26')](_0x207760);}return _0x486c83[_0xcd5b('0x27')]();};}function saveUpdates(_0x43ae43,_0x425c93){return function(_0x2179c1){if(_0x2179c1){return _0x2179c1[_0xcd5b('0x28')](_0x43ae43)[_0xcd5b('0x29')](function(_0xe85c7e){return _0xe85c7e;});}return null;};}function removeEntity(_0x2a5aa9,_0x1afb50){return function(_0x54066d){if(_0x54066d){return _0x54066d[_0xcd5b('0x2a')]()['then'](function(){_0x2a5aa9[_0xcd5b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x417305,_0x54f222){return function(_0x1eda84){if(!_0x1eda84){_0x417305['sendStatus'](0x194);}return _0x1eda84;};}function handleError(_0x51ddc3,_0x444541){_0x444541=_0x444541||0x1f4;return function(_0x1eb83b){logger['error'](_0x1eb83b[_0xcd5b('0x2b')]);if(_0x1eb83b[_0xcd5b('0x2c')]){delete _0x1eb83b['name'];}_0x51ddc3['status'](_0x444541)[_0xcd5b('0x2d')](_0x1eb83b);};}exports[_0xcd5b('0x2e')]=function(_0x20cd45,_0x10ab99){var _0x318b76={},_0x1a0ede={},_0x3ad452={'count':0x0,'rows':[]};var _0x3b0ec1=_['map'](db[_0xcd5b('0x2f')][_0xcd5b('0x30')],function(_0x4c23e0){return{'name':_0x4c23e0['fieldName'],'type':_0x4c23e0[_0xcd5b('0x31')][_0xcd5b('0x32')]};});_0x1a0ede[_0xcd5b('0x33')]=_[_0xcd5b('0x34')](_0x3b0ec1,_0xcd5b('0x2c'));_0x1a0ede['query']=_[_0xcd5b('0x35')](_0x20cd45[_0xcd5b('0x36')]);_0x1a0ede[_0xcd5b('0x37')]=_[_0xcd5b('0x38')](_0x1a0ede[_0xcd5b('0x33')],_0x1a0ede['query']);_0x318b76[_0xcd5b('0x39')]=_['intersection'](_0x1a0ede[_0xcd5b('0x33')],qs['fields'](_0x20cd45[_0xcd5b('0x36')][_0xcd5b('0x3a')]));_0x318b76['attributes']=_0x318b76[_0xcd5b('0x39')]['length']?_0x318b76[_0xcd5b('0x39')]:_0x1a0ede['model'];if(!_0x20cd45['query'][_0xcd5b('0x3b')]('nolimit')){_0x318b76[_0xcd5b('0x20')]=qs[_0xcd5b('0x20')](_0x20cd45[_0xcd5b('0x36')][_0xcd5b('0x20')]);_0x318b76[_0xcd5b('0x1f')]=qs[_0xcd5b('0x1f')](_0x20cd45[_0xcd5b('0x36')][_0xcd5b('0x1f')]);}_0x318b76[_0xcd5b('0x3c')]=qs[_0xcd5b('0x3d')](_0x20cd45[_0xcd5b('0x36')][_0xcd5b('0x3d')]);_0x318b76[_0xcd5b('0x3e')]=qs[_0xcd5b('0x37')](_[_0xcd5b('0x3f')](_0x20cd45[_0xcd5b('0x36')],_0x1a0ede[_0xcd5b('0x37')]),_0x3b0ec1);if(_0x20cd45['query']['filter']){_0x318b76[_0xcd5b('0x3e')]=_[_0xcd5b('0x40')](_0x318b76[_0xcd5b('0x3e')],{'$or':_['map'](_0x3b0ec1,function(_0x5e87cb){if(_0x5e87cb[_0xcd5b('0x31')]!=='VIRTUAL'){var _0xf9a774={};_0xf9a774[_0x5e87cb[_0xcd5b('0x2c')]]={'$like':'%'+_0x20cd45[_0xcd5b('0x36')]['filter']+'%'};return _0xf9a774;}})});}_0x318b76=_['merge']({},_0x318b76,_0x20cd45['options']);var _0x55afa5={'where':_0x318b76[_0xcd5b('0x3e')]};return db[_0xcd5b('0x2f')]['count'](_0x55afa5)[_0xcd5b('0x29')](function(_0x1e8536){_0x3ad452[_0xcd5b('0x22')]=_0x1e8536;if(_0x20cd45[_0xcd5b('0x36')][_0xcd5b('0x41')]){_0x318b76[_0xcd5b('0x42')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xcd5b('0x43')](_0x318b76);})[_0xcd5b('0x29')](function(_0xa779cd){_0x3ad452[_0xcd5b('0x44')]=_0xa779cd;return _0x3ad452;})[_0xcd5b('0x29')](respondWithFilteredResult(_0x10ab99,_0x318b76))['catch'](handleError(_0x10ab99,null));};exports['show']=function(_0x1413e2,_0x3955ba){var _0x5695ed={'raw':!![],'where':{'id':_0x1413e2['params']['id']}},_0x50831d={};_0x50831d['model']=_['keys'](db['SmsTransferReport']['rawAttributes']);_0x50831d[_0xcd5b('0x36')]=_[_0xcd5b('0x35')](_0x1413e2[_0xcd5b('0x36')]);_0x50831d[_0xcd5b('0x37')]=_[_0xcd5b('0x38')](_0x50831d[_0xcd5b('0x33')],_0x50831d[_0xcd5b('0x36')]);_0x5695ed['attributes']=_[_0xcd5b('0x38')](_0x50831d[_0xcd5b('0x33')],qs['fields'](_0x1413e2[_0xcd5b('0x36')][_0xcd5b('0x3a')]));_0x5695ed[_0xcd5b('0x39')]=_0x5695ed[_0xcd5b('0x39')][_0xcd5b('0x45')]?_0x5695ed[_0xcd5b('0x39')]:_0x50831d[_0xcd5b('0x33')];if(_0x1413e2[_0xcd5b('0x36')][_0xcd5b('0x41')]){_0x5695ed['include']=[{'all':!![]}];}_0x5695ed=_[_0xcd5b('0x40')]({},_0x5695ed,_0x1413e2['options']);return db[_0xcd5b('0x2f')]['find'](_0x5695ed)[_0xcd5b('0x29')](handleEntityNotFound(_0x3955ba,null))[_0xcd5b('0x29')](respondWithResult(_0x3955ba,null))[_0xcd5b('0x46')](handleError(_0x3955ba,null));};exports[_0xcd5b('0x47')]=function(_0x516160,_0x3b63e6){return db['SmsTransferReport'][_0xcd5b('0x47')](_0x516160[_0xcd5b('0x48')],{})[_0xcd5b('0x29')](respondWithResult(_0x3b63e6,0xc9))[_0xcd5b('0x46')](handleError(_0x3b63e6,null));};exports['update']=function(_0x3dcf47,_0x24f42f){if(_0x3dcf47[_0xcd5b('0x48')]['id']){delete _0x3dcf47[_0xcd5b('0x48')]['id'];}return db[_0xcd5b('0x2f')][_0xcd5b('0x49')]({'where':{'id':_0x3dcf47[_0xcd5b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x24f42f,null))['then'](saveUpdates(_0x3dcf47[_0xcd5b('0x48')],null))[_0xcd5b('0x29')](respondWithResult(_0x24f42f,null))['catch'](handleError(_0x24f42f,null));};exports[_0xcd5b('0x2a')]=function(_0x42ca24,_0x5d0662){return db['SmsTransferReport'][_0xcd5b('0x49')]({'where':{'id':_0x42ca24[_0xcd5b('0x4a')]['id']}})[_0xcd5b('0x29')](handleEntityNotFound(_0x5d0662,null))['then'](removeEntity(_0x5d0662,null))[_0xcd5b('0x46')](handleError(_0x5d0662,null));};exports[_0xcd5b('0x4b')]=function(_0x34b533,_0x452048){return db['SmsTransferReport'][_0xcd5b('0x4b')]()['then'](respondWithResult(_0x452048,null))[_0xcd5b('0x46')](handleError(_0x452048,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index f2e9eeb..e6801f4 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 _0x707d=['../../config/environment','exports','SmsTransferReport','uniqueid','util','../../config/logger','api','moment','rimraf'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x707d,0x12d));var _0xd707=function(_0xc152fb,_0xefca0d){_0xc152fb=_0xc152fb-0x0;var _0x5e41c9=_0x707d[_0xc152fb];return _0x5e41c9;};'use strict';var _=require('lodash');var util=require(_0xd707('0x0'));var logger=require(_0xd707('0x1'))(_0xd707('0x2'));var moment=require(_0xd707('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd707('0x4'));var config=require(_0xd707('0x5'));var attributes=require('./smsTransferReport.attributes');module[_0xd707('0x6')]=function(_0x6f0216,_0x10a295){return _0x6f0216['define'](_0xd707('0x7'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd707('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd6ce=['bluebird','request-promise','path','./smsTransferReport.attributes','exports','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd6ce,0x127));var _0xed6c=function(_0x156d4,_0x37c674){_0x156d4=_0x156d4-0x0;var _0x52637b=_0xd6ce[_0x156d4];return _0x52637b;};'use strict';var _=require(_0xed6c('0x0'));var util=require(_0xed6c('0x1'));var logger=require(_0xed6c('0x2'))(_0xed6c('0x3'));var moment=require(_0xed6c('0x4'));var BPromise=require(_0xed6c('0x5'));var rp=require(_0xed6c('0x6'));var fs=require('fs');var path=require(_0xed6c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xed6c('0x8'));module[_0xed6c('0x9')]=function(_0x1a6d96,_0x1d0912){return _0x1a6d96['define']('SmsTransferReport',attributes,{'tableName':_0xed6c('0xa'),'paranoid':![],'indexes':[{'name':_0xed6c('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 36f440b..812310d 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 _0x59ce=['request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','SmsTransferReport,\x20%s,\x20%s'];(function(_0x4920ac,_0x442aae){var _0x15eb70=function(_0x19ef78){while(--_0x19ef78){_0x4920ac['push'](_0x4920ac['shift']());}};_0x15eb70(++_0x442aae);}(_0x59ce,0x92));var _0xe59c=function(_0x1aa2d4,_0x1224a5){_0x1aa2d4=_0x1aa2d4-0x0;var _0x351f0f=_0x59ce[_0x1aa2d4];return _0x351f0f;};'use strict';var _=require(_0xe59c('0x0'));var util=require(_0xe59c('0x1'));var moment=require(_0xe59c('0x2'));var BPromise=require('bluebird');var rs=require(_0xe59c('0x3'));var fs=require('fs');var Redis=require(_0xe59c('0x4'));var db=require(_0xe59c('0x5'))['db'];var utils=require(_0xe59c('0x6'));var logger=require(_0xe59c('0x7'))(_0xe59c('0x8'));var config=require(_0xe59c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe59c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x534601,_0x4f07e9,_0x2c1d11){return new BPromise(function(_0x101a79,_0x206753){return client[_0xe59c('0xb')](_0x534601,_0x2c1d11)[_0xe59c('0xc')](function(_0x3981be){logger[_0xe59c('0xd')](_0xe59c('0xe'),_0x4f07e9,_0xe59c('0xf'));logger[_0xe59c('0x10')](_0xe59c('0x11'),_0x4f07e9,_0xe59c('0xf'),JSON[_0xe59c('0x12')](_0x3981be));if(_0x3981be[_0xe59c('0x13')]){if(_0x3981be[_0xe59c('0x13')][_0xe59c('0x14')]===0x1f4){logger[_0xe59c('0x13')](_0xe59c('0xe'),_0x4f07e9,_0x3981be['error'][_0xe59c('0x15')]);return _0x206753(_0x3981be[_0xe59c('0x13')][_0xe59c('0x15')]);}logger[_0xe59c('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x4f07e9,_0x3981be['error'][_0xe59c('0x15')]);return _0x101a79(_0x3981be[_0xe59c('0x13')][_0xe59c('0x15')]);}else{logger[_0xe59c('0xd')](_0xe59c('0xe'),_0x4f07e9,'request\x20sent');_0x101a79(_0x3981be[_0xe59c('0x16')]['message']);}})['catch'](function(_0xee38fc){logger[_0xe59c('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x4f07e9,_0xee38fc);_0x206753(_0xee38fc);});});} \ No newline at end of file +var _0x2494=['../../config/utils','../../config/environment','client','http','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x37974b,_0xf0a0f8){var _0x1824b7=function(_0x186b92){while(--_0x186b92){_0x37974b['push'](_0x37974b['shift']());}};_0x1824b7(++_0xf0a0f8);}(_0x2494,0x82));var _0x4249=function(_0xd84ab3,_0x4c4a5f){_0xd84ab3=_0xd84ab3-0x0;var _0x3f534b=_0x2494[_0xd84ab3];return _0x3f534b;};'use strict';var _=require(_0x4249('0x0'));var util=require('util');var moment=require(_0x4249('0x1'));var BPromise=require(_0x4249('0x2'));var rs=require(_0x4249('0x3'));var fs=require('fs');var Redis=require(_0x4249('0x4'));var db=require(_0x4249('0x5'))['db'];var utils=require(_0x4249('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4249('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4249('0x8')][_0x4249('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xed716a,_0x5b1b17,_0x326336){return new BPromise(function(_0x2b7934,_0x21060d){return client['request'](_0xed716a,_0x326336)['then'](function(_0x3efaa6){logger[_0x4249('0xa')](_0x4249('0xb'),_0x5b1b17,_0x4249('0xc'));logger[_0x4249('0xd')](_0x4249('0xe'),_0x5b1b17,_0x4249('0xc'),JSON['stringify'](_0x3efaa6));if(_0x3efaa6['error']){if(_0x3efaa6[_0x4249('0xf')]['code']===0x1f4){logger[_0x4249('0xf')](_0x4249('0xb'),_0x5b1b17,_0x3efaa6['error'][_0x4249('0x10')]);return _0x21060d(_0x3efaa6[_0x4249('0xf')]['message']);}logger[_0x4249('0xf')](_0x4249('0xb'),_0x5b1b17,_0x3efaa6[_0x4249('0xf')][_0x4249('0x10')]);return _0x2b7934(_0x3efaa6[_0x4249('0xf')][_0x4249('0x10')]);}else{logger['info'](_0x4249('0xb'),_0x5b1b17,_0x4249('0xc'));_0x2b7934(_0x3efaa6['result'][_0x4249('0x10')]);}})['catch'](function(_0x501e9c){logger['error'](_0x4249('0xb'),_0x5b1b17,_0x501e9c);_0x21060d(_0x501e9c);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index cdc3c63..02d3807 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 _0x74c1=['%s-%s%s','extname','now','post','single','create','put','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74c1,0x10e));var _0x174c=function(_0x2d7bbf,_0x5554f9){_0x2d7bbf=_0x2d7bbf-0x0;var _0x26ce6d=_0x74c1[_0x2d7bbf];return _0x26ce6d;};'use strict';var multer=require(_0x174c('0x0'));var util=require(_0x174c('0x1'));var path=require(_0x174c('0x2'));var timeout=require(_0x174c('0x3'));var express=require('express');var router=express[_0x174c('0x4')]();var fs_extra=require(_0x174c('0x5'));var auth=require(_0x174c('0x6'));var interaction=require(_0x174c('0x7'));var config=require(_0x174c('0x8'));var controller=require('./sound.controller');router[_0x174c('0x9')]('/',auth[_0x174c('0xa')](),controller['index']);router[_0x174c('0x9')](_0x174c('0xb'),auth[_0x174c('0xa')](),controller[_0x174c('0xc')]);router[_0x174c('0x9')](_0x174c('0xd'),auth[_0x174c('0xa')](),controller[_0x174c('0xe')]);var upload=multer({'storage':multer[_0x174c('0xf')]({'destination':function(_0x33d829,_0x235fb1,_0x474068){_0x474068(null,path[_0x174c('0x10')](config['root'],_0x174c('0x11')));},'filename':function(_0x4d0ca3,_0x334eff,_0x202dfa){_0x334eff[_0x174c('0x12')]=_0x334eff[_0x174c('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x202dfa(null,util[_0x174c('0x13')](_0x174c('0x14'),path['basename'](_0x334eff['originalname'],path[_0x174c('0x15')](_0x334eff[_0x174c('0x12')])),Date[_0x174c('0x16')](),path[_0x174c('0x15')](_0x334eff[_0x174c('0x12')])));}})});router[_0x174c('0x17')]('/',upload[_0x174c('0x18')]('file'),controller[_0x174c('0x19')]);router[_0x174c('0x1a')](_0x174c('0xb'),auth[_0x174c('0xa')](),controller[_0x174c('0x1b')]);router[_0x174c('0x1c')](_0x174c('0xb'),auth[_0x174c('0xa')](),controller[_0x174c('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x4cc7=['express','Router','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','join','root','server/files/sounds/original/','replace','format','%s-%s%s','basename','originalname','now','extname','post','single','file','create','update','delete','exports','multer','util','connect-timeout'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x4cc7,0x190));var _0x74cc=function(_0x126c60,_0x4bda13){_0x126c60=_0x126c60-0x0;var _0x3110e0=_0x4cc7[_0x126c60];return _0x3110e0;};'use strict';var multer=require(_0x74cc('0x0'));var util=require(_0x74cc('0x1'));var path=require('path');var timeout=require(_0x74cc('0x2'));var express=require(_0x74cc('0x3'));var router=express[_0x74cc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x74cc('0x5'));var interaction=require(_0x74cc('0x6'));var config=require('../../config/environment');var controller=require(_0x74cc('0x7'));router[_0x74cc('0x8')]('/',auth[_0x74cc('0x9')](),controller[_0x74cc('0xa')]);router['get'](_0x74cc('0xb'),auth['isAuthenticated'](),controller[_0x74cc('0xc')]);router['get'](_0x74cc('0xd'),auth[_0x74cc('0x9')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2adbdd,_0x218bc1,_0x468be9){_0x468be9(null,path[_0x74cc('0xe')](config[_0x74cc('0xf')],_0x74cc('0x10')));},'filename':function(_0x4466ec,_0x35c9d0,_0x26c847){_0x35c9d0['originalname']=_0x35c9d0['originalname'][_0x74cc('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x26c847(null,util[_0x74cc('0x12')](_0x74cc('0x13'),path[_0x74cc('0x14')](_0x35c9d0['originalname'],path['extname'](_0x35c9d0[_0x74cc('0x15')])),Date[_0x74cc('0x16')](),path[_0x74cc('0x17')](_0x35c9d0[_0x74cc('0x15')])));}})});router[_0x74cc('0x18')]('/',upload[_0x74cc('0x19')](_0x74cc('0x1a')),controller[_0x74cc('0x1b')]);router['put'](_0x74cc('0xb'),auth[_0x74cc('0x9')](),controller[_0x74cc('0x1c')]);router[_0x74cc('0x1d')](_0x74cc('0xb'),auth[_0x74cc('0x9')](),controller[_0x74cc('0x1d')]);module[_0x74cc('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index d19637c..b857e65 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 _0xbb84=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING','name'];(function(_0xf1792c,_0x2d813f){var _0xd75e59=function(_0x5aae93){while(--_0x5aae93){_0xf1792c['push'](_0xf1792c['shift']());}};_0xd75e59(++_0x2d813f);}(_0xbb84,0x199));var _0x4bb8=function(_0x107f10,_0x5529f2){_0x107f10=_0x107f10-0x0;var _0x811cab=_0xbb84[_0x107f10];return _0x811cab;};'use strict';var Sequelize=require(_0x4bb8('0x0'));module[_0x4bb8('0x1')]={'name':{'type':Sequelize[_0x4bb8('0x2')],'unique':_0x4bb8('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x4bb8('0x2')]},'display_name':{'type':Sequelize[_0x4bb8('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x4bb8('0x2')]},'original_format':{'type':Sequelize[_0x4bb8('0x2')]},'original_duration':{'type':Sequelize[_0x4bb8('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x4bb8('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x4bb8('0x5')]},'converted_channelCount':{'type':Sequelize[_0x4bb8('0x6')]},'converted_bitRate':{'type':Sequelize[_0x4bb8('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x4bb8('0x6')]}}; \ No newline at end of file +var _0x7ff6=['INTEGER','sequelize','exports','STRING','FLOAT','BIGINT'];(function(_0x8e7772,_0x9d77b0){var _0x408200=function(_0x1c61b6){while(--_0x1c61b6){_0x8e7772['push'](_0x8e7772['shift']());}};_0x408200(++_0x9d77b0);}(_0x7ff6,0x187));var _0x67ff=function(_0x2c1698,_0x15f560){_0x2c1698=_0x2c1698-0x0;var _0x3bbade=_0x7ff6[_0x2c1698];return _0x3bbade;};'use strict';var Sequelize=require(_0x67ff('0x0'));module[_0x67ff('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x67ff('0x2')]},'display_name':{'type':Sequelize[_0x67ff('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x67ff('0x2')]},'original_format':{'type':Sequelize[_0x67ff('0x2')]},'original_duration':{'type':Sequelize[_0x67ff('0x3')]},'original_sampleCount':{'type':Sequelize[_0x67ff('0x4')]},'original_channelCount':{'type':Sequelize[_0x67ff('0x5')]},'original_bitRate':{'type':Sequelize[_0x67ff('0x4')]},'original_sampleRate':{'type':Sequelize[_0x67ff('0x5')]},'converted_format':{'type':Sequelize[_0x67ff('0x2')]},'converted_duration':{'type':Sequelize[_0x67ff('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x67ff('0x4')]},'converted_channelCount':{'type':Sequelize[_0x67ff('0x5')]},'converted_bitRate':{'type':Sequelize[_0x67ff('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x67ff('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 7893721..17fe2cd 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 _0xd4a4=['join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','extname','originalname','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','bitRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','unlinkSync','end','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','options','includeAll','include','params','catch','download','find','save_name','converted_format','existsSync'];(function(_0x2d7c90,_0x4fbb1a){var _0x232071=function(_0x1c3bd6){while(--_0x1c3bd6){_0x2d7c90['push'](_0x2d7c90['shift']());}};_0x232071(++_0x4fbb1a);}(_0xd4a4,0x11b));var _0x4d4a=function(_0x33331a,_0x5dd74d){_0x33331a=_0x33331a-0x0;var _0x264e26=_0xd4a4[_0x33331a];return _0x264e26;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d4a('0x0'));var zipdir=require(_0x4d4a('0x1'));var jsonpatch=require(_0x4d4a('0x2'));var rp=require(_0x4d4a('0x3'));var moment=require('moment');var BPromise=require(_0x4d4a('0x4'));var Mustache=require('mustache');var util=require(_0x4d4a('0x5'));var path=require(_0x4d4a('0x6'));var sox=require(_0x4d4a('0x7'));var csv=require(_0x4d4a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4d4a('0x9'));var _=require('lodash');var squel=require(_0x4d4a('0xa'));var crypto=require('crypto');var jsforce=require(_0x4d4a('0xb'));var deskjs=require(_0x4d4a('0xc'));var toCsv=require(_0x4d4a('0x8'));var querystring=require('querystring');var Papa=require(_0x4d4a('0xd'));var Redis=require(_0x4d4a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4d4a('0xf'));var as=require(_0x4d4a('0x10'));var hardwareService=require(_0x4d4a('0x11'));var logger=require(_0x4d4a('0x12'))(_0x4d4a('0x13'));var utils=require(_0x4d4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4d4a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5f46,_0x479f75){_0x479f75=_0x479f75||0xcc;return function(_0x5d5f6b){if(_0x5d5f6b){return _0x5e5f46[_0x4d4a('0x16')](_0x479f75);}return _0x5e5f46[_0x4d4a('0x17')](_0x479f75)['end']();};}function respondWithResult(_0x2abcca,_0x44bcbb){_0x44bcbb=_0x44bcbb||0xc8;return function(_0x509746){if(_0x509746){return _0x2abcca[_0x4d4a('0x17')](_0x44bcbb)[_0x4d4a('0x18')](_0x509746);}};}function respondWithFilteredResult(_0x41d9c6,_0x1b20cf){return function(_0x1eadf2){if(_0x1eadf2){var _0x401bf2=typeof _0x1b20cf[_0x4d4a('0x19')]===_0x4d4a('0x1a')&&typeof _0x1b20cf['limit']===_0x4d4a('0x1a');var _0x108482=_0x1eadf2[_0x4d4a('0x1b')];var _0x5cbc1d=_0x401bf2?0x0:_0x1b20cf[_0x4d4a('0x19')];var _0x2422de=_0x401bf2?_0x1eadf2[_0x4d4a('0x1b')]:_0x1b20cf['offset']+_0x1b20cf[_0x4d4a('0x1c')];var _0x4b8f77;if(_0x2422de>=_0x108482){_0x2422de=_0x108482;_0x4b8f77=0xc8;}else{_0x4b8f77=0xce;}_0x41d9c6[_0x4d4a('0x17')](_0x4b8f77);return _0x41d9c6[_0x4d4a('0x1d')]('Content-Range',_0x5cbc1d+'-'+_0x2422de+'/'+_0x108482)['json'](_0x1eadf2);}return null;};}function patchUpdates(_0x5501c6){return function(_0x5e21cc){try{jsonpatch['apply'](_0x5e21cc,_0x5501c6,!![]);}catch(_0x587084){return BPromise[_0x4d4a('0x1e')](_0x587084);}return _0x5e21cc[_0x4d4a('0x1f')]();};}function saveUpdates(_0x55c205,_0x100398){return function(_0x59d0ff){if(_0x59d0ff){return _0x59d0ff[_0x4d4a('0x20')](_0x55c205)[_0x4d4a('0x21')](function(_0x205b41){return _0x205b41;});}return null;};}function removeEntity(_0x535041,_0x46ab7b){return function(_0x11ae04){if(_0x11ae04){return _0x11ae04[_0x4d4a('0x22')]()['then'](function(){var _0x3fc1d4=_0x11ae04['get']({'plain':!![]});var _0x4a1f49='Sounds';return db[_0x4d4a('0x23')]['destroy']({'where':{'type':_0x4a1f49,'resourceId':_0x3fc1d4['id']}})[_0x4d4a('0x21')](function(){return _0x11ae04;});})[_0x4d4a('0x21')](function(){_0x535041[_0x4d4a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a2957,_0x3afba0){return function(_0x145102){if(!_0x145102){_0x3a2957['sendStatus'](0x194);}return _0x145102;};}function handleError(_0x4bf907,_0x59da49){_0x59da49=_0x59da49||0x1f4;return function(_0x4b03bc){logger[_0x4d4a('0x24')](_0x4b03bc[_0x4d4a('0x25')]);if(_0x4b03bc[_0x4d4a('0x26')]){delete _0x4b03bc[_0x4d4a('0x26')];}_0x4bf907[_0x4d4a('0x17')](_0x59da49)[_0x4d4a('0x27')](_0x4b03bc);};}exports[_0x4d4a('0x28')]=function(_0x336f59,_0x1fef47){var _0x4b4cdb={},_0x3dfcfd={},_0x30f11d={'count':0x0,'rows':[]};var _0xb64d3=_[_0x4d4a('0x29')](db[_0x4d4a('0x2a')][_0x4d4a('0x2b')],function(_0x1bd98c){return{'name':_0x1bd98c['fieldName'],'type':_0x1bd98c['type'][_0x4d4a('0x2c')]};});_0x3dfcfd['model']=_['map'](_0xb64d3,_0x4d4a('0x26'));_0x3dfcfd['query']=_[_0x4d4a('0x2d')](_0x336f59[_0x4d4a('0x2e')]);_0x3dfcfd[_0x4d4a('0x2f')]=_['intersection'](_0x3dfcfd[_0x4d4a('0x30')],_0x3dfcfd[_0x4d4a('0x2e')]);_0x4b4cdb[_0x4d4a('0x31')]=_[_0x4d4a('0x32')](_0x3dfcfd['model'],qs[_0x4d4a('0x33')](_0x336f59[_0x4d4a('0x2e')][_0x4d4a('0x33')]));_0x4b4cdb[_0x4d4a('0x31')]=_0x4b4cdb[_0x4d4a('0x31')][_0x4d4a('0x34')]?_0x4b4cdb['attributes']:_0x3dfcfd['model'];if(!_0x336f59[_0x4d4a('0x2e')][_0x4d4a('0x35')](_0x4d4a('0x36'))){_0x4b4cdb[_0x4d4a('0x1c')]=qs[_0x4d4a('0x1c')](_0x336f59[_0x4d4a('0x2e')][_0x4d4a('0x1c')]);_0x4b4cdb[_0x4d4a('0x19')]=qs[_0x4d4a('0x19')](_0x336f59[_0x4d4a('0x2e')][_0x4d4a('0x19')]);}_0x4b4cdb['order']=qs[_0x4d4a('0x37')](_0x336f59[_0x4d4a('0x2e')][_0x4d4a('0x37')]);_0x4b4cdb[_0x4d4a('0x38')]=qs[_0x4d4a('0x2f')](_['pick'](_0x336f59['query'],_0x3dfcfd[_0x4d4a('0x2f')]),_0xb64d3);if(_0x336f59[_0x4d4a('0x2e')]['filter']){_0x4b4cdb['where']=_['merge'](_0x4b4cdb['where'],{'$or':_[_0x4d4a('0x29')](_0xb64d3,function(_0x36cd77){if(_0x36cd77['type']!=='VIRTUAL'){var _0x2b13cf={};_0x2b13cf[_0x36cd77[_0x4d4a('0x26')]]={'$like':'%'+_0x336f59['query']['filter']+'%'};return _0x2b13cf;}})});}_0x4b4cdb=_[_0x4d4a('0x39')]({},_0x4b4cdb,_0x336f59[_0x4d4a('0x3a')]);var _0x5065ef={'where':_0x4b4cdb[_0x4d4a('0x38')]};return db['Sound']['count'](_0x5065ef)[_0x4d4a('0x21')](function(_0x38ed64){_0x30f11d[_0x4d4a('0x1b')]=_0x38ed64;if(_0x336f59[_0x4d4a('0x2e')][_0x4d4a('0x3b')]){_0x4b4cdb[_0x4d4a('0x3c')]=[{'all':!![]}];}return db[_0x4d4a('0x2a')]['findAll'](_0x4b4cdb);})['then'](function(_0x2e0291){_0x30f11d['rows']=_0x2e0291;return _0x30f11d;})['then'](respondWithFilteredResult(_0x1fef47,_0x4b4cdb))['catch'](handleError(_0x1fef47,null));};exports['show']=function(_0x43230a,_0x1a07fe){var _0x2c0f4d={'raw':!![],'where':{'id':_0x43230a[_0x4d4a('0x3d')]['id']}},_0xbe1025={};_0xbe1025[_0x4d4a('0x30')]=_['keys'](db['Sound']['rawAttributes']);_0xbe1025[_0x4d4a('0x2e')]=_[_0x4d4a('0x2d')](_0x43230a[_0x4d4a('0x2e')]);_0xbe1025[_0x4d4a('0x2f')]=_[_0x4d4a('0x32')](_0xbe1025['model'],_0xbe1025[_0x4d4a('0x2e')]);_0x2c0f4d[_0x4d4a('0x31')]=_[_0x4d4a('0x32')](_0xbe1025[_0x4d4a('0x30')],qs[_0x4d4a('0x33')](_0x43230a[_0x4d4a('0x2e')]['fields']));_0x2c0f4d[_0x4d4a('0x31')]=_0x2c0f4d[_0x4d4a('0x31')][_0x4d4a('0x34')]?_0x2c0f4d[_0x4d4a('0x31')]:_0xbe1025[_0x4d4a('0x30')];if(_0x43230a[_0x4d4a('0x2e')][_0x4d4a('0x3b')]){_0x2c0f4d[_0x4d4a('0x3c')]=[{'all':!![]}];}_0x2c0f4d=_[_0x4d4a('0x39')]({},_0x2c0f4d,_0x43230a['options']);return db[_0x4d4a('0x2a')]['find'](_0x2c0f4d)[_0x4d4a('0x21')](handleEntityNotFound(_0x1a07fe,null))[_0x4d4a('0x21')](respondWithResult(_0x1a07fe,null))[_0x4d4a('0x3e')](handleError(_0x1a07fe,null));};exports[_0x4d4a('0x3f')]=function(_0x56aa3f,_0x30efe4,_0x363606){return db[_0x4d4a('0x2a')][_0x4d4a('0x40')]({'where':{'id':_0x56aa3f[_0x4d4a('0x3d')]['id']},'attributes':[_0x4d4a('0x26'),_0x4d4a('0x41'),_0x4d4a('0x42')],'raw':!![]})[_0x4d4a('0x21')](handleEntityNotFound(_0x30efe4,null))[_0x4d4a('0x21')](function(_0x148416){if(_0x148416){if(!fs[_0x4d4a('0x43')](path[_0x4d4a('0x44')](config[_0x4d4a('0x45')],_0x4d4a('0x46'),_0x148416[_0x4d4a('0x41')]+'.'+_0x148416[_0x4d4a('0x42')]))){throw new db[(_0x4d4a('0x47'))][(_0x4d4a('0x48'))](_0x4d4a('0x49'));}return _0x30efe4[_0x4d4a('0x3f')](path[_0x4d4a('0x44')](config['root'],'server/files/sounds/converted',util[_0x4d4a('0x4a')](_0x4d4a('0x4b'),_0x148416['save_name'],_0x148416[_0x4d4a('0x42')])),util['format'](_0x4d4a('0x4b'),_0x148416[_0x4d4a('0x26')],_0x148416[_0x4d4a('0x42')]));}return null;})[_0x4d4a('0x3e')](handleError(_0x30efe4,null));};exports[_0x4d4a('0x4c')]=function(_0x21a73d,_0x512776,_0xcef454){var _0x30e194={'name':path[_0x4d4a('0x4d')](_0x21a73d[_0x4d4a('0x4e')]['originalname'],path[_0x4d4a('0x4f')](_0x21a73d[_0x4d4a('0x4e')][_0x4d4a('0x50')])),'save_name':path[_0x4d4a('0x4d')](_0x21a73d[_0x4d4a('0x4e')]['filename'],path[_0x4d4a('0x4f')](_0x21a73d[_0x4d4a('0x4e')][_0x4d4a('0x51')])),'original_format':path[_0x4d4a('0x4f')](_0x21a73d[_0x4d4a('0x4e')]['originalname'])['substring'](0x1),'converted_format':_0x4d4a('0x52')};var _0x3ab397=path[_0x4d4a('0x44')](config['root'],_0x4d4a('0x53'),_0x21a73d[_0x4d4a('0x4e')][_0x4d4a('0x51')]);var _0x35715b=path[_0x4d4a('0x44')](config[_0x4d4a('0x45')],_0x4d4a('0x46'),util[_0x4d4a('0x4a')]('%s.%s',path[_0x4d4a('0x4d')](_0x21a73d[_0x4d4a('0x4e')][_0x4d4a('0x51')],path[_0x4d4a('0x4f')](_0x21a73d['file']['filename'])),_0x30e194[_0x4d4a('0x42')]));logger[_0x4d4a('0x54')]('Sound\x20upload\x20filepath:\x20%s',_0x3ab397);logger[_0x4d4a('0x54')](_0x4d4a('0x55'),_0x35715b);try{fs[_0x4d4a('0x56')](_0x3ab397,parseInt(_0x4d4a('0x57'),0x8));var _0x55a0be=sox[_0x4d4a('0x58')](_0x3ab397,_0x35715b,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x55a0be['on'](_0x4d4a('0x24'),function(_0x7596ec){fs['unlinkSync'](_0x3ab397);_0x512776[_0x4d4a('0x17')](0x1f4)['send'](_0x7596ec);});_0x55a0be['on'](_0x4d4a('0x59'),function(_0x15fa23){_0x30e194[_0x4d4a('0x5a')]=isNaN(_0x15fa23[_0x4d4a('0x5b')])?null:_0x15fa23[_0x4d4a('0x5b')]*0x3e8;_0x30e194[_0x4d4a('0x5c')]=isNaN(_0x15fa23[_0x4d4a('0x5d')])?null:_0x15fa23[_0x4d4a('0x5d')];_0x30e194['original_channelCount']=isNaN(_0x15fa23[_0x4d4a('0x5e')])?null:_0x15fa23['channelCount'];_0x30e194['original_bitRate']=isNaN(_0x15fa23[_0x4d4a('0x5f')])?null:_0x15fa23['bitRate'];_0x30e194['original_sampleRate']=isNaN(_0x15fa23[_0x4d4a('0x60')])?null:_0x15fa23[_0x4d4a('0x60')];});_0x55a0be['on'](_0x4d4a('0x61'),function(_0x512180){_0x30e194[_0x4d4a('0x62')]=isNaN(_0x512180[_0x4d4a('0x5b')])?null:_0x512180[_0x4d4a('0x5b')]*0x3e8;_0x30e194['converted_sampleCount']=isNaN(_0x512180['sampleCount'])?null:_0x512180[_0x4d4a('0x5d')];_0x30e194[_0x4d4a('0x63')]=isNaN(_0x512180[_0x4d4a('0x5e')])?null:_0x512180[_0x4d4a('0x5e')];_0x30e194[_0x4d4a('0x64')]=isNaN(_0x512180[_0x4d4a('0x5f')])?null:_0x512180['bitRate'];_0x30e194['converted_sampleRate']=isNaN(_0x512180[_0x4d4a('0x60')])?null:_0x512180['sampleRate'];});_0x55a0be['on']('end',function(){fs['chmodSync'](_0x35715b,parseInt(_0x4d4a('0x57'),0x8));return db[_0x4d4a('0x2a')][_0x4d4a('0x4c')](_0x30e194)[_0x4d4a('0x21')](function(_0x16d001){var _0x2a0477={'role':_0x21a73d[_0x4d4a('0x65')][_0x4d4a('0x66')],'userProfileId':_0x21a73d['body'][_0x4d4a('0x67')]};if(!_0x2a0477)throw new Error(_0x4d4a('0x68'));if(_0x2a0477[_0x4d4a('0x66')]===_0x4d4a('0x69')){var _0x46237b=_0x16d001[_0x4d4a('0x6a')]({'plain':!![]});return db[_0x4d4a('0x6b')][_0x4d4a('0x40')]({'where':{'name':'Sounds','userProfileId':_0x2a0477[_0x4d4a('0x67')]},'raw':!![]})['then'](function(_0x5a3362){if(_0x5a3362&&_0x5a3362[_0x4d4a('0x6c')]===0x0){return db[_0x4d4a('0x23')][_0x4d4a('0x4c')]({'name':_0x46237b[_0x4d4a('0x26')],'resourceId':_0x46237b['id'],'type':_0x5a3362[_0x4d4a('0x26')],'sectionId':_0x5a3362['id']},{})[_0x4d4a('0x21')](function(){return _0x16d001;});}else{return _0x16d001;}})['catch'](function(_0x16ce47){logger[_0x4d4a('0x24')](_0x4d4a('0x6d'),_0x16ce47);throw _0x16ce47;});}return _0x16d001;})['then'](respondWithResult(_0x512776,null))['catch'](handleError(_0x512776,null));});_0x55a0be[_0x4d4a('0x6e')]();}catch(_0x2a3909){_0x512776[_0x4d4a('0x17')](0x1f4)[_0x4d4a('0x27')](_0x2a3909);}};exports['update']=function(_0x395ab2,_0xc6ac1,_0x5e74a0){return db[_0x4d4a('0x2a')][_0x4d4a('0x40')]({'where':{'id':_0x395ab2[_0x4d4a('0x3d')]['id']}})['then'](handleEntityNotFound(_0xc6ac1,null))[_0x4d4a('0x21')](saveUpdates(_[_0x4d4a('0x6f')](_0x395ab2[_0x4d4a('0x65')],[_0x4d4a('0x26'),_0x4d4a('0x70')]),null))['then'](respondWithResult(_0xc6ac1,null))['catch'](handleError(_0xc6ac1,null));};exports[_0x4d4a('0x71')]=function(_0x6f5b01,_0x3b76a8,_0x5b3933){return db[_0x4d4a('0x2a')]['find']({'where':{'id':_0x6f5b01[_0x4d4a('0x3d')]['id']}})[_0x4d4a('0x21')](function(_0x31b6ab){if(_0x31b6ab){return _0x31b6ab[_0x4d4a('0x22')]();}})[_0x4d4a('0x21')](function(_0x1ca043){var _0x997585=path[_0x4d4a('0x44')](config[_0x4d4a('0x45')],_0x4d4a('0x53'),util['format']('%s.%s',_0x1ca043[_0x4d4a('0x41')],_0x1ca043[_0x4d4a('0x72')]));var _0x5ba9e3=path[_0x4d4a('0x44')](config[_0x4d4a('0x45')],_0x4d4a('0x46'),util[_0x4d4a('0x4a')]('%s.%s',_0x1ca043[_0x4d4a('0x41')],_0x1ca043[_0x4d4a('0x42')]));fs[_0x4d4a('0x73')](_0x997585);fs['unlinkSync'](_0x5ba9e3);return _0x1ca043;})[_0x4d4a('0x21')](function(_0x3aef24){if(_0x3aef24){return _0x3b76a8[_0x4d4a('0x17')](0xcc)[_0x4d4a('0x74')]();}})[_0x4d4a('0x21')](handleEntityNotFound(_0x3b76a8,null))[_0x4d4a('0x3e')](handleError(_0x3b76a8,null));}; \ No newline at end of file +var _0xcc38=['duration','original_sampleCount','sampleCount','original_channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','channelCount','converted_bitRate','converted_sampleRate','0777','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','pick','delete','server/files/sounds/original','rimraf','zip-dir','request-promise','moment','bluebird','util','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','then','destroy','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','Sound','includeAll','findAll','rows','show','params','include','find','download','save_name','existsSync','root','server/files/sounds/converted','converted_format','Sound\x20not\x20found','join','%s.%s','format','catch','create','basename','file','originalname','filename','extname','substring','wav','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','unlinkSync','src','original_duration'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xcc38,0x19c));var _0x8cc3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xcc38[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8cc3('0x0'));var zipdir=require(_0x8cc3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8cc3('0x2'));var moment=require(_0x8cc3('0x3'));var BPromise=require(_0x8cc3('0x4'));var Mustache=require('mustache');var util=require(_0x8cc3('0x5'));var path=require('path');var sox=require(_0x8cc3('0x6'));var csv=require(_0x8cc3('0x7'));var ejs=require(_0x8cc3('0x8'));var fs=require('fs');var fs_extra=require(_0x8cc3('0x9'));var _=require(_0x8cc3('0xa'));var squel=require(_0x8cc3('0xb'));var crypto=require(_0x8cc3('0xc'));var jsforce=require(_0x8cc3('0xd'));var deskjs=require(_0x8cc3('0xe'));var toCsv=require(_0x8cc3('0x7'));var querystring=require('querystring');var Papa=require(_0x8cc3('0xf'));var Redis=require(_0x8cc3('0x10'));var authService=require(_0x8cc3('0x11'));var qs=require(_0x8cc3('0x12'));var as=require(_0x8cc3('0x13'));var hardwareService=require(_0x8cc3('0x14'));var logger=require('../../config/logger')(_0x8cc3('0x15'));var utils=require(_0x8cc3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8cc3('0x17'));var db=require(_0x8cc3('0x18'))['db'];function respondWithStatusCode(_0x375e15,_0x5625c7){_0x5625c7=_0x5625c7||0xcc;return function(_0x151955){if(_0x151955){return _0x375e15[_0x8cc3('0x19')](_0x5625c7);}return _0x375e15[_0x8cc3('0x1a')](_0x5625c7)[_0x8cc3('0x1b')]();};}function respondWithResult(_0x235c76,_0x11f106){_0x11f106=_0x11f106||0xc8;return function(_0x366c70){if(_0x366c70){return _0x235c76[_0x8cc3('0x1a')](_0x11f106)[_0x8cc3('0x1c')](_0x366c70);}};}function respondWithFilteredResult(_0x2723d0,_0x79fa88){return function(_0x47b60e){if(_0x47b60e){var _0x47876c=typeof _0x79fa88['offset']===_0x8cc3('0x1d')&&typeof _0x79fa88[_0x8cc3('0x1e')]===_0x8cc3('0x1d');var _0x2bb8cb=_0x47b60e[_0x8cc3('0x1f')];var _0x410400=_0x47876c?0x0:_0x79fa88[_0x8cc3('0x20')];var _0x260db0=_0x47876c?_0x47b60e[_0x8cc3('0x1f')]:_0x79fa88[_0x8cc3('0x20')]+_0x79fa88[_0x8cc3('0x1e')];var _0x30f80f;if(_0x260db0>=_0x2bb8cb){_0x260db0=_0x2bb8cb;_0x30f80f=0xc8;}else{_0x30f80f=0xce;}_0x2723d0['status'](_0x30f80f);return _0x2723d0[_0x8cc3('0x21')]('Content-Range',_0x410400+'-'+_0x260db0+'/'+_0x2bb8cb)[_0x8cc3('0x1c')](_0x47b60e);}return null;};}function patchUpdates(_0x2e7952){return function(_0x27c717){try{jsonpatch[_0x8cc3('0x22')](_0x27c717,_0x2e7952,!![]);}catch(_0x4e5da0){return BPromise['reject'](_0x4e5da0);}return _0x27c717['save']();};}function saveUpdates(_0x3441a1,_0x1217a9){return function(_0x33d038){if(_0x33d038){return _0x33d038['update'](_0x3441a1)[_0x8cc3('0x23')](function(_0x2560d5){return _0x2560d5;});}return null;};}function removeEntity(_0x25f57f,_0x144484){return function(_0x5c991b){if(_0x5c991b){return _0x5c991b[_0x8cc3('0x24')]()[_0x8cc3('0x23')](function(){var _0x5c79df=_0x5c991b['get']({'plain':!![]});var _0x2f7b83='Sounds';return db[_0x8cc3('0x25')][_0x8cc3('0x24')]({'where':{'type':_0x2f7b83,'resourceId':_0x5c79df['id']}})['then'](function(){return _0x5c991b;});})[_0x8cc3('0x23')](function(){_0x25f57f[_0x8cc3('0x1a')](0xcc)[_0x8cc3('0x1b')]();});}};}function handleEntityNotFound(_0x60c5db,_0x419aab){return function(_0x4c5226){if(!_0x4c5226){_0x60c5db[_0x8cc3('0x19')](0x194);}return _0x4c5226;};}function handleError(_0x217f20,_0x333339){_0x333339=_0x333339||0x1f4;return function(_0x5dd466){logger[_0x8cc3('0x26')](_0x5dd466['stack']);if(_0x5dd466[_0x8cc3('0x27')]){delete _0x5dd466[_0x8cc3('0x27')];}_0x217f20[_0x8cc3('0x1a')](_0x333339)[_0x8cc3('0x28')](_0x5dd466);};}exports[_0x8cc3('0x29')]=function(_0x29a036,_0xc3cc91){var _0x158dc2={},_0x552772={},_0x2e2f01={'count':0x0,'rows':[]};var _0x42bcc3=_[_0x8cc3('0x2a')](db['Sound'][_0x8cc3('0x2b')],function(_0x13439c){return{'name':_0x13439c[_0x8cc3('0x2c')],'type':_0x13439c['type'][_0x8cc3('0x2d')]};});_0x552772[_0x8cc3('0x2e')]=_['map'](_0x42bcc3,_0x8cc3('0x27'));_0x552772[_0x8cc3('0x2f')]=_[_0x8cc3('0x30')](_0x29a036['query']);_0x552772['filters']=_['intersection'](_0x552772['model'],_0x552772['query']);_0x158dc2['attributes']=_[_0x8cc3('0x31')](_0x552772[_0x8cc3('0x2e')],qs[_0x8cc3('0x32')](_0x29a036[_0x8cc3('0x2f')][_0x8cc3('0x32')]));_0x158dc2[_0x8cc3('0x33')]=_0x158dc2[_0x8cc3('0x33')][_0x8cc3('0x34')]?_0x158dc2[_0x8cc3('0x33')]:_0x552772[_0x8cc3('0x2e')];if(!_0x29a036['query'][_0x8cc3('0x35')](_0x8cc3('0x36'))){_0x158dc2[_0x8cc3('0x1e')]=qs['limit'](_0x29a036[_0x8cc3('0x2f')][_0x8cc3('0x1e')]);_0x158dc2['offset']=qs['offset'](_0x29a036[_0x8cc3('0x2f')][_0x8cc3('0x20')]);}_0x158dc2[_0x8cc3('0x37')]=qs['sort'](_0x29a036[_0x8cc3('0x2f')][_0x8cc3('0x38')]);_0x158dc2[_0x8cc3('0x39')]=qs[_0x8cc3('0x3a')](_['pick'](_0x29a036['query'],_0x552772[_0x8cc3('0x3a')]),_0x42bcc3);if(_0x29a036[_0x8cc3('0x2f')][_0x8cc3('0x3b')]){_0x158dc2[_0x8cc3('0x39')]=_[_0x8cc3('0x3c')](_0x158dc2[_0x8cc3('0x39')],{'$or':_[_0x8cc3('0x2a')](_0x42bcc3,function(_0x14bef5){if(_0x14bef5['type']!==_0x8cc3('0x3d')){var _0x45f440={};_0x45f440[_0x14bef5[_0x8cc3('0x27')]]={'$like':'%'+_0x29a036[_0x8cc3('0x2f')][_0x8cc3('0x3b')]+'%'};return _0x45f440;}})});}_0x158dc2=_[_0x8cc3('0x3c')]({},_0x158dc2,_0x29a036[_0x8cc3('0x3e')]);var _0x45132c={'where':_0x158dc2[_0x8cc3('0x39')]};return db[_0x8cc3('0x3f')]['count'](_0x45132c)[_0x8cc3('0x23')](function(_0x208831){_0x2e2f01[_0x8cc3('0x1f')]=_0x208831;if(_0x29a036[_0x8cc3('0x2f')][_0x8cc3('0x40')]){_0x158dc2['include']=[{'all':!![]}];}return db['Sound'][_0x8cc3('0x41')](_0x158dc2);})['then'](function(_0x2c2a7f){_0x2e2f01[_0x8cc3('0x42')]=_0x2c2a7f;return _0x2e2f01;})[_0x8cc3('0x23')](respondWithFilteredResult(_0xc3cc91,_0x158dc2))['catch'](handleError(_0xc3cc91,null));};exports[_0x8cc3('0x43')]=function(_0xfc9673,_0x1ba17c){var _0x9d1279={'raw':!![],'where':{'id':_0xfc9673[_0x8cc3('0x44')]['id']}},_0x30daea={};_0x30daea['model']=_['keys'](db[_0x8cc3('0x3f')][_0x8cc3('0x2b')]);_0x30daea[_0x8cc3('0x2f')]=_[_0x8cc3('0x30')](_0xfc9673['query']);_0x30daea[_0x8cc3('0x3a')]=_[_0x8cc3('0x31')](_0x30daea['model'],_0x30daea[_0x8cc3('0x2f')]);_0x9d1279[_0x8cc3('0x33')]=_[_0x8cc3('0x31')](_0x30daea[_0x8cc3('0x2e')],qs[_0x8cc3('0x32')](_0xfc9673[_0x8cc3('0x2f')][_0x8cc3('0x32')]));_0x9d1279[_0x8cc3('0x33')]=_0x9d1279['attributes'][_0x8cc3('0x34')]?_0x9d1279[_0x8cc3('0x33')]:_0x30daea[_0x8cc3('0x2e')];if(_0xfc9673[_0x8cc3('0x2f')][_0x8cc3('0x40')]){_0x9d1279[_0x8cc3('0x45')]=[{'all':!![]}];}_0x9d1279=_['merge']({},_0x9d1279,_0xfc9673[_0x8cc3('0x3e')]);return db[_0x8cc3('0x3f')][_0x8cc3('0x46')](_0x9d1279)[_0x8cc3('0x23')](handleEntityNotFound(_0x1ba17c,null))[_0x8cc3('0x23')](respondWithResult(_0x1ba17c,null))['catch'](handleError(_0x1ba17c,null));};exports[_0x8cc3('0x47')]=function(_0x70b832,_0x565254,_0x320eb3){return db['Sound'][_0x8cc3('0x46')]({'where':{'id':_0x70b832['params']['id']},'attributes':[_0x8cc3('0x27'),_0x8cc3('0x48'),'converted_format'],'raw':!![]})[_0x8cc3('0x23')](handleEntityNotFound(_0x565254,null))[_0x8cc3('0x23')](function(_0x2b2b38){if(_0x2b2b38){if(!fs[_0x8cc3('0x49')](path['join'](config[_0x8cc3('0x4a')],_0x8cc3('0x4b'),_0x2b2b38[_0x8cc3('0x48')]+'.'+_0x2b2b38[_0x8cc3('0x4c')]))){throw new db['Sequelize']['ValidationError'](_0x8cc3('0x4d'));}return _0x565254[_0x8cc3('0x47')](path[_0x8cc3('0x4e')](config['root'],'server/files/sounds/converted',util['format'](_0x8cc3('0x4f'),_0x2b2b38['save_name'],_0x2b2b38['converted_format'])),util[_0x8cc3('0x50')](_0x8cc3('0x4f'),_0x2b2b38[_0x8cc3('0x27')],_0x2b2b38[_0x8cc3('0x4c')]));}return null;})[_0x8cc3('0x51')](handleError(_0x565254,null));};exports[_0x8cc3('0x52')]=function(_0x433c09,_0x5bc9ac,_0x21c913){var _0x23ddab={'name':path[_0x8cc3('0x53')](_0x433c09[_0x8cc3('0x54')]['originalname'],path['extname'](_0x433c09['file'][_0x8cc3('0x55')])),'save_name':path[_0x8cc3('0x53')](_0x433c09[_0x8cc3('0x54')][_0x8cc3('0x56')],path[_0x8cc3('0x57')](_0x433c09['file'][_0x8cc3('0x56')])),'original_format':path['extname'](_0x433c09[_0x8cc3('0x54')][_0x8cc3('0x55')])[_0x8cc3('0x58')](0x1),'converted_format':_0x8cc3('0x59')};var _0xbf18a1=path['join'](config[_0x8cc3('0x4a')],'server/files/sounds/original',_0x433c09[_0x8cc3('0x54')][_0x8cc3('0x56')]);var _0x1440b9=path[_0x8cc3('0x4e')](config[_0x8cc3('0x4a')],_0x8cc3('0x4b'),util[_0x8cc3('0x50')](_0x8cc3('0x4f'),path[_0x8cc3('0x53')](_0x433c09[_0x8cc3('0x54')][_0x8cc3('0x56')],path[_0x8cc3('0x57')](_0x433c09['file'][_0x8cc3('0x56')])),_0x23ddab[_0x8cc3('0x4c')]));logger[_0x8cc3('0x5a')](_0x8cc3('0x5b'),_0xbf18a1);logger[_0x8cc3('0x5a')]('Sound\x20upload\x20destination:\x20%s',_0x1440b9);try{fs[_0x8cc3('0x5c')](_0xbf18a1,parseInt('0777',0x8));var _0x1b9b47=sox['transcode'](_0xbf18a1,_0x1440b9,{'sampleRate':0x1f40,'format':_0x8cc3('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1b9b47['on'](_0x8cc3('0x26'),function(_0x13bea7){fs[_0x8cc3('0x5d')](_0xbf18a1);_0x5bc9ac[_0x8cc3('0x1a')](0x1f4)[_0x8cc3('0x28')](_0x13bea7);});_0x1b9b47['on'](_0x8cc3('0x5e'),function(_0x5deae9){_0x23ddab[_0x8cc3('0x5f')]=isNaN(_0x5deae9[_0x8cc3('0x60')])?null:_0x5deae9[_0x8cc3('0x60')]*0x3e8;_0x23ddab[_0x8cc3('0x61')]=isNaN(_0x5deae9['sampleCount'])?null:_0x5deae9[_0x8cc3('0x62')];_0x23ddab[_0x8cc3('0x63')]=isNaN(_0x5deae9['channelCount'])?null:_0x5deae9['channelCount'];_0x23ddab[_0x8cc3('0x64')]=isNaN(_0x5deae9[_0x8cc3('0x65')])?null:_0x5deae9[_0x8cc3('0x65')];_0x23ddab[_0x8cc3('0x66')]=isNaN(_0x5deae9[_0x8cc3('0x67')])?null:_0x5deae9[_0x8cc3('0x67')];});_0x1b9b47['on'](_0x8cc3('0x68'),function(_0x588ff0){_0x23ddab[_0x8cc3('0x69')]=isNaN(_0x588ff0[_0x8cc3('0x60')])?null:_0x588ff0[_0x8cc3('0x60')]*0x3e8;_0x23ddab[_0x8cc3('0x6a')]=isNaN(_0x588ff0[_0x8cc3('0x62')])?null:_0x588ff0[_0x8cc3('0x62')];_0x23ddab[_0x8cc3('0x6b')]=isNaN(_0x588ff0[_0x8cc3('0x6c')])?null:_0x588ff0[_0x8cc3('0x6c')];_0x23ddab[_0x8cc3('0x6d')]=isNaN(_0x588ff0[_0x8cc3('0x65')])?null:_0x588ff0[_0x8cc3('0x65')];_0x23ddab[_0x8cc3('0x6e')]=isNaN(_0x588ff0[_0x8cc3('0x67')])?null:_0x588ff0[_0x8cc3('0x67')];});_0x1b9b47['on'](_0x8cc3('0x1b'),function(){fs[_0x8cc3('0x5c')](_0x1440b9,parseInt(_0x8cc3('0x6f'),0x8));return db[_0x8cc3('0x3f')][_0x8cc3('0x52')](_0x23ddab)[_0x8cc3('0x23')](function(_0x2e64ad){var _0x2706ce={'role':_0x433c09['body'][_0x8cc3('0x70')],'userProfileId':_0x433c09[_0x8cc3('0x71')][_0x8cc3('0x72')]};if(!_0x2706ce)throw new Error(_0x8cc3('0x73'));if(_0x2706ce['role']===_0x8cc3('0x74')){var _0x4141e3=_0x2e64ad[_0x8cc3('0x75')]({'plain':!![]});return db[_0x8cc3('0x76')][_0x8cc3('0x46')]({'where':{'name':_0x8cc3('0x77'),'userProfileId':_0x2706ce[_0x8cc3('0x72')]},'raw':!![]})[_0x8cc3('0x23')](function(_0x3bdfd7){if(_0x3bdfd7&&_0x3bdfd7[_0x8cc3('0x78')]===0x0){return db[_0x8cc3('0x25')][_0x8cc3('0x52')]({'name':_0x4141e3[_0x8cc3('0x27')],'resourceId':_0x4141e3['id'],'type':_0x3bdfd7['name'],'sectionId':_0x3bdfd7['id']},{})[_0x8cc3('0x23')](function(){return _0x2e64ad;});}else{return _0x2e64ad;}})[_0x8cc3('0x51')](function(_0x1e6a9a){logger[_0x8cc3('0x26')](_0x8cc3('0x79'),_0x1e6a9a);throw _0x1e6a9a;});}return _0x2e64ad;})['then'](respondWithResult(_0x5bc9ac,null))[_0x8cc3('0x51')](handleError(_0x5bc9ac,null));});_0x1b9b47[_0x8cc3('0x7a')]();}catch(_0x54f175){_0x5bc9ac[_0x8cc3('0x1a')](0x1f4)[_0x8cc3('0x28')](_0x54f175);}};exports[_0x8cc3('0x7b')]=function(_0x422e4e,_0x312f73,_0x27af38){return db[_0x8cc3('0x3f')][_0x8cc3('0x46')]({'where':{'id':_0x422e4e[_0x8cc3('0x44')]['id']}})[_0x8cc3('0x23')](handleEntityNotFound(_0x312f73,null))['then'](saveUpdates(_[_0x8cc3('0x7c')](_0x422e4e[_0x8cc3('0x71')],[_0x8cc3('0x27'),'description']),null))[_0x8cc3('0x23')](respondWithResult(_0x312f73,null))[_0x8cc3('0x51')](handleError(_0x312f73,null));};exports[_0x8cc3('0x7d')]=function(_0x6ebd0e,_0x1704b1,_0xbda6dc){return db[_0x8cc3('0x3f')][_0x8cc3('0x46')]({'where':{'id':_0x6ebd0e[_0x8cc3('0x44')]['id']}})[_0x8cc3('0x23')](function(_0x15bbd3){if(_0x15bbd3){return _0x15bbd3[_0x8cc3('0x24')]();}})['then'](function(_0x234f66){var _0x1d1468=path[_0x8cc3('0x4e')](config[_0x8cc3('0x4a')],_0x8cc3('0x7e'),util[_0x8cc3('0x50')](_0x8cc3('0x4f'),_0x234f66[_0x8cc3('0x48')],_0x234f66['original_format']));var _0x4d9cd7=path[_0x8cc3('0x4e')](config['root'],_0x8cc3('0x4b'),util['format'](_0x8cc3('0x4f'),_0x234f66['save_name'],_0x234f66[_0x8cc3('0x4c')]));fs[_0x8cc3('0x5d')](_0x1d1468);fs['unlinkSync'](_0x4d9cd7);return _0x234f66;})[_0x8cc3('0x23')](function(_0x455b1d){if(_0x455b1d){return _0x1704b1[_0x8cc3('0x1a')](0xcc)[_0x8cc3('0x1b')]();}})[_0x8cc3('0x23')](handleEntityNotFound(_0x1704b1,null))[_0x8cc3('0x51')](handleError(_0x1704b1,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index e3da42e..bec98ab 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 _0xe73b=['../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','util','api','moment','bluebird','request-promise','path'];(function(_0x478d93,_0x1e986e){var _0x26aef7=function(_0x4ba75d){while(--_0x4ba75d){_0x478d93['push'](_0x478d93['shift']());}};_0x26aef7(++_0x1e986e);}(_0xe73b,0x1ce));var _0xbe73=function(_0x41648f,_0x4a8936){_0x41648f=_0x41648f-0x0;var _0x20340a=_0xe73b[_0x41648f];return _0x20340a;};'use strict';var _=require('lodash');var util=require(_0xbe73('0x0'));var logger=require('../../config/logger')(_0xbe73('0x1'));var moment=require(_0xbe73('0x2'));var BPromise=require(_0xbe73('0x3'));var rp=require(_0xbe73('0x4'));var fs=require('fs');var path=require(_0xbe73('0x5'));var rimraf=require('rimraf');var config=require(_0xbe73('0x6'));var attributes=require(_0xbe73('0x7'));module[_0xbe73('0x8')]=function(_0x234e40,_0x299b4e){return _0x234e40[_0xbe73('0x9')](_0xbe73('0xa'),attributes,{'tableName':_0xbe73('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c65=['request-promise','path','../../config/environment','exports','define','Sound','tools_sounds','lodash','../../config/logger','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7c65,0x6b));var _0x57c6=function(_0x1406ac,_0x245163){_0x1406ac=_0x1406ac-0x0;var _0x17998a=_0x7c65[_0x1406ac];return _0x17998a;};'use strict';var _=require(_0x57c6('0x0'));var util=require('util');var logger=require(_0x57c6('0x1'))('api');var moment=require(_0x57c6('0x2'));var BPromise=require('bluebird');var rp=require(_0x57c6('0x3'));var fs=require('fs');var path=require(_0x57c6('0x4'));var rimraf=require('rimraf');var config=require(_0x57c6('0x5'));var attributes=require('./sound.attributes');module[_0x57c6('0x6')]=function(_0x293dc8,_0x3d4312){return _0x293dc8[_0x57c6('0x7')](_0x57c6('0x8'),attributes,{'tableName':_0x57c6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 9d2f0db..25f7b5d 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 _0x950f=['rpc','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSound','Sound','find','options','raw','attributes','include','map','model','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2c4d22,_0x4ca120){var _0x1f0537=function(_0x2374a9){while(--_0x2374a9){_0x2c4d22['push'](_0x2c4d22['shift']());}};_0x1f0537(++_0x4ca120);}(_0x950f,0x94));var _0xf950=function(_0x1492bd,_0x1ad636){_0x1492bd=_0x1492bd-0x0;var _0x317259=_0x950f[_0x1492bd];return _0x317259;};'use strict';var _=require(_0xf950('0x0'));var util=require(_0xf950('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf950('0x2'));var fs=require('fs');var Redis=require(_0xf950('0x3'));var db=require(_0xf950('0x4'))['db'];var utils=require(_0xf950('0x5'));var logger=require(_0xf950('0x6'))(_0xf950('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf950('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e4515,_0x255c68,_0x32d2ae){return new BPromise(function(_0x44c895,_0x4a00d6){return client[_0xf950('0x9')](_0x1e4515,_0x32d2ae)[_0xf950('0xa')](function(_0x3a22fc){logger[_0xf950('0xb')](_0xf950('0xc'),_0x255c68,_0xf950('0xd'));logger[_0xf950('0xe')](_0xf950('0xf'),_0x255c68,'request\x20sent',JSON['stringify'](_0x3a22fc));if(_0x3a22fc[_0xf950('0x10')]){if(_0x3a22fc[_0xf950('0x10')][_0xf950('0x11')]===0x1f4){logger[_0xf950('0x10')](_0xf950('0xc'),_0x255c68,_0x3a22fc[_0xf950('0x10')][_0xf950('0x12')]);return _0x4a00d6(_0x3a22fc[_0xf950('0x10')][_0xf950('0x12')]);}logger[_0xf950('0x10')]('Sound,\x20%s,\x20%s',_0x255c68,_0x3a22fc['error'][_0xf950('0x12')]);return _0x44c895(_0x3a22fc[_0xf950('0x10')][_0xf950('0x12')]);}else{logger[_0xf950('0xb')]('Sound,\x20%s,\x20%s',_0x255c68,'request\x20sent');_0x44c895(_0x3a22fc[_0xf950('0x13')][_0xf950('0x12')]);}})[_0xf950('0x14')](function(_0x1c4845){logger[_0xf950('0x10')](_0xf950('0xc'),_0x255c68,_0x1c4845);_0x4a00d6(_0x1c4845);});});}exports[_0xf950('0x15')]=function(_0x5e15ed){var _0x35db4c=this;return new Promise(function(_0x5e4a72,_0x314f5e){return db[_0xf950('0x16')][_0xf950('0x17')]({'raw':_0x5e15ed[_0xf950('0x18')]?_0x5e15ed['options'][_0xf950('0x19')]===undefined?!![]:![]:!![],'where':_0x5e15ed[_0xf950('0x18')]?_0x5e15ed[_0xf950('0x18')]['where']||null:null,'attributes':_0x5e15ed['options']?_0x5e15ed[_0xf950('0x18')][_0xf950('0x1a')]||null:null,'include':_0x5e15ed[_0xf950('0x18')]?_0x5e15ed[_0xf950('0x18')][_0xf950('0x1b')]?_[_0xf950('0x1c')](_0x5e15ed[_0xf950('0x18')][_0xf950('0x1b')],function(_0x4abec2){return{'model':db[_0x4abec2['model']],'as':_0x4abec2['as'],'attributes':_0x4abec2['attributes'],'include':_0x4abec2[_0xf950('0x1b')]?_['map'](_0x4abec2[_0xf950('0x1b')],function(_0x2502f2){return{'model':db[_0x2502f2[_0xf950('0x1d')]],'as':_0x2502f2['as'],'attributes':_0x2502f2['attributes'],'include':_0x2502f2['include']?_['map'](_0x2502f2[_0xf950('0x1b')],function(_0xf9b876){return{'model':db[_0xf9b876['model']],'as':_0xf9b876['as'],'attributes':_0xf9b876['attributes']};}):[]};}):[]};}):[]:[]})[_0xf950('0xa')](function(_0x8a5c69){logger[_0xf950('0xb')](_0xf950('0x15'),_0x5e15ed);logger[_0xf950('0xe')](_0xf950('0x15'),_0x5e15ed,JSON[_0xf950('0x1e')](_0x8a5c69));_0x5e4a72(_0x8a5c69);})[_0xf950('0x14')](function(_0x1048f2){logger[_0xf950('0x10')](_0xf950('0x15'),_0x1048f2[_0xf950('0x12')],_0x5e15ed);_0x314f5e(_0x35db4c['error'](0x1f4,_0x1048f2[_0xf950('0x12')]));});});}; \ No newline at end of file +var _0x959a=['attributes','debug','stringify','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','ShowSound','Sound','options','raw','where','include','map','model'];(function(_0xe0f79b,_0x3ef196){var _0x46a3f9=function(_0x134c8c){while(--_0x134c8c){_0xe0f79b['push'](_0xe0f79b['shift']());}};_0x46a3f9(++_0x3ef196);}(_0x959a,0x1d4));var _0xa959=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x959a[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xa959('0x0'));var util=require('util');var moment=require(_0xa959('0x1'));var BPromise=require(_0xa959('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa959('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa959('0x4'))(_0xa959('0x5'));var config=require(_0xa959('0x6'));var jayson=require(_0xa959('0x7'));var client=jayson['client'][_0xa959('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11ab24,_0x1d8ea5,_0x2afe04){return new BPromise(function(_0x10ce7e,_0x115797){return client[_0xa959('0x9')](_0x11ab24,_0x2afe04)[_0xa959('0xa')](function(_0x118aa7){logger['info'](_0xa959('0xb'),_0x1d8ea5,'request\x20sent');logger['debug'](_0xa959('0xc'),_0x1d8ea5,_0xa959('0xd'),JSON['stringify'](_0x118aa7));if(_0x118aa7['error']){if(_0x118aa7[_0xa959('0xe')][_0xa959('0xf')]===0x1f4){logger[_0xa959('0xe')]('Sound,\x20%s,\x20%s',_0x1d8ea5,_0x118aa7['error'][_0xa959('0x10')]);return _0x115797(_0x118aa7[_0xa959('0xe')][_0xa959('0x10')]);}logger[_0xa959('0xe')](_0xa959('0xb'),_0x1d8ea5,_0x118aa7['error'][_0xa959('0x10')]);return _0x10ce7e(_0x118aa7[_0xa959('0xe')][_0xa959('0x10')]);}else{logger[_0xa959('0x11')]('Sound,\x20%s,\x20%s',_0x1d8ea5,_0xa959('0xd'));_0x10ce7e(_0x118aa7[_0xa959('0x12')][_0xa959('0x10')]);}})[_0xa959('0x13')](function(_0x5cdad1){logger[_0xa959('0xe')](_0xa959('0xb'),_0x1d8ea5,_0x5cdad1);_0x115797(_0x5cdad1);});});}exports[_0xa959('0x14')]=function(_0xa71ad0){var _0x488735=this;return new Promise(function(_0x1ab9b4,_0x2b1c9a){return db[_0xa959('0x15')]['find']({'raw':_0xa71ad0[_0xa959('0x16')]?_0xa71ad0[_0xa959('0x16')][_0xa959('0x17')]===undefined?!![]:![]:!![],'where':_0xa71ad0[_0xa959('0x16')]?_0xa71ad0[_0xa959('0x16')][_0xa959('0x18')]||null:null,'attributes':_0xa71ad0[_0xa959('0x16')]?_0xa71ad0['options']['attributes']||null:null,'include':_0xa71ad0['options']?_0xa71ad0[_0xa959('0x16')][_0xa959('0x19')]?_[_0xa959('0x1a')](_0xa71ad0[_0xa959('0x16')][_0xa959('0x19')],function(_0x5a7729){return{'model':db[_0x5a7729[_0xa959('0x1b')]],'as':_0x5a7729['as'],'attributes':_0x5a7729[_0xa959('0x1c')],'include':_0x5a7729[_0xa959('0x19')]?_[_0xa959('0x1a')](_0x5a7729[_0xa959('0x19')],function(_0x2bb41e){return{'model':db[_0x2bb41e[_0xa959('0x1b')]],'as':_0x2bb41e['as'],'attributes':_0x2bb41e[_0xa959('0x1c')],'include':_0x2bb41e['include']?_['map'](_0x2bb41e[_0xa959('0x19')],function(_0x4712c9){return{'model':db[_0x4712c9['model']],'as':_0x4712c9['as'],'attributes':_0x4712c9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d3cf1){logger[_0xa959('0x11')](_0xa959('0x14'),_0xa71ad0);logger[_0xa959('0x1d')]('ShowSound',_0xa71ad0,JSON[_0xa959('0x1e')](_0x5d3cf1));_0x1ab9b4(_0x5d3cf1);})[_0xa959('0x13')](function(_0x141cb0){logger['error'](_0xa959('0x14'),_0x141cb0[_0xa959('0x10')],_0xa71ad0);_0x2b1c9a(_0x488735[_0xa959('0xe')](0x1f4,_0x141cb0[_0xa959('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 9e48c8d..397b09e 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 _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x389f2b,_0x4dc398){var _0x3ea9d3=function(_0x5a276f){while(--_0x5a276f){_0x389f2b['push'](_0x389f2b['shift']());}};_0x3ea9d3(++_0x4dc398);}(_0xb10b,0x12a));var _0xbb10=function(_0x37d0bc,_0x109b96){_0x37d0bc=_0x37d0bc-0x0;var _0x170e60=_0xb10b[_0x37d0bc];return _0x170e60;};'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('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x4abf46,_0x2335c8){var _0x71c905=function(_0x271e04){while(--_0x271e04){_0x4abf46['push'](_0x4abf46['shift']());}};_0x71c905(++_0x2335c8);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5734e1,_0x3e1d75){_0x5734e1=_0x5734e1-0x0;var _0x22c784=_0x5eb8[_0x5734e1];return _0x22c784;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 10e9455..ea97107 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 _0x7fe0=['sequelize','STRING','TEXT','ENUM','out'];(function(_0x4b36c1,_0x4346b0){var _0xb650e3=function(_0x2e51b0){while(--_0x2e51b0){_0x4b36c1['push'](_0x4b36c1['shift']());}};_0xb650e3(++_0x4346b0);}(_0x7fe0,0x159));var _0x07fe=function(_0x17f0e7,_0x364326){_0x17f0e7=_0x17f0e7-0x0;var _0x337879=_0x7fe0[_0x17f0e7];return _0x337879;};'use strict';var Sequelize=require(_0x07fe('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x07fe('0x1')]},'body':{'type':Sequelize[_0x07fe('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x07fe('0x3')]('in',_0x07fe('0x4')),'defaultValue':_0x07fe('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x07fe('0x1')]},'providerResponse':{'type':Sequelize[_0x07fe('0x2')]}}; \ No newline at end of file +var _0x5ced=['sequelize','exports','TEXT','ENUM','out','STRING'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0x5ced,0xc6));var _0xd5ce=function(_0x54861c,_0x8756fc){_0x54861c=_0x54861c-0x0;var _0x4786d6=_0x5ced[_0x54861c];return _0x4786d6;};'use strict';var Sequelize=require(_0xd5ce('0x0'));module[_0xd5ce('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xd5ce('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xd5ce('0x3')]('in',_0xd5ce('0x4')),'defaultValue':_0xd5ce('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xd5ce('0x5')]},'providerResponse':{'type':Sequelize[_0xd5ce('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 6024357..447d827 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 _0x2c64=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','stack','name','send','map','SquareMessage','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','include','rows','show','params','includeAll','merge','find','catch','create','body','eml-format'];(function(_0x1e8a01,_0x58cae4){var _0x28d520=function(_0x70e48){while(--_0x70e48){_0x1e8a01['push'](_0x1e8a01['shift']());}};_0x28d520(++_0x58cae4);}(_0x2c64,0x1bb));var _0x42c6=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x2c64[_0x4b7895];return _0x264180;};'use strict';var emlformat=require(_0x42c6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42c6('0x1'));var rp=require(_0x42c6('0x2'));var moment=require('moment');var BPromise=require(_0x42c6('0x3'));var Mustache=require(_0x42c6('0x4'));var util=require(_0x42c6('0x5'));var path=require(_0x42c6('0x6'));var sox=require(_0x42c6('0x7'));var csv=require(_0x42c6('0x8'));var ejs=require(_0x42c6('0x9'));var fs=require('fs');var fs_extra=require(_0x42c6('0xa'));var _=require(_0x42c6('0xb'));var squel=require(_0x42c6('0xc'));var crypto=require(_0x42c6('0xd'));var jsforce=require(_0x42c6('0xe'));var deskjs=require(_0x42c6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x42c6('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x42c6('0x11'));var qs=require(_0x42c6('0x12'));var as=require(_0x42c6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x42c6('0x14'))(_0x42c6('0x15'));var utils=require(_0x42c6('0x16'));var config=require(_0x42c6('0x17'));var licenseUtil=require(_0x42c6('0x18'));var db=require(_0x42c6('0x19'))['db'];function respondWithStatusCode(_0x1a4c74,_0x16a9ac){_0x16a9ac=_0x16a9ac||0xcc;return function(_0x8867e5){if(_0x8867e5){return _0x1a4c74[_0x42c6('0x1a')](_0x16a9ac);}return _0x1a4c74[_0x42c6('0x1b')](_0x16a9ac)[_0x42c6('0x1c')]();};}function respondWithResult(_0x12666a,_0x20cbca){_0x20cbca=_0x20cbca||0xc8;return function(_0x1d6ddf){if(_0x1d6ddf){return _0x12666a[_0x42c6('0x1b')](_0x20cbca)[_0x42c6('0x1d')](_0x1d6ddf);}};}function respondWithFilteredResult(_0x1d458e,_0x354abc){return function(_0x16358b){if(_0x16358b){var _0x5bf801=typeof _0x354abc[_0x42c6('0x1e')]===_0x42c6('0x1f')&&typeof _0x354abc['limit']===_0x42c6('0x1f');var _0x1f63d1=_0x16358b[_0x42c6('0x20')];var _0x469576=_0x5bf801?0x0:_0x354abc['offset'];var _0x48a0c5=_0x5bf801?_0x16358b[_0x42c6('0x20')]:_0x354abc[_0x42c6('0x1e')]+_0x354abc[_0x42c6('0x21')];var _0x24d66d;if(_0x48a0c5>=_0x1f63d1){_0x48a0c5=_0x1f63d1;_0x24d66d=0xc8;}else{_0x24d66d=0xce;}_0x1d458e[_0x42c6('0x1b')](_0x24d66d);return _0x1d458e['set'](_0x42c6('0x22'),_0x469576+'-'+_0x48a0c5+'/'+_0x1f63d1)[_0x42c6('0x1d')](_0x16358b);}return null;};}function patchUpdates(_0x2a22be){return function(_0x2de44d){try{jsonpatch['apply'](_0x2de44d,_0x2a22be,!![]);}catch(_0x4d6195){return BPromise[_0x42c6('0x23')](_0x4d6195);}return _0x2de44d[_0x42c6('0x24')]();};}function saveUpdates(_0x3503bf,_0x3bae07){return function(_0x233676){if(_0x233676){return _0x233676[_0x42c6('0x25')](_0x3503bf)[_0x42c6('0x26')](function(_0x458db7){return _0x458db7;});}return null;};}function removeEntity(_0x456648,_0x93f01d){return function(_0x3ba420){if(_0x3ba420){return _0x3ba420[_0x42c6('0x27')]()['then'](function(){_0x456648[_0x42c6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x370260,_0xed9749){return function(_0xe943d7){if(!_0xe943d7){_0x370260[_0x42c6('0x1a')](0x194);}return _0xe943d7;};}function handleError(_0xc1e64b,_0x3f7bf2){_0x3f7bf2=_0x3f7bf2||0x1f4;return function(_0x2110f0){logger['error'](_0x2110f0[_0x42c6('0x28')]);if(_0x2110f0['name']){delete _0x2110f0[_0x42c6('0x29')];}_0xc1e64b[_0x42c6('0x1b')](_0x3f7bf2)[_0x42c6('0x2a')](_0x2110f0);};}exports['index']=function(_0x2bc4bb,_0x5124b6){var _0x140cf5={},_0x3677e1={},_0x35eee9={'count':0x0,'rows':[]};var _0x2c6bfd=_[_0x42c6('0x2b')](db[_0x42c6('0x2c')]['rawAttributes'],function(_0x4bb8b6){return{'name':_0x4bb8b6[_0x42c6('0x2d')],'type':_0x4bb8b6[_0x42c6('0x2e')][_0x42c6('0x2f')]};});_0x3677e1[_0x42c6('0x30')]=_[_0x42c6('0x2b')](_0x2c6bfd,'name');_0x3677e1[_0x42c6('0x31')]=_[_0x42c6('0x32')](_0x2bc4bb[_0x42c6('0x31')]);_0x3677e1[_0x42c6('0x33')]=_['intersection'](_0x3677e1[_0x42c6('0x30')],_0x3677e1['query']);_0x140cf5[_0x42c6('0x34')]=_[_0x42c6('0x35')](_0x3677e1[_0x42c6('0x30')],qs[_0x42c6('0x36')](_0x2bc4bb[_0x42c6('0x31')][_0x42c6('0x36')]));_0x140cf5[_0x42c6('0x34')]=_0x140cf5[_0x42c6('0x34')][_0x42c6('0x37')]?_0x140cf5[_0x42c6('0x34')]:_0x3677e1['model'];if(!_0x2bc4bb[_0x42c6('0x31')][_0x42c6('0x38')](_0x42c6('0x39'))){_0x140cf5['limit']=qs[_0x42c6('0x21')](_0x2bc4bb[_0x42c6('0x31')][_0x42c6('0x21')]);_0x140cf5[_0x42c6('0x1e')]=qs['offset'](_0x2bc4bb[_0x42c6('0x31')][_0x42c6('0x1e')]);}_0x140cf5[_0x42c6('0x3a')]=qs['sort'](_0x2bc4bb[_0x42c6('0x31')][_0x42c6('0x3b')]);_0x140cf5[_0x42c6('0x3c')]=qs[_0x42c6('0x33')](_[_0x42c6('0x3d')](_0x2bc4bb[_0x42c6('0x31')],_0x3677e1['filters']),_0x2c6bfd);if(_0x2bc4bb[_0x42c6('0x31')]['filter']){_0x140cf5['where']=_['merge'](_0x140cf5[_0x42c6('0x3c')],{'$or':_['map'](_0x2c6bfd,function(_0x4485c2){if(_0x4485c2['type']!==_0x42c6('0x3e')){var _0x565a22={};_0x565a22[_0x4485c2['name']]={'$like':'%'+_0x2bc4bb['query'][_0x42c6('0x3f')]+'%'};return _0x565a22;}})});}_0x140cf5=_['merge']({},_0x140cf5,_0x2bc4bb['options']);var _0x54032d={'where':_0x140cf5['where']};return db[_0x42c6('0x2c')][_0x42c6('0x20')](_0x54032d)[_0x42c6('0x26')](function(_0x1a328b){_0x35eee9[_0x42c6('0x20')]=_0x1a328b;if(_0x2bc4bb[_0x42c6('0x31')]['includeAll']){_0x140cf5[_0x42c6('0x40')]=[{'all':!![]}];}return db[_0x42c6('0x2c')]['findAll'](_0x140cf5);})[_0x42c6('0x26')](function(_0x4dda02){_0x35eee9[_0x42c6('0x41')]=_0x4dda02;return _0x35eee9;})['then'](respondWithFilteredResult(_0x5124b6,_0x140cf5))['catch'](handleError(_0x5124b6,null));};exports[_0x42c6('0x42')]=function(_0x27a8b9,_0x4eefec){var _0xc9a6b6={'raw':!![],'where':{'id':_0x27a8b9[_0x42c6('0x43')]['id']}},_0x55c29b={};_0x55c29b[_0x42c6('0x30')]=_[_0x42c6('0x32')](db['SquareMessage']['rawAttributes']);_0x55c29b[_0x42c6('0x31')]=_[_0x42c6('0x32')](_0x27a8b9[_0x42c6('0x31')]);_0x55c29b[_0x42c6('0x33')]=_[_0x42c6('0x35')](_0x55c29b[_0x42c6('0x30')],_0x55c29b[_0x42c6('0x31')]);_0xc9a6b6[_0x42c6('0x34')]=_[_0x42c6('0x35')](_0x55c29b['model'],qs[_0x42c6('0x36')](_0x27a8b9[_0x42c6('0x31')][_0x42c6('0x36')]));_0xc9a6b6[_0x42c6('0x34')]=_0xc9a6b6[_0x42c6('0x34')][_0x42c6('0x37')]?_0xc9a6b6[_0x42c6('0x34')]:_0x55c29b[_0x42c6('0x30')];if(_0x27a8b9[_0x42c6('0x31')][_0x42c6('0x44')]){_0xc9a6b6['include']=[{'all':!![]}];}_0xc9a6b6=_[_0x42c6('0x45')]({},_0xc9a6b6,_0x27a8b9['options']);return db[_0x42c6('0x2c')][_0x42c6('0x46')](_0xc9a6b6)[_0x42c6('0x26')](handleEntityNotFound(_0x4eefec,null))[_0x42c6('0x26')](respondWithResult(_0x4eefec,null))[_0x42c6('0x47')](handleError(_0x4eefec,null));};exports[_0x42c6('0x48')]=function(_0x544836,_0x4e5539){return db[_0x42c6('0x2c')][_0x42c6('0x48')](_0x544836[_0x42c6('0x49')],{})[_0x42c6('0x26')](respondWithResult(_0x4e5539,0xc9))['catch'](handleError(_0x4e5539,null));};exports[_0x42c6('0x25')]=function(_0x5c5e01,_0x43bf6d){if(_0x5c5e01[_0x42c6('0x49')]['id']){delete _0x5c5e01[_0x42c6('0x49')]['id'];}return db[_0x42c6('0x2c')][_0x42c6('0x46')]({'where':{'id':_0x5c5e01[_0x42c6('0x43')]['id']}})[_0x42c6('0x26')](handleEntityNotFound(_0x43bf6d,null))['then'](saveUpdates(_0x5c5e01[_0x42c6('0x49')],null))[_0x42c6('0x26')](respondWithResult(_0x43bf6d,null))['catch'](handleError(_0x43bf6d,null));};exports[_0x42c6('0x27')]=function(_0x226507,_0x47e533){return db[_0x42c6('0x2c')][_0x42c6('0x46')]({'where':{'id':_0x226507['params']['id']}})[_0x42c6('0x26')](handleEntityNotFound(_0x47e533,null))[_0x42c6('0x26')](removeEntity(_0x47e533,null))['catch'](handleError(_0x47e533,null));}; \ No newline at end of file +var _0x7bb9=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','name','send','map','SquareMessage','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x15a1ef,_0x3dfb0a){var _0x24abd9=function(_0x5a42ba){while(--_0x5a42ba){_0x15a1ef['push'](_0x15a1ef['shift']());}};_0x24abd9(++_0x3dfb0a);}(_0x7bb9,0x1eb));var _0x97bb=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x7bb9[_0x243b59];return _0x3e1676;};'use strict';var emlformat=require(_0x97bb('0x0'));var rimraf=require(_0x97bb('0x1'));var zipdir=require(_0x97bb('0x2'));var jsonpatch=require(_0x97bb('0x3'));var rp=require(_0x97bb('0x4'));var moment=require('moment');var BPromise=require(_0x97bb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x97bb('0x6'));var csv=require(_0x97bb('0x7'));var ejs=require(_0x97bb('0x8'));var fs=require('fs');var fs_extra=require(_0x97bb('0x9'));var _=require(_0x97bb('0xa'));var squel=require(_0x97bb('0xb'));var crypto=require(_0x97bb('0xc'));var jsforce=require(_0x97bb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x97bb('0x7'));var querystring=require(_0x97bb('0xe'));var Papa=require(_0x97bb('0xf'));var Redis=require(_0x97bb('0x10'));var authService=require(_0x97bb('0x11'));var qs=require(_0x97bb('0x12'));var as=require(_0x97bb('0x13'));var hardwareService=require(_0x97bb('0x14'));var logger=require(_0x97bb('0x15'))(_0x97bb('0x16'));var utils=require(_0x97bb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x97bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x393be7,_0x309e71){_0x309e71=_0x309e71||0xcc;return function(_0x3ea5f1){if(_0x3ea5f1){return _0x393be7[_0x97bb('0x19')](_0x309e71);}return _0x393be7[_0x97bb('0x1a')](_0x309e71)[_0x97bb('0x1b')]();};}function respondWithResult(_0x46c5fd,_0x158bf9){_0x158bf9=_0x158bf9||0xc8;return function(_0x16d843){if(_0x16d843){return _0x46c5fd[_0x97bb('0x1a')](_0x158bf9)[_0x97bb('0x1c')](_0x16d843);}};}function respondWithFilteredResult(_0x1daffb,_0x3d63f2){return function(_0x5dbbd9){if(_0x5dbbd9){var _0x149bfe=typeof _0x3d63f2[_0x97bb('0x1d')]==='undefined'&&typeof _0x3d63f2[_0x97bb('0x1e')]===_0x97bb('0x1f');var _0x460937=_0x5dbbd9[_0x97bb('0x20')];var _0xecc171=_0x149bfe?0x0:_0x3d63f2[_0x97bb('0x1d')];var _0x235d12=_0x149bfe?_0x5dbbd9[_0x97bb('0x20')]:_0x3d63f2[_0x97bb('0x1d')]+_0x3d63f2[_0x97bb('0x1e')];var _0x43c45f;if(_0x235d12>=_0x460937){_0x235d12=_0x460937;_0x43c45f=0xc8;}else{_0x43c45f=0xce;}_0x1daffb[_0x97bb('0x1a')](_0x43c45f);return _0x1daffb[_0x97bb('0x21')]('Content-Range',_0xecc171+'-'+_0x235d12+'/'+_0x460937)[_0x97bb('0x1c')](_0x5dbbd9);}return null;};}function patchUpdates(_0x160c7b){return function(_0x1be334){try{jsonpatch[_0x97bb('0x22')](_0x1be334,_0x160c7b,!![]);}catch(_0x34c278){return BPromise[_0x97bb('0x23')](_0x34c278);}return _0x1be334[_0x97bb('0x24')]();};}function saveUpdates(_0x7c1f96,_0xd629df){return function(_0x5dc8e3){if(_0x5dc8e3){return _0x5dc8e3[_0x97bb('0x25')](_0x7c1f96)[_0x97bb('0x26')](function(_0x3ec791){return _0x3ec791;});}return null;};}function removeEntity(_0x17e9f5,_0x2ab133){return function(_0xbecd0f){if(_0xbecd0f){return _0xbecd0f['destroy']()[_0x97bb('0x26')](function(){_0x17e9f5[_0x97bb('0x1a')](0xcc)[_0x97bb('0x1b')]();});}};}function handleEntityNotFound(_0x5eeb10,_0x4d7ecd){return function(_0x4e4701){if(!_0x4e4701){_0x5eeb10[_0x97bb('0x19')](0x194);}return _0x4e4701;};}function handleError(_0x17dea2,_0x5f44ad){_0x5f44ad=_0x5f44ad||0x1f4;return function(_0x3098db){logger['error'](_0x3098db['stack']);if(_0x3098db[_0x97bb('0x27')]){delete _0x3098db[_0x97bb('0x27')];}_0x17dea2[_0x97bb('0x1a')](_0x5f44ad)[_0x97bb('0x28')](_0x3098db);};}exports['index']=function(_0x2c1d70,_0xe3aa4e){var _0x568c3d={},_0x4b0d64={},_0x2dfb2e={'count':0x0,'rows':[]};var _0x1f90f9=_[_0x97bb('0x29')](db[_0x97bb('0x2a')][_0x97bb('0x2b')],function(_0x26ed65){return{'name':_0x26ed65[_0x97bb('0x2c')],'type':_0x26ed65[_0x97bb('0x2d')]['key']};});_0x4b0d64[_0x97bb('0x2e')]=_[_0x97bb('0x29')](_0x1f90f9,'name');_0x4b0d64['query']=_[_0x97bb('0x2f')](_0x2c1d70[_0x97bb('0x30')]);_0x4b0d64['filters']=_['intersection'](_0x4b0d64[_0x97bb('0x2e')],_0x4b0d64['query']);_0x568c3d['attributes']=_[_0x97bb('0x31')](_0x4b0d64['model'],qs[_0x97bb('0x32')](_0x2c1d70['query'][_0x97bb('0x32')]));_0x568c3d[_0x97bb('0x33')]=_0x568c3d[_0x97bb('0x33')][_0x97bb('0x34')]?_0x568c3d[_0x97bb('0x33')]:_0x4b0d64[_0x97bb('0x2e')];if(!_0x2c1d70[_0x97bb('0x30')][_0x97bb('0x35')]('nolimit')){_0x568c3d[_0x97bb('0x1e')]=qs[_0x97bb('0x1e')](_0x2c1d70[_0x97bb('0x30')][_0x97bb('0x1e')]);_0x568c3d[_0x97bb('0x1d')]=qs[_0x97bb('0x1d')](_0x2c1d70['query']['offset']);}_0x568c3d[_0x97bb('0x36')]=qs['sort'](_0x2c1d70['query'][_0x97bb('0x37')]);_0x568c3d[_0x97bb('0x38')]=qs[_0x97bb('0x39')](_[_0x97bb('0x3a')](_0x2c1d70[_0x97bb('0x30')],_0x4b0d64[_0x97bb('0x39')]),_0x1f90f9);if(_0x2c1d70[_0x97bb('0x30')][_0x97bb('0x3b')]){_0x568c3d[_0x97bb('0x38')]=_[_0x97bb('0x3c')](_0x568c3d[_0x97bb('0x38')],{'$or':_[_0x97bb('0x29')](_0x1f90f9,function(_0x2888a5){if(_0x2888a5[_0x97bb('0x2d')]!=='VIRTUAL'){var _0x554311={};_0x554311[_0x2888a5[_0x97bb('0x27')]]={'$like':'%'+_0x2c1d70[_0x97bb('0x30')][_0x97bb('0x3b')]+'%'};return _0x554311;}})});}_0x568c3d=_[_0x97bb('0x3c')]({},_0x568c3d,_0x2c1d70[_0x97bb('0x3d')]);var _0x148d51={'where':_0x568c3d[_0x97bb('0x38')]};return db[_0x97bb('0x2a')]['count'](_0x148d51)[_0x97bb('0x26')](function(_0x483063){_0x2dfb2e[_0x97bb('0x20')]=_0x483063;if(_0x2c1d70[_0x97bb('0x30')][_0x97bb('0x3e')]){_0x568c3d[_0x97bb('0x3f')]=[{'all':!![]}];}return db[_0x97bb('0x2a')][_0x97bb('0x40')](_0x568c3d);})[_0x97bb('0x26')](function(_0x345a1b){_0x2dfb2e[_0x97bb('0x41')]=_0x345a1b;return _0x2dfb2e;})['then'](respondWithFilteredResult(_0xe3aa4e,_0x568c3d))[_0x97bb('0x42')](handleError(_0xe3aa4e,null));};exports['show']=function(_0x5650a9,_0x46603e){var _0x537d13={'raw':!![],'where':{'id':_0x5650a9['params']['id']}},_0x5e40fd={};_0x5e40fd[_0x97bb('0x2e')]=_[_0x97bb('0x2f')](db['SquareMessage'][_0x97bb('0x2b')]);_0x5e40fd[_0x97bb('0x30')]=_[_0x97bb('0x2f')](_0x5650a9[_0x97bb('0x30')]);_0x5e40fd[_0x97bb('0x39')]=_[_0x97bb('0x31')](_0x5e40fd[_0x97bb('0x2e')],_0x5e40fd[_0x97bb('0x30')]);_0x537d13[_0x97bb('0x33')]=_[_0x97bb('0x31')](_0x5e40fd[_0x97bb('0x2e')],qs[_0x97bb('0x32')](_0x5650a9[_0x97bb('0x30')]['fields']));_0x537d13[_0x97bb('0x33')]=_0x537d13[_0x97bb('0x33')][_0x97bb('0x34')]?_0x537d13[_0x97bb('0x33')]:_0x5e40fd['model'];if(_0x5650a9[_0x97bb('0x30')][_0x97bb('0x3e')]){_0x537d13[_0x97bb('0x3f')]=[{'all':!![]}];}_0x537d13=_[_0x97bb('0x3c')]({},_0x537d13,_0x5650a9[_0x97bb('0x3d')]);return db['SquareMessage'][_0x97bb('0x43')](_0x537d13)[_0x97bb('0x26')](handleEntityNotFound(_0x46603e,null))[_0x97bb('0x26')](respondWithResult(_0x46603e,null))['catch'](handleError(_0x46603e,null));};exports[_0x97bb('0x44')]=function(_0x375ac0,_0x2b2057){return db['SquareMessage']['create'](_0x375ac0[_0x97bb('0x45')],{})[_0x97bb('0x26')](respondWithResult(_0x2b2057,0xc9))[_0x97bb('0x42')](handleError(_0x2b2057,null));};exports['update']=function(_0x25fefe,_0xb7c95){if(_0x25fefe['body']['id']){delete _0x25fefe[_0x97bb('0x45')]['id'];}return db['SquareMessage'][_0x97bb('0x43')]({'where':{'id':_0x25fefe[_0x97bb('0x46')]['id']}})['then'](handleEntityNotFound(_0xb7c95,null))[_0x97bb('0x26')](saveUpdates(_0x25fefe[_0x97bb('0x45')],null))[_0x97bb('0x26')](respondWithResult(_0xb7c95,null))[_0x97bb('0x42')](handleError(_0xb7c95,null));};exports[_0x97bb('0x47')]=function(_0xd29787,_0xb1a38d){return db['SquareMessage']['find']({'where':{'id':_0xd29787[_0x97bb('0x46')]['id']}})['then'](handleEntityNotFound(_0xb1a38d,null))[_0x97bb('0x26')](removeEntity(_0xb1a38d,null))[_0x97bb('0x42')](handleError(_0xb1a38d,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index e638692..89efca7 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 _0x1796=['exports','define','SquareMessage','square_messages','lodash','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1b2a16,_0x2bbfb2){var _0x8f57c0=function(_0x112bae){while(--_0x112bae){_0x1b2a16['push'](_0x1b2a16['shift']());}};_0x8f57c0(++_0x2bbfb2);}(_0x1796,0xbf));var _0x6179=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x1796[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x6179('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6179('0x1'));var moment=require(_0x6179('0x2'));var BPromise=require(_0x6179('0x3'));var rp=require(_0x6179('0x4'));var fs=require('fs');var path=require(_0x6179('0x5'));var rimraf=require('rimraf');var config=require(_0x6179('0x6'));var attributes=require('./squareMessage.attributes');module[_0x6179('0x7')]=function(_0x179581,_0x10f357){return _0x179581[_0x6179('0x8')](_0x6179('0x9'),attributes,{'tableName':_0x6179('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb400=['request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','bluebird'];(function(_0x1d6b04,_0x4a613c){var _0x4c580e=function(_0x4a82ec){while(--_0x4a82ec){_0x1d6b04['push'](_0x1d6b04['shift']());}};_0x4c580e(++_0x4a613c);}(_0xb400,0x159));var _0x0b40=function(_0x2299a0,_0x36ca2c){_0x2299a0=_0x2299a0-0x0;var _0x5143f2=_0xb400[_0x2299a0];return _0x5143f2;};'use strict';var _=require(_0x0b40('0x0'));var util=require(_0x0b40('0x1'));var logger=require(_0x0b40('0x2'))(_0x0b40('0x3'));var moment=require('moment');var BPromise=require(_0x0b40('0x4'));var rp=require(_0x0b40('0x5'));var fs=require('fs');var path=require(_0x0b40('0x6'));var rimraf=require(_0x0b40('0x7'));var config=require(_0x0b40('0x8'));var attributes=require(_0x0b40('0x9'));module[_0x0b40('0xa')]=function(_0x448504,_0x572527){return _0x448504[_0x0b40('0xb')](_0x0b40('0xc'),attributes,{'tableName':_0x0b40('0xd'),'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 210b68b..3c212a7 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 _0x29fc=['SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareMessage','SquareMessage','body','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x26ae09,_0x147574){var _0xf18c09=function(_0x1d952f){while(--_0x1d952f){_0x26ae09['push'](_0x26ae09['shift']());}};_0xf18c09(++_0x147574);}(_0x29fc,0xbb));var _0xc29f=function(_0x339f27,_0x149cce){_0x339f27=_0x339f27-0x0;var _0x588848=_0x29fc[_0x339f27];return _0x588848;};'use strict';var _=require(_0xc29f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc29f('0x1'));var rs=require(_0xc29f('0x2'));var fs=require('fs');var Redis=require(_0xc29f('0x3'));var db=require(_0xc29f('0x4'))['db'];var utils=require(_0xc29f('0x5'));var logger=require('../../config/logger')(_0xc29f('0x6'));var config=require(_0xc29f('0x7'));var jayson=require(_0xc29f('0x8'));var client=jayson['client'][_0xc29f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a366e,_0x7a56c5,_0x1913a4){return new BPromise(function(_0x229555,_0x3ab314){return client[_0xc29f('0xa')](_0x1a366e,_0x1913a4)[_0xc29f('0xb')](function(_0x867711){logger[_0xc29f('0xc')](_0xc29f('0xd'),_0x7a56c5,_0xc29f('0xe'));logger[_0xc29f('0xf')](_0xc29f('0x10'),_0x7a56c5,_0xc29f('0xe'),JSON['stringify'](_0x867711));if(_0x867711['error']){if(_0x867711[_0xc29f('0x11')][_0xc29f('0x12')]===0x1f4){logger[_0xc29f('0x11')](_0xc29f('0xd'),_0x7a56c5,_0x867711['error'][_0xc29f('0x13')]);return _0x3ab314(_0x867711['error'][_0xc29f('0x13')]);}logger[_0xc29f('0x11')](_0xc29f('0xd'),_0x7a56c5,_0x867711[_0xc29f('0x11')][_0xc29f('0x13')]);return _0x229555(_0x867711['error'][_0xc29f('0x13')]);}else{logger[_0xc29f('0xc')](_0xc29f('0xd'),_0x7a56c5,'request\x20sent');_0x229555(_0x867711['result']['message']);}})[_0xc29f('0x14')](function(_0x5c1a45){logger[_0xc29f('0x11')](_0xc29f('0xd'),_0x7a56c5,_0x5c1a45);_0x3ab314(_0x5c1a45);});});}exports[_0xc29f('0x15')]=function(_0x4a75de){var _0x47fb24=this;return new Promise(function(_0x46726f,_0x53c0db){return db[_0xc29f('0x16')]['create'](_0x4a75de[_0xc29f('0x17')],{'raw':_0x4a75de['options']?_0x4a75de['options']['raw']===undefined?!![]:![]:!![]})[_0xc29f('0xb')](function(_0x4b789d){logger[_0xc29f('0xc')](_0xc29f('0x15'),_0x4a75de);logger[_0xc29f('0xf')](_0xc29f('0x15'),_0x4a75de,JSON[_0xc29f('0x18')](_0x4b789d));_0x46726f(_0x4b789d);})[_0xc29f('0x14')](function(_0x1be0b5){logger[_0xc29f('0x11')]('CreateSquareMessage',_0x1be0b5[_0xc29f('0x13')],_0x4a75de);_0x53c0db(_0x47fb24[_0xc29f('0x11')](0x1f4,_0x1be0b5[_0xc29f('0x13')]));});});}; \ No newline at end of file +var _0xf2c1=['info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request'];(function(_0x2cde6c,_0x51a8c2){var _0x308e14=function(_0x33f8e3){while(--_0x33f8e3){_0x2cde6c['push'](_0x2cde6c['shift']());}};_0x308e14(++_0x51a8c2);}(_0xf2c1,0x196));var _0x1f2c=function(_0x44e9d8,_0x13c3cd){_0x44e9d8=_0x44e9d8-0x0;var _0x32a396=_0xf2c1[_0x44e9d8];return _0x32a396;};'use strict';var _=require(_0x1f2c('0x0'));var util=require('util');var moment=require(_0x1f2c('0x1'));var BPromise=require(_0x1f2c('0x2'));var rs=require(_0x1f2c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f2c('0x4'))['db'];var utils=require(_0x1f2c('0x5'));var logger=require('../../config/logger')(_0x1f2c('0x6'));var config=require(_0x1f2c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1f2c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2baa72,_0x236bf7,_0x3d634e){return new BPromise(function(_0xbd7d38,_0x49f5ce){return client[_0x1f2c('0x9')](_0x2baa72,_0x3d634e)['then'](function(_0x3ad470){logger[_0x1f2c('0xa')](_0x1f2c('0xb'),_0x236bf7,_0x1f2c('0xc'));logger[_0x1f2c('0xd')](_0x1f2c('0xe'),_0x236bf7,_0x1f2c('0xc'),JSON[_0x1f2c('0xf')](_0x3ad470));if(_0x3ad470[_0x1f2c('0x10')]){if(_0x3ad470[_0x1f2c('0x10')]['code']===0x1f4){logger[_0x1f2c('0x10')](_0x1f2c('0xb'),_0x236bf7,_0x3ad470[_0x1f2c('0x10')][_0x1f2c('0x11')]);return _0x49f5ce(_0x3ad470['error']['message']);}logger['error'](_0x1f2c('0xb'),_0x236bf7,_0x3ad470[_0x1f2c('0x10')][_0x1f2c('0x11')]);return _0xbd7d38(_0x3ad470[_0x1f2c('0x10')][_0x1f2c('0x11')]);}else{logger[_0x1f2c('0xa')](_0x1f2c('0xb'),_0x236bf7,_0x1f2c('0xc'));_0xbd7d38(_0x3ad470['result'][_0x1f2c('0x11')]);}})[_0x1f2c('0x12')](function(_0x2e9f5d){logger[_0x1f2c('0x10')](_0x1f2c('0xb'),_0x236bf7,_0x2e9f5d);_0x49f5ce(_0x2e9f5d);});});}exports[_0x1f2c('0x13')]=function(_0x111113){var _0x329cb3=this;return new Promise(function(_0x40cc04,_0x34c9af){return db[_0x1f2c('0x14')][_0x1f2c('0x15')](_0x111113[_0x1f2c('0x16')],{'raw':_0x111113[_0x1f2c('0x17')]?_0x111113[_0x1f2c('0x17')][_0x1f2c('0x18')]===undefined?!![]:![]:!![]})[_0x1f2c('0x19')](function(_0x4bc87b){logger[_0x1f2c('0xa')](_0x1f2c('0x13'),_0x111113);logger[_0x1f2c('0xd')](_0x1f2c('0x13'),_0x111113,JSON[_0x1f2c('0xf')](_0x4bc87b));_0x40cc04(_0x4bc87b);})[_0x1f2c('0x12')](function(_0x40faf5){logger[_0x1f2c('0x10')](_0x1f2c('0x13'),_0x40faf5[_0x1f2c('0x11')],_0x111113);_0x34c9af(_0x329cb3[_0x1f2c('0x10')](0x1f4,_0x40faf5[_0x1f2c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 1e0a240..7bbb95a 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 _0x993e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','show','get','/:id/test','15s','test','post','create','/:id','delete','destroy','exports','multer'];(function(_0xda924f,_0xb613f6){var _0x1241f4=function(_0x165981){while(--_0x165981){_0xda924f['push'](_0xda924f['shift']());}};_0x1241f4(++_0xb613f6);}(_0x993e,0x8b));var _0xe993=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x993e[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xe993('0x0'));var util=require('util');var path=require(_0xe993('0x1'));var timeout=require('connect-timeout');var express=require(_0xe993('0x2'));var router=express[_0xe993('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe993('0x4'));var interaction=require(_0xe993('0x5'));var config=require(_0xe993('0x6'));var controller=require('./squareOdbc.controller');router['get']('/',auth[_0xe993('0x7')](),controller[_0xe993('0x8')]);router['get']('/:id',auth[_0xe993('0x7')](),controller[_0xe993('0x9')]);router[_0xe993('0xa')](_0xe993('0xb'),auth[_0xe993('0x7')](),timeout(_0xe993('0xc')),controller[_0xe993('0xd')]);router[_0xe993('0xe')]('/',auth[_0xe993('0x7')](),controller[_0xe993('0xf')]);router['put'](_0xe993('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xe993('0x11')](_0xe993('0x10'),auth[_0xe993('0x7')](),controller[_0xe993('0x12')]);module[_0xe993('0x13')]=router; \ No newline at end of file +var _0x18ea=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','/:id','show','isAuthenticated','test','post','create','put','update','exports','multer'];(function(_0xaee3df,_0x5853a0){var _0x4140f3=function(_0x4faec5){while(--_0x4faec5){_0xaee3df['push'](_0xaee3df['shift']());}};_0x4140f3(++_0x5853a0);}(_0x18ea,0xe9));var _0xa18e=function(_0x5eb089,_0x25944f){_0x5eb089=_0x5eb089-0x0;var _0x342cc3=_0x18ea[_0x5eb089];return _0x342cc3;};'use strict';var multer=require(_0xa18e('0x0'));var util=require(_0xa18e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa18e('0x2'));var router=express[_0xa18e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa18e('0x4'));var interaction=require(_0xa18e('0x5'));var config=require(_0xa18e('0x6'));var controller=require(_0xa18e('0x7'));router[_0xa18e('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa18e('0x9'),auth['isAuthenticated'](),controller[_0xa18e('0xa')]);router[_0xa18e('0x8')]('/:id/test',auth[_0xa18e('0xb')](),timeout('15s'),controller[_0xa18e('0xc')]);router[_0xa18e('0xd')]('/',auth[_0xa18e('0xb')](),controller[_0xa18e('0xe')]);router[_0xa18e('0xf')](_0xa18e('0x9'),auth['isAuthenticated'](),controller[_0xa18e('0x10')]);router['delete'](_0xa18e('0x9'),auth[_0xa18e('0xb')](),controller['destroy']);module[_0xa18e('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 5069097..e71040d 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 _0x798f=['name','sequelize','exports','STRING'];(function(_0x4c35ca,_0x3abfd6){var _0x22688e=function(_0x5cb33f){while(--_0x5cb33f){_0x4c35ca['push'](_0x4c35ca['shift']());}};_0x22688e(++_0x3abfd6);}(_0x798f,0x6d));var _0xf798=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x798f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xf798('0x0'));module[_0xf798('0x1')]={'name':{'type':Sequelize[_0xf798('0x2')],'unique':_0xf798('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xf798('0x2')]},'description':{'type':Sequelize[_0xf798('0x2')]}}; \ No newline at end of file +var _0x1766=['sequelize','exports','STRING','name'];(function(_0x1642fe,_0x4b21c7){var _0x5cac0c=function(_0x365929){while(--_0x365929){_0x1642fe['push'](_0x1642fe['shift']());}};_0x5cac0c(++_0x4b21c7);}(_0x1766,0x148));var _0x6176=function(_0x5101d6,_0x5d8aa3){_0x5101d6=_0x5101d6-0x0;var _0x14cff7=_0x1766[_0x5101d6];return _0x14cff7;};'use strict';var Sequelize=require(_0x6176('0x0'));module[_0x6176('0x1')]={'name':{'type':Sequelize[_0x6176('0x2')],'unique':_0x6176('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x6176('0x2')]},'description':{'type':Sequelize[_0x6176('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 91d1bd6..10e14fe 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 _0xec7e=['user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','undefined','count','limit','status','Content-Range','apply','reject','update','destroy','then','get','end','error','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','SquareOdbc','includeAll','include','rows','catch','show','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xec7e,0x11a));var _0xeec7=function(_0x5a1038,_0x33bd65){_0x5a1038=_0x5a1038-0x0;var _0x4c7ee8=_0xec7e[_0x5a1038];return _0x4c7ee8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeec7('0x0'));var zipdir=require(_0xeec7('0x1'));var jsonpatch=require(_0xeec7('0x2'));var rp=require(_0xeec7('0x3'));var moment=require(_0xeec7('0x4'));var BPromise=require(_0xeec7('0x5'));var Mustache=require(_0xeec7('0x6'));var util=require(_0xeec7('0x7'));var path=require('path');var sox=require(_0xeec7('0x8'));var csv=require(_0xeec7('0x9'));var ejs=require(_0xeec7('0xa'));var fs=require('fs');var fs_extra=require(_0xeec7('0xb'));var _=require(_0xeec7('0xc'));var squel=require(_0xeec7('0xd'));var crypto=require(_0xeec7('0xe'));var jsforce=require(_0xeec7('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeec7('0x10'));var Redis=require(_0xeec7('0x11'));var authService=require(_0xeec7('0x12'));var qs=require(_0xeec7('0x13'));var as=require(_0xeec7('0x14'));var hardwareService=require(_0xeec7('0x15'));var logger=require('../../config/logger')(_0xeec7('0x16'));var utils=require(_0xeec7('0x17'));var config=require(_0xeec7('0x18'));var licenseUtil=require(_0xeec7('0x19'));var db=require(_0xeec7('0x1a'))['db'];function respondWithStatusCode(_0x207e2b,_0x2eaaff){_0x2eaaff=_0x2eaaff||0xcc;return function(_0x262a90){if(_0x262a90){return _0x207e2b['sendStatus'](_0x2eaaff);}return _0x207e2b['status'](_0x2eaaff)['end']();};}function respondWithResult(_0x316650,_0x2e358a){_0x2e358a=_0x2e358a||0xc8;return function(_0x1ab9c9){if(_0x1ab9c9){return _0x316650['status'](_0x2e358a)[_0xeec7('0x1b')](_0x1ab9c9);}};}function respondWithFilteredResult(_0x47bafb,_0x4d59eb){return function(_0x1c2d29){if(_0x1c2d29){var _0x3eb6c6=typeof _0x4d59eb[_0xeec7('0x1c')]===_0xeec7('0x1d')&&typeof _0x4d59eb['limit']===_0xeec7('0x1d');var _0x1a6f95=_0x1c2d29[_0xeec7('0x1e')];var _0x5c8a94=_0x3eb6c6?0x0:_0x4d59eb[_0xeec7('0x1c')];var _0x21a49c=_0x3eb6c6?_0x1c2d29['count']:_0x4d59eb['offset']+_0x4d59eb[_0xeec7('0x1f')];var _0x5b956f;if(_0x21a49c>=_0x1a6f95){_0x21a49c=_0x1a6f95;_0x5b956f=0xc8;}else{_0x5b956f=0xce;}_0x47bafb[_0xeec7('0x20')](_0x5b956f);return _0x47bafb['set'](_0xeec7('0x21'),_0x5c8a94+'-'+_0x21a49c+'/'+_0x1a6f95)[_0xeec7('0x1b')](_0x1c2d29);}return null;};}function patchUpdates(_0x337069){return function(_0x27f962){try{jsonpatch[_0xeec7('0x22')](_0x27f962,_0x337069,!![]);}catch(_0xc6ace0){return BPromise[_0xeec7('0x23')](_0xc6ace0);}return _0x27f962['save']();};}function saveUpdates(_0xcef790,_0x9f9044){return function(_0x15eed7){if(_0x15eed7){return _0x15eed7[_0xeec7('0x24')](_0xcef790)['then'](function(_0x11d871){return _0x11d871;});}return null;};}function removeEntity(_0x172076,_0x29c81d){return function(_0x41761d){if(_0x41761d){return _0x41761d[_0xeec7('0x25')]()[_0xeec7('0x26')](function(){var _0x3f49e7=_0x41761d[_0xeec7('0x27')]({'plain':!![]});var _0xf9ec26='ODBC';return db['UserProfileResource'][_0xeec7('0x25')]({'where':{'type':_0xf9ec26,'resourceId':_0x3f49e7['id']}})[_0xeec7('0x26')](function(){return _0x41761d;});})['then'](function(){_0x172076['status'](0xcc)[_0xeec7('0x28')]();});}};}function handleEntityNotFound(_0x27b21,_0x4df32e){return function(_0x150b7f){if(!_0x150b7f){_0x27b21['sendStatus'](0x194);}return _0x150b7f;};}function handleError(_0x1574ee,_0x1709a5){_0x1709a5=_0x1709a5||0x1f4;return function(_0x2a3ea7){logger[_0xeec7('0x29')](_0x2a3ea7['stack']);if(_0x2a3ea7[_0xeec7('0x2a')]){delete _0x2a3ea7[_0xeec7('0x2a')];}_0x1574ee['status'](_0x1709a5)[_0xeec7('0x2b')](_0x2a3ea7);};}exports[_0xeec7('0x2c')]=function(_0x1b3e2b,_0x314e18){var _0xda05a2={},_0x5ef222={},_0x38461c={'count':0x0,'rows':[]};var _0x111622=_[_0xeec7('0x2d')](db['SquareOdbc'][_0xeec7('0x2e')],function(_0x5a7963){return{'name':_0x5a7963[_0xeec7('0x2f')],'type':_0x5a7963[_0xeec7('0x30')][_0xeec7('0x31')]};});_0x5ef222['model']=_[_0xeec7('0x2d')](_0x111622,_0xeec7('0x2a'));_0x5ef222['query']=_[_0xeec7('0x32')](_0x1b3e2b[_0xeec7('0x33')]);_0x5ef222['filters']=_[_0xeec7('0x34')](_0x5ef222['model'],_0x5ef222[_0xeec7('0x33')]);_0xda05a2[_0xeec7('0x35')]=_[_0xeec7('0x34')](_0x5ef222[_0xeec7('0x36')],qs[_0xeec7('0x37')](_0x1b3e2b[_0xeec7('0x33')][_0xeec7('0x37')]));_0xda05a2[_0xeec7('0x35')]=_0xda05a2[_0xeec7('0x35')][_0xeec7('0x38')]?_0xda05a2['attributes']:_0x5ef222[_0xeec7('0x36')];if(!_0x1b3e2b[_0xeec7('0x33')][_0xeec7('0x39')](_0xeec7('0x3a'))){_0xda05a2[_0xeec7('0x1f')]=qs['limit'](_0x1b3e2b[_0xeec7('0x33')][_0xeec7('0x1f')]);_0xda05a2[_0xeec7('0x1c')]=qs[_0xeec7('0x1c')](_0x1b3e2b[_0xeec7('0x33')][_0xeec7('0x1c')]);}_0xda05a2['order']=qs[_0xeec7('0x3b')](_0x1b3e2b['query']['sort']);_0xda05a2['where']=qs[_0xeec7('0x3c')](_[_0xeec7('0x3d')](_0x1b3e2b[_0xeec7('0x33')],_0x5ef222[_0xeec7('0x3c')]),_0x111622);if(_0x1b3e2b[_0xeec7('0x33')][_0xeec7('0x3e')]){_0xda05a2['where']=_['merge'](_0xda05a2[_0xeec7('0x3f')],{'$or':_[_0xeec7('0x2d')](_0x111622,function(_0xb43c3d){if(_0xb43c3d[_0xeec7('0x30')]!==_0xeec7('0x40')){var _0x3fcf84={};_0x3fcf84[_0xb43c3d[_0xeec7('0x2a')]]={'$like':'%'+_0x1b3e2b[_0xeec7('0x33')]['filter']+'%'};return _0x3fcf84;}})});}_0xda05a2=_[_0xeec7('0x41')]({},_0xda05a2,_0x1b3e2b[_0xeec7('0x42')]);var _0x3d4b6a={'where':_0xda05a2['where']};return db[_0xeec7('0x43')]['count'](_0x3d4b6a)[_0xeec7('0x26')](function(_0x2c57d1){_0x38461c[_0xeec7('0x1e')]=_0x2c57d1;if(_0x1b3e2b[_0xeec7('0x33')][_0xeec7('0x44')]){_0xda05a2[_0xeec7('0x45')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0xda05a2);})[_0xeec7('0x26')](function(_0xadd6ee){_0x38461c[_0xeec7('0x46')]=_0xadd6ee;return _0x38461c;})['then'](respondWithFilteredResult(_0x314e18,_0xda05a2))[_0xeec7('0x47')](handleError(_0x314e18,null));};exports[_0xeec7('0x48')]=function(_0x3ee095,_0x28478f){var _0x2fd5fb={'raw':!![],'where':{'id':_0x3ee095[_0xeec7('0x49')]['id']}},_0x2be221={};_0x2be221[_0xeec7('0x36')]=_[_0xeec7('0x32')](db['SquareOdbc'][_0xeec7('0x2e')]);_0x2be221[_0xeec7('0x33')]=_[_0xeec7('0x32')](_0x3ee095['query']);_0x2be221[_0xeec7('0x3c')]=_[_0xeec7('0x34')](_0x2be221['model'],_0x2be221[_0xeec7('0x33')]);_0x2fd5fb['attributes']=_[_0xeec7('0x34')](_0x2be221[_0xeec7('0x36')],qs['fields'](_0x3ee095[_0xeec7('0x33')][_0xeec7('0x37')]));_0x2fd5fb[_0xeec7('0x35')]=_0x2fd5fb['attributes'][_0xeec7('0x38')]?_0x2fd5fb[_0xeec7('0x35')]:_0x2be221[_0xeec7('0x36')];if(_0x3ee095[_0xeec7('0x33')][_0xeec7('0x44')]){_0x2fd5fb[_0xeec7('0x45')]=[{'all':!![]}];}_0x2fd5fb=_['merge']({},_0x2fd5fb,_0x3ee095['options']);return db[_0xeec7('0x43')][_0xeec7('0x4a')](_0x2fd5fb)['then'](handleEntityNotFound(_0x28478f,null))[_0xeec7('0x26')](respondWithResult(_0x28478f,null))[_0xeec7('0x47')](handleError(_0x28478f,null));};exports['create']=function(_0x1fada9,_0x473268){return db[_0xeec7('0x43')]['create'](_0x1fada9[_0xeec7('0x4b')],{})[_0xeec7('0x26')](function(_0x4cbf8a){var _0x3ff162=_0x1fada9['user'][_0xeec7('0x27')]({'plain':!![]});if(!_0x3ff162)throw new Error(_0xeec7('0x4c'));if(_0x3ff162[_0xeec7('0x4d')]===_0xeec7('0x4e')){var _0x218fee=_0x4cbf8a[_0xeec7('0x27')]({'plain':!![]});var _0x3feefc='ODBC';return db[_0xeec7('0x4f')][_0xeec7('0x4a')]({'where':{'name':_0x3feefc,'userProfileId':_0x3ff162[_0xeec7('0x50')]},'raw':!![]})[_0xeec7('0x26')](function(_0xdb942a){if(_0xdb942a&&_0xdb942a[_0xeec7('0x51')]===0x0){return db[_0xeec7('0x52')][_0xeec7('0x53')]({'name':_0x218fee[_0xeec7('0x2a')],'resourceId':_0x218fee['id'],'type':_0xdb942a['name'],'sectionId':_0xdb942a['id']},{})[_0xeec7('0x26')](function(){return _0x4cbf8a;});}else{return _0x4cbf8a;}})[_0xeec7('0x47')](function(_0x159251){logger[_0xeec7('0x29')](_0xeec7('0x54'),_0x159251);throw _0x159251;});}return _0x4cbf8a;})[_0xeec7('0x26')](respondWithResult(_0x473268,0xc9))[_0xeec7('0x47')](handleError(_0x473268,null));};exports[_0xeec7('0x24')]=function(_0x268f36,_0x1af576){if(_0x268f36[_0xeec7('0x4b')]['id']){delete _0x268f36[_0xeec7('0x4b')]['id'];}return db[_0xeec7('0x43')][_0xeec7('0x4a')]({'where':{'id':_0x268f36['params']['id']}})[_0xeec7('0x26')](handleEntityNotFound(_0x1af576,null))[_0xeec7('0x26')](saveUpdates(_0x268f36[_0xeec7('0x4b')],null))[_0xeec7('0x26')](respondWithResult(_0x1af576,null))['catch'](handleError(_0x1af576,null));};exports[_0xeec7('0x25')]=function(_0x2c3443,_0x4306e7){return db[_0xeec7('0x43')]['find']({'where':{'id':_0x2c3443['params']['id']}})[_0xeec7('0x26')](handleEntityNotFound(_0x4306e7,null))[_0xeec7('0x26')](removeEntity(_0x4306e7,null))[_0xeec7('0x47')](handleError(_0x4306e7,null));};exports[_0xeec7('0x55')]=function(_0x3632ac,_0x255793,_0x2b0286){var _0x3628df;return db[_0xeec7('0x43')]['find']({'where':{'id':_0x3632ac[_0xeec7('0x49')]['id']},'attributes':['id',_0xeec7('0x56')]})[_0xeec7('0x26')](handleEntityNotFound(_0x255793,null))[_0xeec7('0x26')](function(_0x1e9879){if(_0x1e9879){var _0x55363e=require(_0xeec7('0x57'))();_0x55363e[_0xeec7('0x58')](_0x1e9879[_0xeec7('0x56')]);_0x55363e[_0xeec7('0x59')]();return _0x1e9879;}})['then'](respondWithResult(_0x255793,null))[_0xeec7('0x47')](handleError(_0x255793,null));}; \ No newline at end of file +var _0x6776=['name','send','index','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','type','VIRTUAL','filter','merge','options','SquareOdbc','count','findAll','catch','show','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','openSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','json','reject','save','then','destroy','get','ODBC','UserProfileResource','error','stack'];(function(_0x170b20,_0x49fc52){var _0xbe0395=function(_0x410eea){while(--_0x410eea){_0x170b20['push'](_0x170b20['shift']());}};_0xbe0395(++_0x49fc52);}(_0x6776,0x7f));var _0x6677=function(_0x5f0013,_0x39d054){_0x5f0013=_0x5f0013-0x0;var _0x5500cc=_0x6776[_0x5f0013];return _0x5500cc;};'use strict';var emlformat=require(_0x6677('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6677('0x1'));var jsonpatch=require(_0x6677('0x2'));var rp=require(_0x6677('0x3'));var moment=require(_0x6677('0x4'));var BPromise=require(_0x6677('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6677('0x6'));var sox=require(_0x6677('0x7'));var csv=require('to-csv');var ejs=require(_0x6677('0x8'));var fs=require('fs');var fs_extra=require(_0x6677('0x9'));var _=require(_0x6677('0xa'));var squel=require(_0x6677('0xb'));var crypto=require(_0x6677('0xc'));var jsforce=require(_0x6677('0xd'));var deskjs=require(_0x6677('0xe'));var toCsv=require(_0x6677('0xf'));var querystring=require(_0x6677('0x10'));var Papa=require(_0x6677('0x11'));var Redis=require(_0x6677('0x12'));var authService=require(_0x6677('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6677('0x14'));var hardwareService=require(_0x6677('0x15'));var logger=require(_0x6677('0x16'))(_0x6677('0x17'));var utils=require('../../config/utils');var config=require(_0x6677('0x18'));var licenseUtil=require(_0x6677('0x19'));var db=require(_0x6677('0x1a'))['db'];function respondWithStatusCode(_0x3988d3,_0x5e06cc){_0x5e06cc=_0x5e06cc||0xcc;return function(_0x1dec14){if(_0x1dec14){return _0x3988d3[_0x6677('0x1b')](_0x5e06cc);}return _0x3988d3[_0x6677('0x1c')](_0x5e06cc)[_0x6677('0x1d')]();};}function respondWithResult(_0x2d3347,_0xf4a6ba){_0xf4a6ba=_0xf4a6ba||0xc8;return function(_0x407b3f){if(_0x407b3f){return _0x2d3347[_0x6677('0x1c')](_0xf4a6ba)['json'](_0x407b3f);}};}function respondWithFilteredResult(_0x3692d1,_0x52a298){return function(_0x4d53f1){if(_0x4d53f1){var _0x2e6ba2=typeof _0x52a298[_0x6677('0x1e')]===_0x6677('0x1f')&&typeof _0x52a298[_0x6677('0x20')]===_0x6677('0x1f');var _0x472124=_0x4d53f1['count'];var _0x5ba494=_0x2e6ba2?0x0:_0x52a298[_0x6677('0x1e')];var _0x471f16=_0x2e6ba2?_0x4d53f1['count']:_0x52a298[_0x6677('0x1e')]+_0x52a298[_0x6677('0x20')];var _0x47a7e8;if(_0x471f16>=_0x472124){_0x471f16=_0x472124;_0x47a7e8=0xc8;}else{_0x47a7e8=0xce;}_0x3692d1['status'](_0x47a7e8);return _0x3692d1['set']('Content-Range',_0x5ba494+'-'+_0x471f16+'/'+_0x472124)[_0x6677('0x21')](_0x4d53f1);}return null;};}function patchUpdates(_0x3beeee){return function(_0x462109){try{jsonpatch['apply'](_0x462109,_0x3beeee,!![]);}catch(_0x188e33){return BPromise[_0x6677('0x22')](_0x188e33);}return _0x462109[_0x6677('0x23')]();};}function saveUpdates(_0x2a294d,_0x1537e1){return function(_0x3708f5){if(_0x3708f5){return _0x3708f5['update'](_0x2a294d)[_0x6677('0x24')](function(_0x1b229a){return _0x1b229a;});}return null;};}function removeEntity(_0x1194f9,_0x119ced){return function(_0xcc726e){if(_0xcc726e){return _0xcc726e[_0x6677('0x25')]()[_0x6677('0x24')](function(){var _0x41d686=_0xcc726e[_0x6677('0x26')]({'plain':!![]});var _0x471321=_0x6677('0x27');return db[_0x6677('0x28')][_0x6677('0x25')]({'where':{'type':_0x471321,'resourceId':_0x41d686['id']}})[_0x6677('0x24')](function(){return _0xcc726e;});})['then'](function(){_0x1194f9[_0x6677('0x1c')](0xcc)[_0x6677('0x1d')]();});}};}function handleEntityNotFound(_0x3cf5d9,_0x51cbb7){return function(_0x8edc87){if(!_0x8edc87){_0x3cf5d9[_0x6677('0x1b')](0x194);}return _0x8edc87;};}function handleError(_0x62e943,_0x2f9a67){_0x2f9a67=_0x2f9a67||0x1f4;return function(_0x137f95){logger[_0x6677('0x29')](_0x137f95[_0x6677('0x2a')]);if(_0x137f95[_0x6677('0x2b')]){delete _0x137f95['name'];}_0x62e943['status'](_0x2f9a67)[_0x6677('0x2c')](_0x137f95);};}exports[_0x6677('0x2d')]=function(_0x50e08f,_0x3fd61b){var _0xa24b19={},_0xffd83e={},_0x4245c7={'count':0x0,'rows':[]};var _0x1405b9=_['map'](db['SquareOdbc']['rawAttributes'],function(_0x4bea08){return{'name':_0x4bea08[_0x6677('0x2e')],'type':_0x4bea08['type'][_0x6677('0x2f')]};});_0xffd83e[_0x6677('0x30')]=_[_0x6677('0x31')](_0x1405b9,_0x6677('0x2b'));_0xffd83e[_0x6677('0x32')]=_[_0x6677('0x33')](_0x50e08f[_0x6677('0x32')]);_0xffd83e[_0x6677('0x34')]=_[_0x6677('0x35')](_0xffd83e['model'],_0xffd83e[_0x6677('0x32')]);_0xa24b19[_0x6677('0x36')]=_[_0x6677('0x35')](_0xffd83e[_0x6677('0x30')],qs[_0x6677('0x37')](_0x50e08f[_0x6677('0x32')][_0x6677('0x37')]));_0xa24b19['attributes']=_0xa24b19[_0x6677('0x36')][_0x6677('0x38')]?_0xa24b19[_0x6677('0x36')]:_0xffd83e[_0x6677('0x30')];if(!_0x50e08f[_0x6677('0x32')]['hasOwnProperty']('nolimit')){_0xa24b19[_0x6677('0x20')]=qs['limit'](_0x50e08f[_0x6677('0x32')]['limit']);_0xa24b19['offset']=qs[_0x6677('0x1e')](_0x50e08f['query']['offset']);}_0xa24b19[_0x6677('0x39')]=qs[_0x6677('0x3a')](_0x50e08f[_0x6677('0x32')][_0x6677('0x3a')]);_0xa24b19['where']=qs[_0x6677('0x34')](_[_0x6677('0x3b')](_0x50e08f['query'],_0xffd83e['filters']),_0x1405b9);if(_0x50e08f['query']['filter']){_0xa24b19['where']=_['merge'](_0xa24b19['where'],{'$or':_[_0x6677('0x31')](_0x1405b9,function(_0x51bd8a){if(_0x51bd8a[_0x6677('0x3c')]!==_0x6677('0x3d')){var _0x5e0fc4={};_0x5e0fc4[_0x51bd8a[_0x6677('0x2b')]]={'$like':'%'+_0x50e08f[_0x6677('0x32')][_0x6677('0x3e')]+'%'};return _0x5e0fc4;}})});}_0xa24b19=_[_0x6677('0x3f')]({},_0xa24b19,_0x50e08f[_0x6677('0x40')]);var _0x41c753={'where':_0xa24b19['where']};return db[_0x6677('0x41')][_0x6677('0x42')](_0x41c753)[_0x6677('0x24')](function(_0x1839b0){_0x4245c7[_0x6677('0x42')]=_0x1839b0;if(_0x50e08f[_0x6677('0x32')]['includeAll']){_0xa24b19['include']=[{'all':!![]}];}return db[_0x6677('0x41')][_0x6677('0x43')](_0xa24b19);})[_0x6677('0x24')](function(_0xfcf871){_0x4245c7['rows']=_0xfcf871;return _0x4245c7;})[_0x6677('0x24')](respondWithFilteredResult(_0x3fd61b,_0xa24b19))[_0x6677('0x44')](handleError(_0x3fd61b,null));};exports[_0x6677('0x45')]=function(_0x2c51c3,_0x57b3bb){var _0x55949f={'raw':!![],'where':{'id':_0x2c51c3['params']['id']}},_0x5b1c5c={};_0x5b1c5c[_0x6677('0x30')]=_[_0x6677('0x33')](db[_0x6677('0x41')]['rawAttributes']);_0x5b1c5c[_0x6677('0x32')]=_[_0x6677('0x33')](_0x2c51c3['query']);_0x5b1c5c['filters']=_[_0x6677('0x35')](_0x5b1c5c[_0x6677('0x30')],_0x5b1c5c[_0x6677('0x32')]);_0x55949f[_0x6677('0x36')]=_['intersection'](_0x5b1c5c[_0x6677('0x30')],qs[_0x6677('0x37')](_0x2c51c3[_0x6677('0x32')][_0x6677('0x37')]));_0x55949f[_0x6677('0x36')]=_0x55949f[_0x6677('0x36')][_0x6677('0x38')]?_0x55949f[_0x6677('0x36')]:_0x5b1c5c[_0x6677('0x30')];if(_0x2c51c3[_0x6677('0x32')][_0x6677('0x46')]){_0x55949f['include']=[{'all':!![]}];}_0x55949f=_['merge']({},_0x55949f,_0x2c51c3[_0x6677('0x40')]);return db['SquareOdbc'][_0x6677('0x47')](_0x55949f)[_0x6677('0x24')](handleEntityNotFound(_0x57b3bb,null))[_0x6677('0x24')](respondWithResult(_0x57b3bb,null))[_0x6677('0x44')](handleError(_0x57b3bb,null));};exports[_0x6677('0x48')]=function(_0x411a5c,_0x50a374){return db['SquareOdbc'][_0x6677('0x48')](_0x411a5c[_0x6677('0x49')],{})[_0x6677('0x24')](function(_0x3f0c6b){var _0x1b2bf2=_0x411a5c['user'][_0x6677('0x26')]({'plain':!![]});if(!_0x1b2bf2)throw new Error(_0x6677('0x4a'));if(_0x1b2bf2[_0x6677('0x4b')]===_0x6677('0x4c')){var _0x2dc992=_0x3f0c6b[_0x6677('0x26')]({'plain':!![]});var _0x41c8ae=_0x6677('0x27');return db[_0x6677('0x4d')][_0x6677('0x47')]({'where':{'name':_0x41c8ae,'userProfileId':_0x1b2bf2[_0x6677('0x4e')]},'raw':!![]})[_0x6677('0x24')](function(_0x147733){if(_0x147733&&_0x147733[_0x6677('0x4f')]===0x0){return db[_0x6677('0x28')][_0x6677('0x48')]({'name':_0x2dc992[_0x6677('0x2b')],'resourceId':_0x2dc992['id'],'type':_0x147733[_0x6677('0x2b')],'sectionId':_0x147733['id']},{})['then'](function(){return _0x3f0c6b;});}else{return _0x3f0c6b;}})[_0x6677('0x44')](function(_0x4b91af){logger['error'](_0x6677('0x50'),_0x4b91af);throw _0x4b91af;});}return _0x3f0c6b;})[_0x6677('0x24')](respondWithResult(_0x50a374,0xc9))[_0x6677('0x44')](handleError(_0x50a374,null));};exports['update']=function(_0x595f6d,_0x30846c){if(_0x595f6d[_0x6677('0x49')]['id']){delete _0x595f6d['body']['id'];}return db[_0x6677('0x41')][_0x6677('0x47')]({'where':{'id':_0x595f6d['params']['id']}})[_0x6677('0x24')](handleEntityNotFound(_0x30846c,null))[_0x6677('0x24')](saveUpdates(_0x595f6d[_0x6677('0x49')],null))[_0x6677('0x24')](respondWithResult(_0x30846c,null))[_0x6677('0x44')](handleError(_0x30846c,null));};exports['destroy']=function(_0x556f00,_0x50af5a){return db[_0x6677('0x41')][_0x6677('0x47')]({'where':{'id':_0x556f00[_0x6677('0x51')]['id']}})['then'](handleEntityNotFound(_0x50af5a,null))[_0x6677('0x24')](removeEntity(_0x50af5a,null))[_0x6677('0x44')](handleError(_0x50af5a,null));};exports[_0x6677('0x52')]=function(_0x425f92,_0x2574d5,_0x1a54c5){var _0x317453;return db[_0x6677('0x41')][_0x6677('0x47')]({'where':{'id':_0x425f92[_0x6677('0x51')]['id']},'attributes':['id',_0x6677('0x53')]})[_0x6677('0x24')](handleEntityNotFound(_0x2574d5,null))['then'](function(_0x4617eb){if(_0x4617eb){var _0x1e77b3=require('odbc')();_0x1e77b3[_0x6677('0x54')](_0x4617eb[_0x6677('0x53')]);_0x1e77b3['closeSync']();return _0x4617eb;}})[_0x6677('0x24')](respondWithResult(_0x2574d5,null))[_0x6677('0x44')](handleError(_0x2574d5,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 9f67928..3e0786e 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 _0xe615=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','exports'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xe615,0xfa));var _0x5e61=function(_0x2ceb31,_0x40ecf1){_0x2ceb31=_0x2ceb31-0x0;var _0x168859=_0xe615[_0x2ceb31];return _0x168859;};'use strict';var _=require(_0x5e61('0x0'));var util=require(_0x5e61('0x1'));var logger=require(_0x5e61('0x2'))('api');var moment=require(_0x5e61('0x3'));var BPromise=require(_0x5e61('0x4'));var rp=require(_0x5e61('0x5'));var fs=require('fs');var path=require(_0x5e61('0x6'));var rimraf=require('rimraf');var config=require(_0x5e61('0x7'));var attributes=require(_0x5e61('0x8'));module[_0x5e61('0x9')]=function(_0x22dc17,_0x4b6c33){return _0x22dc17['define']('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5276=['SquareOdbc','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x5c2733,_0x4464a3){var _0x37cd7f=function(_0x13c0a1){while(--_0x13c0a1){_0x5c2733['push'](_0x5c2733['shift']());}};_0x37cd7f(++_0x4464a3);}(_0x5276,0x11f));var _0x6527=function(_0x1ee1a8,_0x2d43fe){_0x1ee1a8=_0x1ee1a8-0x0;var _0x58bf44=_0x5276[_0x1ee1a8];return _0x58bf44;};'use strict';var _=require(_0x6527('0x0'));var util=require('util');var logger=require(_0x6527('0x1'))(_0x6527('0x2'));var moment=require(_0x6527('0x3'));var BPromise=require(_0x6527('0x4'));var rp=require(_0x6527('0x5'));var fs=require('fs');var path=require(_0x6527('0x6'));var rimraf=require(_0x6527('0x7'));var config=require(_0x6527('0x8'));var attributes=require(_0x6527('0x9'));module[_0x6527('0xa')]=function(_0x1aa40d,_0x11e6ad){return _0x1aa40d[_0x6527('0xb')](_0x6527('0xc'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index c568819..2257a0b 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 _0x2125=['http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSquareOdbc','find','options','raw','where','attributes','include','model','map','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0xafa0a2,_0x5f2f92){var _0x35c664=function(_0x1cd60c){while(--_0x1cd60c){_0xafa0a2['push'](_0xafa0a2['shift']());}};_0x35c664(++_0x5f2f92);}(_0x2125,0xdc));var _0x5212=function(_0x3b3065,_0x2a3f89){_0x3b3065=_0x3b3065-0x0;var _0x1e569f=_0x2125[_0x3b3065];return _0x1e569f;};'use strict';var _=require(_0x5212('0x0'));var util=require('util');var moment=require(_0x5212('0x1'));var BPromise=require(_0x5212('0x2'));var rs=require(_0x5212('0x3'));var fs=require('fs');var Redis=require(_0x5212('0x4'));var db=require(_0x5212('0x5'))['db'];var utils=require(_0x5212('0x6'));var logger=require(_0x5212('0x7'))('rpc');var config=require(_0x5212('0x8'));var jayson=require(_0x5212('0x9'));var client=jayson[_0x5212('0xa')][_0x5212('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52c02c,_0x1c2c8a,_0x1298c){return new BPromise(function(_0x304dda,_0x4feea2){return client[_0x5212('0xc')](_0x52c02c,_0x1298c)[_0x5212('0xd')](function(_0x5b5a90){logger[_0x5212('0xe')](_0x5212('0xf'),_0x1c2c8a,_0x5212('0x10'));logger[_0x5212('0x11')](_0x5212('0x12'),_0x1c2c8a,_0x5212('0x10'),JSON[_0x5212('0x13')](_0x5b5a90));if(_0x5b5a90[_0x5212('0x14')]){if(_0x5b5a90[_0x5212('0x14')]['code']===0x1f4){logger[_0x5212('0x14')](_0x5212('0xf'),_0x1c2c8a,_0x5b5a90[_0x5212('0x14')]['message']);return _0x4feea2(_0x5b5a90[_0x5212('0x14')][_0x5212('0x15')]);}logger[_0x5212('0x14')](_0x5212('0xf'),_0x1c2c8a,_0x5b5a90['error'][_0x5212('0x15')]);return _0x304dda(_0x5b5a90[_0x5212('0x14')][_0x5212('0x15')]);}else{logger[_0x5212('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x1c2c8a,_0x5212('0x10'));_0x304dda(_0x5b5a90[_0x5212('0x16')]['message']);}})[_0x5212('0x17')](function(_0x5cc47d){logger[_0x5212('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x1c2c8a,_0x5cc47d);_0x4feea2(_0x5cc47d);});});}exports[_0x5212('0x18')]=function(_0x497ff0){var _0x439c98=this;return new Promise(function(_0x5d257f,_0x5ad223){return db['SquareOdbc'][_0x5212('0x19')]({'raw':_0x497ff0['options']?_0x497ff0[_0x5212('0x1a')][_0x5212('0x1b')]===undefined?!![]:![]:!![],'where':_0x497ff0['options']?_0x497ff0[_0x5212('0x1a')][_0x5212('0x1c')]||null:null,'attributes':_0x497ff0['options']?_0x497ff0[_0x5212('0x1a')][_0x5212('0x1d')]||null:null,'include':_0x497ff0[_0x5212('0x1a')]?_0x497ff0['options']['include']?_['map'](_0x497ff0[_0x5212('0x1a')][_0x5212('0x1e')],function(_0x5893c8){return{'model':db[_0x5893c8[_0x5212('0x1f')]],'as':_0x5893c8['as'],'attributes':_0x5893c8['attributes'],'include':_0x5893c8[_0x5212('0x1e')]?_[_0x5212('0x20')](_0x5893c8[_0x5212('0x1e')],function(_0x386ac9){return{'model':db[_0x386ac9[_0x5212('0x1f')]],'as':_0x386ac9['as'],'attributes':_0x386ac9[_0x5212('0x1d')],'include':_0x386ac9[_0x5212('0x1e')]?_['map'](_0x386ac9[_0x5212('0x1e')],function(_0x35243f){return{'model':db[_0x35243f[_0x5212('0x1f')]],'as':_0x35243f['as'],'attributes':_0x35243f['attributes']};}):[]};}):[]};}):[]:[]})[_0x5212('0xd')](function(_0x41f42f){logger[_0x5212('0xe')](_0x5212('0x18'),_0x497ff0);logger[_0x5212('0x11')](_0x5212('0x18'),_0x497ff0,JSON[_0x5212('0x13')](_0x41f42f));_0x5d257f(_0x41f42f);})[_0x5212('0x17')](function(_0x228c03){logger[_0x5212('0x14')]('ShowSquareOdbc',_0x228c03[_0x5212('0x15')],_0x497ff0);_0x5ad223(_0x439c98[_0x5212('0x14')](0x1f4,_0x228c03[_0x5212('0x15')]));});});}; \ No newline at end of file +var _0x15b5=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','include','map','model','lodash','util','moment','randomstring','ioredis'];(function(_0x122556,_0x440778){var _0x227d73=function(_0x3f7dbe){while(--_0x3f7dbe){_0x122556['push'](_0x122556['shift']());}};_0x227d73(++_0x440778);}(_0x15b5,0x15b));var _0x515b=function(_0x1aab74,_0x38a57b){_0x1aab74=_0x1aab74-0x0;var _0x396af2=_0x15b5[_0x1aab74];return _0x396af2;};'use strict';var _=require(_0x515b('0x0'));var util=require(_0x515b('0x1'));var moment=require(_0x515b('0x2'));var BPromise=require('bluebird');var rs=require(_0x515b('0x3'));var fs=require('fs');var Redis=require(_0x515b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x515b('0x5'));var logger=require(_0x515b('0x6'))(_0x515b('0x7'));var config=require(_0x515b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x515b('0x9')][_0x515b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e19a6,_0x33863a,_0x196730){return new BPromise(function(_0x5d2bbe,_0x517615){return client['request'](_0x4e19a6,_0x196730)[_0x515b('0xb')](function(_0x4ab0d8){logger['info'](_0x515b('0xc'),_0x33863a,_0x515b('0xd'));logger[_0x515b('0xe')](_0x515b('0xf'),_0x33863a,'request\x20sent',JSON[_0x515b('0x10')](_0x4ab0d8));if(_0x4ab0d8['error']){if(_0x4ab0d8[_0x515b('0x11')][_0x515b('0x12')]===0x1f4){logger['error'](_0x515b('0xc'),_0x33863a,_0x4ab0d8['error'][_0x515b('0x13')]);return _0x517615(_0x4ab0d8['error'][_0x515b('0x13')]);}logger[_0x515b('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x33863a,_0x4ab0d8[_0x515b('0x11')]['message']);return _0x5d2bbe(_0x4ab0d8[_0x515b('0x11')][_0x515b('0x13')]);}else{logger[_0x515b('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x33863a,_0x515b('0xd'));_0x5d2bbe(_0x4ab0d8[_0x515b('0x15')]['message']);}})[_0x515b('0x16')](function(_0x5f0b7a){logger[_0x515b('0x11')](_0x515b('0xc'),_0x33863a,_0x5f0b7a);_0x517615(_0x5f0b7a);});});}exports[_0x515b('0x17')]=function(_0x4a2d3a){var _0x12737f=this;return new Promise(function(_0x4d71b0,_0x3a1049){return db[_0x515b('0x18')][_0x515b('0x19')]({'raw':_0x4a2d3a[_0x515b('0x1a')]?_0x4a2d3a['options'][_0x515b('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a2d3a['options']?_0x4a2d3a[_0x515b('0x1a')]['where']||null:null,'attributes':_0x4a2d3a[_0x515b('0x1a')]?_0x4a2d3a['options'][_0x515b('0x1c')]||null:null,'include':_0x4a2d3a[_0x515b('0x1a')]?_0x4a2d3a[_0x515b('0x1a')][_0x515b('0x1d')]?_['map'](_0x4a2d3a['options'][_0x515b('0x1d')],function(_0x5a4698){return{'model':db[_0x5a4698['model']],'as':_0x5a4698['as'],'attributes':_0x5a4698[_0x515b('0x1c')],'include':_0x5a4698['include']?_[_0x515b('0x1e')](_0x5a4698[_0x515b('0x1d')],function(_0x4c0fbf){return{'model':db[_0x4c0fbf[_0x515b('0x1f')]],'as':_0x4c0fbf['as'],'attributes':_0x4c0fbf[_0x515b('0x1c')],'include':_0x4c0fbf[_0x515b('0x1d')]?_[_0x515b('0x1e')](_0x4c0fbf['include'],function(_0x7f5fcb){return{'model':db[_0x7f5fcb['model']],'as':_0x7f5fcb['as'],'attributes':_0x7f5fcb[_0x515b('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ccdde){logger[_0x515b('0x14')](_0x515b('0x17'),_0x4a2d3a);logger[_0x515b('0xe')]('ShowSquareOdbc',_0x4a2d3a,JSON[_0x515b('0x10')](_0x5ccdde));_0x4d71b0(_0x5ccdde);})['catch'](function(_0x23c8e2){logger[_0x515b('0x11')](_0x515b('0x17'),_0x23c8e2[_0x515b('0x13')],_0x4a2d3a);_0x3a1049(_0x12737f[_0x515b('0x11')](0x1f4,_0x23c8e2[_0x515b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 34747d8..e5a6d11 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 _0x7582=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','/:id','get','/:id/users','post','addUsers','put','destroy','delete','removeUsers','exports','util'];(function(_0x24a675,_0x3de6b4){var _0x43f798=function(_0x20c720){while(--_0x20c720){_0x24a675['push'](_0x24a675['shift']());}};_0x43f798(++_0x3de6b4);}(_0x7582,0x167));var _0x2758=function(_0x5b64a1,_0x2ec810){_0x5b64a1=_0x5b64a1-0x0;var _0x4b6f55=_0x7582[_0x5b64a1];return _0x4b6f55;};'use strict';var multer=require('multer');var util=require(_0x2758('0x0'));var path=require(_0x2758('0x1'));var timeout=require(_0x2758('0x2'));var express=require('express');var router=express[_0x2758('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2758('0x4'));var interaction=require(_0x2758('0x5'));var config=require(_0x2758('0x6'));var controller=require(_0x2758('0x7'));router['get']('/',auth[_0x2758('0x8')](),controller[_0x2758('0x9')]);router['get'](_0x2758('0xa'),auth[_0x2758('0x8')](),controller['show']);router[_0x2758('0xb')](_0x2758('0xc'),auth[_0x2758('0x8')](),controller['getUsers']);router[_0x2758('0xd')]('/',auth[_0x2758('0x8')](),controller['create']);router['post'](_0x2758('0xc'),auth[_0x2758('0x8')](),controller[_0x2758('0xe')]);router[_0x2758('0xf')](_0x2758('0xa'),auth[_0x2758('0x8')](),controller['update']);router['delete']('/:id',auth[_0x2758('0x8')](),controller[_0x2758('0x10')]);router[_0x2758('0x11')](_0x2758('0xc'),auth[_0x2758('0x8')](),controller[_0x2758('0x12')]);module[_0x2758('0x13')]=router; \ No newline at end of file +var _0x093f=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','addUsers','put','update','destroy','delete','removeUsers','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x093f,0xd2));var _0xf093=function(_0x538309,_0x20ce8b){_0x538309=_0x538309-0x0;var _0x11aefa=_0x093f[_0x538309];return _0x11aefa;};'use strict';var multer=require(_0xf093('0x0'));var util=require(_0xf093('0x1'));var path=require(_0xf093('0x2'));var timeout=require(_0xf093('0x3'));var express=require(_0xf093('0x4'));var router=express[_0xf093('0x5')]();var fs_extra=require(_0xf093('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf093('0x7'));var config=require(_0xf093('0x8'));var controller=require('./squareProject.controller');router[_0xf093('0x9')]('/',auth[_0xf093('0xa')](),controller[_0xf093('0xb')]);router[_0xf093('0x9')](_0xf093('0xc'),auth[_0xf093('0xa')](),controller[_0xf093('0xd')]);router[_0xf093('0x9')](_0xf093('0xe'),auth[_0xf093('0xa')](),controller[_0xf093('0xf')]);router[_0xf093('0x10')]('/',auth[_0xf093('0xa')](),controller['create']);router['post'](_0xf093('0xe'),auth['isAuthenticated'](),controller[_0xf093('0x11')]);router[_0xf093('0x12')](_0xf093('0xc'),auth['isAuthenticated'](),controller[_0xf093('0x13')]);router['delete'](_0xf093('0xc'),auth['isAuthenticated'](),controller[_0xf093('0x14')]);router[_0xf093('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0xf093('0x16')]);module[_0xf093('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index f4e6416..38f81ee 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 _0x182f=['DATE','exports','name','STRING','BLOB','long','getDataValue','preproduction','toString','production','utf8'];(function(_0xeb30d6,_0x46ba0a){var _0x42de1f=function(_0x1e3105){while(--_0x1e3105){_0xeb30d6['push'](_0xeb30d6['shift']());}};_0x42de1f(++_0x46ba0a);}(_0x182f,0x85));var _0xf182=function(_0x2eba44,_0x537222){_0x2eba44=_0x2eba44-0x0;var _0x24669c=_0x182f[_0x2eba44];return _0x24669c;};'use strict';var Sequelize=require('sequelize');module[_0xf182('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xf182('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xf182('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xf182('0x3')](_0xf182('0x4')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0xf182('0x5')](_0xf182('0x6'))[_0xf182('0x7')]('utf8');}}},'production':{'type':Sequelize[_0xf182('0x3')](_0xf182('0x4')),'get':function(){if(this[_0xf182('0x5')](_0xf182('0x8'))){return this[_0xf182('0x5')]('production')[_0xf182('0x7')](_0xf182('0x9'));}}},'savedAt':{'type':Sequelize[_0xf182('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xf4b4=['production','DATE','exports','STRING','name','TEXT','BLOB','long','preproduction','toString','utf8','getDataValue'];(function(_0xb1dfbb,_0x43519c){var _0x45223a=function(_0x95e26f){while(--_0x95e26f){_0xb1dfbb['push'](_0xb1dfbb['shift']());}};_0x45223a(++_0x43519c);}(_0xf4b4,0x92));var _0x4f4b=function(_0x47024a,_0x2cc60a){_0x47024a=_0x47024a-0x0;var _0xc021b8=_0xf4b4[_0x47024a];return _0xc021b8;};'use strict';var Sequelize=require('sequelize');module[_0x4f4b('0x0')]={'name':{'type':Sequelize[_0x4f4b('0x1')],'unique':_0x4f4b('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x4f4b('0x1')]},'notes':{'type':Sequelize[_0x4f4b('0x3')]},'preproduction':{'type':Sequelize[_0x4f4b('0x4')](_0x4f4b('0x5')),'get':function(){if(this['getDataValue'](_0x4f4b('0x6'))){return this['getDataValue'](_0x4f4b('0x6'))[_0x4f4b('0x7')](_0x4f4b('0x8'));}}},'production':{'type':Sequelize[_0x4f4b('0x4')](_0x4f4b('0x5')),'get':function(){if(this[_0x4f4b('0x9')]('production')){return this[_0x4f4b('0x9')](_0x4f4b('0xa'))[_0x4f4b('0x7')](_0x4f4b('0x8'));}}},'savedAt':{'type':Sequelize[_0x4f4b('0xb')]},'publishedAt':{'type':Sequelize[_0x4f4b('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 7ab2af1..ca6bf52 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 _0x01d9=['SquareProject','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','production','addUsers','ids','removeUsers','emit','userSquareProject:remove','getUsers','findOne','User','nolimit','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SquareProjects','agi','stringify','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x2edf7c,_0x413641){var _0x4f09a=function(_0x3de745){while(--_0x3de745){_0x2edf7c['push'](_0x2edf7c['shift']());}};_0x4f09a(++_0x413641);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var Redis=require(_0x901d('0x1'));var qs=require(_0x901d('0x2'));var logger=require(_0x901d('0x3'))('api');var config=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];config[_0x901d('0x6')]=_[_0x901d('0x7')](config[_0x901d('0x6')],{'host':_0x901d('0x8'),'port':0x18eb});var socket=require(_0x901d('0x9'))(new Redis(config['redis']));require(_0x901d('0xa'))[_0x901d('0xb')](socket);function respondWithStatusCode(_0x21e1d7,_0x12c39f){_0x12c39f=_0x12c39f||0xcc;return function(_0x313f85){if(_0x313f85){return _0x21e1d7[_0x901d('0xc')](_0x12c39f);}return _0x21e1d7[_0x901d('0xd')](_0x12c39f)[_0x901d('0xe')]();};}function respondWithResult(_0x15076e,_0xacff40){_0xacff40=_0xacff40||0xc8;return function(_0x440fb0){if(_0x440fb0){return _0x15076e[_0x901d('0xd')](_0xacff40)[_0x901d('0xf')](_0x440fb0);}};}function respondWithFilteredResult(_0x5d74e2,_0x439f17){return function(_0x5ba100){if(_0x5ba100){var _0x220153=typeof _0x439f17[_0x901d('0x10')]===_0x901d('0x11')&&typeof _0x439f17[_0x901d('0x12')]===_0x901d('0x11');var _0x5d2345=_0x5ba100[_0x901d('0x13')];var _0x31cbbd=_0x220153?0x0:_0x439f17[_0x901d('0x10')];var _0x1618a8=_0x220153?_0x5ba100[_0x901d('0x13')]:_0x439f17[_0x901d('0x10')]+_0x439f17['limit'];var _0x991ee2;if(_0x1618a8>=_0x5d2345){_0x1618a8=_0x5d2345;_0x991ee2=0xc8;}else{_0x991ee2=0xce;}_0x5d74e2[_0x901d('0xd')](_0x991ee2);return _0x5d74e2[_0x901d('0x14')](_0x901d('0x15'),_0x31cbbd+'-'+_0x1618a8+'/'+_0x5d2345)[_0x901d('0xf')](_0x5ba100);}return null;};}function saveUpdates(_0x7dd5f4){return function(_0x477cd4){if(_0x477cd4){return _0x477cd4[_0x901d('0x16')](_0x7dd5f4)[_0x901d('0x17')](function(_0x3b62e5){return _0x3b62e5;});}return null;};}function removeEntity(_0x28caae){return function(_0x390c33){if(_0x390c33){return _0x390c33[_0x901d('0x18')]()[_0x901d('0x17')](function(){var _0x38f42b=_0x390c33[_0x901d('0x19')]({'plain':!![]});var _0xf3c66a=_0x901d('0x1a');return db['UserProfileResource'][_0x901d('0x18')]({'where':{'type':_0xf3c66a,'resourceId':_0x38f42b['id']}})[_0x901d('0x17')](function(){return _0x390c33;});})['then'](function(){var _0x5bdff4=new Redis(config['redis']);_0x5bdff4['publish'](_0x901d('0x1b'),JSON[_0x901d('0x1c')]({'id':_0x390c33['id'],'deleted':!![]}));})['then'](function(){_0x28caae[_0x901d('0xd')](0xcc)[_0x901d('0xe')]();});}};}function handleEntityNotFound(_0x488e24){return function(_0x20778b){if(!_0x20778b){_0x488e24[_0x901d('0xc')](0x194);}return _0x20778b;};}function handleError(_0x2402de,_0x3f80b9){_0x3f80b9=_0x3f80b9||0x1f4;return function(_0x1e7d36){logger[_0x901d('0x1d')](_0x1e7d36[_0x901d('0x1e')]);if(_0x1e7d36[_0x901d('0x1f')]){delete _0x1e7d36['name'];}_0x2402de[_0x901d('0xd')](_0x3f80b9)[_0x901d('0x20')](_0x1e7d36);};}exports[_0x901d('0x21')]=function(_0x1f0ee5,_0x557809){var _0x293119={},_0x23fd43={},_0x27f4ca={'count':0x0,'rows':[]};var _0x3cbe43=_[_0x901d('0x22')](db['SquareProject'][_0x901d('0x23')],function(_0xc52d0f){return{'name':_0xc52d0f[_0x901d('0x24')],'type':_0xc52d0f[_0x901d('0x25')][_0x901d('0x26')]};});_0x23fd43[_0x901d('0x27')]=_['map'](_0x3cbe43,_0x901d('0x1f'));_0x23fd43['query']=_[_0x901d('0x28')](_0x1f0ee5[_0x901d('0x29')]);_0x23fd43[_0x901d('0x2a')]=_[_0x901d('0x2b')](_0x23fd43[_0x901d('0x27')],_0x23fd43[_0x901d('0x29')]);_0x293119[_0x901d('0x2c')]=_[_0x901d('0x2b')](_0x23fd43[_0x901d('0x27')],qs[_0x901d('0x2d')](_0x1f0ee5[_0x901d('0x29')][_0x901d('0x2d')]));_0x293119[_0x901d('0x2c')]=_0x293119[_0x901d('0x2c')][_0x901d('0x2e')]?_0x293119['attributes']:_0x23fd43[_0x901d('0x27')];if(!_0x1f0ee5[_0x901d('0x29')][_0x901d('0x2f')]('nolimit')){_0x293119[_0x901d('0x12')]=qs[_0x901d('0x12')](_0x1f0ee5[_0x901d('0x29')][_0x901d('0x12')]);_0x293119[_0x901d('0x10')]=qs[_0x901d('0x10')](_0x1f0ee5[_0x901d('0x29')][_0x901d('0x10')]);}_0x293119[_0x901d('0x30')]=qs[_0x901d('0x31')](_0x1f0ee5['query']['sort']);_0x293119[_0x901d('0x32')]=qs['filters'](_[_0x901d('0x33')](_0x1f0ee5[_0x901d('0x29')],_0x23fd43['filters']),_0x3cbe43);if(_0x1f0ee5[_0x901d('0x29')][_0x901d('0x34')]){_0x293119[_0x901d('0x32')]=_['merge'](_0x293119[_0x901d('0x32')],{'$or':_[_0x901d('0x22')](_0x3cbe43,function(_0x1a1f9c){if(_0x1a1f9c[_0x901d('0x25')]!==_0x901d('0x35')){var _0x32aa29={};_0x32aa29[_0x1a1f9c[_0x901d('0x1f')]]={'$like':'%'+_0x1f0ee5[_0x901d('0x29')][_0x901d('0x34')]+'%'};return _0x32aa29;}})});}_0x293119=_[_0x901d('0x36')]({},_0x293119,_0x1f0ee5[_0x901d('0x37')]);var _0x3d4f8b={'where':_0x293119[_0x901d('0x32')]};return db[_0x901d('0x38')][_0x901d('0x13')](_0x3d4f8b)[_0x901d('0x17')](function(_0x54a654){_0x27f4ca[_0x901d('0x13')]=_0x54a654;if(_0x1f0ee5[_0x901d('0x29')]['includeAll']){_0x293119['include']=[{'all':!![]}];}return db[_0x901d('0x38')]['findAll'](_0x293119);})[_0x901d('0x17')](function(_0x3d0556){_0x27f4ca[_0x901d('0x39')]=_0x3d0556;return _0x27f4ca;})[_0x901d('0x17')](respondWithFilteredResult(_0x557809,_0x293119))[_0x901d('0x3a')](handleError(_0x557809,null));};exports[_0x901d('0x3b')]=function(_0x5df4cb,_0x4ce6e4){var _0x4ee804={'raw':![],'where':{'id':_0x5df4cb[_0x901d('0x3c')]['id']}},_0x4c4fd0={};_0x4c4fd0[_0x901d('0x27')]=_['keys'](db[_0x901d('0x38')][_0x901d('0x23')]);_0x4c4fd0['query']=_[_0x901d('0x28')](_0x5df4cb[_0x901d('0x29')]);_0x4c4fd0[_0x901d('0x2a')]=_[_0x901d('0x2b')](_0x4c4fd0['model'],_0x4c4fd0['query']);_0x4ee804[_0x901d('0x2c')]=_[_0x901d('0x2b')](_0x4c4fd0[_0x901d('0x27')],qs[_0x901d('0x2d')](_0x5df4cb[_0x901d('0x29')][_0x901d('0x2d')]));_0x4ee804[_0x901d('0x2c')]=_0x4ee804[_0x901d('0x2c')][_0x901d('0x2e')]?_0x4ee804[_0x901d('0x2c')]:_0x4c4fd0[_0x901d('0x27')];if(_0x5df4cb['query'][_0x901d('0x3d')]){_0x4ee804['include']=[{'all':!![]}];}_0x4ee804=_[_0x901d('0x36')]({},_0x4ee804,_0x5df4cb['options']);return db[_0x901d('0x38')]['find'](_0x4ee804)[_0x901d('0x17')](handleEntityNotFound(_0x4ce6e4,null))[_0x901d('0x17')](respondWithResult(_0x4ce6e4,null))[_0x901d('0x3a')](handleError(_0x4ce6e4,null));};exports[_0x901d('0x3e')]=function(_0x2fc1d2,_0x2787ae){return db[_0x901d('0x38')][_0x901d('0x3e')](_0x2fc1d2[_0x901d('0x3f')],{})[_0x901d('0x17')](function(_0x1a27c0){var _0x54fc19=_0x2fc1d2[_0x901d('0x40')][_0x901d('0x19')]({'plain':!![]});if(!_0x54fc19)throw new Error(_0x901d('0x41'));if(_0x54fc19[_0x901d('0x42')]===_0x901d('0x40')){var _0x24b6fa=_0x1a27c0[_0x901d('0x19')]({'plain':!![]});var _0x43135c=_0x901d('0x1a');return db[_0x901d('0x43')][_0x901d('0x44')]({'where':{'name':_0x43135c,'userProfileId':_0x54fc19[_0x901d('0x45')]},'raw':!![]})[_0x901d('0x17')](function(_0x23f2a9){if(_0x23f2a9&&_0x23f2a9['autoAssociation']===0x0){return db['UserProfileResource'][_0x901d('0x3e')]({'name':_0x24b6fa[_0x901d('0x1f')],'resourceId':_0x24b6fa['id'],'type':_0x23f2a9[_0x901d('0x1f')],'sectionId':_0x23f2a9['id']},{})[_0x901d('0x17')](function(){return _0x1a27c0;});}else{return _0x1a27c0;}})[_0x901d('0x3a')](function(_0x5cbc90){logger['error'](_0x901d('0x46'),_0x5cbc90);throw _0x5cbc90;});}return _0x1a27c0;})[_0x901d('0x17')](respondWithResult(_0x2787ae,0xc9))['catch'](handleError(_0x2787ae,null));};exports[_0x901d('0x16')]=function(_0x165207,_0x4d2b2d){if(_0x165207[_0x901d('0x3f')]['id']){delete _0x165207['body']['id'];}return db[_0x901d('0x38')][_0x901d('0x44')]({'where':{'id':_0x165207[_0x901d('0x3c')]['id']}})[_0x901d('0x17')](handleEntityNotFound(_0x4d2b2d,null))['then'](saveUpdates(_0x165207[_0x901d('0x3f')],null))[_0x901d('0x17')](function(_0x1d5880){if(!_0x1d5880)return;var _0x8af950=_0x1d5880[_0x901d('0x19')]({'plain':!![]});return _0x8af950;})[_0x901d('0x17')](function(_0x17c716){var _0x42ddd=new Redis(config[_0x901d('0x6')]);_0x42ddd[_0x901d('0x47')]('agi',JSON[_0x901d('0x1c')](_['pick'](_0x17c716,['id',_0x901d('0x1f'),_0x901d('0x48')])));return _0x17c716;})[_0x901d('0x17')](respondWithResult(_0x4d2b2d,null))[_0x901d('0x3a')](handleError(_0x4d2b2d,null));};exports[_0x901d('0x18')]=function(_0x21f3bd,_0x45c730){return db[_0x901d('0x38')]['find']({'where':{'id':_0x21f3bd[_0x901d('0x3c')]['id']}})[_0x901d('0x17')](handleEntityNotFound(_0x45c730,null))[_0x901d('0x17')](removeEntity(_0x45c730,null))['catch'](handleError(_0x45c730,null));};exports[_0x901d('0x49')]=function(_0x5d049d,_0x1c99ce){return db[_0x901d('0x38')][_0x901d('0x44')]({'where':{'id':_0x5d049d['params']['id']}})[_0x901d('0x17')](handleEntityNotFound(_0x1c99ce,null))[_0x901d('0x17')](function(_0x3740a3){if(_0x3740a3){return _0x3740a3[_0x901d('0x49')](_0x5d049d[_0x901d('0x3f')][_0x901d('0x4a')],_['omit'](_0x5d049d[_0x901d('0x3f')],[_0x901d('0x4a'),'id'])||{});}})[_0x901d('0x17')](respondWithResult(_0x1c99ce,null))[_0x901d('0x3a')](handleError(_0x1c99ce,null));};exports[_0x901d('0x4b')]=function(_0x41f8a5,_0x52eb30){return db[_0x901d('0x38')]['find']({'where':{'id':_0x41f8a5['params']['id']}})['then'](handleEntityNotFound(_0x52eb30,null))['then'](function(_0x23a9aa){if(_0x23a9aa){return _0x23a9aa[_0x901d('0x4b')](_0x41f8a5[_0x901d('0x29')]['ids'])[_0x901d('0x17')](function(){if(_['isArray'](_0x41f8a5[_0x901d('0x29')][_0x901d('0x4a')])){for(var _0xecc8f9=0x0;_0xecc8f9<_0x41f8a5[_0x901d('0x29')][_0x901d('0x4a')][_0x901d('0x2e')];_0xecc8f9+=0x1){socket[_0x901d('0x4c')](_0x901d('0x4d'),{'UserId':Number(_0x41f8a5[_0x901d('0x29')][_0x901d('0x4a')][_0xecc8f9]),'SquareProjectId':Number(_0x41f8a5[_0x901d('0x3c')]['id'])});}}else{socket[_0x901d('0x4c')](_0x901d('0x4d'),{'UserId':Number(_0x41f8a5[_0x901d('0x29')]['ids']),'SquareProjectId':Number(_0x41f8a5['params']['id'])});}});}})[_0x901d('0x17')](respondWithStatusCode(_0x52eb30,null))[_0x901d('0x3a')](handleError(_0x52eb30,null));};exports[_0x901d('0x4e')]=function(_0x3fbb32,_0x109e0a){var _0x383b06={};var _0x2d6431={};var _0x4e9d42;var _0x596a04;return db['SquareProject'][_0x901d('0x4f')]({'where':{'id':_0x3fbb32[_0x901d('0x3c')]['id']}})[_0x901d('0x17')](handleEntityNotFound(_0x109e0a,null))[_0x901d('0x17')](function(_0x32bb51){if(_0x32bb51){_0x4e9d42=_0x32bb51;_0x2d6431[_0x901d('0x27')]=_[_0x901d('0x28')](db[_0x901d('0x50')][_0x901d('0x23')]);_0x2d6431['query']=_['keys'](_0x3fbb32[_0x901d('0x29')]);_0x2d6431[_0x901d('0x2a')]=_[_0x901d('0x2b')](_0x2d6431[_0x901d('0x27')],_0x2d6431[_0x901d('0x29')]);_0x383b06[_0x901d('0x2c')]=_[_0x901d('0x2b')](_0x2d6431[_0x901d('0x27')],qs[_0x901d('0x2d')](_0x3fbb32[_0x901d('0x29')]['fields']));_0x383b06[_0x901d('0x2c')]=_0x383b06[_0x901d('0x2c')]['length']?_0x383b06['attributes']:_0x2d6431[_0x901d('0x27')];_0x383b06[_0x901d('0x30')]=qs['sort'](_0x3fbb32[_0x901d('0x29')][_0x901d('0x31')]);_0x383b06[_0x901d('0x32')]=qs[_0x901d('0x2a')](_['pick'](_0x3fbb32[_0x901d('0x29')],_0x2d6431[_0x901d('0x2a')]));if(_0x3fbb32[_0x901d('0x29')][_0x901d('0x34')]){_0x383b06[_0x901d('0x32')]=_[_0x901d('0x36')](_0x383b06['where'],{'$or':_[_0x901d('0x22')](_0x383b06[_0x901d('0x2c')],function(_0x26b498){var _0x5763ef={};_0x5763ef[_0x26b498]={'$like':'%'+_0x3fbb32[_0x901d('0x29')][_0x901d('0x34')]+'%'};return _0x5763ef;})});}_0x383b06=_[_0x901d('0x36')]({},_0x383b06,_0x3fbb32['options']);return _0x4e9d42['getUsers'](_0x383b06);}})['then'](function(_0x2350ac){if(_0x2350ac){_0x596a04=_0x2350ac[_0x901d('0x2e')];if(!_0x3fbb32['query']['hasOwnProperty'](_0x901d('0x51'))){_0x383b06[_0x901d('0x12')]=qs[_0x901d('0x12')](_0x3fbb32[_0x901d('0x29')][_0x901d('0x12')]);_0x383b06['offset']=qs[_0x901d('0x10')](_0x3fbb32[_0x901d('0x29')][_0x901d('0x10')]);}return _0x4e9d42[_0x901d('0x4e')](_0x383b06);}})['then'](function(_0x2e1dcb){if(_0x2e1dcb){return _0x2e1dcb?{'count':_0x596a04,'rows':_0x2e1dcb}:null;}})['then'](respondWithResult(_0x109e0a,null))[_0x901d('0x3a')](handleError(_0x109e0a,null));}; \ No newline at end of file +var _0x2ef3=['include','findAll','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SquareProjects','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','stringify','pick','production','addUsers','omit','removeUsers','ids','isArray','getUsers','findOne','User','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','count','limit','set','update','then','destroy','get','UserProfileResource','agi','error','stack','map','SquareProject','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','merge','where','VIRTUAL','name','filter','options','includeAll'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x2ef3,0xba));var _0x32ef=function(_0x4a8a28,_0x459c9f){_0x4a8a28=_0x4a8a28-0x0;var _0x307f1e=_0x2ef3[_0x4a8a28];return _0x307f1e;};'use strict';var _=require(_0x32ef('0x0'));var Redis=require(_0x32ef('0x1'));var qs=require(_0x32ef('0x2'));var logger=require(_0x32ef('0x3'))(_0x32ef('0x4'));var config=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x6')]=_[_0x32ef('0x7')](config['redis'],{'host':_0x32ef('0x8'),'port':0x18eb});var socket=require(_0x32ef('0x9'))(new Redis(config['redis']));require('./squareProject.socket')[_0x32ef('0xa')](socket);function respondWithStatusCode(_0x4bfcf8,_0x367c39){_0x367c39=_0x367c39||0xcc;return function(_0x2fb8eb){if(_0x2fb8eb){return _0x4bfcf8[_0x32ef('0xb')](_0x367c39);}return _0x4bfcf8[_0x32ef('0xc')](_0x367c39)[_0x32ef('0xd')]();};}function respondWithResult(_0x2bbb50,_0x28275c){_0x28275c=_0x28275c||0xc8;return function(_0x77df79){if(_0x77df79){return _0x2bbb50['status'](_0x28275c)['json'](_0x77df79);}};}function respondWithFilteredResult(_0x401d0b,_0x33281d){return function(_0x45bfd5){if(_0x45bfd5){var _0x1499c2=typeof _0x33281d['offset']===_0x32ef('0xe')&&typeof _0x33281d['limit']===_0x32ef('0xe');var _0x49d590=_0x45bfd5[_0x32ef('0xf')];var _0x1ef1ae=_0x1499c2?0x0:_0x33281d['offset'];var _0x539d18=_0x1499c2?_0x45bfd5[_0x32ef('0xf')]:_0x33281d['offset']+_0x33281d[_0x32ef('0x10')];var _0x40a6e6;if(_0x539d18>=_0x49d590){_0x539d18=_0x49d590;_0x40a6e6=0xc8;}else{_0x40a6e6=0xce;}_0x401d0b[_0x32ef('0xc')](_0x40a6e6);return _0x401d0b[_0x32ef('0x11')]('Content-Range',_0x1ef1ae+'-'+_0x539d18+'/'+_0x49d590)['json'](_0x45bfd5);}return null;};}function saveUpdates(_0x531e30){return function(_0x13db1a){if(_0x13db1a){return _0x13db1a[_0x32ef('0x12')](_0x531e30)[_0x32ef('0x13')](function(_0x53a5ca){return _0x53a5ca;});}return null;};}function removeEntity(_0x5d559b){return function(_0x1eb468){if(_0x1eb468){return _0x1eb468[_0x32ef('0x14')]()[_0x32ef('0x13')](function(){var _0x57863c=_0x1eb468[_0x32ef('0x15')]({'plain':!![]});var _0x33e230='SquareProjects';return db[_0x32ef('0x16')][_0x32ef('0x14')]({'where':{'type':_0x33e230,'resourceId':_0x57863c['id']}})[_0x32ef('0x13')](function(){return _0x1eb468;});})[_0x32ef('0x13')](function(){var _0x445cda=new Redis(config[_0x32ef('0x6')]);_0x445cda['publish'](_0x32ef('0x17'),JSON['stringify']({'id':_0x1eb468['id'],'deleted':!![]}));})[_0x32ef('0x13')](function(){_0x5d559b[_0x32ef('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1af371){return function(_0x97780){if(!_0x97780){_0x1af371[_0x32ef('0xb')](0x194);}return _0x97780;};}function handleError(_0x55f7f2,_0x57f5e5){_0x57f5e5=_0x57f5e5||0x1f4;return function(_0x22f2d7){logger[_0x32ef('0x18')](_0x22f2d7[_0x32ef('0x19')]);if(_0x22f2d7['name']){delete _0x22f2d7['name'];}_0x55f7f2[_0x32ef('0xc')](_0x57f5e5)['send'](_0x22f2d7);};}exports['index']=function(_0x278495,_0x14d4b3){var _0x371540={},_0x1dbe98={},_0x15ce54={'count':0x0,'rows':[]};var _0x234175=_[_0x32ef('0x1a')](db[_0x32ef('0x1b')][_0x32ef('0x1c')],function(_0x2f52d7){return{'name':_0x2f52d7[_0x32ef('0x1d')],'type':_0x2f52d7[_0x32ef('0x1e')]['key']};});_0x1dbe98[_0x32ef('0x1f')]=_[_0x32ef('0x1a')](_0x234175,'name');_0x1dbe98[_0x32ef('0x20')]=_[_0x32ef('0x21')](_0x278495[_0x32ef('0x20')]);_0x1dbe98[_0x32ef('0x22')]=_['intersection'](_0x1dbe98[_0x32ef('0x1f')],_0x1dbe98[_0x32ef('0x20')]);_0x371540[_0x32ef('0x23')]=_[_0x32ef('0x24')](_0x1dbe98[_0x32ef('0x1f')],qs[_0x32ef('0x25')](_0x278495[_0x32ef('0x20')]['fields']));_0x371540[_0x32ef('0x23')]=_0x371540['attributes'][_0x32ef('0x26')]?_0x371540[_0x32ef('0x23')]:_0x1dbe98['model'];if(!_0x278495[_0x32ef('0x20')][_0x32ef('0x27')](_0x32ef('0x28'))){_0x371540[_0x32ef('0x10')]=qs[_0x32ef('0x10')](_0x278495['query']['limit']);_0x371540[_0x32ef('0x29')]=qs['offset'](_0x278495[_0x32ef('0x20')][_0x32ef('0x29')]);}_0x371540[_0x32ef('0x2a')]=qs[_0x32ef('0x2b')](_0x278495[_0x32ef('0x20')][_0x32ef('0x2b')]);_0x371540['where']=qs['filters'](_['pick'](_0x278495[_0x32ef('0x20')],_0x1dbe98[_0x32ef('0x22')]),_0x234175);if(_0x278495[_0x32ef('0x20')]['filter']){_0x371540['where']=_[_0x32ef('0x2c')](_0x371540[_0x32ef('0x2d')],{'$or':_[_0x32ef('0x1a')](_0x234175,function(_0x480348){if(_0x480348['type']!==_0x32ef('0x2e')){var _0x21706f={};_0x21706f[_0x480348[_0x32ef('0x2f')]]={'$like':'%'+_0x278495[_0x32ef('0x20')][_0x32ef('0x30')]+'%'};return _0x21706f;}})});}_0x371540=_[_0x32ef('0x2c')]({},_0x371540,_0x278495[_0x32ef('0x31')]);var _0x21da90={'where':_0x371540[_0x32ef('0x2d')]};return db['SquareProject'][_0x32ef('0xf')](_0x21da90)[_0x32ef('0x13')](function(_0x14b54f){_0x15ce54['count']=_0x14b54f;if(_0x278495[_0x32ef('0x20')][_0x32ef('0x32')]){_0x371540[_0x32ef('0x33')]=[{'all':!![]}];}return db[_0x32ef('0x1b')][_0x32ef('0x34')](_0x371540);})[_0x32ef('0x13')](function(_0x256c40){_0x15ce54[_0x32ef('0x35')]=_0x256c40;return _0x15ce54;})[_0x32ef('0x13')](respondWithFilteredResult(_0x14d4b3,_0x371540))[_0x32ef('0x36')](handleError(_0x14d4b3,null));};exports[_0x32ef('0x37')]=function(_0x4615b4,_0x48e071){var _0x3cac2e={'raw':![],'where':{'id':_0x4615b4[_0x32ef('0x38')]['id']}},_0xc3a6d3={};_0xc3a6d3[_0x32ef('0x1f')]=_[_0x32ef('0x21')](db[_0x32ef('0x1b')][_0x32ef('0x1c')]);_0xc3a6d3['query']=_['keys'](_0x4615b4[_0x32ef('0x20')]);_0xc3a6d3[_0x32ef('0x22')]=_[_0x32ef('0x24')](_0xc3a6d3[_0x32ef('0x1f')],_0xc3a6d3['query']);_0x3cac2e[_0x32ef('0x23')]=_[_0x32ef('0x24')](_0xc3a6d3['model'],qs[_0x32ef('0x25')](_0x4615b4['query'][_0x32ef('0x25')]));_0x3cac2e[_0x32ef('0x23')]=_0x3cac2e[_0x32ef('0x23')][_0x32ef('0x26')]?_0x3cac2e[_0x32ef('0x23')]:_0xc3a6d3[_0x32ef('0x1f')];if(_0x4615b4[_0x32ef('0x20')][_0x32ef('0x32')]){_0x3cac2e[_0x32ef('0x33')]=[{'all':!![]}];}_0x3cac2e=_[_0x32ef('0x2c')]({},_0x3cac2e,_0x4615b4['options']);return db[_0x32ef('0x1b')]['find'](_0x3cac2e)[_0x32ef('0x13')](handleEntityNotFound(_0x48e071,null))[_0x32ef('0x13')](respondWithResult(_0x48e071,null))[_0x32ef('0x36')](handleError(_0x48e071,null));};exports['create']=function(_0x502113,_0x230ac9){return db[_0x32ef('0x1b')][_0x32ef('0x39')](_0x502113[_0x32ef('0x3a')],{})[_0x32ef('0x13')](function(_0x12c9e6){var _0x47dbe1=_0x502113['user'][_0x32ef('0x15')]({'plain':!![]});if(!_0x47dbe1)throw new Error(_0x32ef('0x3b'));if(_0x47dbe1[_0x32ef('0x3c')]===_0x32ef('0x3d')){var _0x209361=_0x12c9e6[_0x32ef('0x15')]({'plain':!![]});var _0x44ad11=_0x32ef('0x3e');return db[_0x32ef('0x3f')][_0x32ef('0x40')]({'where':{'name':_0x44ad11,'userProfileId':_0x47dbe1[_0x32ef('0x41')]},'raw':!![]})[_0x32ef('0x13')](function(_0x36a65c){if(_0x36a65c&&_0x36a65c['autoAssociation']===0x0){return db[_0x32ef('0x16')][_0x32ef('0x39')]({'name':_0x209361[_0x32ef('0x2f')],'resourceId':_0x209361['id'],'type':_0x36a65c[_0x32ef('0x2f')],'sectionId':_0x36a65c['id']},{})[_0x32ef('0x13')](function(){return _0x12c9e6;});}else{return _0x12c9e6;}})[_0x32ef('0x36')](function(_0x278696){logger[_0x32ef('0x18')](_0x32ef('0x42'),_0x278696);throw _0x278696;});}return _0x12c9e6;})[_0x32ef('0x13')](respondWithResult(_0x230ac9,0xc9))[_0x32ef('0x36')](handleError(_0x230ac9,null));};exports[_0x32ef('0x12')]=function(_0x272377,_0x326445){if(_0x272377[_0x32ef('0x3a')]['id']){delete _0x272377[_0x32ef('0x3a')]['id'];}return db[_0x32ef('0x1b')][_0x32ef('0x40')]({'where':{'id':_0x272377['params']['id']}})['then'](handleEntityNotFound(_0x326445,null))[_0x32ef('0x13')](saveUpdates(_0x272377[_0x32ef('0x3a')],null))[_0x32ef('0x13')](function(_0x166405){if(!_0x166405)return;var _0x34bd3e=_0x166405[_0x32ef('0x15')]({'plain':!![]});return _0x34bd3e;})[_0x32ef('0x13')](function(_0x1f105a){var _0x15b640=new Redis(config[_0x32ef('0x6')]);_0x15b640[_0x32ef('0x43')]('agi',JSON[_0x32ef('0x44')](_[_0x32ef('0x45')](_0x1f105a,['id',_0x32ef('0x2f'),_0x32ef('0x46')])));return _0x1f105a;})[_0x32ef('0x13')](respondWithResult(_0x326445,null))[_0x32ef('0x36')](handleError(_0x326445,null));};exports['destroy']=function(_0x44a4e9,_0x1eeb3e){return db[_0x32ef('0x1b')]['find']({'where':{'id':_0x44a4e9[_0x32ef('0x38')]['id']}})['then'](handleEntityNotFound(_0x1eeb3e,null))[_0x32ef('0x13')](removeEntity(_0x1eeb3e,null))[_0x32ef('0x36')](handleError(_0x1eeb3e,null));};exports['addUsers']=function(_0x206ad5,_0x59e5f9){return db[_0x32ef('0x1b')][_0x32ef('0x40')]({'where':{'id':_0x206ad5[_0x32ef('0x38')]['id']}})[_0x32ef('0x13')](handleEntityNotFound(_0x59e5f9,null))[_0x32ef('0x13')](function(_0x30e377){if(_0x30e377){return _0x30e377[_0x32ef('0x47')](_0x206ad5['body']['ids'],_[_0x32ef('0x48')](_0x206ad5['body'],['ids','id'])||{});}})[_0x32ef('0x13')](respondWithResult(_0x59e5f9,null))[_0x32ef('0x36')](handleError(_0x59e5f9,null));};exports[_0x32ef('0x49')]=function(_0x6aae59,_0x2468e6){return db[_0x32ef('0x1b')][_0x32ef('0x40')]({'where':{'id':_0x6aae59[_0x32ef('0x38')]['id']}})[_0x32ef('0x13')](handleEntityNotFound(_0x2468e6,null))[_0x32ef('0x13')](function(_0x4c125c){if(_0x4c125c){return _0x4c125c['removeUsers'](_0x6aae59[_0x32ef('0x20')][_0x32ef('0x4a')])['then'](function(){if(_[_0x32ef('0x4b')](_0x6aae59[_0x32ef('0x20')][_0x32ef('0x4a')])){for(var _0x49c245=0x0;_0x49c245<_0x6aae59[_0x32ef('0x20')][_0x32ef('0x4a')][_0x32ef('0x26')];_0x49c245+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x6aae59[_0x32ef('0x20')]['ids'][_0x49c245]),'SquareProjectId':Number(_0x6aae59[_0x32ef('0x38')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x6aae59[_0x32ef('0x20')][_0x32ef('0x4a')]),'SquareProjectId':Number(_0x6aae59[_0x32ef('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x2468e6,null))[_0x32ef('0x36')](handleError(_0x2468e6,null));};exports[_0x32ef('0x4c')]=function(_0x5f9da7,_0x58ecbb){var _0x4557ce={};var _0x12b7f8={};var _0x4c3bab;var _0x4a4eaa;return db[_0x32ef('0x1b')][_0x32ef('0x4d')]({'where':{'id':_0x5f9da7[_0x32ef('0x38')]['id']}})[_0x32ef('0x13')](handleEntityNotFound(_0x58ecbb,null))[_0x32ef('0x13')](function(_0x40700e){if(_0x40700e){_0x4c3bab=_0x40700e;_0x12b7f8['model']=_[_0x32ef('0x21')](db[_0x32ef('0x4e')][_0x32ef('0x1c')]);_0x12b7f8[_0x32ef('0x20')]=_[_0x32ef('0x21')](_0x5f9da7[_0x32ef('0x20')]);_0x12b7f8[_0x32ef('0x22')]=_[_0x32ef('0x24')](_0x12b7f8[_0x32ef('0x1f')],_0x12b7f8['query']);_0x4557ce[_0x32ef('0x23')]=_[_0x32ef('0x24')](_0x12b7f8[_0x32ef('0x1f')],qs[_0x32ef('0x25')](_0x5f9da7[_0x32ef('0x20')]['fields']));_0x4557ce['attributes']=_0x4557ce[_0x32ef('0x23')][_0x32ef('0x26')]?_0x4557ce[_0x32ef('0x23')]:_0x12b7f8[_0x32ef('0x1f')];_0x4557ce[_0x32ef('0x2a')]=qs['sort'](_0x5f9da7[_0x32ef('0x20')]['sort']);_0x4557ce[_0x32ef('0x2d')]=qs[_0x32ef('0x22')](_['pick'](_0x5f9da7['query'],_0x12b7f8[_0x32ef('0x22')]));if(_0x5f9da7[_0x32ef('0x20')][_0x32ef('0x30')]){_0x4557ce['where']=_['merge'](_0x4557ce[_0x32ef('0x2d')],{'$or':_[_0x32ef('0x1a')](_0x4557ce[_0x32ef('0x23')],function(_0x416e62){var _0x4f4006={};_0x4f4006[_0x416e62]={'$like':'%'+_0x5f9da7[_0x32ef('0x20')][_0x32ef('0x30')]+'%'};return _0x4f4006;})});}_0x4557ce=_[_0x32ef('0x2c')]({},_0x4557ce,_0x5f9da7[_0x32ef('0x31')]);return _0x4c3bab[_0x32ef('0x4c')](_0x4557ce);}})[_0x32ef('0x13')](function(_0x43b176){if(_0x43b176){_0x4a4eaa=_0x43b176[_0x32ef('0x26')];if(!_0x5f9da7[_0x32ef('0x20')][_0x32ef('0x27')](_0x32ef('0x28'))){_0x4557ce[_0x32ef('0x10')]=qs['limit'](_0x5f9da7['query'][_0x32ef('0x10')]);_0x4557ce[_0x32ef('0x29')]=qs['offset'](_0x5f9da7[_0x32ef('0x20')]['offset']);}return _0x4c3bab[_0x32ef('0x4c')](_0x4557ce);}})[_0x32ef('0x13')](function(_0x323758){if(_0x323758){return _0x323758?{'count':_0x4a4eaa,'rows':_0x323758}:null;}})['then'](respondWithResult(_0x58ecbb,null))[_0x32ef('0x36')](handleError(_0x58ecbb,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index ee6b2af..9dfdd35 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 _0x4ffa=['../../mysqldb','save','update','remove','emit','hook'];(function(_0x3584b2,_0x55d909){var _0x3db4d9=function(_0x278e05){while(--_0x278e05){_0x3584b2['push'](_0x3584b2['shift']());}};_0x3db4d9(++_0x55d909);}(_0x4ffa,0xf0));var _0xa4ff=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4ffa[_0x5d6456];return _0x4d66c1;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xa4ff('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa4ff('0x1'),'afterUpdate':_0xa4ff('0x2'),'afterDestroy':_0xa4ff('0x3')};function emitEvent(_0x4e4cf4){return function(_0x42ed30,_0x4ed0ff,_0x18d990){SquareProjectEvents[_0xa4ff('0x4')](_0x4e4cf4+':'+_0x42ed30['id'],_0x42ed30);SquareProjectEvents[_0xa4ff('0x4')](_0x4e4cf4,_0x42ed30);_0x18d990(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xa4ff('0x5')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x240b=['remove','emit','hook','SquareProject','save','update'];(function(_0x59a5b5,_0x149bf2){var _0x3e4ba9=function(_0x37f3ed){while(--_0x37f3ed){_0x59a5b5['push'](_0x59a5b5['shift']());}};_0x3e4ba9(++_0x149bf2);}(_0x240b,0x9f));var _0xb240=function(_0x199632,_0x547ca0){_0x199632=_0x199632-0x0;var _0x2a516a=_0x240b[_0x199632];return _0x2a516a;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0xb240('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb240('0x1'),'afterUpdate':_0xb240('0x2'),'afterDestroy':_0xb240('0x3')};function emitEvent(_0x2e05ce){return function(_0x4963f1,_0x4a892e,_0x1f2095){SquareProjectEvents[_0xb240('0x4')](_0x2e05ce+':'+_0x4963f1['id'],_0x4963f1);SquareProjectEvents['emit'](_0x2e05ce,_0x4963f1);_0x1f2095(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xb240('0x5')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index e8beceb..39a294f 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 _0x6003=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6003,0xd0));var _0x3600=function(_0x59d339,_0x10fb52){_0x59d339=_0x59d339-0x0;var _0x1923cf=_0x6003[_0x59d339];return _0x1923cf;};'use strict';var _=require(_0x3600('0x0'));var util=require(_0x3600('0x1'));var logger=require(_0x3600('0x2'))(_0x3600('0x3'));var moment=require(_0x3600('0x4'));var BPromise=require(_0x3600('0x5'));var rp=require(_0x3600('0x6'));var fs=require('fs');var path=require(_0x3600('0x7'));var rimraf=require(_0x3600('0x8'));var config=require(_0x3600('0x9'));var attributes=require(_0x3600('0xa'));module['exports']=function(_0x32ea9e,_0x3409b5){return _0x32ea9e[_0x3600('0xb')](_0x3600('0xc'),attributes,{'tableName':_0x3600('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1341f1,_0x14f0fa,_0x4a3adc){if(_0x1341f1[_0x3600('0xe')](_0x3600('0xf'))){_0x1341f1[_0x3600('0x10')]=moment()[_0x3600('0x11')](_0x3600('0x12'));}if(_0x1341f1[_0x3600('0xe')](_0x3600('0x13'))){_0x1341f1[_0x3600('0x14')]=moment()['format'](_0x3600('0x12'));}_0x4a3adc(null,_0x1341f1);}}});}; \ No newline at end of file +var _0xc2b1=['savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','preproduction'];(function(_0x4abe2e,_0x277f70){var _0xcb1e19=function(_0x50fbd7){while(--_0x50fbd7){_0x4abe2e['push'](_0x4abe2e['shift']());}};_0xcb1e19(++_0x277f70);}(_0xc2b1,0x76));var _0x1c2b=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0xc2b1[_0x2abc3d];return _0x252745;};'use strict';var _=require(_0x1c2b('0x0'));var util=require(_0x1c2b('0x1'));var logger=require(_0x1c2b('0x2'))(_0x1c2b('0x3'));var moment=require(_0x1c2b('0x4'));var BPromise=require(_0x1c2b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c2b('0x6'));var rimraf=require(_0x1c2b('0x7'));var config=require(_0x1c2b('0x8'));var attributes=require(_0x1c2b('0x9'));module[_0x1c2b('0xa')]=function(_0x20920f,_0x5cf7ee){return _0x20920f['define'](_0x1c2b('0xb'),attributes,{'tableName':_0x1c2b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ce9e8,_0x7302b5,_0x5003cc){if(_0x4ce9e8[_0x1c2b('0xd')](_0x1c2b('0xe'))){_0x4ce9e8[_0x1c2b('0xf')]=moment()[_0x1c2b('0x10')](_0x1c2b('0x11'));}if(_0x4ce9e8[_0x1c2b('0xd')](_0x1c2b('0x12'))){_0x4ce9e8['publishedAt']=moment()[_0x1c2b('0x10')](_0x1c2b('0x11'));}_0x5003cc(null,_0x4ce9e8);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 4b2de48..1789f83 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 _0xbb62=['raw','where','limit','include','map','model','attributes','then','info','stringify','error','message','ShowSquareProject','debug','catch','ioredis','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options'];(function(_0x59b4c5,_0x70659a){var _0x6b253e=function(_0x2edd7d){while(--_0x2edd7d){_0x59b4c5['push'](_0x59b4c5['shift']());}};_0x6b253e(++_0x70659a);}(_0xbb62,0x96));var _0x2bb6=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0xbb62[_0x4d1ee9];return _0x9a5456;};'use strict';var _=require('lodash');var Redis=require(_0x2bb6('0x0'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('rpc');var config=require(_0x2bb6('0x1'));config[_0x2bb6('0x2')]=_[_0x2bb6('0x3')](config['redis'],{'host':_0x2bb6('0x4'),'port':0x18eb});var socket=require(_0x2bb6('0x5'))(new Redis(config[_0x2bb6('0x2')]));require(_0x2bb6('0x6'))[_0x2bb6('0x7')](socket);exports[_0x2bb6('0x8')]=function(_0x52874a){var _0x594eab=this;return new Promise(function(_0x20c642,_0x2f8a4b){return db[_0x2bb6('0x9')][_0x2bb6('0xa')]({'raw':_0x52874a[_0x2bb6('0xb')]?_0x52874a['options'][_0x2bb6('0xc')]===undefined?!![]:![]:!![],'where':_0x52874a[_0x2bb6('0xb')]?_0x52874a[_0x2bb6('0xb')][_0x2bb6('0xd')]||null:null,'attributes':_0x52874a[_0x2bb6('0xb')]?_0x52874a['options']['attributes']||null:null,'limit':_0x52874a[_0x2bb6('0xb')]?_0x52874a[_0x2bb6('0xb')][_0x2bb6('0xe')]||null:null,'include':_0x52874a[_0x2bb6('0xb')]?_0x52874a['options'][_0x2bb6('0xf')]?_[_0x2bb6('0x10')](_0x52874a['options']['include'],function(_0x45099c){return{'model':db[_0x45099c[_0x2bb6('0x11')]],'as':_0x45099c['as'],'attributes':_0x45099c[_0x2bb6('0x12')],'include':_0x45099c[_0x2bb6('0xf')]?_[_0x2bb6('0x10')](_0x45099c[_0x2bb6('0xf')],function(_0x1855f5){return{'model':db[_0x1855f5[_0x2bb6('0x11')]],'as':_0x1855f5['as'],'attributes':_0x1855f5[_0x2bb6('0x12')],'include':_0x1855f5[_0x2bb6('0xf')]?_[_0x2bb6('0x10')](_0x1855f5['include'],function(_0x117a0e){return{'model':db[_0x117a0e[_0x2bb6('0x11')]],'as':_0x117a0e['as'],'attributes':_0x117a0e[_0x2bb6('0x12')]};}):[]};}):[]};}):[]:[]})[_0x2bb6('0x13')](function(_0x5acada){logger[_0x2bb6('0x14')]('GetSquareProjects',_0x52874a);logger['debug'](_0x2bb6('0x8'),_0x52874a,JSON[_0x2bb6('0x15')](_0x5acada));_0x20c642(_0x5acada);})['catch'](function(_0x33792b){logger[_0x2bb6('0x16')](_0x2bb6('0x8'),_0x33792b[_0x2bb6('0x17')],_0x52874a);_0x2f8a4b(_0x594eab[_0x2bb6('0x16')](0x1f4,_0x33792b[_0x2bb6('0x17')]));});});};exports[_0x2bb6('0x18')]=function(_0x20e5d2){var _0xa242e9=this;return new Promise(function(_0x28faaf,_0x238af0){return db[_0x2bb6('0x9')]['find']({'raw':_0x20e5d2[_0x2bb6('0xb')]?_0x20e5d2['options'][_0x2bb6('0xc')]===undefined?!![]:![]:!![],'where':_0x20e5d2['options']?_0x20e5d2[_0x2bb6('0xb')][_0x2bb6('0xd')]||null:null,'attributes':_0x20e5d2[_0x2bb6('0xb')]?_0x20e5d2[_0x2bb6('0xb')]['attributes']||null:null,'include':_0x20e5d2[_0x2bb6('0xb')]?_0x20e5d2[_0x2bb6('0xb')][_0x2bb6('0xf')]?_[_0x2bb6('0x10')](_0x20e5d2[_0x2bb6('0xb')]['include'],function(_0x21e104){return{'model':db[_0x21e104[_0x2bb6('0x11')]],'as':_0x21e104['as'],'attributes':_0x21e104[_0x2bb6('0x12')],'include':_0x21e104[_0x2bb6('0xf')]?_[_0x2bb6('0x10')](_0x21e104['include'],function(_0x26a549){return{'model':db[_0x26a549[_0x2bb6('0x11')]],'as':_0x26a549['as'],'attributes':_0x26a549[_0x2bb6('0x12')],'include':_0x26a549[_0x2bb6('0xf')]?_[_0x2bb6('0x10')](_0x26a549[_0x2bb6('0xf')],function(_0x5611f8){return{'model':db[_0x5611f8[_0x2bb6('0x11')]],'as':_0x5611f8['as'],'attributes':_0x5611f8[_0x2bb6('0x12')]};}):[]};}):[]};}):[]:[]})[_0x2bb6('0x13')](function(_0xa69918){logger[_0x2bb6('0x14')](_0x2bb6('0x18'),_0x20e5d2);logger[_0x2bb6('0x19')](_0x2bb6('0x18'),_0x20e5d2,JSON[_0x2bb6('0x15')](_0xa69918));_0x28faaf(_0xa69918);})[_0x2bb6('0x1a')](function(_0x5e27df){logger[_0x2bb6('0x16')](_0x2bb6('0x18'),_0x5e27df[_0x2bb6('0x17')],_0x20e5d2);_0x238af0(_0xa242e9[_0x2bb6('0x16')](0x1f4,_0x5e27df[_0x2bb6('0x17')]));});});}; \ No newline at end of file +var _0x3f19=['GetSquareProjects','catch','message','error','SquareProject','find','where','ShowSquareProject','debug','stringify','lodash','../../mysqldb','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','findAll','raw','options','limit','include','map','model','attributes','then','info'];(function(_0xf5a599,_0x485419){var _0x5d0919=function(_0x313c5d){while(--_0x313c5d){_0xf5a599['push'](_0xf5a599['shift']());}};_0x5d0919(++_0x485419);}(_0x3f19,0x149));var _0x93f1=function(_0x4ec520,_0x15fee2){_0x4ec520=_0x4ec520-0x0;var _0xed49d7=_0x3f19[_0x4ec520];return _0xed49d7;};'use strict';var _=require(_0x93f1('0x0'));var Redis=require('ioredis');var db=require(_0x93f1('0x1'))['db'];var logger=require(_0x93f1('0x2'))(_0x93f1('0x3'));var config=require('../../config/environment');config[_0x93f1('0x4')]=_[_0x93f1('0x5')](config['redis'],{'host':_0x93f1('0x6'),'port':0x18eb});var socket=require(_0x93f1('0x7'))(new Redis(config[_0x93f1('0x4')]));require(_0x93f1('0x8'))['register'](socket);exports['GetSquareProjects']=function(_0x3bb48e){var _0x554013=this;return new Promise(function(_0x56f598,_0x359266){return db['SquareProject'][_0x93f1('0x9')]({'raw':_0x3bb48e['options']?_0x3bb48e['options'][_0x93f1('0xa')]===undefined?!![]:![]:!![],'where':_0x3bb48e[_0x93f1('0xb')]?_0x3bb48e[_0x93f1('0xb')]['where']||null:null,'attributes':_0x3bb48e[_0x93f1('0xb')]?_0x3bb48e[_0x93f1('0xb')]['attributes']||null:null,'limit':_0x3bb48e[_0x93f1('0xb')]?_0x3bb48e[_0x93f1('0xb')][_0x93f1('0xc')]||null:null,'include':_0x3bb48e[_0x93f1('0xb')]?_0x3bb48e[_0x93f1('0xb')][_0x93f1('0xd')]?_[_0x93f1('0xe')](_0x3bb48e[_0x93f1('0xb')][_0x93f1('0xd')],function(_0xca8f96){return{'model':db[_0xca8f96[_0x93f1('0xf')]],'as':_0xca8f96['as'],'attributes':_0xca8f96['attributes'],'include':_0xca8f96[_0x93f1('0xd')]?_[_0x93f1('0xe')](_0xca8f96['include'],function(_0x95e3b1){return{'model':db[_0x95e3b1['model']],'as':_0x95e3b1['as'],'attributes':_0x95e3b1['attributes'],'include':_0x95e3b1[_0x93f1('0xd')]?_[_0x93f1('0xe')](_0x95e3b1[_0x93f1('0xd')],function(_0x3d4c47){return{'model':db[_0x3d4c47['model']],'as':_0x3d4c47['as'],'attributes':_0x3d4c47[_0x93f1('0x10')]};}):[]};}):[]};}):[]:[]})[_0x93f1('0x11')](function(_0x59517d){logger[_0x93f1('0x12')](_0x93f1('0x13'),_0x3bb48e);logger['debug'](_0x93f1('0x13'),_0x3bb48e,JSON['stringify'](_0x59517d));_0x56f598(_0x59517d);})[_0x93f1('0x14')](function(_0x5beaf3){logger['error'](_0x93f1('0x13'),_0x5beaf3[_0x93f1('0x15')],_0x3bb48e);_0x359266(_0x554013[_0x93f1('0x16')](0x1f4,_0x5beaf3['message']));});});};exports['ShowSquareProject']=function(_0x3a967b){var _0x35a536=this;return new Promise(function(_0x116943,_0xaab2b0){return db[_0x93f1('0x17')][_0x93f1('0x18')]({'raw':_0x3a967b[_0x93f1('0xb')]?_0x3a967b['options']['raw']===undefined?!![]:![]:!![],'where':_0x3a967b['options']?_0x3a967b[_0x93f1('0xb')][_0x93f1('0x19')]||null:null,'attributes':_0x3a967b[_0x93f1('0xb')]?_0x3a967b[_0x93f1('0xb')][_0x93f1('0x10')]||null:null,'include':_0x3a967b['options']?_0x3a967b['options'][_0x93f1('0xd')]?_[_0x93f1('0xe')](_0x3a967b[_0x93f1('0xb')]['include'],function(_0x3fe9b4){return{'model':db[_0x3fe9b4[_0x93f1('0xf')]],'as':_0x3fe9b4['as'],'attributes':_0x3fe9b4['attributes'],'include':_0x3fe9b4['include']?_[_0x93f1('0xe')](_0x3fe9b4[_0x93f1('0xd')],function(_0x4f53e1){return{'model':db[_0x4f53e1['model']],'as':_0x4f53e1['as'],'attributes':_0x4f53e1['attributes'],'include':_0x4f53e1[_0x93f1('0xd')]?_['map'](_0x4f53e1[_0x93f1('0xd')],function(_0x4d0f12){return{'model':db[_0x4d0f12[_0x93f1('0xf')]],'as':_0x4d0f12['as'],'attributes':_0x4d0f12[_0x93f1('0x10')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc97c83){logger[_0x93f1('0x12')](_0x93f1('0x1a'),_0x3a967b);logger[_0x93f1('0x1b')](_0x93f1('0x1a'),_0x3a967b,JSON[_0x93f1('0x1c')](_0xc97c83));_0x116943(_0xc97c83);})[_0x93f1('0x14')](function(_0x39f0a4){logger[_0x93f1('0x16')]('ShowSquareProject',_0x39f0a4[_0x93f1('0x15')],_0x3a967b);_0xaab2b0(_0x35a536[_0x93f1('0x16')](0x1f4,_0x39f0a4['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 8bdaec8..f387a55 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 _0xda69=['removeListener','register','length','squareProject:','remove','update'];(function(_0x29a894,_0x5f2d6f){var _0x588f68=function(_0x3a19cf){while(--_0x3a19cf){_0x29a894['push'](_0x29a894['shift']());}};_0x588f68(++_0x5f2d6f);}(_0xda69,0x112));var _0x9da6=function(_0x56ba92,_0xb3c986){_0x56ba92=_0x56ba92-0x0;var _0x8fe94d=_0xda69[_0x56ba92];return _0x8fe94d;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0x9da6('0x0'),_0x9da6('0x1')];function createListener(_0x43a4f0,_0x232415){return function(_0x843b4d){_0x232415['emit'](_0x43a4f0,_0x843b4d);};}function removeListener(_0x31a4a5,_0x4521c9){return function(){SquareProjectEvents[_0x9da6('0x2')](_0x31a4a5,_0x4521c9);};}exports[_0x9da6('0x3')]=function(_0x588b6c){for(var _0x57ac8f=0x0,_0x491942=events[_0x9da6('0x4')];_0x57ac8f<_0x491942;_0x57ac8f++){var _0x3ed8c1=events[_0x57ac8f];var _0x2fcfd6=createListener(_0x9da6('0x5')+_0x3ed8c1,_0x588b6c);SquareProjectEvents['on'](_0x3ed8c1,_0x2fcfd6);}}; \ No newline at end of file +var _0x92db=['squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x92db,0xc9));var _0xb92d=function(_0x1f51c0,_0x2ddf83){_0x1f51c0=_0x1f51c0-0x0;var _0x1841cb=_0x92db[_0x1f51c0];return _0x1841cb;};'use strict';var SquareProjectEvents=require(_0xb92d('0x0'));var events=[_0xb92d('0x1'),_0xb92d('0x2'),_0xb92d('0x3')];function createListener(_0x219ae2,_0x341948){return function(_0x2b1778){_0x341948[_0xb92d('0x4')](_0x219ae2,_0x2b1778);};}function removeListener(_0x58bbed,_0x1869e5){return function(){SquareProjectEvents[_0xb92d('0x5')](_0x58bbed,_0x1869e5);};}exports[_0xb92d('0x6')]=function(_0x3a6193){for(var _0x2b587b=0x0,_0x3ad789=events['length'];_0x2b587b<_0x3ad789;_0x2b587b++){var _0x9f3487=events[_0x2b587b];var _0x4ae176=createListener(_0xb92d('0x7')+_0x9f3487,_0x3a6193);SquareProjectEvents['on'](_0x9f3487,_0x4ae176);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 9119513..fc86fca 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 _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x19f8b6,_0x2b4e8c){var _0x213ebc=function(_0x40fc8c){while(--_0x40fc8c){_0x19f8b6['push'](_0x19f8b6['shift']());}};_0x213ebc(++_0x2b4e8c);}(_0x326f,0xd1));var _0xf326=function(_0x49793e,_0x1b97fa){_0x49793e=_0x49793e-0x0;var _0x152df8=_0x326f[_0x49793e];return _0x152df8;};'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/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x1c0b18,_0x67b802){var _0x4e7913=function(_0x2ca308){while(--_0x2ca308){_0x1c0b18['push'](_0x1c0b18['shift']());}};_0x4e7913(++_0x67b802);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xc4aa[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 4584724..a79a5f3 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 _0xac31=['STRING','VIRTUAL','savePath','lastIndexOf','sequelize','exports'];(function(_0x48de84,_0x291585){var _0x186874=function(_0x4e92c4){while(--_0x4e92c4){_0x48de84['push'](_0x48de84['shift']());}};_0x186874(++_0x291585);}(_0xac31,0xca));var _0x1ac3=function(_0xa30f55,_0x382ad8){_0xa30f55=_0xa30f55-0x0;var _0x5d3d9a=_0xac31[_0xa30f55];return _0x5d3d9a;};'use strict';var Sequelize=require(_0x1ac3('0x0'));module[_0x1ac3('0x1')]={'uniqueid':{'type':Sequelize[_0x1ac3('0x2')]},'callerid':{'type':Sequelize[_0x1ac3('0x2')]},'calleridname':{'type':Sequelize[_0x1ac3('0x2')]},'context':{'type':Sequelize[_0x1ac3('0x2')]},'extension':{'type':Sequelize[_0x1ac3('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1ac3('0x2')]},'dnid':{'type':Sequelize[_0x1ac3('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x1ac3('0x2')]},'savePath':{'type':Sequelize[_0x1ac3('0x2')]},'format':{'type':Sequelize[_0x1ac3('0x3')],'get':function(){var _0x1be223='';var _0x157604=this['getDataValue'](_0x1ac3('0x4'));if(_0x157604){_0x1be223=_0x157604['substring'](_0x157604[_0x1ac3('0x5')]('.'));}return _0x1be223;}}}; \ No newline at end of file +var _0x8958=['savePath','substring','lastIndexOf','exports','STRING','VIRTUAL'];(function(_0x3dc089,_0x5ccb0d){var _0x34d9d3=function(_0x4556bf){while(--_0x4556bf){_0x3dc089['push'](_0x3dc089['shift']());}};_0x34d9d3(++_0x5ccb0d);}(_0x8958,0x93));var _0x8895=function(_0x6733ad,_0x47e327){_0x6733ad=_0x6733ad-0x0;var _0x139b51=_0x8958[_0x6733ad];return _0x139b51;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x8895('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8895('0x1')]},'dnid':{'type':Sequelize[_0x8895('0x1')]},'projectName':{'type':Sequelize[_0x8895('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x8895('0x1')]},'savePath':{'type':Sequelize[_0x8895('0x1')]},'format':{'type':Sequelize[_0x8895('0x2')],'get':function(){var _0x40cec6='';var _0x33013a=this['getDataValue'](_0x8895('0x3'));if(_0x33013a){_0x40cec6=_0x33013a[_0x8895('0x4')](_0x33013a[_0x8895('0x5')]('.'));}return _0x40cec6;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index bbd1218..00afe46 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 _0xd353=['secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','then','destroy','status','error','stack','name','index','map','SquareRecording','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile'];(function(_0x267c93,_0x133bfe){var _0x24d2c3=function(_0x3c3466){while(--_0x3c3466){_0x267c93['push'](_0x267c93['shift']());}};_0x24d2c3(++_0x133bfe);}(_0xd353,0xd1));var _0x3d35=function(_0x948867,_0x475f5e){_0x948867=_0x948867-0x0;var _0x2b5b30=_0xd353[_0x948867];return _0x2b5b30;};'use strict';var emlformat=require(_0x3d35('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3d35('0x1'));var jsonpatch=require(_0x3d35('0x2'));var rp=require(_0x3d35('0x3'));var moment=require('moment');var BPromise=require(_0x3d35('0x4'));var Mustache=require(_0x3d35('0x5'));var util=require(_0x3d35('0x6'));var path=require(_0x3d35('0x7'));var sox=require(_0x3d35('0x8'));var csv=require('to-csv');var ejs=require(_0x3d35('0x9'));var fs=require('fs');var fs_extra=require(_0x3d35('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d35('0xb'));var jsforce=require(_0x3d35('0xc'));var deskjs=require(_0x3d35('0xd'));var toCsv=require(_0x3d35('0xe'));var querystring=require(_0x3d35('0xf'));var Papa=require(_0x3d35('0x10'));var Redis=require('ioredis');var authService=require(_0x3d35('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3d35('0x12'));var hardwareService=require(_0x3d35('0x13'));var logger=require(_0x3d35('0x14'))(_0x3d35('0x15'));var utils=require(_0x3d35('0x16'));var config=require(_0x3d35('0x17'));var licenseUtil=require(_0x3d35('0x18'));var db=require(_0x3d35('0x19'))['db'];function respondWithStatusCode(_0x5c10a4,_0x20e58a){_0x20e58a=_0x20e58a||0xcc;return function(_0x4ff813){if(_0x4ff813){return _0x5c10a4[_0x3d35('0x1a')](_0x20e58a);}return _0x5c10a4['status'](_0x20e58a)[_0x3d35('0x1b')]();};}function respondWithResult(_0x38a6e7,_0xba715e){_0xba715e=_0xba715e||0xc8;return function(_0x1493cc){if(_0x1493cc){return _0x38a6e7['status'](_0xba715e)[_0x3d35('0x1c')](_0x1493cc);}};}function respondWithFilteredResult(_0x94c43,_0x59f59d){return function(_0x5e0316){if(_0x5e0316){var _0x1bce34=typeof _0x59f59d[_0x3d35('0x1d')]===_0x3d35('0x1e')&&typeof _0x59f59d['limit']===_0x3d35('0x1e');var _0x3f092a=_0x5e0316[_0x3d35('0x1f')];var _0x47aec7=_0x1bce34?0x0:_0x59f59d[_0x3d35('0x1d')];var _0x1a944c=_0x1bce34?_0x5e0316[_0x3d35('0x1f')]:_0x59f59d[_0x3d35('0x1d')]+_0x59f59d[_0x3d35('0x20')];var _0x2dfb20;if(_0x1a944c>=_0x3f092a){_0x1a944c=_0x3f092a;_0x2dfb20=0xc8;}else{_0x2dfb20=0xce;}_0x94c43['status'](_0x2dfb20);return _0x94c43[_0x3d35('0x21')](_0x3d35('0x22'),_0x47aec7+'-'+_0x1a944c+'/'+_0x3f092a)[_0x3d35('0x1c')](_0x5e0316);}return null;};}function patchUpdates(_0x24f970){return function(_0x55b578){try{jsonpatch[_0x3d35('0x23')](_0x55b578,_0x24f970,!![]);}catch(_0x5289c8){return BPromise['reject'](_0x5289c8);}return _0x55b578['save']();};}function saveUpdates(_0x4c04fb,_0x4310a8){return function(_0x33bc65){if(_0x33bc65){return _0x33bc65['update'](_0x4c04fb)[_0x3d35('0x24')](function(_0x47e599){return _0x47e599;});}return null;};}function removeEntity(_0x229911,_0x420fd7){return function(_0x3a8036){if(_0x3a8036){return _0x3a8036[_0x3d35('0x25')]()['then'](function(){_0x229911[_0x3d35('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a0e1c,_0x5b05b0){return function(_0x13d896){if(!_0x13d896){_0x4a0e1c[_0x3d35('0x1a')](0x194);}return _0x13d896;};}function handleError(_0x1d22c3,_0x506b14){_0x506b14=_0x506b14||0x1f4;return function(_0x288af9){logger[_0x3d35('0x27')](_0x288af9[_0x3d35('0x28')]);if(_0x288af9[_0x3d35('0x29')]){delete _0x288af9[_0x3d35('0x29')];}_0x1d22c3['status'](_0x506b14)['send'](_0x288af9);};}exports[_0x3d35('0x2a')]=function(_0x2889f0,_0x36476e){var _0x2ff8c7={},_0x38c766={},_0x35587e={'count':0x0,'rows':[]};var _0x32f728=_[_0x3d35('0x2b')](db[_0x3d35('0x2c')][_0x3d35('0x2d')],function(_0x185eb0){return{'name':_0x185eb0['fieldName'],'type':_0x185eb0['type'][_0x3d35('0x2e')]};});_0x38c766[_0x3d35('0x2f')]=_[_0x3d35('0x2b')](_0x32f728,_0x3d35('0x29'));_0x38c766[_0x3d35('0x30')]=_[_0x3d35('0x31')](_0x2889f0[_0x3d35('0x30')]);_0x38c766[_0x3d35('0x32')]=_[_0x3d35('0x33')](_0x38c766[_0x3d35('0x2f')],_0x38c766[_0x3d35('0x30')]);_0x2ff8c7[_0x3d35('0x34')]=_[_0x3d35('0x33')](_0x38c766[_0x3d35('0x2f')],qs[_0x3d35('0x35')](_0x2889f0[_0x3d35('0x30')][_0x3d35('0x35')]));_0x2ff8c7[_0x3d35('0x34')]=_0x2ff8c7[_0x3d35('0x34')][_0x3d35('0x36')]?_0x2ff8c7[_0x3d35('0x34')]:_0x38c766[_0x3d35('0x2f')];if(!_0x2889f0[_0x3d35('0x30')]['hasOwnProperty'](_0x3d35('0x37'))){_0x2ff8c7[_0x3d35('0x20')]=qs[_0x3d35('0x20')](_0x2889f0[_0x3d35('0x30')]['limit']);_0x2ff8c7[_0x3d35('0x1d')]=qs['offset'](_0x2889f0[_0x3d35('0x30')][_0x3d35('0x1d')]);}_0x2ff8c7[_0x3d35('0x38')]=qs[_0x3d35('0x39')](_0x2889f0[_0x3d35('0x30')]['sort']);_0x2ff8c7[_0x3d35('0x3a')]=qs[_0x3d35('0x32')](_['pick'](_0x2889f0['query'],_0x38c766[_0x3d35('0x32')]),_0x32f728);if(_0x2889f0[_0x3d35('0x30')][_0x3d35('0x3b')]){_0x2ff8c7[_0x3d35('0x3a')]=_['merge'](_0x2ff8c7[_0x3d35('0x3a')],{'$or':_[_0x3d35('0x2b')](_0x32f728,function(_0x24519f){if(_0x24519f[_0x3d35('0x3c')]!==_0x3d35('0x3d')){var _0x4dde5f={};_0x4dde5f[_0x24519f[_0x3d35('0x29')]]={'$like':'%'+_0x2889f0[_0x3d35('0x30')]['filter']+'%'};return _0x4dde5f;}})});}_0x2ff8c7=_[_0x3d35('0x3e')]({},_0x2ff8c7,_0x2889f0['options']);var _0x6cdd96={'where':_0x2ff8c7[_0x3d35('0x3a')]};return db[_0x3d35('0x2c')][_0x3d35('0x1f')](_0x6cdd96)[_0x3d35('0x24')](function(_0x2436f5){_0x35587e[_0x3d35('0x1f')]=_0x2436f5;if(_0x2889f0['query'][_0x3d35('0x3f')]){_0x2ff8c7[_0x3d35('0x40')]=[{'all':!![]}];}return db[_0x3d35('0x2c')][_0x3d35('0x41')](_0x2ff8c7);})[_0x3d35('0x24')](function(_0x2ecc49){_0x35587e[_0x3d35('0x42')]=_0x2ecc49;return _0x35587e;})[_0x3d35('0x24')](respondWithFilteredResult(_0x36476e,_0x2ff8c7))['catch'](handleError(_0x36476e,null));};exports[_0x3d35('0x43')]=function(_0x38f4c6,_0x2e0d25){var _0x315fb0={'raw':!![],'where':{'id':_0x38f4c6['params']['id']}},_0x2e5716={};_0x2e5716[_0x3d35('0x2f')]=_[_0x3d35('0x31')](db[_0x3d35('0x2c')][_0x3d35('0x2d')]);_0x2e5716[_0x3d35('0x30')]=_[_0x3d35('0x31')](_0x38f4c6[_0x3d35('0x30')]);_0x2e5716[_0x3d35('0x32')]=_[_0x3d35('0x33')](_0x2e5716[_0x3d35('0x2f')],_0x2e5716['query']);_0x315fb0[_0x3d35('0x34')]=_[_0x3d35('0x33')](_0x2e5716[_0x3d35('0x2f')],qs[_0x3d35('0x35')](_0x38f4c6[_0x3d35('0x30')][_0x3d35('0x35')]));_0x315fb0['attributes']=_0x315fb0[_0x3d35('0x34')]['length']?_0x315fb0[_0x3d35('0x34')]:_0x2e5716['model'];if(_0x38f4c6[_0x3d35('0x30')]['includeAll']){_0x315fb0[_0x3d35('0x40')]=[{'all':!![]}];}_0x315fb0=_['merge']({},_0x315fb0,_0x38f4c6['options']);return db[_0x3d35('0x2c')][_0x3d35('0x44')](_0x315fb0)[_0x3d35('0x24')](handleEntityNotFound(_0x2e0d25,null))[_0x3d35('0x24')](respondWithResult(_0x2e0d25,null))[_0x3d35('0x45')](handleError(_0x2e0d25,null));};exports['create']=function(_0x46dd26,_0x22bc5e){return db[_0x3d35('0x2c')][_0x3d35('0x46')](_0x46dd26[_0x3d35('0x47')],{})[_0x3d35('0x24')](respondWithResult(_0x22bc5e,0xc9))[_0x3d35('0x45')](handleError(_0x22bc5e,null));};exports[_0x3d35('0x48')]=function(_0xc2aca0,_0x23a200){if(_0xc2aca0['body']['id']){delete _0xc2aca0[_0x3d35('0x47')]['id'];}return db[_0x3d35('0x2c')][_0x3d35('0x44')]({'where':{'id':_0xc2aca0[_0x3d35('0x49')]['id']}})['then'](handleEntityNotFound(_0x23a200,null))[_0x3d35('0x24')](saveUpdates(_0xc2aca0[_0x3d35('0x47')],null))[_0x3d35('0x24')](respondWithResult(_0x23a200,null))['catch'](handleError(_0x23a200,null));};exports['download']=function(_0x25cfc2,_0x584919,_0x4a432e){var _0x246149=require(_0x3d35('0x4a'));var _0x3ffbfe=![];var _0x57839b={};if(_0x25cfc2[_0x3d35('0x30')][_0x3d35('0x3c')]&&_0x25cfc2[_0x3d35('0x30')][_0x3d35('0x3c')]==='uniqueid'){_0x57839b[_0x3d35('0x4b')]=_0x25cfc2[_0x3d35('0x49')]['id'];}else{_0x57839b['id']=_0x25cfc2[_0x3d35('0x49')]['id'];}return db['SquareRecording']['find']({'where':_0x57839b,'attributes':['id',_0x3d35('0x4c'),_0x3d35('0x4d')],'raw':!![]})[_0x3d35('0x24')](handleEntityNotFound(_0x584919,null))['then'](function(_0x19d683){if(_0x19d683){var _0x37b1a7=_0x19d683[_0x3d35('0x4c')];var _0x36b50d=util[_0x3d35('0x4e')](_0x3d35('0x4f'),_0x37b1a7);if(fs[_0x3d35('0x50')](_0x36b50d)){_0x3ffbfe=!![];return _0x246149[_0x3d35('0x51')](_0x36b50d,_0x37b1a7,config[_0x3d35('0x52')][_0x3d35('0x53')])[_0x3d35('0x24')](function(){return _0x19d683;});}return _0x19d683;}})[_0x3d35('0x24')](function(_0x3c61ba){if(_0x3c61ba){var _0x5012d6=_0x3c61ba['savePath'];if(!fs[_0x3d35('0x50')](_0x5012d6)){throw new db[(_0x3d35('0x54'))][(_0x3d35('0x55'))](_0x3d35('0x56'));}if(_0x3c61ba[_0x3d35('0x4d')]){return _0x584919[_0x3d35('0x57')](_0x5012d6,_0x3c61ba[_0x3d35('0x4d')]+path[_0x3d35('0x58')](_0x5012d6),function(){if(_0x3ffbfe){fs['unlink'](_0x5012d6);}});}else{return _0x584919[_0x3d35('0x57')](_0x5012d6,function(_0x118c5b){if(_0x3ffbfe){fs[_0x3d35('0x59')](_0x5012d6);}});}}})[_0x3d35('0x45')](function(_0x2b7e77){if(_0x2b7e77[_0x3d35('0x5a')]===_0x3d35('0x56')){_0x584919[_0x3d35('0x26')](0x194)['send']('Not\x20found');}else{return handleError(_0x584919,null);}});};exports['destroy']=function(_0x3c5204,_0x480549){return db[_0x3d35('0x2c')][_0x3d35('0x44')]({'where':{'id':_0x3c5204[_0x3d35('0x49')]['id']}})['then'](function(_0x52130e){if(_[_0x3d35('0x5b')](_0x52130e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x52130e;})['then'](function(_0x5a3f49){var _0xf64c0a=_0x5a3f49['savePath'];logger[_0x3d35('0x5c')]('cancellazione\x20fisica\x20documento\x20%s',_0xf64c0a);if(!_[_0x3d35('0x5b')](_0x5a3f49[_0x3d35('0x4c')])&&fs[_0x3d35('0x50')](_0xf64c0a)){logger[_0x3d35('0x5c')](_0x3d35('0x5d')+_0xf64c0a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3d35('0x5e')](_0xf64c0a);}_0xf64c0a=_0xf64c0a+_0x3d35('0x5f');if(!_['isNil'](_0x5a3f49[_0x3d35('0x4c')])&&fs[_0x3d35('0x50')](_0xf64c0a)){logger[_0x3d35('0x5c')](_0x3d35('0x5d')+_0xf64c0a+_0x3d35('0x60'));fs[_0x3d35('0x5e')](_0xf64c0a);}return _0x5a3f49;})[_0x3d35('0x24')](function(_0x205ea9){if(!_0x205ea9)throw new InternalError();return _0x205ea9[_0x3d35('0x25')]();})[_0x3d35('0x24')](function(){_0x480549[_0x3d35('0x26')](0xcc)[_0x3d35('0x1b')]();})[_0x3d35('0x45')](handleError(_0x480549,null));}; \ No newline at end of file +var _0x341e=['model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','length','create','body','find','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','download','unlink','message','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','.cypher','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SquareRecording','fieldName','type','key'];(function(_0x20344b,_0x41d19f){var _0x1a47ec=function(_0xd43c49){while(--_0xd43c49){_0x20344b['push'](_0x20344b['shift']());}};_0x1a47ec(++_0x41d19f);}(_0x341e,0xea));var _0xe341=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x341e[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0xe341('0x0'));var rimraf=require(_0xe341('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe341('0x2'));var rp=require(_0xe341('0x3'));var moment=require(_0xe341('0x4'));var BPromise=require(_0xe341('0x5'));var Mustache=require(_0xe341('0x6'));var util=require(_0xe341('0x7'));var path=require('path');var sox=require(_0xe341('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe341('0x9'));var _=require(_0xe341('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe341('0xb'));var deskjs=require(_0xe341('0xc'));var toCsv=require(_0xe341('0xd'));var querystring=require(_0xe341('0xe'));var Papa=require(_0xe341('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe341('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe341('0x11'));var logger=require(_0xe341('0x12'))(_0xe341('0x13'));var utils=require(_0xe341('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe341('0x15'));var db=require(_0xe341('0x16'))['db'];function respondWithStatusCode(_0x155f39,_0x17777c){_0x17777c=_0x17777c||0xcc;return function(_0x173d89){if(_0x173d89){return _0x155f39[_0xe341('0x17')](_0x17777c);}return _0x155f39[_0xe341('0x18')](_0x17777c)[_0xe341('0x19')]();};}function respondWithResult(_0x22701d,_0x4dccf3){_0x4dccf3=_0x4dccf3||0xc8;return function(_0x5ce459){if(_0x5ce459){return _0x22701d[_0xe341('0x18')](_0x4dccf3)[_0xe341('0x1a')](_0x5ce459);}};}function respondWithFilteredResult(_0x21a64e,_0x507d28){return function(_0x59a508){if(_0x59a508){var _0x3d5e7a=typeof _0x507d28[_0xe341('0x1b')]===_0xe341('0x1c')&&typeof _0x507d28[_0xe341('0x1d')]===_0xe341('0x1c');var _0xb2be0e=_0x59a508[_0xe341('0x1e')];var _0x20f695=_0x3d5e7a?0x0:_0x507d28[_0xe341('0x1b')];var _0x1d27ff=_0x3d5e7a?_0x59a508['count']:_0x507d28[_0xe341('0x1b')]+_0x507d28[_0xe341('0x1d')];var _0x45e226;if(_0x1d27ff>=_0xb2be0e){_0x1d27ff=_0xb2be0e;_0x45e226=0xc8;}else{_0x45e226=0xce;}_0x21a64e[_0xe341('0x18')](_0x45e226);return _0x21a64e[_0xe341('0x1f')](_0xe341('0x20'),_0x20f695+'-'+_0x1d27ff+'/'+_0xb2be0e)[_0xe341('0x1a')](_0x59a508);}return null;};}function patchUpdates(_0x38bea0){return function(_0x43d3c5){try{jsonpatch[_0xe341('0x21')](_0x43d3c5,_0x38bea0,!![]);}catch(_0x23a7b7){return BPromise[_0xe341('0x22')](_0x23a7b7);}return _0x43d3c5[_0xe341('0x23')]();};}function saveUpdates(_0x2b7555,_0x5f2fb5){return function(_0x37de8a){if(_0x37de8a){return _0x37de8a[_0xe341('0x24')](_0x2b7555)[_0xe341('0x25')](function(_0x50ee6e){return _0x50ee6e;});}return null;};}function removeEntity(_0x4ddd0f,_0x16c5b0){return function(_0x26eede){if(_0x26eede){return _0x26eede['destroy']()[_0xe341('0x25')](function(){_0x4ddd0f['status'](0xcc)[_0xe341('0x19')]();});}};}function handleEntityNotFound(_0x30fc28,_0x260b02){return function(_0x2d0c6d){if(!_0x2d0c6d){_0x30fc28['sendStatus'](0x194);}return _0x2d0c6d;};}function handleError(_0x34851f,_0x1fde27){_0x1fde27=_0x1fde27||0x1f4;return function(_0x48cc7a){logger[_0xe341('0x26')](_0x48cc7a[_0xe341('0x27')]);if(_0x48cc7a[_0xe341('0x28')]){delete _0x48cc7a['name'];}_0x34851f[_0xe341('0x18')](_0x1fde27)[_0xe341('0x29')](_0x48cc7a);};}exports[_0xe341('0x2a')]=function(_0x4efeb9,_0x227d02){var _0x5deb3f={},_0x54f68a={},_0x32c79f={'count':0x0,'rows':[]};var _0x2d436d=_[_0xe341('0x2b')](db[_0xe341('0x2c')]['rawAttributes'],function(_0x462d2d){return{'name':_0x462d2d[_0xe341('0x2d')],'type':_0x462d2d[_0xe341('0x2e')][_0xe341('0x2f')]};});_0x54f68a[_0xe341('0x30')]=_[_0xe341('0x2b')](_0x2d436d,_0xe341('0x28'));_0x54f68a[_0xe341('0x31')]=_[_0xe341('0x32')](_0x4efeb9['query']);_0x54f68a['filters']=_[_0xe341('0x33')](_0x54f68a[_0xe341('0x30')],_0x54f68a[_0xe341('0x31')]);_0x5deb3f[_0xe341('0x34')]=_[_0xe341('0x33')](_0x54f68a['model'],qs[_0xe341('0x35')](_0x4efeb9['query'][_0xe341('0x35')]));_0x5deb3f[_0xe341('0x34')]=_0x5deb3f[_0xe341('0x34')]['length']?_0x5deb3f[_0xe341('0x34')]:_0x54f68a[_0xe341('0x30')];if(!_0x4efeb9['query'][_0xe341('0x36')]('nolimit')){_0x5deb3f['limit']=qs[_0xe341('0x1d')](_0x4efeb9['query']['limit']);_0x5deb3f[_0xe341('0x1b')]=qs[_0xe341('0x1b')](_0x4efeb9['query'][_0xe341('0x1b')]);}_0x5deb3f['order']=qs[_0xe341('0x37')](_0x4efeb9['query']['sort']);_0x5deb3f[_0xe341('0x38')]=qs[_0xe341('0x39')](_[_0xe341('0x3a')](_0x4efeb9['query'],_0x54f68a[_0xe341('0x39')]),_0x2d436d);if(_0x4efeb9['query']['filter']){_0x5deb3f[_0xe341('0x38')]=_[_0xe341('0x3b')](_0x5deb3f[_0xe341('0x38')],{'$or':_[_0xe341('0x2b')](_0x2d436d,function(_0x2273f6){if(_0x2273f6[_0xe341('0x2e')]!==_0xe341('0x3c')){var _0x40c070={};_0x40c070[_0x2273f6['name']]={'$like':'%'+_0x4efeb9['query'][_0xe341('0x3d')]+'%'};return _0x40c070;}})});}_0x5deb3f=_['merge']({},_0x5deb3f,_0x4efeb9[_0xe341('0x3e')]);var _0x44eaf6={'where':_0x5deb3f[_0xe341('0x38')]};return db[_0xe341('0x2c')][_0xe341('0x1e')](_0x44eaf6)[_0xe341('0x25')](function(_0xd556ac){_0x32c79f[_0xe341('0x1e')]=_0xd556ac;if(_0x4efeb9[_0xe341('0x31')][_0xe341('0x3f')]){_0x5deb3f[_0xe341('0x40')]=[{'all':!![]}];}return db[_0xe341('0x2c')][_0xe341('0x41')](_0x5deb3f);})[_0xe341('0x25')](function(_0x538916){_0x32c79f['rows']=_0x538916;return _0x32c79f;})[_0xe341('0x25')](respondWithFilteredResult(_0x227d02,_0x5deb3f))[_0xe341('0x42')](handleError(_0x227d02,null));};exports['show']=function(_0x3b84cf,_0x40bdbf){var _0xd30153={'raw':!![],'where':{'id':_0x3b84cf[_0xe341('0x43')]['id']}},_0x408e27={};_0x408e27['model']=_['keys'](db[_0xe341('0x2c')]['rawAttributes']);_0x408e27['query']=_[_0xe341('0x32')](_0x3b84cf[_0xe341('0x31')]);_0x408e27[_0xe341('0x39')]=_[_0xe341('0x33')](_0x408e27['model'],_0x408e27[_0xe341('0x31')]);_0xd30153['attributes']=_[_0xe341('0x33')](_0x408e27[_0xe341('0x30')],qs[_0xe341('0x35')](_0x3b84cf[_0xe341('0x31')]['fields']));_0xd30153[_0xe341('0x34')]=_0xd30153[_0xe341('0x34')][_0xe341('0x44')]?_0xd30153[_0xe341('0x34')]:_0x408e27['model'];if(_0x3b84cf[_0xe341('0x31')][_0xe341('0x3f')]){_0xd30153[_0xe341('0x40')]=[{'all':!![]}];}_0xd30153=_[_0xe341('0x3b')]({},_0xd30153,_0x3b84cf[_0xe341('0x3e')]);return db[_0xe341('0x2c')]['find'](_0xd30153)['then'](handleEntityNotFound(_0x40bdbf,null))[_0xe341('0x25')](respondWithResult(_0x40bdbf,null))[_0xe341('0x42')](handleError(_0x40bdbf,null));};exports[_0xe341('0x45')]=function(_0x13882e,_0x4e51ce){return db[_0xe341('0x2c')][_0xe341('0x45')](_0x13882e[_0xe341('0x46')],{})['then'](respondWithResult(_0x4e51ce,0xc9))[_0xe341('0x42')](handleError(_0x4e51ce,null));};exports['update']=function(_0x14e971,_0x276fed){if(_0x14e971[_0xe341('0x46')]['id']){delete _0x14e971[_0xe341('0x46')]['id'];}return db['SquareRecording'][_0xe341('0x47')]({'where':{'id':_0x14e971['params']['id']}})[_0xe341('0x25')](handleEntityNotFound(_0x276fed,null))[_0xe341('0x25')](saveUpdates(_0x14e971[_0xe341('0x46')],null))[_0xe341('0x25')](respondWithResult(_0x276fed,null))[_0xe341('0x42')](handleError(_0x276fed,null));};exports['download']=function(_0x48a5d5,_0x385d99,_0xfdda72){var _0x3a244c=require(_0xe341('0x48'));var _0xecca1d=![];var _0x4bedf1={};if(_0x48a5d5['query']['type']&&_0x48a5d5['query'][_0xe341('0x2e')]===_0xe341('0x49')){_0x4bedf1['uniqueid']=_0x48a5d5[_0xe341('0x43')]['id'];}else{_0x4bedf1['id']=_0x48a5d5[_0xe341('0x43')]['id'];}return db[_0xe341('0x2c')][_0xe341('0x47')]({'where':_0x4bedf1,'attributes':['id',_0xe341('0x4a'),_0xe341('0x4b')],'raw':!![]})[_0xe341('0x25')](handleEntityNotFound(_0x385d99,null))[_0xe341('0x25')](function(_0x554493){if(_0x554493){var _0x2d132d=_0x554493['savePath'];var _0x404cc0=util[_0xe341('0x4c')](_0xe341('0x4d'),_0x2d132d);if(fs[_0xe341('0x4e')](_0x404cc0)){_0xecca1d=!![];return _0x3a244c[_0xe341('0x4f')](_0x404cc0,_0x2d132d,config[_0xe341('0x50')][_0xe341('0x51')])[_0xe341('0x25')](function(){return _0x554493;});}return _0x554493;}})[_0xe341('0x25')](function(_0x635c3f){if(_0x635c3f){var _0x46fed8=_0x635c3f['savePath'];if(!fs[_0xe341('0x4e')](_0x46fed8)){throw new db[(_0xe341('0x52'))]['ValidationError'](_0xe341('0x53'));}if(_0x635c3f[_0xe341('0x4b')]){return _0x385d99[_0xe341('0x54')](_0x46fed8,_0x635c3f[_0xe341('0x4b')]+path['extname'](_0x46fed8),function(){if(_0xecca1d){fs[_0xe341('0x55')](_0x46fed8);}});}else{return _0x385d99[_0xe341('0x54')](_0x46fed8,function(_0x157875){if(_0xecca1d){fs['unlink'](_0x46fed8);}});}}})[_0xe341('0x42')](function(_0x4f6969){if(_0x4f6969[_0xe341('0x56')]===_0xe341('0x53')){_0x385d99['status'](0x194)[_0xe341('0x29')]('Not\x20found');}else{return handleError(_0x385d99,null);}});};exports[_0xe341('0x57')]=function(_0xc1f000,_0x543391){return db[_0xe341('0x2c')][_0xe341('0x47')]({'where':{'id':_0xc1f000[_0xe341('0x43')]['id']}})['then'](function(_0xade81){if(_[_0xe341('0x58')](_0xade81)){throw new ReferenceError(_0xe341('0x59'));}return _0xade81;})['then'](function(_0x1fe1bd){var _0x5ecc81=_0x1fe1bd[_0xe341('0x4a')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x5ecc81);if(!_['isNil'](_0x1fe1bd['savePath'])&&fs['existsSync'](_0x5ecc81)){logger[_0xe341('0x5a')](_0xe341('0x5b')+_0x5ecc81+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x5ecc81);}_0x5ecc81=_0x5ecc81+_0xe341('0x5c');if(!_[_0xe341('0x58')](_0x1fe1bd[_0xe341('0x4a')])&&fs['existsSync'](_0x5ecc81)){logger[_0xe341('0x5a')](_0xe341('0x5b')+_0x5ecc81+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe341('0x5d')](_0x5ecc81);}return _0x1fe1bd;})[_0xe341('0x25')](function(_0x3f28d1){if(!_0x3f28d1)throw new InternalError();return _0x3f28d1[_0xe341('0x57')]();})[_0xe341('0x25')](function(){_0x543391[_0xe341('0x18')](0xcc)['end']();})[_0xe341('0x42')](handleError(_0x543391,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index ac976b8..4b16fee 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 _0x0e56=['api','moment','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util'];(function(_0x32b9c9,_0x5881e6){var _0x1a837f=function(_0x2edd85){while(--_0x2edd85){_0x32b9c9['push'](_0x32b9c9['shift']());}};_0x1a837f(++_0x5881e6);}(_0x0e56,0xf5));var _0x60e5=function(_0x33a21a,_0x22d1a8){_0x33a21a=_0x33a21a-0x0;var _0x4c628e=_0x0e56[_0x33a21a];return _0x4c628e;};'use strict';var _=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var logger=require('../../config/logger')(_0x60e5('0x2'));var moment=require(_0x60e5('0x3'));var BPromise=require('bluebird');var rp=require(_0x60e5('0x4'));var fs=require('fs');var path=require(_0x60e5('0x5'));var rimraf=require(_0x60e5('0x6'));var config=require(_0x60e5('0x7'));var attributes=require(_0x60e5('0x8'));module[_0x60e5('0x9')]=function(_0x25b3a4,_0x54422a){return _0x25b3a4[_0x60e5('0xa')](_0x60e5('0xb'),attributes,{'tableName':_0x60e5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f59=['SquareRecording','square_recordings','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x8550ba,_0x57c10d){var _0x432399=function(_0x33ab8a){while(--_0x33ab8a){_0x8550ba['push'](_0x8550ba['shift']());}};_0x432399(++_0x57c10d);}(_0x7f59,0x12e));var _0x97f5=function(_0x26d018,_0xedb83d){_0x26d018=_0x26d018-0x0;var _0x296c00=_0x7f59[_0x26d018];return _0x296c00;};'use strict';var _=require(_0x97f5('0x0'));var util=require(_0x97f5('0x1'));var logger=require('../../config/logger')(_0x97f5('0x2'));var moment=require(_0x97f5('0x3'));var BPromise=require(_0x97f5('0x4'));var rp=require(_0x97f5('0x5'));var fs=require('fs');var path=require(_0x97f5('0x6'));var rimraf=require(_0x97f5('0x7'));var config=require(_0x97f5('0x8'));var attributes=require('./squareRecording.attributes');module['exports']=function(_0x498110,_0x5d7027){return _0x498110[_0x97f5('0x9')](_0x97f5('0xa'),attributes,{'tableName':_0x97f5('0xb'),'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 20a07fc..7ab385a 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 _0xba22=['CreateSquareRecording','create','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xba22,0xc1));var _0x2ba2=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xba22[_0x5447fd];return _0x15b28a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2ba2('0x0'));var BPromise=require(_0x2ba2('0x1'));var rs=require(_0x2ba2('0x2'));var fs=require('fs');var Redis=require(_0x2ba2('0x3'));var db=require(_0x2ba2('0x4'))['db'];var utils=require(_0x2ba2('0x5'));var logger=require(_0x2ba2('0x6'))(_0x2ba2('0x7'));var config=require(_0x2ba2('0x8'));var jayson=require(_0x2ba2('0x9'));var client=jayson[_0x2ba2('0xa')][_0x2ba2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c1183,_0x1a75fd,_0xeaa626){return new BPromise(function(_0x3376de,_0x356ddb){return client['request'](_0x1c1183,_0xeaa626)[_0x2ba2('0xc')](function(_0x44693e){logger[_0x2ba2('0xd')](_0x2ba2('0xe'),_0x1a75fd,_0x2ba2('0xf'));logger[_0x2ba2('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x1a75fd,'request\x20sent',JSON[_0x2ba2('0x11')](_0x44693e));if(_0x44693e['error']){if(_0x44693e['error'][_0x2ba2('0x12')]===0x1f4){logger[_0x2ba2('0x13')](_0x2ba2('0xe'),_0x1a75fd,_0x44693e[_0x2ba2('0x13')][_0x2ba2('0x14')]);return _0x356ddb(_0x44693e[_0x2ba2('0x13')][_0x2ba2('0x14')]);}logger[_0x2ba2('0x13')]('SquareRecording,\x20%s,\x20%s',_0x1a75fd,_0x44693e['error']['message']);return _0x3376de(_0x44693e[_0x2ba2('0x13')]['message']);}else{logger[_0x2ba2('0xd')]('SquareRecording,\x20%s,\x20%s',_0x1a75fd,'request\x20sent');_0x3376de(_0x44693e[_0x2ba2('0x15')][_0x2ba2('0x14')]);}})[_0x2ba2('0x16')](function(_0xfc8160){logger['error'](_0x2ba2('0xe'),_0x1a75fd,_0xfc8160);_0x356ddb(_0xfc8160);});});}exports[_0x2ba2('0x17')]=function(_0x5d9ae7){var _0x167d10=this;return new Promise(function(_0x52ff76,_0x43fcea){return db['SquareRecording'][_0x2ba2('0x18')](_0x5d9ae7['body'],{'raw':_0x5d9ae7[_0x2ba2('0x19')]?_0x5d9ae7['options'][_0x2ba2('0x1a')]===undefined?!![]:![]:!![]})[_0x2ba2('0xc')](function(_0x538db4){logger[_0x2ba2('0xd')](_0x2ba2('0x17'),_0x5d9ae7);logger[_0x2ba2('0x10')](_0x2ba2('0x17'),_0x5d9ae7,JSON[_0x2ba2('0x11')](_0x538db4));_0x52ff76(_0x538db4);})['catch'](function(_0x1c91e1){logger['error'](_0x2ba2('0x17'),_0x1c91e1[_0x2ba2('0x14')],_0x5d9ae7);_0x43fcea(_0x167d10[_0x2ba2('0x13')](0x1f4,_0x1c91e1['message']));});});}; \ No newline at end of file +var _0xbb25=['../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','create','body','options','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4336c5,_0x2dd536){var _0x3f9fd2=function(_0x2859c8){while(--_0x2859c8){_0x4336c5['push'](_0x4336c5['shift']());}};_0x3f9fd2(++_0x2dd536);}(_0xbb25,0x142));var _0x5bb2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb25[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5bb2('0x0'));var util=require(_0x5bb2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5bb2('0x2'));var fs=require('fs');var Redis=require(_0x5bb2('0x3'));var db=require(_0x5bb2('0x4'))['db'];var utils=require(_0x5bb2('0x5'));var logger=require(_0x5bb2('0x6'))(_0x5bb2('0x7'));var config=require(_0x5bb2('0x8'));var jayson=require(_0x5bb2('0x9'));var client=jayson[_0x5bb2('0xa')][_0x5bb2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x427679,_0x176fb5,_0x18ea05){return new BPromise(function(_0x5a14a0,_0x4fdb05){return client[_0x5bb2('0xc')](_0x427679,_0x18ea05)[_0x5bb2('0xd')](function(_0x145846){logger[_0x5bb2('0xe')](_0x5bb2('0xf'),_0x176fb5,_0x5bb2('0x10'));logger[_0x5bb2('0x11')](_0x5bb2('0x12'),_0x176fb5,_0x5bb2('0x10'),JSON[_0x5bb2('0x13')](_0x145846));if(_0x145846[_0x5bb2('0x14')]){if(_0x145846[_0x5bb2('0x14')][_0x5bb2('0x15')]===0x1f4){logger[_0x5bb2('0x14')](_0x5bb2('0xf'),_0x176fb5,_0x145846[_0x5bb2('0x14')][_0x5bb2('0x16')]);return _0x4fdb05(_0x145846[_0x5bb2('0x14')][_0x5bb2('0x16')]);}logger[_0x5bb2('0x14')]('SquareRecording,\x20%s,\x20%s',_0x176fb5,_0x145846[_0x5bb2('0x14')][_0x5bb2('0x16')]);return _0x5a14a0(_0x145846[_0x5bb2('0x14')]['message']);}else{logger['info'](_0x5bb2('0xf'),_0x176fb5,_0x5bb2('0x10'));_0x5a14a0(_0x145846[_0x5bb2('0x17')][_0x5bb2('0x16')]);}})[_0x5bb2('0x18')](function(_0x393603){logger[_0x5bb2('0x14')](_0x5bb2('0xf'),_0x176fb5,_0x393603);_0x4fdb05(_0x393603);});});}exports[_0x5bb2('0x19')]=function(_0x26b8f4){var _0x5884ea=this;return new Promise(function(_0x3bddeb,_0x32691b){return db['SquareRecording'][_0x5bb2('0x1a')](_0x26b8f4[_0x5bb2('0x1b')],{'raw':_0x26b8f4[_0x5bb2('0x1c')]?_0x26b8f4['options'][_0x5bb2('0x1d')]===undefined?!![]:![]:!![]})[_0x5bb2('0xd')](function(_0x498f24){logger[_0x5bb2('0xe')]('CreateSquareRecording',_0x26b8f4);logger[_0x5bb2('0x11')](_0x5bb2('0x19'),_0x26b8f4,JSON[_0x5bb2('0x13')](_0x498f24));_0x3bddeb(_0x498f24);})[_0x5bb2('0x18')](function(_0x4c1e5f){logger[_0x5bb2('0x14')](_0x5bb2('0x19'),_0x4c1e5f[_0x5bb2('0x16')],_0x26b8f4);_0x32691b(_0x5884ea[_0x5bb2('0x14')](0x1f4,_0x4c1e5f[_0x5bb2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 0789265..38b4dd9 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 _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(_0x33e831,_0x267ac1){var _0x25e3df=function(_0x151261){while(--_0x151261){_0x33e831['push'](_0x33e831['shift']());}};_0x25e3df(++_0x267ac1);}(_0xe706,0xa3));var _0x6e70=function(_0x4839a2,_0x1f67eb){_0x4839a2=_0x4839a2-0x0;var _0x465147=_0xe706[_0x4839a2];return _0x465147;};'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 +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(_0x32cc68,_0x5d2b21){var _0x472ab1=function(_0x14ff66){while(--_0x14ff66){_0x32cc68['push'](_0x32cc68['shift']());}};_0x472ab1(++_0x5d2b21);}(_0xe706,0xa3));var _0x6e70=function(_0x5a184b,_0x457876){_0x5a184b=_0x5a184b-0x0;var _0x713964=_0xe706[_0x5a184b];return _0x713964;};'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 3bf625d..af90387 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 _0x119e=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x5de818,_0x7c4485){var _0x345670=function(_0x5e268d){while(--_0x5e268d){_0x5de818['push'](_0x5de818['shift']());}};_0x345670(++_0x7c4485);}(_0x119e,0xf9));var _0xe119=function(_0x293828,_0x3d4f2c){_0x293828=_0x293828-0x0;var _0x1f3bd7=_0x119e[_0x293828];return _0x1f3bd7;};'use strict';var Sequelize=require(_0xe119('0x0'));module[_0xe119('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xe119('0x2')]},'request':{'type':Sequelize[_0xe119('0x2')]},'channel':{'type':Sequelize[_0xe119('0x2')]},'language':{'type':Sequelize[_0xe119('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xe119('0x2')]},'version':{'type':Sequelize[_0xe119('0x2')]},'callerid':{'type':Sequelize[_0xe119('0x2')]},'calleridname':{'type':Sequelize[_0xe119('0x2')]},'callingpres':{'type':Sequelize[_0xe119('0x2')]},'callingani2':{'type':Sequelize[_0xe119('0x2')]},'callington':{'type':Sequelize[_0xe119('0x2')]},'callingtns':{'type':Sequelize[_0xe119('0x2')]},'dnid':{'type':Sequelize[_0xe119('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xe119('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xe119('0x2')]},'enhanced':{'type':Sequelize[_0xe119('0x2')]},'accountcode':{'type':Sequelize[_0xe119('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xe119('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xe119('0x3')]},'bot':{'type':Sequelize[_0xe119('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x6c1f=['exports','STRING','DATE','BOOLEAN'];(function(_0x497c63,_0x4db3da){var _0x1faa37=function(_0x4016f9){while(--_0x4016f9){_0x497c63['push'](_0x497c63['shift']());}};_0x1faa37(++_0x4db3da);}(_0x6c1f,0x158));var _0xf6c1=function(_0x22f6f1,_0x1690df){_0x22f6f1=_0x22f6f1-0x0;var _0x3ec7f4=_0x6c1f[_0x22f6f1];return _0x3ec7f4;};'use strict';var Sequelize=require('sequelize');module[_0xf6c1('0x0')]={'network':{'type':Sequelize[_0xf6c1('0x1')]},'network_script':{'type':Sequelize[_0xf6c1('0x1')]},'request':{'type':Sequelize[_0xf6c1('0x1')]},'channel':{'type':Sequelize[_0xf6c1('0x1')]},'language':{'type':Sequelize[_0xf6c1('0x1')]},'type':{'type':Sequelize[_0xf6c1('0x1')]},'uniqueid':{'type':Sequelize[_0xf6c1('0x1')]},'version':{'type':Sequelize[_0xf6c1('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf6c1('0x1')]},'callingpres':{'type':Sequelize[_0xf6c1('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xf6c1('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf6c1('0x1')]},'extension':{'type':Sequelize[_0xf6c1('0x1')]},'priority':{'type':Sequelize[_0xf6c1('0x1')]},'enhanced':{'type':Sequelize[_0xf6c1('0x1')]},'accountcode':{'type':Sequelize[_0xf6c1('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xf6c1('0x1')]},'joinAt':{'type':Sequelize[_0xf6c1('0x2')]},'leaveAt':{'type':Sequelize[_0xf6c1('0x2')]},'bot':{'type':Sequelize[_0xf6c1('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 9c4b620..b4b65e1 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 _0x5728=['key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SquareReport','rawAttributes','type'];(function(_0x48f5a7,_0x19a824){var _0x30234b=function(_0x2d0fb0){while(--_0x2d0fb0){_0x48f5a7['push'](_0x48f5a7['shift']());}};_0x30234b(++_0x19a824);}(_0x5728,0xb5));var _0x8572=function(_0x4d8e4e,_0xfc4f7){_0x4d8e4e=_0x4d8e4e-0x0;var _0x4debcc=_0x5728[_0x4d8e4e];return _0x4debcc;};'use strict';var emlformat=require(_0x8572('0x0'));var rimraf=require(_0x8572('0x1'));var zipdir=require(_0x8572('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8572('0x3'));var moment=require(_0x8572('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8572('0x5'));var util=require(_0x8572('0x6'));var path=require(_0x8572('0x7'));var sox=require(_0x8572('0x8'));var csv=require(_0x8572('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8572('0xa'));var crypto=require(_0x8572('0xb'));var jsforce=require(_0x8572('0xc'));var deskjs=require(_0x8572('0xd'));var toCsv=require(_0x8572('0x9'));var querystring=require(_0x8572('0xe'));var Papa=require(_0x8572('0xf'));var Redis=require(_0x8572('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8572('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8572('0x12'));var utils=require(_0x8572('0x13'));var config=require(_0x8572('0x14'));var licenseUtil=require(_0x8572('0x15'));var db=require(_0x8572('0x16'))['db'];function respondWithStatusCode(_0x38691d,_0x252873){_0x252873=_0x252873||0xcc;return function(_0x266f60){if(_0x266f60){return _0x38691d['sendStatus'](_0x252873);}return _0x38691d[_0x8572('0x17')](_0x252873)[_0x8572('0x18')]();};}function respondWithResult(_0x4dd704,_0x415ff7){_0x415ff7=_0x415ff7||0xc8;return function(_0x44a259){if(_0x44a259){return _0x4dd704[_0x8572('0x17')](_0x415ff7)[_0x8572('0x19')](_0x44a259);}};}function respondWithFilteredResult(_0x47f392,_0x10d35d){return function(_0x38e9bd){if(_0x38e9bd){var _0x8416e3=typeof _0x10d35d['offset']===_0x8572('0x1a')&&typeof _0x10d35d['limit']===_0x8572('0x1a');var _0x20efa5=_0x38e9bd[_0x8572('0x1b')];var _0xbdf7ca=_0x8416e3?0x0:_0x10d35d[_0x8572('0x1c')];var _0x2954d5=_0x8416e3?_0x38e9bd[_0x8572('0x1b')]:_0x10d35d[_0x8572('0x1c')]+_0x10d35d[_0x8572('0x1d')];var _0x3dc631;if(_0x2954d5>=_0x20efa5){_0x2954d5=_0x20efa5;_0x3dc631=0xc8;}else{_0x3dc631=0xce;}_0x47f392[_0x8572('0x17')](_0x3dc631);return _0x47f392[_0x8572('0x1e')](_0x8572('0x1f'),_0xbdf7ca+'-'+_0x2954d5+'/'+_0x20efa5)['json'](_0x38e9bd);}return null;};}function patchUpdates(_0x39e708){return function(_0x555389){try{jsonpatch[_0x8572('0x20')](_0x555389,_0x39e708,!![]);}catch(_0x198563){return BPromise['reject'](_0x198563);}return _0x555389[_0x8572('0x21')]();};}function saveUpdates(_0x2bc303,_0xda7e32){return function(_0x530a71){if(_0x530a71){return _0x530a71[_0x8572('0x22')](_0x2bc303)[_0x8572('0x23')](function(_0x11d9c4){return _0x11d9c4;});}return null;};}function removeEntity(_0x474bd7,_0x7d90ea){return function(_0x4d8cd5){if(_0x4d8cd5){return _0x4d8cd5[_0x8572('0x24')]()[_0x8572('0x23')](function(){_0x474bd7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x251f70,_0x31e6a0){return function(_0x47189f){if(!_0x47189f){_0x251f70[_0x8572('0x25')](0x194);}return _0x47189f;};}function handleError(_0xb89411,_0x455d59){_0x455d59=_0x455d59||0x1f4;return function(_0x61627f){logger[_0x8572('0x26')](_0x61627f[_0x8572('0x27')]);if(_0x61627f[_0x8572('0x28')]){delete _0x61627f[_0x8572('0x28')];}_0xb89411['status'](_0x455d59)[_0x8572('0x29')](_0x61627f);};}exports[_0x8572('0x2a')]=function(_0x478f73,_0x39b6ef){var _0x4e9095={},_0x54de20={},_0x471488={'count':0x0,'rows':[]};var _0x3b4266=_[_0x8572('0x2b')](db[_0x8572('0x2c')][_0x8572('0x2d')],function(_0x2e1309){return{'name':_0x2e1309['fieldName'],'type':_0x2e1309[_0x8572('0x2e')][_0x8572('0x2f')]};});_0x54de20[_0x8572('0x30')]=_['map'](_0x3b4266,_0x8572('0x28'));_0x54de20['query']=_[_0x8572('0x31')](_0x478f73[_0x8572('0x32')]);_0x54de20['filters']=_[_0x8572('0x33')](_0x54de20['model'],_0x54de20[_0x8572('0x32')]);_0x4e9095[_0x8572('0x34')]=_[_0x8572('0x33')](_0x54de20[_0x8572('0x30')],qs[_0x8572('0x35')](_0x478f73[_0x8572('0x32')][_0x8572('0x35')]));_0x4e9095[_0x8572('0x34')]=_0x4e9095['attributes'][_0x8572('0x36')]?_0x4e9095[_0x8572('0x34')]:_0x54de20[_0x8572('0x30')];if(!_0x478f73[_0x8572('0x32')]['hasOwnProperty'](_0x8572('0x37'))){_0x4e9095[_0x8572('0x1d')]=qs['limit'](_0x478f73['query'][_0x8572('0x1d')]);_0x4e9095['offset']=qs[_0x8572('0x1c')](_0x478f73['query'][_0x8572('0x1c')]);}_0x4e9095[_0x8572('0x38')]=qs[_0x8572('0x39')](_0x478f73[_0x8572('0x32')]['sort']);_0x4e9095[_0x8572('0x3a')]=qs[_0x8572('0x3b')](_[_0x8572('0x3c')](_0x478f73[_0x8572('0x32')],_0x54de20[_0x8572('0x3b')]),_0x3b4266);if(_0x478f73[_0x8572('0x32')]['filter']){_0x4e9095['where']=_[_0x8572('0x3d')](_0x4e9095[_0x8572('0x3a')],{'$or':_[_0x8572('0x2b')](_0x3b4266,function(_0x3eec28){if(_0x3eec28[_0x8572('0x2e')]!==_0x8572('0x3e')){var _0x5d1c82={};_0x5d1c82[_0x3eec28[_0x8572('0x28')]]={'$like':'%'+_0x478f73[_0x8572('0x32')][_0x8572('0x3f')]+'%'};return _0x5d1c82;}})});}_0x4e9095=_[_0x8572('0x3d')]({},_0x4e9095,_0x478f73[_0x8572('0x40')]);var _0x25a09b={'where':_0x4e9095[_0x8572('0x3a')]};return db[_0x8572('0x2c')]['count'](_0x25a09b)[_0x8572('0x23')](function(_0x359ed9){_0x471488[_0x8572('0x1b')]=_0x359ed9;if(_0x478f73[_0x8572('0x32')][_0x8572('0x41')]){_0x4e9095[_0x8572('0x42')]=[{'all':!![]}];}return db[_0x8572('0x2c')][_0x8572('0x43')](_0x4e9095);})[_0x8572('0x23')](function(_0x35cd3a){_0x471488[_0x8572('0x44')]=_0x35cd3a;return _0x471488;})[_0x8572('0x23')](respondWithFilteredResult(_0x39b6ef,_0x4e9095))[_0x8572('0x45')](handleError(_0x39b6ef,null));};exports[_0x8572('0x46')]=function(_0x9deabb,_0x65b64){var _0x1476a6={'raw':!![],'where':{'id':_0x9deabb['params']['id']}},_0x55851e={};_0x55851e[_0x8572('0x30')]=_[_0x8572('0x31')](db['SquareReport'][_0x8572('0x2d')]);_0x55851e[_0x8572('0x32')]=_[_0x8572('0x31')](_0x9deabb[_0x8572('0x32')]);_0x55851e[_0x8572('0x3b')]=_[_0x8572('0x33')](_0x55851e[_0x8572('0x30')],_0x55851e[_0x8572('0x32')]);_0x1476a6[_0x8572('0x34')]=_[_0x8572('0x33')](_0x55851e['model'],qs[_0x8572('0x35')](_0x9deabb[_0x8572('0x32')][_0x8572('0x35')]));_0x1476a6['attributes']=_0x1476a6[_0x8572('0x34')][_0x8572('0x36')]?_0x1476a6['attributes']:_0x55851e['model'];if(_0x9deabb[_0x8572('0x32')][_0x8572('0x41')]){_0x1476a6[_0x8572('0x42')]=[{'all':!![]}];}_0x1476a6=_[_0x8572('0x3d')]({},_0x1476a6,_0x9deabb[_0x8572('0x40')]);return db[_0x8572('0x2c')][_0x8572('0x47')](_0x1476a6)[_0x8572('0x23')](handleEntityNotFound(_0x65b64,null))[_0x8572('0x23')](respondWithResult(_0x65b64,null))[_0x8572('0x45')](handleError(_0x65b64,null));};exports[_0x8572('0x48')]=function(_0x2ca9fe,_0x39836a){return db[_0x8572('0x2c')][_0x8572('0x48')](_0x2ca9fe['body'],{})[_0x8572('0x23')](respondWithResult(_0x39836a,0xc9))[_0x8572('0x45')](handleError(_0x39836a,null));};exports[_0x8572('0x22')]=function(_0x180e5a,_0x36dd0e){if(_0x180e5a[_0x8572('0x49')]['id']){delete _0x180e5a[_0x8572('0x49')]['id'];}return db[_0x8572('0x2c')]['find']({'where':{'id':_0x180e5a['params']['id']}})[_0x8572('0x23')](handleEntityNotFound(_0x36dd0e,null))[_0x8572('0x23')](saveUpdates(_0x180e5a[_0x8572('0x49')],null))[_0x8572('0x23')](respondWithResult(_0x36dd0e,null))[_0x8572('0x45')](handleError(_0x36dd0e,null));};exports[_0x8572('0x24')]=function(_0x82332,_0x102454){return db[_0x8572('0x2c')][_0x8572('0x47')]({'where':{'id':_0x82332[_0x8572('0x4a')]['id']}})[_0x8572('0x23')](handleEntityNotFound(_0x102454,null))[_0x8572('0x23')](removeEntity(_0x102454,null))[_0x8572('0x45')](handleError(_0x102454,null));};exports[_0x8572('0x4b')]=function(_0xa18b26,_0x29f1aa){return db['SquareReport'][_0x8572('0x4b')]()[_0x8572('0x23')](respondWithResult(_0x29f1aa,null))[_0x8572('0x45')](handleError(_0x29f1aa,null));}; \ No newline at end of file +var _0x3705=['squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','SquareReport','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash'];(function(_0x4859ca,_0x2798f4){var _0x38e7a6=function(_0x307a9b){while(--_0x307a9b){_0x4859ca['push'](_0x4859ca['shift']());}};_0x38e7a6(++_0x2798f4);}(_0x3705,0x94));var _0x5370=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x3705[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x5370('0x0'));var rimraf=require(_0x5370('0x1'));var zipdir=require(_0x5370('0x2'));var jsonpatch=require(_0x5370('0x3'));var rp=require('request-promise');var moment=require(_0x5370('0x4'));var BPromise=require(_0x5370('0x5'));var Mustache=require(_0x5370('0x6'));var util=require(_0x5370('0x7'));var path=require('path');var sox=require(_0x5370('0x8'));var csv=require(_0x5370('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5370('0xa'));var _=require(_0x5370('0xb'));var squel=require(_0x5370('0xc'));var crypto=require('crypto');var jsforce=require(_0x5370('0xd'));var deskjs=require(_0x5370('0xe'));var toCsv=require(_0x5370('0x9'));var querystring=require(_0x5370('0xf'));var Papa=require(_0x5370('0x10'));var Redis=require(_0x5370('0x11'));var authService=require(_0x5370('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5370('0x13'));var hardwareService=require(_0x5370('0x14'));var logger=require(_0x5370('0x15'))(_0x5370('0x16'));var utils=require(_0x5370('0x17'));var config=require(_0x5370('0x18'));var licenseUtil=require(_0x5370('0x19'));var db=require(_0x5370('0x1a'))['db'];function respondWithStatusCode(_0x2545ce,_0x300cbf){_0x300cbf=_0x300cbf||0xcc;return function(_0x460847){if(_0x460847){return _0x2545ce['sendStatus'](_0x300cbf);}return _0x2545ce[_0x5370('0x1b')](_0x300cbf)[_0x5370('0x1c')]();};}function respondWithResult(_0x59560a,_0x27ed62){_0x27ed62=_0x27ed62||0xc8;return function(_0x1c6ab9){if(_0x1c6ab9){return _0x59560a[_0x5370('0x1b')](_0x27ed62)[_0x5370('0x1d')](_0x1c6ab9);}};}function respondWithFilteredResult(_0x2ce531,_0x1a8f25){return function(_0xd7204){if(_0xd7204){var _0x2a00e5=typeof _0x1a8f25[_0x5370('0x1e')]===_0x5370('0x1f')&&typeof _0x1a8f25[_0x5370('0x20')]===_0x5370('0x1f');var _0x843bea=_0xd7204[_0x5370('0x21')];var _0x28c67a=_0x2a00e5?0x0:_0x1a8f25[_0x5370('0x1e')];var _0x5959c4=_0x2a00e5?_0xd7204[_0x5370('0x21')]:_0x1a8f25[_0x5370('0x1e')]+_0x1a8f25['limit'];var _0x5b937f;if(_0x5959c4>=_0x843bea){_0x5959c4=_0x843bea;_0x5b937f=0xc8;}else{_0x5b937f=0xce;}_0x2ce531['status'](_0x5b937f);return _0x2ce531[_0x5370('0x22')](_0x5370('0x23'),_0x28c67a+'-'+_0x5959c4+'/'+_0x843bea)['json'](_0xd7204);}return null;};}function patchUpdates(_0x39675a){return function(_0x20a6e7){try{jsonpatch[_0x5370('0x24')](_0x20a6e7,_0x39675a,!![]);}catch(_0x335193){return BPromise[_0x5370('0x25')](_0x335193);}return _0x20a6e7[_0x5370('0x26')]();};}function saveUpdates(_0xe2acb5,_0x7a0ef6){return function(_0x19e9b0){if(_0x19e9b0){return _0x19e9b0[_0x5370('0x27')](_0xe2acb5)[_0x5370('0x28')](function(_0x1890fc){return _0x1890fc;});}return null;};}function removeEntity(_0x309c37,_0x2427c9){return function(_0x573bdc){if(_0x573bdc){return _0x573bdc['destroy']()['then'](function(){_0x309c37[_0x5370('0x1b')](0xcc)[_0x5370('0x1c')]();});}};}function handleEntityNotFound(_0x4b1b8a,_0x2ad50c){return function(_0x5d3f3f){if(!_0x5d3f3f){_0x4b1b8a[_0x5370('0x29')](0x194);}return _0x5d3f3f;};}function handleError(_0x5875c2,_0x26bf01){_0x26bf01=_0x26bf01||0x1f4;return function(_0x16d1e3){logger[_0x5370('0x2a')](_0x16d1e3[_0x5370('0x2b')]);if(_0x16d1e3['name']){delete _0x16d1e3[_0x5370('0x2c')];}_0x5875c2[_0x5370('0x1b')](_0x26bf01)[_0x5370('0x2d')](_0x16d1e3);};}exports['index']=function(_0x194780,_0xb9d8fa){var _0x42f4f8={},_0x712fe0={},_0x5b3f68={'count':0x0,'rows':[]};var _0x490424=_['map'](db[_0x5370('0x2e')][_0x5370('0x2f')],function(_0x57183d){return{'name':_0x57183d[_0x5370('0x30')],'type':_0x57183d[_0x5370('0x31')]['key']};});_0x712fe0['model']=_[_0x5370('0x32')](_0x490424,_0x5370('0x2c'));_0x712fe0[_0x5370('0x33')]=_[_0x5370('0x34')](_0x194780['query']);_0x712fe0[_0x5370('0x35')]=_[_0x5370('0x36')](_0x712fe0[_0x5370('0x37')],_0x712fe0['query']);_0x42f4f8[_0x5370('0x38')]=_['intersection'](_0x712fe0['model'],qs[_0x5370('0x39')](_0x194780[_0x5370('0x33')][_0x5370('0x39')]));_0x42f4f8[_0x5370('0x38')]=_0x42f4f8[_0x5370('0x38')][_0x5370('0x3a')]?_0x42f4f8[_0x5370('0x38')]:_0x712fe0[_0x5370('0x37')];if(!_0x194780[_0x5370('0x33')][_0x5370('0x3b')]('nolimit')){_0x42f4f8['limit']=qs['limit'](_0x194780['query'][_0x5370('0x20')]);_0x42f4f8['offset']=qs[_0x5370('0x1e')](_0x194780['query'][_0x5370('0x1e')]);}_0x42f4f8[_0x5370('0x3c')]=qs[_0x5370('0x3d')](_0x194780['query']['sort']);_0x42f4f8[_0x5370('0x3e')]=qs[_0x5370('0x35')](_[_0x5370('0x3f')](_0x194780[_0x5370('0x33')],_0x712fe0[_0x5370('0x35')]),_0x490424);if(_0x194780['query'][_0x5370('0x40')]){_0x42f4f8[_0x5370('0x3e')]=_[_0x5370('0x41')](_0x42f4f8['where'],{'$or':_[_0x5370('0x32')](_0x490424,function(_0x3d7b80){if(_0x3d7b80[_0x5370('0x31')]!==_0x5370('0x42')){var _0x22ea54={};_0x22ea54[_0x3d7b80[_0x5370('0x2c')]]={'$like':'%'+_0x194780[_0x5370('0x33')][_0x5370('0x40')]+'%'};return _0x22ea54;}})});}_0x42f4f8=_['merge']({},_0x42f4f8,_0x194780[_0x5370('0x43')]);var _0x5991d7={'where':_0x42f4f8[_0x5370('0x3e')]};return db[_0x5370('0x2e')]['count'](_0x5991d7)['then'](function(_0x420cbd){_0x5b3f68['count']=_0x420cbd;if(_0x194780[_0x5370('0x33')]['includeAll']){_0x42f4f8[_0x5370('0x44')]=[{'all':!![]}];}return db['SquareReport'][_0x5370('0x45')](_0x42f4f8);})['then'](function(_0x54ac51){_0x5b3f68[_0x5370('0x46')]=_0x54ac51;return _0x5b3f68;})[_0x5370('0x28')](respondWithFilteredResult(_0xb9d8fa,_0x42f4f8))[_0x5370('0x47')](handleError(_0xb9d8fa,null));};exports[_0x5370('0x48')]=function(_0x5671be,_0x270e7c){var _0xf81bc5={'raw':!![],'where':{'id':_0x5671be[_0x5370('0x49')]['id']}},_0x2a1166={};_0x2a1166[_0x5370('0x37')]=_[_0x5370('0x34')](db['SquareReport']['rawAttributes']);_0x2a1166[_0x5370('0x33')]=_[_0x5370('0x34')](_0x5671be[_0x5370('0x33')]);_0x2a1166[_0x5370('0x35')]=_['intersection'](_0x2a1166['model'],_0x2a1166[_0x5370('0x33')]);_0xf81bc5['attributes']=_[_0x5370('0x36')](_0x2a1166[_0x5370('0x37')],qs[_0x5370('0x39')](_0x5671be['query'][_0x5370('0x39')]));_0xf81bc5[_0x5370('0x38')]=_0xf81bc5[_0x5370('0x38')][_0x5370('0x3a')]?_0xf81bc5[_0x5370('0x38')]:_0x2a1166['model'];if(_0x5671be['query'][_0x5370('0x4a')]){_0xf81bc5['include']=[{'all':!![]}];}_0xf81bc5=_['merge']({},_0xf81bc5,_0x5671be['options']);return db[_0x5370('0x2e')]['find'](_0xf81bc5)[_0x5370('0x28')](handleEntityNotFound(_0x270e7c,null))['then'](respondWithResult(_0x270e7c,null))[_0x5370('0x47')](handleError(_0x270e7c,null));};exports[_0x5370('0x4b')]=function(_0x45b932,_0x4914dd){return db[_0x5370('0x2e')][_0x5370('0x4b')](_0x45b932[_0x5370('0x4c')],{})['then'](respondWithResult(_0x4914dd,0xc9))[_0x5370('0x47')](handleError(_0x4914dd,null));};exports['update']=function(_0x5da84d,_0x5e30ce){if(_0x5da84d['body']['id']){delete _0x5da84d[_0x5370('0x4c')]['id'];}return db['SquareReport'][_0x5370('0x4d')]({'where':{'id':_0x5da84d['params']['id']}})['then'](handleEntityNotFound(_0x5e30ce,null))[_0x5370('0x28')](saveUpdates(_0x5da84d[_0x5370('0x4c')],null))[_0x5370('0x28')](respondWithResult(_0x5e30ce,null))[_0x5370('0x47')](handleError(_0x5e30ce,null));};exports[_0x5370('0x4e')]=function(_0x1b1335,_0x77c394){return db[_0x5370('0x2e')]['find']({'where':{'id':_0x1b1335[_0x5370('0x49')]['id']}})[_0x5370('0x28')](handleEntityNotFound(_0x77c394,null))[_0x5370('0x28')](removeEntity(_0x77c394,null))['catch'](handleError(_0x77c394,null));};exports[_0x5370('0x4f')]=function(_0x3c4b85,_0x57a19d){return db[_0x5370('0x2e')][_0x5370('0x4f')]()[_0x5370('0x28')](respondWithResult(_0x57a19d,null))[_0x5370('0x47')](handleError(_0x57a19d,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 710d922..8a4760e 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 _0xbf7c=['uniqueid','project_name','lodash','util','../../config/logger','moment','request-promise','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xbf7c,0xf0));var _0xcbf7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbf7c[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xcbf7('0x0'));var util=require(_0xcbf7('0x1'));var logger=require(_0xcbf7('0x2'))('api');var moment=require(_0xcbf7('0x3'));var BPromise=require('bluebird');var rp=require(_0xcbf7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcbf7('0x5'));var attributes=require(_0xcbf7('0x6'));module[_0xcbf7('0x7')]=function(_0x43579f,_0x4d3362){return _0x43579f[_0xcbf7('0x8')](_0xcbf7('0x9'),attributes,{'tableName':_0xcbf7('0xa'),'paranoid':![],'indexes':[{'name':_0xcbf7('0xb'),'fields':[_0xcbf7('0xc'),_0xcbf7('0xd')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2eec=['exports','define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes'];(function(_0x404efc,_0x2acc49){var _0x4207e8=function(_0x4ac022){while(--_0x4ac022){_0x404efc['push'](_0x404efc['shift']());}};_0x4207e8(++_0x2acc49);}(_0x2eec,0x106));var _0xc2ee=function(_0x5c91ab,_0x499811){_0x5c91ab=_0x5c91ab-0x0;var _0x3f1a36=_0x2eec[_0x5c91ab];return _0x3f1a36;};'use strict';var _=require(_0xc2ee('0x0'));var util=require(_0xc2ee('0x1'));var logger=require(_0xc2ee('0x2'))('api');var moment=require(_0xc2ee('0x3'));var BPromise=require(_0xc2ee('0x4'));var rp=require(_0xc2ee('0x5'));var fs=require('fs');var path=require(_0xc2ee('0x6'));var rimraf=require(_0xc2ee('0x7'));var config=require(_0xc2ee('0x8'));var attributes=require(_0xc2ee('0x9'));module[_0xc2ee('0xa')]=function(_0x35f8e,_0x29f426){return _0x35f8e[_0xc2ee('0xb')]('SquareReport',attributes,{'tableName':_0xc2ee('0xc'),'paranoid':![],'indexes':[{'name':_0xc2ee('0xd'),'fields':[_0xc2ee('0xe'),_0xc2ee('0xf')]},{'name':_0xc2ee('0x10'),'fields':[_0xc2ee('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index b848c28..a54e353 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 _0x3e81=['update','where','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareReport','SquareReport','body','options','raw','debug','UpdateSquareReport'];(function(_0x245772,_0x2c0818){var _0x1a1c3b=function(_0x4087ac){while(--_0x4087ac){_0x245772['push'](_0x245772['shift']());}};_0x1a1c3b(++_0x2c0818);}(_0x3e81,0x124));var _0x13e8=function(_0x11d065,_0x34eb09){_0x11d065=_0x11d065-0x0;var _0x2cfe39=_0x3e81[_0x11d065];return _0x2cfe39;};'use strict';var _=require(_0x13e8('0x0'));var util=require(_0x13e8('0x1'));var moment=require('moment');var BPromise=require(_0x13e8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13e8('0x3'));var db=require(_0x13e8('0x4'))['db'];var utils=require(_0x13e8('0x5'));var logger=require(_0x13e8('0x6'))('rpc');var config=require(_0x13e8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x13e8('0x8')][_0x13e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b38bd,_0x4b2b05,_0xa83b46){return new BPromise(function(_0x26c8f0,_0x4627fe){return client[_0x13e8('0xa')](_0x2b38bd,_0xa83b46)[_0x13e8('0xb')](function(_0x1bdf90){logger[_0x13e8('0xc')](_0x13e8('0xd'),_0x4b2b05,_0x13e8('0xe'));logger['debug'](_0x13e8('0xf'),_0x4b2b05,'request\x20sent',JSON[_0x13e8('0x10')](_0x1bdf90));if(_0x1bdf90[_0x13e8('0x11')]){if(_0x1bdf90['error'][_0x13e8('0x12')]===0x1f4){logger[_0x13e8('0x11')]('SquareReport,\x20%s,\x20%s',_0x4b2b05,_0x1bdf90['error']['message']);return _0x4627fe(_0x1bdf90[_0x13e8('0x11')]['message']);}logger['error'](_0x13e8('0xd'),_0x4b2b05,_0x1bdf90[_0x13e8('0x11')][_0x13e8('0x13')]);return _0x26c8f0(_0x1bdf90[_0x13e8('0x11')][_0x13e8('0x13')]);}else{logger[_0x13e8('0xc')](_0x13e8('0xd'),_0x4b2b05,'request\x20sent');_0x26c8f0(_0x1bdf90['result'][_0x13e8('0x13')]);}})[_0x13e8('0x14')](function(_0x21da4c){logger[_0x13e8('0x11')](_0x13e8('0xd'),_0x4b2b05,_0x21da4c);_0x4627fe(_0x21da4c);});});}exports[_0x13e8('0x15')]=function(_0x3ffdce){var _0x11c9d3=this;return new Promise(function(_0x5acb73,_0x25931a){return db[_0x13e8('0x16')]['create'](_0x3ffdce[_0x13e8('0x17')],{'raw':_0x3ffdce['options']?_0x3ffdce[_0x13e8('0x18')][_0x13e8('0x19')]===undefined?!![]:![]:!![]})[_0x13e8('0xb')](function(_0xb4eeb7){logger[_0x13e8('0xc')]('CreateSquareReport',_0x3ffdce);logger[_0x13e8('0x1a')](_0x13e8('0x15'),_0x3ffdce,JSON['stringify'](_0xb4eeb7));_0x5acb73(_0xb4eeb7);})['catch'](function(_0x61269a){logger[_0x13e8('0x11')](_0x13e8('0x15'),_0x61269a[_0x13e8('0x13')],_0x3ffdce);_0x25931a(_0x11c9d3[_0x13e8('0x11')](0x1f4,_0x61269a[_0x13e8('0x13')]));});});};exports[_0x13e8('0x1b')]=function(_0x30b6ca){var _0x1561ed=this;return new Promise(function(_0x856fed,_0x5f5da6){return db[_0x13e8('0x16')][_0x13e8('0x1c')](_0x30b6ca[_0x13e8('0x17')],{'raw':_0x30b6ca['options']?_0x30b6ca[_0x13e8('0x18')][_0x13e8('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30b6ca[_0x13e8('0x18')]?_0x30b6ca[_0x13e8('0x18')][_0x13e8('0x1d')]||null:null,'attributes':_0x30b6ca[_0x13e8('0x18')]?_0x30b6ca[_0x13e8('0x18')][_0x13e8('0x1e')]||null:null,'limit':_0x30b6ca['options']?_0x30b6ca[_0x13e8('0x18')][_0x13e8('0x1f')]||null:null})['then'](function(_0x4ab8f3){logger[_0x13e8('0xc')](_0x13e8('0x1b'),_0x30b6ca);logger[_0x13e8('0x1a')]('UpdateSquareReport',_0x30b6ca,JSON[_0x13e8('0x10')](_0x4ab8f3));_0x856fed(_0x4ab8f3);})[_0x13e8('0x14')](function(_0x5ebe8f){logger[_0x13e8('0x11')]('UpdateSquareReport',_0x5ebe8f[_0x13e8('0x13')],_0x30b6ca);_0x5f5da6(_0x1561ed[_0x13e8('0x11')](0x1f4,_0x5ebe8f[_0x13e8('0x13')]));});});}; \ No newline at end of file +var _0xc300=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateSquareReport','create','body','options','UpdateSquareReport','SquareReport','update','raw','where','attributes','lodash'];(function(_0x2f29e2,_0x493fdf){var _0x11f455=function(_0xf3069e){while(--_0xf3069e){_0x2f29e2['push'](_0x2f29e2['shift']());}};_0x11f455(++_0x493fdf);}(_0xc300,0x65));var _0x0c30=function(_0x3b2687,_0x5f5366){_0x3b2687=_0x3b2687-0x0;var _0x11f663=_0xc300[_0x3b2687];return _0x11f663;};'use strict';var _=require(_0x0c30('0x0'));var util=require('util');var moment=require(_0x0c30('0x1'));var BPromise=require(_0x0c30('0x2'));var rs=require(_0x0c30('0x3'));var fs=require('fs');var Redis=require(_0x0c30('0x4'));var db=require(_0x0c30('0x5'))['db'];var utils=require(_0x0c30('0x6'));var logger=require('../../config/logger')(_0x0c30('0x7'));var config=require(_0x0c30('0x8'));var jayson=require(_0x0c30('0x9'));var client=jayson[_0x0c30('0xa')][_0x0c30('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3654de,_0x4d1996,_0x42fe13){return new BPromise(function(_0x188404,_0x1b958f){return client[_0x0c30('0xc')](_0x3654de,_0x42fe13)[_0x0c30('0xd')](function(_0x161e72){logger['info'](_0x0c30('0xe'),_0x4d1996,_0x0c30('0xf'));logger[_0x0c30('0x10')](_0x0c30('0x11'),_0x4d1996,'request\x20sent',JSON[_0x0c30('0x12')](_0x161e72));if(_0x161e72[_0x0c30('0x13')]){if(_0x161e72[_0x0c30('0x13')]['code']===0x1f4){logger[_0x0c30('0x13')](_0x0c30('0xe'),_0x4d1996,_0x161e72['error']['message']);return _0x1b958f(_0x161e72[_0x0c30('0x13')][_0x0c30('0x14')]);}logger[_0x0c30('0x13')]('SquareReport,\x20%s,\x20%s',_0x4d1996,_0x161e72[_0x0c30('0x13')][_0x0c30('0x14')]);return _0x188404(_0x161e72[_0x0c30('0x13')]['message']);}else{logger[_0x0c30('0x15')](_0x0c30('0xe'),_0x4d1996,_0x0c30('0xf'));_0x188404(_0x161e72[_0x0c30('0x16')][_0x0c30('0x14')]);}})[_0x0c30('0x17')](function(_0x5d2589){logger['error'](_0x0c30('0xe'),_0x4d1996,_0x5d2589);_0x1b958f(_0x5d2589);});});}exports[_0x0c30('0x18')]=function(_0x217c6d){var _0x313ea4=this;return new Promise(function(_0x1f2e1b,_0x2bd934){return db['SquareReport'][_0x0c30('0x19')](_0x217c6d[_0x0c30('0x1a')],{'raw':_0x217c6d[_0x0c30('0x1b')]?_0x217c6d[_0x0c30('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x0c30('0xd')](function(_0x52afb9){logger[_0x0c30('0x15')](_0x0c30('0x18'),_0x217c6d);logger[_0x0c30('0x10')](_0x0c30('0x18'),_0x217c6d,JSON[_0x0c30('0x12')](_0x52afb9));_0x1f2e1b(_0x52afb9);})['catch'](function(_0x3d8d64){logger[_0x0c30('0x13')](_0x0c30('0x18'),_0x3d8d64[_0x0c30('0x14')],_0x217c6d);_0x2bd934(_0x313ea4[_0x0c30('0x13')](0x1f4,_0x3d8d64[_0x0c30('0x14')]));});});};exports[_0x0c30('0x1c')]=function(_0x24e087){var _0x4064f0=this;return new Promise(function(_0x2839fb,_0xc934d3){return db[_0x0c30('0x1d')][_0x0c30('0x1e')](_0x24e087[_0x0c30('0x1a')],{'raw':_0x24e087[_0x0c30('0x1b')]?_0x24e087[_0x0c30('0x1b')][_0x0c30('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24e087[_0x0c30('0x1b')]?_0x24e087['options'][_0x0c30('0x20')]||null:null,'attributes':_0x24e087[_0x0c30('0x1b')]?_0x24e087[_0x0c30('0x1b')][_0x0c30('0x21')]||null:null,'limit':_0x24e087['options']?_0x24e087['options']['limit']||null:null})['then'](function(_0x233387){logger['info'](_0x0c30('0x1c'),_0x24e087);logger['debug'](_0x0c30('0x1c'),_0x24e087,JSON[_0x0c30('0x12')](_0x233387));_0x2839fb(_0x233387);})[_0x0c30('0x17')](function(_0x3d59d5){logger[_0x0c30('0x13')](_0x0c30('0x1c'),_0x3d59d5[_0x0c30('0x14')],_0x24e087);_0xc934d3(_0x4064f0[_0x0c30('0x13')](0x1f4,_0x3d59d5['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 9086d66..96ab8d5 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 _0x1cb1=['post','create','put','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x1cb1,0x137));var _0x11cb=function(_0x6ff0ae,_0x57b636){_0x6ff0ae=_0x6ff0ae-0x0;var _0x4ce748=_0x1cb1[_0x6ff0ae];return _0x4ce748;};'use strict';var multer=require(_0x11cb('0x0'));var util=require(_0x11cb('0x1'));var path=require(_0x11cb('0x2'));var timeout=require(_0x11cb('0x3'));var express=require('express');var router=express[_0x11cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x11cb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x11cb('0x6'));var controller=require('./squareReportDetail.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x11cb('0x7')](_0x11cb('0x8'),auth[_0x11cb('0x9')](),controller[_0x11cb('0xa')]);router[_0x11cb('0x7')](_0x11cb('0xb'),auth[_0x11cb('0x9')](),controller[_0x11cb('0xc')]);router[_0x11cb('0xd')]('/',auth[_0x11cb('0x9')](),controller[_0x11cb('0xe')]);router[_0x11cb('0xf')](_0x11cb('0xb'),auth[_0x11cb('0x9')](),controller['update']);router[_0x11cb('0x10')]('/:id',auth[_0x11cb('0x9')](),controller[_0x11cb('0x11')]);module['exports']=router; \ No newline at end of file +var _0x96d9=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','destroy','exports','util','path','Router'];(function(_0x5c2e5e,_0x2bc00e){var _0x46a5da=function(_0xf0fa38){while(--_0xf0fa38){_0x5c2e5e['push'](_0x5c2e5e['shift']());}};_0x46a5da(++_0x2bc00e);}(_0x96d9,0x165));var _0x996d=function(_0x22715b,_0x3e6b7c){_0x22715b=_0x22715b-0x0;var _0x1c35e6=_0x96d9[_0x22715b];return _0x1c35e6;};'use strict';var multer=require('multer');var util=require(_0x996d('0x0'));var path=require(_0x996d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x996d('0x2')]();var fs_extra=require(_0x996d('0x3'));var auth=require(_0x996d('0x4'));var interaction=require(_0x996d('0x5'));var config=require(_0x996d('0x6'));var controller=require('./squareReportDetail.controller');router[_0x996d('0x7')]('/',auth[_0x996d('0x8')](),controller[_0x996d('0x9')]);router[_0x996d('0x7')](_0x996d('0xa'),auth[_0x996d('0x8')](),controller[_0x996d('0xb')]);router[_0x996d('0x7')](_0x996d('0xc'),auth['isAuthenticated'](),controller[_0x996d('0xd')]);router[_0x996d('0xe')]('/',auth[_0x996d('0x8')](),controller['create']);router[_0x996d('0xf')]('/:id',auth[_0x996d('0x8')](),controller['update']);router['delete'](_0x996d('0xc'),auth[_0x996d('0x8')](),controller[_0x996d('0x10')]);module[_0x996d('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 6e83016..c9a5da9 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 _0x745f=['exports','STRING','TEXT','sequelize'];(function(_0x340df9,_0x58fe4d){var _0x4b5637=function(_0x3ca7f3){while(--_0x3ca7f3){_0x340df9['push'](_0x340df9['shift']());}};_0x4b5637(++_0x58fe4d);}(_0x745f,0x127));var _0xf745=function(_0x1e5068,_0x31e9c4){_0x1e5068=_0x1e5068-0x0;var _0x2230b6=_0x745f[_0x1e5068];return _0x2230b6;};'use strict';var Sequelize=require(_0xf745('0x0'));module[_0xf745('0x1')]={'uniqueid':{'type':Sequelize[_0xf745('0x2')]},'node':{'type':Sequelize[_0xf745('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xf745('0x3')]},'project_name':{'type':Sequelize[_0xf745('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6fa9=['TEXT','sequelize','exports','STRING'];(function(_0x45dfb4,_0x57643e){var _0x499c2e=function(_0x41ffed){while(--_0x41ffed){_0x45dfb4['push'](_0x45dfb4['shift']());}};_0x499c2e(++_0x57643e);}(_0x6fa9,0x13d));var _0x96fa=function(_0x1a37f4,_0x5b2b24){_0x1a37f4=_0x1a37f4-0x0;var _0x343570=_0x6fa9[_0x1a37f4];return _0x343570;};'use strict';var Sequelize=require(_0x96fa('0x0'));module[_0x96fa('0x1')]={'uniqueid':{'type':Sequelize[_0x96fa('0x2')]},'node':{'type':Sequelize[_0x96fa('0x2')]},'application':{'type':Sequelize[_0x96fa('0x2')]},'data':{'type':Sequelize[_0x96fa('0x3')]},'project_name':{'type':Sequelize[_0x96fa('0x2')]},'callerid':{'type':Sequelize[_0x96fa('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 41123c5..3f25e20 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 _0x4645=['offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','SquareDetailsReport','rawAttributes','fieldName','model','query','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count'];(function(_0x2b72d1,_0x112508){var _0x482358=function(_0x4c827c){while(--_0x4c827c){_0x2b72d1['push'](_0x2b72d1['shift']());}};_0x482358(++_0x112508);}(_0x4645,0x141));var _0x5464=function(_0x24e18d,_0x239822){_0x24e18d=_0x24e18d-0x0;var _0xa570be=_0x4645[_0x24e18d];return _0xa570be;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5464('0x0'));var zipdir=require(_0x5464('0x1'));var jsonpatch=require(_0x5464('0x2'));var rp=require('request-promise');var moment=require(_0x5464('0x3'));var BPromise=require(_0x5464('0x4'));var Mustache=require('mustache');var util=require(_0x5464('0x5'));var path=require(_0x5464('0x6'));var sox=require(_0x5464('0x7'));var csv=require(_0x5464('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5464('0x9'));var crypto=require(_0x5464('0xa'));var jsforce=require(_0x5464('0xb'));var deskjs=require(_0x5464('0xc'));var toCsv=require(_0x5464('0x8'));var querystring=require(_0x5464('0xd'));var Papa=require('papaparse');var Redis=require(_0x5464('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5464('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5464('0x10'));var logger=require(_0x5464('0x11'))(_0x5464('0x12'));var utils=require(_0x5464('0x13'));var config=require(_0x5464('0x14'));var licenseUtil=require(_0x5464('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x409d6f,_0x14952b){_0x14952b=_0x14952b||0xcc;return function(_0x711648){if(_0x711648){return _0x409d6f[_0x5464('0x16')](_0x14952b);}return _0x409d6f[_0x5464('0x17')](_0x14952b)[_0x5464('0x18')]();};}function respondWithResult(_0x34e7d8,_0x22cad4){_0x22cad4=_0x22cad4||0xc8;return function(_0x3d25b8){if(_0x3d25b8){return _0x34e7d8[_0x5464('0x17')](_0x22cad4)[_0x5464('0x19')](_0x3d25b8);}};}function respondWithFilteredResult(_0x341cab,_0xc7eba1){return function(_0x3aeed5){if(_0x3aeed5){var _0x2d1fa7=typeof _0xc7eba1['offset']==='undefined'&&typeof _0xc7eba1[_0x5464('0x1a')]===_0x5464('0x1b');var _0x2153ac=_0x3aeed5[_0x5464('0x1c')];var _0x6c95e3=_0x2d1fa7?0x0:_0xc7eba1[_0x5464('0x1d')];var _0xac8f5c=_0x2d1fa7?_0x3aeed5[_0x5464('0x1c')]:_0xc7eba1[_0x5464('0x1d')]+_0xc7eba1['limit'];var _0x20dd17;if(_0xac8f5c>=_0x2153ac){_0xac8f5c=_0x2153ac;_0x20dd17=0xc8;}else{_0x20dd17=0xce;}_0x341cab[_0x5464('0x17')](_0x20dd17);return _0x341cab[_0x5464('0x1e')]('Content-Range',_0x6c95e3+'-'+_0xac8f5c+'/'+_0x2153ac)['json'](_0x3aeed5);}return null;};}function patchUpdates(_0x197bbf){return function(_0x128abc){try{jsonpatch[_0x5464('0x1f')](_0x128abc,_0x197bbf,!![]);}catch(_0x1e2a1d){return BPromise[_0x5464('0x20')](_0x1e2a1d);}return _0x128abc[_0x5464('0x21')]();};}function saveUpdates(_0x3816f8,_0x82bcba){return function(_0x44a56d){if(_0x44a56d){return _0x44a56d[_0x5464('0x22')](_0x3816f8)[_0x5464('0x23')](function(_0x57bcd2){return _0x57bcd2;});}return null;};}function removeEntity(_0x114edc,_0x2fe6d4){return function(_0x14098){if(_0x14098){return _0x14098[_0x5464('0x24')]()[_0x5464('0x23')](function(){_0x114edc[_0x5464('0x17')](0xcc)[_0x5464('0x18')]();});}};}function handleEntityNotFound(_0x585f7d,_0x2be216){return function(_0x43459f){if(!_0x43459f){_0x585f7d[_0x5464('0x16')](0x194);}return _0x43459f;};}function handleError(_0x3451b9,_0x5c219f){_0x5c219f=_0x5c219f||0x1f4;return function(_0x2df173){logger[_0x5464('0x25')](_0x2df173[_0x5464('0x26')]);if(_0x2df173[_0x5464('0x27')]){delete _0x2df173['name'];}_0x3451b9['status'](_0x5c219f)[_0x5464('0x28')](_0x2df173);};}exports['index']=function(_0x4b7154,_0x4c23ae){var _0x3f73ee={},_0x2f8a28={},_0x547eb7={'count':0x0,'rows':[]};var _0x34badf=_['map'](db[_0x5464('0x29')][_0x5464('0x2a')],function(_0x37d50d){return{'name':_0x37d50d[_0x5464('0x2b')],'type':_0x37d50d['type']['key']};});_0x2f8a28[_0x5464('0x2c')]=_['map'](_0x34badf,'name');_0x2f8a28[_0x5464('0x2d')]=_['keys'](_0x4b7154['query']);_0x2f8a28[_0x5464('0x2e')]=_['intersection'](_0x2f8a28[_0x5464('0x2c')],_0x2f8a28[_0x5464('0x2d')]);_0x3f73ee['attributes']=_[_0x5464('0x2f')](_0x2f8a28[_0x5464('0x2c')],qs['fields'](_0x4b7154[_0x5464('0x2d')]['fields']));_0x3f73ee[_0x5464('0x30')]=_0x3f73ee[_0x5464('0x30')]['length']?_0x3f73ee[_0x5464('0x30')]:_0x2f8a28[_0x5464('0x2c')];if(!_0x4b7154[_0x5464('0x2d')][_0x5464('0x31')]('nolimit')){_0x3f73ee[_0x5464('0x1a')]=qs[_0x5464('0x1a')](_0x4b7154[_0x5464('0x2d')]['limit']);_0x3f73ee['offset']=qs['offset'](_0x4b7154[_0x5464('0x2d')][_0x5464('0x1d')]);}_0x3f73ee[_0x5464('0x32')]=qs[_0x5464('0x33')](_0x4b7154[_0x5464('0x2d')][_0x5464('0x33')]);_0x3f73ee[_0x5464('0x34')]=qs[_0x5464('0x2e')](_['pick'](_0x4b7154['query'],_0x2f8a28[_0x5464('0x2e')]),_0x34badf);if(_0x4b7154[_0x5464('0x2d')][_0x5464('0x35')]){_0x3f73ee[_0x5464('0x34')]=_[_0x5464('0x36')](_0x3f73ee[_0x5464('0x34')],{'$or':_[_0x5464('0x37')](_0x34badf,function(_0x6644ed){if(_0x6644ed[_0x5464('0x38')]!==_0x5464('0x39')){var _0x18ab65={};_0x18ab65[_0x6644ed['name']]={'$like':'%'+_0x4b7154[_0x5464('0x2d')]['filter']+'%'};return _0x18ab65;}})});}_0x3f73ee=_[_0x5464('0x36')]({},_0x3f73ee,_0x4b7154[_0x5464('0x3a')]);var _0x26dc7a={'where':_0x3f73ee[_0x5464('0x34')]};return db[_0x5464('0x29')][_0x5464('0x1c')](_0x26dc7a)[_0x5464('0x23')](function(_0x243d44){_0x547eb7['count']=_0x243d44;if(_0x4b7154[_0x5464('0x2d')][_0x5464('0x3b')]){_0x3f73ee[_0x5464('0x3c')]=[{'all':!![]}];}return db[_0x5464('0x29')][_0x5464('0x3d')](_0x3f73ee);})[_0x5464('0x23')](function(_0xe22241){_0x547eb7[_0x5464('0x3e')]=_0xe22241;return _0x547eb7;})[_0x5464('0x23')](respondWithFilteredResult(_0x4c23ae,_0x3f73ee))['catch'](handleError(_0x4c23ae,null));};exports[_0x5464('0x3f')]=function(_0x5e85e3,_0x17569a){var _0x2485b8={'raw':!![],'where':{'id':_0x5e85e3[_0x5464('0x40')]['id']}},_0x365353={};_0x365353[_0x5464('0x2c')]=_[_0x5464('0x41')](db[_0x5464('0x29')][_0x5464('0x2a')]);_0x365353[_0x5464('0x2d')]=_[_0x5464('0x41')](_0x5e85e3[_0x5464('0x2d')]);_0x365353[_0x5464('0x2e')]=_[_0x5464('0x2f')](_0x365353[_0x5464('0x2c')],_0x365353[_0x5464('0x2d')]);_0x2485b8[_0x5464('0x30')]=_[_0x5464('0x2f')](_0x365353['model'],qs['fields'](_0x5e85e3[_0x5464('0x2d')]['fields']));_0x2485b8['attributes']=_0x2485b8[_0x5464('0x30')]['length']?_0x2485b8['attributes']:_0x365353[_0x5464('0x2c')];if(_0x5e85e3[_0x5464('0x2d')][_0x5464('0x3b')]){_0x2485b8[_0x5464('0x3c')]=[{'all':!![]}];}_0x2485b8=_[_0x5464('0x36')]({},_0x2485b8,_0x5e85e3[_0x5464('0x3a')]);return db[_0x5464('0x29')][_0x5464('0x42')](_0x2485b8)[_0x5464('0x23')](handleEntityNotFound(_0x17569a,null))['then'](respondWithResult(_0x17569a,null))['catch'](handleError(_0x17569a,null));};exports[_0x5464('0x43')]=function(_0x274872,_0xd939ee){return db[_0x5464('0x29')][_0x5464('0x43')](_0x274872[_0x5464('0x44')],{})[_0x5464('0x23')](respondWithResult(_0xd939ee,0xc9))[_0x5464('0x45')](handleError(_0xd939ee,null));};exports[_0x5464('0x22')]=function(_0x490f55,_0x1f5e77){if(_0x490f55[_0x5464('0x44')]['id']){delete _0x490f55[_0x5464('0x44')]['id'];}return db[_0x5464('0x29')][_0x5464('0x42')]({'where':{'id':_0x490f55[_0x5464('0x40')]['id']}})[_0x5464('0x23')](handleEntityNotFound(_0x1f5e77,null))['then'](saveUpdates(_0x490f55[_0x5464('0x44')],null))[_0x5464('0x23')](respondWithResult(_0x1f5e77,null))[_0x5464('0x45')](handleError(_0x1f5e77,null));};exports[_0x5464('0x24')]=function(_0x573dd3,_0x4113aa){return db['SquareDetailsReport'][_0x5464('0x42')]({'where':{'id':_0x573dd3[_0x5464('0x40')]['id']}})['then'](handleEntityNotFound(_0x4113aa,null))[_0x5464('0x23')](removeEntity(_0x4113aa,null))[_0x5464('0x45')](handleError(_0x4113aa,null));};exports['describe']=function(_0x2dded2,_0x3002a8){return db[_0x5464('0x29')]['describe']()['then'](respondWithResult(_0x3002a8,null))[_0x5464('0x45')](handleError(_0x3002a8,null));}; \ No newline at end of file +var _0x0ddc=['to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','map','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','rimraf','moment','mustache','util','sox'];(function(_0x445532,_0x4a8cf5){var _0xae3b12=function(_0x268358){while(--_0x268358){_0x445532['push'](_0x445532['shift']());}};_0xae3b12(++_0x4a8cf5);}(_0x0ddc,0x1f3));var _0xc0dd=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x0ddc[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc0dd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc0dd('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xc0dd('0x2'));var util=require(_0xc0dd('0x3'));var path=require('path');var sox=require(_0xc0dd('0x4'));var csv=require(_0xc0dd('0x5'));var ejs=require(_0xc0dd('0x6'));var fs=require('fs');var fs_extra=require(_0xc0dd('0x7'));var _=require(_0xc0dd('0x8'));var squel=require(_0xc0dd('0x9'));var crypto=require('crypto');var jsforce=require(_0xc0dd('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc0dd('0xb'));var Papa=require(_0xc0dd('0xc'));var Redis=require(_0xc0dd('0xd'));var authService=require(_0xc0dd('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc0dd('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc0dd('0x10'));var config=require(_0xc0dd('0x11'));var licenseUtil=require(_0xc0dd('0x12'));var db=require(_0xc0dd('0x13'))['db'];function respondWithStatusCode(_0x1b487c,_0xde212d){_0xde212d=_0xde212d||0xcc;return function(_0x131d04){if(_0x131d04){return _0x1b487c['sendStatus'](_0xde212d);}return _0x1b487c[_0xc0dd('0x14')](_0xde212d)[_0xc0dd('0x15')]();};}function respondWithResult(_0x19b197,_0xf298c5){_0xf298c5=_0xf298c5||0xc8;return function(_0x30624b){if(_0x30624b){return _0x19b197['status'](_0xf298c5)[_0xc0dd('0x16')](_0x30624b);}};}function respondWithFilteredResult(_0x1af25f,_0x59dc3f){return function(_0x4f2d1c){if(_0x4f2d1c){var _0x30b77d=typeof _0x59dc3f[_0xc0dd('0x17')]==='undefined'&&typeof _0x59dc3f[_0xc0dd('0x18')]===_0xc0dd('0x19');var _0x1c42ba=_0x4f2d1c['count'];var _0x1d45a9=_0x30b77d?0x0:_0x59dc3f[_0xc0dd('0x17')];var _0x4e7647=_0x30b77d?_0x4f2d1c['count']:_0x59dc3f[_0xc0dd('0x17')]+_0x59dc3f[_0xc0dd('0x18')];var _0x171c10;if(_0x4e7647>=_0x1c42ba){_0x4e7647=_0x1c42ba;_0x171c10=0xc8;}else{_0x171c10=0xce;}_0x1af25f['status'](_0x171c10);return _0x1af25f[_0xc0dd('0x1a')](_0xc0dd('0x1b'),_0x1d45a9+'-'+_0x4e7647+'/'+_0x1c42ba)[_0xc0dd('0x16')](_0x4f2d1c);}return null;};}function patchUpdates(_0x202731){return function(_0x32a57d){try{jsonpatch[_0xc0dd('0x1c')](_0x32a57d,_0x202731,!![]);}catch(_0x334ed9){return BPromise[_0xc0dd('0x1d')](_0x334ed9);}return _0x32a57d[_0xc0dd('0x1e')]();};}function saveUpdates(_0x1647dd,_0x372128){return function(_0x22934d){if(_0x22934d){return _0x22934d[_0xc0dd('0x1f')](_0x1647dd)[_0xc0dd('0x20')](function(_0xd87d54){return _0xd87d54;});}return null;};}function removeEntity(_0x15ced6,_0x3a7470){return function(_0x50c115){if(_0x50c115){return _0x50c115[_0xc0dd('0x21')]()[_0xc0dd('0x20')](function(){_0x15ced6[_0xc0dd('0x14')](0xcc)[_0xc0dd('0x15')]();});}};}function handleEntityNotFound(_0x2f0905,_0xee672e){return function(_0x253880){if(!_0x253880){_0x2f0905[_0xc0dd('0x22')](0x194);}return _0x253880;};}function handleError(_0x496d17,_0x27d514){_0x27d514=_0x27d514||0x1f4;return function(_0x281087){logger[_0xc0dd('0x23')](_0x281087[_0xc0dd('0x24')]);if(_0x281087[_0xc0dd('0x25')]){delete _0x281087[_0xc0dd('0x25')];}_0x496d17[_0xc0dd('0x14')](_0x27d514)[_0xc0dd('0x26')](_0x281087);};}exports[_0xc0dd('0x27')]=function(_0x386d26,_0x5512ef){var _0x55149b={},_0x3065a5={},_0x4cf86a={'count':0x0,'rows':[]};var _0x465872=_['map'](db[_0xc0dd('0x28')][_0xc0dd('0x29')],function(_0x423a7f){return{'name':_0x423a7f[_0xc0dd('0x2a')],'type':_0x423a7f[_0xc0dd('0x2b')]['key']};});_0x3065a5[_0xc0dd('0x2c')]=_['map'](_0x465872,_0xc0dd('0x25'));_0x3065a5[_0xc0dd('0x2d')]=_['keys'](_0x386d26[_0xc0dd('0x2d')]);_0x3065a5[_0xc0dd('0x2e')]=_[_0xc0dd('0x2f')](_0x3065a5['model'],_0x3065a5[_0xc0dd('0x2d')]);_0x55149b[_0xc0dd('0x30')]=_[_0xc0dd('0x2f')](_0x3065a5['model'],qs[_0xc0dd('0x31')](_0x386d26[_0xc0dd('0x2d')][_0xc0dd('0x31')]));_0x55149b[_0xc0dd('0x30')]=_0x55149b['attributes'][_0xc0dd('0x32')]?_0x55149b[_0xc0dd('0x30')]:_0x3065a5[_0xc0dd('0x2c')];if(!_0x386d26['query']['hasOwnProperty'](_0xc0dd('0x33'))){_0x55149b[_0xc0dd('0x18')]=qs['limit'](_0x386d26[_0xc0dd('0x2d')][_0xc0dd('0x18')]);_0x55149b[_0xc0dd('0x17')]=qs[_0xc0dd('0x17')](_0x386d26[_0xc0dd('0x2d')][_0xc0dd('0x17')]);}_0x55149b['order']=qs[_0xc0dd('0x34')](_0x386d26[_0xc0dd('0x2d')][_0xc0dd('0x34')]);_0x55149b[_0xc0dd('0x35')]=qs[_0xc0dd('0x2e')](_['pick'](_0x386d26[_0xc0dd('0x2d')],_0x3065a5[_0xc0dd('0x2e')]),_0x465872);if(_0x386d26[_0xc0dd('0x2d')][_0xc0dd('0x36')]){_0x55149b[_0xc0dd('0x35')]=_[_0xc0dd('0x37')](_0x55149b[_0xc0dd('0x35')],{'$or':_[_0xc0dd('0x38')](_0x465872,function(_0x1b784a){if(_0x1b784a['type']!==_0xc0dd('0x39')){var _0x378c33={};_0x378c33[_0x1b784a[_0xc0dd('0x25')]]={'$like':'%'+_0x386d26[_0xc0dd('0x2d')][_0xc0dd('0x36')]+'%'};return _0x378c33;}})});}_0x55149b=_[_0xc0dd('0x37')]({},_0x55149b,_0x386d26[_0xc0dd('0x3a')]);var _0x29c6c2={'where':_0x55149b['where']};return db[_0xc0dd('0x28')]['count'](_0x29c6c2)[_0xc0dd('0x20')](function(_0xc189ba){_0x4cf86a[_0xc0dd('0x3b')]=_0xc189ba;if(_0x386d26[_0xc0dd('0x2d')][_0xc0dd('0x3c')]){_0x55149b[_0xc0dd('0x3d')]=[{'all':!![]}];}return db[_0xc0dd('0x28')][_0xc0dd('0x3e')](_0x55149b);})[_0xc0dd('0x20')](function(_0x571db9){_0x4cf86a[_0xc0dd('0x3f')]=_0x571db9;return _0x4cf86a;})[_0xc0dd('0x20')](respondWithFilteredResult(_0x5512ef,_0x55149b))['catch'](handleError(_0x5512ef,null));};exports[_0xc0dd('0x40')]=function(_0x2b7e1d,_0x127a40){var _0x139d2a={'raw':!![],'where':{'id':_0x2b7e1d[_0xc0dd('0x41')]['id']}},_0x32defc={};_0x32defc['model']=_[_0xc0dd('0x42')](db[_0xc0dd('0x28')][_0xc0dd('0x29')]);_0x32defc[_0xc0dd('0x2d')]=_[_0xc0dd('0x42')](_0x2b7e1d[_0xc0dd('0x2d')]);_0x32defc[_0xc0dd('0x2e')]=_[_0xc0dd('0x2f')](_0x32defc['model'],_0x32defc[_0xc0dd('0x2d')]);_0x139d2a[_0xc0dd('0x30')]=_['intersection'](_0x32defc[_0xc0dd('0x2c')],qs[_0xc0dd('0x31')](_0x2b7e1d[_0xc0dd('0x2d')]['fields']));_0x139d2a[_0xc0dd('0x30')]=_0x139d2a[_0xc0dd('0x30')][_0xc0dd('0x32')]?_0x139d2a['attributes']:_0x32defc['model'];if(_0x2b7e1d[_0xc0dd('0x2d')][_0xc0dd('0x3c')]){_0x139d2a[_0xc0dd('0x3d')]=[{'all':!![]}];}_0x139d2a=_[_0xc0dd('0x37')]({},_0x139d2a,_0x2b7e1d[_0xc0dd('0x3a')]);return db[_0xc0dd('0x28')][_0xc0dd('0x43')](_0x139d2a)['then'](handleEntityNotFound(_0x127a40,null))['then'](respondWithResult(_0x127a40,null))[_0xc0dd('0x44')](handleError(_0x127a40,null));};exports[_0xc0dd('0x45')]=function(_0x3aeda4,_0x57e557){return db[_0xc0dd('0x28')][_0xc0dd('0x45')](_0x3aeda4[_0xc0dd('0x46')],{})[_0xc0dd('0x20')](respondWithResult(_0x57e557,0xc9))['catch'](handleError(_0x57e557,null));};exports['update']=function(_0x489b21,_0x504a8b){if(_0x489b21[_0xc0dd('0x46')]['id']){delete _0x489b21[_0xc0dd('0x46')]['id'];}return db[_0xc0dd('0x28')][_0xc0dd('0x43')]({'where':{'id':_0x489b21[_0xc0dd('0x41')]['id']}})['then'](handleEntityNotFound(_0x504a8b,null))[_0xc0dd('0x20')](saveUpdates(_0x489b21['body'],null))['then'](respondWithResult(_0x504a8b,null))[_0xc0dd('0x44')](handleError(_0x504a8b,null));};exports[_0xc0dd('0x21')]=function(_0x2a06e6,_0x5f1cb9){return db[_0xc0dd('0x28')][_0xc0dd('0x43')]({'where':{'id':_0x2a06e6[_0xc0dd('0x41')]['id']}})[_0xc0dd('0x20')](handleEntityNotFound(_0x5f1cb9,null))['then'](removeEntity(_0x5f1cb9,null))[_0xc0dd('0x44')](handleError(_0x5f1cb9,null));};exports[_0xc0dd('0x47')]=function(_0xe162db,_0x5ecc55){return db['SquareDetailsReport'][_0xc0dd('0x47')]()[_0xc0dd('0x20')](respondWithResult(_0x5ecc55,null))['catch'](handleError(_0x5ecc55,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 374a0d8..c1fce7a 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 _0x545c=['api','bluebird','request-promise','path','rimraf','define','SquareDetailsReport','report_square_details','lodash','util'];(function(_0x2351ee,_0x2cdff5){var _0x40377d=function(_0x30226b){while(--_0x30226b){_0x2351ee['push'](_0x2351ee['shift']());}};_0x40377d(++_0x2cdff5);}(_0x545c,0x1c0));var _0xc545=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x545c[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xc545('0x0'));var util=require(_0xc545('0x1'));var logger=require('../../config/logger')(_0xc545('0x2'));var moment=require('moment');var BPromise=require(_0xc545('0x3'));var rp=require(_0xc545('0x4'));var fs=require('fs');var path=require(_0xc545('0x5'));var rimraf=require(_0xc545('0x6'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x137c74,_0x23e99f){return _0x137c74[_0xc545('0x7')](_0xc545('0x8'),attributes,{'tableName':_0xc545('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4d5=['api','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','util','../../config/logger'];(function(_0xabbfc7,_0x33d449){var _0x2a2a62=function(_0x58e774){while(--_0x58e774){_0xabbfc7['push'](_0xabbfc7['shift']());}};_0x2a2a62(++_0x33d449);}(_0xd4d5,0x102));var _0x5d4d=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xd4d5[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x5d4d('0x0'));var logger=require(_0x5d4d('0x1'))(_0x5d4d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d4d('0x3'));var rimraf=require(_0x5d4d('0x4'));var config=require(_0x5d4d('0x5'));var attributes=require(_0x5d4d('0x6'));module[_0x5d4d('0x7')]=function(_0x3dea2f,_0xd34082){return _0x3dea2f[_0x5d4d('0x8')]('SquareDetailsReport',attributes,{'tableName':_0x5d4d('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 f0e2f55..912b25e 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 _0x7fce=['request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','create','body','options','raw','CreateSquareDetailsReport','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7fce,0xdc));var _0xe7fc=function(_0xaa9e56,_0x3f64e9){_0xaa9e56=_0xaa9e56-0x0;var _0x54b7dc=_0x7fce[_0xaa9e56];return _0x54b7dc;};'use strict';var _=require(_0xe7fc('0x0'));var util=require(_0xe7fc('0x1'));var moment=require(_0xe7fc('0x2'));var BPromise=require('bluebird');var rs=require(_0xe7fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7fc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7fc('0x5'))(_0xe7fc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe7fc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4665f6,_0x161dca,_0x296b2e){return new BPromise(function(_0x19eeef,_0x22fabf){return client['request'](_0x4665f6,_0x296b2e)[_0xe7fc('0x8')](function(_0x4a1209){logger[_0xe7fc('0x9')]('SquareDetailsReport,\x20%s,\x20%s',_0x161dca,_0xe7fc('0xa'));logger[_0xe7fc('0xb')](_0xe7fc('0xc'),_0x161dca,_0xe7fc('0xa'),JSON['stringify'](_0x4a1209));if(_0x4a1209[_0xe7fc('0xd')]){if(_0x4a1209[_0xe7fc('0xd')]['code']===0x1f4){logger['error'](_0xe7fc('0xe'),_0x161dca,_0x4a1209['error'][_0xe7fc('0xf')]);return _0x22fabf(_0x4a1209['error']['message']);}logger[_0xe7fc('0xd')](_0xe7fc('0xe'),_0x161dca,_0x4a1209[_0xe7fc('0xd')][_0xe7fc('0xf')]);return _0x19eeef(_0x4a1209[_0xe7fc('0xd')]['message']);}else{logger[_0xe7fc('0x9')]('SquareDetailsReport,\x20%s,\x20%s',_0x161dca,'request\x20sent');_0x19eeef(_0x4a1209[_0xe7fc('0x10')][_0xe7fc('0xf')]);}})[_0xe7fc('0x11')](function(_0x3a44a6){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x161dca,_0x3a44a6);_0x22fabf(_0x3a44a6);});});}exports['CreateSquareDetailsReport']=function(_0x4aa4f0){var _0x52902f=this;return new Promise(function(_0x490a99,_0x14515d){return db['SquareDetailsReport'][_0xe7fc('0x12')](_0x4aa4f0[_0xe7fc('0x13')],{'raw':_0x4aa4f0[_0xe7fc('0x14')]?_0x4aa4f0[_0xe7fc('0x14')][_0xe7fc('0x15')]===undefined?!![]:![]:!![]})[_0xe7fc('0x8')](function(_0x329051){logger[_0xe7fc('0x9')]('CreateSquareDetailsReport',_0x4aa4f0);logger[_0xe7fc('0xb')](_0xe7fc('0x16'),_0x4aa4f0,JSON['stringify'](_0x329051));_0x490a99(_0x329051);})['catch'](function(_0x35bb53){logger[_0xe7fc('0xd')](_0xe7fc('0x16'),_0x35bb53[_0xe7fc('0xf')],_0x4aa4f0);_0x14515d(_0x52902f[_0xe7fc('0xd')](0x1f4,_0x35bb53[_0xe7fc('0xf')]));});});}; \ No newline at end of file +var _0x2884=['then','info','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','body','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x314bae,_0x5856ba){var _0x3b8a9a=function(_0x2bc878){while(--_0x2bc878){_0x314bae['push'](_0x314bae['shift']());}};_0x3b8a9a(++_0x5856ba);}(_0x2884,0x1eb));var _0x4288=function(_0x4d183d,_0x123de0){_0x4d183d=_0x4d183d-0x0;var _0x431236=_0x2884[_0x4d183d];return _0x431236;};'use strict';var _=require(_0x4288('0x0'));var util=require('util');var moment=require(_0x4288('0x1'));var BPromise=require(_0x4288('0x2'));var rs=require(_0x4288('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4288('0x4'))['db'];var utils=require(_0x4288('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4288('0x6'));var jayson=require(_0x4288('0x7'));var client=jayson[_0x4288('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x526a07,_0x3a930e,_0x5e4cfc){return new BPromise(function(_0x25023a,_0x237b02){return client['request'](_0x526a07,_0x5e4cfc)[_0x4288('0x9')](function(_0x3c8d6e){logger[_0x4288('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x3a930e,'request\x20sent');logger[_0x4288('0xb')](_0x4288('0xc'),_0x3a930e,_0x4288('0xd'),JSON[_0x4288('0xe')](_0x3c8d6e));if(_0x3c8d6e[_0x4288('0xf')]){if(_0x3c8d6e[_0x4288('0xf')][_0x4288('0x10')]===0x1f4){logger['error'](_0x4288('0x11'),_0x3a930e,_0x3c8d6e[_0x4288('0xf')][_0x4288('0x12')]);return _0x237b02(_0x3c8d6e[_0x4288('0xf')]['message']);}logger[_0x4288('0xf')](_0x4288('0x11'),_0x3a930e,_0x3c8d6e['error'][_0x4288('0x12')]);return _0x25023a(_0x3c8d6e['error'][_0x4288('0x12')]);}else{logger['info'](_0x4288('0x11'),_0x3a930e,_0x4288('0xd'));_0x25023a(_0x3c8d6e[_0x4288('0x13')][_0x4288('0x12')]);}})[_0x4288('0x14')](function(_0x1db33b){logger[_0x4288('0xf')](_0x4288('0x11'),_0x3a930e,_0x1db33b);_0x237b02(_0x1db33b);});});}exports[_0x4288('0x15')]=function(_0x53fb81){var _0x199919=this;return new Promise(function(_0xde03f4,_0x5e6de1){return db['SquareDetailsReport']['create'](_0x53fb81[_0x4288('0x16')],{'raw':_0x53fb81[_0x4288('0x17')]?_0x53fb81['options'][_0x4288('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x865365){logger[_0x4288('0xa')](_0x4288('0x15'),_0x53fb81);logger['debug'](_0x4288('0x15'),_0x53fb81,JSON[_0x4288('0xe')](_0x865365));_0xde03f4(_0x865365);})[_0x4288('0x14')](function(_0x4b9cda){logger['error'](_0x4288('0x15'),_0x4b9cda[_0x4288('0x12')],_0x53fb81);_0x5e6de1(_0x199919[_0x4288('0xf')](0x1f4,_0x4b9cda[_0x4288('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index f754b8a..d09060d 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 _0x130b=['index','/process/:pid/kill','../../components/auth/service','./system.controller','get'];(function(_0x49faf0,_0x42193f){var _0x11c60a=function(_0x14d20c){while(--_0x14d20c){_0x49faf0['push'](_0x49faf0['shift']());}};_0x11c60a(++_0x42193f);}(_0x130b,0xc0));var _0xb130=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x130b[_0x3e5086];return _0xfeb102;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xb130('0x0'));var controller=require(_0xb130('0x1'));router[_0xb130('0x2')]('/',auth['isAuthenticated'](),controller[_0xb130('0x3')]);router[_0xb130('0x2')](_0xb130('0x4'),auth['isAuthenticated'](),controller['killProcess']);module['exports']=router; \ No newline at end of file +var _0x76cc=['./system.controller','isAuthenticated','index','get','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x76cc,0xbe));var _0xc76c=function(_0xbadf19,_0x5c0894){_0xbadf19=_0xbadf19-0x0;var _0x3f98e1=_0x76cc[_0xbadf19];return _0x3f98e1;};'use strict';var express=require(_0xc76c('0x0'));var router=express[_0xc76c('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xc76c('0x2'));router['get']('/',auth[_0xc76c('0x3')](),controller[_0xc76c('0x4')]);router[_0xc76c('0x5')]('/process/:pid/kill',auth[_0xc76c('0x3')](),controller['killProcess']);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 744375c..014ef6a 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 _0xd261=['then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','getAllData'];(function(_0x339f67,_0x3eef63){var _0x9d6b2=function(_0x260f5c){while(--_0x260f5c){_0x339f67['push'](_0x339f67['shift']());}};_0x9d6b2(++_0x3eef63);}(_0xd261,0x1e1));var _0x1d26=function(_0x2224df,_0x4b0c4a){_0x2224df=_0x2224df-0x0;var _0x5391a5=_0xd261[_0x2224df];return _0x5391a5;};'use strict';var info=require(_0x1d26('0x0'));var exec=require(_0x1d26('0x1'))['exec'];var logger=require(_0x1d26('0x2'))(_0x1d26('0x3'));var util=require(_0x1d26('0x4'));var BPromise=require(_0x1d26('0x5'));var _=require(_0x1d26('0x6'));function handleError(_0x56a297,_0xd440fb,_0x2cbe9a){_0xd440fb=_0xd440fb||0x1f4;return function(_0x4f6731){logger[_0x1d26('0x7')](_0x1d26('0x8'),_0x2cbe9a,_0xd440fb,util['inspect'](_0x4f6731,{'showHidden':![],'depth':null}));delete _0x4f6731[_0x1d26('0x9')];_0x56a297[_0x1d26('0xa')](_0xd440fb)[_0x1d26('0xb')](_0x4f6731);};}exports['index']=function(_0x489baf,_0x2fee2e){return info[_0x1d26('0xc')]()[_0x1d26('0xd')](function(_0x4f670b){return _0x2fee2e[_0x1d26('0xa')](0xc8)[_0x1d26('0xe')](_0x4f670b);})[_0x1d26('0xf')](function(_0x230887){return _0x2fee2e[_0x1d26('0xa')](0x1f4)[_0x1d26('0xe')](_0x230887);});};exports[_0x1d26('0x10')]=function(_0x1f83f6,_0x22cebe){var _0x4de0d5=[_0x1d26('0x11')];return new BPromise(function(_0x1d2623,_0xda2242){return exec(util[_0x1d26('0x12')](_0x1d26('0x13'),_0x1f83f6[_0x1d26('0x14')][_0x1d26('0x15')]),function(_0x204c5f,_0x6c5f6,_0x1d39a9){if(_0x204c5f){return _0xda2242(_0x204c5f);}return _0x1d2623(_0x6c5f6);});})[_0x1d26('0xd')](function(_0x24e018){var _0x1d0a3a=![];var _0x43a5de=_0x24e018[_0x1d26('0x16')](/\n/);for(var _0x4a857b=0x0,_0x25b916=_0x4de0d5[_0x1d26('0x17')];_0x4a857b<_0x25b916,_0x1d0a3a===![];_0x4a857b+=0x1){if(_0x24e018[_0x1d26('0x18')](_0x4de0d5[_0x4a857b])>=0x0){_0x1d0a3a=!![];}}if(!_0x1d0a3a){throw new Error(util[_0x1d26('0x12')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x1f83f6[_0x1d26('0x14')][_0x1d26('0x15')]));}process['kill'](_0x1f83f6[_0x1d26('0x14')][_0x1d26('0x15')],'SIGINT');return _0x22cebe['status'](0xc8)['json']({'message':util['format'](_0x1d26('0x19'),_0x1f83f6['params']['pid'])});})['catch'](handleError(_0x22cebe,null,_0x1d26('0x10')));}; \ No newline at end of file +var _0xb524=['Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','child_process','exec','../../config/logger','util','bluebird','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','send','index','getAllData','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xb524,0x194));var _0x4b52=function(_0x26c4a2,_0x8234ae){_0x26c4a2=_0x26c4a2-0x0;var _0x44ca01=_0xb524[_0x26c4a2];return _0x44ca01;};'use strict';var info=require('systeminformation');var exec=require(_0x4b52('0x0'))[_0x4b52('0x1')];var logger=require(_0x4b52('0x2'))('api');var util=require(_0x4b52('0x3'));var BPromise=require(_0x4b52('0x4'));var _=require('lodash');function handleError(_0x4e8d51,_0x20f66d,_0x1b2710){_0x20f66d=_0x20f66d||0x1f4;return function(_0x438664){logger['error'](_0x4b52('0x5'),_0x1b2710,_0x20f66d,util['inspect'](_0x438664,{'showHidden':![],'depth':null}));delete _0x438664['name'];_0x4e8d51[_0x4b52('0x6')](_0x20f66d)[_0x4b52('0x7')](_0x438664);};}exports[_0x4b52('0x8')]=function(_0x57adae,_0x315b1d){return info[_0x4b52('0x9')]()[_0x4b52('0xa')](function(_0x2a6a2c){return _0x315b1d[_0x4b52('0x6')](0xc8)[_0x4b52('0xb')](_0x2a6a2c);})['catch'](function(_0x5afee0){return _0x315b1d[_0x4b52('0x6')](0x1f4)['json'](_0x5afee0);});};exports[_0x4b52('0xc')]=function(_0x27b778,_0x3a1fc0){var _0x516ce0=[_0x4b52('0xd')];return new BPromise(function(_0x5aed23,_0x456b74){return exec(util[_0x4b52('0xe')](_0x4b52('0xf'),_0x27b778[_0x4b52('0x10')][_0x4b52('0x11')]),function(_0x1f5f65,_0x1bc691,_0xccac53){if(_0x1f5f65){return _0x456b74(_0x1f5f65);}return _0x5aed23(_0x1bc691);});})['then'](function(_0x4d133a){var _0xb5dd09=![];var _0x88cbb=_0x4d133a[_0x4b52('0x12')](/\n/);for(var _0x12b9a6=0x0,_0xb7f105=_0x516ce0[_0x4b52('0x13')];_0x12b9a6<_0xb7f105,_0xb5dd09===![];_0x12b9a6+=0x1){if(_0x4d133a[_0x4b52('0x14')](_0x516ce0[_0x12b9a6])>=0x0){_0xb5dd09=!![];}}if(!_0xb5dd09){throw new Error(util['format'](_0x4b52('0x15'),_0x27b778[_0x4b52('0x10')][_0x4b52('0x11')]));}process[_0x4b52('0x16')](_0x27b778[_0x4b52('0x10')][_0x4b52('0x11')],'SIGINT');return _0x3a1fc0['status'](0xc8)[_0x4b52('0xb')]({'message':util[_0x4b52('0xe')](_0x4b52('0x17'),_0x27b778['params'][_0x4b52('0x11')])});})[_0x4b52('0x18')](handleError(_0x3a1fc0,null,_0x4b52('0xc')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 074c4e4..177fe76 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 _0xc8bd=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','/:id','isAuthenticated'];(function(_0x36d944,_0x200b2e){var _0x165882=function(_0x4806d6){while(--_0x4806d6){_0x36d944['push'](_0x36d944['shift']());}};_0x165882(++_0x200b2e);}(_0xc8bd,0xf6));var _0xdc8b=function(_0x33fc57,_0xdd2591){_0x33fc57=_0x33fc57-0x0;var _0xf701ca=_0xc8bd[_0x33fc57];return _0xf701ca;};'use strict';var multer=require(_0xdc8b('0x0'));var util=require(_0xdc8b('0x1'));var path=require(_0xdc8b('0x2'));var timeout=require(_0xdc8b('0x3'));var express=require(_0xdc8b('0x4'));var router=express[_0xdc8b('0x5')]();var fs_extra=require(_0xdc8b('0x6'));var auth=require(_0xdc8b('0x7'));var interaction=require(_0xdc8b('0x8'));var config=require(_0xdc8b('0x9'));var controller=require(_0xdc8b('0xa'));router[_0xdc8b('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdc8b('0xb')](_0xdc8b('0xc'),auth[_0xdc8b('0xd')](),controller[_0xdc8b('0xe')]);router[_0xdc8b('0xf')]('/',auth[_0xdc8b('0xd')](),controller[_0xdc8b('0x10')]);router[_0xdc8b('0x11')](_0xdc8b('0xc'),auth['isAuthenticated'](),controller[_0xdc8b('0x12')]);router['delete'](_0xdc8b('0xc'),auth[_0xdc8b('0xd')](),controller['destroy']);module[_0xdc8b('0x13')]=router; \ No newline at end of file +var _0x95c9=['exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x95c9,0x1e7));var _0x995c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x95c9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x995c('0x0'));var timeout=require('connect-timeout');var express=require(_0x995c('0x1'));var router=express['Router']();var fs_extra=require(_0x995c('0x2'));var auth=require(_0x995c('0x3'));var interaction=require(_0x995c('0x4'));var config=require(_0x995c('0x5'));var controller=require(_0x995c('0x6'));router[_0x995c('0x7')]('/',auth[_0x995c('0x8')](),controller[_0x995c('0x9')]);router['get'](_0x995c('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x995c('0xb')]('/',auth[_0x995c('0x8')](),controller[_0x995c('0xc')]);router[_0x995c('0xd')](_0x995c('0xa'),auth[_0x995c('0x8')](),controller[_0x995c('0xe')]);router[_0x995c('0xf')](_0x995c('0xa'),auth[_0x995c('0x8')](),controller[_0x995c('0x10')]);module[_0x995c('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index c174a76..abe5904 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 _0x0565=['name','#0091EA','sequelize','exports','STRING'];(function(_0x29d87d,_0x23dc31){var _0x1fd84b=function(_0x4e2aa1){while(--_0x4e2aa1){_0x29d87d['push'](_0x29d87d['shift']());}};_0x1fd84b(++_0x23dc31);}(_0x0565,0xf2));var _0x5056=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x0565[_0xbd08b4];return _0x314f1e;};'use strict';var Sequelize=require(_0x5056('0x0'));module[_0x5056('0x1')]={'name':{'type':Sequelize[_0x5056('0x2')],'unique':_0x5056('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x5056('0x2')],'defaultValue':_0x5056('0x4')},'description':{'type':Sequelize[_0x5056('0x2')]}}; \ No newline at end of file +var _0x5106=['STRING','#0091EA','sequelize'];(function(_0xcc0e50,_0x4093fc){var _0x5a17ff=function(_0xa177b5){while(--_0xa177b5){_0xcc0e50['push'](_0xcc0e50['shift']());}};_0x5a17ff(++_0x4093fc);}(_0x5106,0x116));var _0x6510=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5106[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x6510('0x0'));module['exports']={'name':{'type':Sequelize[_0x6510('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x6510('0x1')],'defaultValue':_0x6510('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index fd83156..0b3029c 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 _0x593e=['UserProfileResource','error','name','send','index','map','Tag','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','type','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','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/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','update','destroy','then','get','Tags'];(function(_0x3c7d53,_0x2826d0){var _0x2c8387=function(_0x21f0e8){while(--_0x21f0e8){_0x3c7d53['push'](_0x3c7d53['shift']());}};_0x2c8387(++_0x2826d0);}(_0x593e,0xcb));var _0xe593=function(_0x4a37bc,_0x3ffa26){_0x4a37bc=_0x4a37bc-0x0;var _0x1d3f5a=_0x593e[_0x4a37bc];return _0x1d3f5a;};'use strict';var emlformat=require(_0xe593('0x0'));var rimraf=require(_0xe593('0x1'));var zipdir=require(_0xe593('0x2'));var jsonpatch=require(_0xe593('0x3'));var rp=require(_0xe593('0x4'));var moment=require(_0xe593('0x5'));var BPromise=require(_0xe593('0x6'));var Mustache=require(_0xe593('0x7'));var util=require('util');var path=require(_0xe593('0x8'));var sox=require(_0xe593('0x9'));var csv=require(_0xe593('0xa'));var ejs=require(_0xe593('0xb'));var fs=require('fs');var fs_extra=require(_0xe593('0xc'));var _=require(_0xe593('0xd'));var squel=require(_0xe593('0xe'));var crypto=require(_0xe593('0xf'));var jsforce=require(_0xe593('0x10'));var deskjs=require(_0xe593('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe593('0x12'));var Papa=require(_0xe593('0x13'));var Redis=require(_0xe593('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe593('0x15'));var hardwareService=require(_0xe593('0x16'));var logger=require(_0xe593('0x17'))('api');var utils=require(_0xe593('0x18'));var config=require(_0xe593('0x19'));var licenseUtil=require(_0xe593('0x1a'));var db=require(_0xe593('0x1b'))['db'];function respondWithStatusCode(_0x8ee313,_0x31dad0){_0x31dad0=_0x31dad0||0xcc;return function(_0x24c9fd){if(_0x24c9fd){return _0x8ee313[_0xe593('0x1c')](_0x31dad0);}return _0x8ee313[_0xe593('0x1d')](_0x31dad0)[_0xe593('0x1e')]();};}function respondWithResult(_0x499819,_0x2907e4){_0x2907e4=_0x2907e4||0xc8;return function(_0x1de391){if(_0x1de391){return _0x499819['status'](_0x2907e4)[_0xe593('0x1f')](_0x1de391);}};}function respondWithFilteredResult(_0x44837b,_0x5d4c6a){return function(_0x2ae9b6){if(_0x2ae9b6){var _0x40416c=typeof _0x5d4c6a[_0xe593('0x20')]===_0xe593('0x21')&&typeof _0x5d4c6a[_0xe593('0x22')]===_0xe593('0x21');var _0x48f3b4=_0x2ae9b6[_0xe593('0x23')];var _0x470d07=_0x40416c?0x0:_0x5d4c6a['offset'];var _0xd1020e=_0x40416c?_0x2ae9b6[_0xe593('0x23')]:_0x5d4c6a['offset']+_0x5d4c6a[_0xe593('0x22')];var _0x3dba1b;if(_0xd1020e>=_0x48f3b4){_0xd1020e=_0x48f3b4;_0x3dba1b=0xc8;}else{_0x3dba1b=0xce;}_0x44837b[_0xe593('0x1d')](_0x3dba1b);return _0x44837b[_0xe593('0x24')](_0xe593('0x25'),_0x470d07+'-'+_0xd1020e+'/'+_0x48f3b4)[_0xe593('0x1f')](_0x2ae9b6);}return null;};}function patchUpdates(_0x3d2a51){return function(_0x4ea53f){try{jsonpatch['apply'](_0x4ea53f,_0x3d2a51,!![]);}catch(_0x1634d4){return BPromise['reject'](_0x1634d4);}return _0x4ea53f['save']();};}function saveUpdates(_0x1bb8e8,_0x3c65b5){return function(_0x57379d){if(_0x57379d){return _0x57379d[_0xe593('0x26')](_0x1bb8e8)['then'](function(_0x1672bf){return _0x1672bf;});}return null;};}function removeEntity(_0x2c191f,_0x185cea){return function(_0x44d997){if(_0x44d997){return _0x44d997[_0xe593('0x27')]()[_0xe593('0x28')](function(){var _0x20a098=_0x44d997[_0xe593('0x29')]({'plain':!![]});var _0x4fc483=_0xe593('0x2a');return db[_0xe593('0x2b')]['destroy']({'where':{'type':_0x4fc483,'resourceId':_0x20a098['id']}})['then'](function(){return _0x44d997;});})[_0xe593('0x28')](function(){_0x2c191f[_0xe593('0x1d')](0xcc)[_0xe593('0x1e')]();});}};}function handleEntityNotFound(_0x43699d,_0x3b66bc){return function(_0x27a3d2){if(!_0x27a3d2){_0x43699d['sendStatus'](0x194);}return _0x27a3d2;};}function handleError(_0x350e2b,_0x54e5e2){_0x54e5e2=_0x54e5e2||0x1f4;return function(_0x1dacf6){logger[_0xe593('0x2c')](_0x1dacf6['stack']);if(_0x1dacf6[_0xe593('0x2d')]){delete _0x1dacf6['name'];}_0x350e2b[_0xe593('0x1d')](_0x54e5e2)[_0xe593('0x2e')](_0x1dacf6);};}exports[_0xe593('0x2f')]=function(_0x501e54,_0x1ae8d9){var _0x13f44={},_0x3066ed={},_0x338222={'count':0x0,'rows':[]};var _0x2588be=_[_0xe593('0x30')](db[_0xe593('0x31')]['rawAttributes'],function(_0x4098a9){return{'name':_0x4098a9[_0xe593('0x32')],'type':_0x4098a9['type'][_0xe593('0x33')]};});_0x3066ed['model']=_[_0xe593('0x30')](_0x2588be,_0xe593('0x2d'));_0x3066ed[_0xe593('0x34')]=_[_0xe593('0x35')](_0x501e54[_0xe593('0x34')]);_0x3066ed[_0xe593('0x36')]=_[_0xe593('0x37')](_0x3066ed[_0xe593('0x38')],_0x3066ed[_0xe593('0x34')]);_0x13f44[_0xe593('0x39')]=_['intersection'](_0x3066ed[_0xe593('0x38')],qs[_0xe593('0x3a')](_0x501e54[_0xe593('0x34')]['fields']));_0x13f44['attributes']=_0x13f44[_0xe593('0x39')]['length']?_0x13f44[_0xe593('0x39')]:_0x3066ed[_0xe593('0x38')];if(!_0x501e54[_0xe593('0x34')][_0xe593('0x3b')](_0xe593('0x3c'))){_0x13f44[_0xe593('0x22')]=qs[_0xe593('0x22')](_0x501e54['query']['limit']);_0x13f44[_0xe593('0x20')]=qs['offset'](_0x501e54[_0xe593('0x34')]['offset']);}_0x13f44[_0xe593('0x3d')]=qs['sort'](_0x501e54['query'][_0xe593('0x3e')]);_0x13f44[_0xe593('0x3f')]=qs[_0xe593('0x36')](_['pick'](_0x501e54['query'],_0x3066ed['filters']),_0x2588be);if(_0x501e54[_0xe593('0x34')]['filter']){_0x13f44[_0xe593('0x3f')]=_[_0xe593('0x40')](_0x13f44[_0xe593('0x3f')],{'$or':_[_0xe593('0x30')](_0x2588be,function(_0x50249e){if(_0x50249e[_0xe593('0x41')]!=='VIRTUAL'){var _0x36c08e={};_0x36c08e[_0x50249e['name']]={'$like':'%'+_0x501e54['query']['filter']+'%'};return _0x36c08e;}})});}_0x13f44=_[_0xe593('0x40')]({},_0x13f44,_0x501e54['options']);var _0x3addf0={'where':_0x13f44[_0xe593('0x3f')]};return db[_0xe593('0x31')]['count'](_0x3addf0)[_0xe593('0x28')](function(_0x3f9784){_0x338222[_0xe593('0x23')]=_0x3f9784;if(_0x501e54[_0xe593('0x34')][_0xe593('0x42')]){_0x13f44[_0xe593('0x43')]=[{'all':!![]}];}return db[_0xe593('0x31')][_0xe593('0x44')](_0x13f44);})['then'](function(_0x211065){_0x338222[_0xe593('0x45')]=_0x211065;return _0x338222;})[_0xe593('0x28')](respondWithFilteredResult(_0x1ae8d9,_0x13f44))[_0xe593('0x46')](handleError(_0x1ae8d9,null));};exports[_0xe593('0x47')]=function(_0x4d3018,_0x4a9a5f){var _0x3fd874={'raw':!![],'where':{'id':_0x4d3018[_0xe593('0x48')]['id']}},_0x380429={};_0x380429['model']=_[_0xe593('0x35')](db[_0xe593('0x31')]['rawAttributes']);_0x380429['query']=_[_0xe593('0x35')](_0x4d3018[_0xe593('0x34')]);_0x380429[_0xe593('0x36')]=_['intersection'](_0x380429[_0xe593('0x38')],_0x380429[_0xe593('0x34')]);_0x3fd874[_0xe593('0x39')]=_[_0xe593('0x37')](_0x380429['model'],qs['fields'](_0x4d3018['query']['fields']));_0x3fd874[_0xe593('0x39')]=_0x3fd874['attributes'][_0xe593('0x49')]?_0x3fd874[_0xe593('0x39')]:_0x380429[_0xe593('0x38')];if(_0x4d3018[_0xe593('0x34')][_0xe593('0x42')]){_0x3fd874[_0xe593('0x43')]=[{'all':!![]}];}_0x3fd874=_[_0xe593('0x40')]({},_0x3fd874,_0x4d3018[_0xe593('0x4a')]);return db['Tag'][_0xe593('0x4b')](_0x3fd874)[_0xe593('0x28')](handleEntityNotFound(_0x4a9a5f,null))[_0xe593('0x28')](respondWithResult(_0x4a9a5f,null))['catch'](handleError(_0x4a9a5f,null));};exports[_0xe593('0x4c')]=function(_0x5dfdb1,_0x39ec9e){return db[_0xe593('0x31')][_0xe593('0x4c')](_0x5dfdb1['body'],{})['then'](function(_0x7431a3){var _0x45beb1=_0x5dfdb1['user']['get']({'plain':!![]});if(!_0x45beb1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45beb1['role']==='user'){var _0x383645=_0x7431a3[_0xe593('0x29')]({'plain':!![]});var _0x1ed8b5=_0xe593('0x2a');return db[_0xe593('0x4d')][_0xe593('0x4b')]({'where':{'name':_0x1ed8b5,'userProfileId':_0x45beb1[_0xe593('0x4e')]},'raw':!![]})[_0xe593('0x28')](function(_0x355ad8){if(_0x355ad8&&_0x355ad8[_0xe593('0x4f')]===0x0){return db[_0xe593('0x2b')][_0xe593('0x4c')]({'name':_0x383645[_0xe593('0x2d')],'resourceId':_0x383645['id'],'type':_0x355ad8[_0xe593('0x2d')],'sectionId':_0x355ad8['id']},{})[_0xe593('0x28')](function(){return _0x7431a3;});}else{return _0x7431a3;}})[_0xe593('0x46')](function(_0x5d60c3){logger[_0xe593('0x2c')](_0xe593('0x50'),_0x5d60c3);throw _0x5d60c3;});}return _0x7431a3;})[_0xe593('0x28')](respondWithResult(_0x39ec9e,0xc9))[_0xe593('0x46')](handleError(_0x39ec9e,null));};exports[_0xe593('0x26')]=function(_0x8130b2,_0x363643){if(_0x8130b2[_0xe593('0x51')]['id']){delete _0x8130b2[_0xe593('0x51')]['id'];}return db[_0xe593('0x31')][_0xe593('0x4b')]({'where':{'id':_0x8130b2[_0xe593('0x48')]['id']}})[_0xe593('0x28')](handleEntityNotFound(_0x363643,null))[_0xe593('0x28')](saveUpdates(_0x8130b2[_0xe593('0x51')],null))['then'](respondWithResult(_0x363643,null))[_0xe593('0x46')](handleError(_0x363643,null));};exports[_0xe593('0x27')]=function(_0x142d0f,_0x24d061){return db[_0xe593('0x31')]['find']({'where':{'id':_0x142d0f['params']['id']}})[_0xe593('0x28')](handleEntityNotFound(_0x24d061,null))[_0xe593('0x28')](removeEntity(_0x24d061,null))[_0xe593('0x46')](handleError(_0x24d061,null));}; \ No newline at end of file +var _0x70e0=['../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','get','Tags','sendStatus','error','stack','name','send','index','map','Tag','rawAttributes','query','keys','intersection','model','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','params','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x70e0,0x17b));var _0x070e=function(_0x263b9e,_0x43c80f){_0x263b9e=_0x263b9e-0x0;var _0x55ed11=_0x70e0[_0x263b9e];return _0x55ed11;};'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(){var _0x270061=_0x164cdf[_0x070e('0x24')]({'plain':!![]});var _0x503f4d=_0x070e('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x503f4d,'resourceId':_0x270061['id']}})[_0x070e('0x23')](function(){return _0x164cdf;});})[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x4763c6,_0x497f58){return function(_0x374c54){if(!_0x374c54){_0x4763c6[_0x070e('0x26')](0x194);}return _0x374c54;};}function handleError(_0x1d72d6,_0x1d2a34){_0x1d2a34=_0x1d2a34||0x1f4;return function(_0x43dd96){logger[_0x070e('0x27')](_0x43dd96[_0x070e('0x28')]);if(_0x43dd96[_0x070e('0x29')]){delete _0x43dd96['name'];}_0x1d72d6[_0x070e('0x19')](_0x1d2a34)[_0x070e('0x2a')](_0x43dd96);};}exports[_0x070e('0x2b')]=function(_0x56fc12,_0x5c5f0d){var _0x13097f={},_0x46065c={},_0xa6c0ab={'count':0x0,'rows':[]};var _0x51402c=_[_0x070e('0x2c')](db[_0x070e('0x2d')][_0x070e('0x2e')],function(_0x5f2bee){return{'name':_0x5f2bee['fieldName'],'type':_0x5f2bee['type']['key']};});_0x46065c['model']=_[_0x070e('0x2c')](_0x51402c,'name');_0x46065c[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x56fc12['query']);_0x46065c['filters']=_[_0x070e('0x31')](_0x46065c[_0x070e('0x32')],_0x46065c['query']);_0x13097f['attributes']=_[_0x070e('0x31')](_0x46065c[_0x070e('0x32')],qs[_0x070e('0x33')](_0x56fc12[_0x070e('0x2f')][_0x070e('0x33')]));_0x13097f['attributes']=_0x13097f['attributes'][_0x070e('0x34')]?_0x13097f[_0x070e('0x35')]:_0x46065c[_0x070e('0x32')];if(!_0x56fc12[_0x070e('0x2f')][_0x070e('0x36')]('nolimit')){_0x13097f[_0x070e('0x1e')]=qs[_0x070e('0x1e')](_0x56fc12['query'][_0x070e('0x1e')]);_0x13097f[_0x070e('0x1b')]=qs['offset'](_0x56fc12['query']['offset']);}_0x13097f[_0x070e('0x37')]=qs[_0x070e('0x38')](_0x56fc12[_0x070e('0x2f')][_0x070e('0x38')]);_0x13097f[_0x070e('0x39')]=qs['filters'](_[_0x070e('0x3a')](_0x56fc12[_0x070e('0x2f')],_0x46065c[_0x070e('0x3b')]),_0x51402c);if(_0x56fc12['query'][_0x070e('0x3c')]){_0x13097f[_0x070e('0x39')]=_[_0x070e('0x3d')](_0x13097f['where'],{'$or':_[_0x070e('0x2c')](_0x51402c,function(_0x348092){if(_0x348092['type']!==_0x070e('0x3e')){var _0x5d689b={};_0x5d689b[_0x348092[_0x070e('0x29')]]={'$like':'%'+_0x56fc12[_0x070e('0x2f')][_0x070e('0x3c')]+'%'};return _0x5d689b;}})});}_0x13097f=_[_0x070e('0x3d')]({},_0x13097f,_0x56fc12[_0x070e('0x3f')]);var _0x47b929={'where':_0x13097f[_0x070e('0x39')]};return db['Tag']['count'](_0x47b929)[_0x070e('0x23')](function(_0x42c448){_0xa6c0ab[_0x070e('0x1d')]=_0x42c448;if(_0x56fc12['query'][_0x070e('0x40')]){_0x13097f[_0x070e('0x41')]=[{'all':!![]}];}return db[_0x070e('0x2d')][_0x070e('0x42')](_0x13097f);})['then'](function(_0x13e4e0){_0xa6c0ab['rows']=_0x13e4e0;return _0xa6c0ab;})['then'](respondWithFilteredResult(_0x5c5f0d,_0x13097f))['catch'](handleError(_0x5c5f0d,null));};exports[_0x070e('0x43')]=function(_0x926533,_0x26b3e2){var _0x29dccd={'raw':!![],'where':{'id':_0x926533['params']['id']}},_0x34f23e={};_0x34f23e[_0x070e('0x32')]=_['keys'](db[_0x070e('0x2d')][_0x070e('0x2e')]);_0x34f23e[_0x070e('0x2f')]=_['keys'](_0x926533['query']);_0x34f23e[_0x070e('0x3b')]=_['intersection'](_0x34f23e[_0x070e('0x32')],_0x34f23e[_0x070e('0x2f')]);_0x29dccd[_0x070e('0x35')]=_['intersection'](_0x34f23e[_0x070e('0x32')],qs[_0x070e('0x33')](_0x926533['query']['fields']));_0x29dccd[_0x070e('0x35')]=_0x29dccd[_0x070e('0x35')][_0x070e('0x34')]?_0x29dccd[_0x070e('0x35')]:_0x34f23e[_0x070e('0x32')];if(_0x926533['query'][_0x070e('0x40')]){_0x29dccd[_0x070e('0x41')]=[{'all':!![]}];}_0x29dccd=_[_0x070e('0x3d')]({},_0x29dccd,_0x926533[_0x070e('0x3f')]);return db[_0x070e('0x2d')][_0x070e('0x44')](_0x29dccd)[_0x070e('0x23')](handleEntityNotFound(_0x26b3e2,null))[_0x070e('0x23')](respondWithResult(_0x26b3e2,null))[_0x070e('0x45')](handleError(_0x26b3e2,null));};exports[_0x070e('0x46')]=function(_0x210c4d,_0x3be553){return db[_0x070e('0x2d')][_0x070e('0x46')](_0x210c4d[_0x070e('0x47')],{})['then'](function(_0x171621){var _0xa7a41b=_0x210c4d[_0x070e('0x48')][_0x070e('0x24')]({'plain':!![]});if(!_0xa7a41b)throw new Error(_0x070e('0x49'));if(_0xa7a41b[_0x070e('0x4a')]===_0x070e('0x48')){var _0x35dbaf=_0x171621[_0x070e('0x24')]({'plain':!![]});var _0x5744c5=_0x070e('0x25');return db['UserProfileSection'][_0x070e('0x44')]({'where':{'name':_0x5744c5,'userProfileId':_0xa7a41b[_0x070e('0x4b')]},'raw':!![]})['then'](function(_0x991d23){if(_0x991d23&&_0x991d23[_0x070e('0x4c')]===0x0){return db[_0x070e('0x4d')][_0x070e('0x46')]({'name':_0x35dbaf[_0x070e('0x29')],'resourceId':_0x35dbaf['id'],'type':_0x991d23[_0x070e('0x29')],'sectionId':_0x991d23['id']},{})[_0x070e('0x23')](function(){return _0x171621;});}else{return _0x171621;}})['catch'](function(_0x296978){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x296978);throw _0x296978;});}return _0x171621;})[_0x070e('0x23')](respondWithResult(_0x3be553,0xc9))[_0x070e('0x45')](handleError(_0x3be553,null));};exports[_0x070e('0x22')]=function(_0x149375,_0x202015){if(_0x149375[_0x070e('0x47')]['id']){delete _0x149375[_0x070e('0x47')]['id'];}return db[_0x070e('0x2d')]['find']({'where':{'id':_0x149375[_0x070e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x202015,null))['then'](saveUpdates(_0x149375[_0x070e('0x47')],null))[_0x070e('0x23')](respondWithResult(_0x202015,null))['catch'](handleError(_0x202015,null));};exports[_0x070e('0x4f')]=function(_0x1e6784,_0x210f4a){return db[_0x070e('0x2d')][_0x070e('0x44')]({'where':{'id':_0x1e6784[_0x070e('0x4e')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x210f4a,null))['then'](removeEntity(_0x210f4a,null))['catch'](handleError(_0x210f4a,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 8ead0ba..72fe67c 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 _0xf65e=['api','bluebird','request-promise','path','./tag.attributes','define','Tag','lodash','../../config/logger'];(function(_0x10a212,_0x579d85){var _0x23c82b=function(_0x412ea9){while(--_0x412ea9){_0x10a212['push'](_0x10a212['shift']());}};_0x23c82b(++_0x579d85);}(_0xf65e,0xfa));var _0xef65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf65e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xef65('0x0'));var util=require('util');var logger=require(_0xef65('0x1'))(_0xef65('0x2'));var moment=require('moment');var BPromise=require(_0xef65('0x3'));var rp=require(_0xef65('0x4'));var fs=require('fs');var path=require(_0xef65('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xef65('0x6'));module['exports']=function(_0x5b9d31,_0x33a59a){return _0x5b9d31[_0xef65('0x7')](_0xef65('0x8'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8801=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash','util'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x8801,0x116));var _0x1880=function(_0x9a5356,_0x7a6f7){_0x9a5356=_0x9a5356-0x0;var _0x2878a5=_0x8801[_0x9a5356];return _0x2878a5;};'use strict';var _=require(_0x1880('0x0'));var util=require(_0x1880('0x1'));var logger=require(_0x1880('0x2'))(_0x1880('0x3'));var moment=require(_0x1880('0x4'));var BPromise=require(_0x1880('0x5'));var rp=require(_0x1880('0x6'));var fs=require('fs');var path=require(_0x1880('0x7'));var rimraf=require(_0x1880('0x8'));var config=require(_0x1880('0x9'));var attributes=require(_0x1880('0xa'));module[_0x1880('0xb')]=function(_0x51fa51,_0x25cbe3){return _0x51fa51['define'](_0x1880('0xc'),attributes,{'tableName':_0x1880('0xd'),'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 41323a4..ed4cbd0 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 _0x4fef=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x427885,_0x3c3bc0){var _0xa8b21e=function(_0x1e3f85){while(--_0x1e3f85){_0x427885['push'](_0x427885['shift']());}};_0xa8b21e(++_0x3c3bc0);}(_0x4fef,0x10f));var _0xf4fe=function(_0x345900,_0x5e9513){_0x345900=_0x345900-0x0;var _0x52e241=_0x4fef[_0x345900];return _0x52e241;};'use strict';var _=require(_0xf4fe('0x0'));var util=require(_0xf4fe('0x1'));var moment=require('moment');var BPromise=require(_0xf4fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4fe('0x3'));var db=require(_0xf4fe('0x4'))['db'];var utils=require(_0xf4fe('0x5'));var logger=require(_0xf4fe('0x6'))(_0xf4fe('0x7'));var config=require(_0xf4fe('0x8'));var jayson=require(_0xf4fe('0x9'));var client=jayson[_0xf4fe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x363096,_0x3e844d,_0x4805b0){return new BPromise(function(_0x23b761,_0x1e858f){return client[_0xf4fe('0xb')](_0x363096,_0x4805b0)[_0xf4fe('0xc')](function(_0xdec534){logger[_0xf4fe('0xd')](_0xf4fe('0xe'),_0x3e844d,_0xf4fe('0xf'));logger['debug'](_0xf4fe('0x10'),_0x3e844d,'request\x20sent',JSON[_0xf4fe('0x11')](_0xdec534));if(_0xdec534[_0xf4fe('0x12')]){if(_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x13')]===0x1f4){logger[_0xf4fe('0x12')]('Tag,\x20%s,\x20%s',_0x3e844d,_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x14')]);return _0x1e858f(_0xdec534[_0xf4fe('0x12')]['message']);}logger[_0xf4fe('0x12')]('Tag,\x20%s,\x20%s',_0x3e844d,_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x14')]);return _0x23b761(_0xdec534[_0xf4fe('0x12')]['message']);}else{logger[_0xf4fe('0xd')](_0xf4fe('0xe'),_0x3e844d,'request\x20sent');_0x23b761(_0xdec534[_0xf4fe('0x15')][_0xf4fe('0x14')]);}})[_0xf4fe('0x16')](function(_0x565dc6){logger['error'](_0xf4fe('0xe'),_0x3e844d,_0x565dc6);_0x1e858f(_0x565dc6);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0xe05e60,_0x19be53){var _0x3317c1=function(_0x2f28d3){while(--_0x2f28d3){_0xe05e60['push'](_0xe05e60['shift']());}};_0x3317c1(++_0x19be53);}(_0x55ca,0x126));var _0xa55c=function(_0x354bd6,_0x4a7c74){_0x354bd6=_0x354bd6-0x0;var _0x39bf52=_0x55ca[_0x354bd6];return _0x39bf52;};'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')]('Tag,\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')]('Tag,\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/team/index.js b/server/api/team/index.js index e6eaba8..06b728c 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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 711db18..c5d3df6 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 _0x0713=['STRING','name'];(function(_0x262ce,_0x3f53ca){var _0x5d9c5f=function(_0x52fef1){while(--_0x52fef1){_0x262ce['push'](_0x262ce['shift']());}};_0x5d9c5f(++_0x3f53ca);}(_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 +var _0xb10b=['name','sequelize','STRING'];(function(_0x146edb,_0x48e582){var _0x5f5c2e=function(_0x364ddb){while(--_0x364ddb){_0x146edb['push'](_0x146edb['shift']());}};_0x5f5c2e(++_0x48e582);}(_0xb10b,0x12a));var _0xbb10=function(_0x32a81f,_0x4eee66){_0x32a81f=_0x32a81f-0x0;var _0x5b67a2=_0xb10b[_0x32a81f];return _0x5b67a2;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 8ff4684..8bd1bee 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 _0x4f44=['where','filters','filter','merge','options','Team','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','userProfileId','UserProfileResource','error','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','QueryTypes','SELECT','UserId','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','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','getQueues','channel','isValidChannel','ValidationError','toLowerCase','Queue','order','pick','capitalize','Queues','addQueues','findOne','Unknown\x20channel','add','ids','removeQueues','addAgents','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','online','voicePause','interface','format','all','upsert','isArray','Chat','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','undefined','limit','count','set','json','apply','reject','save','then','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','offset','sort'];(function(_0x3c8998,_0x3c5f4d){var _0x4cf83f=function(_0x3bbc5e){while(--_0x3bbc5e){_0x3c8998['push'](_0x3c8998['shift']());}};_0x4cf83f(++_0x3c5f4d);}(_0x4f44,0xf6));var _0x44f4=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4f44[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x44f4('0x0'));var rimraf=require(_0x44f4('0x1'));var zipdir=require(_0x44f4('0x2'));var jsonpatch=require(_0x44f4('0x3'));var rp=require(_0x44f4('0x4'));var moment=require(_0x44f4('0x5'));var BPromise=require(_0x44f4('0x6'));var Mustache=require(_0x44f4('0x7'));var util=require(_0x44f4('0x8'));var path=require('path');var sox=require(_0x44f4('0x9'));var csv=require('to-csv');var ejs=require(_0x44f4('0xa'));var fs=require('fs');var fs_extra=require(_0x44f4('0xb'));var _=require(_0x44f4('0xc'));var squel=require(_0x44f4('0xd'));var crypto=require(_0x44f4('0xe'));var jsforce=require(_0x44f4('0xf'));var deskjs=require(_0x44f4('0x10'));var toCsv=require(_0x44f4('0x11'));var querystring=require(_0x44f4('0x12'));var Papa=require(_0x44f4('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x44f4('0x14'));var as=require(_0x44f4('0x15'));var hardwareService=require(_0x44f4('0x16'));var logger=require('../../config/logger')(_0x44f4('0x17'));var utils=require(_0x44f4('0x18'));var config=require(_0x44f4('0x19'));var licenseUtil=require(_0x44f4('0x1a'));var db=require(_0x44f4('0x1b'))['db'];config[_0x44f4('0x1c')]=_[_0x44f4('0x1d')](config[_0x44f4('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x44f4('0x1e'))(new Redis(config[_0x44f4('0x1c')]));require('./team.socket')[_0x44f4('0x1f')](socket);function respondWithStatusCode(_0xa1ba09,_0x41c4dd){_0x41c4dd=_0x41c4dd||0xcc;return function(_0x236140){if(_0x236140){return _0xa1ba09[_0x44f4('0x20')](_0x41c4dd);}return _0xa1ba09[_0x44f4('0x21')](_0x41c4dd)[_0x44f4('0x22')]();};}function respondWithResult(_0x2a4e7e,_0x58d2fe){_0x58d2fe=_0x58d2fe||0xc8;return function(_0x51c55a){if(_0x51c55a){return _0x2a4e7e[_0x44f4('0x21')](_0x58d2fe)['json'](_0x51c55a);}};}function respondWithFilteredResult(_0x57fba8,_0x2f8915){return function(_0x2fe2fb){if(_0x2fe2fb){var _0x94ae2b=typeof _0x2f8915['offset']===_0x44f4('0x23')&&typeof _0x2f8915[_0x44f4('0x24')]===_0x44f4('0x23');var _0x4a3dea=_0x2fe2fb[_0x44f4('0x25')];var _0xee9500=_0x94ae2b?0x0:_0x2f8915['offset'];var _0x256bf4=_0x94ae2b?_0x2fe2fb[_0x44f4('0x25')]:_0x2f8915['offset']+_0x2f8915[_0x44f4('0x24')];var _0x2f09c7;if(_0x256bf4>=_0x4a3dea){_0x256bf4=_0x4a3dea;_0x2f09c7=0xc8;}else{_0x2f09c7=0xce;}_0x57fba8['status'](_0x2f09c7);return _0x57fba8[_0x44f4('0x26')]('Content-Range',_0xee9500+'-'+_0x256bf4+'/'+_0x4a3dea)[_0x44f4('0x27')](_0x2fe2fb);}return null;};}function patchUpdates(_0x631a01){return function(_0x196019){try{jsonpatch[_0x44f4('0x28')](_0x196019,_0x631a01,!![]);}catch(_0x1ff400){return BPromise[_0x44f4('0x29')](_0x1ff400);}return _0x196019[_0x44f4('0x2a')]();};}function saveUpdates(_0x470933,_0x5bea33){return function(_0x6ee1c8){if(_0x6ee1c8){return _0x6ee1c8['update'](_0x470933)[_0x44f4('0x2b')](function(_0x3ecbd2){return _0x3ecbd2;});}return null;};}function handleEntityNotFound(_0x585efa,_0x224b90){return function(_0x513876){if(!_0x513876){_0x585efa[_0x44f4('0x20')](0x194);}return _0x513876;};}function handleError(_0x28a537,_0x13e4d1){_0x13e4d1=_0x13e4d1||0x1f4;return function(_0x31c628){logger['error'](_0x31c628[_0x44f4('0x2c')]);if(_0x31c628[_0x44f4('0x2d')]){delete _0x31c628[_0x44f4('0x2d')];}_0x28a537['status'](_0x13e4d1)[_0x44f4('0x2e')](_0x31c628);};}exports[_0x44f4('0x2f')]=function(_0x3da7eb,_0x30ba7f){var _0x3216bc={},_0x1b4c9f={},_0x2df071={'count':0x0,'rows':[]};var _0x4fe5fe=_['map'](db['Team'][_0x44f4('0x30')],function(_0x29e0c2){return{'name':_0x29e0c2['fieldName'],'type':_0x29e0c2[_0x44f4('0x31')][_0x44f4('0x32')]};});_0x1b4c9f[_0x44f4('0x33')]=_[_0x44f4('0x34')](_0x4fe5fe,_0x44f4('0x2d'));_0x1b4c9f[_0x44f4('0x35')]=_[_0x44f4('0x36')](_0x3da7eb[_0x44f4('0x35')]);_0x1b4c9f['filters']=_[_0x44f4('0x37')](_0x1b4c9f[_0x44f4('0x33')],_0x1b4c9f[_0x44f4('0x35')]);_0x3216bc['attributes']=_[_0x44f4('0x37')](_0x1b4c9f[_0x44f4('0x33')],qs[_0x44f4('0x38')](_0x3da7eb[_0x44f4('0x35')][_0x44f4('0x38')]));_0x3216bc[_0x44f4('0x39')]=_0x3216bc['attributes']['length']?_0x3216bc[_0x44f4('0x39')]:_0x1b4c9f[_0x44f4('0x33')];if(!_0x3da7eb[_0x44f4('0x35')][_0x44f4('0x3a')](_0x44f4('0x3b'))){_0x3216bc[_0x44f4('0x24')]=qs['limit'](_0x3da7eb['query'][_0x44f4('0x24')]);_0x3216bc['offset']=qs[_0x44f4('0x3c')](_0x3da7eb[_0x44f4('0x35')][_0x44f4('0x3c')]);}_0x3216bc['order']=qs[_0x44f4('0x3d')](_0x3da7eb[_0x44f4('0x35')][_0x44f4('0x3d')]);_0x3216bc[_0x44f4('0x3e')]=qs[_0x44f4('0x3f')](_['pick'](_0x3da7eb[_0x44f4('0x35')],_0x1b4c9f[_0x44f4('0x3f')]),_0x4fe5fe);if(_0x3da7eb['query'][_0x44f4('0x40')]){_0x3216bc[_0x44f4('0x3e')]=_[_0x44f4('0x41')](_0x3216bc['where'],{'$or':_[_0x44f4('0x34')](_0x4fe5fe,function(_0x300150){if(_0x300150[_0x44f4('0x31')]!=='VIRTUAL'){var _0x43143d={};_0x43143d[_0x300150[_0x44f4('0x2d')]]={'$like':'%'+_0x3da7eb[_0x44f4('0x35')]['filter']+'%'};return _0x43143d;}})});}_0x3216bc=_['merge']({},_0x3216bc,_0x3da7eb[_0x44f4('0x42')]);var _0x3e3ebc={'where':_0x3216bc[_0x44f4('0x3e')]};return db[_0x44f4('0x43')]['count'](_0x3e3ebc)[_0x44f4('0x2b')](function(_0x3bec27){_0x2df071[_0x44f4('0x25')]=_0x3bec27;if(_0x3da7eb[_0x44f4('0x35')]['includeAll']){_0x3216bc[_0x44f4('0x44')]=[{'all':!![]}];}return db[_0x44f4('0x43')][_0x44f4('0x45')](_0x3216bc);})[_0x44f4('0x2b')](function(_0xc96159){_0x2df071[_0x44f4('0x46')]=_0xc96159;return _0x2df071;})[_0x44f4('0x2b')](respondWithFilteredResult(_0x30ba7f,_0x3216bc))[_0x44f4('0x47')](handleError(_0x30ba7f,null));};exports[_0x44f4('0x48')]=function(_0x5a824b,_0x293388){var _0x5b9ad0={'raw':![],'where':{'id':_0x5a824b[_0x44f4('0x49')]['id']}},_0x2248ad={};_0x2248ad[_0x44f4('0x33')]=_[_0x44f4('0x36')](db['Team'][_0x44f4('0x30')]);_0x2248ad['query']=_[_0x44f4('0x36')](_0x5a824b[_0x44f4('0x35')]);_0x2248ad[_0x44f4('0x3f')]=_[_0x44f4('0x37')](_0x2248ad[_0x44f4('0x33')],_0x2248ad[_0x44f4('0x35')]);_0x5b9ad0['attributes']=_[_0x44f4('0x37')](_0x2248ad[_0x44f4('0x33')],qs[_0x44f4('0x38')](_0x5a824b[_0x44f4('0x35')]['fields']));_0x5b9ad0[_0x44f4('0x39')]=_0x5b9ad0[_0x44f4('0x39')][_0x44f4('0x4a')]?_0x5b9ad0[_0x44f4('0x39')]:_0x2248ad[_0x44f4('0x33')];if(_0x5a824b['query'][_0x44f4('0x4b')]){_0x5b9ad0[_0x44f4('0x44')]=[{'all':!![]}];}_0x5b9ad0=_[_0x44f4('0x41')]({},_0x5b9ad0,_0x5a824b['options']);return db[_0x44f4('0x43')][_0x44f4('0x4c')](_0x5b9ad0)[_0x44f4('0x2b')](handleEntityNotFound(_0x293388,null))[_0x44f4('0x2b')](respondWithResult(_0x293388,null))['catch'](handleError(_0x293388,null));};exports['create']=function(_0x54ca1,_0x463a6a){return db[_0x44f4('0x43')][_0x44f4('0x4d')](_0x54ca1[_0x44f4('0x4e')],{})['then'](function(_0x5b7950){var _0x44c094=_0x54ca1[_0x44f4('0x4f')]['get']({'plain':!![]});if(!_0x44c094)throw new Error(_0x44f4('0x50'));if(_0x44c094[_0x44f4('0x51')]==='user'){var _0x13dabf=_0x5b7950[_0x44f4('0x52')]({'plain':!![]});var _0x41bc9c=_0x44f4('0x53');return db['UserProfileSection']['find']({'where':{'name':_0x41bc9c,'userProfileId':_0x44c094[_0x44f4('0x54')]},'raw':!![]})[_0x44f4('0x2b')](function(_0x11205b){if(_0x11205b&&_0x11205b['autoAssociation']===0x0){return db[_0x44f4('0x55')][_0x44f4('0x4d')]({'name':_0x13dabf[_0x44f4('0x2d')],'resourceId':_0x13dabf['id'],'type':_0x11205b[_0x44f4('0x2d')],'sectionId':_0x11205b['id']},{})[_0x44f4('0x2b')](function(){return _0x5b7950;});}else{return _0x5b7950;}})[_0x44f4('0x47')](function(_0x602f33){logger[_0x44f4('0x56')](_0x44f4('0x57'),_0x602f33);throw _0x602f33;});}return _0x5b7950;})[_0x44f4('0x2b')](respondWithResult(_0x463a6a,0xc9))['catch'](handleError(_0x463a6a,null));};exports['update']=function(_0x15bdbc,_0x1bbe3c){if(_0x15bdbc[_0x44f4('0x4e')]['id']){delete _0x15bdbc[_0x44f4('0x4e')]['id'];}return db[_0x44f4('0x43')]['find']({'where':{'id':_0x15bdbc['params']['id']}})[_0x44f4('0x2b')](handleEntityNotFound(_0x1bbe3c,null))['then'](saveUpdates(_0x15bdbc[_0x44f4('0x4e')],null))[_0x44f4('0x2b')](respondWithResult(_0x1bbe3c,null))[_0x44f4('0x47')](handleError(_0x1bbe3c,null));};exports[_0x44f4('0x58')]=function(_0x3e4d5b,_0x1b146c){var _0x4d2821=_0x3e4d5b[_0x44f4('0x49')]['id'];var _0x37eb3c=[];return db[_0x44f4('0x59')][_0x44f4('0x5a')](function(_0x2dbb2f){var _0x5b9aec=_0x44f4('0x5b')+_0x4d2821;return db['sequelize']['query'](_0x5b9aec,{'type':db[_0x44f4('0x5c')][_0x44f4('0x5d')][_0x44f4('0x5e')],'raw':!![],'transaction':_0x2dbb2f})[_0x44f4('0x2b')](function(_0x1f43a3){_0x37eb3c=_[_0x44f4('0x34')](_0x1f43a3,function(_0x4e452e){return Number(_0x4e452e[_0x44f4('0x5f')]);});})[_0x44f4('0x2b')](function(){var _0x30a951='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4d2821;return db[_0x44f4('0x59')][_0x44f4('0x35')](_0x30a951,{'type':db[_0x44f4('0x5c')][_0x44f4('0x5d')][_0x44f4('0x5e')],'raw':!![],'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(_0x331728){var _0x3eab57=_[_0x44f4('0x34')](_0x331728,function(_0x5525f9){return Number(_0x5525f9[_0x44f4('0x60')]);});return db['UserVoiceQueue'][_0x44f4('0x58')]({'where':{'UserId':{'$in':_0x37eb3c},'VoiceQueueId':{'$in':_0x3eab57}},'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(){var _0xa247c4=_0x44f4('0x61')+_0x4d2821;return db[_0x44f4('0x59')]['query'](_0xa247c4,{'type':db[_0x44f4('0x5c')][_0x44f4('0x5d')][_0x44f4('0x5e')],'raw':!![],'transaction':_0x2dbb2f});})['then'](function(_0x27fb24){var _0x2b9af5=_[_0x44f4('0x34')](_0x27fb24,function(_0x11af46){return Number(_0x11af46['MailQueueId']);});return db[_0x44f4('0x62')]['destroy']({'where':{'UserId':{'$in':_0x37eb3c},'MailQueueId':{'$in':_0x2b9af5}},'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(){var _0x508356='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4d2821;return db[_0x44f4('0x59')][_0x44f4('0x35')](_0x508356,{'type':db[_0x44f4('0x5c')][_0x44f4('0x5d')][_0x44f4('0x5e')],'raw':!![],'transaction':_0x2dbb2f});})['then'](function(_0x4165ce){var _0x4dcec6=_[_0x44f4('0x34')](_0x4165ce,function(_0x4b5bc8){return Number(_0x4b5bc8[_0x44f4('0x63')]);});return db[_0x44f4('0x64')][_0x44f4('0x58')]({'where':{'UserId':{'$in':_0x37eb3c},'SmsQueueId':{'$in':_0x4dcec6}},'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(){var _0x3f6c4b=_0x44f4('0x65')+_0x4d2821;return db[_0x44f4('0x59')][_0x44f4('0x35')](_0x3f6c4b,{'type':db['Sequelize'][_0x44f4('0x5d')][_0x44f4('0x5e')],'raw':!![],'transaction':_0x2dbb2f});})['then'](function(_0xcd0f2a){var _0x4f0dcf=_[_0x44f4('0x34')](_0xcd0f2a,function(_0x28757a){return Number(_0x28757a[_0x44f4('0x66')]);});return db['UserChatQueue'][_0x44f4('0x58')]({'where':{'UserId':{'$in':_0x37eb3c},'ChatQueueId':{'$in':_0x4f0dcf}},'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(){var _0x1cf936=_0x44f4('0x67')+_0x4d2821;return db[_0x44f4('0x59')][_0x44f4('0x35')](_0x1cf936,{'type':db['Sequelize'][_0x44f4('0x5d')][_0x44f4('0x5e')],'raw':!![],'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(_0x4f1d54){var _0x52f3f4=_[_0x44f4('0x34')](_0x4f1d54,function(_0x368a30){return Number(_0x368a30[_0x44f4('0x68')]);});return db[_0x44f4('0x69')]['destroy']({'where':{'UserId':{'$in':_0x37eb3c},'FaxQueueId':{'$in':_0x52f3f4}},'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(){var _0x47655f=_0x44f4('0x6a')+_0x4d2821;return db['sequelize'][_0x44f4('0x35')](_0x47655f,{'type':db[_0x44f4('0x5c')][_0x44f4('0x5d')][_0x44f4('0x5e')],'raw':!![],'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(_0x492c8e){var _0x4356c4=_['map'](_0x492c8e,function(_0x438c64){return Number(_0x438c64[_0x44f4('0x6b')]);});return db[_0x44f4('0x6c')][_0x44f4('0x58')]({'where':{'UserId':{'$in':_0x37eb3c},'OpenchannelQueueId':{'$in':_0x4356c4}},'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(){var _0x370865=_0x44f4('0x6d')+_0x4d2821;return db[_0x44f4('0x59')][_0x44f4('0x35')](_0x370865,{'type':db[_0x44f4('0x5c')][_0x44f4('0x5d')][_0x44f4('0x5e')],'raw':!![],'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(_0x59ce75){var _0x3a8c2b=_[_0x44f4('0x34')](_0x59ce75,function(_0x5389e2){return Number(_0x5389e2['WhatsappQueueId']);});return db[_0x44f4('0x6e')]['destroy']({'where':{'UserId':{'$in':_0x37eb3c},'WhatsappQueueId':{'$in':_0x3a8c2b}},'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(){return db[_0x44f4('0x6f')][_0x44f4('0x4c')]({'where':{'TeamId':_0x4d2821}});})[_0x44f4('0x2b')](function(_0x107d55){if(_0x107d55===null){return;}return db[_0x44f4('0x70')][_0x44f4('0x58')]({'where':{'UserId':{'$in':_0x37eb3c},'VoicePrefixId':_0x107d55[_0x44f4('0x71')]},'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(){return db[_0x44f4('0x43')][_0x44f4('0x58')]({'where':{'id':_0x4d2821},'cascade':!![],'transaction':_0x2dbb2f});})[_0x44f4('0x2b')](function(_0x3a89c0){if(_0x3a89c0===0x0){_0x1b146c[_0x44f4('0x20')](0x194);}else{return db[_0x44f4('0x55')][_0x44f4('0x58')]({'where':{'type':_0x44f4('0x53'),'resourceId':_0x4d2821},'cascade':!![],'transaction':_0x2dbb2f})[_0x44f4('0x2b')](function(){_0x1b146c[_0x44f4('0x21')](0xcc)[_0x44f4('0x22')]();});}})[_0x44f4('0x47')](function(_0x54f5e2){_0x1b146c[_0x44f4('0x21')](0x1f4)[_0x44f4('0x2e')](_0x54f5e2);});});};exports[_0x44f4('0x72')]=function(_0x2fded9,_0x383dae,_0x52ed75){return db['Team']['findOne']({'where':{'id':_0x2fded9[_0x44f4('0x49')]['id']}})[_0x44f4('0x2b')](handleEntityNotFound(_0x383dae,null))['then'](function(_0x2b9f10){if(!_0x2fded9[_0x44f4('0x35')][_0x44f4('0x73')]||!utils[_0x44f4('0x74')](_0x2fded9['query']['channel'])){throw new db[(_0x44f4('0x5c'))][(_0x44f4('0x75'))]('Unknown\x20channel');}var _0xd9a862={};var _0x4c7837={};_0x4c7837[_0x44f4('0x33')]=_[_0x44f4('0x36')](db[_['capitalize'](_0x2fded9[_0x44f4('0x35')][_0x44f4('0x73')][_0x44f4('0x76')]())+_0x44f4('0x77')][_0x44f4('0x30')]);_0x4c7837['query']=_['keys'](_0x2fded9[_0x44f4('0x35')]);_0x4c7837[_0x44f4('0x3f')]=_[_0x44f4('0x37')](_0x4c7837[_0x44f4('0x33')],_0x4c7837[_0x44f4('0x35')]);_0xd9a862[_0x44f4('0x39')]=_['intersection'](_0x4c7837['model'],qs[_0x44f4('0x38')](_0x2fded9[_0x44f4('0x35')][_0x44f4('0x38')]));_0xd9a862[_0x44f4('0x39')]=_0xd9a862[_0x44f4('0x39')][_0x44f4('0x4a')]?_0xd9a862['attributes']:_0x4c7837[_0x44f4('0x33')];_0xd9a862[_0x44f4('0x24')]=qs[_0x44f4('0x24')](_0x2fded9['query'][_0x44f4('0x24')]);_0xd9a862[_0x44f4('0x3c')]=qs[_0x44f4('0x3c')](_0x2fded9[_0x44f4('0x35')][_0x44f4('0x3c')]);_0xd9a862[_0x44f4('0x78')]=qs['sort'](_0x2fded9[_0x44f4('0x35')][_0x44f4('0x3d')]);_0xd9a862['where']=qs[_0x44f4('0x3f')](_[_0x44f4('0x79')](_0x2fded9[_0x44f4('0x35')],_0x4c7837[_0x44f4('0x3f')]));_0xd9a862=_['merge']({},_0xd9a862,_0x2fded9[_0x44f4('0x42')]);return _0x2b9f10[_0x44f4('0x52')+_[_0x44f4('0x7a')](_0x2fded9[_0x44f4('0x35')][_0x44f4('0x73')][_0x44f4('0x76')]())+_0x44f4('0x7b')](_0xd9a862);})[_0x44f4('0x2b')](respondWithResult(_0x383dae,null))['catch'](handleError(_0x383dae,null));};exports[_0x44f4('0x7c')]=function(_0x1d444c,_0x166010,_0x4efa51){return db[_0x44f4('0x43')][_0x44f4('0x7d')]({'where':{'id':_0x1d444c[_0x44f4('0x49')]['id']}})['then'](function(_0x2fbf76){if(_0x2fbf76){if(!_0x1d444c[_0x44f4('0x4e')][_0x44f4('0x73')]||!utils[_0x44f4('0x74')](_0x1d444c[_0x44f4('0x4e')][_0x44f4('0x73')])){throw new db[(_0x44f4('0x5c'))][(_0x44f4('0x75'))](_0x44f4('0x7e'));}return _0x2fbf76[_0x44f4('0x7f')+_['capitalize'](_0x1d444c[_0x44f4('0x4e')][_0x44f4('0x73')]['toLowerCase']())+_0x44f4('0x7b')](_0x1d444c[_0x44f4('0x4e')][_0x44f4('0x80')]);}return null;})['then'](handleEntityNotFound(_0x166010,null))[_0x44f4('0x2b')](respondWithStatusCode(_0x166010,null))['catch'](handleError(_0x166010,null));};exports[_0x44f4('0x81')]=function(_0x841142,_0xf9ec2d,_0x1cb476){return db[_0x44f4('0x43')][_0x44f4('0x7d')]({'where':{'id':_0x841142[_0x44f4('0x49')]['id']}})['then'](function(_0xbc32dc){if(_0xbc32dc){if(!_0x841142[_0x44f4('0x35')][_0x44f4('0x73')]||!utils[_0x44f4('0x74')](_0x841142[_0x44f4('0x35')]['channel'])){throw new db['Sequelize'][(_0x44f4('0x75'))](_0x44f4('0x7e'));}return _0xbc32dc['remove'+_[_0x44f4('0x7a')](_0x841142[_0x44f4('0x35')][_0x44f4('0x73')][_0x44f4('0x76')]())+'Queues'](_0x841142[_0x44f4('0x35')][_0x44f4('0x80')]);}return null;})[_0x44f4('0x2b')](handleEntityNotFound(_0xf9ec2d,null))['then'](respondWithStatusCode(_0xf9ec2d,null))[_0x44f4('0x47')](handleError(_0xf9ec2d,null));};exports[_0x44f4('0x82')]=function(_0x2bd571,_0x3b50a5){var _0x2ea13a=_['isArray'](_0x2bd571[_0x44f4('0x4e')][_0x44f4('0x80')])?_0x2bd571[_0x44f4('0x4e')][_0x44f4('0x80')]:[_0x2bd571[_0x44f4('0x4e')][_0x44f4('0x80')]];var _0x5b0694=_0x2bd571[_0x44f4('0x49')]['id'];return db['Team'][_0x44f4('0x4c')]({'where':{'id':_0x5b0694}})[_0x44f4('0x2b')](handleEntityNotFound(_0x3b50a5,null))[_0x44f4('0x2b')](function(_0x4da55f){if(_0x4da55f){var _0x108afd=[_0x44f4('0x83'),'Chat',_0x44f4('0x84'),_0x44f4('0x85'),_0x44f4('0x86'),_0x44f4('0x87'),_0x44f4('0x88')];return db[_0x44f4('0x59')][_0x44f4('0x5a')](function(_0x42b4c6){var _0xa23626=_['map'](_0x108afd,function(_0x36b256){var _0x2164ed={'attributes':['id',_0x44f4('0x2d')]};if(_0x36b256===_0x44f4('0x83')){_0x2164ed[_0x44f4('0x89')]={'attributes':[_0x44f4('0x8a')]};}return _0x4da55f[_0x44f4('0x52')+_0x36b256+_0x44f4('0x7b')](_0x2164ed)[_0x44f4('0x2b')](function(_0x249922){var _0x3dddc0=_[_0x44f4('0x34')](_0x249922,function(_0x11d0ae){var _0x30d1bb=_[_0x44f4('0x34')](_0x2ea13a,function(_0x56ba35){var _0x3175ac={'where':{'UserId':_0x56ba35,[_0x36b256+_0x44f4('0x8b')]:_0x11d0ae['id']},'transaction':_0x42b4c6};if(_0x36b256==='Voice'){_0x3175ac[_0x44f4('0x1d')]={'penalty':_0x11d0ae[_0x44f4('0x8c')][_0x44f4('0x8a')]};}return db[_0x44f4('0x8d')+_0x36b256+_0x44f4('0x77')][_0x44f4('0x8e')](_0x3175ac)[_0x44f4('0x2b')](function(){socket[_0x44f4('0x8f')](_0x44f4('0x4f')+_0x36b256+'Queue:save',{'UserId':_0x56ba35,[_0x36b256+_0x44f4('0x8b')]:_0x11d0ae['id']});if(_0x36b256!==_0x44f4('0x83')){return;}return db[_0x44f4('0x8d')][_0x44f4('0x45')]({'where':{'id':_0x2ea13a,'online':0x1},'attributes':['id',_0x44f4('0x2d'),_0x44f4('0x90'),_0x44f4('0x91'),'interface'],'raw':!![]})[_0x44f4('0x2b')](function(_0x1ffc2c){var _0x285eae=_[_0x44f4('0x34')](_0x1ffc2c,function(_0x450ff0){return db['UserVoiceQueueRt']['upsert']({'membername':_0x450ff0[_0x44f4('0x2d')],'UserId':_0x450ff0['id'],'queue_name':_0x11d0ae[_0x44f4('0x2d')],'VoiceQueueId':_0x11d0ae['id'],'interface':_['isNil'](_0x450ff0[_0x44f4('0x92')])?util[_0x44f4('0x93')]('SIP/%s',_0x450ff0[_0x44f4('0x2d')]):_0x450ff0['interface'],'paused':_0x450ff0[_0x44f4('0x91')]||![],'penalty':_0x11d0ae['TeamVoiceQueue'][_0x44f4('0x8a')]},{'transaction':_0x42b4c6});});return Promise[_0x44f4('0x94')](_0x285eae);});});});return Promise['all'](_0x30d1bb);});return Promise['all'](_0x3dddc0);})[_0x44f4('0x2b')](function(){return db[_0x44f4('0x6f')][_0x44f4('0x7d')]({'where':{'teamId':_0x5b0694}})['then'](function(_0x1bb310){if(_0x1bb310){var _0x28b98e=_[_0x44f4('0x34')](_0x2ea13a,function(_0x3b1979){db[_0x44f4('0x70')][_0x44f4('0x95')]({'UserId':_0x3b1979,'VoicePrefixId':_0x1bb310['VoicePrefixId']});});return Promise[_0x44f4('0x94')](_0x28b98e);}});});});return Promise['all'](_0xa23626)[_0x44f4('0x2b')](function(){return _0x4da55f[_0x44f4('0x82')](_0x2ea13a,{'transaction':_0x42b4c6})['spread'](function(_0x2cbaeb){return _0x2cbaeb;});});});}})[_0x44f4('0x2b')](respondWithResult(_0x3b50a5,null))[_0x44f4('0x47')](handleError(_0x3b50a5,null));};exports['removeAgents']=function(_0x6c563a,_0x5ccb0b){var _0x315f87=_[_0x44f4('0x96')](_0x6c563a[_0x44f4('0x35')][_0x44f4('0x80')])?_0x6c563a[_0x44f4('0x35')][_0x44f4('0x80')]:[_0x6c563a[_0x44f4('0x35')][_0x44f4('0x80')]];var _0x2d2468=_0x6c563a[_0x44f4('0x49')]['id'];return db[_0x44f4('0x43')][_0x44f4('0x4c')]({'where':{'id':_0x2d2468}})[_0x44f4('0x2b')](handleEntityNotFound(_0x5ccb0b,null))['then'](function(_0x134376){if(_0x134376){var _0x4827b9=[_0x44f4('0x83'),_0x44f4('0x97'),_0x44f4('0x84'),'Sms',_0x44f4('0x86'),_0x44f4('0x87'),_0x44f4('0x88')];return db[_0x44f4('0x59')][_0x44f4('0x5a')](function(_0x571665){var _0x519ec1=_[_0x44f4('0x34')](_0x4827b9,function(_0x52e027){var _0x1d6fd4={'attributes':['id','name']};return _0x134376['get'+_0x52e027+_0x44f4('0x7b')](_0x1d6fd4)[_0x44f4('0x2b')](function(_0x376cfe){var _0x5a25d8=_['map'](_0x376cfe,function(_0x1ce9b1){return _0x1ce9b1['removeAgents'](_0x315f87,{'transaction':_0x571665})['then'](function(){var _0x4a7e9f=_[_0x44f4('0x34')](_0x315f87,function(_0x42b8c2){socket['emit']('user'+_0x52e027+'Queue:remove',{'UserId':Number(_0x42b8c2),[_0x52e027+'QueueId']:_0x1ce9b1['id']});if(_0x52e027!==_0x44f4('0x83')){return;}return db['UserVoiceQueueRt'][_0x44f4('0x58')]({'where':{'VoiceQueueId':_0x1ce9b1['id'],'UserId':_0x42b8c2},'transaction':_0x571665});});return Promise[_0x44f4('0x94')](_0x4a7e9f);});});return Promise[_0x44f4('0x94')](_0x5a25d8);});});return Promise[_0x44f4('0x94')](_0x519ec1)[_0x44f4('0x2b')](function(){return _0x134376[_0x44f4('0x98')](_0x315f87,{'transaction':_0x571665});})['then'](function(){return db[_0x44f4('0x6f')][_0x44f4('0x7d')]({'where':{'teamId':_0x2d2468}})[_0x44f4('0x2b')](function(_0x1e2507){if(_0x1e2507){var _0x348b3c=_[_0x44f4('0x34')](_0x315f87,function(_0x40267e){db[_0x44f4('0x70')][_0x44f4('0x58')]({'where':{'UserId':_0x40267e,'VoicePrefixId':_0x1e2507['VoicePrefixId']}});});return Promise[_0x44f4('0x94')](_0x348b3c);}});});});}})[_0x44f4('0x2b')](respondWithStatusCode(_0x5ccb0b,null))[_0x44f4('0x47')](handleError(_0x5ccb0b,null));};exports[_0x44f4('0x99')]=function(_0x254d6b,_0x3ec956,_0x3e19c8){var _0x28781e={};var _0x23777f={};var _0x2638c3;var _0x20cfce;return db[_0x44f4('0x43')][_0x44f4('0x7d')]({'where':{'id':_0x254d6b['params']['id']}})[_0x44f4('0x2b')](handleEntityNotFound(_0x3ec956,null))[_0x44f4('0x2b')](function(_0x50a2e1){if(_0x50a2e1){_0x2638c3=_0x50a2e1;_0x23777f[_0x44f4('0x33')]=_['keys'](db[_0x44f4('0x8d')][_0x44f4('0x30')]);_0x23777f[_0x44f4('0x35')]=_[_0x44f4('0x36')](_0x254d6b[_0x44f4('0x35')]);_0x23777f[_0x44f4('0x3f')]=_['intersection'](_0x23777f['model'],_0x23777f[_0x44f4('0x35')]);_0x28781e[_0x44f4('0x39')]=_[_0x44f4('0x37')](_0x23777f['model'],qs[_0x44f4('0x38')](_0x254d6b[_0x44f4('0x35')][_0x44f4('0x38')]));_0x28781e[_0x44f4('0x39')]=_0x28781e[_0x44f4('0x39')][_0x44f4('0x4a')]?_0x28781e['attributes']:_0x23777f['model'];_0x28781e[_0x44f4('0x78')]=qs[_0x44f4('0x3d')](_0x254d6b[_0x44f4('0x35')]['sort']);_0x28781e[_0x44f4('0x3e')]=qs[_0x44f4('0x3f')](_[_0x44f4('0x79')](_0x254d6b[_0x44f4('0x35')],_0x23777f[_0x44f4('0x3f')]));if(_0x254d6b[_0x44f4('0x35')][_0x44f4('0x40')]){_0x28781e[_0x44f4('0x3e')]=_[_0x44f4('0x41')](_0x28781e[_0x44f4('0x3e')],{'$or':_[_0x44f4('0x34')](_0x28781e[_0x44f4('0x39')],function(_0x31a945){var _0x4e67d1={};_0x4e67d1[_0x31a945]={'$like':'%'+_0x254d6b[_0x44f4('0x35')]['filter']+'%'};return _0x4e67d1;})});}_0x28781e=_[_0x44f4('0x41')]({},_0x28781e,_0x254d6b[_0x44f4('0x42')]);return _0x2638c3[_0x44f4('0x99')](_0x28781e);}})[_0x44f4('0x2b')](function(_0x4e8ac3){if(_0x4e8ac3){_0x20cfce=_0x4e8ac3[_0x44f4('0x4a')];if(!_0x254d6b[_0x44f4('0x35')]['hasOwnProperty'](_0x44f4('0x3b'))){_0x28781e[_0x44f4('0x24')]=qs[_0x44f4('0x24')](_0x254d6b[_0x44f4('0x35')][_0x44f4('0x24')]);_0x28781e[_0x44f4('0x3c')]=qs['offset'](_0x254d6b[_0x44f4('0x35')][_0x44f4('0x3c')]);}return _0x2638c3['getAgents'](_0x28781e);}})[_0x44f4('0x2b')](function(_0x1abd69){if(_0x1abd69){return _0x1abd69?{'count':_0x20cfce,'rows':_0x1abd69}:null;}})[_0x44f4('0x2b')](respondWithResult(_0x3ec956,null))[_0x44f4('0x47')](handleError(_0x3ec956,null));}; \ No newline at end of file +var _0x32d7=['SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_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','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','ValidationError','Queues','removeQueues','ids','addAgents','isArray','Voice','Chat','Mail','Sms','Openchannel','Whatsapp','through','penalty','QueueId','User','UserVoiceQueueRt','isNil','interface','format','SIP/%s','voicePause','TeamVoiceQueue','all','spread','removeAgents','Fax','emit','Queue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','stack','name','send','Team','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','find','create','body','get','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes'];(function(_0x163b57,_0xdf2a18){var _0x1f1007=function(_0x2da718){while(--_0x2da718){_0x163b57['push'](_0x163b57['shift']());}};_0x1f1007(++_0xdf2a18);}(_0x32d7,0xd2));var _0x732d=function(_0x12e073,_0x4d43db){_0x12e073=_0x12e073-0x0;var _0x267748=_0x32d7[_0x12e073];return _0x267748;};'use strict';var emlformat=require(_0x732d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x732d('0x1'));var jsonpatch=require(_0x732d('0x2'));var rp=require(_0x732d('0x3'));var moment=require(_0x732d('0x4'));var BPromise=require(_0x732d('0x5'));var Mustache=require(_0x732d('0x6'));var util=require(_0x732d('0x7'));var path=require(_0x732d('0x8'));var sox=require('sox');var csv=require(_0x732d('0x9'));var ejs=require(_0x732d('0xa'));var fs=require('fs');var fs_extra=require(_0x732d('0xb'));var _=require(_0x732d('0xc'));var squel=require(_0x732d('0xd'));var crypto=require(_0x732d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x732d('0xf'));var toCsv=require(_0x732d('0x9'));var querystring=require(_0x732d('0x10'));var Papa=require(_0x732d('0x11'));var Redis=require('ioredis');var authService=require(_0x732d('0x12'));var qs=require(_0x732d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x732d('0x14'));var logger=require('../../config/logger')(_0x732d('0x15'));var utils=require('../../config/utils');var config=require(_0x732d('0x16'));var licenseUtil=require(_0x732d('0x17'));var db=require(_0x732d('0x18'))['db'];config['redis']=_[_0x732d('0x19')](config['redis'],{'host':_0x732d('0x1a'),'port':0x18eb});var socket=require(_0x732d('0x1b'))(new Redis(config['redis']));require(_0x732d('0x1c'))[_0x732d('0x1d')](socket);function respondWithStatusCode(_0x19e9d3,_0x27a0e1){_0x27a0e1=_0x27a0e1||0xcc;return function(_0x989972){if(_0x989972){return _0x19e9d3[_0x732d('0x1e')](_0x27a0e1);}return _0x19e9d3[_0x732d('0x1f')](_0x27a0e1)[_0x732d('0x20')]();};}function respondWithResult(_0xee7e94,_0x239c07){_0x239c07=_0x239c07||0xc8;return function(_0x5d1ef6){if(_0x5d1ef6){return _0xee7e94[_0x732d('0x1f')](_0x239c07)['json'](_0x5d1ef6);}};}function respondWithFilteredResult(_0x4d328c,_0x2343f4){return function(_0x26c65c){if(_0x26c65c){var _0x1fe5c2=typeof _0x2343f4[_0x732d('0x21')]===_0x732d('0x22')&&typeof _0x2343f4[_0x732d('0x23')]===_0x732d('0x22');var _0x5144bd=_0x26c65c[_0x732d('0x24')];var _0x4f890b=_0x1fe5c2?0x0:_0x2343f4[_0x732d('0x21')];var _0x28e554=_0x1fe5c2?_0x26c65c[_0x732d('0x24')]:_0x2343f4[_0x732d('0x21')]+_0x2343f4['limit'];var _0x47dec9;if(_0x28e554>=_0x5144bd){_0x28e554=_0x5144bd;_0x47dec9=0xc8;}else{_0x47dec9=0xce;}_0x4d328c[_0x732d('0x1f')](_0x47dec9);return _0x4d328c[_0x732d('0x25')](_0x732d('0x26'),_0x4f890b+'-'+_0x28e554+'/'+_0x5144bd)[_0x732d('0x27')](_0x26c65c);}return null;};}function patchUpdates(_0x2cd7a2){return function(_0x4032cc){try{jsonpatch[_0x732d('0x28')](_0x4032cc,_0x2cd7a2,!![]);}catch(_0x37ab0d){return BPromise['reject'](_0x37ab0d);}return _0x4032cc['save']();};}function saveUpdates(_0x167fd2,_0x1245b2){return function(_0x1b1d56){if(_0x1b1d56){return _0x1b1d56[_0x732d('0x29')](_0x167fd2)[_0x732d('0x2a')](function(_0xd574b9){return _0xd574b9;});}return null;};}function handleEntityNotFound(_0x23e5fb,_0x1d5ca6){return function(_0x41ec6a){if(!_0x41ec6a){_0x23e5fb[_0x732d('0x1e')](0x194);}return _0x41ec6a;};}function handleError(_0x311013,_0x51af4a){_0x51af4a=_0x51af4a||0x1f4;return function(_0x16a07a){logger['error'](_0x16a07a[_0x732d('0x2b')]);if(_0x16a07a[_0x732d('0x2c')]){delete _0x16a07a['name'];}_0x311013[_0x732d('0x1f')](_0x51af4a)[_0x732d('0x2d')](_0x16a07a);};}exports['index']=function(_0x22cfec,_0x214a22){var _0x4a2f5f={},_0x50abcb={},_0x4a3dca={'count':0x0,'rows':[]};var _0x49dedb=_['map'](db[_0x732d('0x2e')][_0x732d('0x2f')],function(_0x31ab6d){return{'name':_0x31ab6d[_0x732d('0x30')],'type':_0x31ab6d[_0x732d('0x31')][_0x732d('0x32')]};});_0x50abcb[_0x732d('0x33')]=_['map'](_0x49dedb,_0x732d('0x2c'));_0x50abcb['query']=_[_0x732d('0x34')](_0x22cfec[_0x732d('0x35')]);_0x50abcb[_0x732d('0x36')]=_[_0x732d('0x37')](_0x50abcb[_0x732d('0x33')],_0x50abcb[_0x732d('0x35')]);_0x4a2f5f[_0x732d('0x38')]=_['intersection'](_0x50abcb['model'],qs[_0x732d('0x39')](_0x22cfec['query']['fields']));_0x4a2f5f['attributes']=_0x4a2f5f[_0x732d('0x38')][_0x732d('0x3a')]?_0x4a2f5f['attributes']:_0x50abcb[_0x732d('0x33')];if(!_0x22cfec[_0x732d('0x35')][_0x732d('0x3b')]('nolimit')){_0x4a2f5f['limit']=qs[_0x732d('0x23')](_0x22cfec[_0x732d('0x35')][_0x732d('0x23')]);_0x4a2f5f[_0x732d('0x21')]=qs[_0x732d('0x21')](_0x22cfec[_0x732d('0x35')][_0x732d('0x21')]);}_0x4a2f5f[_0x732d('0x3c')]=qs[_0x732d('0x3d')](_0x22cfec[_0x732d('0x35')]['sort']);_0x4a2f5f[_0x732d('0x3e')]=qs['filters'](_[_0x732d('0x3f')](_0x22cfec[_0x732d('0x35')],_0x50abcb['filters']),_0x49dedb);if(_0x22cfec[_0x732d('0x35')][_0x732d('0x40')]){_0x4a2f5f['where']=_[_0x732d('0x41')](_0x4a2f5f[_0x732d('0x3e')],{'$or':_[_0x732d('0x42')](_0x49dedb,function(_0x44bcaa){if(_0x44bcaa[_0x732d('0x31')]!==_0x732d('0x43')){var _0x3da5a5={};_0x3da5a5[_0x44bcaa[_0x732d('0x2c')]]={'$like':'%'+_0x22cfec[_0x732d('0x35')][_0x732d('0x40')]+'%'};return _0x3da5a5;}})});}_0x4a2f5f=_['merge']({},_0x4a2f5f,_0x22cfec[_0x732d('0x44')]);var _0x17fa3e={'where':_0x4a2f5f[_0x732d('0x3e')]};return db['Team'][_0x732d('0x24')](_0x17fa3e)[_0x732d('0x2a')](function(_0x3f40e2){_0x4a3dca[_0x732d('0x24')]=_0x3f40e2;if(_0x22cfec[_0x732d('0x35')]['includeAll']){_0x4a2f5f['include']=[{'all':!![]}];}return db['Team'][_0x732d('0x45')](_0x4a2f5f);})['then'](function(_0x1f94c7){_0x4a3dca[_0x732d('0x46')]=_0x1f94c7;return _0x4a3dca;})[_0x732d('0x2a')](respondWithFilteredResult(_0x214a22,_0x4a2f5f))[_0x732d('0x47')](handleError(_0x214a22,null));};exports[_0x732d('0x48')]=function(_0x573972,_0x26df5d){var _0x1bbff8={'raw':![],'where':{'id':_0x573972[_0x732d('0x49')]['id']}},_0x154b1f={};_0x154b1f[_0x732d('0x33')]=_[_0x732d('0x34')](db[_0x732d('0x2e')][_0x732d('0x2f')]);_0x154b1f[_0x732d('0x35')]=_[_0x732d('0x34')](_0x573972[_0x732d('0x35')]);_0x154b1f[_0x732d('0x36')]=_[_0x732d('0x37')](_0x154b1f[_0x732d('0x33')],_0x154b1f[_0x732d('0x35')]);_0x1bbff8['attributes']=_[_0x732d('0x37')](_0x154b1f[_0x732d('0x33')],qs[_0x732d('0x39')](_0x573972['query'][_0x732d('0x39')]));_0x1bbff8[_0x732d('0x38')]=_0x1bbff8['attributes']['length']?_0x1bbff8[_0x732d('0x38')]:_0x154b1f[_0x732d('0x33')];if(_0x573972[_0x732d('0x35')][_0x732d('0x4a')]){_0x1bbff8['include']=[{'all':!![]}];}_0x1bbff8=_[_0x732d('0x41')]({},_0x1bbff8,_0x573972[_0x732d('0x44')]);return db['Team'][_0x732d('0x4b')](_0x1bbff8)[_0x732d('0x2a')](handleEntityNotFound(_0x26df5d,null))[_0x732d('0x2a')](respondWithResult(_0x26df5d,null))[_0x732d('0x47')](handleError(_0x26df5d,null));};exports[_0x732d('0x4c')]=function(_0x23babc,_0x2b591b){return db[_0x732d('0x2e')][_0x732d('0x4c')](_0x23babc[_0x732d('0x4d')],{})[_0x732d('0x2a')](function(_0x455208){var _0xcff3cf=_0x23babc['user'][_0x732d('0x4e')]({'plain':!![]});if(!_0xcff3cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcff3cf[_0x732d('0x4f')]===_0x732d('0x50')){var _0x430a2e=_0x455208[_0x732d('0x4e')]({'plain':!![]});var _0x3553c0=_0x732d('0x51');return db[_0x732d('0x52')][_0x732d('0x4b')]({'where':{'name':_0x3553c0,'userProfileId':_0xcff3cf[_0x732d('0x53')]},'raw':!![]})[_0x732d('0x2a')](function(_0x3220b3){if(_0x3220b3&&_0x3220b3[_0x732d('0x54')]===0x0){return db[_0x732d('0x55')][_0x732d('0x4c')]({'name':_0x430a2e['name'],'resourceId':_0x430a2e['id'],'type':_0x3220b3['name'],'sectionId':_0x3220b3['id']},{})[_0x732d('0x2a')](function(){return _0x455208;});}else{return _0x455208;}})[_0x732d('0x47')](function(_0x1d7cd1){logger[_0x732d('0x56')](_0x732d('0x57'),_0x1d7cd1);throw _0x1d7cd1;});}return _0x455208;})[_0x732d('0x2a')](respondWithResult(_0x2b591b,0xc9))['catch'](handleError(_0x2b591b,null));};exports['update']=function(_0x145759,_0x1ca9c5){if(_0x145759[_0x732d('0x4d')]['id']){delete _0x145759['body']['id'];}return db[_0x732d('0x2e')][_0x732d('0x4b')]({'where':{'id':_0x145759['params']['id']}})[_0x732d('0x2a')](handleEntityNotFound(_0x1ca9c5,null))[_0x732d('0x2a')](saveUpdates(_0x145759[_0x732d('0x4d')],null))[_0x732d('0x2a')](respondWithResult(_0x1ca9c5,null))[_0x732d('0x47')](handleError(_0x1ca9c5,null));};exports[_0x732d('0x58')]=function(_0x526db2,_0x2e3334){var _0x17c344=_0x526db2[_0x732d('0x49')]['id'];var _0x35947d=[];return db['sequelize'][_0x732d('0x59')](function(_0xda306c){var _0x4b85c7=_0x732d('0x5a')+_0x17c344;return db[_0x732d('0x5b')][_0x732d('0x35')](_0x4b85c7,{'type':db[_0x732d('0x5c')][_0x732d('0x5d')][_0x732d('0x5e')],'raw':!![],'transaction':_0xda306c})[_0x732d('0x2a')](function(_0x2a0075){_0x35947d=_['map'](_0x2a0075,function(_0x58d2d9){return Number(_0x58d2d9['UserId']);});})[_0x732d('0x2a')](function(){var _0x59ec67=_0x732d('0x5f')+_0x17c344;return db[_0x732d('0x5b')]['query'](_0x59ec67,{'type':db[_0x732d('0x5c')]['QueryTypes'][_0x732d('0x5e')],'raw':!![],'transaction':_0xda306c});})['then'](function(_0x55f442){var _0x4e6262=_[_0x732d('0x42')](_0x55f442,function(_0x5a9db8){return Number(_0x5a9db8[_0x732d('0x60')]);});return db[_0x732d('0x61')][_0x732d('0x58')]({'where':{'UserId':{'$in':_0x35947d},'VoiceQueueId':{'$in':_0x4e6262}},'transaction':_0xda306c});})[_0x732d('0x2a')](function(){var _0x5f4527=_0x732d('0x62')+_0x17c344;return db[_0x732d('0x5b')][_0x732d('0x35')](_0x5f4527,{'type':db['Sequelize'][_0x732d('0x5d')][_0x732d('0x5e')],'raw':!![],'transaction':_0xda306c});})['then'](function(_0x43cf37){var _0x3dfc01=_[_0x732d('0x42')](_0x43cf37,function(_0x325c76){return Number(_0x325c76['MailQueueId']);});return db[_0x732d('0x63')][_0x732d('0x58')]({'where':{'UserId':{'$in':_0x35947d},'MailQueueId':{'$in':_0x3dfc01}},'transaction':_0xda306c});})[_0x732d('0x2a')](function(){var _0x181d1a=_0x732d('0x64')+_0x17c344;return db['sequelize'][_0x732d('0x35')](_0x181d1a,{'type':db[_0x732d('0x5c')][_0x732d('0x5d')][_0x732d('0x5e')],'raw':!![],'transaction':_0xda306c});})[_0x732d('0x2a')](function(_0x2113cc){var _0x11f5a0=_['map'](_0x2113cc,function(_0x1a2a27){return Number(_0x1a2a27['SmsQueueId']);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x35947d},'SmsQueueId':{'$in':_0x11f5a0}},'transaction':_0xda306c});})['then'](function(){var _0x41d22d='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x17c344;return db[_0x732d('0x5b')][_0x732d('0x35')](_0x41d22d,{'type':db[_0x732d('0x5c')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0xda306c});})[_0x732d('0x2a')](function(_0x311f2f){var _0x416004=_[_0x732d('0x42')](_0x311f2f,function(_0x20a502){return Number(_0x20a502[_0x732d('0x65')]);});return db[_0x732d('0x66')][_0x732d('0x58')]({'where':{'UserId':{'$in':_0x35947d},'ChatQueueId':{'$in':_0x416004}},'transaction':_0xda306c});})[_0x732d('0x2a')](function(){var _0x6eef3f=_0x732d('0x67')+_0x17c344;return db[_0x732d('0x5b')]['query'](_0x6eef3f,{'type':db[_0x732d('0x5c')][_0x732d('0x5d')][_0x732d('0x5e')],'raw':!![],'transaction':_0xda306c});})[_0x732d('0x2a')](function(_0x4e9abe){var _0x4a1748=_[_0x732d('0x42')](_0x4e9abe,function(_0x283641){return Number(_0x283641[_0x732d('0x68')]);});return db[_0x732d('0x69')][_0x732d('0x58')]({'where':{'UserId':{'$in':_0x35947d},'FaxQueueId':{'$in':_0x4a1748}},'transaction':_0xda306c});})['then'](function(){var _0x22e4b8=_0x732d('0x6a')+_0x17c344;return db[_0x732d('0x5b')][_0x732d('0x35')](_0x22e4b8,{'type':db[_0x732d('0x5c')][_0x732d('0x5d')]['SELECT'],'raw':!![],'transaction':_0xda306c});})[_0x732d('0x2a')](function(_0x359de8){var _0x44186a=_[_0x732d('0x42')](_0x359de8,function(_0x81da20){return Number(_0x81da20[_0x732d('0x6b')]);});return db['UserOpenchannelQueue'][_0x732d('0x58')]({'where':{'UserId':{'$in':_0x35947d},'OpenchannelQueueId':{'$in':_0x44186a}},'transaction':_0xda306c});})[_0x732d('0x2a')](function(){var _0x3a3fda='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x17c344;return db[_0x732d('0x5b')]['query'](_0x3a3fda,{'type':db[_0x732d('0x5c')][_0x732d('0x5d')][_0x732d('0x5e')],'raw':!![],'transaction':_0xda306c});})[_0x732d('0x2a')](function(_0x414588){var _0x3c68f4=_['map'](_0x414588,function(_0x1ea0f2){return Number(_0x1ea0f2[_0x732d('0x6c')]);});return db[_0x732d('0x6d')][_0x732d('0x58')]({'where':{'UserId':{'$in':_0x35947d},'WhatsappQueueId':{'$in':_0x3c68f4}},'transaction':_0xda306c});})[_0x732d('0x2a')](function(){return db[_0x732d('0x6e')][_0x732d('0x4b')]({'where':{'TeamId':_0x17c344}});})[_0x732d('0x2a')](function(_0x11b6f6){if(_0x11b6f6===null){return;}return db[_0x732d('0x6f')][_0x732d('0x58')]({'where':{'UserId':{'$in':_0x35947d},'VoicePrefixId':_0x11b6f6[_0x732d('0x70')]},'transaction':_0xda306c});})[_0x732d('0x2a')](function(){return db[_0x732d('0x2e')][_0x732d('0x58')]({'where':{'id':_0x17c344},'cascade':!![],'transaction':_0xda306c});})[_0x732d('0x2a')](function(_0x108fc5){if(_0x108fc5===0x0){_0x2e3334['sendStatus'](0x194);}else{return db[_0x732d('0x55')][_0x732d('0x58')]({'where':{'type':_0x732d('0x51'),'resourceId':_0x17c344},'cascade':!![],'transaction':_0xda306c})['then'](function(){_0x2e3334[_0x732d('0x1f')](0xcc)[_0x732d('0x20')]();});}})['catch'](function(_0x25c227){_0x2e3334[_0x732d('0x1f')](0x1f4)[_0x732d('0x2d')](_0x25c227);});});};exports[_0x732d('0x71')]=function(_0x42fe9d,_0x13a0c4,_0x4d6490){return db[_0x732d('0x2e')][_0x732d('0x72')]({'where':{'id':_0x42fe9d['params']['id']}})[_0x732d('0x2a')](handleEntityNotFound(_0x13a0c4,null))[_0x732d('0x2a')](function(_0x504694){if(!_0x42fe9d[_0x732d('0x35')][_0x732d('0x73')]||!utils[_0x732d('0x74')](_0x42fe9d[_0x732d('0x35')][_0x732d('0x73')])){throw new db[(_0x732d('0x5c'))]['ValidationError'](_0x732d('0x75'));}var _0x3fca92={};var _0x426ceb={};_0x426ceb[_0x732d('0x33')]=_[_0x732d('0x34')](db[_[_0x732d('0x76')](_0x42fe9d[_0x732d('0x35')][_0x732d('0x73')][_0x732d('0x77')]())+_0x732d('0x78')][_0x732d('0x2f')]);_0x426ceb[_0x732d('0x35')]=_[_0x732d('0x34')](_0x42fe9d[_0x732d('0x35')]);_0x426ceb[_0x732d('0x36')]=_['intersection'](_0x426ceb[_0x732d('0x33')],_0x426ceb[_0x732d('0x35')]);_0x3fca92[_0x732d('0x38')]=_[_0x732d('0x37')](_0x426ceb[_0x732d('0x33')],qs[_0x732d('0x39')](_0x42fe9d[_0x732d('0x35')][_0x732d('0x39')]));_0x3fca92['attributes']=_0x3fca92['attributes']['length']?_0x3fca92[_0x732d('0x38')]:_0x426ceb[_0x732d('0x33')];_0x3fca92['limit']=qs[_0x732d('0x23')](_0x42fe9d['query'][_0x732d('0x23')]);_0x3fca92[_0x732d('0x21')]=qs['offset'](_0x42fe9d[_0x732d('0x35')][_0x732d('0x21')]);_0x3fca92[_0x732d('0x3c')]=qs['sort'](_0x42fe9d['query']['sort']);_0x3fca92[_0x732d('0x3e')]=qs[_0x732d('0x36')](_[_0x732d('0x3f')](_0x42fe9d[_0x732d('0x35')],_0x426ceb['filters']));_0x3fca92=_[_0x732d('0x41')]({},_0x3fca92,_0x42fe9d['options']);return _0x504694['get'+_[_0x732d('0x76')](_0x42fe9d[_0x732d('0x35')]['channel'][_0x732d('0x77')]())+'Queues'](_0x3fca92);})['then'](respondWithResult(_0x13a0c4,null))[_0x732d('0x47')](handleError(_0x13a0c4,null));};exports[_0x732d('0x79')]=function(_0x1e0819,_0x37605c,_0x21e5e0){return db[_0x732d('0x2e')][_0x732d('0x72')]({'where':{'id':_0x1e0819[_0x732d('0x49')]['id']}})[_0x732d('0x2a')](function(_0x3203cc){if(_0x3203cc){if(!_0x1e0819[_0x732d('0x4d')][_0x732d('0x73')]||!utils['isValidChannel'](_0x1e0819[_0x732d('0x4d')][_0x732d('0x73')])){throw new db['Sequelize'][(_0x732d('0x7a'))](_0x732d('0x75'));}return _0x3203cc['add'+_[_0x732d('0x76')](_0x1e0819[_0x732d('0x4d')][_0x732d('0x73')]['toLowerCase']())+_0x732d('0x7b')](_0x1e0819[_0x732d('0x4d')]['ids']);}return null;})[_0x732d('0x2a')](handleEntityNotFound(_0x37605c,null))[_0x732d('0x2a')](respondWithStatusCode(_0x37605c,null))[_0x732d('0x47')](handleError(_0x37605c,null));};exports[_0x732d('0x7c')]=function(_0x18a3ce,_0x4ef338,_0x5c3717){return db['Team'][_0x732d('0x72')]({'where':{'id':_0x18a3ce['params']['id']}})['then'](function(_0x746063){if(_0x746063){if(!_0x18a3ce[_0x732d('0x35')][_0x732d('0x73')]||!utils[_0x732d('0x74')](_0x18a3ce[_0x732d('0x35')][_0x732d('0x73')])){throw new db[(_0x732d('0x5c'))]['ValidationError'](_0x732d('0x75'));}return _0x746063['remove'+_[_0x732d('0x76')](_0x18a3ce[_0x732d('0x35')][_0x732d('0x73')]['toLowerCase']())+'Queues'](_0x18a3ce[_0x732d('0x35')][_0x732d('0x7d')]);}return null;})[_0x732d('0x2a')](handleEntityNotFound(_0x4ef338,null))['then'](respondWithStatusCode(_0x4ef338,null))['catch'](handleError(_0x4ef338,null));};exports[_0x732d('0x7e')]=function(_0x458be5,_0x1e2db6){var _0xecf5c0=_[_0x732d('0x7f')](_0x458be5['body']['ids'])?_0x458be5['body'][_0x732d('0x7d')]:[_0x458be5[_0x732d('0x4d')][_0x732d('0x7d')]];var _0xe4ef2b=_0x458be5[_0x732d('0x49')]['id'];return db[_0x732d('0x2e')][_0x732d('0x4b')]({'where':{'id':_0xe4ef2b}})[_0x732d('0x2a')](handleEntityNotFound(_0x1e2db6,null))['then'](function(_0x14f8eb){if(_0x14f8eb){var _0x322690=[_0x732d('0x80'),_0x732d('0x81'),_0x732d('0x82'),_0x732d('0x83'),'Fax',_0x732d('0x84'),_0x732d('0x85')];return db['sequelize'][_0x732d('0x59')](function(_0x1393e7){var _0x507880=_['map'](_0x322690,function(_0x5e5046){var _0x1c9cea={'attributes':['id',_0x732d('0x2c')]};if(_0x5e5046===_0x732d('0x80')){_0x1c9cea[_0x732d('0x86')]={'attributes':[_0x732d('0x87')]};}return _0x14f8eb[_0x732d('0x4e')+_0x5e5046+_0x732d('0x7b')](_0x1c9cea)[_0x732d('0x2a')](function(_0x3574e2){var _0x32ea61=_[_0x732d('0x42')](_0x3574e2,function(_0x8745e9){var _0x46e637=_[_0x732d('0x42')](_0xecf5c0,function(_0x3f0560){var _0x3739b1={'where':{'UserId':_0x3f0560,[_0x5e5046+_0x732d('0x88')]:_0x8745e9['id']},'transaction':_0x1393e7};if(_0x5e5046===_0x732d('0x80')){_0x3739b1[_0x732d('0x19')]={'penalty':_0x8745e9['TeamVoiceQueue']['penalty']};}return db[_0x732d('0x89')+_0x5e5046+'Queue']['findOrCreate'](_0x3739b1)[_0x732d('0x2a')](function(){socket['emit'](_0x732d('0x50')+_0x5e5046+'Queue:save',{'UserId':_0x3f0560,[_0x5e5046+_0x732d('0x88')]:_0x8745e9['id']});if(_0x5e5046!=='Voice'){return;}return db[_0x732d('0x89')][_0x732d('0x45')]({'where':{'id':_0xecf5c0,'online':0x1},'attributes':['id',_0x732d('0x2c'),'online','voicePause','interface'],'raw':!![]})[_0x732d('0x2a')](function(_0x5af41b){var _0x22fd8a=_[_0x732d('0x42')](_0x5af41b,function(_0x1953aa){return db[_0x732d('0x8a')]['upsert']({'membername':_0x1953aa[_0x732d('0x2c')],'UserId':_0x1953aa['id'],'queue_name':_0x8745e9[_0x732d('0x2c')],'VoiceQueueId':_0x8745e9['id'],'interface':_[_0x732d('0x8b')](_0x1953aa[_0x732d('0x8c')])?util[_0x732d('0x8d')](_0x732d('0x8e'),_0x1953aa[_0x732d('0x2c')]):_0x1953aa[_0x732d('0x8c')],'paused':_0x1953aa[_0x732d('0x8f')]||![],'penalty':_0x8745e9[_0x732d('0x90')][_0x732d('0x87')]},{'transaction':_0x1393e7});});return Promise[_0x732d('0x91')](_0x22fd8a);});});});return Promise['all'](_0x46e637);});return Promise[_0x732d('0x91')](_0x32ea61);})['then'](function(){return db['TeamVoicePrefix'][_0x732d('0x72')]({'where':{'teamId':_0xe4ef2b}})['then'](function(_0x4bd873){if(_0x4bd873){var _0x130bf6=_['map'](_0xecf5c0,function(_0x353cf2){db[_0x732d('0x6f')]['upsert']({'UserId':_0x353cf2,'VoicePrefixId':_0x4bd873[_0x732d('0x70')]});});return Promise[_0x732d('0x91')](_0x130bf6);}});});});return Promise[_0x732d('0x91')](_0x507880)[_0x732d('0x2a')](function(){return _0x14f8eb[_0x732d('0x7e')](_0xecf5c0,{'transaction':_0x1393e7})[_0x732d('0x92')](function(_0x1140bb){return _0x1140bb;});});});}})[_0x732d('0x2a')](respondWithResult(_0x1e2db6,null))[_0x732d('0x47')](handleError(_0x1e2db6,null));};exports[_0x732d('0x93')]=function(_0x9799de,_0x4be48c){var _0x42403a=_['isArray'](_0x9799de['query'][_0x732d('0x7d')])?_0x9799de[_0x732d('0x35')]['ids']:[_0x9799de['query'][_0x732d('0x7d')]];var _0x4e21d7=_0x9799de[_0x732d('0x49')]['id'];return db[_0x732d('0x2e')][_0x732d('0x4b')]({'where':{'id':_0x4e21d7}})[_0x732d('0x2a')](handleEntityNotFound(_0x4be48c,null))[_0x732d('0x2a')](function(_0x177502){if(_0x177502){var _0x4cd462=[_0x732d('0x80'),_0x732d('0x81'),'Mail',_0x732d('0x83'),_0x732d('0x94'),'Openchannel',_0x732d('0x85')];return db[_0x732d('0x5b')][_0x732d('0x59')](function(_0x2c46fc){var _0x2807e7=_[_0x732d('0x42')](_0x4cd462,function(_0x49a7a6){var _0x405b56={'attributes':['id',_0x732d('0x2c')]};return _0x177502[_0x732d('0x4e')+_0x49a7a6+_0x732d('0x7b')](_0x405b56)[_0x732d('0x2a')](function(_0xfa6041){var _0x4aa39a=_[_0x732d('0x42')](_0xfa6041,function(_0x475116){return _0x475116[_0x732d('0x93')](_0x42403a,{'transaction':_0x2c46fc})[_0x732d('0x2a')](function(){var _0x34beb5=_[_0x732d('0x42')](_0x42403a,function(_0xb0b2b6){socket[_0x732d('0x95')]('user'+_0x49a7a6+_0x732d('0x96'),{'UserId':Number(_0xb0b2b6),[_0x49a7a6+'QueueId']:_0x475116['id']});if(_0x49a7a6!=='Voice'){return;}return db[_0x732d('0x8a')][_0x732d('0x58')]({'where':{'VoiceQueueId':_0x475116['id'],'UserId':_0xb0b2b6},'transaction':_0x2c46fc});});return Promise[_0x732d('0x91')](_0x34beb5);});});return Promise[_0x732d('0x91')](_0x4aa39a);});});return Promise[_0x732d('0x91')](_0x2807e7)['then'](function(){return _0x177502[_0x732d('0x93')](_0x42403a,{'transaction':_0x2c46fc});})[_0x732d('0x2a')](function(){return db[_0x732d('0x6e')][_0x732d('0x72')]({'where':{'teamId':_0x4e21d7}})['then'](function(_0x1e0403){if(_0x1e0403){var _0x274e03=_[_0x732d('0x42')](_0x42403a,function(_0x47ffe7){db[_0x732d('0x6f')][_0x732d('0x58')]({'where':{'UserId':_0x47ffe7,'VoicePrefixId':_0x1e0403[_0x732d('0x70')]}});});return Promise[_0x732d('0x91')](_0x274e03);}});});});}})['then'](respondWithStatusCode(_0x4be48c,null))[_0x732d('0x47')](handleError(_0x4be48c,null));};exports[_0x732d('0x97')]=function(_0x488655,_0x2713c0,_0x11db78){var _0x5eebd9={};var _0x1007cb={};var _0xf3892a;var _0x127c13;return db[_0x732d('0x2e')][_0x732d('0x72')]({'where':{'id':_0x488655[_0x732d('0x49')]['id']}})[_0x732d('0x2a')](handleEntityNotFound(_0x2713c0,null))['then'](function(_0x8dfeeb){if(_0x8dfeeb){_0xf3892a=_0x8dfeeb;_0x1007cb['model']=_[_0x732d('0x34')](db[_0x732d('0x89')]['rawAttributes']);_0x1007cb[_0x732d('0x35')]=_[_0x732d('0x34')](_0x488655['query']);_0x1007cb[_0x732d('0x36')]=_['intersection'](_0x1007cb[_0x732d('0x33')],_0x1007cb[_0x732d('0x35')]);_0x5eebd9['attributes']=_[_0x732d('0x37')](_0x1007cb[_0x732d('0x33')],qs[_0x732d('0x39')](_0x488655[_0x732d('0x35')][_0x732d('0x39')]));_0x5eebd9[_0x732d('0x38')]=_0x5eebd9[_0x732d('0x38')]['length']?_0x5eebd9['attributes']:_0x1007cb[_0x732d('0x33')];_0x5eebd9[_0x732d('0x3c')]=qs[_0x732d('0x3d')](_0x488655[_0x732d('0x35')][_0x732d('0x3d')]);_0x5eebd9[_0x732d('0x3e')]=qs['filters'](_[_0x732d('0x3f')](_0x488655[_0x732d('0x35')],_0x1007cb[_0x732d('0x36')]));if(_0x488655[_0x732d('0x35')][_0x732d('0x40')]){_0x5eebd9[_0x732d('0x3e')]=_[_0x732d('0x41')](_0x5eebd9[_0x732d('0x3e')],{'$or':_[_0x732d('0x42')](_0x5eebd9[_0x732d('0x38')],function(_0x424745){var _0x40df8b={};_0x40df8b[_0x424745]={'$like':'%'+_0x488655[_0x732d('0x35')][_0x732d('0x40')]+'%'};return _0x40df8b;})});}_0x5eebd9=_['merge']({},_0x5eebd9,_0x488655[_0x732d('0x44')]);return _0xf3892a[_0x732d('0x97')](_0x5eebd9);}})['then'](function(_0x1cad15){if(_0x1cad15){_0x127c13=_0x1cad15[_0x732d('0x3a')];if(!_0x488655['query']['hasOwnProperty']('nolimit')){_0x5eebd9['limit']=qs[_0x732d('0x23')](_0x488655[_0x732d('0x35')][_0x732d('0x23')]);_0x5eebd9['offset']=qs['offset'](_0x488655[_0x732d('0x35')][_0x732d('0x21')]);}return _0xf3892a[_0x732d('0x97')](_0x5eebd9);}})[_0x732d('0x2a')](function(_0x5d9264){if(_0x5d9264){return _0x5d9264?{'count':_0x127c13,'rows':_0x5d9264}:null;}})[_0x732d('0x2a')](respondWithResult(_0x2713c0,null))['catch'](handleError(_0x2713c0,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 77d59b5..b681b9d 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 _0x4b51=['save','remove','emit','hook','exports','events','../../mysqldb','Team','setMaxListeners'];(function(_0x2cdab6,_0x4e1faf){var _0x3b250e=function(_0x4236ac){while(--_0x4236ac){_0x2cdab6['push'](_0x2cdab6['shift']());}};_0x3b250e(++_0x4e1faf);}(_0x4b51,0x83));var _0x14b5=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0x4b51[_0x318840];return _0x223da4;};'use strict';var EventEmitter=require(_0x14b5('0x0'));var Team=require(_0x14b5('0x1'))['db'][_0x14b5('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x14b5('0x3')](0x0);var events={'afterCreate':_0x14b5('0x4'),'afterUpdate':'update','afterDestroy':_0x14b5('0x5')};function emitEvent(_0x43eaae){return function(_0x321b67,_0x290a3e,_0x2d4b0c){TeamEvents['emit'](_0x43eaae+':'+_0x321b67['id'],_0x321b67);TeamEvents[_0x14b5('0x6')](_0x43eaae,_0x321b67);_0x2d4b0c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x14b5('0x7')](e,emitEvent(event));}}module[_0x14b5('0x8')]=TeamEvents; \ No newline at end of file +var _0x8a21=['update','remove','emit','hasOwnProperty','events','../../mysqldb','Team','setMaxListeners','save'];(function(_0x2ba161,_0x450fc3){var _0x1846ad=function(_0x5aaa8a){while(--_0x5aaa8a){_0x2ba161['push'](_0x2ba161['shift']());}};_0x1846ad(++_0x450fc3);}(_0x8a21,0x112));var _0x18a2=function(_0x4c05da,_0x414720){_0x4c05da=_0x4c05da-0x0;var _0x1614db=_0x8a21[_0x4c05da];return _0x1614db;};'use strict';var EventEmitter=require(_0x18a2('0x0'));var Team=require(_0x18a2('0x1'))['db'][_0x18a2('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x18a2('0x3')](0x0);var events={'afterCreate':_0x18a2('0x4'),'afterUpdate':_0x18a2('0x5'),'afterDestroy':_0x18a2('0x6')};function emitEvent(_0x3f3b5c){return function(_0x5087f1,_0x44e14c,_0x16490d){TeamEvents[_0x18a2('0x7')](_0x3f3b5c+':'+_0x5087f1['id'],_0x5087f1);TeamEvents[_0x18a2('0x7')](_0x3f3b5c,_0x5087f1);_0x16490d(null);};}for(var e in events){if(events[_0x18a2('0x8')](e)){var event=events[e];Team['hook'](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 6734098..1a0d97b 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 _0xbfa1=['Team','teams','Chat','Fax','Mail','Sms','Voice','Whatsapp','lodash','./team.attributes','get','Queues','map','setDataValue','channel','exports','define'];(function(_0x26aee4,_0x530ead){var _0x2e1048=function(_0x2e92db){while(--_0x2e92db){_0x26aee4['push'](_0x26aee4['shift']());}};_0x2e1048(++_0x530ead);}(_0xbfa1,0x1a0));var _0x1bfa=function(_0x6186fc,_0x5bf7ec){_0x6186fc=_0x6186fc-0x0;var _0x3a6753=_0xbfa1[_0x6186fc];return _0x3a6753;};'use strict';var _=require(_0x1bfa('0x0'));var attributes=require(_0x1bfa('0x1'));function getQueuesByChannel(_0x4db712,_0x365249){var _0x2269ae=_0x1bfa('0x2')+_0x365249+_0x1bfa('0x3');return _0x4db712[_0x2269ae]()['then'](function(_0x373b8f){return _[_0x1bfa('0x4')](_0x373b8f,function(_0x5312c3){_0x5312c3[_0x1bfa('0x5')](_0x1bfa('0x6'),_0x365249);return _0x5312c3;});})['catch'](function(_0x62ae6){throw _0x62ae6;});}module[_0x1bfa('0x7')]=function(_0x452dcb){return _0x452dcb[_0x1bfa('0x8')](_0x1bfa('0x9'),attributes,{'tableName':_0x1bfa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x373559=this;var _0x1e7aa4=[_0x1bfa('0xb'),_0x1bfa('0xc'),_0x1bfa('0xd'),'Openchannel',_0x1bfa('0xe'),_0x1bfa('0xf'),_0x1bfa('0x10')];return Promise['resolve']()['then'](function(){var _0x4c1365=_[_0x1bfa('0x4')](_0x1e7aa4,function(_0xf34b62){return getQueuesByChannel(_0x373559,_0xf34b62);});return Promise['all'](_0x4c1365);})['catch'](function(_0x4ce096){throw _0x4ce096;});}}});}; \ No newline at end of file +var _0x2aa8=['catch','lodash','./team.attributes','get','Queues','then','exports','define','Team','teams','Chat','Openchannel','Sms','Voice','Whatsapp','map','all'];(function(_0x449daa,_0x5a1155){var _0x3b7960=function(_0x2f1350){while(--_0x2f1350){_0x449daa['push'](_0x449daa['shift']());}};_0x3b7960(++_0x5a1155);}(_0x2aa8,0xab));var _0x82aa=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2aa8[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x82aa('0x0'));var attributes=require(_0x82aa('0x1'));function getQueuesByChannel(_0x3ff6a2,_0x38da9b){var _0x216a9d=_0x82aa('0x2')+_0x38da9b+_0x82aa('0x3');return _0x3ff6a2[_0x216a9d]()[_0x82aa('0x4')](function(_0x152e5f){return _['map'](_0x152e5f,function(_0x44a1db){_0x44a1db['setDataValue']('channel',_0x38da9b);return _0x44a1db;});})['catch'](function(_0x4349a8){throw _0x4349a8;});}module[_0x82aa('0x5')]=function(_0x46e72f){return _0x46e72f[_0x82aa('0x6')](_0x82aa('0x7'),attributes,{'tableName':_0x82aa('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0xb45663=this;var _0x28011d=[_0x82aa('0x9'),'Fax','Mail',_0x82aa('0xa'),_0x82aa('0xb'),_0x82aa('0xc'),_0x82aa('0xd')];return Promise['resolve']()[_0x82aa('0x4')](function(){var _0x18ae12=_[_0x82aa('0xe')](_0x28011d,function(_0x1e467e){return getQueuesByChannel(_0xb45663,_0x1e467e);});return Promise[_0x82aa('0xf')](_0x18ae12);})[_0x82aa('0x10')](function(_0x282913){throw _0x282913;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index f5f9fca..436f2bf 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 _0x256e=['../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./team.socket','register','then','info','request\x20sent','debug','stringify','error','Team,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5ec15a,_0x598159){var _0x1d73d7=function(_0x20c67c){while(--_0x20c67c){_0x5ec15a['push'](_0x5ec15a['shift']());}};_0x1d73d7(++_0x598159);}(_0x256e,0xd0));var _0xe256=function(_0x19ea9e,_0x17f99c){_0x19ea9e=_0x19ea9e-0x0;var _0x137540=_0x256e[_0x19ea9e];return _0x137540;};'use strict';var _=require(_0xe256('0x0'));var util=require('util');var moment=require(_0xe256('0x1'));var BPromise=require(_0xe256('0x2'));var rs=require(_0xe256('0x3'));var fs=require('fs');var Redis=require(_0xe256('0x4'));var db=require(_0xe256('0x5'))['db'];var utils=require(_0xe256('0x6'));var logger=require(_0xe256('0x7'))('rpc');var config=require(_0xe256('0x8'));var jayson=require(_0xe256('0x9'));var client=jayson[_0xe256('0xa')][_0xe256('0xb')]({'port':0x232a});config['redis']=_[_0xe256('0xc')](config[_0xe256('0xd')],{'host':_0xe256('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe256('0xd')]));require(_0xe256('0xf'))[_0xe256('0x10')](socket);function respondWithRpcPromise(_0x2c69b8,_0x527a89,_0x21ad38){return new BPromise(function(_0x5579a4,_0x517814){return client['request'](_0x2c69b8,_0x21ad38)[_0xe256('0x11')](function(_0x5edfd6){logger[_0xe256('0x12')]('Team,\x20%s,\x20%s',_0x527a89,_0xe256('0x13'));logger[_0xe256('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x527a89,_0xe256('0x13'),JSON[_0xe256('0x15')](_0x5edfd6));if(_0x5edfd6['error']){if(_0x5edfd6['error']['code']===0x1f4){logger[_0xe256('0x16')](_0xe256('0x17'),_0x527a89,_0x5edfd6['error'][_0xe256('0x18')]);return _0x517814(_0x5edfd6[_0xe256('0x16')][_0xe256('0x18')]);}logger[_0xe256('0x16')](_0xe256('0x17'),_0x527a89,_0x5edfd6[_0xe256('0x16')][_0xe256('0x18')]);return _0x5579a4(_0x5edfd6[_0xe256('0x16')]['message']);}else{logger['info'](_0xe256('0x17'),_0x527a89,_0xe256('0x13'));_0x5579a4(_0x5edfd6[_0xe256('0x19')][_0xe256('0x18')]);}})[_0xe256('0x1a')](function(_0x40b7fc){logger[_0xe256('0x16')](_0xe256('0x17'),_0x527a89,_0x40b7fc);_0x517814(_0x40b7fc);});});} \ No newline at end of file +var _0xa631=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x2916f9,_0x195294){var _0x26207d=function(_0x52efd9){while(--_0x52efd9){_0x2916f9['push'](_0x2916f9['shift']());}};_0x26207d(++_0x195294);}(_0xa631,0x103));var _0x1a63=function(_0x4a10c1,_0x565b5d){_0x4a10c1=_0x4a10c1-0x0;var _0x50f854=_0xa631[_0x4a10c1];return _0x50f854;};'use strict';var _=require(_0x1a63('0x0'));var util=require(_0x1a63('0x1'));var moment=require(_0x1a63('0x2'));var BPromise=require(_0x1a63('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a63('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a63('0x5'));var logger=require(_0x1a63('0x6'))(_0x1a63('0x7'));var config=require(_0x1a63('0x8'));var jayson=require(_0x1a63('0x9'));var client=jayson[_0x1a63('0xa')][_0x1a63('0xb')]({'port':0x232a});config[_0x1a63('0xc')]=_[_0x1a63('0xd')](config[_0x1a63('0xc')],{'host':_0x1a63('0xe'),'port':0x18eb});var socket=require(_0x1a63('0xf'))(new Redis(config[_0x1a63('0xc')]));require(_0x1a63('0x10'))[_0x1a63('0x11')](socket);function respondWithRpcPromise(_0x57fc13,_0x5cc6c6,_0x30575e){return new BPromise(function(_0x44c0e3,_0x540d54){return client[_0x1a63('0x12')](_0x57fc13,_0x30575e)['then'](function(_0x183945){logger[_0x1a63('0x13')](_0x1a63('0x14'),_0x5cc6c6,_0x1a63('0x15'));logger[_0x1a63('0x16')](_0x1a63('0x17'),_0x5cc6c6,_0x1a63('0x15'),JSON[_0x1a63('0x18')](_0x183945));if(_0x183945[_0x1a63('0x19')]){if(_0x183945[_0x1a63('0x19')][_0x1a63('0x1a')]===0x1f4){logger[_0x1a63('0x19')](_0x1a63('0x14'),_0x5cc6c6,_0x183945[_0x1a63('0x19')][_0x1a63('0x1b')]);return _0x540d54(_0x183945[_0x1a63('0x19')][_0x1a63('0x1b')]);}logger[_0x1a63('0x19')](_0x1a63('0x14'),_0x5cc6c6,_0x183945[_0x1a63('0x19')][_0x1a63('0x1b')]);return _0x44c0e3(_0x183945[_0x1a63('0x19')][_0x1a63('0x1b')]);}else{logger[_0x1a63('0x13')]('Team,\x20%s,\x20%s',_0x5cc6c6,_0x1a63('0x15'));_0x44c0e3(_0x183945[_0x1a63('0x1c')]['message']);}})['catch'](function(_0x68513d){logger[_0x1a63('0x19')](_0x1a63('0x14'),_0x5cc6c6,_0x68513d);_0x540d54(_0x68513d);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 76062b8..c5061c7 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 _0x135b=['length','./team.events','save','remove','update','removeListener'];(function(_0x57118a,_0x3b7a5a){var _0x5abf56=function(_0x44bb17){while(--_0x44bb17){_0x57118a['push'](_0x57118a['shift']());}};_0x5abf56(++_0x3b7a5a);}(_0x135b,0xaf));var _0xb135=function(_0x3ba537,_0x56b969){_0x3ba537=_0x3ba537-0x0;var _0x585c1a=_0x135b[_0x3ba537];return _0x585c1a;};'use strict';var TeamEvents=require(_0xb135('0x0'));var events=[_0xb135('0x1'),_0xb135('0x2'),_0xb135('0x3')];function createListener(_0x5c1413,_0x41767e){return function(_0x211ffb){_0x41767e['emit'](_0x5c1413,_0x211ffb);};}function removeListener(_0x3b6c51,_0x4dffca){return function(){TeamEvents[_0xb135('0x4')](_0x3b6c51,_0x4dffca);};}exports['register']=function(_0x51a09c){for(var _0x5b96fe=0x0,_0x11780d=events[_0xb135('0x5')];_0x5b96fe<_0x11780d;_0x5b96fe++){var _0x2b57dd=events[_0x5b96fe];var _0xdc547c=createListener('team:'+_0x2b57dd,_0x51a09c);TeamEvents['on'](_0x2b57dd,_0xdc547c);}}; \ No newline at end of file +var _0x252f=['removeListener','register','length','team:','./team.events','save'];(function(_0x543412,_0x4d2bea){var _0x4cab53=function(_0x21519f){while(--_0x21519f){_0x543412['push'](_0x543412['shift']());}};_0x4cab53(++_0x4d2bea);}(_0x252f,0xd0));var _0xf252=function(_0x420a7c,_0x3ef0bc){_0x420a7c=_0x420a7c-0x0;var _0x311c52=_0x252f[_0x420a7c];return _0x311c52;};'use strict';var TeamEvents=require(_0xf252('0x0'));var events=[_0xf252('0x1'),'remove','update'];function createListener(_0x296888,_0x2663b4){return function(_0x57b4a7){_0x2663b4['emit'](_0x296888,_0x57b4a7);};}function removeListener(_0x3c570c,_0x264343){return function(){TeamEvents[_0xf252('0x2')](_0x3c570c,_0x264343);};}exports[_0xf252('0x3')]=function(_0x2e0676){for(var _0x5cbe86=0x0,_0x3fad52=events[_0xf252('0x4')];_0x5cbe86<_0x3fad52;_0x5cbe86++){var _0x271d94=events[_0x5cbe86];var _0xc8ae97=createListener(_0xf252('0x5')+_0x271d94,_0x2e0676);TeamEvents['on'](_0x271d94,_0xc8ae97);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index c4e1d44..0b97b43 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 _0xb404=['INTEGER','sequelize'];(function(_0x35c1f5,_0x2f92fb){var _0x2995b4=function(_0x2e1da7){while(--_0x2e1da7){_0x35c1f5['push'](_0x35c1f5['shift']());}};_0x2995b4(++_0x2f92fb);}(_0xb404,0x123));var _0x4b40=function(_0x1598d4,_0x209b2d){_0x1598d4=_0x1598d4-0x0;var _0x57c770=_0xb404[_0x1598d4];return _0x57c770;};'use strict';var Sequelize=require(_0x4b40('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x4b40('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x4b40('0x1')]}}; \ No newline at end of file +var _0xa79e=['INTEGER','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa79e,0xf7));var _0xea79=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0xa79e[_0x236c89];return _0x3b2a15;};'use strict';var Sequelize=require(_0xea79('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0xea79('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xea79('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index feaad15..de315b3 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 _0xcb9c=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','lodash'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xcb9c,0x110));var _0xccb9=function(_0x3b0ac0,_0x1eb671){_0x3b0ac0=_0x3b0ac0-0x0;var _0x30cc4d=_0xcb9c[_0x3b0ac0];return _0x30cc4d;};'use strict';var _=require(_0xccb9('0x0'));var util=require(_0xccb9('0x1'));var logger=require(_0xccb9('0x2'))(_0xccb9('0x3'));var moment=require(_0xccb9('0x4'));var BPromise=require(_0xccb9('0x5'));var rp=require(_0xccb9('0x6'));var fs=require('fs');var path=require(_0xccb9('0x7'));var rimraf=require('rimraf');var config=require(_0xccb9('0x8'));var attributes=require(_0xccb9('0x9'));module[_0xccb9('0xa')]=function(_0x5bb0e5,_0x34a3da){return _0x5bb0e5[_0xccb9('0xb')](_0xccb9('0xc'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7b5=['path','rimraf','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xa7b5,0x162));var _0x5a7b=function(_0x542da3,_0x369391){_0x542da3=_0x542da3-0x0;var _0x3a1740=_0xa7b5[_0x542da3];return _0x3a1740;};'use strict';var _=require(_0x5a7b('0x0'));var util=require(_0x5a7b('0x1'));var logger=require(_0x5a7b('0x2'))(_0x5a7b('0x3'));var moment=require(_0x5a7b('0x4'));var BPromise=require('bluebird');var rp=require(_0x5a7b('0x5'));var fs=require('fs');var path=require(_0x5a7b('0x6'));var rimraf=require(_0x5a7b('0x7'));var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module[_0x5a7b('0x8')]=function(_0x204212,_0x4899da){return _0x204212[_0x5a7b('0x9')](_0x5a7b('0xa'),attributes,{'tableName':_0x5a7b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 2de4ab4..5f727af 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3a76f0,_0x3060e9){var _0x9e5222=function(_0x31c154){while(--_0x31c154){_0x3a76f0['push'](_0x3a76f0['shift']());}};_0x9e5222(++_0x3060e9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x465db0,_0x6cad00){var _0x25c194=function(_0x87caf2){while(--_0x87caf2){_0x465db0['push'](_0x465db0['shift']());}};_0x25c194(++_0x6cad00);}(_0xedd9,0xfc));var _0x9edd=function(_0x4591db,_0x1182cb){_0x4591db=_0x4591db-0x0;var _0x5891ed=_0xedd9[_0x4591db];return _0x5891ed;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 46893a9..16dd93c 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 _0xd68d=['exports','sequelize'];(function(_0x29861c,_0x408d8d){var _0xdc50dc=function(_0x63ed50){while(--_0x63ed50){_0x29861c['push'](_0x29861c['shift']());}};_0xdc50dc(++_0x408d8d);}(_0xd68d,0x7f));var _0xdd68=function(_0x110801,_0x49c972){_0x110801=_0x110801-0x0;var _0x37d3db=_0xd68d[_0x110801];return _0x37d3db;};'use strict';var Sequelize=require(_0xdd68('0x0'));module[_0xdd68('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0c29=['INTEGER'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0c29,0xb7));var _0x90c2=function(_0x49fcfb,_0x504dec){_0x49fcfb=_0x49fcfb-0x0;var _0x964926=_0x0c29[_0x49fcfb];return _0x964926;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x90c2('0x0')],'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 44680b7..9acd0c1 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 _0x36f1=['request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','moment','bluebird'];(function(_0x17f153,_0x5491fc){var _0x430136=function(_0x2700f2){while(--_0x2700f2){_0x17f153['push'](_0x17f153['shift']());}};_0x430136(++_0x5491fc);}(_0x36f1,0xb0));var _0x136f=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x36f1[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x136f('0x0'));var util=require('util');var logger=require(_0x136f('0x1'))('api');var moment=require(_0x136f('0x2'));var BPromise=require(_0x136f('0x3'));var rp=require(_0x136f('0x4'));var fs=require('fs');var path=require(_0x136f('0x5'));var rimraf=require(_0x136f('0x6'));var config=require(_0x136f('0x7'));var attributes=require(_0x136f('0x8'));module[_0x136f('0x9')]=function(_0x5b00b5,_0x430433){return _0x5b00b5['define'](_0x136f('0xa'),attributes,{'tableName':_0x136f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b2d=['moment','bluebird','path','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','../../config/logger'];(function(_0x49cfcc,_0xf15540){var _0x44d1cc=function(_0x20eab9){while(--_0x20eab9){_0x49cfcc['push'](_0x49cfcc['shift']());}};_0x44d1cc(++_0xf15540);}(_0x8b2d,0xe5));var _0xd8b2=function(_0x3f9ea9,_0x19840d){_0x3f9ea9=_0x3f9ea9-0x0;var _0x291e7f=_0x8b2d[_0x3f9ea9];return _0x291e7f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd8b2('0x0'))('api');var moment=require(_0xd8b2('0x1'));var BPromise=require(_0xd8b2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd8b2('0x3'));var rimraf=require(_0xd8b2('0x4'));var config=require('../../config/environment');var attributes=require(_0xd8b2('0x5'));module[_0xd8b2('0x6')]=function(_0x36eb23,_0x282a58){return _0x36eb23[_0xd8b2('0x7')](_0xd8b2('0x8'),attributes,{'tableName':_0xd8b2('0x9'),'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 d2df2cf..d4760fb 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 _0x296f=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','http','request','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x291cf3,_0x5be25a){var _0x2987fa=function(_0x189b40){while(--_0x189b40){_0x291cf3['push'](_0x291cf3['shift']());}};_0x2987fa(++_0x5be25a);}(_0x296f,0xf0));var _0xf296=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0x296f[_0x46efd7];return _0x5637e4;};'use strict';var _=require(_0xf296('0x0'));var util=require(_0xf296('0x1'));var moment=require(_0xf296('0x2'));var BPromise=require(_0xf296('0x3'));var rs=require(_0xf296('0x4'));var fs=require('fs');var Redis=require(_0xf296('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf296('0x6'))(_0xf296('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf296('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x325b39,_0x5123d3,_0x300f99){return new BPromise(function(_0x3197bc,_0x4b05c5){return client[_0xf296('0x9')](_0x325b39,_0x300f99)['then'](function(_0x1ec8cc){logger[_0xf296('0xa')](_0xf296('0xb'),_0x5123d3,'request\x20sent');logger[_0xf296('0xc')](_0xf296('0xd'),_0x5123d3,_0xf296('0xe'),JSON['stringify'](_0x1ec8cc));if(_0x1ec8cc[_0xf296('0xf')]){if(_0x1ec8cc[_0xf296('0xf')][_0xf296('0x10')]===0x1f4){logger[_0xf296('0xf')](_0xf296('0xb'),_0x5123d3,_0x1ec8cc['error']['message']);return _0x4b05c5(_0x1ec8cc[_0xf296('0xf')][_0xf296('0x11')]);}logger['error'](_0xf296('0xb'),_0x5123d3,_0x1ec8cc[_0xf296('0xf')]['message']);return _0x3197bc(_0x1ec8cc[_0xf296('0xf')][_0xf296('0x11')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x5123d3,'request\x20sent');_0x3197bc(_0x1ec8cc[_0xf296('0x12')][_0xf296('0x11')]);}})[_0xf296('0x13')](function(_0x3d3225){logger[_0xf296('0xf')](_0xf296('0xb'),_0x5123d3,_0x3d3225);_0x4b05c5(_0x3d3225);});});} \ No newline at end of file +var _0xc122=['http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x41e745,_0x4e3812){var _0x5dcd2b=function(_0x20e3c6){while(--_0x20e3c6){_0x41e745['push'](_0x41e745['shift']());}};_0x5dcd2b(++_0x4e3812);}(_0xc122,0x1b9));var _0x2c12=function(_0x29d808,_0x1b1056){_0x29d808=_0x29d808-0x0;var _0x3ff7cd=_0xc122[_0x29d808];return _0x3ff7cd;};'use strict';var _=require('lodash');var util=require(_0x2c12('0x0'));var moment=require(_0x2c12('0x1'));var BPromise=require(_0x2c12('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c12('0x3'));var db=require(_0x2c12('0x4'))['db'];var utils=require(_0x2c12('0x5'));var logger=require('../../config/logger')(_0x2c12('0x6'));var config=require(_0x2c12('0x7'));var jayson=require(_0x2c12('0x8'));var client=jayson['client'][_0x2c12('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x301600,_0x335c1e,_0x13b39b){return new BPromise(function(_0x122409,_0x10bbf3){return client['request'](_0x301600,_0x13b39b)[_0x2c12('0xa')](function(_0x1d109e){logger[_0x2c12('0xb')](_0x2c12('0xc'),_0x335c1e,_0x2c12('0xd'));logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x335c1e,_0x2c12('0xd'),JSON['stringify'](_0x1d109e));if(_0x1d109e['error']){if(_0x1d109e['error']['code']===0x1f4){logger[_0x2c12('0xe')](_0x2c12('0xc'),_0x335c1e,_0x1d109e[_0x2c12('0xe')][_0x2c12('0xf')]);return _0x10bbf3(_0x1d109e[_0x2c12('0xe')]['message']);}logger[_0x2c12('0xe')](_0x2c12('0xc'),_0x335c1e,_0x1d109e['error']['message']);return _0x122409(_0x1d109e[_0x2c12('0xe')][_0x2c12('0xf')]);}else{logger[_0x2c12('0xb')](_0x2c12('0xc'),_0x335c1e,'request\x20sent');_0x122409(_0x1d109e[_0x2c12('0x10')][_0x2c12('0xf')]);}})[_0x2c12('0x11')](function(_0x3d2828){logger[_0x2c12('0xe')](_0x2c12('0xc'),_0x335c1e,_0x3d2828);_0x10bbf3(_0x3d2828);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 4793650..e8f74cf 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 _0x0447=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','exports','multer'];(function(_0x56b288,_0x1ed5ac){var _0x355ae0=function(_0x44b808){while(--_0x44b808){_0x56b288['push'](_0x56b288['shift']());}};_0x355ae0(++_0x1ed5ac);}(_0x0447,0x8b));var _0x7044=function(_0x59f655,_0x1c12aa){_0x59f655=_0x59f655-0x0;var _0x1dbb6e=_0x0447[_0x59f655];return _0x1dbb6e;};'use strict';var multer=require(_0x7044('0x0'));var util=require(_0x7044('0x1'));var path=require(_0x7044('0x2'));var timeout=require(_0x7044('0x3'));var express=require(_0x7044('0x4'));var router=express['Router']();var fs_extra=require(_0x7044('0x5'));var auth=require(_0x7044('0x6'));var interaction=require(_0x7044('0x7'));var config=require(_0x7044('0x8'));var controller=require(_0x7044('0x9'));router[_0x7044('0xa')]('/',auth[_0x7044('0xb')](),controller[_0x7044('0xc')]);router[_0x7044('0xa')]('/:id',auth[_0x7044('0xb')](),controller[_0x7044('0xd')]);router[_0x7044('0xe')]('/',auth[_0x7044('0xb')](),controller['create']);router[_0x7044('0xf')](_0x7044('0x10'),auth['isAuthenticated'](),controller[_0x7044('0x11')]);router[_0x7044('0x12')](_0x7044('0x10'),auth[_0x7044('0xb')](),controller['destroy']);module[_0x7044('0x13')]=router; \ No newline at end of file +var _0x82d8=['get','isAuthenticated','index','/:id','post','create','delete','exports','multer','path','Router','../../components/auth/service','./template.controller'];(function(_0x37b191,_0x261c0d){var _0x2acbce=function(_0x184fed){while(--_0x184fed){_0x37b191['push'](_0x37b191['shift']());}};_0x2acbce(++_0x261c0d);}(_0x82d8,0xff));var _0x882d=function(_0x162bf5,_0x197406){_0x162bf5=_0x162bf5-0x0;var _0x4f45aa=_0x82d8[_0x162bf5];return _0x4f45aa;};'use strict';var multer=require(_0x882d('0x0'));var util=require('util');var path=require(_0x882d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x882d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x882d('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x882d('0x4'));router[_0x882d('0x5')]('/',auth[_0x882d('0x6')](),controller[_0x882d('0x7')]);router[_0x882d('0x5')](_0x882d('0x8'),auth[_0x882d('0x6')](),controller['show']);router[_0x882d('0x9')]('/',auth[_0x882d('0x6')](),controller[_0x882d('0xa')]);router['put'](_0x882d('0x8'),auth[_0x882d('0x6')](),controller['update']);router[_0x882d('0xb')](_0x882d('0x8'),auth[_0x882d('0x6')](),controller['destroy']);module[_0x882d('0xc')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 03f1c04..5f969fb 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 _0xb52f=['STRING','TEXT'];(function(_0x5a04cd,_0x3c2206){var _0xd2d6c8=function(_0x363f2a){while(--_0x363f2a){_0x5a04cd['push'](_0x5a04cd['shift']());}};_0xd2d6c8(++_0x3c2206);}(_0xb52f,0x158));var _0xfb52=function(_0x3de5b7,_0x3d540a){_0x3de5b7=_0x3de5b7-0x0;var _0x2dad16=_0xb52f[_0x3de5b7];return _0x2dad16;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfb52('0x0')]},'description':{'type':Sequelize[_0xfb52('0x0')]},'html':{'type':Sequelize[_0xfb52('0x1')]}}; \ No newline at end of file +var _0x0735=['sequelize','exports','STRING','TEXT'];(function(_0x15ce85,_0x1a1bbe){var _0x56e90b=function(_0x53ed0d){while(--_0x53ed0d){_0x15ce85['push'](_0x15ce85['shift']());}};_0x56e90b(++_0x1a1bbe);}(_0x0735,0x1c0));var _0x5073=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0735[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x5073('0x0'));module[_0x5073('0x1')]={'name':{'type':Sequelize[_0x5073('0x2')]},'description':{'type':Sequelize[_0x5073('0x2')]},'html':{'type':Sequelize[_0x5073('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 004e047..07dc314 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 _0x214d=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','count','set','json','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','model','query'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0x214d,0xbb));var _0xd214=function(_0x4a65cb,_0x35e3ae){_0x4a65cb=_0x4a65cb-0x0;var _0x5185e6=_0x214d[_0x4a65cb];return _0x5185e6;};'use strict';var emlformat=require(_0xd214('0x0'));var rimraf=require(_0xd214('0x1'));var zipdir=require(_0xd214('0x2'));var jsonpatch=require(_0xd214('0x3'));var rp=require('request-promise');var moment=require(_0xd214('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd214('0x5'));var util=require(_0xd214('0x6'));var path=require(_0xd214('0x7'));var sox=require(_0xd214('0x8'));var csv=require(_0xd214('0x9'));var ejs=require(_0xd214('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('desk.js');var toCsv=require(_0xd214('0x9'));var querystring=require('querystring');var Papa=require(_0xd214('0xb'));var Redis=require(_0xd214('0xc'));var authService=require(_0xd214('0xd'));var qs=require(_0xd214('0xe'));var as=require(_0xd214('0xf'));var hardwareService=require(_0xd214('0x10'));var logger=require(_0xd214('0x11'))(_0xd214('0x12'));var utils=require('../../config/utils');var config=require(_0xd214('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd214('0x14'))['db'];function respondWithStatusCode(_0x367bd1,_0x225f58){_0x225f58=_0x225f58||0xcc;return function(_0xb20eed){if(_0xb20eed){return _0x367bd1[_0xd214('0x15')](_0x225f58);}return _0x367bd1['status'](_0x225f58)[_0xd214('0x16')]();};}function respondWithResult(_0x497cd3,_0x4f354b){_0x4f354b=_0x4f354b||0xc8;return function(_0x51d2cc){if(_0x51d2cc){return _0x497cd3[_0xd214('0x17')](_0x4f354b)['json'](_0x51d2cc);}};}function respondWithFilteredResult(_0x6419be,_0x3b475c){return function(_0x206389){if(_0x206389){var _0x59852f=typeof _0x3b475c['offset']===_0xd214('0x18')&&typeof _0x3b475c['limit']===_0xd214('0x18');var _0x579354=_0x206389['count'];var _0x3ce24c=_0x59852f?0x0:_0x3b475c[_0xd214('0x19')];var _0x146ab1=_0x59852f?_0x206389[_0xd214('0x1a')]:_0x3b475c[_0xd214('0x19')]+_0x3b475c['limit'];var _0x1c7ca7;if(_0x146ab1>=_0x579354){_0x146ab1=_0x579354;_0x1c7ca7=0xc8;}else{_0x1c7ca7=0xce;}_0x6419be[_0xd214('0x17')](_0x1c7ca7);return _0x6419be[_0xd214('0x1b')]('Content-Range',_0x3ce24c+'-'+_0x146ab1+'/'+_0x579354)[_0xd214('0x1c')](_0x206389);}return null;};}function patchUpdates(_0x23046c){return function(_0x5d03be){try{jsonpatch['apply'](_0x5d03be,_0x23046c,!![]);}catch(_0x4bf39d){return BPromise['reject'](_0x4bf39d);}return _0x5d03be[_0xd214('0x1d')]();};}function saveUpdates(_0x2a3c04,_0x177c4c){return function(_0x106e32){if(_0x106e32){return _0x106e32[_0xd214('0x1e')](_0x2a3c04)[_0xd214('0x1f')](function(_0x190118){return _0x190118;});}return null;};}function removeEntity(_0x2f2d06,_0x273827){return function(_0x5bd49b){if(_0x5bd49b){return _0x5bd49b[_0xd214('0x20')]()['then'](function(){var _0x2755ff=_0x5bd49b[_0xd214('0x21')]({'plain':!![]});var _0x621cd9='Templates';return db[_0xd214('0x22')][_0xd214('0x20')]({'where':{'type':_0x621cd9,'resourceId':_0x2755ff['id']}})[_0xd214('0x1f')](function(){return _0x5bd49b;});})['then'](function(){_0x2f2d06[_0xd214('0x17')](0xcc)[_0xd214('0x16')]();});}};}function handleEntityNotFound(_0x270654,_0x127fa3){return function(_0x2dcb1b){if(!_0x2dcb1b){_0x270654[_0xd214('0x15')](0x194);}return _0x2dcb1b;};}function handleError(_0x1322aa,_0xf2a067){_0xf2a067=_0xf2a067||0x1f4;return function(_0xa50f03){logger[_0xd214('0x23')](_0xa50f03[_0xd214('0x24')]);if(_0xa50f03[_0xd214('0x25')]){delete _0xa50f03[_0xd214('0x25')];}_0x1322aa[_0xd214('0x17')](_0xf2a067)[_0xd214('0x26')](_0xa50f03);};}exports[_0xd214('0x27')]=function(_0x1981d8,_0x20da25){var _0x9c9018={},_0x527e40={},_0x3b1520={'count':0x0,'rows':[]};var _0x4be491=_[_0xd214('0x28')](db[_0xd214('0x29')][_0xd214('0x2a')],function(_0x48d3cb){return{'name':_0x48d3cb[_0xd214('0x2b')],'type':_0x48d3cb[_0xd214('0x2c')]['key']};});_0x527e40[_0xd214('0x2d')]=_[_0xd214('0x28')](_0x4be491,_0xd214('0x25'));_0x527e40[_0xd214('0x2e')]=_[_0xd214('0x2f')](_0x1981d8[_0xd214('0x2e')]);_0x527e40[_0xd214('0x30')]=_[_0xd214('0x31')](_0x527e40[_0xd214('0x2d')],_0x527e40[_0xd214('0x2e')]);_0x9c9018['attributes']=_[_0xd214('0x31')](_0x527e40[_0xd214('0x2d')],qs[_0xd214('0x32')](_0x1981d8[_0xd214('0x2e')][_0xd214('0x32')]));_0x9c9018[_0xd214('0x33')]=_0x9c9018[_0xd214('0x33')][_0xd214('0x34')]?_0x9c9018['attributes']:_0x527e40[_0xd214('0x2d')];if(!_0x1981d8[_0xd214('0x2e')][_0xd214('0x35')]('nolimit')){_0x9c9018[_0xd214('0x36')]=qs[_0xd214('0x36')](_0x1981d8[_0xd214('0x2e')][_0xd214('0x36')]);_0x9c9018[_0xd214('0x19')]=qs[_0xd214('0x19')](_0x1981d8[_0xd214('0x2e')][_0xd214('0x19')]);}_0x9c9018[_0xd214('0x37')]=qs[_0xd214('0x38')](_0x1981d8[_0xd214('0x2e')][_0xd214('0x38')]);_0x9c9018[_0xd214('0x39')]=qs[_0xd214('0x30')](_[_0xd214('0x3a')](_0x1981d8[_0xd214('0x2e')],_0x527e40[_0xd214('0x30')]),_0x4be491);if(_0x1981d8[_0xd214('0x2e')][_0xd214('0x3b')]){_0x9c9018[_0xd214('0x39')]=_['merge'](_0x9c9018[_0xd214('0x39')],{'$or':_[_0xd214('0x28')](_0x4be491,function(_0x55cdd5){if(_0x55cdd5[_0xd214('0x2c')]!==_0xd214('0x3c')){var _0x29a2ae={};_0x29a2ae[_0x55cdd5['name']]={'$like':'%'+_0x1981d8['query'][_0xd214('0x3b')]+'%'};return _0x29a2ae;}})});}_0x9c9018=_[_0xd214('0x3d')]({},_0x9c9018,_0x1981d8[_0xd214('0x3e')]);var _0x482f73={'where':_0x9c9018['where']};return db[_0xd214('0x29')][_0xd214('0x1a')](_0x482f73)['then'](function(_0x1d4f28){_0x3b1520[_0xd214('0x1a')]=_0x1d4f28;if(_0x1981d8[_0xd214('0x2e')]['includeAll']){_0x9c9018[_0xd214('0x3f')]=[{'all':!![]}];}return db[_0xd214('0x29')][_0xd214('0x40')](_0x9c9018);})[_0xd214('0x1f')](function(_0x5d534a){_0x3b1520['rows']=_0x5d534a;return _0x3b1520;})[_0xd214('0x1f')](respondWithFilteredResult(_0x20da25,_0x9c9018))[_0xd214('0x41')](handleError(_0x20da25,null));};exports[_0xd214('0x42')]=function(_0x3ee1f4,_0x3313ff){var _0x538970={'raw':!![],'where':{'id':_0x3ee1f4['params']['id']}},_0x1f658b={};_0x1f658b[_0xd214('0x2d')]=_['keys'](db[_0xd214('0x29')]['rawAttributes']);_0x1f658b['query']=_[_0xd214('0x2f')](_0x3ee1f4[_0xd214('0x2e')]);_0x1f658b[_0xd214('0x30')]=_[_0xd214('0x31')](_0x1f658b[_0xd214('0x2d')],_0x1f658b[_0xd214('0x2e')]);_0x538970[_0xd214('0x33')]=_['intersection'](_0x1f658b[_0xd214('0x2d')],qs['fields'](_0x3ee1f4[_0xd214('0x2e')]['fields']));_0x538970[_0xd214('0x33')]=_0x538970[_0xd214('0x33')][_0xd214('0x34')]?_0x538970[_0xd214('0x33')]:_0x1f658b[_0xd214('0x2d')];if(_0x3ee1f4['query'][_0xd214('0x43')]){_0x538970['include']=[{'all':!![]}];}_0x538970=_[_0xd214('0x3d')]({},_0x538970,_0x3ee1f4[_0xd214('0x3e')]);return db[_0xd214('0x29')][_0xd214('0x44')](_0x538970)[_0xd214('0x1f')](handleEntityNotFound(_0x3313ff,null))[_0xd214('0x1f')](respondWithResult(_0x3313ff,null))[_0xd214('0x41')](handleError(_0x3313ff,null));};exports[_0xd214('0x45')]=function(_0x1ad3ee,_0x5e21f5){return db[_0xd214('0x29')][_0xd214('0x45')](_0x1ad3ee[_0xd214('0x46')],{})[_0xd214('0x1f')](function(_0x1078c4){var _0x1ae623=_0x1ad3ee[_0xd214('0x47')][_0xd214('0x21')]({'plain':!![]});if(!_0x1ae623)throw new Error(_0xd214('0x48'));if(_0x1ae623['role']===_0xd214('0x47')){var _0x1a6ac6=_0x1078c4[_0xd214('0x21')]({'plain':!![]});var _0x20a1ac='Templates';return db[_0xd214('0x49')]['find']({'where':{'name':_0x20a1ac,'userProfileId':_0x1ae623[_0xd214('0x4a')]},'raw':!![]})[_0xd214('0x1f')](function(_0x444451){if(_0x444451&&_0x444451[_0xd214('0x4b')]===0x0){return db[_0xd214('0x22')][_0xd214('0x45')]({'name':_0x1a6ac6['name'],'resourceId':_0x1a6ac6['id'],'type':_0x444451['name'],'sectionId':_0x444451['id']},{})[_0xd214('0x1f')](function(){return _0x1078c4;});}else{return _0x1078c4;}})[_0xd214('0x41')](function(_0x16ce2c){logger['error'](_0xd214('0x4c'),_0x16ce2c);throw _0x16ce2c;});}return _0x1078c4;})[_0xd214('0x1f')](respondWithResult(_0x5e21f5,0xc9))[_0xd214('0x41')](handleError(_0x5e21f5,null));};exports[_0xd214('0x1e')]=function(_0x416956,_0xea8565){if(_0x416956[_0xd214('0x46')]['id']){delete _0x416956[_0xd214('0x46')]['id'];}return db['Template'][_0xd214('0x44')]({'where':{'id':_0x416956[_0xd214('0x4d')]['id']}})['then'](handleEntityNotFound(_0xea8565,null))[_0xd214('0x1f')](saveUpdates(_0x416956[_0xd214('0x46')],null))[_0xd214('0x1f')](respondWithResult(_0xea8565,null))[_0xd214('0x41')](handleError(_0xea8565,null));};exports[_0xd214('0x20')]=function(_0x445f06,_0x459305){return db[_0xd214('0x29')]['find']({'where':{'id':_0x445f06[_0xd214('0x4d')]['id']}})['then'](handleEntityNotFound(_0x459305,null))[_0xd214('0x1f')](removeEntity(_0x459305,null))['catch'](handleError(_0x459305,null));}; \ No newline at end of file +var _0x982d=['../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','Template','includeAll','include','findAll','rows','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','catch','params','eml-format','zip-dir','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','../../config/utils','../../config/environment'];(function(_0x1b0333,_0x42c267){var _0x1450fb=function(_0xfb8548){while(--_0xfb8548){_0x1b0333['push'](_0x1b0333['shift']());}};_0x1450fb(++_0x42c267);}(_0x982d,0x13a));var _0xd982=function(_0x51405b,_0x1b3ba1){_0x51405b=_0x51405b-0x0;var _0x2fac2d=_0x982d[_0x51405b];return _0x2fac2d;};'use strict';var emlformat=require(_0xd982('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd982('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd982('0x2'));var path=require(_0xd982('0x3'));var sox=require(_0xd982('0x4'));var csv=require(_0xd982('0x5'));var ejs=require(_0xd982('0x6'));var fs=require('fs');var fs_extra=require(_0xd982('0x7'));var _=require(_0xd982('0x8'));var squel=require(_0xd982('0x9'));var crypto=require(_0xd982('0xa'));var jsforce=require(_0xd982('0xb'));var deskjs=require(_0xd982('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd982('0xd'));var Papa=require(_0xd982('0xe'));var Redis=require(_0xd982('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd982('0x10'));var as=require(_0xd982('0x11'));var hardwareService=require(_0xd982('0x12'));var logger=require(_0xd982('0x13'))('api');var utils=require(_0xd982('0x14'));var config=require(_0xd982('0x15'));var licenseUtil=require(_0xd982('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7f9e7,_0xdec5bd){_0xdec5bd=_0xdec5bd||0xcc;return function(_0x3bd7e1){if(_0x3bd7e1){return _0x7f9e7['sendStatus'](_0xdec5bd);}return _0x7f9e7[_0xd982('0x17')](_0xdec5bd)[_0xd982('0x18')]();};}function respondWithResult(_0x164858,_0x1d7378){_0x1d7378=_0x1d7378||0xc8;return function(_0x5854da){if(_0x5854da){return _0x164858[_0xd982('0x17')](_0x1d7378)[_0xd982('0x19')](_0x5854da);}};}function respondWithFilteredResult(_0x481f73,_0x341e52){return function(_0x439a81){if(_0x439a81){var _0x1bb230=typeof _0x341e52[_0xd982('0x1a')]==='undefined'&&typeof _0x341e52[_0xd982('0x1b')]===_0xd982('0x1c');var _0x42dcf1=_0x439a81[_0xd982('0x1d')];var _0x343562=_0x1bb230?0x0:_0x341e52['offset'];var _0x455161=_0x1bb230?_0x439a81[_0xd982('0x1d')]:_0x341e52[_0xd982('0x1a')]+_0x341e52[_0xd982('0x1b')];var _0x38b4f8;if(_0x455161>=_0x42dcf1){_0x455161=_0x42dcf1;_0x38b4f8=0xc8;}else{_0x38b4f8=0xce;}_0x481f73[_0xd982('0x17')](_0x38b4f8);return _0x481f73[_0xd982('0x1e')](_0xd982('0x1f'),_0x343562+'-'+_0x455161+'/'+_0x42dcf1)[_0xd982('0x19')](_0x439a81);}return null;};}function patchUpdates(_0x15f377){return function(_0x1ebb3f){try{jsonpatch[_0xd982('0x20')](_0x1ebb3f,_0x15f377,!![]);}catch(_0x313227){return BPromise[_0xd982('0x21')](_0x313227);}return _0x1ebb3f[_0xd982('0x22')]();};}function saveUpdates(_0x382a14,_0x48e42f){return function(_0xed81c5){if(_0xed81c5){return _0xed81c5[_0xd982('0x23')](_0x382a14)[_0xd982('0x24')](function(_0x2e3a19){return _0x2e3a19;});}return null;};}function removeEntity(_0x495046,_0x172806){return function(_0x31db27){if(_0x31db27){return _0x31db27['destroy']()[_0xd982('0x24')](function(){var _0x356162=_0x31db27[_0xd982('0x25')]({'plain':!![]});var _0x464e69=_0xd982('0x26');return db[_0xd982('0x27')][_0xd982('0x28')]({'where':{'type':_0x464e69,'resourceId':_0x356162['id']}})[_0xd982('0x24')](function(){return _0x31db27;});})['then'](function(){_0x495046[_0xd982('0x17')](0xcc)[_0xd982('0x18')]();});}};}function handleEntityNotFound(_0x1d0e5d,_0x27ea40){return function(_0x102957){if(!_0x102957){_0x1d0e5d[_0xd982('0x29')](0x194);}return _0x102957;};}function handleError(_0x301472,_0x5a26be){_0x5a26be=_0x5a26be||0x1f4;return function(_0x19c446){logger[_0xd982('0x2a')](_0x19c446[_0xd982('0x2b')]);if(_0x19c446[_0xd982('0x2c')]){delete _0x19c446['name'];}_0x301472[_0xd982('0x17')](_0x5a26be)[_0xd982('0x2d')](_0x19c446);};}exports[_0xd982('0x2e')]=function(_0xb08607,_0x192f89){var _0x385d48={},_0x1436de={},_0x3f59e9={'count':0x0,'rows':[]};var _0x511cfe=_[_0xd982('0x2f')](db['Template'][_0xd982('0x30')],function(_0x5f1235){return{'name':_0x5f1235[_0xd982('0x31')],'type':_0x5f1235[_0xd982('0x32')][_0xd982('0x33')]};});_0x1436de[_0xd982('0x34')]=_[_0xd982('0x2f')](_0x511cfe,_0xd982('0x2c'));_0x1436de[_0xd982('0x35')]=_[_0xd982('0x36')](_0xb08607[_0xd982('0x35')]);_0x1436de[_0xd982('0x37')]=_[_0xd982('0x38')](_0x1436de[_0xd982('0x34')],_0x1436de[_0xd982('0x35')]);_0x385d48['attributes']=_[_0xd982('0x38')](_0x1436de[_0xd982('0x34')],qs[_0xd982('0x39')](_0xb08607[_0xd982('0x35')][_0xd982('0x39')]));_0x385d48[_0xd982('0x3a')]=_0x385d48[_0xd982('0x3a')][_0xd982('0x3b')]?_0x385d48[_0xd982('0x3a')]:_0x1436de['model'];if(!_0xb08607[_0xd982('0x35')][_0xd982('0x3c')](_0xd982('0x3d'))){_0x385d48[_0xd982('0x1b')]=qs[_0xd982('0x1b')](_0xb08607[_0xd982('0x35')]['limit']);_0x385d48[_0xd982('0x1a')]=qs[_0xd982('0x1a')](_0xb08607[_0xd982('0x35')][_0xd982('0x1a')]);}_0x385d48[_0xd982('0x3e')]=qs[_0xd982('0x3f')](_0xb08607[_0xd982('0x35')]['sort']);_0x385d48['where']=qs[_0xd982('0x37')](_[_0xd982('0x40')](_0xb08607[_0xd982('0x35')],_0x1436de['filters']),_0x511cfe);if(_0xb08607[_0xd982('0x35')][_0xd982('0x41')]){_0x385d48[_0xd982('0x42')]=_['merge'](_0x385d48[_0xd982('0x42')],{'$or':_[_0xd982('0x2f')](_0x511cfe,function(_0x2e8c65){if(_0x2e8c65['type']!=='VIRTUAL'){var _0x19ac2f={};_0x19ac2f[_0x2e8c65[_0xd982('0x2c')]]={'$like':'%'+_0xb08607[_0xd982('0x35')][_0xd982('0x41')]+'%'};return _0x19ac2f;}})});}_0x385d48=_[_0xd982('0x43')]({},_0x385d48,_0xb08607[_0xd982('0x44')]);var _0x1531d4={'where':_0x385d48[_0xd982('0x42')]};return db[_0xd982('0x45')]['count'](_0x1531d4)[_0xd982('0x24')](function(_0x11abb3){_0x3f59e9[_0xd982('0x1d')]=_0x11abb3;if(_0xb08607['query'][_0xd982('0x46')]){_0x385d48[_0xd982('0x47')]=[{'all':!![]}];}return db[_0xd982('0x45')][_0xd982('0x48')](_0x385d48);})[_0xd982('0x24')](function(_0x4567d1){_0x3f59e9[_0xd982('0x49')]=_0x4567d1;return _0x3f59e9;})[_0xd982('0x24')](respondWithFilteredResult(_0x192f89,_0x385d48))['catch'](handleError(_0x192f89,null));};exports[_0xd982('0x4a')]=function(_0x87726b,_0x363908){var _0x44cd0f={'raw':!![],'where':{'id':_0x87726b['params']['id']}},_0x505e7d={};_0x505e7d[_0xd982('0x34')]=_[_0xd982('0x36')](db[_0xd982('0x45')][_0xd982('0x30')]);_0x505e7d[_0xd982('0x35')]=_[_0xd982('0x36')](_0x87726b[_0xd982('0x35')]);_0x505e7d[_0xd982('0x37')]=_[_0xd982('0x38')](_0x505e7d[_0xd982('0x34')],_0x505e7d[_0xd982('0x35')]);_0x44cd0f[_0xd982('0x3a')]=_['intersection'](_0x505e7d[_0xd982('0x34')],qs['fields'](_0x87726b[_0xd982('0x35')][_0xd982('0x39')]));_0x44cd0f[_0xd982('0x3a')]=_0x44cd0f[_0xd982('0x3a')][_0xd982('0x3b')]?_0x44cd0f[_0xd982('0x3a')]:_0x505e7d[_0xd982('0x34')];if(_0x87726b[_0xd982('0x35')][_0xd982('0x46')]){_0x44cd0f[_0xd982('0x47')]=[{'all':!![]}];}_0x44cd0f=_[_0xd982('0x43')]({},_0x44cd0f,_0x87726b['options']);return db['Template']['find'](_0x44cd0f)[_0xd982('0x24')](handleEntityNotFound(_0x363908,null))[_0xd982('0x24')](respondWithResult(_0x363908,null))['catch'](handleError(_0x363908,null));};exports[_0xd982('0x4b')]=function(_0x1ba01d,_0x11ae4d){return db['Template'][_0xd982('0x4b')](_0x1ba01d[_0xd982('0x4c')],{})[_0xd982('0x24')](function(_0x18ac0d){var _0x4e85d6=_0x1ba01d['user'][_0xd982('0x25')]({'plain':!![]});if(!_0x4e85d6)throw new Error(_0xd982('0x4d'));if(_0x4e85d6[_0xd982('0x4e')]==='user'){var _0x4fd506=_0x18ac0d[_0xd982('0x25')]({'plain':!![]});var _0x4e854f=_0xd982('0x26');return db['UserProfileSection'][_0xd982('0x4f')]({'where':{'name':_0x4e854f,'userProfileId':_0x4e85d6[_0xd982('0x50')]},'raw':!![]})['then'](function(_0x2f032e){if(_0x2f032e&&_0x2f032e[_0xd982('0x51')]===0x0){return db[_0xd982('0x27')]['create']({'name':_0x4fd506[_0xd982('0x2c')],'resourceId':_0x4fd506['id'],'type':_0x2f032e[_0xd982('0x2c')],'sectionId':_0x2f032e['id']},{})[_0xd982('0x24')](function(){return _0x18ac0d;});}else{return _0x18ac0d;}})[_0xd982('0x52')](function(_0x593932){logger[_0xd982('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x593932);throw _0x593932;});}return _0x18ac0d;})[_0xd982('0x24')](respondWithResult(_0x11ae4d,0xc9))['catch'](handleError(_0x11ae4d,null));};exports['update']=function(_0x5cdf9e,_0x48b7fc){if(_0x5cdf9e[_0xd982('0x4c')]['id']){delete _0x5cdf9e[_0xd982('0x4c')]['id'];}return db[_0xd982('0x45')][_0xd982('0x4f')]({'where':{'id':_0x5cdf9e[_0xd982('0x53')]['id']}})[_0xd982('0x24')](handleEntityNotFound(_0x48b7fc,null))[_0xd982('0x24')](saveUpdates(_0x5cdf9e[_0xd982('0x4c')],null))[_0xd982('0x24')](respondWithResult(_0x48b7fc,null))['catch'](handleError(_0x48b7fc,null));};exports['destroy']=function(_0x2e7488,_0xe34ace){return db[_0xd982('0x45')]['find']({'where':{'id':_0x2e7488[_0xd982('0x53')]['id']}})[_0xd982('0x24')](handleEntityNotFound(_0xe34ace,null))['then'](removeEntity(_0xe34ace,null))[_0xd982('0x52')](handleError(_0xe34ace,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index fb6fcac..dd5f9b7 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 _0xfb31=['../../config/environment','./template.attributes','define','Template','tools_templates','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x1bf639,_0x864d54){var _0x553079=function(_0x144bd4){while(--_0x144bd4){_0x1bf639['push'](_0x1bf639['shift']());}};_0x553079(++_0x864d54);}(_0xfb31,0x1c8));var _0x1fb3=function(_0x12ead7,_0x54ce2d){_0x12ead7=_0x12ead7-0x0;var _0x2f9cb0=_0xfb31[_0x12ead7];return _0x2f9cb0;};'use strict';var _=require(_0x1fb3('0x0'));var util=require('util');var logger=require(_0x1fb3('0x1'))('api');var moment=require(_0x1fb3('0x2'));var BPromise=require(_0x1fb3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb3('0x4'));var rimraf=require(_0x1fb3('0x5'));var config=require(_0x1fb3('0x6'));var attributes=require(_0x1fb3('0x7'));module['exports']=function(_0x2426a7,_0x3c88d6){return _0x2426a7[_0x1fb3('0x8')](_0x1fb3('0x9'),attributes,{'tableName':_0x1fb3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc745=['request-promise','path','./template.attributes','exports','Template','tools_templates','lodash','util','../../config/logger','bluebird'];(function(_0x1af469,_0x584d95){var _0x336171=function(_0x574e25){while(--_0x574e25){_0x1af469['push'](_0x1af469['shift']());}};_0x336171(++_0x584d95);}(_0xc745,0x132));var _0x5c74=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc745[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5c74('0x0'));var util=require(_0x5c74('0x1'));var logger=require(_0x5c74('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5c74('0x3'));var rp=require(_0x5c74('0x4'));var fs=require('fs');var path=require(_0x5c74('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5c74('0x6'));module[_0x5c74('0x7')]=function(_0x1d2dbc,_0x51002c){return _0x1d2dbc['define'](_0x5c74('0x8'),attributes,{'tableName':_0x5c74('0x9'),'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 ff09e14..7794ed1 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 _0x4b96=['http','request','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetTemplate','Template','findAll','options','raw','where','limit','include','attributes','map','model','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x423efe,_0x16497d){var _0x1466b8=function(_0x153100){while(--_0x153100){_0x423efe['push'](_0x423efe['shift']());}};_0x1466b8(++_0x16497d);}(_0x4b96,0x12e));var _0x64b9=function(_0x4778c1,_0x339be7){_0x4778c1=_0x4778c1-0x0;var _0x1c20b1=_0x4b96[_0x4778c1];return _0x1c20b1;};'use strict';var _=require(_0x64b9('0x0'));var util=require(_0x64b9('0x1'));var moment=require(_0x64b9('0x2'));var BPromise=require('bluebird');var rs=require(_0x64b9('0x3'));var fs=require('fs');var Redis=require(_0x64b9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x64b9('0x5'));var logger=require(_0x64b9('0x6'))(_0x64b9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x64b9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51433b,_0x46adab,_0x9c08fb){return new BPromise(function(_0x3f9512,_0x405c29){return client[_0x64b9('0x9')](_0x51433b,_0x9c08fb)['then'](function(_0x22060e){logger[_0x64b9('0xa')](_0x64b9('0xb'),_0x46adab,'request\x20sent');logger[_0x64b9('0xc')](_0x64b9('0xd'),_0x46adab,_0x64b9('0xe'),JSON[_0x64b9('0xf')](_0x22060e));if(_0x22060e['error']){if(_0x22060e[_0x64b9('0x10')][_0x64b9('0x11')]===0x1f4){logger['error'](_0x64b9('0xb'),_0x46adab,_0x22060e[_0x64b9('0x10')][_0x64b9('0x12')]);return _0x405c29(_0x22060e[_0x64b9('0x10')][_0x64b9('0x12')]);}logger[_0x64b9('0x10')]('Template,\x20%s,\x20%s',_0x46adab,_0x22060e[_0x64b9('0x10')][_0x64b9('0x12')]);return _0x3f9512(_0x22060e[_0x64b9('0x10')][_0x64b9('0x12')]);}else{logger[_0x64b9('0xa')](_0x64b9('0xb'),_0x46adab,'request\x20sent');_0x3f9512(_0x22060e['result'][_0x64b9('0x12')]);}})['catch'](function(_0x39f91c){logger[_0x64b9('0x10')](_0x64b9('0xb'),_0x46adab,_0x39f91c);_0x405c29(_0x39f91c);});});}exports[_0x64b9('0x13')]=function(_0x4bed3d){var _0x7e7cd7=this;return new Promise(function(_0x1637a4,_0x1a9520){return db[_0x64b9('0x14')][_0x64b9('0x15')]({'raw':_0x4bed3d[_0x64b9('0x16')]?_0x4bed3d['options'][_0x64b9('0x17')]===undefined?!![]:![]:!![],'where':_0x4bed3d[_0x64b9('0x16')]?_0x4bed3d[_0x64b9('0x16')][_0x64b9('0x18')]||null:null,'attributes':_0x4bed3d[_0x64b9('0x16')]?_0x4bed3d[_0x64b9('0x16')]['attributes']||null:null,'limit':_0x4bed3d[_0x64b9('0x16')]?_0x4bed3d[_0x64b9('0x16')][_0x64b9('0x19')]||null:null,'include':_0x4bed3d[_0x64b9('0x16')]?_0x4bed3d[_0x64b9('0x16')][_0x64b9('0x1a')]?_['map'](_0x4bed3d[_0x64b9('0x16')][_0x64b9('0x1a')],function(_0x37034d){return{'model':db[_0x37034d['model']],'as':_0x37034d['as'],'attributes':_0x37034d[_0x64b9('0x1b')],'include':_0x37034d['include']?_[_0x64b9('0x1c')](_0x37034d['include'],function(_0x5088a7){return{'model':db[_0x5088a7[_0x64b9('0x1d')]],'as':_0x5088a7['as'],'attributes':_0x5088a7[_0x64b9('0x1b')],'include':_0x5088a7['include']?_[_0x64b9('0x1c')](_0x5088a7['include'],function(_0x1a35e0){return{'model':db[_0x1a35e0[_0x64b9('0x1d')]],'as':_0x1a35e0['as'],'attributes':_0x1a35e0[_0x64b9('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42ae73){logger[_0x64b9('0xa')]('GetTemplate',_0x4bed3d);logger['debug'](_0x64b9('0x13'),_0x4bed3d,JSON[_0x64b9('0xf')](_0x42ae73));_0x1637a4(_0x42ae73);})[_0x64b9('0x1e')](function(_0x91e004){logger[_0x64b9('0x10')](_0x64b9('0x13'),_0x91e004['message'],_0x4bed3d);_0x1a9520(_0x7e7cd7[_0x64b9('0x10')](0x1f4,_0x91e004[_0x64b9('0x12')]));});});}; \ No newline at end of file +var _0x9831=['raw','where','limit','include','model','attributes','map','GetTemplate','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Template','options'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x9831,0xf8));var _0x1983=function(_0x37ad1b,_0x512c69){_0x37ad1b=_0x37ad1b-0x0;var _0x3babbf=_0x9831[_0x37ad1b];return _0x3babbf;};'use strict';var _=require(_0x1983('0x0'));var util=require(_0x1983('0x1'));var moment=require(_0x1983('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1983('0x3'));var db=require(_0x1983('0x4'))['db'];var utils=require(_0x1983('0x5'));var logger=require(_0x1983('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1983('0x7'));var client=jayson[_0x1983('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1885fa,_0x17337f,_0x45dc42){return new BPromise(function(_0x1054ce,_0x1f6289){return client['request'](_0x1885fa,_0x45dc42)['then'](function(_0x4ba2f3){logger[_0x1983('0x9')](_0x1983('0xa'),_0x17337f,'request\x20sent');logger[_0x1983('0xb')](_0x1983('0xc'),_0x17337f,_0x1983('0xd'),JSON[_0x1983('0xe')](_0x4ba2f3));if(_0x4ba2f3[_0x1983('0xf')]){if(_0x4ba2f3[_0x1983('0xf')][_0x1983('0x10')]===0x1f4){logger[_0x1983('0xf')]('Template,\x20%s,\x20%s',_0x17337f,_0x4ba2f3['error'][_0x1983('0x11')]);return _0x1f6289(_0x4ba2f3[_0x1983('0xf')][_0x1983('0x11')]);}logger['error'](_0x1983('0xa'),_0x17337f,_0x4ba2f3[_0x1983('0xf')][_0x1983('0x11')]);return _0x1054ce(_0x4ba2f3[_0x1983('0xf')][_0x1983('0x11')]);}else{logger[_0x1983('0x9')](_0x1983('0xa'),_0x17337f,_0x1983('0xd'));_0x1054ce(_0x4ba2f3[_0x1983('0x12')][_0x1983('0x11')]);}})[_0x1983('0x13')](function(_0x297e42){logger[_0x1983('0xf')](_0x1983('0xa'),_0x17337f,_0x297e42);_0x1f6289(_0x297e42);});});}exports['GetTemplate']=function(_0xba2f09){var _0x22534=this;return new Promise(function(_0xc999f0,_0x25b19c){return db[_0x1983('0x14')]['findAll']({'raw':_0xba2f09[_0x1983('0x15')]?_0xba2f09['options'][_0x1983('0x16')]===undefined?!![]:![]:!![],'where':_0xba2f09[_0x1983('0x15')]?_0xba2f09[_0x1983('0x15')][_0x1983('0x17')]||null:null,'attributes':_0xba2f09[_0x1983('0x15')]?_0xba2f09[_0x1983('0x15')]['attributes']||null:null,'limit':_0xba2f09[_0x1983('0x15')]?_0xba2f09[_0x1983('0x15')][_0x1983('0x18')]||null:null,'include':_0xba2f09['options']?_0xba2f09[_0x1983('0x15')][_0x1983('0x19')]?_['map'](_0xba2f09[_0x1983('0x15')][_0x1983('0x19')],function(_0xfebaa9){return{'model':db[_0xfebaa9[_0x1983('0x1a')]],'as':_0xfebaa9['as'],'attributes':_0xfebaa9[_0x1983('0x1b')],'include':_0xfebaa9[_0x1983('0x19')]?_[_0x1983('0x1c')](_0xfebaa9[_0x1983('0x19')],function(_0xf740b0){return{'model':db[_0xf740b0[_0x1983('0x1a')]],'as':_0xf740b0['as'],'attributes':_0xf740b0[_0x1983('0x1b')],'include':_0xf740b0['include']?_[_0x1983('0x1c')](_0xf740b0[_0x1983('0x19')],function(_0x4d59f4){return{'model':db[_0x4d59f4[_0x1983('0x1a')]],'as':_0x4d59f4['as'],'attributes':_0x4d59f4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4837cd){logger[_0x1983('0x9')](_0x1983('0x1d'),_0xba2f09);logger[_0x1983('0xb')](_0x1983('0x1d'),_0xba2f09,JSON[_0x1983('0xe')](_0x4837cd));_0xc999f0(_0x4837cd);})[_0x1983('0x13')](function(_0x4f0d48){logger['error']('GetTemplate',_0x4f0d48['message'],_0xba2f09);_0x25b19c(_0x22534['error'](0x1f4,_0x4f0d48[_0x1983('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 714c0b9..4d47f66 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 _0x02b6=['/:id','/:id/all_conditions','getAnyConditions','getActions','create','post','addAllCondition','/:id/any_conditions','addAnyCondition','/:id/actions','addAction','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./trigger.controller','get','isAuthenticated','index'];(function(_0x42fd32,_0x12d3ae){var _0x328b6f=function(_0x3b9d38){while(--_0x3b9d38){_0x42fd32['push'](_0x42fd32['shift']());}};_0x328b6f(++_0x12d3ae);}(_0x02b6,0xf0));var _0x602b=function(_0x28d0ba,_0xa652c5){_0x28d0ba=_0x28d0ba-0x0;var _0x3e7140=_0x02b6[_0x28d0ba];return _0x3e7140;};'use strict';var multer=require(_0x602b('0x0'));var util=require(_0x602b('0x1'));var path=require(_0x602b('0x2'));var timeout=require(_0x602b('0x3'));var express=require(_0x602b('0x4'));var router=express[_0x602b('0x5')]();var fs_extra=require(_0x602b('0x6'));var auth=require(_0x602b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x602b('0x8'));router[_0x602b('0x9')]('/',auth[_0x602b('0xa')](),controller[_0x602b('0xb')]);router[_0x602b('0x9')](_0x602b('0xc'),auth[_0x602b('0xa')](),controller['show']);router[_0x602b('0x9')](_0x602b('0xd'),auth['isAuthenticated'](),controller['getAllConditions']);router['get']('/:id/any_conditions',auth[_0x602b('0xa')](),controller[_0x602b('0xe')]);router[_0x602b('0x9')]('/:id/actions',auth[_0x602b('0xa')](),controller[_0x602b('0xf')]);router['post']('/',auth[_0x602b('0xa')](),controller[_0x602b('0x10')]);router[_0x602b('0x11')](_0x602b('0xd'),auth['isAuthenticated'](),controller[_0x602b('0x12')]);router[_0x602b('0x11')](_0x602b('0x13'),auth[_0x602b('0xa')](),controller[_0x602b('0x14')]);router[_0x602b('0x11')](_0x602b('0x15'),auth[_0x602b('0xa')](),controller[_0x602b('0x16')]);router[_0x602b('0x17')](_0x602b('0xc'),auth[_0x602b('0xa')](),controller[_0x602b('0x18')]);router[_0x602b('0x19')](_0x602b('0xc'),auth[_0x602b('0xa')](),controller[_0x602b('0x1a')]);module[_0x602b('0x1b')]=router; \ No newline at end of file +var _0x8897=['addAction','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition'];(function(_0x1eb115,_0x37d12b){var _0x54a74f=function(_0x102f5b){while(--_0x102f5b){_0x1eb115['push'](_0x1eb115['shift']());}};_0x54a74f(++_0x37d12b);}(_0x8897,0x132));var _0x7889=function(_0x58b23d,_0x57cf15){_0x58b23d=_0x58b23d-0x0;var _0x6761e3=_0x8897[_0x58b23d];return _0x6761e3;};'use strict';var multer=require(_0x7889('0x0'));var util=require(_0x7889('0x1'));var path=require(_0x7889('0x2'));var timeout=require(_0x7889('0x3'));var express=require(_0x7889('0x4'));var router=express[_0x7889('0x5')]();var fs_extra=require(_0x7889('0x6'));var auth=require(_0x7889('0x7'));var interaction=require(_0x7889('0x8'));var config=require(_0x7889('0x9'));var controller=require(_0x7889('0xa'));router[_0x7889('0xb')]('/',auth[_0x7889('0xc')](),controller[_0x7889('0xd')]);router[_0x7889('0xb')](_0x7889('0xe'),auth['isAuthenticated'](),controller[_0x7889('0xf')]);router[_0x7889('0xb')](_0x7889('0x10'),auth['isAuthenticated'](),controller[_0x7889('0x11')]);router['get'](_0x7889('0x12'),auth[_0x7889('0xc')](),controller['getAnyConditions']);router[_0x7889('0xb')](_0x7889('0x13'),auth['isAuthenticated'](),controller[_0x7889('0x14')]);router[_0x7889('0x15')]('/',auth[_0x7889('0xc')](),controller['create']);router[_0x7889('0x15')](_0x7889('0x10'),auth['isAuthenticated'](),controller[_0x7889('0x16')]);router[_0x7889('0x15')](_0x7889('0x12'),auth[_0x7889('0xc')](),controller[_0x7889('0x17')]);router[_0x7889('0x15')]('/:id/actions',auth['isAuthenticated'](),controller[_0x7889('0x18')]);router[_0x7889('0x19')](_0x7889('0xe'),auth[_0x7889('0xc')](),controller[_0x7889('0x1a')]);router[_0x7889('0x1b')](_0x7889('0xe'),auth[_0x7889('0xc')](),controller[_0x7889('0x1c')]);module[_0x7889('0x1d')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index cec9377..ff0a1f9 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 _0xfbc1=['STRING','BOOLEAN'];(function(_0x236951,_0x7c3263){var _0xcb7439=function(_0x34a64d){while(--_0x34a64d){_0x236951['push'](_0x236951['shift']());}};_0xcb7439(++_0x7c3263);}(_0xfbc1,0x15a));var _0x1fbc=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0xfbc1[_0x120376];return _0x28c529;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1fbc('0x0')]},'description':{'type':Sequelize[_0x1fbc('0x0')]},'status':{'type':Sequelize[_0x1fbc('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xfcfc=['STRING','exports'];(function(_0x4f8b2b,_0x1dc8dd){var _0x2f230a=function(_0x232685){while(--_0x232685){_0x4f8b2b['push'](_0x4f8b2b['shift']());}};_0x2f230a(++_0x1dc8dd);}(_0xfcfc,0xf9));var _0xcfcf=function(_0x33a257,_0x2e1a26){_0x33a257=_0x33a257-0x0;var _0x3bfd1e=_0xfcfc[_0x33a257];return _0x3bfd1e;};'use strict';var Sequelize=require('sequelize');module[_0xcfcf('0x0')]={'name':{'type':Sequelize[_0xcfcf('0x1')]},'channel':{'type':Sequelize[_0xcfcf('0x1')]},'description':{'type':Sequelize[_0xcfcf('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index ef2c2d8..187f3a7 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 _0xfbec=['../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','get','Triggers','UserProfileResource','status','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x4fbdc3,_0x49dc61){var _0x1b0ea7=function(_0x472d24){while(--_0x472d24){_0x4fbdc3['push'](_0x4fbdc3['shift']());}};_0x1b0ea7(++_0x49dc61);}(_0xfbec,0x16d));var _0xcfbe=function(_0x2daa93,_0x1bcc18){_0x2daa93=_0x2daa93-0x0;var _0x5bd6b8=_0xfbec[_0x2daa93];return _0x5bd6b8;};'use strict';var emlformat=require(_0xcfbe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcfbe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcfbe('0x2'));var moment=require(_0xcfbe('0x3'));var BPromise=require(_0xcfbe('0x4'));var Mustache=require(_0xcfbe('0x5'));var util=require(_0xcfbe('0x6'));var path=require(_0xcfbe('0x7'));var sox=require('sox');var csv=require(_0xcfbe('0x8'));var ejs=require(_0xcfbe('0x9'));var fs=require('fs');var fs_extra=require(_0xcfbe('0xa'));var _=require(_0xcfbe('0xb'));var squel=require(_0xcfbe('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcfbe('0xd'));var toCsv=require(_0xcfbe('0x8'));var querystring=require(_0xcfbe('0xe'));var Papa=require(_0xcfbe('0xf'));var Redis=require(_0xcfbe('0x10'));var authService=require(_0xcfbe('0x11'));var qs=require(_0xcfbe('0x12'));var as=require(_0xcfbe('0x13'));var hardwareService=require(_0xcfbe('0x14'));var logger=require('../../config/logger')(_0xcfbe('0x15'));var utils=require(_0xcfbe('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcfbe('0x17'));var db=require(_0xcfbe('0x18'))['db'];function respondWithStatusCode(_0x5cdb76,_0x459ed7){_0x459ed7=_0x459ed7||0xcc;return function(_0x21f5c7){if(_0x21f5c7){return _0x5cdb76[_0xcfbe('0x19')](_0x459ed7);}return _0x5cdb76['status'](_0x459ed7)[_0xcfbe('0x1a')]();};}function respondWithResult(_0x34bc83,_0x595f1d){_0x595f1d=_0x595f1d||0xc8;return function(_0x28ac6a){if(_0x28ac6a){return _0x34bc83['status'](_0x595f1d)[_0xcfbe('0x1b')](_0x28ac6a);}};}function respondWithFilteredResult(_0x174e65,_0x5c51e5){return function(_0x40c49b){if(_0x40c49b){var _0x5d3a15=typeof _0x5c51e5[_0xcfbe('0x1c')]===_0xcfbe('0x1d')&&typeof _0x5c51e5[_0xcfbe('0x1e')]===_0xcfbe('0x1d');var _0x5f5665=_0x40c49b[_0xcfbe('0x1f')];var _0x550dd3=_0x5d3a15?0x0:_0x5c51e5['offset'];var _0x20c435=_0x5d3a15?_0x40c49b['count']:_0x5c51e5[_0xcfbe('0x1c')]+_0x5c51e5['limit'];var _0x4d1c91;if(_0x20c435>=_0x5f5665){_0x20c435=_0x5f5665;_0x4d1c91=0xc8;}else{_0x4d1c91=0xce;}_0x174e65['status'](_0x4d1c91);return _0x174e65['set'](_0xcfbe('0x20'),_0x550dd3+'-'+_0x20c435+'/'+_0x5f5665)[_0xcfbe('0x1b')](_0x40c49b);}return null;};}function patchUpdates(_0x4d74fe){return function(_0x222f15){try{jsonpatch[_0xcfbe('0x21')](_0x222f15,_0x4d74fe,!![]);}catch(_0x8208e8){return BPromise['reject'](_0x8208e8);}return _0x222f15[_0xcfbe('0x22')]();};}function saveUpdates(_0x3f640b,_0x141e05){return function(_0x17eeac){if(_0x17eeac){return _0x17eeac['update'](_0x3f640b)[_0xcfbe('0x23')](function(_0x21c06e){return _0x21c06e;});}return null;};}function removeEntity(_0x3c1815,_0x441217){return function(_0x31e1f5){if(_0x31e1f5){return _0x31e1f5['destroy']()['then'](function(){var _0x3e2896=_0x31e1f5[_0xcfbe('0x24')]({'plain':!![]});var _0x1aa277=_0xcfbe('0x25');return db[_0xcfbe('0x26')]['destroy']({'where':{'type':_0x1aa277,'resourceId':_0x3e2896['id']}})[_0xcfbe('0x23')](function(){return _0x31e1f5;});})['then'](function(){_0x3c1815[_0xcfbe('0x27')](0xcc)[_0xcfbe('0x1a')]();});}};}function handleEntityNotFound(_0x518896,_0x2bd08c){return function(_0x43edab){if(!_0x43edab){_0x518896[_0xcfbe('0x19')](0x194);}return _0x43edab;};}function handleError(_0x21332d,_0x770d8){_0x770d8=_0x770d8||0x1f4;return function(_0x4238e2){logger[_0xcfbe('0x28')](_0x4238e2[_0xcfbe('0x29')]);if(_0x4238e2[_0xcfbe('0x2a')]){delete _0x4238e2[_0xcfbe('0x2a')];}_0x21332d['status'](_0x770d8)[_0xcfbe('0x2b')](_0x4238e2);};}exports[_0xcfbe('0x2c')]=function(_0x4539e7,_0xe332a2){var _0xa885f5={},_0x4fddf1={},_0x5dd55a={'count':0x0,'rows':[]};var _0x5906c9=_[_0xcfbe('0x2d')](db[_0xcfbe('0x2e')][_0xcfbe('0x2f')],function(_0x2f71d1){return{'name':_0x2f71d1[_0xcfbe('0x30')],'type':_0x2f71d1[_0xcfbe('0x31')][_0xcfbe('0x32')]};});_0x4fddf1['model']=_[_0xcfbe('0x2d')](_0x5906c9,_0xcfbe('0x2a'));_0x4fddf1[_0xcfbe('0x33')]=_[_0xcfbe('0x34')](_0x4539e7[_0xcfbe('0x33')]);_0x4fddf1[_0xcfbe('0x35')]=_[_0xcfbe('0x36')](_0x4fddf1[_0xcfbe('0x37')],_0x4fddf1[_0xcfbe('0x33')]);_0xa885f5[_0xcfbe('0x38')]=_[_0xcfbe('0x36')](_0x4fddf1[_0xcfbe('0x37')],qs[_0xcfbe('0x39')](_0x4539e7[_0xcfbe('0x33')][_0xcfbe('0x39')]));_0xa885f5[_0xcfbe('0x38')]=_0xa885f5[_0xcfbe('0x38')][_0xcfbe('0x3a')]?_0xa885f5[_0xcfbe('0x38')]:_0x4fddf1[_0xcfbe('0x37')];if(!_0x4539e7[_0xcfbe('0x33')]['hasOwnProperty'](_0xcfbe('0x3b'))){_0xa885f5[_0xcfbe('0x1e')]=qs['limit'](_0x4539e7[_0xcfbe('0x33')][_0xcfbe('0x1e')]);_0xa885f5[_0xcfbe('0x1c')]=qs['offset'](_0x4539e7[_0xcfbe('0x33')][_0xcfbe('0x1c')]);}_0xa885f5[_0xcfbe('0x3c')]=qs[_0xcfbe('0x3d')](_0x4539e7['query']['sort']);_0xa885f5[_0xcfbe('0x3e')]=qs[_0xcfbe('0x35')](_[_0xcfbe('0x3f')](_0x4539e7[_0xcfbe('0x33')],_0x4fddf1[_0xcfbe('0x35')]),_0x5906c9);if(_0x4539e7[_0xcfbe('0x33')][_0xcfbe('0x40')]){_0xa885f5[_0xcfbe('0x3e')]=_['merge'](_0xa885f5[_0xcfbe('0x3e')],{'$or':_['map'](_0x5906c9,function(_0xfa5971){if(_0xfa5971[_0xcfbe('0x31')]!=='VIRTUAL'){var _0x1826a2={};_0x1826a2[_0xfa5971[_0xcfbe('0x2a')]]={'$like':'%'+_0x4539e7['query'][_0xcfbe('0x40')]+'%'};return _0x1826a2;}})});}_0xa885f5=_[_0xcfbe('0x41')]({},_0xa885f5,_0x4539e7[_0xcfbe('0x42')]);var _0x576413={'where':_0xa885f5[_0xcfbe('0x3e')]};return db[_0xcfbe('0x2e')][_0xcfbe('0x1f')](_0x576413)['then'](function(_0x48e809){_0x5dd55a['count']=_0x48e809;if(_0x4539e7[_0xcfbe('0x33')]['includeAll']){_0xa885f5[_0xcfbe('0x43')]=[{'all':!![]}];}return db[_0xcfbe('0x2e')][_0xcfbe('0x44')](_0xa885f5);})[_0xcfbe('0x23')](function(_0x1e4400){_0x5dd55a[_0xcfbe('0x45')]=_0x1e4400;return _0x5dd55a;})[_0xcfbe('0x23')](respondWithFilteredResult(_0xe332a2,_0xa885f5))[_0xcfbe('0x46')](handleError(_0xe332a2,null));};exports['show']=function(_0x264c59,_0x162c2d){var _0x39a852={'raw':![],'where':{'id':_0x264c59[_0xcfbe('0x47')]['id']}},_0xfc84bd={};_0xfc84bd[_0xcfbe('0x37')]=_[_0xcfbe('0x34')](db[_0xcfbe('0x2e')][_0xcfbe('0x2f')]);_0xfc84bd['query']=_[_0xcfbe('0x34')](_0x264c59[_0xcfbe('0x33')]);_0xfc84bd[_0xcfbe('0x35')]=_['intersection'](_0xfc84bd['model'],_0xfc84bd['query']);_0x39a852[_0xcfbe('0x38')]=_[_0xcfbe('0x36')](_0xfc84bd[_0xcfbe('0x37')],qs['fields'](_0x264c59['query']['fields']));_0x39a852['attributes']=_0x39a852['attributes'][_0xcfbe('0x3a')]?_0x39a852[_0xcfbe('0x38')]:_0xfc84bd[_0xcfbe('0x37')];if(_0x264c59[_0xcfbe('0x33')][_0xcfbe('0x48')]){_0x39a852[_0xcfbe('0x43')]=[{'all':!![]}];}_0x39a852=_[_0xcfbe('0x41')]({},_0x39a852,_0x264c59[_0xcfbe('0x42')]);return db['Trigger'][_0xcfbe('0x49')](_0x39a852)[_0xcfbe('0x23')](handleEntityNotFound(_0x162c2d,null))[_0xcfbe('0x23')](respondWithResult(_0x162c2d,null))['catch'](handleError(_0x162c2d,null));};exports[_0xcfbe('0x4a')]=function(_0x159a22,_0x5d5521){return db['Trigger'][_0xcfbe('0x4a')](_0x159a22[_0xcfbe('0x4b')],{})['then'](function(_0x3cb095){var _0x19a0d3=_0x159a22[_0xcfbe('0x4c')][_0xcfbe('0x24')]({'plain':!![]});if(!_0x19a0d3)throw new Error(_0xcfbe('0x4d'));if(_0x19a0d3[_0xcfbe('0x4e')]===_0xcfbe('0x4c')){var _0x1eaf1f=_0x3cb095[_0xcfbe('0x24')]({'plain':!![]});var _0x35a7fb=_0xcfbe('0x25');return db[_0xcfbe('0x4f')]['find']({'where':{'name':_0x35a7fb,'userProfileId':_0x19a0d3[_0xcfbe('0x50')]},'raw':!![]})['then'](function(_0x318532){if(_0x318532&&_0x318532[_0xcfbe('0x51')]===0x0){return db[_0xcfbe('0x26')][_0xcfbe('0x4a')]({'name':_0x1eaf1f[_0xcfbe('0x2a')],'resourceId':_0x1eaf1f['id'],'type':_0x318532[_0xcfbe('0x2a')],'sectionId':_0x318532['id']},{})[_0xcfbe('0x23')](function(){return _0x3cb095;});}else{return _0x3cb095;}})[_0xcfbe('0x46')](function(_0x3a0b05){logger['error'](_0xcfbe('0x52'),_0x3a0b05);throw _0x3a0b05;});}return _0x3cb095;})['then'](respondWithResult(_0x5d5521,0xc9))[_0xcfbe('0x46')](handleError(_0x5d5521,null));};exports[_0xcfbe('0x53')]=function(_0x484ff3,_0x376450){if(_0x484ff3[_0xcfbe('0x4b')]['id']){delete _0x484ff3['body']['id'];}return db[_0xcfbe('0x2e')]['find']({'where':{'id':_0x484ff3['params']['id']}})[_0xcfbe('0x23')](handleEntityNotFound(_0x376450,null))['then'](saveUpdates(_0x484ff3['body'],null))[_0xcfbe('0x23')](respondWithResult(_0x376450,null))['catch'](handleError(_0x376450,null));};exports[_0xcfbe('0x54')]=function(_0x3d8dca,_0x1b0457){return db[_0xcfbe('0x2e')][_0xcfbe('0x49')]({'where':{'id':_0x3d8dca['params']['id']}})[_0xcfbe('0x23')](handleEntityNotFound(_0x1b0457,null))[_0xcfbe('0x23')](removeEntity(_0x1b0457,null))[_0xcfbe('0x46')](handleError(_0x1b0457,null));};exports[_0xcfbe('0x55')]=function(_0x4edcfb,_0x5bf1c3,_0x5499ab){if(_0x4edcfb[_0xcfbe('0x4b')]['id']){delete _0x4edcfb['body']['id'];}return db[_0xcfbe('0x2e')]['find']({'where':{'id':_0x4edcfb[_0xcfbe('0x47')]['id']}})['then'](handleEntityNotFound(_0x5bf1c3,null))['then'](function(_0x1e8898){if(_0x1e8898){_0x4edcfb[_0xcfbe('0x4b')]['TriggerAllId']=_0x1e8898['id'];return db[_0xcfbe('0x56')][_0xcfbe('0x4a')](_0x4edcfb[_0xcfbe('0x4b')]);}})[_0xcfbe('0x23')](respondWithResult(_0x5bf1c3,null))['catch'](handleError(_0x5bf1c3,null));};exports[_0xcfbe('0x57')]=function(_0x3c71d1,_0x1e16a3,_0x2c6a28){if(_0x3c71d1['body']['id']){delete _0x3c71d1[_0xcfbe('0x4b')]['id'];}return db[_0xcfbe('0x2e')][_0xcfbe('0x49')]({'where':{'id':_0x3c71d1[_0xcfbe('0x47')]['id']}})[_0xcfbe('0x23')](handleEntityNotFound(_0x1e16a3,null))['then'](function(_0x22931b){if(_0x22931b){_0x3c71d1['body'][_0xcfbe('0x58')]=_0x22931b['id'];return db[_0xcfbe('0x56')][_0xcfbe('0x4a')](_0x3c71d1[_0xcfbe('0x4b')]);}})['then'](respondWithResult(_0x1e16a3,null))['catch'](handleError(_0x1e16a3,null));};exports[_0xcfbe('0x59')]=function(_0x52b7e3,_0x2dc5ef,_0x5530b6){var _0x2d4667={};var _0x1acb81={};var _0x43a1a9;var _0x5c9a9a;return db[_0xcfbe('0x2e')][_0xcfbe('0x5a')]({'where':{'id':_0x52b7e3['params']['id']}})[_0xcfbe('0x23')](handleEntityNotFound(_0x2dc5ef,null))[_0xcfbe('0x23')](function(_0x1aedcf){if(_0x1aedcf){_0x43a1a9=_0x1aedcf;_0x1acb81[_0xcfbe('0x37')]=_[_0xcfbe('0x34')](db['Condition'][_0xcfbe('0x2f')]);_0x1acb81[_0xcfbe('0x33')]=_[_0xcfbe('0x34')](_0x52b7e3['query']);_0x1acb81['filters']=_[_0xcfbe('0x36')](_0x1acb81['model'],_0x1acb81['query']);_0x2d4667[_0xcfbe('0x38')]=_[_0xcfbe('0x36')](_0x1acb81[_0xcfbe('0x37')],qs['fields'](_0x52b7e3[_0xcfbe('0x33')][_0xcfbe('0x39')]));_0x2d4667[_0xcfbe('0x38')]=_0x2d4667['attributes'][_0xcfbe('0x3a')]?_0x2d4667[_0xcfbe('0x38')]:_0x1acb81[_0xcfbe('0x37')];_0x2d4667[_0xcfbe('0x3c')]=qs[_0xcfbe('0x3d')](_0x52b7e3[_0xcfbe('0x33')][_0xcfbe('0x3d')]);_0x2d4667[_0xcfbe('0x3e')]=qs['filters'](_[_0xcfbe('0x3f')](_0x52b7e3['query'],_0x1acb81[_0xcfbe('0x35')]));if(_0x52b7e3[_0xcfbe('0x33')][_0xcfbe('0x40')]){_0x2d4667['where']=_[_0xcfbe('0x41')](_0x2d4667[_0xcfbe('0x3e')],{'$or':_[_0xcfbe('0x2d')](_0x2d4667['attributes'],function(_0x5796d5){var _0x54f81f={};_0x54f81f[_0x5796d5]={'$like':'%'+_0x52b7e3[_0xcfbe('0x33')][_0xcfbe('0x40')]+'%'};return _0x54f81f;})});}_0x2d4667=_[_0xcfbe('0x41')]({},_0x2d4667,_0x52b7e3[_0xcfbe('0x42')]);return _0x43a1a9[_0xcfbe('0x59')](_0x2d4667);}})[_0xcfbe('0x23')](function(_0x20df20){if(_0x20df20){_0x5c9a9a=_0x20df20[_0xcfbe('0x3a')];if(!_0x52b7e3['query'][_0xcfbe('0x5b')](_0xcfbe('0x3b'))){_0x2d4667['limit']=qs['limit'](_0x52b7e3[_0xcfbe('0x33')][_0xcfbe('0x1e')]);_0x2d4667[_0xcfbe('0x1c')]=qs[_0xcfbe('0x1c')](_0x52b7e3[_0xcfbe('0x33')][_0xcfbe('0x1c')]);}return _0x43a1a9['getAllConditions'](_0x2d4667);}})['then'](function(_0x45bff5){if(_0x45bff5){return _0x45bff5?{'count':_0x5c9a9a,'rows':_0x45bff5}:null;}})['then'](respondWithResult(_0x2dc5ef,null))['catch'](handleError(_0x2dc5ef,null));};exports['getAnyConditions']=function(_0x598375,_0x28e2c9,_0x3e4da8){var _0x33a637={};var _0x213f72={};var _0x21fc3b;var _0x1149d5;return db[_0xcfbe('0x2e')][_0xcfbe('0x5a')]({'where':{'id':_0x598375[_0xcfbe('0x47')]['id']}})['then'](handleEntityNotFound(_0x28e2c9,null))[_0xcfbe('0x23')](function(_0x303879){if(_0x303879){_0x21fc3b=_0x303879;_0x213f72[_0xcfbe('0x37')]=_[_0xcfbe('0x34')](db[_0xcfbe('0x56')][_0xcfbe('0x2f')]);_0x213f72[_0xcfbe('0x33')]=_[_0xcfbe('0x34')](_0x598375[_0xcfbe('0x33')]);_0x213f72[_0xcfbe('0x35')]=_['intersection'](_0x213f72['model'],_0x213f72[_0xcfbe('0x33')]);_0x33a637[_0xcfbe('0x38')]=_[_0xcfbe('0x36')](_0x213f72[_0xcfbe('0x37')],qs['fields'](_0x598375['query'][_0xcfbe('0x39')]));_0x33a637[_0xcfbe('0x38')]=_0x33a637[_0xcfbe('0x38')][_0xcfbe('0x3a')]?_0x33a637['attributes']:_0x213f72[_0xcfbe('0x37')];_0x33a637[_0xcfbe('0x3c')]=qs['sort'](_0x598375['query'][_0xcfbe('0x3d')]);_0x33a637[_0xcfbe('0x3e')]=qs['filters'](_[_0xcfbe('0x3f')](_0x598375['query'],_0x213f72[_0xcfbe('0x35')]));if(_0x598375[_0xcfbe('0x33')][_0xcfbe('0x40')]){_0x33a637[_0xcfbe('0x3e')]=_[_0xcfbe('0x41')](_0x33a637[_0xcfbe('0x3e')],{'$or':_[_0xcfbe('0x2d')](_0x33a637[_0xcfbe('0x38')],function(_0x22bae1){var _0x3c1281={};_0x3c1281[_0x22bae1]={'$like':'%'+_0x598375['query']['filter']+'%'};return _0x3c1281;})});}_0x33a637=_['merge']({},_0x33a637,_0x598375[_0xcfbe('0x42')]);return _0x21fc3b[_0xcfbe('0x5c')](_0x33a637);}})[_0xcfbe('0x23')](function(_0x9705ba){if(_0x9705ba){_0x1149d5=_0x9705ba[_0xcfbe('0x3a')];if(!_0x598375[_0xcfbe('0x33')][_0xcfbe('0x5b')](_0xcfbe('0x3b'))){_0x33a637[_0xcfbe('0x1e')]=qs[_0xcfbe('0x1e')](_0x598375[_0xcfbe('0x33')][_0xcfbe('0x1e')]);_0x33a637['offset']=qs[_0xcfbe('0x1c')](_0x598375[_0xcfbe('0x33')]['offset']);}return _0x21fc3b[_0xcfbe('0x5c')](_0x33a637);}})[_0xcfbe('0x23')](function(_0x461a5d){if(_0x461a5d){return _0x461a5d?{'count':_0x1149d5,'rows':_0x461a5d}:null;}})['then'](respondWithResult(_0x28e2c9,null))[_0xcfbe('0x46')](handleError(_0x28e2c9,null));};exports[_0xcfbe('0x5d')]=function(_0x56a417,_0x536171,_0x39d410){if(_0x56a417[_0xcfbe('0x4b')]['id']){delete _0x56a417[_0xcfbe('0x4b')]['id'];}return db[_0xcfbe('0x2e')][_0xcfbe('0x49')]({'where':{'id':_0x56a417[_0xcfbe('0x47')]['id']}})[_0xcfbe('0x23')](handleEntityNotFound(_0x536171,null))[_0xcfbe('0x23')](function(_0x583d63){if(_0x583d63){_0x56a417[_0xcfbe('0x4b')][_0xcfbe('0x5e')]=_0x583d63['id'];return db[_0xcfbe('0x5f')][_0xcfbe('0x4a')](_0x56a417[_0xcfbe('0x4b')]);}})['then'](respondWithResult(_0x536171,null))['catch'](handleError(_0x536171,null));};exports['getActions']=function(_0x58838d,_0x1fe62c,_0x6bace0){var _0x5e41bb={};var _0xdff6dc={};var _0x1a461d;var _0x59dadf;return db[_0xcfbe('0x2e')][_0xcfbe('0x5a')]({'where':{'id':_0x58838d['params']['id']}})[_0xcfbe('0x23')](handleEntityNotFound(_0x1fe62c,null))['then'](function(_0x5a543a){if(_0x5a543a){_0x1a461d=_0x5a543a;_0xdff6dc[_0xcfbe('0x37')]=_[_0xcfbe('0x34')](db[_0xcfbe('0x5f')]['rawAttributes']);_0xdff6dc[_0xcfbe('0x33')]=_[_0xcfbe('0x34')](_0x58838d[_0xcfbe('0x33')]);_0xdff6dc[_0xcfbe('0x35')]=_[_0xcfbe('0x36')](_0xdff6dc[_0xcfbe('0x37')],_0xdff6dc['query']);_0x5e41bb['attributes']=_[_0xcfbe('0x36')](_0xdff6dc['model'],qs[_0xcfbe('0x39')](_0x58838d[_0xcfbe('0x33')]['fields']));_0x5e41bb[_0xcfbe('0x38')]=_0x5e41bb[_0xcfbe('0x38')][_0xcfbe('0x3a')]?_0x5e41bb[_0xcfbe('0x38')]:_0xdff6dc[_0xcfbe('0x37')];_0x5e41bb['order']=qs['sort'](_0x58838d[_0xcfbe('0x33')][_0xcfbe('0x3d')]);_0x5e41bb[_0xcfbe('0x3e')]=qs[_0xcfbe('0x35')](_[_0xcfbe('0x3f')](_0x58838d[_0xcfbe('0x33')],_0xdff6dc[_0xcfbe('0x35')]));if(_0x58838d[_0xcfbe('0x33')][_0xcfbe('0x40')]){_0x5e41bb['where']=_[_0xcfbe('0x41')](_0x5e41bb[_0xcfbe('0x3e')],{'$or':_[_0xcfbe('0x2d')](_0x5e41bb[_0xcfbe('0x38')],function(_0x507ae8){var _0x5aaaef={};_0x5aaaef[_0x507ae8]={'$like':'%'+_0x58838d[_0xcfbe('0x33')][_0xcfbe('0x40')]+'%'};return _0x5aaaef;})});}_0x5e41bb=_[_0xcfbe('0x41')]({},_0x5e41bb,_0x58838d[_0xcfbe('0x42')]);return _0x1a461d[_0xcfbe('0x60')](_0x5e41bb);}})['then'](function(_0x215b97){if(_0x215b97){_0x59dadf=_0x215b97[_0xcfbe('0x3a')];if(!_0x58838d['query'][_0xcfbe('0x5b')](_0xcfbe('0x3b'))){_0x5e41bb[_0xcfbe('0x1e')]=qs[_0xcfbe('0x1e')](_0x58838d[_0xcfbe('0x33')][_0xcfbe('0x1e')]);_0x5e41bb['offset']=qs[_0xcfbe('0x1c')](_0x58838d['query']['offset']);}return _0x1a461d[_0xcfbe('0x60')](_0x5e41bb);}})[_0xcfbe('0x23')](function(_0x16d4f0){if(_0x16d4f0){return _0x16d4f0?{'count':_0x59dadf,'rows':_0x16d4f0}:null;}})['then'](respondWithResult(_0x1fe62c,null))['catch'](handleError(_0x1fe62c,null));}; \ No newline at end of file +var _0xc8e6=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','count','offset','limit','status','set','apply','reject','save','update','then','get','Triggers','destroy','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','filter','options','includeAll','include','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Condition','addAnyCondition','TriggerAnyId','getAllConditions','order','getAnyConditions','findOne','pick','addAction','Action','getActions','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x5a1cc9,_0x28f54d){var _0x471761=function(_0xda51c0){while(--_0xda51c0){_0x5a1cc9['push'](_0x5a1cc9['shift']());}};_0x471761(++_0x28f54d);}(_0xc8e6,0x112));var _0x6c8e=function(_0x168466,_0x5f37e5){_0x168466=_0x168466-0x0;var _0xcf8a4=_0xc8e6[_0x168466];return _0xcf8a4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c8e('0x0'));var zipdir=require(_0x6c8e('0x1'));var jsonpatch=require(_0x6c8e('0x2'));var rp=require('request-promise');var moment=require(_0x6c8e('0x3'));var BPromise=require(_0x6c8e('0x4'));var Mustache=require('mustache');var util=require(_0x6c8e('0x5'));var path=require(_0x6c8e('0x6'));var sox=require(_0x6c8e('0x7'));var csv=require('to-csv');var ejs=require(_0x6c8e('0x8'));var fs=require('fs');var fs_extra=require(_0x6c8e('0x9'));var _=require(_0x6c8e('0xa'));var squel=require(_0x6c8e('0xb'));var crypto=require(_0x6c8e('0xc'));var jsforce=require(_0x6c8e('0xd'));var deskjs=require(_0x6c8e('0xe'));var toCsv=require(_0x6c8e('0xf'));var querystring=require(_0x6c8e('0x10'));var Papa=require(_0x6c8e('0x11'));var Redis=require(_0x6c8e('0x12'));var authService=require(_0x6c8e('0x13'));var qs=require(_0x6c8e('0x14'));var as=require(_0x6c8e('0x15'));var hardwareService=require(_0x6c8e('0x16'));var logger=require('../../config/logger')(_0x6c8e('0x17'));var utils=require(_0x6c8e('0x18'));var config=require(_0x6c8e('0x19'));var licenseUtil=require(_0x6c8e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b790c,_0x4594bf){_0x4594bf=_0x4594bf||0xcc;return function(_0x5eb295){if(_0x5eb295){return _0x5b790c[_0x6c8e('0x1b')](_0x4594bf);}return _0x5b790c['status'](_0x4594bf)[_0x6c8e('0x1c')]();};}function respondWithResult(_0x386711,_0x32eb30){_0x32eb30=_0x32eb30||0xc8;return function(_0x239e52){if(_0x239e52){return _0x386711['status'](_0x32eb30)[_0x6c8e('0x1d')](_0x239e52);}};}function respondWithFilteredResult(_0x5db1e1,_0x2348aa){return function(_0x6ea0d4){if(_0x6ea0d4){var _0x1b43f9=typeof _0x2348aa['offset']===_0x6c8e('0x1e')&&typeof _0x2348aa['limit']==='undefined';var _0x332144=_0x6ea0d4[_0x6c8e('0x1f')];var _0x356ce4=_0x1b43f9?0x0:_0x2348aa[_0x6c8e('0x20')];var _0xe31d3e=_0x1b43f9?_0x6ea0d4[_0x6c8e('0x1f')]:_0x2348aa[_0x6c8e('0x20')]+_0x2348aa[_0x6c8e('0x21')];var _0x4552b2;if(_0xe31d3e>=_0x332144){_0xe31d3e=_0x332144;_0x4552b2=0xc8;}else{_0x4552b2=0xce;}_0x5db1e1[_0x6c8e('0x22')](_0x4552b2);return _0x5db1e1[_0x6c8e('0x23')]('Content-Range',_0x356ce4+'-'+_0xe31d3e+'/'+_0x332144)[_0x6c8e('0x1d')](_0x6ea0d4);}return null;};}function patchUpdates(_0x4aaaaa){return function(_0x8b47c3){try{jsonpatch[_0x6c8e('0x24')](_0x8b47c3,_0x4aaaaa,!![]);}catch(_0x16ea16){return BPromise[_0x6c8e('0x25')](_0x16ea16);}return _0x8b47c3[_0x6c8e('0x26')]();};}function saveUpdates(_0xc60e0,_0x1c9fc2){return function(_0x6941b8){if(_0x6941b8){return _0x6941b8[_0x6c8e('0x27')](_0xc60e0)[_0x6c8e('0x28')](function(_0xf4309f){return _0xf4309f;});}return null;};}function removeEntity(_0x10cab7,_0x5ae557){return function(_0x2d79f4){if(_0x2d79f4){return _0x2d79f4['destroy']()['then'](function(){var _0x344468=_0x2d79f4[_0x6c8e('0x29')]({'plain':!![]});var _0x1497b1=_0x6c8e('0x2a');return db['UserProfileResource'][_0x6c8e('0x2b')]({'where':{'type':_0x1497b1,'resourceId':_0x344468['id']}})[_0x6c8e('0x28')](function(){return _0x2d79f4;});})[_0x6c8e('0x28')](function(){_0x10cab7[_0x6c8e('0x22')](0xcc)[_0x6c8e('0x1c')]();});}};}function handleEntityNotFound(_0x14346d,_0xeb0c9e){return function(_0x3c1da0){if(!_0x3c1da0){_0x14346d['sendStatus'](0x194);}return _0x3c1da0;};}function handleError(_0x233b65,_0x2020cc){_0x2020cc=_0x2020cc||0x1f4;return function(_0x32c80f){logger[_0x6c8e('0x2c')](_0x32c80f[_0x6c8e('0x2d')]);if(_0x32c80f[_0x6c8e('0x2e')]){delete _0x32c80f[_0x6c8e('0x2e')];}_0x233b65[_0x6c8e('0x22')](_0x2020cc)[_0x6c8e('0x2f')](_0x32c80f);};}exports[_0x6c8e('0x30')]=function(_0x3c0e70,_0x455ee1){var _0x154ee7={},_0x47ca67={},_0x21da2a={'count':0x0,'rows':[]};var _0x4a9480=_[_0x6c8e('0x31')](db[_0x6c8e('0x32')][_0x6c8e('0x33')],function(_0x5e002d){return{'name':_0x5e002d[_0x6c8e('0x34')],'type':_0x5e002d[_0x6c8e('0x35')]['key']};});_0x47ca67[_0x6c8e('0x36')]=_[_0x6c8e('0x31')](_0x4a9480,_0x6c8e('0x2e'));_0x47ca67[_0x6c8e('0x37')]=_[_0x6c8e('0x38')](_0x3c0e70['query']);_0x47ca67[_0x6c8e('0x39')]=_[_0x6c8e('0x3a')](_0x47ca67[_0x6c8e('0x36')],_0x47ca67[_0x6c8e('0x37')]);_0x154ee7[_0x6c8e('0x3b')]=_['intersection'](_0x47ca67[_0x6c8e('0x36')],qs[_0x6c8e('0x3c')](_0x3c0e70[_0x6c8e('0x37')][_0x6c8e('0x3c')]));_0x154ee7[_0x6c8e('0x3b')]=_0x154ee7[_0x6c8e('0x3b')][_0x6c8e('0x3d')]?_0x154ee7['attributes']:_0x47ca67[_0x6c8e('0x36')];if(!_0x3c0e70[_0x6c8e('0x37')][_0x6c8e('0x3e')](_0x6c8e('0x3f'))){_0x154ee7[_0x6c8e('0x21')]=qs[_0x6c8e('0x21')](_0x3c0e70[_0x6c8e('0x37')]['limit']);_0x154ee7[_0x6c8e('0x20')]=qs[_0x6c8e('0x20')](_0x3c0e70[_0x6c8e('0x37')][_0x6c8e('0x20')]);}_0x154ee7['order']=qs[_0x6c8e('0x40')](_0x3c0e70[_0x6c8e('0x37')][_0x6c8e('0x40')]);_0x154ee7[_0x6c8e('0x41')]=qs[_0x6c8e('0x39')](_['pick'](_0x3c0e70['query'],_0x47ca67[_0x6c8e('0x39')]),_0x4a9480);if(_0x3c0e70[_0x6c8e('0x37')]['filter']){_0x154ee7[_0x6c8e('0x41')]=_[_0x6c8e('0x42')](_0x154ee7[_0x6c8e('0x41')],{'$or':_['map'](_0x4a9480,function(_0x4ade96){if(_0x4ade96[_0x6c8e('0x35')]!=='VIRTUAL'){var _0x7b1e5d={};_0x7b1e5d[_0x4ade96['name']]={'$like':'%'+_0x3c0e70[_0x6c8e('0x37')][_0x6c8e('0x43')]+'%'};return _0x7b1e5d;}})});}_0x154ee7=_[_0x6c8e('0x42')]({},_0x154ee7,_0x3c0e70[_0x6c8e('0x44')]);var _0x2012f1={'where':_0x154ee7[_0x6c8e('0x41')]};return db[_0x6c8e('0x32')][_0x6c8e('0x1f')](_0x2012f1)[_0x6c8e('0x28')](function(_0x323dce){_0x21da2a[_0x6c8e('0x1f')]=_0x323dce;if(_0x3c0e70['query'][_0x6c8e('0x45')]){_0x154ee7[_0x6c8e('0x46')]=[{'all':!![]}];}return db[_0x6c8e('0x32')]['findAll'](_0x154ee7);})[_0x6c8e('0x28')](function(_0x293235){_0x21da2a[_0x6c8e('0x47')]=_0x293235;return _0x21da2a;})[_0x6c8e('0x28')](respondWithFilteredResult(_0x455ee1,_0x154ee7))[_0x6c8e('0x48')](handleError(_0x455ee1,null));};exports['show']=function(_0x2281f0,_0x5a1243){var _0xd0f905={'raw':![],'where':{'id':_0x2281f0[_0x6c8e('0x49')]['id']}},_0x21a519={};_0x21a519[_0x6c8e('0x36')]=_['keys'](db[_0x6c8e('0x32')]['rawAttributes']);_0x21a519['query']=_[_0x6c8e('0x38')](_0x2281f0['query']);_0x21a519[_0x6c8e('0x39')]=_[_0x6c8e('0x3a')](_0x21a519['model'],_0x21a519[_0x6c8e('0x37')]);_0xd0f905['attributes']=_[_0x6c8e('0x3a')](_0x21a519[_0x6c8e('0x36')],qs[_0x6c8e('0x3c')](_0x2281f0[_0x6c8e('0x37')][_0x6c8e('0x3c')]));_0xd0f905[_0x6c8e('0x3b')]=_0xd0f905[_0x6c8e('0x3b')]['length']?_0xd0f905[_0x6c8e('0x3b')]:_0x21a519[_0x6c8e('0x36')];if(_0x2281f0['query'][_0x6c8e('0x45')]){_0xd0f905[_0x6c8e('0x46')]=[{'all':!![]}];}_0xd0f905=_[_0x6c8e('0x42')]({},_0xd0f905,_0x2281f0[_0x6c8e('0x44')]);return db[_0x6c8e('0x32')][_0x6c8e('0x4a')](_0xd0f905)['then'](handleEntityNotFound(_0x5a1243,null))[_0x6c8e('0x28')](respondWithResult(_0x5a1243,null))['catch'](handleError(_0x5a1243,null));};exports[_0x6c8e('0x4b')]=function(_0x830a6d,_0x5d8fff){return db[_0x6c8e('0x32')][_0x6c8e('0x4b')](_0x830a6d[_0x6c8e('0x4c')],{})[_0x6c8e('0x28')](function(_0x4c4d1d){var _0x4db0a6=_0x830a6d[_0x6c8e('0x4d')]['get']({'plain':!![]});if(!_0x4db0a6)throw new Error(_0x6c8e('0x4e'));if(_0x4db0a6[_0x6c8e('0x4f')]==='user'){var _0x5df005=_0x4c4d1d[_0x6c8e('0x29')]({'plain':!![]});var _0x48c769=_0x6c8e('0x2a');return db[_0x6c8e('0x50')]['find']({'where':{'name':_0x48c769,'userProfileId':_0x4db0a6[_0x6c8e('0x51')]},'raw':!![]})[_0x6c8e('0x28')](function(_0x5c7509){if(_0x5c7509&&_0x5c7509[_0x6c8e('0x52')]===0x0){return db[_0x6c8e('0x53')][_0x6c8e('0x4b')]({'name':_0x5df005['name'],'resourceId':_0x5df005['id'],'type':_0x5c7509[_0x6c8e('0x2e')],'sectionId':_0x5c7509['id']},{})[_0x6c8e('0x28')](function(){return _0x4c4d1d;});}else{return _0x4c4d1d;}})['catch'](function(_0x2bced7){logger[_0x6c8e('0x2c')](_0x6c8e('0x54'),_0x2bced7);throw _0x2bced7;});}return _0x4c4d1d;})[_0x6c8e('0x28')](respondWithResult(_0x5d8fff,0xc9))[_0x6c8e('0x48')](handleError(_0x5d8fff,null));};exports[_0x6c8e('0x27')]=function(_0x5d57de,_0x2ccd1d){if(_0x5d57de[_0x6c8e('0x4c')]['id']){delete _0x5d57de['body']['id'];}return db['Trigger'][_0x6c8e('0x4a')]({'where':{'id':_0x5d57de['params']['id']}})[_0x6c8e('0x28')](handleEntityNotFound(_0x2ccd1d,null))[_0x6c8e('0x28')](saveUpdates(_0x5d57de[_0x6c8e('0x4c')],null))[_0x6c8e('0x28')](respondWithResult(_0x2ccd1d,null))[_0x6c8e('0x48')](handleError(_0x2ccd1d,null));};exports[_0x6c8e('0x2b')]=function(_0x4ebee8,_0x4db4f8){return db[_0x6c8e('0x32')]['find']({'where':{'id':_0x4ebee8[_0x6c8e('0x49')]['id']}})[_0x6c8e('0x28')](handleEntityNotFound(_0x4db4f8,null))[_0x6c8e('0x28')](removeEntity(_0x4db4f8,null))[_0x6c8e('0x48')](handleError(_0x4db4f8,null));};exports['addAllCondition']=function(_0x532625,_0x4350af,_0x3d6035){if(_0x532625[_0x6c8e('0x4c')]['id']){delete _0x532625['body']['id'];}return db[_0x6c8e('0x32')][_0x6c8e('0x4a')]({'where':{'id':_0x532625[_0x6c8e('0x49')]['id']}})[_0x6c8e('0x28')](handleEntityNotFound(_0x4350af,null))['then'](function(_0x27e99b){if(_0x27e99b){_0x532625['body']['TriggerAllId']=_0x27e99b['id'];return db[_0x6c8e('0x55')][_0x6c8e('0x4b')](_0x532625[_0x6c8e('0x4c')]);}})[_0x6c8e('0x28')](respondWithResult(_0x4350af,null))[_0x6c8e('0x48')](handleError(_0x4350af,null));};exports[_0x6c8e('0x56')]=function(_0x1414c2,_0xc002f8,_0x474be8){if(_0x1414c2[_0x6c8e('0x4c')]['id']){delete _0x1414c2[_0x6c8e('0x4c')]['id'];}return db['Trigger'][_0x6c8e('0x4a')]({'where':{'id':_0x1414c2[_0x6c8e('0x49')]['id']}})[_0x6c8e('0x28')](handleEntityNotFound(_0xc002f8,null))[_0x6c8e('0x28')](function(_0x14ef08){if(_0x14ef08){_0x1414c2[_0x6c8e('0x4c')][_0x6c8e('0x57')]=_0x14ef08['id'];return db['Condition'][_0x6c8e('0x4b')](_0x1414c2['body']);}})['then'](respondWithResult(_0xc002f8,null))[_0x6c8e('0x48')](handleError(_0xc002f8,null));};exports[_0x6c8e('0x58')]=function(_0x1a3612,_0x1c49bb,_0x22b830){var _0x34ba8b={};var _0x377b80={};var _0x8edb5f;var _0x406612;return db['Trigger']['findOne']({'where':{'id':_0x1a3612['params']['id']}})['then'](handleEntityNotFound(_0x1c49bb,null))[_0x6c8e('0x28')](function(_0x401e9c){if(_0x401e9c){_0x8edb5f=_0x401e9c;_0x377b80[_0x6c8e('0x36')]=_[_0x6c8e('0x38')](db[_0x6c8e('0x55')][_0x6c8e('0x33')]);_0x377b80['query']=_[_0x6c8e('0x38')](_0x1a3612[_0x6c8e('0x37')]);_0x377b80[_0x6c8e('0x39')]=_[_0x6c8e('0x3a')](_0x377b80[_0x6c8e('0x36')],_0x377b80[_0x6c8e('0x37')]);_0x34ba8b[_0x6c8e('0x3b')]=_['intersection'](_0x377b80[_0x6c8e('0x36')],qs[_0x6c8e('0x3c')](_0x1a3612['query'][_0x6c8e('0x3c')]));_0x34ba8b[_0x6c8e('0x3b')]=_0x34ba8b['attributes'][_0x6c8e('0x3d')]?_0x34ba8b[_0x6c8e('0x3b')]:_0x377b80['model'];_0x34ba8b[_0x6c8e('0x59')]=qs[_0x6c8e('0x40')](_0x1a3612[_0x6c8e('0x37')][_0x6c8e('0x40')]);_0x34ba8b['where']=qs[_0x6c8e('0x39')](_['pick'](_0x1a3612[_0x6c8e('0x37')],_0x377b80['filters']));if(_0x1a3612[_0x6c8e('0x37')]['filter']){_0x34ba8b['where']=_[_0x6c8e('0x42')](_0x34ba8b['where'],{'$or':_[_0x6c8e('0x31')](_0x34ba8b[_0x6c8e('0x3b')],function(_0x3ee78e){var _0x321fbb={};_0x321fbb[_0x3ee78e]={'$like':'%'+_0x1a3612[_0x6c8e('0x37')][_0x6c8e('0x43')]+'%'};return _0x321fbb;})});}_0x34ba8b=_[_0x6c8e('0x42')]({},_0x34ba8b,_0x1a3612[_0x6c8e('0x44')]);return _0x8edb5f[_0x6c8e('0x58')](_0x34ba8b);}})['then'](function(_0x50336b){if(_0x50336b){_0x406612=_0x50336b[_0x6c8e('0x3d')];if(!_0x1a3612[_0x6c8e('0x37')][_0x6c8e('0x3e')]('nolimit')){_0x34ba8b[_0x6c8e('0x21')]=qs['limit'](_0x1a3612[_0x6c8e('0x37')][_0x6c8e('0x21')]);_0x34ba8b[_0x6c8e('0x20')]=qs[_0x6c8e('0x20')](_0x1a3612[_0x6c8e('0x37')][_0x6c8e('0x20')]);}return _0x8edb5f['getAllConditions'](_0x34ba8b);}})[_0x6c8e('0x28')](function(_0x473844){if(_0x473844){return _0x473844?{'count':_0x406612,'rows':_0x473844}:null;}})[_0x6c8e('0x28')](respondWithResult(_0x1c49bb,null))['catch'](handleError(_0x1c49bb,null));};exports[_0x6c8e('0x5a')]=function(_0x41be56,_0x28165c,_0x3440f4){var _0x5cf9d5={};var _0x5020fb={};var _0x1edbd3;var _0x5612d3;return db['Trigger'][_0x6c8e('0x5b')]({'where':{'id':_0x41be56[_0x6c8e('0x49')]['id']}})[_0x6c8e('0x28')](handleEntityNotFound(_0x28165c,null))[_0x6c8e('0x28')](function(_0x20eb7e){if(_0x20eb7e){_0x1edbd3=_0x20eb7e;_0x5020fb['model']=_[_0x6c8e('0x38')](db[_0x6c8e('0x55')]['rawAttributes']);_0x5020fb['query']=_[_0x6c8e('0x38')](_0x41be56[_0x6c8e('0x37')]);_0x5020fb[_0x6c8e('0x39')]=_[_0x6c8e('0x3a')](_0x5020fb[_0x6c8e('0x36')],_0x5020fb['query']);_0x5cf9d5[_0x6c8e('0x3b')]=_['intersection'](_0x5020fb['model'],qs[_0x6c8e('0x3c')](_0x41be56[_0x6c8e('0x37')][_0x6c8e('0x3c')]));_0x5cf9d5[_0x6c8e('0x3b')]=_0x5cf9d5[_0x6c8e('0x3b')]['length']?_0x5cf9d5['attributes']:_0x5020fb['model'];_0x5cf9d5[_0x6c8e('0x59')]=qs[_0x6c8e('0x40')](_0x41be56[_0x6c8e('0x37')][_0x6c8e('0x40')]);_0x5cf9d5[_0x6c8e('0x41')]=qs[_0x6c8e('0x39')](_[_0x6c8e('0x5c')](_0x41be56['query'],_0x5020fb[_0x6c8e('0x39')]));if(_0x41be56[_0x6c8e('0x37')][_0x6c8e('0x43')]){_0x5cf9d5[_0x6c8e('0x41')]=_[_0x6c8e('0x42')](_0x5cf9d5['where'],{'$or':_[_0x6c8e('0x31')](_0x5cf9d5[_0x6c8e('0x3b')],function(_0x2f3e52){var _0x5c0c72={};_0x5c0c72[_0x2f3e52]={'$like':'%'+_0x41be56['query'][_0x6c8e('0x43')]+'%'};return _0x5c0c72;})});}_0x5cf9d5=_[_0x6c8e('0x42')]({},_0x5cf9d5,_0x41be56[_0x6c8e('0x44')]);return _0x1edbd3[_0x6c8e('0x5a')](_0x5cf9d5);}})['then'](function(_0xc50836){if(_0xc50836){_0x5612d3=_0xc50836[_0x6c8e('0x3d')];if(!_0x41be56[_0x6c8e('0x37')][_0x6c8e('0x3e')]('nolimit')){_0x5cf9d5[_0x6c8e('0x21')]=qs[_0x6c8e('0x21')](_0x41be56[_0x6c8e('0x37')]['limit']);_0x5cf9d5[_0x6c8e('0x20')]=qs[_0x6c8e('0x20')](_0x41be56['query'][_0x6c8e('0x20')]);}return _0x1edbd3[_0x6c8e('0x5a')](_0x5cf9d5);}})[_0x6c8e('0x28')](function(_0x591b8b){if(_0x591b8b){return _0x591b8b?{'count':_0x5612d3,'rows':_0x591b8b}:null;}})[_0x6c8e('0x28')](respondWithResult(_0x28165c,null))['catch'](handleError(_0x28165c,null));};exports[_0x6c8e('0x5d')]=function(_0x56e8c1,_0x2e02bb,_0x4f67f7){if(_0x56e8c1[_0x6c8e('0x4c')]['id']){delete _0x56e8c1[_0x6c8e('0x4c')]['id'];}return db[_0x6c8e('0x32')][_0x6c8e('0x4a')]({'where':{'id':_0x56e8c1[_0x6c8e('0x49')]['id']}})[_0x6c8e('0x28')](handleEntityNotFound(_0x2e02bb,null))[_0x6c8e('0x28')](function(_0x36e738){if(_0x36e738){_0x56e8c1[_0x6c8e('0x4c')]['TriggerId']=_0x36e738['id'];return db[_0x6c8e('0x5e')][_0x6c8e('0x4b')](_0x56e8c1[_0x6c8e('0x4c')]);}})[_0x6c8e('0x28')](respondWithResult(_0x2e02bb,null))[_0x6c8e('0x48')](handleError(_0x2e02bb,null));};exports[_0x6c8e('0x5f')]=function(_0x15994c,_0x13e932,_0x332017){var _0x12c3d2={};var _0x3cf99a={};var _0xab77b;var _0x135766;return db['Trigger'][_0x6c8e('0x5b')]({'where':{'id':_0x15994c[_0x6c8e('0x49')]['id']}})[_0x6c8e('0x28')](handleEntityNotFound(_0x13e932,null))[_0x6c8e('0x28')](function(_0x1b725b){if(_0x1b725b){_0xab77b=_0x1b725b;_0x3cf99a[_0x6c8e('0x36')]=_[_0x6c8e('0x38')](db[_0x6c8e('0x5e')][_0x6c8e('0x33')]);_0x3cf99a['query']=_['keys'](_0x15994c['query']);_0x3cf99a[_0x6c8e('0x39')]=_[_0x6c8e('0x3a')](_0x3cf99a[_0x6c8e('0x36')],_0x3cf99a[_0x6c8e('0x37')]);_0x12c3d2['attributes']=_['intersection'](_0x3cf99a[_0x6c8e('0x36')],qs[_0x6c8e('0x3c')](_0x15994c[_0x6c8e('0x37')][_0x6c8e('0x3c')]));_0x12c3d2[_0x6c8e('0x3b')]=_0x12c3d2['attributes'][_0x6c8e('0x3d')]?_0x12c3d2[_0x6c8e('0x3b')]:_0x3cf99a['model'];_0x12c3d2['order']=qs[_0x6c8e('0x40')](_0x15994c[_0x6c8e('0x37')]['sort']);_0x12c3d2[_0x6c8e('0x41')]=qs[_0x6c8e('0x39')](_[_0x6c8e('0x5c')](_0x15994c[_0x6c8e('0x37')],_0x3cf99a[_0x6c8e('0x39')]));if(_0x15994c[_0x6c8e('0x37')]['filter']){_0x12c3d2[_0x6c8e('0x41')]=_['merge'](_0x12c3d2[_0x6c8e('0x41')],{'$or':_['map'](_0x12c3d2[_0x6c8e('0x3b')],function(_0x11d1f9){var _0x32774d={};_0x32774d[_0x11d1f9]={'$like':'%'+_0x15994c[_0x6c8e('0x37')][_0x6c8e('0x43')]+'%'};return _0x32774d;})});}_0x12c3d2=_[_0x6c8e('0x42')]({},_0x12c3d2,_0x15994c[_0x6c8e('0x44')]);return _0xab77b[_0x6c8e('0x5f')](_0x12c3d2);}})['then'](function(_0x4b8b1b){if(_0x4b8b1b){_0x135766=_0x4b8b1b[_0x6c8e('0x3d')];if(!_0x15994c[_0x6c8e('0x37')][_0x6c8e('0x3e')](_0x6c8e('0x3f'))){_0x12c3d2[_0x6c8e('0x21')]=qs[_0x6c8e('0x21')](_0x15994c[_0x6c8e('0x37')][_0x6c8e('0x21')]);_0x12c3d2['offset']=qs[_0x6c8e('0x20')](_0x15994c[_0x6c8e('0x37')][_0x6c8e('0x20')]);}return _0xab77b[_0x6c8e('0x5f')](_0x12c3d2);}})[_0x6c8e('0x28')](function(_0x4355c8){if(_0x4355c8){return _0x4355c8?{'count':_0x135766,'rows':_0x4355c8}:null;}})[_0x6c8e('0x28')](respondWithResult(_0x13e932,null))['catch'](handleError(_0x13e932,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 250cdd7..956e056 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 _0x4fef=['path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','lodash','util','api','bluebird','request-promise'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x4fef,0x10f));var _0xf4fe=function(_0xea47b9,_0x12aa17){_0xea47b9=_0xea47b9-0x0;var _0xae61ad=_0x4fef[_0xea47b9];return _0xae61ad;};'use strict';var _=require(_0xf4fe('0x0'));var util=require(_0xf4fe('0x1'));var logger=require('../../config/logger')(_0xf4fe('0x2'));var moment=require('moment');var BPromise=require(_0xf4fe('0x3'));var rp=require(_0xf4fe('0x4'));var fs=require('fs');var path=require(_0xf4fe('0x5'));var rimraf=require(_0xf4fe('0x6'));var config=require(_0xf4fe('0x7'));var attributes=require(_0xf4fe('0x8'));module[_0xf4fe('0x9')]=function(_0x27c6c9,_0x522427){return _0x27c6c9[_0xf4fe('0xa')](_0xf4fe('0xb'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x130d=['rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4f9baf,_0x17a0a1){var _0x5dd2dd=function(_0xc553ed){while(--_0xc553ed){_0x4f9baf['push'](_0x4f9baf['shift']());}};_0x5dd2dd(++_0x17a0a1);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd130('0x0'));var util=require('util');var logger=require(_0xd130('0x1'))('api');var moment=require(_0xd130('0x2'));var BPromise=require(_0xd130('0x3'));var rp=require(_0xd130('0x4'));var fs=require('fs');var path=require(_0xd130('0x5'));var rimraf=require(_0xd130('0x6'));var config=require(_0xd130('0x7'));var attributes=require(_0xd130('0x8'));module[_0xd130('0x9')]=function(_0x287e61,_0x4689a8){return _0x287e61[_0xd130('0xa')](_0xd130('0xb'),attributes,{'tableName':_0xd130('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 24ab05d..e402cf8 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 _0x6bc5=['GetTrigger','catch','ShowTrigger','find','then','lodash','util','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','result','Trigger','findAll','options','raw','where','map','include','attributes','model'];(function(_0x3a4128,_0x5c9817){var _0x34e314=function(_0x36e51f){while(--_0x36e51f){_0x3a4128['push'](_0x3a4128['shift']());}};_0x34e314(++_0x5c9817);}(_0x6bc5,0x11c));var _0x56bc=function(_0x27fe77,_0x3fa847){_0x27fe77=_0x27fe77-0x0;var _0x29098a=_0x6bc5[_0x27fe77];return _0x29098a;};'use strict';var _=require(_0x56bc('0x0'));var util=require(_0x56bc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56bc('0x2'))['db'];var utils=require(_0x56bc('0x3'));var logger=require(_0x56bc('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x56bc('0x5'));var client=jayson[_0x56bc('0x6')][_0x56bc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x23ad75,_0x32c791,_0x52d960){return new BPromise(function(_0x1d477e,_0x4b2d24){return client['request'](_0x23ad75,_0x52d960)['then'](function(_0x2ac061){logger[_0x56bc('0x8')](_0x56bc('0x9'),_0x32c791,_0x56bc('0xa'));logger[_0x56bc('0xb')](_0x56bc('0xc'),_0x32c791,_0x56bc('0xa'),JSON['stringify'](_0x2ac061));if(_0x2ac061['error']){if(_0x2ac061[_0x56bc('0xd')][_0x56bc('0xe')]===0x1f4){logger[_0x56bc('0xd')](_0x56bc('0x9'),_0x32c791,_0x2ac061[_0x56bc('0xd')]['message']);return _0x4b2d24(_0x2ac061['error'][_0x56bc('0xf')]);}logger[_0x56bc('0xd')](_0x56bc('0x9'),_0x32c791,_0x2ac061[_0x56bc('0xd')]['message']);return _0x1d477e(_0x2ac061[_0x56bc('0xd')][_0x56bc('0xf')]);}else{logger[_0x56bc('0x8')](_0x56bc('0x9'),_0x32c791,_0x56bc('0xa'));_0x1d477e(_0x2ac061[_0x56bc('0x10')][_0x56bc('0xf')]);}})['catch'](function(_0x537bd0){logger[_0x56bc('0xd')](_0x56bc('0x9'),_0x32c791,_0x537bd0);_0x4b2d24(_0x537bd0);});});}exports['GetTrigger']=function(_0x4e546c){var _0x5fe758=this;return new Promise(function(_0x3233b9,_0x49cccf){return db[_0x56bc('0x11')][_0x56bc('0x12')]({'raw':_0x4e546c[_0x56bc('0x13')]?_0x4e546c[_0x56bc('0x13')][_0x56bc('0x14')]===undefined?!![]:![]:!![],'where':_0x4e546c[_0x56bc('0x13')]?_0x4e546c[_0x56bc('0x13')][_0x56bc('0x15')]||null:null,'attributes':_0x4e546c[_0x56bc('0x13')]?_0x4e546c[_0x56bc('0x13')]['attributes']||null:null,'limit':_0x4e546c[_0x56bc('0x13')]?_0x4e546c[_0x56bc('0x13')]['limit']||null:null,'include':_0x4e546c[_0x56bc('0x13')]?_0x4e546c[_0x56bc('0x13')]['include']?_[_0x56bc('0x16')](_0x4e546c[_0x56bc('0x13')][_0x56bc('0x17')],function(_0x2ab5c6){return{'model':db[_0x2ab5c6['model']],'as':_0x2ab5c6['as'],'attributes':_0x2ab5c6[_0x56bc('0x18')],'include':_0x2ab5c6[_0x56bc('0x17')]?_[_0x56bc('0x16')](_0x2ab5c6[_0x56bc('0x17')],function(_0x4dce02){return{'model':db[_0x4dce02[_0x56bc('0x19')]],'as':_0x4dce02['as'],'attributes':_0x4dce02[_0x56bc('0x18')],'include':_0x4dce02['include']?_[_0x56bc('0x16')](_0x4dce02[_0x56bc('0x17')],function(_0x4fc734){return{'model':db[_0x4fc734[_0x56bc('0x19')]],'as':_0x4fc734['as'],'attributes':_0x4fc734[_0x56bc('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d3dae){logger[_0x56bc('0x8')](_0x56bc('0x1a'),_0x4e546c);logger[_0x56bc('0xb')](_0x56bc('0x1a'),_0x4e546c,JSON['stringify'](_0x5d3dae));_0x3233b9(_0x5d3dae);})[_0x56bc('0x1b')](function(_0x5c93a6){logger[_0x56bc('0xd')]('GetTrigger',_0x5c93a6['message'],_0x4e546c);_0x49cccf(_0x5fe758[_0x56bc('0xd')](0x1f4,_0x5c93a6[_0x56bc('0xf')]));});});};exports[_0x56bc('0x1c')]=function(_0x504422){var _0x2f0d80=this;return new Promise(function(_0x3c4bff,_0x2a9c77){return db['Trigger'][_0x56bc('0x1d')]({'raw':_0x504422['options']?_0x504422['options'][_0x56bc('0x14')]===undefined?!![]:![]:!![],'where':_0x504422['options']?_0x504422[_0x56bc('0x13')]['where']||null:null,'attributes':_0x504422[_0x56bc('0x13')]?_0x504422[_0x56bc('0x13')]['attributes']||null:null,'include':_0x504422[_0x56bc('0x13')]?_0x504422[_0x56bc('0x13')][_0x56bc('0x17')]?_[_0x56bc('0x16')](_0x504422[_0x56bc('0x13')][_0x56bc('0x17')],function(_0x4c4365){return{'model':db[_0x4c4365[_0x56bc('0x19')]],'as':_0x4c4365['as'],'attributes':_0x4c4365[_0x56bc('0x18')],'include':_0x4c4365[_0x56bc('0x17')]?_[_0x56bc('0x16')](_0x4c4365[_0x56bc('0x17')],function(_0xdf8bc7){return{'model':db[_0xdf8bc7[_0x56bc('0x19')]],'as':_0xdf8bc7['as'],'attributes':_0xdf8bc7[_0x56bc('0x18')],'include':_0xdf8bc7[_0x56bc('0x17')]?_[_0x56bc('0x16')](_0xdf8bc7[_0x56bc('0x17')],function(_0x28a57f){return{'model':db[_0x28a57f[_0x56bc('0x19')]],'as':_0x28a57f['as'],'attributes':_0x28a57f[_0x56bc('0x18')]};}):[]};}):[]};}):[]:[]})[_0x56bc('0x1e')](function(_0x53667f){logger[_0x56bc('0x8')](_0x56bc('0x1c'),_0x504422);logger[_0x56bc('0xb')]('ShowTrigger',_0x504422,JSON['stringify'](_0x53667f));_0x3c4bff(_0x53667f);})[_0x56bc('0x1b')](function(_0x204216){logger[_0x56bc('0xd')](_0x56bc('0x1c'),_0x204216[_0x56bc('0xf')],_0x504422);_0x2a9c77(_0x2f0d80[_0x56bc('0xd')](0x1f4,_0x204216[_0x56bc('0xf')]));});});}; \ No newline at end of file +var _0xb712=['request','then','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','Trigger','findAll','options','where','include','map','model','attributes','GetTrigger','ShowTrigger','find','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http'];(function(_0x378891,_0x4e3e16){var _0xfbfda2=function(_0x3b7681){while(--_0x3b7681){_0x378891['push'](_0x378891['shift']());}};_0xfbfda2(++_0x4e3e16);}(_0xb712,0x129));var _0x2b71=function(_0x4d2248,_0x56403d){_0x4d2248=_0x4d2248-0x0;var _0x4ca283=_0xb712[_0x4d2248];return _0x4ca283;};'use strict';var _=require(_0x2b71('0x0'));var util=require('util');var moment=require(_0x2b71('0x1'));var BPromise=require('bluebird');var rs=require(_0x2b71('0x2'));var fs=require('fs');var Redis=require(_0x2b71('0x3'));var db=require(_0x2b71('0x4'))['db'];var utils=require(_0x2b71('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2b71('0x6'));var jayson=require(_0x2b71('0x7'));var client=jayson['client'][_0x2b71('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e1635,_0x398016,_0x378d95){return new BPromise(function(_0x5da993,_0xd0252c){return client[_0x2b71('0x9')](_0x3e1635,_0x378d95)[_0x2b71('0xa')](function(_0xf2b09f){logger['info'](_0x2b71('0xb'),_0x398016,'request\x20sent');logger[_0x2b71('0xc')](_0x2b71('0xd'),_0x398016,_0x2b71('0xe'),JSON[_0x2b71('0xf')](_0xf2b09f));if(_0xf2b09f[_0x2b71('0x10')]){if(_0xf2b09f[_0x2b71('0x10')][_0x2b71('0x11')]===0x1f4){logger[_0x2b71('0x10')](_0x2b71('0xb'),_0x398016,_0xf2b09f[_0x2b71('0x10')][_0x2b71('0x12')]);return _0xd0252c(_0xf2b09f[_0x2b71('0x10')][_0x2b71('0x12')]);}logger[_0x2b71('0x10')](_0x2b71('0xb'),_0x398016,_0xf2b09f[_0x2b71('0x10')][_0x2b71('0x12')]);return _0x5da993(_0xf2b09f[_0x2b71('0x10')][_0x2b71('0x12')]);}else{logger[_0x2b71('0x13')](_0x2b71('0xb'),_0x398016,'request\x20sent');_0x5da993(_0xf2b09f[_0x2b71('0x14')][_0x2b71('0x12')]);}})[_0x2b71('0x15')](function(_0x42fa81){logger[_0x2b71('0x10')](_0x2b71('0xb'),_0x398016,_0x42fa81);_0xd0252c(_0x42fa81);});});}exports['GetTrigger']=function(_0x4cf03b){var _0x4dd7ad=this;return new Promise(function(_0x4ab14b,_0x16a586){return db[_0x2b71('0x16')][_0x2b71('0x17')]({'raw':_0x4cf03b[_0x2b71('0x18')]?_0x4cf03b[_0x2b71('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4cf03b[_0x2b71('0x18')]?_0x4cf03b['options'][_0x2b71('0x19')]||null:null,'attributes':_0x4cf03b[_0x2b71('0x18')]?_0x4cf03b[_0x2b71('0x18')]['attributes']||null:null,'limit':_0x4cf03b[_0x2b71('0x18')]?_0x4cf03b[_0x2b71('0x18')]['limit']||null:null,'include':_0x4cf03b[_0x2b71('0x18')]?_0x4cf03b['options'][_0x2b71('0x1a')]?_[_0x2b71('0x1b')](_0x4cf03b[_0x2b71('0x18')][_0x2b71('0x1a')],function(_0x3cb273){return{'model':db[_0x3cb273[_0x2b71('0x1c')]],'as':_0x3cb273['as'],'attributes':_0x3cb273[_0x2b71('0x1d')],'include':_0x3cb273[_0x2b71('0x1a')]?_[_0x2b71('0x1b')](_0x3cb273[_0x2b71('0x1a')],function(_0x2ad5f7){return{'model':db[_0x2ad5f7[_0x2b71('0x1c')]],'as':_0x2ad5f7['as'],'attributes':_0x2ad5f7[_0x2b71('0x1d')],'include':_0x2ad5f7[_0x2b71('0x1a')]?_[_0x2b71('0x1b')](_0x2ad5f7['include'],function(_0x14e47a){return{'model':db[_0x14e47a[_0x2b71('0x1c')]],'as':_0x14e47a['as'],'attributes':_0x14e47a[_0x2b71('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2b71('0xa')](function(_0x3410c9){logger[_0x2b71('0x13')](_0x2b71('0x1e'),_0x4cf03b);logger['debug'](_0x2b71('0x1e'),_0x4cf03b,JSON[_0x2b71('0xf')](_0x3410c9));_0x4ab14b(_0x3410c9);})['catch'](function(_0x19e28f){logger[_0x2b71('0x10')](_0x2b71('0x1e'),_0x19e28f[_0x2b71('0x12')],_0x4cf03b);_0x16a586(_0x4dd7ad[_0x2b71('0x10')](0x1f4,_0x19e28f[_0x2b71('0x12')]));});});};exports[_0x2b71('0x1f')]=function(_0x16d773){var _0x52c857=this;return new Promise(function(_0x37ab13,_0x4b0da6){return db['Trigger'][_0x2b71('0x20')]({'raw':_0x16d773[_0x2b71('0x18')]?_0x16d773['options'][_0x2b71('0x21')]===undefined?!![]:![]:!![],'where':_0x16d773[_0x2b71('0x18')]?_0x16d773[_0x2b71('0x18')][_0x2b71('0x19')]||null:null,'attributes':_0x16d773[_0x2b71('0x18')]?_0x16d773[_0x2b71('0x18')][_0x2b71('0x1d')]||null:null,'include':_0x16d773['options']?_0x16d773[_0x2b71('0x18')]['include']?_['map'](_0x16d773[_0x2b71('0x18')][_0x2b71('0x1a')],function(_0x4672c3){return{'model':db[_0x4672c3[_0x2b71('0x1c')]],'as':_0x4672c3['as'],'attributes':_0x4672c3[_0x2b71('0x1d')],'include':_0x4672c3[_0x2b71('0x1a')]?_[_0x2b71('0x1b')](_0x4672c3[_0x2b71('0x1a')],function(_0x1d321f){return{'model':db[_0x1d321f['model']],'as':_0x1d321f['as'],'attributes':_0x1d321f[_0x2b71('0x1d')],'include':_0x1d321f['include']?_[_0x2b71('0x1b')](_0x1d321f[_0x2b71('0x1a')],function(_0x3b0f5d){return{'model':db[_0x3b0f5d['model']],'as':_0x3b0f5d['as'],'attributes':_0x3b0f5d[_0x2b71('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1274bc){logger[_0x2b71('0x13')](_0x2b71('0x1f'),_0x16d773);logger[_0x2b71('0xc')](_0x2b71('0x1f'),_0x16d773,JSON[_0x2b71('0xf')](_0x1274bc));_0x37ab13(_0x1274bc);})[_0x2b71('0x15')](function(_0x33f218){logger[_0x2b71('0x10')](_0x2b71('0x1f'),_0x33f218['message'],_0x16d773);_0x4b0da6(_0x52c857[_0x2b71('0x10')](0x1f4,_0x33f218[_0x2b71('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index fbe7020..8e10479 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 _0x797b=['post','create','put','update','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./trunk.controller','isAuthenticated','index','get','show','/:id/clone','clone'];(function(_0x243869,_0x76ff3b){var _0x5728f5=function(_0x2a0d58){while(--_0x2a0d58){_0x243869['push'](_0x243869['shift']());}};_0x5728f5(++_0x76ff3b);}(_0x797b,0xe3));var _0xb797=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0x797b[_0x4687df];return _0x32eaef;};'use strict';var multer=require(_0xb797('0x0'));var util=require(_0xb797('0x1'));var path=require(_0xb797('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb797('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb797('0x4'));var interaction=require(_0xb797('0x5'));var config=require('../../config/environment');var controller=require(_0xb797('0x6'));router['get']('/',auth[_0xb797('0x7')](),controller[_0xb797('0x8')]);router[_0xb797('0x9')]('/:id',auth[_0xb797('0x7')](),controller[_0xb797('0xa')]);router['post'](_0xb797('0xb'),auth['isAuthenticated'](),controller[_0xb797('0xc')]);router[_0xb797('0xd')]('/',auth['isAuthenticated'](),controller[_0xb797('0xe')]);router[_0xb797('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb797('0x10')]);router[_0xb797('0x11')](_0xb797('0x12'),auth[_0xb797('0x7')](),controller[_0xb797('0x13')]);module['exports']=router; \ No newline at end of file +var _0x447b=['clone','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','isAuthenticated','index','get','/:id','show','post','/:id/clone'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x447b,0x1a9));var _0xb447=function(_0x823eb3,_0x3bb3f3){_0x823eb3=_0x823eb3-0x0;var _0x1c946d=_0x447b[_0x823eb3];return _0x1c946d;};'use strict';var multer=require(_0xb447('0x0'));var util=require('util');var path=require(_0xb447('0x1'));var timeout=require(_0xb447('0x2'));var express=require(_0xb447('0x3'));var router=express[_0xb447('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('./trunk.controller');router['get']('/',auth[_0xb447('0x5')](),controller[_0xb447('0x6')]);router[_0xb447('0x7')](_0xb447('0x8'),auth['isAuthenticated'](),controller[_0xb447('0x9')]);router[_0xb447('0xa')](_0xb447('0xb'),auth[_0xb447('0x5')](),controller[_0xb447('0xc')]);router[_0xb447('0xa')]('/',auth[_0xb447('0x5')](),controller[_0xb447('0xd')]);router[_0xb447('0xe')](_0xb447('0x8'),auth[_0xb447('0x5')](),controller[_0xb447('0xf')]);router[_0xb447('0x10')]('/:id',auth[_0xb447('0x5')](),controller[_0xb447('0x11')]);module[_0xb447('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 24a0dac..43ea006 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 _0xf962=['ENUM','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','INTEGER','refuse','uac','uas','pai','certificate','active','actpass','dynamic','nonat','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x2ecd9d,_0x4fe14c){var _0x27f062=function(_0x391408){while(--_0x391408){_0x2ecd9d['push'](_0x2ecd9d['shift']());}};_0x27f062(++_0x4fe14c);}(_0xf962,0xbc));var _0x2f96=function(_0x26222d,_0x1d2de1){_0x26222d=_0x26222d-0x0;var _0x16bf9f=_0xf962[_0x26222d];return _0x16bf9f;};'use strict';var Sequelize=require(_0x2f96('0x0'));module[_0x2f96('0x1')]={'name':{'type':Sequelize[_0x2f96('0x2')],'allowNull':![],'unique':_0x2f96('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x5'),_0x2f96('0x6'),_0x2f96('0x7')),'allowNull':![],'defaultValue':_0x2f96('0x5')},'context':{'type':Sequelize[_0x2f96('0x2')],'allowNull':![],'defaultValue':_0x2f96('0x8')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x2f96('0x9'),_0x2f96('0xa'),_0x2f96('0xb'),_0x2f96('0xc'),_0x2f96('0xd'),_0x2f96('0xe'),_0x2f96('0xf'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x2f96('0x2')]},'secret':{'type':Sequelize[_0x2f96('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x2f96('0x2')],'defaultValue':_0x2f96('0x10'),'set':function(_0x46d41b){this[_0x2f96('0x11')](_0x2f96('0x12'),_0x46d41b?_0x46d41b[_0x2f96('0x13')](','):null);},'get':function(){return this[_0x2f96('0x14')]('transport')?this[_0x2f96('0x14')]('transport')[_0x2f96('0x15')](','):null;},'comment':_0x2f96('0x16')},'dtmfmode':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x17'),_0x2f96('0x18'),'shortinfo',_0x2f96('0x19'),_0x2f96('0x1a')),'defaultValue':_0x2f96('0x17')},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat','update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2f96('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x2f96('0x2')],'defaultValue':_0x2f96('0x1c'),'set':function(_0x955596){this[_0x2f96('0x11')]('nat',_0x955596?_0x955596[_0x2f96('0x13')](','):null);},'get':function(){return this['getDataValue'](_0x2f96('0x1d'))?this['getDataValue']('nat')[_0x2f96('0x15')](','):null;},'comment':_0x2f96('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x2f96('0x2')]},'pickupgroup':{'type':Sequelize[_0x2f96('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x2f96('0x2')]},'language':{'type':Sequelize[_0x2f96('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2f96('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2f96('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x2f96('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x121053){this[_0x2f96('0x11')](_0x2f96('0x1f'),_0x121053?_0x121053[_0x2f96('0x13')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x2f96('0x14')](_0x2f96('0x1f'))?this[_0x2f96('0x14')](_0x2f96('0x1f'))[_0x2f96('0x15')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x2f96('0x4')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x208cd8){this[_0x2f96('0x11')](_0x2f96('0x20'),_0x208cd8?_0x208cd8[_0x2f96('0x13')](','):null);},'get':function(){return this[_0x2f96('0x14')](_0x2f96('0x20'))?this['getDataValue'](_0x2f96('0x20'))[_0x2f96('0x15')](','):null;},'comment':_0x2f96('0x21')},'trustrpid':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x2f96('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no',_0x2f96('0x22'))},'promiscredir':{'type':Sequelize[_0x2f96('0x4')]('yes','no')},'useclientcode':{'type':Sequelize[_0x2f96('0x4')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x2f96('0x23')},'amaflags':{'type':Sequelize[_0x2f96('0x2')]},'callcounter':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no'),'defaultValue':_0x2f96('0x1b')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x2f96('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no')},'subscribecontext':{'type':Sequelize[_0x2f96('0x2')]},'template':{'type':Sequelize[_0x2f96('0x2')]},'videosupport':{'type':Sequelize[_0x2f96('0x4')]('yes','no',_0x2f96('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2f96('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no')},'mailbox':{'type':Sequelize[_0x2f96('0x2')]},'session_timers':{'type':Sequelize[_0x2f96('0x4')]('accept',_0x2f96('0x26'),'originate')},'session_expires':{'type':Sequelize[_0x2f96('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x2f96('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x27'),_0x2f96('0x28')),'defaultValue':_0x2f96('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x2f96('0x2')]},'regexten':{'type':Sequelize[_0x2f96('0x2')]},'fromdomain':{'type':Sequelize[_0x2f96('0x2')]},'fromuser':{'type':Sequelize[_0x2f96('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no'),'defaultValue':_0x2f96('0x1b')},'keepalive':{'type':Sequelize[_0x2f96('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x2f96('0x2')]},'defaultuser':{'type':Sequelize[_0x2f96('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2f96('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x2f96('0x4')]('yes','no',_0x2f96('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2f96('0x2')]},'callbackextension':{'type':Sequelize[_0x2f96('0x2')]},'timert1':{'type':Sequelize[_0x2f96('0x25')](0xb)},'timerb':{'type':Sequelize[_0x2f96('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2f96('0x25')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x2f96('0x2')]},'contactacl':{'type':Sequelize[_0x2f96('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2f96('0x2')]},'use_q850_reason':{'type':Sequelize[_0x2f96('0x2')]},'maxforwards':{'type':Sequelize[_0x2f96('0x25')](0xb)},'encryption':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no')},'icesupport':{'type':Sequelize[_0x2f96('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x2f96('0x1b'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x2f96('0x1b'),'no','fingerprint',_0x2f96('0x2a'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x2f96('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x2f96('0x2')]},'dtlscipher':{'type':Sequelize[_0x2f96('0x2')]},'dtlscafile':{'type':Sequelize[_0x2f96('0x2')]},'dtlscapath':{'type':Sequelize[_0x2f96('0x2')]},'dtlssetup':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x2b'),'passive',_0x2f96('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x2f96('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2f96('0x4')](_0x2f96('0x1b'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x2f96('0x2')]},'mohsuggest':{'type':Sequelize[_0x2f96('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2f96('0x2')]},'host':{'type':Sequelize[_0x2f96('0x2')],'defaultValue':_0x2f96('0x2d')},'canreinvite':{'type':Sequelize[_0x2f96('0x4')]('yes','no',_0x2f96('0x2e'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2f96('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x2f96('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2f96('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x4e7f=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','outgoing','yes','force_rport,comedia','nat','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','nonat','update','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','join','getDataValue','transport'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x4e7f,0x130));var _0xf4e7=function(_0x41d684,_0x52f976){_0x41d684=_0x41d684-0x0;var _0x83b011=_0x4e7f[_0x41d684];return _0x83b011;};'use strict';var Sequelize=require(_0xf4e7('0x0'));module[_0xf4e7('0x1')]={'name':{'type':Sequelize[_0xf4e7('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x4'),_0xf4e7('0x5'),_0xf4e7('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xf4e7('0x2')],'allowNull':![],'defaultValue':_0xf4e7('0x7')},'callingpres':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x8'),_0xf4e7('0x9'),_0xf4e7('0xa'),_0xf4e7('0xb'),_0xf4e7('0xc'),_0xf4e7('0xd'),_0xf4e7('0xe'),_0xf4e7('0xf'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xf4e7('0x2')]},'secret':{'type':Sequelize[_0xf4e7('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x1726be){this[_0xf4e7('0x10')]('transport',_0x1726be?_0x1726be[_0xf4e7('0x11')](','):null);},'get':function(){return this[_0xf4e7('0x12')](_0xf4e7('0x13'))?this['getDataValue'](_0xf4e7('0x13'))[_0xf4e7('0x14')](','):null;},'comment':_0xf4e7('0x15')},'dtmfmode':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x16'),_0xf4e7('0x17'),'shortinfo',_0xf4e7('0x18'),_0xf4e7('0x19')),'defaultValue':_0xf4e7('0x16')},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat','update',_0xf4e7('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf4e7('0x2')]},'directmediadeny':{'type':Sequelize[_0xf4e7('0x2')]},'nat':{'type':Sequelize[_0xf4e7('0x2')],'defaultValue':_0xf4e7('0x1c'),'set':function(_0x332217){this['setDataValue'](_0xf4e7('0x1d'),_0x332217?_0x332217[_0xf4e7('0x11')](','):null);},'get':function(){return this[_0xf4e7('0x12')](_0xf4e7('0x1d'))?this[_0xf4e7('0x12')]('nat')[_0xf4e7('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xf4e7('0x2')]},'pickupgroup':{'type':Sequelize[_0xf4e7('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf4e7('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf4e7('0x2')],'defaultValue':_0xf4e7('0x1e')},'allow':{'type':Sequelize[_0xf4e7('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x49d6e3){this[_0xf4e7('0x10')](_0xf4e7('0x1f'),_0x49d6e3?_0x49d6e3[_0xf4e7('0x11')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xf4e7('0x12')](_0xf4e7('0x1f'))?this[_0xf4e7('0x12')](_0xf4e7('0x1f'))[_0xf4e7('0x14')](';'):null;},'comment':_0xf4e7('0x20')},'autoframing':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no')},'insecure':{'type':Sequelize[_0xf4e7('0x2')],'defaultValue':'port,invite','set':function(_0x10f95c){this[_0xf4e7('0x10')](_0xf4e7('0x21'),_0x10f95c?_0x10f95c[_0xf4e7('0x11')](','):null);},'get':function(){return this[_0xf4e7('0x12')]('insecure')?this[_0xf4e7('0x12')](_0xf4e7('0x21'))['split'](','):null;},'comment':_0xf4e7('0x22')},'trustrpid':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no',_0xf4e7('0x23'))},'promiscredir':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no')},'accountcode':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'setvar':{'type':Sequelize[_0xf4e7('0x2')]},'callerid':{'type':Sequelize[_0xf4e7('0x2')],'defaultValue':_0xf4e7('0x25')},'amaflags':{'type':Sequelize[_0xf4e7('0x2')]},'callcounter':{'type':Sequelize[_0xf4e7('0x3')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0xf4e7('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xf4e7('0x2')]},'videosupport':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no',_0xf4e7('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no')},'mailbox':{'type':Sequelize[_0xf4e7('0x2')]},'session_timers':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x27'),_0xf4e7('0x28'),_0xf4e7('0x29'))},'session_expires':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x2a'),_0xf4e7('0x2b')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xf4e7('0x2')]},'regexten':{'type':Sequelize[_0xf4e7('0x2')]},'fromdomain':{'type':Sequelize[_0xf4e7('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xf4e7('0x2')]},'rtptimeout':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no',_0xf4e7('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xf4e7('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xf4e7('0x2')]},'contactacl':{'type':Sequelize[_0xf4e7('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xf4e7('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'encryption':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no')},'dtlsverify':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no',_0xf4e7('0x2d'),_0xf4e7('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xf4e7('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xf4e7('0x2')]},'dtlscipher':{'type':Sequelize[_0xf4e7('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xf4e7('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xf4e7('0x2f'),_0xf4e7('0x30'),_0xf4e7('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf4e7('0x2')]},'usereqphone':{'type':Sequelize[_0xf4e7('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xf4e7('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0xf4e7('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0xf4e7('0x2')]},'mohinterpret':{'type':Sequelize[_0xf4e7('0x2')]},'mohsuggest':{'type':Sequelize[_0xf4e7('0x2')]},'parkinglot':{'type':Sequelize[_0xf4e7('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xf4e7('0x3')]('yes','no',_0xf4e7('0x32'),_0xf4e7('0x33'),_0xf4e7('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf4e7('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xf4e7('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xf4e7('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 52c47b8..7750f28 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 _0x6aa7=['sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','clone','find','get','createdAt','body','omit','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','update','utf8','server/files/templates/registry.ejs','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','order'];(function(_0x4b2d3b,_0x4d1ea9){var _0x4bd344=function(_0x2b4734){while(--_0x2b4734){_0x4b2d3b['push'](_0x4b2d3b['shift']());}};_0x4bd344(++_0x4d1ea9);}(_0x6aa7,0x178));var _0x76aa=function(_0x57a8ef,_0x3009ed){_0x57a8ef=_0x57a8ef-0x0;var _0x273a49=_0x6aa7[_0x57a8ef];return _0x273a49;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x76aa('0x19'));var client=jayson['client'][_0x76aa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12dde0,_0x3f8f6b,_0x8e44ed,_0x10432c){return new BPromise(function(_0x4e309f,_0x5f5b59){var _0x2b3b4f=_0x10432c||client;return _0x2b3b4f['request'](_0x12dde0,_0x8e44ed)[_0x76aa('0x1b')](function(_0x319bf1){logger['info'](_0x76aa('0x1c'),_0x3f8f6b,'request\x20sent');logger[_0x76aa('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3f8f6b,_0x76aa('0x1e'),JSON[_0x76aa('0x1f')](_0x319bf1));if(_0x319bf1[_0x76aa('0x20')]){if(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x21')]===0x1f4){logger[_0x76aa('0x20')]('Trunk,\x20%s,\x20%s',_0x3f8f6b,_0x319bf1['error'][_0x76aa('0x22')]);return _0x5f5b59(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);return _0x4e309f(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}else{logger['info'](_0x76aa('0x1c'),_0x3f8f6b,_0x76aa('0x1e'));_0x4e309f(_0x319bf1[_0x76aa('0x23')]['message']);}})[_0x76aa('0x24')](function(_0x189cb6){logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x189cb6);_0x5f5b59(_0x189cb6);});});}function respondWithStatusCode(_0x29c50c,_0xc1044c){_0xc1044c=_0xc1044c||0xcc;return function(_0x3cd039){if(_0x3cd039){return _0x29c50c[_0x76aa('0x25')](_0xc1044c);}return _0x29c50c[_0x76aa('0x26')](_0xc1044c)[_0x76aa('0x27')]();};}function respondWithResult(_0x37f1ab,_0x26b75e){_0x26b75e=_0x26b75e||0xc8;return function(_0x3599a9){if(_0x3599a9){return _0x37f1ab['status'](_0x26b75e)[_0x76aa('0x28')](_0x3599a9);}};}function respondWithFilteredResult(_0x1d6d15,_0x25c614){return function(_0x2e7ab4){if(_0x2e7ab4){var _0xa1e6=typeof _0x25c614[_0x76aa('0x29')]===_0x76aa('0x2a')&&typeof _0x25c614[_0x76aa('0x2b')]===_0x76aa('0x2a');var _0x1bdc3d=_0x2e7ab4['count'];var _0x3fcb7f=_0xa1e6?0x0:_0x25c614['offset'];var _0x994550=_0xa1e6?_0x2e7ab4[_0x76aa('0x2c')]:_0x25c614[_0x76aa('0x29')]+_0x25c614[_0x76aa('0x2b')];var _0x1eecd9;if(_0x994550>=_0x1bdc3d){_0x994550=_0x1bdc3d;_0x1eecd9=0xc8;}else{_0x1eecd9=0xce;}_0x1d6d15[_0x76aa('0x26')](_0x1eecd9);return _0x1d6d15[_0x76aa('0x2d')](_0x76aa('0x2e'),_0x3fcb7f+'-'+_0x994550+'/'+_0x1bdc3d)[_0x76aa('0x28')](_0x2e7ab4);}return null;};}function patchUpdates(_0x3ea05a){return function(_0x5edcd8){try{jsonpatch[_0x76aa('0x2f')](_0x5edcd8,_0x3ea05a,!![]);}catch(_0x5532c7){return BPromise[_0x76aa('0x30')](_0x5532c7);}return _0x5edcd8[_0x76aa('0x31')]();};}function saveUpdates(_0x458ac3,_0x38ecd1){return function(_0x35a705){if(_0x35a705){return _0x35a705['update'](_0x458ac3)[_0x76aa('0x1b')](function(_0x25a11f){return _0x25a11f;});}return null;};}function removeEntity(_0x5a0f72,_0x2ee338){return function(_0x58d860){if(_0x58d860){return _0x58d860[_0x76aa('0x32')]()['then'](function(){var _0x8479a3=_0x58d860['get']({'plain':!![]});var _0x58f135=_0x76aa('0x33');return db[_0x76aa('0x34')][_0x76aa('0x32')]({'where':{'type':_0x58f135,'resourceId':_0x8479a3['id']}})[_0x76aa('0x1b')](function(){return _0x58d860;});})['then'](function(){_0x5a0f72['status'](0xcc)[_0x76aa('0x27')]();});}};}function handleEntityNotFound(_0x1c7b6f,_0x58127c){return function(_0x23e2fd){if(!_0x23e2fd){_0x1c7b6f[_0x76aa('0x25')](0x194);}return _0x23e2fd;};}function handleError(_0x5b57d8,_0x9ce5f4){_0x9ce5f4=_0x9ce5f4||0x1f4;return function(_0x5c77f1){logger['error'](_0x5c77f1[_0x76aa('0x35')]);if(_0x5c77f1[_0x76aa('0x36')]){delete _0x5c77f1[_0x76aa('0x36')];}_0x5b57d8[_0x76aa('0x26')](_0x9ce5f4)['send'](_0x5c77f1);};}exports[_0x76aa('0x37')]=function(_0x1c22f7,_0x2eea79){var _0x4e131a={},_0x113770={},_0x1638db={'count':0x0,'rows':[]};var _0x2f7726=_[_0x76aa('0x38')](db[_0x76aa('0x39')][_0x76aa('0x3a')],function(_0x878903){return{'name':_0x878903[_0x76aa('0x3b')],'type':_0x878903[_0x76aa('0x3c')]['key']};});_0x113770[_0x76aa('0x3d')]=_[_0x76aa('0x38')](_0x2f7726,_0x76aa('0x36'));_0x113770[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x1c22f7[_0x76aa('0x3e')]);_0x113770['filters']=_['intersection'](_0x113770[_0x76aa('0x3d')],_0x113770[_0x76aa('0x3e')]);_0x4e131a[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x113770['model'],qs[_0x76aa('0x42')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x4e131a[_0x76aa('0x40')]=_0x4e131a[_0x76aa('0x40')]['length']?_0x4e131a[_0x76aa('0x40')]:_0x113770['model'];if(!_0x1c22f7[_0x76aa('0x3e')]['hasOwnProperty']('nolimit')){_0x4e131a['limit']=qs[_0x76aa('0x2b')](_0x1c22f7['query']['limit']);_0x4e131a['offset']=qs[_0x76aa('0x29')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x29')]);}_0x4e131a[_0x76aa('0x43')]=qs[_0x76aa('0x44')](_0x1c22f7['query'][_0x76aa('0x44')]);_0x4e131a[_0x76aa('0x45')]=qs[_0x76aa('0x46')](_[_0x76aa('0x47')](_0x1c22f7[_0x76aa('0x3e')],_0x113770['filters']),_0x2f7726);if(_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]){_0x4e131a['where']=_[_0x76aa('0x49')](_0x4e131a['where'],{'$or':_[_0x76aa('0x38')](_0x2f7726,function(_0x24ea05){if(_0x24ea05[_0x76aa('0x3c')]!==_0x76aa('0x4a')){var _0x2d0bc4={};_0x2d0bc4[_0x24ea05[_0x76aa('0x36')]]={'$like':'%'+_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]+'%'};return _0x2d0bc4;}})});}_0x4e131a=_[_0x76aa('0x49')]({},_0x4e131a,_0x1c22f7[_0x76aa('0x4b')]);var _0x5e4967={'where':_0x4e131a[_0x76aa('0x45')]};return db['Trunk'][_0x76aa('0x2c')](_0x5e4967)[_0x76aa('0x1b')](function(_0x5e95f5){_0x1638db[_0x76aa('0x2c')]=_0x5e95f5;if(_0x1c22f7['query']['includeAll']){_0x4e131a[_0x76aa('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x76aa('0x4d')](_0x4e131a);})[_0x76aa('0x1b')](function(_0x4315b3){_0x1638db[_0x76aa('0x4e')]=_0x4315b3;return _0x1638db;})[_0x76aa('0x1b')](respondWithFilteredResult(_0x2eea79,_0x4e131a))[_0x76aa('0x24')](handleError(_0x2eea79,null));};exports['show']=function(_0x564546,_0x2fcf8f){var _0x1eafb2={'raw':![],'where':{'id':_0x564546[_0x76aa('0x4f')]['id']}},_0x1708d4={};_0x1708d4[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x1708d4[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x564546['query']);_0x1708d4[_0x76aa('0x46')]=_['intersection'](_0x1708d4[_0x76aa('0x3d')],_0x1708d4['query']);_0x1eafb2[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x1708d4[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x564546[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x1eafb2[_0x76aa('0x40')]=_0x1eafb2['attributes'][_0x76aa('0x50')]?_0x1eafb2['attributes']:_0x1708d4[_0x76aa('0x3d')];if(_0x564546[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x1eafb2[_0x76aa('0x4c')]=[{'all':!![]}];}_0x1eafb2=_[_0x76aa('0x49')]({},_0x1eafb2,_0x564546[_0x76aa('0x4b')]);return db[_0x76aa('0x39')]['find'](_0x1eafb2)[_0x76aa('0x1b')](handleEntityNotFound(_0x2fcf8f,null))[_0x76aa('0x1b')](respondWithResult(_0x2fcf8f,null))[_0x76aa('0x24')](handleError(_0x2fcf8f,null));};exports[_0x76aa('0x52')]=function(_0x5c742c,_0xb9401b){var _0x163440={'where':{'id':_0x5c742c[_0x76aa('0x4f')]['id']}},_0x8dc601={};_0x8dc601[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x163440[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x8dc601[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x163440['attributes']=_0x163440['attributes'][_0x76aa('0x50')]?_0x163440[_0x76aa('0x40')]:_0x8dc601['model'];if(_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x163440['include']=[{'all':!![]}];}_0x163440=_[_0x76aa('0x49')]({},_0x163440,_0x5c742c[_0x76aa('0x4b')]);return db[_0x76aa('0x39')][_0x76aa('0x53')](_0x163440)[_0x76aa('0x1b')](handleEntityNotFound(_0xb9401b,null))[_0x76aa('0x1b')](function(_0x3376ec){if(_0x3376ec){var _0x30573a=_0x3376ec[_0x76aa('0x54')]({'plain':!![]});_0x30573a=qs['omit'](_0x30573a,['id',_0x76aa('0x55'),'updatedAt']);_0x5c742c[_0x76aa('0x56')]=_[_0x76aa('0x57')](_0x5c742c[_0x76aa('0x56')],['id',_0x76aa('0x55'),_0x76aa('0x58')]);return db[_0x76aa('0x39')][_0x76aa('0x59')](_[_0x76aa('0x49')](_0x30573a,_0x5c742c[_0x76aa('0x56')]),{'include':_0x5c742c['query'][_0x76aa('0x51')]?[{'all':!![]}]:undefined})[_0x76aa('0x1b')](function(_0x5c542b){var _0xe5957d=_0x5c742c[_0x76aa('0x5a')][_0x76aa('0x54')]({'plain':!![]});if(!_0xe5957d)throw new Error(_0x76aa('0x5b'));if(_0xe5957d[_0x76aa('0x5c')]==='user'){var _0x364d05=_0x5c542b['get']({'plain':!![]});var _0x35bd2b=_0x76aa('0x33');return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':_0x35bd2b,'userProfileId':_0xe5957d[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x2bfb46){if(_0x2bfb46&&_0x2bfb46['autoAssociation']===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x364d05['name'],'resourceId':_0x364d05['id'],'type':_0x2bfb46['name'],'sectionId':_0x2bfb46['id']},{})[_0x76aa('0x1b')](function(){return _0x5c542b;});}else{return _0x5c542b;}})[_0x76aa('0x24')](function(_0x5295a7){logger[_0x76aa('0x20')](_0x76aa('0x5f'),_0x5295a7);throw _0x5295a7;});}return _0x5c542b;});}})[_0x76aa('0x1b')](respondWithResult(_0xb9401b,0xc9))['catch'](handleError(_0xb9401b,null));};exports[_0x76aa('0x59')]=function(_0x47f733,_0xf31e1f,_0x1178e5){var _0x2315cf;return db[_0x76aa('0x39')]['create'](_0x47f733['body'],{'raw':!![]})[_0x76aa('0x1b')](function(_0x4dfeb3){_0x2315cf=_0x4dfeb3;return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x43a2af){var _0x2dd320=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x63')),'utf8');var _0x7d02e7=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x557c11=ejs[_0x76aa('0x64')](_0x2dd320,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x65'),_0x557c11);if(_0x2315cf[_0x76aa('0x66')]){var _0x38faff=ejs[_0x76aa('0x64')](_0x7d02e7,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x67'),_0x38faff);}})['then'](function(){return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x59'),{'module':_0x76aa('0x69')});})[_0x76aa('0x1b')](function(){var _0x1037fb=_0x47f733['user'][_0x76aa('0x54')]({'plain':!![]});if(!_0x1037fb)throw new Error(_0x76aa('0x5b'));if(_0x1037fb[_0x76aa('0x5c')]===_0x76aa('0x5a')){var _0x32c1de=_0x2315cf[_0x76aa('0x54')]({'plain':!![]});return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':'Trunks','userProfileId':_0x1037fb[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x48136a){if(_0x48136a&&_0x48136a[_0x76aa('0x6a')]===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x32c1de[_0x76aa('0x36')],'resourceId':_0x32c1de['id'],'type':_0x48136a[_0x76aa('0x36')],'sectionId':_0x48136a['id']},{})[_0x76aa('0x1b')](function(){return _0x2315cf;});}else{return _0x2315cf;}})[_0x76aa('0x24')](function(_0x5dc923){logger[_0x76aa('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dc923);throw _0x5dc923;});}return _0x2315cf;})['then'](respondWithResult(_0xf31e1f,0xc9))[_0x76aa('0x24')](handleError(_0xf31e1f,null));};exports[_0x76aa('0x6b')]=function(_0x5d8947,_0x5d1de1,_0x36da4d){var _0x14b5a2;return db[_0x76aa('0x39')]['find']({'where':{'id':_0x5d8947['params']['id']}})[_0x76aa('0x1b')](handleEntityNotFound(_0x5d1de1,null))[_0x76aa('0x1b')](saveUpdates(_0x5d8947[_0x76aa('0x56')],null))['then'](function(_0xb70589){if(_0xb70589){_0x14b5a2=_0xb70589;return db['Trunk'][_0x76aa('0x4d')]({'raw':!![]});}})[_0x76aa('0x1b')](function(_0x383290){if(_0x383290){var _0x325ffa=fs[_0x76aa('0x60')](path['join'](config['root'],_0x76aa('0x63')),_0x76aa('0x6c'));var _0x19ebb7=fs['readFileSync'](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x6d')),_0x76aa('0x6c'));var _0x303b78=ejs['render'](_0x325ffa,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x303b78);var _0x213f7f=ejs[_0x76aa('0x64')](_0x19ebb7,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x213f7f);return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x6b'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x547411){if(_0x547411){return _0x14b5a2;}})['then'](respondWithResult(_0x5d1de1,null))['catch'](handleError(_0x5d1de1,null));};exports[_0x76aa('0x32')]=function(_0x22f44f,_0x52c5be,_0x5c2c91){var _0x4f01e9;return db[_0x76aa('0x39')][_0x76aa('0x53')]({'where':{'id':_0x22f44f[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52c5be,null))['then'](removeEntity(_0x52c5be,null))[_0x76aa('0x1b')](function(){return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x354c7b){var _0x55e526=fs['readFileSync'](path[_0x76aa('0x61')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x4673e6=fs[_0x76aa('0x60')](path['join'](config[_0x76aa('0x62')],_0x76aa('0x6d')),'utf8');var _0x22063f=ejs[_0x76aa('0x64')](_0x55e526,{'trunks':_0x354c7b});var _0x11d91f=ejs[_0x76aa('0x64')](_0x4673e6,{'trunks':_0x354c7b});fs[_0x76aa('0x6e')](_0x76aa('0x65'),_0x22063f);fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x11d91f);return respondWithRpcPromise(_0x76aa('0x68'),'destroy',{'module':_0x76aa('0x69')});})[_0x76aa('0x24')](handleError(_0x52c5be,null));}; \ No newline at end of file +var _0x98a8=['../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Trunks','UserProfileResource','stack','name','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trunk','include','show','params','keys','rawAttributes','includeAll','clone','find','createdAt','updatedAt','body','omit','create','user','role','UserProfileSection','userProfileId','autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x766197,_0x1e43b0){var _0x8ea430=function(_0x2ee670){while(--_0x2ee670){_0x766197['push'](_0x766197['shift']());}};_0x8ea430(++_0x1e43b0);}(_0x98a8,0x12c));var _0x898a=function(_0x29a1a2,_0x232615){_0x29a1a2=_0x29a1a2-0x0;var _0xc5175f=_0x98a8[_0x29a1a2];return _0xc5175f;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];var jayson=require(_0x898a('0x19'));var client=jayson[_0x898a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfded,_0x5b5c9c,_0x373d53,_0x1f5be4){return new BPromise(function(_0xb24335,_0x116fbe){var _0x1873e9=_0x1f5be4||client;return _0x1873e9[_0x898a('0x1b')](_0x5bfded,_0x373d53)['then'](function(_0x47033c){logger['info'](_0x898a('0x1c'),_0x5b5c9c,'request\x20sent');logger[_0x898a('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b5c9c,_0x898a('0x1e'),JSON['stringify'](_0x47033c));if(_0x47033c[_0x898a('0x1f')]){if(_0x47033c[_0x898a('0x1f')][_0x898a('0x20')]===0x1f4){logger['error'](_0x898a('0x1c'),_0x5b5c9c,_0x47033c['error']['message']);return _0x116fbe(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5b5c9c,_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);return _0xb24335(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}else{logger[_0x898a('0x22')](_0x898a('0x1c'),_0x5b5c9c,_0x898a('0x1e'));_0xb24335(_0x47033c['result'][_0x898a('0x21')]);}})[_0x898a('0x23')](function(_0x11cae2){logger[_0x898a('0x1f')](_0x898a('0x1c'),_0x5b5c9c,_0x11cae2);_0x116fbe(_0x11cae2);});});}function respondWithStatusCode(_0x310bfa,_0x4e254d){_0x4e254d=_0x4e254d||0xcc;return function(_0x274cdf){if(_0x274cdf){return _0x310bfa[_0x898a('0x24')](_0x4e254d);}return _0x310bfa[_0x898a('0x25')](_0x4e254d)[_0x898a('0x26')]();};}function respondWithResult(_0x3901ab,_0x1426e3){_0x1426e3=_0x1426e3||0xc8;return function(_0x5b7719){if(_0x5b7719){return _0x3901ab[_0x898a('0x25')](_0x1426e3)['json'](_0x5b7719);}};}function respondWithFilteredResult(_0x513c6b,_0x53ddb2){return function(_0x3678be){if(_0x3678be){var _0x1f4d86=typeof _0x53ddb2[_0x898a('0x27')]===_0x898a('0x28')&&typeof _0x53ddb2[_0x898a('0x29')]===_0x898a('0x28');var _0x398e98=_0x3678be[_0x898a('0x2a')];var _0xd31922=_0x1f4d86?0x0:_0x53ddb2['offset'];var _0x4b3e68=_0x1f4d86?_0x3678be['count']:_0x53ddb2[_0x898a('0x27')]+_0x53ddb2[_0x898a('0x29')];var _0x3b7704;if(_0x4b3e68>=_0x398e98){_0x4b3e68=_0x398e98;_0x3b7704=0xc8;}else{_0x3b7704=0xce;}_0x513c6b[_0x898a('0x25')](_0x3b7704);return _0x513c6b[_0x898a('0x2b')](_0x898a('0x2c'),_0xd31922+'-'+_0x4b3e68+'/'+_0x398e98)[_0x898a('0x2d')](_0x3678be);}return null;};}function patchUpdates(_0xf74645){return function(_0x18773a){try{jsonpatch[_0x898a('0x2e')](_0x18773a,_0xf74645,!![]);}catch(_0x44c5d2){return BPromise[_0x898a('0x2f')](_0x44c5d2);}return _0x18773a['save']();};}function saveUpdates(_0x7a1eb5,_0x17a5f3){return function(_0x26eead){if(_0x26eead){return _0x26eead[_0x898a('0x30')](_0x7a1eb5)[_0x898a('0x31')](function(_0x47af5b){return _0x47af5b;});}return null;};}function removeEntity(_0x48cefb,_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x32')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x33')]({'plain':!![]});var _0x5eafc7=_0x898a('0x34');return db[_0x898a('0x35')][_0x898a('0x32')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x31')](function(){return _0x1e2fd4;});})[_0x898a('0x31')](function(){_0x48cefb['status'](0xcc)[_0x898a('0x26')]();});}};}function handleEntityNotFound(_0x5baf5b,_0x573eb3){return function(_0x14e2dc){if(!_0x14e2dc){_0x5baf5b['sendStatus'](0x194);}return _0x14e2dc;};}function handleError(_0x3c9588,_0x4b3aac){_0x4b3aac=_0x4b3aac||0x1f4;return function(_0x37cb11){logger['error'](_0x37cb11[_0x898a('0x36')]);if(_0x37cb11[_0x898a('0x37')]){delete _0x37cb11[_0x898a('0x37')];}_0x3c9588['status'](_0x4b3aac)['send'](_0x37cb11);};}exports['index']=function(_0x1575d2,_0x429c32){var _0x5a228f={},_0xdd019d={},_0x3d3463={'count':0x0,'rows':[]};var _0xe84f7e=_[_0x898a('0x38')](db['Trunk']['rawAttributes'],function(_0x3aed01){return{'name':_0x3aed01[_0x898a('0x39')],'type':_0x3aed01['type']['key']};});_0xdd019d[_0x898a('0x3a')]=_[_0x898a('0x38')](_0xe84f7e,_0x898a('0x37'));_0xdd019d[_0x898a('0x3b')]=_['keys'](_0x1575d2[_0x898a('0x3b')]);_0xdd019d[_0x898a('0x3c')]=_['intersection'](_0xdd019d['model'],_0xdd019d['query']);_0x5a228f[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0xdd019d[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x3f')]));_0x5a228f[_0x898a('0x3d')]=_0x5a228f[_0x898a('0x3d')][_0x898a('0x40')]?_0x5a228f[_0x898a('0x3d')]:_0xdd019d[_0x898a('0x3a')];if(!_0x1575d2[_0x898a('0x3b')][_0x898a('0x41')](_0x898a('0x42'))){_0x5a228f[_0x898a('0x29')]=qs['limit'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x29')]);_0x5a228f[_0x898a('0x27')]=qs['offset'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x27')]);}_0x5a228f[_0x898a('0x43')]=qs[_0x898a('0x44')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x44')]);_0x5a228f[_0x898a('0x45')]=qs[_0x898a('0x3c')](_['pick'](_0x1575d2[_0x898a('0x3b')],_0xdd019d[_0x898a('0x3c')]),_0xe84f7e);if(_0x1575d2[_0x898a('0x3b')][_0x898a('0x46')]){_0x5a228f['where']=_[_0x898a('0x47')](_0x5a228f[_0x898a('0x45')],{'$or':_['map'](_0xe84f7e,function(_0x241677){if(_0x241677['type']!==_0x898a('0x48')){var _0x5137c4={};_0x5137c4[_0x241677['name']]={'$like':'%'+_0x1575d2[_0x898a('0x3b')]['filter']+'%'};return _0x5137c4;}})});}_0x5a228f=_[_0x898a('0x47')]({},_0x5a228f,_0x1575d2[_0x898a('0x49')]);var _0x4d6ac0={'where':_0x5a228f[_0x898a('0x45')]};return db[_0x898a('0x4a')]['count'](_0x4d6ac0)[_0x898a('0x31')](function(_0x199437){_0x3d3463[_0x898a('0x2a')]=_0x199437;if(_0x1575d2[_0x898a('0x3b')]['includeAll']){_0x5a228f[_0x898a('0x4b')]=[{'all':!![]}];}return db[_0x898a('0x4a')]['findAll'](_0x5a228f);})[_0x898a('0x31')](function(_0x1d8c16){_0x3d3463['rows']=_0x1d8c16;return _0x3d3463;})[_0x898a('0x31')](respondWithFilteredResult(_0x429c32,_0x5a228f))['catch'](handleError(_0x429c32,null));};exports[_0x898a('0x4c')]=function(_0x41f291,_0x32ccb9){var _0x50f9e3={'raw':![],'where':{'id':_0x41f291[_0x898a('0x4d')]['id']}},_0x2f6cb3={};_0x2f6cb3[_0x898a('0x3a')]=_[_0x898a('0x4e')](db['Trunk'][_0x898a('0x4f')]);_0x2f6cb3['query']=_[_0x898a('0x4e')](_0x41f291[_0x898a('0x3b')]);_0x2f6cb3[_0x898a('0x3c')]=_['intersection'](_0x2f6cb3[_0x898a('0x3a')],_0x2f6cb3[_0x898a('0x3b')]);_0x50f9e3[_0x898a('0x3d')]=_['intersection'](_0x2f6cb3['model'],qs[_0x898a('0x3f')](_0x41f291[_0x898a('0x3b')][_0x898a('0x3f')]));_0x50f9e3[_0x898a('0x3d')]=_0x50f9e3[_0x898a('0x3d')][_0x898a('0x40')]?_0x50f9e3[_0x898a('0x3d')]:_0x2f6cb3[_0x898a('0x3a')];if(_0x41f291[_0x898a('0x3b')][_0x898a('0x50')]){_0x50f9e3[_0x898a('0x4b')]=[{'all':!![]}];}_0x50f9e3=_['merge']({},_0x50f9e3,_0x41f291[_0x898a('0x49')]);return db[_0x898a('0x4a')]['find'](_0x50f9e3)[_0x898a('0x31')](handleEntityNotFound(_0x32ccb9,null))['then'](respondWithResult(_0x32ccb9,null))['catch'](handleError(_0x32ccb9,null));};exports[_0x898a('0x51')]=function(_0x124f9b,_0x209529){var _0x5bfd61={'where':{'id':_0x124f9b[_0x898a('0x4d')]['id']}},_0x556fd8={};_0x556fd8[_0x898a('0x3a')]=_['keys'](db[_0x898a('0x4a')][_0x898a('0x4f')]);_0x5bfd61['attributes']=_[_0x898a('0x3e')](_0x556fd8[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x124f9b['query'][_0x898a('0x3f')]));_0x5bfd61[_0x898a('0x3d')]=_0x5bfd61[_0x898a('0x3d')][_0x898a('0x40')]?_0x5bfd61[_0x898a('0x3d')]:_0x556fd8[_0x898a('0x3a')];if(_0x124f9b['query'][_0x898a('0x50')]){_0x5bfd61['include']=[{'all':!![]}];}_0x5bfd61=_[_0x898a('0x47')]({},_0x5bfd61,_0x124f9b[_0x898a('0x49')]);return db[_0x898a('0x4a')][_0x898a('0x52')](_0x5bfd61)[_0x898a('0x31')](handleEntityNotFound(_0x209529,null))[_0x898a('0x31')](function(_0x2486a5){if(_0x2486a5){var _0x75ff57=_0x2486a5[_0x898a('0x33')]({'plain':!![]});_0x75ff57=qs['omit'](_0x75ff57,['id',_0x898a('0x53'),_0x898a('0x54')]);_0x124f9b[_0x898a('0x55')]=_[_0x898a('0x56')](_0x124f9b[_0x898a('0x55')],['id',_0x898a('0x53'),_0x898a('0x54')]);return db[_0x898a('0x4a')][_0x898a('0x57')](_[_0x898a('0x47')](_0x75ff57,_0x124f9b[_0x898a('0x55')]),{'include':_0x124f9b[_0x898a('0x3b')][_0x898a('0x50')]?[{'all':!![]}]:undefined})[_0x898a('0x31')](function(_0x22f9ba){var _0x5f42ae=_0x124f9b[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x5f42ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f42ae[_0x898a('0x59')]===_0x898a('0x58')){var _0x5f0944=_0x22f9ba[_0x898a('0x33')]({'plain':!![]});var _0x1daecd=_0x898a('0x34');return db[_0x898a('0x5a')]['find']({'where':{'name':_0x1daecd,'userProfileId':_0x5f42ae[_0x898a('0x5b')]},'raw':!![]})[_0x898a('0x31')](function(_0x137935){if(_0x137935&&_0x137935[_0x898a('0x5c')]===0x0){return db['UserProfileResource'][_0x898a('0x57')]({'name':_0x5f0944[_0x898a('0x37')],'resourceId':_0x5f0944['id'],'type':_0x137935['name'],'sectionId':_0x137935['id']},{})[_0x898a('0x31')](function(){return _0x22f9ba;});}else{return _0x22f9ba;}})[_0x898a('0x23')](function(_0x5b7019){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7019);throw _0x5b7019;});}return _0x22f9ba;});}})[_0x898a('0x31')](respondWithResult(_0x209529,0xc9))['catch'](handleError(_0x209529,null));};exports['create']=function(_0x5ed35e,_0xfdd6d8,_0x473f5c){var _0x3909c5;return db[_0x898a('0x4a')]['create'](_0x5ed35e['body'],{'raw':!![]})[_0x898a('0x31')](function(_0x232be0){_0x3909c5=_0x232be0;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x41cf94){var _0x30051d=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x42fda8=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),_0x898a('0x63'));var _0x3bcc3d=ejs[_0x898a('0x64')](_0x30051d,{'trunks':_0x41cf94||[]});fs[_0x898a('0x65')](_0x898a('0x66'),_0x3bcc3d);if(_0x3909c5[_0x898a('0x67')]){var _0x307849=ejs[_0x898a('0x64')](_0x42fda8,{'trunks':_0x41cf94||[]});fs['writeFileSync'](_0x898a('0x68'),_0x307849);}})['then'](function(){return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x57'),{'module':_0x898a('0x6a')});})['then'](function(){var _0x31102d=_0x5ed35e[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x31102d)throw new Error(_0x898a('0x6b'));if(_0x31102d[_0x898a('0x59')]==='user'){var _0x4b9487=_0x3909c5[_0x898a('0x33')]({'plain':!![]});return db[_0x898a('0x5a')][_0x898a('0x52')]({'where':{'name':_0x898a('0x34'),'userProfileId':_0x31102d['userProfileId']},'raw':!![]})[_0x898a('0x31')](function(_0x3d3451){if(_0x3d3451&&_0x3d3451[_0x898a('0x5c')]===0x0){return db[_0x898a('0x35')][_0x898a('0x57')]({'name':_0x4b9487[_0x898a('0x37')],'resourceId':_0x4b9487['id'],'type':_0x3d3451[_0x898a('0x37')],'sectionId':_0x3d3451['id']},{})[_0x898a('0x31')](function(){return _0x3909c5;});}else{return _0x3909c5;}})['catch'](function(_0x32a207){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a207);throw _0x32a207;});}return _0x3909c5;})[_0x898a('0x31')](respondWithResult(_0xfdd6d8,0xc9))['catch'](handleError(_0xfdd6d8,null));};exports[_0x898a('0x30')]=function(_0x4b2575,_0x2471d8,_0x387f2c){var _0x3b07dc;return db[_0x898a('0x4a')][_0x898a('0x52')]({'where':{'id':_0x4b2575[_0x898a('0x4d')]['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x2471d8,null))[_0x898a('0x31')](saveUpdates(_0x4b2575[_0x898a('0x55')],null))['then'](function(_0x3fe54b){if(_0x3fe54b){_0x3b07dc=_0x3fe54b;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});}})[_0x898a('0x31')](function(_0x290972){if(_0x290972){var _0x1d594b=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x4fad03=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x898a('0x63'));var _0x4a79a4=ejs[_0x898a('0x64')](_0x1d594b,{'trunks':_0x290972||[]});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a79a4);var _0x3f6815=ejs[_0x898a('0x64')](_0x4fad03,{'trunks':_0x290972||[]});fs[_0x898a('0x65')](_0x898a('0x68'),_0x3f6815);return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x30'),{'module':_0x898a('0x6a')});}return null;})['then'](function(_0x3237e8){if(_0x3237e8){return _0x3b07dc;}})[_0x898a('0x31')](respondWithResult(_0x2471d8,null))[_0x898a('0x23')](handleError(_0x2471d8,null));};exports['destroy']=function(_0x27560f,_0x61247c,_0x5c6247){var _0x39e917;return db['Trunk']['find']({'where':{'id':_0x27560f['params']['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x61247c,null))[_0x898a('0x31')](removeEntity(_0x61247c,null))[_0x898a('0x31')](function(){return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x12e54b){var _0x50dd52=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x24670c=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),'utf8');var _0x5847cb=ejs['render'](_0x50dd52,{'trunks':_0x12e54b});var _0x3b8fb5=ejs[_0x898a('0x64')](_0x24670c,{'trunks':_0x12e54b});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5847cb);fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3b8fb5);return respondWithRpcPromise('Reload',_0x898a('0x32'),{'module':_0x898a('0x6a')});})[_0x898a('0x23')](handleError(_0x61247c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 3536b3f..df9eba9 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 _0xec40=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','Trunk'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xec40,0xdc));var _0x0ec4=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0xec40[_0x2c3255];return _0x282aba;};'use strict';var _=require(_0x0ec4('0x0'));var util=require(_0x0ec4('0x1'));var logger=require(_0x0ec4('0x2'))(_0x0ec4('0x3'));var moment=require(_0x0ec4('0x4'));var BPromise=require(_0x0ec4('0x5'));var rp=require(_0x0ec4('0x6'));var fs=require('fs');var path=require(_0x0ec4('0x7'));var rimraf=require('rimraf');var config=require(_0x0ec4('0x8'));var attributes=require('./trunk.attributes');module[_0x0ec4('0x9')]=function(_0x10305c,_0x4e38d7){return _0x10305c['define'](_0x0ec4('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22b8=['path','../../config/environment','exports','define','Trunk','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2710b4,_0x5885ae){var _0x4724f5=function(_0x114e4c){while(--_0x114e4c){_0x2710b4['push'](_0x2710b4['shift']());}};_0x4724f5(++_0x5885ae);}(_0x22b8,0x19c));var _0x822b=function(_0x49258d,_0x5bcf0e){_0x49258d=_0x49258d-0x0;var _0x2a9044=_0x22b8[_0x49258d];return _0x2a9044;};'use strict';var _=require(_0x822b('0x0'));var util=require(_0x822b('0x1'));var logger=require(_0x822b('0x2'))('api');var moment=require(_0x822b('0x3'));var BPromise=require(_0x822b('0x4'));var rp=require(_0x822b('0x5'));var fs=require('fs');var path=require(_0x822b('0x6'));var rimraf=require('rimraf');var config=require(_0x822b('0x7'));var attributes=require('./trunk.attributes');module[_0x822b('0x8')]=function(_0x5448f2,_0x4fe959){return _0x5448f2[_0x822b('0x9')](_0x822b('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index fdd5cdb..1d96a36 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 _0x3368=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','Trunk,\x20%s,\x20%s','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowTrunk','find','lodash','util','randomstring'];(function(_0x283b55,_0x279bee){var _0x192e58=function(_0x535c7c){while(--_0x535c7c){_0x283b55['push'](_0x283b55['shift']());}};_0x192e58(++_0x279bee);}(_0x3368,0xc9));var _0x8336=function(_0x46aae1,_0x130f4e){_0x46aae1=_0x46aae1-0x0;var _0xc42a8e=_0x3368[_0x46aae1];return _0xc42a8e;};'use strict';var _=require(_0x8336('0x0'));var util=require(_0x8336('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8336('0x2'));var fs=require('fs');var Redis=require(_0x8336('0x3'));var db=require(_0x8336('0x4'))['db'];var utils=require(_0x8336('0x5'));var logger=require('../../config/logger')(_0x8336('0x6'));var config=require('../../config/environment');var jayson=require(_0x8336('0x7'));var client=jayson[_0x8336('0x8')][_0x8336('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf9bab0,_0x4f558e,_0x392a0a){return new BPromise(function(_0x242f69,_0x55ac49){return client['request'](_0xf9bab0,_0x392a0a)[_0x8336('0xa')](function(_0x3aa828){logger[_0x8336('0xb')]('Trunk,\x20%s,\x20%s',_0x4f558e,_0x8336('0xc'));logger[_0x8336('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x4f558e,_0x8336('0xc'),JSON['stringify'](_0x3aa828));if(_0x3aa828[_0x8336('0xe')]){if(_0x3aa828['error'][_0x8336('0xf')]===0x1f4){logger['error'](_0x8336('0x10'),_0x4f558e,_0x3aa828['error'][_0x8336('0x11')]);return _0x55ac49(_0x3aa828[_0x8336('0xe')][_0x8336('0x11')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x4f558e,_0x3aa828[_0x8336('0xe')][_0x8336('0x11')]);return _0x242f69(_0x3aa828[_0x8336('0xe')]['message']);}else{logger[_0x8336('0xb')](_0x8336('0x10'),_0x4f558e,'request\x20sent');_0x242f69(_0x3aa828[_0x8336('0x12')][_0x8336('0x11')]);}})['catch'](function(_0x4a2938){logger['error'](_0x8336('0x10'),_0x4f558e,_0x4a2938);_0x55ac49(_0x4a2938);});});}exports[_0x8336('0x13')]=function(_0x30dedb){var _0x3bd439=this;return new Promise(function(_0x3da5e8,_0x50fe15){return db[_0x8336('0x14')][_0x8336('0x15')]({'raw':_0x30dedb['options']?_0x30dedb[_0x8336('0x16')][_0x8336('0x17')]===undefined?!![]:![]:!![],'where':_0x30dedb[_0x8336('0x16')]?_0x30dedb[_0x8336('0x16')][_0x8336('0x18')]||null:null,'attributes':_0x30dedb[_0x8336('0x16')]?_0x30dedb[_0x8336('0x16')][_0x8336('0x19')]||null:null,'limit':_0x30dedb['options']?_0x30dedb[_0x8336('0x16')][_0x8336('0x1a')]||null:null,'include':_0x30dedb[_0x8336('0x16')]?_0x30dedb[_0x8336('0x16')][_0x8336('0x1b')]?_[_0x8336('0x1c')](_0x30dedb['options']['include'],function(_0x3c8e88){return{'model':db[_0x3c8e88[_0x8336('0x1d')]],'as':_0x3c8e88['as'],'attributes':_0x3c8e88[_0x8336('0x19')],'include':_0x3c8e88[_0x8336('0x1b')]?_[_0x8336('0x1c')](_0x3c8e88['include'],function(_0x273fa5){return{'model':db[_0x273fa5[_0x8336('0x1d')]],'as':_0x273fa5['as'],'attributes':_0x273fa5[_0x8336('0x19')],'include':_0x273fa5['include']?_[_0x8336('0x1c')](_0x273fa5[_0x8336('0x1b')],function(_0x536d9f){return{'model':db[_0x536d9f[_0x8336('0x1d')]],'as':_0x536d9f['as'],'attributes':_0x536d9f[_0x8336('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8336('0xa')](function(_0x295ca4){logger[_0x8336('0xb')](_0x8336('0x13'),_0x30dedb);logger[_0x8336('0xd')]('GetTrunk',_0x30dedb,JSON[_0x8336('0x1e')](_0x295ca4));_0x3da5e8(_0x295ca4);})[_0x8336('0x1f')](function(_0xc06ac7){logger['error']('GetTrunk',_0xc06ac7[_0x8336('0x11')],_0x30dedb);_0x50fe15(_0x3bd439[_0x8336('0xe')](0x1f4,_0xc06ac7[_0x8336('0x11')]));});});};exports[_0x8336('0x20')]=function(_0x22fe54){var _0x1e0464=this;return new Promise(function(_0x297aff,_0x5d4b56){return db[_0x8336('0x14')][_0x8336('0x21')]({'raw':_0x22fe54[_0x8336('0x16')]?_0x22fe54[_0x8336('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x22fe54[_0x8336('0x16')]?_0x22fe54['options']['where']||null:null,'attributes':_0x22fe54[_0x8336('0x16')]?_0x22fe54[_0x8336('0x16')][_0x8336('0x19')]||null:null,'include':_0x22fe54[_0x8336('0x16')]?_0x22fe54[_0x8336('0x16')][_0x8336('0x1b')]?_['map'](_0x22fe54[_0x8336('0x16')]['include'],function(_0x321a33){return{'model':db[_0x321a33[_0x8336('0x1d')]],'as':_0x321a33['as'],'attributes':_0x321a33[_0x8336('0x19')],'include':_0x321a33['include']?_[_0x8336('0x1c')](_0x321a33[_0x8336('0x1b')],function(_0x323938){return{'model':db[_0x323938[_0x8336('0x1d')]],'as':_0x323938['as'],'attributes':_0x323938[_0x8336('0x19')],'include':_0x323938[_0x8336('0x1b')]?_[_0x8336('0x1c')](_0x323938[_0x8336('0x1b')],function(_0x34d93d){return{'model':db[_0x34d93d[_0x8336('0x1d')]],'as':_0x34d93d['as'],'attributes':_0x34d93d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d274f){logger[_0x8336('0xb')](_0x8336('0x20'),_0x22fe54);logger['debug'](_0x8336('0x20'),_0x22fe54,JSON['stringify'](_0x4d274f));_0x297aff(_0x4d274f);})['catch'](function(_0x2cd716){logger[_0x8336('0xe')](_0x8336('0x20'),_0x2cd716[_0x8336('0x11')],_0x22fe54);_0x5d4b56(_0x1e0464[_0x8336('0xe')](0x1f4,_0x2cd716[_0x8336('0x11')]));});});}; \ No newline at end of file +var _0xa3e9=['include','model','map','ShowTrunk','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetTrunk','findAll','options','raw','attributes','limit'];(function(_0x2c9c3f,_0x2f64bb){var _0xec6fd0=function(_0x53486c){while(--_0x53486c){_0x2c9c3f['push'](_0x2c9c3f['shift']());}};_0xec6fd0(++_0x2f64bb);}(_0xa3e9,0x106));var _0x9a3e=function(_0x2e3840,_0x1a36b6){_0x2e3840=_0x2e3840-0x0;var _0x22a726=_0xa3e9[_0x2e3840];return _0x22a726;};'use strict';var _=require(_0x9a3e('0x0'));var util=require('util');var moment=require(_0x9a3e('0x1'));var BPromise=require(_0x9a3e('0x2'));var rs=require(_0x9a3e('0x3'));var fs=require('fs');var Redis=require(_0x9a3e('0x4'));var db=require(_0x9a3e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9a3e('0x6'));var jayson=require(_0x9a3e('0x7'));var client=jayson['client'][_0x9a3e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2767cf,_0x49dc23,_0x387329){return new BPromise(function(_0x176ed5,_0x173a5f){return client[_0x9a3e('0x9')](_0x2767cf,_0x387329)[_0x9a3e('0xa')](function(_0x2caecb){logger[_0x9a3e('0xb')](_0x9a3e('0xc'),_0x49dc23,_0x9a3e('0xd'));logger[_0x9a3e('0xe')]('Trunk,\x20%s,\x20%s,\x20%s',_0x49dc23,_0x9a3e('0xd'),JSON[_0x9a3e('0xf')](_0x2caecb));if(_0x2caecb['error']){if(_0x2caecb[_0x9a3e('0x10')][_0x9a3e('0x11')]===0x1f4){logger[_0x9a3e('0x10')]('Trunk,\x20%s,\x20%s',_0x49dc23,_0x2caecb[_0x9a3e('0x10')][_0x9a3e('0x12')]);return _0x173a5f(_0x2caecb[_0x9a3e('0x10')]['message']);}logger[_0x9a3e('0x10')](_0x9a3e('0xc'),_0x49dc23,_0x2caecb[_0x9a3e('0x10')]['message']);return _0x176ed5(_0x2caecb['error'][_0x9a3e('0x12')]);}else{logger[_0x9a3e('0xb')](_0x9a3e('0xc'),_0x49dc23,_0x9a3e('0xd'));_0x176ed5(_0x2caecb['result']['message']);}})[_0x9a3e('0x13')](function(_0x57a273){logger[_0x9a3e('0x10')]('Trunk,\x20%s,\x20%s',_0x49dc23,_0x57a273);_0x173a5f(_0x57a273);});});}exports[_0x9a3e('0x14')]=function(_0xc0c7a3){var _0xa145cf=this;return new Promise(function(_0x2983e7,_0x5736a5){return db['Trunk'][_0x9a3e('0x15')]({'raw':_0xc0c7a3['options']?_0xc0c7a3[_0x9a3e('0x16')][_0x9a3e('0x17')]===undefined?!![]:![]:!![],'where':_0xc0c7a3[_0x9a3e('0x16')]?_0xc0c7a3['options']['where']||null:null,'attributes':_0xc0c7a3[_0x9a3e('0x16')]?_0xc0c7a3[_0x9a3e('0x16')][_0x9a3e('0x18')]||null:null,'limit':_0xc0c7a3[_0x9a3e('0x16')]?_0xc0c7a3[_0x9a3e('0x16')][_0x9a3e('0x19')]||null:null,'include':_0xc0c7a3[_0x9a3e('0x16')]?_0xc0c7a3[_0x9a3e('0x16')][_0x9a3e('0x1a')]?_['map'](_0xc0c7a3[_0x9a3e('0x16')][_0x9a3e('0x1a')],function(_0x4d02a0){return{'model':db[_0x4d02a0[_0x9a3e('0x1b')]],'as':_0x4d02a0['as'],'attributes':_0x4d02a0['attributes'],'include':_0x4d02a0[_0x9a3e('0x1a')]?_[_0x9a3e('0x1c')](_0x4d02a0[_0x9a3e('0x1a')],function(_0x160d29){return{'model':db[_0x160d29[_0x9a3e('0x1b')]],'as':_0x160d29['as'],'attributes':_0x160d29[_0x9a3e('0x18')],'include':_0x160d29[_0x9a3e('0x1a')]?_[_0x9a3e('0x1c')](_0x160d29[_0x9a3e('0x1a')],function(_0xd35503){return{'model':db[_0xd35503[_0x9a3e('0x1b')]],'as':_0xd35503['as'],'attributes':_0xd35503[_0x9a3e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9a3e('0xa')](function(_0x16ac8f){logger[_0x9a3e('0xb')](_0x9a3e('0x14'),_0xc0c7a3);logger[_0x9a3e('0xe')]('GetTrunk',_0xc0c7a3,JSON['stringify'](_0x16ac8f));_0x2983e7(_0x16ac8f);})[_0x9a3e('0x13')](function(_0x150d1a){logger[_0x9a3e('0x10')](_0x9a3e('0x14'),_0x150d1a[_0x9a3e('0x12')],_0xc0c7a3);_0x5736a5(_0xa145cf[_0x9a3e('0x10')](0x1f4,_0x150d1a['message']));});});};exports[_0x9a3e('0x1d')]=function(_0x121d33){var _0x2eae82=this;return new Promise(function(_0x2fc3b5,_0x5c341b){return db['Trunk'][_0x9a3e('0x1e')]({'raw':_0x121d33[_0x9a3e('0x16')]?_0x121d33[_0x9a3e('0x16')][_0x9a3e('0x17')]===undefined?!![]:![]:!![],'where':_0x121d33[_0x9a3e('0x16')]?_0x121d33[_0x9a3e('0x16')][_0x9a3e('0x1f')]||null:null,'attributes':_0x121d33[_0x9a3e('0x16')]?_0x121d33[_0x9a3e('0x16')]['attributes']||null:null,'include':_0x121d33['options']?_0x121d33[_0x9a3e('0x16')][_0x9a3e('0x1a')]?_[_0x9a3e('0x1c')](_0x121d33[_0x9a3e('0x16')]['include'],function(_0x5721a6){return{'model':db[_0x5721a6[_0x9a3e('0x1b')]],'as':_0x5721a6['as'],'attributes':_0x5721a6['attributes'],'include':_0x5721a6[_0x9a3e('0x1a')]?_['map'](_0x5721a6[_0x9a3e('0x1a')],function(_0x53a654){return{'model':db[_0x53a654[_0x9a3e('0x1b')]],'as':_0x53a654['as'],'attributes':_0x53a654[_0x9a3e('0x18')],'include':_0x53a654[_0x9a3e('0x1a')]?_[_0x9a3e('0x1c')](_0x53a654[_0x9a3e('0x1a')],function(_0x2d2637){return{'model':db[_0x2d2637[_0x9a3e('0x1b')]],'as':_0x2d2637['as'],'attributes':_0x2d2637[_0x9a3e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9a3e('0xa')](function(_0x54b763){logger[_0x9a3e('0xb')](_0x9a3e('0x1d'),_0x121d33);logger['debug'](_0x9a3e('0x1d'),_0x121d33,JSON['stringify'](_0x54b763));_0x2fc3b5(_0x54b763);})[_0x9a3e('0x13')](function(_0x36d675){logger[_0x9a3e('0x10')]('ShowTrunk',_0x36d675[_0x9a3e('0x12')],_0x121d33);_0x5c341b(_0x2eae82[_0x9a3e('0x10')](0x1f4,_0x36d675['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index a20f649..6babb18 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 _0xa2d6=['./user-setting.controller','put','/:id','isAuthenticated','update','express','Router','../../components/auth/service'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xa2d6,0x65));var _0x6a2d=function(_0xb77d35,_0x291854){_0xb77d35=_0xb77d35-0x0;var _0x5389a8=_0xa2d6[_0xb77d35];return _0x5389a8;};'use strict';var express=require(_0x6a2d('0x0'));var router=express[_0x6a2d('0x1')]();var auth=require(_0x6a2d('0x2'));var controller=require(_0x6a2d('0x3'));router[_0x6a2d('0x4')](_0x6a2d('0x5'),auth[_0x6a2d('0x6')](),controller[_0x6a2d('0x7')]);module['exports']=router; \ No newline at end of file +var _0xdd03=['put','isAuthenticated','update','exports','express','../../components/auth/service'];(function(_0x7ad478,_0x2e89ef){var _0x1c660c=function(_0x1191c2){while(--_0x1191c2){_0x7ad478['push'](_0x7ad478['shift']());}};_0x1c660c(++_0x2e89ef);}(_0xdd03,0x124));var _0x3dd0=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xdd03[_0x4b369d];return _0x571a98;};'use strict';var express=require(_0x3dd0('0x0'));var router=express['Router']();var auth=require(_0x3dd0('0x1'));var controller=require('./user-setting.controller');router[_0x3dd0('0x2')]('/:id',auth[_0x3dd0('0x3')](),controller[_0x3dd0('0x4')]);module[_0x3dd0('0x5')]=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 995b318..053eff9 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 _0x8eb1=['UserId','sequelize','error','info','debug','exports','ENUM','BOOLEAN','TEXT','INTEGER'];(function(_0x3db58d,_0x3f0c01){var _0x17158d=function(_0x1b03f5){while(--_0x1b03f5){_0x3db58d['push'](_0x3db58d['shift']());}};_0x17158d(++_0x3f0c01);}(_0x8eb1,0x191));var _0x18eb=function(_0x30e50b,_0x26b79b){_0x30e50b=_0x30e50b-0x0;var _0x516d42=_0x8eb1[_0x30e50b];return _0x516d42;};'use strict';var Sequelize=require(_0x18eb('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x18eb('0x1'),'warning',_0x18eb('0x2'),_0x18eb('0x3')];module[_0x18eb('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x18eb('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x18eb('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x18eb('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x18eb('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x18eb('0x8')],'unique':_0x18eb('0x9')}}; \ No newline at end of file +var _0x06c0=['INTEGER','sequelize','warning','debug','exports','ENUM','TEXT'];(function(_0x317dc2,_0x2fcb0a){var _0x332e60=function(_0x3de79e){while(--_0x3de79e){_0x317dc2['push'](_0x317dc2['shift']());}};_0x332e60(++_0x2fcb0a);}(_0x06c0,0xc5));var _0x006c=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x06c0[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0x006c('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x006c('0x1'),'info',_0x006c('0x2')];module[_0x006c('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x006c('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x006c('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x006c('0x6')],'unique':'UserId'}}; \ 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 fdd8750..663cd86 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 _0xf874=['status','update','then','sendStatus','error','stack','name','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','defaults'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xf874,0x177));var _0x4f87=function(_0x29019b,_0x816250){_0x29019b=_0x29019b-0x0;var _0x378e6e=_0xf874[_0x29019b];return _0x378e6e;};'use strict';var _=require(_0x4f87('0x0'));var Redis=require('ioredis');var logger=require(_0x4f87('0x1'))(_0x4f87('0x2'));var config=require(_0x4f87('0x3'));var db=require(_0x4f87('0x4'))['db'];var socket=require(_0x4f87('0x5'))(new Redis(config[_0x4f87('0x6')]));require(_0x4f87('0x7'))['register'](socket);config[_0x4f87('0x6')]=_[_0x4f87('0x8')](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x497346,_0x4ac62f){_0x4ac62f=_0x4ac62f||0xc8;return function(_0x55a9b0){if(_0x55a9b0){return _0x497346[_0x4f87('0x9')](_0x4ac62f)['json'](_0x55a9b0);}};}function saveUpdates(_0x1bcbde){return function(_0x434b3f){if(_0x434b3f){return _0x434b3f[_0x4f87('0xa')](_0x1bcbde)[_0x4f87('0xb')](function(_0x4dfb28){return _0x4dfb28;});}return null;};}function handleEntityNotFound(_0x25dea7){return function(_0x364d09){if(!_0x364d09){_0x25dea7[_0x4f87('0xc')](0x194);}return _0x364d09;};}function handleError(_0x1777bb,_0x1faa4e){_0x1faa4e=_0x1faa4e||0x1f4;return function(_0x442128){logger[_0x4f87('0xd')](_0x442128[_0x4f87('0xe')]);if(_0x442128[_0x4f87('0xf')]){delete _0x442128[_0x4f87('0xf')];}_0x1777bb[_0x4f87('0x9')](_0x1faa4e)['send'](_0x442128);};}exports[_0x4f87('0xa')]=function(_0x16833c,_0x501ee7){if(_0x16833c['user'][_0x4f87('0x10')]!=='admin')throw new Error(_0x4f87('0x11'));if(isNaN(Number(_0x16833c[_0x4f87('0x12')]['id'])))throw new Error(_0x4f87('0x13'));return db[_0x4f87('0x14')][_0x4f87('0x15')]({'where':{'id':_0x16833c[_0x4f87('0x12')]['id']}})[_0x4f87('0xb')](handleEntityNotFound(_0x501ee7,null))[_0x4f87('0xb')](saveUpdates(_0x16833c[_0x4f87('0x16')],null))[_0x4f87('0xb')](respondWithResult(_0x501ee7,null))[_0x4f87('0x17')](handleError(_0x501ee7,null));}; \ No newline at end of file +var _0xd240=['localhost','status','json','update','then','error','stack','send','user','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch','ioredis','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register'];(function(_0x459e7b,_0x58d063){var _0x20b4e3=function(_0x4a00d1){while(--_0x4a00d1){_0x459e7b['push'](_0x459e7b['shift']());}};_0x20b4e3(++_0x58d063);}(_0xd240,0x1c7));var _0x0d24=function(_0x5758b5,_0x4bb1dd){_0x5758b5=_0x5758b5-0x0;var _0x36b590=_0xd240[_0x5758b5];return _0x36b590;};'use strict';var _=require('lodash');var Redis=require(_0x0d24('0x0'));var logger=require('../../config/logger')('api');var config=require(_0x0d24('0x1'));var db=require(_0x0d24('0x2'))['db'];var socket=require(_0x0d24('0x3'))(new Redis(config[_0x0d24('0x4')]));require(_0x0d24('0x5'))[_0x0d24('0x6')](socket);config['redis']=_['defaults'](config[_0x0d24('0x4')],{'host':_0x0d24('0x7'),'port':0x18eb});function respondWithResult(_0x1005ff,_0x250141){_0x250141=_0x250141||0xc8;return function(_0x48fb91){if(_0x48fb91){return _0x1005ff[_0x0d24('0x8')](_0x250141)[_0x0d24('0x9')](_0x48fb91);}};}function saveUpdates(_0x4345ae){return function(_0x43d5e0){if(_0x43d5e0){return _0x43d5e0[_0x0d24('0xa')](_0x4345ae)[_0x0d24('0xb')](function(_0x23f9ed){return _0x23f9ed;});}return null;};}function handleEntityNotFound(_0x4b55f0){return function(_0x3aedef){if(!_0x3aedef){_0x4b55f0['sendStatus'](0x194);}return _0x3aedef;};}function handleError(_0xc98389,_0x52550f){_0x52550f=_0x52550f||0x1f4;return function(_0x1603a8){logger[_0x0d24('0xc')](_0x1603a8[_0x0d24('0xd')]);if(_0x1603a8['name']){delete _0x1603a8['name'];}_0xc98389[_0x0d24('0x8')](_0x52550f)[_0x0d24('0xe')](_0x1603a8);};}exports[_0x0d24('0xa')]=function(_0x4de3a0,_0x1149ec){if(_0x4de3a0[_0x0d24('0xf')]['role']!=='admin')throw new Error(_0x0d24('0x10'));if(isNaN(Number(_0x4de3a0[_0x0d24('0x11')]['id'])))throw new Error(_0x0d24('0x12'));return db[_0x0d24('0x13')][_0x0d24('0x14')]({'where':{'id':_0x4de3a0[_0x0d24('0x11')]['id']}})[_0x0d24('0xb')](handleEntityNotFound(_0x1149ec,null))[_0x0d24('0xb')](saveUpdates(_0x4de3a0['body'],null))[_0x0d24('0xb')](respondWithResult(_0x1149ec,null))[_0x0d24('0x15')](handleError(_0x1149ec,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 720cf6c..bdea77c 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 _0x5199=['emit','exports','events','../../mysqldb','save','update','remove'];(function(_0x211195,_0x30929f){var _0x593b25=function(_0x192a3a){while(--_0x192a3a){_0x211195['push'](_0x211195['shift']());}};_0x593b25(++_0x30929f);}(_0x5199,0x10c));var _0x9519=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x5199[_0x29b609];return _0x54c952;};'use strict';var EventEmitter=require(_0x9519('0x0'));var UserSetting=require(_0x9519('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9519('0x2'),'afterUpdate':_0x9519('0x3'),'afterDestroy':_0x9519('0x4')};function emitEvent(_0x35b036){return function(_0xd20e1b,_0x2d1a84,_0x136d78){UserSettingEvents[_0x9519('0x5')](_0x35b036+':'+_0xd20e1b['id'],_0xd20e1b);UserSettingEvents[_0x9519('0x5')](_0x35b036,_0xd20e1b);_0x136d78(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x9519('0x6')]=UserSettingEvents; \ No newline at end of file +var _0xcf91=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3b594b,_0x5835c3){var _0x1ea5f8=function(_0x191b3e){while(--_0x191b3e){_0x3b594b['push'](_0x3b594b['shift']());}};_0x1ea5f8(++_0x5835c3);}(_0xcf91,0x1cd));var _0x1cf9=function(_0x416d0c,_0x3116a6){_0x416d0c=_0x416d0c-0x0;var _0x2b1ac4=_0xcf91[_0x416d0c];return _0x2b1ac4;};'use strict';var EventEmitter=require(_0x1cf9('0x0'));var UserSetting=require(_0x1cf9('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x1cf9('0x2')](0x0);var events={'afterCreate':_0x1cf9('0x3'),'afterUpdate':_0x1cf9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5acdb7){return function(_0x10ff91,_0x433bf2,_0x2dc694){UserSettingEvents[_0x1cf9('0x5')](_0x5acdb7+':'+_0x10ff91['id'],_0x10ff91);UserSettingEvents[_0x1cf9('0x5')](_0x5acdb7,_0x10ff91);_0x2dc694(null);};}for(var e in events){if(events[_0x1cf9('0x6')](e)){var event=events[e];UserSetting[_0x1cf9('0x7')](e,emitEvent(event));}}module[_0x1cf9('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 0a13b79..b40f56d 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 _0x78f0=['exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x1aca7e,_0x44f65e){var _0x5c489e=function(_0x19f0a1){while(--_0x19f0a1){_0x1aca7e['push'](_0x1aca7e['shift']());}};_0x5c489e(++_0x44f65e);}(_0x78f0,0x15d));var _0x078f=function(_0x51ba06,_0x90392a){_0x51ba06=_0x51ba06-0x0;var _0x183954=_0x78f0[_0x51ba06];return _0x183954;};'use strict';var attributes=require(_0x078f('0x0'));module[_0x078f('0x1')]=function(_0x140ffe){return _0x140ffe[_0x078f('0x2')](_0x078f('0x3'),attributes,{'tableName':_0x078f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x34a715){if(!_0x34a715[_0x078f('0x5')])_0x34a715['clientSideLoggingEnabledSince']=null;else if(_0x34a715[_0x078f('0x6')]===null)_0x34a715[_0x078f('0x6')]=new Date();}}});}; \ No newline at end of file +var _0x0490=['exports','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x0490,0x147));var _0x0049=function(_0x41479d,_0x2911da){_0x41479d=_0x41479d-0x0;var _0x435670=_0x0490[_0x41479d];return _0x435670;};'use strict';var attributes=require('./user-setting.attributes');module[_0x0049('0x0')]=function(_0x5f5313){return _0x5f5313['define']('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2803f6){if(!_0x2803f6[_0x0049('0x1')])_0x2803f6[_0x0049('0x2')]=null;else if(_0x2803f6[_0x0049('0x2')]===null)_0x2803f6[_0x0049('0x2')]=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 0c55cef..be390f8 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 _0x0e1b=['register','length','user-setting:','./user-setting.events','save','remove','update','emit','user-setting:update','UserId'];(function(_0x2f3067,_0x390d50){var _0x598564=function(_0x131fa1){while(--_0x131fa1){_0x2f3067['push'](_0x2f3067['shift']());}};_0x598564(++_0x390d50);}(_0x0e1b,0x143));var _0xb0e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e1b[_0x3dd15e];return _0x231fd0;};'use strict';var UserSettingEvents=require(_0xb0e1('0x0'));var events=[_0xb0e1('0x1'),_0xb0e1('0x2'),_0xb0e1('0x3')];function createListener(_0x23e9f5,_0x54ade3){return function(_0xce4e8d){_0x54ade3[_0xb0e1('0x4')](_0x23e9f5,_0xce4e8d);if(_0x23e9f5===_0xb0e1('0x5')){_0x54ade3[_0xb0e1('0x4')]('user-setting:update:user-'+_0xce4e8d[_0xb0e1('0x6')],_0xce4e8d);}};}exports[_0xb0e1('0x7')]=function(_0x369e64){for(var _0x10ddd1=0x0,_0x239350=events[_0xb0e1('0x8')];_0x10ddd1<_0x239350;_0x10ddd1++){var _0x2eecbe=events[_0x10ddd1];var _0x56d1da=createListener(_0xb0e1('0x9')+_0x2eecbe,_0x369e64);UserSettingEvents['on'](_0x2eecbe,_0x56d1da);}}; \ No newline at end of file +var _0xe19d=['user-setting:update','UserId','register','length','user-setting:','./user-setting.events','remove','emit'];(function(_0x7633c,_0x1e45bf){var _0x1b77e2=function(_0x4c3e7f){while(--_0x4c3e7f){_0x7633c['push'](_0x7633c['shift']());}};_0x1b77e2(++_0x1e45bf);}(_0xe19d,0x12d));var _0xde19=function(_0x1fdce6,_0x4412d9){_0x1fdce6=_0x1fdce6-0x0;var _0x36b546=_0xe19d[_0x1fdce6];return _0x36b546;};'use strict';var UserSettingEvents=require(_0xde19('0x0'));var events=['save',_0xde19('0x1'),'update'];function createListener(_0x3c3f9d,_0x130926){return function(_0x44cbfc){_0x130926[_0xde19('0x2')](_0x3c3f9d,_0x44cbfc);if(_0x3c3f9d===_0xde19('0x3')){_0x130926[_0xde19('0x2')]('user-setting:update:user-'+_0x44cbfc[_0xde19('0x4')],_0x44cbfc);}};}exports[_0xde19('0x5')]=function(_0x3727ef){for(var _0x4f17b9=0x0,_0x1ed5bd=events[_0xde19('0x6')];_0x4f17b9<_0x1ed5bd;_0x4f17b9++){var _0x274391=events[_0x4f17b9];var _0x391df3=createListener(_0xde19('0x7')+_0x274391,_0x3727ef);UserSettingEvents['on'](_0x274391,_0x391df3);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 7db39c4..0748546 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 _0xfa63=['addContacts','post','create','/create_many','/:id/queues','addQueues','diskStorage','join','server/files/images/','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/api_key','getApiKey'];(function(_0x483cf8,_0x5b6c2c){var _0x378cb0=function(_0x353447){while(--_0x353447){_0x483cf8['push'](_0x483cf8['shift']());}};_0x378cb0(++_0x5b6c2c);}(_0xfa63,0x190));var _0x3fa6=function(_0x284b56,_0x12efc6){_0x284b56=_0x284b56-0x0;var _0x1f1f9b=_0xfa63[_0x284b56];return _0x1f1f9b;};'use strict';var multer=require('multer');var util=require(_0x3fa6('0x0'));var path=require(_0x3fa6('0x1'));var timeout=require(_0x3fa6('0x2'));var express=require(_0x3fa6('0x3'));var router=express['Router']();var fs_extra=require(_0x3fa6('0x4'));var auth=require(_0x3fa6('0x5'));var interaction=require(_0x3fa6('0x6'));var config=require(_0x3fa6('0x7'));var controller=require(_0x3fa6('0x8'));router['get']('/',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0xa')]);router[_0x3fa6('0xb')](_0x3fa6('0xc'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0xd')]);router['get'](_0x3fa6('0xe'),auth[_0x3fa6('0x9')](),controller['whoami']);router['get'](_0x3fa6('0xf'),auth['isAuthenticated'](),controller[_0x3fa6('0x10')]);router[_0x3fa6('0xb')](_0x3fa6('0x11'),auth[_0x3fa6('0x9')](),controller['show']);router[_0x3fa6('0xb')](_0x3fa6('0x12'),controller[_0x3fa6('0x13')]);router['get']('/:id/open_tabs',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x14')]);router[_0x3fa6('0xb')](_0x3fa6('0x15'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x16')]);router[_0x3fa6('0xb')]('/:id/queues',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x17')]);router[_0x3fa6('0xb')](_0x3fa6('0x18'),auth['isAuthenticated'](),controller[_0x3fa6('0x19')]);router[_0x3fa6('0xb')](_0x3fa6('0x1a'),auth['isAuthenticated'](),controller[_0x3fa6('0x1b')]);router[_0x3fa6('0xb')](_0x3fa6('0x1c'),auth['isAuthenticated'](),controller[_0x3fa6('0x1d')]);router['get'](_0x3fa6('0x1e'),auth['isAuthenticated'](),controller[_0x3fa6('0x1f')]);router[_0x3fa6('0xb')](_0x3fa6('0x20'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x21')]);router['get'](_0x3fa6('0x22'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x23')]);router[_0x3fa6('0xb')]('/:id/mail/interactions',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x24')]);router[_0x3fa6('0xb')](_0x3fa6('0x25'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x26')]);router[_0x3fa6('0xb')](_0x3fa6('0x27'),auth[_0x3fa6('0x9')](),controller['getFaxInteractions']);router['get']('/:id/whatsapp/interactions',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x28')]);router[_0x3fa6('0xb')](_0x3fa6('0x29'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3fa6('0xb')](_0x3fa6('0x2a'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x2b')]);router[_0x3fa6('0xb')](_0x3fa6('0x2c'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x2d')]);router[_0x3fa6('0xb')](_0x3fa6('0x2e'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x2f')]);router[_0x3fa6('0xb')](_0x3fa6('0x30'),auth[_0x3fa6('0x9')](),controller['getFaxAccounts']);router[_0x3fa6('0xb')](_0x3fa6('0x31'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x32')]);router[_0x3fa6('0xb')](_0x3fa6('0x33'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x34')]);router['get']('/:id/sms_accounts',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x35')]);router['get'](_0x3fa6('0x36'),auth[_0x3fa6('0x9')](),controller['getChatWebsites']);router[_0x3fa6('0xb')]('/:id/whatsapp_accounts',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x37')]);router['get'](_0x3fa6('0x38'),auth['isAuthenticated'](),controller[_0x3fa6('0x39')]);router[_0x3fa6('0xb')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller['getScheduledCalls']);router[_0x3fa6('0xb')](_0x3fa6('0x3a'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x3b')]);router['post'](_0x3fa6('0x15'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x3c')]);router[_0x3fa6('0x3d')]('/',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x3e')]);router[_0x3fa6('0x3d')](_0x3fa6('0x3f'),auth[_0x3fa6('0x9')](),controller['bulkCreate']);router[_0x3fa6('0x3d')](_0x3fa6('0x40'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x41')]);var upload=multer({'storage':multer[_0x3fa6('0x42')]({'destination':function(_0x11f676,_0x5f1241,_0x164036){_0x164036(null,path[_0x3fa6('0x43')](config['root'],_0x3fa6('0x44')));},'filename':function(_0x1884bf,_0x547494,_0x3d8958){_0x3d8958(null,util['format'](_0x3fa6('0x45'),Date[_0x3fa6('0x46')](),_0x547494[_0x3fa6('0x47')]));}})});router[_0x3fa6('0x3d')](_0x3fa6('0x12'),upload[_0x3fa6('0x48')](_0x3fa6('0x49')),controller[_0x3fa6('0x4a')]);router['post'](_0x3fa6('0x4b'),auth['isAuthenticated'](),controller[_0x3fa6('0x4c')]);router['post'](_0x3fa6('0x4d'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x4e')]);router[_0x3fa6('0x3d')]('/:id/pause',auth[_0x3fa6('0x9')](),controller['pause']);router[_0x3fa6('0x3d')](_0x3fa6('0x4f'),auth[_0x3fa6('0x9')](),controller['unpause']);router[_0x3fa6('0x3d')](_0x3fa6('0x29'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x50')]);router[_0x3fa6('0x3d')](_0x3fa6('0x51'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x52')]);router[_0x3fa6('0x3d')](_0x3fa6('0x53'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x54')]);router[_0x3fa6('0x3d')](_0x3fa6('0x55'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x56')]);router[_0x3fa6('0x3d')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x3fa6('0x57')]);router[_0x3fa6('0x3d')](_0x3fa6('0x58'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x59')]);router['post'](_0x3fa6('0x5a'),auth[_0x3fa6('0x9')](),controller['addWhatsappInteractions']);router[_0x3fa6('0x3d')](_0x3fa6('0x30'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x5b')]);router[_0x3fa6('0x3d')](_0x3fa6('0x31'),auth[_0x3fa6('0x9')](),controller['addMailAccounts']);router['post'](_0x3fa6('0x33'),auth[_0x3fa6('0x9')](),controller['addOpenchannelAccounts']);router[_0x3fa6('0x3d')](_0x3fa6('0x5c'),auth['isAuthenticated'](),controller[_0x3fa6('0x5d')]);router[_0x3fa6('0x3d')](_0x3fa6('0x36'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x5e')]);router['post'](_0x3fa6('0x5f'),auth['isAuthenticated'](),controller[_0x3fa6('0x60')]);router[_0x3fa6('0x3d')]('/:id/square_projects',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x61')]);router[_0x3fa6('0x3d')](_0x3fa6('0x3a'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x62')]);router['put'](_0x3fa6('0x11'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x63')]);router['put'](_0x3fa6('0x64'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x65')]);router[_0x3fa6('0x66')](_0x3fa6('0x40'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x67')]);router[_0x3fa6('0x66')](_0x3fa6('0x29'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x68')]);router[_0x3fa6('0x66')](_0x3fa6('0x11'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x69')]);router[_0x3fa6('0x66')](_0x3fa6('0x51'),auth[_0x3fa6('0x9')](),controller['removeChatInteractions']);router[_0x3fa6('0x66')](_0x3fa6('0x53'),auth['isAuthenticated'](),controller[_0x3fa6('0x6a')]);router[_0x3fa6('0x66')](_0x3fa6('0x55'),auth[_0x3fa6('0x9')](),controller['removeFaxInteractions']);router[_0x3fa6('0x66')]('/:id/sms_interactions',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x6b')]);router[_0x3fa6('0x66')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x3fa6('0x6c')]);router['delete'](_0x3fa6('0x5a'),auth[_0x3fa6('0x9')](),controller['removeWhatsappInteractions']);router[_0x3fa6('0x66')](_0x3fa6('0x30'),auth['isAuthenticated'](),controller[_0x3fa6('0x6d')]);router[_0x3fa6('0x66')](_0x3fa6('0x31'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x3fa6('0x66')]('/:id/openchannel_accounts',auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x6e')]);router[_0x3fa6('0x66')](_0x3fa6('0x5c'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x6f')]);router['delete'](_0x3fa6('0x36'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x3fa6('0x66')](_0x3fa6('0x5f'),auth[_0x3fa6('0x9')](),controller[_0x3fa6('0x70')]);router[_0x3fa6('0x66')](_0x3fa6('0x38'),auth['isAuthenticated'](),controller[_0x3fa6('0x71')]);router[_0x3fa6('0x66')](_0x3fa6('0x3a'),auth[_0x3fa6('0x9')](),controller['removeApiKey']);module[_0x3fa6('0x72')]=router; \ No newline at end of file +var _0x5126=['/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','/:id/password','removeQueues','removeTeams','delete','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/chat_websites','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','/whoami','whoami','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/sms_accounts','getSmsAccounts','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','/:id/contacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','originalname','file','addAvatar','login','/:id/logout','logout','pause','/:id/unpause','unpause','addTeams'];(function(_0x75ce5b,_0x3b582f){var _0x22195e=function(_0x166668){while(--_0x166668){_0x75ce5b['push'](_0x75ce5b['shift']());}};_0x22195e(++_0x3b582f);}(_0x5126,0x113));var _0x6512=function(_0x5a5203,_0x1210a9){_0x5a5203=_0x5a5203-0x0;var _0x5eaa19=_0x5126[_0x5a5203];return _0x5eaa19;};'use strict';var multer=require(_0x6512('0x0'));var util=require(_0x6512('0x1'));var path=require(_0x6512('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6512('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6512('0x4'));var controller=require(_0x6512('0x5'));router[_0x6512('0x6')]('/',auth[_0x6512('0x7')](),controller['index']);router[_0x6512('0x6')](_0x6512('0x8'),auth[_0x6512('0x7')](),controller['describe']);router[_0x6512('0x6')](_0x6512('0x9'),auth[_0x6512('0x7')](),controller[_0x6512('0xa')]);router['get']('/presence',auth[_0x6512('0x7')](),controller[_0x6512('0xb')]);router[_0x6512('0x6')](_0x6512('0xc'),auth[_0x6512('0x7')](),controller[_0x6512('0xd')]);router[_0x6512('0x6')](_0x6512('0xe'),controller[_0x6512('0xf')]);router[_0x6512('0x6')](_0x6512('0x10'),auth[_0x6512('0x7')](),controller[_0x6512('0x11')]);router[_0x6512('0x6')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0x6512('0x6')](_0x6512('0x12'),auth[_0x6512('0x7')](),controller[_0x6512('0x13')]);router[_0x6512('0x6')](_0x6512('0x14'),auth[_0x6512('0x7')](),controller[_0x6512('0x15')]);router[_0x6512('0x6')](_0x6512('0x16'),auth[_0x6512('0x7')](),controller[_0x6512('0x17')]);router['get']('/:id/recordings',auth[_0x6512('0x7')](),controller[_0x6512('0x18')]);router[_0x6512('0x6')](_0x6512('0x19'),auth[_0x6512('0x7')](),controller[_0x6512('0x1a')]);router['get'](_0x6512('0x1b'),auth['isAuthenticated'](),controller[_0x6512('0x1c')]);router['get']('/:id/openchannel/interactions',auth[_0x6512('0x7')](),controller[_0x6512('0x1d')]);router[_0x6512('0x6')](_0x6512('0x1e'),auth[_0x6512('0x7')](),controller[_0x6512('0x1f')]);router[_0x6512('0x6')](_0x6512('0x20'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x6512('0x6')](_0x6512('0x21'),auth[_0x6512('0x7')](),controller[_0x6512('0x22')]);router[_0x6512('0x6')](_0x6512('0x23'),auth[_0x6512('0x7')](),controller[_0x6512('0x24')]);router[_0x6512('0x6')](_0x6512('0x25'),auth[_0x6512('0x7')](),controller[_0x6512('0x26')]);router[_0x6512('0x6')](_0x6512('0x27'),auth['isAuthenticated'](),controller[_0x6512('0x28')]);router[_0x6512('0x6')]('/:id/agents',auth['isAuthenticated'](),controller[_0x6512('0x29')]);router[_0x6512('0x6')]('/:id/prefixes',auth[_0x6512('0x7')](),controller[_0x6512('0x2a')]);router['get'](_0x6512('0x2b'),auth[_0x6512('0x7')](),controller[_0x6512('0x2c')]);router['get'](_0x6512('0x2d'),auth[_0x6512('0x7')](),controller[_0x6512('0x2e')]);router['get']('/:id/openchannel_accounts',auth[_0x6512('0x7')](),controller['getOpenchannelAccounts']);router[_0x6512('0x6')](_0x6512('0x2f'),auth[_0x6512('0x7')](),controller[_0x6512('0x30')]);router[_0x6512('0x6')]('/:id/chat_websites',auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x6512('0x6')](_0x6512('0x31'),auth[_0x6512('0x7')](),controller['getWhatsappAccounts']);router[_0x6512('0x6')](_0x6512('0x32'),auth[_0x6512('0x7')](),controller[_0x6512('0x33')]);router[_0x6512('0x6')]('/:id/scheduled_calls',auth[_0x6512('0x7')](),controller[_0x6512('0x34')]);router[_0x6512('0x6')](_0x6512('0x35'),auth['isAuthenticated'](),controller[_0x6512('0x36')]);router[_0x6512('0x37')](_0x6512('0x38'),auth[_0x6512('0x7')](),controller['addContacts']);router[_0x6512('0x37')]('/',auth[_0x6512('0x7')](),controller[_0x6512('0x39')]);router[_0x6512('0x37')](_0x6512('0x3a'),auth['isAuthenticated'](),controller[_0x6512('0x3b')]);router[_0x6512('0x37')](_0x6512('0x12'),auth[_0x6512('0x7')](),controller[_0x6512('0x3c')]);var upload=multer({'storage':multer[_0x6512('0x3d')]({'destination':function(_0x11e25c,_0x20f8c9,_0x4b65a5){_0x4b65a5(null,path[_0x6512('0x3e')](config[_0x6512('0x3f')],_0x6512('0x40')));},'filename':function(_0x3ec79d,_0x433655,_0x4c4c12){_0x4c4c12(null,util[_0x6512('0x41')]('%s-%s',Date['now'](),_0x433655[_0x6512('0x42')]));}})});router[_0x6512('0x37')]('/:id/avatar',upload['single'](_0x6512('0x43')),controller[_0x6512('0x44')]);router[_0x6512('0x37')]('/:id/login',auth[_0x6512('0x7')](),controller[_0x6512('0x45')]);router[_0x6512('0x37')](_0x6512('0x46'),auth[_0x6512('0x7')](),controller[_0x6512('0x47')]);router[_0x6512('0x37')]('/:id/pause',auth[_0x6512('0x7')](),controller[_0x6512('0x48')]);router[_0x6512('0x37')](_0x6512('0x49'),auth['isAuthenticated'](),controller[_0x6512('0x4a')]);router[_0x6512('0x37')](_0x6512('0x25'),auth[_0x6512('0x7')](),controller[_0x6512('0x4b')]);router[_0x6512('0x37')](_0x6512('0x4c'),auth[_0x6512('0x7')](),controller[_0x6512('0x4d')]);router['post'](_0x6512('0x4e'),auth[_0x6512('0x7')](),controller[_0x6512('0x4f')]);router[_0x6512('0x37')](_0x6512('0x50'),auth[_0x6512('0x7')](),controller[_0x6512('0x51')]);router['post'](_0x6512('0x52'),auth[_0x6512('0x7')](),controller[_0x6512('0x53')]);router[_0x6512('0x37')](_0x6512('0x54'),auth[_0x6512('0x7')](),controller['addOpenchannelInteractions']);router[_0x6512('0x37')](_0x6512('0x55'),auth[_0x6512('0x7')](),controller[_0x6512('0x56')]);router[_0x6512('0x37')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x6512('0x57')]);router[_0x6512('0x37')](_0x6512('0x2d'),auth[_0x6512('0x7')](),controller[_0x6512('0x58')]);router[_0x6512('0x37')](_0x6512('0x59'),auth[_0x6512('0x7')](),controller[_0x6512('0x5a')]);router['post'](_0x6512('0x2f'),auth[_0x6512('0x7')](),controller['addSmsAccounts']);router[_0x6512('0x37')]('/:id/chat_websites',auth[_0x6512('0x7')](),controller[_0x6512('0x5b')]);router[_0x6512('0x37')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x6512('0x5c')]);router[_0x6512('0x37')](_0x6512('0x32'),auth[_0x6512('0x7')](),controller[_0x6512('0x5d')]);router[_0x6512('0x37')]('/:id/api_key',auth[_0x6512('0x7')](),controller[_0x6512('0x5e')]);router[_0x6512('0x5f')](_0x6512('0xc'),auth[_0x6512('0x7')](),controller[_0x6512('0x60')]);router[_0x6512('0x5f')](_0x6512('0x61'),auth[_0x6512('0x7')](),controller['changePassword']);router['delete'](_0x6512('0x12'),auth['isAuthenticated'](),controller[_0x6512('0x62')]);router['delete'](_0x6512('0x25'),auth[_0x6512('0x7')](),controller[_0x6512('0x63')]);router[_0x6512('0x64')]('/:id',auth[_0x6512('0x7')](),controller[_0x6512('0x65')]);router['delete'](_0x6512('0x4c'),auth[_0x6512('0x7')](),controller[_0x6512('0x66')]);router['delete'](_0x6512('0x4e'),auth[_0x6512('0x7')](),controller['removeMailInteractions']);router[_0x6512('0x64')](_0x6512('0x50'),auth[_0x6512('0x7')](),controller[_0x6512('0x67')]);router['delete']('/:id/sms_interactions',auth[_0x6512('0x7')](),controller[_0x6512('0x68')]);router[_0x6512('0x64')](_0x6512('0x54'),auth['isAuthenticated'](),controller[_0x6512('0x69')]);router[_0x6512('0x64')](_0x6512('0x55'),auth[_0x6512('0x7')](),controller[_0x6512('0x6a')]);router[_0x6512('0x64')]('/:id/fax_accounts',auth[_0x6512('0x7')](),controller[_0x6512('0x6b')]);router[_0x6512('0x64')](_0x6512('0x2d'),auth['isAuthenticated'](),controller[_0x6512('0x6c')]);router['delete'](_0x6512('0x59'),auth[_0x6512('0x7')](),controller[_0x6512('0x6d')]);router['delete']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x6512('0x6e')]);router[_0x6512('0x64')](_0x6512('0x6f'),auth[_0x6512('0x7')](),controller[_0x6512('0x70')]);router['delete'](_0x6512('0x31'),auth[_0x6512('0x7')](),controller[_0x6512('0x71')]);router[_0x6512('0x64')](_0x6512('0x32'),auth[_0x6512('0x7')](),controller[_0x6512('0x72')]);router[_0x6512('0x64')](_0x6512('0x35'),auth[_0x6512('0x7')](),controller[_0x6512('0x73')]);module[_0x6512('0x74')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index f14a12c..a2d64e5 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 _0x34e8=['isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','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','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get'];(function(_0x2087b4,_0x347664){var _0x3cb351=function(_0x2b02b7){while(--_0x2b02b7){_0x2087b4['push'](_0x2087b4['shift']());}};_0x3cb351(++_0x347664);}(_0x34e8,0x12c));var _0x834e=function(_0x376bee,_0x2db1fa){_0x376bee=_0x376bee-0x0;var _0x8724e7=_0x34e8[_0x376bee];return _0x8724e7;};'use strict';var Sequelize=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));module['exports']={'name':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x472111){this[_0x834e('0x6')](_0x834e('0x5'),_0x472111);this[_0x834e('0x6')](_0x834e('0x7'),_0x472111);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'set':function(_0x52056d){this[_0x834e('0x6')](_0x834e('0x8'),_0x52056d);this[_0x834e('0x6')](_0x834e('0x9'),util[_0x834e('0xa')](_0x834e('0xb'),_0x52056d,this[_0x834e('0xc')](_0x834e('0xd'))));}},'alias':{'type':Sequelize[_0x834e('0x4')]},'email':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0xe'),'validate':{'isEmail':!![]},'set':function(_0x36e124){if(_0x36e124){this[_0x834e('0x6')](_0x834e('0xe'),_0x36e124[_0x834e('0xf')]());}}},'role':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x11'),'user',_0x834e('0x12'),_0x834e('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x834e('0x4')],'defaultValue':_0x834e('0x14')},'internal':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':![],'unique':_0x834e('0xd'),'set':function(_0x50e860){this[_0x834e('0x6')](_0x834e('0xd'),_0x50e860);this['setDataValue'](_0x834e('0x16'),_0x50e860);this['setDataValue'](_0x834e('0x9'),util[_0x834e('0xa')]('\x22%s\x22\x20<%s>',this[_0x834e('0xc')](_0x834e('0x8')),_0x50e860));}},'salt':{'type':Sequelize[_0x834e('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x834e('0x4')]},'address':{'type':Sequelize[_0x834e('0x4')]},'zipcode':{'type':Sequelize[_0x834e('0x4')]},'userpic':{'type':Sequelize[_0x834e('0x4')]},'city':{'type':Sequelize[_0x834e('0x4')]},'country':{'type':Sequelize[_0x834e('0x4')]},'online':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x834e('0x18')},'lastPauseAt':{'type':Sequelize[_0x834e('0x19')]},'chatCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x834e('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x834e('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0x834e('0x1b')},'context':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x834e('0x1d'),_0x834e('0x1e'),_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),_0x834e('0x23'),_0x834e('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x25'),'set':function(_0x2b3418){this[_0x834e('0x6')](_0x834e('0x26'),_0x2b3418?_0x2b3418[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x26'))?this[_0x834e('0xc')]('transport')[_0x834e('0x28')](','):null;},'comment':_0x834e('0x29')},'dtmfmode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2a'),'info',_0x834e('0x2b'),_0x834e('0x2c'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x31'),'set':function(_0x6a3ac){this['setDataValue'](_0x834e('0x32'),_0x6a3ac?_0x6a3ac[_0x834e('0x27')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x834e('0xc')](_0x834e('0x32'))[_0x834e('0x28')](','):null;},'comment':_0x834e('0x33')},'callgroup':{'type':Sequelize[_0x834e('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x834e('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x834e('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x834e('0x34')},'allow':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'defaultValue':_0x834e('0x35'),'set':function(_0x3c59af){this[_0x834e('0x6')]('allow',_0x3c59af?_0x3c59af[_0x834e('0x27')](';'):_0x834e('0x35'));},'get':function(){return this[_0x834e('0xc')]('allow')?this[_0x834e('0xc')](_0x834e('0x36'))['split'](';'):null;},'comment':_0x834e('0x37')},'autoframing':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'set':function(_0x4a18bb){this['setDataValue'](_0x834e('0x38'),_0x4a18bb?_0x4a18bb[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x38'))?this[_0x834e('0xc')](_0x834e('0x38'))[_0x834e('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x834e('0x10')]('yes','no',_0x834e('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x3a')},'amaflags':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3c'),_0x834e('0x3d'),_0x834e('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3f'),_0x834e('0x40')),'allowNull':!![],'defaultValue':_0x834e('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x834e('0x10')]('yes','no','fingerprint',_0x834e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x834e('0x10')]('active',_0x834e('0x42'),_0x834e('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x834e('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x834e('0x19')]},'passwordResetAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x834e('0x45')]},'showWebBar':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0,'set':function(_0x1e4310){this[_0x834e('0x6')](_0x834e('0x46'),_0x1e4310);var _0x1659c8=this[_0x834e('0x47')]({'plain':!![]});switch(_0x1e4310){case 0x0:case 0x1:var _0x17b8e3=_0x1659c8[_0x834e('0x26')]?_[_0x834e('0x48')](_0x1659c8[_0x834e('0x26')])?_0x1659c8[_0x834e('0x26')][_0x834e('0x27')]():_0x1659c8[_0x834e('0x26')]:'udp';if(_0x17b8e3===_0x834e('0x49')){_0x17b8e3=_0x834e('0x25');}this[_0x834e('0x6')](_0x834e('0x26'),_0x17b8e3);this['setDataValue'](_0x834e('0x4a'),'no');this['setDataValue']('avpf',null);this[_0x834e('0x6')](_0x834e('0x4b'),null);this[_0x834e('0x6')](_0x834e('0x4c'),null);this[_0x834e('0x6')](_0x834e('0x4d'),null);this[_0x834e('0x6')](_0x834e('0x4e'),null);this['setDataValue'](_0x834e('0x4f'),null);this['setDataValue'](_0x834e('0x50'),null);this[_0x834e('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x834e('0x51'),'no');break;case 0x2:this[_0x834e('0x6')](_0x834e('0x26'),_0x834e('0x49'));this[_0x834e('0x6')]('encryption',_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x52'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4b'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4c'),_0x834e('0x2d'));this['setDataValue'](_0x834e('0x4d'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4e'),'no');this['setDataValue'](_0x834e('0x4f'),'actpass');this['setDataValue']('dtlscertfile',_0x1659c8[_0x834e('0x50')]||_0x834e('0x53'));this['setDataValue'](_0x834e('0x54'),_0x1659c8[_0x834e('0x54')]||'/etc/pki/tls/private/motion.key');this[_0x834e('0x6')](_0x834e('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x346be5){this[_0x834e('0x6')](_0x834e('0x55'),_0x346be5?_0x346be5[_0x834e('0x27')](','):[]);},'get':function(){return this[_0x834e('0xc')]('permissions')?_[_0x834e('0x56')](this['getDataValue'](_0x834e('0x55'))[_0x834e('0x28')](','),function(_0x2c758c){return parseInt(_0x2c758c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x834e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x834e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x834e('0xc')](_0x834e('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x18ddac){if(typeof _0x18ddac===_0x834e('0x58')){var _0x5acf5c=_0x18ddac==='1'?!![]:_0x18ddac==='0'?![]:_0x18ddac===_0x834e('0x59')?!![]:_0x18ddac===_0x834e('0x5a')?![]:![];this[_0x834e('0x6')]('screenrecording',_0x5acf5c);}else{this[_0x834e('0x6')](_0x834e('0x5b'),_0x18ddac);}}},'blocked':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x443633){this[_0x834e('0x6')]('blocked',_0x443633);if(_0x443633===!![]){this['setDataValue'](_0x834e('0x5c'),moment());this[_0x834e('0x6')]('loginAttempts',0x0);}else{this[_0x834e('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x834e('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0}}; \ No newline at end of file +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(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 97be9b3..57c3051 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 _0x3f06=['OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','concat','getContacts','findOne','CmContact','sort','pick','merge','hasOwnProperty','List','Tag','Tags','color','tag','nolimit','getQueues','order','Queue','Unknown\x20role','getVoiceQueuesRt','options','getGroups','ChatGroup','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','login','phone','mobile','loginInPause','intrf','format','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','PAUSE','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','flattenDeep','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getDataValue','Queue:save','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','Team','removeAgent','Voice','getLists','CmList','getAgents','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','user_has_chat_interactions:save','removeChatInteractions','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$like','$contains','$any','lastName','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','iat','nonce','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','flatten','col','toString','desc','asc','uniqBy','orderBy','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','QueryTypes','select','ui.','InteractionId','field','ui.createdAt','_interactions','ui.UserId\x20=\x20?','moment','util','path','lodash','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','redis','./user.socket','register','defaults','client','http','then','info','User,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','json','offset','limit','count','Content-Range','update','emit','userNotification:recalc:','destroy','get','Users','user','Agents','agent','Telephones','telephone','filter','ignore','map','value','includes','role','find','UserProfileResource','end','name','index','User','rawAttributes','fieldName','type','password','getOptions','where','query','includeAll','include','userSetting','UserSetting','attributes','push','findAll','openTabs','rows','chat','dataValues','sms','fax','mail','openchannel','whatsapp','all','show','params','differenceBy','keys','salt','filters','intersection','model','fields','length','true','body','describe','addContacts','ids','internal','Setting','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','from','mailbox','VoiceMail','fullname','email','permissions','101','102','113','110','104','105','106','107','108','100','111','115','create','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','online','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','Queues','penalty','spread','toLowerCase','QueueId','voice','SIP/%s','UserVoiceQueueRt','removeQueues','channel','remove','isArray','Queue:remove','addAvatar','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','userpic','server/files/images/','download','ChatOpenTabs','createdAt','FaxOpenTabs','OpenchannelOpenTabs'];(function(_0x3d84d4,_0x5819b0){var _0x3fb47c=function(_0x1e5ce0){while(--_0x1e5ce0){_0x3d84d4['push'](_0x3d84d4['shift']());}};_0x3fb47c(++_0x5819b0);}(_0x3f06,0xd5));var _0x63f0=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x3f06[_0x1cc8fe];return _0x230054;};'use strict';var moment=require(_0x63f0('0x0'));var util=require(_0x63f0('0x1'));var path=require(_0x63f0('0x2'));var fs=require('fs');var _=require(_0x63f0('0x3'));var squel=require('squel');var jayson=require(_0x63f0('0x4'));var Redis=require(_0x63f0('0x5'));var authService=require(_0x63f0('0x6'));var qs=require(_0x63f0('0x7'));var logger=require(_0x63f0('0x8'))('api');var utils=require(_0x63f0('0x9'));var config=require('../../config/environment');var licenseUtil=require(_0x63f0('0xa'));var APIBadRequestError=require(_0x63f0('0xb'))[_0x63f0('0xc')];var APINotFoundError=require('../../errors/api')[_0x63f0('0xd')];var APIHandleError=require('../../errors/api')[_0x63f0('0xe')];var db=require(_0x63f0('0xf'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x63f0('0x10')]));require(_0x63f0('0x11'))[_0x63f0('0x12')](socket);config[_0x63f0('0x10')]=_[_0x63f0('0x13')](config[_0x63f0('0x10')],{'host':'localhost','port':0x18eb});var amiClient=jayson[_0x63f0('0x14')][_0x63f0('0x15')]({'port':0x232a});var values;function respondWithRpcPromise(_0x58ce67,_0x5f145b,_0x413277,_0x2b4199){return new Promise(function(_0x15238b,_0x441a27){var _0x5d8006=_0x2b4199||amiClient;return _0x5d8006['request'](_0x58ce67,_0x413277)[_0x63f0('0x16')](function(_0x34fe97){logger[_0x63f0('0x17')](_0x63f0('0x18'),_0x5f145b,'request\x20sent');logger[_0x63f0('0x19')]('User,\x20%s,\x20%s,\x20%s',_0x5f145b,_0x63f0('0x1a'),JSON[_0x63f0('0x1b')](_0x34fe97));if(_0x34fe97[_0x63f0('0x1c')]){if(_0x34fe97[_0x63f0('0x1c')][_0x63f0('0x1d')]===0x1f4){logger['error'](_0x63f0('0x18'),_0x5f145b,_0x34fe97[_0x63f0('0x1c')]['message']);return _0x441a27(_0x34fe97[_0x63f0('0x1c')][_0x63f0('0x1e')]);}logger[_0x63f0('0x1c')](_0x63f0('0x18'),_0x5f145b,_0x34fe97[_0x63f0('0x1c')][_0x63f0('0x1e')]);return _0x15238b(_0x34fe97['error'][_0x63f0('0x1e')]);}else{logger[_0x63f0('0x17')]('User,\x20%s,\x20%s',_0x5f145b,_0x63f0('0x1a'));_0x15238b(_0x34fe97[_0x63f0('0x1f')][_0x63f0('0x1e')]);}})[_0x63f0('0x20')](function(_0x28fc1c){logger[_0x63f0('0x1c')]('User,\x20%s,\x20%s',_0x5f145b,_0x28fc1c);_0x441a27(_0x28fc1c);});});}function respondWithStatusCode(_0x52681a,_0x8fd2f2){_0x8fd2f2=_0x8fd2f2||0xcc;return function(_0x48194b){if(_0x48194b){return _0x52681a['sendStatus'](_0x8fd2f2);}return _0x52681a[_0x63f0('0x21')](_0x8fd2f2)['end']();};}function respondWithResult(_0x2b6541,_0x38c371){_0x38c371=_0x38c371||0xc8;return function(_0x192317){if(_0x192317){return _0x2b6541[_0x63f0('0x21')](_0x38c371)[_0x63f0('0x22')](_0x192317);}};}function respondWithFilteredResult(_0x46f611,_0x40dc7d){return function(_0x19027f){if(_0x19027f){var _0x2b30da=typeof _0x40dc7d[_0x63f0('0x23')]==='undefined'&&typeof _0x40dc7d[_0x63f0('0x24')]==='undefined';var _0x35af61=_0x19027f['count'];var _0x33236f=_0x2b30da?0x0:_0x40dc7d[_0x63f0('0x23')];var _0x464a9e=_0x2b30da?_0x19027f[_0x63f0('0x25')]:_0x40dc7d[_0x63f0('0x23')]+_0x40dc7d['limit'];var _0xe9c726;if(_0x464a9e>=_0x35af61){_0x464a9e=_0x35af61;_0xe9c726=0xc8;}else{_0xe9c726=0xce;}_0x46f611[_0x63f0('0x21')](_0xe9c726);return _0x46f611['set'](_0x63f0('0x26'),_0x33236f+'-'+_0x464a9e+'/'+_0x35af61)[_0x63f0('0x22')](_0x19027f);}return null;};}function saveUpdates(_0x2223fd){return function(_0x54d241){if(_0x54d241){return _0x54d241[_0x63f0('0x27')](_0x2223fd)[_0x63f0('0x16')](function(_0x13a5fc){socket[_0x63f0('0x28')](_0x63f0('0x29')+_0x13a5fc['id'],{});return _0x13a5fc;});}return null;};}function removeEntity(_0x11ed28){return function(_0x5a37bb){if(_0x5a37bb){return _0x5a37bb[_0x63f0('0x2a')]()[_0x63f0('0x16')](function(){var _0x17c87e=_0x5a37bb[_0x63f0('0x2b')]({'plain':!![]});if(_0x17c87e['role']==='admin')return;var _0x26e8ec=[{'name':_0x63f0('0x2c'),'value':_0x63f0('0x2d'),'ignore':!![]},{'name':_0x63f0('0x2e'),'value':_0x63f0('0x2f'),'ignore':![]},{'name':_0x63f0('0x30'),'value':_0x63f0('0x31'),'ignore':![]}];var _0x167fc9=_(_0x26e8ec)[_0x63f0('0x32')](_0x63f0('0x33'))[_0x63f0('0x34')](_0x63f0('0x35'))[_0x63f0('0x35')]();if(_[_0x63f0('0x36')](_0x167fc9,_0x17c87e[_0x63f0('0x37')])){return;}var _0x57e4d3=_[_0x63f0('0x38')](_0x26e8ec,[_0x63f0('0x35'),_0x17c87e[_0x63f0('0x37')]])['name'];return db[_0x63f0('0x39')][_0x63f0('0x2a')]({'where':{'type':_0x57e4d3,'resourceId':_0x17c87e['id']}})[_0x63f0('0x16')](function(){return _0x5a37bb;});})[_0x63f0('0x16')](function(){_0x11ed28[_0x63f0('0x21')](0xcc)[_0x63f0('0x3a')]();});}};}function handleEntityNotFound(_0x39e855){return function(_0x540ad9){if(!_0x540ad9){_0x39e855['sendStatus'](0x194);}return _0x540ad9;};}function handleError(_0x39e49b,_0x42031f){_0x42031f=_0x42031f||0x1f4;return function(_0x3282a2){logger[_0x63f0('0x1c')](_0x3282a2['stack']);if(_0x3282a2[_0x63f0('0x3b')]){delete _0x3282a2['name'];}_0x39e49b[_0x63f0('0x21')](_0x42031f)['send'](_0x3282a2);};}exports[_0x63f0('0x3c')]=function(_0x42682a,_0x6d6455){var _0x3930c0={},_0x54ca51={'count':0x0,'rows':[]};var _0x4ee70b=_(db[_0x63f0('0x3d')][_0x63f0('0x3e')])[_0x63f0('0x34')](function(_0xd83325){return{'name':_0xd83325[_0x63f0('0x3f')],'type':_0xd83325[_0x63f0('0x40')]['key']};})[_0x63f0('0x32')](function(_0x12310f){return!_[_0x63f0('0x36')]([_0x63f0('0x41'),'salt'],_0x12310f['name']);})[_0x63f0('0x35')]();_0x3930c0=qs[_0x63f0('0x42')](_0x4ee70b,_0x42682a);var _0x1b04e8={'where':_0x3930c0[_0x63f0('0x43')]};return db[_0x63f0('0x3d')][_0x63f0('0x25')](_0x1b04e8)[_0x63f0('0x16')](function(_0x4fabcc){_0x54ca51[_0x63f0('0x25')]=_0x4fabcc;if(_0x42682a[_0x63f0('0x44')][_0x63f0('0x45')]){_0x3930c0[_0x63f0('0x46')]=[{'all':!![]}];}if(_0x42682a[_0x63f0('0x44')][_0x63f0('0x47')]==='true'){_0x3930c0[_0x63f0('0x46')]=[{'model':db[_0x63f0('0x48')],'as':_0x63f0('0x47')}];}if(!_[_0x63f0('0x36')](_0x3930c0[_0x63f0('0x49')],'id')){_0x3930c0[_0x63f0('0x49')][_0x63f0('0x4a')]('id');}return db[_0x63f0('0x3d')][_0x63f0('0x4b')](_0x3930c0);})[_0x63f0('0x16')](function(_0x36642c){_0x54ca51['rows']=_0x36642c;if(_0x42682a[_0x63f0('0x44')][_0x63f0('0x4c')]==='true'){var _0x314165=[];for(var _0x507fd=0x0;_0x507fd<_0x54ca51[_0x63f0('0x4d')]['length'];_0x507fd++){_0x314165[_0x63f0('0x4a')](get_open_tabs(_0x63f0('0x4e'),_0x54ca51[_0x63f0('0x4d')][_0x507fd][_0x63f0('0x4f')]));_0x314165[_0x63f0('0x4a')](get_open_tabs(_0x63f0('0x50'),_0x54ca51[_0x63f0('0x4d')][_0x507fd]['dataValues']));_0x314165[_0x63f0('0x4a')](get_open_tabs(_0x63f0('0x51'),_0x54ca51[_0x63f0('0x4d')][_0x507fd][_0x63f0('0x4f')]));_0x314165[_0x63f0('0x4a')](get_open_tabs(_0x63f0('0x52'),_0x54ca51[_0x63f0('0x4d')][_0x507fd]['dataValues']));_0x314165[_0x63f0('0x4a')](get_open_tabs(_0x63f0('0x53'),_0x54ca51[_0x63f0('0x4d')][_0x507fd][_0x63f0('0x4f')]));_0x314165['push'](get_open_tabs(_0x63f0('0x54'),_0x54ca51['rows'][_0x507fd][_0x63f0('0x4f')]));}return Promise[_0x63f0('0x55')](_0x314165)['then'](function(){return _0x54ca51;});}else{return _0x54ca51;}})[_0x63f0('0x16')](respondWithFilteredResult(_0x6d6455,_0x3930c0))[_0x63f0('0x20')](handleError(_0x6d6455,null));};exports[_0x63f0('0x56')]=function(_0x14adf1,_0x23f5b3){var _0x2fc3ad={'raw':![],'where':{'id':_0x14adf1[_0x63f0('0x57')]['id']}},_0x379426={};_0x379426['model']=_[_0x63f0('0x58')](_[_0x63f0('0x59')](db[_0x63f0('0x3d')]['rawAttributes']),[_0x63f0('0x41'),_0x63f0('0x5a')]);_0x379426[_0x63f0('0x44')]=_['keys'](_0x14adf1[_0x63f0('0x44')]);_0x379426[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x379426[_0x63f0('0x5d')],_0x379426[_0x63f0('0x44')]);_0x2fc3ad[_0x63f0('0x49')]=_['intersection'](_0x379426[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x14adf1[_0x63f0('0x44')][_0x63f0('0x5e')]));_0x2fc3ad[_0x63f0('0x49')]=_0x2fc3ad[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x2fc3ad[_0x63f0('0x49')]:_0x379426[_0x63f0('0x5d')];if(_0x14adf1['query'][_0x63f0('0x45')]){_0x2fc3ad[_0x63f0('0x46')]=[{'all':!![]}];}if(_0x14adf1[_0x63f0('0x44')][_0x63f0('0x47')]===_0x63f0('0x60')){_0x2fc3ad[_0x63f0('0x46')]=[{'model':db[_0x63f0('0x48')],'as':_0x63f0('0x47')}];}_0x2fc3ad=_['merge']({},_0x2fc3ad,_0x14adf1['options']);if(!_['includes'](_0x2fc3ad[_0x63f0('0x49')],'id')){_0x2fc3ad['attributes'][_0x63f0('0x4a')]('id');}return db[_0x63f0('0x3d')][_0x63f0('0x38')](_0x2fc3ad)[_0x63f0('0x16')](handleEntityNotFound(_0x23f5b3,null))['then'](function(_0x537c12){var _0x4702ed=[];values=_0x537c12;if(_0x14adf1['query'][_0x63f0('0x4c')]===_0x63f0('0x60')){_0x4702ed[_0x63f0('0x4a')](get_open_tabs('chat',_0x537c12['dataValues']));_0x4702ed[_0x63f0('0x4a')](get_open_tabs('sms',_0x537c12[_0x63f0('0x4f')]));_0x4702ed[_0x63f0('0x4a')](get_open_tabs('openchannel',_0x537c12['dataValues']));_0x4702ed[_0x63f0('0x4a')](get_open_tabs(_0x63f0('0x54'),_0x537c12['dataValues']));_0x4702ed[_0x63f0('0x4a')](get_open_tabs(_0x63f0('0x51'),_0x537c12[_0x63f0('0x4f')]));_0x4702ed['push'](get_open_tabs(_0x63f0('0x52'),_0x537c12[_0x63f0('0x4f')]));return Promise[_0x63f0('0x55')](_0x4702ed);}else{return values;}})[_0x63f0('0x16')](function(){return values;})['then'](respondWithResult(_0x23f5b3,null))['catch'](handleError(_0x23f5b3,null));};exports[_0x63f0('0x27')]=function(_0x391b64,_0x3b7351){if(_0x391b64[_0x63f0('0x61')]['id']){delete _0x391b64['body']['id'];}delete _0x391b64[_0x63f0('0x61')][_0x63f0('0x37')];return db[_0x63f0('0x3d')][_0x63f0('0x38')]({'where':{'id':_0x391b64[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x3b7351,null))[_0x63f0('0x16')](saveUpdates(_0x391b64['body'],null))[_0x63f0('0x16')](respondWithResult(_0x3b7351,null))[_0x63f0('0x20')](handleError(_0x3b7351,null));};exports['describe']=function(_0x56f400,_0x4ca85b){return db[_0x63f0('0x3d')][_0x63f0('0x62')]()[_0x63f0('0x16')](respondWithResult(_0x4ca85b,null))[_0x63f0('0x20')](handleError(_0x4ca85b,null));};exports[_0x63f0('0x63')]=function(_0x175b10,_0x2d9f2d){return db[_0x63f0('0x3d')][_0x63f0('0x38')]({'where':{'id':_0x175b10[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x2d9f2d,null))[_0x63f0('0x16')](function(_0x511308){if(_0x511308){return _0x511308[_0x63f0('0x63')](_0x175b10[_0x63f0('0x61')][_0x63f0('0x64')],_['omit'](_0x175b10[_0x63f0('0x61')],[_0x63f0('0x64'),'id'])||{});}})[_0x63f0('0x16')](respondWithResult(_0x2d9f2d,null))[_0x63f0('0x20')](handleError(_0x2d9f2d,null));};function validateUser(_0x21cbac){return new Promise(function(_0x4709f3,_0x5651fe){if(_0x21cbac[_0x63f0('0x65')])return _0x4709f3(_0x21cbac);return db[_0x63f0('0x66')]['findById'](0x1)[_0x63f0('0x16')](function(_0x2d5653){if(_0x2d5653[_0x63f0('0x67')])authService[_0x63f0('0x68')](_0x21cbac[_0x63f0('0x41')]);db[_0x63f0('0x3d')][_0x63f0('0x69')]('internal')[_0x63f0('0x16')](function(_0x237957){if(_[_0x63f0('0x6a')](_0x237957)){_0x21cbac[_0x63f0('0x65')]=_0x2d5653[_0x63f0('0x6b')]||0x1;return;}if(_[_0x63f0('0x6a')](_0x2d5653[_0x63f0('0x6b')])||_0x2d5653[_0x63f0('0x6b')]===_0x237957){_0x21cbac[_0x63f0('0x65')]=_0x237957+0x1;return;}if(_0x2d5653[_0x63f0('0x6b')]>_0x237957){_0x21cbac[_0x63f0('0x65')]=_0x2d5653[_0x63f0('0x6b')];return;}return db[_0x63f0('0x6c')]['query'](_0x63f0('0x6d'),{'type':db[_0x63f0('0x6c')]['QueryTypes'][_0x63f0('0x6e')]})[_0x63f0('0x16')](function(_0x5ce043){if(_0x5ce043&&_0x5ce043['length']){for(var _0x4c2bc0=0x0,_0x122076=_0x5ce043[_0x63f0('0x5f')];_0x4c2bc0<_0x122076&&_[_0x63f0('0x6a')](_0x21cbac[_0x63f0('0x65')]);_0x4c2bc0++){if(_0x2d5653[_0x63f0('0x6b')]<=_0x5ce043[_0x4c2bc0][_0x63f0('0x6f')]){_0x21cbac[_0x63f0('0x65')]=_0x5ce043[_0x4c2bc0][_0x63f0('0x6f')];}else if(_0x2d5653[_0x63f0('0x6b')]>_0x5ce043[_0x4c2bc0]['from']&&_0x2d5653[_0x63f0('0x6b')]<=_0x5ce043[_0x4c2bc0]['to']){_0x21cbac[_0x63f0('0x65')]=_0x2d5653['min_internal'];}}}if(_[_0x63f0('0x6a')](_0x21cbac['internal'])){_0x21cbac[_0x63f0('0x65')]=_0x237957+0x1;}return _0x4709f3(_0x21cbac);});});})[_0x63f0('0x20')](function(_0x1c8725){_0x5651fe(_0x1c8725);});});}function updateUser(_0xe6a7e9){return new Promise(function(_0x9c46eb,_0x1410c6){try{if(_0xe6a7e9['voicemail']){_0xe6a7e9[_0x63f0('0x70')]=_0xe6a7e9[_0x63f0('0x65')];_0xe6a7e9[_0x63f0('0x71')]={'mailbox':_0xe6a7e9['internal'],'password':_0xe6a7e9[_0x63f0('0x41')],'fullname':_0xe6a7e9[_0x63f0('0x72')],'email':_0xe6a7e9[_0x63f0('0x73')]};}if(_0xe6a7e9['role']==='agent'){if(!_0xe6a7e9['permissions'])_0xe6a7e9[_0x63f0('0x74')]=[_0x63f0('0x75'),_0x63f0('0x76'),'103',_0x63f0('0x77'),_0x63f0('0x78'),_0x63f0('0x79'),_0x63f0('0x7a'),_0x63f0('0x7b'),_0x63f0('0x7c'),_0x63f0('0x7d'),'109',_0x63f0('0x7e'),_0x63f0('0x7f'),'114',_0x63f0('0x80')];}_0x9c46eb(_0xe6a7e9);}catch(_0x29afcd){_0x1410c6(_0x29afcd);}});}exports[_0x63f0('0x81')]=function(_0x58a17c,_0x32f7c9){if(_0x58a17c[_0x63f0('0x2d')][_0x63f0('0x37')]===_0x63f0('0x2f'))throw new Error(_0x63f0('0x82'));if(_0x58a17c[_0x63f0('0x61')][_0x63f0('0x37')]===_0x63f0('0x2d')&&_0x58a17c[_0x63f0('0x2d')]['role']!==_0x63f0('0x83')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x58a17c['body']['role']===_0x63f0('0x83')&&_0x58a17c[_0x63f0('0x2d')][_0x63f0('0x37')]!==_0x63f0('0x83')){throw new Error(_0x63f0('0x84'));}return licenseUtil[_0x63f0('0x85')]([_0x58a17c[_0x63f0('0x61')]])['then'](function(){return validateUser(_0x58a17c[_0x63f0('0x61')]);})[_0x63f0('0x16')](function(_0x38cba5){return updateUser(_0x38cba5)['then'](function(_0x26fc4a){if(_0x26fc4a[_0x63f0('0x37')]===_0x63f0('0x83')){_0x26fc4a[_0x63f0('0x86')]=_0x58a17c[_0x63f0('0x2d')][_0x63f0('0x86')];delete _0x26fc4a[_0x63f0('0x87')];}return _0x26fc4a;});})[_0x63f0('0x16')](function(_0x182bf3){return db[_0x63f0('0x3d')][_0x63f0('0x81')](_0x182bf3,{'include':[{'model':db[_0x63f0('0x71')],'as':'VoiceMail'}]});})[_0x63f0('0x16')](function(_0x336727){if(_0x58a17c[_0x63f0('0x61')][_0x63f0('0x37')]==='user')return _0x336727;if(_0x58a17c[_0x63f0('0x2d')]['role']!=='user')return _0x336727;return db[_0x63f0('0x88')][_0x63f0('0x38')]({'where':{'name':_0x336727[_0x63f0('0x37')]===_0x63f0('0x2f')?_0x63f0('0x2e'):_0x63f0('0x30'),'userProfileId':_0x58a17c[_0x63f0('0x2d')][_0x63f0('0x87')]},'raw':!![]})[_0x63f0('0x16')](function(_0x29d529){if(!_0x29d529||_0x29d529[_0x63f0('0x89')]!=0x0)return _0x336727;return db[_0x63f0('0x39')][_0x63f0('0x81')]({'name':_0x336727[_0x63f0('0x3b')],'resourceId':_0x336727['id'],'type':_0x29d529[_0x63f0('0x3b')],'sectionId':_0x29d529['id']},{})['then'](function(){return _0x336727;});})['catch'](function(_0x5a03d0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a03d0);throw _0x5a03d0;});})[_0x63f0('0x16')](respondWithResult(_0x32f7c9,0xc9))['catch'](handleError(_0x32f7c9,null));};exports[_0x63f0('0x8a')]=function(_0x5d87d0,_0x28ec80){var _0x4f615d=_0x5d87d0[_0x63f0('0x61')];var _0x210d82=[];if(_0x5d87d0[_0x63f0('0x2d')][_0x63f0('0x37')]===_0x63f0('0x2f'))throw new Error(_0x63f0('0x82'));if(_[_0x63f0('0x8b')](_0x4f615d,[_0x63f0('0x37'),_0x63f0('0x2d')])&&_0x5d87d0[_0x63f0('0x2d')][_0x63f0('0x37')]!==_0x63f0('0x83')){throw new Error(_0x63f0('0x8c'));}if(_['some'](_0x4f615d,[_0x63f0('0x37'),_0x63f0('0x83')])&&_0x5d87d0['user']['role']!==_0x63f0('0x83')){throw new Error(_0x63f0('0x8d'));}return licenseUtil[_0x63f0('0x85')](_0x4f615d)[_0x63f0('0x16')](function(){return validateUser(_0x4f615d[0x0]);})['then'](function(){for(var _0x2eccb2=0x1;_0x2eccb2<_0x4f615d['length'];_0x2eccb2++){var _0x46bd7e=_0x4f615d[_0x2eccb2-0x1][_0x63f0('0x65')];if(!_0x4f615d[_0x2eccb2][_0x63f0('0x65')])_0x4f615d[_0x2eccb2]['internal']=_0x46bd7e+0x1;_0x210d82[_0x63f0('0x4a')](validateUser(_0x4f615d[_0x2eccb2]));}return Promise[_0x63f0('0x55')](_0x210d82);})[_0x63f0('0x16')](function(){_0x210d82=[];for(var _0x4c12cb=0x0;_0x4c12cb<_0x4f615d[_0x63f0('0x5f')];_0x4c12cb++){_0x210d82['push'](updateUser(_0x4f615d[_0x4c12cb]));}return Promise[_0x63f0('0x55')](_0x210d82);})[_0x63f0('0x16')](function(){_0x210d82=_0x4f615d[_0x63f0('0x34')](function(_0x45c60c){return db[_0x63f0('0x3d')][_0x63f0('0x81')](_0x45c60c,{'include':[{'model':db[_0x63f0('0x71')],'as':_0x63f0('0x71')}]})['then'](function(_0x16b484){_0x45c60c['id']=_0x16b484['id'];return _0x45c60c;});});return Promise[_0x63f0('0x55')](_0x210d82);})[_0x63f0('0x16')](function(_0x31cc64){if(_0x5d87d0[_0x63f0('0x61')]['role']===_0x63f0('0x2d'))return _0x31cc64;if(_0x5d87d0['user'][_0x63f0('0x37')]!==_0x63f0('0x2d'))return _0x31cc64;var _0x28816a=_[_0x63f0('0x8b')](_0x31cc64,function(_0x3a31b7){return _0x3a31b7[_0x63f0('0x37')]===_0x63f0('0x2f')||_0x3a31b7[_0x63f0('0x37')]==='telephone';});if(!_0x28816a)return _0x31cc64;return db[_0x63f0('0x88')][_0x63f0('0x4b')]({'where':{'name':{'$or':[_0x63f0('0x2e'),_0x63f0('0x30')]},'userProfileId':_0x5d87d0[_0x63f0('0x2d')]['userProfileId']},'raw':!![]})[_0x63f0('0x16')](function(_0xb2afc1){if(_[_0x63f0('0x8e')](_0xb2afc1)||!_[_0x63f0('0x8b')](_0xb2afc1,[_0x63f0('0x89'),0x0]))return _0x31cc64;_0x210d82=[];var _0x31c695=_(_0xb2afc1)[_0x63f0('0x34')](function(_0x39798c){if(_0x39798c[_0x63f0('0x89')]===0x1)return;return _0x39798c['name']===_0x63f0('0x2e')?'agent':'telephone';})['compact']()[_0x63f0('0x35')]();for(var _0x1f2b13=0x0;_0x1f2b13<_0x31cc64['length'];_0x1f2b13++){if(!_[_0x63f0('0x36')](_0x31c695,_0x31cc64[_0x1f2b13][_0x63f0('0x37')]))return;var _0x5d0775=_0x31cc64[_0x1f2b13][_0x63f0('0x37')]===_0x63f0('0x2f')?_0x63f0('0x2e'):_0x63f0('0x30');_0x210d82['push'](db['UserProfileResource'][_0x63f0('0x81')]({'name':_0x31cc64[_0x1f2b13]['name'],'resourceId':_0x31cc64[_0x1f2b13]['id'],'type':_0x5d0775,'sectionId':_['find'](_0xb2afc1,[_0x63f0('0x3b'),_0x5d0775])['id']},{}));}return Promise['all'](_0x210d82);});})[_0x63f0('0x16')](respondWithResult(_0x28ec80,0xc9))['catch'](handleError(_0x28ec80,null));};exports[_0x63f0('0x8f')]=function(_0x2f7044,_0x4f44f5){if(_0x2f7044[_0x63f0('0x61')]['id']){delete _0x2f7044[_0x63f0('0x61')]['id'];}return db[_0x63f0('0x3d')]['find']({'where':{'id':_0x2f7044['params']['id']}})[_0x63f0('0x16')](function(_0x2b1edc){if(!_0x2b1edc)return null;if(_0x2b1edc['id']===_0x2f7044['user']['id']){if(!_0x2f7044[_0x63f0('0x61')][_0x63f0('0x90')]||!_0x2f7044[_0x63f0('0x61')][_0x63f0('0x91')]){throw new db[(_0x63f0('0x92'))][(_0x63f0('0x93'))](_0x63f0('0x94'));}if(!_0x2b1edc[_0x63f0('0x95')](_0x2f7044[_0x63f0('0x61')][_0x63f0('0x90')])){throw new db[(_0x63f0('0x92'))][(_0x63f0('0x93'))](_0x63f0('0x96'));}if(_0x2f7044[_0x63f0('0x61')][_0x63f0('0x90')]===_0x2f7044[_0x63f0('0x61')][_0x63f0('0x91')]){throw new db[(_0x63f0('0x92'))]['ValidationError'](_0x63f0('0x97'));}}else if(_0x2f7044[_0x63f0('0x2d')][_0x63f0('0x37')]===_0x63f0('0x83')){if(!_0x2f7044[_0x63f0('0x61')]['newPassword']){throw new db[(_0x63f0('0x92'))][(_0x63f0('0x93'))](_0x63f0('0x98'));}}else if(_0x2f7044['user'][_0x63f0('0x37')]==='user'){if(!_0x2f7044[_0x63f0('0x61')][_0x63f0('0x91')]){throw new db[(_0x63f0('0x92'))][(_0x63f0('0x93'))](_0x63f0('0x98'));}if(_0x2b1edc[_0x63f0('0x37')]!==_0x63f0('0x2f')){throw new db[(_0x63f0('0x92'))]['ValidationError']('Unauthorized');}}else{throw new db[(_0x63f0('0x92'))]['ValidationError'](_0x63f0('0x82'));}return _0x2b1edc;})['then'](handleEntityNotFound(_0x4f44f5,null))[_0x63f0('0x16')](function(_0x416eb4){return db[_0x63f0('0x66')]['findOne']({'attributes':['id',_0x63f0('0x67'),_0x63f0('0x99'),'passwordHistoryLimit']})[_0x63f0('0x16')](function(_0x48beba){if(_0x48beba[_0x63f0('0x67')])authService[_0x63f0('0x68')](_0x2f7044[_0x63f0('0x61')]['newPassword']);if(!_0x48beba[_0x63f0('0x99')]||!_0x416eb4[_0x63f0('0x9a')])return _0x416eb4;authService[_0x63f0('0x9b')](_0x2f7044[_0x63f0('0x61')][_0x63f0('0x91')],_0x416eb4['previousPasswords'],_0x48beba[_0x63f0('0x9c')]);return _0x416eb4;})['then'](saveUpdates({'password':_0x2f7044[_0x63f0('0x61')][_0x63f0('0x91')],'passwordResetAt':_0x2f7044['user']['id']==_0x2f7044[_0x63f0('0x57')]['id']?moment():null,'previousPasswords':authService[_0x63f0('0x9d')](_0x2f7044[_0x63f0('0x61')][_0x63f0('0x91')],_0x416eb4[_0x63f0('0x9a')])},null));})[_0x63f0('0x16')](respondWithResult(_0x4f44f5,null))['catch'](handleError(_0x4f44f5,null));};exports[_0x63f0('0x9e')]=function(_0x45c84d,_0x5d0b1f){var _0x20d943=_0x45c84d[_0x63f0('0x61')]['channel'];return db['User'][_0x63f0('0x38')]({'where':{'id':_0x45c84d[_0x63f0('0x57')]['id']},'attributes':['id',_0x63f0('0x3b'),_0x63f0('0x37'),_0x63f0('0x9f'),'loginInPause',_0x63f0('0xa0'),_0x63f0('0xa1')]})['then'](handleEntityNotFound(_0x5d0b1f,null))[_0x63f0('0x16')](function(_0x275571){if(_0x275571){if(!utils[_0x63f0('0xa2')](_0x20d943)){throw new db[(_0x63f0('0x92'))][(_0x63f0('0x93'))](_0x63f0('0xa3'));}return _0x275571[_0x63f0('0xa4')+_[_0x63f0('0xa5')](_0x20d943['toLowerCase']())+_0x63f0('0xa6')](_0x45c84d[_0x63f0('0x61')][_0x63f0('0x64')],{'penalty':_0x45c84d[_0x63f0('0x61')][_0x63f0('0xa7')]||0x0})[_0x63f0('0xa8')](function(_0x5cab28){for(var _0x276272=0x0;_0x276272<_0x45c84d[_0x63f0('0x61')]['ids']['length'];_0x276272+=0x1){var _0x554f9f={'UserId':Number(_0x45c84d[_0x63f0('0x57')]['id'])};_0x554f9f[_[_0x63f0('0xa5')](_0x20d943[_0x63f0('0xa9')]())+_0x63f0('0xaa')]=Number(_0x45c84d[_0x63f0('0x61')][_0x63f0('0x64')][_0x276272]);socket[_0x63f0('0x28')](_0x63f0('0x2d')+_[_0x63f0('0xa5')](_0x20d943['toLowerCase']())+'Queue:save',_0x554f9f);}return _0x5cab28;})[_0x63f0('0x16')](function(){if(_0x20d943==='voice'){return db['VoiceQueue'][_0x63f0('0x4b')]({'where':{'id':_0x45c84d[_0x63f0('0x61')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x53bc0f){var _0x181bee=_0x275571['get']({'plain':!![]});var _0x30fec6=[];if(_0x20d943===_0x63f0('0xab')&&_0x181bee[_0x63f0('0x37')]===_0x63f0('0x2f')&&_0x181bee[_0x63f0('0x9f')]){for(let _0x1c5754=0x0;_0x1c5754<_0x53bc0f['length'];_0x1c5754+=0x1){_0x30fec6['push']({'membername':_0x181bee[_0x63f0('0x3b')],'UserId':_0x181bee['id'],'queue_name':_0x53bc0f[_0x1c5754][_0x63f0('0x3b')],'VoiceQueueId':_0x53bc0f[_0x1c5754]['id'],'interface':_[_0x63f0('0x6a')](_0x181bee[_0x63f0('0xa1')])?util['format'](_0x63f0('0xac'),_0x181bee[_0x63f0('0x3b')]):_0x181bee['interface'],'paused':_0x181bee[_0x63f0('0xa0')]||![],'penalty':_0x45c84d[_0x63f0('0x61')][_0x63f0('0xa7')]||0x0});}return Promise['all'](_0x30fec6['map'](function(_0xbe36d9){return db[_0x63f0('0xad')]['upsert'](_0xbe36d9);}));}return _0x275571;});}})[_0x63f0('0x16')](respondWithStatusCode(_0x5d0b1f,null))[_0x63f0('0x20')](handleError(_0x5d0b1f,null));};exports[_0x63f0('0xae')]=function(_0x8da647,_0x48224c){var _0x124b90,_0x167f8f;return db[_0x63f0('0x3d')]['find']({'where':{'id':_0x8da647[_0x63f0('0x57')]['id']},'attributes':['id',_0x63f0('0x3b'),_0x63f0('0x37')]})[_0x63f0('0x16')](handleEntityNotFound(_0x48224c,null))[_0x63f0('0x16')](function(_0x4a3efa){if(_0x4a3efa){_0x124b90=_0x4a3efa;if(!_0x8da647['query'][_0x63f0('0xaf')]||!utils[_0x63f0('0xa2')](_0x8da647[_0x63f0('0x44')][_0x63f0('0xaf')])){throw new db['Sequelize'][(_0x63f0('0x93'))](_0x63f0('0xa3'));}return _0x4a3efa[_0x63f0('0xb0')+_[_0x63f0('0xa5')](_0x8da647[_0x63f0('0x44')][_0x63f0('0xaf')]['toLowerCase']())+_0x63f0('0xa6')](_0x8da647[_0x63f0('0x44')][_0x63f0('0x64')]);}})[_0x63f0('0x16')](function(_0x41015a){if(_[_0x63f0('0xb1')](_0x8da647[_0x63f0('0x44')][_0x63f0('0x64')])){for(var _0x13e678=0x0;_0x13e678<_0x8da647['query'][_0x63f0('0x64')][_0x63f0('0x5f')];_0x13e678+=0x1){_0x167f8f={'UserId':Number(_0x8da647[_0x63f0('0x57')]['id'])};_0x167f8f[_[_0x63f0('0xa5')](_0x8da647['query']['channel'][_0x63f0('0xa9')]())+_0x63f0('0xaa')]=Number(_0x8da647[_0x63f0('0x44')][_0x63f0('0x64')][_0x13e678]);socket['emit'](_0x63f0('0x2d')+_[_0x63f0('0xa5')](_0x8da647[_0x63f0('0x44')]['channel']['toLowerCase']())+_0x63f0('0xb2'),_0x167f8f);}}else{_0x167f8f={'UserId':Number(_0x8da647[_0x63f0('0x57')]['id'])};_0x167f8f[_[_0x63f0('0xa5')](_0x8da647[_0x63f0('0x44')][_0x63f0('0xaf')][_0x63f0('0xa9')]())+_0x63f0('0xaa')]=Number(_0x8da647['query'][_0x63f0('0x64')]);socket['emit'](_0x63f0('0x2d')+_[_0x63f0('0xa5')](_0x8da647[_0x63f0('0x44')][_0x63f0('0xaf')]['toLowerCase']())+'Queue:remove',_0x167f8f);}return _0x41015a;})['then'](function(){if(_0x8da647[_0x63f0('0x44')][_0x63f0('0xaf')]===_0x63f0('0xab')){return db['UserVoiceQueueRt'][_0x63f0('0x2a')]({'where':{'UserId':_0x8da647[_0x63f0('0x57')]['id'],'VoiceQueueId':_0x8da647['query']['ids']},'individualHooks':!![]})[_0x63f0('0x16')](function(){return _0x124b90;});}return _0x124b90;})[_0x63f0('0x16')](respondWithStatusCode(_0x48224c,null))[_0x63f0('0x20')](handleError(_0x48224c,null));};exports[_0x63f0('0xb3')]=function(_0x5d7186,_0x3d8a2f){_0x5d7186[_0x63f0('0x61')]['userpic']=_0x5d7186[_0x63f0('0xb4')][_0x63f0('0xb5')];return db[_0x63f0('0x3d')][_0x63f0('0x38')]({'where':{'id':_0x5d7186['params']['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x3d8a2f,null))[_0x63f0('0x16')](saveUpdates(_0x5d7186['body'],null))[_0x63f0('0x16')](respondWithResult(_0x3d8a2f,null))[_0x63f0('0x20')](handleError(_0x3d8a2f,null));};exports[_0x63f0('0xb6')]=function(_0x42603f,_0x8829d7){var _0x10dc06=path[_0x63f0('0xb7')](config[_0x63f0('0xb8')],_0x63f0('0xb9'));return db['User'][_0x63f0('0x38')]({'where':{'id':_0x42603f[_0x63f0('0x57')]['id']},'attributes':['id',_0x63f0('0xba')],'raw':!![]})['then'](handleEntityNotFound(_0x8829d7,null))[_0x63f0('0x16')](function(_0x5e376a){if(_0x5e376a){if(_[_0x63f0('0x6a')](_0x5e376a['userpic'])){return _0x8829d7['download'](_0x10dc06);}else{if(!fs['existsSync'](path[_0x63f0('0xb7')](config[_0x63f0('0xb8')],_0x63f0('0xbb'),_0x5e376a['userpic']))){return _0x8829d7[_0x63f0('0xbc')](_0x10dc06);}return _0x8829d7[_0x63f0('0xbc')](path[_0x63f0('0xb7')](config[_0x63f0('0xb8')],_0x63f0('0xbb'),_0x5e376a['userpic']));}}})[_0x63f0('0x20')](handleError(_0x8829d7,null));};exports['getOpenTabs']=function(_0x259c16,_0x57ee9f){return db['User']['find']({'where':{'id':_0x259c16['params']['id']},'attributes':['id']})[_0x63f0('0x16')](handleEntityNotFound(_0x57ee9f,null))[_0x63f0('0x16')](function(_0x3edf83){var _0x183ed1=[];values=_0x3edf83[_0x63f0('0x4f')];_0x183ed1['push'](get_open_tabs(_0x63f0('0x4e'),_0x3edf83['dataValues']));_0x183ed1[_0x63f0('0x4a')](get_open_tabs('sms',_0x3edf83['dataValues']));_0x183ed1[_0x63f0('0x4a')](get_open_tabs(_0x63f0('0x53'),_0x3edf83[_0x63f0('0x4f')]));_0x183ed1[_0x63f0('0x4a')](get_open_tabs('whatsapp',_0x3edf83[_0x63f0('0x4f')]));_0x183ed1[_0x63f0('0x4a')](get_open_tabs(_0x63f0('0x51'),_0x3edf83[_0x63f0('0x4f')]));_0x183ed1['push'](get_open_tabs(_0x63f0('0x52'),_0x3edf83[_0x63f0('0x4f')]));return Promise[_0x63f0('0x55')](_0x183ed1);})[_0x63f0('0x16')](function(_0x3bccd5){if(_0x3bccd5){var _0x462867=_['map'](values[_0x63f0('0xbd')],function(_0x5f534e){return{'channel':'CHAT','id':_0x5f534e['id'],'createdAt':_0x5f534e[_0x63f0('0xbe')]};});var _0x1ad3d0=_[_0x63f0('0x34')](values[_0x63f0('0xbf')],function(_0x330b0d){return{'channel':'FAX','id':_0x330b0d['id'],'createdAt':_0x330b0d[_0x63f0('0xbe')]};});var _0x19e8ea=_[_0x63f0('0x34')](values[_0x63f0('0xc0')],function(_0x1cc6fa){return{'channel':_0x63f0('0xc1'),'id':_0x1cc6fa['id'],'createdAt':_0x1cc6fa['createdAt']};});var _0x2e5602=_[_0x63f0('0x34')](values[_0x63f0('0xc2')],function(_0x5be25b){return{'channel':_0x63f0('0xc3'),'id':_0x5be25b['id'],'createdAt':_0x5be25b[_0x63f0('0xbe')]};});var _0x16d9df=_[_0x63f0('0x34')](values[_0x63f0('0xc4')],function(_0x254869){return{'channel':_0x63f0('0xc5'),'id':_0x254869['id'],'createdAt':_0x254869[_0x63f0('0xbe')]};});var _0x210445=_[_0x63f0('0x34')](values[_0x63f0('0xc6')],function(_0x406cd2){return{'channel':'WHATSAPP','id':_0x406cd2['id'],'createdAt':_0x406cd2[_0x63f0('0xbe')]};});var _0x4875b2=_[_0x63f0('0xc7')](_0x462867,_0x1ad3d0,_0x19e8ea,_0x2e5602,_0x16d9df,_0x210445);var _0x2c1968={'count':_0x4875b2[_0x63f0('0x5f')],'rows':_0x4875b2};return _0x2c1968;}else return null;})[_0x63f0('0x16')](respondWithResult(_0x57ee9f,null))['catch'](handleError(_0x57ee9f,null));};exports[_0x63f0('0xc8')]=function(_0x5e910c,_0x1341a){var _0x3840a9={};var _0x4f798d={};var _0x70fb47;var _0x4d47e7;return db['User'][_0x63f0('0xc9')]({'where':{'id':_0x5e910c['params']['id']}})['then'](handleEntityNotFound(_0x1341a,null))[_0x63f0('0x16')](function(_0x22a651){if(_0x22a651){_0x70fb47=_0x22a651;_0x4f798d[_0x63f0('0x5d')]=_[_0x63f0('0x59')](db[_0x63f0('0xca')][_0x63f0('0x3e')]);_0x4f798d[_0x63f0('0x44')]=_[_0x63f0('0x59')](_0x5e910c[_0x63f0('0x44')]);_0x4f798d[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x4f798d['model'],_0x4f798d[_0x63f0('0x44')]);_0x3840a9[_0x63f0('0x49')]=_[_0x63f0('0x5c')](_0x4f798d[_0x63f0('0x5d')],qs['fields'](_0x5e910c[_0x63f0('0x44')][_0x63f0('0x5e')]));_0x3840a9[_0x63f0('0x49')]=_0x3840a9[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x3840a9[_0x63f0('0x49')]:_0x4f798d[_0x63f0('0x5d')];_0x3840a9['order']=qs[_0x63f0('0xcb')](_0x5e910c['query'][_0x63f0('0xcb')]);_0x3840a9['where']=qs[_0x63f0('0x5b')](_[_0x63f0('0xcc')](_0x5e910c[_0x63f0('0x44')],_0x4f798d['filters']));if(_0x5e910c[_0x63f0('0x44')][_0x63f0('0x32')]){_0x3840a9[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x3840a9[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x3840a9[_0x63f0('0x49')],function(_0x37818a){var _0x2d5d03={};_0x2d5d03[_0x37818a]={'$like':'%'+_0x5e910c[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0x2d5d03;})});}_0x3840a9=_[_0x63f0('0xcd')]({},_0x3840a9,_0x5e910c['options']);return _0x70fb47[_0x63f0('0xc8')](_0x3840a9);}})[_0x63f0('0x16')](function(_0x490807){if(_0x490807){_0x4d47e7=_0x490807['length'];if(_0x5e910c[_0x63f0('0x44')][_0x63f0('0xce')]('includeAll')){_0x3840a9['include']=[{'model':db['CmList'],'as':_0x63f0('0xcf'),'required':![]},{'model':db[_0x63f0('0xd0')],'as':_0x63f0('0xd1'),'attributes':['id',_0x63f0('0x3b'),_0x63f0('0xd2')],'where':_0x5e910c['query'][_0x63f0('0xd3')]?{'id':_0x5e910c[_0x63f0('0x44')]['tag']}:undefined,'required':_0x5e910c[_0x63f0('0x44')]['tag']?!![]:![]}];}if(!_0x5e910c[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x3840a9[_0x63f0('0x24')]=qs[_0x63f0('0x24')](_0x5e910c['query']['limit']);_0x3840a9[_0x63f0('0x23')]=qs[_0x63f0('0x23')](_0x5e910c[_0x63f0('0x44')][_0x63f0('0x23')]);}return _0x70fb47[_0x63f0('0xc8')](_0x3840a9);}})['then'](function(_0x58ad63){if(_0x58ad63){return _0x58ad63?{'count':_0x4d47e7,'rows':_0x58ad63}:null;}})[_0x63f0('0x16')](respondWithResult(_0x1341a,null))[_0x63f0('0x20')](handleError(_0x1341a,null));};exports[_0x63f0('0xd5')]=function(_0x452ce7,_0x1c1736){var _0x1a4bc0;var _0x2ca0eb={};var _0x57594c;return db[_0x63f0('0x3d')][_0x63f0('0xc9')]({'where':{'id':_0x452ce7['params']['id']},'attributes':['id',_0x63f0('0x3b'),_0x63f0('0x37')]})[_0x63f0('0x16')](handleEntityNotFound(_0x1c1736,null))[_0x63f0('0x16')](function(_0x96e131){if(!utils[_0x63f0('0xa2')](_0x452ce7[_0x63f0('0x44')]['channel'])){throw new db[(_0x63f0('0x92'))][(_0x63f0('0x93'))]('Unknown\x20channel');}_0x1a4bc0=_0x96e131;var _0x3c6677={};_0x3c6677[_0x63f0('0x5d')]=_['keys'](db[_[_0x63f0('0xa5')](_0x452ce7[_0x63f0('0x44')][_0x63f0('0xaf')])+'Queue'][_0x63f0('0x3e')]);_0x3c6677['query']=_['keys'](_0x452ce7[_0x63f0('0x44')]);_0x3c6677[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x3c6677[_0x63f0('0x5d')],_0x3c6677[_0x63f0('0x44')]);_0x2ca0eb[_0x63f0('0x49')]=_[_0x63f0('0x5c')](_0x3c6677[_0x63f0('0x5d')],qs['fields'](_0x452ce7['query'][_0x63f0('0x5e')]));_0x2ca0eb[_0x63f0('0x49')]=_0x2ca0eb['attributes']['length']?_0x2ca0eb['attributes']:_0x3c6677[_0x63f0('0x5d')];_0x2ca0eb[_0x63f0('0xd6')]=qs['sort'](_0x452ce7[_0x63f0('0x44')][_0x63f0('0xcb')]);_0x2ca0eb['where']=qs['filters'](_[_0x63f0('0xcc')](_0x452ce7[_0x63f0('0x44')],_0x3c6677[_0x63f0('0x5b')]));if(_0x452ce7[_0x63f0('0x44')]['filter']){_0x2ca0eb[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x2ca0eb[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x2ca0eb[_0x63f0('0x49')],function(_0x361381){var _0x1f57d8={};_0x1f57d8[_0x361381]={'$like':'%'+_0x452ce7[_0x63f0('0x44')]['filter']+'%'};return _0x1f57d8;})});}_0x2ca0eb=_[_0x63f0('0xcd')]({},_0x2ca0eb,_0x452ce7['options']);switch(_0x1a4bc0[_0x63f0('0x37')]){case'admin':return db[_[_0x63f0('0xa5')](_0x452ce7[_0x63f0('0x44')][_0x63f0('0xaf')])+_0x63f0('0xd7')]['findAll'](_0x2ca0eb);case _0x63f0('0x2d'):case _0x63f0('0x2f'):return _0x1a4bc0[_0x63f0('0x2b')+_[_0x63f0('0xa5')](_0x452ce7['query'][_0x63f0('0xaf')])+_0x63f0('0xa6')](_0x2ca0eb);default:throw new db[(_0x63f0('0x92'))][(_0x63f0('0x93'))](_0x63f0('0xd8'));}})[_0x63f0('0x16')](function(_0x15fb46){_0x57594c=_0x15fb46[_0x63f0('0x5f')];if(!_0x452ce7[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x2ca0eb['limit']=qs[_0x63f0('0x24')](_0x452ce7[_0x63f0('0x44')][_0x63f0('0x24')]);_0x2ca0eb[_0x63f0('0x23')]=qs['offset'](_0x452ce7['query'][_0x63f0('0x23')]);}switch(_0x1a4bc0[_0x63f0('0x37')]){case'admin':return db[_['capitalize'](_0x452ce7['query'][_0x63f0('0xaf')])+_0x63f0('0xd7')][_0x63f0('0x4b')](_0x2ca0eb);case _0x63f0('0x2d'):case _0x63f0('0x2f'):return _0x1a4bc0[_0x63f0('0x2b')+_[_0x63f0('0xa5')](_0x452ce7['query'][_0x63f0('0xaf')])+'Queues'](_0x2ca0eb);}})['then'](function(_0x525ca7){return{'count':_0x57594c,'rows':_0x525ca7};})[_0x63f0('0x16')](respondWithResult(_0x1c1736,null))[_0x63f0('0x20')](handleError(_0x1c1736,null));};exports[_0x63f0('0xd9')]=function(_0x23b114,_0x582972){var _0x20ac8b={};var _0x2213b4={};var _0x3af06e;var _0x3684b8;return db[_0x63f0('0x3d')][_0x63f0('0xc9')]({'where':{'id':_0x23b114[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x582972,null))[_0x63f0('0x16')](function(_0x17abc6){if(_0x17abc6){_0x3af06e=_0x17abc6;_0x2213b4[_0x63f0('0x5d')]=_['keys'](db[_0x63f0('0xad')][_0x63f0('0x3e')]);_0x2213b4[_0x63f0('0x44')]=_[_0x63f0('0x59')](_0x23b114['query']);_0x2213b4[_0x63f0('0x5b')]=_['intersection'](_0x2213b4[_0x63f0('0x5d')],_0x2213b4[_0x63f0('0x44')]);_0x20ac8b[_0x63f0('0x49')]=_[_0x63f0('0x5c')](_0x2213b4[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x23b114['query'][_0x63f0('0x5e')]));_0x20ac8b[_0x63f0('0x49')]=_0x20ac8b[_0x63f0('0x49')]['length']?_0x20ac8b['attributes']:_0x2213b4['model'];_0x20ac8b[_0x63f0('0xd6')]=qs[_0x63f0('0xcb')](_0x23b114['query'][_0x63f0('0xcb')]);_0x20ac8b[_0x63f0('0x43')]=qs[_0x63f0('0x5b')](_[_0x63f0('0xcc')](_0x23b114['query'],_0x2213b4[_0x63f0('0x5b')]));if(_0x23b114[_0x63f0('0x44')][_0x63f0('0x32')]){_0x20ac8b['where']=_[_0x63f0('0xcd')](_0x20ac8b[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x20ac8b[_0x63f0('0x49')],function(_0x4ec7a){var _0x2cf2b2={};_0x2cf2b2[_0x4ec7a]={'$like':'%'+_0x23b114[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0x2cf2b2;})});}_0x20ac8b=_[_0x63f0('0xcd')]({},_0x20ac8b,_0x23b114[_0x63f0('0xda')]);return _0x3af06e[_0x63f0('0xd9')](_0x20ac8b);}})[_0x63f0('0x16')](function(_0x277f57){if(_0x277f57){_0x3684b8=_0x277f57[_0x63f0('0x5f')];if(!_0x23b114[_0x63f0('0x44')]['hasOwnProperty'](_0x63f0('0xd4'))){_0x20ac8b[_0x63f0('0x24')]=qs[_0x63f0('0x24')](_0x23b114['query'][_0x63f0('0x24')]);_0x20ac8b['offset']=qs[_0x63f0('0x23')](_0x23b114['query'][_0x63f0('0x23')]);}return _0x3af06e['getVoiceQueuesRt'](_0x20ac8b);}})[_0x63f0('0x16')](function(_0x86a317){if(_0x86a317){return _0x86a317?{'count':_0x3684b8,'rows':_0x86a317}:null;}})['then'](respondWithResult(_0x582972,null))[_0x63f0('0x20')](handleError(_0x582972,null));};exports[_0x63f0('0xdb')]=function(_0x32b235,_0x1031c7){var _0x200075={};var _0x4b5d11={};var _0x566a5c;var _0x7ed43b;return db['User']['findOne']({'where':{'id':_0x32b235[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x1031c7,null))[_0x63f0('0x16')](function(_0x3a8c2b){if(_0x3a8c2b){_0x566a5c=_0x3a8c2b;_0x4b5d11['model']=_[_0x63f0('0x59')](db[_0x63f0('0xdc')][_0x63f0('0x3e')]);_0x4b5d11[_0x63f0('0x44')]=_['keys'](_0x32b235[_0x63f0('0x44')]);_0x4b5d11[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x4b5d11[_0x63f0('0x5d')],_0x4b5d11[_0x63f0('0x44')]);_0x200075['attributes']=_[_0x63f0('0x5c')](_0x4b5d11[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x32b235[_0x63f0('0x44')][_0x63f0('0x5e')]));_0x200075[_0x63f0('0x49')]=_0x200075[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x200075[_0x63f0('0x49')]:_0x4b5d11[_0x63f0('0x5d')];_0x200075['order']=qs[_0x63f0('0xcb')](_0x32b235[_0x63f0('0x44')][_0x63f0('0xcb')]);_0x200075['where']=qs[_0x63f0('0x5b')](_['pick'](_0x32b235[_0x63f0('0x44')],_0x4b5d11['filters']));if(_0x32b235[_0x63f0('0x44')][_0x63f0('0x32')]){_0x200075[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x200075[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x200075[_0x63f0('0x49')],function(_0x392bde){var _0x1a0bdf={};_0x1a0bdf[_0x392bde]={'$like':'%'+_0x32b235['query'][_0x63f0('0x32')]+'%'};return _0x1a0bdf;})});}_0x200075=_[_0x63f0('0xcd')]({},_0x200075,_0x32b235[_0x63f0('0xda')]);return _0x566a5c[_0x63f0('0xdb')](_0x200075);}})[_0x63f0('0x16')](function(_0x10d222){if(_0x10d222){_0x7ed43b=_0x10d222[_0x63f0('0x5f')];if(!_0x32b235[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x200075[_0x63f0('0x24')]=qs[_0x63f0('0x24')](_0x32b235[_0x63f0('0x44')][_0x63f0('0x24')]);_0x200075['offset']=qs[_0x63f0('0x23')](_0x32b235[_0x63f0('0x44')][_0x63f0('0x23')]);}return _0x566a5c[_0x63f0('0xdb')](_0x200075);}})['then'](function(_0x434037){if(_0x434037){return _0x434037?{'count':_0x7ed43b,'rows':_0x434037}:null;}})['then'](respondWithResult(_0x1031c7,null))['catch'](handleError(_0x1031c7,null));};exports[_0x63f0('0xdd')]=function(_0x24bed6,_0x201928){var _0x2448b3={'raw':!![],'where':{}};var _0x6fa2f8={};var _0x29bbdc={'count':0x0,'rows':[]};return db[_0x63f0('0x3d')]['findOne']({'where':{'id':_0x24bed6['params']['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x201928,null))[_0x63f0('0x16')](function(_0x3017a9){if(_0x3017a9){_0x6fa2f8[_0x63f0('0x5d')]=_[_0x63f0('0x59')](db['VoiceRecording'][_0x63f0('0x3e')]);_0x6fa2f8['query']=_[_0x63f0('0x59')](_0x24bed6['query']);_0x6fa2f8['filters']=_[_0x63f0('0x5c')](_0x6fa2f8[_0x63f0('0x5d')],_0x6fa2f8[_0x63f0('0x44')]);_0x2448b3[_0x63f0('0x49')]=_['intersection'](_0x6fa2f8[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x24bed6[_0x63f0('0x44')][_0x63f0('0x5e')]));_0x2448b3[_0x63f0('0x49')]=_0x2448b3[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x2448b3[_0x63f0('0x49')]:_0x6fa2f8[_0x63f0('0x5d')];if(!_0x24bed6['query']['hasOwnProperty'](_0x63f0('0xd4'))){_0x2448b3[_0x63f0('0x24')]=qs[_0x63f0('0x24')](_0x24bed6[_0x63f0('0x44')][_0x63f0('0x24')]);_0x2448b3['offset']=qs['offset'](_0x24bed6[_0x63f0('0x44')][_0x63f0('0x23')]);}_0x2448b3[_0x63f0('0xd6')]=qs[_0x63f0('0xcb')](_0x24bed6[_0x63f0('0x44')]['sort']);_0x2448b3['where']=qs[_0x63f0('0x5b')](_['pick'](_0x24bed6['query'],_0x6fa2f8[_0x63f0('0x5b')]));_0x2448b3[_0x63f0('0x43')][_0x63f0('0xde')]=_0x3017a9['id'];if(_0x24bed6[_0x63f0('0x44')][_0x63f0('0x32')]){_0x2448b3[_0x63f0('0x43')]=_['merge'](_0x2448b3[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x2448b3['attributes'],function(_0x564450){var _0x5b8165={};_0x5b8165[_0x564450]={'$like':'%'+_0x24bed6[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0x5b8165;})});}_0x2448b3=_[_0x63f0('0xcd')]({},_0x2448b3,_0x24bed6['options']);return db['VoiceRecording'][_0x63f0('0x25')]({'where':_0x2448b3['where']})[_0x63f0('0x16')](function(_0x159b2c){_0x29bbdc['count']=_0x159b2c;if(_0x24bed6['query'][_0x63f0('0x45')]){_0x2448b3[_0x63f0('0x46')]=[{'all':!![]}];}return db[_0x63f0('0xdf')][_0x63f0('0x4b')](_0x2448b3);})['then'](function(_0x56149e){_0x29bbdc['rows']=_0x56149e;return _0x29bbdc;});}})[_0x63f0('0x16')](respondWithFilteredResult(_0x201928,_0x2448b3))[_0x63f0('0x20')](handleError(_0x201928,null));};exports[_0x63f0('0xe0')]=function(_0x483a02,_0x343c40){var _0x31d07b={'raw':!![],'where':{}};var _0x5524a3={};var _0x22c542={'count':0x0,'rows':[]};return db[_0x63f0('0x3d')][_0x63f0('0xc9')]({'where':{'id':_0x483a02[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x343c40,null))[_0x63f0('0x16')](function(_0x46ccd0){if(_0x46ccd0){_0x5524a3[_0x63f0('0x5d')]=_[_0x63f0('0x59')](db[_0x63f0('0xe1')]['rawAttributes']);_0x5524a3[_0x63f0('0x44')]=_[_0x63f0('0x59')](_0x483a02['query']);_0x5524a3[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x5524a3[_0x63f0('0x5d')],_0x5524a3[_0x63f0('0x44')]);_0x31d07b[_0x63f0('0x49')]=_[_0x63f0('0x5c')](_0x5524a3[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x483a02[_0x63f0('0x44')][_0x63f0('0x5e')]));_0x31d07b[_0x63f0('0x49')]=_0x31d07b['attributes'][_0x63f0('0x5f')]?_0x31d07b[_0x63f0('0x49')]:_0x5524a3[_0x63f0('0x5d')];if(!_0x483a02[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x31d07b[_0x63f0('0x24')]=qs[_0x63f0('0x24')](_0x483a02[_0x63f0('0x44')][_0x63f0('0x24')]);_0x31d07b[_0x63f0('0x23')]=qs[_0x63f0('0x23')](_0x483a02[_0x63f0('0x44')][_0x63f0('0x23')]);}_0x31d07b[_0x63f0('0xd6')]=qs[_0x63f0('0xcb')](_0x483a02[_0x63f0('0x44')]['sort']);_0x31d07b[_0x63f0('0x43')]=qs['filters'](_[_0x63f0('0xcc')](_0x483a02['query'],_0x5524a3[_0x63f0('0x5b')]));_0x31d07b[_0x63f0('0x43')][_0x63f0('0xde')]=_0x46ccd0['id'];if(_0x483a02['query'][_0x63f0('0x32')]){_0x31d07b[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x31d07b[_0x63f0('0x43')],{'$or':_['map'](_0x31d07b['attributes'],function(_0x130786){var _0x2b6893={};_0x2b6893[_0x130786]={'$like':'%'+_0x483a02[_0x63f0('0x44')]['filter']+'%'};return _0x2b6893;})});}_0x31d07b=_[_0x63f0('0xcd')]({},_0x31d07b,_0x483a02[_0x63f0('0xda')]);return db[_0x63f0('0xe1')][_0x63f0('0x25')]({'where':_0x31d07b['where']})['then'](function(_0x32aac7){_0x22c542[_0x63f0('0x25')]=_0x32aac7;if(_0x483a02[_0x63f0('0x44')]['includeAll']){_0x31d07b['include']=[{'all':!![]}];}return db['ScreenRecording'][_0x63f0('0x4b')](_0x31d07b);})[_0x63f0('0x16')](function(_0x1db77e){_0x22c542[_0x63f0('0x4d')]=_0x1db77e;return _0x22c542;});}})[_0x63f0('0x16')](respondWithFilteredResult(_0x343c40,_0x31d07b))[_0x63f0('0x20')](handleError(_0x343c40,null));};exports[_0x63f0('0xe2')]=function(_0x97d009,_0x4a2d52){var _0x5d2f2f={};var _0x40d35e={};var _0x4a4adc;var _0x46b1dc;return db['User'][_0x63f0('0xc9')]({'where':{'id':_0x97d009[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x4a2d52,null))[_0x63f0('0x16')](function(_0x4836ae){if(_0x4836ae){_0x4a4adc=_0x4836ae;_0x40d35e[_0x63f0('0x5d')]=_['keys'](db['ChatInteraction'][_0x63f0('0x3e')]);_0x40d35e['query']=_[_0x63f0('0x59')](_0x97d009['query']);_0x40d35e[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x40d35e['model'],_0x40d35e[_0x63f0('0x44')]);_0x5d2f2f[_0x63f0('0x49')]=_[_0x63f0('0x5c')](_0x40d35e[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x97d009[_0x63f0('0x44')][_0x63f0('0x5e')]));_0x5d2f2f[_0x63f0('0x49')]=_0x5d2f2f[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x5d2f2f[_0x63f0('0x49')]:_0x40d35e['model'];_0x5d2f2f[_0x63f0('0xd6')]=qs[_0x63f0('0xcb')](_0x97d009[_0x63f0('0x44')]['sort']);_0x5d2f2f[_0x63f0('0x43')]=qs[_0x63f0('0x5b')](_['pick'](_0x97d009['query'],_0x40d35e[_0x63f0('0x5b')]));if(_0x97d009[_0x63f0('0x44')][_0x63f0('0x32')]){_0x5d2f2f[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x5d2f2f[_0x63f0('0x43')],{'$or':_['map'](_0x5d2f2f[_0x63f0('0x49')],function(_0x422194){var _0x3b4741={};_0x3b4741[_0x422194]={'$like':'%'+_0x97d009[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0x3b4741;})});}_0x5d2f2f=_[_0x63f0('0xcd')]({},_0x5d2f2f,_0x97d009['options']);return _0x4a4adc[_0x63f0('0xe2')](_0x5d2f2f);}})['then'](function(_0x1435b8){if(_0x1435b8){_0x46b1dc=_0x1435b8[_0x63f0('0x5f')];if(!_0x97d009[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x5d2f2f[_0x63f0('0x24')]=qs[_0x63f0('0x24')](_0x97d009[_0x63f0('0x44')][_0x63f0('0x24')]);_0x5d2f2f['offset']=qs[_0x63f0('0x23')](_0x97d009[_0x63f0('0x44')]['offset']);}return _0x4a4adc[_0x63f0('0xe2')](_0x5d2f2f);}})[_0x63f0('0x16')](function(_0xf04285){if(_0xf04285){return _0xf04285?{'count':_0x46b1dc,'rows':_0xf04285}:null;}})['then'](respondWithResult(_0x4a2d52,null))[_0x63f0('0x20')](handleError(_0x4a2d52,null));};exports[_0x63f0('0xe3')]=function(_0x5b8475,_0x15ae34){var _0x19f1c9={};var _0x1d57f3={};var _0x1c5795;var _0x39d3d9;return db['User'][_0x63f0('0xc9')]({'where':{'id':_0x5b8475[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x15ae34,null))[_0x63f0('0x16')](function(_0x402465){if(_0x402465){_0x1c5795=_0x402465;_0x1d57f3[_0x63f0('0x5d')]=_[_0x63f0('0x59')](db[_0x63f0('0xe4')][_0x63f0('0x3e')]);_0x1d57f3['query']=_['keys'](_0x5b8475[_0x63f0('0x44')]);_0x1d57f3[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x1d57f3[_0x63f0('0x5d')],_0x1d57f3[_0x63f0('0x44')]);_0x19f1c9[_0x63f0('0x49')]=_[_0x63f0('0x5c')](_0x1d57f3[_0x63f0('0x5d')],qs['fields'](_0x5b8475[_0x63f0('0x44')]['fields']));_0x19f1c9[_0x63f0('0x49')]=_0x19f1c9[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x19f1c9[_0x63f0('0x49')]:_0x1d57f3[_0x63f0('0x5d')];_0x19f1c9['order']=qs[_0x63f0('0xcb')](_0x5b8475[_0x63f0('0x44')][_0x63f0('0xcb')]);_0x19f1c9[_0x63f0('0x43')]=qs[_0x63f0('0x5b')](_['pick'](_0x5b8475[_0x63f0('0x44')],_0x1d57f3[_0x63f0('0x5b')]));if(_0x5b8475[_0x63f0('0x44')][_0x63f0('0x32')]){_0x19f1c9[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x19f1c9[_0x63f0('0x43')],{'$or':_['map'](_0x19f1c9[_0x63f0('0x49')],function(_0x2c829c){var _0x1d58de={};_0x1d58de[_0x2c829c]={'$like':'%'+_0x5b8475[_0x63f0('0x44')]['filter']+'%'};return _0x1d58de;})});}_0x19f1c9=_[_0x63f0('0xcd')]({},_0x19f1c9,_0x5b8475[_0x63f0('0xda')]);return _0x1c5795[_0x63f0('0xe3')](_0x19f1c9);}})[_0x63f0('0x16')](function(_0x2c9e9c){if(_0x2c9e9c){_0x39d3d9=_0x2c9e9c[_0x63f0('0x5f')];if(!_0x5b8475[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x19f1c9[_0x63f0('0x24')]=qs[_0x63f0('0x24')](_0x5b8475[_0x63f0('0x44')]['limit']);_0x19f1c9[_0x63f0('0x23')]=qs[_0x63f0('0x23')](_0x5b8475[_0x63f0('0x44')][_0x63f0('0x23')]);}return _0x1c5795[_0x63f0('0xe3')](_0x19f1c9);}})['then'](function(_0x314264){if(_0x314264){return _0x314264?{'count':_0x39d3d9,'rows':_0x314264}:null;}})[_0x63f0('0x16')](respondWithResult(_0x15ae34,null))['catch'](handleError(_0x15ae34,null));};exports[_0x63f0('0xe5')]=function(_0x5a1b9f,_0x3a4d77){var _0x3df7b2={'raw':!![],'where':{}};var _0x2c9113={};var _0x560c07={'count':0x0,'rows':[]};return db[_0x63f0('0x3d')][_0x63f0('0xc9')]({'where':{'id':_0x5a1b9f[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x3a4d77,null))[_0x63f0('0x16')](function(_0x43e370){if(_0x43e370){_0x2c9113[_0x63f0('0x5d')]=_['keys'](db['MailInteraction'][_0x63f0('0x3e')]);_0x2c9113['query']=_['keys'](_0x5a1b9f[_0x63f0('0x44')]);_0x2c9113[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x2c9113[_0x63f0('0x5d')],_0x2c9113['query']);_0x3df7b2[_0x63f0('0x49')]=_[_0x63f0('0x5c')](_0x2c9113[_0x63f0('0x5d')],qs['fields'](_0x5a1b9f[_0x63f0('0x44')]['fields']));_0x3df7b2[_0x63f0('0x49')]=_0x3df7b2[_0x63f0('0x49')]['length']?_0x3df7b2[_0x63f0('0x49')]:_0x2c9113[_0x63f0('0x5d')];if(!_0x5a1b9f[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x3df7b2[_0x63f0('0x24')]=qs['limit'](_0x5a1b9f['query'][_0x63f0('0x24')]);_0x3df7b2[_0x63f0('0x23')]=qs[_0x63f0('0x23')](_0x5a1b9f[_0x63f0('0x44')][_0x63f0('0x23')]);}_0x3df7b2['order']=qs[_0x63f0('0xcb')](_0x5a1b9f[_0x63f0('0x44')][_0x63f0('0xcb')]);_0x3df7b2[_0x63f0('0x43')]=qs[_0x63f0('0x5b')](_[_0x63f0('0xcc')](_0x5a1b9f[_0x63f0('0x44')],_0x2c9113[_0x63f0('0x5b')]));_0x3df7b2['where']['UserId']=_0x43e370['id'];if(_0x5a1b9f[_0x63f0('0x44')]['filter']){_0x3df7b2['where']=_[_0x63f0('0xcd')](_0x3df7b2[_0x63f0('0x43')],{'$or':_['map'](_0x3df7b2[_0x63f0('0x49')],function(_0x2d628e){var _0xeb8c1d={};_0xeb8c1d[_0x2d628e]={'$like':'%'+_0x5a1b9f[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0xeb8c1d;})});}_0x3df7b2=_[_0x63f0('0xcd')]({},_0x3df7b2,_0x5a1b9f[_0x63f0('0xda')]);return db[_0x63f0('0xe6')][_0x63f0('0x25')]({'where':_0x3df7b2[_0x63f0('0x43')]})[_0x63f0('0x16')](function(_0x4ae4b7){_0x560c07[_0x63f0('0x25')]=_0x4ae4b7;if(_0x5a1b9f['query']['includeAll']){_0x3df7b2[_0x63f0('0x46')]=[{'all':!![]}];}return db['MailInteraction'][_0x63f0('0x4b')](_0x3df7b2);})[_0x63f0('0x16')](function(_0x21da19){_0x560c07[_0x63f0('0x4d')]=_0x21da19;return _0x560c07;});}})[_0x63f0('0x16')](respondWithFilteredResult(_0x3a4d77,_0x3df7b2))['catch'](handleError(_0x3a4d77,null));};exports[_0x63f0('0xe7')]=function(_0x3cf960,_0x84ba41){var _0x4eb36e={};var _0x9f9144={};var _0x5d8b5d;var _0x169c4b;return db[_0x63f0('0x3d')][_0x63f0('0xc9')]({'where':{'id':_0x3cf960['params']['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x84ba41,null))[_0x63f0('0x16')](function(_0x5ea80b){if(_0x5ea80b){_0x5d8b5d=_0x5ea80b;_0x9f9144[_0x63f0('0x5d')]=_[_0x63f0('0x59')](db[_0x63f0('0xe8')][_0x63f0('0x3e')]);_0x9f9144[_0x63f0('0x44')]=_[_0x63f0('0x59')](_0x3cf960[_0x63f0('0x44')]);_0x9f9144['filters']=_[_0x63f0('0x5c')](_0x9f9144[_0x63f0('0x5d')],_0x9f9144[_0x63f0('0x44')]);_0x4eb36e[_0x63f0('0x49')]=_[_0x63f0('0x5c')](_0x9f9144[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x3cf960[_0x63f0('0x44')][_0x63f0('0x5e')]));_0x4eb36e[_0x63f0('0x49')]=_0x4eb36e[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x4eb36e[_0x63f0('0x49')]:_0x9f9144[_0x63f0('0x5d')];_0x4eb36e[_0x63f0('0xd6')]=qs['sort'](_0x3cf960[_0x63f0('0x44')][_0x63f0('0xcb')]);_0x4eb36e[_0x63f0('0x43')]=qs[_0x63f0('0x5b')](_['pick'](_0x3cf960[_0x63f0('0x44')],_0x9f9144[_0x63f0('0x5b')]));if(_0x3cf960[_0x63f0('0x44')]['filter']){_0x4eb36e[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x4eb36e[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x4eb36e[_0x63f0('0x49')],function(_0x1a83bd){var _0x61074c={};_0x61074c[_0x1a83bd]={'$like':'%'+_0x3cf960[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0x61074c;})});}_0x4eb36e=_[_0x63f0('0xcd')]({},_0x4eb36e,_0x3cf960[_0x63f0('0xda')]);return _0x5d8b5d['getSmsInteractions'](_0x4eb36e);}})['then'](function(_0x3e88d9){if(_0x3e88d9){_0x169c4b=_0x3e88d9[_0x63f0('0x5f')];if(!_0x3cf960[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x4eb36e[_0x63f0('0x24')]=qs['limit'](_0x3cf960[_0x63f0('0x44')][_0x63f0('0x24')]);_0x4eb36e[_0x63f0('0x23')]=qs[_0x63f0('0x23')](_0x3cf960[_0x63f0('0x44')][_0x63f0('0x23')]);}return _0x5d8b5d[_0x63f0('0xe7')](_0x4eb36e);}})[_0x63f0('0x16')](function(_0x52f1fa){if(_0x52f1fa){return _0x52f1fa?{'count':_0x169c4b,'rows':_0x52f1fa}:null;}})['then'](respondWithResult(_0x84ba41,null))[_0x63f0('0x20')](handleError(_0x84ba41,null));};exports[_0x63f0('0xe9')]=function(_0x551e05,_0x5e73a6){var _0xde57b1={};var _0xdc07fa={};var _0x28eea9;var _0x1eb7e4;return db[_0x63f0('0x3d')]['findOne']({'where':{'id':_0x551e05[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x5e73a6,null))[_0x63f0('0x16')](function(_0x775bcd){if(_0x775bcd){_0x28eea9=_0x775bcd;_0xdc07fa[_0x63f0('0x5d')]=_['keys'](db['FaxInteraction'][_0x63f0('0x3e')]);_0xdc07fa[_0x63f0('0x44')]=_[_0x63f0('0x59')](_0x551e05[_0x63f0('0x44')]);_0xdc07fa[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0xdc07fa[_0x63f0('0x5d')],_0xdc07fa[_0x63f0('0x44')]);_0xde57b1['attributes']=_[_0x63f0('0x5c')](_0xdc07fa[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x551e05['query'][_0x63f0('0x5e')]));_0xde57b1[_0x63f0('0x49')]=_0xde57b1[_0x63f0('0x49')][_0x63f0('0x5f')]?_0xde57b1[_0x63f0('0x49')]:_0xdc07fa[_0x63f0('0x5d')];_0xde57b1[_0x63f0('0xd6')]=qs[_0x63f0('0xcb')](_0x551e05[_0x63f0('0x44')][_0x63f0('0xcb')]);_0xde57b1['where']=qs['filters'](_[_0x63f0('0xcc')](_0x551e05['query'],_0xdc07fa[_0x63f0('0x5b')]));if(_0x551e05[_0x63f0('0x44')]['filter']){_0xde57b1['where']=_[_0x63f0('0xcd')](_0xde57b1[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0xde57b1[_0x63f0('0x49')],function(_0x4aa044){var _0x4eadcf={};_0x4eadcf[_0x4aa044]={'$like':'%'+_0x551e05[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0x4eadcf;})});}_0xde57b1=_[_0x63f0('0xcd')]({},_0xde57b1,_0x551e05[_0x63f0('0xda')]);return _0x28eea9[_0x63f0('0xe9')](_0xde57b1);}})[_0x63f0('0x16')](function(_0x3f0d26){if(_0x3f0d26){_0x1eb7e4=_0x3f0d26['length'];if(!_0x551e05[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0xde57b1[_0x63f0('0x24')]=qs[_0x63f0('0x24')](_0x551e05['query'][_0x63f0('0x24')]);_0xde57b1[_0x63f0('0x23')]=qs[_0x63f0('0x23')](_0x551e05['query'][_0x63f0('0x23')]);}return _0x28eea9[_0x63f0('0xe9')](_0xde57b1);}})[_0x63f0('0x16')](function(_0x210c9f){if(_0x210c9f){return _0x210c9f?{'count':_0x1eb7e4,'rows':_0x210c9f}:null;}})[_0x63f0('0x16')](respondWithResult(_0x5e73a6,null))[_0x63f0('0x20')](handleError(_0x5e73a6,null));};exports['getWhatsappInteractions']=function(_0x3bbd6a,_0xf80719){var _0x311241={};var _0x50592a={};var _0x18fe6c;var _0x22053a;return db['User'][_0x63f0('0xc9')]({'where':{'id':_0x3bbd6a['params']['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0xf80719,null))[_0x63f0('0x16')](function(_0x42b66d){if(_0x42b66d){_0x18fe6c=_0x42b66d;_0x50592a[_0x63f0('0x5d')]=_[_0x63f0('0x59')](db['WhatsappInteraction'][_0x63f0('0x3e')]);_0x50592a[_0x63f0('0x44')]=_[_0x63f0('0x59')](_0x3bbd6a[_0x63f0('0x44')]);_0x50592a['filters']=_[_0x63f0('0x5c')](_0x50592a[_0x63f0('0x5d')],_0x50592a[_0x63f0('0x44')]);_0x311241['attributes']=_[_0x63f0('0x5c')](_0x50592a[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x3bbd6a[_0x63f0('0x44')]['fields']));_0x311241['attributes']=_0x311241[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x311241['attributes']:_0x50592a[_0x63f0('0x5d')];_0x311241[_0x63f0('0xd6')]=qs[_0x63f0('0xcb')](_0x3bbd6a[_0x63f0('0x44')][_0x63f0('0xcb')]);_0x311241[_0x63f0('0x43')]=qs['filters'](_[_0x63f0('0xcc')](_0x3bbd6a['query'],_0x50592a['filters']));if(_0x3bbd6a[_0x63f0('0x44')][_0x63f0('0x32')]){_0x311241['where']=_[_0x63f0('0xcd')](_0x311241[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x311241[_0x63f0('0x49')],function(_0x2e74c8){var _0x11a322={};_0x11a322[_0x2e74c8]={'$like':'%'+_0x3bbd6a[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0x11a322;})});}_0x311241=_[_0x63f0('0xcd')]({},_0x311241,_0x3bbd6a[_0x63f0('0xda')]);return _0x18fe6c[_0x63f0('0xea')](_0x311241);}})[_0x63f0('0x16')](function(_0x3d8203){if(_0x3d8203){_0x22053a=_0x3d8203[_0x63f0('0x5f')];if(!_0x3bbd6a['query']['hasOwnProperty']('nolimit')){_0x311241['limit']=qs['limit'](_0x3bbd6a[_0x63f0('0x44')][_0x63f0('0x24')]);_0x311241[_0x63f0('0x23')]=qs[_0x63f0('0x23')](_0x3bbd6a[_0x63f0('0x44')][_0x63f0('0x23')]);}return _0x18fe6c[_0x63f0('0xea')](_0x311241);}})[_0x63f0('0x16')](function(_0x48775f){if(_0x48775f){return _0x48775f?{'count':_0x22053a,'rows':_0x48775f}:null;}})[_0x63f0('0x16')](respondWithResult(_0xf80719,null))[_0x63f0('0x20')](handleError(_0xf80719,null));};exports[_0x63f0('0xeb')]=function(_0x19e5ed,_0xefc0f5,_0x115229){var _0x43abe8;var _0x2daabd;var _0x5e0bc6;var _0x552e96=!_[_0x63f0('0x6a')](_0x19e5ed[_0x63f0('0x57')]['id'])?_0x19e5ed['params']['id']:!_[_0x63f0('0x6a')](_0x19e5ed[_0x63f0('0x2d')]['id'])?_0x19e5ed[_0x63f0('0x2d')]['id']:null;return db[_0x63f0('0x3d')][_0x63f0('0x38')]({'where':{'id':_0x552e96,'role':{'$or':['admin','user',_0x63f0('0x2f')]}},'attributes':['id',_0x63f0('0x3b'),_0x63f0('0xec'),_0x63f0('0xed'),_0x63f0('0x37'),_0x63f0('0x65'),_0x63f0('0xee')]})[_0x63f0('0x16')](function(_0x10df13){if(_0x10df13){if(_0x10df13['role']===_0x63f0('0x2f')){_0x43abe8=_0x10df13;if(_0x19e5ed[_0x63f0('0x61')][_0x63f0('0xa1')]){_0x5e0bc6=util['format']('LOCAL/%s@from-sip/n',_0x43abe8[_0x19e5ed['body'][_0x63f0('0xa1')]]);}else if(_0x19e5ed['body'][_0x63f0('0xef')]){_0x5e0bc6=util[_0x63f0('0xf0')](_0x63f0('0xac'),_0x19e5ed[_0x63f0('0x61')][_0x63f0('0xef')]);}else{_0x5e0bc6=util[_0x63f0('0xf0')](_0x63f0('0xac'),_0x43abe8['name']);}socket['to'](util[_0x63f0('0xf0')](_0x63f0('0xf1'),_0x43abe8[_0x63f0('0x3b')]))[_0x63f0('0x28')](_0x63f0('0xf2'),{'user':{'id':_0x43abe8['id'],'name':_0x43abe8[_0x63f0('0x3b')]},'ip':_0x19e5ed[_0x63f0('0xf3')][_0x63f0('0xf4')]||_0x19e5ed[_0x63f0('0xf5')][_0x63f0('0xf6')]||_0x19e5ed[_0x63f0('0xf7')][_0x63f0('0xf6')]||_0x19e5ed[_0x63f0('0xf5')][_0x63f0('0xf7')]['remoteAddress']});return db[_0x63f0('0xad')][_0x63f0('0x2a')]({'where':{'membername':_0x43abe8[_0x63f0('0x3b')]},'individualHooks':!![]});}}else{throw new db[(_0x63f0('0x92'))][(_0x63f0('0x93'))](_0x63f0('0xf8'));}})['then'](function(){if(_0x43abe8){return _0x43abe8[_0x63f0('0xf9')]({'raw':!![]});}})[_0x63f0('0x16')](function(_0x50d5b6){if(_0x43abe8){if(_0x50d5b6){_0x2daabd=_0x50d5b6;if(_0x2daabd['length']){var _0xd264d=_0x2daabd[_0x63f0('0x34')](function(_0x1eff6c){var _0x836706={'membername':_0x43abe8[_0x63f0('0x3b')],'UserId':_0x43abe8['id'],'queue_name':_0x1eff6c[_0x63f0('0x3b')],'VoiceQueueId':_0x1eff6c['id'],'interface':_0x5e0bc6,'paused':_0x43abe8[_0x63f0('0xee')]||![],'penalty':_0x1eff6c[_0x63f0('0xfa')]||0x0};return db[_0x63f0('0xad')][_0x63f0('0xfb')](_0x836706);});return Promise[_0x63f0('0x55')](_0xd264d);}}}})[_0x63f0('0x16')](function(){if(_0x43abe8){return db[_0x63f0('0xfc')][_0x63f0('0x4b')]({'where':{'membername':_0x43abe8[_0x63f0('0x3b')],'exitAt':null}});}})[_0x63f0('0x16')](function(_0x45410c){if(_0x43abe8){var _0x1b51fd=[];_0x45410c[_0x63f0('0xfd')](function(_0xc4680){_0x1b51fd['push'](_0xc4680[_0x63f0('0x27')]({'exitAt':moment()[_0x63f0('0xf0')](_0x63f0('0xfe'))}));});return Promise['all'](_0x1b51fd);}})['then'](function(){if(_0x43abe8){var _0x20ab12=[];var _0x3518b7=[];var _0x27851c=utils[_0x63f0('0xff')]();var _0x2324cc={'membername':_0x43abe8[_0x63f0('0x3b')],'interface':_0x5e0bc6,'enterAt':moment()[_0x63f0('0xf0')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x43abe8['role'],'internal':_0x43abe8[_0x63f0('0x65')]};_0x27851c[_0x63f0('0xfd')](function(_0x2e3461){_0x20ab12['push'](_[_0x63f0('0xcd')]({'channel':_0x2e3461,'type':_0x63f0('0x100'),'data1':_0x19e5ed[_0x63f0('0x61')]['device'],'data2':_0x5e0bc6},_0x2324cc));if(_0x43abe8[_0x63f0('0xee')]){_0x3518b7[_0x63f0('0x4a')](_[_0x63f0('0xcd')]({'channel':_0x2e3461,'type':'PAUSE','data1':_0x63f0('0x101')},_0x2324cc));}});return db['MemberReport'][_0x63f0('0x8a')](_0x20ab12['concat'](_0x3518b7),{'individualHooks':!![]});}})[_0x63f0('0x16')](function(){if(_0x43abe8){return _0x43abe8[_0x63f0('0x27')]({'online':!![],'lastLoginAt':moment()[_0x63f0('0xf0')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x43abe8[_0x63f0('0xee')]||![],'mailPause':_0x43abe8['loginInPause']||![],'chatPause':_0x43abe8[_0x63f0('0xee')]||![],'faxPause':_0x43abe8[_0x63f0('0xee')]||![],'smsPause':_0x43abe8[_0x63f0('0xee')]||![],'openchannelPause':_0x43abe8['loginInPause']||![],'whatsappPause':_0x43abe8['loginInPause']||![],'pauseType':_0x43abe8[_0x63f0('0xee')]?'LOGININPAUSE':null,'interface':_0x5e0bc6,'lastPauseAt':moment()[_0x63f0('0xf0')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0xa1f89){if(_0x19e5ed[_0x63f0('0x102')]){return _0x115229();}else{return Promise[_0x63f0('0x103')](_0xa1f89)[_0x63f0('0x16')](respondWithResult(_0xefc0f5,null));}})[_0x63f0('0x20')](handleError(_0xefc0f5,null));};exports[_0x63f0('0x104')]=function(_0x11b3d5,_0x5758b9){var _0x3267b9;return db['User'][_0x63f0('0x38')]({'where':{'id':_0x11b3d5[_0x63f0('0x57')]['id'],'role':_0x63f0('0x2f')},'attributes':['id','name',_0x63f0('0x37')]})[_0x63f0('0x16')](handleEntityNotFound(_0x5758b9,null))[_0x63f0('0x16')](function(_0x189565){if(_0x189565){_0x3267b9=_0x189565;return db[_0x63f0('0xad')][_0x63f0('0x2a')]({'where':{'membername':_0x3267b9[_0x63f0('0x3b')]},'individualHooks':!![]});}})[_0x63f0('0x16')](function(){return db['MemberReport'][_0x63f0('0x4b')]({'where':{'membername':_0x3267b9[_0x63f0('0x3b')],'exitAt':null}});})['then'](function(_0x588ddb){var _0x304c55=[];_0x588ddb[_0x63f0('0xfd')](function(_0x15d223){_0x304c55[_0x63f0('0x4a')](_0x15d223[_0x63f0('0x27')]({'exitAt':moment()[_0x63f0('0xf0')](_0x63f0('0xfe'))}));});return Promise[_0x63f0('0x55')](_0x304c55);})[_0x63f0('0x16')](function(){return _0x3267b9[_0x63f0('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x63f0('0x16')](respondWithResult(_0x5758b9,null))[_0x63f0('0x20')](handleError(_0x5758b9,null));};exports[_0x63f0('0x105')]=function(_0x187acd,_0x4d6860){var _0x19972e;return db[_0x63f0('0xad')][_0x63f0('0x27')]({'paused':0x1},{'where':{'UserId':_0x187acd[_0x63f0('0x57')]['id']},'individualHooks':!![]})[_0x63f0('0x16')](function(){return db[_0x63f0('0x3d')][_0x63f0('0x38')]({'where':{'id':_0x187acd[_0x63f0('0x57')]['id'],'role':_0x63f0('0x2f')},'attributes':['id',_0x63f0('0x3b'),_0x63f0('0x37'),'internal',_0x63f0('0xa1'),_0x63f0('0x9f')]});})[_0x63f0('0x16')](handleEntityNotFound(_0x4d6860,null))[_0x63f0('0x16')](function(_0x2faffe){if(_0x2faffe){_0x19972e=_0x2faffe;return respondWithRpcPromise(_0x63f0('0x106'),'pause',{'id':_0x19972e['id'],'name':_0x19972e[_0x63f0('0x3b')],'pause':!![]});}})[_0x63f0('0x16')](function(){if(_0x19972e){return db[_0x63f0('0xfc')][_0x63f0('0x4b')]({'where':{'membername':_0x19972e[_0x63f0('0x3b')],'type':'PAUSE','exitAt':null}});}})[_0x63f0('0x16')](function(_0x46b13c){if(_0x46b13c[_0x63f0('0x5f')]){var _0x50c86d=moment()['format'](_0x63f0('0xfe'));for(var _0x553b5c=0x0,_0x4cc9eb=_0x46b13c['length'];_0x553b5c<_0x4cc9eb;_0x553b5c++){_0x46b13c[_0x553b5c][_0x63f0('0x107')]({'exitAt':_0x50c86d});}}})[_0x63f0('0x16')](function(){var _0x1a31f7=[];var _0xbf2da=utils[_0x63f0('0xff')]();_0xbf2da[_0x63f0('0xfd')](function(_0x4460a9){_0x1a31f7[_0x63f0('0x4a')]({'channel':_0x4460a9,'membername':_0x19972e[_0x63f0('0x3b')],'interface':_[_0x63f0('0x6a')](_0x19972e[_0x63f0('0xa1')])?util['format'](_0x63f0('0xac'),_0x19972e['name']):_0x19972e[_0x63f0('0xa1')],'type':_0x63f0('0x108'),'enterAt':moment()[_0x63f0('0xf0')](_0x63f0('0xfe')),'data1':_0x187acd[_0x63f0('0x61')][_0x63f0('0x40')]||'DEFAULT\x20PAUSE','role':_0x19972e[_0x63f0('0x37')],'internal':_0x19972e[_0x63f0('0x65')]});});return db[_0x63f0('0xfc')][_0x63f0('0x8a')](_0x1a31f7,{'individualHooks':!![]});})['then'](function(){return _0x19972e[_0x63f0('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x187acd[_0x63f0('0x61')][_0x63f0('0x40')]||_0x63f0('0x109'),'lastPauseAt':moment()[_0x63f0('0xf0')](_0x63f0('0xfe'))});})['then'](respondWithResult(_0x4d6860,null))['catch'](handleError(_0x4d6860,null));};exports[_0x63f0('0x10a')]=function(_0x3575d9,_0x15d4fd){if(_0x3575d9[_0x63f0('0x61')][_0x63f0('0xaf')]&&!utils[_0x63f0('0xa2')](_0x3575d9[_0x63f0('0x61')][_0x63f0('0xaf')])){throw new APIBadRequestError(util[_0x63f0('0xf0')](_0x63f0('0x10b'),_0x3575d9[_0x63f0('0x61')][_0x63f0('0xaf')]));}return db['User'][_0x63f0('0x38')]({'where':{'id':_0x3575d9[_0x63f0('0x57')]['id']},'attributes':['id',_0x63f0('0x3b'),_0x63f0('0x37'),'internal','interface',_0x63f0('0x9f'),'voicePause',_0x63f0('0x10c'),_0x63f0('0x10d'),'faxPause',_0x63f0('0x10e'),_0x63f0('0x10f'),_0x63f0('0x110'),_0x63f0('0x111'),_0x63f0('0x112')]})[_0x63f0('0x16')](function(_0x2e37ac){if(!_0x2e37ac){throw new APINotFoundError(util[_0x63f0('0xf0')](_0x63f0('0x113'),_0x3575d9[_0x63f0('0x57')]['id']));}return _0x2e37ac[_0x63f0('0x10a')](_0x3575d9[_0x63f0('0x61')][_0x63f0('0xaf')]);})['then'](respondWithResult(_0x15d4fd,null))['catch'](APIHandleError(_0x15d4fd));};exports[_0x63f0('0x114')]=function(_0x5a5c0a,_0x1423af){var _0x2fa020={};var _0x5ea282={};var _0x227ad5;var _0x78ba6d;return db['User'][_0x63f0('0xc9')]({'where':{'id':_0x5a5c0a['params']['id']}})['then'](handleEntityNotFound(_0x1423af,null))['then'](function(_0x34c1e4){if(_0x34c1e4){_0x227ad5=_0x34c1e4;_0x5ea282['model']=_['keys'](db['Team'][_0x63f0('0x3e')]);_0x5ea282[_0x63f0('0x44')]=_[_0x63f0('0x59')](_0x5a5c0a[_0x63f0('0x44')]);_0x5ea282[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x5ea282[_0x63f0('0x5d')],_0x5ea282[_0x63f0('0x44')]);_0x2fa020[_0x63f0('0x49')]=_['intersection'](_0x5ea282[_0x63f0('0x5d')],qs[_0x63f0('0x5e')](_0x5a5c0a[_0x63f0('0x44')][_0x63f0('0x5e')]));_0x2fa020[_0x63f0('0x49')]=_0x2fa020[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x2fa020[_0x63f0('0x49')]:_0x5ea282[_0x63f0('0x5d')];_0x2fa020[_0x63f0('0xd6')]=qs['sort'](_0x5a5c0a[_0x63f0('0x44')][_0x63f0('0xcb')]);_0x2fa020[_0x63f0('0x43')]=qs[_0x63f0('0x5b')](_['pick'](_0x5a5c0a['query'],_0x5ea282['filters']));if(_0x5a5c0a[_0x63f0('0x44')][_0x63f0('0x32')]){_0x2fa020[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x2fa020[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x2fa020[_0x63f0('0x49')],function(_0x2dd632){var _0x5e5ba2={};_0x5e5ba2[_0x2dd632]={'$like':'%'+_0x5a5c0a[_0x63f0('0x44')]['filter']+'%'};return _0x5e5ba2;})});}_0x2fa020=_[_0x63f0('0xcd')]({},_0x2fa020,_0x5a5c0a[_0x63f0('0xda')]);return _0x227ad5[_0x63f0('0x114')](_0x2fa020);}})['then'](function(_0x144bef){if(_0x144bef){_0x78ba6d=_0x144bef['length'];if(!_0x5a5c0a[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x2fa020[_0x63f0('0x24')]=qs[_0x63f0('0x24')](_0x5a5c0a[_0x63f0('0x44')][_0x63f0('0x24')]);_0x2fa020[_0x63f0('0x23')]=qs['offset'](_0x5a5c0a[_0x63f0('0x44')][_0x63f0('0x23')]);}return _0x227ad5[_0x63f0('0x114')](_0x2fa020);}})[_0x63f0('0x16')](function(_0x47fb6e){if(_0x47fb6e){return _0x47fb6e?{'count':_0x78ba6d,'rows':_0x47fb6e}:null;}})[_0x63f0('0x16')](respondWithResult(_0x1423af,null))[_0x63f0('0x20')](handleError(_0x1423af,null));};exports[_0x63f0('0x115')]=function(_0x15b2e3,_0x181b5d){var _0xf33882=_0x15b2e3['params']['id'];var _0x452b98=_0x15b2e3[_0x63f0('0x61')]?_0x15b2e3[_0x63f0('0x61')][_0x63f0('0x64')]:null;var _0x587a29=[];return Promise[_0x63f0('0x103')]()['then'](function(){if(!_0x452b98)throw new APIBadRequestError(_0x63f0('0x116'));})[_0x63f0('0x16')](function(){return db['User'][_0x63f0('0xc9')]({'where':{'id':_0xf33882}});})[_0x63f0('0x16')](function(_0x1cdc47){if(!_0x1cdc47)throw new APINotFoundError(util[_0x63f0('0xf0')]('User\x20with\x20id\x20%s\x20not\x20found',_0x15b2e3[_0x63f0('0x57')]['id']));return db[_0x63f0('0x6c')][_0x63f0('0x117')](function(_0x409f46){return _0x1cdc47['addTeams'](_0x452b98,{'transaction':_0x409f46})['then'](function(){return db['Team'][_0x63f0('0x4b')]({'where':{'id':{'$in':_0x452b98}}});})[_0x63f0('0x16')](function(_0xe4f32b){var _0x54544a=_[_0x63f0('0x34')](_0xe4f32b,function(_0x2b756e){return _0x2b756e[_0x63f0('0x118')]();});return Promise[_0x63f0('0x55')](_0x54544a);})[_0x63f0('0x16')](function(_0x20a495){_0x587a29=_[_0x63f0('0x119')](_0x20a495);var _0x4ec893=_[_0x63f0('0x34')](_0x587a29,function(_0x315503){return _0x315503['addAgent'](_0x1cdc47['id'],{'transaction':_0x409f46});});return Promise[_0x63f0('0x55')](_0x4ec893);})['then'](function(){if(!_0x1cdc47[_0x63f0('0x9f')])return;var _0x3e6111=_[_0x63f0('0x32')](_0x587a29,function(_0x551893){return _0x551893['getDataValue'](_0x63f0('0xaf'))==='Voice';});var _0x589632=_[_0x63f0('0x34')](_0x3e6111,function(_0xfbbcfe){return db['UserVoiceQueueRt'][_0x63f0('0xfb')]({'membername':_0x1cdc47[_0x63f0('0x3b')],'UserId':_0x1cdc47['id'],'queue_name':_0xfbbcfe[_0x63f0('0x3b')],'VoiceQueueId':_0xfbbcfe['id'],'interface':_[_0x63f0('0x6a')](_0x1cdc47['interface'])?util['format'](_0x63f0('0xac'),_0x1cdc47[_0x63f0('0x3b')]):_0x1cdc47[_0x63f0('0xa1')],'paused':_0x1cdc47[_0x63f0('0xa0')]||![],'penalty':_0x1cdc47[_0x63f0('0xa7')]},{'transaction':_0x409f46});});return Promise[_0x63f0('0x55')](_0x589632);})[_0x63f0('0x16')](function(){return db[_0x63f0('0x11a')][_0x63f0('0x4b')]({'where':{'teamId':{'$in':_0x452b98}}});})['then'](function(_0x31f91a){var _0x2ea2d9=_['map'](_0x31f91a,function(_0x14a76e){return db[_0x63f0('0x11b')]['create']({'UserId':_0x1cdc47['id'],'VoicePrefixId':_0x14a76e[_0x63f0('0x11c')]},{'transaction':_0x409f46});});return Promise[_0x63f0('0x55')](_0x2ea2d9);});});})[_0x63f0('0x16')](function(){for(var _0x3fb3ac=0x0;_0x3fb3ac<_0x587a29[_0x63f0('0x5f')];_0x3fb3ac++){var _0x1aa281=_0x587a29[_0x3fb3ac][_0x63f0('0x11d')](_0x63f0('0xaf'));var _0x4edd50=_0x1aa281+_0x63f0('0xaa');socket[_0x63f0('0x28')](_0x63f0('0x2d')+_0x1aa281+_0x63f0('0x11e'),{'UserId':_0xf33882,['queueField']:_0x587a29[_0x3fb3ac]['id']});}})[_0x63f0('0x16')](respondWithStatusCode(_0x181b5d,null))['catch'](APIHandleError(_0x181b5d));};exports[_0x63f0('0x11f')]=function(_0x4fee7a,_0x3ee7f0){var _0x55516e=_0x4fee7a[_0x63f0('0x57')]['id'];var _0x5ca5bc=null;if(_0x4fee7a['query'][_0x63f0('0x64')]){_0x5ca5bc=_['isArray'](_0x4fee7a['query'][_0x63f0('0x64')])?_0x4fee7a[_0x63f0('0x44')]['ids']:[_0x4fee7a[_0x63f0('0x44')][_0x63f0('0x64')]];}var _0x48f0a9=[];return Promise[_0x63f0('0x103')]()[_0x63f0('0x16')](function(){if(!_0x5ca5bc)throw new APIBadRequestError(_0x63f0('0x120'));})[_0x63f0('0x16')](function(){return db[_0x63f0('0x3d')][_0x63f0('0xc9')]({'where':{'id':_0x55516e}});})[_0x63f0('0x16')](function(_0x4ffa83){if(!_0x4ffa83)throw new APINotFoundError(util['format'](_0x63f0('0x113'),_0x4fee7a['params']['id']));return db['sequelize']['transaction'](function(_0x1e7f9b){return _0x4ffa83['removeTeams'](_0x5ca5bc,{'transaction':_0x1e7f9b})['then'](function(){return db[_0x63f0('0x121')][_0x63f0('0x4b')]({'where':{'id':{'$in':_0x5ca5bc}}});})[_0x63f0('0x16')](function(_0x5f3bd5){var _0x42100c=_[_0x63f0('0x34')](_0x5f3bd5,function(_0x32ee79){return _0x32ee79[_0x63f0('0x118')]();});return Promise[_0x63f0('0x55')](_0x42100c);})[_0x63f0('0x16')](function(_0x1800fe){_0x48f0a9=_[_0x63f0('0x119')](_0x1800fe);var _0x420d23=_[_0x63f0('0x34')](_0x48f0a9,function(_0x531f69){return _0x531f69[_0x63f0('0x122')](_0x4ffa83['id'],{'transaction':_0x1e7f9b});});return Promise[_0x63f0('0x55')](_0x420d23);})[_0x63f0('0x16')](function(){if(!_0x4ffa83[_0x63f0('0x9f')])return;var _0x4429a2=_['filter'](_0x48f0a9,function(_0x25b020){return _0x25b020[_0x63f0('0x11d')](_0x63f0('0xaf'))===_0x63f0('0x123');});var _0x4151c9=_[_0x63f0('0x34')](_0x4429a2,function(_0x56837a){return db[_0x63f0('0xad')][_0x63f0('0x2a')]({'where':{'VoiceQueueId':_0x56837a['id'],'UserId':_0x4ffa83['id']},'transaction':_0x1e7f9b});});return Promise['all'](_0x4151c9);})[_0x63f0('0x16')](function(){return db[_0x63f0('0x11a')][_0x63f0('0x4b')]({'where':{'teamId':{'$in':_0x5ca5bc}}});})[_0x63f0('0x16')](function(_0x3c2fbe){var _0x25bff5=_[_0x63f0('0x34')](_0x3c2fbe,function(_0x3ee507){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x4ffa83['id'],'VoicePrefixId':_0x3ee507[_0x63f0('0x11c')]}},{'transaction':_0x1e7f9b});});return Promise['all'](_0x25bff5);});});})[_0x63f0('0x16')](function(){for(var _0x15b80c=0x0;_0x15b80c<_0x48f0a9[_0x63f0('0x5f')];_0x15b80c++){var _0x407d16=_0x48f0a9[_0x15b80c][_0x63f0('0x11d')](_0x63f0('0xaf'));var _0x3e33f5=_0x407d16+_0x63f0('0xaa');socket[_0x63f0('0x28')](_0x63f0('0x2d')+_0x407d16+_0x63f0('0xb2'),{'UserId':_0x55516e,['queueField']:_0x48f0a9[_0x15b80c]['id']});}})[_0x63f0('0x16')](respondWithStatusCode(_0x3ee7f0,null))[_0x63f0('0x20')](APIHandleError(_0x3ee7f0));};exports[_0x63f0('0x124')]=function(_0x216b40,_0x1a7e77){var _0x13e845={};var _0xeb59a3={};var _0x5c58a2;var _0x5c2ed4;return db[_0x63f0('0x3d')]['findOne']({'where':{'id':_0x216b40[_0x63f0('0x57')]['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x1a7e77,null))[_0x63f0('0x16')](function(_0xb8d657){if(_0xb8d657){_0x5c58a2=_0xb8d657;_0xeb59a3[_0x63f0('0x5d')]=_[_0x63f0('0x59')](db[_0x63f0('0x125')][_0x63f0('0x3e')]);_0xeb59a3[_0x63f0('0x44')]=_[_0x63f0('0x59')](_0x216b40[_0x63f0('0x44')]);_0xeb59a3[_0x63f0('0x5b')]=_['intersection'](_0xeb59a3[_0x63f0('0x5d')],_0xeb59a3[_0x63f0('0x44')]);_0x13e845[_0x63f0('0x49')]=_[_0x63f0('0x5c')](_0xeb59a3['model'],qs[_0x63f0('0x5e')](_0x216b40[_0x63f0('0x44')][_0x63f0('0x5e')]));_0x13e845['attributes']=_0x13e845[_0x63f0('0x49')]['length']?_0x13e845['attributes']:_0xeb59a3[_0x63f0('0x5d')];_0x13e845[_0x63f0('0xd6')]=qs[_0x63f0('0xcb')](_0x216b40[_0x63f0('0x44')]['sort']);_0x13e845[_0x63f0('0x43')]=qs[_0x63f0('0x5b')](_[_0x63f0('0xcc')](_0x216b40[_0x63f0('0x44')],_0xeb59a3['filters']));if(_0x216b40[_0x63f0('0x44')]['filter']){_0x13e845[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x13e845[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x13e845[_0x63f0('0x49')],function(_0x1f47b3){var _0x382e03={};_0x382e03[_0x1f47b3]={'$like':'%'+_0x216b40[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0x382e03;})});}_0x13e845=_['merge']({},_0x13e845,_0x216b40[_0x63f0('0xda')]);return _0x5c58a2['getLists'](_0x13e845);}})[_0x63f0('0x16')](function(_0x12d23b){if(_0x12d23b){_0x5c2ed4=_0x12d23b[_0x63f0('0x5f')];if(!_0x216b40[_0x63f0('0x44')][_0x63f0('0xce')](_0x63f0('0xd4'))){_0x13e845['limit']=qs[_0x63f0('0x24')](_0x216b40['query'][_0x63f0('0x24')]);_0x13e845[_0x63f0('0x23')]=qs[_0x63f0('0x23')](_0x216b40[_0x63f0('0x44')]['offset']);}return _0x5c58a2[_0x63f0('0x124')](_0x13e845);}})[_0x63f0('0x16')](function(_0x252ae8){if(_0x252ae8){return _0x252ae8?{'count':_0x5c2ed4,'rows':_0x252ae8}:null;}})[_0x63f0('0x16')](respondWithResult(_0x1a7e77,null))['catch'](handleError(_0x1a7e77,null));};exports[_0x63f0('0x126')]=function(_0x2bc39c,_0x46c7be){var _0x26f815={};var _0x5514e5={};var _0x1bd4f5;return db[_0x63f0('0x3d')]['findOne']({'where':{'id':_0x2bc39c['params']['id']}})[_0x63f0('0x16')](handleEntityNotFound(_0x46c7be,null))[_0x63f0('0x16')](function(_0x31a9c3){if(_0x31a9c3){_0x1bd4f5=_0x31a9c3;_0x5514e5['model']=_[_0x63f0('0x59')](db[_0x63f0('0x3d')]['rawAttributes']);_0x5514e5[_0x63f0('0x44')]=_[_0x63f0('0x59')](_0x2bc39c['query']);_0x5514e5[_0x63f0('0x5b')]=_[_0x63f0('0x5c')](_0x5514e5['model'],_0x5514e5[_0x63f0('0x44')]);_0x26f815[_0x63f0('0x49')]=_['intersection'](_0x5514e5['model'],qs['fields'](_0x2bc39c['query']['fields']));_0x26f815[_0x63f0('0x49')]=_0x26f815[_0x63f0('0x49')][_0x63f0('0x5f')]?_0x26f815['attributes']:_0x5514e5['model'];_0x26f815[_0x63f0('0xd6')]=qs['sort'](_0x2bc39c['query']['sort']);_0x26f815[_0x63f0('0x43')]=qs[_0x63f0('0x5b')](_['pick'](_0x2bc39c[_0x63f0('0x44')],_0x5514e5[_0x63f0('0x5b')]));if(_0x2bc39c[_0x63f0('0x44')]['filter']){_0x26f815[_0x63f0('0x43')]=_[_0x63f0('0xcd')](_0x26f815[_0x63f0('0x43')],{'$or':_[_0x63f0('0x34')](_0x26f815[_0x63f0('0x49')],function(_0xbf0c9d){var _0x38fba7={};_0x38fba7[_0xbf0c9d]={'$like':'%'+_0x2bc39c[_0x63f0('0x44')][_0x63f0('0x32')]+'%'};return _0x38fba7;})});}_0x26f815[_0x63f0('0x5d')]=db[_0x63f0('0x3d')];_0x26f815['as']=_0x63f0('0x2e');_0x26f815=_['merge']({},_0x26f815,_0x2bc39c[_0x63f0('0xda')]);return _0x1bd4f5[_0x63f0('0xf9')]({'include':[_0x26f815]});}})[_0x63f0('0x16')](function(_0x278863){if(_0x278863){var _0x537a7e={},_0x3641a3=[];for(var _0x514594=0x0;_0x514594<_0x278863['length'];_0x514594+=0x1){for(var _0x46274e=0x0,_0x6c731f;_0x46274e<_0x278863[_0x514594]['Agents']['length'];_0x46274e+=0x1){_0x6c731f=_0x278863[_0x514594][_0x63f0('0x2e')][_0x46274e][_0x63f0('0x2b')]({'plain':!![]});_0x537a7e[_0x6c731f['id']]=_0x6c731f;}}_0x537a7e=_[_0x63f0('0x127')](_0x537a7e);for(var _0x13a727=qs['offset'](_0x2bc39c['query'][_0x63f0('0x23')]);_0x13a727<_0x537a7e[_0x63f0('0x5f')]&&_0x3641a3[_0x63f0('0x5f')]=_0xab556b){_0x40e119=_0xab556b;_0xb5b31b=0xc8;}else{_0xb5b31b=0xce;}_0x5924a6[_0x4297('0x26')](_0xb5b31b);return _0x5924a6[_0x4297('0x2c')](_0x4297('0x2d'),_0x3edeb2+'-'+_0x40e119+'/'+_0xab556b)[_0x4297('0x27')](_0x2bbd86);}return null;};}function saveUpdates(_0x582482){return function(_0x5713a5){if(_0x5713a5){return _0x5713a5['update'](_0x582482)[_0x4297('0x19')](function(_0x41b320){socket[_0x4297('0x2e')](_0x4297('0x2f')+_0x41b320['id'],{});return _0x41b320;});}return null;};}function removeEntity(_0x4849be){return function(_0x4c185f){if(_0x4c185f){return _0x4c185f[_0x4297('0x30')]()[_0x4297('0x19')](function(){var _0x5e5aab=_0x4c185f['get']({'plain':!![]});if(_0x5e5aab[_0x4297('0x31')]===_0x4297('0x32'))return;var _0x25ea79=[{'name':_0x4297('0x33'),'value':'user','ignore':!![]},{'name':_0x4297('0x34'),'value':_0x4297('0x35'),'ignore':![]},{'name':_0x4297('0x36'),'value':_0x4297('0x37'),'ignore':![]}];var _0x16d809=_(_0x25ea79)[_0x4297('0x38')](_0x4297('0x39'))[_0x4297('0x3a')](_0x4297('0x3b'))['value']();if(_['includes'](_0x16d809,_0x5e5aab[_0x4297('0x31')])){return;}var _0x834b1f=_[_0x4297('0x3c')](_0x25ea79,[_0x4297('0x3b'),_0x5e5aab[_0x4297('0x31')]])[_0x4297('0x3d')];return db[_0x4297('0x3e')][_0x4297('0x30')]({'where':{'type':_0x834b1f,'resourceId':_0x5e5aab['id']}})[_0x4297('0x19')](function(){return _0x4c185f;});})[_0x4297('0x19')](function(){_0x4849be[_0x4297('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0xba79c1){return function(_0x1f6892){if(!_0x1f6892){_0xba79c1['sendStatus'](0x194);}return _0x1f6892;};}function handleError(_0x3f74c6,_0x9f2423){_0x9f2423=_0x9f2423||0x1f4;return function(_0x2c7309){logger[_0x4297('0x1f')](_0x2c7309['stack']);if(_0x2c7309[_0x4297('0x3d')]){delete _0x2c7309[_0x4297('0x3d')];}_0x3f74c6[_0x4297('0x26')](_0x9f2423)[_0x4297('0x3f')](_0x2c7309);};}exports[_0x4297('0x40')]=function(_0x2e6e2a,_0x986919){var _0x222373={},_0x2e4839={'count':0x0,'rows':[]};var _0x4a13b5=_(db[_0x4297('0x41')][_0x4297('0x42')])[_0x4297('0x3a')](function(_0x4aa21e){return{'name':_0x4aa21e[_0x4297('0x43')],'type':_0x4aa21e['type'][_0x4297('0x44')]};})[_0x4297('0x38')](function(_0x13e06d){return!_[_0x4297('0x45')](['password','salt'],_0x13e06d[_0x4297('0x3d')]);})[_0x4297('0x3b')]();_0x222373=qs['getOptions'](_0x4a13b5,_0x2e6e2a);var _0x59609a={'where':_0x222373[_0x4297('0x46')]};return db[_0x4297('0x41')][_0x4297('0x2b')](_0x59609a)[_0x4297('0x19')](function(_0x4e6e49){_0x2e4839[_0x4297('0x2b')]=_0x4e6e49;if(_0x2e6e2a['query']['includeAll']){_0x222373[_0x4297('0x47')]=[{'all':!![]}];}if(_0x2e6e2a[_0x4297('0x48')][_0x4297('0x49')]==='true'){_0x222373[_0x4297('0x47')]=[{'model':db[_0x4297('0x4a')],'as':_0x4297('0x49')}];}if(!_['includes'](_0x222373['attributes'],'id')){_0x222373['attributes']['push']('id');}return db[_0x4297('0x41')][_0x4297('0x4b')](_0x222373);})[_0x4297('0x19')](function(_0x15b36d){_0x2e4839[_0x4297('0x4c')]=_0x15b36d;if(_0x2e6e2a['query']['openTabs']==='true'){var _0x31454e=[];for(var _0x17ba9d=0x0;_0x17ba9d<_0x2e4839['rows']['length'];_0x17ba9d++){_0x31454e[_0x4297('0x4d')](get_open_tabs(_0x4297('0x4e'),_0x2e4839[_0x4297('0x4c')][_0x17ba9d]['dataValues']));_0x31454e['push'](get_open_tabs(_0x4297('0x4f'),_0x2e4839[_0x4297('0x4c')][_0x17ba9d][_0x4297('0x50')]));_0x31454e['push'](get_open_tabs('fax',_0x2e4839[_0x4297('0x4c')][_0x17ba9d]['dataValues']));_0x31454e[_0x4297('0x4d')](get_open_tabs(_0x4297('0x51'),_0x2e4839[_0x4297('0x4c')][_0x17ba9d]['dataValues']));_0x31454e[_0x4297('0x4d')](get_open_tabs('openchannel',_0x2e4839[_0x4297('0x4c')][_0x17ba9d]['dataValues']));_0x31454e[_0x4297('0x4d')](get_open_tabs('whatsapp',_0x2e4839['rows'][_0x17ba9d][_0x4297('0x50')]));}return Promise[_0x4297('0x52')](_0x31454e)['then'](function(){return _0x2e4839;});}else{return _0x2e4839;}})[_0x4297('0x19')](respondWithFilteredResult(_0x986919,_0x222373))[_0x4297('0x23')](handleError(_0x986919,null));};exports['show']=function(_0x6545cf,_0x54c83f){var _0x557947={'raw':![],'where':{'id':_0x6545cf['params']['id']}},_0x118130={};_0x118130[_0x4297('0x53')]=_[_0x4297('0x54')](_['keys'](db[_0x4297('0x41')][_0x4297('0x42')]),[_0x4297('0x55'),'salt']);_0x118130[_0x4297('0x48')]=_[_0x4297('0x56')](_0x6545cf[_0x4297('0x48')]);_0x118130['filters']=_[_0x4297('0x57')](_0x118130[_0x4297('0x53')],_0x118130['query']);_0x557947[_0x4297('0x58')]=_['intersection'](_0x118130[_0x4297('0x53')],qs[_0x4297('0x59')](_0x6545cf['query'][_0x4297('0x59')]));_0x557947['attributes']=_0x557947['attributes'][_0x4297('0x5a')]?_0x557947[_0x4297('0x58')]:_0x118130[_0x4297('0x53')];if(_0x6545cf[_0x4297('0x48')][_0x4297('0x5b')]){_0x557947[_0x4297('0x47')]=[{'all':!![]}];}if(_0x6545cf[_0x4297('0x48')][_0x4297('0x49')]===_0x4297('0x5c')){_0x557947[_0x4297('0x47')]=[{'model':db[_0x4297('0x4a')],'as':_0x4297('0x49')}];}_0x557947=_[_0x4297('0x5d')]({},_0x557947,_0x6545cf[_0x4297('0x5e')]);if(!_['includes'](_0x557947['attributes'],'id')){_0x557947[_0x4297('0x58')][_0x4297('0x4d')]('id');}return db[_0x4297('0x41')][_0x4297('0x3c')](_0x557947)[_0x4297('0x19')](handleEntityNotFound(_0x54c83f,null))[_0x4297('0x19')](function(_0x11b0ab){var _0x189e7a=[];values=_0x11b0ab;if(_0x6545cf[_0x4297('0x48')][_0x4297('0x5f')]===_0x4297('0x5c')){_0x189e7a['push'](get_open_tabs('chat',_0x11b0ab[_0x4297('0x50')]));_0x189e7a[_0x4297('0x4d')](get_open_tabs(_0x4297('0x4f'),_0x11b0ab[_0x4297('0x50')]));_0x189e7a[_0x4297('0x4d')](get_open_tabs(_0x4297('0x60'),_0x11b0ab[_0x4297('0x50')]));_0x189e7a[_0x4297('0x4d')](get_open_tabs('whatsapp',_0x11b0ab['dataValues']));_0x189e7a['push'](get_open_tabs(_0x4297('0x61'),_0x11b0ab[_0x4297('0x50')]));_0x189e7a[_0x4297('0x4d')](get_open_tabs(_0x4297('0x51'),_0x11b0ab[_0x4297('0x50')]));return Promise[_0x4297('0x52')](_0x189e7a);}else{return values;}})[_0x4297('0x19')](function(){return values;})[_0x4297('0x19')](respondWithResult(_0x54c83f,null))[_0x4297('0x23')](handleError(_0x54c83f,null));};exports[_0x4297('0x62')]=function(_0x4da332,_0x2ab1b2){if(_0x4da332[_0x4297('0x63')]['id']){delete _0x4da332['body']['id'];}delete _0x4da332[_0x4297('0x63')][_0x4297('0x31')];return db[_0x4297('0x41')][_0x4297('0x3c')]({'where':{'id':_0x4da332[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x2ab1b2,null))[_0x4297('0x19')](saveUpdates(_0x4da332[_0x4297('0x63')],null))['then'](respondWithResult(_0x2ab1b2,null))[_0x4297('0x23')](handleError(_0x2ab1b2,null));};exports[_0x4297('0x65')]=function(_0x379131,_0x549dee){return db[_0x4297('0x41')]['describe']()['then'](respondWithResult(_0x549dee,null))[_0x4297('0x23')](handleError(_0x549dee,null));};exports['addContacts']=function(_0x436c2b,_0x59cc2b){return db[_0x4297('0x41')][_0x4297('0x3c')]({'where':{'id':_0x436c2b[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x59cc2b,null))[_0x4297('0x19')](function(_0x2052ab){if(_0x2052ab){return _0x2052ab[_0x4297('0x66')](_0x436c2b[_0x4297('0x63')][_0x4297('0x67')],_['omit'](_0x436c2b[_0x4297('0x63')],[_0x4297('0x67'),'id'])||{});}})[_0x4297('0x19')](respondWithResult(_0x59cc2b,null))[_0x4297('0x23')](handleError(_0x59cc2b,null));};function validateUser(_0x591b50){return new Promise(function(_0x81f128,_0x2950f2){if(_0x591b50['internal'])return _0x81f128(_0x591b50);return db[_0x4297('0x68')][_0x4297('0x69')](0x1)['then'](function(_0x7241fd){if(_0x7241fd[_0x4297('0x6a')])authService[_0x4297('0x6b')](_0x591b50[_0x4297('0x55')]);db[_0x4297('0x41')][_0x4297('0x6c')]('internal')[_0x4297('0x19')](function(_0x4c5e16){if(_[_0x4297('0x6d')](_0x4c5e16)){_0x591b50[_0x4297('0x6e')]=_0x7241fd[_0x4297('0x6f')]||0x1;return;}if(_[_0x4297('0x6d')](_0x7241fd[_0x4297('0x6f')])||_0x7241fd[_0x4297('0x6f')]===_0x4c5e16){_0x591b50[_0x4297('0x6e')]=_0x4c5e16+0x1;return;}if(_0x7241fd[_0x4297('0x6f')]>_0x4c5e16){_0x591b50[_0x4297('0x6e')]=_0x7241fd[_0x4297('0x6f')];return;}return db['sequelize'][_0x4297('0x48')](_0x4297('0x70'),{'type':db[_0x4297('0x71')][_0x4297('0x72')][_0x4297('0x73')]})[_0x4297('0x19')](function(_0x1301dd){if(_0x1301dd&&_0x1301dd['length']){for(var _0x541c80=0x0,_0x1b7d13=_0x1301dd['length'];_0x541c80<_0x1b7d13&&_['isNil'](_0x591b50['internal']);_0x541c80++){if(_0x7241fd[_0x4297('0x6f')]<=_0x1301dd[_0x541c80][_0x4297('0x74')]){_0x591b50[_0x4297('0x6e')]=_0x1301dd[_0x541c80][_0x4297('0x74')];}else if(_0x7241fd[_0x4297('0x6f')]>_0x1301dd[_0x541c80][_0x4297('0x74')]&&_0x7241fd[_0x4297('0x6f')]<=_0x1301dd[_0x541c80]['to']){_0x591b50[_0x4297('0x6e')]=_0x7241fd[_0x4297('0x6f')];}}}if(_[_0x4297('0x6d')](_0x591b50[_0x4297('0x6e')])){_0x591b50[_0x4297('0x6e')]=_0x4c5e16+0x1;}return _0x81f128(_0x591b50);});});})[_0x4297('0x23')](function(_0x4dedcc){_0x2950f2(_0x4dedcc);});});}function updateUser(_0x4dda0a){return new Promise(function(_0x4f6d5e,_0x416d75){try{if(_0x4dda0a[_0x4297('0x75')]){_0x4dda0a['mailbox']=_0x4dda0a[_0x4297('0x6e')];_0x4dda0a['VoiceMail']={'mailbox':_0x4dda0a[_0x4297('0x6e')],'password':_0x4dda0a['password'],'fullname':_0x4dda0a[_0x4297('0x76')],'email':_0x4dda0a[_0x4297('0x77')]};}if(_0x4dda0a['role']==='agent'){if(!_0x4dda0a[_0x4297('0x78')])_0x4dda0a['permissions']=[_0x4297('0x79'),_0x4297('0x7a'),'103',_0x4297('0x7b'),'110',_0x4297('0x7c'),_0x4297('0x7d'),_0x4297('0x7e'),_0x4297('0x7f'),_0x4297('0x80'),_0x4297('0x81'),'100','111',_0x4297('0x82'),'115'];}_0x4f6d5e(_0x4dda0a);}catch(_0x5affc4){_0x416d75(_0x5affc4);}});}exports[_0x4297('0x83')]=function(_0x5ec213,_0x25e938){if(_0x5ec213[_0x4297('0x84')][_0x4297('0x31')]==='agent')throw new Error(_0x4297('0x85'));if(_0x5ec213[_0x4297('0x63')][_0x4297('0x31')]==='user'&&_0x5ec213[_0x4297('0x84')]['role']!==_0x4297('0x32')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x5ec213[_0x4297('0x63')][_0x4297('0x31')]==='admin'&&_0x5ec213[_0x4297('0x84')]['role']!==_0x4297('0x32')){throw new Error(_0x4297('0x86'));}return licenseUtil[_0x4297('0x87')]([_0x5ec213[_0x4297('0x63')]])[_0x4297('0x19')](function(){return validateUser(_0x5ec213[_0x4297('0x63')]);})[_0x4297('0x19')](function(_0x305fbd){return updateUser(_0x305fbd)[_0x4297('0x19')](function(_0x3a2242){if(_0x3a2242[_0x4297('0x31')]===_0x4297('0x32')){_0x3a2242[_0x4297('0x88')]=_0x5ec213['user'][_0x4297('0x88')];delete _0x3a2242[_0x4297('0x89')];}return _0x3a2242;});})[_0x4297('0x19')](function(_0x3006e5){return db[_0x4297('0x41')][_0x4297('0x83')](_0x3006e5,{'include':[{'model':db[_0x4297('0x8a')],'as':_0x4297('0x8a')}]});})['then'](function(_0x360ad4){if(_0x5ec213[_0x4297('0x63')][_0x4297('0x31')]===_0x4297('0x84'))return _0x360ad4;if(_0x5ec213['user']['role']!==_0x4297('0x84'))return _0x360ad4;return db[_0x4297('0x8b')][_0x4297('0x3c')]({'where':{'name':_0x360ad4['role']==='agent'?'Agents':_0x4297('0x36'),'userProfileId':_0x5ec213[_0x4297('0x84')]['userProfileId']},'raw':!![]})[_0x4297('0x19')](function(_0x3410a5){if(!_0x3410a5||_0x3410a5[_0x4297('0x8c')]!=0x0)return _0x360ad4;return db[_0x4297('0x3e')][_0x4297('0x83')]({'name':_0x360ad4[_0x4297('0x3d')],'resourceId':_0x360ad4['id'],'type':_0x3410a5[_0x4297('0x3d')],'sectionId':_0x3410a5['id']},{})[_0x4297('0x19')](function(){return _0x360ad4;});})['catch'](function(_0x29bc5e){logger[_0x4297('0x1f')](_0x4297('0x8d'),_0x29bc5e);throw _0x29bc5e;});})['then'](respondWithResult(_0x25e938,0xc9))['catch'](handleError(_0x25e938,null));};exports[_0x4297('0x8e')]=function(_0x5bd71f,_0x3ea11a){var _0x9abc35=_0x5bd71f[_0x4297('0x63')];var _0x3ab93e=[];if(_0x5bd71f[_0x4297('0x84')][_0x4297('0x31')]===_0x4297('0x35'))throw new Error('Unauthorized');if(_[_0x4297('0x8f')](_0x9abc35,[_0x4297('0x31'),_0x4297('0x84')])&&_0x5bd71f[_0x4297('0x84')][_0x4297('0x31')]!==_0x4297('0x32')){throw new Error(_0x4297('0x90'));}if(_[_0x4297('0x8f')](_0x9abc35,[_0x4297('0x31'),_0x4297('0x32')])&&_0x5bd71f['user'][_0x4297('0x31')]!==_0x4297('0x32')){throw new Error(_0x4297('0x91'));}return licenseUtil[_0x4297('0x87')](_0x9abc35)['then'](function(){return validateUser(_0x9abc35[0x0]);})[_0x4297('0x19')](function(){for(var _0x2d14cc=0x1;_0x2d14cc<_0x9abc35[_0x4297('0x5a')];_0x2d14cc++){var _0x41797a=_0x9abc35[_0x2d14cc-0x1]['internal'];if(!_0x9abc35[_0x2d14cc][_0x4297('0x6e')])_0x9abc35[_0x2d14cc][_0x4297('0x6e')]=_0x41797a+0x1;_0x3ab93e['push'](validateUser(_0x9abc35[_0x2d14cc]));}return Promise[_0x4297('0x52')](_0x3ab93e);})['then'](function(){_0x3ab93e=[];for(var _0x5bbb83=0x0;_0x5bbb83<_0x9abc35[_0x4297('0x5a')];_0x5bbb83++){_0x3ab93e[_0x4297('0x4d')](updateUser(_0x9abc35[_0x5bbb83]));}return Promise[_0x4297('0x52')](_0x3ab93e);})[_0x4297('0x19')](function(){_0x3ab93e=_0x9abc35['map'](function(_0x274947){return db['User']['create'](_0x274947,{'include':[{'model':db[_0x4297('0x8a')],'as':_0x4297('0x8a')}]})[_0x4297('0x19')](function(_0x5def37){_0x274947['id']=_0x5def37['id'];return _0x274947;});});return Promise[_0x4297('0x52')](_0x3ab93e);})[_0x4297('0x19')](function(_0x42e321){if(_0x5bd71f[_0x4297('0x63')][_0x4297('0x31')]===_0x4297('0x84'))return _0x42e321;if(_0x5bd71f[_0x4297('0x84')][_0x4297('0x31')]!=='user')return _0x42e321;var _0xd0f956=_['some'](_0x42e321,function(_0x5b1fa3){return _0x5b1fa3['role']===_0x4297('0x35')||_0x5b1fa3[_0x4297('0x31')]==='telephone';});if(!_0xd0f956)return _0x42e321;return db[_0x4297('0x8b')][_0x4297('0x4b')]({'where':{'name':{'$or':[_0x4297('0x34'),_0x4297('0x36')]},'userProfileId':_0x5bd71f['user'][_0x4297('0x89')]},'raw':!![]})['then'](function(_0x382959){if(_[_0x4297('0x92')](_0x382959)||!_[_0x4297('0x8f')](_0x382959,[_0x4297('0x8c'),0x0]))return _0x42e321;_0x3ab93e=[];var _0x285295=_(_0x382959)['map'](function(_0xa07ccf){if(_0xa07ccf[_0x4297('0x8c')]===0x1)return;return _0xa07ccf[_0x4297('0x3d')]===_0x4297('0x34')?_0x4297('0x35'):'telephone';})[_0x4297('0x93')]()[_0x4297('0x3b')]();for(var _0xd04f9a=0x0;_0xd04f9a<_0x42e321[_0x4297('0x5a')];_0xd04f9a++){if(!_[_0x4297('0x45')](_0x285295,_0x42e321[_0xd04f9a][_0x4297('0x31')]))return;var _0x24d75d=_0x42e321[_0xd04f9a][_0x4297('0x31')]===_0x4297('0x35')?_0x4297('0x34'):_0x4297('0x36');_0x3ab93e[_0x4297('0x4d')](db['UserProfileResource']['create']({'name':_0x42e321[_0xd04f9a][_0x4297('0x3d')],'resourceId':_0x42e321[_0xd04f9a]['id'],'type':_0x24d75d,'sectionId':_[_0x4297('0x3c')](_0x382959,[_0x4297('0x3d'),_0x24d75d])['id']},{}));}return Promise[_0x4297('0x52')](_0x3ab93e);});})[_0x4297('0x19')](respondWithResult(_0x3ea11a,0xc9))['catch'](handleError(_0x3ea11a,null));};exports[_0x4297('0x94')]=function(_0x43e5c7,_0x52a87b){if(_0x43e5c7[_0x4297('0x63')]['id']){delete _0x43e5c7['body']['id'];}return db[_0x4297('0x41')][_0x4297('0x3c')]({'where':{'id':_0x43e5c7[_0x4297('0x64')]['id']}})[_0x4297('0x19')](function(_0x499999){if(!_0x499999)return null;if(_0x499999['id']===_0x43e5c7[_0x4297('0x84')]['id']){if(!_0x43e5c7[_0x4297('0x63')]['oldPassword']||!_0x43e5c7['body']['newPassword']){throw new db['Sequelize'][(_0x4297('0x95'))](_0x4297('0x96'));}if(!_0x499999[_0x4297('0x97')](_0x43e5c7[_0x4297('0x63')][_0x4297('0x98')])){throw new db[(_0x4297('0x99'))]['ValidationError'](_0x4297('0x9a'));}if(_0x43e5c7[_0x4297('0x63')][_0x4297('0x98')]===_0x43e5c7[_0x4297('0x63')][_0x4297('0x9b')]){throw new db[(_0x4297('0x99'))][(_0x4297('0x95'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x43e5c7[_0x4297('0x84')][_0x4297('0x31')]==='admin'){if(!_0x43e5c7[_0x4297('0x63')][_0x4297('0x9b')]){throw new db[(_0x4297('0x99'))][(_0x4297('0x95'))](_0x4297('0x9c'));}}else if(_0x43e5c7[_0x4297('0x84')][_0x4297('0x31')]===_0x4297('0x84')){if(!_0x43e5c7[_0x4297('0x63')]['newPassword']){throw new db['Sequelize'][(_0x4297('0x95'))](_0x4297('0x9c'));}if(_0x499999[_0x4297('0x31')]!==_0x4297('0x35')){throw new db['Sequelize'][(_0x4297('0x95'))](_0x4297('0x85'));}}else{throw new db['Sequelize']['ValidationError'](_0x4297('0x85'));}return _0x499999;})[_0x4297('0x19')](handleEntityNotFound(_0x52a87b,null))[_0x4297('0x19')](function(_0x3182cc){return db[_0x4297('0x68')][_0x4297('0x9d')]({'attributes':['id','securePassword',_0x4297('0x9e'),_0x4297('0x9f')]})[_0x4297('0x19')](function(_0x474066){if(_0x474066['securePassword'])authService[_0x4297('0x6b')](_0x43e5c7['body']['newPassword']);if(!_0x474066['enforcePasswordHistory']||!_0x3182cc['previousPasswords'])return _0x3182cc;authService[_0x4297('0xa0')](_0x43e5c7[_0x4297('0x63')][_0x4297('0x9b')],_0x3182cc['previousPasswords'],_0x474066[_0x4297('0x9f')]);return _0x3182cc;})[_0x4297('0x19')](saveUpdates({'password':_0x43e5c7['body']['newPassword'],'passwordResetAt':_0x43e5c7['user']['id']==_0x43e5c7[_0x4297('0x64')]['id']?moment():null,'previousPasswords':authService[_0x4297('0xa1')](_0x43e5c7[_0x4297('0x63')]['newPassword'],_0x3182cc[_0x4297('0xa2')])},null));})[_0x4297('0x19')](respondWithResult(_0x52a87b,null))[_0x4297('0x23')](handleError(_0x52a87b,null));};exports['addQueues']=function(_0x522786,_0x36a5d7){var _0x49e446=_0x522786[_0x4297('0x63')][_0x4297('0xa3')];return db['User'][_0x4297('0x3c')]({'where':{'id':_0x522786[_0x4297('0x64')]['id']},'attributes':['id',_0x4297('0x3d'),_0x4297('0x31'),'online','loginInPause',_0x4297('0xa4'),_0x4297('0xa5')]})[_0x4297('0x19')](handleEntityNotFound(_0x36a5d7,null))[_0x4297('0x19')](function(_0x485eea){if(_0x485eea){if(!utils[_0x4297('0xa6')](_0x49e446)){throw new db['Sequelize'][(_0x4297('0x95'))]('Unknown\x20channel');}return _0x485eea['add'+_[_0x4297('0xa7')](_0x49e446[_0x4297('0xa8')]())+_0x4297('0xa9')](_0x522786[_0x4297('0x63')]['ids'],{'penalty':_0x522786['body'][_0x4297('0xaa')]||0x0})[_0x4297('0xab')](function(_0x42050c){for(var _0x1656a7=0x0;_0x1656a7<_0x522786['body'][_0x4297('0x67')]['length'];_0x1656a7+=0x1){var _0x3b8748={'UserId':Number(_0x522786[_0x4297('0x64')]['id'])};_0x3b8748[_[_0x4297('0xa7')](_0x49e446[_0x4297('0xa8')]())+_0x4297('0xac')]=Number(_0x522786[_0x4297('0x63')][_0x4297('0x67')][_0x1656a7]);socket[_0x4297('0x2e')](_0x4297('0x84')+_[_0x4297('0xa7')](_0x49e446[_0x4297('0xa8')]())+_0x4297('0xad'),_0x3b8748);}return _0x42050c;})['then'](function(){if(_0x49e446===_0x4297('0xae')){return db[_0x4297('0xaf')][_0x4297('0x4b')]({'where':{'id':_0x522786[_0x4297('0x63')][_0x4297('0x67')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x4297('0x19')](function(_0x5a860d){var _0x2b78a8=_0x485eea[_0x4297('0xb0')]({'plain':!![]});var _0x493d2e=[];if(_0x49e446==='voice'&&_0x2b78a8[_0x4297('0x31')]==='agent'&&_0x2b78a8[_0x4297('0xb1')]){for(let _0x49c2a1=0x0;_0x49c2a1<_0x5a860d[_0x4297('0x5a')];_0x49c2a1+=0x1){_0x493d2e['push']({'membername':_0x2b78a8[_0x4297('0x3d')],'UserId':_0x2b78a8['id'],'queue_name':_0x5a860d[_0x49c2a1][_0x4297('0x3d')],'VoiceQueueId':_0x5a860d[_0x49c2a1]['id'],'interface':_[_0x4297('0x6d')](_0x2b78a8[_0x4297('0xa5')])?util[_0x4297('0xb2')](_0x4297('0xb3'),_0x2b78a8[_0x4297('0x3d')]):_0x2b78a8[_0x4297('0xa5')],'paused':_0x2b78a8[_0x4297('0xa4')]||![],'penalty':_0x522786[_0x4297('0x63')][_0x4297('0xaa')]||0x0});}return Promise[_0x4297('0x52')](_0x493d2e[_0x4297('0x3a')](function(_0x1fd4e5){return db['UserVoiceQueueRt'][_0x4297('0xb4')](_0x1fd4e5);}));}return _0x485eea;});}})['then'](respondWithStatusCode(_0x36a5d7,null))[_0x4297('0x23')](handleError(_0x36a5d7,null));};exports[_0x4297('0xb5')]=function(_0x5c6bed,_0x20a21d){var _0x3df505,_0x1db29a;return db[_0x4297('0x41')][_0x4297('0x3c')]({'where':{'id':_0x5c6bed['params']['id']},'attributes':['id',_0x4297('0x3d'),_0x4297('0x31')]})[_0x4297('0x19')](handleEntityNotFound(_0x20a21d,null))[_0x4297('0x19')](function(_0x2bfc7e){if(_0x2bfc7e){_0x3df505=_0x2bfc7e;if(!_0x5c6bed['query'][_0x4297('0xa3')]||!utils[_0x4297('0xa6')](_0x5c6bed['query'][_0x4297('0xa3')])){throw new db[(_0x4297('0x99'))]['ValidationError'](_0x4297('0xb6'));}return _0x2bfc7e['remove'+_['capitalize'](_0x5c6bed['query'][_0x4297('0xa3')][_0x4297('0xa8')]())+_0x4297('0xa9')](_0x5c6bed[_0x4297('0x48')][_0x4297('0x67')]);}})[_0x4297('0x19')](function(_0x9255b5){if(_[_0x4297('0xb7')](_0x5c6bed['query'][_0x4297('0x67')])){for(var _0x46a97f=0x0;_0x46a97f<_0x5c6bed[_0x4297('0x48')][_0x4297('0x67')][_0x4297('0x5a')];_0x46a97f+=0x1){_0x1db29a={'UserId':Number(_0x5c6bed[_0x4297('0x64')]['id'])};_0x1db29a[_['capitalize'](_0x5c6bed[_0x4297('0x48')][_0x4297('0xa3')]['toLowerCase']())+_0x4297('0xac')]=Number(_0x5c6bed['query'][_0x4297('0x67')][_0x46a97f]);socket[_0x4297('0x2e')](_0x4297('0x84')+_[_0x4297('0xa7')](_0x5c6bed[_0x4297('0x48')]['channel']['toLowerCase']())+_0x4297('0xb8'),_0x1db29a);}}else{_0x1db29a={'UserId':Number(_0x5c6bed[_0x4297('0x64')]['id'])};_0x1db29a[_[_0x4297('0xa7')](_0x5c6bed[_0x4297('0x48')]['channel'][_0x4297('0xa8')]())+'QueueId']=Number(_0x5c6bed[_0x4297('0x48')][_0x4297('0x67')]);socket[_0x4297('0x2e')]('user'+_['capitalize'](_0x5c6bed[_0x4297('0x48')][_0x4297('0xa3')][_0x4297('0xa8')]())+_0x4297('0xb8'),_0x1db29a);}return _0x9255b5;})[_0x4297('0x19')](function(){if(_0x5c6bed[_0x4297('0x48')][_0x4297('0xa3')]===_0x4297('0xae')){return db[_0x4297('0xb9')][_0x4297('0x30')]({'where':{'UserId':_0x5c6bed[_0x4297('0x64')]['id'],'VoiceQueueId':_0x5c6bed['query'][_0x4297('0x67')]},'individualHooks':!![]})['then'](function(){return _0x3df505;});}return _0x3df505;})[_0x4297('0x19')](respondWithStatusCode(_0x20a21d,null))[_0x4297('0x23')](handleError(_0x20a21d,null));};exports[_0x4297('0xba')]=function(_0x1107ee,_0x5c7cdd){_0x1107ee[_0x4297('0x63')][_0x4297('0xbb')]=_0x1107ee[_0x4297('0xbc')][_0x4297('0xbd')];return db[_0x4297('0x41')][_0x4297('0x3c')]({'where':{'id':_0x1107ee[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x5c7cdd,null))[_0x4297('0x19')](saveUpdates(_0x1107ee['body'],null))['then'](respondWithResult(_0x5c7cdd,null))['catch'](handleError(_0x5c7cdd,null));};exports['getAvatar']=function(_0x135b15,_0x294426){var _0x183045=path[_0x4297('0xbe')](config[_0x4297('0xbf')],_0x4297('0xc0'));return db[_0x4297('0x41')][_0x4297('0x3c')]({'where':{'id':_0x135b15['params']['id']},'attributes':['id',_0x4297('0xbb')],'raw':!![]})[_0x4297('0x19')](handleEntityNotFound(_0x294426,null))[_0x4297('0x19')](function(_0x12c894){if(_0x12c894){if(_[_0x4297('0x6d')](_0x12c894[_0x4297('0xbb')])){return _0x294426[_0x4297('0xc1')](_0x183045);}else{if(!fs[_0x4297('0xc2')](path['join'](config[_0x4297('0xbf')],_0x4297('0xc3'),_0x12c894[_0x4297('0xbb')]))){return _0x294426[_0x4297('0xc1')](_0x183045);}return _0x294426[_0x4297('0xc1')](path['join'](config[_0x4297('0xbf')],_0x4297('0xc3'),_0x12c894[_0x4297('0xbb')]));}}})[_0x4297('0x23')](handleError(_0x294426,null));};exports[_0x4297('0xc4')]=function(_0x37a8f2,_0x75f7fc){return db[_0x4297('0x41')][_0x4297('0x3c')]({'where':{'id':_0x37a8f2[_0x4297('0x64')]['id']},'attributes':['id']})[_0x4297('0x19')](handleEntityNotFound(_0x75f7fc,null))[_0x4297('0x19')](function(_0x108c5b){var _0x4cd39f=[];values=_0x108c5b[_0x4297('0x50')];_0x4cd39f[_0x4297('0x4d')](get_open_tabs(_0x4297('0x4e'),_0x108c5b['dataValues']));_0x4cd39f[_0x4297('0x4d')](get_open_tabs(_0x4297('0x4f'),_0x108c5b[_0x4297('0x50')]));_0x4cd39f[_0x4297('0x4d')](get_open_tabs(_0x4297('0x60'),_0x108c5b[_0x4297('0x50')]));_0x4cd39f['push'](get_open_tabs(_0x4297('0xc5'),_0x108c5b[_0x4297('0x50')]));_0x4cd39f[_0x4297('0x4d')](get_open_tabs('fax',_0x108c5b['dataValues']));_0x4cd39f['push'](get_open_tabs(_0x4297('0x51'),_0x108c5b['dataValues']));return Promise[_0x4297('0x52')](_0x4cd39f);})['then'](function(_0x235757){if(_0x235757){var _0x8ab2c6=_[_0x4297('0x3a')](values[_0x4297('0xc6')],function(_0x2a2fef){return{'channel':_0x4297('0xc7'),'id':_0x2a2fef['id'],'createdAt':_0x2a2fef[_0x4297('0xc8')]};});var _0x609b71=_[_0x4297('0x3a')](values['FaxOpenTabs'],function(_0x1c8469){return{'channel':_0x4297('0xc9'),'id':_0x1c8469['id'],'createdAt':_0x1c8469['createdAt']};});var _0x21eea9=_[_0x4297('0x3a')](values[_0x4297('0xca')],function(_0x11b713){return{'channel':_0x4297('0xcb'),'id':_0x11b713['id'],'createdAt':_0x11b713[_0x4297('0xc8')]};});var _0x4e10d8=_[_0x4297('0x3a')](values[_0x4297('0xcc')],function(_0x3cba2a){return{'channel':_0x4297('0xcd'),'id':_0x3cba2a['id'],'createdAt':_0x3cba2a['createdAt']};});var _0x5a5a2b=_[_0x4297('0x3a')](values[_0x4297('0xce')],function(_0x3a405f){return{'channel':_0x4297('0xcf'),'id':_0x3a405f['id'],'createdAt':_0x3a405f['createdAt']};});var _0x2fa63d=_[_0x4297('0x3a')](values['WhatsappOpenTabs'],function(_0x17a07a){return{'channel':'WHATSAPP','id':_0x17a07a['id'],'createdAt':_0x17a07a['createdAt']};});var _0x5a0df3=_[_0x4297('0xd0')](_0x8ab2c6,_0x609b71,_0x21eea9,_0x4e10d8,_0x5a5a2b,_0x2fa63d);var _0x38ab5b={'count':_0x5a0df3[_0x4297('0x5a')],'rows':_0x5a0df3};return _0x38ab5b;}else return null;})['then'](respondWithResult(_0x75f7fc,null))[_0x4297('0x23')](handleError(_0x75f7fc,null));};exports[_0x4297('0xd1')]=function(_0x241953,_0x4b1b52){var _0x33de33={};var _0x5ca46f={};var _0x2d074b;var _0x1c4e2a;return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x241953['params']['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x4b1b52,null))['then'](function(_0x2d5f8c){if(_0x2d5f8c){_0x2d074b=_0x2d5f8c;_0x5ca46f['model']=_['keys'](db[_0x4297('0xd2')][_0x4297('0x42')]);_0x5ca46f['query']=_[_0x4297('0x56')](_0x241953[_0x4297('0x48')]);_0x5ca46f[_0x4297('0xd3')]=_[_0x4297('0x57')](_0x5ca46f[_0x4297('0x53')],_0x5ca46f[_0x4297('0x48')]);_0x33de33[_0x4297('0x58')]=_[_0x4297('0x57')](_0x5ca46f[_0x4297('0x53')],qs[_0x4297('0x59')](_0x241953[_0x4297('0x48')][_0x4297('0x59')]));_0x33de33[_0x4297('0x58')]=_0x33de33[_0x4297('0x58')][_0x4297('0x5a')]?_0x33de33[_0x4297('0x58')]:_0x5ca46f[_0x4297('0x53')];_0x33de33[_0x4297('0xd4')]=qs['sort'](_0x241953[_0x4297('0x48')][_0x4297('0xd5')]);_0x33de33['where']=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x241953[_0x4297('0x48')],_0x5ca46f[_0x4297('0xd3')]));if(_0x241953['query'][_0x4297('0x38')]){_0x33de33['where']=_['merge'](_0x33de33[_0x4297('0x46')],{'$or':_['map'](_0x33de33['attributes'],function(_0x298d3b){var _0xc4499c={};_0xc4499c[_0x298d3b]={'$like':'%'+_0x241953[_0x4297('0x48')][_0x4297('0x38')]+'%'};return _0xc4499c;})});}_0x33de33=_[_0x4297('0x5d')]({},_0x33de33,_0x241953['options']);return _0x2d074b[_0x4297('0xd1')](_0x33de33);}})[_0x4297('0x19')](function(_0x5eebb8){if(_0x5eebb8){_0x1c4e2a=_0x5eebb8[_0x4297('0x5a')];if(_0x241953[_0x4297('0x48')][_0x4297('0xd7')](_0x4297('0x5b'))){_0x33de33[_0x4297('0x47')]=[{'model':db[_0x4297('0xd8')],'as':_0x4297('0xd9'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x4297('0x3d'),_0x4297('0xda')],'where':_0x241953['query']['tag']?{'id':_0x241953[_0x4297('0x48')][_0x4297('0xdb')]}:undefined,'required':_0x241953[_0x4297('0x48')][_0x4297('0xdb')]?!![]:![]}];}if(!_0x241953[_0x4297('0x48')][_0x4297('0xd7')](_0x4297('0xdc'))){_0x33de33[_0x4297('0x29')]=qs[_0x4297('0x29')](_0x241953[_0x4297('0x48')][_0x4297('0x29')]);_0x33de33[_0x4297('0x2a')]=qs[_0x4297('0x2a')](_0x241953[_0x4297('0x48')][_0x4297('0x2a')]);}return _0x2d074b[_0x4297('0xd1')](_0x33de33);}})['then'](function(_0x24d6ce){if(_0x24d6ce){return _0x24d6ce?{'count':_0x1c4e2a,'rows':_0x24d6ce}:null;}})[_0x4297('0x19')](respondWithResult(_0x4b1b52,null))[_0x4297('0x23')](handleError(_0x4b1b52,null));};exports[_0x4297('0xdd')]=function(_0x33ab6e,_0xc3f3c6){var _0x204385;var _0x1ee7fd={};var _0x2a8feb;return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x33ab6e[_0x4297('0x64')]['id']},'attributes':['id',_0x4297('0x3d'),_0x4297('0x31')]})[_0x4297('0x19')](handleEntityNotFound(_0xc3f3c6,null))[_0x4297('0x19')](function(_0x94c74c){if(!utils[_0x4297('0xa6')](_0x33ab6e[_0x4297('0x48')][_0x4297('0xa3')])){throw new db['Sequelize'][(_0x4297('0x95'))](_0x4297('0xb6'));}_0x204385=_0x94c74c;var _0x4e45ec={};_0x4e45ec[_0x4297('0x53')]=_[_0x4297('0x56')](db[_[_0x4297('0xa7')](_0x33ab6e[_0x4297('0x48')][_0x4297('0xa3')])+_0x4297('0xde')][_0x4297('0x42')]);_0x4e45ec[_0x4297('0x48')]=_[_0x4297('0x56')](_0x33ab6e[_0x4297('0x48')]);_0x4e45ec[_0x4297('0xd3')]=_['intersection'](_0x4e45ec[_0x4297('0x53')],_0x4e45ec[_0x4297('0x48')]);_0x1ee7fd[_0x4297('0x58')]=_['intersection'](_0x4e45ec['model'],qs[_0x4297('0x59')](_0x33ab6e[_0x4297('0x48')]['fields']));_0x1ee7fd['attributes']=_0x1ee7fd[_0x4297('0x58')]['length']?_0x1ee7fd[_0x4297('0x58')]:_0x4e45ec[_0x4297('0x53')];_0x1ee7fd[_0x4297('0xd4')]=qs['sort'](_0x33ab6e[_0x4297('0x48')][_0x4297('0xd5')]);_0x1ee7fd[_0x4297('0x46')]=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x33ab6e[_0x4297('0x48')],_0x4e45ec[_0x4297('0xd3')]));if(_0x33ab6e[_0x4297('0x48')][_0x4297('0x38')]){_0x1ee7fd[_0x4297('0x46')]=_[_0x4297('0x5d')](_0x1ee7fd['where'],{'$or':_[_0x4297('0x3a')](_0x1ee7fd[_0x4297('0x58')],function(_0x20c8b9){var _0x51ee9b={};_0x51ee9b[_0x20c8b9]={'$like':'%'+_0x33ab6e[_0x4297('0x48')][_0x4297('0x38')]+'%'};return _0x51ee9b;})});}_0x1ee7fd=_['merge']({},_0x1ee7fd,_0x33ab6e['options']);switch(_0x204385['role']){case'admin':return db[_[_0x4297('0xa7')](_0x33ab6e[_0x4297('0x48')][_0x4297('0xa3')])+'Queue'][_0x4297('0x4b')](_0x1ee7fd);case _0x4297('0x84'):case _0x4297('0x35'):return _0x204385['get'+_[_0x4297('0xa7')](_0x33ab6e[_0x4297('0x48')][_0x4297('0xa3')])+_0x4297('0xa9')](_0x1ee7fd);default:throw new db[(_0x4297('0x99'))][(_0x4297('0x95'))]('Unknown\x20role');}})[_0x4297('0x19')](function(_0x3f16d9){_0x2a8feb=_0x3f16d9[_0x4297('0x5a')];if(!_0x33ab6e[_0x4297('0x48')][_0x4297('0xd7')](_0x4297('0xdc'))){_0x1ee7fd[_0x4297('0x29')]=qs[_0x4297('0x29')](_0x33ab6e[_0x4297('0x48')][_0x4297('0x29')]);_0x1ee7fd['offset']=qs[_0x4297('0x2a')](_0x33ab6e['query'][_0x4297('0x2a')]);}switch(_0x204385[_0x4297('0x31')]){case'admin':return db[_['capitalize'](_0x33ab6e['query'][_0x4297('0xa3')])+_0x4297('0xde')][_0x4297('0x4b')](_0x1ee7fd);case _0x4297('0x84'):case _0x4297('0x35'):return _0x204385[_0x4297('0xb0')+_[_0x4297('0xa7')](_0x33ab6e[_0x4297('0x48')]['channel'])+_0x4297('0xa9')](_0x1ee7fd);}})[_0x4297('0x19')](function(_0x40aff8){return{'count':_0x2a8feb,'rows':_0x40aff8};})[_0x4297('0x19')](respondWithResult(_0xc3f3c6,null))[_0x4297('0x23')](handleError(_0xc3f3c6,null));};exports[_0x4297('0xdf')]=function(_0x242cb9,_0x2db886){var _0x138c4d={};var _0x29432c={};var _0x1fe52f;var _0x5e62c9;return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x242cb9[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x2db886,null))[_0x4297('0x19')](function(_0x5491d8){if(_0x5491d8){_0x1fe52f=_0x5491d8;_0x29432c[_0x4297('0x53')]=_[_0x4297('0x56')](db[_0x4297('0xb9')][_0x4297('0x42')]);_0x29432c[_0x4297('0x48')]=_[_0x4297('0x56')](_0x242cb9[_0x4297('0x48')]);_0x29432c[_0x4297('0xd3')]=_['intersection'](_0x29432c['model'],_0x29432c[_0x4297('0x48')]);_0x138c4d[_0x4297('0x58')]=_[_0x4297('0x57')](_0x29432c[_0x4297('0x53')],qs[_0x4297('0x59')](_0x242cb9[_0x4297('0x48')]['fields']));_0x138c4d['attributes']=_0x138c4d[_0x4297('0x58')][_0x4297('0x5a')]?_0x138c4d[_0x4297('0x58')]:_0x29432c[_0x4297('0x53')];_0x138c4d['order']=qs[_0x4297('0xd5')](_0x242cb9[_0x4297('0x48')]['sort']);_0x138c4d[_0x4297('0x46')]=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x242cb9['query'],_0x29432c[_0x4297('0xd3')]));if(_0x242cb9[_0x4297('0x48')][_0x4297('0x38')]){_0x138c4d[_0x4297('0x46')]=_[_0x4297('0x5d')](_0x138c4d[_0x4297('0x46')],{'$or':_['map'](_0x138c4d[_0x4297('0x58')],function(_0x4a8a77){var _0x5e4724={};_0x5e4724[_0x4a8a77]={'$like':'%'+_0x242cb9['query'][_0x4297('0x38')]+'%'};return _0x5e4724;})});}_0x138c4d=_[_0x4297('0x5d')]({},_0x138c4d,_0x242cb9[_0x4297('0x5e')]);return _0x1fe52f[_0x4297('0xdf')](_0x138c4d);}})['then'](function(_0x46241a){if(_0x46241a){_0x5e62c9=_0x46241a['length'];if(!_0x242cb9['query'][_0x4297('0xd7')](_0x4297('0xdc'))){_0x138c4d[_0x4297('0x29')]=qs['limit'](_0x242cb9[_0x4297('0x48')]['limit']);_0x138c4d[_0x4297('0x2a')]=qs[_0x4297('0x2a')](_0x242cb9['query'][_0x4297('0x2a')]);}return _0x1fe52f[_0x4297('0xdf')](_0x138c4d);}})[_0x4297('0x19')](function(_0x42f93b){if(_0x42f93b){return _0x42f93b?{'count':_0x5e62c9,'rows':_0x42f93b}:null;}})[_0x4297('0x19')](respondWithResult(_0x2db886,null))[_0x4297('0x23')](handleError(_0x2db886,null));};exports[_0x4297('0xe0')]=function(_0x4f86b8,_0x99f71b){var _0x4086e5={};var _0x30bc4a={};var _0x5f464a;var _0x1bcf4a;return db['User'][_0x4297('0x9d')]({'where':{'id':_0x4f86b8[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x99f71b,null))[_0x4297('0x19')](function(_0x18dbba){if(_0x18dbba){_0x5f464a=_0x18dbba;_0x30bc4a[_0x4297('0x53')]=_[_0x4297('0x56')](db['ChatGroup'][_0x4297('0x42')]);_0x30bc4a[_0x4297('0x48')]=_['keys'](_0x4f86b8[_0x4297('0x48')]);_0x30bc4a[_0x4297('0xd3')]=_[_0x4297('0x57')](_0x30bc4a[_0x4297('0x53')],_0x30bc4a[_0x4297('0x48')]);_0x4086e5[_0x4297('0x58')]=_[_0x4297('0x57')](_0x30bc4a[_0x4297('0x53')],qs['fields'](_0x4f86b8[_0x4297('0x48')][_0x4297('0x59')]));_0x4086e5[_0x4297('0x58')]=_0x4086e5['attributes'][_0x4297('0x5a')]?_0x4086e5[_0x4297('0x58')]:_0x30bc4a['model'];_0x4086e5[_0x4297('0xd4')]=qs[_0x4297('0xd5')](_0x4f86b8[_0x4297('0x48')][_0x4297('0xd5')]);_0x4086e5[_0x4297('0x46')]=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x4f86b8['query'],_0x30bc4a[_0x4297('0xd3')]));if(_0x4f86b8['query'][_0x4297('0x38')]){_0x4086e5[_0x4297('0x46')]=_[_0x4297('0x5d')](_0x4086e5[_0x4297('0x46')],{'$or':_[_0x4297('0x3a')](_0x4086e5['attributes'],function(_0x4edeec){var _0x336290={};_0x336290[_0x4edeec]={'$like':'%'+_0x4f86b8[_0x4297('0x48')][_0x4297('0x38')]+'%'};return _0x336290;})});}_0x4086e5=_[_0x4297('0x5d')]({},_0x4086e5,_0x4f86b8[_0x4297('0x5e')]);return _0x5f464a[_0x4297('0xe0')](_0x4086e5);}})[_0x4297('0x19')](function(_0x2feac8){if(_0x2feac8){_0x1bcf4a=_0x2feac8['length'];if(!_0x4f86b8[_0x4297('0x48')][_0x4297('0xd7')](_0x4297('0xdc'))){_0x4086e5[_0x4297('0x29')]=qs[_0x4297('0x29')](_0x4f86b8[_0x4297('0x48')][_0x4297('0x29')]);_0x4086e5[_0x4297('0x2a')]=qs[_0x4297('0x2a')](_0x4f86b8[_0x4297('0x48')][_0x4297('0x2a')]);}return _0x5f464a[_0x4297('0xe0')](_0x4086e5);}})[_0x4297('0x19')](function(_0x15c16c){if(_0x15c16c){return _0x15c16c?{'count':_0x1bcf4a,'rows':_0x15c16c}:null;}})['then'](respondWithResult(_0x99f71b,null))['catch'](handleError(_0x99f71b,null));};exports[_0x4297('0xe1')]=function(_0x492686,_0x48a897){var _0x102db5={'raw':!![],'where':{}};var _0x2ef6c3={};var _0x16b2b2={'count':0x0,'rows':[]};return db[_0x4297('0x41')]['findOne']({'where':{'id':_0x492686[_0x4297('0x64')]['id']}})['then'](handleEntityNotFound(_0x48a897,null))[_0x4297('0x19')](function(_0x2c7114){if(_0x2c7114){_0x2ef6c3[_0x4297('0x53')]=_[_0x4297('0x56')](db['VoiceRecording']['rawAttributes']);_0x2ef6c3[_0x4297('0x48')]=_[_0x4297('0x56')](_0x492686[_0x4297('0x48')]);_0x2ef6c3[_0x4297('0xd3')]=_[_0x4297('0x57')](_0x2ef6c3['model'],_0x2ef6c3[_0x4297('0x48')]);_0x102db5['attributes']=_['intersection'](_0x2ef6c3[_0x4297('0x53')],qs[_0x4297('0x59')](_0x492686[_0x4297('0x48')][_0x4297('0x59')]));_0x102db5[_0x4297('0x58')]=_0x102db5[_0x4297('0x58')]['length']?_0x102db5[_0x4297('0x58')]:_0x2ef6c3[_0x4297('0x53')];if(!_0x492686[_0x4297('0x48')][_0x4297('0xd7')](_0x4297('0xdc'))){_0x102db5[_0x4297('0x29')]=qs[_0x4297('0x29')](_0x492686[_0x4297('0x48')][_0x4297('0x29')]);_0x102db5['offset']=qs[_0x4297('0x2a')](_0x492686[_0x4297('0x48')][_0x4297('0x2a')]);}_0x102db5[_0x4297('0xd4')]=qs['sort'](_0x492686[_0x4297('0x48')][_0x4297('0xd5')]);_0x102db5[_0x4297('0x46')]=qs[_0x4297('0xd3')](_['pick'](_0x492686['query'],_0x2ef6c3[_0x4297('0xd3')]));_0x102db5[_0x4297('0x46')][_0x4297('0xe2')]=_0x2c7114['id'];if(_0x492686['query'][_0x4297('0x38')]){_0x102db5[_0x4297('0x46')]=_['merge'](_0x102db5['where'],{'$or':_[_0x4297('0x3a')](_0x102db5['attributes'],function(_0x1860b4){var _0x4db1cf={};_0x4db1cf[_0x1860b4]={'$like':'%'+_0x492686[_0x4297('0x48')][_0x4297('0x38')]+'%'};return _0x4db1cf;})});}_0x102db5=_[_0x4297('0x5d')]({},_0x102db5,_0x492686[_0x4297('0x5e')]);return db['VoiceRecording'][_0x4297('0x2b')]({'where':_0x102db5[_0x4297('0x46')]})[_0x4297('0x19')](function(_0x1d8860){_0x16b2b2[_0x4297('0x2b')]=_0x1d8860;if(_0x492686[_0x4297('0x48')][_0x4297('0x5b')]){_0x102db5[_0x4297('0x47')]=[{'all':!![]}];}return db['VoiceRecording'][_0x4297('0x4b')](_0x102db5);})[_0x4297('0x19')](function(_0x56f0ec){_0x16b2b2[_0x4297('0x4c')]=_0x56f0ec;return _0x16b2b2;});}})[_0x4297('0x19')](respondWithFilteredResult(_0x48a897,_0x102db5))[_0x4297('0x23')](handleError(_0x48a897,null));};exports[_0x4297('0xe3')]=function(_0xa85e3d,_0x488389){var _0x2d4fa7={'raw':!![],'where':{}};var _0x31ebcf={};var _0x31b204={'count':0x0,'rows':[]};return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0xa85e3d[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x488389,null))['then'](function(_0x21e7f3){if(_0x21e7f3){_0x31ebcf[_0x4297('0x53')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x31ebcf[_0x4297('0x48')]=_['keys'](_0xa85e3d[_0x4297('0x48')]);_0x31ebcf[_0x4297('0xd3')]=_[_0x4297('0x57')](_0x31ebcf['model'],_0x31ebcf[_0x4297('0x48')]);_0x2d4fa7[_0x4297('0x58')]=_[_0x4297('0x57')](_0x31ebcf[_0x4297('0x53')],qs['fields'](_0xa85e3d[_0x4297('0x48')]['fields']));_0x2d4fa7[_0x4297('0x58')]=_0x2d4fa7[_0x4297('0x58')][_0x4297('0x5a')]?_0x2d4fa7[_0x4297('0x58')]:_0x31ebcf[_0x4297('0x53')];if(!_0xa85e3d[_0x4297('0x48')]['hasOwnProperty'](_0x4297('0xdc'))){_0x2d4fa7[_0x4297('0x29')]=qs[_0x4297('0x29')](_0xa85e3d[_0x4297('0x48')][_0x4297('0x29')]);_0x2d4fa7[_0x4297('0x2a')]=qs[_0x4297('0x2a')](_0xa85e3d[_0x4297('0x48')][_0x4297('0x2a')]);}_0x2d4fa7['order']=qs['sort'](_0xa85e3d['query'][_0x4297('0xd5')]);_0x2d4fa7['where']=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0xa85e3d[_0x4297('0x48')],_0x31ebcf[_0x4297('0xd3')]));_0x2d4fa7[_0x4297('0x46')][_0x4297('0xe2')]=_0x21e7f3['id'];if(_0xa85e3d[_0x4297('0x48')][_0x4297('0x38')]){_0x2d4fa7[_0x4297('0x46')]=_['merge'](_0x2d4fa7[_0x4297('0x46')],{'$or':_['map'](_0x2d4fa7[_0x4297('0x58')],function(_0x2578e4){var _0xd80039={};_0xd80039[_0x2578e4]={'$like':'%'+_0xa85e3d[_0x4297('0x48')]['filter']+'%'};return _0xd80039;})});}_0x2d4fa7=_[_0x4297('0x5d')]({},_0x2d4fa7,_0xa85e3d[_0x4297('0x5e')]);return db['ScreenRecording'][_0x4297('0x2b')]({'where':_0x2d4fa7[_0x4297('0x46')]})[_0x4297('0x19')](function(_0x176abd){_0x31b204[_0x4297('0x2b')]=_0x176abd;if(_0xa85e3d[_0x4297('0x48')][_0x4297('0x5b')]){_0x2d4fa7[_0x4297('0x47')]=[{'all':!![]}];}return db[_0x4297('0xe4')][_0x4297('0x4b')](_0x2d4fa7);})['then'](function(_0x27c503){_0x31b204[_0x4297('0x4c')]=_0x27c503;return _0x31b204;});}})[_0x4297('0x19')](respondWithFilteredResult(_0x488389,_0x2d4fa7))[_0x4297('0x23')](handleError(_0x488389,null));};exports[_0x4297('0xe5')]=function(_0x2bab91,_0x34570f){var _0x4fc24b={};var _0x57b126={};var _0x5f78eb;var _0x2fe4fc;return db['User'][_0x4297('0x9d')]({'where':{'id':_0x2bab91[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x34570f,null))[_0x4297('0x19')](function(_0x236d3a){if(_0x236d3a){_0x5f78eb=_0x236d3a;_0x57b126[_0x4297('0x53')]=_[_0x4297('0x56')](db['ChatInteraction'][_0x4297('0x42')]);_0x57b126[_0x4297('0x48')]=_[_0x4297('0x56')](_0x2bab91[_0x4297('0x48')]);_0x57b126[_0x4297('0xd3')]=_[_0x4297('0x57')](_0x57b126[_0x4297('0x53')],_0x57b126[_0x4297('0x48')]);_0x4fc24b['attributes']=_[_0x4297('0x57')](_0x57b126['model'],qs[_0x4297('0x59')](_0x2bab91[_0x4297('0x48')][_0x4297('0x59')]));_0x4fc24b[_0x4297('0x58')]=_0x4fc24b['attributes']['length']?_0x4fc24b[_0x4297('0x58')]:_0x57b126[_0x4297('0x53')];_0x4fc24b['order']=qs['sort'](_0x2bab91[_0x4297('0x48')][_0x4297('0xd5')]);_0x4fc24b[_0x4297('0x46')]=qs['filters'](_[_0x4297('0xd6')](_0x2bab91[_0x4297('0x48')],_0x57b126[_0x4297('0xd3')]));if(_0x2bab91[_0x4297('0x48')][_0x4297('0x38')]){_0x4fc24b[_0x4297('0x46')]=_[_0x4297('0x5d')](_0x4fc24b[_0x4297('0x46')],{'$or':_[_0x4297('0x3a')](_0x4fc24b[_0x4297('0x58')],function(_0x4f2b44){var _0x1e8de5={};_0x1e8de5[_0x4f2b44]={'$like':'%'+_0x2bab91[_0x4297('0x48')][_0x4297('0x38')]+'%'};return _0x1e8de5;})});}_0x4fc24b=_[_0x4297('0x5d')]({},_0x4fc24b,_0x2bab91[_0x4297('0x5e')]);return _0x5f78eb['getChatInteractions'](_0x4fc24b);}})[_0x4297('0x19')](function(_0x1cbbca){if(_0x1cbbca){_0x2fe4fc=_0x1cbbca['length'];if(!_0x2bab91[_0x4297('0x48')][_0x4297('0xd7')](_0x4297('0xdc'))){_0x4fc24b['limit']=qs['limit'](_0x2bab91[_0x4297('0x48')]['limit']);_0x4fc24b['offset']=qs[_0x4297('0x2a')](_0x2bab91[_0x4297('0x48')][_0x4297('0x2a')]);}return _0x5f78eb[_0x4297('0xe5')](_0x4fc24b);}})[_0x4297('0x19')](function(_0x1d735d){if(_0x1d735d){return _0x1d735d?{'count':_0x2fe4fc,'rows':_0x1d735d}:null;}})[_0x4297('0x19')](respondWithResult(_0x34570f,null))[_0x4297('0x23')](handleError(_0x34570f,null));};exports[_0x4297('0xe6')]=function(_0x4d1312,_0x53fa1d){var _0x2ea765={};var _0xdce734={};var _0x7b616e;var _0x367593;return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x4d1312[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x53fa1d,null))[_0x4297('0x19')](function(_0x2a30ea){if(_0x2a30ea){_0x7b616e=_0x2a30ea;_0xdce734['model']=_[_0x4297('0x56')](db[_0x4297('0xe7')][_0x4297('0x42')]);_0xdce734['query']=_[_0x4297('0x56')](_0x4d1312[_0x4297('0x48')]);_0xdce734['filters']=_['intersection'](_0xdce734[_0x4297('0x53')],_0xdce734[_0x4297('0x48')]);_0x2ea765[_0x4297('0x58')]=_[_0x4297('0x57')](_0xdce734[_0x4297('0x53')],qs[_0x4297('0x59')](_0x4d1312[_0x4297('0x48')][_0x4297('0x59')]));_0x2ea765[_0x4297('0x58')]=_0x2ea765[_0x4297('0x58')][_0x4297('0x5a')]?_0x2ea765[_0x4297('0x58')]:_0xdce734[_0x4297('0x53')];_0x2ea765[_0x4297('0xd4')]=qs[_0x4297('0xd5')](_0x4d1312['query'][_0x4297('0xd5')]);_0x2ea765[_0x4297('0x46')]=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x4d1312[_0x4297('0x48')],_0xdce734[_0x4297('0xd3')]));if(_0x4d1312[_0x4297('0x48')][_0x4297('0x38')]){_0x2ea765[_0x4297('0x46')]=_[_0x4297('0x5d')](_0x2ea765[_0x4297('0x46')],{'$or':_[_0x4297('0x3a')](_0x2ea765['attributes'],function(_0x41d927){var _0x65327d={};_0x65327d[_0x41d927]={'$like':'%'+_0x4d1312[_0x4297('0x48')][_0x4297('0x38')]+'%'};return _0x65327d;})});}_0x2ea765=_[_0x4297('0x5d')]({},_0x2ea765,_0x4d1312[_0x4297('0x5e')]);return _0x7b616e[_0x4297('0xe6')](_0x2ea765);}})['then'](function(_0x58a8da){if(_0x58a8da){_0x367593=_0x58a8da[_0x4297('0x5a')];if(!_0x4d1312['query'][_0x4297('0xd7')](_0x4297('0xdc'))){_0x2ea765[_0x4297('0x29')]=qs[_0x4297('0x29')](_0x4d1312[_0x4297('0x48')][_0x4297('0x29')]);_0x2ea765[_0x4297('0x2a')]=qs[_0x4297('0x2a')](_0x4d1312[_0x4297('0x48')]['offset']);}return _0x7b616e[_0x4297('0xe6')](_0x2ea765);}})[_0x4297('0x19')](function(_0x142f4f){if(_0x142f4f){return _0x142f4f?{'count':_0x367593,'rows':_0x142f4f}:null;}})[_0x4297('0x19')](respondWithResult(_0x53fa1d,null))[_0x4297('0x23')](handleError(_0x53fa1d,null));};exports[_0x4297('0xe8')]=function(_0x3dbfb3,_0x98c0d9){var _0x212c94={'raw':!![],'where':{}};var _0x150efa={};var _0x4ca29e={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x3dbfb3[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x98c0d9,null))[_0x4297('0x19')](function(_0x3e4d0b){if(_0x3e4d0b){_0x150efa[_0x4297('0x53')]=_['keys'](db[_0x4297('0xe9')][_0x4297('0x42')]);_0x150efa[_0x4297('0x48')]=_[_0x4297('0x56')](_0x3dbfb3[_0x4297('0x48')]);_0x150efa[_0x4297('0xd3')]=_['intersection'](_0x150efa['model'],_0x150efa[_0x4297('0x48')]);_0x212c94[_0x4297('0x58')]=_['intersection'](_0x150efa[_0x4297('0x53')],qs['fields'](_0x3dbfb3[_0x4297('0x48')][_0x4297('0x59')]));_0x212c94[_0x4297('0x58')]=_0x212c94[_0x4297('0x58')][_0x4297('0x5a')]?_0x212c94[_0x4297('0x58')]:_0x150efa[_0x4297('0x53')];if(!_0x3dbfb3['query']['hasOwnProperty'](_0x4297('0xdc'))){_0x212c94[_0x4297('0x29')]=qs['limit'](_0x3dbfb3[_0x4297('0x48')][_0x4297('0x29')]);_0x212c94[_0x4297('0x2a')]=qs[_0x4297('0x2a')](_0x3dbfb3['query'][_0x4297('0x2a')]);}_0x212c94[_0x4297('0xd4')]=qs[_0x4297('0xd5')](_0x3dbfb3['query'][_0x4297('0xd5')]);_0x212c94[_0x4297('0x46')]=qs[_0x4297('0xd3')](_['pick'](_0x3dbfb3['query'],_0x150efa[_0x4297('0xd3')]));_0x212c94[_0x4297('0x46')]['UserId']=_0x3e4d0b['id'];if(_0x3dbfb3[_0x4297('0x48')][_0x4297('0x38')]){_0x212c94[_0x4297('0x46')]=_['merge'](_0x212c94['where'],{'$or':_['map'](_0x212c94['attributes'],function(_0x10b36b){var _0xcb79b2={};_0xcb79b2[_0x10b36b]={'$like':'%'+_0x3dbfb3[_0x4297('0x48')][_0x4297('0x38')]+'%'};return _0xcb79b2;})});}_0x212c94=_['merge']({},_0x212c94,_0x3dbfb3[_0x4297('0x5e')]);return db['MailInteraction'][_0x4297('0x2b')]({'where':_0x212c94['where']})[_0x4297('0x19')](function(_0x3cbb8b){_0x4ca29e[_0x4297('0x2b')]=_0x3cbb8b;if(_0x3dbfb3['query']['includeAll']){_0x212c94[_0x4297('0x47')]=[{'all':!![]}];}return db[_0x4297('0xe9')]['findAll'](_0x212c94);})[_0x4297('0x19')](function(_0x1fe3bc){_0x4ca29e[_0x4297('0x4c')]=_0x1fe3bc;return _0x4ca29e;});}})[_0x4297('0x19')](respondWithFilteredResult(_0x98c0d9,_0x212c94))[_0x4297('0x23')](handleError(_0x98c0d9,null));};exports['getSmsInteractions']=function(_0x3c382a,_0x3525d8){var _0x2db818={};var _0x160131={};var _0x2b8fef;var _0x4887dc;return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x3c382a[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x3525d8,null))[_0x4297('0x19')](function(_0x4176f6){if(_0x4176f6){_0x2b8fef=_0x4176f6;_0x160131[_0x4297('0x53')]=_[_0x4297('0x56')](db[_0x4297('0xea')][_0x4297('0x42')]);_0x160131[_0x4297('0x48')]=_[_0x4297('0x56')](_0x3c382a[_0x4297('0x48')]);_0x160131[_0x4297('0xd3')]=_[_0x4297('0x57')](_0x160131['model'],_0x160131['query']);_0x2db818[_0x4297('0x58')]=_[_0x4297('0x57')](_0x160131[_0x4297('0x53')],qs[_0x4297('0x59')](_0x3c382a[_0x4297('0x48')][_0x4297('0x59')]));_0x2db818[_0x4297('0x58')]=_0x2db818['attributes'][_0x4297('0x5a')]?_0x2db818[_0x4297('0x58')]:_0x160131[_0x4297('0x53')];_0x2db818['order']=qs[_0x4297('0xd5')](_0x3c382a['query'][_0x4297('0xd5')]);_0x2db818[_0x4297('0x46')]=qs['filters'](_['pick'](_0x3c382a['query'],_0x160131[_0x4297('0xd3')]));if(_0x3c382a[_0x4297('0x48')][_0x4297('0x38')]){_0x2db818['where']=_[_0x4297('0x5d')](_0x2db818['where'],{'$or':_[_0x4297('0x3a')](_0x2db818[_0x4297('0x58')],function(_0x324611){var _0x128d7d={};_0x128d7d[_0x324611]={'$like':'%'+_0x3c382a['query'][_0x4297('0x38')]+'%'};return _0x128d7d;})});}_0x2db818=_['merge']({},_0x2db818,_0x3c382a[_0x4297('0x5e')]);return _0x2b8fef['getSmsInteractions'](_0x2db818);}})[_0x4297('0x19')](function(_0x241e65){if(_0x241e65){_0x4887dc=_0x241e65[_0x4297('0x5a')];if(!_0x3c382a[_0x4297('0x48')][_0x4297('0xd7')]('nolimit')){_0x2db818[_0x4297('0x29')]=qs[_0x4297('0x29')](_0x3c382a[_0x4297('0x48')][_0x4297('0x29')]);_0x2db818['offset']=qs[_0x4297('0x2a')](_0x3c382a[_0x4297('0x48')][_0x4297('0x2a')]);}return _0x2b8fef[_0x4297('0xeb')](_0x2db818);}})['then'](function(_0x36071d){if(_0x36071d){return _0x36071d?{'count':_0x4887dc,'rows':_0x36071d}:null;}})[_0x4297('0x19')](respondWithResult(_0x3525d8,null))[_0x4297('0x23')](handleError(_0x3525d8,null));};exports[_0x4297('0xec')]=function(_0x389d2b,_0xaf4d4d){var _0x3400c9={};var _0x19c4e0={};var _0x4c23dd;var _0x154684;return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x389d2b[_0x4297('0x64')]['id']}})['then'](handleEntityNotFound(_0xaf4d4d,null))[_0x4297('0x19')](function(_0x4489c6){if(_0x4489c6){_0x4c23dd=_0x4489c6;_0x19c4e0['model']=_[_0x4297('0x56')](db[_0x4297('0xed')][_0x4297('0x42')]);_0x19c4e0[_0x4297('0x48')]=_[_0x4297('0x56')](_0x389d2b[_0x4297('0x48')]);_0x19c4e0[_0x4297('0xd3')]=_['intersection'](_0x19c4e0[_0x4297('0x53')],_0x19c4e0[_0x4297('0x48')]);_0x3400c9[_0x4297('0x58')]=_[_0x4297('0x57')](_0x19c4e0['model'],qs['fields'](_0x389d2b[_0x4297('0x48')]['fields']));_0x3400c9[_0x4297('0x58')]=_0x3400c9[_0x4297('0x58')][_0x4297('0x5a')]?_0x3400c9[_0x4297('0x58')]:_0x19c4e0[_0x4297('0x53')];_0x3400c9[_0x4297('0xd4')]=qs[_0x4297('0xd5')](_0x389d2b[_0x4297('0x48')]['sort']);_0x3400c9[_0x4297('0x46')]=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x389d2b[_0x4297('0x48')],_0x19c4e0[_0x4297('0xd3')]));if(_0x389d2b[_0x4297('0x48')][_0x4297('0x38')]){_0x3400c9[_0x4297('0x46')]=_[_0x4297('0x5d')](_0x3400c9[_0x4297('0x46')],{'$or':_[_0x4297('0x3a')](_0x3400c9[_0x4297('0x58')],function(_0x5e6524){var _0x4010d2={};_0x4010d2[_0x5e6524]={'$like':'%'+_0x389d2b[_0x4297('0x48')]['filter']+'%'};return _0x4010d2;})});}_0x3400c9=_[_0x4297('0x5d')]({},_0x3400c9,_0x389d2b[_0x4297('0x5e')]);return _0x4c23dd[_0x4297('0xec')](_0x3400c9);}})[_0x4297('0x19')](function(_0x1191ca){if(_0x1191ca){_0x154684=_0x1191ca['length'];if(!_0x389d2b[_0x4297('0x48')][_0x4297('0xd7')](_0x4297('0xdc'))){_0x3400c9['limit']=qs[_0x4297('0x29')](_0x389d2b['query'][_0x4297('0x29')]);_0x3400c9[_0x4297('0x2a')]=qs[_0x4297('0x2a')](_0x389d2b['query'][_0x4297('0x2a')]);}return _0x4c23dd[_0x4297('0xec')](_0x3400c9);}})['then'](function(_0x2786f9){if(_0x2786f9){return _0x2786f9?{'count':_0x154684,'rows':_0x2786f9}:null;}})[_0x4297('0x19')](respondWithResult(_0xaf4d4d,null))[_0x4297('0x23')](handleError(_0xaf4d4d,null));};exports[_0x4297('0xee')]=function(_0x41158a,_0x4ac75){var _0x2ec50f={};var _0x55f6d4={};var _0x15477e;var _0x495d0b;return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x41158a[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x4ac75,null))[_0x4297('0x19')](function(_0x1d5446){if(_0x1d5446){_0x15477e=_0x1d5446;_0x55f6d4[_0x4297('0x53')]=_['keys'](db[_0x4297('0xef')][_0x4297('0x42')]);_0x55f6d4[_0x4297('0x48')]=_[_0x4297('0x56')](_0x41158a[_0x4297('0x48')]);_0x55f6d4[_0x4297('0xd3')]=_[_0x4297('0x57')](_0x55f6d4[_0x4297('0x53')],_0x55f6d4[_0x4297('0x48')]);_0x2ec50f['attributes']=_[_0x4297('0x57')](_0x55f6d4[_0x4297('0x53')],qs['fields'](_0x41158a[_0x4297('0x48')][_0x4297('0x59')]));_0x2ec50f[_0x4297('0x58')]=_0x2ec50f['attributes'][_0x4297('0x5a')]?_0x2ec50f[_0x4297('0x58')]:_0x55f6d4['model'];_0x2ec50f[_0x4297('0xd4')]=qs[_0x4297('0xd5')](_0x41158a[_0x4297('0x48')]['sort']);_0x2ec50f[_0x4297('0x46')]=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x41158a['query'],_0x55f6d4['filters']));if(_0x41158a[_0x4297('0x48')]['filter']){_0x2ec50f[_0x4297('0x46')]=_['merge'](_0x2ec50f[_0x4297('0x46')],{'$or':_[_0x4297('0x3a')](_0x2ec50f[_0x4297('0x58')],function(_0x585564){var _0x123dab={};_0x123dab[_0x585564]={'$like':'%'+_0x41158a[_0x4297('0x48')][_0x4297('0x38')]+'%'};return _0x123dab;})});}_0x2ec50f=_['merge']({},_0x2ec50f,_0x41158a[_0x4297('0x5e')]);return _0x15477e[_0x4297('0xee')](_0x2ec50f);}})[_0x4297('0x19')](function(_0x27ead0){if(_0x27ead0){_0x495d0b=_0x27ead0[_0x4297('0x5a')];if(!_0x41158a['query'][_0x4297('0xd7')](_0x4297('0xdc'))){_0x2ec50f[_0x4297('0x29')]=qs[_0x4297('0x29')](_0x41158a[_0x4297('0x48')][_0x4297('0x29')]);_0x2ec50f['offset']=qs['offset'](_0x41158a[_0x4297('0x48')]['offset']);}return _0x15477e[_0x4297('0xee')](_0x2ec50f);}})[_0x4297('0x19')](function(_0x19957c){if(_0x19957c){return _0x19957c?{'count':_0x495d0b,'rows':_0x19957c}:null;}})[_0x4297('0x19')](respondWithResult(_0x4ac75,null))[_0x4297('0x23')](handleError(_0x4ac75,null));};exports[_0x4297('0xf0')]=function(_0x477075,_0x4bdd13,_0x5e3d2c){var _0x55003a;var _0x235b2c;var _0x591c71;var _0x40622b=!_['isNil'](_0x477075[_0x4297('0x64')]['id'])?_0x477075[_0x4297('0x64')]['id']:!_[_0x4297('0x6d')](_0x477075['user']['id'])?_0x477075[_0x4297('0x84')]['id']:null;return db[_0x4297('0x41')][_0x4297('0x3c')]({'where':{'id':_0x40622b,'role':{'$or':[_0x4297('0x32'),_0x4297('0x84'),_0x4297('0x35')]}},'attributes':['id','name',_0x4297('0xf1'),_0x4297('0xf2'),_0x4297('0x31'),_0x4297('0x6e'),'loginInPause']})[_0x4297('0x19')](function(_0x5a671d){if(_0x5a671d){if(_0x5a671d[_0x4297('0x31')]===_0x4297('0x35')){_0x55003a=_0x5a671d;if(_0x477075[_0x4297('0x63')][_0x4297('0xa5')]){_0x591c71=util[_0x4297('0xb2')](_0x4297('0xf3'),_0x55003a[_0x477075['body'][_0x4297('0xa5')]]);}else if(_0x477075[_0x4297('0x63')][_0x4297('0xf4')]){_0x591c71=util[_0x4297('0xb2')]('SIP/%s',_0x477075[_0x4297('0x63')][_0x4297('0xf4')]);}else{_0x591c71=util[_0x4297('0xb2')](_0x4297('0xb3'),_0x55003a[_0x4297('0x3d')]);}socket['to'](util[_0x4297('0xb2')](_0x4297('0xf5'),_0x55003a['name']))[_0x4297('0x2e')](_0x4297('0xf6'),{'user':{'id':_0x55003a['id'],'name':_0x55003a[_0x4297('0x3d')]},'ip':_0x477075[_0x4297('0xf7')][_0x4297('0xf8')]||_0x477075['connection']['remoteAddress']||_0x477075['socket'][_0x4297('0xf9')]||_0x477075[_0x4297('0xfa')]['socket'][_0x4297('0xf9')]});return db['UserVoiceQueueRt'][_0x4297('0x30')]({'where':{'membername':_0x55003a[_0x4297('0x3d')]},'individualHooks':!![]});}}else{throw new db[(_0x4297('0x99'))]['ValidationError'](_0x4297('0xfb'));}})['then'](function(){if(_0x55003a){return _0x55003a[_0x4297('0xfc')]({'raw':!![]});}})['then'](function(_0x1e5fd7){if(_0x55003a){if(_0x1e5fd7){_0x235b2c=_0x1e5fd7;if(_0x235b2c[_0x4297('0x5a')]){var _0xc5bda=_0x235b2c[_0x4297('0x3a')](function(_0x1a1370){var _0x154d0e={'membername':_0x55003a[_0x4297('0x3d')],'UserId':_0x55003a['id'],'queue_name':_0x1a1370[_0x4297('0x3d')],'VoiceQueueId':_0x1a1370['id'],'interface':_0x591c71,'paused':_0x55003a[_0x4297('0xfd')]||![],'penalty':_0x1a1370[_0x4297('0xfe')]||0x0};return db[_0x4297('0xb9')]['upsert'](_0x154d0e);});return Promise[_0x4297('0x52')](_0xc5bda);}}}})[_0x4297('0x19')](function(){if(_0x55003a){return db[_0x4297('0xff')][_0x4297('0x4b')]({'where':{'membername':_0x55003a['name'],'exitAt':null}});}})[_0x4297('0x19')](function(_0x551d64){if(_0x55003a){var _0x1f2793=[];_0x551d64['forEach'](function(_0x4f43ef){_0x1f2793[_0x4297('0x4d')](_0x4f43ef[_0x4297('0x62')]({'exitAt':moment()[_0x4297('0xb2')](_0x4297('0x100'))}));});return Promise['all'](_0x1f2793);}})[_0x4297('0x19')](function(){if(_0x55003a){var _0xb60279=[];var _0x4ef74b=[];var _0x23a769=utils[_0x4297('0x101')]();var _0x465179={'membername':_0x55003a[_0x4297('0x3d')],'interface':_0x591c71,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x55003a['role'],'internal':_0x55003a[_0x4297('0x6e')]};_0x23a769['forEach'](function(_0x20e8bc){_0xb60279['push'](_['merge']({'channel':_0x20e8bc,'type':_0x4297('0x102'),'data1':_0x477075[_0x4297('0x63')][_0x4297('0x103')],'data2':_0x591c71},_0x465179));if(_0x55003a[_0x4297('0xfd')]){_0x4ef74b[_0x4297('0x4d')](_[_0x4297('0x5d')]({'channel':_0x20e8bc,'type':_0x4297('0x104'),'data1':_0x4297('0x105')},_0x465179));}});return db[_0x4297('0xff')][_0x4297('0x8e')](_0xb60279[_0x4297('0xd0')](_0x4ef74b),{'individualHooks':!![]});}})[_0x4297('0x19')](function(){if(_0x55003a){return _0x55003a[_0x4297('0x62')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x55003a['loginInPause']||![],'mailPause':_0x55003a[_0x4297('0xfd')]||![],'chatPause':_0x55003a['loginInPause']||![],'faxPause':_0x55003a[_0x4297('0xfd')]||![],'smsPause':_0x55003a[_0x4297('0xfd')]||![],'openchannelPause':_0x55003a['loginInPause']||![],'whatsappPause':_0x55003a[_0x4297('0xfd')]||![],'pauseType':_0x55003a[_0x4297('0xfd')]?_0x4297('0x105'):null,'interface':_0x591c71,'lastPauseAt':moment()[_0x4297('0xb2')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x4297('0x19')](function(_0xdce183){if(_0x477075[_0x4297('0x106')]){return _0x5e3d2c();}else{return Promise[_0x4297('0x107')](_0xdce183)[_0x4297('0x19')](respondWithResult(_0x4bdd13,null));}})[_0x4297('0x23')](handleError(_0x4bdd13,null));};exports['logout']=function(_0x28f5f2,_0x426675){var _0x2d6b8f;return db[_0x4297('0x41')][_0x4297('0x3c')]({'where':{'id':_0x28f5f2[_0x4297('0x64')]['id'],'role':_0x4297('0x35')},'attributes':['id',_0x4297('0x3d'),_0x4297('0x31')]})[_0x4297('0x19')](handleEntityNotFound(_0x426675,null))[_0x4297('0x19')](function(_0x52123b){if(_0x52123b){_0x2d6b8f=_0x52123b;return db[_0x4297('0xb9')]['destroy']({'where':{'membername':_0x2d6b8f[_0x4297('0x3d')]},'individualHooks':!![]});}})['then'](function(){return db[_0x4297('0xff')][_0x4297('0x4b')]({'where':{'membername':_0x2d6b8f[_0x4297('0x3d')],'exitAt':null}});})[_0x4297('0x19')](function(_0x58a249){var _0x41df54=[];_0x58a249[_0x4297('0x108')](function(_0xe7ac1c){_0x41df54[_0x4297('0x4d')](_0xe7ac1c[_0x4297('0x62')]({'exitAt':moment()['format'](_0x4297('0x100'))}));});return Promise[_0x4297('0x52')](_0x41df54);})['then'](function(){return _0x2d6b8f[_0x4297('0x62')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x426675,null))[_0x4297('0x23')](handleError(_0x426675,null));};exports[_0x4297('0x109')]=function(_0x18a493,_0x2c48db){var _0xf3c51d;return db[_0x4297('0xb9')][_0x4297('0x62')]({'paused':0x1},{'where':{'UserId':_0x18a493['params']['id']},'individualHooks':!![]})[_0x4297('0x19')](function(){return db['User'][_0x4297('0x3c')]({'where':{'id':_0x18a493[_0x4297('0x64')]['id'],'role':_0x4297('0x35')},'attributes':['id',_0x4297('0x3d'),_0x4297('0x31'),_0x4297('0x6e'),_0x4297('0xa5'),_0x4297('0xb1')]});})[_0x4297('0x19')](handleEntityNotFound(_0x2c48db,null))['then'](function(_0x5a726d){if(_0x5a726d){_0xf3c51d=_0x5a726d;return respondWithRpcPromise(_0x4297('0x10a'),_0x4297('0x109'),{'id':_0xf3c51d['id'],'name':_0xf3c51d[_0x4297('0x3d')],'pause':!![]});}})[_0x4297('0x19')](function(){if(_0xf3c51d){return db[_0x4297('0xff')][_0x4297('0x4b')]({'where':{'membername':_0xf3c51d[_0x4297('0x3d')],'type':_0x4297('0x104'),'exitAt':null}});}})[_0x4297('0x19')](function(_0x115545){if(_0x115545[_0x4297('0x5a')]){var _0x42721b=moment()['format'](_0x4297('0x100'));for(var _0x374814=0x0,_0x3ff2e7=_0x115545['length'];_0x374814<_0x3ff2e7;_0x374814++){_0x115545[_0x374814][_0x4297('0x10b')]({'exitAt':_0x42721b});}}})[_0x4297('0x19')](function(){var _0xc6b4d9=[];var _0x5c823d=utils[_0x4297('0x101')]();_0x5c823d[_0x4297('0x108')](function(_0x5e3199){_0xc6b4d9['push']({'channel':_0x5e3199,'membername':_0xf3c51d[_0x4297('0x3d')],'interface':_[_0x4297('0x6d')](_0xf3c51d[_0x4297('0xa5')])?util[_0x4297('0xb2')](_0x4297('0xb3'),_0xf3c51d[_0x4297('0x3d')]):_0xf3c51d[_0x4297('0xa5')],'type':_0x4297('0x104'),'enterAt':moment()[_0x4297('0xb2')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x18a493['body']['type']||_0x4297('0x10c'),'role':_0xf3c51d[_0x4297('0x31')],'internal':_0xf3c51d[_0x4297('0x6e')]});});return db[_0x4297('0xff')][_0x4297('0x8e')](_0xc6b4d9,{'individualHooks':!![]});})[_0x4297('0x19')](function(){return _0xf3c51d[_0x4297('0x62')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x18a493[_0x4297('0x63')]['type']||_0x4297('0x10c'),'lastPauseAt':moment()[_0x4297('0xb2')](_0x4297('0x100'))});})[_0x4297('0x19')](respondWithResult(_0x2c48db,null))[_0x4297('0x23')](handleError(_0x2c48db,null));};exports[_0x4297('0x10d')]=function(_0x26a11a,_0x382609){if(_0x26a11a[_0x4297('0x63')]['channel']&&!utils[_0x4297('0xa6')](_0x26a11a[_0x4297('0x63')][_0x4297('0xa3')])){throw new APIBadRequestError(util[_0x4297('0xb2')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x26a11a[_0x4297('0x63')]['channel']));}return db['User'][_0x4297('0x3c')]({'where':{'id':_0x26a11a['params']['id']},'attributes':['id',_0x4297('0x3d'),'role','internal',_0x4297('0xa5'),_0x4297('0xb1'),'voicePause',_0x4297('0x10e'),_0x4297('0x10f'),_0x4297('0x110'),_0x4297('0x111'),'smsPause',_0x4297('0x112'),_0x4297('0x113'),_0x4297('0x114')]})[_0x4297('0x19')](function(_0x5e4005){if(!_0x5e4005){throw new APINotFoundError(util[_0x4297('0xb2')](_0x4297('0x115'),_0x26a11a[_0x4297('0x64')]['id']));}return _0x5e4005[_0x4297('0x10d')](_0x26a11a[_0x4297('0x63')][_0x4297('0xa3')]);})[_0x4297('0x19')](respondWithResult(_0x382609,null))[_0x4297('0x23')](APIHandleError(_0x382609));};exports[_0x4297('0x116')]=function(_0x6ea156,_0x87c349){var _0x3b6f84={};var _0x227a32={};var _0x4a61fd;var _0x3398e9;return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x6ea156[_0x4297('0x64')]['id']}})['then'](handleEntityNotFound(_0x87c349,null))[_0x4297('0x19')](function(_0x29953e){if(_0x29953e){_0x4a61fd=_0x29953e;_0x227a32[_0x4297('0x53')]=_['keys'](db[_0x4297('0x117')]['rawAttributes']);_0x227a32[_0x4297('0x48')]=_[_0x4297('0x56')](_0x6ea156[_0x4297('0x48')]);_0x227a32[_0x4297('0xd3')]=_[_0x4297('0x57')](_0x227a32[_0x4297('0x53')],_0x227a32['query']);_0x3b6f84['attributes']=_[_0x4297('0x57')](_0x227a32[_0x4297('0x53')],qs[_0x4297('0x59')](_0x6ea156['query'][_0x4297('0x59')]));_0x3b6f84[_0x4297('0x58')]=_0x3b6f84[_0x4297('0x58')][_0x4297('0x5a')]?_0x3b6f84[_0x4297('0x58')]:_0x227a32[_0x4297('0x53')];_0x3b6f84[_0x4297('0xd4')]=qs['sort'](_0x6ea156['query'][_0x4297('0xd5')]);_0x3b6f84[_0x4297('0x46')]=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x6ea156[_0x4297('0x48')],_0x227a32['filters']));if(_0x6ea156[_0x4297('0x48')][_0x4297('0x38')]){_0x3b6f84[_0x4297('0x46')]=_[_0x4297('0x5d')](_0x3b6f84[_0x4297('0x46')],{'$or':_['map'](_0x3b6f84['attributes'],function(_0xa09570){var _0x43f2a9={};_0x43f2a9[_0xa09570]={'$like':'%'+_0x6ea156[_0x4297('0x48')]['filter']+'%'};return _0x43f2a9;})});}_0x3b6f84=_[_0x4297('0x5d')]({},_0x3b6f84,_0x6ea156[_0x4297('0x5e')]);return _0x4a61fd[_0x4297('0x116')](_0x3b6f84);}})[_0x4297('0x19')](function(_0x51cb25){if(_0x51cb25){_0x3398e9=_0x51cb25[_0x4297('0x5a')];if(!_0x6ea156[_0x4297('0x48')][_0x4297('0xd7')](_0x4297('0xdc'))){_0x3b6f84[_0x4297('0x29')]=qs[_0x4297('0x29')](_0x6ea156[_0x4297('0x48')][_0x4297('0x29')]);_0x3b6f84['offset']=qs[_0x4297('0x2a')](_0x6ea156[_0x4297('0x48')][_0x4297('0x2a')]);}return _0x4a61fd[_0x4297('0x116')](_0x3b6f84);}})[_0x4297('0x19')](function(_0x1ca6b0){if(_0x1ca6b0){return _0x1ca6b0?{'count':_0x3398e9,'rows':_0x1ca6b0}:null;}})['then'](respondWithResult(_0x87c349,null))[_0x4297('0x23')](handleError(_0x87c349,null));};exports[_0x4297('0x118')]=function(_0x1bd053,_0x1830fd){var _0x4268ff=_0x1bd053['params']['id'];var _0x5d09f4=_0x1bd053['body']?_0x1bd053[_0x4297('0x63')][_0x4297('0x67')]:null;var _0x11ddc6=[];return Promise[_0x4297('0x107')]()['then'](function(){if(!_0x5d09f4)throw new APIBadRequestError(_0x4297('0x119'));})[_0x4297('0x19')](function(){return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x4268ff}});})[_0x4297('0x19')](function(_0x42902d){if(!_0x42902d)throw new APINotFoundError(util[_0x4297('0xb2')](_0x4297('0x115'),_0x1bd053[_0x4297('0x64')]['id']));return db[_0x4297('0x71')][_0x4297('0x11a')](function(_0x36823d){return _0x42902d['addTeams'](_0x5d09f4,{'transaction':_0x36823d})[_0x4297('0x19')](function(){return db['Team'][_0x4297('0x4b')]({'where':{'id':{'$in':_0x5d09f4}}});})[_0x4297('0x19')](function(_0x10ec03){var _0x2751b8=_[_0x4297('0x3a')](_0x10ec03,function(_0x3cd697){return _0x3cd697[_0x4297('0x11b')]();});return Promise[_0x4297('0x52')](_0x2751b8);})['then'](function(_0x554756){_0x11ddc6=_['flattenDeep'](_0x554756);var _0x4c727a=_[_0x4297('0x3a')](_0x11ddc6,function(_0x735688){return _0x735688[_0x4297('0x11c')](_0x42902d['id'],{'transaction':_0x36823d});});return Promise[_0x4297('0x52')](_0x4c727a);})[_0x4297('0x19')](function(){if(!_0x42902d[_0x4297('0xb1')])return;var _0x18c6a0=_[_0x4297('0x38')](_0x11ddc6,function(_0x48d521){return _0x48d521[_0x4297('0x11d')](_0x4297('0xa3'))===_0x4297('0x11e');});var _0x2bcaaf=_[_0x4297('0x3a')](_0x18c6a0,function(_0x5b4f55){return db[_0x4297('0xb9')][_0x4297('0xb4')]({'membername':_0x42902d[_0x4297('0x3d')],'UserId':_0x42902d['id'],'queue_name':_0x5b4f55[_0x4297('0x3d')],'VoiceQueueId':_0x5b4f55['id'],'interface':_[_0x4297('0x6d')](_0x42902d[_0x4297('0xa5')])?util[_0x4297('0xb2')](_0x4297('0xb3'),_0x42902d[_0x4297('0x3d')]):_0x42902d[_0x4297('0xa5')],'paused':_0x42902d[_0x4297('0xa4')]||![],'penalty':_0x42902d[_0x4297('0xaa')]},{'transaction':_0x36823d});});return Promise['all'](_0x2bcaaf);})[_0x4297('0x19')](function(){return db['TeamVoicePrefix'][_0x4297('0x4b')]({'where':{'teamId':{'$in':_0x5d09f4}}});})[_0x4297('0x19')](function(_0x132433){var _0x578147=_[_0x4297('0x3a')](_0x132433,function(_0x137bd3){return db[_0x4297('0x11f')]['create']({'UserId':_0x42902d['id'],'VoicePrefixId':_0x137bd3[_0x4297('0x120')]},{'transaction':_0x36823d});});return Promise[_0x4297('0x52')](_0x578147);});});})[_0x4297('0x19')](function(){for(var _0x5a4ad0=0x0;_0x5a4ad0<_0x11ddc6['length'];_0x5a4ad0++){var _0xbea9ed=_0x11ddc6[_0x5a4ad0][_0x4297('0x11d')](_0x4297('0xa3'));var _0x57a925=_0xbea9ed+_0x4297('0xac');socket['emit'](_0x4297('0x84')+_0xbea9ed+'Queue:save',{'UserId':_0x4268ff,['queueField']:_0x11ddc6[_0x5a4ad0]['id']});}})['then'](respondWithStatusCode(_0x1830fd,null))[_0x4297('0x23')](APIHandleError(_0x1830fd));};exports[_0x4297('0x121')]=function(_0x219235,_0x42ebdb){var _0x52eb0b=_0x219235[_0x4297('0x64')]['id'];var _0x49ddcf=null;if(_0x219235[_0x4297('0x48')]['ids']){_0x49ddcf=_[_0x4297('0xb7')](_0x219235[_0x4297('0x48')][_0x4297('0x67')])?_0x219235[_0x4297('0x48')][_0x4297('0x67')]:[_0x219235[_0x4297('0x48')][_0x4297('0x67')]];}var _0x429896=[];return Promise[_0x4297('0x107')]()[_0x4297('0x19')](function(){if(!_0x49ddcf)throw new APIBadRequestError(_0x4297('0x122'));})[_0x4297('0x19')](function(){return db['User']['findOne']({'where':{'id':_0x52eb0b}});})[_0x4297('0x19')](function(_0x16dd15){if(!_0x16dd15)throw new APINotFoundError(util['format'](_0x4297('0x115'),_0x219235[_0x4297('0x64')]['id']));return db[_0x4297('0x71')]['transaction'](function(_0x356abb){return _0x16dd15[_0x4297('0x121')](_0x49ddcf,{'transaction':_0x356abb})[_0x4297('0x19')](function(){return db[_0x4297('0x117')][_0x4297('0x4b')]({'where':{'id':{'$in':_0x49ddcf}}});})[_0x4297('0x19')](function(_0xcf7e21){var _0x268a44=_[_0x4297('0x3a')](_0xcf7e21,function(_0x2a4296){return _0x2a4296[_0x4297('0x11b')]();});return Promise[_0x4297('0x52')](_0x268a44);})['then'](function(_0x379f84){_0x429896=_['flattenDeep'](_0x379f84);var _0x2239b5=_[_0x4297('0x3a')](_0x429896,function(_0x5aeac3){return _0x5aeac3[_0x4297('0x123')](_0x16dd15['id'],{'transaction':_0x356abb});});return Promise['all'](_0x2239b5);})[_0x4297('0x19')](function(){if(!_0x16dd15[_0x4297('0xb1')])return;var _0x509820=_[_0x4297('0x38')](_0x429896,function(_0xcea0b6){return _0xcea0b6[_0x4297('0x11d')]('channel')==='Voice';});var _0x752b3f=_[_0x4297('0x3a')](_0x509820,function(_0x416d1f){return db['UserVoiceQueueRt'][_0x4297('0x30')]({'where':{'VoiceQueueId':_0x416d1f['id'],'UserId':_0x16dd15['id']},'transaction':_0x356abb});});return Promise['all'](_0x752b3f);})[_0x4297('0x19')](function(){return db[_0x4297('0x124')][_0x4297('0x4b')]({'where':{'teamId':{'$in':_0x49ddcf}}});})[_0x4297('0x19')](function(_0x30caef){var _0x56a071=_[_0x4297('0x3a')](_0x30caef,function(_0x304703){return db['UserVoicePrefix'][_0x4297('0x30')]({'where':{'UserId':_0x16dd15['id'],'VoicePrefixId':_0x304703[_0x4297('0x120')]}},{'transaction':_0x356abb});});return Promise[_0x4297('0x52')](_0x56a071);});});})['then'](function(){for(var _0x507bec=0x0;_0x507bec<_0x429896[_0x4297('0x5a')];_0x507bec++){var _0x2c11d6=_0x429896[_0x507bec][_0x4297('0x11d')](_0x4297('0xa3'));var _0x7d9d3a=_0x2c11d6+_0x4297('0xac');socket[_0x4297('0x2e')](_0x4297('0x84')+_0x2c11d6+_0x4297('0xb8'),{'UserId':_0x52eb0b,['queueField']:_0x429896[_0x507bec]['id']});}})['then'](respondWithStatusCode(_0x42ebdb,null))[_0x4297('0x23')](APIHandleError(_0x42ebdb));};exports['getLists']=function(_0x57714f,_0x17fca9){var _0x2038dd={};var _0x4a3369={};var _0x4b73bc;var _0x55b2a0;return db['User'][_0x4297('0x9d')]({'where':{'id':_0x57714f[_0x4297('0x64')]['id']}})['then'](handleEntityNotFound(_0x17fca9,null))[_0x4297('0x19')](function(_0x37d315){if(_0x37d315){_0x4b73bc=_0x37d315;_0x4a3369['model']=_[_0x4297('0x56')](db[_0x4297('0xd8')][_0x4297('0x42')]);_0x4a3369[_0x4297('0x48')]=_[_0x4297('0x56')](_0x57714f[_0x4297('0x48')]);_0x4a3369[_0x4297('0xd3')]=_['intersection'](_0x4a3369['model'],_0x4a3369['query']);_0x2038dd[_0x4297('0x58')]=_['intersection'](_0x4a3369[_0x4297('0x53')],qs['fields'](_0x57714f[_0x4297('0x48')][_0x4297('0x59')]));_0x2038dd[_0x4297('0x58')]=_0x2038dd['attributes'][_0x4297('0x5a')]?_0x2038dd[_0x4297('0x58')]:_0x4a3369[_0x4297('0x53')];_0x2038dd[_0x4297('0xd4')]=qs[_0x4297('0xd5')](_0x57714f[_0x4297('0x48')]['sort']);_0x2038dd['where']=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x57714f[_0x4297('0x48')],_0x4a3369['filters']));if(_0x57714f[_0x4297('0x48')]['filter']){_0x2038dd['where']=_[_0x4297('0x5d')](_0x2038dd[_0x4297('0x46')],{'$or':_['map'](_0x2038dd[_0x4297('0x58')],function(_0x56e218){var _0x5f5136={};_0x5f5136[_0x56e218]={'$like':'%'+_0x57714f['query'][_0x4297('0x38')]+'%'};return _0x5f5136;})});}_0x2038dd=_[_0x4297('0x5d')]({},_0x2038dd,_0x57714f[_0x4297('0x5e')]);return _0x4b73bc[_0x4297('0x125')](_0x2038dd);}})['then'](function(_0x3ca3d6){if(_0x3ca3d6){_0x55b2a0=_0x3ca3d6[_0x4297('0x5a')];if(!_0x57714f['query'][_0x4297('0xd7')]('nolimit')){_0x2038dd['limit']=qs[_0x4297('0x29')](_0x57714f[_0x4297('0x48')][_0x4297('0x29')]);_0x2038dd[_0x4297('0x2a')]=qs['offset'](_0x57714f[_0x4297('0x48')]['offset']);}return _0x4b73bc[_0x4297('0x125')](_0x2038dd);}})[_0x4297('0x19')](function(_0x1fd097){if(_0x1fd097){return _0x1fd097?{'count':_0x55b2a0,'rows':_0x1fd097}:null;}})['then'](respondWithResult(_0x17fca9,null))['catch'](handleError(_0x17fca9,null));};exports[_0x4297('0x126')]=function(_0x118554,_0x6dc290){var _0xa51569={};var _0x4bbf90={};var _0x4c8cb9;return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x118554[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x6dc290,null))[_0x4297('0x19')](function(_0x5111b8){if(_0x5111b8){_0x4c8cb9=_0x5111b8;_0x4bbf90[_0x4297('0x53')]=_[_0x4297('0x56')](db['User'][_0x4297('0x42')]);_0x4bbf90[_0x4297('0x48')]=_[_0x4297('0x56')](_0x118554[_0x4297('0x48')]);_0x4bbf90[_0x4297('0xd3')]=_[_0x4297('0x57')](_0x4bbf90[_0x4297('0x53')],_0x4bbf90[_0x4297('0x48')]);_0xa51569['attributes']=_[_0x4297('0x57')](_0x4bbf90[_0x4297('0x53')],qs['fields'](_0x118554['query'][_0x4297('0x59')]));_0xa51569[_0x4297('0x58')]=_0xa51569[_0x4297('0x58')][_0x4297('0x5a')]?_0xa51569[_0x4297('0x58')]:_0x4bbf90[_0x4297('0x53')];_0xa51569['order']=qs[_0x4297('0xd5')](_0x118554[_0x4297('0x48')][_0x4297('0xd5')]);_0xa51569[_0x4297('0x46')]=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x118554[_0x4297('0x48')],_0x4bbf90['filters']));if(_0x118554[_0x4297('0x48')][_0x4297('0x38')]){_0xa51569[_0x4297('0x46')]=_[_0x4297('0x5d')](_0xa51569[_0x4297('0x46')],{'$or':_[_0x4297('0x3a')](_0xa51569[_0x4297('0x58')],function(_0x523c8a){var _0x3d9559={};_0x3d9559[_0x523c8a]={'$like':'%'+_0x118554[_0x4297('0x48')]['filter']+'%'};return _0x3d9559;})});}_0xa51569[_0x4297('0x53')]=db[_0x4297('0x41')];_0xa51569['as']=_0x4297('0x34');_0xa51569=_[_0x4297('0x5d')]({},_0xa51569,_0x118554[_0x4297('0x5e')]);return _0x4c8cb9[_0x4297('0xfc')]({'include':[_0xa51569]});}})[_0x4297('0x19')](function(_0x3c8726){if(_0x3c8726){var _0x71ff75={},_0x5cb260=[];for(var _0x348702=0x0;_0x348702<_0x3c8726[_0x4297('0x5a')];_0x348702+=0x1){for(var _0x4b572a=0x0,_0x28b735;_0x4b572a<_0x3c8726[_0x348702][_0x4297('0x34')][_0x4297('0x5a')];_0x4b572a+=0x1){_0x28b735=_0x3c8726[_0x348702][_0x4297('0x34')][_0x4b572a][_0x4297('0xb0')]({'plain':!![]});_0x71ff75[_0x28b735['id']]=_0x28b735;}}_0x71ff75=_[_0x4297('0x127')](_0x71ff75);for(var _0xa05dc1=qs[_0x4297('0x2a')](_0x118554['query'][_0x4297('0x2a')]);_0xa05dc1<_0x71ff75[_0x4297('0x5a')]&&_0x5cb260['length']=_0x274637[_0x4808('0x47')]){throw new Error(_0x4808('0x48'));}})['then'](function(){if(_0x4c7a3e){return db[_0x4808('0x20')][_0x4808('0x49')]({'where':{'membername':_0x4c7a3e['name']},'individualHooks':!![]});}})[_0x4808('0x11')](function(){if(_0x4c7a3e){return _0x4c7a3e[_0x4808('0x4a')]({'raw':!![]});}})[_0x4808('0x11')](function(_0x3699c2){if(_0x4c7a3e){if(_0x3699c2){var _0x191b67=[];_0x1a53bd=_0x3699c2;if(_0x1a53bd[_0x4808('0x23')]){for(var _0x28c5c5=0x0;_0x28c5c5<_0x1a53bd[_0x4808('0x23')];_0x28c5c5++){_0x191b67[_0x4808('0x3f')](db[_0x4808('0x20')]['upsert']({'membername':_0x4c7a3e[_0x4808('0x1c')],'UserId':_0x4c7a3e['id'],'queue_name':_0x1a53bd[_0x28c5c5][_0x4808('0x1c')],'VoiceQueueId':_0x1a53bd[_0x28c5c5]['id'],'interface':_0x3fcb18,'paused':_0x4c7a3e[_0x4808('0x43')]||![],'penalty':_0x1a53bd[_0x28c5c5][_0x4808('0x4b')]||0x0}));}return BPromise['all'](_0x191b67);}}}})[_0x4808('0x11')](function(){if(_0x4c7a3e){return db[_0x4808('0x21')]['findAll']({'where':{'membername':_0x4c7a3e[_0x4808('0x1c')],'exitAt':null}});}})[_0x4808('0x11')](function(_0x17ad09){if(_0x4c7a3e){if(_0x17ad09&&_0x17ad09[_0x4808('0x23')]){var _0x4439bb=[];_0x17ad09[_0x4808('0x28')](function(_0x506cfd){_0x4439bb[_0x4808('0x3f')](_0x506cfd[_0x4808('0x2e')]({'exitAt':moment()[_0x4808('0x24')](_0x4808('0x25'))}));});return BPromise[_0x4808('0x40')](_0x4439bb);}}})[_0x4808('0x11')](function(){if(_0x4c7a3e){var _0x1d1d1b=[];var _0xbb7222=[];var _0x1bbf1d=utils[_0x4808('0x27')]();var _0x4ef09f={'membername':_0x4c7a3e[_0x4808('0x1c')],'interface':_0x3fcb18,'enterAt':moment()[_0x4808('0x24')](_0x4808('0x25')),'role':_0x4c7a3e[_0x4808('0x1d')],'internal':_0x4c7a3e[_0x4808('0x1e')]};_0x1bbf1d[_0x4808('0x28')](function(_0x33a84a){_0x1d1d1b[_0x4808('0x3f')](_[_0x4808('0x4c')]({'channel':_0x33a84a,'type':_0x4808('0x4d'),'data1':_0x4808('0x4e'),'data2':_0x3fcb18},_0x4ef09f));if(_0x4c7a3e['loginInPause']){_0xbb7222['push'](_['merge']({'channel':_0x33a84a,'type':_0x4808('0x4f'),'data1':_0x4808('0x50')},_0x4ef09f));}});return db[_0x4808('0x21')][_0x4808('0x51')](_0x1d1d1b[_0x4808('0x52')](_0xbb7222),{'individualHooks':!![]});}})[_0x4808('0x11')](function(){if(_0x4c7a3e){return _0x4c7a3e[_0x4808('0x2e')]({'online':!![],'lastLoginAt':moment()[_0x4808('0x24')](_0x4808('0x25')),'voicePause':_0x4c7a3e[_0x4808('0x43')]||![],'mailPause':_0x4c7a3e[_0x4808('0x43')]||![],'chatPause':_0x4c7a3e[_0x4808('0x43')]||![],'faxPause':_0x4c7a3e[_0x4808('0x43')]||![],'smsPause':_0x4c7a3e['loginInPause']||![],'openchannelPause':_0x4c7a3e[_0x4808('0x43')]||![],'pauseType':_0x4c7a3e[_0x4808('0x43')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x4808('0x24')](_0x4808('0x25')),'interface':_0x3fcb18});}})[_0x4808('0x11')](function(_0x459cc8){_0x21b49e(_0x459cc8);})['catch'](function(_0x3d8559){_0x38a75d(_0x4b9eb6['error'](0x1f4,_0x3d8559[_0x4808('0x17')]));});});}; \ No newline at end of file +var _0xf519=['concat','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','register','GetUser','User','findAll','options','where','attributes','limit','include','model','map','then','info','debug','catch','error','message','ShowUser','find','raw','stringify','PauseUser','name','role','internal','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','updateAttributes','getChannels','push','isNil','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','DEFAULT\x20PAUSE','body','uniqueid','type','isValidChannel','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','chatPause','openchannelPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','system','LogoutUser','forEach','all','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','merge','LOGIN','LOGININPAUSE','bulkCreate'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0xf519,0xb1));var _0x9f51=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0xf519[_0xadde88];return _0x3b8eb6;};'use strict';var _=require(_0x9f51('0x0'));var util=require(_0x9f51('0x1'));var moment=require(_0x9f51('0x2'));var BPromise=require(_0x9f51('0x3'));var Redis=require(_0x9f51('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9f51('0x5'));var logger=require(_0x9f51('0x6'))(_0x9f51('0x7'));var config=require(_0x9f51('0x8'));config[_0x9f51('0x9')]=_[_0x9f51('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9f51('0xb'))(new Redis(config[_0x9f51('0x9')]));require('./user.socket')[_0x9f51('0xc')](socket);exports[_0x9f51('0xd')]=function(_0x5b96cd){var _0x4e02ff=this;return new Promise(function(_0x41e085,_0x4dbf6c){return db[_0x9f51('0xe')][_0x9f51('0xf')]({'raw':_0x5b96cd[_0x9f51('0x10')]?_0x5b96cd['options']['raw']===undefined?!![]:![]:!![],'where':_0x5b96cd[_0x9f51('0x10')]?_0x5b96cd['options'][_0x9f51('0x11')]||null:null,'attributes':_0x5b96cd[_0x9f51('0x10')]?_0x5b96cd['options'][_0x9f51('0x12')]||null:null,'limit':_0x5b96cd[_0x9f51('0x10')]?_0x5b96cd[_0x9f51('0x10')][_0x9f51('0x13')]||null:null,'include':_0x5b96cd[_0x9f51('0x10')]?_0x5b96cd[_0x9f51('0x10')][_0x9f51('0x14')]?_['map'](_0x5b96cd[_0x9f51('0x10')][_0x9f51('0x14')],function(_0x20e489){return{'model':db[_0x20e489[_0x9f51('0x15')]],'as':_0x20e489['as'],'attributes':_0x20e489['attributes'],'include':_0x20e489[_0x9f51('0x14')]?_[_0x9f51('0x16')](_0x20e489[_0x9f51('0x14')],function(_0x56d426){return{'model':db[_0x56d426[_0x9f51('0x15')]],'as':_0x56d426['as'],'attributes':_0x56d426[_0x9f51('0x12')],'include':_0x56d426[_0x9f51('0x14')]?_['map'](_0x56d426[_0x9f51('0x14')],function(_0x53e79f){return{'model':db[_0x53e79f['model']],'as':_0x53e79f['as'],'attributes':_0x53e79f['attributes']};}):[]};}):[]};}):[]:[]})[_0x9f51('0x17')](function(_0x4266d7){logger[_0x9f51('0x18')]('GetUser',_0x5b96cd);logger[_0x9f51('0x19')](_0x9f51('0xd'),_0x5b96cd,JSON['stringify'](_0x4266d7));_0x41e085(_0x4266d7);})[_0x9f51('0x1a')](function(_0x1afe23){logger[_0x9f51('0x1b')](_0x9f51('0xd'),_0x1afe23[_0x9f51('0x1c')],_0x5b96cd);_0x4dbf6c(_0x4e02ff[_0x9f51('0x1b')](0x1f4,_0x1afe23[_0x9f51('0x1c')]));});});};exports[_0x9f51('0x1d')]=function(_0x13eba5){var _0x10a98b=this;return new Promise(function(_0x12d843,_0x503cdf){return db[_0x9f51('0xe')][_0x9f51('0x1e')]({'raw':_0x13eba5[_0x9f51('0x10')]?_0x13eba5['options'][_0x9f51('0x1f')]===undefined?!![]:![]:!![],'where':_0x13eba5[_0x9f51('0x10')]?_0x13eba5[_0x9f51('0x10')][_0x9f51('0x11')]||null:null,'attributes':_0x13eba5['options']?_0x13eba5['options']['attributes']||null:null,'include':_0x13eba5[_0x9f51('0x10')]?_0x13eba5[_0x9f51('0x10')][_0x9f51('0x14')]?_['map'](_0x13eba5['options'][_0x9f51('0x14')],function(_0x35b6dc){return{'model':db[_0x35b6dc['model']],'as':_0x35b6dc['as'],'attributes':_0x35b6dc[_0x9f51('0x12')],'include':_0x35b6dc[_0x9f51('0x14')]?_[_0x9f51('0x16')](_0x35b6dc[_0x9f51('0x14')],function(_0x521dcc){return{'model':db[_0x521dcc['model']],'as':_0x521dcc['as'],'attributes':_0x521dcc['attributes'],'include':_0x521dcc[_0x9f51('0x14')]?_[_0x9f51('0x16')](_0x521dcc[_0x9f51('0x14')],function(_0x3b79ad){return{'model':db[_0x3b79ad[_0x9f51('0x15')]],'as':_0x3b79ad['as'],'attributes':_0x3b79ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x9f51('0x17')](function(_0x4eb64d){logger[_0x9f51('0x18')]('ShowUser',_0x13eba5);logger['debug'](_0x9f51('0x1d'),_0x13eba5,JSON[_0x9f51('0x20')](_0x4eb64d));_0x12d843(_0x4eb64d);})[_0x9f51('0x1a')](function(_0xd60791){logger[_0x9f51('0x1b')]('ShowUser',_0xd60791[_0x9f51('0x1c')],_0x13eba5);_0x503cdf(_0x10a98b[_0x9f51('0x1b')](0x1f4,_0xd60791['message']));});});};exports[_0x9f51('0x21')]=function(_0x2409b9){var _0x5cc6a0=this;return new Promise(function(_0x234364,_0x1c8f4e){var _0x288164;return db[_0x9f51('0xe')][_0x9f51('0x1e')]({'where':_0x2409b9[_0x9f51('0x10')][_0x9f51('0x11')]||{},'attributes':['id',_0x9f51('0x22'),_0x9f51('0x23'),_0x9f51('0x24'),'interface']})[_0x9f51('0x17')](function(_0x1ae247){if(_0x1ae247){_0x288164=_0x1ae247;return db[_0x9f51('0x25')][_0x9f51('0x26')]({'paused':0x1},{'where':{'UserId':_0x288164['id']},'individualHooks':!![]});}})[_0x9f51('0x17')](function(){if(_0x288164){return db[_0x9f51('0x27')][_0x9f51('0xf')]({'where':{'membername':_0x288164[_0x9f51('0x22')],'type':_0x9f51('0x28'),'exitAt':null}});}})[_0x9f51('0x17')](function(_0x8de782){if(_0x288164){if(_0x8de782&&_0x8de782[_0x9f51('0x29')]){var _0x3c611a=moment()[_0x9f51('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x223419=0x0,_0xf288c6=_0x8de782[_0x9f51('0x29')];_0x223419<_0xf288c6;_0x223419++){_0x8de782[_0x223419][_0x9f51('0x2b')]({'exitAt':_0x3c611a});}}}})[_0x9f51('0x17')](function(){if(_0x288164){var _0x583357=[];var _0xaf2ca9=utils[_0x9f51('0x2c')]();_0xaf2ca9['forEach'](function(_0xa3fd8f){_0x583357[_0x9f51('0x2d')]({'channel':_0xa3fd8f,'membername':_0x288164['name'],'interface':_[_0x9f51('0x2e')](_0x288164[_0x9f51('0x2f')])?util['format'](_0x9f51('0x30'),_0x288164[_0x9f51('0x22')]):_0x288164[_0x9f51('0x2f')],'type':'PAUSE','enterAt':moment()['format'](_0x9f51('0x31')),'data1':_0x2409b9['body']['type']||_0x9f51('0x32'),'role':_0x288164[_0x9f51('0x23')],'internal':_0x288164[_0x9f51('0x24')],'uniqueid':_0x2409b9[_0x9f51('0x33')][_0x9f51('0x34')]||null});});return db[_0x9f51('0x27')]['bulkCreate'](_0x583357,{'individualHooks':!![]});}})['then'](function(){if(_0x288164){return _0x288164[_0x9f51('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2409b9[_0x9f51('0x33')][_0x9f51('0x35')]||_0x9f51('0x32'),'lastPauseAt':moment()[_0x9f51('0x2a')](_0x9f51('0x31'))});}})['then'](function(_0x206d5c){_0x234364(_0x206d5c);})['catch'](function(_0x4d8dfb){_0x1c8f4e(_0x5cc6a0[_0x9f51('0x1b')](0x1f4,_0x4d8dfb[_0x9f51('0x1c')]));});});};exports['UnpauseUser']=function(_0x82f954){var _0x537531=this;return new Promise(function(_0x479dcd,_0x3ad097){if(_0x82f954[_0x9f51('0x33')]['channel']&&!utils[_0x9f51('0x36')](_0x82f954[_0x9f51('0x33')][_0x9f51('0x37')])){throw new Error(util[_0x9f51('0x2a')](_0x9f51('0x38'),_0x82f954['body']['channel']));}return db[_0x9f51('0xe')][_0x9f51('0x39')]({'where':_0x82f954['options'][_0x9f51('0x11')]||{},'attributes':['id',_0x9f51('0x22'),_0x9f51('0x23'),'internal',_0x9f51('0x2f'),_0x9f51('0x3a'),_0x9f51('0x3b'),_0x9f51('0x3c'),_0x9f51('0x3d'),'faxPause',_0x9f51('0x3e'),'smsPause','whatsappPause',_0x9f51('0x3f'),_0x9f51('0x40')]})[_0x9f51('0x17')](function(_0x1ce157){if(!_0x1ce157){throw new Error(util['format'](_0x9f51('0x41'),_0x82f954['params']['id']));}return _0x1ce157[_0x9f51('0x42')](_0x82f954[_0x9f51('0x33')][_0x9f51('0x37')],_0x9f51('0x43'));})[_0x9f51('0x17')](function(_0x3d9ee9){_0x479dcd(_0x3d9ee9);})[_0x9f51('0x1a')](function(_0xe7e4f0){_0x3ad097(_0x537531[_0x9f51('0x1b')](0x1f4,_0xe7e4f0[_0x9f51('0x1c')]));});});};exports[_0x9f51('0x44')]=function(_0x4129f3){var _0x1f825d=this;return new Promise(function(_0x201df5,_0x4cf952){var _0x28f50c;return db[_0x9f51('0xe')]['findOne']({'where':_0x4129f3[_0x9f51('0x10')][_0x9f51('0x11')]||{},'attributes':['id',_0x9f51('0x22')]})[_0x9f51('0x17')](function(_0x2d390d){if(_0x2d390d){_0x28f50c=_0x2d390d;return db[_0x9f51('0x25')]['destroy']({'where':{'membername':_0x28f50c[_0x9f51('0x22')]},'individualHooks':!![]});}})['then'](function(){if(_0x28f50c){return db[_0x9f51('0x27')][_0x9f51('0xf')]({'where':{'membername':_0x28f50c[_0x9f51('0x22')],'exitAt':null}});}})['then'](function(_0x4e96a3){if(_0x28f50c){if(_0x4e96a3&&_0x4e96a3[_0x9f51('0x29')]){var _0xca8b85=[];_0x4e96a3[_0x9f51('0x45')](function(_0x270198){_0xca8b85['push'](_0x270198['update']({'exitAt':moment()[_0x9f51('0x2a')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x9f51('0x46')](_0xca8b85);}}})[_0x9f51('0x17')](function(){if(_0x28f50c){return _0x28f50c['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x9f51('0x17')](function(_0x1bcf7d){_0x201df5(_0x1bcf7d);})[_0x9f51('0x1a')](function(_0x2c7ef2){_0x4cf952(_0x1f825d[_0x9f51('0x1b')](0x1f4,_0x2c7ef2[_0x9f51('0x1c')]));});});};exports[_0x9f51('0x47')]=function(_0x266c15){var _0x59a9d0=this;return new Promise(function(_0x3c170e,_0x5ecda2){var _0x52bd11;var _0x577590;var _0xdb40d4;var _0x457b37;return db['User'][_0x9f51('0x39')]({'where':_0x266c15['options'][_0x9f51('0x11')]||{},'attributes':['id',_0x9f51('0x22'),_0x9f51('0x23'),_0x9f51('0x48'),_0x9f51('0x49'),_0x9f51('0x24'),_0x9f51('0x4a'),_0x9f51('0x2f')]})[_0x9f51('0x17')](function(_0x2441be){if(_0x2441be){_0x52bd11=_0x2441be;_0x457b37=_0x266c15['body'][_0x9f51('0x2f')]?_0x266c15['body'][_0x9f51('0x2f')]:util[_0x9f51('0x2a')](_0x9f51('0x30'),_0x52bd11['name']);return db[_0x9f51('0xe')][_0x9f51('0x4b')]({'where':{'role':_0x9f51('0x4c'),'online':!![],'id':{'$ne':_0x52bd11['id']}}});}})[_0x9f51('0x17')](function(_0x1143c8){if(_0x1143c8){_0xdb40d4=_0x1143c8;return require(_0x9f51('0x4d'))[_0x9f51('0x4e')]();}})['then'](function(_0x277b36){if(_0x277b36&&_0x277b36[_0x9f51('0x4f')]&&_0xdb40d4>=_0x277b36[_0x9f51('0x4f')]){throw new Error(_0x9f51('0x50'));}})[_0x9f51('0x17')](function(){if(_0x52bd11){return db[_0x9f51('0x25')][_0x9f51('0x51')]({'where':{'membername':_0x52bd11[_0x9f51('0x22')]},'individualHooks':!![]});}})[_0x9f51('0x17')](function(){if(_0x52bd11){return _0x52bd11[_0x9f51('0x52')]({'raw':!![]});}})['then'](function(_0x4d7634){if(_0x52bd11){if(_0x4d7634){var _0x325e22=[];_0x577590=_0x4d7634;if(_0x577590[_0x9f51('0x29')]){for(var _0x4a68fa=0x0;_0x4a68fa<_0x577590[_0x9f51('0x29')];_0x4a68fa++){_0x325e22['push'](db[_0x9f51('0x25')]['upsert']({'membername':_0x52bd11[_0x9f51('0x22')],'UserId':_0x52bd11['id'],'queue_name':_0x577590[_0x4a68fa]['name'],'VoiceQueueId':_0x577590[_0x4a68fa]['id'],'interface':_0x457b37,'paused':_0x52bd11[_0x9f51('0x4a')]||![],'penalty':_0x577590[_0x4a68fa]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x9f51('0x46')](_0x325e22);}}}})['then'](function(){if(_0x52bd11){return db[_0x9f51('0x27')][_0x9f51('0xf')]({'where':{'membername':_0x52bd11[_0x9f51('0x22')],'exitAt':null}});}})[_0x9f51('0x17')](function(_0x5234c5){if(_0x52bd11){if(_0x5234c5&&_0x5234c5[_0x9f51('0x29')]){var _0x4b4886=[];_0x5234c5[_0x9f51('0x45')](function(_0x273e75){_0x4b4886[_0x9f51('0x2d')](_0x273e75[_0x9f51('0x26')]({'exitAt':moment()[_0x9f51('0x2a')](_0x9f51('0x31'))}));});return BPromise[_0x9f51('0x46')](_0x4b4886);}}})[_0x9f51('0x17')](function(){if(_0x52bd11){var _0x57c1c8=[];var _0x27013e=[];var _0x532bbb=utils['getChannels']();var _0x528454={'membername':_0x52bd11[_0x9f51('0x22')],'interface':_0x457b37,'enterAt':moment()[_0x9f51('0x2a')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x52bd11[_0x9f51('0x23')],'internal':_0x52bd11[_0x9f51('0x24')]};_0x532bbb['forEach'](function(_0x257e7b){_0x57c1c8[_0x9f51('0x2d')](_[_0x9f51('0x53')]({'channel':_0x257e7b,'type':_0x9f51('0x54'),'data1':'callysquare','data2':_0x457b37},_0x528454));if(_0x52bd11[_0x9f51('0x4a')]){_0x27013e[_0x9f51('0x2d')](_['merge']({'channel':_0x257e7b,'type':'PAUSE','data1':_0x9f51('0x55')},_0x528454));}});return db[_0x9f51('0x27')][_0x9f51('0x56')](_0x57c1c8[_0x9f51('0x57')](_0x27013e),{'individualHooks':!![]});}})[_0x9f51('0x17')](function(){if(_0x52bd11){return _0x52bd11[_0x9f51('0x26')]({'online':!![],'lastLoginAt':moment()[_0x9f51('0x2a')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x52bd11[_0x9f51('0x4a')]||![],'mailPause':_0x52bd11[_0x9f51('0x4a')]||![],'chatPause':_0x52bd11[_0x9f51('0x4a')]||![],'faxPause':_0x52bd11[_0x9f51('0x4a')]||![],'smsPause':_0x52bd11[_0x9f51('0x4a')]||![],'openchannelPause':_0x52bd11[_0x9f51('0x4a')]||![],'pauseType':_0x52bd11[_0x9f51('0x4a')]?_0x9f51('0x55'):null,'lastPauseAt':moment()[_0x9f51('0x2a')](_0x9f51('0x31')),'interface':_0x457b37});}})[_0x9f51('0x17')](function(_0x3e8679){_0x3c170e(_0x3e8679);})[_0x9f51('0x1a')](function(_0x5cb256){_0x5ecda2(_0x59a9d0[_0x9f51('0x1b')](0x1f4,_0x5cb256[_0x9f51('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 9dc73c4..0562b45 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 _0xa3a7=['emit','removeListener','register','length','user:','./user.events','remove','update'];(function(_0x95d5d2,_0x19be17){var _0x4e601d=function(_0x4ddfc5){while(--_0x4ddfc5){_0x95d5d2['push'](_0x95d5d2['shift']());}};_0x4e601d(++_0x19be17);}(_0xa3a7,0x18d));var _0x7a3a=function(_0x49ffdf,_0x340e42){_0x49ffdf=_0x49ffdf-0x0;var _0x5b425d=_0xa3a7[_0x49ffdf];return _0x5b425d;};'use strict';var UserEvents=require(_0x7a3a('0x0'));var events=['save',_0x7a3a('0x1'),_0x7a3a('0x2')];function createListener(_0x45ecd5,_0x252fb3){return function(_0x12db9e){_0x252fb3[_0x7a3a('0x3')](_0x45ecd5,_0x12db9e);};}function removeListener(_0x21d3c6,_0xab29fe){return function(){UserEvents[_0x7a3a('0x4')](_0x21d3c6,_0xab29fe);};}exports[_0x7a3a('0x5')]=function(_0x3d37c4){for(var _0x2a9319=0x0,_0x3667c4=events[_0x7a3a('0x6')];_0x2a9319<_0x3667c4;_0x2a9319++){var _0x2c6154=events[_0x2a9319];var _0x101f5f=createListener(_0x7a3a('0x7')+_0x2c6154,_0x3d37c4);UserEvents['on'](_0x2c6154,_0x101f5f);}}; \ No newline at end of file +var _0x3e14=['removeListener','length','user:','./user.events','save','remove','update','emit'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0x3e14,0x1a3));var _0x43e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e14[_0x3dd15e];return _0x231fd0;};'use strict';var UserEvents=require(_0x43e1('0x0'));var events=[_0x43e1('0x1'),_0x43e1('0x2'),_0x43e1('0x3')];function createListener(_0x21e403,_0x36a3e5){return function(_0xd52559){_0x36a3e5[_0x43e1('0x4')](_0x21e403,_0xd52559);};}function removeListener(_0x160741,_0x174c44){return function(){UserEvents[_0x43e1('0x5')](_0x160741,_0x174c44);};}exports['register']=function(_0x3bc5c7){for(var _0x5e4552=0x0,_0x2594f7=events[_0x43e1('0x6')];_0x5e4552<_0x2594f7;_0x5e4552++){var _0xfde6ba=events[_0x5e4552];var _0x4849eb=createListener(_0x43e1('0x7')+_0xfde6ba,_0x3bc5c7);UserEvents['on'](_0xfde6ba,_0x4849eb);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 6c38276..c44a8cd 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5614a3,_0x1ebbb3){var _0x15f60c=function(_0x213c69){while(--_0x213c69){_0x5614a3['push'](_0x5614a3['shift']());}};_0x15f60c(++_0x1ebbb3);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x15d229,_0x132b33){var _0x2ebafc=function(_0x41a43c){while(--_0x41a43c){_0x15d229['push'](_0x15d229['shift']());}};_0x2ebafc(++_0x132b33);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index b9ea6e6..1b66aa1 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 _0xf34e=['sequelize','exports'];(function(_0x4ad19d,_0x1ed608){var _0x2d11b8=function(_0x42e7aa){while(--_0x42e7aa){_0x4ad19d['push'](_0x4ad19d['shift']());}};_0x2d11b8(++_0x1ed608);}(_0xf34e,0x1cc));var _0xef34=function(_0x383732,_0x4c5eb1){_0x383732=_0x383732-0x0;var _0xe08061=_0xf34e[_0x383732];return _0xe08061;};'use strict';var Sequelize=require(_0xef34('0x0'));module[_0xef34('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe920=['sequelize'];(function(_0x451646,_0x5a9280){var _0x28c085=function(_0x4bb194){while(--_0x4bb194){_0x451646['push'](_0x451646['shift']());}};_0x28c085(++_0x5a9280);}(_0xe920,0x11c));var _0x0e92=function(_0x102b0c,_0x33dee4){_0x102b0c=_0x102b0c-0x0;var _0x9b15ca=_0xe920[_0x102b0c];return _0x9b15ca;};'use strict';var Sequelize=require(_0x0e92('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index b732d42..1c7a70d 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 _0x6a50=['api','moment','bluebird','request-promise','path','rimraf','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x8febdb,_0x197628){var _0x30abe3=function(_0xdd63d2){while(--_0xdd63d2){_0x8febdb['push'](_0x8febdb['shift']());}};_0x30abe3(++_0x197628);}(_0x6a50,0x19d));var _0x06a5=function(_0x314e22,_0x891517){_0x314e22=_0x314e22-0x0;var _0x4ac0f5=_0x6a50[_0x314e22];return _0x4ac0f5;};'use strict';var _=require(_0x06a5('0x0'));var util=require(_0x06a5('0x1'));var logger=require(_0x06a5('0x2'))(_0x06a5('0x3'));var moment=require(_0x06a5('0x4'));var BPromise=require(_0x06a5('0x5'));var rp=require(_0x06a5('0x6'));var fs=require('fs');var path=require(_0x06a5('0x7'));var rimraf=require(_0x06a5('0x8'));var config=require('../../config/environment');var attributes=require(_0x06a5('0x9'));module['exports']=function(_0x296087,_0x111e0b){return _0x296087[_0x06a5('0xa')](_0x06a5('0xb'),attributes,{'tableName':_0x06a5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d62=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','lodash'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x6d62,0x18b));var _0x26d6=function(_0x3c42ff,_0x45ee1f){_0x3c42ff=_0x3c42ff-0x0;var _0x4c0f6d=_0x6d62[_0x3c42ff];return _0x4c0f6d;};'use strict';var _=require(_0x26d6('0x0'));var util=require('util');var logger=require(_0x26d6('0x1'))('api');var moment=require(_0x26d6('0x2'));var BPromise=require(_0x26d6('0x3'));var rp=require(_0x26d6('0x4'));var fs=require('fs');var path=require(_0x26d6('0x5'));var rimraf=require(_0x26d6('0x6'));var config=require(_0x26d6('0x7'));var attributes=require(_0x26d6('0x8'));module[_0x26d6('0x9')]=function(_0x1187ac,_0x15fccb){return _0x1187ac[_0x26d6('0xa')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','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 a58877c..99950a2 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 _0x81b3=['UserChatQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x382747,_0xfe6a98){var _0x2080fb=function(_0x1a5d4b){while(--_0x1a5d4b){_0x382747['push'](_0x382747['shift']());}};_0x2080fb(++_0xfe6a98);}(_0x81b3,0xa6));var _0x381b=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x81b3[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x381b('0x0'));var util=require(_0x381b('0x1'));var moment=require(_0x381b('0x2'));var BPromise=require(_0x381b('0x3'));var rs=require(_0x381b('0x4'));var fs=require('fs');var Redis=require(_0x381b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x381b('0x6'));var config=require('../../config/environment');var jayson=require(_0x381b('0x7'));var client=jayson[_0x381b('0x8')][_0x381b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1222d7,_0x3f5ad5,_0x1774af){return new BPromise(function(_0xdfd20f,_0x235a1f){return client[_0x381b('0xa')](_0x1222d7,_0x1774af)['then'](function(_0x5f27eb){logger['info'](_0x381b('0xb'),_0x3f5ad5,_0x381b('0xc'));logger[_0x381b('0xd')](_0x381b('0xe'),_0x3f5ad5,_0x381b('0xc'),JSON['stringify'](_0x5f27eb));if(_0x5f27eb['error']){if(_0x5f27eb['error']['code']===0x1f4){logger[_0x381b('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x3f5ad5,_0x5f27eb['error'][_0x381b('0x10')]);return _0x235a1f(_0x5f27eb[_0x381b('0xf')][_0x381b('0x10')]);}logger['error'](_0x381b('0xb'),_0x3f5ad5,_0x5f27eb[_0x381b('0xf')]['message']);return _0xdfd20f(_0x5f27eb[_0x381b('0xf')][_0x381b('0x10')]);}else{logger[_0x381b('0x11')](_0x381b('0xb'),_0x3f5ad5,'request\x20sent');_0xdfd20f(_0x5f27eb[_0x381b('0x12')]['message']);}})[_0x381b('0x13')](function(_0x5977ce){logger[_0x381b('0xf')](_0x381b('0xb'),_0x3f5ad5,_0x5977ce);_0x235a1f(_0x5977ce);});});} \ No newline at end of file +var _0x0749=['jayson/promise','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x44c3c1,_0x33d4cd){var _0x3a78ba=function(_0x1d8cbc){while(--_0x1d8cbc){_0x44c3c1['push'](_0x44c3c1['shift']());}};_0x3a78ba(++_0x33d4cd);}(_0x0749,0x18f));var _0x9074=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x0749[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x9074('0x0'));var util=require(_0x9074('0x1'));var moment=require(_0x9074('0x2'));var BPromise=require(_0x9074('0x3'));var rs=require(_0x9074('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9074('0x5'))['db'];var utils=require(_0x9074('0x6'));var logger=require('../../config/logger')(_0x9074('0x7'));var config=require(_0x9074('0x8'));var jayson=require(_0x9074('0x9'));var client=jayson['client'][_0x9074('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3633a5,_0x4adb8b,_0x529c69){return new BPromise(function(_0x24db7e,_0x584e86){return client[_0x9074('0xb')](_0x3633a5,_0x529c69)[_0x9074('0xc')](function(_0x15e4b5){logger[_0x9074('0xd')](_0x9074('0xe'),_0x4adb8b,_0x9074('0xf'));logger[_0x9074('0x10')](_0x9074('0x11'),_0x4adb8b,_0x9074('0xf'),JSON[_0x9074('0x12')](_0x15e4b5));if(_0x15e4b5['error']){if(_0x15e4b5[_0x9074('0x13')][_0x9074('0x14')]===0x1f4){logger[_0x9074('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x4adb8b,_0x15e4b5[_0x9074('0x13')][_0x9074('0x15')]);return _0x584e86(_0x15e4b5['error'][_0x9074('0x15')]);}logger['error'](_0x9074('0xe'),_0x4adb8b,_0x15e4b5[_0x9074('0x13')]['message']);return _0x24db7e(_0x15e4b5[_0x9074('0x13')][_0x9074('0x15')]);}else{logger[_0x9074('0xd')](_0x9074('0xe'),_0x4adb8b,_0x9074('0xf'));_0x24db7e(_0x15e4b5[_0x9074('0x16')]['message']);}})[_0x9074('0x17')](function(_0x20ec9e){logger[_0x9074('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x4adb8b,_0x20ec9e);_0x584e86(_0x20ec9e);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index c2272d0..3e5f9bf 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(_0x3438e0,_0x140a7f){var _0x45cbba=function(_0x4a6205){while(--_0x4a6205){_0x3438e0['push'](_0x3438e0['shift']());}};_0x45cbba(++_0x140a7f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x51bfa7,_0x51c8e0){var _0x1cf7ae=function(_0x5e5625){while(--_0x5e5625){_0x51bfa7['push'](_0x51bfa7['shift']());}};_0x1cf7ae(++_0x51c8e0);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index ff0b98e..8883e44 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 _0x0666=['STRING','sequelize','INTEGER'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x0666,0xcd));var _0x6066=function(_0x580cf8,_0x26751e){_0x580cf8=_0x580cf8-0x0;var _0xcc9a9e=_0x0666[_0x580cf8];return _0xcc9a9e;};'use strict';var Sequelize=require(_0x6066('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6066('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x6066('0x2')]}}; \ No newline at end of file +var _0xf490=['STRING','sequelize','exports','INTEGER'];(function(_0x2b67f3,_0x2285d2){var _0xb81c62=function(_0x4aec70){while(--_0x4aec70){_0x2b67f3['push'](_0x2b67f3['shift']());}};_0xb81c62(++_0x2285d2);}(_0xf490,0xc1));var _0x0f49=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0xf490[_0x3efe87];return _0x56a4cc;};'use strict';var Sequelize=require(_0x0f49('0x0'));module[_0x0f49('0x1')]={'penalty':{'type':Sequelize[_0x0f49('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x0f49('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 206a652..7978535 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 _0x5c14=['moment','bluebird','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api'];(function(_0x345d7a,_0x247261){var _0x154602=function(_0x29c9c0){while(--_0x29c9c0){_0x345d7a['push'](_0x345d7a['shift']());}};_0x154602(++_0x247261);}(_0x5c14,0x14c));var _0x45c1=function(_0x5e39dd,_0x1c914d){_0x5e39dd=_0x5e39dd-0x0;var _0x3ae379=_0x5c14[_0x5e39dd];return _0x3ae379;};'use strict';var _=require(_0x45c1('0x0'));var util=require(_0x45c1('0x1'));var logger=require(_0x45c1('0x2'))(_0x45c1('0x3'));var moment=require(_0x45c1('0x4'));var BPromise=require(_0x45c1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x45c1('0x6'));var rimraf=require(_0x45c1('0x7'));var config=require(_0x45c1('0x8'));var attributes=require(_0x45c1('0x9'));module[_0x45c1('0xa')]=function(_0x2c0183,_0x1b7646){return _0x2c0183[_0x45c1('0xb')](_0x45c1('0xc'),attributes,{'tableName':_0x45c1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81ab=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define'];(function(_0x5c62fc,_0x41431a){var _0x14c817=function(_0x34dd8a){while(--_0x34dd8a){_0x5c62fc['push'](_0x5c62fc['shift']());}};_0x14c817(++_0x41431a);}(_0x81ab,0xd1));var _0xb81a=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0x81ab[_0x5c2c7c];return _0xea7ffe;};'use strict';var _=require(_0xb81a('0x0'));var util=require(_0xb81a('0x1'));var logger=require(_0xb81a('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb81a('0x3'));var rp=require(_0xb81a('0x4'));var fs=require('fs');var path=require(_0xb81a('0x5'));var rimraf=require(_0xb81a('0x6'));var config=require(_0xb81a('0x7'));var attributes=require(_0xb81a('0x8'));module[_0xb81a('0x9')]=function(_0x37640b,_0x46879d){return _0x37640b[_0xb81a('0xa')]('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 da5aa01..13e0145 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 _0x15d7=['jayson/promise','http','request','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','UserFaxQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0x15d7,0x1c8));var _0x715d=function(_0x533edb,_0x431845){_0x533edb=_0x533edb-0x0;var _0x13e589=_0x15d7[_0x533edb];return _0x13e589;};'use strict';var _=require(_0x715d('0x0'));var util=require(_0x715d('0x1'));var moment=require(_0x715d('0x2'));var BPromise=require(_0x715d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x715d('0x4'));var logger=require(_0x715d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x715d('0x6'));var client=jayson['client'][_0x715d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5dbb22,_0x16b06a,_0x105233){return new BPromise(function(_0x13b857,_0xa4a51f){return client[_0x715d('0x8')](_0x5dbb22,_0x105233)[_0x715d('0x9')](function(_0x1b488e){logger[_0x715d('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x16b06a,_0x715d('0xb'));logger[_0x715d('0xc')](_0x715d('0xd'),_0x16b06a,'request\x20sent',JSON[_0x715d('0xe')](_0x1b488e));if(_0x1b488e['error']){if(_0x1b488e['error'][_0x715d('0xf')]===0x1f4){logger[_0x715d('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x16b06a,_0x1b488e[_0x715d('0x10')][_0x715d('0x11')]);return _0xa4a51f(_0x1b488e[_0x715d('0x10')][_0x715d('0x11')]);}logger[_0x715d('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x16b06a,_0x1b488e[_0x715d('0x10')][_0x715d('0x11')]);return _0x13b857(_0x1b488e['error'][_0x715d('0x11')]);}else{logger[_0x715d('0xa')](_0x715d('0x12'),_0x16b06a,_0x715d('0xb'));_0x13b857(_0x1b488e[_0x715d('0x13')][_0x715d('0x11')]);}})[_0x715d('0x14')](function(_0x3535cb){logger[_0x715d('0x10')](_0x715d('0x12'),_0x16b06a,_0x3535cb);_0xa4a51f(_0x3535cb);});});} \ No newline at end of file +var _0x7a92=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a92,0x90));var _0x27a9=function(_0x485bae,_0x33a0c1){_0x485bae=_0x485bae-0x0;var _0x4702c6=_0x7a92[_0x485bae];return _0x4702c6;};'use strict';var _=require(_0x27a9('0x0'));var util=require(_0x27a9('0x1'));var moment=require('moment');var BPromise=require(_0x27a9('0x2'));var rs=require(_0x27a9('0x3'));var fs=require('fs');var Redis=require(_0x27a9('0x4'));var db=require(_0x27a9('0x5'))['db'];var utils=require(_0x27a9('0x6'));var logger=require(_0x27a9('0x7'))('rpc');var config=require(_0x27a9('0x8'));var jayson=require(_0x27a9('0x9'));var client=jayson[_0x27a9('0xa')][_0x27a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28ea35,_0x1bf7ea,_0x4300f8){return new BPromise(function(_0x2141bb,_0x11a1b5){return client[_0x27a9('0xc')](_0x28ea35,_0x4300f8)[_0x27a9('0xd')](function(_0x230aa8){logger[_0x27a9('0xe')](_0x27a9('0xf'),_0x1bf7ea,'request\x20sent');logger[_0x27a9('0x10')](_0x27a9('0x11'),_0x1bf7ea,_0x27a9('0x12'),JSON[_0x27a9('0x13')](_0x230aa8));if(_0x230aa8[_0x27a9('0x14')]){if(_0x230aa8['error'][_0x27a9('0x15')]===0x1f4){logger['error'](_0x27a9('0xf'),_0x1bf7ea,_0x230aa8[_0x27a9('0x14')]['message']);return _0x11a1b5(_0x230aa8[_0x27a9('0x14')][_0x27a9('0x16')]);}logger[_0x27a9('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x1bf7ea,_0x230aa8[_0x27a9('0x14')]['message']);return _0x2141bb(_0x230aa8[_0x27a9('0x14')][_0x27a9('0x16')]);}else{logger['info'](_0x27a9('0xf'),_0x1bf7ea,_0x27a9('0x12'));_0x2141bb(_0x230aa8[_0x27a9('0x17')][_0x27a9('0x16')]);}})['catch'](function(_0x4e302d){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x1bf7ea,_0x4e302d);_0x11a1b5(_0x4e302d);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index a1f69e3..718f8c4 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x555bdc,_0x1e7f5b){var _0x425dcf=function(_0x4de9d2){while(--_0x4de9d2){_0x555bdc['push'](_0x555bdc['shift']());}};_0x425dcf(++_0x1e7f5b);}(_0x70e0,0x17b));var _0x070e=function(_0x4035fa,_0x58973b){_0x4035fa=_0x4035fa-0x0;var _0x265020=_0x70e0[_0x4035fa];return _0x265020;};'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(_0x47a4d2,_0x2fb66e){var _0x14a141=function(_0x3dacc6){while(--_0x3dacc6){_0x47a4d2['push'](_0x47a4d2['shift']());}};_0x14a141(++_0x2fb66e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0xcb91[_0x29e35f];return _0x266b74;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 8612578..00e035f 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 _0x13f6=['exports'];(function(_0x127273,_0x273a2b){var _0x3a17cf=function(_0x238d60){while(--_0x238d60){_0x127273['push'](_0x127273['shift']());}};_0x3a17cf(++_0x273a2b);}(_0x13f6,0xaf));var _0x613f=function(_0x4a00b6,_0x2bbf56){_0x4a00b6=_0x4a00b6-0x0;var _0x4031f7=_0x13f6[_0x4a00b6];return _0x4031f7;};'use strict';var Sequelize=require('sequelize');module[_0x613f('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0e42=['INTEGER'];(function(_0x42586b,_0x5c02f4){var _0x2d3403=function(_0x3bdfcb){while(--_0x3bdfcb){_0x42586b['push'](_0x42586b['shift']());}};_0x2d3403(++_0x5c02f4);}(_0x0e42,0x1e9));var _0x20e4=function(_0x42f37e,_0xe79d40){_0x42f37e=_0x42f37e-0x0;var _0x262086=_0x0e42[_0x42f37e];return _0x262086;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x20e4('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 94be70a..a082dd4 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 _0x0c3d=['./userMailQueue.attributes','exports','UserMailQueue','user_has_mail_queues','lodash','../../config/logger','bluebird','rimraf','../../config/environment'];(function(_0x5f259c,_0x26127d){var _0xddcf04=function(_0x5ea71f){while(--_0x5ea71f){_0x5f259c['push'](_0x5f259c['shift']());}};_0xddcf04(++_0x26127d);}(_0x0c3d,0x70));var _0xd0c3=function(_0x277607,_0x345a06){_0x277607=_0x277607-0x0;var _0x15fe23=_0x0c3d[_0x277607];return _0x15fe23;};'use strict';var _=require(_0xd0c3('0x0'));var util=require('util');var logger=require(_0xd0c3('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd0c3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd0c3('0x3'));var config=require(_0xd0c3('0x4'));var attributes=require(_0xd0c3('0x5'));module[_0xd0c3('0x6')]=function(_0x902ec0,_0xa1cfdf){return _0x902ec0['define'](_0xd0c3('0x7'),attributes,{'tableName':_0xd0c3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c06=['UserMailQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userMailQueue.attributes','define'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x7c06,0x121));var _0x67c0=function(_0x47e309,_0x1e771a){_0x47e309=_0x47e309-0x0;var _0x2e1900=_0x7c06[_0x47e309];return _0x2e1900;};'use strict';var _=require(_0x67c0('0x0'));var util=require(_0x67c0('0x1'));var logger=require(_0x67c0('0x2'))(_0x67c0('0x3'));var moment=require(_0x67c0('0x4'));var BPromise=require(_0x67c0('0x5'));var rp=require(_0x67c0('0x6'));var fs=require('fs');var path=require(_0x67c0('0x7'));var rimraf=require(_0x67c0('0x8'));var config=require('../../config/environment');var attributes=require(_0x67c0('0x9'));module['exports']=function(_0x56d861,_0x34c202){return _0x56d861[_0x67c0('0xa')](_0x67c0('0xb'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 01133c5..667f76c 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 _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0xc092a6,_0xfdb8a6){var _0x1db0c6=function(_0x3117ed){while(--_0x3117ed){_0xc092a6['push'](_0xc092a6['shift']());}};_0x1db0c6(++_0xfdb8a6);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3e961c,_0x5747e7){_0x3e961c=_0x3e961c-0x0;var _0x474f9c=_0x4b84[_0x3e961c];return _0x474f9c;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file +var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x35ba3d,_0x328a1f){var _0x19a8e7=function(_0x5dbc81){while(--_0x5dbc81){_0x35ba3d['push'](_0x35ba3d['shift']());}};_0x19a8e7(++_0x328a1f);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2ea54c,_0x2b3c66){_0x2ea54c=_0x2ea54c-0x0;var _0x2b771c=_0x8ef6[_0x2ea54c];return _0x2b771c;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index fd82e19..08dea8c 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 _0x3e73=['../../components/auth/service','../../components/interaction/service','post','exports','multer','connect-timeout','express','Router'];(function(_0x1deb72,_0x3f6338){var _0x18bbdf=function(_0x1b4b9b){while(--_0x1b4b9b){_0x1deb72['push'](_0x1deb72['shift']());}};_0x18bbdf(++_0x3f6338);}(_0x3e73,0xcc));var _0x33e7=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x3e73[_0x1da527];return _0x40fc7c;};'use strict';var multer=require(_0x33e7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x33e7('0x1'));var express=require(_0x33e7('0x2'));var router=express[_0x33e7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x33e7('0x4'));var interaction=require(_0x33e7('0x5'));var config=require('../../config/environment');var controller=require('./userNotification.controller');router[_0x33e7('0x6')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0x33e7('0x7')]=router; \ No newline at end of file +var _0x45b8=['post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x4d093a,_0x15d59c){var _0x5d7227=function(_0x4e2fee){while(--_0x4e2fee){_0x4d093a['push'](_0x4d093a['shift']());}};_0x5d7227(++_0x15d59c);}(_0x45b8,0x1e4));var _0x845b=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x45b8[_0x40220a];return _0x3903cc;};'use strict';var multer=require(_0x845b('0x0'));var util=require(_0x845b('0x1'));var path=require(_0x845b('0x2'));var timeout=require(_0x845b('0x3'));var express=require(_0x845b('0x4'));var router=express[_0x845b('0x5')]();var fs_extra=require(_0x845b('0x6'));var auth=require(_0x845b('0x7'));var interaction=require(_0x845b('0x8'));var config=require(_0x845b('0x9'));var controller=require(_0x845b('0xa'));router[_0x845b('0xb')]('/',auth[_0x845b('0xc')](),controller[_0x845b('0xd')]);module[_0x845b('0xe')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index cfdc82a..35a8040 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 _0x0ef4=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x284664,_0x455bfa){var _0x2e5d22=function(_0x40f40b){while(--_0x40f40b){_0x284664['push'](_0x284664['shift']());}};_0x2e5d22(++_0x455bfa);}(_0x0ef4,0xd2));var _0x40ef=function(_0x1f7996,_0x299a14){_0x1f7996=_0x1f7996-0x0;var _0x584609=_0x0ef4[_0x1f7996];return _0x584609;};'use strict';var Sequelize=require(_0x40ef('0x0'));module[_0x40ef('0x1')]={'body':{'type':Sequelize[_0x40ef('0x2')]},'senderName':{'type':Sequelize[_0x40ef('0x3')]},'recipientsId':{'type':Sequelize[_0x40ef('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x40ef('0x4')]}}; \ No newline at end of file +var _0xce2d=['TEXT','STRING','BOOLEAN','sequelize'];(function(_0x544586,_0xf5da31){var _0x2ee451=function(_0x77f203){while(--_0x77f203){_0x544586['push'](_0x544586['shift']());}};_0x2ee451(++_0xf5da31);}(_0xce2d,0x93));var _0xdce2=function(_0x5c22e0,_0x3b8f74){_0x5c22e0=_0x5c22e0-0x0;var _0x24ad5a=_0xce2d[_0x5c22e0];return _0x24ad5a;};'use strict';var Sequelize=require(_0xdce2('0x0'));module['exports']={'body':{'type':Sequelize[_0xdce2('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xdce2('0x1')]},'recipientsDescription':{'type':Sequelize[_0xdce2('0x2')]},'beep':{'type':Sequelize[_0xdce2('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index a47eb20..3f80411 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 _0x18e8=['socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','save','update','then','destroy','error','stack','name','sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','whatsappqueue','team','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','userNotification:send','catch','Template','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','startCase','User','union','ids','queue','push','all','findOne','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','redis'];(function(_0x1ecb4f,_0x1137a4){var _0x40fa12=function(_0x52c483){while(--_0x52c483){_0x1ecb4f['push'](_0x1ecb4f['shift']());}};_0x40fa12(++_0x1137a4);}(_0x18e8,0xa2));var _0x818e=function(_0x4c6385,_0x5aaa52){_0x4c6385=_0x4c6385-0x0;var _0x2e07d9=_0x18e8[_0x4c6385];return _0x2e07d9;};'use strict';var emlformat=require(_0x818e('0x0'));var rimraf=require(_0x818e('0x1'));var zipdir=require(_0x818e('0x2'));var jsonpatch=require(_0x818e('0x3'));var rp=require('request-promise');var moment=require(_0x818e('0x4'));var BPromise=require(_0x818e('0x5'));var Mustache=require(_0x818e('0x6'));var util=require(_0x818e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x818e('0x8'));var ejs=require(_0x818e('0x9'));var fs=require('fs');var fs_extra=require(_0x818e('0xa'));var _=require(_0x818e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x818e('0xc'));var deskjs=require(_0x818e('0xd'));var toCsv=require(_0x818e('0x8'));var querystring=require(_0x818e('0xe'));var Papa=require(_0x818e('0xf'));var Redis=require(_0x818e('0x10'));var authService=require(_0x818e('0x11'));var qs=require(_0x818e('0x12'));var as=require(_0x818e('0x13'));var hardwareService=require(_0x818e('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x818e('0x15'));var config=require(_0x818e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x818e('0x17'))['db'];config['redis']=_[_0x818e('0x18')](config[_0x818e('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x818e('0x1a'))(new Redis(config['redis']));require(_0x818e('0x1b'))[_0x818e('0x1c')](socket);function respondWithStatusCode(_0x1125ba,_0x3a3afa){_0x3a3afa=_0x3a3afa||0xcc;return function(_0x5647d5){if(_0x5647d5){return _0x1125ba[_0x818e('0x1d')](_0x3a3afa);}return _0x1125ba[_0x818e('0x1e')](_0x3a3afa)[_0x818e('0x1f')]();};}function respondWithResult(_0x10e851,_0x1edc80){_0x1edc80=_0x1edc80||0xc8;return function(_0x56ce6c){if(_0x56ce6c){return _0x10e851[_0x818e('0x1e')](_0x1edc80)['json'](_0x56ce6c);}};}function respondWithFilteredResult(_0x3aa12a,_0x2ac640){return function(_0x139d63){if(_0x139d63){var _0x34129b=typeof _0x2ac640[_0x818e('0x20')]===_0x818e('0x21')&&typeof _0x2ac640[_0x818e('0x22')]===_0x818e('0x21');var _0x57b099=_0x139d63[_0x818e('0x23')];var _0x3afbaf=_0x34129b?0x0:_0x2ac640[_0x818e('0x20')];var _0x51e620=_0x34129b?_0x139d63[_0x818e('0x23')]:_0x2ac640[_0x818e('0x20')]+_0x2ac640['limit'];var _0x328012;if(_0x51e620>=_0x57b099){_0x51e620=_0x57b099;_0x328012=0xc8;}else{_0x328012=0xce;}_0x3aa12a[_0x818e('0x1e')](_0x328012);return _0x3aa12a[_0x818e('0x24')]('Content-Range',_0x3afbaf+'-'+_0x51e620+'/'+_0x57b099)['json'](_0x139d63);}return null;};}function patchUpdates(_0x303e1c){return function(_0x1168a2){try{jsonpatch['apply'](_0x1168a2,_0x303e1c,!![]);}catch(_0x153db3){return BPromise['reject'](_0x153db3);}return _0x1168a2[_0x818e('0x25')]();};}function saveUpdates(_0x374603,_0x3de324){return function(_0x5b6b95){if(_0x5b6b95){return _0x5b6b95[_0x818e('0x26')](_0x374603)[_0x818e('0x27')](function(_0x108a35){return _0x108a35;});}return null;};}function removeEntity(_0x2818da,_0x5a7c59){return function(_0x237683){if(_0x237683){return _0x237683[_0x818e('0x28')]()[_0x818e('0x27')](function(){_0x2818da[_0x818e('0x1e')](0xcc)[_0x818e('0x1f')]();});}};}function handleEntityNotFound(_0x573dd1,_0x322227){return function(_0x13f44d){if(!_0x13f44d){_0x573dd1['sendStatus'](0x194);}return _0x13f44d;};}function handleError(_0x569268,_0x2113a2){_0x2113a2=_0x2113a2||0x1f4;return function(_0xc33e29){logger[_0x818e('0x29')](_0xc33e29[_0x818e('0x2a')]);if(_0xc33e29[_0x818e('0x2b')]){delete _0xc33e29[_0x818e('0x2b')];}_0x569268['status'](_0x2113a2)['send'](_0xc33e29);};}exports[_0x818e('0x2c')]=function(_0x4405b4,_0xee4803,_0xd382c1){if(!_0x4405b4['body'][_0x818e('0x2d')](_0x818e('0x2e'))&&!_0x4405b4[_0x818e('0x2f')][_0x818e('0x2d')](_0x818e('0x30'))){throw new db[(_0x818e('0x31'))][(_0x818e('0x32'))](_0x818e('0x33'));}else{if(_0x4405b4[_0x818e('0x2f')][_0x818e('0x2d')](_0x818e('0x30'))&&!_0x4405b4[_0x818e('0x2f')][_0x818e('0x2d')](_0x818e('0x34'))){throw new db[(_0x818e('0x31'))][(_0x818e('0x32'))](_0x818e('0x35'));}if(!_0x4405b4[_0x818e('0x2f')][_0x818e('0x2d')]('recipients')){throw new db[(_0x818e('0x31'))][(_0x818e('0x32'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x46734f=JSON[_0x818e('0x36')](_0x4405b4['body'][_0x818e('0x37')]);}catch(_0x1afafb){logger['error'](_0x1afafb);throw new db['Sequelize'][(_0x818e('0x32'))](_0x818e('0x38'));}var _0x5cba6b=['chatqueue',_0x818e('0x39'),_0x818e('0x3a'),_0x818e('0x3b'),'smsqueue','voicequeue',_0x818e('0x3c'),_0x818e('0x3d'),_0x818e('0x3e')];if(_['some'](_0x46734f,function(_0x43d34b){return!_[_0x818e('0x3f')](_0x5cba6b,_0x43d34b[_0x818e('0x40')][_0x818e('0x41')]());})){throw new db[(_0x818e('0x31'))][(_0x818e('0x32'))](_0x818e('0x42'));}}}var _0x22847f={};_0x22847f[_0x818e('0x43')]=_0x4405b4['body']['hasOwnProperty'](_0x818e('0x43'))?_0x4405b4[_0x818e('0x2f')]['senderName']:_0x4405b4[_0x818e('0x3e')][_0x818e('0x44')];_0x22847f[_0x818e('0x45')]=_[_0x818e('0x46')](_0x4405b4[_0x818e('0x2f')][_0x818e('0x45')])?null:_0x4405b4[_0x818e('0x2f')]['recipientsDescription'];_0x22847f[_0x818e('0x47')]=_0x4405b4['body'][_0x818e('0x47')]||![];_0x22847f[_0x818e('0x48')]=_0x4405b4['user']['id'];return getContent(_0x4405b4[_0x818e('0x2f')])[_0x818e('0x27')](function(_0x526693){_0x22847f[_0x818e('0x2f')]=_0x526693;return getRecipients(_0x46734f);})[_0x818e('0x27')](function(_0x6da9dc){_0x22847f[_0x818e('0x49')]=_[_0x818e('0x4a')](_0x6da9dc)[_0x818e('0x4b')](',');return db[_0x818e('0x4c')][_0x818e('0x4d')](function(_0x275165){return db[_0x818e('0x4e')]['create'](_0x22847f,{'raw':!![],'transaction':_0x275165})[_0x818e('0x27')](function(_0x4fe611){var _0x317068={'sender':_0x22847f[_0x818e('0x43')],'description':_0x22847f['recipientsDescription'],'content':_0x22847f[_0x818e('0x2f')],'beep':_0x22847f['beep']};_0x6da9dc['forEach'](function(_0x656293){_0x317068['recipient']=_0x656293;socket['emit'](_0x818e('0x4f'),_0x317068);});return _0x4fe611;});});})[_0x818e('0x27')](respondWithResult(_0xee4803,0xc9))[_0x818e('0x50')](handleError(_0xee4803,null));};function getContent(_0x3d187d){return new BPromise(function(_0x16a07b,_0x5e2be9){if(_0x3d187d['text']){_0x16a07b(_0x3d187d[_0x818e('0x2e')]);return;}return db[_0x818e('0x51')]['findOne']({'attributes':['html'],'where':{'id':_0x3d187d[_0x818e('0x30')]},'raw':!![]})[_0x818e('0x27')](function(_0x777d7d){if(!_0x777d7d)throw new db[(_0x818e('0x31'))][(_0x818e('0x32'))](_0x818e('0x52'));var _0x109222=Mustache[_0x818e('0x53')](_0x777d7d['html'],_0x3d187d[_0x818e('0x34')]);_0x16a07b(_0x109222);})['catch'](function(_0x479766){_0x5e2be9(_0x479766);});});}function getRecipients(_0x2aa788){return new BPromise(function(_0x1285f2,_0x124aba){var _0x4528a2=[];var _0x4d0ebf=[];_0x2aa788[_0x818e('0x54')](function(_0x2864ee){var _0x4cf489=_[_0x818e('0x55')](_0x2864ee[_0x818e('0x40')][_0x818e('0x41')]());if(_0x4cf489===_0x818e('0x56')){_0x4528a2=_[_0x818e('0x57')](_0x4528a2,_0x2864ee[_0x818e('0x58')]);}else{if(_[_0x818e('0x3f')](_0x4cf489,_0x818e('0x59')))_0x4cf489=_0x4cf489['replace']('queue','Queue');_0x2864ee[_0x818e('0x58')][_0x818e('0x54')](function(_0x227067){_0x4d0ebf[_0x818e('0x5a')](getAgents(_0x4cf489,_0x227067));});}});return BPromise[_0x818e('0x5b')](_0x4d0ebf)[_0x818e('0x27')](function(_0x24c6b1){_0x4528a2=_[_0x818e('0x57')](_0x4528a2,_['flatten'](_0x24c6b1));_0x1285f2(_0x4528a2);})[_0x818e('0x50')](function(_0x143835){_0x124aba(_0x143835);});});}function getAgents(_0x2551be,_0x5d7ae3){return new BPromise(function(_0x2e2e61,_0x5812d7){return db[_0x2551be][_0x818e('0x5c')]({'where':{'id':_0x5d7ae3}})[_0x818e('0x27')](function(_0x274083){return _0x274083['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x3e616f){var _0x253afc=_[_0x818e('0x5d')](_0x3e616f,'id');_0x2e2e61(_0x253afc);});})[_0x818e('0x50')](function(_0x5d6089){_0x5812d7(_0x5d6089);});});} \ No newline at end of file +var _0xd276=['forEach','recipient','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','User','union','ids','queue','replace','Queue','push','all','flatten','map','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','count','offset','limit','Content-Range','reject','update','destroy','then','end','stack','name','body','text','hasOwnProperty','TemplateId','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','transaction','UserNotification','create'];(function(_0x755a0e,_0x4a79e7){var _0xaf71a4=function(_0x4f221a){while(--_0x4f221a){_0x755a0e['push'](_0x755a0e['shift']());}};_0xaf71a4(++_0x4a79e7);}(_0xd276,0x185));var _0x6d27=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0xd276[_0x47e549];return _0x251374;};'use strict';var emlformat=require(_0x6d27('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6d27('0x1'));var jsonpatch=require(_0x6d27('0x2'));var rp=require(_0x6d27('0x3'));var moment=require('moment');var BPromise=require(_0x6d27('0x4'));var Mustache=require(_0x6d27('0x5'));var util=require(_0x6d27('0x6'));var path=require('path');var sox=require(_0x6d27('0x7'));var csv=require(_0x6d27('0x8'));var ejs=require(_0x6d27('0x9'));var fs=require('fs');var fs_extra=require(_0x6d27('0xa'));var _=require(_0x6d27('0xb'));var squel=require(_0x6d27('0xc'));var crypto=require(_0x6d27('0xd'));var jsforce=require(_0x6d27('0xe'));var deskjs=require(_0x6d27('0xf'));var toCsv=require(_0x6d27('0x8'));var querystring=require('querystring');var Papa=require(_0x6d27('0x10'));var Redis=require('ioredis');var authService=require(_0x6d27('0x11'));var qs=require(_0x6d27('0x12'));var as=require(_0x6d27('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6d27('0x14'));var utils=require(_0x6d27('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6d27('0x16'));var db=require(_0x6d27('0x17'))['db'];config[_0x6d27('0x18')]=_[_0x6d27('0x19')](config[_0x6d27('0x18')],{'host':_0x6d27('0x1a'),'port':0x18eb});var socket=require(_0x6d27('0x1b'))(new Redis(config[_0x6d27('0x18')]));require('./userNotification.socket')[_0x6d27('0x1c')](socket);function respondWithStatusCode(_0x2f67e3,_0x33fef8){_0x33fef8=_0x33fef8||0xcc;return function(_0x302b43){if(_0x302b43){return _0x2f67e3[_0x6d27('0x1d')](_0x33fef8);}return _0x2f67e3[_0x6d27('0x1e')](_0x33fef8)['end']();};}function respondWithResult(_0x457490,_0x3bb019){_0x3bb019=_0x3bb019||0xc8;return function(_0x532dba){if(_0x532dba){return _0x457490['status'](_0x3bb019)[_0x6d27('0x1f')](_0x532dba);}};}function respondWithFilteredResult(_0x57fb4d,_0x42776d){return function(_0xe52dbe){if(_0xe52dbe){var _0x5b149a=typeof _0x42776d['offset']===_0x6d27('0x20')&&typeof _0x42776d['limit']==='undefined';var _0x580e56=_0xe52dbe[_0x6d27('0x21')];var _0x4808e8=_0x5b149a?0x0:_0x42776d[_0x6d27('0x22')];var _0x4d87b5=_0x5b149a?_0xe52dbe[_0x6d27('0x21')]:_0x42776d[_0x6d27('0x22')]+_0x42776d[_0x6d27('0x23')];var _0x2f36cf;if(_0x4d87b5>=_0x580e56){_0x4d87b5=_0x580e56;_0x2f36cf=0xc8;}else{_0x2f36cf=0xce;}_0x57fb4d[_0x6d27('0x1e')](_0x2f36cf);return _0x57fb4d['set'](_0x6d27('0x24'),_0x4808e8+'-'+_0x4d87b5+'/'+_0x580e56)[_0x6d27('0x1f')](_0xe52dbe);}return null;};}function patchUpdates(_0x3ca8aa){return function(_0x4ede4b){try{jsonpatch['apply'](_0x4ede4b,_0x3ca8aa,!![]);}catch(_0x366ae1){return BPromise[_0x6d27('0x25')](_0x366ae1);}return _0x4ede4b['save']();};}function saveUpdates(_0x5f1434,_0x17bb5a){return function(_0x5e5722){if(_0x5e5722){return _0x5e5722[_0x6d27('0x26')](_0x5f1434)['then'](function(_0x5c6bde){return _0x5c6bde;});}return null;};}function removeEntity(_0x4f2052,_0x3373b5){return function(_0x4c88d6){if(_0x4c88d6){return _0x4c88d6[_0x6d27('0x27')]()[_0x6d27('0x28')](function(){_0x4f2052[_0x6d27('0x1e')](0xcc)[_0x6d27('0x29')]();});}};}function handleEntityNotFound(_0x7ed77d,_0x1063b0){return function(_0x5ee00c){if(!_0x5ee00c){_0x7ed77d['sendStatus'](0x194);}return _0x5ee00c;};}function handleError(_0xf80590,_0x38b15a){_0x38b15a=_0x38b15a||0x1f4;return function(_0x33b8b4){logger['error'](_0x33b8b4[_0x6d27('0x2a')]);if(_0x33b8b4[_0x6d27('0x2b')]){delete _0x33b8b4[_0x6d27('0x2b')];}_0xf80590[_0x6d27('0x1e')](_0x38b15a)['send'](_0x33b8b4);};}exports['sendUserNotification']=function(_0x81030e,_0x2f3668,_0xb6d449){if(!_0x81030e[_0x6d27('0x2c')]['hasOwnProperty'](_0x6d27('0x2d'))&&!_0x81030e[_0x6d27('0x2c')][_0x6d27('0x2e')](_0x6d27('0x2f'))){throw new db[(_0x6d27('0x30'))]['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x81030e['body'][_0x6d27('0x2e')](_0x6d27('0x2f'))&&!_0x81030e['body'][_0x6d27('0x2e')]('view')){throw new db['Sequelize'][(_0x6d27('0x31'))](_0x6d27('0x32'));}if(!_0x81030e[_0x6d27('0x2c')][_0x6d27('0x2e')](_0x6d27('0x33'))){throw new db[(_0x6d27('0x30'))][(_0x6d27('0x31'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x4fcc6a=JSON['parse'](_0x81030e[_0x6d27('0x2c')][_0x6d27('0x33')]);}catch(_0x2e3663){logger['error'](_0x2e3663);throw new db[(_0x6d27('0x30'))]['ValidationError'](_0x6d27('0x34'));}var _0x2ece17=[_0x6d27('0x35'),_0x6d27('0x36'),'mailqueue',_0x6d27('0x37'),_0x6d27('0x38'),'voicequeue','whatsappqueue',_0x6d27('0x39'),_0x6d27('0x3a')];if(_[_0x6d27('0x3b')](_0x4fcc6a,function(_0xe3cfdf){return!_[_0x6d27('0x3c')](_0x2ece17,_0xe3cfdf[_0x6d27('0x3d')][_0x6d27('0x3e')]());})){throw new db['Sequelize'][(_0x6d27('0x31'))](_0x6d27('0x3f'));}}}var _0x2350b2={};_0x2350b2[_0x6d27('0x40')]=_0x81030e[_0x6d27('0x2c')][_0x6d27('0x2e')]('senderName')?_0x81030e[_0x6d27('0x2c')][_0x6d27('0x40')]:_0x81030e[_0x6d27('0x3a')][_0x6d27('0x41')];_0x2350b2[_0x6d27('0x42')]=_[_0x6d27('0x43')](_0x81030e['body']['recipientsDescription'])?null:_0x81030e[_0x6d27('0x2c')]['recipientsDescription'];_0x2350b2[_0x6d27('0x44')]=_0x81030e[_0x6d27('0x2c')][_0x6d27('0x44')]||![];_0x2350b2[_0x6d27('0x45')]=_0x81030e['user']['id'];return getContent(_0x81030e[_0x6d27('0x2c')])['then'](function(_0x4db782){_0x2350b2[_0x6d27('0x2c')]=_0x4db782;return getRecipients(_0x4fcc6a);})[_0x6d27('0x28')](function(_0x33b57a){_0x2350b2[_0x6d27('0x46')]=_['sortBy'](_0x33b57a)[_0x6d27('0x47')](',');return db[_0x6d27('0x48')][_0x6d27('0x49')](function(_0x51a886){return db[_0x6d27('0x4a')][_0x6d27('0x4b')](_0x2350b2,{'raw':!![],'transaction':_0x51a886})['then'](function(_0x376433){var _0x26e872={'sender':_0x2350b2[_0x6d27('0x40')],'description':_0x2350b2[_0x6d27('0x42')],'content':_0x2350b2[_0x6d27('0x2c')],'beep':_0x2350b2[_0x6d27('0x44')]};_0x33b57a[_0x6d27('0x4c')](function(_0x1d4380){_0x26e872[_0x6d27('0x4d')]=_0x1d4380;socket['emit']('userNotification:send',_0x26e872);});return _0x376433;});});})['then'](respondWithResult(_0x2f3668,0xc9))[_0x6d27('0x4e')](handleError(_0x2f3668,null));};function getContent(_0x5eb1a3){return new BPromise(function(_0x425660,_0x12e6ae){if(_0x5eb1a3[_0x6d27('0x2d')]){_0x425660(_0x5eb1a3['text']);return;}return db[_0x6d27('0x4f')][_0x6d27('0x50')]({'attributes':['html'],'where':{'id':_0x5eb1a3[_0x6d27('0x2f')]},'raw':!![]})[_0x6d27('0x28')](function(_0x680a30){if(!_0x680a30)throw new db['Sequelize']['ValidationError'](_0x6d27('0x51'));var _0x2ced53=Mustache['render'](_0x680a30[_0x6d27('0x52')],_0x5eb1a3['view']);_0x425660(_0x2ced53);})['catch'](function(_0x3fdf4f){_0x12e6ae(_0x3fdf4f);});});}function getRecipients(_0xc78669){return new BPromise(function(_0x14f366,_0x1df93a){var _0x44a816=[];var _0xde583b=[];_0xc78669[_0x6d27('0x4c')](function(_0x3f7784){var _0x70510c=_['startCase'](_0x3f7784[_0x6d27('0x3d')]['toLowerCase']());if(_0x70510c===_0x6d27('0x53')){_0x44a816=_[_0x6d27('0x54')](_0x44a816,_0x3f7784[_0x6d27('0x55')]);}else{if(_['includes'](_0x70510c,_0x6d27('0x56')))_0x70510c=_0x70510c[_0x6d27('0x57')](_0x6d27('0x56'),_0x6d27('0x58'));_0x3f7784[_0x6d27('0x55')]['forEach'](function(_0x333a76){_0xde583b[_0x6d27('0x59')](getAgents(_0x70510c,_0x333a76));});}});return BPromise[_0x6d27('0x5a')](_0xde583b)[_0x6d27('0x28')](function(_0x36b884){_0x44a816=_[_0x6d27('0x54')](_0x44a816,_[_0x6d27('0x5b')](_0x36b884));_0x14f366(_0x44a816);})['catch'](function(_0x1803dd){_0x1df93a(_0x1803dd);});});}function getAgents(_0x1f4a37,_0x273b6e){return new BPromise(function(_0x28f012,_0x2cd3e0){return db[_0x1f4a37][_0x6d27('0x50')]({'where':{'id':_0x273b6e}})[_0x6d27('0x28')](function(_0x3b4250){return _0x3b4250['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0xfcc28b){var _0x444bf4=_[_0x6d27('0x5c')](_0xfcc28b,'id');_0x28f012(_0x444bf4);});})[_0x6d27('0x4e')](function(_0x26514b){_0x2cd3e0(_0x26514b);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 9af854d..7da75d8 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 _0x6b65=['save','remove','emit','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners'];(function(_0xfc5e94,_0x22bcc7){var _0x3aa883=function(_0x3af896){while(--_0x3af896){_0xfc5e94['push'](_0xfc5e94['shift']());}};_0x3aa883(++_0x22bcc7);}(_0x6b65,0x68));var _0x56b6=function(_0x255a85,_0x43ea4c){_0x255a85=_0x255a85-0x0;var _0x5ee089=_0x6b65[_0x255a85];return _0x5ee089;};'use strict';var EventEmitter=require(_0x56b6('0x0'));var UserNotification=require(_0x56b6('0x1'))['db'][_0x56b6('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x56b6('0x3')](0x0);var events={'afterCreate':_0x56b6('0x4'),'afterUpdate':'update','afterDestroy':_0x56b6('0x5')};function emitEvent(_0x3fcb75){return function(_0xbd74e5,_0x41016f,_0x47c540){UserNotificationEvents[_0x56b6('0x6')](_0x3fcb75+':'+_0xbd74e5['id'],_0xbd74e5);UserNotificationEvents[_0x56b6('0x6')](_0x3fcb75,_0xbd74e5);_0x47c540(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x56b6('0x7')](e,emitEvent(event));}}module[_0x56b6('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xd853=['hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd853,0xac));var _0x3d85=function(_0x3dff0d,_0x4d59ff){_0x3dff0d=_0x3dff0d-0x0;var _0x352383=_0xd853[_0x3dff0d];return _0x352383;};'use strict';var EventEmitter=require(_0x3d85('0x0'));var UserNotification=require(_0x3d85('0x1'))['db'][_0x3d85('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3d85('0x3')](0x0);var events={'afterCreate':_0x3d85('0x4'),'afterUpdate':_0x3d85('0x5'),'afterDestroy':_0x3d85('0x6')};function emitEvent(_0xd54a79){return function(_0x21874d,_0x1d0385,_0x59c3b0){UserNotificationEvents[_0x3d85('0x7')](_0xd54a79+':'+_0x21874d['id'],_0x21874d);UserNotificationEvents[_0x3d85('0x7')](_0xd54a79,_0x21874d);_0x59c3b0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x3d85('0x8')](e,emitEvent(event));}}module[_0x3d85('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 55fc340..cb8f7f6 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 _0x1529=['moment','path','rimraf','../../config/environment','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x1933c1,_0x2b9bac){var _0x5d30f8=function(_0x3e72d3){while(--_0x3e72d3){_0x1933c1['push'](_0x1933c1['shift']());}};_0x5d30f8(++_0x2b9bac);}(_0x1529,0x1b6));var _0x9152=function(_0x3f43ef,_0x4c2ba9){_0x3f43ef=_0x3f43ef-0x0;var _0x20af43=_0x1529[_0x3f43ef];return _0x20af43;};'use strict';var _=require('lodash');var util=require(_0x9152('0x0'));var logger=require(_0x9152('0x1'))('api');var moment=require(_0x9152('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9152('0x3'));var rimraf=require(_0x9152('0x4'));var config=require(_0x9152('0x5'));var attributes=require('./userNotification.attributes');module['exports']=function(_0x4b1ef1,_0x3f69c7){return _0x4b1ef1[_0x9152('0x6')](_0x9152('0x7'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9152('0x8'),'collate':_0x9152('0x9')});}; \ No newline at end of file +var _0x3e2d=['exports','define','userNotifications','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes'];(function(_0x443f42,_0x248e76){var _0x3aca21=function(_0x4537f5){while(--_0x4537f5){_0x443f42['push'](_0x443f42['shift']());}};_0x3aca21(++_0x248e76);}(_0x3e2d,0x142));var _0xd3e2=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x3e2d[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xd3e2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd3e2('0x1'));var BPromise=require(_0xd3e2('0x2'));var rp=require(_0xd3e2('0x3'));var fs=require('fs');var path=require(_0xd3e2('0x4'));var rimraf=require(_0xd3e2('0x5'));var config=require(_0xd3e2('0x6'));var attributes=require(_0xd3e2('0x7'));module[_0xd3e2('0x8')]=function(_0x37bad9,_0x58fc16){return _0x37bad9[_0xd3e2('0x9')]('UserNotification',attributes,{'tableName':_0xd3e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 6c8b1ee..7350769 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 _0xcb3f=['message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s'];(function(_0x297763,_0x2c446a){var _0x1306b1=function(_0x350a9f){while(--_0x350a9f){_0x297763['push'](_0x297763['shift']());}};_0x1306b1(++_0x2c446a);}(_0xcb3f,0x1b4));var _0xfcb3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xcb3f[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xfcb3('0x0'));var util=require(_0xfcb3('0x1'));var moment=require('moment');var BPromise=require(_0xfcb3('0x2'));var rs=require(_0xfcb3('0x3'));var fs=require('fs');var Redis=require(_0xfcb3('0x4'));var db=require(_0xfcb3('0x5'))['db'];var utils=require(_0xfcb3('0x6'));var logger=require(_0xfcb3('0x7'))(_0xfcb3('0x8'));var config=require(_0xfcb3('0x9'));var jayson=require(_0xfcb3('0xa'));var client=jayson[_0xfcb3('0xb')][_0xfcb3('0xc')]({'port':0x232a});config[_0xfcb3('0xd')]=_[_0xfcb3('0xe')](config['redis'],{'host':_0xfcb3('0xf'),'port':0x18eb});var socket=require(_0xfcb3('0x10'))(new Redis(config[_0xfcb3('0xd')]));require(_0xfcb3('0x11'))[_0xfcb3('0x12')](socket);function respondWithRpcPromise(_0x302ae5,_0x34631c,_0x36eb8b){return new BPromise(function(_0x9ddc00,_0xb7ea17){return client[_0xfcb3('0x13')](_0x302ae5,_0x36eb8b)[_0xfcb3('0x14')](function(_0x3849e1){logger['info']('UserNotification,\x20%s,\x20%s',_0x34631c,_0xfcb3('0x15'));logger[_0xfcb3('0x16')](_0xfcb3('0x17'),_0x34631c,_0xfcb3('0x15'),JSON[_0xfcb3('0x18')](_0x3849e1));if(_0x3849e1[_0xfcb3('0x19')]){if(_0x3849e1[_0xfcb3('0x19')][_0xfcb3('0x1a')]===0x1f4){logger['error'](_0xfcb3('0x1b'),_0x34631c,_0x3849e1['error'][_0xfcb3('0x1c')]);return _0xb7ea17(_0x3849e1[_0xfcb3('0x19')]['message']);}logger[_0xfcb3('0x19')](_0xfcb3('0x1b'),_0x34631c,_0x3849e1['error'][_0xfcb3('0x1c')]);return _0x9ddc00(_0x3849e1[_0xfcb3('0x19')][_0xfcb3('0x1c')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x34631c,'request\x20sent');_0x9ddc00(_0x3849e1['result'][_0xfcb3('0x1c')]);}})['catch'](function(_0x45ee1f){logger['error']('UserNotification,\x20%s,\x20%s',_0x34631c,_0x45ee1f);_0xb7ea17(_0x45ee1f);});});} \ No newline at end of file +var _0x36dd=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./userNotification.socket','register','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x98b363,_0x5f1146){var _0x103b5c=function(_0x495442){while(--_0x495442){_0x98b363['push'](_0x98b363['shift']());}};_0x103b5c(++_0x5f1146);}(_0x36dd,0x13f));var _0xd36d=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x36dd[_0xa60623];return _0x4a6487;};'use strict';var _=require(_0xd36d('0x0'));var util=require(_0xd36d('0x1'));var moment=require(_0xd36d('0x2'));var BPromise=require('bluebird');var rs=require(_0xd36d('0x3'));var fs=require('fs');var Redis=require(_0xd36d('0x4'));var db=require(_0xd36d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd36d('0x6'))(_0xd36d('0x7'));var config=require(_0xd36d('0x8'));var jayson=require(_0xd36d('0x9'));var client=jayson[_0xd36d('0xa')][_0xd36d('0xb')]({'port':0x232a});config[_0xd36d('0xc')]=_[_0xd36d('0xd')](config[_0xd36d('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd36d('0xc')]));require(_0xd36d('0xe'))[_0xd36d('0xf')](socket);function respondWithRpcPromise(_0x30bf53,_0x3c9141,_0x5e7044){return new BPromise(function(_0xa69248,_0x5e7c2c){return client['request'](_0x30bf53,_0x5e7044)[_0xd36d('0x10')](function(_0x3dae36){logger[_0xd36d('0x11')]('UserNotification,\x20%s,\x20%s',_0x3c9141,_0xd36d('0x12'));logger[_0xd36d('0x13')](_0xd36d('0x14'),_0x3c9141,_0xd36d('0x12'),JSON[_0xd36d('0x15')](_0x3dae36));if(_0x3dae36['error']){if(_0x3dae36[_0xd36d('0x16')][_0xd36d('0x17')]===0x1f4){logger[_0xd36d('0x16')](_0xd36d('0x18'),_0x3c9141,_0x3dae36['error']['message']);return _0x5e7c2c(_0x3dae36[_0xd36d('0x16')]['message']);}logger[_0xd36d('0x16')](_0xd36d('0x18'),_0x3c9141,_0x3dae36[_0xd36d('0x16')]['message']);return _0xa69248(_0x3dae36[_0xd36d('0x16')][_0xd36d('0x19')]);}else{logger[_0xd36d('0x11')](_0xd36d('0x18'),_0x3c9141,_0xd36d('0x12'));_0xa69248(_0x3dae36[_0xd36d('0x1a')][_0xd36d('0x19')]);}})['catch'](function(_0x4b0e7d){logger[_0xd36d('0x16')](_0xd36d('0x18'),_0x3c9141,_0x4b0e7d);_0x5e7c2c(_0x4b0e7d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 0b93004..3a51b8e 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 _0x1f1f=['emit','removeListener','register','length','userNotification:','./userNotification.events','save','update'];(function(_0x19fc8f,_0x264aa6){var _0x1f24f4=function(_0x2b1400){while(--_0x2b1400){_0x19fc8f['push'](_0x19fc8f['shift']());}};_0x1f24f4(++_0x264aa6);}(_0x1f1f,0x1cd));var _0xf1f1=function(_0xd9f102,_0x5a0d28){_0xd9f102=_0xd9f102-0x0;var _0x2652e4=_0x1f1f[_0xd9f102];return _0x2652e4;};'use strict';var UserNotificationEvents=require(_0xf1f1('0x0'));var events=[_0xf1f1('0x1'),'remove',_0xf1f1('0x2')];function createListener(_0xcfefa,_0x2dcc94){return function(_0x41a2aa){_0x2dcc94[_0xf1f1('0x3')](_0xcfefa,_0x41a2aa);};}function removeListener(_0x1db5d7,_0x4a6d56){return function(){UserNotificationEvents[_0xf1f1('0x4')](_0x1db5d7,_0x4a6d56);};}exports[_0xf1f1('0x5')]=function(_0x2372b0){for(var _0x5d7509=0x0,_0x30bcde=events[_0xf1f1('0x6')];_0x5d7509<_0x30bcde;_0x5d7509++){var _0x23447d=events[_0x5d7509];var _0x5783a6=createListener(_0xf1f1('0x7')+_0x23447d,_0x2372b0);UserNotificationEvents['on'](_0x23447d,_0x5783a6);}}; \ No newline at end of file +var _0x76c1=['removeListener','length','userNotification:','./userNotification.events','remove','update'];(function(_0xde9083,_0x40ea54){var _0x191c72=function(_0x415fed){while(--_0x415fed){_0xde9083['push'](_0xde9083['shift']());}};_0x191c72(++_0x40ea54);}(_0x76c1,0xab));var _0x176c=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0x76c1[_0xf0ec6e];return _0x8bbc27;};'use strict';var UserNotificationEvents=require(_0x176c('0x0'));var events=['save',_0x176c('0x1'),_0x176c('0x2')];function createListener(_0x48b361,_0x5e7601){return function(_0x465a8e){_0x5e7601['emit'](_0x48b361,_0x465a8e);};}function removeListener(_0x5bbe4b,_0x5746eb){return function(){UserNotificationEvents[_0x176c('0x3')](_0x5bbe4b,_0x5746eb);};}exports['register']=function(_0x252f2d){for(var _0x4f8090=0x0,_0x5020dc=events[_0x176c('0x4')];_0x4f8090<_0x5020dc;_0x4f8090++){var _0x25c80d=events[_0x4f8090];var _0x4f9311=createListener(_0x176c('0x5')+_0x25c80d,_0x252f2d);UserNotificationEvents['on'](_0x25c80d,_0x4f9311);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index c114471..46579ce 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x43919a,_0x567fa6){var _0x2738d6=function(_0x37e8dc){while(--_0x37e8dc){_0x43919a['push'](_0x43919a['shift']());}};_0x2738d6(++_0x567fa6);}(_0xedd9,0xfc));var _0x9edd=function(_0xbbfe2e,_0x4d5127){_0xbbfe2e=_0xbbfe2e-0x0;var _0x364fef=_0xedd9[_0xbbfe2e];return _0x364fef;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2ac9b1,_0x3d7bf2){var _0x55792b=function(_0x16e132){while(--_0x16e132){_0x2ac9b1['push'](_0x2ac9b1['shift']());}};_0x55792b(++_0x3d7bf2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x48ec91,_0x212edc){_0x48ec91=_0x48ec91-0x0;var _0x22766c=_0xcb91[_0x48ec91];return _0x22766c;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index ed85efe..756afe1 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 _0x1539=['INTEGER','exports'];(function(_0x2ab2e2,_0x2bec9c){var _0x5941d2=function(_0x3779d0){while(--_0x3779d0){_0x2ab2e2['push'](_0x2ab2e2['shift']());}};_0x5941d2(++_0x2bec9c);}(_0x1539,0x139));var _0x9153=function(_0x28897b,_0x4c8a20){_0x28897b=_0x28897b-0x0;var _0x3a1b68=_0x1539[_0x28897b];return _0x3a1b68;};'use strict';var Sequelize=require('sequelize');module[_0x9153('0x0')]={'penalty':{'type':Sequelize[_0x9153('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd4f7=['sequelize'];(function(_0x4e00f1,_0x427920){var _0x2c95f4=function(_0xc445e0){while(--_0xc445e0){_0x4e00f1['push'](_0x4e00f1['shift']());}};_0x2c95f4(++_0x427920);}(_0xd4f7,0x8c));var _0x7d4f=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0xd4f7[_0x54edc9];return _0x2ae7a9;};'use strict';var Sequelize=require(_0x7d4f('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'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 b08f0db..c101bf1 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 _0x94c5=['api','moment','bluebird','request-promise','path','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','util'];(function(_0x54a930,_0x40062f){var _0x46743e=function(_0x5e51df){while(--_0x5e51df){_0x54a930['push'](_0x54a930['shift']());}};_0x46743e(++_0x40062f);}(_0x94c5,0xf0));var _0x594c=function(_0x190abb,_0x5c356d){_0x190abb=_0x190abb-0x0;var _0x31fe0f=_0x94c5[_0x190abb];return _0x31fe0f;};'use strict';var _=require(_0x594c('0x0'));var util=require(_0x594c('0x1'));var logger=require('../../config/logger')(_0x594c('0x2'));var moment=require(_0x594c('0x3'));var BPromise=require(_0x594c('0x4'));var rp=require(_0x594c('0x5'));var fs=require('fs');var path=require(_0x594c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x594c('0x7'));module[_0x594c('0x8')]=function(_0x268ec2,_0x3a3c28){return _0x268ec2[_0x594c('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0x594c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fdb=['api','moment','bluebird','path','../../config/environment','./userOpenchannelQueue.attributes','define','user_has_openchannel_queues','lodash','util','../../config/logger'];(function(_0x7457fe,_0x564a5e){var _0x57a6e4=function(_0x566577){while(--_0x566577){_0x7457fe['push'](_0x7457fe['shift']());}};_0x57a6e4(++_0x564a5e);}(_0x6fdb,0x1e1));var _0xb6fd=function(_0xd72a57,_0x5b119d){_0xd72a57=_0xd72a57-0x0;var _0x37c1f2=_0x6fdb[_0xd72a57];return _0x37c1f2;};'use strict';var _=require(_0xb6fd('0x0'));var util=require(_0xb6fd('0x1'));var logger=require(_0xb6fd('0x2'))(_0xb6fd('0x3'));var moment=require(_0xb6fd('0x4'));var BPromise=require(_0xb6fd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb6fd('0x6'));var rimraf=require('rimraf');var config=require(_0xb6fd('0x7'));var attributes=require(_0xb6fd('0x8'));module['exports']=function(_0x2590d5,_0x196b5c){return _0x2590d5[_0xb6fd('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0xb6fd('0xa'),'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 35eca8a..c7647b3 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 _0x6aa9=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug'];(function(_0x1169e6,_0x32722f){var _0x534261=function(_0x34dd35){while(--_0x34dd35){_0x1169e6['push'](_0x1169e6['shift']());}};_0x534261(++_0x32722f);}(_0x6aa9,0x6e));var _0x96aa=function(_0x3d94ec,_0x4ba41b){_0x3d94ec=_0x3d94ec-0x0;var _0x7bd75d=_0x6aa9[_0x3d94ec];return _0x7bd75d;};'use strict';var _=require(_0x96aa('0x0'));var util=require(_0x96aa('0x1'));var moment=require(_0x96aa('0x2'));var BPromise=require(_0x96aa('0x3'));var rs=require(_0x96aa('0x4'));var fs=require('fs');var Redis=require(_0x96aa('0x5'));var db=require(_0x96aa('0x6'))['db'];var utils=require(_0x96aa('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x96aa('0x8'));var client=jayson[_0x96aa('0x9')][_0x96aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d862,_0x4443a4,_0x5658a4){return new BPromise(function(_0x123ae8,_0x45e834){return client[_0x96aa('0xb')](_0x1d862,_0x5658a4)[_0x96aa('0xc')](function(_0xfa4b7a){logger[_0x96aa('0xd')](_0x96aa('0xe'),_0x4443a4,'request\x20sent');logger[_0x96aa('0xf')](_0x96aa('0x10'),_0x4443a4,_0x96aa('0x11'),JSON[_0x96aa('0x12')](_0xfa4b7a));if(_0xfa4b7a['error']){if(_0xfa4b7a[_0x96aa('0x13')]['code']===0x1f4){logger[_0x96aa('0x13')](_0x96aa('0xe'),_0x4443a4,_0xfa4b7a[_0x96aa('0x13')][_0x96aa('0x14')]);return _0x45e834(_0xfa4b7a[_0x96aa('0x13')][_0x96aa('0x14')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4443a4,_0xfa4b7a['error'][_0x96aa('0x14')]);return _0x123ae8(_0xfa4b7a['error'][_0x96aa('0x14')]);}else{logger['info'](_0x96aa('0xe'),_0x4443a4,_0x96aa('0x11'));_0x123ae8(_0xfa4b7a['result'][_0x96aa('0x14')]);}})['catch'](function(_0x16a3b4){logger[_0x96aa('0x13')](_0x96aa('0xe'),_0x4443a4,_0x16a3b4);_0x45e834(_0x16a3b4);});});} \ No newline at end of file +var _0xa6d4=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','catch','moment','bluebird'];(function(_0x57e5e2,_0x50f2f0){var _0x1215f9=function(_0xc7ab72){while(--_0xc7ab72){_0x57e5e2['push'](_0x57e5e2['shift']());}};_0x1215f9(++_0x50f2f0);}(_0xa6d4,0x140));var _0x4a6d=function(_0x397a32,_0x1a6cf5){_0x397a32=_0x397a32-0x0;var _0x135033=_0xa6d4[_0x397a32];return _0x135033;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4a6d('0x0'));var BPromise=require(_0x4a6d('0x1'));var rs=require(_0x4a6d('0x2'));var fs=require('fs');var Redis=require(_0x4a6d('0x3'));var db=require(_0x4a6d('0x4'))['db'];var utils=require(_0x4a6d('0x5'));var logger=require(_0x4a6d('0x6'))(_0x4a6d('0x7'));var config=require(_0x4a6d('0x8'));var jayson=require(_0x4a6d('0x9'));var client=jayson[_0x4a6d('0xa')][_0x4a6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16c82d,_0x5ed03b,_0x324d09){return new BPromise(function(_0x116610,_0x25aeb4){return client[_0x4a6d('0xc')](_0x16c82d,_0x324d09)[_0x4a6d('0xd')](function(_0x3bedc4){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x5ed03b,_0x4a6d('0xe'));logger[_0x4a6d('0xf')](_0x4a6d('0x10'),_0x5ed03b,_0x4a6d('0xe'),JSON[_0x4a6d('0x11')](_0x3bedc4));if(_0x3bedc4[_0x4a6d('0x12')]){if(_0x3bedc4['error'][_0x4a6d('0x13')]===0x1f4){logger[_0x4a6d('0x12')](_0x4a6d('0x14'),_0x5ed03b,_0x3bedc4[_0x4a6d('0x12')][_0x4a6d('0x15')]);return _0x25aeb4(_0x3bedc4[_0x4a6d('0x12')]['message']);}logger['error'](_0x4a6d('0x14'),_0x5ed03b,_0x3bedc4['error'][_0x4a6d('0x15')]);return _0x116610(_0x3bedc4[_0x4a6d('0x12')][_0x4a6d('0x15')]);}else{logger['info'](_0x4a6d('0x14'),_0x5ed03b,'request\x20sent');_0x116610(_0x3bedc4['result']['message']);}})[_0x4a6d('0x16')](function(_0x1430b2){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x5ed03b,_0x1430b2);_0x25aeb4(_0x1430b2);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 1e9b41c..dfe5ca4 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 _0x5eb0=['isAuthenticated','index','/describe','describe','/:id','getSections','getResources','post','create','/:id/clone','clone','/:id/sections','/:id/resources','put','update','delete','destroy','removeSections','removeResources','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get'];(function(_0x5ebeaf,_0x2dc0b7){var _0x2a1de7=function(_0x4c7841){while(--_0x4c7841){_0x5ebeaf['push'](_0x5ebeaf['shift']());}};_0x2a1de7(++_0x2dc0b7);}(_0x5eb0,0x1c6));var _0x05eb=function(_0x22d04a,_0x2986bc){_0x22d04a=_0x22d04a-0x0;var _0x542e52=_0x5eb0[_0x22d04a];return _0x542e52;};'use strict';var multer=require(_0x05eb('0x0'));var util=require(_0x05eb('0x1'));var path=require(_0x05eb('0x2'));var timeout=require(_0x05eb('0x3'));var express=require(_0x05eb('0x4'));var router=express['Router']();var fs_extra=require(_0x05eb('0x5'));var auth=require(_0x05eb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x05eb('0x7'));var controller=require(_0x05eb('0x8'));router[_0x05eb('0x9')]('/',auth[_0x05eb('0xa')](),controller[_0x05eb('0xb')]);router[_0x05eb('0x9')](_0x05eb('0xc'),auth[_0x05eb('0xa')](),controller[_0x05eb('0xd')]);router[_0x05eb('0x9')](_0x05eb('0xe'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/sections',auth[_0x05eb('0xa')](),controller[_0x05eb('0xf')]);router['get']('/:id/resources',auth[_0x05eb('0xa')](),controller[_0x05eb('0x10')]);router[_0x05eb('0x11')]('/',auth['isAuthenticated'](),controller[_0x05eb('0x12')]);router['post'](_0x05eb('0x13'),auth[_0x05eb('0xa')](),controller[_0x05eb('0x14')]);router[_0x05eb('0x11')](_0x05eb('0x15'),auth[_0x05eb('0xa')](),controller['addSections']);router[_0x05eb('0x11')](_0x05eb('0x16'),auth['isAuthenticated'](),controller['addResources']);router[_0x05eb('0x17')](_0x05eb('0xe'),auth['isAuthenticated'](),controller[_0x05eb('0x18')]);router[_0x05eb('0x19')](_0x05eb('0xe'),auth[_0x05eb('0xa')](),controller[_0x05eb('0x1a')]);router['delete']('/:id/sections',auth[_0x05eb('0xa')](),controller[_0x05eb('0x1b')]);router['delete'](_0x05eb('0x16'),auth[_0x05eb('0xa')](),controller[_0x05eb('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x5336=['exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','addSections','addResources','put','update','delete','destroy','removeResources'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x5336,0xa9));var _0x6533=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x5336[_0x1a36a5];return _0x746243;};'use strict';var multer=require('multer');var util=require(_0x6533('0x0'));var path=require(_0x6533('0x1'));var timeout=require('connect-timeout');var express=require(_0x6533('0x2'));var router=express['Router']();var fs_extra=require(_0x6533('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6533('0x4'));var config=require(_0x6533('0x5'));var controller=require(_0x6533('0x6'));router['get']('/',auth[_0x6533('0x7')](),controller['index']);router[_0x6533('0x8')](_0x6533('0x9'),auth[_0x6533('0x7')](),controller[_0x6533('0xa')]);router[_0x6533('0x8')](_0x6533('0xb'),auth[_0x6533('0x7')](),controller[_0x6533('0xc')]);router[_0x6533('0x8')](_0x6533('0xd'),auth[_0x6533('0x7')](),controller[_0x6533('0xe')]);router[_0x6533('0x8')](_0x6533('0xf'),auth[_0x6533('0x7')](),controller[_0x6533('0x10')]);router[_0x6533('0x11')]('/',auth[_0x6533('0x7')](),controller[_0x6533('0x12')]);router[_0x6533('0x11')](_0x6533('0x13'),auth[_0x6533('0x7')](),controller['clone']);router['post'](_0x6533('0xd'),auth[_0x6533('0x7')](),controller[_0x6533('0x14')]);router[_0x6533('0x11')](_0x6533('0xf'),auth['isAuthenticated'](),controller[_0x6533('0x15')]);router[_0x6533('0x16')](_0x6533('0xb'),auth['isAuthenticated'](),controller[_0x6533('0x17')]);router[_0x6533('0x18')](_0x6533('0xb'),auth[_0x6533('0x7')](),controller[_0x6533('0x19')]);router['delete'](_0x6533('0xd'),auth[_0x6533('0x7')](),controller['removeSections']);router[_0x6533('0x18')](_0x6533('0xf'),auth['isAuthenticated'](),controller[_0x6533('0x1a')]);module[_0x6533('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 b0f4fa5..8e9f442 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 _0xe489=['crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x53e887,_0x5a4cb9){var _0x2a7cce=function(_0x4dbfc4){while(--_0x4dbfc4){_0x53e887['push'](_0x53e887['shift']());}};_0x2a7cce(++_0x5a4cb9);}(_0xe489,0x181));var _0x9e48=function(_0x2a25d6,_0x4b304b){_0x2a25d6=_0x2a25d6-0x0;var _0x3b6822=_0xe489[_0x2a25d6];return _0x3b6822;};'use strict';var Sequelize=require(_0x9e48('0x0'));module[_0x9e48('0x1')]={'name':{'type':Sequelize[_0x9e48('0x2')],'allowNull':![],'unique':_0x9e48('0x3')},'crudPermissions':{'type':Sequelize[_0x9e48('0x2')],'set':function(_0x2b369e){this[_0x9e48('0x4')](_0x9e48('0x5'),_0x2b369e?_0x2b369e[_0x9e48('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x9e48('0x5'))?this[_0x9e48('0x7')](_0x9e48('0x5'))[_0x9e48('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9e48('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x9e48('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x9e48('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9e48('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x9e48('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x9e48('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9e48('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9e48('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9e48('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb8d2=['getDataValue','crudPermissions','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','join'];(function(_0x39bc44,_0x1d4373){var _0x2916d8=function(_0x1767ac){while(--_0x1767ac){_0x39bc44['push'](_0x39bc44['shift']());}};_0x2916d8(++_0x1d4373);}(_0xb8d2,0xb8));var _0x2b8d=function(_0x3a4c07,_0x18440c){_0x3a4c07=_0x3a4c07-0x0;var _0x5a4943=_0xb8d2[_0x3a4c07];return _0x5a4943;};'use strict';var Sequelize=require(_0x2b8d('0x0'));module[_0x2b8d('0x1')]={'name':{'type':Sequelize[_0x2b8d('0x2')],'allowNull':![],'unique':_0x2b8d('0x3')},'crudPermissions':{'type':Sequelize[_0x2b8d('0x2')],'set':function(_0x1c9130){this[_0x2b8d('0x4')]('crudPermissions',_0x1c9130?_0x1c9130[_0x2b8d('0x5')](''):[]);},'get':function(){return this[_0x2b8d('0x6')](_0x2b8d('0x7'))?this['getDataValue'](_0x2b8d('0x7'))[_0x2b8d('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x2b8d('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x2b8d('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x2b8d('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x2b8d('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2b8d('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x2b8d('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 46db60a..f019ff6 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 _0xaaee=['nolimit','order','pick','where','merge','map','VIRTUAL','options','count','include','findAll','show','rawAttributes','includeAll','catch','create','body','clone','params','find','get','omit','createdAt','crudPermissions','updatedAt','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','UserProfileSection','push','removeSections','ids','filter','includes','isEmpty','subsections','enabled','findOne','forEach','resourceId','Plugin','addResources','sequelize','bulkCreate','removeResources','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','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/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','json','undefined','limit','offset','set','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','UserProfile','fieldName','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x174658,_0x49d391){var _0x9d1d1a=function(_0x19f723){while(--_0x19f723){_0x174658['push'](_0x174658['shift']());}};_0x9d1d1a(++_0x49d391);}(_0xaaee,0xa9));var _0xeaae=function(_0x1f3b1c,_0x481f75){_0x1f3b1c=_0x1f3b1c-0x0;var _0x573b21=_0xaaee[_0x1f3b1c];return _0x573b21;};'use strict';var emlformat=require(_0xeaae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeaae('0x1'));var jsonpatch=require(_0xeaae('0x2'));var rp=require('request-promise');var moment=require(_0xeaae('0x3'));var BPromise=require(_0xeaae('0x4'));var Mustache=require(_0xeaae('0x5'));var util=require(_0xeaae('0x6'));var path=require('path');var sox=require(_0xeaae('0x7'));var csv=require(_0xeaae('0x8'));var ejs=require(_0xeaae('0x9'));var fs=require('fs');var fs_extra=require(_0xeaae('0xa'));var _=require(_0xeaae('0xb'));var squel=require(_0xeaae('0xc'));var crypto=require('crypto');var jsforce=require(_0xeaae('0xd'));var deskjs=require(_0xeaae('0xe'));var toCsv=require(_0xeaae('0x8'));var querystring=require(_0xeaae('0xf'));var Papa=require(_0xeaae('0x10'));var Redis=require(_0xeaae('0x11'));var authService=require(_0xeaae('0x12'));var qs=require(_0xeaae('0x13'));var as=require(_0xeaae('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeaae('0x15'))(_0xeaae('0x16'));var utils=require(_0xeaae('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xeaae('0x18'))['db'];config[_0xeaae('0x19')]=_[_0xeaae('0x1a')](config['redis'],{'host':_0xeaae('0x1b'),'port':0x18eb});var socket=require(_0xeaae('0x1c'))(new Redis(config[_0xeaae('0x19')]));require(_0xeaae('0x1d'))['register'](socket);function respondWithStatusCode(_0x4d3766,_0x1a75b7){_0x1a75b7=_0x1a75b7||0xcc;return function(_0x1b4f7e){if(_0x1b4f7e){return _0x4d3766[_0xeaae('0x1e')](_0x1a75b7);}return _0x4d3766[_0xeaae('0x1f')](_0x1a75b7)['end']();};}function respondWithResult(_0x1dd48f,_0x5be794){_0x5be794=_0x5be794||0xc8;return function(_0x29bd11){if(_0x29bd11){return _0x1dd48f[_0xeaae('0x1f')](_0x5be794)[_0xeaae('0x20')](_0x29bd11);}};}function respondWithFilteredResult(_0x355f39,_0x574ff7){return function(_0x538e3d){if(_0x538e3d){var _0x5d5aa1=typeof _0x574ff7['offset']===_0xeaae('0x21')&&typeof _0x574ff7[_0xeaae('0x22')]==='undefined';var _0x4667ff=_0x538e3d['count'];var _0x1ac7a2=_0x5d5aa1?0x0:_0x574ff7[_0xeaae('0x23')];var _0x3491a6=_0x5d5aa1?_0x538e3d['count']:_0x574ff7[_0xeaae('0x23')]+_0x574ff7[_0xeaae('0x22')];var _0x4c925a;if(_0x3491a6>=_0x4667ff){_0x3491a6=_0x4667ff;_0x4c925a=0xc8;}else{_0x4c925a=0xce;}_0x355f39['status'](_0x4c925a);return _0x355f39[_0xeaae('0x24')]('Content-Range',_0x1ac7a2+'-'+_0x3491a6+'/'+_0x4667ff)['json'](_0x538e3d);}return null;};}function patchUpdates(_0x12f1b0){return function(_0x20d632){try{jsonpatch[_0xeaae('0x25')](_0x20d632,_0x12f1b0,!![]);}catch(_0x25945c){return BPromise[_0xeaae('0x26')](_0x25945c);}return _0x20d632[_0xeaae('0x27')]();};}function saveUpdates(_0x2a961c,_0x3881f3){return function(_0x31801a){if(_0x31801a){return _0x31801a[_0xeaae('0x28')](_0x2a961c)['then'](function(_0xa7fa13){return _0xa7fa13;});}return null;};}function removeEntity(_0x124b21,_0x10a0f2){return function(_0x337bdb){if(_0x337bdb){return _0x337bdb[_0xeaae('0x29')]()[_0xeaae('0x2a')](function(){_0x124b21[_0xeaae('0x1f')](0xcc)[_0xeaae('0x2b')]();});}};}function handleEntityNotFound(_0x58ac1d,_0x51c515){return function(_0x261ccd){if(!_0x261ccd){_0x58ac1d[_0xeaae('0x1e')](0x194);}return _0x261ccd;};}function handleError(_0x3ee762,_0x5d2a26){_0x5d2a26=_0x5d2a26||0x1f4;return function(_0x294938){logger[_0xeaae('0x2c')](_0x294938[_0xeaae('0x2d')]);if(_0x294938[_0xeaae('0x2e')]){delete _0x294938[_0xeaae('0x2e')];}_0x3ee762[_0xeaae('0x1f')](_0x5d2a26)[_0xeaae('0x2f')](_0x294938);};}exports[_0xeaae('0x30')]=function(_0x38c80c,_0x24f0f2){var _0x48aeca={},_0x43a759={},_0x2363fa={'count':0x0,'rows':[]};var _0x4c938f=_['map'](db[_0xeaae('0x31')]['rawAttributes'],function(_0x1dfe6b){return{'name':_0x1dfe6b[_0xeaae('0x32')],'type':_0x1dfe6b[_0xeaae('0x33')]['key']};});_0x43a759['model']=_['map'](_0x4c938f,_0xeaae('0x2e'));_0x43a759['query']=_[_0xeaae('0x34')](_0x38c80c[_0xeaae('0x35')]);_0x43a759[_0xeaae('0x36')]=_['intersection'](_0x43a759[_0xeaae('0x37')],_0x43a759[_0xeaae('0x35')]);_0x48aeca[_0xeaae('0x38')]=_[_0xeaae('0x39')](_0x43a759[_0xeaae('0x37')],qs['fields'](_0x38c80c[_0xeaae('0x35')][_0xeaae('0x3a')]));_0x48aeca[_0xeaae('0x38')]=_0x48aeca[_0xeaae('0x38')][_0xeaae('0x3b')]?_0x48aeca[_0xeaae('0x38')]:_0x43a759[_0xeaae('0x37')];if(!_0x38c80c[_0xeaae('0x35')][_0xeaae('0x3c')](_0xeaae('0x3d'))){_0x48aeca[_0xeaae('0x22')]=qs['limit'](_0x38c80c['query']['limit']);_0x48aeca['offset']=qs['offset'](_0x38c80c[_0xeaae('0x35')]['offset']);}_0x48aeca[_0xeaae('0x3e')]=qs['sort'](_0x38c80c[_0xeaae('0x35')]['sort']);_0x48aeca['where']=qs[_0xeaae('0x36')](_[_0xeaae('0x3f')](_0x38c80c['query'],_0x43a759[_0xeaae('0x36')]),_0x4c938f);if(_0x38c80c[_0xeaae('0x35')]['filter']){_0x48aeca[_0xeaae('0x40')]=_[_0xeaae('0x41')](_0x48aeca[_0xeaae('0x40')],{'$or':_[_0xeaae('0x42')](_0x4c938f,function(_0x31ccc7){if(_0x31ccc7['type']!==_0xeaae('0x43')){var _0x53b310={};_0x53b310[_0x31ccc7[_0xeaae('0x2e')]]={'$like':'%'+_0x38c80c[_0xeaae('0x35')]['filter']+'%'};return _0x53b310;}})});}_0x48aeca=_[_0xeaae('0x41')]({},_0x48aeca,_0x38c80c[_0xeaae('0x44')]);var _0x412843={'where':_0x48aeca['where']};return db[_0xeaae('0x31')][_0xeaae('0x45')](_0x412843)[_0xeaae('0x2a')](function(_0x40d844){_0x2363fa[_0xeaae('0x45')]=_0x40d844;if(_0x38c80c['query']['includeAll']){_0x48aeca[_0xeaae('0x46')]=[{'all':!![]}];}return db[_0xeaae('0x31')][_0xeaae('0x47')](_0x48aeca);})['then'](function(_0x467a65){_0x2363fa['rows']=_0x467a65;return _0x2363fa;})[_0xeaae('0x2a')](respondWithFilteredResult(_0x24f0f2,_0x48aeca))['catch'](handleError(_0x24f0f2,null));};exports[_0xeaae('0x48')]=function(_0x456ab6,_0x24b855){var _0x4c5c73={'raw':![],'where':{'id':_0x456ab6['params']['id']}},_0x19dce2={};_0x19dce2[_0xeaae('0x37')]=_['keys'](db['UserProfile'][_0xeaae('0x49')]);_0x19dce2[_0xeaae('0x35')]=_['keys'](_0x456ab6[_0xeaae('0x35')]);_0x19dce2[_0xeaae('0x36')]=_[_0xeaae('0x39')](_0x19dce2[_0xeaae('0x37')],_0x19dce2[_0xeaae('0x35')]);_0x4c5c73[_0xeaae('0x38')]=_['intersection'](_0x19dce2[_0xeaae('0x37')],qs[_0xeaae('0x3a')](_0x456ab6[_0xeaae('0x35')]['fields']));_0x4c5c73['attributes']=_0x4c5c73[_0xeaae('0x38')][_0xeaae('0x3b')]?_0x4c5c73['attributes']:_0x19dce2[_0xeaae('0x37')];if(_0x456ab6[_0xeaae('0x35')][_0xeaae('0x4a')]){_0x4c5c73[_0xeaae('0x46')]=[{'all':!![]}];}_0x4c5c73=_[_0xeaae('0x41')]({},_0x4c5c73,_0x456ab6['options']);return db[_0xeaae('0x31')]['find'](_0x4c5c73)['then'](handleEntityNotFound(_0x24b855,null))[_0xeaae('0x2a')](respondWithResult(_0x24b855,null))[_0xeaae('0x4b')](handleError(_0x24b855,null));};exports[_0xeaae('0x4c')]=function(_0x285dfe,_0x235b0d){return db[_0xeaae('0x31')][_0xeaae('0x4c')](_0x285dfe[_0xeaae('0x4d')],{})[_0xeaae('0x2a')](respondWithResult(_0x235b0d,0xc9))[_0xeaae('0x4b')](handleError(_0x235b0d,null));};exports[_0xeaae('0x4e')]=function(_0x1312bb,_0xa77659){var _0x451553={'where':{'id':_0x1312bb[_0xeaae('0x4f')]['id']}},_0x5be668={};_0x5be668['model']=_[_0xeaae('0x34')](db[_0xeaae('0x31')][_0xeaae('0x49')]);_0x451553[_0xeaae('0x38')]=_['intersection'](_0x5be668[_0xeaae('0x37')],qs['fields'](_0x1312bb[_0xeaae('0x35')][_0xeaae('0x3a')]));_0x451553[_0xeaae('0x38')]=_0x451553[_0xeaae('0x38')]['length']?_0x451553[_0xeaae('0x38')]:_0x5be668[_0xeaae('0x37')];if(_0x1312bb[_0xeaae('0x35')][_0xeaae('0x4a')]){_0x451553['include']=[{'all':!![]}];}_0x451553=_[_0xeaae('0x41')]({},_0x451553,_0x1312bb[_0xeaae('0x44')]);return db['UserProfile'][_0xeaae('0x50')](_0x451553)[_0xeaae('0x2a')](handleEntityNotFound(_0xa77659,null))[_0xeaae('0x2a')](function(_0x2a9a84){if(_0x2a9a84){var _0xe8e418=_0x2a9a84[_0xeaae('0x51')]({'plain':!![]});_0xe8e418=qs[_0xeaae('0x52')](_0xe8e418,['id',_0xeaae('0x53'),'updatedAt',_0xeaae('0x54')]);_0x1312bb[_0xeaae('0x4d')]=_[_0xeaae('0x52')](_0x1312bb[_0xeaae('0x4d')],['id',_0xeaae('0x53'),_0xeaae('0x55')]);return db['sequelize'][_0xeaae('0x56')](function(_0x47a350){return db[_0xeaae('0x31')]['create'](_[_0xeaae('0x41')](_0xe8e418,_0x1312bb[_0xeaae('0x4d')]),{'include':_0x1312bb['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x47a350})[_0xeaae('0x2a')](function(_0x3d7d1b){var _0x19f230=_0x3d7d1b[_0xeaae('0x51')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x1312bb[_0xeaae('0x4f')]['id']},'raw':!![]})[_0xeaae('0x2a')](function(_0x46d1c1){if(_0x46d1c1){return BPromise[_0xeaae('0x57')](_0x46d1c1,function(_0x8005ec){return new BPromise(function(_0x52e20d,_0x570bb9){if(_0x8005ec[_0xeaae('0x58')]===null||_0x8005ec['autoAssociation']===0x1)_0x52e20d(null);return db[_0xeaae('0x59')][_0xeaae('0x47')]({'where':{'sectionId':_0x8005ec['id']},'raw':!![]})[_0xeaae('0x2a')](function(_0x4d9fce){var _0x2f290f=_[_0xeaae('0x42')](_0x4d9fce,function(_0x59881d){return qs[_0xeaae('0x52')](_0x59881d,['id',_0xeaae('0x53'),_0xeaae('0x55'),_0xeaae('0x5a')]);});_0x52e20d(_0x2f290f);})[_0xeaae('0x4b')](function(_0x397ba7){_0x570bb9(_0x397ba7);});})[_0xeaae('0x2a')](function(_0x24a36b){var _0x2975c8=qs[_0xeaae('0x52')](_0x8005ec,['id',_0xeaae('0x53'),_0xeaae('0x55')]);_0x2975c8[_0xeaae('0x5b')]=_0x19f230['id'];if(_0x24a36b)_0x2975c8[_0xeaae('0x5c')]=_0x24a36b;return _0x2975c8;})[_0xeaae('0x2a')](function(_0x52bc70){return db['UserProfileSection'][_0xeaae('0x4c')](_0x52bc70,{'include':[{'model':db[_0xeaae('0x59')],'as':_0xeaae('0x5c')}],'raw':!![],'transaction':_0x47a350});});})[_0xeaae('0x2a')](function(){return _0x19f230;});}});});});}})[_0xeaae('0x2a')](respondWithResult(_0xa77659,0xc9))[_0xeaae('0x4b')](handleError(_0xa77659,null));};exports[_0xeaae('0x28')]=function(_0x52f51c,_0x45886d){if(_0x52f51c[_0xeaae('0x4d')]['id']){delete _0x52f51c[_0xeaae('0x4d')]['id'];}return db[_0xeaae('0x31')][_0xeaae('0x50')]({'where':{'id':_0x52f51c['params']['id']}})['then'](handleEntityNotFound(_0x45886d,null))[_0xeaae('0x2a')](saveUpdates(_0x52f51c[_0xeaae('0x4d')],null))[_0xeaae('0x2a')](respondWithResult(_0x45886d,null))[_0xeaae('0x4b')](handleError(_0x45886d,null));};exports[_0xeaae('0x29')]=function(_0x4b4171,_0x1abd87){return db['UserProfile'][_0xeaae('0x50')]({'where':{'id':_0x4b4171[_0xeaae('0x4f')]['id']}})[_0xeaae('0x2a')](handleEntityNotFound(_0x1abd87,null))[_0xeaae('0x2a')](removeEntity(_0x1abd87,null))['catch'](handleError(_0x1abd87,null));};exports[_0xeaae('0x5d')]=function(_0x2f701c,_0x462ad5){return db[_0xeaae('0x31')][_0xeaae('0x5d')]()[_0xeaae('0x2a')](respondWithResult(_0x462ad5,null))[_0xeaae('0x4b')](handleError(_0x462ad5,null));};exports[_0xeaae('0x5e')]=function(_0x2cf10,_0x2a0b33){var _0x513a7e=_0x2cf10[_0xeaae('0x4d')];return db[_0xeaae('0x31')]['find']({'where':{'id':_0x2cf10[_0xeaae('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2a0b33,null))[_0xeaae('0x2a')](function(_0x23266f){if(_0x23266f){return db['sequelize']['transaction'](function(_0x1af83b){return db[_0xeaae('0x5f')][_0xeaae('0x29')]({'where':{'userProfileId':_0x2cf10[_0xeaae('0x4f')]['id'],'sectionId':_[_0xeaae('0x42')](_0x513a7e,function(_0x5a9e4e){return _0x5a9e4e[_0xeaae('0x5a')];})},'transaction':_0x1af83b})[_0xeaae('0x2a')](function(){var _0x3cd27e=_[_0xeaae('0x42')](_0x513a7e,function(_0x333f03){_0x333f03[_0xeaae('0x5b')]=_0x2cf10[_0xeaae('0x4f')]['id'];return _0x333f03;});var _0x1d42a9=[];return BPromise['each'](_0x3cd27e,function(_0x3a1c81){return db[_0xeaae('0x5f')][_0xeaae('0x4c')](_0x3a1c81,{'include':[{'model':db[_0xeaae('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x1af83b})['then'](function(_0x5f22fa){_0x1d42a9[_0xeaae('0x60')](_0x5f22fa[_0xeaae('0x51')]({'plain':!![]}));});})[_0xeaae('0x2a')](function(){return _0x1d42a9;});});});}})[_0xeaae('0x2a')](function(_0x4c22f7){return _0x4c22f7;})[_0xeaae('0x2a')](respondWithResult(_0x2a0b33,null))['catch'](handleError(_0x2a0b33,null));};exports[_0xeaae('0x61')]=function(_0x4b3f81,_0x1c529d){var _0x551df3;return db[_0xeaae('0x31')][_0xeaae('0x50')]({'where':{'id':_0x4b3f81[_0xeaae('0x4f')]['id']},'attributes':['id',_0xeaae('0x2e')]})[_0xeaae('0x2a')](handleEntityNotFound(_0x1c529d,null))['then'](function(_0x362629){if(_0x362629){_0x551df3=_0x362629;return db['UserProfileSection'][_0xeaae('0x29')]({'where':{'userProfileId':_0x4b3f81[_0xeaae('0x4f')]['id'],'sectionId':_0x4b3f81[_0xeaae('0x35')][_0xeaae('0x62')]}});}})['then'](function(){return _0x551df3;})['then'](respondWithStatusCode(_0x1c529d,null))[_0xeaae('0x4b')](handleError(_0x1c529d,null));};exports['getSections']=function(_0x2595e3,_0x2b44bd){var _0x48b5f7=[];var _0x42b694=[];return db['UserProfileSection'][_0xeaae('0x47')]({'where':{'userProfileId':_0x2595e3['params']['id']},'raw':!![]})['then'](function(_0x40c8cf){_0x48b5f7=_[_0xeaae('0x63')](_0x40c8cf,function(_0x42d002){return _0x42d002['enabled']===0x1||_[_0xeaae('0x64')]([0x3eb,0x709],_0x42d002[_0xeaae('0x5a')]);});if(!_[_0xeaae('0x65')](_0x48b5f7)){return _[_0xeaae('0x42')](_0x48b5f7,function(_0x3366c1){return _0x3366c1[_0xeaae('0x5a')];});}else{return;}})[_0xeaae('0x2a')](function(_0x55dc28){if(_0x55dc28)_0x42b694=_0x55dc28;if(_['includes'](_0x42b694,0x64)){var _0x589699=_['find'](_0x48b5f7,{'sectionId':0x64});return hasDefaultDashboard(_0x589699)['then'](function(_0x17c969){return _[_0xeaae('0x42')](_0x48b5f7,function(_0x224514){if(_0x224514[_0xeaae('0x5a')]===0x64){_0x224514[_0xeaae('0x66')]=_0x17c969;}return _0x224514;});});}else{return;}})[_0xeaae('0x2a')](function(_0x2b2427){if(_0x2b2427)_0x48b5f7=_0x2b2427;if(_['includes'](_0x42b694,0x3eb)){var _0x53a485=_[_0xeaae('0x50')](_0x48b5f7,{'sectionId':0x3eb});return getCustomDashboards(_0x53a485)['then'](function(_0x545ec9){return _[_0xeaae('0x42')](_0x48b5f7,function(_0x11fe79){if(_0x53a485['enabled']){if(_0x11fe79[_0xeaae('0x5a')]===0x3eb){_0x11fe79[_0xeaae('0x66')]=_0x545ec9;}}else{if(_0x11fe79[_0xeaae('0x5a')]===0x64){_0x11fe79[_0xeaae('0x66')]=_0x545ec9;}}return _0x11fe79;});});}else{return;}})[_0xeaae('0x2a')](function(_0x143969){if(_0x143969)_0x48b5f7=_0x143969;if(_[_0xeaae('0x64')](_0x42b694,0x709)){var _0x43bc34=_[_0xeaae('0x50')](_0x48b5f7,{'sectionId':0x709});return getPlugins(_0x43bc34)['then'](function(_0x14bd5f){if(_0x43bc34['enabled']){return _[_0xeaae('0x42')](_0x48b5f7,function(_0x56eb3f){if(_0x56eb3f[_0xeaae('0x5a')]===0x709){_0x56eb3f['subsections']=_0x14bd5f;}return _0x56eb3f;});}else{var _0x3fa3f9={'sectionId':0x76c,'enabled':0x1,'subsections':_0x14bd5f};var _0x4b35f2=_[_0xeaae('0x42')](_0x48b5f7);_0x4b35f2[_0xeaae('0x60')](_0x3fa3f9);return _0x4b35f2;}});}else{return;}})[_0xeaae('0x2a')](function(_0x1b3992){if(_0x1b3992)_0x48b5f7=_0x1b3992;return _['filter'](_0x48b5f7,[_0xeaae('0x67'),0x1]);})['then'](respondWithResult(_0x2b44bd,null))[_0xeaae('0x4b')](handleError(_0x2b44bd,null));};function hasDefaultDashboard(_0x4098f6){var _0x1c1ceb=[0x65];return new BPromise(function(_0x5c1868,_0x4c7a7b){try{if(_0x4098f6[_0xeaae('0x58')]){_0x5c1868(_0x1c1ceb);}else{return db[_0xeaae('0x59')][_0xeaae('0x68')]({'where':{'sectionId':_0x4098f6['id']},'raw':!![]})[_0xeaae('0x2a')](function(_0x3e0591){_0x3e0591?_0x5c1868(_0x1c1ceb):_0x5c1868();});}}catch(_0x3055b5){_0x4c7a7b(_0x3055b5);}});}function getCustomDashboards(_0x47cc16){var _0x1c1223=[];return new BPromise(function(_0x3a0337,_0xb81906){try{if(_0x47cc16[_0xeaae('0x58')]){return db['Dashboard'][_0xeaae('0x47')]({'raw':!![]})[_0xeaae('0x2a')](function(_0x10e519){_0x10e519[_0xeaae('0x69')](function(_0x2638f5){_0x1c1223[_0xeaae('0x60')](_0x2638f5['id']+0x1869f);});_0x3a0337(_0x1c1223);});}else{return db[_0xeaae('0x59')][_0xeaae('0x47')]({'where':{'sectionId':_0x47cc16['id']},'raw':!![]})[_0xeaae('0x2a')](function(_0x18fabf){_0x18fabf[_0xeaae('0x69')](function(_0x4272d8){_0x1c1223[_0xeaae('0x60')](_0x4272d8[_0xeaae('0x6a')]+0x1869f);});_0x3a0337(_0x1c1223);});}}catch(_0x398612){_0xb81906(_0x398612);}});}function getPlugins(_0x1b3c11){var _0xdf4dc3=[];return new BPromise(function(_0x6e584,_0x3ed552){try{if(_0x1b3c11[_0xeaae('0x58')]){return db[_0xeaae('0x6b')]['findAll']({'raw':!![]})[_0xeaae('0x2a')](function(_0x1a4dff){_0x1a4dff[_0xeaae('0x69')](function(_0x30afdb){_0xdf4dc3[_0xeaae('0x60')](_0x30afdb['id']+0x15b38);});_0x6e584(_0xdf4dc3);});}else{return db[_0xeaae('0x59')][_0xeaae('0x47')]({'where':{'sectionId':_0x1b3c11['id']},'raw':!![]})[_0xeaae('0x2a')](function(_0x54b53f){_0x54b53f['forEach'](function(_0x3a0b84){_0xdf4dc3[_0xeaae('0x60')](_0x3a0b84[_0xeaae('0x6a')]+0x15b38);});_0x6e584(_0xdf4dc3);});}}catch(_0x2df97d){_0x3ed552(_0x2df97d);}});}exports[_0xeaae('0x6c')]=function(_0x45a081,_0x5db212){return db['UserProfile']['find']({'where':{'id':_0x45a081['params']['id']}})[_0xeaae('0x2a')](handleEntityNotFound(_0x5db212,null))[_0xeaae('0x2a')](function(_0x1f9089){if(_0x1f9089){return db[_0xeaae('0x6d')]['transaction'](function(_0x480a4e){return db[_0xeaae('0x5f')]['findAll']({'where':{'userProfileId':_0x45a081[_0xeaae('0x4f')]['id']},'attributes':['id'],'raw':!![]})[_0xeaae('0x2a')](function(_0x2a9f3b){if(_0x2a9f3b){return db[_0xeaae('0x5f')][_0xeaae('0x29')]({'where':{'userProfileId':_0x45a081[_0xeaae('0x4f')]['id'],'id':_['map'](_0x2a9f3b,function(_0x2b5770){return _0x2b5770['id'];})},'transaction':_0x480a4e});}})['then'](function(_0x6b5a0a){var _0x32dffe=_['map'](_0x45a081['body'],function(_0x25bf58){_0x25bf58['userProfileId']=_0x45a081[_0xeaae('0x4f')]['id'];return _0x25bf58;});return db[_0xeaae('0x5f')][_0xeaae('0x6e')](_0x32dffe,{'raw':!![],'transaction':_0x480a4e});})[_0xeaae('0x2a')](function(_0x39b1a2){var _0x22ad7f=_[_0xeaae('0x63')](_['map'](_0x39b1a2,function(_0x115e09){return _0x115e09['get']({'plain':!![]});}),{'includeAll':![]});if(_0x22ad7f){return db[_0xeaae('0x5f')][_0xeaae('0x47')]({'where':{'userProfileId':_0x45a081[_0xeaae('0x4f')]['id'],'sectionId':_[_0xeaae('0x42')](_0x22ad7f,function(_0x43d121){return _0x43d121['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0xeaae('0x2a')](function(_0xc3d8e6){var _0x610fa3=_[_0xeaae('0x42')](_0x45a081['body'],function(_0x4eb1b2){_0x4eb1b2[_0xeaae('0x5b')]=_0x45a081[_0xeaae('0x4f')]['id'];return _0x4eb1b2;});return db['UserProfileResource'][_0xeaae('0x6e')](_0x610fa3,{'raw':!![],'transaction':_0x480a4e});});}})[_0xeaae('0x4b')](handleError(_0x5db212,null));});}})['then'](function(_0x5d060f){var _0x43aaff=_[_0xeaae('0x42')](_0x5d060f,function(_0xc19289){return _0xc19289[_0xeaae('0x51')]({'plain':!![]});});})[_0xeaae('0x2a')](respondWithResult(_0x5db212,null))['catch'](handleError(_0x5db212,null));};exports[_0xeaae('0x6f')]=function(_0x481fee,_0x17ea66,_0x307265){return db[_0xeaae('0x31')]['find']({'where':{'id':_0x481fee[_0xeaae('0x4f')]['id']}})[_0xeaae('0x2a')](handleEntityNotFound(_0x17ea66,null))[_0xeaae('0x2a')](function(_0x5d0426){if(_0x5d0426){return _0x5d0426[_0xeaae('0x6f')](_0x481fee['query']['ids']);}})[_0xeaae('0x2a')](respondWithStatusCode(_0x17ea66,null))[_0xeaae('0x4b')](handleError(_0x17ea66,null));};exports[_0xeaae('0x70')]=function(_0x7d9874,_0x4e2661){var _0x5ef9b9={};if(!_0x7d9874['query'][_0xeaae('0x71')])throw new Error('Missing\x20section\x20parameter');if(!_0x7d9874[_0xeaae('0x35')][_0xeaae('0x3c')]('nolimit')){_0x5ef9b9['limit']=qs[_0xeaae('0x22')](_0x7d9874[_0xeaae('0x35')]['limit']);_0x5ef9b9[_0xeaae('0x23')]=qs[_0xeaae('0x23')](_0x7d9874[_0xeaae('0x35')][_0xeaae('0x23')]);}return db[_0xeaae('0x31')][_0xeaae('0x50')]({'where':{'id':_0x7d9874['params']['id']}})[_0xeaae('0x2a')](function(_0x1f4785){if(!_0x1f4785)throw new Error(_0xeaae('0x72')+_0x7d9874['params']['id']);return db[_0xeaae('0x31')][_0xeaae('0x70')](_0x7d9874);})[_0xeaae('0x2a')](respondWithFilteredResult(_0x4e2661,_0x5ef9b9))[_0xeaae('0x4b')](handleError(_0x4e2661,null));}; \ No newline at end of file +var _0xb5fa=['getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','fieldName','type','key','model','map','query','filters','intersection','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','UserProfile','include','findAll','rows','catch','show','keys','rawAttributes','fields','length','includeAll','merge','find','create','body','clone','get','updatedAt','omit','createdAt','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','userProfileId','Resources','params','describe','addSections','sectionId','each','push'];(function(_0x404d07,_0x114ff6){var _0xaf09a8=function(_0x3d1cca){while(--_0x3d1cca){_0x404d07['push'](_0x404d07['shift']());}};_0xaf09a8(++_0x114ff6);}(_0xb5fa,0xf8));var _0xab5f=function(_0x5a8ee3,_0x5864a3){_0x5a8ee3=_0x5a8ee3-0x0;var _0x59042a=_0xb5fa[_0x5a8ee3];return _0x59042a;};'use strict';var emlformat=require(_0xab5f('0x0'));var rimraf=require(_0xab5f('0x1'));var zipdir=require(_0xab5f('0x2'));var jsonpatch=require(_0xab5f('0x3'));var rp=require(_0xab5f('0x4'));var moment=require(_0xab5f('0x5'));var BPromise=require(_0xab5f('0x6'));var Mustache=require(_0xab5f('0x7'));var util=require(_0xab5f('0x8'));var path=require(_0xab5f('0x9'));var sox=require(_0xab5f('0xa'));var csv=require(_0xab5f('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xab5f('0xc'));var crypto=require(_0xab5f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xab5f('0xe'));var toCsv=require(_0xab5f('0xb'));var querystring=require(_0xab5f('0xf'));var Papa=require(_0xab5f('0x10'));var Redis=require(_0xab5f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xab5f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab5f('0x13'));var logger=require('../../config/logger')(_0xab5f('0x14'));var utils=require(_0xab5f('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xab5f('0x16')]=_[_0xab5f('0x17')](config['redis'],{'host':_0xab5f('0x18'),'port':0x18eb});var socket=require(_0xab5f('0x19'))(new Redis(config[_0xab5f('0x16')]));require(_0xab5f('0x1a'))[_0xab5f('0x1b')](socket);function respondWithStatusCode(_0x4101ee,_0x4319c7){_0x4319c7=_0x4319c7||0xcc;return function(_0x425053){if(_0x425053){return _0x4101ee[_0xab5f('0x1c')](_0x4319c7);}return _0x4101ee[_0xab5f('0x1d')](_0x4319c7)[_0xab5f('0x1e')]();};}function respondWithResult(_0x30089f,_0x177e6d){_0x177e6d=_0x177e6d||0xc8;return function(_0x22588b){if(_0x22588b){return _0x30089f[_0xab5f('0x1d')](_0x177e6d)[_0xab5f('0x1f')](_0x22588b);}};}function respondWithFilteredResult(_0xecd649,_0x340190){return function(_0x4aca7d){if(_0x4aca7d){var _0x2caadb=typeof _0x340190['offset']===_0xab5f('0x20')&&typeof _0x340190[_0xab5f('0x21')]===_0xab5f('0x20');var _0x1d6c2b=_0x4aca7d['count'];var _0xd2df62=_0x2caadb?0x0:_0x340190[_0xab5f('0x22')];var _0x3bca15=_0x2caadb?_0x4aca7d[_0xab5f('0x23')]:_0x340190[_0xab5f('0x22')]+_0x340190[_0xab5f('0x21')];var _0x58cfa4;if(_0x3bca15>=_0x1d6c2b){_0x3bca15=_0x1d6c2b;_0x58cfa4=0xc8;}else{_0x58cfa4=0xce;}_0xecd649[_0xab5f('0x1d')](_0x58cfa4);return _0xecd649[_0xab5f('0x24')](_0xab5f('0x25'),_0xd2df62+'-'+_0x3bca15+'/'+_0x1d6c2b)['json'](_0x4aca7d);}return null;};}function patchUpdates(_0xb47124){return function(_0x134a23){try{jsonpatch[_0xab5f('0x26')](_0x134a23,_0xb47124,!![]);}catch(_0x237704){return BPromise[_0xab5f('0x27')](_0x237704);}return _0x134a23[_0xab5f('0x28')]();};}function saveUpdates(_0x4b3127,_0x55daaf){return function(_0x3c5847){if(_0x3c5847){return _0x3c5847[_0xab5f('0x29')](_0x4b3127)[_0xab5f('0x2a')](function(_0x39bf0f){return _0x39bf0f;});}return null;};}function removeEntity(_0x3fb403,_0x49972a){return function(_0x3db1a6){if(_0x3db1a6){return _0x3db1a6[_0xab5f('0x2b')]()['then'](function(){_0x3fb403[_0xab5f('0x1d')](0xcc)[_0xab5f('0x1e')]();});}};}function handleEntityNotFound(_0x56e074,_0x391fec){return function(_0x4fee82){if(!_0x4fee82){_0x56e074[_0xab5f('0x1c')](0x194);}return _0x4fee82;};}function handleError(_0x2c0a1a,_0x1e1fa9){_0x1e1fa9=_0x1e1fa9||0x1f4;return function(_0x239229){logger['error'](_0x239229[_0xab5f('0x2c')]);if(_0x239229[_0xab5f('0x2d')]){delete _0x239229[_0xab5f('0x2d')];}_0x2c0a1a[_0xab5f('0x1d')](_0x1e1fa9)[_0xab5f('0x2e')](_0x239229);};}exports['index']=function(_0x5c6229,_0x7f5308){var _0x464287={},_0x290df8={},_0x274951={'count':0x0,'rows':[]};var _0x4bd729=_['map'](db['UserProfile']['rawAttributes'],function(_0x494c4b){return{'name':_0x494c4b[_0xab5f('0x2f')],'type':_0x494c4b[_0xab5f('0x30')][_0xab5f('0x31')]};});_0x290df8[_0xab5f('0x32')]=_[_0xab5f('0x33')](_0x4bd729,_0xab5f('0x2d'));_0x290df8[_0xab5f('0x34')]=_['keys'](_0x5c6229[_0xab5f('0x34')]);_0x290df8[_0xab5f('0x35')]=_[_0xab5f('0x36')](_0x290df8[_0xab5f('0x32')],_0x290df8[_0xab5f('0x34')]);_0x464287[_0xab5f('0x37')]=_['intersection'](_0x290df8[_0xab5f('0x32')],qs['fields'](_0x5c6229[_0xab5f('0x34')]['fields']));_0x464287['attributes']=_0x464287['attributes']['length']?_0x464287[_0xab5f('0x37')]:_0x290df8['model'];if(!_0x5c6229[_0xab5f('0x34')][_0xab5f('0x38')](_0xab5f('0x39'))){_0x464287[_0xab5f('0x21')]=qs[_0xab5f('0x21')](_0x5c6229[_0xab5f('0x34')][_0xab5f('0x21')]);_0x464287[_0xab5f('0x22')]=qs[_0xab5f('0x22')](_0x5c6229['query'][_0xab5f('0x22')]);}_0x464287['order']=qs[_0xab5f('0x3a')](_0x5c6229[_0xab5f('0x34')][_0xab5f('0x3a')]);_0x464287['where']=qs[_0xab5f('0x35')](_[_0xab5f('0x3b')](_0x5c6229[_0xab5f('0x34')],_0x290df8[_0xab5f('0x35')]),_0x4bd729);if(_0x5c6229[_0xab5f('0x34')][_0xab5f('0x3c')]){_0x464287[_0xab5f('0x3d')]=_['merge'](_0x464287[_0xab5f('0x3d')],{'$or':_[_0xab5f('0x33')](_0x4bd729,function(_0x6298c4){if(_0x6298c4[_0xab5f('0x30')]!==_0xab5f('0x3e')){var _0x141a34={};_0x141a34[_0x6298c4[_0xab5f('0x2d')]]={'$like':'%'+_0x5c6229[_0xab5f('0x34')]['filter']+'%'};return _0x141a34;}})});}_0x464287=_['merge']({},_0x464287,_0x5c6229[_0xab5f('0x3f')]);var _0x384cbf={'where':_0x464287['where']};return db[_0xab5f('0x40')]['count'](_0x384cbf)[_0xab5f('0x2a')](function(_0x71490a){_0x274951['count']=_0x71490a;if(_0x5c6229[_0xab5f('0x34')]['includeAll']){_0x464287[_0xab5f('0x41')]=[{'all':!![]}];}return db[_0xab5f('0x40')][_0xab5f('0x42')](_0x464287);})[_0xab5f('0x2a')](function(_0x2da96f){_0x274951[_0xab5f('0x43')]=_0x2da96f;return _0x274951;})['then'](respondWithFilteredResult(_0x7f5308,_0x464287))[_0xab5f('0x44')](handleError(_0x7f5308,null));};exports[_0xab5f('0x45')]=function(_0x22249a,_0x2e81c6){var _0x366c5d={'raw':![],'where':{'id':_0x22249a['params']['id']}},_0x358e13={};_0x358e13[_0xab5f('0x32')]=_[_0xab5f('0x46')](db['UserProfile'][_0xab5f('0x47')]);_0x358e13['query']=_[_0xab5f('0x46')](_0x22249a[_0xab5f('0x34')]);_0x358e13['filters']=_[_0xab5f('0x36')](_0x358e13[_0xab5f('0x32')],_0x358e13[_0xab5f('0x34')]);_0x366c5d[_0xab5f('0x37')]=_[_0xab5f('0x36')](_0x358e13[_0xab5f('0x32')],qs[_0xab5f('0x48')](_0x22249a[_0xab5f('0x34')]['fields']));_0x366c5d[_0xab5f('0x37')]=_0x366c5d[_0xab5f('0x37')][_0xab5f('0x49')]?_0x366c5d['attributes']:_0x358e13[_0xab5f('0x32')];if(_0x22249a[_0xab5f('0x34')][_0xab5f('0x4a')]){_0x366c5d[_0xab5f('0x41')]=[{'all':!![]}];}_0x366c5d=_[_0xab5f('0x4b')]({},_0x366c5d,_0x22249a[_0xab5f('0x3f')]);return db[_0xab5f('0x40')][_0xab5f('0x4c')](_0x366c5d)[_0xab5f('0x2a')](handleEntityNotFound(_0x2e81c6,null))[_0xab5f('0x2a')](respondWithResult(_0x2e81c6,null))[_0xab5f('0x44')](handleError(_0x2e81c6,null));};exports[_0xab5f('0x4d')]=function(_0x4502ee,_0x28a126){return db['UserProfile'][_0xab5f('0x4d')](_0x4502ee[_0xab5f('0x4e')],{})[_0xab5f('0x2a')](respondWithResult(_0x28a126,0xc9))[_0xab5f('0x44')](handleError(_0x28a126,null));};exports[_0xab5f('0x4f')]=function(_0x500258,_0x5d1daf){var _0x1cd159={'where':{'id':_0x500258['params']['id']}},_0x20a959={};_0x20a959[_0xab5f('0x32')]=_[_0xab5f('0x46')](db[_0xab5f('0x40')][_0xab5f('0x47')]);_0x1cd159['attributes']=_['intersection'](_0x20a959[_0xab5f('0x32')],qs[_0xab5f('0x48')](_0x500258['query'][_0xab5f('0x48')]));_0x1cd159[_0xab5f('0x37')]=_0x1cd159['attributes']['length']?_0x1cd159[_0xab5f('0x37')]:_0x20a959['model'];if(_0x500258[_0xab5f('0x34')][_0xab5f('0x4a')]){_0x1cd159[_0xab5f('0x41')]=[{'all':!![]}];}_0x1cd159=_[_0xab5f('0x4b')]({},_0x1cd159,_0x500258[_0xab5f('0x3f')]);return db[_0xab5f('0x40')][_0xab5f('0x4c')](_0x1cd159)[_0xab5f('0x2a')](handleEntityNotFound(_0x5d1daf,null))[_0xab5f('0x2a')](function(_0x454932){if(_0x454932){var _0x4c5f73=_0x454932[_0xab5f('0x50')]({'plain':!![]});_0x4c5f73=qs['omit'](_0x4c5f73,['id','createdAt',_0xab5f('0x51'),'crudPermissions']);_0x500258[_0xab5f('0x4e')]=_[_0xab5f('0x52')](_0x500258[_0xab5f('0x4e')],['id',_0xab5f('0x53'),_0xab5f('0x51')]);return db[_0xab5f('0x54')][_0xab5f('0x55')](function(_0xd56352){return db[_0xab5f('0x40')]['create'](_[_0xab5f('0x4b')](_0x4c5f73,_0x500258[_0xab5f('0x4e')]),{'include':_0x500258[_0xab5f('0x34')][_0xab5f('0x4a')]?[{'all':!![]}]:undefined,'transaction':_0xd56352})['then'](function(_0x5b8ca3){var _0x438c04=_0x5b8ca3[_0xab5f('0x50')]({'plain':!![]});return db[_0xab5f('0x56')][_0xab5f('0x42')]({'where':{'userProfileId':_0x500258['params']['id']},'raw':!![]})[_0xab5f('0x2a')](function(_0x42e5e6){if(_0x42e5e6){return BPromise['each'](_0x42e5e6,function(_0x454822){return new BPromise(function(_0x2a5f34,_0x3ca59d){if(_0x454822[_0xab5f('0x57')]===null||_0x454822[_0xab5f('0x57')]===0x1)_0x2a5f34(null);return db[_0xab5f('0x58')][_0xab5f('0x42')]({'where':{'sectionId':_0x454822['id']},'raw':!![]})['then'](function(_0x1f2084){var _0x8ea961=_[_0xab5f('0x33')](_0x1f2084,function(_0x2b13f9){return qs[_0xab5f('0x52')](_0x2b13f9,['id',_0xab5f('0x53'),'updatedAt','sectionId']);});_0x2a5f34(_0x8ea961);})[_0xab5f('0x44')](function(_0x3aa745){_0x3ca59d(_0x3aa745);});})['then'](function(_0x449ae7){var _0x183e7a=qs['omit'](_0x454822,['id',_0xab5f('0x53'),_0xab5f('0x51')]);_0x183e7a[_0xab5f('0x59')]=_0x438c04['id'];if(_0x449ae7)_0x183e7a[_0xab5f('0x5a')]=_0x449ae7;return _0x183e7a;})['then'](function(_0x5e6ff2){return db[_0xab5f('0x56')][_0xab5f('0x4d')](_0x5e6ff2,{'include':[{'model':db[_0xab5f('0x58')],'as':'Resources'}],'raw':!![],'transaction':_0xd56352});});})[_0xab5f('0x2a')](function(){return _0x438c04;});}});});});}})[_0xab5f('0x2a')](respondWithResult(_0x5d1daf,0xc9))['catch'](handleError(_0x5d1daf,null));};exports[_0xab5f('0x29')]=function(_0x20cab5,_0x30911c){if(_0x20cab5[_0xab5f('0x4e')]['id']){delete _0x20cab5[_0xab5f('0x4e')]['id'];}return db[_0xab5f('0x40')][_0xab5f('0x4c')]({'where':{'id':_0x20cab5[_0xab5f('0x5b')]['id']}})[_0xab5f('0x2a')](handleEntityNotFound(_0x30911c,null))[_0xab5f('0x2a')](saveUpdates(_0x20cab5[_0xab5f('0x4e')],null))['then'](respondWithResult(_0x30911c,null))[_0xab5f('0x44')](handleError(_0x30911c,null));};exports[_0xab5f('0x2b')]=function(_0xf925f4,_0x391b32){return db['UserProfile'][_0xab5f('0x4c')]({'where':{'id':_0xf925f4[_0xab5f('0x5b')]['id']}})['then'](handleEntityNotFound(_0x391b32,null))[_0xab5f('0x2a')](removeEntity(_0x391b32,null))[_0xab5f('0x44')](handleError(_0x391b32,null));};exports['describe']=function(_0x542ca0,_0x15b9b1){return db[_0xab5f('0x40')][_0xab5f('0x5c')]()[_0xab5f('0x2a')](respondWithResult(_0x15b9b1,null))[_0xab5f('0x44')](handleError(_0x15b9b1,null));};exports[_0xab5f('0x5d')]=function(_0x2acbaf,_0x2026da){var _0x58442f=_0x2acbaf[_0xab5f('0x4e')];return db[_0xab5f('0x40')][_0xab5f('0x4c')]({'where':{'id':_0x2acbaf[_0xab5f('0x5b')]['id']}})[_0xab5f('0x2a')](handleEntityNotFound(_0x2026da,null))[_0xab5f('0x2a')](function(_0x1bf11e){if(_0x1bf11e){return db[_0xab5f('0x54')][_0xab5f('0x55')](function(_0x23298f){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x2acbaf['params']['id'],'sectionId':_[_0xab5f('0x33')](_0x58442f,function(_0x4a6ce5){return _0x4a6ce5[_0xab5f('0x5e')];})},'transaction':_0x23298f})[_0xab5f('0x2a')](function(){var _0x5ec60c=_['map'](_0x58442f,function(_0x1db10e){_0x1db10e[_0xab5f('0x59')]=_0x2acbaf[_0xab5f('0x5b')]['id'];return _0x1db10e;});var _0x515c5c=[];return BPromise[_0xab5f('0x5f')](_0x5ec60c,function(_0x76055e){return db[_0xab5f('0x56')][_0xab5f('0x4d')](_0x76055e,{'include':[{'model':db[_0xab5f('0x58')],'as':_0xab5f('0x5a')}],'raw':!![],'transaction':_0x23298f})[_0xab5f('0x2a')](function(_0xed5baf){_0x515c5c[_0xab5f('0x60')](_0xed5baf[_0xab5f('0x50')]({'plain':!![]}));});})['then'](function(){return _0x515c5c;});});});}})['then'](function(_0x429d50){return _0x429d50;})['then'](respondWithResult(_0x2026da,null))[_0xab5f('0x44')](handleError(_0x2026da,null));};exports['removeSections']=function(_0x66f756,_0x1b0485){var _0x4aaf14;return db['UserProfile'][_0xab5f('0x4c')]({'where':{'id':_0x66f756[_0xab5f('0x5b')]['id']},'attributes':['id',_0xab5f('0x2d')]})[_0xab5f('0x2a')](handleEntityNotFound(_0x1b0485,null))[_0xab5f('0x2a')](function(_0x181470){if(_0x181470){_0x4aaf14=_0x181470;return db[_0xab5f('0x56')]['destroy']({'where':{'userProfileId':_0x66f756['params']['id'],'sectionId':_0x66f756[_0xab5f('0x34')]['ids']}});}})[_0xab5f('0x2a')](function(){return _0x4aaf14;})[_0xab5f('0x2a')](respondWithStatusCode(_0x1b0485,null))['catch'](handleError(_0x1b0485,null));};exports[_0xab5f('0x61')]=function(_0x11fa3d,_0x3667ac){var _0x4ff35f=[];var _0x4f5881=[];return db[_0xab5f('0x56')][_0xab5f('0x42')]({'where':{'userProfileId':_0x11fa3d['params']['id']},'raw':!![]})['then'](function(_0x1cb964){_0x4ff35f=_[_0xab5f('0x3c')](_0x1cb964,function(_0x9857fd){return _0x9857fd[_0xab5f('0x62')]===0x1||_[_0xab5f('0x63')]([0x3eb,0x709],_0x9857fd[_0xab5f('0x5e')]);});if(!_[_0xab5f('0x64')](_0x4ff35f)){return _['map'](_0x4ff35f,function(_0x23acfb){return _0x23acfb['sectionId'];});}else{return;}})[_0xab5f('0x2a')](function(_0x16036a){if(_0x16036a)_0x4f5881=_0x16036a;if(_[_0xab5f('0x63')](_0x4f5881,0x64)){var _0x3ddba3=_[_0xab5f('0x4c')](_0x4ff35f,{'sectionId':0x64});return hasDefaultDashboard(_0x3ddba3)[_0xab5f('0x2a')](function(_0x58bb7e){return _[_0xab5f('0x33')](_0x4ff35f,function(_0x12f94e){if(_0x12f94e[_0xab5f('0x5e')]===0x64){_0x12f94e[_0xab5f('0x65')]=_0x58bb7e;}return _0x12f94e;});});}else{return;}})[_0xab5f('0x2a')](function(_0x13b2e7){if(_0x13b2e7)_0x4ff35f=_0x13b2e7;if(_['includes'](_0x4f5881,0x3eb)){var _0x3e32ee=_[_0xab5f('0x4c')](_0x4ff35f,{'sectionId':0x3eb});return getCustomDashboards(_0x3e32ee)[_0xab5f('0x2a')](function(_0x210f9b){return _['map'](_0x4ff35f,function(_0x4dc8a4){if(_0x3e32ee[_0xab5f('0x62')]){if(_0x4dc8a4[_0xab5f('0x5e')]===0x3eb){_0x4dc8a4[_0xab5f('0x65')]=_0x210f9b;}}else{if(_0x4dc8a4[_0xab5f('0x5e')]===0x64){_0x4dc8a4[_0xab5f('0x65')]=_0x210f9b;}}return _0x4dc8a4;});});}else{return;}})['then'](function(_0x313156){if(_0x313156)_0x4ff35f=_0x313156;if(_['includes'](_0x4f5881,0x709)){var _0x15bee3=_['find'](_0x4ff35f,{'sectionId':0x709});return getPlugins(_0x15bee3)[_0xab5f('0x2a')](function(_0x502538){if(_0x15bee3[_0xab5f('0x62')]){return _[_0xab5f('0x33')](_0x4ff35f,function(_0x3f2735){if(_0x3f2735[_0xab5f('0x5e')]===0x709){_0x3f2735[_0xab5f('0x65')]=_0x502538;}return _0x3f2735;});}else{var _0x323c4f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x502538};var _0x2e08c4=_[_0xab5f('0x33')](_0x4ff35f);_0x2e08c4[_0xab5f('0x60')](_0x323c4f);return _0x2e08c4;}});}else{return;}})[_0xab5f('0x2a')](function(_0x265b37){if(_0x265b37)_0x4ff35f=_0x265b37;return _[_0xab5f('0x3c')](_0x4ff35f,[_0xab5f('0x62'),0x1]);})[_0xab5f('0x2a')](respondWithResult(_0x3667ac,null))[_0xab5f('0x44')](handleError(_0x3667ac,null));};function hasDefaultDashboard(_0x5eb263){var _0x61d75f=[0x65];return new BPromise(function(_0x5c3d83,_0x1faa75){try{if(_0x5eb263['autoAssociation']){_0x5c3d83(_0x61d75f);}else{return db[_0xab5f('0x58')][_0xab5f('0x66')]({'where':{'sectionId':_0x5eb263['id']},'raw':!![]})[_0xab5f('0x2a')](function(_0x22cfbf){_0x22cfbf?_0x5c3d83(_0x61d75f):_0x5c3d83();});}}catch(_0x4c1181){_0x1faa75(_0x4c1181);}});}function getCustomDashboards(_0x1bfd18){var _0x513869=[];return new BPromise(function(_0x5327c8,_0x5db8b8){try{if(_0x1bfd18['autoAssociation']){return db[_0xab5f('0x67')][_0xab5f('0x42')]({'raw':!![]})[_0xab5f('0x2a')](function(_0x10a07f){_0x10a07f[_0xab5f('0x68')](function(_0x400d80){_0x513869['push'](_0x400d80['id']+0x1869f);});_0x5327c8(_0x513869);});}else{return db[_0xab5f('0x58')][_0xab5f('0x42')]({'where':{'sectionId':_0x1bfd18['id']},'raw':!![]})[_0xab5f('0x2a')](function(_0x5ae266){_0x5ae266[_0xab5f('0x68')](function(_0x358b00){_0x513869[_0xab5f('0x60')](_0x358b00[_0xab5f('0x69')]+0x1869f);});_0x5327c8(_0x513869);});}}catch(_0xa6014b){_0x5db8b8(_0xa6014b);}});}function getPlugins(_0x5eac9c){var _0x221e99=[];return new BPromise(function(_0x291d86,_0x5e60f1){try{if(_0x5eac9c[_0xab5f('0x57')]){return db[_0xab5f('0x6a')]['findAll']({'raw':!![]})[_0xab5f('0x2a')](function(_0x36e6e2){_0x36e6e2[_0xab5f('0x68')](function(_0x52d479){_0x221e99['push'](_0x52d479['id']+0x15b38);});_0x291d86(_0x221e99);});}else{return db[_0xab5f('0x58')][_0xab5f('0x42')]({'where':{'sectionId':_0x5eac9c['id']},'raw':!![]})[_0xab5f('0x2a')](function(_0x1eecbb){_0x1eecbb['forEach'](function(_0x2a4491){_0x221e99['push'](_0x2a4491[_0xab5f('0x69')]+0x15b38);});_0x291d86(_0x221e99);});}}catch(_0x159113){_0x5e60f1(_0x159113);}});}exports[_0xab5f('0x6b')]=function(_0x1fdae5,_0x19e4e9){return db[_0xab5f('0x40')][_0xab5f('0x4c')]({'where':{'id':_0x1fdae5[_0xab5f('0x5b')]['id']}})[_0xab5f('0x2a')](handleEntityNotFound(_0x19e4e9,null))[_0xab5f('0x2a')](function(_0xf1566f){if(_0xf1566f){return db[_0xab5f('0x54')][_0xab5f('0x55')](function(_0x9d7975){return db[_0xab5f('0x56')][_0xab5f('0x42')]({'where':{'userProfileId':_0x1fdae5[_0xab5f('0x5b')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x28cf22){if(_0x28cf22){return db['UserProfileSection'][_0xab5f('0x2b')]({'where':{'userProfileId':_0x1fdae5[_0xab5f('0x5b')]['id'],'id':_['map'](_0x28cf22,function(_0x38012a){return _0x38012a['id'];})},'transaction':_0x9d7975});}})[_0xab5f('0x2a')](function(_0x22b3d9){var _0x316a2c=_[_0xab5f('0x33')](_0x1fdae5[_0xab5f('0x4e')],function(_0x3a9f61){_0x3a9f61[_0xab5f('0x59')]=_0x1fdae5[_0xab5f('0x5b')]['id'];return _0x3a9f61;});return db[_0xab5f('0x56')][_0xab5f('0x6c')](_0x316a2c,{'raw':!![],'transaction':_0x9d7975});})[_0xab5f('0x2a')](function(_0x323cd8){var _0x1988fc=_[_0xab5f('0x3c')](_[_0xab5f('0x33')](_0x323cd8,function(_0xc39441){return _0xc39441[_0xab5f('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x1988fc){return db[_0xab5f('0x56')][_0xab5f('0x42')]({'where':{'userProfileId':_0x1fdae5['params']['id'],'sectionId':_['map'](_0x1988fc,function(_0x282af9){return _0x282af9[_0xab5f('0x5e')];})},'attributes':['id',_0xab5f('0x5e')],'raw':!![]})['then'](function(_0x24cd3c){var _0x3dab9a=_[_0xab5f('0x33')](_0x1fdae5[_0xab5f('0x4e')],function(_0x6f1db9){_0x6f1db9['userProfileId']=_0x1fdae5['params']['id'];return _0x6f1db9;});return db[_0xab5f('0x58')][_0xab5f('0x6c')](_0x3dab9a,{'raw':!![],'transaction':_0x9d7975});});}})['catch'](handleError(_0x19e4e9,null));});}})['then'](function(_0x282e61){var _0x3a8573=_[_0xab5f('0x33')](_0x282e61,function(_0x436a24){return _0x436a24['get']({'plain':!![]});});})[_0xab5f('0x2a')](respondWithResult(_0x19e4e9,null))['catch'](handleError(_0x19e4e9,null));};exports[_0xab5f('0x6d')]=function(_0x46b37f,_0x21d746,_0x17a648){return db[_0xab5f('0x40')][_0xab5f('0x4c')]({'where':{'id':_0x46b37f[_0xab5f('0x5b')]['id']}})['then'](handleEntityNotFound(_0x21d746,null))[_0xab5f('0x2a')](function(_0x1284d0){if(_0x1284d0){return _0x1284d0[_0xab5f('0x6d')](_0x46b37f['query'][_0xab5f('0x6e')]);}})[_0xab5f('0x2a')](respondWithStatusCode(_0x21d746,null))[_0xab5f('0x44')](handleError(_0x21d746,null));};exports[_0xab5f('0x6f')]=function(_0x41a241,_0x40f320){var _0x1f1cf2={};if(!_0x41a241['query'][_0xab5f('0x70')])throw new Error(_0xab5f('0x71'));if(!_0x41a241[_0xab5f('0x34')][_0xab5f('0x38')](_0xab5f('0x39'))){_0x1f1cf2[_0xab5f('0x21')]=qs['limit'](_0x41a241['query'][_0xab5f('0x21')]);_0x1f1cf2[_0xab5f('0x22')]=qs[_0xab5f('0x22')](_0x41a241[_0xab5f('0x34')]['offset']);}return db[_0xab5f('0x40')]['find']({'where':{'id':_0x41a241[_0xab5f('0x5b')]['id']}})[_0xab5f('0x2a')](function(_0x278900){if(!_0x278900)throw new Error(_0xab5f('0x72')+_0x41a241[_0xab5f('0x5b')]['id']);return db['UserProfile']['getResources'](_0x41a241);})['then'](respondWithFilteredResult(_0x40f320,_0x1f1cf2))['catch'](handleError(_0x40f320,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 4bbd944..d793f8e 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 _0xba18=['events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2732e5,_0x19e433){var _0x55896a=function(_0xed98df){while(--_0xed98df){_0x2732e5['push'](_0x2732e5['shift']());}};_0x55896a(++_0x19e433);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x8ba1('0x0'));var UserProfile=require(_0x8ba1('0x1'))['db'][_0x8ba1('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x8ba1('0x3')](0x0);var events={'afterCreate':_0x8ba1('0x4'),'afterUpdate':_0x8ba1('0x5'),'afterDestroy':_0x8ba1('0x6')};function emitEvent(_0x3b5254){return function(_0x59c54c,_0xe3bc16,_0x3136d7){UserProfileEvents[_0x8ba1('0x7')](_0x3b5254+':'+_0x59c54c['id'],_0x59c54c);UserProfileEvents[_0x8ba1('0x7')](_0x3b5254,_0x59c54c);_0x3136d7(null);};}for(var e in events){if(events[_0x8ba1('0x8')](e)){var event=events[e];UserProfile[_0x8ba1('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x5430=['UserProfile','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x9e110d,_0x3f26f4){var _0x291f4a=function(_0x1e4508){while(--_0x1e4508){_0x9e110d['push'](_0x9e110d['shift']());}};_0x291f4a(++_0x3f26f4);}(_0x5430,0x10c));var _0x0543=function(_0x1819d1,_0x22f8d0){_0x1819d1=_0x1819d1-0x0;var _0x5193b8=_0x5430[_0x1819d1];return _0x5193b8;};'use strict';var EventEmitter=require(_0x0543('0x0'));var UserProfile=require(_0x0543('0x1'))['db'][_0x0543('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x0543('0x3')](0x0);var events={'afterCreate':_0x0543('0x4'),'afterUpdate':_0x0543('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5b122c){return function(_0x1c5ab7,_0x4ee416,_0x523f3d){UserProfileEvents[_0x0543('0x6')](_0x5b122c+':'+_0x1c5ab7['id'],_0x1c5ab7);UserProfileEvents[_0x0543('0x6')](_0x5b122c,_0x1c5ab7);_0x523f3d(null);};}for(var e in events){if(events[_0x0543('0x7')](e)){var event=events[e];UserProfile[_0x0543('0x8')](e,emitEvent(event));}}module[_0x0543('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index a428419..d6a2196 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 _0x3a58=['zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','vtigeraccounts','User','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','pauses','Schedule','sounds','tags','templates','Template','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','Reports','AnalyticMetric','charAt','toUpperCase','slice','SELECT','select','ui.','ui.createdAt','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','define','user_profiles','raw','section','mergeResources','isEmpty','length','push','UserProfileSection','params','all','union','ignore','autoAssociation','rawAttributes','model','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','AnalyticExtractedReport','foreignKey','find','forEach','includeAll','include','default','reportId','custom','count','ids','customSorting','extraQueryConditions','Tags','color','Tag','tag','rows','openTabs','true','chat','dataValues','fax','mail','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','name','catch','resolve','UserProfileResource','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','contacts','CmContact','ListId','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','agent','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','SmsQueue','SmsAccount','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','admin','user'];(function(_0x10f100,_0x20f3d3){var _0x51546e=function(_0x488217){while(--_0x488217){_0x10f100['push'](_0x10f100['shift']());}};_0x51546e(++_0x20f3d3);}(_0x3a58,0x64));var _0x83a5=function(_0x3df759,_0x1e00f4){_0x3df759=_0x3df759-0x0;var _0x479567=_0x3a58[_0x3df759];return _0x479567;};'use strict';var _=require(_0x83a5('0x0'));var attributes=require(_0x83a5('0x1'));var qs=require('../../components/parsers/qs');var squel=require(_0x83a5('0x2'));module[_0x83a5('0x3')]=function(_0x4daaea){var _0x432d16=_0x4daaea[_0x83a5('0x4')];function _0x7bb356(_0x3b4416,_0x1be5ca){return new Promise(function(_0x348949,_0x3edbac){if(!_0x1be5ca)return _0x348949(null);var _0x302e45=_0x1be5ca[_0x83a5('0x5')]?{[_0x1be5ca[_0x83a5('0x5')][_0x83a5('0x6')]]:_0x1be5ca[_0x83a5('0x5')][_0x83a5('0x7')]}:undefined;return _0x432d16[_0x3b4416][_0x83a5('0x8')]({'where':_0x302e45,'raw':!![]})[_0x83a5('0x9')](function(_0x534226){_0x1be5ca[_0x83a5('0xa')]=_[_0x83a5('0xb')](_0x534226,'id');_0x348949(_0x1be5ca);})['catch'](function(_0x3deb44){_0x3edbac(_0x3deb44);});});}function _0x43444a(_0x28b5fa,_0x1b1c5d){return new Promise(function(_0x3451f8,_0x2bd3be){var _0x5ad1df=_0x28b5fa[_0x83a5('0x5')]?{[_0x28b5fa[_0x83a5('0x5')][_0x83a5('0x6')]]:_0x28b5fa[_0x83a5('0x5')][_0x83a5('0x7')]}:undefined;return _0x432d16[_0x28b5fa['model']][_0x83a5('0x8')]({'where':_0x5ad1df,'raw':!![]})[_0x83a5('0x9')](function(_0x3510ac){_0x1b1c5d[_0x83a5('0xa')]=_[_0x83a5('0xb')](_0x3510ac,function(_0x29d55d){return _0x29d55d[_0x83a5('0xc')];});_0x3451f8(_0x1b1c5d);})[_0x83a5('0xd')](function(_0x2d1feb){_0x2bd3be(_0x2d1feb);});});}function _0x4e7738(_0x20a8b7,_0x589201,_0x39ccac){if(!_0x589201)return Promise[_0x83a5('0xe')](null);return new Promise(function(_0x1af7cc,_0x272a88){return _0x432d16[_0x83a5('0xf')][_0x83a5('0x8')]({'where':{'sectionId':_0x589201['id']},'raw':!![]})[_0x83a5('0x9')](function(_0x2d1f52){if(_0x20a8b7[_0x83a5('0x6')]&&_0x20a8b7[_0x83a5('0x6')]!=='id'){_0x589201['associatedResources']=_['map'](_0x2d1f52,function(_0x584e1f){return _0x584e1f[_0x20a8b7[_0x83a5('0x6')]];});}else{if(_0x39ccac==='AnalyticExtractedReport'){_0x589201[_0x83a5('0xa')]=_[_0x83a5('0xb')](_0x2d1f52,function(_0x8834de){return{'id':_0x8834de[_0x83a5('0x10')],'type':_0x8834de[_0x83a5('0x11')]};});}else{_0x589201['associatedResources']=_[_0x83a5('0xb')](_0x2d1f52,function(_0x59904d){return _0x59904d[_0x83a5('0x10')];});}}_0x1af7cc(_0x589201);})[_0x83a5('0xd')](function(_0x249443){_0x272a88(_0x249443);});});}function _0x37a4a1(_0x45f400,_0x399f9e){var _0x26e2a2={'parentSections':[]};switch(_0x45f400[_0x83a5('0x12')]()){case _0x83a5('0x13'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x15');break;case _0x83a5('0x16'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x17');break;case _0x83a5('0x18'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x19');_0x26e2a2[_0x83a5('0x1a')]=[{'name':_0x83a5('0x1b'),'field':'name','foreignKey':_0x83a5('0x1c')}];break;case'projects':_0x26e2a2['childModel']='JscriptyProject';break;case _0x83a5('0x1d'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x1e');_0x26e2a2[_0x83a5('0x1a')]=[{'name':'Lists','field':'id','foreignKey':_0x83a5('0x1f')}];break;case'lists':_0x26e2a2['childModel']=_0x83a5('0x20');break;case _0x83a5('0x21'):_0x26e2a2['childModel']=_0x83a5('0x22');break;case _0x83a5('0x23'):_0x26e2a2['childModel']='CmCustomField';break;case _0x83a5('0x24'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x25');break;case _0x83a5('0x26'):_0x26e2a2[_0x83a5('0x14')]='ChatWebsite';break;case _0x83a5('0x27'):_0x26e2a2['childModel']=_0x83a5('0x28');break;case _0x83a5('0x29'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x2a');break;case _0x83a5('0x2b'):case _0x83a5('0x2c'):case'outboundroutes':_0x26e2a2['childModel']=_0x83a5('0x2d');break;case _0x83a5('0x2e'):_0x26e2a2['childModel']=_0x83a5('0x2f');break;case _0x83a5('0x30'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x31');break;case _0x83a5('0x32'):_0x26e2a2['childModel']=_0x83a5('0x33');_0x26e2a2['parentSections']=[{'name':_0x83a5('0x34'),'field':_0x83a5('0xc'),'foreignKey':_0x83a5('0x35'),'model':'User','filter':{'field':'role','value':[_0x83a5('0x36')]}},{'name':'Telephones','field':_0x83a5('0xc'),'foreignKey':_0x83a5('0x35'),'model':'User','filter':{'field':'role','value':[_0x83a5('0x37')]}},{'name':_0x83a5('0x38'),'field':_0x83a5('0xc'),'foreignKey':_0x83a5('0x39'),'model':_0x83a5('0x3a'),'filter':{'field':_0x83a5('0x11'),'value':[_0x83a5('0x3b')]}},{'name':_0x83a5('0x3c'),'field':_0x83a5('0xc'),'foreignKey':_0x83a5('0x39'),'model':_0x83a5('0x3a'),'filter':{'field':_0x83a5('0x11'),'value':[_0x83a5('0x3d')]}}];break;case _0x83a5('0x3e'):_0x26e2a2[_0x83a5('0x14')]='VoiceMusicOnHold';break;case _0x83a5('0x3f'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x40');break;case _0x83a5('0x41'):_0x26e2a2[_0x83a5('0x14')]='VoicePrefix';break;case _0x83a5('0x42'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x43');break;case'mailqueues':_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x44');break;case'mailaccounts':_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x45');break;case _0x83a5('0x46'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x47');break;case _0x83a5('0x48'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x49');break;case'openchannelaccounts':_0x26e2a2['childModel']='OpenchannelAccount';break;case'smsqueues':_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x4a');break;case'smsaccounts':_0x26e2a2['childModel']=_0x83a5('0x4b');break;case'whatsappqueues':_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x4c');break;case _0x83a5('0x4d'):_0x26e2a2['childModel']='WhatsappAccount';break;case _0x83a5('0x4e'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x4f');break;case _0x83a5('0x50'):case _0x83a5('0x51'):_0x26e2a2['childModel']=_0x83a5('0x3a');if(_0x399f9e){_0x26e2a2['parentSections']=[{'name':_0x83a5('0x38')},{'name':_0x83a5('0x3c')}];}break;case _0x83a5('0x52'):case _0x83a5('0x53'):case _0x83a5('0x54'):_0x26e2a2[_0x83a5('0x14')]='User';if(_0x399f9e){_0x26e2a2[_0x83a5('0x1a')]=[{'name':'Users','filter':{'field':'role','value':[_0x83a5('0x55'),_0x83a5('0x56')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x83a5('0x57'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x58');break;case _0x83a5('0x59'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x5a');break;case'freshdeskaccounts':_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x5b');break;case _0x83a5('0x5c'):_0x26e2a2['childModel']=_0x83a5('0x5d');break;case _0x83a5('0x5e'):_0x26e2a2[_0x83a5('0x14')]='DeskAccount';break;case _0x83a5('0x5f'):_0x26e2a2['childModel']='ZohoAccount';break;case _0x83a5('0x60'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x61');break;case _0x83a5('0x62'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x63');break;case _0x83a5('0x64'):_0x26e2a2['childModel']=_0x83a5('0x65');break;case _0x83a5('0x66'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x67');break;case'intervals':_0x26e2a2['childModel']='Interval';break;case _0x83a5('0x68'):_0x26e2a2[_0x83a5('0x14')]='Pause';break;case'scheduler':_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x69');break;case _0x83a5('0x6a'):_0x26e2a2[_0x83a5('0x14')]='Sound';break;case _0x83a5('0x6b'):_0x26e2a2[_0x83a5('0x14')]='Tag';break;case _0x83a5('0x6c'):_0x26e2a2['childModel']=_0x83a5('0x6d');break;case _0x83a5('0x6e'):_0x26e2a2['childModel']='Trigger';break;case _0x83a5('0x6f'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x70');break;case _0x83a5('0x71'):_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x72');break;case _0x83a5('0x73'):_0x26e2a2['childModel']=_0x83a5('0x74');break;case'extractedreports':_0x26e2a2[_0x83a5('0x14')]='AnalyticExtractedReport';_0x26e2a2['parentSections']=[{'name':_0x83a5('0x75'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x26e2a2[_0x83a5('0x14')]=_0x83a5('0x76');break;}return _0x26e2a2;}function _0x6a0171(_0x3db906,_0x345161){var _0x2c5d9c=_0x3db906[_0x83a5('0x77')](0x0)[_0x83a5('0x78')]()+_0x3db906[_0x83a5('0x79')](0x1);var _0x71fa93={'type':_0x432d16['Sequelize']['QueryTypes'][_0x83a5('0x7a')],'raw':!![]};return new Promise(function(_0x13164e,_0x5f271b){var _0xfa4c93=squel[_0x83a5('0x7b')]()['field'](_0x83a5('0x7c')+_0x2c5d9c+'InteractionId','id')[_0x83a5('0x6')](_0x83a5('0x7d'))['from']('user_has_'+_0x3db906+_0x83a5('0x7e'),'ui')[_0x83a5('0x7f')](_0x83a5('0x80'),_0x345161['id']);return _0x432d16[_0x83a5('0x81')][_0x83a5('0x82')](_0xfa4c93['toString'](),_0x71fa93)[_0x83a5('0x9')](function(_0x565b1c){_0x345161[_0x2c5d9c+_0x83a5('0x83')]=_0x565b1c;_0x13164e(_0x565b1c);})['catch'](function(_0x5b146a){_0x5f271b(_0x5b146a);});});}return _0x4daaea[_0x83a5('0x84')]('UserProfile',attributes,{'tableName':_0x83a5('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x571051){var _0x187d33={'raw':_0x571051[_0x83a5('0x82')][_0x83a5('0x86')],'where':{}};var _0x5ecb63={};var _0x1e18ff={'count':0x0,'rows':[]};var _0x2363a7=_0x571051[_0x83a5('0x82')][_0x83a5('0x87')];var _0x4957f8=_0x571051[_0x83a5('0x82')][_0x83a5('0x88')]||![];var _0x45c5f5=_0x37a4a1(_0x2363a7,_0x4957f8);if(!_0x45c5f5['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x2363a7+'\x27');var _0x209f8b=[{'name':_0x2363a7}];if(!_[_0x83a5('0x89')](_0x45c5f5[_0x83a5('0x1a')]))_0x209f8b=_0x45c5f5['parentSections'];var _0x37699b=[];for(var _0x263602=0x0;_0x263602<_0x209f8b[_0x83a5('0x8a')];_0x263602++){_0x37699b[_0x83a5('0x8b')](_0x432d16[_0x83a5('0x8c')]['find']({'where':{'userProfileId':_0x571051[_0x83a5('0x8d')]['id'],'name':_0x209f8b[_0x263602][_0x83a5('0xc')]},'raw':!![]}));}return Promise[_0x83a5('0x8e')](_0x37699b)[_0x83a5('0x9')](function(_0x2bd903){var _0x2b6fd8=_[_0x83a5('0x5')](_0x2bd903,function(_0x295778){return _0x295778?_0x295778:undefined;});var _0x433765=_[_0x83a5('0x5')](_0x209f8b,['ignore',!![]]);var _0x15afa7=_['isEmpty'](_0x2b6fd8)&&_[_0x83a5('0x89')](_0x433765)?null:_[_0x83a5('0x8f')](_0x433765,_0x2b6fd8);if(!_0x15afa7)return null;var _0x28ba6e=[];for(var _0xbb06a3=0x0;_0xbb06a3<_0x15afa7[_0x83a5('0x8a')];_0xbb06a3++){var _0xbd1afa=_['find'](_0x209f8b,function(_0x455b82){return _0x15afa7[_0xbb06a3]?_0x455b82['name']===_0x15afa7[_0xbb06a3][_0x83a5('0xc')]:null;});if(_0xbd1afa){if(_0x15afa7[_0xbb06a3][_0x83a5('0x90')]){_0x28ba6e[_0x83a5('0x8b')](_0x7bb356(_0x45c5f5[_0x83a5('0x14')],_0x15afa7[_0xbb06a3]));}else{if(!_0x15afa7[_0xbb06a3][_0x83a5('0x91')]){_0x28ba6e['push'](_0x4e7738(_0xbd1afa,_0x15afa7[_0xbb06a3],_0x45c5f5['childModel']));}else{if(_0xbd1afa['model']){_0x28ba6e[_0x83a5('0x8b')](_0x43444a(_0xbd1afa,_0x15afa7[_0xbb06a3]));}}}}}return Promise[_0x83a5('0x8e')](_0x28ba6e);})[_0x83a5('0x9')](function(_0x487356){var _0x17c8db=_0x487356;var _0xe37a87=null;if(_0x17c8db){_0xe37a87=_0x17c8db[_0x83a5('0x8a')]===0x1?_0x17c8db[0x0]:null;}if(!_0xe37a87&&!_0x17c8db)return _0x1e18ff;var _0x5bdb35=_0x432d16[_0x45c5f5[_0x83a5('0x14')]][_0x83a5('0x92')];_0x5ecb63[_0x83a5('0x93')]=_['keys'](_0x5bdb35);_0x5ecb63[_0x83a5('0x82')]=_[_0x83a5('0x94')](_0x571051[_0x83a5('0x82')]);_0x5ecb63[_0x83a5('0x95')]=_[_0x83a5('0x96')](_0x5ecb63[_0x83a5('0x93')],_0x5ecb63[_0x83a5('0x82')]);_0x187d33[_0x83a5('0x97')]=_[_0x83a5('0x96')](_0x5ecb63['model'],qs[_0x83a5('0x98')](_0x571051[_0x83a5('0x82')][_0x83a5('0x98')]));_0x187d33[_0x83a5('0x97')]=_0x187d33[_0x83a5('0x97')]['length']?_0x187d33[_0x83a5('0x97')]:_0x5ecb63['model'];if(!_0x571051['query'][_0x83a5('0x99')](_0x83a5('0x9a'))){_0x187d33[_0x83a5('0x9b')]=qs['limit'](_0x571051[_0x83a5('0x82')]['limit']);_0x187d33[_0x83a5('0x9c')]=qs['offset'](_0x571051[_0x83a5('0x82')]['offset']);}_0x187d33[_0x83a5('0x9d')]=qs[_0x83a5('0x9e')](_0x571051['query'][_0x83a5('0x9e')]);_0x187d33[_0x83a5('0x7f')]=qs['filters'](_[_0x83a5('0x9f')](_0x571051[_0x83a5('0x82')],_0x5ecb63[_0x83a5('0x95')]));if(_0x571051[_0x83a5('0x82')][_0x83a5('0x5')]){_0x187d33['where']=_[_0x83a5('0xa0')](_0x187d33[_0x83a5('0x7f')],{'$or':_['map'](_0x5bdb35,function(_0x15d0a6){if(_0x15d0a6[_0x83a5('0x11')][_0x83a5('0xa1')]!==_0x83a5('0xa2')){var _0x366813={};_0x366813[_0x15d0a6[_0x83a5('0x6')]]={'$like':'%'+_0x571051['query'][_0x83a5('0x5')]+'%'};return _0x366813;}})});}var _0x271204=[];var _0x4ddc93=null;var _0x4b37ef={};if(_0xe37a87){_0x4ddc93=_['find'](_0x209f8b,[_0x83a5('0xc'),_0xe37a87[_0x83a5('0xc')]]);if(_0x4ddc93['field']){_0x4b37ef={};if(_0x45c5f5['childModel']===_0x83a5('0xa3')){_0x4b37ef[_0x4ddc93['foreignKey']]=_[_0x83a5('0xb')](_0xe37a87['associatedResources'],'id');}else{_0x4b37ef[_0x4ddc93[_0x83a5('0xa4')]]=_0xe37a87['associatedResources'];}_0x271204[_0x83a5('0x8b')](_0x4b37ef);}else{_0x187d33[_0x83a5('0x7f')]['id']=_0xe37a87[_0x83a5('0xa')];}}else{for(var _0xe31685=0x0;_0xe31685<_0x17c8db[_0x83a5('0x8a')];_0xe31685++){_0x4ddc93=_[_0x83a5('0xa5')](_0x209f8b,[_0x83a5('0xc'),_0x17c8db[_0xe31685]['name']]);if(_0x4ddc93['field']){_0x4b37ef={};_0x4b37ef[_0x4ddc93['foreignKey']]=_0x17c8db[_0xe31685][_0x83a5('0xa')];_0x271204[_0x83a5('0x8b')](_0x4b37ef);}else{if(!_0x187d33['where']['id'])_0x187d33[_0x83a5('0x7f')]['id']=[];_0x17c8db[_0xe31685]['associatedResources'][_0x83a5('0xa6')](function(_0x39d188){_0x187d33[_0x83a5('0x7f')]['id'][_0x83a5('0x8b')](_0x39d188);});}}}if(!_[_0x83a5('0x89')](_0x271204)){_0x187d33[_0x83a5('0x7f')]=_['merge'](_0x187d33[_0x83a5('0x7f')],{'$and':{'$or':_0x271204}});}_0x187d33=_[_0x83a5('0xa0')]({},_0x187d33,_0x571051['options']);if(_0xe37a87&&!_0xe37a87[_0x83a5('0x91')]&&_0x45c5f5[_0x83a5('0x14')]==='AnalyticExtractedReport'){if(_0x571051[_0x83a5('0x82')][_0x83a5('0xa7')]){_0x187d33[_0x83a5('0xa8')]=[{'all':!![]}];}return _0x432d16[_0x45c5f5[_0x83a5('0x14')]][_0x83a5('0x8')](_0x187d33)[_0x83a5('0x9')](function(_0x3bf9bf){var _0x3dfa6f=[];_0x3bf9bf[_0x83a5('0xa6')](function(_0x2de0e1){var _0x1e0821;switch(_0x2de0e1['reportType']){case _0x83a5('0xa9'):_0x1e0821=_[_0x83a5('0xa5')](_0xe37a87[_0x83a5('0xa')],function(_0x26a066){return _0x26a066['id']===_0x2de0e1[_0x83a5('0xaa')]&&_0x26a066['type']==='DefaultReports';});break;case _0x83a5('0xab'):_0x1e0821=_['find'](_0xe37a87[_0x83a5('0xa')],function(_0x2d3fda){return _0x2d3fda['id']===_0x2de0e1[_0x83a5('0xaa')]&&_0x2d3fda['type']==='CustomReports';});break;}if(_0x1e0821)_0x3dfa6f[_0x83a5('0x8b')](_0x2de0e1);});_0x1e18ff[_0x83a5('0xac')]=_0x3dfa6f['length'];_0x1e18ff['rows']=_0x3dfa6f;return _0x1e18ff;});}else{if(!_['isEmpty'](_0x571051[_0x83a5('0x82')][_0x83a5('0xad')])){_0x187d33['where']['id']=_0x187d33[_0x83a5('0x7f')]['id']?_[_0x83a5('0x96')](_0x187d33[_0x83a5('0x7f')]['id'],_0x571051[_0x83a5('0x82')][_0x83a5('0xad')]):_0x571051[_0x83a5('0x82')][_0x83a5('0xad')];if(_0x571051['query'][_0x83a5('0xae')]){_0x187d33[_0x83a5('0x9d')]=_0x571051[_0x83a5('0x82')][_0x83a5('0xae')];}}if(_0x571051['query'][_0x83a5('0xaf')]){_0x187d33['where']=_[_0x83a5('0xa0')](_0x187d33['where'],{'$and':_0x571051[_0x83a5('0x82')][_0x83a5('0xaf')]});}return _0x432d16[_0x45c5f5[_0x83a5('0x14')]][_0x83a5('0xac')]({'where':_0x187d33[_0x83a5('0x7f')]})[_0x83a5('0x9')](function(_0x2ac196){_0x1e18ff[_0x83a5('0xac')]=_0x2ac196;if(_0x571051[_0x83a5('0x82')][_0x83a5('0xa7')]){if(_0x45c5f5['childModel']===_0x83a5('0x1e')){_0x187d33[_0x83a5('0xa8')]=[{'model':_0x432d16['Tag'],'as':_0x83a5('0xb0'),'attributes':['id',_0x83a5('0xc'),_0x83a5('0xb1')],'required':_0x571051['query']['tag']?!![]:![]},{'model':_0x432d16[_0x83a5('0xb2')],'as':'ThroughTags','attributes':['id','name','color'],'through':_0x571051['query'][_0x83a5('0xb3')]?{'attributes':[],'where':{'TagId':_0x571051['query'][_0x83a5('0xb3')]||undefined}}:{},'required':_0x571051[_0x83a5('0x82')][_0x83a5('0xb3')]?!![]:![]}];}else{_0x187d33[_0x83a5('0xa8')]=[{'all':!![]}];}}return _0x432d16[_0x45c5f5[_0x83a5('0x14')]][_0x83a5('0x8')](_0x187d33);})[_0x83a5('0x9')](function(_0x2d164b){_0x1e18ff[_0x83a5('0xb4')]=_0x2d164b;if(_0x2363a7===_0x83a5('0x34')&&_0x571051[_0x83a5('0x82')][_0x83a5('0xb5')]===_0x83a5('0xb6')){var _0x54caee=[];for(var _0x4ef2d1=0x0;_0x4ef2d1<_0x1e18ff['rows'][_0x83a5('0x8a')];_0x4ef2d1++){_0x54caee[_0x83a5('0x8b')](_0x6a0171(_0x83a5('0xb7'),_0x1e18ff[_0x83a5('0xb4')][_0x4ef2d1]['dataValues']));_0x54caee[_0x83a5('0x8b')](_0x6a0171('sms',_0x1e18ff[_0x83a5('0xb4')][_0x4ef2d1][_0x83a5('0xb8')]));_0x54caee[_0x83a5('0x8b')](_0x6a0171(_0x83a5('0xb9'),_0x1e18ff['rows'][_0x4ef2d1]['dataValues']));_0x54caee[_0x83a5('0x8b')](_0x6a0171(_0x83a5('0xba'),_0x1e18ff[_0x83a5('0xb4')][_0x4ef2d1][_0x83a5('0xb8')]));_0x54caee[_0x83a5('0x8b')](_0x6a0171('openchannel',_0x1e18ff['rows'][_0x4ef2d1][_0x83a5('0xb8')]));_0x54caee[_0x83a5('0x8b')](_0x6a0171('whatsapp',_0x1e18ff[_0x83a5('0xb4')][_0x4ef2d1][_0x83a5('0xb8')]));}return Promise[_0x83a5('0x8e')](_0x54caee)[_0x83a5('0x9')](function(){return _0x1e18ff;});}return _0x1e18ff;});}});}}});}; \ No newline at end of file +var _0xe2de=['nolimit','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','forEach','include','reportType','default','DefaultReports','custom','count','rows','ids','customSorting','extraQueryConditions','includeAll','CmContact','Tags','tag','ThroughTags','color','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','value','findAll','then','associatedResources','map','field','model','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','whatsappqueues','whatsappaccounts','WhatsappAccount','Team','queuecampaigns','users','agents','telephones','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','Schedule','sounds','Sound','tags','Tag','triggers','Trigger','trunks','Trunk','variables','extractedreports','Reports','reportId','metrics','charAt','toUpperCase','slice','QueryTypes','select','InteractionId','ui.createdAt','where','ui.UserId\x20=\x20?','toString','OpenTabs','define','UserProfile','user_profiles','query','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','find','params','all','ignore','union','push','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x5ed0f8,_0x34e76d){var _0x4e6fd8=function(_0x3b0be9){while(--_0x3b0be9){_0x5ed0f8['push'](_0x5ed0f8['shift']());}};_0x4e6fd8(++_0x34e76d);}(_0xe2de,0x1a7));var _0xee2d=function(_0x155586,_0x163199){_0x155586=_0x155586-0x0;var _0x4262fc=_0xe2de[_0x155586];return _0x4262fc;};'use strict';var _=require('lodash');var attributes=require(_0xee2d('0x0'));var qs=require(_0xee2d('0x1'));var squel=require(_0xee2d('0x2'));module[_0xee2d('0x3')]=function(_0x327fcd){var _0x5946fc=_0x327fcd[_0xee2d('0x4')];function _0x58c47e(_0x5d6407,_0x3b05c9){return new Promise(function(_0x53d9c9,_0x1197c5){if(!_0x3b05c9)return _0x53d9c9(null);var _0x2fe034=_0x3b05c9[_0xee2d('0x5')]?{[_0x3b05c9[_0xee2d('0x5')]['field']]:_0x3b05c9[_0xee2d('0x5')][_0xee2d('0x6')]}:undefined;return _0x5946fc[_0x5d6407][_0xee2d('0x7')]({'where':_0x2fe034,'raw':!![]})[_0xee2d('0x8')](function(_0x5c7461){_0x3b05c9[_0xee2d('0x9')]=_[_0xee2d('0xa')](_0x5c7461,'id');_0x53d9c9(_0x3b05c9);})['catch'](function(_0x155c99){_0x1197c5(_0x155c99);});});}function _0x4d8af8(_0x2b74e9,_0x12acf1){return new Promise(function(_0x49d645,_0x96c95e){var _0xf46889=_0x2b74e9['filter']?{[_0x2b74e9[_0xee2d('0x5')][_0xee2d('0xb')]]:_0x2b74e9[_0xee2d('0x5')]['value']}:undefined;return _0x5946fc[_0x2b74e9[_0xee2d('0xc')]][_0xee2d('0x7')]({'where':_0xf46889,'raw':!![]})[_0xee2d('0x8')](function(_0x369026){_0x12acf1[_0xee2d('0x9')]=_[_0xee2d('0xa')](_0x369026,function(_0x345bcb){return _0x345bcb[_0xee2d('0xd')];});_0x49d645(_0x12acf1);})[_0xee2d('0xe')](function(_0x5288af){_0x96c95e(_0x5288af);});});}function _0x484078(_0x445aa6,_0x164810,_0x23baee){if(!_0x164810)return Promise[_0xee2d('0xf')](null);return new Promise(function(_0x258773,_0x5c9523){return _0x5946fc[_0xee2d('0x10')][_0xee2d('0x7')]({'where':{'sectionId':_0x164810['id']},'raw':!![]})['then'](function(_0xf9f21){if(_0x445aa6[_0xee2d('0xb')]&&_0x445aa6[_0xee2d('0xb')]!=='id'){_0x164810[_0xee2d('0x9')]=_['map'](_0xf9f21,function(_0x3aaa8e){return _0x3aaa8e[_0x445aa6[_0xee2d('0xb')]];});}else{if(_0x23baee===_0xee2d('0x11')){_0x164810[_0xee2d('0x9')]=_[_0xee2d('0xa')](_0xf9f21,function(_0x192d27){return{'id':_0x192d27['resourceId'],'type':_0x192d27[_0xee2d('0x12')]};});}else{_0x164810[_0xee2d('0x9')]=_[_0xee2d('0xa')](_0xf9f21,function(_0x292d80){return _0x292d80[_0xee2d('0x13')];});}}_0x258773(_0x164810);})[_0xee2d('0xe')](function(_0x71ea97){_0x5c9523(_0x71ea97);});});}function _0x1d2460(_0x23baa6,_0x132f17){var _0x1cef66={'parentSections':[]};switch(_0x23baa6[_0xee2d('0x14')]()){case _0xee2d('0x15'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x17');break;case _0xee2d('0x18'):_0x1cef66['childModel']=_0xee2d('0x19');break;case'squarerecordings':_0x1cef66['childModel']=_0xee2d('0x1a');_0x1cef66[_0xee2d('0x1b')]=[{'name':'SquareProjects','field':_0xee2d('0xd'),'foreignKey':_0xee2d('0x1c')}];break;case _0xee2d('0x1d'):_0x1cef66['childModel']=_0xee2d('0x1e');break;case _0xee2d('0x1f'):_0x1cef66['childModel']='CmContact';_0x1cef66[_0xee2d('0x1b')]=[{'name':_0xee2d('0x20'),'field':'id','foreignKey':_0xee2d('0x21')}];break;case _0xee2d('0x22'):_0x1cef66['childModel']=_0xee2d('0x23');break;case _0xee2d('0x24'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x25');break;case _0xee2d('0x26'):_0x1cef66['childModel']=_0xee2d('0x27');break;case _0xee2d('0x28'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x29');break;case _0xee2d('0x2a'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x2b');break;case _0xee2d('0x2c'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x2d');break;case'faxaccounts':_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x2e');break;case _0xee2d('0x2f'):case _0xee2d('0x30'):case _0xee2d('0x31'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x32');break;case _0xee2d('0x33'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x34');break;case _0xee2d('0x35'):_0x1cef66[_0xee2d('0x16')]='VoiceMail';break;case _0xee2d('0x36'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x37');_0x1cef66['parentSections']=[{'name':_0xee2d('0x38'),'field':_0xee2d('0xd'),'foreignKey':_0xee2d('0x39'),'model':_0xee2d('0x3a'),'filter':{'field':_0xee2d('0x3b'),'value':[_0xee2d('0x3c')]}},{'name':_0xee2d('0x3d'),'field':'name','foreignKey':_0xee2d('0x39'),'model':'User','filter':{'field':'role','value':[_0xee2d('0x3e')]}},{'name':'VoiceQueues','field':_0xee2d('0xd'),'foreignKey':_0xee2d('0x3f'),'model':_0xee2d('0x40'),'filter':{'field':_0xee2d('0x12'),'value':[_0xee2d('0x41')]}},{'name':_0xee2d('0x42'),'field':_0xee2d('0xd'),'foreignKey':_0xee2d('0x3f'),'model':_0xee2d('0x40'),'filter':{'field':'type','value':[_0xee2d('0x43')]}}];break;case _0xee2d('0x44'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x45');break;case _0xee2d('0x46'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x47');break;case'voiceprefixes':_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x48');break;case _0xee2d('0x49'):_0x1cef66['childModel']='Campaign';break;case _0xee2d('0x4a'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x4b');break;case _0xee2d('0x4c'):_0x1cef66[_0xee2d('0x16')]='MailAccount';break;case'mailsubstatuses':_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x4d');break;case _0xee2d('0x4e'):_0x1cef66['childModel']=_0xee2d('0x4f');break;case _0xee2d('0x50'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x51');break;case _0xee2d('0x52'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x53');break;case'smsaccounts':_0x1cef66[_0xee2d('0x16')]='SmsAccount';break;case _0xee2d('0x54'):_0x1cef66[_0xee2d('0x16')]='WhatsappQueue';break;case _0xee2d('0x55'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x56');break;case'teams':_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x57');break;case'voicequeues':case _0xee2d('0x58'):_0x1cef66['childModel']=_0xee2d('0x40');if(_0x132f17){_0x1cef66[_0xee2d('0x1b')]=[{'name':'VoiceQueues'},{'name':_0xee2d('0x42')}];}break;case _0xee2d('0x59'):case _0xee2d('0x5a'):case _0xee2d('0x5b'):_0x1cef66['childModel']=_0xee2d('0x3a');if(_0x132f17){_0x1cef66[_0xee2d('0x1b')]=[{'name':'Users','filter':{'field':_0xee2d('0x3b'),'value':[_0xee2d('0x5c'),_0xee2d('0x5d')]},'ignore':!![]},{'name':_0xee2d('0x38')},{'name':_0xee2d('0x3d')}];}break;case _0xee2d('0x5e'):_0x1cef66[_0xee2d('0x16')]='ZendeskAccount';break;case _0xee2d('0x5f'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x60');break;case _0xee2d('0x61'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x62');break;case _0xee2d('0x63'):_0x1cef66['childModel']='SugarcrmAccount';break;case _0xee2d('0x64'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x65');break;case'zohoaccounts':_0x1cef66[_0xee2d('0x16')]='ZohoAccount';break;case'vtigeraccounts':_0x1cef66[_0xee2d('0x16')]='User';break;case'cannedanswers':_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x66');break;case _0xee2d('0x67'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x68');break;case _0xee2d('0x69'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x6a');break;case _0xee2d('0x6b'):_0x1cef66[_0xee2d('0x16')]='Interval';break;case _0xee2d('0x6c'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x6d');break;case'scheduler':_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x6e');break;case _0xee2d('0x6f'):_0x1cef66['childModel']=_0xee2d('0x70');break;case _0xee2d('0x71'):_0x1cef66['childModel']=_0xee2d('0x72');break;case'templates':_0x1cef66[_0xee2d('0x16')]='Template';break;case _0xee2d('0x73'):_0x1cef66['childModel']=_0xee2d('0x74');break;case _0xee2d('0x75'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x76');break;case _0xee2d('0x77'):_0x1cef66[_0xee2d('0x16')]='Variable';break;case'plugins':_0x1cef66[_0xee2d('0x16')]='Plugin';break;case _0xee2d('0x78'):_0x1cef66['childModel']=_0xee2d('0x11');_0x1cef66[_0xee2d('0x1b')]=[{'name':_0xee2d('0x79'),'field':'id','foreignKey':_0xee2d('0x7a')}];break;case _0xee2d('0x7b'):_0x1cef66['childModel']='AnalyticMetric';break;}return _0x1cef66;}function _0xa65656(_0x487b9a,_0x469bd8){var _0x3de3e6=_0x487b9a[_0xee2d('0x7c')](0x0)[_0xee2d('0x7d')]()+_0x487b9a[_0xee2d('0x7e')](0x1);var _0x4a6399={'type':_0x5946fc['Sequelize'][_0xee2d('0x7f')]['SELECT'],'raw':!![]};return new Promise(function(_0x1e9bd4,_0x177b52){var _0x5861b3=squel[_0xee2d('0x80')]()[_0xee2d('0xb')]('ui.'+_0x3de3e6+_0xee2d('0x81'),'id')[_0xee2d('0xb')](_0xee2d('0x82'))['from']('user_has_'+_0x487b9a+'_interactions','ui')[_0xee2d('0x83')](_0xee2d('0x84'),_0x469bd8['id']);return _0x5946fc['sequelize']['query'](_0x5861b3[_0xee2d('0x85')](),_0x4a6399)[_0xee2d('0x8')](function(_0x461f24){_0x469bd8[_0x3de3e6+_0xee2d('0x86')]=_0x461f24;_0x1e9bd4(_0x461f24);})['catch'](function(_0x2b3de1){_0x177b52(_0x2b3de1);});});}return _0x327fcd[_0xee2d('0x87')](_0xee2d('0x88'),attributes,{'tableName':_0xee2d('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x447f5c){var _0x1c7ee2={'raw':_0x447f5c[_0xee2d('0x8a')][_0xee2d('0x8b')],'where':{}};var _0x34fa56={};var _0x1c3b77={'count':0x0,'rows':[]};var _0x208e0f=_0x447f5c[_0xee2d('0x8a')][_0xee2d('0x8c')];var _0x514edf=_0x447f5c[_0xee2d('0x8a')][_0xee2d('0x8d')]||![];var _0x1d1c8d=_0x1d2460(_0x208e0f,_0x514edf);if(!_0x1d1c8d[_0xee2d('0x16')])throw new Error(_0xee2d('0x8e')+_0x208e0f+'\x27');var _0x1a99ef=[{'name':_0x208e0f}];if(!_[_0xee2d('0x8f')](_0x1d1c8d['parentSections']))_0x1a99ef=_0x1d1c8d['parentSections'];var _0x44e0f2=[];for(var _0x4092bd=0x0;_0x4092bd<_0x1a99ef[_0xee2d('0x90')];_0x4092bd++){_0x44e0f2['push'](_0x5946fc['UserProfileSection'][_0xee2d('0x91')]({'where':{'userProfileId':_0x447f5c[_0xee2d('0x92')]['id'],'name':_0x1a99ef[_0x4092bd][_0xee2d('0xd')]},'raw':!![]}));}return Promise[_0xee2d('0x93')](_0x44e0f2)[_0xee2d('0x8')](function(_0x27b3ef){var _0x4f0e03=_[_0xee2d('0x5')](_0x27b3ef,function(_0x248938){return _0x248938?_0x248938:undefined;});var _0x382f96=_[_0xee2d('0x5')](_0x1a99ef,[_0xee2d('0x94'),!![]]);var _0x1875c0=_['isEmpty'](_0x4f0e03)&&_[_0xee2d('0x8f')](_0x382f96)?null:_[_0xee2d('0x95')](_0x382f96,_0x4f0e03);if(!_0x1875c0)return null;var _0x15842c=[];for(var _0x22e0ff=0x0;_0x22e0ff<_0x1875c0[_0xee2d('0x90')];_0x22e0ff++){var _0x1dd01e=_[_0xee2d('0x91')](_0x1a99ef,function(_0x1c8caf){return _0x1875c0[_0x22e0ff]?_0x1c8caf['name']===_0x1875c0[_0x22e0ff][_0xee2d('0xd')]:null;});if(_0x1dd01e){if(_0x1875c0[_0x22e0ff][_0xee2d('0x94')]){_0x15842c[_0xee2d('0x96')](_0x58c47e(_0x1d1c8d[_0xee2d('0x16')],_0x1875c0[_0x22e0ff]));}else{if(!_0x1875c0[_0x22e0ff][_0xee2d('0x97')]){_0x15842c[_0xee2d('0x96')](_0x484078(_0x1dd01e,_0x1875c0[_0x22e0ff],_0x1d1c8d[_0xee2d('0x16')]));}else{if(_0x1dd01e['model']){_0x15842c[_0xee2d('0x96')](_0x4d8af8(_0x1dd01e,_0x1875c0[_0x22e0ff]));}}}}}return Promise[_0xee2d('0x93')](_0x15842c);})[_0xee2d('0x8')](function(_0x3fbd04){var _0x48718c=_0x3fbd04;var _0x2540ec=null;if(_0x48718c){_0x2540ec=_0x48718c[_0xee2d('0x90')]===0x1?_0x48718c[0x0]:null;}if(!_0x2540ec&&!_0x48718c)return _0x1c3b77;var _0x176990=_0x5946fc[_0x1d1c8d[_0xee2d('0x16')]][_0xee2d('0x98')];_0x34fa56[_0xee2d('0xc')]=_[_0xee2d('0x99')](_0x176990);_0x34fa56[_0xee2d('0x8a')]=_[_0xee2d('0x99')](_0x447f5c['query']);_0x34fa56[_0xee2d('0x9a')]=_['intersection'](_0x34fa56[_0xee2d('0xc')],_0x34fa56[_0xee2d('0x8a')]);_0x1c7ee2['attributes']=_[_0xee2d('0x9b')](_0x34fa56[_0xee2d('0xc')],qs[_0xee2d('0x9c')](_0x447f5c['query'][_0xee2d('0x9c')]));_0x1c7ee2['attributes']=_0x1c7ee2['attributes'][_0xee2d('0x90')]?_0x1c7ee2[_0xee2d('0x9d')]:_0x34fa56[_0xee2d('0xc')];if(!_0x447f5c['query'][_0xee2d('0x9e')](_0xee2d('0x9f'))){_0x1c7ee2[_0xee2d('0xa0')]=qs[_0xee2d('0xa0')](_0x447f5c[_0xee2d('0x8a')]['limit']);_0x1c7ee2[_0xee2d('0xa1')]=qs[_0xee2d('0xa1')](_0x447f5c[_0xee2d('0x8a')][_0xee2d('0xa1')]);}_0x1c7ee2[_0xee2d('0xa2')]=qs[_0xee2d('0xa3')](_0x447f5c['query'][_0xee2d('0xa3')]);_0x1c7ee2[_0xee2d('0x83')]=qs[_0xee2d('0x9a')](_[_0xee2d('0xa4')](_0x447f5c['query'],_0x34fa56['filters']));if(_0x447f5c[_0xee2d('0x8a')][_0xee2d('0x5')]){_0x1c7ee2[_0xee2d('0x83')]=_[_0xee2d('0xa5')](_0x1c7ee2[_0xee2d('0x83')],{'$or':_['map'](_0x176990,function(_0x24e724){if(_0x24e724[_0xee2d('0x12')]['key']!==_0xee2d('0xa6')){var _0xed11fa={};_0xed11fa[_0x24e724['field']]={'$like':'%'+_0x447f5c[_0xee2d('0x8a')][_0xee2d('0x5')]+'%'};return _0xed11fa;}})});}var _0x50f043=[];var _0x9e5b6c=null;var _0x56b2cb={};if(_0x2540ec){_0x9e5b6c=_[_0xee2d('0x91')](_0x1a99ef,[_0xee2d('0xd'),_0x2540ec[_0xee2d('0xd')]]);if(_0x9e5b6c[_0xee2d('0xb')]){_0x56b2cb={};if(_0x1d1c8d[_0xee2d('0x16')]===_0xee2d('0x11')){_0x56b2cb[_0x9e5b6c[_0xee2d('0xa7')]]=_[_0xee2d('0xa')](_0x2540ec['associatedResources'],'id');}else{_0x56b2cb[_0x9e5b6c[_0xee2d('0xa7')]]=_0x2540ec[_0xee2d('0x9')];}_0x50f043[_0xee2d('0x96')](_0x56b2cb);}else{_0x1c7ee2[_0xee2d('0x83')]['id']=_0x2540ec[_0xee2d('0x9')];}}else{for(var _0x57c49b=0x0;_0x57c49b<_0x48718c[_0xee2d('0x90')];_0x57c49b++){_0x9e5b6c=_[_0xee2d('0x91')](_0x1a99ef,[_0xee2d('0xd'),_0x48718c[_0x57c49b][_0xee2d('0xd')]]);if(_0x9e5b6c[_0xee2d('0xb')]){_0x56b2cb={};_0x56b2cb[_0x9e5b6c[_0xee2d('0xa7')]]=_0x48718c[_0x57c49b][_0xee2d('0x9')];_0x50f043[_0xee2d('0x96')](_0x56b2cb);}else{if(!_0x1c7ee2[_0xee2d('0x83')]['id'])_0x1c7ee2[_0xee2d('0x83')]['id']=[];_0x48718c[_0x57c49b]['associatedResources'][_0xee2d('0xa8')](function(_0x421829){_0x1c7ee2[_0xee2d('0x83')]['id']['push'](_0x421829);});}}}if(!_[_0xee2d('0x8f')](_0x50f043)){_0x1c7ee2['where']=_[_0xee2d('0xa5')](_0x1c7ee2['where'],{'$and':{'$or':_0x50f043}});}_0x1c7ee2=_[_0xee2d('0xa5')]({},_0x1c7ee2,_0x447f5c['options']);if(_0x2540ec&&!_0x2540ec[_0xee2d('0x97')]&&_0x1d1c8d[_0xee2d('0x16')]===_0xee2d('0x11')){if(_0x447f5c[_0xee2d('0x8a')]['includeAll']){_0x1c7ee2[_0xee2d('0xa9')]=[{'all':!![]}];}return _0x5946fc[_0x1d1c8d[_0xee2d('0x16')]][_0xee2d('0x7')](_0x1c7ee2)['then'](function(_0x40075c){var _0x31f442=[];_0x40075c[_0xee2d('0xa8')](function(_0x4cfcb5){var _0x2f1328;switch(_0x4cfcb5[_0xee2d('0xaa')]){case _0xee2d('0xab'):_0x2f1328=_[_0xee2d('0x91')](_0x2540ec[_0xee2d('0x9')],function(_0x3701c5){return _0x3701c5['id']===_0x4cfcb5['reportId']&&_0x3701c5['type']===_0xee2d('0xac');});break;case _0xee2d('0xad'):_0x2f1328=_['find'](_0x2540ec['associatedResources'],function(_0x40f17d){return _0x40f17d['id']===_0x4cfcb5['reportId']&&_0x40f17d['type']==='CustomReports';});break;}if(_0x2f1328)_0x31f442['push'](_0x4cfcb5);});_0x1c3b77[_0xee2d('0xae')]=_0x31f442[_0xee2d('0x90')];_0x1c3b77[_0xee2d('0xaf')]=_0x31f442;return _0x1c3b77;});}else{if(!_[_0xee2d('0x8f')](_0x447f5c[_0xee2d('0x8a')][_0xee2d('0xb0')])){_0x1c7ee2[_0xee2d('0x83')]['id']=_0x1c7ee2[_0xee2d('0x83')]['id']?_[_0xee2d('0x9b')](_0x1c7ee2[_0xee2d('0x83')]['id'],_0x447f5c[_0xee2d('0x8a')]['ids']):_0x447f5c[_0xee2d('0x8a')][_0xee2d('0xb0')];if(_0x447f5c[_0xee2d('0x8a')]['customSorting']){_0x1c7ee2['order']=_0x447f5c[_0xee2d('0x8a')][_0xee2d('0xb1')];}}if(_0x447f5c['query'][_0xee2d('0xb2')]){_0x1c7ee2[_0xee2d('0x83')]=_['merge'](_0x1c7ee2[_0xee2d('0x83')],{'$and':_0x447f5c[_0xee2d('0x8a')]['extraQueryConditions']});}return _0x5946fc[_0x1d1c8d[_0xee2d('0x16')]][_0xee2d('0xae')]({'where':_0x1c7ee2['where']})[_0xee2d('0x8')](function(_0x3b48b0){_0x1c3b77[_0xee2d('0xae')]=_0x3b48b0;if(_0x447f5c['query'][_0xee2d('0xb3')]){if(_0x1d1c8d[_0xee2d('0x16')]===_0xee2d('0xb4')){_0x1c7ee2['include']=[{'model':_0x5946fc[_0xee2d('0x72')],'as':_0xee2d('0xb5'),'attributes':['id',_0xee2d('0xd'),'color'],'required':_0x447f5c[_0xee2d('0x8a')][_0xee2d('0xb6')]?!![]:![]},{'model':_0x5946fc[_0xee2d('0x72')],'as':_0xee2d('0xb7'),'attributes':['id',_0xee2d('0xd'),_0xee2d('0xb8')],'through':_0x447f5c[_0xee2d('0x8a')]['tag']?{'attributes':[],'where':{'TagId':_0x447f5c[_0xee2d('0x8a')][_0xee2d('0xb6')]||undefined}}:{},'required':_0x447f5c[_0xee2d('0x8a')][_0xee2d('0xb6')]?!![]:![]}];}else{_0x1c7ee2['include']=[{'all':!![]}];}}return _0x5946fc[_0x1d1c8d[_0xee2d('0x16')]][_0xee2d('0x7')](_0x1c7ee2);})['then'](function(_0x16071a){_0x1c3b77[_0xee2d('0xaf')]=_0x16071a;if(_0x208e0f===_0xee2d('0x38')&&_0x447f5c[_0xee2d('0x8a')][_0xee2d('0xb9')]===_0xee2d('0xba')){var _0x5001e3=[];for(var _0x3658f5=0x0;_0x3658f5<_0x1c3b77[_0xee2d('0xaf')][_0xee2d('0x90')];_0x3658f5++){_0x5001e3[_0xee2d('0x96')](_0xa65656(_0xee2d('0xbb'),_0x1c3b77['rows'][_0x3658f5][_0xee2d('0xbc')]));_0x5001e3[_0xee2d('0x96')](_0xa65656(_0xee2d('0xbd'),_0x1c3b77[_0xee2d('0xaf')][_0x3658f5][_0xee2d('0xbc')]));_0x5001e3[_0xee2d('0x96')](_0xa65656(_0xee2d('0xbe'),_0x1c3b77[_0xee2d('0xaf')][_0x3658f5][_0xee2d('0xbc')]));_0x5001e3[_0xee2d('0x96')](_0xa65656(_0xee2d('0xbf'),_0x1c3b77['rows'][_0x3658f5][_0xee2d('0xbc')]));_0x5001e3[_0xee2d('0x96')](_0xa65656(_0xee2d('0xc0'),_0x1c3b77['rows'][_0x3658f5][_0xee2d('0xbc')]));_0x5001e3[_0xee2d('0x96')](_0xa65656(_0xee2d('0xc1'),_0x1c3b77['rows'][_0x3658f5]['dataValues']));}return Promise['all'](_0x5001e3)['then'](function(){return _0x1c3b77;});}return _0x1c3b77;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 6f3d6c5..3c01f34 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 _0x0024=['defaults','localhost','socket.io-emitter','./userProfile.socket','request','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','util','bluebird','ioredis','../../config/logger','rpc','client','http','redis'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x0024,0xa8));var _0x4002=function(_0x3c22b3,_0x509f39){_0x3c22b3=_0x3c22b3-0x0;var _0x6969f7=_0x0024[_0x3c22b3];return _0x6969f7;};'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('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4002('0x3'))(_0x4002('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4002('0x5')][_0x4002('0x6')]({'port':0x232a});config[_0x4002('0x7')]=_[_0x4002('0x8')](config['redis'],{'host':_0x4002('0x9'),'port':0x18eb});var socket=require(_0x4002('0xa'))(new Redis(config[_0x4002('0x7')]));require(_0x4002('0xb'))['register'](socket);function respondWithRpcPromise(_0x5f32c7,_0x21c971,_0x26fd5d){return new BPromise(function(_0x397864,_0x12c368){return client[_0x4002('0xc')](_0x5f32c7,_0x26fd5d)['then'](function(_0x53c0ef){logger['info'](_0x4002('0xd'),_0x21c971,_0x4002('0xe'));logger[_0x4002('0xf')](_0x4002('0x10'),_0x21c971,'request\x20sent',JSON[_0x4002('0x11')](_0x53c0ef));if(_0x53c0ef[_0x4002('0x12')]){if(_0x53c0ef[_0x4002('0x12')][_0x4002('0x13')]===0x1f4){logger[_0x4002('0x12')]('UserProfile,\x20%s,\x20%s',_0x21c971,_0x53c0ef[_0x4002('0x12')]['message']);return _0x12c368(_0x53c0ef[_0x4002('0x12')][_0x4002('0x14')]);}logger[_0x4002('0x12')]('UserProfile,\x20%s,\x20%s',_0x21c971,_0x53c0ef[_0x4002('0x12')]['message']);return _0x397864(_0x53c0ef['error'][_0x4002('0x14')]);}else{logger[_0x4002('0x15')]('UserProfile,\x20%s,\x20%s',_0x21c971,_0x4002('0xe'));_0x397864(_0x53c0ef['result']['message']);}})['catch'](function(_0x22820f){logger[_0x4002('0x12')](_0x4002('0xd'),_0x21c971,_0x22820f);_0x12c368(_0x22820f);});});} \ No newline at end of file +var _0x3e24=['info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register'];(function(_0x22dc58,_0x38deff){var _0x242216=function(_0x5244af){while(--_0x5244af){_0x22dc58['push'](_0x22dc58['shift']());}};_0x242216(++_0x38deff);}(_0x3e24,0x167));var _0x43e2=function(_0xc3f3bd,_0x20b7f5){_0xc3f3bd=_0xc3f3bd-0x0;var _0x27d0bd=_0x3e24[_0xc3f3bd];return _0x27d0bd;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var BPromise=require(_0x43e2('0x3'));var rs=require(_0x43e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43e2('0x5'))['db'];var utils=require(_0x43e2('0x6'));var logger=require('../../config/logger')(_0x43e2('0x7'));var config=require(_0x43e2('0x8'));var jayson=require(_0x43e2('0x9'));var client=jayson[_0x43e2('0xa')][_0x43e2('0xb')]({'port':0x232a});config[_0x43e2('0xc')]=_[_0x43e2('0xd')](config['redis'],{'host':_0x43e2('0xe'),'port':0x18eb});var socket=require(_0x43e2('0xf'))(new Redis(config['redis']));require(_0x43e2('0x10'))[_0x43e2('0x11')](socket);function respondWithRpcPromise(_0x5375d8,_0x2ed387,_0x1ef968){return new BPromise(function(_0x52146c,_0x45848e){return client['request'](_0x5375d8,_0x1ef968)['then'](function(_0x5847f0){logger[_0x43e2('0x12')](_0x43e2('0x13'),_0x2ed387,_0x43e2('0x14'));logger[_0x43e2('0x15')](_0x43e2('0x16'),_0x2ed387,_0x43e2('0x14'),JSON[_0x43e2('0x17')](_0x5847f0));if(_0x5847f0[_0x43e2('0x18')]){if(_0x5847f0[_0x43e2('0x18')][_0x43e2('0x19')]===0x1f4){logger[_0x43e2('0x18')](_0x43e2('0x13'),_0x2ed387,_0x5847f0['error'][_0x43e2('0x1a')]);return _0x45848e(_0x5847f0[_0x43e2('0x18')][_0x43e2('0x1a')]);}logger[_0x43e2('0x18')]('UserProfile,\x20%s,\x20%s',_0x2ed387,_0x5847f0['error'][_0x43e2('0x1a')]);return _0x52146c(_0x5847f0[_0x43e2('0x18')][_0x43e2('0x1a')]);}else{logger[_0x43e2('0x12')](_0x43e2('0x13'),_0x2ed387,_0x43e2('0x14'));_0x52146c(_0x5847f0[_0x43e2('0x1b')][_0x43e2('0x1a')]);}})[_0x43e2('0x1c')](function(_0x399cab){logger['error'](_0x43e2('0x13'),_0x2ed387,_0x399cab);_0x45848e(_0x399cab);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index bd9537d..07d8f6a 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 _0xb3db=['emit','removeListener','length','./userProfile.events','save','remove','update'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xb3db,0xf8));var _0xbb3d=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xb3db[_0x40bffc];return _0x3007e9;};'use strict';var UserProfileEvents=require(_0xbb3d('0x0'));var events=[_0xbb3d('0x1'),_0xbb3d('0x2'),_0xbb3d('0x3')];function createListener(_0x1567e7,_0x1921b2){return function(_0x16a0f8){_0x1921b2[_0xbb3d('0x4')](_0x1567e7,_0x16a0f8);};}function removeListener(_0x4abccb,_0x423ff8){return function(){UserProfileEvents[_0xbb3d('0x5')](_0x4abccb,_0x423ff8);};}exports['register']=function(_0x4d644f){for(var _0x337736=0x0,_0x3b65a9=events[_0xbb3d('0x6')];_0x337736<_0x3b65a9;_0x337736++){var _0x34705f=events[_0x337736];var _0x3ecc0e=createListener('userProfile:'+_0x34705f,_0x4d644f);UserProfileEvents['on'](_0x34705f,_0x3ecc0e);}}; \ No newline at end of file +var _0x6f30=['remove','update','emit','removeListener','length','userProfile:','./userProfile.events','save'];(function(_0x3fc3c1,_0x332974){var _0x430c0b=function(_0x2cca0d){while(--_0x2cca0d){_0x3fc3c1['push'](_0x3fc3c1['shift']());}};_0x430c0b(++_0x332974);}(_0x6f30,0x1ce));var _0x06f3=function(_0xc5e02a,_0xd9da3c){_0xc5e02a=_0xc5e02a-0x0;var _0xbeca77=_0x6f30[_0xc5e02a];return _0xbeca77;};'use strict';var UserProfileEvents=require(_0x06f3('0x0'));var events=[_0x06f3('0x1'),_0x06f3('0x2'),_0x06f3('0x3')];function createListener(_0x55de13,_0x336365){return function(_0x251841){_0x336365[_0x06f3('0x4')](_0x55de13,_0x251841);};}function removeListener(_0x4a9f5c,_0x338a42){return function(){UserProfileEvents[_0x06f3('0x5')](_0x4a9f5c,_0x338a42);};}exports['register']=function(_0xda242a){for(var _0x229e97=0x0,_0x4b47ef=events[_0x06f3('0x6')];_0x229e97<_0x4b47ef;_0x229e97++){var _0x3b23dd=events[_0x229e97];var _0x41a85f=createListener(_0x06f3('0x7')+_0x3b23dd,_0xda242a);UserProfileEvents['on'](_0x3b23dd,_0x41a85f);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 92e7eca..6e8128f 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 _0xddc5=['post','create','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0xf13641,_0x4342c1){var _0x3d9f3d=function(_0x1b1ef3){while(--_0x1b1ef3){_0xf13641['push'](_0xf13641['shift']());}};_0x3d9f3d(++_0x4342c1);}(_0xddc5,0x101));var _0x5ddc=function(_0xecb1b7,_0x5c05e6){_0xecb1b7=_0xecb1b7-0x0;var _0xa22d64=_0xddc5[_0xecb1b7];return _0xa22d64;};'use strict';var multer=require(_0x5ddc('0x0'));var util=require(_0x5ddc('0x1'));var path=require('path');var timeout=require(_0x5ddc('0x2'));var express=require(_0x5ddc('0x3'));var router=express[_0x5ddc('0x4')]();var fs_extra=require(_0x5ddc('0x5'));var auth=require(_0x5ddc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5ddc('0x7'));router[_0x5ddc('0x8')]('/',auth[_0x5ddc('0x9')](),controller[_0x5ddc('0xa')]);router[_0x5ddc('0x8')](_0x5ddc('0xb'),auth[_0x5ddc('0x9')](),controller[_0x5ddc('0xc')]);router[_0x5ddc('0x8')](_0x5ddc('0xd'),auth[_0x5ddc('0x9')](),controller[_0x5ddc('0xe')]);router[_0x5ddc('0xf')]('/',auth[_0x5ddc('0x9')](),controller[_0x5ddc('0x10')]);router['put'](_0x5ddc('0xd'),auth[_0x5ddc('0x9')](),controller['update']);router['delete'](_0x5ddc('0xd'),auth[_0x5ddc('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8def=['post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','show'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8def,0x18e));var _0xf8de=function(_0x49c2e1,_0x16469a){_0x49c2e1=_0x49c2e1-0x0;var _0x14f88b=_0x8def[_0x49c2e1];return _0x14f88b;};'use strict';var multer=require('multer');var util=require(_0xf8de('0x0'));var path=require(_0xf8de('0x1'));var timeout=require(_0xf8de('0x2'));var express=require(_0xf8de('0x3'));var router=express[_0xf8de('0x4')]();var fs_extra=require(_0xf8de('0x5'));var auth=require(_0xf8de('0x6'));var interaction=require(_0xf8de('0x7'));var config=require(_0xf8de('0x8'));var controller=require(_0xf8de('0x9'));router[_0xf8de('0xa')]('/',auth['isAuthenticated'](),controller[_0xf8de('0xb')]);router[_0xf8de('0xa')](_0xf8de('0xc'),auth[_0xf8de('0xd')](),controller[_0xf8de('0xe')]);router[_0xf8de('0xa')]('/:id',auth[_0xf8de('0xd')](),controller[_0xf8de('0xf')]);router[_0xf8de('0x10')]('/',auth['isAuthenticated'](),controller[_0xf8de('0x11')]);router[_0xf8de('0x12')](_0xf8de('0x13'),auth[_0xf8de('0xd')](),controller[_0xf8de('0x14')]);router[_0xf8de('0x15')]('/:id',auth[_0xf8de('0xd')](),controller[_0xf8de('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 94db530..c819b73 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 _0x103e=['sequelize','STRING','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x103e,0x18c));var _0xe103=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x103e[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xe103('0x0'));module['exports']={'name':{'type':Sequelize[_0xe103('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xe103('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xa0d2=['STRING','INTEGER','sequelize'];(function(_0xf0aa82,_0x6cd556){var _0x1e1caa=function(_0x30985e){while(--_0x30985e){_0xf0aa82['push'](_0xf0aa82['shift']());}};_0x1e1caa(++_0x6cd556);}(_0xa0d2,0x146));var _0x2a0d=function(_0x55ff57,_0x19cabf){_0x55ff57=_0x55ff57-0x0;var _0x42cf8b=_0xa0d2[_0x55ff57];return _0x42cf8b;};'use strict';var Sequelize=require(_0x2a0d('0x0'));module['exports']={'name':{'type':Sequelize[_0x2a0d('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x2a0d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2a0d('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index e26b28a..d87aae4 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 _0xd117=['filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','UserProfileResource','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x112c5d,_0x295440){var _0xb50c7e=function(_0x311b26){while(--_0x311b26){_0x112c5d['push'](_0x112c5d['shift']());}};_0xb50c7e(++_0x295440);}(_0xd117,0x182));var _0x7d11=function(_0x36d25e,_0x1a047d){_0x36d25e=_0x36d25e-0x0;var _0x4b95b8=_0xd117[_0x36d25e];return _0x4b95b8;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['create'](_0x161213['body'],{})['then'](respondWithResult(_0x193631,0xc9))[_0x7d11('0x40')](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x20297a,_0x18ae0e){if(_0x20297a[_0x7d11('0x48')]['id']){delete _0x20297a[_0x7d11('0x48')]['id'];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'id':_0x20297a[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x18ae0e,null))[_0x7d11('0x22')](saveUpdates(_0x20297a[_0x7d11('0x48')],null))['then'](respondWithResult(_0x18ae0e,null))[_0x7d11('0x40')](handleError(_0x18ae0e,null));};exports[_0x7d11('0x23')]=function(_0x29207f,_0x553a03){return db['UserProfileResource'][_0x7d11('0x45')]({'where':{'id':_0x29207f[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x553a03,null))['then'](removeEntity(_0x553a03,null))['catch'](handleError(_0x553a03,null));};exports[_0x7d11('0x49')]=function(_0x36af2b,_0x5e6234){return db[_0x7d11('0x28')][_0x7d11('0x49')]()[_0x7d11('0x22')](respondWithResult(_0x5e6234,null))[_0x7d11('0x40')](handleError(_0x5e6234,null));}; \ No newline at end of file +var _0x9f0e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f0e,0x116));var _0xe9f0=function(_0x54b8ae,_0x2de98e){_0x54b8ae=_0x54b8ae-0x0;var _0x427596=_0x9f0e[_0x54b8ae];return _0x427596;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x26')]();});}};}function handleEntityNotFound(_0x1321bb,_0x3c4ba9){return function(_0x3fce54){if(!_0x3fce54){_0x1321bb['sendStatus'](0x194);}return _0x3fce54;};}function handleError(_0x371095,_0x27541f){_0x27541f=_0x27541f||0x1f4;return function(_0x2ddfba){logger[_0xe9f0('0x27')](_0x2ddfba['stack']);if(_0x2ddfba[_0xe9f0('0x28')]){delete _0x2ddfba[_0xe9f0('0x28')];}_0x371095[_0xe9f0('0x1a')](_0x27541f)[_0xe9f0('0x29')](_0x2ddfba);};}exports[_0xe9f0('0x2a')]=function(_0x5457f6,_0x130f96){var _0xdc16bc={},_0x44fb5b={},_0xab3d81={'count':0x0,'rows':[]};var _0xa27c84=_[_0xe9f0('0x2b')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')],function(_0x2b6503){return{'name':_0x2b6503[_0xe9f0('0x2e')],'type':_0x2b6503[_0xe9f0('0x2f')][_0xe9f0('0x30')]};});_0x44fb5b[_0xe9f0('0x31')]=_[_0xe9f0('0x2b')](_0xa27c84,_0xe9f0('0x28'));_0x44fb5b[_0xe9f0('0x32')]=_[_0xe9f0('0x33')](_0x5457f6[_0xe9f0('0x32')]);_0x44fb5b[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x44fb5b[_0xe9f0('0x31')],_0x44fb5b[_0xe9f0('0x32')]);_0xdc16bc[_0xe9f0('0x36')]=_[_0xe9f0('0x35')](_0x44fb5b['model'],qs['fields'](_0x5457f6['query'][_0xe9f0('0x37')]));_0xdc16bc['attributes']=_0xdc16bc[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0xdc16bc['attributes']:_0x44fb5b[_0xe9f0('0x31')];if(!_0x5457f6['query']['hasOwnProperty']('nolimit')){_0xdc16bc[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x5457f6['query'][_0xe9f0('0x1d')]);_0xdc16bc[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x5457f6['query']['offset']);}_0xdc16bc[_0xe9f0('0x39')]=qs[_0xe9f0('0x3a')](_0x5457f6[_0xe9f0('0x32')]['sort']);_0xdc16bc[_0xe9f0('0x3b')]=qs[_0xe9f0('0x34')](_[_0xe9f0('0x3c')](_0x5457f6[_0xe9f0('0x32')],_0x44fb5b[_0xe9f0('0x34')]),_0xa27c84);if(_0x5457f6['query'][_0xe9f0('0x3d')]){_0xdc16bc[_0xe9f0('0x3b')]=_[_0xe9f0('0x3e')](_0xdc16bc['where'],{'$or':_[_0xe9f0('0x2b')](_0xa27c84,function(_0xbec11f){if(_0xbec11f['type']!==_0xe9f0('0x3f')){var _0x5154c3={};_0x5154c3[_0xbec11f[_0xe9f0('0x28')]]={'$like':'%'+_0x5457f6['query']['filter']+'%'};return _0x5154c3;}})});}_0xdc16bc=_['merge']({},_0xdc16bc,_0x5457f6['options']);var _0x5165f7={'where':_0xdc16bc[_0xe9f0('0x3b')]};return db[_0xe9f0('0x2c')][_0xe9f0('0x1e')](_0x5165f7)[_0xe9f0('0x24')](function(_0x2560c6){_0xab3d81[_0xe9f0('0x1e')]=_0x2560c6;if(_0x5457f6[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0xdc16bc[_0xe9f0('0x41')]=[{'all':!![]}];}return db['UserProfileResource'][_0xe9f0('0x42')](_0xdc16bc);})[_0xe9f0('0x24')](function(_0x36b00a){_0xab3d81['rows']=_0x36b00a;return _0xab3d81;})['then'](respondWithFilteredResult(_0x130f96,_0xdc16bc))[_0xe9f0('0x43')](handleError(_0x130f96,null));};exports['show']=function(_0x297689,_0x52613a){var _0x314f0e={'raw':![],'where':{'id':_0x297689['params']['id']}},_0x42d9d2={};_0x42d9d2[_0xe9f0('0x31')]=_[_0xe9f0('0x33')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')]);_0x42d9d2[_0xe9f0('0x32')]=_['keys'](_0x297689[_0xe9f0('0x32')]);_0x42d9d2[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x42d9d2[_0xe9f0('0x31')],_0x42d9d2[_0xe9f0('0x32')]);_0x314f0e['attributes']=_[_0xe9f0('0x35')](_0x42d9d2['model'],qs['fields'](_0x297689[_0xe9f0('0x32')][_0xe9f0('0x37')]));_0x314f0e['attributes']=_0x314f0e[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0x314f0e[_0xe9f0('0x36')]:_0x42d9d2[_0xe9f0('0x31')];if(_0x297689[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0x314f0e[_0xe9f0('0x41')]=[{'all':!![]}];}_0x314f0e=_['merge']({},_0x314f0e,_0x297689[_0xe9f0('0x44')]);return db['UserProfileResource'][_0xe9f0('0x45')](_0x314f0e)['then'](handleEntityNotFound(_0x52613a,null))[_0xe9f0('0x24')](respondWithResult(_0x52613a,null))['catch'](handleError(_0x52613a,null));};exports[_0xe9f0('0x46')]=function(_0x2023b4,_0x422324){return db['UserProfileResource'][_0xe9f0('0x46')](_0x2023b4[_0xe9f0('0x47')],{})[_0xe9f0('0x24')](respondWithResult(_0x422324,0xc9))[_0xe9f0('0x43')](handleError(_0x422324,null));};exports[_0xe9f0('0x23')]=function(_0x135175,_0x6ece3f){if(_0x135175[_0xe9f0('0x47')]['id']){delete _0x135175[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x135175[_0xe9f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x6ece3f,null))['then'](saveUpdates(_0x135175[_0xe9f0('0x47')],null))[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,null))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports['destroy']=function(_0x1ac381,_0x4d8b2e){return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x1ac381[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4d8b2e,null))['then'](removeEntity(_0x4d8b2e,null))[_0xe9f0('0x43')](handleError(_0x4d8b2e,null));};exports[_0xe9f0('0x49')]=function(_0x5163ea,_0x2bf65c){return db[_0xe9f0('0x2c')][_0xe9f0('0x49')]()[_0xe9f0('0x24')](respondWithResult(_0x2bf65c,null))['catch'](handleError(_0x2bf65c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index bee53a9..6b0fac9 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 _0x5d5c=['request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2a4095,_0x13f4f0){var _0x52eeab=function(_0x3950dd){while(--_0x3950dd){_0x2a4095['push'](_0x2a4095['shift']());}};_0x52eeab(++_0x13f4f0);}(_0x5d5c,0x17b));var _0xc5d5=function(_0x19b571,_0x2e3579){_0x19b571=_0x19b571-0x0;var _0x17cb19=_0x5d5c[_0x19b571];return _0x17cb19;};'use strict';var _=require(_0xc5d5('0x0'));var util=require(_0xc5d5('0x1'));var logger=require(_0xc5d5('0x2'))('api');var moment=require(_0xc5d5('0x3'));var BPromise=require(_0xc5d5('0x4'));var rp=require(_0xc5d5('0x5'));var fs=require('fs');var path=require(_0xc5d5('0x6'));var rimraf=require(_0xc5d5('0x7'));var config=require(_0xc5d5('0x8'));var attributes=require(_0xc5d5('0x9'));module[_0xc5d5('0xa')]=function(_0x548b23,_0x5cd1d7){return _0x548b23[_0xc5d5('0xb')](_0xc5d5('0xc'),attributes,{'tableName':_0xc5d5('0xd'),'paranoid':![],'indexes':[{'name':_0xc5d5('0xe'),'fields':[_0xc5d5('0xf'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f32=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','user_profile_has_resources','compositeIndex','resourceId','lodash','api'];(function(_0x23f211,_0x19fae5){var _0x428abf=function(_0x2bc256){while(--_0x2bc256){_0x23f211['push'](_0x23f211['shift']());}};_0x428abf(++_0x19fae5);}(_0x6f32,0x15a));var _0x26f3=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x6f32[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x26f3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x26f3('0x1'));var moment=require(_0x26f3('0x2'));var BPromise=require(_0x26f3('0x3'));var rp=require(_0x26f3('0x4'));var fs=require('fs');var path=require(_0x26f3('0x5'));var rimraf=require(_0x26f3('0x6'));var config=require(_0x26f3('0x7'));var attributes=require('./userProfileResource.attributes');module[_0x26f3('0x8')]=function(_0x442c63,_0x3aa2d9){return _0x442c63['define']('UserProfileResource',attributes,{'tableName':_0x26f3('0x9'),'paranoid':![],'indexes':[{'name':_0x26f3('0xa'),'fields':[_0x26f3('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 01cedb8..1c143dc 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 _0x6c37=['jayson/promise','client','http','request','then','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x16b667,_0xadec02){var _0x58620e=function(_0x5db60b){while(--_0x5db60b){_0x16b667['push'](_0x16b667['shift']());}};_0x58620e(++_0xadec02);}(_0x6c37,0x1c7));var _0x76c3=function(_0x3d61d7,_0x10ce18){_0x3d61d7=_0x3d61d7-0x0;var _0x3752b3=_0x6c37[_0x3d61d7];return _0x3752b3;};'use strict';var _=require('lodash');var util=require(_0x76c3('0x0'));var moment=require(_0x76c3('0x1'));var BPromise=require(_0x76c3('0x2'));var rs=require(_0x76c3('0x3'));var fs=require('fs');var Redis=require(_0x76c3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76c3('0x5'));var logger=require('../../config/logger')(_0x76c3('0x6'));var config=require('../../config/environment');var jayson=require(_0x76c3('0x7'));var client=jayson[_0x76c3('0x8')][_0x76c3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x446e5a,_0x4fca28,_0x2d69cf){return new BPromise(function(_0x1912ec,_0x4dcd96){return client[_0x76c3('0xa')](_0x446e5a,_0x2d69cf)[_0x76c3('0xb')](function(_0x3da146){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x4fca28,_0x76c3('0xc'));logger[_0x76c3('0xd')](_0x76c3('0xe'),_0x4fca28,_0x76c3('0xc'),JSON[_0x76c3('0xf')](_0x3da146));if(_0x3da146[_0x76c3('0x10')]){if(_0x3da146[_0x76c3('0x10')][_0x76c3('0x11')]===0x1f4){logger[_0x76c3('0x10')](_0x76c3('0x12'),_0x4fca28,_0x3da146[_0x76c3('0x10')][_0x76c3('0x13')]);return _0x4dcd96(_0x3da146[_0x76c3('0x10')][_0x76c3('0x13')]);}logger[_0x76c3('0x10')](_0x76c3('0x12'),_0x4fca28,_0x3da146[_0x76c3('0x10')][_0x76c3('0x13')]);return _0x1912ec(_0x3da146[_0x76c3('0x10')][_0x76c3('0x13')]);}else{logger['info'](_0x76c3('0x12'),_0x4fca28,_0x76c3('0xc'));_0x1912ec(_0x3da146['result'][_0x76c3('0x13')]);}})[_0x76c3('0x14')](function(_0x577ad7){logger[_0x76c3('0x10')](_0x76c3('0x12'),_0x4fca28,_0x577ad7);_0x4dcd96(_0x577ad7);});});} \ No newline at end of file +var _0x1def=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4ff8b9,_0x1631d4){var _0xdcd7e1=function(_0xb207fc){while(--_0xb207fc){_0x4ff8b9['push'](_0x4ff8b9['shift']());}};_0xdcd7e1(++_0x1631d4);}(_0x1def,0x15e));var _0xf1de=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x1def[_0x51fe5f];return _0x4abce9;};'use strict';var _=require('lodash');var util=require(_0xf1de('0x0'));var moment=require(_0xf1de('0x1'));var BPromise=require('bluebird');var rs=require(_0xf1de('0x2'));var fs=require('fs');var Redis=require(_0xf1de('0x3'));var db=require(_0xf1de('0x4'))['db'];var utils=require(_0xf1de('0x5'));var logger=require(_0xf1de('0x6'))(_0xf1de('0x7'));var config=require(_0xf1de('0x8'));var jayson=require(_0xf1de('0x9'));var client=jayson[_0xf1de('0xa')][_0xf1de('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1308e1,_0x51231b,_0x16ca3e){return new BPromise(function(_0x481e38,_0x150e49){return client[_0xf1de('0xc')](_0x1308e1,_0x16ca3e)[_0xf1de('0xd')](function(_0x3aee60){logger[_0xf1de('0xe')](_0xf1de('0xf'),_0x51231b,_0xf1de('0x10'));logger[_0xf1de('0x11')](_0xf1de('0x12'),_0x51231b,'request\x20sent',JSON[_0xf1de('0x13')](_0x3aee60));if(_0x3aee60[_0xf1de('0x14')]){if(_0x3aee60[_0xf1de('0x14')][_0xf1de('0x15')]===0x1f4){logger[_0xf1de('0x14')](_0xf1de('0xf'),_0x51231b,_0x3aee60[_0xf1de('0x14')][_0xf1de('0x16')]);return _0x150e49(_0x3aee60['error'][_0xf1de('0x16')]);}logger[_0xf1de('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x51231b,_0x3aee60[_0xf1de('0x14')][_0xf1de('0x16')]);return _0x481e38(_0x3aee60[_0xf1de('0x14')][_0xf1de('0x16')]);}else{logger[_0xf1de('0xe')](_0xf1de('0xf'),_0x51231b,_0xf1de('0x10'));_0x481e38(_0x3aee60[_0xf1de('0x17')][_0xf1de('0x16')]);}})[_0xf1de('0x18')](function(_0x482224){logger[_0xf1de('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x51231b,_0x482224);_0x150e49(_0x482224);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index db31247..c28e843 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 _0xf969=['describe','/:id','show','create','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe'];(function(_0x45cb89,_0x99520e){var _0x5948c1=function(_0x4c81c3){while(--_0x4c81c3){_0x45cb89['push'](_0x45cb89['shift']());}};_0x5948c1(++_0x99520e);}(_0xf969,0x1ce));var _0x9f96=function(_0x55ee8e,_0x3409c3){_0x55ee8e=_0x55ee8e-0x0;var _0x5acdae=_0xf969[_0x55ee8e];return _0x5acdae;};'use strict';var multer=require(_0x9f96('0x0'));var util=require(_0x9f96('0x1'));var path=require(_0x9f96('0x2'));var timeout=require(_0x9f96('0x3'));var express=require(_0x9f96('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9f96('0x5'));var interaction=require(_0x9f96('0x6'));var config=require(_0x9f96('0x7'));var controller=require(_0x9f96('0x8'));router['get']('/',auth[_0x9f96('0x9')](),controller[_0x9f96('0xa')]);router[_0x9f96('0xb')](_0x9f96('0xc'),auth[_0x9f96('0x9')](),controller[_0x9f96('0xd')]);router['get'](_0x9f96('0xe'),auth[_0x9f96('0x9')](),controller[_0x9f96('0xf')]);router['post']('/',auth[_0x9f96('0x9')](),controller[_0x9f96('0x10')]);router['put'](_0x9f96('0xe'),auth[_0x9f96('0x9')](),controller['update']);router[_0x9f96('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9f96('0x12')]=router; \ No newline at end of file +var _0x1aaf=['describe','/:id','show','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','index','/describe','isAuthenticated'];(function(_0x1fe140,_0x39a06a){var _0x3afa84=function(_0xe907b3){while(--_0xe907b3){_0x1fe140['push'](_0x1fe140['shift']());}};_0x3afa84(++_0x39a06a);}(_0x1aaf,0x138));var _0xf1aa=function(_0x12fdf4,_0x537462){_0x12fdf4=_0x12fdf4-0x0;var _0x3e8b88=_0x1aaf[_0x12fdf4];return _0x3e8b88;};'use strict';var multer=require('multer');var util=require(_0xf1aa('0x0'));var path=require(_0xf1aa('0x1'));var timeout=require(_0xf1aa('0x2'));var express=require('express');var router=express[_0xf1aa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf1aa('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf1aa('0x5'));var controller=require(_0xf1aa('0x6'));router[_0xf1aa('0x7')]('/',auth['isAuthenticated'](),controller[_0xf1aa('0x8')]);router[_0xf1aa('0x7')](_0xf1aa('0x9'),auth[_0xf1aa('0xa')](),controller[_0xf1aa('0xb')]);router[_0xf1aa('0x7')](_0xf1aa('0xc'),auth[_0xf1aa('0xa')](),controller[_0xf1aa('0xd')]);router['post']('/',auth[_0xf1aa('0xa')](),controller['create']);router[_0xf1aa('0xe')]('/:id',auth[_0xf1aa('0xa')](),controller[_0xf1aa('0xf')]);router[_0xf1aa('0x10')]('/:id',auth[_0xf1aa('0xa')](),controller[_0xf1aa('0x11')]);module[_0xf1aa('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 24d90f4..8a1b422 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 _0xb9a7=['getDataValue','split','exports','BOOLEAN','STRING','setDataValue','crudPermissions','join'];(function(_0x255542,_0x37855d){var _0x26cd52=function(_0x5427cb){while(--_0x5427cb){_0x255542['push'](_0x255542['shift']());}};_0x26cd52(++_0x37855d);}(_0xb9a7,0x112));var _0x7b9a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xb9a7[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require('sequelize');module[_0x7b9a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x7b9a('0x1')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x7b9a('0x2')],'set':function(_0x40ef7d){this[_0x7b9a('0x3')](_0x7b9a('0x4'),_0x40ef7d?_0x40ef7d[_0x7b9a('0x5')](''):[]);},'get':function(){return this[_0x7b9a('0x6')](_0x7b9a('0x4'))?this[_0x7b9a('0x6')](_0x7b9a('0x4'))[_0x7b9a('0x7')](''):[];}}}; \ No newline at end of file +var _0x9ffd=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0x139e7f,_0x45855a){var _0x271c5f=function(_0x56350e){while(--_0x56350e){_0x139e7f['push'](_0x139e7f['shift']());}};_0x271c5f(++_0x45855a);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x18896b,_0xb22a57){_0x18896b=_0x18896b-0x0;var _0x5a81d2=_0x9ffd[_0x18896b];return _0x5a81d2;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'name':{'type':Sequelize[_0xd9ff('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd9ff('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd9ff('0x2')],'set':function(_0x53e962){this[_0xd9ff('0x5')](_0xd9ff('0x6'),_0x53e962?_0x53e962['join'](''):[]);},'get':function(){return this[_0xd9ff('0x7')](_0xd9ff('0x6'))?this[_0xd9ff('0x7')](_0xd9ff('0x6'))[_0xd9ff('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 35f3ac7..2af6728 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 _0x4c46=['map','query','filters','intersection','attributes','order','sort','where','type','filter','merge','includeAll','findAll','rows','catch','show','params','keys','fields','length','include','options','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','key','model'];(function(_0x2f0417,_0xe2d1a2){var _0x233551=function(_0x254213){while(--_0x254213){_0x2f0417['push'](_0x2f0417['shift']());}};_0x233551(++_0xe2d1a2);}(_0x4c46,0x139));var _0x64c4=function(_0x50e9cc,_0x32a875){_0x50e9cc=_0x50e9cc-0x0;var _0x1e1175=_0x4c46[_0x50e9cc];return _0x1e1175;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x64c4('0x0'));var jsonpatch=require(_0x64c4('0x1'));var rp=require(_0x64c4('0x2'));var moment=require(_0x64c4('0x3'));var BPromise=require(_0x64c4('0x4'));var Mustache=require(_0x64c4('0x5'));var util=require('util');var path=require(_0x64c4('0x6'));var sox=require(_0x64c4('0x7'));var csv=require('to-csv');var ejs=require(_0x64c4('0x8'));var fs=require('fs');var fs_extra=require(_0x64c4('0x9'));var _=require(_0x64c4('0xa'));var squel=require('squel');var crypto=require(_0x64c4('0xb'));var jsforce=require(_0x64c4('0xc'));var deskjs=require(_0x64c4('0xd'));var toCsv=require('to-csv');var querystring=require(_0x64c4('0xe'));var Papa=require(_0x64c4('0xf'));var Redis=require(_0x64c4('0x10'));var authService=require(_0x64c4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64c4('0x12'));var logger=require(_0x64c4('0x13'))('api');var utils=require(_0x64c4('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x64c4('0x15'))['db'];function respondWithStatusCode(_0x3235a0,_0x1213ab){_0x1213ab=_0x1213ab||0xcc;return function(_0x332131){if(_0x332131){return _0x3235a0['sendStatus'](_0x1213ab);}return _0x3235a0[_0x64c4('0x16')](_0x1213ab)[_0x64c4('0x17')]();};}function respondWithResult(_0x14aae8,_0x20b793){_0x20b793=_0x20b793||0xc8;return function(_0x39adcb){if(_0x39adcb){return _0x14aae8[_0x64c4('0x16')](_0x20b793)[_0x64c4('0x18')](_0x39adcb);}};}function respondWithFilteredResult(_0x485cdc,_0x428d83){return function(_0x2b13dd){if(_0x2b13dd){var _0x491fa6=typeof _0x428d83[_0x64c4('0x19')]===_0x64c4('0x1a')&&typeof _0x428d83['limit']===_0x64c4('0x1a');var _0x5142c3=_0x2b13dd[_0x64c4('0x1b')];var _0x1f66e0=_0x491fa6?0x0:_0x428d83[_0x64c4('0x19')];var _0x39a4df=_0x491fa6?_0x2b13dd['count']:_0x428d83['offset']+_0x428d83[_0x64c4('0x1c')];var _0x3a16a4;if(_0x39a4df>=_0x5142c3){_0x39a4df=_0x5142c3;_0x3a16a4=0xc8;}else{_0x3a16a4=0xce;}_0x485cdc[_0x64c4('0x16')](_0x3a16a4);return _0x485cdc[_0x64c4('0x1d')](_0x64c4('0x1e'),_0x1f66e0+'-'+_0x39a4df+'/'+_0x5142c3)[_0x64c4('0x18')](_0x2b13dd);}return null;};}function patchUpdates(_0x26abca){return function(_0x5ac95f){try{jsonpatch[_0x64c4('0x1f')](_0x5ac95f,_0x26abca,!![]);}catch(_0x41aab8){return BPromise[_0x64c4('0x20')](_0x41aab8);}return _0x5ac95f['save']();};}function saveUpdates(_0x23b2ce,_0x2a59bc){return function(_0x49acb2){if(_0x49acb2){return _0x49acb2[_0x64c4('0x21')](_0x23b2ce)[_0x64c4('0x22')](function(_0x1f7ed4){return _0x1f7ed4;});}return null;};}function removeEntity(_0x34b5fd,_0x56303a){return function(_0x31c73c){if(_0x31c73c){return _0x31c73c[_0x64c4('0x23')]()[_0x64c4('0x22')](function(){_0x34b5fd['status'](0xcc)[_0x64c4('0x17')]();});}};}function handleEntityNotFound(_0x4587dc,_0x2e6717){return function(_0x26216b){if(!_0x26216b){_0x4587dc[_0x64c4('0x24')](0x194);}return _0x26216b;};}function handleError(_0x4bca01,_0x329a89){_0x329a89=_0x329a89||0x1f4;return function(_0x12e216){logger[_0x64c4('0x25')](_0x12e216[_0x64c4('0x26')]);if(_0x12e216[_0x64c4('0x27')]){delete _0x12e216[_0x64c4('0x27')];}_0x4bca01[_0x64c4('0x16')](_0x329a89)[_0x64c4('0x28')](_0x12e216);};}exports[_0x64c4('0x29')]=function(_0x5ae613,_0xd98640){var _0x34ccad={},_0x59314e={},_0x52bb50={'count':0x0,'rows':[]};var _0x7db89b=_['map'](db[_0x64c4('0x2a')][_0x64c4('0x2b')],function(_0x707a4a){return{'name':_0x707a4a[_0x64c4('0x2c')],'type':_0x707a4a['type'][_0x64c4('0x2d')]};});_0x59314e[_0x64c4('0x2e')]=_[_0x64c4('0x2f')](_0x7db89b,_0x64c4('0x27'));_0x59314e[_0x64c4('0x30')]=_['keys'](_0x5ae613[_0x64c4('0x30')]);_0x59314e[_0x64c4('0x31')]=_[_0x64c4('0x32')](_0x59314e[_0x64c4('0x2e')],_0x59314e[_0x64c4('0x30')]);_0x34ccad[_0x64c4('0x33')]=_[_0x64c4('0x32')](_0x59314e['model'],qs['fields'](_0x5ae613[_0x64c4('0x30')]['fields']));_0x34ccad[_0x64c4('0x33')]=_0x34ccad[_0x64c4('0x33')]['length']?_0x34ccad[_0x64c4('0x33')]:_0x59314e[_0x64c4('0x2e')];if(!_0x5ae613['query']['hasOwnProperty']('nolimit')){_0x34ccad['limit']=qs[_0x64c4('0x1c')](_0x5ae613[_0x64c4('0x30')][_0x64c4('0x1c')]);_0x34ccad[_0x64c4('0x19')]=qs[_0x64c4('0x19')](_0x5ae613[_0x64c4('0x30')]['offset']);}_0x34ccad[_0x64c4('0x34')]=qs[_0x64c4('0x35')](_0x5ae613[_0x64c4('0x30')]['sort']);_0x34ccad[_0x64c4('0x36')]=qs[_0x64c4('0x31')](_['pick'](_0x5ae613[_0x64c4('0x30')],_0x59314e[_0x64c4('0x31')]),_0x7db89b);if(_0x5ae613[_0x64c4('0x30')]['filter']){_0x34ccad[_0x64c4('0x36')]=_['merge'](_0x34ccad[_0x64c4('0x36')],{'$or':_[_0x64c4('0x2f')](_0x7db89b,function(_0x5ab5b0){if(_0x5ab5b0[_0x64c4('0x37')]!=='VIRTUAL'){var _0x52880b={};_0x52880b[_0x5ab5b0[_0x64c4('0x27')]]={'$like':'%'+_0x5ae613[_0x64c4('0x30')][_0x64c4('0x38')]+'%'};return _0x52880b;}})});}_0x34ccad=_[_0x64c4('0x39')]({},_0x34ccad,_0x5ae613['options']);var _0x2b8afb={'where':_0x34ccad['where']};return db['UserProfileSection'][_0x64c4('0x1b')](_0x2b8afb)[_0x64c4('0x22')](function(_0x628b8b){_0x52bb50[_0x64c4('0x1b')]=_0x628b8b;if(_0x5ae613[_0x64c4('0x30')][_0x64c4('0x3a')]){_0x34ccad['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x64c4('0x3b')](_0x34ccad);})[_0x64c4('0x22')](function(_0x98b986){_0x52bb50[_0x64c4('0x3c')]=_0x98b986;return _0x52bb50;})[_0x64c4('0x22')](respondWithFilteredResult(_0xd98640,_0x34ccad))[_0x64c4('0x3d')](handleError(_0xd98640,null));};exports[_0x64c4('0x3e')]=function(_0x33334c,_0x37f698){var _0x319556={'raw':![],'where':{'id':_0x33334c[_0x64c4('0x3f')]['id']}},_0x18831a={};_0x18831a[_0x64c4('0x2e')]=_[_0x64c4('0x40')](db[_0x64c4('0x2a')][_0x64c4('0x2b')]);_0x18831a[_0x64c4('0x30')]=_[_0x64c4('0x40')](_0x33334c['query']);_0x18831a[_0x64c4('0x31')]=_['intersection'](_0x18831a[_0x64c4('0x2e')],_0x18831a[_0x64c4('0x30')]);_0x319556[_0x64c4('0x33')]=_[_0x64c4('0x32')](_0x18831a[_0x64c4('0x2e')],qs[_0x64c4('0x41')](_0x33334c[_0x64c4('0x30')][_0x64c4('0x41')]));_0x319556[_0x64c4('0x33')]=_0x319556[_0x64c4('0x33')][_0x64c4('0x42')]?_0x319556[_0x64c4('0x33')]:_0x18831a[_0x64c4('0x2e')];if(_0x33334c[_0x64c4('0x30')][_0x64c4('0x3a')]){_0x319556[_0x64c4('0x43')]=[{'all':!![]}];}_0x319556=_[_0x64c4('0x39')]({},_0x319556,_0x33334c[_0x64c4('0x44')]);return db['UserProfileSection']['find'](_0x319556)[_0x64c4('0x22')](handleEntityNotFound(_0x37f698,null))[_0x64c4('0x22')](respondWithResult(_0x37f698,null))[_0x64c4('0x3d')](handleError(_0x37f698,null));};exports[_0x64c4('0x45')]=function(_0x4509fb,_0x5a1270){return db[_0x64c4('0x2a')][_0x64c4('0x45')](_0x4509fb[_0x64c4('0x46')],{})[_0x64c4('0x22')](respondWithResult(_0x5a1270,0xc9))[_0x64c4('0x3d')](handleError(_0x5a1270,null));};exports[_0x64c4('0x21')]=function(_0x2b15fb,_0x1ffcaf){if(_0x2b15fb[_0x64c4('0x46')]['id']){delete _0x2b15fb[_0x64c4('0x46')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x2b15fb['params']['id']}})[_0x64c4('0x22')](handleEntityNotFound(_0x1ffcaf,null))[_0x64c4('0x22')](saveUpdates(_0x2b15fb[_0x64c4('0x46')],null))[_0x64c4('0x22')](respondWithResult(_0x1ffcaf,null))[_0x64c4('0x3d')](handleError(_0x1ffcaf,null));};exports['destroy']=function(_0x59cbe9,_0x41f7f3){return db[_0x64c4('0x2a')]['find']({'where':{'id':_0x59cbe9[_0x64c4('0x3f')]['id']}})[_0x64c4('0x22')](handleEntityNotFound(_0x41f7f3,null))[_0x64c4('0x22')](removeEntity(_0x41f7f3,null))['catch'](handleError(_0x41f7f3,null));};exports[_0x64c4('0x47')]=function(_0x667edb,_0x1bdfed){return db[_0x64c4('0x2a')]['describe']()[_0x64c4('0x22')](respondWithResult(_0x1bdfed,null))[_0x64c4('0x3d')](handleError(_0x1bdfed,null));}; \ No newline at end of file +var _0xb6cb=['catch','show','params','rawAttributes','options','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','set','json','reject','save','update','then','stack','name','send','map','UserProfileSection','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','includeAll','include'];(function(_0x564608,_0x3dfdc7){var _0x197419=function(_0x29b71e){while(--_0x29b71e){_0x564608['push'](_0x564608['shift']());}};_0x197419(++_0x3dfdc7);}(_0xb6cb,0x1de));var _0xbb6c=function(_0x256cc1,_0x568424){_0x256cc1=_0x256cc1-0x0;var _0x330d0a=_0xb6cb[_0x256cc1];return _0x330d0a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb6c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb6c('0x1'));var rp=require(_0xbb6c('0x2'));var moment=require(_0xbb6c('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbb6c('0x4'));var path=require(_0xbb6c('0x5'));var sox=require(_0xbb6c('0x6'));var csv=require(_0xbb6c('0x7'));var ejs=require(_0xbb6c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb6c('0x9'));var squel=require(_0xbb6c('0xa'));var crypto=require(_0xbb6c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbb6c('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbb6c('0xd'));var Redis=require('ioredis');var authService=require(_0xbb6c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbb6c('0xf'));var hardwareService=require(_0xbb6c('0x10'));var logger=require('../../config/logger')(_0xbb6c('0x11'));var utils=require(_0xbb6c('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xbb6c('0x13'));var db=require(_0xbb6c('0x14'))['db'];function respondWithStatusCode(_0x1e24fb,_0x43c5fb){_0x43c5fb=_0x43c5fb||0xcc;return function(_0x5d9455){if(_0x5d9455){return _0x1e24fb[_0xbb6c('0x15')](_0x43c5fb);}return _0x1e24fb['status'](_0x43c5fb)[_0xbb6c('0x16')]();};}function respondWithResult(_0x51e667,_0x41ee74){_0x41ee74=_0x41ee74||0xc8;return function(_0x347316){if(_0x347316){return _0x51e667['status'](_0x41ee74)['json'](_0x347316);}};}function respondWithFilteredResult(_0x528c9c,_0x229899){return function(_0x37ce90){if(_0x37ce90){var _0xa1da9f=typeof _0x229899[_0xbb6c('0x17')]==='undefined'&&typeof _0x229899[_0xbb6c('0x18')]===_0xbb6c('0x19');var _0x3456f6=_0x37ce90[_0xbb6c('0x1a')];var _0x25395d=_0xa1da9f?0x0:_0x229899[_0xbb6c('0x17')];var _0x314210=_0xa1da9f?_0x37ce90[_0xbb6c('0x1a')]:_0x229899[_0xbb6c('0x17')]+_0x229899[_0xbb6c('0x18')];var _0x4c30e3;if(_0x314210>=_0x3456f6){_0x314210=_0x3456f6;_0x4c30e3=0xc8;}else{_0x4c30e3=0xce;}_0x528c9c[_0xbb6c('0x1b')](_0x4c30e3);return _0x528c9c[_0xbb6c('0x1c')]('Content-Range',_0x25395d+'-'+_0x314210+'/'+_0x3456f6)[_0xbb6c('0x1d')](_0x37ce90);}return null;};}function patchUpdates(_0x48ccca){return function(_0x2e88c7){try{jsonpatch['apply'](_0x2e88c7,_0x48ccca,!![]);}catch(_0x33dc99){return BPromise[_0xbb6c('0x1e')](_0x33dc99);}return _0x2e88c7[_0xbb6c('0x1f')]();};}function saveUpdates(_0x4b45ed,_0x3aa538){return function(_0x2a0536){if(_0x2a0536){return _0x2a0536[_0xbb6c('0x20')](_0x4b45ed)[_0xbb6c('0x21')](function(_0x1d298f){return _0x1d298f;});}return null;};}function removeEntity(_0x4de603,_0x9d2106){return function(_0x30c2e0){if(_0x30c2e0){return _0x30c2e0['destroy']()[_0xbb6c('0x21')](function(){_0x4de603[_0xbb6c('0x1b')](0xcc)[_0xbb6c('0x16')]();});}};}function handleEntityNotFound(_0x1afb13,_0x57db4a){return function(_0xa95384){if(!_0xa95384){_0x1afb13[_0xbb6c('0x15')](0x194);}return _0xa95384;};}function handleError(_0x3b9b25,_0x3ee350){_0x3ee350=_0x3ee350||0x1f4;return function(_0x537315){logger['error'](_0x537315[_0xbb6c('0x22')]);if(_0x537315[_0xbb6c('0x23')]){delete _0x537315[_0xbb6c('0x23')];}_0x3b9b25['status'](_0x3ee350)[_0xbb6c('0x24')](_0x537315);};}exports['index']=function(_0x4258da,_0x589e58){var _0x1cb7c9={},_0x3a5c5b={},_0x2769fa={'count':0x0,'rows':[]};var _0x2b9157=_[_0xbb6c('0x25')](db[_0xbb6c('0x26')]['rawAttributes'],function(_0x36bf2b){return{'name':_0x36bf2b[_0xbb6c('0x27')],'type':_0x36bf2b['type']['key']};});_0x3a5c5b['model']=_[_0xbb6c('0x25')](_0x2b9157,'name');_0x3a5c5b[_0xbb6c('0x28')]=_[_0xbb6c('0x29')](_0x4258da[_0xbb6c('0x28')]);_0x3a5c5b[_0xbb6c('0x2a')]=_[_0xbb6c('0x2b')](_0x3a5c5b[_0xbb6c('0x2c')],_0x3a5c5b[_0xbb6c('0x28')]);_0x1cb7c9[_0xbb6c('0x2d')]=_[_0xbb6c('0x2b')](_0x3a5c5b['model'],qs[_0xbb6c('0x2e')](_0x4258da['query'][_0xbb6c('0x2e')]));_0x1cb7c9['attributes']=_0x1cb7c9['attributes'][_0xbb6c('0x2f')]?_0x1cb7c9['attributes']:_0x3a5c5b['model'];if(!_0x4258da[_0xbb6c('0x28')][_0xbb6c('0x30')](_0xbb6c('0x31'))){_0x1cb7c9[_0xbb6c('0x18')]=qs[_0xbb6c('0x18')](_0x4258da[_0xbb6c('0x28')][_0xbb6c('0x18')]);_0x1cb7c9[_0xbb6c('0x17')]=qs[_0xbb6c('0x17')](_0x4258da[_0xbb6c('0x28')][_0xbb6c('0x17')]);}_0x1cb7c9[_0xbb6c('0x32')]=qs[_0xbb6c('0x33')](_0x4258da[_0xbb6c('0x28')]['sort']);_0x1cb7c9[_0xbb6c('0x34')]=qs[_0xbb6c('0x2a')](_['pick'](_0x4258da['query'],_0x3a5c5b[_0xbb6c('0x2a')]),_0x2b9157);if(_0x4258da['query'][_0xbb6c('0x35')]){_0x1cb7c9['where']=_['merge'](_0x1cb7c9[_0xbb6c('0x34')],{'$or':_[_0xbb6c('0x25')](_0x2b9157,function(_0x5c28e8){if(_0x5c28e8[_0xbb6c('0x36')]!=='VIRTUAL'){var _0x44dd0d={};_0x44dd0d[_0x5c28e8[_0xbb6c('0x23')]]={'$like':'%'+_0x4258da[_0xbb6c('0x28')][_0xbb6c('0x35')]+'%'};return _0x44dd0d;}})});}_0x1cb7c9=_[_0xbb6c('0x37')]({},_0x1cb7c9,_0x4258da['options']);var _0x35fb46={'where':_0x1cb7c9[_0xbb6c('0x34')]};return db[_0xbb6c('0x26')][_0xbb6c('0x1a')](_0x35fb46)[_0xbb6c('0x21')](function(_0x640b1d){_0x2769fa[_0xbb6c('0x1a')]=_0x640b1d;if(_0x4258da[_0xbb6c('0x28')][_0xbb6c('0x38')]){_0x1cb7c9[_0xbb6c('0x39')]=[{'all':!![]}];}return db[_0xbb6c('0x26')]['findAll'](_0x1cb7c9);})[_0xbb6c('0x21')](function(_0x45d999){_0x2769fa['rows']=_0x45d999;return _0x2769fa;})[_0xbb6c('0x21')](respondWithFilteredResult(_0x589e58,_0x1cb7c9))[_0xbb6c('0x3a')](handleError(_0x589e58,null));};exports[_0xbb6c('0x3b')]=function(_0x51731e,_0x10c120){var _0x107e89={'raw':![],'where':{'id':_0x51731e[_0xbb6c('0x3c')]['id']}},_0x436b2f={};_0x436b2f[_0xbb6c('0x2c')]=_['keys'](db['UserProfileSection'][_0xbb6c('0x3d')]);_0x436b2f[_0xbb6c('0x28')]=_[_0xbb6c('0x29')](_0x51731e[_0xbb6c('0x28')]);_0x436b2f[_0xbb6c('0x2a')]=_[_0xbb6c('0x2b')](_0x436b2f[_0xbb6c('0x2c')],_0x436b2f[_0xbb6c('0x28')]);_0x107e89[_0xbb6c('0x2d')]=_[_0xbb6c('0x2b')](_0x436b2f[_0xbb6c('0x2c')],qs['fields'](_0x51731e[_0xbb6c('0x28')][_0xbb6c('0x2e')]));_0x107e89['attributes']=_0x107e89[_0xbb6c('0x2d')][_0xbb6c('0x2f')]?_0x107e89[_0xbb6c('0x2d')]:_0x436b2f[_0xbb6c('0x2c')];if(_0x51731e[_0xbb6c('0x28')][_0xbb6c('0x38')]){_0x107e89[_0xbb6c('0x39')]=[{'all':!![]}];}_0x107e89=_[_0xbb6c('0x37')]({},_0x107e89,_0x51731e[_0xbb6c('0x3e')]);return db['UserProfileSection'][_0xbb6c('0x3f')](_0x107e89)[_0xbb6c('0x21')](handleEntityNotFound(_0x10c120,null))[_0xbb6c('0x21')](respondWithResult(_0x10c120,null))['catch'](handleError(_0x10c120,null));};exports[_0xbb6c('0x40')]=function(_0x56146a,_0x43d776){return db['UserProfileSection'][_0xbb6c('0x40')](_0x56146a[_0xbb6c('0x41')],{})[_0xbb6c('0x21')](respondWithResult(_0x43d776,0xc9))[_0xbb6c('0x3a')](handleError(_0x43d776,null));};exports[_0xbb6c('0x20')]=function(_0x2f4f04,_0x7dfb5){if(_0x2f4f04[_0xbb6c('0x41')]['id']){delete _0x2f4f04[_0xbb6c('0x41')]['id'];}return db[_0xbb6c('0x26')][_0xbb6c('0x3f')]({'where':{'id':_0x2f4f04[_0xbb6c('0x3c')]['id']}})[_0xbb6c('0x21')](handleEntityNotFound(_0x7dfb5,null))[_0xbb6c('0x21')](saveUpdates(_0x2f4f04[_0xbb6c('0x41')],null))['then'](respondWithResult(_0x7dfb5,null))[_0xbb6c('0x3a')](handleError(_0x7dfb5,null));};exports['destroy']=function(_0x491990,_0x3cd456){return db[_0xbb6c('0x26')][_0xbb6c('0x3f')]({'where':{'id':_0x491990['params']['id']}})[_0xbb6c('0x21')](handleEntityNotFound(_0x3cd456,null))[_0xbb6c('0x21')](removeEntity(_0x3cd456,null))['catch'](handleError(_0x3cd456,null));};exports[_0xbb6c('0x42')]=function(_0x501bd1,_0x55c7bd){return db[_0xbb6c('0x26')][_0xbb6c('0x42')]()[_0xbb6c('0x21')](respondWithResult(_0x55c7bd,null))[_0xbb6c('0x3a')](handleError(_0x55c7bd,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 6abe58e..ab78a16 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 _0xe9ef=['user_profile_has_sections','sectionId','userProfileId','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0xe9ef,0x16e));var _0xfe9e=function(_0xd1c39b,_0x16f0c6){_0xd1c39b=_0xd1c39b-0x0;var _0x58f5bc=_0xe9ef[_0xd1c39b];return _0x58f5bc;};'use strict';var _=require(_0xfe9e('0x0'));var util=require('util');var logger=require(_0xfe9e('0x1'))(_0xfe9e('0x2'));var moment=require('moment');var BPromise=require(_0xfe9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe9e('0x4'));var rimraf=require(_0xfe9e('0x5'));var config=require(_0xfe9e('0x6'));var attributes=require(_0xfe9e('0x7'));module['exports']=function(_0x448c5b,_0x929d6d){return _0x448c5b['define']('UserProfileSection',attributes,{'tableName':_0xfe9e('0x8'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xfe9e('0x9'),_0xfe9e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd65e=['userProfileId','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./userProfileSection.attributes','UserProfileSection','sectionId'];(function(_0x4d5448,_0x316bd2){var _0x4c8ed7=function(_0x384a95){while(--_0x384a95){_0x4d5448['push'](_0x4d5448['shift']());}};_0x4c8ed7(++_0x316bd2);}(_0xd65e,0x91));var _0xed65=function(_0x30b27b,_0x34036b){_0x30b27b=_0x30b27b-0x0;var _0x59fa11=_0xd65e[_0x30b27b];return _0x59fa11;};'use strict';var _=require(_0xed65('0x0'));var util=require(_0xed65('0x1'));var logger=require(_0xed65('0x2'))(_0xed65('0x3'));var moment=require(_0xed65('0x4'));var BPromise=require(_0xed65('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xed65('0x6'));var config=require(_0xed65('0x7'));var attributes=require(_0xed65('0x8'));module['exports']=function(_0x109571,_0x3dd68f){return _0x109571['define'](_0xed65('0x9'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xed65('0xa'),_0xed65('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index abb6f0f..b1b85fe 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 _0x2b5f=['../../config/environment','jayson/promise','client','http','request','info','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1580e6,_0x3a4705){var _0x21dd50=function(_0x29d839){while(--_0x29d839){_0x1580e6['push'](_0x1580e6['shift']());}};_0x21dd50(++_0x3a4705);}(_0x2b5f,0xe7));var _0xf2b5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2b5f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf2b5('0x0'));var util=require(_0xf2b5('0x1'));var moment=require('moment');var BPromise=require(_0xf2b5('0x2'));var rs=require(_0xf2b5('0x3'));var fs=require('fs');var Redis=require(_0xf2b5('0x4'));var db=require(_0xf2b5('0x5'))['db'];var utils=require(_0xf2b5('0x6'));var logger=require(_0xf2b5('0x7'))(_0xf2b5('0x8'));var config=require(_0xf2b5('0x9'));var jayson=require(_0xf2b5('0xa'));var client=jayson[_0xf2b5('0xb')][_0xf2b5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x533c1c,_0x4149c9,_0x4d6a58){return new BPromise(function(_0x4271de,_0x5ae349){return client[_0xf2b5('0xd')](_0x533c1c,_0x4d6a58)['then'](function(_0x3b0a88){logger[_0xf2b5('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x4149c9,'request\x20sent');logger[_0xf2b5('0xf')](_0xf2b5('0x10'),_0x4149c9,_0xf2b5('0x11'),JSON['stringify'](_0x3b0a88));if(_0x3b0a88[_0xf2b5('0x12')]){if(_0x3b0a88[_0xf2b5('0x12')][_0xf2b5('0x13')]===0x1f4){logger[_0xf2b5('0x12')](_0xf2b5('0x14'),_0x4149c9,_0x3b0a88[_0xf2b5('0x12')][_0xf2b5('0x15')]);return _0x5ae349(_0x3b0a88[_0xf2b5('0x12')][_0xf2b5('0x15')]);}logger[_0xf2b5('0x12')](_0xf2b5('0x14'),_0x4149c9,_0x3b0a88['error'][_0xf2b5('0x15')]);return _0x4271de(_0x3b0a88[_0xf2b5('0x12')][_0xf2b5('0x15')]);}else{logger[_0xf2b5('0xe')](_0xf2b5('0x14'),_0x4149c9,_0xf2b5('0x11'));_0x4271de(_0x3b0a88[_0xf2b5('0x16')]['message']);}})[_0xf2b5('0x17')](function(_0xe2cf02){logger[_0xf2b5('0x12')](_0xf2b5('0x14'),_0x4149c9,_0xe2cf02);_0x5ae349(_0xe2cf02);});});} \ No newline at end of file +var _0xc79b=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s'];(function(_0x10dc64,_0x11bb29){var _0x9cf98d=function(_0x558d71){while(--_0x558d71){_0x10dc64['push'](_0x10dc64['shift']());}};_0x9cf98d(++_0x11bb29);}(_0xc79b,0x1d1));var _0xbc79=function(_0x43ff08,_0x28e72b){_0x43ff08=_0x43ff08-0x0;var _0x444971=_0xc79b[_0x43ff08];return _0x444971;};'use strict';var _=require(_0xbc79('0x0'));var util=require('util');var moment=require(_0xbc79('0x1'));var BPromise=require(_0xbc79('0x2'));var rs=require(_0xbc79('0x3'));var fs=require('fs');var Redis=require(_0xbc79('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc79('0x5'));var logger=require(_0xbc79('0x6'))(_0xbc79('0x7'));var config=require('../../config/environment');var jayson=require(_0xbc79('0x8'));var client=jayson['client'][_0xbc79('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcda29b,_0x127f1d,_0x4af038){return new BPromise(function(_0x3abe25,_0x19489b){return client[_0xbc79('0xa')](_0xcda29b,_0x4af038)['then'](function(_0x53b09b){logger[_0xbc79('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x127f1d,_0xbc79('0xc'));logger[_0xbc79('0xd')](_0xbc79('0xe'),_0x127f1d,'request\x20sent',JSON[_0xbc79('0xf')](_0x53b09b));if(_0x53b09b[_0xbc79('0x10')]){if(_0x53b09b[_0xbc79('0x10')][_0xbc79('0x11')]===0x1f4){logger[_0xbc79('0x10')](_0xbc79('0x12'),_0x127f1d,_0x53b09b[_0xbc79('0x10')][_0xbc79('0x13')]);return _0x19489b(_0x53b09b[_0xbc79('0x10')][_0xbc79('0x13')]);}logger[_0xbc79('0x10')](_0xbc79('0x12'),_0x127f1d,_0x53b09b['error'][_0xbc79('0x13')]);return _0x3abe25(_0x53b09b['error'][_0xbc79('0x13')]);}else{logger['info'](_0xbc79('0x12'),_0x127f1d,_0xbc79('0xc'));_0x3abe25(_0x53b09b[_0xbc79('0x14')][_0xbc79('0x13')]);}})[_0xbc79('0x15')](function(_0x529ad0){logger[_0xbc79('0x10')](_0xbc79('0x12'),_0x127f1d,_0x529ad0);_0x19489b(_0x529ad0);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 4dfb9ba..530dbbb 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x22440d,_0x48aa1c){var _0x228672=function(_0x11ecda){while(--_0x11ecda){_0x22440d['push'](_0x22440d['shift']());}};_0x228672(++_0x48aa1c);}(_0xe706,0xa3));var _0x6e70=function(_0x358bf3,_0x40ec1f){_0x358bf3=_0x358bf3-0x0;var _0x248106=_0xe706[_0x358bf3];return _0x248106;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x31feaa,_0x2e975c){var _0x53bdce=function(_0x2d9d60){while(--_0x2d9d60){_0x31feaa['push'](_0x31feaa['shift']());}};_0x53bdce(++_0x2e975c);}(_0xedd9,0xfc));var _0x9edd=function(_0x122cdb,_0x296c7c){_0x122cdb=_0x122cdb-0x0;var _0x29c292=_0xedd9[_0x122cdb];return _0x29c292;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index b78001e..929be65 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 _0xf465=['exports','INTEGER','sequelize'];(function(_0x54fb05,_0x5437a0){var _0xf23796=function(_0x329fb5){while(--_0x329fb5){_0x54fb05['push'](_0x54fb05['shift']());}};_0xf23796(++_0x5437a0);}(_0xf465,0x8f));var _0x5f46=function(_0x364220,_0x34ce6a){_0x364220=_0x364220-0x0;var _0x4a6928=_0xf465[_0x364220];return _0x4a6928;};'use strict';var Sequelize=require(_0x5f46('0x0'));module[_0x5f46('0x1')]={'penalty':{'type':Sequelize[_0x5f46('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb2e9=['exports','INTEGER'];(function(_0x21ba22,_0x38908f){var _0x997b34=function(_0x5630f5){while(--_0x5630f5){_0x21ba22['push'](_0x21ba22['shift']());}};_0x997b34(++_0x38908f);}(_0xb2e9,0x1a2));var _0x9b2e=function(_0xaa817a,_0x2263f4){_0xaa817a=_0xaa817a-0x0;var _0xd40af8=_0xb2e9[_0xaa817a];return _0xd40af8;};'use strict';var Sequelize=require('sequelize');module[_0x9b2e('0x0')]={'penalty':{'type':Sequelize[_0x9b2e('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index e5d28e9..00c377d 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 _0xf072=['path','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','moment','request-promise'];(function(_0x2780d0,_0x5b94aa){var _0x81799d=function(_0x23b12f){while(--_0x23b12f){_0x2780d0['push'](_0x2780d0['shift']());}};_0x81799d(++_0x5b94aa);}(_0xf072,0x1cf));var _0x2f07=function(_0x375712,_0x5f0d34){_0x375712=_0x375712-0x0;var _0x13ab42=_0xf072[_0x375712];return _0x13ab42;};'use strict';var _=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var logger=require(_0x2f07('0x2'))('api');var moment=require(_0x2f07('0x3'));var BPromise=require('bluebird');var rp=require(_0x2f07('0x4'));var fs=require('fs');var path=require(_0x2f07('0x5'));var rimraf=require(_0x2f07('0x6'));var config=require('../../config/environment');var attributes=require(_0x2f07('0x7'));module[_0x2f07('0x8')]=function(_0x3643bb,_0x2e6422){return _0x3643bb[_0x2f07('0x9')](_0x2f07('0xa'),attributes,{'tableName':_0x2f07('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4317=['./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3e3dc7,_0x4fd37b){var _0x27b565=function(_0xa886f5){while(--_0xa886f5){_0x3e3dc7['push'](_0x3e3dc7['shift']());}};_0x27b565(++_0x4fd37b);}(_0x4317,0x7c));var _0x7431=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4317[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x7431('0x0'));var logger=require(_0x7431('0x1'))(_0x7431('0x2'));var moment=require('moment');var BPromise=require(_0x7431('0x3'));var rp=require(_0x7431('0x4'));var fs=require('fs');var path=require(_0x7431('0x5'));var rimraf=require(_0x7431('0x6'));var config=require(_0x7431('0x7'));var attributes=require(_0x7431('0x8'));module['exports']=function(_0x57adc1,_0x1e1f35){return _0x57adc1[_0x7431('0x9')](_0x7431('0xa'),attributes,{'tableName':_0x7431('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 80123d1..dac4f83 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 _0xd0a2=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x1a3a4c,_0x50e07b){var _0x8054c0=function(_0x504e18){while(--_0x504e18){_0x1a3a4c['push'](_0x1a3a4c['shift']());}};_0x8054c0(++_0x50e07b);}(_0xd0a2,0x10d));var _0x2d0a=function(_0x3df935,_0x2f6877){_0x3df935=_0x3df935-0x0;var _0x152412=_0xd0a2[_0x3df935];return _0x152412;};'use strict';var _=require(_0x2d0a('0x0'));var util=require('util');var moment=require(_0x2d0a('0x1'));var BPromise=require(_0x2d0a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d0a('0x3'));var db=require(_0x2d0a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2d0a('0x5'));var jayson=require(_0x2d0a('0x6'));var client=jayson[_0x2d0a('0x7')][_0x2d0a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e0a28,_0xa8f44,_0x426a01){return new BPromise(function(_0x178c87,_0x1cccdc){return client['request'](_0x2e0a28,_0x426a01)[_0x2d0a('0x9')](function(_0x967cc1){logger[_0x2d0a('0xa')](_0x2d0a('0xb'),_0xa8f44,_0x2d0a('0xc'));logger[_0x2d0a('0xd')](_0x2d0a('0xe'),_0xa8f44,_0x2d0a('0xc'),JSON[_0x2d0a('0xf')](_0x967cc1));if(_0x967cc1[_0x2d0a('0x10')]){if(_0x967cc1[_0x2d0a('0x10')][_0x2d0a('0x11')]===0x1f4){logger[_0x2d0a('0x10')](_0x2d0a('0xb'),_0xa8f44,_0x967cc1['error'][_0x2d0a('0x12')]);return _0x1cccdc(_0x967cc1[_0x2d0a('0x10')][_0x2d0a('0x12')]);}logger[_0x2d0a('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0xa8f44,_0x967cc1[_0x2d0a('0x10')][_0x2d0a('0x12')]);return _0x178c87(_0x967cc1['error']['message']);}else{logger[_0x2d0a('0xa')](_0x2d0a('0xb'),_0xa8f44,_0x2d0a('0xc'));_0x178c87(_0x967cc1['result'][_0x2d0a('0x12')]);}})[_0x2d0a('0x13')](function(_0xae81aa){logger[_0x2d0a('0x10')](_0x2d0a('0xb'),_0xa8f44,_0xae81aa);_0x1cccdc(_0xae81aa);});});} \ No newline at end of file +var _0x23bf=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment'];(function(_0x105d93,_0x1e3730){var _0x2743c3=function(_0x3bc972){while(--_0x3bc972){_0x105d93['push'](_0x105d93['shift']());}};_0x2743c3(++_0x1e3730);}(_0x23bf,0x18d));var _0xf23b=function(_0x3677ae,_0x2984a2){_0x3677ae=_0x3677ae-0x0;var _0x3d25bb=_0x23bf[_0x3677ae];return _0x3d25bb;};'use strict';var _=require('lodash');var util=require(_0xf23b('0x0'));var moment=require(_0xf23b('0x1'));var BPromise=require(_0xf23b('0x2'));var rs=require(_0xf23b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf23b('0x4'))['db'];var utils=require(_0xf23b('0x5'));var logger=require(_0xf23b('0x6'))(_0xf23b('0x7'));var config=require('../../config/environment');var jayson=require(_0xf23b('0x8'));var client=jayson[_0xf23b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x445c9b,_0x2c4231,_0x15e398){return new BPromise(function(_0x110773,_0x5a3ab5){return client[_0xf23b('0xa')](_0x445c9b,_0x15e398)[_0xf23b('0xb')](function(_0x18d6d1){logger[_0xf23b('0xc')](_0xf23b('0xd'),_0x2c4231,_0xf23b('0xe'));logger['debug'](_0xf23b('0xf'),_0x2c4231,'request\x20sent',JSON[_0xf23b('0x10')](_0x18d6d1));if(_0x18d6d1['error']){if(_0x18d6d1[_0xf23b('0x11')]['code']===0x1f4){logger['error'](_0xf23b('0xd'),_0x2c4231,_0x18d6d1[_0xf23b('0x11')][_0xf23b('0x12')]);return _0x5a3ab5(_0x18d6d1[_0xf23b('0x11')]['message']);}logger['error'](_0xf23b('0xd'),_0x2c4231,_0x18d6d1['error'][_0xf23b('0x12')]);return _0x110773(_0x18d6d1['error'][_0xf23b('0x12')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x2c4231,_0xf23b('0xe'));_0x110773(_0x18d6d1[_0xf23b('0x13')][_0xf23b('0x12')]);}})[_0xf23b('0x14')](function(_0x2c2f2c){logger[_0xf23b('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x2c4231,_0x2c2f2c);_0x5a3ab5(_0x2c2f2c);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 5b93a1c..33b3d8f 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 _0xe974=['exports','INTEGER','sequelize'];(function(_0x18fde9,_0x12c174){var _0x3e30a4=function(_0x5db863){while(--_0x5db863){_0x18fde9['push'](_0x18fde9['shift']());}};_0x3e30a4(++_0x12c174);}(_0xe974,0x86));var _0x4e97=function(_0x1c3370,_0xf617e8){_0x1c3370=_0x1c3370-0x0;var _0xa9b358=_0xe974[_0x1c3370];return _0xa9b358;};'use strict';var Sequelize=require(_0x4e97('0x0'));module[_0x4e97('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x4e97('0x2')]}}; \ No newline at end of file +var _0x83fd=['sequelize','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x83fd,0xae));var _0xd83f=function(_0xfea915,_0x59e24b){_0xfea915=_0xfea915-0x0;var _0x254ddf=_0x83fd[_0xfea915];return _0x254ddf;};'use strict';var Sequelize=require(_0xd83f('0x0'));module['exports']={'UserId':{'type':Sequelize[_0xd83f('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xd83f('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 4a6cf37..6b04ab4 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(_0x23d5be,_0x20f8a6){var _0xa7959d=function(_0x2107a1){while(--_0x2107a1){_0x23d5be['push'](_0x23d5be['shift']());}};_0xa7959d(++_0x20f8a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x20de17,_0x39b0c0){var _0x489f34=function(_0x361eb1){while(--_0x361eb1){_0x20de17['push'](_0x20de17['shift']());}};_0x489f34(++_0x39b0c0);}(_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 fa10a55..77c6a1a 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2c1841,_0x505204){var _0x28d148=function(_0x5be79f){while(--_0x5be79f){_0x2c1841['push'](_0x2c1841['shift']());}};_0x28d148(++_0x505204);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x519c98,_0x22e47c){var _0x3b9a8e=function(_0x45bc5c){while(--_0x45bc5c){_0x519c98['push'](_0x519c98['shift']());}};_0x3b9a8e(++_0x22e47c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ef8f1,_0x1280a3){_0x2ef8f1=_0x2ef8f1-0x0;var _0x17498d=_0xcb91[_0x2ef8f1];return _0x17498d;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 7318ea8..19bca13 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 _0x79fc=['sequelize','exports','INTEGER'];(function(_0x4bb691,_0x37679a){var _0x588b53=function(_0x2c802d){while(--_0x2c802d){_0x4bb691['push'](_0x4bb691['shift']());}};_0x588b53(++_0x37679a);}(_0x79fc,0x1ad));var _0xc79f=function(_0x33a1c1,_0x28b6b3){_0x33a1c1=_0x33a1c1-0x0;var _0x34fbc6=_0x79fc[_0x33a1c1];return _0x34fbc6;};'use strict';var Sequelize=require(_0xc79f('0x0'));module[_0xc79f('0x1')]={'penalty':{'type':Sequelize[_0xc79f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1d53=['INTEGER','sequelize'];(function(_0x5a70d3,_0x21f1a5){var _0xdd91cd=function(_0x4d8dd9){while(--_0x4d8dd9){_0x5a70d3['push'](_0x5a70d3['shift']());}};_0xdd91cd(++_0x21f1a5);}(_0x1d53,0x123));var _0x31d5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1d53[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x31d5('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x31d5('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 3b2a400..acd5522 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 _0x4e91=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','api'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x4e91,0x17e));var _0x14e9=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0x4e91[_0x5e4563];return _0x8d1bf5;};'use strict';var _=require(_0x14e9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x14e9('0x1'));var moment=require(_0x14e9('0x2'));var BPromise=require(_0x14e9('0x3'));var rp=require(_0x14e9('0x4'));var fs=require('fs');var path=require(_0x14e9('0x5'));var rimraf=require(_0x14e9('0x6'));var config=require(_0x14e9('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0x14e9('0x8')]=function(_0x13acec,_0x264d3e){return _0x13acec[_0x14e9('0x9')](_0x14e9('0xa'),attributes,{'tableName':_0x14e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c1a=['api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','../../config/logger'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0c1a,0x15b));var _0xa0c1=function(_0x320d86,_0x23afb1){_0x320d86=_0x320d86-0x0;var _0x1b9f83=_0x0c1a[_0x320d86];return _0x1b9f83;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa0c1('0x0'))(_0xa0c1('0x1'));var moment=require(_0xa0c1('0x2'));var BPromise=require('bluebird');var rp=require(_0xa0c1('0x3'));var fs=require('fs');var path=require(_0xa0c1('0x4'));var rimraf=require(_0xa0c1('0x5'));var config=require(_0xa0c1('0x6'));var attributes=require(_0xa0c1('0x7'));module[_0xa0c1('0x8')]=function(_0x2cb2db,_0x2bd519){return _0x2cb2db[_0xa0c1('0x9')](_0xa0c1('0xa'),attributes,{'tableName':_0xa0c1('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 7d159ce..0ca084d 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 _0x9701=['../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x1de138,_0x3145f5){var _0x1f69c5=function(_0x3c3a13){while(--_0x3c3a13){_0x1de138['push'](_0x1de138['shift']());}};_0x1f69c5(++_0x3145f5);}(_0x9701,0x19a));var _0x1970=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9701[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x1970('0x0'));var util=require(_0x1970('0x1'));var moment=require(_0x1970('0x2'));var BPromise=require(_0x1970('0x3'));var rs=require(_0x1970('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1970('0x5'))['db'];var utils=require(_0x1970('0x6'));var logger=require('../../config/logger')(_0x1970('0x7'));var config=require(_0x1970('0x8'));var jayson=require(_0x1970('0x9'));var client=jayson[_0x1970('0xa')][_0x1970('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53d8ab,_0x2e4be8,_0x234dcb){return new BPromise(function(_0x3c9cf3,_0x1b003a){return client[_0x1970('0xc')](_0x53d8ab,_0x234dcb)[_0x1970('0xd')](function(_0x88e901){logger[_0x1970('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x2e4be8,'request\x20sent');logger[_0x1970('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2e4be8,_0x1970('0x10'),JSON['stringify'](_0x88e901));if(_0x88e901[_0x1970('0x11')]){if(_0x88e901[_0x1970('0x11')]['code']===0x1f4){logger[_0x1970('0x11')](_0x1970('0x12'),_0x2e4be8,_0x88e901['error'][_0x1970('0x13')]);return _0x1b003a(_0x88e901[_0x1970('0x11')][_0x1970('0x13')]);}logger['error'](_0x1970('0x12'),_0x2e4be8,_0x88e901[_0x1970('0x11')][_0x1970('0x13')]);return _0x3c9cf3(_0x88e901[_0x1970('0x11')][_0x1970('0x13')]);}else{logger[_0x1970('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x2e4be8,_0x1970('0x10'));_0x3c9cf3(_0x88e901[_0x1970('0x14')][_0x1970('0x13')]);}})[_0x1970('0x15')](function(_0x4290ec){logger[_0x1970('0x11')](_0x1970('0x12'),_0x2e4be8,_0x4290ec);_0x1b003a(_0x4290ec);});});} \ No newline at end of file +var _0x6855=['code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x1a8913,_0x506f3a){var _0x3d084e=function(_0x4a1c3){while(--_0x4a1c3){_0x1a8913['push'](_0x1a8913['shift']());}};_0x3d084e(++_0x506f3a);}(_0x6855,0x100));var _0x5685=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x6855[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x5685('0x0'));var util=require('util');var moment=require(_0x5685('0x1'));var BPromise=require('bluebird');var rs=require(_0x5685('0x2'));var fs=require('fs');var Redis=require(_0x5685('0x3'));var db=require(_0x5685('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5685('0x5'))(_0x5685('0x6'));var config=require('../../config/environment');var jayson=require(_0x5685('0x7'));var client=jayson[_0x5685('0x8')][_0x5685('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbd7c1e,_0x417b58,_0x466be5){return new BPromise(function(_0x459114,_0x505e76){return client['request'](_0xbd7c1e,_0x466be5)[_0x5685('0xa')](function(_0x4951aa){logger[_0x5685('0xb')](_0x5685('0xc'),_0x417b58,'request\x20sent');logger[_0x5685('0xd')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x417b58,_0x5685('0xe'),JSON[_0x5685('0xf')](_0x4951aa));if(_0x4951aa['error']){if(_0x4951aa[_0x5685('0x10')][_0x5685('0x11')]===0x1f4){logger[_0x5685('0x10')](_0x5685('0xc'),_0x417b58,_0x4951aa['error']['message']);return _0x505e76(_0x4951aa[_0x5685('0x10')][_0x5685('0x12')]);}logger[_0x5685('0x10')](_0x5685('0xc'),_0x417b58,_0x4951aa[_0x5685('0x10')][_0x5685('0x12')]);return _0x459114(_0x4951aa['error']['message']);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x417b58,'request\x20sent');_0x459114(_0x4951aa[_0x5685('0x13')][_0x5685('0x12')]);}})[_0x5685('0x14')](function(_0x4088f3){logger['error'](_0x5685('0xc'),_0x417b58,_0x4088f3);_0x505e76(_0x4088f3);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index f9e9b09..9c8e9f9 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5e6b40,_0x24d85a){var _0x4b1640=function(_0x2bc553){while(--_0x2bc553){_0x5e6b40['push'](_0x5e6b40['shift']());}};_0x4b1640(++_0x24d85a);}(_0x70e0,0x17b));var _0x070e=function(_0x53aa20,_0x2aaf6a){_0x53aa20=_0x53aa20-0x0;var _0x5c83d5=_0x70e0[_0x53aa20];return _0x5c83d5;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5000e5,_0x1a2ed9){var _0x496c30=function(_0x789477){while(--_0x789477){_0x5000e5['push'](_0x5000e5['shift']());}};_0x496c30(++_0x1a2ed9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 409d7b6..160559b 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 _0x2aaa=['STRING','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x324f55,_0x2e6ca4){var _0x284952=function(_0x36ceae){while(--_0x36ceae){_0x324f55['push'](_0x324f55['shift']());}};_0x284952(++_0x2e6ca4);}(_0x2aaa,0x185));var _0xa2aa=function(_0x4f6203,_0x11eccd){_0x4f6203=_0x4f6203-0x0;var _0xde4e17=_0x2aaa[_0x4f6203];return _0xde4e17;};'use strict';var Sequelize=require('sequelize');module[_0xa2aa('0x0')]={'uniqueid':{'type':Sequelize[_0xa2aa('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xa2aa('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xa2aa('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xa2aa('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xa2aa('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xa2aa('0x3')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xa2aa('0x1')](0xb),'defaultValue':0x0,'comment':_0xa2aa('0x2')},'paused':{'type':Sequelize[_0xa2aa('0x1')](0xb),'defaultValue':0x0,'comment':_0xa2aa('0x2')}}; \ No newline at end of file +var _0xcf58=['queue_interface','sequelize','exports','Required\x20by\x20Asterisk','STRING','INTEGER'];(function(_0x37c769,_0x2fb02f){var _0x2f5a22=function(_0x21d190){while(--_0x21d190){_0x37c769['push'](_0x37c769['shift']());}};_0x2f5a22(++_0x2fb02f);}(_0xcf58,0x193));var _0x8cf5=function(_0x44bf88,_0x478b6e){_0x44bf88=_0x44bf88-0x0;var _0xe552a8=_0xcf58[_0x44bf88];return _0xe552a8;};'use strict';var Sequelize=require(_0x8cf5('0x0'));module[_0x8cf5('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8cf5('0x2')},'membername':{'type':Sequelize[_0x8cf5('0x3')],'allowNull':![],'comment':_0x8cf5('0x2')},'UserId':{'type':Sequelize[_0x8cf5('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8cf5('0x3')],'allowNull':![],'unique':_0x8cf5('0x5'),'comment':_0x8cf5('0x2')},'VoiceQueueId':{'type':Sequelize[_0x8cf5('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0x8cf5('0x3')],'allowNull':![],'unique':_0x8cf5('0x5'),'comment':_0x8cf5('0x2')},'penalty':{'type':Sequelize[_0x8cf5('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x8cf5('0x4')](0xb),'defaultValue':0x0,'comment':_0x8cf5('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 03f26bb..aef1eee 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 _0xd9f9=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x1b6d05,_0x54e014){var _0x441ec2=function(_0x3178a1){while(--_0x3178a1){_0x1b6d05['push'](_0x1b6d05['shift']());}};_0x441ec2(++_0x54e014);}(_0xd9f9,0x10f));var _0x9d9f=function(_0x58d3e4,_0x592460){_0x58d3e4=_0x58d3e4-0x0;var _0x4e68dc=_0xd9f9[_0x58d3e4];return _0x4e68dc;};'use strict';var EventEmitter=require(_0x9d9f('0x0'));var UserVoiceQueueRt=require(_0x9d9f('0x1'))['db'][_0x9d9f('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9d9f('0x3')](0x0);var events={'afterCreate':_0x9d9f('0x4'),'afterUpdate':_0x9d9f('0x5'),'afterDestroy':_0x9d9f('0x6')};function emitEvent(_0x41d1fd){return function(_0x2404e9,_0x69cc42,_0x1c4946){UserVoiceQueueRtEvents[_0x9d9f('0x7')](_0x41d1fd+':'+_0x2404e9['id'],_0x2404e9);UserVoiceQueueRtEvents[_0x9d9f('0x7')](_0x41d1fd,_0x2404e9);_0x1c4946(null);};}for(var e in events){if(events[_0x9d9f('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x9d9f('0x9')](e,emitEvent(event));}}module[_0x9d9f('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x1597=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','UserVoiceQueueRt'];(function(_0x471e8a,_0x35e1cc){var _0x37f362=function(_0x3c9207){while(--_0x3c9207){_0x471e8a['push'](_0x471e8a['shift']());}};_0x37f362(++_0x35e1cc);}(_0x1597,0x16e));var _0x7159=function(_0x217c2e,_0x358f06){_0x217c2e=_0x217c2e-0x0;var _0x22b7d8=_0x1597[_0x217c2e];return _0x22b7d8;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x7159('0x0'))['db'][_0x7159('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7159('0x2'),'afterUpdate':_0x7159('0x3'),'afterDestroy':_0x7159('0x4')};function emitEvent(_0x19a554){return function(_0x2bf7f0,_0x3777e9,_0xcd1d){UserVoiceQueueRtEvents[_0x7159('0x5')](_0x19a554+':'+_0x2bf7f0['id'],_0x2bf7f0);UserVoiceQueueRtEvents[_0x7159('0x5')](_0x19a554,_0x2bf7f0);_0xcd1d(null);};}for(var e in events){if(events[_0x7159('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x7159('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 20045d1..74d3a2f 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 _0xc703=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x43f748,_0x2afb5f){var _0x2b6349=function(_0x26c642){while(--_0x26c642){_0x43f748['push'](_0x43f748['shift']());}};_0x2b6349(++_0x2afb5f);}(_0xc703,0x1ce));var _0x3c70=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0xc703[_0x5a5395];return _0x4da43d;};'use strict';var _=require(_0x3c70('0x0'));var util=require(_0x3c70('0x1'));var logger=require(_0x3c70('0x2'))(_0x3c70('0x3'));var moment=require(_0x3c70('0x4'));var BPromise=require(_0x3c70('0x5'));var rp=require(_0x3c70('0x6'));var fs=require('fs');var path=require(_0x3c70('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x1381aa,_0x242e47){return _0x1381aa[_0x3c70('0x8')](_0x3c70('0x9'),attributes,{'tableName':_0x3c70('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x600a=['request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','util','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x600a,0xce));var _0xa600=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0x600a[_0x10dbf6];return _0x452147;};'use strict';var _=require('lodash');var util=require(_0xa600('0x0'));var logger=require('../../config/logger')(_0xa600('0x1'));var moment=require(_0xa600('0x2'));var BPromise=require(_0xa600('0x3'));var rp=require(_0xa600('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa600('0x5'));var config=require(_0xa600('0x6'));var attributes=require(_0xa600('0x7'));module[_0xa600('0x8')]=function(_0x420b64,_0x4f3abe){return _0x420b64[_0xa600('0x9')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index fc448fe..9432c41 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 _0xbb44=['defaults','redis','localhost','./userVoiceQueueRt.socket','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','UserVoiceQueueRt,\x20%s,\x20%s','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','raw','options','where','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x41eee0,_0x312b31){var _0x25387b=function(_0x114ffd){while(--_0x114ffd){_0x41eee0['push'](_0x41eee0['shift']());}};_0x25387b(++_0x312b31);}(_0xbb44,0x123));var _0x4bb4=function(_0x1eed2f,_0x444824){_0x1eed2f=_0x1eed2f-0x0;var _0x337856=_0xbb44[_0x1eed2f];return _0x337856;};'use strict';var _=require(_0x4bb4('0x0'));var util=require(_0x4bb4('0x1'));var moment=require(_0x4bb4('0x2'));var BPromise=require(_0x4bb4('0x3'));var rs=require(_0x4bb4('0x4'));var fs=require('fs');var Redis=require(_0x4bb4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4bb4('0x6'));var logger=require(_0x4bb4('0x7'))(_0x4bb4('0x8'));var config=require(_0x4bb4('0x9'));var jayson=require(_0x4bb4('0xa'));var client=jayson[_0x4bb4('0xb')][_0x4bb4('0xc')]({'port':0x232a});config['redis']=_[_0x4bb4('0xd')](config[_0x4bb4('0xe')],{'host':_0x4bb4('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4bb4('0xe')]));require(_0x4bb4('0x10'))['register'](socket);function respondWithRpcPromise(_0x2b05ad,_0x4cc1c0,_0x71b828){return new BPromise(function(_0x4b2290,_0x19c3d4){return client[_0x4bb4('0x11')](_0x2b05ad,_0x71b828)[_0x4bb4('0x12')](function(_0x4b346e){logger[_0x4bb4('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4cc1c0,_0x4bb4('0x14'));logger[_0x4bb4('0x15')](_0x4bb4('0x16'),_0x4cc1c0,_0x4bb4('0x14'),JSON[_0x4bb4('0x17')](_0x4b346e));if(_0x4b346e[_0x4bb4('0x18')]){if(_0x4b346e['error']['code']===0x1f4){logger[_0x4bb4('0x18')](_0x4bb4('0x19'),_0x4cc1c0,_0x4b346e[_0x4bb4('0x18')]['message']);return _0x19c3d4(_0x4b346e[_0x4bb4('0x18')][_0x4bb4('0x1a')]);}logger[_0x4bb4('0x18')](_0x4bb4('0x19'),_0x4cc1c0,_0x4b346e[_0x4bb4('0x18')][_0x4bb4('0x1a')]);return _0x4b2290(_0x4b346e[_0x4bb4('0x18')]['message']);}else{logger[_0x4bb4('0x13')](_0x4bb4('0x19'),_0x4cc1c0,'request\x20sent');_0x4b2290(_0x4b346e['result'][_0x4bb4('0x1a')]);}})[_0x4bb4('0x1b')](function(_0x3d4522){logger[_0x4bb4('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4cc1c0,_0x3d4522);_0x19c3d4(_0x3d4522);});});}exports[_0x4bb4('0x1c')]=function(_0x36217d){var _0x1c69f9=this;return new Promise(function(_0x331d21,_0x21f177){return db[_0x4bb4('0x1d')][_0x4bb4('0x1e')]({'raw':_0x36217d['options']?_0x36217d['options'][_0x4bb4('0x1f')]===undefined?!![]:![]:!![],'where':_0x36217d[_0x4bb4('0x20')]?_0x36217d[_0x4bb4('0x20')][_0x4bb4('0x21')]||null:null,'attributes':[[db['sequelize']['fn'](_0x4bb4('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0x4bb4('0x23')](_0x4bb4('0x24')))),_0x4bb4('0x25')]]})[_0x4bb4('0x12')](function(_0x479671){logger[_0x4bb4('0x13')](_0x4bb4('0x1c'),_0x36217d);logger[_0x4bb4('0x15')]('GetVoiceQueueRtPauses',_0x36217d,JSON[_0x4bb4('0x17')](_0x479671));_0x331d21(_0x479671);})['catch'](function(_0x39f22c){logger[_0x4bb4('0x18')](_0x4bb4('0x1c'),_0x39f22c['message'],_0x36217d);_0x21f177(_0x1c69f9[_0x4bb4('0x18')](0x1f4,_0x39f22c[_0x4bb4('0x1a')]));});});}; \ No newline at end of file +var _0x8eec=['literal','`paused`\x20=\x201,\x201,\x20null','then','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','catch','findAll','options','raw','where','COUNT','sequelize'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x8eec,0x124));var _0xc8ee=function(_0x3d7b5e,_0x5a5b35){_0x3d7b5e=_0x3d7b5e-0x0;var _0x456ad9=_0x8eec[_0x3d7b5e];return _0x456ad9;};'use strict';var _=require(_0xc8ee('0x0'));var util=require(_0xc8ee('0x1'));var moment=require(_0xc8ee('0x2'));var BPromise=require(_0xc8ee('0x3'));var rs=require(_0xc8ee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8ee('0x5'))['db'];var utils=require(_0xc8ee('0x6'));var logger=require(_0xc8ee('0x7'))(_0xc8ee('0x8'));var config=require(_0xc8ee('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc8ee('0xa')][_0xc8ee('0xb')]({'port':0x232a});config[_0xc8ee('0xc')]=_['defaults'](config[_0xc8ee('0xc')],{'host':_0xc8ee('0xd'),'port':0x18eb});var socket=require(_0xc8ee('0xe'))(new Redis(config[_0xc8ee('0xc')]));require('./userVoiceQueueRt.socket')[_0xc8ee('0xf')](socket);function respondWithRpcPromise(_0x30d60d,_0x42cd5c,_0x387ef0){return new BPromise(function(_0x3fa068,_0x414878){return client['request'](_0x30d60d,_0x387ef0)['then'](function(_0x2a5500){logger[_0xc8ee('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x42cd5c,_0xc8ee('0x11'));logger[_0xc8ee('0x12')](_0xc8ee('0x13'),_0x42cd5c,_0xc8ee('0x11'),JSON[_0xc8ee('0x14')](_0x2a5500));if(_0x2a5500[_0xc8ee('0x15')]){if(_0x2a5500[_0xc8ee('0x15')][_0xc8ee('0x16')]===0x1f4){logger[_0xc8ee('0x15')](_0xc8ee('0x17'),_0x42cd5c,_0x2a5500['error'][_0xc8ee('0x18')]);return _0x414878(_0x2a5500['error'][_0xc8ee('0x18')]);}logger[_0xc8ee('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x42cd5c,_0x2a5500[_0xc8ee('0x15')][_0xc8ee('0x18')]);return _0x3fa068(_0x2a5500['error'][_0xc8ee('0x18')]);}else{logger[_0xc8ee('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x42cd5c,_0xc8ee('0x11'));_0x3fa068(_0x2a5500['result'][_0xc8ee('0x18')]);}})[_0xc8ee('0x19')](function(_0x2e7fc1){logger[_0xc8ee('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x42cd5c,_0x2e7fc1);_0x414878(_0x2e7fc1);});});}exports['GetVoiceQueueRtPauses']=function(_0x268506){var _0x298201=this;return new Promise(function(_0x511ac5,_0x48a3ca){return db['UserVoiceQueueRt'][_0xc8ee('0x1a')]({'raw':_0x268506[_0xc8ee('0x1b')]?_0x268506[_0xc8ee('0x1b')][_0xc8ee('0x1c')]===undefined?!![]:![]:!![],'where':_0x268506['options']?_0x268506[_0xc8ee('0x1b')][_0xc8ee('0x1d')]||null:null,'attributes':[[db['sequelize']['fn'](_0xc8ee('0x1e'),db[_0xc8ee('0x1f')]['fn']('IF',db[_0xc8ee('0x1f')][_0xc8ee('0x20')](_0xc8ee('0x21')))),'outboundQueuePauses']]})[_0xc8ee('0x22')](function(_0x224069){logger['info']('GetVoiceQueueRtPauses',_0x268506);logger['debug'](_0xc8ee('0x23'),_0x268506,JSON[_0xc8ee('0x14')](_0x224069));_0x511ac5(_0x224069);})['catch'](function(_0xbdb7ae){logger['error'](_0xc8ee('0x23'),_0xbdb7ae[_0xc8ee('0x18')],_0x268506);_0x48a3ca(_0x298201[_0xc8ee('0x15')](0x1f4,_0xbdb7ae['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 7b927d3..3dbc793 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 _0xf611=['emit','removeListener','length','userVoiceQueueRt:','save','remove','update'];(function(_0x4dc207,_0x3fb8fd){var _0x2cb941=function(_0x1d02e2){while(--_0x1d02e2){_0x4dc207['push'](_0x4dc207['shift']());}};_0x2cb941(++_0x3fb8fd);}(_0xf611,0x7b));var _0x1f61=function(_0x37e848,_0x418405){_0x37e848=_0x37e848-0x0;var _0x512fe7=_0xf611[_0x37e848];return _0x512fe7;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x1f61('0x0'),_0x1f61('0x1'),_0x1f61('0x2')];function createListener(_0x58da3e,_0x5e6707){return function(_0x5ede64){_0x5e6707[_0x1f61('0x3')](_0x58da3e,_0x5ede64);};}function removeListener(_0x4e0df1,_0xdc8d91){return function(){UserVoiceQueueRtEvents[_0x1f61('0x4')](_0x4e0df1,_0xdc8d91);};}exports['register']=function(_0x4faa5b){for(var _0x290165=0x0,_0x34a924=events[_0x1f61('0x5')];_0x290165<_0x34a924;_0x290165++){var _0x21e3f6=events[_0x290165];var _0x5b2e5b=createListener(_0x1f61('0x6')+_0x21e3f6,_0x4faa5b);UserVoiceQueueRtEvents['on'](_0x21e3f6,_0x5b2e5b);}}; \ No newline at end of file +var _0xa93e=['update','emit','removeListener','register','length','remove'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xa93e,0x1df));var _0xea93=function(_0x57239f,_0x567a7b){_0x57239f=_0x57239f-0x0;var _0x4b1456=_0xa93e[_0x57239f];return _0x4b1456;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0xea93('0x0'),_0xea93('0x1')];function createListener(_0x47d9db,_0xd64380){return function(_0x50af65){_0xd64380[_0xea93('0x2')](_0x47d9db,_0x50af65);};}function removeListener(_0x5b5341,_0x5398ba){return function(){UserVoiceQueueRtEvents[_0xea93('0x3')](_0x5b5341,_0x5398ba);};}exports[_0xea93('0x4')]=function(_0x6c6985){for(var _0x26def3=0x0,_0x477a7d=events[_0xea93('0x5')];_0x26def3<_0x477a7d;_0x26def3++){var _0x54ebdf=events[_0x26def3];var _0x12876e=createListener('userVoiceQueueRt:'+_0x54ebdf,_0x6c6985);UserVoiceQueueRtEvents['on'](_0x54ebdf,_0x12876e);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 3c83d08..cb4e731 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5c6f50,_0x2352f2){var _0x5f1838=function(_0x4ba739){while(--_0x4ba739){_0x5c6f50['push'](_0x5c6f50['shift']());}};_0x5f1838(++_0x2352f2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x16a223,_0x31b6e8){var _0x5ded66=function(_0x25eb5f){while(--_0x25eb5f){_0x16a223['push'](_0x16a223['shift']());}};_0x5ded66(++_0x31b6e8);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 7fe0419..54fb3b1 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 _0x8daf=['exports','sequelize'];(function(_0x316769,_0x3f6f2c){var _0x44562d=function(_0x5c2962){while(--_0x5c2962){_0x316769['push'](_0x316769['shift']());}};_0x44562d(++_0x3f6f2c);}(_0x8daf,0xf9));var _0xf8da=function(_0x7d0f83,_0x43b7e3){_0x7d0f83=_0x7d0f83-0x0;var _0x7e1b2e=_0x8daf[_0x7d0f83];return _0x7e1b2e;};'use strict';var Sequelize=require(_0xf8da('0x0'));module[_0xf8da('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x338e=['exports','INTEGER','sequelize'];(function(_0x4c3cce,_0x543dc3){var _0x117afe=function(_0x5f4179){while(--_0x5f4179){_0x4c3cce['push'](_0x4c3cce['shift']());}};_0x117afe(++_0x543dc3);}(_0x338e,0x137));var _0xe338=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x338e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe338('0x0'));module[_0xe338('0x1')]={'penalty':{'type':Sequelize[_0xe338('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index c705b94..01486ee 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 _0xfd32=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','../../config/logger','api'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xfd32,0xa6));var _0x2fd3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd32[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2fd3('0x0'))(_0x2fd3('0x1'));var moment=require(_0x2fd3('0x2'));var BPromise=require(_0x2fd3('0x3'));var rp=require(_0x2fd3('0x4'));var fs=require('fs');var path=require(_0x2fd3('0x5'));var rimraf=require(_0x2fd3('0x6'));var config=require(_0x2fd3('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x2fd3('0x8')]=function(_0x4ce2c5,_0x186fe9){return _0x4ce2c5[_0x2fd3('0x9')](_0x2fd3('0xa'),attributes,{'tableName':_0x2fd3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96d1=['define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','moment','bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x1c1e61,_0xfa2e23){var _0x231251=function(_0x246c0a){while(--_0x246c0a){_0x1c1e61['push'](_0x1c1e61['shift']());}};_0x231251(++_0xfa2e23);}(_0x96d1,0xea));var _0x196d=function(_0x4704e5,_0x11046f){_0x4704e5=_0x4704e5-0x0;var _0x334dca=_0x96d1[_0x4704e5];return _0x334dca;};'use strict';var _=require(_0x196d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x196d('0x1'));var BPromise=require(_0x196d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x196d('0x3'));var rimraf=require(_0x196d('0x4'));var config=require(_0x196d('0x5'));var attributes=require(_0x196d('0x6'));module[_0x196d('0x7')]=function(_0x75f161,_0x50f3d9){return _0x75f161[_0x196d('0x8')](_0x196d('0x9'),attributes,{'tableName':_0x196d('0xa'),'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 6d8458d..67bf75f 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 _0x3e23=['error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x207f13,_0x45b0ec){var _0x23d772=function(_0x5dde53){while(--_0x5dde53){_0x207f13['push'](_0x207f13['shift']());}};_0x23d772(++_0x45b0ec);}(_0x3e23,0x1a6));var _0x33e2=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x3e23[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x33e2('0x0'));var util=require('util');var moment=require(_0x33e2('0x1'));var BPromise=require(_0x33e2('0x2'));var rs=require(_0x33e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x33e2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x33e2('0x5'))(_0x33e2('0x6'));var config=require(_0x33e2('0x7'));var jayson=require(_0x33e2('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x236548,_0x322aed,_0x1ac7fb){return new BPromise(function(_0x308584,_0xb6e06b){return client[_0x33e2('0x9')](_0x236548,_0x1ac7fb)[_0x33e2('0xa')](function(_0x9e7a66){logger[_0x33e2('0xb')](_0x33e2('0xc'),_0x322aed,_0x33e2('0xd'));logger['debug'](_0x33e2('0xe'),_0x322aed,_0x33e2('0xd'),JSON['stringify'](_0x9e7a66));if(_0x9e7a66[_0x33e2('0xf')]){if(_0x9e7a66[_0x33e2('0xf')][_0x33e2('0x10')]===0x1f4){logger[_0x33e2('0xf')](_0x33e2('0xc'),_0x322aed,_0x9e7a66[_0x33e2('0xf')][_0x33e2('0x11')]);return _0xb6e06b(_0x9e7a66['error'][_0x33e2('0x11')]);}logger[_0x33e2('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x322aed,_0x9e7a66[_0x33e2('0xf')][_0x33e2('0x11')]);return _0x308584(_0x9e7a66['error'][_0x33e2('0x11')]);}else{logger[_0x33e2('0xb')](_0x33e2('0xc'),_0x322aed,_0x33e2('0xd'));_0x308584(_0x9e7a66[_0x33e2('0x12')]['message']);}})['catch'](function(_0x47b4ac){logger[_0x33e2('0xf')](_0x33e2('0xc'),_0x322aed,_0x47b4ac);_0xb6e06b(_0x47b4ac);});});} \ No newline at end of file +var _0xc38f=['lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0xbf6110,_0x552776){var _0x496027=function(_0x16af15){while(--_0x16af15){_0xbf6110['push'](_0xbf6110['shift']());}};_0x496027(++_0x552776);}(_0xc38f,0x1b0));var _0xfc38=function(_0x309a8e,_0x498f0b){_0x309a8e=_0x309a8e-0x0;var _0x3e9808=_0xc38f[_0x309a8e];return _0x3e9808;};'use strict';var _=require(_0xfc38('0x0'));var util=require(_0xfc38('0x1'));var moment=require(_0xfc38('0x2'));var BPromise=require('bluebird');var rs=require(_0xfc38('0x3'));var fs=require('fs');var Redis=require(_0xfc38('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc38('0x5'));var logger=require('../../config/logger')(_0xfc38('0x6'));var config=require(_0xfc38('0x7'));var jayson=require(_0xfc38('0x8'));var client=jayson[_0xfc38('0x9')][_0xfc38('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439b6f,_0x869169,_0x12abb8){return new BPromise(function(_0x57d164,_0x20d66b){return client[_0xfc38('0xb')](_0x439b6f,_0x12abb8)[_0xfc38('0xc')](function(_0xb64f0d){logger['info'](_0xfc38('0xd'),_0x869169,_0xfc38('0xe'));logger[_0xfc38('0xf')](_0xfc38('0x10'),_0x869169,'request\x20sent',JSON[_0xfc38('0x11')](_0xb64f0d));if(_0xb64f0d[_0xfc38('0x12')]){if(_0xb64f0d['error'][_0xfc38('0x13')]===0x1f4){logger[_0xfc38('0x12')](_0xfc38('0xd'),_0x869169,_0xb64f0d[_0xfc38('0x12')]['message']);return _0x20d66b(_0xb64f0d[_0xfc38('0x12')][_0xfc38('0x14')]);}logger[_0xfc38('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x869169,_0xb64f0d['error'][_0xfc38('0x14')]);return _0x57d164(_0xb64f0d['error'][_0xfc38('0x14')]);}else{logger[_0xfc38('0x15')](_0xfc38('0xd'),_0x869169,_0xfc38('0xe'));_0x57d164(_0xb64f0d[_0xfc38('0x16')]['message']);}})[_0xfc38('0x17')](function(_0x355386){logger[_0xfc38('0x12')](_0xfc38('0xd'),_0x869169,_0x355386);_0x20d66b(_0x355386);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 341645c..8b7ff27 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 _0xb91a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x1f0f34,_0x48c366){var _0x4c1439=function(_0x58873e){while(--_0x58873e){_0x1f0f34['push'](_0x1f0f34['shift']());}};_0x4c1439(++_0x48c366);}(_0xb91a,0xf4));var _0xab91=function(_0x810e1e,_0x2a8d85){_0x810e1e=_0x810e1e-0x0;var _0xf076cf=_0xb91a[_0x810e1e];return _0xf076cf;};'use strict';var multer=require(_0xab91('0x0'));var util=require(_0xab91('0x1'));var path=require(_0xab91('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xab91('0x3')]();var fs_extra=require(_0xab91('0x4'));var auth=require(_0xab91('0x5'));var interaction=require(_0xab91('0x6'));var config=require(_0xab91('0x7'));var controller=require(_0xab91('0x8'));router[_0xab91('0x9')]('/',auth[_0xab91('0xa')](),controller[_0xab91('0xb')]);router[_0xab91('0x9')]('/:id',auth[_0xab91('0xa')](),controller[_0xab91('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xab91('0xd')](_0xab91('0xe'),auth[_0xab91('0xa')](),controller[_0xab91('0xf')]);router[_0xab91('0x10')](_0xab91('0xe'),auth[_0xab91('0xa')](),controller[_0xab91('0x11')]);module[_0xab91('0x12')]=router; \ No newline at end of file +var _0x777f=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer'];(function(_0x4d4f61,_0x56d7a7){var _0x297414=function(_0x30d055){while(--_0x30d055){_0x4d4f61['push'](_0x4d4f61['shift']());}};_0x297414(++_0x56d7a7);}(_0x777f,0x9f));var _0xf777=function(_0x35ef6b,_0x202c42){_0x35ef6b=_0x35ef6b-0x0;var _0x3ad145=_0x777f[_0x35ef6b];return _0x3ad145;};'use strict';var multer=require(_0xf777('0x0'));var util=require(_0xf777('0x1'));var path=require(_0xf777('0x2'));var timeout=require(_0xf777('0x3'));var express=require(_0xf777('0x4'));var router=express[_0xf777('0x5')]();var fs_extra=require(_0xf777('0x6'));var auth=require(_0xf777('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf777('0x8'));var controller=require(_0xf777('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf777('0xa')](_0xf777('0xb'),auth[_0xf777('0xc')](),controller[_0xf777('0xd')]);router[_0xf777('0xe')]('/',auth[_0xf777('0xc')](),controller[_0xf777('0xf')]);router[_0xf777('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf777('0x11')](_0xf777('0xb'),auth['isAuthenticated'](),controller[_0xf777('0x12')]);module[_0xf777('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 7f3adcd..54da648 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 _0x4444=['exports','name','STRING','sequelize'];(function(_0x2a8272,_0x5f3e38){var _0xe0fa73=function(_0x3a1878){while(--_0x3a1878){_0x2a8272['push'](_0x2a8272['shift']());}};_0xe0fa73(++_0x5f3e38);}(_0x4444,0xa3));var _0x4444=function(_0x5ee1ef,_0x8d83d5){_0x5ee1ef=_0x5ee1ef-0x0;var _0x601cdc=_0x4444[_0x5ee1ef];return _0x601cdc;};'use strict';var Sequelize=require(_0x4444('0x0'));module[_0x4444('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4444('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4444('0x3')]}}; \ No newline at end of file +var _0x46de=['exports','STRING','name','sequelize'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x46de,0x1c3));var _0xe46d=function(_0x3cffb3,_0x284b2d){_0x3cffb3=_0x3cffb3-0x0;var _0x57a846=_0x46de[_0x3cffb3];return _0x57a846;};'use strict';var Sequelize=require(_0xe46d('0x0'));module[_0xe46d('0x1')]={'name':{'type':Sequelize[_0xe46d('0x2')],'unique':_0xe46d('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 3724dfa..79b601e 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 _0xa714=['set','json','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','catch','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','limit','count'];(function(_0x23cc2d,_0xd02450){var _0x3dd47d=function(_0x26c771){while(--_0x26c771){_0x23cc2d['push'](_0x23cc2d['shift']());}};_0x3dd47d(++_0xd02450);}(_0xa714,0x17d));var _0x4a71=function(_0x191aed,_0x60a0fa){_0x191aed=_0x191aed-0x0;var _0x57311a=_0xa714[_0x191aed];return _0x57311a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4a71('0x0'));var jsonpatch=require(_0x4a71('0x1'));var rp=require(_0x4a71('0x2'));var moment=require(_0x4a71('0x3'));var BPromise=require(_0x4a71('0x4'));var Mustache=require(_0x4a71('0x5'));var util=require(_0x4a71('0x6'));var path=require(_0x4a71('0x7'));var sox=require(_0x4a71('0x8'));var csv=require(_0x4a71('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a71('0xa'));var _=require(_0x4a71('0xb'));var squel=require(_0x4a71('0xc'));var crypto=require(_0x4a71('0xd'));var jsforce=require(_0x4a71('0xe'));var deskjs=require(_0x4a71('0xf'));var toCsv=require(_0x4a71('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4a71('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4a71('0x11'));var hardwareService=require(_0x4a71('0x12'));var logger=require(_0x4a71('0x13'))(_0x4a71('0x14'));var utils=require(_0x4a71('0x15'));var config=require(_0x4a71('0x16'));var licenseUtil=require(_0x4a71('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x490b80,_0x23e508){_0x23e508=_0x23e508||0xcc;return function(_0x1c352f){if(_0x1c352f){return _0x490b80['sendStatus'](_0x23e508);}return _0x490b80[_0x4a71('0x18')](_0x23e508)[_0x4a71('0x19')]();};}function respondWithResult(_0x54be20,_0x5f361f){_0x5f361f=_0x5f361f||0xc8;return function(_0x4f4681){if(_0x4f4681){return _0x54be20[_0x4a71('0x18')](_0x5f361f)['json'](_0x4f4681);}};}function respondWithFilteredResult(_0x55356d,_0x583905){return function(_0x21bccb){if(_0x21bccb){var _0x3104d3=typeof _0x583905[_0x4a71('0x1a')]==='undefined'&&typeof _0x583905[_0x4a71('0x1b')]==='undefined';var _0x44e5bd=_0x21bccb[_0x4a71('0x1c')];var _0x7d751f=_0x3104d3?0x0:_0x583905[_0x4a71('0x1a')];var _0x521a56=_0x3104d3?_0x21bccb[_0x4a71('0x1c')]:_0x583905[_0x4a71('0x1a')]+_0x583905[_0x4a71('0x1b')];var _0x82b2c5;if(_0x521a56>=_0x44e5bd){_0x521a56=_0x44e5bd;_0x82b2c5=0xc8;}else{_0x82b2c5=0xce;}_0x55356d[_0x4a71('0x18')](_0x82b2c5);return _0x55356d[_0x4a71('0x1d')]('Content-Range',_0x7d751f+'-'+_0x521a56+'/'+_0x44e5bd)[_0x4a71('0x1e')](_0x21bccb);}return null;};}function patchUpdates(_0x50cdd5){return function(_0x3c6615){try{jsonpatch['apply'](_0x3c6615,_0x50cdd5,!![]);}catch(_0x52f524){return BPromise[_0x4a71('0x1f')](_0x52f524);}return _0x3c6615[_0x4a71('0x20')]();};}function saveUpdates(_0x577534,_0x27ec1f){return function(_0x208e80){if(_0x208e80){return _0x208e80[_0x4a71('0x21')](_0x577534)[_0x4a71('0x22')](function(_0x59e565){return _0x59e565;});}return null;};}function removeEntity(_0x2f447c,_0x32eadd){return function(_0x4a7279){if(_0x4a7279){return _0x4a7279[_0x4a71('0x23')]()[_0x4a71('0x22')](function(){var _0x4c6c2b=_0x4a7279[_0x4a71('0x24')]({'plain':!![]});var _0x1ec5b0=_0x4a71('0x25');return db[_0x4a71('0x26')]['destroy']({'where':{'type':_0x1ec5b0,'resourceId':_0x4c6c2b['id']}})[_0x4a71('0x22')](function(){return _0x4a7279;});})[_0x4a71('0x22')](function(){_0x2f447c[_0x4a71('0x18')](0xcc)[_0x4a71('0x19')]();});}};}function handleEntityNotFound(_0x29b003,_0x340d97){return function(_0x3a174e){if(!_0x3a174e){_0x29b003['sendStatus'](0x194);}return _0x3a174e;};}function handleError(_0x376d3f,_0x3a6d5d){_0x3a6d5d=_0x3a6d5d||0x1f4;return function(_0x463b3f){logger[_0x4a71('0x27')](_0x463b3f[_0x4a71('0x28')]);if(_0x463b3f[_0x4a71('0x29')]){delete _0x463b3f[_0x4a71('0x29')];}_0x376d3f[_0x4a71('0x18')](_0x3a6d5d)[_0x4a71('0x2a')](_0x463b3f);};}exports[_0x4a71('0x2b')]=function(_0x1c6653,_0x177b71){var _0xa508c4={},_0x537ed2={},_0x1b71d5={'count':0x0,'rows':[]};var _0x37a3e6=_[_0x4a71('0x2c')](db[_0x4a71('0x2d')][_0x4a71('0x2e')],function(_0x5e546f){return{'name':_0x5e546f[_0x4a71('0x2f')],'type':_0x5e546f['type'][_0x4a71('0x30')]};});_0x537ed2[_0x4a71('0x31')]=_[_0x4a71('0x2c')](_0x37a3e6,_0x4a71('0x29'));_0x537ed2[_0x4a71('0x32')]=_['keys'](_0x1c6653[_0x4a71('0x32')]);_0x537ed2['filters']=_[_0x4a71('0x33')](_0x537ed2['model'],_0x537ed2[_0x4a71('0x32')]);_0xa508c4[_0x4a71('0x34')]=_['intersection'](_0x537ed2[_0x4a71('0x31')],qs[_0x4a71('0x35')](_0x1c6653[_0x4a71('0x32')][_0x4a71('0x35')]));_0xa508c4['attributes']=_0xa508c4[_0x4a71('0x34')][_0x4a71('0x36')]?_0xa508c4['attributes']:_0x537ed2[_0x4a71('0x31')];if(!_0x1c6653[_0x4a71('0x32')][_0x4a71('0x37')](_0x4a71('0x38'))){_0xa508c4['limit']=qs[_0x4a71('0x1b')](_0x1c6653['query'][_0x4a71('0x1b')]);_0xa508c4[_0x4a71('0x1a')]=qs[_0x4a71('0x1a')](_0x1c6653['query'][_0x4a71('0x1a')]);}_0xa508c4[_0x4a71('0x39')]=qs[_0x4a71('0x3a')](_0x1c6653['query'][_0x4a71('0x3a')]);_0xa508c4[_0x4a71('0x3b')]=qs[_0x4a71('0x3c')](_[_0x4a71('0x3d')](_0x1c6653[_0x4a71('0x32')],_0x537ed2[_0x4a71('0x3c')]),_0x37a3e6);if(_0x1c6653[_0x4a71('0x32')][_0x4a71('0x3e')]){_0xa508c4[_0x4a71('0x3b')]=_[_0x4a71('0x3f')](_0xa508c4['where'],{'$or':_['map'](_0x37a3e6,function(_0x21efb4){if(_0x21efb4[_0x4a71('0x40')]!=='VIRTUAL'){var _0x4158c2={};_0x4158c2[_0x21efb4[_0x4a71('0x29')]]={'$like':'%'+_0x1c6653[_0x4a71('0x32')][_0x4a71('0x3e')]+'%'};return _0x4158c2;}})});}_0xa508c4=_['merge']({},_0xa508c4,_0x1c6653[_0x4a71('0x41')]);var _0x3c4873={'where':_0xa508c4[_0x4a71('0x3b')]};return db[_0x4a71('0x2d')][_0x4a71('0x1c')](_0x3c4873)[_0x4a71('0x22')](function(_0x305a2f){_0x1b71d5['count']=_0x305a2f;if(_0x1c6653['query'][_0x4a71('0x42')]){_0xa508c4[_0x4a71('0x43')]=[{'all':!![]}];}return db[_0x4a71('0x2d')][_0x4a71('0x44')](_0xa508c4);})[_0x4a71('0x22')](function(_0x3caa53){_0x1b71d5['rows']=_0x3caa53;return _0x1b71d5;})[_0x4a71('0x22')](respondWithFilteredResult(_0x177b71,_0xa508c4))[_0x4a71('0x45')](handleError(_0x177b71,null));};exports['show']=function(_0x5f2c14,_0x556399){var _0x1bef19={'raw':!![],'where':{'id':_0x5f2c14[_0x4a71('0x46')]['id']}},_0x1aa28f={};_0x1aa28f[_0x4a71('0x31')]=_[_0x4a71('0x47')](db[_0x4a71('0x2d')][_0x4a71('0x2e')]);_0x1aa28f['query']=_[_0x4a71('0x47')](_0x5f2c14[_0x4a71('0x32')]);_0x1aa28f['filters']=_['intersection'](_0x1aa28f[_0x4a71('0x31')],_0x1aa28f[_0x4a71('0x32')]);_0x1bef19[_0x4a71('0x34')]=_[_0x4a71('0x33')](_0x1aa28f[_0x4a71('0x31')],qs[_0x4a71('0x35')](_0x5f2c14[_0x4a71('0x32')][_0x4a71('0x35')]));_0x1bef19[_0x4a71('0x34')]=_0x1bef19[_0x4a71('0x34')][_0x4a71('0x36')]?_0x1bef19[_0x4a71('0x34')]:_0x1aa28f['model'];if(_0x5f2c14[_0x4a71('0x32')][_0x4a71('0x42')]){_0x1bef19[_0x4a71('0x43')]=[{'all':!![]}];}_0x1bef19=_[_0x4a71('0x3f')]({},_0x1bef19,_0x5f2c14[_0x4a71('0x41')]);return db[_0x4a71('0x2d')][_0x4a71('0x48')](_0x1bef19)[_0x4a71('0x22')](handleEntityNotFound(_0x556399,null))[_0x4a71('0x22')](respondWithResult(_0x556399,null))[_0x4a71('0x45')](handleError(_0x556399,null));};exports[_0x4a71('0x49')]=function(_0x30d514,_0x1b38a5){return db[_0x4a71('0x2d')]['create'](_0x30d514['body'],{})[_0x4a71('0x22')](function(_0x510e3b){var _0x2e1c75=_0x30d514[_0x4a71('0x4a')][_0x4a71('0x24')]({'plain':!![]});if(!_0x2e1c75)throw new Error(_0x4a71('0x4b'));if(_0x2e1c75[_0x4a71('0x4c')]==='user'){var _0x1b1e9b=_0x510e3b[_0x4a71('0x24')]({'plain':!![]});var _0xdc3131=_0x4a71('0x25');return db[_0x4a71('0x4d')][_0x4a71('0x48')]({'where':{'name':_0xdc3131,'userProfileId':_0x2e1c75[_0x4a71('0x4e')]},'raw':!![]})[_0x4a71('0x22')](function(_0x4d24d9){if(_0x4d24d9&&_0x4d24d9[_0x4a71('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x1b1e9b[_0x4a71('0x29')],'resourceId':_0x1b1e9b['id'],'type':_0x4d24d9['name'],'sectionId':_0x4d24d9['id']},{})[_0x4a71('0x22')](function(){return _0x510e3b;});}else{return _0x510e3b;}})['catch'](function(_0x49a2be){logger[_0x4a71('0x27')](_0x4a71('0x50'),_0x49a2be);throw _0x49a2be;});}return _0x510e3b;})[_0x4a71('0x22')](respondWithResult(_0x1b38a5,0xc9))[_0x4a71('0x45')](handleError(_0x1b38a5,null));};exports[_0x4a71('0x21')]=function(_0x2ec51b,_0xf10069){if(_0x2ec51b[_0x4a71('0x51')]['id']){delete _0x2ec51b['body']['id'];}return db[_0x4a71('0x2d')]['find']({'where':{'id':_0x2ec51b['params']['id']}})['then'](handleEntityNotFound(_0xf10069,null))[_0x4a71('0x22')](saveUpdates(_0x2ec51b[_0x4a71('0x51')],null))[_0x4a71('0x22')](respondWithResult(_0xf10069,null))[_0x4a71('0x45')](handleError(_0xf10069,null));};exports[_0x4a71('0x23')]=function(_0x1e5318,_0x9e12c1){return db[_0x4a71('0x2d')][_0x4a71('0x48')]({'where':{'id':_0x1e5318[_0x4a71('0x46')]['id']}})[_0x4a71('0x22')](handleEntityNotFound(_0x9e12c1,null))[_0x4a71('0x22')](removeEntity(_0x9e12c1,null))[_0x4a71('0x45')](handleError(_0x9e12c1,null));}; \ No newline at end of file +var _0xf31c=['zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','name','send','map','Variable','key','model','query','keys','intersection','attributes','fields','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','findAll','catch','show','params','rawAttributes','length','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','userProfileId','autoAssociation','rimraf'];(function(_0x1cefbe,_0x4fc06c){var _0x4cd985=function(_0x14dc2a){while(--_0x14dc2a){_0x1cefbe['push'](_0x1cefbe['shift']());}};_0x4cd985(++_0x4fc06c);}(_0xf31c,0x1e5));var _0xcf31=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xf31c[_0x565c49];return _0x20ca34;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcf31('0x0'));var zipdir=require(_0xcf31('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcf31('0x2'));var BPromise=require(_0xcf31('0x3'));var Mustache=require(_0xcf31('0x4'));var util=require(_0xcf31('0x5'));var path=require(_0xcf31('0x6'));var sox=require(_0xcf31('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf31('0x8'));var _=require('lodash');var squel=require(_0xcf31('0x9'));var crypto=require('crypto');var jsforce=require(_0xcf31('0xa'));var deskjs=require(_0xcf31('0xb'));var toCsv=require(_0xcf31('0xc'));var querystring=require(_0xcf31('0xd'));var Papa=require('papaparse');var Redis=require(_0xcf31('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xcf31('0xf'));var as=require(_0xcf31('0x10'));var hardwareService=require(_0xcf31('0x11'));var logger=require(_0xcf31('0x12'))(_0xcf31('0x13'));var utils=require(_0xcf31('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xcf31('0x15'));var db=require(_0xcf31('0x16'))['db'];function respondWithStatusCode(_0x103e76,_0x4b105d){_0x4b105d=_0x4b105d||0xcc;return function(_0x129306){if(_0x129306){return _0x103e76[_0xcf31('0x17')](_0x4b105d);}return _0x103e76[_0xcf31('0x18')](_0x4b105d)[_0xcf31('0x19')]();};}function respondWithResult(_0x432b7b,_0x192400){_0x192400=_0x192400||0xc8;return function(_0x4699be){if(_0x4699be){return _0x432b7b['status'](_0x192400)[_0xcf31('0x1a')](_0x4699be);}};}function respondWithFilteredResult(_0x41b8e8,_0x19c6b){return function(_0x2d0be3){if(_0x2d0be3){var _0x53cfda=typeof _0x19c6b[_0xcf31('0x1b')]===_0xcf31('0x1c')&&typeof _0x19c6b['limit']===_0xcf31('0x1c');var _0x1e3c24=_0x2d0be3[_0xcf31('0x1d')];var _0xa625a2=_0x53cfda?0x0:_0x19c6b['offset'];var _0x14ab81=_0x53cfda?_0x2d0be3[_0xcf31('0x1d')]:_0x19c6b['offset']+_0x19c6b['limit'];var _0x5560e8;if(_0x14ab81>=_0x1e3c24){_0x14ab81=_0x1e3c24;_0x5560e8=0xc8;}else{_0x5560e8=0xce;}_0x41b8e8['status'](_0x5560e8);return _0x41b8e8[_0xcf31('0x1e')](_0xcf31('0x1f'),_0xa625a2+'-'+_0x14ab81+'/'+_0x1e3c24)['json'](_0x2d0be3);}return null;};}function patchUpdates(_0x12900e){return function(_0x14da81){try{jsonpatch[_0xcf31('0x20')](_0x14da81,_0x12900e,!![]);}catch(_0x83762b){return BPromise[_0xcf31('0x21')](_0x83762b);}return _0x14da81[_0xcf31('0x22')]();};}function saveUpdates(_0x5f2b2a,_0x19d345){return function(_0x1461ed){if(_0x1461ed){return _0x1461ed[_0xcf31('0x23')](_0x5f2b2a)[_0xcf31('0x24')](function(_0x230c7d){return _0x230c7d;});}return null;};}function removeEntity(_0x17b189,_0x466fe0){return function(_0x27d18f){if(_0x27d18f){return _0x27d18f[_0xcf31('0x25')]()[_0xcf31('0x24')](function(){var _0x26395f=_0x27d18f['get']({'plain':!![]});var _0x35d6fa='Variables';return db[_0xcf31('0x26')][_0xcf31('0x25')]({'where':{'type':_0x35d6fa,'resourceId':_0x26395f['id']}})[_0xcf31('0x24')](function(){return _0x27d18f;});})[_0xcf31('0x24')](function(){_0x17b189['status'](0xcc)[_0xcf31('0x19')]();});}};}function handleEntityNotFound(_0x2927fa,_0x447756){return function(_0x416887){if(!_0x416887){_0x2927fa[_0xcf31('0x17')](0x194);}return _0x416887;};}function handleError(_0x159f86,_0x29de3f){_0x29de3f=_0x29de3f||0x1f4;return function(_0x406a28){logger[_0xcf31('0x27')](_0x406a28['stack']);if(_0x406a28[_0xcf31('0x28')]){delete _0x406a28[_0xcf31('0x28')];}_0x159f86['status'](_0x29de3f)[_0xcf31('0x29')](_0x406a28);};}exports['index']=function(_0x25fc77,_0x576e51){var _0x352e47={},_0x35de54={},_0x3e2530={'count':0x0,'rows':[]};var _0x1aa93c=_[_0xcf31('0x2a')](db[_0xcf31('0x2b')]['rawAttributes'],function(_0x13ee40){return{'name':_0x13ee40['fieldName'],'type':_0x13ee40['type'][_0xcf31('0x2c')]};});_0x35de54[_0xcf31('0x2d')]=_[_0xcf31('0x2a')](_0x1aa93c,'name');_0x35de54[_0xcf31('0x2e')]=_[_0xcf31('0x2f')](_0x25fc77['query']);_0x35de54['filters']=_[_0xcf31('0x30')](_0x35de54['model'],_0x35de54[_0xcf31('0x2e')]);_0x352e47[_0xcf31('0x31')]=_['intersection'](_0x35de54[_0xcf31('0x2d')],qs[_0xcf31('0x32')](_0x25fc77[_0xcf31('0x2e')][_0xcf31('0x32')]));_0x352e47[_0xcf31('0x31')]=_0x352e47[_0xcf31('0x31')]['length']?_0x352e47[_0xcf31('0x31')]:_0x35de54[_0xcf31('0x2d')];if(!_0x25fc77[_0xcf31('0x2e')]['hasOwnProperty']('nolimit')){_0x352e47[_0xcf31('0x33')]=qs[_0xcf31('0x33')](_0x25fc77[_0xcf31('0x2e')]['limit']);_0x352e47[_0xcf31('0x1b')]=qs[_0xcf31('0x1b')](_0x25fc77[_0xcf31('0x2e')][_0xcf31('0x1b')]);}_0x352e47[_0xcf31('0x34')]=qs[_0xcf31('0x35')](_0x25fc77[_0xcf31('0x2e')]['sort']);_0x352e47[_0xcf31('0x36')]=qs[_0xcf31('0x37')](_[_0xcf31('0x38')](_0x25fc77[_0xcf31('0x2e')],_0x35de54[_0xcf31('0x37')]),_0x1aa93c);if(_0x25fc77[_0xcf31('0x2e')][_0xcf31('0x39')]){_0x352e47[_0xcf31('0x36')]=_[_0xcf31('0x3a')](_0x352e47[_0xcf31('0x36')],{'$or':_[_0xcf31('0x2a')](_0x1aa93c,function(_0x544b78){if(_0x544b78[_0xcf31('0x3b')]!==_0xcf31('0x3c')){var _0x2f1f52={};_0x2f1f52[_0x544b78[_0xcf31('0x28')]]={'$like':'%'+_0x25fc77[_0xcf31('0x2e')][_0xcf31('0x39')]+'%'};return _0x2f1f52;}})});}_0x352e47=_['merge']({},_0x352e47,_0x25fc77[_0xcf31('0x3d')]);var _0x30edb8={'where':_0x352e47[_0xcf31('0x36')]};return db['Variable']['count'](_0x30edb8)['then'](function(_0x4a9979){_0x3e2530[_0xcf31('0x1d')]=_0x4a9979;if(_0x25fc77[_0xcf31('0x2e')]['includeAll']){_0x352e47['include']=[{'all':!![]}];}return db['Variable'][_0xcf31('0x3e')](_0x352e47);})[_0xcf31('0x24')](function(_0x2c78f4){_0x3e2530['rows']=_0x2c78f4;return _0x3e2530;})[_0xcf31('0x24')](respondWithFilteredResult(_0x576e51,_0x352e47))[_0xcf31('0x3f')](handleError(_0x576e51,null));};exports[_0xcf31('0x40')]=function(_0x4068f3,_0x213c30){var _0x15e789={'raw':!![],'where':{'id':_0x4068f3[_0xcf31('0x41')]['id']}},_0x1ddd75={};_0x1ddd75['model']=_['keys'](db['Variable'][_0xcf31('0x42')]);_0x1ddd75[_0xcf31('0x2e')]=_[_0xcf31('0x2f')](_0x4068f3[_0xcf31('0x2e')]);_0x1ddd75[_0xcf31('0x37')]=_['intersection'](_0x1ddd75[_0xcf31('0x2d')],_0x1ddd75['query']);_0x15e789[_0xcf31('0x31')]=_['intersection'](_0x1ddd75[_0xcf31('0x2d')],qs['fields'](_0x4068f3['query'][_0xcf31('0x32')]));_0x15e789[_0xcf31('0x31')]=_0x15e789[_0xcf31('0x31')][_0xcf31('0x43')]?_0x15e789[_0xcf31('0x31')]:_0x1ddd75['model'];if(_0x4068f3['query'][_0xcf31('0x44')]){_0x15e789[_0xcf31('0x45')]=[{'all':!![]}];}_0x15e789=_[_0xcf31('0x3a')]({},_0x15e789,_0x4068f3[_0xcf31('0x3d')]);return db[_0xcf31('0x2b')][_0xcf31('0x46')](_0x15e789)[_0xcf31('0x24')](handleEntityNotFound(_0x213c30,null))[_0xcf31('0x24')](respondWithResult(_0x213c30,null))[_0xcf31('0x3f')](handleError(_0x213c30,null));};exports[_0xcf31('0x47')]=function(_0x4a663a,_0x4cd825){return db[_0xcf31('0x2b')][_0xcf31('0x47')](_0x4a663a[_0xcf31('0x48')],{})[_0xcf31('0x24')](function(_0xb6f7ab){var _0x3c7d5f=_0x4a663a[_0xcf31('0x49')][_0xcf31('0x4a')]({'plain':!![]});if(!_0x3c7d5f)throw new Error(_0xcf31('0x4b'));if(_0x3c7d5f[_0xcf31('0x4c')]===_0xcf31('0x49')){var _0x4234bb=_0xb6f7ab[_0xcf31('0x4a')]({'plain':!![]});var _0x27c5ad=_0xcf31('0x4d');return db[_0xcf31('0x4e')][_0xcf31('0x46')]({'where':{'name':_0x27c5ad,'userProfileId':_0x3c7d5f[_0xcf31('0x4f')]},'raw':!![]})[_0xcf31('0x24')](function(_0x4d1d1a){if(_0x4d1d1a&&_0x4d1d1a[_0xcf31('0x50')]===0x0){return db[_0xcf31('0x26')][_0xcf31('0x47')]({'name':_0x4234bb['name'],'resourceId':_0x4234bb['id'],'type':_0x4d1d1a['name'],'sectionId':_0x4d1d1a['id']},{})[_0xcf31('0x24')](function(){return _0xb6f7ab;});}else{return _0xb6f7ab;}})[_0xcf31('0x3f')](function(_0x541685){logger[_0xcf31('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x541685);throw _0x541685;});}return _0xb6f7ab;})[_0xcf31('0x24')](respondWithResult(_0x4cd825,0xc9))[_0xcf31('0x3f')](handleError(_0x4cd825,null));};exports['update']=function(_0x2d32c5,_0x14b324){if(_0x2d32c5[_0xcf31('0x48')]['id']){delete _0x2d32c5[_0xcf31('0x48')]['id'];}return db[_0xcf31('0x2b')][_0xcf31('0x46')]({'where':{'id':_0x2d32c5[_0xcf31('0x41')]['id']}})['then'](handleEntityNotFound(_0x14b324,null))[_0xcf31('0x24')](saveUpdates(_0x2d32c5[_0xcf31('0x48')],null))[_0xcf31('0x24')](respondWithResult(_0x14b324,null))['catch'](handleError(_0x14b324,null));};exports['destroy']=function(_0x169b1d,_0x303b82){return db['Variable']['find']({'where':{'id':_0x169b1d[_0xcf31('0x41')]['id']}})[_0xcf31('0x24')](handleEntityNotFound(_0x303b82,null))[_0xcf31('0x24')](removeEntity(_0x303b82,null))[_0xcf31('0x3f')](handleError(_0x303b82,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index cbf74c8..c5b1a13 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 _0xb928=['exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes'];(function(_0x1170ef,_0x26d037){var _0x36d888=function(_0x6ea133){while(--_0x6ea133){_0x1170ef['push'](_0x1170ef['shift']());}};_0x36d888(++_0x26d037);}(_0xb928,0x100));var _0x8b92=function(_0x36d25e,_0x1a047d){_0x36d25e=_0x36d25e-0x0;var _0x4b95b8=_0xb928[_0x36d25e];return _0x4b95b8;};'use strict';var _=require(_0x8b92('0x0'));var util=require(_0x8b92('0x1'));var logger=require(_0x8b92('0x2'))(_0x8b92('0x3'));var moment=require('moment');var BPromise=require(_0x8b92('0x4'));var rp=require(_0x8b92('0x5'));var fs=require('fs');var path=require(_0x8b92('0x6'));var rimraf=require(_0x8b92('0x7'));var config=require(_0x8b92('0x8'));var attributes=require(_0x8b92('0x9'));module[_0x8b92('0xa')]=function(_0x92ecf4,_0x3ff6e8){return _0x92ecf4[_0x8b92('0xb')](_0x8b92('0xc'),attributes,{'tableName':_0x8b92('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e41=['request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','api','moment','bluebird'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x4e41,0x175));var _0x14e4=function(_0x5d4a92,_0x2b4533){_0x5d4a92=_0x5d4a92-0x0;var _0x5468fb=_0x4e41[_0x5d4a92];return _0x5468fb;};'use strict';var _=require(_0x14e4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x14e4('0x1'));var moment=require(_0x14e4('0x2'));var BPromise=require(_0x14e4('0x3'));var rp=require(_0x14e4('0x4'));var fs=require('fs');var path=require(_0x14e4('0x5'));var rimraf=require(_0x14e4('0x6'));var config=require(_0x14e4('0x7'));var attributes=require(_0x14e4('0x8'));module[_0x14e4('0x9')]=function(_0x175fa5,_0x57d21f){return _0x175fa5[_0x14e4('0xa')](_0x14e4('0xb'),attributes,{'tableName':_0x14e4('0xc'),'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 5c9ae13..b4eb500 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 _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x5b989e,_0x4e28f9){var _0x36f054=function(_0x4a0bd0){while(--_0x4a0bd0){_0x5b989e['push'](_0x5b989e['shift']());}};_0x36f054(++_0x4e28f9);}(_0x55ca,0x126));var _0xa55c=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0x55ca[_0x5de532];return _0x4e9192;};'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')]('Variable,\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')]('Variable,\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);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +var _0x8ef6=['result','catch','Variable','find','options','raw','include','model','attributes','map','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1e1f17,_0x4bd574){var _0x465b52=function(_0x46accd){while(--_0x46accd){_0x1e1f17['push'](_0x1e1f17['shift']());}};_0x465b52(++_0x4bd574);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2dce85,_0x1ac12a){_0x2dce85=_0x2dce85-0x0;var _0x4340b6=_0x8ef6[_0x2dce85];return _0x4340b6;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['ShowVariable']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')]({'raw':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1['options'][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['where']||null:null,'attributes':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['attributes']||null:null,'include':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1c')]?_['map'](_0x2633c1['options']['include'],function(_0x26018d){return{'model':db[_0x26018d[_0x68ef('0x1d')]],'as':_0x26018d['as'],'attributes':_0x26018d[_0x68ef('0x1e')],'include':_0x26018d[_0x68ef('0x1c')]?_[_0x68ef('0x1f')](_0x26018d[_0x68ef('0x1c')],function(_0x258cd5){return{'model':db[_0x258cd5[_0x68ef('0x1d')]],'as':_0x258cd5['as'],'attributes':_0x258cd5[_0x68ef('0x1e')],'include':_0x258cd5[_0x68ef('0x1c')]?_['map'](_0x258cd5[_0x68ef('0x1c')],function(_0x57f9ee){return{'model':db[_0x57f9ee['model']],'as':_0x57f9ee['as'],'attributes':_0x57f9ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x268f32){logger[_0x68ef('0xd')](_0x68ef('0x20'),_0x2633c1);logger['debug']('ShowVariable',_0x2633c1,JSON[_0x68ef('0x12')](_0x268f32));_0x4ade0d(_0x268f32);})[_0x68ef('0x17')](function(_0x7bf96){logger[_0x68ef('0x13')](_0x68ef('0x20'),_0x7bf96[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x7bf96[_0x68ef('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index f780f3b..52279e0 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 _0x481c=['/migrations','migrations','exports','Router','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart'];(function(_0x566a6d,_0x3baf32){var _0x405354=function(_0x152050){while(--_0x152050){_0x566a6d['push'](_0x566a6d['shift']());}};_0x405354(++_0x3baf32);}(_0x481c,0x153));var _0xc481=function(_0x5e7ca0,_0x8a3602){_0x5e7ca0=_0x5e7ca0-0x0;var _0x327230=_0x481c[_0x5e7ca0];return _0x327230;};'use strict';var express=require('express');var router=express[_0xc481('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xc481('0x1'));router[_0xc481('0x2')]('/',controller[_0xc481('0x3')]);router['get'](_0xc481('0x4'),auth[_0xc481('0x5')](),auth[_0xc481('0x6')](),controller[_0xc481('0x7')]);router[_0xc481('0x2')](_0xc481('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xc481('0x9')]);router[_0xc481('0x2')](_0xc481('0xa'),auth[_0xc481('0x5')](),auth[_0xc481('0x6')](),controller[_0xc481('0xb')]);router[_0xc481('0x2')](_0xc481('0xc'),auth['isAuthenticated'](),controller['restart']);router[_0xc481('0x2')](_0xc481('0xd'),controller[_0xc481('0xe')]);module[_0xc481('0xf')]=router; \ No newline at end of file +var _0xe677=['get','/fetch','canUpdate','fetch','/reset','isAuthenticated','reset','pull','/migrations','migrations','exports','express','../../components/auth/service','index'];(function(_0x36ac49,_0x4a4afe){var _0x42aee0=function(_0x3e1ac3){while(--_0x3e1ac3){_0x36ac49['push'](_0x36ac49['shift']());}};_0x42aee0(++_0x4a4afe);}(_0xe677,0xf9));var _0x7e67=function(_0x35a274,_0x98b399){_0x35a274=_0x35a274-0x0;var _0x40d905=_0xe677[_0x35a274];return _0x40d905;};'use strict';var express=require(_0x7e67('0x0'));var router=express['Router']();var auth=require(_0x7e67('0x1'));var controller=require('./version.controller');router['get']('/',controller[_0x7e67('0x2')]);router[_0x7e67('0x3')](_0x7e67('0x4'),auth['isAuthenticated'](),auth[_0x7e67('0x5')](),controller[_0x7e67('0x6')]);router['get'](_0x7e67('0x7'),auth[_0x7e67('0x8')](),auth[_0x7e67('0x5')](),controller[_0x7e67('0x9')]);router[_0x7e67('0x3')]('/pull',auth[_0x7e67('0x8')](),auth[_0x7e67('0x5')](),controller[_0x7e67('0xa')]);router[_0x7e67('0x3')]('/restart',auth[_0x7e67('0x8')](),controller['restart']);router['get'](_0x7e67('0xb'),controller[_0x7e67('0xc')]);module[_0x7e67('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 42ef3b8..737efb5 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 _0x5a36=['status','error','json','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','.js','exports','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','umzug','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','update','simple-git','root','index','query','latest','fetch','tags','2.0.0'];(function(_0x10fb19,_0x16bd31){var _0x483102=function(_0x1b8d68){while(--_0x1b8d68){_0x10fb19['push'](_0x10fb19['shift']());}};_0x483102(++_0x16bd31);}(_0x5a36,0x1cc));var _0x65a3=function(_0x5bccd3,_0x4e2b7b){_0x5bccd3=_0x5bccd3-0x0;var _0x322dbc=_0x5a36[_0x5bccd3];return _0x322dbc;};'use strict';var Umzug=require(_0x65a3('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x65a3('0x1'))(module,_0x65a3('0x2'));var compareVersions=require(_0x65a3('0x3'));var exec=require(_0x65a3('0x4'))[_0x65a3('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0x65a3('0x6'));var pm2=require(_0x65a3('0x7'));var logger=require('../../config/logger')(_0x65a3('0x8'));var git=require(_0x65a3('0x9'))(config[_0x65a3('0xa')]);exports[_0x65a3('0xb')]=function(_0x14db51,_0x250c5b){var _0x3a2e5f={'current':module['exports'][_0x65a3('0x2')],'phonebar':0x2};if(_0x14db51['query']&&_0x14db51[_0x65a3('0xc')][_0x65a3('0xd')]){return git[_0x65a3('0xe')]()[_0x65a3('0xf')](function(_0x423bb7,_0x3ad664){_0x3a2e5f[_0x65a3('0xd')]=(_0x423bb7?module['exports'][_0x65a3('0x2')]:_0x3ad664[_0x65a3('0xd')])||_0x65a3('0x10');return _0x250c5b[_0x65a3('0x11')](0xc8)['json'](_0x3a2e5f);});}else{return _0x250c5b[_0x65a3('0x11')](0xc8)['json'](_0x3a2e5f);}};exports['fetch']=function(_0x242a05,_0x3d3016){return git['fetch'](['origin','master'],function(_0x405ee6){if(_0x405ee6){logger[_0x65a3('0x12')](_0x405ee6);return _0x3d3016[_0x65a3('0x11')](0x1f4)[_0x65a3('0x13')](_0x405ee6);}logger['info'](_0x65a3('0x14'));return _0x3d3016['status'](0xc8)['json']({'output':_0x65a3('0x15')});});};exports[_0x65a3('0x16')]=function(_0x3df422,_0x46113b){return git['reset']([_0x65a3('0x17'),_0x65a3('0x18')],function(_0x107efc){if(_0x107efc){logger[_0x65a3('0x12')](_0x107efc);return _0x46113b[_0x65a3('0x11')](0x1f4)[_0x65a3('0x13')](_0x107efc);}logger[_0x65a3('0x19')](_0x65a3('0x1a'));return _0x46113b['status'](0xc8)['json']({'output':_0x65a3('0x1b')});});};exports[_0x65a3('0x1c')]=function(_0x3e5456,_0x476c69){exec(_0x65a3('0x1d'),function(_0x4356cf,_0x470a2c,_0x15e558){logger[_0x65a3('0x19')](_0x470a2c);logger[_0x65a3('0x19')](_0x15e558);if(_0x4356cf){logger['error'](_0x4356cf);return _0x476c69[_0x65a3('0x11')](0x1f4)[_0x65a3('0x13')](_0x4356cf);}return _0x476c69[_0x65a3('0x11')](0xc8)['json']({'output':_0x470a2c});});};exports[_0x65a3('0x1e')]=function(_0x1a8a9e,_0x246fd0){return pm2[_0x65a3('0x1e')](_0x65a3('0x1f'))[_0x65a3('0x20')](function(_0x1387a3){logger['info'](_0x65a3('0x21'),_0x1387a3);return _0x246fd0[_0x65a3('0x11')](0xc8)['json']({'output':_0x65a3('0x22')});})[_0x65a3('0x23')](function(_0x2312e5){logger['error'](_0x2312e5);return _0x246fd0[_0x65a3('0x11')](0x1f4)[_0x65a3('0x13')](_0x2312e5);});};exports[_0x65a3('0x24')]=function(_0x3bad7c,_0x5086e3){var _0x554d8a=fs[_0x65a3('0x25')](path[_0x65a3('0x26')](config[_0x65a3('0xa')],_0x65a3('0x27'),_0x65a3('0x24')));var _0x2b5372=[];for(var _0x2eb0fe=0x0;_0x2eb0fe<_0x554d8a[_0x65a3('0x28')];_0x2eb0fe++){var _0x1ea5bd=_0x554d8a[_0x2eb0fe][_0x65a3('0x29')](_0x65a3('0x2a'),'');if(compareVersions(module[_0x65a3('0x2b')][_0x65a3('0x2')],_0x1ea5bd)===-0x1){_0x2b5372['push'](_0x1ea5bd);}}if(_0x2b5372[_0x65a3('0x28')]){var _0x444718=_0x2b5372[_0x65a3('0x2c')](compareVersions);var _0x47a86f=new Umzug({'storage':_0x65a3('0x2d'),'storageOptions':{'model':db[_0x65a3('0x2e')],'modelName':_0x65a3('0x2e'),'columnName':_0x65a3('0x2')},'migrations':{'params':[db[_0x65a3('0x2d')]['getQueryInterface'](),db['sequelize'][_0x65a3('0x2f')],function(){throw new Error(_0x65a3('0x30'));}],'path':path[_0x65a3('0x26')](config['root'],_0x65a3('0x27'),_0x65a3('0x24')),'pattern':/\.js$/}});_0x47a86f['up']({'migrations':_[_0x65a3('0x31')](_0x444718,function(_0x46b6b6){return _0x46b6b6+'.js';})})[_0x65a3('0x20')](function(){return _0x5086e3['status'](0xc8)[_0x65a3('0x13')]({'output':_0x65a3('0x32')+module[_0x65a3('0x2b')][_0x65a3('0x2')]+_0x65a3('0x33')+_[_0x65a3('0x34')](_0x444718),'migrations':_[_0x65a3('0x26')](_0x444718)});})['catch'](function(_0x509c2f){if(_0x509c2f instanceof db[_0x65a3('0x2d')]['UniqueConstraintError']){return _0x5086e3[_0x65a3('0x11')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x5086e3['status'](0x1f4)['json'](_0x509c2f);}});}else{return _0x5086e3[_0x65a3('0x11')](0xc8)[_0x65a3('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x623c=['getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','latest','fetch','tags','status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','server','length','replace','.js','push','sort','sequelize','Migration'];(function(_0x54522a,_0x519c28){var _0x57def8=function(_0x2b91eb){while(--_0x2b91eb){_0x54522a['push'](_0x54522a['shift']());}};_0x57def8(++_0x519c28);}(_0x623c,0x14e));var _0xc623=function(_0x152a61,_0x133061){_0x152a61=_0x152a61-0x0;var _0x42e94c=_0x623c[_0x152a61];return _0x42e94c;};'use strict';var Umzug=require('umzug');var path=require(_0xc623('0x0'));var fs=require('fs');var _=require(_0xc623('0x1'));var pkginfo=require(_0xc623('0x2'))(module,_0xc623('0x3'));var compareVersions=require('compare-versions');var exec=require(_0xc623('0x4'))[_0xc623('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0xc623('0x6'));var pm2=require(_0xc623('0x7'));var logger=require(_0xc623('0x8'))(_0xc623('0x9'));var git=require(_0xc623('0xa'))(config[_0xc623('0xb')]);exports[_0xc623('0xc')]=function(_0x23f724,_0x2c42ed){var _0x3b2820={'current':module[_0xc623('0xd')][_0xc623('0x3')],'phonebar':0x2};if(_0x23f724['query']&&_0x23f724['query'][_0xc623('0xe')]){return git[_0xc623('0xf')]()[_0xc623('0x10')](function(_0x3e5568,_0x47d377){_0x3b2820[_0xc623('0xe')]=(_0x3e5568?module[_0xc623('0xd')][_0xc623('0x3')]:_0x47d377[_0xc623('0xe')])||'2.0.0';return _0x2c42ed[_0xc623('0x11')](0xc8)[_0xc623('0x12')](_0x3b2820);});}else{return _0x2c42ed['status'](0xc8)[_0xc623('0x12')](_0x3b2820);}};exports[_0xc623('0xf')]=function(_0x2bdd09,_0x3b4792){return git[_0xc623('0xf')](['origin',_0xc623('0x13')],function(_0x5eed5e){if(_0x5eed5e){logger[_0xc623('0x14')](_0x5eed5e);return _0x3b4792['status'](0x1f4)['json'](_0x5eed5e);}logger[_0xc623('0x15')](_0xc623('0x16'));return _0x3b4792[_0xc623('0x11')](0xc8)[_0xc623('0x12')]({'output':_0xc623('0x17')});});};exports[_0xc623('0x18')]=function(_0x217718,_0xdd8a25){return git[_0xc623('0x18')]([_0xc623('0x19'),'FETCH_HEAD'],function(_0xc8b7ef){if(_0xc8b7ef){logger[_0xc623('0x14')](_0xc8b7ef);return _0xdd8a25[_0xc623('0x11')](0x1f4)['json'](_0xc8b7ef);}logger[_0xc623('0x15')](_0xc623('0x1a'));return _0xdd8a25[_0xc623('0x11')](0xc8)[_0xc623('0x12')]({'output':_0xc623('0x1b')});});};exports['pull']=function(_0x17005b,_0x59f662){exec(_0xc623('0x1c'),function(_0x113646,_0x588610,_0x572691){logger[_0xc623('0x15')](_0x588610);logger[_0xc623('0x15')](_0x572691);if(_0x113646){logger[_0xc623('0x14')](_0x113646);return _0x59f662[_0xc623('0x11')](0x1f4)[_0xc623('0x12')](_0x113646);}return _0x59f662[_0xc623('0x11')](0xc8)[_0xc623('0x12')]({'output':_0x588610});});};exports['restart']=function(_0x2a9620,_0x50683e){return pm2[_0xc623('0x1d')](_0xc623('0x1e'))[_0xc623('0x1f')](function(_0x24786d){logger['info'](_0xc623('0x20'),_0x24786d);return _0x50683e['status'](0xc8)[_0xc623('0x12')]({'output':_0xc623('0x21')});})[_0xc623('0x22')](function(_0x358d3b){logger[_0xc623('0x14')](_0x358d3b);return _0x50683e[_0xc623('0x11')](0x1f4)[_0xc623('0x12')](_0x358d3b);});};exports[_0xc623('0x23')]=function(_0x5caac4,_0x37e12a){var _0xcce323=fs['readdirSync'](path['join'](config[_0xc623('0xb')],_0xc623('0x24'),_0xc623('0x23')));var _0x311f22=[];for(var _0x1788e5=0x0;_0x1788e5<_0xcce323[_0xc623('0x25')];_0x1788e5++){var _0x2198d3=_0xcce323[_0x1788e5][_0xc623('0x26')](_0xc623('0x27'),'');if(compareVersions(module[_0xc623('0xd')][_0xc623('0x3')],_0x2198d3)===-0x1){_0x311f22[_0xc623('0x28')](_0x2198d3);}}if(_0x311f22[_0xc623('0x25')]){var _0x5f488b=_0x311f22[_0xc623('0x29')](compareVersions);var _0x85a20c=new Umzug({'storage':_0xc623('0x2a'),'storageOptions':{'model':db[_0xc623('0x2b')],'modelName':_0xc623('0x2b'),'columnName':_0xc623('0x3')},'migrations':{'params':[db[_0xc623('0x2a')][_0xc623('0x2c')](),db[_0xc623('0x2a')][_0xc623('0x2d')],function(){throw new Error(_0xc623('0x2e'));}],'path':path[_0xc623('0x2f')](config[_0xc623('0xb')],_0xc623('0x24'),_0xc623('0x23')),'pattern':/\.js$/}});_0x85a20c['up']({'migrations':_[_0xc623('0x30')](_0x5f488b,function(_0x3bc9af){return _0x3bc9af+_0xc623('0x27');})})[_0xc623('0x1f')](function(){return _0x37e12a[_0xc623('0x11')](0xc8)['json']({'output':_0xc623('0x31')+module[_0xc623('0xd')]['version']+_0xc623('0x32')+_[_0xc623('0x33')](_0x5f488b),'migrations':_['join'](_0x5f488b)});})['catch'](function(_0x127e00){if(_0x127e00 instanceof db[_0xc623('0x2a')][_0xc623('0x34')]){return _0x37e12a['status'](0xc8)[_0xc623('0x12')]({'output':_0xc623('0x35')});}else{return _0x37e12a[_0xc623('0x11')](0x1f4)[_0xc623('0x12')](_0x127e00);}});}else{return _0x37e12a[_0xc623('0x11')](0xc8)[_0xc623('0x12')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index d02c889..48483de 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 _0x6698=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x63939,_0x56e783){var _0x41bb2e=function(_0x4fae3b){while(--_0x4fae3b){_0x63939['push'](_0x63939['shift']());}};_0x41bb2e(++_0x56e783);}(_0x6698,0x83));var _0x8669=function(_0x182622,_0x1d06e0){_0x182622=_0x182622-0x0;var _0x4cde14=_0x6698[_0x182622];return _0x4cde14;};'use strict';var multer=require(_0x8669('0x0'));var util=require('util');var path=require(_0x8669('0x1'));var timeout=require('connect-timeout');var express=require(_0x8669('0x2'));var router=express[_0x8669('0x3')]();var fs_extra=require(_0x8669('0x4'));var auth=require(_0x8669('0x5'));var interaction=require(_0x8669('0x6'));var config=require('../../config/environment');var controller=require(_0x8669('0x7'));router[_0x8669('0x8')]('/',auth[_0x8669('0x9')](),controller[_0x8669('0xa')]);router['get'](_0x8669('0xb'),auth[_0x8669('0x9')](),controller[_0x8669('0xc')]);router[_0x8669('0x8')](_0x8669('0xd'),auth[_0x8669('0x9')](),controller[_0x8669('0xe')]);router[_0x8669('0xf')]('/',auth['isAuthenticated'](),controller[_0x8669('0x10')]);router[_0x8669('0x11')](_0x8669('0xd'),auth[_0x8669('0x9')](),controller[_0x8669('0x12')]);router[_0x8669('0x13')](_0x8669('0xd'),auth[_0x8669('0x9')](),controller[_0x8669('0x14')]);module[_0x8669('0x15')]=router; \ No newline at end of file +var _0x2d43=['destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete'];(function(_0x217ff6,_0x36f75d){var _0x417c93=function(_0x4787d2){while(--_0x4787d2){_0x217ff6['push'](_0x217ff6['shift']());}};_0x417c93(++_0x36f75d);}(_0x2d43,0x12e));var _0x32d4=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x2d43[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require('multer');var util=require(_0x32d4('0x0'));var path=require(_0x32d4('0x1'));var timeout=require('connect-timeout');var express=require(_0x32d4('0x2'));var router=express[_0x32d4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x32d4('0x4'));var interaction=require(_0x32d4('0x5'));var config=require(_0x32d4('0x6'));var controller=require(_0x32d4('0x7'));router[_0x32d4('0x8')]('/',auth[_0x32d4('0x9')](),controller[_0x32d4('0xa')]);router[_0x32d4('0x8')](_0x32d4('0xb'),auth[_0x32d4('0x9')](),controller[_0x32d4('0xc')]);router['get'](_0x32d4('0xd'),auth[_0x32d4('0x9')](),controller[_0x32d4('0xe')]);router[_0x32d4('0xf')]('/',auth[_0x32d4('0x9')](),controller['create']);router['put'](_0x32d4('0xd'),auth['isAuthenticated'](),controller[_0x32d4('0x10')]);router[_0x32d4('0x11')](_0x32d4('0xd'),auth[_0x32d4('0x9')](),controller[_0x32d4('0x12')]);module[_0x32d4('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 217ea00..91630a1 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 _0xcd6f=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x5734e1,_0x3e1d75){var _0x22c784=function(_0x4fe1eb){while(--_0x4fe1eb){_0x5734e1['push'](_0x5734e1['shift']());}};_0x22c784(++_0x3e1d75);}(_0xcd6f,0x17b));var _0xfcd6=function(_0xfe3407,_0x2d93f9){_0xfe3407=_0xfe3407-0x0;var _0x2a86ba=_0xcd6f[_0xfe3407];return _0x2a86ba;};'use strict';var Sequelize=require(_0xfcd6('0x0'));module[_0xfcd6('0x1')]={'type':{'type':Sequelize[_0xfcd6('0x2')]},'uniqueid':{'type':Sequelize[_0xfcd6('0x2')]},'calleridnum':{'type':Sequelize[_0xfcd6('0x2')]},'calleridname':{'type':Sequelize[_0xfcd6('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xfcd6('0x2')]},'membername':{'type':Sequelize[_0xfcd6('0x2')]},'agentcalledAt':{'type':Sequelize[_0xfcd6('0x3')]},'agentconnectAt':{'type':Sequelize[_0xfcd6('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xfcd6('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xfcd6('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xfcd6('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xfcd6('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xfcd6('0x2')]},'accountcode':{'type':Sequelize[_0xfcd6('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xfcd6('0x2')]},'priority':{'type':Sequelize[_0xfcd6('0x2')]},'destchannel':{'type':Sequelize[_0xfcd6('0x2')]},'destchannelstate':{'type':Sequelize[_0xfcd6('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xfcd6('0x2')]},'destcalleridnum':{'type':Sequelize[_0xfcd6('0x2')]},'destcalleridname':{'type':Sequelize[_0xfcd6('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xfcd6('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xfcd6('0x2')]},'destlanguage':{'type':Sequelize[_0xfcd6('0x2')]},'destaccountcode':{'type':Sequelize[_0xfcd6('0x2')]},'destcontext':{'type':Sequelize[_0xfcd6('0x2')]},'destexten':{'type':Sequelize[_0xfcd6('0x2')]},'destpriority':{'type':Sequelize[_0xfcd6('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xfcd6('0x2')]},'transfer':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xfcd6('0x6')},'transferexten':{'type':Sequelize[_0xfcd6('0x2')]},'transferuniqueid':{'type':Sequelize[_0xfcd6('0x2')]},'agententerreason':{'type':Sequelize[_0xfcd6('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3da6=['DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3da6,0xc1));var _0x63da=function(_0x2ad4e0,_0x4f0a5c){_0x2ad4e0=_0x2ad4e0-0x0;var _0x5ef8a7=_0x3da6[_0x2ad4e0];return _0x5ef8a7;};'use strict';var Sequelize=require(_0x63da('0x0'));module[_0x63da('0x1')]={'type':{'type':Sequelize[_0x63da('0x2')]},'uniqueid':{'type':Sequelize[_0x63da('0x2')]},'calleridnum':{'type':Sequelize[_0x63da('0x2')]},'calleridname':{'type':Sequelize[_0x63da('0x2')]},'queue':{'type':Sequelize[_0x63da('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x63da('0x2')]},'agentcalledAt':{'type':Sequelize[_0x63da('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x63da('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x63da('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x63da('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x63da('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x63da('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x63da('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x63da('0x5')]},'reason':{'type':Sequelize[_0x63da('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x63da('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x63da('0x2')]},'connectedlinenum':{'type':Sequelize[_0x63da('0x2')]},'connectedlinename':{'type':Sequelize[_0x63da('0x2')]},'language':{'type':Sequelize[_0x63da('0x2')]},'accountcode':{'type':Sequelize[_0x63da('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x63da('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x63da('0x2')]},'destchannelstate':{'type':Sequelize[_0x63da('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x63da('0x2')]},'destcalleridnum':{'type':Sequelize[_0x63da('0x2')]},'destcalleridname':{'type':Sequelize[_0x63da('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x63da('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x63da('0x2')]},'destlanguage':{'type':Sequelize[_0x63da('0x2')]},'destaccountcode':{'type':Sequelize[_0x63da('0x2')]},'destcontext':{'type':Sequelize[_0x63da('0x2')]},'destexten':{'type':Sequelize[_0x63da('0x2')]},'destpriority':{'type':Sequelize[_0x63da('0x2')]},'destuniqueid':{'type':Sequelize[_0x63da('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x63da('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x63da('0x6')},'transferexten':{'type':Sequelize[_0x63da('0x2')]},'transferuniqueid':{'type':Sequelize[_0x63da('0x2')]},'agententerreason':{'type':Sequelize[_0x63da('0x5')],'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 23f7ae0..965bb45 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(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];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 4e65c25..1763abf 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 _0x2e8a=['destuniqueid','util','../../config/logger','moment','bluebird','path','define','report_agent','uniqueid'];(function(_0x175290,_0x42e572){var _0x52bd78=function(_0xea7cc7){while(--_0xea7cc7){_0x175290['push'](_0x175290['shift']());}};_0x52bd78(++_0x42e572);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x30b057,_0x1d1505){_0x30b057=_0x30b057-0x0;var _0x331671=_0x2e8a[_0x30b057];return _0x331671;};'use strict';var _=require('lodash');var util=require(_0xa2e8('0x0'));var logger=require(_0xa2e8('0x1'))('api');var moment=require(_0xa2e8('0x2'));var BPromise=require(_0xa2e8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2e8('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x4593d2,_0x32fb35){return _0x4593d2[_0xa2e8('0x5')]('VoiceAgentReport',attributes,{'tableName':_0xa2e8('0x6'),'paranoid':![],'indexes':[{'fields':[_0xa2e8('0x7'),_0xa2e8('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0618=['util','api','moment','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','lodash'];(function(_0x332339,_0x3a98e1){var _0x2d78e9=function(_0x574ea5){while(--_0x574ea5){_0x332339['push'](_0x332339['shift']());}};_0x2d78e9(++_0x3a98e1);}(_0x0618,0x1c6));var _0x8061=function(_0x426706,_0x5a7138){_0x426706=_0x426706-0x0;var _0x2288d1=_0x0618[_0x426706];return _0x2288d1;};'use strict';var _=require(_0x8061('0x0'));var util=require(_0x8061('0x1'));var logger=require('../../config/logger')(_0x8061('0x2'));var moment=require(_0x8061('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8061('0x4'));var rimraf=require(_0x8061('0x5'));var config=require(_0x8061('0x6'));var attributes=require(_0x8061('0x7'));module[_0x8061('0x8')]=function(_0x2c47b6,_0x1cca7f){return _0x2c47b6[_0x8061('0x9')](_0x8061('0xa'),attributes,{'tableName':_0x8061('0xb'),'paranoid':![],'indexes':[{'fields':[_0x8061('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index b3e04e6..c7b42fa 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 _0x20e7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','update','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x56ec18,_0x38a5da){var _0x150509=function(_0x4e80d0){while(--_0x4e80d0){_0x56ec18['push'](_0x56ec18['shift']());}};_0x150509(++_0x38a5da);}(_0x20e7,0x1a9));var _0x720e=function(_0xcd812c,_0x41e128){_0xcd812c=_0xcd812c-0x0;var _0x40996a=_0x20e7[_0xcd812c];return _0x40996a;};'use strict';var _=require(_0x720e('0x0'));var util=require(_0x720e('0x1'));var moment=require('moment');var BPromise=require(_0x720e('0x2'));var rs=require(_0x720e('0x3'));var fs=require('fs');var Redis=require(_0x720e('0x4'));var db=require(_0x720e('0x5'))['db'];var utils=require(_0x720e('0x6'));var logger=require(_0x720e('0x7'))(_0x720e('0x8'));var config=require(_0x720e('0x9'));var jayson=require(_0x720e('0xa'));var client=jayson[_0x720e('0xb')][_0x720e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x455e7d,_0x3b3c0d,_0x6d3d68){return new BPromise(function(_0x46dfff,_0x48c62f){return client[_0x720e('0xd')](_0x455e7d,_0x6d3d68)[_0x720e('0xe')](function(_0x3a136d){logger[_0x720e('0xf')](_0x720e('0x10'),_0x3b3c0d,'request\x20sent');logger[_0x720e('0x11')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x3b3c0d,'request\x20sent',JSON[_0x720e('0x12')](_0x3a136d));if(_0x3a136d[_0x720e('0x13')]){if(_0x3a136d['error'][_0x720e('0x14')]===0x1f4){logger[_0x720e('0x13')](_0x720e('0x10'),_0x3b3c0d,_0x3a136d['error'][_0x720e('0x15')]);return _0x48c62f(_0x3a136d[_0x720e('0x13')][_0x720e('0x15')]);}logger['error'](_0x720e('0x10'),_0x3b3c0d,_0x3a136d[_0x720e('0x13')][_0x720e('0x15')]);return _0x46dfff(_0x3a136d[_0x720e('0x13')]['message']);}else{logger[_0x720e('0xf')](_0x720e('0x10'),_0x3b3c0d,_0x720e('0x16'));_0x46dfff(_0x3a136d[_0x720e('0x17')]['message']);}})[_0x720e('0x18')](function(_0x48ab5c){logger[_0x720e('0x13')](_0x720e('0x10'),_0x3b3c0d,_0x48ab5c);_0x48c62f(_0x48ab5c);});});}exports[_0x720e('0x19')]=function(_0x271821){var _0x1b4c54=this;return new Promise(function(_0x57344b,_0x3f3d55){return db[_0x720e('0x1a')][_0x720e('0x1b')](_0x271821[_0x720e('0x1c')],{'raw':_0x271821[_0x720e('0x1d')]?_0x271821[_0x720e('0x1d')][_0x720e('0x1e')]===undefined?!![]:![]:!![]})[_0x720e('0xe')](function(_0x68d7fc){logger[_0x720e('0xf')](_0x720e('0x19'),_0x271821);logger[_0x720e('0x11')]('CreateVoiceAgentReport',_0x271821,JSON[_0x720e('0x12')](_0x68d7fc));_0x57344b(_0x68d7fc);})[_0x720e('0x18')](function(_0x5e022c){logger['error'](_0x720e('0x19'),_0x5e022c[_0x720e('0x15')],_0x271821);_0x3f3d55(_0x1b4c54[_0x720e('0x13')](0x1f4,_0x5e022c[_0x720e('0x15')]));});});};exports['UpdateVoiceAgentReport']=function(_0x307f01){var _0x3b0a44=this;return new Promise(function(_0x431122,_0x173c5c){return db[_0x720e('0x1a')][_0x720e('0x1f')](_0x307f01['body'],{'raw':_0x307f01['options']?_0x307f01[_0x720e('0x1d')][_0x720e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x307f01[_0x720e('0x1d')]?_0x307f01['options'][_0x720e('0x20')]||null:null,'attributes':_0x307f01['options']?_0x307f01[_0x720e('0x1d')][_0x720e('0x21')]||null:null,'limit':_0x307f01[_0x720e('0x1d')]?_0x307f01[_0x720e('0x1d')][_0x720e('0x22')]||null:null})['then'](function(_0x2eb807){logger[_0x720e('0xf')](_0x720e('0x23'),_0x307f01);logger[_0x720e('0x11')]('UpdateVoiceAgentReport',_0x307f01,JSON[_0x720e('0x12')](_0x2eb807));_0x431122(_0x2eb807);})[_0x720e('0x18')](function(_0x35e05c){logger['error']('UpdateVoiceAgentReport',_0x35e05c[_0x720e('0x15')],_0x307f01);_0x173c5c(_0x3b0a44[_0x720e('0x13')](0x1f4,_0x35e05c['message']));});});}; \ No newline at end of file +var _0xfae3=['options','raw','debug','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceAgentReport','create','body'];(function(_0x241ca9,_0x4d8a2f){var _0x13d5c5=function(_0x594c95){while(--_0x594c95){_0x241ca9['push'](_0x241ca9['shift']());}};_0x13d5c5(++_0x4d8a2f);}(_0xfae3,0x15d));var _0x3fae=function(_0x10e74e,_0x1603ae){_0x10e74e=_0x10e74e-0x0;var _0x2198c1=_0xfae3[_0x10e74e];return _0x2198c1;};'use strict';var _=require(_0x3fae('0x0'));var util=require(_0x3fae('0x1'));var moment=require(_0x3fae('0x2'));var BPromise=require(_0x3fae('0x3'));var rs=require(_0x3fae('0x4'));var fs=require('fs');var Redis=require(_0x3fae('0x5'));var db=require(_0x3fae('0x6'))['db'];var utils=require(_0x3fae('0x7'));var logger=require(_0x3fae('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x345c70,_0x2fa869,_0x2b4fca){return new BPromise(function(_0x555929,_0x37856a){return client[_0x3fae('0x9')](_0x345c70,_0x2b4fca)[_0x3fae('0xa')](function(_0x1d8246){logger[_0x3fae('0xb')](_0x3fae('0xc'),_0x2fa869,_0x3fae('0xd'));logger['debug'](_0x3fae('0xe'),_0x2fa869,'request\x20sent',JSON[_0x3fae('0xf')](_0x1d8246));if(_0x1d8246[_0x3fae('0x10')]){if(_0x1d8246[_0x3fae('0x10')][_0x3fae('0x11')]===0x1f4){logger[_0x3fae('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x2fa869,_0x1d8246[_0x3fae('0x10')][_0x3fae('0x12')]);return _0x37856a(_0x1d8246[_0x3fae('0x10')]['message']);}logger[_0x3fae('0x10')](_0x3fae('0xc'),_0x2fa869,_0x1d8246['error']['message']);return _0x555929(_0x1d8246[_0x3fae('0x10')]['message']);}else{logger[_0x3fae('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x2fa869,_0x3fae('0xd'));_0x555929(_0x1d8246['result'][_0x3fae('0x12')]);}})[_0x3fae('0x13')](function(_0x4ce05f){logger[_0x3fae('0x10')](_0x3fae('0xc'),_0x2fa869,_0x4ce05f);_0x37856a(_0x4ce05f);});});}exports[_0x3fae('0x14')]=function(_0x2d3820){var _0x3b25ed=this;return new Promise(function(_0x5e1c68,_0x5dcb57){return db['VoiceAgentReport'][_0x3fae('0x15')](_0x2d3820[_0x3fae('0x16')],{'raw':_0x2d3820[_0x3fae('0x17')]?_0x2d3820[_0x3fae('0x17')][_0x3fae('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x59b7c5){logger[_0x3fae('0xb')](_0x3fae('0x14'),_0x2d3820);logger[_0x3fae('0x19')]('CreateVoiceAgentReport',_0x2d3820,JSON[_0x3fae('0xf')](_0x59b7c5));_0x5e1c68(_0x59b7c5);})['catch'](function(_0x23caef){logger[_0x3fae('0x10')](_0x3fae('0x14'),_0x23caef[_0x3fae('0x12')],_0x2d3820);_0x5dcb57(_0x3b25ed[_0x3fae('0x10')](0x1f4,_0x23caef['message']));});});};exports[_0x3fae('0x1a')]=function(_0x2114ee){var _0x58ab0e=this;return new Promise(function(_0x1b06f7,_0x535580){return db['VoiceAgentReport'][_0x3fae('0x1b')](_0x2114ee[_0x3fae('0x16')],{'raw':_0x2114ee[_0x3fae('0x17')]?_0x2114ee[_0x3fae('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2114ee[_0x3fae('0x17')]?_0x2114ee[_0x3fae('0x17')][_0x3fae('0x1c')]||null:null,'attributes':_0x2114ee[_0x3fae('0x17')]?_0x2114ee[_0x3fae('0x17')][_0x3fae('0x1d')]||null:null,'limit':_0x2114ee['options']?_0x2114ee[_0x3fae('0x17')][_0x3fae('0x1e')]||null:null})[_0x3fae('0xa')](function(_0x4589d9){logger[_0x3fae('0xb')](_0x3fae('0x1a'),_0x2114ee);logger[_0x3fae('0x19')](_0x3fae('0x1a'),_0x2114ee,JSON[_0x3fae('0xf')](_0x4589d9));_0x1b06f7(_0x4589d9);})[_0x3fae('0x13')](function(_0x1cadd1){logger[_0x3fae('0x10')]('UpdateVoiceAgentReport',_0x1cadd1[_0x3fae('0x12')],_0x2114ee);_0x535580(_0x58ab0e[_0x3fae('0x10')](0x1f4,_0x1cadd1[_0x3fae('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 82815a1..242082f 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 _0x2d17=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','show','post','create','put','/:id','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d17,0x17e));var _0x72d1=function(_0x19698d,_0x116676){_0x19698d=_0x19698d-0x0;var _0xee6db7=_0x2d17[_0x19698d];return _0xee6db7;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var fs_extra=require(_0x72d1('0x4'));var auth=require(_0x72d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x72d1('0x6'));var controller=require('./voiceCallReport.controller');router[_0x72d1('0x7')]('/',auth['isAuthenticated'](),controller[_0x72d1('0x8')]);router[_0x72d1('0x7')]('/describe',auth[_0x72d1('0x9')](),controller[_0x72d1('0xa')]);router[_0x72d1('0x7')]('/:id',auth[_0x72d1('0x9')](),controller[_0x72d1('0xb')]);router[_0x72d1('0xc')]('/',auth['isAuthenticated'](),controller[_0x72d1('0xd')]);router[_0x72d1('0xe')](_0x72d1('0xf'),auth[_0x72d1('0x9')](),controller[_0x72d1('0x10')]);router[_0x72d1('0x11')](_0x72d1('0xf'),auth[_0x72d1('0x9')](),controller[_0x72d1('0x12')]);module[_0x72d1('0x13')]=router; \ No newline at end of file +var _0x5fc3=['/:id','show','post','create','put','update','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe'];(function(_0x534d06,_0x37270b){var _0x11c86a=function(_0xc9c6ff){while(--_0xc9c6ff){_0x534d06['push'](_0x534d06['shift']());}};_0x11c86a(++_0x37270b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0x5fc3[_0x695b76];return _0x1dc21f;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index fd3cd51..e499b52 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 _0x46c2=['ENUM','inbound','internal','outbound','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x2ad56d,_0x9322e3){var _0x3da082=function(_0x4fc813){while(--_0x4fc813){_0x2ad56d['push'](_0x2ad56d['shift']());}};_0x3da082(++_0x9322e3);}(_0x46c2,0x180));var _0x246c=function(_0x372ab6,_0x1b9e57){_0x372ab6=_0x372ab6-0x0;var _0x14b88f=_0x46c2[_0x372ab6];return _0x14b88f;};'use strict';var Sequelize=require(_0x246c('0x0'));module[_0x246c('0x1')]={'uniqueid':{'type':Sequelize[_0x246c('0x2')]},'type':{'type':Sequelize[_0x246c('0x3')](_0x246c('0x4'),_0x246c('0x5'),_0x246c('0x6'),'inbound-fax','outbound-fax','dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x246c('0x2')]},'destination':{'type':Sequelize[_0x246c('0x2')]},'destinationcontext':{'type':Sequelize[_0x246c('0x2')]},'callerid':{'type':Sequelize[_0x246c('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x246c('0x2')]},'lastapplication':{'type':Sequelize[_0x246c('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x246c('0x7')]},'systemanswertime':{'type':Sequelize[_0x246c('0x7')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x246c('0x2')]},'userfield':{'type':Sequelize[_0x246c('0x2')]},'userDisposition':{'type':Sequelize[_0x246c('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x246c('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x246c('0x2')]},'routeid':{'type':Sequelize[_0x246c('0x8')]},'sipcallid':{'type':Sequelize[_0x246c('0x2')]}}; \ No newline at end of file +var _0xe820=['TEXT','DATE','INTEGER','sequelize','STRING','internal','outbound','inbound-fax','dialer'];(function(_0x1c3f09,_0x342d1c){var _0x3ebaad=function(_0x54df20){while(--_0x54df20){_0x1c3f09['push'](_0x1c3f09['shift']());}};_0x3ebaad(++_0x342d1c);}(_0xe820,0xd2));var _0x0e82=function(_0x3dc7e4,_0x22bfac){_0x3dc7e4=_0x3dc7e4-0x0;var _0x57329e=_0xe820[_0x3dc7e4];return _0x57329e;};'use strict';var Sequelize=require(_0x0e82('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0e82('0x1')]},'type':{'type':Sequelize['ENUM']('inbound',_0x0e82('0x2'),_0x0e82('0x3'),_0x0e82('0x4'),'outbound-fax',_0x0e82('0x5'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0e82('0x1')]},'source':{'type':Sequelize[_0x0e82('0x1')]},'destination':{'type':Sequelize[_0x0e82('0x1')]},'destinationcontext':{'type':Sequelize[_0x0e82('0x1')]},'callerid':{'type':Sequelize[_0x0e82('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x0e82('0x1')]},'lastapplication':{'type':Sequelize[_0x0e82('0x1')]},'lastdata':{'type':Sequelize[_0x0e82('0x6')]},'starttime':{'type':Sequelize[_0x0e82('0x7')]},'systemanswertime':{'type':Sequelize[_0x0e82('0x7')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x0e82('0x7')]},'duration':{'type':Sequelize[_0x0e82('0x8')]},'billableseconds':{'type':Sequelize[_0x0e82('0x8')]},'mohtime':{'type':Sequelize[_0x0e82('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0e82('0x1')]},'amaflags':{'type':Sequelize[_0x0e82('0x1')]},'userfield':{'type':Sequelize[_0x0e82('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0e82('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x0e82('0x1')]},'note':{'type':Sequelize[_0x0e82('0x1')]},'prefix':{'type':Sequelize[_0x0e82('0x1')]},'routeid':{'type':Sequelize[_0x0e82('0x8')]},'sipcallid':{'type':Sequelize[_0x0e82('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index aa726fe..73fbb13 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(_0x26efac,_0x21ab8a){var _0x8482e4=function(_0x14db32){while(--_0x14db32){_0x26efac['push'](_0x26efac['shift']());}};_0x8482e4(++_0x21ab8a);}(_0xadb5,0xad));var _0x5adb=function(_0x2f9b0d,_0x2dd212){_0x2f9b0d=_0x2f9b0d-0x0;var _0x323b49=_0xadb5[_0x2f9b0d];return _0x323b49;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x53c679,_0xd36565){var _0x50e85d=function(_0x2ecbab){while(--_0x2ecbab){_0x53c679['push'](_0x53c679['shift']());}};_0x50e85d(++_0xd36565);}(_0x0b0e,0x187));var _0xe0b0=function(_0x56355a,_0x138baf){_0x56355a=_0x56355a-0x0;var _0x573afa=_0x0b0e[_0x56355a];return _0x573afa;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index cb103ca..6206d77 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 _0x65fd=['api','bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger'];(function(_0x5c6d95,_0x2b311f){var _0x2ecb56=function(_0x45e9d7){while(--_0x45e9d7){_0x5c6d95['push'](_0x5c6d95['shift']());}};_0x2ecb56(++_0x2b311f);}(_0x65fd,0x185));var _0xd65f=function(_0xbbd43e,_0xd974b7){_0xbbd43e=_0xbbd43e-0x0;var _0x5bb007=_0x65fd[_0xbbd43e];return _0x5bb007;};'use strict';var _=require(_0xd65f('0x0'));var util=require(_0xd65f('0x1'));var logger=require(_0xd65f('0x2'))(_0xd65f('0x3'));var moment=require('moment');var BPromise=require(_0xd65f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd65f('0x5'));var rimraf=require(_0xd65f('0x6'));var config=require(_0xd65f('0x7'));var attributes=require(_0xd65f('0x8'));module[_0xd65f('0x9')]=function(_0x4ae3ad,_0x5f1ce8){return _0x4ae3ad[_0xd65f('0xa')](_0xd65f('0xb'),attributes,{'tableName':_0xd65f('0xc'),'paranoid':![],'indexes':[{'fields':[_0xd65f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x51a1=['request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','VoiceCallReport','report_call','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x53fb01,_0x5c6f99){var _0x4d9126=function(_0x256f88){while(--_0x256f88){_0x53fb01['push'](_0x53fb01['shift']());}};_0x4d9126(++_0x5c6f99);}(_0x51a1,0x1b7));var _0x151a=function(_0x5c3afe,_0x50a0e0){_0x5c3afe=_0x5c3afe-0x0;var _0x222563=_0x51a1[_0x5c3afe];return _0x222563;};'use strict';var _=require(_0x151a('0x0'));var util=require(_0x151a('0x1'));var logger=require('../../config/logger')(_0x151a('0x2'));var moment=require(_0x151a('0x3'));var BPromise=require(_0x151a('0x4'));var rp=require(_0x151a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x151a('0x6'));var config=require(_0x151a('0x7'));var attributes=require(_0x151a('0x8'));module['exports']=function(_0x2d8fba,_0x5cf0e7){return _0x2d8fba['define'](_0x151a('0x9'),attributes,{'tableName':_0x151a('0xa'),'paranoid':![],'indexes':[{'fields':[_0x151a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index f755334..e3acb9d 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 _0xb248=['request\x20sent','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','map','include','model','then','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','limit','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message'];(function(_0x26f045,_0x265039){var _0x4d0603=function(_0x10ab3e){while(--_0x10ab3e){_0x26f045['push'](_0x26f045['shift']());}};_0x4d0603(++_0x265039);}(_0xb248,0x1db));var _0x8b24=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xb248[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x8b24('0x0'));var util=require('util');var moment=require(_0x8b24('0x1'));var BPromise=require(_0x8b24('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b24('0x3'))['db'];var utils=require(_0x8b24('0x4'));var logger=require(_0x8b24('0x5'))(_0x8b24('0x6'));var config=require(_0x8b24('0x7'));var jayson=require(_0x8b24('0x8'));var client=jayson[_0x8b24('0x9')][_0x8b24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4327e1,_0x77a20a,_0x1e613b){return new BPromise(function(_0x2b190d,_0x129880){return client['request'](_0x4327e1,_0x1e613b)['then'](function(_0x55b41b){logger[_0x8b24('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x77a20a,'request\x20sent');logger[_0x8b24('0xc')](_0x8b24('0xd'),_0x77a20a,'request\x20sent',JSON[_0x8b24('0xe')](_0x55b41b));if(_0x55b41b[_0x8b24('0xf')]){if(_0x55b41b['error'][_0x8b24('0x10')]===0x1f4){logger[_0x8b24('0xf')](_0x8b24('0x11'),_0x77a20a,_0x55b41b[_0x8b24('0xf')][_0x8b24('0x12')]);return _0x129880(_0x55b41b[_0x8b24('0xf')][_0x8b24('0x12')]);}logger[_0x8b24('0xf')](_0x8b24('0x11'),_0x77a20a,_0x55b41b[_0x8b24('0xf')]['message']);return _0x2b190d(_0x55b41b[_0x8b24('0xf')]['message']);}else{logger[_0x8b24('0xb')](_0x8b24('0x11'),_0x77a20a,_0x8b24('0x13'));_0x2b190d(_0x55b41b['result'][_0x8b24('0x12')]);}})[_0x8b24('0x14')](function(_0x458fea){logger[_0x8b24('0xf')](_0x8b24('0x11'),_0x77a20a,_0x458fea);_0x129880(_0x458fea);});});}exports[_0x8b24('0x15')]=function(_0x3fed1b){var _0x2eaec4=this;return new Promise(function(_0x15ccd6,_0xc4cb1f){return db[_0x8b24('0x16')][_0x8b24('0x17')]({'raw':_0x3fed1b[_0x8b24('0x18')]?_0x3fed1b['options'][_0x8b24('0x19')]===undefined?!![]:![]:!![],'where':_0x3fed1b[_0x8b24('0x18')]?_0x3fed1b[_0x8b24('0x18')][_0x8b24('0x1a')]||null:null,'attributes':_0x3fed1b[_0x8b24('0x18')]?_0x3fed1b[_0x8b24('0x18')][_0x8b24('0x1b')]||null:null,'limit':_0x3fed1b[_0x8b24('0x18')]?_0x3fed1b[_0x8b24('0x18')]['limit']||null:null,'include':_0x3fed1b[_0x8b24('0x18')]?_0x3fed1b[_0x8b24('0x18')]['include']?_[_0x8b24('0x1c')](_0x3fed1b['options'][_0x8b24('0x1d')],function(_0x42caac){return{'model':db[_0x42caac[_0x8b24('0x1e')]],'as':_0x42caac['as'],'attributes':_0x42caac['attributes'],'include':_0x42caac[_0x8b24('0x1d')]?_['map'](_0x42caac['include'],function(_0x1dc806){return{'model':db[_0x1dc806[_0x8b24('0x1e')]],'as':_0x1dc806['as'],'attributes':_0x1dc806['attributes'],'include':_0x1dc806[_0x8b24('0x1d')]?_['map'](_0x1dc806['include'],function(_0x41df96){return{'model':db[_0x41df96[_0x8b24('0x1e')]],'as':_0x41df96['as'],'attributes':_0x41df96[_0x8b24('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8b24('0x1f')](function(_0x1be526){logger['info'](_0x8b24('0x15'),_0x3fed1b);logger[_0x8b24('0xc')](_0x8b24('0x15'),_0x3fed1b,JSON[_0x8b24('0xe')](_0x1be526));_0x15ccd6(_0x1be526);})[_0x8b24('0x14')](function(_0x1fcb7f){logger[_0x8b24('0xf')](_0x8b24('0x15'),_0x1fcb7f[_0x8b24('0x12')],_0x3fed1b);_0xc4cb1f(_0x2eaec4['error'](0x1f4,_0x1fcb7f[_0x8b24('0x12')]));});});};exports[_0x8b24('0x20')]=function(_0x5c4607){var _0x1690f9=this;return new Promise(function(_0x228d2f,_0x3b84e2){return db['VoiceCallReport'][_0x8b24('0x21')](_0x5c4607[_0x8b24('0x22')],{'raw':_0x5c4607[_0x8b24('0x18')]?_0x5c4607['options'][_0x8b24('0x19')]===undefined?!![]:![]:!![]})[_0x8b24('0x1f')](function(_0x40a64d){logger['info'](_0x8b24('0x20'),_0x5c4607);logger[_0x8b24('0xc')](_0x8b24('0x20'),_0x5c4607,JSON[_0x8b24('0xe')](_0x40a64d));_0x228d2f(_0x40a64d);})[_0x8b24('0x14')](function(_0x2b4240){logger[_0x8b24('0xf')]('CreateVoiceCallReport',_0x2b4240[_0x8b24('0x12')],_0x5c4607);_0x3b84e2(_0x1690f9[_0x8b24('0xf')](0x1f4,_0x2b4240[_0x8b24('0x12')]));});});};exports[_0x8b24('0x23')]=function(_0x1812b7){var _0x42991a=this;return new Promise(function(_0x48d7ae,_0x93aa41){return db[_0x8b24('0x16')][_0x8b24('0x24')](_0x1812b7[_0x8b24('0x22')],{'raw':_0x1812b7['options']?_0x1812b7[_0x8b24('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1812b7[_0x8b24('0x18')]?_0x1812b7[_0x8b24('0x18')][_0x8b24('0x1a')]||null:null,'attributes':_0x1812b7['options']?_0x1812b7[_0x8b24('0x18')][_0x8b24('0x1b')]||null:null,'limit':_0x1812b7[_0x8b24('0x18')]?_0x1812b7['options'][_0x8b24('0x25')]||null:null})[_0x8b24('0x1f')](function(_0xb65363){logger['info'](_0x8b24('0x23'),_0x1812b7);logger['debug']('UpdateVoiceCallReport',_0x1812b7,JSON[_0x8b24('0xe')](_0xb65363));_0x48d7ae(_0xb65363);})[_0x8b24('0x14')](function(_0x1cd748){logger[_0x8b24('0xf')](_0x8b24('0x23'),_0x1cd748[_0x8b24('0x12')],_0x1812b7);_0x93aa41(_0x42991a['error'](0x1f4,_0x1cd748[_0x8b24('0x12')]));});});}; \ No newline at end of file +var _0x0354=['request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','map','model','include','catch','CreateVoiceCallReport','create','body','then','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x21df35,_0x47c3f7){var _0x4b5524=function(_0x4470d){while(--_0x4470d){_0x21df35['push'](_0x21df35['shift']());}};_0x4b5524(++_0x47c3f7);}(_0x0354,0x196));var _0x4035=function(_0x1d8cf8,_0x4e1e5b){_0x1d8cf8=_0x1d8cf8-0x0;var _0x22f848=_0x0354[_0x1d8cf8];return _0x22f848;};'use strict';var _=require(_0x4035('0x0'));var util=require(_0x4035('0x1'));var moment=require(_0x4035('0x2'));var BPromise=require(_0x4035('0x3'));var rs=require(_0x4035('0x4'));var fs=require('fs');var Redis=require(_0x4035('0x5'));var db=require(_0x4035('0x6'))['db'];var utils=require(_0x4035('0x7'));var logger=require(_0x4035('0x8'))(_0x4035('0x9'));var config=require(_0x4035('0xa'));var jayson=require(_0x4035('0xb'));var client=jayson[_0x4035('0xc')][_0x4035('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x28c9e0,_0x1f6363,_0x14a971){return new BPromise(function(_0x4fbedb,_0x54a7bf){return client[_0x4035('0xe')](_0x28c9e0,_0x14a971)['then'](function(_0x61538a){logger[_0x4035('0xf')](_0x4035('0x10'),_0x1f6363,_0x4035('0x11'));logger[_0x4035('0x12')](_0x4035('0x13'),_0x1f6363,_0x4035('0x11'),JSON[_0x4035('0x14')](_0x61538a));if(_0x61538a[_0x4035('0x15')]){if(_0x61538a[_0x4035('0x15')]['code']===0x1f4){logger[_0x4035('0x15')]('VoiceCallReport,\x20%s,\x20%s',_0x1f6363,_0x61538a[_0x4035('0x15')][_0x4035('0x16')]);return _0x54a7bf(_0x61538a[_0x4035('0x15')][_0x4035('0x16')]);}logger[_0x4035('0x15')](_0x4035('0x10'),_0x1f6363,_0x61538a[_0x4035('0x15')]['message']);return _0x4fbedb(_0x61538a[_0x4035('0x15')]['message']);}else{logger[_0x4035('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x1f6363,_0x4035('0x11'));_0x4fbedb(_0x61538a[_0x4035('0x17')][_0x4035('0x16')]);}})['catch'](function(_0x335ffe){logger[_0x4035('0x15')](_0x4035('0x10'),_0x1f6363,_0x335ffe);_0x54a7bf(_0x335ffe);});});}exports[_0x4035('0x18')]=function(_0x4c9683){var _0x2a84c2=this;return new Promise(function(_0x230043,_0x187b91){return db[_0x4035('0x19')][_0x4035('0x1a')]({'raw':_0x4c9683[_0x4035('0x1b')]?_0x4c9683['options'][_0x4035('0x1c')]===undefined?!![]:![]:!![],'where':_0x4c9683[_0x4035('0x1b')]?_0x4c9683[_0x4035('0x1b')][_0x4035('0x1d')]||null:null,'attributes':_0x4c9683[_0x4035('0x1b')]?_0x4c9683[_0x4035('0x1b')][_0x4035('0x1e')]||null:null,'limit':_0x4c9683[_0x4035('0x1b')]?_0x4c9683[_0x4035('0x1b')][_0x4035('0x1f')]||null:null,'include':_0x4c9683[_0x4035('0x1b')]?_0x4c9683['options']['include']?_[_0x4035('0x20')](_0x4c9683[_0x4035('0x1b')]['include'],function(_0x5aa45e){return{'model':db[_0x5aa45e[_0x4035('0x21')]],'as':_0x5aa45e['as'],'attributes':_0x5aa45e[_0x4035('0x1e')],'include':_0x5aa45e[_0x4035('0x22')]?_['map'](_0x5aa45e[_0x4035('0x22')],function(_0x2fb9b9){return{'model':db[_0x2fb9b9[_0x4035('0x21')]],'as':_0x2fb9b9['as'],'attributes':_0x2fb9b9[_0x4035('0x1e')],'include':_0x2fb9b9[_0x4035('0x22')]?_[_0x4035('0x20')](_0x2fb9b9[_0x4035('0x22')],function(_0x338731){return{'model':db[_0x338731['model']],'as':_0x338731['as'],'attributes':_0x338731[_0x4035('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b590c){logger['info']('GetVoiceCallReport',_0x4c9683);logger[_0x4035('0x12')](_0x4035('0x18'),_0x4c9683,JSON[_0x4035('0x14')](_0x5b590c));_0x230043(_0x5b590c);})[_0x4035('0x23')](function(_0x391fa0){logger['error'](_0x4035('0x18'),_0x391fa0[_0x4035('0x16')],_0x4c9683);_0x187b91(_0x2a84c2[_0x4035('0x15')](0x1f4,_0x391fa0['message']));});});};exports[_0x4035('0x24')]=function(_0x489bcf){var _0x2499b7=this;return new Promise(function(_0x452ec3,_0x5456ac){return db[_0x4035('0x19')][_0x4035('0x25')](_0x489bcf[_0x4035('0x26')],{'raw':_0x489bcf[_0x4035('0x1b')]?_0x489bcf[_0x4035('0x1b')][_0x4035('0x1c')]===undefined?!![]:![]:!![]})[_0x4035('0x27')](function(_0x4c0541){logger[_0x4035('0xf')](_0x4035('0x24'),_0x489bcf);logger[_0x4035('0x12')](_0x4035('0x24'),_0x489bcf,JSON[_0x4035('0x14')](_0x4c0541));_0x452ec3(_0x4c0541);})[_0x4035('0x23')](function(_0x237deb){logger[_0x4035('0x15')](_0x4035('0x24'),_0x237deb['message'],_0x489bcf);_0x5456ac(_0x2499b7[_0x4035('0x15')](0x1f4,_0x237deb['message']));});});};exports[_0x4035('0x28')]=function(_0x43bb8b){var _0x22ec92=this;return new Promise(function(_0xd9a4b5,_0x2ea44c){return db['VoiceCallReport'][_0x4035('0x29')](_0x43bb8b[_0x4035('0x26')],{'raw':_0x43bb8b['options']?_0x43bb8b[_0x4035('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43bb8b[_0x4035('0x1b')]?_0x43bb8b['options'][_0x4035('0x1d')]||null:null,'attributes':_0x43bb8b['options']?_0x43bb8b['options'][_0x4035('0x1e')]||null:null,'limit':_0x43bb8b[_0x4035('0x1b')]?_0x43bb8b[_0x4035('0x1b')]['limit']||null:null})['then'](function(_0x549743){logger[_0x4035('0xf')](_0x4035('0x28'),_0x43bb8b);logger[_0x4035('0x12')](_0x4035('0x28'),_0x43bb8b,JSON[_0x4035('0x14')](_0x549743));_0xd9a4b5(_0x549743);})[_0x4035('0x23')](function(_0x125c42){logger[_0x4035('0x15')]('UpdateVoiceCallReport',_0x125c42[_0x4035('0x16')],_0x43bb8b);_0x2ea44c(_0x22ec92[_0x4035('0x15')](0x1f4,_0x125c42[_0x4035('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 1694477..3303301 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 _0x5b73=['index','/:id','show','post','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated'];(function(_0x1f2384,_0x1ff547){var _0x4976d0=function(_0x5583e8){while(--_0x5583e8){_0x1f2384['push'](_0x1f2384['shift']());}};_0x4976d0(++_0x1ff547);}(_0x5b73,0x1cb));var _0x35b7=function(_0x378720,_0xa711f1){_0x378720=_0x378720-0x0;var _0x47920a=_0x5b73[_0x378720];return _0x47920a;};'use strict';var multer=require(_0x35b7('0x0'));var util=require('util');var path=require(_0x35b7('0x1'));var timeout=require('connect-timeout');var express=require(_0x35b7('0x2'));var router=express[_0x35b7('0x3')]();var fs_extra=require(_0x35b7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x35b7('0x5'));var controller=require(_0x35b7('0x6'));router[_0x35b7('0x7')]('/',auth[_0x35b7('0x8')](),controller[_0x35b7('0x9')]);router['get'](_0x35b7('0xa'),auth[_0x35b7('0x8')](),controller[_0x35b7('0xb')]);router[_0x35b7('0xc')]('/',auth[_0x35b7('0x8')](),controller['create']);router[_0x35b7('0xd')](_0x35b7('0xa'),auth['isAuthenticated'](),controller[_0x35b7('0xe')]);router[_0x35b7('0xf')](_0x35b7('0xa'),auth[_0x35b7('0x8')](),controller[_0x35b7('0x10')]);module[_0x35b7('0x11')]=router; \ No newline at end of file +var _0xa574=['index','/:id','create','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated'];(function(_0x1f5b22,_0x576d92){var _0x47bc6e=function(_0x238b0e){while(--_0x238b0e){_0x1f5b22['push'](_0x1f5b22['shift']());}};_0x47bc6e(++_0x576d92);}(_0xa574,0x6d));var _0x4a57=function(_0x1b334a,_0x3d4c05){_0x1b334a=_0x1b334a-0x0;var _0xc1b3cc=_0xa574[_0x1b334a];return _0xc1b3cc;};'use strict';var multer=require(_0x4a57('0x0'));var util=require(_0x4a57('0x1'));var path=require(_0x4a57('0x2'));var timeout=require('connect-timeout');var express=require(_0x4a57('0x3'));var router=express[_0x4a57('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4a57('0x5'));var interaction=require(_0x4a57('0x6'));var config=require(_0x4a57('0x7'));var controller=require(_0x4a57('0x8'));router['get']('/',auth[_0x4a57('0x9')](),controller[_0x4a57('0xa')]);router['get'](_0x4a57('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x4a57('0xc')]);router[_0x4a57('0xd')](_0x4a57('0xb'),auth['isAuthenticated'](),controller[_0x4a57('0xe')]);router['delete'](_0x4a57('0xb'),auth['isAuthenticated'](),controller[_0x4a57('0xf')]);module[_0x4a57('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index ed52769..cbb6b33 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 _0xbac7=['join','getDataValue','BOOLEAN','exports','STRING','name','options'];(function(_0x57183a,_0x1ff933){var _0x3bbd53=function(_0x2f60ba){while(--_0x2f60ba){_0x57183a['push'](_0x57183a['shift']());}};_0x3bbd53(++_0x1ff933);}(_0xbac7,0x145));var _0x7bac=function(_0x3bf815,_0x4eeb9f){_0x3bf815=_0x3bf815-0x0;var _0x3989a6=_0xbac7[_0x3bf815];return _0x3989a6;};'use strict';var Sequelize=require('sequelize');module[_0x7bac('0x0')]={'name':{'type':Sequelize[_0x7bac('0x1')]},'prefix':{'type':Sequelize[_0x7bac('0x1')],'unique':_0x7bac('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x7bac('0x1')],'set':function(_0x20a461){this['setDataValue'](_0x7bac('0x3'),_0x20a461?_0x20a461[_0x7bac('0x4')](''):[]);},'get':function(){return this[_0x7bac('0x5')](_0x7bac('0x3'))?this[_0x7bac('0x5')](_0x7bac('0x3'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x7bac('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x7bac('0x1')]},'description':{'type':Sequelize[_0x7bac('0x1')]}}; \ No newline at end of file +var _0x2902=['split','BOOLEAN','exports','STRING','name','setDataValue','options','join','getDataValue'];(function(_0x5c98ea,_0xa782aa){var _0x51e853=function(_0x57d5b0){while(--_0x57d5b0){_0x5c98ea['push'](_0x5c98ea['shift']());}};_0x51e853(++_0xa782aa);}(_0x2902,0x122));var _0x2290=function(_0x1a0ef3,_0x535bbf){_0x1a0ef3=_0x1a0ef3-0x0;var _0x2b86da=_0x2902[_0x1a0ef3];return _0x2b86da;};'use strict';var Sequelize=require('sequelize');module[_0x2290('0x0')]={'name':{'type':Sequelize[_0x2290('0x1')]},'prefix':{'type':Sequelize[_0x2290('0x1')],'unique':_0x2290('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x2290('0x1')],'set':function(_0x25e66a){this[_0x2290('0x3')](_0x2290('0x4'),_0x25e66a?_0x25e66a[_0x2290('0x5')](''):[]);},'get':function(){return this[_0x2290('0x6')](_0x2290('0x4'))?this[_0x2290('0x6')](_0x2290('0x4'))[_0x2290('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x2290('0x1')]},'record':{'type':Sequelize[_0x2290('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2290('0x1')]},'description':{'type':Sequelize[_0x2290('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 168486b..4b770c1 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 _0xab26=['stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error'];(function(_0x575a38,_0x2e83d7){var _0x5a7bdd=function(_0x1bf478){while(--_0x1bf478){_0x575a38['push'](_0x575a38['shift']());}};_0x5a7bdd(++_0x2e83d7);}(_0xab26,0xd2));var _0x6ab2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xab26[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x6ab2('0x0'));var rimraf=require(_0x6ab2('0x1'));var zipdir=require(_0x6ab2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6ab2('0x3'));var moment=require(_0x6ab2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6ab2('0x5'));var path=require('path');var sox=require(_0x6ab2('0x6'));var csv=require(_0x6ab2('0x7'));var ejs=require(_0x6ab2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ab2('0x9'));var squel=require(_0x6ab2('0xa'));var crypto=require('crypto');var jsforce=require(_0x6ab2('0xb'));var deskjs=require(_0x6ab2('0xc'));var toCsv=require(_0x6ab2('0x7'));var querystring=require(_0x6ab2('0xd'));var Papa=require(_0x6ab2('0xe'));var Redis=require(_0x6ab2('0xf'));var authService=require(_0x6ab2('0x10'));var qs=require(_0x6ab2('0x11'));var as=require(_0x6ab2('0x12'));var hardwareService=require(_0x6ab2('0x13'));var logger=require(_0x6ab2('0x14'))('api');var utils=require(_0x6ab2('0x15'));var config=require(_0x6ab2('0x16'));var licenseUtil=require(_0x6ab2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b6f7c,_0x10c3b1){_0x10c3b1=_0x10c3b1||0xcc;return function(_0x2bb464){if(_0x2bb464){return _0x5b6f7c[_0x6ab2('0x18')](_0x10c3b1);}return _0x5b6f7c[_0x6ab2('0x19')](_0x10c3b1)[_0x6ab2('0x1a')]();};}function respondWithResult(_0x432df4,_0x9f3aea){_0x9f3aea=_0x9f3aea||0xc8;return function(_0x13d31d){if(_0x13d31d){return _0x432df4['status'](_0x9f3aea)[_0x6ab2('0x1b')](_0x13d31d);}};}function respondWithFilteredResult(_0x55d6f4,_0x1bc335){return function(_0x429aba){if(_0x429aba){var _0x5ced24=typeof _0x1bc335['offset']==='undefined'&&typeof _0x1bc335[_0x6ab2('0x1c')]===_0x6ab2('0x1d');var _0x20f437=_0x429aba[_0x6ab2('0x1e')];var _0x272bd0=_0x5ced24?0x0:_0x1bc335[_0x6ab2('0x1f')];var _0x508376=_0x5ced24?_0x429aba[_0x6ab2('0x1e')]:_0x1bc335[_0x6ab2('0x1f')]+_0x1bc335['limit'];var _0x17f6e0;if(_0x508376>=_0x20f437){_0x508376=_0x20f437;_0x17f6e0=0xc8;}else{_0x17f6e0=0xce;}_0x55d6f4['status'](_0x17f6e0);return _0x55d6f4['set'](_0x6ab2('0x20'),_0x272bd0+'-'+_0x508376+'/'+_0x20f437)[_0x6ab2('0x1b')](_0x429aba);}return null;};}function patchUpdates(_0x2ca855){return function(_0x1851bf){try{jsonpatch[_0x6ab2('0x21')](_0x1851bf,_0x2ca855,!![]);}catch(_0x4a2584){return BPromise[_0x6ab2('0x22')](_0x4a2584);}return _0x1851bf[_0x6ab2('0x23')]();};}function saveUpdates(_0x3b7a1a,_0x3fad2b){return function(_0x25fa3f){if(_0x25fa3f){return _0x25fa3f[_0x6ab2('0x24')](_0x3b7a1a)[_0x6ab2('0x25')](function(_0x2b87a0){return _0x2b87a0;});}return null;};}function removeEntity(_0x2784f8,_0x1caf3d){return function(_0x4fd76d){if(_0x4fd76d){return _0x4fd76d['destroy']()['then'](function(){var _0x11e287=_0x4fd76d[_0x6ab2('0x26')]({'plain':!![]});var _0x273aee='ChanSpies';return db[_0x6ab2('0x27')][_0x6ab2('0x28')]({'where':{'type':_0x273aee,'resourceId':_0x11e287['id']}})[_0x6ab2('0x25')](function(){return _0x4fd76d;});})[_0x6ab2('0x25')](function(){_0x2784f8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x58e29c,_0x22085c){return function(_0x5bb6ac){if(!_0x5bb6ac){_0x58e29c['sendStatus'](0x194);}return _0x5bb6ac;};}function handleError(_0xd40bad,_0x2a1833){_0x2a1833=_0x2a1833||0x1f4;return function(_0x161165){logger[_0x6ab2('0x29')](_0x161165[_0x6ab2('0x2a')]);if(_0x161165[_0x6ab2('0x2b')]){delete _0x161165[_0x6ab2('0x2b')];}_0xd40bad[_0x6ab2('0x19')](_0x2a1833)[_0x6ab2('0x2c')](_0x161165);};}exports['index']=function(_0x3c80ed,_0xd9c398){var _0x4978eb={},_0xbbd61b={},_0x5eca90={'count':0x0,'rows':[]};var _0x390015=_[_0x6ab2('0x2d')](db[_0x6ab2('0x2e')][_0x6ab2('0x2f')],function(_0x6d3c1d){return{'name':_0x6d3c1d[_0x6ab2('0x30')],'type':_0x6d3c1d['type'][_0x6ab2('0x31')]};});_0xbbd61b[_0x6ab2('0x32')]=_[_0x6ab2('0x2d')](_0x390015,_0x6ab2('0x2b'));_0xbbd61b[_0x6ab2('0x33')]=_[_0x6ab2('0x34')](_0x3c80ed[_0x6ab2('0x33')]);_0xbbd61b['filters']=_[_0x6ab2('0x35')](_0xbbd61b[_0x6ab2('0x32')],_0xbbd61b['query']);_0x4978eb['attributes']=_[_0x6ab2('0x35')](_0xbbd61b[_0x6ab2('0x32')],qs[_0x6ab2('0x36')](_0x3c80ed[_0x6ab2('0x33')][_0x6ab2('0x36')]));_0x4978eb[_0x6ab2('0x37')]=_0x4978eb[_0x6ab2('0x37')][_0x6ab2('0x38')]?_0x4978eb['attributes']:_0xbbd61b['model'];if(!_0x3c80ed[_0x6ab2('0x33')][_0x6ab2('0x39')](_0x6ab2('0x3a'))){_0x4978eb[_0x6ab2('0x1c')]=qs[_0x6ab2('0x1c')](_0x3c80ed['query'][_0x6ab2('0x1c')]);_0x4978eb[_0x6ab2('0x1f')]=qs[_0x6ab2('0x1f')](_0x3c80ed['query'][_0x6ab2('0x1f')]);}_0x4978eb[_0x6ab2('0x3b')]=qs['sort'](_0x3c80ed[_0x6ab2('0x33')][_0x6ab2('0x3c')]);_0x4978eb[_0x6ab2('0x3d')]=qs[_0x6ab2('0x3e')](_[_0x6ab2('0x3f')](_0x3c80ed[_0x6ab2('0x33')],_0xbbd61b[_0x6ab2('0x3e')]),_0x390015);if(_0x3c80ed['query'][_0x6ab2('0x40')]){_0x4978eb['where']=_[_0x6ab2('0x41')](_0x4978eb[_0x6ab2('0x3d')],{'$or':_[_0x6ab2('0x2d')](_0x390015,function(_0x5c765b){if(_0x5c765b['type']!==_0x6ab2('0x42')){var _0x4f08ad={};_0x4f08ad[_0x5c765b['name']]={'$like':'%'+_0x3c80ed[_0x6ab2('0x33')][_0x6ab2('0x40')]+'%'};return _0x4f08ad;}})});}_0x4978eb=_[_0x6ab2('0x41')]({},_0x4978eb,_0x3c80ed[_0x6ab2('0x43')]);var _0x1a4818={'where':_0x4978eb['where']};return db[_0x6ab2('0x2e')]['count'](_0x1a4818)[_0x6ab2('0x25')](function(_0x1a3b61){_0x5eca90[_0x6ab2('0x1e')]=_0x1a3b61;if(_0x3c80ed[_0x6ab2('0x33')]['includeAll']){_0x4978eb[_0x6ab2('0x44')]=[{'all':!![]}];}return db[_0x6ab2('0x2e')][_0x6ab2('0x45')](_0x4978eb);})[_0x6ab2('0x25')](function(_0x12d4b6){_0x5eca90[_0x6ab2('0x46')]=_0x12d4b6;return _0x5eca90;})[_0x6ab2('0x25')](respondWithFilteredResult(_0xd9c398,_0x4978eb))[_0x6ab2('0x47')](handleError(_0xd9c398,null));};exports[_0x6ab2('0x48')]=function(_0x2aea88,_0x398274){var _0x32333d={'raw':![],'where':{'id':_0x2aea88[_0x6ab2('0x49')]['id']}},_0x5720af={};_0x5720af[_0x6ab2('0x32')]=_[_0x6ab2('0x34')](db[_0x6ab2('0x2e')][_0x6ab2('0x2f')]);_0x5720af[_0x6ab2('0x33')]=_['keys'](_0x2aea88[_0x6ab2('0x33')]);_0x5720af[_0x6ab2('0x3e')]=_[_0x6ab2('0x35')](_0x5720af[_0x6ab2('0x32')],_0x5720af['query']);_0x32333d['attributes']=_[_0x6ab2('0x35')](_0x5720af[_0x6ab2('0x32')],qs[_0x6ab2('0x36')](_0x2aea88[_0x6ab2('0x33')][_0x6ab2('0x36')]));_0x32333d['attributes']=_0x32333d[_0x6ab2('0x37')][_0x6ab2('0x38')]?_0x32333d[_0x6ab2('0x37')]:_0x5720af[_0x6ab2('0x32')];if(_0x2aea88['query']['includeAll']){_0x32333d[_0x6ab2('0x44')]=[{'all':!![]}];}_0x32333d=_[_0x6ab2('0x41')]({},_0x32333d,_0x2aea88['options']);return db[_0x6ab2('0x2e')]['find'](_0x32333d)['then'](handleEntityNotFound(_0x398274,null))['then'](respondWithResult(_0x398274,null))[_0x6ab2('0x47')](handleError(_0x398274,null));};exports[_0x6ab2('0x4a')]=function(_0x4fffb4,_0x186746){return db['VoiceChanSpy'][_0x6ab2('0x4a')](_0x4fffb4[_0x6ab2('0x4b')],{})[_0x6ab2('0x25')](function(_0x9c5d40){var _0x507695=_0x4fffb4[_0x6ab2('0x4c')][_0x6ab2('0x26')]({'plain':!![]});if(!_0x507695)throw new Error(_0x6ab2('0x4d'));if(_0x507695[_0x6ab2('0x4e')]===_0x6ab2('0x4c')){var _0x301270=_0x9c5d40[_0x6ab2('0x26')]({'plain':!![]});var _0x507da5=_0x6ab2('0x4f');return db[_0x6ab2('0x50')][_0x6ab2('0x51')]({'where':{'name':_0x507da5,'userProfileId':_0x507695[_0x6ab2('0x52')]},'raw':!![]})[_0x6ab2('0x25')](function(_0x1449db){if(_0x1449db&&_0x1449db['autoAssociation']===0x0){return db[_0x6ab2('0x27')]['create']({'name':_0x301270[_0x6ab2('0x2b')],'resourceId':_0x301270['id'],'type':_0x1449db[_0x6ab2('0x2b')],'sectionId':_0x1449db['id']},{})[_0x6ab2('0x25')](function(){return _0x9c5d40;});}else{return _0x9c5d40;}})[_0x6ab2('0x47')](function(_0x145428){logger[_0x6ab2('0x29')](_0x6ab2('0x53'),_0x145428);throw _0x145428;});}return _0x9c5d40;})[_0x6ab2('0x25')](respondWithResult(_0x186746,0xc9))[_0x6ab2('0x47')](handleError(_0x186746,null));};exports['update']=function(_0x326d64,_0x5df5be){if(_0x326d64['body']['id']){delete _0x326d64[_0x6ab2('0x4b')]['id'];}return db[_0x6ab2('0x2e')][_0x6ab2('0x51')]({'where':{'id':_0x326d64[_0x6ab2('0x49')]['id']}})[_0x6ab2('0x25')](handleEntityNotFound(_0x5df5be,null))[_0x6ab2('0x25')](saveUpdates(_0x326d64[_0x6ab2('0x4b')],null))[_0x6ab2('0x25')](respondWithResult(_0x5df5be,null))[_0x6ab2('0x47')](handleError(_0x5df5be,null));};exports[_0x6ab2('0x28')]=function(_0xdd943,_0x409b6e){return db['VoiceChanSpy'][_0x6ab2('0x51')]({'where':{'id':_0xdd943[_0x6ab2('0x49')]['id']}})[_0x6ab2('0x25')](handleEntityNotFound(_0x409b6e,null))[_0x6ab2('0x25')](removeEntity(_0x409b6e,null))[_0x6ab2('0x47')](handleError(_0x409b6e,null));}; \ No newline at end of file +var _0xf0cc=['rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','eml-format','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','undefined','offset','count','limit','set','Content-Range','json','reject','update','then','get','ChanSpies','error','send','index','map','rawAttributes','fieldName','type','key','name','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','VoiceChanSpy','includeAll','include'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xf0cc,0xa7));var _0xcf0c=function(_0xd8310b,_0x4713e2){_0xd8310b=_0xd8310b-0x0;var _0x149acf=_0xf0cc[_0xd8310b];return _0x149acf;};'use strict';var emlformat=require(_0xcf0c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcf0c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcf0c('0x2'));var Mustache=require(_0xcf0c('0x3'));var util=require('util');var path=require('path');var sox=require(_0xcf0c('0x4'));var csv=require(_0xcf0c('0x5'));var ejs=require(_0xcf0c('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf0c('0x7'));var squel=require(_0xcf0c('0x8'));var crypto=require(_0xcf0c('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcf0c('0x5'));var querystring=require('querystring');var Papa=require(_0xcf0c('0xa'));var Redis=require('ioredis');var authService=require(_0xcf0c('0xb'));var qs=require(_0xcf0c('0xc'));var as=require(_0xcf0c('0xd'));var hardwareService=require(_0xcf0c('0xe'));var logger=require(_0xcf0c('0xf'))(_0xcf0c('0x10'));var utils=require(_0xcf0c('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xcf0c('0x12'));var db=require(_0xcf0c('0x13'))['db'];function respondWithStatusCode(_0x6dde21,_0x34f74f){_0x34f74f=_0x34f74f||0xcc;return function(_0x327f65){if(_0x327f65){return _0x6dde21['sendStatus'](_0x34f74f);}return _0x6dde21[_0xcf0c('0x14')](_0x34f74f)[_0xcf0c('0x15')]();};}function respondWithResult(_0x26fc43,_0x4fd482){_0x4fd482=_0x4fd482||0xc8;return function(_0x52038a){if(_0x52038a){return _0x26fc43[_0xcf0c('0x14')](_0x4fd482)['json'](_0x52038a);}};}function respondWithFilteredResult(_0x1f7a47,_0x8ed57d){return function(_0x5362ef){if(_0x5362ef){var _0x58f9ab=typeof _0x8ed57d['offset']===_0xcf0c('0x16')&&typeof _0x8ed57d['limit']===_0xcf0c('0x16');var _0xee0e66=_0x5362ef['count'];var _0x48766e=_0x58f9ab?0x0:_0x8ed57d[_0xcf0c('0x17')];var _0x3c43e5=_0x58f9ab?_0x5362ef[_0xcf0c('0x18')]:_0x8ed57d['offset']+_0x8ed57d[_0xcf0c('0x19')];var _0x134ecb;if(_0x3c43e5>=_0xee0e66){_0x3c43e5=_0xee0e66;_0x134ecb=0xc8;}else{_0x134ecb=0xce;}_0x1f7a47[_0xcf0c('0x14')](_0x134ecb);return _0x1f7a47[_0xcf0c('0x1a')](_0xcf0c('0x1b'),_0x48766e+'-'+_0x3c43e5+'/'+_0xee0e66)[_0xcf0c('0x1c')](_0x5362ef);}return null;};}function patchUpdates(_0x29bb2b){return function(_0xcfb5bd){try{jsonpatch['apply'](_0xcfb5bd,_0x29bb2b,!![]);}catch(_0x203da7){return BPromise[_0xcf0c('0x1d')](_0x203da7);}return _0xcfb5bd['save']();};}function saveUpdates(_0x4832d2,_0x39b1ed){return function(_0x20b8f3){if(_0x20b8f3){return _0x20b8f3[_0xcf0c('0x1e')](_0x4832d2)[_0xcf0c('0x1f')](function(_0x1ceea0){return _0x1ceea0;});}return null;};}function removeEntity(_0x8c4978,_0xbdf266){return function(_0x33628d){if(_0x33628d){return _0x33628d['destroy']()[_0xcf0c('0x1f')](function(){var _0x5466f4=_0x33628d[_0xcf0c('0x20')]({'plain':!![]});var _0x39f5e0=_0xcf0c('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x39f5e0,'resourceId':_0x5466f4['id']}})[_0xcf0c('0x1f')](function(){return _0x33628d;});})[_0xcf0c('0x1f')](function(){_0x8c4978[_0xcf0c('0x14')](0xcc)[_0xcf0c('0x15')]();});}};}function handleEntityNotFound(_0x9b0174,_0x36c637){return function(_0x3b38d9){if(!_0x3b38d9){_0x9b0174['sendStatus'](0x194);}return _0x3b38d9;};}function handleError(_0x1d9501,_0x1ce8d4){_0x1ce8d4=_0x1ce8d4||0x1f4;return function(_0x2bd2e3){logger[_0xcf0c('0x22')](_0x2bd2e3['stack']);if(_0x2bd2e3['name']){delete _0x2bd2e3['name'];}_0x1d9501['status'](_0x1ce8d4)[_0xcf0c('0x23')](_0x2bd2e3);};}exports[_0xcf0c('0x24')]=function(_0x3bdfd0,_0x34db17){var _0x3da4df={},_0x3fa73f={},_0x358e43={'count':0x0,'rows':[]};var _0x249d54=_[_0xcf0c('0x25')](db['VoiceChanSpy'][_0xcf0c('0x26')],function(_0x4f5ee2){return{'name':_0x4f5ee2[_0xcf0c('0x27')],'type':_0x4f5ee2[_0xcf0c('0x28')][_0xcf0c('0x29')]};});_0x3fa73f['model']=_['map'](_0x249d54,_0xcf0c('0x2a'));_0x3fa73f['query']=_[_0xcf0c('0x2b')](_0x3bdfd0[_0xcf0c('0x2c')]);_0x3fa73f[_0xcf0c('0x2d')]=_[_0xcf0c('0x2e')](_0x3fa73f[_0xcf0c('0x2f')],_0x3fa73f['query']);_0x3da4df[_0xcf0c('0x30')]=_[_0xcf0c('0x2e')](_0x3fa73f[_0xcf0c('0x2f')],qs[_0xcf0c('0x31')](_0x3bdfd0['query'][_0xcf0c('0x31')]));_0x3da4df[_0xcf0c('0x30')]=_0x3da4df[_0xcf0c('0x30')][_0xcf0c('0x32')]?_0x3da4df['attributes']:_0x3fa73f[_0xcf0c('0x2f')];if(!_0x3bdfd0[_0xcf0c('0x2c')]['hasOwnProperty'](_0xcf0c('0x33'))){_0x3da4df[_0xcf0c('0x19')]=qs[_0xcf0c('0x19')](_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x19')]);_0x3da4df[_0xcf0c('0x17')]=qs[_0xcf0c('0x17')](_0x3bdfd0['query'][_0xcf0c('0x17')]);}_0x3da4df['order']=qs[_0xcf0c('0x34')](_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x34')]);_0x3da4df[_0xcf0c('0x35')]=qs[_0xcf0c('0x2d')](_['pick'](_0x3bdfd0['query'],_0x3fa73f[_0xcf0c('0x2d')]),_0x249d54);if(_0x3bdfd0['query'][_0xcf0c('0x36')]){_0x3da4df[_0xcf0c('0x35')]=_[_0xcf0c('0x37')](_0x3da4df[_0xcf0c('0x35')],{'$or':_[_0xcf0c('0x25')](_0x249d54,function(_0x532b2a){if(_0x532b2a[_0xcf0c('0x28')]!==_0xcf0c('0x38')){var _0xc1d73e={};_0xc1d73e[_0x532b2a[_0xcf0c('0x2a')]]={'$like':'%'+_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x36')]+'%'};return _0xc1d73e;}})});}_0x3da4df=_[_0xcf0c('0x37')]({},_0x3da4df,_0x3bdfd0[_0xcf0c('0x39')]);var _0x12b43f={'where':_0x3da4df[_0xcf0c('0x35')]};return db[_0xcf0c('0x3a')]['count'](_0x12b43f)['then'](function(_0xf39dea){_0x358e43[_0xcf0c('0x18')]=_0xf39dea;if(_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x3b')]){_0x3da4df[_0xcf0c('0x3c')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x3da4df);})[_0xcf0c('0x1f')](function(_0x24f4bd){_0x358e43[_0xcf0c('0x3d')]=_0x24f4bd;return _0x358e43;})['then'](respondWithFilteredResult(_0x34db17,_0x3da4df))[_0xcf0c('0x3e')](handleError(_0x34db17,null));};exports[_0xcf0c('0x3f')]=function(_0x2c8fa2,_0x1e688e){var _0x53af37={'raw':![],'where':{'id':_0x2c8fa2['params']['id']}},_0x681778={};_0x681778[_0xcf0c('0x2f')]=_['keys'](db[_0xcf0c('0x3a')]['rawAttributes']);_0x681778[_0xcf0c('0x2c')]=_[_0xcf0c('0x2b')](_0x2c8fa2['query']);_0x681778['filters']=_['intersection'](_0x681778[_0xcf0c('0x2f')],_0x681778[_0xcf0c('0x2c')]);_0x53af37[_0xcf0c('0x30')]=_[_0xcf0c('0x2e')](_0x681778[_0xcf0c('0x2f')],qs[_0xcf0c('0x31')](_0x2c8fa2[_0xcf0c('0x2c')][_0xcf0c('0x31')]));_0x53af37[_0xcf0c('0x30')]=_0x53af37[_0xcf0c('0x30')][_0xcf0c('0x32')]?_0x53af37[_0xcf0c('0x30')]:_0x681778['model'];if(_0x2c8fa2[_0xcf0c('0x2c')][_0xcf0c('0x3b')]){_0x53af37[_0xcf0c('0x3c')]=[{'all':!![]}];}_0x53af37=_[_0xcf0c('0x37')]({},_0x53af37,_0x2c8fa2[_0xcf0c('0x39')]);return db['VoiceChanSpy']['find'](_0x53af37)[_0xcf0c('0x1f')](handleEntityNotFound(_0x1e688e,null))[_0xcf0c('0x1f')](respondWithResult(_0x1e688e,null))['catch'](handleError(_0x1e688e,null));};exports[_0xcf0c('0x40')]=function(_0x1f9728,_0x87e6d4){return db[_0xcf0c('0x3a')][_0xcf0c('0x40')](_0x1f9728[_0xcf0c('0x41')],{})[_0xcf0c('0x1f')](function(_0xe9f843){var _0x2fca4a=_0x1f9728[_0xcf0c('0x42')][_0xcf0c('0x20')]({'plain':!![]});if(!_0x2fca4a)throw new Error(_0xcf0c('0x43'));if(_0x2fca4a[_0xcf0c('0x44')]===_0xcf0c('0x42')){var _0x11558c=_0xe9f843[_0xcf0c('0x20')]({'plain':!![]});var _0x5563be=_0xcf0c('0x21');return db['UserProfileSection'][_0xcf0c('0x45')]({'where':{'name':_0x5563be,'userProfileId':_0x2fca4a[_0xcf0c('0x46')]},'raw':!![]})[_0xcf0c('0x1f')](function(_0x5103ff){if(_0x5103ff&&_0x5103ff[_0xcf0c('0x47')]===0x0){return db[_0xcf0c('0x48')][_0xcf0c('0x40')]({'name':_0x11558c[_0xcf0c('0x2a')],'resourceId':_0x11558c['id'],'type':_0x5103ff[_0xcf0c('0x2a')],'sectionId':_0x5103ff['id']},{})[_0xcf0c('0x1f')](function(){return _0xe9f843;});}else{return _0xe9f843;}})['catch'](function(_0x20b133){logger['error'](_0xcf0c('0x49'),_0x20b133);throw _0x20b133;});}return _0xe9f843;})[_0xcf0c('0x1f')](respondWithResult(_0x87e6d4,0xc9))[_0xcf0c('0x3e')](handleError(_0x87e6d4,null));};exports[_0xcf0c('0x1e')]=function(_0x543d75,_0x19782d){if(_0x543d75[_0xcf0c('0x41')]['id']){delete _0x543d75[_0xcf0c('0x41')]['id'];}return db[_0xcf0c('0x3a')][_0xcf0c('0x45')]({'where':{'id':_0x543d75[_0xcf0c('0x4a')]['id']}})[_0xcf0c('0x1f')](handleEntityNotFound(_0x19782d,null))['then'](saveUpdates(_0x543d75[_0xcf0c('0x41')],null))[_0xcf0c('0x1f')](respondWithResult(_0x19782d,null))[_0xcf0c('0x3e')](handleError(_0x19782d,null));};exports[_0xcf0c('0x4b')]=function(_0x3f9edd,_0x53a2c8){return db[_0xcf0c('0x3a')][_0xcf0c('0x45')]({'where':{'id':_0x3f9edd[_0xcf0c('0x4a')]['id']}})[_0xcf0c('0x1f')](handleEntityNotFound(_0x53a2c8,null))[_0xcf0c('0x1f')](removeEntity(_0x53a2c8,null))['catch'](handleError(_0x53a2c8,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 1abd85b..be385ab 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 _0x563f=['models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','length','lodash','bluebird','context','from-sip','%s%s','prefix','system','push','merge','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth','password','ChanSpy','SIP/%s,%s','name','options','join','concat','internal','User','agent','then','catch'];(function(_0xeaad17,_0xf6d4e8){var _0x2e4f6b=function(_0x52d30d){while(--_0x52d30d){_0xeaad17['push'](_0xeaad17['shift']());}};_0x2e4f6b(++_0xf6d4e8);}(_0x563f,0x19f));var _0xf563=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x563f[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xf563('0x0'));var util=require('util');var BPromise=require(_0xf563('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x38ffe4,_0x1d2a7e,_0x17f638){var _0x47f26e=0x1;var _0x21b80b=[];var _0x5c742b={'context':_0x1d2a7e[_0xf563('0x2')]||_0xf563('0x3'),'exten':util['format'](_0xf563('0x4'),_0x38ffe4[_0xf563('0x5')],_0x17f638),'type':_0xf563('0x6'),'isApp':![],'ChanSpyId':_0x38ffe4['id'],'UserId':_0x1d2a7e['id']};_0x21b80b[_0xf563('0x7')](_[_0xf563('0x8')]({'app':_0xf563('0x9'),'appdata':util[_0xf563('0xa')](_0xf563('0xb'),_0xf563('0xc')),'priority':_0x47f26e++},_0x5c742b));if(_0x38ffe4[_0xf563('0xd')]){_0x21b80b[_0xf563('0x7')](_[_0xf563('0x8')]({'app':_0xf563('0xe'),'appdata':util[_0xf563('0xa')](_0xf563('0xf'),_0x38ffe4['recordingFormat']),'priority':_0x47f26e++},_0x5c742b));}if(_0x38ffe4[_0xf563('0x10')]){_0x21b80b['push'](_[_0xf563('0x8')]({'app':'Authenticate','appdata':_0x38ffe4[_0xf563('0x11')],'priority':_0x47f26e++},_0x5c742b));}_0x21b80b[_0xf563('0x7')](_['merge']({'app':_0xf563('0x12'),'appdata':util[_0xf563('0xa')](_0xf563('0x13'),_0x1d2a7e[_0xf563('0x14')],_0x38ffe4['options']?_0x38ffe4[_0xf563('0x15')][_0xf563('0x16')](''):''),'priority':_0x47f26e++},_0x5c742b));if(_0x38ffe4[_0xf563('0xd')]){_0x21b80b[_0xf563('0x7')](_[_0xf563('0x8')]({'app':'StopMixMonitor','priority':_0x47f26e++},_0x5c742b));}return _0x21b80b;};var getChanSpyApplications=function(_0x122488,_0xb919ef){var _0x551543=[];for(var _0x4c3d41=0x0,_0x522307=0x1;_0x4c3d41<_0xb919ef['length'];_0x4c3d41++,_0x522307=0x1){_0x551543=_0x551543[_0xf563('0x17')](getUserApplications(_0x122488,_0xb919ef[_0x4c3d41],_0xb919ef[_0x4c3d41][_0xf563('0x18')]));if(_0xb919ef[_0x4c3d41][_0xf563('0x18')]!=_0xb919ef[_0x4c3d41][_0xf563('0x14')]){_0x551543=_0x551543[_0xf563('0x17')](getUserApplications(_0x122488,_0xb919ef[_0x4c3d41],_0xb919ef[_0x4c3d41][_0xf563('0x14')]));}}return _0x551543;};var getChanSpyPromise=function(_0x5be611,_0xe35e92){return new BPromise(function(_0x52b27e,_0x47173a){return _0x5be611[_0xf563('0x19')]['findAll']({'attributes':['id',_0xf563('0x14'),_0xf563('0x18')],'where':{'role':_0xf563('0x1a'),'chanspy':!![]},'raw':!![]})[_0xf563('0x1b')](function(_0x1eea33){if(_0x1eea33){return _0x52b27e(getChanSpyApplications(_0xe35e92,_0x1eea33));}return _0x52b27e([]);})[_0xf563('0x1c')](function(_0x569796){_0x47173a(_0x569796);});});};module['exports']=function(_0x719379,_0x4cccf4){var _0x285459=_0x719379[_0xf563('0x1d')];return _0x719379[_0xf563('0x1e')](_0xf563('0x1f'),attributes,{'tableName':_0xf563('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x9ad99f,_0x92a231,_0x5b29c9){return getChanSpyPromise(_0x285459,_0x9ad99f)[_0xf563('0x1b')](function(_0xd06d6d){if(_0xd06d6d&&_0xd06d6d['length']){return _0x285459[_0xf563('0x21')][_0xf563('0x22')](_0xd06d6d);}})['then'](function(){_0x5b29c9();})[_0xf563('0x1c')](function(_0x1ca2e6){_0x5b29c9(_0x1ca2e6);});},'afterUpdate':function(_0x5e4cc5,_0x3da322,_0xf64573){return _0x285459[_0xf563('0x21')][_0xf563('0x23')]({'where':{'ChanSpyId':_0x5e4cc5['id']}})[_0xf563('0x1b')](function(){return getChanSpyPromise(_0x285459,_0x5e4cc5);})['then'](function(_0x4fe9c9){if(_0x4fe9c9&&_0x4fe9c9[_0xf563('0x24')]){return _0x285459[_0xf563('0x21')]['bulkCreate'](_0x4fe9c9);}})[_0xf563('0x1b')](function(){_0xf64573();})['catch'](function(_0x40d5ad){_0xf64573(_0x40d5ad);});},'afterDestroy':function(_0x3db8a7,_0x357e5d,_0x27f643){return _0x285459[_0xf563('0x21')][_0xf563('0x23')]({'where':{'ChanSpyId':_0x3db8a7['id']}})['then'](function(){_0x27f643();})['catch'](function(_0x3689f0){_0x27f643(_0x3689f0);});}}});}; \ No newline at end of file +var _0x8a47=['password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','findAll','agent','then','catch','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','lodash','bluebird','./voiceChanSpy.attributes','format','%s%s','push','merge','CDR(type)=%s','recordingFormat','auth','Authenticate'];(function(_0x27b26c,_0x169539){var _0x5aa488=function(_0xd06b5c){while(--_0xd06b5c){_0x27b26c['push'](_0x27b26c['shift']());}};_0x5aa488(++_0x169539);}(_0x8a47,0x195));var _0x78a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8a47[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x78a4('0x0'));var util=require('util');var BPromise=require(_0x78a4('0x1'));var attributes=require(_0x78a4('0x2'));var getUserApplications=function(_0x47d551,_0x16bc9e,_0x5f3692){var _0x27ca51=0x1;var _0x260ec6=[];var _0x80cbb7={'context':_0x16bc9e['context']||'from-sip','exten':util[_0x78a4('0x3')](_0x78a4('0x4'),_0x47d551['prefix'],_0x5f3692),'type':'system','isApp':![],'ChanSpyId':_0x47d551['id'],'UserId':_0x16bc9e['id']};_0x260ec6[_0x78a4('0x5')](_[_0x78a4('0x6')]({'app':'Set','appdata':util[_0x78a4('0x3')](_0x78a4('0x7'),'chanspy'),'priority':_0x27ca51++},_0x80cbb7));if(_0x47d551['record']){_0x260ec6[_0x78a4('0x5')](_[_0x78a4('0x6')]({'app':'MixMonitor','appdata':util[_0x78a4('0x3')]('${UNIQUEID}.%s,a',_0x47d551[_0x78a4('0x8')]),'priority':_0x27ca51++},_0x80cbb7));}if(_0x47d551[_0x78a4('0x9')]){_0x260ec6[_0x78a4('0x5')](_[_0x78a4('0x6')]({'app':_0x78a4('0xa'),'appdata':_0x47d551[_0x78a4('0xb')],'priority':_0x27ca51++},_0x80cbb7));}_0x260ec6[_0x78a4('0x5')](_[_0x78a4('0x6')]({'app':_0x78a4('0xc'),'appdata':util[_0x78a4('0x3')](_0x78a4('0xd'),_0x16bc9e[_0x78a4('0xe')],_0x47d551[_0x78a4('0xf')]?_0x47d551[_0x78a4('0xf')][_0x78a4('0x10')](''):''),'priority':_0x27ca51++},_0x80cbb7));if(_0x47d551['record']){_0x260ec6['push'](_['merge']({'app':'StopMixMonitor','priority':_0x27ca51++},_0x80cbb7));}return _0x260ec6;};var getChanSpyApplications=function(_0x1759c3,_0x390cb6){var _0x2ff636=[];for(var _0x33df47=0x0,_0x298499=0x1;_0x33df47<_0x390cb6[_0x78a4('0x11')];_0x33df47++,_0x298499=0x1){_0x2ff636=_0x2ff636[_0x78a4('0x12')](getUserApplications(_0x1759c3,_0x390cb6[_0x33df47],_0x390cb6[_0x33df47][_0x78a4('0x13')]));if(_0x390cb6[_0x33df47]['internal']!=_0x390cb6[_0x33df47]['name']){_0x2ff636=_0x2ff636[_0x78a4('0x12')](getUserApplications(_0x1759c3,_0x390cb6[_0x33df47],_0x390cb6[_0x33df47][_0x78a4('0xe')]));}}return _0x2ff636;};var getChanSpyPromise=function(_0x2e3fb3,_0x3dd7cc){return new BPromise(function(_0x4e5972,_0x32a7d4){return _0x2e3fb3[_0x78a4('0x14')][_0x78a4('0x15')]({'attributes':['id',_0x78a4('0xe'),_0x78a4('0x13')],'where':{'role':_0x78a4('0x16'),'chanspy':!![]},'raw':!![]})[_0x78a4('0x17')](function(_0x474825){if(_0x474825){return _0x4e5972(getChanSpyApplications(_0x3dd7cc,_0x474825));}return _0x4e5972([]);})[_0x78a4('0x18')](function(_0x1da2de){_0x32a7d4(_0x1da2de);});});};module['exports']=function(_0x3184d9,_0x5724f5){var _0x786999=_0x3184d9[_0x78a4('0x19')];return _0x3184d9[_0x78a4('0x1a')](_0x78a4('0x1b'),attributes,{'tableName':_0x78a4('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3890e4,_0x5d0275,_0x2ff1ad){return getChanSpyPromise(_0x786999,_0x3890e4)[_0x78a4('0x17')](function(_0x45e250){if(_0x45e250&&_0x45e250[_0x78a4('0x11')]){return _0x786999[_0x78a4('0x1d')]['bulkCreate'](_0x45e250);}})[_0x78a4('0x17')](function(){_0x2ff1ad();})[_0x78a4('0x18')](function(_0xd7ec01){_0x2ff1ad(_0xd7ec01);});},'afterUpdate':function(_0x41a62e,_0x27fe6c,_0x3b84d1){return _0x786999['VoiceExtension'][_0x78a4('0x1e')]({'where':{'ChanSpyId':_0x41a62e['id']}})['then'](function(){return getChanSpyPromise(_0x786999,_0x41a62e);})['then'](function(_0x322841){if(_0x322841&&_0x322841['length']){return _0x786999[_0x78a4('0x1d')][_0x78a4('0x1f')](_0x322841);}})[_0x78a4('0x17')](function(){_0x3b84d1();})[_0x78a4('0x18')](function(_0x2beef6){_0x3b84d1(_0x2beef6);});},'afterDestroy':function(_0x2025fd,_0x4cb607,_0x1fc527){return _0x786999[_0x78a4('0x1d')][_0x78a4('0x1e')]({'where':{'ChanSpyId':_0x2025fd['id']}})[_0x78a4('0x17')](function(){_0x1fc527();})['catch'](function(_0x142e21){_0x1fc527(_0x142e21);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 968231e..65e2778 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 _0xbdb7=['request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','VoiceChanSpy,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0xdb7eb4,_0x36875a){_0xdb7eb4=_0xdb7eb4-0x0;var _0x27f8a7=_0xbdb7[_0xdb7eb4];return _0x27f8a7;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0xdb94=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','message','catch'];(function(_0x4bd995,_0x5abdf1){var _0x40d9f3=function(_0x431cb1){while(--_0x431cb1){_0x4bd995['push'](_0x4bd995['shift']());}};_0x40d9f3(++_0x5abdf1);}(_0xdb94,0xab));var _0x4db9=function(_0xf049d3,_0x7742d5){_0xf049d3=_0xf049d3-0x0;var _0x4262d1=_0xdb94[_0xf049d3];return _0x4262d1;};'use strict';var _=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var moment=require(_0x4db9('0x2'));var BPromise=require(_0x4db9('0x3'));var rs=require(_0x4db9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4db9('0x5'))['db'];var utils=require(_0x4db9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4db9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4db9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d1f45,_0x196ede,_0x50c27a){return new BPromise(function(_0x14deb9,_0x26248b){return client[_0x4db9('0x9')](_0x5d1f45,_0x50c27a)[_0x4db9('0xa')](function(_0x2cacca){logger[_0x4db9('0xb')](_0x4db9('0xc'),_0x196ede,_0x4db9('0xd'));logger[_0x4db9('0xe')](_0x4db9('0xf'),_0x196ede,_0x4db9('0xd'),JSON['stringify'](_0x2cacca));if(_0x2cacca[_0x4db9('0x10')]){if(_0x2cacca[_0x4db9('0x10')]['code']===0x1f4){logger['error'](_0x4db9('0xc'),_0x196ede,_0x2cacca['error']['message']);return _0x26248b(_0x2cacca[_0x4db9('0x10')][_0x4db9('0x11')]);}logger['error'](_0x4db9('0xc'),_0x196ede,_0x2cacca[_0x4db9('0x10')][_0x4db9('0x11')]);return _0x14deb9(_0x2cacca[_0x4db9('0x10')]['message']);}else{logger['info'](_0x4db9('0xc'),_0x196ede,_0x4db9('0xd'));_0x14deb9(_0x2cacca['result'][_0x4db9('0x11')]);}})[_0x4db9('0x12')](function(_0x5d6471){logger['error'](_0x4db9('0xc'),_0x196ede,_0x5d6471);_0x26248b(_0x5d6471);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index b165346..c3a093f 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 _0x9129=['../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4cc016,_0x39302e){var _0xf8bc28=function(_0x26327c){while(--_0x26327c){_0x4cc016['push'](_0x4cc016['shift']());}};_0xf8bc28(++_0x39302e);}(_0x9129,0xac));var _0x9912=function(_0x42e495,_0x49d9da){_0x42e495=_0x42e495-0x0;var _0x595da1=_0x9129[_0x42e495];return _0x595da1;};'use strict';var multer=require(_0x9912('0x0'));var util=require(_0x9912('0x1'));var path=require(_0x9912('0x2'));var timeout=require(_0x9912('0x3'));var express=require(_0x9912('0x4'));var router=express[_0x9912('0x5')]();var fs_extra=require(_0x9912('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9912('0x7'));var config=require(_0x9912('0x8'));var controller=require('./voiceContext.controller');router[_0x9912('0x9')]('/',auth['isAuthenticated'](),controller[_0x9912('0xa')]);router[_0x9912('0x9')](_0x9912('0xb'),auth[_0x9912('0xc')](),controller[_0x9912('0xd')]);router[_0x9912('0xe')]('/',auth[_0x9912('0xc')](),controller[_0x9912('0xf')]);router[_0x9912('0x10')](_0x9912('0xb'),auth[_0x9912('0xc')](),controller['update']);router[_0x9912('0x11')]('/:id',auth[_0x9912('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7336=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','update','delete','destroy','exports','multer','util','path'];(function(_0x11e6d6,_0x93cb1){var _0x4df6bb=function(_0x3866c9){while(--_0x3866c9){_0x11e6d6['push'](_0x11e6d6['shift']());}};_0x4df6bb(++_0x93cb1);}(_0x7336,0x140));var _0x6733=function(_0x54356c,_0x21b801){_0x54356c=_0x54356c-0x0;var _0x397aa8=_0x7336[_0x54356c];return _0x397aa8;};'use strict';var multer=require(_0x6733('0x0'));var util=require(_0x6733('0x1'));var path=require(_0x6733('0x2'));var timeout=require(_0x6733('0x3'));var express=require(_0x6733('0x4'));var router=express[_0x6733('0x5')]();var fs_extra=require(_0x6733('0x6'));var auth=require(_0x6733('0x7'));var interaction=require(_0x6733('0x8'));var config=require(_0x6733('0x9'));var controller=require('./voiceContext.controller');router[_0x6733('0xa')]('/',auth[_0x6733('0xb')](),controller[_0x6733('0xc')]);router[_0x6733('0xa')](_0x6733('0xd'),auth[_0x6733('0xb')](),controller[_0x6733('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6733('0xd'),auth[_0x6733('0xb')](),controller[_0x6733('0xf')]);router[_0x6733('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6733('0x11')]);module[_0x6733('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 a2bb098..04b0f33 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 _0x1843=['name','BOOLEAN','sequelize','exports'];(function(_0x475389,_0x2deda6){var _0x5aa36d=function(_0x1546a9){while(--_0x1546a9){_0x475389['push'](_0x475389['shift']());}};_0x5aa36d(++_0x2deda6);}(_0x1843,0x6a));var _0x3184=function(_0x3a0dc5,_0x540eb0){_0x3a0dc5=_0x3a0dc5-0x0;var _0x1d48a3=_0x1843[_0x3a0dc5];return _0x1d48a3;};'use strict';var Sequelize=require(_0x3184('0x0'));module[_0x3184('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3184('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x3184('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3f4a=['BOOLEAN','exports','STRING'];(function(_0x87239,_0x38c793){var _0x53af1e=function(_0x11eb5f){while(--_0x11eb5f){_0x87239['push'](_0x87239['shift']());}};_0x53af1e(++_0x38c793);}(_0x3f4a,0x12a));var _0xa3f4=function(_0x4526e1,_0x48a88c){_0x4526e1=_0x4526e1-0x0;var _0x38b122=_0x3f4a[_0x4526e1];return _0x38b122;};'use strict';var Sequelize=require('sequelize');module[_0xa3f4('0x0')]={'name':{'type':Sequelize[_0xa3f4('0x1')],'unique':'name'},'description':{'type':Sequelize[_0xa3f4('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xa3f4('0x2')],'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 b5c2c26..269474b 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 _0xea96=['filter','merge','options','count','include','findAll','show','rawAttributes','includeAll','find','catch','create','body','join','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','utf8','render','Reload','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','client','http','request','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','sendStatus','end','status','json','offset','limit','undefined','set','Content-Range','apply','update','then','get','Contexts','UserProfileResource','destroy','stack','name','index','VoiceContext','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','VIRTUAL'];(function(_0x14e51e,_0x4da5a8){var _0x1186ed=function(_0x5e7e81){while(--_0x5e7e81){_0x14e51e['push'](_0x14e51e['shift']());}};_0x1186ed(++_0x4da5a8);}(_0xea96,0x13c));var _0x6ea9=function(_0x412f6f,_0x175d7c){_0x412f6f=_0x412f6f-0x0;var _0x22e073=_0xea96[_0x412f6f];return _0x22e073;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6ea9('0x0'));var jsonpatch=require(_0x6ea9('0x1'));var rp=require('request-promise');var moment=require(_0x6ea9('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6ea9('0x3'));var path=require(_0x6ea9('0x4'));var sox=require(_0x6ea9('0x5'));var csv=require(_0x6ea9('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6ea9('0x7'));var crypto=require(_0x6ea9('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x6ea9('0x9'));var toCsv=require('to-csv');var querystring=require(_0x6ea9('0xa'));var Papa=require(_0x6ea9('0xb'));var Redis=require(_0x6ea9('0xc'));var authService=require(_0x6ea9('0xd'));var qs=require(_0x6ea9('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ea9('0xf'));var logger=require('../../config/logger')(_0x6ea9('0x10'));var utils=require('../../config/utils');var config=require(_0x6ea9('0x11'));var licenseUtil=require(_0x6ea9('0x12'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x6ea9('0x13')][_0x6ea9('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x44769d,_0x5c7374,_0x229f67,_0x2fe294){return new BPromise(function(_0x59f6a4,_0x2dccc9){var _0x55eb08=_0x2fe294||client;return _0x55eb08[_0x6ea9('0x15')](_0x44769d,_0x229f67)['then'](function(_0x3011c6){logger[_0x6ea9('0x16')](_0x6ea9('0x17'),_0x5c7374,'request\x20sent');logger[_0x6ea9('0x18')](_0x6ea9('0x19'),_0x5c7374,'request\x20sent',JSON['stringify'](_0x3011c6));if(_0x3011c6[_0x6ea9('0x1a')]){if(_0x3011c6[_0x6ea9('0x1a')][_0x6ea9('0x1b')]===0x1f4){logger[_0x6ea9('0x1a')]('VoiceContext,\x20%s,\x20%s',_0x5c7374,_0x3011c6[_0x6ea9('0x1a')]['message']);return _0x2dccc9(_0x3011c6[_0x6ea9('0x1a')][_0x6ea9('0x1c')]);}logger[_0x6ea9('0x1a')]('VoiceContext,\x20%s,\x20%s',_0x5c7374,_0x3011c6[_0x6ea9('0x1a')][_0x6ea9('0x1c')]);return _0x59f6a4(_0x3011c6[_0x6ea9('0x1a')][_0x6ea9('0x1c')]);}else{logger[_0x6ea9('0x16')](_0x6ea9('0x17'),_0x5c7374,_0x6ea9('0x1d'));_0x59f6a4(_0x3011c6[_0x6ea9('0x1e')]['message']);}})['catch'](function(_0x137b83){logger['error'](_0x6ea9('0x17'),_0x5c7374,_0x137b83);_0x2dccc9(_0x137b83);});});}function respondWithStatusCode(_0x4de06e,_0x4928ee){_0x4928ee=_0x4928ee||0xcc;return function(_0x42be77){if(_0x42be77){return _0x4de06e[_0x6ea9('0x1f')](_0x4928ee);}return _0x4de06e['status'](_0x4928ee)[_0x6ea9('0x20')]();};}function respondWithResult(_0x339830,_0x51b69b){_0x51b69b=_0x51b69b||0xc8;return function(_0x42ad9d){if(_0x42ad9d){return _0x339830[_0x6ea9('0x21')](_0x51b69b)[_0x6ea9('0x22')](_0x42ad9d);}};}function respondWithFilteredResult(_0x417924,_0x1b3ced){return function(_0x2de97c){if(_0x2de97c){var _0x547acf=typeof _0x1b3ced[_0x6ea9('0x23')]==='undefined'&&typeof _0x1b3ced[_0x6ea9('0x24')]===_0x6ea9('0x25');var _0x87300e=_0x2de97c['count'];var _0x10c47b=_0x547acf?0x0:_0x1b3ced[_0x6ea9('0x23')];var _0x29e2b0=_0x547acf?_0x2de97c['count']:_0x1b3ced[_0x6ea9('0x23')]+_0x1b3ced[_0x6ea9('0x24')];var _0x39187a;if(_0x29e2b0>=_0x87300e){_0x29e2b0=_0x87300e;_0x39187a=0xc8;}else{_0x39187a=0xce;}_0x417924[_0x6ea9('0x21')](_0x39187a);return _0x417924[_0x6ea9('0x26')](_0x6ea9('0x27'),_0x10c47b+'-'+_0x29e2b0+'/'+_0x87300e)[_0x6ea9('0x22')](_0x2de97c);}return null;};}function patchUpdates(_0xbffb42){return function(_0x57f6d5){try{jsonpatch[_0x6ea9('0x28')](_0x57f6d5,_0xbffb42,!![]);}catch(_0x2f4ab6){return BPromise['reject'](_0x2f4ab6);}return _0x57f6d5['save']();};}function saveUpdates(_0x281630,_0x5af5f4){return function(_0x51b900){if(_0x51b900){return _0x51b900[_0x6ea9('0x29')](_0x281630)[_0x6ea9('0x2a')](function(_0x17b58d){return _0x17b58d;});}return null;};}function removeEntity(_0x1b1432,_0x3e7ba0){return function(_0x368378){if(_0x368378){return _0x368378['destroy']()['then'](function(){var _0x480964=_0x368378[_0x6ea9('0x2b')]({'plain':!![]});var _0x57871d=_0x6ea9('0x2c');return db[_0x6ea9('0x2d')][_0x6ea9('0x2e')]({'where':{'type':_0x57871d,'resourceId':_0x480964['id']}})['then'](function(){return _0x368378;});})[_0x6ea9('0x2a')](function(){_0x1b1432[_0x6ea9('0x21')](0xcc)[_0x6ea9('0x20')]();});}};}function handleEntityNotFound(_0xe862ea,_0x42f51c){return function(_0x5b4f36){if(!_0x5b4f36){_0xe862ea[_0x6ea9('0x1f')](0x194);}return _0x5b4f36;};}function handleError(_0x47949d,_0x580d85){_0x580d85=_0x580d85||0x1f4;return function(_0x24f520){logger[_0x6ea9('0x1a')](_0x24f520[_0x6ea9('0x2f')]);if(_0x24f520[_0x6ea9('0x30')]){delete _0x24f520['name'];}_0x47949d['status'](_0x580d85)['send'](_0x24f520);};}exports[_0x6ea9('0x31')]=function(_0x5aa1f6,_0x2e2ca2){var _0x8b8d62={},_0x5cb35f={},_0x3635cb={'count':0x0,'rows':[]};var _0xb0cbc5=_['map'](db[_0x6ea9('0x32')]['rawAttributes'],function(_0x18ac64){return{'name':_0x18ac64[_0x6ea9('0x33')],'type':_0x18ac64[_0x6ea9('0x34')][_0x6ea9('0x35')]};});_0x5cb35f[_0x6ea9('0x36')]=_[_0x6ea9('0x37')](_0xb0cbc5,_0x6ea9('0x30'));_0x5cb35f[_0x6ea9('0x38')]=_[_0x6ea9('0x39')](_0x5aa1f6['query']);_0x5cb35f['filters']=_[_0x6ea9('0x3a')](_0x5cb35f[_0x6ea9('0x36')],_0x5cb35f[_0x6ea9('0x38')]);_0x8b8d62[_0x6ea9('0x3b')]=_[_0x6ea9('0x3a')](_0x5cb35f['model'],qs[_0x6ea9('0x3c')](_0x5aa1f6[_0x6ea9('0x38')][_0x6ea9('0x3c')]));_0x8b8d62[_0x6ea9('0x3b')]=_0x8b8d62[_0x6ea9('0x3b')][_0x6ea9('0x3d')]?_0x8b8d62[_0x6ea9('0x3b')]:_0x5cb35f[_0x6ea9('0x36')];if(!_0x5aa1f6['query']['hasOwnProperty']('nolimit')){_0x8b8d62[_0x6ea9('0x24')]=qs[_0x6ea9('0x24')](_0x5aa1f6['query'][_0x6ea9('0x24')]);_0x8b8d62['offset']=qs['offset'](_0x5aa1f6[_0x6ea9('0x38')][_0x6ea9('0x23')]);}_0x8b8d62[_0x6ea9('0x3e')]=qs[_0x6ea9('0x3f')](_0x5aa1f6[_0x6ea9('0x38')][_0x6ea9('0x3f')]);_0x8b8d62[_0x6ea9('0x40')]=qs[_0x6ea9('0x41')](_[_0x6ea9('0x42')](_0x5aa1f6[_0x6ea9('0x38')],_0x5cb35f[_0x6ea9('0x41')]),_0xb0cbc5);if(_0x5aa1f6[_0x6ea9('0x38')]['filter']){_0x8b8d62['where']=_['merge'](_0x8b8d62[_0x6ea9('0x40')],{'$or':_[_0x6ea9('0x37')](_0xb0cbc5,function(_0x122f28){if(_0x122f28[_0x6ea9('0x34')]!==_0x6ea9('0x43')){var _0x20222d={};_0x20222d[_0x122f28[_0x6ea9('0x30')]]={'$like':'%'+_0x5aa1f6[_0x6ea9('0x38')][_0x6ea9('0x44')]+'%'};return _0x20222d;}})});}_0x8b8d62=_[_0x6ea9('0x45')]({},_0x8b8d62,_0x5aa1f6[_0x6ea9('0x46')]);var _0x2b4273={'where':_0x8b8d62['where']};return db[_0x6ea9('0x32')][_0x6ea9('0x47')](_0x2b4273)[_0x6ea9('0x2a')](function(_0x3a6920){_0x3635cb['count']=_0x3a6920;if(_0x5aa1f6['query']['includeAll']){_0x8b8d62[_0x6ea9('0x48')]=[{'all':!![]}];}return db[_0x6ea9('0x32')][_0x6ea9('0x49')](_0x8b8d62);})['then'](function(_0x487e87){_0x3635cb['rows']=_0x487e87;return _0x3635cb;})[_0x6ea9('0x2a')](respondWithFilteredResult(_0x2e2ca2,_0x8b8d62))['catch'](handleError(_0x2e2ca2,null));};exports[_0x6ea9('0x4a')]=function(_0x93fb1a,_0x58cbfe){var _0x2dbe31={'raw':![],'where':{'id':_0x93fb1a['params']['id']}},_0x24ac72={};_0x24ac72[_0x6ea9('0x36')]=_[_0x6ea9('0x39')](db[_0x6ea9('0x32')][_0x6ea9('0x4b')]);_0x24ac72[_0x6ea9('0x38')]=_[_0x6ea9('0x39')](_0x93fb1a['query']);_0x24ac72[_0x6ea9('0x41')]=_['intersection'](_0x24ac72['model'],_0x24ac72['query']);_0x2dbe31[_0x6ea9('0x3b')]=_[_0x6ea9('0x3a')](_0x24ac72['model'],qs[_0x6ea9('0x3c')](_0x93fb1a[_0x6ea9('0x38')]['fields']));_0x2dbe31[_0x6ea9('0x3b')]=_0x2dbe31[_0x6ea9('0x3b')][_0x6ea9('0x3d')]?_0x2dbe31['attributes']:_0x24ac72[_0x6ea9('0x36')];if(_0x93fb1a[_0x6ea9('0x38')][_0x6ea9('0x4c')]){_0x2dbe31['include']=[{'all':!![]}];}_0x2dbe31=_[_0x6ea9('0x45')]({},_0x2dbe31,_0x93fb1a[_0x6ea9('0x46')]);return db[_0x6ea9('0x32')][_0x6ea9('0x4d')](_0x2dbe31)[_0x6ea9('0x2a')](handleEntityNotFound(_0x58cbfe,null))[_0x6ea9('0x2a')](respondWithResult(_0x58cbfe,null))[_0x6ea9('0x4e')](handleError(_0x58cbfe,null));};exports[_0x6ea9('0x4f')]=function(_0x2d2710,_0xa67fac,_0x145559){var _0x554631;return db[_0x6ea9('0x32')][_0x6ea9('0x4f')](_0x2d2710[_0x6ea9('0x50')],{'raw':!![]})['then'](function(_0x4eaa5e){_0x554631=_0x4eaa5e;return db['VoiceContext'][_0x6ea9('0x49')]({'raw':!![]});})[_0x6ea9('0x2a')](function(_0x7e2ef1){var _0x157dce=fs['readFileSync'](path[_0x6ea9('0x51')](config['root'],_0x6ea9('0x52')),'utf8');var _0x33decd=ejs['render'](_0x157dce,{'contexts':_0x7e2ef1||[]});fs[_0x6ea9('0x53')](_0x6ea9('0x54'),_0x33decd);})[_0x6ea9('0x2a')](function(){return respondWithRpcPromise('Reload','create',{'module':_0x6ea9('0x55')});})[_0x6ea9('0x2a')](function(){var _0x231f27=_0x2d2710[_0x6ea9('0x56')][_0x6ea9('0x2b')]({'plain':!![]});if(!_0x231f27)throw new Error(_0x6ea9('0x57'));if(_0x231f27[_0x6ea9('0x58')]==='user'){var _0x35964f=_0x554631[_0x6ea9('0x2b')]({'plain':!![]});return db[_0x6ea9('0x59')][_0x6ea9('0x4d')]({'where':{'name':_0x6ea9('0x2c'),'userProfileId':_0x231f27['userProfileId']},'raw':!![]})[_0x6ea9('0x2a')](function(_0xabf9c3){if(_0xabf9c3&&_0xabf9c3['autoAssociation']===0x0){return db['UserProfileResource'][_0x6ea9('0x4f')]({'name':_0x35964f[_0x6ea9('0x30')],'resourceId':_0x35964f['id'],'type':_0xabf9c3['name'],'sectionId':_0xabf9c3['id']},{})[_0x6ea9('0x2a')](function(){return _0x554631;});}else{return _0x554631;}})[_0x6ea9('0x4e')](function(_0x10b716){logger[_0x6ea9('0x1a')](_0x6ea9('0x5a'),_0x10b716);throw _0x10b716;});}return _0x554631;})[_0x6ea9('0x2a')](respondWithResult(_0xa67fac,0xc9))['catch'](handleError(_0xa67fac,null));};exports['update']=function(_0x52b444,_0xa1679c,_0x355128){var _0x538829;return db[_0x6ea9('0x32')]['find']({'where':{'id':_0x52b444['params']['id']}})[_0x6ea9('0x2a')](handleEntityNotFound(_0xa1679c,null))['then'](saveUpdates(_0x52b444['body'],null))[_0x6ea9('0x2a')](function(_0xa14699){if(_0xa14699){_0x538829=_0xa14699;return db[_0x6ea9('0x32')][_0x6ea9('0x49')]({'raw':!![]});}})[_0x6ea9('0x2a')](function(_0x17fbda){var _0x422d58=fs[_0x6ea9('0x5b')](path['join'](config[_0x6ea9('0x5c')],_0x6ea9('0x52')),_0x6ea9('0x5d'));var _0x22c3c9=ejs[_0x6ea9('0x5e')](_0x422d58,{'contexts':_0x17fbda||[]});fs[_0x6ea9('0x53')](_0x6ea9('0x54'),_0x22c3c9);})['then'](function(){return respondWithRpcPromise('Reload','update',{'module':_0x6ea9('0x55')});})['then'](function(){return _0x538829;})[_0x6ea9('0x2a')](respondWithResult(_0xa1679c,null))[_0x6ea9('0x4e')](handleError(_0xa1679c,null));};exports[_0x6ea9('0x2e')]=function(_0x25d470,_0x2c1fe2,_0x5376bb){var _0x145fee;return db[_0x6ea9('0x32')]['find']({'where':{'id':_0x25d470['params']['id']}})[_0x6ea9('0x2a')](handleEntityNotFound(_0x2c1fe2,null))[_0x6ea9('0x2a')](removeEntity(_0x2c1fe2,null))[_0x6ea9('0x2a')](function(){return db[_0x6ea9('0x32')][_0x6ea9('0x49')]({'raw':!![]});})['then'](function(_0x48630e){var _0x2dc229=fs['readFileSync'](path['join'](config[_0x6ea9('0x5c')],_0x6ea9('0x52')),'utf8');var _0x545174=ejs[_0x6ea9('0x5e')](_0x2dc229,{'contexts':_0x48630e});fs[_0x6ea9('0x53')](_0x6ea9('0x54'),_0x545174);return respondWithRpcPromise(_0x6ea9('0x5f'),_0x6ea9('0x2e'),{'module':_0x6ea9('0x55')});})[_0x6ea9('0x4e')](handleError(_0x2c1fe2,null));}; \ No newline at end of file +var _0x9556=['../../config/logger','api','../../config/utils','../../config/environment','client','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','end','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','destroy','get','Contexts','UserProfileResource','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','VoiceContext','includeAll','findAll','rows','show','keys','length','include','find','create','body','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','readFileSync','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x14761d,_0x204fcc){var _0x8f69ee=function(_0x1fd266){while(--_0x1fd266){_0x14761d['push'](_0x14761d['shift']());}};_0x8f69ee(++_0x204fcc);}(_0x9556,0x1db));var _0x6955=function(_0x38d329,_0x5ea6d0){_0x38d329=_0x38d329-0x0;var _0x3ae28f=_0x9556[_0x38d329];return _0x3ae28f;};'use strict';var emlformat=require(_0x6955('0x0'));var rimraf=require(_0x6955('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6955('0x2'));var rp=require('request-promise');var moment=require(_0x6955('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6955('0x4'));var util=require(_0x6955('0x5'));var path=require(_0x6955('0x6'));var sox=require(_0x6955('0x7'));var csv=require('to-csv');var ejs=require(_0x6955('0x8'));var fs=require('fs');var fs_extra=require(_0x6955('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6955('0xa'));var jsforce=require(_0x6955('0xb'));var deskjs=require(_0x6955('0xc'));var toCsv=require(_0x6955('0xd'));var querystring=require(_0x6955('0xe'));var Papa=require(_0x6955('0xf'));var Redis=require(_0x6955('0x10'));var authService=require(_0x6955('0x11'));var qs=require(_0x6955('0x12'));var as=require(_0x6955('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6955('0x14'))(_0x6955('0x15'));var utils=require(_0x6955('0x16'));var config=require(_0x6955('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x6955('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x554ddc,_0x31b595,_0x2a8237,_0x2c7702){return new BPromise(function(_0x176d04,_0x50c011){var _0x244533=_0x2c7702||client;return _0x244533['request'](_0x554ddc,_0x2a8237)[_0x6955('0x19')](function(_0x246ea3){logger[_0x6955('0x1a')](_0x6955('0x1b'),_0x31b595,_0x6955('0x1c'));logger[_0x6955('0x1d')](_0x6955('0x1e'),_0x31b595,'request\x20sent',JSON[_0x6955('0x1f')](_0x246ea3));if(_0x246ea3[_0x6955('0x20')]){if(_0x246ea3[_0x6955('0x20')]['code']===0x1f4){logger[_0x6955('0x20')]('VoiceContext,\x20%s,\x20%s',_0x31b595,_0x246ea3[_0x6955('0x20')][_0x6955('0x21')]);return _0x50c011(_0x246ea3['error'][_0x6955('0x21')]);}logger[_0x6955('0x20')](_0x6955('0x1b'),_0x31b595,_0x246ea3[_0x6955('0x20')][_0x6955('0x21')]);return _0x176d04(_0x246ea3['error'][_0x6955('0x21')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x31b595,_0x6955('0x1c'));_0x176d04(_0x246ea3[_0x6955('0x22')]['message']);}})[_0x6955('0x23')](function(_0x4fd680){logger['error'](_0x6955('0x1b'),_0x31b595,_0x4fd680);_0x50c011(_0x4fd680);});});}function respondWithStatusCode(_0xdabaf3,_0x3ea0c1){_0x3ea0c1=_0x3ea0c1||0xcc;return function(_0x4cce68){if(_0x4cce68){return _0xdabaf3['sendStatus'](_0x3ea0c1);}return _0xdabaf3['status'](_0x3ea0c1)[_0x6955('0x24')]();};}function respondWithResult(_0x2f7436,_0x1889a8){_0x1889a8=_0x1889a8||0xc8;return function(_0x28bb53){if(_0x28bb53){return _0x2f7436[_0x6955('0x25')](_0x1889a8)[_0x6955('0x26')](_0x28bb53);}};}function respondWithFilteredResult(_0x5d41f3,_0x4fb0e5){return function(_0x191063){if(_0x191063){var _0x15363a=typeof _0x4fb0e5['offset']===_0x6955('0x27')&&typeof _0x4fb0e5[_0x6955('0x28')]==='undefined';var _0x39f54f=_0x191063['count'];var _0x470f99=_0x15363a?0x0:_0x4fb0e5[_0x6955('0x29')];var _0x479fbb=_0x15363a?_0x191063[_0x6955('0x2a')]:_0x4fb0e5[_0x6955('0x29')]+_0x4fb0e5['limit'];var _0x3d4735;if(_0x479fbb>=_0x39f54f){_0x479fbb=_0x39f54f;_0x3d4735=0xc8;}else{_0x3d4735=0xce;}_0x5d41f3[_0x6955('0x25')](_0x3d4735);return _0x5d41f3[_0x6955('0x2b')](_0x6955('0x2c'),_0x470f99+'-'+_0x479fbb+'/'+_0x39f54f)[_0x6955('0x26')](_0x191063);}return null;};}function patchUpdates(_0x19a2e7){return function(_0x45a91c){try{jsonpatch['apply'](_0x45a91c,_0x19a2e7,!![]);}catch(_0xecc929){return BPromise[_0x6955('0x2d')](_0xecc929);}return _0x45a91c[_0x6955('0x2e')]();};}function saveUpdates(_0x3e7070,_0x53e3b0){return function(_0x1bc25c){if(_0x1bc25c){return _0x1bc25c[_0x6955('0x2f')](_0x3e7070)[_0x6955('0x19')](function(_0x3e0cb2){return _0x3e0cb2;});}return null;};}function removeEntity(_0x592577,_0x234588){return function(_0x497779){if(_0x497779){return _0x497779[_0x6955('0x30')]()[_0x6955('0x19')](function(){var _0x291ee1=_0x497779[_0x6955('0x31')]({'plain':!![]});var _0x4d98b5=_0x6955('0x32');return db[_0x6955('0x33')][_0x6955('0x30')]({'where':{'type':_0x4d98b5,'resourceId':_0x291ee1['id']}})[_0x6955('0x19')](function(){return _0x497779;});})[_0x6955('0x19')](function(){_0x592577[_0x6955('0x25')](0xcc)[_0x6955('0x24')]();});}};}function handleEntityNotFound(_0x15ae9c,_0x168ebf){return function(_0x3fc7e5){if(!_0x3fc7e5){_0x15ae9c['sendStatus'](0x194);}return _0x3fc7e5;};}function handleError(_0x975ba2,_0x360d6b){_0x360d6b=_0x360d6b||0x1f4;return function(_0x1796f3){logger[_0x6955('0x20')](_0x1796f3['stack']);if(_0x1796f3[_0x6955('0x34')]){delete _0x1796f3[_0x6955('0x34')];}_0x975ba2[_0x6955('0x25')](_0x360d6b)[_0x6955('0x35')](_0x1796f3);};}exports['index']=function(_0x1d2615,_0x592c52){var _0x2fde5e={},_0x42e1ba={},_0x55e9b2={'count':0x0,'rows':[]};var _0x5c0be3=_[_0x6955('0x36')](db['VoiceContext'][_0x6955('0x37')],function(_0x3f93e0){return{'name':_0x3f93e0['fieldName'],'type':_0x3f93e0[_0x6955('0x38')][_0x6955('0x39')]};});_0x42e1ba[_0x6955('0x3a')]=_[_0x6955('0x36')](_0x5c0be3,_0x6955('0x34'));_0x42e1ba[_0x6955('0x3b')]=_['keys'](_0x1d2615['query']);_0x42e1ba[_0x6955('0x3c')]=_[_0x6955('0x3d')](_0x42e1ba[_0x6955('0x3a')],_0x42e1ba[_0x6955('0x3b')]);_0x2fde5e[_0x6955('0x3e')]=_[_0x6955('0x3d')](_0x42e1ba[_0x6955('0x3a')],qs[_0x6955('0x3f')](_0x1d2615[_0x6955('0x3b')][_0x6955('0x3f')]));_0x2fde5e[_0x6955('0x3e')]=_0x2fde5e[_0x6955('0x3e')]['length']?_0x2fde5e[_0x6955('0x3e')]:_0x42e1ba['model'];if(!_0x1d2615[_0x6955('0x3b')][_0x6955('0x40')](_0x6955('0x41'))){_0x2fde5e[_0x6955('0x28')]=qs[_0x6955('0x28')](_0x1d2615['query'][_0x6955('0x28')]);_0x2fde5e['offset']=qs[_0x6955('0x29')](_0x1d2615[_0x6955('0x3b')][_0x6955('0x29')]);}_0x2fde5e['order']=qs[_0x6955('0x42')](_0x1d2615[_0x6955('0x3b')][_0x6955('0x42')]);_0x2fde5e[_0x6955('0x43')]=qs[_0x6955('0x3c')](_['pick'](_0x1d2615[_0x6955('0x3b')],_0x42e1ba[_0x6955('0x3c')]),_0x5c0be3);if(_0x1d2615[_0x6955('0x3b')][_0x6955('0x44')]){_0x2fde5e[_0x6955('0x43')]=_[_0x6955('0x45')](_0x2fde5e[_0x6955('0x43')],{'$or':_['map'](_0x5c0be3,function(_0x37b478){if(_0x37b478['type']!==_0x6955('0x46')){var _0x2ce9a0={};_0x2ce9a0[_0x37b478['name']]={'$like':'%'+_0x1d2615['query']['filter']+'%'};return _0x2ce9a0;}})});}_0x2fde5e=_[_0x6955('0x45')]({},_0x2fde5e,_0x1d2615[_0x6955('0x47')]);var _0x18e0b8={'where':_0x2fde5e[_0x6955('0x43')]};return db[_0x6955('0x48')]['count'](_0x18e0b8)['then'](function(_0x5701d9){_0x55e9b2['count']=_0x5701d9;if(_0x1d2615['query'][_0x6955('0x49')]){_0x2fde5e['include']=[{'all':!![]}];}return db[_0x6955('0x48')][_0x6955('0x4a')](_0x2fde5e);})['then'](function(_0x28baed){_0x55e9b2[_0x6955('0x4b')]=_0x28baed;return _0x55e9b2;})[_0x6955('0x19')](respondWithFilteredResult(_0x592c52,_0x2fde5e))[_0x6955('0x23')](handleError(_0x592c52,null));};exports[_0x6955('0x4c')]=function(_0x133995,_0x2daff7){var _0x700e69={'raw':![],'where':{'id':_0x133995['params']['id']}},_0x1fd3b4={};_0x1fd3b4['model']=_[_0x6955('0x4d')](db['VoiceContext'][_0x6955('0x37')]);_0x1fd3b4[_0x6955('0x3b')]=_[_0x6955('0x4d')](_0x133995[_0x6955('0x3b')]);_0x1fd3b4[_0x6955('0x3c')]=_[_0x6955('0x3d')](_0x1fd3b4['model'],_0x1fd3b4['query']);_0x700e69[_0x6955('0x3e')]=_[_0x6955('0x3d')](_0x1fd3b4['model'],qs[_0x6955('0x3f')](_0x133995[_0x6955('0x3b')][_0x6955('0x3f')]));_0x700e69[_0x6955('0x3e')]=_0x700e69[_0x6955('0x3e')][_0x6955('0x4e')]?_0x700e69[_0x6955('0x3e')]:_0x1fd3b4[_0x6955('0x3a')];if(_0x133995[_0x6955('0x3b')]['includeAll']){_0x700e69[_0x6955('0x4f')]=[{'all':!![]}];}_0x700e69=_[_0x6955('0x45')]({},_0x700e69,_0x133995[_0x6955('0x47')]);return db['VoiceContext'][_0x6955('0x50')](_0x700e69)['then'](handleEntityNotFound(_0x2daff7,null))[_0x6955('0x19')](respondWithResult(_0x2daff7,null))[_0x6955('0x23')](handleError(_0x2daff7,null));};exports['create']=function(_0x410cb3,_0x25be3b,_0x4b6caa){var _0x171878;return db[_0x6955('0x48')][_0x6955('0x51')](_0x410cb3[_0x6955('0x52')],{'raw':!![]})[_0x6955('0x19')](function(_0x45fd75){_0x171878=_0x45fd75;return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x1a938b){var _0x36dbdc=fs['readFileSync'](path[_0x6955('0x53')](config[_0x6955('0x54')],_0x6955('0x55')),_0x6955('0x56'));var _0x4bae92=ejs[_0x6955('0x57')](_0x36dbdc,{'contexts':_0x1a938b||[]});fs[_0x6955('0x58')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x4bae92);})[_0x6955('0x19')](function(){return respondWithRpcPromise(_0x6955('0x59'),_0x6955('0x51'),{'module':_0x6955('0x5a')});})[_0x6955('0x19')](function(){var _0x53d7b7=_0x410cb3[_0x6955('0x5b')][_0x6955('0x31')]({'plain':!![]});if(!_0x53d7b7)throw new Error(_0x6955('0x5c'));if(_0x53d7b7[_0x6955('0x5d')]==='user'){var _0x21e197=_0x171878['get']({'plain':!![]});return db['UserProfileSection'][_0x6955('0x50')]({'where':{'name':_0x6955('0x32'),'userProfileId':_0x53d7b7[_0x6955('0x5e')]},'raw':!![]})[_0x6955('0x19')](function(_0x163e29){if(_0x163e29&&_0x163e29[_0x6955('0x5f')]===0x0){return db[_0x6955('0x33')][_0x6955('0x51')]({'name':_0x21e197[_0x6955('0x34')],'resourceId':_0x21e197['id'],'type':_0x163e29[_0x6955('0x34')],'sectionId':_0x163e29['id']},{})['then'](function(){return _0x171878;});}else{return _0x171878;}})[_0x6955('0x23')](function(_0x391dd8){logger['error'](_0x6955('0x60'),_0x391dd8);throw _0x391dd8;});}return _0x171878;})[_0x6955('0x19')](respondWithResult(_0x25be3b,0xc9))[_0x6955('0x23')](handleError(_0x25be3b,null));};exports['update']=function(_0x385e4,_0x58a1fa,_0xb3db18){var _0x154aab;return db[_0x6955('0x48')][_0x6955('0x50')]({'where':{'id':_0x385e4[_0x6955('0x61')]['id']}})[_0x6955('0x19')](handleEntityNotFound(_0x58a1fa,null))[_0x6955('0x19')](saveUpdates(_0x385e4[_0x6955('0x52')],null))['then'](function(_0x3472ab){if(_0x3472ab){_0x154aab=_0x3472ab;return db['VoiceContext'][_0x6955('0x4a')]({'raw':!![]});}})[_0x6955('0x19')](function(_0x2dd09e){var _0xc8f562=fs[_0x6955('0x62')](path[_0x6955('0x53')](config[_0x6955('0x54')],'server/files/templates/context.ejs'),_0x6955('0x56'));var _0x9d12bc=ejs[_0x6955('0x57')](_0xc8f562,{'contexts':_0x2dd09e||[]});fs[_0x6955('0x58')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x9d12bc);})[_0x6955('0x19')](function(){return respondWithRpcPromise(_0x6955('0x59'),'update',{'module':_0x6955('0x5a')});})['then'](function(){return _0x154aab;})[_0x6955('0x19')](respondWithResult(_0x58a1fa,null))['catch'](handleError(_0x58a1fa,null));};exports[_0x6955('0x30')]=function(_0x4a83e8,_0x50e854,_0x29e27b){var _0x19553a;return db[_0x6955('0x48')][_0x6955('0x50')]({'where':{'id':_0x4a83e8['params']['id']}})[_0x6955('0x19')](handleEntityNotFound(_0x50e854,null))[_0x6955('0x19')](removeEntity(_0x50e854,null))[_0x6955('0x19')](function(){return db['VoiceContext'][_0x6955('0x4a')]({'raw':!![]});})[_0x6955('0x19')](function(_0xd3b11f){var _0x2a3b7d=fs[_0x6955('0x62')](path[_0x6955('0x53')](config[_0x6955('0x54')],_0x6955('0x55')),_0x6955('0x56'));var _0xd4afc3=ejs[_0x6955('0x57')](_0x2a3b7d,{'contexts':_0xd3b11f});fs[_0x6955('0x58')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xd4afc3);return respondWithRpcPromise(_0x6955('0x59'),'destroy',{'module':_0x6955('0x5a')});})['catch'](handleError(_0x50e854,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 56f7aa1..87ee0e0 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 _0xf6e6=['bluebird','request-promise','path','rimraf','../../config/environment','VoiceContext','lodash','util','../../config/logger','api','moment'];(function(_0x4eb09f,_0x16eaf1){var _0x23c072=function(_0x3ee8e8){while(--_0x3ee8e8){_0x4eb09f['push'](_0x4eb09f['shift']());}};_0x23c072(++_0x16eaf1);}(_0xf6e6,0x1a8));var _0x6f6e=function(_0x5a9f8d,_0x56097e){_0x5a9f8d=_0x5a9f8d-0x0;var _0x43e517=_0xf6e6[_0x5a9f8d];return _0x43e517;};'use strict';var _=require(_0x6f6e('0x0'));var util=require(_0x6f6e('0x1'));var logger=require(_0x6f6e('0x2'))(_0x6f6e('0x3'));var moment=require(_0x6f6e('0x4'));var BPromise=require(_0x6f6e('0x5'));var rp=require(_0x6f6e('0x6'));var fs=require('fs');var path=require(_0x6f6e('0x7'));var rimraf=require(_0x6f6e('0x8'));var config=require(_0x6f6e('0x9'));var attributes=require('./voiceContext.attributes');module['exports']=function(_0x572a51,_0x586ea1){return _0x572a51['define'](_0x6f6e('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f8d=['util','../../config/logger','moment','bluebird','request-promise','rimraf','./voiceContext.attributes','exports','voice_contexts','lodash'];(function(_0x1defb2,_0x429099){var _0xad8973=function(_0xe26c42){while(--_0xe26c42){_0x1defb2['push'](_0x1defb2['shift']());}};_0xad8973(++_0x429099);}(_0x0f8d,0x185));var _0xd0f8=function(_0x2a2f0d,_0x56b22a){_0x2a2f0d=_0x2a2f0d-0x0;var _0x36809c=_0x0f8d[_0x2a2f0d];return _0x36809c;};'use strict';var _=require(_0xd0f8('0x0'));var util=require(_0xd0f8('0x1'));var logger=require(_0xd0f8('0x2'))('api');var moment=require(_0xd0f8('0x3'));var BPromise=require(_0xd0f8('0x4'));var rp=require(_0xd0f8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0f8('0x6'));var config=require('../../config/environment');var attributes=require(_0xd0f8('0x7'));module[_0xd0f8('0x8')]=function(_0x3ec97d,_0x202090){return _0x3ec97d['define']('VoiceContext',attributes,{'tableName':_0xd0f8('0x9'),'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 233a407..3d132a5 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 _0x4ad3=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x4ad3,0x1b1));var _0x34ad=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0x4ad3[_0x4687df];return _0x32eaef;};'use strict';var _=require(_0x34ad('0x0'));var util=require(_0x34ad('0x1'));var moment=require(_0x34ad('0x2'));var BPromise=require(_0x34ad('0x3'));var rs=require(_0x34ad('0x4'));var fs=require('fs');var Redis=require(_0x34ad('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ad('0x6'));var logger=require(_0x34ad('0x7'))(_0x34ad('0x8'));var config=require(_0x34ad('0x9'));var jayson=require(_0x34ad('0xa'));var client=jayson[_0x34ad('0xb')][_0x34ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b927b,_0x674cc7,_0x10d356){return new BPromise(function(_0x4b6c38,_0x582178){return client[_0x34ad('0xd')](_0x3b927b,_0x10d356)[_0x34ad('0xe')](function(_0xb6c4f5){logger[_0x34ad('0xf')]('VoiceContext,\x20%s,\x20%s',_0x674cc7,_0x34ad('0x10'));logger[_0x34ad('0x11')](_0x34ad('0x12'),_0x674cc7,_0x34ad('0x10'),JSON[_0x34ad('0x13')](_0xb6c4f5));if(_0xb6c4f5[_0x34ad('0x14')]){if(_0xb6c4f5[_0x34ad('0x14')][_0x34ad('0x15')]===0x1f4){logger[_0x34ad('0x14')](_0x34ad('0x16'),_0x674cc7,_0xb6c4f5[_0x34ad('0x14')][_0x34ad('0x17')]);return _0x582178(_0xb6c4f5[_0x34ad('0x14')][_0x34ad('0x17')]);}logger[_0x34ad('0x14')](_0x34ad('0x16'),_0x674cc7,_0xb6c4f5['error'][_0x34ad('0x17')]);return _0x4b6c38(_0xb6c4f5[_0x34ad('0x14')][_0x34ad('0x17')]);}else{logger['info'](_0x34ad('0x16'),_0x674cc7,_0x34ad('0x10'));_0x4b6c38(_0xb6c4f5[_0x34ad('0x18')][_0x34ad('0x17')]);}})[_0x34ad('0x19')](function(_0x48e90a){logger[_0x34ad('0x14')]('VoiceContext,\x20%s,\x20%s',_0x674cc7,_0x48e90a);_0x582178(_0x48e90a);});});} \ No newline at end of file +var _0x2fe5=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','message','VoiceContext,\x20%s,\x20%s','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x40ff3b,_0x238af7){var _0x3ccf4f=function(_0x397ae0){while(--_0x397ae0){_0x40ff3b['push'](_0x40ff3b['shift']());}};_0x3ccf4f(++_0x238af7);}(_0x2fe5,0x14b));var _0x52fe=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2fe5[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x52fe('0x0'));var util=require(_0x52fe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x52fe('0x2'));var fs=require('fs');var Redis=require(_0x52fe('0x3'));var db=require(_0x52fe('0x4'))['db'];var utils=require(_0x52fe('0x5'));var logger=require(_0x52fe('0x6'))('rpc');var config=require(_0x52fe('0x7'));var jayson=require(_0x52fe('0x8'));var client=jayson['client'][_0x52fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x157c5a,_0x2b3f41,_0x31b5dd){return new BPromise(function(_0x408cef,_0x49f7d9){return client[_0x52fe('0xa')](_0x157c5a,_0x31b5dd)[_0x52fe('0xb')](function(_0xe73ece){logger['info']('VoiceContext,\x20%s,\x20%s',_0x2b3f41,_0x52fe('0xc'));logger[_0x52fe('0xd')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2b3f41,_0x52fe('0xc'),JSON[_0x52fe('0xe')](_0xe73ece));if(_0xe73ece[_0x52fe('0xf')]){if(_0xe73ece[_0x52fe('0xf')]['code']===0x1f4){logger[_0x52fe('0xf')]('VoiceContext,\x20%s,\x20%s',_0x2b3f41,_0xe73ece[_0x52fe('0xf')]['message']);return _0x49f7d9(_0xe73ece[_0x52fe('0xf')][_0x52fe('0x10')]);}logger[_0x52fe('0xf')](_0x52fe('0x11'),_0x2b3f41,_0xe73ece['error'][_0x52fe('0x10')]);return _0x408cef(_0xe73ece[_0x52fe('0xf')][_0x52fe('0x10')]);}else{logger[_0x52fe('0x12')](_0x52fe('0x11'),_0x2b3f41,_0x52fe('0xc'));_0x408cef(_0xe73ece[_0x52fe('0x13')][_0x52fe('0x10')]);}})[_0x52fe('0x14')](function(_0x33ab22){logger['error']('VoiceContext,\x20%s,\x20%s',_0x2b3f41,_0x33ab22);_0x49f7d9(_0x33ab22);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 9042788..568594a 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 _0x37a4=['./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','path','express','Router','fs-extra','../../config/environment'];(function(_0x3c25c9,_0x552da8){var _0x33e149=function(_0x29d615){while(--_0x29d615){_0x3c25c9['push'](_0x3c25c9['shift']());}};_0x33e149(++_0x552da8);}(_0x37a4,0xcb));var _0x437a=function(_0x4ca7bb,_0xfde519){_0x4ca7bb=_0x4ca7bb-0x0;var _0x14e575=_0x37a4[_0x4ca7bb];return _0x14e575;};'use strict';var multer=require(_0x437a('0x0'));var util=require('util');var path=require(_0x437a('0x1'));var timeout=require('connect-timeout');var express=require(_0x437a('0x2'));var router=express[_0x437a('0x3')]();var fs_extra=require(_0x437a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x437a('0x5'));var controller=require(_0x437a('0x6'));router[_0x437a('0x7')]('/',auth[_0x437a('0x8')](),controller['index']);router[_0x437a('0x7')](_0x437a('0x9'),auth['isAuthenticated'](),controller[_0x437a('0xa')]);router[_0x437a('0x7')](_0x437a('0xb'),auth[_0x437a('0x8')](),controller[_0x437a('0xc')]);router[_0x437a('0xd')]('/',auth[_0x437a('0x8')](),controller[_0x437a('0xe')]);router[_0x437a('0xf')](_0x437a('0xb'),auth[_0x437a('0x8')](),controller['update']);router[_0x437a('0x10')](_0x437a('0xb'),auth[_0x437a('0x8')](),controller[_0x437a('0x11')]);module[_0x437a('0x12')]=router; \ No newline at end of file +var _0x682e=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put'];(function(_0x29632e,_0x5ecba4){var _0x426e04=function(_0x4eb357){while(--_0x4eb357){_0x29632e['push'](_0x29632e['shift']());}};_0x426e04(++_0x5ecba4);}(_0x682e,0x1ce));var _0xe682=function(_0x191460,_0x434d78){_0x191460=_0x191460-0x0;var _0x458b5a=_0x682e[_0x191460];return _0x458b5a;};'use strict';var multer=require(_0xe682('0x0'));var util=require(_0xe682('0x1'));var path=require(_0xe682('0x2'));var timeout=require(_0xe682('0x3'));var express=require(_0xe682('0x4'));var router=express[_0xe682('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe682('0x6'));var interaction=require(_0xe682('0x7'));var config=require(_0xe682('0x8'));var controller=require(_0xe682('0x9'));router[_0xe682('0xa')]('/',auth[_0xe682('0xb')](),controller[_0xe682('0xc')]);router[_0xe682('0xa')](_0xe682('0xd'),auth[_0xe682('0xb')](),controller['describe']);router[_0xe682('0xa')](_0xe682('0xe'),auth[_0xe682('0xb')](),controller[_0xe682('0xf')]);router[_0xe682('0x10')]('/',auth[_0xe682('0xb')](),controller['create']);router[_0xe682('0x11')]('/:id',auth[_0xe682('0xb')](),controller['update']);router['delete'](_0xe682('0xe'),auth[_0xe682('0xb')](),controller[_0xe682('0x12')]);module[_0xe682('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index e45e512..04bd127 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 _0xa41a=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x2f2ce4,_0xe81350){var _0x517cb9=function(_0x170cce){while(--_0x170cce){_0x2f2ce4['push'](_0x2f2ce4['shift']());}};_0x517cb9(++_0xe81350);}(_0xa41a,0x6b));var _0xaa41=function(_0x5e9dc5,_0x1f9a00){_0x5e9dc5=_0x5e9dc5-0x0;var _0x14fcd9=_0xa41a[_0x5e9dc5];return _0x14fcd9;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xaa41('0x2')]},'channelstate':{'type':Sequelize[_0xaa41('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'calleridnum':{'type':Sequelize[_0xaa41('0x2')]},'calleridname':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'language':{'type':Sequelize[_0xaa41('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xaa41('0x2')]},'exten':{'type':Sequelize[_0xaa41('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xaa41('0x2')]},'destchannel':{'type':Sequelize[_0xaa41('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridnum':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridname':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'destlanguage':{'type':Sequelize[_0xaa41('0x2')]},'destaccountcode':{'type':Sequelize[_0xaa41('0x2')]},'destcontext':{'type':Sequelize[_0xaa41('0x2')]},'destexten':{'type':Sequelize[_0xaa41('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xaa41('0x2')]},'destlinkedid':{'type':Sequelize[_0xaa41('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xaa41('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xaa41('0x4')]},'lastevent':{'type':Sequelize[_0xaa41('0x2')],'comment':_0xaa41('0x5')},'routeId':{'type':Sequelize[_0xaa41('0x3')]},'duration':{'type':Sequelize[_0xaa41('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xaa41('0x3')]}}; \ No newline at end of file +var _0x55ca=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x3f9d1d,_0x3fc4dd){var _0x4be18a=function(_0x11efd8){while(--_0x11efd8){_0x3f9d1d['push'](_0x3f9d1d['shift']());}};_0x4be18a(++_0x3fc4dd);}(_0x55ca,0x126));var _0xa55c=function(_0x316904,_0x1e8b77){_0x316904=_0x316904-0x0;var _0xfa9a21=_0x55ca[_0x316904];return _0xfa9a21;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'calleridnum':{'type':Sequelize[_0xa55c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa55c('0x2')]},'connectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'language':{'type':Sequelize[_0xa55c('0x2')]},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'context':{'type':Sequelize[_0xa55c('0x2')]},'exten':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa55c('0x2')]},'destchannel':{'type':Sequelize[_0xa55c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'destlanguage':{'type':Sequelize[_0xa55c('0x2')]},'destaccountcode':{'type':Sequelize[_0xa55c('0x2')]},'destcontext':{'type':Sequelize[_0xa55c('0x2')]},'destexten':{'type':Sequelize[_0xa55c('0x2')]},'destpriority':{'type':Sequelize[_0xa55c('0x3')]},'destuniqueid':{'type':Sequelize[_0xa55c('0x2')]},'destlinkedid':{'type':Sequelize[_0xa55c('0x2')]},'dialstring':{'type':Sequelize[_0xa55c('0x2')]},'dialstatus':{'type':Sequelize[_0xa55c('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa55c('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa55c('0x3')]},'holdtime':{'type':Sequelize[_0xa55c('0x3')]},'billableseconds':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 6c64c80..55896e5 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 _0xfdfa=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','filter','merge','options','includeAll','include','VoiceDialReport','findAll','rows','catch','show','create','body','find','params','describe','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys'];(function(_0x51a6d6,_0x3c9c49){var _0x5ef1a8=function(_0x8ff84a){while(--_0x8ff84a){_0x51a6d6['push'](_0x51a6d6['shift']());}};_0x5ef1a8(++_0x3c9c49);}(_0xfdfa,0x127));var _0xafdf=function(_0x47beeb,_0x8b8e6){_0x47beeb=_0x47beeb-0x0;var _0x7ccb0b=_0xfdfa[_0x47beeb];return _0x7ccb0b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xafdf('0x0'));var jsonpatch=require(_0xafdf('0x1'));var rp=require('request-promise');var moment=require(_0xafdf('0x2'));var BPromise=require(_0xafdf('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xafdf('0x4'));var sox=require('sox');var csv=require(_0xafdf('0x5'));var ejs=require(_0xafdf('0x6'));var fs=require('fs');var fs_extra=require(_0xafdf('0x7'));var _=require(_0xafdf('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xafdf('0x9'));var deskjs=require(_0xafdf('0xa'));var toCsv=require(_0xafdf('0x5'));var querystring=require(_0xafdf('0xb'));var Papa=require(_0xafdf('0xc'));var Redis=require('ioredis');var authService=require(_0xafdf('0xd'));var qs=require(_0xafdf('0xe'));var as=require(_0xafdf('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xafdf('0x10'))('api');var utils=require(_0xafdf('0x11'));var config=require(_0xafdf('0x12'));var licenseUtil=require(_0xafdf('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x169215,_0x87fa21){_0x87fa21=_0x87fa21||0xcc;return function(_0x3f9ed0){if(_0x3f9ed0){return _0x169215[_0xafdf('0x14')](_0x87fa21);}return _0x169215[_0xafdf('0x15')](_0x87fa21)[_0xafdf('0x16')]();};}function respondWithResult(_0x56276c,_0x2902cf){_0x2902cf=_0x2902cf||0xc8;return function(_0x3b5d39){if(_0x3b5d39){return _0x56276c['status'](_0x2902cf)[_0xafdf('0x17')](_0x3b5d39);}};}function respondWithFilteredResult(_0x454e46,_0x298c12){return function(_0x1f14fc){if(_0x1f14fc){var _0x6317c2=typeof _0x298c12[_0xafdf('0x18')]===_0xafdf('0x19')&&typeof _0x298c12[_0xafdf('0x1a')]===_0xafdf('0x19');var _0xb69c25=_0x1f14fc[_0xafdf('0x1b')];var _0x3b1125=_0x6317c2?0x0:_0x298c12['offset'];var _0x41dfbb=_0x6317c2?_0x1f14fc[_0xafdf('0x1b')]:_0x298c12[_0xafdf('0x18')]+_0x298c12[_0xafdf('0x1a')];var _0x530e3d;if(_0x41dfbb>=_0xb69c25){_0x41dfbb=_0xb69c25;_0x530e3d=0xc8;}else{_0x530e3d=0xce;}_0x454e46[_0xafdf('0x15')](_0x530e3d);return _0x454e46['set']('Content-Range',_0x3b1125+'-'+_0x41dfbb+'/'+_0xb69c25)[_0xafdf('0x17')](_0x1f14fc);}return null;};}function patchUpdates(_0x149065){return function(_0x34b40f){try{jsonpatch['apply'](_0x34b40f,_0x149065,!![]);}catch(_0x447cdf){return BPromise[_0xafdf('0x1c')](_0x447cdf);}return _0x34b40f[_0xafdf('0x1d')]();};}function saveUpdates(_0x3f99bd,_0x199b55){return function(_0x16aec7){if(_0x16aec7){return _0x16aec7[_0xafdf('0x1e')](_0x3f99bd)[_0xafdf('0x1f')](function(_0x1232b0){return _0x1232b0;});}return null;};}function removeEntity(_0x59f728,_0x1318be){return function(_0x327ba5){if(_0x327ba5){return _0x327ba5[_0xafdf('0x20')]()[_0xafdf('0x1f')](function(){_0x59f728['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bfde0,_0x12f397){return function(_0x9a29e1){if(!_0x9a29e1){_0x1bfde0[_0xafdf('0x14')](0x194);}return _0x9a29e1;};}function handleError(_0x47b154,_0xbaca5e){_0xbaca5e=_0xbaca5e||0x1f4;return function(_0x321df8){logger[_0xafdf('0x21')](_0x321df8['stack']);if(_0x321df8['name']){delete _0x321df8[_0xafdf('0x22')];}_0x47b154[_0xafdf('0x15')](_0xbaca5e)[_0xafdf('0x23')](_0x321df8);};}exports[_0xafdf('0x24')]=function(_0x44bdf3,_0x5179d9){var _0x4075bd={},_0xd87c6b={},_0x1198d6={'count':0x0,'rows':[]};var _0x5b8cf5=_['map'](db['VoiceDialReport'][_0xafdf('0x25')],function(_0x2b4998){return{'name':_0x2b4998[_0xafdf('0x26')],'type':_0x2b4998[_0xafdf('0x27')][_0xafdf('0x28')]};});_0xd87c6b[_0xafdf('0x29')]=_[_0xafdf('0x2a')](_0x5b8cf5,_0xafdf('0x22'));_0xd87c6b[_0xafdf('0x2b')]=_[_0xafdf('0x2c')](_0x44bdf3[_0xafdf('0x2b')]);_0xd87c6b[_0xafdf('0x2d')]=_[_0xafdf('0x2e')](_0xd87c6b[_0xafdf('0x29')],_0xd87c6b[_0xafdf('0x2b')]);_0x4075bd['attributes']=_['intersection'](_0xd87c6b[_0xafdf('0x29')],qs[_0xafdf('0x2f')](_0x44bdf3[_0xafdf('0x2b')][_0xafdf('0x2f')]));_0x4075bd['attributes']=_0x4075bd[_0xafdf('0x30')][_0xafdf('0x31')]?_0x4075bd['attributes']:_0xd87c6b['model'];if(!_0x44bdf3[_0xafdf('0x2b')][_0xafdf('0x32')](_0xafdf('0x33'))){_0x4075bd[_0xafdf('0x1a')]=qs[_0xafdf('0x1a')](_0x44bdf3[_0xafdf('0x2b')][_0xafdf('0x1a')]);_0x4075bd[_0xafdf('0x18')]=qs[_0xafdf('0x18')](_0x44bdf3[_0xafdf('0x2b')][_0xafdf('0x18')]);}_0x4075bd['order']=qs['sort'](_0x44bdf3[_0xafdf('0x2b')]['sort']);_0x4075bd[_0xafdf('0x34')]=qs['filters'](_['pick'](_0x44bdf3[_0xafdf('0x2b')],_0xd87c6b[_0xafdf('0x2d')]),_0x5b8cf5);if(_0x44bdf3[_0xafdf('0x2b')][_0xafdf('0x35')]){_0x4075bd['where']=_[_0xafdf('0x36')](_0x4075bd[_0xafdf('0x34')],{'$or':_['map'](_0x5b8cf5,function(_0x1ce7ce){if(_0x1ce7ce[_0xafdf('0x27')]!=='VIRTUAL'){var _0x317e47={};_0x317e47[_0x1ce7ce[_0xafdf('0x22')]]={'$like':'%'+_0x44bdf3[_0xafdf('0x2b')][_0xafdf('0x35')]+'%'};return _0x317e47;}})});}_0x4075bd=_[_0xafdf('0x36')]({},_0x4075bd,_0x44bdf3[_0xafdf('0x37')]);var _0x5ae138={'where':_0x4075bd['where']};return db['VoiceDialReport'][_0xafdf('0x1b')](_0x5ae138)['then'](function(_0x2ed712){_0x1198d6['count']=_0x2ed712;if(_0x44bdf3[_0xafdf('0x2b')][_0xafdf('0x38')]){_0x4075bd[_0xafdf('0x39')]=[{'all':!![]}];}return db[_0xafdf('0x3a')][_0xafdf('0x3b')](_0x4075bd);})[_0xafdf('0x1f')](function(_0x2656eb){_0x1198d6[_0xafdf('0x3c')]=_0x2656eb;return _0x1198d6;})[_0xafdf('0x1f')](respondWithFilteredResult(_0x5179d9,_0x4075bd))[_0xafdf('0x3d')](handleError(_0x5179d9,null));};exports[_0xafdf('0x3e')]=function(_0x23b916,_0x5e9c6c){var _0x3367e8={'raw':!![],'where':{'id':_0x23b916['params']['id']}},_0x1bdef2={};_0x1bdef2[_0xafdf('0x29')]=_[_0xafdf('0x2c')](db[_0xafdf('0x3a')][_0xafdf('0x25')]);_0x1bdef2[_0xafdf('0x2b')]=_[_0xafdf('0x2c')](_0x23b916[_0xafdf('0x2b')]);_0x1bdef2['filters']=_[_0xafdf('0x2e')](_0x1bdef2['model'],_0x1bdef2[_0xafdf('0x2b')]);_0x3367e8['attributes']=_[_0xafdf('0x2e')](_0x1bdef2['model'],qs['fields'](_0x23b916[_0xafdf('0x2b')]['fields']));_0x3367e8['attributes']=_0x3367e8[_0xafdf('0x30')][_0xafdf('0x31')]?_0x3367e8['attributes']:_0x1bdef2[_0xafdf('0x29')];if(_0x23b916['query']['includeAll']){_0x3367e8[_0xafdf('0x39')]=[{'all':!![]}];}_0x3367e8=_[_0xafdf('0x36')]({},_0x3367e8,_0x23b916[_0xafdf('0x37')]);return db['VoiceDialReport']['find'](_0x3367e8)[_0xafdf('0x1f')](handleEntityNotFound(_0x5e9c6c,null))[_0xafdf('0x1f')](respondWithResult(_0x5e9c6c,null))[_0xafdf('0x3d')](handleError(_0x5e9c6c,null));};exports[_0xafdf('0x3f')]=function(_0x57c8be,_0x4cadde){return db[_0xafdf('0x3a')][_0xafdf('0x3f')](_0x57c8be[_0xafdf('0x40')],{})[_0xafdf('0x1f')](respondWithResult(_0x4cadde,0xc9))[_0xafdf('0x3d')](handleError(_0x4cadde,null));};exports[_0xafdf('0x1e')]=function(_0xc04bc7,_0x143fe9){if(_0xc04bc7[_0xafdf('0x40')]['id']){delete _0xc04bc7[_0xafdf('0x40')]['id'];}return db[_0xafdf('0x3a')][_0xafdf('0x41')]({'where':{'id':_0xc04bc7[_0xafdf('0x42')]['id']}})[_0xafdf('0x1f')](handleEntityNotFound(_0x143fe9,null))[_0xafdf('0x1f')](saveUpdates(_0xc04bc7['body'],null))[_0xafdf('0x1f')](respondWithResult(_0x143fe9,null))['catch'](handleError(_0x143fe9,null));};exports['destroy']=function(_0x34809d,_0x54ed56){return db[_0xafdf('0x3a')][_0xafdf('0x41')]({'where':{'id':_0x34809d[_0xafdf('0x42')]['id']}})[_0xafdf('0x1f')](handleEntityNotFound(_0x54ed56,null))[_0xafdf('0x1f')](removeEntity(_0x54ed56,null))[_0xafdf('0x3d')](handleError(_0x54ed56,null));};exports[_0xafdf('0x43')]=function(_0x4c1dec,_0xdc31d0){return db[_0xafdf('0x3a')][_0xafdf('0x43')]()[_0xafdf('0x1f')](respondWithResult(_0xdc31d0,null))[_0xafdf('0x3d')](handleError(_0xdc31d0,null));}; \ No newline at end of file +var _0x0a7c=['../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','sendStatus','stack','name','send','index','map','VoiceDialReport','fieldName','type','key','keys','model','query','intersection','fields','attributes','length','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x1c21f7,_0x474549){var _0x119f60=function(_0x5eddab){while(--_0x5eddab){_0x1c21f7['push'](_0x1c21f7['shift']());}};_0x119f60(++_0x474549);}(_0x0a7c,0x1a6));var _0xc0a7=function(_0x46ce21,_0x254327){_0x46ce21=_0x46ce21-0x0;var _0x4901ba=_0x0a7c[_0x46ce21];return _0x4901ba;};'use strict';var emlformat=require(_0xc0a7('0x0'));var rimraf=require(_0xc0a7('0x1'));var zipdir=require(_0xc0a7('0x2'));var jsonpatch=require(_0xc0a7('0x3'));var rp=require(_0xc0a7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc0a7('0x5'));var util=require(_0xc0a7('0x6'));var path=require(_0xc0a7('0x7'));var sox=require(_0xc0a7('0x8'));var csv=require(_0xc0a7('0x9'));var ejs=require(_0xc0a7('0xa'));var fs=require('fs');var fs_extra=require(_0xc0a7('0xb'));var _=require('lodash');var squel=require(_0xc0a7('0xc'));var crypto=require('crypto');var jsforce=require(_0xc0a7('0xd'));var deskjs=require(_0xc0a7('0xe'));var toCsv=require(_0xc0a7('0x9'));var querystring=require(_0xc0a7('0xf'));var Papa=require(_0xc0a7('0x10'));var Redis=require(_0xc0a7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc0a7('0x12'));var as=require(_0xc0a7('0x13'));var hardwareService=require(_0xc0a7('0x14'));var logger=require('../../config/logger')(_0xc0a7('0x15'));var utils=require(_0xc0a7('0x16'));var config=require(_0xc0a7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc0a7('0x18'))['db'];function respondWithStatusCode(_0x3ae11a,_0xfffd22){_0xfffd22=_0xfffd22||0xcc;return function(_0x24e45d){if(_0x24e45d){return _0x3ae11a['sendStatus'](_0xfffd22);}return _0x3ae11a[_0xc0a7('0x19')](_0xfffd22)[_0xc0a7('0x1a')]();};}function respondWithResult(_0x5277f1,_0x1db16b){_0x1db16b=_0x1db16b||0xc8;return function(_0x138149){if(_0x138149){return _0x5277f1[_0xc0a7('0x19')](_0x1db16b)[_0xc0a7('0x1b')](_0x138149);}};}function respondWithFilteredResult(_0x31a5fb,_0x1d6c5c){return function(_0xce907d){if(_0xce907d){var _0x5b2451=typeof _0x1d6c5c['offset']===_0xc0a7('0x1c')&&typeof _0x1d6c5c[_0xc0a7('0x1d')]===_0xc0a7('0x1c');var _0x439859=_0xce907d[_0xc0a7('0x1e')];var _0x561732=_0x5b2451?0x0:_0x1d6c5c[_0xc0a7('0x1f')];var _0x43dbc7=_0x5b2451?_0xce907d[_0xc0a7('0x1e')]:_0x1d6c5c[_0xc0a7('0x1f')]+_0x1d6c5c[_0xc0a7('0x1d')];var _0x19a6d5;if(_0x43dbc7>=_0x439859){_0x43dbc7=_0x439859;_0x19a6d5=0xc8;}else{_0x19a6d5=0xce;}_0x31a5fb[_0xc0a7('0x19')](_0x19a6d5);return _0x31a5fb[_0xc0a7('0x20')](_0xc0a7('0x21'),_0x561732+'-'+_0x43dbc7+'/'+_0x439859)[_0xc0a7('0x1b')](_0xce907d);}return null;};}function patchUpdates(_0x4a0499){return function(_0x4adc10){try{jsonpatch[_0xc0a7('0x22')](_0x4adc10,_0x4a0499,!![]);}catch(_0x456823){return BPromise['reject'](_0x456823);}return _0x4adc10['save']();};}function saveUpdates(_0x4dd9bd,_0x3a617f){return function(_0x207b3f){if(_0x207b3f){return _0x207b3f[_0xc0a7('0x23')](_0x4dd9bd)[_0xc0a7('0x24')](function(_0x1f40e0){return _0x1f40e0;});}return null;};}function removeEntity(_0x3f54c3,_0x4a7b41){return function(_0x597181){if(_0x597181){return _0x597181['destroy']()[_0xc0a7('0x24')](function(){_0x3f54c3[_0xc0a7('0x19')](0xcc)[_0xc0a7('0x1a')]();});}};}function handleEntityNotFound(_0xf64e84,_0x33e957){return function(_0x5c8f26){if(!_0x5c8f26){_0xf64e84[_0xc0a7('0x25')](0x194);}return _0x5c8f26;};}function handleError(_0x1068ac,_0x358073){_0x358073=_0x358073||0x1f4;return function(_0x4ad89e){logger['error'](_0x4ad89e[_0xc0a7('0x26')]);if(_0x4ad89e[_0xc0a7('0x27')]){delete _0x4ad89e[_0xc0a7('0x27')];}_0x1068ac[_0xc0a7('0x19')](_0x358073)[_0xc0a7('0x28')](_0x4ad89e);};}exports[_0xc0a7('0x29')]=function(_0x5a4da3,_0x40b7e3){var _0x32b509={},_0x575a77={},_0x559d7f={'count':0x0,'rows':[]};var _0x232be5=_[_0xc0a7('0x2a')](db[_0xc0a7('0x2b')]['rawAttributes'],function(_0x586a5d){return{'name':_0x586a5d[_0xc0a7('0x2c')],'type':_0x586a5d[_0xc0a7('0x2d')][_0xc0a7('0x2e')]};});_0x575a77['model']=_[_0xc0a7('0x2a')](_0x232be5,_0xc0a7('0x27'));_0x575a77['query']=_[_0xc0a7('0x2f')](_0x5a4da3['query']);_0x575a77['filters']=_['intersection'](_0x575a77[_0xc0a7('0x30')],_0x575a77[_0xc0a7('0x31')]);_0x32b509['attributes']=_[_0xc0a7('0x32')](_0x575a77['model'],qs[_0xc0a7('0x33')](_0x5a4da3[_0xc0a7('0x31')]['fields']));_0x32b509[_0xc0a7('0x34')]=_0x32b509[_0xc0a7('0x34')][_0xc0a7('0x35')]?_0x32b509[_0xc0a7('0x34')]:_0x575a77[_0xc0a7('0x30')];if(!_0x5a4da3[_0xc0a7('0x31')]['hasOwnProperty'](_0xc0a7('0x36'))){_0x32b509[_0xc0a7('0x1d')]=qs[_0xc0a7('0x1d')](_0x5a4da3[_0xc0a7('0x31')][_0xc0a7('0x1d')]);_0x32b509['offset']=qs[_0xc0a7('0x1f')](_0x5a4da3[_0xc0a7('0x31')][_0xc0a7('0x1f')]);}_0x32b509['order']=qs[_0xc0a7('0x37')](_0x5a4da3['query']['sort']);_0x32b509[_0xc0a7('0x38')]=qs[_0xc0a7('0x39')](_['pick'](_0x5a4da3['query'],_0x575a77['filters']),_0x232be5);if(_0x5a4da3[_0xc0a7('0x31')][_0xc0a7('0x3a')]){_0x32b509['where']=_['merge'](_0x32b509[_0xc0a7('0x38')],{'$or':_[_0xc0a7('0x2a')](_0x232be5,function(_0x292d5e){if(_0x292d5e[_0xc0a7('0x2d')]!==_0xc0a7('0x3b')){var _0x3b1f83={};_0x3b1f83[_0x292d5e[_0xc0a7('0x27')]]={'$like':'%'+_0x5a4da3[_0xc0a7('0x31')][_0xc0a7('0x3a')]+'%'};return _0x3b1f83;}})});}_0x32b509=_[_0xc0a7('0x3c')]({},_0x32b509,_0x5a4da3[_0xc0a7('0x3d')]);var _0x1ddfe8={'where':_0x32b509[_0xc0a7('0x38')]};return db[_0xc0a7('0x2b')][_0xc0a7('0x1e')](_0x1ddfe8)['then'](function(_0xef46c3){_0x559d7f[_0xc0a7('0x1e')]=_0xef46c3;if(_0x5a4da3[_0xc0a7('0x31')][_0xc0a7('0x3e')]){_0x32b509[_0xc0a7('0x3f')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xc0a7('0x40')](_0x32b509);})[_0xc0a7('0x24')](function(_0x51ce99){_0x559d7f['rows']=_0x51ce99;return _0x559d7f;})['then'](respondWithFilteredResult(_0x40b7e3,_0x32b509))['catch'](handleError(_0x40b7e3,null));};exports[_0xc0a7('0x41')]=function(_0x3c2a04,_0x34a249){var _0x56941a={'raw':!![],'where':{'id':_0x3c2a04[_0xc0a7('0x42')]['id']}},_0x1aa4fe={};_0x1aa4fe[_0xc0a7('0x30')]=_[_0xc0a7('0x2f')](db[_0xc0a7('0x2b')][_0xc0a7('0x43')]);_0x1aa4fe[_0xc0a7('0x31')]=_['keys'](_0x3c2a04['query']);_0x1aa4fe[_0xc0a7('0x39')]=_[_0xc0a7('0x32')](_0x1aa4fe[_0xc0a7('0x30')],_0x1aa4fe[_0xc0a7('0x31')]);_0x56941a[_0xc0a7('0x34')]=_[_0xc0a7('0x32')](_0x1aa4fe[_0xc0a7('0x30')],qs[_0xc0a7('0x33')](_0x3c2a04[_0xc0a7('0x31')][_0xc0a7('0x33')]));_0x56941a[_0xc0a7('0x34')]=_0x56941a['attributes'][_0xc0a7('0x35')]?_0x56941a[_0xc0a7('0x34')]:_0x1aa4fe[_0xc0a7('0x30')];if(_0x3c2a04['query'][_0xc0a7('0x3e')]){_0x56941a[_0xc0a7('0x3f')]=[{'all':!![]}];}_0x56941a=_[_0xc0a7('0x3c')]({},_0x56941a,_0x3c2a04[_0xc0a7('0x3d')]);return db[_0xc0a7('0x2b')][_0xc0a7('0x44')](_0x56941a)[_0xc0a7('0x24')](handleEntityNotFound(_0x34a249,null))[_0xc0a7('0x24')](respondWithResult(_0x34a249,null))[_0xc0a7('0x45')](handleError(_0x34a249,null));};exports[_0xc0a7('0x46')]=function(_0x49fe21,_0x3206b5){return db[_0xc0a7('0x2b')]['create'](_0x49fe21[_0xc0a7('0x47')],{})[_0xc0a7('0x24')](respondWithResult(_0x3206b5,0xc9))['catch'](handleError(_0x3206b5,null));};exports['update']=function(_0x1a6286,_0x50873b){if(_0x1a6286[_0xc0a7('0x47')]['id']){delete _0x1a6286[_0xc0a7('0x47')]['id'];}return db[_0xc0a7('0x2b')][_0xc0a7('0x44')]({'where':{'id':_0x1a6286[_0xc0a7('0x42')]['id']}})[_0xc0a7('0x24')](handleEntityNotFound(_0x50873b,null))[_0xc0a7('0x24')](saveUpdates(_0x1a6286[_0xc0a7('0x47')],null))['then'](respondWithResult(_0x50873b,null))[_0xc0a7('0x45')](handleError(_0x50873b,null));};exports[_0xc0a7('0x48')]=function(_0x2e8a86,_0x27b673){return db[_0xc0a7('0x2b')]['find']({'where':{'id':_0x2e8a86['params']['id']}})[_0xc0a7('0x24')](handleEntityNotFound(_0x27b673,null))['then'](removeEntity(_0x27b673,null))[_0xc0a7('0x45')](handleError(_0x27b673,null));};exports[_0xc0a7('0x49')]=function(_0x228f2f,_0x4b798c){return db['VoiceDialReport'][_0xc0a7('0x49')]()[_0xc0a7('0x24')](respondWithResult(_0x4b798c,null))[_0xc0a7('0x45')](handleError(_0x4b798c,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 0e81393..019727f 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 _0xb673=['moment','bluebird','path','rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial','lodash','util','api'];(function(_0x4b6e55,_0x5c1ece){var _0x43918e=function(_0x1bbcea){while(--_0x1bbcea){_0x4b6e55['push'](_0x4b6e55['shift']());}};_0x43918e(++_0x5c1ece);}(_0xb673,0xa5));var _0x3b67=function(_0x5e4258,_0x2e0494){_0x5e4258=_0x5e4258-0x0;var _0x5660cb=_0xb673[_0x5e4258];return _0x5660cb;};'use strict';var _=require(_0x3b67('0x0'));var util=require(_0x3b67('0x1'));var logger=require('../../config/logger')(_0x3b67('0x2'));var moment=require(_0x3b67('0x3'));var BPromise=require(_0x3b67('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b67('0x5'));var rimraf=require(_0x3b67('0x6'));var config=require(_0x3b67('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0x3b67('0x8')]=function(_0x4bb159,_0x296e4c){return _0x4bb159[_0x3b67('0x9')](_0x3b67('0xa'),attributes,{'tableName':_0x3b67('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf569=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','VoiceDialReport','report_dial','util'];(function(_0x2c3517,_0x513b08){var _0x2be0a6=function(_0x45bae1){while(--_0x45bae1){_0x2c3517['push'](_0x2c3517['shift']());}};_0x2be0a6(++_0x513b08);}(_0xf569,0xd0));var _0x9f56=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xf569[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var util=require(_0x9f56('0x0'));var logger=require(_0x9f56('0x1'))(_0x9f56('0x2'));var moment=require(_0x9f56('0x3'));var BPromise=require(_0x9f56('0x4'));var rp=require(_0x9f56('0x5'));var fs=require('fs');var path=require(_0x9f56('0x6'));var rimraf=require(_0x9f56('0x7'));var config=require('../../config/environment');var attributes=require(_0x9f56('0x8'));module['exports']=function(_0x467a46,_0x3488f2){return _0x467a46['define'](_0x9f56('0x9'),attributes,{'tableName':_0x9f56('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 39bb3b7..75e6b0a 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 _0xfe02=['where','attributes','limit','UpdateVoiceDialReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','then','update','raw'];(function(_0x45b5db,_0x1cc3c5){var _0x10af94=function(_0x22aaed){while(--_0x22aaed){_0x45b5db['push'](_0x45b5db['shift']());}};_0x10af94(++_0x1cc3c5);}(_0xfe02,0x13f));var _0x2fe0=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xfe02[_0xdc37a1];return _0x99b4fe;};'use strict';var _=require(_0x2fe0('0x0'));var util=require(_0x2fe0('0x1'));var moment=require('moment');var BPromise=require(_0x2fe0('0x2'));var rs=require(_0x2fe0('0x3'));var fs=require('fs');var Redis=require(_0x2fe0('0x4'));var db=require(_0x2fe0('0x5'))['db'];var utils=require(_0x2fe0('0x6'));var logger=require(_0x2fe0('0x7'))(_0x2fe0('0x8'));var config=require(_0x2fe0('0x9'));var jayson=require(_0x2fe0('0xa'));var client=jayson[_0x2fe0('0xb')][_0x2fe0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d635d,_0x29b61e,_0x12a721){return new BPromise(function(_0x2a11c5,_0x513eee){return client['request'](_0x1d635d,_0x12a721)['then'](function(_0x575616){logger[_0x2fe0('0xd')](_0x2fe0('0xe'),_0x29b61e,'request\x20sent');logger[_0x2fe0('0xf')](_0x2fe0('0x10'),_0x29b61e,_0x2fe0('0x11'),JSON[_0x2fe0('0x12')](_0x575616));if(_0x575616[_0x2fe0('0x13')]){if(_0x575616[_0x2fe0('0x13')][_0x2fe0('0x14')]===0x1f4){logger[_0x2fe0('0x13')](_0x2fe0('0xe'),_0x29b61e,_0x575616['error']['message']);return _0x513eee(_0x575616['error'][_0x2fe0('0x15')]);}logger[_0x2fe0('0x13')](_0x2fe0('0xe'),_0x29b61e,_0x575616[_0x2fe0('0x13')]['message']);return _0x2a11c5(_0x575616[_0x2fe0('0x13')]['message']);}else{logger['info'](_0x2fe0('0xe'),_0x29b61e,_0x2fe0('0x11'));_0x2a11c5(_0x575616['result'][_0x2fe0('0x15')]);}})[_0x2fe0('0x16')](function(_0x577690){logger[_0x2fe0('0x13')](_0x2fe0('0xe'),_0x29b61e,_0x577690);_0x513eee(_0x577690);});});}exports[_0x2fe0('0x17')]=function(_0x487905){var _0x10c859=this;return new Promise(function(_0xf2c43a,_0x2d01f7){return db[_0x2fe0('0x18')][_0x2fe0('0x19')](_0x487905[_0x2fe0('0x1a')],{'raw':_0x487905[_0x2fe0('0x1b')]?_0x487905[_0x2fe0('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x2fe0('0x1c')](function(_0x48c9b0){logger['info'](_0x2fe0('0x17'),_0x487905);logger[_0x2fe0('0xf')]('CreateVoiceDialReport',_0x487905,JSON['stringify'](_0x48c9b0));_0xf2c43a(_0x48c9b0);})[_0x2fe0('0x16')](function(_0x3bbcc6){logger[_0x2fe0('0x13')](_0x2fe0('0x17'),_0x3bbcc6[_0x2fe0('0x15')],_0x487905);_0x2d01f7(_0x10c859['error'](0x1f4,_0x3bbcc6['message']));});});};exports['UpdateVoiceDialReport']=function(_0x3cbce6){var _0x2a53a4=this;return new Promise(function(_0x44c3a7,_0x4a8b1e){return db[_0x2fe0('0x18')][_0x2fe0('0x1d')](_0x3cbce6[_0x2fe0('0x1a')],{'raw':_0x3cbce6[_0x2fe0('0x1b')]?_0x3cbce6[_0x2fe0('0x1b')][_0x2fe0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cbce6['options']?_0x3cbce6[_0x2fe0('0x1b')][_0x2fe0('0x1f')]||null:null,'attributes':_0x3cbce6['options']?_0x3cbce6[_0x2fe0('0x1b')][_0x2fe0('0x20')]||null:null,'limit':_0x3cbce6['options']?_0x3cbce6[_0x2fe0('0x1b')][_0x2fe0('0x21')]||null:null})[_0x2fe0('0x1c')](function(_0x31f153){logger['info']('UpdateVoiceDialReport',_0x3cbce6);logger[_0x2fe0('0xf')](_0x2fe0('0x22'),_0x3cbce6,JSON[_0x2fe0('0x12')](_0x31f153));_0x44c3a7(_0x31f153);})[_0x2fe0('0x16')](function(_0x20f635){logger['error'](_0x2fe0('0x22'),_0x20f635[_0x2fe0('0x15')],_0x3cbce6);_0x4a8b1e(_0x2a53a4['error'](0x1f4,_0x20f635['message']));});});}; \ No newline at end of file +var _0x42da=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','UpdateVoiceDialReport','update','raw','limit','util','bluebird','randomstring'];(function(_0x28d8bd,_0x2a9333){var _0x4eacd4=function(_0x52d2a0){while(--_0x52d2a0){_0x28d8bd['push'](_0x28d8bd['shift']());}};_0x4eacd4(++_0x2a9333);}(_0x42da,0x11d));var _0xa42d=function(_0x2846b3,_0x58897b){_0x2846b3=_0x2846b3-0x0;var _0x19e97a=_0x42da[_0x2846b3];return _0x19e97a;};'use strict';var _=require('lodash');var util=require(_0xa42d('0x0'));var moment=require('moment');var BPromise=require(_0xa42d('0x1'));var rs=require(_0xa42d('0x2'));var fs=require('fs');var Redis=require(_0xa42d('0x3'));var db=require(_0xa42d('0x4'))['db'];var utils=require(_0xa42d('0x5'));var logger=require('../../config/logger')(_0xa42d('0x6'));var config=require(_0xa42d('0x7'));var jayson=require(_0xa42d('0x8'));var client=jayson[_0xa42d('0x9')][_0xa42d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1de4cb,_0x2bc3e4,_0x2b9dbc){return new BPromise(function(_0x4c98c4,_0x4b2793){return client[_0xa42d('0xb')](_0x1de4cb,_0x2b9dbc)[_0xa42d('0xc')](function(_0x3fb4dd){logger[_0xa42d('0xd')](_0xa42d('0xe'),_0x2bc3e4,_0xa42d('0xf'));logger[_0xa42d('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x2bc3e4,_0xa42d('0xf'),JSON[_0xa42d('0x11')](_0x3fb4dd));if(_0x3fb4dd[_0xa42d('0x12')]){if(_0x3fb4dd[_0xa42d('0x12')][_0xa42d('0x13')]===0x1f4){logger[_0xa42d('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x2bc3e4,_0x3fb4dd['error'][_0xa42d('0x14')]);return _0x4b2793(_0x3fb4dd[_0xa42d('0x12')][_0xa42d('0x14')]);}logger['error'](_0xa42d('0xe'),_0x2bc3e4,_0x3fb4dd[_0xa42d('0x12')][_0xa42d('0x14')]);return _0x4c98c4(_0x3fb4dd['error'][_0xa42d('0x14')]);}else{logger['info'](_0xa42d('0xe'),_0x2bc3e4,_0xa42d('0xf'));_0x4c98c4(_0x3fb4dd[_0xa42d('0x15')][_0xa42d('0x14')]);}})[_0xa42d('0x16')](function(_0x2f451b){logger['error'](_0xa42d('0xe'),_0x2bc3e4,_0x2f451b);_0x4b2793(_0x2f451b);});});}exports[_0xa42d('0x17')]=function(_0x1e256c){var _0x3f47e7=this;return new Promise(function(_0x49e01c,_0x352dd8){return db[_0xa42d('0x18')][_0xa42d('0x19')](_0x1e256c[_0xa42d('0x1a')],{'raw':_0x1e256c[_0xa42d('0x1b')]?_0x1e256c[_0xa42d('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2a8b86){logger[_0xa42d('0xd')]('CreateVoiceDialReport',_0x1e256c);logger[_0xa42d('0x10')](_0xa42d('0x17'),_0x1e256c,JSON[_0xa42d('0x11')](_0x2a8b86));_0x49e01c(_0x2a8b86);})[_0xa42d('0x16')](function(_0x28d244){logger[_0xa42d('0x12')]('CreateVoiceDialReport',_0x28d244['message'],_0x1e256c);_0x352dd8(_0x3f47e7[_0xa42d('0x12')](0x1f4,_0x28d244['message']));});});};exports[_0xa42d('0x1c')]=function(_0x53eb17){var _0x23c633=this;return new Promise(function(_0x3eb10b,_0x58503c){return db[_0xa42d('0x18')][_0xa42d('0x1d')](_0x53eb17[_0xa42d('0x1a')],{'raw':_0x53eb17['options']?_0x53eb17[_0xa42d('0x1b')][_0xa42d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53eb17['options']?_0x53eb17[_0xa42d('0x1b')]['where']||null:null,'attributes':_0x53eb17[_0xa42d('0x1b')]?_0x53eb17['options']['attributes']||null:null,'limit':_0x53eb17['options']?_0x53eb17[_0xa42d('0x1b')][_0xa42d('0x1f')]||null:null})['then'](function(_0x509172){logger[_0xa42d('0xd')](_0xa42d('0x1c'),_0x53eb17);logger[_0xa42d('0x10')](_0xa42d('0x1c'),_0x53eb17,JSON[_0xa42d('0x11')](_0x509172));_0x3eb10b(_0x509172);})[_0xa42d('0x16')](function(_0x414b9a){logger['error']('UpdateVoiceDialReport',_0x414b9a['message'],_0x53eb17);_0x58503c(_0x23c633[_0xa42d('0x12')](0x1f4,_0x414b9a['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 51dc812..0bc10d2 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 _0x441a=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','create','post','/:id/applications','addApplications'];(function(_0x38c160,_0x1318fa){var _0x780b56=function(_0x51c44e){while(--_0x51c44e){_0x38c160['push'](_0x38c160['shift']());}};_0x780b56(++_0x1318fa);}(_0x441a,0x9e));var _0xa441=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x441a[_0x26b80e];return _0x84a8a8;};'use strict';var multer=require(_0xa441('0x0'));var util=require(_0xa441('0x1'));var path=require(_0xa441('0x2'));var timeout=require(_0xa441('0x3'));var express=require(_0xa441('0x4'));var router=express[_0xa441('0x5')]();var fs_extra=require(_0xa441('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa441('0x7'));var config=require('../../config/environment');var controller=require(_0xa441('0x8'));router[_0xa441('0x9')]('/',auth[_0xa441('0xa')](),controller[_0xa441('0xb')]);router['get'](_0xa441('0xc'),auth[_0xa441('0xa')](),controller[_0xa441('0xd')]);router['post']('/',auth[_0xa441('0xa')](),controller[_0xa441('0xe')]);router[_0xa441('0xf')](_0xa441('0x10'),auth['isAuthenticated'](),controller[_0xa441('0x11')]);router[_0xa441('0x12')](_0xa441('0xc'),auth['isAuthenticated'](),controller[_0xa441('0x13')]);router['delete'](_0xa441('0xc'),auth[_0xa441('0xa')](),controller[_0xa441('0x14')]);module[_0xa441('0x15')]=router; \ No newline at end of file +var _0xd5be=['get','index','/:id','isAuthenticated','show','post','create','/:id/applications','put','update','delete','destroy','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1bfb29,_0x1d6359){var _0x28ff29=function(_0x375585){while(--_0x375585){_0x1bfb29['push'](_0x1bfb29['shift']());}};_0x28ff29(++_0x1d6359);}(_0xd5be,0x11a));var _0xed5b=function(_0x203387,_0x25ee77){_0x203387=_0x203387-0x0;var _0x358e6b=_0xd5be[_0x203387];return _0x358e6b;};'use strict';var multer=require('multer');var util=require(_0xed5b('0x0'));var path=require(_0xed5b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xed5b('0x2')]();var fs_extra=require(_0xed5b('0x3'));var auth=require(_0xed5b('0x4'));var interaction=require(_0xed5b('0x5'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0xed5b('0x6')]('/',auth['isAuthenticated'](),controller[_0xed5b('0x7')]);router[_0xed5b('0x6')](_0xed5b('0x8'),auth[_0xed5b('0x9')](),controller[_0xed5b('0xa')]);router[_0xed5b('0xb')]('/',auth['isAuthenticated'](),controller[_0xed5b('0xc')]);router['post'](_0xed5b('0xd'),auth[_0xed5b('0x9')](),controller['addApplications']);router[_0xed5b('0xe')](_0xed5b('0x8'),auth[_0xed5b('0x9')](),controller[_0xed5b('0xf')]);router[_0xed5b('0x10')](_0xed5b('0x8'),auth[_0xed5b('0x9')](),controller[_0xed5b('0x11')]);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 2a93530..55c264c 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 _0xa1a0=['wav','VIRTUAL','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN'];(function(_0x5955ca,_0x51a601){var _0x1b7ff6=function(_0xe2cfc2){while(--_0xe2cfc2){_0x5955ca['push'](_0x5955ca['shift']());}};_0x1b7ff6(++_0x51a601);}(_0xa1a0,0x81));var _0x0a1a=function(_0x32ce61,_0x2ba733){_0x32ce61=_0x32ce61-0x0;var _0x28eded=_0xa1a0[_0x32ce61];return _0x28eded;};'use strict';var Sequelize=require(_0x0a1a('0x0'));module[_0x0a1a('0x1')]={'context':{'type':Sequelize[_0x0a1a('0x2')],'allowNull':![],'unique':_0x0a1a('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0a1a('0x2')],'allowNull':![],'unique':_0x0a1a('0x3')},'priority':{'type':Sequelize[_0x0a1a('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a1a('0x4')},'appdata':{'type':Sequelize[_0x0a1a('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0a1a('0x5')]('inbound',_0x0a1a('0x6'),_0x0a1a('0x7'),_0x0a1a('0x8'),_0x0a1a('0x9'),_0x0a1a('0xa'),_0x0a1a('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x0a1a('0x2')]},'interval':{'type':Sequelize[_0x0a1a('0x2')],'allowNull':![],'defaultValue':_0x0a1a('0xc')},'IntervalId':{'type':Sequelize[_0x0a1a('0xd')]},'isApp':{'type':Sequelize[_0x0a1a('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a1a('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x0a1a('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x0a1a('0x2')],'defaultValue':_0x0a1a('0xf')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a1a('0x10')],'get':function(_0x11fe44){return this['getDataValue'](_0x0a1a('0x11'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xf5a5=['NoOp','ENUM','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0xf5a5,0x11d));var _0x5f5a=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xf5a5[_0x5608a3];return _0x1ed50a;};'use strict';var Sequelize=require(_0x5f5a('0x0'));module[_0x5f5a('0x1')]={'context':{'type':Sequelize[_0x5f5a('0x2')],'allowNull':![],'unique':_0x5f5a('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5f5a('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x5f5a('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x5f5a('0x2')],'allowNull':![],'defaultValue':_0x5f5a('0x4')},'appdata':{'type':Sequelize[_0x5f5a('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x5f5a('0x5')]('inbound','outbound','internal',_0x5f5a('0x6'),_0x5f5a('0x7'),_0x5f5a('0x8'),_0x5f5a('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x5f5a('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5f5a('0xa')},'IntervalId':{'type':Sequelize[_0x5f5a('0xb')]},'isApp':{'type':Sequelize[_0x5f5a('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x5f5a('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x5f5a('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x5f5a('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x5f5a('0xd')},'answer':{'type':Sequelize[_0x5f5a('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x5f5a('0xe')],'get':function(_0x2337bf){return this[_0x5f5a('0xf')](_0x5f5a('0x10'));}},'alias':{'type':Sequelize[_0x5f5a('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 985ea2e..3b0b424 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 _0xaaa3=['outbound','InternalRoutes','internal','filter','ignore','map','find','type','name','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','includeAll','include','findAll','catch','params','create','body','exten','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','value','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','destroy','then','InboundRoutes','inbound','OutboundRoutes'];(function(_0x29420e,_0x2113c1){var _0x55b018=function(_0x22c422){while(--_0x22c422){_0x29420e['push'](_0x29420e['shift']());}};_0x55b018(++_0x2113c1);}(_0xaaa3,0x158));var _0x3aaa=function(_0xa11e4c,_0x504d25){_0xa11e4c=_0xa11e4c-0x0;var _0x80b15b=_0xaaa3[_0xa11e4c];return _0x80b15b;};'use strict';var _=require(_0x3aaa('0x0'));var Redis=require('ioredis');var qs=require(_0x3aaa('0x1'));var logger=require(_0x3aaa('0x2'))('api');var config=require('../../config/environment');var db=require(_0x3aaa('0x3'))['db'];config[_0x3aaa('0x4')]=_[_0x3aaa('0x5')](config[_0x3aaa('0x4')],{'host':_0x3aaa('0x6'),'port':0x18eb});var socket=require(_0x3aaa('0x7'))(new Redis(config[_0x3aaa('0x4')]));require(_0x3aaa('0x8'))[_0x3aaa('0x9')](socket);function respondWithStatusCode(_0x112e67,_0x5b31e3){_0x5b31e3=_0x5b31e3||0xcc;return function(_0x182156){if(_0x182156){return _0x112e67[_0x3aaa('0xa')](_0x5b31e3);}return _0x112e67[_0x3aaa('0xb')](_0x5b31e3)[_0x3aaa('0xc')]();};}function respondWithResult(_0x29a3a4,_0x5ae1ab){_0x5ae1ab=_0x5ae1ab||0xc8;return function(_0x57af0b){if(_0x57af0b){return _0x29a3a4[_0x3aaa('0xb')](_0x5ae1ab)[_0x3aaa('0xd')](_0x57af0b);}};}function respondWithFilteredResult(_0x11b87f,_0x4393eb){return function(_0x479c17){if(_0x479c17){var _0x5a8afb=typeof _0x4393eb[_0x3aaa('0xe')]===_0x3aaa('0xf')&&typeof _0x4393eb[_0x3aaa('0x10')]===_0x3aaa('0xf');var _0x30f27d=_0x479c17[_0x3aaa('0x11')];var _0x54127d=_0x5a8afb?0x0:_0x4393eb[_0x3aaa('0xe')];var _0x192f01=_0x5a8afb?_0x479c17[_0x3aaa('0x11')]:_0x4393eb[_0x3aaa('0xe')]+_0x4393eb[_0x3aaa('0x10')];var _0x2c2b11;if(_0x192f01>=_0x30f27d){_0x192f01=_0x30f27d;_0x2c2b11=0xc8;}else{_0x2c2b11=0xce;}_0x11b87f[_0x3aaa('0xb')](_0x2c2b11);return _0x11b87f['set'](_0x3aaa('0x12'),_0x54127d+'-'+_0x192f01+'/'+_0x30f27d)['json'](_0x479c17);}return null;};}function removeEntity(_0x4b7e9b){return function(_0x53a065){if(_0x53a065){return _0x53a065[_0x3aaa('0x13')]()[_0x3aaa('0x14')](function(){var _0xc6774d=_0x53a065['get']({'plain':!![]});var _0x46e4e8=[{'name':_0x3aaa('0x15'),'value':_0x3aaa('0x16'),'ignore':![]},{'name':_0x3aaa('0x17'),'value':_0x3aaa('0x18'),'ignore':![]},{'name':_0x3aaa('0x19'),'value':_0x3aaa('0x1a'),'ignore':![]}];var _0x2aaa22=_(_0x46e4e8)[_0x3aaa('0x1b')](_0x3aaa('0x1c'))[_0x3aaa('0x1d')]('value')['value']();if(_['includes'](_0x2aaa22,_0xc6774d['type'])){return;}var _0xa89602=_[_0x3aaa('0x1e')](_0x46e4e8,['value',_0xc6774d[_0x3aaa('0x1f')]])[_0x3aaa('0x20')];return db['UserProfileResource'][_0x3aaa('0x13')]({'where':{'type':_0xa89602,'resourceId':_0xc6774d['id']}})[_0x3aaa('0x14')](function(){return _0x53a065;});})[_0x3aaa('0x14')](function(){_0x4b7e9b[_0x3aaa('0xb')](0xcc)[_0x3aaa('0xc')]();});}};}function handleEntityNotFound(_0x424523){return function(_0x130b20){if(!_0x130b20){_0x424523[_0x3aaa('0xa')](0x194);}return _0x130b20;};}function handleError(_0x528f4b,_0x52ee7f){_0x52ee7f=_0x52ee7f||0x1f4;return function(_0x52e78f){logger[_0x3aaa('0x21')](_0x52e78f[_0x3aaa('0x22')]);if(_0x52e78f[_0x3aaa('0x20')]){delete _0x52e78f['name'];}_0x528f4b['status'](_0x52ee7f)[_0x3aaa('0x23')](_0x52e78f);};}exports[_0x3aaa('0x24')]=function(_0x55365d,_0x597aa8){var _0x3f7066={},_0x4e2fd7={},_0x57b62f={'count':0x0,'rows':[]};var _0x543d00=_['map'](db[_0x3aaa('0x25')][_0x3aaa('0x26')],function(_0x38dc04){return{'name':_0x38dc04[_0x3aaa('0x27')],'type':_0x38dc04['type']['key']};});_0x4e2fd7['model']=_[_0x3aaa('0x1d')](_0x543d00,'name');_0x4e2fd7[_0x3aaa('0x28')]=_[_0x3aaa('0x29')](_0x55365d[_0x3aaa('0x28')]);_0x4e2fd7['filters']=_[_0x3aaa('0x2a')](_0x4e2fd7['model'],_0x4e2fd7[_0x3aaa('0x28')]);_0x3f7066[_0x3aaa('0x2b')]=_[_0x3aaa('0x2a')](_0x4e2fd7['model'],qs['fields'](_0x55365d[_0x3aaa('0x28')][_0x3aaa('0x2c')]));_0x3f7066[_0x3aaa('0x2b')]=_0x3f7066[_0x3aaa('0x2b')][_0x3aaa('0x2d')]?_0x3f7066[_0x3aaa('0x2b')]:_0x4e2fd7[_0x3aaa('0x2e')];if(!_0x55365d[_0x3aaa('0x28')][_0x3aaa('0x2f')](_0x3aaa('0x30'))){_0x3f7066['limit']=qs[_0x3aaa('0x10')](_0x55365d[_0x3aaa('0x28')]['limit']);_0x3f7066[_0x3aaa('0xe')]=qs[_0x3aaa('0xe')](_0x55365d[_0x3aaa('0x28')][_0x3aaa('0xe')]);}_0x3f7066[_0x3aaa('0x31')]=qs['sort'](_0x55365d['query'][_0x3aaa('0x32')]);_0x3f7066[_0x3aaa('0x33')]=qs[_0x3aaa('0x34')](_[_0x3aaa('0x35')](_0x55365d[_0x3aaa('0x28')],_0x4e2fd7[_0x3aaa('0x34')]),_0x543d00);if(_0x55365d['query'][_0x3aaa('0x1b')]){_0x3f7066['where']=_['merge'](_0x3f7066[_0x3aaa('0x33')],{'$or':_[_0x3aaa('0x1d')](_0x543d00,function(_0x4c81eb){if(_0x4c81eb['type']!=='VIRTUAL'){var _0x100494={};_0x100494[_0x4c81eb[_0x3aaa('0x20')]]={'$like':'%'+_0x55365d['query'][_0x3aaa('0x1b')]+'%'};return _0x100494;}})});}_0x3f7066=_[_0x3aaa('0x36')]({},_0x3f7066,_0x55365d[_0x3aaa('0x37')]);var _0x841d0c={'where':_0x3f7066['where']};return db[_0x3aaa('0x25')]['count'](_0x841d0c)[_0x3aaa('0x14')](function(_0xf924b9){_0x57b62f[_0x3aaa('0x11')]=_0xf924b9;if(_0x55365d['query'][_0x3aaa('0x38')]){_0x3f7066[_0x3aaa('0x39')]=[{'all':!![]}];}return db[_0x3aaa('0x25')][_0x3aaa('0x3a')](_0x3f7066);})[_0x3aaa('0x14')](function(_0x1954be){_0x57b62f['rows']=_0x1954be;return _0x57b62f;})['then'](respondWithFilteredResult(_0x597aa8,_0x3f7066))[_0x3aaa('0x3b')](handleError(_0x597aa8,null));};exports['show']=function(_0x330425,_0x1a5971){var _0x3e1973={'raw':![],'where':{'id':_0x330425[_0x3aaa('0x3c')]['id']}},_0x1eaaef={};_0x1eaaef[_0x3aaa('0x2e')]=_['keys'](db[_0x3aaa('0x25')][_0x3aaa('0x26')]);_0x1eaaef[_0x3aaa('0x28')]=_['keys'](_0x330425[_0x3aaa('0x28')]);_0x1eaaef[_0x3aaa('0x34')]=_[_0x3aaa('0x2a')](_0x1eaaef[_0x3aaa('0x2e')],_0x1eaaef[_0x3aaa('0x28')]);_0x3e1973[_0x3aaa('0x2b')]=_[_0x3aaa('0x2a')](_0x1eaaef[_0x3aaa('0x2e')],qs[_0x3aaa('0x2c')](_0x330425[_0x3aaa('0x28')][_0x3aaa('0x2c')]));_0x3e1973['attributes']=_0x3e1973[_0x3aaa('0x2b')][_0x3aaa('0x2d')]?_0x3e1973[_0x3aaa('0x2b')]:_0x1eaaef[_0x3aaa('0x2e')];if(_0x330425['query'][_0x3aaa('0x38')]){_0x3e1973[_0x3aaa('0x39')]=[{'all':!![]}];}_0x3e1973=_[_0x3aaa('0x36')]({},_0x3e1973,_0x330425[_0x3aaa('0x37')]);return db['VoiceExtension'][_0x3aaa('0x1e')](_0x3e1973)[_0x3aaa('0x14')](handleEntityNotFound(_0x1a5971,null))[_0x3aaa('0x14')](respondWithResult(_0x1a5971,null))[_0x3aaa('0x3b')](handleError(_0x1a5971,null));};exports[_0x3aaa('0x13')]=function(_0x3e3c48,_0xab65d2){return db[_0x3aaa('0x25')][_0x3aaa('0x1e')]({'where':{'id':_0x3e3c48[_0x3aaa('0x3c')]['id']}})[_0x3aaa('0x14')](handleEntityNotFound(_0xab65d2,null))[_0x3aaa('0x14')](removeEntity(_0xab65d2,null))[_0x3aaa('0x3b')](handleError(_0xab65d2,null));};exports[_0x3aaa('0x3d')]=function(_0x55390b,_0x4db508){if(_0x55390b[_0x3aaa('0x3e')][_0x3aaa('0x1f')]===_0x3aaa('0x18')&&!_['startsWith'](_0x55390b[_0x3aaa('0x3e')]['exten'],'_')){_0x55390b[_0x3aaa('0x3e')][_0x3aaa('0x3f')]='_'['concat'](_0x55390b[_0x3aaa('0x3e')]['exten']);}return db[_0x3aaa('0x25')]['create'](_0x55390b[_0x3aaa('0x3e')],{'raw':![]})['then'](function(_0x1c08a2){var _0x4c64e6=_0x55390b[_0x3aaa('0x40')][_0x3aaa('0x41')]({'plain':!![]});if(!_0x4c64e6)throw new Error(_0x3aaa('0x42'));if(_0x4c64e6[_0x3aaa('0x43')]==='user'){var _0x527059=_0x1c08a2['get']({'plain':!![]});var _0x37b12a=[{'name':'InboundRoutes','value':_0x3aaa('0x16')},{'name':'OutboundRoutes','value':_0x3aaa('0x18')},{'name':_0x3aaa('0x19'),'value':'internal'}];var _0x212e55=_[_0x3aaa('0x1e')](_0x37b12a,[_0x3aaa('0x44'),_0x527059['type']])['name'];return db[_0x3aaa('0x45')]['find']({'where':{'name':_0x212e55,'userProfileId':_0x4c64e6[_0x3aaa('0x46')]},'raw':!![]})[_0x3aaa('0x14')](function(_0x225b68){if(_0x225b68&&_0x225b68['autoAssociation']===0x0){return db[_0x3aaa('0x47')][_0x3aaa('0x3d')]({'name':_0x527059['name'],'resourceId':_0x527059['id'],'type':_0x225b68[_0x3aaa('0x20')],'sectionId':_0x225b68['id']},{})[_0x3aaa('0x14')](function(){return _0x1c08a2;});}else{return _0x1c08a2;}})[_0x3aaa('0x3b')](function(_0x5bab71){logger['error'](_0x3aaa('0x48'),_0x5bab71);throw _0x5bab71;});}return _0x1c08a2;})[_0x3aaa('0x14')](respondWithResult(_0x4db508,0xc9))['catch'](handleError(_0x4db508,null));};exports[_0x3aaa('0x49')]=function(_0x3ef819,_0x267893){if(_0x3ef819['body']['id']){delete _0x3ef819['body']['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x3ef819[_0x3aaa('0x3c')]['id']}})['then'](handleEntityNotFound(_0x267893,null))[_0x3aaa('0x14')](function(_0x18e3c7){if(_0x18e3c7){return db[_0x3aaa('0x25')]['update'](_[_0x3aaa('0x35')](_0x3ef819[_0x3aaa('0x3e')],[_0x3aaa('0x3f'),'context',_0x3aaa('0x4a'),_0x3aaa('0x4b'),_0x3aaa('0x4c'),_0x3aaa('0x4d'),_0x3aaa('0x4e')]),{'where':{'context':_0x18e3c7[_0x3aaa('0x4f')],'exten':_0x18e3c7['exten']},'individualHooks':!![]})['then'](function(_0x42c440){return _0x42c440;});}return null;})['then'](respondWithStatusCode(_0x267893,null))[_0x3aaa('0x3b')](handleError(_0x267893,null));};exports[_0x3aaa('0x50')]=function(_0x4c7aeb,_0x593ae7){var _0x25f6ff=_0x4c7aeb[_0x3aaa('0x3c')]['id'];var _0x279726=_0x4c7aeb['body'];var _0x56f0a6=0xc8;var _0x38f794=null;return db[_0x3aaa('0x51')][_0x3aaa('0x52')]({'isolationLevel':db[_0x3aaa('0x51')][_0x3aaa('0x53')]['ISOLATION_LEVELS'][_0x3aaa('0x54')]},function(_0x294861){return db[_0x3aaa('0x25')]['findOne']({'where':{'id':_0x25f6ff},'transaction':_0x294861})[_0x3aaa('0x14')](function(_0x5ae007){if(_0x5ae007){return db['VoiceExtension'][_0x3aaa('0x13')]({'where':{'VoiceExtensionId':_0x25f6ff},'transaction':_0x294861})[_0x3aaa('0x14')](function(){var _0x8b86d0=_['map'](_0x279726,function(_0x28f073){_0x28f073[_0x3aaa('0x55')]=_0x25f6ff;_0x28f073[_0x3aaa('0x56')]=!![];return _0x28f073;});return _0x5ae007[_0x3aaa('0x57')](_0x8b86d0);})[_0x3aaa('0x14')](function(_0x4c231f){return db['VoiceExtension'][_0x3aaa('0x58')](_0x4c231f,{'transaction':_0x294861});});}else{_0x56f0a6=0x194;_0x38f794=[];}});})[_0x3aaa('0x14')](function(){if(_0x56f0a6!==0x194){return db[_0x3aaa('0x25')][_0x3aaa('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x25f6ff},'order':_0x3aaa('0x5a')})[_0x3aaa('0x14')](function(_0x583357){_0x38f794=_0x583357;});}})[_0x3aaa('0x3b')](function(_0x2fa175){_0x56f0a6=0x1f4;logger[_0x3aaa('0x21')](_0x2fa175[_0x3aaa('0x22')]);if(_0x2fa175[_0x3aaa('0x20')]){delete _0x2fa175['name'];}_0x38f794=_0x2fa175;})[_0x3aaa('0x5b')](function(){if(_0x38f794===null){_0x593ae7[_0x3aaa('0xa')](_0x56f0a6);}else{if(_0x56f0a6===0x1f4){_0x593ae7[_0x3aaa('0xb')](_0x56f0a6)[_0x3aaa('0x23')](_0x38f794);}else{_0x593ae7['status'](_0x56f0a6)[_0x3aaa('0xd')](_0x38f794);}}});}; \ No newline at end of file +var _0xd2f2=['VoiceExtension','findAll','catch','rawAttributes','include','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','update','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','filter','ignore','map','value','includes','type','find','name','then','error','stack','send','fieldName','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','options'];(function(_0x515b56,_0x285acf){var _0x589680=function(_0x366eff){while(--_0x366eff){_0x515b56['push'](_0x515b56['shift']());}};_0x589680(++_0x285acf);}(_0xd2f2,0x83));var _0x2d2f=function(_0x1014d7,_0x3d98ff){_0x1014d7=_0x1014d7-0x0;var _0x8d83ee=_0xd2f2[_0x1014d7];return _0x8d83ee;};'use strict';var _=require(_0x2d2f('0x0'));var Redis=require(_0x2d2f('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x2d2f('0x2'))(_0x2d2f('0x3'));var config=require('../../config/environment');var db=require(_0x2d2f('0x4'))['db'];config['redis']=_[_0x2d2f('0x5')](config[_0x2d2f('0x6')],{'host':_0x2d2f('0x7'),'port':0x18eb});var socket=require(_0x2d2f('0x8'))(new Redis(config[_0x2d2f('0x6')]));require(_0x2d2f('0x9'))[_0x2d2f('0xa')](socket);function respondWithStatusCode(_0x39f2eb,_0x105a06){_0x105a06=_0x105a06||0xcc;return function(_0x3c6777){if(_0x3c6777){return _0x39f2eb[_0x2d2f('0xb')](_0x105a06);}return _0x39f2eb[_0x2d2f('0xc')](_0x105a06)[_0x2d2f('0xd')]();};}function respondWithResult(_0x196f94,_0x4195e5){_0x4195e5=_0x4195e5||0xc8;return function(_0x18a56e){if(_0x18a56e){return _0x196f94[_0x2d2f('0xc')](_0x4195e5)[_0x2d2f('0xe')](_0x18a56e);}};}function respondWithFilteredResult(_0x53965d,_0x301b4f){return function(_0x315f28){if(_0x315f28){var _0xc88f73=typeof _0x301b4f[_0x2d2f('0xf')]===_0x2d2f('0x10')&&typeof _0x301b4f[_0x2d2f('0x11')]===_0x2d2f('0x10');var _0xd6e74a=_0x315f28['count'];var _0x480be0=_0xc88f73?0x0:_0x301b4f['offset'];var _0x2835f3=_0xc88f73?_0x315f28[_0x2d2f('0x12')]:_0x301b4f[_0x2d2f('0xf')]+_0x301b4f[_0x2d2f('0x11')];var _0x1b4a2c;if(_0x2835f3>=_0xd6e74a){_0x2835f3=_0xd6e74a;_0x1b4a2c=0xc8;}else{_0x1b4a2c=0xce;}_0x53965d[_0x2d2f('0xc')](_0x1b4a2c);return _0x53965d['set'](_0x2d2f('0x13'),_0x480be0+'-'+_0x2835f3+'/'+_0xd6e74a)[_0x2d2f('0xe')](_0x315f28);}return null;};}function removeEntity(_0x5a2140){return function(_0x8943fd){if(_0x8943fd){return _0x8943fd[_0x2d2f('0x14')]()['then'](function(){var _0x12bdc9=_0x8943fd[_0x2d2f('0x15')]({'plain':!![]});var _0x2224f6=[{'name':_0x2d2f('0x16'),'value':_0x2d2f('0x17'),'ignore':![]},{'name':_0x2d2f('0x18'),'value':_0x2d2f('0x19'),'ignore':![]},{'name':'InternalRoutes','value':_0x2d2f('0x1a'),'ignore':![]}];var _0x49a456=_(_0x2224f6)[_0x2d2f('0x1b')](_0x2d2f('0x1c'))[_0x2d2f('0x1d')](_0x2d2f('0x1e'))['value']();if(_[_0x2d2f('0x1f')](_0x49a456,_0x12bdc9[_0x2d2f('0x20')])){return;}var _0x599a07=_[_0x2d2f('0x21')](_0x2224f6,[_0x2d2f('0x1e'),_0x12bdc9[_0x2d2f('0x20')]])[_0x2d2f('0x22')];return db['UserProfileResource'][_0x2d2f('0x14')]({'where':{'type':_0x599a07,'resourceId':_0x12bdc9['id']}})['then'](function(){return _0x8943fd;});})[_0x2d2f('0x23')](function(){_0x5a2140[_0x2d2f('0xc')](0xcc)[_0x2d2f('0xd')]();});}};}function handleEntityNotFound(_0x4cc261){return function(_0x4fe286){if(!_0x4fe286){_0x4cc261[_0x2d2f('0xb')](0x194);}return _0x4fe286;};}function handleError(_0x3208f1,_0x1b57f2){_0x1b57f2=_0x1b57f2||0x1f4;return function(_0x2524e0){logger[_0x2d2f('0x24')](_0x2524e0[_0x2d2f('0x25')]);if(_0x2524e0['name']){delete _0x2524e0[_0x2d2f('0x22')];}_0x3208f1[_0x2d2f('0xc')](_0x1b57f2)[_0x2d2f('0x26')](_0x2524e0);};}exports['index']=function(_0x5b6d5e,_0x3ee953){var _0x5f17ff={},_0x33d4eb={},_0x69d76e={'count':0x0,'rows':[]};var _0x3f7c22=_['map'](db['VoiceExtension']['rawAttributes'],function(_0x414180){return{'name':_0x414180[_0x2d2f('0x27')],'type':_0x414180['type']['key']};});_0x33d4eb['model']=_[_0x2d2f('0x1d')](_0x3f7c22,'name');_0x33d4eb[_0x2d2f('0x28')]=_[_0x2d2f('0x29')](_0x5b6d5e[_0x2d2f('0x28')]);_0x33d4eb['filters']=_['intersection'](_0x33d4eb[_0x2d2f('0x2a')],_0x33d4eb[_0x2d2f('0x28')]);_0x5f17ff[_0x2d2f('0x2b')]=_[_0x2d2f('0x2c')](_0x33d4eb[_0x2d2f('0x2a')],qs[_0x2d2f('0x2d')](_0x5b6d5e[_0x2d2f('0x28')][_0x2d2f('0x2d')]));_0x5f17ff[_0x2d2f('0x2b')]=_0x5f17ff['attributes'][_0x2d2f('0x2e')]?_0x5f17ff['attributes']:_0x33d4eb[_0x2d2f('0x2a')];if(!_0x5b6d5e[_0x2d2f('0x28')][_0x2d2f('0x2f')]('nolimit')){_0x5f17ff[_0x2d2f('0x11')]=qs[_0x2d2f('0x11')](_0x5b6d5e[_0x2d2f('0x28')][_0x2d2f('0x11')]);_0x5f17ff[_0x2d2f('0xf')]=qs[_0x2d2f('0xf')](_0x5b6d5e[_0x2d2f('0x28')][_0x2d2f('0xf')]);}_0x5f17ff[_0x2d2f('0x30')]=qs[_0x2d2f('0x31')](_0x5b6d5e[_0x2d2f('0x28')]['sort']);_0x5f17ff[_0x2d2f('0x32')]=qs[_0x2d2f('0x33')](_[_0x2d2f('0x34')](_0x5b6d5e[_0x2d2f('0x28')],_0x33d4eb[_0x2d2f('0x33')]),_0x3f7c22);if(_0x5b6d5e[_0x2d2f('0x28')][_0x2d2f('0x1b')]){_0x5f17ff[_0x2d2f('0x32')]=_[_0x2d2f('0x35')](_0x5f17ff['where'],{'$or':_['map'](_0x3f7c22,function(_0x3fc97a){if(_0x3fc97a[_0x2d2f('0x20')]!=='VIRTUAL'){var _0x53203c={};_0x53203c[_0x3fc97a[_0x2d2f('0x22')]]={'$like':'%'+_0x5b6d5e['query']['filter']+'%'};return _0x53203c;}})});}_0x5f17ff=_[_0x2d2f('0x35')]({},_0x5f17ff,_0x5b6d5e[_0x2d2f('0x36')]);var _0x5e649c={'where':_0x5f17ff[_0x2d2f('0x32')]};return db[_0x2d2f('0x37')]['count'](_0x5e649c)[_0x2d2f('0x23')](function(_0x11b9e8){_0x69d76e[_0x2d2f('0x12')]=_0x11b9e8;if(_0x5b6d5e['query']['includeAll']){_0x5f17ff['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x2d2f('0x38')](_0x5f17ff);})['then'](function(_0x1cb263){_0x69d76e['rows']=_0x1cb263;return _0x69d76e;})[_0x2d2f('0x23')](respondWithFilteredResult(_0x3ee953,_0x5f17ff))[_0x2d2f('0x39')](handleError(_0x3ee953,null));};exports['show']=function(_0x492733,_0x5490b0){var _0x5d0909={'raw':![],'where':{'id':_0x492733['params']['id']}},_0x40d22b={};_0x40d22b[_0x2d2f('0x2a')]=_[_0x2d2f('0x29')](db['VoiceExtension'][_0x2d2f('0x3a')]);_0x40d22b[_0x2d2f('0x28')]=_['keys'](_0x492733[_0x2d2f('0x28')]);_0x40d22b[_0x2d2f('0x33')]=_[_0x2d2f('0x2c')](_0x40d22b[_0x2d2f('0x2a')],_0x40d22b['query']);_0x5d0909[_0x2d2f('0x2b')]=_[_0x2d2f('0x2c')](_0x40d22b[_0x2d2f('0x2a')],qs[_0x2d2f('0x2d')](_0x492733['query'][_0x2d2f('0x2d')]));_0x5d0909[_0x2d2f('0x2b')]=_0x5d0909[_0x2d2f('0x2b')][_0x2d2f('0x2e')]?_0x5d0909[_0x2d2f('0x2b')]:_0x40d22b[_0x2d2f('0x2a')];if(_0x492733[_0x2d2f('0x28')]['includeAll']){_0x5d0909[_0x2d2f('0x3b')]=[{'all':!![]}];}_0x5d0909=_['merge']({},_0x5d0909,_0x492733[_0x2d2f('0x36')]);return db[_0x2d2f('0x37')][_0x2d2f('0x21')](_0x5d0909)['then'](handleEntityNotFound(_0x5490b0,null))[_0x2d2f('0x23')](respondWithResult(_0x5490b0,null))[_0x2d2f('0x39')](handleError(_0x5490b0,null));};exports[_0x2d2f('0x14')]=function(_0x226b53,_0x43343f){return db[_0x2d2f('0x37')][_0x2d2f('0x21')]({'where':{'id':_0x226b53['params']['id']}})[_0x2d2f('0x23')](handleEntityNotFound(_0x43343f,null))['then'](removeEntity(_0x43343f,null))[_0x2d2f('0x39')](handleError(_0x43343f,null));};exports[_0x2d2f('0x3c')]=function(_0x550edf,_0x2d833a){if(_0x550edf[_0x2d2f('0x3d')][_0x2d2f('0x20')]===_0x2d2f('0x19')&&!_[_0x2d2f('0x3e')](_0x550edf[_0x2d2f('0x3d')][_0x2d2f('0x3f')],'_')){_0x550edf[_0x2d2f('0x3d')][_0x2d2f('0x3f')]='_'[_0x2d2f('0x40')](_0x550edf['body'][_0x2d2f('0x3f')]);}return db[_0x2d2f('0x37')]['create'](_0x550edf[_0x2d2f('0x3d')],{'raw':![]})['then'](function(_0x4029bd){var _0x2f1be8=_0x550edf[_0x2d2f('0x41')][_0x2d2f('0x15')]({'plain':!![]});if(!_0x2f1be8)throw new Error(_0x2d2f('0x42'));if(_0x2f1be8[_0x2d2f('0x43')]===_0x2d2f('0x41')){var _0x137dc2=_0x4029bd[_0x2d2f('0x15')]({'plain':!![]});var _0x240aed=[{'name':_0x2d2f('0x16'),'value':_0x2d2f('0x17')},{'name':'OutboundRoutes','value':_0x2d2f('0x19')},{'name':_0x2d2f('0x44'),'value':_0x2d2f('0x1a')}];var _0x5af15b=_[_0x2d2f('0x21')](_0x240aed,[_0x2d2f('0x1e'),_0x137dc2[_0x2d2f('0x20')]])[_0x2d2f('0x22')];return db[_0x2d2f('0x45')][_0x2d2f('0x21')]({'where':{'name':_0x5af15b,'userProfileId':_0x2f1be8[_0x2d2f('0x46')]},'raw':!![]})['then'](function(_0x4966cc){if(_0x4966cc&&_0x4966cc[_0x2d2f('0x47')]===0x0){return db[_0x2d2f('0x48')][_0x2d2f('0x3c')]({'name':_0x137dc2[_0x2d2f('0x22')],'resourceId':_0x137dc2['id'],'type':_0x4966cc[_0x2d2f('0x22')],'sectionId':_0x4966cc['id']},{})[_0x2d2f('0x23')](function(){return _0x4029bd;});}else{return _0x4029bd;}})['catch'](function(_0x53041a){logger[_0x2d2f('0x24')](_0x2d2f('0x49'),_0x53041a);throw _0x53041a;});}return _0x4029bd;})[_0x2d2f('0x23')](respondWithResult(_0x2d833a,0xc9))[_0x2d2f('0x39')](handleError(_0x2d833a,null));};exports['update']=function(_0x1ac451,_0x5d3427){if(_0x1ac451[_0x2d2f('0x3d')]['id']){delete _0x1ac451['body']['id'];}return db[_0x2d2f('0x37')][_0x2d2f('0x21')]({'where':{'id':_0x1ac451[_0x2d2f('0x4a')]['id']}})[_0x2d2f('0x23')](handleEntityNotFound(_0x5d3427,null))['then'](function(_0x19f4cf){if(_0x19f4cf){return db['VoiceExtension'][_0x2d2f('0x4b')](_['pick'](_0x1ac451[_0x2d2f('0x3d')],[_0x2d2f('0x3f'),_0x2d2f('0x4c'),'description',_0x2d2f('0x4d'),_0x2d2f('0x4e'),_0x2d2f('0x4f'),_0x2d2f('0x50')]),{'where':{'context':_0x19f4cf[_0x2d2f('0x4c')],'exten':_0x19f4cf[_0x2d2f('0x3f')]},'individualHooks':!![]})[_0x2d2f('0x23')](function(_0x2656a1){return _0x2656a1;});}return null;})[_0x2d2f('0x23')](respondWithStatusCode(_0x5d3427,null))[_0x2d2f('0x39')](handleError(_0x5d3427,null));};exports[_0x2d2f('0x51')]=function(_0x5a91d9,_0x76811d){var _0x468100=_0x5a91d9[_0x2d2f('0x4a')]['id'];var _0x2f6bdb=_0x5a91d9[_0x2d2f('0x3d')];var _0x1c0ff1=0xc8;var _0x5aa2dd=null;return db[_0x2d2f('0x52')][_0x2d2f('0x53')]({'isolationLevel':db['sequelize'][_0x2d2f('0x54')]['ISOLATION_LEVELS'][_0x2d2f('0x55')]},function(_0x326c7a){return db[_0x2d2f('0x37')][_0x2d2f('0x56')]({'where':{'id':_0x468100},'transaction':_0x326c7a})[_0x2d2f('0x23')](function(_0x574d62){if(_0x574d62){return db['VoiceExtension'][_0x2d2f('0x14')]({'where':{'VoiceExtensionId':_0x468100},'transaction':_0x326c7a})[_0x2d2f('0x23')](function(){var _0x26703e=_[_0x2d2f('0x1d')](_0x2f6bdb,function(_0x394bdf){_0x394bdf[_0x2d2f('0x57')]=_0x468100;_0x394bdf[_0x2d2f('0x58')]=!![];return _0x394bdf;});return _0x574d62[_0x2d2f('0x59')](_0x26703e);})[_0x2d2f('0x23')](function(_0x38405c){return db['VoiceExtension'][_0x2d2f('0x5a')](_0x38405c,{'transaction':_0x326c7a});});}else{_0x1c0ff1=0x194;_0x5aa2dd=[];}});})[_0x2d2f('0x23')](function(){if(_0x1c0ff1!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x468100},'order':_0x2d2f('0x5b')})['then'](function(_0x3017c7){_0x5aa2dd=_0x3017c7;});}})[_0x2d2f('0x39')](function(_0x4e4413){_0x1c0ff1=0x1f4;logger[_0x2d2f('0x24')](_0x4e4413['stack']);if(_0x4e4413[_0x2d2f('0x22')]){delete _0x4e4413[_0x2d2f('0x22')];}_0x5aa2dd=_0x4e4413;})[_0x2d2f('0x5c')](function(){if(_0x5aa2dd===null){_0x76811d['sendStatus'](_0x1c0ff1);}else{if(_0x1c0ff1===0x1f4){_0x76811d[_0x2d2f('0xc')](_0x1c0ff1)[_0x2d2f('0x26')](_0x5aa2dd);}else{_0x76811d[_0x2d2f('0xc')](_0x1c0ff1)['json'](_0x5aa2dd);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 67b0dbb..eba38f6 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 _0xfd08=['emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceExtension','setMaxListeners','save','update'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xfd08,0x79));var _0x8fd0=function(_0x108d5f,_0x33f82d){_0x108d5f=_0x108d5f-0x0;var _0x456ea3=_0xfd08[_0x108d5f];return _0x456ea3;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x8fd0('0x0'))['db'][_0x8fd0('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x8fd0('0x2')](0x0);var events={'afterCreate':_0x8fd0('0x3'),'afterUpdate':_0x8fd0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x59e7b8){return function(_0x3b03e1,_0x4e6d29,_0x190e1b){VoiceExtensionEvents['emit'](_0x59e7b8+':'+_0x3b03e1['id'],_0x3b03e1);VoiceExtensionEvents[_0x8fd0('0x5')](_0x59e7b8,_0x3b03e1);_0x190e1b(null);};}for(var e in events){if(events[_0x8fd0('0x6')](e)){var event=events[e];VoiceExtension[_0x8fd0('0x7')](e,emitEvent(event));}}module[_0x8fd0('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x41f4=['setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x29a2ce,_0x5d6558){var _0x2fa9ea=function(_0x526d35){while(--_0x526d35){_0x29a2ce['push'](_0x29a2ce['shift']());}};_0x2fa9ea(++_0x5d6558);}(_0x41f4,0x66));var _0x441f=function(_0x3279f2,_0x51210e){_0x3279f2=_0x3279f2-0x0;var _0xf506ea=_0x41f4[_0x3279f2];return _0xf506ea;};'use strict';var EventEmitter=require(_0x441f('0x0'));var VoiceExtension=require(_0x441f('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x441f('0x2')](0x0);var events={'afterCreate':_0x441f('0x3'),'afterUpdate':'update','afterDestroy':_0x441f('0x4')};function emitEvent(_0x212312){return function(_0xc41de3,_0x207604,_0x42ae1d){VoiceExtensionEvents[_0x441f('0x5')](_0x212312+':'+_0xc41de3['id'],_0xc41de3);VoiceExtensionEvents[_0x441f('0x5')](_0x212312,_0xc41de3);_0x42ae1d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x441f('0x6')](e,emitEvent(event));}}module[_0x441f('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 54cbcfb..12b33e1 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 _0x102b=['CDR(routeid)=','XCALLY-MOTION-ANSWER=0','CDR(type)=outbound','NoOp','alias','No\x20alias\x20set','outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','name','param','phone','split','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','IntervalId','then','*,*,*,*','intervals','interval','tag','length','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','answer','queue','playback','app','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','priority','last','concat','define','get','Hangup','./voiceExtension.attributes','models','type','CDR(type)=','context','exten','Set','CDR(routeAlias)=','inbound','push'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x102b,0x1be));var _0xb102=function(_0x33fefa,_0x5aa198){_0x33fefa=_0x33fefa-0x0;var _0xa4d9f6=_0x102b[_0x33fefa];return _0xa4d9f6;};'use strict';var _=require('lodash');var attributes=require(_0xb102('0x0'));module['exports']=function(_0x3c503a){var _0x3e1311=_0x3c503a[_0xb102('0x1')];function _0x1be904(_0x1e44cb){var _0x1402fb=0x2;var _0x19e35d=[{'type':_0x1e44cb[_0xb102('0x2')],'app':'Set','appdata':_0xb102('0x3')+_0x1e44cb[_0xb102('0x2')],'context':_0x1e44cb[_0xb102('0x4')],'exten':_0x1e44cb[_0xb102('0x5')],'priority':_0x1402fb++,'VoiceExtensionId':_0x1e44cb['id']},{'type':_0x1e44cb[_0xb102('0x2')],'app':_0x1e44cb['alias']?_0xb102('0x6'):'NoOp','appdata':_0x1e44cb['alias']?_0xb102('0x7')+_0x1e44cb['alias']:'No\x20alias\x20set','context':_0x1e44cb[_0xb102('0x4')],'exten':_0x1e44cb[_0xb102('0x5')],'priority':_0x1402fb++,'VoiceExtensionId':_0x1e44cb['id']}];if(_0x1e44cb['type']===_0xb102('0x8')){_0x19e35d[_0xb102('0x9')]({'type':_0xb102('0x8'),'app':_0xb102('0x6'),'appdata':_0xb102('0xa')+_0x1e44cb['id'],'context':_0x1e44cb[_0xb102('0x4')],'exten':_0x1e44cb[_0xb102('0x5')],'priority':_0x1402fb++,'VoiceExtensionId':_0x1e44cb['id']});}_0x19e35d['push']({'type':_0x1e44cb[_0xb102('0x2')],'app':'Set','appdata':_0xb102('0xb'),'context':_0x1e44cb[_0xb102('0x4')],'exten':_0x1e44cb['exten'],'priority':_0x1402fb++,'VoiceExtensionId':_0x1e44cb['id']},{'type':_0x1e44cb[_0xb102('0x2')],'app':_0xb102('0x6'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1e44cb[_0xb102('0x4')],'exten':_0x1e44cb[_0xb102('0x5')],'priority':_0x1402fb++,'VoiceExtensionId':_0x1e44cb['id']},{'type':_0x1e44cb[_0xb102('0x2')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x1e44cb['context'],'exten':_0x1e44cb[_0xb102('0x5')],'priority':_0x1402fb++,'VoiceExtensionId':_0x1e44cb['id']});return _0x19e35d;}function _0x7f3487(_0x182dcc){var _0xc80615=0x2;var _0x52c8c0=[{'type':'outbound','app':_0xb102('0x6'),'appdata':_0xb102('0xc'),'context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':'outbound','app':_0x182dcc['alias']?_0xb102('0x6'):_0xb102('0xd'),'appdata':_0x182dcc[_0xb102('0xe')]?_0xb102('0x7')+_0x182dcc['alias']:_0xb102('0xf'),'context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':_0xb102('0x10'),'app':'Set','appdata':'CDR(destination)='+(_0x182dcc[_0xb102('0x11')]?_0xb102('0x12')+_0x182dcc['cutdigits']+'}':_0xb102('0x13')),'context':_0x182dcc['context'],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':_0xb102('0x10'),'app':_0xb102('0x6'),'appdata':_0xb102('0xa')+_0x182dcc['id'],'context':_0x182dcc['context'],'exten':_0x182dcc['exten'],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':_0xb102('0x10'),'app':_0xb102('0x14'),'appdata':_0xb102('0x15')+(_0xc80615+0x2)+_0xb102('0x16')+(_0xc80615+0x1)+')','context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':_0xb102('0x10'),'app':_0xb102('0x6'),'appdata':_0x182dcc['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x182dcc[_0xb102('0x11')]+'}':_0xb102('0x17'),'context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':'outbound','app':_0xb102('0x6'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':'outbound','app':_0xb102('0x6'),'appdata':_0xb102('0x18'),'context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':_0xb102('0x10'),'app':_0xb102('0x6'),'appdata':_0xb102('0x19'),'context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':'outbound','app':_0xb102('0x6'),'appdata':_0xb102('0x1a')+_0x182dcc['id'],'context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc['exten'],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']}];if(_0x182dcc[_0xb102('0x1b')](_0xb102('0x1c'))&&_0x182dcc[_0xb102('0x1c')]!==_0xb102('0x1d')){_0x52c8c0['push']({'type':'outbound','app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']},{'type':'outbound','app':_0xb102('0x6'),'appdata':_0xb102('0x1e')+_0x182dcc[_0xb102('0x1c')]||_0xb102('0x1f'),'context':_0x182dcc[_0xb102('0x4')],'exten':_0x182dcc[_0xb102('0x5')],'priority':_0xc80615++,'VoiceExtensionId':_0x182dcc['id']});}return _0x52c8c0;}function _0x1de300(_0x13c977,_0x634133){var _0x2aff96=[{'name':_0xb102('0x20'),'param':0x0},{'name':_0xb102('0x21'),'param':0x1},{'name':_0xb102('0x22'),'param':0x2},{'name':_0xb102('0x23'),'param':0x3}];var _0x236e87={};var _0x17a24f=_0x634133['split'](',');var _0x25a797=[];for(var _0x195c4a=0x0;_0x195c4a<_0x2aff96['length'];_0x195c4a++){switch(_0x2aff96[_0x195c4a][_0xb102('0x24')]){case _0xb102('0x20'):_0x236e87[_0xb102('0x20')]=_0x17a24f[_0x2aff96[_0x195c4a][_0xb102('0x25')]]['split']('/')[0x1];_0x236e87[_0xb102('0x26')]=_0x17a24f[_0x2aff96[_0x195c4a][_0xb102('0x25')]][_0xb102('0x27')]('/')[0x2];_0x236e87[_0xb102('0x28')]=_0x236e87[_0xb102('0x26')]?_0x236e87[_0xb102('0x26')][_0xb102('0x27')]('$')[0x0]:undefined;_0x236e87['phone']=_0x13c977[_0xb102('0x11')]?(_0x236e87[_0xb102('0x28')]||'')+'${EXTEN:'+_0x13c977[_0xb102('0x11')]+'}':(_0x236e87[_0xb102('0x28')]||'')+_0xb102('0x13');_0x25a797[_0x2aff96[_0x195c4a]['param']]=[_0xb102('0x29'),_0x236e87[_0xb102('0x20')],_0x236e87['phone']][_0xb102('0x2a')]('/');break;case'options':_0x236e87['options']=_0x17a24f[_0x2aff96[_0x195c4a]['param']];if(_0x13c977[_0xb102('0x1c')]!==_0xb102('0x1d')){if(_0x236e87['options'][_0xb102('0x2b')](_0xb102('0x2c'))<0x0){_0x236e87[_0xb102('0x22')]+=_0xb102('0x2c');}}else{_0x236e87[_0xb102('0x22')]=_0x236e87[_0xb102('0x22')][_0xb102('0x2d')](_0xb102('0x2c'),'');}_0x25a797[_0x2aff96[_0x195c4a][_0xb102('0x25')]]=_0x236e87['options'];break;default:_0x25a797[_0x2aff96[_0x195c4a][_0xb102('0x25')]]=_0x17a24f[_0x2aff96[_0x195c4a][_0xb102('0x25')]];}}return _0x25a797[_0xb102('0x2a')](',');}function _0x12fa71(_0x357c8b,_0x46b719,_0x55803b){return new Promise(function(_0x4c1014,_0x217d0e){var _0x15ed28=[];if(_[_0xb102('0x2e')](_0x46b719))return _0x4c1014(_0x15ed28);_0x3e1311[_0xb102('0x2f')]['findAll']({'attributes':['id','interval',_0xb102('0x30')],'raw':!![]})[_0xb102('0x31')](function(_0x45cdb2){for(var _0x9d638e=0x0,_0xb6167d=0x0;_0x9d638e<_0x46b719['length'];_0x9d638e++,_0xb6167d=0x0){var _0x5db346=_0x46b719[_0x9d638e];var _0x1f69cf=[];var _0xae108e=[];delete _0x5db346['id'];if(_0x5db346['interval']!==_0xb102('0x32')){_0x5db346[_0xb102('0x33')]=[_0x5db346['interval']];}else{_0x5db346['intervals']=_0x5db346['IntervalId']?_['map'](_['filter'](_0x45cdb2,{'IntervalId':_0x5db346[_0xb102('0x30')]}),_0xb102('0x34')):[];}_0x5db346[_0xb102('0x4')]=_0x357c8b['context'];_0x5db346[_0xb102('0x5')]=_0x357c8b[_0xb102('0x5')];if(_0x5db346['type'])_0x5db346[_0xb102('0x2')]=_0x5db346[_0xb102('0x2')]['toLowerCase']();if(_0x357c8b[_0xb102('0x2')]==='outbound'){if(_0x5db346['hasOwnProperty'](_0xb102('0x35'))&&_0x5db346['tag']&&_0x5db346[_0xb102('0x35')]!=='--'){_0x1f69cf[_0xb102('0x9')]({'type':_0x5db346[_0xb102('0x2')]['toLowerCase'](),'app':_0xb102('0x6'),'appdata':'CDR(tag)='+_0x5db346[_0xb102('0x35')],'context':_0x357c8b[_0xb102('0x4')],'exten':_0x357c8b[_0xb102('0x5')],'priority':_0x5db346[_0xb102('0x33')][_0xb102('0x36')]+_0x55803b+_0xb6167d++,'VoiceExtensionId':_0x357c8b['id']});}_0x1f69cf[_0xb102('0x9')]({'type':_0x5db346[_0xb102('0x2')][_0xb102('0x37')](),'app':'ExecIf','appdata':_0xb102('0x38')+(_0x5db346[_0xb102('0x39')]?'Set(CALLERID(all)='+_0x5db346[_0xb102('0x39')]+')':'NoOp(No\x20number\x20available)'),'context':_0x357c8b['context'],'exten':_0x357c8b[_0xb102('0x5')],'priority':_0x5db346['intervals'][_0xb102('0x36')]+_0x55803b+_0xb6167d++,'VoiceExtensionId':_0x357c8b['id']});}else{if(_0x5db346[_0xb102('0x1b')](_0xb102('0x3a'))){if([_0xb102('0x3b'),_0xb102('0x3c')]['includes'](_0x5db346[_0xb102('0x3d')][_0xb102('0x37')]())&&_0x5db346[_0xb102('0x3e')]!==_0xb102('0x3f')){if(_0x5db346[_0xb102('0x3a')]){_0x1f69cf[_0xb102('0x9')]({'type':_0x5db346[_0xb102('0x2')][_0xb102('0x37')](),'app':_0xb102('0x14'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x357c8b[_0xb102('0x4')],'exten':_0x357c8b[_0xb102('0x5')],'priority':_0x5db346[_0xb102('0x33')][_0xb102('0x36')]+_0x55803b+_0xb6167d++,'VoiceExtensionId':_0x357c8b['id']});_0x1f69cf[_0xb102('0x9')]({'type':_0x5db346[_0xb102('0x2')][_0xb102('0x37')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x357c8b[_0xb102('0x4')],'exten':_0x357c8b[_0xb102('0x5')],'priority':_0x5db346['intervals'][_0xb102('0x36')]+_0x55803b+_0xb6167d++,'VoiceExtensionId':_0x357c8b['id']});}else{_0x1f69cf[_0xb102('0x9')]({'type':_0x5db346[_0xb102('0x2')]['toLowerCase'](),'app':_0xb102('0x14'),'appdata':_0xb102('0x40'),'context':_0x357c8b['context'],'exten':_0x357c8b[_0xb102('0x5')],'priority':_0x5db346[_0xb102('0x33')]['length']+_0x55803b+_0xb6167d++,'VoiceExtensionId':_0x357c8b['id']});_0x1f69cf['push']({'type':_0x5db346[_0xb102('0x2')][_0xb102('0x37')](),'app':_0xb102('0x6'),'appdata':_0xb102('0x41'),'context':_0x357c8b[_0xb102('0x4')],'exten':_0x357c8b[_0xb102('0x5')],'priority':_0x5db346['intervals']['length']+_0x55803b+_0xb6167d++,'VoiceExtensionId':_0x357c8b['id']});}}}}for(var _0x4a17bd=0x0;_0x4a17bd<_0x5db346[_0xb102('0x33')][_0xb102('0x36')];_0x4a17bd++){var _0x49f24a=_0x55803b+_0x5db346[_0xb102('0x33')]['length'];var _0x20d32a=_0x4a17bd===_0x5db346[_0xb102('0x33')][_0xb102('0x36')]-0x1?_0x55803b+_0x1f69cf[_0xb102('0x36')]+_0xae108e[_0xb102('0x36')]+0x2:_0x55803b+_0x4a17bd+0x1;_0x1f69cf[_0xb102('0x42')](_0x4a17bd,0x0,{'type':_0x357c8b['type'],'app':_0xb102('0x43'),'appdata':_0x5db346[_0xb102('0x33')][_0x4a17bd]+'?'+_0x357c8b[_0xb102('0x4')]+_0xb102('0x44')+_0x49f24a+':'+_0x357c8b[_0xb102('0x4')]+_0xb102('0x44')+_0x20d32a,'exten':_0x357c8b[_0xb102('0x5')],'context':_0x357c8b[_0xb102('0x4')],'priority':_0x55803b+_0x4a17bd,'VoiceExtensionId':_0x357c8b['id']});}if(_0x5db346[_0xb102('0x3e')]==='outboundDial')_0x5db346[_0xb102('0x45')]=_0x1de300(_0x357c8b,_0x5db346[_0xb102('0x45')]);_0x5db346[_0xb102('0x46')]=_0x1f69cf['length']?_[_0xb102('0x47')](_0x1f69cf)['priority']+0x1:_0x55803b;_0x15ed28=_[_0xb102('0x48')](_0x15ed28,_0x1f69cf,[_0x5db346],_0xae108e);_0x55803b=_[_0xb102('0x47')](_0x15ed28)[_0xb102('0x46')]+0x1;}return _0x4c1014(_0x15ed28);})['catch'](function(_0x420215){_0x217d0e(_0x420215);});});}return _0x3c503a[_0xb102('0x49')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5192ec){var _0x58ac4d=this[_0xb102('0x4a')]({'plain':!![]});var _0x2c1773=_0x58ac4d[_0xb102('0x2')]===_0xb102('0x10')?_0x7f3487(_0x58ac4d):_0x1be904(_0x58ac4d);return _0x12fa71(_0x58ac4d,_0x5192ec,_['last'](_0x2c1773)['priority']+0x1)['then'](function(_0x3564bd){var _0x2ee411=_[_0xb102('0x48')](_0x2c1773,_0x3564bd);_0x2ee411[_0xb102('0x9')]({'type':_0x58ac4d[_0xb102('0x2')],'app':_0xb102('0x4b'),'exten':_0x58ac4d[_0xb102('0x5')],'context':_0x58ac4d['context'],'priority':_[_0xb102('0x47')](_0x2ee411)['priority']+0x1,'VoiceExtensionId':_0x58ac4d['id']});return _0x2ee411;});}}});}; \ No newline at end of file +var _0x8456=['outboundDial','appdata','priority','last','define','VoiceExtension','voice_extensions','get','concat','Hangup','lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','context','exten','alias','NoOp','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(routeAlias)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','split','length','name','param','phone','prefix','${EXTEN:','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','then','intervals','IntervalId','map','tag','CDR(tag)=','toLowerCase','callerID','Set(CALLERID(all)=','answer','playback','includes','app','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8456,0xfd));var _0x6845=function(_0x2516d4,_0x4f5208){_0x2516d4=_0x2516d4-0x0;var _0x511da6=_0x8456[_0x2516d4];return _0x511da6;};'use strict';var _=require(_0x6845('0x0'));var attributes=require(_0x6845('0x1'));module[_0x6845('0x2')]=function(_0x4ac25c){var _0x95d10d=_0x4ac25c['models'];function _0x20f486(_0x45801c){var _0x20f1bc=0x2;var _0x15c118=[{'type':_0x45801c[_0x6845('0x3')],'app':_0x6845('0x4'),'appdata':_0x6845('0x5')+_0x45801c[_0x6845('0x3')],'context':_0x45801c[_0x6845('0x6')],'exten':_0x45801c[_0x6845('0x7')],'priority':_0x20f1bc++,'VoiceExtensionId':_0x45801c['id']},{'type':_0x45801c['type'],'app':_0x45801c[_0x6845('0x8')]?'Set':_0x6845('0x9'),'appdata':_0x45801c[_0x6845('0x8')]?'CDR(routeAlias)='+_0x45801c[_0x6845('0x8')]:_0x6845('0xa'),'context':_0x45801c[_0x6845('0x6')],'exten':_0x45801c['exten'],'priority':_0x20f1bc++,'VoiceExtensionId':_0x45801c['id']}];if(_0x45801c[_0x6845('0x3')]===_0x6845('0xb')){_0x15c118[_0x6845('0xc')]({'type':_0x6845('0xb'),'app':_0x6845('0x4'),'appdata':_0x6845('0xd')+_0x45801c['id'],'context':_0x45801c['context'],'exten':_0x45801c[_0x6845('0x7')],'priority':_0x20f1bc++,'VoiceExtensionId':_0x45801c['id']});}_0x15c118[_0x6845('0xc')]({'type':_0x45801c[_0x6845('0x3')],'app':_0x6845('0x4'),'appdata':_0x6845('0xe'),'context':_0x45801c['context'],'exten':_0x45801c['exten'],'priority':_0x20f1bc++,'VoiceExtensionId':_0x45801c['id']},{'type':_0x45801c[_0x6845('0x3')],'app':_0x6845('0x4'),'appdata':_0x6845('0xf'),'context':_0x45801c['context'],'exten':_0x45801c[_0x6845('0x7')],'priority':_0x20f1bc++,'VoiceExtensionId':_0x45801c['id']},{'type':_0x45801c[_0x6845('0x3')],'app':_0x6845('0x4'),'appdata':_0x6845('0x10'),'context':_0x45801c[_0x6845('0x6')],'exten':_0x45801c[_0x6845('0x7')],'priority':_0x20f1bc++,'VoiceExtensionId':_0x45801c['id']});return _0x15c118;}function _0x3d6f07(_0x4f7035){var _0x14043b=0x2;var _0x5c5a1b=[{'type':'outbound','app':_0x6845('0x4'),'appdata':_0x6845('0x11'),'context':_0x4f7035['context'],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':_0x6845('0x12'),'app':_0x4f7035[_0x6845('0x8')]?_0x6845('0x4'):_0x6845('0x9'),'appdata':_0x4f7035[_0x6845('0x8')]?_0x6845('0x13')+_0x4f7035[_0x6845('0x8')]:'No\x20alias\x20set','context':_0x4f7035[_0x6845('0x6')],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':_0x6845('0x12'),'app':_0x6845('0x4'),'appdata':'CDR(destination)='+(_0x4f7035['cutdigits']?'${EXTEN:'+_0x4f7035[_0x6845('0x14')]+'}':_0x6845('0x15')),'context':_0x4f7035[_0x6845('0x6')],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':'outbound','app':_0x6845('0x4'),'appdata':'CDR(routeid)='+_0x4f7035['id'],'context':_0x4f7035[_0x6845('0x6')],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':'outbound','app':_0x6845('0x16'),'appdata':_0x6845('0x17')+(_0x14043b+0x2)+_0x6845('0x18')+(_0x14043b+0x1)+')','context':_0x4f7035[_0x6845('0x6')],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':_0x6845('0x12'),'app':_0x6845('0x4'),'appdata':_0x4f7035['cutdigits']?_0x6845('0x19')+_0x4f7035[_0x6845('0x14')]+'}':_0x6845('0x1a'),'context':_0x4f7035['context'],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':_0x6845('0x12'),'app':_0x6845('0x4'),'appdata':_0x6845('0xe'),'context':_0x4f7035[_0x6845('0x6')],'exten':_0x4f7035['exten'],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':_0x6845('0x12'),'app':_0x6845('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4f7035[_0x6845('0x6')],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':_0x6845('0x12'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x4f7035[_0x6845('0x6')],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':_0x6845('0x12'),'app':_0x6845('0x4'),'appdata':'outboundrouteid='+_0x4f7035['id'],'context':_0x4f7035['context'],'exten':_0x4f7035['exten'],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']}];if(_0x4f7035[_0x6845('0x1b')]('recordingFormat')&&_0x4f7035[_0x6845('0x1c')]!=='none'){_0x5c5a1b[_0x6845('0xc')]({'type':_0x6845('0x12'),'app':_0x6845('0x4'),'appdata':_0x6845('0x1d'),'context':_0x4f7035[_0x6845('0x6')],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':_0x6845('0x12'),'app':'Set','appdata':_0x6845('0x1e')+_0x4f7035['recordingFormat']||'wav','context':_0x4f7035[_0x6845('0x6')],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']});}return _0x5c5a1b;}function _0x35adaf(_0x14e752,_0x498506){var _0xda3bfc=[{'name':_0x6845('0x1f'),'param':0x0},{'name':_0x6845('0x20'),'param':0x1},{'name':_0x6845('0x21'),'param':0x2},{'name':_0x6845('0x22'),'param':0x3}];var _0x1698bd={};var _0x367f98=_0x498506[_0x6845('0x23')](',');var _0x4f76da=[];for(var _0x4739fe=0x0;_0x4739fe<_0xda3bfc[_0x6845('0x24')];_0x4739fe++){switch(_0xda3bfc[_0x4739fe][_0x6845('0x25')]){case _0x6845('0x1f'):_0x1698bd[_0x6845('0x1f')]=_0x367f98[_0xda3bfc[_0x4739fe][_0x6845('0x26')]][_0x6845('0x23')]('/')[0x1];_0x1698bd[_0x6845('0x27')]=_0x367f98[_0xda3bfc[_0x4739fe][_0x6845('0x26')]][_0x6845('0x23')]('/')[0x2];_0x1698bd['prefix']=_0x1698bd[_0x6845('0x27')]?_0x1698bd[_0x6845('0x27')]['split']('$')[0x0]:undefined;_0x1698bd[_0x6845('0x27')]=_0x14e752[_0x6845('0x14')]?(_0x1698bd[_0x6845('0x28')]||'')+_0x6845('0x29')+_0x14e752[_0x6845('0x14')]+'}':(_0x1698bd[_0x6845('0x28')]||'')+_0x6845('0x15');_0x4f76da[_0xda3bfc[_0x4739fe]['param']]=['SIP',_0x1698bd['trunk'],_0x1698bd[_0x6845('0x27')]][_0x6845('0x2a')]('/');break;case _0x6845('0x21'):_0x1698bd[_0x6845('0x21')]=_0x367f98[_0xda3bfc[_0x4739fe][_0x6845('0x26')]];if(_0x14e752[_0x6845('0x1c')]!=='none'){if(_0x1698bd[_0x6845('0x21')][_0x6845('0x2b')](_0x6845('0x2c'))<0x0){_0x1698bd[_0x6845('0x21')]+=_0x6845('0x2c');}}else{_0x1698bd[_0x6845('0x21')]=_0x1698bd[_0x6845('0x21')][_0x6845('0x2d')](_0x6845('0x2c'),'');}_0x4f76da[_0xda3bfc[_0x4739fe][_0x6845('0x26')]]=_0x1698bd[_0x6845('0x21')];break;default:_0x4f76da[_0xda3bfc[_0x4739fe][_0x6845('0x26')]]=_0x367f98[_0xda3bfc[_0x4739fe][_0x6845('0x26')]];}}return _0x4f76da[_0x6845('0x2a')](',');}function _0x3d9825(_0x4a9cb1,_0x5cf943,_0x440067){return new Promise(function(_0x11e959,_0x4a9201){var _0x3eeb3f=[];if(_[_0x6845('0x2e')](_0x5cf943))return _0x11e959(_0x3eeb3f);_0x95d10d[_0x6845('0x2f')][_0x6845('0x30')]({'attributes':['id',_0x6845('0x31'),'IntervalId'],'raw':!![]})[_0x6845('0x32')](function(_0x3ca763){for(var _0x372d60=0x0,_0x209787=0x0;_0x372d60<_0x5cf943[_0x6845('0x24')];_0x372d60++,_0x209787=0x0){var _0x4ce0fa=_0x5cf943[_0x372d60];var _0x26ccea=[];var _0x1def0d=[];delete _0x4ce0fa['id'];if(_0x4ce0fa[_0x6845('0x31')]!=='*,*,*,*'){_0x4ce0fa['intervals']=[_0x4ce0fa['interval']];}else{_0x4ce0fa[_0x6845('0x33')]=_0x4ce0fa[_0x6845('0x34')]?_[_0x6845('0x35')](_['filter'](_0x3ca763,{'IntervalId':_0x4ce0fa['IntervalId']}),'interval'):[];}_0x4ce0fa[_0x6845('0x6')]=_0x4a9cb1[_0x6845('0x6')];_0x4ce0fa[_0x6845('0x7')]=_0x4a9cb1[_0x6845('0x7')];if(_0x4ce0fa['type'])_0x4ce0fa[_0x6845('0x3')]=_0x4ce0fa[_0x6845('0x3')]['toLowerCase']();if(_0x4a9cb1[_0x6845('0x3')]===_0x6845('0x12')){if(_0x4ce0fa[_0x6845('0x1b')](_0x6845('0x36'))&&_0x4ce0fa[_0x6845('0x36')]&&_0x4ce0fa[_0x6845('0x36')]!=='--'){_0x26ccea[_0x6845('0xc')]({'type':_0x4ce0fa[_0x6845('0x3')]['toLowerCase'](),'app':_0x6845('0x4'),'appdata':_0x6845('0x37')+_0x4ce0fa[_0x6845('0x36')],'context':_0x4a9cb1[_0x6845('0x6')],'exten':_0x4a9cb1[_0x6845('0x7')],'priority':_0x4ce0fa[_0x6845('0x33')][_0x6845('0x24')]+_0x440067+_0x209787++,'VoiceExtensionId':_0x4a9cb1['id']});}_0x26ccea[_0x6845('0xc')]({'type':_0x4ce0fa[_0x6845('0x3')][_0x6845('0x38')](),'app':_0x6845('0x16'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x4ce0fa[_0x6845('0x39')]?_0x6845('0x3a')+_0x4ce0fa['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x4a9cb1[_0x6845('0x6')],'exten':_0x4a9cb1[_0x6845('0x7')],'priority':_0x4ce0fa[_0x6845('0x33')][_0x6845('0x24')]+_0x440067+_0x209787++,'VoiceExtensionId':_0x4a9cb1['id']});}else{if(_0x4ce0fa[_0x6845('0x1b')](_0x6845('0x3b'))){if(['queue',_0x6845('0x3c')][_0x6845('0x3d')](_0x4ce0fa[_0x6845('0x3e')][_0x6845('0x38')]())&&_0x4ce0fa['appType']!==_0x6845('0x3f')){if(_0x4ce0fa[_0x6845('0x3b')]){_0x26ccea[_0x6845('0xc')]({'type':_0x4ce0fa[_0x6845('0x3')][_0x6845('0x38')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4a9cb1['context'],'exten':_0x4a9cb1[_0x6845('0x7')],'priority':_0x4ce0fa['intervals'][_0x6845('0x24')]+_0x440067+_0x209787++,'VoiceExtensionId':_0x4a9cb1['id']});_0x26ccea[_0x6845('0xc')]({'type':_0x4ce0fa[_0x6845('0x3')][_0x6845('0x38')](),'app':_0x6845('0x4'),'appdata':_0x6845('0x40'),'context':_0x4a9cb1['context'],'exten':_0x4a9cb1[_0x6845('0x7')],'priority':_0x4ce0fa[_0x6845('0x33')][_0x6845('0x24')]+_0x440067+_0x209787++,'VoiceExtensionId':_0x4a9cb1['id']});}else{_0x26ccea['push']({'type':_0x4ce0fa[_0x6845('0x3')][_0x6845('0x38')](),'app':'ExecIf','appdata':_0x6845('0x41'),'context':_0x4a9cb1['context'],'exten':_0x4a9cb1[_0x6845('0x7')],'priority':_0x4ce0fa[_0x6845('0x33')][_0x6845('0x24')]+_0x440067+_0x209787++,'VoiceExtensionId':_0x4a9cb1['id']});_0x26ccea[_0x6845('0xc')]({'type':_0x4ce0fa[_0x6845('0x3')]['toLowerCase'](),'app':_0x6845('0x4'),'appdata':_0x6845('0x42'),'context':_0x4a9cb1['context'],'exten':_0x4a9cb1['exten'],'priority':_0x4ce0fa[_0x6845('0x33')]['length']+_0x440067+_0x209787++,'VoiceExtensionId':_0x4a9cb1['id']});}}}}for(var _0x47cc96=0x0;_0x47cc96<_0x4ce0fa['intervals'][_0x6845('0x24')];_0x47cc96++){var _0x50443e=_0x440067+_0x4ce0fa[_0x6845('0x33')]['length'];var _0x26c6f6=_0x47cc96===_0x4ce0fa['intervals']['length']-0x1?_0x440067+_0x26ccea[_0x6845('0x24')]+_0x1def0d['length']+0x2:_0x440067+_0x47cc96+0x1;_0x26ccea[_0x6845('0x43')](_0x47cc96,0x0,{'type':_0x4a9cb1[_0x6845('0x3')],'app':_0x6845('0x44'),'appdata':_0x4ce0fa[_0x6845('0x33')][_0x47cc96]+'?'+_0x4a9cb1['context']+_0x6845('0x45')+_0x50443e+':'+_0x4a9cb1['context']+_0x6845('0x45')+_0x26c6f6,'exten':_0x4a9cb1[_0x6845('0x7')],'context':_0x4a9cb1['context'],'priority':_0x440067+_0x47cc96,'VoiceExtensionId':_0x4a9cb1['id']});}if(_0x4ce0fa[_0x6845('0x46')]===_0x6845('0x47'))_0x4ce0fa[_0x6845('0x48')]=_0x35adaf(_0x4a9cb1,_0x4ce0fa[_0x6845('0x48')]);_0x4ce0fa[_0x6845('0x49')]=_0x26ccea['length']?_['last'](_0x26ccea)['priority']+0x1:_0x440067;_0x3eeb3f=_['concat'](_0x3eeb3f,_0x26ccea,[_0x4ce0fa],_0x1def0d);_0x440067=_[_0x6845('0x4a')](_0x3eeb3f)[_0x6845('0x49')]+0x1;}return _0x11e959(_0x3eeb3f);})['catch'](function(_0x28bcd2){_0x4a9201(_0x28bcd2);});});}return _0x4ac25c[_0x6845('0x4b')](_0x6845('0x4c'),attributes,{'tableName':_0x6845('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4e58c9){var _0x1ba944=this[_0x6845('0x4e')]({'plain':!![]});var _0x5355c6=_0x1ba944['type']===_0x6845('0x12')?_0x3d6f07(_0x1ba944):_0x20f486(_0x1ba944);return _0x3d9825(_0x1ba944,_0x4e58c9,_[_0x6845('0x4a')](_0x5355c6)[_0x6845('0x49')]+0x1)[_0x6845('0x32')](function(_0x56f077){var _0x572ef1=_[_0x6845('0x4f')](_0x5355c6,_0x56f077);_0x572ef1[_0x6845('0xc')]({'type':_0x1ba944['type'],'app':_0x6845('0x50'),'exten':_0x1ba944['exten'],'context':_0x1ba944[_0x6845('0x6')],'priority':_['last'](_0x572ef1)[_0x6845('0x49')]+0x1,'VoiceExtensionId':_0x1ba944['id']});return _0x572ef1;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index bf26942..20b4f23 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 _0xd9c8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','debug','request\x20sent','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','options','where','attributes','include','map','model','lodash','util'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xd9c8[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x8d9c('0x0'));var util=require(_0x8d9c('0x1'));var moment=require('moment');var BPromise=require(_0x8d9c('0x2'));var rs=require(_0x8d9c('0x3'));var fs=require('fs');var Redis=require(_0x8d9c('0x4'));var db=require(_0x8d9c('0x5'))['db'];var utils=require(_0x8d9c('0x6'));var logger=require(_0x8d9c('0x7'))(_0x8d9c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8d9c('0x9')]({'port':0x232a});config[_0x8d9c('0xa')]=_[_0x8d9c('0xb')](config['redis'],{'host':_0x8d9c('0xc'),'port':0x18eb});var socket=require(_0x8d9c('0xd'))(new Redis(config[_0x8d9c('0xa')]));require(_0x8d9c('0xe'))[_0x8d9c('0xf')](socket);function respondWithRpcPromise(_0xc3a2ff,_0xa2bf79,_0xaa0a72){return new BPromise(function(_0x52de51,_0x26b5b3){return client['request'](_0xc3a2ff,_0xaa0a72)[_0x8d9c('0x10')](function(_0x5d31e7){logger[_0x8d9c('0x11')]('VoiceExtension,\x20%s,\x20%s',_0xa2bf79,'request\x20sent');logger[_0x8d9c('0x12')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0xa2bf79,_0x8d9c('0x13'),JSON[_0x8d9c('0x14')](_0x5d31e7));if(_0x5d31e7[_0x8d9c('0x15')]){if(_0x5d31e7[_0x8d9c('0x15')][_0x8d9c('0x16')]===0x1f4){logger[_0x8d9c('0x15')](_0x8d9c('0x17'),_0xa2bf79,_0x5d31e7[_0x8d9c('0x15')][_0x8d9c('0x18')]);return _0x26b5b3(_0x5d31e7[_0x8d9c('0x15')]['message']);}logger[_0x8d9c('0x15')](_0x8d9c('0x17'),_0xa2bf79,_0x5d31e7[_0x8d9c('0x15')][_0x8d9c('0x18')]);return _0x52de51(_0x5d31e7[_0x8d9c('0x15')][_0x8d9c('0x18')]);}else{logger[_0x8d9c('0x11')](_0x8d9c('0x17'),_0xa2bf79,_0x8d9c('0x13'));_0x52de51(_0x5d31e7[_0x8d9c('0x19')]['message']);}})[_0x8d9c('0x1a')](function(_0x6671d7){logger['error'](_0x8d9c('0x17'),_0xa2bf79,_0x6671d7);_0x26b5b3(_0x6671d7);});});}exports[_0x8d9c('0x1b')]=function(_0x57a45b){var _0x3ba938=this;return new Promise(function(_0x2ba1c8,_0xa8391d){return db[_0x8d9c('0x1c')]['findAll']({'raw':_0x57a45b[_0x8d9c('0x1d')]?_0x57a45b[_0x8d9c('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x57a45b['options']?_0x57a45b[_0x8d9c('0x1d')][_0x8d9c('0x1e')]||null:null,'attributes':_0x57a45b[_0x8d9c('0x1d')]?_0x57a45b[_0x8d9c('0x1d')][_0x8d9c('0x1f')]||null:null,'limit':_0x57a45b[_0x8d9c('0x1d')]?_0x57a45b[_0x8d9c('0x1d')]['limit']||null:null,'include':_0x57a45b[_0x8d9c('0x1d')]?_0x57a45b['options'][_0x8d9c('0x20')]?_[_0x8d9c('0x21')](_0x57a45b[_0x8d9c('0x1d')][_0x8d9c('0x20')],function(_0x171c96){return{'model':db[_0x171c96[_0x8d9c('0x22')]],'as':_0x171c96['as'],'attributes':_0x171c96[_0x8d9c('0x1f')],'include':_0x171c96['include']?_['map'](_0x171c96['include'],function(_0x527302){return{'model':db[_0x527302['model']],'as':_0x527302['as'],'attributes':_0x527302[_0x8d9c('0x1f')],'include':_0x527302[_0x8d9c('0x20')]?_[_0x8d9c('0x21')](_0x527302[_0x8d9c('0x20')],function(_0x5cb119){return{'model':db[_0x5cb119[_0x8d9c('0x22')]],'as':_0x5cb119['as'],'attributes':_0x5cb119[_0x8d9c('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5548a7){logger[_0x8d9c('0x11')]('GetVoiceExtension',_0x57a45b);logger[_0x8d9c('0x12')](_0x8d9c('0x1b'),_0x57a45b,JSON[_0x8d9c('0x14')](_0x5548a7));_0x2ba1c8(_0x5548a7);})['catch'](function(_0x5eaa3e){logger[_0x8d9c('0x15')](_0x8d9c('0x1b'),_0x5eaa3e[_0x8d9c('0x18')],_0x57a45b);_0xa8391d(_0x3ba938[_0x8d9c('0x15')](0x1f4,_0x5eaa3e[_0x8d9c('0x18')]));});});}; \ No newline at end of file +var _0xf69d=['./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','info','catch','GetVoiceExtension','options','raw','attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf69d,0xd3));var _0xdf69=function(_0x56356f,_0x487c2f){_0x56356f=_0x56356f-0x0;var _0x4a8bd6=_0xf69d[_0x56356f];return _0x4a8bd6;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var moment=require(_0xdf69('0x2'));var BPromise=require(_0xdf69('0x3'));var rs=require(_0xdf69('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf69('0x5'))['db'];var utils=require(_0xdf69('0x6'));var logger=require(_0xdf69('0x7'))(_0xdf69('0x8'));var config=require(_0xdf69('0x9'));var jayson=require(_0xdf69('0xa'));var client=jayson[_0xdf69('0xb')][_0xdf69('0xc')]({'port':0x232a});config[_0xdf69('0xd')]=_[_0xdf69('0xe')](config[_0xdf69('0xd')],{'host':_0xdf69('0xf'),'port':0x18eb});var socket=require(_0xdf69('0x10'))(new Redis(config[_0xdf69('0xd')]));require(_0xdf69('0x11'))[_0xdf69('0x12')](socket);function respondWithRpcPromise(_0x1e0e8d,_0x4fcc93,_0x305726){return new BPromise(function(_0x420011,_0x20cc6c){return client[_0xdf69('0x13')](_0x1e0e8d,_0x305726)[_0xdf69('0x14')](function(_0x1b86d4){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x4fcc93,'request\x20sent');logger['debug'](_0xdf69('0x15'),_0x4fcc93,_0xdf69('0x16'),JSON[_0xdf69('0x17')](_0x1b86d4));if(_0x1b86d4[_0xdf69('0x18')]){if(_0x1b86d4[_0xdf69('0x18')][_0xdf69('0x19')]===0x1f4){logger['error'](_0xdf69('0x1a'),_0x4fcc93,_0x1b86d4[_0xdf69('0x18')][_0xdf69('0x1b')]);return _0x20cc6c(_0x1b86d4[_0xdf69('0x18')]['message']);}logger[_0xdf69('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x4fcc93,_0x1b86d4[_0xdf69('0x18')][_0xdf69('0x1b')]);return _0x420011(_0x1b86d4['error'][_0xdf69('0x1b')]);}else{logger[_0xdf69('0x1c')](_0xdf69('0x1a'),_0x4fcc93,_0xdf69('0x16'));_0x420011(_0x1b86d4['result']['message']);}})[_0xdf69('0x1d')](function(_0x15e73a){logger['error'](_0xdf69('0x1a'),_0x4fcc93,_0x15e73a);_0x20cc6c(_0x15e73a);});});}exports[_0xdf69('0x1e')]=function(_0x68fa80){var _0x526cbc=this;return new Promise(function(_0x4776df,_0x452cfa){return db['VoiceExtension']['findAll']({'raw':_0x68fa80[_0xdf69('0x1f')]?_0x68fa80[_0xdf69('0x1f')][_0xdf69('0x20')]===undefined?!![]:![]:!![],'where':_0x68fa80['options']?_0x68fa80['options']['where']||null:null,'attributes':_0x68fa80[_0xdf69('0x1f')]?_0x68fa80['options'][_0xdf69('0x21')]||null:null,'limit':_0x68fa80[_0xdf69('0x1f')]?_0x68fa80[_0xdf69('0x1f')]['limit']||null:null,'include':_0x68fa80['options']?_0x68fa80[_0xdf69('0x1f')][_0xdf69('0x22')]?_[_0xdf69('0x23')](_0x68fa80[_0xdf69('0x1f')]['include'],function(_0x3b727c){return{'model':db[_0x3b727c[_0xdf69('0x24')]],'as':_0x3b727c['as'],'attributes':_0x3b727c[_0xdf69('0x21')],'include':_0x3b727c['include']?_[_0xdf69('0x23')](_0x3b727c['include'],function(_0x5dcabd){return{'model':db[_0x5dcabd['model']],'as':_0x5dcabd['as'],'attributes':_0x5dcabd['attributes'],'include':_0x5dcabd[_0xdf69('0x22')]?_[_0xdf69('0x23')](_0x5dcabd['include'],function(_0x301bd2){return{'model':db[_0x301bd2[_0xdf69('0x24')]],'as':_0x301bd2['as'],'attributes':_0x301bd2[_0xdf69('0x21')]};}):[]};}):[]};}):[]:[]})[_0xdf69('0x14')](function(_0x1b7c16){logger[_0xdf69('0x1c')](_0xdf69('0x1e'),_0x68fa80);logger[_0xdf69('0x25')](_0xdf69('0x1e'),_0x68fa80,JSON[_0xdf69('0x17')](_0x1b7c16));_0x4776df(_0x1b7c16);})[_0xdf69('0x1d')](function(_0x2a23ed){logger[_0xdf69('0x18')](_0xdf69('0x1e'),_0x2a23ed[_0xdf69('0x1b')],_0x68fa80);_0x452cfa(_0x526cbc[_0xdf69('0x18')](0x1f4,_0x2a23ed[_0xdf69('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 46a4347..566b149 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 _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x3401f7,_0x9fb50b){var _0x6fe230=function(_0x28ff2f){while(--_0x28ff2f){_0x3401f7['push'](_0x3401f7['shift']());}};_0x6fe230(++_0x9fb50b);}(_0xabce,0x103));var _0xeabc=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xabce[_0x173d7e];return _0x2220d6;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file +var _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x3d1ec3,_0x5e2d7c){var _0x998c76=function(_0x38054a){while(--_0x38054a){_0x3d1ec3['push'](_0x3d1ec3['shift']());}};_0x998c76(++_0x5e2d7c);}(_0x5fab,0x177));var _0xb5fa=function(_0x741a7b,_0x5cb899){_0x741a7b=_0x741a7b-0x0;var _0x43a8e6=_0x5fab[_0x741a7b];return _0x43a8e6;};'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 f349f73..90518f8 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 _0x32f4=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','getMessages','post','create','update','exports'];(function(_0x49aa3a,_0x4cd1a6){var _0x530886=function(_0x36a9e5){while(--_0x36a9e5){_0x49aa3a['push'](_0x49aa3a['shift']());}};_0x530886(++_0x4cd1a6);}(_0x32f4,0x154));var _0x432f=function(_0x2f376b,_0x3a9efb){_0x2f376b=_0x2f376b-0x0;var _0x341c98=_0x32f4[_0x2f376b];return _0x341c98;};'use strict';var multer=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var path=require(_0x432f('0x2'));var timeout=require(_0x432f('0x3'));var express=require('express');var router=express[_0x432f('0x4')]();var fs_extra=require(_0x432f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var controller=require(_0x432f('0x8'));router[_0x432f('0x9')]('/',auth[_0x432f('0xa')](),controller['index']);router['get'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['show']);router[_0x432f('0x9')]('/:id/messages',auth[_0x432f('0xa')](),controller[_0x432f('0xc')]);router[_0x432f('0xd')]('/',auth[_0x432f('0xa')](),controller[_0x432f('0xe')]);router['put'](_0x432f('0xb'),auth['isAuthenticated'](),controller[_0x432f('0xf')]);router['delete'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['destroy']);module[_0x432f('0x10')]=router; \ No newline at end of file +var _0x77d4=['index','show','getMessages','post','create','/:id','update','delete','destroy','util','connect-timeout','Router','fs-extra','../../config/environment','./voiceMail.controller','get','isAuthenticated'];(function(_0x38ba3f,_0x1fefe3){var _0x4076d2=function(_0x55f7f9){while(--_0x55f7f9){_0x38ba3f['push'](_0x38ba3f['shift']());}};_0x4076d2(++_0x1fefe3);}(_0x77d4,0x108));var _0x477d=function(_0x1c7377,_0x8a8698){_0x1c7377=_0x1c7377-0x0;var _0x5d03e3=_0x77d4[_0x1c7377];return _0x5d03e3;};'use strict';var multer=require('multer');var util=require(_0x477d('0x0'));var path=require('path');var timeout=require(_0x477d('0x1'));var express=require('express');var router=express[_0x477d('0x2')]();var fs_extra=require(_0x477d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x477d('0x4'));var controller=require(_0x477d('0x5'));router[_0x477d('0x6')]('/',auth[_0x477d('0x7')](),controller[_0x477d('0x8')]);router[_0x477d('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x477d('0x9')]);router['get']('/:id/messages',auth[_0x477d('0x7')](),controller[_0x477d('0xa')]);router[_0x477d('0xb')]('/',auth[_0x477d('0x7')](),controller[_0x477d('0xc')]);router['put'](_0x477d('0xd'),auth['isAuthenticated'](),controller[_0x477d('0xe')]);router[_0x477d('0xf')]('/:id',auth[_0x477d('0x7')](),controller[_0x477d('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 67c0426..73cde76 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 _0xd110=['STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports'];(function(_0x32d32f,_0x377be2){var _0x3384f8=function(_0x45af70){while(--_0x45af70){_0x32d32f['push'](_0x32d32f['shift']());}};_0x3384f8(++_0x377be2);}(_0xd110,0x7c));var _0x0d11=function(_0x571a00,_0x55bee9){_0x571a00=_0x571a00-0x0;var _0x294f3c=_0xd110[_0x571a00];return _0x294f3c;};'use strict';var Sequelize=require(_0x0d11('0x0'));module[_0x0d11('0x1')]={'customer_id':{'type':Sequelize[_0x0d11('0x2')]},'context':{'type':Sequelize[_0x0d11('0x2')],'defaultValue':_0x0d11('0x3'),'unique':_0x0d11('0x4')},'mailbox':{'type':Sequelize[_0x0d11('0x2')],'defaultValue':'','allowNull':![],'unique':_0x0d11('0x4')},'password':{'type':Sequelize[_0x0d11('0x2')]},'fullname':{'type':Sequelize[_0x0d11('0x2')]},'email':{'type':Sequelize[_0x0d11('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3e8f78){this[_0x0d11('0x5')]('email',typeof _0x3e8f78===_0x0d11('0x6')&&_0x3e8f78[_0x0d11('0x7')]()?_0x3e8f78[_0x0d11('0x7')]():null);}},'pager':{'type':Sequelize[_0x0d11('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x0d11('0x8')},'attach':{'type':Sequelize[_0x0d11('0x9')](_0x0d11('0xa'),'no'),'defaultValue':_0x0d11('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x0d11('0xa'),'no'),'defaultValue':_0x0d11('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0d11('0x2')]},'callback':{'type':Sequelize[_0x0d11('0x2')]},'review':{'type':Sequelize[_0x0d11('0x9')](_0x0d11('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0d11('0x9')](_0x0d11('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0d11('0x9')](_0x0d11('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0d11('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0d11('0x9')](_0x0d11('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0d11('0x9')](_0x0d11('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0d11('0x9')](_0x0d11('0xa'),'no'),'defaultValue':_0x0d11('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x0d11('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0d11('0x9')](_0x0d11('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0d11('0x9')](_0x0d11('0xa'),'no'),'defaultValue':_0x0d11('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x0d11('0x2')]},'emailbody':{'type':Sequelize[_0x0d11('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0d11('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0d11('0xd')],'get':function(){return this[_0x0d11('0xe')](_0x0d11('0xf'))+_0x0d11('0x10')+this[_0x0d11('0xe')](_0x0d11('0x11'));}}}; \ No newline at end of file +var _0x8c14=['TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)'];(function(_0x1cb0b4,_0x1fd48d){var _0x525b60=function(_0x1efccc){while(--_0x1efccc){_0x1cb0b4['push'](_0x1cb0b4['shift']());}};_0x525b60(++_0x1fd48d);}(_0x8c14,0xc5));var _0x48c1=function(_0x2282af,_0x1c263f){_0x2282af=_0x2282af-0x0;var _0x599a7e=_0x8c14[_0x2282af];return _0x599a7e;};'use strict';var Sequelize=require(_0x48c1('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x48c1('0x1')],'defaultValue':_0x48c1('0x2'),'unique':_0x48c1('0x3')},'mailbox':{'type':Sequelize[_0x48c1('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x48c1('0x1')]},'fullname':{'type':Sequelize[_0x48c1('0x1')]},'email':{'type':Sequelize[_0x48c1('0x1')],'validate':{'isEmail':!![]},'set':function(_0x5d0cb1){this[_0x48c1('0x4')](_0x48c1('0x5'),typeof _0x5d0cb1===_0x48c1('0x6')&&_0x5d0cb1[_0x48c1('0x7')]()?_0x5d0cb1[_0x48c1('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x48c1('0x8')},'attach':{'type':Sequelize[_0x48c1('0x9')]('yes','no'),'defaultValue':_0x48c1('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x48c1('0x9')](_0x48c1('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x48c1('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0x48c1('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x48c1('0x9')](_0x48c1('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x48c1('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x48c1('0x9')](_0x48c1('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x48c1('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x48c1('0x9')](_0x48c1('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x48c1('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x48c1('0x9')](_0x48c1('0xa'),'no'),'defaultValue':_0x48c1('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x48c1('0x9')](_0x48c1('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x48c1('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x48c1('0x9')](_0x48c1('0xa'),'no'),'defaultValue':_0x48c1('0xa'),'allowNull':![]},'stamp':{'type':_0x48c1('0xc')},'emailsubject':{'type':Sequelize[_0x48c1('0x1')]},'emailbody':{'type':Sequelize[_0x48c1('0x1')]},'maxsecs':{'type':Sequelize[_0x48c1('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x48c1('0xe')],'get':function(){return this['getDataValue'](_0x48c1('0xf'))+_0x48c1('0x10')+this[_0x48c1('0x11')](_0x48c1('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 9e17aa3..47870d5 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 _0xf4eb=['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','limit','count','Content-Range','json','apply','reject','save','then','destroy','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','key','model','keys','filters','intersection','attributes','fields','query','length','order','sort','pick','where','merge','type','VIRTUAL','filter','options','include','rows','catch','show','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','getMessages','VoiceMailMessage','hasOwnProperty','nolimit','mailbox','eml-format','moment','util','path','sox','to-csv','ejs'];(function(_0x18ccd6,_0x1098e8){var _0x587d2c=function(_0x460ad6){while(--_0x460ad6){_0x18ccd6['push'](_0x18ccd6['shift']());}};_0x587d2c(++_0x1098e8);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5f1574,_0x5a8f5c){_0x5f1574=_0x5f1574-0x0;var _0x2ef92d=_0xf4eb[_0x5f1574];return _0x2ef92d;};'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(){var _0x3a5d72=_0x30994d['get']({'plain':!![]});var _0x90635e=_0xbf4e('0x21');return db[_0xbf4e('0x22')]['destroy']({'where':{'type':_0x90635e,'resourceId':_0x3a5d72['id']}})[_0xbf4e('0x1f')](function(){return _0x30994d;});})['then'](function(){_0x51648c['status'](0xcc)[_0xbf4e('0x15')]();});}};}function handleEntityNotFound(_0x5a0a9b,_0x38c923){return function(_0x315df3){if(!_0x315df3){_0x5a0a9b[_0xbf4e('0x13')](0x194);}return _0x315df3;};}function handleError(_0x41f918,_0x5c912f){_0x5c912f=_0x5c912f||0x1f4;return function(_0x2d4686){logger[_0xbf4e('0x23')](_0x2d4686[_0xbf4e('0x24')]);if(_0x2d4686['name']){delete _0x2d4686[_0xbf4e('0x25')];}_0x41f918['status'](_0x5c912f)[_0xbf4e('0x26')](_0x2d4686);};}exports[_0xbf4e('0x27')]=function(_0xb8b58e,_0x498dbd){var _0x1d12e2={},_0x362716={},_0x2f3cf8={'count':0x0,'rows':[]};var _0xc7ca87=_[_0xbf4e('0x28')](db[_0xbf4e('0x29')]['rawAttributes'],function(_0x35c82d){return{'name':_0x35c82d[_0xbf4e('0x2a')],'type':_0x35c82d['type'][_0xbf4e('0x2b')]};});_0x362716[_0xbf4e('0x2c')]=_['map'](_0xc7ca87,_0xbf4e('0x25'));_0x362716['query']=_[_0xbf4e('0x2d')](_0xb8b58e['query']);_0x362716[_0xbf4e('0x2e')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],_0x362716['query']);_0x1d12e2[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],qs[_0xbf4e('0x31')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x1d12e2['attributes']=_0x1d12e2[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x1d12e2[_0xbf4e('0x30')]:_0x362716[_0xbf4e('0x2c')];if(!_0xb8b58e[_0xbf4e('0x32')]['hasOwnProperty']('nolimit')){_0x1d12e2['limit']=qs['limit'](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x18')]);_0x1d12e2[_0xbf4e('0x16')]=qs[_0xbf4e('0x16')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x16')]);}_0x1d12e2[_0xbf4e('0x34')]=qs[_0xbf4e('0x35')](_0xb8b58e[_0xbf4e('0x32')]['sort']);_0x1d12e2['where']=qs[_0xbf4e('0x2e')](_[_0xbf4e('0x36')](_0xb8b58e[_0xbf4e('0x32')],_0x362716['filters']),_0xc7ca87);if(_0xb8b58e[_0xbf4e('0x32')]['filter']){_0x1d12e2[_0xbf4e('0x37')]=_[_0xbf4e('0x38')](_0x1d12e2[_0xbf4e('0x37')],{'$or':_[_0xbf4e('0x28')](_0xc7ca87,function(_0x5ce339){if(_0x5ce339[_0xbf4e('0x39')]!==_0xbf4e('0x3a')){var _0x3aa308={};_0x3aa308[_0x5ce339[_0xbf4e('0x25')]]={'$like':'%'+_0xb8b58e['query'][_0xbf4e('0x3b')]+'%'};return _0x3aa308;}})});}_0x1d12e2=_[_0xbf4e('0x38')]({},_0x1d12e2,_0xb8b58e[_0xbf4e('0x3c')]);var _0x29fe9d={'where':_0x1d12e2[_0xbf4e('0x37')]};return db[_0xbf4e('0x29')][_0xbf4e('0x19')](_0x29fe9d)['then'](function(_0x176166){_0x2f3cf8[_0xbf4e('0x19')]=_0x176166;if(_0xb8b58e['query']['includeAll']){_0x1d12e2[_0xbf4e('0x3d')]=[{'all':!![]}];}return db[_0xbf4e('0x29')]['findAll'](_0x1d12e2);})['then'](function(_0x2b1bf4){_0x2f3cf8[_0xbf4e('0x3e')]=_0x2b1bf4;return _0x2f3cf8;})[_0xbf4e('0x1f')](respondWithFilteredResult(_0x498dbd,_0x1d12e2))[_0xbf4e('0x3f')](handleError(_0x498dbd,null));};exports[_0xbf4e('0x40')]=function(_0x3ad0a4,_0x5a03c6){var _0x3ecc15={'raw':!![],'where':{'id':_0x3ad0a4['params']['id']}},_0x7bd91={};_0x7bd91['model']=_['keys'](db['VoiceMail'][_0xbf4e('0x41')]);_0x7bd91['query']=_[_0xbf4e('0x2d')](_0x3ad0a4[_0xbf4e('0x32')]);_0x7bd91['filters']=_['intersection'](_0x7bd91[_0xbf4e('0x2c')],_0x7bd91[_0xbf4e('0x32')]);_0x3ecc15[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x7bd91[_0xbf4e('0x2c')],qs['fields'](_0x3ad0a4[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x3ecc15[_0xbf4e('0x30')]=_0x3ecc15[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x3ecc15[_0xbf4e('0x30')]:_0x7bd91[_0xbf4e('0x2c')];if(_0x3ad0a4[_0xbf4e('0x32')]['includeAll']){_0x3ecc15[_0xbf4e('0x3d')]=[{'all':!![]}];}_0x3ecc15=_[_0xbf4e('0x38')]({},_0x3ecc15,_0x3ad0a4[_0xbf4e('0x3c')]);return db[_0xbf4e('0x29')][_0xbf4e('0x42')](_0x3ecc15)[_0xbf4e('0x1f')](handleEntityNotFound(_0x5a03c6,null))[_0xbf4e('0x1f')](respondWithResult(_0x5a03c6,null))[_0xbf4e('0x3f')](handleError(_0x5a03c6,null));};exports[_0xbf4e('0x43')]=function(_0x3447ab,_0x2fdba9){return db[_0xbf4e('0x29')][_0xbf4e('0x43')](_0x3447ab[_0xbf4e('0x44')],{})[_0xbf4e('0x1f')](function(_0x2892ce){var _0x10bc23=_0x3447ab['user'][_0xbf4e('0x45')]({'plain':!![]});if(!_0x10bc23)throw new Error(_0xbf4e('0x46'));if(_0x10bc23[_0xbf4e('0x47')]==='user'){var _0x33ab9a=_0x2892ce['get']({'plain':!![]});var _0x4a050e=_0xbf4e('0x21');return db[_0xbf4e('0x48')]['find']({'where':{'name':_0x4a050e,'userProfileId':_0x10bc23[_0xbf4e('0x49')]},'raw':!![]})[_0xbf4e('0x1f')](function(_0x31d779){if(_0x31d779&&_0x31d779[_0xbf4e('0x4a')]===0x0){return db[_0xbf4e('0x22')][_0xbf4e('0x43')]({'name':_0x33ab9a[_0xbf4e('0x25')],'resourceId':_0x33ab9a['id'],'type':_0x31d779[_0xbf4e('0x25')],'sectionId':_0x31d779['id']},{})[_0xbf4e('0x1f')](function(){return _0x2892ce;});}else{return _0x2892ce;}})[_0xbf4e('0x3f')](function(_0x271ad2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x271ad2);throw _0x271ad2;});}return _0x2892ce;})[_0xbf4e('0x1f')](respondWithResult(_0x2fdba9,0xc9))[_0xbf4e('0x3f')](handleError(_0x2fdba9,null));};exports[_0xbf4e('0x4b')]=function(_0x586f5d,_0x339ce6){if(_0x586f5d[_0xbf4e('0x44')]['id']){delete _0x586f5d['body']['id'];}return db['VoiceMail'][_0xbf4e('0x42')]({'where':{'id':_0x586f5d['params']['id']}})['then'](handleEntityNotFound(_0x339ce6,null))[_0xbf4e('0x1f')](saveUpdates(_0x586f5d[_0xbf4e('0x44')],null))[_0xbf4e('0x1f')](respondWithResult(_0x339ce6,null))[_0xbf4e('0x3f')](handleError(_0x339ce6,null));};exports[_0xbf4e('0x20')]=function(_0x5ec2d9,_0x242a75){return db['VoiceMail'][_0xbf4e('0x42')]({'where':{'id':_0x5ec2d9['params']['id']}})[_0xbf4e('0x1f')](handleEntityNotFound(_0x242a75,null))['then'](removeEntity(_0x242a75,null))[_0xbf4e('0x3f')](handleError(_0x242a75,null));};exports[_0xbf4e('0x4c')]=function(_0x3e60e7,_0x16592f,_0xfd54c){return db['VoiceMail']['findOne']({'where':{'id':_0x3e60e7['params']['id']}})['then'](handleEntityNotFound(_0x16592f,null))[_0xbf4e('0x1f')](function(_0x453411){var _0x5cfc26;var _0x200096={},_0x23c335={};_0x23c335[_0xbf4e('0x2c')]=_[_0xbf4e('0x2d')](db[_0xbf4e('0x4d')][_0xbf4e('0x41')]);_0x23c335[_0xbf4e('0x32')]=_['keys'](_0x3e60e7[_0xbf4e('0x32')]);_0x23c335[_0xbf4e('0x2e')]=_[_0xbf4e('0x2f')](_0x23c335['model'],_0x23c335['query']);_0x200096[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x23c335[_0xbf4e('0x2c')],qs['fields'](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x200096[_0xbf4e('0x30')]=_0x200096[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x200096[_0xbf4e('0x30')]:_0x23c335[_0xbf4e('0x2c')];if(!_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x4e')](_0xbf4e('0x4f'))){_0x200096[_0xbf4e('0x18')]=qs[_0xbf4e('0x18')](_0x3e60e7['query'][_0xbf4e('0x18')]);_0x200096['offset']=qs[_0xbf4e('0x16')](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x16')]);}_0x200096[_0xbf4e('0x34')]=qs[_0xbf4e('0x35')](_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x35')]);_0x200096[_0xbf4e('0x37')]=qs['filters'](_[_0xbf4e('0x36')](_0x3e60e7[_0xbf4e('0x32')],_0x23c335[_0xbf4e('0x2e')]));if(_0x3e60e7[_0xbf4e('0x32')][_0xbf4e('0x3b')]){_0x200096['where']=_[_0xbf4e('0x38')](_0x200096[_0xbf4e('0x37')],{'$or':_[_0xbf4e('0x28')](_0x200096[_0xbf4e('0x30')],function(_0x12f19f){var _0x2c606b={};_0x2c606b[_0x12f19f]={'$like':'%'+_0x3e60e7['query'][_0xbf4e('0x3b')]+'%'};return _0x2c606b;})});}_0x200096['where']=_[_0xbf4e('0x38')](_0x200096[_0xbf4e('0x37')],{'mailboxuser':_0x453411[_0xbf4e('0x50')]});_0x200096=_[_0xbf4e('0x38')]({},_0x200096,_0x3e60e7['options']);return db[_0xbf4e('0x4d')]['findAndCountAll'](_0x200096)['then'](respondWithFilteredResult(_0x16592f,_0x200096));})[_0xbf4e('0x3f')](handleError(_0x16592f,null));}; \ No newline at end of file +var _0xd4f4=['get','Voicemails','then','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','VoiceMailMessage','findAndCountAll','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','../../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'];(function(_0x545e41,_0x55830d){var _0x20ee17=function(_0xac9b17){while(--_0xac9b17){_0x545e41['push'](_0x545e41['shift']());}};_0x20ee17(++_0x55830d);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x29df7d,_0xd61a65){_0x29df7d=_0x29df7d-0x0;var _0xd68f20=_0xd4f4[_0x29df7d];return _0xd68f20;};'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(){var _0x44bd2f=_0x3f4a55[_0x4d4f('0x2b')]({'plain':!![]});var _0x1cf365=_0x4d4f('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x1cf365,'resourceId':_0x44bd2f['id']}})[_0x4d4f('0x2d')](function(){return _0x3f4a55;});})[_0x4d4f('0x2d')](function(){_0x3d5d93[_0x4d4f('0x1f')](0xcc)[_0x4d4f('0x1e')]();});}};}function handleEntityNotFound(_0x58acbe,_0x671c87){return function(_0x380ebf){if(!_0x380ebf){_0x58acbe[_0x4d4f('0x1d')](0x194);}return _0x380ebf;};}function handleError(_0x2e91b2,_0x4effb1){_0x4effb1=_0x4effb1||0x1f4;return function(_0x338ba2){logger['error'](_0x338ba2[_0x4d4f('0x2e')]);if(_0x338ba2[_0x4d4f('0x2f')]){delete _0x338ba2['name'];}_0x2e91b2[_0x4d4f('0x1f')](_0x4effb1)[_0x4d4f('0x30')](_0x338ba2);};}exports[_0x4d4f('0x31')]=function(_0x3d7f14,_0x19a502){var _0x43a704={},_0x4c69cb={},_0x36eede={'count':0x0,'rows':[]};var _0x4578b6=_[_0x4d4f('0x32')](db[_0x4d4f('0x33')][_0x4d4f('0x34')],function(_0x4e47e5){return{'name':_0x4e47e5[_0x4d4f('0x35')],'type':_0x4e47e5['type'][_0x4d4f('0x36')]};});_0x4c69cb['model']=_['map'](_0x4578b6,'name');_0x4c69cb[_0x4d4f('0x37')]=_['keys'](_0x3d7f14[_0x4d4f('0x37')]);_0x4c69cb[_0x4d4f('0x38')]=_[_0x4d4f('0x39')](_0x4c69cb['model'],_0x4c69cb[_0x4d4f('0x37')]);_0x43a704[_0x4d4f('0x3a')]=_[_0x4d4f('0x39')](_0x4c69cb['model'],qs[_0x4d4f('0x3b')](_0x3d7f14['query'][_0x4d4f('0x3b')]));_0x43a704[_0x4d4f('0x3a')]=_0x43a704[_0x4d4f('0x3a')][_0x4d4f('0x3c')]?_0x43a704[_0x4d4f('0x3a')]:_0x4c69cb[_0x4d4f('0x3d')];if(!_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x3e')]('nolimit')){_0x43a704['limit']=qs[_0x4d4f('0x23')](_0x3d7f14['query']['limit']);_0x43a704[_0x4d4f('0x21')]=qs[_0x4d4f('0x21')](_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x21')]);}_0x43a704[_0x4d4f('0x3f')]=qs['sort'](_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x40')]);_0x43a704['where']=qs[_0x4d4f('0x38')](_[_0x4d4f('0x41')](_0x3d7f14[_0x4d4f('0x37')],_0x4c69cb[_0x4d4f('0x38')]),_0x4578b6);if(_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x42')]){_0x43a704[_0x4d4f('0x43')]=_[_0x4d4f('0x44')](_0x43a704[_0x4d4f('0x43')],{'$or':_['map'](_0x4578b6,function(_0x55a151){if(_0x55a151[_0x4d4f('0x45')]!==_0x4d4f('0x46')){var _0x4b3ba1={};_0x4b3ba1[_0x55a151[_0x4d4f('0x2f')]]={'$like':'%'+_0x3d7f14['query']['filter']+'%'};return _0x4b3ba1;}})});}_0x43a704=_[_0x4d4f('0x44')]({},_0x43a704,_0x3d7f14[_0x4d4f('0x47')]);var _0x58b52c={'where':_0x43a704['where']};return db[_0x4d4f('0x33')][_0x4d4f('0x24')](_0x58b52c)['then'](function(_0x949a6d){_0x36eede[_0x4d4f('0x24')]=_0x949a6d;if(_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x48')]){_0x43a704[_0x4d4f('0x49')]=[{'all':!![]}];}return db['VoiceMail'][_0x4d4f('0x4a')](_0x43a704);})['then'](function(_0x45a0c1){_0x36eede[_0x4d4f('0x4b')]=_0x45a0c1;return _0x36eede;})['then'](respondWithFilteredResult(_0x19a502,_0x43a704))[_0x4d4f('0x4c')](handleError(_0x19a502,null));};exports[_0x4d4f('0x4d')]=function(_0x1f7169,_0x489abe){var _0x379b59={'raw':!![],'where':{'id':_0x1f7169[_0x4d4f('0x4e')]['id']}},_0x48caa2={};_0x48caa2['model']=_[_0x4d4f('0x4f')](db[_0x4d4f('0x33')][_0x4d4f('0x34')]);_0x48caa2[_0x4d4f('0x37')]=_[_0x4d4f('0x4f')](_0x1f7169['query']);_0x48caa2['filters']=_[_0x4d4f('0x39')](_0x48caa2[_0x4d4f('0x3d')],_0x48caa2[_0x4d4f('0x37')]);_0x379b59[_0x4d4f('0x3a')]=_['intersection'](_0x48caa2['model'],qs['fields'](_0x1f7169[_0x4d4f('0x37')][_0x4d4f('0x3b')]));_0x379b59[_0x4d4f('0x3a')]=_0x379b59[_0x4d4f('0x3a')][_0x4d4f('0x3c')]?_0x379b59[_0x4d4f('0x3a')]:_0x48caa2[_0x4d4f('0x3d')];if(_0x1f7169[_0x4d4f('0x37')][_0x4d4f('0x48')]){_0x379b59[_0x4d4f('0x49')]=[{'all':!![]}];}_0x379b59=_[_0x4d4f('0x44')]({},_0x379b59,_0x1f7169[_0x4d4f('0x47')]);return db['VoiceMail'][_0x4d4f('0x50')](_0x379b59)[_0x4d4f('0x2d')](handleEntityNotFound(_0x489abe,null))['then'](respondWithResult(_0x489abe,null))[_0x4d4f('0x4c')](handleError(_0x489abe,null));};exports['create']=function(_0x15cf38,_0x401466){return db['VoiceMail'][_0x4d4f('0x51')](_0x15cf38[_0x4d4f('0x52')],{})[_0x4d4f('0x2d')](function(_0x21d0d6){var _0x7f22f2=_0x15cf38[_0x4d4f('0x53')][_0x4d4f('0x2b')]({'plain':!![]});if(!_0x7f22f2)throw new Error(_0x4d4f('0x54'));if(_0x7f22f2[_0x4d4f('0x55')]===_0x4d4f('0x53')){var _0xa6cef=_0x21d0d6[_0x4d4f('0x2b')]({'plain':!![]});var _0x504d85=_0x4d4f('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x504d85,'userProfileId':_0x7f22f2['userProfileId']},'raw':!![]})[_0x4d4f('0x2d')](function(_0x168742){if(_0x168742&&_0x168742['autoAssociation']===0x0){return db['UserProfileResource'][_0x4d4f('0x51')]({'name':_0xa6cef[_0x4d4f('0x2f')],'resourceId':_0xa6cef['id'],'type':_0x168742['name'],'sectionId':_0x168742['id']},{})[_0x4d4f('0x2d')](function(){return _0x21d0d6;});}else{return _0x21d0d6;}})['catch'](function(_0x17b59e){logger[_0x4d4f('0x56')](_0x4d4f('0x57'),_0x17b59e);throw _0x17b59e;});}return _0x21d0d6;})[_0x4d4f('0x2d')](respondWithResult(_0x401466,0xc9))['catch'](handleError(_0x401466,null));};exports[_0x4d4f('0x29')]=function(_0x2008c3,_0x36a446){if(_0x2008c3[_0x4d4f('0x52')]['id']){delete _0x2008c3[_0x4d4f('0x52')]['id'];}return db['VoiceMail'][_0x4d4f('0x50')]({'where':{'id':_0x2008c3['params']['id']}})[_0x4d4f('0x2d')](handleEntityNotFound(_0x36a446,null))['then'](saveUpdates(_0x2008c3[_0x4d4f('0x52')],null))[_0x4d4f('0x2d')](respondWithResult(_0x36a446,null))['catch'](handleError(_0x36a446,null));};exports[_0x4d4f('0x2a')]=function(_0x1d8ae6,_0x4d08c8){return db[_0x4d4f('0x33')]['find']({'where':{'id':_0x1d8ae6[_0x4d4f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4d08c8,null))['then'](removeEntity(_0x4d08c8,null))[_0x4d4f('0x4c')](handleError(_0x4d08c8,null));};exports[_0x4d4f('0x58')]=function(_0x23bf8e,_0x213cdb,_0x29a3a1){return db['VoiceMail']['findOne']({'where':{'id':_0x23bf8e[_0x4d4f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x213cdb,null))[_0x4d4f('0x2d')](function(_0xadc9ac){var _0x23771c;var _0x4585b5={},_0x31aba3={};_0x31aba3[_0x4d4f('0x3d')]=_['keys'](db[_0x4d4f('0x59')][_0x4d4f('0x34')]);_0x31aba3[_0x4d4f('0x37')]=_['keys'](_0x23bf8e[_0x4d4f('0x37')]);_0x31aba3[_0x4d4f('0x38')]=_[_0x4d4f('0x39')](_0x31aba3['model'],_0x31aba3[_0x4d4f('0x37')]);_0x4585b5['attributes']=_[_0x4d4f('0x39')](_0x31aba3[_0x4d4f('0x3d')],qs[_0x4d4f('0x3b')](_0x23bf8e[_0x4d4f('0x37')][_0x4d4f('0x3b')]));_0x4585b5[_0x4d4f('0x3a')]=_0x4585b5[_0x4d4f('0x3a')][_0x4d4f('0x3c')]?_0x4585b5[_0x4d4f('0x3a')]:_0x31aba3['model'];if(!_0x23bf8e[_0x4d4f('0x37')][_0x4d4f('0x3e')]('nolimit')){_0x4585b5[_0x4d4f('0x23')]=qs[_0x4d4f('0x23')](_0x23bf8e[_0x4d4f('0x37')][_0x4d4f('0x23')]);_0x4585b5['offset']=qs[_0x4d4f('0x21')](_0x23bf8e[_0x4d4f('0x37')]['offset']);}_0x4585b5['order']=qs[_0x4d4f('0x40')](_0x23bf8e[_0x4d4f('0x37')]['sort']);_0x4585b5['where']=qs['filters'](_[_0x4d4f('0x41')](_0x23bf8e[_0x4d4f('0x37')],_0x31aba3['filters']));if(_0x23bf8e[_0x4d4f('0x37')][_0x4d4f('0x42')]){_0x4585b5[_0x4d4f('0x43')]=_[_0x4d4f('0x44')](_0x4585b5[_0x4d4f('0x43')],{'$or':_[_0x4d4f('0x32')](_0x4585b5[_0x4d4f('0x3a')],function(_0x20845c){var _0x542513={};_0x542513[_0x20845c]={'$like':'%'+_0x23bf8e[_0x4d4f('0x37')]['filter']+'%'};return _0x542513;})});}_0x4585b5[_0x4d4f('0x43')]=_[_0x4d4f('0x44')](_0x4585b5[_0x4d4f('0x43')],{'mailboxuser':_0xadc9ac['mailbox']});_0x4585b5=_[_0x4d4f('0x44')]({},_0x4585b5,_0x23bf8e[_0x4d4f('0x47')]);return db[_0x4d4f('0x59')][_0x4d4f('0x5a')](_0x4585b5)['then'](respondWithFilteredResult(_0x213cdb,_0x4585b5));})[_0x4d4f('0x4c')](handleError(_0x213cdb,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index d3cb894..59f72fb 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 _0x94fe=['context','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','mailbox'];(function(_0x42aca7,_0x5acc37){var _0x1ccd4c=function(_0x19b6af){while(--_0x19b6af){_0x42aca7['push'](_0x42aca7['shift']());}};_0x1ccd4c(++_0x5acc37);}(_0x94fe,0xd1));var _0xe94f=function(_0x22d435,_0x1647e4){_0x22d435=_0x22d435-0x0;var _0x639e3f=_0x94fe[_0x22d435];return _0x639e3f;};'use strict';var _=require(_0xe94f('0x0'));var util=require(_0xe94f('0x1'));var logger=require(_0xe94f('0x2'))(_0xe94f('0x3'));var moment=require(_0xe94f('0x4'));var BPromise=require('bluebird');var rp=require(_0xe94f('0x5'));var fs=require('fs');var path=require(_0xe94f('0x6'));var rimraf=require(_0xe94f('0x7'));var config=require(_0xe94f('0x8'));var attributes=require(_0xe94f('0x9'));module[_0xe94f('0xa')]=function(_0x2a36ae,_0x10cbdc){return _0x2a36ae[_0xe94f('0xb')]('VoiceMail',attributes,{'tableName':_0xe94f('0xc'),'paranoid':![],'indexes':[{'name':_0xe94f('0xd'),'fields':[_0xe94f('0xe'),_0xe94f('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaa76=['bluebird','request-promise','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','../../config/logger','api','moment'];(function(_0x13be43,_0x1261e8){var _0x2b5d2f=function(_0x4a979f){while(--_0x4a979f){_0x13be43['push'](_0x13be43['shift']());}};_0x2b5d2f(++_0x1261e8);}(_0xaa76,0x1bc));var _0x6aa7=function(_0x24d7d2,_0x2d04ec){_0x24d7d2=_0x24d7d2-0x0;var _0x7c0a5f=_0xaa76[_0x24d7d2];return _0x7c0a5f;};'use strict';var _=require(_0x6aa7('0x0'));var util=require('util');var logger=require(_0x6aa7('0x1'))(_0x6aa7('0x2'));var moment=require(_0x6aa7('0x3'));var BPromise=require(_0x6aa7('0x4'));var rp=require(_0x6aa7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6aa7('0x6'));module[_0x6aa7('0x7')]=function(_0x5d4e1a,_0x4da9df){return _0x5d4e1a[_0x6aa7('0x8')](_0x6aa7('0x9'),attributes,{'tableName':_0x6aa7('0xa'),'paranoid':![],'indexes':[{'name':_0x6aa7('0xb'),'fields':[_0x6aa7('0xc'),_0x6aa7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 8263e63..a2c461f 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 _0xd56d=['info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','message','catch','util','bluebird','randomstring','ioredis','../../config/utils','client','request'];(function(_0x5bc85f,_0xa9a9e0){var _0x44874d=function(_0x3a0f03){while(--_0x3a0f03){_0x5bc85f['push'](_0x5bc85f['shift']());}};_0x44874d(++_0xa9a9e0);}(_0xd56d,0x134));var _0xdd56=function(_0x484f06,_0x36e4ac){_0x484f06=_0x484f06-0x0;var _0x332d44=_0xd56d[_0x484f06];return _0x332d44;};'use strict';var _=require('lodash');var util=require(_0xdd56('0x0'));var moment=require('moment');var BPromise=require(_0xdd56('0x1'));var rs=require(_0xdd56('0x2'));var fs=require('fs');var Redis=require(_0xdd56('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdd56('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdd56('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c67a9,_0xf8bbd6,_0x53b60b){return new BPromise(function(_0x21ad73,_0x502f7b){return client[_0xdd56('0x6')](_0x2c67a9,_0x53b60b)['then'](function(_0x205a3d){logger[_0xdd56('0x7')](_0xdd56('0x8'),_0xf8bbd6,_0xdd56('0x9'));logger[_0xdd56('0xa')](_0xdd56('0xb'),_0xf8bbd6,_0xdd56('0x9'),JSON['stringify'](_0x205a3d));if(_0x205a3d['error']){if(_0x205a3d[_0xdd56('0xc')]['code']===0x1f4){logger[_0xdd56('0xc')](_0xdd56('0x8'),_0xf8bbd6,_0x205a3d['error']['message']);return _0x502f7b(_0x205a3d['error'][_0xdd56('0xd')]);}logger[_0xdd56('0xc')](_0xdd56('0x8'),_0xf8bbd6,_0x205a3d['error'][_0xdd56('0xd')]);return _0x21ad73(_0x205a3d[_0xdd56('0xc')]['message']);}else{logger[_0xdd56('0x7')]('VoiceMail,\x20%s,\x20%s',_0xf8bbd6,_0xdd56('0x9'));_0x21ad73(_0x205a3d['result'][_0xdd56('0xd')]);}})[_0xdd56('0xe')](function(_0x8eb79b){logger[_0xdd56('0xc')](_0xdd56('0x8'),_0xf8bbd6,_0x8eb79b);_0x502f7b(_0x8eb79b);});});} \ No newline at end of file +var _0x5333=['../../config/environment','client','http','then','info','request\x20sent','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x406fbb,_0x1093e5){var _0x8e921d=function(_0x410517){while(--_0x410517){_0x406fbb['push'](_0x406fbb['shift']());}};_0x8e921d(++_0x1093e5);}(_0x5333,0x69));var _0x3533=function(_0x250298,_0x5a869a){_0x250298=_0x250298-0x0;var _0x798dbf=_0x5333[_0x250298];return _0x798dbf;};'use strict';var _=require(_0x3533('0x0'));var util=require(_0x3533('0x1'));var moment=require(_0x3533('0x2'));var BPromise=require(_0x3533('0x3'));var rs=require(_0x3533('0x4'));var fs=require('fs');var Redis=require(_0x3533('0x5'));var db=require(_0x3533('0x6'))['db'];var utils=require(_0x3533('0x7'));var logger=require(_0x3533('0x8'))(_0x3533('0x9'));var config=require(_0x3533('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3533('0xb')][_0x3533('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d2d02,_0x4f6410,_0x2a513d){return new BPromise(function(_0x5399b5,_0x252dae){return client['request'](_0x1d2d02,_0x2a513d)[_0x3533('0xd')](function(_0x214b92){logger[_0x3533('0xe')]('VoiceMail,\x20%s,\x20%s',_0x4f6410,_0x3533('0xf'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x4f6410,'request\x20sent',JSON[_0x3533('0x10')](_0x214b92));if(_0x214b92[_0x3533('0x11')]){if(_0x214b92[_0x3533('0x11')][_0x3533('0x12')]===0x1f4){logger[_0x3533('0x11')](_0x3533('0x13'),_0x4f6410,_0x214b92[_0x3533('0x11')][_0x3533('0x14')]);return _0x252dae(_0x214b92[_0x3533('0x11')][_0x3533('0x14')]);}logger['error'](_0x3533('0x13'),_0x4f6410,_0x214b92[_0x3533('0x11')][_0x3533('0x14')]);return _0x5399b5(_0x214b92[_0x3533('0x11')]['message']);}else{logger[_0x3533('0xe')]('VoiceMail,\x20%s,\x20%s',_0x4f6410,'request\x20sent');_0x5399b5(_0x214b92[_0x3533('0x15')][_0x3533('0x14')]);}})[_0x3533('0x16')](function(_0x1420e5){logger['error']('VoiceMail,\x20%s,\x20%s',_0x4f6410,_0x1420e5);_0x252dae(_0x1420e5);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 9536cc7..4c06423 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 _0x6358=['put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','index','/:id','isAuthenticated','/:id/download','download','post','create'];(function(_0x5e1cf7,_0x2954cf){var _0x2917db=function(_0x223aee){while(--_0x223aee){_0x5e1cf7['push'](_0x5e1cf7['shift']());}};_0x2917db(++_0x2954cf);}(_0x6358,0x1cf));var _0x8635=function(_0x40a39f,_0x5b92f9){_0x40a39f=_0x40a39f-0x0;var _0x87d929=_0x6358[_0x40a39f];return _0x87d929;};'use strict';var multer=require(_0x8635('0x0'));var util=require(_0x8635('0x1'));var path=require(_0x8635('0x2'));var timeout=require(_0x8635('0x3'));var express=require(_0x8635('0x4'));var router=express[_0x8635('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8635('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8635('0x7'));var controller=require(_0x8635('0x8'));router[_0x8635('0x9')]('/',auth['isAuthenticated'](),controller[_0x8635('0xa')]);router[_0x8635('0x9')](_0x8635('0xb'),auth[_0x8635('0xc')](),controller['show']);router['get'](_0x8635('0xd'),auth[_0x8635('0xc')](),controller[_0x8635('0xe')]);router[_0x8635('0xf')]('/',auth[_0x8635('0xc')](),controller[_0x8635('0x10')]);router[_0x8635('0x11')](_0x8635('0xb'),auth[_0x8635('0xc')](),controller[_0x8635('0x12')]);router[_0x8635('0x13')](_0x8635('0xb'),auth[_0x8635('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7a38=['./voiceMailMessage.controller','get','index','/:id','isAuthenticated','show','/:id/download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x41378f,_0x5e2214){var _0x4fa590=function(_0x29dba8){while(--_0x29dba8){_0x41378f['push'](_0x41378f['shift']());}};_0x4fa590(++_0x5e2214);}(_0x7a38,0x173));var _0x87a3=function(_0x1ae0a7,_0x6ae49d){_0x1ae0a7=_0x1ae0a7-0x0;var _0x5ebf43=_0x7a38[_0x1ae0a7];return _0x5ebf43;};'use strict';var multer=require(_0x87a3('0x0'));var util=require(_0x87a3('0x1'));var path=require(_0x87a3('0x2'));var timeout=require(_0x87a3('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x87a3('0x4'));var auth=require(_0x87a3('0x5'));var interaction=require(_0x87a3('0x6'));var config=require('../../config/environment');var controller=require(_0x87a3('0x7'));router[_0x87a3('0x8')]('/',auth['isAuthenticated'](),controller[_0x87a3('0x9')]);router[_0x87a3('0x8')](_0x87a3('0xa'),auth[_0x87a3('0xb')](),controller[_0x87a3('0xc')]);router['get'](_0x87a3('0xd'),auth[_0x87a3('0xb')](),controller['download']);router[_0x87a3('0xe')]('/',auth[_0x87a3('0xb')](),controller[_0x87a3('0xf')]);router[_0x87a3('0x10')](_0x87a3('0xa'),auth[_0x87a3('0xb')](),controller[_0x87a3('0x11')]);router[_0x87a3('0x12')]('/:id',auth[_0x87a3('0xb')](),controller[_0x87a3('0x13')]);module[_0x87a3('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 7fde825..9224bce 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 _0xa2fd=['STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue'];(function(_0x20c2f4,_0x470117){var _0x2c4823=function(_0x581e46){while(--_0x581e46){_0x20c2f4['push'](_0x20c2f4['shift']());}};_0x2c4823(++_0x470117);}(_0xa2fd,0x96));var _0xda2f=function(_0x40061a,_0x272992){_0x40061a=_0x40061a-0x0;var _0x34067e=_0xa2fd[_0x40061a];return _0x34067e;};'use strict';var Sequelize=require(_0xda2f('0x0'));module[_0xda2f('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x34c337){return this[_0xda2f('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xda2f('0x4')](_0xda2f('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':''},'stamp':{'type':_0xda2f('0x6'),'defaultValue':Sequelize[_0xda2f('0x7')](_0xda2f('0x8'))}}; \ No newline at end of file +var _0x510c=['getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x135a1c,_0x28b5f6){var _0x295c98=function(_0x2747fc){while(--_0x2747fc){_0x135a1c['push'](_0x135a1c['shift']());}};_0x295c98(++_0x28b5f6);}(_0x510c,0xee));var _0xc510=function(_0x175f2d,_0x535afb){_0x175f2d=_0x175f2d-0x0;var _0x3d894c=_0x510c[_0x175f2d];return _0x3d894c;};'use strict';var Sequelize=require(_0xc510('0x0'));module[_0xc510('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5b4482){return this[_0xc510('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xc510('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xc510('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xc510('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xc510('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xc510('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xc510('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xc510('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xc510('0x5')](_0xc510('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xc510('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xc510('0x4')],'defaultValue':''},'stamp':{'type':_0xc510('0x7'),'defaultValue':Sequelize[_0xc510('0x8')](_0xc510('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index d13d48b..b9a6211 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 _0x3962=['util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','end','error','name','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filters','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','destroy','find','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','send','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x228800,_0x1a89fe){var _0x5383f9=function(_0x20e98b){while(--_0x20e98b){_0x228800['push'](_0x228800['shift']());}};_0x5383f9(++_0x1a89fe);}(_0x3962,0x199));var _0x2396=function(_0x31efed,_0xdd9a51){_0x31efed=_0x31efed-0x0;var _0x24d4bc=_0x3962[_0x31efed];return _0x24d4bc;};'use strict';var emlformat=require(_0x2396('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2396('0x1'));var jsonpatch=require(_0x2396('0x2'));var rp=require('request-promise');var moment=require(_0x2396('0x3'));var BPromise=require(_0x2396('0x4'));var Mustache=require(_0x2396('0x5'));var util=require(_0x2396('0x6'));var path=require(_0x2396('0x7'));var sox=require(_0x2396('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2396('0x9'));var squel=require(_0x2396('0xa'));var crypto=require('crypto');var jsforce=require(_0x2396('0xb'));var deskjs=require(_0x2396('0xc'));var toCsv=require(_0x2396('0xd'));var querystring=require(_0x2396('0xe'));var Papa=require(_0x2396('0xf'));var Redis=require(_0x2396('0x10'));var authService=require(_0x2396('0x11'));var qs=require(_0x2396('0x12'));var as=require(_0x2396('0x13'));var hardwareService=require(_0x2396('0x14'));var logger=require('../../config/logger')(_0x2396('0x15'));var utils=require(_0x2396('0x16'));var config=require(_0x2396('0x17'));var licenseUtil=require(_0x2396('0x18'));var db=require(_0x2396('0x19'))['db'];function respondWithStatusCode(_0x41ce19,_0x14dc7b){_0x14dc7b=_0x14dc7b||0xcc;return function(_0x1fc755){if(_0x1fc755){return _0x41ce19[_0x2396('0x1a')](_0x14dc7b);}return _0x41ce19[_0x2396('0x1b')](_0x14dc7b)['end']();};}function respondWithResult(_0x292822,_0xdcebf7){_0xdcebf7=_0xdcebf7||0xc8;return function(_0x4a91f1){if(_0x4a91f1){return _0x292822[_0x2396('0x1b')](_0xdcebf7)[_0x2396('0x1c')](_0x4a91f1);}};}function respondWithFilteredResult(_0x6cd7ae,_0x3a2137){return function(_0x362f04){if(_0x362f04){var _0x5949c2=typeof _0x3a2137[_0x2396('0x1d')]===_0x2396('0x1e')&&typeof _0x3a2137[_0x2396('0x1f')]==='undefined';var _0x31eb4a=_0x362f04[_0x2396('0x20')];var _0x62f82f=_0x5949c2?0x0:_0x3a2137[_0x2396('0x1d')];var _0x19b380=_0x5949c2?_0x362f04[_0x2396('0x20')]:_0x3a2137['offset']+_0x3a2137['limit'];var _0x5418d0;if(_0x19b380>=_0x31eb4a){_0x19b380=_0x31eb4a;_0x5418d0=0xc8;}else{_0x5418d0=0xce;}_0x6cd7ae[_0x2396('0x1b')](_0x5418d0);return _0x6cd7ae[_0x2396('0x21')](_0x2396('0x22'),_0x62f82f+'-'+_0x19b380+'/'+_0x31eb4a)['json'](_0x362f04);}return null;};}function patchUpdates(_0xa20190){return function(_0xf48cf7){try{jsonpatch['apply'](_0xf48cf7,_0xa20190,!![]);}catch(_0x1a9386){return BPromise[_0x2396('0x23')](_0x1a9386);}return _0xf48cf7[_0x2396('0x24')]();};}function saveUpdates(_0x471989,_0x1bfaf0){return function(_0x10d47e){if(_0x10d47e){return _0x10d47e['update'](_0x471989)[_0x2396('0x25')](function(_0x312097){return _0x312097;});}return null;};}function removeEntity(_0x43a68a,_0x1d4b63){return function(_0x2f23af){if(_0x2f23af){return _0x2f23af['destroy']()[_0x2396('0x25')](function(){_0x43a68a['status'](0xcc)[_0x2396('0x26')]();});}};}function handleEntityNotFound(_0x53a47b,_0xc51a48){return function(_0x195086){if(!_0x195086){_0x53a47b[_0x2396('0x1a')](0x194);}return _0x195086;};}function handleError(_0x697974,_0x1bc3f3){_0x1bc3f3=_0x1bc3f3||0x1f4;return function(_0x2da688){logger[_0x2396('0x27')](_0x2da688['stack']);if(_0x2da688[_0x2396('0x28')]){delete _0x2da688[_0x2396('0x28')];}_0x697974[_0x2396('0x1b')](_0x1bc3f3)['send'](_0x2da688);};}exports[_0x2396('0x29')]=function(_0x146771,_0x1e5575){var _0x19be80={},_0x4c950f={},_0x45b03b={'count':0x0,'rows':[]};var _0x319fdc=_[_0x2396('0x2a')](db[_0x2396('0x2b')][_0x2396('0x2c')],function(_0xdc498c){return{'name':_0xdc498c[_0x2396('0x2d')],'type':_0xdc498c[_0x2396('0x2e')][_0x2396('0x2f')]};});_0x4c950f[_0x2396('0x30')]=_['differenceBy'](_[_0x2396('0x2a')](_0x319fdc,_0x2396('0x28')),[_0x2396('0x28')]);_0x4c950f[_0x2396('0x31')]=_[_0x2396('0x32')](_0x146771[_0x2396('0x31')]);_0x4c950f['filters']=_[_0x2396('0x33')](_0x4c950f[_0x2396('0x30')],_0x4c950f['query']);_0x19be80['attributes']=_[_0x2396('0x33')](_0x4c950f['model'],qs[_0x2396('0x34')](_0x146771[_0x2396('0x31')][_0x2396('0x34')]));_0x19be80[_0x2396('0x35')]=_0x19be80['attributes'][_0x2396('0x36')]?_0x19be80[_0x2396('0x35')]:_0x4c950f[_0x2396('0x30')];if(!_0x146771[_0x2396('0x31')][_0x2396('0x37')]('nolimit')){_0x19be80[_0x2396('0x1f')]=qs[_0x2396('0x1f')](_0x146771[_0x2396('0x31')]['limit']);_0x19be80[_0x2396('0x1d')]=qs['offset'](_0x146771[_0x2396('0x31')][_0x2396('0x1d')]);}_0x19be80['order']=qs[_0x2396('0x38')](_0x146771[_0x2396('0x31')][_0x2396('0x38')]);_0x19be80['where']=qs['filters'](_[_0x2396('0x39')](_0x146771['query'],_0x4c950f[_0x2396('0x3a')]),_0x319fdc);if(_0x146771['query'][_0x2396('0x3b')]){_0x19be80[_0x2396('0x3c')]=_['merge'](_0x19be80['where'],{'$or':_[_0x2396('0x2a')](_0x319fdc,function(_0x367e07){if(_0x367e07[_0x2396('0x2e')]!=='VIRTUAL'){var _0x1e8330={};_0x1e8330[_0x367e07[_0x2396('0x28')]]={'$like':'%'+_0x146771[_0x2396('0x31')]['filter']+'%'};return _0x1e8330;}})});}_0x19be80=_[_0x2396('0x3d')]({},_0x19be80,_0x146771[_0x2396('0x3e')]);var _0x243a51={'where':_0x19be80['where']};return db[_0x2396('0x2b')][_0x2396('0x20')](_0x243a51)[_0x2396('0x25')](function(_0xa701d5){_0x45b03b[_0x2396('0x20')]=_0xa701d5;if(_0x146771['query'][_0x2396('0x3f')]){_0x19be80[_0x2396('0x40')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x2396('0x41')](_0x19be80);})['then'](function(_0x486c57){_0x45b03b[_0x2396('0x42')]=_0x486c57;return _0x45b03b;})[_0x2396('0x25')](respondWithFilteredResult(_0x1e5575,_0x19be80))[_0x2396('0x43')](handleError(_0x1e5575,null));};exports[_0x2396('0x44')]=function(_0x6cd6b6,_0x5bbee1){var _0x2d51f4={'raw':!![],'where':{'id':_0x6cd6b6[_0x2396('0x45')]['id']}},_0x9225cc={};_0x9225cc['model']=_[_0x2396('0x32')](db[_0x2396('0x2b')][_0x2396('0x2c')]);_0x9225cc['query']=_[_0x2396('0x32')](_0x6cd6b6['query']);_0x9225cc['filters']=_[_0x2396('0x33')](_0x9225cc[_0x2396('0x30')],_0x9225cc['query']);_0x2d51f4['attributes']=_[_0x2396('0x33')](_0x9225cc['model'],qs[_0x2396('0x34')](_0x6cd6b6[_0x2396('0x31')][_0x2396('0x34')]));_0x2d51f4[_0x2396('0x35')]=_0x2d51f4[_0x2396('0x35')][_0x2396('0x36')]?_0x2d51f4[_0x2396('0x35')]:_0x9225cc[_0x2396('0x30')];if(_0x6cd6b6[_0x2396('0x31')]['includeAll']){_0x2d51f4['include']=[{'all':!![]}];}_0x2d51f4=_[_0x2396('0x3d')]({},_0x2d51f4,_0x6cd6b6[_0x2396('0x3e')]);return db[_0x2396('0x2b')]['find'](_0x2d51f4)[_0x2396('0x25')](handleEntityNotFound(_0x5bbee1,null))[_0x2396('0x25')](respondWithResult(_0x5bbee1,null))[_0x2396('0x43')](handleError(_0x5bbee1,null));};exports['create']=function(_0x3c61c5,_0x45f9d9){return db['VoiceMailMessage'][_0x2396('0x46')](_0x3c61c5[_0x2396('0x47')],{})[_0x2396('0x25')](respondWithResult(_0x45f9d9,0xc9))['catch'](handleError(_0x45f9d9,null));};exports[_0x2396('0x48')]=function(_0x525a3e,_0x16f9b3){if(_0x525a3e[_0x2396('0x47')]['id']){delete _0x525a3e[_0x2396('0x47')]['id'];}return db[_0x2396('0x2b')]['find']({'where':{'id':_0x525a3e[_0x2396('0x45')]['id']}})[_0x2396('0x25')](handleEntityNotFound(_0x16f9b3,null))['then'](saveUpdates(_0x525a3e[_0x2396('0x47')],null))[_0x2396('0x25')](respondWithResult(_0x16f9b3,null))[_0x2396('0x43')](handleError(_0x16f9b3,null));};exports[_0x2396('0x49')]=function(_0x9befd2,_0x42b028){return db[_0x2396('0x2b')][_0x2396('0x4a')]({'where':{'id':_0x9befd2[_0x2396('0x45')]['id']}})[_0x2396('0x25')](handleEntityNotFound(_0x42b028,null))[_0x2396('0x25')](removeEntity(_0x42b028,null))[_0x2396('0x43')](handleError(_0x42b028,null));};exports['download']=function(_0x2d8773,_0x15a253,_0xe2ee0c){return db[_0x2396('0x2b')]['find']({'where':{'id':_0x2d8773[_0x2396('0x45')]['id']},'attributes':['id',_0x2396('0x4b'),_0x2396('0x4c')]})[_0x2396('0x25')](handleEntityNotFound(_0x15a253,null))['then'](function(_0x33e649){if(_0x33e649){if(!_0x33e649[_0x2396('0x4b')]){throw new db['Sequelize'][(_0x2396('0x4d'))](_0x2396('0x4e'));}var _0x5bfa30={'Content-Type':'audio/wav','Content-Disposition':_0x2396('0x4f')};if(_0x33e649[_0x2396('0x4c')]){_0x5bfa30[_0x2396('0x50')]=_0x2396('0x51')+_0x33e649[_0x2396('0x4c')]+'.wav\x22';}_0x15a253[_0x2396('0x21')](_0x5bfa30);return _0x15a253[_0x2396('0x52')](new Buffer(_0x33e649['recording']));}})[_0x2396('0x43')](handleError(_0x15a253,null));}; \ No newline at end of file +var _0xebce=['VoiceMailMessage','count','includeAll','findAll','rows','show','params','keys','include','catch','create','body','find','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','.wav\x22','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options'];(function(_0x18b9a8,_0x1770b6){var _0x4a0a8f=function(_0x80ea93){while(--_0x80ea93){_0x18b9a8['push'](_0x18b9a8['shift']());}};_0x4a0a8f(++_0x1770b6);}(_0xebce,0xb8));var _0xeebc=function(_0x3722d2,_0x206336){_0x3722d2=_0x3722d2-0x0;var _0x15ae66=_0xebce[_0x3722d2];return _0x15ae66;};'use strict';var emlformat=require(_0xeebc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeebc('0x1'));var jsonpatch=require(_0xeebc('0x2'));var rp=require(_0xeebc('0x3'));var moment=require('moment');var BPromise=require(_0xeebc('0x4'));var Mustache=require('mustache');var util=require(_0xeebc('0x5'));var path=require(_0xeebc('0x6'));var sox=require('sox');var csv=require(_0xeebc('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeebc('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xeebc('0x9'));var deskjs=require(_0xeebc('0xa'));var toCsv=require('to-csv');var querystring=require(_0xeebc('0xb'));var Papa=require('papaparse');var Redis=require(_0xeebc('0xc'));var authService=require(_0xeebc('0xd'));var qs=require(_0xeebc('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeebc('0xf'));var logger=require(_0xeebc('0x10'))(_0xeebc('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xeebc('0x12'))['db'];function respondWithStatusCode(_0x471f1a,_0xa2dc21){_0xa2dc21=_0xa2dc21||0xcc;return function(_0x3aee81){if(_0x3aee81){return _0x471f1a[_0xeebc('0x13')](_0xa2dc21);}return _0x471f1a[_0xeebc('0x14')](_0xa2dc21)[_0xeebc('0x15')]();};}function respondWithResult(_0x3987f5,_0x26c323){_0x26c323=_0x26c323||0xc8;return function(_0x2bcb44){if(_0x2bcb44){return _0x3987f5[_0xeebc('0x14')](_0x26c323)[_0xeebc('0x16')](_0x2bcb44);}};}function respondWithFilteredResult(_0x1e8b76,_0x1bc151){return function(_0x572f8b){if(_0x572f8b){var _0x358635=typeof _0x1bc151[_0xeebc('0x17')]===_0xeebc('0x18')&&typeof _0x1bc151[_0xeebc('0x19')]===_0xeebc('0x18');var _0x226c56=_0x572f8b['count'];var _0x13672d=_0x358635?0x0:_0x1bc151[_0xeebc('0x17')];var _0x323bfa=_0x358635?_0x572f8b['count']:_0x1bc151[_0xeebc('0x17')]+_0x1bc151[_0xeebc('0x19')];var _0x4b6135;if(_0x323bfa>=_0x226c56){_0x323bfa=_0x226c56;_0x4b6135=0xc8;}else{_0x4b6135=0xce;}_0x1e8b76[_0xeebc('0x14')](_0x4b6135);return _0x1e8b76[_0xeebc('0x1a')]('Content-Range',_0x13672d+'-'+_0x323bfa+'/'+_0x226c56)[_0xeebc('0x16')](_0x572f8b);}return null;};}function patchUpdates(_0x2a973f){return function(_0x3fa15f){try{jsonpatch[_0xeebc('0x1b')](_0x3fa15f,_0x2a973f,!![]);}catch(_0xfe871){return BPromise[_0xeebc('0x1c')](_0xfe871);}return _0x3fa15f[_0xeebc('0x1d')]();};}function saveUpdates(_0x4c4a57,_0x16989f){return function(_0x2b3bde){if(_0x2b3bde){return _0x2b3bde[_0xeebc('0x1e')](_0x4c4a57)[_0xeebc('0x1f')](function(_0x33034e){return _0x33034e;});}return null;};}function removeEntity(_0x47d9c5,_0x34e83d){return function(_0x4dbc20){if(_0x4dbc20){return _0x4dbc20[_0xeebc('0x20')]()[_0xeebc('0x1f')](function(){_0x47d9c5[_0xeebc('0x14')](0xcc)[_0xeebc('0x15')]();});}};}function handleEntityNotFound(_0x3bd946,_0x5c5da2){return function(_0x1d6c8a){if(!_0x1d6c8a){_0x3bd946['sendStatus'](0x194);}return _0x1d6c8a;};}function handleError(_0x283449,_0x329355){_0x329355=_0x329355||0x1f4;return function(_0x56d1da){logger['error'](_0x56d1da[_0xeebc('0x21')]);if(_0x56d1da['name']){delete _0x56d1da[_0xeebc('0x22')];}_0x283449[_0xeebc('0x14')](_0x329355)[_0xeebc('0x23')](_0x56d1da);};}exports[_0xeebc('0x24')]=function(_0x31ffc4,_0x126a1b){var _0x5dc271={},_0x1a9dc9={},_0x234ef9={'count':0x0,'rows':[]};var _0x47c58d=_[_0xeebc('0x25')](db['VoiceMailMessage'][_0xeebc('0x26')],function(_0x58fdb4){return{'name':_0x58fdb4[_0xeebc('0x27')],'type':_0x58fdb4[_0xeebc('0x28')][_0xeebc('0x29')]};});_0x1a9dc9[_0xeebc('0x2a')]=_['differenceBy'](_[_0xeebc('0x25')](_0x47c58d,_0xeebc('0x22')),[_0xeebc('0x22')]);_0x1a9dc9[_0xeebc('0x2b')]=_['keys'](_0x31ffc4[_0xeebc('0x2b')]);_0x1a9dc9['filters']=_[_0xeebc('0x2c')](_0x1a9dc9[_0xeebc('0x2a')],_0x1a9dc9[_0xeebc('0x2b')]);_0x5dc271['attributes']=_[_0xeebc('0x2c')](_0x1a9dc9[_0xeebc('0x2a')],qs[_0xeebc('0x2d')](_0x31ffc4[_0xeebc('0x2b')][_0xeebc('0x2d')]));_0x5dc271[_0xeebc('0x2e')]=_0x5dc271[_0xeebc('0x2e')][_0xeebc('0x2f')]?_0x5dc271[_0xeebc('0x2e')]:_0x1a9dc9[_0xeebc('0x2a')];if(!_0x31ffc4[_0xeebc('0x2b')][_0xeebc('0x30')](_0xeebc('0x31'))){_0x5dc271['limit']=qs[_0xeebc('0x19')](_0x31ffc4[_0xeebc('0x2b')][_0xeebc('0x19')]);_0x5dc271['offset']=qs[_0xeebc('0x17')](_0x31ffc4[_0xeebc('0x2b')]['offset']);}_0x5dc271[_0xeebc('0x32')]=qs['sort'](_0x31ffc4[_0xeebc('0x2b')][_0xeebc('0x33')]);_0x5dc271[_0xeebc('0x34')]=qs['filters'](_[_0xeebc('0x35')](_0x31ffc4[_0xeebc('0x2b')],_0x1a9dc9[_0xeebc('0x36')]),_0x47c58d);if(_0x31ffc4[_0xeebc('0x2b')][_0xeebc('0x37')]){_0x5dc271['where']=_[_0xeebc('0x38')](_0x5dc271[_0xeebc('0x34')],{'$or':_[_0xeebc('0x25')](_0x47c58d,function(_0xbb4d5e){if(_0xbb4d5e[_0xeebc('0x28')]!==_0xeebc('0x39')){var _0x1511af={};_0x1511af[_0xbb4d5e[_0xeebc('0x22')]]={'$like':'%'+_0x31ffc4[_0xeebc('0x2b')][_0xeebc('0x37')]+'%'};return _0x1511af;}})});}_0x5dc271=_[_0xeebc('0x38')]({},_0x5dc271,_0x31ffc4[_0xeebc('0x3a')]);var _0x1ab704={'where':_0x5dc271[_0xeebc('0x34')]};return db[_0xeebc('0x3b')][_0xeebc('0x3c')](_0x1ab704)[_0xeebc('0x1f')](function(_0x309cb2){_0x234ef9[_0xeebc('0x3c')]=_0x309cb2;if(_0x31ffc4['query'][_0xeebc('0x3d')]){_0x5dc271['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0xeebc('0x3e')](_0x5dc271);})[_0xeebc('0x1f')](function(_0x4bf53b){_0x234ef9[_0xeebc('0x3f')]=_0x4bf53b;return _0x234ef9;})[_0xeebc('0x1f')](respondWithFilteredResult(_0x126a1b,_0x5dc271))['catch'](handleError(_0x126a1b,null));};exports[_0xeebc('0x40')]=function(_0x3a8145,_0x3d3e91){var _0x5dc13a={'raw':!![],'where':{'id':_0x3a8145[_0xeebc('0x41')]['id']}},_0x356ad8={};_0x356ad8[_0xeebc('0x2a')]=_[_0xeebc('0x42')](db[_0xeebc('0x3b')]['rawAttributes']);_0x356ad8[_0xeebc('0x2b')]=_[_0xeebc('0x42')](_0x3a8145[_0xeebc('0x2b')]);_0x356ad8[_0xeebc('0x36')]=_['intersection'](_0x356ad8[_0xeebc('0x2a')],_0x356ad8[_0xeebc('0x2b')]);_0x5dc13a[_0xeebc('0x2e')]=_[_0xeebc('0x2c')](_0x356ad8[_0xeebc('0x2a')],qs[_0xeebc('0x2d')](_0x3a8145[_0xeebc('0x2b')]['fields']));_0x5dc13a[_0xeebc('0x2e')]=_0x5dc13a['attributes']['length']?_0x5dc13a[_0xeebc('0x2e')]:_0x356ad8[_0xeebc('0x2a')];if(_0x3a8145[_0xeebc('0x2b')]['includeAll']){_0x5dc13a[_0xeebc('0x43')]=[{'all':!![]}];}_0x5dc13a=_[_0xeebc('0x38')]({},_0x5dc13a,_0x3a8145[_0xeebc('0x3a')]);return db[_0xeebc('0x3b')]['find'](_0x5dc13a)[_0xeebc('0x1f')](handleEntityNotFound(_0x3d3e91,null))[_0xeebc('0x1f')](respondWithResult(_0x3d3e91,null))[_0xeebc('0x44')](handleError(_0x3d3e91,null));};exports[_0xeebc('0x45')]=function(_0x47a597,_0x4103a8){return db[_0xeebc('0x3b')][_0xeebc('0x45')](_0x47a597[_0xeebc('0x46')],{})['then'](respondWithResult(_0x4103a8,0xc9))[_0xeebc('0x44')](handleError(_0x4103a8,null));};exports['update']=function(_0x487b3e,_0x43dcde){if(_0x487b3e[_0xeebc('0x46')]['id']){delete _0x487b3e['body']['id'];}return db[_0xeebc('0x3b')][_0xeebc('0x47')]({'where':{'id':_0x487b3e[_0xeebc('0x41')]['id']}})[_0xeebc('0x1f')](handleEntityNotFound(_0x43dcde,null))[_0xeebc('0x1f')](saveUpdates(_0x487b3e[_0xeebc('0x46')],null))[_0xeebc('0x1f')](respondWithResult(_0x43dcde,null))[_0xeebc('0x44')](handleError(_0x43dcde,null));};exports[_0xeebc('0x20')]=function(_0x38de65,_0x4dedde){return db[_0xeebc('0x3b')][_0xeebc('0x47')]({'where':{'id':_0x38de65[_0xeebc('0x41')]['id']}})[_0xeebc('0x1f')](handleEntityNotFound(_0x4dedde,null))[_0xeebc('0x1f')](removeEntity(_0x4dedde,null))['catch'](handleError(_0x4dedde,null));};exports[_0xeebc('0x48')]=function(_0x485ef0,_0x163f5a,_0x80fc9a){return db['VoiceMailMessage'][_0xeebc('0x47')]({'where':{'id':_0x485ef0[_0xeebc('0x41')]['id']},'attributes':['id',_0xeebc('0x49'),_0xeebc('0x4a')]})[_0xeebc('0x1f')](handleEntityNotFound(_0x163f5a,null))['then'](function(_0x1a519c){if(_0x1a519c){if(!_0x1a519c[_0xeebc('0x49')]){throw new db[(_0xeebc('0x4b'))][(_0xeebc('0x4c'))]('VoiceMailMessage\x20not\x20found');}var _0x21cbb9={'Content-Type':_0xeebc('0x4d'),'Content-Disposition':_0xeebc('0x4e')};if(_0x1a519c['msg_id']){_0x21cbb9[_0xeebc('0x4f')]='attachment;\x20filename=\x22'+_0x1a519c[_0xeebc('0x4a')]+_0xeebc('0x50');}_0x163f5a[_0xeebc('0x1a')](_0x21cbb9);return _0x163f5a['send'](new Buffer(_0x1a519c[_0xeebc('0x49')]));}})[_0xeebc('0x44')](handleError(_0x163f5a,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 794fa17..ee84497 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 _0x4bbe=['dir','lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0x2e98a4,_0x1beee2){var _0x1e31d9=function(_0x3d4605){while(--_0x3d4605){_0x2e98a4['push'](_0x2e98a4['shift']());}};_0x1e31d9(++_0x1beee2);}(_0x4bbe,0xe5));var _0xe4bb=function(_0x1a6c24,_0xe10515){_0x1a6c24=_0x1a6c24-0x0;var _0x40a9fd=_0x4bbe[_0x1a6c24];return _0x40a9fd;};'use strict';var _=require(_0xe4bb('0x0'));var util=require('util');var logger=require(_0xe4bb('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe4bb('0x2'));var rp=require(_0xe4bb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4bb('0x4'));var config=require(_0xe4bb('0x5'));var attributes=require(_0xe4bb('0x6'));module[_0xe4bb('0x7')]=function(_0x4d3719,_0x448891){return _0x4d3719[_0xe4bb('0x8')](_0xe4bb('0x9'),attributes,{'tableName':_0xe4bb('0xa'),'paranoid':![],'indexes':[{'name':_0xe4bb('0xb'),'fields':[_0xe4bb('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xab0d=['../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x226b19,_0x4bdfb8){var _0x6bfc30=function(_0x40b6a4){while(--_0x40b6a4){_0x226b19['push'](_0x226b19['shift']());}};_0x6bfc30(++_0x4bdfb8);}(_0xab0d,0x102));var _0xdab0=function(_0x15f104,_0x5293de){_0x15f104=_0x15f104-0x0;var _0x2aea1f=_0xab0d[_0x15f104];return _0x2aea1f;};'use strict';var _=require('lodash');var util=require(_0xdab0('0x0'));var logger=require(_0xdab0('0x1'))(_0xdab0('0x2'));var moment=require(_0xdab0('0x3'));var BPromise=require(_0xdab0('0x4'));var rp=require(_0xdab0('0x5'));var fs=require('fs');var path=require(_0xdab0('0x6'));var rimraf=require(_0xdab0('0x7'));var config=require(_0xdab0('0x8'));var attributes=require(_0xdab0('0x9'));module[_0xdab0('0xa')]=function(_0x38fea6,_0x213d0f){return _0x38fea6[_0xdab0('0xb')](_0xdab0('0xc'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0xdab0('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 057a58a..7827e0e 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 _0xd9d9=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5c33d4,_0x1f8d84){var _0x4e407f=function(_0x47d6af){while(--_0x47d6af){_0x5c33d4['push'](_0x5c33d4['shift']());}};_0x4e407f(++_0x1f8d84);}(_0xd9d9,0x1de));var _0x9d9d=function(_0x3f56cf,_0x3882f7){_0x3f56cf=_0x3f56cf-0x0;var _0x3cd779=_0xd9d9[_0x3f56cf];return _0x3cd779;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9d9d('0x0'));var BPromise=require(_0x9d9d('0x1'));var rs=require(_0x9d9d('0x2'));var fs=require('fs');var Redis=require(_0x9d9d('0x3'));var db=require(_0x9d9d('0x4'))['db'];var utils=require(_0x9d9d('0x5'));var logger=require('../../config/logger')(_0x9d9d('0x6'));var config=require(_0x9d9d('0x7'));var jayson=require(_0x9d9d('0x8'));var client=jayson['client'][_0x9d9d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25682f,_0x5cd93b,_0x5a92b3){return new BPromise(function(_0x30831c,_0x1c1449){return client[_0x9d9d('0xa')](_0x25682f,_0x5a92b3)[_0x9d9d('0xb')](function(_0x482b85){logger[_0x9d9d('0xc')](_0x9d9d('0xd'),_0x5cd93b,_0x9d9d('0xe'));logger[_0x9d9d('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x5cd93b,_0x9d9d('0xe'),JSON[_0x9d9d('0x10')](_0x482b85));if(_0x482b85[_0x9d9d('0x11')]){if(_0x482b85[_0x9d9d('0x11')]['code']===0x1f4){logger[_0x9d9d('0x11')](_0x9d9d('0xd'),_0x5cd93b,_0x482b85[_0x9d9d('0x11')][_0x9d9d('0x12')]);return _0x1c1449(_0x482b85['error'][_0x9d9d('0x12')]);}logger[_0x9d9d('0x11')](_0x9d9d('0xd'),_0x5cd93b,_0x482b85[_0x9d9d('0x11')][_0x9d9d('0x12')]);return _0x30831c(_0x482b85['error'][_0x9d9d('0x12')]);}else{logger[_0x9d9d('0xc')](_0x9d9d('0xd'),_0x5cd93b,_0x9d9d('0xe'));_0x30831c(_0x482b85[_0x9d9d('0x13')][_0x9d9d('0x12')]);}})[_0x9d9d('0x14')](function(_0x132ac0){logger[_0x9d9d('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x5cd93b,_0x132ac0);_0x1c1449(_0x132ac0);});});} \ No newline at end of file +var _0x9bc5=['info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then'];(function(_0xe75f9a,_0x429af9){var _0x534d1f=function(_0x3eefc0){while(--_0x3eefc0){_0xe75f9a['push'](_0xe75f9a['shift']());}};_0x534d1f(++_0x429af9);}(_0x9bc5,0x17b));var _0x59bc=function(_0x42c06b,_0x597a58){_0x42c06b=_0x42c06b-0x0;var _0x162a27=_0x9bc5[_0x42c06b];return _0x162a27;};'use strict';var _=require(_0x59bc('0x0'));var util=require(_0x59bc('0x1'));var moment=require(_0x59bc('0x2'));var BPromise=require(_0x59bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59bc('0x4'))['db'];var utils=require(_0x59bc('0x5'));var logger=require(_0x59bc('0x6'))('rpc');var config=require(_0x59bc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x59bc('0x8')][_0x59bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x467514,_0x148abf,_0x338789){return new BPromise(function(_0x3fc282,_0x4e2092){return client[_0x59bc('0xa')](_0x467514,_0x338789)[_0x59bc('0xb')](function(_0x3cf74c){logger[_0x59bc('0xc')](_0x59bc('0xd'),_0x148abf,'request\x20sent');logger[_0x59bc('0xe')](_0x59bc('0xf'),_0x148abf,'request\x20sent',JSON[_0x59bc('0x10')](_0x3cf74c));if(_0x3cf74c[_0x59bc('0x11')]){if(_0x3cf74c[_0x59bc('0x11')][_0x59bc('0x12')]===0x1f4){logger[_0x59bc('0x11')](_0x59bc('0xd'),_0x148abf,_0x3cf74c[_0x59bc('0x11')][_0x59bc('0x13')]);return _0x4e2092(_0x3cf74c['error'][_0x59bc('0x13')]);}logger[_0x59bc('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x148abf,_0x3cf74c[_0x59bc('0x11')][_0x59bc('0x13')]);return _0x3fc282(_0x3cf74c[_0x59bc('0x11')]['message']);}else{logger[_0x59bc('0xc')](_0x59bc('0xd'),_0x148abf,_0x59bc('0x14'));_0x3fc282(_0x3cf74c[_0x59bc('0x15')][_0x59bc('0x13')]);}})[_0x59bc('0x16')](function(_0x12a1f4){logger[_0x59bc('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x148abf,_0x12a1f4);_0x4e2092(_0x12a1f4);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index f9239d4..c951cc2 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 _0x78c8=['/:id/sounds','addSound','put','update','destroy','delete','/:id/sounds/:id2','multer','util','path','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getSounds','post','create'];(function(_0x5c2e7e,_0x35ad6b){var _0x83db0=function(_0x278d53){while(--_0x278d53){_0x5c2e7e['push'](_0x5c2e7e['shift']());}};_0x83db0(++_0x35ad6b);}(_0x78c8,0x1ab));var _0x878c=function(_0x1c9a98,_0x39f1c4){_0x1c9a98=_0x1c9a98-0x0;var _0x5e9786=_0x78c8[_0x1c9a98];return _0x5e9786;};'use strict';var multer=require(_0x878c('0x0'));var util=require(_0x878c('0x1'));var path=require(_0x878c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x878c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x878c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x878c('0x5'));var controller=require('./voiceMusicOnHold.controller');router[_0x878c('0x6')]('/',auth[_0x878c('0x7')](),controller[_0x878c('0x8')]);router[_0x878c('0x6')](_0x878c('0x9'),auth[_0x878c('0x7')](),controller[_0x878c('0xa')]);router[_0x878c('0x6')]('/:id/sounds',auth['isAuthenticated'](),controller[_0x878c('0xb')]);router[_0x878c('0xc')]('/',auth[_0x878c('0x7')](),controller[_0x878c('0xd')]);router[_0x878c('0xc')](_0x878c('0xe'),auth['isAuthenticated'](),controller[_0x878c('0xf')]);router[_0x878c('0x10')](_0x878c('0x9'),auth[_0x878c('0x7')](),controller[_0x878c('0x11')]);router['delete'](_0x878c('0x9'),auth[_0x878c('0x7')](),controller[_0x878c('0x12')]);router[_0x878c('0x13')](_0x878c('0x14'),auth[_0x878c('0x7')](),controller['removeSound']);module['exports']=router; \ No newline at end of file +var _0x6986=['destroy','/:id/sounds/:id2','removeSound','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','/:id'];(function(_0x12e032,_0x51fbb1){var _0x4abbd5=function(_0x3af43f){while(--_0x3af43f){_0x12e032['push'](_0x12e032['shift']());}};_0x4abbd5(++_0x51fbb1);}(_0x6986,0x1a2));var _0x6698=function(_0x19e928,_0x26a0e4){_0x19e928=_0x19e928-0x0;var _0x4e941f=_0x6986[_0x19e928];return _0x4e941f;};'use strict';var multer=require(_0x6698('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6698('0x1'));var express=require(_0x6698('0x2'));var router=express['Router']();var fs_extra=require(_0x6698('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6698('0x4'));var config=require('../../config/environment');var controller=require(_0x6698('0x5'));router[_0x6698('0x6')]('/',auth[_0x6698('0x7')](),controller[_0x6698('0x8')]);router['get']('/:id',auth[_0x6698('0x7')](),controller[_0x6698('0x9')]);router[_0x6698('0x6')](_0x6698('0xa'),auth['isAuthenticated'](),controller[_0x6698('0xb')]);router[_0x6698('0xc')]('/',auth[_0x6698('0x7')](),controller[_0x6698('0xd')]);router[_0x6698('0xc')](_0x6698('0xa'),auth[_0x6698('0x7')](),controller[_0x6698('0xe')]);router[_0x6698('0xf')]('/:id',auth[_0x6698('0x7')](),controller[_0x6698('0x10')]);router[_0x6698('0x11')](_0x6698('0x12'),auth['isAuthenticated'](),controller[_0x6698('0x13')]);router[_0x6698('0x11')](_0x6698('0x14'),auth[_0x6698('0x7')](),controller[_0x6698('0x15')]);module[_0x6698('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index e072c7d..706a15b 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 _0x96fe=['ENUM','files','mp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','name'];(function(_0x5b54c1,_0x51aba9){var _0x592f7d=function(_0x43eb8d){while(--_0x43eb8d){_0x5b54c1['push'](_0x5b54c1['shift']());}};_0x592f7d(++_0x51aba9);}(_0x96fe,0x127));var _0xe96f=function(_0x3b698d,_0xf2146e){_0x3b698d=_0x3b698d-0x0;var _0x2bd341=_0x96fe[_0x3b698d];return _0x2bd341;};'use strict';var Sequelize=require(_0xe96f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe96f('0x1')},'mode':{'type':Sequelize[_0xe96f('0x2')]('custom',_0xe96f('0x3'),_0xe96f('0x4'),'quietmp3nb',_0xe96f('0x5'),_0xe96f('0x6')),'allowNull':!![],'defaultValue':_0xe96f('0x3')},'directory':{'type':Sequelize[_0xe96f('0x7')],'allowNull':!![]},'application':{'type':Sequelize[_0xe96f('0x7')],'allowNull':!![]},'digit':{'type':Sequelize[_0xe96f('0x7')],'allowNull':!![]},'sort':{'type':Sequelize[_0xe96f('0x7')],'allowNull':!![],'defaultValue':_0xe96f('0x8')},'format':{'type':Sequelize[_0xe96f('0x7')],'allowNull':!![]},'stamp':{'type':_0xe96f('0x9')},'defaultEntry':{'type':Sequelize[_0xe96f('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa2bc=['name','custom','files','quietmp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2bc,0xe2));var _0xca2b=function(_0x4cef94,_0x3db7e2){_0x4cef94=_0x4cef94-0x0;var _0x5ecb8a=_0xa2bc[_0x4cef94];return _0x5ecb8a;};'use strict';var Sequelize=require(_0xca2b('0x0'));module[_0xca2b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xca2b('0x2')},'mode':{'type':Sequelize['ENUM'](_0xca2b('0x3'),_0xca2b('0x4'),'mp3nb',_0xca2b('0x5'),_0xca2b('0x6'),_0xca2b('0x7')),'allowNull':!![],'defaultValue':_0xca2b('0x4')},'directory':{'type':Sequelize[_0xca2b('0x8')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xca2b('0x8')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xca2b('0x9')},'format':{'type':Sequelize[_0xca2b('0x8')],'allowNull':!![]},'stamp':{'type':_0xca2b('0xa')},'defaultEntry':{'type':Sequelize[_0xca2b('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 77dc711..c75ea48 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 _0xe188=['set','Content-Range','reject','save','update','then','destroy','get','MusicOnHolds','sendStatus','error','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','body','find','sequelize','transaction','mode','files','directory','join','root','server/files/moh','create','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','readdirSync','forEach','unlinkSync','ValidationError','message','addSound','Sound','save_name','createdAt','server/files/sounds/converted','format','basename','extname','%s.%s','symlinkSync','Sequelize','removeSound','findOne','id2','converted_format','getSounds','nolimit','rimraf','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x41ba82,_0x2c9ab0){var _0x5c9789=function(_0x41ba51){while(--_0x41ba51){_0x41ba82['push'](_0x41ba82['shift']());}};_0x5c9789(++_0x2c9ab0);}(_0xe188,0xb7));var _0x8e18=function(_0x243625,_0x193a87){_0x243625=_0x243625-0x0;var _0x3fa2f2=_0xe188[_0x243625];return _0x3fa2f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8e18('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8e18('0x1'));var util=require(_0x8e18('0x2'));var path=require(_0x8e18('0x3'));var sox=require(_0x8e18('0x4'));var csv=require(_0x8e18('0x5'));var ejs=require(_0x8e18('0x6'));var fs=require('fs');var fs_extra=require(_0x8e18('0x7'));var _=require(_0x8e18('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8e18('0x9'));var deskjs=require(_0x8e18('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8e18('0xb'));var Redis=require(_0x8e18('0xc'));var authService=require(_0x8e18('0xd'));var qs=require(_0x8e18('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e18('0xf'));var logger=require('../../config/logger')(_0x8e18('0x10'));var utils=require(_0x8e18('0x11'));var config=require(_0x8e18('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x8e18('0x13'))['db'];function respondWithStatusCode(_0x4c0dad,_0x3c50fb){_0x3c50fb=_0x3c50fb||0xcc;return function(_0x27c682){if(_0x27c682){return _0x4c0dad['sendStatus'](_0x3c50fb);}return _0x4c0dad[_0x8e18('0x14')](_0x3c50fb)[_0x8e18('0x15')]();};}function respondWithResult(_0x10385d,_0x216cf4){_0x216cf4=_0x216cf4||0xc8;return function(_0x323f61){if(_0x323f61){return _0x10385d[_0x8e18('0x14')](_0x216cf4)[_0x8e18('0x16')](_0x323f61);}};}function respondWithFilteredResult(_0x48786c,_0x13b687){return function(_0x33d3ad){if(_0x33d3ad){var _0x44a9a8=typeof _0x13b687[_0x8e18('0x17')]===_0x8e18('0x18')&&typeof _0x13b687[_0x8e18('0x19')]===_0x8e18('0x18');var _0x316bf6=_0x33d3ad[_0x8e18('0x1a')];var _0x2eed99=_0x44a9a8?0x0:_0x13b687[_0x8e18('0x17')];var _0x1b507d=_0x44a9a8?_0x33d3ad['count']:_0x13b687['offset']+_0x13b687['limit'];var _0x16a155;if(_0x1b507d>=_0x316bf6){_0x1b507d=_0x316bf6;_0x16a155=0xc8;}else{_0x16a155=0xce;}_0x48786c[_0x8e18('0x14')](_0x16a155);return _0x48786c[_0x8e18('0x1b')](_0x8e18('0x1c'),_0x2eed99+'-'+_0x1b507d+'/'+_0x316bf6)[_0x8e18('0x16')](_0x33d3ad);}return null;};}function patchUpdates(_0x594194){return function(_0x31ebeb){try{jsonpatch['apply'](_0x31ebeb,_0x594194,!![]);}catch(_0x5606a8){return BPromise[_0x8e18('0x1d')](_0x5606a8);}return _0x31ebeb[_0x8e18('0x1e')]();};}function saveUpdates(_0x4b2a35,_0x3cb8f6){return function(_0x20c4f8){if(_0x20c4f8){return _0x20c4f8[_0x8e18('0x1f')](_0x4b2a35)[_0x8e18('0x20')](function(_0x5d5187){return _0x5d5187;});}return null;};}function removeEntity(_0x1bbc9e,_0x27c6f6){return function(_0x5b2d92){if(_0x5b2d92){return _0x5b2d92[_0x8e18('0x21')]()[_0x8e18('0x20')](function(){var _0xe6f88e=_0x5b2d92[_0x8e18('0x22')]({'plain':!![]});var _0x2292e6=_0x8e18('0x23');return db['UserProfileResource'][_0x8e18('0x21')]({'where':{'type':_0x2292e6,'resourceId':_0xe6f88e['id']}})['then'](function(){return _0x5b2d92;});})['then'](function(){_0x1bbc9e[_0x8e18('0x14')](0xcc)[_0x8e18('0x15')]();});}};}function handleEntityNotFound(_0x128394,_0x222dbf){return function(_0x428f54){if(!_0x428f54){_0x128394[_0x8e18('0x24')](0x194);}return _0x428f54;};}function handleError(_0x287770,_0xcc1cc1){_0xcc1cc1=_0xcc1cc1||0x1f4;return function(_0x42d66d){logger[_0x8e18('0x25')](_0x42d66d['stack']);if(_0x42d66d[_0x8e18('0x26')]){delete _0x42d66d['name'];}_0x287770['status'](_0xcc1cc1)['send'](_0x42d66d);};}exports[_0x8e18('0x27')]=function(_0x33428e,_0x3a30b7){var _0x5c23cc={},_0x51bc33={},_0x34dff4={'count':0x0,'rows':[]};var _0x5e5063=_[_0x8e18('0x28')](db[_0x8e18('0x29')][_0x8e18('0x2a')],function(_0x4add4f){return{'name':_0x4add4f[_0x8e18('0x2b')],'type':_0x4add4f[_0x8e18('0x2c')]['key']};});_0x51bc33[_0x8e18('0x2d')]=_['map'](_0x5e5063,_0x8e18('0x26'));_0x51bc33[_0x8e18('0x2e')]=_[_0x8e18('0x2f')](_0x33428e[_0x8e18('0x2e')]);_0x51bc33['filters']=_[_0x8e18('0x30')](_0x51bc33[_0x8e18('0x2d')],_0x51bc33[_0x8e18('0x2e')]);_0x5c23cc[_0x8e18('0x31')]=_[_0x8e18('0x30')](_0x51bc33[_0x8e18('0x2d')],qs[_0x8e18('0x32')](_0x33428e[_0x8e18('0x2e')][_0x8e18('0x32')]));_0x5c23cc[_0x8e18('0x31')]=_0x5c23cc['attributes'][_0x8e18('0x33')]?_0x5c23cc['attributes']:_0x51bc33['model'];if(!_0x33428e[_0x8e18('0x2e')][_0x8e18('0x34')]('nolimit')){_0x5c23cc[_0x8e18('0x19')]=qs[_0x8e18('0x19')](_0x33428e[_0x8e18('0x2e')][_0x8e18('0x19')]);_0x5c23cc[_0x8e18('0x17')]=qs[_0x8e18('0x17')](_0x33428e[_0x8e18('0x2e')][_0x8e18('0x17')]);}_0x5c23cc[_0x8e18('0x35')]=qs[_0x8e18('0x36')](_0x33428e[_0x8e18('0x2e')][_0x8e18('0x36')]);delete _0x33428e[_0x8e18('0x2e')][_0x8e18('0x36')];_0x5c23cc[_0x8e18('0x37')]=qs['filters'](_['pick'](_0x33428e[_0x8e18('0x2e')],_0x51bc33[_0x8e18('0x38')]),_0x5e5063);if(_0x33428e[_0x8e18('0x2e')][_0x8e18('0x39')]){_0x5c23cc[_0x8e18('0x37')]=_[_0x8e18('0x3a')](_0x5c23cc[_0x8e18('0x37')],{'$or':_['map'](_0x5e5063,function(_0x9aae95){if(_0x9aae95[_0x8e18('0x2c')]!==_0x8e18('0x3b')){var _0x44715c={};_0x44715c[_0x9aae95[_0x8e18('0x26')]]={'$like':'%'+_0x33428e['query'][_0x8e18('0x39')]+'%'};return _0x44715c;}})});}_0x5c23cc=_[_0x8e18('0x3a')]({},_0x5c23cc,_0x33428e[_0x8e18('0x3c')]);var _0x42b61f={'where':_0x5c23cc[_0x8e18('0x37')]};return db[_0x8e18('0x29')][_0x8e18('0x1a')](_0x42b61f)['then'](function(_0x2d8f2b){_0x34dff4[_0x8e18('0x1a')]=_0x2d8f2b;if(_0x33428e[_0x8e18('0x2e')][_0x8e18('0x3d')]){_0x5c23cc[_0x8e18('0x3e')]=[{'all':!![]}];}return db[_0x8e18('0x29')][_0x8e18('0x3f')](_0x5c23cc);})[_0x8e18('0x20')](function(_0x3e31fa){_0x34dff4['rows']=_0x3e31fa;return _0x34dff4;})['then'](respondWithFilteredResult(_0x3a30b7,_0x5c23cc))[_0x8e18('0x40')](handleError(_0x3a30b7,null));};exports[_0x8e18('0x41')]=function(_0x15a35e,_0x5c1a55){var _0x268e8d={'raw':![],'where':{'id':_0x15a35e[_0x8e18('0x42')]['id']}},_0xf84858={};_0xf84858[_0x8e18('0x2d')]=_['keys'](db[_0x8e18('0x29')]['rawAttributes']);_0xf84858['query']=_[_0x8e18('0x2f')](_0x15a35e[_0x8e18('0x2e')]);_0xf84858['filters']=_[_0x8e18('0x30')](_0xf84858['model'],_0xf84858[_0x8e18('0x2e')]);_0x268e8d[_0x8e18('0x31')]=_['intersection'](_0xf84858[_0x8e18('0x2d')],qs[_0x8e18('0x32')](_0x15a35e['query']['fields']));_0x268e8d['attributes']=_0x268e8d[_0x8e18('0x31')]['length']?_0x268e8d[_0x8e18('0x31')]:_0xf84858[_0x8e18('0x2d')];if(_0x15a35e[_0x8e18('0x2e')][_0x8e18('0x3d')]){_0x268e8d['include']=[{'all':!![]}];}_0x268e8d=_[_0x8e18('0x3a')]({},_0x268e8d,_0x15a35e['options']);return db['VoiceMusicOnHold']['find'](_0x268e8d)[_0x8e18('0x20')](handleEntityNotFound(_0x5c1a55,null))[_0x8e18('0x20')](respondWithResult(_0x5c1a55,null))['catch'](handleError(_0x5c1a55,null));};exports['update']=function(_0x12800a,_0x3f4aa6){if(_0x12800a[_0x8e18('0x43')]['id']){delete _0x12800a[_0x8e18('0x43')]['id'];}return db[_0x8e18('0x29')][_0x8e18('0x44')]({'where':{'id':_0x12800a[_0x8e18('0x42')]['id']}})[_0x8e18('0x20')](handleEntityNotFound(_0x3f4aa6,null))['then'](saveUpdates(_0x12800a['body'],null))[_0x8e18('0x20')](respondWithResult(_0x3f4aa6,null))[_0x8e18('0x40')](handleError(_0x3f4aa6,null));};exports['create']=function(_0x886495,_0x1f04dd,_0x1703bf){return db[_0x8e18('0x45')][_0x8e18('0x46')](function(_0x3b9637){if(_0x886495[_0x8e18('0x43')][_0x8e18('0x47')]===_0x8e18('0x48')){_0x886495[_0x8e18('0x43')][_0x8e18('0x49')]=path[_0x8e18('0x4a')](config[_0x8e18('0x4b')],_0x8e18('0x4c'),_0x886495[_0x8e18('0x43')][_0x8e18('0x26')]);}return db[_0x8e18('0x29')][_0x8e18('0x4d')](_0x886495[_0x8e18('0x43')],{'transaction':_0x3b9637})[_0x8e18('0x20')](function(_0x37166e){if(_0x886495[_0x8e18('0x43')][_0x8e18('0x47')]==='files'){fs['mkdirSync'](_0x37166e[_0x8e18('0x49')],parseInt(_0x8e18('0x4e'),0x8));}var _0x2f7cea=_0x886495['user'][_0x8e18('0x22')]({'plain':!![]});if(!_0x2f7cea)throw new Error(_0x8e18('0x4f'));if(_0x2f7cea[_0x8e18('0x50')]==='user'){var _0x140e42=_0x37166e['get']({'plain':!![]});return db['UserProfileSection'][_0x8e18('0x44')]({'where':{'name':_0x8e18('0x23'),'userProfileId':_0x2f7cea['userProfileId']},'raw':!![]})[_0x8e18('0x20')](function(_0x2f64fe){if(_0x2f64fe&&_0x2f64fe[_0x8e18('0x51')]===0x0){return db[_0x8e18('0x52')][_0x8e18('0x4d')]({'name':_0x140e42[_0x8e18('0x26')],'resourceId':_0x140e42['id'],'type':_0x2f64fe[_0x8e18('0x26')],'sectionId':_0x2f64fe['id']},{})[_0x8e18('0x20')](function(){return _0x37166e;});}else{return _0x37166e;}})[_0x8e18('0x40')](function(_0x52b65d){logger[_0x8e18('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52b65d);});}return _0x37166e;});})[_0x8e18('0x20')](respondWithResult(_0x1f04dd,0xc9))['catch'](handleError(_0x1f04dd,null));};exports[_0x8e18('0x21')]=function(_0x1eb61e,_0x59846d,_0xd0e13b){var _0x28b836;return db['VoiceMusicOnHold'][_0x8e18('0x44')]({'where':{'id':_0x1eb61e[_0x8e18('0x42')]['id']}})[_0x8e18('0x20')](function(_0x33cbce){if(_0x33cbce){return db[_0x8e18('0x45')]['transaction'](function(_0x4f481e){return _0x33cbce['destroy']({'transaction':_0x4f481e,'raw':!![]})[_0x8e18('0x20')](function(_0x1e2516){if(_0x1e2516[_0x8e18('0x49')]){fs[_0x8e18('0x53')](_0x1e2516[_0x8e18('0x49')])[_0x8e18('0x54')](function(_0x27399c){fs[_0x8e18('0x55')](path[_0x8e18('0x4a')](_0x1e2516[_0x8e18('0x49')],_0x27399c));});fs['rmdirSync'](_0x1e2516[_0x8e18('0x49')]);}return _0x1e2516;});})[_0x8e18('0x40')](function(_0x121500){throw new db['Sequelize'][(_0x8e18('0x56'))](_0x121500[_0x8e18('0x57')]);});}})[_0x8e18('0x20')](handleEntityNotFound(_0x59846d,null))[_0x8e18('0x20')](removeEntity(_0x59846d,null))[_0x8e18('0x40')](handleError(_0x59846d,null));};exports[_0x8e18('0x58')]=function(_0xee8150,_0x4eb5c6,_0x5afc1e){return db[_0x8e18('0x45')][_0x8e18('0x46')](function(_0x39b71e){var _0x354711;return db[_0x8e18('0x29')]['find']({'where':{'id':_0xee8150[_0x8e18('0x42')]['id']}})[_0x8e18('0x20')](function(_0x3b80f7){if(_0x3b80f7){_0x354711=_0x3b80f7;return _0x3b80f7['addSound'](_0xee8150[_0x8e18('0x43')]['id'],{'transaction':_0x39b71e});}})[_0x8e18('0x20')](function(_0x47d669){if(_0x47d669){return db[_0x8e18('0x59')]['findOne']({'where':{'id':_0xee8150[_0x8e18('0x43')]['id']},'attributes':['id',_0x8e18('0x26'),_0x8e18('0x5a'),'converted_format',_0x8e18('0x5b')],'raw':!![]});}})[_0x8e18('0x20')](function(_0x1935b4){if(_0x1935b4){var _0xee5e12=path['join'](config[_0x8e18('0x4b')],_0x8e18('0x5c'),util[_0x8e18('0x5d')]('%s.%s',path[_0x8e18('0x5e')](_0x1935b4['save_name'],path[_0x8e18('0x5f')](_0x1935b4[_0x8e18('0x5a')])),_0x1935b4['converted_format']));var _0x531a82=path[_0x8e18('0x4a')](config['root'],'server/files/moh',_0x354711[_0x8e18('0x26')],util[_0x8e18('0x5d')](_0x8e18('0x60'),_0x1935b4['name'],_0x1935b4['converted_format']));fs[_0x8e18('0x61')](_0xee5e12,_0x531a82);return _0x1935b4;}})[_0x8e18('0x40')](function(_0x13ccb4){throw new db[(_0x8e18('0x62'))][(_0x8e18('0x56'))](_0x13ccb4[_0x8e18('0x57')]);});})[_0x8e18('0x20')](handleEntityNotFound(_0x4eb5c6,null))[_0x8e18('0x20')](respondWithResult(_0x4eb5c6,0xc9))[_0x8e18('0x40')](handleError(_0x4eb5c6,null));};exports[_0x8e18('0x63')]=function(_0xa72ec9,_0x503299,_0x2bb080){return db[_0x8e18('0x45')][_0x8e18('0x46')](function(_0x3be73b){var _0x1ead91;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0xa72ec9[_0x8e18('0x42')]['id']}})['then'](handleEntityNotFound(_0x503299,null))[_0x8e18('0x20')](function(_0x1c6fdd){if(_0x1c6fdd){_0x1ead91=_0x1c6fdd;return _0x1c6fdd[_0x8e18('0x63')](_0xa72ec9[_0x8e18('0x42')]['id2']);}})['then'](function(_0xfcccb2){if(_0xfcccb2){return db[_0x8e18('0x59')][_0x8e18('0x64')]({'where':{'id':_0xa72ec9[_0x8e18('0x42')][_0x8e18('0x65')]},'attributes':['id','name',_0x8e18('0x5a'),_0x8e18('0x66'),_0x8e18('0x5b')],'raw':!![]});}})[_0x8e18('0x20')](function(_0x26f75b){if(_0x26f75b){fs[_0x8e18('0x55')](path[_0x8e18('0x4a')](_0x1ead91['directory'],util[_0x8e18('0x5d')](_0x8e18('0x60'),_0x26f75b[_0x8e18('0x26')],_0x26f75b[_0x8e18('0x66')])));return _0x26f75b;}})['catch'](function(_0x1207af){throw new db[(_0x8e18('0x62'))][(_0x8e18('0x56'))](_0x1207af[_0x8e18('0x57')]);});})[_0x8e18('0x20')](handleEntityNotFound(_0x503299,null))[_0x8e18('0x20')](respondWithStatusCode(_0x503299,0xcc))['catch'](handleError(_0x503299,null));};exports[_0x8e18('0x67')]=function(_0x422af9,_0x2e1dce,_0xb5a04a){var _0xbb7998={};var _0x1626ac={};var _0xbae89c;var _0x181d90;return db[_0x8e18('0x29')][_0x8e18('0x64')]({'where':{'id':_0x422af9['params']['id']}})['then'](handleEntityNotFound(_0x2e1dce,null))['then'](function(_0x5f24f1){if(_0x5f24f1){_0xbae89c=_0x5f24f1;_0x1626ac[_0x8e18('0x2d')]=_[_0x8e18('0x2f')](db[_0x8e18('0x59')][_0x8e18('0x2a')]);_0x1626ac[_0x8e18('0x2e')]=_[_0x8e18('0x2f')](_0x422af9[_0x8e18('0x2e')]);_0x1626ac[_0x8e18('0x38')]=_['intersection'](_0x1626ac[_0x8e18('0x2d')],_0x1626ac[_0x8e18('0x2e')]);_0xbb7998['attributes']=_[_0x8e18('0x30')](_0x1626ac[_0x8e18('0x2d')],qs[_0x8e18('0x32')](_0x422af9['query'][_0x8e18('0x32')]));_0xbb7998['attributes']=_0xbb7998[_0x8e18('0x31')][_0x8e18('0x33')]?_0xbb7998['attributes']:_0x1626ac['model'];_0xbb7998[_0x8e18('0x35')]=qs[_0x8e18('0x36')](_0x422af9[_0x8e18('0x2e')]['sort']);_0xbb7998['where']=qs['filters'](_['pick'](_0x422af9[_0x8e18('0x2e')],_0x1626ac[_0x8e18('0x38')]));if(_0x422af9[_0x8e18('0x2e')][_0x8e18('0x39')]){_0xbb7998[_0x8e18('0x37')]=_['merge'](_0xbb7998['where'],{'$or':_[_0x8e18('0x28')](_0xbb7998[_0x8e18('0x31')],function(_0x1435ca){var _0x908314={};_0x908314[_0x1435ca]={'$like':'%'+_0x422af9[_0x8e18('0x2e')][_0x8e18('0x39')]+'%'};return _0x908314;})});}_0xbb7998=_[_0x8e18('0x3a')]({},_0xbb7998,_0x422af9[_0x8e18('0x3c')]);return _0xbae89c['getSounds'](_0xbb7998);}})[_0x8e18('0x20')](function(_0x458373){if(_0x458373){_0x181d90=_0x458373[_0x8e18('0x33')];if(!_0x422af9[_0x8e18('0x2e')][_0x8e18('0x34')](_0x8e18('0x68'))){_0xbb7998[_0x8e18('0x19')]=qs['limit'](_0x422af9[_0x8e18('0x2e')]['limit']);_0xbb7998[_0x8e18('0x17')]=qs[_0x8e18('0x17')](_0x422af9[_0x8e18('0x2e')][_0x8e18('0x17')]);}return _0xbae89c[_0x8e18('0x67')](_0xbb7998);}})[_0x8e18('0x20')](function(_0x329372){if(_0x329372){return _0x329372?{'count':_0x181d90,'rows':_0x329372}:null;}})[_0x8e18('0x20')](respondWithResult(_0x2e1dce,null))[_0x8e18('0x40')](handleError(_0x2e1dce,null));}; \ No newline at end of file +var _0xb436=['intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','count','includeAll','include','findAll','rows','catch','show','body','find','params','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','create','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','sequelize','transaction','save_name','createdAt','server/files/sounds/converted','%s.%s','basename','format','converted_format','symlinkSync','removeSound','findOne','id2','Sound','getSounds','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','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','status','set','apply','reject','save','update','then','destroy','MusicOnHolds','UserProfileResource','error','name','send','map','VoiceMusicOnHold','rawAttributes','type','key','model','keys','query','filters'];(function(_0xb8daa7,_0x46a4ac){var _0x1effa3=function(_0xb907ee){while(--_0xb907ee){_0xb8daa7['push'](_0xb8daa7['shift']());}};_0x1effa3(++_0x46a4ac);}(_0xb436,0x124));var _0x6b43=function(_0x46e523,_0xe6fccb){_0x46e523=_0x46e523-0x0;var _0x5da0ee=_0xb436[_0x46e523];return _0x5da0ee;};'use strict';var emlformat=require(_0x6b43('0x0'));var rimraf=require(_0x6b43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b43('0x2'));var rp=require(_0x6b43('0x3'));var moment=require(_0x6b43('0x4'));var BPromise=require(_0x6b43('0x5'));var Mustache=require(_0x6b43('0x6'));var util=require(_0x6b43('0x7'));var path=require(_0x6b43('0x8'));var sox=require(_0x6b43('0x9'));var csv=require(_0x6b43('0xa'));var ejs=require(_0x6b43('0xb'));var fs=require('fs');var fs_extra=require(_0x6b43('0xc'));var _=require(_0x6b43('0xd'));var squel=require(_0x6b43('0xe'));var crypto=require(_0x6b43('0xf'));var jsforce=require(_0x6b43('0x10'));var deskjs=require(_0x6b43('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6b43('0x12'));var Redis=require(_0x6b43('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6b43('0x14'));var hardwareService=require(_0x6b43('0x15'));var logger=require(_0x6b43('0x16'))(_0x6b43('0x17'));var utils=require(_0x6b43('0x18'));var config=require(_0x6b43('0x19'));var licenseUtil=require(_0x6b43('0x1a'));var db=require(_0x6b43('0x1b'))['db'];function respondWithStatusCode(_0x4ac1a2,_0x2b43fe){_0x2b43fe=_0x2b43fe||0xcc;return function(_0x1d502b){if(_0x1d502b){return _0x4ac1a2[_0x6b43('0x1c')](_0x2b43fe);}return _0x4ac1a2['status'](_0x2b43fe)[_0x6b43('0x1d')]();};}function respondWithResult(_0x566578,_0x1e2c80){_0x1e2c80=_0x1e2c80||0xc8;return function(_0x5463bf){if(_0x5463bf){return _0x566578['status'](_0x1e2c80)[_0x6b43('0x1e')](_0x5463bf);}};}function respondWithFilteredResult(_0x539061,_0x85385a){return function(_0x1eb66c){if(_0x1eb66c){var _0x370844=typeof _0x85385a[_0x6b43('0x1f')]===_0x6b43('0x20')&&typeof _0x85385a['limit']===_0x6b43('0x20');var _0x5ce079=_0x1eb66c['count'];var _0x227e8d=_0x370844?0x0:_0x85385a[_0x6b43('0x1f')];var _0x5d36d6=_0x370844?_0x1eb66c['count']:_0x85385a[_0x6b43('0x1f')]+_0x85385a[_0x6b43('0x21')];var _0x4886b9;if(_0x5d36d6>=_0x5ce079){_0x5d36d6=_0x5ce079;_0x4886b9=0xc8;}else{_0x4886b9=0xce;}_0x539061[_0x6b43('0x22')](_0x4886b9);return _0x539061[_0x6b43('0x23')]('Content-Range',_0x227e8d+'-'+_0x5d36d6+'/'+_0x5ce079)[_0x6b43('0x1e')](_0x1eb66c);}return null;};}function patchUpdates(_0x4b5f43){return function(_0x246395){try{jsonpatch[_0x6b43('0x24')](_0x246395,_0x4b5f43,!![]);}catch(_0x579c79){return BPromise[_0x6b43('0x25')](_0x579c79);}return _0x246395[_0x6b43('0x26')]();};}function saveUpdates(_0x561fba,_0x227a33){return function(_0x128dc6){if(_0x128dc6){return _0x128dc6[_0x6b43('0x27')](_0x561fba)[_0x6b43('0x28')](function(_0x5c60a1){return _0x5c60a1;});}return null;};}function removeEntity(_0x2501fa,_0x2fc4f8){return function(_0x48d339){if(_0x48d339){return _0x48d339[_0x6b43('0x29')]()[_0x6b43('0x28')](function(){var _0x86f55c=_0x48d339['get']({'plain':!![]});var _0x7f2275=_0x6b43('0x2a');return db[_0x6b43('0x2b')][_0x6b43('0x29')]({'where':{'type':_0x7f2275,'resourceId':_0x86f55c['id']}})[_0x6b43('0x28')](function(){return _0x48d339;});})[_0x6b43('0x28')](function(){_0x2501fa[_0x6b43('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dee01,_0x17441a){return function(_0x13a54c){if(!_0x13a54c){_0x2dee01['sendStatus'](0x194);}return _0x13a54c;};}function handleError(_0x20c87c,_0x7eac6){_0x7eac6=_0x7eac6||0x1f4;return function(_0x401412){logger[_0x6b43('0x2c')](_0x401412['stack']);if(_0x401412[_0x6b43('0x2d')]){delete _0x401412[_0x6b43('0x2d')];}_0x20c87c[_0x6b43('0x22')](_0x7eac6)[_0x6b43('0x2e')](_0x401412);};}exports['index']=function(_0x221c6f,_0x4551a2){var _0x3a4f2e={},_0x7b57ca={},_0xf1e198={'count':0x0,'rows':[]};var _0x425828=_[_0x6b43('0x2f')](db[_0x6b43('0x30')][_0x6b43('0x31')],function(_0x3f9de4){return{'name':_0x3f9de4['fieldName'],'type':_0x3f9de4[_0x6b43('0x32')][_0x6b43('0x33')]};});_0x7b57ca[_0x6b43('0x34')]=_[_0x6b43('0x2f')](_0x425828,_0x6b43('0x2d'));_0x7b57ca['query']=_[_0x6b43('0x35')](_0x221c6f[_0x6b43('0x36')]);_0x7b57ca[_0x6b43('0x37')]=_[_0x6b43('0x38')](_0x7b57ca[_0x6b43('0x34')],_0x7b57ca['query']);_0x3a4f2e[_0x6b43('0x39')]=_[_0x6b43('0x38')](_0x7b57ca['model'],qs[_0x6b43('0x3a')](_0x221c6f[_0x6b43('0x36')][_0x6b43('0x3a')]));_0x3a4f2e['attributes']=_0x3a4f2e[_0x6b43('0x39')][_0x6b43('0x3b')]?_0x3a4f2e['attributes']:_0x7b57ca[_0x6b43('0x34')];if(!_0x221c6f[_0x6b43('0x36')]['hasOwnProperty'](_0x6b43('0x3c'))){_0x3a4f2e[_0x6b43('0x21')]=qs[_0x6b43('0x21')](_0x221c6f[_0x6b43('0x36')][_0x6b43('0x21')]);_0x3a4f2e[_0x6b43('0x1f')]=qs[_0x6b43('0x1f')](_0x221c6f[_0x6b43('0x36')][_0x6b43('0x1f')]);}_0x3a4f2e[_0x6b43('0x3d')]=qs[_0x6b43('0x3e')](_0x221c6f['query'][_0x6b43('0x3e')]);delete _0x221c6f[_0x6b43('0x36')]['sort'];_0x3a4f2e['where']=qs[_0x6b43('0x37')](_[_0x6b43('0x3f')](_0x221c6f[_0x6b43('0x36')],_0x7b57ca[_0x6b43('0x37')]),_0x425828);if(_0x221c6f['query'][_0x6b43('0x40')]){_0x3a4f2e[_0x6b43('0x41')]=_[_0x6b43('0x42')](_0x3a4f2e[_0x6b43('0x41')],{'$or':_[_0x6b43('0x2f')](_0x425828,function(_0x3ad144){if(_0x3ad144['type']!=='VIRTUAL'){var _0x327972={};_0x327972[_0x3ad144[_0x6b43('0x2d')]]={'$like':'%'+_0x221c6f[_0x6b43('0x36')][_0x6b43('0x40')]+'%'};return _0x327972;}})});}_0x3a4f2e=_[_0x6b43('0x42')]({},_0x3a4f2e,_0x221c6f[_0x6b43('0x43')]);var _0x4e974b={'where':_0x3a4f2e[_0x6b43('0x41')]};return db[_0x6b43('0x30')]['count'](_0x4e974b)[_0x6b43('0x28')](function(_0x47aca2){_0xf1e198[_0x6b43('0x44')]=_0x47aca2;if(_0x221c6f[_0x6b43('0x36')][_0x6b43('0x45')]){_0x3a4f2e[_0x6b43('0x46')]=[{'all':!![]}];}return db[_0x6b43('0x30')][_0x6b43('0x47')](_0x3a4f2e);})['then'](function(_0x756a89){_0xf1e198[_0x6b43('0x48')]=_0x756a89;return _0xf1e198;})[_0x6b43('0x28')](respondWithFilteredResult(_0x4551a2,_0x3a4f2e))[_0x6b43('0x49')](handleError(_0x4551a2,null));};exports[_0x6b43('0x4a')]=function(_0x5522dc,_0x40296f){var _0x532167={'raw':![],'where':{'id':_0x5522dc['params']['id']}},_0x16ee29={};_0x16ee29['model']=_[_0x6b43('0x35')](db['VoiceMusicOnHold'][_0x6b43('0x31')]);_0x16ee29[_0x6b43('0x36')]=_[_0x6b43('0x35')](_0x5522dc['query']);_0x16ee29['filters']=_['intersection'](_0x16ee29['model'],_0x16ee29[_0x6b43('0x36')]);_0x532167[_0x6b43('0x39')]=_[_0x6b43('0x38')](_0x16ee29['model'],qs['fields'](_0x5522dc['query']['fields']));_0x532167['attributes']=_0x532167[_0x6b43('0x39')]['length']?_0x532167[_0x6b43('0x39')]:_0x16ee29['model'];if(_0x5522dc[_0x6b43('0x36')][_0x6b43('0x45')]){_0x532167['include']=[{'all':!![]}];}_0x532167=_['merge']({},_0x532167,_0x5522dc['options']);return db[_0x6b43('0x30')]['find'](_0x532167)[_0x6b43('0x28')](handleEntityNotFound(_0x40296f,null))[_0x6b43('0x28')](respondWithResult(_0x40296f,null))['catch'](handleError(_0x40296f,null));};exports['update']=function(_0x542fa3,_0xf14da7){if(_0x542fa3[_0x6b43('0x4b')]['id']){delete _0x542fa3['body']['id'];}return db[_0x6b43('0x30')][_0x6b43('0x4c')]({'where':{'id':_0x542fa3[_0x6b43('0x4d')]['id']}})['then'](handleEntityNotFound(_0xf14da7,null))[_0x6b43('0x28')](saveUpdates(_0x542fa3[_0x6b43('0x4b')],null))[_0x6b43('0x28')](respondWithResult(_0xf14da7,null))['catch'](handleError(_0xf14da7,null));};exports['create']=function(_0x22049a,_0x7f6705,_0x475de2){return db['sequelize']['transaction'](function(_0x3db7a6){if(_0x22049a[_0x6b43('0x4b')][_0x6b43('0x4e')]===_0x6b43('0x4f')){_0x22049a['body'][_0x6b43('0x50')]=path[_0x6b43('0x51')](config[_0x6b43('0x52')],_0x6b43('0x53'),_0x22049a[_0x6b43('0x4b')]['name']);}return db[_0x6b43('0x30')]['create'](_0x22049a[_0x6b43('0x4b')],{'transaction':_0x3db7a6})[_0x6b43('0x28')](function(_0x3d9c40){if(_0x22049a['body'][_0x6b43('0x4e')]===_0x6b43('0x4f')){fs[_0x6b43('0x54')](_0x3d9c40[_0x6b43('0x50')],parseInt(_0x6b43('0x55'),0x8));}var _0x4964d3=_0x22049a[_0x6b43('0x56')]['get']({'plain':!![]});if(!_0x4964d3)throw new Error(_0x6b43('0x57'));if(_0x4964d3[_0x6b43('0x58')]===_0x6b43('0x56')){var _0x910dcc=_0x3d9c40[_0x6b43('0x59')]({'plain':!![]});return db[_0x6b43('0x5a')][_0x6b43('0x4c')]({'where':{'name':_0x6b43('0x2a'),'userProfileId':_0x4964d3['userProfileId']},'raw':!![]})[_0x6b43('0x28')](function(_0x29fc81){if(_0x29fc81&&_0x29fc81[_0x6b43('0x5b')]===0x0){return db[_0x6b43('0x2b')][_0x6b43('0x5c')]({'name':_0x910dcc['name'],'resourceId':_0x910dcc['id'],'type':_0x29fc81[_0x6b43('0x2d')],'sectionId':_0x29fc81['id']},{})[_0x6b43('0x28')](function(){return _0x3d9c40;});}else{return _0x3d9c40;}})['catch'](function(_0x2535db){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2535db);});}return _0x3d9c40;});})[_0x6b43('0x28')](respondWithResult(_0x7f6705,0xc9))[_0x6b43('0x49')](handleError(_0x7f6705,null));};exports[_0x6b43('0x29')]=function(_0x177480,_0x169724,_0x5487d0){var _0x16d241;return db[_0x6b43('0x30')]['find']({'where':{'id':_0x177480['params']['id']}})[_0x6b43('0x28')](function(_0x566927){if(_0x566927){return db['sequelize']['transaction'](function(_0x44353b){return _0x566927[_0x6b43('0x29')]({'transaction':_0x44353b,'raw':!![]})['then'](function(_0x4771c7){if(_0x4771c7[_0x6b43('0x50')]){fs[_0x6b43('0x5d')](_0x4771c7[_0x6b43('0x50')])[_0x6b43('0x5e')](function(_0x407e8c){fs[_0x6b43('0x5f')](path[_0x6b43('0x51')](_0x4771c7[_0x6b43('0x50')],_0x407e8c));});fs[_0x6b43('0x60')](_0x4771c7[_0x6b43('0x50')]);}return _0x4771c7;});})[_0x6b43('0x49')](function(_0x20b6bb){throw new db[(_0x6b43('0x61'))][(_0x6b43('0x62'))](_0x20b6bb[_0x6b43('0x63')]);});}})[_0x6b43('0x28')](handleEntityNotFound(_0x169724,null))[_0x6b43('0x28')](removeEntity(_0x169724,null))['catch'](handleError(_0x169724,null));};exports[_0x6b43('0x64')]=function(_0x217246,_0x338344,_0x39b452){return db[_0x6b43('0x65')][_0x6b43('0x66')](function(_0x28d7f8){var _0x13d704;return db[_0x6b43('0x30')][_0x6b43('0x4c')]({'where':{'id':_0x217246[_0x6b43('0x4d')]['id']}})[_0x6b43('0x28')](function(_0x624013){if(_0x624013){_0x13d704=_0x624013;return _0x624013[_0x6b43('0x64')](_0x217246['body']['id'],{'transaction':_0x28d7f8});}})[_0x6b43('0x28')](function(_0x3023cb){if(_0x3023cb){return db['Sound']['findOne']({'where':{'id':_0x217246[_0x6b43('0x4b')]['id']},'attributes':['id',_0x6b43('0x2d'),_0x6b43('0x67'),'converted_format',_0x6b43('0x68')],'raw':!![]});}})[_0x6b43('0x28')](function(_0x4733a4){if(_0x4733a4){var _0x18a29c=path['join'](config[_0x6b43('0x52')],_0x6b43('0x69'),util['format'](_0x6b43('0x6a'),path[_0x6b43('0x6b')](_0x4733a4[_0x6b43('0x67')],path['extname'](_0x4733a4[_0x6b43('0x67')])),_0x4733a4['converted_format']));var _0x3f793d=path[_0x6b43('0x51')](config['root'],_0x6b43('0x53'),_0x13d704['name'],util[_0x6b43('0x6c')](_0x6b43('0x6a'),_0x4733a4['name'],_0x4733a4[_0x6b43('0x6d')]));fs[_0x6b43('0x6e')](_0x18a29c,_0x3f793d);return _0x4733a4;}})[_0x6b43('0x49')](function(_0x22a834){throw new db[(_0x6b43('0x61'))][(_0x6b43('0x62'))](_0x22a834[_0x6b43('0x63')]);});})[_0x6b43('0x28')](handleEntityNotFound(_0x338344,null))['then'](respondWithResult(_0x338344,0xc9))[_0x6b43('0x49')](handleError(_0x338344,null));};exports[_0x6b43('0x6f')]=function(_0x2222e0,_0x2a0cb7,_0x126654){return db[_0x6b43('0x65')][_0x6b43('0x66')](function(_0x417fab){var _0x31e763;return db[_0x6b43('0x30')][_0x6b43('0x70')]({'where':{'id':_0x2222e0[_0x6b43('0x4d')]['id']}})[_0x6b43('0x28')](handleEntityNotFound(_0x2a0cb7,null))[_0x6b43('0x28')](function(_0xa62769){if(_0xa62769){_0x31e763=_0xa62769;return _0xa62769[_0x6b43('0x6f')](_0x2222e0[_0x6b43('0x4d')][_0x6b43('0x71')]);}})[_0x6b43('0x28')](function(_0x3ba56a){if(_0x3ba56a){return db[_0x6b43('0x72')]['findOne']({'where':{'id':_0x2222e0[_0x6b43('0x4d')][_0x6b43('0x71')]},'attributes':['id',_0x6b43('0x2d'),'save_name',_0x6b43('0x6d'),_0x6b43('0x68')],'raw':!![]});}})[_0x6b43('0x28')](function(_0x3e0fcf){if(_0x3e0fcf){fs['unlinkSync'](path[_0x6b43('0x51')](_0x31e763[_0x6b43('0x50')],util[_0x6b43('0x6c')](_0x6b43('0x6a'),_0x3e0fcf['name'],_0x3e0fcf[_0x6b43('0x6d')])));return _0x3e0fcf;}})['catch'](function(_0x56cb9c){throw new db['Sequelize'][(_0x6b43('0x62'))](_0x56cb9c[_0x6b43('0x63')]);});})[_0x6b43('0x28')](handleEntityNotFound(_0x2a0cb7,null))[_0x6b43('0x28')](respondWithStatusCode(_0x2a0cb7,0xcc))['catch'](handleError(_0x2a0cb7,null));};exports[_0x6b43('0x73')]=function(_0x1899fa,_0x15ddf9,_0xc1833f){var _0x48c386={};var _0x3af795={};var _0x402607;var _0x1904c6;return db['VoiceMusicOnHold'][_0x6b43('0x70')]({'where':{'id':_0x1899fa[_0x6b43('0x4d')]['id']}})[_0x6b43('0x28')](handleEntityNotFound(_0x15ddf9,null))['then'](function(_0x4622b0){if(_0x4622b0){_0x402607=_0x4622b0;_0x3af795['model']=_[_0x6b43('0x35')](db[_0x6b43('0x72')][_0x6b43('0x31')]);_0x3af795['query']=_[_0x6b43('0x35')](_0x1899fa['query']);_0x3af795[_0x6b43('0x37')]=_[_0x6b43('0x38')](_0x3af795[_0x6b43('0x34')],_0x3af795['query']);_0x48c386[_0x6b43('0x39')]=_[_0x6b43('0x38')](_0x3af795[_0x6b43('0x34')],qs[_0x6b43('0x3a')](_0x1899fa['query'][_0x6b43('0x3a')]));_0x48c386[_0x6b43('0x39')]=_0x48c386[_0x6b43('0x39')][_0x6b43('0x3b')]?_0x48c386[_0x6b43('0x39')]:_0x3af795[_0x6b43('0x34')];_0x48c386['order']=qs[_0x6b43('0x3e')](_0x1899fa['query'][_0x6b43('0x3e')]);_0x48c386[_0x6b43('0x41')]=qs['filters'](_[_0x6b43('0x3f')](_0x1899fa[_0x6b43('0x36')],_0x3af795[_0x6b43('0x37')]));if(_0x1899fa[_0x6b43('0x36')]['filter']){_0x48c386[_0x6b43('0x41')]=_['merge'](_0x48c386[_0x6b43('0x41')],{'$or':_[_0x6b43('0x2f')](_0x48c386['attributes'],function(_0x56c2f7){var _0x14d1a0={};_0x14d1a0[_0x56c2f7]={'$like':'%'+_0x1899fa[_0x6b43('0x36')]['filter']+'%'};return _0x14d1a0;})});}_0x48c386=_[_0x6b43('0x42')]({},_0x48c386,_0x1899fa['options']);return _0x402607[_0x6b43('0x73')](_0x48c386);}})['then'](function(_0x27ef27){if(_0x27ef27){_0x1904c6=_0x27ef27['length'];if(!_0x1899fa[_0x6b43('0x36')]['hasOwnProperty'](_0x6b43('0x3c'))){_0x48c386[_0x6b43('0x21')]=qs[_0x6b43('0x21')](_0x1899fa[_0x6b43('0x36')]['limit']);_0x48c386[_0x6b43('0x1f')]=qs['offset'](_0x1899fa['query'][_0x6b43('0x1f')]);}return _0x402607[_0x6b43('0x73')](_0x48c386);}})[_0x6b43('0x28')](function(_0x4d9304){if(_0x4d9304){return _0x4d9304?{'count':_0x1904c6,'rows':_0x4d9304}:null;}})[_0x6b43('0x28')](respondWithResult(_0x15ddf9,null))[_0x6b43('0x49')](handleError(_0x15ddf9,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 135e61c..6a9e3ca 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 _0x2f20=['define','VoiceMusicOnHold','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x11c539,_0x52de82){var _0x2da1e3=function(_0x3d3652){while(--_0x3d3652){_0x11c539['push'](_0x11c539['shift']());}};_0x2da1e3(++_0x52de82);}(_0x2f20,0x92));var _0x02f2=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x2f20[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x02f2('0x0'));var util=require(_0x02f2('0x1'));var logger=require(_0x02f2('0x2'))(_0x02f2('0x3'));var moment=require(_0x02f2('0x4'));var BPromise=require('bluebird');var rp=require(_0x02f2('0x5'));var fs=require('fs');var path=require(_0x02f2('0x6'));var rimraf=require(_0x02f2('0x7'));var config=require(_0x02f2('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x02f2('0x9')]=function(_0x1dd12d,_0x57b108){return _0x1dd12d[_0x02f2('0xa')](_0x02f2('0xb'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb241=['path','rimraf','../../config/environment','exports','VoiceMusicOnHold','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x556694,_0x488ae7){var _0x5e566f=function(_0x49472e){while(--_0x49472e){_0x556694['push'](_0x556694['shift']());}};_0x5e566f(++_0x488ae7);}(_0xb241,0x125));var _0x1b24=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb241[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x1b24('0x0'));var util=require(_0x1b24('0x1'));var logger=require(_0x1b24('0x2'))(_0x1b24('0x3'));var moment=require(_0x1b24('0x4'));var BPromise=require(_0x1b24('0x5'));var rp=require(_0x1b24('0x6'));var fs=require('fs');var path=require(_0x1b24('0x7'));var rimraf=require(_0x1b24('0x8'));var config=require(_0x1b24('0x9'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x1b24('0xa')]=function(_0x14680b,_0x1297d0){return _0x14680b['define'](_0x1b24('0xb'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 0a6f836..f0b90ad 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x12b10e,_0x50ce6a){var _0x6d097b=function(_0x2be178){while(--_0x2be178){_0x12b10e['push'](_0x12b10e['shift']());}};_0x6d097b(++_0x50ce6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x6d3c0c,_0x3e8582){var _0x4eff80=function(_0x2a7001){while(--_0x2a7001){_0x6d3c0c['push'](_0x6d3c0c['shift']());}};_0x4eff80(++_0x3e8582);}(_0x70e0,0x17b));var _0x070e=function(_0x5e340b,_0x38fa12){_0x5e340b=_0x5e340b-0x0;var _0x553cb9=_0x70e0[_0x5e340b];return _0x553cb9;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 4557a2d..6752a9b 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 _0x1413=['update','destroy','removeAgents','delete','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','get','/describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','create','post','addTeams','put'];(function(_0x20cb20,_0x256051){var _0x2fcf4b=function(_0x26200b){while(--_0x26200b){_0x20cb20['push'](_0x20cb20['shift']());}};_0x2fcf4b(++_0x256051);}(_0x1413,0x170));var _0x3141=function(_0x39b126,_0x57060e){_0x39b126=_0x39b126-0x0;var _0x3fd917=_0x1413[_0x39b126];return _0x3fd917;};'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['addAgents']);router[_0x3141('0x13')]('/:id/teams',auth[_0x3141('0x9')](),controller[_0x3141('0x14')]);router[_0x3141('0x15')]('/:id',auth[_0x3141('0x9')](),controller[_0x3141('0x16')]);router['delete'](_0x3141('0xc'),auth[_0x3141('0x9')](),controller[_0x3141('0x17')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x3141('0x18')]);router[_0x3141('0x19')]('/:id/teams',auth[_0x3141('0x9')](),controller['removeTeams']);module['exports']=router; \ No newline at end of file +var _0xc631=['/:id','show','/:id/users','getAgents','getTeams','post','create','addAgents','put','update','delete','/:id/teams','removeTeams','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x551834,_0x330d01){var _0x3ae736=function(_0xb1a1b7){while(--_0xb1a1b7){_0x551834['push'](_0x551834['shift']());}};_0x3ae736(++_0x330d01);}(_0xc631,0x82));var _0x1c63=function(_0x5bd02a,_0x2abcc0){_0x5bd02a=_0x5bd02a-0x0;var _0x402ca8=_0xc631[_0x5bd02a];return _0x402ca8;};'use strict';var multer=require('multer');var util=require(_0x1c63('0x0'));var path=require(_0x1c63('0x1'));var timeout=require(_0x1c63('0x2'));var express=require(_0x1c63('0x3'));var router=express[_0x1c63('0x4')]();var fs_extra=require(_0x1c63('0x5'));var auth=require(_0x1c63('0x6'));var interaction=require(_0x1c63('0x7'));var config=require(_0x1c63('0x8'));var controller=require(_0x1c63('0x9'));router['get']('/',auth[_0x1c63('0xa')](),controller[_0x1c63('0xb')]);router[_0x1c63('0xc')](_0x1c63('0xd'),auth[_0x1c63('0xa')](),controller[_0x1c63('0xe')]);router['get'](_0x1c63('0xf'),auth[_0x1c63('0xa')](),controller[_0x1c63('0x10')]);router[_0x1c63('0xc')](_0x1c63('0x11'),auth[_0x1c63('0xa')](),controller[_0x1c63('0x12')]);router['get']('/:id/teams',auth[_0x1c63('0xa')](),controller[_0x1c63('0x13')]);router[_0x1c63('0x14')]('/',auth[_0x1c63('0xa')](),controller[_0x1c63('0x15')]);router[_0x1c63('0x14')](_0x1c63('0x11'),auth[_0x1c63('0xa')](),controller[_0x1c63('0x16')]);router[_0x1c63('0x14')]('/:id/teams',auth[_0x1c63('0xa')](),controller['addTeams']);router[_0x1c63('0x17')](_0x1c63('0xf'),auth[_0x1c63('0xa')](),controller[_0x1c63('0x18')]);router[_0x1c63('0x19')](_0x1c63('0xf'),auth[_0x1c63('0xa')](),controller['destroy']);router['delete'](_0x1c63('0x11'),auth[_0x1c63('0xa')](),controller['removeAgents']);router['delete'](_0x1c63('0x1a'),auth['isAuthenticated'](),controller[_0x1c63('0x1b')]);module[_0x1c63('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 1ce9a8c..463cb3e 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 _0xd2b6=['INTEGER','STRING','name','system-','getDataValue'];(function(_0x28d979,_0x1927d1){var _0x3a2d92=function(_0x487e82){while(--_0x487e82){_0x28d979['push'](_0x28d979['shift']());}};_0x3a2d92(++_0x1927d1);}(_0xd2b6,0x173));var _0x6d2b=function(_0x3f6131,_0x531acc){_0x3f6131=_0x3f6131-0x0;var _0x18d856=_0xd2b6[_0x3f6131];return _0x18d856;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6d2b('0x0')],'allowNull':![],'unique':_0x6d2b('0x1')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x2a5e5b){return _0x6d2b('0x2')+this[_0x6d2b('0x3')](_0x6d2b('0x1'))+'-';}},'description':{'type':Sequelize[_0x6d2b('0x0')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x6d2b('0x4')]}}; \ No newline at end of file +var _0x8622=['INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-','getDataValue'];(function(_0xbe97ea,_0x1a2102){var _0x5ddc50=function(_0x3de1d9){while(--_0x3de1d9){_0xbe97ea['push'](_0xbe97ea['shift']());}};_0x5ddc50(++_0x1a2102);}(_0x8622,0x1a9));var _0x2862=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8622[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x2862('0x0'));module[_0x2862('0x1')]={'name':{'type':Sequelize[_0x2862('0x2')],'allowNull':![],'unique':_0x2862('0x3')},'prefix':{'type':Sequelize[_0x2862('0x4')],'get':function(_0x522760){return _0x2862('0x5')+this[_0x2862('0x6')](_0x2862('0x3'))+'-';}},'description':{'type':Sequelize[_0x2862('0x2')]},'callerIdAll':{'type':Sequelize[_0x2862('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x2862('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 62045ea..b87ff7f 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 _0x4cf8=['forEach','removeTeams','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','map','VoicePrefix','fieldName','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','options','includeAll','show','rawAttributes','find','params','describe','create','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','prefix','system-','sequelize','findById','addAgents','body','ids','spread','emit','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','getTeams','Team','findAll','Agents','voicePause','interface','flatMap','transaction','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate'];(function(_0x1cd9a9,_0x226b55){var _0x15795d=function(_0x238793){while(--_0x238793){_0x1cd9a9['push'](_0x1cd9a9['shift']());}};_0x15795d(++_0x226b55);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x2f02d4,_0x27b24a){_0x2f02d4=_0x2f02d4-0x0;var _0x4b707d=_0x4cf8[_0x2f02d4];return _0x4b707d;};'use strict';var emlformat=require(_0x84cf('0x0'));var rimraf=require(_0x84cf('0x1'));var zipdir=require(_0x84cf('0x2'));var jsonpatch=require(_0x84cf('0x3'));var rp=require(_0x84cf('0x4'));var moment=require(_0x84cf('0x5'));var BPromise=require(_0x84cf('0x6'));var Mustache=require(_0x84cf('0x7'));var util=require(_0x84cf('0x8'));var path=require(_0x84cf('0x9'));var sox=require(_0x84cf('0xa'));var csv=require(_0x84cf('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84cf('0xc'));var squel=require('squel');var crypto=require(_0x84cf('0xd'));var jsforce=require(_0x84cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x84cf('0xb'));var querystring=require(_0x84cf('0xf'));var Papa=require('papaparse');var Redis=require(_0x84cf('0x10'));var authService=require(_0x84cf('0x11'));var qs=require(_0x84cf('0x12'));var as=require(_0x84cf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84cf('0x14'))(_0x84cf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84cf('0x16'));var db=require(_0x84cf('0x17'))['db'];config[_0x84cf('0x18')]=_[_0x84cf('0x19')](config[_0x84cf('0x18')],{'host':_0x84cf('0x1a'),'port':0x18eb});var socket=require(_0x84cf('0x1b'))(new Redis(config[_0x84cf('0x18')]));require(_0x84cf('0x1c'))[_0x84cf('0x1d')](socket);function respondWithStatusCode(_0x2fc41f,_0x385027){_0x385027=_0x385027||0xcc;return function(_0x7db8f){if(_0x7db8f){return _0x2fc41f[_0x84cf('0x1e')](_0x385027);}return _0x2fc41f[_0x84cf('0x1f')](_0x385027)[_0x84cf('0x20')]();};}function respondWithResult(_0x464e70,_0x240edf){_0x240edf=_0x240edf||0xc8;return function(_0xe12c7b){if(_0xe12c7b){return _0x464e70['status'](_0x240edf)[_0x84cf('0x21')](_0xe12c7b);}};}function respondWithFilteredResult(_0x5d6a93,_0xfa6641){return function(_0x1abe2d){if(_0x1abe2d){var _0x1dad1a=typeof _0xfa6641[_0x84cf('0x22')]===_0x84cf('0x23')&&typeof _0xfa6641['limit']==='undefined';var _0x42d6d4=_0x1abe2d[_0x84cf('0x24')];var _0x346b43=_0x1dad1a?0x0:_0xfa6641[_0x84cf('0x22')];var _0x219afa=_0x1dad1a?_0x1abe2d['count']:_0xfa6641[_0x84cf('0x22')]+_0xfa6641[_0x84cf('0x25')];var _0x3ca1be;if(_0x219afa>=_0x42d6d4){_0x219afa=_0x42d6d4;_0x3ca1be=0xc8;}else{_0x3ca1be=0xce;}_0x5d6a93[_0x84cf('0x1f')](_0x3ca1be);return _0x5d6a93[_0x84cf('0x26')]('Content-Range',_0x346b43+'-'+_0x219afa+'/'+_0x42d6d4)[_0x84cf('0x21')](_0x1abe2d);}return null;};}function patchUpdates(_0x160f86){return function(_0x475b19){try{jsonpatch[_0x84cf('0x27')](_0x475b19,_0x160f86,!![]);}catch(_0x3e5e94){return BPromise[_0x84cf('0x28')](_0x3e5e94);}return _0x475b19[_0x84cf('0x29')]();};}function saveUpdates(_0x4c9d1c,_0x2b2c90){return function(_0x26db3f){if(_0x26db3f){return _0x26db3f[_0x84cf('0x2a')](_0x4c9d1c)[_0x84cf('0x2b')](function(_0x1d220a){return _0x1d220a;});}return null;};}function removeEntity(_0x44d4bf,_0x3c7eda){return function(_0xa44c81){if(_0xa44c81){return _0xa44c81[_0x84cf('0x2c')]()[_0x84cf('0x2b')](function(){var _0x5179c1=_0xa44c81[_0x84cf('0x2d')]({'plain':!![]});var _0x17bc92=_0x84cf('0x2e');return db[_0x84cf('0x2f')]['destroy']({'where':{'type':_0x17bc92,'resourceId':_0x5179c1['id']}})[_0x84cf('0x2b')](function(){return _0xa44c81;});})['then'](function(){_0x44d4bf[_0x84cf('0x1f')](0xcc)[_0x84cf('0x20')]();});}};}function handleEntityNotFound(_0x43b41b,_0xc15298){return function(_0x51adcf){if(!_0x51adcf){_0x43b41b[_0x84cf('0x1e')](0x194);}return _0x51adcf;};}function handleError(_0x2e4653,_0x309398){_0x309398=_0x309398||0x1f4;return function(_0x1bfa56){logger[_0x84cf('0x30')](_0x1bfa56[_0x84cf('0x31')]);if(_0x1bfa56[_0x84cf('0x32')]){delete _0x1bfa56[_0x84cf('0x32')];}_0x2e4653[_0x84cf('0x1f')](_0x309398)['send'](_0x1bfa56);};}exports['index']=function(_0x2795ef,_0x25de3a){var _0x16ebaa={},_0x1e889e={},_0x38eeea={'count':0x0,'rows':[]};var _0x1453cf=_[_0x84cf('0x33')](db[_0x84cf('0x34')]['rawAttributes'],function(_0x113b3e){return{'name':_0x113b3e[_0x84cf('0x35')],'type':_0x113b3e['type'][_0x84cf('0x36')]};});_0x1e889e['model']=_[_0x84cf('0x33')](_0x1453cf,_0x84cf('0x32'));_0x1e889e[_0x84cf('0x37')]=_[_0x84cf('0x38')](_0x2795ef[_0x84cf('0x37')]);_0x1e889e['filters']=_[_0x84cf('0x39')](_0x1e889e['model'],_0x1e889e['query']);_0x16ebaa[_0x84cf('0x3a')]=_[_0x84cf('0x39')](_0x1e889e['model'],qs[_0x84cf('0x3b')](_0x2795ef[_0x84cf('0x37')][_0x84cf('0x3b')]));_0x16ebaa[_0x84cf('0x3a')]=_0x16ebaa[_0x84cf('0x3a')][_0x84cf('0x3c')]?_0x16ebaa['attributes']:_0x1e889e[_0x84cf('0x3d')];if(!_0x2795ef[_0x84cf('0x37')][_0x84cf('0x3e')](_0x84cf('0x3f'))){_0x16ebaa[_0x84cf('0x25')]=qs[_0x84cf('0x25')](_0x2795ef['query'][_0x84cf('0x25')]);_0x16ebaa['offset']=qs[_0x84cf('0x22')](_0x2795ef[_0x84cf('0x37')][_0x84cf('0x22')]);}_0x16ebaa[_0x84cf('0x40')]=qs[_0x84cf('0x41')](_0x2795ef[_0x84cf('0x37')][_0x84cf('0x41')]);_0x16ebaa[_0x84cf('0x42')]=qs[_0x84cf('0x43')](_['pick'](_0x2795ef[_0x84cf('0x37')],_0x1e889e['filters']),_0x1453cf);if(_0x2795ef[_0x84cf('0x37')][_0x84cf('0x44')]){_0x16ebaa['where']=_[_0x84cf('0x45')](_0x16ebaa['where'],{'$or':_[_0x84cf('0x33')](_0x1453cf,function(_0x504d32){if(_0x504d32[_0x84cf('0x46')]!=='VIRTUAL'){var _0x2db7dd={};_0x2db7dd[_0x504d32[_0x84cf('0x32')]]={'$like':'%'+_0x2795ef['query'][_0x84cf('0x44')]+'%'};return _0x2db7dd;}})});}_0x16ebaa=_[_0x84cf('0x45')]({},_0x16ebaa,_0x2795ef[_0x84cf('0x47')]);var _0x5ef5fb={'where':_0x16ebaa[_0x84cf('0x42')]};return db['VoicePrefix'][_0x84cf('0x24')](_0x5ef5fb)['then'](function(_0x56b0e5){_0x38eeea['count']=_0x56b0e5;if(_0x2795ef[_0x84cf('0x37')][_0x84cf('0x48')]){_0x16ebaa['include']=[{'all':!![]}];}return db[_0x84cf('0x34')]['findAll'](_0x16ebaa);})[_0x84cf('0x2b')](function(_0x3fe8c1){_0x38eeea['rows']=_0x3fe8c1;return _0x38eeea;})[_0x84cf('0x2b')](respondWithFilteredResult(_0x25de3a,_0x16ebaa))['catch'](handleError(_0x25de3a,null));};exports[_0x84cf('0x49')]=function(_0x593b35,_0x4feb7e){var _0x5d8b69={'raw':![],'where':{'id':_0x593b35['params']['id']}},_0x5498ec={};_0x5498ec['model']=_['keys'](db[_0x84cf('0x34')][_0x84cf('0x4a')]);_0x5498ec[_0x84cf('0x37')]=_[_0x84cf('0x38')](_0x593b35['query']);_0x5498ec[_0x84cf('0x43')]=_['intersection'](_0x5498ec[_0x84cf('0x3d')],_0x5498ec[_0x84cf('0x37')]);_0x5d8b69[_0x84cf('0x3a')]=_[_0x84cf('0x39')](_0x5498ec[_0x84cf('0x3d')],qs[_0x84cf('0x3b')](_0x593b35['query'][_0x84cf('0x3b')]));_0x5d8b69[_0x84cf('0x3a')]=_0x5d8b69['attributes'][_0x84cf('0x3c')]?_0x5d8b69[_0x84cf('0x3a')]:_0x5498ec[_0x84cf('0x3d')];if(_0x593b35['query']['includeAll']){_0x5d8b69['include']=[{'all':!![]}];}_0x5d8b69=_[_0x84cf('0x45')]({},_0x5d8b69,_0x593b35[_0x84cf('0x47')]);return db[_0x84cf('0x34')][_0x84cf('0x4b')](_0x5d8b69)[_0x84cf('0x2b')](handleEntityNotFound(_0x4feb7e,null))[_0x84cf('0x2b')](respondWithResult(_0x4feb7e,null))['catch'](handleError(_0x4feb7e,null));};exports[_0x84cf('0x2c')]=function(_0x55316e,_0x44b8b0){return db['VoicePrefix']['find']({'where':{'id':_0x55316e[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0x44b8b0,null))[_0x84cf('0x2b')](removeEntity(_0x44b8b0,null))['catch'](handleError(_0x44b8b0,null));};exports['describe']=function(_0x290a4d,_0x1ce99c){return db[_0x84cf('0x34')][_0x84cf('0x4d')]()[_0x84cf('0x2b')](respondWithResult(_0x1ce99c,null))['catch'](handleError(_0x1ce99c,null));};exports[_0x84cf('0x4e')]=function(_0x225fc2,_0x5e4af1){var _0x33145e;return db['sequelize']['transaction'](function(_0x147194){return db[_0x84cf('0x34')]['create'](_0x225fc2['body'],{'transaction':_0x147194})[_0x84cf('0x2b')](function(_0x9f2467){_0x33145e=_0x9f2467[_0x84cf('0x2d')]({'plain':!![]});return db[_0x84cf('0x4f')][_0x84cf('0x4b')]({'where':{'id':_0x33145e[_0x84cf('0x50')]},'raw':!![]})[_0x84cf('0x2b')](function(_0x20ae02){return createVoicePrefixExtensions(_0x33145e,_0x20ae02,_0x147194);});});})['then'](function(){var _0x1bc15c=_0x225fc2[_0x84cf('0x51')]['get']({'plain':!![]});if(!_0x1bc15c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bc15c[_0x84cf('0x52')]===_0x84cf('0x51')){var _0x3912cb=_0x33145e;return db[_0x84cf('0x53')][_0x84cf('0x4b')]({'where':{'name':_0x84cf('0x2e'),'userProfileId':_0x1bc15c[_0x84cf('0x54')]},'raw':!![]})['then'](function(_0x652356){if(_0x652356&&_0x652356['autoAssociation']===0x0){return db[_0x84cf('0x2f')]['create']({'name':_0x3912cb[_0x84cf('0x32')],'resourceId':_0x3912cb['id'],'type':_0x652356[_0x84cf('0x32')],'sectionId':_0x652356['id']},{})['then'](function(){return _0x33145e;});}else{return _0x33145e;}})[_0x84cf('0x55')](function(_0x448260){logger['error'](_0x84cf('0x56'),_0x448260);throw _0x448260;});}return _0x33145e;})['then'](respondWithResult(_0x5e4af1,null))['catch'](handleError(_0x5e4af1,null));};function Extension(_0x5cc371,_0x50cde2,_0x2007a6,_0x39394f){this[_0x84cf('0x57')]=_0x84cf('0x58');this['exten']=_0x5cc371;this[_0x84cf('0x59')]=_0x2007a6;this[_0x84cf('0x46')]='system';this[_0x84cf('0x5a')]=_0x84cf('0x5b');this[_0x84cf('0x5c')]=_0x50cde2;this[_0x84cf('0x5d')]=_0x39394f;}function createVoicePrefixExtensions(_0x2073f1,_0x273711,_0x1f1f76){return new BPromise(function(_0x39a336,_0x553ee2){var _0x155934=new Extension(formatPrefixName(_0x2073f1['prefix']),0x1,_0x84cf('0x5e'),_0x84cf('0x5f'));_0x155934[_0x84cf('0x60')]=_0x2073f1['id'];return db[_0x84cf('0x4f')][_0x84cf('0x4e')](_0x155934,{'transaction':_0x1f1f76})['then'](function(_0xfea0d2){var _0x41ee7a=_0xfea0d2[_0x84cf('0x2d')]({'plain':!![]});var _0x4ebb4b=_[_0x84cf('0x33')](addVoicePrefixExtensions(_0x2073f1,_0x273711),function(_0x240cca){_0x240cca['VoiceExtensionId']=_0x41ee7a['id'];_0x240cca[_0x84cf('0x60')]=_0x2073f1['id'];return _0x240cca;});return db['VoiceExtension'][_0x84cf('0x61')](_0x4ebb4b,{'transaction':_0x1f1f76})[_0x84cf('0x2b')](function(_0x57f1f2){if(!_0x57f1f2){return _0x553ee2(_0x84cf('0x62'));}else{return _0x39a336(_0x57f1f2);}})[_0x84cf('0x55')](function(_0x4a7905){return _0x553ee2(_0x4a7905);});});;});};function addVoicePrefixExtensions(_0x40b33e,_0x2ff1bb){var _0x262ae1=[];var _0x286769=formatPrefixName(_0x40b33e['prefix']);_0x262ae1[_0x84cf('0x63')](new Extension(_0x286769,0x2,_0x84cf('0x64'),'CDR(prefix)='+_0x40b33e['name']));if(_0x40b33e['callerIdAll']){_0x262ae1[_0x84cf('0x63')](new Extension(_0x286769,0x3,_0x84cf('0x64'),_0x84cf('0x65')+_0x40b33e['callerIdAll']));}else{_0x262ae1['push'](new Extension(_0x286769,0x3,_0x84cf('0x5e'),_0x84cf('0x66')));}_0x262ae1[_0x84cf('0x63')](new Extension(_0x286769,0x4,_0x84cf('0x67'),_0x2ff1bb[_0x84cf('0x57')]+','+_0x84cf('0x68')+(0x8+_0x40b33e[_0x84cf('0x32')][_0x84cf('0x3c')])+'}'+','+0x1));return _0x262ae1;}function formatPrefixName(_0x4a5e79){var _0x20b930='_';for(var _0x5350d9=0x0;_0x5350d9<_0x4a5e79[_0x84cf('0x3c')];_0x5350d9++){if(_0x4a5e79[_0x84cf('0x69')](_0x5350d9)=='-'){_0x20b930+=_0x4a5e79['charAt'](_0x5350d9);}else{_0x20b930+='['+_0x4a5e79['charAt'](_0x5350d9)+']';}}_0x20b930+='.';return _0x20b930;}exports[_0x84cf('0x2a')]=function(_0x31e622,_0x373a25,_0x1c6e56){var _0xad54e8=_0x31e622['body'];_0xad54e8[_0x84cf('0x6a')]=_0x84cf('0x6b')+_0xad54e8[_0x84cf('0x32')]+'-';return db[_0x84cf('0x6c')]['transaction'](function(_0x93d687){return db['VoicePrefix']['update'](_0xad54e8,{'where':{'id':_0xad54e8['id']},'transaction':_0x93d687})[_0x84cf('0x2b')](function(){return db[_0x84cf('0x4f')][_0x84cf('0x2c')]({'where':{'VoicePrefixId':_0xad54e8['id']},'transaction':_0x93d687})[_0x84cf('0x2b')](function(){return db['VoiceExtension']['find']({'where':{'id':_0xad54e8['VoiceExtensionId']},'raw':!![]})[_0x84cf('0x2b')](function(_0x53e61f){return createVoicePrefixExtensions(_0xad54e8,_0x53e61f,_0x93d687);});});});})[_0x84cf('0x2b')](function(){return db[_0x84cf('0x34')][_0x84cf('0x6d')](_0xad54e8['id']);})[_0x84cf('0x2b')](respondWithResult(_0x373a25,null))['catch'](handleError(_0x373a25,null));};exports[_0x84cf('0x6e')]=function(_0x14ac69,_0x4e1141,_0xa373e4){return db['VoicePrefix']['find']({'where':{'id':_0x14ac69[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0x4e1141,null))['then'](function(_0x5b95b7){if(_0x5b95b7){return _0x5b95b7[_0x84cf('0x6e')](_0x14ac69['body']['ids'],_['omit'](_0x14ac69[_0x84cf('0x6f')],[_0x84cf('0x70'),'id'])||{})[_0x84cf('0x71')](function(_0x58300f){for(var _0x49e6f6=0x0;_0x49e6f6<_0x14ac69[_0x84cf('0x6f')][_0x84cf('0x70')][_0x84cf('0x3c')];_0x49e6f6+=0x1){socket[_0x84cf('0x72')]('userVoicePrefix:save',{'UserId':Number(_0x14ac69['body']['ids'][_0x49e6f6]),'VoicePrefixId':Number(_0x14ac69[_0x84cf('0x4c')]['id'])});}return _0x58300f;});}})[_0x84cf('0x2b')](respondWithResult(_0x4e1141,null))[_0x84cf('0x55')](handleError(_0x4e1141,null));};exports['removeAgents']=function(_0x20693f,_0x29d062,_0x242e39){return db[_0x84cf('0x34')][_0x84cf('0x4b')]({'where':{'id':_0x20693f['params']['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0x29d062,null))[_0x84cf('0x2b')](function(_0xc32a6f){if(_0xc32a6f){return _0xc32a6f['removeAgents'](_0x20693f[_0x84cf('0x37')][_0x84cf('0x70')])['then'](function(){if(_[_0x84cf('0x73')](_0x20693f[_0x84cf('0x37')][_0x84cf('0x70')])){for(var _0x132210=0x0;_0x132210<_0x20693f['query']['ids'][_0x84cf('0x3c')];_0x132210+=0x1){socket[_0x84cf('0x72')]('userVoicePrefix:remove',{'UserId':Number(_0x20693f['query'][_0x84cf('0x70')][_0x132210]),'VoicePrefixId':Number(_0x20693f[_0x84cf('0x4c')]['id'])});}}else{socket[_0x84cf('0x72')](_0x84cf('0x74'),{'UserId':Number(_0x20693f[_0x84cf('0x37')][_0x84cf('0x70')]),'VoicePrefixId':Number(_0x20693f[_0x84cf('0x4c')]['id'])});}});}})[_0x84cf('0x2b')](respondWithStatusCode(_0x29d062,null))['catch'](handleError(_0x29d062,null));};exports[_0x84cf('0x75')]=function(_0x2323bc,_0x1f7ecd,_0xcb28b4){var _0x4fd3f1={};var _0x3bf924={};var _0x56ea7d;var _0x3ec503;return db['VoicePrefix'][_0x84cf('0x76')]({'where':{'id':_0x2323bc[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0x1f7ecd,null))[_0x84cf('0x2b')](function(_0xc4029f){if(_0xc4029f){_0x56ea7d=_0xc4029f;_0x3bf924['model']=_[_0x84cf('0x38')](db[_0x84cf('0x77')][_0x84cf('0x4a')]);_0x3bf924[_0x84cf('0x37')]=_[_0x84cf('0x38')](_0x2323bc[_0x84cf('0x37')]);_0x3bf924[_0x84cf('0x43')]=_[_0x84cf('0x39')](_0x3bf924[_0x84cf('0x3d')],_0x3bf924[_0x84cf('0x37')]);_0x4fd3f1[_0x84cf('0x3a')]=_[_0x84cf('0x39')](_0x3bf924[_0x84cf('0x3d')],qs[_0x84cf('0x3b')](_0x2323bc[_0x84cf('0x37')][_0x84cf('0x3b')]));_0x4fd3f1[_0x84cf('0x3a')]=_0x4fd3f1[_0x84cf('0x3a')]['length']?_0x4fd3f1['attributes']:_0x3bf924[_0x84cf('0x3d')];_0x4fd3f1['order']=qs[_0x84cf('0x41')](_0x2323bc[_0x84cf('0x37')]['sort']);_0x4fd3f1[_0x84cf('0x42')]=qs[_0x84cf('0x43')](_[_0x84cf('0x78')](_0x2323bc['query'],_0x3bf924[_0x84cf('0x43')]));if(_0x2323bc['query'][_0x84cf('0x44')]){_0x4fd3f1['where']=_[_0x84cf('0x45')](_0x4fd3f1[_0x84cf('0x42')],{'$or':_['map'](_0x4fd3f1[_0x84cf('0x3a')],function(_0x10e44b){var _0xe11402={};_0xe11402[_0x10e44b]={'$like':'%'+_0x2323bc['query'][_0x84cf('0x44')]+'%'};return _0xe11402;})});}_0x4fd3f1=_['merge']({},_0x4fd3f1,_0x2323bc[_0x84cf('0x47')]);return _0x56ea7d[_0x84cf('0x75')](_0x4fd3f1);}})[_0x84cf('0x2b')](function(_0xff46d2){if(_0xff46d2){_0x3ec503=_0xff46d2[_0x84cf('0x3c')];if(!_0x2323bc[_0x84cf('0x37')]['hasOwnProperty'](_0x84cf('0x3f'))){_0x4fd3f1[_0x84cf('0x25')]=qs[_0x84cf('0x25')](_0x2323bc[_0x84cf('0x37')][_0x84cf('0x25')]);_0x4fd3f1[_0x84cf('0x22')]=qs[_0x84cf('0x22')](_0x2323bc[_0x84cf('0x37')][_0x84cf('0x22')]);}return _0x56ea7d['getAgents'](_0x4fd3f1);}})[_0x84cf('0x2b')](function(_0x4dc17f){if(_0x4dc17f){return _0x4dc17f?{'count':_0x3ec503,'rows':_0x4dc17f}:null;}})['then'](respondWithResult(_0x1f7ecd,null))[_0x84cf('0x55')](handleError(_0x1f7ecd,null));};exports[_0x84cf('0x79')]=function(_0x55da82,_0xf14418,_0x1def45){var _0x13d30b={};var _0x4dad47={};var _0x3152c2;var _0x50e088;return db[_0x84cf('0x34')][_0x84cf('0x76')]({'where':{'id':_0x55da82[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0xf14418,null))[_0x84cf('0x2b')](function(_0x3b5f14){if(_0x3b5f14){_0x3152c2=_0x3b5f14;_0x4dad47['model']=_[_0x84cf('0x38')](db[_0x84cf('0x7a')][_0x84cf('0x4a')]);_0x4dad47[_0x84cf('0x37')]=_[_0x84cf('0x38')](_0x55da82[_0x84cf('0x37')]);_0x4dad47[_0x84cf('0x43')]=_[_0x84cf('0x39')](_0x4dad47[_0x84cf('0x3d')],_0x4dad47[_0x84cf('0x37')]);_0x13d30b['attributes']=_['intersection'](_0x4dad47[_0x84cf('0x3d')],qs['fields'](_0x55da82[_0x84cf('0x37')][_0x84cf('0x3b')]));_0x13d30b[_0x84cf('0x3a')]=_0x13d30b['attributes'][_0x84cf('0x3c')]?_0x13d30b[_0x84cf('0x3a')]:_0x4dad47[_0x84cf('0x3d')];_0x13d30b[_0x84cf('0x40')]=qs['sort'](_0x55da82['query'][_0x84cf('0x41')]);_0x13d30b[_0x84cf('0x42')]=qs[_0x84cf('0x43')](_[_0x84cf('0x78')](_0x55da82[_0x84cf('0x37')],_0x4dad47[_0x84cf('0x43')]));if(_0x55da82[_0x84cf('0x37')][_0x84cf('0x44')]){_0x13d30b[_0x84cf('0x42')]=_[_0x84cf('0x45')](_0x13d30b['where'],{'$or':_[_0x84cf('0x33')](_0x13d30b[_0x84cf('0x3a')],function(_0x543607){var _0x4e9be5={};_0x4e9be5[_0x543607]={'$like':'%'+_0x55da82[_0x84cf('0x37')][_0x84cf('0x44')]+'%'};return _0x4e9be5;})});}_0x13d30b=_[_0x84cf('0x45')]({},_0x13d30b,_0x55da82[_0x84cf('0x47')]);return _0x3152c2[_0x84cf('0x79')](_0x13d30b);}})['then'](function(_0x38e27d){if(_0x38e27d){_0x50e088=_0x38e27d[_0x84cf('0x3c')];if(!_0x55da82[_0x84cf('0x37')][_0x84cf('0x3e')](_0x84cf('0x3f'))){_0x13d30b[_0x84cf('0x25')]=qs['limit'](_0x55da82[_0x84cf('0x37')][_0x84cf('0x25')]);_0x13d30b['offset']=qs['offset'](_0x55da82[_0x84cf('0x37')]['offset']);}return _0x3152c2[_0x84cf('0x79')](_0x13d30b);}})['then'](function(_0x127ac0){if(_0x127ac0){return _0x127ac0?{'count':_0x50e088,'rows':_0x127ac0}:null;}})[_0x84cf('0x2b')](respondWithResult(_0xf14418,null))[_0x84cf('0x55')](handleError(_0xf14418,null));};exports['addTeams']=function(_0x2e145c,_0x15ed32,_0x265818){var _0x57c01b=_0x2e145c[_0x84cf('0x6f')][_0x84cf('0x70')];var _0x27492c;return db[_0x84cf('0x7a')][_0x84cf('0x7b')]({'where':{'id':_0x57c01b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x84cf('0x7c'),'attributes':['id',_0x84cf('0x32'),'online',_0x84cf('0x7d'),_0x84cf('0x7e')],'raw':!![]}]})[_0x84cf('0x2b')](function(_0x188afd){if(_0x188afd){_0x27492c=_0x188afd;var _0x2d75f8=_[_0x84cf('0x7f')](_0x188afd,function(_0x5b9da4){var _0x8e16b4=_0x5b9da4[_0x84cf('0x2d')]({'plain':!![]});return _0x8e16b4[_0x84cf('0x7c')];});return db[_0x84cf('0x34')][_0x84cf('0x4b')]({'where':{'id':_0x2e145c[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](function(_0x1a083d){return db[_0x84cf('0x6c')][_0x84cf('0x80')](function(_0x5e41df){return _0x1a083d[_0x84cf('0x81')](_0x57c01b,{'transaction':_0x5e41df})[_0x84cf('0x2b')](function(){return BPromise[_0x84cf('0x82')](_0x27492c,function(_0x33fb10){return db[_0x84cf('0x83')][_0x84cf('0x84')]({'TeamId':_0x33fb10['id'],'VoicePrefixId':_0x2e145c['params']['id']},{'transaction':_0x5e41df});});})['then'](function(){return BPromise[_0x84cf('0x82')](_0x2d75f8,function(_0x166065){return db[_0x84cf('0x85')][_0x84cf('0x86')]({'where':{'UserId':_0x166065['id'],'VoicePrefixId':_0x2e145c[_0x84cf('0x4c')]['id']},'transaction':_0x5e41df});});})['then'](function(){_0x2d75f8[_0x84cf('0x87')](function(_0x4ce3ea){socket['emit']('userVoicePrefix:save',{'UserId':_0x4ce3ea['id'],'VoicePrefixId':_0x1a083d['id']});});});});});}})['then'](respondWithStatusCode(_0x15ed32,null))[_0x84cf('0x55')](handleError(_0x15ed32,null));};exports[_0x84cf('0x88')]=function(_0x5d6832,_0x502910,_0x311d7e){return db[_0x84cf('0x7a')][_0x84cf('0x7b')]({'where':{'id':_0x5d6832[_0x84cf('0x37')][_0x84cf('0x70')]},'attributes':['id'],'include':[{'model':db[_0x84cf('0x77')],'as':_0x84cf('0x7c'),'attributes':['id'],'raw':!![]}]})[_0x84cf('0x2b')](handleEntityNotFound(_0x502910,null))[_0x84cf('0x2b')](function(_0x2d17a1){var _0x5d0481=_[_0x84cf('0x33')](_0x2d17a1,'id');var _0x38c81a=[];var _0x4cb254=[];var _0x2aa96a=squel['select']();_0x2aa96a[_0x84cf('0x89')](_0x84cf('0x8a'))[_0x84cf('0x8b')]('team_has_voice_prefixes','tq')[_0x84cf('0x8c')]('user_has_teams','ut',_0x84cf('0x8d'))[_0x84cf('0x42')]('VoicePrefixId\x20=\x20?',_0x5d6832[_0x84cf('0x4c')]['id']);for(var _0x5b6ced=0x0;_0x5b6ced<_0x2d17a1[_0x84cf('0x3c')];_0x5b6ced+=0x1){let _0x202101=_0x2d17a1[_0x5b6ced];for(var _0x4b06c6=0x0;_0x4b06c6<_0x202101[_0x84cf('0x7c')][_0x84cf('0x3c')];_0x4b06c6+=0x1){let _0x3c05ec=_0x202101[_0x84cf('0x7c')][_0x4b06c6];var _0x145498=_0x2aa96a[_0x84cf('0x8e')]();_0x145498[_0x84cf('0x42')](_0x84cf('0x8f'),_0x3c05ec['id']);_0x4cb254[_0x84cf('0x63')](db[_0x84cf('0x6c')][_0x84cf('0x37')](_0x145498[_0x84cf('0x90')](),{'type':db['sequelize'][_0x84cf('0x91')][_0x84cf('0x92')]})[_0x84cf('0x2b')](function(_0x30b3c9){if(_0x30b3c9[_0x84cf('0x3c')]===0x1){return _0x3c05ec['id'];}else{var _0x562de5=_['every'](_['map'](_0x30b3c9,_0x84cf('0x93')),function(_0x55f411){return _[_0x84cf('0x94')](_0x5d0481,_0x55f411);});if(_0x562de5){return _0x3c05ec['id'];}}}));}}return BPromise[_0x84cf('0x95')](_0x4cb254)[_0x84cf('0x2b')](function(_0x5d4ece){_0x38c81a=_(_0x38c81a)[_0x84cf('0x96')](_0x5d4ece)[_0x84cf('0x97')]()[_0x84cf('0x98')]();return db['VoicePrefix']['find']({'where':{'id':_0x5d6832['params']['id']}})[_0x84cf('0x2b')](function(_0x399112){return db[_0x84cf('0x6c')][_0x84cf('0x80')](function(_0x209b79){return _0x399112['removeTeams'](_0x5d6832[_0x84cf('0x37')][_0x84cf('0x70')],{'transaction':_0x209b79})[_0x84cf('0x2b')](function(){if(!_['isEmpty'](_0x38c81a)){return _0x399112[_0x84cf('0x99')](_0x38c81a,{'transaction':_0x209b79});}})['then'](function(){_0x38c81a[_0x84cf('0x87')](function(_0x194267){socket[_0x84cf('0x72')](_0x84cf('0x74'),{'UserId':_0x194267,'VoicePrefixId':_0x399112['id']});});});});});});})['then'](respondWithStatusCode(_0x502910,null))[_0x84cf('0x55')](handleError(_0x502910,null));}; \ No newline at end of file +var _0x1c9a=['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','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','VoicePrefixes','UserProfileResource','error','stack','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','find','params','describe','sequelize','create','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','VoiceExtension','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','${EXTEN:','charAt','body','system-','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','User','filter','getAgents','getTeams','findOne','addTeams','Team','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','all','union','compact','isEmpty','eml-format','zip-dir','request-promise','moment','bluebird','util','path'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1c9a,0x98));var _0xa1c9=function(_0x276658,_0x3f5f6e){_0x276658=_0x276658-0x0;var _0x12bb75=_0x1c9a[_0x276658];return _0x12bb75;};'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'];config[_0xa1c9('0x19')]=_['defaults'](config[_0xa1c9('0x19')],{'host':_0xa1c9('0x1a'),'port':0x18eb});var socket=require(_0xa1c9('0x1b'))(new Redis(config[_0xa1c9('0x19')]));require(_0xa1c9('0x1c'))['register'](socket);function respondWithStatusCode(_0x335dda,_0x4b2fa5){_0x4b2fa5=_0x4b2fa5||0xcc;return function(_0x2cba13){if(_0x2cba13){return _0x335dda[_0xa1c9('0x1d')](_0x4b2fa5);}return _0x335dda[_0xa1c9('0x1e')](_0x4b2fa5)[_0xa1c9('0x1f')]();};}function respondWithResult(_0x44ab5b,_0x3b51f5){_0x3b51f5=_0x3b51f5||0xc8;return function(_0x1f6d26){if(_0x1f6d26){return _0x44ab5b[_0xa1c9('0x1e')](_0x3b51f5)['json'](_0x1f6d26);}};}function respondWithFilteredResult(_0x11ca10,_0x1084d2){return function(_0x224ae4){if(_0x224ae4){var _0x50db9b=typeof _0x1084d2[_0xa1c9('0x20')]==='undefined'&&typeof _0x1084d2[_0xa1c9('0x21')]===_0xa1c9('0x22');var _0x204d54=_0x224ae4['count'];var _0x3a1110=_0x50db9b?0x0:_0x1084d2[_0xa1c9('0x20')];var _0x128732=_0x50db9b?_0x224ae4['count']:_0x1084d2[_0xa1c9('0x20')]+_0x1084d2[_0xa1c9('0x21')];var _0x4c6dbb;if(_0x128732>=_0x204d54){_0x128732=_0x204d54;_0x4c6dbb=0xc8;}else{_0x4c6dbb=0xce;}_0x11ca10[_0xa1c9('0x1e')](_0x4c6dbb);return _0x11ca10[_0xa1c9('0x23')](_0xa1c9('0x24'),_0x3a1110+'-'+_0x128732+'/'+_0x204d54)['json'](_0x224ae4);}return null;};}function patchUpdates(_0x29f1b1){return function(_0x3dcec5){try{jsonpatch[_0xa1c9('0x25')](_0x3dcec5,_0x29f1b1,!![]);}catch(_0x23a461){return BPromise[_0xa1c9('0x26')](_0x23a461);}return _0x3dcec5['save']();};}function saveUpdates(_0x50b16b,_0x200749){return function(_0x50b16d){if(_0x50b16d){return _0x50b16d[_0xa1c9('0x27')](_0x50b16b)[_0xa1c9('0x28')](function(_0x1c6f37){return _0x1c6f37;});}return null;};}function removeEntity(_0x3059eb,_0x339ed1){return function(_0x522dc0){if(_0x522dc0){return _0x522dc0[_0xa1c9('0x29')]()[_0xa1c9('0x28')](function(){var _0x20cbe1=_0x522dc0['get']({'plain':!![]});var _0x133f80=_0xa1c9('0x2a');return db[_0xa1c9('0x2b')]['destroy']({'where':{'type':_0x133f80,'resourceId':_0x20cbe1['id']}})[_0xa1c9('0x28')](function(){return _0x522dc0;});})[_0xa1c9('0x28')](function(){_0x3059eb['status'](0xcc)[_0xa1c9('0x1f')]();});}};}function handleEntityNotFound(_0x48ce34,_0xdf6d0c){return function(_0x2404c3){if(!_0x2404c3){_0x48ce34[_0xa1c9('0x1d')](0x194);}return _0x2404c3;};}function handleError(_0x254b13,_0x40b9d5){_0x40b9d5=_0x40b9d5||0x1f4;return function(_0xe8523b){logger[_0xa1c9('0x2c')](_0xe8523b[_0xa1c9('0x2d')]);if(_0xe8523b['name']){delete _0xe8523b['name'];}_0x254b13[_0xa1c9('0x1e')](_0x40b9d5)[_0xa1c9('0x2e')](_0xe8523b);};}exports[_0xa1c9('0x2f')]=function(_0xf419d0,_0x3161b0){var _0x5b67c3={},_0x53f325={},_0x5aecd7={'count':0x0,'rows':[]};var _0x259ac3=_[_0xa1c9('0x30')](db[_0xa1c9('0x31')][_0xa1c9('0x32')],function(_0x39cf81){return{'name':_0x39cf81[_0xa1c9('0x33')],'type':_0x39cf81[_0xa1c9('0x34')]['key']};});_0x53f325[_0xa1c9('0x35')]=_['map'](_0x259ac3,_0xa1c9('0x36'));_0x53f325['query']=_[_0xa1c9('0x37')](_0xf419d0[_0xa1c9('0x38')]);_0x53f325[_0xa1c9('0x39')]=_['intersection'](_0x53f325[_0xa1c9('0x35')],_0x53f325[_0xa1c9('0x38')]);_0x5b67c3[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x53f325['model'],qs['fields'](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x5b67c3[_0xa1c9('0x3a')]=_0x5b67c3[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x5b67c3[_0xa1c9('0x3a')]:_0x53f325[_0xa1c9('0x35')];if(!_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x5b67c3['limit']=qs[_0xa1c9('0x21')](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x5b67c3[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0xf419d0[_0xa1c9('0x38')]['offset']);}_0x5b67c3[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0xf419d0[_0xa1c9('0x38')]['sort']);_0x5b67c3[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0xf419d0[_0xa1c9('0x38')],_0x53f325[_0xa1c9('0x39')]),_0x259ac3);if(_0xf419d0['query']['filter']){_0x5b67c3[_0xa1c9('0x42')]=_[_0xa1c9('0x43')](_0x5b67c3[_0xa1c9('0x42')],{'$or':_[_0xa1c9('0x30')](_0x259ac3,function(_0xd9e67){if(_0xd9e67[_0xa1c9('0x34')]!==_0xa1c9('0x44')){var _0x146e47={};_0x146e47[_0xd9e67[_0xa1c9('0x36')]]={'$like':'%'+_0xf419d0[_0xa1c9('0x38')]['filter']+'%'};return _0x146e47;}})});}_0x5b67c3=_['merge']({},_0x5b67c3,_0xf419d0[_0xa1c9('0x45')]);var _0x46920c={'where':_0x5b67c3['where']};return db[_0xa1c9('0x31')][_0xa1c9('0x46')](_0x46920c)[_0xa1c9('0x28')](function(_0x36c846){_0x5aecd7[_0xa1c9('0x46')]=_0x36c846;if(_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x5b67c3[_0xa1c9('0x48')]=[{'all':!![]}];}return db[_0xa1c9('0x31')][_0xa1c9('0x49')](_0x5b67c3);})[_0xa1c9('0x28')](function(_0x50cc27){_0x5aecd7[_0xa1c9('0x4a')]=_0x50cc27;return _0x5aecd7;})['then'](respondWithFilteredResult(_0x3161b0,_0x5b67c3))[_0xa1c9('0x4b')](handleError(_0x3161b0,null));};exports['show']=function(_0x42be67,_0x4a9e02){var _0x43598b={'raw':![],'where':{'id':_0x42be67['params']['id']}},_0x18bb43={};_0x18bb43[_0xa1c9('0x35')]=_[_0xa1c9('0x37')](db['VoicePrefix'][_0xa1c9('0x32')]);_0x18bb43[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x42be67[_0xa1c9('0x38')]);_0x18bb43[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x18bb43['model'],_0x18bb43[_0xa1c9('0x38')]);_0x43598b[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x18bb43[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x42be67['query']['fields']));_0x43598b['attributes']=_0x43598b[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x43598b[_0xa1c9('0x3a')]:_0x18bb43['model'];if(_0x42be67[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x43598b['include']=[{'all':!![]}];}_0x43598b=_[_0xa1c9('0x43')]({},_0x43598b,_0x42be67['options']);return db['VoicePrefix'][_0xa1c9('0x4c')](_0x43598b)[_0xa1c9('0x28')](handleEntityNotFound(_0x4a9e02,null))[_0xa1c9('0x28')](respondWithResult(_0x4a9e02,null))[_0xa1c9('0x4b')](handleError(_0x4a9e02,null));};exports[_0xa1c9('0x29')]=function(_0x31fbb8,_0x18aa46){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x31fbb8[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x18aa46,null))[_0xa1c9('0x28')](removeEntity(_0x18aa46,null))[_0xa1c9('0x4b')](handleError(_0x18aa46,null));};exports[_0xa1c9('0x4e')]=function(_0x149450,_0x112f82){return db[_0xa1c9('0x31')][_0xa1c9('0x4e')]()[_0xa1c9('0x28')](respondWithResult(_0x112f82,null))['catch'](handleError(_0x112f82,null));};exports['create']=function(_0x12118e,_0x6160fc){var _0x66a5eb;return db[_0xa1c9('0x4f')]['transaction'](function(_0x449e85){return db[_0xa1c9('0x31')][_0xa1c9('0x50')](_0x12118e['body'],{'transaction':_0x449e85})[_0xa1c9('0x28')](function(_0x3f650a){_0x66a5eb=_0x3f650a['get']({'plain':!![]});return db['VoiceExtension'][_0xa1c9('0x4c')]({'where':{'id':_0x66a5eb['VoiceExtensionId']},'raw':!![]})[_0xa1c9('0x28')](function(_0x1bd5c7){return createVoicePrefixExtensions(_0x66a5eb,_0x1bd5c7,_0x449e85);});});})[_0xa1c9('0x28')](function(){var _0x4c1165=_0x12118e['user'][_0xa1c9('0x51')]({'plain':!![]});if(!_0x4c1165)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c1165[_0xa1c9('0x52')]==='user'){var _0x3334ad=_0x66a5eb;return db[_0xa1c9('0x53')][_0xa1c9('0x4c')]({'where':{'name':_0xa1c9('0x2a'),'userProfileId':_0x4c1165[_0xa1c9('0x54')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x3917ed){if(_0x3917ed&&_0x3917ed['autoAssociation']===0x0){return db[_0xa1c9('0x2b')][_0xa1c9('0x50')]({'name':_0x3334ad['name'],'resourceId':_0x3334ad['id'],'type':_0x3917ed['name'],'sectionId':_0x3917ed['id']},{})['then'](function(){return _0x66a5eb;});}else{return _0x66a5eb;}})[_0xa1c9('0x4b')](function(_0x55fe87){logger[_0xa1c9('0x2c')](_0xa1c9('0x55'),_0x55fe87);throw _0x55fe87;});}return _0x66a5eb;})[_0xa1c9('0x28')](respondWithResult(_0x6160fc,null))[_0xa1c9('0x4b')](handleError(_0x6160fc,null));};function Extension(_0x2f0c80,_0x5b81f4,_0x4bf711,_0x48950c){this['context']=_0xa1c9('0x56');this[_0xa1c9('0x57')]=_0x2f0c80;this[_0xa1c9('0x58')]=_0x4bf711;this[_0xa1c9('0x34')]=_0xa1c9('0x59');this[_0xa1c9('0x5a')]=_0xa1c9('0x5b');this[_0xa1c9('0x5c')]=_0x5b81f4;this[_0xa1c9('0x5d')]=_0x48950c;}function createVoicePrefixExtensions(_0x317799,_0x4639cf,_0xef5d24){return new BPromise(function(_0x288267,_0x29d833){var _0x51f675=new Extension(formatPrefixName(_0x317799[_0xa1c9('0x5e')]),0x1,_0xa1c9('0x5f'),_0xa1c9('0x60'));_0x51f675[_0xa1c9('0x61')]=_0x317799['id'];return db['VoiceExtension'][_0xa1c9('0x50')](_0x51f675,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x1b2cff){var _0x39ffed=_0x1b2cff['get']({'plain':!![]});var _0x4b9aa8=_[_0xa1c9('0x30')](addVoicePrefixExtensions(_0x317799,_0x4639cf),function(_0x2a89d2){_0x2a89d2[_0xa1c9('0x62')]=_0x39ffed['id'];_0x2a89d2[_0xa1c9('0x61')]=_0x317799['id'];return _0x2a89d2;});return db[_0xa1c9('0x63')]['bulkCreate'](_0x4b9aa8,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x21abdf){if(!_0x21abdf){return _0x29d833(_0xa1c9('0x64'));}else{return _0x288267(_0x21abdf);}})[_0xa1c9('0x4b')](function(_0x5ba7aa){return _0x29d833(_0x5ba7aa);});});;});};function addVoicePrefixExtensions(_0x37613f,_0x17d848){var _0xa18fa4=[];var _0x5a5c65=formatPrefixName(_0x37613f[_0xa1c9('0x5e')]);_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x2,'Set',_0xa1c9('0x66')+_0x37613f[_0xa1c9('0x36')]));if(_0x37613f[_0xa1c9('0x67')]){_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x68'),_0xa1c9('0x69')+_0x37613f[_0xa1c9('0x67')]));}else{_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x5f'),_0xa1c9('0x6a')));}_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x4,'goto',_0x17d848[_0xa1c9('0x6b')]+','+_0xa1c9('0x6c')+(0x8+_0x37613f[_0xa1c9('0x36')][_0xa1c9('0x3d')])+'}'+','+0x1));return _0xa18fa4;}function formatPrefixName(_0x5961aa){var _0x358481='_';for(var _0xdbc56a=0x0;_0xdbc56a<_0x5961aa[_0xa1c9('0x3d')];_0xdbc56a++){if(_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)=='-'){_0x358481+=_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a);}else{_0x358481+='['+_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)+']';}}_0x358481+='.';return _0x358481;}exports[_0xa1c9('0x27')]=function(_0x27048c,_0xb24e0b,_0x178e47){var _0x1fec82=_0x27048c[_0xa1c9('0x6e')];_0x1fec82[_0xa1c9('0x5e')]=_0xa1c9('0x6f')+_0x1fec82['name']+'-';return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x1f219d){return db[_0xa1c9('0x31')][_0xa1c9('0x27')](_0x1fec82,{'where':{'id':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['destroy']({'where':{'VoicePrefixId':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['find']({'where':{'id':_0x1fec82[_0xa1c9('0x62')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x150d76){return createVoicePrefixExtensions(_0x1fec82,_0x150d76,_0x1f219d);});});});})[_0xa1c9('0x28')](function(){return db['VoicePrefix'][_0xa1c9('0x71')](_0x1fec82['id']);})['then'](respondWithResult(_0xb24e0b,null))['catch'](handleError(_0xb24e0b,null));};exports[_0xa1c9('0x72')]=function(_0x134d3f,_0x40f420,_0x423c58){return db['VoicePrefix'][_0xa1c9('0x4c')]({'where':{'id':_0x134d3f[_0xa1c9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x40f420,null))[_0xa1c9('0x28')](function(_0x464da9){if(_0x464da9){return _0x464da9[_0xa1c9('0x72')](_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')],_[_0xa1c9('0x74')](_0x134d3f['body'],['ids','id'])||{})[_0xa1c9('0x75')](function(_0x52e78b){for(var _0x3de2c7=0x0;_0x3de2c7<_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3de2c7+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':Number(_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0x3de2c7]),'VoicePrefixId':Number(_0x134d3f[_0xa1c9('0x4d')]['id'])});}return _0x52e78b;});}})['then'](respondWithResult(_0x40f420,null))[_0xa1c9('0x4b')](handleError(_0x40f420,null));};exports['removeAgents']=function(_0x4a8841,_0x8bc83d,_0x518811){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x4a8841[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x8bc83d,null))[_0xa1c9('0x28')](function(_0x2a17b7){if(_0x2a17b7){return _0x2a17b7[_0xa1c9('0x78')](_0x4a8841['query'][_0xa1c9('0x73')])[_0xa1c9('0x28')](function(){if(_[_0xa1c9('0x79')](_0x4a8841['query']['ids'])){for(var _0x3f4f76=0x0;_0x3f4f76<_0x4a8841['query'][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3f4f76+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841['query'][_0xa1c9('0x73')][_0x3f4f76]),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}}else{socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841[_0xa1c9('0x38')]['ids']),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x8bc83d,null))[_0xa1c9('0x4b')](handleError(_0x8bc83d,null));};exports['getAgents']=function(_0x3936cb,_0x175662,_0x134935){var _0x197721={};var _0x7281bd={};var _0x35a356;var _0x53ea3b;return db[_0xa1c9('0x31')]['findOne']({'where':{'id':_0x3936cb[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x175662,null))['then'](function(_0x28d323){if(_0x28d323){_0x35a356=_0x28d323;_0x7281bd['model']=_[_0xa1c9('0x37')](db[_0xa1c9('0x7b')][_0xa1c9('0x32')]);_0x7281bd[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x3936cb[_0xa1c9('0x38')]);_0x7281bd[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],_0x7281bd[_0xa1c9('0x38')]);_0x197721[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x197721['attributes']=_0x197721['attributes'][_0xa1c9('0x3d')]?_0x197721[_0xa1c9('0x3a')]:_0x7281bd[_0xa1c9('0x35')];_0x197721['order']=qs[_0xa1c9('0x41')](_0x3936cb['query']['sort']);_0x197721[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x3936cb[_0xa1c9('0x38')],_0x7281bd['filters']));if(_0x3936cb['query'][_0xa1c9('0x7c')]){_0x197721['where']=_[_0xa1c9('0x43')](_0x197721[_0xa1c9('0x42')],{'$or':_['map'](_0x197721[_0xa1c9('0x3a')],function(_0x1277eb){var _0x88cb2c={};_0x88cb2c[_0x1277eb]={'$like':'%'+_0x3936cb[_0xa1c9('0x38')]['filter']+'%'};return _0x88cb2c;})});}_0x197721=_[_0xa1c9('0x43')]({},_0x197721,_0x3936cb[_0xa1c9('0x45')]);return _0x35a356[_0xa1c9('0x7d')](_0x197721);}})[_0xa1c9('0x28')](function(_0x465162){if(_0x465162){_0x53ea3b=_0x465162[_0xa1c9('0x3d')];if(!_0x3936cb['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x197721['limit']=qs['limit'](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x197721[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x20')]);}return _0x35a356['getAgents'](_0x197721);}})[_0xa1c9('0x28')](function(_0x4deadc){if(_0x4deadc){return _0x4deadc?{'count':_0x53ea3b,'rows':_0x4deadc}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x175662,null))[_0xa1c9('0x4b')](handleError(_0x175662,null));};exports[_0xa1c9('0x7e')]=function(_0x59bc9f,_0x1c8a80,_0x2780b7){var _0x26f241={};var _0x537f48={};var _0x4e1e2f;var _0x46d8d1;return db['VoicePrefix'][_0xa1c9('0x7f')]({'where':{'id':_0x59bc9f['params']['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x1c8a80,null))[_0xa1c9('0x28')](function(_0x2d2374){if(_0x2d2374){_0x4e1e2f=_0x2d2374;_0x537f48['model']=_['keys'](db['Team'][_0xa1c9('0x32')]);_0x537f48[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x59bc9f[_0xa1c9('0x38')]);_0x537f48['filters']=_['intersection'](_0x537f48[_0xa1c9('0x35')],_0x537f48['query']);_0x26f241[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x537f48[_0xa1c9('0x35')],qs['fields'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x26f241[_0xa1c9('0x3a')]=_0x26f241[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x26f241[_0xa1c9('0x3a')]:_0x537f48[_0xa1c9('0x35')];_0x26f241[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0x59bc9f[_0xa1c9('0x38')]['sort']);_0x26f241[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x59bc9f[_0xa1c9('0x38')],_0x537f48[_0xa1c9('0x39')]));if(_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x7c')]){_0x26f241[_0xa1c9('0x42')]=_['merge'](_0x26f241[_0xa1c9('0x42')],{'$or':_['map'](_0x26f241[_0xa1c9('0x3a')],function(_0x2c04c5){var _0x137a58={};_0x137a58[_0x2c04c5]={'$like':'%'+_0x59bc9f['query'][_0xa1c9('0x7c')]+'%'};return _0x137a58;})});}_0x26f241=_[_0xa1c9('0x43')]({},_0x26f241,_0x59bc9f[_0xa1c9('0x45')]);return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x328fa7){if(_0x328fa7){_0x46d8d1=_0x328fa7[_0xa1c9('0x3d')];if(!_0x59bc9f['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x26f241[_0xa1c9('0x21')]=qs['limit'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x26f241['offset']=qs[_0xa1c9('0x20')](_0x59bc9f['query'][_0xa1c9('0x20')]);}return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x3e5016){if(_0x3e5016){return _0x3e5016?{'count':_0x46d8d1,'rows':_0x3e5016}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x1c8a80,null))['catch'](handleError(_0x1c8a80,null));};exports[_0xa1c9('0x80')]=function(_0xabacf1,_0x38a7fc,_0x2a3082){var _0x276c98=_0xabacf1[_0xa1c9('0x6e')][_0xa1c9('0x73')];var _0x48520d;return db[_0xa1c9('0x81')][_0xa1c9('0x49')]({'where':{'id':_0x276c98},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id','name',_0xa1c9('0x83'),_0xa1c9('0x84'),'interface'],'raw':!![]}]})[_0xa1c9('0x28')](function(_0x2a82fd){if(_0x2a82fd){_0x48520d=_0x2a82fd;var _0x419cf2=_[_0xa1c9('0x85')](_0x2a82fd,function(_0x51884d){var _0x52360b=_0x51884d[_0xa1c9('0x51')]({'plain':!![]});return _0x52360b['Agents'];});return db[_0xa1c9('0x31')]['find']({'where':{'id':_0xabacf1['params']['id']}})[_0xa1c9('0x28')](function(_0x507b2a){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x296607){return _0x507b2a[_0xa1c9('0x80')](_0x276c98,{'transaction':_0x296607})[_0xa1c9('0x28')](function(){return BPromise[_0xa1c9('0x86')](_0x48520d,function(_0x531c20){return db[_0xa1c9('0x87')]['upsert']({'TeamId':_0x531c20['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},{'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){return BPromise['each'](_0x419cf2,function(_0x110617){return db[_0xa1c9('0x88')][_0xa1c9('0x89')]({'where':{'UserId':_0x110617['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){_0x419cf2[_0xa1c9('0x8a')](function(_0x5640bb){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':_0x5640bb['id'],'VoicePrefixId':_0x507b2a['id']});});});});});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x38a7fc,null))['catch'](handleError(_0x38a7fc,null));};exports[_0xa1c9('0x8b')]=function(_0x4c8c5e,_0x3cb7d4,_0x5c504c){return db['Team'][_0xa1c9('0x49')]({'where':{'id':_0x4c8c5e['query'][_0xa1c9('0x73')]},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id'],'raw':!![]}]})[_0xa1c9('0x28')](handleEntityNotFound(_0x3cb7d4,null))['then'](function(_0x4423e8){var _0x2c75e6=_['map'](_0x4423e8,'id');var _0x163589=[];var _0x5f3e31=[];var _0x6e0efe=squel[_0xa1c9('0x8c')]();_0x6e0efe[_0xa1c9('0x8d')](_0xa1c9('0x8e'))[_0xa1c9('0x8f')](_0xa1c9('0x90'),'tq')[_0xa1c9('0x91')](_0xa1c9('0x92'),'ut',_0xa1c9('0x93'))[_0xa1c9('0x42')](_0xa1c9('0x94'),_0x4c8c5e[_0xa1c9('0x4d')]['id']);for(var _0x2953bd=0x0;_0x2953bd<_0x4423e8['length'];_0x2953bd+=0x1){let _0x28050b=_0x4423e8[_0x2953bd];for(var _0x3f998a=0x0;_0x3f998a<_0x28050b['Agents'][_0xa1c9('0x3d')];_0x3f998a+=0x1){let _0x12cdd5=_0x28050b[_0xa1c9('0x82')][_0x3f998a];var _0x1c5baa=_0x6e0efe[_0xa1c9('0x95')]();_0x1c5baa[_0xa1c9('0x42')](_0xa1c9('0x96'),_0x12cdd5['id']);_0x5f3e31[_0xa1c9('0x65')](db['sequelize']['query'](_0x1c5baa[_0xa1c9('0x97')](),{'type':db[_0xa1c9('0x4f')]['QueryTypes']['SELECT']})['then'](function(_0x5c9f06){if(_0x5c9f06['length']===0x1){return _0x12cdd5['id'];}else{var _0x4d6b40=_[_0xa1c9('0x98')](_[_0xa1c9('0x30')](_0x5c9f06,_0xa1c9('0x99')),function(_0x20c454){return _[_0xa1c9('0x9a')](_0x2c75e6,_0x20c454);});if(_0x4d6b40){return _0x12cdd5['id'];}}}));}}return BPromise[_0xa1c9('0x9b')](_0x5f3e31)['then'](function(_0x22fde9){_0x163589=_(_0x163589)[_0xa1c9('0x9c')](_0x22fde9)[_0xa1c9('0x9d')]()['value']();return db[_0xa1c9('0x31')]['find']({'where':{'id':_0x4c8c5e['params']['id']}})[_0xa1c9('0x28')](function(_0x3e67f4){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x52905a){return _0x3e67f4[_0xa1c9('0x8b')](_0x4c8c5e[_0xa1c9('0x38')][_0xa1c9('0x73')],{'transaction':_0x52905a})[_0xa1c9('0x28')](function(){if(!_[_0xa1c9('0x9e')](_0x163589)){return _0x3e67f4['removeAgents'](_0x163589,{'transaction':_0x52905a});}})[_0xa1c9('0x28')](function(){_0x163589['forEach'](function(_0x424be7){socket[_0xa1c9('0x76')]('userVoicePrefix:remove',{'UserId':_0x424be7,'VoicePrefixId':_0x3e67f4['id']});});});});});});})[_0xa1c9('0x28')](respondWithStatusCode(_0x3cb7d4,null))[_0xa1c9('0x4b')](handleError(_0x3cb7d4,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 653ce23..02a7d02 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 _0x36dd=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix'];(function(_0x480529,_0x227832){var _0x586251=function(_0x13283a){while(--_0x13283a){_0x480529['push'](_0x480529['shift']());}};_0x586251(++_0x227832);}(_0x36dd,0x6b));var _0xd36d=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x36dd[_0xbd08b4];return _0x314f1e;};'use strict';var EventEmitter=require(_0xd36d('0x0'));var VoicePrefix=require(_0xd36d('0x1'))['db'][_0xd36d('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd36d('0x3')](0x0);var events={'afterCreate':_0xd36d('0x4'),'afterUpdate':_0xd36d('0x5'),'afterDestroy':_0xd36d('0x6')};function emitEvent(_0x1946d2){return function(_0x588e16,_0x3240c7,_0x448296){VoicePrefixEvents[_0xd36d('0x7')](_0x1946d2+':'+_0x588e16['id'],_0x588e16);VoicePrefixEvents[_0xd36d('0x7')](_0x1946d2,_0x588e16);_0x448296(null);};}for(var e in events){if(events[_0xd36d('0x8')](e)){var event=events[e];VoicePrefix[_0xd36d('0x9')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xb68f=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x22e6b4,_0x174b0d){var _0x48aaa5=function(_0x284f3a){while(--_0x284f3a){_0x22e6b4['push'](_0x22e6b4['shift']());}};_0x48aaa5(++_0x174b0d);}(_0xb68f,0xb0));var _0xfb68=function(_0x1f29fa,_0x31ece8){_0x1f29fa=_0x1f29fa-0x0;var _0x3eb5dd=_0xb68f[_0x1f29fa];return _0x3eb5dd;};'use strict';var EventEmitter=require(_0xfb68('0x0'));var VoicePrefix=require(_0xfb68('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xfb68('0x2')](0x0);var events={'afterCreate':_0xfb68('0x3'),'afterUpdate':_0xfb68('0x4'),'afterDestroy':_0xfb68('0x5')};function emitEvent(_0x4eb4ca){return function(_0x58d4cd,_0xe13d81,_0x1b6ca0){VoicePrefixEvents['emit'](_0x4eb4ca+':'+_0x58d4cd['id'],_0x58d4cd);VoicePrefixEvents[_0xfb68('0x6')](_0x4eb4ca,_0x58d4cd);_0x1b6ca0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xfb68('0x7')](e,emitEvent(event));}}module[_0xfb68('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index bfa1ca1..0694d24 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 _0xf5e3=['./voicePrefix.attributes','exports','define','voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x3e09d3,_0x3199e3){var _0x16d05c=function(_0x569009){while(--_0x569009){_0x3e09d3['push'](_0x3e09d3['shift']());}};_0x16d05c(++_0x3199e3);}(_0xf5e3,0x160));var _0x3f5e=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0xf5e3[_0x1cbcf1];return _0x3a06f0;};'use strict';var _=require(_0x3f5e('0x0'));var util=require(_0x3f5e('0x1'));var logger=require(_0x3f5e('0x2'))(_0x3f5e('0x3'));var moment=require(_0x3f5e('0x4'));var BPromise=require('bluebird');var rp=require(_0x3f5e('0x5'));var fs=require('fs');var path=require(_0x3f5e('0x6'));var rimraf=require('rimraf');var config=require(_0x3f5e('0x7'));var attributes=require(_0x3f5e('0x8'));module[_0x3f5e('0x9')]=function(_0x66fe96,_0x1b7b8c){return _0x66fe96[_0x3f5e('0xa')]('VoicePrefix',attributes,{'tableName':_0x3f5e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a35=['bluebird','request-promise','path','../../config/environment','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment'];(function(_0x11a694,_0x16854a){var _0x10b5b9=function(_0x224052){while(--_0x224052){_0x11a694['push'](_0x11a694['shift']());}};_0x10b5b9(++_0x16854a);}(_0x8a35,0x1e9));var _0x58a3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8a35[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x58a3('0x0'));var util=require(_0x58a3('0x1'));var logger=require(_0x58a3('0x2'))(_0x58a3('0x3'));var moment=require(_0x58a3('0x4'));var BPromise=require(_0x58a3('0x5'));var rp=require(_0x58a3('0x6'));var fs=require('fs');var path=require(_0x58a3('0x7'));var rimraf=require('rimraf');var config=require(_0x58a3('0x8'));var attributes=require('./voicePrefix.attributes');module[_0x58a3('0x9')]=function(_0x373ecb,_0x51cf38){return _0x373ecb[_0x58a3('0xa')](_0x58a3('0xb'),attributes,{'tableName':_0x58a3('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 7727089..a0edf1f 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 _0x1203=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','VoicePrefix,\x20%s,\x20%s','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x51c657,_0x58d926){var _0x1c4198=function(_0x7c4f9d){while(--_0x7c4f9d){_0x51c657['push'](_0x51c657['shift']());}};_0x1c4198(++_0x58d926);}(_0x1203,0x8c));var _0x3120=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1203[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3120('0x0'));var util=require(_0x3120('0x1'));var moment=require(_0x3120('0x2'));var BPromise=require(_0x3120('0x3'));var rs=require(_0x3120('0x4'));var fs=require('fs');var Redis=require(_0x3120('0x5'));var db=require(_0x3120('0x6'))['db'];var utils=require(_0x3120('0x7'));var logger=require(_0x3120('0x8'))(_0x3120('0x9'));var config=require(_0x3120('0xa'));var jayson=require(_0x3120('0xb'));var client=jayson[_0x3120('0xc')][_0x3120('0xd')]({'port':0x232a});config[_0x3120('0xe')]=_[_0x3120('0xf')](config['redis'],{'host':_0x3120('0x10'),'port':0x18eb});var socket=require(_0x3120('0x11'))(new Redis(config['redis']));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x6ee01b,_0x39f834,_0x5b2ae3){return new BPromise(function(_0x1493fd,_0x5d0ba8){return client[_0x3120('0x12')](_0x6ee01b,_0x5b2ae3)[_0x3120('0x13')](function(_0x492cda){logger[_0x3120('0x14')](_0x3120('0x15'),_0x39f834,'request\x20sent');logger['debug'](_0x3120('0x16'),_0x39f834,_0x3120('0x17'),JSON[_0x3120('0x18')](_0x492cda));if(_0x492cda[_0x3120('0x19')]){if(_0x492cda[_0x3120('0x19')][_0x3120('0x1a')]===0x1f4){logger[_0x3120('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x39f834,_0x492cda[_0x3120('0x19')][_0x3120('0x1b')]);return _0x5d0ba8(_0x492cda[_0x3120('0x19')][_0x3120('0x1b')]);}logger[_0x3120('0x19')](_0x3120('0x15'),_0x39f834,_0x492cda[_0x3120('0x19')]['message']);return _0x1493fd(_0x492cda[_0x3120('0x19')]['message']);}else{logger[_0x3120('0x14')](_0x3120('0x15'),_0x39f834,_0x3120('0x17'));_0x1493fd(_0x492cda[_0x3120('0x1c')][_0x3120('0x1b')]);}})[_0x3120('0x1d')](function(_0x50429){logger['error'](_0x3120('0x15'),_0x39f834,_0x50429);_0x5d0ba8(_0x50429);});});} \ No newline at end of file +var _0xe3da=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment'];(function(_0x1fbe59,_0x45dd45){var _0x315b32=function(_0x403fe){while(--_0x403fe){_0x1fbe59['push'](_0x1fbe59['shift']());}};_0x315b32(++_0x45dd45);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});config[_0xae3d('0xe')]=_[_0xae3d('0xf')](config['redis'],{'host':_0xae3d('0x10'),'port':0x18eb});var socket=require(_0xae3d('0x11'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xae3d('0x12')](socket);function respondWithRpcPromise(_0x157a3e,_0x420e28,_0x124833){return new BPromise(function(_0x2705b8,_0x15d6da){return client['request'](_0x157a3e,_0x124833)[_0xae3d('0x13')](function(_0x49fe58){logger[_0xae3d('0x14')](_0xae3d('0x15'),_0x420e28,_0xae3d('0x16'));logger[_0xae3d('0x17')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x420e28,_0xae3d('0x16'),JSON[_0xae3d('0x18')](_0x49fe58));if(_0x49fe58[_0xae3d('0x19')]){if(_0x49fe58[_0xae3d('0x19')][_0xae3d('0x1a')]===0x1f4){logger[_0xae3d('0x19')](_0xae3d('0x15'),_0x420e28,_0x49fe58['error'][_0xae3d('0x1b')]);return _0x15d6da(_0x49fe58[_0xae3d('0x19')][_0xae3d('0x1b')]);}logger[_0xae3d('0x19')](_0xae3d('0x15'),_0x420e28,_0x49fe58[_0xae3d('0x19')]['message']);return _0x2705b8(_0x49fe58[_0xae3d('0x19')][_0xae3d('0x1b')]);}else{logger[_0xae3d('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x420e28,_0xae3d('0x16'));_0x2705b8(_0x49fe58[_0xae3d('0x1c')]['message']);}})['catch'](function(_0x8a37cc){logger[_0xae3d('0x19')](_0xae3d('0x15'),_0x420e28,_0x8a37cc);_0x15d6da(_0x8a37cc);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 47d58cf..f3c754c 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 _0x44f8=['remove','update','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x329905,_0x13c144){var _0x3aa42=function(_0x2fac43){while(--_0x2fac43){_0x329905['push'](_0x329905['shift']());}};_0x3aa42(++_0x13c144);}(_0x44f8,0x1de));var _0x844f=function(_0xf53e05,_0x4e603d){_0xf53e05=_0xf53e05-0x0;var _0xbcb5c8=_0x44f8[_0xf53e05];return _0xbcb5c8;};'use strict';var VoicePrefixEvents=require(_0x844f('0x0'));var events=[_0x844f('0x1'),_0x844f('0x2'),_0x844f('0x3')];function createListener(_0x8193a3,_0x24561f){return function(_0x4aad74){_0x24561f['emit'](_0x8193a3,_0x4aad74);};}function removeListener(_0x26151e,_0x5cd939){return function(){VoicePrefixEvents['removeListener'](_0x26151e,_0x5cd939);};}exports['register']=function(_0xe654ca){for(var _0x2cd42=0x0,_0x46eb2c=events[_0x844f('0x4')];_0x2cd42<_0x46eb2c;_0x2cd42++){var _0x37b697=events[_0x2cd42];var _0x1987a9=createListener(_0x844f('0x5')+_0x37b697,_0xe654ca);VoicePrefixEvents['on'](_0x37b697,_0x1987a9);}}; \ No newline at end of file +var _0x8efc=['emit','removeListener','register','length','save','remove','update'];(function(_0x25f3a7,_0x58ec8b){var _0x5a5d9b=function(_0x301d5f){while(--_0x301d5f){_0x25f3a7['push'](_0x25f3a7['shift']());}};_0x5a5d9b(++_0x58ec8b);}(_0x8efc,0xb3));var _0xc8ef=function(_0x24b477,_0x30393b){_0x24b477=_0x24b477-0x0;var _0x4041a6=_0x8efc[_0x24b477];return _0x4041a6;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xc8ef('0x0'),_0xc8ef('0x1'),_0xc8ef('0x2')];function createListener(_0x1753d9,_0x517faf){return function(_0x2e2c8f){_0x517faf[_0xc8ef('0x3')](_0x1753d9,_0x2e2c8f);};}function removeListener(_0x33b9c9,_0x50d1f6){return function(){VoicePrefixEvents[_0xc8ef('0x4')](_0x33b9c9,_0x50d1f6);};}exports[_0xc8ef('0x5')]=function(_0x1cd466){for(var _0x13b433=0x0,_0x576ff9=events[_0xc8ef('0x6')];_0x13b433<_0x576ff9;_0x13b433++){var _0x3d06cd=events[_0x13b433];var _0x1c8931=createListener('voicePrefix:'+_0x3d06cd,_0x1cd466);VoicePrefixEvents['on'](_0x3d06cd,_0x1c8931);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 77ec24e..8d2b8c8 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(_0x47604d,_0x15a014){var _0x388e4c=function(_0x42a446){while(--_0x42a446){_0x47604d['push'](_0x47604d['shift']());}};_0x388e4c(++_0x15a014);}(_0xb10b,0x12a));var _0xbb10=function(_0x1d219c,_0x50820a){_0x1d219c=_0x1d219c-0x0;var _0x3d9fde=_0xb10b[_0x1d219c];return _0x3d9fde;};'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(_0x24bfd6,_0x40e032){var _0x4f46c1=function(_0x374cd1){while(--_0x374cd1){_0x24bfd6['push'](_0x24bfd6['shift']());}};_0x4f46c1(++_0x40e032);}(_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'));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 d11d149..dc9efec 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 _0xb891=['Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','ENUM','inbound','outbound','STRING','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','type','getDataValue','dialMethod','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','periodic_announce','join','joinempty','leavewhenempty','split','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).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x63284e,_0x1dc83d){var _0x977884=function(_0xcdb3a){while(--_0xcdb3a){_0x63284e['push'](_0x63284e['shift']());}};_0x977884(++_0x1dc83d);}(_0xb891,0x1e2));var _0x1b89=function(_0x1fc628,_0xf851bf){_0x1fc628=_0x1fc628-0x0;var _0x166624=_0xb891[_0x1fc628];return _0x166624;};'use strict';var Sequelize=require(_0x1b89('0x0'));module[_0x1b89('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1b89('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x4'),_0x1b89('0x5')),'allowNull':![],'defaultValue':_0x1b89('0x4')},'musiconhold':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0x1b89('0x7'),_0x1b89('0x8'),_0x1b89('0x9'),_0x1b89('0xa'),_0x1b89('0xb'),_0x1b89('0xc'),_0x1b89('0xd')),'allowNull':![],'defaultValue':_0x1b89('0xe'),'set':function(_0x48a348){this[_0x1b89('0xf')](_0x1b89('0x10'),_0x48a348?_0x48a348:'rrmemory');},'get':function(){var _0x11160c=this['getDataValue'](_0x1b89('0x11'));var _0x24322d=this[_0x1b89('0x12')](_0x1b89('0x13'));var _0x4d11bd=this['getDataValue'](_0x1b89('0x10'));if(_0x11160c===_0x1b89('0x4')){return _0x4d11bd;}if(_0x24322d==='booked'&&_0x4d11bd===_0x1b89('0xa')||_0x24322d==='booked'&&_0x4d11bd===_0x1b89('0x14')){return _0x4d11bd;}if(_0x24322d===_0x1b89('0x15')||_0x24322d===_0x1b89('0x16')||_0x24322d===_0x1b89('0x17')){return _0x4d11bd;}return null;}},'servicelevel':{'type':Sequelize[_0x1b89('0x18')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x1b89('0x18')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1b89('0x6')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x1b89('0x18')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1b89('0x3')]('yes','no'),'defaultValue':_0x1b89('0x19')},'autopause':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no',_0x1b89('0x1a')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1b89('0x18')](0xb)},'autopausebusy':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x1b89('0x18')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1b89('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x1b89('0x6')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x1b89('0x6')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x1b89('0x18')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x1b89('0x18')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no'),'defaultValue':_0x1b89('0x19')},'announce_holdtime':{'type':Sequelize[_0x1b89('0x3')]('yes','no',_0x1b89('0x1b')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no')},'announce_position_limit':{'type':Sequelize[_0x1b89('0x18')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x1b89('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x1b89('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x1b89('0x6')]},'queue_quantity2':{'type':Sequelize[_0x1b89('0x6')]},'queue_periodic_announce':{'type':Sequelize[_0x1b89('0x6')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x25b867){this[_0x1b89('0xf')](_0x1b89('0x1c'),_0x25b867?_0x25b867[_0x1b89('0x1d')](','):[]);},'get':function(){return this[_0x1b89('0x12')](_0x1b89('0x1c'))?this['getDataValue'](_0x1b89('0x1c'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':'yes','set':function(_0x225614){this['setDataValue'](_0x1b89('0x1e'),_0x225614?_0x225614['join'](','):undefined);},'get':function(){return this[_0x1b89('0x12')](_0x1b89('0x1e'))?this[_0x1b89('0x12')](_0x1b89('0x1e'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0xacffae){this[_0x1b89('0xf')]('leavewhenempty',_0xacffae?_0xacffae['join'](','):undefined);},'get':function(){return this[_0x1b89('0x12')](_0x1b89('0x1f'))?this[_0x1b89('0x12')](_0x1b89('0x1f'))[_0x1b89('0x20')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x19'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x1b89('0x18')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x1b89('0x6')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x1b89('0x21')],'defaultValue':0x0,'set':function(_0x2f75ac){this[_0x1b89('0xf')](_0x1b89('0x22'),_0x2f75ac);if(_0x2f75ac){if(this['getDataValue'](_0x1b89('0x23'))<0x2){this[_0x1b89('0xf')](_0x1b89('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x1b89('0x18')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1b89('0x21')],'defaultValue':0x0,'comment':_0x1b89('0x24')},'dialMethod':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x25'),'progressive',_0x1b89('0x17'),_0x1b89('0x16'),'booked'),'defaultValue':_0x1b89('0x15'),'comment':_0x1b89('0x26')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x1b89('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x1b89('0x18')](0x4)[_0x1b89('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1b89('0x28')},'dialPowerLevel':{'type':Sequelize[_0x1b89('0x29')](0x2)[_0x1b89('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1b89('0x2a')},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0x1b89('0x2b')),'defaultValue':_0x1b89('0x2b'),'comment':_0x1b89('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x1b89('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x1b89('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1b89('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1b89('0x6')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1b89('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b89('0x2f')},'dialQueueOptions':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':_0x1b89('0x30'),'comment':_0x1b89('0x31')},'dialQueueTimeout':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b89('0x32')},'dialQueueProject':{'type':Sequelize[_0x1b89('0x6')],'comment':_0x1b89('0x33')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b89('0x34')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1b89('0x18')](0x5)[_0x1b89('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x1b89('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x1b89('0x18')](0x5)[_0x1b89('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0x3,'comment':_0x1b89('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1b89('0x18')](0x5)[_0x1b89('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1b89('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1b89('0x36')},'dialTimezone':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1b89('0x6')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x37'),_0x1b89('0x38'),'onlyIfOpen'),'defaultValue':_0x1b89('0x37')},'dialAMDActive':{'type':Sequelize[_0x1b89('0x21')],'defaultValue':0x0,'comment':_0x1b89('0x39')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1b89('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x1b89('0x18')](0x9)[_0x1b89('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1b89('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1b89('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1b89('0x18')](0x9)[_0x1b89('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1b89('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x1b89('0x18')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1b89('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1b89('0x18')](0x9)[_0x1b89('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1b89('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1b89('0x18')](0x9)[_0x1b89('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1b89('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1b89('0x18')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1b89('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x1b89('0x18')](0x5)[_0x1b89('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x1b89('0x21')],'defaultValue':0x0,'comment':_0x1b89('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1b89('0x3')](_0x1b89('0x40'),_0x1b89('0x41')),'defaultValue':_0x1b89('0x40')},'dialQueueProject2':{'type':Sequelize[_0x1b89('0x6')],'comment':_0x1b89('0x33')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x1b89('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x1b89('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x1b89('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1b89('0x42')},'dialCutDigit':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1b89('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b89('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1b89('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b89('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0x1b89('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b89('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1b89('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b89('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b89('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1b89('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b89('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1b89('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b89('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x1b89('0x4b')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1b89('0x4c'),'set':function(_0x3c97c6){if(!_0x3c97c6)this['setDataValue'](_0x1b89('0x4d'),null);this[_0x1b89('0xf')](_0x1b89('0x4e'),_0x3c97c6);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x1b89('0x18')](0x3)[_0x1b89('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x1b89('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x1b89('0x21')],'defaultValue':![]}}; \ No newline at end of file +var _0xcb74=['agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#RecallMe\x20Timeout\x20(min:1)','DESC','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)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','booked','progressive','predictive','power','INTEGER','STRING','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT'];(function(_0x6fbb94,_0xc2bdee){var _0x16f0e8=function(_0x20b41c){while(--_0x20b41c){_0x6fbb94['push'](_0x6fbb94['shift']());}};_0x16f0e8(++_0xc2bdee);}(_0xcb74,0x127));var _0x4cb7=function(_0x514f7a,_0x3640f7){_0x514f7a=_0x514f7a-0x0;var _0x5f47b5=_0xcb74[_0x514f7a];return _0x5f47b5;};'use strict';var Sequelize=require('sequelize');module[_0x4cb7('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4cb7('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x3'),_0x4cb7('0x4')),'allowNull':![],'defaultValue':_0x4cb7('0x3')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x4cb7('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x4cb7('0x2')]('rr',_0x4cb7('0x6'),_0x4cb7('0x7'),_0x4cb7('0x8'),_0x4cb7('0x9'),_0x4cb7('0xa'),_0x4cb7('0xb'),_0x4cb7('0xc'),_0x4cb7('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x2a548b){this[_0x4cb7('0xe')](_0x4cb7('0xf'),_0x2a548b?_0x2a548b:_0x4cb7('0xa'));},'get':function(){var _0x33218a=this[_0x4cb7('0x10')](_0x4cb7('0x11'));var _0x4a32b3=this[_0x4cb7('0x10')]('dialMethod');var _0x574ec8=this[_0x4cb7('0x10')]('strategy');if(_0x33218a===_0x4cb7('0x3')){return _0x574ec8;}if(_0x4a32b3===_0x4cb7('0x12')&&_0x574ec8===_0x4cb7('0xa')||_0x4a32b3===_0x4cb7('0x12')&&_0x574ec8==='roundrobin'){return _0x574ec8;}if(_0x4a32b3===_0x4cb7('0x13')||_0x4a32b3===_0x4cb7('0x14')||_0x4a32b3===_0x4cb7('0x15')){return _0x574ec8;}return null;}},'servicelevel':{'type':Sequelize[_0x4cb7('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x4cb7('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x4cb7('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x4cb7('0x17')]},'weight':{'type':Sequelize[_0x4cb7('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x4cb7('0x2')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x18'),'no',_0x4cb7('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x4cb7('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x4cb7('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x4cb7('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x4cb7('0x17')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x4cb7('0x17')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x4cb7('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x4cb7('0x2')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x4cb7('0x18'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM'](_0x4cb7('0x18'),'no',_0x4cb7('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x4cb7('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x4cb7('0x17')]},'queue_youarenext':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x4cb7('0x17')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x4cb7('0x17')]},'queue_quantity1':{'type':Sequelize[_0x4cb7('0x17')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x4cb7('0x17')]},'queue_less_than':{'type':Sequelize[_0x4cb7('0x17')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x52976e){this['setDataValue'](_0x4cb7('0x1b'),_0x52976e?_0x52976e[_0x4cb7('0x1c')](','):[]);},'get':function(){return this[_0x4cb7('0x10')](_0x4cb7('0x1b'))?this[_0x4cb7('0x10')]('periodic_announce')[_0x4cb7('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':'yes','set':function(_0x5af969){this[_0x4cb7('0xe')]('joinempty',_0x5af969?_0x5af969[_0x4cb7('0x1c')](','):undefined);},'get':function(){return this[_0x4cb7('0x10')](_0x4cb7('0x1e'))?this[_0x4cb7('0x10')](_0x4cb7('0x1e'))[_0x4cb7('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':'no','set':function(_0x68008b){this['setDataValue'](_0x4cb7('0x1f'),_0x68008b?_0x68008b[_0x4cb7('0x1c')](','):undefined);},'get':function(){return this[_0x4cb7('0x10')](_0x4cb7('0x1f'))?this['getDataValue'](_0x4cb7('0x1f'))[_0x4cb7('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x4cb7('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x4cb7('0x17')]},'description':{'type':Sequelize[_0x4cb7('0x17')]},'acw':{'type':Sequelize[_0x4cb7('0x20')],'defaultValue':0x0,'set':function(_0x407567){this[_0x4cb7('0xe')](_0x4cb7('0x21'),_0x407567);if(_0x407567){if(this[_0x4cb7('0x10')](_0x4cb7('0x22'))<0x2){this[_0x4cb7('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x4cb7('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x23'),_0x4cb7('0x13'),_0x4cb7('0x15'),_0x4cb7('0x14'),_0x4cb7('0x12')),'defaultValue':_0x4cb7('0x13'),'comment':_0x4cb7('0x24')},'dialLimitChannel':{'type':Sequelize[_0x4cb7('0x16')](0x4)[_0x4cb7('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4cb7('0x26')},'dialLimitQueue':{'type':Sequelize[_0x4cb7('0x16')](0x4)[_0x4cb7('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4cb7('0x27')},'dialPowerLevel':{'type':Sequelize[_0x4cb7('0x28')](0x2)[_0x4cb7('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x4cb7('0x29'),_0x4cb7('0x2a')),'defaultValue':'dropRate','comment':_0x4cb7('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x4cb7('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x4cb7('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x4cb7('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4cb7('0x17')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4cb7('0x17')]},'dialOriginateTimeout':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cb7('0x2e')},'dialQueueOptions':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':_0x4cb7('0x2f'),'comment':_0x4cb7('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x4cb7('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cb7('0x31')},'dialQueueProject':{'type':Sequelize[_0x4cb7('0x17')],'comment':_0x4cb7('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cb7('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4cb7('0x16')](0x5)[_0x4cb7('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cb7('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cb7('0x35')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cb7('0x36')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4cb7('0x25')],'defaultValue':0x3,'comment':_0x4cb7('0x37')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4cb7('0x16')](0x5)[_0x4cb7('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cb7('0x38')},'dialGlobalMaxRetry':{'type':Sequelize[_0x4cb7('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4cb7('0x39')},'dialTimezone':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':_0x4cb7('0x3a')},'dialPrefix':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x3b'),_0x4cb7('0x3c'),'onlyIfOpen'),'defaultValue':_0x4cb7('0x3b')},'dialAMDActive':{'type':Sequelize[_0x4cb7('0x20')],'defaultValue':0x0,'comment':_0x4cb7('0x3d')},'dialAMDInitialSilence':{'type':Sequelize[_0x4cb7('0x16')](0x9)[_0x4cb7('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4cb7('0x3e')},'dialAMDGreeting':{'type':Sequelize[_0x4cb7('0x16')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4cb7('0x3f')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4cb7('0x16')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4cb7('0x40')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4cb7('0x41')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x4cb7('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4cb7('0x42')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4cb7('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4cb7('0x43')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4cb7('0x16')](0x9)[_0x4cb7('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4cb7('0x16')](0x5)[_0x4cb7('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4cb7('0x16')](0x9)[_0x4cb7('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x4cb7('0x16')](0x5)[_0x4cb7('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x4cb7('0x44')},'dialRecallInQueue':{'type':Sequelize[_0x4cb7('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x45'),'ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x4cb7('0x17')],'comment':_0x4cb7('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x4cb7('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x4cb7('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4cb7('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4cb7('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cb7('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cb7('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cb7('0x49')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4cb7('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cb7('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4cb7('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cb7('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4cb7('0x16')](0x5)[_0x4cb7('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cb7('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cb7('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4cb7('0x16')](0x5)[_0x4cb7('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cb7('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4cb7('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cb7('0x4f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4cb7('0x16')](0x5)[_0x4cb7('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cb7('0x50')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4cb7('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4cb7('0x20')],'defaultValue':![],'comment':_0x4cb7('0x51'),'set':function(_0x44c85f){if(!_0x44c85f)this[_0x4cb7('0xe')](_0x4cb7('0x52'),null);this[_0x4cb7('0xe')](_0x4cb7('0x53'),_0x44c85f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x4cb7('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index ec82ffd..481a9c4 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 _0x5fab=['./voiceQueue.socket','register','end','offset','undefined','limit','count','status','set','json','reject','save','update','then','destroy','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','sendStatus','error','send','index','VoiceQueue','fieldName','model','keys','query','filters','intersection','attributes','length','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','autoAssociation','CmHopper','hasOwnProperty','nolimit','getHopperHistories','findOne','CmHopperHistory','VoiceQueueId','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','penalty','sequelize','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','transaction','ids','removeAgents','userVoiceQueue:remove','addAgents','isEmpty','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter'];(function(_0x12f527,_0x46c69c){var _0x1bf550=function(_0x5aaf63){while(--_0x5aaf63){_0x12f527['push'](_0x12f527['shift']());}};_0x1bf550(++_0x46c69c);}(_0x5fab,0x177));var _0xb5fa=function(_0x411172,_0x5f3b53){_0x411172=_0x411172-0x0;var _0x489979=_0x5fab[_0x411172];return _0x489979;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];config['redis']=_[_0xb5fa('0x1a')](config[_0xb5fa('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xb5fa('0x1c'))(new Redis(config['redis']));require(_0xb5fa('0x1d'))[_0xb5fa('0x1e')](socket);function respondWithStatusCode(_0x40c914,_0xca8d82){_0xca8d82=_0xca8d82||0xcc;return function(_0x8e9d1c){if(_0x8e9d1c){return _0x40c914['sendStatus'](_0xca8d82);}return _0x40c914['status'](_0xca8d82)[_0xb5fa('0x1f')]();};}function respondWithResult(_0x587043,_0x31f252){_0x31f252=_0x31f252||0xc8;return function(_0x27c8f7){if(_0x27c8f7){return _0x587043['status'](_0x31f252)['json'](_0x27c8f7);}};}function respondWithFilteredResult(_0x451a55,_0x1f7f05){return function(_0x32e9e5){if(_0x32e9e5){var _0x46eef0=typeof _0x1f7f05[_0xb5fa('0x20')]===_0xb5fa('0x21')&&typeof _0x1f7f05[_0xb5fa('0x22')]===_0xb5fa('0x21');var _0xc14dc4=_0x32e9e5[_0xb5fa('0x23')];var _0x3c8d53=_0x46eef0?0x0:_0x1f7f05[_0xb5fa('0x20')];var _0x5cd822=_0x46eef0?_0x32e9e5[_0xb5fa('0x23')]:_0x1f7f05['offset']+_0x1f7f05[_0xb5fa('0x22')];var _0x4a6c04;if(_0x5cd822>=_0xc14dc4){_0x5cd822=_0xc14dc4;_0x4a6c04=0xc8;}else{_0x4a6c04=0xce;}_0x451a55[_0xb5fa('0x24')](_0x4a6c04);return _0x451a55[_0xb5fa('0x25')]('Content-Range',_0x3c8d53+'-'+_0x5cd822+'/'+_0xc14dc4)[_0xb5fa('0x26')](_0x32e9e5);}return null;};}function patchUpdates(_0x3a2ab9){return function(_0x283a56){try{jsonpatch['apply'](_0x283a56,_0x3a2ab9,!![]);}catch(_0x32a85c){return BPromise[_0xb5fa('0x27')](_0x32a85c);}return _0x283a56[_0xb5fa('0x28')]();};}function saveUpdates(_0x542348,_0x224ec8){return function(_0x5d55f7){if(_0x5d55f7){return _0x5d55f7[_0xb5fa('0x29')](_0x542348)[_0xb5fa('0x2a')](function(_0x11053a){return _0x11053a;});}return null;};}function removeEntity(_0x543edf,_0x2dbd22){return function(_0x3f61cd){if(_0x3f61cd){return _0x3f61cd[_0xb5fa('0x2b')]()[_0xb5fa('0x2a')](function(){var _0x568870=_0x3f61cd['get']({'plain':!![]});var _0x5bdf11=[{'name':'VoiceQueues','value':_0xb5fa('0x2c'),'ignore':![]},{'name':_0xb5fa('0x2d'),'value':_0xb5fa('0x2e'),'ignore':![]}];var _0x2bdf50=_(_0x5bdf11)[_0xb5fa('0x2f')](_0xb5fa('0x30'))[_0xb5fa('0x31')](_0xb5fa('0x32'))[_0xb5fa('0x32')]();if(_[_0xb5fa('0x33')](_0x2bdf50,_0x568870[_0xb5fa('0x34')])){return;}var _0x259d21=_[_0xb5fa('0x35')](_0x5bdf11,[_0xb5fa('0x32'),_0x568870[_0xb5fa('0x34')]])[_0xb5fa('0x36')];return db[_0xb5fa('0x37')][_0xb5fa('0x2b')]({'where':{'type':_0x259d21,'resourceId':_0x568870['id']}})[_0xb5fa('0x2a')](function(){return _0x3f61cd;});})[_0xb5fa('0x2a')](function(){_0x543edf[_0xb5fa('0x24')](0xcc)[_0xb5fa('0x1f')]();});}};}function handleEntityNotFound(_0x10fb43,_0x25fc7c){return function(_0x4cba5a){if(!_0x4cba5a){_0x10fb43[_0xb5fa('0x38')](0x194);}return _0x4cba5a;};}function handleError(_0x4d056c,_0x5c7fdd){_0x5c7fdd=_0x5c7fdd||0x1f4;return function(_0x558708){logger[_0xb5fa('0x39')](_0x558708['stack']);if(_0x558708[_0xb5fa('0x36')]){delete _0x558708['name'];}_0x4d056c['status'](_0x5c7fdd)[_0xb5fa('0x3a')](_0x558708);};}exports[_0xb5fa('0x3b')]=function(_0x4a4bff,_0x59f41d){var _0x3d73c2={},_0x9cf63d={},_0x252421={'count':0x0,'rows':[]};var _0x560b53=_[_0xb5fa('0x31')](db[_0xb5fa('0x3c')]['rawAttributes'],function(_0x18398f){return{'name':_0x18398f[_0xb5fa('0x3d')],'type':_0x18398f[_0xb5fa('0x34')]['key']};});_0x9cf63d[_0xb5fa('0x3e')]=_[_0xb5fa('0x31')](_0x560b53,_0xb5fa('0x36'));_0x9cf63d['query']=_[_0xb5fa('0x3f')](_0x4a4bff[_0xb5fa('0x40')]);_0x9cf63d[_0xb5fa('0x41')]=_[_0xb5fa('0x42')](_0x9cf63d['model'],_0x9cf63d['query']);_0x3d73c2['attributes']=_['intersection'](_0x9cf63d['model'],qs['fields'](_0x4a4bff[_0xb5fa('0x40')]['fields']));_0x3d73c2[_0xb5fa('0x43')]=_0x3d73c2[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x3d73c2[_0xb5fa('0x43')]:_0x9cf63d[_0xb5fa('0x3e')];if(!_0x4a4bff[_0xb5fa('0x40')]['hasOwnProperty']('nolimit')){_0x3d73c2['limit']=qs[_0xb5fa('0x22')](_0x4a4bff['query'][_0xb5fa('0x22')]);_0x3d73c2['offset']=qs['offset'](_0x4a4bff[_0xb5fa('0x40')][_0xb5fa('0x20')]);}_0x3d73c2[_0xb5fa('0x45')]=qs[_0xb5fa('0x46')](_0x4a4bff[_0xb5fa('0x40')][_0xb5fa('0x46')]);_0x3d73c2[_0xb5fa('0x47')]=qs[_0xb5fa('0x41')](_[_0xb5fa('0x48')](_0x4a4bff[_0xb5fa('0x40')],_0x9cf63d['filters']),_0x560b53);if(_0x4a4bff[_0xb5fa('0x40')]['filter']){_0x3d73c2[_0xb5fa('0x47')]=_[_0xb5fa('0x49')](_0x3d73c2[_0xb5fa('0x47')],{'$or':_[_0xb5fa('0x31')](_0x560b53,function(_0x1c706b){if(_0x1c706b[_0xb5fa('0x34')]!==_0xb5fa('0x4a')){var _0x10c381={};_0x10c381[_0x1c706b['name']]={'$like':'%'+_0x4a4bff[_0xb5fa('0x40')][_0xb5fa('0x2f')]+'%'};return _0x10c381;}})});}_0x3d73c2=_['merge']({},_0x3d73c2,_0x4a4bff[_0xb5fa('0x4b')]);var _0x5a6ae3={'where':_0x3d73c2[_0xb5fa('0x47')]};return db[_0xb5fa('0x3c')]['count'](_0x5a6ae3)['then'](function(_0x2db269){_0x252421[_0xb5fa('0x23')]=_0x2db269;if(_0x4a4bff[_0xb5fa('0x40')][_0xb5fa('0x4c')]){_0x3d73c2[_0xb5fa('0x4d')]=[{'all':!![]}];}return db[_0xb5fa('0x3c')][_0xb5fa('0x4e')](_0x3d73c2);})[_0xb5fa('0x2a')](function(_0x499d36){_0x252421[_0xb5fa('0x4f')]=_0x499d36;return _0x252421;})[_0xb5fa('0x2a')](respondWithFilteredResult(_0x59f41d,_0x3d73c2))['catch'](handleError(_0x59f41d,null));};exports[_0xb5fa('0x50')]=function(_0x2c378a,_0x247999){var _0x43b056={'raw':![],'where':{'id':_0x2c378a[_0xb5fa('0x51')]['id']}},_0x30d0d4={};_0x30d0d4[_0xb5fa('0x3e')]=_[_0xb5fa('0x3f')](db[_0xb5fa('0x3c')][_0xb5fa('0x52')]);_0x30d0d4[_0xb5fa('0x40')]=_[_0xb5fa('0x3f')](_0x2c378a[_0xb5fa('0x40')]);_0x30d0d4[_0xb5fa('0x41')]=_[_0xb5fa('0x42')](_0x30d0d4[_0xb5fa('0x3e')],_0x30d0d4['query']);_0x43b056['attributes']=_[_0xb5fa('0x42')](_0x30d0d4['model'],qs[_0xb5fa('0x53')](_0x2c378a[_0xb5fa('0x40')]['fields']));_0x43b056[_0xb5fa('0x43')]=_0x43b056[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x43b056[_0xb5fa('0x43')]:_0x30d0d4[_0xb5fa('0x3e')];if(_0x2c378a[_0xb5fa('0x40')]['includeAll']){_0x43b056[_0xb5fa('0x4d')]=[{'all':!![]}];}_0x43b056=_['merge']({},_0x43b056,_0x2c378a[_0xb5fa('0x4b')]);return db[_0xb5fa('0x3c')][_0xb5fa('0x35')](_0x43b056)['then'](handleEntityNotFound(_0x247999,null))[_0xb5fa('0x2a')](respondWithResult(_0x247999,null))[_0xb5fa('0x54')](handleError(_0x247999,null));};exports['create']=function(_0x4f6ffa,_0x3f19ee){return db[_0xb5fa('0x3c')][_0xb5fa('0x55')](_0x4f6ffa[_0xb5fa('0x56')],{})[_0xb5fa('0x2a')](function(_0x7775b4){var _0x31c91f=_0x4f6ffa[_0xb5fa('0x57')][_0xb5fa('0x58')]({'plain':!![]});if(!_0x31c91f)throw new Error(_0xb5fa('0x59'));if(_0x31c91f[_0xb5fa('0x5a')]===_0xb5fa('0x57')){var _0x3ccfd1=_0x7775b4[_0xb5fa('0x58')]({'plain':!![]});var _0x23f235=[{'name':_0xb5fa('0x5b'),'value':_0xb5fa('0x2c')},{'name':_0xb5fa('0x2d'),'value':'outbound'}];var _0x1900a5=_[_0xb5fa('0x35')](_0x23f235,[_0xb5fa('0x32'),_0x3ccfd1[_0xb5fa('0x34')]])[_0xb5fa('0x36')];return db[_0xb5fa('0x5c')][_0xb5fa('0x35')]({'where':{'name':_0x1900a5,'userProfileId':_0x31c91f[_0xb5fa('0x5d')]},'raw':!![]})[_0xb5fa('0x2a')](function(_0x1e0547){if(_0x1e0547&&_0x1e0547['autoAssociation']===0x0){return db['UserProfileResource'][_0xb5fa('0x55')]({'name':_0x3ccfd1[_0xb5fa('0x36')],'resourceId':_0x3ccfd1['id'],'type':_0x1e0547[_0xb5fa('0x36')],'sectionId':_0x1e0547['id']},{})['then'](function(){return _0x7775b4;});}else{return _0x7775b4;}})[_0xb5fa('0x54')](function(_0x367f7a){logger[_0xb5fa('0x39')](_0xb5fa('0x5e'),_0x367f7a);throw _0x367f7a;});}return _0x7775b4;})[_0xb5fa('0x2a')](respondWithResult(_0x3f19ee,0xc9))[_0xb5fa('0x54')](handleError(_0x3f19ee,null));};exports[_0xb5fa('0x5f')]=function(_0x4f82f0,_0x7bcd09){var _0x4611f3={'where':{'id':_0x4f82f0[_0xb5fa('0x51')]['id']}},_0x4afc02={};_0x4afc02[_0xb5fa('0x3e')]=_['keys'](db[_0xb5fa('0x3c')][_0xb5fa('0x52')]);_0x4611f3[_0xb5fa('0x43')]=_[_0xb5fa('0x42')](_0x4afc02[_0xb5fa('0x3e')],qs[_0xb5fa('0x53')](_0x4f82f0[_0xb5fa('0x40')][_0xb5fa('0x53')]));_0x4611f3[_0xb5fa('0x43')]=_0x4611f3[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x4611f3[_0xb5fa('0x43')]:_0x4afc02[_0xb5fa('0x3e')];if(_0x4f82f0[_0xb5fa('0x40')][_0xb5fa('0x4c')]){_0x4611f3[_0xb5fa('0x4d')]=[{'all':!![]}];}_0x4611f3=_[_0xb5fa('0x49')]({},_0x4611f3,_0x4f82f0[_0xb5fa('0x4b')]);return db[_0xb5fa('0x3c')][_0xb5fa('0x35')](_0x4611f3)[_0xb5fa('0x2a')](handleEntityNotFound(_0x7bcd09,null))[_0xb5fa('0x2a')](function(_0x488563){if(_0x488563){var _0x41fd9c=_0x488563[_0xb5fa('0x58')]({'plain':!![]});_0x41fd9c=qs[_0xb5fa('0x60')](_0x41fd9c,['id','createdAt',_0xb5fa('0x61')]);_0x4f82f0[_0xb5fa('0x56')]=_['omit'](_0x4f82f0[_0xb5fa('0x56')],['id',_0xb5fa('0x62'),_0xb5fa('0x61')]);return db['VoiceQueue']['create'](_[_0xb5fa('0x49')](_0x41fd9c,_0x4f82f0[_0xb5fa('0x56')]),{'include':_0x4f82f0[_0xb5fa('0x40')]['includeAll']?[{'all':!![]}]:undefined})[_0xb5fa('0x2a')](function(_0x30d53b){var _0x199555=_0x4f82f0[_0xb5fa('0x57')]['get']({'plain':!![]});if(!_0x199555)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x199555['role']===_0xb5fa('0x57')){var _0x28a5f1=_0x30d53b[_0xb5fa('0x58')]({'plain':!![]});var _0x4ce1bd=[{'name':_0xb5fa('0x5b'),'value':_0xb5fa('0x2c')},{'name':_0xb5fa('0x2d'),'value':_0xb5fa('0x2e')}];var _0x2a1872=_[_0xb5fa('0x35')](_0x4ce1bd,[_0xb5fa('0x32'),_0x28a5f1[_0xb5fa('0x34')]])[_0xb5fa('0x36')];return db[_0xb5fa('0x5c')][_0xb5fa('0x35')]({'where':{'name':_0x2a1872,'userProfileId':_0x199555[_0xb5fa('0x5d')]},'raw':!![]})[_0xb5fa('0x2a')](function(_0x38faa6){if(_0x38faa6&&_0x38faa6[_0xb5fa('0x63')]===0x0){return db['UserProfileResource'][_0xb5fa('0x55')]({'name':_0x28a5f1['name'],'resourceId':_0x28a5f1['id'],'type':_0x38faa6[_0xb5fa('0x36')],'sectionId':_0x38faa6['id']},{})[_0xb5fa('0x2a')](function(){return _0x30d53b;});}else{return _0x30d53b;}})[_0xb5fa('0x54')](function(_0x3e90c7){logger[_0xb5fa('0x39')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e90c7);throw _0x3e90c7;});}return _0x30d53b;});}})[_0xb5fa('0x2a')](respondWithResult(_0x7bcd09,0xc9))['catch'](handleError(_0x7bcd09,null));};exports[_0xb5fa('0x29')]=function(_0x3ab924,_0x118a0e){if(_0x3ab924[_0xb5fa('0x56')]['id']){delete _0x3ab924['body']['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x3ab924[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x118a0e,null))[_0xb5fa('0x2a')](saveUpdates(_0x3ab924[_0xb5fa('0x56')],null))[_0xb5fa('0x2a')](respondWithResult(_0x118a0e,null))[_0xb5fa('0x54')](handleError(_0x118a0e,null));};exports['destroy']=function(_0x9bf200,_0x5c08e1){return db['VoiceQueue'][_0xb5fa('0x35')]({'where':{'id':_0x9bf200['params']['id']}})['then'](handleEntityNotFound(_0x5c08e1,null))['then'](removeEntity(_0x5c08e1,null))[_0xb5fa('0x54')](handleError(_0x5c08e1,null));};exports['getHoppers']=function(_0x46c973,_0xe8f400,_0x1f05f7){var _0x4e4e2a={'raw':![],'where':{}};var _0x5cac2e={};var _0xb1fcac={'count':0x0,'rows':[]};return db[_0xb5fa('0x3c')]['findOne']({'where':{'id':_0x46c973[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0xe8f400,null))[_0xb5fa('0x2a')](function(_0x2aaa2c){if(_0x2aaa2c){_0x5cac2e['model']=_[_0xb5fa('0x3f')](db[_0xb5fa('0x64')][_0xb5fa('0x52')]);_0x5cac2e[_0xb5fa('0x40')]=_[_0xb5fa('0x3f')](_0x46c973[_0xb5fa('0x40')]);_0x5cac2e[_0xb5fa('0x41')]=_['intersection'](_0x5cac2e[_0xb5fa('0x3e')],_0x5cac2e['query']);_0x4e4e2a[_0xb5fa('0x43')]=_[_0xb5fa('0x42')](_0x5cac2e['model'],qs[_0xb5fa('0x53')](_0x46c973[_0xb5fa('0x40')][_0xb5fa('0x53')]));_0x4e4e2a[_0xb5fa('0x43')]=_0x4e4e2a[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x4e4e2a[_0xb5fa('0x43')]:_0x5cac2e[_0xb5fa('0x3e')];if(!_0x46c973['query'][_0xb5fa('0x65')](_0xb5fa('0x66'))){_0x4e4e2a[_0xb5fa('0x22')]=qs[_0xb5fa('0x22')](_0x46c973['query']['limit']);_0x4e4e2a['offset']=qs['offset'](_0x46c973[_0xb5fa('0x40')][_0xb5fa('0x20')]);}_0x4e4e2a[_0xb5fa('0x45')]=qs[_0xb5fa('0x46')](_0x46c973['query']['sort']);_0x4e4e2a[_0xb5fa('0x47')]=qs['filters'](_[_0xb5fa('0x48')](_0x46c973[_0xb5fa('0x40')],_0x5cac2e[_0xb5fa('0x41')]));_0x4e4e2a[_0xb5fa('0x47')]['VoiceQueueId']=_0x2aaa2c['id'];if(_0x46c973[_0xb5fa('0x40')]['filter']){_0x4e4e2a[_0xb5fa('0x47')]=_[_0xb5fa('0x49')](_0x4e4e2a['where'],{'$or':_['map'](_0x4e4e2a[_0xb5fa('0x43')],function(_0x3150ac){var _0x64ab9e={};_0x64ab9e[_0x3150ac]={'$like':'%'+_0x46c973[_0xb5fa('0x40')][_0xb5fa('0x2f')]+'%'};return _0x64ab9e;})});}_0x4e4e2a=_[_0xb5fa('0x49')]({},_0x4e4e2a,_0x46c973[_0xb5fa('0x4b')]);return db[_0xb5fa('0x64')][_0xb5fa('0x23')]({'where':_0x4e4e2a[_0xb5fa('0x47')]})[_0xb5fa('0x2a')](function(_0x2d27c1){_0xb1fcac[_0xb5fa('0x23')]=_0x2d27c1;if(_0x46c973['query']['includeAll']){_0x4e4e2a[_0xb5fa('0x4d')]=[{'all':!![]}];}return db['CmHopper'][_0xb5fa('0x4e')](_0x4e4e2a);})[_0xb5fa('0x2a')](function(_0x502946){_0xb1fcac[_0xb5fa('0x4f')]=_0x502946;return _0xb1fcac;});}})[_0xb5fa('0x2a')](respondWithFilteredResult(_0xe8f400,_0x4e4e2a))['catch'](handleError(_0xe8f400,null));};exports[_0xb5fa('0x67')]=function(_0x3ba1d0,_0x4b9d03,_0x138c60){var _0x3a59ed={'raw':!![],'where':{}};var _0x367593={};var _0x5a358d={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xb5fa('0x68')]({'where':{'id':_0x3ba1d0[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x4b9d03,null))[_0xb5fa('0x2a')](function(_0x397830){if(_0x397830){_0x367593[_0xb5fa('0x3e')]=_[_0xb5fa('0x3f')](db[_0xb5fa('0x69')][_0xb5fa('0x52')]);_0x367593[_0xb5fa('0x40')]=_['keys'](_0x3ba1d0['query']);_0x367593[_0xb5fa('0x41')]=_[_0xb5fa('0x42')](_0x367593[_0xb5fa('0x3e')],_0x367593[_0xb5fa('0x40')]);_0x3a59ed['attributes']=_[_0xb5fa('0x42')](_0x367593[_0xb5fa('0x3e')],qs[_0xb5fa('0x53')](_0x3ba1d0['query'][_0xb5fa('0x53')]));_0x3a59ed[_0xb5fa('0x43')]=_0x3a59ed[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x3a59ed['attributes']:_0x367593[_0xb5fa('0x3e')];if(!_0x3ba1d0[_0xb5fa('0x40')][_0xb5fa('0x65')](_0xb5fa('0x66'))){_0x3a59ed[_0xb5fa('0x22')]=qs[_0xb5fa('0x22')](_0x3ba1d0[_0xb5fa('0x40')][_0xb5fa('0x22')]);_0x3a59ed[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0x3ba1d0[_0xb5fa('0x40')][_0xb5fa('0x20')]);}_0x3a59ed[_0xb5fa('0x45')]=qs[_0xb5fa('0x46')](_0x3ba1d0[_0xb5fa('0x40')]['sort']);_0x3a59ed[_0xb5fa('0x47')]=qs[_0xb5fa('0x41')](_[_0xb5fa('0x48')](_0x3ba1d0[_0xb5fa('0x40')],_0x367593[_0xb5fa('0x41')]));_0x3a59ed[_0xb5fa('0x47')][_0xb5fa('0x6a')]=_0x397830['id'];if(_0x3ba1d0[_0xb5fa('0x40')]['filter']){_0x3a59ed['where']=_[_0xb5fa('0x49')](_0x3a59ed['where'],{'$or':_['map'](_0x3a59ed[_0xb5fa('0x43')],function(_0x27dbe8){var _0x2faf23={};_0x2faf23[_0x27dbe8]={'$like':'%'+_0x3ba1d0['query'][_0xb5fa('0x2f')]+'%'};return _0x2faf23;})});}_0x3a59ed=_[_0xb5fa('0x49')]({},_0x3a59ed,_0x3ba1d0[_0xb5fa('0x4b')]);return db['CmHopperHistory'][_0xb5fa('0x23')]({'where':_0x3a59ed[_0xb5fa('0x47')]})['then'](function(_0x27ca06){_0x5a358d[_0xb5fa('0x23')]=_0x27ca06;if(_0x3ba1d0[_0xb5fa('0x40')][_0xb5fa('0x4c')]){_0x3a59ed[_0xb5fa('0x4d')]=[{'all':!![]}];}return db[_0xb5fa('0x69')][_0xb5fa('0x4e')](_0x3a59ed);})['then'](function(_0x2c6212){_0x5a358d[_0xb5fa('0x4f')]=_0x2c6212;return _0x5a358d;});}})[_0xb5fa('0x2a')](respondWithFilteredResult(_0x4b9d03,_0x3a59ed))[_0xb5fa('0x54')](handleError(_0x4b9d03,null));};exports['getHopperFinals']=function(_0x48f335,_0x181ad8,_0x21fa37){var _0x3b1fe2={'raw':!![],'where':{}};var _0x1a889a={};var _0x4eb5a0={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x48f335['params']['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x181ad8,null))[_0xb5fa('0x2a')](function(_0x22144f){if(_0x22144f){_0x1a889a[_0xb5fa('0x3e')]=_[_0xb5fa('0x3f')](db[_0xb5fa('0x6b')][_0xb5fa('0x52')]);_0x1a889a[_0xb5fa('0x40')]=_[_0xb5fa('0x3f')](_0x48f335[_0xb5fa('0x40')]);_0x1a889a[_0xb5fa('0x41')]=_['intersection'](_0x1a889a[_0xb5fa('0x3e')],_0x1a889a[_0xb5fa('0x40')]);_0x3b1fe2['attributes']=_[_0xb5fa('0x42')](_0x1a889a[_0xb5fa('0x3e')],qs['fields'](_0x48f335[_0xb5fa('0x40')][_0xb5fa('0x53')]));_0x3b1fe2[_0xb5fa('0x43')]=_0x3b1fe2[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x3b1fe2[_0xb5fa('0x43')]:_0x1a889a[_0xb5fa('0x3e')];if(!_0x48f335[_0xb5fa('0x40')][_0xb5fa('0x65')]('nolimit')){_0x3b1fe2[_0xb5fa('0x22')]=qs[_0xb5fa('0x22')](_0x48f335[_0xb5fa('0x40')][_0xb5fa('0x22')]);_0x3b1fe2[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0x48f335[_0xb5fa('0x40')][_0xb5fa('0x20')]);}_0x3b1fe2['order']=qs[_0xb5fa('0x46')](_0x48f335['query'][_0xb5fa('0x46')]);_0x3b1fe2[_0xb5fa('0x47')]=qs[_0xb5fa('0x41')](_[_0xb5fa('0x48')](_0x48f335[_0xb5fa('0x40')],_0x1a889a[_0xb5fa('0x41')]));_0x3b1fe2[_0xb5fa('0x47')][_0xb5fa('0x6a')]=_0x22144f['id'];if(_0x48f335[_0xb5fa('0x40')]['filter']){_0x3b1fe2['where']=_[_0xb5fa('0x49')](_0x3b1fe2[_0xb5fa('0x47')],{'$or':_[_0xb5fa('0x31')](_0x3b1fe2[_0xb5fa('0x43')],function(_0x5378ce){var _0x161c49={};_0x161c49[_0x5378ce]={'$like':'%'+_0x48f335['query'][_0xb5fa('0x2f')]+'%'};return _0x161c49;})});}_0x3b1fe2=_[_0xb5fa('0x49')]({},_0x3b1fe2,_0x48f335['options']);return db[_0xb5fa('0x6b')]['count']({'where':_0x3b1fe2[_0xb5fa('0x47')]})['then'](function(_0x26718c){_0x4eb5a0[_0xb5fa('0x23')]=_0x26718c;if(_0x48f335[_0xb5fa('0x40')][_0xb5fa('0x4c')]){_0x3b1fe2[_0xb5fa('0x4d')]=[{'all':!![]}];}return db[_0xb5fa('0x6b')][_0xb5fa('0x4e')](_0x3b1fe2);})[_0xb5fa('0x2a')](function(_0x3f5d43){_0x4eb5a0[_0xb5fa('0x4f')]=_0x3f5d43;return _0x4eb5a0;});}})[_0xb5fa('0x2a')](respondWithFilteredResult(_0x181ad8,_0x3b1fe2))['catch'](handleError(_0x181ad8,null));};exports[_0xb5fa('0x6c')]=function(_0x284b34,_0x384c8e,_0x497931){var _0x2145d8={'raw':!![],'where':{}};var _0x2ca7d5={};var _0x1e11bc={'count':0x0,'rows':[]};return db[_0xb5fa('0x3c')][_0xb5fa('0x68')]({'where':{'id':_0x284b34[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x384c8e,null))[_0xb5fa('0x2a')](function(_0x59fd75){if(_0x59fd75){_0x2ca7d5[_0xb5fa('0x3e')]=_['keys'](db[_0xb5fa('0x6d')][_0xb5fa('0x52')]);_0x2ca7d5[_0xb5fa('0x40')]=_[_0xb5fa('0x3f')](_0x284b34[_0xb5fa('0x40')]);_0x2ca7d5[_0xb5fa('0x41')]=_[_0xb5fa('0x42')](_0x2ca7d5[_0xb5fa('0x3e')],_0x2ca7d5[_0xb5fa('0x40')]);_0x2145d8[_0xb5fa('0x43')]=_[_0xb5fa('0x42')](_0x2ca7d5[_0xb5fa('0x3e')],qs[_0xb5fa('0x53')](_0x284b34[_0xb5fa('0x40')][_0xb5fa('0x53')]));_0x2145d8[_0xb5fa('0x43')]=_0x2145d8[_0xb5fa('0x43')]['length']?_0x2145d8[_0xb5fa('0x43')]:_0x2ca7d5[_0xb5fa('0x3e')];if(!_0x284b34['query'][_0xb5fa('0x65')](_0xb5fa('0x66'))){_0x2145d8['limit']=qs['limit'](_0x284b34['query'][_0xb5fa('0x22')]);_0x2145d8[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0x284b34[_0xb5fa('0x40')][_0xb5fa('0x20')]);}_0x2145d8[_0xb5fa('0x45')]=qs[_0xb5fa('0x46')](_0x284b34['query']['sort']);_0x2145d8['where']=qs[_0xb5fa('0x41')](_['pick'](_0x284b34['query'],_0x2ca7d5[_0xb5fa('0x41')]));_0x2145d8['where'][_0xb5fa('0x6a')]=_0x59fd75['id'];if(_0x284b34[_0xb5fa('0x40')][_0xb5fa('0x2f')]){_0x2145d8[_0xb5fa('0x47')]=_[_0xb5fa('0x49')](_0x2145d8['where'],{'$or':_[_0xb5fa('0x31')](_0x2145d8[_0xb5fa('0x43')],function(_0x2fe715){var _0x3c5ac4={};_0x3c5ac4[_0x2fe715]={'$like':'%'+_0x284b34[_0xb5fa('0x40')]['filter']+'%'};return _0x3c5ac4;})});}_0x2145d8=_[_0xb5fa('0x49')]({},_0x2145d8,_0x284b34[_0xb5fa('0x4b')]);return db[_0xb5fa('0x6d')][_0xb5fa('0x23')]({'where':_0x2145d8[_0xb5fa('0x47')]})[_0xb5fa('0x2a')](function(_0x502d4d){_0x1e11bc[_0xb5fa('0x23')]=_0x502d4d;if(_0x284b34[_0xb5fa('0x40')][_0xb5fa('0x4c')]){_0x2145d8[_0xb5fa('0x4d')]=[{'all':!![]}];}return db[_0xb5fa('0x6d')][_0xb5fa('0x4e')](_0x2145d8);})[_0xb5fa('0x2a')](function(_0x24cfb3){_0x1e11bc[_0xb5fa('0x4f')]=_0x24cfb3;return _0x1e11bc;});}})[_0xb5fa('0x2a')](respondWithFilteredResult(_0x384c8e,_0x2145d8))[_0xb5fa('0x54')](handleError(_0x384c8e,null));};exports[_0xb5fa('0x6e')]=function(_0x1d307c,_0x3b7625,_0x3347eb){var _0x349e0b={};var _0x11bbec={};var _0xaffb14;var _0x334b3a;return db[_0xb5fa('0x3c')][_0xb5fa('0x68')]({'where':{'id':_0x1d307c[_0xb5fa('0x51')]['id']}})['then'](handleEntityNotFound(_0x3b7625,null))['then'](function(_0x33a62e){if(_0x33a62e){_0xaffb14=_0x33a62e;_0x11bbec[_0xb5fa('0x3e')]=_[_0xb5fa('0x3f')](db[_0xb5fa('0x6f')][_0xb5fa('0x52')]);_0x11bbec[_0xb5fa('0x40')]=_['keys'](_0x1d307c['query']);_0x11bbec['filters']=_[_0xb5fa('0x42')](_0x11bbec[_0xb5fa('0x3e')],_0x11bbec['query']);_0x349e0b[_0xb5fa('0x43')]=_[_0xb5fa('0x42')](_0x11bbec['model'],qs[_0xb5fa('0x53')](_0x1d307c[_0xb5fa('0x40')][_0xb5fa('0x53')]));_0x349e0b[_0xb5fa('0x43')]=_0x349e0b[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x349e0b[_0xb5fa('0x43')]:_0x11bbec[_0xb5fa('0x3e')];_0x349e0b['order']=qs[_0xb5fa('0x46')](_0x1d307c['query'][_0xb5fa('0x46')]);_0x349e0b[_0xb5fa('0x47')]=qs[_0xb5fa('0x41')](_[_0xb5fa('0x48')](_0x1d307c['query'],_0x11bbec[_0xb5fa('0x41')]));if(_0x1d307c[_0xb5fa('0x40')][_0xb5fa('0x2f')]){_0x349e0b[_0xb5fa('0x47')]=_['merge'](_0x349e0b[_0xb5fa('0x47')],{'$or':_[_0xb5fa('0x31')](_0x349e0b[_0xb5fa('0x43')],function(_0x146f1f){var _0x16221f={};_0x16221f[_0x146f1f]={'$like':'%'+_0x1d307c[_0xb5fa('0x40')][_0xb5fa('0x2f')]+'%'};return _0x16221f;})});}_0x349e0b=_['merge']({},_0x349e0b,_0x1d307c[_0xb5fa('0x4b')]);return _0xaffb14['getTeams'](_0x349e0b);}})[_0xb5fa('0x2a')](function(_0x391414){if(_0x391414){_0x334b3a=_0x391414[_0xb5fa('0x44')];if(!_0x1d307c[_0xb5fa('0x40')][_0xb5fa('0x65')](_0xb5fa('0x66'))){_0x349e0b[_0xb5fa('0x22')]=qs['limit'](_0x1d307c['query'][_0xb5fa('0x22')]);_0x349e0b[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0x1d307c[_0xb5fa('0x40')][_0xb5fa('0x20')]);}return _0xaffb14[_0xb5fa('0x6e')](_0x349e0b);}})[_0xb5fa('0x2a')](function(_0x35b509){if(_0x35b509){return _0x35b509?{'count':_0x334b3a,'rows':_0x35b509}:null;}})['then'](respondWithResult(_0x3b7625,null))[_0xb5fa('0x54')](handleError(_0x3b7625,null));};exports[_0xb5fa('0x70')]=function(_0x270cda,_0x33b2fa,_0x31449a){var _0x39733a=_0x270cda[_0xb5fa('0x56')][_0xb5fa('0x71')];var _0x330d32=_['map'](_0x39733a,'id');return db[_0xb5fa('0x6f')]['findAll']({'where':{'id':_0x330d32},'attributes':['id'],'include':[{'model':db[_0xb5fa('0x72')],'as':_0xb5fa('0x73'),'attributes':['id',_0xb5fa('0x36'),_0xb5fa('0x74'),_0xb5fa('0x75'),_0xb5fa('0x76')],'raw':!![]}]})['then'](function(_0x9618fc){if(_0x9618fc){var _0x3170c1=_[_0xb5fa('0x77')](_0x9618fc,function(_0x327f35){var _0x365087=_0x327f35[_0xb5fa('0x58')]({'plain':!![]});_0x365087[_0xb5fa('0x73')]['forEach'](function(_0x5d0e21){_0x5d0e21[_0xb5fa('0x78')]=_[_0xb5fa('0x35')](_0x39733a,{'id':_0x365087['id']})[_0xb5fa('0x78')];});return _0x365087[_0xb5fa('0x73')];});return db[_0xb5fa('0x3c')][_0xb5fa('0x35')]({'where':{'id':_0x270cda[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](function(_0x31c103){return db[_0xb5fa('0x79')]['transaction'](function(_0x394383){return _0x31c103[_0xb5fa('0x70')](_0x330d32,{'transaction':_0x394383})[_0xb5fa('0x2a')](function(){return BPromise[_0xb5fa('0x7a')](_0x39733a,function(_0x161d37){return db[_0xb5fa('0x7b')][_0xb5fa('0x7c')]({'TeamId':_0x161d37['id'],'VoiceQueueId':_0x270cda[_0xb5fa('0x51')]['id'],'penalty':_0x161d37[_0xb5fa('0x78')]},{'transaction':_0x394383});});})[_0xb5fa('0x2a')](function(){return BPromise[_0xb5fa('0x7a')](_0x3170c1,function(_0x140068){return db[_0xb5fa('0x7d')][_0xb5fa('0x7e')]({'where':{'UserId':_0x140068['id'],'VoiceQueueId':_0x270cda['params']['id']},'defaults':{'penalty':_0x140068['penalty']},'transaction':_0x394383});});})[_0xb5fa('0x2a')](function(){return BPromise[_0xb5fa('0x7a')](_['filter'](_0x3170c1,{'online':!![]}),function(_0x419d0c){return db[_0xb5fa('0x7f')][_0xb5fa('0x7c')]({'membername':_0x419d0c['name'],'UserId':_0x419d0c['id'],'queue_name':_0x31c103[_0xb5fa('0x36')],'VoiceQueueId':_0x31c103['id'],'interface':_[_0xb5fa('0x80')](_0x419d0c[_0xb5fa('0x76')])?util[_0xb5fa('0x81')](_0xb5fa('0x82'),_0x419d0c[_0xb5fa('0x36')]):_0x419d0c[_0xb5fa('0x76')],'paused':_0x419d0c[_0xb5fa('0x75')]||![],'penalty':_0x419d0c['penalty']},{'transaction':_0x394383});});})[_0xb5fa('0x2a')](function(){_0x3170c1[_0xb5fa('0x83')](function(_0x4da81b){socket[_0xb5fa('0x84')](_0xb5fa('0x85'),{'UserId':_0x4da81b['id'],'VoiceQueueId':_0x31c103['id']});});});});});}})['then'](respondWithStatusCode(_0x33b2fa,null))[_0xb5fa('0x54')](handleError(_0x33b2fa,null));};exports[_0xb5fa('0x86')]=function(_0xc4359f,_0x110d6e,_0x413427){return db[_0xb5fa('0x6f')][_0xb5fa('0x4e')]({'where':{'id':_0xc4359f[_0xb5fa('0x40')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb5fa('0x72')],'as':_0xb5fa('0x73'),'attributes':['id'],'raw':!![]}]})[_0xb5fa('0x2a')](handleEntityNotFound(_0x110d6e,null))[_0xb5fa('0x2a')](function(_0xe67c27){var _0x486620=_[_0xb5fa('0x31')](_0xe67c27,'id');var _0x32718e=[];var _0x426bcc=[];var _0x5f5aec=squel[_0xb5fa('0x87')]();_0x5f5aec[_0xb5fa('0x88')](_0xb5fa('0x89'))['from'](_0xb5fa('0x8a'),'tq')[_0xb5fa('0x8b')](_0xb5fa('0x8c'),'ut',_0xb5fa('0x8d'))[_0xb5fa('0x47')](_0xb5fa('0x8e'),_0xc4359f[_0xb5fa('0x51')]['id']);for(var _0xae1424=0x0;_0xae1424<_0xe67c27[_0xb5fa('0x44')];_0xae1424+=0x1){let _0x5ca7f7=_0xe67c27[_0xae1424];for(var _0x47f1fa=0x0;_0x47f1fa<_0x5ca7f7[_0xb5fa('0x73')][_0xb5fa('0x44')];_0x47f1fa+=0x1){let _0x4e65cc=_0x5ca7f7['Agents'][_0x47f1fa];var _0x5373fb=_0x5f5aec['clone']();_0x5373fb['where'](_0xb5fa('0x8f'),_0x4e65cc['id']);_0x426bcc[_0xb5fa('0x90')](db[_0xb5fa('0x79')][_0xb5fa('0x40')](_0x5373fb[_0xb5fa('0x91')](),{'type':db[_0xb5fa('0x79')][_0xb5fa('0x92')][_0xb5fa('0x93')]})[_0xb5fa('0x2a')](function(_0x459a9c){if(_0x459a9c['length']===0x1){return _0x4e65cc['id'];}else{var _0x525cc6=_[_0xb5fa('0x94')](_[_0xb5fa('0x31')](_0x459a9c,_0xb5fa('0x95')),function(_0x48a74d){return _['includes'](_0x486620,_0x48a74d);});if(_0x525cc6){return _0x4e65cc['id'];}}}));}}return BPromise[_0xb5fa('0x96')](_0x426bcc)[_0xb5fa('0x2a')](function(_0x326014){_0x32718e=_(_0x32718e)[_0xb5fa('0x97')](_0x326014)[_0xb5fa('0x98')]()[_0xb5fa('0x32')]();return db[_0xb5fa('0x3c')][_0xb5fa('0x35')]({'where':{'id':_0xc4359f[_0xb5fa('0x51')]['id']}})['then'](function(_0x17a3d3){return db[_0xb5fa('0x79')][_0xb5fa('0x99')](function(_0x4277fb){return _0x17a3d3[_0xb5fa('0x86')](_0xc4359f[_0xb5fa('0x40')][_0xb5fa('0x9a')],{'transaction':_0x4277fb})[_0xb5fa('0x2a')](function(){if(!_['isEmpty'](_0x32718e)){return _0x17a3d3[_0xb5fa('0x9b')](_0x32718e,{'transaction':_0x4277fb})[_0xb5fa('0x2a')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0xc4359f[_0xb5fa('0x51')]['id'],'UserId':_0x32718e},'transaction':_0x4277fb});});}})['then'](function(){_0x32718e[_0xb5fa('0x83')](function(_0x29dbb8){socket[_0xb5fa('0x84')](_0xb5fa('0x9c'),{'UserId':_0x29dbb8,'VoiceQueueId':_0x17a3d3['id']});});});});});});})[_0xb5fa('0x2a')](respondWithStatusCode(_0x110d6e,null))[_0xb5fa('0x54')](handleError(_0x110d6e,null));};exports[_0xb5fa('0x9d')]=function(_0x1abbf0,_0x5c2255,_0x7c6bfa){var _0x4555c7,_0x38e337;return db[_0xb5fa('0x3c')]['find']({'where':{'id':_0x1abbf0[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x5c2255,null))['then'](function(_0x239e39){if(_0x239e39){_0x38e337=_0x239e39;return _0x239e39[_0xb5fa('0x9d')](_0x1abbf0['body'][_0xb5fa('0x9a')],_[_0xb5fa('0x60')](_0x1abbf0['body'],[_0xb5fa('0x9a'),'id'])||{})['spread'](function(_0x499fe4){for(var _0x2b84a6=0x0;_0x2b84a6<_0x1abbf0[_0xb5fa('0x56')][_0xb5fa('0x9a')][_0xb5fa('0x44')];_0x2b84a6+=0x1){socket[_0xb5fa('0x84')](_0xb5fa('0x85'),{'UserId':Number(_0x1abbf0[_0xb5fa('0x56')]['ids'][_0x2b84a6]),'VoiceQueueId':Number(_0x1abbf0[_0xb5fa('0x51')]['id'])});}return _0x499fe4;});}})[_0xb5fa('0x2a')](function(_0x5e656f){_0x4555c7=_0x5e656f||[];if(_0x38e337){return db['User'][_0xb5fa('0x4e')]({'where':{'id':_0x1abbf0[_0xb5fa('0x56')][_0xb5fa('0x9a')]},'attributes':['id','name',_0xb5fa('0x74'),'voicePause',_0xb5fa('0x76')],'raw':!![]});}})['then'](function(_0x4051b0){if(!_[_0xb5fa('0x9e')](_0x4051b0)){var _0xccf981=[];for(var _0x124c04=0x0;_0x124c04<_0x4051b0[_0xb5fa('0x44')];_0x124c04++){if(_0x4051b0[_0x124c04][_0xb5fa('0x74')]){_0xccf981[_0xb5fa('0x90')](db['UserVoiceQueueRt'][_0xb5fa('0x7c')]({'membername':_0x4051b0[_0x124c04][_0xb5fa('0x36')],'UserId':_0x4051b0[_0x124c04]['id'],'queue_name':_0x38e337['name'],'VoiceQueueId':_0x38e337['id'],'interface':_[_0xb5fa('0x80')](_0x4051b0[_0x124c04]['interface'])?util[_0xb5fa('0x81')](_0xb5fa('0x82'),_0x4051b0[_0x124c04][_0xb5fa('0x36')]):_0x4051b0[_0x124c04][_0xb5fa('0x76')],'paused':_0x4051b0[_0x124c04]['voicePause']||![],'penalty':_0x1abbf0[_0xb5fa('0x56')]['penalty']||0x0}));}}return BPromise[_0xb5fa('0x96')](_0xccf981);}})[_0xb5fa('0x2a')](function(){return _0x4555c7;})['then'](respondWithResult(_0x5c2255,null))[_0xb5fa('0x54')](handleError(_0x5c2255,null));};exports[_0xb5fa('0x9b')]=function(_0x2abe9b,_0x1e4fa1,_0x327b53){return db['VoiceQueue'][_0xb5fa('0x35')]({'where':{'id':_0x2abe9b['params']['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x1e4fa1,null))[_0xb5fa('0x2a')](function(_0x5a57e0){if(_0x5a57e0){return _0x5a57e0[_0xb5fa('0x9b')](_0x2abe9b[_0xb5fa('0x40')]['ids'])['then'](function(){if(_[_0xb5fa('0x9f')](_0x2abe9b[_0xb5fa('0x40')][_0xb5fa('0x9a')])){for(var _0x1a501e=0x0;_0x1a501e<_0x2abe9b[_0xb5fa('0x40')][_0xb5fa('0x9a')][_0xb5fa('0x44')];_0x1a501e+=0x1){socket[_0xb5fa('0x84')](_0xb5fa('0x9c'),{'UserId':Number(_0x2abe9b[_0xb5fa('0x40')]['ids'][_0x1a501e]),'VoiceQueueId':Number(_0x2abe9b['params']['id'])});}}else{socket['emit'](_0xb5fa('0x9c'),{'UserId':Number(_0x2abe9b[_0xb5fa('0x40')]['ids']),'VoiceQueueId':Number(_0x2abe9b['params']['id'])});}});}})['then'](function(_0x5ae447){return db[_0xb5fa('0x7f')]['destroy']({'where':{'VoiceQueueId':_0x2abe9b[_0xb5fa('0x51')]['id'],'UserId':_0x2abe9b[_0xb5fa('0x40')][_0xb5fa('0x9a')]}})['then'](function(){return _0x5ae447;});})[_0xb5fa('0x2a')](respondWithStatusCode(_0x1e4fa1,null))[_0xb5fa('0x54')](handleError(_0x1e4fa1,null));};exports['getAgents']=function(_0x31e2a1,_0xcf6d4d,_0x57dcb6){var _0x5c8559={};var _0x4d88b8={};var _0x17f4d4;var _0x460d3c;return db[_0xb5fa('0x3c')]['findOne']({'where':{'id':_0x31e2a1[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0xcf6d4d,null))[_0xb5fa('0x2a')](function(_0x3a3b73){if(_0x3a3b73){_0x17f4d4=_0x3a3b73;_0x4d88b8[_0xb5fa('0x3e')]=_['keys'](db[_0xb5fa('0x72')]['rawAttributes']);_0x4d88b8[_0xb5fa('0x40')]=_[_0xb5fa('0x3f')](_0x31e2a1[_0xb5fa('0x40')]);_0x4d88b8[_0xb5fa('0x41')]=_[_0xb5fa('0x42')](_0x4d88b8[_0xb5fa('0x3e')],_0x4d88b8[_0xb5fa('0x40')]);_0x5c8559[_0xb5fa('0x43')]=_[_0xb5fa('0x42')](_0x4d88b8['model'],qs['fields'](_0x31e2a1[_0xb5fa('0x40')][_0xb5fa('0x53')]));_0x5c8559['attributes']=_0x5c8559[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x5c8559['attributes']:_0x4d88b8[_0xb5fa('0x3e')];_0x5c8559[_0xb5fa('0x45')]=qs[_0xb5fa('0x46')](_0x31e2a1['query'][_0xb5fa('0x46')]);_0x5c8559[_0xb5fa('0x47')]=qs[_0xb5fa('0x41')](_[_0xb5fa('0x48')](_0x31e2a1[_0xb5fa('0x40')],_0x4d88b8['filters']));if(_0x31e2a1[_0xb5fa('0x40')][_0xb5fa('0x2f')]){_0x5c8559[_0xb5fa('0x47')]=_[_0xb5fa('0x49')](_0x5c8559[_0xb5fa('0x47')],{'$or':_['map'](_0x5c8559['attributes'],function(_0x19a567){var _0xb3a8c1={};_0xb3a8c1[_0x19a567]={'$like':'%'+_0x31e2a1[_0xb5fa('0x40')][_0xb5fa('0x2f')]+'%'};return _0xb3a8c1;})});}_0x5c8559=_[_0xb5fa('0x49')]({},_0x5c8559,_0x31e2a1['options']);return _0x17f4d4['getAgents'](_0x5c8559);}})['then'](function(_0x389fd1){if(_0x389fd1){_0x460d3c=_0x389fd1[_0xb5fa('0x44')];if(!_0x31e2a1['query'][_0xb5fa('0x65')](_0xb5fa('0x66'))){_0x5c8559[_0xb5fa('0x22')]=qs[_0xb5fa('0x22')](_0x31e2a1[_0xb5fa('0x40')]['limit']);_0x5c8559[_0xb5fa('0x20')]=qs['offset'](_0x31e2a1[_0xb5fa('0x40')][_0xb5fa('0x20')]);}return _0x17f4d4[_0xb5fa('0xa0')](_0x5c8559);}})[_0xb5fa('0x2a')](function(_0x1db92b){if(_0x1db92b){return _0x1db92b?{'count':_0x460d3c,'rows':_0x1db92b}:null;}})[_0xb5fa('0x2a')](respondWithResult(_0xcf6d4d,null))[_0xb5fa('0x54')](handleError(_0xcf6d4d,null));};exports[_0xb5fa('0xa1')]=function(_0x42a3e9,_0x497465,_0x268f7e){var _0x7a3bd4={};var _0x2f8007={};var _0x22a5ec;var _0x5cf2e1;return db[_0xb5fa('0x3c')][_0xb5fa('0x68')]({'where':{'id':_0x42a3e9['params']['id']}})['then'](handleEntityNotFound(_0x497465,null))[_0xb5fa('0x2a')](function(_0x1c296a){if(_0x1c296a){_0x22a5ec=_0x1c296a;_0x2f8007['model']=_['keys'](db[_0xb5fa('0x7f')][_0xb5fa('0x52')]);_0x2f8007[_0xb5fa('0x40')]=_[_0xb5fa('0x3f')](_0x42a3e9[_0xb5fa('0x40')]);_0x2f8007['filters']=_['intersection'](_0x2f8007[_0xb5fa('0x3e')],_0x2f8007['query']);_0x7a3bd4[_0xb5fa('0x43')]=_['intersection'](_0x2f8007[_0xb5fa('0x3e')],qs[_0xb5fa('0x53')](_0x42a3e9['query']['fields']));_0x7a3bd4[_0xb5fa('0x43')]=_0x7a3bd4['attributes'][_0xb5fa('0x44')]?_0x7a3bd4[_0xb5fa('0x43')]:_0x2f8007['model'];_0x7a3bd4[_0xb5fa('0x45')]=qs[_0xb5fa('0x46')](_0x42a3e9[_0xb5fa('0x40')]['sort']);_0x7a3bd4[_0xb5fa('0x47')]=qs[_0xb5fa('0x41')](_['pick'](_0x42a3e9[_0xb5fa('0x40')],_0x2f8007[_0xb5fa('0x41')]));if(_0x42a3e9[_0xb5fa('0x40')][_0xb5fa('0x2f')]){_0x7a3bd4[_0xb5fa('0x47')]=_[_0xb5fa('0x49')](_0x7a3bd4[_0xb5fa('0x47')],{'$or':_[_0xb5fa('0x31')](_0x7a3bd4[_0xb5fa('0x43')],function(_0x10dd98){var _0x2dd8fe={};_0x2dd8fe[_0x10dd98]={'$like':'%'+_0x42a3e9[_0xb5fa('0x40')][_0xb5fa('0x2f')]+'%'};return _0x2dd8fe;})});}_0x7a3bd4=_[_0xb5fa('0x49')]({},_0x7a3bd4,_0x42a3e9[_0xb5fa('0x4b')]);return _0x22a5ec[_0xb5fa('0xa1')](_0x7a3bd4);}})[_0xb5fa('0x2a')](function(_0x3deef3){if(_0x3deef3){_0x5cf2e1=_0x3deef3[_0xb5fa('0x44')];if(!_0x42a3e9[_0xb5fa('0x40')][_0xb5fa('0x65')](_0xb5fa('0x66'))){_0x7a3bd4[_0xb5fa('0x22')]=qs[_0xb5fa('0x22')](_0x42a3e9['query'][_0xb5fa('0x22')]);_0x7a3bd4[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0x42a3e9[_0xb5fa('0x40')][_0xb5fa('0x20')]);}return _0x22a5ec[_0xb5fa('0xa1')](_0x7a3bd4);}})['then'](function(_0x20a8d1){return _0x20a8d1?{'count':_0x5cf2e1,'rows':_0x20a8d1}:null;})[_0xb5fa('0x2a')](respondWithResult(_0x497465,null))[_0xb5fa('0x54')](handleError(_0x497465,null));};exports[_0xb5fa('0xa2')]=function(_0x440432,_0x24d5cf,_0x469df4){var _0x992e57={};var _0x3c75c9={};var _0x39c124;var _0xba4cd0;return db['VoiceQueue'][_0xb5fa('0x68')]({'where':{'id':_0x440432[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x24d5cf,null))[_0xb5fa('0x2a')](function(_0x5345f8){if(_0x5345f8){_0x39c124=_0x5345f8;_0x3c75c9[_0xb5fa('0x3e')]=_['keys'](db[_0xb5fa('0xa3')]['rawAttributes']);_0x3c75c9['query']=_[_0xb5fa('0x3f')](_0x440432[_0xb5fa('0x40')]);_0x3c75c9[_0xb5fa('0x41')]=_[_0xb5fa('0x42')](_0x3c75c9[_0xb5fa('0x3e')],_0x3c75c9[_0xb5fa('0x40')]);_0x992e57[_0xb5fa('0x43')]=_[_0xb5fa('0x42')](_0x3c75c9[_0xb5fa('0x3e')],qs[_0xb5fa('0x53')](_0x440432['query'][_0xb5fa('0x53')]));_0x992e57['attributes']=_0x992e57[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x992e57[_0xb5fa('0x43')]:_0x3c75c9[_0xb5fa('0x3e')];_0x992e57[_0xb5fa('0x45')]=qs[_0xb5fa('0x46')](_0x440432[_0xb5fa('0x40')]['sort']);_0x992e57['where']=qs[_0xb5fa('0x41')](_[_0xb5fa('0x48')](_0x440432[_0xb5fa('0x40')],_0x3c75c9[_0xb5fa('0x41')]));if(_0x440432[_0xb5fa('0x40')][_0xb5fa('0x2f')]){_0x992e57['where']=_[_0xb5fa('0x49')](_0x992e57[_0xb5fa('0x47')],{'$or':_[_0xb5fa('0x31')](_0x992e57[_0xb5fa('0x43')],function(_0x47f1fc){var _0x391545={};_0x391545[_0x47f1fc]={'$like':'%'+_0x440432[_0xb5fa('0x40')][_0xb5fa('0x2f')]+'%'};return _0x391545;})});}_0x992e57=_['merge']({},_0x992e57,_0x440432[_0xb5fa('0x4b')]);return _0x39c124[_0xb5fa('0xa2')](_0x992e57);}})[_0xb5fa('0x2a')](function(_0x525e79){if(_0x525e79){_0xba4cd0=_0x525e79[_0xb5fa('0x44')];if(!_0x440432[_0xb5fa('0x40')][_0xb5fa('0x65')](_0xb5fa('0x66'))){_0x992e57[_0xb5fa('0x22')]=qs[_0xb5fa('0x22')](_0x440432[_0xb5fa('0x40')][_0xb5fa('0x22')]);_0x992e57['offset']=qs[_0xb5fa('0x20')](_0x440432[_0xb5fa('0x40')][_0xb5fa('0x20')]);}return _0x39c124[_0xb5fa('0xa2')](_0x992e57);}})[_0xb5fa('0x2a')](function(_0xc8ae02){if(_0xc8ae02){return _0xc8ae02?{'count':_0xba4cd0,'rows':_0xc8ae02}:null;}})['then'](respondWithResult(_0x24d5cf,null))[_0xb5fa('0x54')](handleError(_0x24d5cf,null));};exports[_0xb5fa('0xa4')]=function(_0x4ba538,_0x135da7,_0x11718c){var _0x2f70bb=moment()[_0xb5fa('0x81')](_0xb5fa('0xa5'));var _0x30adfb,_0x2415ad;return db[_0xb5fa('0x3c')]['find']({'where':{'id':_0x4ba538['params']['id']}})['then'](handleEntityNotFound(_0x135da7,null))[_0xb5fa('0x2a')](function(_0x1a83de){if(_0x1a83de){_0x2415ad=_0x1a83de;return _0x1a83de[_0xb5fa('0xa4')](_0x4ba538[_0xb5fa('0x56')]['ids'],_[_0xb5fa('0x60')](_0x4ba538[_0xb5fa('0x56')],['ids','id'])||{});}return null;})[_0xb5fa('0xa6')](function(_0x1cc5e9){var _0x9130ef;_0x30adfb=_0x1cc5e9||[];var _0x534af4=[];if(_0x1cc5e9){for(var _0x4bea5f=0x0;_0x4bea5f<_0x1cc5e9['length'];_0x4bea5f+=0x1){var _0x20ee6e=_0x1cc5e9[_0x4bea5f][_0xb5fa('0x58')]({'plain':!![]});_0x2415ad[_0xb5fa('0xa7')]=_0x4ba538['body'][_0xb5fa('0xa7')]?_0x4ba538['body'][_0xb5fa('0xa7')]:_0x2415ad[_0xb5fa('0xa7')];switch(_0x2415ad['dialCheckDuplicateType']){case _0xb5fa('0xa8'):_0x9130ef=squel[_0xb5fa('0xa9')]()[_0xb5fa('0xaa')](_0xb5fa('0xab'))[_0xb5fa('0xac')](['phone',_0xb5fa('0xad'),_0xb5fa('0xae'),_0xb5fa('0xaf'),_0xb5fa('0x6a'),_0xb5fa('0x62'),_0xb5fa('0x61')],squel[_0xb5fa('0x87')]()[_0xb5fa('0x88')](_0xb5fa('0xb0'),'phone')[_0xb5fa('0x88')]('\x27'+_0x2f70bb+'\x27',_0xb5fa('0xad'))[_0xb5fa('0x88')]('id',_0xb5fa('0xae'))[_0xb5fa('0x88')](_0x20ee6e[_0xb5fa('0xb1')]['toString'](),'ListId')[_0xb5fa('0x88')](_0x4ba538[_0xb5fa('0x51')]['id']['toString'](),'VoiceQueueId')[_0xb5fa('0x88')]('\x27'+_0x2f70bb+'\x27',_0xb5fa('0x62'))[_0xb5fa('0x88')]('\x27'+_0x2f70bb+'\x27',_0xb5fa('0x61'))[_0xb5fa('0xb2')](_0xb5fa('0xb3'))[_0xb5fa('0x47')](_0xb5fa('0xb4'))[_0xb5fa('0x47')](_0xb5fa('0xb5'),_0x20ee6e[_0xb5fa('0xb1')][_0xb5fa('0x91')]())['where'](_0xb5fa('0xb6'))[_0xb5fa('0x47')](_0xb5fa('0xb7'),squel[_0xb5fa('0x87')]()[_0xb5fa('0x88')]('COALESCE(calleridnum,\x27\x27)')[_0xb5fa('0xb2')](_0xb5fa('0xb8'))[_0xb5fa('0x47')](_0xb5fa('0x8e'),_0x4ba538[_0xb5fa('0x51')]['id'][_0xb5fa('0x91')]()))[_0xb5fa('0x47')](_0xb5fa('0xb7'),squel[_0xb5fa('0x87')]()[_0xb5fa('0x88')]('COALESCE(phone,\x27\x27)')[_0xb5fa('0xb2')]('cm_hopper')[_0xb5fa('0x47')](_0xb5fa('0x8e'),_0x4ba538[_0xb5fa('0x51')]['id'][_0xb5fa('0x91')]())))[_0xb5fa('0x91')]();break;case'onlyIfOpen':_0x9130ef=squel[_0xb5fa('0xa9')]()['into'](_0xb5fa('0xab'))[_0xb5fa('0xac')]([_0xb5fa('0xb0'),_0xb5fa('0xad'),_0xb5fa('0xae'),_0xb5fa('0xaf'),_0xb5fa('0x6a'),_0xb5fa('0x62'),_0xb5fa('0x61')],squel[_0xb5fa('0x87')]()[_0xb5fa('0x88')]('phone','phone')[_0xb5fa('0x88')]('\x27'+_0x2f70bb+'\x27',_0xb5fa('0xad'))['field']('id','ContactId')[_0xb5fa('0x88')](_0x20ee6e['CmListId'][_0xb5fa('0x91')](),_0xb5fa('0xaf'))[_0xb5fa('0x88')](_0x4ba538[_0xb5fa('0x51')]['id'][_0xb5fa('0x91')](),_0xb5fa('0x6a'))[_0xb5fa('0x88')]('\x27'+_0x2f70bb+'\x27',_0xb5fa('0x62'))[_0xb5fa('0x88')]('\x27'+_0x2f70bb+'\x27',_0xb5fa('0x61'))[_0xb5fa('0xb2')](_0xb5fa('0xb3'))[_0xb5fa('0x47')]('deletedAt\x20IS\x20NULL')[_0xb5fa('0x47')](_0xb5fa('0xb5'),_0x20ee6e[_0xb5fa('0xb1')][_0xb5fa('0x91')]())[_0xb5fa('0x47')](_0xb5fa('0xb6'))['where'](_0xb5fa('0xb7'),squel['select']()[_0xb5fa('0x88')]('COALESCE(phone,\x27\x27)')[_0xb5fa('0xb2')](_0xb5fa('0xab'))[_0xb5fa('0x47')](_0xb5fa('0x8e'),_0x4ba538[_0xb5fa('0x51')]['id'][_0xb5fa('0x91')]())))[_0xb5fa('0x91')]();break;default:_0x9130ef=squel[_0xb5fa('0xa9')]()[_0xb5fa('0xaa')](_0xb5fa('0xab'))[_0xb5fa('0xac')]([_0xb5fa('0xb0'),_0xb5fa('0xad'),_0xb5fa('0xae'),_0xb5fa('0xaf'),_0xb5fa('0x6a'),_0xb5fa('0x62'),_0xb5fa('0x61')],squel['select']()[_0xb5fa('0x88')](_0xb5fa('0xb0'),_0xb5fa('0xb0'))['field']('\x27'+_0x2f70bb+'\x27',_0xb5fa('0xad'))[_0xb5fa('0x88')]('id',_0xb5fa('0xae'))[_0xb5fa('0x88')](_0x20ee6e[_0xb5fa('0xb1')][_0xb5fa('0x91')](),_0xb5fa('0xaf'))[_0xb5fa('0x88')](_0x4ba538['params']['id'][_0xb5fa('0x91')](),_0xb5fa('0x6a'))[_0xb5fa('0x88')]('\x27'+_0x2f70bb+'\x27',_0xb5fa('0x62'))['field']('\x27'+_0x2f70bb+'\x27','updatedAt')[_0xb5fa('0xb2')](_0xb5fa('0xb3'))[_0xb5fa('0x47')](_0xb5fa('0xb4'))['where']('ListId\x20=\x20?',_0x20ee6e[_0xb5fa('0xb1')][_0xb5fa('0x91')]())[_0xb5fa('0x47')](_0xb5fa('0xb6')))[_0xb5fa('0x91')]();}_0x534af4['push'](db[_0xb5fa('0x79')][_0xb5fa('0x40')](_0x9130ef));}return BPromise[_0xb5fa('0x96')](_0x534af4);}})['then'](function(){var _0x127046=[];var _0x1f125d=squel[_0xb5fa('0xa9')]()[_0xb5fa('0xaa')](_0xb5fa('0xb9'))[_0xb5fa('0xac')]([_0xb5fa('0xba'),'phone',_0xb5fa('0xbb'),'createdAt',_0xb5fa('0x61')],squel[_0xb5fa('0x87')]()['field'](_0xb5fa('0xbc'))[_0xb5fa('0x88')](_0xb5fa('0xbd'))['field'](_0xb5fa('0xbe'))[_0xb5fa('0x88')]('\x27'+_0x2f70bb+'\x27',_0xb5fa('0x62'))[_0xb5fa('0x88')]('\x27'+_0x2f70bb+'\x27',_0xb5fa('0x61'))[_0xb5fa('0xb2')](_0xb5fa('0xbf'),'ci')['join']('cm_hopper','h',_0xb5fa('0xc0'))[_0xb5fa('0x47')](_0xb5fa('0xc1'),_0x2f70bb)[_0xb5fa('0x47')](_0xb5fa('0xc2'),_0xb5fa('0xc3')))[_0xb5fa('0x91')]();_0x127046['push'](db['sequelize']['query'](_0x1f125d));return BPromise['all'](_0x127046);})[_0xb5fa('0x2a')](function(){return _0x30adfb;})[_0xb5fa('0x2a')](respondWithResult(_0x135da7,null))[_0xb5fa('0x54')](handleError(_0x135da7,null));};exports[_0xb5fa('0xc4')]=function(_0x4bd42c,_0x57e2e7,_0x5bc013){return db['VoiceQueue'][_0xb5fa('0x35')]({'where':{'id':_0x4bd42c['params']['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x57e2e7,null))[_0xb5fa('0x2a')](function(_0x1ab9fa){if(_0x1ab9fa){return _0x1ab9fa['removeLists'](_0x4bd42c[_0xb5fa('0x40')]['ids']);}})[_0xb5fa('0x2a')](function(_0x244f8c){if(_0x244f8c){return db['CmHopper']['destroy']({'where':{'ListId':_0x4bd42c['query']['ids'],'VoiceQueueId':_0x4bd42c[_0xb5fa('0x51')]['id']}})['then'](function(){return _0x244f8c;});}})[_0xb5fa('0x2a')](respondWithStatusCode(_0x57e2e7,null))[_0xb5fa('0x54')](handleError(_0x57e2e7,null));};exports['getBlackLists']=function(_0x401997,_0x243f24,_0x54015b){var _0x252c71={};var _0x1114ec={};var _0x5ec374;var _0x56db90;return db[_0xb5fa('0x3c')][_0xb5fa('0x68')]({'where':{'id':_0x401997[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x243f24,null))[_0xb5fa('0x2a')](function(_0x2aa222){if(_0x2aa222){_0x5ec374=_0x2aa222;_0x1114ec[_0xb5fa('0x3e')]=_[_0xb5fa('0x3f')](db[_0xb5fa('0xa3')][_0xb5fa('0x52')]);_0x1114ec['query']=_[_0xb5fa('0x3f')](_0x401997[_0xb5fa('0x40')]);_0x1114ec[_0xb5fa('0x41')]=_[_0xb5fa('0x42')](_0x1114ec['model'],_0x1114ec[_0xb5fa('0x40')]);_0x252c71['attributes']=_['intersection'](_0x1114ec[_0xb5fa('0x3e')],qs['fields'](_0x401997[_0xb5fa('0x40')][_0xb5fa('0x53')]));_0x252c71[_0xb5fa('0x43')]=_0x252c71[_0xb5fa('0x43')][_0xb5fa('0x44')]?_0x252c71[_0xb5fa('0x43')]:_0x1114ec[_0xb5fa('0x3e')];_0x252c71['order']=qs[_0xb5fa('0x46')](_0x401997[_0xb5fa('0x40')][_0xb5fa('0x46')]);_0x252c71[_0xb5fa('0x47')]=qs[_0xb5fa('0x41')](_[_0xb5fa('0x48')](_0x401997[_0xb5fa('0x40')],_0x1114ec[_0xb5fa('0x41')]));if(_0x401997['query']['filter']){_0x252c71[_0xb5fa('0x47')]=_[_0xb5fa('0x49')](_0x252c71[_0xb5fa('0x47')],{'$or':_[_0xb5fa('0x31')](_0x252c71[_0xb5fa('0x43')],function(_0x3f87c6){var _0x3c9643={};_0x3c9643[_0x3f87c6]={'$like':'%'+_0x401997[_0xb5fa('0x40')][_0xb5fa('0x2f')]+'%'};return _0x3c9643;})});}_0x252c71=_['merge']({},_0x252c71,_0x401997[_0xb5fa('0x4b')]);return _0x5ec374[_0xb5fa('0xc5')](_0x252c71);}})[_0xb5fa('0x2a')](function(_0x1795cd){if(_0x1795cd){_0x56db90=_0x1795cd['length'];if(!_0x401997[_0xb5fa('0x40')][_0xb5fa('0x65')](_0xb5fa('0x66'))){_0x252c71[_0xb5fa('0x22')]=qs[_0xb5fa('0x22')](_0x401997[_0xb5fa('0x40')][_0xb5fa('0x22')]);_0x252c71[_0xb5fa('0x20')]=qs['offset'](_0x401997[_0xb5fa('0x40')][_0xb5fa('0x20')]);}return _0x5ec374[_0xb5fa('0xc5')](_0x252c71);}})[_0xb5fa('0x2a')](function(_0xe2d44){if(_0xe2d44){return _0xe2d44?{'count':_0x56db90,'rows':_0xe2d44}:null;}})[_0xb5fa('0x2a')](respondWithResult(_0x243f24,null))[_0xb5fa('0x54')](handleError(_0x243f24,null));};exports[_0xb5fa('0xc6')]=function(_0x4a9163,_0x5212f0,_0x2cbb88){var _0x294654,_0x4337db;return db['VoiceQueue'][_0xb5fa('0x35')]({'where':{'id':_0x4a9163[_0xb5fa('0x51')]['id']}})['then'](handleEntityNotFound(_0x5212f0,null))[_0xb5fa('0x2a')](function(_0x553b26){if(_0x553b26){_0x4337db=_0x553b26;return _0x553b26['addBlackLists'](_0x4a9163[_0xb5fa('0x56')][_0xb5fa('0x9a')],_['omit'](_0x4a9163[_0xb5fa('0x56')],[_0xb5fa('0x9a'),'id'])||{});}return null;})[_0xb5fa('0xa6')](function(_0x424caf){var _0x3bb73f;_0x294654=_0x424caf||[];var _0x5646d9=[];if(_0x424caf){for(var _0x36462b=0x0;_0x36462b<_0x424caf[_0xb5fa('0x44')];_0x36462b+=0x1){var _0x525c8e=_0x424caf[_0x36462b][_0xb5fa('0x58')]({'plain':!![]});_0x3bb73f=squel['insert']()['into'](_0xb5fa('0xc7'))[_0xb5fa('0xac')]([_0xb5fa('0xb0'),_0xb5fa('0xae'),_0xb5fa('0xaf'),_0xb5fa('0x6a'),'createdAt',_0xb5fa('0x61')],squel[_0xb5fa('0x87')]()[_0xb5fa('0x88')](_0xb5fa('0xb0'),_0xb5fa('0xb0'))[_0xb5fa('0x88')]('id',_0xb5fa('0xae'))[_0xb5fa('0x88')](_0x525c8e[_0xb5fa('0xb1')]['toString'](),_0xb5fa('0xaf'))['field'](_0x4a9163[_0xb5fa('0x51')]['id'][_0xb5fa('0x91')](),'VoiceQueueId')[_0xb5fa('0x88')](_0xb5fa('0xc8'),_0xb5fa('0x62'))['field'](_0xb5fa('0xc8'),_0xb5fa('0x61'))[_0xb5fa('0xb2')]('cm_contacts')[_0xb5fa('0x47')]('deletedAt\x20IS\x20NULL')['where'](_0xb5fa('0xb5'),_0x525c8e[_0xb5fa('0xb1')][_0xb5fa('0x91')]())[_0xb5fa('0x47')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x5646d9['push'](db[_0xb5fa('0x79')]['query'](_0x3bb73f));}return BPromise['all'](_0x5646d9);}})['then'](function(){return _0x294654;})['then'](respondWithResult(_0x5212f0,null))['catch'](handleError(_0x5212f0,null));};exports['removeBlackLists']=function(_0x3fb210,_0x541c45,_0x399d08){return db[_0xb5fa('0x3c')][_0xb5fa('0x35')]({'where':{'id':_0x3fb210[_0xb5fa('0x51')]['id']}})[_0xb5fa('0x2a')](handleEntityNotFound(_0x541c45,null))[_0xb5fa('0x2a')](function(_0x3a4984){if(_0x3a4984){return _0x3a4984[_0xb5fa('0xc9')](_0x3fb210[_0xb5fa('0x40')]['ids']);}})[_0xb5fa('0x2a')](function(_0x5772c5){if(_0x5772c5){return db[_0xb5fa('0x6d')]['destroy']({'where':{'ListId':_0x3fb210[_0xb5fa('0x40')][_0xb5fa('0x9a')],'VoiceQueueId':_0x3fb210[_0xb5fa('0x51')]['id']}})['then'](function(){return _0x5772c5;});}})[_0xb5fa('0x2a')](respondWithStatusCode(_0x541c45,null))['catch'](handleError(_0x541c45,null));}; \ No newline at end of file +var _0x4af9=['body','user','get','role','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','findOne','CmHopper','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','penalty','Agents','sequelize','transaction','each','upsert','isNil','format','forEach','emit','userVoiceQueue:save','ids','select','field','team_has_voice_queues','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','addAgents','spread','push','userVoiceQueue:remove','UserVoiceQueueRt','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','cm_hopper','phone','scheduledAt','ListId','ContactId','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','phone\x20NOT\x20IN\x20(?)','fromQuery','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','join','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','find','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','VoiceQueue','includeAll','findAll','rows','params','include','catch','create'];(function(_0x55b65f,_0x44fa1a){var _0xe652a6=function(_0x1f6ba2){while(--_0x1f6ba2){_0x55b65f['push'](_0x55b65f['shift']());}};_0xe652a6(++_0x44fa1a);}(_0x4af9,0x12c));var _0x94af=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4af9[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x94af('0x0'));var rimraf=require(_0x94af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x94af('0x2'));var moment=require(_0x94af('0x3'));var BPromise=require(_0x94af('0x4'));var Mustache=require(_0x94af('0x5'));var util=require(_0x94af('0x6'));var path=require(_0x94af('0x7'));var sox=require(_0x94af('0x8'));var csv=require('to-csv');var ejs=require(_0x94af('0x9'));var fs=require('fs');var fs_extra=require(_0x94af('0xa'));var _=require(_0x94af('0xb'));var squel=require(_0x94af('0xc'));var crypto=require('crypto');var jsforce=require(_0x94af('0xd'));var deskjs=require(_0x94af('0xe'));var toCsv=require(_0x94af('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x94af('0x10'));var authService=require(_0x94af('0x11'));var qs=require(_0x94af('0x12'));var as=require(_0x94af('0x13'));var hardwareService=require(_0x94af('0x14'));var logger=require(_0x94af('0x15'))('api');var utils=require(_0x94af('0x16'));var config=require(_0x94af('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x94af('0x18'))['db'];config[_0x94af('0x19')]=_[_0x94af('0x1a')](config[_0x94af('0x19')],{'host':_0x94af('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x94af('0x19')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x4d080c,_0xa68306){_0xa68306=_0xa68306||0xcc;return function(_0x3300a3){if(_0x3300a3){return _0x4d080c[_0x94af('0x1c')](_0xa68306);}return _0x4d080c[_0x94af('0x1d')](_0xa68306)['end']();};}function respondWithResult(_0x275c63,_0x204ad7){_0x204ad7=_0x204ad7||0xc8;return function(_0x539f74){if(_0x539f74){return _0x275c63[_0x94af('0x1d')](_0x204ad7)[_0x94af('0x1e')](_0x539f74);}};}function respondWithFilteredResult(_0x11ee85,_0x32b1d4){return function(_0x414bc9){if(_0x414bc9){var _0x3d3611=typeof _0x32b1d4[_0x94af('0x1f')]===_0x94af('0x20')&&typeof _0x32b1d4[_0x94af('0x21')]===_0x94af('0x20');var _0x4a9d75=_0x414bc9['count'];var _0x4349db=_0x3d3611?0x0:_0x32b1d4[_0x94af('0x1f')];var _0xee81a=_0x3d3611?_0x414bc9[_0x94af('0x22')]:_0x32b1d4[_0x94af('0x1f')]+_0x32b1d4[_0x94af('0x21')];var _0x4adbea;if(_0xee81a>=_0x4a9d75){_0xee81a=_0x4a9d75;_0x4adbea=0xc8;}else{_0x4adbea=0xce;}_0x11ee85[_0x94af('0x1d')](_0x4adbea);return _0x11ee85['set'](_0x94af('0x23'),_0x4349db+'-'+_0xee81a+'/'+_0x4a9d75)['json'](_0x414bc9);}return null;};}function patchUpdates(_0xa0cf1a){return function(_0x3445cd){try{jsonpatch[_0x94af('0x24')](_0x3445cd,_0xa0cf1a,!![]);}catch(_0x521828){return BPromise[_0x94af('0x25')](_0x521828);}return _0x3445cd[_0x94af('0x26')]();};}function saveUpdates(_0x906599,_0x270f9a){return function(_0x587b74){if(_0x587b74){return _0x587b74[_0x94af('0x27')](_0x906599)[_0x94af('0x28')](function(_0x24e8a0){return _0x24e8a0;});}return null;};}function removeEntity(_0x3b6152,_0x202e5c){return function(_0x4334c2){if(_0x4334c2){return _0x4334c2[_0x94af('0x29')]()[_0x94af('0x28')](function(){var _0x131a93=_0x4334c2['get']({'plain':!![]});var _0x1ac64d=[{'name':'VoiceQueues','value':_0x94af('0x2a'),'ignore':![]},{'name':_0x94af('0x2b'),'value':_0x94af('0x2c'),'ignore':![]}];var _0x4898ac=_(_0x1ac64d)[_0x94af('0x2d')](_0x94af('0x2e'))['map'](_0x94af('0x2f'))[_0x94af('0x2f')]();if(_[_0x94af('0x30')](_0x4898ac,_0x131a93[_0x94af('0x31')])){return;}var _0x1700f6=_[_0x94af('0x32')](_0x1ac64d,['value',_0x131a93[_0x94af('0x31')]])['name'];return db['UserProfileResource'][_0x94af('0x29')]({'where':{'type':_0x1700f6,'resourceId':_0x131a93['id']}})[_0x94af('0x28')](function(){return _0x4334c2;});})[_0x94af('0x28')](function(){_0x3b6152[_0x94af('0x1d')](0xcc)[_0x94af('0x33')]();});}};}function handleEntityNotFound(_0x503d6b,_0x203b86){return function(_0x951441){if(!_0x951441){_0x503d6b['sendStatus'](0x194);}return _0x951441;};}function handleError(_0x42f0f2,_0x2f02cf){_0x2f02cf=_0x2f02cf||0x1f4;return function(_0x177bd2){logger[_0x94af('0x34')](_0x177bd2[_0x94af('0x35')]);if(_0x177bd2[_0x94af('0x36')]){delete _0x177bd2[_0x94af('0x36')];}_0x42f0f2['status'](_0x2f02cf)[_0x94af('0x37')](_0x177bd2);};}exports[_0x94af('0x38')]=function(_0x8fd6ba,_0x3e0a9a){var _0x26b846={},_0x3bced0={},_0x9b90fb={'count':0x0,'rows':[]};var _0xbd51ac=_[_0x94af('0x39')](db['VoiceQueue'][_0x94af('0x3a')],function(_0x950c6c){return{'name':_0x950c6c[_0x94af('0x3b')],'type':_0x950c6c[_0x94af('0x31')][_0x94af('0x3c')]};});_0x3bced0['model']=_[_0x94af('0x39')](_0xbd51ac,_0x94af('0x36'));_0x3bced0[_0x94af('0x3d')]=_[_0x94af('0x3e')](_0x8fd6ba['query']);_0x3bced0[_0x94af('0x3f')]=_['intersection'](_0x3bced0['model'],_0x3bced0['query']);_0x26b846[_0x94af('0x40')]=_[_0x94af('0x41')](_0x3bced0['model'],qs[_0x94af('0x42')](_0x8fd6ba['query'][_0x94af('0x42')]));_0x26b846['attributes']=_0x26b846[_0x94af('0x40')][_0x94af('0x43')]?_0x26b846[_0x94af('0x40')]:_0x3bced0[_0x94af('0x44')];if(!_0x8fd6ba[_0x94af('0x3d')][_0x94af('0x45')](_0x94af('0x46'))){_0x26b846[_0x94af('0x21')]=qs[_0x94af('0x21')](_0x8fd6ba[_0x94af('0x3d')][_0x94af('0x21')]);_0x26b846['offset']=qs[_0x94af('0x1f')](_0x8fd6ba[_0x94af('0x3d')]['offset']);}_0x26b846[_0x94af('0x47')]=qs['sort'](_0x8fd6ba[_0x94af('0x3d')][_0x94af('0x48')]);_0x26b846[_0x94af('0x49')]=qs['filters'](_[_0x94af('0x4a')](_0x8fd6ba['query'],_0x3bced0[_0x94af('0x3f')]),_0xbd51ac);if(_0x8fd6ba[_0x94af('0x3d')]['filter']){_0x26b846[_0x94af('0x49')]=_[_0x94af('0x4b')](_0x26b846[_0x94af('0x49')],{'$or':_[_0x94af('0x39')](_0xbd51ac,function(_0xc4414a){if(_0xc4414a[_0x94af('0x31')]!==_0x94af('0x4c')){var _0x35cdaa={};_0x35cdaa[_0xc4414a['name']]={'$like':'%'+_0x8fd6ba[_0x94af('0x3d')]['filter']+'%'};return _0x35cdaa;}})});}_0x26b846=_[_0x94af('0x4b')]({},_0x26b846,_0x8fd6ba[_0x94af('0x4d')]);var _0xaf0610={'where':_0x26b846[_0x94af('0x49')]};return db[_0x94af('0x4e')][_0x94af('0x22')](_0xaf0610)['then'](function(_0xab4ac5){_0x9b90fb[_0x94af('0x22')]=_0xab4ac5;if(_0x8fd6ba[_0x94af('0x3d')][_0x94af('0x4f')]){_0x26b846['include']=[{'all':!![]}];}return db[_0x94af('0x4e')][_0x94af('0x50')](_0x26b846);})[_0x94af('0x28')](function(_0x29bb6c){_0x9b90fb[_0x94af('0x51')]=_0x29bb6c;return _0x9b90fb;})[_0x94af('0x28')](respondWithFilteredResult(_0x3e0a9a,_0x26b846))['catch'](handleError(_0x3e0a9a,null));};exports['show']=function(_0x3c11a5,_0x343483){var _0x3b66d8={'raw':![],'where':{'id':_0x3c11a5[_0x94af('0x52')]['id']}},_0xbfcb8b={};_0xbfcb8b[_0x94af('0x44')]=_['keys'](db[_0x94af('0x4e')][_0x94af('0x3a')]);_0xbfcb8b[_0x94af('0x3d')]=_[_0x94af('0x3e')](_0x3c11a5[_0x94af('0x3d')]);_0xbfcb8b[_0x94af('0x3f')]=_[_0x94af('0x41')](_0xbfcb8b['model'],_0xbfcb8b[_0x94af('0x3d')]);_0x3b66d8['attributes']=_[_0x94af('0x41')](_0xbfcb8b[_0x94af('0x44')],qs[_0x94af('0x42')](_0x3c11a5[_0x94af('0x3d')][_0x94af('0x42')]));_0x3b66d8[_0x94af('0x40')]=_0x3b66d8[_0x94af('0x40')][_0x94af('0x43')]?_0x3b66d8[_0x94af('0x40')]:_0xbfcb8b[_0x94af('0x44')];if(_0x3c11a5[_0x94af('0x3d')][_0x94af('0x4f')]){_0x3b66d8[_0x94af('0x53')]=[{'all':!![]}];}_0x3b66d8=_['merge']({},_0x3b66d8,_0x3c11a5[_0x94af('0x4d')]);return db[_0x94af('0x4e')][_0x94af('0x32')](_0x3b66d8)[_0x94af('0x28')](handleEntityNotFound(_0x343483,null))[_0x94af('0x28')](respondWithResult(_0x343483,null))[_0x94af('0x54')](handleError(_0x343483,null));};exports[_0x94af('0x55')]=function(_0x50c7fb,_0x36cb23){return db[_0x94af('0x4e')][_0x94af('0x55')](_0x50c7fb[_0x94af('0x56')],{})['then'](function(_0x2b632a){var _0x5a815e=_0x50c7fb[_0x94af('0x57')][_0x94af('0x58')]({'plain':!![]});if(!_0x5a815e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a815e[_0x94af('0x59')]==='user'){var _0x49b087=_0x2b632a['get']({'plain':!![]});var _0x3ba3a7=[{'name':_0x94af('0x5a'),'value':_0x94af('0x2a')},{'name':_0x94af('0x2b'),'value':'outbound'}];var _0x289b2a=_[_0x94af('0x32')](_0x3ba3a7,[_0x94af('0x2f'),_0x49b087[_0x94af('0x31')]])[_0x94af('0x36')];return db[_0x94af('0x5b')][_0x94af('0x32')]({'where':{'name':_0x289b2a,'userProfileId':_0x5a815e[_0x94af('0x5c')]},'raw':!![]})[_0x94af('0x28')](function(_0x12811f){if(_0x12811f&&_0x12811f[_0x94af('0x5d')]===0x0){return db[_0x94af('0x5e')]['create']({'name':_0x49b087[_0x94af('0x36')],'resourceId':_0x49b087['id'],'type':_0x12811f[_0x94af('0x36')],'sectionId':_0x12811f['id']},{})[_0x94af('0x28')](function(){return _0x2b632a;});}else{return _0x2b632a;}})[_0x94af('0x54')](function(_0x59693d){logger[_0x94af('0x34')](_0x94af('0x5f'),_0x59693d);throw _0x59693d;});}return _0x2b632a;})[_0x94af('0x28')](respondWithResult(_0x36cb23,0xc9))[_0x94af('0x54')](handleError(_0x36cb23,null));};exports[_0x94af('0x60')]=function(_0x5dc314,_0xfe0ba3){var _0x21451f={'where':{'id':_0x5dc314[_0x94af('0x52')]['id']}},_0x5ef898={};_0x5ef898[_0x94af('0x44')]=_[_0x94af('0x3e')](db[_0x94af('0x4e')][_0x94af('0x3a')]);_0x21451f[_0x94af('0x40')]=_[_0x94af('0x41')](_0x5ef898[_0x94af('0x44')],qs[_0x94af('0x42')](_0x5dc314['query'][_0x94af('0x42')]));_0x21451f['attributes']=_0x21451f[_0x94af('0x40')]['length']?_0x21451f[_0x94af('0x40')]:_0x5ef898[_0x94af('0x44')];if(_0x5dc314[_0x94af('0x3d')][_0x94af('0x4f')]){_0x21451f[_0x94af('0x53')]=[{'all':!![]}];}_0x21451f=_['merge']({},_0x21451f,_0x5dc314[_0x94af('0x4d')]);return db['VoiceQueue'][_0x94af('0x32')](_0x21451f)[_0x94af('0x28')](handleEntityNotFound(_0xfe0ba3,null))[_0x94af('0x28')](function(_0x10ff3d){if(_0x10ff3d){var _0x23b919=_0x10ff3d[_0x94af('0x58')]({'plain':!![]});_0x23b919=qs[_0x94af('0x61')](_0x23b919,['id',_0x94af('0x62'),'updatedAt']);_0x5dc314[_0x94af('0x56')]=_['omit'](_0x5dc314[_0x94af('0x56')],['id','createdAt',_0x94af('0x63')]);return db[_0x94af('0x4e')][_0x94af('0x55')](_[_0x94af('0x4b')](_0x23b919,_0x5dc314[_0x94af('0x56')]),{'include':_0x5dc314[_0x94af('0x3d')][_0x94af('0x4f')]?[{'all':!![]}]:undefined})[_0x94af('0x28')](function(_0x14e844){var _0x6fb055=_0x5dc314[_0x94af('0x57')][_0x94af('0x58')]({'plain':!![]});if(!_0x6fb055)throw new Error(_0x94af('0x64'));if(_0x6fb055[_0x94af('0x59')]===_0x94af('0x57')){var _0x581670=_0x14e844['get']({'plain':!![]});var _0x4b36a6=[{'name':_0x94af('0x5a'),'value':_0x94af('0x2a')},{'name':_0x94af('0x2b'),'value':'outbound'}];var _0x3a5928=_[_0x94af('0x32')](_0x4b36a6,[_0x94af('0x2f'),_0x581670[_0x94af('0x31')]])[_0x94af('0x36')];return db['UserProfileSection']['find']({'where':{'name':_0x3a5928,'userProfileId':_0x6fb055[_0x94af('0x5c')]},'raw':!![]})[_0x94af('0x28')](function(_0x2d7419){if(_0x2d7419&&_0x2d7419[_0x94af('0x5d')]===0x0){return db[_0x94af('0x5e')][_0x94af('0x55')]({'name':_0x581670[_0x94af('0x36')],'resourceId':_0x581670['id'],'type':_0x2d7419[_0x94af('0x36')],'sectionId':_0x2d7419['id']},{})[_0x94af('0x28')](function(){return _0x14e844;});}else{return _0x14e844;}})[_0x94af('0x54')](function(_0x19a2f0){logger['error'](_0x94af('0x5f'),_0x19a2f0);throw _0x19a2f0;});}return _0x14e844;});}})[_0x94af('0x28')](respondWithResult(_0xfe0ba3,0xc9))[_0x94af('0x54')](handleError(_0xfe0ba3,null));};exports[_0x94af('0x27')]=function(_0x3f57d0,_0x483970){if(_0x3f57d0[_0x94af('0x56')]['id']){delete _0x3f57d0['body']['id'];}return db[_0x94af('0x4e')]['find']({'where':{'id':_0x3f57d0[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x483970,null))[_0x94af('0x28')](saveUpdates(_0x3f57d0[_0x94af('0x56')],null))[_0x94af('0x28')](respondWithResult(_0x483970,null))['catch'](handleError(_0x483970,null));};exports[_0x94af('0x29')]=function(_0xd3d368,_0x33bb76){return db['VoiceQueue'][_0x94af('0x32')]({'where':{'id':_0xd3d368['params']['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x33bb76,null))[_0x94af('0x28')](removeEntity(_0x33bb76,null))[_0x94af('0x54')](handleError(_0x33bb76,null));};exports['getHoppers']=function(_0x182a8f,_0x6e481b,_0x5a6b89){var _0x5c4121={'raw':![],'where':{}};var _0x34a045={};var _0x5a3b10={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x94af('0x65')]({'where':{'id':_0x182a8f[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x6e481b,null))[_0x94af('0x28')](function(_0x2a1b78){if(_0x2a1b78){_0x34a045[_0x94af('0x44')]=_[_0x94af('0x3e')](db[_0x94af('0x66')][_0x94af('0x3a')]);_0x34a045[_0x94af('0x3d')]=_['keys'](_0x182a8f[_0x94af('0x3d')]);_0x34a045[_0x94af('0x3f')]=_[_0x94af('0x41')](_0x34a045['model'],_0x34a045[_0x94af('0x3d')]);_0x5c4121['attributes']=_['intersection'](_0x34a045[_0x94af('0x44')],qs[_0x94af('0x42')](_0x182a8f[_0x94af('0x3d')][_0x94af('0x42')]));_0x5c4121[_0x94af('0x40')]=_0x5c4121['attributes'][_0x94af('0x43')]?_0x5c4121[_0x94af('0x40')]:_0x34a045[_0x94af('0x44')];if(!_0x182a8f['query']['hasOwnProperty'](_0x94af('0x46'))){_0x5c4121['limit']=qs[_0x94af('0x21')](_0x182a8f[_0x94af('0x3d')][_0x94af('0x21')]);_0x5c4121['offset']=qs[_0x94af('0x1f')](_0x182a8f['query'][_0x94af('0x1f')]);}_0x5c4121[_0x94af('0x47')]=qs[_0x94af('0x48')](_0x182a8f[_0x94af('0x3d')][_0x94af('0x48')]);_0x5c4121['where']=qs[_0x94af('0x3f')](_[_0x94af('0x4a')](_0x182a8f[_0x94af('0x3d')],_0x34a045['filters']));_0x5c4121['where']['VoiceQueueId']=_0x2a1b78['id'];if(_0x182a8f[_0x94af('0x3d')][_0x94af('0x2d')]){_0x5c4121[_0x94af('0x49')]=_[_0x94af('0x4b')](_0x5c4121['where'],{'$or':_[_0x94af('0x39')](_0x5c4121[_0x94af('0x40')],function(_0x54fc21){var _0x366f59={};_0x366f59[_0x54fc21]={'$like':'%'+_0x182a8f[_0x94af('0x3d')][_0x94af('0x2d')]+'%'};return _0x366f59;})});}_0x5c4121=_['merge']({},_0x5c4121,_0x182a8f['options']);return db[_0x94af('0x66')][_0x94af('0x22')]({'where':_0x5c4121['where']})['then'](function(_0x4d27d9){_0x5a3b10[_0x94af('0x22')]=_0x4d27d9;if(_0x182a8f[_0x94af('0x3d')][_0x94af('0x4f')]){_0x5c4121[_0x94af('0x53')]=[{'all':!![]}];}return db[_0x94af('0x66')][_0x94af('0x50')](_0x5c4121);})[_0x94af('0x28')](function(_0x5639a7){_0x5a3b10[_0x94af('0x51')]=_0x5639a7;return _0x5a3b10;});}})[_0x94af('0x28')](respondWithFilteredResult(_0x6e481b,_0x5c4121))[_0x94af('0x54')](handleError(_0x6e481b,null));};exports[_0x94af('0x67')]=function(_0xe801b0,_0x337b44,_0x291cc6){var _0x2932b6={'raw':!![],'where':{}};var _0x2967b2={};var _0x36a4e8={'count':0x0,'rows':[]};return db[_0x94af('0x4e')][_0x94af('0x65')]({'where':{'id':_0xe801b0['params']['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x337b44,null))[_0x94af('0x28')](function(_0xbfde8a){if(_0xbfde8a){_0x2967b2[_0x94af('0x44')]=_[_0x94af('0x3e')](db[_0x94af('0x68')][_0x94af('0x3a')]);_0x2967b2[_0x94af('0x3d')]=_[_0x94af('0x3e')](_0xe801b0[_0x94af('0x3d')]);_0x2967b2[_0x94af('0x3f')]=_[_0x94af('0x41')](_0x2967b2[_0x94af('0x44')],_0x2967b2[_0x94af('0x3d')]);_0x2932b6['attributes']=_[_0x94af('0x41')](_0x2967b2[_0x94af('0x44')],qs[_0x94af('0x42')](_0xe801b0[_0x94af('0x3d')][_0x94af('0x42')]));_0x2932b6[_0x94af('0x40')]=_0x2932b6[_0x94af('0x40')][_0x94af('0x43')]?_0x2932b6[_0x94af('0x40')]:_0x2967b2[_0x94af('0x44')];if(!_0xe801b0[_0x94af('0x3d')]['hasOwnProperty'](_0x94af('0x46'))){_0x2932b6[_0x94af('0x21')]=qs[_0x94af('0x21')](_0xe801b0['query'][_0x94af('0x21')]);_0x2932b6[_0x94af('0x1f')]=qs[_0x94af('0x1f')](_0xe801b0[_0x94af('0x3d')][_0x94af('0x1f')]);}_0x2932b6['order']=qs['sort'](_0xe801b0[_0x94af('0x3d')][_0x94af('0x48')]);_0x2932b6[_0x94af('0x49')]=qs[_0x94af('0x3f')](_[_0x94af('0x4a')](_0xe801b0[_0x94af('0x3d')],_0x2967b2[_0x94af('0x3f')]));_0x2932b6[_0x94af('0x49')][_0x94af('0x69')]=_0xbfde8a['id'];if(_0xe801b0[_0x94af('0x3d')][_0x94af('0x2d')]){_0x2932b6['where']=_[_0x94af('0x4b')](_0x2932b6[_0x94af('0x49')],{'$or':_[_0x94af('0x39')](_0x2932b6[_0x94af('0x40')],function(_0x118be3){var _0x295950={};_0x295950[_0x118be3]={'$like':'%'+_0xe801b0['query'][_0x94af('0x2d')]+'%'};return _0x295950;})});}_0x2932b6=_[_0x94af('0x4b')]({},_0x2932b6,_0xe801b0['options']);return db[_0x94af('0x68')]['count']({'where':_0x2932b6[_0x94af('0x49')]})[_0x94af('0x28')](function(_0x4e24b3){_0x36a4e8['count']=_0x4e24b3;if(_0xe801b0['query'][_0x94af('0x4f')]){_0x2932b6['include']=[{'all':!![]}];}return db[_0x94af('0x68')]['findAll'](_0x2932b6);})['then'](function(_0x9e6c7d){_0x36a4e8['rows']=_0x9e6c7d;return _0x36a4e8;});}})['then'](respondWithFilteredResult(_0x337b44,_0x2932b6))[_0x94af('0x54')](handleError(_0x337b44,null));};exports[_0x94af('0x6a')]=function(_0x2e1788,_0x19dc9a,_0x2c5357){var _0x3968b3={'raw':!![],'where':{}};var _0x3b0d8f={};var _0x50a97c={'count':0x0,'rows':[]};return db[_0x94af('0x4e')][_0x94af('0x65')]({'where':{'id':_0x2e1788[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x19dc9a,null))['then'](function(_0x24b7fa){if(_0x24b7fa){_0x3b0d8f[_0x94af('0x44')]=_[_0x94af('0x3e')](db[_0x94af('0x6b')]['rawAttributes']);_0x3b0d8f[_0x94af('0x3d')]=_['keys'](_0x2e1788['query']);_0x3b0d8f[_0x94af('0x3f')]=_['intersection'](_0x3b0d8f[_0x94af('0x44')],_0x3b0d8f[_0x94af('0x3d')]);_0x3968b3[_0x94af('0x40')]=_[_0x94af('0x41')](_0x3b0d8f['model'],qs[_0x94af('0x42')](_0x2e1788['query'][_0x94af('0x42')]));_0x3968b3[_0x94af('0x40')]=_0x3968b3[_0x94af('0x40')]['length']?_0x3968b3[_0x94af('0x40')]:_0x3b0d8f[_0x94af('0x44')];if(!_0x2e1788['query'][_0x94af('0x45')]('nolimit')){_0x3968b3[_0x94af('0x21')]=qs['limit'](_0x2e1788[_0x94af('0x3d')]['limit']);_0x3968b3[_0x94af('0x1f')]=qs['offset'](_0x2e1788[_0x94af('0x3d')][_0x94af('0x1f')]);}_0x3968b3[_0x94af('0x47')]=qs[_0x94af('0x48')](_0x2e1788[_0x94af('0x3d')][_0x94af('0x48')]);_0x3968b3['where']=qs['filters'](_[_0x94af('0x4a')](_0x2e1788[_0x94af('0x3d')],_0x3b0d8f[_0x94af('0x3f')]));_0x3968b3[_0x94af('0x49')][_0x94af('0x69')]=_0x24b7fa['id'];if(_0x2e1788['query'][_0x94af('0x2d')]){_0x3968b3[_0x94af('0x49')]=_[_0x94af('0x4b')](_0x3968b3[_0x94af('0x49')],{'$or':_['map'](_0x3968b3[_0x94af('0x40')],function(_0x575188){var _0x113657={};_0x113657[_0x575188]={'$like':'%'+_0x2e1788['query'][_0x94af('0x2d')]+'%'};return _0x113657;})});}_0x3968b3=_[_0x94af('0x4b')]({},_0x3968b3,_0x2e1788[_0x94af('0x4d')]);return db[_0x94af('0x6b')][_0x94af('0x22')]({'where':_0x3968b3[_0x94af('0x49')]})['then'](function(_0x3f9cd0){_0x50a97c[_0x94af('0x22')]=_0x3f9cd0;if(_0x2e1788['query'][_0x94af('0x4f')]){_0x3968b3[_0x94af('0x53')]=[{'all':!![]}];}return db[_0x94af('0x6b')]['findAll'](_0x3968b3);})[_0x94af('0x28')](function(_0x12c060){_0x50a97c[_0x94af('0x51')]=_0x12c060;return _0x50a97c;});}})[_0x94af('0x28')](respondWithFilteredResult(_0x19dc9a,_0x3968b3))[_0x94af('0x54')](handleError(_0x19dc9a,null));};exports[_0x94af('0x6c')]=function(_0x45efc4,_0x3ab7ea,_0x19495e){var _0x3efbb9={'raw':!![],'where':{}};var _0x12e380={};var _0x12fc05={'count':0x0,'rows':[]};return db[_0x94af('0x4e')][_0x94af('0x65')]({'where':{'id':_0x45efc4[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x3ab7ea,null))[_0x94af('0x28')](function(_0x5051b9){if(_0x5051b9){_0x12e380[_0x94af('0x44')]=_[_0x94af('0x3e')](db['CmHopperBlack'][_0x94af('0x3a')]);_0x12e380[_0x94af('0x3d')]=_[_0x94af('0x3e')](_0x45efc4[_0x94af('0x3d')]);_0x12e380[_0x94af('0x3f')]=_[_0x94af('0x41')](_0x12e380[_0x94af('0x44')],_0x12e380[_0x94af('0x3d')]);_0x3efbb9[_0x94af('0x40')]=_[_0x94af('0x41')](_0x12e380[_0x94af('0x44')],qs[_0x94af('0x42')](_0x45efc4['query'][_0x94af('0x42')]));_0x3efbb9[_0x94af('0x40')]=_0x3efbb9[_0x94af('0x40')][_0x94af('0x43')]?_0x3efbb9['attributes']:_0x12e380['model'];if(!_0x45efc4['query'][_0x94af('0x45')](_0x94af('0x46'))){_0x3efbb9[_0x94af('0x21')]=qs[_0x94af('0x21')](_0x45efc4[_0x94af('0x3d')][_0x94af('0x21')]);_0x3efbb9['offset']=qs[_0x94af('0x1f')](_0x45efc4[_0x94af('0x3d')][_0x94af('0x1f')]);}_0x3efbb9[_0x94af('0x47')]=qs['sort'](_0x45efc4[_0x94af('0x3d')][_0x94af('0x48')]);_0x3efbb9[_0x94af('0x49')]=qs[_0x94af('0x3f')](_[_0x94af('0x4a')](_0x45efc4[_0x94af('0x3d')],_0x12e380[_0x94af('0x3f')]));_0x3efbb9[_0x94af('0x49')]['VoiceQueueId']=_0x5051b9['id'];if(_0x45efc4[_0x94af('0x3d')][_0x94af('0x2d')]){_0x3efbb9[_0x94af('0x49')]=_[_0x94af('0x4b')](_0x3efbb9[_0x94af('0x49')],{'$or':_[_0x94af('0x39')](_0x3efbb9['attributes'],function(_0x65a092){var _0x5da8c2={};_0x5da8c2[_0x65a092]={'$like':'%'+_0x45efc4[_0x94af('0x3d')][_0x94af('0x2d')]+'%'};return _0x5da8c2;})});}_0x3efbb9=_[_0x94af('0x4b')]({},_0x3efbb9,_0x45efc4[_0x94af('0x4d')]);return db[_0x94af('0x6d')][_0x94af('0x22')]({'where':_0x3efbb9[_0x94af('0x49')]})[_0x94af('0x28')](function(_0x10cc66){_0x12fc05[_0x94af('0x22')]=_0x10cc66;if(_0x45efc4[_0x94af('0x3d')][_0x94af('0x4f')]){_0x3efbb9[_0x94af('0x53')]=[{'all':!![]}];}return db[_0x94af('0x6d')]['findAll'](_0x3efbb9);})[_0x94af('0x28')](function(_0x6a617b){_0x12fc05[_0x94af('0x51')]=_0x6a617b;return _0x12fc05;});}})[_0x94af('0x28')](respondWithFilteredResult(_0x3ab7ea,_0x3efbb9))[_0x94af('0x54')](handleError(_0x3ab7ea,null));};exports[_0x94af('0x6e')]=function(_0x2ee6f3,_0x449752,_0x18d832){var _0x2f03fd={};var _0x2d4938={};var _0x185e8f;var _0x4e974c;return db[_0x94af('0x4e')][_0x94af('0x65')]({'where':{'id':_0x2ee6f3[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x449752,null))[_0x94af('0x28')](function(_0x21eadd){if(_0x21eadd){_0x185e8f=_0x21eadd;_0x2d4938[_0x94af('0x44')]=_[_0x94af('0x3e')](db[_0x94af('0x6f')][_0x94af('0x3a')]);_0x2d4938[_0x94af('0x3d')]=_[_0x94af('0x3e')](_0x2ee6f3[_0x94af('0x3d')]);_0x2d4938['filters']=_[_0x94af('0x41')](_0x2d4938[_0x94af('0x44')],_0x2d4938[_0x94af('0x3d')]);_0x2f03fd[_0x94af('0x40')]=_[_0x94af('0x41')](_0x2d4938[_0x94af('0x44')],qs[_0x94af('0x42')](_0x2ee6f3['query'][_0x94af('0x42')]));_0x2f03fd[_0x94af('0x40')]=_0x2f03fd['attributes']['length']?_0x2f03fd['attributes']:_0x2d4938[_0x94af('0x44')];_0x2f03fd[_0x94af('0x47')]=qs[_0x94af('0x48')](_0x2ee6f3[_0x94af('0x3d')][_0x94af('0x48')]);_0x2f03fd['where']=qs['filters'](_[_0x94af('0x4a')](_0x2ee6f3[_0x94af('0x3d')],_0x2d4938[_0x94af('0x3f')]));if(_0x2ee6f3[_0x94af('0x3d')][_0x94af('0x2d')]){_0x2f03fd[_0x94af('0x49')]=_[_0x94af('0x4b')](_0x2f03fd[_0x94af('0x49')],{'$or':_[_0x94af('0x39')](_0x2f03fd[_0x94af('0x40')],function(_0x444a82){var _0x2f483e={};_0x2f483e[_0x444a82]={'$like':'%'+_0x2ee6f3[_0x94af('0x3d')][_0x94af('0x2d')]+'%'};return _0x2f483e;})});}_0x2f03fd=_[_0x94af('0x4b')]({},_0x2f03fd,_0x2ee6f3[_0x94af('0x4d')]);return _0x185e8f[_0x94af('0x6e')](_0x2f03fd);}})['then'](function(_0x14a97a){if(_0x14a97a){_0x4e974c=_0x14a97a['length'];if(!_0x2ee6f3[_0x94af('0x3d')][_0x94af('0x45')](_0x94af('0x46'))){_0x2f03fd['limit']=qs[_0x94af('0x21')](_0x2ee6f3[_0x94af('0x3d')][_0x94af('0x21')]);_0x2f03fd[_0x94af('0x1f')]=qs[_0x94af('0x1f')](_0x2ee6f3[_0x94af('0x3d')][_0x94af('0x1f')]);}return _0x185e8f[_0x94af('0x6e')](_0x2f03fd);}})[_0x94af('0x28')](function(_0x2b0e03){if(_0x2b0e03){return _0x2b0e03?{'count':_0x4e974c,'rows':_0x2b0e03}:null;}})['then'](respondWithResult(_0x449752,null))[_0x94af('0x54')](handleError(_0x449752,null));};exports[_0x94af('0x70')]=function(_0x4e1042,_0xe2fdda,_0x16fe1a){var _0x40cbd2=_0x4e1042[_0x94af('0x56')][_0x94af('0x71')];var _0x4d6961=_[_0x94af('0x39')](_0x40cbd2,'id');return db['Team'][_0x94af('0x50')]({'where':{'id':_0x4d6961},'attributes':['id'],'include':[{'model':db[_0x94af('0x72')],'as':'Agents','attributes':['id',_0x94af('0x36'),_0x94af('0x73'),_0x94af('0x74'),_0x94af('0x75')],'raw':!![]}]})[_0x94af('0x28')](function(_0x354a00){if(_0x354a00){var _0xffffa9=_[_0x94af('0x76')](_0x354a00,function(_0x3df205){var _0x434722=_0x3df205['get']({'plain':!![]});_0x434722['Agents']['forEach'](function(_0xd40465){_0xd40465[_0x94af('0x77')]=_[_0x94af('0x32')](_0x40cbd2,{'id':_0x434722['id']})[_0x94af('0x77')];});return _0x434722[_0x94af('0x78')];});return db[_0x94af('0x4e')][_0x94af('0x32')]({'where':{'id':_0x4e1042['params']['id']}})[_0x94af('0x28')](function(_0x1799b0){return db[_0x94af('0x79')][_0x94af('0x7a')](function(_0xc0ba11){return _0x1799b0['addTeams'](_0x4d6961,{'transaction':_0xc0ba11})[_0x94af('0x28')](function(){return BPromise[_0x94af('0x7b')](_0x40cbd2,function(_0x57c750){return db['TeamVoiceQueue'][_0x94af('0x7c')]({'TeamId':_0x57c750['id'],'VoiceQueueId':_0x4e1042[_0x94af('0x52')]['id'],'penalty':_0x57c750[_0x94af('0x77')]},{'transaction':_0xc0ba11});});})[_0x94af('0x28')](function(){return BPromise[_0x94af('0x7b')](_0xffffa9,function(_0x255bcd){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x255bcd['id'],'VoiceQueueId':_0x4e1042['params']['id']},'defaults':{'penalty':_0x255bcd[_0x94af('0x77')]},'transaction':_0xc0ba11});});})[_0x94af('0x28')](function(){return BPromise[_0x94af('0x7b')](_[_0x94af('0x2d')](_0xffffa9,{'online':!![]}),function(_0x4890ea){return db['UserVoiceQueueRt'][_0x94af('0x7c')]({'membername':_0x4890ea[_0x94af('0x36')],'UserId':_0x4890ea['id'],'queue_name':_0x1799b0[_0x94af('0x36')],'VoiceQueueId':_0x1799b0['id'],'interface':_[_0x94af('0x7d')](_0x4890ea[_0x94af('0x75')])?util[_0x94af('0x7e')]('SIP/%s',_0x4890ea['name']):_0x4890ea[_0x94af('0x75')],'paused':_0x4890ea[_0x94af('0x74')]||![],'penalty':_0x4890ea[_0x94af('0x77')]},{'transaction':_0xc0ba11});});})[_0x94af('0x28')](function(){_0xffffa9[_0x94af('0x7f')](function(_0x192385){socket[_0x94af('0x80')](_0x94af('0x81'),{'UserId':_0x192385['id'],'VoiceQueueId':_0x1799b0['id']});});});});});}})['then'](respondWithStatusCode(_0xe2fdda,null))[_0x94af('0x54')](handleError(_0xe2fdda,null));};exports['removeTeams']=function(_0xca425d,_0x2980f6,_0x676cdb){return db['Team']['findAll']({'where':{'id':_0xca425d[_0x94af('0x3d')][_0x94af('0x82')]},'attributes':['id'],'include':[{'model':db[_0x94af('0x72')],'as':_0x94af('0x78'),'attributes':['id'],'raw':!![]}]})[_0x94af('0x28')](handleEntityNotFound(_0x2980f6,null))[_0x94af('0x28')](function(_0x41069b){var _0x1d7fd1=_[_0x94af('0x39')](_0x41069b,'id');var _0x1b5752=[];var _0x5a96ac=[];var _0x2e4530=squel[_0x94af('0x83')]();_0x2e4530[_0x94af('0x84')]('tq.TeamId')['from'](_0x94af('0x85'),'tq')['join']('user_has_teams','ut',_0x94af('0x86'))[_0x94af('0x49')](_0x94af('0x87'),_0xca425d[_0x94af('0x52')]['id']);for(var _0x11cede=0x0;_0x11cede<_0x41069b['length'];_0x11cede+=0x1){let _0x47e83c=_0x41069b[_0x11cede];for(var _0x5b0c8f=0x0;_0x5b0c8f<_0x47e83c[_0x94af('0x78')][_0x94af('0x43')];_0x5b0c8f+=0x1){let _0x4f064d=_0x47e83c[_0x94af('0x78')][_0x5b0c8f];var _0x18eca5=_0x2e4530[_0x94af('0x60')]();_0x18eca5[_0x94af('0x49')]('ut.UserId\x20=\x20?',_0x4f064d['id']);_0x5a96ac['push'](db['sequelize'][_0x94af('0x3d')](_0x18eca5[_0x94af('0x88')](),{'type':db[_0x94af('0x79')][_0x94af('0x89')][_0x94af('0x8a')]})[_0x94af('0x28')](function(_0x3981f8){if(_0x3981f8[_0x94af('0x43')]===0x1){return _0x4f064d['id'];}else{var _0x249693=_[_0x94af('0x8b')](_[_0x94af('0x39')](_0x3981f8,_0x94af('0x8c')),function(_0x11621c){return _[_0x94af('0x30')](_0x1d7fd1,_0x11621c);});if(_0x249693){return _0x4f064d['id'];}}}));}}return BPromise[_0x94af('0x8d')](_0x5a96ac)[_0x94af('0x28')](function(_0x56e686){_0x1b5752=_(_0x1b5752)[_0x94af('0x8e')](_0x56e686)[_0x94af('0x8f')]()[_0x94af('0x2f')]();return db[_0x94af('0x4e')]['find']({'where':{'id':_0xca425d[_0x94af('0x52')]['id']}})['then'](function(_0x44a9a6){return db[_0x94af('0x79')][_0x94af('0x7a')](function(_0x2431a6){return _0x44a9a6['removeTeams'](_0xca425d[_0x94af('0x3d')][_0x94af('0x82')],{'transaction':_0x2431a6})[_0x94af('0x28')](function(){if(!_[_0x94af('0x90')](_0x1b5752)){return _0x44a9a6[_0x94af('0x91')](_0x1b5752,{'transaction':_0x2431a6})['then'](function(){return db['UserVoiceQueueRt'][_0x94af('0x29')]({'where':{'VoiceQueueId':_0xca425d[_0x94af('0x52')]['id'],'UserId':_0x1b5752},'transaction':_0x2431a6});});}})[_0x94af('0x28')](function(){_0x1b5752[_0x94af('0x7f')](function(_0xaab321){socket[_0x94af('0x80')]('userVoiceQueue:remove',{'UserId':_0xaab321,'VoiceQueueId':_0x44a9a6['id']});});});});});});})['then'](respondWithStatusCode(_0x2980f6,null))['catch'](handleError(_0x2980f6,null));};exports[_0x94af('0x92')]=function(_0x4141ed,_0x8cb2fe,_0x548958){var _0x2e74ff,_0xe0c42d;return db['VoiceQueue'][_0x94af('0x32')]({'where':{'id':_0x4141ed[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x8cb2fe,null))[_0x94af('0x28')](function(_0x42256c){if(_0x42256c){_0xe0c42d=_0x42256c;return _0x42256c[_0x94af('0x92')](_0x4141ed[_0x94af('0x56')]['ids'],_['omit'](_0x4141ed[_0x94af('0x56')],['ids','id'])||{})[_0x94af('0x93')](function(_0x222634){for(var _0xe6b7fb=0x0;_0xe6b7fb<_0x4141ed[_0x94af('0x56')][_0x94af('0x82')][_0x94af('0x43')];_0xe6b7fb+=0x1){socket[_0x94af('0x80')](_0x94af('0x81'),{'UserId':Number(_0x4141ed['body'][_0x94af('0x82')][_0xe6b7fb]),'VoiceQueueId':Number(_0x4141ed['params']['id'])});}return _0x222634;});}})[_0x94af('0x28')](function(_0x360ea5){_0x2e74ff=_0x360ea5||[];if(_0xe0c42d){return db[_0x94af('0x72')][_0x94af('0x50')]({'where':{'id':_0x4141ed[_0x94af('0x56')][_0x94af('0x82')]},'attributes':['id',_0x94af('0x36'),_0x94af('0x73'),_0x94af('0x74'),_0x94af('0x75')],'raw':!![]});}})[_0x94af('0x28')](function(_0x4cfd5e){if(!_[_0x94af('0x90')](_0x4cfd5e)){var _0x20813f=[];for(var _0x1b5bb6=0x0;_0x1b5bb6<_0x4cfd5e[_0x94af('0x43')];_0x1b5bb6++){if(_0x4cfd5e[_0x1b5bb6][_0x94af('0x73')]){_0x20813f[_0x94af('0x94')](db['UserVoiceQueueRt'][_0x94af('0x7c')]({'membername':_0x4cfd5e[_0x1b5bb6][_0x94af('0x36')],'UserId':_0x4cfd5e[_0x1b5bb6]['id'],'queue_name':_0xe0c42d[_0x94af('0x36')],'VoiceQueueId':_0xe0c42d['id'],'interface':_[_0x94af('0x7d')](_0x4cfd5e[_0x1b5bb6][_0x94af('0x75')])?util['format']('SIP/%s',_0x4cfd5e[_0x1b5bb6][_0x94af('0x36')]):_0x4cfd5e[_0x1b5bb6][_0x94af('0x75')],'paused':_0x4cfd5e[_0x1b5bb6]['voicePause']||![],'penalty':_0x4141ed[_0x94af('0x56')]['penalty']||0x0}));}}return BPromise['all'](_0x20813f);}})[_0x94af('0x28')](function(){return _0x2e74ff;})['then'](respondWithResult(_0x8cb2fe,null))[_0x94af('0x54')](handleError(_0x8cb2fe,null));};exports['removeAgents']=function(_0x2718b8,_0x4d6aa5,_0x4f9be3){return db[_0x94af('0x4e')]['find']({'where':{'id':_0x2718b8[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x4d6aa5,null))[_0x94af('0x28')](function(_0x253874){if(_0x253874){return _0x253874['removeAgents'](_0x2718b8[_0x94af('0x3d')]['ids'])[_0x94af('0x28')](function(){if(_['isArray'](_0x2718b8['query'][_0x94af('0x82')])){for(var _0xafb569=0x0;_0xafb569<_0x2718b8[_0x94af('0x3d')][_0x94af('0x82')][_0x94af('0x43')];_0xafb569+=0x1){socket['emit'](_0x94af('0x95'),{'UserId':Number(_0x2718b8[_0x94af('0x3d')][_0x94af('0x82')][_0xafb569]),'VoiceQueueId':Number(_0x2718b8[_0x94af('0x52')]['id'])});}}else{socket['emit'](_0x94af('0x95'),{'UserId':Number(_0x2718b8['query'][_0x94af('0x82')]),'VoiceQueueId':Number(_0x2718b8[_0x94af('0x52')]['id'])});}});}})[_0x94af('0x28')](function(_0x5c2e09){return db[_0x94af('0x96')][_0x94af('0x29')]({'where':{'VoiceQueueId':_0x2718b8[_0x94af('0x52')]['id'],'UserId':_0x2718b8[_0x94af('0x3d')][_0x94af('0x82')]}})[_0x94af('0x28')](function(){return _0x5c2e09;});})[_0x94af('0x28')](respondWithStatusCode(_0x4d6aa5,null))[_0x94af('0x54')](handleError(_0x4d6aa5,null));};exports[_0x94af('0x97')]=function(_0x437eb5,_0xc88800,_0xa1b272){var _0x1f07a9={};var _0x2c2891={};var _0x4c51be;var _0x5753d5;return db[_0x94af('0x4e')][_0x94af('0x65')]({'where':{'id':_0x437eb5['params']['id']}})[_0x94af('0x28')](handleEntityNotFound(_0xc88800,null))['then'](function(_0x47e324){if(_0x47e324){_0x4c51be=_0x47e324;_0x2c2891[_0x94af('0x44')]=_[_0x94af('0x3e')](db[_0x94af('0x72')][_0x94af('0x3a')]);_0x2c2891[_0x94af('0x3d')]=_[_0x94af('0x3e')](_0x437eb5[_0x94af('0x3d')]);_0x2c2891[_0x94af('0x3f')]=_[_0x94af('0x41')](_0x2c2891[_0x94af('0x44')],_0x2c2891[_0x94af('0x3d')]);_0x1f07a9[_0x94af('0x40')]=_[_0x94af('0x41')](_0x2c2891[_0x94af('0x44')],qs['fields'](_0x437eb5[_0x94af('0x3d')][_0x94af('0x42')]));_0x1f07a9[_0x94af('0x40')]=_0x1f07a9['attributes']['length']?_0x1f07a9[_0x94af('0x40')]:_0x2c2891[_0x94af('0x44')];_0x1f07a9[_0x94af('0x47')]=qs[_0x94af('0x48')](_0x437eb5[_0x94af('0x3d')][_0x94af('0x48')]);_0x1f07a9[_0x94af('0x49')]=qs['filters'](_[_0x94af('0x4a')](_0x437eb5[_0x94af('0x3d')],_0x2c2891[_0x94af('0x3f')]));if(_0x437eb5[_0x94af('0x3d')][_0x94af('0x2d')]){_0x1f07a9[_0x94af('0x49')]=_[_0x94af('0x4b')](_0x1f07a9[_0x94af('0x49')],{'$or':_['map'](_0x1f07a9[_0x94af('0x40')],function(_0x15a1a5){var _0x4d505a={};_0x4d505a[_0x15a1a5]={'$like':'%'+_0x437eb5['query'][_0x94af('0x2d')]+'%'};return _0x4d505a;})});}_0x1f07a9=_[_0x94af('0x4b')]({},_0x1f07a9,_0x437eb5[_0x94af('0x4d')]);return _0x4c51be[_0x94af('0x97')](_0x1f07a9);}})['then'](function(_0x4d8b97){if(_0x4d8b97){_0x5753d5=_0x4d8b97['length'];if(!_0x437eb5[_0x94af('0x3d')][_0x94af('0x45')]('nolimit')){_0x1f07a9['limit']=qs['limit'](_0x437eb5[_0x94af('0x3d')][_0x94af('0x21')]);_0x1f07a9['offset']=qs[_0x94af('0x1f')](_0x437eb5[_0x94af('0x3d')][_0x94af('0x1f')]);}return _0x4c51be[_0x94af('0x97')](_0x1f07a9);}})[_0x94af('0x28')](function(_0x6ee9d2){if(_0x6ee9d2){return _0x6ee9d2?{'count':_0x5753d5,'rows':_0x6ee9d2}:null;}})['then'](respondWithResult(_0xc88800,null))['catch'](handleError(_0xc88800,null));};exports[_0x94af('0x98')]=function(_0x1da3de,_0x223a9d,_0x44e581){var _0x229a55={};var _0x1c4417={};var _0x1c66da;var _0x4b8b83;return db['VoiceQueue']['findOne']({'where':{'id':_0x1da3de[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x223a9d,null))['then'](function(_0x4d58c8){if(_0x4d58c8){_0x1c66da=_0x4d58c8;_0x1c4417[_0x94af('0x44')]=_['keys'](db[_0x94af('0x96')]['rawAttributes']);_0x1c4417[_0x94af('0x3d')]=_[_0x94af('0x3e')](_0x1da3de[_0x94af('0x3d')]);_0x1c4417[_0x94af('0x3f')]=_[_0x94af('0x41')](_0x1c4417['model'],_0x1c4417[_0x94af('0x3d')]);_0x229a55[_0x94af('0x40')]=_['intersection'](_0x1c4417[_0x94af('0x44')],qs['fields'](_0x1da3de[_0x94af('0x3d')][_0x94af('0x42')]));_0x229a55[_0x94af('0x40')]=_0x229a55[_0x94af('0x40')][_0x94af('0x43')]?_0x229a55[_0x94af('0x40')]:_0x1c4417['model'];_0x229a55[_0x94af('0x47')]=qs[_0x94af('0x48')](_0x1da3de[_0x94af('0x3d')][_0x94af('0x48')]);_0x229a55[_0x94af('0x49')]=qs[_0x94af('0x3f')](_[_0x94af('0x4a')](_0x1da3de[_0x94af('0x3d')],_0x1c4417[_0x94af('0x3f')]));if(_0x1da3de[_0x94af('0x3d')][_0x94af('0x2d')]){_0x229a55[_0x94af('0x49')]=_[_0x94af('0x4b')](_0x229a55['where'],{'$or':_[_0x94af('0x39')](_0x229a55[_0x94af('0x40')],function(_0x10da47){var _0x29a4a0={};_0x29a4a0[_0x10da47]={'$like':'%'+_0x1da3de['query'][_0x94af('0x2d')]+'%'};return _0x29a4a0;})});}_0x229a55=_[_0x94af('0x4b')]({},_0x229a55,_0x1da3de[_0x94af('0x4d')]);return _0x1c66da[_0x94af('0x98')](_0x229a55);}})[_0x94af('0x28')](function(_0x435745){if(_0x435745){_0x4b8b83=_0x435745[_0x94af('0x43')];if(!_0x1da3de[_0x94af('0x3d')][_0x94af('0x45')](_0x94af('0x46'))){_0x229a55['limit']=qs[_0x94af('0x21')](_0x1da3de['query'][_0x94af('0x21')]);_0x229a55[_0x94af('0x1f')]=qs[_0x94af('0x1f')](_0x1da3de[_0x94af('0x3d')][_0x94af('0x1f')]);}return _0x1c66da['getMembers'](_0x229a55);}})[_0x94af('0x28')](function(_0x412fe0){return _0x412fe0?{'count':_0x4b8b83,'rows':_0x412fe0}:null;})[_0x94af('0x28')](respondWithResult(_0x223a9d,null))[_0x94af('0x54')](handleError(_0x223a9d,null));};exports[_0x94af('0x99')]=function(_0x50f6a6,_0x4a28ad,_0x16cf5c){var _0x31f1fd={};var _0x5ef2f5={};var _0x5e0a84;var _0x215a38;return db[_0x94af('0x4e')]['findOne']({'where':{'id':_0x50f6a6[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x4a28ad,null))[_0x94af('0x28')](function(_0x396d7c){if(_0x396d7c){_0x5e0a84=_0x396d7c;_0x5ef2f5[_0x94af('0x44')]=_[_0x94af('0x3e')](db[_0x94af('0x9a')][_0x94af('0x3a')]);_0x5ef2f5[_0x94af('0x3d')]=_[_0x94af('0x3e')](_0x50f6a6[_0x94af('0x3d')]);_0x5ef2f5['filters']=_[_0x94af('0x41')](_0x5ef2f5['model'],_0x5ef2f5[_0x94af('0x3d')]);_0x31f1fd[_0x94af('0x40')]=_[_0x94af('0x41')](_0x5ef2f5[_0x94af('0x44')],qs[_0x94af('0x42')](_0x50f6a6['query']['fields']));_0x31f1fd[_0x94af('0x40')]=_0x31f1fd[_0x94af('0x40')][_0x94af('0x43')]?_0x31f1fd['attributes']:_0x5ef2f5['model'];_0x31f1fd[_0x94af('0x47')]=qs[_0x94af('0x48')](_0x50f6a6[_0x94af('0x3d')][_0x94af('0x48')]);_0x31f1fd[_0x94af('0x49')]=qs[_0x94af('0x3f')](_['pick'](_0x50f6a6[_0x94af('0x3d')],_0x5ef2f5[_0x94af('0x3f')]));if(_0x50f6a6[_0x94af('0x3d')]['filter']){_0x31f1fd[_0x94af('0x49')]=_['merge'](_0x31f1fd[_0x94af('0x49')],{'$or':_[_0x94af('0x39')](_0x31f1fd[_0x94af('0x40')],function(_0x20b95e){var _0x181aae={};_0x181aae[_0x20b95e]={'$like':'%'+_0x50f6a6['query'][_0x94af('0x2d')]+'%'};return _0x181aae;})});}_0x31f1fd=_['merge']({},_0x31f1fd,_0x50f6a6[_0x94af('0x4d')]);return _0x5e0a84[_0x94af('0x99')](_0x31f1fd);}})[_0x94af('0x28')](function(_0x560829){if(_0x560829){_0x215a38=_0x560829[_0x94af('0x43')];if(!_0x50f6a6[_0x94af('0x3d')][_0x94af('0x45')](_0x94af('0x46'))){_0x31f1fd[_0x94af('0x21')]=qs[_0x94af('0x21')](_0x50f6a6['query'][_0x94af('0x21')]);_0x31f1fd[_0x94af('0x1f')]=qs[_0x94af('0x1f')](_0x50f6a6['query']['offset']);}return _0x5e0a84[_0x94af('0x99')](_0x31f1fd);}})['then'](function(_0x221f09){if(_0x221f09){return _0x221f09?{'count':_0x215a38,'rows':_0x221f09}:null;}})[_0x94af('0x28')](respondWithResult(_0x4a28ad,null))[_0x94af('0x54')](handleError(_0x4a28ad,null));};exports['addLists']=function(_0x41f514,_0x553e0d,_0x379048){var _0x1362c7=moment()[_0x94af('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x25b4d2,_0x5d6624;return db[_0x94af('0x4e')][_0x94af('0x32')]({'where':{'id':_0x41f514[_0x94af('0x52')]['id']}})['then'](handleEntityNotFound(_0x553e0d,null))[_0x94af('0x28')](function(_0x4dde7e){if(_0x4dde7e){_0x5d6624=_0x4dde7e;return _0x4dde7e[_0x94af('0x9b')](_0x41f514[_0x94af('0x56')][_0x94af('0x82')],_['omit'](_0x41f514['body'],[_0x94af('0x82'),'id'])||{});}return null;})[_0x94af('0x93')](function(_0x5344ae){var _0x520465;_0x25b4d2=_0x5344ae||[];var _0xdf890f=[];if(_0x5344ae){for(var _0x3132eb=0x0;_0x3132eb<_0x5344ae[_0x94af('0x43')];_0x3132eb+=0x1){var _0x1832e9=_0x5344ae[_0x3132eb][_0x94af('0x58')]({'plain':!![]});_0x5d6624['dialCheckDuplicateType']=_0x41f514['body'][_0x94af('0x9c')]?_0x41f514[_0x94af('0x56')]['dialCheckDuplicateType']:_0x5d6624['dialCheckDuplicateType'];switch(_0x5d6624[_0x94af('0x9c')]){case _0x94af('0x9d'):_0x520465=squel['insert']()[_0x94af('0x9e')](_0x94af('0x9f'))['fromQuery']([_0x94af('0xa0'),_0x94af('0xa1'),'ContactId',_0x94af('0xa2'),'VoiceQueueId',_0x94af('0x62'),_0x94af('0x63')],squel[_0x94af('0x83')]()[_0x94af('0x84')](_0x94af('0xa0'),'phone')[_0x94af('0x84')]('\x27'+_0x1362c7+'\x27',_0x94af('0xa1'))[_0x94af('0x84')]('id',_0x94af('0xa3'))['field'](_0x1832e9[_0x94af('0xa4')]['toString'](),_0x94af('0xa2'))[_0x94af('0x84')](_0x41f514[_0x94af('0x52')]['id']['toString'](),_0x94af('0x69'))[_0x94af('0x84')]('\x27'+_0x1362c7+'\x27',_0x94af('0x62'))['field']('\x27'+_0x1362c7+'\x27','updatedAt')[_0x94af('0xa5')](_0x94af('0xa6'))[_0x94af('0x49')](_0x94af('0xa7'))['where'](_0x94af('0xa8'),_0x1832e9['CmListId'][_0x94af('0x88')]())[_0x94af('0x49')](_0x94af('0xa9'))[_0x94af('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0x94af('0x83')]()[_0x94af('0x84')](_0x94af('0xaa'))['from'](_0x94af('0xab'))[_0x94af('0x49')]('VoiceQueueId\x20=\x20?',_0x41f514['params']['id'][_0x94af('0x88')]()))[_0x94af('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0x94af('0x83')]()[_0x94af('0x84')](_0x94af('0xac'))[_0x94af('0xa5')]('cm_hopper')[_0x94af('0x49')]('VoiceQueueId\x20=\x20?',_0x41f514[_0x94af('0x52')]['id'][_0x94af('0x88')]())))['toString']();break;case _0x94af('0xad'):_0x520465=squel[_0x94af('0xae')]()[_0x94af('0x9e')](_0x94af('0x9f'))['fromQuery']([_0x94af('0xa0'),_0x94af('0xa1'),_0x94af('0xa3'),_0x94af('0xa2'),'VoiceQueueId',_0x94af('0x62'),_0x94af('0x63')],squel[_0x94af('0x83')]()[_0x94af('0x84')](_0x94af('0xa0'),_0x94af('0xa0'))[_0x94af('0x84')]('\x27'+_0x1362c7+'\x27','scheduledAt')['field']('id',_0x94af('0xa3'))[_0x94af('0x84')](_0x1832e9[_0x94af('0xa4')][_0x94af('0x88')](),_0x94af('0xa2'))['field'](_0x41f514[_0x94af('0x52')]['id'][_0x94af('0x88')](),_0x94af('0x69'))[_0x94af('0x84')]('\x27'+_0x1362c7+'\x27',_0x94af('0x62'))[_0x94af('0x84')]('\x27'+_0x1362c7+'\x27','updatedAt')[_0x94af('0xa5')](_0x94af('0xa6'))[_0x94af('0x49')](_0x94af('0xa7'))['where'](_0x94af('0xa8'),_0x1832e9[_0x94af('0xa4')][_0x94af('0x88')]())[_0x94af('0x49')](_0x94af('0xa9'))[_0x94af('0x49')](_0x94af('0xaf'),squel[_0x94af('0x83')]()[_0x94af('0x84')](_0x94af('0xac'))['from'](_0x94af('0x9f'))[_0x94af('0x49')](_0x94af('0x87'),_0x41f514[_0x94af('0x52')]['id'][_0x94af('0x88')]())))[_0x94af('0x88')]();break;default:_0x520465=squel['insert']()[_0x94af('0x9e')]('cm_hopper')[_0x94af('0xb0')]([_0x94af('0xa0'),_0x94af('0xa1'),_0x94af('0xa3'),_0x94af('0xa2'),_0x94af('0x69'),_0x94af('0x62'),_0x94af('0x63')],squel[_0x94af('0x83')]()[_0x94af('0x84')](_0x94af('0xa0'),_0x94af('0xa0'))[_0x94af('0x84')]('\x27'+_0x1362c7+'\x27',_0x94af('0xa1'))[_0x94af('0x84')]('id',_0x94af('0xa3'))['field'](_0x1832e9[_0x94af('0xa4')][_0x94af('0x88')](),_0x94af('0xa2'))['field'](_0x41f514['params']['id']['toString'](),_0x94af('0x69'))[_0x94af('0x84')]('\x27'+_0x1362c7+'\x27','createdAt')[_0x94af('0x84')]('\x27'+_0x1362c7+'\x27',_0x94af('0x63'))[_0x94af('0xa5')](_0x94af('0xa6'))[_0x94af('0x49')](_0x94af('0xa7'))[_0x94af('0x49')](_0x94af('0xa8'),_0x1832e9['CmListId'][_0x94af('0x88')]())[_0x94af('0x49')]('phone\x20IS\x20NOT\x20NULL'))[_0x94af('0x88')]();}_0xdf890f['push'](db[_0x94af('0x79')][_0x94af('0x3d')](_0x520465));}return BPromise[_0x94af('0x8d')](_0xdf890f);}})['then'](function(){var _0x4209e9=[];var _0x304848=squel['insert']()[_0x94af('0x9e')](_0x94af('0xb1'))[_0x94af('0xb0')]([_0x94af('0xb2'),_0x94af('0xa0'),_0x94af('0xb3'),'createdAt',_0x94af('0x63')],squel[_0x94af('0x83')]()[_0x94af('0x84')](_0x94af('0xb4'))[_0x94af('0x84')](_0x94af('0xb5'))[_0x94af('0x84')](_0x94af('0xb6'))[_0x94af('0x84')]('\x27'+_0x1362c7+'\x27',_0x94af('0x62'))['field']('\x27'+_0x1362c7+'\x27',_0x94af('0x63'))[_0x94af('0xa5')]('cm_contact_has_items','ci')[_0x94af('0xb7')](_0x94af('0x9f'),'h',_0x94af('0xb8'))[_0x94af('0x49')](_0x94af('0xb9'),_0x1362c7)[_0x94af('0x49')](_0x94af('0xba'),_0x94af('0xbb')))[_0x94af('0x88')]();_0x4209e9['push'](db[_0x94af('0x79')]['query'](_0x304848));return BPromise[_0x94af('0x8d')](_0x4209e9);})[_0x94af('0x28')](function(){return _0x25b4d2;})[_0x94af('0x28')](respondWithResult(_0x553e0d,null))[_0x94af('0x54')](handleError(_0x553e0d,null));};exports[_0x94af('0xbc')]=function(_0x4b6544,_0x5dafec,_0x1ed024){return db[_0x94af('0x4e')][_0x94af('0x32')]({'where':{'id':_0x4b6544[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x5dafec,null))[_0x94af('0x28')](function(_0x3845ae){if(_0x3845ae){return _0x3845ae['removeLists'](_0x4b6544[_0x94af('0x3d')][_0x94af('0x82')]);}})['then'](function(_0x146682){if(_0x146682){return db[_0x94af('0x66')]['destroy']({'where':{'ListId':_0x4b6544[_0x94af('0x3d')]['ids'],'VoiceQueueId':_0x4b6544[_0x94af('0x52')]['id']}})['then'](function(){return _0x146682;});}})[_0x94af('0x28')](respondWithStatusCode(_0x5dafec,null))[_0x94af('0x54')](handleError(_0x5dafec,null));};exports[_0x94af('0xbd')]=function(_0x4b384d,_0x422662,_0x1bf301){var _0x3ca00b={};var _0x25c42d={};var _0x2e0360;var _0x2b71f6;return db['VoiceQueue'][_0x94af('0x65')]({'where':{'id':_0x4b384d[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x422662,null))['then'](function(_0x4a1083){if(_0x4a1083){_0x2e0360=_0x4a1083;_0x25c42d['model']=_[_0x94af('0x3e')](db[_0x94af('0x9a')][_0x94af('0x3a')]);_0x25c42d[_0x94af('0x3d')]=_[_0x94af('0x3e')](_0x4b384d[_0x94af('0x3d')]);_0x25c42d[_0x94af('0x3f')]=_['intersection'](_0x25c42d[_0x94af('0x44')],_0x25c42d[_0x94af('0x3d')]);_0x3ca00b[_0x94af('0x40')]=_['intersection'](_0x25c42d[_0x94af('0x44')],qs[_0x94af('0x42')](_0x4b384d[_0x94af('0x3d')][_0x94af('0x42')]));_0x3ca00b['attributes']=_0x3ca00b[_0x94af('0x40')][_0x94af('0x43')]?_0x3ca00b[_0x94af('0x40')]:_0x25c42d['model'];_0x3ca00b[_0x94af('0x47')]=qs[_0x94af('0x48')](_0x4b384d[_0x94af('0x3d')][_0x94af('0x48')]);_0x3ca00b[_0x94af('0x49')]=qs[_0x94af('0x3f')](_[_0x94af('0x4a')](_0x4b384d[_0x94af('0x3d')],_0x25c42d[_0x94af('0x3f')]));if(_0x4b384d[_0x94af('0x3d')][_0x94af('0x2d')]){_0x3ca00b[_0x94af('0x49')]=_['merge'](_0x3ca00b[_0x94af('0x49')],{'$or':_['map'](_0x3ca00b[_0x94af('0x40')],function(_0x4157b3){var _0x4d8e85={};_0x4d8e85[_0x4157b3]={'$like':'%'+_0x4b384d[_0x94af('0x3d')][_0x94af('0x2d')]+'%'};return _0x4d8e85;})});}_0x3ca00b=_[_0x94af('0x4b')]({},_0x3ca00b,_0x4b384d['options']);return _0x2e0360[_0x94af('0xbd')](_0x3ca00b);}})[_0x94af('0x28')](function(_0x25378c){if(_0x25378c){_0x2b71f6=_0x25378c[_0x94af('0x43')];if(!_0x4b384d['query'][_0x94af('0x45')](_0x94af('0x46'))){_0x3ca00b[_0x94af('0x21')]=qs[_0x94af('0x21')](_0x4b384d[_0x94af('0x3d')][_0x94af('0x21')]);_0x3ca00b['offset']=qs['offset'](_0x4b384d[_0x94af('0x3d')][_0x94af('0x1f')]);}return _0x2e0360[_0x94af('0xbd')](_0x3ca00b);}})['then'](function(_0x43c906){if(_0x43c906){return _0x43c906?{'count':_0x2b71f6,'rows':_0x43c906}:null;}})[_0x94af('0x28')](respondWithResult(_0x422662,null))['catch'](handleError(_0x422662,null));};exports[_0x94af('0xbe')]=function(_0x3c942a,_0x3b360b,_0x348209){var _0x232667,_0x1edc0d;return db['VoiceQueue'][_0x94af('0x32')]({'where':{'id':_0x3c942a['params']['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x3b360b,null))[_0x94af('0x28')](function(_0x2c7390){if(_0x2c7390){_0x1edc0d=_0x2c7390;return _0x2c7390[_0x94af('0xbe')](_0x3c942a[_0x94af('0x56')][_0x94af('0x82')],_['omit'](_0x3c942a[_0x94af('0x56')],['ids','id'])||{});}return null;})[_0x94af('0x93')](function(_0x2ab17e){var _0x1503d7;_0x232667=_0x2ab17e||[];var _0x1f2d00=[];if(_0x2ab17e){for(var _0x3c7033=0x0;_0x3c7033<_0x2ab17e[_0x94af('0x43')];_0x3c7033+=0x1){var _0x3eaadd=_0x2ab17e[_0x3c7033][_0x94af('0x58')]({'plain':!![]});_0x1503d7=squel[_0x94af('0xae')]()[_0x94af('0x9e')]('cm_hopper_black')[_0x94af('0xb0')]([_0x94af('0xa0'),_0x94af('0xa3'),_0x94af('0xa2'),_0x94af('0x69'),'createdAt',_0x94af('0x63')],squel['select']()[_0x94af('0x84')](_0x94af('0xa0'),_0x94af('0xa0'))[_0x94af('0x84')]('id',_0x94af('0xa3'))[_0x94af('0x84')](_0x3eaadd[_0x94af('0xa4')][_0x94af('0x88')](),_0x94af('0xa2'))[_0x94af('0x84')](_0x3c942a[_0x94af('0x52')]['id']['toString'](),_0x94af('0x69'))[_0x94af('0x84')](_0x94af('0xbf'),_0x94af('0x62'))[_0x94af('0x84')](_0x94af('0xbf'),_0x94af('0x63'))[_0x94af('0xa5')]('cm_contacts')[_0x94af('0x49')](_0x94af('0xa7'))['where'](_0x94af('0xa8'),_0x3eaadd[_0x94af('0xa4')]['toString']())[_0x94af('0x49')](_0x94af('0xa9')))['toString']();_0x1f2d00['push'](db[_0x94af('0x79')][_0x94af('0x3d')](_0x1503d7));}return BPromise[_0x94af('0x8d')](_0x1f2d00);}})[_0x94af('0x28')](function(){return _0x232667;})[_0x94af('0x28')](respondWithResult(_0x3b360b,null))[_0x94af('0x54')](handleError(_0x3b360b,null));};exports['removeBlackLists']=function(_0xf5488d,_0x1324d8,_0x18944b){return db[_0x94af('0x4e')][_0x94af('0x32')]({'where':{'id':_0xf5488d[_0x94af('0x52')]['id']}})['then'](handleEntityNotFound(_0x1324d8,null))[_0x94af('0x28')](function(_0x2d4675){if(_0x2d4675){return _0x2d4675[_0x94af('0xc0')](_0xf5488d['query'][_0x94af('0x82')]);}})[_0x94af('0x28')](function(_0x5f3d02){if(_0x5f3d02){return db[_0x94af('0x6d')][_0x94af('0x29')]({'where':{'ListId':_0xf5488d[_0x94af('0x3d')][_0x94af('0x82')],'VoiceQueueId':_0xf5488d[_0x94af('0x52')]['id']}})['then'](function(){return _0x5f3d02;});}})['then'](respondWithStatusCode(_0x1324d8,null))[_0x94af('0x54')](handleError(_0x1324d8,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 30a957b..5d4bd24 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 _0xb97f=['remove','emit','hook','exports','events','../../mysqldb','VoiceQueue','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb97f,0x124));var _0xfb97=function(_0x3004e0,_0x277776){_0x3004e0=_0x3004e0-0x0;var _0x3d175b=_0xb97f[_0x3004e0];return _0x3d175b;};'use strict';var EventEmitter=require(_0xfb97('0x0'));var VoiceQueue=require(_0xfb97('0x1'))['db'][_0xfb97('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfb97('0x3'),'afterDestroy':_0xfb97('0x4')};function emitEvent(_0x2a6d7e){return function(_0x3524c3,_0x2f1e84,_0x2947c1){VoiceQueueEvents[_0xfb97('0x5')](_0x2a6d7e+':'+_0x3524c3['id'],_0x3524c3);VoiceQueueEvents[_0xfb97('0x5')](_0x2a6d7e,_0x3524c3);_0x2947c1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xfb97('0x6')](e,emitEvent(event));}}module[_0xfb97('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0xc676=['hasOwnProperty','../../mysqldb','VoiceQueue','save','remove','emit'];(function(_0x4aa031,_0x3dd2cf){var _0x5f951=function(_0x43dc26){while(--_0x43dc26){_0x4aa031['push'](_0x4aa031['shift']());}};_0x5f951(++_0x3dd2cf);}(_0xc676,0xdf));var _0x6c67=function(_0x5b8a1a,_0x3206f2){_0x5b8a1a=_0x5b8a1a-0x0;var _0x38243d=_0xc676[_0x5b8a1a];return _0x38243d;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x6c67('0x0'))['db'][_0x6c67('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6c67('0x2'),'afterUpdate':'update','afterDestroy':_0x6c67('0x3')};function emitEvent(_0x55d204){return function(_0x11884e,_0x4c0719,_0x2fc8e8){VoiceQueueEvents[_0x6c67('0x4')](_0x55d204+':'+_0x11884e['id'],_0x11884e);VoiceQueueEvents[_0x6c67('0x4')](_0x55d204,_0x11884e);_0x2fc8e8(null);};}for(var e in events){if(events[_0x6c67('0x5')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index fbcece8..8da832f 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 _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x3d8812,_0x24b648){var _0x3aa4ee=function(_0x1d5e09){while(--_0x1d5e09){_0x3d8812['push'](_0x3d8812['shift']());}};_0x3aa4ee(++_0x24b648);}(_0x008c,0x188));var _0xc008=function(_0x55036a,_0x1e43dc){_0x55036a=_0x55036a-0x0;var _0x2ebe00=_0x008c[_0x55036a];return _0x2ebe00;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x44b259,_0x3192db){var _0x4c6b72=function(_0x2d9682){while(--_0x2d9682){_0x44b259['push'](_0x44b259['shift']());}};_0x4c6b72(++_0x3192db);}(_0x34e8,0x12c));var _0x834e=function(_0x2a53d2,_0x43b8da){_0x2a53d2=_0x2a53d2-0x0;var _0x145f0e=_0x34e8[_0x2a53d2];return _0x145f0e;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 280c4c2..37167a1 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 _0xe78e=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowVoiceQueue','find'];(function(_0x1288c5,_0x7de5e6){var _0xf24aad=function(_0x2da39f){while(--_0x2da39f){_0x1288c5['push'](_0x1288c5['shift']());}};_0xf24aad(++_0x7de5e6);}(_0xe78e,0x1b9));var _0xee78=function(_0x2fec0d,_0x4efdf0){_0x2fec0d=_0x2fec0d-0x0;var _0x1762fd=_0xe78e[_0x2fec0d];return _0x1762fd;};'use strict';var _=require('lodash');var util=require(_0xee78('0x0'));var moment=require(_0xee78('0x1'));var BPromise=require(_0xee78('0x2'));var rs=require(_0xee78('0x3'));var fs=require('fs');var Redis=require(_0xee78('0x4'));var db=require(_0xee78('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xee78('0x6'))(_0xee78('0x7'));var config=require('../../config/environment');var jayson=require(_0xee78('0x8'));var client=jayson[_0xee78('0x9')][_0xee78('0xa')]({'port':0x232a});config['redis']=_[_0xee78('0xb')](config[_0xee78('0xc')],{'host':_0xee78('0xd'),'port':0x18eb});var socket=require(_0xee78('0xe'))(new Redis(config[_0xee78('0xc')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x48a49a,_0x343f2c,_0x2bd2f7){return new BPromise(function(_0x37f99a,_0x1a71a5){return client[_0xee78('0xf')](_0x48a49a,_0x2bd2f7)[_0xee78('0x10')](function(_0x44706e){logger[_0xee78('0x11')](_0xee78('0x12'),_0x343f2c,_0xee78('0x13'));logger['debug'](_0xee78('0x14'),_0x343f2c,_0xee78('0x13'),JSON['stringify'](_0x44706e));if(_0x44706e['error']){if(_0x44706e[_0xee78('0x15')][_0xee78('0x16')]===0x1f4){logger[_0xee78('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x343f2c,_0x44706e[_0xee78('0x15')][_0xee78('0x17')]);return _0x1a71a5(_0x44706e[_0xee78('0x15')][_0xee78('0x17')]);}logger[_0xee78('0x15')](_0xee78('0x12'),_0x343f2c,_0x44706e[_0xee78('0x15')][_0xee78('0x17')]);return _0x37f99a(_0x44706e[_0xee78('0x15')]['message']);}else{logger[_0xee78('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x343f2c,'request\x20sent');_0x37f99a(_0x44706e[_0xee78('0x18')][_0xee78('0x17')]);}})['catch'](function(_0x3fbf3a){logger[_0xee78('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x343f2c,_0x3fbf3a);_0x1a71a5(_0x3fbf3a);});});}exports[_0xee78('0x19')]=function(_0x255eaf){var _0x202048=this;return new Promise(function(_0x5214c3,_0x254c85){return db[_0xee78('0x1a')][_0xee78('0x1b')]({'raw':_0x255eaf[_0xee78('0x1c')]?_0x255eaf[_0xee78('0x1c')][_0xee78('0x1d')]===undefined?!![]:![]:!![],'where':_0x255eaf[_0xee78('0x1c')]?_0x255eaf[_0xee78('0x1c')][_0xee78('0x1e')]||null:null,'attributes':_0x255eaf['options']?_0x255eaf['options'][_0xee78('0x1f')]||null:null,'limit':_0x255eaf['options']?_0x255eaf['options'][_0xee78('0x20')]||null:null,'include':_0x255eaf[_0xee78('0x1c')]?_0x255eaf['options'][_0xee78('0x21')]?_[_0xee78('0x22')](_0x255eaf[_0xee78('0x1c')][_0xee78('0x21')],function(_0x3900ce){return{'model':db[_0x3900ce[_0xee78('0x23')]],'as':_0x3900ce['as'],'attributes':_0x3900ce[_0xee78('0x1f')],'include':_0x3900ce[_0xee78('0x21')]?_[_0xee78('0x22')](_0x3900ce[_0xee78('0x21')],function(_0x4e76df){return{'model':db[_0x4e76df[_0xee78('0x23')]],'as':_0x4e76df['as'],'attributes':_0x4e76df['attributes'],'include':_0x4e76df[_0xee78('0x21')]?_['map'](_0x4e76df[_0xee78('0x21')],function(_0x976b30){return{'model':db[_0x976b30[_0xee78('0x23')]],'as':_0x976b30['as'],'attributes':_0x976b30[_0xee78('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xee78('0x10')](function(_0x24b92f){logger['info'](_0xee78('0x19'),_0x255eaf);logger[_0xee78('0x24')](_0xee78('0x19'),_0x255eaf,JSON['stringify'](_0x24b92f));_0x5214c3(_0x24b92f);})['catch'](function(_0x58153b){logger[_0xee78('0x15')](_0xee78('0x19'),_0x58153b[_0xee78('0x17')],_0x255eaf);_0x254c85(_0x202048[_0xee78('0x15')](0x1f4,_0x58153b[_0xee78('0x17')]));});});};exports[_0xee78('0x25')]=function(_0x378117){var _0x4b0e85=this;return new Promise(function(_0xf77078,_0x453325){return db[_0xee78('0x1a')][_0xee78('0x26')]({'raw':_0x378117['options']?_0x378117[_0xee78('0x1c')][_0xee78('0x1d')]===undefined?!![]:![]:!![],'where':_0x378117[_0xee78('0x1c')]?_0x378117['options'][_0xee78('0x1e')]||null:null,'attributes':_0x378117[_0xee78('0x1c')]?_0x378117[_0xee78('0x1c')]['attributes']||null:null,'include':_0x378117[_0xee78('0x1c')]?_0x378117[_0xee78('0x1c')][_0xee78('0x21')]?_['map'](_0x378117['options'][_0xee78('0x21')],function(_0x147383){return{'model':db[_0x147383[_0xee78('0x23')]],'as':_0x147383['as'],'attributes':_0x147383['attributes'],'include':_0x147383[_0xee78('0x21')]?_['map'](_0x147383[_0xee78('0x21')],function(_0x296f0e){return{'model':db[_0x296f0e[_0xee78('0x23')]],'as':_0x296f0e['as'],'attributes':_0x296f0e['attributes'],'include':_0x296f0e['include']?_[_0xee78('0x22')](_0x296f0e[_0xee78('0x21')],function(_0x5b25ae){return{'model':db[_0x5b25ae['model']],'as':_0x5b25ae['as'],'attributes':_0x5b25ae[_0xee78('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xee78('0x10')](function(_0x4e48ff){logger['info'](_0xee78('0x25'),_0x378117);logger[_0xee78('0x24')](_0xee78('0x25'),_0x378117,JSON['stringify'](_0x4e48ff));_0xf77078(_0x4e48ff);})[_0xee78('0x27')](function(_0x2b5663){logger[_0xee78('0x15')]('ShowVoiceQueue',_0x2b5663[_0xee78('0x17')],_0x378117);_0x453325(_0x4b0e85[_0xee78('0x15')](0x1f4,_0x2b5663[_0xee78('0x17')]));});});}; \ No newline at end of file +var _0xe6f6=['./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','include','map','model','debug','ShowVoiceQueue','find','info','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xe6f6,0x6a));var _0x6e6f=function(_0xf27dbb,_0x4a148d){_0xf27dbb=_0xf27dbb-0x0;var _0x287217=_0xe6f6[_0xf27dbb];return _0x287217;};'use strict';var _=require(_0x6e6f('0x0'));var util=require(_0x6e6f('0x1'));var moment=require('moment');var BPromise=require(_0x6e6f('0x2'));var rs=require(_0x6e6f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6e6f('0x4'));var logger=require(_0x6e6f('0x5'))(_0x6e6f('0x6'));var config=require('../../config/environment');var jayson=require(_0x6e6f('0x7'));var client=jayson[_0x6e6f('0x8')][_0x6e6f('0x9')]({'port':0x232a});config[_0x6e6f('0xa')]=_[_0x6e6f('0xb')](config[_0x6e6f('0xa')],{'host':_0x6e6f('0xc'),'port':0x18eb});var socket=require(_0x6e6f('0xd'))(new Redis(config[_0x6e6f('0xa')]));require(_0x6e6f('0xe'))[_0x6e6f('0xf')](socket);function respondWithRpcPromise(_0x3adcbd,_0x2199dd,_0x195df8){return new BPromise(function(_0x8b9335,_0x1b61d3){return client[_0x6e6f('0x10')](_0x3adcbd,_0x195df8)[_0x6e6f('0x11')](function(_0x1a8a79){logger['info'](_0x6e6f('0x12'),_0x2199dd,_0x6e6f('0x13'));logger['debug'](_0x6e6f('0x14'),_0x2199dd,_0x6e6f('0x13'),JSON[_0x6e6f('0x15')](_0x1a8a79));if(_0x1a8a79[_0x6e6f('0x16')]){if(_0x1a8a79['error'][_0x6e6f('0x17')]===0x1f4){logger['error'](_0x6e6f('0x12'),_0x2199dd,_0x1a8a79[_0x6e6f('0x16')]['message']);return _0x1b61d3(_0x1a8a79[_0x6e6f('0x16')]['message']);}logger[_0x6e6f('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x2199dd,_0x1a8a79[_0x6e6f('0x16')][_0x6e6f('0x18')]);return _0x8b9335(_0x1a8a79[_0x6e6f('0x16')][_0x6e6f('0x18')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x2199dd,'request\x20sent');_0x8b9335(_0x1a8a79['result'][_0x6e6f('0x18')]);}})[_0x6e6f('0x19')](function(_0x29d8cf){logger[_0x6e6f('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x2199dd,_0x29d8cf);_0x1b61d3(_0x29d8cf);});});}exports[_0x6e6f('0x1a')]=function(_0x3bdc45){var _0x27c501=this;return new Promise(function(_0x3f008d,_0x5ea86b){return db[_0x6e6f('0x1b')][_0x6e6f('0x1c')]({'raw':_0x3bdc45[_0x6e6f('0x1d')]?_0x3bdc45['options'][_0x6e6f('0x1e')]===undefined?!![]:![]:!![],'where':_0x3bdc45[_0x6e6f('0x1d')]?_0x3bdc45[_0x6e6f('0x1d')][_0x6e6f('0x1f')]||null:null,'attributes':_0x3bdc45[_0x6e6f('0x1d')]?_0x3bdc45[_0x6e6f('0x1d')][_0x6e6f('0x20')]||null:null,'limit':_0x3bdc45['options']?_0x3bdc45[_0x6e6f('0x1d')]['limit']||null:null,'include':_0x3bdc45[_0x6e6f('0x1d')]?_0x3bdc45[_0x6e6f('0x1d')][_0x6e6f('0x21')]?_[_0x6e6f('0x22')](_0x3bdc45[_0x6e6f('0x1d')]['include'],function(_0x104000){return{'model':db[_0x104000[_0x6e6f('0x23')]],'as':_0x104000['as'],'attributes':_0x104000[_0x6e6f('0x20')],'include':_0x104000[_0x6e6f('0x21')]?_[_0x6e6f('0x22')](_0x104000[_0x6e6f('0x21')],function(_0x155e2f){return{'model':db[_0x155e2f[_0x6e6f('0x23')]],'as':_0x155e2f['as'],'attributes':_0x155e2f[_0x6e6f('0x20')],'include':_0x155e2f['include']?_[_0x6e6f('0x22')](_0x155e2f[_0x6e6f('0x21')],function(_0x401070){return{'model':db[_0x401070[_0x6e6f('0x23')]],'as':_0x401070['as'],'attributes':_0x401070[_0x6e6f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6e6f('0x11')](function(_0x4a2c60){logger['info'](_0x6e6f('0x1a'),_0x3bdc45);logger[_0x6e6f('0x24')](_0x6e6f('0x1a'),_0x3bdc45,JSON[_0x6e6f('0x15')](_0x4a2c60));_0x3f008d(_0x4a2c60);})['catch'](function(_0x4d1e11){logger['error'](_0x6e6f('0x1a'),_0x4d1e11[_0x6e6f('0x18')],_0x3bdc45);_0x5ea86b(_0x27c501[_0x6e6f('0x16')](0x1f4,_0x4d1e11[_0x6e6f('0x18')]));});});};exports[_0x6e6f('0x25')]=function(_0x4040e5){var _0x5800af=this;return new Promise(function(_0x4fd27b,_0x419ce3){return db['VoiceQueue'][_0x6e6f('0x26')]({'raw':_0x4040e5['options']?_0x4040e5[_0x6e6f('0x1d')][_0x6e6f('0x1e')]===undefined?!![]:![]:!![],'where':_0x4040e5[_0x6e6f('0x1d')]?_0x4040e5[_0x6e6f('0x1d')][_0x6e6f('0x1f')]||null:null,'attributes':_0x4040e5['options']?_0x4040e5[_0x6e6f('0x1d')][_0x6e6f('0x20')]||null:null,'include':_0x4040e5[_0x6e6f('0x1d')]?_0x4040e5[_0x6e6f('0x1d')][_0x6e6f('0x21')]?_['map'](_0x4040e5[_0x6e6f('0x1d')][_0x6e6f('0x21')],function(_0x235bd6){return{'model':db[_0x235bd6[_0x6e6f('0x23')]],'as':_0x235bd6['as'],'attributes':_0x235bd6['attributes'],'include':_0x235bd6[_0x6e6f('0x21')]?_['map'](_0x235bd6['include'],function(_0x1efc13){return{'model':db[_0x1efc13['model']],'as':_0x1efc13['as'],'attributes':_0x1efc13[_0x6e6f('0x20')],'include':_0x1efc13[_0x6e6f('0x21')]?_[_0x6e6f('0x22')](_0x1efc13[_0x6e6f('0x21')],function(_0x4df619){return{'model':db[_0x4df619[_0x6e6f('0x23')]],'as':_0x4df619['as'],'attributes':_0x4df619[_0x6e6f('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22f583){logger[_0x6e6f('0x27')](_0x6e6f('0x25'),_0x4040e5);logger[_0x6e6f('0x24')](_0x6e6f('0x25'),_0x4040e5,JSON[_0x6e6f('0x15')](_0x22f583));_0x4fd27b(_0x22f583);})[_0x6e6f('0x19')](function(_0x654bb2){logger[_0x6e6f('0x16')](_0x6e6f('0x25'),_0x654bb2[_0x6e6f('0x18')],_0x4040e5);_0x419ce3(_0x5800af['error'](0x1f4,_0x654bb2[_0x6e6f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index dfba7e4..5527f65 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 _0x937f=['remove','update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x2c199f,_0x9bc083){var _0x443416=function(_0x10803e){while(--_0x10803e){_0x2c199f['push'](_0x2c199f['shift']());}};_0x443416(++_0x9bc083);}(_0x937f,0xb2));var _0xf937=function(_0xdd14ac,_0x108a82){_0xdd14ac=_0xdd14ac-0x0;var _0x1dcce2=_0x937f[_0xdd14ac];return _0x1dcce2;};'use strict';var VoiceQueueEvents=require(_0xf937('0x0'));var events=[_0xf937('0x1'),_0xf937('0x2'),_0xf937('0x3')];function createListener(_0x3b7cfe,_0x10d73b){return function(_0x31b9f6){_0x10d73b[_0xf937('0x4')](_0x3b7cfe,_0x31b9f6);};}function removeListener(_0x5ee95f,_0x2afb59){return function(){VoiceQueueEvents[_0xf937('0x5')](_0x5ee95f,_0x2afb59);};}exports[_0xf937('0x6')]=function(_0x8fa8c){for(var _0x331cde=0x0,_0x2e2bf7=events[_0xf937('0x7')];_0x331cde<_0x2e2bf7;_0x331cde++){var _0x19799f=events[_0x331cde];var _0x39622b=createListener(_0xf937('0x8')+_0x19799f,_0x8fa8c);VoiceQueueEvents['on'](_0x19799f,_0x39622b);}}; \ No newline at end of file +var _0x0094=['./voiceQueue.events','save','remove','update','emit','removeListener','register','length','voiceQueue:'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x0094,0x1e6));var _0x4009=function(_0x10626e,_0x5d5d84){_0x10626e=_0x10626e-0x0;var _0x4b2b33=_0x0094[_0x10626e];return _0x4b2b33;};'use strict';var VoiceQueueEvents=require(_0x4009('0x0'));var events=[_0x4009('0x1'),_0x4009('0x2'),_0x4009('0x3')];function createListener(_0x4dad66,_0x1b3d3e){return function(_0x46a23f){_0x1b3d3e[_0x4009('0x4')](_0x4dad66,_0x46a23f);};}function removeListener(_0x29dd4d,_0x5419f9){return function(){VoiceQueueEvents[_0x4009('0x5')](_0x29dd4d,_0x5419f9);};}exports[_0x4009('0x6')]=function(_0x21b334){for(var _0x75faf0=0x0,_0xfcb34=events[_0x4009('0x7')];_0x75faf0<_0xfcb34;_0x75faf0++){var _0x109e6a=events[_0x75faf0];var _0x4cb98e=createListener(_0x4009('0x8')+_0x109e6a,_0x21b334);VoiceQueueEvents['on'](_0x109e6a,_0x4cb98e);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 0a9bcdd..bfe0235 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 _0xff4c=['./voiceQueueReport.controller','get','isAuthenticated','index','/describe','/index','getVoiceQueuesReport','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','fs-extra'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xff4c,0x1db));var _0xcff4=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xff4c[_0x2ca9d4];return _0x258956;};'use strict';var multer=require(_0xcff4('0x0'));var util=require(_0xcff4('0x1'));var path=require(_0xcff4('0x2'));var timeout=require('connect-timeout');var express=require(_0xcff4('0x3'));var router=express['Router']();var fs_extra=require(_0xcff4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcff4('0x5'));router[_0xcff4('0x6')]('/',auth[_0xcff4('0x7')](),controller[_0xcff4('0x8')]);router[_0xcff4('0x6')](_0xcff4('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xcff4('0xa'),auth['isAuthenticated'](),controller[_0xcff4('0xb')]);router[_0xcff4('0x6')](_0xcff4('0xc'),auth[_0xcff4('0x7')](),controller['show']);router[_0xcff4('0xd')]('/',auth[_0xcff4('0x7')](),controller[_0xcff4('0xe')]);router[_0xcff4('0xf')](_0xcff4('0xc'),auth[_0xcff4('0x7')](),controller[_0xcff4('0x10')]);router[_0xcff4('0x11')](_0xcff4('0xc'),auth[_0xcff4('0x7')](),controller[_0xcff4('0x12')]);module[_0xcff4('0x13')]=router; \ No newline at end of file +var _0xcfe4=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','delete','exports'];(function(_0x197d5c,_0x1936b0){var _0x13dc71=function(_0x332d07){while(--_0x332d07){_0x197d5c['push'](_0x197d5c['shift']());}};_0x13dc71(++_0x1936b0);}(_0xcfe4,0x9a));var _0x4cfe=function(_0x4819cc,_0x4bb9f2){_0x4819cc=_0x4819cc-0x0;var _0x31851d=_0xcfe4[_0x4819cc];return _0x31851d;};'use strict';var multer=require(_0x4cfe('0x0'));var util=require(_0x4cfe('0x1'));var path=require(_0x4cfe('0x2'));var timeout=require(_0x4cfe('0x3'));var express=require(_0x4cfe('0x4'));var router=express[_0x4cfe('0x5')]();var fs_extra=require(_0x4cfe('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4cfe('0x7'));var config=require(_0x4cfe('0x8'));var controller=require(_0x4cfe('0x9'));router[_0x4cfe('0xa')]('/',auth['isAuthenticated'](),controller[_0x4cfe('0xb')]);router[_0x4cfe('0xa')](_0x4cfe('0xc'),auth['isAuthenticated'](),controller[_0x4cfe('0xd')]);router[_0x4cfe('0xa')]('/index',auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0x4cfe('0xa')](_0x4cfe('0xe'),auth[_0x4cfe('0xf')](),controller[_0x4cfe('0x10')]);router[_0x4cfe('0x11')]('/',auth[_0x4cfe('0xf')](),controller[_0x4cfe('0x12')]);router[_0x4cfe('0x13')](_0x4cfe('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x4cfe('0x14')](_0x4cfe('0xe'),auth[_0x4cfe('0xf')](),controller['destroy']);module[_0x4cfe('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 981e874..538178a 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 _0x309d=['getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','holdtime','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE'];(function(_0x26d7b8,_0x597018){var _0x48657d=function(_0x1bc747){while(--_0x1bc747){_0x26d7b8['push'](_0x26d7b8['shift']());}};_0x48657d(++_0x597018);}(_0x309d,0x10e));var _0xd309=function(_0x5243a3,_0x5e8ca2){_0x5243a3=_0x5243a3-0x0;var _0x139fcb=_0x309d[_0x5243a3];return _0x139fcb;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xd309('0x0')]={'type':{'type':Sequelize[_0xd309('0x1')]},'uniqueid':{'type':Sequelize[_0xd309('0x1')]},'calleridnum':{'type':Sequelize[_0xd309('0x1')]},'calleridname':{'type':Sequelize[_0xd309('0x1')]},'queue':{'type':Sequelize[_0xd309('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0xd309('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0xd309('0x2')],'set':function(_0x476900){var _0xe75258=moment(_0x476900);var _0x407a90=moment(this[_0xd309('0x3')](_0xd309('0x4')))['format'](_0xd309('0x5'));var _0x2ccafa=_0xe75258['diff'](_0x407a90,_0xd309('0x6'));this[_0xd309('0x7')]('queuecallerleaveAt',_0x476900);this[_0xd309('0x7')](_0xd309('0x8'),_0x2ccafa||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xd309('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xd309('0x2')]},'queuecallercomplete':{'type':Sequelize[_0xd309('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xd309('0x2')]},'queuecallerexit':{'type':Sequelize[_0xd309('0x9')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xd309('0x2')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xd309('0xa')},'originalposition':{'type':Sequelize[_0xd309('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd309('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd309('0x1')]},'context':{'type':Sequelize[_0xd309('0x1')]},'exten':{'type':Sequelize[_0xd309('0x1')]},'priority':{'type':Sequelize[_0xd309('0x1')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xd309('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xd309('0x1')]},'transfer':{'type':Sequelize[_0xd309('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xd309('0xc')},'transferexten':{'type':Sequelize[_0xd309('0x1')]},'transferuniqueid':{'type':Sequelize[_0xd309('0x1')]},'disposition':{'type':Sequelize[_0xd309('0x1')]},'secondDisposition':{'type':Sequelize[_0xd309('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x04c0=['STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment'];(function(_0x50aa8d,_0x5efabf){var _0x3f1abb=function(_0x3e8e75){while(--_0x3e8e75){_0x50aa8d['push'](_0x50aa8d['shift']());}};_0x3f1abb(++_0x5efabf);}(_0x04c0,0x11e));var _0x004c=function(_0x559e89,_0x231e84){_0x559e89=_0x559e89-0x0;var _0x3877a2=_0x04c0[_0x559e89];return _0x3877a2;};'use strict';var Sequelize=require(_0x004c('0x0'));var moment=require(_0x004c('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x004c('0x2')]},'calleridnum':{'type':Sequelize[_0x004c('0x2')]},'calleridname':{'type':Sequelize[_0x004c('0x2')]},'queue':{'type':Sequelize[_0x004c('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x004c('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x004c('0x3')],'set':function(_0x38773e){var _0x3fde8f=moment(_0x38773e);var _0xd7ff69=moment(this[_0x004c('0x4')](_0x004c('0x5')))[_0x004c('0x6')](_0x004c('0x7'));var _0x55f37f=_0x3fde8f['diff'](_0xd7ff69,_0x004c('0x8'));this[_0x004c('0x9')](_0x004c('0xa'),_0x38773e);this[_0x004c('0x9')](_0x004c('0xb'),_0x55f37f||null);}},'position':{'type':Sequelize[_0x004c('0xc')]},'count':{'type':Sequelize[_0x004c('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x004c('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x004c('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x004c('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x004c('0x2')],'comment':_0x004c('0xe')},'originalposition':{'type':Sequelize[_0x004c('0xc')]},'channel':{'type':Sequelize[_0x004c('0x2')]},'connectedlinenum':{'type':Sequelize[_0x004c('0x2')]},'connectedlinename':{'type':Sequelize[_0x004c('0x2')]},'accountcode':{'type':Sequelize[_0x004c('0x2')]},'context':{'type':Sequelize[_0x004c('0x2')]},'exten':{'type':Sequelize[_0x004c('0x2')]},'priority':{'type':Sequelize[_0x004c('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x004c('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x004c('0x2')],'comment':_0x004c('0xf')},'transferexten':{'type':Sequelize[_0x004c('0x2')]},'transferuniqueid':{'type':Sequelize[_0x004c('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x004c('0xc')],'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 776041b..46c6b82 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 _0xf673=['./voiceQueueReport.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','map','VoiceQueueReport','rawAttributes','fieldName','key','model','filters','intersection','query','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','show','params','keys','fields','options','create','body','catch','find','describe','getVoiceQueuesReport','rows','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x17c042,_0x20062e){var _0x554337=function(_0x25a1db){while(--_0x25a1db){_0x17c042['push'](_0x17c042['shift']());}};_0x554337(++_0x20062e);}(_0xf673,0x120));var _0x3f67=function(_0x216799,_0x44b817){_0x216799=_0x216799-0x0;var _0x3661c3=_0xf673[_0x216799];return _0x3661c3;};'use strict';var emlformat=require(_0x3f67('0x0'));var rimraf=require(_0x3f67('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f67('0x2'));var rp=require('request-promise');var moment=require(_0x3f67('0x3'));var BPromise=require(_0x3f67('0x4'));var Mustache=require(_0x3f67('0x5'));var util=require(_0x3f67('0x6'));var path=require(_0x3f67('0x7'));var sox=require('sox');var csv=require(_0x3f67('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f67('0x9'));var _=require(_0x3f67('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3f67('0xb'));var toCsv=require(_0x3f67('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3f67('0xc'));var qs=require(_0x3f67('0xd'));var as=require(_0x3f67('0xe'));var hardwareService=require(_0x3f67('0xf'));var logger=require(_0x3f67('0x10'))(_0x3f67('0x11'));var utils=require(_0x3f67('0x12'));var config=require(_0x3f67('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f67('0x14'))['db'];config[_0x3f67('0x15')]=_[_0x3f67('0x16')](config[_0x3f67('0x15')],{'host':_0x3f67('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f67('0x15')]));require(_0x3f67('0x18'))[_0x3f67('0x19')](socket);function respondWithStatusCode(_0x2873ab,_0x2ee5bf){_0x2ee5bf=_0x2ee5bf||0xcc;return function(_0x32e297){if(_0x32e297){return _0x2873ab['sendStatus'](_0x2ee5bf);}return _0x2873ab[_0x3f67('0x1a')](_0x2ee5bf)[_0x3f67('0x1b')]();};}function respondWithResult(_0x37c9fe,_0x2c837f){_0x2c837f=_0x2c837f||0xc8;return function(_0x1c34cd){if(_0x1c34cd){return _0x37c9fe[_0x3f67('0x1a')](_0x2c837f)[_0x3f67('0x1c')](_0x1c34cd);}};}function respondWithFilteredResult(_0x2ba124,_0x20dbc0){return function(_0x29c7ce){if(_0x29c7ce){var _0x5ca4e9=typeof _0x20dbc0[_0x3f67('0x1d')]==='undefined'&&typeof _0x20dbc0[_0x3f67('0x1e')]===_0x3f67('0x1f');var _0x46ceaf=_0x29c7ce[_0x3f67('0x20')];var _0x4dce4f=_0x5ca4e9?0x0:_0x20dbc0[_0x3f67('0x1d')];var _0x2d7444=_0x5ca4e9?_0x29c7ce['count']:_0x20dbc0['offset']+_0x20dbc0[_0x3f67('0x1e')];var _0x456b05;if(_0x2d7444>=_0x46ceaf){_0x2d7444=_0x46ceaf;_0x456b05=0xc8;}else{_0x456b05=0xce;}_0x2ba124['status'](_0x456b05);return _0x2ba124[_0x3f67('0x21')](_0x3f67('0x22'),_0x4dce4f+'-'+_0x2d7444+'/'+_0x46ceaf)[_0x3f67('0x1c')](_0x29c7ce);}return null;};}function patchUpdates(_0x11a423){return function(_0x3d140b){try{jsonpatch['apply'](_0x3d140b,_0x11a423,!![]);}catch(_0x378e01){return BPromise[_0x3f67('0x23')](_0x378e01);}return _0x3d140b[_0x3f67('0x24')]();};}function saveUpdates(_0x525a0b,_0x4c7ec7){return function(_0x48ae5f){if(_0x48ae5f){return _0x48ae5f[_0x3f67('0x25')](_0x525a0b)[_0x3f67('0x26')](function(_0x9cb927){return _0x9cb927;});}return null;};}function removeEntity(_0x24b681,_0x3089f2){return function(_0x5a46b6){if(_0x5a46b6){return _0x5a46b6[_0x3f67('0x27')]()['then'](function(){_0x24b681[_0x3f67('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c5590,_0x10cf57){return function(_0x5d3705){if(!_0x5d3705){_0x4c5590['sendStatus'](0x194);}return _0x5d3705;};}function handleError(_0x2701a2,_0x810473){_0x810473=_0x810473||0x1f4;return function(_0x27780a){logger[_0x3f67('0x28')](_0x27780a['stack']);if(_0x27780a['name']){delete _0x27780a[_0x3f67('0x29')];}_0x2701a2[_0x3f67('0x1a')](_0x810473)[_0x3f67('0x2a')](_0x27780a);};}exports['index']=function(_0x37cc1a,_0x27acb2){var _0x15dd4a={},_0x5578fa={},_0x14b0e4={'count':0x0,'rows':[]};var _0xc2d5a3=_[_0x3f67('0x2b')](db[_0x3f67('0x2c')][_0x3f67('0x2d')],function(_0x16a778){return{'name':_0x16a778[_0x3f67('0x2e')],'type':_0x16a778['type'][_0x3f67('0x2f')]};});_0x5578fa[_0x3f67('0x30')]=_['map'](_0xc2d5a3,_0x3f67('0x29'));_0x5578fa['query']=_['keys'](_0x37cc1a['query']);_0x5578fa[_0x3f67('0x31')]=_[_0x3f67('0x32')](_0x5578fa['model'],_0x5578fa[_0x3f67('0x33')]);_0x15dd4a[_0x3f67('0x34')]=_[_0x3f67('0x32')](_0x5578fa[_0x3f67('0x30')],qs['fields'](_0x37cc1a[_0x3f67('0x33')]['fields']));_0x15dd4a[_0x3f67('0x34')]=_0x15dd4a['attributes'][_0x3f67('0x35')]?_0x15dd4a[_0x3f67('0x34')]:_0x5578fa[_0x3f67('0x30')];if(!_0x37cc1a[_0x3f67('0x33')][_0x3f67('0x36')]('nolimit')){_0x15dd4a[_0x3f67('0x1e')]=qs[_0x3f67('0x1e')](_0x37cc1a['query'][_0x3f67('0x1e')]);_0x15dd4a[_0x3f67('0x1d')]=qs[_0x3f67('0x1d')](_0x37cc1a[_0x3f67('0x33')][_0x3f67('0x1d')]);}_0x15dd4a[_0x3f67('0x37')]=qs[_0x3f67('0x38')](_0x37cc1a['query']['sort']);_0x15dd4a[_0x3f67('0x39')]=qs[_0x3f67('0x31')](_[_0x3f67('0x3a')](_0x37cc1a['query'],_0x5578fa['filters']),_0xc2d5a3);if(_0x37cc1a['query'][_0x3f67('0x3b')]){_0x15dd4a[_0x3f67('0x39')]=_[_0x3f67('0x3c')](_0x15dd4a['where'],{'$or':_['map'](_0xc2d5a3,function(_0x5d68ec){if(_0x5d68ec[_0x3f67('0x3d')]!==_0x3f67('0x3e')){var _0x5aff57={};_0x5aff57[_0x5d68ec[_0x3f67('0x29')]]={'$like':'%'+_0x37cc1a[_0x3f67('0x33')][_0x3f67('0x3b')]+'%'};return _0x5aff57;}})});}_0x15dd4a=_[_0x3f67('0x3c')]({},_0x15dd4a,_0x37cc1a['options']);var _0x34662d={'where':_0x15dd4a['where']};return db['VoiceQueueReport'][_0x3f67('0x20')](_0x34662d)[_0x3f67('0x26')](function(_0x35644f){_0x14b0e4['count']=_0x35644f;if(_0x37cc1a[_0x3f67('0x33')][_0x3f67('0x3f')]){_0x15dd4a[_0x3f67('0x40')]=[{'all':!![]}];}return db[_0x3f67('0x2c')][_0x3f67('0x41')](_0x15dd4a);})[_0x3f67('0x26')](function(_0x285846){_0x14b0e4['rows']=_0x285846;return _0x14b0e4;})[_0x3f67('0x26')](respondWithFilteredResult(_0x27acb2,_0x15dd4a))['catch'](handleError(_0x27acb2,null));};exports[_0x3f67('0x42')]=function(_0x5b3621,_0x2c1a8d){var _0x2a04a4={'raw':![],'where':{'id':_0x5b3621[_0x3f67('0x43')]['id']}},_0x2a66c7={};_0x2a66c7[_0x3f67('0x30')]=_[_0x3f67('0x44')](db['VoiceQueueReport'][_0x3f67('0x2d')]);_0x2a66c7[_0x3f67('0x33')]=_['keys'](_0x5b3621[_0x3f67('0x33')]);_0x2a66c7[_0x3f67('0x31')]=_[_0x3f67('0x32')](_0x2a66c7[_0x3f67('0x30')],_0x2a66c7[_0x3f67('0x33')]);_0x2a04a4['attributes']=_[_0x3f67('0x32')](_0x2a66c7[_0x3f67('0x30')],qs[_0x3f67('0x45')](_0x5b3621[_0x3f67('0x33')][_0x3f67('0x45')]));_0x2a04a4['attributes']=_0x2a04a4[_0x3f67('0x34')][_0x3f67('0x35')]?_0x2a04a4['attributes']:_0x2a66c7[_0x3f67('0x30')];if(_0x5b3621[_0x3f67('0x33')][_0x3f67('0x3f')]){_0x2a04a4[_0x3f67('0x40')]=[{'all':!![]}];}_0x2a04a4=_['merge']({},_0x2a04a4,_0x5b3621[_0x3f67('0x46')]);return db[_0x3f67('0x2c')]['find'](_0x2a04a4)['then'](handleEntityNotFound(_0x2c1a8d,null))['then'](respondWithResult(_0x2c1a8d,null))['catch'](handleError(_0x2c1a8d,null));};exports['create']=function(_0x5cf09a,_0x19ff67){return db[_0x3f67('0x2c')][_0x3f67('0x47')](_0x5cf09a[_0x3f67('0x48')],{})[_0x3f67('0x26')](respondWithResult(_0x19ff67,0xc9))[_0x3f67('0x49')](handleError(_0x19ff67,null));};exports[_0x3f67('0x25')]=function(_0x49d57c,_0x429707){if(_0x49d57c[_0x3f67('0x48')]['id']){delete _0x49d57c[_0x3f67('0x48')]['id'];}return db[_0x3f67('0x2c')][_0x3f67('0x4a')]({'where':{'id':_0x49d57c[_0x3f67('0x43')]['id']}})[_0x3f67('0x26')](handleEntityNotFound(_0x429707,null))[_0x3f67('0x26')](saveUpdates(_0x49d57c[_0x3f67('0x48')],null))[_0x3f67('0x26')](respondWithResult(_0x429707,null))[_0x3f67('0x49')](handleError(_0x429707,null));};exports[_0x3f67('0x27')]=function(_0x382325,_0x4e8f4b){return db['VoiceQueueReport'][_0x3f67('0x4a')]({'where':{'id':_0x382325[_0x3f67('0x43')]['id']}})[_0x3f67('0x26')](handleEntityNotFound(_0x4e8f4b,null))['then'](removeEntity(_0x4e8f4b,null))[_0x3f67('0x49')](handleError(_0x4e8f4b,null));};exports[_0x3f67('0x4b')]=function(_0x1a0795,_0x2badea){return db[_0x3f67('0x2c')][_0x3f67('0x4b')]()[_0x3f67('0x26')](respondWithResult(_0x2badea,null))[_0x3f67('0x49')](handleError(_0x2badea,null));};exports[_0x3f67('0x4c')]=function(_0x552162,_0xfe700e){var _0x1666f2={},_0x4fa6d8={},_0x1d67cb={'count':0x0,'rows':[]};_0x4fa6d8['model']=_[_0x3f67('0x44')](db[_0x3f67('0x2c')][_0x3f67('0x2d')]);_0x4fa6d8[_0x3f67('0x33')]=_[_0x3f67('0x44')](_0x552162[_0x3f67('0x33')]);_0x4fa6d8[_0x3f67('0x31')]=_[_0x3f67('0x32')](_0x4fa6d8[_0x3f67('0x30')],_0x4fa6d8['query']);_0x1666f2['attributes']=_[_0x3f67('0x32')](_0x4fa6d8[_0x3f67('0x30')],qs[_0x3f67('0x45')](_0x552162['query'][_0x3f67('0x45')]));_0x1666f2[_0x3f67('0x34')]=_0x1666f2['attributes']['length']?_0x1666f2['attributes']:_0x4fa6d8[_0x3f67('0x30')];if(!_0x552162[_0x3f67('0x33')][_0x3f67('0x36')]('nolimit')){_0x1666f2[_0x3f67('0x1e')]=qs[_0x3f67('0x1e')](_0x552162['query'][_0x3f67('0x1e')]);_0x1666f2[_0x3f67('0x1d')]=qs[_0x3f67('0x1d')](_0x552162['query']['offset']);}_0x1666f2[_0x3f67('0x37')]=qs[_0x3f67('0x38')](_0x552162[_0x3f67('0x33')]['sort']);_0x1666f2['where']=qs[_0x3f67('0x31')](_[_0x3f67('0x3a')](_0x552162[_0x3f67('0x33')],_0x4fa6d8[_0x3f67('0x31')]));if(_0x552162[_0x3f67('0x33')]['filter']){_0x1666f2[_0x3f67('0x39')]=_[_0x3f67('0x3c')](_0x1666f2[_0x3f67('0x39')],{'$or':_[_0x3f67('0x2b')](_0x1666f2[_0x3f67('0x34')],function(_0x46b3c1){var _0x517b90={};_0x517b90[_0x46b3c1]={'$like':'%'+_0x552162[_0x3f67('0x33')][_0x3f67('0x3b')]+'%'};return _0x517b90;})});}_0x1666f2=_[_0x3f67('0x3c')]({},_0x1666f2,_0x552162[_0x3f67('0x46')]);var _0x12f06e={'where':_0x1666f2[_0x3f67('0x39')]};return db[_0x3f67('0x2c')][_0x3f67('0x20')](_0x12f06e)[_0x3f67('0x26')](function(_0x4b9b5f){_0x1d67cb[_0x3f67('0x20')]=_0x4b9b5f;if(_0x552162[_0x3f67('0x33')][_0x3f67('0x3f')]){_0x1666f2[_0x3f67('0x40')]=[{'all':!![]}];}return db[_0x3f67('0x2c')][_0x3f67('0x41')](_0x1666f2);})[_0x3f67('0x26')](function(_0x30f322){_0x1d67cb[_0x3f67('0x4d')]=_0x30f322;return _0x1d67cb;})[_0x3f67('0x26')](respondWithFilteredResult(_0xfe700e,_0x1666f2,_0x3f67('0x4c')))[_0x3f67('0x49')](handleError(_0xfe700e,null,_0x3f67('0x4c')));}; \ No newline at end of file +var _0x5cd7=['squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','defaults','redis','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','update','then','name','send','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','rows','show','length','find','catch','create','body','params','destroy','describe','getVoiceQueuesReport','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x1b04b1,_0x37b1cb){var _0x3479f8=function(_0x2fd831){while(--_0x2fd831){_0x1b04b1['push'](_0x1b04b1['shift']());}};_0x3479f8(++_0x37b1cb);}(_0x5cd7,0x132));var _0x75cd=function(_0x218ca4,_0x41cc40){_0x218ca4=_0x218ca4-0x0;var _0x1b3ff9=_0x5cd7[_0x218ca4];return _0x1b3ff9;};'use strict';var emlformat=require(_0x75cd('0x0'));var rimraf=require(_0x75cd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x75cd('0x2'));var rp=require(_0x75cd('0x3'));var moment=require(_0x75cd('0x4'));var BPromise=require(_0x75cd('0x5'));var Mustache=require(_0x75cd('0x6'));var util=require(_0x75cd('0x7'));var path=require(_0x75cd('0x8'));var sox=require(_0x75cd('0x9'));var csv=require(_0x75cd('0xa'));var ejs=require(_0x75cd('0xb'));var fs=require('fs');var fs_extra=require(_0x75cd('0xc'));var _=require(_0x75cd('0xd'));var squel=require(_0x75cd('0xe'));var crypto=require(_0x75cd('0xf'));var jsforce=require(_0x75cd('0x10'));var deskjs=require(_0x75cd('0x11'));var toCsv=require(_0x75cd('0xa'));var querystring=require(_0x75cd('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75cd('0x13'));var hardwareService=require(_0x75cd('0x14'));var logger=require(_0x75cd('0x15'))('api');var utils=require(_0x75cd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x75cd('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x75cd('0x18')](config[_0x75cd('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x75cd('0x1a'))(new Redis(config['redis']));require(_0x75cd('0x1b'))[_0x75cd('0x1c')](socket);function respondWithStatusCode(_0x4ebfb9,_0x2cd091){_0x2cd091=_0x2cd091||0xcc;return function(_0xeeb7dd){if(_0xeeb7dd){return _0x4ebfb9[_0x75cd('0x1d')](_0x2cd091);}return _0x4ebfb9['status'](_0x2cd091)[_0x75cd('0x1e')]();};}function respondWithResult(_0x596291,_0x2becd7){_0x2becd7=_0x2becd7||0xc8;return function(_0x392b02){if(_0x392b02){return _0x596291[_0x75cd('0x1f')](_0x2becd7)[_0x75cd('0x20')](_0x392b02);}};}function respondWithFilteredResult(_0x23d14b,_0x22de96){return function(_0x4e1dc6){if(_0x4e1dc6){var _0x225bf6=typeof _0x22de96[_0x75cd('0x21')]===_0x75cd('0x22')&&typeof _0x22de96['limit']===_0x75cd('0x22');var _0x22bf55=_0x4e1dc6[_0x75cd('0x23')];var _0x1a8f1a=_0x225bf6?0x0:_0x22de96[_0x75cd('0x21')];var _0xbcb79d=_0x225bf6?_0x4e1dc6[_0x75cd('0x23')]:_0x22de96[_0x75cd('0x21')]+_0x22de96[_0x75cd('0x24')];var _0x19b85d;if(_0xbcb79d>=_0x22bf55){_0xbcb79d=_0x22bf55;_0x19b85d=0xc8;}else{_0x19b85d=0xce;}_0x23d14b[_0x75cd('0x1f')](_0x19b85d);return _0x23d14b[_0x75cd('0x25')]('Content-Range',_0x1a8f1a+'-'+_0xbcb79d+'/'+_0x22bf55)[_0x75cd('0x20')](_0x4e1dc6);}return null;};}function patchUpdates(_0x5bfd08){return function(_0x243258){try{jsonpatch[_0x75cd('0x26')](_0x243258,_0x5bfd08,!![]);}catch(_0xc166ee){return BPromise['reject'](_0xc166ee);}return _0x243258['save']();};}function saveUpdates(_0x3681e4,_0x3ae4f6){return function(_0x1ec62f){if(_0x1ec62f){return _0x1ec62f[_0x75cd('0x27')](_0x3681e4)[_0x75cd('0x28')](function(_0x453cd5){return _0x453cd5;});}return null;};}function removeEntity(_0x3e1c4e,_0x1e0045){return function(_0x337000){if(_0x337000){return _0x337000['destroy']()[_0x75cd('0x28')](function(){_0x3e1c4e[_0x75cd('0x1f')](0xcc)[_0x75cd('0x1e')]();});}};}function handleEntityNotFound(_0x38a319,_0x5e048c){return function(_0x2fc8a1){if(!_0x2fc8a1){_0x38a319[_0x75cd('0x1d')](0x194);}return _0x2fc8a1;};}function handleError(_0x24e8db,_0x28dbd0){_0x28dbd0=_0x28dbd0||0x1f4;return function(_0x16b292){logger['error'](_0x16b292['stack']);if(_0x16b292['name']){delete _0x16b292[_0x75cd('0x29')];}_0x24e8db[_0x75cd('0x1f')](_0x28dbd0)[_0x75cd('0x2a')](_0x16b292);};}exports[_0x75cd('0x2b')]=function(_0x5b1242,_0x588d51){var _0x555240={},_0x2f4a38={},_0x4f1dc8={'count':0x0,'rows':[]};var _0x29cece=_['map'](db['VoiceQueueReport'][_0x75cd('0x2c')],function(_0x2390b9){return{'name':_0x2390b9['fieldName'],'type':_0x2390b9[_0x75cd('0x2d')][_0x75cd('0x2e')]};});_0x2f4a38[_0x75cd('0x2f')]=_['map'](_0x29cece,_0x75cd('0x29'));_0x2f4a38[_0x75cd('0x30')]=_[_0x75cd('0x31')](_0x5b1242[_0x75cd('0x30')]);_0x2f4a38[_0x75cd('0x32')]=_[_0x75cd('0x33')](_0x2f4a38[_0x75cd('0x2f')],_0x2f4a38['query']);_0x555240[_0x75cd('0x34')]=_[_0x75cd('0x33')](_0x2f4a38['model'],qs[_0x75cd('0x35')](_0x5b1242[_0x75cd('0x30')][_0x75cd('0x35')]));_0x555240['attributes']=_0x555240[_0x75cd('0x34')]['length']?_0x555240['attributes']:_0x2f4a38[_0x75cd('0x2f')];if(!_0x5b1242['query'][_0x75cd('0x36')](_0x75cd('0x37'))){_0x555240['limit']=qs['limit'](_0x5b1242['query'][_0x75cd('0x24')]);_0x555240[_0x75cd('0x21')]=qs[_0x75cd('0x21')](_0x5b1242['query'][_0x75cd('0x21')]);}_0x555240[_0x75cd('0x38')]=qs['sort'](_0x5b1242[_0x75cd('0x30')][_0x75cd('0x39')]);_0x555240[_0x75cd('0x3a')]=qs[_0x75cd('0x32')](_[_0x75cd('0x3b')](_0x5b1242[_0x75cd('0x30')],_0x2f4a38['filters']),_0x29cece);if(_0x5b1242[_0x75cd('0x30')][_0x75cd('0x3c')]){_0x555240[_0x75cd('0x3a')]=_[_0x75cd('0x3d')](_0x555240[_0x75cd('0x3a')],{'$or':_['map'](_0x29cece,function(_0x28da94){if(_0x28da94[_0x75cd('0x2d')]!==_0x75cd('0x3e')){var _0x480381={};_0x480381[_0x28da94[_0x75cd('0x29')]]={'$like':'%'+_0x5b1242[_0x75cd('0x30')][_0x75cd('0x3c')]+'%'};return _0x480381;}})});}_0x555240=_['merge']({},_0x555240,_0x5b1242[_0x75cd('0x3f')]);var _0x345ac5={'where':_0x555240['where']};return db[_0x75cd('0x40')][_0x75cd('0x23')](_0x345ac5)[_0x75cd('0x28')](function(_0x1e532b){_0x4f1dc8[_0x75cd('0x23')]=_0x1e532b;if(_0x5b1242['query'][_0x75cd('0x41')]){_0x555240[_0x75cd('0x42')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x75cd('0x43')](_0x555240);})[_0x75cd('0x28')](function(_0xd53c1e){_0x4f1dc8[_0x75cd('0x44')]=_0xd53c1e;return _0x4f1dc8;})[_0x75cd('0x28')](respondWithFilteredResult(_0x588d51,_0x555240))['catch'](handleError(_0x588d51,null));};exports[_0x75cd('0x45')]=function(_0xb69958,_0x434af8){var _0x40a307={'raw':![],'where':{'id':_0xb69958['params']['id']}},_0x5f0387={};_0x5f0387[_0x75cd('0x2f')]=_[_0x75cd('0x31')](db['VoiceQueueReport'][_0x75cd('0x2c')]);_0x5f0387['query']=_[_0x75cd('0x31')](_0xb69958['query']);_0x5f0387[_0x75cd('0x32')]=_[_0x75cd('0x33')](_0x5f0387[_0x75cd('0x2f')],_0x5f0387[_0x75cd('0x30')]);_0x40a307[_0x75cd('0x34')]=_[_0x75cd('0x33')](_0x5f0387['model'],qs['fields'](_0xb69958['query'][_0x75cd('0x35')]));_0x40a307['attributes']=_0x40a307[_0x75cd('0x34')][_0x75cd('0x46')]?_0x40a307[_0x75cd('0x34')]:_0x5f0387['model'];if(_0xb69958[_0x75cd('0x30')][_0x75cd('0x41')]){_0x40a307[_0x75cd('0x42')]=[{'all':!![]}];}_0x40a307=_['merge']({},_0x40a307,_0xb69958[_0x75cd('0x3f')]);return db[_0x75cd('0x40')][_0x75cd('0x47')](_0x40a307)[_0x75cd('0x28')](handleEntityNotFound(_0x434af8,null))[_0x75cd('0x28')](respondWithResult(_0x434af8,null))[_0x75cd('0x48')](handleError(_0x434af8,null));};exports[_0x75cd('0x49')]=function(_0x5e1bd6,_0x2c7329){return db[_0x75cd('0x40')][_0x75cd('0x49')](_0x5e1bd6[_0x75cd('0x4a')],{})[_0x75cd('0x28')](respondWithResult(_0x2c7329,0xc9))['catch'](handleError(_0x2c7329,null));};exports[_0x75cd('0x27')]=function(_0x429543,_0x100f13){if(_0x429543['body']['id']){delete _0x429543[_0x75cd('0x4a')]['id'];}return db[_0x75cd('0x40')][_0x75cd('0x47')]({'where':{'id':_0x429543[_0x75cd('0x4b')]['id']}})[_0x75cd('0x28')](handleEntityNotFound(_0x100f13,null))[_0x75cd('0x28')](saveUpdates(_0x429543[_0x75cd('0x4a')],null))[_0x75cd('0x28')](respondWithResult(_0x100f13,null))[_0x75cd('0x48')](handleError(_0x100f13,null));};exports[_0x75cd('0x4c')]=function(_0x3e71af,_0x1eac8a){return db[_0x75cd('0x40')]['find']({'where':{'id':_0x3e71af[_0x75cd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1eac8a,null))['then'](removeEntity(_0x1eac8a,null))['catch'](handleError(_0x1eac8a,null));};exports['describe']=function(_0x3132f0,_0x4066fb){return db[_0x75cd('0x40')][_0x75cd('0x4d')]()[_0x75cd('0x28')](respondWithResult(_0x4066fb,null))[_0x75cd('0x48')](handleError(_0x4066fb,null));};exports[_0x75cd('0x4e')]=function(_0x58916b,_0x5d509d){var _0x482c76={},_0xc577bd={},_0x397580={'count':0x0,'rows':[]};_0xc577bd['model']=_[_0x75cd('0x31')](db[_0x75cd('0x40')][_0x75cd('0x2c')]);_0xc577bd[_0x75cd('0x30')]=_['keys'](_0x58916b['query']);_0xc577bd[_0x75cd('0x32')]=_[_0x75cd('0x33')](_0xc577bd[_0x75cd('0x2f')],_0xc577bd['query']);_0x482c76['attributes']=_[_0x75cd('0x33')](_0xc577bd[_0x75cd('0x2f')],qs[_0x75cd('0x35')](_0x58916b['query'][_0x75cd('0x35')]));_0x482c76[_0x75cd('0x34')]=_0x482c76[_0x75cd('0x34')][_0x75cd('0x46')]?_0x482c76[_0x75cd('0x34')]:_0xc577bd['model'];if(!_0x58916b[_0x75cd('0x30')][_0x75cd('0x36')]('nolimit')){_0x482c76[_0x75cd('0x24')]=qs[_0x75cd('0x24')](_0x58916b['query'][_0x75cd('0x24')]);_0x482c76[_0x75cd('0x21')]=qs[_0x75cd('0x21')](_0x58916b[_0x75cd('0x30')][_0x75cd('0x21')]);}_0x482c76['order']=qs[_0x75cd('0x39')](_0x58916b['query'][_0x75cd('0x39')]);_0x482c76[_0x75cd('0x3a')]=qs[_0x75cd('0x32')](_[_0x75cd('0x3b')](_0x58916b[_0x75cd('0x30')],_0xc577bd[_0x75cd('0x32')]));if(_0x58916b[_0x75cd('0x30')][_0x75cd('0x3c')]){_0x482c76['where']=_['merge'](_0x482c76[_0x75cd('0x3a')],{'$or':_[_0x75cd('0x4f')](_0x482c76[_0x75cd('0x34')],function(_0x3fb502){var _0x45b1fb={};_0x45b1fb[_0x3fb502]={'$like':'%'+_0x58916b[_0x75cd('0x30')][_0x75cd('0x3c')]+'%'};return _0x45b1fb;})});}_0x482c76=_['merge']({},_0x482c76,_0x58916b[_0x75cd('0x3f')]);var _0x27c23a={'where':_0x482c76[_0x75cd('0x3a')]};return db['VoiceQueueReport'][_0x75cd('0x23')](_0x27c23a)[_0x75cd('0x28')](function(_0x50a29a){_0x397580[_0x75cd('0x23')]=_0x50a29a;if(_0x58916b['query'][_0x75cd('0x41')]){_0x482c76[_0x75cd('0x42')]=[{'all':!![]}];}return db[_0x75cd('0x40')]['findAll'](_0x482c76);})[_0x75cd('0x28')](function(_0x5c32e4){_0x397580[_0x75cd('0x44')]=_0x5c32e4;return _0x397580;})[_0x75cd('0x28')](respondWithFilteredResult(_0x5d509d,_0x482c76,_0x75cd('0x4e')))[_0x75cd('0x48')](handleError(_0x5d509d,null,_0x75cd('0x4e')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index aad14d5..123f875 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 _0x4c6c=['hook','exports','events','VoiceQueueReport','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x2e4fc0,_0x357302){var _0xee288=function(_0x12db53){while(--_0x12db53){_0x2e4fc0['push'](_0x2e4fc0['shift']());}};_0xee288(++_0x357302);}(_0x4c6c,0x1ea));var _0xc4c6=function(_0x471db6,_0x59aa0d){_0x471db6=_0x471db6-0x0;var _0x2d98b3=_0x4c6c[_0x471db6];return _0x2d98b3;};'use strict';var EventEmitter=require(_0xc4c6('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xc4c6('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xc4c6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc4c6('0x3')};function emitEvent(_0x3b9912){return function(_0x312008,_0x24db48,_0x237065){VoiceQueueReportEvents['emit'](_0x3b9912+':'+_0x312008['id'],_0x312008);VoiceQueueReportEvents[_0xc4c6('0x4')](_0x3b9912,_0x312008);_0x237065(null);};}for(var e in events){if(events[_0xc4c6('0x5')](e)){var event=events[e];VoiceQueueReport[_0xc4c6('0x6')](e,emitEvent(event));}}module[_0xc4c6('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xf51a=['save','update','remove','hasOwnProperty','hook','exports','setMaxListeners'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xf51a,0x195));var _0xaf51=function(_0x14cac6,_0x31d89d){_0x14cac6=_0x14cac6-0x0;var _0x311ef0=_0xf51a[_0x14cac6];return _0x311ef0;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xaf51('0x0')](0x0);var events={'afterCreate':_0xaf51('0x1'),'afterUpdate':_0xaf51('0x2'),'afterDestroy':_0xaf51('0x3')};function emitEvent(_0x19fa1a){return function(_0x47ddbf,_0x2852b7,_0x2ef814){VoiceQueueReportEvents['emit'](_0x19fa1a+':'+_0x47ddbf['id'],_0x47ddbf);VoiceQueueReportEvents['emit'](_0x19fa1a,_0x47ddbf);_0x2ef814(null);};}for(var e in events){if(events[_0xaf51('0x4')](e)){var event=events[e];VoiceQueueReport[_0xaf51('0x5')](e,emitEvent(event));}}module[_0xaf51('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index ede22b0..96f8e99 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 _0xea2b=['moment','bluebird','request-promise','path','rimraf','exports','define','VoiceQueueReport','report_queue','calleridnum','lodash','util','../../config/logger'];(function(_0x489ba5,_0xa1a03c){var _0x3727e9=function(_0x53613e){while(--_0x53613e){_0x489ba5['push'](_0x489ba5['shift']());}};_0x3727e9(++_0xa1a03c);}(_0xea2b,0x1de));var _0xbea2=function(_0x203f03,_0x33aafc){_0x203f03=_0x203f03-0x0;var _0x28879a=_0xea2b[_0x203f03];return _0x28879a;};'use strict';var _=require(_0xbea2('0x0'));var util=require(_0xbea2('0x1'));var logger=require(_0xbea2('0x2'))('api');var moment=require(_0xbea2('0x3'));var BPromise=require(_0xbea2('0x4'));var rp=require(_0xbea2('0x5'));var fs=require('fs');var path=require(_0xbea2('0x6'));var rimraf=require(_0xbea2('0x7'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0xbea2('0x8')]=function(_0x5f37d2,_0x20927a){return _0x5f37d2[_0xbea2('0x9')](_0xbea2('0xa'),attributes,{'tableName':_0xbea2('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xbea2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b8d=['api','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','report_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x0b8d,0xbd));var _0xd0b8=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x0b8d[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0xd0b8('0x0'));var util=require(_0xd0b8('0x1'));var logger=require(_0xd0b8('0x2'))(_0xd0b8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd0b8('0x4'));var fs=require('fs');var path=require(_0xd0b8('0x5'));var rimraf=require(_0xd0b8('0x6'));var config=require(_0xd0b8('0x7'));var attributes=require(_0xd0b8('0x8'));module[_0xd0b8('0x9')]=function(_0x820540,_0x3bf19d){return _0x820540['define']('VoiceQueueReport',attributes,{'tableName':_0xd0b8('0xa'),'paranoid':![],'indexes':[{'fields':[_0xd0b8('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 7bfa650..6270f6a 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 _0xf933=['then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','debug','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','where','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults','./voiceQueueReport.socket','register'];(function(_0x15b082,_0x591c06){var _0x5522cd=function(_0x4039f7){while(--_0x4039f7){_0x15b082['push'](_0x15b082['shift']());}};_0x5522cd(++_0x591c06);}(_0xf933,0x1a0));var _0x3f93=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0xf933[_0x162780];return _0x1ea2dc;};'use strict';var _=require(_0x3f93('0x0'));var util=require(_0x3f93('0x1'));var moment=require(_0x3f93('0x2'));var BPromise=require(_0x3f93('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f93('0x4'))['db'];var utils=require(_0x3f93('0x5'));var logger=require('../../config/logger')(_0x3f93('0x6'));var config=require(_0x3f93('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3f93('0x8')]({'port':0x232a});config[_0x3f93('0x9')]=_[_0x3f93('0xa')](config[_0x3f93('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f93('0x9')]));require(_0x3f93('0xb'))[_0x3f93('0xc')](socket);function respondWithRpcPromise(_0x1c522f,_0x378542,_0x60b4eb){return new BPromise(function(_0x190141,_0x639b75){return client['request'](_0x1c522f,_0x60b4eb)[_0x3f93('0xd')](function(_0x2b2f18){logger[_0x3f93('0xe')](_0x3f93('0xf'),_0x378542,_0x3f93('0x10'));logger['debug'](_0x3f93('0x11'),_0x378542,_0x3f93('0x10'),JSON[_0x3f93('0x12')](_0x2b2f18));if(_0x2b2f18['error']){if(_0x2b2f18[_0x3f93('0x13')][_0x3f93('0x14')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x378542,_0x2b2f18['error'][_0x3f93('0x15')]);return _0x639b75(_0x2b2f18['error'][_0x3f93('0x15')]);}logger[_0x3f93('0x13')](_0x3f93('0xf'),_0x378542,_0x2b2f18[_0x3f93('0x13')]['message']);return _0x190141(_0x2b2f18[_0x3f93('0x13')][_0x3f93('0x15')]);}else{logger[_0x3f93('0xe')]('VoiceQueueReport,\x20%s,\x20%s',_0x378542,_0x3f93('0x10'));_0x190141(_0x2b2f18[_0x3f93('0x16')][_0x3f93('0x15')]);}})[_0x3f93('0x17')](function(_0x1726e9){logger[_0x3f93('0x13')](_0x3f93('0xf'),_0x378542,_0x1726e9);_0x639b75(_0x1726e9);});});}exports[_0x3f93('0x18')]=function(_0x4e5820){var _0x3af0e0=this;return new Promise(function(_0xe9bc89,_0x2d7dec){return db[_0x3f93('0x19')][_0x3f93('0x1a')]({'raw':_0x4e5820[_0x3f93('0x1b')]?_0x4e5820['options'][_0x3f93('0x1c')]===undefined?!![]:![]:!![],'where':_0x4e5820['options']?_0x4e5820['options']['where']||null:null,'attributes':_0x4e5820[_0x3f93('0x1b')]?_0x4e5820[_0x3f93('0x1b')][_0x3f93('0x1d')]||null:null,'limit':_0x4e5820[_0x3f93('0x1b')]?_0x4e5820['options'][_0x3f93('0x1e')]||null:null,'include':_0x4e5820[_0x3f93('0x1b')]?_0x4e5820[_0x3f93('0x1b')][_0x3f93('0x1f')]?_['map'](_0x4e5820[_0x3f93('0x1b')][_0x3f93('0x1f')],function(_0xa18089){return{'model':db[_0xa18089['model']],'as':_0xa18089['as'],'attributes':_0xa18089[_0x3f93('0x1d')],'include':_0xa18089[_0x3f93('0x1f')]?_['map'](_0xa18089[_0x3f93('0x1f')],function(_0x4b6aa8){return{'model':db[_0x4b6aa8['model']],'as':_0x4b6aa8['as'],'attributes':_0x4b6aa8[_0x3f93('0x1d')],'include':_0x4b6aa8[_0x3f93('0x1f')]?_[_0x3f93('0x20')](_0x4b6aa8[_0x3f93('0x1f')],function(_0xeffcca){return{'model':db[_0xeffcca[_0x3f93('0x21')]],'as':_0xeffcca['as'],'attributes':_0xeffcca['attributes']};}):[]};}):[]};}):[]:[]})[_0x3f93('0xd')](function(_0x4673eb){logger[_0x3f93('0xe')](_0x3f93('0x18'),_0x4e5820);logger[_0x3f93('0x22')](_0x3f93('0x18'),_0x4e5820,JSON[_0x3f93('0x12')](_0x4673eb));_0xe9bc89(_0x4673eb);})[_0x3f93('0x17')](function(_0x485130){logger[_0x3f93('0x13')]('GetVoiceQueueReport',_0x485130['message'],_0x4e5820);_0x2d7dec(_0x3af0e0[_0x3f93('0x13')](0x1f4,_0x485130[_0x3f93('0x15')]));});});};exports[_0x3f93('0x23')]=function(_0x50615c){var _0x49fc23=this;return new Promise(function(_0x58a3d6,_0x2c482b){return db['VoiceQueueReport'][_0x3f93('0x24')](_0x50615c['body'],{'raw':_0x50615c[_0x3f93('0x1b')]?_0x50615c[_0x3f93('0x1b')][_0x3f93('0x1c')]===undefined?!![]:![]:!![]})[_0x3f93('0xd')](function(_0x44a0a9){logger['info'](_0x3f93('0x23'),_0x50615c);logger['debug']('CreateVoiceQueueReport',_0x50615c,JSON[_0x3f93('0x12')](_0x44a0a9));_0x58a3d6(_0x44a0a9);})[_0x3f93('0x17')](function(_0x59f7f7){logger[_0x3f93('0x13')](_0x3f93('0x23'),_0x59f7f7[_0x3f93('0x15')],_0x50615c);_0x2c482b(_0x49fc23[_0x3f93('0x13')](0x1f4,_0x59f7f7[_0x3f93('0x15')]));});});};exports[_0x3f93('0x25')]=function(_0x58b727){var _0x2c44aa=this;return new Promise(function(_0x316c55,_0x46f177){return db[_0x3f93('0x19')]['update'](_0x58b727['body'],{'raw':_0x58b727[_0x3f93('0x1b')]?_0x58b727[_0x3f93('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58b727['options']?_0x58b727['options'][_0x3f93('0x26')]||null:null,'attributes':_0x58b727[_0x3f93('0x1b')]?_0x58b727[_0x3f93('0x1b')][_0x3f93('0x1d')]||null:null,'limit':_0x58b727[_0x3f93('0x1b')]?_0x58b727[_0x3f93('0x1b')]['limit']||null:null})[_0x3f93('0xd')](function(_0x33a6b9){logger[_0x3f93('0xe')]('UpdateVoiceQueueReport',_0x58b727);logger['debug']('UpdateVoiceQueueReport',_0x58b727,JSON[_0x3f93('0x12')](_0x33a6b9));_0x316c55(_0x33a6b9);})['catch'](function(_0x5cbd14){logger[_0x3f93('0x13')](_0x3f93('0x25'),_0x5cbd14[_0x3f93('0x15')],_0x58b727);_0x46f177(_0x2c44aa[_0x3f93('0x13')](0x1f4,_0x5cbd14[_0x3f93('0x15')]));});});}; \ No newline at end of file +var _0x54d3=['request','then','VoiceQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','limit','include','model','attributes','map','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./voiceQueueReport.socket'];(function(_0x5c6469,_0x54afe8){var _0x4a85d0=function(_0x668156){while(--_0x668156){_0x5c6469['push'](_0x5c6469['shift']());}};_0x4a85d0(++_0x54afe8);}(_0x54d3,0x6b));var _0x354d=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x54d3[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x354d('0x0'));var util=require(_0x354d('0x1'));var moment=require(_0x354d('0x2'));var BPromise=require(_0x354d('0x3'));var rs=require(_0x354d('0x4'));var fs=require('fs');var Redis=require(_0x354d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x354d('0x6'));var logger=require(_0x354d('0x7'))(_0x354d('0x8'));var config=require(_0x354d('0x9'));var jayson=require(_0x354d('0xa'));var client=jayson['client'][_0x354d('0xb')]({'port':0x232a});config[_0x354d('0xc')]=_[_0x354d('0xd')](config[_0x354d('0xc')],{'host':_0x354d('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x354d('0xc')]));require(_0x354d('0xf'))['register'](socket);function respondWithRpcPromise(_0x125b46,_0x457274,_0xfcbe0d){return new BPromise(function(_0x8fa5a8,_0x39be32){return client[_0x354d('0x10')](_0x125b46,_0xfcbe0d)[_0x354d('0x11')](function(_0x8ce607){logger['info'](_0x354d('0x12'),_0x457274,'request\x20sent');logger[_0x354d('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x457274,_0x354d('0x14'),JSON[_0x354d('0x15')](_0x8ce607));if(_0x8ce607['error']){if(_0x8ce607['error'][_0x354d('0x16')]===0x1f4){logger[_0x354d('0x17')](_0x354d('0x12'),_0x457274,_0x8ce607['error'][_0x354d('0x18')]);return _0x39be32(_0x8ce607[_0x354d('0x17')][_0x354d('0x18')]);}logger[_0x354d('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x457274,_0x8ce607[_0x354d('0x17')][_0x354d('0x18')]);return _0x8fa5a8(_0x8ce607[_0x354d('0x17')]['message']);}else{logger[_0x354d('0x19')](_0x354d('0x12'),_0x457274,_0x354d('0x14'));_0x8fa5a8(_0x8ce607[_0x354d('0x1a')][_0x354d('0x18')]);}})[_0x354d('0x1b')](function(_0x4979dc){logger['error'](_0x354d('0x12'),_0x457274,_0x4979dc);_0x39be32(_0x4979dc);});});}exports[_0x354d('0x1c')]=function(_0x46196a){var _0x18295b=this;return new Promise(function(_0x5dd830,_0x119914){return db[_0x354d('0x1d')]['findAll']({'raw':_0x46196a[_0x354d('0x1e')]?_0x46196a[_0x354d('0x1e')][_0x354d('0x1f')]===undefined?!![]:![]:!![],'where':_0x46196a[_0x354d('0x1e')]?_0x46196a[_0x354d('0x1e')][_0x354d('0x20')]||null:null,'attributes':_0x46196a[_0x354d('0x1e')]?_0x46196a[_0x354d('0x1e')]['attributes']||null:null,'limit':_0x46196a[_0x354d('0x1e')]?_0x46196a[_0x354d('0x1e')][_0x354d('0x21')]||null:null,'include':_0x46196a[_0x354d('0x1e')]?_0x46196a[_0x354d('0x1e')][_0x354d('0x22')]?_['map'](_0x46196a[_0x354d('0x1e')][_0x354d('0x22')],function(_0x576967){return{'model':db[_0x576967[_0x354d('0x23')]],'as':_0x576967['as'],'attributes':_0x576967[_0x354d('0x24')],'include':_0x576967[_0x354d('0x22')]?_[_0x354d('0x25')](_0x576967[_0x354d('0x22')],function(_0x331ac8){return{'model':db[_0x331ac8[_0x354d('0x23')]],'as':_0x331ac8['as'],'attributes':_0x331ac8[_0x354d('0x24')],'include':_0x331ac8[_0x354d('0x22')]?_[_0x354d('0x25')](_0x331ac8['include'],function(_0x41c3cb){return{'model':db[_0x41c3cb['model']],'as':_0x41c3cb['as'],'attributes':_0x41c3cb[_0x354d('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c298d){logger['info'](_0x354d('0x1c'),_0x46196a);logger[_0x354d('0x13')](_0x354d('0x1c'),_0x46196a,JSON['stringify'](_0x5c298d));_0x5dd830(_0x5c298d);})['catch'](function(_0x12c62c){logger['error'](_0x354d('0x1c'),_0x12c62c[_0x354d('0x18')],_0x46196a);_0x119914(_0x18295b[_0x354d('0x17')](0x1f4,_0x12c62c[_0x354d('0x18')]));});});};exports[_0x354d('0x26')]=function(_0x250664){var _0x2538b0=this;return new Promise(function(_0x406fcf,_0x1a81fd){return db[_0x354d('0x1d')]['create'](_0x250664[_0x354d('0x27')],{'raw':_0x250664[_0x354d('0x1e')]?_0x250664[_0x354d('0x1e')][_0x354d('0x1f')]===undefined?!![]:![]:!![]})[_0x354d('0x11')](function(_0x1e8227){logger[_0x354d('0x19')](_0x354d('0x26'),_0x250664);logger[_0x354d('0x13')]('CreateVoiceQueueReport',_0x250664,JSON[_0x354d('0x15')](_0x1e8227));_0x406fcf(_0x1e8227);})[_0x354d('0x1b')](function(_0x573bd0){logger[_0x354d('0x17')]('CreateVoiceQueueReport',_0x573bd0[_0x354d('0x18')],_0x250664);_0x1a81fd(_0x2538b0['error'](0x1f4,_0x573bd0[_0x354d('0x18')]));});});};exports[_0x354d('0x28')]=function(_0x4bbd83){var _0x283c7c=this;return new Promise(function(_0x12d21c,_0x17e499){return db[_0x354d('0x1d')]['update'](_0x4bbd83['body'],{'raw':_0x4bbd83[_0x354d('0x1e')]?_0x4bbd83['options'][_0x354d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bbd83[_0x354d('0x1e')]?_0x4bbd83[_0x354d('0x1e')][_0x354d('0x20')]||null:null,'attributes':_0x4bbd83['options']?_0x4bbd83[_0x354d('0x1e')]['attributes']||null:null,'limit':_0x4bbd83[_0x354d('0x1e')]?_0x4bbd83[_0x354d('0x1e')][_0x354d('0x21')]||null:null})[_0x354d('0x11')](function(_0x3cbfef){logger[_0x354d('0x19')](_0x354d('0x28'),_0x4bbd83);logger[_0x354d('0x13')](_0x354d('0x28'),_0x4bbd83,JSON[_0x354d('0x15')](_0x3cbfef));_0x12d21c(_0x3cbfef);})[_0x354d('0x1b')](function(_0x278396){logger[_0x354d('0x17')](_0x354d('0x28'),_0x278396[_0x354d('0x18')],_0x4bbd83);_0x17e499(_0x283c7c['error'](0x1f4,_0x278396[_0x354d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index c1f9d61..1d46c34 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 _0x65ac=['save','remove','update','emit','removeListener','register','length','voiceQueueReport:'];(function(_0x51c179,_0x4b6dc1){var _0x48f84f=function(_0x11d43f){while(--_0x11d43f){_0x51c179['push'](_0x51c179['shift']());}};_0x48f84f(++_0x4b6dc1);}(_0x65ac,0x100));var _0xc65a=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x65ac[_0x5608a3];return _0x1ed50a;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xc65a('0x0'),_0xc65a('0x1'),_0xc65a('0x2')];function createListener(_0x513bbe,_0x33fbff){return function(_0x4ac309){_0x33fbff[_0xc65a('0x3')](_0x513bbe,_0x4ac309);};}function removeListener(_0x5d98ec,_0x3d84d6){return function(){VoiceQueueReportEvents[_0xc65a('0x4')](_0x5d98ec,_0x3d84d6);};}exports[_0xc65a('0x5')]=function(_0x25abc5){for(var _0x979e5b=0x0,_0x34e48b=events[_0xc65a('0x6')];_0x979e5b<_0x34e48b;_0x979e5b++){var _0x1cbea3=events[_0x979e5b];var _0x29d016=createListener(_0xc65a('0x7')+_0x1cbea3,_0x25abc5);VoiceQueueReportEvents['on'](_0x1cbea3,_0x29d016);}}; \ No newline at end of file +var _0x1de4=['emit','removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x37c788,_0x22f870){var _0x5be845=function(_0x4835aa){while(--_0x4835aa){_0x37c788['push'](_0x37c788['shift']());}};_0x5be845(++_0x22f870);}(_0x1de4,0x94));var _0x41de=function(_0x2b7442,_0x561591){_0x2b7442=_0x2b7442-0x0;var _0x56e035=_0x1de4[_0x2b7442];return _0x56e035;};'use strict';var VoiceQueueReportEvents=require(_0x41de('0x0'));var events=[_0x41de('0x1'),_0x41de('0x2'),_0x41de('0x3')];function createListener(_0x4aafae,_0x35b505){return function(_0x43c48c){_0x35b505[_0x41de('0x4')](_0x4aafae,_0x43c48c);};}function removeListener(_0x5dd1cb,_0x378cbe){return function(){VoiceQueueReportEvents[_0x41de('0x5')](_0x5dd1cb,_0x378cbe);};}exports['register']=function(_0x2e7196){for(var _0x122565=0x0,_0x2f1078=events[_0x41de('0x6')];_0x122565<_0x2f1078;_0x122565++){var _0x50f716=events[_0x122565];var _0x4c292c=createListener(_0x41de('0x7')+_0x50f716,_0x2e7196);VoiceQueueReportEvents['on'](_0x50f716,_0x4c292c);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index af5cac8..a4b3a61 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 _0x953e=['index','/:id','isAuthenticated','show','post','create','put','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get'];(function(_0x552dc3,_0x475401){var _0x495c3a=function(_0x55827d){while(--_0x55827d){_0x552dc3['push'](_0x552dc3['shift']());}};_0x495c3a(++_0x475401);}(_0x953e,0xc6));var _0xe953=function(_0x1cf1cd,_0x3677b4){_0x1cf1cd=_0x1cf1cd-0x0;var _0x2682ae=_0x953e[_0x1cf1cd];return _0x2682ae;};'use strict';var multer=require(_0xe953('0x0'));var util=require(_0xe953('0x1'));var path=require(_0xe953('0x2'));var timeout=require(_0xe953('0x3'));var express=require(_0xe953('0x4'));var router=express['Router']();var fs_extra=require(_0xe953('0x5'));var auth=require(_0xe953('0x6'));var interaction=require(_0xe953('0x7'));var config=require(_0xe953('0x8'));var controller=require(_0xe953('0x9'));router[_0xe953('0xa')]('/',auth['isAuthenticated'](),controller[_0xe953('0xb')]);router[_0xe953('0xa')](_0xe953('0xc'),auth[_0xe953('0xd')](),controller[_0xe953('0xe')]);router[_0xe953('0xf')]('/',auth[_0xe953('0xd')](),controller[_0xe953('0x10')]);router[_0xe953('0x11')](_0xe953('0xc'),auth[_0xe953('0xd')](),controller['update']);router['delete'](_0xe953('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xe953('0x12')]=router; \ No newline at end of file +var _0x3eec=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','show'];(function(_0x36385b,_0x429635){var _0x409886=function(_0x33bfa3){while(--_0x33bfa3){_0x36385b['push'](_0x36385b['shift']());}};_0x409886(++_0x429635);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x1527a3,_0x1bbee8){_0x1527a3=_0x1527a3-0x0;var _0x2634c0=_0x3eec[_0x1527a3];return _0x2634c0;};'use strict';var multer=require(_0xc3ee('0x0'));var util=require(_0xc3ee('0x1'));var path=require(_0xc3ee('0x2'));var timeout=require(_0xc3ee('0x3'));var express=require('express');var router=express[_0xc3ee('0x4')]();var fs_extra=require(_0xc3ee('0x5'));var auth=require(_0xc3ee('0x6'));var interaction=require(_0xc3ee('0x7'));var config=require(_0xc3ee('0x8'));var controller=require(_0xc3ee('0x9'));router['get']('/',auth[_0xc3ee('0xa')](),controller[_0xc3ee('0xb')]);router[_0xc3ee('0xc')](_0xc3ee('0xd'),auth[_0xc3ee('0xa')](),controller[_0xc3ee('0xe')]);router[_0xc3ee('0xf')]('/',auth[_0xc3ee('0xa')](),controller[_0xc3ee('0x10')]);router[_0xc3ee('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc3ee('0x12')]);router[_0xc3ee('0x13')](_0xc3ee('0xd'),auth[_0xc3ee('0xa')](),controller['destroy']);module[_0xc3ee('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 8092267..7c8f1b9 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 _0x76d3=['format','moment','exports','STRING','DATE'];(function(_0xcd5c68,_0x6fa052){var _0x199cdc=function(_0xe6f040){while(--_0xe6f040){_0xcd5c68['push'](_0xcd5c68['shift']());}};_0x199cdc(++_0x6fa052);}(_0x76d3,0x12d));var _0x376d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x76d3[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x376d('0x0'));module[_0x376d('0x1')]={'time':{'type':Sequelize[_0x376d('0x2')]},'callid':{'type':Sequelize[_0x376d('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x376d('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x376d('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x376d('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x376d('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x376d('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x376d('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x376d('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x376d('0x3')],'allowNull':![],'defaultValue':moment()[_0x376d('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0xef4e=['DATE','format','sequelize','moment','exports','STRING'];(function(_0x1e744a,_0xa8fdb1){var _0x1ac4d0=function(_0x13a75d){while(--_0x13a75d){_0x1e744a['push'](_0x1e744a['shift']());}};_0x1ac4d0(++_0xa8fdb1);}(_0xef4e,0xc2));var _0xeef4=function(_0x4f9b3a,_0x4b31a2){_0x4f9b3a=_0x4f9b3a-0x0;var _0x10cb16=_0xef4e[_0x4f9b3a];return _0x10cb16;};'use strict';var Sequelize=require(_0xeef4('0x0'));var moment=require(_0xeef4('0x1'));module[_0xeef4('0x2')]={'time':{'type':Sequelize[_0xeef4('0x3')]},'callid':{'type':Sequelize[_0xeef4('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xeef4('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xeef4('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xeef4('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xeef4('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xeef4('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xeef4('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xeef4('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xeef4('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xeef4('0x4')],'allowNull':![],'defaultValue':moment()[_0xeef4('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 97a9936..354b83c 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 _0xea65=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','intersection','options','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x535dcf,_0x2b22d0){var _0x18fcae=function(_0x55cbba){while(--_0x55cbba){_0x535dcf['push'](_0x535dcf['shift']());}};_0x18fcae(++_0x2b22d0);}(_0xea65,0x11b));var _0x5ea6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xea65[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x5ea6('0x0'));var rimraf=require(_0x5ea6('0x1'));var zipdir=require(_0x5ea6('0x2'));var jsonpatch=require(_0x5ea6('0x3'));var rp=require('request-promise');var moment=require(_0x5ea6('0x4'));var BPromise=require(_0x5ea6('0x5'));var Mustache=require(_0x5ea6('0x6'));var util=require(_0x5ea6('0x7'));var path=require(_0x5ea6('0x8'));var sox=require('sox');var csv=require(_0x5ea6('0x9'));var ejs=require(_0x5ea6('0xa'));var fs=require('fs');var fs_extra=require(_0x5ea6('0xb'));var _=require(_0x5ea6('0xc'));var squel=require(_0x5ea6('0xd'));var crypto=require(_0x5ea6('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5ea6('0x9'));var querystring=require(_0x5ea6('0xf'));var Papa=require(_0x5ea6('0x10'));var Redis=require('ioredis');var authService=require(_0x5ea6('0x11'));var qs=require(_0x5ea6('0x12'));var as=require(_0x5ea6('0x13'));var hardwareService=require(_0x5ea6('0x14'));var logger=require(_0x5ea6('0x15'))(_0x5ea6('0x16'));var utils=require(_0x5ea6('0x17'));var config=require(_0x5ea6('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4649cf,_0x29bb5d){_0x29bb5d=_0x29bb5d||0xcc;return function(_0x1b64ef){if(_0x1b64ef){return _0x4649cf['sendStatus'](_0x29bb5d);}return _0x4649cf['status'](_0x29bb5d)[_0x5ea6('0x19')]();};}function respondWithResult(_0x3363b9,_0x37929c){_0x37929c=_0x37929c||0xc8;return function(_0x243ce3){if(_0x243ce3){return _0x3363b9[_0x5ea6('0x1a')](_0x37929c)[_0x5ea6('0x1b')](_0x243ce3);}};}function respondWithFilteredResult(_0x47511f,_0x2d81e5){return function(_0x3782d0){if(_0x3782d0){var _0x2e15c4=typeof _0x2d81e5[_0x5ea6('0x1c')]===_0x5ea6('0x1d')&&typeof _0x2d81e5[_0x5ea6('0x1e')]===_0x5ea6('0x1d');var _0x30dde1=_0x3782d0[_0x5ea6('0x1f')];var _0x31186f=_0x2e15c4?0x0:_0x2d81e5[_0x5ea6('0x1c')];var _0x5df2be=_0x2e15c4?_0x3782d0[_0x5ea6('0x1f')]:_0x2d81e5[_0x5ea6('0x1c')]+_0x2d81e5[_0x5ea6('0x1e')];var _0x5e90e5;if(_0x5df2be>=_0x30dde1){_0x5df2be=_0x30dde1;_0x5e90e5=0xc8;}else{_0x5e90e5=0xce;}_0x47511f['status'](_0x5e90e5);return _0x47511f[_0x5ea6('0x20')]('Content-Range',_0x31186f+'-'+_0x5df2be+'/'+_0x30dde1)[_0x5ea6('0x1b')](_0x3782d0);}return null;};}function patchUpdates(_0x2ba00e){return function(_0x5628eb){try{jsonpatch[_0x5ea6('0x21')](_0x5628eb,_0x2ba00e,!![]);}catch(_0x446011){return BPromise['reject'](_0x446011);}return _0x5628eb[_0x5ea6('0x22')]();};}function saveUpdates(_0x2008fb,_0x47617d){return function(_0x9159b8){if(_0x9159b8){return _0x9159b8[_0x5ea6('0x23')](_0x2008fb)[_0x5ea6('0x24')](function(_0x39362f){return _0x39362f;});}return null;};}function removeEntity(_0x15d3b2,_0x507b6a){return function(_0x32198e){if(_0x32198e){return _0x32198e[_0x5ea6('0x25')]()[_0x5ea6('0x24')](function(){_0x15d3b2[_0x5ea6('0x1a')](0xcc)[_0x5ea6('0x19')]();});}};}function handleEntityNotFound(_0x335c5c,_0x270987){return function(_0x49840c){if(!_0x49840c){_0x335c5c['sendStatus'](0x194);}return _0x49840c;};}function handleError(_0x3bcac5,_0x414399){_0x414399=_0x414399||0x1f4;return function(_0x586657){logger[_0x5ea6('0x26')](_0x586657[_0x5ea6('0x27')]);if(_0x586657[_0x5ea6('0x28')]){delete _0x586657[_0x5ea6('0x28')];}_0x3bcac5[_0x5ea6('0x1a')](_0x414399)['send'](_0x586657);};}exports[_0x5ea6('0x29')]=function(_0xb9693d,_0x136089){var _0x26f6d8={},_0x191d37={},_0x4eb69b={'count':0x0,'rows':[]};var _0x47829a=_[_0x5ea6('0x2a')](db[_0x5ea6('0x2b')][_0x5ea6('0x2c')],function(_0x3e98cf){return{'name':_0x3e98cf[_0x5ea6('0x2d')],'type':_0x3e98cf[_0x5ea6('0x2e')][_0x5ea6('0x2f')]};});_0x191d37[_0x5ea6('0x30')]=_[_0x5ea6('0x2a')](_0x47829a,_0x5ea6('0x28'));_0x191d37[_0x5ea6('0x31')]=_[_0x5ea6('0x32')](_0xb9693d[_0x5ea6('0x31')]);_0x191d37[_0x5ea6('0x33')]=_['intersection'](_0x191d37[_0x5ea6('0x30')],_0x191d37[_0x5ea6('0x31')]);_0x26f6d8[_0x5ea6('0x34')]=_['intersection'](_0x191d37[_0x5ea6('0x30')],qs['fields'](_0xb9693d[_0x5ea6('0x31')][_0x5ea6('0x35')]));_0x26f6d8[_0x5ea6('0x34')]=_0x26f6d8[_0x5ea6('0x34')][_0x5ea6('0x36')]?_0x26f6d8['attributes']:_0x191d37[_0x5ea6('0x30')];if(!_0xb9693d[_0x5ea6('0x31')]['hasOwnProperty'](_0x5ea6('0x37'))){_0x26f6d8[_0x5ea6('0x1e')]=qs[_0x5ea6('0x1e')](_0xb9693d[_0x5ea6('0x31')]['limit']);_0x26f6d8['offset']=qs[_0x5ea6('0x1c')](_0xb9693d[_0x5ea6('0x31')]['offset']);}_0x26f6d8[_0x5ea6('0x38')]=qs[_0x5ea6('0x39')](_0xb9693d[_0x5ea6('0x31')][_0x5ea6('0x39')]);_0x26f6d8[_0x5ea6('0x3a')]=qs['filters'](_['pick'](_0xb9693d[_0x5ea6('0x31')],_0x191d37['filters']),_0x47829a);if(_0xb9693d[_0x5ea6('0x31')][_0x5ea6('0x3b')]){_0x26f6d8[_0x5ea6('0x3a')]=_[_0x5ea6('0x3c')](_0x26f6d8[_0x5ea6('0x3a')],{'$or':_[_0x5ea6('0x2a')](_0x47829a,function(_0x257ee6){if(_0x257ee6[_0x5ea6('0x2e')]!==_0x5ea6('0x3d')){var _0x5a0aa3={};_0x5a0aa3[_0x257ee6[_0x5ea6('0x28')]]={'$like':'%'+_0xb9693d['query'][_0x5ea6('0x3b')]+'%'};return _0x5a0aa3;}})});}_0x26f6d8=_['merge']({},_0x26f6d8,_0xb9693d['options']);var _0x16fa40={'where':_0x26f6d8['where']};return db[_0x5ea6('0x2b')][_0x5ea6('0x1f')](_0x16fa40)[_0x5ea6('0x24')](function(_0x3e594a){_0x4eb69b[_0x5ea6('0x1f')]=_0x3e594a;if(_0xb9693d[_0x5ea6('0x31')][_0x5ea6('0x3e')]){_0x26f6d8[_0x5ea6('0x3f')]=[{'all':!![]}];}return db[_0x5ea6('0x2b')][_0x5ea6('0x40')](_0x26f6d8);})[_0x5ea6('0x24')](function(_0x4f7128){_0x4eb69b['rows']=_0x4f7128;return _0x4eb69b;})[_0x5ea6('0x24')](respondWithFilteredResult(_0x136089,_0x26f6d8))[_0x5ea6('0x41')](handleError(_0x136089,null));};exports[_0x5ea6('0x42')]=function(_0x70192e,_0x367d39){var _0x5a91f3={'raw':!![],'where':{'id':_0x70192e[_0x5ea6('0x43')]['id']}},_0x3465f8={};_0x3465f8[_0x5ea6('0x30')]=_['keys'](db['VoiceQueuesLog']['rawAttributes']);_0x3465f8[_0x5ea6('0x31')]=_['keys'](_0x70192e[_0x5ea6('0x31')]);_0x3465f8[_0x5ea6('0x33')]=_[_0x5ea6('0x44')](_0x3465f8[_0x5ea6('0x30')],_0x3465f8['query']);_0x5a91f3[_0x5ea6('0x34')]=_[_0x5ea6('0x44')](_0x3465f8[_0x5ea6('0x30')],qs[_0x5ea6('0x35')](_0x70192e['query']['fields']));_0x5a91f3[_0x5ea6('0x34')]=_0x5a91f3[_0x5ea6('0x34')][_0x5ea6('0x36')]?_0x5a91f3[_0x5ea6('0x34')]:_0x3465f8['model'];if(_0x70192e[_0x5ea6('0x31')][_0x5ea6('0x3e')]){_0x5a91f3[_0x5ea6('0x3f')]=[{'all':!![]}];}_0x5a91f3=_[_0x5ea6('0x3c')]({},_0x5a91f3,_0x70192e[_0x5ea6('0x45')]);return db['VoiceQueuesLog'][_0x5ea6('0x46')](_0x5a91f3)[_0x5ea6('0x24')](handleEntityNotFound(_0x367d39,null))[_0x5ea6('0x24')](respondWithResult(_0x367d39,null))[_0x5ea6('0x41')](handleError(_0x367d39,null));};exports['create']=function(_0x27bb6b,_0x2ee309){return db['VoiceQueuesLog']['create'](_0x27bb6b[_0x5ea6('0x47')],{})[_0x5ea6('0x24')](respondWithResult(_0x2ee309,0xc9))[_0x5ea6('0x41')](handleError(_0x2ee309,null));};exports['update']=function(_0x21ae48,_0x630891){if(_0x21ae48['body']['id']){delete _0x21ae48[_0x5ea6('0x47')]['id'];}return db[_0x5ea6('0x2b')][_0x5ea6('0x46')]({'where':{'id':_0x21ae48[_0x5ea6('0x43')]['id']}})[_0x5ea6('0x24')](handleEntityNotFound(_0x630891,null))[_0x5ea6('0x24')](saveUpdates(_0x21ae48[_0x5ea6('0x47')],null))['then'](respondWithResult(_0x630891,null))[_0x5ea6('0x41')](handleError(_0x630891,null));};exports[_0x5ea6('0x25')]=function(_0x357228,_0x1f854f){return db[_0x5ea6('0x2b')][_0x5ea6('0x46')]({'where':{'id':_0x357228[_0x5ea6('0x43')]['id']}})[_0x5ea6('0x24')](handleEntityNotFound(_0x1f854f,null))[_0x5ea6('0x24')](removeEntity(_0x1f854f,null))[_0x5ea6('0x41')](handleError(_0x1f854f,null));}; \ No newline at end of file +var _0x65e1=['model','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','create','body','find','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','reject','update','then','destroy','sendStatus','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','key','keys','query','filters','intersection'];(function(_0x1328a5,_0x3f3d12){var _0x171b39=function(_0x215390){while(--_0x215390){_0x1328a5['push'](_0x1328a5['shift']());}};_0x171b39(++_0x3f3d12);}(_0x65e1,0xed));var _0x165e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x65e1[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x165e('0x0'));var zipdir=require(_0x165e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x165e('0x2'));var moment=require('moment');var BPromise=require(_0x165e('0x3'));var Mustache=require(_0x165e('0x4'));var util=require(_0x165e('0x5'));var path=require(_0x165e('0x6'));var sox=require(_0x165e('0x7'));var csv=require(_0x165e('0x8'));var ejs=require(_0x165e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x165e('0xa'));var squel=require(_0x165e('0xb'));var crypto=require(_0x165e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x165e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x165e('0xe'));var Papa=require(_0x165e('0xf'));var Redis=require(_0x165e('0x10'));var authService=require(_0x165e('0x11'));var qs=require(_0x165e('0x12'));var as=require(_0x165e('0x13'));var hardwareService=require(_0x165e('0x14'));var logger=require(_0x165e('0x15'))(_0x165e('0x16'));var utils=require(_0x165e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x165e('0x18'));var db=require(_0x165e('0x19'))['db'];function respondWithStatusCode(_0x595d57,_0xecf429){_0xecf429=_0xecf429||0xcc;return function(_0x33dce3){if(_0x33dce3){return _0x595d57['sendStatus'](_0xecf429);}return _0x595d57[_0x165e('0x1a')](_0xecf429)[_0x165e('0x1b')]();};}function respondWithResult(_0x459c0e,_0x2d2f0c){_0x2d2f0c=_0x2d2f0c||0xc8;return function(_0x500b3a){if(_0x500b3a){return _0x459c0e[_0x165e('0x1a')](_0x2d2f0c)['json'](_0x500b3a);}};}function respondWithFilteredResult(_0x300fc8,_0x5436a0){return function(_0xb82088){if(_0xb82088){var _0x27371e=typeof _0x5436a0[_0x165e('0x1c')]===_0x165e('0x1d')&&typeof _0x5436a0[_0x165e('0x1e')]===_0x165e('0x1d');var _0x16d69c=_0xb82088[_0x165e('0x1f')];var _0x209eb7=_0x27371e?0x0:_0x5436a0[_0x165e('0x1c')];var _0x32edf5=_0x27371e?_0xb82088[_0x165e('0x1f')]:_0x5436a0[_0x165e('0x1c')]+_0x5436a0['limit'];var _0x54fcb9;if(_0x32edf5>=_0x16d69c){_0x32edf5=_0x16d69c;_0x54fcb9=0xc8;}else{_0x54fcb9=0xce;}_0x300fc8['status'](_0x54fcb9);return _0x300fc8['set']('Content-Range',_0x209eb7+'-'+_0x32edf5+'/'+_0x16d69c)[_0x165e('0x20')](_0xb82088);}return null;};}function patchUpdates(_0x2792ee){return function(_0x52ab26){try{jsonpatch[_0x165e('0x21')](_0x52ab26,_0x2792ee,!![]);}catch(_0x59e1c2){return BPromise[_0x165e('0x22')](_0x59e1c2);}return _0x52ab26['save']();};}function saveUpdates(_0x1f52f7,_0x3c058a){return function(_0x2ecdab){if(_0x2ecdab){return _0x2ecdab[_0x165e('0x23')](_0x1f52f7)[_0x165e('0x24')](function(_0x20f5ee){return _0x20f5ee;});}return null;};}function removeEntity(_0x248950,_0x3fae8c){return function(_0x598574){if(_0x598574){return _0x598574[_0x165e('0x25')]()[_0x165e('0x24')](function(){_0x248950[_0x165e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51ffff,_0x1bd9ea){return function(_0x5315a2){if(!_0x5315a2){_0x51ffff[_0x165e('0x26')](0x194);}return _0x5315a2;};}function handleError(_0x4f631e,_0x326a39){_0x326a39=_0x326a39||0x1f4;return function(_0x3f5e39){logger['error'](_0x3f5e39['stack']);if(_0x3f5e39[_0x165e('0x27')]){delete _0x3f5e39[_0x165e('0x27')];}_0x4f631e['status'](_0x326a39)[_0x165e('0x28')](_0x3f5e39);};}exports[_0x165e('0x29')]=function(_0x17006c,_0x158fd8){var _0x1cec47={},_0x1d0854={},_0x5b8fb7={'count':0x0,'rows':[]};var _0x82a016=_[_0x165e('0x2a')](db[_0x165e('0x2b')][_0x165e('0x2c')],function(_0x4cb01b){return{'name':_0x4cb01b[_0x165e('0x2d')],'type':_0x4cb01b['type'][_0x165e('0x2e')]};});_0x1d0854['model']=_[_0x165e('0x2a')](_0x82a016,_0x165e('0x27'));_0x1d0854['query']=_[_0x165e('0x2f')](_0x17006c[_0x165e('0x30')]);_0x1d0854[_0x165e('0x31')]=_[_0x165e('0x32')](_0x1d0854[_0x165e('0x33')],_0x1d0854[_0x165e('0x30')]);_0x1cec47[_0x165e('0x34')]=_[_0x165e('0x32')](_0x1d0854[_0x165e('0x33')],qs[_0x165e('0x35')](_0x17006c[_0x165e('0x30')]['fields']));_0x1cec47['attributes']=_0x1cec47[_0x165e('0x34')][_0x165e('0x36')]?_0x1cec47[_0x165e('0x34')]:_0x1d0854['model'];if(!_0x17006c[_0x165e('0x30')][_0x165e('0x37')]('nolimit')){_0x1cec47[_0x165e('0x1e')]=qs[_0x165e('0x1e')](_0x17006c[_0x165e('0x30')][_0x165e('0x1e')]);_0x1cec47[_0x165e('0x1c')]=qs['offset'](_0x17006c[_0x165e('0x30')][_0x165e('0x1c')]);}_0x1cec47['order']=qs[_0x165e('0x38')](_0x17006c[_0x165e('0x30')]['sort']);_0x1cec47[_0x165e('0x39')]=qs[_0x165e('0x31')](_['pick'](_0x17006c['query'],_0x1d0854[_0x165e('0x31')]),_0x82a016);if(_0x17006c[_0x165e('0x30')][_0x165e('0x3a')]){_0x1cec47[_0x165e('0x39')]=_[_0x165e('0x3b')](_0x1cec47[_0x165e('0x39')],{'$or':_[_0x165e('0x2a')](_0x82a016,function(_0x260749){if(_0x260749[_0x165e('0x3c')]!==_0x165e('0x3d')){var _0x3b1ca4={};_0x3b1ca4[_0x260749[_0x165e('0x27')]]={'$like':'%'+_0x17006c[_0x165e('0x30')][_0x165e('0x3a')]+'%'};return _0x3b1ca4;}})});}_0x1cec47=_[_0x165e('0x3b')]({},_0x1cec47,_0x17006c['options']);var _0x621df0={'where':_0x1cec47[_0x165e('0x39')]};return db[_0x165e('0x2b')][_0x165e('0x1f')](_0x621df0)['then'](function(_0x48c13e){_0x5b8fb7[_0x165e('0x1f')]=_0x48c13e;if(_0x17006c[_0x165e('0x30')][_0x165e('0x3e')]){_0x1cec47['include']=[{'all':!![]}];}return db[_0x165e('0x2b')][_0x165e('0x3f')](_0x1cec47);})[_0x165e('0x24')](function(_0x36a523){_0x5b8fb7[_0x165e('0x40')]=_0x36a523;return _0x5b8fb7;})[_0x165e('0x24')](respondWithFilteredResult(_0x158fd8,_0x1cec47))[_0x165e('0x41')](handleError(_0x158fd8,null));};exports[_0x165e('0x42')]=function(_0x23e898,_0x394cfb){var _0x4a3e15={'raw':!![],'where':{'id':_0x23e898[_0x165e('0x43')]['id']}},_0x195bd3={};_0x195bd3[_0x165e('0x33')]=_[_0x165e('0x2f')](db['VoiceQueuesLog']['rawAttributes']);_0x195bd3[_0x165e('0x30')]=_[_0x165e('0x2f')](_0x23e898[_0x165e('0x30')]);_0x195bd3['filters']=_[_0x165e('0x32')](_0x195bd3[_0x165e('0x33')],_0x195bd3['query']);_0x4a3e15[_0x165e('0x34')]=_[_0x165e('0x32')](_0x195bd3[_0x165e('0x33')],qs['fields'](_0x23e898['query'][_0x165e('0x35')]));_0x4a3e15[_0x165e('0x34')]=_0x4a3e15['attributes'][_0x165e('0x36')]?_0x4a3e15[_0x165e('0x34')]:_0x195bd3['model'];if(_0x23e898[_0x165e('0x30')][_0x165e('0x3e')]){_0x4a3e15[_0x165e('0x44')]=[{'all':!![]}];}_0x4a3e15=_[_0x165e('0x3b')]({},_0x4a3e15,_0x23e898['options']);return db['VoiceQueuesLog']['find'](_0x4a3e15)[_0x165e('0x24')](handleEntityNotFound(_0x394cfb,null))[_0x165e('0x24')](respondWithResult(_0x394cfb,null))[_0x165e('0x41')](handleError(_0x394cfb,null));};exports['create']=function(_0x2b9309,_0x55b58c){return db[_0x165e('0x2b')][_0x165e('0x45')](_0x2b9309[_0x165e('0x46')],{})[_0x165e('0x24')](respondWithResult(_0x55b58c,0xc9))['catch'](handleError(_0x55b58c,null));};exports[_0x165e('0x23')]=function(_0x56ced1,_0x14e915){if(_0x56ced1['body']['id']){delete _0x56ced1[_0x165e('0x46')]['id'];}return db['VoiceQueuesLog'][_0x165e('0x47')]({'where':{'id':_0x56ced1['params']['id']}})['then'](handleEntityNotFound(_0x14e915,null))[_0x165e('0x24')](saveUpdates(_0x56ced1[_0x165e('0x46')],null))[_0x165e('0x24')](respondWithResult(_0x14e915,null))[_0x165e('0x41')](handleError(_0x14e915,null));};exports['destroy']=function(_0x29d134,_0x4ac05f){return db[_0x165e('0x2b')][_0x165e('0x47')]({'where':{'id':_0x29d134[_0x165e('0x43')]['id']}})[_0x165e('0x24')](handleEntityNotFound(_0x4ac05f,null))[_0x165e('0x24')](removeEntity(_0x4ac05f,null))['catch'](handleError(_0x4ac05f,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 31094fb..d89c3c3 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 _0x2917=['event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm'];(function(_0x2b9423,_0x534c16){var _0x599196=function(_0x53eab4){while(--_0x53eab4){_0x2b9423['push'](_0x2b9423['shift']());}};_0x599196(++_0x534c16);}(_0x2917,0x142));var _0x7291=function(_0x14e27a,_0x3b4136){_0x14e27a=_0x14e27a-0x0;var _0x288688=_0x2917[_0x14e27a];return _0x288688;};'use strict';var _=require(_0x7291('0x0'));var util=require(_0x7291('0x1'));var logger=require(_0x7291('0x2'))(_0x7291('0x3'));var moment=require(_0x7291('0x4'));var BPromise=require(_0x7291('0x5'));var rp=require(_0x7291('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7291('0x7'));var attributes=require(_0x7291('0x8'));module[_0x7291('0x9')]=function(_0x6aac19,_0x1ee790){return _0x6aac19[_0x7291('0xa')](_0x7291('0xb'),attributes,{'tableName':_0x7291('0xc'),'paranoid':![],'indexes':[{'name':_0x7291('0xd'),'fields':[_0x7291('0xe'),_0x7291('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc44d=['api','moment','request-promise','path','rimraf','../../config/environment','exports','event','lodash','../../config/logger'];(function(_0xd43b9b,_0x12c924){var _0x23427f=function(_0x323c2d){while(--_0x323c2d){_0xd43b9b['push'](_0xd43b9b['shift']());}};_0x23427f(++_0x12c924);}(_0xc44d,0xc6));var _0xdc44=function(_0x3bf838,_0x22b424){_0x3bf838=_0x3bf838-0x0;var _0x2a279f=_0xc44d[_0x3bf838];return _0x2a279f;};'use strict';var _=require(_0xdc44('0x0'));var util=require('util');var logger=require(_0xdc44('0x1'))(_0xdc44('0x2'));var moment=require(_0xdc44('0x3'));var BPromise=require('bluebird');var rp=require(_0xdc44('0x4'));var fs=require('fs');var path=require(_0xdc44('0x5'));var rimraf=require(_0xdc44('0x6'));var config=require(_0xdc44('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0xdc44('0x8')]=function(_0x5cbb51,_0x36a987){return _0x5cbb51['define']('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xdc44('0x9'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 07a62f0..188bb2a 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 _0x2a31=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x2e456a,_0x282a22){var _0x4cb7b9=function(_0x444173){while(--_0x444173){_0x2e456a['push'](_0x2e456a['shift']());}};_0x4cb7b9(++_0x282a22);}(_0x2a31,0xe4));var _0x12a3=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x2a31[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x12a3('0x0'));var util=require(_0x12a3('0x1'));var moment=require(_0x12a3('0x2'));var BPromise=require(_0x12a3('0x3'));var rs=require(_0x12a3('0x4'));var fs=require('fs');var Redis=require(_0x12a3('0x5'));var db=require(_0x12a3('0x6'))['db'];var utils=require(_0x12a3('0x7'));var logger=require(_0x12a3('0x8'))(_0x12a3('0x9'));var config=require(_0x12a3('0xa'));var jayson=require(_0x12a3('0xb'));var client=jayson[_0x12a3('0xc')][_0x12a3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5411bc,_0xcf401f,_0x5e24b3){return new BPromise(function(_0x25703e,_0x4d6252){return client[_0x12a3('0xe')](_0x5411bc,_0x5e24b3)['then'](function(_0xc38543){logger['info'](_0x12a3('0xf'),_0xcf401f,_0x12a3('0x10'));logger[_0x12a3('0x11')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0xcf401f,'request\x20sent',JSON[_0x12a3('0x12')](_0xc38543));if(_0xc38543[_0x12a3('0x13')]){if(_0xc38543[_0x12a3('0x13')][_0x12a3('0x14')]===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0xcf401f,_0xc38543[_0x12a3('0x13')]['message']);return _0x4d6252(_0xc38543[_0x12a3('0x13')][_0x12a3('0x15')]);}logger['error'](_0x12a3('0xf'),_0xcf401f,_0xc38543[_0x12a3('0x13')]['message']);return _0x25703e(_0xc38543['error'][_0x12a3('0x15')]);}else{logger[_0x12a3('0x16')](_0x12a3('0xf'),_0xcf401f,_0x12a3('0x10'));_0x25703e(_0xc38543[_0x12a3('0x17')][_0x12a3('0x15')]);}})[_0x12a3('0x18')](function(_0x471db6){logger[_0x12a3('0x13')](_0x12a3('0xf'),_0xcf401f,_0x471db6);_0x4d6252(_0x471db6);});});} \ No newline at end of file +var _0x682e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x4a8418,_0x39078a){var _0x390174=function(_0x173ea6){while(--_0x173ea6){_0x4a8418['push'](_0x4a8418['shift']());}};_0x390174(++_0x39078a);}(_0x682e,0x119));var _0xe682=function(_0x564795,_0x429022){_0x564795=_0x564795-0x0;var _0x359c30=_0x682e[_0x564795];return _0x359c30;};'use strict';var _=require(_0xe682('0x0'));var util=require('util');var moment=require(_0xe682('0x1'));var BPromise=require(_0xe682('0x2'));var rs=require(_0xe682('0x3'));var fs=require('fs');var Redis=require(_0xe682('0x4'));var db=require(_0xe682('0x5'))['db'];var utils=require(_0xe682('0x6'));var logger=require(_0xe682('0x7'))(_0xe682('0x8'));var config=require(_0xe682('0x9'));var jayson=require(_0xe682('0xa'));var client=jayson[_0xe682('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x82fa21,_0x1d766a,_0x214393){return new BPromise(function(_0x283937,_0x5d9cd5){return client[_0xe682('0xc')](_0x82fa21,_0x214393)[_0xe682('0xd')](function(_0xc6d5fe){logger[_0xe682('0xe')](_0xe682('0xf'),_0x1d766a,_0xe682('0x10'));logger['debug'](_0xe682('0x11'),_0x1d766a,_0xe682('0x10'),JSON['stringify'](_0xc6d5fe));if(_0xc6d5fe[_0xe682('0x12')]){if(_0xc6d5fe[_0xe682('0x12')][_0xe682('0x13')]===0x1f4){logger[_0xe682('0x12')](_0xe682('0xf'),_0x1d766a,_0xc6d5fe[_0xe682('0x12')][_0xe682('0x14')]);return _0x5d9cd5(_0xc6d5fe['error'][_0xe682('0x14')]);}logger[_0xe682('0x12')](_0xe682('0xf'),_0x1d766a,_0xc6d5fe[_0xe682('0x12')][_0xe682('0x14')]);return _0x283937(_0xc6d5fe[_0xe682('0x12')][_0xe682('0x14')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x1d766a,_0xe682('0x10'));_0x283937(_0xc6d5fe[_0xe682('0x15')][_0xe682('0x14')]);}})['catch'](function(_0x11b0aa){logger[_0xe682('0x12')](_0xe682('0xf'),_0x1d766a,_0x11b0aa);_0x5d9cd5(_0x11b0aa);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 94d930a..a8555ad 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 _0xcfc3=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','create','runTranscribe','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x5a2e2a,_0xf1b1ba){var _0x2d4f85=function(_0xcea253){while(--_0xcea253){_0x5a2e2a['push'](_0x5a2e2a['shift']());}};_0x2d4f85(++_0xf1b1ba);}(_0xcfc3,0x18b));var _0x3cfc=function(_0x55fb8f,_0x574d3a){_0x55fb8f=_0x55fb8f-0x0;var _0x2c841a=_0xcfc3[_0x55fb8f];return _0x2c841a;};'use strict';var multer=require('multer');var util=require(_0x3cfc('0x0'));var path=require(_0x3cfc('0x1'));var timeout=require(_0x3cfc('0x2'));var express=require(_0x3cfc('0x3'));var router=express[_0x3cfc('0x4')]();var fs_extra=require(_0x3cfc('0x5'));var auth=require(_0x3cfc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3cfc('0x7'));var controller=require('./voiceRecording.controller');router[_0x3cfc('0x8')]('/',auth[_0x3cfc('0x9')](),controller[_0x3cfc('0xa')]);router['get']('/describe',auth[_0x3cfc('0x9')](),controller[_0x3cfc('0xb')]);router[_0x3cfc('0x8')]('/:id',auth[_0x3cfc('0x9')](),controller['show']);router[_0x3cfc('0x8')](_0x3cfc('0xc'),auth['isAuthenticated'](),controller[_0x3cfc('0xd')]);router['get']('/:id/downloads',controller[_0x3cfc('0xe')]);router[_0x3cfc('0x8')](_0x3cfc('0xf'),auth['isAuthenticated'](),controller[_0x3cfc('0x10')]);router['post']('/',auth[_0x3cfc('0x9')](),controller[_0x3cfc('0x11')]);router['post'](_0x3cfc('0xf'),auth[_0x3cfc('0x9')](),controller[_0x3cfc('0x12')]);router[_0x3cfc('0x13')](_0x3cfc('0x14'),auth[_0x3cfc('0x9')](),controller[_0x3cfc('0x15')]);router[_0x3cfc('0x16')](_0x3cfc('0x14'),auth[_0x3cfc('0x9')](),controller[_0x3cfc('0x17')]);module[_0x3cfc('0x18')]=router; \ No newline at end of file +var _0x7198=['../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','describe','download','downloads','downloadTranscribe','post','create','put','update','delete','/:id','destroy','path','express','Router','fs-extra'];(function(_0x5a0fc2,_0x8ce4fb){var _0x4213f8=function(_0x352ab5){while(--_0x352ab5){_0x5a0fc2['push'](_0x5a0fc2['shift']());}};_0x4213f8(++_0x8ce4fb);}(_0x7198,0xb0));var _0x8719=function(_0x5e6440,_0x409bb5){_0x5e6440=_0x5e6440-0x0;var _0x47e4ec=_0x7198[_0x5e6440];return _0x47e4ec;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8719('0x0'));var timeout=require('connect-timeout');var express=require(_0x8719('0x1'));var router=express[_0x8719('0x2')]();var fs_extra=require(_0x8719('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8719('0x4'));var controller=require(_0x8719('0x5'));router[_0x8719('0x6')]('/',auth[_0x8719('0x7')](),controller[_0x8719('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x8719('0x9')]);router[_0x8719('0x6')]('/:id',auth[_0x8719('0x7')](),controller['show']);router[_0x8719('0x6')]('/:id/download',auth[_0x8719('0x7')](),controller[_0x8719('0xa')]);router[_0x8719('0x6')]('/:id/downloads',controller[_0x8719('0xb')]);router[_0x8719('0x6')]('/:id/transcribe',auth[_0x8719('0x7')](),controller[_0x8719('0xc')]);router[_0x8719('0xd')]('/',auth['isAuthenticated'](),controller[_0x8719('0xe')]);router[_0x8719('0xd')]('/:id/transcribe',auth[_0x8719('0x7')](),controller['runTranscribe']);router[_0x8719('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8719('0x10')]);router[_0x8719('0x11')](_0x8719('0x12'),auth['isAuthenticated'](),controller[_0x8719('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 9057a95..5c5f27c 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(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 6ff2218..3930298 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 _0x1f9b=['bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','runTranscribe','findOne','Sequelize','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','fileText','root','/server/files/transcribes/transcribe_','.txt','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','fieldName','type','key','model','differenceBy','format','query','filters','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','rows','catch','show','params','keys','intersection','includeAll','options','find','body','describe','uniqueid','value','%s.cypher','existsSync','ValidationError','filename','download','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','../../components/encryptor','sequelize','col','token','$and','push','decryptFile','secrets','recording','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','upload','TranscribeService','basename','Location'];(function(_0x2b0c7b,_0x479338){var _0x15aee=function(_0x54c0eb){while(--_0x54c0eb){_0x2b0c7b['push'](_0x2b0c7b['shift']());}};_0x15aee(++_0x479338);}(_0x1f9b,0x1e7));var _0xb1f9=function(_0x188d57,_0x848da0){_0x188d57=_0x188d57-0x0;var _0x137703=_0x1f9b[_0x188d57];return _0x137703;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1f9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1f9('0x1'));var rp=require(_0xb1f9('0x2'));var moment=require(_0xb1f9('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb1f9('0x4'));var path=require(_0xb1f9('0x5'));var sox=require(_0xb1f9('0x6'));var csv=require(_0xb1f9('0x7'));var ejs=require(_0xb1f9('0x8'));var fs=require('fs');var fs_extra=require(_0xb1f9('0x9'));var _=require(_0xb1f9('0xa'));var squel=require(_0xb1f9('0xb'));var crypto=require(_0xb1f9('0xc'));var jsforce=require(_0xb1f9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb1f9('0x7'));var querystring=require(_0xb1f9('0xe'));var Papa=require(_0xb1f9('0xf'));var AWS=require(_0xb1f9('0x10'));var uuidv4=require(_0xb1f9('0x11'));var Redis=require(_0xb1f9('0x12'));var authService=require(_0xb1f9('0x13'));var qs=require(_0xb1f9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb1f9('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xb1f9('0x16'));var config=require(_0xb1f9('0x17'));var licenseUtil=require(_0xb1f9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35adcf,_0x134ebf){_0x134ebf=_0x134ebf||0xcc;return function(_0x2bb1d6){if(_0x2bb1d6){return _0x35adcf[_0xb1f9('0x19')](_0x134ebf);}return _0x35adcf[_0xb1f9('0x1a')](_0x134ebf)[_0xb1f9('0x1b')]();};}function respondWithResult(_0x4422b5,_0x9b141b){_0x9b141b=_0x9b141b||0xc8;return function(_0x3c99ac){if(_0x3c99ac){return _0x4422b5['status'](_0x9b141b)[_0xb1f9('0x1c')](_0x3c99ac);}};}function respondWithFilteredResult(_0x529051,_0x8882bb){return function(_0x2b9d8d){if(_0x2b9d8d){var _0x499ed4=typeof _0x8882bb[_0xb1f9('0x1d')]==='undefined'&&typeof _0x8882bb[_0xb1f9('0x1e')]===_0xb1f9('0x1f');var _0x4262c0=_0x2b9d8d[_0xb1f9('0x20')];var _0x3ba10a=_0x499ed4?0x0:_0x8882bb[_0xb1f9('0x1d')];var _0x54348c=_0x499ed4?_0x2b9d8d[_0xb1f9('0x20')]:_0x8882bb[_0xb1f9('0x1d')]+_0x8882bb[_0xb1f9('0x1e')];var _0x38d3d9;if(_0x54348c>=_0x4262c0){_0x54348c=_0x4262c0;_0x38d3d9=0xc8;}else{_0x38d3d9=0xce;}_0x529051[_0xb1f9('0x1a')](_0x38d3d9);return _0x529051[_0xb1f9('0x21')](_0xb1f9('0x22'),_0x3ba10a+'-'+_0x54348c+'/'+_0x4262c0)[_0xb1f9('0x1c')](_0x2b9d8d);}return null;};}function patchUpdates(_0x1423c0){return function(_0x50dc7c){try{jsonpatch['apply'](_0x50dc7c,_0x1423c0,!![]);}catch(_0x195a05){return BPromise[_0xb1f9('0x23')](_0x195a05);}return _0x50dc7c[_0xb1f9('0x24')]();};}function saveUpdates(_0x4bdbb9,_0x18ecca){return function(_0x442c75){if(_0x442c75){return _0x442c75[_0xb1f9('0x25')](_0x4bdbb9)[_0xb1f9('0x26')](function(_0x2ab502){return _0x2ab502;});}return null;};}function removeEntity(_0xf815d0,_0x39d128){return function(_0x6ab797){if(_0x6ab797){return _0x6ab797[_0xb1f9('0x27')]()[_0xb1f9('0x26')](function(){_0xf815d0[_0xb1f9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43ae83,_0x7790c3){return function(_0x2cdb36){if(!_0x2cdb36){_0x43ae83['sendStatus'](0x194);}return _0x2cdb36;};}function handleError(_0x3b0799,_0x5d7c7d){_0x5d7c7d=_0x5d7c7d||0x1f4;return function(_0x390c9a){logger[_0xb1f9('0x28')](_0x390c9a[_0xb1f9('0x29')]);if(_0x390c9a[_0xb1f9('0x2a')]){delete _0x390c9a[_0xb1f9('0x2a')];}_0x3b0799['status'](_0x5d7c7d)[_0xb1f9('0x2b')](_0x390c9a);};}exports[_0xb1f9('0x2c')]=function(_0x796c65,_0x2c2587){var _0x1c744b={},_0x361f0b={},_0x546f44={'count':0x0,'rows':[]};var _0x46117e=_[_0xb1f9('0x2d')](db[_0xb1f9('0x2e')]['rawAttributes'],function(_0x231dfd){return{'name':_0x231dfd[_0xb1f9('0x2f')],'type':_0x231dfd[_0xb1f9('0x30')][_0xb1f9('0x31')]};});_0x361f0b[_0xb1f9('0x32')]=_[_0xb1f9('0x33')](_[_0xb1f9('0x2d')](_0x46117e,_0xb1f9('0x2a')),[_0xb1f9('0x34')]);_0x361f0b['query']=_['keys'](_0x796c65[_0xb1f9('0x35')]);_0x361f0b[_0xb1f9('0x36')]=_['intersection'](_0x361f0b[_0xb1f9('0x32')],_0x361f0b['query']);_0x1c744b[_0xb1f9('0x37')]=_['intersection'](_0x361f0b[_0xb1f9('0x32')],qs['fields'](_0x796c65['query'][_0xb1f9('0x38')]));_0x1c744b[_0xb1f9('0x37')]=_0x1c744b[_0xb1f9('0x37')][_0xb1f9('0x39')]?_0x1c744b[_0xb1f9('0x37')]:_0x361f0b['model'];if(!_0x796c65['query']['hasOwnProperty']('nolimit')){_0x1c744b[_0xb1f9('0x1e')]=qs[_0xb1f9('0x1e')](_0x796c65[_0xb1f9('0x35')]['limit']);_0x1c744b[_0xb1f9('0x1d')]=qs[_0xb1f9('0x1d')](_0x796c65['query'][_0xb1f9('0x1d')]);}_0x1c744b[_0xb1f9('0x3a')]=qs['sort'](_0x796c65[_0xb1f9('0x35')][_0xb1f9('0x3b')]);_0x1c744b[_0xb1f9('0x3c')]=qs['filters'](_[_0xb1f9('0x3d')](_0x796c65['query'],_0x361f0b[_0xb1f9('0x36')]),_0x46117e);if(_0x796c65[_0xb1f9('0x35')]['filter']){_0x1c744b[_0xb1f9('0x3c')]=_[_0xb1f9('0x3e')](_0x1c744b[_0xb1f9('0x3c')],{'$or':_[_0xb1f9('0x2d')](_0x46117e,function(_0x5a79da){if(_0x5a79da[_0xb1f9('0x30')]!==_0xb1f9('0x3f')){var _0x4c66e8={};_0x4c66e8[_0x5a79da['name']]={'$like':'%'+_0x796c65[_0xb1f9('0x35')][_0xb1f9('0x40')]+'%'};return _0x4c66e8;}})});}_0x1c744b=_[_0xb1f9('0x3e')]({},_0x1c744b,_0x796c65['options']);var _0x5d9edb={'where':_0x1c744b[_0xb1f9('0x3c')]};return db[_0xb1f9('0x2e')][_0xb1f9('0x20')](_0x5d9edb)[_0xb1f9('0x26')](function(_0x5411dc){_0x546f44[_0xb1f9('0x20')]=_0x5411dc;if(_0x796c65[_0xb1f9('0x35')]['includeAll']){_0x1c744b['include']=[{'all':!![]}];}return db[_0xb1f9('0x2e')]['findAll'](_0x1c744b);})[_0xb1f9('0x26')](function(_0x56ab3e){_0x546f44[_0xb1f9('0x41')]=_0x56ab3e;return _0x546f44;})[_0xb1f9('0x26')](respondWithFilteredResult(_0x2c2587,_0x1c744b))[_0xb1f9('0x42')](handleError(_0x2c2587,null));};exports[_0xb1f9('0x43')]=function(_0x9240bb,_0x3466f3){var _0xe09786={'raw':![],'where':{'id':_0x9240bb[_0xb1f9('0x44')]['id']}},_0x2aaa32={};_0x2aaa32[_0xb1f9('0x32')]=_['keys'](db[_0xb1f9('0x2e')]['rawAttributes']);_0x2aaa32[_0xb1f9('0x35')]=_[_0xb1f9('0x45')](_0x9240bb[_0xb1f9('0x35')]);_0x2aaa32['filters']=_[_0xb1f9('0x46')](_0x2aaa32[_0xb1f9('0x32')],_0x2aaa32[_0xb1f9('0x35')]);_0xe09786[_0xb1f9('0x37')]=_[_0xb1f9('0x46')](_0x2aaa32[_0xb1f9('0x32')],qs[_0xb1f9('0x38')](_0x9240bb['query']['fields']));_0xe09786[_0xb1f9('0x37')]=_0xe09786[_0xb1f9('0x37')][_0xb1f9('0x39')]?_0xe09786[_0xb1f9('0x37')]:_0x2aaa32['model'];if(_0x9240bb[_0xb1f9('0x35')][_0xb1f9('0x47')]){_0xe09786['include']=[{'all':!![]}];}_0xe09786=_['merge']({},_0xe09786,_0x9240bb[_0xb1f9('0x48')]);return db[_0xb1f9('0x2e')][_0xb1f9('0x49')](_0xe09786)[_0xb1f9('0x26')](handleEntityNotFound(_0x3466f3,null))[_0xb1f9('0x26')](respondWithResult(_0x3466f3,null))[_0xb1f9('0x42')](handleError(_0x3466f3,null));};exports['create']=function(_0x403dfc,_0xb0dc20){return db[_0xb1f9('0x2e')]['create'](_0x403dfc[_0xb1f9('0x4a')],{})[_0xb1f9('0x26')](respondWithResult(_0xb0dc20,0xc9))['catch'](handleError(_0xb0dc20,null));};exports[_0xb1f9('0x25')]=function(_0x1f7a54,_0x4db2c1){if(_0x1f7a54[_0xb1f9('0x4a')]['id']){delete _0x1f7a54['body']['id'];}return db['VoiceRecording'][_0xb1f9('0x49')]({'where':{'id':_0x1f7a54['params']['id']}})[_0xb1f9('0x26')](handleEntityNotFound(_0x4db2c1,null))['then'](saveUpdates(_0x1f7a54[_0xb1f9('0x4a')],null))[_0xb1f9('0x26')](respondWithResult(_0x4db2c1,null))['catch'](handleError(_0x4db2c1,null));};exports['describe']=function(_0x12e681,_0xa2c70f){return db[_0xb1f9('0x2e')][_0xb1f9('0x4b')]()['then'](respondWithResult(_0xa2c70f,null))[_0xb1f9('0x42')](handleError(_0xa2c70f,null));};exports['download']=function(_0xe0c923,_0x37d3ae,_0x25ffc9){var _0x53a3fd=require('../../components/encryptor');var _0x2e5d95=![];var _0x3514e8={};if(_0xe0c923['query'][_0xb1f9('0x30')]&&_0xe0c923[_0xb1f9('0x35')]['type']===_0xb1f9('0x4c')){_0x3514e8[_0xb1f9('0x4c')]=_0xe0c923[_0xb1f9('0x44')]['id'];}else{_0x3514e8['id']=_0xe0c923[_0xb1f9('0x44')]['id'];}return db[_0xb1f9('0x2e')][_0xb1f9('0x49')]({'where':_0x3514e8,'attributes':['id','value'],'raw':!![]})[_0xb1f9('0x26')](handleEntityNotFound(_0x37d3ae,null))[_0xb1f9('0x26')](function(_0x396f1d){if(_0x396f1d){var _0x5dd04b=_0x396f1d[_0xb1f9('0x4d')];var _0x3adcc3=util[_0xb1f9('0x34')](_0xb1f9('0x4e'),_0x5dd04b);if(fs[_0xb1f9('0x4f')](_0x3adcc3)){_0x2e5d95=!![];return _0x53a3fd['decryptFile'](_0x3adcc3,_0x5dd04b,config['secrets']['recording'])[_0xb1f9('0x26')](function(){return _0x396f1d;});}return _0x396f1d;}})['then'](function(_0x3dfc8d){if(_0x3dfc8d){var _0x2276dc=_0x3dfc8d[_0xb1f9('0x4d')];if(!fs['existsSync'](_0x2276dc)){throw new db['Sequelize'][(_0xb1f9('0x50'))]('VoiceRecording\x20not\x20found');}if(_0x3dfc8d[_0xb1f9('0x51')]){return _0x37d3ae[_0xb1f9('0x52')](_0x2276dc,_0x3dfc8d[_0xb1f9('0x51')]+path[_0xb1f9('0x53')](_0x2276dc),function(){if(_0x2e5d95){fs[_0xb1f9('0x54')](_0x2276dc);}});}else{return _0x37d3ae[_0xb1f9('0x52')](_0x2276dc,function(_0x2445b3){if(_0x2e5d95){fs[_0xb1f9('0x54')](_0x2276dc);}});}}})[_0xb1f9('0x42')](function(_0x1f0899){if(_0x1f0899[_0xb1f9('0x55')]===_0xb1f9('0x56')){_0x37d3ae[_0xb1f9('0x1a')](0x194)[_0xb1f9('0x2b')](_0xb1f9('0x57'));}else{return handleError(_0x37d3ae,null);}});};exports['downloads']=function(_0x4ca673,_0x294d84,_0x3e9854){var _0x3b2d4b=require(_0xb1f9('0x58'));var _0x222827=![];var _0x4a5b2b={'$and':[db['sequelize'][_0xb1f9('0x3c')](db[_0xb1f9('0x59')]['fn']('MD5',db[_0xb1f9('0x59')][_0xb1f9('0x5a')](_0xb1f9('0x4c'))),_0x4ca673[_0xb1f9('0x35')][_0xb1f9('0x5b')])]};if(_0x4ca673[_0xb1f9('0x35')][_0xb1f9('0x30')]&&_0x4ca673['query'][_0xb1f9('0x30')]==='uniqueid'){_0x4a5b2b[_0xb1f9('0x5c')][_0xb1f9('0x5d')]({'uniqueid':_0x4ca673[_0xb1f9('0x44')]['id']});}else{_0x4a5b2b['$and'][_0xb1f9('0x5d')]({'id':_0x4ca673[_0xb1f9('0x44')]['id']});}return db['VoiceRecording'][_0xb1f9('0x49')]({'where':_0x4a5b2b,'attributes':['id',_0xb1f9('0x4d')],'raw':!![]})[_0xb1f9('0x26')](handleEntityNotFound(_0x294d84,null))[_0xb1f9('0x26')](function(_0x2472a1){if(_0x2472a1){var _0x5eaa01=util[_0xb1f9('0x34')](_0xb1f9('0x4e'),_0x2472a1[_0xb1f9('0x4d')]);if(fs[_0xb1f9('0x4f')](_0x5eaa01)){_0x222827=!![];return _0x3b2d4b[_0xb1f9('0x5e')](_0x5eaa01,_0x2472a1[_0xb1f9('0x4d')],config[_0xb1f9('0x5f')][_0xb1f9('0x60')])[_0xb1f9('0x26')](function(){return _0x2472a1;});}return _0x2472a1;}})[_0xb1f9('0x26')](function(_0x31ceea){if(_0x31ceea){if(!fs['existsSync'](_0x31ceea[_0xb1f9('0x4d')])){throw new db['Sequelize']['ValidationError'](_0xb1f9('0x56'));}if(_0x31ceea[_0xb1f9('0x51')]){return _0x294d84[_0xb1f9('0x52')](_0x31ceea[_0xb1f9('0x4d')],_0x31ceea['filename']+path['extname'](_0x31ceea[_0xb1f9('0x4d')]),function(){if(_0x222827){fs[_0xb1f9('0x54')](_0x31ceea[_0xb1f9('0x4d')]);}});}else{return _0x294d84['download'](_0x31ceea[_0xb1f9('0x4d')],function(_0x521a7d){if(_0x222827){fs[_0xb1f9('0x54')](_0x31ceea[_0xb1f9('0x4d')]);}});}}})[_0xb1f9('0x42')](handleError(_0x294d84,null));};exports[_0xb1f9('0x27')]=function(_0x4870ca,_0x2bbbc6){return db[_0xb1f9('0x2e')][_0xb1f9('0x49')]({'where':{'id':_0x4870ca[_0xb1f9('0x44')]['id']}})[_0xb1f9('0x26')](function(_0x18e4e6){if(_[_0xb1f9('0x61')](_0x18e4e6)){throw new ReferenceError(_0xb1f9('0x62'));}return _0x18e4e6;})[_0xb1f9('0x26')](function(_0xb5dd27){var _0x3b0311=_0xb5dd27[_0xb1f9('0x4d')];logger[_0xb1f9('0x63')](_0xb1f9('0x64'),_0x3b0311);if(!_[_0xb1f9('0x61')](_0xb5dd27[_0xb1f9('0x4d')])&&fs[_0xb1f9('0x4f')](_0x3b0311)){logger[_0xb1f9('0x63')]('File:\x20\x22'+_0x3b0311+_0xb1f9('0x65'));fs[_0xb1f9('0x66')](_0x3b0311);}_0x3b0311=_0x3b0311+_0xb1f9('0x67');if(!_[_0xb1f9('0x61')](_0xb5dd27['value'])&&fs[_0xb1f9('0x4f')](_0x3b0311)){logger[_0xb1f9('0x63')]('File:\x20\x22'+_0x3b0311+_0xb1f9('0x65'));fs[_0xb1f9('0x66')](_0x3b0311);}return _0xb5dd27;})[_0xb1f9('0x26')](function(_0x211e1c){if(!_0x211e1c)throw new InternalError();return _0x211e1c['destroy']();})[_0xb1f9('0x26')](function(){_0x2bbbc6[_0xb1f9('0x1a')](0xcc)[_0xb1f9('0x1b')]();})[_0xb1f9('0x42')](handleError(_0x2bbbc6,null));};function getBucketslist(_0x33fb6a,_0x423f23,_0xebc08b){return new Promise(function(_0x26602d,_0xa7eac3){var _0x3b9b7a=new AWS['S3']({'accessKeyId':_0x423f23,'secretAccessKey':_0x33fb6a,'region':_0xebc08b});_0x3b9b7a['listBuckets']({},function(_0x1168db,_0x2e356f){if(_0x1168db){return _0xa7eac3(_0x1168db);}else{return _0x26602d(_0x2e356f);}});});}function createBucket(_0x373824,_0xb5a756,_0x1d9675,_0x118b49){return new Promise(function(_0x49f791,_0x287a08){var _0x4a4e17=new AWS['S3']({'accessKeyId':_0xb5a756,'secretAccessKey':_0x373824,'region':_0x1d9675});_0x4a4e17[_0xb1f9('0x68')]({'Bucket':_0x118b49},function(_0x5e0070,_0x528477){if(_0x5e0070){return _0x287a08(_0x5e0070);}else{return _0x49f791(_0x528477);}});});}function uploadFile(_0xe92c5d,_0x9de806,_0x4ed4b9,_0x4df435,_0x5ec5c1,_0x5742ee){return new Promise(function(_0x17e15d,_0x505621){var _0x34e650=new AWS['S3']({'accessKeyId':_0x9de806,'secretAccessKey':_0xe92c5d,'region':_0x4ed4b9});_0x34e650[_0xb1f9('0x69')]({'Bucket':_0x4df435,'Key':_0x5ec5c1,'Body':_0x5742ee},function(_0x40413e,_0x5290e7){if(_0x40413e){return _0x505621(_0x40413e);}else{return _0x17e15d(_0x5290e7);}});});}function startTranscribe(_0x3d3235,_0x589680,_0x2a392f,_0x1cb6e9,_0x3eec8d,_0x1a4f7a){return new Promise(function(_0x134dc4,_0x311379){var _0x1d7b6b=new AWS[(_0xb1f9('0x6a'))]({'accessKeyId':_0x589680,'secretAccessKey':_0x3d3235,'region':_0x2a392f});_0x1d7b6b['startTranscriptionJob']({'TranscriptionJobName':_0x1cb6e9,'LanguageCode':_0x3eec8d,'Media':{'MediaFileUri':_0x1a4f7a}},function(_0x4f0c40,_0x2825c0){if(_0x4f0c40){return _0x311379(_0x4f0c40);}else{return _0x134dc4(_0x2825c0);}});});}function transcribe(_0x22cc57,_0x88968f,_0x408ef7,_0x1ab3f6,_0x39cb73,_0x5179d5,_0x1ace45){return new Promise(function(_0x43ec18,_0x2bcf28){var _0xbafa0d={};logger[_0xb1f9('0x63')](util[_0xb1f9('0x34')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x22cc57,_0x39cb73));return uploadFile(_0x88968f,_0x408ef7,_0x1ab3f6,_0x39cb73,path[_0xb1f9('0x6b')](_0x5179d5),fs['readFileSync'](_0x5179d5))[_0xb1f9('0x26')](function(_0x5c5331){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x22cc57,_0x39cb73,_0x5c5331[_0xb1f9('0x6c')]));_0xbafa0d[_0xb1f9('0x6d')]=_0x5c5331[_0xb1f9('0x6e')];_0xbafa0d[_0xb1f9('0x6f')]=_0x5c5331[_0xb1f9('0x6c')];logger[_0xb1f9('0x63')](util[_0xb1f9('0x34')](_0xb1f9('0x70'),_0x22cc57));return startTranscribe(_0x88968f,_0x408ef7,_0x1ab3f6,uuidv4(),_0x1ace45,_0x5c5331[_0xb1f9('0x6c')]);})['then'](function(_0x4fb742){logger[_0xb1f9('0x63')](util['format'](_0xb1f9('0x71'),_0x22cc57,_0x4fb742[_0xb1f9('0x72')]['TranscriptionJobName']));_0xbafa0d[_0xb1f9('0x73')]=_0x4fb742[_0xb1f9('0x72')][_0xb1f9('0x74')];_0xbafa0d[_0xb1f9('0x75')]=_0x4fb742['TranscriptionJob']['TranscriptionJobStatus'];return _0x43ec18(_0xbafa0d);})[_0xb1f9('0x42')](function(_0x1d0ed0){return _0x2bcf28(_0x1d0ed0);});});}exports[_0xb1f9('0x76')]=function(_0x24de3d,_0x44a71d,_0x4be729){var _0x4b769d;var _0x34a42c;var _0x121f34;var _0x5714bb=require('../../components/encryptor');return db[_0xb1f9('0x2e')][_0xb1f9('0x77')]({'where':{'id':_0x24de3d[_0xb1f9('0x44')]['id']}})[_0xb1f9('0x26')](function(_0x3d4f02){if(_0x3d4f02){var _0x2ab3dd=util[_0xb1f9('0x34')]('%s.cypher',_0x3d4f02['value']);if(fs[_0xb1f9('0x4f')](_0x2ab3dd)){cypher=!![];return _0x5714bb[_0xb1f9('0x5e')](_0x2ab3dd,_0x3d4f02[_0xb1f9('0x4d')],config[_0xb1f9('0x5f')]['recording'])[_0xb1f9('0x26')](function(){return _0x3d4f02;});}return _0x3d4f02;}})[_0xb1f9('0x26')](function(_0x257c56){if(!_0x257c56){throw new db[(_0xb1f9('0x78'))]['ValidationError'](_0xb1f9('0x79'));}_0x34a42c=_0x257c56;return db[_0xb1f9('0x7a')][_0xb1f9('0x77')]({'where':{'id':0x1}});})[_0xb1f9('0x26')](handleEntityNotFound(_0x44a71d,null))['then'](function(_0x265e34){if(_0x265e34){_0x4b769d=_0x265e34;if(!_0x4b769d[_0xb1f9('0x7b')]||!_0x4b769d[_0xb1f9('0x7c')]||!_0x4b769d[_0xb1f9('0x7d')]||!_0x4b769d[_0xb1f9('0x7e')]||!_0x4b769d[_0xb1f9('0x6d')]){throw new db[(_0xb1f9('0x78'))]['ValidationError'](_0xb1f9('0x7f'));}if(_0x24de3d[_0xb1f9('0x4a')][_0xb1f9('0x80')]&&(!_0x4b769d[_0xb1f9('0x81')]||!_0x4b769d[_0xb1f9('0x82')]||!_0x4b769d['sentimentRegion']||!_0x4b769d[_0xb1f9('0x7e')]||!_0x4b769d['bucket'])){throw new db['Sequelize'][(_0xb1f9('0x50'))](_0xb1f9('0x83'));}return db[_0xb1f9('0x84')]['findOne']({'where':{'id':_0x4b769d['transcribeAccountId']}});}})[_0xb1f9('0x26')](function(_0x41f044){if(!_0x41f044){throw new db[(_0xb1f9('0x78'))][(_0xb1f9('0x50'))](_0xb1f9('0x85'));}if(!_0x41f044[_0xb1f9('0x86')]||!_0x41f044[_0xb1f9('0x87')]){throw new db['Sequelize'][(_0xb1f9('0x50'))](_0xb1f9('0x88'));}_0x121f34=_0x41f044;return getBucketslist(_0x121f34[_0xb1f9('0x86')],_0x121f34[_0xb1f9('0x87')],_0x4b769d['transcribeRegion']);})[_0xb1f9('0x26')](function(_0x3cad70){if(_0x3cad70&&_0x3cad70[_0xb1f9('0x89')]){var _0x10a052=_[_0xb1f9('0x49')](_0x3cad70[_0xb1f9('0x89')],function(_0x37e1d3){return _0x37e1d3[_0xb1f9('0x8a')]===_0x4b769d['bucket'];});if(!_0x10a052){logger[_0xb1f9('0x63')](util['format'](_0xb1f9('0x8b'),_0x24de3d[_0xb1f9('0x44')]['id'],_0x4b769d[_0xb1f9('0x6d')]));return createBucket(_0x121f34['data1'],_0x121f34[_0xb1f9('0x87')],_0x4b769d[_0xb1f9('0x7d')],_0x4b769d['bucket']);}logger[_0xb1f9('0x63')](util['format'](_0xb1f9('0x8c'),_0x24de3d[_0xb1f9('0x44')]['id'],_0x4b769d[_0xb1f9('0x6d')]));return;}})[_0xb1f9('0x26')](function(_0x35838d){if(_0x34a42c[_0xb1f9('0x75')]===_0xb1f9('0x8d')){return transcribe(_0x24de3d[_0xb1f9('0x44')]['id'],_0x121f34['data1'],_0x121f34['data2'],_0x4b769d['transcribeRegion'],_0x4b769d[_0xb1f9('0x6d')],_0x34a42c[_0xb1f9('0x4d')],_0x4b769d[_0xb1f9('0x7e')]);}else{logger[_0xb1f9('0x63')](util[_0xb1f9('0x34')](_0xb1f9('0x8e'),_0x24de3d[_0xb1f9('0x44')]['id']));return{'transcribeStatus':_0xb1f9('0x8f')};}})[_0xb1f9('0x26')](function(_0x45092e){if(_0x45092e){_0x45092e['tempSentiment']=_0x24de3d[_0xb1f9('0x4a')]['runSentiment'];return _0x34a42c[_0xb1f9('0x90')](_0x45092e);}})['then'](respondWithResult(_0x44a71d,null))[_0xb1f9('0x42')](handleError(_0x44a71d,null));};function writeFile(_0xcfeb4e,_0x3c19c5){return new Promise(function(_0x19cc6b,_0xdd8c70){fs['writeFile'](_0x3c19c5,_0xcfeb4e,function(_0x18b803,_0x7d1666){if(_0x18b803){return _0xdd8c70(_0x18b803);}else{return _0x19cc6b(_0x7d1666);}});});}exports['downloadTranscribe']=function(_0x336e58,_0x15854b,_0x4b0cfe){return db[_0xb1f9('0x2e')]['findOne']({'where':{'id':_0x336e58[_0xb1f9('0x44')]['id']}})[_0xb1f9('0x26')](handleEntityNotFound(_0x15854b))['then'](function(_0xd0e274){if(_0xd0e274&&_0xd0e274[_0xb1f9('0x91')]){var _0x49533a=_0xd0e274[_0xb1f9('0x91')];var _0x1279f6=config[_0xb1f9('0x92')]+_0xb1f9('0x93')+_0xd0e274['id']+_0xb1f9('0x94');if(fs[_0xb1f9('0x4f')](_0x1279f6)){return _0x1279f6;}return writeFile(_0x49533a,_0x1279f6)[_0xb1f9('0x26')](function(){return _0x1279f6;});}else{throw new db[(_0xb1f9('0x78'))][(_0xb1f9('0x50'))]('Transcript\x20not\x20available');}})[_0xb1f9('0x26')](function(_0x23b7be){return _0x15854b[_0xb1f9('0x52')](_0x23b7be);})['catch'](handleError(_0x15854b));}; \ No newline at end of file +var _0xe0e9=['VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','../../components/encryptor','sequelize','MD5','col','token','uniqueid','$and','push','Sequelize','destroy','Entity\x20not\x20found','info','isNil','unlinkSync','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','fileText','root','/server/files/transcribes/transcribe_','.txt','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','uuid/v4','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','VoiceRecording','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','count','includeAll','rows','catch','show','rawAttributes','fields','include','find','create','body','describe','download','params','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError'];(function(_0x141a2c,_0x363af0){var _0x25e0e4=function(_0xdc6572){while(--_0xdc6572){_0x141a2c['push'](_0x141a2c['shift']());}};_0x25e0e4(++_0x363af0);}(_0xe0e9,0xdf));var _0x9e0e=function(_0x1a438e,_0x19709d){_0x1a438e=_0x1a438e-0x0;var _0x13cf5a=_0xe0e9[_0x1a438e];return _0x13cf5a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e0e('0x0'));var zipdir=require(_0x9e0e('0x1'));var jsonpatch=require(_0x9e0e('0x2'));var rp=require(_0x9e0e('0x3'));var moment=require(_0x9e0e('0x4'));var BPromise=require(_0x9e0e('0x5'));var Mustache=require(_0x9e0e('0x6'));var util=require(_0x9e0e('0x7'));var path=require(_0x9e0e('0x8'));var sox=require('sox');var csv=require(_0x9e0e('0x9'));var ejs=require(_0x9e0e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9e0e('0xb'));var squel=require(_0x9e0e('0xc'));var crypto=require(_0x9e0e('0xd'));var jsforce=require(_0x9e0e('0xe'));var deskjs=require(_0x9e0e('0xf'));var toCsv=require(_0x9e0e('0x9'));var querystring=require(_0x9e0e('0x10'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0x9e0e('0x11'));var Redis=require(_0x9e0e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9e0e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e0e('0x14'));var logger=require(_0x9e0e('0x15'))(_0x9e0e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9e0e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x556640,_0x44d953){_0x44d953=_0x44d953||0xcc;return function(_0x35d8f0){if(_0x35d8f0){return _0x556640[_0x9e0e('0x18')](_0x44d953);}return _0x556640[_0x9e0e('0x19')](_0x44d953)[_0x9e0e('0x1a')]();};}function respondWithResult(_0x59a389,_0xfb17c8){_0xfb17c8=_0xfb17c8||0xc8;return function(_0x5f7b15){if(_0x5f7b15){return _0x59a389[_0x9e0e('0x19')](_0xfb17c8)[_0x9e0e('0x1b')](_0x5f7b15);}};}function respondWithFilteredResult(_0x476204,_0x3c663a){return function(_0x10ea6a){if(_0x10ea6a){var _0x43ace5=typeof _0x3c663a[_0x9e0e('0x1c')]===_0x9e0e('0x1d')&&typeof _0x3c663a[_0x9e0e('0x1e')]===_0x9e0e('0x1d');var _0x51b8bc=_0x10ea6a['count'];var _0x4bf81a=_0x43ace5?0x0:_0x3c663a[_0x9e0e('0x1c')];var _0x3300b0=_0x43ace5?_0x10ea6a['count']:_0x3c663a['offset']+_0x3c663a[_0x9e0e('0x1e')];var _0x48876d;if(_0x3300b0>=_0x51b8bc){_0x3300b0=_0x51b8bc;_0x48876d=0xc8;}else{_0x48876d=0xce;}_0x476204[_0x9e0e('0x19')](_0x48876d);return _0x476204[_0x9e0e('0x1f')](_0x9e0e('0x20'),_0x4bf81a+'-'+_0x3300b0+'/'+_0x51b8bc)[_0x9e0e('0x1b')](_0x10ea6a);}return null;};}function patchUpdates(_0x29c1a7){return function(_0x448fa3){try{jsonpatch['apply'](_0x448fa3,_0x29c1a7,!![]);}catch(_0x3bd3c1){return BPromise[_0x9e0e('0x21')](_0x3bd3c1);}return _0x448fa3[_0x9e0e('0x22')]();};}function saveUpdates(_0x25c45c,_0xbf0336){return function(_0xbe94cc){if(_0xbe94cc){return _0xbe94cc[_0x9e0e('0x23')](_0x25c45c)[_0x9e0e('0x24')](function(_0x266d16){return _0x266d16;});}return null;};}function removeEntity(_0x2b9552,_0x12c5f8){return function(_0x2605dc){if(_0x2605dc){return _0x2605dc['destroy']()[_0x9e0e('0x24')](function(){_0x2b9552[_0x9e0e('0x19')](0xcc)[_0x9e0e('0x1a')]();});}};}function handleEntityNotFound(_0x19447e,_0x401988){return function(_0x4d813c){if(!_0x4d813c){_0x19447e[_0x9e0e('0x18')](0x194);}return _0x4d813c;};}function handleError(_0xf0d10a,_0x17e0a3){_0x17e0a3=_0x17e0a3||0x1f4;return function(_0x562172){logger[_0x9e0e('0x25')](_0x562172[_0x9e0e('0x26')]);if(_0x562172[_0x9e0e('0x27')]){delete _0x562172[_0x9e0e('0x27')];}_0xf0d10a['status'](_0x17e0a3)[_0x9e0e('0x28')](_0x562172);};}exports[_0x9e0e('0x29')]=function(_0x1bd0e7,_0x1d6313){var _0x3fcc5b={},_0x273e00={},_0x52a155={'count':0x0,'rows':[]};var _0x113c83=_[_0x9e0e('0x2a')](db[_0x9e0e('0x2b')]['rawAttributes'],function(_0x2ca2c7){return{'name':_0x2ca2c7[_0x9e0e('0x2c')],'type':_0x2ca2c7[_0x9e0e('0x2d')][_0x9e0e('0x2e')]};});_0x273e00[_0x9e0e('0x2f')]=_[_0x9e0e('0x30')](_['map'](_0x113c83,_0x9e0e('0x27')),[_0x9e0e('0x31')]);_0x273e00[_0x9e0e('0x32')]=_[_0x9e0e('0x33')](_0x1bd0e7['query']);_0x273e00[_0x9e0e('0x34')]=_['intersection'](_0x273e00[_0x9e0e('0x2f')],_0x273e00['query']);_0x3fcc5b[_0x9e0e('0x35')]=_[_0x9e0e('0x36')](_0x273e00['model'],qs['fields'](_0x1bd0e7[_0x9e0e('0x32')]['fields']));_0x3fcc5b['attributes']=_0x3fcc5b[_0x9e0e('0x35')]['length']?_0x3fcc5b['attributes']:_0x273e00[_0x9e0e('0x2f')];if(!_0x1bd0e7[_0x9e0e('0x32')][_0x9e0e('0x37')](_0x9e0e('0x38'))){_0x3fcc5b[_0x9e0e('0x1e')]=qs[_0x9e0e('0x1e')](_0x1bd0e7[_0x9e0e('0x32')][_0x9e0e('0x1e')]);_0x3fcc5b['offset']=qs[_0x9e0e('0x1c')](_0x1bd0e7['query'][_0x9e0e('0x1c')]);}_0x3fcc5b[_0x9e0e('0x39')]=qs['sort'](_0x1bd0e7[_0x9e0e('0x32')][_0x9e0e('0x3a')]);_0x3fcc5b['where']=qs['filters'](_['pick'](_0x1bd0e7[_0x9e0e('0x32')],_0x273e00[_0x9e0e('0x34')]),_0x113c83);if(_0x1bd0e7[_0x9e0e('0x32')]['filter']){_0x3fcc5b[_0x9e0e('0x3b')]=_['merge'](_0x3fcc5b[_0x9e0e('0x3b')],{'$or':_['map'](_0x113c83,function(_0x3c9437){if(_0x3c9437[_0x9e0e('0x2d')]!==_0x9e0e('0x3c')){var _0x51d052={};_0x51d052[_0x3c9437['name']]={'$like':'%'+_0x1bd0e7['query'][_0x9e0e('0x3d')]+'%'};return _0x51d052;}})});}_0x3fcc5b=_[_0x9e0e('0x3e')]({},_0x3fcc5b,_0x1bd0e7[_0x9e0e('0x3f')]);var _0x5a331c={'where':_0x3fcc5b[_0x9e0e('0x3b')]};return db['VoiceRecording'][_0x9e0e('0x40')](_0x5a331c)[_0x9e0e('0x24')](function(_0xdbc3b4){_0x52a155[_0x9e0e('0x40')]=_0xdbc3b4;if(_0x1bd0e7['query'][_0x9e0e('0x41')]){_0x3fcc5b['include']=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x3fcc5b);})[_0x9e0e('0x24')](function(_0x2e0c8e){_0x52a155[_0x9e0e('0x42')]=_0x2e0c8e;return _0x52a155;})[_0x9e0e('0x24')](respondWithFilteredResult(_0x1d6313,_0x3fcc5b))[_0x9e0e('0x43')](handleError(_0x1d6313,null));};exports[_0x9e0e('0x44')]=function(_0x36d4e1,_0x2a6caa){var _0x595f78={'raw':![],'where':{'id':_0x36d4e1['params']['id']}},_0x50e45c={};_0x50e45c[_0x9e0e('0x2f')]=_[_0x9e0e('0x33')](db[_0x9e0e('0x2b')][_0x9e0e('0x45')]);_0x50e45c[_0x9e0e('0x32')]=_[_0x9e0e('0x33')](_0x36d4e1['query']);_0x50e45c[_0x9e0e('0x34')]=_[_0x9e0e('0x36')](_0x50e45c['model'],_0x50e45c[_0x9e0e('0x32')]);_0x595f78['attributes']=_[_0x9e0e('0x36')](_0x50e45c['model'],qs[_0x9e0e('0x46')](_0x36d4e1[_0x9e0e('0x32')][_0x9e0e('0x46')]));_0x595f78[_0x9e0e('0x35')]=_0x595f78[_0x9e0e('0x35')]['length']?_0x595f78[_0x9e0e('0x35')]:_0x50e45c[_0x9e0e('0x2f')];if(_0x36d4e1[_0x9e0e('0x32')][_0x9e0e('0x41')]){_0x595f78[_0x9e0e('0x47')]=[{'all':!![]}];}_0x595f78=_[_0x9e0e('0x3e')]({},_0x595f78,_0x36d4e1[_0x9e0e('0x3f')]);return db[_0x9e0e('0x2b')][_0x9e0e('0x48')](_0x595f78)[_0x9e0e('0x24')](handleEntityNotFound(_0x2a6caa,null))['then'](respondWithResult(_0x2a6caa,null))['catch'](handleError(_0x2a6caa,null));};exports[_0x9e0e('0x49')]=function(_0x23a143,_0x1208dd){return db[_0x9e0e('0x2b')]['create'](_0x23a143[_0x9e0e('0x4a')],{})[_0x9e0e('0x24')](respondWithResult(_0x1208dd,0xc9))['catch'](handleError(_0x1208dd,null));};exports[_0x9e0e('0x23')]=function(_0xb10af6,_0x38dfa3){if(_0xb10af6['body']['id']){delete _0xb10af6[_0x9e0e('0x4a')]['id'];}return db[_0x9e0e('0x2b')][_0x9e0e('0x48')]({'where':{'id':_0xb10af6['params']['id']}})[_0x9e0e('0x24')](handleEntityNotFound(_0x38dfa3,null))[_0x9e0e('0x24')](saveUpdates(_0xb10af6[_0x9e0e('0x4a')],null))['then'](respondWithResult(_0x38dfa3,null))['catch'](handleError(_0x38dfa3,null));};exports[_0x9e0e('0x4b')]=function(_0x5c7442,_0xe8e2f6){return db[_0x9e0e('0x2b')][_0x9e0e('0x4b')]()[_0x9e0e('0x24')](respondWithResult(_0xe8e2f6,null))['catch'](handleError(_0xe8e2f6,null));};exports[_0x9e0e('0x4c')]=function(_0x37968e,_0x88272f,_0x2b9f71){var _0x217953=require('../../components/encryptor');var _0x132dc2=![];var _0x138a46={};if(_0x37968e[_0x9e0e('0x32')][_0x9e0e('0x2d')]&&_0x37968e['query'][_0x9e0e('0x2d')]==='uniqueid'){_0x138a46['uniqueid']=_0x37968e['params']['id'];}else{_0x138a46['id']=_0x37968e[_0x9e0e('0x4d')]['id'];}return db['VoiceRecording'][_0x9e0e('0x48')]({'where':_0x138a46,'attributes':['id',_0x9e0e('0x4e')],'raw':!![]})[_0x9e0e('0x24')](handleEntityNotFound(_0x88272f,null))['then'](function(_0x279fc1){if(_0x279fc1){var _0x16ad7c=_0x279fc1['value'];var _0x122858=util[_0x9e0e('0x31')](_0x9e0e('0x4f'),_0x16ad7c);if(fs[_0x9e0e('0x50')](_0x122858)){_0x132dc2=!![];return _0x217953[_0x9e0e('0x51')](_0x122858,_0x16ad7c,config[_0x9e0e('0x52')][_0x9e0e('0x53')])['then'](function(){return _0x279fc1;});}return _0x279fc1;}})[_0x9e0e('0x24')](function(_0x1c8537){if(_0x1c8537){var _0x2f9c75=_0x1c8537[_0x9e0e('0x4e')];if(!fs[_0x9e0e('0x50')](_0x2f9c75)){throw new db['Sequelize'][(_0x9e0e('0x54'))](_0x9e0e('0x55'));}if(_0x1c8537[_0x9e0e('0x56')]){return _0x88272f[_0x9e0e('0x4c')](_0x2f9c75,_0x1c8537[_0x9e0e('0x56')]+path[_0x9e0e('0x57')](_0x2f9c75),function(){if(_0x132dc2){fs[_0x9e0e('0x58')](_0x2f9c75);}});}else{return _0x88272f[_0x9e0e('0x4c')](_0x2f9c75,function(_0x4293e3){if(_0x132dc2){fs[_0x9e0e('0x58')](_0x2f9c75);}});}}})[_0x9e0e('0x43')](function(_0x3a7b35){if(_0x3a7b35[_0x9e0e('0x59')]==='VoiceRecording\x20not\x20found'){_0x88272f['status'](0x194)[_0x9e0e('0x28')](_0x9e0e('0x5a'));}else{return handleError(_0x88272f,null);}});};exports['downloads']=function(_0x3a060e,_0x2b5618,_0x14311b){var _0x7d9692=require(_0x9e0e('0x5b'));var _0x10221d=![];var _0x4ad002={'$and':[db[_0x9e0e('0x5c')][_0x9e0e('0x3b')](db[_0x9e0e('0x5c')]['fn'](_0x9e0e('0x5d'),db[_0x9e0e('0x5c')][_0x9e0e('0x5e')]('uniqueid')),_0x3a060e[_0x9e0e('0x32')][_0x9e0e('0x5f')])]};if(_0x3a060e[_0x9e0e('0x32')][_0x9e0e('0x2d')]&&_0x3a060e['query']['type']===_0x9e0e('0x60')){_0x4ad002[_0x9e0e('0x61')][_0x9e0e('0x62')]({'uniqueid':_0x3a060e[_0x9e0e('0x4d')]['id']});}else{_0x4ad002[_0x9e0e('0x61')][_0x9e0e('0x62')]({'id':_0x3a060e[_0x9e0e('0x4d')]['id']});}return db[_0x9e0e('0x2b')][_0x9e0e('0x48')]({'where':_0x4ad002,'attributes':['id',_0x9e0e('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x2b5618,null))[_0x9e0e('0x24')](function(_0x37d1bd){if(_0x37d1bd){var _0x1f1485=util[_0x9e0e('0x31')](_0x9e0e('0x4f'),_0x37d1bd['value']);if(fs[_0x9e0e('0x50')](_0x1f1485)){_0x10221d=!![];return _0x7d9692[_0x9e0e('0x51')](_0x1f1485,_0x37d1bd[_0x9e0e('0x4e')],config[_0x9e0e('0x52')]['recording'])[_0x9e0e('0x24')](function(){return _0x37d1bd;});}return _0x37d1bd;}})[_0x9e0e('0x24')](function(_0x11193b){if(_0x11193b){if(!fs[_0x9e0e('0x50')](_0x11193b[_0x9e0e('0x4e')])){throw new db[(_0x9e0e('0x63'))]['ValidationError'](_0x9e0e('0x55'));}if(_0x11193b['filename']){return _0x2b5618[_0x9e0e('0x4c')](_0x11193b['value'],_0x11193b[_0x9e0e('0x56')]+path['extname'](_0x11193b['value']),function(){if(_0x10221d){fs['unlink'](_0x11193b['value']);}});}else{return _0x2b5618['download'](_0x11193b[_0x9e0e('0x4e')],function(_0x23cbe3){if(_0x10221d){fs['unlink'](_0x11193b[_0x9e0e('0x4e')]);}});}}})[_0x9e0e('0x43')](handleError(_0x2b5618,null));};exports[_0x9e0e('0x64')]=function(_0x1d5f5e,_0x212a5d){return db[_0x9e0e('0x2b')][_0x9e0e('0x48')]({'where':{'id':_0x1d5f5e[_0x9e0e('0x4d')]['id']}})['then'](function(_0x222a3c){if(_['isNil'](_0x222a3c)){throw new ReferenceError(_0x9e0e('0x65'));}return _0x222a3c;})[_0x9e0e('0x24')](function(_0x111c0c){var _0x57a5eb=_0x111c0c[_0x9e0e('0x4e')];logger[_0x9e0e('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0x57a5eb);if(!_[_0x9e0e('0x67')](_0x111c0c[_0x9e0e('0x4e')])&&fs[_0x9e0e('0x50')](_0x57a5eb)){logger[_0x9e0e('0x66')]('File:\x20\x22'+_0x57a5eb+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x9e0e('0x68')](_0x57a5eb);}_0x57a5eb=_0x57a5eb+_0x9e0e('0x69');if(!_[_0x9e0e('0x67')](_0x111c0c['value'])&&fs[_0x9e0e('0x50')](_0x57a5eb)){logger[_0x9e0e('0x66')](_0x9e0e('0x6a')+_0x57a5eb+_0x9e0e('0x6b'));fs[_0x9e0e('0x68')](_0x57a5eb);}return _0x111c0c;})[_0x9e0e('0x24')](function(_0x33304a){if(!_0x33304a)throw new InternalError();return _0x33304a[_0x9e0e('0x64')]();})[_0x9e0e('0x24')](function(){_0x212a5d[_0x9e0e('0x19')](0xcc)[_0x9e0e('0x1a')]();})[_0x9e0e('0x43')](handleError(_0x212a5d,null));};function getBucketslist(_0x379a52,_0x5ae984,_0x8987e6){return new Promise(function(_0x453f68,_0x76dfc){var _0x38389b=new AWS['S3']({'accessKeyId':_0x5ae984,'secretAccessKey':_0x379a52,'region':_0x8987e6});_0x38389b[_0x9e0e('0x6c')]({},function(_0x34ce1b,_0x287346){if(_0x34ce1b){return _0x76dfc(_0x34ce1b);}else{return _0x453f68(_0x287346);}});});}function createBucket(_0x50054a,_0x37896d,_0x5699bc,_0x72cf6){return new Promise(function(_0x164cfb,_0x33995c){var _0x5d2553=new AWS['S3']({'accessKeyId':_0x37896d,'secretAccessKey':_0x50054a,'region':_0x5699bc});_0x5d2553[_0x9e0e('0x6d')]({'Bucket':_0x72cf6},function(_0x166f94,_0x5b5a69){if(_0x166f94){return _0x33995c(_0x166f94);}else{return _0x164cfb(_0x5b5a69);}});});}function uploadFile(_0x44e904,_0x33d6b3,_0x1806f9,_0x5a7212,_0x48761e,_0x4fdd8d){return new Promise(function(_0x384026,_0x4fea33){var _0x5564f5=new AWS['S3']({'accessKeyId':_0x33d6b3,'secretAccessKey':_0x44e904,'region':_0x1806f9});_0x5564f5[_0x9e0e('0x6e')]({'Bucket':_0x5a7212,'Key':_0x48761e,'Body':_0x4fdd8d},function(_0x1ba4c2,_0x24ca64){if(_0x1ba4c2){return _0x4fea33(_0x1ba4c2);}else{return _0x384026(_0x24ca64);}});});}function startTranscribe(_0x2c0c17,_0x53e5b8,_0x1f0328,_0x4e06a0,_0x288856,_0x2ed92d){return new Promise(function(_0x1022ba,_0x18eebd){var _0x1a630a=new AWS[(_0x9e0e('0x6f'))]({'accessKeyId':_0x53e5b8,'secretAccessKey':_0x2c0c17,'region':_0x1f0328});_0x1a630a['startTranscriptionJob']({'TranscriptionJobName':_0x4e06a0,'LanguageCode':_0x288856,'Media':{'MediaFileUri':_0x2ed92d}},function(_0x56759e,_0x43476c){if(_0x56759e){return _0x18eebd(_0x56759e);}else{return _0x1022ba(_0x43476c);}});});}function transcribe(_0x3489a6,_0x4ee378,_0x437dac,_0x47c779,_0x17f7b6,_0x586d29,_0x446f0b){return new Promise(function(_0x2bcbd4,_0x237920){var _0x1c811c={};logger[_0x9e0e('0x66')](util[_0x9e0e('0x31')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x3489a6,_0x17f7b6));return uploadFile(_0x4ee378,_0x437dac,_0x47c779,_0x17f7b6,path[_0x9e0e('0x70')](_0x586d29),fs[_0x9e0e('0x71')](_0x586d29))[_0x9e0e('0x24')](function(_0x2870dd){logger[_0x9e0e('0x66')](util[_0x9e0e('0x31')](_0x9e0e('0x72'),_0x3489a6,_0x17f7b6,_0x2870dd[_0x9e0e('0x73')]));_0x1c811c[_0x9e0e('0x74')]=_0x2870dd[_0x9e0e('0x75')];_0x1c811c[_0x9e0e('0x76')]=_0x2870dd[_0x9e0e('0x73')];logger[_0x9e0e('0x66')](util[_0x9e0e('0x31')](_0x9e0e('0x77'),_0x3489a6));return startTranscribe(_0x4ee378,_0x437dac,_0x47c779,uuidv4(),_0x446f0b,_0x2870dd[_0x9e0e('0x73')]);})[_0x9e0e('0x24')](function(_0x5ef318){logger['info'](util[_0x9e0e('0x31')](_0x9e0e('0x78'),_0x3489a6,_0x5ef318[_0x9e0e('0x79')]['TranscriptionJobName']));_0x1c811c['transcribeName']=_0x5ef318['TranscriptionJob'][_0x9e0e('0x7a')];_0x1c811c['transcribeStatus']=_0x5ef318['TranscriptionJob'][_0x9e0e('0x7b')];return _0x2bcbd4(_0x1c811c);})[_0x9e0e('0x43')](function(_0x370436){return _0x237920(_0x370436);});});}exports[_0x9e0e('0x7c')]=function(_0x4211c4,_0x1ea0f4,_0x3cfade){var _0x594249;var _0x161c74;var _0x2650c8;var _0x1918a9=require(_0x9e0e('0x5b'));return db[_0x9e0e('0x2b')][_0x9e0e('0x7d')]({'where':{'id':_0x4211c4[_0x9e0e('0x4d')]['id']}})['then'](function(_0x30dd85){if(_0x30dd85){var _0x1adf2c=util[_0x9e0e('0x31')]('%s.cypher',_0x30dd85['value']);if(fs['existsSync'](_0x1adf2c)){cypher=!![];return _0x1918a9[_0x9e0e('0x51')](_0x1adf2c,_0x30dd85['value'],config[_0x9e0e('0x52')][_0x9e0e('0x53')])[_0x9e0e('0x24')](function(){return _0x30dd85;});}return _0x30dd85;}})['then'](function(_0x11338c){if(!_0x11338c){throw new db[(_0x9e0e('0x63'))][(_0x9e0e('0x54'))](_0x9e0e('0x7e'));}_0x161c74=_0x11338c;return db[_0x9e0e('0x7f')][_0x9e0e('0x7d')]({'where':{'id':0x1}});})[_0x9e0e('0x24')](handleEntityNotFound(_0x1ea0f4,null))[_0x9e0e('0x24')](function(_0x5721f4){if(_0x5721f4){_0x594249=_0x5721f4;if(!_0x594249[_0x9e0e('0x80')]||!_0x594249[_0x9e0e('0x81')]||!_0x594249[_0x9e0e('0x82')]||!_0x594249['language']||!_0x594249['bucket']){throw new db[(_0x9e0e('0x63'))][(_0x9e0e('0x54'))](_0x9e0e('0x83'));}if(_0x4211c4[_0x9e0e('0x4a')][_0x9e0e('0x84')]&&(!_0x594249[_0x9e0e('0x85')]||!_0x594249[_0x9e0e('0x86')]||!_0x594249[_0x9e0e('0x87')]||!_0x594249[_0x9e0e('0x88')]||!_0x594249[_0x9e0e('0x74')])){throw new db[(_0x9e0e('0x63'))][(_0x9e0e('0x54'))](_0x9e0e('0x89'));}return db['CloudProvider'][_0x9e0e('0x7d')]({'where':{'id':_0x594249[_0x9e0e('0x81')]}});}})[_0x9e0e('0x24')](function(_0x18f117){if(!_0x18f117){throw new db[(_0x9e0e('0x63'))][(_0x9e0e('0x54'))](_0x9e0e('0x8a'));}if(!_0x18f117[_0x9e0e('0x8b')]||!_0x18f117[_0x9e0e('0x8c')]){throw new db['Sequelize'][(_0x9e0e('0x54'))]('Cloud\x20Provider\x20not\x20configured');}_0x2650c8=_0x18f117;return getBucketslist(_0x2650c8[_0x9e0e('0x8b')],_0x2650c8[_0x9e0e('0x8c')],_0x594249[_0x9e0e('0x82')]);})[_0x9e0e('0x24')](function(_0x3c997a){if(_0x3c997a&&_0x3c997a[_0x9e0e('0x8d')]){var _0x3e2545=_[_0x9e0e('0x48')](_0x3c997a['Buckets'],function(_0x5035e6){return _0x5035e6[_0x9e0e('0x8e')]===_0x594249['bucket'];});if(!_0x3e2545){logger[_0x9e0e('0x66')](util[_0x9e0e('0x31')](_0x9e0e('0x8f'),_0x4211c4['params']['id'],_0x594249[_0x9e0e('0x74')]));return createBucket(_0x2650c8[_0x9e0e('0x8b')],_0x2650c8['data2'],_0x594249[_0x9e0e('0x82')],_0x594249['bucket']);}logger[_0x9e0e('0x66')](util[_0x9e0e('0x31')](_0x9e0e('0x90'),_0x4211c4[_0x9e0e('0x4d')]['id'],_0x594249[_0x9e0e('0x74')]));return;}})[_0x9e0e('0x24')](function(_0x227c0a){if(_0x161c74['transcribeStatus']===_0x9e0e('0x91')){return transcribe(_0x4211c4[_0x9e0e('0x4d')]['id'],_0x2650c8[_0x9e0e('0x8b')],_0x2650c8[_0x9e0e('0x8c')],_0x594249[_0x9e0e('0x82')],_0x594249[_0x9e0e('0x74')],_0x161c74[_0x9e0e('0x4e')],_0x594249[_0x9e0e('0x88')]);}else{logger['info'](util[_0x9e0e('0x31')](_0x9e0e('0x92'),_0x4211c4[_0x9e0e('0x4d')]['id']));return{'transcribeStatus':_0x9e0e('0x93')};}})['then'](function(_0x3a5d80){if(_0x3a5d80){_0x3a5d80[_0x9e0e('0x94')]=_0x4211c4[_0x9e0e('0x4a')][_0x9e0e('0x84')];return _0x161c74[_0x9e0e('0x95')](_0x3a5d80);}})[_0x9e0e('0x24')](respondWithResult(_0x1ea0f4,null))['catch'](handleError(_0x1ea0f4,null));};function writeFile(_0x5bb737,_0x3f25b8){return new Promise(function(_0x2eeb79,_0x3ec63f){fs['writeFile'](_0x3f25b8,_0x5bb737,function(_0x1f2eb9,_0x3daf6b){if(_0x1f2eb9){return _0x3ec63f(_0x1f2eb9);}else{return _0x2eeb79(_0x3daf6b);}});});}exports['downloadTranscribe']=function(_0x49fd74,_0x1afb48,_0x5771b5){return db[_0x9e0e('0x2b')][_0x9e0e('0x7d')]({'where':{'id':_0x49fd74[_0x9e0e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1afb48))[_0x9e0e('0x24')](function(_0x54b3a6){if(_0x54b3a6&&_0x54b3a6[_0x9e0e('0x96')]){var _0x28db2c=_0x54b3a6[_0x9e0e('0x96')];var _0x47f192=config[_0x9e0e('0x97')]+_0x9e0e('0x98')+_0x54b3a6['id']+_0x9e0e('0x99');if(fs[_0x9e0e('0x50')](_0x47f192)){return _0x47f192;}return writeFile(_0x28db2c,_0x47f192)['then'](function(){return _0x47f192;});}else{throw new db[(_0x9e0e('0x63'))][(_0x9e0e('0x54'))]('Transcript\x20not\x20available');}})[_0x9e0e('0x24')](function(_0x259d94){return _0x1afb48['download'](_0x259d94);})[_0x9e0e('0x43')](handleError(_0x1afb48));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 8d6954e..99fdbcf 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 _0x5178=['define','VoiceRecording','uniqueid','transcribeStatus','exports'];(function(_0x5f2826,_0x375841){var _0x1f8f43=function(_0x166691){while(--_0x166691){_0x5f2826['push'](_0x5f2826['shift']());}};_0x1f8f43(++_0x375841);}(_0x5178,0x171));var _0x8517=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x5178[_0x6131cd];return _0x47e916;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x8517('0x0')]=function(_0x150a6a,_0x27662b){return _0x150a6a[_0x8517('0x1')](_0x8517('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8517('0x3')]},{'name':_0x8517('0x4'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe799=['VoiceRecording','uniqueid','transcribeStatus','./voiceRecording.attributes','define'];(function(_0x1ac8e1,_0x395baa){var _0x287e25=function(_0xf633ab){while(--_0xf633ab){_0x1ac8e1['push'](_0x1ac8e1['shift']());}};_0x287e25(++_0x395baa);}(_0xe799,0x170));var _0x9e79=function(_0x5ca6dd,_0xcfc331){_0x5ca6dd=_0x5ca6dd-0x0;var _0xd30189=_0xe799[_0x5ca6dd];return _0xd30189;};'use strict';var attributes=require(_0x9e79('0x0'));module['exports']=function(_0x3308ba,_0x59bc90){return _0x3308ba[_0x9e79('0x1')](_0x9e79('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x9e79('0x3'),'fields':[_0x9e79('0x3')]},{'name':_0x9e79('0x4'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index c2061ef..0116034 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 _0x5430=['info','request\x20sent','debug','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','UpdateVoiceRecording','VoiceRecording','options','raw','limit','catch','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','create','body','existsSync','format','%s.cypher','value','encryptFile','secrets','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x208d58,_0x165c3b){var _0x1c6bb7=function(_0x42dd2f){while(--_0x42dd2f){_0x208d58['push'](_0x208d58['shift']());}};_0x1c6bb7(++_0x165c3b);}(_0x5430,0x10c));var _0x0543=function(_0x111f9c,_0x114ab5){_0x111f9c=_0x111f9c-0x0;var _0x5b9a82=_0x5430[_0x111f9c];return _0x5b9a82;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});}exports[_0x0543('0x15')]=function(_0x20b396){var _0x285080=this;return new Promise(function(_0x577cf0,_0x5eb03e){return db[_0x0543('0x16')]['update'](_0x20b396['body'],{'raw':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20b396['options']?_0x20b396[_0x0543('0x17')]['where']||null:null,'attributes':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')]['attributes']||null:null,'limit':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x19')]||null:null})[_0x0543('0xb')](function(_0x37347e){logger[_0x0543('0xc')]('UpdateVoiceRecording',_0x20b396);logger['debug']('UpdateVoiceRecording',_0x20b396,JSON[_0x0543('0xf')](_0x37347e));_0x577cf0(_0x37347e);})[_0x0543('0x1a')](function(_0x15ebeb){logger[_0x0543('0x10')](_0x0543('0x15'),_0x15ebeb[_0x0543('0x13')],_0x20b396);_0x5eb03e(_0x285080[_0x0543('0x10')](0x1f4,_0x15ebeb[_0x0543('0x13')]));});});};exports[_0x0543('0x1b')]=function(_0xf1eccf){var _0x40a261=this;return new Promise(function(_0x21fc63,_0x547a88){var _0x25e6f1=require(_0x0543('0x1c'));var _0x30ad9e;return db['Setting'][_0x0543('0x1d')]({'attributes':['id',_0x0543('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0543('0xb')](function(_0x10b881){_0x30ad9e=_0x10b881;return db['VoiceRecording'][_0x0543('0x1f')](_0xf1eccf[_0x0543('0x20')]);})['then'](function(_0x576084){if(_0x30ad9e[_0x0543('0x1e')]&&fs[_0x0543('0x21')](_0x576084['value'])){var _0x3b879b=util[_0x0543('0x22')](_0x0543('0x23'),_0x576084[_0x0543('0x24')]);return _0x25e6f1[_0x0543('0x25')](_0x576084[_0x0543('0x24')],_0x3b879b,config[_0x0543('0x26')]['recording'])[_0x0543('0xb')](function(){fs['unlink'](_0x576084[_0x0543('0x24')]);logger[_0x0543('0xc')](_0x0543('0x27'));return _0x576084;});}return _0x576084;})[_0x0543('0xb')](function(_0x28307f){logger['info'](_0x0543('0x1b'),_0xf1eccf);logger['debug'](_0x0543('0x1b'),_0xf1eccf,JSON[_0x0543('0xf')](_0x28307f));_0x21fc63(_0x28307f);})[_0x0543('0x1a')](function(_0x327027){logger['error'](_0x0543('0x1b'),_0x327027['message'],_0xf1eccf);_0x547a88(_0x40a261[_0x0543('0x10')](0x1f4,_0x327027[_0x0543('0x13')]));});});}; \ No newline at end of file +var _0x4975=['catch','VoiceRecording','update','body','options','raw','where','limit','then','UpdateVoiceRecording','CreateVoiceRecording','create','value','format','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x533528,_0x409d05){var _0x3189f1=function(_0x5e63d2){while(--_0x5e63d2){_0x533528['push'](_0x533528['shift']());}};_0x3189f1(++_0x409d05);}(_0x4975,0x86));var _0x5497=function(_0x5b68b3,_0x468acb){_0x5b68b3=_0x5b68b3-0x0;var _0xf0853c=_0x4975[_0x5b68b3];return _0xf0853c;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});}exports['UpdateVoiceRecording']=function(_0x3f4d20){var _0x1bf442=this;return new Promise(function(_0x3a47fd,_0x5d9e24){return db[_0x5497('0x17')][_0x5497('0x18')](_0x3f4d20[_0x5497('0x19')],{'raw':_0x3f4d20[_0x5497('0x1a')]?_0x3f4d20[_0x5497('0x1a')][_0x5497('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f4d20[_0x5497('0x1a')]?_0x3f4d20[_0x5497('0x1a')][_0x5497('0x1c')]||null:null,'attributes':_0x3f4d20[_0x5497('0x1a')]?_0x3f4d20[_0x5497('0x1a')]['attributes']||null:null,'limit':_0x3f4d20[_0x5497('0x1a')]?_0x3f4d20['options'][_0x5497('0x1d')]||null:null})[_0x5497('0x1e')](function(_0x44265c){logger[_0x5497('0xd')](_0x5497('0x1f'),_0x3f4d20);logger[_0x5497('0x10')]('UpdateVoiceRecording',_0x3f4d20,JSON['stringify'](_0x44265c));_0x3a47fd(_0x44265c);})[_0x5497('0x16')](function(_0x34b97f){logger[_0x5497('0x13')](_0x5497('0x1f'),_0x34b97f['message'],_0x3f4d20);_0x5d9e24(_0x1bf442[_0x5497('0x13')](0x1f4,_0x34b97f['message']));});});};exports[_0x5497('0x20')]=function(_0x16a2b4){var _0x429d36=this;return new Promise(function(_0x34a1a5,_0x163a30){var _0x31cd01=require('../../components/encryptor');var _0x4af5f4;return db['Setting']['findOne']({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x5497('0x1e')](function(_0x48d146){_0x4af5f4=_0x48d146;return db['VoiceRecording'][_0x5497('0x21')](_0x16a2b4[_0x5497('0x19')]);})[_0x5497('0x1e')](function(_0x4c442a){if(_0x4af5f4['callRecordingEncryption']&&fs['existsSync'](_0x4c442a[_0x5497('0x22')])){var _0x471e0b=util[_0x5497('0x23')]('%s.cypher',_0x4c442a['value']);return _0x31cd01['encryptFile'](_0x4c442a[_0x5497('0x22')],_0x471e0b,config['secrets'][_0x5497('0x24')])[_0x5497('0x1e')](function(){fs[_0x5497('0x25')](_0x4c442a['value']);logger[_0x5497('0xd')](_0x5497('0x26'));return _0x4c442a;});}return _0x4c442a;})['then'](function(_0xce7cb2){logger[_0x5497('0xd')](_0x5497('0x20'),_0x16a2b4);logger['debug'](_0x5497('0x20'),_0x16a2b4,JSON[_0x5497('0x12')](_0xce7cb2));_0x34a1a5(_0xce7cb2);})[_0x5497('0x16')](function(_0x362b96){logger[_0x5497('0x13')]('CreateVoiceRecording',_0x362b96[_0x5497('0x14')],_0x16a2b4);_0x163a30(_0x429d36[_0x5497('0x13')](0x1f4,_0x362b96['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 99de93e..9e3d787 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 _0x05ae=['update','delete','destroy','exports','multer','path','express','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x293e7a,_0x1792a2){var _0xb78342=function(_0x833afe){while(--_0x833afe){_0x293e7a['push'](_0x293e7a['shift']());}};_0xb78342(++_0x1792a2);}(_0x05ae,0x10e));var _0xe05a=function(_0x158b72,_0xc0c898){_0x158b72=_0x158b72-0x0;var _0x3c7fc8=_0x05ae[_0x158b72];return _0x3c7fc8;};'use strict';var multer=require(_0xe05a('0x0'));var util=require('util');var path=require(_0xe05a('0x1'));var timeout=require('connect-timeout');var express=require(_0xe05a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe05a('0x3'));var config=require('../../config/environment');var controller=require(_0xe05a('0x4'));router[_0xe05a('0x5')]('/',auth[_0xe05a('0x6')](),controller[_0xe05a('0x7')]);router[_0xe05a('0x5')](_0xe05a('0x8'),auth[_0xe05a('0x6')](),controller[_0xe05a('0x9')]);router[_0xe05a('0x5')](_0xe05a('0xa'),auth[_0xe05a('0x6')](),controller[_0xe05a('0xb')]);router[_0xe05a('0xc')]('/',auth[_0xe05a('0x6')](),controller[_0xe05a('0xd')]);router[_0xe05a('0xe')](_0xe05a('0xa'),auth[_0xe05a('0x6')](),controller[_0xe05a('0xf')]);router[_0xe05a('0x10')](_0xe05a('0xa'),auth['isAuthenticated'](),controller[_0xe05a('0x11')]);module[_0xe05a('0x12')]=router; \ No newline at end of file +var _0x08e2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','express'];(function(_0x155fe6,_0x129957){var _0x516bd3=function(_0x8e02e9){while(--_0x8e02e9){_0x155fe6['push'](_0x155fe6['shift']());}};_0x516bd3(++_0x129957);}(_0x08e2,0xbb));var _0x208e=function(_0x370a1f,_0x49e83b){_0x370a1f=_0x370a1f-0x0;var _0x2342ed=_0x08e2[_0x370a1f];return _0x2342ed;};'use strict';var multer=require(_0x208e('0x0'));var util=require(_0x208e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x208e('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x208e('0x3'));var interaction=require(_0x208e('0x4'));var config=require(_0x208e('0x5'));var controller=require(_0x208e('0x6'));router['get']('/',auth[_0x208e('0x7')](),controller[_0x208e('0x8')]);router[_0x208e('0x9')]('/describe',auth[_0x208e('0x7')](),controller[_0x208e('0xa')]);router['get'](_0x208e('0xb'),auth[_0x208e('0x7')](),controller[_0x208e('0xc')]);router[_0x208e('0xd')]('/',auth[_0x208e('0x7')](),controller[_0x208e('0xe')]);router[_0x208e('0xf')](_0x208e('0xb'),auth[_0x208e('0x7')](),controller[_0x208e('0x10')]);router[_0x208e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x208e('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 25b5fd1..e42e06e 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 _0x1a62=['sequelize','moment','exports','ENUM','attended','STRING','Yes'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1a62,0xcb));var _0x21a6=function(_0x5d082a,_0x4aa33f){_0x5d082a=_0x5d082a-0x0;var _0xebd7f4=_0x1a62[_0x5d082a];return _0xebd7f4;};'use strict';var Sequelize=require(_0x21a6('0x0'));var moment=require(_0x21a6('0x1'));module[_0x21a6('0x2')]={'type':{'type':Sequelize[_0x21a6('0x3')]('blind',_0x21a6('0x4'))},'result':{'type':Sequelize[_0x21a6('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x21a6('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x21a6('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x21a6('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x21a6('0x5')]},'transferercontext':{'type':Sequelize[_0x21a6('0x5')]},'transfererexten':{'type':Sequelize[_0x21a6('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x21a6('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x21a6('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x21a6('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x21a6('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x21a6('0x5')]},'transfereecontext':{'type':Sequelize[_0x21a6('0x5')]},'transfereeexten':{'type':Sequelize[_0x21a6('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0x21a6('0x6'),'No')},'context':{'type':Sequelize[_0x21a6('0x5')]},'extension':{'type':Sequelize[_0x21a6('0x5')]}}; \ No newline at end of file +var _0x78c0=['exports','ENUM','blind','STRING','sequelize','moment'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x78c0,0x70));var _0x078c=function(_0x18f603,_0x552467){_0x18f603=_0x18f603-0x0;var _0x563027=_0x78c0[_0x18f603];return _0x563027;};'use strict';var Sequelize=require(_0x078c('0x0'));var moment=require(_0x078c('0x1'));module[_0x078c('0x2')]={'type':{'type':Sequelize[_0x078c('0x3')](_0x078c('0x4'),'attended')},'result':{'type':Sequelize[_0x078c('0x5')]},'transfererchannel':{'type':Sequelize[_0x078c('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x078c('0x5')]},'transferercalleridname':{'type':Sequelize[_0x078c('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x078c('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x078c('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x078c('0x5')]},'transferercontext':{'type':Sequelize[_0x078c('0x5')]},'transfererexten':{'type':Sequelize[_0x078c('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x078c('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x078c('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x078c('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x078c('0x5')]},'transfereeexten':{'type':Sequelize[_0x078c('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x078c('0x5')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0x078c('0x5')]},'extension':{'type':Sequelize[_0x078c('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index edec353..53f746c 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 _0x464f=['papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','VoiceTransferReport','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','querystring'];(function(_0x33d7be,_0x594f0d){var _0x1e0e2d=function(_0x1cbcf2){while(--_0x1cbcf2){_0x33d7be['push'](_0x33d7be['shift']());}};_0x1e0e2d(++_0x594f0d);}(_0x464f,0x116));var _0xf464=function(_0x1e5546,_0x3b69d6){_0x1e5546=_0x1e5546-0x0;var _0x3dca0a=_0x464f[_0x1e5546];return _0x3dca0a;};'use strict';var emlformat=require(_0xf464('0x0'));var rimraf=require(_0xf464('0x1'));var zipdir=require(_0xf464('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf464('0x3'));var Mustache=require(_0xf464('0x4'));var util=require(_0xf464('0x5'));var path=require(_0xf464('0x6'));var sox=require(_0xf464('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf464('0x8'));var _=require(_0xf464('0x9'));var squel=require(_0xf464('0xa'));var crypto=require(_0xf464('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf464('0xc'));var querystring=require(_0xf464('0xd'));var Papa=require(_0xf464('0xe'));var Redis=require(_0xf464('0xf'));var authService=require(_0xf464('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf464('0x11'))(_0xf464('0x12'));var utils=require(_0xf464('0x13'));var config=require(_0xf464('0x14'));var licenseUtil=require(_0xf464('0x15'));var db=require(_0xf464('0x16'))['db'];function respondWithStatusCode(_0x8e6f85,_0x561bb1){_0x561bb1=_0x561bb1||0xcc;return function(_0x563923){if(_0x563923){return _0x8e6f85[_0xf464('0x17')](_0x561bb1);}return _0x8e6f85[_0xf464('0x18')](_0x561bb1)['end']();};}function respondWithResult(_0x7a88ca,_0x3e386a){_0x3e386a=_0x3e386a||0xc8;return function(_0x565756){if(_0x565756){return _0x7a88ca[_0xf464('0x18')](_0x3e386a)['json'](_0x565756);}};}function respondWithFilteredResult(_0x3aaa94,_0x3ca95c){return function(_0x3cda41){if(_0x3cda41){var _0x445cb5=typeof _0x3ca95c[_0xf464('0x19')]===_0xf464('0x1a')&&typeof _0x3ca95c[_0xf464('0x1b')]===_0xf464('0x1a');var _0x522774=_0x3cda41[_0xf464('0x1c')];var _0x5936ec=_0x445cb5?0x0:_0x3ca95c[_0xf464('0x19')];var _0x526fb9=_0x445cb5?_0x3cda41['count']:_0x3ca95c[_0xf464('0x19')]+_0x3ca95c['limit'];var _0x342d69;if(_0x526fb9>=_0x522774){_0x526fb9=_0x522774;_0x342d69=0xc8;}else{_0x342d69=0xce;}_0x3aaa94[_0xf464('0x18')](_0x342d69);return _0x3aaa94[_0xf464('0x1d')](_0xf464('0x1e'),_0x5936ec+'-'+_0x526fb9+'/'+_0x522774)['json'](_0x3cda41);}return null;};}function patchUpdates(_0x3233e4){return function(_0x51458d){try{jsonpatch['apply'](_0x51458d,_0x3233e4,!![]);}catch(_0x3b5c7f){return BPromise[_0xf464('0x1f')](_0x3b5c7f);}return _0x51458d[_0xf464('0x20')]();};}function saveUpdates(_0x5daf19,_0x37fb3d){return function(_0x11a614){if(_0x11a614){return _0x11a614[_0xf464('0x21')](_0x5daf19)[_0xf464('0x22')](function(_0x5e6359){return _0x5e6359;});}return null;};}function removeEntity(_0x1ee6a9,_0x8e910a){return function(_0x10f223){if(_0x10f223){return _0x10f223[_0xf464('0x23')]()[_0xf464('0x22')](function(){_0x1ee6a9[_0xf464('0x18')](0xcc)[_0xf464('0x24')]();});}};}function handleEntityNotFound(_0x259809,_0x58458f){return function(_0x3fce56){if(!_0x3fce56){_0x259809['sendStatus'](0x194);}return _0x3fce56;};}function handleError(_0x28b56b,_0x171688){_0x171688=_0x171688||0x1f4;return function(_0x2c55f7){logger['error'](_0x2c55f7[_0xf464('0x25')]);if(_0x2c55f7['name']){delete _0x2c55f7[_0xf464('0x26')];}_0x28b56b[_0xf464('0x18')](_0x171688)['send'](_0x2c55f7);};}exports[_0xf464('0x27')]=function(_0x1ccda0,_0x1491ec){var _0xd5c9ef={},_0x4a6d53={},_0x13906a={'count':0x0,'rows':[]};var _0x505e6=_[_0xf464('0x28')](db['VoiceTransferReport']['rawAttributes'],function(_0x1dba83){return{'name':_0x1dba83[_0xf464('0x29')],'type':_0x1dba83[_0xf464('0x2a')][_0xf464('0x2b')]};});_0x4a6d53[_0xf464('0x2c')]=_[_0xf464('0x28')](_0x505e6,_0xf464('0x26'));_0x4a6d53[_0xf464('0x2d')]=_[_0xf464('0x2e')](_0x1ccda0[_0xf464('0x2d')]);_0x4a6d53[_0xf464('0x2f')]=_[_0xf464('0x30')](_0x4a6d53['model'],_0x4a6d53[_0xf464('0x2d')]);_0xd5c9ef[_0xf464('0x31')]=_[_0xf464('0x30')](_0x4a6d53[_0xf464('0x2c')],qs[_0xf464('0x32')](_0x1ccda0[_0xf464('0x2d')][_0xf464('0x32')]));_0xd5c9ef[_0xf464('0x31')]=_0xd5c9ef['attributes'][_0xf464('0x33')]?_0xd5c9ef['attributes']:_0x4a6d53[_0xf464('0x2c')];if(!_0x1ccda0['query']['hasOwnProperty']('nolimit')){_0xd5c9ef[_0xf464('0x1b')]=qs[_0xf464('0x1b')](_0x1ccda0['query'][_0xf464('0x1b')]);_0xd5c9ef[_0xf464('0x19')]=qs['offset'](_0x1ccda0[_0xf464('0x2d')][_0xf464('0x19')]);}_0xd5c9ef[_0xf464('0x34')]=qs[_0xf464('0x35')](_0x1ccda0[_0xf464('0x2d')]['sort']);_0xd5c9ef[_0xf464('0x36')]=qs[_0xf464('0x2f')](_[_0xf464('0x37')](_0x1ccda0['query'],_0x4a6d53[_0xf464('0x2f')]),_0x505e6);if(_0x1ccda0[_0xf464('0x2d')][_0xf464('0x38')]){_0xd5c9ef['where']=_['merge'](_0xd5c9ef['where'],{'$or':_[_0xf464('0x28')](_0x505e6,function(_0x563c2c){if(_0x563c2c[_0xf464('0x2a')]!==_0xf464('0x39')){var _0x10c3b9={};_0x10c3b9[_0x563c2c[_0xf464('0x26')]]={'$like':'%'+_0x1ccda0[_0xf464('0x2d')][_0xf464('0x38')]+'%'};return _0x10c3b9;}})});}_0xd5c9ef=_[_0xf464('0x3a')]({},_0xd5c9ef,_0x1ccda0[_0xf464('0x3b')]);var _0x4c6396={'where':_0xd5c9ef[_0xf464('0x36')]};return db[_0xf464('0x3c')][_0xf464('0x1c')](_0x4c6396)[_0xf464('0x22')](function(_0x79efd7){_0x13906a[_0xf464('0x1c')]=_0x79efd7;if(_0x1ccda0[_0xf464('0x2d')][_0xf464('0x3d')]){_0xd5c9ef['include']=[{'all':!![]}];}return db[_0xf464('0x3c')][_0xf464('0x3e')](_0xd5c9ef);})[_0xf464('0x22')](function(_0x4e8620){_0x13906a[_0xf464('0x3f')]=_0x4e8620;return _0x13906a;})[_0xf464('0x22')](respondWithFilteredResult(_0x1491ec,_0xd5c9ef))[_0xf464('0x40')](handleError(_0x1491ec,null));};exports[_0xf464('0x41')]=function(_0x4c023e,_0x482345){var _0x31b28f={'raw':!![],'where':{'id':_0x4c023e['params']['id']}},_0x391f51={};_0x391f51['model']=_[_0xf464('0x2e')](db['VoiceTransferReport'][_0xf464('0x42')]);_0x391f51[_0xf464('0x2d')]=_[_0xf464('0x2e')](_0x4c023e[_0xf464('0x2d')]);_0x391f51[_0xf464('0x2f')]=_[_0xf464('0x30')](_0x391f51['model'],_0x391f51[_0xf464('0x2d')]);_0x31b28f['attributes']=_[_0xf464('0x30')](_0x391f51[_0xf464('0x2c')],qs[_0xf464('0x32')](_0x4c023e[_0xf464('0x2d')]['fields']));_0x31b28f[_0xf464('0x31')]=_0x31b28f[_0xf464('0x31')]['length']?_0x31b28f['attributes']:_0x391f51['model'];if(_0x4c023e[_0xf464('0x2d')]['includeAll']){_0x31b28f[_0xf464('0x43')]=[{'all':!![]}];}_0x31b28f=_[_0xf464('0x3a')]({},_0x31b28f,_0x4c023e[_0xf464('0x3b')]);return db['VoiceTransferReport'][_0xf464('0x44')](_0x31b28f)['then'](handleEntityNotFound(_0x482345,null))['then'](respondWithResult(_0x482345,null))[_0xf464('0x40')](handleError(_0x482345,null));};exports[_0xf464('0x45')]=function(_0x2308ae,_0x280ed3){return db[_0xf464('0x3c')]['create'](_0x2308ae['body'],{})['then'](respondWithResult(_0x280ed3,0xc9))[_0xf464('0x40')](handleError(_0x280ed3,null));};exports[_0xf464('0x21')]=function(_0x56c190,_0x4724f6){if(_0x56c190[_0xf464('0x46')]['id']){delete _0x56c190['body']['id'];}return db[_0xf464('0x3c')]['find']({'where':{'id':_0x56c190['params']['id']}})[_0xf464('0x22')](handleEntityNotFound(_0x4724f6,null))[_0xf464('0x22')](saveUpdates(_0x56c190['body'],null))['then'](respondWithResult(_0x4724f6,null))[_0xf464('0x40')](handleError(_0x4724f6,null));};exports[_0xf464('0x23')]=function(_0x5e9b13,_0x31b387){return db[_0xf464('0x3c')][_0xf464('0x44')]({'where':{'id':_0x5e9b13[_0xf464('0x47')]['id']}})[_0xf464('0x22')](handleEntityNotFound(_0x31b387,null))[_0xf464('0x22')](removeEntity(_0x31b387,null))[_0xf464('0x40')](handleError(_0x31b387,null));};exports[_0xf464('0x48')]=function(_0x456844,_0x1ba7fe){return db[_0xf464('0x3c')][_0xf464('0x48')]()[_0xf464('0x22')](respondWithResult(_0x1ba7fe,null))[_0xf464('0x40')](handleError(_0x1ba7fe,null));}; \ No newline at end of file +var _0x2c05=['squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','VoiceTransferReport','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash'];(function(_0x114937,_0x45956b){var _0x5350af=function(_0x1cc369){while(--_0x1cc369){_0x114937['push'](_0x114937['shift']());}};_0x5350af(++_0x45956b);}(_0x2c05,0x1bc));var _0x52c0=function(_0x573bef,_0x182914){_0x573bef=_0x573bef-0x0;var _0x2ef4f4=_0x2c05[_0x573bef];return _0x2ef4f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x52c0('0x0'));var zipdir=require(_0x52c0('0x1'));var jsonpatch=require(_0x52c0('0x2'));var rp=require(_0x52c0('0x3'));var moment=require(_0x52c0('0x4'));var BPromise=require(_0x52c0('0x5'));var Mustache=require(_0x52c0('0x6'));var util=require(_0x52c0('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x52c0('0x8'));var ejs=require(_0x52c0('0x9'));var fs=require('fs');var fs_extra=require(_0x52c0('0xa'));var _=require(_0x52c0('0xb'));var squel=require(_0x52c0('0xc'));var crypto=require(_0x52c0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x52c0('0xe'));var toCsv=require(_0x52c0('0x8'));var querystring=require(_0x52c0('0xf'));var Papa=require(_0x52c0('0x10'));var Redis=require('ioredis');var authService=require(_0x52c0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x52c0('0x12'));var hardwareService=require(_0x52c0('0x13'));var logger=require(_0x52c0('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x52c0('0x15'));var licenseUtil=require(_0x52c0('0x16'));var db=require(_0x52c0('0x17'))['db'];function respondWithStatusCode(_0x40b56f,_0x486d1c){_0x486d1c=_0x486d1c||0xcc;return function(_0x379d9b){if(_0x379d9b){return _0x40b56f['sendStatus'](_0x486d1c);}return _0x40b56f[_0x52c0('0x18')](_0x486d1c)[_0x52c0('0x19')]();};}function respondWithResult(_0x312b75,_0x4937e2){_0x4937e2=_0x4937e2||0xc8;return function(_0xd5c425){if(_0xd5c425){return _0x312b75['status'](_0x4937e2)['json'](_0xd5c425);}};}function respondWithFilteredResult(_0x49339f,_0x14c343){return function(_0x155579){if(_0x155579){var _0x2d0ea5=typeof _0x14c343[_0x52c0('0x1a')]==='undefined'&&typeof _0x14c343[_0x52c0('0x1b')]===_0x52c0('0x1c');var _0x457161=_0x155579['count'];var _0x358c00=_0x2d0ea5?0x0:_0x14c343[_0x52c0('0x1a')];var _0x53adc4=_0x2d0ea5?_0x155579[_0x52c0('0x1d')]:_0x14c343['offset']+_0x14c343['limit'];var _0x19958a;if(_0x53adc4>=_0x457161){_0x53adc4=_0x457161;_0x19958a=0xc8;}else{_0x19958a=0xce;}_0x49339f[_0x52c0('0x18')](_0x19958a);return _0x49339f[_0x52c0('0x1e')]('Content-Range',_0x358c00+'-'+_0x53adc4+'/'+_0x457161)[_0x52c0('0x1f')](_0x155579);}return null;};}function patchUpdates(_0x2a0146){return function(_0x4b199f){try{jsonpatch[_0x52c0('0x20')](_0x4b199f,_0x2a0146,!![]);}catch(_0x9080d9){return BPromise[_0x52c0('0x21')](_0x9080d9);}return _0x4b199f[_0x52c0('0x22')]();};}function saveUpdates(_0x3d320a,_0x4b9ef7){return function(_0x54f3a9){if(_0x54f3a9){return _0x54f3a9[_0x52c0('0x23')](_0x3d320a)[_0x52c0('0x24')](function(_0x3ab9d6){return _0x3ab9d6;});}return null;};}function removeEntity(_0x290039,_0x48b949){return function(_0x38e8f4){if(_0x38e8f4){return _0x38e8f4[_0x52c0('0x25')]()[_0x52c0('0x24')](function(){_0x290039[_0x52c0('0x18')](0xcc)[_0x52c0('0x19')]();});}};}function handleEntityNotFound(_0x499d9f,_0x54153e){return function(_0x308b33){if(!_0x308b33){_0x499d9f[_0x52c0('0x26')](0x194);}return _0x308b33;};}function handleError(_0x3b0994,_0x1b1a64){_0x1b1a64=_0x1b1a64||0x1f4;return function(_0x5f5733){logger[_0x52c0('0x27')](_0x5f5733[_0x52c0('0x28')]);if(_0x5f5733[_0x52c0('0x29')]){delete _0x5f5733[_0x52c0('0x29')];}_0x3b0994[_0x52c0('0x18')](_0x1b1a64)['send'](_0x5f5733);};}exports[_0x52c0('0x2a')]=function(_0x486fbf,_0x39e21c){var _0x1990ea={},_0x192685={},_0x486282={'count':0x0,'rows':[]};var _0x3a2607=_['map'](db[_0x52c0('0x2b')]['rawAttributes'],function(_0x39b815){return{'name':_0x39b815[_0x52c0('0x2c')],'type':_0x39b815[_0x52c0('0x2d')][_0x52c0('0x2e')]};});_0x192685['model']=_[_0x52c0('0x2f')](_0x3a2607,_0x52c0('0x29'));_0x192685[_0x52c0('0x30')]=_[_0x52c0('0x31')](_0x486fbf[_0x52c0('0x30')]);_0x192685['filters']=_['intersection'](_0x192685[_0x52c0('0x32')],_0x192685[_0x52c0('0x30')]);_0x1990ea[_0x52c0('0x33')]=_[_0x52c0('0x34')](_0x192685[_0x52c0('0x32')],qs[_0x52c0('0x35')](_0x486fbf[_0x52c0('0x30')][_0x52c0('0x35')]));_0x1990ea[_0x52c0('0x33')]=_0x1990ea[_0x52c0('0x33')][_0x52c0('0x36')]?_0x1990ea[_0x52c0('0x33')]:_0x192685[_0x52c0('0x32')];if(!_0x486fbf[_0x52c0('0x30')][_0x52c0('0x37')]('nolimit')){_0x1990ea['limit']=qs[_0x52c0('0x1b')](_0x486fbf['query'][_0x52c0('0x1b')]);_0x1990ea[_0x52c0('0x1a')]=qs[_0x52c0('0x1a')](_0x486fbf['query'][_0x52c0('0x1a')]);}_0x1990ea['order']=qs[_0x52c0('0x38')](_0x486fbf[_0x52c0('0x30')][_0x52c0('0x38')]);_0x1990ea['where']=qs[_0x52c0('0x39')](_[_0x52c0('0x3a')](_0x486fbf[_0x52c0('0x30')],_0x192685['filters']),_0x3a2607);if(_0x486fbf[_0x52c0('0x30')][_0x52c0('0x3b')]){_0x1990ea['where']=_[_0x52c0('0x3c')](_0x1990ea[_0x52c0('0x3d')],{'$or':_[_0x52c0('0x2f')](_0x3a2607,function(_0x532c7f){if(_0x532c7f[_0x52c0('0x2d')]!==_0x52c0('0x3e')){var _0x352f14={};_0x352f14[_0x532c7f[_0x52c0('0x29')]]={'$like':'%'+_0x486fbf['query'][_0x52c0('0x3b')]+'%'};return _0x352f14;}})});}_0x1990ea=_['merge']({},_0x1990ea,_0x486fbf[_0x52c0('0x3f')]);var _0x3ceeed={'where':_0x1990ea['where']};return db['VoiceTransferReport'][_0x52c0('0x1d')](_0x3ceeed)[_0x52c0('0x24')](function(_0x2ce100){_0x486282[_0x52c0('0x1d')]=_0x2ce100;if(_0x486fbf[_0x52c0('0x30')][_0x52c0('0x40')]){_0x1990ea[_0x52c0('0x41')]=[{'all':!![]}];}return db[_0x52c0('0x2b')][_0x52c0('0x42')](_0x1990ea);})[_0x52c0('0x24')](function(_0x1eb4db){_0x486282[_0x52c0('0x43')]=_0x1eb4db;return _0x486282;})[_0x52c0('0x24')](respondWithFilteredResult(_0x39e21c,_0x1990ea))[_0x52c0('0x44')](handleError(_0x39e21c,null));};exports[_0x52c0('0x45')]=function(_0x5a80c8,_0x3c70c0){var _0x443fea={'raw':!![],'where':{'id':_0x5a80c8[_0x52c0('0x46')]['id']}},_0x415336={};_0x415336['model']=_['keys'](db[_0x52c0('0x2b')][_0x52c0('0x47')]);_0x415336[_0x52c0('0x30')]=_[_0x52c0('0x31')](_0x5a80c8[_0x52c0('0x30')]);_0x415336[_0x52c0('0x39')]=_[_0x52c0('0x34')](_0x415336[_0x52c0('0x32')],_0x415336[_0x52c0('0x30')]);_0x443fea['attributes']=_[_0x52c0('0x34')](_0x415336[_0x52c0('0x32')],qs[_0x52c0('0x35')](_0x5a80c8['query'][_0x52c0('0x35')]));_0x443fea[_0x52c0('0x33')]=_0x443fea[_0x52c0('0x33')][_0x52c0('0x36')]?_0x443fea[_0x52c0('0x33')]:_0x415336[_0x52c0('0x32')];if(_0x5a80c8[_0x52c0('0x30')][_0x52c0('0x40')]){_0x443fea['include']=[{'all':!![]}];}_0x443fea=_['merge']({},_0x443fea,_0x5a80c8['options']);return db[_0x52c0('0x2b')]['find'](_0x443fea)[_0x52c0('0x24')](handleEntityNotFound(_0x3c70c0,null))[_0x52c0('0x24')](respondWithResult(_0x3c70c0,null))['catch'](handleError(_0x3c70c0,null));};exports[_0x52c0('0x48')]=function(_0x220009,_0x303777){return db[_0x52c0('0x2b')][_0x52c0('0x48')](_0x220009[_0x52c0('0x49')],{})[_0x52c0('0x24')](respondWithResult(_0x303777,0xc9))[_0x52c0('0x44')](handleError(_0x303777,null));};exports[_0x52c0('0x23')]=function(_0x383362,_0x24f599){if(_0x383362[_0x52c0('0x49')]['id']){delete _0x383362[_0x52c0('0x49')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x383362[_0x52c0('0x46')]['id']}})[_0x52c0('0x24')](handleEntityNotFound(_0x24f599,null))[_0x52c0('0x24')](saveUpdates(_0x383362['body'],null))[_0x52c0('0x24')](respondWithResult(_0x24f599,null))[_0x52c0('0x44')](handleError(_0x24f599,null));};exports[_0x52c0('0x25')]=function(_0x3a4f8d,_0x56015f){return db[_0x52c0('0x2b')][_0x52c0('0x4a')]({'where':{'id':_0x3a4f8d[_0x52c0('0x46')]['id']}})['then'](handleEntityNotFound(_0x56015f,null))[_0x52c0('0x24')](removeEntity(_0x56015f,null))[_0x52c0('0x44')](handleError(_0x56015f,null));};exports[_0x52c0('0x4b')]=function(_0x103a99,_0x447147){return db[_0x52c0('0x2b')][_0x52c0('0x4b')]()['then'](respondWithResult(_0x447147,null))[_0x52c0('0x44')](handleError(_0x447147,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 9420444..2488f5a 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 _0xdffd=['../../config/environment','./voiceTransferReport.attributes','exports','define','report_call_transfer','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x17f4fc,_0x18d6dd){var _0xb7d90=function(_0x213bb8){while(--_0x213bb8){_0x17f4fc['push'](_0x17f4fc['shift']());}};_0xb7d90(++_0x18d6dd);}(_0xdffd,0x171));var _0xddff=function(_0x443440,_0x2c9f20){_0x443440=_0x443440-0x0;var _0x40eb56=_0xdffd[_0x443440];return _0x40eb56;};'use strict';var _=require(_0xddff('0x0'));var util=require(_0xddff('0x1'));var logger=require(_0xddff('0x2'))('api');var moment=require(_0xddff('0x3'));var BPromise=require(_0xddff('0x4'));var rp=require(_0xddff('0x5'));var fs=require('fs');var path=require(_0xddff('0x6'));var rimraf=require(_0xddff('0x7'));var config=require(_0xddff('0x8'));var attributes=require(_0xddff('0x9'));module[_0xddff('0xa')]=function(_0x4858da,_0x15f6dd){return _0x4858da[_0xddff('0xb')]('VoiceTransferReport',attributes,{'tableName':_0xddff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1192=['./voiceTransferReport.attributes','exports','define','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1192,0x198));var _0x2119=function(_0x2e15de,_0x3b9a6f){_0x2e15de=_0x2e15de-0x0;var _0xdaa198=_0x1192[_0x2e15de];return _0xdaa198;};'use strict';var _=require('lodash');var util=require(_0x2119('0x0'));var logger=require(_0x2119('0x1'))('api');var moment=require(_0x2119('0x2'));var BPromise=require(_0x2119('0x3'));var rp=require(_0x2119('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2119('0x5'));var attributes=require(_0x2119('0x6'));module[_0x2119('0x7')]=function(_0x5aa78b,_0x55c0f2){return _0x5aa78b[_0x2119('0x8')]('VoiceTransferReport',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 d06e3e9..a3fca2d 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 _0x55bb=['error','VoiceTransferReport,\x20%s,\x20%s','message','info','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x536db8,_0x1d41e4){var _0x34a9c8=function(_0x3cf1b2){while(--_0x3cf1b2){_0x536db8['push'](_0x536db8['shift']());}};_0x34a9c8(++_0x1d41e4);}(_0x55bb,0x168));var _0xb55b=function(_0x3cc072,_0x78c87e){_0x3cc072=_0x3cc072-0x0;var _0x3339ac=_0x55bb[_0x3cc072];return _0x3339ac;};'use strict';var _=require('lodash');var util=require(_0xb55b('0x0'));var moment=require(_0xb55b('0x1'));var BPromise=require(_0xb55b('0x2'));var rs=require(_0xb55b('0x3'));var fs=require('fs');var Redis=require(_0xb55b('0x4'));var db=require(_0xb55b('0x5'))['db'];var utils=require(_0xb55b('0x6'));var logger=require('../../config/logger')(_0xb55b('0x7'));var config=require('../../config/environment');var jayson=require(_0xb55b('0x8'));var client=jayson[_0xb55b('0x9')][_0xb55b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a358c,_0x21a233,_0x50d3a5){return new BPromise(function(_0x41dad9,_0x282279){return client[_0xb55b('0xb')](_0x2a358c,_0x50d3a5)[_0xb55b('0xc')](function(_0x4e3350){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x21a233,_0xb55b('0xd'));logger[_0xb55b('0xe')](_0xb55b('0xf'),_0x21a233,'request\x20sent',JSON[_0xb55b('0x10')](_0x4e3350));if(_0x4e3350[_0xb55b('0x11')]){if(_0x4e3350[_0xb55b('0x11')]['code']===0x1f4){logger[_0xb55b('0x11')](_0xb55b('0x12'),_0x21a233,_0x4e3350[_0xb55b('0x11')][_0xb55b('0x13')]);return _0x282279(_0x4e3350[_0xb55b('0x11')][_0xb55b('0x13')]);}logger['error'](_0xb55b('0x12'),_0x21a233,_0x4e3350['error'][_0xb55b('0x13')]);return _0x41dad9(_0x4e3350[_0xb55b('0x11')][_0xb55b('0x13')]);}else{logger[_0xb55b('0x14')](_0xb55b('0x12'),_0x21a233,_0xb55b('0xd'));_0x41dad9(_0x4e3350[_0xb55b('0x15')][_0xb55b('0x13')]);}})['catch'](function(_0x1a31c7){logger[_0xb55b('0x11')](_0xb55b('0x12'),_0x21a233,_0x1a31c7);_0x282279(_0x1a31c7);});});}exports[_0xb55b('0x16')]=function(_0x34e56c){var _0x2ce89c=this;return new Promise(function(_0x29de35,_0x65a444){return db[_0xb55b('0x17')][_0xb55b('0x18')](_0x34e56c[_0xb55b('0x19')],{'raw':_0x34e56c[_0xb55b('0x1a')]?_0x34e56c[_0xb55b('0x1a')][_0xb55b('0x1b')]===undefined?!![]:![]:!![]})[_0xb55b('0xc')](function(_0x400d99){logger[_0xb55b('0x14')]('CreateVoiceTransferReport',_0x34e56c);logger[_0xb55b('0xe')](_0xb55b('0x16'),_0x34e56c,JSON['stringify'](_0x400d99));_0x29de35(_0x400d99);})[_0xb55b('0x1c')](function(_0x2c35b2){logger['error'](_0xb55b('0x16'),_0x2c35b2[_0xb55b('0x13')],_0x34e56c);_0x65a444(_0x2ce89c[_0xb55b('0x11')](0x1f4,_0x2c35b2[_0xb55b('0x13')]));});});}; \ No newline at end of file +var _0x720f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','CreateVoiceTransferReport','create','options','lodash','util','bluebird','randomstring'];(function(_0x4b4d43,_0x1590f7){var _0x5706ba=function(_0x11d99b){while(--_0x11d99b){_0x4b4d43['push'](_0x4b4d43['shift']());}};_0x5706ba(++_0x1590f7);}(_0x720f,0x19c));var _0xf720=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x720f[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0xf720('0x0'));var util=require(_0xf720('0x1'));var moment=require('moment');var BPromise=require(_0xf720('0x2'));var rs=require(_0xf720('0x3'));var fs=require('fs');var Redis=require(_0xf720('0x4'));var db=require(_0xf720('0x5'))['db'];var utils=require(_0xf720('0x6'));var logger=require(_0xf720('0x7'))(_0xf720('0x8'));var config=require('../../config/environment');var jayson=require(_0xf720('0x9'));var client=jayson[_0xf720('0xa')][_0xf720('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ebbd0,_0x2521b2,_0x2b0b3c){return new BPromise(function(_0x88d65f,_0x5d085f){return client[_0xf720('0xc')](_0x2ebbd0,_0x2b0b3c)[_0xf720('0xd')](function(_0x36365e){logger[_0xf720('0xe')](_0xf720('0xf'),_0x2521b2,'request\x20sent');logger[_0xf720('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x2521b2,'request\x20sent',JSON[_0xf720('0x11')](_0x36365e));if(_0x36365e[_0xf720('0x12')]){if(_0x36365e[_0xf720('0x12')][_0xf720('0x13')]===0x1f4){logger[_0xf720('0x12')](_0xf720('0xf'),_0x2521b2,_0x36365e[_0xf720('0x12')][_0xf720('0x14')]);return _0x5d085f(_0x36365e['error'][_0xf720('0x14')]);}logger[_0xf720('0x12')](_0xf720('0xf'),_0x2521b2,_0x36365e['error'][_0xf720('0x14')]);return _0x88d65f(_0x36365e['error']['message']);}else{logger[_0xf720('0xe')](_0xf720('0xf'),_0x2521b2,'request\x20sent');_0x88d65f(_0x36365e[_0xf720('0x15')][_0xf720('0x14')]);}})[_0xf720('0x16')](function(_0xeb6e82){logger[_0xf720('0x12')](_0xf720('0xf'),_0x2521b2,_0xeb6e82);_0x5d085f(_0xeb6e82);});});}exports[_0xf720('0x17')]=function(_0x186efc){var _0x90fde4=this;return new Promise(function(_0x2174c2,_0x3dde39){return db['VoiceTransferReport'][_0xf720('0x18')](_0x186efc['body'],{'raw':_0x186efc[_0xf720('0x19')]?_0x186efc[_0xf720('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xf720('0xd')](function(_0x3eeee3){logger['info'](_0xf720('0x17'),_0x186efc);logger[_0xf720('0x10')]('CreateVoiceTransferReport',_0x186efc,JSON[_0xf720('0x11')](_0x3eeee3));_0x2174c2(_0x3eeee3);})[_0xf720('0x16')](function(_0x9c73e4){logger[_0xf720('0x12')]('CreateVoiceTransferReport',_0x9c73e4[_0xf720('0x14')],_0x186efc);_0x3dde39(_0x90fde4[_0xf720('0x12')](0x1f4,_0x9c73e4['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 13bae3d..82ad5c3 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 _0x153f=['hold','/unhold','unhold','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','originate','/hangup','isWebrtcLicence','hangup','answer','/hold'];(function(_0xfb2935,_0x4ca521){var _0x49394b=function(_0x1241fb){while(--_0x1241fb){_0xfb2935['push'](_0xfb2935['shift']());}};_0x49394b(++_0x4ca521);}(_0x153f,0x15b));var _0xf153=function(_0x46246d,_0x55d892){_0x46246d=_0x46246d-0x0;var _0x59b6b1=_0x153f[_0x46246d];return _0x59b6b1;};'use strict';var express=require(_0xf153('0x0'));var router=express[_0xf153('0x1')]();var auth=require(_0xf153('0x2'));var controller=require(_0xf153('0x3'));router[_0xf153('0x4')](_0xf153('0x5'),auth[_0xf153('0x6')](),auth['isWebrtcLicence'](),controller[_0xf153('0x7')]);router['post'](_0xf153('0x8'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xa')]);router[_0xf153('0x4')]('/answer',auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xb')]);router[_0xf153('0x4')](_0xf153('0xc'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xd')]);router[_0xf153('0x4')](_0xf153('0xe'),auth['isAuthenticated'](),auth[_0xf153('0x9')](),controller[_0xf153('0xf')]);router[_0xf153('0x4')]('/calls',auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0x10')]);router[_0xf153('0x4')](_0xf153('0x11'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0x12')]);module[_0xf153('0x13')]=router; \ No newline at end of file +var _0xe14d=['hangup','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','originate','post','/hangup','isWebrtcLicence'];(function(_0x8e992d,_0x5dd91c){var _0x41dd7f=function(_0x130202){while(--_0x130202){_0x8e992d['push'](_0x8e992d['shift']());}};_0x41dd7f(++_0x5dd91c);}(_0xe14d,0x1ee));var _0xde14=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xe14d[_0x125ff8];return _0x2d9ef;};'use strict';var express=require(_0xde14('0x0'));var router=express[_0xde14('0x1')]();var auth=require(_0xde14('0x2'));var controller=require(_0xde14('0x3'));router['post'](_0xde14('0x4'),auth[_0xde14('0x5')](),auth['isWebrtcLicence'](),controller[_0xde14('0x6')]);router[_0xde14('0x7')](_0xde14('0x8'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xa')]);router['post']('/answer',auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xb')]);router[_0xde14('0x7')](_0xde14('0xc'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xd')]);router['post'](_0xde14('0xe'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xf')]);router[_0xde14('0x7')](_0xde14('0x10'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x11')]);router[_0xde14('0x7')](_0xde14('0x12'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 6368edc..6e9061c 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 _0xa588=['client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','emit','handleError:','error','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','transfer','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise'];(function(_0x386187,_0x1ad2ac){var _0x4abeaa=function(_0x251f63){while(--_0x251f63){_0x386187['push'](_0x386187['shift']());}};_0x4abeaa(++_0x1ad2ac);}(_0xa588,0xe1));var _0x8a58=function(_0x2c0b5c,_0x2de2b0){_0x2c0b5c=_0x2c0b5c-0x0;var _0x331c54=_0xa588[_0x2c0b5c];return _0x331c54;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x8a58('0x0'));var db=require(_0x8a58('0x1'))['db'];var config=require(_0x8a58('0x2'));var util=require(_0x8a58('0x3'));var BPromise=require(_0x8a58('0x4'));var jayson=require(_0x8a58('0x5'));var amiClient=jayson[_0x8a58('0x6')][_0x8a58('0x7')]({'port':0x232a});var logger=require(_0x8a58('0x8'))('webbarapi');var Redis=require(_0x8a58('0x9'));config[_0x8a58('0xa')]=_[_0x8a58('0xb')](config[_0x8a58('0xa')],{'host':_0x8a58('0xc'),'port':0x18eb});var io=require(_0x8a58('0xd'))(new Redis(config[_0x8a58('0xa')]));var Schema=require(_0x8a58('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a58('0xf')]},'callNumber':{'type':_0x8a58('0x10'),'required':[!![],_0x8a58('0x11')]},'callerId':{'type':_0x8a58('0x10')},'callbackUrl':{'type':_0x8a58('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a58('0xf')]},'sessionId':{'type':_0x8a58('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':[!![],_0x8a58('0x13')]},'transferNumber':{'type':_0x8a58('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]}});function emit(_0x26e3a8,_0xd967db,_0xddfaae){logger['info'](_0x26e3a8,_0xd967db,JSON['stringify'](_0xddfaae));io['to'](_0x26e3a8)[_0x8a58('0x14')](_0xd967db,_0xddfaae);}function handleError(_0x107e0a){return function(_0x18a14d){console['log'](_0x8a58('0x15'),_0x18a14d,_0x18a14d instanceof RangeError);logger[_0x8a58('0x16')](_0x18a14d['stack']);if(_0x18a14d instanceof RangeError){if(_0x18a14d[_0x8a58('0x17')]){delete _0x18a14d[_0x8a58('0x17')];}_0x107e0a[_0x8a58('0x18')](0x194)[_0x8a58('0x19')](_0x18a14d);}else{if(_0x18a14d[_0x8a58('0x17')]){delete _0x18a14d[_0x8a58('0x17')];}_0x107e0a[_0x8a58('0x18')](0x1f4)[_0x8a58('0x19')](_0x18a14d);}};}function checkError(){return function(_0x92951){if(!_0x92951){throw new RangeError(_0x8a58('0x1a'));}return _0x92951;};}function respondWithRpcPromise(_0xb20cfe,_0x844b58){return new BPromise(function(_0x3758fa,_0x34adb8){var _0x561a9a=amiClient;return _0x561a9a[_0x8a58('0x1b')](_0xb20cfe,_0x844b58)[_0x8a58('0x1c')](function(_0x20a6c5){if(_0x20a6c5[_0x8a58('0x16')]){if(_0x20a6c5[_0x8a58('0x16')][_0x8a58('0x1d')]===0x1f4){return _0x34adb8(_0x20a6c5[_0x8a58('0x16')]['message']);}return _0x3758fa(_0x20a6c5[_0x8a58('0x16')][_0x8a58('0x1e')]);}else{_0x3758fa(_0x20a6c5[_0x8a58('0x1f')]);}})[_0x8a58('0x20')](function(_0x4fb0fb){_0x34adb8(_0x4fb0fb);});});}function getAgent(_0x1e9c3b){return db[_0x8a58('0x21')][_0x8a58('0x22')]({'where':{'id':_0x1e9c3b,'role':'agent'}})[_0x8a58('0x1c')](checkError());}function getAgentCheckSession(_0x31abcc,_0x4426ff){return new BPromise(function(_0x27d7c8,_0x367aec){var _0x3e317f=respondWithRpcPromise(_0x8a58('0x23'));var _0x4d5041=getAgent(_0x31abcc);Promise[_0x8a58('0x24')]([_0x3e317f,_0x4d5041])['then'](function(_0x501aa1){var _0x5e7265=_0x501aa1[0x0];var _0x4cfc96=_0x501aa1[0x1];var _0x5a9c53=_[_0x8a58('0x25')](_0x5e7265[_0x8a58('0x26')],function(_0x1b2d9e){return _0x1b2d9e[_0x8a58('0x27')]==_0x4cfc96['id']&&_0x1b2d9e[_0x8a58('0x28')]==_0x4426ff;});if(_0x5a9c53[_0x8a58('0x29')]==0x1){_0x27d7c8(_0x4cfc96);}else{_0x367aec(new RangeError(_0x8a58('0x2a')+_0x4426ff+_0x8a58('0x2b')));}});});}exports[_0x8a58('0x2c')]=function(_0x3d9e3a,_0x8ab99c){logger[_0x8a58('0x2d')](_0x8a58('0x2e'),_0x3d9e3a['body']);var _0x330e8a=originateValidation[_0x8a58('0xe')](_0x3d9e3a[_0x8a58('0x2f')]);if(_0x330e8a[_0x8a58('0x29')]>0x0){return _0x8ab99c[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x330e8a);}var _0x50c73d=_0x3d9e3a[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x25ecd6=_0x3d9e3a[_0x8a58('0x2f')][_0x8a58('0x32')];var _0x264cc7=_0x3d9e3a[_0x8a58('0x2f')]['callerId'];var _0x3d1fb0=_0x3d9e3a[_0x8a58('0x2f')][_0x8a58('0x33')];return getAgent(_0x50c73d)['then'](function(_0x5ecfea){logger['info'](_0x8a58('0x34'),_0x5ecfea[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x5ecfea['name']),_0x8a58('0x37'),{'callNumber':_0x25ecd6,'callerId':_0x264cc7,'callbackUrl':_0x3d1fb0});return _0x8ab99c[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x38')});})['catch'](handleError(_0x8ab99c));};exports[_0x8a58('0x39')]=function(_0x2a7c70,_0x5aad83){logger[_0x8a58('0x2d')](_0x8a58('0x3a'),_0x2a7c70[_0x8a58('0x2f')]);var _0x35d930=hangupValidation[_0x8a58('0xe')](_0x2a7c70[_0x8a58('0x2f')]);if(_0x35d930['length']>0x0){return _0x5aad83['status'](0x190)[_0x8a58('0x30')](_0x35d930);}var _0x31b8fe=_0x2a7c70['body'][_0x8a58('0x31')];var _0x2e1d71=_0x2a7c70[_0x8a58('0x2f')][_0x8a58('0x28')];return getAgent(_0x31b8fe)[_0x8a58('0x1c')](function(_0x4e9e04){logger[_0x8a58('0x2d')]('entityFound:',_0x4e9e04[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x4e9e04[_0x8a58('0x17')]),_0x8a58('0x3b'),{'sessionId':_0x2e1d71});return _0x5aad83[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x5aad83));};exports[_0x8a58('0x3c')]=function(_0x54e454,_0x53fd19){logger[_0x8a58('0x2d')](_0x8a58('0x3d'),_0x54e454[_0x8a58('0x2f')]);var _0x573cd3=answerValidation['validate'](_0x54e454[_0x8a58('0x2f')]);if(_0x573cd3['length']>0x0){return _0x53fd19[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x573cd3);}var _0x3feec0=_0x54e454[_0x8a58('0x2f')]['userId'];var _0x417951=_0x54e454[_0x8a58('0x2f')]['sessionId'];return getAgent(_0x3feec0)[_0x8a58('0x1c')](function(_0xba52de){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0xba52de['name']);emit(util[_0x8a58('0x35')]('user:%s',_0xba52de[_0x8a58('0x17')]),_0x8a58('0x3e'),{'sessionId':_0x417951});return _0x53fd19['status'](0xc8)[_0x8a58('0x30')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x53fd19));};exports[_0x8a58('0x3f')]=function(_0x417b08,_0x177ba9){logger[_0x8a58('0x2d')](_0x8a58('0x40'),_0x417b08[_0x8a58('0x2f')]);var _0x507423=holdValidation['validate'](_0x417b08[_0x8a58('0x2f')]);if(_0x507423[_0x8a58('0x29')]>0x0){return _0x177ba9[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x507423);}var _0x1ec51b=_0x417b08[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x903c85=_0x417b08[_0x8a58('0x2f')][_0x8a58('0x28')];return getAgent(_0x1ec51b)[_0x8a58('0x1c')](function(_0x392c32){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0x392c32['name']);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x392c32[_0x8a58('0x17')]),_0x8a58('0x41'),{'sessionId':_0x903c85});return _0x177ba9[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x42')});})['catch'](handleError(_0x177ba9));};exports['unhold']=function(_0x5ab682,_0x31e12a){logger[_0x8a58('0x2d')](_0x8a58('0x43'),_0x5ab682['body']);var _0x3883ee=unholdValidation[_0x8a58('0xe')](_0x5ab682[_0x8a58('0x2f')]);if(_0x3883ee[_0x8a58('0x29')]>0x0){return _0x31e12a[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x3883ee);}var _0x22f5aa=_0x5ab682[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x2f48ef=_0x5ab682[_0x8a58('0x2f')][_0x8a58('0x28')];return getAgent(_0x22f5aa)['then'](function(_0xf44eaa){logger[_0x8a58('0x2d')]('entityFound:',_0xf44eaa[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0xf44eaa['name']),_0x8a58('0x44'),{'sessionId':_0x2f48ef});return _0x31e12a['status'](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x45')});})[_0x8a58('0x20')](handleError(_0x31e12a));};exports[_0x8a58('0x46')]=function(_0x3c7225,_0xfd0229){logger[_0x8a58('0x2d')](_0x8a58('0x47'),_0xfd0229[_0x8a58('0x2f')]);var _0x53fbde=callsValidation[_0x8a58('0xe')](_0x3c7225[_0x8a58('0x2f')]);if(_0x53fbde[_0x8a58('0x29')]>0x0){return _0xfd0229[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x53fbde);}var _0x57adf4=_0x3c7225[_0x8a58('0x2f')][_0x8a58('0x31')];var _0xa01a37=respondWithRpcPromise(_0x8a58('0x23'));var _0x1022d5=getAgent(_0x57adf4);return Promise[_0x8a58('0x24')]([_0xa01a37,_0x1022d5])[_0x8a58('0x1c')](function(_0x38e435){var _0x515f26=_0x38e435[0x0];var _0x415dea=_0x38e435[0x1];var _0xbf6332=_[_0x8a58('0x25')](_0x515f26['rows'],function(_0x229e68){return _0x229e68['UserId']==_0x415dea['id'];});return _0xfd0229[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'count':_0xbf6332[_0x8a58('0x29')],'rows':_0xbf6332});})[_0x8a58('0x20')](handleError(_0xfd0229));};exports[_0x8a58('0x48')]=function(_0x2f653d,_0x1b8292){logger[_0x8a58('0x2d')]('conference\x20fired:',_0x2f653d['body']);var _0x455aeb=conferenceValidation[_0x8a58('0xe')](_0x2f653d[_0x8a58('0x2f')]);if(_0x455aeb[_0x8a58('0x29')]>0x0){return _0x1b8292[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x455aeb);}var _0x1b4f68=_0x2f653d['body'][_0x8a58('0x31')];return getAgent(_0x1b4f68)[_0x8a58('0x1c')](function(_0x493ccd){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0x493ccd[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x493ccd[_0x8a58('0x17')]),'webbar:conference');return _0x1b8292[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':'conference\x20executed!'});})[_0x8a58('0x20')](handleError(_0x1b8292));};exports[_0x8a58('0x49')]=function(_0x19e256,_0x26b333){logger['info']('transfer\x20fired:',_0x19e256[_0x8a58('0x2f')]);var _0x5ce699=transferValidation[_0x8a58('0xe')](_0x19e256[_0x8a58('0x2f')]);if(_0x5ce699[_0x8a58('0x29')]>0x0){return _0x26b333[_0x8a58('0x18')](0x190)['json'](_0x5ce699);}var _0xb0b5da=_0x19e256[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x371930=_0x19e256[_0x8a58('0x2f')][_0x8a58('0x28')];var _0x9046f1=_0x19e256[_0x8a58('0x2f')][_0x8a58('0x4a')];return getAgent(_0xb0b5da)[_0x8a58('0x1c')](function(_0x318acd){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0x318acd['name']);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x318acd[_0x8a58('0x17')]),_0x8a58('0x4b'),{'sessionId':_0x371930,'transferNumber':_0x9046f1});return _0x26b333[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x4c')});})[_0x8a58('0x20')](handleError(_0x26b333));}; \ No newline at end of file +var _0xfd28=['all','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','json','callNumber','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','hangup','user:%s','hangup\x20executed!','answer\x20fired:','userId','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','calls','calls\x20fired:','VoiceChannels','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','util','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','validate','number','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','handleError:','error','stack','name','status','NotFound','then','code','message','result','catch','User','findOne','agent'];(function(_0x30a8c7,_0x8dcda2){var _0x16290c=function(_0x44ac89){while(--_0x44ac89){_0x30a8c7['push'](_0x30a8c7['shift']());}};_0x16290c(++_0x8dcda2);}(_0xfd28,0x148));var _0x8fd2=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0xfd28[_0x1e9424];return _0x1bd96c;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x8fd2('0x0'));var db=require(_0x8fd2('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x8fd2('0x2'));var BPromise=require('bluebird');var jayson=require(_0x8fd2('0x3'));var amiClient=jayson[_0x8fd2('0x4')][_0x8fd2('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0x8fd2('0x6'));var Redis=require(_0x8fd2('0x7'));config[_0x8fd2('0x8')]=_[_0x8fd2('0x9')](config[_0x8fd2('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8fd2('0x8')]));var Schema=require(_0x8fd2('0xa'));var originateValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x8fd2('0xc'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x8fd2('0xc')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x8fd2('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':_0x8fd2('0xc'),'required':[!![],_0x8fd2('0xe')]},'transferNumber':{'type':_0x8fd2('0xc'),'required':[!![],_0x8fd2('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':_0x8fd2('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':_0x8fd2('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x20daca,_0x5ef478,_0x4f0b17){logger['info'](_0x20daca,_0x5ef478,JSON[_0x8fd2('0x10')](_0x4f0b17));io['to'](_0x20daca)[_0x8fd2('0x11')](_0x5ef478,_0x4f0b17);}function handleError(_0x1ced10){return function(_0x12e8a3){console['log'](_0x8fd2('0x12'),_0x12e8a3,_0x12e8a3 instanceof RangeError);logger[_0x8fd2('0x13')](_0x12e8a3[_0x8fd2('0x14')]);if(_0x12e8a3 instanceof RangeError){if(_0x12e8a3[_0x8fd2('0x15')]){delete _0x12e8a3[_0x8fd2('0x15')];}_0x1ced10['status'](0x194)['send'](_0x12e8a3);}else{if(_0x12e8a3[_0x8fd2('0x15')]){delete _0x12e8a3['name'];}_0x1ced10[_0x8fd2('0x16')](0x1f4)['send'](_0x12e8a3);}};}function checkError(){return function(_0x1631c6){if(!_0x1631c6){throw new RangeError(_0x8fd2('0x17'));}return _0x1631c6;};}function respondWithRpcPromise(_0x4f81dc,_0x122b60){return new BPromise(function(_0x4c2be8,_0xd3981f){var _0x44ee7a=amiClient;return _0x44ee7a['request'](_0x4f81dc,_0x122b60)[_0x8fd2('0x18')](function(_0x2a9c3c){if(_0x2a9c3c[_0x8fd2('0x13')]){if(_0x2a9c3c['error'][_0x8fd2('0x19')]===0x1f4){return _0xd3981f(_0x2a9c3c[_0x8fd2('0x13')][_0x8fd2('0x1a')]);}return _0x4c2be8(_0x2a9c3c[_0x8fd2('0x13')][_0x8fd2('0x1a')]);}else{_0x4c2be8(_0x2a9c3c[_0x8fd2('0x1b')]);}})[_0x8fd2('0x1c')](function(_0x398925){_0xd3981f(_0x398925);});});}function getAgent(_0x1456b4){return db[_0x8fd2('0x1d')][_0x8fd2('0x1e')]({'where':{'id':_0x1456b4,'role':_0x8fd2('0x1f')}})[_0x8fd2('0x18')](checkError());}function getAgentCheckSession(_0x512e5a,_0x4c6af7){return new BPromise(function(_0x345bc3,_0x1858a9){var _0x288bcd=respondWithRpcPromise('VoiceChannels');var _0x2f26ae=getAgent(_0x512e5a);Promise[_0x8fd2('0x20')]([_0x288bcd,_0x2f26ae])[_0x8fd2('0x18')](function(_0x960869){var _0x119439=_0x960869[0x0];var _0x4745bf=_0x960869[0x1];var _0x332ab0=_['filter'](_0x119439[_0x8fd2('0x21')],function(_0x13c9b9){return _0x13c9b9[_0x8fd2('0x22')]==_0x4745bf['id']&&_0x13c9b9[_0x8fd2('0x23')]==_0x4c6af7;});if(_0x332ab0[_0x8fd2('0x24')]==0x1){_0x345bc3(_0x4745bf);}else{_0x1858a9(new RangeError(_0x8fd2('0x25')+_0x4c6af7+_0x8fd2('0x26')));}});});}exports['originate']=function(_0x5b992a,_0x5144ba){logger[_0x8fd2('0x27')](_0x8fd2('0x28'),_0x5b992a[_0x8fd2('0x29')]);var _0xe4987b=originateValidation['validate'](_0x5b992a['body']);if(_0xe4987b[_0x8fd2('0x24')]>0x0){return _0x5144ba[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0xe4987b);}var _0x18fe4e=_0x5b992a[_0x8fd2('0x29')]['userId'];var _0x328964=_0x5b992a['body'][_0x8fd2('0x2b')];var _0x4ade8c=_0x5b992a[_0x8fd2('0x29')]['callerId'];var _0x134420=_0x5b992a[_0x8fd2('0x29')][_0x8fd2('0x2c')];return getAgent(_0x18fe4e)['then'](function(_0x339291){logger['info'](_0x8fd2('0x2d'),_0x339291[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')]('user:%s',_0x339291[_0x8fd2('0x15')]),_0x8fd2('0x2f'),{'callNumber':_0x328964,'callerId':_0x4ade8c,'callbackUrl':_0x134420});return _0x5144ba[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':_0x8fd2('0x30')});})[_0x8fd2('0x1c')](handleError(_0x5144ba));};exports[_0x8fd2('0x31')]=function(_0x4adfa2,_0x37a24b){logger[_0x8fd2('0x27')]('hangup\x20fired:',_0x4adfa2[_0x8fd2('0x29')]);var _0x130072=hangupValidation[_0x8fd2('0xa')](_0x4adfa2[_0x8fd2('0x29')]);if(_0x130072[_0x8fd2('0x24')]>0x0){return _0x37a24b[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x130072);}var _0x5e6140=_0x4adfa2[_0x8fd2('0x29')]['userId'];var _0x566c9e=_0x4adfa2[_0x8fd2('0x29')][_0x8fd2('0x23')];return getAgent(_0x5e6140)[_0x8fd2('0x18')](function(_0x2edcfd){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2edcfd['name']);emit(util['format'](_0x8fd2('0x32'),_0x2edcfd['name']),'webbar:hangup',{'sessionId':_0x566c9e});return _0x37a24b[_0x8fd2('0x16')](0xc8)[_0x8fd2('0x2a')]({'error':![],'message':_0x8fd2('0x33')});})[_0x8fd2('0x1c')](handleError(_0x37a24b));};exports['answer']=function(_0x39cd8e,_0x1d5458){logger[_0x8fd2('0x27')](_0x8fd2('0x34'),_0x39cd8e[_0x8fd2('0x29')]);var _0x1de9aa=answerValidation[_0x8fd2('0xa')](_0x39cd8e['body']);if(_0x1de9aa[_0x8fd2('0x24')]>0x0){return _0x1d5458[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x1de9aa);}var _0x70404e=_0x39cd8e[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x40a572=_0x39cd8e['body'][_0x8fd2('0x23')];return getAgent(_0x70404e)[_0x8fd2('0x18')](function(_0x2abd80){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2abd80[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')]('user:%s',_0x2abd80[_0x8fd2('0x15')]),'webbar:answer',{'sessionId':_0x40a572});return _0x1d5458[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':_0x8fd2('0x36')});})[_0x8fd2('0x1c')](handleError(_0x1d5458));};exports[_0x8fd2('0x37')]=function(_0x5c0632,_0x290467){logger[_0x8fd2('0x27')](_0x8fd2('0x38'),_0x5c0632['body']);var _0x3c65c4=holdValidation['validate'](_0x5c0632[_0x8fd2('0x29')]);if(_0x3c65c4[_0x8fd2('0x24')]>0x0){return _0x290467[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x3c65c4);}var _0xc62e9e=_0x5c0632[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x34ffed=_0x5c0632[_0x8fd2('0x29')][_0x8fd2('0x23')];return getAgent(_0xc62e9e)[_0x8fd2('0x18')](function(_0x34f3a2){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x34f3a2[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')](_0x8fd2('0x32'),_0x34f3a2[_0x8fd2('0x15')]),_0x8fd2('0x39'),{'sessionId':_0x34ffed});return _0x290467['status'](0xc8)['json']({'error':![],'message':_0x8fd2('0x3a')});})[_0x8fd2('0x1c')](handleError(_0x290467));};exports[_0x8fd2('0x3b')]=function(_0x5d79c3,_0x4d5b81){logger[_0x8fd2('0x27')]('unhold\x20fired:',_0x5d79c3[_0x8fd2('0x29')]);var _0x1295c4=unholdValidation[_0x8fd2('0xa')](_0x5d79c3['body']);if(_0x1295c4[_0x8fd2('0x24')]>0x0){return _0x4d5b81[_0x8fd2('0x16')](0x190)['json'](_0x1295c4);}var _0x331ada=_0x5d79c3[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x56050f=_0x5d79c3[_0x8fd2('0x29')][_0x8fd2('0x23')];return getAgent(_0x331ada)[_0x8fd2('0x18')](function(_0x2c5766){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2c5766['name']);emit(util['format'](_0x8fd2('0x32'),_0x2c5766[_0x8fd2('0x15')]),'webbar:unhold',{'sessionId':_0x56050f});return _0x4d5b81[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x8fd2('0x1c')](handleError(_0x4d5b81));};exports[_0x8fd2('0x3c')]=function(_0x337354,_0x29a00e){logger[_0x8fd2('0x27')](_0x8fd2('0x3d'),_0x29a00e['body']);var _0x2f4759=callsValidation[_0x8fd2('0xa')](_0x337354[_0x8fd2('0x29')]);if(_0x2f4759[_0x8fd2('0x24')]>0x0){return _0x29a00e[_0x8fd2('0x16')](0x190)['json'](_0x2f4759);}var _0x5cf641=_0x337354['body']['userId'];var _0x57b8f6=respondWithRpcPromise(_0x8fd2('0x3e'));var _0x382154=getAgent(_0x5cf641);return Promise[_0x8fd2('0x20')]([_0x57b8f6,_0x382154])[_0x8fd2('0x18')](function(_0x21696c){var _0x25abdc=_0x21696c[0x0];var _0x460f31=_0x21696c[0x1];var _0x4a81ab=_[_0x8fd2('0x3f')](_0x25abdc['rows'],function(_0x351cfe){return _0x351cfe[_0x8fd2('0x22')]==_0x460f31['id'];});return _0x29a00e['status'](0xc8)['json']({'count':_0x4a81ab[_0x8fd2('0x24')],'rows':_0x4a81ab});})[_0x8fd2('0x1c')](handleError(_0x29a00e));};exports[_0x8fd2('0x40')]=function(_0x30a952,_0x37ddfa){logger['info'](_0x8fd2('0x41'),_0x30a952[_0x8fd2('0x29')]);var _0x1b46d6=conferenceValidation[_0x8fd2('0xa')](_0x30a952['body']);if(_0x1b46d6[_0x8fd2('0x24')]>0x0){return _0x37ddfa[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x1b46d6);}var _0x23c608=_0x30a952['body']['userId'];return getAgent(_0x23c608)['then'](function(_0x2e5693){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2e5693[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')]('user:%s',_0x2e5693[_0x8fd2('0x15')]),_0x8fd2('0x42'));return _0x37ddfa['status'](0xc8)[_0x8fd2('0x2a')]({'error':![],'message':_0x8fd2('0x43')});})[_0x8fd2('0x1c')](handleError(_0x37ddfa));};exports[_0x8fd2('0x44')]=function(_0x305d83,_0x5547c7){logger[_0x8fd2('0x27')](_0x8fd2('0x45'),_0x305d83[_0x8fd2('0x29')]);var _0x4606f7=transferValidation[_0x8fd2('0xa')](_0x305d83[_0x8fd2('0x29')]);if(_0x4606f7[_0x8fd2('0x24')]>0x0){return _0x5547c7[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x4606f7);}var _0x4680f0=_0x305d83[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x40ffd5=_0x305d83['body'][_0x8fd2('0x23')];var _0x237756=_0x305d83['body']['transferNumber'];return getAgent(_0x4680f0)['then'](function(_0x2bd1d0){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2bd1d0[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')](_0x8fd2('0x32'),_0x2bd1d0['name']),_0x8fd2('0x46'),{'sessionId':_0x40ffd5,'transferNumber':_0x237756});return _0x5547c7[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':_0x8fd2('0x47')});})['catch'](handleError(_0x5547c7));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index a52fc7a..4875434 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 _0x524e=['index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','addDisposition','addAnswer','addApplications','/:id/notify','notify','/:id/send','put','update','delete','destroy','removeAnswers','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get'];(function(_0xe003bd,_0x3fbb70){var _0xd0eda3=function(_0x54e04f){while(--_0x54e04f){_0xe003bd['push'](_0xe003bd['shift']());}};_0xd0eda3(++_0x3fbb70);}(_0x524e,0x15e));var _0xe524=function(_0x45f47a,_0x5687c3){_0x45f47a=_0x45f47a-0x0;var _0x17b4de=_0x524e[_0x45f47a];return _0x17b4de;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var fs_extra=require(_0xe524('0x4'));var auth=require(_0xe524('0x5'));var interaction=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var controller=require(_0xe524('0x8'));router[_0xe524('0x9')]('/',auth['isAuthenticated'](),controller[_0xe524('0xa')]);router[_0xe524('0x9')](_0xe524('0xb'),auth['isAuthenticated'](),controller[_0xe524('0xc')]);router[_0xe524('0x9')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0xf')]);router[_0xe524('0x9')](_0xe524('0x10'),auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x9')](_0xe524('0x12'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);router[_0xe524('0x9')](_0xe524('0x14'),auth[_0xe524('0xe')](),controller['getAgents']);router['get'](_0xe524('0x15'),auth[_0xe524('0xe')](),controller[_0xe524('0x16')]);router[_0xe524('0x17')]('/',auth[_0xe524('0xe')](),controller['create']);router[_0xe524('0x17')]('/:id/dispositions',auth[_0xe524('0xe')](),controller[_0xe524('0x18')]);router['post'](_0xe524('0x12'),auth['isAuthenticated'](),controller[_0xe524('0x19')]);router['post'](_0xe524('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['post'](_0xe524('0x15'),auth['isAuthenticated'](),controller[_0xe524('0x1a')]);router[_0xe524('0x17')](_0xe524('0x1b'),controller[_0xe524('0x1c')]);router['post'](_0xe524('0x1d'),auth[_0xe524('0xe')](),controller['send']);router[_0xe524('0x1e')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x1f')]);router[_0xe524('0x20')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x21')]);router[_0xe524('0x20')]('/:id/dispositions',auth[_0xe524('0xe')](),controller['removeDispositions']);router['delete'](_0xe524('0x12'),auth[_0xe524('0xe')](),controller[_0xe524('0x22')]);router[_0xe524('0x20')]('/:id/users',auth[_0xe524('0xe')](),controller['removeAgents']);module[_0xe524('0x23')]=router; \ No newline at end of file +var _0x66fa=['/:id','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','post','/:id/dispositions','addDisposition','addAgents','/:id/notify','notify','/:id/send','send','put'];(function(_0x4c91f8,_0xff98ab){var _0x2240b1=function(_0x3e543b){while(--_0x3e543b){_0x4c91f8['push'](_0x4c91f8['shift']());}};_0x2240b1(++_0xff98ab);}(_0x66fa,0x117));var _0xa66f=function(_0x1b4277,_0x1498eb){_0x1b4277=_0x1b4277-0x0;var _0x3369bc=_0x66fa[_0x1b4277];return _0x3369bc;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var fs_extra=require(_0xa66f('0x5'));var auth=require(_0xa66f('0x6'));var interaction=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0xa66f('0x9')](),controller[_0xa66f('0xa')]);router[_0xa66f('0xb')](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['describe']);router[_0xa66f('0xb')]('/:id',auth[_0xa66f('0x9')](),controller['show']);router[_0xa66f('0xb')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0xa66f('0xb')](_0xa66f('0xd'),auth['isAuthenticated'](),controller[_0xa66f('0xe')]);router['get'](_0xa66f('0xf'),auth['isAuthenticated'](),controller[_0xa66f('0x10')]);router[_0xa66f('0xb')](_0xa66f('0x11'),auth['isAuthenticated'](),controller['getApplications']);router[_0xa66f('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa66f('0x13'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x14')]);router[_0xa66f('0x12')](_0xa66f('0xd'),auth['isAuthenticated'](),controller['addAnswer']);router[_0xa66f('0x12')](_0xa66f('0xf'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x15')]);router['post'](_0xa66f('0x11'),auth['isAuthenticated'](),controller['addApplications']);router[_0xa66f('0x12')](_0xa66f('0x16'),controller[_0xa66f('0x17')]);router[_0xa66f('0x12')](_0xa66f('0x18'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x19')]);router[_0xa66f('0x1a')](_0xa66f('0x1b'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x1c')]);router[_0xa66f('0x1d')](_0xa66f('0x1b'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x1e')]);router['delete'](_0xa66f('0x13'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x1f')]);router[_0xa66f('0x1d')]('/:id/canned_answers',auth[_0xa66f('0x9')](),controller[_0xa66f('0x20')]);router[_0xa66f('0x1d')](_0xa66f('0xf'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xa66f('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 9cf4fed..2c0feac 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 _0xf4a4=['ENUM','twilio','sinch','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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','generate'];(function(_0x55d6d3,_0x23c8ef){var _0x3946bc=function(_0x1c218f){while(--_0x1c218f){_0x55d6d3['push'](_0x55d6d3['shift']());}};_0x3946bc(++_0x23c8ef);}(_0xf4a4,0x173));var _0x4f4a=function(_0x33679d,_0x448096){_0x33679d=_0x33679d-0x0;var _0x408bcc=_0xf4a4[_0x33679d];return _0x408bcc;};'use strict';var Sequelize=require(_0x4f4a('0x0'));var rs=require(_0x4f4a('0x1'));module['exports']={'name':{'type':Sequelize[_0x4f4a('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x4f4a('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x4f4a('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x4f4a('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4f4a('0x4')](_0x4f4a('0x5'),_0x4f4a('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x4f4a('0x2')]},'authToken':{'type':Sequelize[_0x4f4a('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4f4a('0x7')],'defaultValue':function(){return _0x4f4a('0x8');}},'notificationSound':{'type':Sequelize[_0x4f4a('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4f4a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4f4a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4f4a('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4f4a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4f4a('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4f4a('0x9')],'defaultValue':![],'comment':_0x4f4a('0xb'),'set':function(_0x4894c4){if(!_0x4894c4){this[_0x4f4a('0xc')](_0x4f4a('0xd'),null);}this['setDataValue'](_0x4f4a('0xe'),_0x4894c4);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc877=['name','STRING','generate','ENUM','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc877,0x7d));var _0x7c87=function(_0x4e7ab9,_0x3f6e8a){_0x4e7ab9=_0x4e7ab9-0x0;var _0xbfb8cc=_0xc877[_0x4e7ab9];return _0xbfb8cc;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x7c87('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x7c87('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0x7c87('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x7c87('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x7c87('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7c87('0x4')](_0x7c87('0x5'),_0x7c87('0x6'))},'accountSid':{'type':Sequelize[_0x7c87('0x2')]},'baseUrl':{'type':Sequelize[_0x7c87('0x2')]},'authToken':{'type':Sequelize[_0x7c87('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7c87('0x7');}},'notificationSound':{'type':Sequelize[_0x7c87('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x7c87('0x8')],'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[_0x7c87('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7c87('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7c87('0x9')],'comment':_0x7c87('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x7c87('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1b811a){if(!_0x1b811a){this[_0x7c87('0xb')](_0x7c87('0xc'),null);}this[_0x7c87('0xb')](_0x7c87('0xd'),_0x1b811a);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index c4b2102..654f788 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 _0x7abb=['show','options','create','body','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','rows','removeAnswers','addAgents','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','notify','Applications','account','sinch','statuses','WhatsappMessage','message_id','applications','orderBy','asc','CmContact','describe','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','from','From','whatsapp:','messageId','MessageSid','notifications','isNil','ValidationError','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','Contacts','DESC','list','omit','defaults','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','List','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','update','get','WhatsappAccounts','UserProfileResource','destroy','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0x7abb,0x1e6));var _0xb7ab=function(_0x1dfc71,_0x52cbd3){_0x1dfc71=_0x1dfc71-0x0;var _0x449188=_0x7abb[_0x1dfc71];return _0x449188;};'use strict';var emlformat=require(_0xb7ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb7ab('0x1'));var jsonpatch=require(_0xb7ab('0x2'));var rp=require(_0xb7ab('0x3'));var moment=require(_0xb7ab('0x4'));var BPromise=require(_0xb7ab('0x5'));var Mustache=require(_0xb7ab('0x6'));var util=require('util');var path=require(_0xb7ab('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb7ab('0x8'));var _=require(_0xb7ab('0x9'));var squel=require(_0xb7ab('0xa'));var crypto=require(_0xb7ab('0xb'));var jsforce=require(_0xb7ab('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb7ab('0xd'));var querystring=require(_0xb7ab('0xe'));var Papa=require(_0xb7ab('0xf'));var Redis=require('ioredis');var authService=require(_0xb7ab('0x10'));var qs=require(_0xb7ab('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb7ab('0x12'));var logger=require(_0xb7ab('0x13'))('api');var utils=require(_0xb7ab('0x14'));var config=require(_0xb7ab('0x15'));var licenseUtil=require(_0xb7ab('0x16'));var db=require(_0xb7ab('0x17'))['db'];config[_0xb7ab('0x18')]=_['defaults'](config[_0xb7ab('0x18')],{'host':_0xb7ab('0x19'),'port':0x18eb});var socket=require(_0xb7ab('0x1a'))(new Redis(config[_0xb7ab('0x18')]));require('./whatsappAccount.socket')[_0xb7ab('0x1b')](socket);var jayson=require(_0xb7ab('0x1c'));var client=jayson['client'][_0xb7ab('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0xff4588,_0x2a3730,_0x418c18,_0x147fb2){return new BPromise(function(_0x57725d,_0x55a2da){var _0x50156f=_0x147fb2||client;return _0x50156f[_0xb7ab('0x1e')](_0xff4588,_0x418c18)[_0xb7ab('0x1f')](function(_0x2e1559){logger[_0xb7ab('0x20')](_0xb7ab('0x21'),_0x2a3730,_0xb7ab('0x22'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2a3730,_0xb7ab('0x22'),JSON[_0xb7ab('0x23')](_0x2e1559));if(_0x2e1559[_0xb7ab('0x24')]){if(_0x2e1559[_0xb7ab('0x24')][_0xb7ab('0x25')]===0x1f4){logger[_0xb7ab('0x24')](_0xb7ab('0x21'),_0x2a3730,_0x2e1559[_0xb7ab('0x24')]['message']);return _0x55a2da(_0x2e1559['error'][_0xb7ab('0x26')]);}logger[_0xb7ab('0x24')](_0xb7ab('0x21'),_0x2a3730,_0x2e1559[_0xb7ab('0x24')][_0xb7ab('0x26')]);return _0x57725d(_0x2e1559[_0xb7ab('0x24')][_0xb7ab('0x26')]);}else{logger[_0xb7ab('0x20')](_0xb7ab('0x21'),_0x2a3730,_0xb7ab('0x22'));_0x57725d(_0x2e1559[_0xb7ab('0x27')]['message']);}})[_0xb7ab('0x28')](function(_0x3c7fd1){logger[_0xb7ab('0x24')](_0xb7ab('0x21'),_0x2a3730,_0x3c7fd1);_0x55a2da(_0x3c7fd1);});});}function respondWithStatusCode(_0x101945,_0x17da2a){_0x17da2a=_0x17da2a||0xcc;return function(_0x47c017){if(_0x47c017){return _0x101945['sendStatus'](_0x17da2a);}return _0x101945[_0xb7ab('0x29')](_0x17da2a)[_0xb7ab('0x2a')]();};}function respondWithResult(_0x2d642a,_0x20567b){_0x20567b=_0x20567b||0xc8;return function(_0x467b09){if(_0x467b09){return _0x2d642a[_0xb7ab('0x29')](_0x20567b)[_0xb7ab('0x2b')](_0x467b09);}};}function respondWithFilteredResult(_0x30db68,_0x33df9a){return function(_0x12ff5d){if(_0x12ff5d){var _0xe68c7f=typeof _0x33df9a[_0xb7ab('0x2c')]===_0xb7ab('0x2d')&&typeof _0x33df9a[_0xb7ab('0x2e')]===_0xb7ab('0x2d');var _0x24768e=_0x12ff5d['count'];var _0x12ee79=_0xe68c7f?0x0:_0x33df9a[_0xb7ab('0x2c')];var _0x427ce3=_0xe68c7f?_0x12ff5d[_0xb7ab('0x2f')]:_0x33df9a[_0xb7ab('0x2c')]+_0x33df9a[_0xb7ab('0x2e')];var _0x3e5db1;if(_0x427ce3>=_0x24768e){_0x427ce3=_0x24768e;_0x3e5db1=0xc8;}else{_0x3e5db1=0xce;}_0x30db68[_0xb7ab('0x29')](_0x3e5db1);return _0x30db68[_0xb7ab('0x30')]('Content-Range',_0x12ee79+'-'+_0x427ce3+'/'+_0x24768e)[_0xb7ab('0x2b')](_0x12ff5d);}return null;};}function patchUpdates(_0x485dc5){return function(_0x306b07){try{jsonpatch['apply'](_0x306b07,_0x485dc5,!![]);}catch(_0x2242a6){return BPromise['reject'](_0x2242a6);}return _0x306b07['save']();};}function saveUpdates(_0x4a2aee,_0x18522a){return function(_0x1c65fc){if(_0x1c65fc){return _0x1c65fc[_0xb7ab('0x31')](_0x4a2aee)[_0xb7ab('0x1f')](function(_0x288ee9){return _0x288ee9;});}return null;};}function removeEntity(_0x49e58c,_0x2f4470){return function(_0x311d97){if(_0x311d97){return _0x311d97['destroy']()['then'](function(){var _0x12aa65=_0x311d97[_0xb7ab('0x32')]({'plain':!![]});var _0x422809=_0xb7ab('0x33');return db[_0xb7ab('0x34')][_0xb7ab('0x35')]({'where':{'type':_0x422809,'resourceId':_0x12aa65['id']}})['then'](function(){return _0x311d97;});})[_0xb7ab('0x1f')](function(){_0x49e58c[_0xb7ab('0x29')](0xcc)[_0xb7ab('0x2a')]();});}};}function handleEntityNotFound(_0x3300d9,_0x50f9b2){return function(_0x5bf3e7){if(!_0x5bf3e7){_0x3300d9[_0xb7ab('0x36')](0x194);}return _0x5bf3e7;};}function handleError(_0x47e77d,_0x4b3dc3){_0x4b3dc3=_0x4b3dc3||0x1f4;return function(_0x5889c7){logger[_0xb7ab('0x24')](_0x5889c7['stack']);if(_0x5889c7[_0xb7ab('0x37')]){delete _0x5889c7[_0xb7ab('0x37')];}_0x47e77d[_0xb7ab('0x29')](_0x4b3dc3)[_0xb7ab('0x38')](_0x5889c7);};}exports[_0xb7ab('0x39')]=function(_0x29ba05,_0x2ca248){var _0x95395a={'include':[{'model':db[_0xb7ab('0x3a')],'as':_0xb7ab('0x3b')}]},_0x3da8f6={},_0x490d77={'count':0x0,'rows':[]};var _0x17db90=_[_0xb7ab('0x3c')](db[_0xb7ab('0x3d')][_0xb7ab('0x3e')],function(_0x24feb2){return{'name':_0x24feb2['fieldName'],'type':_0x24feb2['type']['key']};});_0x3da8f6[_0xb7ab('0x3f')]=_[_0xb7ab('0x3c')](_0x17db90,'name');_0x3da8f6[_0xb7ab('0x40')]=_[_0xb7ab('0x41')](_0x29ba05[_0xb7ab('0x40')]);_0x3da8f6[_0xb7ab('0x42')]=_['intersection'](_0x3da8f6[_0xb7ab('0x3f')],_0x3da8f6[_0xb7ab('0x40')]);_0x95395a[_0xb7ab('0x43')]=_[_0xb7ab('0x44')](_0x3da8f6[_0xb7ab('0x3f')],qs[_0xb7ab('0x45')](_0x29ba05['query'][_0xb7ab('0x45')]));_0x95395a[_0xb7ab('0x43')]=_0x95395a['attributes'][_0xb7ab('0x46')]?_0x95395a[_0xb7ab('0x43')]:_0x3da8f6[_0xb7ab('0x3f')];if(!_0x29ba05[_0xb7ab('0x40')][_0xb7ab('0x47')](_0xb7ab('0x48'))){_0x95395a[_0xb7ab('0x2e')]=qs[_0xb7ab('0x2e')](_0x29ba05[_0xb7ab('0x40')]['limit']);_0x95395a['offset']=qs[_0xb7ab('0x2c')](_0x29ba05[_0xb7ab('0x40')][_0xb7ab('0x2c')]);}_0x95395a[_0xb7ab('0x49')]=qs[_0xb7ab('0x4a')](_0x29ba05['query'][_0xb7ab('0x4a')]);_0x95395a[_0xb7ab('0x4b')]=qs[_0xb7ab('0x42')](_[_0xb7ab('0x4c')](_0x29ba05[_0xb7ab('0x40')],_0x3da8f6[_0xb7ab('0x42')]),_0x17db90);if(_0x29ba05[_0xb7ab('0x40')][_0xb7ab('0x4d')]){_0x95395a[_0xb7ab('0x4b')]=_[_0xb7ab('0x4e')](_0x95395a['where'],{'$or':_['map'](_0x17db90,function(_0x3d22b6){if(_0x3d22b6[_0xb7ab('0x4f')]!==_0xb7ab('0x50')){var _0xcbd988={};_0xcbd988[_0x3d22b6['name']]={'$like':'%'+_0x29ba05[_0xb7ab('0x40')]['filter']+'%'};return _0xcbd988;}})});}_0x95395a=_[_0xb7ab('0x4e')]({},_0x95395a,_0x29ba05['options']);var _0x339415={'where':_0x95395a[_0xb7ab('0x4b')]};return db['WhatsappAccount'][_0xb7ab('0x2f')](_0x339415)[_0xb7ab('0x1f')](function(_0x3fa2bb){_0x490d77[_0xb7ab('0x2f')]=_0x3fa2bb;if(_0x29ba05[_0xb7ab('0x40')][_0xb7ab('0x51')]){_0x95395a[_0xb7ab('0x52')]=[{'all':!![]}];}return db[_0xb7ab('0x3d')][_0xb7ab('0x53')](_0x95395a);})['then'](function(_0x44aaae){_0x490d77['rows']=_0x44aaae;return _0x490d77;})[_0xb7ab('0x1f')](respondWithFilteredResult(_0x2ca248,_0x95395a))[_0xb7ab('0x28')](handleError(_0x2ca248,null));};exports[_0xb7ab('0x54')]=function(_0x3e09dd,_0x155c1b){var _0x4b0ba9={'raw':![],'where':{'id':_0x3e09dd['params']['id']},'include':[{'model':db[_0xb7ab('0x3a')],'as':_0xb7ab('0x3b')}]},_0x356fc0={};_0x356fc0[_0xb7ab('0x3f')]=_[_0xb7ab('0x41')](db[_0xb7ab('0x3d')][_0xb7ab('0x3e')]);_0x356fc0['query']=_[_0xb7ab('0x41')](_0x3e09dd[_0xb7ab('0x40')]);_0x356fc0[_0xb7ab('0x42')]=_['intersection'](_0x356fc0[_0xb7ab('0x3f')],_0x356fc0[_0xb7ab('0x40')]);_0x4b0ba9[_0xb7ab('0x43')]=_[_0xb7ab('0x44')](_0x356fc0[_0xb7ab('0x3f')],qs[_0xb7ab('0x45')](_0x3e09dd[_0xb7ab('0x40')][_0xb7ab('0x45')]));_0x4b0ba9['attributes']=_0x4b0ba9[_0xb7ab('0x43')][_0xb7ab('0x46')]?_0x4b0ba9[_0xb7ab('0x43')]:_0x356fc0['model'];if(_0x3e09dd[_0xb7ab('0x40')][_0xb7ab('0x51')]){_0x4b0ba9[_0xb7ab('0x52')]=[{'all':!![]}];}_0x4b0ba9=_[_0xb7ab('0x4e')]({},_0x4b0ba9,_0x3e09dd[_0xb7ab('0x55')]);return db['WhatsappAccount']['find'](_0x4b0ba9)['then'](handleEntityNotFound(_0x155c1b,null))[_0xb7ab('0x1f')](respondWithResult(_0x155c1b,null))['catch'](handleError(_0x155c1b,null));};exports[_0xb7ab('0x56')]=function(_0x35ddf5,_0x1265fa){return db[_0xb7ab('0x3d')][_0xb7ab('0x56')](_0x35ddf5[_0xb7ab('0x57')],{})[_0xb7ab('0x1f')](function(_0xd8b67e){var _0x37a4f7=_0x35ddf5[_0xb7ab('0x58')][_0xb7ab('0x32')]({'plain':!![]});if(!_0x37a4f7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37a4f7[_0xb7ab('0x59')]===_0xb7ab('0x58')){var _0x1d2946=_0xd8b67e[_0xb7ab('0x32')]({'plain':!![]});var _0x3dca20='WhatsappAccounts';return db[_0xb7ab('0x5a')]['find']({'where':{'name':_0x3dca20,'userProfileId':_0x37a4f7['userProfileId']},'raw':!![]})[_0xb7ab('0x1f')](function(_0x51d809){if(_0x51d809&&_0x51d809['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1d2946[_0xb7ab('0x37')],'resourceId':_0x1d2946['id'],'type':_0x51d809[_0xb7ab('0x37')],'sectionId':_0x51d809['id']},{})[_0xb7ab('0x1f')](function(){return _0xd8b67e;});}else{return _0xd8b67e;}})[_0xb7ab('0x28')](function(_0x549d9a){logger[_0xb7ab('0x24')](_0xb7ab('0x5b'),_0x549d9a);throw _0x549d9a;});}return _0xd8b67e;})[_0xb7ab('0x1f')](respondWithResult(_0x1265fa,0xc9))[_0xb7ab('0x28')](handleError(_0x1265fa,null));};exports[_0xb7ab('0x31')]=function(_0x5cdc7d,_0x1e1753){if(_0x5cdc7d['body']['id']){delete _0x5cdc7d['body']['id'];}return db[_0xb7ab('0x3d')][_0xb7ab('0x5c')]({'where':{'id':_0x5cdc7d[_0xb7ab('0x5d')]['id']},'include':[{'model':db[_0xb7ab('0x3a')],'as':_0xb7ab('0x3b')}]})[_0xb7ab('0x1f')](handleEntityNotFound(_0x1e1753,null))[_0xb7ab('0x1f')](saveUpdates(_0x5cdc7d['body'],null))[_0xb7ab('0x1f')](respondWithResult(_0x1e1753,null))[_0xb7ab('0x28')](handleError(_0x1e1753,null));};exports[_0xb7ab('0x35')]=function(_0x41b553,_0x15997f){return db[_0xb7ab('0x3d')][_0xb7ab('0x5c')]({'where':{'id':_0x41b553['params']['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x15997f,null))[_0xb7ab('0x1f')](removeEntity(_0x15997f,null))['catch'](handleError(_0x15997f,null));};exports['describe']=function(_0x5ea87f,_0xfa7db8){return db[_0xb7ab('0x3d')]['describe']()[_0xb7ab('0x1f')](respondWithResult(_0xfa7db8,null))[_0xb7ab('0x28')](handleError(_0xfa7db8,null));};exports[_0xb7ab('0x5e')]=function(_0x2e9442,_0x1bed3b,_0x26f480){if(_0x2e9442[_0xb7ab('0x57')]['id']){delete _0x2e9442[_0xb7ab('0x57')]['id'];}return db['WhatsappAccount'][_0xb7ab('0x5c')]({'where':{'id':_0x2e9442[_0xb7ab('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1bed3b,null))[_0xb7ab('0x1f')](function(_0x31d39d){if(_0x31d39d){_0x2e9442[_0xb7ab('0x57')][_0xb7ab('0x5f')]=_0x31d39d['id'];return db[_0xb7ab('0x60')][_0xb7ab('0x56')](_0x2e9442[_0xb7ab('0x57')]);}})[_0xb7ab('0x1f')](respondWithResult(_0x1bed3b,null))['catch'](handleError(_0x1bed3b,null));};exports[_0xb7ab('0x61')]=function(_0x5550cc,_0x17a437,_0x2a917b){var _0x3562c2={'raw':![],'where':{}};var _0x3f920e={};var _0x3144e3={'count':0x0,'rows':[]};return db[_0xb7ab('0x3d')][_0xb7ab('0x62')]({'where':{'id':_0x5550cc[_0xb7ab('0x5d')]['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x17a437,null))[_0xb7ab('0x1f')](function(_0x5b597f){if(_0x5b597f){_0x3f920e[_0xb7ab('0x3f')]=_['keys'](db[_0xb7ab('0x60')][_0xb7ab('0x3e')]);_0x3f920e[_0xb7ab('0x40')]=_['keys'](_0x5550cc[_0xb7ab('0x40')]);_0x3f920e[_0xb7ab('0x42')]=_[_0xb7ab('0x44')](_0x3f920e[_0xb7ab('0x3f')],_0x3f920e[_0xb7ab('0x40')]);_0x3562c2[_0xb7ab('0x43')]=_[_0xb7ab('0x44')](_0x3f920e[_0xb7ab('0x3f')],qs[_0xb7ab('0x45')](_0x5550cc[_0xb7ab('0x40')]['fields']));_0x3562c2[_0xb7ab('0x43')]=_0x3562c2[_0xb7ab('0x43')]['length']?_0x3562c2[_0xb7ab('0x43')]:_0x3f920e['model'];if(!_0x5550cc[_0xb7ab('0x40')]['hasOwnProperty']('nolimit')){_0x3562c2['limit']=qs[_0xb7ab('0x2e')](_0x5550cc[_0xb7ab('0x40')][_0xb7ab('0x2e')]);_0x3562c2[_0xb7ab('0x2c')]=qs[_0xb7ab('0x2c')](_0x5550cc[_0xb7ab('0x40')][_0xb7ab('0x2c')]);}_0x3562c2[_0xb7ab('0x49')]=qs['sort'](_0x5550cc[_0xb7ab('0x40')][_0xb7ab('0x4a')]);_0x3562c2[_0xb7ab('0x4b')]=qs[_0xb7ab('0x42')](_[_0xb7ab('0x4c')](_0x5550cc[_0xb7ab('0x40')],_0x3f920e[_0xb7ab('0x42')]));_0x3562c2[_0xb7ab('0x4b')][_0xb7ab('0x5f')]=_0x5b597f['id'];if(_0x5550cc[_0xb7ab('0x40')][_0xb7ab('0x4d')]){_0x3562c2[_0xb7ab('0x4b')]=_[_0xb7ab('0x4e')](_0x3562c2[_0xb7ab('0x4b')],{'$or':_['map'](_0x3562c2[_0xb7ab('0x43')],function(_0x13e254){var _0x306c74={};_0x306c74[_0x13e254]={'$like':'%'+_0x5550cc['query'][_0xb7ab('0x4d')]+'%'};return _0x306c74;})});}_0x3562c2=_[_0xb7ab('0x4e')]({},_0x3562c2,_0x5550cc['options']);return db[_0xb7ab('0x60')][_0xb7ab('0x2f')]({'where':_0x3562c2[_0xb7ab('0x4b')]})[_0xb7ab('0x1f')](function(_0x4b2b6d){_0x3144e3[_0xb7ab('0x2f')]=_0x4b2b6d;if(_0x5550cc['query']['includeAll']){_0x3562c2['include']=[{'all':!![]}];}return db[_0xb7ab('0x60')]['findAll'](_0x3562c2);})[_0xb7ab('0x1f')](function(_0x3ff6b6){_0x3144e3['rows']=_0x3ff6b6;return _0x3144e3;});}})[_0xb7ab('0x1f')](respondWithFilteredResult(_0x17a437,_0x3562c2))['catch'](handleError(_0x17a437,null));};exports[_0xb7ab('0x63')]=function(_0x38b8ab,_0x2f80e5,_0x532871){return db[_0xb7ab('0x3d')][_0xb7ab('0x5c')]({'where':{'id':_0x38b8ab[_0xb7ab('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2f80e5,null))[_0xb7ab('0x1f')](function(_0x21676b){if(_0x21676b){return _0x21676b[_0xb7ab('0x63')](_0x38b8ab['query'][_0xb7ab('0x64')]);}})[_0xb7ab('0x1f')](respondWithStatusCode(_0x2f80e5,null))[_0xb7ab('0x28')](handleError(_0x2f80e5,null));};exports[_0xb7ab('0x65')]=function(_0x595fe5,_0x3c6dc5,_0x19bf1f){if(_0x595fe5[_0xb7ab('0x57')]['id']){delete _0x595fe5[_0xb7ab('0x57')]['id'];}return db[_0xb7ab('0x3d')][_0xb7ab('0x5c')]({'where':{'id':_0x595fe5[_0xb7ab('0x5d')]['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x3c6dc5,null))[_0xb7ab('0x1f')](function(_0x2c82c2){if(_0x2c82c2){_0x595fe5[_0xb7ab('0x57')][_0xb7ab('0x5f')]=_0x2c82c2['id'];return db[_0xb7ab('0x66')][_0xb7ab('0x56')](_0x595fe5[_0xb7ab('0x57')]);}})[_0xb7ab('0x1f')](respondWithResult(_0x3c6dc5,null))[_0xb7ab('0x28')](handleError(_0x3c6dc5,null));};exports['getAnswers']=function(_0x5a0743,_0x335280,_0x560922){var _0x4deb60={'raw':![],'where':{}};var _0x474a37={};var _0x2ac4e7={'count':0x0,'rows':[]};return db[_0xb7ab('0x3d')][_0xb7ab('0x62')]({'where':{'id':_0x5a0743[_0xb7ab('0x5d')]['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x335280,null))['then'](function(_0x540c9e){if(_0x540c9e){_0x474a37[_0xb7ab('0x3f')]=_['keys'](db['CannedAnswer'][_0xb7ab('0x3e')]);_0x474a37['query']=_['keys'](_0x5a0743['query']);_0x474a37[_0xb7ab('0x42')]=_[_0xb7ab('0x44')](_0x474a37[_0xb7ab('0x3f')],_0x474a37[_0xb7ab('0x40')]);_0x4deb60[_0xb7ab('0x43')]=_[_0xb7ab('0x44')](_0x474a37['model'],qs[_0xb7ab('0x45')](_0x5a0743[_0xb7ab('0x40')][_0xb7ab('0x45')]));_0x4deb60[_0xb7ab('0x43')]=_0x4deb60[_0xb7ab('0x43')][_0xb7ab('0x46')]?_0x4deb60[_0xb7ab('0x43')]:_0x474a37[_0xb7ab('0x3f')];if(!_0x5a0743[_0xb7ab('0x40')][_0xb7ab('0x47')]('nolimit')){_0x4deb60[_0xb7ab('0x2e')]=qs[_0xb7ab('0x2e')](_0x5a0743[_0xb7ab('0x40')][_0xb7ab('0x2e')]);_0x4deb60['offset']=qs[_0xb7ab('0x2c')](_0x5a0743[_0xb7ab('0x40')]['offset']);}_0x4deb60[_0xb7ab('0x49')]=qs[_0xb7ab('0x4a')](_0x5a0743[_0xb7ab('0x40')][_0xb7ab('0x4a')]);_0x4deb60[_0xb7ab('0x4b')]=qs[_0xb7ab('0x42')](_[_0xb7ab('0x4c')](_0x5a0743[_0xb7ab('0x40')],_0x474a37[_0xb7ab('0x42')]));_0x4deb60[_0xb7ab('0x4b')][_0xb7ab('0x5f')]=_0x540c9e['id'];if(_0x5a0743['query'][_0xb7ab('0x4d')]){_0x4deb60[_0xb7ab('0x4b')]=_[_0xb7ab('0x4e')](_0x4deb60[_0xb7ab('0x4b')],{'$or':_['map'](_0x4deb60['attributes'],function(_0x5b1261){var _0x7b3c41={};_0x7b3c41[_0x5b1261]={'$like':'%'+_0x5a0743[_0xb7ab('0x40')][_0xb7ab('0x4d')]+'%'};return _0x7b3c41;})});}_0x4deb60=_[_0xb7ab('0x4e')]({},_0x4deb60,_0x5a0743[_0xb7ab('0x55')]);return db[_0xb7ab('0x66')][_0xb7ab('0x2f')]({'where':_0x4deb60[_0xb7ab('0x4b')]})[_0xb7ab('0x1f')](function(_0x41bf4e){_0x2ac4e7[_0xb7ab('0x2f')]=_0x41bf4e;if(_0x5a0743[_0xb7ab('0x40')][_0xb7ab('0x51')]){_0x4deb60[_0xb7ab('0x52')]=[{'all':!![]}];}return db[_0xb7ab('0x66')][_0xb7ab('0x53')](_0x4deb60);})[_0xb7ab('0x1f')](function(_0x3bdf79){_0x2ac4e7[_0xb7ab('0x67')]=_0x3bdf79;return _0x2ac4e7;});}})[_0xb7ab('0x1f')](respondWithFilteredResult(_0x335280,_0x4deb60))[_0xb7ab('0x28')](handleError(_0x335280,null));};exports[_0xb7ab('0x68')]=function(_0x3e2f58,_0x513b6c,_0x206227){return db[_0xb7ab('0x3d')][_0xb7ab('0x5c')]({'where':{'id':_0x3e2f58[_0xb7ab('0x5d')]['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x513b6c,null))[_0xb7ab('0x1f')](function(_0x34d292){if(_0x34d292){return _0x34d292['removeAnswers'](_0x3e2f58[_0xb7ab('0x40')][_0xb7ab('0x64')]);}})[_0xb7ab('0x1f')](respondWithStatusCode(_0x513b6c,null))[_0xb7ab('0x28')](handleError(_0x513b6c,null));};exports[_0xb7ab('0x69')]=function(_0x34c500,_0x16b43d,_0x567a2e){return db['WhatsappAccount'][_0xb7ab('0x5c')]({'where':{'id':_0x34c500[_0xb7ab('0x5d')]['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x16b43d,null))['then'](function(_0x386bb8){if(_0x386bb8){return _0x386bb8['addAgents'](_0x34c500[_0xb7ab('0x57')][_0xb7ab('0x64')],_['omit'](_0x34c500['body'],['ids','id'])||{})[_0xb7ab('0x6a')](function(_0x4b8aac){for(var _0x5b722a=0x0;_0x5b722a<_0x34c500[_0xb7ab('0x57')][_0xb7ab('0x64')][_0xb7ab('0x46')];_0x5b722a+=0x1){socket['emit'](_0xb7ab('0x6b'),{'UserId':Number(_0x34c500[_0xb7ab('0x57')][_0xb7ab('0x64')][_0x5b722a]),'WhatsappAccountId':Number(_0x34c500[_0xb7ab('0x5d')]['id'])});}return _0x4b8aac;});}})[_0xb7ab('0x1f')](respondWithResult(_0x16b43d,null))[_0xb7ab('0x28')](handleError(_0x16b43d,null));};exports[_0xb7ab('0x6c')]=function(_0x3b6a0e,_0x23a9f9,_0x53800b){return db[_0xb7ab('0x3d')][_0xb7ab('0x5c')]({'where':{'id':_0x3b6a0e[_0xb7ab('0x5d')]['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x23a9f9,null))[_0xb7ab('0x1f')](function(_0x116a08){if(_0x116a08){return _0x116a08[_0xb7ab('0x6c')](_0x3b6a0e['query'][_0xb7ab('0x64')])[_0xb7ab('0x1f')](function(){if(_[_0xb7ab('0x6d')](_0x3b6a0e['query'][_0xb7ab('0x64')])){for(var _0x3f3db8=0x0;_0x3f3db8<_0x3b6a0e[_0xb7ab('0x40')][_0xb7ab('0x64')][_0xb7ab('0x46')];_0x3f3db8+=0x1){socket[_0xb7ab('0x6e')](_0xb7ab('0x6f'),{'UserId':Number(_0x3b6a0e[_0xb7ab('0x40')][_0xb7ab('0x64')][_0x3f3db8]),'WhatsappAccountId':Number(_0x3b6a0e['params']['id'])});}}else{socket[_0xb7ab('0x6e')](_0xb7ab('0x6f'),{'UserId':Number(_0x3b6a0e[_0xb7ab('0x40')][_0xb7ab('0x64')]),'WhatsappAccountId':Number(_0x3b6a0e[_0xb7ab('0x5d')]['id'])});}});}})[_0xb7ab('0x1f')](respondWithStatusCode(_0x23a9f9,null))[_0xb7ab('0x28')](handleError(_0x23a9f9,null));};exports[_0xb7ab('0x70')]=function(_0x5cdb9c,_0x3dd533,_0x2545f7){var _0x39d939={};var _0x4973e5={};var _0x2d131a;var _0xde3443;return db[_0xb7ab('0x3d')][_0xb7ab('0x62')]({'where':{'id':_0x5cdb9c['params']['id']}})['then'](handleEntityNotFound(_0x3dd533,null))['then'](function(_0x26c51e){if(_0x26c51e){_0x2d131a=_0x26c51e;_0x4973e5[_0xb7ab('0x3f')]=_[_0xb7ab('0x41')](db[_0xb7ab('0x71')][_0xb7ab('0x3e')]);_0x4973e5['query']=_[_0xb7ab('0x41')](_0x5cdb9c['query']);_0x4973e5['filters']=_[_0xb7ab('0x44')](_0x4973e5[_0xb7ab('0x3f')],_0x4973e5[_0xb7ab('0x40')]);_0x39d939[_0xb7ab('0x43')]=_['intersection'](_0x4973e5[_0xb7ab('0x3f')],qs['fields'](_0x5cdb9c[_0xb7ab('0x40')][_0xb7ab('0x45')]));_0x39d939[_0xb7ab('0x43')]=_0x39d939['attributes'][_0xb7ab('0x46')]?_0x39d939[_0xb7ab('0x43')]:_0x4973e5[_0xb7ab('0x3f')];_0x39d939[_0xb7ab('0x49')]=qs[_0xb7ab('0x4a')](_0x5cdb9c[_0xb7ab('0x40')][_0xb7ab('0x4a')]);_0x39d939['where']=qs['filters'](_['pick'](_0x5cdb9c[_0xb7ab('0x40')],_0x4973e5['filters']));if(_0x5cdb9c[_0xb7ab('0x40')][_0xb7ab('0x4d')]){_0x39d939['where']=_['merge'](_0x39d939[_0xb7ab('0x4b')],{'$or':_[_0xb7ab('0x3c')](_0x39d939['attributes'],function(_0x55059a){var _0x2a0918={};_0x2a0918[_0x55059a]={'$like':'%'+_0x5cdb9c[_0xb7ab('0x40')][_0xb7ab('0x4d')]+'%'};return _0x2a0918;})});}_0x39d939=_[_0xb7ab('0x4e')]({},_0x39d939,_0x5cdb9c[_0xb7ab('0x55')]);return _0x2d131a[_0xb7ab('0x70')](_0x39d939);}})[_0xb7ab('0x1f')](function(_0x1dc03c){if(_0x1dc03c){_0xde3443=_0x1dc03c[_0xb7ab('0x46')];if(!_0x5cdb9c[_0xb7ab('0x40')]['hasOwnProperty'](_0xb7ab('0x48'))){_0x39d939[_0xb7ab('0x2e')]=qs['limit'](_0x5cdb9c['query']['limit']);_0x39d939[_0xb7ab('0x2c')]=qs[_0xb7ab('0x2c')](_0x5cdb9c[_0xb7ab('0x40')][_0xb7ab('0x2c')]);}return _0x2d131a[_0xb7ab('0x70')](_0x39d939);}})[_0xb7ab('0x1f')](function(_0x265fe0){if(_0x265fe0){return _0x265fe0?{'count':_0xde3443,'rows':_0x265fe0}:null;}})['then'](respondWithResult(_0x3dd533,null))[_0xb7ab('0x28')](handleError(_0x3dd533,null));};exports[_0xb7ab('0x72')]=function(_0x471533,_0xbc8fd){var _0x490048=_0x471533['params']['id'];var _0x53d9d2=_0x471533['body'];var _0x302af8=0xc8;var _0x4cb70b=null;return db[_0xb7ab('0x73')]['transaction']({'isolationLevel':db[_0xb7ab('0x73')][_0xb7ab('0x74')][_0xb7ab('0x75')][_0xb7ab('0x76')]},function(_0x72c5cf){return db[_0xb7ab('0x3d')][_0xb7ab('0x62')]({'where':{'id':_0x490048},'transaction':_0x72c5cf})[_0xb7ab('0x1f')](function(_0x295d1d){if(_0x295d1d){return db['WhatsappApplication'][_0xb7ab('0x35')]({'where':{'WhatsappAccountId':_0x490048},'transaction':_0x72c5cf})['then'](function(){var _0xae7ccd=_['map'](_0x53d9d2,function(_0x176b45){_0x176b45[_0xb7ab('0x5f')]=_0x490048;return _0x176b45;});return db[_0xb7ab('0x77')][_0xb7ab('0x78')](_0xae7ccd,{'transaction':_0x72c5cf});});}else{_0x302af8=0x194;_0x4cb70b=[];}});})[_0xb7ab('0x1f')](function(){if(_0x302af8!==0x194){return db['WhatsappApplication'][_0xb7ab('0x79')]({'where':{'WhatsappAccountId':_0x490048},'order':_0xb7ab('0x7a')})['then'](function(_0x2cd456){_0x4cb70b=_0x2cd456;});}})[_0xb7ab('0x28')](function(_0x250690){_0x302af8=0x1f4;logger['error'](_0x250690[_0xb7ab('0x7b')]);if(_0x250690[_0xb7ab('0x37')]){delete _0x250690[_0xb7ab('0x37')];}_0x4cb70b=_0x250690;})[_0xb7ab('0x7c')](function(){if(_0x4cb70b===null){_0xbc8fd[_0xb7ab('0x36')](_0x302af8);}else{if(_0x302af8===0x1f4){_0xbc8fd[_0xb7ab('0x29')](_0x302af8)[_0xb7ab('0x38')](_0x4cb70b);}else{_0xbc8fd[_0xb7ab('0x29')](_0x302af8)[_0xb7ab('0x2b')](_0x4cb70b);}}});};exports[_0xb7ab('0x7d')]=function(_0x1ecb0a,_0x100967,_0x2ed6b1){var _0xc21602={};var _0x5ee773={};var _0x1b3b58;var _0x1d8297;return db[_0xb7ab('0x3d')]['findOne']({'where':{'id':_0x1ecb0a['params']['id']}})['then'](handleEntityNotFound(_0x100967,null))['then'](function(_0x3ca164){if(_0x3ca164){_0x1b3b58=_0x3ca164;_0x5ee773['model']=_[_0xb7ab('0x41')](db[_0xb7ab('0x77')]['rawAttributes']);_0x5ee773[_0xb7ab('0x40')]=_[_0xb7ab('0x41')](_0x1ecb0a[_0xb7ab('0x40')]);_0x5ee773['filters']=_[_0xb7ab('0x44')](_0x5ee773[_0xb7ab('0x3f')],_0x5ee773[_0xb7ab('0x40')]);_0xc21602['attributes']=_[_0xb7ab('0x44')](_0x5ee773['model'],qs[_0xb7ab('0x45')](_0x1ecb0a[_0xb7ab('0x40')][_0xb7ab('0x45')]));_0xc21602[_0xb7ab('0x43')]=_0xc21602[_0xb7ab('0x43')][_0xb7ab('0x46')]?_0xc21602[_0xb7ab('0x43')]:_0x5ee773[_0xb7ab('0x3f')];_0xc21602[_0xb7ab('0x49')]=qs['sort'](_0x1ecb0a[_0xb7ab('0x40')][_0xb7ab('0x4a')]);_0xc21602[_0xb7ab('0x4b')]=qs[_0xb7ab('0x42')](_[_0xb7ab('0x4c')](_0x1ecb0a[_0xb7ab('0x40')],_0x5ee773['filters']));if(_0x1ecb0a[_0xb7ab('0x40')]['filter']){_0xc21602[_0xb7ab('0x4b')]=_[_0xb7ab('0x4e')](_0xc21602[_0xb7ab('0x4b')],{'$or':_[_0xb7ab('0x3c')](_0xc21602[_0xb7ab('0x43')],function(_0x1237dd){var _0x2c9584={};_0x2c9584[_0x1237dd]={'$like':'%'+_0x1ecb0a[_0xb7ab('0x40')][_0xb7ab('0x4d')]+'%'};return _0x2c9584;})});}_0xc21602=_[_0xb7ab('0x4e')]({},_0xc21602,_0x1ecb0a[_0xb7ab('0x55')]);return _0x1b3b58[_0xb7ab('0x7d')](_0xc21602);}})[_0xb7ab('0x1f')](function(_0x381eec){if(_0x381eec){_0x1d8297=_0x381eec[_0xb7ab('0x46')];if(!_0x1ecb0a[_0xb7ab('0x40')]['hasOwnProperty'](_0xb7ab('0x48'))){_0xc21602[_0xb7ab('0x2e')]=qs['limit'](_0x1ecb0a['query'][_0xb7ab('0x2e')]);_0xc21602[_0xb7ab('0x2c')]=qs[_0xb7ab('0x2c')](_0x1ecb0a[_0xb7ab('0x40')][_0xb7ab('0x2c')]);}return _0x1b3b58[_0xb7ab('0x7d')](_0xc21602);}})[_0xb7ab('0x1f')](function(_0x2d3073){if(_0x2d3073){return _0x2d3073?{'count':_0x1d8297,'rows':_0x2d3073}:null;}})[_0xb7ab('0x1f')](respondWithResult(_0x100967,null))[_0xb7ab('0x28')](handleError(_0x100967,null));};exports[_0xb7ab('0x7e')]=function(_0x567d28,_0xffb54f,_0x3787f9){var _0x3840fb={'channel':'whatsapp'};var _0x307a64=[];var _0x379b02=[];var _0x4d0b59={};return db[_0xb7ab('0x3d')][_0xb7ab('0x5c')]({'where':{'id':_0x567d28[_0xb7ab('0x5d')]['id']},'include':[{'model':db[_0xb7ab('0x77')],'as':_0xb7ab('0x7f')}]})[_0xb7ab('0x1f')](handleEntityNotFound(_0xffb54f,null))[_0xb7ab('0x1f')](function(_0x4501ff){_0x3840fb[_0xb7ab('0x80')]=_0x4501ff;if(_0x3840fb[_0xb7ab('0x80')]&&_0x3840fb['account'][_0xb7ab('0x4f')]===_0xb7ab('0x81')&&_0x567d28[_0xb7ab('0x57')][_0xb7ab('0x82')]){if(_0x567d28[_0xb7ab('0x57')][_0xb7ab('0x82')][_0xb7ab('0x46')]===0x0)return;if(_0x567d28[_0xb7ab('0x57')]['statuses'][0x0]['state']!=='read')return;return db[_0xb7ab('0x83')][_0xb7ab('0x31')]({'read':!![],'readAt':_0x567d28[_0xb7ab('0x57')][_0xb7ab('0x82')][0x0]['timestamp']},{'where':{'messageId':_0x567d28[_0xb7ab('0x57')][_0xb7ab('0x82')][0x0][_0xb7ab('0x84')]},'individualHooks':!![]})[_0xb7ab('0x1f')](function(_0x285815){return _0xffb54f[_0xb7ab('0x29')](0xc8)[_0xb7ab('0x2b')](_0x285815);});}_0x3840fb[_0xb7ab('0x85')]=_[_0xb7ab('0x86')](_0x4501ff['Applications'],[_0xb7ab('0x7a')],[_0xb7ab('0x87')]);if(_0x3840fb[_0xb7ab('0x80')][_0xb7ab('0x7f')]){delete _0x3840fb[_0xb7ab('0x80')][_0xb7ab('0x7f')];}return db[_0xb7ab('0x88')][_0xb7ab('0x89')]()['then'](function(_0x1220b7){if(!_0x1220b7){throw new db[(_0xb7ab('0x8a'))]['ValidationError']('no\x20available\x20attributes');}_0x307a64=_[_0xb7ab('0x8b')](_['keys'](_0x1220b7),[_0xb7ab('0x8c'),_0xb7ab('0x8d')]);_0x379b02=_[_0xb7ab('0x8b')](_[_0xb7ab('0x41')](_0x1220b7),[_0xb7ab('0x8c'),_0xb7ab('0x8d'),_0xb7ab('0x8e'),_0xb7ab('0x8f')]);_0x3840fb[_0xb7ab('0x57')]={'mapKey':'mobile'};if(_0x3840fb['account']&&_0x3840fb['account']['type']==='twilio'){_0x3840fb['body'][_0xb7ab('0x90')]=_0x567d28['body'][_0xb7ab('0x91')]['replace'](_0xb7ab('0x92'),'');_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0x57')]=_0x567d28[_0xb7ab('0x57')]['Body'];_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0x93')]=_0x567d28['body'][_0xb7ab('0x94')];}if(_0x3840fb['account']&&_0x3840fb['account'][_0xb7ab('0x4f')]===_0xb7ab('0x81')){_0x3840fb['body'][_0xb7ab('0x90')]=_0x567d28[_0xb7ab('0x57')][_0xb7ab('0x95')][0x0][_0xb7ab('0x90')];_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0x57')]=_0x567d28[_0xb7ab('0x57')][_0xb7ab('0x95')][0x0]['message'][_0xb7ab('0x57')];_0x3840fb['body'][_0xb7ab('0x93')]=_0x567d28[_0xb7ab('0x57')][_0xb7ab('0x95')][0x0][_0xb7ab('0x84')];}if(_0x3840fb[_0xb7ab('0x57')]['id']){delete _0x3840fb[_0xb7ab('0x57')]['id'];}if(_[_0xb7ab('0x96')](_0x3840fb['body'][_0xb7ab('0x90')])){throw new db[(_0xb7ab('0x8a'))][(_0xb7ab('0x97'))](_0xb7ab('0x98'));}if(_[_0xb7ab('0x96')](_0x3840fb['body'][_0xb7ab('0x57')])||_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0x57')]===''){throw new db[(_0xb7ab('0x8a'))][(_0xb7ab('0x97'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x3840fb[_0xb7ab('0x57')]['mapKey'])){throw new db[(_0xb7ab('0x8a'))][(_0xb7ab('0x97'))](_0xb7ab('0x99')+_0x379b02);}if(!_[_0xb7ab('0x9a')](_0x379b02,_0x3840fb['body'][_0xb7ab('0x9b')])){throw new db[(_0xb7ab('0x8a'))][(_0xb7ab('0x97'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x379b02);}_0x4d0b59[_0x3840fb[_0xb7ab('0x57')]['mapKey']]=_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0x90')];return db['CmList']['find']({'where':{'id':_0x3840fb[_0xb7ab('0x80')][_0xb7ab('0x8f')]},'include':[{'model':db['CmContact'],'as':_0xb7ab('0x9c'),'where':_0x4d0b59,'limit':0x1,'order':[[_0xb7ab('0x8d'),_0xb7ab('0x9d')]]}]});})[_0xb7ab('0x1f')](handleEntityNotFound(_0xffb54f,null))['then'](function(_0x52c247){if(_0x52c247){_0x3840fb[_0xb7ab('0x9e')]=_[_0xb7ab('0x9f')](_0x52c247,['Contacts']);if(_0x52c247['Contacts'][_0xb7ab('0x46')]){return _0x52c247[_0xb7ab('0x9c')][0x0];}var _0x21b42a=_[_0xb7ab('0xa0')](_0x3840fb['body'],{'firstName':_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0x90')],'ListId':_0x52c247['id']});_0x21b42a[_0x3840fb['body'][_0xb7ab('0x9b')]]=_0x3840fb[_0xb7ab('0x57')]['from'];return db[_0xb7ab('0x88')]['create'](_0x21b42a,{'fields':_0x307a64,'raw':!![]});}})['then'](handleEntityNotFound(_0xffb54f,null))[_0xb7ab('0x1f')](function(_0x103c46){if(_0x103c46){_0x3840fb[_0xb7ab('0xa1')]=_0x103c46;var _0x18d6a7={'ContactId':_0x103c46['id'],'phone':_0x3840fb[_0xb7ab('0x57')]['from'],'WhatsappAccountId':_0x567d28[_0xb7ab('0x5d')]['id']};var _0x3bfd8c={'ContactId':_0x103c46['id'],'WhatsappAccountId':_0x567d28[_0xb7ab('0x5d')]['id'],'closed':![]};return db[_0xb7ab('0xa2')][_0xb7ab('0x5c')]({'where':_0x3bfd8c})[_0xb7ab('0x1f')](function(_0x4be14e){if(_0x4be14e){return[_0x4be14e,![]];}return db[_0xb7ab('0xa2')][_0xb7ab('0x56')](_0x18d6a7)[_0xb7ab('0x1f')](function(_0x542be3){return[_0x542be3,!![]];});});}})['spread'](function(_0x125fbd,_0xa7b802){_0x3840fb['interaction']=_0x125fbd[_0xb7ab('0x32')]({'plain':!![]});_0x3840fb[_0xb7ab('0xa3')][_0xb7ab('0xa4')]=![];if(_0xa7b802){if(_0x3840fb['account'][_0xb7ab('0xa5')]){_0x3840fb[_0xb7ab('0x85')][_0xb7ab('0xa6')]({'id':0x0,'priority':_0x3840fb[_0xb7ab('0x85')][_0xb7ab('0x46')]+0x1,'app':_0xb7ab('0xa7'),'appdata':_0xb7ab('0xa8'),'interval':_0xb7ab('0xa9')});}_0x3840fb[_0xb7ab('0xa3')][_0xb7ab('0xa4')]=!![];}return db['WhatsappMessage'][_0xb7ab('0x56')]({'phone':_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0x90')],'messageId':_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0x93')],'body':_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0x57')],'WhatsappAccountId':_0x567d28['params']['id'],'WhatsappInteractionId':_0x125fbd['id'],'direction':'in','ContactId':_0x125fbd['ContactId'],'AttachmentId':_0x3840fb[_0xb7ab('0x57')][_0xb7ab('0xaa')]});})['then'](function(_0x5002bc){_0x3840fb[_0xb7ab('0x26')]=_0x5002bc;if(_0x3840fb['interaction']['UserId']){return db[_0xb7ab('0x71')][_0xb7ab('0x5c')]({'attributes':['id',_0xb7ab('0x37')],'where':{'id':_0x3840fb['interaction'][_0xb7ab('0xab')]}})[_0xb7ab('0x1f')](function(_0x3b68df){if(_0x3b68df){_0x3840fb[_0xb7ab('0x85')][_0xb7ab('0xac')]({'id':0x0,'priority':0x0,'app':_0xb7ab('0xad'),'appdata':_0x3b68df['name']+','+(_0x3840fb['account'][_0xb7ab('0xae')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb7ab('0xaf'),_0xb7ab('0xb0'),_0x3840fb);});}return respondWithRpcPromise(_0xb7ab('0xaf'),'startRouting',_0x3840fb);})['then'](function(_0xcff844){if(_0xcff844){var _0x423929=0xc8;var _0x3fdecb=_0xb7ab('0xb1');logger[_0xb7ab('0x20')](_0xb7ab('0xb2'),_0x3fdecb,_0x423929,_0xb7ab('0xb3'));logger[_0xb7ab('0xb4')](_0xb7ab('0xb5'),_0x3fdecb,_0x423929,_0xb7ab('0xb3'),JSON[_0xb7ab('0x23')](_0xcff844));if(_0x3840fb[_0xb7ab('0x80')]['type']==='twilio'){return _0xffb54f[_0xb7ab('0x29')](_0x423929)['set'](_0xb7ab('0xb6'),'text/xml')[_0xb7ab('0x38')](_0xb7ab('0xb7'));}else{return _0xffb54f[_0xb7ab('0x29')](_0x423929)['json'](_0xcff844);}}});})[_0xb7ab('0x28')](handleError(_0xffb54f,null));};exports[_0xb7ab('0x38')]=function(_0x11293b,_0x4eadd7,_0x3d4708){var _0xc60fca,_0x2601e8,_0x14370a;if(_[_0xb7ab('0x96')](_0x11293b[_0xb7ab('0x57')][_0xb7ab('0x57')])||_0x11293b['body'][_0xb7ab('0x57')]===''){throw new db[(_0xb7ab('0x8a'))][(_0xb7ab('0x97'))](_0xb7ab('0xb8'));}if(_[_0xb7ab('0x96')](_0x11293b[_0xb7ab('0x57')]['to'])){throw new db['Sequelize'][(_0xb7ab('0x97'))]('to\x20is\x20mandatory');}_0xc60fca=_0x11293b['body']['to'];return db[_0xb7ab('0x3d')][_0xb7ab('0x5c')]({'where':{'id':_0x11293b[_0xb7ab('0x5d')]['id']},'include':[{'model':db[_0xb7ab('0xb9')],'as':_0xb7ab('0xba'),'include':[{'model':db['CmContact'],'as':_0xb7ab('0x9c'),'where':{'mobile':_0xc60fca},'limit':0x1,'order':[[_0xb7ab('0x8d'),_0xb7ab('0x9d')]]}]}]})[_0xb7ab('0x1f')](handleEntityNotFound(_0x4eadd7,null))[_0xb7ab('0x1f')](function(_0xa2fde6){if(_0xa2fde6&&_0xa2fde6[_0xb7ab('0xba')]){_0x2601e8=_0xa2fde6[_0xb7ab('0x32')]({'plain':!![]});if(_0x2601e8['List']&&_0x2601e8[_0xb7ab('0xba')]['Contacts'][_0xb7ab('0x46')]){return _0x2601e8[_0xb7ab('0xba')][_0xb7ab('0x9c')][0x0];}return db[_0xb7ab('0x88')][_0xb7ab('0x56')](_['defaults'](_0x11293b[_0xb7ab('0x57')],{'firstName':_0xc60fca,'mobile':_0xc60fca,'phone':_0xc60fca,'ListId':_0x2601e8[_0xb7ab('0x8f')]}));}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x4eadd7,null))['then'](function(_0x24072c){if(_0x24072c){_0x14370a=_0x24072c;return db[_0xb7ab('0xa2')]['find']({'where':{'ContactId':_0x14370a['id'],'closed':![],'WhatsappAccountId':_0x2601e8['id']}})[_0xb7ab('0x1f')](function(_0x190984){if(_0x190984){return[_0x190984,![]];}return db['WhatsappInteraction'][_0xb7ab('0x56')]({'UserId':_0x11293b['user']['id'],'ContactId':_0x14370a['id'],'WhatsappAccountId':_0x2601e8['id'],'phone':_0xc60fca,'firstMsgDirection':_0xb7ab('0xbb'),'Messages':[_[_0xb7ab('0x4e')](_0x11293b[_0xb7ab('0x57')],{'read':![],'body':_0x11293b[_0xb7ab('0x57')][_0xb7ab('0x57')],'phone':_0xc60fca,'WhatsappAccountId':_0x2601e8['id'],'UserId':_0x11293b[_0xb7ab('0x58')]['id'],'ContactId':_0x14370a['id']})]},{'include':[{'model':db[_0xb7ab('0x83')],'as':_0xb7ab('0xbc')}]})[_0xb7ab('0x1f')](function(_0x5aa89e){return[_0x5aa89e,!![]];});});}})[_0xb7ab('0x6a')](function(_0x3bd2cc,_0x161969){if(_0x161969){return _0x3bd2cc;}return db[_0xb7ab('0x83')][_0xb7ab('0x56')](_['merge'](_0x11293b[_0xb7ab('0x57')],{'read':![],'body':_0x11293b['body']['body'],'phone':_0xc60fca,'WhatsappAccountId':_0x2601e8['id'],'WhatsappInteractionId':_0x3bd2cc['id'],'UserId':_0x11293b[_0xb7ab('0x58')]['id'],'ContactId':_0x14370a['id']}))['then'](function(_0x35e8f9){_0x3bd2cc[_0xb7ab('0xbd')][_0xb7ab('0xbc')]=[];_0x3bd2cc[_0xb7ab('0xbd')][_0xb7ab('0xbc')][_0xb7ab('0xa6')](_0x35e8f9['dataValues']);return _0x3bd2cc;});})[_0xb7ab('0x1f')](respondWithResult(_0x4eadd7,null))['catch'](handleError(_0x4eadd7,null));}; \ No newline at end of file +var _0x611e=['agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','to\x20is\x20mandatory','List','Messages','dataValues','eml-format','fast-json-patch','request-promise','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','stack','send','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','name','body','describe','addDisposition','WhatsappAccountId','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','removeAgents','userWhatsappAccount:remove','getAgents','findOne','User','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','statuses','read','WhatsappMessage','message_id','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','MessageSid','sinch','notifications','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','defaults','contact','WhatsappInteraction','autoclose','applications','push','unmanaged','*,*,*,*','interaction','created','ContactId','AttachmentId','UserId','unshift'];(function(_0x5beb98,_0x560c65){var _0xb537b4=function(_0x11fad4){while(--_0x11fad4){_0x5beb98['push'](_0x5beb98['shift']());}};_0xb537b4(++_0x560c65);}(_0x611e,0xce));var _0xe611=function(_0x5e2983,_0x5e8414){_0x5e2983=_0x5e2983-0x0;var _0x2e80d4=_0x611e[_0x5e2983];return _0x2e80d4;};'use strict';var emlformat=require(_0xe611('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe611('0x1'));var rp=require(_0xe611('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe611('0x3'));var path=require(_0xe611('0x4'));var sox=require(_0xe611('0x5'));var csv=require('to-csv');var ejs=require(_0xe611('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe611('0x7'));var squel=require(_0xe611('0x8'));var crypto=require(_0xe611('0x9'));var jsforce=require(_0xe611('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe611('0xb'));var Papa=require(_0xe611('0xc'));var Redis=require(_0xe611('0xd'));var authService=require(_0xe611('0xe'));var qs=require(_0xe611('0xf'));var as=require(_0xe611('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe611('0x11'))('api');var utils=require(_0xe611('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xe611('0x13'));var db=require(_0xe611('0x14'))['db'];config[_0xe611('0x15')]=_['defaults'](config[_0xe611('0x15')],{'host':_0xe611('0x16'),'port':0x18eb});var socket=require(_0xe611('0x17'))(new Redis(config[_0xe611('0x15')]));require(_0xe611('0x18'))[_0xe611('0x19')](socket);var jayson=require(_0xe611('0x1a'));var client=jayson[_0xe611('0x1b')][_0xe611('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x17a4a6,_0x5262ec,_0x85f933,_0x4486f8){return new BPromise(function(_0x41b21e,_0x3100b2){var _0x31f4f4=_0x4486f8||client;return _0x31f4f4['request'](_0x17a4a6,_0x85f933)['then'](function(_0x527a06){logger['info'](_0xe611('0x1d'),_0x5262ec,_0xe611('0x1e'));logger[_0xe611('0x1f')](_0xe611('0x20'),_0x5262ec,_0xe611('0x1e'),JSON[_0xe611('0x21')](_0x527a06));if(_0x527a06[_0xe611('0x22')]){if(_0x527a06['error'][_0xe611('0x23')]===0x1f4){logger['error'](_0xe611('0x1d'),_0x5262ec,_0x527a06['error'][_0xe611('0x24')]);return _0x3100b2(_0x527a06[_0xe611('0x22')]['message']);}logger[_0xe611('0x22')](_0xe611('0x1d'),_0x5262ec,_0x527a06[_0xe611('0x22')][_0xe611('0x24')]);return _0x41b21e(_0x527a06['error'][_0xe611('0x24')]);}else{logger[_0xe611('0x25')](_0xe611('0x1d'),_0x5262ec,'request\x20sent');_0x41b21e(_0x527a06[_0xe611('0x26')][_0xe611('0x24')]);}})[_0xe611('0x27')](function(_0x47bf08){logger['error'](_0xe611('0x1d'),_0x5262ec,_0x47bf08);_0x3100b2(_0x47bf08);});});}function respondWithStatusCode(_0x423fcc,_0x81ba48){_0x81ba48=_0x81ba48||0xcc;return function(_0x3c07f3){if(_0x3c07f3){return _0x423fcc[_0xe611('0x28')](_0x81ba48);}return _0x423fcc[_0xe611('0x29')](_0x81ba48)[_0xe611('0x2a')]();};}function respondWithResult(_0x54c6ad,_0xca091a){_0xca091a=_0xca091a||0xc8;return function(_0x54f012){if(_0x54f012){return _0x54c6ad[_0xe611('0x29')](_0xca091a)['json'](_0x54f012);}};}function respondWithFilteredResult(_0x5a9c9e,_0x353ff8){return function(_0x510105){if(_0x510105){var _0x3370c5=typeof _0x353ff8[_0xe611('0x2b')]==='undefined'&&typeof _0x353ff8[_0xe611('0x2c')]===_0xe611('0x2d');var _0x4564d4=_0x510105[_0xe611('0x2e')];var _0x50bde2=_0x3370c5?0x0:_0x353ff8['offset'];var _0x31dc6b=_0x3370c5?_0x510105[_0xe611('0x2e')]:_0x353ff8[_0xe611('0x2b')]+_0x353ff8[_0xe611('0x2c')];var _0x57d8f8;if(_0x31dc6b>=_0x4564d4){_0x31dc6b=_0x4564d4;_0x57d8f8=0xc8;}else{_0x57d8f8=0xce;}_0x5a9c9e[_0xe611('0x29')](_0x57d8f8);return _0x5a9c9e[_0xe611('0x2f')](_0xe611('0x30'),_0x50bde2+'-'+_0x31dc6b+'/'+_0x4564d4)[_0xe611('0x31')](_0x510105);}return null;};}function patchUpdates(_0x25321){return function(_0x1a4fef){try{jsonpatch[_0xe611('0x32')](_0x1a4fef,_0x25321,!![]);}catch(_0xea820d){return BPromise[_0xe611('0x33')](_0xea820d);}return _0x1a4fef['save']();};}function saveUpdates(_0x1e5e5e,_0x3f772f){return function(_0x44b4cd){if(_0x44b4cd){return _0x44b4cd[_0xe611('0x34')](_0x1e5e5e)[_0xe611('0x35')](function(_0xbd34e5){return _0xbd34e5;});}return null;};}function removeEntity(_0x854270,_0x4ce238){return function(_0x4fad39){if(_0x4fad39){return _0x4fad39[_0xe611('0x36')]()[_0xe611('0x35')](function(){var _0x128995=_0x4fad39[_0xe611('0x37')]({'plain':!![]});var _0x149f88='WhatsappAccounts';return db[_0xe611('0x38')]['destroy']({'where':{'type':_0x149f88,'resourceId':_0x128995['id']}})['then'](function(){return _0x4fad39;});})['then'](function(){_0x854270[_0xe611('0x29')](0xcc)[_0xe611('0x2a')]();});}};}function handleEntityNotFound(_0x36ce31,_0x26f08a){return function(_0x167820){if(!_0x167820){_0x36ce31['sendStatus'](0x194);}return _0x167820;};}function handleError(_0x2b16cf,_0x1ac3cb){_0x1ac3cb=_0x1ac3cb||0x1f4;return function(_0x4bdc90){logger[_0xe611('0x22')](_0x4bdc90[_0xe611('0x39')]);if(_0x4bdc90['name']){delete _0x4bdc90['name'];}_0x2b16cf[_0xe611('0x29')](_0x1ac3cb)[_0xe611('0x3a')](_0x4bdc90);};}exports['index']=function(_0x3de181,_0x3df141){var _0x170253={'include':[{'model':db[_0xe611('0x3b')],'as':_0xe611('0x3c')}]},_0x1972bc={},_0x3c21d4={'count':0x0,'rows':[]};var _0x553c1e=_['map'](db[_0xe611('0x3d')][_0xe611('0x3e')],function(_0x583fd4){return{'name':_0x583fd4[_0xe611('0x3f')],'type':_0x583fd4['type']['key']};});_0x1972bc['model']=_['map'](_0x553c1e,'name');_0x1972bc[_0xe611('0x40')]=_[_0xe611('0x41')](_0x3de181['query']);_0x1972bc[_0xe611('0x42')]=_['intersection'](_0x1972bc[_0xe611('0x43')],_0x1972bc[_0xe611('0x40')]);_0x170253['attributes']=_[_0xe611('0x44')](_0x1972bc['model'],qs[_0xe611('0x45')](_0x3de181[_0xe611('0x40')][_0xe611('0x45')]));_0x170253[_0xe611('0x46')]=_0x170253[_0xe611('0x46')][_0xe611('0x47')]?_0x170253[_0xe611('0x46')]:_0x1972bc[_0xe611('0x43')];if(!_0x3de181[_0xe611('0x40')][_0xe611('0x48')](_0xe611('0x49'))){_0x170253[_0xe611('0x2c')]=qs[_0xe611('0x2c')](_0x3de181[_0xe611('0x40')][_0xe611('0x2c')]);_0x170253[_0xe611('0x2b')]=qs[_0xe611('0x2b')](_0x3de181[_0xe611('0x40')]['offset']);}_0x170253[_0xe611('0x4a')]=qs[_0xe611('0x4b')](_0x3de181[_0xe611('0x40')]['sort']);_0x170253[_0xe611('0x4c')]=qs['filters'](_[_0xe611('0x4d')](_0x3de181[_0xe611('0x40')],_0x1972bc[_0xe611('0x42')]),_0x553c1e);if(_0x3de181[_0xe611('0x40')][_0xe611('0x4e')]){_0x170253['where']=_[_0xe611('0x4f')](_0x170253[_0xe611('0x4c')],{'$or':_[_0xe611('0x50')](_0x553c1e,function(_0x1421d1){if(_0x1421d1[_0xe611('0x51')]!==_0xe611('0x52')){var _0x19047d={};_0x19047d[_0x1421d1['name']]={'$like':'%'+_0x3de181['query'][_0xe611('0x4e')]+'%'};return _0x19047d;}})});}_0x170253=_['merge']({},_0x170253,_0x3de181['options']);var _0x28e707={'where':_0x170253[_0xe611('0x4c')]};return db[_0xe611('0x3d')][_0xe611('0x2e')](_0x28e707)[_0xe611('0x35')](function(_0x27e1b2){_0x3c21d4[_0xe611('0x2e')]=_0x27e1b2;if(_0x3de181[_0xe611('0x40')][_0xe611('0x53')]){_0x170253[_0xe611('0x54')]=[{'all':!![]}];}return db[_0xe611('0x3d')][_0xe611('0x55')](_0x170253);})[_0xe611('0x35')](function(_0x3bf104){_0x3c21d4[_0xe611('0x56')]=_0x3bf104;return _0x3c21d4;})[_0xe611('0x35')](respondWithFilteredResult(_0x3df141,_0x170253))[_0xe611('0x27')](handleError(_0x3df141,null));};exports[_0xe611('0x57')]=function(_0x50c470,_0x21cd6){var _0x416be2={'raw':![],'where':{'id':_0x50c470[_0xe611('0x58')]['id']},'include':[{'model':db[_0xe611('0x3b')],'as':'mandatoryDispositionPause'}]},_0x10029a={};_0x10029a[_0xe611('0x43')]=_[_0xe611('0x41')](db[_0xe611('0x3d')][_0xe611('0x3e')]);_0x10029a[_0xe611('0x40')]=_[_0xe611('0x41')](_0x50c470[_0xe611('0x40')]);_0x10029a[_0xe611('0x42')]=_[_0xe611('0x44')](_0x10029a[_0xe611('0x43')],_0x10029a[_0xe611('0x40')]);_0x416be2[_0xe611('0x46')]=_[_0xe611('0x44')](_0x10029a[_0xe611('0x43')],qs[_0xe611('0x45')](_0x50c470[_0xe611('0x40')][_0xe611('0x45')]));_0x416be2[_0xe611('0x46')]=_0x416be2['attributes'][_0xe611('0x47')]?_0x416be2[_0xe611('0x46')]:_0x10029a[_0xe611('0x43')];if(_0x50c470[_0xe611('0x40')][_0xe611('0x53')]){_0x416be2['include']=[{'all':!![]}];}_0x416be2=_[_0xe611('0x4f')]({},_0x416be2,_0x50c470[_0xe611('0x59')]);return db[_0xe611('0x3d')][_0xe611('0x5a')](_0x416be2)[_0xe611('0x35')](handleEntityNotFound(_0x21cd6,null))[_0xe611('0x35')](respondWithResult(_0x21cd6,null))[_0xe611('0x27')](handleError(_0x21cd6,null));};exports[_0xe611('0x5b')]=function(_0x474d1a,_0x58948e){return db[_0xe611('0x3d')][_0xe611('0x5b')](_0x474d1a['body'],{})[_0xe611('0x35')](function(_0x17c806){var _0x4740d3=_0x474d1a[_0xe611('0x5c')]['get']({'plain':!![]});if(!_0x4740d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4740d3['role']===_0xe611('0x5c')){var _0x507af1=_0x17c806['get']({'plain':!![]});var _0x15816b=_0xe611('0x5d');return db[_0xe611('0x5e')][_0xe611('0x5a')]({'where':{'name':_0x15816b,'userProfileId':_0x4740d3[_0xe611('0x5f')]},'raw':!![]})[_0xe611('0x35')](function(_0x44b5db){if(_0x44b5db&&_0x44b5db[_0xe611('0x60')]===0x0){return db['UserProfileResource'][_0xe611('0x5b')]({'name':_0x507af1[_0xe611('0x61')],'resourceId':_0x507af1['id'],'type':_0x44b5db[_0xe611('0x61')],'sectionId':_0x44b5db['id']},{})[_0xe611('0x35')](function(){return _0x17c806;});}else{return _0x17c806;}})['catch'](function(_0x4d1b19){logger[_0xe611('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d1b19);throw _0x4d1b19;});}return _0x17c806;})['then'](respondWithResult(_0x58948e,0xc9))[_0xe611('0x27')](handleError(_0x58948e,null));};exports[_0xe611('0x34')]=function(_0x50fd36,_0x37a2a7){if(_0x50fd36['body']['id']){delete _0x50fd36[_0xe611('0x62')]['id'];}return db[_0xe611('0x3d')]['find']({'where':{'id':_0x50fd36[_0xe611('0x58')]['id']},'include':[{'model':db[_0xe611('0x3b')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x37a2a7,null))[_0xe611('0x35')](saveUpdates(_0x50fd36[_0xe611('0x62')],null))[_0xe611('0x35')](respondWithResult(_0x37a2a7,null))[_0xe611('0x27')](handleError(_0x37a2a7,null));};exports[_0xe611('0x36')]=function(_0x4d09ba,_0xa1407c){return db[_0xe611('0x3d')][_0xe611('0x5a')]({'where':{'id':_0x4d09ba[_0xe611('0x58')]['id']}})['then'](handleEntityNotFound(_0xa1407c,null))[_0xe611('0x35')](removeEntity(_0xa1407c,null))['catch'](handleError(_0xa1407c,null));};exports['describe']=function(_0xb4eaaa,_0x13c568){return db['WhatsappAccount'][_0xe611('0x63')]()['then'](respondWithResult(_0x13c568,null))[_0xe611('0x27')](handleError(_0x13c568,null));};exports[_0xe611('0x64')]=function(_0x1fd5ca,_0x4cba71,_0x895399){if(_0x1fd5ca[_0xe611('0x62')]['id']){delete _0x1fd5ca[_0xe611('0x62')]['id'];}return db['WhatsappAccount'][_0xe611('0x5a')]({'where':{'id':_0x1fd5ca[_0xe611('0x58')]['id']}})[_0xe611('0x35')](handleEntityNotFound(_0x4cba71,null))['then'](function(_0x4bdb85){if(_0x4bdb85){_0x1fd5ca[_0xe611('0x62')][_0xe611('0x65')]=_0x4bdb85['id'];return db[_0xe611('0x66')][_0xe611('0x5b')](_0x1fd5ca[_0xe611('0x62')]);}})[_0xe611('0x35')](respondWithResult(_0x4cba71,null))[_0xe611('0x27')](handleError(_0x4cba71,null));};exports['getDispositions']=function(_0x59c818,_0xf52f99,_0x5a1c08){var _0x59a3ca={'raw':![],'where':{}};var _0x19caa2={};var _0x1b264f={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x59c818[_0xe611('0x58')]['id']}})['then'](handleEntityNotFound(_0xf52f99,null))[_0xe611('0x35')](function(_0x4a1ee7){if(_0x4a1ee7){_0x19caa2['model']=_[_0xe611('0x41')](db[_0xe611('0x66')][_0xe611('0x3e')]);_0x19caa2[_0xe611('0x40')]=_[_0xe611('0x41')](_0x59c818[_0xe611('0x40')]);_0x19caa2[_0xe611('0x42')]=_[_0xe611('0x44')](_0x19caa2[_0xe611('0x43')],_0x19caa2[_0xe611('0x40')]);_0x59a3ca['attributes']=_['intersection'](_0x19caa2[_0xe611('0x43')],qs['fields'](_0x59c818[_0xe611('0x40')]['fields']));_0x59a3ca[_0xe611('0x46')]=_0x59a3ca[_0xe611('0x46')]['length']?_0x59a3ca['attributes']:_0x19caa2[_0xe611('0x43')];if(!_0x59c818[_0xe611('0x40')]['hasOwnProperty'](_0xe611('0x49'))){_0x59a3ca[_0xe611('0x2c')]=qs[_0xe611('0x2c')](_0x59c818[_0xe611('0x40')][_0xe611('0x2c')]);_0x59a3ca[_0xe611('0x2b')]=qs[_0xe611('0x2b')](_0x59c818[_0xe611('0x40')][_0xe611('0x2b')]);}_0x59a3ca[_0xe611('0x4a')]=qs['sort'](_0x59c818[_0xe611('0x40')][_0xe611('0x4b')]);_0x59a3ca[_0xe611('0x4c')]=qs[_0xe611('0x42')](_[_0xe611('0x4d')](_0x59c818[_0xe611('0x40')],_0x19caa2[_0xe611('0x42')]));_0x59a3ca['where'][_0xe611('0x65')]=_0x4a1ee7['id'];if(_0x59c818['query']['filter']){_0x59a3ca[_0xe611('0x4c')]=_[_0xe611('0x4f')](_0x59a3ca[_0xe611('0x4c')],{'$or':_['map'](_0x59a3ca[_0xe611('0x46')],function(_0x54b5eb){var _0xae0093={};_0xae0093[_0x54b5eb]={'$like':'%'+_0x59c818[_0xe611('0x40')][_0xe611('0x4e')]+'%'};return _0xae0093;})});}_0x59a3ca=_[_0xe611('0x4f')]({},_0x59a3ca,_0x59c818[_0xe611('0x59')]);return db[_0xe611('0x66')][_0xe611('0x2e')]({'where':_0x59a3ca[_0xe611('0x4c')]})[_0xe611('0x35')](function(_0x3baeb3){_0x1b264f[_0xe611('0x2e')]=_0x3baeb3;if(_0x59c818[_0xe611('0x40')][_0xe611('0x53')]){_0x59a3ca[_0xe611('0x54')]=[{'all':!![]}];}return db['Disposition'][_0xe611('0x55')](_0x59a3ca);})[_0xe611('0x35')](function(_0x30cdc3){_0x1b264f[_0xe611('0x56')]=_0x30cdc3;return _0x1b264f;});}})['then'](respondWithFilteredResult(_0xf52f99,_0x59a3ca))['catch'](handleError(_0xf52f99,null));};exports[_0xe611('0x67')]=function(_0x26a097,_0x3cd5ae,_0x3fa6f1){return db['WhatsappAccount'][_0xe611('0x5a')]({'where':{'id':_0x26a097[_0xe611('0x58')]['id']}})[_0xe611('0x35')](handleEntityNotFound(_0x3cd5ae,null))[_0xe611('0x35')](function(_0x120cbc){if(_0x120cbc){return _0x120cbc['removeDispositions'](_0x26a097[_0xe611('0x40')][_0xe611('0x68')]);}})[_0xe611('0x35')](respondWithStatusCode(_0x3cd5ae,null))[_0xe611('0x27')](handleError(_0x3cd5ae,null));};exports['addAnswer']=function(_0x2cfac4,_0x12874e,_0x1d1e53){if(_0x2cfac4['body']['id']){delete _0x2cfac4[_0xe611('0x62')]['id'];}return db[_0xe611('0x3d')][_0xe611('0x5a')]({'where':{'id':_0x2cfac4[_0xe611('0x58')]['id']}})[_0xe611('0x35')](handleEntityNotFound(_0x12874e,null))[_0xe611('0x35')](function(_0x54d5ca){if(_0x54d5ca){_0x2cfac4[_0xe611('0x62')][_0xe611('0x65')]=_0x54d5ca['id'];return db[_0xe611('0x69')][_0xe611('0x5b')](_0x2cfac4[_0xe611('0x62')]);}})[_0xe611('0x35')](respondWithResult(_0x12874e,null))['catch'](handleError(_0x12874e,null));};exports[_0xe611('0x6a')]=function(_0x204cbd,_0x32f2a4,_0x1a0965){var _0x118f46={'raw':![],'where':{}};var _0x1a980d={};var _0x21fd48={'count':0x0,'rows':[]};return db[_0xe611('0x3d')]['findOne']({'where':{'id':_0x204cbd[_0xe611('0x58')]['id']}})['then'](handleEntityNotFound(_0x32f2a4,null))[_0xe611('0x35')](function(_0x294821){if(_0x294821){_0x1a980d['model']=_['keys'](db[_0xe611('0x69')][_0xe611('0x3e')]);_0x1a980d[_0xe611('0x40')]=_[_0xe611('0x41')](_0x204cbd[_0xe611('0x40')]);_0x1a980d['filters']=_['intersection'](_0x1a980d[_0xe611('0x43')],_0x1a980d[_0xe611('0x40')]);_0x118f46[_0xe611('0x46')]=_[_0xe611('0x44')](_0x1a980d[_0xe611('0x43')],qs[_0xe611('0x45')](_0x204cbd[_0xe611('0x40')][_0xe611('0x45')]));_0x118f46['attributes']=_0x118f46[_0xe611('0x46')][_0xe611('0x47')]?_0x118f46[_0xe611('0x46')]:_0x1a980d[_0xe611('0x43')];if(!_0x204cbd[_0xe611('0x40')]['hasOwnProperty']('nolimit')){_0x118f46[_0xe611('0x2c')]=qs[_0xe611('0x2c')](_0x204cbd[_0xe611('0x40')][_0xe611('0x2c')]);_0x118f46[_0xe611('0x2b')]=qs[_0xe611('0x2b')](_0x204cbd[_0xe611('0x40')]['offset']);}_0x118f46[_0xe611('0x4a')]=qs['sort'](_0x204cbd[_0xe611('0x40')][_0xe611('0x4b')]);_0x118f46[_0xe611('0x4c')]=qs['filters'](_[_0xe611('0x4d')](_0x204cbd[_0xe611('0x40')],_0x1a980d[_0xe611('0x42')]));_0x118f46[_0xe611('0x4c')][_0xe611('0x65')]=_0x294821['id'];if(_0x204cbd['query'][_0xe611('0x4e')]){_0x118f46[_0xe611('0x4c')]=_['merge'](_0x118f46[_0xe611('0x4c')],{'$or':_['map'](_0x118f46[_0xe611('0x46')],function(_0x13f879){var _0x1ed2e5={};_0x1ed2e5[_0x13f879]={'$like':'%'+_0x204cbd[_0xe611('0x40')]['filter']+'%'};return _0x1ed2e5;})});}_0x118f46=_['merge']({},_0x118f46,_0x204cbd[_0xe611('0x59')]);return db[_0xe611('0x69')][_0xe611('0x2e')]({'where':_0x118f46[_0xe611('0x4c')]})[_0xe611('0x35')](function(_0x246d01){_0x21fd48[_0xe611('0x2e')]=_0x246d01;if(_0x204cbd[_0xe611('0x40')][_0xe611('0x53')]){_0x118f46[_0xe611('0x54')]=[{'all':!![]}];}return db[_0xe611('0x69')][_0xe611('0x55')](_0x118f46);})[_0xe611('0x35')](function(_0x42aa85){_0x21fd48[_0xe611('0x56')]=_0x42aa85;return _0x21fd48;});}})[_0xe611('0x35')](respondWithFilteredResult(_0x32f2a4,_0x118f46))['catch'](handleError(_0x32f2a4,null));};exports[_0xe611('0x6b')]=function(_0x3255a4,_0x116af8,_0x5a74e7){return db[_0xe611('0x3d')]['find']({'where':{'id':_0x3255a4['params']['id']}})[_0xe611('0x35')](handleEntityNotFound(_0x116af8,null))[_0xe611('0x35')](function(_0x247019){if(_0x247019){return _0x247019[_0xe611('0x6b')](_0x3255a4[_0xe611('0x40')][_0xe611('0x68')]);}})[_0xe611('0x35')](respondWithStatusCode(_0x116af8,null))[_0xe611('0x27')](handleError(_0x116af8,null));};exports[_0xe611('0x6c')]=function(_0x49e695,_0x18ff00,_0x4f7854){return db[_0xe611('0x3d')][_0xe611('0x5a')]({'where':{'id':_0x49e695[_0xe611('0x58')]['id']}})[_0xe611('0x35')](handleEntityNotFound(_0x18ff00,null))[_0xe611('0x35')](function(_0x1036f3){if(_0x1036f3){return _0x1036f3[_0xe611('0x6c')](_0x49e695[_0xe611('0x62')][_0xe611('0x68')],_[_0xe611('0x6d')](_0x49e695[_0xe611('0x62')],[_0xe611('0x68'),'id'])||{})[_0xe611('0x6e')](function(_0x5463e9){for(var _0x364376=0x0;_0x364376<_0x49e695[_0xe611('0x62')][_0xe611('0x68')][_0xe611('0x47')];_0x364376+=0x1){socket[_0xe611('0x6f')]('userWhatsappAccount:save',{'UserId':Number(_0x49e695['body'][_0xe611('0x68')][_0x364376]),'WhatsappAccountId':Number(_0x49e695[_0xe611('0x58')]['id'])});}return _0x5463e9;});}})[_0xe611('0x35')](respondWithResult(_0x18ff00,null))[_0xe611('0x27')](handleError(_0x18ff00,null));};exports[_0xe611('0x70')]=function(_0x173699,_0x26e22b,_0x2933f3){return db[_0xe611('0x3d')][_0xe611('0x5a')]({'where':{'id':_0x173699[_0xe611('0x58')]['id']}})['then'](handleEntityNotFound(_0x26e22b,null))[_0xe611('0x35')](function(_0x5a4b4d){if(_0x5a4b4d){return _0x5a4b4d['removeAgents'](_0x173699[_0xe611('0x40')]['ids'])[_0xe611('0x35')](function(){if(_['isArray'](_0x173699[_0xe611('0x40')][_0xe611('0x68')])){for(var _0x4196b8=0x0;_0x4196b8<_0x173699[_0xe611('0x40')][_0xe611('0x68')][_0xe611('0x47')];_0x4196b8+=0x1){socket[_0xe611('0x6f')]('userWhatsappAccount:remove',{'UserId':Number(_0x173699[_0xe611('0x40')][_0xe611('0x68')][_0x4196b8]),'WhatsappAccountId':Number(_0x173699[_0xe611('0x58')]['id'])});}}else{socket[_0xe611('0x6f')](_0xe611('0x71'),{'UserId':Number(_0x173699['query'][_0xe611('0x68')]),'WhatsappAccountId':Number(_0x173699[_0xe611('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x26e22b,null))['catch'](handleError(_0x26e22b,null));};exports[_0xe611('0x72')]=function(_0x1004b9,_0x3132d4,_0x55cc52){var _0x2b38c2={};var _0x450835={};var _0x1e158b;var _0xa68bfa;return db['WhatsappAccount'][_0xe611('0x73')]({'where':{'id':_0x1004b9[_0xe611('0x58')]['id']}})[_0xe611('0x35')](handleEntityNotFound(_0x3132d4,null))['then'](function(_0x62346){if(_0x62346){_0x1e158b=_0x62346;_0x450835['model']=_[_0xe611('0x41')](db[_0xe611('0x74')][_0xe611('0x3e')]);_0x450835[_0xe611('0x40')]=_[_0xe611('0x41')](_0x1004b9[_0xe611('0x40')]);_0x450835[_0xe611('0x42')]=_[_0xe611('0x44')](_0x450835[_0xe611('0x43')],_0x450835['query']);_0x2b38c2[_0xe611('0x46')]=_['intersection'](_0x450835[_0xe611('0x43')],qs['fields'](_0x1004b9[_0xe611('0x40')][_0xe611('0x45')]));_0x2b38c2[_0xe611('0x46')]=_0x2b38c2[_0xe611('0x46')][_0xe611('0x47')]?_0x2b38c2[_0xe611('0x46')]:_0x450835[_0xe611('0x43')];_0x2b38c2[_0xe611('0x4a')]=qs[_0xe611('0x4b')](_0x1004b9[_0xe611('0x40')]['sort']);_0x2b38c2[_0xe611('0x4c')]=qs[_0xe611('0x42')](_[_0xe611('0x4d')](_0x1004b9['query'],_0x450835['filters']));if(_0x1004b9[_0xe611('0x40')][_0xe611('0x4e')]){_0x2b38c2['where']=_[_0xe611('0x4f')](_0x2b38c2[_0xe611('0x4c')],{'$or':_[_0xe611('0x50')](_0x2b38c2[_0xe611('0x46')],function(_0x3d12c7){var _0x304543={};_0x304543[_0x3d12c7]={'$like':'%'+_0x1004b9[_0xe611('0x40')][_0xe611('0x4e')]+'%'};return _0x304543;})});}_0x2b38c2=_[_0xe611('0x4f')]({},_0x2b38c2,_0x1004b9[_0xe611('0x59')]);return _0x1e158b['getAgents'](_0x2b38c2);}})[_0xe611('0x35')](function(_0x41702a){if(_0x41702a){_0xa68bfa=_0x41702a[_0xe611('0x47')];if(!_0x1004b9[_0xe611('0x40')]['hasOwnProperty']('nolimit')){_0x2b38c2[_0xe611('0x2c')]=qs[_0xe611('0x2c')](_0x1004b9[_0xe611('0x40')][_0xe611('0x2c')]);_0x2b38c2['offset']=qs[_0xe611('0x2b')](_0x1004b9[_0xe611('0x40')][_0xe611('0x2b')]);}return _0x1e158b[_0xe611('0x72')](_0x2b38c2);}})[_0xe611('0x35')](function(_0x1d783d){if(_0x1d783d){return _0x1d783d?{'count':_0xa68bfa,'rows':_0x1d783d}:null;}})[_0xe611('0x35')](respondWithResult(_0x3132d4,null))[_0xe611('0x27')](handleError(_0x3132d4,null));};exports['addApplications']=function(_0x209349,_0x3a831b){var _0xf9f323=_0x209349[_0xe611('0x58')]['id'];var _0x15045b=_0x209349['body'];var _0x172bab=0xc8;var _0x2f4431=null;return db[_0xe611('0x75')]['transaction']({'isolationLevel':db[_0xe611('0x75')]['Transaction'][_0xe611('0x76')][_0xe611('0x77')]},function(_0x43bf04){return db[_0xe611('0x3d')][_0xe611('0x73')]({'where':{'id':_0xf9f323},'transaction':_0x43bf04})[_0xe611('0x35')](function(_0x3e60fe){if(_0x3e60fe){return db[_0xe611('0x78')][_0xe611('0x36')]({'where':{'WhatsappAccountId':_0xf9f323},'transaction':_0x43bf04})[_0xe611('0x35')](function(){var _0x2b2922=_[_0xe611('0x50')](_0x15045b,function(_0x2becf0){_0x2becf0[_0xe611('0x65')]=_0xf9f323;return _0x2becf0;});return db[_0xe611('0x78')][_0xe611('0x79')](_0x2b2922,{'transaction':_0x43bf04});});}else{_0x172bab=0x194;_0x2f4431=[];}});})['then'](function(){if(_0x172bab!==0x194){return db[_0xe611('0x78')][_0xe611('0x7a')]({'where':{'WhatsappAccountId':_0xf9f323},'order':_0xe611('0x7b')})[_0xe611('0x35')](function(_0x1d1bc5){_0x2f4431=_0x1d1bc5;});}})['catch'](function(_0x34e3d9){_0x172bab=0x1f4;logger['error'](_0x34e3d9[_0xe611('0x39')]);if(_0x34e3d9[_0xe611('0x61')]){delete _0x34e3d9[_0xe611('0x61')];}_0x2f4431=_0x34e3d9;})[_0xe611('0x7c')](function(){if(_0x2f4431===null){_0x3a831b[_0xe611('0x28')](_0x172bab);}else{if(_0x172bab===0x1f4){_0x3a831b['status'](_0x172bab)[_0xe611('0x3a')](_0x2f4431);}else{_0x3a831b[_0xe611('0x29')](_0x172bab)[_0xe611('0x31')](_0x2f4431);}}});};exports[_0xe611('0x7d')]=function(_0x244fae,_0x16abe0,_0x334197){var _0x3df54c={};var _0x6f656d={};var _0x5eed29;var _0x3d24ed;return db[_0xe611('0x3d')][_0xe611('0x73')]({'where':{'id':_0x244fae[_0xe611('0x58')]['id']}})['then'](handleEntityNotFound(_0x16abe0,null))['then'](function(_0x142af5){if(_0x142af5){_0x5eed29=_0x142af5;_0x6f656d[_0xe611('0x43')]=_[_0xe611('0x41')](db['WhatsappApplication']['rawAttributes']);_0x6f656d['query']=_[_0xe611('0x41')](_0x244fae[_0xe611('0x40')]);_0x6f656d[_0xe611('0x42')]=_[_0xe611('0x44')](_0x6f656d['model'],_0x6f656d['query']);_0x3df54c[_0xe611('0x46')]=_[_0xe611('0x44')](_0x6f656d['model'],qs['fields'](_0x244fae[_0xe611('0x40')][_0xe611('0x45')]));_0x3df54c[_0xe611('0x46')]=_0x3df54c[_0xe611('0x46')][_0xe611('0x47')]?_0x3df54c['attributes']:_0x6f656d['model'];_0x3df54c[_0xe611('0x4a')]=qs[_0xe611('0x4b')](_0x244fae[_0xe611('0x40')][_0xe611('0x4b')]);_0x3df54c['where']=qs[_0xe611('0x42')](_['pick'](_0x244fae['query'],_0x6f656d['filters']));if(_0x244fae[_0xe611('0x40')]['filter']){_0x3df54c['where']=_[_0xe611('0x4f')](_0x3df54c[_0xe611('0x4c')],{'$or':_[_0xe611('0x50')](_0x3df54c['attributes'],function(_0xfa75b3){var _0x3fd0f6={};_0x3fd0f6[_0xfa75b3]={'$like':'%'+_0x244fae[_0xe611('0x40')][_0xe611('0x4e')]+'%'};return _0x3fd0f6;})});}_0x3df54c=_[_0xe611('0x4f')]({},_0x3df54c,_0x244fae[_0xe611('0x59')]);return _0x5eed29[_0xe611('0x7d')](_0x3df54c);}})[_0xe611('0x35')](function(_0x351e2b){if(_0x351e2b){_0x3d24ed=_0x351e2b[_0xe611('0x47')];if(!_0x244fae[_0xe611('0x40')][_0xe611('0x48')](_0xe611('0x49'))){_0x3df54c['limit']=qs[_0xe611('0x2c')](_0x244fae[_0xe611('0x40')]['limit']);_0x3df54c['offset']=qs[_0xe611('0x2b')](_0x244fae[_0xe611('0x40')][_0xe611('0x2b')]);}return _0x5eed29[_0xe611('0x7d')](_0x3df54c);}})['then'](function(_0x32d44e){if(_0x32d44e){return _0x32d44e?{'count':_0x3d24ed,'rows':_0x32d44e}:null;}})[_0xe611('0x35')](respondWithResult(_0x16abe0,null))[_0xe611('0x27')](handleError(_0x16abe0,null));};exports[_0xe611('0x7e')]=function(_0x2bbe21,_0x4e77d2,_0x1fb322){var _0x296c7c={'channel':_0xe611('0x7f')};var _0xa27c85=[];var _0x1441c1=[];var _0x471ac8={};return db[_0xe611('0x3d')][_0xe611('0x5a')]({'where':{'id':_0x2bbe21[_0xe611('0x58')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xe611('0x80')}]})['then'](handleEntityNotFound(_0x4e77d2,null))['then'](function(_0x1c3b93){_0x296c7c[_0xe611('0x81')]=_0x1c3b93;if(_0x296c7c['account']&&_0x296c7c[_0xe611('0x81')][_0xe611('0x51')]==='sinch'&&_0x2bbe21[_0xe611('0x62')]['statuses']){if(_0x2bbe21['body'][_0xe611('0x82')]['length']===0x0)return;if(_0x2bbe21['body']['statuses'][0x0]['state']!==_0xe611('0x83'))return;return db[_0xe611('0x84')]['update']({'read':!![],'readAt':_0x2bbe21[_0xe611('0x62')][_0xe611('0x82')][0x0]['timestamp']},{'where':{'messageId':_0x2bbe21[_0xe611('0x62')]['statuses'][0x0][_0xe611('0x85')]},'individualHooks':!![]})[_0xe611('0x35')](function(_0x1af131){return _0x4e77d2[_0xe611('0x29')](0xc8)[_0xe611('0x31')](_0x1af131);});}_0x296c7c['applications']=_['orderBy'](_0x1c3b93[_0xe611('0x80')],['priority'],[_0xe611('0x86')]);if(_0x296c7c[_0xe611('0x81')][_0xe611('0x80')]){delete _0x296c7c['account'][_0xe611('0x80')];}return db[_0xe611('0x87')]['describe']()[_0xe611('0x35')](function(_0x2b23ce){if(!_0x2b23ce){throw new db[(_0xe611('0x88'))][(_0xe611('0x89'))](_0xe611('0x8a'));}_0xa27c85=_[_0xe611('0x8b')](_[_0xe611('0x41')](_0x2b23ce),[_0xe611('0x8c'),_0xe611('0x8d')]);_0x1441c1=_[_0xe611('0x8b')](_[_0xe611('0x41')](_0x2b23ce),[_0xe611('0x8c'),_0xe611('0x8d'),_0xe611('0x8e'),_0xe611('0x8f')]);_0x296c7c[_0xe611('0x62')]={'mapKey':_0xe611('0x90')};if(_0x296c7c[_0xe611('0x81')]&&_0x296c7c[_0xe611('0x81')][_0xe611('0x51')]===_0xe611('0x91')){_0x296c7c['body'][_0xe611('0x92')]=_0x2bbe21[_0xe611('0x62')][_0xe611('0x93')][_0xe611('0x94')](_0xe611('0x95'),'');_0x296c7c[_0xe611('0x62')]['body']=_0x2bbe21[_0xe611('0x62')][_0xe611('0x96')];_0x296c7c[_0xe611('0x62')]['messageId']=_0x2bbe21[_0xe611('0x62')][_0xe611('0x97')];}if(_0x296c7c[_0xe611('0x81')]&&_0x296c7c[_0xe611('0x81')]['type']===_0xe611('0x98')){_0x296c7c['body'][_0xe611('0x92')]=_0x2bbe21[_0xe611('0x62')][_0xe611('0x99')][0x0][_0xe611('0x92')];_0x296c7c[_0xe611('0x62')][_0xe611('0x62')]=_0x2bbe21[_0xe611('0x62')][_0xe611('0x99')][0x0]['message']['body'];_0x296c7c[_0xe611('0x62')][_0xe611('0x9a')]=_0x2bbe21[_0xe611('0x62')][_0xe611('0x99')][0x0][_0xe611('0x85')];}if(_0x296c7c[_0xe611('0x62')]['id']){delete _0x296c7c[_0xe611('0x62')]['id'];}if(_[_0xe611('0x9b')](_0x296c7c[_0xe611('0x62')][_0xe611('0x92')])){throw new db[(_0xe611('0x88'))]['ValidationError'](_0xe611('0x9c'));}if(_[_0xe611('0x9b')](_0x296c7c['body']['body'])||_0x296c7c[_0xe611('0x62')][_0xe611('0x62')]===''){throw new db[(_0xe611('0x88'))][(_0xe611('0x89'))](_0xe611('0x9d'));}if(_[_0xe611('0x9b')](_0x296c7c['body']['mapKey'])){throw new db[(_0xe611('0x88'))][(_0xe611('0x89'))](_0xe611('0x9e')+_0x1441c1);}if(!_[_0xe611('0x9f')](_0x1441c1,_0x296c7c[_0xe611('0x62')][_0xe611('0xa0')])){throw new db[(_0xe611('0x88'))][(_0xe611('0x89'))](_0xe611('0xa1')+_0x1441c1);}_0x471ac8[_0x296c7c[_0xe611('0x62')][_0xe611('0xa0')]]=_0x296c7c[_0xe611('0x62')]['from'];return db[_0xe611('0xa2')]['find']({'where':{'id':_0x296c7c[_0xe611('0x81')][_0xe611('0x8f')]},'include':[{'model':db[_0xe611('0x87')],'as':_0xe611('0xa3'),'where':_0x471ac8,'limit':0x1,'order':[[_0xe611('0x8d'),_0xe611('0xa4')]]}]});})['then'](handleEntityNotFound(_0x4e77d2,null))[_0xe611('0x35')](function(_0xcffd3a){if(_0xcffd3a){_0x296c7c[_0xe611('0xa5')]=_['omit'](_0xcffd3a,['Contacts']);if(_0xcffd3a[_0xe611('0xa3')]['length']){return _0xcffd3a['Contacts'][0x0];}var _0x4f79dd=_[_0xe611('0xa6')](_0x296c7c[_0xe611('0x62')],{'firstName':_0x296c7c['body'][_0xe611('0x92')],'ListId':_0xcffd3a['id']});_0x4f79dd[_0x296c7c['body'][_0xe611('0xa0')]]=_0x296c7c['body'][_0xe611('0x92')];return db[_0xe611('0x87')][_0xe611('0x5b')](_0x4f79dd,{'fields':_0xa27c85,'raw':!![]});}})[_0xe611('0x35')](handleEntityNotFound(_0x4e77d2,null))['then'](function(_0x49124e){if(_0x49124e){_0x296c7c[_0xe611('0xa7')]=_0x49124e;var _0x25fb6c={'ContactId':_0x49124e['id'],'phone':_0x296c7c[_0xe611('0x62')][_0xe611('0x92')],'WhatsappAccountId':_0x2bbe21[_0xe611('0x58')]['id']};var _0x3f7d56={'ContactId':_0x49124e['id'],'WhatsappAccountId':_0x2bbe21[_0xe611('0x58')]['id'],'closed':![]};return db[_0xe611('0xa8')][_0xe611('0x5a')]({'where':_0x3f7d56})[_0xe611('0x35')](function(_0x381601){if(_0x381601){return[_0x381601,![]];}return db[_0xe611('0xa8')][_0xe611('0x5b')](_0x25fb6c)[_0xe611('0x35')](function(_0x31ae66){return[_0x31ae66,!![]];});});}})[_0xe611('0x6e')](function(_0x43fec9,_0x226669){_0x296c7c['interaction']=_0x43fec9['get']({'plain':!![]});_0x296c7c['interaction']['created']=![];if(_0x226669){if(_0x296c7c[_0xe611('0x81')][_0xe611('0xa9')]){_0x296c7c[_0xe611('0xaa')][_0xe611('0xab')]({'id':0x0,'priority':_0x296c7c['applications'][_0xe611('0x47')]+0x1,'app':'close','appdata':_0xe611('0xac'),'interval':_0xe611('0xad')});}_0x296c7c[_0xe611('0xae')][_0xe611('0xaf')]=!![];}return db[_0xe611('0x84')][_0xe611('0x5b')]({'phone':_0x296c7c[_0xe611('0x62')]['from'],'messageId':_0x296c7c[_0xe611('0x62')]['messageId'],'body':_0x296c7c[_0xe611('0x62')][_0xe611('0x62')],'WhatsappAccountId':_0x2bbe21[_0xe611('0x58')]['id'],'WhatsappInteractionId':_0x43fec9['id'],'direction':'in','ContactId':_0x43fec9[_0xe611('0xb0')],'AttachmentId':_0x296c7c[_0xe611('0x62')][_0xe611('0xb1')]});})['then'](function(_0x454be7){_0x296c7c[_0xe611('0x24')]=_0x454be7;if(_0x296c7c[_0xe611('0xae')][_0xe611('0xb2')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x296c7c[_0xe611('0xae')]['UserId']}})[_0xe611('0x35')](function(_0x163fad){if(_0x163fad){_0x296c7c[_0xe611('0xaa')][_0xe611('0xb3')]({'id':0x0,'priority':0x0,'app':_0xe611('0xb4'),'appdata':_0x163fad['name']+','+(_0x296c7c[_0xe611('0x81')][_0xe611('0xb5')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xe611('0xb6'),_0xe611('0xb7'),_0x296c7c);});}return respondWithRpcPromise(_0xe611('0xb6'),_0xe611('0xb7'),_0x296c7c);})[_0xe611('0x35')](function(_0x3f5a7d){if(_0x3f5a7d){var _0x5a161b=0xc8;var _0x12767e=_0xe611('0xb8');logger[_0xe611('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x12767e,_0x5a161b,_0xe611('0xb9'));logger[_0xe611('0x1f')](_0xe611('0xba'),_0x12767e,_0x5a161b,_0xe611('0xb9'),JSON[_0xe611('0x21')](_0x3f5a7d));if(_0x296c7c[_0xe611('0x81')][_0xe611('0x51')]===_0xe611('0x91')){return _0x4e77d2[_0xe611('0x29')](_0x5a161b)[_0xe611('0x2f')](_0xe611('0xbb'),'text/xml')[_0xe611('0x3a')](_0xe611('0xbc'));}else{return _0x4e77d2['status'](_0x5a161b)[_0xe611('0x31')](_0x3f5a7d);}}});})[_0xe611('0x27')](handleError(_0x4e77d2,null));};exports[_0xe611('0x3a')]=function(_0xa619f3,_0x1edcc5,_0x2c2bd3){var _0x1d9a74,_0x25fb2f,_0x88c144;if(_[_0xe611('0x9b')](_0xa619f3[_0xe611('0x62')][_0xe611('0x62')])||_0xa619f3[_0xe611('0x62')][_0xe611('0x62')]===''){throw new db['Sequelize'][(_0xe611('0x89'))](_0xe611('0x9d'));}if(_['isNil'](_0xa619f3[_0xe611('0x62')]['to'])){throw new db[(_0xe611('0x88'))]['ValidationError'](_0xe611('0xbd'));}_0x1d9a74=_0xa619f3[_0xe611('0x62')]['to'];return db['WhatsappAccount'][_0xe611('0x5a')]({'where':{'id':_0xa619f3[_0xe611('0x58')]['id']},'include':[{'model':db[_0xe611('0xa2')],'as':_0xe611('0xbe'),'include':[{'model':db[_0xe611('0x87')],'as':'Contacts','where':{'mobile':_0x1d9a74},'limit':0x1,'order':[[_0xe611('0x8d'),_0xe611('0xa4')]]}]}]})[_0xe611('0x35')](handleEntityNotFound(_0x1edcc5,null))[_0xe611('0x35')](function(_0x50de72){if(_0x50de72&&_0x50de72['List']){_0x25fb2f=_0x50de72['get']({'plain':!![]});if(_0x25fb2f['List']&&_0x25fb2f['List'][_0xe611('0xa3')][_0xe611('0x47')]){return _0x25fb2f[_0xe611('0xbe')][_0xe611('0xa3')][0x0];}return db[_0xe611('0x87')][_0xe611('0x5b')](_['defaults'](_0xa619f3[_0xe611('0x62')],{'firstName':_0x1d9a74,'mobile':_0x1d9a74,'phone':_0x1d9a74,'ListId':_0x25fb2f['ListId']}));}})['then'](handleEntityNotFound(_0x1edcc5,null))[_0xe611('0x35')](function(_0x560c31){if(_0x560c31){_0x88c144=_0x560c31;return db[_0xe611('0xa8')][_0xe611('0x5a')]({'where':{'ContactId':_0x88c144['id'],'closed':![],'WhatsappAccountId':_0x25fb2f['id']}})['then'](function(_0x165eb8){if(_0x165eb8){return[_0x165eb8,![]];}return db[_0xe611('0xa8')][_0xe611('0x5b')]({'UserId':_0xa619f3[_0xe611('0x5c')]['id'],'ContactId':_0x88c144['id'],'WhatsappAccountId':_0x25fb2f['id'],'phone':_0x1d9a74,'firstMsgDirection':'out','Messages':[_[_0xe611('0x4f')](_0xa619f3[_0xe611('0x62')],{'read':![],'body':_0xa619f3[_0xe611('0x62')][_0xe611('0x62')],'phone':_0x1d9a74,'WhatsappAccountId':_0x25fb2f['id'],'UserId':_0xa619f3['user']['id'],'ContactId':_0x88c144['id']})]},{'include':[{'model':db[_0xe611('0x84')],'as':_0xe611('0xbf')}]})[_0xe611('0x35')](function(_0x2f69d0){return[_0x2f69d0,!![]];});});}})[_0xe611('0x6e')](function(_0x2870f3,_0x53ef81){if(_0x53ef81){return _0x2870f3;}return db[_0xe611('0x84')][_0xe611('0x5b')](_[_0xe611('0x4f')](_0xa619f3[_0xe611('0x62')],{'read':![],'body':_0xa619f3[_0xe611('0x62')][_0xe611('0x62')],'phone':_0x1d9a74,'WhatsappAccountId':_0x25fb2f['id'],'WhatsappInteractionId':_0x2870f3['id'],'UserId':_0xa619f3['user']['id'],'ContactId':_0x88c144['id']}))[_0xe611('0x35')](function(_0x4cd163){_0x2870f3['dataValues'][_0xe611('0xbf')]=[];_0x2870f3[_0xe611('0xc0')][_0xe611('0xbf')][_0xe611('0xab')](_0x4cd163[_0xe611('0xc0')]);return _0x2870f3;});})[_0xe611('0x35')](respondWithResult(_0x1edcc5,null))[_0xe611('0x27')](handleError(_0x1edcc5,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 499f4ed..53eba10 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 _0x0910=['events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x0910,0x186));var _0x0091=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0910[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x0091('0x0'));var WhatsappAccount=require(_0x0091('0x1'))['db'][_0x0091('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x0091('0x3')](0x0);var events={'afterCreate':_0x0091('0x4'),'afterUpdate':_0x0091('0x5'),'afterDestroy':_0x0091('0x6')};function emitEvent(_0x5e47c8){return function(_0x539be0,_0x1ce02f,_0x2097eb){WhatsappAccountEvents[_0x0091('0x7')](_0x5e47c8+':'+_0x539be0['id'],_0x539be0);WhatsappAccountEvents[_0x0091('0x7')](_0x5e47c8,_0x539be0);_0x2097eb(null);};}for(var e in events){if(events[_0x0091('0x8')](e)){var event=events[e];WhatsappAccount[_0x0091('0x9')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x6490=['WhatsappAccount','setMaxListeners','save','remove','hook','exports','events','../../mysqldb'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x6490,0xf6));var _0x0649=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0x6490[_0xbec8e6];return _0x4aa6f2;};'use strict';var EventEmitter=require(_0x0649('0x0'));var WhatsappAccount=require(_0x0649('0x1'))['db'][_0x0649('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x0649('0x3')](0x0);var events={'afterCreate':_0x0649('0x4'),'afterUpdate':'update','afterDestroy':_0x0649('0x5')};function emitEvent(_0x275f90){return function(_0x8dd77d,_0x38833b,_0x2626dc){WhatsappAccountEvents['emit'](_0x275f90+':'+_0x8dd77d['id'],_0x8dd77d);WhatsappAccountEvents['emit'](_0x275f90,_0x8dd77d);_0x2626dc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x0649('0x6')](e,emitEvent(event));}}module[_0x0649('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index c94a358..e5b9ecd 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 _0xf5e3=['WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define'];(function(_0x4f58ce,_0x6cad20){var _0x4c7b91=function(_0x5464ea){while(--_0x5464ea){_0x4f58ce['push'](_0x4f58ce['shift']());}};_0x4c7b91(++_0x6cad20);}(_0xf5e3,0xb2));var _0x3f5e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xf5e3[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x3f5e('0x0'));var util=require('util');var logger=require(_0x3f5e('0x1'))(_0x3f5e('0x2'));var moment=require(_0x3f5e('0x3'));var BPromise=require(_0x3f5e('0x4'));var rp=require(_0x3f5e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3f5e('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0x3f5e('0x7')]=function(_0x461db3,_0x4b677d){return _0x461db3[_0x3f5e('0x8')](_0x3f5e('0x9'),attributes,{'tableName':_0x3f5e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33ae=['request-promise','path','../../config/environment','exports','define','whatsapp_accounts','lodash','util','../../config/logger','moment','bluebird'];(function(_0xf36a76,_0x3967b3){var _0x414aa5=function(_0x84dc89){while(--_0x84dc89){_0xf36a76['push'](_0xf36a76['shift']());}};_0x414aa5(++_0x3967b3);}(_0x33ae,0x103));var _0xe33a=function(_0x3ed091,_0x3491d4){_0x3ed091=_0x3ed091-0x0;var _0x49f07c=_0x33ae[_0x3ed091];return _0x49f07c;};'use strict';var _=require(_0xe33a('0x0'));var util=require(_0xe33a('0x1'));var logger=require(_0xe33a('0x2'))('api');var moment=require(_0xe33a('0x3'));var BPromise=require(_0xe33a('0x4'));var rp=require(_0xe33a('0x5'));var fs=require('fs');var path=require(_0xe33a('0x6'));var rimraf=require('rimraf');var config=require(_0xe33a('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0xe33a('0x8')]=function(_0x3be258,_0x8b15cf){return _0x3be258[_0xe33a('0x9')]('WhatsappAccount',attributes,{'tableName':_0xe33a('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 9f39b13..dfee25d 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 _0xd4ea=['WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','then','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1f3801,_0x20226a){var _0x28b32c=function(_0x38bc55){while(--_0x38bc55){_0x1f3801['push'](_0x1f3801['shift']());}};_0x28b32c(++_0x20226a);}(_0xd4ea,0xb4));var _0xad4e=function(_0x25217f,_0x3368bb){_0x25217f=_0x25217f-0x0;var _0x27bfbb=_0xd4ea[_0x25217f];return _0x27bfbb;};'use strict';var _=require(_0xad4e('0x0'));var util=require(_0xad4e('0x1'));var moment=require(_0xad4e('0x2'));var BPromise=require(_0xad4e('0x3'));var rs=require(_0xad4e('0x4'));var fs=require('fs');var Redis=require(_0xad4e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xad4e('0x6'));var logger=require(_0xad4e('0x7'))(_0xad4e('0x8'));var config=require(_0xad4e('0x9'));var jayson=require(_0xad4e('0xa'));var client=jayson[_0xad4e('0xb')][_0xad4e('0xc')]({'port':0x232a});config[_0xad4e('0xd')]=_[_0xad4e('0xe')](config[_0xad4e('0xd')],{'host':_0xad4e('0xf'),'port':0x18eb});var socket=require(_0xad4e('0x10'))(new Redis(config[_0xad4e('0xd')]));require('./whatsappAccount.socket')[_0xad4e('0x11')](socket);function respondWithRpcPromise(_0x38576f,_0x40d022,_0x4d0089){return new BPromise(function(_0x47989a,_0x1be0b1){return client['request'](_0x38576f,_0x4d0089)['then'](function(_0x219dd3){logger['info'](_0xad4e('0x12'),_0x40d022,_0xad4e('0x13'));logger['debug'](_0xad4e('0x14'),_0x40d022,_0xad4e('0x13'),JSON['stringify'](_0x219dd3));if(_0x219dd3[_0xad4e('0x15')]){if(_0x219dd3[_0xad4e('0x15')][_0xad4e('0x16')]===0x1f4){logger[_0xad4e('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x40d022,_0x219dd3[_0xad4e('0x15')][_0xad4e('0x17')]);return _0x1be0b1(_0x219dd3[_0xad4e('0x15')][_0xad4e('0x17')]);}logger['error'](_0xad4e('0x12'),_0x40d022,_0x219dd3[_0xad4e('0x15')][_0xad4e('0x17')]);return _0x47989a(_0x219dd3[_0xad4e('0x15')][_0xad4e('0x17')]);}else{logger[_0xad4e('0x18')](_0xad4e('0x12'),_0x40d022,_0xad4e('0x13'));_0x47989a(_0x219dd3[_0xad4e('0x19')][_0xad4e('0x17')]);}})[_0xad4e('0x1a')](function(_0x9bae50){logger[_0xad4e('0x15')](_0xad4e('0x12'),_0x40d022,_0x9bae50);_0x1be0b1(_0x9bae50);});});}exports[_0xad4e('0x1b')]=function(_0x28f53a){var _0x1aa015=this;return new Promise(function(_0x28ef41,_0xae4e22){return db[_0xad4e('0x1c')][_0xad4e('0x1d')]({'raw':_0x28f53a['options']?_0x28f53a[_0xad4e('0x1e')][_0xad4e('0x1f')]===undefined?!![]:![]:!![],'where':_0x28f53a[_0xad4e('0x1e')]?_0x28f53a[_0xad4e('0x1e')][_0xad4e('0x20')]||null:null,'attributes':_0x28f53a[_0xad4e('0x1e')]?_0x28f53a[_0xad4e('0x1e')][_0xad4e('0x21')]||null:null,'include':_0x28f53a[_0xad4e('0x1e')]?_0x28f53a[_0xad4e('0x1e')][_0xad4e('0x22')]?_[_0xad4e('0x23')](_0x28f53a[_0xad4e('0x1e')][_0xad4e('0x22')],function(_0xe548cb){return{'model':db[_0xe548cb[_0xad4e('0x24')]],'as':_0xe548cb['as'],'attributes':_0xe548cb[_0xad4e('0x21')],'include':_0xe548cb[_0xad4e('0x22')]?_[_0xad4e('0x23')](_0xe548cb[_0xad4e('0x22')],function(_0x8dc460){return{'model':db[_0x8dc460['model']],'as':_0x8dc460['as'],'attributes':_0x8dc460[_0xad4e('0x21')],'include':_0x8dc460[_0xad4e('0x22')]?_[_0xad4e('0x23')](_0x8dc460['include'],function(_0x669b56){return{'model':db[_0x669b56[_0xad4e('0x24')]],'as':_0x669b56['as'],'attributes':_0x669b56['attributes']};}):[]};}):[]};}):[]:[]})[_0xad4e('0x25')](function(_0x23e420){logger[_0xad4e('0x18')](_0xad4e('0x1b'),_0x28f53a);logger[_0xad4e('0x26')](_0xad4e('0x1b'),_0x28f53a,JSON[_0xad4e('0x27')](_0x23e420));_0x28ef41(_0x23e420);})['catch'](function(_0x325beb){logger[_0xad4e('0x15')](_0xad4e('0x1b'),_0x325beb[_0xad4e('0x17')],_0x28f53a);_0xae4e22(_0x1aa015[_0xad4e('0x15')](0x1f4,_0x325beb['message']));});});}; \ No newline at end of file +var _0x6c6f=['where','include','model','map','attributes','then','debug','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw'];(function(_0x1b225a,_0x12e8e0){var _0x75784a=function(_0x2b2a59){while(--_0x2b2a59){_0x1b225a['push'](_0x1b225a['shift']());}};_0x75784a(++_0x12e8e0);}(_0x6c6f,0x10b));var _0xf6c6=function(_0x1037b7,_0x20ef64){_0x1037b7=_0x1037b7-0x0;var _0x5bb655=_0x6c6f[_0x1037b7];return _0x5bb655;};'use strict';var _=require(_0xf6c6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf6c6('0x1'));var rs=require(_0xf6c6('0x2'));var fs=require('fs');var Redis=require(_0xf6c6('0x3'));var db=require(_0xf6c6('0x4'))['db'];var utils=require(_0xf6c6('0x5'));var logger=require('../../config/logger')(_0xf6c6('0x6'));var config=require(_0xf6c6('0x7'));var jayson=require(_0xf6c6('0x8'));var client=jayson[_0xf6c6('0x9')]['http']({'port':0x232a});config[_0xf6c6('0xa')]=_[_0xf6c6('0xb')](config[_0xf6c6('0xa')],{'host':_0xf6c6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf6c6('0xa')]));require(_0xf6c6('0xd'))[_0xf6c6('0xe')](socket);function respondWithRpcPromise(_0x19c5a9,_0x476d54,_0x20341d){return new BPromise(function(_0x5165d5,_0x443405){return client[_0xf6c6('0xf')](_0x19c5a9,_0x20341d)['then'](function(_0xc1008e){logger[_0xf6c6('0x10')](_0xf6c6('0x11'),_0x476d54,'request\x20sent');logger['debug'](_0xf6c6('0x12'),_0x476d54,'request\x20sent',JSON['stringify'](_0xc1008e));if(_0xc1008e[_0xf6c6('0x13')]){if(_0xc1008e[_0xf6c6('0x13')]['code']===0x1f4){logger[_0xf6c6('0x13')](_0xf6c6('0x11'),_0x476d54,_0xc1008e[_0xf6c6('0x13')][_0xf6c6('0x14')]);return _0x443405(_0xc1008e[_0xf6c6('0x13')][_0xf6c6('0x14')]);}logger[_0xf6c6('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x476d54,_0xc1008e[_0xf6c6('0x13')][_0xf6c6('0x14')]);return _0x5165d5(_0xc1008e[_0xf6c6('0x13')][_0xf6c6('0x14')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x476d54,_0xf6c6('0x15'));_0x5165d5(_0xc1008e[_0xf6c6('0x16')][_0xf6c6('0x14')]);}})[_0xf6c6('0x17')](function(_0x570b9d){logger[_0xf6c6('0x13')](_0xf6c6('0x11'),_0x476d54,_0x570b9d);_0x443405(_0x570b9d);});});}exports[_0xf6c6('0x18')]=function(_0x3674f4){var _0x3a1adb=this;return new Promise(function(_0x536b7a,_0x5e36a1){return db[_0xf6c6('0x19')][_0xf6c6('0x1a')]({'raw':_0x3674f4[_0xf6c6('0x1b')]?_0x3674f4[_0xf6c6('0x1b')][_0xf6c6('0x1c')]===undefined?!![]:![]:!![],'where':_0x3674f4[_0xf6c6('0x1b')]?_0x3674f4[_0xf6c6('0x1b')][_0xf6c6('0x1d')]||null:null,'attributes':_0x3674f4[_0xf6c6('0x1b')]?_0x3674f4[_0xf6c6('0x1b')]['attributes']||null:null,'include':_0x3674f4[_0xf6c6('0x1b')]?_0x3674f4[_0xf6c6('0x1b')][_0xf6c6('0x1e')]?_['map'](_0x3674f4[_0xf6c6('0x1b')][_0xf6c6('0x1e')],function(_0xa06a8d){return{'model':db[_0xa06a8d[_0xf6c6('0x1f')]],'as':_0xa06a8d['as'],'attributes':_0xa06a8d['attributes'],'include':_0xa06a8d[_0xf6c6('0x1e')]?_[_0xf6c6('0x20')](_0xa06a8d[_0xf6c6('0x1e')],function(_0x2d94a9){return{'model':db[_0x2d94a9[_0xf6c6('0x1f')]],'as':_0x2d94a9['as'],'attributes':_0x2d94a9['attributes'],'include':_0x2d94a9['include']?_[_0xf6c6('0x20')](_0x2d94a9[_0xf6c6('0x1e')],function(_0x36858f){return{'model':db[_0x36858f[_0xf6c6('0x1f')]],'as':_0x36858f['as'],'attributes':_0x36858f[_0xf6c6('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf6c6('0x22')](function(_0x458b29){logger['info']('ShowWhatsappAccount',_0x3674f4);logger[_0xf6c6('0x23')]('ShowWhatsappAccount',_0x3674f4,JSON[_0xf6c6('0x24')](_0x458b29));_0x536b7a(_0x458b29);})[_0xf6c6('0x17')](function(_0x5d62cf){logger[_0xf6c6('0x13')](_0xf6c6('0x18'),_0x5d62cf[_0xf6c6('0x14')],_0x3674f4);_0x5e36a1(_0x3a1adb[_0xf6c6('0x13')](0x1f4,_0x5d62cf[_0xf6c6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 93c232d..a3801ad 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 _0x475b=['./whatsappAccount.events','save','remove','emit','removeListener','register','length','whatsappAccount:'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x475b,0x1c8));var _0xb475=function(_0x5a31e2,_0x4a5ca2){_0x5a31e2=_0x5a31e2-0x0;var _0x15ef23=_0x475b[_0x5a31e2];return _0x15ef23;};'use strict';var WhatsappAccountEvents=require(_0xb475('0x0'));var events=[_0xb475('0x1'),_0xb475('0x2'),'update'];function createListener(_0x421d30,_0x328276){return function(_0x3923db){_0x328276[_0xb475('0x3')](_0x421d30,_0x3923db);};}function removeListener(_0x373e1c,_0x2f2829){return function(){WhatsappAccountEvents[_0xb475('0x4')](_0x373e1c,_0x2f2829);};}exports[_0xb475('0x5')]=function(_0x2a9609){for(var _0x1dc4ab=0x0,_0x255922=events[_0xb475('0x6')];_0x1dc4ab<_0x255922;_0x1dc4ab++){var _0x2b5b7f=events[_0x1dc4ab];var _0x71ffc6=createListener(_0xb475('0x7')+_0x2b5b7f,_0x2a9609);WhatsappAccountEvents['on'](_0x2b5b7f,_0x71ffc6);}}; \ No newline at end of file +var _0xa609=['register','whatsappAccount:','./whatsappAccount.events','remove','update','removeListener'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xa609,0x14c));var _0x9a60=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa609[_0x2c91e9];return _0x13f0ff;};'use strict';var WhatsappAccountEvents=require(_0x9a60('0x0'));var events=['save',_0x9a60('0x1'),_0x9a60('0x2')];function createListener(_0x264fdd,_0xdccd23){return function(_0x351c12){_0xdccd23['emit'](_0x264fdd,_0x351c12);};}function removeListener(_0x2b9b26,_0x97e959){return function(){WhatsappAccountEvents[_0x9a60('0x3')](_0x2b9b26,_0x97e959);};}exports[_0x9a60('0x4')]=function(_0x2fc536){for(var _0x3bb804=0x0,_0x40c82d=events['length'];_0x3bb804<_0x40c82d;_0x3bb804++){var _0x5e9904=events[_0x3bb804];var _0x4c307b=createListener(_0x9a60('0x5')+_0x5e9904,_0x2fc536);WhatsappAccountEvents['on'](_0x5e9904,_0x4c307b);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 2c7c975..1991970 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 _0x7372=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','index','get','/:id','isAuthenticated','create','put','update','delete','destroy','exports'];(function(_0x32cb17,_0x29f17b){var _0x2c0377=function(_0x3b9188){while(--_0x3b9188){_0x32cb17['push'](_0x32cb17['shift']());}};_0x2c0377(++_0x29f17b);}(_0x7372,0xee));var _0x2737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7372[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2737('0x0'));var timeout=require(_0x2737('0x1'));var express=require('express');var router=express[_0x2737('0x2')]();var fs_extra=require(_0x2737('0x3'));var auth=require(_0x2737('0x4'));var interaction=require(_0x2737('0x5'));var config=require('../../config/environment');var controller=require(_0x2737('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x2737('0x7')]);router[_0x2737('0x8')](_0x2737('0x9'),auth[_0x2737('0xa')](),controller['show']);router['post']('/',auth[_0x2737('0xa')](),controller[_0x2737('0xb')]);router[_0x2737('0xc')](_0x2737('0x9'),auth['isAuthenticated'](),controller[_0x2737('0xd')]);router[_0x2737('0xe')](_0x2737('0x9'),auth[_0x2737('0xa')](),controller[_0x2737('0xf')]);module[_0x2737('0x10')]=router; \ No newline at end of file +var _0x7b6f=['post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated'];(function(_0x5d4d47,_0x46da7d){var _0x241374=function(_0x13fb98){while(--_0x13fb98){_0x5d4d47['push'](_0x5d4d47['shift']());}};_0x241374(++_0x46da7d);}(_0x7b6f,0x182));var _0xf7b6=function(_0x125a11,_0x305254){_0x125a11=_0x125a11-0x0;var _0x422646=_0x7b6f[_0x125a11];return _0x422646;};'use strict';var multer=require(_0xf7b6('0x0'));var util=require(_0xf7b6('0x1'));var path=require(_0xf7b6('0x2'));var timeout=require(_0xf7b6('0x3'));var express=require(_0xf7b6('0x4'));var router=express[_0xf7b6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf7b6('0x6'));var interaction=require(_0xf7b6('0x7'));var config=require(_0xf7b6('0x8'));var controller=require('./whatsappApplication.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf7b6('0x9')]);router[_0xf7b6('0xa')](_0xf7b6('0xb'),auth[_0xf7b6('0xc')](),controller['show']);router[_0xf7b6('0xd')]('/',auth[_0xf7b6('0xc')](),controller[_0xf7b6('0xe')]);router[_0xf7b6('0xf')](_0xf7b6('0xb'),auth[_0xf7b6('0xc')](),controller['update']);router[_0xf7b6('0x10')](_0xf7b6('0xb'),auth[_0xf7b6('0xc')](),controller[_0xf7b6('0x11')]);module[_0xf7b6('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 7ca106a..f223a7c 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 _0x8a61=['noop','TEXT','STRING','*,*,*,*','exports'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x8a61,0x9a));var _0x18a6=function(_0x1f9afb,_0x4e6f1b){_0x1f9afb=_0x1f9afb-0x0;var _0x456466=_0x8a61[_0x1f9afb];return _0x456466;};'use strict';var Sequelize=require('sequelize');module[_0x18a6('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x18a6('0x1')},'appdata':{'type':Sequelize[_0x18a6('0x2')]()},'description':{'type':Sequelize[_0x18a6('0x3')]},'interval':{'type':Sequelize[_0x18a6('0x3')],'defaultValue':_0x18a6('0x4')}}; \ No newline at end of file +var _0x7c7e=['sequelize','exports','INTEGER','STRING','*,*,*,*'];(function(_0x2ac1ca,_0x1e47d4){var _0x596155=function(_0x374f16){while(--_0x374f16){_0x2ac1ca['push'](_0x2ac1ca['shift']());}};_0x596155(++_0x1e47d4);}(_0x7c7e,0x19a));var _0xe7c7=function(_0x52efc5,_0x5a1d26){_0x52efc5=_0x52efc5-0x0;var _0xc9e03b=_0x7c7e[_0x52efc5];return _0xc9e03b;};'use strict';var Sequelize=require(_0xe7c7('0x0'));module[_0xe7c7('0x1')]={'priority':{'type':Sequelize[_0xe7c7('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe7c7('0x3')]},'interval':{'type':Sequelize[_0xe7c7('0x3')],'defaultValue':_0xe7c7('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index b727b9f..d6eb9ca 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 _0x4f7a=['update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','keys','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','WhatsappApplication','findAll','rows','catch','show','params','intersection','find','create','body','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','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','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save'];(function(_0x1ab32e,_0x4fecb8){var _0x38fe19=function(_0x4698e8){while(--_0x4698e8){_0x1ab32e['push'](_0x1ab32e['shift']());}};_0x38fe19(++_0x4fecb8);}(_0x4f7a,0x105));var _0xa4f7=function(_0x41461f,_0x2c2dd3){_0x41461f=_0x41461f-0x0;var _0x550ee5=_0x4f7a[_0x41461f];return _0x550ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa4f7('0x0'));var jsonpatch=require(_0xa4f7('0x1'));var rp=require(_0xa4f7('0x2'));var moment=require('moment');var BPromise=require(_0xa4f7('0x3'));var Mustache=require('mustache');var util=require(_0xa4f7('0x4'));var path=require(_0xa4f7('0x5'));var sox=require(_0xa4f7('0x6'));var csv=require('to-csv');var ejs=require(_0xa4f7('0x7'));var fs=require('fs');var fs_extra=require(_0xa4f7('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa4f7('0x9'));var jsforce=require(_0xa4f7('0xa'));var deskjs=require(_0xa4f7('0xb'));var toCsv=require(_0xa4f7('0xc'));var querystring=require(_0xa4f7('0xd'));var Papa=require('papaparse');var Redis=require(_0xa4f7('0xe'));var authService=require(_0xa4f7('0xf'));var qs=require(_0xa4f7('0x10'));var as=require(_0xa4f7('0x11'));var hardwareService=require(_0xa4f7('0x12'));var logger=require(_0xa4f7('0x13'))(_0xa4f7('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa4f7('0x15'));var db=require(_0xa4f7('0x16'))['db'];function respondWithStatusCode(_0x4a8cf9,_0x14e435){_0x14e435=_0x14e435||0xcc;return function(_0x2dd3d2){if(_0x2dd3d2){return _0x4a8cf9[_0xa4f7('0x17')](_0x14e435);}return _0x4a8cf9['status'](_0x14e435)[_0xa4f7('0x18')]();};}function respondWithResult(_0x321bd7,_0x3666c8){_0x3666c8=_0x3666c8||0xc8;return function(_0x593304){if(_0x593304){return _0x321bd7[_0xa4f7('0x19')](_0x3666c8)[_0xa4f7('0x1a')](_0x593304);}};}function respondWithFilteredResult(_0x2a255f,_0x39d437){return function(_0x492500){if(_0x492500){var _0x3e9fc7=typeof _0x39d437[_0xa4f7('0x1b')]==='undefined'&&typeof _0x39d437['limit']===_0xa4f7('0x1c');var _0x4b4111=_0x492500[_0xa4f7('0x1d')];var _0x44e119=_0x3e9fc7?0x0:_0x39d437['offset'];var _0x1cba51=_0x3e9fc7?_0x492500['count']:_0x39d437[_0xa4f7('0x1b')]+_0x39d437[_0xa4f7('0x1e')];var _0x10b16a;if(_0x1cba51>=_0x4b4111){_0x1cba51=_0x4b4111;_0x10b16a=0xc8;}else{_0x10b16a=0xce;}_0x2a255f[_0xa4f7('0x19')](_0x10b16a);return _0x2a255f[_0xa4f7('0x1f')](_0xa4f7('0x20'),_0x44e119+'-'+_0x1cba51+'/'+_0x4b4111)['json'](_0x492500);}return null;};}function patchUpdates(_0x18bb7a){return function(_0x2ffd9a){try{jsonpatch[_0xa4f7('0x21')](_0x2ffd9a,_0x18bb7a,!![]);}catch(_0x33ef47){return BPromise['reject'](_0x33ef47);}return _0x2ffd9a[_0xa4f7('0x22')]();};}function saveUpdates(_0x392312,_0x3bee6b){return function(_0x1a027c){if(_0x1a027c){return _0x1a027c[_0xa4f7('0x23')](_0x392312)[_0xa4f7('0x24')](function(_0x2a59b4){return _0x2a59b4;});}return null;};}function removeEntity(_0xdbc437,_0x16a342){return function(_0x1201ee){if(_0x1201ee){return _0x1201ee[_0xa4f7('0x25')]()[_0xa4f7('0x24')](function(){_0xdbc437['status'](0xcc)[_0xa4f7('0x18')]();});}};}function handleEntityNotFound(_0x18b3c7,_0x19a20d){return function(_0x2b56fe){if(!_0x2b56fe){_0x18b3c7[_0xa4f7('0x17')](0x194);}return _0x2b56fe;};}function handleError(_0x5c6122,_0x5f1480){_0x5f1480=_0x5f1480||0x1f4;return function(_0x4afd1d){logger[_0xa4f7('0x26')](_0x4afd1d['stack']);if(_0x4afd1d[_0xa4f7('0x27')]){delete _0x4afd1d[_0xa4f7('0x27')];}_0x5c6122[_0xa4f7('0x19')](_0x5f1480)['send'](_0x4afd1d);};}exports[_0xa4f7('0x28')]=function(_0x5366dc,_0x858aa){var _0x513a41={},_0x36704e={},_0x1009d2={'count':0x0,'rows':[]};var _0x24c64b=_[_0xa4f7('0x29')](db['WhatsappApplication'][_0xa4f7('0x2a')],function(_0x16c8b0){return{'name':_0x16c8b0[_0xa4f7('0x2b')],'type':_0x16c8b0[_0xa4f7('0x2c')][_0xa4f7('0x2d')]};});_0x36704e['model']=_[_0xa4f7('0x29')](_0x24c64b,_0xa4f7('0x27'));_0x36704e['query']=_[_0xa4f7('0x2e')](_0x5366dc[_0xa4f7('0x2f')]);_0x36704e[_0xa4f7('0x30')]=_['intersection'](_0x36704e[_0xa4f7('0x31')],_0x36704e[_0xa4f7('0x2f')]);_0x513a41['attributes']=_['intersection'](_0x36704e[_0xa4f7('0x31')],qs[_0xa4f7('0x32')](_0x5366dc[_0xa4f7('0x2f')]['fields']));_0x513a41[_0xa4f7('0x33')]=_0x513a41[_0xa4f7('0x33')][_0xa4f7('0x34')]?_0x513a41[_0xa4f7('0x33')]:_0x36704e[_0xa4f7('0x31')];if(!_0x5366dc[_0xa4f7('0x2f')][_0xa4f7('0x35')](_0xa4f7('0x36'))){_0x513a41[_0xa4f7('0x1e')]=qs['limit'](_0x5366dc[_0xa4f7('0x2f')][_0xa4f7('0x1e')]);_0x513a41[_0xa4f7('0x1b')]=qs[_0xa4f7('0x1b')](_0x5366dc[_0xa4f7('0x2f')][_0xa4f7('0x1b')]);}_0x513a41[_0xa4f7('0x37')]=qs[_0xa4f7('0x38')](_0x5366dc['query'][_0xa4f7('0x38')]);_0x513a41[_0xa4f7('0x39')]=qs['filters'](_['pick'](_0x5366dc[_0xa4f7('0x2f')],_0x36704e[_0xa4f7('0x30')]),_0x24c64b);if(_0x5366dc[_0xa4f7('0x2f')]['filter']){_0x513a41[_0xa4f7('0x39')]=_[_0xa4f7('0x3a')](_0x513a41[_0xa4f7('0x39')],{'$or':_[_0xa4f7('0x29')](_0x24c64b,function(_0x495142){if(_0x495142[_0xa4f7('0x2c')]!==_0xa4f7('0x3b')){var _0x1a5bd3={};_0x1a5bd3[_0x495142[_0xa4f7('0x27')]]={'$like':'%'+_0x5366dc[_0xa4f7('0x2f')][_0xa4f7('0x3c')]+'%'};return _0x1a5bd3;}})});}_0x513a41=_[_0xa4f7('0x3a')]({},_0x513a41,_0x5366dc[_0xa4f7('0x3d')]);var _0x3601f2={'where':_0x513a41[_0xa4f7('0x39')]};return db['WhatsappApplication']['count'](_0x3601f2)['then'](function(_0x22dfdd){_0x1009d2['count']=_0x22dfdd;if(_0x5366dc[_0xa4f7('0x2f')][_0xa4f7('0x3e')]){_0x513a41[_0xa4f7('0x3f')]=[{'all':!![]}];}return db[_0xa4f7('0x40')][_0xa4f7('0x41')](_0x513a41);})['then'](function(_0x1698f2){_0x1009d2[_0xa4f7('0x42')]=_0x1698f2;return _0x1009d2;})[_0xa4f7('0x24')](respondWithFilteredResult(_0x858aa,_0x513a41))[_0xa4f7('0x43')](handleError(_0x858aa,null));};exports[_0xa4f7('0x44')]=function(_0xc26958,_0x41ca2b){var _0x3ccb19={'raw':!![],'where':{'id':_0xc26958[_0xa4f7('0x45')]['id']}},_0x34192f={};_0x34192f['model']=_[_0xa4f7('0x2e')](db['WhatsappApplication']['rawAttributes']);_0x34192f[_0xa4f7('0x2f')]=_[_0xa4f7('0x2e')](_0xc26958[_0xa4f7('0x2f')]);_0x34192f[_0xa4f7('0x30')]=_[_0xa4f7('0x46')](_0x34192f['model'],_0x34192f[_0xa4f7('0x2f')]);_0x3ccb19[_0xa4f7('0x33')]=_[_0xa4f7('0x46')](_0x34192f[_0xa4f7('0x31')],qs[_0xa4f7('0x32')](_0xc26958['query'][_0xa4f7('0x32')]));_0x3ccb19[_0xa4f7('0x33')]=_0x3ccb19['attributes'][_0xa4f7('0x34')]?_0x3ccb19[_0xa4f7('0x33')]:_0x34192f[_0xa4f7('0x31')];if(_0xc26958['query']['includeAll']){_0x3ccb19[_0xa4f7('0x3f')]=[{'all':!![]}];}_0x3ccb19=_[_0xa4f7('0x3a')]({},_0x3ccb19,_0xc26958[_0xa4f7('0x3d')]);return db['WhatsappApplication'][_0xa4f7('0x47')](_0x3ccb19)[_0xa4f7('0x24')](handleEntityNotFound(_0x41ca2b,null))[_0xa4f7('0x24')](respondWithResult(_0x41ca2b,null))[_0xa4f7('0x43')](handleError(_0x41ca2b,null));};exports[_0xa4f7('0x48')]=function(_0x4f4171,_0x4cf939){return db[_0xa4f7('0x40')][_0xa4f7('0x48')](_0x4f4171['body'],{})['then'](respondWithResult(_0x4cf939,0xc9))[_0xa4f7('0x43')](handleError(_0x4cf939,null));};exports[_0xa4f7('0x23')]=function(_0x44e8a1,_0x1a4afb){if(_0x44e8a1[_0xa4f7('0x49')]['id']){delete _0x44e8a1[_0xa4f7('0x49')]['id'];}return db[_0xa4f7('0x40')][_0xa4f7('0x47')]({'where':{'id':_0x44e8a1[_0xa4f7('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a4afb,null))['then'](saveUpdates(_0x44e8a1['body'],null))[_0xa4f7('0x24')](respondWithResult(_0x1a4afb,null))[_0xa4f7('0x43')](handleError(_0x1a4afb,null));};exports[_0xa4f7('0x25')]=function(_0xf793c3,_0x1ea455){return db[_0xa4f7('0x40')][_0xa4f7('0x47')]({'where':{'id':_0xf793c3[_0xa4f7('0x45')]['id']}})[_0xa4f7('0x24')](handleEntityNotFound(_0x1ea455,null))['then'](removeEntity(_0x1ea455,null))['catch'](handleError(_0x1ea455,null));}; \ No newline at end of file +var _0xffc0=['../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','WhatsappApplication','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','show','params','length','find','catch','create','body','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x56528a,_0x51ad4c){var _0x564f6b=function(_0x19262f){while(--_0x19262f){_0x56528a['push'](_0x56528a['shift']());}};_0x564f6b(++_0x51ad4c);}(_0xffc0,0x1a0));var _0x0ffc=function(_0x394b8f,_0x45594c){_0x394b8f=_0x394b8f-0x0;var _0x8d3528=_0xffc0[_0x394b8f];return _0x8d3528;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ffc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ffc('0x1'));var rp=require(_0x0ffc('0x2'));var moment=require(_0x0ffc('0x3'));var BPromise=require(_0x0ffc('0x4'));var Mustache=require(_0x0ffc('0x5'));var util=require(_0x0ffc('0x6'));var path=require(_0x0ffc('0x7'));var sox=require('sox');var csv=require(_0x0ffc('0x8'));var ejs=require(_0x0ffc('0x9'));var fs=require('fs');var fs_extra=require(_0x0ffc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0ffc('0xb'));var jsforce=require(_0x0ffc('0xc'));var deskjs=require(_0x0ffc('0xd'));var toCsv=require(_0x0ffc('0x8'));var querystring=require('querystring');var Papa=require(_0x0ffc('0xe'));var Redis=require(_0x0ffc('0xf'));var authService=require(_0x0ffc('0x10'));var qs=require(_0x0ffc('0x11'));var as=require(_0x0ffc('0x12'));var hardwareService=require(_0x0ffc('0x13'));var logger=require(_0x0ffc('0x14'))(_0x0ffc('0x15'));var utils=require('../../config/utils');var config=require(_0x0ffc('0x16'));var licenseUtil=require(_0x0ffc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19e514,_0xbf12d1){_0xbf12d1=_0xbf12d1||0xcc;return function(_0x9622fe){if(_0x9622fe){return _0x19e514['sendStatus'](_0xbf12d1);}return _0x19e514[_0x0ffc('0x18')](_0xbf12d1)[_0x0ffc('0x19')]();};}function respondWithResult(_0x47a80b,_0x2095df){_0x2095df=_0x2095df||0xc8;return function(_0x137908){if(_0x137908){return _0x47a80b[_0x0ffc('0x18')](_0x2095df)[_0x0ffc('0x1a')](_0x137908);}};}function respondWithFilteredResult(_0x20edfc,_0x5034bc){return function(_0x35af98){if(_0x35af98){var _0x565921=typeof _0x5034bc[_0x0ffc('0x1b')]===_0x0ffc('0x1c')&&typeof _0x5034bc['limit']===_0x0ffc('0x1c');var _0x577e89=_0x35af98['count'];var _0x5b0018=_0x565921?0x0:_0x5034bc['offset'];var _0x314dab=_0x565921?_0x35af98[_0x0ffc('0x1d')]:_0x5034bc[_0x0ffc('0x1b')]+_0x5034bc[_0x0ffc('0x1e')];var _0x294f34;if(_0x314dab>=_0x577e89){_0x314dab=_0x577e89;_0x294f34=0xc8;}else{_0x294f34=0xce;}_0x20edfc['status'](_0x294f34);return _0x20edfc['set'](_0x0ffc('0x1f'),_0x5b0018+'-'+_0x314dab+'/'+_0x577e89)['json'](_0x35af98);}return null;};}function patchUpdates(_0x49e690){return function(_0x60ac9d){try{jsonpatch[_0x0ffc('0x20')](_0x60ac9d,_0x49e690,!![]);}catch(_0x49faaa){return BPromise[_0x0ffc('0x21')](_0x49faaa);}return _0x60ac9d[_0x0ffc('0x22')]();};}function saveUpdates(_0x27ae43,_0x527fd4){return function(_0x4ffd80){if(_0x4ffd80){return _0x4ffd80[_0x0ffc('0x23')](_0x27ae43)[_0x0ffc('0x24')](function(_0x418150){return _0x418150;});}return null;};}function removeEntity(_0x948451,_0x46b4e6){return function(_0x4d4294){if(_0x4d4294){return _0x4d4294['destroy']()[_0x0ffc('0x24')](function(){_0x948451['status'](0xcc)[_0x0ffc('0x19')]();});}};}function handleEntityNotFound(_0x5ad1b4,_0x25e3c0){return function(_0x136b0a){if(!_0x136b0a){_0x5ad1b4[_0x0ffc('0x25')](0x194);}return _0x136b0a;};}function handleError(_0x1265f5,_0x3968cc){_0x3968cc=_0x3968cc||0x1f4;return function(_0x34bce1){logger[_0x0ffc('0x26')](_0x34bce1[_0x0ffc('0x27')]);if(_0x34bce1['name']){delete _0x34bce1[_0x0ffc('0x28')];}_0x1265f5[_0x0ffc('0x18')](_0x3968cc)['send'](_0x34bce1);};}exports['index']=function(_0x40166f,_0x5f3a01){var _0x13c425={},_0x5d3cff={},_0x4ece4f={'count':0x0,'rows':[]};var _0x22eafd=_['map'](db[_0x0ffc('0x29')][_0x0ffc('0x2a')],function(_0x28c608){return{'name':_0x28c608['fieldName'],'type':_0x28c608[_0x0ffc('0x2b')][_0x0ffc('0x2c')]};});_0x5d3cff[_0x0ffc('0x2d')]=_[_0x0ffc('0x2e')](_0x22eafd,'name');_0x5d3cff[_0x0ffc('0x2f')]=_[_0x0ffc('0x30')](_0x40166f[_0x0ffc('0x2f')]);_0x5d3cff['filters']=_[_0x0ffc('0x31')](_0x5d3cff['model'],_0x5d3cff[_0x0ffc('0x2f')]);_0x13c425['attributes']=_[_0x0ffc('0x31')](_0x5d3cff[_0x0ffc('0x2d')],qs['fields'](_0x40166f[_0x0ffc('0x2f')][_0x0ffc('0x32')]));_0x13c425[_0x0ffc('0x33')]=_0x13c425[_0x0ffc('0x33')]['length']?_0x13c425[_0x0ffc('0x33')]:_0x5d3cff[_0x0ffc('0x2d')];if(!_0x40166f[_0x0ffc('0x2f')][_0x0ffc('0x34')](_0x0ffc('0x35'))){_0x13c425[_0x0ffc('0x1e')]=qs[_0x0ffc('0x1e')](_0x40166f['query'][_0x0ffc('0x1e')]);_0x13c425[_0x0ffc('0x1b')]=qs[_0x0ffc('0x1b')](_0x40166f[_0x0ffc('0x2f')]['offset']);}_0x13c425[_0x0ffc('0x36')]=qs[_0x0ffc('0x37')](_0x40166f[_0x0ffc('0x2f')][_0x0ffc('0x37')]);_0x13c425['where']=qs[_0x0ffc('0x38')](_[_0x0ffc('0x39')](_0x40166f[_0x0ffc('0x2f')],_0x5d3cff[_0x0ffc('0x38')]),_0x22eafd);if(_0x40166f[_0x0ffc('0x2f')][_0x0ffc('0x3a')]){_0x13c425[_0x0ffc('0x3b')]=_[_0x0ffc('0x3c')](_0x13c425[_0x0ffc('0x3b')],{'$or':_['map'](_0x22eafd,function(_0x1d23d4){if(_0x1d23d4[_0x0ffc('0x2b')]!==_0x0ffc('0x3d')){var _0x2d5d00={};_0x2d5d00[_0x1d23d4['name']]={'$like':'%'+_0x40166f[_0x0ffc('0x2f')][_0x0ffc('0x3a')]+'%'};return _0x2d5d00;}})});}_0x13c425=_[_0x0ffc('0x3c')]({},_0x13c425,_0x40166f[_0x0ffc('0x3e')]);var _0x2f9f98={'where':_0x13c425[_0x0ffc('0x3b')]};return db[_0x0ffc('0x29')][_0x0ffc('0x1d')](_0x2f9f98)[_0x0ffc('0x24')](function(_0x5cf45e){_0x4ece4f[_0x0ffc('0x1d')]=_0x5cf45e;if(_0x40166f[_0x0ffc('0x2f')][_0x0ffc('0x3f')]){_0x13c425[_0x0ffc('0x40')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x13c425);})['then'](function(_0x28105d){_0x4ece4f['rows']=_0x28105d;return _0x4ece4f;})[_0x0ffc('0x24')](respondWithFilteredResult(_0x5f3a01,_0x13c425))['catch'](handleError(_0x5f3a01,null));};exports[_0x0ffc('0x41')]=function(_0x1cb958,_0x50c005){var _0x54070c={'raw':!![],'where':{'id':_0x1cb958[_0x0ffc('0x42')]['id']}},_0x1bf431={};_0x1bf431['model']=_[_0x0ffc('0x30')](db[_0x0ffc('0x29')]['rawAttributes']);_0x1bf431['query']=_[_0x0ffc('0x30')](_0x1cb958['query']);_0x1bf431[_0x0ffc('0x38')]=_['intersection'](_0x1bf431['model'],_0x1bf431['query']);_0x54070c[_0x0ffc('0x33')]=_['intersection'](_0x1bf431[_0x0ffc('0x2d')],qs[_0x0ffc('0x32')](_0x1cb958[_0x0ffc('0x2f')]['fields']));_0x54070c[_0x0ffc('0x33')]=_0x54070c[_0x0ffc('0x33')][_0x0ffc('0x43')]?_0x54070c[_0x0ffc('0x33')]:_0x1bf431[_0x0ffc('0x2d')];if(_0x1cb958[_0x0ffc('0x2f')][_0x0ffc('0x3f')]){_0x54070c[_0x0ffc('0x40')]=[{'all':!![]}];}_0x54070c=_['merge']({},_0x54070c,_0x1cb958[_0x0ffc('0x3e')]);return db[_0x0ffc('0x29')][_0x0ffc('0x44')](_0x54070c)['then'](handleEntityNotFound(_0x50c005,null))[_0x0ffc('0x24')](respondWithResult(_0x50c005,null))[_0x0ffc('0x45')](handleError(_0x50c005,null));};exports[_0x0ffc('0x46')]=function(_0x2b16f7,_0x4a146f){return db[_0x0ffc('0x29')][_0x0ffc('0x46')](_0x2b16f7['body'],{})[_0x0ffc('0x24')](respondWithResult(_0x4a146f,0xc9))[_0x0ffc('0x45')](handleError(_0x4a146f,null));};exports['update']=function(_0x57e328,_0x18b774){if(_0x57e328[_0x0ffc('0x47')]['id']){delete _0x57e328[_0x0ffc('0x47')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x57e328[_0x0ffc('0x42')]['id']}})['then'](handleEntityNotFound(_0x18b774,null))[_0x0ffc('0x24')](saveUpdates(_0x57e328[_0x0ffc('0x47')],null))[_0x0ffc('0x24')](respondWithResult(_0x18b774,null))[_0x0ffc('0x45')](handleError(_0x18b774,null));};exports[_0x0ffc('0x48')]=function(_0x4a879a,_0x1b73b5){return db[_0x0ffc('0x29')][_0x0ffc('0x44')]({'where':{'id':_0x4a879a[_0x0ffc('0x42')]['id']}})['then'](handleEntityNotFound(_0x1b73b5,null))['then'](removeEntity(_0x1b73b5,null))[_0x0ffc('0x45')](handleError(_0x1b73b5,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 517edf9..5c7fd07 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 _0x32ef=['WhatsappApplication','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./whatsappApplication.attributes','exports','define'];(function(_0x39cff6,_0x4811ed){var _0x249019=function(_0x339e2f){while(--_0x339e2f){_0x39cff6['push'](_0x39cff6['shift']());}};_0x249019(++_0x4811ed);}(_0x32ef,0xf9));var _0xf32e=function(_0x5a86be,_0x43bede){_0x5a86be=_0x5a86be-0x0;var _0x59249b=_0x32ef[_0x5a86be];return _0x59249b;};'use strict';var _=require(_0xf32e('0x0'));var util=require(_0xf32e('0x1'));var logger=require(_0xf32e('0x2'))(_0xf32e('0x3'));var moment=require(_0xf32e('0x4'));var BPromise=require(_0xf32e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf32e('0x6'));var rimraf=require(_0xf32e('0x7'));var config=require('../../config/environment');var attributes=require(_0xf32e('0x8'));module[_0xf32e('0x9')]=function(_0x1a7d35,_0x1062c8){return _0x1a7d35[_0xf32e('0xa')](_0xf32e('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf32e('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x89f7=['moment','request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','lodash','util','../../config/logger'];(function(_0xf5ae13,_0x4861f6){var _0x11b847=function(_0x28b042){while(--_0x28b042){_0xf5ae13['push'](_0xf5ae13['shift']());}};_0x11b847(++_0x4861f6);}(_0x89f7,0x105));var _0x789f=function(_0xac0de1,_0x12d3d9){_0xac0de1=_0xac0de1-0x0;var _0x1c1995=_0x89f7[_0xac0de1];return _0x1c1995;};'use strict';var _=require(_0x789f('0x0'));var util=require(_0x789f('0x1'));var logger=require(_0x789f('0x2'))('api');var moment=require(_0x789f('0x3'));var BPromise=require('bluebird');var rp=require(_0x789f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x789f('0x5'));var config=require(_0x789f('0x6'));var attributes=require(_0x789f('0x7'));module[_0x789f('0x8')]=function(_0x5d7abe,_0x273a16){return _0x5d7abe[_0x789f('0x9')](_0x789f('0xa'),attributes,{'tableName':_0x789f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index f1d55ef..f864b3b 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 _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(_0x217eb1,_0x100654){var _0x326ad9=function(_0x56b6dd){while(--_0x56b6dd){_0x217eb1['push'](_0x217eb1['shift']());}};_0x326ad9(++_0x100654);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x3a20ae,_0x3233b1){_0x3a20ae=_0x3a20ae-0x0;var _0x4a012d=_0xd0bb[_0x3a20ae];return _0x4a012d;};'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 +var _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s'];(function(_0x22b18a,_0x5744fc){var _0x32ce7e=function(_0x296be8){while(--_0x296be8){_0x22b18a['push'](_0x22b18a['shift']());}};_0x32ce7e(++_0x5744fc);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x00bb[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 32d67a0..b51f5fc 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 _0x9fd4=['../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x163742,_0x467e36){var _0x1152ac=function(_0x40a83d){while(--_0x40a83d){_0x163742['push'](_0x163742['shift']());}};_0x1152ac(++_0x467e36);}(_0x9fd4,0x16c));var _0x49fd=function(_0x3480e9,_0x1ce980){_0x3480e9=_0x3480e9-0x0;var _0x389aad=_0x9fd4[_0x3480e9];return _0x389aad;};'use strict';var multer=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var path=require(_0x49fd('0x2'));var timeout=require(_0x49fd('0x3'));var express=require(_0x49fd('0x4'));var router=express[_0x49fd('0x5')]();var fs_extra=require(_0x49fd('0x6'));var auth=require(_0x49fd('0x7'));var interaction=require(_0x49fd('0x8'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x49fd('0x9')]('/',auth[_0x49fd('0xa')](),controller[_0x49fd('0xb')]);router[_0x49fd('0x9')]('/describe',auth[_0x49fd('0xa')](),controller[_0x49fd('0xc')]);router[_0x49fd('0x9')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),controller['show']);router[_0x49fd('0x9')](_0x49fd('0xe'),auth[_0x49fd('0xa')](),controller[_0x49fd('0xf')]);router[_0x49fd('0x9')](_0x49fd('0x10'),auth[_0x49fd('0xa')](),controller['download']);router[_0x49fd('0x11')]('/',auth[_0x49fd('0xa')](),controller[_0x49fd('0x12')]);router[_0x49fd('0x11')](_0x49fd('0xe'),auth[_0x49fd('0xa')](),controller[_0x49fd('0x13')]);router[_0x49fd('0x11')](_0x49fd('0x14'),auth[_0x49fd('0xa')](),interaction[_0x49fd('0x15')](_0x49fd('0x16'),_0x49fd('0x17')),controller[_0x49fd('0x18')]);router[_0x49fd('0x19')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),interaction[_0x49fd('0x15')](_0x49fd('0x16'),_0x49fd('0x1a')),controller[_0x49fd('0x1b')]);router[_0x49fd('0x1c')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),interaction[_0x49fd('0x15')](_0x49fd('0x16'),'whatsappinteraction:destroy'),controller[_0x49fd('0x1d')]);router[_0x49fd('0x1c')]('/:id/tags',auth['isAuthenticated'](),controller[_0x49fd('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xa1f6=['whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','multer','util','path','connect-timeout','express','Router','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked'];(function(_0x372515,_0xdd11f){var _0xa3bf4e=function(_0x212cc8){while(--_0x212cc8){_0x372515['push'](_0x372515['shift']());}};_0xa3bf4e(++_0xdd11f);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0xa1f6[_0x5f519b];return _0x2461e2;};'use strict';var multer=require(_0x6a1f('0x0'));var util=require(_0x6a1f('0x1'));var path=require(_0x6a1f('0x2'));var timeout=require(_0x6a1f('0x3'));var express=require(_0x6a1f('0x4'));var router=express[_0x6a1f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x6a1f('0x6')]('/',auth[_0x6a1f('0x7')](),controller[_0x6a1f('0x8')]);router[_0x6a1f('0x6')](_0x6a1f('0x9'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xa')]);router['get'](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xc')]);router[_0x6a1f('0x6')](_0x6a1f('0xd'),auth['isAuthenticated'](),controller[_0x6a1f('0xe')]);router[_0x6a1f('0x6')](_0x6a1f('0xf'),auth[_0x6a1f('0x7')](),controller['download']);router[_0x6a1f('0x10')]('/',auth['isAuthenticated'](),controller[_0x6a1f('0x11')]);router[_0x6a1f('0x10')](_0x6a1f('0xd'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0x12')]);router[_0x6a1f('0x10')](_0x6a1f('0x13'),auth[_0x6a1f('0x7')](),interaction[_0x6a1f('0x14')](_0x6a1f('0x15'),_0x6a1f('0x16')),controller[_0x6a1f('0x17')]);router[_0x6a1f('0x18')](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),interaction[_0x6a1f('0x14')](_0x6a1f('0x15'),_0x6a1f('0x19')),controller[_0x6a1f('0x1a')]);router['delete'](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),interaction[_0x6a1f('0x14')](_0x6a1f('0x15'),_0x6a1f('0x1b')),controller[_0x6a1f('0x1c')]);router[_0x6a1f('0x1d')](_0x6a1f('0x13'),auth['isAuthenticated'](),controller[_0x6a1f('0x1e')]);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 e9edc81..efc9dd5 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 _0x29d4=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x3a05b5,_0x669384){var _0x1760a0=function(_0x1064a9){while(--_0x1064a9){_0x3a05b5['push'](_0x3a05b5['shift']());}};_0x1760a0(++_0x669384);}(_0x29d4,0x1a1));var _0x429d=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x29d4[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0x429d('0x0'));var moment=require('moment');module[_0x429d('0x1')]={'closed':{'type':Sequelize[_0x429d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x429d('0x3')]},'disposition':{'type':Sequelize[_0x429d('0x4')]},'secondDisposition':{'type':Sequelize[_0x429d('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x429d('0x4')]},'phone':{'type':Sequelize[_0x429d('0x4')]},'read1stAt':{'type':Sequelize[_0x429d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x429d('0x5')]('in',_0x429d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x429d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x429d('0x5')]('in',_0x429d('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xed5f=['DATE','ENUM','out','moment','exports','BOOLEAN','STRING'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xed5f,0x1e6));var _0xfed5=function(_0x4ffe36,_0x309e69){_0x4ffe36=_0x4ffe36-0x0;var _0x2bb16f=_0xed5f[_0x4ffe36];return _0x2bb16f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfed5('0x0'));module[_0xfed5('0x1')]={'closed':{'type':Sequelize[_0xfed5('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xfed5('0x3')]},'secondDisposition':{'type':Sequelize[_0xfed5('0x3')]},'thirdDisposition':{'type':Sequelize[_0xfed5('0x3')]},'note':{'type':Sequelize[_0xfed5('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xfed5('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xfed5('0x5')]('in',_0xfed5('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfed5('0x5')]('in',_0xfed5('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 92ccb7b..85587ae 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 _0x5f8e=['CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','name','Owner','fullname','get','mkdirSync','Whatsapp','N.A.','closed','closedAt','disposition','existsSync','createReadStream','createWriteStream','basename','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','stack','send','index','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','user','catch','show','params','model','query','filters','intersection','attributes','fields','includeAll','include','merge','find','create','update','body','describe','addMessage','WhatsappMessage','ids','keys','length','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','map','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','unix','toString','join','root','server','tmp','transcript-%d-%s.zip','push','User'];(function(_0x11b7d5,_0x1aaa34){var _0x3a4a86=function(_0x3452eb){while(--_0x3452eb){_0x11b7d5['push'](_0x11b7d5['shift']());}};_0x3a4a86(++_0x1aaa34);}(_0x5f8e,0x1aa));var _0xe5f8=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0x5f8e[_0x34d346];return _0x122d76;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xe5f8('0x0'));var moment=require(_0xe5f8('0x1'));var BPromise=require(_0xe5f8('0x2'));var util=require(_0xe5f8('0x3'));var path=require(_0xe5f8('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe5f8('0x5'));var Redis=require(_0xe5f8('0x6'));var interaction=require(_0xe5f8('0x7'));var qs=require(_0xe5f8('0x8'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xe5f8('0x9'));var config=require('../../config/environment');var db=require(_0xe5f8('0xa'))['db'];config[_0xe5f8('0xb')]=_[_0xe5f8('0xc')](config[_0xe5f8('0xb')],{'host':_0xe5f8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe5f8('0xb')]));require(_0xe5f8('0xe'))[_0xe5f8('0xf')](socket);function respondWithStatusCode(_0x2c90e0,_0x1d5733){_0x1d5733=_0x1d5733||0xcc;return function(_0x2d1ced){if(_0x2d1ced){return _0x2c90e0[_0xe5f8('0x10')](_0x1d5733);}return _0x2c90e0[_0xe5f8('0x11')](_0x1d5733)[_0xe5f8('0x12')]();};}function respondWithResult(_0x4d5adc,_0x11e3ac){_0x11e3ac=_0x11e3ac||0xc8;return function(_0x55ad6e){if(_0x55ad6e){return _0x4d5adc['status'](_0x11e3ac)[_0xe5f8('0x13')](_0x55ad6e);}};}function respondWithFilteredResult(_0x4dc260,_0xcc337c){return function(_0xcc49d4){if(_0xcc49d4){var _0x433e2f=typeof _0xcc337c[_0xe5f8('0x14')]==='undefined'&&typeof _0xcc337c['limit']===_0xe5f8('0x15');var _0x29a956=_0xcc49d4[_0xe5f8('0x16')];var _0x42d014=_0x433e2f?0x0:_0xcc337c[_0xe5f8('0x14')];var _0x7af47e=_0x433e2f?_0xcc49d4[_0xe5f8('0x16')]:_0xcc337c[_0xe5f8('0x14')]+_0xcc337c[_0xe5f8('0x17')];var _0x382d2a;if(_0x7af47e>=_0x29a956){_0x7af47e=_0x29a956;_0x382d2a=0xc8;}else{_0x382d2a=0xce;}_0x4dc260[_0xe5f8('0x11')](_0x382d2a);return _0x4dc260[_0xe5f8('0x18')](_0xe5f8('0x19'),_0x42d014+'-'+_0x7af47e+'/'+_0x29a956)['json'](_0xcc49d4);}return null;};}function saveUpdates(_0x1abe77){return function(_0x5e6c40){if(_0x5e6c40){return _0x5e6c40['update'](_0x1abe77)[_0xe5f8('0x1a')](function(_0x12a1b0){return _0x12a1b0;});}return null;};}function removeEntity(_0x34f632){return function(_0x1ac890){if(_0x1ac890){return _0x1ac890[_0xe5f8('0x1b')]()['then'](function(){_0x34f632[_0xe5f8('0x11')](0xcc)[_0xe5f8('0x12')]();});}};}function handleEntityNotFound(_0x54c8c1){return function(_0x1ff8c0){if(!_0x1ff8c0){_0x54c8c1['sendStatus'](0x194);}return _0x1ff8c0;};}function handleError(_0x2b350d,_0x538be3){_0x538be3=_0x538be3||0x1f4;return function(_0x556158){logger[_0xe5f8('0x1c')](_0x556158[_0xe5f8('0x1d')]);if(_0x556158['name']){delete _0x556158['name'];}_0x2b350d[_0xe5f8('0x11')](_0x538be3)[_0xe5f8('0x1e')](_0x556158);};}exports[_0xe5f8('0x1f')]=function(_0x2bf459,_0x44eabf){var _0x45a65c={};var _0x316226=_['map'](db[_0xe5f8('0x20')][_0xe5f8('0x21')],function(_0x37b42a){return{'name':_0x37b42a[_0xe5f8('0x22')],'type':_0x37b42a[_0xe5f8('0x23')][_0xe5f8('0x24')]};});_0x45a65c=qs[_0xe5f8('0x25')](_0x316226,_0x2bf459);return interaction[_0xe5f8('0x26')](_0xe5f8('0x27'),_0x2bf459['query'],_0x2bf459[_0xe5f8('0x28')],_0x45a65c,_0x316226)['then'](respondWithFilteredResult(_0x44eabf,_0x45a65c))[_0xe5f8('0x29')](handleError(_0x44eabf,null));};exports[_0xe5f8('0x2a')]=function(_0xda513d,_0x4f59ba){var _0x32ed5d={'raw':![],'where':{'id':_0xda513d[_0xe5f8('0x2b')]['id']}},_0x551017={};_0x551017[_0xe5f8('0x2c')]=_['keys'](db[_0xe5f8('0x20')][_0xe5f8('0x21')]);_0x551017['query']=_['keys'](_0xda513d[_0xe5f8('0x2d')]);_0x551017[_0xe5f8('0x2e')]=_[_0xe5f8('0x2f')](_0x551017['model'],_0x551017[_0xe5f8('0x2d')]);_0x32ed5d[_0xe5f8('0x30')]=_['intersection'](_0x551017[_0xe5f8('0x2c')],qs[_0xe5f8('0x31')](_0xda513d['query'][_0xe5f8('0x31')]));_0x32ed5d[_0xe5f8('0x30')]=_0x32ed5d[_0xe5f8('0x30')]['length']?_0x32ed5d[_0xe5f8('0x30')]:_0x551017[_0xe5f8('0x2c')];if(_0xda513d['query'][_0xe5f8('0x32')]){_0x32ed5d[_0xe5f8('0x33')]=[{'all':!![]}];}_0x32ed5d=_[_0xe5f8('0x34')]({},_0x32ed5d,_0xda513d['options']);return db[_0xe5f8('0x20')][_0xe5f8('0x35')](_0x32ed5d)[_0xe5f8('0x1a')](handleEntityNotFound(_0x4f59ba,null))['then'](respondWithResult(_0x4f59ba,null))[_0xe5f8('0x29')](handleError(_0x4f59ba,null));};exports[_0xe5f8('0x36')]=function(_0x597059,_0x387c36){return db[_0xe5f8('0x20')][_0xe5f8('0x36')](_0x597059['body'],{})[_0xe5f8('0x1a')](respondWithResult(_0x387c36,0xc9))['catch'](handleError(_0x387c36,null));};exports[_0xe5f8('0x37')]=function(_0x1de365,_0x2df19a){if(_0x1de365[_0xe5f8('0x38')]['id']){delete _0x1de365[_0xe5f8('0x38')]['id'];}return db[_0xe5f8('0x20')]['find']({'where':{'id':_0x1de365[_0xe5f8('0x2b')]['id']}})[_0xe5f8('0x1a')](handleEntityNotFound(_0x2df19a,null))[_0xe5f8('0x1a')](saveUpdates(_0x1de365[_0xe5f8('0x38')],null))['then'](respondWithResult(_0x2df19a,null))[_0xe5f8('0x29')](handleError(_0x2df19a,null));};exports[_0xe5f8('0x1b')]=function(_0x43fab7,_0x31a42a){return db[_0xe5f8('0x20')]['find']({'where':{'id':_0x43fab7[_0xe5f8('0x2b')]['id']}})['then'](handleEntityNotFound(_0x31a42a,null))[_0xe5f8('0x1a')](removeEntity(_0x31a42a,null))['catch'](handleError(_0x31a42a,null));};exports[_0xe5f8('0x39')]=function(_0x13c0a7,_0x4715c2){return db['WhatsappInteraction'][_0xe5f8('0x39')]()['then'](respondWithResult(_0x4715c2,null))[_0xe5f8('0x29')](handleError(_0x4715c2,null));};exports[_0xe5f8('0x3a')]=function(_0x23dfe4,_0x2f3ab4){return db[_0xe5f8('0x3b')][_0xe5f8('0x35')]({'where':{'id':_0x23dfe4[_0xe5f8('0x2b')]['id']}})[_0xe5f8('0x1a')](handleEntityNotFound(_0x2f3ab4,null))['then'](function(_0x23bb1c){if(_0x23bb1c){return _0x23bb1c['addMessage'](_0x23dfe4[_0xe5f8('0x38')][_0xe5f8('0x3c')],_['omit'](_0x23dfe4['body'],[_0xe5f8('0x3c'),'id'])||{});}})[_0xe5f8('0x1a')](respondWithResult(_0x2f3ab4,null))[_0xe5f8('0x29')](handleError(_0x2f3ab4,null));};exports['getMessages']=function(_0x2b563b,_0x1b2108){var _0x15d6ec={'raw':![],'where':{}};var _0xe73a0f={};var _0x131ba8={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x2b563b[_0xe5f8('0x2b')]['id']}})[_0xe5f8('0x1a')](handleEntityNotFound(_0x1b2108,null))['then'](function(_0x27d455){if(_0x27d455){_0xe73a0f[_0xe5f8('0x2c')]=_[_0xe5f8('0x3d')](db['WhatsappMessage'][_0xe5f8('0x21')]);_0xe73a0f[_0xe5f8('0x2d')]=_['keys'](_0x2b563b[_0xe5f8('0x2d')]);_0xe73a0f['filters']=_[_0xe5f8('0x2f')](_0xe73a0f[_0xe5f8('0x2c')],_0xe73a0f[_0xe5f8('0x2d')]);_0x15d6ec['attributes']=_[_0xe5f8('0x2f')](_0xe73a0f[_0xe5f8('0x2c')],qs[_0xe5f8('0x31')](_0x2b563b[_0xe5f8('0x2d')]['fields']));_0x15d6ec['attributes']=_0x15d6ec[_0xe5f8('0x30')][_0xe5f8('0x3e')]?_0x15d6ec[_0xe5f8('0x30')]:_0xe73a0f[_0xe5f8('0x2c')];if(!_0x2b563b[_0xe5f8('0x2d')][_0xe5f8('0x3f')](_0xe5f8('0x40'))){_0x15d6ec[_0xe5f8('0x17')]=qs[_0xe5f8('0x17')](_0x2b563b[_0xe5f8('0x2d')][_0xe5f8('0x17')]);_0x15d6ec[_0xe5f8('0x14')]=qs['offset'](_0x2b563b[_0xe5f8('0x2d')][_0xe5f8('0x14')]);}_0x15d6ec[_0xe5f8('0x41')]=qs[_0xe5f8('0x42')](_0x2b563b['query'][_0xe5f8('0x42')]);_0x15d6ec[_0xe5f8('0x43')]=qs[_0xe5f8('0x2e')](_[_0xe5f8('0x44')](_0x2b563b[_0xe5f8('0x2d')],_0xe73a0f[_0xe5f8('0x2e')]));_0x15d6ec[_0xe5f8('0x43')][_0xe5f8('0x45')]=_0x27d455['id'];if(_0x2b563b[_0xe5f8('0x2d')]['filter']){_0x15d6ec['where']=_['merge'](_0x15d6ec[_0xe5f8('0x43')],{'$or':_[_0xe5f8('0x46')](_0x15d6ec[_0xe5f8('0x30')],function(_0x244408){var _0x490b25={};_0x490b25[_0x244408]={'$like':'%'+_0x2b563b['query'][_0xe5f8('0x47')]+'%'};return _0x490b25;})});}if(_0x2b563b[_0xe5f8('0x2d')][_0xe5f8('0x48')]){var _0xb18eb9=_0x2b563b[_0xe5f8('0x2d')][_0xe5f8('0x48')][_0xe5f8('0x49')](',');var _0x4d93ac={};_0x4d93ac[_0xb18eb9[0x0]]={'$gte':moment(_0xb18eb9[0x1])[_0xe5f8('0x4a')](_0xe5f8('0x4b'))};_0x15d6ec[_0xe5f8('0x43')]=_[_0xe5f8('0x34')](_0x15d6ec[_0xe5f8('0x43')],_0x4d93ac);}_0x15d6ec=_[_0xe5f8('0x34')]({},_0x15d6ec,_0x2b563b['options']);return db[_0xe5f8('0x3b')][_0xe5f8('0x16')]({'where':_0x15d6ec[_0xe5f8('0x43')]})[_0xe5f8('0x1a')](function(_0x4ddccd){_0x131ba8[_0xe5f8('0x16')]=_0x4ddccd;if(_0x2b563b[_0xe5f8('0x2d')][_0xe5f8('0x32')]){_0x15d6ec['include']=[{'all':!![]}];}return db[_0xe5f8('0x3b')]['findAll'](_0x15d6ec);})[_0xe5f8('0x1a')](function(_0x3557d1){_0x131ba8['rows']=_0x3557d1;return _0x131ba8;});}})[_0xe5f8('0x1a')](respondWithFilteredResult(_0x1b2108,_0x15d6ec))[_0xe5f8('0x29')](handleError(_0x1b2108,null));};exports[_0xe5f8('0x4c')]=function(_0x2b17ee,_0x9ed7b9){return db[_0xe5f8('0x20')][_0xe5f8('0x35')]({'where':{'id':_0x2b17ee['params']['id']}})['then'](handleEntityNotFound(_0x9ed7b9,null))['then'](function(_0x5c9970){if(_0x5c9970){return _0x5c9970[_0xe5f8('0x4d')](_0x2b17ee[_0xe5f8('0x38')][_0xe5f8('0x3c')],_[_0xe5f8('0x4e')](_0x2b17ee[_0xe5f8('0x38')],[_0xe5f8('0x3c'),'id'])||{})[_0xe5f8('0x4f')](function(){return db[_0xe5f8('0x50')][_0xe5f8('0x26')]({'attributes':['id','name',_0xe5f8('0x51')],'where':{'id':_0x2b17ee[_0xe5f8('0x38')]['ids']}});})[_0xe5f8('0x1a')](function(_0x33f414){socket[_0xe5f8('0x52')](_0xe5f8('0x53'),{'id':Number(_0x2b17ee[_0xe5f8('0x2b')]['id']),'tags':_0x33f414||[]});return{'id':Number(_0x2b17ee[_0xe5f8('0x2b')]['id']),'tags':_0x33f414||[]};});}})[_0xe5f8('0x1a')](respondWithResult(_0x9ed7b9,null))[_0xe5f8('0x29')](handleError(_0x9ed7b9,null));};exports['removeTags']=function(_0x4e1acd,_0x1b5418){return db[_0xe5f8('0x20')][_0xe5f8('0x35')]({'where':{'id':_0x4e1acd[_0xe5f8('0x2b')]['id']}})[_0xe5f8('0x1a')](handleEntityNotFound(_0x1b5418,null))[_0xe5f8('0x1a')](function(_0x60f451){if(_0x60f451){return _0x60f451[_0xe5f8('0x54')](_0x4e1acd['query'][_0xe5f8('0x3c')]);}})[_0xe5f8('0x1a')](respondWithStatusCode(_0x1b5418,null))['catch'](handleError(_0x1b5418,null));};exports['download']=function(_0x13927f,_0x119374){var _0x2bcf1c=moment()[_0xe5f8('0x55')]()[_0xe5f8('0x56')]();var _0x4b9a6a=path[_0xe5f8('0x57')](config[_0xe5f8('0x58')],_0xe5f8('0x59'),'files',_0xe5f8('0x5a'));var _0x5e0bfe=path[_0xe5f8('0x57')](config[_0xe5f8('0x58')],_0xe5f8('0x59'),'files','attachments');var _0x5dba23=path[_0xe5f8('0x57')](_0x4b9a6a,_0x2bcf1c);var _0xd0d396=util[_0xe5f8('0x4a')](_0xe5f8('0x5b'),_0x13927f['params']['id'],_0x2bcf1c);var _0x203f80=path[_0xe5f8('0x57')](_0x4b9a6a,_0xd0d396);var _0x30c3d9=[];_0x30c3d9[_0xe5f8('0x5c')]({'model':db[_0xe5f8('0x5d')],'as':_0xe5f8('0x5d'),'attributes':['id','fullname'],'raw':!![]});_0x30c3d9['push']({'model':db[_0xe5f8('0x5e')],'as':_0xe5f8('0x5f'),'attributes':['id',_0xe5f8('0x60'),_0xe5f8('0x61')],'raw':!![]});if(_0x13927f['query']['attachments']){_0x30c3d9[_0xe5f8('0x5c')]({'model':db[_0xe5f8('0x62')],'as':_0xe5f8('0x62'),'raw':!![]});}var _0x6f5e20=[{'model':db[_0xe5f8('0x3b')],'as':_0xe5f8('0x63'),'attributes':['id',_0xe5f8('0x38'),_0xe5f8('0x64'),_0xe5f8('0x65'),_0xe5f8('0x66'),_0xe5f8('0x67')],'include':_0x30c3d9}];_0x6f5e20[_0xe5f8('0x5c')]({'model':db[_0xe5f8('0x68')],'as':_0xe5f8('0x69'),'attributes':['id',_0xe5f8('0x6a')]});_0x6f5e20['push']({'model':db[_0xe5f8('0x5d')],'as':_0xe5f8('0x6b'),'attributes':['id',_0xe5f8('0x6c')]});return db[_0xe5f8('0x20')][_0xe5f8('0x35')]({'where':{'id':_0x13927f[_0xe5f8('0x2b')]['id']},'include':_0x6f5e20})[_0xe5f8('0x1a')](handleEntityNotFound(_0x119374,null))[_0xe5f8('0x1a')](function(_0xb26c6a){if(_0xb26c6a){var _0x2cc2d6=_0xb26c6a[_0xe5f8('0x6d')]({'plain':!![]});fs[_0xe5f8('0x6e')](_0x5dba23);var _0x4cf731={'channel':_0xe5f8('0x6f'),'account':_0x2cc2d6[_0xe5f8('0x69')][_0xe5f8('0x6a')],'agent':_0x2cc2d6[_0xe5f8('0x6b')]?_0x2cc2d6[_0xe5f8('0x6b')][_0xe5f8('0x6c')]:_0xe5f8('0x70'),'createdAt':moment(_0x2cc2d6[_0xe5f8('0x64')])[_0xe5f8('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x2cc2d6[_0xe5f8('0x71')]?moment(_0x2cc2d6[_0xe5f8('0x72')])[_0xe5f8('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe5f8('0x56')]():'','disposition':_0x2cc2d6[_0xe5f8('0x73')],'messages':_(_0x2cc2d6[_0xe5f8('0x63')])[_0xe5f8('0x47')]({'secret':![]})['map'](function(_0x48a08f){if(_0x48a08f['Attachment']){var _0x33ba73=path['join'](_0x5e0bfe,_0x48a08f[_0xe5f8('0x62')]['basename']);if(fs[_0xe5f8('0x74')](_0x33ba73)){fs[_0xe5f8('0x75')](_0x33ba73)['pipe'](fs[_0xe5f8('0x76')](path[_0xe5f8('0x57')](_0x5dba23,_0x48a08f['Attachment'][_0xe5f8('0x77')])));}}return{'date':moment(_0x48a08f[_0xe5f8('0x64')])['format'](_0xe5f8('0x4b'))[_0xe5f8('0x56')](),'sender':_0x48a08f[_0xe5f8('0x65')]===_0xe5f8('0x78')?_0x48a08f['User']?_0x48a08f['User'][_0xe5f8('0x6c')]:_0xe5f8('0x79'):_0x48a08f[_0xe5f8('0x5f')][_0xe5f8('0x60')]+(_0x48a08f['Contact']['lastName']?'\x20'+_0x48a08f['Contact'][_0xe5f8('0x61')]:''),'body':_0x48a08f[_0xe5f8('0x62')]?_0x48a08f[_0xe5f8('0x62')]['basename']:_0x48a08f[_0xe5f8('0x38')],'direction':_0x48a08f[_0xe5f8('0x65')]===_0xe5f8('0x78')?'A':'C','secret':_0x48a08f[_0xe5f8('0x66')],'read':_0x48a08f['read'],'attachment':_0x48a08f[_0xe5f8('0x62')]};})[_0xe5f8('0x7a')]()};return ejs[_0xe5f8('0x7b')](path[_0xe5f8('0x57')](config[_0xe5f8('0x58')],'server',_0xe5f8('0x7c'),_0xe5f8('0x7d')),{'interaction':_0x4cf731})['then'](function(_0x479211){var _0x39e0ee=path[_0xe5f8('0x57')](_0x5dba23,_0xe5f8('0x7e')+_0x2cc2d6['id']+'-'+_0x2bcf1c+_0xe5f8('0x7f'));var _0x1fd66a={'path':_0x39e0ee,'channel':'Whatsapp','interactionId':_0x2cc2d6['id']};return pdf[_0xe5f8('0x80')](_0x479211,_0x1fd66a);})[_0xe5f8('0x1a')](function(){return new BPromise(function(_0x3baa63,_0x27f4fa){zipdir(_0x5dba23,{'saveTo':_0x203f80},function(_0xa6f83f,_0x558826){if(_0xa6f83f)return _0x27f4fa(_0xa6f83f);return _0x3baa63(_0x558826);});})[_0xe5f8('0x1a')](function(){return new BPromise(function(_0x523445,_0x3e5ff4){rimraf(_0x5dba23,function(_0x393441){if(_0x393441)_0x3e5ff4(_0x393441);return _0x523445();});});})[_0xe5f8('0x1a')](function(){return _0x119374[_0xe5f8('0x81')](_0x203f80,_0xd0d396,function(_0x2e17a5){if(_0x2e17a5){console['log']('err',_0x2e17a5);}else{fs['unlinkSync'](_0x203f80);}});});});}else{return _0x119374[_0xe5f8('0x10')](0xc8);}})[_0xe5f8('0x29')](handleError(_0x119374,null));}; \ No newline at end of file +var _0xabd8=['spread','Tag','color','whatsappInteractionTags:save','removeTags','unix','toString','root','server','files','tmp','attachments','join','format','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Attachment','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','disposition','Messages','basename','existsSync','createReadStream','createWriteStream','out','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','download','log','rimraf','zip-dir','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','then','name','send','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','catch','show','params','model','keys','filters','attributes','length','includeAll','include','merge','options','find','create','body','describe','WhatsappMessage','addMessage','ids','omit','intersection','fields','nolimit','sort','where','pick','filter','$gte','split','rows','addTags','setTags'];(function(_0x7398e9,_0x39b11c){var _0x502bd4=function(_0x441fe5){while(--_0x441fe5){_0x7398e9['push'](_0x7398e9['shift']());}};_0x502bd4(++_0x39b11c);}(_0xabd8,0xa8));var _0x8abd=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xabd8[_0x13b02f];return _0x12e9a6;};'use strict';var rimraf=require(_0x8abd('0x0'));var zipdir=require(_0x8abd('0x1'));var moment=require('moment');var BPromise=require(_0x8abd('0x2'));var util=require(_0x8abd('0x3'));var path=require(_0x8abd('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8abd('0x5'));var Redis=require(_0x8abd('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x8abd('0x7'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x8abd('0x8'));var config=require('../../config/environment');var db=require(_0x8abd('0x9'))['db'];config['redis']=_[_0x8abd('0xa')](config['redis'],{'host':_0x8abd('0xb'),'port':0x18eb});var socket=require(_0x8abd('0xc'))(new Redis(config[_0x8abd('0xd')]));require(_0x8abd('0xe'))[_0x8abd('0xf')](socket);function respondWithStatusCode(_0x2dc7ad,_0x4e4874){_0x4e4874=_0x4e4874||0xcc;return function(_0x1cba7f){if(_0x1cba7f){return _0x2dc7ad[_0x8abd('0x10')](_0x4e4874);}return _0x2dc7ad[_0x8abd('0x11')](_0x4e4874)[_0x8abd('0x12')]();};}function respondWithResult(_0x11d065,_0x4addd9){_0x4addd9=_0x4addd9||0xc8;return function(_0x10b96c){if(_0x10b96c){return _0x11d065['status'](_0x4addd9)[_0x8abd('0x13')](_0x10b96c);}};}function respondWithFilteredResult(_0x24f0a9,_0x150dd9){return function(_0x358488){if(_0x358488){var _0x374521=typeof _0x150dd9[_0x8abd('0x14')]===_0x8abd('0x15')&&typeof _0x150dd9[_0x8abd('0x16')]===_0x8abd('0x15');var _0x3e697c=_0x358488[_0x8abd('0x17')];var _0x3a8d3d=_0x374521?0x0:_0x150dd9[_0x8abd('0x14')];var _0x19657a=_0x374521?_0x358488[_0x8abd('0x17')]:_0x150dd9[_0x8abd('0x14')]+_0x150dd9['limit'];var _0x1d2149;if(_0x19657a>=_0x3e697c){_0x19657a=_0x3e697c;_0x1d2149=0xc8;}else{_0x1d2149=0xce;}_0x24f0a9[_0x8abd('0x11')](_0x1d2149);return _0x24f0a9[_0x8abd('0x18')]('Content-Range',_0x3a8d3d+'-'+_0x19657a+'/'+_0x3e697c)['json'](_0x358488);}return null;};}function saveUpdates(_0x2a1633){return function(_0x2af088){if(_0x2af088){return _0x2af088[_0x8abd('0x19')](_0x2a1633)['then'](function(_0x27b3c0){return _0x27b3c0;});}return null;};}function removeEntity(_0x3f2542){return function(_0x40fc69){if(_0x40fc69){return _0x40fc69[_0x8abd('0x1a')]()[_0x8abd('0x1b')](function(){_0x3f2542[_0x8abd('0x11')](0xcc)[_0x8abd('0x12')]();});}};}function handleEntityNotFound(_0x5bd9b2){return function(_0x3c52e2){if(!_0x3c52e2){_0x5bd9b2['sendStatus'](0x194);}return _0x3c52e2;};}function handleError(_0x3c4be9,_0x118902){_0x118902=_0x118902||0x1f4;return function(_0x15090f){logger['error'](_0x15090f['stack']);if(_0x15090f[_0x8abd('0x1c')]){delete _0x15090f['name'];}_0x3c4be9[_0x8abd('0x11')](_0x118902)[_0x8abd('0x1d')](_0x15090f);};}exports['index']=function(_0x3a030c,_0x1bd8a9){var _0x71453b={};var _0x46d27b=_[_0x8abd('0x1e')](db[_0x8abd('0x1f')][_0x8abd('0x20')],function(_0x53c92c){return{'name':_0x53c92c[_0x8abd('0x21')],'type':_0x53c92c[_0x8abd('0x22')][_0x8abd('0x23')]};});_0x71453b=qs[_0x8abd('0x24')](_0x46d27b,_0x3a030c);return interaction[_0x8abd('0x25')](_0x8abd('0x26'),_0x3a030c[_0x8abd('0x27')],_0x3a030c['user'],_0x71453b,_0x46d27b)[_0x8abd('0x1b')](respondWithFilteredResult(_0x1bd8a9,_0x71453b))[_0x8abd('0x28')](handleError(_0x1bd8a9,null));};exports[_0x8abd('0x29')]=function(_0x5a3ce8,_0x52266b){var _0x26073f={'raw':![],'where':{'id':_0x5a3ce8[_0x8abd('0x2a')]['id']}},_0x210f7d={};_0x210f7d[_0x8abd('0x2b')]=_[_0x8abd('0x2c')](db[_0x8abd('0x1f')][_0x8abd('0x20')]);_0x210f7d[_0x8abd('0x27')]=_[_0x8abd('0x2c')](_0x5a3ce8['query']);_0x210f7d[_0x8abd('0x2d')]=_['intersection'](_0x210f7d[_0x8abd('0x2b')],_0x210f7d[_0x8abd('0x27')]);_0x26073f['attributes']=_['intersection'](_0x210f7d[_0x8abd('0x2b')],qs['fields'](_0x5a3ce8[_0x8abd('0x27')]['fields']));_0x26073f[_0x8abd('0x2e')]=_0x26073f['attributes'][_0x8abd('0x2f')]?_0x26073f[_0x8abd('0x2e')]:_0x210f7d[_0x8abd('0x2b')];if(_0x5a3ce8[_0x8abd('0x27')][_0x8abd('0x30')]){_0x26073f[_0x8abd('0x31')]=[{'all':!![]}];}_0x26073f=_[_0x8abd('0x32')]({},_0x26073f,_0x5a3ce8[_0x8abd('0x33')]);return db[_0x8abd('0x1f')][_0x8abd('0x34')](_0x26073f)[_0x8abd('0x1b')](handleEntityNotFound(_0x52266b,null))[_0x8abd('0x1b')](respondWithResult(_0x52266b,null))['catch'](handleError(_0x52266b,null));};exports[_0x8abd('0x35')]=function(_0x50ae4e,_0x3fe6ed){return db[_0x8abd('0x1f')][_0x8abd('0x35')](_0x50ae4e[_0x8abd('0x36')],{})[_0x8abd('0x1b')](respondWithResult(_0x3fe6ed,0xc9))[_0x8abd('0x28')](handleError(_0x3fe6ed,null));};exports[_0x8abd('0x19')]=function(_0x583c7e,_0x2ef012){if(_0x583c7e[_0x8abd('0x36')]['id']){delete _0x583c7e[_0x8abd('0x36')]['id'];}return db['WhatsappInteraction'][_0x8abd('0x34')]({'where':{'id':_0x583c7e['params']['id']}})[_0x8abd('0x1b')](handleEntityNotFound(_0x2ef012,null))['then'](saveUpdates(_0x583c7e[_0x8abd('0x36')],null))[_0x8abd('0x1b')](respondWithResult(_0x2ef012,null))['catch'](handleError(_0x2ef012,null));};exports[_0x8abd('0x1a')]=function(_0x21f510,_0x58712e){return db[_0x8abd('0x1f')]['find']({'where':{'id':_0x21f510[_0x8abd('0x2a')]['id']}})[_0x8abd('0x1b')](handleEntityNotFound(_0x58712e,null))['then'](removeEntity(_0x58712e,null))[_0x8abd('0x28')](handleError(_0x58712e,null));};exports[_0x8abd('0x37')]=function(_0x1be389,_0x395dcb){return db['WhatsappInteraction'][_0x8abd('0x37')]()['then'](respondWithResult(_0x395dcb,null))[_0x8abd('0x28')](handleError(_0x395dcb,null));};exports['addMessage']=function(_0x2f8be8,_0x556045){return db[_0x8abd('0x38')]['find']({'where':{'id':_0x2f8be8[_0x8abd('0x2a')]['id']}})['then'](handleEntityNotFound(_0x556045,null))[_0x8abd('0x1b')](function(_0x128df1){if(_0x128df1){return _0x128df1[_0x8abd('0x39')](_0x2f8be8[_0x8abd('0x36')][_0x8abd('0x3a')],_[_0x8abd('0x3b')](_0x2f8be8[_0x8abd('0x36')],[_0x8abd('0x3a'),'id'])||{});}})[_0x8abd('0x1b')](respondWithResult(_0x556045,null))[_0x8abd('0x28')](handleError(_0x556045,null));};exports['getMessages']=function(_0xd52732,_0x6ca53a){var _0x4e22bf={'raw':![],'where':{}};var _0x14c5cd={};var _0x3dc82b={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0xd52732[_0x8abd('0x2a')]['id']}})[_0x8abd('0x1b')](handleEntityNotFound(_0x6ca53a,null))[_0x8abd('0x1b')](function(_0xc41319){if(_0xc41319){_0x14c5cd[_0x8abd('0x2b')]=_['keys'](db['WhatsappMessage'][_0x8abd('0x20')]);_0x14c5cd['query']=_[_0x8abd('0x2c')](_0xd52732[_0x8abd('0x27')]);_0x14c5cd[_0x8abd('0x2d')]=_[_0x8abd('0x3c')](_0x14c5cd[_0x8abd('0x2b')],_0x14c5cd[_0x8abd('0x27')]);_0x4e22bf['attributes']=_['intersection'](_0x14c5cd['model'],qs[_0x8abd('0x3d')](_0xd52732[_0x8abd('0x27')][_0x8abd('0x3d')]));_0x4e22bf[_0x8abd('0x2e')]=_0x4e22bf[_0x8abd('0x2e')]['length']?_0x4e22bf['attributes']:_0x14c5cd[_0x8abd('0x2b')];if(!_0xd52732[_0x8abd('0x27')]['hasOwnProperty'](_0x8abd('0x3e'))){_0x4e22bf[_0x8abd('0x16')]=qs[_0x8abd('0x16')](_0xd52732['query'][_0x8abd('0x16')]);_0x4e22bf[_0x8abd('0x14')]=qs[_0x8abd('0x14')](_0xd52732[_0x8abd('0x27')]['offset']);}_0x4e22bf['order']=qs['sort'](_0xd52732[_0x8abd('0x27')][_0x8abd('0x3f')]);_0x4e22bf[_0x8abd('0x40')]=qs[_0x8abd('0x2d')](_[_0x8abd('0x41')](_0xd52732['query'],_0x14c5cd[_0x8abd('0x2d')]));_0x4e22bf[_0x8abd('0x40')]['WhatsappInteractionId']=_0xc41319['id'];if(_0xd52732[_0x8abd('0x27')][_0x8abd('0x42')]){_0x4e22bf['where']=_[_0x8abd('0x32')](_0x4e22bf[_0x8abd('0x40')],{'$or':_[_0x8abd('0x1e')](_0x4e22bf['attributes'],function(_0x188521){var _0x110938={};_0x110938[_0x188521]={'$like':'%'+_0xd52732[_0x8abd('0x27')][_0x8abd('0x42')]+'%'};return _0x110938;})});}if(_0xd52732['query']['$gte']){var _0x33b420=_0xd52732['query'][_0x8abd('0x43')][_0x8abd('0x44')](',');var _0x4fec66={};_0x4fec66[_0x33b420[0x0]]={'$gte':moment(_0x33b420[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4e22bf[_0x8abd('0x40')]=_['merge'](_0x4e22bf['where'],_0x4fec66);}_0x4e22bf=_['merge']({},_0x4e22bf,_0xd52732['options']);return db[_0x8abd('0x38')][_0x8abd('0x17')]({'where':_0x4e22bf['where']})['then'](function(_0xcbbc0b){_0x3dc82b[_0x8abd('0x17')]=_0xcbbc0b;if(_0xd52732[_0x8abd('0x27')]['includeAll']){_0x4e22bf['include']=[{'all':!![]}];}return db[_0x8abd('0x38')][_0x8abd('0x25')](_0x4e22bf);})[_0x8abd('0x1b')](function(_0xcddaff){_0x3dc82b[_0x8abd('0x45')]=_0xcddaff;return _0x3dc82b;});}})[_0x8abd('0x1b')](respondWithFilteredResult(_0x6ca53a,_0x4e22bf))[_0x8abd('0x28')](handleError(_0x6ca53a,null));};exports[_0x8abd('0x46')]=function(_0x46e6ff,_0x51b3cf){return db[_0x8abd('0x1f')][_0x8abd('0x34')]({'where':{'id':_0x46e6ff[_0x8abd('0x2a')]['id']}})[_0x8abd('0x1b')](handleEntityNotFound(_0x51b3cf,null))[_0x8abd('0x1b')](function(_0x9e2745){if(_0x9e2745){return _0x9e2745[_0x8abd('0x47')](_0x46e6ff[_0x8abd('0x36')][_0x8abd('0x3a')],_[_0x8abd('0x3b')](_0x46e6ff['body'],[_0x8abd('0x3a'),'id'])||{})[_0x8abd('0x48')](function(){return db[_0x8abd('0x49')][_0x8abd('0x25')]({'attributes':['id',_0x8abd('0x1c'),_0x8abd('0x4a')],'where':{'id':_0x46e6ff[_0x8abd('0x36')][_0x8abd('0x3a')]}});})['then'](function(_0x1e0ab5){socket['emit'](_0x8abd('0x4b'),{'id':Number(_0x46e6ff[_0x8abd('0x2a')]['id']),'tags':_0x1e0ab5||[]});return{'id':Number(_0x46e6ff['params']['id']),'tags':_0x1e0ab5||[]};});}})['then'](respondWithResult(_0x51b3cf,null))[_0x8abd('0x28')](handleError(_0x51b3cf,null));};exports[_0x8abd('0x4c')]=function(_0x331192,_0x434953){return db[_0x8abd('0x1f')][_0x8abd('0x34')]({'where':{'id':_0x331192[_0x8abd('0x2a')]['id']}})[_0x8abd('0x1b')](handleEntityNotFound(_0x434953,null))[_0x8abd('0x1b')](function(_0x9be420){if(_0x9be420){return _0x9be420[_0x8abd('0x4c')](_0x331192[_0x8abd('0x27')][_0x8abd('0x3a')]);}})[_0x8abd('0x1b')](respondWithStatusCode(_0x434953,null))['catch'](handleError(_0x434953,null));};exports['download']=function(_0x1e1e3e,_0x4889ca){var _0x51d6b8=moment()[_0x8abd('0x4d')]()[_0x8abd('0x4e')]();var _0x4c6672=path['join'](config[_0x8abd('0x4f')],_0x8abd('0x50'),_0x8abd('0x51'),_0x8abd('0x52'));var _0x369995=path['join'](config[_0x8abd('0x4f')],_0x8abd('0x50'),_0x8abd('0x51'),_0x8abd('0x53'));var _0x2896b2=path[_0x8abd('0x54')](_0x4c6672,_0x51d6b8);var _0x13eee5=util[_0x8abd('0x55')](_0x8abd('0x56'),_0x1e1e3e[_0x8abd('0x2a')]['id'],_0x51d6b8);var _0x49a287=path['join'](_0x4c6672,_0x13eee5);var _0x21c922=[];_0x21c922[_0x8abd('0x57')]({'model':db[_0x8abd('0x58')],'as':'User','attributes':['id',_0x8abd('0x59')],'raw':!![]});_0x21c922[_0x8abd('0x57')]({'model':db['CmContact'],'as':_0x8abd('0x5a'),'attributes':['id',_0x8abd('0x5b'),_0x8abd('0x5c')],'raw':!![]});if(_0x1e1e3e[_0x8abd('0x27')][_0x8abd('0x53')]){_0x21c922['push']({'model':db[_0x8abd('0x5d')],'as':_0x8abd('0x5d'),'raw':!![]});}var _0x2457d8=[{'model':db[_0x8abd('0x38')],'as':'Messages','attributes':['id',_0x8abd('0x36'),'createdAt',_0x8abd('0x5e'),_0x8abd('0x5f'),_0x8abd('0x60')],'include':_0x21c922}];_0x2457d8['push']({'model':db[_0x8abd('0x61')],'as':_0x8abd('0x62'),'attributes':['id','name']});_0x2457d8['push']({'model':db['User'],'as':_0x8abd('0x63'),'attributes':['id',_0x8abd('0x59')]});return db['WhatsappInteraction'][_0x8abd('0x34')]({'where':{'id':_0x1e1e3e['params']['id']},'include':_0x2457d8})['then'](handleEntityNotFound(_0x4889ca,null))[_0x8abd('0x1b')](function(_0x2fd107){if(_0x2fd107){var _0x309539=_0x2fd107[_0x8abd('0x64')]({'plain':!![]});fs[_0x8abd('0x65')](_0x2896b2);var _0x565e4b={'channel':_0x8abd('0x66'),'account':_0x309539[_0x8abd('0x62')][_0x8abd('0x1c')],'agent':_0x309539[_0x8abd('0x63')]?_0x309539[_0x8abd('0x63')]['fullname']:_0x8abd('0x67'),'createdAt':moment(_0x309539[_0x8abd('0x68')])['format'](_0x8abd('0x69'))[_0x8abd('0x4e')](),'closedAt':_0x309539['closed']?moment(_0x309539['closedAt'])[_0x8abd('0x55')](_0x8abd('0x69'))[_0x8abd('0x4e')]():'','disposition':_0x309539[_0x8abd('0x6a')],'messages':_(_0x309539[_0x8abd('0x6b')])[_0x8abd('0x42')]({'secret':![]})[_0x8abd('0x1e')](function(_0x96215b){if(_0x96215b[_0x8abd('0x5d')]){var _0xa30c2d=path[_0x8abd('0x54')](_0x369995,_0x96215b[_0x8abd('0x5d')][_0x8abd('0x6c')]);if(fs[_0x8abd('0x6d')](_0xa30c2d)){fs[_0x8abd('0x6e')](_0xa30c2d)['pipe'](fs[_0x8abd('0x6f')](path[_0x8abd('0x54')](_0x2896b2,_0x96215b[_0x8abd('0x5d')]['basename'])));}}return{'date':moment(_0x96215b[_0x8abd('0x68')])[_0x8abd('0x55')](_0x8abd('0x69'))[_0x8abd('0x4e')](),'sender':_0x96215b[_0x8abd('0x5e')]===_0x8abd('0x70')?_0x96215b[_0x8abd('0x58')]?_0x96215b[_0x8abd('0x58')][_0x8abd('0x59')]:'System':_0x96215b[_0x8abd('0x5a')][_0x8abd('0x5b')]+(_0x96215b[_0x8abd('0x5a')][_0x8abd('0x5c')]?'\x20'+_0x96215b[_0x8abd('0x5a')]['lastName']:''),'body':_0x96215b[_0x8abd('0x5d')]?_0x96215b[_0x8abd('0x5d')][_0x8abd('0x6c')]:_0x96215b[_0x8abd('0x36')],'direction':_0x96215b[_0x8abd('0x5e')]===_0x8abd('0x70')?'A':'C','secret':_0x96215b[_0x8abd('0x5f')],'read':_0x96215b[_0x8abd('0x60')],'attachment':_0x96215b[_0x8abd('0x5d')]};})[_0x8abd('0x71')]()};return ejs[_0x8abd('0x72')](path[_0x8abd('0x54')](config[_0x8abd('0x4f')],_0x8abd('0x50'),'views',_0x8abd('0x73')),{'interaction':_0x565e4b})[_0x8abd('0x1b')](function(_0x3dcc14){var _0x28a45c=path[_0x8abd('0x54')](_0x2896b2,_0x8abd('0x74')+_0x309539['id']+'-'+_0x51d6b8+_0x8abd('0x75'));var _0x2d17c0={'path':_0x28a45c,'channel':'Whatsapp','interactionId':_0x309539['id']};return pdf['createPdfFromHTML'](_0x3dcc14,_0x2d17c0);})[_0x8abd('0x1b')](function(){return new BPromise(function(_0x50e704,_0x2908dd){zipdir(_0x2896b2,{'saveTo':_0x49a287},function(_0x1d058d,_0x19ba82){if(_0x1d058d)return _0x2908dd(_0x1d058d);return _0x50e704(_0x19ba82);});})['then'](function(){return new BPromise(function(_0x3494fa,_0x255179){rimraf(_0x2896b2,function(_0x5e89ef){if(_0x5e89ef)_0x255179(_0x5e89ef);return _0x3494fa();});});})[_0x8abd('0x1b')](function(){return _0x4889ca[_0x8abd('0x76')](_0x49a287,_0x13eee5,function(_0x26efe9){if(_0x26efe9){console[_0x8abd('0x77')]('err',_0x26efe9);}else{fs['unlinkSync'](_0x49a287);}});});});}else{return _0x4889ca[_0x8abd('0x10')](0xc8);}})['catch'](handleError(_0x4889ca,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 84e1f65..702c583 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 _0x833b=['remove','getUsers','setDataValue','Users','map','findAll','then','length','emit','catch','exports','../../mysqldb','setMaxListeners','update'];(function(_0x1e271f,_0xf14504){var _0x2b2ac5=function(_0x21c3b6){while(--_0x21c3b6){_0x1e271f['push'](_0x1e271f['shift']());}};_0x2b2ac5(++_0xf14504);}(_0x833b,0x131));var _0xb833=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x833b[_0x47aa64];return _0x549c7a;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xb833('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xb833('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb833('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb833('0x2'),'afterDestroy':_0xb833('0x3')};function emitEvent(_0x1f9d90){return function(_0x181a4e,_0x44e55d,_0x35b3f0){_0x181a4e[_0xb833('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3afa71){_0x181a4e[_0xb833('0x5')](_0xb833('0x6'),_0x3afa71[_0xb833('0x7')](function(_0x3b74c4){return{'id':_0x3b74c4['id']};}));return WhatsappMessage[_0xb833('0x8')]({'where':{'WhatsappInteractionId':_0x181a4e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb833('0x9')](function(_0x50cb16){_0x181a4e[_0xb833('0x5')]('unreadMessages',_0x50cb16[_0xb833('0xa')]);WhatsappInteractionEvents[_0xb833('0xb')](_0x1f9d90+':'+_0x181a4e['id'],_0x181a4e);WhatsappInteractionEvents[_0xb833('0xb')](_0x1f9d90,_0x181a4e);_0x35b3f0(null);})[_0xb833('0xc')](_0x35b3f0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xb833('0xd')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xd61e=['findAll','then','setDataValue','emit','catch','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','update','remove','getUsers'];(function(_0x3c5e54,_0x2b991b){var _0x3ae1f3=function(_0x43f80f){while(--_0x43f80f){_0x3c5e54['push'](_0x3c5e54['shift']());}};_0x3ae1f3(++_0x2b991b);}(_0xd61e,0x13d));var _0xed61=function(_0x13e94c,_0x366ef3){_0x13e94c=_0x13e94c-0x0;var _0x293f19=_0xd61e[_0x13e94c];return _0x293f19;};'use strict';var EventEmitter=require(_0xed61('0x0'));var WhatsappInteraction=require(_0xed61('0x1'))['db'][_0xed61('0x2')];var WhatsappMessage=require(_0xed61('0x1'))['db'][_0xed61('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xed61('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xed61('0x5'),'afterDestroy':_0xed61('0x6')};function emitEvent(_0x152e2d){return function(_0x376e19,_0x1739bd,_0x39e7f8){_0x376e19[_0xed61('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5e6173){_0x376e19['setDataValue']('Users',_0x5e6173['map'](function(_0xbac89d){return{'id':_0xbac89d['id']};}));return WhatsappMessage[_0xed61('0x8')]({'where':{'WhatsappInteractionId':_0x376e19['id'],'direction':'in','read':![]},'raw':!![]});})[_0xed61('0x9')](function(_0xfd8844){_0x376e19[_0xed61('0xa')]('unreadMessages',_0xfd8844['length']);WhatsappInteractionEvents['emit'](_0x152e2d+':'+_0x376e19['id'],_0x376e19);WhatsappInteractionEvents[_0xed61('0xb')](_0x152e2d,_0x376e19);_0x39e7f8(null);})[_0xed61('0xc')](_0x39e7f8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 0695ff5..e499f05 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 _0x7341=['lodash','api','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0x7341,0x1d1));var _0x1734=function(_0x1e82c2,_0x870e1b){_0x1e82c2=_0x1e82c2-0x0;var _0x4033ac=_0x7341[_0x1e82c2];return _0x4033ac;};'use strict';var _=require(_0x1734('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1734('0x1'));var moment=require('moment');var BPromise=require(_0x1734('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1734('0x3'));var rimraf=require(_0x1734('0x4'));var config=require(_0x1734('0x5'));var attributes=require(_0x1734('0x6'));module[_0x1734('0x7')]=function(_0x52ebe3,_0x47a7cf){return _0x52ebe3['define'](_0x1734('0x8'),attributes,{'tableName':_0x1734('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2520ac,_0x5e357b,_0x3dea13){if(_0x2520ac[_0x1734('0xa')](_0x1734('0xb'))){_0x2520ac[_0x1734('0xc')]=moment()[_0x1734('0xd')](_0x1734('0xe'));}_0x3dea13(null,_0x2520ac);}}});}; \ No newline at end of file +var _0xb3c1=['format','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','WhatsappInteraction','whatsapp_interactions','closed'];(function(_0x18d241,_0x51af73){var _0x201259=function(_0x2523f7){while(--_0x2523f7){_0x18d241['push'](_0x18d241['shift']());}};_0x201259(++_0x51af73);}(_0xb3c1,0xc5));var _0x1b3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3c1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1b3c('0x0'));var util=require(_0x1b3c('0x1'));var logger=require(_0x1b3c('0x2'))('api');var moment=require(_0x1b3c('0x3'));var BPromise=require(_0x1b3c('0x4'));var rp=require(_0x1b3c('0x5'));var fs=require('fs');var path=require(_0x1b3c('0x6'));var rimraf=require(_0x1b3c('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x1b3c('0x8')]=function(_0x3bb2c8,_0x51fd55){return _0x3bb2c8[_0x1b3c('0x9')](_0x1b3c('0xa'),attributes,{'tableName':_0x1b3c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x11c882,_0x1d3c0f,_0x2cd715){if(_0x11c882['changed'](_0x1b3c('0xc'))){_0x11c882['closedAt']=moment()[_0x1b3c('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2cd715(null,_0x11c882);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index bdaef7f..c8ffc63 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 _0x0041=['omit','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','limit','catch','AddTagsToWhatsappInteraction','find','addTags','ids'];(function(_0x598152,_0x4230ac){var _0x71af95=function(_0x59f1da){while(--_0x59f1da){_0x598152['push'](_0x598152['shift']());}};_0x71af95(++_0x4230ac);}(_0x0041,0x1a6));var _0x1004=function(_0x255ba1,_0x4e9c8b){_0x255ba1=_0x255ba1-0x0;var _0x2c3437=_0x0041[_0x255ba1];return _0x2c3437;};'use strict';var _=require(_0x1004('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1004('0x1'));var rs=require(_0x1004('0x2'));var fs=require('fs');var Redis=require(_0x1004('0x3'));var db=require(_0x1004('0x4'))['db'];var utils=require(_0x1004('0x5'));var logger=require(_0x1004('0x6'))(_0x1004('0x7'));var config=require(_0x1004('0x8'));var jayson=require(_0x1004('0x9'));var client=jayson[_0x1004('0xa')][_0x1004('0xb')]({'port':0x232a});config[_0x1004('0xc')]=_[_0x1004('0xd')](config['redis'],{'host':_0x1004('0xe'),'port':0x18eb});var socket=require(_0x1004('0xf'))(new Redis(config['redis']));require(_0x1004('0x10'))['register'](socket);function respondWithRpcPromise(_0x5c4f87,_0x55977e,_0x13d769){return new BPromise(function(_0x2aed4b,_0x5cf30a){return client[_0x1004('0x11')](_0x5c4f87,_0x13d769)[_0x1004('0x12')](function(_0x2d3551){logger[_0x1004('0x13')](_0x1004('0x14'),_0x55977e,_0x1004('0x15'));logger[_0x1004('0x16')](_0x1004('0x17'),_0x55977e,'request\x20sent',JSON[_0x1004('0x18')](_0x2d3551));if(_0x2d3551[_0x1004('0x19')]){if(_0x2d3551[_0x1004('0x19')][_0x1004('0x1a')]===0x1f4){logger[_0x1004('0x19')](_0x1004('0x14'),_0x55977e,_0x2d3551[_0x1004('0x19')][_0x1004('0x1b')]);return _0x5cf30a(_0x2d3551[_0x1004('0x19')][_0x1004('0x1b')]);}logger[_0x1004('0x19')](_0x1004('0x14'),_0x55977e,_0x2d3551['error'][_0x1004('0x1b')]);return _0x2aed4b(_0x2d3551[_0x1004('0x19')]['message']);}else{logger['info'](_0x1004('0x14'),_0x55977e,_0x1004('0x15'));_0x2aed4b(_0x2d3551['result']['message']);}})['catch'](function(_0x191e33){logger['error'](_0x1004('0x14'),_0x55977e,_0x191e33);_0x5cf30a(_0x191e33);});});}exports[_0x1004('0x1c')]=function(_0x364be7){var _0x2c294e=this;return new Promise(function(_0x130226,_0x3d28b1){return db[_0x1004('0x1d')][_0x1004('0x1e')](_0x364be7[_0x1004('0x1f')],{'raw':_0x364be7[_0x1004('0x20')]?_0x364be7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x364be7[_0x1004('0x20')]?_0x364be7['options'][_0x1004('0x21')]||null:null,'attributes':_0x364be7['options']?_0x364be7[_0x1004('0x20')]['attributes']||null:null,'limit':_0x364be7['options']?_0x364be7[_0x1004('0x20')][_0x1004('0x22')]||null:null})[_0x1004('0x12')](function(_0x18b377){logger[_0x1004('0x13')](_0x1004('0x1c'),_0x364be7);logger[_0x1004('0x16')]('UpdateWhatsappInteraction',_0x364be7,JSON[_0x1004('0x18')](_0x18b377));_0x130226(_0x18b377);})[_0x1004('0x23')](function(_0x417a84){logger[_0x1004('0x19')](_0x1004('0x1c'),_0x417a84[_0x1004('0x1b')],_0x364be7);_0x3d28b1(_0x2c294e['error'](0x1f4,_0x417a84[_0x1004('0x1b')]));});});};exports[_0x1004('0x24')]=function(_0x484f2b){return new Promise(function(_0x4cbac4,_0xec3aa5){return db[_0x1004('0x1d')][_0x1004('0x25')]({'where':_0x484f2b[_0x1004('0x20')]?_0x484f2b[_0x1004('0x20')]['where']||null:null})[_0x1004('0x12')](function(_0xc5a002){if(_0xc5a002){return _0xc5a002[_0x1004('0x26')](_0x484f2b[_0x1004('0x1f')][_0x1004('0x27')],_[_0x1004('0x28')](_0x484f2b[_0x1004('0x1f')],[_0x1004('0x27'),'id'])||{});}})['spread'](function(_0x1d0e63){logger[_0x1004('0x13')](_0x1004('0x29'),_0x484f2b);logger[_0x1004('0x16')](_0x1004('0x29'),_0x484f2b,JSON[_0x1004('0x18')](_0x1d0e63));_0x4cbac4(_0x1d0e63);})[_0x1004('0x23')](function(_0x2f6164){logger[_0x1004('0x19')]('AddTags',_0x2f6164[_0x1004('0x1b')],_0x484f2b);_0xec3aa5(_this[_0x1004('0x19')](0x1f4,_0x2f6164[_0x1004('0x1b')]));});});}; \ No newline at end of file +var _0xed84=['client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','raw','options','where','attributes','limit','then','addTags','ids','spread','AddTags','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed84,0x1b1));var _0x4ed8=function(_0x404b7b,_0x1d4662){_0x404b7b=_0x404b7b-0x0;var _0xa8205=_0xed84[_0x404b7b];return _0xa8205;};'use strict';var _=require('lodash');var util=require(_0x4ed8('0x0'));var moment=require(_0x4ed8('0x1'));var BPromise=require(_0x4ed8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ed8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ed8('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4ed8('0x5'));var jayson=require(_0x4ed8('0x6'));var client=jayson[_0x4ed8('0x7')][_0x4ed8('0x8')]({'port':0x232a});config[_0x4ed8('0x9')]=_[_0x4ed8('0xa')](config[_0x4ed8('0x9')],{'host':_0x4ed8('0xb'),'port':0x18eb});var socket=require(_0x4ed8('0xc'))(new Redis(config[_0x4ed8('0x9')]));require(_0x4ed8('0xd'))['register'](socket);function respondWithRpcPromise(_0x49014e,_0x62887d,_0x8a84fc){return new BPromise(function(_0x151a43,_0x40b1d2){return client[_0x4ed8('0xe')](_0x49014e,_0x8a84fc)['then'](function(_0x3071c0){logger['info'](_0x4ed8('0xf'),_0x62887d,_0x4ed8('0x10'));logger[_0x4ed8('0x11')](_0x4ed8('0x12'),_0x62887d,_0x4ed8('0x10'),JSON[_0x4ed8('0x13')](_0x3071c0));if(_0x3071c0[_0x4ed8('0x14')]){if(_0x3071c0[_0x4ed8('0x14')][_0x4ed8('0x15')]===0x1f4){logger['error'](_0x4ed8('0xf'),_0x62887d,_0x3071c0[_0x4ed8('0x14')]['message']);return _0x40b1d2(_0x3071c0[_0x4ed8('0x14')][_0x4ed8('0x16')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x62887d,_0x3071c0['error'][_0x4ed8('0x16')]);return _0x151a43(_0x3071c0[_0x4ed8('0x14')]['message']);}else{logger[_0x4ed8('0x17')](_0x4ed8('0xf'),_0x62887d,_0x4ed8('0x10'));_0x151a43(_0x3071c0[_0x4ed8('0x18')][_0x4ed8('0x16')]);}})[_0x4ed8('0x19')](function(_0x163afb){logger[_0x4ed8('0x14')](_0x4ed8('0xf'),_0x62887d,_0x163afb);_0x40b1d2(_0x163afb);});});}exports[_0x4ed8('0x1a')]=function(_0xa7884b){var _0x171bce=this;return new Promise(function(_0x35a586,_0x175bd0){return db[_0x4ed8('0x1b')][_0x4ed8('0x1c')](_0xa7884b[_0x4ed8('0x1d')],{'raw':_0xa7884b['options']?_0xa7884b['options'][_0x4ed8('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa7884b[_0x4ed8('0x1f')]?_0xa7884b[_0x4ed8('0x1f')][_0x4ed8('0x20')]||null:null,'attributes':_0xa7884b[_0x4ed8('0x1f')]?_0xa7884b[_0x4ed8('0x1f')][_0x4ed8('0x21')]||null:null,'limit':_0xa7884b[_0x4ed8('0x1f')]?_0xa7884b[_0x4ed8('0x1f')][_0x4ed8('0x22')]||null:null})[_0x4ed8('0x23')](function(_0x128663){logger[_0x4ed8('0x17')](_0x4ed8('0x1a'),_0xa7884b);logger[_0x4ed8('0x11')](_0x4ed8('0x1a'),_0xa7884b,JSON[_0x4ed8('0x13')](_0x128663));_0x35a586(_0x128663);})['catch'](function(_0x2b3221){logger[_0x4ed8('0x14')]('UpdateWhatsappInteraction',_0x2b3221[_0x4ed8('0x16')],_0xa7884b);_0x175bd0(_0x171bce[_0x4ed8('0x14')](0x1f4,_0x2b3221['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x3342a8){return new Promise(function(_0xf53921,_0x46036a){return db['WhatsappInteraction']['find']({'where':_0x3342a8['options']?_0x3342a8['options'][_0x4ed8('0x20')]||null:null})[_0x4ed8('0x23')](function(_0x50b097){if(_0x50b097){return _0x50b097[_0x4ed8('0x24')](_0x3342a8[_0x4ed8('0x1d')][_0x4ed8('0x25')],_['omit'](_0x3342a8['body'],[_0x4ed8('0x25'),'id'])||{});}})[_0x4ed8('0x26')](function(_0x7f9400){logger[_0x4ed8('0x17')](_0x4ed8('0x27'),_0x3342a8);logger[_0x4ed8('0x11')](_0x4ed8('0x27'),_0x3342a8,JSON[_0x4ed8('0x13')](_0x7f9400));_0xf53921(_0x7f9400);})[_0x4ed8('0x19')](function(_0x516a9b){logger[_0x4ed8('0x14')]('AddTags',_0x516a9b[_0x4ed8('0x16')],_0x3342a8);_0x46036a(_this[_0x4ed8('0x14')](0x1f4,_0x516a9b[_0x4ed8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 002fe82..f16f5de 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 _0xae3c=['whatsappInteraction:','./whatsappInteraction.events','remove','emit','removeListener','register'];(function(_0x5e8b31,_0x177999){var _0x453957=function(_0x417ccb){while(--_0x417ccb){_0x5e8b31['push'](_0x5e8b31['shift']());}};_0x453957(++_0x177999);}(_0xae3c,0x18d));var _0xcae3=function(_0x4c98b9,_0x1ad11b){_0x4c98b9=_0x4c98b9-0x0;var _0x3a257a=_0xae3c[_0x4c98b9];return _0x3a257a;};'use strict';var WhatsappInteractionEvents=require(_0xcae3('0x0'));var events=['save',_0xcae3('0x1'),'update'];function createListener(_0x2cc997,_0x668e26){return function(_0x371eb2){_0x668e26[_0xcae3('0x2')](_0x2cc997,_0x371eb2);};}function removeListener(_0x2f5455,_0x302a5d){return function(){WhatsappInteractionEvents[_0xcae3('0x3')](_0x2f5455,_0x302a5d);};}exports[_0xcae3('0x4')]=function(_0x49af7f){for(var _0x491814=0x0,_0x290a2f=events['length'];_0x491814<_0x290a2f;_0x491814++){var _0x489455=events[_0x491814];var _0x49d3b8=createListener(_0xcae3('0x5')+_0x489455,_0x49af7f);WhatsappInteractionEvents['on'](_0x489455,_0x49d3b8);}}; \ No newline at end of file +var _0xe045=['./whatsappInteraction.events','update','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x239193,_0x1585ef){var _0x4f51c3=function(_0x8eba2c){while(--_0x8eba2c){_0x239193['push'](_0x239193['shift']());}};_0x4f51c3(++_0x1585ef);}(_0xe045,0x1b2));var _0x5e04=function(_0x353026,_0x3247d9){_0x353026=_0x353026-0x0;var _0x694a1c=_0xe045[_0x353026];return _0x694a1c;};'use strict';var WhatsappInteractionEvents=require(_0x5e04('0x0'));var events=['save','remove',_0x5e04('0x1')];function createListener(_0x2101db,_0x676e41){return function(_0x40cf14){_0x676e41[_0x5e04('0x2')](_0x2101db,_0x40cf14);};}function removeListener(_0x45317a,_0x390ff9){return function(){WhatsappInteractionEvents[_0x5e04('0x3')](_0x45317a,_0x390ff9);};}exports[_0x5e04('0x4')]=function(_0x30b19e){for(var _0x29d26a=0x0,_0x462679=events[_0x5e04('0x5')];_0x29d26a<_0x462679;_0x29d26a++){var _0x14e608=events[_0x29d26a];var _0x3aa7d9=createListener(_0x5e04('0x6')+_0x14e608,_0x30b19e);WhatsappInteractionEvents['on'](_0x14e608,_0x3aa7d9);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 7c969fa..3ba167c 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 _0x0222=['get','/describe','isAuthenticated','describe','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','accept','/:id/reject','reject','/:id','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','index'];(function(_0x238210,_0x221e48){var _0x1a0430=function(_0x20d299){while(--_0x20d299){_0x238210['push'](_0x238210['shift']());}};_0x1a0430(++_0x221e48);}(_0x0222,0x12c));var _0x2022=function(_0x10e12a,_0x42b0e8){_0x10e12a=_0x10e12a-0x0;var _0x77ddcd=_0x0222[_0x10e12a];return _0x77ddcd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2022('0x0'));var timeout=require('connect-timeout');var express=require(_0x2022('0x1'));var router=express[_0x2022('0x2')]();var fs_extra=require(_0x2022('0x3'));var auth=require(_0x2022('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2022('0x5'));var controller=require(_0x2022('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x2022('0x7')]);router[_0x2022('0x8')](_0x2022('0x9'),auth[_0x2022('0xa')](),controller[_0x2022('0xb')]);router[_0x2022('0x8')]('/:id',auth[_0x2022('0xa')](),controller[_0x2022('0xc')]);router[_0x2022('0xd')]('/',auth['isAuthenticated'](),interaction[_0x2022('0xe')](_0x2022('0xf'),_0x2022('0x10')),controller[_0x2022('0x11')]);router[_0x2022('0xd')](_0x2022('0x12'),controller[_0x2022('0x13')]);router[_0x2022('0x14')]('/:id',auth[_0x2022('0xa')](),controller[_0x2022('0x15')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x2022('0x16')]);router[_0x2022('0x14')](_0x2022('0x17'),auth[_0x2022('0xa')](),controller[_0x2022('0x18')]);router['delete'](_0x2022('0x19'),auth[_0x2022('0xa')](),controller[_0x2022('0x1a')]);module[_0x2022('0x1b')]=router; \ No newline at end of file +var _0x5fd5=['create','/:id/status','put','/:id/accept','/:id/reject','reject','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create'];(function(_0x158161,_0x7d0e15){var _0x2a1579=function(_0x4766fe){while(--_0x4766fe){_0x158161['push'](_0x158161['shift']());}};_0x2a1579(++_0x7d0e15);}(_0x5fd5,0xd7));var _0x55fd=function(_0x1ba40c,_0x4d8113){_0x1ba40c=_0x1ba40c-0x0;var _0x2dffa8=_0x5fd5[_0x1ba40c];return _0x2dffa8;};'use strict';var multer=require('multer');var util=require(_0x55fd('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x55fd('0x1'));var router=express[_0x55fd('0x2')]();var fs_extra=require(_0x55fd('0x3'));var auth=require(_0x55fd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x55fd('0x5'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0x55fd('0x6')](),controller['index']);router[_0x55fd('0x7')]('/describe',auth[_0x55fd('0x6')](),controller[_0x55fd('0x8')]);router[_0x55fd('0x7')](_0x55fd('0x9'),auth[_0x55fd('0x6')](),controller[_0x55fd('0xa')]);router[_0x55fd('0xb')]('/',auth[_0x55fd('0x6')](),interaction[_0x55fd('0xc')](_0x55fd('0xd'),_0x55fd('0xe')),controller[_0x55fd('0xf')]);router[_0x55fd('0xb')](_0x55fd('0x10'),controller['status']);router[_0x55fd('0x11')](_0x55fd('0x9'),auth[_0x55fd('0x6')](),controller['update']);router[_0x55fd('0x11')](_0x55fd('0x12'),auth[_0x55fd('0x6')](),controller['accept']);router[_0x55fd('0x11')](_0x55fd('0x13'),auth['isAuthenticated'](),controller[_0x55fd('0x14')]);router[_0x55fd('0x15')](_0x55fd('0x9'),auth[_0x55fd('0x6')](),controller['destroy']);module[_0x55fd('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index bf68ffe..6c50567 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 _0x5fcb=['DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5fcb,0x141));var _0xb5fc=function(_0x43dc4f,_0x14beab){_0x43dc4f=_0x43dc4f-0x0;var _0x31c2e2=_0x5fcb[_0x43dc4f];return _0x31c2e2;};'use strict';var Sequelize=require(_0xb5fc('0x0'));module[_0xb5fc('0x1')]={'body':{'type':Sequelize[_0xb5fc('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb5fc('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb5fc('0x4')]('in',_0xb5fc('0x5')),'defaultValue':_0xb5fc('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb5fc('0x6')](0xbe)},'phone':{'type':Sequelize[_0xb5fc('0x6')]},'readAt':{'type':Sequelize[_0xb5fc('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb5fc('0x6')]},'providerResponse':{'type':Sequelize[_0xb5fc('0x2')]}}; \ No newline at end of file +var _0x6726=['STRING','DATE','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x46c4bd,_0x269459){var _0x32a4f1=function(_0x58ac06){while(--_0x58ac06){_0x46c4bd['push'](_0x46c4bd['shift']());}};_0x32a4f1(++_0x269459);}(_0x6726,0xdb));var _0x6672=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0x6726[_0x11e30d];return _0x2d4e29;};'use strict';var Sequelize=require('sequelize');module[_0x6672('0x0')]={'body':{'type':Sequelize[_0x6672('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x6672('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6672('0x3')]('in','out'),'defaultValue':_0x6672('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x6672('0x5')]},'readAt':{'type':Sequelize[_0x6672('0x6')]},'secret':{'type':Sequelize[_0x6672('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6672('0x5')]},'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 19fe1ac..845e9d3 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 _0xa60a=['event','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','SELECT','interface','motionChannel','reject','rejectmessage','WhatsappAccount','debug','received\x20delivery\x20report\x20from','messageId','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','eml-format','rimraf','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','show','params','find','catch','create','body','describe','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','WhatsappInteractionId','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','email','internal','SIP/%s','user','channel'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xa60a,0x1b2));var _0xaa60=function(_0x143be9,_0x5aa1f1){_0x143be9=_0x143be9-0x0;var _0x9e536=_0xa60a[_0x143be9];return _0x9e536;};'use strict';var emlformat=require(_0xaa60('0x0'));var rimraf=require(_0xaa60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa60('0x2'));var rp=require('request-promise');var moment=require(_0xaa60('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaa60('0x4'));var path=require(_0xaa60('0x5'));var sox=require(_0xaa60('0x6'));var csv=require(_0xaa60('0x7'));var ejs=require(_0xaa60('0x8'));var fs=require('fs');var fs_extra=require(_0xaa60('0x9'));var _=require(_0xaa60('0xa'));var squel=require('squel');var crypto=require(_0xaa60('0xb'));var jsforce=require(_0xaa60('0xc'));var deskjs=require(_0xaa60('0xd'));var toCsv=require(_0xaa60('0x7'));var querystring=require(_0xaa60('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaa60('0xf'));var qs=require(_0xaa60('0x10'));var as=require(_0xaa60('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa60('0x12'))(_0xaa60('0x13'));var utils=require('../../config/utils');var config=require(_0xaa60('0x14'));var licenseUtil=require(_0xaa60('0x15'));var db=require(_0xaa60('0x16'))['db'];config[_0xaa60('0x17')]=_['defaults'](config[_0xaa60('0x17')],{'host':_0xaa60('0x18'),'port':0x18eb});var socket=require(_0xaa60('0x19'))(new Redis(config['redis']));require(_0xaa60('0x1a'))[_0xaa60('0x1b')](socket);var jayson=require(_0xaa60('0x1c'));var client=jayson[_0xaa60('0x1d')][_0xaa60('0x1e')]({'port':0x232c});var client9002=jayson[_0xaa60('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd2eeae,_0x3cdb6c,_0x2a8a72,_0x57a9fc){return new BPromise(function(_0x5cc759,_0xc5b21f){var _0x228b7c=_0x57a9fc||client;return _0x228b7c[_0xaa60('0x1f')](_0xd2eeae,_0x2a8a72)['then'](function(_0x465528){logger[_0xaa60('0x20')](_0xaa60('0x21'),_0x3cdb6c,_0xaa60('0x22'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3cdb6c,_0xaa60('0x22'),JSON['stringify'](_0x465528));if(_0x465528[_0xaa60('0x23')]){if(_0x465528[_0xaa60('0x23')][_0xaa60('0x24')]===0x1f4){logger[_0xaa60('0x23')](_0xaa60('0x21'),_0x3cdb6c,_0x465528[_0xaa60('0x23')][_0xaa60('0x25')]);return _0xc5b21f(_0x465528['error'][_0xaa60('0x25')]);}logger[_0xaa60('0x23')](_0xaa60('0x21'),_0x3cdb6c,_0x465528[_0xaa60('0x23')][_0xaa60('0x25')]);return _0x5cc759(_0x465528[_0xaa60('0x23')]['message']);}else{logger['info'](_0xaa60('0x21'),_0x3cdb6c,_0xaa60('0x22'));_0x5cc759(_0x465528[_0xaa60('0x26')][_0xaa60('0x25')]);}})['catch'](function(_0x4e2fab){logger[_0xaa60('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x3cdb6c,_0x4e2fab);_0xc5b21f(_0x4e2fab);});});}function respondWithStatusCode(_0x22f1ee,_0x59c3a5){_0x59c3a5=_0x59c3a5||0xcc;return function(_0x53e188){if(_0x53e188){return _0x22f1ee[_0xaa60('0x27')](_0x59c3a5);}return _0x22f1ee[_0xaa60('0x28')](_0x59c3a5)[_0xaa60('0x29')]();};}function respondWithResult(_0x42e838,_0x4bdabe){_0x4bdabe=_0x4bdabe||0xc8;return function(_0x3af1d0){if(_0x3af1d0){return _0x42e838[_0xaa60('0x28')](_0x4bdabe)[_0xaa60('0x2a')](_0x3af1d0);}};}function respondWithFilteredResult(_0x54f56c,_0x381693){return function(_0x2a9450){if(_0x2a9450){var _0x1be0a7=typeof _0x381693[_0xaa60('0x2b')]==='undefined'&&typeof _0x381693['limit']===_0xaa60('0x2c');var _0x4f92a4=_0x2a9450[_0xaa60('0x2d')];var _0x46a58b=_0x1be0a7?0x0:_0x381693[_0xaa60('0x2b')];var _0x17c4b4=_0x1be0a7?_0x2a9450[_0xaa60('0x2d')]:_0x381693[_0xaa60('0x2b')]+_0x381693[_0xaa60('0x2e')];var _0x10342c;if(_0x17c4b4>=_0x4f92a4){_0x17c4b4=_0x4f92a4;_0x10342c=0xc8;}else{_0x10342c=0xce;}_0x54f56c['status'](_0x10342c);return _0x54f56c[_0xaa60('0x2f')](_0xaa60('0x30'),_0x46a58b+'-'+_0x17c4b4+'/'+_0x4f92a4)[_0xaa60('0x2a')](_0x2a9450);}return null;};}function patchUpdates(_0x548a71){return function(_0x5d34a0){try{jsonpatch[_0xaa60('0x31')](_0x5d34a0,_0x548a71,!![]);}catch(_0x11944c){return BPromise['reject'](_0x11944c);}return _0x5d34a0[_0xaa60('0x32')]();};}function saveUpdates(_0x9e1397,_0x113e24){return function(_0x511bb4){if(_0x511bb4){return _0x511bb4[_0xaa60('0x33')](_0x9e1397)[_0xaa60('0x34')](function(_0x4abc8a){return _0x4abc8a;});}return null;};}function removeEntity(_0x1bdc34,_0x1f208c){return function(_0x4ee660){if(_0x4ee660){return _0x4ee660['destroy']()['then'](function(){_0x1bdc34[_0xaa60('0x28')](0xcc)[_0xaa60('0x29')]();});}};}function handleEntityNotFound(_0x1e1cad,_0x2fd413){return function(_0x545604){if(!_0x545604){_0x1e1cad[_0xaa60('0x27')](0x194);}return _0x545604;};}function handleError(_0x59c886,_0x7bb899){_0x7bb899=_0x7bb899||0x1f4;return function(_0x3a4ed5){logger[_0xaa60('0x23')](_0x3a4ed5[_0xaa60('0x35')]);if(_0x3a4ed5[_0xaa60('0x36')]){delete _0x3a4ed5[_0xaa60('0x36')];}_0x59c886[_0xaa60('0x28')](_0x7bb899)[_0xaa60('0x37')](_0x3a4ed5);};}exports['index']=function(_0x18af36,_0x580b36){var _0x184fac={},_0x1ca4c={},_0x5b9ba0={'count':0x0,'rows':[]};var _0x597df2=_[_0xaa60('0x38')](db[_0xaa60('0x39')][_0xaa60('0x3a')],function(_0x454613){return{'name':_0x454613[_0xaa60('0x3b')],'type':_0x454613['type'][_0xaa60('0x3c')]};});_0x1ca4c['model']=_[_0xaa60('0x38')](_0x597df2,_0xaa60('0x36'));_0x1ca4c[_0xaa60('0x3d')]=_[_0xaa60('0x3e')](_0x18af36[_0xaa60('0x3d')]);_0x1ca4c[_0xaa60('0x3f')]=_[_0xaa60('0x40')](_0x1ca4c[_0xaa60('0x41')],_0x1ca4c[_0xaa60('0x3d')]);_0x184fac[_0xaa60('0x42')]=_[_0xaa60('0x40')](_0x1ca4c['model'],qs[_0xaa60('0x43')](_0x18af36[_0xaa60('0x3d')]['fields']));_0x184fac['attributes']=_0x184fac[_0xaa60('0x42')][_0xaa60('0x44')]?_0x184fac['attributes']:_0x1ca4c[_0xaa60('0x41')];if(!_0x18af36['query'][_0xaa60('0x45')](_0xaa60('0x46'))){_0x184fac[_0xaa60('0x2e')]=qs['limit'](_0x18af36[_0xaa60('0x3d')][_0xaa60('0x2e')]);_0x184fac[_0xaa60('0x2b')]=qs[_0xaa60('0x2b')](_0x18af36[_0xaa60('0x3d')][_0xaa60('0x2b')]);}_0x184fac['order']=qs[_0xaa60('0x47')](_0x18af36[_0xaa60('0x3d')]['sort']);_0x184fac[_0xaa60('0x48')]=qs['filters'](_[_0xaa60('0x49')](_0x18af36[_0xaa60('0x3d')],_0x1ca4c[_0xaa60('0x3f')]),_0x597df2);if(_0x18af36[_0xaa60('0x3d')]['filter']){_0x184fac[_0xaa60('0x48')]=_[_0xaa60('0x4a')](_0x184fac['where'],{'$or':_[_0xaa60('0x38')](_0x597df2,function(_0x2352d0){if(_0x2352d0[_0xaa60('0x4b')]!==_0xaa60('0x4c')){var _0x4e017c={};_0x4e017c[_0x2352d0[_0xaa60('0x36')]]={'$like':'%'+_0x18af36[_0xaa60('0x3d')][_0xaa60('0x4d')]+'%'};return _0x4e017c;}})});}_0x184fac=_[_0xaa60('0x4a')]({},_0x184fac,_0x18af36[_0xaa60('0x4e')]);var _0x537468={'where':_0x184fac[_0xaa60('0x48')]};return db[_0xaa60('0x39')][_0xaa60('0x2d')](_0x537468)[_0xaa60('0x34')](function(_0x46a06f){_0x5b9ba0['count']=_0x46a06f;if(_0x18af36[_0xaa60('0x3d')][_0xaa60('0x4f')]){_0x184fac[_0xaa60('0x50')]=[{'all':!![]}];}return db[_0xaa60('0x39')]['findAll'](_0x184fac);})[_0xaa60('0x34')](function(_0x69ea5d){_0x5b9ba0[_0xaa60('0x51')]=_0x69ea5d;return _0x5b9ba0;})[_0xaa60('0x34')](respondWithFilteredResult(_0x580b36,_0x184fac))['catch'](handleError(_0x580b36,null));};exports[_0xaa60('0x52')]=function(_0x475246,_0x41c765){var _0xde64b2={'raw':!![],'where':{'id':_0x475246[_0xaa60('0x53')]['id']}},_0x51777f={};_0x51777f[_0xaa60('0x41')]=_[_0xaa60('0x3e')](db[_0xaa60('0x39')]['rawAttributes']);_0x51777f['query']=_['keys'](_0x475246[_0xaa60('0x3d')]);_0x51777f[_0xaa60('0x3f')]=_['intersection'](_0x51777f[_0xaa60('0x41')],_0x51777f[_0xaa60('0x3d')]);_0xde64b2[_0xaa60('0x42')]=_['intersection'](_0x51777f[_0xaa60('0x41')],qs['fields'](_0x475246[_0xaa60('0x3d')][_0xaa60('0x43')]));_0xde64b2[_0xaa60('0x42')]=_0xde64b2[_0xaa60('0x42')][_0xaa60('0x44')]?_0xde64b2[_0xaa60('0x42')]:_0x51777f['model'];if(_0x475246['query']['includeAll']){_0xde64b2[_0xaa60('0x50')]=[{'all':!![]}];}_0xde64b2=_[_0xaa60('0x4a')]({},_0xde64b2,_0x475246[_0xaa60('0x4e')]);return db[_0xaa60('0x39')][_0xaa60('0x54')](_0xde64b2)['then'](handleEntityNotFound(_0x41c765,null))['then'](respondWithResult(_0x41c765,null))[_0xaa60('0x55')](handleError(_0x41c765,null));};exports[_0xaa60('0x56')]=function(_0x436bb2,_0x43f1a3){return db['WhatsappMessage'][_0xaa60('0x56')](_0x436bb2[_0xaa60('0x57')],{})[_0xaa60('0x34')](respondWithResult(_0x43f1a3,0xc9))[_0xaa60('0x55')](handleError(_0x43f1a3,null));};exports[_0xaa60('0x33')]=function(_0x780231,_0x2bcb3a){if(_0x780231[_0xaa60('0x57')]['id']){delete _0x780231[_0xaa60('0x57')]['id'];}return db['WhatsappMessage'][_0xaa60('0x54')]({'where':{'id':_0x780231[_0xaa60('0x53')]['id']}})[_0xaa60('0x34')](handleEntityNotFound(_0x2bcb3a,null))[_0xaa60('0x34')](saveUpdates(_0x780231[_0xaa60('0x57')],null))[_0xaa60('0x34')](respondWithResult(_0x2bcb3a,null))['catch'](handleError(_0x2bcb3a,null));};exports['destroy']=function(_0x3a1d31,_0x2fc4f7){return db[_0xaa60('0x39')][_0xaa60('0x54')]({'where':{'id':_0x3a1d31[_0xaa60('0x53')]['id']}})[_0xaa60('0x34')](handleEntityNotFound(_0x2fc4f7,null))[_0xaa60('0x34')](removeEntity(_0x2fc4f7,null))[_0xaa60('0x55')](handleError(_0x2fc4f7,null));};exports[_0xaa60('0x58')]=function(_0x266f5b,_0x5e3468){return db['WhatsappMessage'][_0xaa60('0x58')]()[_0xaa60('0x34')](respondWithResult(_0x5e3468,null))[_0xaa60('0x55')](handleError(_0x5e3468,null));};var interaction_log=require(_0xaa60('0x12'))(_0xaa60('0x59'));exports[_0xaa60('0x5a')]=function(_0x40d44f,_0x3d572d,_0xde4e8){var _0x3a3c20={'agent':{},'channel':'whatsapp'};if(_0x40d44f[_0xaa60('0x57')]['id']){delete _0x40d44f[_0xaa60('0x57')]['id'];}_0x40d44f[_0xaa60('0x57')][_0xaa60('0x5b')]=!![];_0x40d44f[_0xaa60('0x57')][_0xaa60('0x5c')]=moment()[_0xaa60('0x5d')](_0xaa60('0x5e'));_0x40d44f[_0xaa60('0x57')][_0xaa60('0x5f')]=_0x40d44f[_0xaa60('0x57')][_0xaa60('0x5f')]||_0x40d44f['user']['id'];_0x3a3c20['agent']['id']=_0x40d44f['body'][_0xaa60('0x5f')];return db[_0xaa60('0x39')]['find']({'where':{'id':_0x40d44f[_0xaa60('0x53')]['id'],'UserId':null}})[_0xaa60('0x34')](handleEntityNotFound(_0x3d572d,null))[_0xaa60('0x34')](saveUpdates(_0x40d44f[_0xaa60('0x57')],null))[_0xaa60('0x34')](function(_0x1ebfa9){if(_0x1ebfa9){_0x3a3c20[_0xaa60('0x25')]=_0x1ebfa9[_0xaa60('0x60')]({'plain':!![]});return db['WhatsappInteraction'][_0xaa60('0x54')]({'where':{'id':_0x1ebfa9[_0xaa60('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x3d572d,null))[_0xaa60('0x34')](function(_0x1d68de){if(_0x1d68de){return _0x1d68de[_0xaa60('0x33')]({'UserId':_0x40d44f[_0xaa60('0x57')][_0xaa60('0x5f')],'read1stAt':_['isNil'](_0x1d68de[_0xaa60('0x62')])?moment()['format'](_0xaa60('0x5e')):undefined});}return null;})[_0xaa60('0x34')](function(_0x36dc48){if(_0x36dc48){_0x3a3c20[_0xaa60('0x63')]=_0x36dc48['get']({'plain':!![]});interaction_log[_0xaa60('0x20')](_0xaa60('0x64'),_0x40d44f['user']['id'],_0x40d44f['user']['name'],_0x40d44f['user'][_0xaa60('0x65')],_0x3a3c20[_0xaa60('0x63')]['id'],_0x40d44f[_0xaa60('0x57')]?JSON['stringify'](_0x40d44f[_0xaa60('0x57')]):_0xaa60('0x66'));return respondWithRpcPromise(_0xaa60('0x67'),'acceptMessage',_0x3a3c20);}return null;})['then'](function(_0x1a80a4){var _0x455034=_0xaa60('0x68')+_0x1a80a4[_0xaa60('0x25')][_0xaa60('0x69')];return db[_0xaa60('0x6a')][_0xaa60('0x3d')](_0x455034,{'type':db[_0xaa60('0x6b')][_0xaa60('0x6c')]['SELECT'],'raw':!![]})[_0xaa60('0x34')](function(_0x35834f){return _0x35834f;});})[_0xaa60('0x34')](function(_0x1bab81){if(_0x1bab81){_0x3a3c20[_0xaa60('0x25')][_0xaa60('0x6d')]=_0x1bab81[0x0];if(!_0x40d44f[_0xaa60('0x57')][_0xaa60('0x5f')])return;return db[_0xaa60('0x6e')][_0xaa60('0x54')]({'where':{'id':_0x40d44f['body'][_0xaa60('0x5f')],'role':_0xaa60('0x6f')},'attributes':['id','name',_0xaa60('0x70'),_0xaa60('0x71'),_0xaa60('0x72')],'raw':!![]});}return null;})[_0xaa60('0x34')](function(_0x5b159a){if(!_0x5b159a)return null;_0x3a3c20[_0xaa60('0x25')][_0xaa60('0x6f')]=_0x5b159a;return _0x3a3c20;})[_0xaa60('0x34')](function(_0x5dc445){if(_0x5dc445){if(_0x40d44f[_0xaa60('0x57')]['manual']){_0x3a3c20[_0xaa60('0x25')]['interface']=util[_0xaa60('0x5d')](_0xaa60('0x73'),_0x40d44f[_0xaa60('0x74')]['name']);_0x3a3c20[_0xaa60('0x25')][_0xaa60('0x75')]=_0x3a3c20[_0xaa60('0x75')];_0x3a3c20['message']['motionChannel']=_0x3a3c20['channel'];_0x3a3c20['message'][_0xaa60('0x76')]=_0xaa60('0x5a');return respondWithRpcPromise(_0xaa60('0x77'),_0xaa60('0x77'),{'event':_0xaa60('0x78'),'message':_0x3a3c20[_0xaa60('0x25')]},client9002)[_0xaa60('0x34')](function(){return _0x3a3c20;});}return _0x3a3c20;}return null;})['then'](respondWithResult(_0x3d572d,null))[_0xaa60('0x55')](handleError(_0x3d572d,null));};var interaction_log=require(_0xaa60('0x12'))(_0xaa60('0x59'));exports['reject']=function(_0x2cff8e,_0x23d30d,_0x4f8b0c){var _0x194661={'agent':{},'channel':'whatsapp'};if(_0x2cff8e['body']['id']){delete _0x2cff8e[_0xaa60('0x57')]['id'];}_0x2cff8e[_0xaa60('0x57')]['UserId']=_0x2cff8e['body'][_0xaa60('0x5f')]||_0x2cff8e[_0xaa60('0x74')]['id'];_0x194661[_0xaa60('0x6f')]['id']=_0x2cff8e[_0xaa60('0x57')][_0xaa60('0x5f')];return db[_0xaa60('0x39')]['find']({'where':{'id':_0x2cff8e[_0xaa60('0x53')]['id'],'UserId':null}})[_0xaa60('0x34')](handleEntityNotFound(_0x23d30d,null))[_0xaa60('0x34')](function(_0x83d0bc){if(_0x83d0bc){_0x194661[_0xaa60('0x25')]=_0x83d0bc[_0xaa60('0x60')]({'plain':!![]});return db[_0xaa60('0x79')][_0xaa60('0x54')]({'where':{'id':_0x83d0bc[_0xaa60('0x61')]}});}return null;})[_0xaa60('0x34')](handleEntityNotFound(_0x23d30d,null))[_0xaa60('0x34')](function(_0x1b5315){if(_0x1b5315){_0x194661[_0xaa60('0x63')]=_0x1b5315[_0xaa60('0x60')]({'plain':!![]});interaction_log['info'](_0xaa60('0x7a'),_0x2cff8e[_0xaa60('0x74')]['id'],_0x2cff8e[_0xaa60('0x74')][_0xaa60('0x36')],_0x2cff8e[_0xaa60('0x74')][_0xaa60('0x65')],_0x194661[_0xaa60('0x63')]['id'],_0x2cff8e[_0xaa60('0x57')]?JSON[_0xaa60('0x7b')](_0x2cff8e['body']):'null');return respondWithRpcPromise(_0xaa60('0x7c'),_0xaa60('0x7d'),_0x194661);}return null;})[_0xaa60('0x34')](function(_0x8d8617){var _0x23c6ca=_0xaa60('0x68')+_0x8d8617[_0xaa60('0x25')]['ContactId'];return db[_0xaa60('0x6a')]['query'](_0x23c6ca,{'type':db['Sequelize'][_0xaa60('0x6c')][_0xaa60('0x7e')],'raw':!![]})[_0xaa60('0x34')](function(_0x57e241){return _0x57e241;});})[_0xaa60('0x34')](function(_0x41f729){if(_0x41f729){_0x194661[_0xaa60('0x25')]['contact']=_0x41f729[0x0];if(!_0x2cff8e[_0xaa60('0x57')][_0xaa60('0x5f')])return;return db['User'][_0xaa60('0x54')]({'where':{'id':_0x2cff8e[_0xaa60('0x57')][_0xaa60('0x5f')],'role':'agent'},'attributes':['id',_0xaa60('0x36'),_0xaa60('0x70'),_0xaa60('0x71'),'internal'],'raw':!![]});}return null;})[_0xaa60('0x34')](function(_0x4b4538){if(!_0x4b4538)return null;_0x194661[_0xaa60('0x25')][_0xaa60('0x6f')]=_0x4b4538;return _0x194661;})['then'](function(_0x448839){if(_0x448839){_0x448839[_0xaa60('0x25')][_0xaa60('0x7f')]=util[_0xaa60('0x5d')](_0xaa60('0x73'),_0x2cff8e[_0xaa60('0x74')][_0xaa60('0x36')]);_0x448839[_0xaa60('0x25')][_0xaa60('0x75')]=_0x194661['channel'];_0x448839[_0xaa60('0x25')][_0xaa60('0x80')]=_0x194661[_0xaa60('0x75')];_0x448839['message'][_0xaa60('0x76')]=_0xaa60('0x81');respondWithRpcPromise(_0xaa60('0x77'),'EventManager',{'event':_0xaa60('0x82'),'message':_0x448839[_0xaa60('0x25')]},client9002);return _0x194661;}return null;})[_0xaa60('0x34')](respondWithResult(_0x23d30d,null))[_0xaa60('0x55')](handleError(_0x23d30d,null));};exports[_0xaa60('0x28')]=function(_0x23e8b1,_0x341549,_0x50596c){if(_0x23e8b1[_0xaa60('0x57')]['id']){delete _0x23e8b1[_0xaa60('0x57')]['id'];}var _0x8defd1;return db[_0xaa60('0x39')]['find']({'where':{'id':_0x23e8b1[_0xaa60('0x53')]['id']}})[_0xaa60('0x34')](handleEntityNotFound(_0x341549,null))[_0xaa60('0x34')](function(_0x19aa7c){if(_0x19aa7c){_0x8defd1=_0x19aa7c;return db[_0xaa60('0x83')][_0xaa60('0x54')]({'where':{'id':_0x19aa7c['WhatsappAccountId']}});}})[_0xaa60('0x34')](handleEntityNotFound(_0x341549,null))['then'](function(_0x10c2db){if(_0x10c2db){logger[_0xaa60('0x84')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xaa60('0x28'),_0xaa60('0x85'),_0x10c2db[_0xaa60('0x4b')],util['inspect'](_0x23e8b1[_0xaa60('0x57')],{'showHidden':![],'depth':null}));switch(_0x10c2db[_0xaa60('0x4b')]){case'twilio':if(_0x23e8b1[_0xaa60('0x57')]['MessageSid']&&_0x23e8b1['body']['MessageSid']===_0x8defd1[_0xaa60('0x86')]&&_0x23e8b1[_0xaa60('0x57')]['MessageStatus']&&_0x23e8b1[_0xaa60('0x57')]['MessageStatus']===_0xaa60('0x5b')){return _0x8defd1[_0xaa60('0x33')]({'read':!![]});}else{logger[_0xaa60('0x23')](_0xaa60('0x87'),'status',_0xaa60('0x88'),util[_0xaa60('0x89')](_0x23e8b1[_0xaa60('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x8defd1;}})[_0xaa60('0x34')](respondWithResult(_0x341549,null))[_0xaa60('0x55')](handleError(_0x341549,null));}; \ No newline at end of file +var _0x6ad8=['redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','json','undefined','limit','count','offset','status','set','Content-Range','save','update','then','destroy','sendStatus','stack','name','send','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','WhatsappMessage','includeAll','include','findAll','params','length','find','create','body','describe','whatsapp-interactions','accept','whatsapp','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','interaction','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','channel','motionChannel','event','EventManager','acceptmessage','reject','rejectMessage','contact','fullname','SIP/%s','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x4a7513,_0x19e317){var _0x41b93a=function(_0x49f74b){while(--_0x49f74b){_0x4a7513['push'](_0x4a7513['shift']());}};_0x41b93a(++_0x19e317);}(_0x6ad8,0xf8));var _0x86ad=function(_0x1320ec,_0x2f90de){_0x1320ec=_0x1320ec-0x0;var _0x1327ac=_0x6ad8[_0x1320ec];return _0x1327ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86ad('0x0'));var zipdir=require(_0x86ad('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x86ad('0x2'));var moment=require(_0x86ad('0x3'));var BPromise=require(_0x86ad('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x86ad('0x5'));var sox=require(_0x86ad('0x6'));var csv=require(_0x86ad('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x86ad('0x8'));var _=require(_0x86ad('0x9'));var squel=require('squel');var crypto=require(_0x86ad('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x86ad('0xb'));var toCsv=require('to-csv');var querystring=require(_0x86ad('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86ad('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x86ad('0xe'));var logger=require(_0x86ad('0xf'))(_0x86ad('0x10'));var utils=require(_0x86ad('0x11'));var config=require(_0x86ad('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86ad('0x13'))['db'];config[_0x86ad('0x14')]=_[_0x86ad('0x15')](config[_0x86ad('0x14')],{'host':_0x86ad('0x16'),'port':0x18eb});var socket=require(_0x86ad('0x17'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x86ad('0x18')](socket);var jayson=require(_0x86ad('0x19'));var client=jayson[_0x86ad('0x1a')][_0x86ad('0x1b')]({'port':0x232c});var client9002=jayson[_0x86ad('0x1a')][_0x86ad('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x282d26,_0x4a5c5f,_0x365d79,_0x33f1ba){return new BPromise(function(_0x1a1e85,_0x21772e){var _0x1c969d=_0x33f1ba||client;return _0x1c969d[_0x86ad('0x1c')](_0x282d26,_0x365d79)['then'](function(_0x210216){logger[_0x86ad('0x1d')](_0x86ad('0x1e'),_0x4a5c5f,_0x86ad('0x1f'));logger['debug'](_0x86ad('0x20'),_0x4a5c5f,_0x86ad('0x1f'),JSON['stringify'](_0x210216));if(_0x210216[_0x86ad('0x21')]){if(_0x210216['error'][_0x86ad('0x22')]===0x1f4){logger[_0x86ad('0x21')](_0x86ad('0x1e'),_0x4a5c5f,_0x210216[_0x86ad('0x21')][_0x86ad('0x23')]);return _0x21772e(_0x210216[_0x86ad('0x21')][_0x86ad('0x23')]);}logger[_0x86ad('0x21')](_0x86ad('0x1e'),_0x4a5c5f,_0x210216['error'][_0x86ad('0x23')]);return _0x1a1e85(_0x210216[_0x86ad('0x21')][_0x86ad('0x23')]);}else{logger[_0x86ad('0x1d')]('WhatsappMessage,\x20%s,\x20%s',_0x4a5c5f,_0x86ad('0x1f'));_0x1a1e85(_0x210216[_0x86ad('0x24')][_0x86ad('0x23')]);}})[_0x86ad('0x25')](function(_0x45c480){logger['error'](_0x86ad('0x1e'),_0x4a5c5f,_0x45c480);_0x21772e(_0x45c480);});});}function respondWithStatusCode(_0x18714e,_0x6d16a5){_0x6d16a5=_0x6d16a5||0xcc;return function(_0x4fb309){if(_0x4fb309){return _0x18714e['sendStatus'](_0x6d16a5);}return _0x18714e['status'](_0x6d16a5)['end']();};}function respondWithResult(_0x2c3ebf,_0xfc9527){_0xfc9527=_0xfc9527||0xc8;return function(_0x36fc20){if(_0x36fc20){return _0x2c3ebf['status'](_0xfc9527)[_0x86ad('0x26')](_0x36fc20);}};}function respondWithFilteredResult(_0x2318c5,_0x2ab872){return function(_0x405b0f){if(_0x405b0f){var _0x1863aa=typeof _0x2ab872['offset']===_0x86ad('0x27')&&typeof _0x2ab872[_0x86ad('0x28')]==='undefined';var _0x3858f1=_0x405b0f[_0x86ad('0x29')];var _0x14bf7e=_0x1863aa?0x0:_0x2ab872['offset'];var _0x908a6a=_0x1863aa?_0x405b0f[_0x86ad('0x29')]:_0x2ab872[_0x86ad('0x2a')]+_0x2ab872[_0x86ad('0x28')];var _0x31adf9;if(_0x908a6a>=_0x3858f1){_0x908a6a=_0x3858f1;_0x31adf9=0xc8;}else{_0x31adf9=0xce;}_0x2318c5[_0x86ad('0x2b')](_0x31adf9);return _0x2318c5[_0x86ad('0x2c')](_0x86ad('0x2d'),_0x14bf7e+'-'+_0x908a6a+'/'+_0x3858f1)[_0x86ad('0x26')](_0x405b0f);}return null;};}function patchUpdates(_0x143a20){return function(_0x53f75f){try{jsonpatch['apply'](_0x53f75f,_0x143a20,!![]);}catch(_0x53b211){return BPromise['reject'](_0x53b211);}return _0x53f75f[_0x86ad('0x2e')]();};}function saveUpdates(_0x162163,_0x95239){return function(_0x19fc01){if(_0x19fc01){return _0x19fc01[_0x86ad('0x2f')](_0x162163)[_0x86ad('0x30')](function(_0x5b2f2a){return _0x5b2f2a;});}return null;};}function removeEntity(_0x2dac6f,_0x18e5de){return function(_0x16e991){if(_0x16e991){return _0x16e991[_0x86ad('0x31')]()[_0x86ad('0x30')](function(){_0x2dac6f[_0x86ad('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58a4bf,_0x21b5ee){return function(_0x54743a){if(!_0x54743a){_0x58a4bf[_0x86ad('0x32')](0x194);}return _0x54743a;};}function handleError(_0x15a305,_0x414ee7){_0x414ee7=_0x414ee7||0x1f4;return function(_0x1db4ee){logger['error'](_0x1db4ee[_0x86ad('0x33')]);if(_0x1db4ee['name']){delete _0x1db4ee[_0x86ad('0x34')];}_0x15a305[_0x86ad('0x2b')](_0x414ee7)[_0x86ad('0x35')](_0x1db4ee);};}exports['index']=function(_0x197ea1,_0x30959b){var _0xa7d37={},_0x33af6b={},_0x58e3a4={'count':0x0,'rows':[]};var _0x347c7f=_['map'](db['WhatsappMessage'][_0x86ad('0x36')],function(_0x56f55b){return{'name':_0x56f55b[_0x86ad('0x37')],'type':_0x56f55b[_0x86ad('0x38')][_0x86ad('0x39')]};});_0x33af6b['model']=_[_0x86ad('0x3a')](_0x347c7f,_0x86ad('0x34'));_0x33af6b['query']=_['keys'](_0x197ea1[_0x86ad('0x3b')]);_0x33af6b[_0x86ad('0x3c')]=_[_0x86ad('0x3d')](_0x33af6b[_0x86ad('0x3e')],_0x33af6b['query']);_0xa7d37[_0x86ad('0x3f')]=_[_0x86ad('0x3d')](_0x33af6b[_0x86ad('0x3e')],qs[_0x86ad('0x40')](_0x197ea1[_0x86ad('0x3b')][_0x86ad('0x40')]));_0xa7d37['attributes']=_0xa7d37[_0x86ad('0x3f')]['length']?_0xa7d37[_0x86ad('0x3f')]:_0x33af6b[_0x86ad('0x3e')];if(!_0x197ea1[_0x86ad('0x3b')][_0x86ad('0x41')](_0x86ad('0x42'))){_0xa7d37['limit']=qs[_0x86ad('0x28')](_0x197ea1['query']['limit']);_0xa7d37[_0x86ad('0x2a')]=qs[_0x86ad('0x2a')](_0x197ea1[_0x86ad('0x3b')][_0x86ad('0x2a')]);}_0xa7d37[_0x86ad('0x43')]=qs[_0x86ad('0x44')](_0x197ea1['query'][_0x86ad('0x44')]);_0xa7d37[_0x86ad('0x45')]=qs[_0x86ad('0x3c')](_['pick'](_0x197ea1[_0x86ad('0x3b')],_0x33af6b[_0x86ad('0x3c')]),_0x347c7f);if(_0x197ea1[_0x86ad('0x3b')]['filter']){_0xa7d37[_0x86ad('0x45')]=_[_0x86ad('0x46')](_0xa7d37[_0x86ad('0x45')],{'$or':_[_0x86ad('0x3a')](_0x347c7f,function(_0x250bc6){if(_0x250bc6[_0x86ad('0x38')]!==_0x86ad('0x47')){var _0x51b3db={};_0x51b3db[_0x250bc6[_0x86ad('0x34')]]={'$like':'%'+_0x197ea1[_0x86ad('0x3b')][_0x86ad('0x48')]+'%'};return _0x51b3db;}})});}_0xa7d37=_['merge']({},_0xa7d37,_0x197ea1[_0x86ad('0x49')]);var _0x33f00a={'where':_0xa7d37[_0x86ad('0x45')]};return db[_0x86ad('0x4a')][_0x86ad('0x29')](_0x33f00a)['then'](function(_0x1372f8){_0x58e3a4[_0x86ad('0x29')]=_0x1372f8;if(_0x197ea1[_0x86ad('0x3b')][_0x86ad('0x4b')]){_0xa7d37[_0x86ad('0x4c')]=[{'all':!![]}];}return db[_0x86ad('0x4a')][_0x86ad('0x4d')](_0xa7d37);})[_0x86ad('0x30')](function(_0x310f2d){_0x58e3a4['rows']=_0x310f2d;return _0x58e3a4;})[_0x86ad('0x30')](respondWithFilteredResult(_0x30959b,_0xa7d37))[_0x86ad('0x25')](handleError(_0x30959b,null));};exports['show']=function(_0x1de35d,_0x56c0d3){var _0x20c286={'raw':!![],'where':{'id':_0x1de35d[_0x86ad('0x4e')]['id']}},_0x245729={};_0x245729[_0x86ad('0x3e')]=_['keys'](db[_0x86ad('0x4a')]['rawAttributes']);_0x245729[_0x86ad('0x3b')]=_['keys'](_0x1de35d[_0x86ad('0x3b')]);_0x245729[_0x86ad('0x3c')]=_['intersection'](_0x245729['model'],_0x245729[_0x86ad('0x3b')]);_0x20c286[_0x86ad('0x3f')]=_[_0x86ad('0x3d')](_0x245729[_0x86ad('0x3e')],qs[_0x86ad('0x40')](_0x1de35d[_0x86ad('0x3b')][_0x86ad('0x40')]));_0x20c286['attributes']=_0x20c286[_0x86ad('0x3f')][_0x86ad('0x4f')]?_0x20c286['attributes']:_0x245729['model'];if(_0x1de35d['query'][_0x86ad('0x4b')]){_0x20c286[_0x86ad('0x4c')]=[{'all':!![]}];}_0x20c286=_['merge']({},_0x20c286,_0x1de35d[_0x86ad('0x49')]);return db['WhatsappMessage'][_0x86ad('0x50')](_0x20c286)['then'](handleEntityNotFound(_0x56c0d3,null))[_0x86ad('0x30')](respondWithResult(_0x56c0d3,null))[_0x86ad('0x25')](handleError(_0x56c0d3,null));};exports[_0x86ad('0x51')]=function(_0x295bd8,_0x11eead){return db[_0x86ad('0x4a')]['create'](_0x295bd8[_0x86ad('0x52')],{})[_0x86ad('0x30')](respondWithResult(_0x11eead,0xc9))[_0x86ad('0x25')](handleError(_0x11eead,null));};exports[_0x86ad('0x2f')]=function(_0x511aba,_0x5a03ca){if(_0x511aba[_0x86ad('0x52')]['id']){delete _0x511aba[_0x86ad('0x52')]['id'];}return db[_0x86ad('0x4a')][_0x86ad('0x50')]({'where':{'id':_0x511aba[_0x86ad('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5a03ca,null))[_0x86ad('0x30')](saveUpdates(_0x511aba[_0x86ad('0x52')],null))[_0x86ad('0x30')](respondWithResult(_0x5a03ca,null))[_0x86ad('0x25')](handleError(_0x5a03ca,null));};exports[_0x86ad('0x31')]=function(_0x832bf2,_0x4f7cca){return db['WhatsappMessage'][_0x86ad('0x50')]({'where':{'id':_0x832bf2[_0x86ad('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4f7cca,null))['then'](removeEntity(_0x4f7cca,null))[_0x86ad('0x25')](handleError(_0x4f7cca,null));};exports[_0x86ad('0x53')]=function(_0x2ee0e3,_0x147c40){return db[_0x86ad('0x4a')][_0x86ad('0x53')]()[_0x86ad('0x30')](respondWithResult(_0x147c40,null))[_0x86ad('0x25')](handleError(_0x147c40,null));};var interaction_log=require('../../config/logger')(_0x86ad('0x54'));exports[_0x86ad('0x55')]=function(_0x575465,_0x172ae7,_0x3bf413){var _0x50dfa7={'agent':{},'channel':_0x86ad('0x56')};if(_0x575465[_0x86ad('0x52')]['id']){delete _0x575465[_0x86ad('0x52')]['id'];}_0x575465['body']['read']=!![];_0x575465[_0x86ad('0x52')][_0x86ad('0x57')]=moment()['format'](_0x86ad('0x58'));_0x575465[_0x86ad('0x52')][_0x86ad('0x59')]=_0x575465['body']['UserId']||_0x575465[_0x86ad('0x5a')]['id'];_0x50dfa7[_0x86ad('0x5b')]['id']=_0x575465[_0x86ad('0x52')][_0x86ad('0x59')];return db['WhatsappMessage'][_0x86ad('0x50')]({'where':{'id':_0x575465[_0x86ad('0x4e')]['id'],'UserId':null}})[_0x86ad('0x30')](handleEntityNotFound(_0x172ae7,null))[_0x86ad('0x30')](saveUpdates(_0x575465[_0x86ad('0x52')],null))['then'](function(_0x11dc67){if(_0x11dc67){_0x50dfa7[_0x86ad('0x23')]=_0x11dc67[_0x86ad('0x5c')]({'plain':!![]});return db[_0x86ad('0x5d')][_0x86ad('0x50')]({'where':{'id':_0x11dc67[_0x86ad('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x172ae7,null))['then'](function(_0x33944d){if(_0x33944d){return _0x33944d[_0x86ad('0x2f')]({'UserId':_0x575465[_0x86ad('0x52')][_0x86ad('0x59')],'read1stAt':_[_0x86ad('0x5f')](_0x33944d[_0x86ad('0x60')])?moment()[_0x86ad('0x61')](_0x86ad('0x58')):undefined});}return null;})['then'](function(_0xad2bbe){if(_0xad2bbe){_0x50dfa7[_0x86ad('0x62')]=_0xad2bbe[_0x86ad('0x5c')]({'plain':!![]});interaction_log[_0x86ad('0x1d')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x575465[_0x86ad('0x5a')]['id'],_0x575465[_0x86ad('0x5a')][_0x86ad('0x34')],_0x575465[_0x86ad('0x5a')][_0x86ad('0x63')],_0x50dfa7['interaction']['id'],_0x575465['body']?JSON[_0x86ad('0x64')](_0x575465[_0x86ad('0x52')]):_0x86ad('0x65'));return respondWithRpcPromise(_0x86ad('0x66'),_0x86ad('0x67'),_0x50dfa7);}return null;})[_0x86ad('0x30')](function(_0x237f03){var _0x2f7dda=_0x86ad('0x68')+_0x237f03['message'][_0x86ad('0x69')];return db[_0x86ad('0x6a')][_0x86ad('0x3b')](_0x2f7dda,{'type':db[_0x86ad('0x6b')][_0x86ad('0x6c')][_0x86ad('0x6d')],'raw':!![]})[_0x86ad('0x30')](function(_0xdd93c6){return _0xdd93c6;});})[_0x86ad('0x30')](function(_0x5a83cb){if(_0x5a83cb){_0x50dfa7['message']['contact']=_0x5a83cb[0x0];if(!_0x575465['body'][_0x86ad('0x59')])return;return db[_0x86ad('0x6e')][_0x86ad('0x50')]({'where':{'id':_0x575465['body'][_0x86ad('0x59')],'role':_0x86ad('0x5b')},'attributes':['id',_0x86ad('0x34'),'fullname',_0x86ad('0x6f'),_0x86ad('0x70')],'raw':!![]});}return null;})[_0x86ad('0x30')](function(_0x12f4a5){if(!_0x12f4a5)return null;_0x50dfa7[_0x86ad('0x23')][_0x86ad('0x5b')]=_0x12f4a5;return _0x50dfa7;})[_0x86ad('0x30')](function(_0x3440af){if(_0x3440af){if(_0x575465[_0x86ad('0x52')]['manual']){_0x50dfa7[_0x86ad('0x23')]['interface']=util[_0x86ad('0x61')]('SIP/%s',_0x575465[_0x86ad('0x5a')][_0x86ad('0x34')]);_0x50dfa7['message']['channel']=_0x50dfa7[_0x86ad('0x71')];_0x50dfa7[_0x86ad('0x23')][_0x86ad('0x72')]=_0x50dfa7[_0x86ad('0x71')];_0x50dfa7[_0x86ad('0x23')][_0x86ad('0x73')]=_0x86ad('0x55');return respondWithRpcPromise(_0x86ad('0x74'),_0x86ad('0x74'),{'event':_0x86ad('0x75'),'message':_0x50dfa7[_0x86ad('0x23')]},client9002)['then'](function(){return _0x50dfa7;});}return _0x50dfa7;}return null;})['then'](respondWithResult(_0x172ae7,null))[_0x86ad('0x25')](handleError(_0x172ae7,null));};var interaction_log=require(_0x86ad('0xf'))(_0x86ad('0x54'));exports[_0x86ad('0x76')]=function(_0xbe2c7d,_0x38caf5,_0x342563){var _0x107e5c={'agent':{},'channel':_0x86ad('0x56')};if(_0xbe2c7d[_0x86ad('0x52')]['id']){delete _0xbe2c7d[_0x86ad('0x52')]['id'];}_0xbe2c7d['body']['UserId']=_0xbe2c7d['body']['UserId']||_0xbe2c7d[_0x86ad('0x5a')]['id'];_0x107e5c[_0x86ad('0x5b')]['id']=_0xbe2c7d[_0x86ad('0x52')][_0x86ad('0x59')];return db[_0x86ad('0x4a')][_0x86ad('0x50')]({'where':{'id':_0xbe2c7d['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x38caf5,null))[_0x86ad('0x30')](function(_0x52b081){if(_0x52b081){_0x107e5c[_0x86ad('0x23')]=_0x52b081['get']({'plain':!![]});return db['WhatsappInteraction'][_0x86ad('0x50')]({'where':{'id':_0x52b081[_0x86ad('0x5e')]}});}return null;})[_0x86ad('0x30')](handleEntityNotFound(_0x38caf5,null))[_0x86ad('0x30')](function(_0x1e9755){if(_0x1e9755){_0x107e5c['interaction']=_0x1e9755[_0x86ad('0x5c')]({'plain':!![]});interaction_log[_0x86ad('0x1d')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xbe2c7d[_0x86ad('0x5a')]['id'],_0xbe2c7d['user'][_0x86ad('0x34')],_0xbe2c7d[_0x86ad('0x5a')]['role'],_0x107e5c[_0x86ad('0x62')]['id'],_0xbe2c7d['body']?JSON[_0x86ad('0x64')](_0xbe2c7d[_0x86ad('0x52')]):_0x86ad('0x65'));return respondWithRpcPromise('RejectMessage',_0x86ad('0x77'),_0x107e5c);}return null;})[_0x86ad('0x30')](function(_0x2807fc){var _0x33c9ee=_0x86ad('0x68')+_0x2807fc[_0x86ad('0x23')][_0x86ad('0x69')];return db['sequelize'][_0x86ad('0x3b')](_0x33c9ee,{'type':db['Sequelize'][_0x86ad('0x6c')][_0x86ad('0x6d')],'raw':!![]})[_0x86ad('0x30')](function(_0x2da922){return _0x2da922;});})[_0x86ad('0x30')](function(_0x3e34e0){if(_0x3e34e0){_0x107e5c[_0x86ad('0x23')][_0x86ad('0x78')]=_0x3e34e0[0x0];if(!_0xbe2c7d['body']['UserId'])return;return db[_0x86ad('0x6e')][_0x86ad('0x50')]({'where':{'id':_0xbe2c7d[_0x86ad('0x52')]['UserId'],'role':_0x86ad('0x5b')},'attributes':['id','name',_0x86ad('0x79'),_0x86ad('0x6f'),'internal'],'raw':!![]});}return null;})['then'](function(_0x394734){if(!_0x394734)return null;_0x107e5c[_0x86ad('0x23')]['agent']=_0x394734;return _0x107e5c;})['then'](function(_0x1e8f94){if(_0x1e8f94){_0x1e8f94[_0x86ad('0x23')]['interface']=util['format'](_0x86ad('0x7a'),_0xbe2c7d[_0x86ad('0x5a')][_0x86ad('0x34')]);_0x1e8f94['message'][_0x86ad('0x71')]=_0x107e5c[_0x86ad('0x71')];_0x1e8f94[_0x86ad('0x23')][_0x86ad('0x72')]=_0x107e5c[_0x86ad('0x71')];_0x1e8f94[_0x86ad('0x23')][_0x86ad('0x73')]=_0x86ad('0x76');respondWithRpcPromise('EventManager',_0x86ad('0x74'),{'event':_0x86ad('0x7b'),'message':_0x1e8f94['message']},client9002);return _0x107e5c;}return null;})[_0x86ad('0x30')](respondWithResult(_0x38caf5,null))[_0x86ad('0x25')](handleError(_0x38caf5,null));};exports[_0x86ad('0x2b')]=function(_0x53aa92,_0x2780a7,_0x5cd9ef){if(_0x53aa92['body']['id']){delete _0x53aa92['body']['id'];}var _0x23a926;return db[_0x86ad('0x4a')][_0x86ad('0x50')]({'where':{'id':_0x53aa92[_0x86ad('0x4e')]['id']}})[_0x86ad('0x30')](handleEntityNotFound(_0x2780a7,null))[_0x86ad('0x30')](function(_0x4718e5){if(_0x4718e5){_0x23a926=_0x4718e5;return db[_0x86ad('0x7c')][_0x86ad('0x50')]({'where':{'id':_0x4718e5[_0x86ad('0x7d')]}});}})['then'](handleEntityNotFound(_0x2780a7,null))[_0x86ad('0x30')](function(_0x106f3b){if(_0x106f3b){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x86ad('0x2b'),_0x86ad('0x7e'),_0x106f3b['type'],util[_0x86ad('0x7f')](_0x53aa92[_0x86ad('0x52')],{'showHidden':![],'depth':null}));switch(_0x106f3b[_0x86ad('0x38')]){case _0x86ad('0x80'):if(_0x53aa92[_0x86ad('0x52')][_0x86ad('0x81')]&&_0x53aa92['body'][_0x86ad('0x81')]===_0x23a926[_0x86ad('0x82')]&&_0x53aa92[_0x86ad('0x52')][_0x86ad('0x83')]&&_0x53aa92[_0x86ad('0x52')][_0x86ad('0x83')]===_0x86ad('0x84')){return _0x23a926[_0x86ad('0x2f')]({'read':!![]});}else{logger[_0x86ad('0x21')](_0x86ad('0x85'),'status','twilio',util[_0x86ad('0x7f')](_0x53aa92['body'],{'showHidden':![],'depth':null}));}break;}return _0x23a926;}})[_0x86ad('0x30')](respondWithResult(_0x2780a7,null))[_0x86ad('0x25')](handleError(_0x2780a7,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index ab95a77..2137542 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 _0x0713=['exports','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4a8bad,_0x4bfb2f){var _0x30cf32=function(_0x557b3a){while(--_0x557b3a){_0x4a8bad['push'](_0x4a8bad['shift']());}};_0x30cf32(++_0x4bfb2f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0x3071('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x3071('0x1')](0x0);var events={'afterCreate':_0x3071('0x2'),'afterUpdate':_0x3071('0x3'),'afterDestroy':_0x3071('0x4')};function emitEvent(_0x52b5fb){return function(_0x2c547f,_0x7b18a4,_0x33a70c){WhatsappMessageEvents[_0x3071('0x5')](_0x52b5fb+':'+_0x2c547f['id'],_0x2c547f);WhatsappMessageEvents[_0x3071('0x5')](_0x52b5fb,_0x2c547f);_0x33a70c(null);};}for(var e in events){if(events[_0x3071('0x6')](e)){var event=events[e];WhatsappMessage[_0x3071('0x7')](e,emitEvent(event));}}module[_0x3071('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0x7794=['save','remove','hasOwnProperty','hook','../../mysqldb','WhatsappMessage','setMaxListeners'];(function(_0x3cf5a3,_0x5a4492){var _0x39ba2d=function(_0x3ed989){while(--_0x3ed989){_0x3cf5a3['push'](_0x3cf5a3['shift']());}};_0x39ba2d(++_0x5a4492);}(_0x7794,0x7b));var _0x4779=function(_0x33c8db,_0x5d6316){_0x33c8db=_0x33c8db-0x0;var _0x1746a6=_0x7794[_0x33c8db];return _0x1746a6;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x4779('0x0'))['db'][_0x4779('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4779('0x2')](0x0);var events={'afterCreate':_0x4779('0x3'),'afterUpdate':'update','afterDestroy':_0x4779('0x4')};function emitEvent(_0x1e9fdc){return function(_0x4d3b05,_0x40e5f9,_0x54dc7f){WhatsappMessageEvents['emit'](_0x1e9fdc+':'+_0x4d3b05['id'],_0x4d3b05);WhatsappMessageEvents['emit'](_0x1e9fdc,_0x4d3b05);_0x54dc7f(null);};}for(var e in events){if(events[_0x4779('0x5')](e)){var event=events[e];WhatsappMessage[_0x4779('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 7460436..40decce 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 _0x4a16=['UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','toLowerCase','catch','error','WhatsappAccount','WhatsappAccountId','type','twilio','phone','accountSid','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','authToken','baseUrl','/messages/','text','body','POST','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','FULLTEXT','models','get','direction','out','secret','isNil'];(function(_0x242c13,_0x473489){var _0x4b2190=function(_0x313784){while(--_0x313784){_0x242c13['push'](_0x242c13['shift']());}};_0x4b2190(++_0x473489);}(_0x4a16,0xd9));var _0x64a1=function(_0x38987e,_0x1a4a8f){_0x38987e=_0x38987e-0x0;var _0x1ba6ce=_0x4a16[_0x38987e];return _0x1ba6ce;};'use strict';var _=require(_0x64a1('0x0'));var util=require(_0x64a1('0x1'));var logger=require(_0x64a1('0x2'))('api');var moment=require(_0x64a1('0x3'));var BPromise=require(_0x64a1('0x4'));var rp=require('request-promise');var fetch=require('node-fetch');var fs=require('fs');var path=require('path');var rimraf=require(_0x64a1('0x5'));var config=require(_0x64a1('0x6'));var attributes=require('./whatsappMessage.attributes');module[_0x64a1('0x7')]=function(_0x55b2fb,_0x86cd45){return _0x55b2fb[_0x64a1('0x8')](_0x64a1('0x9'),attributes,{'tableName':_0x64a1('0xa'),'paranoid':![],'indexes':[{'name':_0x64a1('0xb'),'fields':[_0x64a1('0xb')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0x64a1('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x213502,_0x57eb86,_0x591d90){var _0x1d62cd=_0x55b2fb[_0x64a1('0xd')];var _0x4c0519=_0x213502[_0x64a1('0xe')]({'plain':!![]});if(_0x4c0519['direction']['toLowerCase']()==='in'||_0x4c0519[_0x64a1('0xf')]['toLowerCase']()===_0x64a1('0x10')&&!_0x4c0519[_0x64a1('0x11')]&&!_[_0x64a1('0x12')](_0x4c0519[_0x64a1('0x13')])){_0x1d62cd[_0x64a1('0x14')][_0x64a1('0x15')]({'where':{'id':_0x4c0519[_0x64a1('0x16')]}})[_0x64a1('0x17')](function(_0x430c48){if(_0x430c48){_0x430c48['update']({'lastMsgAt':_0x4c0519['createdAt'],'lastMsgDirection':_0x4c0519[_0x64a1('0xf')][_0x64a1('0x18')]()});}})[_0x64a1('0x19')](function(_0x56bfea){console[_0x64a1('0x1a')](_0x56bfea);});}if(_0x4c0519['direction']==='out'&&!_0x4c0519[_0x64a1('0x11')]){var _0x2e3901;_0x1d62cd[_0x64a1('0x1b')]['find']({'where':{'id':_0x4c0519[_0x64a1('0x1c')]},'raw':!![]})['then'](function(_0x580907){_0x2e3901=_0x580907;if(_0x2e3901&&_0x2e3901[_0x64a1('0x1d')]){switch(_0x2e3901[_0x64a1('0x1d')]){case _0x64a1('0x1e'):var _0x8d8e88=require(_0x64a1('0x1e'));if(_0x2e3901['accountSid']&&_0x2e3901['authToken']&&_0x2e3901[_0x64a1('0x1f')]){var _0x263b35=new _0x8d8e88(_0x2e3901[_0x64a1('0x20')],_0x2e3901['authToken']);_0x263b35[_0x64a1('0x21')]['create']({'body':_0x4c0519['body'],'to':'whatsapp:'+_0x4c0519[_0x64a1('0x1f')],'from':_0x64a1('0x22')+_0x2e3901['phone'],'statusCallback':_0x2e3901[_0x64a1('0x23')]+_0x64a1('0x24')+_0x4c0519['id']+_0x64a1('0x25')+_0x2e3901[_0x64a1('0x26')]})[_0x64a1('0x17')](function(_0x1f0a5a){if(_0x1f0a5a[_0x64a1('0x27')]){return _0x213502[_0x64a1('0x28')]({'messageId':_0x1f0a5a['sid']});}})[_0x64a1('0x19')](function(_0x230400){logger[_0x64a1('0x1a')](_0x64a1('0x29'),_0x64a1('0x2a'),_0x64a1('0x1e'),util[_0x64a1('0x2b')](_0x230400,{'showHidden':![],'depth':null}));});}else{logger[_0x64a1('0x1a')](_0x64a1('0x29'),'afterCreate',_0x64a1('0x1e'),_0x64a1('0x2c'));}break;case _0x64a1('0x2d'):var _0x3f8c75=_0x2e3901[_0x64a1('0x20')];var _0x567a69=_0x2e3901[_0x64a1('0x2e')];var _0x1c9bc7=_0x2e3901[_0x64a1('0x2f')]+'/whatsapp/v1/'+_0x3f8c75+_0x64a1('0x30');var _0x2ef081={'to':[_0x4c0519[_0x64a1('0x1f')]],'message':{'type':_0x64a1('0x31'),'text':_0x4c0519[_0x64a1('0x32')]}};var _0x2e91a={'method':_0x64a1('0x33'),'uri':_0x1c9bc7,'headers':{'Authorization':_0x64a1('0x34')+_0x567a69,'Content-Type':'application/json'},'body':_0x2ef081,'json':!![]};rp(_0x2e91a)[_0x64a1('0x17')](function(_0x19b40e){if(_0x19b40e[_0x64a1('0x35')][0x0][_0x64a1('0x36')]){return _0x213502[_0x64a1('0x28')]({'messageId':_0x19b40e[_0x64a1('0x35')][0x0][_0x64a1('0x36')]});}})['catch'](function(_0x350cf4){logger[_0x64a1('0x37')](_0x64a1('0x38'),_0x350cf4);});break;}}})[_0x64a1('0x39')](function(){_0x591d90();});}else{_0x591d90();}}},'charset':'utf8mb4','collate':_0x64a1('0x3a')});}; \ No newline at end of file +var _0x239b=['out','secret','isNil','UserId','findOne','WhatsappInteractionId','createdAt','catch','error','WhatsappAccount','find','then','type','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','message_id','statuses','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','exports','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','direction','toLowerCase'];(function(_0x548281,_0x379e04){var _0x19ef24=function(_0x1581a5){while(--_0x1581a5){_0x548281['push'](_0x548281['shift']());}};_0x19ef24(++_0x379e04);}(_0x239b,0x141));var _0xb239=function(_0x3f2476,_0xfae0ca){_0x3f2476=_0x3f2476-0x0;var _0x36cf2b=_0x239b[_0x3f2476];return _0x36cf2b;};'use strict';var _=require('lodash');var util=require(_0xb239('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb239('0x1'));var BPromise=require(_0xb239('0x2'));var rp=require(_0xb239('0x3'));var fetch=require(_0xb239('0x4'));var fs=require('fs');var path=require(_0xb239('0x5'));var rimraf=require('rimraf');var config=require(_0xb239('0x6'));var attributes=require(_0xb239('0x7'));module[_0xb239('0x8')]=function(_0xbba6ed,_0x50aab9){return _0xbba6ed['define']('WhatsappMessage',attributes,{'tableName':_0xb239('0x9'),'paranoid':![],'indexes':[{'name':_0xb239('0xa'),'fields':[_0xb239('0xa')]},{'name':_0xb239('0xb'),'fields':['body'],'type':_0xb239('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x169e65,_0x191a27,_0x2767af){var _0x1c5337=_0xbba6ed['models'];var _0x2ff50d=_0x169e65['get']({'plain':!![]});if(_0x2ff50d[_0xb239('0xd')]['toLowerCase']()==='in'||_0x2ff50d[_0xb239('0xd')][_0xb239('0xe')]()===_0xb239('0xf')&&!_0x2ff50d[_0xb239('0x10')]&&!_[_0xb239('0x11')](_0x2ff50d[_0xb239('0x12')])){_0x1c5337['WhatsappInteraction'][_0xb239('0x13')]({'where':{'id':_0x2ff50d[_0xb239('0x14')]}})['then'](function(_0x483b9c){if(_0x483b9c){_0x483b9c['update']({'lastMsgAt':_0x2ff50d[_0xb239('0x15')],'lastMsgDirection':_0x2ff50d[_0xb239('0xd')]['toLowerCase']()});}})[_0xb239('0x16')](function(_0x15a7bd){console[_0xb239('0x17')](_0x15a7bd);});}if(_0x2ff50d['direction']==='out'&&!_0x2ff50d['secret']){var _0x464761;_0x1c5337[_0xb239('0x18')][_0xb239('0x19')]({'where':{'id':_0x2ff50d['WhatsappAccountId']},'raw':!![]})[_0xb239('0x1a')](function(_0xa75e9c){_0x464761=_0xa75e9c;if(_0x464761&&_0x464761[_0xb239('0x1b')]){switch(_0x464761[_0xb239('0x1b')]){case _0xb239('0x1c'):var _0x481347=require('twilio');if(_0x464761[_0xb239('0x1d')]&&_0x464761[_0xb239('0x1e')]&&_0x464761[_0xb239('0x1f')]){var _0x1c4e3e=new _0x481347(_0x464761['accountSid'],_0x464761[_0xb239('0x1e')]);_0x1c4e3e[_0xb239('0x20')][_0xb239('0x21')]({'body':_0x2ff50d[_0xb239('0x22')],'to':_0xb239('0x23')+_0x2ff50d[_0xb239('0x1f')],'from':_0xb239('0x23')+_0x464761['phone'],'statusCallback':_0x464761[_0xb239('0x24')]+_0xb239('0x25')+_0x2ff50d['id']+_0xb239('0x26')+_0x464761[_0xb239('0x27')]})[_0xb239('0x1a')](function(_0x1fa8ca){if(_0x1fa8ca['sid']){return _0x169e65[_0xb239('0x28')]({'messageId':_0x1fa8ca['sid']});}})[_0xb239('0x16')](function(_0x50b411){logger[_0xb239('0x17')](_0xb239('0x29'),'afterCreate',_0xb239('0x1c'),util['inspect'](_0x50b411,{'showHidden':![],'depth':null}));});}else{logger[_0xb239('0x17')](_0xb239('0x29'),_0xb239('0x2a'),_0xb239('0x1c'),_0xb239('0x2b'));}break;case _0xb239('0x2c'):var _0x5933b0=_0x464761['accountSid'];var _0x4a3ae6=_0x464761['authToken'];var _0x49aae5=_0x464761[_0xb239('0x2d')]+_0xb239('0x2e')+_0x5933b0+'/messages/';var _0x33992f={'to':[_0x2ff50d['phone']],'message':{'type':_0xb239('0x2f'),'text':_0x2ff50d[_0xb239('0x22')]}};var _0x25a4aa={'method':_0xb239('0x30'),'uri':_0x49aae5,'headers':{'Authorization':_0xb239('0x31')+_0x4a3ae6,'Content-Type':_0xb239('0x32')},'body':_0x33992f,'json':!![]};rp(_0x25a4aa)[_0xb239('0x1a')](function(_0x2cf665){if(_0x2cf665['statuses'][0x0][_0xb239('0x33')]){return _0x169e65['update']({'messageId':_0x2cf665[_0xb239('0x34')][0x0][_0xb239('0x33')]});}})[_0xb239('0x16')](function(_0x1eec70){logger['err'](_0xb239('0x35'),_0x1eec70);});break;}}})['finally'](function(){_0x2767af();});}else{_0x2767af();}}},'charset':_0xb239('0x36'),'collate':_0xb239('0x37')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 2ad4d32..e598a83 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 _0x10e5=['redis','defaults','localhost','socket.io-emitter','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','create','options','raw','then','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x72dbb,_0x238ccf){var _0x1b69ce=function(_0x14bfe0){while(--_0x14bfe0){_0x72dbb['push'](_0x72dbb['shift']());}};_0x1b69ce(++_0x238ccf);}(_0x10e5,0x7c));var _0x510e=function(_0x3eb1c1,_0x1bb418){_0x3eb1c1=_0x3eb1c1-0x0;var _0x53645a=_0x10e5[_0x3eb1c1];return _0x53645a;};'use strict';var _=require(_0x510e('0x0'));var util=require(_0x510e('0x1'));var moment=require(_0x510e('0x2'));var BPromise=require('bluebird');var rs=require(_0x510e('0x3'));var fs=require('fs');var Redis=require(_0x510e('0x4'));var db=require(_0x510e('0x5'))['db'];var utils=require(_0x510e('0x6'));var logger=require(_0x510e('0x7'))('rpc');var config=require(_0x510e('0x8'));var jayson=require(_0x510e('0x9'));var client=jayson[_0x510e('0xa')][_0x510e('0xb')]({'port':0x232a});config[_0x510e('0xc')]=_[_0x510e('0xd')](config[_0x510e('0xc')],{'host':_0x510e('0xe'),'port':0x18eb});var socket=require(_0x510e('0xf'))(new Redis(config[_0x510e('0xc')]));require('./whatsappMessage.socket')[_0x510e('0x10')](socket);function respondWithRpcPromise(_0x2ce661,_0xd97247,_0x59e2e1){return new BPromise(function(_0xd573f9,_0x4a6531){return client[_0x510e('0x11')](_0x2ce661,_0x59e2e1)['then'](function(_0x3f63be){logger[_0x510e('0x12')](_0x510e('0x13'),_0xd97247,_0x510e('0x14'));logger['debug'](_0x510e('0x15'),_0xd97247,_0x510e('0x14'),JSON[_0x510e('0x16')](_0x3f63be));if(_0x3f63be[_0x510e('0x17')]){if(_0x3f63be[_0x510e('0x17')][_0x510e('0x18')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0xd97247,_0x3f63be[_0x510e('0x17')]['message']);return _0x4a6531(_0x3f63be[_0x510e('0x17')]['message']);}logger[_0x510e('0x17')](_0x510e('0x13'),_0xd97247,_0x3f63be[_0x510e('0x17')][_0x510e('0x19')]);return _0xd573f9(_0x3f63be[_0x510e('0x17')]['message']);}else{logger[_0x510e('0x12')](_0x510e('0x13'),_0xd97247,_0x510e('0x14'));_0xd573f9(_0x3f63be[_0x510e('0x1a')][_0x510e('0x19')]);}})[_0x510e('0x1b')](function(_0x3ecac1){logger[_0x510e('0x17')](_0x510e('0x13'),_0xd97247,_0x3ecac1);_0x4a6531(_0x3ecac1);});});}exports[_0x510e('0x1c')]=function(_0x17c46f){var _0x1ce1ec=this;return new Promise(function(_0xe03c68,_0x3d7fa7){return db['WhatsappMessage'][_0x510e('0x1d')](_0x17c46f['body'],{'raw':_0x17c46f[_0x510e('0x1e')]?_0x17c46f[_0x510e('0x1e')][_0x510e('0x1f')]===undefined?!![]:![]:!![]})[_0x510e('0x20')](function(_0x387d39){logger[_0x510e('0x12')](_0x510e('0x1c'),_0x17c46f);logger[_0x510e('0x21')](_0x510e('0x1c'),_0x17c46f,JSON[_0x510e('0x16')](_0x387d39));_0xe03c68(_0x387d39);})[_0x510e('0x1b')](function(_0x3beb68){logger[_0x510e('0x17')](_0x510e('0x1c'),_0x3beb68['message'],_0x17c46f);_0x3d7fa7(_0x1ce1ec['error'](0x1f4,_0x3beb68['message']));});});}; \ No newline at end of file +var _0x0673=['WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./whatsappMessage.socket','register','request','then','request\x20sent','debug','stringify','error','code'];(function(_0xbe67e0,_0x5e6a91){var _0x343480=function(_0xb98f6b){while(--_0xb98f6b){_0xbe67e0['push'](_0xbe67e0['shift']());}};_0x343480(++_0x5e6a91);}(_0x0673,0xbe));var _0x3067=function(_0x3cb6f6,_0x16f93d){_0x3cb6f6=_0x3cb6f6-0x0;var _0x535aba=_0x0673[_0x3cb6f6];return _0x535aba;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3067('0x0'));var BPromise=require(_0x3067('0x1'));var rs=require(_0x3067('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3067('0x3'));var logger=require(_0x3067('0x4'))(_0x3067('0x5'));var config=require(_0x3067('0x6'));var jayson=require(_0x3067('0x7'));var client=jayson['client'][_0x3067('0x8')]({'port':0x232a});config[_0x3067('0x9')]=_['defaults'](config[_0x3067('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3067('0xa'))(new Redis(config[_0x3067('0x9')]));require(_0x3067('0xb'))[_0x3067('0xc')](socket);function respondWithRpcPromise(_0x21c929,_0x578a62,_0x3e9ac7){return new BPromise(function(_0x5742aa,_0x44da4b){return client[_0x3067('0xd')](_0x21c929,_0x3e9ac7)[_0x3067('0xe')](function(_0x16ff06){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x578a62,_0x3067('0xf'));logger[_0x3067('0x10')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x578a62,'request\x20sent',JSON[_0x3067('0x11')](_0x16ff06));if(_0x16ff06[_0x3067('0x12')]){if(_0x16ff06[_0x3067('0x12')][_0x3067('0x13')]===0x1f4){logger[_0x3067('0x12')](_0x3067('0x14'),_0x578a62,_0x16ff06[_0x3067('0x12')][_0x3067('0x15')]);return _0x44da4b(_0x16ff06['error'][_0x3067('0x15')]);}logger['error'](_0x3067('0x14'),_0x578a62,_0x16ff06[_0x3067('0x12')]['message']);return _0x5742aa(_0x16ff06[_0x3067('0x12')][_0x3067('0x15')]);}else{logger[_0x3067('0x16')](_0x3067('0x14'),_0x578a62,_0x3067('0xf'));_0x5742aa(_0x16ff06[_0x3067('0x17')][_0x3067('0x15')]);}})[_0x3067('0x18')](function(_0x195aee){logger[_0x3067('0x12')](_0x3067('0x14'),_0x578a62,_0x195aee);_0x44da4b(_0x195aee);});});}exports[_0x3067('0x19')]=function(_0x5a1ec5){var _0x249e62=this;return new Promise(function(_0x7c1b5,_0x3f0dad){return db[_0x3067('0x1a')][_0x3067('0x1b')](_0x5a1ec5[_0x3067('0x1c')],{'raw':_0x5a1ec5[_0x3067('0x1d')]?_0x5a1ec5[_0x3067('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x3067('0xe')](function(_0x10d1c7){logger['info'](_0x3067('0x19'),_0x5a1ec5);logger['debug']('CreateWhatsappMessage',_0x5a1ec5,JSON[_0x3067('0x11')](_0x10d1c7));_0x7c1b5(_0x10d1c7);})[_0x3067('0x18')](function(_0x245d49){logger['error'](_0x3067('0x19'),_0x245d49[_0x3067('0x15')],_0x5a1ec5);_0x3f0dad(_0x249e62[_0x3067('0x12')](0x1f4,_0x245d49[_0x3067('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 2488fb7..99f6bdc 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 _0x2429=['whatsappMessage:','./whatsappMessage.events','save','remove','emit','register'];(function(_0x582628,_0x45dc5d){var _0x4dfea5=function(_0x2ed090){while(--_0x2ed090){_0x582628['push'](_0x582628['shift']());}};_0x4dfea5(++_0x45dc5d);}(_0x2429,0xcd));var _0x9242=function(_0x2ae099,_0x1d9376){_0x2ae099=_0x2ae099-0x0;var _0x2ce323=_0x2429[_0x2ae099];return _0x2ce323;};'use strict';var WhatsappMessageEvents=require(_0x9242('0x0'));var events=[_0x9242('0x1'),_0x9242('0x2'),'update'];function createListener(_0x586e89,_0x4aad0b){return function(_0x296643){_0x4aad0b[_0x9242('0x3')](_0x586e89,_0x296643);};}function removeListener(_0x24bb8d,_0x582c07){return function(){WhatsappMessageEvents['removeListener'](_0x24bb8d,_0x582c07);};}exports[_0x9242('0x4')]=function(_0x46808a){for(var _0x2324d4=0x0,_0x35150a=events['length'];_0x2324d4<_0x35150a;_0x2324d4++){var _0x5a924a=events[_0x2324d4];var _0x456453=createListener(_0x9242('0x5')+_0x5a924a,_0x46808a);WhatsappMessageEvents['on'](_0x5a924a,_0x456453);}}; \ No newline at end of file +var _0x18dd=['emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','update'];(function(_0x17784a,_0x42fe44){var _0x41aded=function(_0x2e7319){while(--_0x2e7319){_0x17784a['push'](_0x17784a['shift']());}};_0x41aded(++_0x42fe44);}(_0x18dd,0xb5));var _0xd18d=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x18dd[_0x1035c1];return _0x308d67;};'use strict';var WhatsappMessageEvents=require(_0xd18d('0x0'));var events=[_0xd18d('0x1'),'remove',_0xd18d('0x2')];function createListener(_0x4a2b59,_0x160896){return function(_0x159167){_0x160896[_0xd18d('0x3')](_0x4a2b59,_0x159167);};}function removeListener(_0xcd49b3,_0x5bcdb7){return function(){WhatsappMessageEvents[_0xd18d('0x4')](_0xcd49b3,_0x5bcdb7);};}exports[_0xd18d('0x5')]=function(_0x196eb4){for(var _0x4dc1e6=0x0,_0x303276=events[_0xd18d('0x6')];_0x4dc1e6<_0x303276;_0x4dc1e6++){var _0x16a1b7=events[_0x4dc1e6];var _0x395e3e=createListener(_0xd18d('0x7')+_0x16a1b7,_0x196eb4);WhatsappMessageEvents['on'](_0x16a1b7,_0x395e3e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 14b5552..e3b1f3b 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 _0x46cf=['express','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/users','getAgents','/:id/teams','addTeams','post','addAgents','put','update','destroy','delete','removeTeams','exports','path','connect-timeout'];(function(_0x25bc0a,_0x555154){var _0x3cfa8c=function(_0xc7391){while(--_0xc7391){_0x25bc0a['push'](_0x25bc0a['shift']());}};_0x3cfa8c(++_0x555154);}(_0x46cf,0x14e));var _0xf46c=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x46cf[_0x35885a];return _0xe86249;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf46c('0x0'));var timeout=require(_0xf46c('0x1'));var express=require(_0xf46c('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf46c('0x3'));var config=require('../../config/environment');var controller=require(_0xf46c('0x4'));router[_0xf46c('0x5')]('/',auth[_0xf46c('0x6')](),controller[_0xf46c('0x7')]);router[_0xf46c('0x5')]('/describe',auth['isAuthenticated'](),controller[_0xf46c('0x8')]);router['get'](_0xf46c('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0xf46c('0xa'),auth[_0xf46c('0x6')](),controller[_0xf46c('0xb')]);router[_0xf46c('0x5')]('/:id/teams',auth[_0xf46c('0x6')](),controller['getTeams']);router['get'](_0xf46c('0xc'),auth[_0xf46c('0x6')](),controller[_0xf46c('0xd')]);router['post']('/',auth[_0xf46c('0x6')](),controller['create']);router['post'](_0xf46c('0xe'),auth[_0xf46c('0x6')](),controller[_0xf46c('0xf')]);router[_0xf46c('0x10')](_0xf46c('0xc'),auth['isAuthenticated'](),controller[_0xf46c('0x11')]);router[_0xf46c('0x12')](_0xf46c('0x9'),auth[_0xf46c('0x6')](),controller[_0xf46c('0x13')]);router['delete'](_0xf46c('0x9'),auth['isAuthenticated'](),controller[_0xf46c('0x14')]);router[_0xf46c('0x15')](_0xf46c('0xe'),auth[_0xf46c('0x6')](),controller[_0xf46c('0x16')]);router[_0xf46c('0x15')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xf46c('0x17')]=router; \ No newline at end of file +var _0x3f59=['update','delete','destroy','removeTeams','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put'];(function(_0x181e7e,_0x57323e){var _0xe4db71=function(_0x431f54){while(--_0x431f54){_0x181e7e['push'](_0x181e7e['shift']());}};_0xe4db71(++_0x57323e);}(_0x3f59,0x1d4));var _0x93f5=function(_0x19f8e0,_0x4efa3f){_0x19f8e0=_0x19f8e0-0x0;var _0xd84710=_0x3f59[_0x19f8e0];return _0xd84710;};'use strict';var multer=require(_0x93f5('0x0'));var util=require('util');var path=require(_0x93f5('0x1'));var timeout=require(_0x93f5('0x2'));var express=require(_0x93f5('0x3'));var router=express[_0x93f5('0x4')]();var fs_extra=require(_0x93f5('0x5'));var auth=require(_0x93f5('0x6'));var interaction=require(_0x93f5('0x7'));var config=require(_0x93f5('0x8'));var controller=require(_0x93f5('0x9'));router['get']('/',auth[_0x93f5('0xa')](),controller[_0x93f5('0xb')]);router[_0x93f5('0xc')]('/describe',auth[_0x93f5('0xa')](),controller[_0x93f5('0xd')]);router[_0x93f5('0xc')](_0x93f5('0xe'),auth[_0x93f5('0xa')](),controller[_0x93f5('0xf')]);router[_0x93f5('0xc')](_0x93f5('0x10'),auth['isAuthenticated'](),controller['getMembers']);router[_0x93f5('0xc')](_0x93f5('0x11'),auth[_0x93f5('0xa')](),controller[_0x93f5('0x12')]);router[_0x93f5('0xc')](_0x93f5('0x13'),auth['isAuthenticated'](),controller[_0x93f5('0x14')]);router[_0x93f5('0x15')]('/',auth[_0x93f5('0xa')](),controller[_0x93f5('0x16')]);router[_0x93f5('0x15')]('/:id/teams',auth[_0x93f5('0xa')](),controller['addTeams']);router[_0x93f5('0x15')](_0x93f5('0x13'),auth[_0x93f5('0xa')](),controller[_0x93f5('0x17')]);router[_0x93f5('0x18')](_0x93f5('0xe'),auth[_0x93f5('0xa')](),controller[_0x93f5('0x19')]);router[_0x93f5('0x1a')](_0x93f5('0xe'),auth[_0x93f5('0xa')](),controller[_0x93f5('0x1b')]);router[_0x93f5('0x1a')]('/:id/teams',auth[_0x93f5('0xa')](),controller[_0x93f5('0x1c')]);router[_0x93f5('0x1a')](_0x93f5('0x13'),auth[_0x93f5('0xa')](),controller['removeAgents']);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 52d26a0..aafb093 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 _0x644a=['beepall','sequelize','exports','STRING','name','INTEGER','rrmemory'];(function(_0x3c6ae2,_0x5c52d8){var _0x4edda=function(_0x5593eb){while(--_0x5593eb){_0x3c6ae2['push'](_0x3c6ae2['shift']());}};_0x4edda(++_0x5c52d8);}(_0x644a,0xfd));var _0xa644=function(_0x4796eb,_0x2f8389){_0x4796eb=_0x4796eb-0x0;var _0x1fb1a4=_0x644a[_0x4796eb];return _0x1fb1a4;};'use strict';var Sequelize=require(_0xa644('0x0'));module[_0xa644('0x1')]={'name':{'type':Sequelize[_0xa644('0x2')],'unique':_0xa644('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xa644('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa644('0x5'),_0xa644('0x6'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8e44=['roundrobin','sequelize','exports','STRING','ENUM','rrmemory','beepall'];(function(_0x53ec1e,_0x3a84d9){var _0xbf83d9=function(_0x425a74){while(--_0x425a74){_0x53ec1e['push'](_0x53ec1e['shift']());}};_0xbf83d9(++_0x3a84d9);}(_0x8e44,0x1ac));var _0x48e4=function(_0x11a846,_0x2c29cb){_0x11a846=_0x11a846-0x0;var _0x2b8c28=_0x8e44[_0x11a846];return _0x2b8c28;};'use strict';var Sequelize=require(_0x48e4('0x0'));module[_0x48e4('0x1')]={'name':{'type':Sequelize[_0x48e4('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x48e4('0x3')](_0x48e4('0x4'),_0x48e4('0x5'),_0x48e4('0x6'))},'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 64b2903..049396c 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 _0x1df6=['interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','get','WhatsappQueues','destroy','error','stack','name','send','rawAttributes','fieldName','map','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','WhatsappQueue','includeAll','include','findAll','rows','show','params','intersection','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','pick','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','Agents'];(function(_0x3dc1e5,_0x2b3ce9){var _0x2c4e8d=function(_0xcb8719){while(--_0xcb8719){_0x3dc1e5['push'](_0x3dc1e5['shift']());}};_0x2c4e8d(++_0x2b3ce9);}(_0x1df6,0x150));var _0x61df=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1df6[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x61df('0x0'));var rimraf=require(_0x61df('0x1'));var zipdir=require(_0x61df('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x61df('0x3'));var moment=require(_0x61df('0x4'));var BPromise=require(_0x61df('0x5'));var Mustache=require(_0x61df('0x6'));var util=require(_0x61df('0x7'));var path=require(_0x61df('0x8'));var sox=require(_0x61df('0x9'));var csv=require(_0x61df('0xa'));var ejs=require(_0x61df('0xb'));var fs=require('fs');var fs_extra=require(_0x61df('0xc'));var _=require(_0x61df('0xd'));var squel=require(_0x61df('0xe'));var crypto=require(_0x61df('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x61df('0x10'));var toCsv=require(_0x61df('0xa'));var querystring=require(_0x61df('0x11'));var Papa=require(_0x61df('0x12'));var Redis=require(_0x61df('0x13'));var authService=require(_0x61df('0x14'));var qs=require(_0x61df('0x15'));var as=require(_0x61df('0x16'));var hardwareService=require(_0x61df('0x17'));var logger=require(_0x61df('0x18'))('api');var utils=require(_0x61df('0x19'));var config=require(_0x61df('0x1a'));var licenseUtil=require(_0x61df('0x1b'));var db=require(_0x61df('0x1c'))['db'];config[_0x61df('0x1d')]=_[_0x61df('0x1e')](config[_0x61df('0x1d')],{'host':_0x61df('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x61df('0x1d')]));require(_0x61df('0x20'))[_0x61df('0x21')](socket);function respondWithStatusCode(_0x2e8698,_0x434ca5){_0x434ca5=_0x434ca5||0xcc;return function(_0x456e0d){if(_0x456e0d){return _0x2e8698[_0x61df('0x22')](_0x434ca5);}return _0x2e8698['status'](_0x434ca5)[_0x61df('0x23')]();};}function respondWithResult(_0x185202,_0xdbe4eb){_0xdbe4eb=_0xdbe4eb||0xc8;return function(_0x40fd7a){if(_0x40fd7a){return _0x185202[_0x61df('0x24')](_0xdbe4eb)['json'](_0x40fd7a);}};}function respondWithFilteredResult(_0x583312,_0x21a6dd){return function(_0x4bb2a7){if(_0x4bb2a7){var _0x42a861=typeof _0x21a6dd[_0x61df('0x25')]==='undefined'&&typeof _0x21a6dd[_0x61df('0x26')]===_0x61df('0x27');var _0x5c4095=_0x4bb2a7[_0x61df('0x28')];var _0xfae1e0=_0x42a861?0x0:_0x21a6dd[_0x61df('0x25')];var _0x6fd508=_0x42a861?_0x4bb2a7['count']:_0x21a6dd[_0x61df('0x25')]+_0x21a6dd[_0x61df('0x26')];var _0x97d2f5;if(_0x6fd508>=_0x5c4095){_0x6fd508=_0x5c4095;_0x97d2f5=0xc8;}else{_0x97d2f5=0xce;}_0x583312[_0x61df('0x24')](_0x97d2f5);return _0x583312[_0x61df('0x29')](_0x61df('0x2a'),_0xfae1e0+'-'+_0x6fd508+'/'+_0x5c4095)[_0x61df('0x2b')](_0x4bb2a7);}return null;};}function patchUpdates(_0x45f998){return function(_0x524704){try{jsonpatch[_0x61df('0x2c')](_0x524704,_0x45f998,!![]);}catch(_0x4272d1){return BPromise['reject'](_0x4272d1);}return _0x524704[_0x61df('0x2d')]();};}function saveUpdates(_0x448f31,_0x4dc508){return function(_0x2949d0){if(_0x2949d0){return _0x2949d0[_0x61df('0x2e')](_0x448f31)[_0x61df('0x2f')](function(_0x323b20){return _0x323b20;});}return null;};}function removeEntity(_0x4f0a37,_0x51575b){return function(_0x248569){if(_0x248569){return _0x248569['destroy']()[_0x61df('0x2f')](function(){var _0x21ee82=_0x248569[_0x61df('0x30')]({'plain':!![]});var _0x2bb136=_0x61df('0x31');return db['UserProfileResource'][_0x61df('0x32')]({'where':{'type':_0x2bb136,'resourceId':_0x21ee82['id']}})[_0x61df('0x2f')](function(){return _0x248569;});})[_0x61df('0x2f')](function(){_0x4f0a37[_0x61df('0x24')](0xcc)[_0x61df('0x23')]();});}};}function handleEntityNotFound(_0x572129,_0x46276d){return function(_0xdab2ec){if(!_0xdab2ec){_0x572129[_0x61df('0x22')](0x194);}return _0xdab2ec;};}function handleError(_0x39735b,_0x4e335e){_0x4e335e=_0x4e335e||0x1f4;return function(_0x4941f5){logger[_0x61df('0x33')](_0x4941f5[_0x61df('0x34')]);if(_0x4941f5[_0x61df('0x35')]){delete _0x4941f5[_0x61df('0x35')];}_0x39735b[_0x61df('0x24')](_0x4e335e)[_0x61df('0x36')](_0x4941f5);};}exports['index']=function(_0x47bf12,_0x266fa5){var _0x3923ca={},_0x2f4683={},_0xa5fccc={'count':0x0,'rows':[]};var _0x391de4=_['map'](db['WhatsappQueue'][_0x61df('0x37')],function(_0x4c09d6){return{'name':_0x4c09d6[_0x61df('0x38')],'type':_0x4c09d6['type']['key']};});_0x2f4683['model']=_[_0x61df('0x39')](_0x391de4,_0x61df('0x35'));_0x2f4683[_0x61df('0x3a')]=_[_0x61df('0x3b')](_0x47bf12[_0x61df('0x3a')]);_0x2f4683[_0x61df('0x3c')]=_['intersection'](_0x2f4683[_0x61df('0x3d')],_0x2f4683[_0x61df('0x3a')]);_0x3923ca[_0x61df('0x3e')]=_['intersection'](_0x2f4683[_0x61df('0x3d')],qs[_0x61df('0x3f')](_0x47bf12[_0x61df('0x3a')][_0x61df('0x3f')]));_0x3923ca[_0x61df('0x3e')]=_0x3923ca[_0x61df('0x3e')][_0x61df('0x40')]?_0x3923ca[_0x61df('0x3e')]:_0x2f4683[_0x61df('0x3d')];if(!_0x47bf12[_0x61df('0x3a')][_0x61df('0x41')](_0x61df('0x42'))){_0x3923ca[_0x61df('0x26')]=qs[_0x61df('0x26')](_0x47bf12[_0x61df('0x3a')][_0x61df('0x26')]);_0x3923ca[_0x61df('0x25')]=qs[_0x61df('0x25')](_0x47bf12[_0x61df('0x3a')]['offset']);}_0x3923ca[_0x61df('0x43')]=qs[_0x61df('0x44')](_0x47bf12[_0x61df('0x3a')][_0x61df('0x44')]);_0x3923ca[_0x61df('0x45')]=qs[_0x61df('0x3c')](_['pick'](_0x47bf12[_0x61df('0x3a')],_0x2f4683[_0x61df('0x3c')]),_0x391de4);if(_0x47bf12[_0x61df('0x3a')][_0x61df('0x46')]){_0x3923ca[_0x61df('0x45')]=_[_0x61df('0x47')](_0x3923ca[_0x61df('0x45')],{'$or':_[_0x61df('0x39')](_0x391de4,function(_0x5c67ce){if(_0x5c67ce['type']!==_0x61df('0x48')){var _0x656100={};_0x656100[_0x5c67ce[_0x61df('0x35')]]={'$like':'%'+_0x47bf12[_0x61df('0x3a')][_0x61df('0x46')]+'%'};return _0x656100;}})});}_0x3923ca=_[_0x61df('0x47')]({},_0x3923ca,_0x47bf12[_0x61df('0x49')]);var _0x376062={'where':_0x3923ca[_0x61df('0x45')]};return db[_0x61df('0x4a')][_0x61df('0x28')](_0x376062)[_0x61df('0x2f')](function(_0x38ef12){_0xa5fccc[_0x61df('0x28')]=_0x38ef12;if(_0x47bf12[_0x61df('0x3a')][_0x61df('0x4b')]){_0x3923ca[_0x61df('0x4c')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x61df('0x4d')](_0x3923ca);})[_0x61df('0x2f')](function(_0x41966f){_0xa5fccc[_0x61df('0x4e')]=_0x41966f;return _0xa5fccc;})['then'](respondWithFilteredResult(_0x266fa5,_0x3923ca))['catch'](handleError(_0x266fa5,null));};exports[_0x61df('0x4f')]=function(_0x1a8dd5,_0x4edfd9){var _0x1e32b5={'raw':!![],'where':{'id':_0x1a8dd5[_0x61df('0x50')]['id']}},_0x5eb1f9={};_0x5eb1f9['model']=_[_0x61df('0x3b')](db[_0x61df('0x4a')][_0x61df('0x37')]);_0x5eb1f9['query']=_[_0x61df('0x3b')](_0x1a8dd5[_0x61df('0x3a')]);_0x5eb1f9[_0x61df('0x3c')]=_[_0x61df('0x51')](_0x5eb1f9[_0x61df('0x3d')],_0x5eb1f9[_0x61df('0x3a')]);_0x1e32b5[_0x61df('0x3e')]=_[_0x61df('0x51')](_0x5eb1f9[_0x61df('0x3d')],qs[_0x61df('0x3f')](_0x1a8dd5['query'][_0x61df('0x3f')]));_0x1e32b5[_0x61df('0x3e')]=_0x1e32b5[_0x61df('0x3e')][_0x61df('0x40')]?_0x1e32b5[_0x61df('0x3e')]:_0x5eb1f9[_0x61df('0x3d')];if(_0x1a8dd5[_0x61df('0x3a')][_0x61df('0x4b')]){_0x1e32b5[_0x61df('0x4c')]=[{'all':!![]}];}_0x1e32b5=_['merge']({},_0x1e32b5,_0x1a8dd5[_0x61df('0x49')]);return db[_0x61df('0x4a')]['find'](_0x1e32b5)[_0x61df('0x2f')](handleEntityNotFound(_0x4edfd9,null))['then'](respondWithResult(_0x4edfd9,null))[_0x61df('0x52')](handleError(_0x4edfd9,null));};exports[_0x61df('0x53')]=function(_0x1c678a,_0x325365){return db[_0x61df('0x4a')][_0x61df('0x53')](_0x1c678a[_0x61df('0x54')],{})['then'](function(_0x1fc217){var _0x3c39b5=_0x1c678a['user'][_0x61df('0x30')]({'plain':!![]});if(!_0x3c39b5)throw new Error(_0x61df('0x55'));if(_0x3c39b5[_0x61df('0x56')]===_0x61df('0x57')){var _0x2f9aec=_0x1fc217[_0x61df('0x30')]({'plain':!![]});var _0x12d849='WhatsappQueues';return db[_0x61df('0x58')][_0x61df('0x59')]({'where':{'name':_0x12d849,'userProfileId':_0x3c39b5['userProfileId']},'raw':!![]})[_0x61df('0x2f')](function(_0x347778){if(_0x347778&&_0x347778[_0x61df('0x5a')]===0x0){return db[_0x61df('0x5b')][_0x61df('0x53')]({'name':_0x2f9aec[_0x61df('0x35')],'resourceId':_0x2f9aec['id'],'type':_0x347778[_0x61df('0x35')],'sectionId':_0x347778['id']},{})[_0x61df('0x2f')](function(){return _0x1fc217;});}else{return _0x1fc217;}})[_0x61df('0x52')](function(_0x514edf){logger['error'](_0x61df('0x5c'),_0x514edf);throw _0x514edf;});}return _0x1fc217;})[_0x61df('0x2f')](respondWithResult(_0x325365,0xc9))['catch'](handleError(_0x325365,null));};exports['update']=function(_0x54ae03,_0x3f8560){if(_0x54ae03[_0x61df('0x54')]['id']){delete _0x54ae03[_0x61df('0x54')]['id'];}return db[_0x61df('0x4a')]['find']({'where':{'id':_0x54ae03[_0x61df('0x50')]['id']}})[_0x61df('0x2f')](handleEntityNotFound(_0x3f8560,null))[_0x61df('0x2f')](saveUpdates(_0x54ae03['body'],null))[_0x61df('0x2f')](respondWithResult(_0x3f8560,null))['catch'](handleError(_0x3f8560,null));};exports[_0x61df('0x32')]=function(_0x4970dd,_0x95c91a){return db[_0x61df('0x4a')][_0x61df('0x59')]({'where':{'id':_0x4970dd[_0x61df('0x50')]['id']}})[_0x61df('0x2f')](handleEntityNotFound(_0x95c91a,null))[_0x61df('0x2f')](removeEntity(_0x95c91a,null))['catch'](handleError(_0x95c91a,null));};exports[_0x61df('0x5d')]=function(_0x4bd1c5,_0x4adc33){return db[_0x61df('0x4a')][_0x61df('0x5d')]()['then'](respondWithResult(_0x4adc33,null))[_0x61df('0x52')](handleError(_0x4adc33,null));};exports[_0x61df('0x5e')]=function(_0x146f37,_0x1c1d49,_0x3c45ee){var _0x2adbc3={'raw':!![],'where':{}},_0x36d183={},_0x470496;return db[_0x61df('0x4a')]['findOne']({'where':{'id':_0x146f37[_0x61df('0x50')]['id']}})[_0x61df('0x2f')](handleEntityNotFound(_0x1c1d49,null))['then'](function(_0x3814bb){if(_0x3814bb){_0x470496=_0x3814bb[_0x61df('0x30')]({'plain':!![]});_0x36d183[_0x61df('0x3d')]=_[_0x61df('0x3b')](db[_0x61df('0x5f')][_0x61df('0x37')]);_0x36d183['query']=_['keys'](_0x146f37[_0x61df('0x3a')]);_0x36d183[_0x61df('0x3c')]=_['intersection'](_0x36d183['model'],_0x36d183[_0x61df('0x3a')]);_0x2adbc3[_0x61df('0x3e')]=_[_0x61df('0x51')](_0x36d183[_0x61df('0x3d')],qs[_0x61df('0x3f')](_0x146f37[_0x61df('0x3a')][_0x61df('0x3f')]));_0x2adbc3[_0x61df('0x3e')]=_0x2adbc3[_0x61df('0x3e')][_0x61df('0x40')]?_0x2adbc3[_0x61df('0x3e')]:_0x36d183[_0x61df('0x3d')];if(!_0x146f37['query'][_0x61df('0x41')](_0x61df('0x42'))){_0x2adbc3[_0x61df('0x26')]=qs[_0x61df('0x26')](_0x146f37[_0x61df('0x3a')][_0x61df('0x26')]);_0x2adbc3[_0x61df('0x25')]=qs[_0x61df('0x25')](_0x146f37[_0x61df('0x3a')][_0x61df('0x25')]);}_0x2adbc3[_0x61df('0x43')]=qs[_0x61df('0x44')](_0x146f37[_0x61df('0x3a')][_0x61df('0x44')]);_0x2adbc3['where']=qs[_0x61df('0x3c')](_[_0x61df('0x60')](_0x146f37['query'],_0x36d183[_0x61df('0x3c')]));_0x2adbc3[_0x61df('0x45')][_0x61df('0x61')]=_0x3814bb['id'];if(_0x146f37[_0x61df('0x3a')]['filter']){_0x2adbc3['where']=_[_0x61df('0x47')](_0x2adbc3['where'],{'$or':_['map'](_0x2adbc3[_0x61df('0x3e')],function(_0x331ad0){var _0x3c4638={};_0x3c4638[_0x331ad0]={'$like':'%'+_0x146f37[_0x61df('0x3a')][_0x61df('0x46')]+'%'};return _0x3c4638;})});}_0x2adbc3=_[_0x61df('0x47')]({},_0x2adbc3,_0x146f37[_0x61df('0x49')]);return db[_0x61df('0x5f')]['findAll'](_0x2adbc3);}})[_0x61df('0x2f')](function(_0x345138){if(_0x345138){return db[_0x61df('0x62')][_0x61df('0x63')]({'where':{'id':_[_0x61df('0x39')](_0x345138,_0x61df('0x64')),'role':_0x61df('0x65')},'attributes':['id',_0x61df('0x35'),_0x61df('0x66'),_0x61df('0x67'),_0x61df('0x68')]});}})[_0x61df('0x2f')](function(_0x50c3fe){if(_0x50c3fe){return{'count':_0x50c3fe[_0x61df('0x28')],'rows':_[_0x61df('0x39')](_0x50c3fe['rows'],function(_0x4a3004){return{'membername':_0x4a3004[_0x61df('0x35')],'UserId':_0x4a3004['id'],'queue_name':_0x470496[_0x61df('0x35')],'WhatsappQueueId':_0x470496['id'],'interface':util[_0x61df('0x69')](_0x61df('0x6a'),_0x61df('0x6b'),_0x4a3004[_0x61df('0x35')]),'penalty':0x0,'paused':_0x4a3004[_0x61df('0x66')],'createdAt':_0x4a3004['createdAt'],'updatedAt':_0x4a3004['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x61df('0x2f')](respondWithFilteredResult(_0x1c1d49,_0x2adbc3))[_0x61df('0x52')](handleError(_0x1c1d49,null));};exports[_0x61df('0x6c')]=function(_0x48d223,_0x361593,_0x3aa181){var _0x273b64={};var _0x124cfc={};var _0x5f14a1;var _0x42841b;return db['WhatsappQueue'][_0x61df('0x6d')]({'where':{'id':_0x48d223[_0x61df('0x50')]['id']}})['then'](handleEntityNotFound(_0x361593,null))[_0x61df('0x2f')](function(_0xa1b5ec){if(_0xa1b5ec){_0x5f14a1=_0xa1b5ec;_0x124cfc[_0x61df('0x3d')]=_['keys'](db[_0x61df('0x6e')]['rawAttributes']);_0x124cfc[_0x61df('0x3a')]=_[_0x61df('0x3b')](_0x48d223[_0x61df('0x3a')]);_0x124cfc['filters']=_[_0x61df('0x51')](_0x124cfc[_0x61df('0x3d')],_0x124cfc[_0x61df('0x3a')]);_0x273b64[_0x61df('0x3e')]=_[_0x61df('0x51')](_0x124cfc[_0x61df('0x3d')],qs['fields'](_0x48d223[_0x61df('0x3a')][_0x61df('0x3f')]));_0x273b64[_0x61df('0x3e')]=_0x273b64[_0x61df('0x3e')][_0x61df('0x40')]?_0x273b64[_0x61df('0x3e')]:_0x124cfc[_0x61df('0x3d')];_0x273b64['order']=qs['sort'](_0x48d223['query'][_0x61df('0x44')]);_0x273b64[_0x61df('0x45')]=qs[_0x61df('0x3c')](_['pick'](_0x48d223[_0x61df('0x3a')],_0x124cfc[_0x61df('0x3c')]));if(_0x48d223[_0x61df('0x3a')][_0x61df('0x46')]){_0x273b64[_0x61df('0x45')]=_[_0x61df('0x47')](_0x273b64[_0x61df('0x45')],{'$or':_['map'](_0x273b64['attributes'],function(_0x2e71af){var _0x3cf4b8={};_0x3cf4b8[_0x2e71af]={'$like':'%'+_0x48d223[_0x61df('0x3a')][_0x61df('0x46')]+'%'};return _0x3cf4b8;})});}_0x273b64=_['merge']({},_0x273b64,_0x48d223[_0x61df('0x49')]);return _0x5f14a1[_0x61df('0x6c')](_0x273b64);}})[_0x61df('0x2f')](function(_0x4ce874){if(_0x4ce874){_0x42841b=_0x4ce874[_0x61df('0x40')];if(!_0x48d223[_0x61df('0x3a')]['hasOwnProperty'](_0x61df('0x42'))){_0x273b64['limit']=qs[_0x61df('0x26')](_0x48d223[_0x61df('0x3a')][_0x61df('0x26')]);_0x273b64[_0x61df('0x25')]=qs['offset'](_0x48d223['query'][_0x61df('0x25')]);}return _0x5f14a1[_0x61df('0x6c')](_0x273b64);}})[_0x61df('0x2f')](function(_0x4304a6){if(_0x4304a6){return _0x4304a6?{'count':_0x42841b,'rows':_0x4304a6}:null;}})[_0x61df('0x2f')](respondWithResult(_0x361593,null))[_0x61df('0x52')](handleError(_0x361593,null));};exports[_0x61df('0x6f')]=function(_0xf44a50,_0xd1d061,_0x1a0fb7){var _0x4459be=_0xf44a50[_0x61df('0x54')][_0x61df('0x70')];return db[_0x61df('0x6e')][_0x61df('0x4d')]({'where':{'id':_0x4459be},'attributes':['id'],'include':[{'model':db['User'],'as':_0x61df('0x71'),'attributes':['id','name','online','voicePause',_0x61df('0x72')],'raw':!![]}]})[_0x61df('0x2f')](function(_0x3d65b9){if(_0x3d65b9){var _0x38a898=_[_0x61df('0x73')](_0x3d65b9,function(_0x10d6cf){var _0x107b32=_0x10d6cf[_0x61df('0x30')]({'plain':!![]});return _0x107b32[_0x61df('0x71')];});return db[_0x61df('0x4a')][_0x61df('0x59')]({'where':{'id':_0xf44a50['params']['id']}})[_0x61df('0x2f')](function(_0x1474c6){return db[_0x61df('0x74')][_0x61df('0x75')](function(_0xcfdaed){return _0x1474c6[_0x61df('0x6f')](_0x4459be,{'transaction':_0xcfdaed})[_0x61df('0x2f')](function(){return BPromise[_0x61df('0x76')](_0x38a898,function(_0x574037){return db[_0x61df('0x5f')][_0x61df('0x77')]({'where':{'UserId':_0x574037['id'],'WhatsappQueueId':_0xf44a50[_0x61df('0x50')]['id']},'transaction':_0xcfdaed});});})[_0x61df('0x2f')](function(){_0x38a898[_0x61df('0x78')](function(_0x5554c6){socket[_0x61df('0x79')](_0x61df('0x7a'),{'UserId':_0x5554c6['id'],'WhatsappQueueId':_0x1474c6['id']});});});});});}})[_0x61df('0x2f')](respondWithStatusCode(_0xd1d061,null))[_0x61df('0x52')](handleError(_0xd1d061,null));};exports[_0x61df('0x7b')]=function(_0x240c5a,_0x377a0d,_0x6b4d27){return db[_0x61df('0x6e')]['findAll']({'where':{'id':_0x240c5a[_0x61df('0x3a')][_0x61df('0x70')]},'attributes':['id'],'include':[{'model':db[_0x61df('0x62')],'as':_0x61df('0x71'),'attributes':['id'],'raw':!![]}]})[_0x61df('0x2f')](handleEntityNotFound(_0x377a0d,null))[_0x61df('0x2f')](function(_0x1e2672){var _0x521988=_[_0x61df('0x39')](_0x1e2672,'id');var _0x59986e=[];var _0x37bf2b=[];var _0x31fc3e=squel['select']();_0x31fc3e[_0x61df('0x7c')](_0x61df('0x7d'))[_0x61df('0x7e')](_0x61df('0x7f'),'tq')[_0x61df('0x80')](_0x61df('0x81'),'ut',_0x61df('0x82'))[_0x61df('0x45')](_0x61df('0x83'),_0x240c5a[_0x61df('0x50')]['id']);for(var _0x21ec57=0x0;_0x21ec57<_0x1e2672[_0x61df('0x40')];_0x21ec57+=0x1){let _0xc48055=_0x1e2672[_0x21ec57];for(var _0xb59af9=0x0;_0xb59af9<_0xc48055['Agents']['length'];_0xb59af9+=0x1){let _0x5c99cd=_0xc48055[_0x61df('0x71')][_0xb59af9];var _0x54e310=_0x31fc3e[_0x61df('0x84')]();_0x54e310['where'](_0x61df('0x85'),_0x5c99cd['id']);_0x37bf2b[_0x61df('0x86')](db['sequelize']['query'](_0x54e310[_0x61df('0x87')](),{'type':db[_0x61df('0x74')][_0x61df('0x88')][_0x61df('0x89')]})[_0x61df('0x2f')](function(_0x23d303){if(_0x23d303[_0x61df('0x40')]===0x1){return _0x5c99cd['id'];}else{var _0x5a5db9=_['every'](_[_0x61df('0x39')](_0x23d303,_0x61df('0x8a')),function(_0x2b1d8b){return _[_0x61df('0x8b')](_0x521988,_0x2b1d8b);});if(_0x5a5db9){return _0x5c99cd['id'];}}}));}}return BPromise[_0x61df('0x8c')](_0x37bf2b)[_0x61df('0x2f')](function(_0x1f18b3){_0x59986e=_(_0x59986e)[_0x61df('0x8d')](_0x1f18b3)[_0x61df('0x8e')]()['value']();return db[_0x61df('0x4a')][_0x61df('0x59')]({'where':{'id':_0x240c5a['params']['id']}})[_0x61df('0x2f')](function(_0x3f292a){return db[_0x61df('0x74')][_0x61df('0x75')](function(_0x5ad7fe){return _0x3f292a[_0x61df('0x7b')](_0x240c5a['query'][_0x61df('0x70')],{'transaction':_0x5ad7fe})['then'](function(){if(!_[_0x61df('0x8f')](_0x59986e)){return _0x3f292a[_0x61df('0x90')](_0x59986e,{'transaction':_0x5ad7fe});}})[_0x61df('0x2f')](function(){_0x59986e[_0x61df('0x78')](function(_0x4679ea){socket[_0x61df('0x79')](_0x61df('0x91'),{'UserId':_0x4679ea,'WhatsappQueueId':_0x3f292a['id']});});});});});});})['then'](respondWithStatusCode(_0x377a0d,null))[_0x61df('0x52')](handleError(_0x377a0d,null));};exports['addAgents']=function(_0x1ee308,_0x468231,_0x4fefa1){return db['WhatsappQueue'][_0x61df('0x59')]({'where':{'id':_0x1ee308['params']['id']}})[_0x61df('0x2f')](handleEntityNotFound(_0x468231,null))[_0x61df('0x2f')](function(_0x3f923c){if(_0x3f923c){return _0x3f923c[_0x61df('0x92')](_0x1ee308[_0x61df('0x54')]['ids'],_['omit'](_0x1ee308[_0x61df('0x54')],[_0x61df('0x70'),'id'])||{})[_0x61df('0x93')](function(_0x473241){for(var _0x4c8e3a=0x0;_0x4c8e3a<_0x1ee308[_0x61df('0x54')]['ids'][_0x61df('0x40')];_0x4c8e3a+=0x1){socket['emit'](_0x61df('0x7a'),{'UserId':Number(_0x1ee308[_0x61df('0x54')][_0x61df('0x70')][_0x4c8e3a]),'WhatsappQueueId':Number(_0x1ee308[_0x61df('0x50')]['id'])});}return _0x473241;});}})['then'](respondWithResult(_0x468231,null))[_0x61df('0x52')](handleError(_0x468231,null));};exports['removeAgents']=function(_0x23981a,_0x33a671,_0x5b05a5){return db['WhatsappQueue'][_0x61df('0x59')]({'where':{'id':_0x23981a[_0x61df('0x50')]['id']}})[_0x61df('0x2f')](handleEntityNotFound(_0x33a671,null))['then'](function(_0x2a2505){if(_0x2a2505){return _0x2a2505[_0x61df('0x90')](_0x23981a[_0x61df('0x3a')][_0x61df('0x70')])[_0x61df('0x2f')](function(){if(_[_0x61df('0x94')](_0x23981a[_0x61df('0x3a')][_0x61df('0x70')])){for(var _0x2612e5=0x0;_0x2612e5<_0x23981a['query'][_0x61df('0x70')][_0x61df('0x40')];_0x2612e5+=0x1){socket[_0x61df('0x79')]('userWhatsappQueue:remove',{'UserId':Number(_0x23981a[_0x61df('0x3a')][_0x61df('0x70')][_0x2612e5]),'WhatsappQueueId':Number(_0x23981a[_0x61df('0x50')]['id'])});}}else{socket[_0x61df('0x79')](_0x61df('0x91'),{'UserId':Number(_0x23981a[_0x61df('0x3a')][_0x61df('0x70')]),'WhatsappQueueId':Number(_0x23981a[_0x61df('0x50')]['id'])});}});}})[_0x61df('0x2f')](respondWithStatusCode(_0x33a671,null))['catch'](handleError(_0x33a671,null));};exports['getAgents']=function(_0x223670,_0x9be2f3,_0x4f6fd1){var _0x433ec8={};var _0x210b9e={};var _0x23b0cf;var _0x11c022;return db[_0x61df('0x4a')][_0x61df('0x6d')]({'where':{'id':_0x223670[_0x61df('0x50')]['id']}})[_0x61df('0x2f')](handleEntityNotFound(_0x9be2f3,null))[_0x61df('0x2f')](function(_0x1ff4fc){if(_0x1ff4fc){_0x23b0cf=_0x1ff4fc;_0x210b9e[_0x61df('0x3d')]=_[_0x61df('0x3b')](db[_0x61df('0x62')]['rawAttributes']);_0x210b9e[_0x61df('0x3a')]=_[_0x61df('0x3b')](_0x223670['query']);_0x210b9e[_0x61df('0x3c')]=_[_0x61df('0x51')](_0x210b9e[_0x61df('0x3d')],_0x210b9e[_0x61df('0x3a')]);_0x433ec8['attributes']=_['intersection'](_0x210b9e[_0x61df('0x3d')],qs[_0x61df('0x3f')](_0x223670[_0x61df('0x3a')][_0x61df('0x3f')]));_0x433ec8[_0x61df('0x3e')]=_0x433ec8[_0x61df('0x3e')]['length']?_0x433ec8[_0x61df('0x3e')]:_0x210b9e[_0x61df('0x3d')];_0x433ec8[_0x61df('0x43')]=qs[_0x61df('0x44')](_0x223670[_0x61df('0x3a')][_0x61df('0x44')]);_0x433ec8[_0x61df('0x45')]=qs['filters'](_[_0x61df('0x60')](_0x223670['query'],_0x210b9e[_0x61df('0x3c')]));if(_0x223670['query']['filter']){_0x433ec8[_0x61df('0x45')]=_[_0x61df('0x47')](_0x433ec8[_0x61df('0x45')],{'$or':_[_0x61df('0x39')](_0x433ec8['attributes'],function(_0x306c8e){var _0x55a941={};_0x55a941[_0x306c8e]={'$like':'%'+_0x223670[_0x61df('0x3a')]['filter']+'%'};return _0x55a941;})});}_0x433ec8=_[_0x61df('0x47')]({},_0x433ec8,_0x223670['options']);return _0x23b0cf[_0x61df('0x95')](_0x433ec8);}})['then'](function(_0x52fd48){if(_0x52fd48){_0x11c022=_0x52fd48['length'];if(!_0x223670[_0x61df('0x3a')][_0x61df('0x41')]('nolimit')){_0x433ec8[_0x61df('0x26')]=qs['limit'](_0x223670['query'][_0x61df('0x26')]);_0x433ec8[_0x61df('0x25')]=qs[_0x61df('0x25')](_0x223670[_0x61df('0x3a')]['offset']);}return _0x23b0cf[_0x61df('0x95')](_0x433ec8);}})[_0x61df('0x2f')](function(_0x397489){if(_0x397489){return _0x397489?{'count':_0x11c022,'rows':_0x397489}:null;}})[_0x61df('0x2f')](respondWithResult(_0x9be2f3,null))['catch'](handleError(_0x9be2f3,null));}; \ No newline at end of file +var _0x3517=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','describe','getMembers','findOne','UserWhatsappQueue','nolimit','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','hasOwnProperty','addTeams','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','ids','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','all','union','compact','value','isEmpty','removeAgents','forEach','addAgents','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','index','WhatsappQueue','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params'];(function(_0x4b505f,_0x4dff6d){var _0x5529fe=function(_0x5eb41d){while(--_0x5eb41d){_0x4b505f['push'](_0x4b505f['shift']());}};_0x5529fe(++_0x4dff6d);}(_0x3517,0xd1));var _0x7351=function(_0x5ccd7d,_0x50598a){_0x5ccd7d=_0x5ccd7d-0x0;var _0xf52d40=_0x3517[_0x5ccd7d];return _0xf52d40;};'use strict';var emlformat=require(_0x7351('0x0'));var rimraf=require(_0x7351('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7351('0x2'));var rp=require(_0x7351('0x3'));var moment=require(_0x7351('0x4'));var BPromise=require(_0x7351('0x5'));var Mustache=require('mustache');var util=require(_0x7351('0x6'));var path=require(_0x7351('0x7'));var sox=require(_0x7351('0x8'));var csv=require(_0x7351('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7351('0xa'));var squel=require(_0x7351('0xb'));var crypto=require('crypto');var jsforce=require(_0x7351('0xc'));var deskjs=require(_0x7351('0xd'));var toCsv=require(_0x7351('0x9'));var querystring=require('querystring');var Papa=require(_0x7351('0xe'));var Redis=require(_0x7351('0xf'));var authService=require(_0x7351('0x10'));var qs=require(_0x7351('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7351('0x12'));var logger=require(_0x7351('0x13'))(_0x7351('0x14'));var utils=require(_0x7351('0x15'));var config=require(_0x7351('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7351('0x17'))['db'];config[_0x7351('0x18')]=_[_0x7351('0x19')](config[_0x7351('0x18')],{'host':_0x7351('0x1a'),'port':0x18eb});var socket=require(_0x7351('0x1b'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x7351('0x1c')](socket);function respondWithStatusCode(_0x42f5bc,_0x5692a6){_0x5692a6=_0x5692a6||0xcc;return function(_0x16af0f){if(_0x16af0f){return _0x42f5bc[_0x7351('0x1d')](_0x5692a6);}return _0x42f5bc[_0x7351('0x1e')](_0x5692a6)[_0x7351('0x1f')]();};}function respondWithResult(_0xd12c,_0x16b452){_0x16b452=_0x16b452||0xc8;return function(_0x339084){if(_0x339084){return _0xd12c['status'](_0x16b452)[_0x7351('0x20')](_0x339084);}};}function respondWithFilteredResult(_0x1e2435,_0xd1e041){return function(_0x510f99){if(_0x510f99){var _0x5103fe=typeof _0xd1e041[_0x7351('0x21')]===_0x7351('0x22')&&typeof _0xd1e041[_0x7351('0x23')]===_0x7351('0x22');var _0xfe601f=_0x510f99['count'];var _0x4b3648=_0x5103fe?0x0:_0xd1e041[_0x7351('0x21')];var _0x377955=_0x5103fe?_0x510f99[_0x7351('0x24')]:_0xd1e041[_0x7351('0x21')]+_0xd1e041[_0x7351('0x23')];var _0x41b9d6;if(_0x377955>=_0xfe601f){_0x377955=_0xfe601f;_0x41b9d6=0xc8;}else{_0x41b9d6=0xce;}_0x1e2435['status'](_0x41b9d6);return _0x1e2435[_0x7351('0x25')](_0x7351('0x26'),_0x4b3648+'-'+_0x377955+'/'+_0xfe601f)[_0x7351('0x20')](_0x510f99);}return null;};}function patchUpdates(_0xc9782a){return function(_0x20f222){try{jsonpatch[_0x7351('0x27')](_0x20f222,_0xc9782a,!![]);}catch(_0x428cfe){return BPromise['reject'](_0x428cfe);}return _0x20f222[_0x7351('0x28')]();};}function saveUpdates(_0x2dddd5,_0x4cc6a8){return function(_0x2a980f){if(_0x2a980f){return _0x2a980f['update'](_0x2dddd5)[_0x7351('0x29')](function(_0x2bd575){return _0x2bd575;});}return null;};}function removeEntity(_0x1d15c7,_0x4d9624){return function(_0x3a3ed9){if(_0x3a3ed9){return _0x3a3ed9[_0x7351('0x2a')]()[_0x7351('0x29')](function(){var _0x5c8421=_0x3a3ed9[_0x7351('0x2b')]({'plain':!![]});var _0x50ef69=_0x7351('0x2c');return db[_0x7351('0x2d')][_0x7351('0x2a')]({'where':{'type':_0x50ef69,'resourceId':_0x5c8421['id']}})[_0x7351('0x29')](function(){return _0x3a3ed9;});})[_0x7351('0x29')](function(){_0x1d15c7['status'](0xcc)[_0x7351('0x1f')]();});}};}function handleEntityNotFound(_0x4ec8d5,_0x4244e4){return function(_0x3825fd){if(!_0x3825fd){_0x4ec8d5[_0x7351('0x1d')](0x194);}return _0x3825fd;};}function handleError(_0x40240c,_0x7c06c3){_0x7c06c3=_0x7c06c3||0x1f4;return function(_0x55be35){logger[_0x7351('0x2e')](_0x55be35[_0x7351('0x2f')]);if(_0x55be35[_0x7351('0x30')]){delete _0x55be35[_0x7351('0x30')];}_0x40240c[_0x7351('0x1e')](_0x7c06c3)['send'](_0x55be35);};}exports[_0x7351('0x31')]=function(_0x4f32d6,_0x5afe0c){var _0x4ecfc1={},_0x4bf6ed={},_0x5b8e97={'count':0x0,'rows':[]};var _0x545c04=_['map'](db[_0x7351('0x32')][_0x7351('0x33')],function(_0x5a2111){return{'name':_0x5a2111[_0x7351('0x34')],'type':_0x5a2111[_0x7351('0x35')]['key']};});_0x4bf6ed[_0x7351('0x36')]=_[_0x7351('0x37')](_0x545c04,_0x7351('0x30'));_0x4bf6ed['query']=_[_0x7351('0x38')](_0x4f32d6[_0x7351('0x39')]);_0x4bf6ed[_0x7351('0x3a')]=_[_0x7351('0x3b')](_0x4bf6ed[_0x7351('0x36')],_0x4bf6ed[_0x7351('0x39')]);_0x4ecfc1[_0x7351('0x3c')]=_[_0x7351('0x3b')](_0x4bf6ed[_0x7351('0x36')],qs[_0x7351('0x3d')](_0x4f32d6[_0x7351('0x39')]['fields']));_0x4ecfc1[_0x7351('0x3c')]=_0x4ecfc1[_0x7351('0x3c')][_0x7351('0x3e')]?_0x4ecfc1['attributes']:_0x4bf6ed[_0x7351('0x36')];if(!_0x4f32d6[_0x7351('0x39')]['hasOwnProperty']('nolimit')){_0x4ecfc1[_0x7351('0x23')]=qs[_0x7351('0x23')](_0x4f32d6[_0x7351('0x39')][_0x7351('0x23')]);_0x4ecfc1[_0x7351('0x21')]=qs['offset'](_0x4f32d6['query'][_0x7351('0x21')]);}_0x4ecfc1[_0x7351('0x3f')]=qs[_0x7351('0x40')](_0x4f32d6[_0x7351('0x39')][_0x7351('0x40')]);_0x4ecfc1[_0x7351('0x41')]=qs[_0x7351('0x3a')](_[_0x7351('0x42')](_0x4f32d6[_0x7351('0x39')],_0x4bf6ed[_0x7351('0x3a')]),_0x545c04);if(_0x4f32d6[_0x7351('0x39')]['filter']){_0x4ecfc1['where']=_[_0x7351('0x43')](_0x4ecfc1[_0x7351('0x41')],{'$or':_[_0x7351('0x37')](_0x545c04,function(_0x3d4a6a){if(_0x3d4a6a[_0x7351('0x35')]!==_0x7351('0x44')){var _0x3ff1fd={};_0x3ff1fd[_0x3d4a6a[_0x7351('0x30')]]={'$like':'%'+_0x4f32d6[_0x7351('0x39')][_0x7351('0x45')]+'%'};return _0x3ff1fd;}})});}_0x4ecfc1=_[_0x7351('0x43')]({},_0x4ecfc1,_0x4f32d6[_0x7351('0x46')]);var _0x1d1e41={'where':_0x4ecfc1['where']};return db[_0x7351('0x32')]['count'](_0x1d1e41)[_0x7351('0x29')](function(_0x4b0e28){_0x5b8e97[_0x7351('0x24')]=_0x4b0e28;if(_0x4f32d6[_0x7351('0x39')][_0x7351('0x47')]){_0x4ecfc1['include']=[{'all':!![]}];}return db[_0x7351('0x32')][_0x7351('0x48')](_0x4ecfc1);})['then'](function(_0x57e839){_0x5b8e97[_0x7351('0x49')]=_0x57e839;return _0x5b8e97;})[_0x7351('0x29')](respondWithFilteredResult(_0x5afe0c,_0x4ecfc1))[_0x7351('0x4a')](handleError(_0x5afe0c,null));};exports[_0x7351('0x4b')]=function(_0x1b2677,_0x238dbe){var _0x58be73={'raw':!![],'where':{'id':_0x1b2677[_0x7351('0x4c')]['id']}},_0x1b86dd={};_0x1b86dd['model']=_[_0x7351('0x38')](db[_0x7351('0x32')][_0x7351('0x33')]);_0x1b86dd[_0x7351('0x39')]=_[_0x7351('0x38')](_0x1b2677[_0x7351('0x39')]);_0x1b86dd[_0x7351('0x3a')]=_[_0x7351('0x3b')](_0x1b86dd[_0x7351('0x36')],_0x1b86dd[_0x7351('0x39')]);_0x58be73[_0x7351('0x3c')]=_[_0x7351('0x3b')](_0x1b86dd[_0x7351('0x36')],qs[_0x7351('0x3d')](_0x1b2677[_0x7351('0x39')][_0x7351('0x3d')]));_0x58be73['attributes']=_0x58be73[_0x7351('0x3c')][_0x7351('0x3e')]?_0x58be73[_0x7351('0x3c')]:_0x1b86dd[_0x7351('0x36')];if(_0x1b2677['query'][_0x7351('0x47')]){_0x58be73['include']=[{'all':!![]}];}_0x58be73=_[_0x7351('0x43')]({},_0x58be73,_0x1b2677['options']);return db['WhatsappQueue'][_0x7351('0x4d')](_0x58be73)[_0x7351('0x29')](handleEntityNotFound(_0x238dbe,null))[_0x7351('0x29')](respondWithResult(_0x238dbe,null))['catch'](handleError(_0x238dbe,null));};exports[_0x7351('0x4e')]=function(_0x4fa658,_0x466cd6){return db[_0x7351('0x32')][_0x7351('0x4e')](_0x4fa658[_0x7351('0x4f')],{})[_0x7351('0x29')](function(_0x7e0da1){var _0x3af8ea=_0x4fa658[_0x7351('0x50')][_0x7351('0x2b')]({'plain':!![]});if(!_0x3af8ea)throw new Error(_0x7351('0x51'));if(_0x3af8ea[_0x7351('0x52')]==='user'){var _0x57a8a5=_0x7e0da1[_0x7351('0x2b')]({'plain':!![]});var _0x215a67=_0x7351('0x2c');return db[_0x7351('0x53')]['find']({'where':{'name':_0x215a67,'userProfileId':_0x3af8ea[_0x7351('0x54')]},'raw':!![]})[_0x7351('0x29')](function(_0x564748){if(_0x564748&&_0x564748[_0x7351('0x55')]===0x0){return db[_0x7351('0x2d')][_0x7351('0x4e')]({'name':_0x57a8a5[_0x7351('0x30')],'resourceId':_0x57a8a5['id'],'type':_0x564748['name'],'sectionId':_0x564748['id']},{})[_0x7351('0x29')](function(){return _0x7e0da1;});}else{return _0x7e0da1;}})[_0x7351('0x4a')](function(_0x4babc1){logger[_0x7351('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4babc1);throw _0x4babc1;});}return _0x7e0da1;})[_0x7351('0x29')](respondWithResult(_0x466cd6,0xc9))[_0x7351('0x4a')](handleError(_0x466cd6,null));};exports[_0x7351('0x56')]=function(_0x1e742e,_0x712ffc){if(_0x1e742e[_0x7351('0x4f')]['id']){delete _0x1e742e[_0x7351('0x4f')]['id'];}return db[_0x7351('0x32')]['find']({'where':{'id':_0x1e742e[_0x7351('0x4c')]['id']}})['then'](handleEntityNotFound(_0x712ffc,null))[_0x7351('0x29')](saveUpdates(_0x1e742e[_0x7351('0x4f')],null))[_0x7351('0x29')](respondWithResult(_0x712ffc,null))[_0x7351('0x4a')](handleError(_0x712ffc,null));};exports[_0x7351('0x2a')]=function(_0x5e4ec8,_0x8a8902){return db['WhatsappQueue'][_0x7351('0x4d')]({'where':{'id':_0x5e4ec8[_0x7351('0x4c')]['id']}})[_0x7351('0x29')](handleEntityNotFound(_0x8a8902,null))[_0x7351('0x29')](removeEntity(_0x8a8902,null))[_0x7351('0x4a')](handleError(_0x8a8902,null));};exports['describe']=function(_0x36cbef,_0x405301){return db['WhatsappQueue'][_0x7351('0x57')]()[_0x7351('0x29')](respondWithResult(_0x405301,null))[_0x7351('0x4a')](handleError(_0x405301,null));};exports[_0x7351('0x58')]=function(_0x2f96f0,_0x4e533a,_0x2fc003){var _0x18f0b3={'raw':!![],'where':{}},_0x361ec1={},_0x1ab709;return db[_0x7351('0x32')][_0x7351('0x59')]({'where':{'id':_0x2f96f0[_0x7351('0x4c')]['id']}})[_0x7351('0x29')](handleEntityNotFound(_0x4e533a,null))[_0x7351('0x29')](function(_0xab950){if(_0xab950){_0x1ab709=_0xab950[_0x7351('0x2b')]({'plain':!![]});_0x361ec1['model']=_[_0x7351('0x38')](db[_0x7351('0x5a')][_0x7351('0x33')]);_0x361ec1[_0x7351('0x39')]=_['keys'](_0x2f96f0[_0x7351('0x39')]);_0x361ec1[_0x7351('0x3a')]=_[_0x7351('0x3b')](_0x361ec1[_0x7351('0x36')],_0x361ec1[_0x7351('0x39')]);_0x18f0b3['attributes']=_[_0x7351('0x3b')](_0x361ec1['model'],qs[_0x7351('0x3d')](_0x2f96f0[_0x7351('0x39')]['fields']));_0x18f0b3['attributes']=_0x18f0b3[_0x7351('0x3c')][_0x7351('0x3e')]?_0x18f0b3['attributes']:_0x361ec1[_0x7351('0x36')];if(!_0x2f96f0['query']['hasOwnProperty'](_0x7351('0x5b'))){_0x18f0b3[_0x7351('0x23')]=qs[_0x7351('0x23')](_0x2f96f0[_0x7351('0x39')][_0x7351('0x23')]);_0x18f0b3[_0x7351('0x21')]=qs[_0x7351('0x21')](_0x2f96f0[_0x7351('0x39')][_0x7351('0x21')]);}_0x18f0b3[_0x7351('0x3f')]=qs[_0x7351('0x40')](_0x2f96f0[_0x7351('0x39')][_0x7351('0x40')]);_0x18f0b3['where']=qs['filters'](_[_0x7351('0x42')](_0x2f96f0[_0x7351('0x39')],_0x361ec1[_0x7351('0x3a')]));_0x18f0b3[_0x7351('0x41')][_0x7351('0x5c')]=_0xab950['id'];if(_0x2f96f0['query']['filter']){_0x18f0b3[_0x7351('0x41')]=_[_0x7351('0x43')](_0x18f0b3[_0x7351('0x41')],{'$or':_[_0x7351('0x37')](_0x18f0b3['attributes'],function(_0x4cdf9d){var _0x4fcb6a={};_0x4fcb6a[_0x4cdf9d]={'$like':'%'+_0x2f96f0[_0x7351('0x39')][_0x7351('0x45')]+'%'};return _0x4fcb6a;})});}_0x18f0b3=_[_0x7351('0x43')]({},_0x18f0b3,_0x2f96f0[_0x7351('0x46')]);return db[_0x7351('0x5a')][_0x7351('0x48')](_0x18f0b3);}})[_0x7351('0x29')](function(_0x13e562){if(_0x13e562){return db[_0x7351('0x5d')][_0x7351('0x5e')]({'where':{'id':_[_0x7351('0x37')](_0x13e562,_0x7351('0x5f')),'role':_0x7351('0x60')},'attributes':['id','name',_0x7351('0x61'),'updatedAt',_0x7351('0x62')]});}})['then'](function(_0x1a7d5c){if(_0x1a7d5c){return{'count':_0x1a7d5c[_0x7351('0x24')],'rows':_[_0x7351('0x37')](_0x1a7d5c[_0x7351('0x49')],function(_0x45b124){return{'membername':_0x45b124[_0x7351('0x30')],'UserId':_0x45b124['id'],'queue_name':_0x1ab709[_0x7351('0x30')],'WhatsappQueueId':_0x1ab709['id'],'interface':util[_0x7351('0x63')](_0x7351('0x64'),_0x7351('0x65'),_0x45b124[_0x7351('0x30')]),'penalty':0x0,'paused':_0x45b124[_0x7351('0x61')],'createdAt':_0x45b124[_0x7351('0x62')],'updatedAt':_0x45b124[_0x7351('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7351('0x29')](respondWithFilteredResult(_0x4e533a,_0x18f0b3))[_0x7351('0x4a')](handleError(_0x4e533a,null));};exports[_0x7351('0x67')]=function(_0x3459f0,_0x1268e1,_0x3a10cb){var _0x185646={};var _0x14abf4={};var _0x387c29;var _0x307275;return db[_0x7351('0x32')][_0x7351('0x59')]({'where':{'id':_0x3459f0[_0x7351('0x4c')]['id']}})[_0x7351('0x29')](handleEntityNotFound(_0x1268e1,null))[_0x7351('0x29')](function(_0x30a8dd){if(_0x30a8dd){_0x387c29=_0x30a8dd;_0x14abf4[_0x7351('0x36')]=_['keys'](db[_0x7351('0x68')][_0x7351('0x33')]);_0x14abf4[_0x7351('0x39')]=_[_0x7351('0x38')](_0x3459f0[_0x7351('0x39')]);_0x14abf4[_0x7351('0x3a')]=_[_0x7351('0x3b')](_0x14abf4[_0x7351('0x36')],_0x14abf4[_0x7351('0x39')]);_0x185646['attributes']=_['intersection'](_0x14abf4[_0x7351('0x36')],qs[_0x7351('0x3d')](_0x3459f0[_0x7351('0x39')]['fields']));_0x185646[_0x7351('0x3c')]=_0x185646['attributes']['length']?_0x185646['attributes']:_0x14abf4[_0x7351('0x36')];_0x185646['order']=qs[_0x7351('0x40')](_0x3459f0['query'][_0x7351('0x40')]);_0x185646[_0x7351('0x41')]=qs[_0x7351('0x3a')](_[_0x7351('0x42')](_0x3459f0['query'],_0x14abf4[_0x7351('0x3a')]));if(_0x3459f0[_0x7351('0x39')][_0x7351('0x45')]){_0x185646[_0x7351('0x41')]=_[_0x7351('0x43')](_0x185646[_0x7351('0x41')],{'$or':_[_0x7351('0x37')](_0x185646[_0x7351('0x3c')],function(_0x5c461a){var _0x15f455={};_0x15f455[_0x5c461a]={'$like':'%'+_0x3459f0['query'][_0x7351('0x45')]+'%'};return _0x15f455;})});}_0x185646=_[_0x7351('0x43')]({},_0x185646,_0x3459f0[_0x7351('0x46')]);return _0x387c29[_0x7351('0x67')](_0x185646);}})[_0x7351('0x29')](function(_0x2dc70f){if(_0x2dc70f){_0x307275=_0x2dc70f[_0x7351('0x3e')];if(!_0x3459f0[_0x7351('0x39')][_0x7351('0x69')]('nolimit')){_0x185646[_0x7351('0x23')]=qs[_0x7351('0x23')](_0x3459f0[_0x7351('0x39')][_0x7351('0x23')]);_0x185646[_0x7351('0x21')]=qs[_0x7351('0x21')](_0x3459f0['query'][_0x7351('0x21')]);}return _0x387c29[_0x7351('0x67')](_0x185646);}})[_0x7351('0x29')](function(_0x50cc4){if(_0x50cc4){return _0x50cc4?{'count':_0x307275,'rows':_0x50cc4}:null;}})[_0x7351('0x29')](respondWithResult(_0x1268e1,null))[_0x7351('0x4a')](handleError(_0x1268e1,null));};exports[_0x7351('0x6a')]=function(_0x2b5f48,_0x453600,_0x44bbf2){var _0xb679ab=_0x2b5f48[_0x7351('0x4f')]['ids'];return db['Team'][_0x7351('0x48')]({'where':{'id':_0xb679ab},'attributes':['id'],'include':[{'model':db[_0x7351('0x5d')],'as':_0x7351('0x6b'),'attributes':['id','name',_0x7351('0x6c'),_0x7351('0x6d'),'interface'],'raw':!![]}]})[_0x7351('0x29')](function(_0x1daef4){if(_0x1daef4){var _0x334272=_[_0x7351('0x6e')](_0x1daef4,function(_0x639eb3){var _0x403774=_0x639eb3[_0x7351('0x2b')]({'plain':!![]});return _0x403774[_0x7351('0x6b')];});return db[_0x7351('0x32')][_0x7351('0x4d')]({'where':{'id':_0x2b5f48['params']['id']}})['then'](function(_0x2a61fa){return db[_0x7351('0x6f')][_0x7351('0x70')](function(_0x30fdb0){return _0x2a61fa['addTeams'](_0xb679ab,{'transaction':_0x30fdb0})[_0x7351('0x29')](function(){return BPromise[_0x7351('0x71')](_0x334272,function(_0xe55f79){return db['UserWhatsappQueue'][_0x7351('0x72')]({'where':{'UserId':_0xe55f79['id'],'WhatsappQueueId':_0x2b5f48['params']['id']},'transaction':_0x30fdb0});});})[_0x7351('0x29')](function(){_0x334272['forEach'](function(_0x464c34){socket[_0x7351('0x73')]('userWhatsappQueue:save',{'UserId':_0x464c34['id'],'WhatsappQueueId':_0x2a61fa['id']});});});});});}})[_0x7351('0x29')](respondWithStatusCode(_0x453600,null))[_0x7351('0x4a')](handleError(_0x453600,null));};exports[_0x7351('0x74')]=function(_0x3ca04d,_0x2bd19a,_0x461d0d){return db[_0x7351('0x68')][_0x7351('0x48')]({'where':{'id':_0x3ca04d[_0x7351('0x39')][_0x7351('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2bd19a,null))['then'](function(_0x1e8315){var _0x2b1e6=_[_0x7351('0x37')](_0x1e8315,'id');var _0x3b701c=[];var _0x30593f=[];var _0x2b24a1=squel['select']();_0x2b24a1[_0x7351('0x76')](_0x7351('0x77'))[_0x7351('0x78')](_0x7351('0x79'),'tq')[_0x7351('0x7a')](_0x7351('0x7b'),'ut',_0x7351('0x7c'))[_0x7351('0x41')](_0x7351('0x7d'),_0x3ca04d[_0x7351('0x4c')]['id']);for(var _0x4f794b=0x0;_0x4f794b<_0x1e8315[_0x7351('0x3e')];_0x4f794b+=0x1){let _0x4d6b33=_0x1e8315[_0x4f794b];for(var _0x3f097f=0x0;_0x3f097f<_0x4d6b33[_0x7351('0x6b')][_0x7351('0x3e')];_0x3f097f+=0x1){let _0x170953=_0x4d6b33['Agents'][_0x3f097f];var _0x3972f6=_0x2b24a1[_0x7351('0x7e')]();_0x3972f6[_0x7351('0x41')](_0x7351('0x7f'),_0x170953['id']);_0x30593f[_0x7351('0x80')](db[_0x7351('0x6f')]['query'](_0x3972f6['toString'](),{'type':db['sequelize'][_0x7351('0x81')][_0x7351('0x82')]})['then'](function(_0x43bbf3){if(_0x43bbf3[_0x7351('0x3e')]===0x1){return _0x170953['id'];}else{var _0x3281f3=_[_0x7351('0x83')](_['map'](_0x43bbf3,'TeamId'),function(_0x18fc4f){return _['includes'](_0x2b1e6,_0x18fc4f);});if(_0x3281f3){return _0x170953['id'];}}}));}}return BPromise[_0x7351('0x84')](_0x30593f)['then'](function(_0x449844){_0x3b701c=_(_0x3b701c)[_0x7351('0x85')](_0x449844)[_0x7351('0x86')]()[_0x7351('0x87')]();return db[_0x7351('0x32')][_0x7351('0x4d')]({'where':{'id':_0x3ca04d[_0x7351('0x4c')]['id']}})[_0x7351('0x29')](function(_0x2cd9f5){return db[_0x7351('0x6f')][_0x7351('0x70')](function(_0x548bd0){return _0x2cd9f5['removeTeams'](_0x3ca04d[_0x7351('0x39')][_0x7351('0x75')],{'transaction':_0x548bd0})[_0x7351('0x29')](function(){if(!_[_0x7351('0x88')](_0x3b701c)){return _0x2cd9f5[_0x7351('0x89')](_0x3b701c,{'transaction':_0x548bd0});}})[_0x7351('0x29')](function(){_0x3b701c[_0x7351('0x8a')](function(_0x30c3c3){socket[_0x7351('0x73')]('userWhatsappQueue:remove',{'UserId':_0x30c3c3,'WhatsappQueueId':_0x2cd9f5['id']});});});});});});})['then'](respondWithStatusCode(_0x2bd19a,null))[_0x7351('0x4a')](handleError(_0x2bd19a,null));};exports['addAgents']=function(_0xc7a83c,_0x260ce2,_0x59d583){return db['WhatsappQueue'][_0x7351('0x4d')]({'where':{'id':_0xc7a83c[_0x7351('0x4c')]['id']}})['then'](handleEntityNotFound(_0x260ce2,null))[_0x7351('0x29')](function(_0x1162fa){if(_0x1162fa){return _0x1162fa[_0x7351('0x8b')](_0xc7a83c[_0x7351('0x4f')][_0x7351('0x75')],_['omit'](_0xc7a83c['body'],[_0x7351('0x75'),'id'])||{})['spread'](function(_0x383601){for(var _0x55a5ac=0x0;_0x55a5ac<_0xc7a83c['body'][_0x7351('0x75')][_0x7351('0x3e')];_0x55a5ac+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':Number(_0xc7a83c['body']['ids'][_0x55a5ac]),'WhatsappQueueId':Number(_0xc7a83c[_0x7351('0x4c')]['id'])});}return _0x383601;});}})[_0x7351('0x29')](respondWithResult(_0x260ce2,null))['catch'](handleError(_0x260ce2,null));};exports['removeAgents']=function(_0x2ddbea,_0x45f2bc,_0x136052){return db[_0x7351('0x32')][_0x7351('0x4d')]({'where':{'id':_0x2ddbea['params']['id']}})[_0x7351('0x29')](handleEntityNotFound(_0x45f2bc,null))[_0x7351('0x29')](function(_0x435005){if(_0x435005){return _0x435005[_0x7351('0x89')](_0x2ddbea[_0x7351('0x39')][_0x7351('0x75')])[_0x7351('0x29')](function(){if(_[_0x7351('0x8c')](_0x2ddbea[_0x7351('0x39')][_0x7351('0x75')])){for(var _0x13c194=0x0;_0x13c194<_0x2ddbea['query'][_0x7351('0x75')][_0x7351('0x3e')];_0x13c194+=0x1){socket['emit'](_0x7351('0x8d'),{'UserId':Number(_0x2ddbea[_0x7351('0x39')][_0x7351('0x75')][_0x13c194]),'WhatsappQueueId':Number(_0x2ddbea[_0x7351('0x4c')]['id'])});}}else{socket[_0x7351('0x73')](_0x7351('0x8d'),{'UserId':Number(_0x2ddbea[_0x7351('0x39')][_0x7351('0x75')]),'WhatsappQueueId':Number(_0x2ddbea['params']['id'])});}});}})['then'](respondWithStatusCode(_0x45f2bc,null))[_0x7351('0x4a')](handleError(_0x45f2bc,null));};exports[_0x7351('0x8e')]=function(_0x42899f,_0x56644b,_0x276996){var _0x29ff51={};var _0x261c69={};var _0x394ce3;var _0x385bef;return db['WhatsappQueue'][_0x7351('0x59')]({'where':{'id':_0x42899f['params']['id']}})['then'](handleEntityNotFound(_0x56644b,null))['then'](function(_0x4ec644){if(_0x4ec644){_0x394ce3=_0x4ec644;_0x261c69[_0x7351('0x36')]=_[_0x7351('0x38')](db['User'][_0x7351('0x33')]);_0x261c69[_0x7351('0x39')]=_[_0x7351('0x38')](_0x42899f[_0x7351('0x39')]);_0x261c69[_0x7351('0x3a')]=_['intersection'](_0x261c69['model'],_0x261c69['query']);_0x29ff51[_0x7351('0x3c')]=_[_0x7351('0x3b')](_0x261c69[_0x7351('0x36')],qs[_0x7351('0x3d')](_0x42899f['query'][_0x7351('0x3d')]));_0x29ff51[_0x7351('0x3c')]=_0x29ff51[_0x7351('0x3c')][_0x7351('0x3e')]?_0x29ff51[_0x7351('0x3c')]:_0x261c69[_0x7351('0x36')];_0x29ff51['order']=qs[_0x7351('0x40')](_0x42899f[_0x7351('0x39')][_0x7351('0x40')]);_0x29ff51[_0x7351('0x41')]=qs[_0x7351('0x3a')](_[_0x7351('0x42')](_0x42899f[_0x7351('0x39')],_0x261c69[_0x7351('0x3a')]));if(_0x42899f[_0x7351('0x39')]['filter']){_0x29ff51[_0x7351('0x41')]=_[_0x7351('0x43')](_0x29ff51[_0x7351('0x41')],{'$or':_[_0x7351('0x37')](_0x29ff51[_0x7351('0x3c')],function(_0x20f3b1){var _0x1cb7cc={};_0x1cb7cc[_0x20f3b1]={'$like':'%'+_0x42899f['query'][_0x7351('0x45')]+'%'};return _0x1cb7cc;})});}_0x29ff51=_['merge']({},_0x29ff51,_0x42899f[_0x7351('0x46')]);return _0x394ce3[_0x7351('0x8e')](_0x29ff51);}})['then'](function(_0x2b5e58){if(_0x2b5e58){_0x385bef=_0x2b5e58[_0x7351('0x3e')];if(!_0x42899f[_0x7351('0x39')][_0x7351('0x69')]('nolimit')){_0x29ff51[_0x7351('0x23')]=qs[_0x7351('0x23')](_0x42899f[_0x7351('0x39')][_0x7351('0x23')]);_0x29ff51['offset']=qs['offset'](_0x42899f['query'][_0x7351('0x21')]);}return _0x394ce3[_0x7351('0x8e')](_0x29ff51);}})[_0x7351('0x29')](function(_0x205ca2){if(_0x205ca2){return _0x205ca2?{'count':_0x385bef,'rows':_0x205ca2}:null;}})[_0x7351('0x29')](respondWithResult(_0x56644b,null))[_0x7351('0x4a')](handleError(_0x56644b,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 2b37084..6c4b707 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 _0x40ff=['emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','update','remove'];(function(_0x1ad8fc,_0x378b5e){var _0x222a1e=function(_0x228c9f){while(--_0x228c9f){_0x1ad8fc['push'](_0x1ad8fc['shift']());}};_0x222a1e(++_0x378b5e);}(_0x40ff,0x147));var _0xf40f=function(_0x35d3fb,_0x1406f3){_0x35d3fb=_0x35d3fb-0x0;var _0x5a9d0d=_0x40ff[_0x35d3fb];return _0x5a9d0d;};'use strict';var EventEmitter=require(_0xf40f('0x0'));var WhatsappQueue=require(_0xf40f('0x1'))['db'][_0xf40f('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xf40f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf40f('0x4'),'afterDestroy':_0xf40f('0x5')};function emitEvent(_0x855818){return function(_0x598a11,_0x371c27,_0x64e7e3){WhatsappQueueEvents[_0xf40f('0x6')](_0x855818+':'+_0x598a11['id'],_0x598a11);WhatsappQueueEvents[_0xf40f('0x6')](_0x855818,_0x598a11);_0x64e7e3(null);};}for(var e in events){if(events[_0xf40f('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xf40f('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xab21=['WhatsappQueue','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x21fcd5,_0x1091a4){var _0x53456e=function(_0x9293de){while(--_0x9293de){_0x21fcd5['push'](_0x21fcd5['shift']());}};_0x53456e(++_0x1091a4);}(_0xab21,0xf1));var _0x1ab2=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xab21[_0x3b0731];return _0x4204d7;};'use strict';var EventEmitter=require(_0x1ab2('0x0'));var WhatsappQueue=require(_0x1ab2('0x1'))['db'][_0x1ab2('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1ab2('0x3'),'afterUpdate':'update','afterDestroy':_0x1ab2('0x4')};function emitEvent(_0x6500f4){return function(_0x252241,_0x5e54fe,_0x2667dd){WhatsappQueueEvents[_0x1ab2('0x5')](_0x6500f4+':'+_0x252241['id'],_0x252241);WhatsappQueueEvents[_0x1ab2('0x5')](_0x6500f4,_0x252241);_0x2667dd(null);};}for(var e in events){if(events[_0x1ab2('0x6')](e)){var event=events[e];WhatsappQueue[_0x1ab2('0x7')](e,emitEvent(event));}}module[_0x1ab2('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 50be594..b1958d5 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 _0x67a4=['whatsapp_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue'];(function(_0x2f23ce,_0x14cee0){var _0x2ce8aa=function(_0x9a0e37){while(--_0x9a0e37){_0x2f23ce['push'](_0x2f23ce['shift']());}};_0x2ce8aa(++_0x14cee0);}(_0x67a4,0x145));var _0x467a=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0x67a4[_0x54ccd7];return _0x4e667b;};'use strict';var _=require(_0x467a('0x0'));var util=require(_0x467a('0x1'));var logger=require('../../config/logger')(_0x467a('0x2'));var moment=require(_0x467a('0x3'));var BPromise=require(_0x467a('0x4'));var rp=require(_0x467a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x467a('0x6'));var config=require(_0x467a('0x7'));var attributes=require(_0x467a('0x8'));module[_0x467a('0x9')]=function(_0x154800,_0x5519d5){return _0x154800['define'](_0x467a('0xa'),attributes,{'tableName':_0x467a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba63=['exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./whatsappQueue.attributes'];(function(_0x1b7b7e,_0x2daa87){var _0x57403f=function(_0x1a5baa){while(--_0x1a5baa){_0x1b7b7e['push'](_0x1b7b7e['shift']());}};_0x57403f(++_0x2daa87);}(_0xba63,0x118));var _0x3ba6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xba63[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x3ba6('0x0'));var util=require(_0x3ba6('0x1'));var logger=require(_0x3ba6('0x2'))('api');var moment=require(_0x3ba6('0x3'));var BPromise=require(_0x3ba6('0x4'));var rp=require(_0x3ba6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3ba6('0x6'));var attributes=require(_0x3ba6('0x7'));module[_0x3ba6('0x8')]=function(_0x2a4ab9,_0x4825c3){return _0x2a4ab9[_0x3ba6('0x9')](_0x3ba6('0xa'),attributes,{'tableName':_0x3ba6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 122e1e4..504aae1 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 _0xe95a=['message','info','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowWhatsappQueue','WhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueue,\x20%s,\x20%s'];(function(_0x18f329,_0x403cdf){var _0x3db824=function(_0x446153){while(--_0x446153){_0x18f329['push'](_0x18f329['shift']());}};_0x3db824(++_0x403cdf);}(_0xe95a,0x1d8));var _0xae95=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xe95a[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0xae95('0x0'));var util=require(_0xae95('0x1'));var moment=require(_0xae95('0x2'));var BPromise=require(_0xae95('0x3'));var rs=require(_0xae95('0x4'));var fs=require('fs');var Redis=require(_0xae95('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xae95('0x6'));var logger=require('../../config/logger')(_0xae95('0x7'));var config=require(_0xae95('0x8'));var jayson=require(_0xae95('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xae95('0xa')],{'host':_0xae95('0xb'),'port':0x18eb});var socket=require(_0xae95('0xc'))(new Redis(config['redis']));require(_0xae95('0xd'))['register'](socket);function respondWithRpcPromise(_0x4db3d0,_0x509627,_0x3ef57a){return new BPromise(function(_0x3187c6,_0x3b6821){return client[_0xae95('0xe')](_0x4db3d0,_0x3ef57a)[_0xae95('0xf')](function(_0x56426f){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x509627,_0xae95('0x10'));logger[_0xae95('0x11')](_0xae95('0x12'),_0x509627,_0xae95('0x10'),JSON[_0xae95('0x13')](_0x56426f));if(_0x56426f[_0xae95('0x14')]){if(_0x56426f[_0xae95('0x14')]['code']===0x1f4){logger['error'](_0xae95('0x15'),_0x509627,_0x56426f[_0xae95('0x14')][_0xae95('0x16')]);return _0x3b6821(_0x56426f[_0xae95('0x14')][_0xae95('0x16')]);}logger[_0xae95('0x14')](_0xae95('0x15'),_0x509627,_0x56426f[_0xae95('0x14')][_0xae95('0x16')]);return _0x3187c6(_0x56426f[_0xae95('0x14')][_0xae95('0x16')]);}else{logger[_0xae95('0x17')](_0xae95('0x15'),_0x509627,_0xae95('0x10'));_0x3187c6(_0x56426f['result']['message']);}})['catch'](function(_0x4c63ae){logger[_0xae95('0x14')](_0xae95('0x15'),_0x509627,_0x4c63ae);_0x3b6821(_0x4c63ae);});});}exports[_0xae95('0x18')]=function(_0x1e930e){var _0x1115ee=this;return new Promise(function(_0x57cdfd,_0x4801a4){return db['WhatsappQueue'][_0xae95('0x19')]({'raw':_0x1e930e[_0xae95('0x1a')]?_0x1e930e[_0xae95('0x1a')][_0xae95('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e930e[_0xae95('0x1a')]?_0x1e930e[_0xae95('0x1a')][_0xae95('0x1c')]||null:null,'attributes':_0x1e930e[_0xae95('0x1a')]?_0x1e930e[_0xae95('0x1a')][_0xae95('0x1d')]||null:null,'limit':_0x1e930e['options']?_0x1e930e['options'][_0xae95('0x1e')]||null:null,'include':_0x1e930e[_0xae95('0x1a')]?_0x1e930e[_0xae95('0x1a')][_0xae95('0x1f')]?_['map'](_0x1e930e[_0xae95('0x1a')][_0xae95('0x1f')],function(_0x151e06){return{'model':db[_0x151e06[_0xae95('0x20')]],'as':_0x151e06['as'],'attributes':_0x151e06[_0xae95('0x1d')],'include':_0x151e06['include']?_[_0xae95('0x21')](_0x151e06[_0xae95('0x1f')],function(_0x4ec3b1){return{'model':db[_0x4ec3b1[_0xae95('0x20')]],'as':_0x4ec3b1['as'],'attributes':_0x4ec3b1[_0xae95('0x1d')],'include':_0x4ec3b1[_0xae95('0x1f')]?_[_0xae95('0x21')](_0x4ec3b1['include'],function(_0x809cb8){return{'model':db[_0x809cb8[_0xae95('0x20')]],'as':_0x809cb8['as'],'attributes':_0x809cb8['attributes']};}):[]};}):[]};}):[]:[]})[_0xae95('0xf')](function(_0xb4e6d2){logger[_0xae95('0x17')]('GetWhatsappQueue',_0x1e930e);logger[_0xae95('0x11')](_0xae95('0x18'),_0x1e930e,JSON['stringify'](_0xb4e6d2));_0x57cdfd(_0xb4e6d2);})[_0xae95('0x22')](function(_0x41f2da){logger[_0xae95('0x14')](_0xae95('0x18'),_0x41f2da['message'],_0x1e930e);_0x4801a4(_0x1115ee[_0xae95('0x14')](0x1f4,_0x41f2da[_0xae95('0x16')]));});});};exports[_0xae95('0x23')]=function(_0x23102f){var _0x17b68e=this;return new Promise(function(_0x3a48ad,_0x55a2d8){return db[_0xae95('0x24')][_0xae95('0x25')]({'raw':_0x23102f['options']?_0x23102f[_0xae95('0x1a')][_0xae95('0x1b')]===undefined?!![]:![]:!![],'where':_0x23102f['options']?_0x23102f[_0xae95('0x1a')]['where']||null:null,'attributes':_0x23102f['options']?_0x23102f[_0xae95('0x1a')]['attributes']||null:null,'include':_0x23102f[_0xae95('0x1a')]?_0x23102f[_0xae95('0x1a')]['include']?_[_0xae95('0x21')](_0x23102f[_0xae95('0x1a')][_0xae95('0x1f')],function(_0x4b8eec){return{'model':db[_0x4b8eec[_0xae95('0x20')]],'as':_0x4b8eec['as'],'attributes':_0x4b8eec[_0xae95('0x1d')],'include':_0x4b8eec[_0xae95('0x1f')]?_['map'](_0x4b8eec[_0xae95('0x1f')],function(_0x14ad6e){return{'model':db[_0x14ad6e['model']],'as':_0x14ad6e['as'],'attributes':_0x14ad6e['attributes'],'include':_0x14ad6e[_0xae95('0x1f')]?_[_0xae95('0x21')](_0x14ad6e[_0xae95('0x1f')],function(_0x5c08cb){return{'model':db[_0x5c08cb[_0xae95('0x20')]],'as':_0x5c08cb['as'],'attributes':_0x5c08cb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b484d){logger[_0xae95('0x17')]('ShowWhatsappQueue',_0x23102f);logger[_0xae95('0x11')](_0xae95('0x23'),_0x23102f,JSON[_0xae95('0x13')](_0x3b484d));_0x3a48ad(_0x3b484d);})[_0xae95('0x22')](function(_0xe814b2){logger[_0xae95('0x14')](_0xae95('0x23'),_0xe814b2['message'],_0x23102f);_0x55a2d8(_0x17b68e[_0xae95('0x14')](0x1f4,_0xe814b2[_0xae95('0x16')]));});});}; \ No newline at end of file +var _0xbd95=['register','then','info','request\x20sent','debug','error','code','WhatsappQueue,\x20%s,\x20%s','message','catch','findAll','options','raw','where','include','map','model','attributes','GetWhatsappQueue','stringify','ShowWhatsappQueue','WhatsappQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x1419aa,_0x37c2b9){var _0x10e63c=function(_0x592f6b){while(--_0x592f6b){_0x1419aa['push'](_0x1419aa['shift']());}};_0x10e63c(++_0x37c2b9);}(_0xbd95,0x17f));var _0x5bd9=function(_0x22fae2,_0x4664fb){_0x22fae2=_0x22fae2-0x0;var _0x445558=_0xbd95[_0x22fae2];return _0x445558;};'use strict';var _=require(_0x5bd9('0x0'));var util=require('util');var moment=require(_0x5bd9('0x1'));var BPromise=require(_0x5bd9('0x2'));var rs=require(_0x5bd9('0x3'));var fs=require('fs');var Redis=require(_0x5bd9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5bd9('0x5'))(_0x5bd9('0x6'));var config=require(_0x5bd9('0x7'));var jayson=require(_0x5bd9('0x8'));var client=jayson['client'][_0x5bd9('0x9')]({'port':0x232a});config[_0x5bd9('0xa')]=_[_0x5bd9('0xb')](config[_0x5bd9('0xa')],{'host':_0x5bd9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x5bd9('0xd')](socket);function respondWithRpcPromise(_0x1f97c5,_0x4b4b25,_0x152296){return new BPromise(function(_0x28747b,_0x221a93){return client['request'](_0x1f97c5,_0x152296)[_0x5bd9('0xe')](function(_0x29357a){logger[_0x5bd9('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x4b4b25,_0x5bd9('0x10'));logger[_0x5bd9('0x11')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4b4b25,_0x5bd9('0x10'),JSON['stringify'](_0x29357a));if(_0x29357a[_0x5bd9('0x12')]){if(_0x29357a[_0x5bd9('0x12')][_0x5bd9('0x13')]===0x1f4){logger[_0x5bd9('0x12')](_0x5bd9('0x14'),_0x4b4b25,_0x29357a[_0x5bd9('0x12')][_0x5bd9('0x15')]);return _0x221a93(_0x29357a[_0x5bd9('0x12')][_0x5bd9('0x15')]);}logger[_0x5bd9('0x12')](_0x5bd9('0x14'),_0x4b4b25,_0x29357a[_0x5bd9('0x12')]['message']);return _0x28747b(_0x29357a[_0x5bd9('0x12')][_0x5bd9('0x15')]);}else{logger[_0x5bd9('0xf')](_0x5bd9('0x14'),_0x4b4b25,_0x5bd9('0x10'));_0x28747b(_0x29357a['result']['message']);}})[_0x5bd9('0x16')](function(_0x10f001){logger[_0x5bd9('0x12')](_0x5bd9('0x14'),_0x4b4b25,_0x10f001);_0x221a93(_0x10f001);});});}exports['GetWhatsappQueue']=function(_0x4fdeae){var _0x417a2e=this;return new Promise(function(_0x2897b3,_0x2bdb98){return db['WhatsappQueue'][_0x5bd9('0x17')]({'raw':_0x4fdeae[_0x5bd9('0x18')]?_0x4fdeae[_0x5bd9('0x18')][_0x5bd9('0x19')]===undefined?!![]:![]:!![],'where':_0x4fdeae[_0x5bd9('0x18')]?_0x4fdeae[_0x5bd9('0x18')][_0x5bd9('0x1a')]||null:null,'attributes':_0x4fdeae[_0x5bd9('0x18')]?_0x4fdeae['options']['attributes']||null:null,'limit':_0x4fdeae['options']?_0x4fdeae[_0x5bd9('0x18')]['limit']||null:null,'include':_0x4fdeae['options']?_0x4fdeae['options'][_0x5bd9('0x1b')]?_[_0x5bd9('0x1c')](_0x4fdeae['options'][_0x5bd9('0x1b')],function(_0x2ac993){return{'model':db[_0x2ac993[_0x5bd9('0x1d')]],'as':_0x2ac993['as'],'attributes':_0x2ac993[_0x5bd9('0x1e')],'include':_0x2ac993[_0x5bd9('0x1b')]?_[_0x5bd9('0x1c')](_0x2ac993[_0x5bd9('0x1b')],function(_0x133ef8){return{'model':db[_0x133ef8['model']],'as':_0x133ef8['as'],'attributes':_0x133ef8[_0x5bd9('0x1e')],'include':_0x133ef8['include']?_[_0x5bd9('0x1c')](_0x133ef8[_0x5bd9('0x1b')],function(_0x3d2a69){return{'model':db[_0x3d2a69[_0x5bd9('0x1d')]],'as':_0x3d2a69['as'],'attributes':_0x3d2a69[_0x5bd9('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x191c9b){logger[_0x5bd9('0xf')](_0x5bd9('0x1f'),_0x4fdeae);logger[_0x5bd9('0x11')](_0x5bd9('0x1f'),_0x4fdeae,JSON[_0x5bd9('0x20')](_0x191c9b));_0x2897b3(_0x191c9b);})[_0x5bd9('0x16')](function(_0x41ae7a){logger[_0x5bd9('0x12')]('GetWhatsappQueue',_0x41ae7a[_0x5bd9('0x15')],_0x4fdeae);_0x2bdb98(_0x417a2e[_0x5bd9('0x12')](0x1f4,_0x41ae7a['message']));});});};exports[_0x5bd9('0x21')]=function(_0x4b2dee){var _0x18ab67=this;return new Promise(function(_0xdd502d,_0x2c4eac){return db[_0x5bd9('0x22')][_0x5bd9('0x23')]({'raw':_0x4b2dee['options']?_0x4b2dee['options'][_0x5bd9('0x19')]===undefined?!![]:![]:!![],'where':_0x4b2dee[_0x5bd9('0x18')]?_0x4b2dee[_0x5bd9('0x18')]['where']||null:null,'attributes':_0x4b2dee[_0x5bd9('0x18')]?_0x4b2dee[_0x5bd9('0x18')]['attributes']||null:null,'include':_0x4b2dee[_0x5bd9('0x18')]?_0x4b2dee[_0x5bd9('0x18')][_0x5bd9('0x1b')]?_[_0x5bd9('0x1c')](_0x4b2dee[_0x5bd9('0x18')]['include'],function(_0x8f41e3){return{'model':db[_0x8f41e3['model']],'as':_0x8f41e3['as'],'attributes':_0x8f41e3['attributes'],'include':_0x8f41e3['include']?_['map'](_0x8f41e3['include'],function(_0x265cda){return{'model':db[_0x265cda[_0x5bd9('0x1d')]],'as':_0x265cda['as'],'attributes':_0x265cda['attributes'],'include':_0x265cda[_0x5bd9('0x1b')]?_[_0x5bd9('0x1c')](_0x265cda[_0x5bd9('0x1b')],function(_0x49976e){return{'model':db[_0x49976e['model']],'as':_0x49976e['as'],'attributes':_0x49976e[_0x5bd9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5bd9('0xe')](function(_0x139355){logger['info']('ShowWhatsappQueue',_0x4b2dee);logger[_0x5bd9('0x11')](_0x5bd9('0x21'),_0x4b2dee,JSON[_0x5bd9('0x20')](_0x139355));_0xdd502d(_0x139355);})[_0x5bd9('0x16')](function(_0x51237c){logger[_0x5bd9('0x12')](_0x5bd9('0x21'),_0x51237c['message'],_0x4b2dee);_0x2c4eac(_0x18ab67[_0x5bd9('0x12')](0x1f4,_0x51237c[_0x5bd9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 7350b64..4c3c725 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 _0x12d6=['update','emit','removeListener','register','length','whatsappQueue:','save','remove'];(function(_0x30d020,_0x3f2194){var _0x1fc136=function(_0xa7c321){while(--_0xa7c321){_0x30d020['push'](_0x30d020['shift']());}};_0x1fc136(++_0x3f2194);}(_0x12d6,0x1d6));var _0x612d=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0x12d6[_0x3c6dce];return _0x1450e9;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x612d('0x0'),_0x612d('0x1'),_0x612d('0x2')];function createListener(_0x5e72b4,_0x3cefa3){return function(_0x44a098){_0x3cefa3[_0x612d('0x3')](_0x5e72b4,_0x44a098);};}function removeListener(_0x9f9adb,_0x451b4f){return function(){WhatsappQueueEvents[_0x612d('0x4')](_0x9f9adb,_0x451b4f);};}exports[_0x612d('0x5')]=function(_0x4a58b0){for(var _0x426c57=0x0,_0x457577=events[_0x612d('0x6')];_0x426c57<_0x457577;_0x426c57++){var _0x2a3924=events[_0x426c57];var _0x66d94a=createListener(_0x612d('0x7')+_0x2a3924,_0x4a58b0);WhatsappQueueEvents['on'](_0x2a3924,_0x66d94a);}}; \ No newline at end of file +var _0x2307=['update','emit','removeListener','length','whatsappQueue:','save','remove'];(function(_0x5e932e,_0x2bd49e){var _0x45de43=function(_0x3b3d1e){while(--_0x3b3d1e){_0x5e932e['push'](_0x5e932e['shift']());}};_0x45de43(++_0x2bd49e);}(_0x2307,0x67));var _0x7230=function(_0x1326e5,_0x14131f){_0x1326e5=_0x1326e5-0x0;var _0x4a15e0=_0x2307[_0x1326e5];return _0x4a15e0;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x7230('0x0'),_0x7230('0x1'),_0x7230('0x2')];function createListener(_0x4f8ec3,_0xd4e42c){return function(_0x1a9b5b){_0xd4e42c[_0x7230('0x3')](_0x4f8ec3,_0x1a9b5b);};}function removeListener(_0xb22270,_0x45eb2a){return function(){WhatsappQueueEvents[_0x7230('0x4')](_0xb22270,_0x45eb2a);};}exports['register']=function(_0x3740f5){for(var _0x2ddb4c=0x0,_0x36a7c8=events[_0x7230('0x5')];_0x2ddb4c<_0x36a7c8;_0x2ddb4c++){var _0x6ba9f3=events[_0x2ddb4c];var _0x2ce713=createListener(_0x7230('0x6')+_0x6ba9f3,_0x3740f5);WhatsappQueueEvents['on'](_0x6ba9f3,_0x2ce713);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 656bc34..f5c3fc0 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 _0x4066=['get','index','/describe','isAuthenticated','describe','/:id','create','put','update','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2ddabf,_0x4265fe){var _0x2ab06d=function(_0x413458){while(--_0x413458){_0x2ddabf['push'](_0x2ddabf['shift']());}};_0x2ab06d(++_0x4265fe);}(_0x4066,0x1b3));var _0x6406=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4066[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x6406('0x0'));var util=require('util');var path=require(_0x6406('0x1'));var timeout=require('connect-timeout');var express=require(_0x6406('0x2'));var router=express[_0x6406('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6406('0x4'));var interaction=require(_0x6406('0x5'));var config=require(_0x6406('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0x6406('0x7')]('/',auth['isAuthenticated'](),controller[_0x6406('0x8')]);router[_0x6406('0x7')](_0x6406('0x9'),auth[_0x6406('0xa')](),controller[_0x6406('0xb')]);router[_0x6406('0x7')](_0x6406('0xc'),auth[_0x6406('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x6406('0xd')]);router[_0x6406('0xe')](_0x6406('0xc'),auth[_0x6406('0xa')](),controller[_0x6406('0xf')]);router['delete']('/:id',auth[_0x6406('0xa')](),controller['destroy']);module[_0x6406('0x10')]=router; \ No newline at end of file +var _0xf920=['./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','delete','destroy','exports','multer','util','path','express','fs-extra'];(function(_0x54135d,_0x285be9){var _0x129cf7=function(_0x58e713){while(--_0x58e713){_0x54135d['push'](_0x54135d['shift']());}};_0x129cf7(++_0x285be9);}(_0xf920,0x1d7));var _0x0f92=function(_0x1ba2e5,_0xbcc3fb){_0x1ba2e5=_0x1ba2e5-0x0;var _0x2b8957=_0xf920[_0x1ba2e5];return _0x2b8957;};'use strict';var multer=require(_0x0f92('0x0'));var util=require(_0x0f92('0x1'));var path=require(_0x0f92('0x2'));var timeout=require('connect-timeout');var express=require(_0x0f92('0x3'));var router=express['Router']();var fs_extra=require(_0x0f92('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0f92('0x5'));router[_0x0f92('0x6')]('/',auth[_0x0f92('0x7')](),controller[_0x0f92('0x8')]);router['get'](_0x0f92('0x9'),auth[_0x0f92('0x7')](),controller['describe']);router[_0x0f92('0x6')](_0x0f92('0xa'),auth[_0x0f92('0x7')](),controller[_0x0f92('0xb')]);router['post']('/',auth[_0x0f92('0x7')](),controller[_0x0f92('0xc')]);router[_0x0f92('0xd')]('/:id',auth[_0x0f92('0x7')](),controller['update']);router[_0x0f92('0xe')](_0x0f92('0xa'),auth[_0x0f92('0x7')](),controller[_0x0f92('0xf')]);module[_0x0f92('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 42841a1..bfd3380 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x1aacf6,_0x4da429){var _0xce43cc=function(_0x4d1797){while(--_0x4d1797){_0x1aacf6['push'](_0x1aacf6['shift']());}};_0xce43cc(++_0x4da429);}(_0x7a54,0x106));var _0x47a5=function(_0x9ee3f,_0x1adc9d){_0x9ee3f=_0x9ee3f-0x0;var _0x3b8d45=_0x7a54[_0x9ee3f];return _0x3b8d45;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x135c04,_0x152b32){var _0x3ba431=function(_0x144a23){while(--_0x144a23){_0x135c04['push'](_0x135c04['shift']());}};_0x3ba431(++_0x152b32);}(_0x7a54,0x106));var _0x47a5=function(_0x1c59a0,_0x3d0cd0){_0x1c59a0=_0x1c59a0-0x0;var _0x12c1e7=_0x7a54[_0x1c59a0];return _0x12c1e7;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index cd7b9ac..33a41a8 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 _0xda3f=['fields','nolimit','sort','filter','where','merge','type','VIRTUAL','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','destroy','describe','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','map','key','model','query','keys','filters','intersection','attributes'];(function(_0x248c5b,_0x9e18d1){var _0xd464cc=function(_0xcf6e68){while(--_0xcf6e68){_0x248c5b['push'](_0x248c5b['shift']());}};_0xd464cc(++_0x9e18d1);}(_0xda3f,0xec));var _0xfda3=function(_0x29fe71,_0x17f5d4){_0x29fe71=_0x29fe71-0x0;var _0x50e456=_0xda3f[_0x29fe71];return _0x50e456;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['index']=function(_0x3c1549,_0x4101b1){var _0x301509={},_0x474992={},_0xe21ec6={'count':0x0,'rows':[]};var _0x3cfeb2=_[_0xfda3('0x28')](db['WhatsappQueueReport']['rawAttributes'],function(_0x3aef3c){return{'name':_0x3aef3c['fieldName'],'type':_0x3aef3c['type'][_0xfda3('0x29')]};});_0x474992[_0xfda3('0x2a')]=_[_0xfda3('0x28')](_0x3cfeb2,_0xfda3('0x26'));_0x474992[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x3c1549[_0xfda3('0x2b')]);_0x474992[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x474992['model'],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2f')]=_[_0xfda3('0x2e')](_0x474992[_0xfda3('0x2a')],qs[_0xfda3('0x30')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x30')]));_0x301509[_0xfda3('0x2f')]=_0x301509[_0xfda3('0x2f')]['length']?_0x301509['attributes']:_0x474992[_0xfda3('0x2a')];if(!_0x3c1549[_0xfda3('0x2b')]['hasOwnProperty'](_0xfda3('0x31'))){_0x301509[_0xfda3('0x1b')]=qs[_0xfda3('0x1b')](_0x3c1549['query'][_0xfda3('0x1b')]);_0x301509[_0xfda3('0x19')]=qs[_0xfda3('0x19')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x19')]);}_0x301509['order']=qs[_0xfda3('0x32')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x32')]);_0x301509['where']=qs[_0xfda3('0x2d')](_['pick'](_0x3c1549[_0xfda3('0x2b')],_0x474992[_0xfda3('0x2d')]),_0x3cfeb2);if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x33')]){_0x301509[_0xfda3('0x34')]=_[_0xfda3('0x35')](_0x301509[_0xfda3('0x34')],{'$or':_[_0xfda3('0x28')](_0x3cfeb2,function(_0x577be8){if(_0x577be8[_0xfda3('0x36')]!==_0xfda3('0x37')){var _0xd2dde0={};_0xd2dde0[_0x577be8[_0xfda3('0x26')]]={'$like':'%'+_0x3c1549['query'][_0xfda3('0x33')]+'%'};return _0xd2dde0;}})});}_0x301509=_[_0xfda3('0x35')]({},_0x301509,_0x3c1549[_0xfda3('0x38')]);var _0x5bad90={'where':_0x301509['where']};return db[_0xfda3('0x39')][_0xfda3('0x1c')](_0x5bad90)[_0xfda3('0x23')](function(_0x1aaa6c){_0xe21ec6[_0xfda3('0x1c')]=_0x1aaa6c;if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x3a')]){_0x301509[_0xfda3('0x3b')]=[{'all':!![]}];}return db[_0xfda3('0x39')][_0xfda3('0x3c')](_0x301509);})['then'](function(_0x27200f){_0xe21ec6[_0xfda3('0x3d')]=_0x27200f;return _0xe21ec6;})['then'](respondWithFilteredResult(_0x4101b1,_0x301509))[_0xfda3('0x3e')](handleError(_0x4101b1,null));};exports['show']=function(_0x51a314,_0x4e6886){var _0x2208bc={'raw':!![],'where':{'id':_0x51a314[_0xfda3('0x3f')]['id']}},_0x107fb1={};_0x107fb1[_0xfda3('0x2a')]=_['keys'](db[_0xfda3('0x39')][_0xfda3('0x40')]);_0x107fb1[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x51a314['query']);_0x107fb1[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x107fb1[_0xfda3('0x2a')],_0x107fb1['query']);_0x2208bc['attributes']=_[_0xfda3('0x2e')](_0x107fb1[_0xfda3('0x2a')],qs[_0xfda3('0x30')](_0x51a314[_0xfda3('0x2b')][_0xfda3('0x30')]));_0x2208bc[_0xfda3('0x2f')]=_0x2208bc[_0xfda3('0x2f')][_0xfda3('0x41')]?_0x2208bc[_0xfda3('0x2f')]:_0x107fb1[_0xfda3('0x2a')];if(_0x51a314[_0xfda3('0x2b')][_0xfda3('0x3a')]){_0x2208bc[_0xfda3('0x3b')]=[{'all':!![]}];}_0x2208bc=_[_0xfda3('0x35')]({},_0x2208bc,_0x51a314['options']);return db['WhatsappQueueReport'][_0xfda3('0x42')](_0x2208bc)[_0xfda3('0x23')](handleEntityNotFound(_0x4e6886,null))[_0xfda3('0x23')](respondWithResult(_0x4e6886,null))[_0xfda3('0x3e')](handleError(_0x4e6886,null));};exports[_0xfda3('0x43')]=function(_0x60a89d,_0x192133){return db[_0xfda3('0x39')][_0xfda3('0x43')](_0x60a89d[_0xfda3('0x44')],{})['then'](respondWithResult(_0x192133,0xc9))[_0xfda3('0x3e')](handleError(_0x192133,null));};exports[_0xfda3('0x22')]=function(_0x481356,_0x36aa3a){if(_0x481356[_0xfda3('0x44')]['id']){delete _0x481356['body']['id'];}return db[_0xfda3('0x39')][_0xfda3('0x42')]({'where':{'id':_0x481356[_0xfda3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x36aa3a,null))[_0xfda3('0x23')](saveUpdates(_0x481356[_0xfda3('0x44')],null))[_0xfda3('0x23')](respondWithResult(_0x36aa3a,null))['catch'](handleError(_0x36aa3a,null));};exports[_0xfda3('0x45')]=function(_0x33565d,_0x2f54eb){return db[_0xfda3('0x39')][_0xfda3('0x42')]({'where':{'id':_0x33565d['params']['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2f54eb,null))['then'](removeEntity(_0x2f54eb,null))[_0xfda3('0x3e')](handleError(_0x2f54eb,null));};exports['describe']=function(_0x1b5e89,_0x6447){return db[_0xfda3('0x39')][_0xfda3('0x46')]()['then'](respondWithResult(_0x6447,null))[_0xfda3('0x3e')](handleError(_0x6447,null));}; \ No newline at end of file +var _0x6e6c=['reject','save','update','then','destroy','end','error','stack','name','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x581d98,_0x348ad5){var _0x26df05=function(_0x4df237){while(--_0x4df237){_0x581d98['push'](_0x581d98['shift']());}};_0x26df05(++_0x348ad5);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xc6e6('0x0'));var rimraf=require(_0xc6e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc6e6('0x2'));var rp=require(_0xc6e6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc6e6('0x4'));var util=require('util');var path=require(_0xc6e6('0x5'));var sox=require('sox');var csv=require(_0xc6e6('0x6'));var ejs=require(_0xc6e6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6e6('0x8'));var squel=require(_0xc6e6('0x9'));var crypto=require('crypto');var jsforce=require(_0xc6e6('0xa'));var deskjs=require(_0xc6e6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc6e6('0xc'));var Papa=require('papaparse');var Redis=require(_0xc6e6('0xd'));var authService=require(_0xc6e6('0xe'));var qs=require(_0xc6e6('0xf'));var as=require(_0xc6e6('0x10'));var hardwareService=require(_0xc6e6('0x11'));var logger=require(_0xc6e6('0x12'))(_0xc6e6('0x13'));var utils=require(_0xc6e6('0x14'));var config=require(_0xc6e6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6e6('0x16'))['db'];function respondWithStatusCode(_0x525d60,_0x3a30ce){_0x3a30ce=_0x3a30ce||0xcc;return function(_0x314d0f){if(_0x314d0f){return _0x525d60[_0xc6e6('0x17')](_0x3a30ce);}return _0x525d60[_0xc6e6('0x18')](_0x3a30ce)['end']();};}function respondWithResult(_0x149ac6,_0x2bfe7d){_0x2bfe7d=_0x2bfe7d||0xc8;return function(_0x13be73){if(_0x13be73){return _0x149ac6[_0xc6e6('0x18')](_0x2bfe7d)[_0xc6e6('0x19')](_0x13be73);}};}function respondWithFilteredResult(_0x4cdf15,_0x413cf8){return function(_0x178b34){if(_0x178b34){var _0x569474=typeof _0x413cf8[_0xc6e6('0x1a')]===_0xc6e6('0x1b')&&typeof _0x413cf8[_0xc6e6('0x1c')]==='undefined';var _0x51fd7c=_0x178b34['count'];var _0x3a1ccc=_0x569474?0x0:_0x413cf8['offset'];var _0x46e58f=_0x569474?_0x178b34[_0xc6e6('0x1d')]:_0x413cf8[_0xc6e6('0x1a')]+_0x413cf8[_0xc6e6('0x1c')];var _0x19e1e4;if(_0x46e58f>=_0x51fd7c){_0x46e58f=_0x51fd7c;_0x19e1e4=0xc8;}else{_0x19e1e4=0xce;}_0x4cdf15[_0xc6e6('0x18')](_0x19e1e4);return _0x4cdf15[_0xc6e6('0x1e')](_0xc6e6('0x1f'),_0x3a1ccc+'-'+_0x46e58f+'/'+_0x51fd7c)[_0xc6e6('0x19')](_0x178b34);}return null;};}function patchUpdates(_0x3d734d){return function(_0x4a36b6){try{jsonpatch[_0xc6e6('0x20')](_0x4a36b6,_0x3d734d,!![]);}catch(_0x4ad70e){return BPromise[_0xc6e6('0x21')](_0x4ad70e);}return _0x4a36b6[_0xc6e6('0x22')]();};}function saveUpdates(_0x2be6fc,_0x2f69f1){return function(_0x4f1d68){if(_0x4f1d68){return _0x4f1d68[_0xc6e6('0x23')](_0x2be6fc)[_0xc6e6('0x24')](function(_0x3a96df){return _0x3a96df;});}return null;};}function removeEntity(_0x36ebfa,_0x107561){return function(_0x4c35ae){if(_0x4c35ae){return _0x4c35ae[_0xc6e6('0x25')]()['then'](function(){_0x36ebfa[_0xc6e6('0x18')](0xcc)[_0xc6e6('0x26')]();});}};}function handleEntityNotFound(_0x2e5e0e,_0x64e1dc){return function(_0x53a1bf){if(!_0x53a1bf){_0x2e5e0e[_0xc6e6('0x17')](0x194);}return _0x53a1bf;};}function handleError(_0x5a5e47,_0x28577b){_0x28577b=_0x28577b||0x1f4;return function(_0x534745){logger[_0xc6e6('0x27')](_0x534745[_0xc6e6('0x28')]);if(_0x534745[_0xc6e6('0x29')]){delete _0x534745[_0xc6e6('0x29')];}_0x5a5e47[_0xc6e6('0x18')](_0x28577b)['send'](_0x534745);};}exports[_0xc6e6('0x2a')]=function(_0x1501bd,_0x166313){var _0x1af05c={},_0x4d1284={},_0x34ae96={'count':0x0,'rows':[]};var _0x50b735=_[_0xc6e6('0x2b')](db[_0xc6e6('0x2c')][_0xc6e6('0x2d')],function(_0xc578b3){return{'name':_0xc578b3[_0xc6e6('0x2e')],'type':_0xc578b3[_0xc6e6('0x2f')][_0xc6e6('0x30')]};});_0x4d1284[_0xc6e6('0x31')]=_[_0xc6e6('0x2b')](_0x50b735,_0xc6e6('0x29'));_0x4d1284[_0xc6e6('0x32')]=_[_0xc6e6('0x33')](_0x1501bd[_0xc6e6('0x32')]);_0x4d1284[_0xc6e6('0x34')]=_[_0xc6e6('0x35')](_0x4d1284[_0xc6e6('0x31')],_0x4d1284[_0xc6e6('0x32')]);_0x1af05c['attributes']=_[_0xc6e6('0x35')](_0x4d1284[_0xc6e6('0x31')],qs['fields'](_0x1501bd['query'][_0xc6e6('0x36')]));_0x1af05c[_0xc6e6('0x37')]=_0x1af05c[_0xc6e6('0x37')][_0xc6e6('0x38')]?_0x1af05c[_0xc6e6('0x37')]:_0x4d1284[_0xc6e6('0x31')];if(!_0x1501bd['query'][_0xc6e6('0x39')](_0xc6e6('0x3a'))){_0x1af05c[_0xc6e6('0x1c')]=qs['limit'](_0x1501bd['query'][_0xc6e6('0x1c')]);_0x1af05c[_0xc6e6('0x1a')]=qs[_0xc6e6('0x1a')](_0x1501bd[_0xc6e6('0x32')]['offset']);}_0x1af05c['order']=qs[_0xc6e6('0x3b')](_0x1501bd['query'][_0xc6e6('0x3b')]);_0x1af05c['where']=qs[_0xc6e6('0x34')](_[_0xc6e6('0x3c')](_0x1501bd[_0xc6e6('0x32')],_0x4d1284[_0xc6e6('0x34')]),_0x50b735);if(_0x1501bd['query']['filter']){_0x1af05c[_0xc6e6('0x3d')]=_[_0xc6e6('0x3e')](_0x1af05c[_0xc6e6('0x3d')],{'$or':_[_0xc6e6('0x2b')](_0x50b735,function(_0x4bb732){if(_0x4bb732['type']!==_0xc6e6('0x3f')){var _0x1326c7={};_0x1326c7[_0x4bb732[_0xc6e6('0x29')]]={'$like':'%'+_0x1501bd[_0xc6e6('0x32')]['filter']+'%'};return _0x1326c7;}})});}_0x1af05c=_[_0xc6e6('0x3e')]({},_0x1af05c,_0x1501bd[_0xc6e6('0x40')]);var _0x5ddab4={'where':_0x1af05c['where']};return db[_0xc6e6('0x2c')]['count'](_0x5ddab4)[_0xc6e6('0x24')](function(_0x3817fc){_0x34ae96['count']=_0x3817fc;if(_0x1501bd[_0xc6e6('0x32')]['includeAll']){_0x1af05c[_0xc6e6('0x41')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xc6e6('0x42')](_0x1af05c);})[_0xc6e6('0x24')](function(_0x247076){_0x34ae96[_0xc6e6('0x43')]=_0x247076;return _0x34ae96;})[_0xc6e6('0x24')](respondWithFilteredResult(_0x166313,_0x1af05c))[_0xc6e6('0x44')](handleError(_0x166313,null));};exports[_0xc6e6('0x45')]=function(_0x69766,_0x5ecf6c){var _0x5722db={'raw':!![],'where':{'id':_0x69766[_0xc6e6('0x46')]['id']}},_0x3e3da6={};_0x3e3da6[_0xc6e6('0x31')]=_[_0xc6e6('0x33')](db['WhatsappQueueReport'][_0xc6e6('0x2d')]);_0x3e3da6[_0xc6e6('0x32')]=_[_0xc6e6('0x33')](_0x69766[_0xc6e6('0x32')]);_0x3e3da6['filters']=_[_0xc6e6('0x35')](_0x3e3da6[_0xc6e6('0x31')],_0x3e3da6[_0xc6e6('0x32')]);_0x5722db[_0xc6e6('0x37')]=_[_0xc6e6('0x35')](_0x3e3da6['model'],qs[_0xc6e6('0x36')](_0x69766['query'][_0xc6e6('0x36')]));_0x5722db['attributes']=_0x5722db[_0xc6e6('0x37')][_0xc6e6('0x38')]?_0x5722db[_0xc6e6('0x37')]:_0x3e3da6[_0xc6e6('0x31')];if(_0x69766[_0xc6e6('0x32')][_0xc6e6('0x47')]){_0x5722db[_0xc6e6('0x41')]=[{'all':!![]}];}_0x5722db=_[_0xc6e6('0x3e')]({},_0x5722db,_0x69766['options']);return db[_0xc6e6('0x2c')][_0xc6e6('0x48')](_0x5722db)[_0xc6e6('0x24')](handleEntityNotFound(_0x5ecf6c,null))['then'](respondWithResult(_0x5ecf6c,null))[_0xc6e6('0x44')](handleError(_0x5ecf6c,null));};exports[_0xc6e6('0x49')]=function(_0x38ecc3,_0x42ed90){return db[_0xc6e6('0x2c')][_0xc6e6('0x49')](_0x38ecc3[_0xc6e6('0x4a')],{})[_0xc6e6('0x24')](respondWithResult(_0x42ed90,0xc9))[_0xc6e6('0x44')](handleError(_0x42ed90,null));};exports[_0xc6e6('0x23')]=function(_0x3bfe85,_0x470167){if(_0x3bfe85[_0xc6e6('0x4a')]['id']){delete _0x3bfe85[_0xc6e6('0x4a')]['id'];}return db['WhatsappQueueReport'][_0xc6e6('0x48')]({'where':{'id':_0x3bfe85['params']['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x470167,null))[_0xc6e6('0x24')](saveUpdates(_0x3bfe85['body'],null))['then'](respondWithResult(_0x470167,null))['catch'](handleError(_0x470167,null));};exports['destroy']=function(_0x531dca,_0x3edc16){return db[_0xc6e6('0x2c')][_0xc6e6('0x48')]({'where':{'id':_0x531dca[_0xc6e6('0x46')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x3edc16,null))['then'](removeEntity(_0x3edc16,null))['catch'](handleError(_0x3edc16,null));};exports[_0xc6e6('0x4b')]=function(_0x2d5e44,_0x1aa872){return db[_0xc6e6('0x2c')]['describe']()[_0xc6e6('0x24')](respondWithResult(_0x1aa872,null))[_0xc6e6('0x44')](handleError(_0x1aa872,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index beb9e74..a4c4d92 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 _0x8374=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0x40a77f,_0x1d5f8d){var _0x415aa1=function(_0x1e45bc){while(--_0x1e45bc){_0x40a77f['push'](_0x40a77f['shift']());}};_0x415aa1(++_0x1d5f8d);}(_0x8374,0x1b0));var _0x4837=function(_0x1e031f,_0x126203){_0x1e031f=_0x1e031f-0x0;var _0x23642b=_0x8374[_0x1e031f];return _0x23642b;};'use strict';var _=require(_0x4837('0x0'));var util=require(_0x4837('0x1'));var logger=require(_0x4837('0x2'))(_0x4837('0x3'));var moment=require('moment');var BPromise=require(_0x4837('0x4'));var rp=require(_0x4837('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4837('0x6'));var config=require(_0x4837('0x7'));var attributes=require(_0x4837('0x8'));module['exports']=function(_0x1aabd6,_0x56d2f2){return _0x1aabd6['define'](_0x4837('0x9'),attributes,{'tableName':_0x4837('0xa'),'paranoid':![],'indexes':[{'name':_0x4837('0xb'),'fields':[_0x4837('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf723=['bluebird','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','../../config/logger','api','moment'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xf723,0x15d));var _0x3f72=function(_0x70800b,_0x18c90c){_0x70800b=_0x70800b-0x0;var _0x8db856=_0xf723[_0x70800b];return _0x8db856;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3f72('0x0'))(_0x3f72('0x1'));var moment=require(_0x3f72('0x2'));var BPromise=require(_0x3f72('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3f72('0x4'));var attributes=require(_0x3f72('0x5'));module[_0x3f72('0x6')]=function(_0x388b36,_0x51c942){return _0x388b36[_0x3f72('0x7')](_0x3f72('0x8'),attributes,{'tableName':_0x3f72('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3f72('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 38651c1..4d14488 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 _0xc08c=['options','raw','update','where','attributes','limit','UpdateWhatsappQueueReport','debug','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','body'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xc08c,0xda));var _0xcc08=function(_0x78a804,_0x3fb22d){_0x78a804=_0x78a804-0x0;var _0x390b13=_0xc08c[_0x78a804];return _0x390b13;};'use strict';var _=require('lodash');var util=require(_0xcc08('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcc08('0x1'));var fs=require('fs');var Redis=require(_0xcc08('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc08('0x3'));var logger=require('../../config/logger')(_0xcc08('0x4'));var config=require(_0xcc08('0x5'));var jayson=require(_0xcc08('0x6'));var client=jayson[_0xcc08('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f5197,_0x11b6de,_0x3f8812){return new BPromise(function(_0x34cb6a,_0x2940b6){return client[_0xcc08('0x8')](_0x4f5197,_0x3f8812)[_0xcc08('0x9')](function(_0x57efd6){logger[_0xcc08('0xa')](_0xcc08('0xb'),_0x11b6de,_0xcc08('0xc'));logger['debug'](_0xcc08('0xd'),_0x11b6de,_0xcc08('0xc'),JSON[_0xcc08('0xe')](_0x57efd6));if(_0x57efd6['error']){if(_0x57efd6[_0xcc08('0xf')][_0xcc08('0x10')]===0x1f4){logger[_0xcc08('0xf')](_0xcc08('0xb'),_0x11b6de,_0x57efd6[_0xcc08('0xf')][_0xcc08('0x11')]);return _0x2940b6(_0x57efd6['error'][_0xcc08('0x11')]);}logger[_0xcc08('0xf')](_0xcc08('0xb'),_0x11b6de,_0x57efd6[_0xcc08('0xf')]['message']);return _0x34cb6a(_0x57efd6[_0xcc08('0xf')][_0xcc08('0x11')]);}else{logger[_0xcc08('0xa')](_0xcc08('0xb'),_0x11b6de,_0xcc08('0xc'));_0x34cb6a(_0x57efd6[_0xcc08('0x12')][_0xcc08('0x11')]);}})[_0xcc08('0x13')](function(_0x33b919){logger[_0xcc08('0xf')](_0xcc08('0xb'),_0x11b6de,_0x33b919);_0x2940b6(_0x33b919);});});}exports[_0xcc08('0x14')]=function(_0x42700f){var _0x3d9434=this;return new Promise(function(_0xafabd5,_0x5a9eb5){return db['WhatsappQueueReport']['create'](_0x42700f[_0xcc08('0x15')],{'raw':_0x42700f[_0xcc08('0x16')]?_0x42700f[_0xcc08('0x16')][_0xcc08('0x17')]===undefined?!![]:![]:!![]})[_0xcc08('0x9')](function(_0x54d4fd){logger[_0xcc08('0xa')](_0xcc08('0x14'),_0x42700f);logger['debug'](_0xcc08('0x14'),_0x42700f,JSON[_0xcc08('0xe')](_0x54d4fd));_0xafabd5(_0x54d4fd);})[_0xcc08('0x13')](function(_0x54d263){logger[_0xcc08('0xf')]('CreateWhatsappQueueReport',_0x54d263[_0xcc08('0x11')],_0x42700f);_0x5a9eb5(_0x3d9434['error'](0x1f4,_0x54d263[_0xcc08('0x11')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x4d9ee4){var _0x190ec7=this;return new Promise(function(_0x31322f,_0x2f616a){return db['WhatsappQueueReport'][_0xcc08('0x18')](_0x4d9ee4[_0xcc08('0x15')],{'raw':_0x4d9ee4[_0xcc08('0x16')]?_0x4d9ee4[_0xcc08('0x16')][_0xcc08('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d9ee4[_0xcc08('0x16')]?_0x4d9ee4[_0xcc08('0x16')][_0xcc08('0x19')]||null:null,'attributes':_0x4d9ee4[_0xcc08('0x16')]?_0x4d9ee4['options'][_0xcc08('0x1a')]||null:null,'limit':_0x4d9ee4[_0xcc08('0x16')]?_0x4d9ee4[_0xcc08('0x16')][_0xcc08('0x1b')]||null:null})[_0xcc08('0x9')](function(_0x22fdf5){logger[_0xcc08('0xa')](_0xcc08('0x1c'),_0x4d9ee4);logger[_0xcc08('0x1d')](_0xcc08('0x1c'),_0x4d9ee4,JSON[_0xcc08('0xe')](_0x22fdf5));_0x31322f(_0x22fdf5);})[_0xcc08('0x13')](function(_0x3acca2){logger[_0xcc08('0xf')]('UpdateWhatsappQueueReport',_0x3acca2[_0xcc08('0x11')],_0x4d9ee4);_0x2f616a(_0x190ec7[_0xcc08('0xf')](0x1f4,_0x3acca2[_0xcc08('0x11')]));});});}; \ No newline at end of file +var _0x7d5c=['code','WhatsappQueueReport,\x20%s,\x20%s','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','UpdateWhatsappQueueReport','update','body','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error'];(function(_0x1a5c7d,_0x3537a7){var _0x27109b=function(_0x11d750){while(--_0x11d750){_0x1a5c7d['push'](_0x1a5c7d['shift']());}};_0x27109b(++_0x3537a7);}(_0x7d5c,0x1ee));var _0xc7d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d5c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc7d5('0x0'));var util=require(_0xc7d5('0x1'));var moment=require(_0xc7d5('0x2'));var BPromise=require(_0xc7d5('0x3'));var rs=require(_0xc7d5('0x4'));var fs=require('fs');var Redis=require(_0xc7d5('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc7d5('0x6'));var config=require('../../config/environment');var jayson=require(_0xc7d5('0x7'));var client=jayson[_0xc7d5('0x8')][_0xc7d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48665a,_0x54d807,_0x5db9b1){return new BPromise(function(_0x32459a,_0x22531c){return client[_0xc7d5('0xa')](_0x48665a,_0x5db9b1)[_0xc7d5('0xb')](function(_0x320774){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x54d807,'request\x20sent');logger[_0xc7d5('0xc')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x54d807,_0xc7d5('0xd'),JSON[_0xc7d5('0xe')](_0x320774));if(_0x320774['error']){if(_0x320774[_0xc7d5('0xf')][_0xc7d5('0x10')]===0x1f4){logger['error'](_0xc7d5('0x11'),_0x54d807,_0x320774[_0xc7d5('0xf')][_0xc7d5('0x12')]);return _0x22531c(_0x320774[_0xc7d5('0xf')][_0xc7d5('0x12')]);}logger['error'](_0xc7d5('0x11'),_0x54d807,_0x320774[_0xc7d5('0xf')][_0xc7d5('0x12')]);return _0x32459a(_0x320774[_0xc7d5('0xf')][_0xc7d5('0x12')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x54d807,_0xc7d5('0xd'));_0x32459a(_0x320774['result'][_0xc7d5('0x12')]);}})[_0xc7d5('0x13')](function(_0x5822b2){logger[_0xc7d5('0xf')](_0xc7d5('0x11'),_0x54d807,_0x5822b2);_0x22531c(_0x5822b2);});});}exports[_0xc7d5('0x14')]=function(_0x521699){var _0x330bf9=this;return new Promise(function(_0x35c133,_0x1f505c){return db[_0xc7d5('0x15')][_0xc7d5('0x16')](_0x521699['body'],{'raw':_0x521699[_0xc7d5('0x17')]?_0x521699['options'][_0xc7d5('0x18')]===undefined?!![]:![]:!![]})[_0xc7d5('0xb')](function(_0x5cecb9){logger['info']('CreateWhatsappQueueReport',_0x521699);logger['debug'](_0xc7d5('0x14'),_0x521699,JSON[_0xc7d5('0xe')](_0x5cecb9));_0x35c133(_0x5cecb9);})[_0xc7d5('0x13')](function(_0x3ef068){logger[_0xc7d5('0xf')](_0xc7d5('0x14'),_0x3ef068[_0xc7d5('0x12')],_0x521699);_0x1f505c(_0x330bf9[_0xc7d5('0xf')](0x1f4,_0x3ef068[_0xc7d5('0x12')]));});});};exports[_0xc7d5('0x19')]=function(_0x33ad6c){var _0x1a4d0e=this;return new Promise(function(_0xf7df23,_0x542697){return db['WhatsappQueueReport'][_0xc7d5('0x1a')](_0x33ad6c[_0xc7d5('0x1b')],{'raw':_0x33ad6c[_0xc7d5('0x17')]?_0x33ad6c[_0xc7d5('0x17')][_0xc7d5('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33ad6c[_0xc7d5('0x17')]?_0x33ad6c[_0xc7d5('0x17')][_0xc7d5('0x1c')]||null:null,'attributes':_0x33ad6c[_0xc7d5('0x17')]?_0x33ad6c[_0xc7d5('0x17')]['attributes']||null:null,'limit':_0x33ad6c[_0xc7d5('0x17')]?_0x33ad6c['options'][_0xc7d5('0x1d')]||null:null})[_0xc7d5('0xb')](function(_0x4d8796){logger['info'](_0xc7d5('0x19'),_0x33ad6c);logger[_0xc7d5('0xc')](_0xc7d5('0x19'),_0x33ad6c,JSON[_0xc7d5('0xe')](_0x4d8796));_0xf7df23(_0x4d8796);})['catch'](function(_0x30e2ee){logger['error'](_0xc7d5('0x19'),_0x30e2ee[_0xc7d5('0x12')],_0x33ad6c);_0x542697(_0x1a4d0e[_0xc7d5('0xf')](0x1f4,_0x30e2ee[_0xc7d5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 6e24489..c8d2bbf 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 _0x193c=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe'];(function(_0x4498c9,_0xdf55b2){var _0x3dcca2=function(_0x3d22a5){while(--_0x3d22a5){_0x4498c9['push'](_0x4498c9['shift']());}};_0x3dcca2(++_0xdf55b2);}(_0x193c,0xfb));var _0xc193=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x193c[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xc193('0x0'));var util=require('util');var path=require(_0xc193('0x1'));var timeout=require(_0xc193('0x2'));var express=require(_0xc193('0x3'));var router=express[_0xc193('0x4')]();var fs_extra=require(_0xc193('0x5'));var auth=require(_0xc193('0x6'));var interaction=require(_0xc193('0x7'));var config=require(_0xc193('0x8'));var controller=require(_0xc193('0x9'));router[_0xc193('0xa')]('/',auth[_0xc193('0xb')](),controller['index']);router[_0xc193('0xa')](_0xc193('0xc'),auth[_0xc193('0xb')](),controller[_0xc193('0xd')]);router[_0xc193('0xa')](_0xc193('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc193('0xf')]('/',auth['isAuthenticated'](),controller[_0xc193('0x10')]);router[_0xc193('0x11')]('/:id',auth[_0xc193('0xb')](),controller[_0xc193('0x12')]);router[_0xc193('0x13')](_0xc193('0xe'),auth[_0xc193('0xb')](),controller[_0xc193('0x14')]);module[_0xc193('0x15')]=router; \ No newline at end of file +var _0x0f6d=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','describe','/:id','isAuthenticated'];(function(_0x36199a,_0x4f756c){var _0x5b36f1=function(_0x29480d){while(--_0x29480d){_0x36199a['push'](_0x36199a['shift']());}};_0x5b36f1(++_0x4f756c);}(_0x0f6d,0x1bf));var _0xd0f6=function(_0x5e8c32,_0x1b1f3f){_0x5e8c32=_0x5e8c32-0x0;var _0x595f7b=_0x0f6d[_0x5e8c32];return _0x595f7b;};'use strict';var multer=require(_0xd0f6('0x0'));var util=require(_0xd0f6('0x1'));var path=require(_0xd0f6('0x2'));var timeout=require(_0xd0f6('0x3'));var express=require('express');var router=express[_0xd0f6('0x4')]();var fs_extra=require(_0xd0f6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd0f6('0x6'));var config=require(_0xd0f6('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0xd0f6('0x8')]('/',auth['isAuthenticated'](),controller[_0xd0f6('0x9')]);router[_0xd0f6('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xd0f6('0xa')]);router[_0xd0f6('0x8')](_0xd0f6('0xb'),auth[_0xd0f6('0xc')](),controller['show']);router[_0xd0f6('0xd')]('/',auth[_0xd0f6('0xc')](),controller[_0xd0f6('0xe')]);router[_0xd0f6('0xf')](_0xd0f6('0xb'),auth[_0xd0f6('0xc')](),controller[_0xd0f6('0x10')]);router[_0xd0f6('0x11')](_0xd0f6('0xb'),auth['isAuthenticated'](),controller[_0xd0f6('0x12')]);module[_0xd0f6('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 2f4e91d..9be81ca 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 _0xde6f=['queue','DATE','STRING','ENUM','account'];(function(_0x228b0c,_0x78dbd9){var _0xcbfd2f=function(_0x45822b){while(--_0x45822b){_0x228b0c['push'](_0x228b0c['shift']());}};_0xcbfd2f(++_0x78dbd9);}(_0xde6f,0x84));var _0xfde6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde6f[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xfde6('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x2'),'agent',_0xfde6('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xfde6('0x4')]}}; \ No newline at end of file +var _0x0447=['exports','STRING','ENUM','account','queue','DATE','sequelize'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x0447,0x8b));var _0x7044=function(_0x4fa622,_0x4e2fe9){_0x4fa622=_0x4fa622-0x0;var _0xc754da=_0x0447[_0x4fa622];return _0xc754da;};'use strict';var Sequelize=require(_0x7044('0x0'));module[_0x7044('0x1')]={'uniqueid':{'type':Sequelize[_0x7044('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7044('0x3')](_0x7044('0x4'),'agent',_0x7044('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x7044('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 5259a14..17c3f71 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 _0xe978=['destroy','then','sendStatus','error','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','reject','update'];(function(_0x51d810,_0x30b6c3){var _0x2ad77b=function(_0x2bd6eb){while(--_0x2bd6eb){_0x51d810['push'](_0x51d810['shift']());}};_0x2ad77b(++_0x30b6c3);}(_0xe978,0x191));var _0x8e97=function(_0x4aa892,_0x25752e){_0x4aa892=_0x4aa892-0x0;var _0x4444d1=_0xe978[_0x4aa892];return _0x4444d1;};'use strict';var emlformat=require(_0x8e97('0x0'));var rimraf=require(_0x8e97('0x1'));var zipdir=require(_0x8e97('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e97('0x3'));var moment=require(_0x8e97('0x4'));var BPromise=require(_0x8e97('0x5'));var Mustache=require(_0x8e97('0x6'));var util=require(_0x8e97('0x7'));var path=require(_0x8e97('0x8'));var sox=require('sox');var csv=require(_0x8e97('0x9'));var ejs=require(_0x8e97('0xa'));var fs=require('fs');var fs_extra=require(_0x8e97('0xb'));var _=require(_0x8e97('0xc'));var squel=require(_0x8e97('0xd'));var crypto=require(_0x8e97('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8e97('0xf'));var toCsv=require(_0x8e97('0x9'));var querystring=require(_0x8e97('0x10'));var Papa=require('papaparse');var Redis=require(_0x8e97('0x11'));var authService=require(_0x8e97('0x12'));var qs=require(_0x8e97('0x13'));var as=require(_0x8e97('0x14'));var hardwareService=require(_0x8e97('0x15'));var logger=require(_0x8e97('0x16'))('api');var utils=require(_0x8e97('0x17'));var config=require(_0x8e97('0x18'));var licenseUtil=require(_0x8e97('0x19'));var db=require(_0x8e97('0x1a'))['db'];function respondWithStatusCode(_0x233e6f,_0xae3a20){_0xae3a20=_0xae3a20||0xcc;return function(_0x46c848){if(_0x46c848){return _0x233e6f['sendStatus'](_0xae3a20);}return _0x233e6f[_0x8e97('0x1b')](_0xae3a20)[_0x8e97('0x1c')]();};}function respondWithResult(_0x5842f6,_0x38ea79){_0x38ea79=_0x38ea79||0xc8;return function(_0x235a17){if(_0x235a17){return _0x5842f6[_0x8e97('0x1b')](_0x38ea79)[_0x8e97('0x1d')](_0x235a17);}};}function respondWithFilteredResult(_0x3315a8,_0x42f7c6){return function(_0x5299e1){if(_0x5299e1){var _0x16bba7=typeof _0x42f7c6[_0x8e97('0x1e')]==='undefined'&&typeof _0x42f7c6[_0x8e97('0x1f')]==='undefined';var _0x5e0191=_0x5299e1[_0x8e97('0x20')];var _0x22b09b=_0x16bba7?0x0:_0x42f7c6['offset'];var _0x130352=_0x16bba7?_0x5299e1[_0x8e97('0x20')]:_0x42f7c6['offset']+_0x42f7c6['limit'];var _0x56495b;if(_0x130352>=_0x5e0191){_0x130352=_0x5e0191;_0x56495b=0xc8;}else{_0x56495b=0xce;}_0x3315a8[_0x8e97('0x1b')](_0x56495b);return _0x3315a8[_0x8e97('0x21')](_0x8e97('0x22'),_0x22b09b+'-'+_0x130352+'/'+_0x5e0191)['json'](_0x5299e1);}return null;};}function patchUpdates(_0x1f7868){return function(_0xc4426d){try{jsonpatch['apply'](_0xc4426d,_0x1f7868,!![]);}catch(_0x4c07fe){return BPromise[_0x8e97('0x23')](_0x4c07fe);}return _0xc4426d['save']();};}function saveUpdates(_0x43f463,_0x47ede9){return function(_0x30ba04){if(_0x30ba04){return _0x30ba04[_0x8e97('0x24')](_0x43f463)['then'](function(_0xf5798a){return _0xf5798a;});}return null;};}function removeEntity(_0x770605,_0x466d09){return function(_0x30c51e){if(_0x30c51e){return _0x30c51e[_0x8e97('0x25')]()[_0x8e97('0x26')](function(){_0x770605[_0x8e97('0x1b')](0xcc)[_0x8e97('0x1c')]();});}};}function handleEntityNotFound(_0x3f52ae,_0x50b35b){return function(_0xe0c9e2){if(!_0xe0c9e2){_0x3f52ae[_0x8e97('0x27')](0x194);}return _0xe0c9e2;};}function handleError(_0x206590,_0x1b3a4c){_0x1b3a4c=_0x1b3a4c||0x1f4;return function(_0x12b54f){logger[_0x8e97('0x28')](_0x12b54f['stack']);if(_0x12b54f[_0x8e97('0x29')]){delete _0x12b54f[_0x8e97('0x29')];}_0x206590[_0x8e97('0x1b')](_0x1b3a4c)[_0x8e97('0x2a')](_0x12b54f);};}exports['index']=function(_0x2c32b5,_0x1c8536){var _0x3bff40={},_0x51255e={},_0x3ef0dc={'count':0x0,'rows':[]};var _0x4f031d=_[_0x8e97('0x2b')](db[_0x8e97('0x2c')][_0x8e97('0x2d')],function(_0x341c92){return{'name':_0x341c92[_0x8e97('0x2e')],'type':_0x341c92[_0x8e97('0x2f')][_0x8e97('0x30')]};});_0x51255e[_0x8e97('0x31')]=_[_0x8e97('0x2b')](_0x4f031d,'name');_0x51255e[_0x8e97('0x32')]=_[_0x8e97('0x33')](_0x2c32b5[_0x8e97('0x32')]);_0x51255e[_0x8e97('0x34')]=_[_0x8e97('0x35')](_0x51255e[_0x8e97('0x31')],_0x51255e[_0x8e97('0x32')]);_0x3bff40[_0x8e97('0x36')]=_['intersection'](_0x51255e['model'],qs[_0x8e97('0x37')](_0x2c32b5['query']['fields']));_0x3bff40[_0x8e97('0x36')]=_0x3bff40[_0x8e97('0x36')]['length']?_0x3bff40[_0x8e97('0x36')]:_0x51255e[_0x8e97('0x31')];if(!_0x2c32b5['query']['hasOwnProperty']('nolimit')){_0x3bff40[_0x8e97('0x1f')]=qs[_0x8e97('0x1f')](_0x2c32b5[_0x8e97('0x32')][_0x8e97('0x1f')]);_0x3bff40[_0x8e97('0x1e')]=qs[_0x8e97('0x1e')](_0x2c32b5[_0x8e97('0x32')]['offset']);}_0x3bff40[_0x8e97('0x38')]=qs[_0x8e97('0x39')](_0x2c32b5['query'][_0x8e97('0x39')]);_0x3bff40[_0x8e97('0x3a')]=qs[_0x8e97('0x34')](_[_0x8e97('0x3b')](_0x2c32b5['query'],_0x51255e[_0x8e97('0x34')]),_0x4f031d);if(_0x2c32b5[_0x8e97('0x32')][_0x8e97('0x3c')]){_0x3bff40['where']=_[_0x8e97('0x3d')](_0x3bff40[_0x8e97('0x3a')],{'$or':_[_0x8e97('0x2b')](_0x4f031d,function(_0x4ea8bc){if(_0x4ea8bc[_0x8e97('0x2f')]!==_0x8e97('0x3e')){var _0x2354c1={};_0x2354c1[_0x4ea8bc['name']]={'$like':'%'+_0x2c32b5[_0x8e97('0x32')][_0x8e97('0x3c')]+'%'};return _0x2354c1;}})});}_0x3bff40=_['merge']({},_0x3bff40,_0x2c32b5[_0x8e97('0x3f')]);var _0xf71c62={'where':_0x3bff40[_0x8e97('0x3a')]};return db[_0x8e97('0x2c')][_0x8e97('0x20')](_0xf71c62)[_0x8e97('0x26')](function(_0x48e4e9){_0x3ef0dc[_0x8e97('0x20')]=_0x48e4e9;if(_0x2c32b5['query']['includeAll']){_0x3bff40[_0x8e97('0x40')]=[{'all':!![]}];}return db[_0x8e97('0x2c')][_0x8e97('0x41')](_0x3bff40);})['then'](function(_0x97c0ff){_0x3ef0dc[_0x8e97('0x42')]=_0x97c0ff;return _0x3ef0dc;})['then'](respondWithFilteredResult(_0x1c8536,_0x3bff40))[_0x8e97('0x43')](handleError(_0x1c8536,null));};exports['show']=function(_0xc1a648,_0x3953ec){var _0x4f9d63={'raw':!![],'where':{'id':_0xc1a648[_0x8e97('0x44')]['id']}},_0x4e7b21={};_0x4e7b21[_0x8e97('0x31')]=_['keys'](db['WhatsappTransferReport'][_0x8e97('0x2d')]);_0x4e7b21[_0x8e97('0x32')]=_[_0x8e97('0x33')](_0xc1a648['query']);_0x4e7b21['filters']=_[_0x8e97('0x35')](_0x4e7b21[_0x8e97('0x31')],_0x4e7b21['query']);_0x4f9d63[_0x8e97('0x36')]=_['intersection'](_0x4e7b21['model'],qs[_0x8e97('0x37')](_0xc1a648[_0x8e97('0x32')][_0x8e97('0x37')]));_0x4f9d63[_0x8e97('0x36')]=_0x4f9d63[_0x8e97('0x36')]['length']?_0x4f9d63['attributes']:_0x4e7b21[_0x8e97('0x31')];if(_0xc1a648['query'][_0x8e97('0x45')]){_0x4f9d63[_0x8e97('0x40')]=[{'all':!![]}];}_0x4f9d63=_[_0x8e97('0x3d')]({},_0x4f9d63,_0xc1a648[_0x8e97('0x3f')]);return db['WhatsappTransferReport'][_0x8e97('0x46')](_0x4f9d63)[_0x8e97('0x26')](handleEntityNotFound(_0x3953ec,null))['then'](respondWithResult(_0x3953ec,null))[_0x8e97('0x43')](handleError(_0x3953ec,null));};exports[_0x8e97('0x47')]=function(_0x9e7c01,_0x27c6f9){return db[_0x8e97('0x2c')][_0x8e97('0x47')](_0x9e7c01['body'],{})[_0x8e97('0x26')](respondWithResult(_0x27c6f9,0xc9))[_0x8e97('0x43')](handleError(_0x27c6f9,null));};exports[_0x8e97('0x24')]=function(_0x4855ce,_0x39279e){if(_0x4855ce['body']['id']){delete _0x4855ce[_0x8e97('0x48')]['id'];}return db[_0x8e97('0x2c')][_0x8e97('0x46')]({'where':{'id':_0x4855ce[_0x8e97('0x44')]['id']}})[_0x8e97('0x26')](handleEntityNotFound(_0x39279e,null))[_0x8e97('0x26')](saveUpdates(_0x4855ce[_0x8e97('0x48')],null))['then'](respondWithResult(_0x39279e,null))[_0x8e97('0x43')](handleError(_0x39279e,null));};exports[_0x8e97('0x25')]=function(_0xf9e76a,_0x49a9a7){return db['WhatsappTransferReport'][_0x8e97('0x46')]({'where':{'id':_0xf9e76a[_0x8e97('0x44')]['id']}})['then'](handleEntityNotFound(_0x49a9a7,null))[_0x8e97('0x26')](removeEntity(_0x49a9a7,null))[_0x8e97('0x43')](handleError(_0x49a9a7,null));};exports['describe']=function(_0x20f5c6,_0x4c1605){return db[_0x8e97('0x2c')]['describe']()[_0x8e97('0x26')](respondWithResult(_0x4c1605,null))[_0x8e97('0x43')](handleError(_0x4c1605,null));}; \ No newline at end of file +var _0x553a=['fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','includeAll','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','offset','count','Content-Range','json','reject','save','update','then','destroy','name','index','map','WhatsappTransferReport','rawAttributes'];(function(_0x207c76,_0x5c742c){var _0x102327=function(_0x182203){while(--_0x182203){_0x207c76['push'](_0x207c76['shift']());}};_0x102327(++_0x5c742c);}(_0x553a,0x141));var _0xa553=function(_0x417baa,_0x3923d0){_0x417baa=_0x417baa-0x0;var _0x42724f=_0x553a[_0x417baa];return _0x42724f;};'use strict';var emlformat=require(_0xa553('0x0'));var rimraf=require(_0xa553('0x1'));var zipdir=require(_0xa553('0x2'));var jsonpatch=require(_0xa553('0x3'));var rp=require(_0xa553('0x4'));var moment=require(_0xa553('0x5'));var BPromise=require(_0xa553('0x6'));var Mustache=require(_0xa553('0x7'));var util=require(_0xa553('0x8'));var path=require('path');var sox=require(_0xa553('0x9'));var csv=require('to-csv');var ejs=require(_0xa553('0xa'));var fs=require('fs');var fs_extra=require(_0xa553('0xb'));var _=require('lodash');var squel=require(_0xa553('0xc'));var crypto=require('crypto');var jsforce=require(_0xa553('0xd'));var deskjs=require(_0xa553('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa553('0xf'));var Papa=require(_0xa553('0x10'));var Redis=require(_0xa553('0x11'));var authService=require(_0xa553('0x12'));var qs=require(_0xa553('0x13'));var as=require(_0xa553('0x14'));var hardwareService=require(_0xa553('0x15'));var logger=require(_0xa553('0x16'))(_0xa553('0x17'));var utils=require('../../config/utils');var config=require(_0xa553('0x18'));var licenseUtil=require(_0xa553('0x19'));var db=require(_0xa553('0x1a'))['db'];function respondWithStatusCode(_0xc76eb7,_0x21cd2b){_0x21cd2b=_0x21cd2b||0xcc;return function(_0x398bf8){if(_0x398bf8){return _0xc76eb7['sendStatus'](_0x21cd2b);}return _0xc76eb7[_0xa553('0x1b')](_0x21cd2b)[_0xa553('0x1c')]();};}function respondWithResult(_0x4be723,_0x52d941){_0x52d941=_0x52d941||0xc8;return function(_0x363bae){if(_0x363bae){return _0x4be723[_0xa553('0x1b')](_0x52d941)['json'](_0x363bae);}};}function respondWithFilteredResult(_0x6e8e80,_0x16cc82){return function(_0x3b107b){if(_0x3b107b){var _0x453415=typeof _0x16cc82['offset']==='undefined'&&typeof _0x16cc82[_0xa553('0x1d')]==='undefined';var _0x2aea88=_0x3b107b['count'];var _0x5c3c1b=_0x453415?0x0:_0x16cc82[_0xa553('0x1e')];var _0x2d109d=_0x453415?_0x3b107b[_0xa553('0x1f')]:_0x16cc82[_0xa553('0x1e')]+_0x16cc82[_0xa553('0x1d')];var _0x5d0351;if(_0x2d109d>=_0x2aea88){_0x2d109d=_0x2aea88;_0x5d0351=0xc8;}else{_0x5d0351=0xce;}_0x6e8e80[_0xa553('0x1b')](_0x5d0351);return _0x6e8e80['set'](_0xa553('0x20'),_0x5c3c1b+'-'+_0x2d109d+'/'+_0x2aea88)[_0xa553('0x21')](_0x3b107b);}return null;};}function patchUpdates(_0x12624f){return function(_0x27f94b){try{jsonpatch['apply'](_0x27f94b,_0x12624f,!![]);}catch(_0xe923e3){return BPromise[_0xa553('0x22')](_0xe923e3);}return _0x27f94b[_0xa553('0x23')]();};}function saveUpdates(_0x7f4c0,_0x49e282){return function(_0x3ec7e2){if(_0x3ec7e2){return _0x3ec7e2[_0xa553('0x24')](_0x7f4c0)[_0xa553('0x25')](function(_0x3b0aa5){return _0x3b0aa5;});}return null;};}function removeEntity(_0x33088c,_0x13bf73){return function(_0x38b768){if(_0x38b768){return _0x38b768[_0xa553('0x26')]()[_0xa553('0x25')](function(){_0x33088c[_0xa553('0x1b')](0xcc)[_0xa553('0x1c')]();});}};}function handleEntityNotFound(_0x4b89c3,_0xbc227f){return function(_0x558f69){if(!_0x558f69){_0x4b89c3['sendStatus'](0x194);}return _0x558f69;};}function handleError(_0x7594ff,_0xd62036){_0xd62036=_0xd62036||0x1f4;return function(_0x239ccc){logger['error'](_0x239ccc['stack']);if(_0x239ccc[_0xa553('0x27')]){delete _0x239ccc[_0xa553('0x27')];}_0x7594ff['status'](_0xd62036)['send'](_0x239ccc);};}exports[_0xa553('0x28')]=function(_0x5a2c76,_0x5adc7d){var _0x5ecc92={},_0x436311={},_0x1f9482={'count':0x0,'rows':[]};var _0x329692=_[_0xa553('0x29')](db[_0xa553('0x2a')][_0xa553('0x2b')],function(_0x2e6101){return{'name':_0x2e6101[_0xa553('0x2c')],'type':_0x2e6101['type'][_0xa553('0x2d')]};});_0x436311[_0xa553('0x2e')]=_[_0xa553('0x29')](_0x329692,_0xa553('0x27'));_0x436311['query']=_[_0xa553('0x2f')](_0x5a2c76[_0xa553('0x30')]);_0x436311['filters']=_[_0xa553('0x31')](_0x436311['model'],_0x436311['query']);_0x5ecc92[_0xa553('0x32')]=_['intersection'](_0x436311[_0xa553('0x2e')],qs[_0xa553('0x33')](_0x5a2c76['query'][_0xa553('0x33')]));_0x5ecc92[_0xa553('0x32')]=_0x5ecc92[_0xa553('0x32')][_0xa553('0x34')]?_0x5ecc92[_0xa553('0x32')]:_0x436311[_0xa553('0x2e')];if(!_0x5a2c76['query'][_0xa553('0x35')](_0xa553('0x36'))){_0x5ecc92[_0xa553('0x1d')]=qs[_0xa553('0x1d')](_0x5a2c76[_0xa553('0x30')][_0xa553('0x1d')]);_0x5ecc92[_0xa553('0x1e')]=qs[_0xa553('0x1e')](_0x5a2c76['query'][_0xa553('0x1e')]);}_0x5ecc92[_0xa553('0x37')]=qs[_0xa553('0x38')](_0x5a2c76[_0xa553('0x30')][_0xa553('0x38')]);_0x5ecc92[_0xa553('0x39')]=qs[_0xa553('0x3a')](_[_0xa553('0x3b')](_0x5a2c76[_0xa553('0x30')],_0x436311[_0xa553('0x3a')]),_0x329692);if(_0x5a2c76[_0xa553('0x30')][_0xa553('0x3c')]){_0x5ecc92[_0xa553('0x39')]=_[_0xa553('0x3d')](_0x5ecc92[_0xa553('0x39')],{'$or':_['map'](_0x329692,function(_0x2a64f3){if(_0x2a64f3[_0xa553('0x3e')]!=='VIRTUAL'){var _0x3bfcc2={};_0x3bfcc2[_0x2a64f3['name']]={'$like':'%'+_0x5a2c76[_0xa553('0x30')]['filter']+'%'};return _0x3bfcc2;}})});}_0x5ecc92=_[_0xa553('0x3d')]({},_0x5ecc92,_0x5a2c76['options']);var _0x46fe65={'where':_0x5ecc92[_0xa553('0x39')]};return db[_0xa553('0x2a')][_0xa553('0x1f')](_0x46fe65)['then'](function(_0x4d7405){_0x1f9482[_0xa553('0x1f')]=_0x4d7405;if(_0x5a2c76['query'][_0xa553('0x3f')]){_0x5ecc92['include']=[{'all':!![]}];}return db[_0xa553('0x2a')][_0xa553('0x40')](_0x5ecc92);})[_0xa553('0x25')](function(_0x5895d7){_0x1f9482[_0xa553('0x41')]=_0x5895d7;return _0x1f9482;})[_0xa553('0x25')](respondWithFilteredResult(_0x5adc7d,_0x5ecc92))[_0xa553('0x42')](handleError(_0x5adc7d,null));};exports[_0xa553('0x43')]=function(_0x29b33a,_0x18c55c){var _0x1a25df={'raw':!![],'where':{'id':_0x29b33a[_0xa553('0x44')]['id']}},_0x34c12f={};_0x34c12f['model']=_[_0xa553('0x2f')](db[_0xa553('0x2a')][_0xa553('0x2b')]);_0x34c12f['query']=_[_0xa553('0x2f')](_0x29b33a[_0xa553('0x30')]);_0x34c12f['filters']=_[_0xa553('0x31')](_0x34c12f[_0xa553('0x2e')],_0x34c12f[_0xa553('0x30')]);_0x1a25df[_0xa553('0x32')]=_[_0xa553('0x31')](_0x34c12f[_0xa553('0x2e')],qs['fields'](_0x29b33a[_0xa553('0x30')][_0xa553('0x33')]));_0x1a25df['attributes']=_0x1a25df[_0xa553('0x32')][_0xa553('0x34')]?_0x1a25df[_0xa553('0x32')]:_0x34c12f[_0xa553('0x2e')];if(_0x29b33a[_0xa553('0x30')][_0xa553('0x3f')]){_0x1a25df['include']=[{'all':!![]}];}_0x1a25df=_['merge']({},_0x1a25df,_0x29b33a['options']);return db[_0xa553('0x2a')][_0xa553('0x45')](_0x1a25df)[_0xa553('0x25')](handleEntityNotFound(_0x18c55c,null))[_0xa553('0x25')](respondWithResult(_0x18c55c,null))['catch'](handleError(_0x18c55c,null));};exports['create']=function(_0x5299b7,_0x5cfc34){return db[_0xa553('0x2a')][_0xa553('0x46')](_0x5299b7[_0xa553('0x47')],{})[_0xa553('0x25')](respondWithResult(_0x5cfc34,0xc9))[_0xa553('0x42')](handleError(_0x5cfc34,null));};exports['update']=function(_0x35873c,_0x4bc820){if(_0x35873c['body']['id']){delete _0x35873c['body']['id'];}return db[_0xa553('0x2a')][_0xa553('0x45')]({'where':{'id':_0x35873c['params']['id']}})[_0xa553('0x25')](handleEntityNotFound(_0x4bc820,null))[_0xa553('0x25')](saveUpdates(_0x35873c[_0xa553('0x47')],null))['then'](respondWithResult(_0x4bc820,null))['catch'](handleError(_0x4bc820,null));};exports[_0xa553('0x26')]=function(_0xefff08,_0xdd0b15){return db['WhatsappTransferReport'][_0xa553('0x45')]({'where':{'id':_0xefff08[_0xa553('0x44')]['id']}})[_0xa553('0x25')](handleEntityNotFound(_0xdd0b15,null))[_0xa553('0x25')](removeEntity(_0xdd0b15,null))['catch'](handleError(_0xdd0b15,null));};exports[_0xa553('0x48')]=function(_0x4dd893,_0x1881c1){return db['WhatsappTransferReport'][_0xa553('0x48')]()[_0xa553('0x25')](respondWithResult(_0x1881c1,null))[_0xa553('0x42')](handleError(_0x1881c1,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 20f672e..29adab4 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 _0x2a5d=['exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','moment','bluebird','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x2a5d,0x9b));var _0xd2a5=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x2a5d[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require('lodash');var util=require(_0xd2a5('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd2a5('0x1'));var BPromise=require(_0xd2a5('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd2a5('0x3'));var attributes=require(_0xd2a5('0x4'));module[_0xd2a5('0x5')]=function(_0xdf3367,_0x18aa4b){return _0xdf3367[_0xd2a5('0x6')](_0xd2a5('0x7'),attributes,{'tableName':_0xd2a5('0x8'),'paranoid':![],'indexes':[{'name':_0xd2a5('0x9'),'fields':[_0xd2a5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x323e=['bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x323e,0x1a0));var _0xe323=function(_0x7af1a1,_0xfee683){_0x7af1a1=_0x7af1a1-0x0;var _0x3f57ac=_0x323e[_0x7af1a1];return _0x3f57ac;};'use strict';var _=require(_0xe323('0x0'));var util=require('util');var logger=require(_0xe323('0x1'))(_0xe323('0x2'));var moment=require(_0xe323('0x3'));var BPromise=require(_0xe323('0x4'));var rp=require(_0xe323('0x5'));var fs=require('fs');var path=require(_0xe323('0x6'));var rimraf=require(_0xe323('0x7'));var config=require('../../config/environment');var attributes=require(_0xe323('0x8'));module[_0xe323('0x9')]=function(_0x480183,_0x517876){return _0x480183[_0xe323('0xa')](_0xe323('0xb'),attributes,{'tableName':_0xe323('0xc'),'paranoid':![],'indexes':[{'name':_0xe323('0xd'),'fields':[_0xe323('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 0552122..0f0778e 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 _0x16ca=['../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x16ca,0x155));var _0xa16c=function(_0xd3bdab,_0x5d784a){_0xd3bdab=_0xd3bdab-0x0;var _0x1c3178=_0x16ca[_0xd3bdab];return _0x1c3178;};'use strict';var _=require(_0xa16c('0x0'));var util=require(_0xa16c('0x1'));var moment=require(_0xa16c('0x2'));var BPromise=require('bluebird');var rs=require(_0xa16c('0x3'));var fs=require('fs');var Redis=require(_0xa16c('0x4'));var db=require(_0xa16c('0x5'))['db'];var utils=require(_0xa16c('0x6'));var logger=require(_0xa16c('0x7'))(_0xa16c('0x8'));var config=require(_0xa16c('0x9'));var jayson=require(_0xa16c('0xa'));var client=jayson[_0xa16c('0xb')][_0xa16c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1428fe,_0x1865ef,_0x5b469e){return new BPromise(function(_0x2014bf,_0x18a79f){return client[_0xa16c('0xd')](_0x1428fe,_0x5b469e)[_0xa16c('0xe')](function(_0x27f273){logger[_0xa16c('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1865ef,'request\x20sent');logger['debug'](_0xa16c('0x10'),_0x1865ef,_0xa16c('0x11'),JSON[_0xa16c('0x12')](_0x27f273));if(_0x27f273[_0xa16c('0x13')]){if(_0x27f273[_0xa16c('0x13')][_0xa16c('0x14')]===0x1f4){logger['error'](_0xa16c('0x15'),_0x1865ef,_0x27f273[_0xa16c('0x13')][_0xa16c('0x16')]);return _0x18a79f(_0x27f273[_0xa16c('0x13')]['message']);}logger['error'](_0xa16c('0x15'),_0x1865ef,_0x27f273[_0xa16c('0x13')][_0xa16c('0x16')]);return _0x2014bf(_0x27f273[_0xa16c('0x13')][_0xa16c('0x16')]);}else{logger[_0xa16c('0xf')](_0xa16c('0x15'),_0x1865ef,_0xa16c('0x11'));_0x2014bf(_0x27f273[_0xa16c('0x17')][_0xa16c('0x16')]);}})[_0xa16c('0x18')](function(_0x2337ab){logger['error'](_0xa16c('0x15'),_0x1865ef,_0x2337ab);_0x18a79f(_0x2337ab);});});} \ No newline at end of file +var _0xcc6f=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','then','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x4ba001,_0x46b3ae){var _0x488623=function(_0x222e8d){while(--_0x222e8d){_0x4ba001['push'](_0x4ba001['shift']());}};_0x488623(++_0x46b3ae);}(_0xcc6f,0x10f));var _0xfcc6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcc6f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfcc6('0x0'));var util=require(_0xfcc6('0x1'));var moment=require(_0xfcc6('0x2'));var BPromise=require(_0xfcc6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcc6('0x4'));var db=require(_0xfcc6('0x5'))['db'];var utils=require(_0xfcc6('0x6'));var logger=require(_0xfcc6('0x7'))(_0xfcc6('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35b186,_0x5a703a,_0xc8a708){return new BPromise(function(_0x13ceb6,_0x4b65e8){return client['request'](_0x35b186,_0xc8a708)[_0xfcc6('0x9')](function(_0x43c42c){logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x5a703a,_0xfcc6('0xa'));logger[_0xfcc6('0xb')](_0xfcc6('0xc'),_0x5a703a,'request\x20sent',JSON[_0xfcc6('0xd')](_0x43c42c));if(_0x43c42c[_0xfcc6('0xe')]){if(_0x43c42c['error'][_0xfcc6('0xf')]===0x1f4){logger[_0xfcc6('0xe')](_0xfcc6('0x10'),_0x5a703a,_0x43c42c['error']['message']);return _0x4b65e8(_0x43c42c['error'][_0xfcc6('0x11')]);}logger[_0xfcc6('0xe')](_0xfcc6('0x10'),_0x5a703a,_0x43c42c[_0xfcc6('0xe')]['message']);return _0x13ceb6(_0x43c42c[_0xfcc6('0xe')][_0xfcc6('0x11')]);}else{logger[_0xfcc6('0x12')](_0xfcc6('0x10'),_0x5a703a,'request\x20sent');_0x13ceb6(_0x43c42c[_0xfcc6('0x13')][_0xfcc6('0x11')]);}})[_0xfcc6('0x14')](function(_0x233db3){logger[_0xfcc6('0xe')](_0xfcc6('0x10'),_0x5a703a,_0x233db3);_0x4b65e8(_0x233db3);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 798592d..ceab123 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x624c=['./config/schedule/cloud-provider','sequelize','sync','then','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','Online\x20apps:','join','Offline\x20apps:','map','status','online','name','None','App\x20Ready!','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','exit','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','app','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe'];(function(_0x64ecc5,_0x52b509){var _0x1cd35b=function(_0x40c0a5){while(--_0x40c0a5){_0x64ecc5['push'](_0x64ecc5['shift']());}};_0x1cd35b(++_0x52b509);}(_0x624c,0x1ee));var _0xc624=function(_0x27766b,_0x155221){_0x27766b=_0x27766b-0x0;var _0x3de10e=_0x624c[_0x27766b];return _0x3de10e;};'use strict';var _=require('lodash');var db=require(_0xc624('0x0'))['db'];var seedDb=require(_0xc624('0x1'));var checkLicense=require(_0xc624('0x2'));var rpc=require(_0xc624('0x3'));var config=require(_0xc624('0x4'));var logger=require('./config/logger')(_0xc624('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0xc624('0x6'));var schedule=require('./config/schedule');var chat=require(_0xc624('0x7'));var whatsapp=require(_0xc624('0x8'));var transcribe=require(_0xc624('0x9'));var provider=require(_0xc624('0xa'));function main(){return db[_0xc624('0xb')][_0xc624('0xc')]()[_0xc624('0xd')](function(){if(config['seedDB']){return seedDb[_0xc624('0xe')]();}})[_0xc624('0xd')](function(){return checkLicense[_0xc624('0xe')]();})['then'](function(){return rpc[_0xc624('0xf')]();})[_0xc624('0xd')](function(_0x4a7cf1){logger[_0xc624('0x10')](_0x4a7cf1);return chat[_0xc624('0x11')]();})[_0xc624('0xd')](function(){return whatsapp[_0xc624('0x11')]();})[_0xc624('0xd')](function(){return schedule['start']();})[_0xc624('0xd')](function(){return transcribe[_0xc624('0x11')]();})[_0xc624('0xd')](function(){return provider[_0xc624('0x11')]();})['then'](function(_0x4f50f3){logger['info'](_0x4f50f3);return pm2[_0xc624('0x11')](pm2Config);})['then'](function(_0x3cbc19){var _0x5c236e=_0x3cbc19[_0xc624('0x12')](function(_0x362a4a){return typeof _0x362a4a[_0xc624('0x13')]===_0xc624('0x14')&&_0x362a4a['exitCode']>=0x0;});if(_0x5c236e[_0xc624('0x15')]>0x0){throw new Error(_0x5c236e[_0xc624('0x15')]+_0xc624('0x16')+_['map'](_0x5c236e,function(_0x190458){return'\x22'+_0x190458[_0xc624('0x17')]['name']+'\x22';}));}logger[_0xc624('0x10')](_0xc624('0x18'),_['map'](_[_0xc624('0x12')](_0x3cbc19,{'status':'online'}),'name')[_0xc624('0x19')]());logger[_0xc624('0x10')](_0xc624('0x1a'),_[_0xc624('0x1b')](_[_0xc624('0x12')](_0x3cbc19,function(_0x55be9e){return _0x55be9e[_0xc624('0x1c')]!==_0xc624('0x1d');}),_0xc624('0x1e'))['join']()||_0xc624('0x1f'));console['log'](_0xc624('0x20'));})['catch'](function(_0xa646e1){console[_0xc624('0x21')](_0xc624('0x22'),_0xa646e1);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0xa646e1);process[_0xc624('0x23')](0x1);});}main(); \ No newline at end of file +var _0x806b=['filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','online','name','Offline\x20apps:','status','join','None','log','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','then','seedDB','default','info','start'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x806b,0x163));var _0xb806=function(_0x4ceed5,_0x298aa4){_0x4ceed5=_0x4ceed5-0x0;var _0x18bc6d=_0x806b[_0x4ceed5];return _0x18bc6d;};'use strict';var _=require(_0xb806('0x0'));var db=require(_0xb806('0x1'))['db'];var seedDb=require(_0xb806('0x2'));var checkLicense=require(_0xb806('0x3'));var rpc=require(_0xb806('0x4'));var config=require(_0xb806('0x5'));var logger=require(_0xb806('0x6'))(_0xb806('0x7'));var pm2=require('./config/pm2');var pm2Config=require(_0xb806('0x8'));var schedule=require(_0xb806('0x9'));var chat=require(_0xb806('0xa'));var whatsapp=require(_0xb806('0xb'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xb806('0xc'));function main(){return db[_0xb806('0xd')]['sync']()[_0xb806('0xe')](function(){if(config[_0xb806('0xf')]){return seedDb[_0xb806('0x10')]();}})[_0xb806('0xe')](function(){return checkLicense['default']();})[_0xb806('0xe')](function(){return rpc['listen']();})[_0xb806('0xe')](function(_0x4cd6b4){logger[_0xb806('0x11')](_0x4cd6b4);return chat['start']();})[_0xb806('0xe')](function(){return whatsapp[_0xb806('0x12')]();})[_0xb806('0xe')](function(){return schedule['start']();})[_0xb806('0xe')](function(){return transcribe[_0xb806('0x12')]();})['then'](function(){return provider[_0xb806('0x12')]();})[_0xb806('0xe')](function(_0x5d08f8){logger[_0xb806('0x11')](_0x5d08f8);return pm2[_0xb806('0x12')](pm2Config);})['then'](function(_0x282777){var _0xede757=_0x282777[_0xb806('0x13')](function(_0x1a3258){return typeof _0x1a3258[_0xb806('0x14')]==='number'&&_0x1a3258['exitCode']>=0x0;});if(_0xede757[_0xb806('0x15')]>0x0){throw new Error(_0xede757['length']+_0xb806('0x16')+_[_0xb806('0x17')](_0xede757,function(_0x2fd643){return'\x22'+_0x2fd643[_0xb806('0x18')]['name']+'\x22';}));}logger[_0xb806('0x11')](_0xb806('0x19'),_[_0xb806('0x17')](_[_0xb806('0x13')](_0x282777,{'status':_0xb806('0x1a')}),_0xb806('0x1b'))['join']());logger[_0xb806('0x11')](_0xb806('0x1c'),_['map'](_[_0xb806('0x13')](_0x282777,function(_0x2dbb8a){return _0x2dbb8a[_0xb806('0x1d')]!==_0xb806('0x1a');}),'name')[_0xb806('0x1e')]()||_0xb806('0x1f'));console[_0xb806('0x20')]('App\x20Ready!');})['catch'](function(_0x41ffe5){console[_0xb806('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x41ffe5);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x41ffe5);process[_0xb806('0x21')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 84b6402..e01898b 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 _0xedd9=['crypto','bluebird','util','moment','session','fullname','name','internal','email','permissions','voicePause','chatPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','authorization','startsWith','headers','Basic','User','find','authenticate','pass','status','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','split','unshift','join','promisify','secrets','payload','verify','hex','toString','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware'];(function(_0x51f9bf,_0x24d5b7){var _0x2986e3=function(_0x1fcc2f){while(--_0x1fcc2f){_0x51f9bf['push'](_0x51f9bf['shift']());}};_0x2986e3(++_0x24d5b7);}(_0xedd9,0xfc));var _0x9edd=function(_0x12392c,_0x2f004f){_0x12392c=_0x12392c-0x0;var _0x2875f3=_0xedd9[_0x12392c];return _0x2875f3;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x9edd('0x0'));var hardwareConf=require(_0x9edd('0x1'));var licenseUtil=require(_0x9edd('0x2'));var encryptor=require(_0x9edd('0x3'));var _=require(_0x9edd('0x4'));var jwt=require(_0x9edd('0x5'));var expressJwt=require(_0x9edd('0x6'));var compose=require(_0x9edd('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0x9edd('0x8'));var BPromise=require(_0x9edd('0x9'));var util=require(_0x9edd('0xa'));var moment=require(_0x9edd('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x9edd('0xc')]});var userAttributes=['id','role',_0x9edd('0xd'),_0x9edd('0xe'),_0x9edd('0xf'),_0x9edd('0x10'),'userpic',_0x9edd('0x11'),'md5secret',_0x9edd('0x12'),_0x9edd('0x13'),'mailPause',_0x9edd('0x14'),_0x9edd('0x15'),'openchannelPause',_0x9edd('0x16'),_0x9edd('0x17'),_0x9edd('0x18'),_0x9edd('0x19'),_0x9edd('0x1a'),_0x9edd('0x1b'),_0x9edd('0x1c'),_0x9edd('0x1d'),'phoneBarAutoAnswer',_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24'),_0x9edd('0x25'),'phoneBarRemoteControlPort',_0x9edd('0x26'),_0x9edd('0x27'),_0x9edd('0x28'),'privacyEnabled',_0x9edd('0x29'),_0x9edd('0x2a'),_0x9edd('0x2b'),'downloadOmnichannelInteractions',_0x9edd('0x2c'),'ignorePauseForPreviewCalls',_0x9edd('0x2d'),_0x9edd('0x2e'),'chatAutoanswerDelay','emailAutoanswer',_0x9edd('0x2f'),'smsAutoanswer',_0x9edd('0x30'),'openchannelAutoanswer','openchannelAutoanswerDelay',_0x9edd('0x31'),_0x9edd('0x32'),'whatsappAutoanswer','whatsappAutoanswerDelay'];exports[_0x9edd('0x33')]=function(){return this[_0x9edd('0x34')](!![])[_0x9edd('0x35')](function(_0x542172,_0x3741c8,_0x1dca43){if(_0x542172[_0x9edd('0x36')]){_0x1dca43();}else{return db[_0x9edd('0x37')][_0x9edd('0x38')]({'where':{'id':_0x542172['params']['id']},'attributes':['id',_0x9edd('0x39'),_0x9edd('0x3a')],'raw':!![]})[_0x9edd('0x3b')](function(_0x2f9f86){if(_0x2f9f86&&_0x2f9f86[_0x9edd('0x39')]){return _0x3741c8['status'](_0x2f9f86['disposition']===_0x9edd('0x3c')?0x195:0x193)[_0x9edd('0x3d')]({'message':_0x2f9f86[_0x9edd('0x3a')]===_0x9edd('0x3c')?_0x9edd('0x3e'):'Forbidden.'});}else{_0x1dca43();}})['catch'](function(_0x214d0a){_0x1dca43(_0x214d0a);});}});};exports[_0x9edd('0x34')]=function isAuthenticated(_0x1c762c){return compose()['use'](function(_0x238b22,_0x28cfae,_0x2ae8dd){var _0x41af53;if(_0x238b22['headers'][_0x9edd('0x3f')]){if(_[_0x9edd('0x40')](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x42'))){var _0x42e664=basicAuth(_0x238b22);db[_0x9edd('0x43')][_0x9edd('0x44')]({'where':{'name':_0x42e664[_0x9edd('0xe')]}})[_0x9edd('0x3b')](function(_0x4fd03f){if(!_0x4fd03f||!_0x4fd03f[_0x9edd('0x45')](_0x42e664[_0x9edd('0x46')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':'Wrong\x20credentials.'});}_0x238b22[_0x9edd('0x36')]={'id':_0x4fd03f['id']};_0x2ae8dd();})[_0x9edd('0x48')](function(_0x267c74){_0x2ae8dd(_0x267c74);});}else if(_['startsWith'](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x49'))){validateJwt(_0x238b22,_0x28cfae,_0x2ae8dd);}else{if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':_0x9edd('0x4a')});}}}else if(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')]){try{var _0xd0fd74={'audience':hardwareConf[_0x9edd('0x4d')](),'issuer':hardwareConf[_0x9edd('0x4d')]()};verifyJwt(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')],_0xd0fd74)[_0x9edd('0x3b')](function(_0x5757fc){return db[_0x9edd('0x43')]['find']({'where':{'id':_0x5757fc[_0x9edd('0x4e')]}})[_0x9edd('0x3b')](function(_0x10d6fd){_0x41af53=_0x10d6fd;return db[_0x9edd('0x4f')][_0x9edd('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9edd('0x50')],'raw':!![]});})[_0x9edd('0x3b')](function(_0x2b3469){if(!_0x41af53||!_[_0x9edd('0x51')](_0x41af53[_0x9edd('0x52')],_0x5757fc[_0x9edd('0x53')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x54')});}if(_0x41af53[_0x9edd('0x55')]){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x41af53[_0x9edd('0x56')]){if(_0x2b3469['blockDuration']>0x0){if(moment(_0x41af53[_0x9edd('0x57')])[_0x9edd('0x58')](_0x2b3469[_0x9edd('0x50')],'minutes')>moment()){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});}}else{return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x238b22[_0x9edd('0x36')]={'id':_0x41af53['id']};_0x2ae8dd();});})[_0x9edd('0x48')](function(){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});});}catch(_0x389f51){_0x2ae8dd(_0x389f51);}}else if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)['json']({'message':_0x9edd('0x4a')});}})['use'](function(_0x2bdb3f,_0xc1e657,_0x587d74){if(_0x2bdb3f[_0x9edd('0x36')]){db['User']['find']({'where':{'id':_0x2bdb3f[_0x9edd('0x36')]['id']},'attributes':userAttributes})[_0x9edd('0x3b')](function(_0x1f276b){if(!_0x1f276b){return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5a')});}_0x2bdb3f[_0x9edd('0x36')]=_0x1f276b;_0x587d74();})[_0x9edd('0x48')](function(_0x18c149){_0x587d74(_0x18c149);});}else if(_0x1c762c){_0x587d74();}else{return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5b')});}});};exports[_0x9edd('0x5c')]=function canUpdate(){return compose()[_0x9edd('0x35')](function(_0x46e9f4,_0x5416f8,_0x13197d){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x1e5805){if(_0x1e5805[_0x9edd('0x5e')]){_0x13197d();}else{return _0x5416f8[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})['catch'](function(_0x4bc7a1){_0x13197d(_0x4bc7a1);});});};exports[_0x9edd('0x5f')]=function isWebrtcLicence(){return compose()['use'](function(_0x8b1fdb,_0x19b56b,_0x2b06d3){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x53005b){if(_0x53005b[_0x9edd('0x60')]){_0x2b06d3();}else{return _0x19b56b[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})[_0x9edd('0x48')](function(_0xfd7bd1){_0x2b06d3(_0xfd7bd1);});});};exports[_0x9edd('0x61')]=function(_0x293b03,_0x1d78c4,_0x35bdec){_0x293b03['isMiddleware']=!![];return _0x35bdec();};exports[_0x9edd('0x62')]=function signToken(_0x237e91){return signJwt(_0x237e91);};exports['setTokenCookie']=function(_0xb93816,_0x8d8701){if(!_0xb93816['user']){return _0x8d8701[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x63')});}var _0x5215b0={'payload':{'id':_0xb93816[_0x9edd('0x36')]['id'],'role':_0xb93816[_0x9edd('0x36')][_0x9edd('0x64')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5215b0)[_0x9edd('0x3b')](function(_0x53f6e3){_0x8d8701[_0x9edd('0x65')](_0x9edd('0x66'),_0x53f6e3);_0x8d8701[_0x9edd('0x67')]('/dashboards/general');})[_0x9edd('0x48')](function(_0x21f6ce){return _0x8d8701['status'](0x1f4)[_0x9edd('0x68')](_0x21f6ce);});};exports['retrieveApiKey']=function(_0x336494){if(_[_0x9edd('0x69')](_0x336494[_0x9edd('0x52')])||_[_0x9edd('0x69')](_0x336494[_0x9edd('0x6a')])){return null;}else{return createJwt(_0x336494);}};exports[_0x9edd('0x6b')]=function(_0x2334d4){_0x2334d4[_0x9edd('0x52')]=generateNonce();_0x2334d4[_0x9edd('0x6a')]=generateIssuedAt();return createJwt(_0x2334d4);};exports[_0x9edd('0x6c')]=function(_0x31272d,_0x5a3b1d){var _0x161bea=_0x31272d[_0x9edd('0x4b')][_0x9edd('0x4c')];if(_0x161bea){var _0x58fe29={'nonce':_0x5a3b1d[_0x9edd('0x52')],'iat':_0x5a3b1d['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x161bea,_0x58fe29)[_0x9edd('0x3b')](function(){return generateApiKey(_0x5a3b1d);});}else{throw{'message':_0x9edd('0x6d')};}};exports[_0x9edd('0x6e')]=function(_0x35ddb3){var _0x48a900=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x48a900['test'](_0x35ddb3))throw new db['Sequelize'][(_0x9edd('0x6f'))](_0x9edd('0x70'));return;};exports[_0x9edd('0x71')]=function(_0x1091ff,_0x2e2920,_0x41ec97){var _0x25906c=encryptor[_0x9edd('0x72')](_0x2e2920)['split'](',');for(var _0x16dfdc=0x0;_0x16dfdc<_0x41ec97;_0x16dfdc++){if(!_0x25906c[_0x16dfdc])break;if(_0x1091ff['toLowerCase']()===_0x25906c[_0x16dfdc][_0x9edd('0x73')]()){var _0x6a1cfc=util['format'](_0x9edd('0x74'),_0x41ec97);if(_0x41ec97===0x1){_0x6a1cfc=_0x9edd('0x75');}throw new db[(_0x9edd('0x76'))]['ValidationError'](_0x6a1cfc);}}return;};exports[_0x9edd('0x77')]=function(_0x2e1ce3,_0x430eb4){var _0x15ebfa=_0x430eb4?encryptor[_0x9edd('0x72')](_0x430eb4)[_0x9edd('0x78')](','):[];if(_0x15ebfa['length']===0x5){_0x15ebfa['splice'](-0x1,0x1);}_0x15ebfa[_0x9edd('0x79')](_0x2e1ce3);return encryptor['encryptString'](_0x15ebfa[_0x9edd('0x7a')](','));};function signJwt(_0x3e9a3e){var _0x439083=BPromise[_0x9edd('0x7b')](jwt['sign'],{'context':jwt});var _0x21ead2=_0x3e9a3e['secret']||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0xc6bde6,_0x5ca123){_0x439083(_0x3e9a3e[_0x9edd('0x7d')],_0x21ead2,_0x3e9a3e['options'])[_0x9edd('0x3b')](function(_0x4e1eda){_0xc6bde6(_0x4e1eda);})['catch'](function(_0x236b82){_0x5ca123(_0x236b82);});});}function verifyJwt(_0x4a72d0,_0x141137,_0x134c9c){var _0x307a61=BPromise['promisify'](jwt[_0x9edd('0x7e')],{'context':jwt});var _0x321485=_0x134c9c||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0x467512,_0x4d8fbb){_0x307a61(_0x4a72d0,_0x321485,_0x141137)['then'](function(_0x2e1a96){_0x467512(_0x2e1a96);})[_0x9edd('0x48')](function(_0x5516c4){_0x4d8fbb(_0x5516c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x9edd('0x7f'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x9edd('0x80')]();}function createJwt(_0x32ff46){var _0x589348={'payload':{'iat':_0x32ff46[_0x9edd('0x6a')],'nonce':_0x32ff46[_0x9edd('0x52')]},'options':{'algorithm':_0x9edd('0x81'),'subject':_0x32ff46['id']['toString'](),'issuer':hardwareConf[_0x9edd('0x4d')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x589348)[_0x9edd('0x3b')](function(_0x18d1a0){return{'iat':_0x32ff46['apiKeyIat'],'nonce':_0x32ff46[_0x9edd('0x52')],'token':_0x18d1a0};});} \ No newline at end of file +var _0xb43b=['headers','then','authenticate','pass','status','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','find','sub','allowedLoginAttempts','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','minutes','User\x20object\x20not\x20found.','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','apiKeyNonce','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','unshift','encryptString','join','promisify','sign','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','moment','session','role','fullname','name','internal','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','allowmessenger','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarPrefixRequired','phoneBarRemoteControl','interface','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','whatsappAutoanswer','isChatInteractionAuthorized','use','ChatInteraction','findOne','params','closed','disposition','unmanaged','json','Forbidden.','catch','isAuthenticated','authorization','startsWith'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3b2f67,_0x3d2f7c){_0x3b2f67=_0x3b2f67-0x0;var _0x6c5564=_0xb43b[_0x3b2f67];return _0x6c5564;};'use strict';var db=require(_0xbb43('0x0'))['db'];var config=require(_0xbb43('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xbb43('0x2'));var encryptor=require(_0xbb43('0x3'));var _=require(_0xbb43('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xbb43('0x5'));var compose=require(_0xbb43('0x6'));var basicAuth=require(_0xbb43('0x7'));var crypto=require(_0xbb43('0x8'));var BPromise=require('bluebird');var util=require('util');var moment=require(_0xbb43('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0xbb43('0xa')]});var userAttributes=['id',_0xbb43('0xb'),_0xbb43('0xc'),_0xbb43('0xd'),_0xbb43('0xe'),'email',_0xbb43('0xf'),_0xbb43('0x10'),'md5secret',_0xbb43('0x11'),_0xbb43('0x12'),_0xbb43('0x13'),_0xbb43('0x14'),_0xbb43('0x15'),_0xbb43('0x16'),'pauseType',_0xbb43('0x17'),_0xbb43('0x18'),'lastPauseAt','crudPermissions',_0xbb43('0x19'),'passwordResetAt','alias',_0xbb43('0x1a'),'phoneBarAutoAnswerDelay',_0xbb43('0x1b'),_0xbb43('0x1c'),'phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires',_0xbb43('0x1d'),_0xbb43('0x1e'),'phoneBarRemoteControlPort','hotdesk',_0xbb43('0x1f'),'userProfileId','privacyEnabled',_0xbb43('0x20'),_0xbb43('0x21'),_0xbb43('0x22'),'downloadOmnichannelInteractions',_0xbb43('0x23'),'ignorePauseForPreviewCalls',_0xbb43('0x24'),_0xbb43('0x25'),'chatAutoanswerDelay','emailAutoanswer',_0xbb43('0x26'),_0xbb43('0x27'),_0xbb43('0x28'),_0xbb43('0x29'),'openchannelAutoanswerDelay',_0xbb43('0x2a'),'faxAutoanswerDelay',_0xbb43('0x2b'),'whatsappAutoanswerDelay'];exports[_0xbb43('0x2c')]=function(){return this['isAuthenticated'](!![])[_0xbb43('0x2d')](function(_0x451cbd,_0x577ddd,_0x1d0768){if(_0x451cbd['user']){_0x1d0768();}else{return db[_0xbb43('0x2e')][_0xbb43('0x2f')]({'where':{'id':_0x451cbd[_0xbb43('0x30')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})['then'](function(_0x269ca5){if(_0x269ca5&&_0x269ca5[_0xbb43('0x31')]){return _0x577ddd['status'](_0x269ca5[_0xbb43('0x32')]===_0xbb43('0x33')?0x195:0x193)[_0xbb43('0x34')]({'message':_0x269ca5[_0xbb43('0x32')]==='unmanaged'?'Unmanaged.':_0xbb43('0x35')});}else{_0x1d0768();}})[_0xbb43('0x36')](function(_0xa88db0){_0x1d0768(_0xa88db0);});}});};exports[_0xbb43('0x37')]=function isAuthenticated(_0x510b05){return compose()[_0xbb43('0x2d')](function(_0x21d386,_0x473828,_0x539730){var _0x2ad6da;if(_0x21d386['headers'][_0xbb43('0x38')]){if(_[_0xbb43('0x39')](_0x21d386[_0xbb43('0x3a')][_0xbb43('0x38')],'Basic')){var _0x157d62=basicAuth(_0x21d386);db['User']['find']({'where':{'name':_0x157d62['name']}})[_0xbb43('0x3b')](function(_0x573a05){if(!_0x573a05||!_0x573a05[_0xbb43('0x3c')](_0x157d62[_0xbb43('0x3d')])){return _0x473828[_0xbb43('0x3e')](0x191)['json']({'message':_0xbb43('0x3f')});}_0x21d386[_0xbb43('0x40')]={'id':_0x573a05['id']};_0x539730();})[_0xbb43('0x36')](function(_0xd987fa){_0x539730(_0xd987fa);});}else if(_[_0xbb43('0x39')](_0x21d386[_0xbb43('0x3a')][_0xbb43('0x38')],_0xbb43('0x41'))){validateJwt(_0x21d386,_0x473828,_0x539730);}else{if(_0x510b05){_0x539730();}else{return _0x473828['status'](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x42')});}}}else if(_0x21d386[_0xbb43('0x43')][_0xbb43('0x44')]){try{var _0x4015ec={'audience':hardwareConf[_0xbb43('0x45')](),'issuer':hardwareConf[_0xbb43('0x45')]()};verifyJwt(_0x21d386[_0xbb43('0x43')][_0xbb43('0x44')],_0x4015ec)[_0xbb43('0x3b')](function(_0x21346a){return db[_0xbb43('0x46')][_0xbb43('0x47')]({'where':{'id':_0x21346a[_0xbb43('0x48')]}})[_0xbb43('0x3b')](function(_0x405f36){_0x2ad6da=_0x405f36;return db['Setting'][_0xbb43('0x2f')]({'where':{'id':0x1},'attributes':[_0xbb43('0x49'),'blockDuration'],'raw':!![]});})[_0xbb43('0x3b')](function(_0x2c9a7c){if(!_0x2ad6da||!_[_0xbb43('0x4a')](_0x2ad6da['apiKeyNonce'],_0x21346a['nonce'])){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4b')});}if(_0x2ad6da['disabled']){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4c')});}if(_0x2ad6da[_0xbb43('0x4d')]){if(_0x2c9a7c[_0xbb43('0x4e')]>0x0){if(moment(_0x2ad6da[_0xbb43('0x4f')])['add'](_0x2c9a7c[_0xbb43('0x4e')],_0xbb43('0x50'))>moment()){return _0x473828[_0xbb43('0x3e')](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4c')});}}else{return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x21d386[_0xbb43('0x40')]={'id':_0x2ad6da['id']};_0x539730();});})[_0xbb43('0x36')](function(){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1fcf64){_0x539730(_0x1fcf64);}}else if(_0x510b05){_0x539730();}else{return _0x473828[_0xbb43('0x3e')](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x42')});}})['use'](function(_0x3e0871,_0x136bd4,_0x59750b){if(_0x3e0871[_0xbb43('0x40')]){db['User'][_0xbb43('0x47')]({'where':{'id':_0x3e0871[_0xbb43('0x40')]['id']},'attributes':userAttributes})[_0xbb43('0x3b')](function(_0x14e57e){if(!_0x14e57e){return _0x136bd4[_0xbb43('0x3e')](0x194)[_0xbb43('0x34')]({'message':'User\x20not\x20found.'});}_0x3e0871[_0xbb43('0x40')]=_0x14e57e;_0x59750b();})['catch'](function(_0x307f1e){_0x59750b(_0x307f1e);});}else if(_0x510b05){_0x59750b();}else{return _0x136bd4[_0xbb43('0x3e')](0x194)[_0xbb43('0x34')]({'message':_0xbb43('0x51')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xbb43('0x2d')](function(_0x39f75f,_0x4bc351,_0x24ba15){return licenseUtil[_0xbb43('0x52')]()[_0xbb43('0x3b')](function(_0x40f519){if(_0x40f519[_0xbb43('0x53')]){_0x24ba15();}else{return _0x4bc351['status'](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x54')});}})['catch'](function(_0x1a66f0){_0x24ba15(_0x1a66f0);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x4d7034,_0x5e2e6d,_0x1c3482){return licenseUtil['getLicense']()[_0xbb43('0x3b')](function(_0x5e5c86){if(_0x5e5c86[_0xbb43('0x55')]){_0x1c3482();}else{return _0x5e2e6d[_0xbb43('0x3e')](0x193)[_0xbb43('0x34')]({'message':'Forbidden'});}})[_0xbb43('0x36')](function(_0x4d9f18){_0x1c3482(_0x4d9f18);});});};exports[_0xbb43('0x56')]=function(_0x2518bf,_0xd43d24,_0x29840e){_0x2518bf[_0xbb43('0x56')]=!![];return _0x29840e();};exports[_0xbb43('0x57')]=function signToken(_0x37d8d3){return signJwt(_0x37d8d3);};exports['setTokenCookie']=function(_0x93f6e7,_0x26ea59){if(!_0x93f6e7[_0xbb43('0x40')]){return _0x26ea59[_0xbb43('0x3e')](0x194)['json']({'message':_0xbb43('0x58')});}var _0x3233b7={'payload':{'id':_0x93f6e7[_0xbb43('0x40')]['id'],'role':_0x93f6e7[_0xbb43('0x40')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3233b7)[_0xbb43('0x3b')](function(_0x3fdb10){_0x26ea59[_0xbb43('0x59')]('motion.token',_0x3fdb10);_0x26ea59[_0xbb43('0x5a')](_0xbb43('0x5b'));})[_0xbb43('0x36')](function(_0x1dc40a){return _0x26ea59[_0xbb43('0x3e')](0x1f4)['send'](_0x1dc40a);});};exports['retrieveApiKey']=function(_0xb44557){if(_['isNil'](_0xb44557[_0xbb43('0x5c')])||_[_0xbb43('0x5d')](_0xb44557['apiKeyIat'])){return null;}else{return createJwt(_0xb44557);}};exports[_0xbb43('0x5e')]=function(_0x3719dc){_0x3719dc[_0xbb43('0x5c')]=generateNonce();_0x3719dc[_0xbb43('0x5f')]=generateIssuedAt();return createJwt(_0x3719dc);};exports[_0xbb43('0x60')]=function(_0x5cb3c6,_0x124f88){var _0x539ffc=_0x5cb3c6['query'][_0xbb43('0x44')];if(_0x539ffc){var _0x1b9307={'nonce':_0x124f88[_0xbb43('0x5c')],'iat':_0x124f88[_0xbb43('0x5f')],'audience':hardwareConf[_0xbb43('0x45')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x539ffc,_0x1b9307)['then'](function(){return generateApiKey(_0x124f88);});}else{throw{'message':_0xbb43('0x61')};}};exports[_0xbb43('0x62')]=function(_0x3a84ad){var _0x308646=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x308646[_0xbb43('0x63')](_0x3a84ad))throw new db[(_0xbb43('0x64'))][(_0xbb43('0x65'))](_0xbb43('0x66'));return;};exports[_0xbb43('0x67')]=function(_0x578b85,_0x1b6f96,_0xb996d7){var _0x432bd8=encryptor[_0xbb43('0x68')](_0x1b6f96)[_0xbb43('0x69')](',');for(var _0x1fae27=0x0;_0x1fae27<_0xb996d7;_0x1fae27++){if(!_0x432bd8[_0x1fae27])break;if(_0x578b85[_0xbb43('0x6a')]()===_0x432bd8[_0x1fae27][_0xbb43('0x6a')]()){var _0x3e01e4=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0xb996d7);if(_0xb996d7===0x1){_0x3e01e4=_0xbb43('0x6b');}throw new db[(_0xbb43('0x64'))][(_0xbb43('0x65'))](_0x3e01e4);}}return;};exports[_0xbb43('0x6c')]=function(_0x38814a,_0x19e27e){var _0x2e01fb=_0x19e27e?encryptor['decryptString'](_0x19e27e)[_0xbb43('0x69')](','):[];if(_0x2e01fb['length']===0x5){_0x2e01fb['splice'](-0x1,0x1);}_0x2e01fb[_0xbb43('0x6d')](_0x38814a);return encryptor[_0xbb43('0x6e')](_0x2e01fb[_0xbb43('0x6f')](','));};function signJwt(_0x22ce17){var _0x24393a=BPromise[_0xbb43('0x70')](jwt[_0xbb43('0x71')],{'context':jwt});var _0x341481=_0x22ce17['secret']||config['secrets'][_0xbb43('0xa')];return new BPromise(function(_0x2b96b8,_0x137e75){_0x24393a(_0x22ce17[_0xbb43('0x72')],_0x341481,_0x22ce17[_0xbb43('0x73')])[_0xbb43('0x3b')](function(_0x12717e){_0x2b96b8(_0x12717e);})[_0xbb43('0x36')](function(_0x3ca6ad){_0x137e75(_0x3ca6ad);});});}function verifyJwt(_0x555426,_0x165936,_0x392d1a){var _0x234bc7=BPromise[_0xbb43('0x70')](jwt[_0xbb43('0x74')],{'context':jwt});var _0x33a4db=_0x392d1a||config['secrets'][_0xbb43('0xa')];return new BPromise(function(_0xb48be2,_0x42e437){_0x234bc7(_0x555426,_0x33a4db,_0x165936)[_0xbb43('0x3b')](function(_0xc34a02){_0xb48be2(_0xc34a02);})['catch'](function(_0x3c260f){_0x42e437(_0x3c260f);});});}function generateNonce(){return crypto[_0xbb43('0x75')](0x10)[_0xbb43('0x76')](_0xbb43('0x77'));}function generateIssuedAt(){return Math[_0xbb43('0x78')](Date[_0xbb43('0x79')]()/0x3e8)[_0xbb43('0x76')]();}function createJwt(_0x2992ea){var _0x10fd8b={'payload':{'iat':_0x2992ea[_0xbb43('0x5f')],'nonce':_0x2992ea['apiKeyNonce']},'options':{'algorithm':_0xbb43('0x7a'),'subject':_0x2992ea['id']['toString'](),'issuer':hardwareConf[_0xbb43('0x45')](),'audience':hardwareConf[_0xbb43('0x45')]()}};return signJwt(_0x10fd8b)[_0xbb43('0x3b')](function(_0x3dbcd9){return{'iat':_0x2992ea[_0xbb43('0x5f')],'nonce':_0x2992ea['apiKeyNonce'],'token':_0x3dbcd9};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 396f9f7..17238dc 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['buildContactsQuery','getFilteredContacts','catch','CmContact','keys','filter','cf_','CmCustomField','slice','all','length','./sql-utils','findAll','resolve','then','search','parseAdvancedSearchFilter','where','default','fields','clause','user','skip','checkListsRestrictions','ids','tag','count'];(function(_0x49636b,_0x41ec3e){var _0x21f151=function(_0x203cca){while(--_0x203cca){_0x49636b['push'](_0x49636b['shift']());}};_0x21f151(++_0x41ec3e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var sqlUtils=require(_0x65f6('0x0'));var db=require('../../mysqldb')['db'];exports[_0x65f6('0x1')]=function(_0x2f06ae,_0x3461cd,_0xbce843,_0x1a330c){var _0x5eb9ad={'count':0x0,'rows':[]};var _0x3c5029=sqlUtils['skipContactsQuery'](_0x3461cd,_0x2f06ae);if(_0x3c5029){return Promise[_0x65f6('0x2')](_0x5eb9ad);}var _0x22b017=sqlUtils['getContactsSubquery']();var _0x4ed98f={};var _0x1c0e12=![];var _0x2c6571=![];return Promise[_0x65f6('0x2')]()[_0x65f6('0x3')](function(){if(_0x2f06ae[_0x65f6('0x4')]){return sqlUtils[_0x65f6('0x5')](_0x2f06ae['search'],_0x1a330c);}else{return sqlUtils['parseQueryParameters'](_0x2f06ae,_0x1a330c);}})[_0x65f6('0x3')](function(_0x2f6d5b){_0x22b017[_0x65f6('0x6')](_0x2f6d5b[_0x65f6('0x7')]);_0x22b017['where'](_0x2f6d5b[_0x65f6('0x8')]);_0x22b017['where'](_0x2f6d5b['filter']);_0x22b017[_0x65f6('0x6')](_0x2f6d5b['user'][_0x65f6('0x9')]);_0x4ed98f=_0x2f6d5b['tags'];_0x2c6571=_0x2f6d5b[_0x65f6('0xa')][_0x65f6('0xb')];return sqlUtils[_0x65f6('0xc')](_0x3461cd,_0x2f06ae,_0x2c6571);})[_0x65f6('0x3')](function(_0x369f96){_0x22b017[_0x65f6('0x6')](_0x369f96);var _0x44144b=_0x2f06ae[_0x65f6('0x4')]?_0x4ed98f[_0x65f6('0xd')]:_0x2f06ae[_0x65f6('0xe')];_0x1c0e12=_0x44144b?!![]:![];return sqlUtils['countFilteredContacts'](_0x22b017,_0x44144b);})[_0x65f6('0x3')](function(_0x49a913){_0x5eb9ad['count']=_0x49a913;if(_0x5eb9ad[_0x65f6('0xf')]===0x0){return;}return sqlUtils[_0x65f6('0x10')](_0x22b017,_0x2f06ae[_0x65f6('0x8')],_0xbce843,_0x1c0e12,_0x4ed98f[_0x65f6('0x9')],_0x2c6571);})[_0x65f6('0x3')](function(_0x1f974c){if(!_0x1f974c){return[];}return sqlUtils[_0x65f6('0x11')](_0x1f974c,_0x2f06ae,_0xbce843);})[_0x65f6('0x3')](function(_0x495dd6){_0x5eb9ad['rows']=_0x495dd6;return _0x5eb9ad;})[_0x65f6('0x12')](function(_0x5b4055){throw _0x5b4055;});};exports['describe']=function(){var _0x5c5b91={};var _0x365159=[];return db[_0x65f6('0x13')]['describe']()[_0x65f6('0x3')](function(_0x270893){_0x5c5b91=_0x270893;var _0xbee6a4=Object[_0x65f6('0x14')](_0x5c5b91)[_0x65f6('0x15')](function(_0xc139c2){return _['startsWith'](_0xc139c2,_0x65f6('0x16'))?_0xc139c2:undefined;});var _0x4bb39e=_0xbee6a4['map'](function(_0x212247){return db[_0x65f6('0x17')]['findOne']({'where':{'id':_0x212247[_0x65f6('0x18')](0x3)},'raw':!![]});});return Promise[_0x65f6('0x19')](_0x4bb39e);})[_0x65f6('0x3')](function(_0x2774a1){for(var _0x4f5a69=0x0;_0x4f5a69<_0x2774a1[_0x65f6('0x1a')];_0x4f5a69++){if(_0x2774a1[_0x4f5a69]){var _0x59ea32=_0x65f6('0x16')+_0x2774a1[_0x4f5a69]['id'];_0x5c5b91[_0x59ea32]['fieldType']=_0x2774a1[_0x4f5a69]['type'];}}_0x365159=_['map'](Object[_0x65f6('0x14')](_0x5c5b91),function(_0x16cde8){return{'name':_0x16cde8,'type':_0x5c5b91[_0x16cde8]['type']};});return _0x365159;})[_0x65f6('0x12')](function(_0x28f710){throw _0x28f710;});}; \ No newline at end of file +var _0x0b0e=['tags','skip','tag','count','getFilteredContacts','catch','CmContact','keys','cf_','map','findOne','all','length','type','lodash','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','filter','user','clause'];(function(_0x18d862,_0x3bf0e8){var _0x2066d7=function(_0x45bda4){while(--_0x45bda4){_0x18d862['push'](_0x18d862['shift']());}};_0x2066d7(++_0x3bf0e8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x26f866,_0x1900bc){_0x26f866=_0x26f866-0x0;var _0x1abef3=_0x0b0e[_0x26f866];return _0x1abef3;};'use strict';var _=require(_0xe0b0('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xe0b0('0x1'))['db'];exports['findAll']=function(_0x7e5a8a,_0xdf715e,_0x3b5e2b,_0x25153a){var _0x28040c={'count':0x0,'rows':[]};var _0x38a058=sqlUtils[_0xe0b0('0x2')](_0xdf715e,_0x7e5a8a);if(_0x38a058){return Promise[_0xe0b0('0x3')](_0x28040c);}var _0x30e20d=sqlUtils[_0xe0b0('0x4')]();var _0x219b1c={};var _0x5cf9cc=![];var _0x50be7f=![];return Promise[_0xe0b0('0x3')]()[_0xe0b0('0x5')](function(){if(_0x7e5a8a[_0xe0b0('0x6')]){return sqlUtils[_0xe0b0('0x7')](_0x7e5a8a['search'],_0x25153a);}else{return sqlUtils[_0xe0b0('0x8')](_0x7e5a8a,_0x25153a);}})[_0xe0b0('0x5')](function(_0x553d4f){_0x30e20d[_0xe0b0('0x9')](_0x553d4f[_0xe0b0('0xa')]);_0x30e20d['where'](_0x553d4f[_0xe0b0('0xb')]);_0x30e20d[_0xe0b0('0x9')](_0x553d4f[_0xe0b0('0xc')]);_0x30e20d['where'](_0x553d4f[_0xe0b0('0xd')][_0xe0b0('0xe')]);_0x219b1c=_0x553d4f[_0xe0b0('0xf')];_0x50be7f=_0x553d4f[_0xe0b0('0xd')][_0xe0b0('0x10')];return sqlUtils['checkListsRestrictions'](_0xdf715e,_0x7e5a8a,_0x50be7f);})[_0xe0b0('0x5')](function(_0x154de6){_0x30e20d[_0xe0b0('0x9')](_0x154de6);var _0x24babd=_0x7e5a8a[_0xe0b0('0x6')]?_0x219b1c['ids']:_0x7e5a8a[_0xe0b0('0x11')];_0x5cf9cc=_0x24babd?!![]:![];return sqlUtils['countFilteredContacts'](_0x30e20d,_0x24babd);})[_0xe0b0('0x5')](function(_0xadee6e){_0x28040c['count']=_0xadee6e;if(_0x28040c[_0xe0b0('0x12')]===0x0){return;}return sqlUtils['buildContactsQuery'](_0x30e20d,_0x7e5a8a[_0xe0b0('0xb')],_0x3b5e2b,_0x5cf9cc,_0x219b1c[_0xe0b0('0xe')],_0x50be7f);})['then'](function(_0x54a3eb){if(!_0x54a3eb){return[];}return sqlUtils[_0xe0b0('0x13')](_0x54a3eb,_0x7e5a8a,_0x3b5e2b);})['then'](function(_0x4df8da){_0x28040c['rows']=_0x4df8da;return _0x28040c;})[_0xe0b0('0x14')](function(_0x50fa4a){throw _0x50fa4a;});};exports['describe']=function(){var _0x10cde1={};var _0x59dff5=[];return db[_0xe0b0('0x15')]['describe']()[_0xe0b0('0x5')](function(_0x1cd7c4){_0x10cde1=_0x1cd7c4;var _0x3e10b3=Object[_0xe0b0('0x16')](_0x10cde1)[_0xe0b0('0xc')](function(_0x58b804){return _['startsWith'](_0x58b804,_0xe0b0('0x17'))?_0x58b804:undefined;});var _0x5512bb=_0x3e10b3[_0xe0b0('0x18')](function(_0x31b5f8){return db['CmCustomField'][_0xe0b0('0x19')]({'where':{'id':_0x31b5f8['slice'](0x3)},'raw':!![]});});return Promise[_0xe0b0('0x1a')](_0x5512bb);})['then'](function(_0x28586d){for(var _0x576352=0x0;_0x576352<_0x28586d[_0xe0b0('0x1b')];_0x576352++){if(_0x28586d[_0x576352]){var _0x4de537=_0xe0b0('0x17')+_0x28586d[_0x576352]['id'];_0x10cde1[_0x4de537]['fieldType']=_0x28586d[_0x576352][_0xe0b0('0x1c')];}}_0x59dff5=_['map'](Object[_0xe0b0('0x16')](_0x10cde1),function(_0x3c3bc2){return{'name':_0x3c3bc2,'type':_0x10cde1[_0x3c3bc2][_0xe0b0('0x1c')]};});return _0x59dff5;})[_0xe0b0('0x14')](function(_0x3ec2){throw _0x3ec2;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index aafb2a4..5924f27 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44d4=['type','value','start','end','Tag','tags','and','ids','User','user','clause','skip','keys','map','compact','Contact','push','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','filter','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','limit','offset','group','subqry.id','having','order','forEach','DESC','from','findAll','color','SELECT','sequelize','query','toString','Tags','clone','COUNT(*)','c.id','isEmpty','Sequelize','QueryTypes','exports','lodash','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','t.id\x20=\x20ct.TagId','firstName','phone','mobile','fax','email','deletedAt','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x44d4,0x161));var _0x444d=function(_0x36e7d3,_0xd816e4){_0x36e7d3=_0x36e7d3-0x0;var _0x1b9c66=_0x44d4[_0x36e7d3];return _0x1b9c66;};'use strict';var _=require(_0x444d('0x0'));var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var utils=require(_0x444d('0x1'));var db=require(_0x444d('0x2'))['db'];function skipContactsQuery(_0x5a77ed,_0x5da726){var _0x51377d=![];if(_0x5a77ed[_0x444d('0x3')]===_0x444d('0x4')&&!_0x5da726[_0x444d('0x5')]&&!_0x5da726[_0x444d('0x6')]&&_0x5da726[_0x444d('0x7')]!==_0x444d('0x8')){_0x51377d=!![];}return _0x51377d;}function getContactsSubquery(){return squel[_0x444d('0x9')]()['from'](_0x444d('0xa'),'c')['where'](_0x444d('0xb'));}function applyJoinClauses(_0xfd355e,_0x87d3e8){var _0x3982b2=_0x87d3e8?'c':_0x444d('0xc');_0xfd355e[_0x444d('0xd')](_0x444d('0xe'),'uc',_0x444d('0xf')+_0x3982b2+_0x444d('0x10'))[_0x444d('0xd')](_0x444d('0x11'),'ct','ct.CmContactId\x20=\x20'+_0x3982b2+_0x444d('0x10'))[_0x444d('0xd')]('tools_tags','t',_0x444d('0x12'));return _0xfd355e;}function addFieldsToQuery(_0x3a2d03,_0x2807fb,_0x488ef6,_0x3382a4,_0x41b794){var _0x390231=_0x41b794?'c':'subqry';if(!_0x2807fb){_0x2807fb=['id',_0x444d('0x13'),'lastName',_0x444d('0x14'),_0x444d('0x15'),_0x444d('0x16'),_0x444d('0x17'),'ListId','CompanyId','createdAt','updatedAt',_0x444d('0x18'),_0x444d('0x19')];}var _0x171c35=_0x488ef6&&_0x41b794||!_0x488ef6&&!_0x41b794;if(_0x3382a4){_0x171c35=_0x3382a4&&_0x41b794||!_0x3382a4&&!_0x41b794;}_0x2807fb['forEach'](function(_0x54e12a){if(_0x54e12a===_0x444d('0x19')){if(_0x171c35){_0x3a2d03[_0x444d('0x1a')](_0x444d('0x1b'),_0x54e12a);}else if(_0x488ef6||_0x3382a4){_0x3a2d03[_0x444d('0x1a')](_0x390231+'.'+_0x54e12a);}}else{_0x3a2d03[_0x444d('0x1a')](_0x390231+'.'+_0x54e12a);}});return _0x3a2d03;}function getSqlClauses(){var _0x4bbcd1={'default':squel[_0x444d('0x1c')](),'fields':squel[_0x444d('0x1c')](),'filter':squel[_0x444d('0x1c')](),'tags':{'clause':squel[_0x444d('0x1c')](),'ids':null},'user':{'clause':squel[_0x444d('0x1c')](),'skip':![]}};return _0x4bbcd1;}function parseTagParameter(_0x25e6ae){var _0x3365ae=squel['expr']();if(_0x25e6ae){var _0x5e071f=utils[_0x444d('0x1d')](_0x25e6ae);_0x5e071f['forEach'](function(_0x4dd652){_0x3365ae['or'](_0x444d('0x1e'),'%,'+_0x4dd652+',%');});}return _0x3365ae;}function parseSearchFilter(_0x11563d){var _0x546a9f=squel['expr']();if(_0x11563d){var _0x17cc83=_0x11563d[_0x444d('0x1f')]('\x5c','\x5c\x5c')[_0x444d('0x1f')](/'/g,'\x27\x27');if(_0x17cc83[_0x444d('0x20')]('\x20')[_0x444d('0x21')]>0x1){_0x546a9f['or'](_0x444d('0x22'),qs[_0x444d('0x23')](_0x17cc83),null);}else{if(qs[_0x444d('0x24')](_0x17cc83)){_0x546a9f['or'](_0x444d('0x25'),_0x17cc83+'%');_0x546a9f['or']('c.phone\x20LIKE\x20?',_0x17cc83+'%');_0x546a9f['or']('c.mobile\x20LIKE\x20?',_0x17cc83+'%');_0x546a9f['or'](_0x444d('0x26'),_0x17cc83+'%');}else if(qs['isEmail'](_0x17cc83)){_0x546a9f['or']('c.email\x20LIKE\x20?',_0x17cc83+'%');}else{_0x546a9f['or'](_0x444d('0x27'),'%'+_0x17cc83+'%');_0x546a9f['or']('c.lastName\x20LIKE\x20?','%'+_0x17cc83+'%');_0x546a9f['or'](_0x444d('0x28'),'%'+_0x17cc83+'%');}}}return _0x546a9f;}function parseAdvancedSearchFilter(_0x197e30,_0x5eaf02){var _0x1f6a96=getSqlClauses();var _0x262fd2=as[_0x444d('0x29')](_0x197e30);var _0xea2b0b=_0x262fd2['sqlOperator'];for(var _0x24ec2e=0x0;_0x24ec2e<_0x262fd2['conditions'][_0x444d('0x21')];_0x24ec2e++){var _0x4a2930=_0x262fd2[_0x444d('0x2a')][_0x24ec2e];var _0xa8aadc='c';var _0x2dfad8=_[_0x444d('0x2b')](_0x5eaf02,[_0x444d('0x2c'),_0x4a2930['field']]);if(_0x2dfad8){if(_0x4a2930[_0x444d('0x1a')]===_0x444d('0x2d')||_0x2dfad8[_0x444d('0x2e')]===_0x444d('0x2f')){_0x4a2930[_0x444d('0x30')]=_0x444d('0x31');}var _0x428155=as[_0x444d('0x32')](_0xa8aadc,_0x2dfad8[_0x444d('0x33')],_0x4a2930);_0x1f6a96['default'][_0xea2b0b](_0x428155['text'],_0x428155[_0x444d('0x34')][_0x444d('0x35')],_0x428155['value'][_0x444d('0x36')]);}else{if(_0x4a2930[_0x444d('0x1a')]===_0x444d('0x37')){var _0x3dd359=_0x4a2930[_0x444d('0x34')]['split'](',')['map'](function(_0x586d83){return Number(_0x586d83);});var _0xedc655=parseTagParameter(_0x3dd359);_0x1f6a96[_0x444d('0x38')]['clause'][_0x444d('0x39')](_0xedc655);_0x1f6a96['tags'][_0x444d('0x3a')]=_0x3dd359;}else if(_0x4a2930[_0x444d('0x1a')]===_0x444d('0x3b')){_0x1f6a96[_0x444d('0x3c')][_0x444d('0x3d')]['and']('uc.UserId\x20=\x20?',_0x4a2930[_0x444d('0x34')]);_0x1f6a96[_0x444d('0x3c')][_0x444d('0x3e')]=!![];}}}return _0x1f6a96;}function parseModelFields(_0x2297d3,_0x226e8e){var _0x1e459a=squel[_0x444d('0x1c')]();var _0x4d61af=_(_0x2297d3)[_0x444d('0x3f')]()[_0x444d('0x40')](function(_0x58dc9d){return _['some'](_0x226e8e,[_0x444d('0x2c'),_0x58dc9d])?_0x58dc9d:undefined;})[_0x444d('0x41')]()['value']();if(_0x2297d3[_0x444d('0x42')]){_0x4d61af[_0x444d('0x43')](_0x444d('0x42'));}if(_0x4d61af[_0x444d('0x21')]>0x0){_0x4d61af['forEach'](function(_0x4c2d45){if(_0x4c2d45==='ListId'){_0x1e459a[_0x444d('0x39')]('c.ListId\x20IN\x20?',[][_0x444d('0x44')](_0x2297d3[_0x4c2d45]));}else if(_0x4c2d45===_0x444d('0x42')){var _0x4cae30='%'+_0x2297d3[_0x4c2d45]+'%';_0x1e459a[_0x444d('0x39')](_0x444d('0x45'),_0x4cae30);}else{_0x1e459a['and']('c.'+_0x4c2d45+_0x444d('0x46'),_0x2297d3[_0x4c2d45]);}});}return _0x1e459a;}function parseQueryParameters(_0x2fec67,_0xd6dab0){var _0x2fa717=getSqlClauses();return Promise[_0x444d('0x47')]()[_0x444d('0x48')](function(){return parseModelFields(_0x2fec67,_0xd6dab0);})[_0x444d('0x48')](function(_0xc73730){_0x2fa717['fields']['and'](_0xc73730);return parseTagParameter(_0x2fec67['tag']);})[_0x444d('0x48')](function(_0x1e1585){_0x2fa717[_0x444d('0x38')][_0x444d('0x3d')]['and'](_0x1e1585);return parseSearchFilter(_0x2fec67[_0x444d('0x49')]);})[_0x444d('0x48')](function(_0x852d09){_0x2fa717['filter']=_0x852d09;return _0x2fa717;});}function checkListsRestrictions(_0x183f5b,_0x4d86a5,_0x29ecae){var _0x5ffa03=squel[_0x444d('0x1c')]();return Promise[_0x444d('0x47')]()['then'](function(){if(_0x4d86a5[_0x444d('0x5')]&&_0x183f5b[_0x444d('0x3')]===_0x444d('0x4')&&!_0x29ecae){return _0x183f5b[_0x444d('0x4a')]({'attributes':['id'],'raw':!![]});}})[_0x444d('0x48')](function(_0x1c8828){if(_0x1c8828){if(_0x1c8828[_0x444d('0x21')]===0x0){_0x5ffa03[_0x444d('0x39')](_0x444d('0x4b'));}else{_0x5ffa03[_0x444d('0x39')](_0x444d('0x4c'),_[_0x444d('0x40')](_0x1c8828,'id'));}}})[_0x444d('0x48')](function(){return _0x5ffa03;});}function buildContactsQuery(_0x7687bc,_0x278dc1,_0x20a00c,_0x44ef12,_0x52a27b,_0x4899f8){if(_0x278dc1){_0x278dc1=_0x20a00c[_0x444d('0x4d')];}_0x7687bc=addFieldsToQuery(_0x7687bc,_0x278dc1,_0x44ef12,_0x4899f8,!![]);var _0x2014d8=squel[_0x444d('0x9')]();_0x2014d8=addFieldsToQuery(_0x2014d8,_0x278dc1,_0x44ef12,_0x4899f8,![]);if(_0x44ef12||_0x4899f8){_0x7687bc=applyJoinClauses(_0x7687bc,!![]);_0x7687bc['group']('c.id');if(_0x20a00c['limit']){_0x2014d8[_0x444d('0x4e')](_0x20a00c[_0x444d('0x4e')]);}if(_0x20a00c[_0x444d('0x4f')]){_0x2014d8[_0x444d('0x4f')](_0x20a00c[_0x444d('0x4f')]);}}else{_0x2014d8=applyJoinClauses(_0x2014d8,![]);_0x2014d8[_0x444d('0x50')](_0x444d('0x51'));if(_0x20a00c[_0x444d('0x4e')]){_0x7687bc[_0x444d('0x4e')](_0x20a00c[_0x444d('0x4e')]);}if(_0x20a00c[_0x444d('0x4f')]){_0x7687bc[_0x444d('0x4f')](_0x20a00c['offset']);}}_0x2014d8[_0x444d('0x52')](_0x52a27b);if(_0x20a00c['order']){_0x20a00c[_0x444d('0x53')][_0x444d('0x54')](function(_0x579de1){_0x7687bc[_0x444d('0x53')]('c.'+_0x579de1[0x0],_0x579de1[0x1]===_0x444d('0x55')?![]:!![]);_0x2014d8[_0x444d('0x53')]('subqry.'+_0x579de1[0x0],_0x579de1[0x1]==='DESC'?![]:!![]);});}_0x2014d8[_0x444d('0x56')](_0x7687bc,_0x444d('0xc'));return _0x2014d8;}function getFilteredContacts(_0x2b3525){var _0x4c3962=[];return db[_0x444d('0x37')][_0x444d('0x57')]({'attributes':['id',_0x444d('0x2c'),_0x444d('0x58')],'raw':!![]})[_0x444d('0x48')](function(_0x172a8a){_0x4c3962=_['keyBy'](_0x172a8a,'id');var _0x37a11a={'type':db['Sequelize']['QueryTypes'][_0x444d('0x59')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x444d('0x5a')][_0x444d('0x5b')](_0x2b3525[_0x444d('0x5c')](),_0x37a11a);})[_0x444d('0x48')](function(_0x57d76e){_0x57d76e[_0x444d('0x54')](function(_0xb32756){if(_0xb32756[_0x444d('0x19')]){_0xb32756[_0x444d('0x5d')]=[];_0xb32756[_0x444d('0x19')][_0x444d('0x20')](',')[_0x444d('0x54')](function(_0x4905a0){_0xb32756[_0x444d('0x5d')][_0x444d('0x43')](_0x4c3962[_0x4905a0]);});}delete _0xb32756['TagIds'];});return _0x57d76e;});}function countFilteredContacts(_0xacaabe,_0x5d518d){var _0x562ac0=_0xacaabe[_0x444d('0x5e')]();_0x562ac0['field'](_0x444d('0x5f'));_0x562ac0=applyJoinClauses(_0x562ac0,!![]);_0xacaabe[_0x444d('0x50')](_0x444d('0x60'));var _0x1d2803=utils['getSelectedTags'](_0x5d518d);if(!_[_0x444d('0x61')](_0x1d2803)){_0x562ac0['where']('t.id\x20IN\x20?',_0x1d2803);}var _0x13fc76={'type':db[_0x444d('0x62')][_0x444d('0x63')][_0x444d('0x59')],'raw':!![]};return db[_0x444d('0x5a')][_0x444d('0x5b')](_0x562ac0[_0x444d('0x5c')](),_0x13fc76)['then'](function(_0x315916){return _0x315916[0x0][_0x444d('0x5f')];});}module[_0x444d('0x64')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x5e30=['subqry.id','having','order','DESC','subqry.','keyBy','Sequelize','SELECT','CmContact','sequelize','query','Tags','push','clone','COUNT(*)','group','isEmpty','QueryTypes','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role','agent','search','ListId','autocomplete','from','cm_contacts','c.deletedAt\x20IS\x20NULL','cm_user_has_contacts','.id','left_join','cm_contact_has_tags','t.id\x20=\x20ct.TagId','subqry','lastName','fax','email','createdAt','updatedAt','deletedAt','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','datetime','castTo','DATE','buildExpression','type','text','value','end','Tag','map','tags','User','user','clause','and','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','select','c.id','limit','offset'];(function(_0xb6c5f8,_0x2f1ff6){var _0x57f855=function(_0x5f3edd){while(--_0x5f3edd){_0xb6c5f8['push'](_0xb6c5f8['shift']());}};_0x57f855(++_0x2f1ff6);}(_0x5e30,0x7b));var _0x05e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e30[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x05e3('0x0'));var squel=require(_0x05e3('0x1'));var as=require(_0x05e3('0x2'));var qs=require(_0x05e3('0x3'));var utils=require(_0x05e3('0x4'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x5136f8,_0x5675cc){var _0x187527=![];if(_0x5136f8[_0x05e3('0x5')]===_0x05e3('0x6')&&!_0x5675cc[_0x05e3('0x7')]&&!_0x5675cc[_0x05e3('0x8')]&&_0x5675cc[_0x05e3('0x9')]!=='true'){_0x187527=!![];}return _0x187527;}function getContactsSubquery(){return squel['select']()[_0x05e3('0xa')](_0x05e3('0xb'),'c')['where'](_0x05e3('0xc'));}function applyJoinClauses(_0x1d849b,_0x14e007){var _0x2afc34=_0x14e007?'c':'subqry';_0x1d849b['left_join'](_0x05e3('0xd'),'uc','uc.CmContactId\x20=\x20'+_0x2afc34+_0x05e3('0xe'))[_0x05e3('0xf')](_0x05e3('0x10'),'ct','ct.CmContactId\x20=\x20'+_0x2afc34+_0x05e3('0xe'))[_0x05e3('0xf')]('tools_tags','t',_0x05e3('0x11'));return _0x1d849b;}function addFieldsToQuery(_0x5e4e21,_0x1eaa98,_0x2d03c8,_0x2fad56,_0x21d6e2){var _0x5f50ca=_0x21d6e2?'c':_0x05e3('0x12');if(!_0x1eaa98){_0x1eaa98=['id','firstName',_0x05e3('0x13'),'phone','mobile',_0x05e3('0x14'),_0x05e3('0x15'),_0x05e3('0x8'),'CompanyId',_0x05e3('0x16'),_0x05e3('0x17'),_0x05e3('0x18'),_0x05e3('0x19')];}var _0x50dce4=_0x2d03c8&&_0x21d6e2||!_0x2d03c8&&!_0x21d6e2;if(_0x2fad56){_0x50dce4=_0x2fad56&&_0x21d6e2||!_0x2fad56&&!_0x21d6e2;}_0x1eaa98['forEach'](function(_0x8ea7d8){if(_0x8ea7d8===_0x05e3('0x19')){if(_0x50dce4){_0x5e4e21[_0x05e3('0x1a')](_0x05e3('0x1b'),_0x8ea7d8);}else if(_0x2d03c8||_0x2fad56){_0x5e4e21[_0x05e3('0x1a')](_0x5f50ca+'.'+_0x8ea7d8);}}else{_0x5e4e21[_0x05e3('0x1a')](_0x5f50ca+'.'+_0x8ea7d8);}});return _0x5e4e21;}function getSqlClauses(){var _0x57c59f={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x05e3('0x1c')](),'tags':{'clause':squel[_0x05e3('0x1c')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x57c59f;}function parseTagParameter(_0x46cfd5){var _0x281b0c=squel['expr']();if(_0x46cfd5){var _0x3953af=utils[_0x05e3('0x1d')](_0x46cfd5);_0x3953af[_0x05e3('0x1e')](function(_0x25459c){_0x281b0c['or'](_0x05e3('0x1f'),'%,'+_0x25459c+',%');});}return _0x281b0c;}function parseSearchFilter(_0x5b254e){var _0x40552b=squel[_0x05e3('0x1c')]();if(_0x5b254e){var _0x484cdc=_0x5b254e['replace']('\x5c','\x5c\x5c')[_0x05e3('0x20')](/'/g,'\x27\x27');if(_0x484cdc[_0x05e3('0x21')]('\x20')[_0x05e3('0x22')]>0x1){_0x40552b['or'](_0x05e3('0x23'),qs['getFullTextValue'](_0x484cdc),null);}else{if(qs['isNumeric'](_0x484cdc)){_0x40552b['or'](_0x05e3('0x24'),_0x484cdc+'%');_0x40552b['or'](_0x05e3('0x25'),_0x484cdc+'%');_0x40552b['or'](_0x05e3('0x26'),_0x484cdc+'%');_0x40552b['or']('c.fax\x20LIKE\x20?',_0x484cdc+'%');}else if(qs['isEmail'](_0x484cdc)){_0x40552b['or'](_0x05e3('0x27'),_0x484cdc+'%');}else{_0x40552b['or'](_0x05e3('0x28'),'%'+_0x484cdc+'%');_0x40552b['or'](_0x05e3('0x29'),'%'+_0x484cdc+'%');_0x40552b['or'](_0x05e3('0x27'),'%'+_0x484cdc+'%');}}}return _0x40552b;}function parseAdvancedSearchFilter(_0x2d5d25,_0x5ec676){var _0x27d7e7=getSqlClauses();var _0x46dafa=as[_0x05e3('0x2a')](_0x2d5d25);var _0x5680ef=_0x46dafa[_0x05e3('0x2b')];for(var _0x4ecee8=0x0;_0x4ecee8<_0x46dafa[_0x05e3('0x2c')][_0x05e3('0x22')];_0x4ecee8++){var _0x559991=_0x46dafa[_0x05e3('0x2c')][_0x4ecee8];var _0x3f4868='c';var _0x439309=_[_0x05e3('0x2d')](_0x5ec676,[_0x05e3('0x2e'),_0x559991[_0x05e3('0x1a')]]);if(_0x439309){if(_0x559991[_0x05e3('0x1a')]===_0x05e3('0x2f')||_0x439309['fieldType']===_0x05e3('0x30')){_0x559991[_0x05e3('0x31')]=_0x05e3('0x32');}var _0x4cac45=as[_0x05e3('0x33')](_0x3f4868,_0x439309[_0x05e3('0x34')],_0x559991);_0x27d7e7['default'][_0x5680ef](_0x4cac45[_0x05e3('0x35')],_0x4cac45['value']['start'],_0x4cac45[_0x05e3('0x36')][_0x05e3('0x37')]);}else{if(_0x559991[_0x05e3('0x1a')]===_0x05e3('0x38')){var _0x4457ab=_0x559991['value'][_0x05e3('0x21')](',')[_0x05e3('0x39')](function(_0x48f1f4){return Number(_0x48f1f4);});var _0x51fe55=parseTagParameter(_0x4457ab);_0x27d7e7[_0x05e3('0x3a')]['clause']['and'](_0x51fe55);_0x27d7e7['tags']['ids']=_0x4457ab;}else if(_0x559991[_0x05e3('0x1a')]===_0x05e3('0x3b')){_0x27d7e7[_0x05e3('0x3c')][_0x05e3('0x3d')][_0x05e3('0x3e')](_0x05e3('0x3f'),_0x559991[_0x05e3('0x36')]);_0x27d7e7[_0x05e3('0x3c')][_0x05e3('0x40')]=!![];}}}return _0x27d7e7;}function parseModelFields(_0x2e5282,_0xdcd4d2){var _0x4623bd=squel[_0x05e3('0x1c')]();var _0x2d2b10=_(_0x2e5282)[_0x05e3('0x41')]()[_0x05e3('0x39')](function(_0x553339){return _[_0x05e3('0x42')](_0xdcd4d2,[_0x05e3('0x2e'),_0x553339])?_0x553339:undefined;})[_0x05e3('0x43')]()[_0x05e3('0x36')]();if(_0x2e5282[_0x05e3('0x44')]){_0x2d2b10['push'](_0x05e3('0x44'));}if(_0x2d2b10[_0x05e3('0x22')]>0x0){_0x2d2b10[_0x05e3('0x1e')](function(_0xe9b1aa){if(_0xe9b1aa===_0x05e3('0x8')){_0x4623bd['and'](_0x05e3('0x45'),[][_0x05e3('0x46')](_0x2e5282[_0xe9b1aa]));}else if(_0xe9b1aa===_0x05e3('0x44')){var _0x58cd0b='%'+_0x2e5282[_0xe9b1aa]+'%';_0x4623bd[_0x05e3('0x3e')](_0x05e3('0x47'),_0x58cd0b);}else{_0x4623bd['and']('c.'+_0xe9b1aa+_0x05e3('0x48'),_0x2e5282[_0xe9b1aa]);}});}return _0x4623bd;}function parseQueryParameters(_0x29a754,_0x522a7c){var _0x2e9b0e=getSqlClauses();return Promise[_0x05e3('0x49')]()[_0x05e3('0x4a')](function(){return parseModelFields(_0x29a754,_0x522a7c);})[_0x05e3('0x4a')](function(_0x19b9d1){_0x2e9b0e[_0x05e3('0x4b')][_0x05e3('0x3e')](_0x19b9d1);return parseTagParameter(_0x29a754[_0x05e3('0x4c')]);})['then'](function(_0x447592){_0x2e9b0e['tags']['clause'][_0x05e3('0x3e')](_0x447592);return parseSearchFilter(_0x29a754['filter']);})['then'](function(_0x6db49a){_0x2e9b0e[_0x05e3('0x4d')]=_0x6db49a;return _0x2e9b0e;});}function checkListsRestrictions(_0x275859,_0x1630dd,_0x3f0b2f){var _0x5b1bcd=squel[_0x05e3('0x1c')]();return Promise[_0x05e3('0x49')]()[_0x05e3('0x4a')](function(){if(_0x1630dd[_0x05e3('0x7')]&&_0x275859[_0x05e3('0x5')]===_0x05e3('0x6')&&!_0x3f0b2f){return _0x275859[_0x05e3('0x4e')]({'attributes':['id'],'raw':!![]});}})[_0x05e3('0x4a')](function(_0x1b876e){if(_0x1b876e){if(_0x1b876e[_0x05e3('0x22')]===0x0){_0x5b1bcd[_0x05e3('0x3e')](_0x05e3('0x4f'));}else{_0x5b1bcd[_0x05e3('0x3e')](_0x05e3('0x45'),_[_0x05e3('0x39')](_0x1b876e,'id'));}}})[_0x05e3('0x4a')](function(){return _0x5b1bcd;});}function buildContactsQuery(_0x2f9048,_0x51ee9c,_0x5d31b9,_0x5d7ca7,_0x2685a5,_0x1bed6a){if(_0x51ee9c){_0x51ee9c=_0x5d31b9[_0x05e3('0x50')];}_0x2f9048=addFieldsToQuery(_0x2f9048,_0x51ee9c,_0x5d7ca7,_0x1bed6a,!![]);var _0x372b81=squel[_0x05e3('0x51')]();_0x372b81=addFieldsToQuery(_0x372b81,_0x51ee9c,_0x5d7ca7,_0x1bed6a,![]);if(_0x5d7ca7||_0x1bed6a){_0x2f9048=applyJoinClauses(_0x2f9048,!![]);_0x2f9048['group'](_0x05e3('0x52'));if(_0x5d31b9['limit']){_0x372b81[_0x05e3('0x53')](_0x5d31b9['limit']);}if(_0x5d31b9[_0x05e3('0x54')]){_0x372b81['offset'](_0x5d31b9[_0x05e3('0x54')]);}}else{_0x372b81=applyJoinClauses(_0x372b81,![]);_0x372b81['group'](_0x05e3('0x55'));if(_0x5d31b9['limit']){_0x2f9048[_0x05e3('0x53')](_0x5d31b9[_0x05e3('0x53')]);}if(_0x5d31b9[_0x05e3('0x54')]){_0x2f9048[_0x05e3('0x54')](_0x5d31b9[_0x05e3('0x54')]);}}_0x372b81[_0x05e3('0x56')](_0x2685a5);if(_0x5d31b9[_0x05e3('0x57')]){_0x5d31b9[_0x05e3('0x57')][_0x05e3('0x1e')](function(_0x56f377){_0x2f9048[_0x05e3('0x57')]('c.'+_0x56f377[0x0],_0x56f377[0x1]===_0x05e3('0x58')?![]:!![]);_0x372b81[_0x05e3('0x57')](_0x05e3('0x59')+_0x56f377[0x0],_0x56f377[0x1]===_0x05e3('0x58')?![]:!![]);});}_0x372b81[_0x05e3('0xa')](_0x2f9048,_0x05e3('0x12'));return _0x372b81;}function getFilteredContacts(_0x1ba314){var _0x192135=[];return db[_0x05e3('0x38')]['findAll']({'attributes':['id','name','color'],'raw':!![]})[_0x05e3('0x4a')](function(_0x54b66e){_0x192135=_[_0x05e3('0x5a')](_0x54b66e,'id');var _0x254720={'type':db[_0x05e3('0x5b')]['QueryTypes'][_0x05e3('0x5c')],'model':db[_0x05e3('0x5d')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x05e3('0x5e')][_0x05e3('0x5f')](_0x1ba314['toString'](),_0x254720);})[_0x05e3('0x4a')](function(_0x2ac356){_0x2ac356[_0x05e3('0x1e')](function(_0x45d3bd){if(_0x45d3bd[_0x05e3('0x19')]){_0x45d3bd[_0x05e3('0x60')]=[];_0x45d3bd[_0x05e3('0x19')]['split'](',')[_0x05e3('0x1e')](function(_0x4a1932){_0x45d3bd['Tags'][_0x05e3('0x61')](_0x192135[_0x4a1932]);});}delete _0x45d3bd['TagIds'];});return _0x2ac356;});}function countFilteredContacts(_0x316c50,_0x30e291){var _0x454be2=_0x316c50[_0x05e3('0x62')]();_0x454be2[_0x05e3('0x1a')](_0x05e3('0x63'));_0x454be2=applyJoinClauses(_0x454be2,!![]);_0x316c50[_0x05e3('0x64')]('c.id');var _0x4e0f6f=utils[_0x05e3('0x1d')](_0x30e291);if(!_[_0x05e3('0x65')](_0x4e0f6f)){_0x454be2['where']('t.id\x20IN\x20?',_0x4e0f6f);}var _0x20b115={'type':db[_0x05e3('0x5b')][_0x05e3('0x66')][_0x05e3('0x5c')],'raw':!![]};return db[_0x05e3('0x5e')][_0x05e3('0x5f')](_0x454be2['toString'](),_0x20b115)[_0x05e3('0x4a')](function(_0xa0ffb6){return _0xa0ffb6[0x0][_0x05e3('0x63')];});}module[_0x05e3('0x67')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 172cd8f..e6689db 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 _0x1acb=['createCipher','utf8','base64','secret','crypto','bluebird','lodash','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','filter','hasOwnProperty','encryptFile','data','binary','write','final','end','close','decryptFile','createReadStream','createWriteStream','createDecipher','update','unlink','encryptString'];(function(_0x1f1e5f,_0x376859){var _0x13b7ea=function(_0x27aa70){while(--_0x27aa70){_0x1f1e5f['push'](_0x1f1e5f['shift']());}};_0x13b7ea(++_0x376859);}(_0x1acb,0x1b1));var _0xb1ac=function(_0x2b5f19,_0x3ac009){_0x2b5f19=_0x2b5f19-0x0;var _0x1b42c5=_0x1acb[_0x2b5f19];return _0x1b42c5;};'use strict';var crypto=require(_0xb1ac('0x0'));var fs=require('fs');var BPromise=require(_0xb1ac('0x1'));var _=require(_0xb1ac('0x2'));var config=require('../../config/environment');var logger=require(_0xb1ac('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xb1ac('0x4')][_0xb1ac('0x5')],'algorithm':_0xb1ac('0x6')};const fileOptions={'algorithm':_0xb1ac('0x7')};if(config[_0xb1ac('0x8')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config[_0xb1ac('0x8')][_0xb1ac('0x9')]);if(isSupported){fileOptions['algorithm']=config['encrypt'][_0xb1ac('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xb1ac('0xa')](',\x20');logger[_0xb1ac('0xb')](config['encrypt'][_0xb1ac('0x9')],_0xb1ac('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x42a423){return AES_SUPPORTED_RX['test'](_0x42a423);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xb1ac('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x61e5d5){return getSupportedCiphers()['indexOf'](_0x61e5d5)>-0x1;}function combineOptions(_0x524356){var _0x3d7ef7={};for(var _0x249b80 in fileOptions){if(fileOptions[_0xb1ac('0xe')](_0x249b80)){_0x3d7ef7[_0x249b80]=fileOptions[_0x249b80];}}if(_0x524356){for(var _0x22b89b in _0x524356){if(_0x524356[_0xb1ac('0xe')](_0x22b89b)){_0x3d7ef7[_0x22b89b]=_0x524356[_0x22b89b];}}}return _0x3d7ef7;}exports[_0xb1ac('0xf')]=function(_0x869805,_0x488f05,_0x325874,_0x2464d2){return new BPromise(function(_0x430873,_0x454d4f){_0x2464d2=combineOptions(_0x2464d2);var _0x85d814=new Buffer(_0x325874);var _0x3b24d5=fs['createReadStream'](_0x869805);var _0x12074a=fs['createWriteStream'](_0x488f05);var _0x1e07fd=crypto['createCipher'](_0x2464d2[_0xb1ac('0x9')],_0x85d814);_0x3b24d5['on'](_0xb1ac('0x10'),function(_0x10236f){var _0x1b8b72=new Buffer(_0x1e07fd['update'](_0x10236f),_0xb1ac('0x11'));_0x12074a[_0xb1ac('0x12')](_0x1b8b72);});_0x3b24d5['on']('end',function(){try{var _0x4ccefe=new Buffer(_0x1e07fd[_0xb1ac('0x13')]('binary'),_0xb1ac('0x11'));_0x12074a[_0xb1ac('0x12')](_0x4ccefe);_0x12074a[_0xb1ac('0x14')]();_0x12074a['on'](_0xb1ac('0x15'),function(){return _0x430873(_0x488f05);});}catch(_0x2f7444){fs['unlink'](_0x488f05);return _0x454d4f(_0x2f7444);}});});};exports[_0xb1ac('0x16')]=function(_0x157152,_0x290c4c,_0x8c9666,_0x2070f6){return new BPromise(function(_0x21fcd3,_0x346434){_0x2070f6=combineOptions(_0x2070f6);var _0x1d79de=new Buffer(_0x8c9666);var _0x4b9484=fs[_0xb1ac('0x17')](_0x157152);var _0x40cda5=fs[_0xb1ac('0x18')](_0x290c4c);var _0x49345f=crypto[_0xb1ac('0x19')](_0x2070f6[_0xb1ac('0x9')],_0x1d79de);_0x4b9484['on'](_0xb1ac('0x10'),function(_0x24710a){var _0x435fc1=new Buffer(_0x49345f[_0xb1ac('0x1a')](_0x24710a),'binary');_0x40cda5[_0xb1ac('0x12')](_0x435fc1);});_0x4b9484['on'](_0xb1ac('0x14'),function(){try{var _0x438edf=new Buffer(_0x49345f[_0xb1ac('0x13')](_0xb1ac('0x11')),_0xb1ac('0x11'));_0x40cda5[_0xb1ac('0x12')](_0x438edf);_0x40cda5[_0xb1ac('0x14')]();_0x40cda5['on'](_0xb1ac('0x15'),function(){return _0x21fcd3(_0x290c4c);});}catch(_0x4ece25){fs[_0xb1ac('0x1b')](_0x290c4c);return _0x346434(_0x4ece25);}});});};exports[_0xb1ac('0x1c')]=function(_0x4c45a7,_0x2a2473,_0x17256c){var _0x3931c9=_0x17256c||stringOptions[_0xb1ac('0x9')];var _0x45ca3b=_0x2a2473||stringOptions['secret'];var _0x59bc2d=crypto[_0xb1ac('0x1d')](_0x3931c9,_0x45ca3b);var _0x1814b0=_0x59bc2d[_0xb1ac('0x1a')](_0x4c45a7,_0xb1ac('0x1e'),_0xb1ac('0x1f'));_0x1814b0+=_0x59bc2d[_0xb1ac('0x13')](_0xb1ac('0x1f'));return _0x1814b0;};exports['decryptString']=function(_0x20112d,_0xad8b1b,_0x26a419){var _0x35f8fc=_0x26a419||stringOptions[_0xb1ac('0x9')];var _0x51dff2=_0xad8b1b||stringOptions[_0xb1ac('0x20')];var _0x2b6cf8=crypto[_0xb1ac('0x19')](_0x35f8fc,_0x51dff2);var _0x2734d8=_0x2b6cf8[_0xb1ac('0x1a')](_0x20112d,_0xb1ac('0x1f'),_0xb1ac('0x1e'));_0x2734d8+=_0x2b6cf8[_0xb1ac('0x13')](_0xb1ac('0x1e'));return _0x2734d8;}; \ No newline at end of file +var _0x8535=['binary','write','final','end','unlink','decryptFile','createWriteStream','createDecipher','close','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update'];(function(_0xee0ada,_0x69c6ca){var _0x2a9d5a=function(_0x4ae4db){while(--_0x4ae4db){_0xee0ada['push'](_0xee0ada['shift']());}};_0x2a9d5a(++_0x69c6ca);}(_0x8535,0x77));var _0x5853=function(_0x2de0b4,_0x252563){_0x2de0b4=_0x2de0b4-0x0;var _0x637314=_0x8535[_0x2de0b4];return _0x637314;};'use strict';var crypto=require(_0x5853('0x0'));var fs=require('fs');var BPromise=require(_0x5853('0x1'));var _=require(_0x5853('0x2'));var config=require(_0x5853('0x3'));var logger=require(_0x5853('0x4'))(_0x5853('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x5853('0x6')][_0x5853('0x7')],'algorithm':_0x5853('0x8')};const fileOptions={'algorithm':_0x5853('0x9')};if(config['encrypt']&&config[_0x5853('0xa')][_0x5853('0xb')]){var isSupported=isAlgorithmSupported(config[_0x5853('0xa')][_0x5853('0xb')]);if(isSupported){fileOptions[_0x5853('0xb')]=config['encrypt'][_0x5853('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x5853('0xc')](',\x20');logger[_0x5853('0xd')](config['encrypt'][_0x5853('0xb')],_0x5853('0xe'),supportedAlgorithms);}}function isASupportedCipher(_0x23db59){return AES_SUPPORTED_RX['test'](_0x23db59);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x26bb8b){return getSupportedCiphers()['indexOf'](_0x26bb8b)>-0x1;}function combineOptions(_0x3e44b5){var _0x33ab1c={};for(var _0xb02598 in fileOptions){if(fileOptions[_0x5853('0xf')](_0xb02598)){_0x33ab1c[_0xb02598]=fileOptions[_0xb02598];}}if(_0x3e44b5){for(var _0x3d9b3c in _0x3e44b5){if(_0x3e44b5[_0x5853('0xf')](_0x3d9b3c)){_0x33ab1c[_0x3d9b3c]=_0x3e44b5[_0x3d9b3c];}}}return _0x33ab1c;}exports[_0x5853('0x10')]=function(_0x589dd7,_0x1361f4,_0xfeb127,_0x16e0a3){return new BPromise(function(_0x429588,_0x4fb4be){_0x16e0a3=combineOptions(_0x16e0a3);var _0x4183e1=new Buffer(_0xfeb127);var _0x4811ad=fs[_0x5853('0x11')](_0x589dd7);var _0x5b9cd1=fs['createWriteStream'](_0x1361f4);var _0x1e7191=crypto[_0x5853('0x12')](_0x16e0a3[_0x5853('0xb')],_0x4183e1);_0x4811ad['on'](_0x5853('0x13'),function(_0x207bfd){var _0x42655c=new Buffer(_0x1e7191[_0x5853('0x14')](_0x207bfd),_0x5853('0x15'));_0x5b9cd1[_0x5853('0x16')](_0x42655c);});_0x4811ad['on']('end',function(){try{var _0x9592e4=new Buffer(_0x1e7191[_0x5853('0x17')](_0x5853('0x15')),'binary');_0x5b9cd1[_0x5853('0x16')](_0x9592e4);_0x5b9cd1[_0x5853('0x18')]();_0x5b9cd1['on']('close',function(){return _0x429588(_0x1361f4);});}catch(_0x11dc10){fs[_0x5853('0x19')](_0x1361f4);return _0x4fb4be(_0x11dc10);}});});};exports[_0x5853('0x1a')]=function(_0x9aa48f,_0x33d677,_0x4b81b4,_0x4d0edd){return new BPromise(function(_0x19ae37,_0x35438d){_0x4d0edd=combineOptions(_0x4d0edd);var _0x3627f7=new Buffer(_0x4b81b4);var _0x1440bb=fs[_0x5853('0x11')](_0x9aa48f);var _0x7cae3a=fs[_0x5853('0x1b')](_0x33d677);var _0x3048ba=crypto[_0x5853('0x1c')](_0x4d0edd['algorithm'],_0x3627f7);_0x1440bb['on'](_0x5853('0x13'),function(_0x548be9){var _0x77ad42=new Buffer(_0x3048ba[_0x5853('0x14')](_0x548be9),_0x5853('0x15'));_0x7cae3a[_0x5853('0x16')](_0x77ad42);});_0x1440bb['on'](_0x5853('0x18'),function(){try{var _0x37bc17=new Buffer(_0x3048ba[_0x5853('0x17')](_0x5853('0x15')),'binary');_0x7cae3a[_0x5853('0x16')](_0x37bc17);_0x7cae3a[_0x5853('0x18')]();_0x7cae3a['on'](_0x5853('0x1d'),function(){return _0x19ae37(_0x33d677);});}catch(_0x5f3b1e){fs[_0x5853('0x19')](_0x33d677);return _0x35438d(_0x5f3b1e);}});});};exports[_0x5853('0x1e')]=function(_0x2a73f5,_0x2acddd,_0x373806){var _0x227fed=_0x373806||stringOptions[_0x5853('0xb')];var _0x521aec=_0x2acddd||stringOptions[_0x5853('0x1f')];var _0x2ebc61=crypto['createCipher'](_0x227fed,_0x521aec);var _0x4fabaa=_0x2ebc61[_0x5853('0x14')](_0x2a73f5,_0x5853('0x20'),_0x5853('0x21'));_0x4fabaa+=_0x2ebc61[_0x5853('0x17')](_0x5853('0x21'));return _0x4fabaa;};exports[_0x5853('0x22')]=function(_0x403ea0,_0x3c6d9b,_0xefd344){var _0x3d48f9=_0xefd344||stringOptions[_0x5853('0xb')];var _0x18a1d6=_0x3c6d9b||stringOptions[_0x5853('0x1f')];var _0x4c4b8c=crypto['createDecipher'](_0x3d48f9,_0x18a1d6);var _0x251e37=_0x4c4b8c[_0x5853('0x14')](_0x403ea0,_0x5853('0x21'),'utf8');_0x251e37+=_0x4c4b8c[_0x5853('0x17')](_0x5853('0x20'));return _0x251e37;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 5749f13..eea3d9b 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 _0xe945=['push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','.csv','existsSync','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','analytics','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','length','range','isInteger','forEach'];(function(_0x30067d,_0x20b6e8){var _0x8495cf=function(_0x478cd4){while(--_0x478cd4){_0x30067d['push'](_0x30067d['shift']());}};_0x8495cf(++_0x20b6e8);}(_0xe945,0xa9));var _0x5e94=function(_0x156187,_0x353a03){_0x156187=_0x156187-0x0;var _0x15d0f6=_0xe945[_0x156187];return _0x15d0f6;};'use strict';var util=require('util');var path=require(_0x5e94('0x0'));var _=require(_0x5e94('0x1'));var csv=require(_0x5e94('0x2'));var fs=require('fs');var BPromise=require(_0x5e94('0x3'));var zipdir=require(_0x5e94('0x4'));var rimraf=require(_0x5e94('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x5e94('0x6'))['dbH'];var logger=require('../../config/logger')(_0x5e94('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x5e94('0x8')][0x2]);var QUERY=process[_0x5e94('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2a435b,_0x5ddc5b){var _0x16ed87={'status':_0x2a435b};var _0xee933a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5ddc5b){_0x16ed87[_0x5e94('0x9')]=_0x5ddc5b;}return db['AnalyticExtractedReport']['update'](_0x16ed87,_0xee933a);}function main(){var _0x512ce9=0x1388;var _0x57a97f;logger[_0x5e94('0xa')](util[_0x5e94('0xb')](_0x5e94('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x5e94('0xd')][_0x5e94('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5e94('0xf'),_0x5e94('0x10')]})[_0x5e94('0x11')](function(_0x1c3a85){if(_0x1c3a85){_0x57a97f=_0x1c3a85;_0x512ce9=_0x57a97f[_0x5e94('0x10')]||0x1388;}})[_0x5e94('0x11')](function(){return dbH[_0x5e94('0x12')][_0x5e94('0x13')](util['format'](_0x5e94('0x14'),QUERY),{'type':dbH[_0x5e94('0x12')]['QueryTypes'][_0x5e94('0x15')]});})['then'](function(_0x44932f){if(!_0x44932f[0x0][_0x5e94('0x16')]){return analyticExtractedReport('Empty');}var _0x3312f1=[];var _0x404b24=0x0;if(_0x57a97f[_0x5e94('0xf')]){if(_0x44932f&&_0x44932f[_0x5e94('0x17')]){var _0x538e71=_[_0x5e94('0x18')](_0x44932f[0x0][_0x5e94('0x16')]/_0x512ce9);var _0x3965e4=Number[_0x5e94('0x19')](_0x44932f[0x0][_0x5e94('0x16')]/_0x512ce9)?_0x44932f[0x0][_0x5e94('0x16')]%_0x512ce9:0x0;_0x538e71[_0x5e94('0x1a')](function(_0x2a1f05){if(_0x2a1f05>0x0){_0x404b24+=_0x512ce9;}_0x3312f1[_0x5e94('0x1b')](dbH[_0x5e94('0x12')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x512ce9,_0x404b24),{'type':dbH['sequelize']['QueryTypes'][_0x5e94('0x15')]}));});if(_0x3965e4>0x0){_0x404b24+=_0x512ce9;_0x3312f1['push'](dbH[_0x5e94('0x12')]['query'](util[_0x5e94('0xb')](_0x5e94('0x1c'),QUERY,_0x3965e4,_0x404b24),{'type':dbH[_0x5e94('0x12')][_0x5e94('0x1d')]['SELECT']}));}}}else{_0x3312f1[_0x5e94('0x1b')](dbH[_0x5e94('0x12')][_0x5e94('0x13')](QUERY,{'type':dbH[_0x5e94('0x12')][_0x5e94('0x1d')][_0x5e94('0x15')]}));}var _0x3d9252=path[_0x5e94('0x1e')](PATH);var _0x10d611=path['basename'](PATH,_0x5e94('0x1f'));var _0xa29394=_0x57a97f[_0x5e94('0xf')]&&_0x3312f1[_0x5e94('0x17')]>0x1;var _0x9338f4=[];if(!fs[_0x5e94('0x20')](path['join'](_0x3d9252,_0x10d611))&&_0xa29394){fs[_0x5e94('0x21')](path[_0x5e94('0x22')](_0x3d9252,_0x10d611));}return BPromise[_0x5e94('0x23')](_0x3312f1,function(_0x1722b3){_0x9338f4[_0x5e94('0x1b')](_0x1722b3);})[_0x5e94('0x11')](function(){for(var _0x450fd2=0x0;_0x450fd2<_0x9338f4['length'];_0x450fd2+=0x1){var _0x1460a9;var _0x461ba7=_0x9338f4[_0x450fd2];if(_0xa29394){_0x1460a9=path['join'](_0x3d9252,_0x10d611,util[_0x5e94('0xb')](_0x5e94('0x24'),_0x10d611,_0x450fd2,_0x5e94('0x25')));}else{_0x1460a9=path[_0x5e94('0x22')](_0x3d9252,util[_0x5e94('0xb')](_0x5e94('0x26'),_0x10d611,_0x5e94('0x25')));}fs[_0x5e94('0x27')](_0x1460a9,csv(_0x461ba7));}})[_0x5e94('0x11')](function(){if(_0xa29394){return new Promise(function(_0x49d58d){zipdir(path[_0x5e94('0x22')](_0x3d9252,_0x10d611),{'saveTo':path[_0x5e94('0x22')](_0x3d9252,util[_0x5e94('0xb')](_0x5e94('0x26'),_0x10d611,_0x5e94('0x28')))},function(_0x384f0a,_0x42b111){rimraf(path[_0x5e94('0x22')](_0x3d9252,_0x10d611),function(){});_0x49d58d(_0x5e94('0x29'));});});}})['then'](function(){logger[_0x5e94('0xa')](util[_0x5e94('0xb')](_0x5e94('0x2a'),EXTRACTED_REPORT_ID,_0x5e94('0x2b')));return analyticExtractedReport(_0x5e94('0x2c'),_0xa29394?util[_0x5e94('0xb')](_0x5e94('0x26'),_0x10d611,_0xa29394?_0x5e94('0x28'):_0x5e94('0x25')):null);});})['catch'](function(_0x2aad91){logger[_0x5e94('0xa')](util[_0x5e94('0xb')](_0x5e94('0x2d'),EXTRACTED_REPORT_ID,_0x5e94('0x2b')),util[_0x5e94('0x2e')](_0x2aad91,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5e94('0x2f'));})['finally'](function(){process[_0x5e94('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x3605=['AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','QueryTypes','SELECT','num','length','range','isInteger','forEach','push','query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','each','%s%d.%s','csv','%s.%s','zip','zip\x20finished','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','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename'];(function(_0x500785,_0x15e5ff){var _0x1f8bcc=function(_0x406983){while(--_0x406983){_0x500785['push'](_0x500785['shift']());}};_0x1f8bcc(++_0x15e5ff);}(_0x3605,0xee));var _0x5360=function(_0x3e27e5,_0x49f888){_0x3e27e5=_0x3e27e5-0x0;var _0x1a2bbc=_0x3605[_0x3e27e5];return _0x1a2bbc;};'use strict';var util=require(_0x5360('0x0'));var path=require(_0x5360('0x1'));var _=require(_0x5360('0x2'));var csv=require(_0x5360('0x3'));var fs=require('fs');var BPromise=require(_0x5360('0x4'));var zipdir=require(_0x5360('0x5'));var rimraf=require(_0x5360('0x6'));var db=require(_0x5360('0x7'))['db'];var dbH=require(_0x5360('0x7'))[_0x5360('0x8')];var logger=require('../../config/logger')(_0x5360('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x5360('0xa')][0x3];var PATH=process[_0x5360('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2ad37a,_0x4bac27){var _0x5e5027={'status':_0x2ad37a};var _0xba6d92={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4bac27){_0x5e5027[_0x5360('0xb')]=_0x4bac27;}return db[_0x5360('0xc')][_0x5360('0xd')](_0x5e5027,_0xba6d92);}function main(){var _0x192adc=0x1388;var _0x17d9d2;logger['info'](util['format'](_0x5360('0xe'),EXTRACTED_REPORT_ID,_0x5360('0xf')));return db['Setting'][_0x5360('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5360('0x11'),_0x5360('0x12')]})[_0x5360('0x13')](function(_0x1898e7){if(_0x1898e7){_0x17d9d2=_0x1898e7;_0x192adc=_0x17d9d2[_0x5360('0x12')]||0x1388;}})[_0x5360('0x13')](function(){return dbH[_0x5360('0x14')]['query'](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x5360('0x14')][_0x5360('0x15')][_0x5360('0x16')]});})['then'](function(_0x588b11){if(!_0x588b11[0x0][_0x5360('0x17')]){return analyticExtractedReport('Empty');}var _0x13769f=[];var _0x1d34f1=0x0;if(_0x17d9d2[_0x5360('0x11')]){if(_0x588b11&&_0x588b11[_0x5360('0x18')]){var _0x3b9f6a=_[_0x5360('0x19')](_0x588b11[0x0][_0x5360('0x17')]/_0x192adc);var _0x3af3a5=Number[_0x5360('0x1a')](_0x588b11[0x0][_0x5360('0x17')]/_0x192adc)?_0x588b11[0x0]['num']%_0x192adc:0x0;_0x3b9f6a[_0x5360('0x1b')](function(_0x541775){if(_0x541775>0x0){_0x1d34f1+=_0x192adc;}_0x13769f[_0x5360('0x1c')](dbH[_0x5360('0x14')][_0x5360('0x1d')](util[_0x5360('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x192adc,_0x1d34f1),{'type':dbH['sequelize'][_0x5360('0x15')][_0x5360('0x16')]}));});if(_0x3af3a5>0x0){_0x1d34f1+=_0x192adc;_0x13769f[_0x5360('0x1c')](dbH[_0x5360('0x14')]['query'](util[_0x5360('0x1e')](_0x5360('0x1f'),QUERY,_0x3af3a5,_0x1d34f1),{'type':dbH['sequelize'][_0x5360('0x15')][_0x5360('0x16')]}));}}}else{_0x13769f[_0x5360('0x1c')](dbH[_0x5360('0x14')]['query'](QUERY,{'type':dbH[_0x5360('0x14')][_0x5360('0x15')][_0x5360('0x16')]}));}var _0xd95f39=path[_0x5360('0x20')](PATH);var _0x5d7d61=path[_0x5360('0x21')](PATH,_0x5360('0x22'));var _0x5b870d=_0x17d9d2[_0x5360('0x11')]&&_0x13769f['length']>0x1;var _0x31ed36=[];if(!fs[_0x5360('0x23')](path['join'](_0xd95f39,_0x5d7d61))&&_0x5b870d){fs['mkdirSync'](path[_0x5360('0x24')](_0xd95f39,_0x5d7d61));}return BPromise[_0x5360('0x25')](_0x13769f,function(_0x497bb){_0x31ed36[_0x5360('0x1c')](_0x497bb);})[_0x5360('0x13')](function(){for(var _0x3190a0=0x0;_0x3190a0<_0x31ed36[_0x5360('0x18')];_0x3190a0+=0x1){var _0x63b534;var _0xa5711=_0x31ed36[_0x3190a0];if(_0x5b870d){_0x63b534=path[_0x5360('0x24')](_0xd95f39,_0x5d7d61,util['format'](_0x5360('0x26'),_0x5d7d61,_0x3190a0,_0x5360('0x27')));}else{_0x63b534=path['join'](_0xd95f39,util[_0x5360('0x1e')](_0x5360('0x28'),_0x5d7d61,'csv'));}fs['writeFileSync'](_0x63b534,csv(_0xa5711));}})[_0x5360('0x13')](function(){if(_0x5b870d){return new Promise(function(_0x32e87c){zipdir(path[_0x5360('0x24')](_0xd95f39,_0x5d7d61),{'saveTo':path['join'](_0xd95f39,util[_0x5360('0x1e')](_0x5360('0x28'),_0x5d7d61,_0x5360('0x29')))},function(_0xa98e68,_0x272f6a){rimraf(path[_0x5360('0x24')](_0xd95f39,_0x5d7d61),function(){});_0x32e87c(_0x5360('0x2a'));});});}})[_0x5360('0x13')](function(){logger[_0x5360('0x2b')](util['format'](_0x5360('0x2c'),EXTRACTED_REPORT_ID,_0x5360('0xf')));return analyticExtractedReport(_0x5360('0x2d'),_0x5b870d?util['format'](_0x5360('0x28'),_0x5d7d61,_0x5b870d?'zip':_0x5360('0x27')):null);});})['catch'](function(_0x383816){logger[_0x5360('0x2b')](util[_0x5360('0x1e')](_0x5360('0x2e'),EXTRACTED_REPORT_ID,'CSV'),util[_0x5360('0x2f')](_0x383816,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5360('0x30'));})['finally'](function(){process[_0x5360('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index eca95aa..6e2006d 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 _0x3bbc=['existsSync','join','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','catch','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map','pick','toString','value','fill','length','auto','body','push','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','Arial','black','right','num','Setting','find','split','splitSizePdf','then','range','forEach','sequelize','query','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','.pdf'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x3bbc,0x19c));var _0xc3bb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3bbc[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xc3bb('0x0'));var fs=require('fs');var util=require(_0xc3bb('0x1'));var path=require(_0xc3bb('0x2'));var moment=require(_0xc3bb('0x3'));var htmlToPdfmake=require(_0xc3bb('0x4'));var PdfPrinter=require(_0xc3bb('0x5'));var zipdir=require(_0xc3bb('0x6'));var rimraf=require(_0xc3bb('0x7'));var JSDOM=require(_0xc3bb('0x8'))[_0xc3bb('0x9')];var window=new JSDOM('')[_0xc3bb('0xa')];var BPromise=require('bluebird');var db=require(_0xc3bb('0xb'))['db'];var dbH=require(_0xc3bb('0xb'))[_0xc3bb('0xc')];var logger=require(_0xc3bb('0xd'))(_0xc3bb('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0xc3bb('0xf')][0x2]);var QUERY=process[_0xc3bb('0xf')][0x3];var PATH=process[_0xc3bb('0xf')][0x4];var NAME=process[_0xc3bb('0xf')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2dd675,_0x451eef){var _0x1d38a7={'status':_0x2dd675};var _0x21692e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x451eef){_0x1d38a7[_0xc3bb('0x10')]=_0x451eef;}return db[_0xc3bb('0x11')][_0xc3bb('0x12')](_0x1d38a7,_0x21692e);}function getHeaders(_0x20d71b){return _[_0xc3bb('0x13')](_0x20d71b,function(_0x1e33ea){return{'text':_0x1e33ea,'style':'tableHeader'};});}function getRows(_0x5cb2dc,_0x4c957a){return _['map'](_0x4c957a,function(_0x3fdcb0){return _(_0x3fdcb0)[_0xc3bb('0x14')](_0x5cb2dc)[_0xc3bb('0x13')](function(_0x551e59){return _0x551e59?_[_0xc3bb('0x15')](_0x551e59):'';})[_0xc3bb('0x16')]();});}function createTable(_0x2cbe26,_0x8a93e){var _0x3af5b0={'widths':_[_0xc3bb('0x17')](Array(_0x2cbe26[_0xc3bb('0x18')]),0x91),'heights':function(_0x2d15c9){return _0x2d15c9===0x0?_0xc3bb('0x19'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5f5cb6=getHeaders(_0x2cbe26);_0x3af5b0[_0xc3bb('0x1a')][_0xc3bb('0x1b')](_0x5f5cb6);var _0x588d6c=getRows(_0x2cbe26,_0x8a93e);_0x3af5b0[_0xc3bb('0x1a')]=_0x3af5b0[_0xc3bb('0x1a')]['concat'](_0x588d6c);return _0x3af5b0;}function createTables(_0x387e03){var _0x2b7c23=[];var _0x449ac9=_[_0xc3bb('0x1c')](Object[_0xc3bb('0x1d')](_0x387e03[0x0]),0x5);_0x449ac9['forEach'](function(_0x72bb77){_0x2b7c23[_0xc3bb('0x1b')](createTable(_0x72bb77,_0x387e03));});return _0x2b7c23;}function getPDFDocDefinition(_0x1962e8){var _0x4781a6=util[_0xc3bb('0x1e')](_0xc3bb('0x1f'),NAME,EXTRACTED_REPORT[_0xc3bb('0x20')],moment(EXTRACTED_REPORT['startDate'])[_0xc3bb('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xc3bb('0x21')])[_0xc3bb('0x1e')](FORMAT));var _0x503c13=[];for(var _0x4fd3dd=0x0;_0x4fd3dd<_0x1962e8['length'];_0x4fd3dd++){var _0x1db711=[];if(_0x4fd3dd===0x0){_0x1db711['push']({'text':_0x4781a6,'style':_0xc3bb('0x22')});}var _0x593ded={'table':_0x1962e8[_0x4fd3dd]};if(_0x4fd3dd>0x0){_0x593ded[_0xc3bb('0x23')]=_0xc3bb('0x24');_0x593ded[_0xc3bb('0x25')]=[0x0,0x46,0x0,0x0];}_0x1db711[_0xc3bb('0x1b')](_0x593ded);_0x503c13[_0xc3bb('0x1b')](_0x1db711);}return{'pageSize':'A4','pageOrientation':_0xc3bb('0x26'),'content':_0x503c13,'footer':function(_0x52a384,_0xb66705){return{'text':_0x52a384[_0xc3bb('0x15')]()+_0xc3bb('0x27')+_0xb66705,'style':'footer'};},'defaultStyle':{'font':_0xc3bb('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xc3bb('0x29')},'footer':{'alignment':_0xc3bb('0x2a'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x8de75e){var _0x3826ab=0x1388;var _0x115a05;if(!_0x8de75e[0x0][_0xc3bb('0x2b')]){return analyticExtractedReport('Empty');}return db[_0xc3bb('0x2c')][_0xc3bb('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc3bb('0x2e'),_0xc3bb('0x2f')]})[_0xc3bb('0x30')](function(_0x55ba0c){if(_0x55ba0c){_0x115a05=_0x55ba0c;_0x3826ab=_0x115a05['splitSizePdf']||0x3e8;}})[_0xc3bb('0x30')](function(){var _0x5c9645=[];var _0x19fd7f=0x0;if(_0x115a05[_0xc3bb('0x2e')]){if(_0x8de75e&&_0x8de75e[_0xc3bb('0x18')]){var _0x2cc14c=_[_0xc3bb('0x31')](_0x8de75e[0x0][_0xc3bb('0x2b')]/_0x3826ab);var _0x21b97f=Number['isInteger'](_0x8de75e[0x0]['num']/_0x3826ab)?_0x8de75e[0x0]['num']%_0x3826ab:0x0;_0x2cc14c[_0xc3bb('0x32')](function(_0x49e092){if(_0x49e092>0x0){_0x19fd7f+=_0x3826ab;}_0x5c9645['push'](dbH[_0xc3bb('0x33')][_0xc3bb('0x34')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3826ab,_0x19fd7f),{'type':dbH['sequelize']['QueryTypes'][_0xc3bb('0x35')]}));});if(_0x21b97f>0x0){_0x19fd7f+=_0x3826ab;_0x5c9645['push'](dbH['sequelize'][_0xc3bb('0x34')](util[_0xc3bb('0x1e')](_0xc3bb('0x36'),QUERY,_0x21b97f,_0x19fd7f),{'type':dbH[_0xc3bb('0x33')][_0xc3bb('0x37')]['SELECT']}));}}}else{_0x5c9645['push'](dbH['sequelize'][_0xc3bb('0x34')](QUERY,{'type':dbH[_0xc3bb('0x33')]['QueryTypes'][_0xc3bb('0x35')]}));}var _0xea252e=path['dirname'](PATH);var _0x30202c=path[_0xc3bb('0x38')](PATH,_0xc3bb('0x39'));var _0x5306d7=_0x115a05[_0xc3bb('0x2e')]&&_0x5c9645[_0xc3bb('0x18')]>0x1;var _0x2a491c=[];if(!fs[_0xc3bb('0x3a')](path[_0xc3bb('0x3b')](_0xea252e,_0x30202c))&&_0x5306d7){fs['mkdirSync'](path[_0xc3bb('0x3b')](_0xea252e,_0x30202c));}return BPromise['each'](_0x5c9645,function(_0x4b578b){_0x2a491c[_0xc3bb('0x1b')](_0x4b578b);})[_0xc3bb('0x30')](function(){var _0x44ebe8=[];for(var _0x4cfe0b=0x0;_0x4cfe0b<_0x2a491c[_0xc3bb('0x18')];_0x4cfe0b+=0x1){var _0x5bbdec=_0x2a491c[_0x4cfe0b];var _0x1d57b0=createTables(_[_0xc3bb('0x3c')](_0x5bbdec));var _0x441425;var _0x39738d=getPDFDocDefinition(_0x1d57b0);var _0x40f7bf=getPDFPrinter();var _0x2a9ee4=_0x40f7bf[_0xc3bb('0x3d')](_0x39738d);if(_0x5306d7){_0x441425=path[_0xc3bb('0x3b')](_0xea252e,_0x30202c,util['format'](_0xc3bb('0x3e'),_0x30202c,_0x4cfe0b,_0xc3bb('0x3f')));}else{_0x441425=path[_0xc3bb('0x3b')](_0xea252e,util[_0xc3bb('0x1e')](_0xc3bb('0x40'),_0x30202c,_0xc3bb('0x3f')));}_0x44ebe8[_0xc3bb('0x1b')](writePDFDocument(_0x2a9ee4,_0x441425));}return Promise[_0xc3bb('0x41')](_0x44ebe8);})[_0xc3bb('0x30')](function(){if(_0x5306d7){return new Promise(function(_0x47f603){zipdir(path['join'](_0xea252e,_0x30202c),{'saveTo':path[_0xc3bb('0x3b')](_0xea252e,util['format'](_0xc3bb('0x40'),_0x30202c,_0xc3bb('0x42')))},function(){rimraf(path[_0xc3bb('0x3b')](_0xea252e,_0x30202c),function(){});_0x47f603('zip\x20finished');});});}})[_0xc3bb('0x30')](function(){if(!_0x5306d7)return;rimraf(path[_0xc3bb('0x3b')](_0xea252e,_0x30202c),function(){});})[_0xc3bb('0x30')](function(){logger[_0xc3bb('0x43')](util['format'](_0xc3bb('0x44'),EXTRACTED_REPORT_ID,_0xc3bb('0x45')));return analyticExtractedReport(_0xc3bb('0x46'),_0x5306d7?util[_0xc3bb('0x1e')]('%s.%s',_0x30202c,_0x5306d7?_0xc3bb('0x42'):_0xc3bb('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xc3bb('0x1e')](_0xc3bb('0x47'),EXTRACTED_REPORT_ID,_0xc3bb('0x45')));return db['AnalyticExtractedReport'][_0xc3bb('0x48')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x224411){EXTRACTED_REPORT=_0x224411;return dbH[_0xc3bb('0x33')]['query'](util[_0xc3bb('0x1e')](_0xc3bb('0x49'),QUERY),{'type':dbH[_0xc3bb('0x33')][_0xc3bb('0x37')][_0xc3bb('0x35')]});})['then'](extractReport)['catch'](function(_0xe13d68){logger['info'](util[_0xc3bb('0x1e')](_0xc3bb('0x4a'),EXTRACTED_REPORT_ID,'PDF'),util[_0xc3bb('0x4b')](_0xe13d68,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc3bb('0x4c'));})[_0xc3bb('0x4d')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x55a2ea=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xc3bb('0x4e'),'italics':__dirname+_0xc3bb('0x4f'),'bolditalics':__dirname+_0xc3bb('0x50')}});return _0x55a2ea;}function getPDFDocDefinitionFromHTML(_0x4f1e4a,_0x141bbc){var _0xcc9469=util[_0xc3bb('0x1e')](_0xc3bb('0x51'),_0x141bbc[_0xc3bb('0x52')],_0x141bbc[_0xc3bb('0x53')]);var _0x38680a=moment()[_0xc3bb('0x1e')](_0xc3bb('0x54'))[_0xc3bb('0x15')]();var _0x3ab564=htmlToPdfmake(_0x4f1e4a,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3ab564],'defaultStyle':{'font':_0xc3bb('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xc3bb('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xc3bb('0x55')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xc3bb('0x22')}];},'footer':function(_0x316f18,_0xef272){return[{'text':util[_0xc3bb('0x1e')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0xcc9469,_0x316f18,_0xef272,_0x38680a),'style':_0xc3bb('0x56')}];}};}function writePDFDocument(_0x150459,_0x23c5f4){return new Promise(function(_0x1ca453,_0x36ca55){var _0x129508=_0x150459[_0xc3bb('0x57')](fs[_0xc3bb('0x58')](_0x23c5f4));_0x129508['on'](_0xc3bb('0x59'),function(){_0x1ca453(_0xc3bb('0x59'));});_0x129508['on'](_0xc3bb('0x5a'),function(_0x1a39fb){_0x36ca55(_0x1a39fb);});_0x150459[_0xc3bb('0x5b')]();});}exports[_0xc3bb('0x5c')]=function(_0x2bd3f3,_0x2d06f1){var _0x22c48b=getPDFPrinter();var _0x3da80a=getPDFDocDefinitionFromHTML(_0x2bd3f3,_0x2d06f1);var _0x4ace7a=_0x22c48b['createPdfKitDocument'](_0x3da80a);return writePDFDocument(_0x4ace7a,_0x2d06f1[_0xc3bb('0x2')])[_0xc3bb('0x5d')](function(_0x70010){throw _0x70010;});}; \ No newline at end of file +var _0x4ba5=['chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','push','pageBreak','before','landscape','\x20/\x20','black','right','num','Empty','find','split','splitSizePdf','then','range','isInteger','query','sequelize','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.pdf','existsSync','mkdirSync','join','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','pdf','all','zip\x20finished','info','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','header','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','zip-dir','jsdom','JSDOM','window','bluebird','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','map','toString','value','fill','length','auto','body','concat'];(function(_0x417dd9,_0x34c874){var _0x7e7052=function(_0x31fb53){while(--_0x31fb53){_0x417dd9['push'](_0x417dd9['shift']());}};_0x7e7052(++_0x34c874);}(_0x4ba5,0x102));var _0x54ba=function(_0x404957,_0x5192a4){_0x404957=_0x404957-0x0;var _0x4e0365=_0x4ba5[_0x404957];return _0x4e0365;};'use strict';var _=require(_0x54ba('0x0'));var fs=require('fs');var util=require(_0x54ba('0x1'));var path=require(_0x54ba('0x2'));var moment=require(_0x54ba('0x3'));var htmlToPdfmake=require(_0x54ba('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x54ba('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0x54ba('0x6'))[_0x54ba('0x7')];var window=new JSDOM('')[_0x54ba('0x8')];var BPromise=require(_0x54ba('0x9'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x54ba('0xa')];var logger=require(_0x54ba('0xb'))(_0x54ba('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x54ba('0xd')][0x2]);var QUERY=process[_0x54ba('0xd')][0x3];var PATH=process[_0x54ba('0xd')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x54ba('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x773d62,_0x505ccb){var _0x53f364={'status':_0x773d62};var _0x5bbebc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x505ccb){_0x53f364[_0x54ba('0xf')]=_0x505ccb;}return db[_0x54ba('0x10')][_0x54ba('0x11')](_0x53f364,_0x5bbebc);}function getHeaders(_0x126e9d){return _['map'](_0x126e9d,function(_0x277fe2){return{'text':_0x277fe2,'style':_0x54ba('0x12')};});}function getRows(_0x1e3c1d,_0x1b7871){return _[_0x54ba('0x13')](_0x1b7871,function(_0x1a24cc){return _(_0x1a24cc)['pick'](_0x1e3c1d)[_0x54ba('0x13')](function(_0x37a555){return _0x37a555?_[_0x54ba('0x14')](_0x37a555):'';})[_0x54ba('0x15')]();});}function createTable(_0x16425e,_0x388860){var _0x38b810={'widths':_[_0x54ba('0x16')](Array(_0x16425e[_0x54ba('0x17')]),0x91),'heights':function(_0x5f593a){return _0x5f593a===0x0?_0x54ba('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4519e1=getHeaders(_0x16425e);_0x38b810[_0x54ba('0x19')]['push'](_0x4519e1);var _0x309d15=getRows(_0x16425e,_0x388860);_0x38b810[_0x54ba('0x19')]=_0x38b810[_0x54ba('0x19')][_0x54ba('0x1a')](_0x309d15);return _0x38b810;}function createTables(_0x1a61d6){var _0x1b84fe=[];var _0x539112=_[_0x54ba('0x1b')](Object[_0x54ba('0x1c')](_0x1a61d6[0x0]),0x5);_0x539112[_0x54ba('0x1d')](function(_0x57d9de){_0x1b84fe['push'](createTable(_0x57d9de,_0x1a61d6));});return _0x1b84fe;}function getPDFDocDefinition(_0x5d1740){var _0x35c40b=util[_0x54ba('0x1e')](_0x54ba('0x1f'),NAME,EXTRACTED_REPORT[_0x54ba('0x20')],moment(EXTRACTED_REPORT['startDate'])[_0x54ba('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0x54ba('0x21')])[_0x54ba('0x1e')](FORMAT));var _0x1abaca=[];for(var _0x487205=0x0;_0x487205<_0x5d1740[_0x54ba('0x17')];_0x487205++){var _0x4af202=[];if(_0x487205===0x0){_0x4af202[_0x54ba('0x22')]({'text':_0x35c40b,'style':'header'});}var _0x20a3c0={'table':_0x5d1740[_0x487205]};if(_0x487205>0x0){_0x20a3c0[_0x54ba('0x23')]=_0x54ba('0x24');_0x20a3c0['margin']=[0x0,0x46,0x0,0x0];}_0x4af202[_0x54ba('0x22')](_0x20a3c0);_0x1abaca[_0x54ba('0x22')](_0x4af202);}return{'pageSize':'A4','pageOrientation':_0x54ba('0x25'),'content':_0x1abaca,'footer':function(_0x2808a7,_0x17bc2a){return{'text':_0x2808a7['toString']()+_0x54ba('0x26')+_0x17bc2a,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x54ba('0x27')},'footer':{'alignment':_0x54ba('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x544e1f){var _0x17c72b=0x1388;var _0x30028b;if(!_0x544e1f[0x0][_0x54ba('0x29')]){return analyticExtractedReport(_0x54ba('0x2a'));}return db['Setting'][_0x54ba('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x54ba('0x2c'),_0x54ba('0x2d')]})[_0x54ba('0x2e')](function(_0xa162ad){if(_0xa162ad){_0x30028b=_0xa162ad;_0x17c72b=_0x30028b[_0x54ba('0x2d')]||0x3e8;}})[_0x54ba('0x2e')](function(){var _0x467263=[];var _0x5151ad=0x0;if(_0x30028b[_0x54ba('0x2c')]){if(_0x544e1f&&_0x544e1f['length']){var _0x2e9ee4=_[_0x54ba('0x2f')](_0x544e1f[0x0][_0x54ba('0x29')]/_0x17c72b);var _0x5d7ad5=Number[_0x54ba('0x30')](_0x544e1f[0x0]['num']/_0x17c72b)?_0x544e1f[0x0]['num']%_0x17c72b:0x0;_0x2e9ee4[_0x54ba('0x1d')](function(_0x1dc215){if(_0x1dc215>0x0){_0x5151ad+=_0x17c72b;}_0x467263[_0x54ba('0x22')](dbH['sequelize'][_0x54ba('0x31')](util[_0x54ba('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x17c72b,_0x5151ad),{'type':dbH[_0x54ba('0x32')][_0x54ba('0x33')][_0x54ba('0x34')]}));});if(_0x5d7ad5>0x0){_0x5151ad+=_0x17c72b;_0x467263[_0x54ba('0x22')](dbH[_0x54ba('0x32')][_0x54ba('0x31')](util[_0x54ba('0x1e')](_0x54ba('0x35'),QUERY,_0x5d7ad5,_0x5151ad),{'type':dbH[_0x54ba('0x32')]['QueryTypes']['SELECT']}));}}}else{_0x467263[_0x54ba('0x22')](dbH[_0x54ba('0x32')][_0x54ba('0x31')](QUERY,{'type':dbH[_0x54ba('0x32')][_0x54ba('0x33')][_0x54ba('0x34')]}));}var _0x1c37f6=path['dirname'](PATH);var _0x3657d4=path[_0x54ba('0x36')](PATH,_0x54ba('0x37'));var _0x9a2daa=_0x30028b[_0x54ba('0x2c')]&&_0x467263['length']>0x1;var _0x10d4f3=[];if(!fs[_0x54ba('0x38')](path['join'](_0x1c37f6,_0x3657d4))&&_0x9a2daa){fs[_0x54ba('0x39')](path[_0x54ba('0x3a')](_0x1c37f6,_0x3657d4));}return BPromise[_0x54ba('0x3b')](_0x467263,function(_0x4c6d25){_0x10d4f3['push'](_0x4c6d25);})[_0x54ba('0x2e')](function(){var _0x157d52=[];for(var _0x21ef42=0x0;_0x21ef42<_0x10d4f3['length'];_0x21ef42+=0x1){var _0x1bafc1=_0x10d4f3[_0x21ef42];var _0x2678d2=createTables(_[_0x54ba('0x3c')](_0x1bafc1));var _0xf1352a;var _0x4d2606=getPDFDocDefinition(_0x2678d2);var _0x492a72=getPDFPrinter();var _0x48efac=_0x492a72[_0x54ba('0x3d')](_0x4d2606);if(_0x9a2daa){_0xf1352a=path['join'](_0x1c37f6,_0x3657d4,util['format'](_0x54ba('0x3e'),_0x3657d4,_0x21ef42,'pdf'));}else{_0xf1352a=path['join'](_0x1c37f6,util['format'](_0x54ba('0x3f'),_0x3657d4,_0x54ba('0x40')));}_0x157d52[_0x54ba('0x22')](writePDFDocument(_0x48efac,_0xf1352a));}return Promise[_0x54ba('0x41')](_0x157d52);})[_0x54ba('0x2e')](function(){if(_0x9a2daa){return new Promise(function(_0x2780cd){zipdir(path['join'](_0x1c37f6,_0x3657d4),{'saveTo':path[_0x54ba('0x3a')](_0x1c37f6,util[_0x54ba('0x1e')](_0x54ba('0x3f'),_0x3657d4,'zip'))},function(){rimraf(path[_0x54ba('0x3a')](_0x1c37f6,_0x3657d4),function(){});_0x2780cd(_0x54ba('0x42'));});});}})['then'](function(){if(!_0x9a2daa)return;rimraf(path[_0x54ba('0x3a')](_0x1c37f6,_0x3657d4),function(){});})[_0x54ba('0x2e')](function(){logger[_0x54ba('0x43')](util[_0x54ba('0x1e')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x54ba('0x44')));return analyticExtractedReport('Completed',_0x9a2daa?util[_0x54ba('0x1e')](_0x54ba('0x3f'),_0x3657d4,_0x9a2daa?'zip':_0x54ba('0x40')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x54ba('0x43')](util[_0x54ba('0x1e')](_0x54ba('0x45'),EXTRACTED_REPORT_ID,_0x54ba('0x44')));return db['AnalyticExtractedReport'][_0x54ba('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x213117){EXTRACTED_REPORT=_0x213117;return dbH['sequelize'][_0x54ba('0x31')](util[_0x54ba('0x1e')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x54ba('0x32')][_0x54ba('0x33')][_0x54ba('0x34')]});})[_0x54ba('0x2e')](extractReport)[_0x54ba('0x47')](function(_0x23f3a0){logger['info'](util['format'](_0x54ba('0x48'),EXTRACTED_REPORT_ID,_0x54ba('0x44')),util[_0x54ba('0x49')](_0x23f3a0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x54ba('0x4a'));})[_0x54ba('0x4b')](function(){process[_0x54ba('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x331dd8=new PdfPrinter({'Arial':{'normal':__dirname+_0x54ba('0x4d'),'bold':__dirname+_0x54ba('0x4e'),'italics':__dirname+_0x54ba('0x4f'),'bolditalics':__dirname+_0x54ba('0x50')}});return _0x331dd8;}function getPDFDocDefinitionFromHTML(_0x18bca8,_0x906aef){var _0xf6d434=util[_0x54ba('0x1e')](_0x54ba('0x51'),_0x906aef[_0x54ba('0x52')],_0x906aef[_0x54ba('0x53')]);var _0x112dfe=moment()[_0x54ba('0x1e')](_0x54ba('0x54'))[_0x54ba('0x14')]();var _0x27c47d=htmlToPdfmake(_0x18bca8,{'window':window,'tableAutoSize':!![]});return{'content':[_0x27c47d],'defaultStyle':{'font':_0x54ba('0x55')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x54ba('0x56'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x54ba('0x56')}},'header':function(){return[{'text':_0x54ba('0x57'),'style':_0x54ba('0x58')}];},'footer':function(_0x269d21,_0x13513a){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0xf6d434,_0x269d21,_0x13513a,_0x112dfe),'style':'footer'}];}};}function writePDFDocument(_0x699f38,_0x1931f5){return new Promise(function(_0x36a589,_0x22a4e0){var _0x1786a4=_0x699f38[_0x54ba('0x59')](fs[_0x54ba('0x5a')](_0x1931f5));_0x1786a4['on'](_0x54ba('0x5b'),function(){_0x36a589('finish');});_0x1786a4['on'](_0x54ba('0x5c'),function(_0x4cb5f0){_0x22a4e0(_0x4cb5f0);});_0x699f38[_0x54ba('0x5d')]();});}exports[_0x54ba('0x5e')]=function(_0x5bb768,_0x2fca05){var _0x1d236c=getPDFPrinter();var _0x44ef3c=getPDFDocDefinitionFromHTML(_0x5bb768,_0x2fca05);var _0x1184dd=_0x1d236c[_0x54ba('0x3d')](_0x44ef3c);return writePDFDocument(_0x1184dd,_0x2fca05['path'])['catch'](function(_0x15006e){throw _0x15006e;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index e28a60f..7b44927 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 _0x1c9e=['then','splitSizeXlsx','sequelize','QueryTypes','SELECT','Empty','length','range','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','query','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','inspect','Failed','finally','exit','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split'];(function(_0x4e2fef,_0x3599c5){var _0x1f487a=function(_0x15a779){while(--_0x15a779){_0x4e2fef['push'](_0x4e2fef['shift']());}};_0x1f487a(++_0x3599c5);}(_0x1c9e,0x146));var _0xe1c9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1c9e[_0x2641f9];return _0x585741;};'use strict';var util=require('util');var path=require(_0xe1c9('0x0'));var _=require(_0xe1c9('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xe1c9('0x2'));var zipdir=require(_0xe1c9('0x3'));var rimraf=require(_0xe1c9('0x4'));var db=require(_0xe1c9('0x5'))['db'];var dbH=require(_0xe1c9('0x5'))[_0xe1c9('0x6')];var logger=require(_0xe1c9('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xe1c9('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xe1c9('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x401626,_0x16fcfe){var _0x1b8811={'status':_0x401626};var _0x5e582e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x16fcfe){_0x1b8811[_0xe1c9('0x9')]=_0x16fcfe;}return db['AnalyticExtractedReport']['update'](_0x1b8811,_0x5e582e);}function main(){var _0x547dc0=0x1388;var _0x26a87e;logger[_0xe1c9('0xa')](util[_0xe1c9('0xb')](_0xe1c9('0xc'),EXTRACTED_REPORT_ID,_0xe1c9('0xd')));return db[_0xe1c9('0xe')][_0xe1c9('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe1c9('0x10'),'splitSizeXlsx']})[_0xe1c9('0x11')](function(_0xc323c4){if(_0xc323c4){_0x26a87e=_0xc323c4;_0x547dc0=_0x26a87e[_0xe1c9('0x12')]||0x1388;}})[_0xe1c9('0x11')](function(){return dbH['sequelize']['query'](util[_0xe1c9('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xe1c9('0x13')][_0xe1c9('0x14')][_0xe1c9('0x15')]});})[_0xe1c9('0x11')](function(_0x18c79a){if(!_0x18c79a[0x0]['num']){return analyticExtractedReport(_0xe1c9('0x16'));}var _0x43207b=[];var _0x2b3ae1=0x0;if(_0x26a87e[_0xe1c9('0x10')]){if(_0x18c79a&&_0x18c79a[_0xe1c9('0x17')]){var _0x4859f7=_[_0xe1c9('0x18')](_0x18c79a[0x0][_0xe1c9('0x19')]/_0x547dc0);var _0x11e34f=Number['isInteger'](_0x18c79a[0x0]['num']/_0x547dc0)?_0x18c79a[0x0][_0xe1c9('0x19')]%_0x547dc0:0x0;_0x4859f7['forEach'](function(_0x1feea7){if(_0x1feea7>0x0){_0x2b3ae1+=_0x547dc0;}_0x43207b[_0xe1c9('0x1a')](dbH['sequelize']['query'](util[_0xe1c9('0xb')](_0xe1c9('0x1b'),QUERY,_0x547dc0,_0x2b3ae1),{'type':dbH[_0xe1c9('0x13')][_0xe1c9('0x14')][_0xe1c9('0x15')]}));});if(_0x11e34f>0x0){_0x2b3ae1+=_0x547dc0;_0x43207b[_0xe1c9('0x1a')](dbH[_0xe1c9('0x13')][_0xe1c9('0x1c')](util[_0xe1c9('0xb')](_0xe1c9('0x1b'),QUERY,_0x11e34f,_0x2b3ae1),{'type':dbH[_0xe1c9('0x13')][_0xe1c9('0x14')]['SELECT']}));}}}else{_0x43207b[_0xe1c9('0x1a')](dbH[_0xe1c9('0x13')][_0xe1c9('0x1c')](QUERY,{'type':dbH['sequelize'][_0xe1c9('0x14')][_0xe1c9('0x15')]}));}var _0x3c47bc=path[_0xe1c9('0x1d')](PATH);var _0x5ed41c=path[_0xe1c9('0x1e')](PATH,_0xe1c9('0x1f'));var _0x28fcca=_0x26a87e[_0xe1c9('0x10')]&&_0x43207b[_0xe1c9('0x17')]>0x1;var _0x6c3f4f=[];if(!fs[_0xe1c9('0x20')](path[_0xe1c9('0x21')](_0x3c47bc,_0x5ed41c))&&_0x28fcca){fs[_0xe1c9('0x22')](path[_0xe1c9('0x21')](_0x3c47bc,_0x5ed41c));}return BPromise[_0xe1c9('0x23')](_0x43207b,function(_0x4a5fa7){_0x6c3f4f['push'](_0x4a5fa7);})['then'](function(){for(var _0x125f67=0x0;_0x125f67<_0x6c3f4f[_0xe1c9('0x17')];_0x125f67+=0x1){var _0x4a4026;var _0x580b9f=_0x6c3f4f[_0x125f67];if(_0x28fcca){_0x4a4026=path[_0xe1c9('0x21')](_0x3c47bc,_0x5ed41c,util[_0xe1c9('0xb')](_0xe1c9('0x24'),_0x5ed41c,_0x125f67,_0xe1c9('0x25')));}else{_0x4a4026=path['join'](_0x3c47bc,util[_0xe1c9('0xb')](_0xe1c9('0x26'),_0x5ed41c,_0xe1c9('0x25')));}fs[_0xe1c9('0x27')](_0x4a4026,json2xls(_0x580b9f),_0xe1c9('0x28'));}})[_0xe1c9('0x11')](function(){if(_0x28fcca){return new Promise(function(_0x3cf858){zipdir(path['join'](_0x3c47bc,_0x5ed41c),{'saveTo':path[_0xe1c9('0x21')](_0x3c47bc,util[_0xe1c9('0xb')](_0xe1c9('0x26'),_0x5ed41c,_0xe1c9('0x29')))},function(_0x51676b,_0x473869){rimraf(path[_0xe1c9('0x21')](_0x3c47bc,_0x5ed41c),function(){});_0x3cf858(_0xe1c9('0x2a'));});});}})[_0xe1c9('0x11')](function(){logger[_0xe1c9('0xa')](util[_0xe1c9('0xb')](_0xe1c9('0x2b'),EXTRACTED_REPORT_ID,_0xe1c9('0xd')));return analyticExtractedReport(_0xe1c9('0x2c'),_0x28fcca?util[_0xe1c9('0xb')]('%s.%s',_0x5ed41c,_0x28fcca?_0xe1c9('0x29'):_0xe1c9('0x25')):null);});})['catch'](function(_0x3838e8){logger[_0xe1c9('0xa')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe1c9('0xd')),util[_0xe1c9('0x2d')](_0x3838e8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe1c9('0x2e'));})[_0xe1c9('0x2f')](function(){process[_0xe1c9('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x5686=['update','info','format','XLSX','Setting','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x5686,0x1be));var _0x6568=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x5686[_0x576170];return _0x397c70;};'use strict';var util=require(_0x6568('0x0'));var path=require(_0x6568('0x1'));var _=require(_0x6568('0x2'));var fs=require('fs');var json2xls=require(_0x6568('0x3'));var BPromise=require(_0x6568('0x4'));var zipdir=require(_0x6568('0x5'));var rimraf=require(_0x6568('0x6'));var db=require(_0x6568('0x7'))['db'];var dbH=require(_0x6568('0x7'))[_0x6568('0x8')];var logger=require(_0x6568('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6568('0xa')][0x2]);var QUERY=process[_0x6568('0xa')][0x3];var PATH=process[_0x6568('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3c06a7,_0x15c54b){var _0x120e9c={'status':_0x3c06a7};var _0x31b658={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x15c54b){_0x120e9c[_0x6568('0xb')]=_0x15c54b;}return db[_0x6568('0xc')][_0x6568('0xd')](_0x120e9c,_0x31b658);}function main(){var _0x29cfeb=0x1388;var _0x52a458;logger[_0x6568('0xe')](util[_0x6568('0xf')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6568('0x10')));return db[_0x6568('0x11')][_0x6568('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6568('0x13'),_0x6568('0x14')]})[_0x6568('0x15')](function(_0x113f92){if(_0x113f92){_0x52a458=_0x113f92;_0x29cfeb=_0x52a458[_0x6568('0x14')]||0x1388;}})[_0x6568('0x15')](function(){return dbH['sequelize'][_0x6568('0x16')](util['format'](_0x6568('0x17'),QUERY),{'type':dbH[_0x6568('0x18')][_0x6568('0x19')][_0x6568('0x1a')]});})['then'](function(_0x4d986a){if(!_0x4d986a[0x0][_0x6568('0x1b')]){return analyticExtractedReport(_0x6568('0x1c'));}var _0x4e1cbb=[];var _0x314bb0=0x0;if(_0x52a458[_0x6568('0x13')]){if(_0x4d986a&&_0x4d986a[_0x6568('0x1d')]){var _0x524a85=_[_0x6568('0x1e')](_0x4d986a[0x0][_0x6568('0x1b')]/_0x29cfeb);var _0x8a426f=Number['isInteger'](_0x4d986a[0x0][_0x6568('0x1b')]/_0x29cfeb)?_0x4d986a[0x0][_0x6568('0x1b')]%_0x29cfeb:0x0;_0x524a85[_0x6568('0x1f')](function(_0x37073f){if(_0x37073f>0x0){_0x314bb0+=_0x29cfeb;}_0x4e1cbb[_0x6568('0x20')](dbH[_0x6568('0x18')][_0x6568('0x16')](util[_0x6568('0xf')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x29cfeb,_0x314bb0),{'type':dbH[_0x6568('0x18')][_0x6568('0x19')][_0x6568('0x1a')]}));});if(_0x8a426f>0x0){_0x314bb0+=_0x29cfeb;_0x4e1cbb[_0x6568('0x20')](dbH[_0x6568('0x18')][_0x6568('0x16')](util[_0x6568('0xf')](_0x6568('0x21'),QUERY,_0x8a426f,_0x314bb0),{'type':dbH[_0x6568('0x18')]['QueryTypes']['SELECT']}));}}}else{_0x4e1cbb[_0x6568('0x20')](dbH[_0x6568('0x18')][_0x6568('0x16')](QUERY,{'type':dbH[_0x6568('0x18')]['QueryTypes'][_0x6568('0x1a')]}));}var _0x102a0b=path[_0x6568('0x22')](PATH);var _0x287656=path[_0x6568('0x23')](PATH,_0x6568('0x24'));var _0x2c445a=_0x52a458[_0x6568('0x13')]&&_0x4e1cbb[_0x6568('0x1d')]>0x1;var _0x6e2eb5=[];if(!fs['existsSync'](path[_0x6568('0x25')](_0x102a0b,_0x287656))&&_0x2c445a){fs['mkdirSync'](path[_0x6568('0x25')](_0x102a0b,_0x287656));}return BPromise[_0x6568('0x26')](_0x4e1cbb,function(_0x12991f){_0x6e2eb5[_0x6568('0x20')](_0x12991f);})[_0x6568('0x15')](function(){for(var _0x14b5dd=0x0;_0x14b5dd<_0x6e2eb5[_0x6568('0x1d')];_0x14b5dd+=0x1){var _0xcf960e;var _0x338ba1=_0x6e2eb5[_0x14b5dd];if(_0x2c445a){_0xcf960e=path[_0x6568('0x25')](_0x102a0b,_0x287656,util[_0x6568('0xf')](_0x6568('0x27'),_0x287656,_0x14b5dd,_0x6568('0x28')));}else{_0xcf960e=path[_0x6568('0x25')](_0x102a0b,util[_0x6568('0xf')](_0x6568('0x29'),_0x287656,_0x6568('0x28')));}fs[_0x6568('0x2a')](_0xcf960e,json2xls(_0x338ba1),_0x6568('0x2b'));}})[_0x6568('0x15')](function(){if(_0x2c445a){return new Promise(function(_0x55e303){zipdir(path['join'](_0x102a0b,_0x287656),{'saveTo':path[_0x6568('0x25')](_0x102a0b,util[_0x6568('0xf')]('%s.%s',_0x287656,_0x6568('0x2c')))},function(_0x179518,_0x453e12){rimraf(path['join'](_0x102a0b,_0x287656),function(){});_0x55e303(_0x6568('0x2d'));});});}})[_0x6568('0x15')](function(){logger[_0x6568('0xe')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x6568('0x10')));return analyticExtractedReport(_0x6568('0x2e'),_0x2c445a?util[_0x6568('0xf')](_0x6568('0x29'),_0x287656,_0x2c445a?'zip':_0x6568('0x28')):null);});})[_0x6568('0x2f')](function(_0x1bc9e6){logger[_0x6568('0xe')](util[_0x6568('0xf')](_0x6568('0x30'),EXTRACTED_REPORT_ID,_0x6568('0x10')),util['inspect'](_0x1bc9e6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6568('0x31'));})[_0x6568('0x32')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index efb57bb..b661a25 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 _0xb7e1=['*,*,*,*','tag','CDR(tag)=','length','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','toLowerCase','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','transaction','catch','error','rewrite','util','Interval','findAll','intervals','models','VoiceExtension','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','hasOwnProperty','priority','extensions','extension','find','type','CDR(type)=%s','VoiceExtensionId','inbound','push','Set','CDR(routeid)=','outbound','${EXTEN:','${EXTEN}','context','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','updatedAt','interval'];(function(_0x3a0538,_0x3f7e29){var _0x49e6ef=function(_0x7fa737){while(--_0x7fa737){_0x3a0538['push'](_0x3a0538['shift']());}};_0x49e6ef(++_0x3f7e29);}(_0xb7e1,0x11a));var _0x1b7e=function(_0x28baab,_0x34af5f){_0x28baab=_0x28baab-0x0;var _0x35a3a5=_0xb7e1[_0x28baab];return _0x35a3a5;};'use strict';var _=require('lodash');var util=require(_0x1b7e('0x0'));function rewrite(_0x52a1eb,_0x404dbb){var _0x312694=this;return _0x52a1eb['models'][_0x1b7e('0x1')][_0x1b7e('0x2')]({'raw':!![]})['then'](function(_0x2e969f){_0x312694[_0x1b7e('0x3')]=_0x2e969f;return _0x52a1eb[_0x1b7e('0x4')][_0x1b7e('0x5')][_0x1b7e('0x2')]({'where':{'IntervalId':_0x404dbb[_0x1b7e('0x6')]},'raw':!![]});})['then'](function(_0x318a66){return _0x52a1eb['models'][_0x1b7e('0x5')][_0x1b7e('0x2')]({'where':{'exten':{'$in':_['uniq'](_[_0x1b7e('0x7')](_0x318a66,_0x1b7e('0x8')))}},'order':[{'raw':_0x1b7e('0x9')}],'raw':!![]});})[_0x1b7e('0xa')](function(_0x4bf42d){var _0x520dff=_[_0x1b7e('0xb')](_0x4bf42d,{'priority':'1'});var _0x4724b4=_[_0x1b7e('0xb')](_0x4bf42d,{'isApp':0x1});var _0x48591a=_[_0x1b7e('0xc')](_0x4724b4,_0x1b7e('0x8'));var _0x49b386=['queue','playback'];var _0x28ff6b=[];var _0x314d6c=[];for(var _0x121142 in _0x48591a){if(_0x48591a[_0x1b7e('0xd')](_0x121142)){_0x312694[_0x1b7e('0xe')]=0x2;_0x312694[_0x1b7e('0xf')]=[];_0x312694[_0x1b7e('0x10')]=_[_0x1b7e('0x11')](_0x520dff,{'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')]});_0x312694['extensions']['push']({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':'Set','appdata':util['format'](_0x1b7e('0x13'),_0x48591a[_0x121142][0x0][_0x1b7e('0x12')]),'context':_0x48591a[_0x121142][0x0]['context'],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694['priority']++,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});if(_0x48591a[_0x121142][0x0][_0x1b7e('0x12')]===_0x1b7e('0x15')){_0x312694['extensions'][_0x1b7e('0x16')]({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':_0x1b7e('0x17'),'appdata':_0x1b7e('0x18')+_0x48591a[_0x121142][0x0][_0x1b7e('0x14')],'context':_0x48591a[_0x121142][0x0]['context'],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694['priority']++,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});}else if(_0x48591a[_0x121142][0x0][_0x1b7e('0x12')]===_0x1b7e('0x19')){if(_0x312694[_0x1b7e('0x10')]){_0x312694[_0x1b7e('0xf')][_0x1b7e('0x16')]({'type':_0x48591a[_0x121142][0x0]['type'],'app':_0x1b7e('0x17'),'appdata':'CDR(destination)='+(_0x312694[_0x1b7e('0x10')]['cutdigits']?_0x1b7e('0x1a')+_0x312694[_0x1b7e('0x10')]['cutdigits']+'}':_0x1b7e('0x1b')),'context':_0x48591a[_0x121142][0x0][_0x1b7e('0x1c')],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694[_0x1b7e('0xe')]++,'VoiceExtensionId':_0x48591a[_0x121142][0x0]['VoiceExtensionId']});}_0x312694[_0x1b7e('0xf')][_0x1b7e('0x16')]({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':_0x1b7e('0x17'),'appdata':'CDR(routeid)='+_0x48591a[_0x121142][0x0][_0x1b7e('0x14')],'context':_0x48591a[_0x121142][0x0][_0x1b7e('0x1c')],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694[_0x1b7e('0xe')]++,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});var _0xf0066c=_0x312694['priority']++;_0x312694[_0x1b7e('0xf')][_0x1b7e('0x16')]({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':'ExecIf','appdata':_0x1b7e('0x1d')+(_0xf0066c+0x2)+_0x1b7e('0x1e')+(_0xf0066c+0x1)+')','context':_0x48591a[_0x121142][0x0][_0x1b7e('0x1c')],'exten':_0x48591a[_0x121142][0x0]['exten'],'priority':_0xf0066c,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});if(_0x312694['extension']){_0x312694[_0x1b7e('0xf')][_0x1b7e('0x16')]({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':_0x1b7e('0x17'),'appdata':_0x312694[_0x1b7e('0x10')][_0x1b7e('0x1f')]?_0x1b7e('0x20')+_0x312694[_0x1b7e('0x10')][_0x1b7e('0x1f')]+'}':'CDR(prefix)=noprefix','context':_0x48591a[_0x121142][0x0][_0x1b7e('0x1c')],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694[_0x1b7e('0xe')]++,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});}_0x312694[_0x1b7e('0xf')][_0x1b7e('0x16')]({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':_0x1b7e('0x17'),'appdata':_0x1b7e('0x21')+_0x48591a[_0x121142][0x0][_0x1b7e('0x14')],'context':_0x48591a[_0x121142][0x0][_0x1b7e('0x1c')],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694[_0x1b7e('0xe')]++,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});if(_0x312694['extension']&&_0x312694['extension'][_0x1b7e('0xd')](_0x1b7e('0x22'))&&_0x312694[_0x1b7e('0x10')][_0x1b7e('0x22')]!==_0x1b7e('0x23')){_0x312694[_0x1b7e('0xf')][_0x1b7e('0x16')]({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x48591a[_0x121142][0x0]['context'],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694['priority']++,'VoiceExtensionId':_0x48591a[_0x121142][0x0]['VoiceExtensionId']});_0x312694[_0x1b7e('0xf')]['push']({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':_0x1b7e('0x17'),'appdata':_0x1b7e('0x24')+_0x312694[_0x1b7e('0x10')][_0x1b7e('0x22')]||_0x1b7e('0x25'),'context':_0x48591a[_0x121142][0x0][_0x1b7e('0x1c')],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694['priority']++,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});}}_0x312694[_0x1b7e('0xf')]['push']({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':_0x1b7e('0x17'),'appdata':_0x1b7e('0x26'),'context':_0x48591a[_0x121142][0x0]['context'],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694[_0x1b7e('0xe')]++,'VoiceExtensionId':_0x48591a[_0x121142][0x0]['VoiceExtensionId']});_0x312694[_0x1b7e('0xf')]['push']({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':'Set','appdata':_0x1b7e('0x27'),'context':_0x48591a[_0x121142][0x0][_0x1b7e('0x1c')],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694[_0x1b7e('0xe')]++,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});_0x312694[_0x1b7e('0xf')][_0x1b7e('0x16')]({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':_0x1b7e('0x17'),'appdata':_0x1b7e('0x28'),'context':_0x48591a[_0x121142][0x0][_0x1b7e('0x1c')],'exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'priority':_0x312694[_0x1b7e('0xe')]++,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});for(var _0x5a0ae6=0x0,_0x4bf6d5=0x0;_0x5a0ae6<_0x48591a[_0x121142]['length'];_0x5a0ae6+=0x1,_0x4bf6d5=0x0){var _0x2ad79b=_0x48591a[_0x121142][_0x5a0ae6];if(_0x2ad79b[_0x1b7e('0x12')]){_0x2ad79b[_0x1b7e('0x12')]=_0x2ad79b['type']['toLowerCase']();}var _0x1d716d=[];var _0x5ecafa=[];delete _0x2ad79b['id'];delete _0x2ad79b['createdAt'];delete _0x2ad79b[_0x1b7e('0x29')];var _0x269fdc=_0x2ad79b[_0x1b7e('0x2a')]!==_0x1b7e('0x2b')?[_0x2ad79b[_0x1b7e('0x2a')]]:_0x2ad79b[_0x1b7e('0x6')]?_['map'](_[_0x1b7e('0xb')](_0x312694[_0x1b7e('0x3')],{'IntervalId':_0x2ad79b[_0x1b7e('0x6')]}),_0x1b7e('0x2a')):[];if(_0x2ad79b[_0x1b7e('0xd')](_0x1b7e('0x2c'))){if(_0x2ad79b[_0x1b7e('0x2c')]&&_0x2ad79b[_0x1b7e('0x2c')]!=='--'){_0x1d716d[_0x1b7e('0x16')]({'type':_0x2ad79b[_0x1b7e('0x12')],'app':_0x1b7e('0x17'),'appdata':_0x1b7e('0x2d')+_0x2ad79b[_0x1b7e('0x2c')],'context':_0x2ad79b['context'],'exten':_0x2ad79b[_0x1b7e('0x8')],'priority':_0x269fdc[_0x1b7e('0x2e')]+_0x312694[_0x1b7e('0xe')]+_0x4bf6d5++,'VoiceExtensionId':_0x2ad79b['VoiceExtensionId']});}}if(_0x2ad79b['type']===_0x1b7e('0x19')&&_0x2ad79b[_0x1b7e('0xd')](_0x1b7e('0x2f'))){if(_0x2ad79b[_0x1b7e('0x2f')]){_0x1d716d[_0x1b7e('0x16')]({'type':_0x2ad79b[_0x1b7e('0x12')],'app':_0x1b7e('0x30'),'appdata':_0x1b7e('0x31')+_0x2ad79b[_0x1b7e('0x2f')]+')','context':_0x2ad79b['context'],'exten':_0x2ad79b['exten'],'priority':_0x269fdc['length']+_0x312694['priority']+_0x4bf6d5++,'VoiceExtensionId':_0x2ad79b['VoiceExtensionId']});}else{_0x1d716d[_0x1b7e('0x16')]({'type':_0x2ad79b[_0x1b7e('0x12')],'app':_0x1b7e('0x30'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x2ad79b[_0x1b7e('0x1c')],'exten':_0x2ad79b[_0x1b7e('0x8')],'priority':_0x269fdc[_0x1b7e('0x2e')]+_0x312694[_0x1b7e('0xe')]+_0x4bf6d5++,'VoiceExtensionId':_0x2ad79b[_0x1b7e('0x14')]});}}if(_0x2ad79b[_0x1b7e('0xd')](_0x1b7e('0x32'))){if(_0x49b386['indexOf'](_0x2ad79b['app'][_0x1b7e('0x33')]())>=0x0&&_0x2ad79b[_0x1b7e('0x34')]!=='custom'){if(_0x2ad79b[_0x1b7e('0x32')]){_0x1d716d[_0x1b7e('0x16')]({'type':_0x2ad79b[_0x1b7e('0x12')],'app':_0x1b7e('0x30'),'appdata':_0x1b7e('0x35'),'context':_0x2ad79b[_0x1b7e('0x1c')],'exten':_0x2ad79b[_0x1b7e('0x8')],'priority':_0x269fdc[_0x1b7e('0x2e')]+_0x312694[_0x1b7e('0xe')]+_0x4bf6d5++,'VoiceExtensionId':_0x2ad79b[_0x1b7e('0x14')]});_0x1d716d[_0x1b7e('0x16')]({'type':_0x2ad79b[_0x1b7e('0x12')],'app':_0x1b7e('0x17'),'appdata':_0x1b7e('0x36'),'context':_0x2ad79b[_0x1b7e('0x1c')],'exten':_0x2ad79b[_0x1b7e('0x8')],'priority':_0x269fdc[_0x1b7e('0x2e')]+_0x312694[_0x1b7e('0xe')]+_0x4bf6d5++,'VoiceExtensionId':_0x2ad79b[_0x1b7e('0x14')]});}else{_0x1d716d['push']({'type':_0x2ad79b[_0x1b7e('0x12')],'app':_0x1b7e('0x30'),'appdata':_0x1b7e('0x37'),'context':_0x2ad79b[_0x1b7e('0x1c')],'exten':_0x2ad79b['exten'],'priority':_0x269fdc[_0x1b7e('0x2e')]+_0x312694[_0x1b7e('0xe')]+_0x4bf6d5++,'VoiceExtensionId':_0x2ad79b[_0x1b7e('0x14')]});_0x1d716d['push']({'type':_0x2ad79b[_0x1b7e('0x12')],'app':'Set','appdata':_0x1b7e('0x38'),'context':_0x2ad79b[_0x1b7e('0x1c')],'exten':_0x2ad79b['exten'],'priority':_0x269fdc['length']+_0x312694['priority']+_0x4bf6d5++,'VoiceExtensionId':_0x2ad79b[_0x1b7e('0x14')]});}}}for(var _0x5e6a47=0x0;_0x5e6a47<_0x269fdc['length'];_0x5e6a47+=0x1){var _0x4619dd=_0x312694[_0x1b7e('0xe')]+_0x269fdc[_0x1b7e('0x2e')];var _0x56ce70=_0x5e6a47===_0x269fdc[_0x1b7e('0x2e')]-0x1?_0x312694[_0x1b7e('0xe')]+_0x1d716d[_0x1b7e('0x2e')]+_0x5ecafa[_0x1b7e('0x2e')]+0x2:_0x312694['priority']+_0x5e6a47+0x1;_0x1d716d['splice'](_0x5e6a47,0x0,{'type':_0x2ad79b[_0x1b7e('0x12')],'app':_0x1b7e('0x39'),'appdata':_0x269fdc[_0x5e6a47]+'?'+_0x2ad79b[_0x1b7e('0x1c')]+_0x1b7e('0x3a')+_0x4619dd+':'+_0x2ad79b['context']+_0x1b7e('0x3a')+_0x56ce70,'exten':_0x2ad79b[_0x1b7e('0x8')],'context':_0x2ad79b[_0x1b7e('0x1c')],'priority':_0x312694[_0x1b7e('0xe')]+_0x5e6a47,'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});}_0x2ad79b[_0x1b7e('0xe')]=_0x1d716d[_0x1b7e('0x2e')]?_[_0x1b7e('0x3b')](_0x1d716d)[_0x1b7e('0xe')]+0x1:_0x312694[_0x1b7e('0xe')];_0x312694[_0x1b7e('0xe')]=(_0x5ecafa[_0x1b7e('0x2e')]?_['last'](_0x5ecafa)[_0x1b7e('0xe')]:_0x2ad79b[_0x1b7e('0xe')])+0x1;_0x312694['extensions']=_[_0x1b7e('0x3c')](_0x312694[_0x1b7e('0xf')],_0x1d716d,[_0x2ad79b],_0x5ecafa);}_0x312694[_0x1b7e('0xf')][_0x1b7e('0x16')]({'type':_0x48591a[_0x121142][0x0][_0x1b7e('0x12')],'app':'Hangup','exten':_0x48591a[_0x121142][0x0][_0x1b7e('0x8')],'context':_0x48591a[_0x121142][0x0]['context'],'priority':_0x312694[_0x1b7e('0xe')],'VoiceExtensionId':_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]});_0x28ff6b['push'](_0x48591a[_0x121142][0x0][_0x1b7e('0x14')]);_0x314d6c=_[_0x1b7e('0x3c')](_0x314d6c,_0x312694['extensions']);}}return _0x52a1eb[_0x1b7e('0x3d')](function(_0x2d9f3c){return _0x52a1eb[_0x1b7e('0x4')][_0x1b7e('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x28ff6b}},'transaction':_0x2d9f3c})['then'](function(_0x4f344b){return _0x52a1eb[_0x1b7e('0x4')][_0x1b7e('0x5')]['bulkCreate'](_['sortBy'](_0x314d6c,'priority'),{'transaction':_0x2d9f3c});});});})[_0x1b7e('0x3e')](function(_0x3b557d){console[_0x1b7e('0x3f')](_0x3b557d);});}exports[_0x1b7e('0x40')]=rewrite; \ No newline at end of file +var _0x0cf5=['$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','lodash','util','models','Interval','findAll','intervals','VoiceExtension','IntervalId','uniq','map','then','filter','groupBy','exten','playback','hasOwnProperty','priority','extensions','find','push','format','type','context','VoiceExtensionId','Set','outbound','CDR(destination)=','extension','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='];(function(_0x3a2038,_0x31bb2b){var _0x16adf8=function(_0x23a50c){while(--_0x23a50c){_0x3a2038['push'](_0x3a2038['shift']());}};_0x16adf8(++_0x31bb2b);}(_0x0cf5,0xa8));var _0x50cf=function(_0x44453f,_0x443e4f){_0x44453f=_0x44453f-0x0;var _0x7962e7=_0x0cf5[_0x44453f];return _0x7962e7;};'use strict';var _=require(_0x50cf('0x0'));var util=require(_0x50cf('0x1'));function rewrite(_0x2f4750,_0x46d71e){var _0x2bad26=this;return _0x2f4750[_0x50cf('0x2')][_0x50cf('0x3')][_0x50cf('0x4')]({'raw':!![]})['then'](function(_0x132624){_0x2bad26[_0x50cf('0x5')]=_0x132624;return _0x2f4750[_0x50cf('0x2')][_0x50cf('0x6')]['findAll']({'where':{'IntervalId':_0x46d71e[_0x50cf('0x7')]},'raw':!![]});})['then'](function(_0x21b6e5){return _0x2f4750['models'][_0x50cf('0x6')][_0x50cf('0x4')]({'where':{'exten':{'$in':_[_0x50cf('0x8')](_[_0x50cf('0x9')](_0x21b6e5,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x50cf('0xa')](function(_0x3bdb9d){var _0x102ce3=_[_0x50cf('0xb')](_0x3bdb9d,{'priority':'1'});var _0x3a21c5=_[_0x50cf('0xb')](_0x3bdb9d,{'isApp':0x1});var _0xc79c4d=_[_0x50cf('0xc')](_0x3a21c5,_0x50cf('0xd'));var _0x468ab2=['queue',_0x50cf('0xe')];var _0x353824=[];var _0x3e4ea4=[];for(var _0x33cf47 in _0xc79c4d){if(_0xc79c4d[_0x50cf('0xf')](_0x33cf47)){_0x2bad26[_0x50cf('0x10')]=0x2;_0x2bad26[_0x50cf('0x11')]=[];_0x2bad26['extension']=_[_0x50cf('0x12')](_0x102ce3,{'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')]});_0x2bad26['extensions'][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0]['type'],'app':'Set','appdata':util[_0x50cf('0x14')]('CDR(type)=%s',_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')]),'context':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x16')],'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')],'priority':_0x2bad26['priority']++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});if(_0xc79c4d[_0x33cf47][0x0]['type']==='inbound'){_0x2bad26[_0x50cf('0x11')]['push']({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':'CDR(routeid)='+_0xc79c4d[_0x33cf47][0x0]['VoiceExtensionId'],'context':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x16')],'exten':_0xc79c4d[_0x33cf47][0x0]['exten'],'priority':_0x2bad26[_0x50cf('0x10')]++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});}else if(_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')]===_0x50cf('0x19')){if(_0x2bad26['extension']){_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':_0x50cf('0x1a')+(_0x2bad26[_0x50cf('0x1b')][_0x50cf('0x1c')]?_0x50cf('0x1d')+_0x2bad26[_0x50cf('0x1b')][_0x50cf('0x1c')]+'}':'${EXTEN}'),'context':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x16')],'exten':_0xc79c4d[_0x33cf47][0x0]['exten'],'priority':_0x2bad26[_0x50cf('0x10')]++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});}_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':_0x50cf('0x1e')+_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')],'context':_0xc79c4d[_0x33cf47][0x0]['context'],'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')],'priority':_0x2bad26[_0x50cf('0x10')]++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});var _0x3a7b1b=_0x2bad26[_0x50cf('0x10')]++;_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x1f'),'appdata':_0x50cf('0x20')+(_0x3a7b1b+0x2)+_0x50cf('0x21')+(_0x3a7b1b+0x1)+')','context':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x16')],'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')],'priority':_0x3a7b1b,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});if(_0x2bad26['extension']){_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':_0x2bad26[_0x50cf('0x1b')]['cutdigits']?_0x50cf('0x22')+_0x2bad26[_0x50cf('0x1b')][_0x50cf('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x16')],'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')],'priority':_0x2bad26[_0x50cf('0x10')]++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});}_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':_0x50cf('0x23')+_0xc79c4d[_0x33cf47][0x0]['VoiceExtensionId'],'context':_0xc79c4d[_0x33cf47][0x0]['context'],'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')],'priority':_0x2bad26[_0x50cf('0x10')]++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});if(_0x2bad26[_0x50cf('0x1b')]&&_0x2bad26[_0x50cf('0x1b')][_0x50cf('0xf')](_0x50cf('0x24'))&&_0x2bad26[_0x50cf('0x1b')]['recordingFormat']!==_0x50cf('0x25')){_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':_0x50cf('0x26'),'context':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x16')],'exten':_0xc79c4d[_0x33cf47][0x0]['exten'],'priority':_0x2bad26[_0x50cf('0x10')]++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':_0x50cf('0x27')+_0x2bad26[_0x50cf('0x1b')]['recordingFormat']||_0x50cf('0x28'),'context':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x16')],'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')],'priority':_0x2bad26[_0x50cf('0x10')]++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});}}_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':'Set','appdata':_0x50cf('0x29'),'context':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x16')],'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')],'priority':_0x2bad26[_0x50cf('0x10')]++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':'Set','appdata':_0x50cf('0x2a'),'context':_0xc79c4d[_0x33cf47][0x0]['context'],'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')],'priority':_0x2bad26['priority']++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0]['VoiceExtensionId']});_0x2bad26[_0x50cf('0x11')]['push']({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':_0x50cf('0x2b'),'context':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x16')],'exten':_0xc79c4d[_0x33cf47][0x0]['exten'],'priority':_0x2bad26[_0x50cf('0x10')]++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});for(var _0x2ff69f=0x0,_0x3d6792=0x0;_0x2ff69f<_0xc79c4d[_0x33cf47][_0x50cf('0x2c')];_0x2ff69f+=0x1,_0x3d6792=0x0){var _0x343e9a=_0xc79c4d[_0x33cf47][_0x2ff69f];if(_0x343e9a[_0x50cf('0x15')]){_0x343e9a[_0x50cf('0x15')]=_0x343e9a['type'][_0x50cf('0x2d')]();}var _0x33e8fd=[];var _0x367bc6=[];delete _0x343e9a['id'];delete _0x343e9a[_0x50cf('0x2e')];delete _0x343e9a[_0x50cf('0x2f')];var _0x37e402=_0x343e9a[_0x50cf('0x30')]!==_0x50cf('0x31')?[_0x343e9a['interval']]:_0x343e9a['IntervalId']?_[_0x50cf('0x9')](_[_0x50cf('0xb')](_0x2bad26[_0x50cf('0x5')],{'IntervalId':_0x343e9a[_0x50cf('0x7')]}),_0x50cf('0x30')):[];if(_0x343e9a[_0x50cf('0xf')](_0x50cf('0x32'))){if(_0x343e9a[_0x50cf('0x32')]&&_0x343e9a[_0x50cf('0x32')]!=='--'){_0x33e8fd[_0x50cf('0x13')]({'type':_0x343e9a[_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':_0x50cf('0x33')+_0x343e9a[_0x50cf('0x32')],'context':_0x343e9a[_0x50cf('0x16')],'exten':_0x343e9a[_0x50cf('0xd')],'priority':_0x37e402[_0x50cf('0x2c')]+_0x2bad26[_0x50cf('0x10')]+_0x3d6792++,'VoiceExtensionId':_0x343e9a[_0x50cf('0x17')]});}}if(_0x343e9a[_0x50cf('0x15')]==='outbound'&&_0x343e9a['hasOwnProperty'](_0x50cf('0x34'))){if(_0x343e9a['callerID']){_0x33e8fd[_0x50cf('0x13')]({'type':_0x343e9a[_0x50cf('0x15')],'app':_0x50cf('0x1f'),'appdata':_0x50cf('0x35')+_0x343e9a[_0x50cf('0x34')]+')','context':_0x343e9a[_0x50cf('0x16')],'exten':_0x343e9a[_0x50cf('0xd')],'priority':_0x37e402[_0x50cf('0x2c')]+_0x2bad26[_0x50cf('0x10')]+_0x3d6792++,'VoiceExtensionId':_0x343e9a[_0x50cf('0x17')]});}else{_0x33e8fd[_0x50cf('0x13')]({'type':_0x343e9a[_0x50cf('0x15')],'app':'ExecIf','appdata':_0x50cf('0x36'),'context':_0x343e9a['context'],'exten':_0x343e9a[_0x50cf('0xd')],'priority':_0x37e402[_0x50cf('0x2c')]+_0x2bad26[_0x50cf('0x10')]+_0x3d6792++,'VoiceExtensionId':_0x343e9a[_0x50cf('0x17')]});}}if(_0x343e9a[_0x50cf('0xf')](_0x50cf('0x37'))){if(_0x468ab2[_0x50cf('0x38')](_0x343e9a[_0x50cf('0x39')]['toLowerCase']())>=0x0&&_0x343e9a[_0x50cf('0x3a')]!==_0x50cf('0x3b')){if(_0x343e9a['answer']){_0x33e8fd['push']({'type':_0x343e9a[_0x50cf('0x15')],'app':'ExecIf','appdata':_0x50cf('0x3c'),'context':_0x343e9a[_0x50cf('0x16')],'exten':_0x343e9a[_0x50cf('0xd')],'priority':_0x37e402[_0x50cf('0x2c')]+_0x2bad26[_0x50cf('0x10')]+_0x3d6792++,'VoiceExtensionId':_0x343e9a['VoiceExtensionId']});_0x33e8fd['push']({'type':_0x343e9a[_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x343e9a[_0x50cf('0x16')],'exten':_0x343e9a['exten'],'priority':_0x37e402[_0x50cf('0x2c')]+_0x2bad26[_0x50cf('0x10')]+_0x3d6792++,'VoiceExtensionId':_0x343e9a[_0x50cf('0x17')]});}else{_0x33e8fd[_0x50cf('0x13')]({'type':_0x343e9a[_0x50cf('0x15')],'app':_0x50cf('0x1f'),'appdata':_0x50cf('0x3d'),'context':_0x343e9a[_0x50cf('0x16')],'exten':_0x343e9a[_0x50cf('0xd')],'priority':_0x37e402['length']+_0x2bad26[_0x50cf('0x10')]+_0x3d6792++,'VoiceExtensionId':_0x343e9a[_0x50cf('0x17')]});_0x33e8fd[_0x50cf('0x13')]({'type':_0x343e9a['type'],'app':_0x50cf('0x18'),'appdata':_0x50cf('0x3e'),'context':_0x343e9a[_0x50cf('0x16')],'exten':_0x343e9a[_0x50cf('0xd')],'priority':_0x37e402['length']+_0x2bad26['priority']+_0x3d6792++,'VoiceExtensionId':_0x343e9a[_0x50cf('0x17')]});}}}for(var _0x4d39aa=0x0;_0x4d39aa<_0x37e402['length'];_0x4d39aa+=0x1){var _0x54300e=_0x2bad26[_0x50cf('0x10')]+_0x37e402[_0x50cf('0x2c')];var _0x180317=_0x4d39aa===_0x37e402['length']-0x1?_0x2bad26[_0x50cf('0x10')]+_0x33e8fd[_0x50cf('0x2c')]+_0x367bc6[_0x50cf('0x2c')]+0x2:_0x2bad26[_0x50cf('0x10')]+_0x4d39aa+0x1;_0x33e8fd[_0x50cf('0x3f')](_0x4d39aa,0x0,{'type':_0x343e9a[_0x50cf('0x15')],'app':_0x50cf('0x40'),'appdata':_0x37e402[_0x4d39aa]+'?'+_0x343e9a[_0x50cf('0x16')]+_0x50cf('0x41')+_0x54300e+':'+_0x343e9a[_0x50cf('0x16')]+_0x50cf('0x41')+_0x180317,'exten':_0x343e9a['exten'],'context':_0x343e9a[_0x50cf('0x16')],'priority':_0x2bad26[_0x50cf('0x10')]+_0x4d39aa,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});}_0x343e9a[_0x50cf('0x10')]=_0x33e8fd[_0x50cf('0x2c')]?_['last'](_0x33e8fd)[_0x50cf('0x10')]+0x1:_0x2bad26['priority'];_0x2bad26[_0x50cf('0x10')]=(_0x367bc6[_0x50cf('0x2c')]?_[_0x50cf('0x42')](_0x367bc6)['priority']:_0x343e9a[_0x50cf('0x10')])+0x1;_0x2bad26[_0x50cf('0x11')]=_[_0x50cf('0x43')](_0x2bad26[_0x50cf('0x11')],_0x33e8fd,[_0x343e9a],_0x367bc6);}_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x44'),'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')],'context':_0xc79c4d[_0x33cf47][0x0]['context'],'priority':_0x2bad26[_0x50cf('0x10')],'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});_0x353824[_0x50cf('0x13')](_0xc79c4d[_0x33cf47][0x0]['VoiceExtensionId']);_0x3e4ea4=_[_0x50cf('0x43')](_0x3e4ea4,_0x2bad26[_0x50cf('0x11')]);}}return _0x2f4750['transaction'](function(_0x66285){return _0x2f4750[_0x50cf('0x2')][_0x50cf('0x6')][_0x50cf('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x353824}},'transaction':_0x66285})[_0x50cf('0xa')](function(_0x42628f){return _0x2f4750[_0x50cf('0x2')][_0x50cf('0x6')][_0x50cf('0x46')](_[_0x50cf('0x47')](_0x3e4ea4,_0x50cf('0x10')),{'transaction':_0x66285});});});})[_0x50cf('0x48')](function(_0x10bc2c){console[_0x50cf('0x49')](_0x10bc2c);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 47d0c77..21e0ec4 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 _0x45ba=['cm_hopper_black','id\x20IN\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','always','sequelize','query','VoiceQueueId','all','CmList','BlackLists','Campaign','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','CmContact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','ContactId','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x45ba,0x99));var _0xa45b=function(_0x58e023,_0x5d2c38){_0x58e023=_0x58e023-0x0;var _0x3e96d0=_0x45ba[_0x58e023];return _0x3e96d0;};'use strict';var BPromise=require(_0xa45b('0x0'));var util=require(_0xa45b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0xa45b('0x2'));var Papa=require(_0xa45b('0x3'));var Redis=require(_0xa45b('0x4'));var db=require(_0xa45b('0x5'))['db'];var config=require(_0xa45b('0x6'));var logger=require(_0xa45b('0x7'))(_0xa45b('0x8'));config[_0xa45b('0x9')]=_['defaults'](config[_0xa45b('0x9')],{'host':_0xa45b('0xa'),'port':0x18eb});var socket=require(_0xa45b('0xb'))(new Redis(config[_0xa45b('0x9')]));require('../../../api/cmContact/cmContact.socket')[_0xa45b('0xc')](socket);try{if(!process[_0xa45b('0xd')][0x2]||process[_0xa45b('0xd')][0x2]===_0xa45b('0xe')||process[_0xa45b('0xd')][0x2]===_0xa45b('0xf')){throw new Error(_0xa45b('0x10'));}var FILEPATH=process[_0xa45b('0xd')][0x2];if(!process[_0xa45b('0xd')][0x3]||process['argv'][0x3]===_0xa45b('0xe')||process[_0xa45b('0xd')][0x3]===_0xa45b('0xf')||!process[_0xa45b('0xd')][0x4]||process[_0xa45b('0xd')][0x4]===_0xa45b('0xe')||process[_0xa45b('0xd')][0x4]===_0xa45b('0xf')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xa45b('0x11')](process[_0xa45b('0xd')][0x3]['split'](','),process['argv'][0x4][_0xa45b('0x12')](','));if(!process[_0xa45b('0xd')][0x5]||process[_0xa45b('0xd')][0x5]===_0xa45b('0xe')||process[_0xa45b('0xd')][0x5]===_0xa45b('0xf')){throw new Error(_0xa45b('0x13'));}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xa45b('0xd')][0x6]!=='undefined'&&process[_0xa45b('0xd')][0x6]!==_0xa45b('0xf')?process['argv'][0x6]:null;var DUPLICATES=process[_0xa45b('0xd')][0x7]&&process[_0xa45b('0xd')][0x7]!==_0xa45b('0xe')&&process[_0xa45b('0xd')][0x7]!==_0xa45b('0xf')?process[_0xa45b('0xd')][0x7]:null;if(!process[_0xa45b('0xd')][0x8]||process[_0xa45b('0xd')][0x8]==='undefined'||process[_0xa45b('0xd')][0x8]===_0xa45b('0xf')){throw new Error(_0xa45b('0x14'));}var SOCKET_TIMESTAMP=process[_0xa45b('0xd')][0x8];}catch(_0x3b07da){logger[_0xa45b('0x15')](_0x3b07da);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(_0x2e5db8,_0x131593,_0x5e57fb,_0x47e7d8){var _0x4c5e65={'message':_0x131593};_0x4c5e65[_0x2e5db8]=!![];if(_0x5e57fb){_0x4c5e65[_0xa45b('0x16')]=_0x5e57fb;}if(_0x47e7d8){_0x4c5e65[_0xa45b('0x17')]=_0x47e7d8;}return _0x4c5e65;}function isEmail(_0x4ff13b){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))*$/[_0xa45b('0x18')](_0x4ff13b);}function checkRow(_0xbb09ef,_0x4fca7b,_0x476629){return new BPromise(function(_0x212cd9,_0x32ebd7){if(_[_0xa45b('0x19')](_0xbb09ef)){return _0x32ebd7(handleCheckRowError(_0xa45b('0x15'),_0xa45b('0x1a'),null,_0x476629));}if(_0xbb09ef[_0xa45b('0x1b')]&&_0xbb09ef[_0xa45b('0x1b')]['length']){var _0x51bec2=_[_0xa45b('0x1c')](_0xbb09ef[_0xa45b('0x1b')],'message')[_0xa45b('0x1d')](';');return _0x32ebd7(handleCheckRowError(_0xa45b('0x15'),_0x51bec2,null,_0x476629));}var _0x19cc3a={};for(var _0x44b0e9 in FIELDS){if(FIELDS[_0xa45b('0x1e')](_0x44b0e9)&&FIELDS[_0x44b0e9]){_0x19cc3a[_0x44b0e9]=_0xbb09ef[_0xa45b('0x1f')][0x0][FIELDS[_0x44b0e9]]||_0xbb09ef[_0xa45b('0x1f')][0x0]['\ufeff'+FIELDS[_0x44b0e9]];}}if(!_0x19cc3a[_0xa45b('0x20')]){return _0x32ebd7(handleCheckRowError(_0xa45b('0x15'),_0xa45b('0x21'),null,_0x476629));}if(!_0x19cc3a[_0xa45b('0x22')]){return _0x32ebd7(handleCheckRowError(_0xa45b('0x15'),_0xa45b('0x23'),null,_0x476629));}if(_0x19cc3a[_0xa45b('0x24')]){var _0x661163=moment(_0x19cc3a[_0xa45b('0x24')],_0xa45b('0x25'));if(!_0x661163[_0xa45b('0x26')]()){return _0x32ebd7(handleCheckRowError(_0xa45b('0x15'),_0xa45b('0x27'),null,_0x476629));}}if(_0x19cc3a['email']){if(!isEmail(_0x19cc3a[_0xa45b('0x28')])){return _0x32ebd7(handleCheckRowError(_0xa45b('0x15'),_0xa45b('0x29'),null,_0x476629));}}_0x19cc3a[_0xa45b('0x2a')]=LISTID;_0x19cc3a[_0xa45b('0x2b')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xa45b('0x2c')]&&_0x4fca7b){var _0xc45232={};for(var _0x4be11e=0x0,_0x457469=DUPLICATES[_0xa45b('0x2c')];_0x4be11e<_0x457469;_0x4be11e+=0x1){_0xc45232[DUPLICATES[_0x4be11e]]=_0x19cc3a[DUPLICATES[_0x4be11e]];}var _0x1ae697=_[_0xa45b('0x2d')](_0x4fca7b,_0xc45232);if(_0x1ae697){return _0x32ebd7(handleCheckRowError(_0xa45b('0x2e'),'Duplicate\x20Contact',_0x1ae697,_0x476629));}}return db[_0xa45b('0x2f')]['create'](_0x19cc3a,{'raw':!![],'hooks':![],'fields':_[_0xa45b('0x30')](_0x19cc3a)})[_0xa45b('0x31')](function(_0x3ce3e3){if(DUPLICATES&&DUPLICATES[_0xa45b('0x2c')]&&_0x4fca7b){_0x4fca7b[_0xa45b('0x32')](_[_0xa45b('0x33')](_0x19cc3a,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3ce3e3['id'];return _0x212cd9();})[_0xa45b('0x34')](function(_0x10461e){return _0x32ebd7(handleCheckRowError(_0xa45b('0x15'),_0xa45b('0x35')+(_0x10461e[_0xa45b('0x36')]||JSON[_0xa45b('0x37')](_0x10461e)),null,_0x476629));});});}function checkHopper(){function _0x26df8b(){return function(_0x194974){logger[_0xa45b('0x15')](_0xa45b('0x38'),_0xa45b('0x39'),util['inspect'](_0x194974,{'showHidden':![],'depth':null}));};}var _0x5b1dc7=function(_0x577aa3,_0x3e0594){var _0xd0cf80=squel[_0xa45b('0x3a')]()[_0xa45b('0x3b')](_0xa45b('0x3c'))[_0xa45b('0x3d')](['phone',_0xa45b('0x3e'),'ContactId','ListId',_0x3e0594,_0xa45b('0x3f'),_0xa45b('0x40')],squel[_0xa45b('0x41')]()['field'](_0xa45b('0x22'),_0xa45b('0x22'))[_0xa45b('0x42')]('NOW()',_0xa45b('0x3e'))[_0xa45b('0x42')]('id',_0xa45b('0x43'))['field'](LISTID['toString'](),_0xa45b('0x2a'))[_0xa45b('0x42')](_0x577aa3['id'][_0xa45b('0x44')](),_0x3e0594)['field']('NOW()',_0xa45b('0x3f'))[_0xa45b('0x42')](_0xa45b('0x45'),_0xa45b('0x40'))[_0xa45b('0x46')](_0xa45b('0x47'))[_0xa45b('0x48')](_0xa45b('0x49'))[_0xa45b('0x48')](_0xa45b('0x4a'),LISTID[_0xa45b('0x44')]())[_0xa45b('0x48')](_0xa45b('0x4b'))[_0xa45b('0x48')](_0xa45b('0x4c'),squel['select']()['field'](_0xa45b('0x22'))[_0xa45b('0x46')]('cm_hopper')[_0xa45b('0x48')](_0x3e0594+_0xa45b('0x4d'),_0x577aa3['id'][_0xa45b('0x44')]())))[_0xa45b('0x44')]();return _0xd0cf80;};var _0x5b317f=function(_0x34d1f8,_0x3d949e){var _0x32cfbf=squel[_0xa45b('0x3a')]()[_0xa45b('0x3b')](_0xa45b('0x3c'))['fromQuery']([_0xa45b('0x22'),_0xa45b('0x3e'),_0xa45b('0x43'),'ListId',_0x3d949e,'createdAt',_0xa45b('0x40')],squel[_0xa45b('0x41')]()['field'](_0xa45b('0x22'),_0xa45b('0x22'))[_0xa45b('0x42')](_0xa45b('0x45'),_0xa45b('0x3e'))[_0xa45b('0x42')]('id',_0xa45b('0x43'))['field'](LISTID[_0xa45b('0x44')](),'ListId')[_0xa45b('0x42')](_0x34d1f8['id'][_0xa45b('0x44')](),_0x3d949e)[_0xa45b('0x42')](_0xa45b('0x45'),_0xa45b('0x3f'))[_0xa45b('0x42')](_0xa45b('0x45'),_0xa45b('0x40'))['from'](_0xa45b('0x47'))[_0xa45b('0x48')]('deletedAt\x20IS\x20NULL')[_0xa45b('0x48')]('ListId\x20=\x20?',LISTID['toString']())[_0xa45b('0x48')]('id\x20IN\x20?',squel[_0xa45b('0x4e')](hopperContacts))[_0xa45b('0x48')](_0xa45b('0x4b'))[_0xa45b('0x48')](_0xa45b('0x4c'),squel[_0xa45b('0x41')]()['field'](_0xa45b('0x4f'))[_0xa45b('0x46')](_0xa45b('0x50'))[_0xa45b('0x48')](_0x3d949e+'\x20=\x20?',_0x34d1f8['id'][_0xa45b('0x44')]()))[_0xa45b('0x48')](_0xa45b('0x4c'),squel[_0xa45b('0x41')]()['field'](_0xa45b('0x22'))[_0xa45b('0x46')](_0xa45b('0x3c'))['where'](_0x3d949e+_0xa45b('0x4d'),_0x34d1f8['id'][_0xa45b('0x44')]())))[_0xa45b('0x44')]();return _0x32cfbf;};function _0x53cd2c(_0xaaf96d,_0xe07593){var _0x4a5b45=squel['insert']()[_0xa45b('0x3b')](_0xa45b('0x3c'))[_0xa45b('0x3d')]([_0xa45b('0x22'),_0xa45b('0x3e'),'ContactId',_0xa45b('0x2a'),_0xe07593,_0xa45b('0x3f'),'updatedAt'],squel['select']()[_0xa45b('0x42')](_0xa45b('0x22'),_0xa45b('0x22'))[_0xa45b('0x42')](_0xa45b('0x45'),_0xa45b('0x3e'))[_0xa45b('0x42')]('id','ContactId')[_0xa45b('0x42')](LISTID[_0xa45b('0x44')](),_0xa45b('0x2a'))[_0xa45b('0x42')](_0xaaf96d['id'][_0xa45b('0x44')](),_0xe07593)[_0xa45b('0x42')]('NOW()',_0xa45b('0x3f'))['field'](_0xa45b('0x45'),_0xa45b('0x40'))[_0xa45b('0x46')](_0xa45b('0x47'))[_0xa45b('0x48')](_0xa45b('0x49'))[_0xa45b('0x48')](_0xa45b('0x4a'),LISTID[_0xa45b('0x44')]())[_0xa45b('0x48')]('id\x20IN\x20?',squel[_0xa45b('0x4e')](hopperContacts))[_0xa45b('0x48')](_0xa45b('0x4b')))[_0xa45b('0x44')]();return _0x4a5b45;}function _0x5f1512(_0x445761,_0x1375e4){var _0x62871a=squel[_0xa45b('0x3a')]()[_0xa45b('0x3b')](_0xa45b('0x51'))[_0xa45b('0x3d')]([_0xa45b('0x22'),'ContactId',_0xa45b('0x2a'),_0x1375e4,_0xa45b('0x3f'),_0xa45b('0x40')],squel['select']()[_0xa45b('0x42')]('phone','phone')['field']('id',_0xa45b('0x43'))[_0xa45b('0x42')](LISTID[_0xa45b('0x44')](),_0xa45b('0x2a'))[_0xa45b('0x42')](_0x445761['id'][_0xa45b('0x44')](),_0x1375e4)[_0xa45b('0x42')](_0xa45b('0x45'),_0xa45b('0x3f'))['field'](_0xa45b('0x45'),_0xa45b('0x40'))[_0xa45b('0x46')](_0xa45b('0x47'))[_0xa45b('0x48')](_0xa45b('0x49'))[_0xa45b('0x48')](_0xa45b('0x4a'),LISTID['toString']())[_0xa45b('0x48')](_0xa45b('0x52'),squel[_0xa45b('0x4e')](hopperContacts))[_0xa45b('0x48')](_0xa45b('0x4b')))[_0xa45b('0x44')]();return _0x62871a;}return db[_0xa45b('0x53')][_0xa45b('0x54')]({'where':{'type':_0xa45b('0x55')},'attributes':['id',_0xa45b('0x56')],'include':[{'model':db['CmList'],'as':_0xa45b('0x57'),'where':{'id':LISTID}}]})[_0xa45b('0x31')](function(_0x1bcea5){var _0x2db574=[];if(_0x1bcea5){var _0x446894;for(var _0x1fa475=0x0,_0x2bebde;_0x1fa475<_0x1bcea5[_0xa45b('0x2c')];_0x1fa475+=0x1){_0x2bebde=_0x1bcea5[_0x1fa475][_0xa45b('0x58')]({'plain':!![]});switch(_0x2bebde[_0xa45b('0x56')]){case _0xa45b('0x59'):_0x2db574['push'](db[_0xa45b('0x5a')][_0xa45b('0x5b')](_0x5b317f(_0x2bebde,_0xa45b('0x5c')))[_0xa45b('0x31')](function(){})[_0xa45b('0x34')](_0x26df8b()));break;case'onlyIfOpen':_0x2db574[_0xa45b('0x32')](db[_0xa45b('0x5a')][_0xa45b('0x5b')](_0x5b1dc7(_0x2bebde,'VoiceQueueId'))[_0xa45b('0x31')](function(){})[_0xa45b('0x34')](_0x26df8b()));break;default:_0x2db574['push'](db[_0xa45b('0x5a')][_0xa45b('0x5b')](_0x53cd2c(_0x2bebde,_0xa45b('0x5c')))['then'](function(){})[_0xa45b('0x34')](_0x26df8b()));}}}return _0x2db574;})[_0xa45b('0x5d')]()[_0xa45b('0x31')](function(){return db[_0xa45b('0x53')]['findAll']({'where':{'type':_0xa45b('0x55')},'attributes':['id'],'include':[{'model':db[_0xa45b('0x5e')],'as':_0xa45b('0x5f'),'where':{'id':LISTID}}]})[_0xa45b('0x31')](function(_0x3a2322){var _0x3ce3d2=[];if(_0x3a2322){var _0x5eb2fb;for(var _0x2596c8=0x0,_0x3c0e6a;_0x2596c8<_0x3a2322['length'];_0x2596c8+=0x1){_0x3c0e6a=_0x3a2322[_0x2596c8][_0xa45b('0x58')]({'plain':!![]});_0x3ce3d2[_0xa45b('0x32')](db[_0xa45b('0x5a')][_0xa45b('0x5b')](_0x5f1512(_0x3c0e6a,_0xa45b('0x5c')))[_0xa45b('0x31')](function(){})[_0xa45b('0x34')](_0x26df8b()));}}return _0x3ce3d2;})[_0xa45b('0x5d')]();})[_0xa45b('0x31')](function(){return db[_0xa45b('0x60')]['findAll']({'attributes':['id',_0xa45b('0x56')],'include':[{'model':db[_0xa45b('0x5e')],'as':_0xa45b('0x57'),'where':{'id':LISTID}}]})[_0xa45b('0x31')](function(_0x79b35c){var _0x3c7ff1=[];if(_0x79b35c){for(var _0x4361e4=0x0,_0x3de3a2;_0x4361e4<_0x79b35c[_0xa45b('0x2c')];_0x4361e4+=0x1){_0x3de3a2=_0x79b35c[_0x4361e4][_0xa45b('0x58')]({'plain':!![]});switch(_0x3de3a2['dialCheckDuplicateType']){case _0xa45b('0x59'):_0x3c7ff1[_0xa45b('0x32')](db[_0xa45b('0x5a')]['query'](_0x5b317f(_0x3de3a2,_0xa45b('0x61')))['then'](function(){})[_0xa45b('0x34')](_0x26df8b()));break;case _0xa45b('0x62'):_0x3c7ff1[_0xa45b('0x32')](db['sequelize']['query'](_0x5b1dc7(_0x3de3a2,_0xa45b('0x61')))[_0xa45b('0x31')](function(){})['catch'](_0x26df8b()));break;default:_0x3c7ff1[_0xa45b('0x32')](db[_0xa45b('0x5a')]['query'](_0x53cd2c(_0x3de3a2,_0xa45b('0x61')))[_0xa45b('0x31')](function(){})[_0xa45b('0x34')](_0x26df8b()));}}}return _0x3c7ff1;})[_0xa45b('0x5d')]();})[_0xa45b('0x31')](function(){return db[_0xa45b('0x60')][_0xa45b('0x54')]({'attributes':['id'],'include':[{'model':db[_0xa45b('0x5e')],'as':_0xa45b('0x5f'),'where':{'id':LISTID}}]})[_0xa45b('0x31')](function(_0x3e2eac){var _0x3fea7c=[];if(_0x3e2eac){for(var _0x2b5f59=0x0,_0x590373;_0x2b5f59<_0x3e2eac[_0xa45b('0x2c')];_0x2b5f59+=0x1){_0x590373=_0x3e2eac[_0x2b5f59][_0xa45b('0x58')]({'plain':!![]});_0x3fea7c['push'](db[_0xa45b('0x5a')][_0xa45b('0x5b')](_0x5f1512(_0x590373,_0xa45b('0x61')))[_0xa45b('0x31')](function(){})[_0xa45b('0x34')](_0x26df8b()));}}return _0x3fea7c;})[_0xa45b('0x5d')]();})[_0xa45b('0x34')](function(_0x4b1336){logger['error'](_0xa45b('0x63'),_0xa45b('0x64'),_0x4b1336[_0xa45b('0x36')]);});}var processPromises=function(_0x3e9a23){return BPromise[_0xa45b('0x5d')](promises)[_0xa45b('0x31')](function(_0x39dbb1){})[_0xa45b('0x34')](function(_0x1e57ce){logger[_0xa45b('0x15')](_0xa45b('0x65'),JSON[_0xa45b('0x37')](_0x1e57ce));})[_0xa45b('0x66')](function(){socket[_0xa45b('0x67')](_0xa45b('0x68')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3e9a23){return _0x3e9a23[_0xa45b('0x69')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xa45b('0x67')](_0xa45b('0x68')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xa45b('0x6a')](FILEPATH);}catch(_0x4cd796){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x4cd796));}finally{process[_0xa45b('0x6b')](0x0);}});};process['on'](_0xa45b('0x6c'),function(){logger[_0xa45b('0x6d')](_0xa45b('0x6e'));endCsv();});function main(){return BPromise[_0xa45b('0x6f')]()[_0xa45b('0x31')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xa45b('0x12')](',');return db[_0xa45b('0x2f')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa45b('0x31')](function(_0xa37188){var _0x5bb0fb=fs[_0xa45b('0x70')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xa45b('0x71')](_0x5bb0fb,{'header':!![],'skipEmptyLines':!![],'step':function(_0xd5509d,_0x199a15){total+=0x1;var _0x5f4b63=total;promises[_0xa45b('0x32')](checkRow(_0xd5509d,_0xa37188,_0x5f4b63)['then'](function(){success+=0x1;})['catch'](function(_0x4c6479){if(_0x4c6479[_0xa45b('0x15')]){errors+=0x1;delete _0x4c6479[_0xa45b('0x15')];}else if(_0x4c6479['duplicate']){duplicates+=0x1;delete _0x4c6479[_0xa45b('0x2e')];}rows[_0xa45b('0x32')](_0x4c6479);}));if(total%0xc8===0x0){_0x199a15[_0xa45b('0x72')]();return processPromises(_0x199a15);}},'complete':function(){return processPromises()[_0xa45b('0x31')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0xc84131,_0x40694c){logger[_0xa45b('0x6d')](_0xa45b('0x73'),JSON['stringify'](_0xc84131));endCsv();}});})['catch'](function(_0x15c747){logger[_0xa45b('0x15')](_0xa45b('0x74'),JSON[_0xa45b('0x37')](_0x15c747));});}main(); \ No newline at end of file +var _0x9389=['ListId','CompanyId','find','duplicate','Duplicate\x20Contact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','ContactId','updatedAt','select','field','NOW()','scheduledAt','toString','createdAt','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','id\x20IN\x20?','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','\x20=\x20?','str','cm_hopper_black','cm_contacts','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','sequelize','query','VoiceQueueId','onlyIfOpen','BlackLists','get','all','Campaign','always','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','CmContact','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','papaparse','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','null','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email'];(function(_0x101b07,_0x32fd40){var _0x379034=function(_0x3f4823){while(--_0x3f4823){_0x101b07['push'](_0x101b07['shift']());}};_0x379034(++_0x32fd40);}(_0x9389,0xb2));var _0x9938=function(_0x4fe950,_0x122ba4){_0x4fe950=_0x4fe950-0x0;var _0x244076=_0x9389[_0x4fe950];return _0x244076;};'use strict';var BPromise=require('bluebird');var util=require(_0x9938('0x0'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0x9938('0x1'));var Redis=require('ioredis');var db=require(_0x9938('0x2'))['db'];var config=require('../../../config/environment');var logger=require(_0x9938('0x3'))(_0x9938('0x4'));config[_0x9938('0x5')]=_[_0x9938('0x6')](config[_0x9938('0x5')],{'host':_0x9938('0x7'),'port':0x18eb});var socket=require(_0x9938('0x8'))(new Redis(config[_0x9938('0x5')]));require('../../../api/cmContact/cmContact.socket')[_0x9938('0x9')](socket);try{if(!process[_0x9938('0xa')][0x2]||process[_0x9938('0xa')][0x2]===_0x9938('0xb')||process[_0x9938('0xa')][0x2]==='null'){throw new Error(_0x9938('0xc'));}var FILEPATH=process['argv'][0x2];if(!process[_0x9938('0xa')][0x3]||process[_0x9938('0xa')][0x3]===_0x9938('0xb')||process[_0x9938('0xa')][0x3]==='null'||!process[_0x9938('0xa')][0x4]||process[_0x9938('0xa')][0x4]===_0x9938('0xb')||process[_0x9938('0xa')][0x4]==='null'){throw new Error(_0x9938('0xd'));}var FIELDS=_['zipObject'](process[_0x9938('0xa')][0x3][_0x9938('0xe')](','),process[_0x9938('0xa')][0x4][_0x9938('0xe')](','));if(!process[_0x9938('0xa')][0x5]||process[_0x9938('0xa')][0x5]===_0x9938('0xb')||process[_0x9938('0xa')][0x5]===_0x9938('0xf')){throw new Error(_0x9938('0x10'));}var LISTID=process[_0x9938('0xa')][0x5];var COMPANYID=process[_0x9938('0xa')][0x6]&&process[_0x9938('0xa')][0x6]!==_0x9938('0xb')&&process['argv'][0x6]!==_0x9938('0xf')?process[_0x9938('0xa')][0x6]:null;var DUPLICATES=process[_0x9938('0xa')][0x7]&&process[_0x9938('0xa')][0x7]!==_0x9938('0xb')&&process[_0x9938('0xa')][0x7]!==_0x9938('0xf')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0x9938('0xa')][0x8]===_0x9938('0xb')||process[_0x9938('0xa')][0x8]==='null'){throw new Error(_0x9938('0x11'));}var SOCKET_TIMESTAMP=process[_0x9938('0xa')][0x8];}catch(_0x4641a1){logger[_0x9938('0x12')](_0x4641a1);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(_0x353163,_0x422a6b,_0x3312d7,_0x31d317){var _0x41d225={'message':_0x422a6b};_0x41d225[_0x353163]=!![];if(_0x3312d7){_0x41d225['contact']=_0x3312d7;}if(_0x31d317){_0x41d225[_0x9938('0x13')]=_0x31d317;}return _0x41d225;}function isEmail(_0x5e679d){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'](_0x5e679d);}function checkRow(_0x3f457e,_0x2e30d5,_0x18c483){return new BPromise(function(_0x65583b,_0x476bdb){if(_[_0x9938('0x14')](_0x3f457e)){return _0x476bdb(handleCheckRowError('error',_0x9938('0x15'),null,_0x18c483));}if(_0x3f457e['errors']&&_0x3f457e[_0x9938('0x16')][_0x9938('0x17')]){var _0x537a2b=_[_0x9938('0x18')](_0x3f457e[_0x9938('0x16')],_0x9938('0x19'))[_0x9938('0x1a')](';');return _0x476bdb(handleCheckRowError(_0x9938('0x12'),_0x537a2b,null,_0x18c483));}var _0x66846a={};for(var _0x27c260 in FIELDS){if(FIELDS['hasOwnProperty'](_0x27c260)&&FIELDS[_0x27c260]){_0x66846a[_0x27c260]=_0x3f457e[_0x9938('0x1b')][0x0][FIELDS[_0x27c260]]||_0x3f457e[_0x9938('0x1b')][0x0]['\ufeff'+FIELDS[_0x27c260]];}}if(!_0x66846a[_0x9938('0x1c')]){return _0x476bdb(handleCheckRowError(_0x9938('0x12'),_0x9938('0x1d'),null,_0x18c483));}if(!_0x66846a[_0x9938('0x1e')]){return _0x476bdb(handleCheckRowError(_0x9938('0x12'),_0x9938('0x1f'),null,_0x18c483));}if(_0x66846a[_0x9938('0x20')]){var _0x17885c=moment(_0x66846a[_0x9938('0x20')],_0x9938('0x21'));if(!_0x17885c['isValid']()){return _0x476bdb(handleCheckRowError(_0x9938('0x12'),_0x9938('0x22'),null,_0x18c483));}}if(_0x66846a[_0x9938('0x23')]){if(!isEmail(_0x66846a[_0x9938('0x23')])){return _0x476bdb(handleCheckRowError(_0x9938('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x18c483));}}_0x66846a[_0x9938('0x24')]=LISTID;_0x66846a[_0x9938('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x9938('0x17')]&&_0x2e30d5){var _0x4aa09e={};for(var _0x400690=0x0,_0x353055=DUPLICATES[_0x9938('0x17')];_0x400690<_0x353055;_0x400690+=0x1){_0x4aa09e[DUPLICATES[_0x400690]]=_0x66846a[DUPLICATES[_0x400690]];}var _0x8b446c=_[_0x9938('0x26')](_0x2e30d5,_0x4aa09e);if(_0x8b446c){return _0x476bdb(handleCheckRowError(_0x9938('0x27'),_0x9938('0x28'),_0x8b446c,_0x18c483));}}return db['CmContact']['create'](_0x66846a,{'raw':!![],'hooks':![],'fields':_[_0x9938('0x29')](_0x66846a)})[_0x9938('0x2a')](function(_0x47e75c){if(DUPLICATES&&DUPLICATES[_0x9938('0x17')]&&_0x2e30d5){_0x2e30d5[_0x9938('0x2b')](_[_0x9938('0x2c')](_0x66846a,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x47e75c['id'];return _0x65583b();})[_0x9938('0x2d')](function(_0x5cb41e){return _0x476bdb(handleCheckRowError(_0x9938('0x12'),_0x9938('0x2e')+(_0x5cb41e[_0x9938('0x19')]||JSON[_0x9938('0x2f')](_0x5cb41e)),null,_0x18c483));});});}function checkHopper(){function _0x57ce1d(){return function(_0x4af519){logger[_0x9938('0x12')](_0x9938('0x30'),_0x9938('0x31'),util['inspect'](_0x4af519,{'showHidden':![],'depth':null}));};}var _0x52d66a=function(_0x55449a,_0xa0a369){var _0x1654e2=squel[_0x9938('0x32')]()[_0x9938('0x33')](_0x9938('0x34'))[_0x9938('0x35')]([_0x9938('0x1e'),'scheduledAt',_0x9938('0x36'),_0x9938('0x24'),_0xa0a369,'createdAt',_0x9938('0x37')],squel[_0x9938('0x38')]()[_0x9938('0x39')](_0x9938('0x1e'),_0x9938('0x1e'))[_0x9938('0x39')](_0x9938('0x3a'),_0x9938('0x3b'))[_0x9938('0x39')]('id',_0x9938('0x36'))['field'](LISTID['toString'](),_0x9938('0x24'))['field'](_0x55449a['id'][_0x9938('0x3c')](),_0xa0a369)[_0x9938('0x39')](_0x9938('0x3a'),_0x9938('0x3d'))[_0x9938('0x39')](_0x9938('0x3a'),_0x9938('0x37'))[_0x9938('0x3e')]('cm_contacts')[_0x9938('0x3f')](_0x9938('0x40'))[_0x9938('0x3f')](_0x9938('0x41'),LISTID[_0x9938('0x3c')]())['where'](_0x9938('0x42'))[_0x9938('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x9938('0x1e'))['from'](_0x9938('0x34'))['where'](_0xa0a369+'\x20=\x20?',_0x55449a['id']['toString']())))[_0x9938('0x3c')]();return _0x1654e2;};var _0x51fe5d=function(_0x1f6968,_0x1e738f){var _0x41fc1a=squel[_0x9938('0x32')]()['into'](_0x9938('0x34'))[_0x9938('0x35')]([_0x9938('0x1e'),_0x9938('0x3b'),_0x9938('0x36'),_0x9938('0x24'),_0x1e738f,_0x9938('0x3d'),_0x9938('0x37')],squel[_0x9938('0x38')]()[_0x9938('0x39')](_0x9938('0x1e'),_0x9938('0x1e'))['field'](_0x9938('0x3a'),_0x9938('0x3b'))['field']('id',_0x9938('0x36'))['field'](LISTID[_0x9938('0x3c')](),_0x9938('0x24'))[_0x9938('0x39')](_0x1f6968['id'][_0x9938('0x3c')](),_0x1e738f)['field'](_0x9938('0x3a'),_0x9938('0x3d'))[_0x9938('0x39')](_0x9938('0x3a'),_0x9938('0x37'))[_0x9938('0x3e')]('cm_contacts')[_0x9938('0x3f')](_0x9938('0x40'))[_0x9938('0x3f')](_0x9938('0x41'),LISTID[_0x9938('0x3c')]())[_0x9938('0x3f')](_0x9938('0x43'),squel['str'](hopperContacts))[_0x9938('0x3f')](_0x9938('0x42'))[_0x9938('0x3f')](_0x9938('0x44'),squel[_0x9938('0x38')]()[_0x9938('0x39')](_0x9938('0x45'))[_0x9938('0x3e')](_0x9938('0x46'))[_0x9938('0x3f')](_0x1e738f+'\x20=\x20?',_0x1f6968['id'][_0x9938('0x3c')]()))[_0x9938('0x3f')](_0x9938('0x44'),squel['select']()[_0x9938('0x39')](_0x9938('0x1e'))['from']('cm_hopper')['where'](_0x1e738f+_0x9938('0x47'),_0x1f6968['id'][_0x9938('0x3c')]())))[_0x9938('0x3c')]();return _0x41fc1a;};function _0x6358db(_0x326098,_0x105bb1){var _0x4be375=squel['insert']()[_0x9938('0x33')](_0x9938('0x34'))[_0x9938('0x35')]([_0x9938('0x1e'),_0x9938('0x3b'),'ContactId',_0x9938('0x24'),_0x105bb1,_0x9938('0x3d'),'updatedAt'],squel[_0x9938('0x38')]()[_0x9938('0x39')](_0x9938('0x1e'),_0x9938('0x1e'))['field'](_0x9938('0x3a'),_0x9938('0x3b'))['field']('id',_0x9938('0x36'))['field'](LISTID[_0x9938('0x3c')](),_0x9938('0x24'))[_0x9938('0x39')](_0x326098['id'][_0x9938('0x3c')](),_0x105bb1)[_0x9938('0x39')](_0x9938('0x3a'),_0x9938('0x3d'))[_0x9938('0x39')]('NOW()',_0x9938('0x37'))[_0x9938('0x3e')]('cm_contacts')[_0x9938('0x3f')](_0x9938('0x40'))[_0x9938('0x3f')](_0x9938('0x41'),LISTID['toString']())['where'](_0x9938('0x43'),squel[_0x9938('0x48')](hopperContacts))[_0x9938('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0x9938('0x3c')]();return _0x4be375;}function _0x4b2068(_0x4315cb,_0x152fdd){var _0x2b61a2=squel[_0x9938('0x32')]()['into'](_0x9938('0x49'))[_0x9938('0x35')]([_0x9938('0x1e'),_0x9938('0x36'),_0x9938('0x24'),_0x152fdd,'createdAt',_0x9938('0x37')],squel[_0x9938('0x38')]()[_0x9938('0x39')](_0x9938('0x1e'),_0x9938('0x1e'))['field']('id',_0x9938('0x36'))[_0x9938('0x39')](LISTID[_0x9938('0x3c')](),'ListId')['field'](_0x4315cb['id'][_0x9938('0x3c')](),_0x152fdd)['field'](_0x9938('0x3a'),_0x9938('0x3d'))['field']('NOW()','updatedAt')['from'](_0x9938('0x4a'))[_0x9938('0x3f')]('deletedAt\x20IS\x20NULL')[_0x9938('0x3f')](_0x9938('0x41'),LISTID[_0x9938('0x3c')]())[_0x9938('0x3f')]('id\x20IN\x20?',squel[_0x9938('0x48')](hopperContacts))[_0x9938('0x3f')](_0x9938('0x42')))['toString']();return _0x2b61a2;}return db[_0x9938('0x4b')][_0x9938('0x4c')]({'where':{'type':_0x9938('0x4d')},'attributes':['id',_0x9938('0x4e')],'include':[{'model':db[_0x9938('0x4f')],'as':_0x9938('0x50'),'where':{'id':LISTID}}]})[_0x9938('0x2a')](function(_0x4a8b31){var _0xcdcf31=[];if(_0x4a8b31){var _0x545c87;for(var _0x2369e2=0x0,_0x22263e;_0x2369e2<_0x4a8b31[_0x9938('0x17')];_0x2369e2+=0x1){_0x22263e=_0x4a8b31[_0x2369e2]['get']({'plain':!![]});switch(_0x22263e[_0x9938('0x4e')]){case'always':_0xcdcf31[_0x9938('0x2b')](db[_0x9938('0x51')][_0x9938('0x52')](_0x51fe5d(_0x22263e,_0x9938('0x53')))[_0x9938('0x2a')](function(){})[_0x9938('0x2d')](_0x57ce1d()));break;case _0x9938('0x54'):_0xcdcf31['push'](db['sequelize'][_0x9938('0x52')](_0x52d66a(_0x22263e,'VoiceQueueId'))[_0x9938('0x2a')](function(){})['catch'](_0x57ce1d()));break;default:_0xcdcf31[_0x9938('0x2b')](db[_0x9938('0x51')]['query'](_0x6358db(_0x22263e,'VoiceQueueId'))[_0x9938('0x2a')](function(){})[_0x9938('0x2d')](_0x57ce1d()));}}}return _0xcdcf31;})['all']()[_0x9938('0x2a')](function(){return db[_0x9938('0x4b')][_0x9938('0x4c')]({'where':{'type':_0x9938('0x4d')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x9938('0x55'),'where':{'id':LISTID}}]})[_0x9938('0x2a')](function(_0x387d6f){var _0x51dfbb=[];if(_0x387d6f){var _0x2e4a01;for(var _0x5bab36=0x0,_0x2a6641;_0x5bab36<_0x387d6f[_0x9938('0x17')];_0x5bab36+=0x1){_0x2a6641=_0x387d6f[_0x5bab36][_0x9938('0x56')]({'plain':!![]});_0x51dfbb[_0x9938('0x2b')](db[_0x9938('0x51')]['query'](_0x4b2068(_0x2a6641,'VoiceQueueId'))['then'](function(){})[_0x9938('0x2d')](_0x57ce1d()));}}return _0x51dfbb;})[_0x9938('0x57')]();})[_0x9938('0x2a')](function(){return db[_0x9938('0x58')][_0x9938('0x4c')]({'attributes':['id',_0x9938('0x4e')],'include':[{'model':db[_0x9938('0x4f')],'as':_0x9938('0x50'),'where':{'id':LISTID}}]})[_0x9938('0x2a')](function(_0x33c8a5){var _0x19301f=[];if(_0x33c8a5){for(var _0x574df1=0x0,_0x42a51e;_0x574df1<_0x33c8a5[_0x9938('0x17')];_0x574df1+=0x1){_0x42a51e=_0x33c8a5[_0x574df1][_0x9938('0x56')]({'plain':!![]});switch(_0x42a51e[_0x9938('0x4e')]){case _0x9938('0x59'):_0x19301f[_0x9938('0x2b')](db['sequelize'][_0x9938('0x52')](_0x51fe5d(_0x42a51e,_0x9938('0x5a')))[_0x9938('0x2a')](function(){})['catch'](_0x57ce1d()));break;case'onlyIfOpen':_0x19301f[_0x9938('0x2b')](db[_0x9938('0x51')][_0x9938('0x52')](_0x52d66a(_0x42a51e,_0x9938('0x5a')))[_0x9938('0x2a')](function(){})[_0x9938('0x2d')](_0x57ce1d()));break;default:_0x19301f['push'](db[_0x9938('0x51')][_0x9938('0x52')](_0x6358db(_0x42a51e,_0x9938('0x5a')))[_0x9938('0x2a')](function(){})[_0x9938('0x2d')](_0x57ce1d()));}}}return _0x19301f;})['all']();})['then'](function(){return db[_0x9938('0x58')][_0x9938('0x4c')]({'attributes':['id'],'include':[{'model':db[_0x9938('0x4f')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0xc73d15){var _0x370e48=[];if(_0xc73d15){for(var _0x2762fb=0x0,_0x2acb2b;_0x2762fb<_0xc73d15[_0x9938('0x17')];_0x2762fb+=0x1){_0x2acb2b=_0xc73d15[_0x2762fb][_0x9938('0x56')]({'plain':!![]});_0x370e48['push'](db['sequelize'][_0x9938('0x52')](_0x4b2068(_0x2acb2b,_0x9938('0x5a')))[_0x9938('0x2a')](function(){})['catch'](_0x57ce1d()));}}return _0x370e48;})[_0x9938('0x57')]();})[_0x9938('0x2d')](function(_0x3599ab){logger[_0x9938('0x12')](_0x9938('0x5b'),'generalCheckHopper',_0x3599ab[_0x9938('0x19')]);});}var processPromises=function(_0xb8427d){return BPromise[_0x9938('0x57')](promises)[_0x9938('0x2a')](function(_0x28d97f){})['catch'](function(_0x50dbb5){logger[_0x9938('0x12')](_0x9938('0x5c'),JSON[_0x9938('0x2f')](_0x50dbb5));})[_0x9938('0x5d')](function(){socket[_0x9938('0x5e')](_0x9938('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xb8427d){return _0xb8427d[_0x9938('0x60')]();}});};var endCsv=function(){return BPromise[_0x9938('0x61')]()[_0x9938('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0x9938('0x2a')](function(){socket[_0x9938('0x5e')](_0x9938('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x9938('0x62')](FILEPATH);}catch(_0x399eb4){logger[_0x9938('0x12')](_0x9938('0x63'),JSON[_0x9938('0x2f')](_0x399eb4));}finally{process[_0x9938('0x64')](0x0);}});};process['on']('SIGINT',function(){logger[_0x9938('0x65')](_0x9938('0x66'));endCsv();});function main(){return BPromise[_0x9938('0x61')]()[_0x9938('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x9938('0xe')](',');return db[_0x9938('0x67')][_0x9938('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x9938('0x2a')](function(_0x2c0699){var _0x182b58=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x182b58,{'header':!![],'skipEmptyLines':!![],'step':function(_0x35ed64,_0x1fcf0e){total+=0x1;var _0x2242e2=total;promises['push'](checkRow(_0x35ed64,_0x2c0699,_0x2242e2)[_0x9938('0x2a')](function(){success+=0x1;})['catch'](function(_0x35d012){if(_0x35d012[_0x9938('0x12')]){errors+=0x1;delete _0x35d012[_0x9938('0x12')];}else if(_0x35d012[_0x9938('0x27')]){duplicates+=0x1;delete _0x35d012[_0x9938('0x27')];}rows[_0x9938('0x2b')](_0x35d012);}));if(total%0xc8===0x0){_0x1fcf0e['pause']();return processPromises(_0x1fcf0e);}},'complete':function(){return processPromises()[_0x9938('0x2a')](function(){logger[_0x9938('0x65')](_0x9938('0x68'));endCsv();});},'error':function(_0x2ad14d,_0x5472e4){logger['info'](_0x9938('0x69'),JSON['stringify'](_0x2ad14d));endCsv();}});})[_0x9938('0x2d')](function(_0x183357){logger['error'](_0x9938('0x6a'),JSON[_0x9938('0x2f')](_0x183357));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 152cb47..c954f8e 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 _0x7948=['inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','phone','scheduledat','ListId','createdAt','priority','recallme','fields','join','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','ContactId','updatedAt','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','message','exit','errors','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','error','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','set','offset','main','stringify','send','start','binding','clone','socket_timestamp','root','.csv','keys','includes','header','name','parse','data','rows','find','_description','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','\x20not\x20specified','replace','itemTypeId','SystemRow','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','dialTimezone,utcOffset',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactTypeId','orderBy','voice_queues_has_cm_blacklists','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','contact:import:','unlink','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','update','create','PHONE'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0x7948,0x144));var _0x8794=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0x7948[_0x41ee16];return _0x1f60de;};'use strict';var fs=require('fs');var path=require(_0x8794('0x0'));var _=require(_0x8794('0x1'));var Papa=require(_0x8794('0x2'));var util=require(_0x8794('0x3'));var BPromise=require(_0x8794('0x4'));var moment=require(_0x8794('0x5'));var squel=require('squel');var Redis=require(_0x8794('0x6'));var db=require(_0x8794('0x7'))['db'];var config=require('../../../config/environment');var shared=require('../../../config/environment/shared');var logger=require(_0x8794('0x8'))(_0x8794('0x9'));config[_0x8794('0xa')]=_[_0x8794('0xb')](config[_0x8794('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8794('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x8794('0xc')](_0x8794('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x8794('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x8b75a5){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))*$/[_0x8794('0xe')](_0x8b75a5);}function selectNotIn(_0x4aafb5,_0x3612ef,_0x2656df,_0x4db0f1,_0x391472){return squel[_0x8794('0xf')]()[_0x8794('0x10')]('phone')[_0x8794('0x11')](_0x4db0f1)['join'](_0x3612ef,null,_0x3612ef+_0x8794('0x12')+_0x4db0f1+'.'+_0x2656df)[_0x8794('0x13')](_0x4db0f1+'.'+_0x2656df+_0x8794('0x14')+_0x4aafb5+'.'+_0x2656df)[_0x8794('0x13')](_0x3612ef+_0x8794('0x15')+_0x391472['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2f8c97,_0x4b9dd0){promisesAdditionalPhones=[];return db[_0x8794('0x16')][_0x8794('0x17')]({'raw':!![],'attributes':['id',_0x8794('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x8794('0x19')](function(_0x5d073b){if(_0x5d073b!==null){var _0x1ae842=[];for(var _0x57e895=0x0;_0x57e895<_0x5d073b[_0x8794('0x1a')];_0x57e895++){var _0x1fead2=_0x5d073b[_0x57e895];_0x1ae842[_0x8794('0x1b')](insertAdditionalPhones(_0x1fead2));}}Promise[_0x8794('0x1c')](_0x1ae842)['then'](function(){_0x2f8c97({'val':0x1});});});});}function insertAdditionalPhones(_0x3bb73b){return new Promise(function(_0x4bee49,_0x21bcc4){var _0x21d6ea=_0x3bb73b['AdditionalPhones'];var _0x5007e6=_0x21d6ea[_0x8794('0x1d')](';');var _0x2b62f1=[];orderBy=0x0;for(var _0x121cda=0x0;_0x121cda<_0x5007e6[_0x8794('0x1a')];_0x121cda++){_0x2b62f1['push'](splitAdditionalPhone(_0x3bb73b['id'],_0x5007e6[_0x121cda]));}Promise[_0x8794('0x1c')](_0x2b62f1)[_0x8794('0x19')](function(){_0x4bee49({'val':_0x5007e6[_0x8794('0x1a')]});});});}function splitAdditionalPhone(_0x50a9dc,_0xf3cc1b){return new Promise(function(_0x199d7e,_0x370f4c){var _0x4f81d2=_0xf3cc1b[_0x8794('0x1d')](':');var _0x19a3ea=_0x4f81d2[0x0];var _0x3450e5=_0x4f81d2[0x1];if(!_[_0x8794('0x1e')](_0x3450e5)){var _0x383bf4=_0x3450e5[_0x8794('0x1d')]('|');var _0x27ddab=[];for(var _0xd9f592=0x0;_0xd9f592<_0x383bf4[_0x8794('0x1a')];_0xd9f592++){if(_0x383bf4[_0xd9f592]!==''){var _0x46e6d2=_[_0x8794('0x1f')](promisesAdditionalPhones,{'contactId':_0x50a9dc,'phone':_0x383bf4[_0xd9f592]});if(_0x46e6d2[_0x8794('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x8794('0x1b')]({'contactId':_0x50a9dc,'contactTypeId':_0x19a3ea,'phone':_0x383bf4[_0xd9f592],'orderBy':orderBy});}}}_0x199d7e({'ok':0x1});}else _0x199d7e({'res':0x0});});}function createAdditionalPhone(_0x1b094a,_0x450bac,_0x3c1eb9,_0x5c1c2d){var _0x242388='';var _0x582417='';var _0x37b289=_0x3c1eb9[_0x8794('0x1d')]('§');_0x242388=_0x37b289[0x0];if(_0x37b289[_0x8794('0x1a')]==0x2)_0x582417=_0x37b289[0x1];return new Promise(function(_0x251764,_0x1207f5){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x1b094a,'item':_0x242388}})[_0x8794('0x19')](function(_0xa52bee){if(_0xa52bee){return db[_0x8794('0x20')][_0x8794('0x21')]({'ItemTypeId':_0x450bac,'description':_0x582417,'OrderBy':_0x5c1c2d},{'where':{'CmContactId':_0x1b094a,'item':_0x242388}})['then'](function(_0x7f96ab){_0x251764({'res':'updated'});});}else{return db[_0x8794('0x20')][_0x8794('0x22')]({'CmContactId':_0x1b094a,'item':_0x242388,'description':_0x582417,'ItemTypeId':_0x450bac,'OrderBy':_0x5c1c2d,'ItemClass':_0x8794('0x23')})[_0x8794('0x19')](function(_0x2da24a){_0x251764({'res':_0x8794('0x24')});});}});});}function insertCmHopper(_0x38a1f5,_0x5e55aa,_0xfbfa44,_0x4ef13e,_0x3ee9d6){var _0x1454ed=[_0x8794('0x25'),_0x8794('0x26'),_0x8794('0x27'),_0x8794('0x28'),_0x5e55aa+'.'+_0x4ef13e,_0x8794('0x29'),_0x8794('0x2a'),_0x8794('0x2b'),'cm_contacts.UserId','\x22'+_0x3ee9d6+'\x22'];return squel[_0x8794('0x2c')]()[_0x8794('0x2d')](_0x8794('0x2e'))[_0x8794('0x2f')]([_0x8794('0x30'),_0x8794('0x31'),'ContactId',_0x8794('0x32'),_0x4ef13e,_0x8794('0x33'),'updatedAt',_0x8794('0x34'),'UserId',_0x8794('0x35')],squel[_0x8794('0xf')]()[_0x8794('0x36')](_0x1454ed)[_0x8794('0x11')](_0x5e55aa)[_0x8794('0x37')](_0x8794('0x38'),null,_0x8794('0x39')+_0x5e55aa+_0x8794('0x3a'))[_0x8794('0x37')](_0xfbfa44,null,_0xfbfa44+'.id\x20=\x20'+_0x5e55aa+'.'+_0x4ef13e)[_0x8794('0x13')](_0x5e55aa+_0x8794('0x3b'),_0x38a1f5)[_0x8794('0x13')](_0x8794('0x3c'),NOW)[_0x8794('0x13')](_0x8794('0x3d'),selectNotIn(_0x5e55aa,_0xfbfa44,_0x4ef13e,_0x8794('0x2e'),[_0x8794('0x3e'),_0x8794('0x3f')]))[_0x8794('0x13')](_0x8794('0x3d'),selectNotIn(_0x5e55aa,_0xfbfa44,_0x4ef13e,_0x8794('0x2e'),['\x22always\x22'])))[_0x8794('0x40')]();}function insertCmHopperBlack(_0x534af1,_0x37c68d,_0x432757,_0xe274f0){var _0x136378=[_0x8794('0x25'),_0x8794('0x27'),_0x8794('0x28'),_0x37c68d+'.'+_0xe274f0,_0x8794('0x29'),_0x8794('0x2a')];return squel[_0x8794('0x2c')]()['into'](_0x8794('0x41'))[_0x8794('0x2f')]([_0x8794('0x30'),_0x8794('0x42'),'ListId',_0xe274f0,_0x8794('0x33'),_0x8794('0x43')],squel[_0x8794('0xf')]()[_0x8794('0x36')](_0x136378)[_0x8794('0x11')](_0x37c68d)[_0x8794('0x37')](_0x8794('0x38'),null,_0x8794('0x39')+_0x37c68d+_0x8794('0x3a'))[_0x8794('0x37')](_0x432757,null,_0x432757+_0x8794('0x12')+_0x37c68d+'.'+_0xe274f0)[_0x8794('0x13')](_0x37c68d+_0x8794('0x3b'),_0x534af1)['where'](_0x8794('0x3c'),NOW)[_0x8794('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x8794('0xf')]()[_0x8794('0x10')](_0x8794('0x30'))['from'](_0x8794('0x41'))[_0x8794('0x13')](_0x8794('0x44'),_0x534af1)[_0x8794('0x13')](_0xe274f0+_0x8794('0x14')+_0x37c68d+'.'+_0xe274f0)))[_0x8794('0x40')]();}function insertTzCmHopper(_0x2697da,_0x296f8c,_0x1d89dd,_0x1bfb14,_0x3600bd,_0x563ca6){var _0x5c4296=[_0x8794('0x25'),_0x8794('0x45')+_0x563ca6+_0x8794('0x46'),_0x8794('0x27'),_0x8794('0x28'),_0x296f8c+'.'+_0x1bfb14,'cm_contacts.createdAt',_0x8794('0x2a'),_0x8794('0x2b'),'cm_contacts.UserId','\x22'+_0x3600bd+'\x22'];var _0x593a10=squel[_0x8794('0x2c')]()[_0x8794('0x2d')](_0x8794('0x2e'))[_0x8794('0x2f')]([_0x8794('0x30'),_0x8794('0x31'),_0x8794('0x42'),'ListId',_0x1bfb14,_0x8794('0x33'),_0x8794('0x43'),'priority','UserId',_0x8794('0x35')],squel[_0x8794('0xf')]()[_0x8794('0x36')](_0x5c4296)[_0x8794('0x11')](_0x296f8c)['join']('cm_contacts',null,_0x8794('0x39')+_0x296f8c+_0x8794('0x3a'))[_0x8794('0x37')](_0x1d89dd,null,_0x1d89dd+_0x8794('0x12')+_0x296f8c+'.'+_0x1bfb14)[_0x8794('0x37')](_0x563ca6,null,_0x563ca6+_0x8794('0x12')+_0x296f8c+'.'+_0x1bfb14)[_0x8794('0x13')](_0x296f8c+_0x8794('0x3b'),_0x2697da)[_0x8794('0x13')](_0x8794('0x3c'),NOW)['where'](_0x8794('0x3d'),selectNotIn(_0x296f8c,_0x1d89dd,_0x1bfb14,'cm_hopper',[_0x8794('0x3e'),_0x8794('0x3f')]))[_0x8794('0x13')](_0x8794('0x3d'),selectNotIn(_0x296f8c,_0x1d89dd,_0x1bfb14,_0x8794('0x2e'),[_0x8794('0x3e')])))[_0x8794('0x40')]();return _0x593a10;}function insertTzCmHopperBlack(_0x1cdc26,_0x169e7b,_0x63aee5,_0x2b4e9f){var _0x30cc47=[_0x8794('0x25'),_0x8794('0x27'),_0x8794('0x28'),_0x169e7b+'.'+_0x2b4e9f,_0x8794('0x29'),_0x8794('0x2a')];return squel[_0x8794('0x2c')]()[_0x8794('0x2d')](_0x8794('0x41'))['fromQuery']([_0x8794('0x30'),_0x8794('0x42'),_0x8794('0x32'),_0x2b4e9f,'createdAt','updatedAt'],squel[_0x8794('0xf')]()[_0x8794('0x36')](_0x30cc47)['from'](_0x169e7b)[_0x8794('0x37')](_0x8794('0x38'),null,_0x8794('0x39')+_0x169e7b+_0x8794('0x3a'))['join'](_0x63aee5,null,_0x63aee5+_0x8794('0x12')+_0x169e7b+'.'+_0x2b4e9f)[_0x8794('0x13')](_0x169e7b+'.CmListId\x20=\x20?',_0x1cdc26)[_0x8794('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x8794('0xf')]()['field'](_0x8794('0x30'))[_0x8794('0x11')](_0x8794('0x41'))['where'](_0x8794('0x44'),_0x1cdc26)[_0x8794('0x13')](_0x2b4e9f+_0x8794('0x14')+_0x169e7b+'.'+_0x2b4e9f)))[_0x8794('0x40')]();}function insertCmHopperAdditionalPhones(_0x39ddc0){var _0x3a4314=[_0x8794('0x47'),_0x8794('0x48'),'cm_contact_has_items.OrderBy',_0x8794('0x49'),'cm_contact_has_items.updatedAt'];return squel[_0x8794('0x2c')]()['into']('cm_hopper_additional_phones')[_0x8794('0x2f')]([_0x8794('0x4a'),_0x8794('0x30'),_0x8794('0x4b'),_0x8794('0x33'),_0x8794('0x43')],squel[_0x8794('0xf')]()[_0x8794('0x36')](_0x3a4314)[_0x8794('0x11')](_0x8794('0x2e'))[_0x8794('0x37')](_0x8794('0x38'),null,_0x8794('0x4c'))[_0x8794('0x37')](_0x8794('0x4d'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x8794('0x13')](_0x8794('0x4e'),_0x39ddc0)[_0x8794('0x13')](_0x8794('0x3c'),NOW))[_0x8794('0x40')]();}function insertCmContact(_0x54f601,_0x50934b,_0xbb0255,_0x43822b){var _0x57c4df=_[_0x8794('0x4f')](_['keys'](_0x43822b),[_0x8794('0x32'),_0x8794('0x50'),_0x8794('0x33'),'updatedAt']);return squel[_0x8794('0x2c')]()[_0x8794('0x2d')](_0x8794('0x38'))[_0x8794('0x2f')](_0x57c4df,squel[_0x8794('0xf')]()[_0x8794('0x36')](_0x57c4df)[_0x8794('0x11')](_0x50934b)['where']('('+_0xbb0255[_0x8794('0x37')](',')+_0x8794('0x51'),squel['select']()[_0x8794('0x36')](_0xbb0255)[_0x8794('0x11')]('cm_contacts')[_0x8794('0x13')]('ListId\x20=\x20?',_0x54f601)[_0x8794('0x13')]('deletedAt\x20IS\x20NULL'))[_0x8794('0x13')](_0x8794('0x52'),squel[_0x8794('0xf')]()[_0x8794('0x10')](_0x8794('0x53'),_0x8794('0x54'))['from'](_0x50934b)[_0x8794('0x55')](_0xbb0255['join'](','))))[_0x8794('0x40')]();}function handleStop(){logger[_0x8794('0x56')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x1eb6d3){logger['error'](_0x1eb6d3[_0x8794('0x57')]);process[_0x8794('0x58')](0x1);}function handleError(_0x221aa0,_0x51958c){stats[_0x8794('0x59')]['push']({'name':_0x51958c['code'],'message':_0x51958c[_0x8794('0x57')],'row':_0x221aa0});}function handleQuery(_0x26ac02){logger[_0x8794('0x56')](_0x26ac02);return db[_0x8794('0x5a')][_0x8794('0x5b')](_0x26ac02)[_0x8794('0x5c')](function(_0x193b46){results[_0x8794('0x1b')](_0x193b46);})[_0x8794('0x5d')](function(_0x515bee){logger['error'](_0x515bee[_0x8794('0x57')]);});}function updateTzCampaigns(_0x4e2919){return new Promise(function(_0x3b1291,_0x25b6e0){var _0x29e69b=squel['select']()[_0x8794('0x36')]([_0x8794('0x5e'),_0x8794('0x5f')])[_0x8794('0x11')](_0x8794('0x60'))['join'](_0x8794('0x61'),null,_0x8794('0x62'))[_0x8794('0x13')]('campaigns_has_cm_lists.CmListId='+_0x4e2919);db[_0x8794('0x5a')][_0x8794('0x5b')](_0x29e69b[_0x8794('0x40')]())[_0x8794('0x5c')](function(_0x4f3417){var _0xe92797=[];for(var _0x4fe178=0x0;_0x4fe178<_0x4f3417[_0x8794('0x1a')];_0x4fe178++){_0xe92797[_0x8794('0x1b')](getTimezoneData(_0x4f3417[_0x4fe178],tmp_campaigns));}BPromise[_0x8794('0x1c')](_0xe92797)[_0x8794('0x19')](function(){_0x3b1291({'val':0x1});});})[_0x8794('0x5d')](function(_0x38817d){logger[_0x8794('0x63')](_0x38817d[_0x8794('0x57')]);_0x3b1291({'val':0x0});});});}function updateTzVoiceQueues(_0x59387e){return new Promise(function(_0x17d4e3,_0x5e0d8e){var _0x7887c6=squel[_0x8794('0xf')]()['fields']([_0x8794('0x64'),'voice_queues.dialTimezone'])[_0x8794('0x11')](_0x8794('0x65'))[_0x8794('0x37')](_0x8794('0x66'),null,_0x8794('0x67'))[_0x8794('0x13')]('voice_queues_has_cm_lists.CmListId='+_0x59387e);db[_0x8794('0x5a')][_0x8794('0x5b')](_0x7887c6[_0x8794('0x40')]())[_0x8794('0x5c')](function(_0x15fb61){var _0x537dfd=[];for(var _0x1ac5dc=0x0;_0x1ac5dc<_0x15fb61['length'];_0x1ac5dc++){_0x537dfd[_0x8794('0x1b')](getTimezoneData(_0x15fb61[_0x1ac5dc],tmp_voice_queues));}BPromise[_0x8794('0x1c')](_0x537dfd)['then'](function(){_0x17d4e3({'val':0x1});});})[_0x8794('0x5d')](function(_0x56a3b5){logger[_0x8794('0x63')](_0x56a3b5[_0x8794('0x57')]);_0x17d4e3({'val':0x0});});});}function getTimezoneData(_0x37714d,_0x2e13be){return new Promise(function(_0x59ee8d,_0x69c025){var _0x2691d5=shared[_0x8794('0x68')];var _0x7e2d15=_0x2691d5[_0x37714d[_0x8794('0x69')]];if(_[_0x8794('0x1e')](_0x7e2d15)){_0x59ee8d({'ret':0x1});}else{var _0x5f3da1=_0x7e2d15['utcOffset'];var _0xa3d29f=squel[_0x8794('0x2c')]()[_0x8794('0x2d')](_0x2e13be)['set']('id',_0x37714d['id'])[_0x8794('0x6a')](_0x8794('0x6b'),_0x5f3da1)['set']('dialTimezone',_0x37714d[_0x8794('0x69')])[_0x8794('0x40')]();return db['sequelize']['query'](_0xa3d29f)['spread'](function(_0x2aa2a0){_0x59ee8d({'ret':0x1});})[_0x8794('0x5d')](function(_0x1618f7){logger['error'](_0x1618f7['message']);_0x69c025({'ret':0x1});});}});}function handleTZQuery(_0x77e43){logger[_0x8794('0x56')](_0x77e43);return db[_0x8794('0x5a')][_0x8794('0x5b')](_0x77e43)[_0x8794('0x5c')](function(_0x3e3e62){})[_0x8794('0x5d')](function(_0x5dcb3d){logger[_0x8794('0x63')](_0x5dcb3d['message']);});}function main(_0xf76909,_0x5e587b,_0x13df99,_0x55c17e){logger[_0x8794('0x56')](_0x8794('0x6c'),_0xf76909,JSON[_0x8794('0x6d')](_0x5e587b));process[_0x8794('0x6e')](_0x8794('0x6f'));var _0x37d1da=_0x5e587b[_0x8794('0x70')];var _0x3c765d=_[_0x8794('0x71')](_0x37d1da);var _0x2476c5=_0x5e587b[_0x8794('0x72')];var _0x482a61=path[_0x8794('0x37')](config[_0x8794('0x73')],'server/files/tmp',_0x2476c5+_0x8794('0x74'));hasTZ=_[_0x8794('0x75')](_0x37d1da)[_0x8794('0x76')](_0x8794('0x69'));var _0x370193=_[_0x8794('0x75')](_0x37d1da)[_0x8794('0x37')]();logger[_0x8794('0x56')](_0x8794('0x77'),_0x370193);db['ContactItemType'][_0x8794('0x17')]({'raw':!![],'attributes':['id',_0x8794('0x78')]})[_0x8794('0x19')](function(_0x1949c4){for(var _0x4d3b39=0x0;_0x4d3b39<_0x1949c4['length'];_0x4d3b39++){if(_0x1949c4[_0x4d3b39]['name']in _0x37d1da){contactItemTypes['push'](_0x1949c4[_0x4d3b39]);delete _0x3c765d[_0x1949c4[_0x4d3b39][_0x8794('0x78')]];hasAdditionalPhones=!![];}for(var _0x37a9e8 in _0x37d1da){if(_0x1949c4[_0x4d3b39][_0x8794('0x78')]+'_description'===_0x37a9e8){phoneDescriptions[_0x8794('0x1b')]({'itemTypeId':_0x1949c4[_0x4d3b39]['id'],'description':_0x37a9e8});delete _0x3c765d[_0x37a9e8];}}}if(hasAdditionalPhones)_0x3c765d['AdditionalPhones']='';var _0x2aa466=_['keys'](_0x3c765d)['join']();logger[_0x8794('0x56')](_0x8794('0x77'),_0x2aa466);fs['writeFileSync'](_0x482a61,_0x2aa466+'\x0a');Papa[_0x8794('0x79')](fs['createReadStream'](_0xf76909),{'header':!![],'skipEmptyLines':!![],'step':function(_0xda5356,_0x5a1b79){try{for(var _0x371364=0x0,_0x4519a3=[];_0x371364<_0xda5356[_0x8794('0x7a')][_0x8794('0x1a')];_0x371364++){stats[_0x8794('0x7b')]+=0x1;if(_0xda5356[_0x8794('0x59')][_0x371364]){handleError(_0xda5356[_0x8794('0x7a')][_0x371364],_0xda5356[_0x8794('0x59')][_0x371364]);}else{var _0x4571b0=[];var _0x3ce3f1=[];var _0x3ed266={};for(var _0x3ab198 in _0x37d1da){let _0xc0c1b7=contactItemTypes['find'](_0x19d893=>_0x19d893[_0x8794('0x78')]===_0x3ab198);let _0x3aeb94=contactItemTypes[_0x8794('0x7c')](_0x494ec1=>_0x494ec1[_0x8794('0x78')]+_0x8794('0x7d')===_0x3ab198);if(_[_0x8794('0x1e')](_0xc0c1b7)&&_['isNil'](_0x3aeb94)){if(_0x37d1da[_0x8794('0x7e')](_0x3ab198)){if(_0xda5356['data'][_0x371364][_0x37d1da[_0x3ab198]]){var _0x4289c6=_[_0x8794('0x7f')](_0xda5356['data'][_0x371364][_0x37d1da[_0x3ab198]]['replace'](/"/g,'\x27'));switch(_0x3ab198){case _0x8794('0x31'):var _0x3f0204=moment(_0x4289c6,_0x8794('0xd'),!![]);if(_0x3f0204[_0x8794('0x80')]()){_0x4519a3[_0x8794('0x1b')]('\x22'+_0x4289c6+'\x22');}else{_0x4571b0[_0x8794('0x1b')](_0x8794('0x81'));}break;case _0x8794('0x34'):var _0xba2a5c=parseInt(_0x4289c6);_0x4289c6=_[_0x8794('0x82')](_0xba2a5c)||_0xba2a5c<0x0||_0xba2a5c>0x4?_0x55c17e?0x3:0x2:_0xba2a5c;_0x4519a3[_0x8794('0x1b')]('\x22'+_0x4289c6+'\x22');break;case _0x8794('0x83'):var _0x3e3dfb=parseInt(_0x4289c6);if(_['isNumber'](_0x3e3dfb)&&_[_0x8794('0x76')](_0x13df99,_0x3e3dfb)){_0x4519a3[_0x8794('0x1b')]('\x22'+_0x3e3dfb+'\x22');}else{_0x4571b0[_0x8794('0x1b')]('agent\x20not\x20exists');}break;case _0x8794('0x84'):if(isEmail(_0x4289c6)){_0x4519a3[_0x8794('0x1b')]('\x22'+_0x4289c6+'\x22');}else{_0x4571b0[_0x8794('0x1b')](_0x8794('0x85'));}break;case'dateOfBirth':var _0x34e54a=moment(_0x4289c6,_0x8794('0x86'),!![]);if(_0x34e54a[_0x8794('0x80')]()){_0x4519a3[_0x8794('0x1b')]('\x22'+_0x4289c6+'\x22');}else{_0x4571b0[_0x8794('0x1b')](_0x8794('0x87'));}break;case _0x8794('0x69'):var _0x55b6fd=shared[_0x8794('0x68')];var _0x1951b3=_0x55b6fd[_0x4289c6];if(!_[_0x8794('0x1e')](_0x1951b3)){var _0x565087=_0x1951b3[_0x8794('0x88')];_0x4519a3[_0x8794('0x1b')]('\x22'+_0x4289c6+'\x22');_0x4519a3[_0x8794('0x1b')]('\x22'+_0x565087+'\x22');}break;default:_0x4519a3[_0x8794('0x1b')]('\x22'+_0x4289c6+'\x22');}}else{switch(_0x3ab198){case _0x8794('0x89'):case _0x8794('0x30'):_0x4571b0[_0x8794('0x1b')](_0x3ab198+_0x8794('0x8a'));break;default:_0x4519a3[_0x8794('0x1b')]('\x22\x22');}}}}else{var _0x32db94='';if(!_[_0x8794('0x1e')](_0xc0c1b7)){if(!_0x3ed266['hasOwnProperty'](_0xc0c1b7['id'])){if(!_[_0x8794('0x1e')](_0xda5356[_0x8794('0x7a')][_0x371364][_0x37d1da[_0x3ab198]])){var _0x4289c6=_[_0x8794('0x7f')](_0xda5356[_0x8794('0x7a')][_0x371364][_0x37d1da[_0x3ab198]][_0x8794('0x8b')](/"/g,'\x27'));var _0x186376=phoneDescriptions[_0x8794('0x7c')](_0x129f79=>_0x129f79[_0x8794('0x8c')]===_0xc0c1b7['id']);if(!_[_0x8794('0x1e')](_0x186376)){var _0x223622=_[_0x8794('0x7f')](_0xda5356['data'][_0x371364][_0x37d1da[_0x186376['description']]]['replace'](/"/g,'\x27'));if(!_[_0x8794('0x1e')](_0x223622))_0x4289c6=_0x4289c6+'§'+_0x223622;}if(_0x32db94=='')_0x32db94=_0x4289c6;else _0x32db94+='|'+_0x4289c6;}_0x3ce3f1['push'](_0xc0c1b7['id']+':'+_0x32db94);_0x3ed266[_0xc0c1b7['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4519a3[_0x8794('0x1b')]('\x22'+_0x3ce3f1[_0x8794('0x37')](';')+'\x22');}if(_0x4571b0['length']){handleError(_0xda5356[_0x8794('0x7a')][_0x371364],{'code':_0x8794('0x8d'),'message':_0x4571b0[_0x8794('0x37')]()});}else{fs['appendFileSync'](_0x482a61,_0x4519a3['join']()+'\x0a');}_0x4519a3=[];}if(!(stats[_0x8794('0x7b')]%0xc8)){socket[_0x8794('0x8e')]('contact:import:'+_0x2476c5,stats);stats[_0x8794('0x59')]=[];}}if(stopped){logger[_0x8794('0x56')](_0x8794('0x8f'));_0x5a1b79['abort']();}}catch(_0x1f1e6c){handleError(_0xda5356['data'][_0x371364],{'code':_0x8794('0x90'),'message':_0x1f1e6c[_0x8794('0x57')]});logger[_0x8794('0x63')](_0x8794('0x91'),_0x1f1e6c[_0x8794('0x57')]);}},'complete':function(){try{var _0x1088c6=[];var _0x1f87c1=[];var _0x53b262=_0x8794('0x38');if(_0x5e587b[_0x8794('0x92')]&&_0x5e587b['duplicates']['length']){_0x53b262=_0x8794('0x93')+_0x2476c5;_0x1088c6[_0x8794('0x1b')](_0x8794('0x94')+_0x53b262+_0x8794('0x95'));}tmp_campaigns=_0x8794('0x96')+_0x2476c5;tmp_voice_queues=_0x8794('0x97')+_0x2476c5;_0x1f87c1[_0x8794('0x1b')](_0x8794('0x94')+tmp_campaigns+_0x8794('0x98'));_0x1f87c1[_0x8794('0x1b')](_0x8794('0x94')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x8794('0x99')](_0x1f87c1,handleTZQuery)[_0x8794('0x19')](function(_0x24595c){updateTzCampaigns(_0x5e587b['ListId'])[_0x8794('0x19')](function(_0x2fab7b){updateTzVoiceQueues(_0x5e587b['ListId'])[_0x8794('0x19')](function(_0x2a99cb){if(hasTZ)_0x2aa466=_0x2aa466[_0x8794('0x8b')]('dialTimezone',_0x8794('0x9a'));var _0x26ad12=util[_0x8794('0xc')]('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',_0x482a61,_0x53b262,_0x2aa466,_0x5e587b[_0x8794('0x32')],_0x5e587b[_0x8794('0x50')]||null,NOW,NOW);if(_[_0x8794('0x1e')](_0x37d1da[_0x8794('0x31')])){_0x26ad12+=_0x8794('0x9b');}_0x1088c6['push'](_0x26ad12);if(_0x5e587b[_0x8794('0x92')]&&_0x5e587b[_0x8794('0x92')][_0x8794('0x1a')]){_0x1088c6[_0x8794('0x1b')](insertCmContact(_0x5e587b[_0x8794('0x32')],_0x53b262,_0x5e587b[_0x8794('0x92')],_0x37d1da));_0x1088c6[_0x8794('0x1b')](_0x8794('0x9c')+_0x53b262+';');}BPromise[_0x8794('0x99')](_0x1088c6,handleQuery)['then'](function(_0x10cee2){BPromise[_0x8794('0x1c')]([handleAdditionalPhones()])[_0x8794('0x19')](function(){_0x1088c6=[];for(var _0x8ab135=0x0;_0x8ab135\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','papaparse','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','AdditionalPhones','then','length','push','split','all','isNil','filter','CmContactHasItem','findOne','update','updated','create','PHONE','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts'];(function(_0x5e849c,_0x4cbd22){var _0x26adea=function(_0x5db633){while(--_0x5db633){_0x5e849c['push'](_0x5e849c['shift']());}};_0x26adea(++_0x4cbd22);}(_0x0fdf,0x79));var _0xf0fd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0fdf[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0xf0fd('0x0'));var util=require('util');var BPromise=require(_0xf0fd('0x1'));var moment=require(_0xf0fd('0x2'));var squel=require(_0xf0fd('0x3'));var Redis=require(_0xf0fd('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xf0fd('0x5'));var shared=require(_0xf0fd('0x6'));var logger=require('../../../config/logger')('import');config[_0xf0fd('0x7')]=_['defaults'](config[_0xf0fd('0x7')],{'host':_0xf0fd('0x8'),'port':0x18eb});var socket=require(_0xf0fd('0x9'))(new Redis(config[_0xf0fd('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xf0fd('0xa')](_0xf0fd('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x59ea2d){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'](_0x59ea2d);}function selectNotIn(_0xa2915e,_0x1e4743,_0x2ecbda,_0xbf2715,_0x2185bc){return squel[_0xf0fd('0xc')]()[_0xf0fd('0xd')](_0xf0fd('0xe'))[_0xf0fd('0xf')](_0xbf2715)[_0xf0fd('0x10')](_0x1e4743,null,_0x1e4743+_0xf0fd('0x11')+_0xbf2715+'.'+_0x2ecbda)[_0xf0fd('0x12')](_0xbf2715+'.'+_0x2ecbda+'\x20=\x20'+_0xa2915e+'.'+_0x2ecbda)[_0xf0fd('0x12')](_0x1e4743+_0xf0fd('0x13')+_0x2185bc[_0xf0fd('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x55ec51,_0x104144){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id',_0xf0fd('0x14')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xf0fd('0x15')](function(_0x278c44){if(_0x278c44!==null){var _0x3316e1=[];for(var _0xc74e22=0x0;_0xc74e22<_0x278c44[_0xf0fd('0x16')];_0xc74e22++){var _0x1be2fc=_0x278c44[_0xc74e22];_0x3316e1[_0xf0fd('0x17')](insertAdditionalPhones(_0x1be2fc));}}Promise['all'](_0x3316e1)[_0xf0fd('0x15')](function(){_0x55ec51({'val':0x1});});});});}function insertAdditionalPhones(_0x75b340){return new Promise(function(_0x4a571a,_0x5b8751){var _0x408e1e=_0x75b340[_0xf0fd('0x14')];var _0x45e874=_0x408e1e[_0xf0fd('0x18')](';');var _0xe8b842=[];orderBy=0x0;for(var _0x5ab7b6=0x0;_0x5ab7b6<_0x45e874[_0xf0fd('0x16')];_0x5ab7b6++){_0xe8b842[_0xf0fd('0x17')](splitAdditionalPhone(_0x75b340['id'],_0x45e874[_0x5ab7b6]));}Promise[_0xf0fd('0x19')](_0xe8b842)['then'](function(){_0x4a571a({'val':_0x45e874[_0xf0fd('0x16')]});});});}function splitAdditionalPhone(_0x5029d4,_0x4caf8a){return new Promise(function(_0x473bf9,_0x2c07c7){var _0x199687=_0x4caf8a['split'](':');var _0x19247a=_0x199687[0x0];var _0xef6f40=_0x199687[0x1];if(!_[_0xf0fd('0x1a')](_0xef6f40)){var _0x36e16f=_0xef6f40['split']('|');var _0x13bd0d=[];for(var _0x45dde7=0x0;_0x45dde7<_0x36e16f['length'];_0x45dde7++){if(_0x36e16f[_0x45dde7]!==''){var _0x2b003f=_[_0xf0fd('0x1b')](promisesAdditionalPhones,{'contactId':_0x5029d4,'phone':_0x36e16f[_0x45dde7]});if(_0x2b003f['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x5029d4,'contactTypeId':_0x19247a,'phone':_0x36e16f[_0x45dde7],'orderBy':orderBy});}}}_0x473bf9({'ok':0x1});}else _0x473bf9({'res':0x0});});}function createAdditionalPhone(_0x4c4b30,_0x40cd2c,_0x17f98e,_0xecbbf){var _0x5598e1='';var _0x2ab55d='';var _0x4a7b88=_0x17f98e[_0xf0fd('0x18')]('§');_0x5598e1=_0x4a7b88[0x0];if(_0x4a7b88[_0xf0fd('0x16')]==0x2)_0x2ab55d=_0x4a7b88[0x1];return new Promise(function(_0x347cf0,_0x15e584){return db[_0xf0fd('0x1c')][_0xf0fd('0x1d')]({'where':{'CmContactId':_0x4c4b30,'item':_0x5598e1}})[_0xf0fd('0x15')](function(_0x3e3118){if(_0x3e3118){return db[_0xf0fd('0x1c')][_0xf0fd('0x1e')]({'ItemTypeId':_0x40cd2c,'description':_0x2ab55d,'OrderBy':_0xecbbf},{'where':{'CmContactId':_0x4c4b30,'item':_0x5598e1}})['then'](function(_0x1a7522){_0x347cf0({'res':_0xf0fd('0x1f')});});}else{return db[_0xf0fd('0x1c')][_0xf0fd('0x20')]({'CmContactId':_0x4c4b30,'item':_0x5598e1,'description':_0x2ab55d,'ItemTypeId':_0x40cd2c,'OrderBy':_0xecbbf,'ItemClass':_0xf0fd('0x21')})[_0xf0fd('0x15')](function(_0x2297ad){_0x347cf0({'res':'inserted'});});}});});}function insertCmHopper(_0x13efe9,_0x592b9,_0x469b82,_0x3dc74a,_0x3ac3ad){var _0x1ff0da=[_0xf0fd('0x22'),'cm_contacts.scheduledat',_0xf0fd('0x23'),'cm_contacts.ListId',_0x592b9+'.'+_0x3dc74a,_0xf0fd('0x24'),_0xf0fd('0x25'),_0xf0fd('0x26'),'cm_contacts.UserId','\x22'+_0x3ac3ad+'\x22'];return squel[_0xf0fd('0x27')]()[_0xf0fd('0x28')](_0xf0fd('0x29'))[_0xf0fd('0x2a')]([_0xf0fd('0xe'),_0xf0fd('0x2b'),_0xf0fd('0x2c'),_0xf0fd('0x2d'),_0x3dc74a,_0xf0fd('0x2e'),_0xf0fd('0x2f'),_0xf0fd('0x30'),_0xf0fd('0x31'),_0xf0fd('0x32')],squel['select']()[_0xf0fd('0x33')](_0x1ff0da)[_0xf0fd('0xf')](_0x592b9)[_0xf0fd('0x10')](_0xf0fd('0x34'),null,_0xf0fd('0x35')+_0x592b9+_0xf0fd('0x36'))[_0xf0fd('0x10')](_0x469b82,null,_0x469b82+_0xf0fd('0x11')+_0x592b9+'.'+_0x3dc74a)[_0xf0fd('0x12')](_0x592b9+_0xf0fd('0x37'),_0x13efe9)[_0xf0fd('0x12')](_0xf0fd('0x38'),NOW)[_0xf0fd('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x592b9,_0x469b82,_0x3dc74a,_0xf0fd('0x29'),['\x22always\x22','\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x592b9,_0x469b82,_0x3dc74a,_0xf0fd('0x29'),[_0xf0fd('0x39')])))[_0xf0fd('0x3a')]();}function insertCmHopperBlack(_0x4704ca,_0x1f5cd1,_0x4ddf19,_0x578f06){var _0x5dd6bf=['cm_contacts.phone',_0xf0fd('0x23'),'cm_contacts.ListId',_0x1f5cd1+'.'+_0x578f06,_0xf0fd('0x24'),_0xf0fd('0x25')];return squel[_0xf0fd('0x27')]()['into']('cm_hopper_black')[_0xf0fd('0x2a')]([_0xf0fd('0xe'),_0xf0fd('0x2c'),_0xf0fd('0x2d'),_0x578f06,_0xf0fd('0x2e'),_0xf0fd('0x2f')],squel[_0xf0fd('0xc')]()['fields'](_0x5dd6bf)[_0xf0fd('0xf')](_0x1f5cd1)[_0xf0fd('0x10')](_0xf0fd('0x34'),null,_0xf0fd('0x35')+_0x1f5cd1+_0xf0fd('0x36'))[_0xf0fd('0x10')](_0x4ddf19,null,_0x4ddf19+_0xf0fd('0x11')+_0x1f5cd1+'.'+_0x578f06)[_0xf0fd('0x12')](_0x1f5cd1+_0xf0fd('0x37'),_0x4704ca)[_0xf0fd('0x12')](_0xf0fd('0x38'),NOW)[_0xf0fd('0x12')](_0xf0fd('0x3b'),squel[_0xf0fd('0xc')]()[_0xf0fd('0xd')]('phone')[_0xf0fd('0xf')](_0xf0fd('0x3c'))[_0xf0fd('0x12')]('ListId\x20=\x20?',_0x4704ca)[_0xf0fd('0x12')](_0x578f06+_0xf0fd('0x3d')+_0x1f5cd1+'.'+_0x578f06)))['toString']();}function insertTzCmHopper(_0x68b0c6,_0x20d3b8,_0x5e7cdf,_0x3d72fc,_0x4ce1b3,_0x4d93ab){var _0x29cd11=['cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20'+_0x4d93ab+_0xf0fd('0x3e'),'cm_contacts.id','cm_contacts.ListId',_0x20d3b8+'.'+_0x3d72fc,_0xf0fd('0x24'),'cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','\x22'+_0x4ce1b3+'\x22'];var _0x5dfdae=squel[_0xf0fd('0x27')]()[_0xf0fd('0x28')](_0xf0fd('0x29'))[_0xf0fd('0x2a')](['phone',_0xf0fd('0x2b'),_0xf0fd('0x2c'),_0xf0fd('0x2d'),_0x3d72fc,'createdAt','updatedAt',_0xf0fd('0x30'),_0xf0fd('0x31'),_0xf0fd('0x32')],squel[_0xf0fd('0xc')]()[_0xf0fd('0x33')](_0x29cd11)['from'](_0x20d3b8)['join'](_0xf0fd('0x34'),null,'cm_contacts.ListId\x20=\x20'+_0x20d3b8+_0xf0fd('0x36'))[_0xf0fd('0x10')](_0x5e7cdf,null,_0x5e7cdf+'.id\x20=\x20'+_0x20d3b8+'.'+_0x3d72fc)[_0xf0fd('0x10')](_0x4d93ab,null,_0x4d93ab+'.id\x20=\x20'+_0x20d3b8+'.'+_0x3d72fc)[_0xf0fd('0x12')](_0x20d3b8+_0xf0fd('0x37'),_0x68b0c6)['where'](_0xf0fd('0x38'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x20d3b8,_0x5e7cdf,_0x3d72fc,_0xf0fd('0x29'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0xf0fd('0x12')](_0xf0fd('0x3b'),selectNotIn(_0x20d3b8,_0x5e7cdf,_0x3d72fc,_0xf0fd('0x29'),['\x22always\x22'])))[_0xf0fd('0x3a')]();return _0x5dfdae;}function insertTzCmHopperBlack(_0x4125a5,_0x5b4fc5,_0x52b751,_0x5676f8){var _0x12634a=[_0xf0fd('0x22'),_0xf0fd('0x23'),_0xf0fd('0x3f'),_0x5b4fc5+'.'+_0x5676f8,'cm_contacts.createdAt',_0xf0fd('0x25')];return squel['insert']()[_0xf0fd('0x28')](_0xf0fd('0x3c'))[_0xf0fd('0x2a')]([_0xf0fd('0xe'),_0xf0fd('0x2c'),'ListId',_0x5676f8,'createdAt','updatedAt'],squel[_0xf0fd('0xc')]()[_0xf0fd('0x33')](_0x12634a)[_0xf0fd('0xf')](_0x5b4fc5)[_0xf0fd('0x10')](_0xf0fd('0x34'),null,_0xf0fd('0x35')+_0x5b4fc5+_0xf0fd('0x36'))[_0xf0fd('0x10')](_0x52b751,null,_0x52b751+_0xf0fd('0x11')+_0x5b4fc5+'.'+_0x5676f8)[_0xf0fd('0x12')](_0x5b4fc5+'.CmListId\x20=\x20?',_0x4125a5)[_0xf0fd('0x12')](_0xf0fd('0x38'),NOW)[_0xf0fd('0x12')](_0xf0fd('0x3b'),squel[_0xf0fd('0xc')]()[_0xf0fd('0xd')](_0xf0fd('0xe'))[_0xf0fd('0xf')](_0xf0fd('0x3c'))[_0xf0fd('0x12')](_0xf0fd('0x40'),_0x4125a5)[_0xf0fd('0x12')](_0x5676f8+_0xf0fd('0x3d')+_0x5b4fc5+'.'+_0x5676f8)))[_0xf0fd('0x3a')]();}function insertCmHopperAdditionalPhones(_0x3d3d72){var _0x54fc82=[_0xf0fd('0x41'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0xf0fd('0x42')];return squel[_0xf0fd('0x27')]()['into'](_0xf0fd('0x43'))[_0xf0fd('0x2a')]([_0xf0fd('0x44'),_0xf0fd('0xe'),_0xf0fd('0x45'),'createdAt','updatedAt'],squel['select']()[_0xf0fd('0x33')](_0x54fc82)['from'](_0xf0fd('0x29'))['join'](_0xf0fd('0x34'),null,_0xf0fd('0x46'))['join'](_0xf0fd('0x47'),null,_0xf0fd('0x48'))[_0xf0fd('0x12')](_0xf0fd('0x49'),_0x3d3d72)['where'](_0xf0fd('0x38'),NOW))[_0xf0fd('0x3a')]();}function insertCmContact(_0x1ab388,_0xaa0d3d,_0x6d5c88,_0x1396d1){var _0x25822c=_[_0xf0fd('0x4a')](_[_0xf0fd('0x4b')](_0x1396d1),[_0xf0fd('0x2d'),'CompanyId','createdAt',_0xf0fd('0x2f')]);return squel['insert']()[_0xf0fd('0x28')](_0xf0fd('0x34'))[_0xf0fd('0x2a')](_0x25822c,squel[_0xf0fd('0xc')]()[_0xf0fd('0x33')](_0x25822c)[_0xf0fd('0xf')](_0xaa0d3d)['where']('('+_0x6d5c88['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xf0fd('0xc')]()[_0xf0fd('0x33')](_0x6d5c88)['from'](_0xf0fd('0x34'))['where'](_0xf0fd('0x40'),_0x1ab388)[_0xf0fd('0x12')]('deletedAt\x20IS\x20NULL'))[_0xf0fd('0x12')](_0xf0fd('0x4c'),squel['select']()[_0xf0fd('0xd')](_0xf0fd('0x4d'),'min_id')[_0xf0fd('0xf')](_0xaa0d3d)['group'](_0x6d5c88[_0xf0fd('0x10')](','))))['toString']();}function handleStop(){logger[_0xf0fd('0x4e')](_0xf0fd('0x4f'));stopped=!![];}function handleUncaughtException(_0x1066c8){logger[_0xf0fd('0x50')](_0x1066c8[_0xf0fd('0x51')]);process[_0xf0fd('0x52')](0x1);}function handleError(_0x27da01,_0x398f9d){stats[_0xf0fd('0x53')][_0xf0fd('0x17')]({'name':_0x398f9d['code'],'message':_0x398f9d[_0xf0fd('0x51')],'row':_0x27da01});}function handleQuery(_0x166955){logger[_0xf0fd('0x4e')](_0x166955);return db['sequelize'][_0xf0fd('0x54')](_0x166955)['spread'](function(_0x2c39fb){results[_0xf0fd('0x17')](_0x2c39fb);})[_0xf0fd('0x55')](function(_0x92ed6a){logger['error'](_0x92ed6a[_0xf0fd('0x51')]);});}function updateTzCampaigns(_0xa3443a){return new Promise(function(_0x547fe1,_0x1ebe94){var _0x350a50=squel[_0xf0fd('0xc')]()['fields']([_0xf0fd('0x56'),_0xf0fd('0x57')])[_0xf0fd('0xf')](_0xf0fd('0x58'))[_0xf0fd('0x10')](_0xf0fd('0x59'),null,_0xf0fd('0x5a'))[_0xf0fd('0x12')]('campaigns_has_cm_lists.CmListId='+_0xa3443a);db[_0xf0fd('0x5b')][_0xf0fd('0x54')](_0x350a50['toString']())[_0xf0fd('0x5c')](function(_0xd54038){var _0x3714d8=[];for(var _0x5efeef=0x0;_0x5efeef<_0xd54038[_0xf0fd('0x16')];_0x5efeef++){_0x3714d8['push'](getTimezoneData(_0xd54038[_0x5efeef],tmp_campaigns));}BPromise[_0xf0fd('0x19')](_0x3714d8)['then'](function(){_0x547fe1({'val':0x1});});})[_0xf0fd('0x55')](function(_0xf5ff08){logger[_0xf0fd('0x50')](_0xf5ff08[_0xf0fd('0x51')]);_0x547fe1({'val':0x0});});});}function updateTzVoiceQueues(_0x3c07c9){return new Promise(function(_0x1ff74a,_0x3c6a74){var _0x4c86ce=squel[_0xf0fd('0xc')]()[_0xf0fd('0x33')]([_0xf0fd('0x5d'),_0xf0fd('0x5e')])[_0xf0fd('0xf')]('voice_queues')[_0xf0fd('0x10')]('voice_queues_has_cm_lists',null,_0xf0fd('0x5f'))[_0xf0fd('0x12')](_0xf0fd('0x60')+_0x3c07c9);db[_0xf0fd('0x5b')][_0xf0fd('0x54')](_0x4c86ce['toString']())[_0xf0fd('0x5c')](function(_0x51321c){var _0x4d7d84=[];for(var _0x4c6289=0x0;_0x4c6289<_0x51321c[_0xf0fd('0x16')];_0x4c6289++){_0x4d7d84['push'](getTimezoneData(_0x51321c[_0x4c6289],tmp_voice_queues));}BPromise[_0xf0fd('0x19')](_0x4d7d84)[_0xf0fd('0x15')](function(){_0x1ff74a({'val':0x1});});})[_0xf0fd('0x55')](function(_0x532342){logger['error'](_0x532342[_0xf0fd('0x51')]);_0x1ff74a({'val':0x0});});});}function getTimezoneData(_0x3847c3,_0x562e80){return new Promise(function(_0x1d724a,_0x343158){var _0x4bffa0=shared[_0xf0fd('0x61')];var _0x5e9fb8=_0x4bffa0[_0x3847c3[_0xf0fd('0x62')]];if(_[_0xf0fd('0x1a')](_0x5e9fb8)){_0x1d724a({'ret':0x1});}else{var _0x42e93f=_0x5e9fb8[_0xf0fd('0x63')];var _0x2597b3=squel[_0xf0fd('0x27')]()[_0xf0fd('0x28')](_0x562e80)[_0xf0fd('0x64')]('id',_0x3847c3['id'])[_0xf0fd('0x64')](_0xf0fd('0x65'),_0x42e93f)[_0xf0fd('0x64')](_0xf0fd('0x62'),_0x3847c3[_0xf0fd('0x62')])['toString']();return db['sequelize'][_0xf0fd('0x54')](_0x2597b3)['spread'](function(_0x13a45c){_0x1d724a({'ret':0x1});})[_0xf0fd('0x55')](function(_0x4c8886){logger['error'](_0x4c8886['message']);_0x343158({'ret':0x1});});}});}function handleTZQuery(_0x726259){logger[_0xf0fd('0x4e')](_0x726259);return db['sequelize']['query'](_0x726259)[_0xf0fd('0x5c')](function(_0x49fb89){})[_0xf0fd('0x55')](function(_0x4e095a){logger[_0xf0fd('0x50')](_0x4e095a[_0xf0fd('0x51')]);});}function main(_0x1d3f3b,_0x3beb58,_0x5a4ba2,_0x363208){logger[_0xf0fd('0x4e')]('main',_0x1d3f3b,JSON[_0xf0fd('0x66')](_0x3beb58));process[_0xf0fd('0x67')](_0xf0fd('0x68'));var _0x5a9e17=_0x3beb58[_0xf0fd('0x69')];var _0xcca049=_[_0xf0fd('0x6a')](_0x5a9e17);var _0x1d2d78=_0x3beb58[_0xf0fd('0x6b')];var _0x5cbfdb=path[_0xf0fd('0x10')](config['root'],_0xf0fd('0x6c'),_0x1d2d78+_0xf0fd('0x6d'));hasTZ=_[_0xf0fd('0x4b')](_0x5a9e17)[_0xf0fd('0x6e')](_0xf0fd('0x62'));var _0x3a691a=_[_0xf0fd('0x4b')](_0x5a9e17)['join']();logger[_0xf0fd('0x4e')](_0xf0fd('0x6f'),_0x3a691a);db[_0xf0fd('0x70')]['findAll']({'raw':!![],'attributes':['id',_0xf0fd('0x71')]})[_0xf0fd('0x15')](function(_0x92016f){for(var _0x5578b6=0x0;_0x5578b6<_0x92016f[_0xf0fd('0x16')];_0x5578b6++){if(_0x92016f[_0x5578b6][_0xf0fd('0x71')]in _0x5a9e17){contactItemTypes['push'](_0x92016f[_0x5578b6]);delete _0xcca049[_0x92016f[_0x5578b6][_0xf0fd('0x71')]];hasAdditionalPhones=!![];}for(var _0x50ee0d in _0x5a9e17){if(_0x92016f[_0x5578b6][_0xf0fd('0x71')]+_0xf0fd('0x72')===_0x50ee0d){phoneDescriptions[_0xf0fd('0x17')]({'itemTypeId':_0x92016f[_0x5578b6]['id'],'description':_0x50ee0d});delete _0xcca049[_0x50ee0d];}}}if(hasAdditionalPhones)_0xcca049[_0xf0fd('0x14')]='';var _0x1eb5ca=_[_0xf0fd('0x4b')](_0xcca049)['join']();logger[_0xf0fd('0x4e')]('header',_0x1eb5ca);fs['writeFileSync'](_0x5cbfdb,_0x1eb5ca+'\x0a');Papa['parse'](fs[_0xf0fd('0x73')](_0x1d3f3b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x47775e,_0x3c9bd8){try{for(var _0x2a9f45=0x0,_0x10f40b=[];_0x2a9f45<_0x47775e['data'][_0xf0fd('0x16')];_0x2a9f45++){stats[_0xf0fd('0x74')]+=0x1;if(_0x47775e[_0xf0fd('0x53')][_0x2a9f45]){handleError(_0x47775e[_0xf0fd('0x75')][_0x2a9f45],_0x47775e[_0xf0fd('0x53')][_0x2a9f45]);}else{var _0x5ef740=[];var _0x5c1b83=[];var _0x27049f={};for(var _0x5e6513 in _0x5a9e17){let _0x5b84ae=contactItemTypes['find'](_0x24848b=>_0x24848b['name']===_0x5e6513);let _0x451240=contactItemTypes[_0xf0fd('0x76')](_0x330492=>_0x330492['name']+_0xf0fd('0x72')===_0x5e6513);if(_['isNil'](_0x5b84ae)&&_[_0xf0fd('0x1a')](_0x451240)){if(_0x5a9e17[_0xf0fd('0x77')](_0x5e6513)){if(_0x47775e['data'][_0x2a9f45][_0x5a9e17[_0x5e6513]]){var _0x235937=_[_0xf0fd('0x78')](_0x47775e[_0xf0fd('0x75')][_0x2a9f45][_0x5a9e17[_0x5e6513]][_0xf0fd('0x79')](/"/g,'\x27'));switch(_0x5e6513){case _0xf0fd('0x2b'):var _0x4d6288=moment(_0x235937,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x4d6288[_0xf0fd('0x7a')]()){_0x10f40b['push']('\x22'+_0x235937+'\x22');}else{_0x5ef740[_0xf0fd('0x17')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x29d2e4=parseInt(_0x235937);_0x235937=_[_0xf0fd('0x7b')](_0x29d2e4)||_0x29d2e4<0x0||_0x29d2e4>0x4?_0x363208?0x3:0x2:_0x29d2e4;_0x10f40b[_0xf0fd('0x17')]('\x22'+_0x235937+'\x22');break;case'UserId':var _0x443b69=parseInt(_0x235937);if(_['isNumber'](_0x443b69)&&_['includes'](_0x5a4ba2,_0x443b69)){_0x10f40b[_0xf0fd('0x17')]('\x22'+_0x443b69+'\x22');}else{_0x5ef740[_0xf0fd('0x17')](_0xf0fd('0x7c'));}break;case _0xf0fd('0x7d'):if(isEmail(_0x235937)){_0x10f40b[_0xf0fd('0x17')]('\x22'+_0x235937+'\x22');}else{_0x5ef740[_0xf0fd('0x17')](_0xf0fd('0x7e'));}break;case _0xf0fd('0x7f'):var _0x3a9a8c=moment(_0x235937,_0xf0fd('0x80'),!![]);if(_0x3a9a8c[_0xf0fd('0x7a')]()){_0x10f40b[_0xf0fd('0x17')]('\x22'+_0x235937+'\x22');}else{_0x5ef740[_0xf0fd('0x17')](_0xf0fd('0x81'));}break;case'dialTimezone':var _0x37101d=shared['timezones'];var _0x5367ad=_0x37101d[_0x235937];if(!_[_0xf0fd('0x1a')](_0x5367ad)){var _0x1c1700=_0x5367ad[_0xf0fd('0x63')];_0x10f40b['push']('\x22'+_0x235937+'\x22');_0x10f40b['push']('\x22'+_0x1c1700+'\x22');}break;default:_0x10f40b[_0xf0fd('0x17')]('\x22'+_0x235937+'\x22');}}else{switch(_0x5e6513){case _0xf0fd('0x82'):case _0xf0fd('0xe'):_0x5ef740[_0xf0fd('0x17')](_0x5e6513+'\x20not\x20specified');break;default:_0x10f40b['push']('\x22\x22');}}}}else{var _0x16fd6d='';if(!_['isNil'](_0x5b84ae)){if(!_0x27049f['hasOwnProperty'](_0x5b84ae['id'])){if(!_[_0xf0fd('0x1a')](_0x47775e[_0xf0fd('0x75')][_0x2a9f45][_0x5a9e17[_0x5e6513]])){var _0x235937=_[_0xf0fd('0x78')](_0x47775e[_0xf0fd('0x75')][_0x2a9f45][_0x5a9e17[_0x5e6513]][_0xf0fd('0x79')](/"/g,'\x27'));var _0x24a9be=phoneDescriptions[_0xf0fd('0x76')](_0x423d49=>_0x423d49[_0xf0fd('0x83')]===_0x5b84ae['id']);if(!_[_0xf0fd('0x1a')](_0x24a9be)){var _0x5b0e9e=_['trim'](_0x47775e[_0xf0fd('0x75')][_0x2a9f45][_0x5a9e17[_0x24a9be[_0xf0fd('0x84')]]][_0xf0fd('0x79')](/"/g,'\x27'));if(!_[_0xf0fd('0x1a')](_0x5b0e9e))_0x235937=_0x235937+'§'+_0x5b0e9e;}if(_0x16fd6d=='')_0x16fd6d=_0x235937;else _0x16fd6d+='|'+_0x235937;}_0x5c1b83[_0xf0fd('0x17')](_0x5b84ae['id']+':'+_0x16fd6d);_0x27049f[_0x5b84ae['id']]=0x1;}}}}if(hasAdditionalPhones){_0x10f40b[_0xf0fd('0x17')]('\x22'+_0x5c1b83[_0xf0fd('0x10')](';')+'\x22');}if(_0x5ef740['length']){handleError(_0x47775e[_0xf0fd('0x75')][_0x2a9f45],{'code':'SystemRow','message':_0x5ef740[_0xf0fd('0x10')]()});}else{fs[_0xf0fd('0x85')](_0x5cbfdb,_0x10f40b[_0xf0fd('0x10')]()+'\x0a');}_0x10f40b=[];}if(!(stats[_0xf0fd('0x74')]%0xc8)){socket['emit'](_0xf0fd('0x86')+_0x1d2d78,stats);stats[_0xf0fd('0x53')]=[];}}if(stopped){logger[_0xf0fd('0x4e')](_0xf0fd('0x87'));_0x3c9bd8[_0xf0fd('0x88')]();}}catch(_0x4d288f){handleError(_0x47775e['data'][_0x2a9f45],{'code':_0xf0fd('0x89'),'message':_0x4d288f[_0xf0fd('0x51')]});logger['error']('step',_0x4d288f[_0xf0fd('0x51')]);}},'complete':function(){try{var _0x1cbf4e=[];var _0x125fe9=[];var _0x4d325b=_0xf0fd('0x34');if(_0x3beb58['duplicates']&&_0x3beb58[_0xf0fd('0x8a')][_0xf0fd('0x16')]){_0x4d325b='cm_contacts_'+_0x1d2d78;_0x1cbf4e[_0xf0fd('0x17')](_0xf0fd('0x8b')+_0x4d325b+_0xf0fd('0x8c'));}tmp_campaigns=_0xf0fd('0x8d')+_0x1d2d78;tmp_voice_queues=_0xf0fd('0x8e')+_0x1d2d78;_0x125fe9[_0xf0fd('0x17')](_0xf0fd('0x8b')+tmp_campaigns+_0xf0fd('0x8f'));_0x125fe9[_0xf0fd('0x17')](_0xf0fd('0x8b')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise['each'](_0x125fe9,handleTZQuery)['then'](function(_0x55a25c){updateTzCampaigns(_0x3beb58[_0xf0fd('0x2d')])['then'](function(_0x30a52e){updateTzVoiceQueues(_0x3beb58[_0xf0fd('0x2d')])[_0xf0fd('0x15')](function(_0x43f14c){if(hasTZ)_0x1eb5ca=_0x1eb5ca[_0xf0fd('0x79')](_0xf0fd('0x62'),_0xf0fd('0x90'));var _0x2ddb29=util[_0xf0fd('0xa')](_0xf0fd('0x91'),_0x5cbfdb,_0x4d325b,_0x1eb5ca,_0x3beb58[_0xf0fd('0x2d')],_0x3beb58[_0xf0fd('0x92')]||null,NOW,NOW);if(_[_0xf0fd('0x1a')](_0x5a9e17[_0xf0fd('0x2b')])){_0x2ddb29+=',\x20scheduledAt\x20=\x20NOW()';}_0x1cbf4e['push'](_0x2ddb29);if(_0x3beb58[_0xf0fd('0x8a')]&&_0x3beb58[_0xf0fd('0x8a')][_0xf0fd('0x16')]){_0x1cbf4e['push'](insertCmContact(_0x3beb58[_0xf0fd('0x2d')],_0x4d325b,_0x3beb58['duplicates'],_0x5a9e17));_0x1cbf4e[_0xf0fd('0x17')](_0xf0fd('0x93')+_0x4d325b+';');}BPromise[_0xf0fd('0x94')](_0x1cbf4e,handleQuery)[_0xf0fd('0x15')](function(_0x23b5fe){BPromise[_0xf0fd('0x19')]([handleAdditionalPhones()])[_0xf0fd('0x15')](function(){_0x1cbf4e=[];for(var _0x18c215=0x0;_0x18c215\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','map','SIGINT','uncaughtException','path','papaparse','bluebird','moment','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','phone','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','spread','length','isNil','AdditionalPhones','push'];(function(_0x44fe9b,_0x260b8e){var _0x42e6c2=function(_0x3baa2d){while(--_0x3baa2d){_0x44fe9b['push'](_0x44fe9b['shift']());}};_0x42e6c2(++_0x260b8e);}(_0x62cf,0x81));var _0xf62c=function(_0x406c29,_0x1c0c63){_0x406c29=_0x406c29-0x0;var _0x2ad235=_0x62cf[_0x406c29];return _0x2ad235;};'use strict';var fs=require('fs');var path=require(_0xf62c('0x0'));var _=require('lodash');var Papa=require(_0xf62c('0x1'));var util=require('util');var BPromise=require(_0xf62c('0x2'));var moment=require(_0xf62c('0x3'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0xf62c('0x4'))['db'];var config=require(_0xf62c('0x5'));var logger=require(_0xf62c('0x6'))(_0xf62c('0x7'));config[_0xf62c('0x8')]=_[_0xf62c('0x9')](config[_0xf62c('0x8')],{'host':_0xf62c('0xa'),'port':0x18eb});var socket=require(_0xf62c('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xf62c('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xf62c('0xd')+moment()[_0xf62c('0xc')](_0xf62c('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x424bf6){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))*$/[_0xf62c('0xf')](_0x424bf6);}function selectNotIn(_0x250c8c,_0x336122,_0x1d52e9,_0x3b1b62,_0x9a583f){return squel[_0xf62c('0x10')]()['field'](_0xf62c('0x11'))['from'](_0x3b1b62)['join'](_0x336122,null,_0x336122+_0xf62c('0x12')+_0x3b1b62+'.'+_0x1d52e9)[_0xf62c('0x13')](_0x3b1b62+'.'+_0x1d52e9+'\x20=\x20'+_0x250c8c+'.'+_0x1d52e9)[_0xf62c('0x13')](_0x336122+_0xf62c('0x14')+_0x9a583f['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1c47fa,_0x4a5cba){promisesAdditionalPhones=[];promisesContact=[];return db[_0xf62c('0x15')][_0xf62c('0x16')]('select\x20*\x20from\x20'+tempTableName)[_0xf62c('0x17')](function(_0x3ffb03){if(_0x3ffb03!==null){var _0x55bba7=[];for(var _0x29aece=0x0;_0x29aece<_0x3ffb03[_0xf62c('0x18')];_0x29aece++){var _0x28acfb=_0x3ffb03[_0x29aece];if(!_['isNil'](_0x28acfb[_0xf62c('0x11')])){if(!_[_0xf62c('0x19')](_0x28acfb[_0xf62c('0x1a')]))_0x55bba7[_0xf62c('0x1b')](insertAdditionalPhones(_0x28acfb));promisesContact[_0xf62c('0x1b')]({'contact':_0x28acfb});}}}Promise['all'](_0x55bba7)[_0xf62c('0x1c')](function(){_0x1c47fa({'val':0x1});});})[_0xf62c('0x1d')](function(_0x359c25){logger['error'](_0x359c25['message']);});});}function insertAdditionalPhones(_0x3ae15e){return new Promise(function(_0x3c3624,_0x279439){var _0x14d2f5=_0x3ae15e[_0xf62c('0x1a')];if(_['isNil'](_0x14d2f5))_0x279439({'val':0x0});else{var _0x4dc634=_0x14d2f5['split'](';');var _0x11fda3=[];orderBy=0x0;for(var _0x1c883c=0x0;_0x1c883c<_0x4dc634[_0xf62c('0x18')];_0x1c883c++){_0x11fda3[_0xf62c('0x1b')](splitAdditionalPhone(_0x3ae15e['id'],_0x4dc634[_0x1c883c]));}Promise[_0xf62c('0x1e')](_0x11fda3)[_0xf62c('0x1c')](function(){_0x3c3624({'val':_0x4dc634['length']});});}});}function splitAdditionalPhone(_0x33b572,_0x120077){return new Promise(function(_0x424660,_0x53015c){var _0x4f22be=_0x120077['split'](':');var _0x496992=_0x4f22be[0x0];var _0x2165ae=_0x4f22be[0x1];if(_0x2165ae!==''){var _0x5c4e52=_0x2165ae[_0xf62c('0x1f')]('|');var _0x4973a8=[];for(var _0x2e2e54=0x0;_0x2e2e54<_0x5c4e52['length'];_0x2e2e54++){if(_0x5c4e52[_0x2e2e54]!==''){var _0x9da128=_[_0xf62c('0x20')](promisesAdditionalPhones,{'contactId':_0x33b572,'phone':_0x5c4e52[_0x2e2e54]});if(_0x9da128[_0xf62c('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0xf62c('0x1b')]({'contactId':_0x33b572,'contactTypeId':_0x496992,'phone':_0x5c4e52[_0x2e2e54],'orderBy':orderBy});}}}_0x424660({'ok':0x1});}else _0x424660({'res':0x0});});}function createAdditionalPhone(_0xbaa5a0,_0x4d00ab,_0x1ecd60,_0x1d441a){var _0x269222='';var _0x358036='';var _0x9dde25=_0x1ecd60[_0xf62c('0x1f')]('§');_0x269222=_0x9dde25[0x0];if(_0x9dde25[_0xf62c('0x18')]==0x2)_0x358036=_0x9dde25[0x1];return new Promise(function(_0x41b2c8,_0x19b820){return db[_0xf62c('0x21')]['findOne']({'where':{'CmContactId':_0xbaa5a0,'item':_0x269222}})[_0xf62c('0x1c')](function(_0x1aaeb9){if(_0x1aaeb9){return db['CmContactHasItem'][_0xf62c('0x22')]({'ItemTypeId':_0x4d00ab,'description':_0x358036,'OrderBy':_0x1d441a},{'where':{'CmContactId':_0xbaa5a0,'item':_0x269222}})['then'](function(_0x46aeba){_0x41b2c8({'res':_0xf62c('0x23')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0xbaa5a0,'item':_0x269222,'ItemTypeId':_0x4d00ab,'description':_0x358036,'OrderBy':_0x1d441a,'ItemClass':_0xf62c('0x24')})[_0xf62c('0x1c')](function(_0x5931c7){_0x41b2c8({'res':_0xf62c('0x25')});});}});});}function updateContact(_0x55921c){return new Promise(function(_0x396211,_0x127260){var _0x17ba4b=_0x55921c['id'];delete _0x55921c['id'];return db[_0xf62c('0x26')]['update'](_0x55921c,{'where':{'id':_0x17ba4b}})['then'](function(_0x3f6726){updatedRows+=0x1;return db['CmHopper'][_0xf62c('0x22')]({'phone':_0x55921c['phone']},{'where':{'ContactId':_0x17ba4b}})[_0xf62c('0x1c')](function(_0x18fb4f){_0x396211({'ret':'OK'});});});});}function insertCmHopper(_0x337fec,_0x440bdb,_0x5db4cb,_0x29ae19,_0x319447){var _0x1942db=[_0xf62c('0x27'),'cm_contacts.scheduledat',_0xf62c('0x28'),_0xf62c('0x29'),_0x440bdb+'.'+_0x29ae19,'cm_contacts.createdAt',_0xf62c('0x2a'),_0xf62c('0x2b'),_0xf62c('0x2c'),'\x22'+_0x319447+'\x22'];return squel[_0xf62c('0x2d')]()[_0xf62c('0x2e')](_0xf62c('0x2f'))[_0xf62c('0x30')]([_0xf62c('0x11'),_0xf62c('0x31'),_0xf62c('0x32'),_0xf62c('0x33'),_0x29ae19,_0xf62c('0x34'),_0xf62c('0x35'),_0xf62c('0x36'),_0xf62c('0x37'),_0xf62c('0x38')],squel[_0xf62c('0x10')]()[_0xf62c('0x39')](_0x1942db)[_0xf62c('0x3a')](_0x440bdb)[_0xf62c('0x3b')]('cm_contacts',null,_0xf62c('0x3c')+_0x440bdb+_0xf62c('0x3d'))[_0xf62c('0x3b')](_0x5db4cb,null,_0x5db4cb+_0xf62c('0x12')+_0x440bdb+'.'+_0x29ae19)['where'](_0x440bdb+_0xf62c('0x3e'),_0x337fec)[_0xf62c('0x13')](_0xf62c('0x3f'),NOW)[_0xf62c('0x13')](_0xf62c('0x40'),selectNotIn(_0x440bdb,_0x5db4cb,_0x29ae19,'cm_hopper',['\x22always\x22',_0xf62c('0x41')]))['where'](_0xf62c('0x40'),selectNotIn(_0x440bdb,_0x5db4cb,_0x29ae19,_0xf62c('0x2f'),[_0xf62c('0x42')])))['toString']();}function insertCmHopperBlack(_0x22f082,_0x35931b,_0x27218d,_0x3a550c){var _0x9b84ed=[_0xf62c('0x27'),'cm_contacts.id',_0xf62c('0x29'),_0x35931b+'.'+_0x3a550c,'cm_contacts.createdAt',_0xf62c('0x2a')];return squel[_0xf62c('0x2d')]()[_0xf62c('0x2e')](_0xf62c('0x43'))[_0xf62c('0x30')]([_0xf62c('0x11'),_0xf62c('0x32'),_0xf62c('0x33'),_0x3a550c,_0xf62c('0x34'),'updatedAt'],squel[_0xf62c('0x10')]()[_0xf62c('0x39')](_0x9b84ed)['from'](_0x35931b)['join'](_0xf62c('0x44'),null,'cm_contacts.ListId\x20=\x20'+_0x35931b+_0xf62c('0x3d'))[_0xf62c('0x3b')](_0x27218d,null,_0x27218d+'.id\x20=\x20'+_0x35931b+'.'+_0x3a550c)[_0xf62c('0x13')](_0x35931b+'.CmListId\x20=\x20?',_0x22f082)[_0xf62c('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xf62c('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xf62c('0x10')]()[_0xf62c('0x45')](_0xf62c('0x11'))[_0xf62c('0x3a')]('cm_hopper_black')[_0xf62c('0x13')](_0xf62c('0x46'),_0x22f082)[_0xf62c('0x13')](_0x3a550c+_0xf62c('0x47'),_0x35931b+'.'+_0x3a550c)))[_0xf62c('0x48')]();}function insertCmHopperAdditionalPhones(_0x55d473){var _0x1ea3a7=[_0xf62c('0x49'),_0xf62c('0x4a'),_0xf62c('0x4b'),_0xf62c('0x4c'),_0xf62c('0x4d')];return squel[_0xf62c('0x2d')]()[_0xf62c('0x2e')]('cm_hopper_additional_phones')[_0xf62c('0x30')]([_0xf62c('0x4e'),'phone',_0xf62c('0x4f'),'createdAt','updatedAt'],squel[_0xf62c('0x10')]()[_0xf62c('0x39')](_0x1ea3a7)['from'](_0xf62c('0x2f'))['join'](_0xf62c('0x44'),null,_0xf62c('0x50'))[_0xf62c('0x3b')](_0xf62c('0x51'),null,_0xf62c('0x52'))[_0xf62c('0x13')](_0xf62c('0x53'),_0x55d473)[_0xf62c('0x13')](_0xf62c('0x3f'),NOW))[_0xf62c('0x48')]();}function insertCmContact(_0xf04483,_0x127619,_0x15259c,_0x4fd2e8){var _0x247276=_[_0xf62c('0x54')](_[_0xf62c('0x55')](_0x4fd2e8),['ListId',_0xf62c('0x56'),_0xf62c('0x34'),_0xf62c('0x35')]);return squel['insert']()[_0xf62c('0x2e')]('cm_contacts')[_0xf62c('0x30')](_0x247276,squel['select']()[_0xf62c('0x39')](_0x247276)['from'](_0x127619)[_0xf62c('0x13')]('('+_0x15259c[_0xf62c('0x3b')](',')+_0xf62c('0x57'),squel['select']()['fields'](_0x15259c)[_0xf62c('0x3a')](_0xf62c('0x44'))[_0xf62c('0x13')](_0xf62c('0x46'),_0xf04483))[_0xf62c('0x13')](_0xf62c('0x58'),squel[_0xf62c('0x10')]()[_0xf62c('0x45')](_0xf62c('0x59'),_0xf62c('0x5a'))[_0xf62c('0x3a')](_0x127619)[_0xf62c('0x5b')](_0x15259c[_0xf62c('0x3b')](','))))[_0xf62c('0x48')]();}function handleStop(){logger[_0xf62c('0x5c')](_0xf62c('0x5d'));stopped=!![];}function handleUncaughtException(_0x4a6833){logger[_0xf62c('0x5e')](_0x4a6833['message']);process[_0xf62c('0x5f')](0x1);}function handleError(_0x44e0d3,_0x1ca4f4){stats[_0xf62c('0x60')][_0xf62c('0x1b')]({'name':_0x1ca4f4[_0xf62c('0x61')],'message':_0x1ca4f4[_0xf62c('0x62')],'row':_0x44e0d3});}function handleQuery(_0x101b1c){logger[_0xf62c('0x5c')](_0x101b1c);return db[_0xf62c('0x15')][_0xf62c('0x16')](_0x101b1c)[_0xf62c('0x17')](function(_0x4d20bf){results[_0xf62c('0x1b')](_0x4d20bf);})[_0xf62c('0x1d')](function(_0x4a59a0){logger[_0xf62c('0x5e')](_0x4a59a0[_0xf62c('0x62')]);});}function main(_0x919e3,_0x4a2067,_0xfb3fa6,_0x568a0c){logger[_0xf62c('0x5c')](_0xf62c('0x63'),_0x919e3,JSON['stringify'](_0x4a2067));process['send'](_0xf62c('0x64'));var _0x16bcac=_0x4a2067[_0xf62c('0x65')];var _0x5ebc7e=_['clone'](_0x16bcac);var _0x50a518=_0x4a2067[_0xf62c('0x66')];var _0x51568e=path[_0xf62c('0x3b')](config[_0xf62c('0x67')],_0xf62c('0x68'),_0x50a518+_0xf62c('0x69'));logger[_0xf62c('0x5c')](_0xf62c('0x6a'),_0x4a2067);db[_0xf62c('0x6b')][_0xf62c('0x6c')]({'raw':!![],'attributes':['id',_0xf62c('0x6d')]})[_0xf62c('0x1c')](function(_0x1b0a9c){for(var _0x4ba340=0x0;_0x4ba340<_0x1b0a9c[_0xf62c('0x18')];_0x4ba340++){if(_0x1b0a9c[_0x4ba340][_0xf62c('0x6d')]in _0x16bcac){contactItemTypes[_0xf62c('0x1b')](_0x1b0a9c[_0x4ba340]);delete _0x5ebc7e[_0x1b0a9c[_0x4ba340][_0xf62c('0x6d')]];hasAdditionalPhones=!![];}for(var _0x3f28fb in _0x16bcac){if(_0x1b0a9c[_0x4ba340]['name']+'_description'===_0x3f28fb){phoneDescriptions[_0xf62c('0x1b')]({'itemTypeId':_0x1b0a9c[_0x4ba340]['id'],'description':_0x3f28fb});delete _0x5ebc7e[_0x3f28fb];}}}if(hasAdditionalPhones)_0x5ebc7e['AdditionalPhones']='';var _0x3a59f7=_['keys'](_0x5ebc7e)[_0xf62c('0x3b')]();logger[_0xf62c('0x5c')]('header',_0x3a59f7);fs['writeFileSync'](_0x51568e,_0x3a59f7+'\x0a');Papa[_0xf62c('0x6e')](fs[_0xf62c('0x6f')](_0x919e3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x30f424,_0x2e2c7e){try{for(var _0x4bd40b=0x0,_0x195d0c=[];_0x4bd40b<_0x30f424[_0xf62c('0x70')][_0xf62c('0x18')];_0x4bd40b++){stats[_0xf62c('0x71')]+=0x1;if(_0x30f424['errors'][_0x4bd40b]){handleError(_0x30f424['data'][_0x4bd40b],_0x30f424[_0xf62c('0x60')][_0x4bd40b]);}else{var _0x17ae5d=[];var _0x476ddc=[];var _0x4ea745={};for(var _0xc7df2c in _0x16bcac){let _0x4b8d5d=contactItemTypes[_0xf62c('0x72')](_0x2e45a3=>_0x2e45a3['name']===_0xc7df2c);let _0x1e70a0=contactItemTypes[_0xf62c('0x72')](_0x27a9cf=>_0x27a9cf['name']+_0xf62c('0x73')===_0xc7df2c);if(_[_0xf62c('0x19')](_0x4b8d5d)&&_[_0xf62c('0x19')](_0x1e70a0)){if(_0x16bcac['hasOwnProperty'](_0xc7df2c)){if(_0x30f424[_0xf62c('0x70')][_0x4bd40b][_0x16bcac[_0xc7df2c]]){var _0x66d980=_[_0xf62c('0x74')](_0x30f424['data'][_0x4bd40b][_0x16bcac[_0xc7df2c]][_0xf62c('0x75')](/"/g,'\x27'));switch(_0xc7df2c){case _0xf62c('0x31'):var _0xcd46d2=moment(_0x66d980,_0xf62c('0x76'),!![]);if(_0xcd46d2[_0xf62c('0x77')]()){_0x195d0c[_0xf62c('0x1b')]('\x22'+_0x66d980+'\x22');}else{_0x17ae5d[_0xf62c('0x1b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x44af47=parseInt(_0x66d980);_0x66d980=_[_0xf62c('0x78')](_0x44af47)||_0x44af47<0x0||_0x44af47>0x4?_0x568a0c?0x3:0x2:_0x44af47;_0x195d0c[_0xf62c('0x1b')]('\x22'+_0x66d980+'\x22');break;case _0xf62c('0x37'):var _0x14ef34=parseInt(_0x66d980);if(_[_0xf62c('0x79')](_0x14ef34)&&_['includes'](_0xfb3fa6,_0x14ef34)){_0x195d0c[_0xf62c('0x1b')]('\x22'+_0x14ef34+'\x22');}else{_0x17ae5d[_0xf62c('0x1b')](_0xf62c('0x7a'));}break;case'email':if(isEmail(_0x66d980)){_0x195d0c[_0xf62c('0x1b')]('\x22'+_0x66d980+'\x22');}else{_0x17ae5d[_0xf62c('0x1b')](_0xf62c('0x7b'));}break;case _0xf62c('0x7c'):var _0x5a61cc=moment(_0x66d980,'YYYY-MM-DD',!![]);if(_0x5a61cc[_0xf62c('0x77')]()){_0x195d0c[_0xf62c('0x1b')]('\x22'+_0x66d980+'\x22');}else{_0x17ae5d[_0xf62c('0x1b')](_0xf62c('0x7d'));}break;default:_0x195d0c['push']('\x22'+_0x66d980+'\x22');}}else{switch(_0xc7df2c){case _0xf62c('0x7e'):case _0xf62c('0x11'):_0x17ae5d[_0xf62c('0x1b')](_0xc7df2c+_0xf62c('0x7f'));break;default:_0x195d0c[_0xf62c('0x1b')]('\x22\x22');}}}}else{var _0x5f37db='';if(!_[_0xf62c('0x19')](_0x4b8d5d)){if(!_0x4ea745['hasOwnProperty'](_0x4b8d5d['id'])){for(var _0xf8982c=0x0;_0xf8982c<_0x16bcac[_0xc7df2c][_0xf62c('0x18')];_0xf8982c++){var _0x66d980=_[_0xf62c('0x74')](_0x30f424[_0xf62c('0x70')][_0x4bd40b][_0x16bcac[_0xc7df2c][_0xf8982c]][_0xf62c('0x75')](/"/g,'\x27'));var _0x57a872=phoneDescriptions[_0xf62c('0x72')](_0x53c67f=>_0x53c67f[_0xf62c('0x80')]===_0x4b8d5d['id']);if(!_[_0xf62c('0x19')](_0x57a872)){var _0x484845=_['trim'](_0x30f424['data'][_0x4bd40b][_0x16bcac[_0x57a872[_0xf62c('0x81')]][0x0]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x484845))_0x66d980=_0x66d980+'§'+_0x484845;}if(_0x5f37db=='')_0x5f37db=_0x66d980;else _0x5f37db+='|'+_0x66d980;}_0x476ddc[_0xf62c('0x1b')](_0x4b8d5d['id']+':'+_0x5f37db);_0x4ea745[_0x4b8d5d['id']]=0x1;}}}}if(hasAdditionalPhones){_0x195d0c[_0xf62c('0x1b')]('\x22'+_0x476ddc['join'](';')+'\x22');}if(_0x17ae5d[_0xf62c('0x18')]){handleError(_0x30f424[_0xf62c('0x70')][_0x4bd40b],{'code':_0xf62c('0x82'),'message':_0x17ae5d[_0xf62c('0x3b')]()});}else{fs[_0xf62c('0x83')](_0x51568e,_0x195d0c[_0xf62c('0x3b')]()+'\x0a');}_0x195d0c=[];}if(!(stats['rows']%0xc8)){socket[_0xf62c('0x84')]('contact:import:'+_0x50a518,stats);stats[_0xf62c('0x60')]=[];}}if(stopped){logger[_0xf62c('0x5c')]('Abort\x20parser');_0x2e2c7e[_0xf62c('0x85')]();}}catch(_0x4d41a6){handleError(_0x30f424[_0xf62c('0x70')][_0x4bd40b],{'code':_0xf62c('0x86'),'message':_0x4d41a6[_0xf62c('0x62')]});logger[_0xf62c('0x5e')]('step',_0x4d41a6['message']);}},'complete':function(){try{var _0x2a8290=[];var _0x306c71=tempTableName;_0x2a8290[_0xf62c('0x1b')](_0xf62c('0x87')+_0x306c71+_0xf62c('0x88'));logger[_0xf62c('0x5c')](_0xf62c('0x89'),contactItemTypes[_0xf62c('0x18')]);var _0x2bc2d3=util[_0xf62c('0xc')](_0xf62c('0x8a'),_0x51568e,_0x306c71,_0x3a59f7,_0x4a2067[_0xf62c('0x33')],_0x4a2067[_0xf62c('0x56')]||null,NOW,NOW);if(_[_0xf62c('0x19')](_0x16bcac[_0xf62c('0x31')])){_0x2bc2d3+=_0xf62c('0x8b');}_0x2a8290['push'](_0x2bc2d3);BPromise[_0xf62c('0x8c')](_0x2a8290,handleQuery)[_0xf62c('0x1c')](function(_0x32a4df){BPromise[_0xf62c('0x1e')]([handleAdditionalPhones()])['then'](function(){_0x2a8290=[];for(var _0x1fb126=0x0;_0x1fb126\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss'];(function(_0x4e7f3f,_0x5c57da){var _0x441fd2=function(_0x177c74){while(--_0x177c74){_0x4e7f3f['push'](_0x4e7f3f['shift']());}};_0x441fd2(++_0x5c57da);}(_0x6a47,0x84));var _0x76a4=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x6a47[_0x413feb];return _0x40ee88;};'use strict';var fs=require('fs');var path=require(_0x76a4('0x0'));var _=require(_0x76a4('0x1'));var Papa=require(_0x76a4('0x2'));var util=require(_0x76a4('0x3'));var BPromise=require(_0x76a4('0x4'));var moment=require(_0x76a4('0x5'));var squel=require(_0x76a4('0x6'));var Redis=require('ioredis');var db=require(_0x76a4('0x7'))['db'];var config=require(_0x76a4('0x8'));var logger=require(_0x76a4('0x9'))(_0x76a4('0xa'));config[_0x76a4('0xb')]=_[_0x76a4('0xc')](config['redis'],{'host':_0x76a4('0xd'),'port':0x18eb});var socket=require(_0x76a4('0xe'))(new Redis(config[_0x76a4('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x76a4('0xf')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x76a4('0x10')+moment()[_0x76a4('0xf')](_0x76a4('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0xe3900b){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))*$/[_0x76a4('0x12')](_0xe3900b);}function selectNotIn(_0x4e4e63,_0x9290cb,_0x18d994,_0x2e5966,_0x194c94){return squel[_0x76a4('0x13')]()[_0x76a4('0x14')](_0x76a4('0x15'))[_0x76a4('0x16')](_0x2e5966)[_0x76a4('0x17')](_0x9290cb,null,_0x9290cb+'.id\x20=\x20'+_0x2e5966+'.'+_0x18d994)[_0x76a4('0x18')](_0x2e5966+'.'+_0x18d994+_0x76a4('0x19')+_0x4e4e63+'.'+_0x18d994)[_0x76a4('0x18')](_0x9290cb+_0x76a4('0x1a')+_0x194c94['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x169211,_0x362211){promisesAdditionalPhones=[];promisesContact=[];return db[_0x76a4('0x1b')][_0x76a4('0x1c')](_0x76a4('0x1d')+tempTableName)[_0x76a4('0x1e')](function(_0x25e50c){if(_0x25e50c!==null){var _0x11b558=[];for(var _0xec4933=0x0;_0xec4933<_0x25e50c[_0x76a4('0x1f')];_0xec4933++){var _0x28bf86=_0x25e50c[_0xec4933];if(!_[_0x76a4('0x20')](_0x28bf86[_0x76a4('0x15')])){if(!_[_0x76a4('0x20')](_0x28bf86[_0x76a4('0x21')]))_0x11b558['push'](insertAdditionalPhones(_0x28bf86));promisesContact[_0x76a4('0x22')]({'contact':_0x28bf86});}}}Promise[_0x76a4('0x23')](_0x11b558)[_0x76a4('0x24')](function(){_0x169211({'val':0x1});});})[_0x76a4('0x25')](function(_0x3b7293){logger['error'](_0x3b7293['message']);});});}function insertAdditionalPhones(_0x506266){return new Promise(function(_0x3ee68e,_0x11e806){var _0x1ac9dc=_0x506266[_0x76a4('0x21')];if(_[_0x76a4('0x20')](_0x1ac9dc))_0x11e806({'val':0x0});else{var _0x15eeb6=_0x1ac9dc['split'](';');var _0x246d81=[];orderBy=0x0;for(var _0x34dd31=0x0;_0x34dd31<_0x15eeb6[_0x76a4('0x1f')];_0x34dd31++){_0x246d81[_0x76a4('0x22')](splitAdditionalPhone(_0x506266['id'],_0x15eeb6[_0x34dd31]));}Promise['all'](_0x246d81)[_0x76a4('0x24')](function(){_0x3ee68e({'val':_0x15eeb6[_0x76a4('0x1f')]});});}});}function splitAdditionalPhone(_0x4b9bfa,_0x423c4c){return new Promise(function(_0x31eed1,_0x16783b){var _0x466b54=_0x423c4c[_0x76a4('0x26')](':');var _0x2ccc18=_0x466b54[0x0];var _0x1481ba=_0x466b54[0x1];if(_0x1481ba!==''){var _0x499928=_0x1481ba[_0x76a4('0x26')]('|');var _0x1ce821=[];for(var _0x145f2c=0x0;_0x145f2c<_0x499928[_0x76a4('0x1f')];_0x145f2c++){if(_0x499928[_0x145f2c]!==''){var _0x1aaf5b=_[_0x76a4('0x27')](promisesAdditionalPhones,{'contactId':_0x4b9bfa,'phone':_0x499928[_0x145f2c]});if(_0x1aaf5b[_0x76a4('0x1f')]==0x0){orderBy++;promisesAdditionalPhones[_0x76a4('0x22')]({'contactId':_0x4b9bfa,'contactTypeId':_0x2ccc18,'phone':_0x499928[_0x145f2c],'orderBy':orderBy});}}}_0x31eed1({'ok':0x1});}else _0x31eed1({'res':0x0});});}function createAdditionalPhone(_0x430e4a,_0x5bb5b1,_0x59c759,_0x16f343){var _0x1d36dc='';var _0x4c0230='';var _0x1e7cf0=_0x59c759[_0x76a4('0x26')]('§');_0x1d36dc=_0x1e7cf0[0x0];if(_0x1e7cf0[_0x76a4('0x1f')]==0x2)_0x4c0230=_0x1e7cf0[0x1];return new Promise(function(_0xedf944,_0x5425ff){return db[_0x76a4('0x28')][_0x76a4('0x29')]({'where':{'CmContactId':_0x430e4a,'item':_0x1d36dc}})[_0x76a4('0x24')](function(_0x1c7361){if(_0x1c7361){return db[_0x76a4('0x28')][_0x76a4('0x2a')]({'ItemTypeId':_0x5bb5b1,'description':_0x4c0230,'OrderBy':_0x16f343},{'where':{'CmContactId':_0x430e4a,'item':_0x1d36dc}})[_0x76a4('0x24')](function(_0x357a7d){_0xedf944({'res':'updated'});});}else{return db[_0x76a4('0x28')][_0x76a4('0x2b')]({'CmContactId':_0x430e4a,'item':_0x1d36dc,'ItemTypeId':_0x5bb5b1,'description':_0x4c0230,'OrderBy':_0x16f343,'ItemClass':_0x76a4('0x2c')})[_0x76a4('0x24')](function(_0x4c2971){_0xedf944({'res':_0x76a4('0x2d')});});}});});}function updateContact(_0x4dd10d){return new Promise(function(_0x26526b,_0x2257da){var _0x507042=_0x4dd10d['id'];delete _0x4dd10d['id'];return db['CmContact'][_0x76a4('0x2a')](_0x4dd10d,{'where':{'id':_0x507042}})[_0x76a4('0x24')](function(_0x3839d8){updatedRows+=0x1;return db['CmHopper'][_0x76a4('0x2a')]({'phone':_0x4dd10d[_0x76a4('0x15')]},{'where':{'ContactId':_0x507042}})['then'](function(_0x3989e1){_0x26526b({'ret':'OK'});});});});}function insertCmHopper(_0x28327f,_0xd92bf9,_0x43321a,_0x40db80,_0x78d815){var _0x513a77=[_0x76a4('0x2e'),'cm_contacts.scheduledat',_0x76a4('0x2f'),_0x76a4('0x30'),_0xd92bf9+'.'+_0x40db80,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x76a4('0x31'),_0x76a4('0x32'),'\x22'+_0x78d815+'\x22'];return squel['insert']()[_0x76a4('0x33')](_0x76a4('0x34'))[_0x76a4('0x35')]([_0x76a4('0x15'),'scheduledat','ContactId',_0x76a4('0x36'),_0x40db80,_0x76a4('0x37'),'updatedAt',_0x76a4('0x38'),_0x76a4('0x39'),'recallme'],squel[_0x76a4('0x13')]()[_0x76a4('0x3a')](_0x513a77)[_0x76a4('0x16')](_0xd92bf9)['join'](_0x76a4('0x3b'),null,_0x76a4('0x3c')+_0xd92bf9+_0x76a4('0x3d'))[_0x76a4('0x17')](_0x43321a,null,_0x43321a+_0x76a4('0x3e')+_0xd92bf9+'.'+_0x40db80)[_0x76a4('0x18')](_0xd92bf9+_0x76a4('0x3f'),_0x28327f)[_0x76a4('0x18')](_0x76a4('0x40'),NOW)[_0x76a4('0x18')](_0x76a4('0x41'),selectNotIn(_0xd92bf9,_0x43321a,_0x40db80,_0x76a4('0x34'),[_0x76a4('0x42'),'\x22onlyIfOpen\x22']))[_0x76a4('0x18')](_0x76a4('0x41'),selectNotIn(_0xd92bf9,_0x43321a,_0x40db80,_0x76a4('0x34'),[_0x76a4('0x42')])))[_0x76a4('0x43')]();}function insertCmHopperBlack(_0x5907d5,_0x350676,_0x57b15f,_0x43de80){var _0x18070d=[_0x76a4('0x2e'),'cm_contacts.id',_0x76a4('0x30'),_0x350676+'.'+_0x43de80,_0x76a4('0x44'),_0x76a4('0x45')];return squel[_0x76a4('0x46')]()['into'](_0x76a4('0x47'))[_0x76a4('0x35')](['phone',_0x76a4('0x48'),_0x76a4('0x36'),_0x43de80,_0x76a4('0x37'),_0x76a4('0x49')],squel[_0x76a4('0x13')]()['fields'](_0x18070d)[_0x76a4('0x16')](_0x350676)['join'](_0x76a4('0x3b'),null,_0x76a4('0x3c')+_0x350676+_0x76a4('0x3d'))['join'](_0x57b15f,null,_0x57b15f+_0x76a4('0x3e')+_0x350676+'.'+_0x43de80)[_0x76a4('0x18')](_0x350676+'.CmListId\x20=\x20?',_0x5907d5)[_0x76a4('0x18')](_0x76a4('0x40'),NOW)[_0x76a4('0x18')](_0x76a4('0x41'),squel[_0x76a4('0x13')]()['field'](_0x76a4('0x15'))[_0x76a4('0x16')](_0x76a4('0x47'))[_0x76a4('0x18')](_0x76a4('0x4a'),_0x5907d5)[_0x76a4('0x18')](_0x43de80+_0x76a4('0x4b'),_0x350676+'.'+_0x43de80)))[_0x76a4('0x43')]();}function insertCmHopperAdditionalPhones(_0x5c663a){var _0x4d3346=['cm_hopper.id',_0x76a4('0x4c'),_0x76a4('0x4d'),'cm_contact_has_items.createdAt',_0x76a4('0x4e')];return squel[_0x76a4('0x46')]()[_0x76a4('0x33')](_0x76a4('0x4f'))[_0x76a4('0x35')]([_0x76a4('0x50'),'phone','OrderBy','createdAt',_0x76a4('0x49')],squel['select']()[_0x76a4('0x3a')](_0x4d3346)[_0x76a4('0x16')](_0x76a4('0x34'))['join'](_0x76a4('0x3b'),null,_0x76a4('0x51'))[_0x76a4('0x17')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x76a4('0x18')](_0x76a4('0x52'),_0x5c663a)[_0x76a4('0x18')](_0x76a4('0x40'),NOW))[_0x76a4('0x43')]();}function insertCmContact(_0x4ff075,_0x41dd9c,_0x3d4c10,_0x210fd7){var _0x42f3e7=_['concat'](_[_0x76a4('0x53')](_0x210fd7),[_0x76a4('0x36'),'CompanyId',_0x76a4('0x37'),'updatedAt']);return squel[_0x76a4('0x46')]()[_0x76a4('0x33')](_0x76a4('0x3b'))[_0x76a4('0x35')](_0x42f3e7,squel[_0x76a4('0x13')]()['fields'](_0x42f3e7)[_0x76a4('0x16')](_0x41dd9c)[_0x76a4('0x18')]('('+_0x3d4c10[_0x76a4('0x17')](',')+_0x76a4('0x54'),squel[_0x76a4('0x13')]()[_0x76a4('0x3a')](_0x3d4c10)[_0x76a4('0x16')](_0x76a4('0x3b'))['where'](_0x76a4('0x4a'),_0x4ff075))['where'](_0x76a4('0x55'),squel['select']()[_0x76a4('0x14')](_0x76a4('0x56'),_0x76a4('0x57'))[_0x76a4('0x16')](_0x41dd9c)['group'](_0x3d4c10['join'](','))))[_0x76a4('0x43')]();}function handleStop(){logger[_0x76a4('0x58')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x1bbb46){logger[_0x76a4('0x59')](_0x1bbb46[_0x76a4('0x5a')]);process[_0x76a4('0x5b')](0x1);}function handleError(_0x16623c,_0x39ac31){stats[_0x76a4('0x5c')][_0x76a4('0x22')]({'name':_0x39ac31['code'],'message':_0x39ac31[_0x76a4('0x5a')],'row':_0x16623c});}function handleQuery(_0x1a5761){logger[_0x76a4('0x58')](_0x1a5761);return db['sequelize'][_0x76a4('0x1c')](_0x1a5761)['spread'](function(_0x230cd2){results[_0x76a4('0x22')](_0x230cd2);})[_0x76a4('0x25')](function(_0xe12040){logger['error'](_0xe12040[_0x76a4('0x5a')]);});}function main(_0x57ba53,_0x8a3322,_0x5ab84f,_0x1f2d8e){logger[_0x76a4('0x58')]('main',_0x57ba53,JSON[_0x76a4('0x5d')](_0x8a3322));process[_0x76a4('0x5e')](_0x76a4('0x5f'));var _0x2eb926=_0x8a3322[_0x76a4('0x60')];var _0x57cc1e=_['clone'](_0x2eb926);var _0x1f21d0=_0x8a3322[_0x76a4('0x61')];var _0x58e1a2=path[_0x76a4('0x17')](config[_0x76a4('0x62')],_0x76a4('0x63'),_0x1f21d0+_0x76a4('0x64'));logger[_0x76a4('0x58')](_0x76a4('0x65'),_0x8a3322);db['ContactItemType'][_0x76a4('0x66')]({'raw':!![],'attributes':['id',_0x76a4('0x67')]})[_0x76a4('0x24')](function(_0x3ad699){for(var _0x58cae5=0x0;_0x58cae5<_0x3ad699[_0x76a4('0x1f')];_0x58cae5++){if(_0x3ad699[_0x58cae5][_0x76a4('0x67')]in _0x2eb926){contactItemTypes[_0x76a4('0x22')](_0x3ad699[_0x58cae5]);delete _0x57cc1e[_0x3ad699[_0x58cae5][_0x76a4('0x67')]];hasAdditionalPhones=!![];}for(var _0x40798a in _0x2eb926){if(_0x3ad699[_0x58cae5]['name']+'_description'===_0x40798a){phoneDescriptions['push']({'itemTypeId':_0x3ad699[_0x58cae5]['id'],'description':_0x40798a});delete _0x57cc1e[_0x40798a];}}}if(hasAdditionalPhones)_0x57cc1e[_0x76a4('0x21')]='';var _0x2f9d4f=_[_0x76a4('0x53')](_0x57cc1e)[_0x76a4('0x17')]();logger['info'](_0x76a4('0x68'),_0x2f9d4f);fs[_0x76a4('0x69')](_0x58e1a2,_0x2f9d4f+'\x0a');Papa[_0x76a4('0x6a')](fs['createReadStream'](_0x57ba53),{'header':!![],'skipEmptyLines':!![],'step':function(_0x446854,_0x1522e4){try{for(var _0x35cd76=0x0,_0x5033c5=[];_0x35cd76<_0x446854[_0x76a4('0x6b')]['length'];_0x35cd76++){stats['rows']+=0x1;if(_0x446854[_0x76a4('0x5c')][_0x35cd76]){handleError(_0x446854[_0x76a4('0x6b')][_0x35cd76],_0x446854[_0x76a4('0x5c')][_0x35cd76]);}else{var _0x185070=[];var _0x49981f=[];var _0x15aceb={};for(var _0x5efc5c in _0x2eb926){let _0x3e8b07=contactItemTypes[_0x76a4('0x6c')](_0x36bcaa=>_0x36bcaa[_0x76a4('0x67')]===_0x5efc5c);let _0x47a705=contactItemTypes[_0x76a4('0x6c')](_0x50ad0d=>_0x50ad0d[_0x76a4('0x67')]+_0x76a4('0x6d')===_0x5efc5c);if(_['isNil'](_0x3e8b07)&&_['isNil'](_0x47a705)){if(_0x2eb926[_0x76a4('0x6e')](_0x5efc5c)){if(_0x446854[_0x76a4('0x6b')][_0x35cd76][_0x2eb926[_0x5efc5c]]){var _0x5860e5=_[_0x76a4('0x6f')](_0x446854[_0x76a4('0x6b')][_0x35cd76][_0x2eb926[_0x5efc5c]]['replace'](/"/g,'\x27'));switch(_0x5efc5c){case _0x76a4('0x70'):var _0x88dcfd=moment(_0x5860e5,_0x76a4('0x71'),!![]);if(_0x88dcfd['isValid']()){_0x5033c5[_0x76a4('0x22')]('\x22'+_0x5860e5+'\x22');}else{_0x185070[_0x76a4('0x22')](_0x76a4('0x72'));}break;case _0x76a4('0x38'):var _0xe3ec34=parseInt(_0x5860e5);_0x5860e5=_[_0x76a4('0x73')](_0xe3ec34)||_0xe3ec34<0x0||_0xe3ec34>0x4?_0x1f2d8e?0x3:0x2:_0xe3ec34;_0x5033c5[_0x76a4('0x22')]('\x22'+_0x5860e5+'\x22');break;case'UserId':var _0x20f7a1=parseInt(_0x5860e5);if(_[_0x76a4('0x74')](_0x20f7a1)&&_['includes'](_0x5ab84f,_0x20f7a1)){_0x5033c5[_0x76a4('0x22')]('\x22'+_0x20f7a1+'\x22');}else{_0x185070[_0x76a4('0x22')](_0x76a4('0x75'));}break;case _0x76a4('0x76'):if(isEmail(_0x5860e5)){_0x5033c5[_0x76a4('0x22')]('\x22'+_0x5860e5+'\x22');}else{_0x185070['push'](_0x76a4('0x77'));}break;case _0x76a4('0x78'):var _0x4f29ab=moment(_0x5860e5,'YYYY-MM-DD',!![]);if(_0x4f29ab[_0x76a4('0x79')]()){_0x5033c5[_0x76a4('0x22')]('\x22'+_0x5860e5+'\x22');}else{_0x185070[_0x76a4('0x22')](_0x76a4('0x7a'));}break;default:_0x5033c5[_0x76a4('0x22')]('\x22'+_0x5860e5+'\x22');}}else{switch(_0x5efc5c){case _0x76a4('0x7b'):case _0x76a4('0x15'):_0x185070[_0x76a4('0x22')](_0x5efc5c+_0x76a4('0x7c'));break;default:_0x5033c5[_0x76a4('0x22')]('\x22\x22');}}}}else{var _0x2404c7='';if(!_['isNil'](_0x3e8b07)){if(!_0x15aceb[_0x76a4('0x6e')](_0x3e8b07['id'])){for(var _0x5b6689=0x0;_0x5b6689<_0x2eb926[_0x5efc5c]['length'];_0x5b6689++){var _0x5860e5=_['trim'](_0x446854['data'][_0x35cd76][_0x2eb926[_0x5efc5c][_0x5b6689]][_0x76a4('0x7d')](/"/g,'\x27'));var _0x53c9be=phoneDescriptions[_0x76a4('0x6c')](_0x192f32=>_0x192f32[_0x76a4('0x7e')]===_0x3e8b07['id']);if(!_[_0x76a4('0x20')](_0x53c9be)){var _0x1fe333=_[_0x76a4('0x6f')](_0x446854['data'][_0x35cd76][_0x2eb926[_0x53c9be['description']][0x0]][_0x76a4('0x7d')](/"/g,'\x27'));if(!_['isNil'](_0x1fe333))_0x5860e5=_0x5860e5+'§'+_0x1fe333;}if(_0x2404c7=='')_0x2404c7=_0x5860e5;else _0x2404c7+='|'+_0x5860e5;}_0x49981f[_0x76a4('0x22')](_0x3e8b07['id']+':'+_0x2404c7);_0x15aceb[_0x3e8b07['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5033c5[_0x76a4('0x22')]('\x22'+_0x49981f[_0x76a4('0x17')](';')+'\x22');}if(_0x185070[_0x76a4('0x1f')]){handleError(_0x446854[_0x76a4('0x6b')][_0x35cd76],{'code':_0x76a4('0x7f'),'message':_0x185070['join']()});}else{fs['appendFileSync'](_0x58e1a2,_0x5033c5[_0x76a4('0x17')]()+'\x0a');}_0x5033c5=[];}if(!(stats['rows']%0xc8)){socket[_0x76a4('0x80')](_0x76a4('0x81')+_0x1f21d0,stats);stats[_0x76a4('0x5c')]=[];}}if(stopped){logger[_0x76a4('0x58')](_0x76a4('0x82'));_0x1522e4[_0x76a4('0x83')]();}}catch(_0x510496){handleError(_0x446854['data'][_0x35cd76],{'code':_0x76a4('0x84'),'message':_0x510496['message']});logger[_0x76a4('0x59')](_0x76a4('0x85'),_0x510496[_0x76a4('0x5a')]);}},'complete':function(){try{var _0x88469d=[];var _0x4d1b58=tempTableName;_0x88469d[_0x76a4('0x22')]('CREATE\x20TABLE\x20'+_0x4d1b58+'\x20LIKE\x20cm_contacts;');logger[_0x76a4('0x58')](_0x76a4('0x86'),contactItemTypes['length']);var _0x4334f1=util[_0x76a4('0xf')](_0x76a4('0x87'),_0x58e1a2,_0x4d1b58,_0x2f9d4f,_0x8a3322['ListId'],_0x8a3322['CompanyId']||null,NOW,NOW);if(_[_0x76a4('0x20')](_0x2eb926[_0x76a4('0x70')])){_0x4334f1+=_0x76a4('0x88');}_0x88469d[_0x76a4('0x22')](_0x4334f1);BPromise[_0x76a4('0x89')](_0x88469d,handleQuery)['then'](function(_0x109f94){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x88469d=[];for(var _0x3e276f=0x0;_0x3e276f\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.secondDisposition','i.to','i.UserId','contactName','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.*'];(function(_0x2c9461,_0x18e24d){var _0x50e4fb=function(_0x1fc85e){while(--_0x1fc85e){_0x2c9461['push'](_0x2c9461['shift']());}};_0x50e4fb(++_0x18e24d);}(_0x2bc6,0x163));var _0x62bc=function(_0x5f44f6,_0x5bf9cf){_0x5f44f6=_0x5f44f6-0x0;var _0x420ae8=_0x2bc6[_0x5f44f6];return _0x420ae8;};'use strict';var _=require(_0x62bc('0x0'));var squel=require(_0x62bc('0x1'));var as=require(_0x62bc('0x2'));var qs=require('../parsers/qs');var updateInteraction=require('./update-interaction')['updateInteraction'];var utils=require('./utils');var db=require(_0x62bc('0x3'))['db'];function skipInteractionsQuery(_0x576608,_0x2a1959,_0x2b12de){var _0x4fac5b=![];var _0x3cce26=utils[_0x62bc('0x4')](_0x576608);if(_0x2a1959[_0x62bc('0x5')]===_0x62bc('0x6')&&!_0x2b12de[_0x62bc('0x7')]&&!_0x2b12de[_0x3cce26]){_0x4fac5b=!![];}return _0x4fac5b;}function getTagsQuery(){return squel[_0x62bc('0x8')]()['field']('id')[_0x62bc('0x9')](_0x62bc('0xa'))[_0x62bc('0x9')](_0x62bc('0xb'))['from'](_0x62bc('0xc'));}function getUsersQuery(_0x107bf9,_0x1e3a57){var _0x546acc=utils[_0x62bc('0xd')](_0x107bf9);var _0x22e6c8=_0x62bc('0xe')+_0x107bf9+_0x62bc('0xf');var _0x217456=squel[_0x62bc('0x8')]()[_0x62bc('0x9')]('u.id')[_0x62bc('0x9')](_0x62bc('0x10'))['field'](_0x62bc('0x11')+_0x546acc)[_0x62bc('0x12')](_0x22e6c8,'ui')[_0x62bc('0x13')]('users','u',_0x62bc('0x14'));if(_0x1e3a57[_0x62bc('0x15')]>0x0){_0x217456['where']('ui.'+_0x546acc+_0x62bc('0x16'),_[_0x62bc('0x17')](_0x1e3a57,'id'));}return _0x217456;}function getInteractionsQuery(_0x5bb569){var _0x278893=utils[_0x62bc('0x18')](_0x5bb569);var _0xc1211c=utils[_0x62bc('0x4')](_0x5bb569);var _0xc95407=utils[_0x62bc('0xd')](_0x5bb569);return squel[_0x62bc('0x8')]()[_0x62bc('0x12')](_0x278893[_0x62bc('0x19')],'i')['left_join']('cm_contacts','c',_0x62bc('0x1a'))[_0x62bc('0x13')](_0x62bc('0x1b'),'o','o.id\x20=\x20i.UserId')[_0x62bc('0x13')](_0x278893['accounts'],'a',_0x62bc('0x1c')+_0xc1211c)[_0x62bc('0x13')](_0x278893[_0x62bc('0x1d')],'me','me.'+_0xc95407+_0x62bc('0x1e'))[_0x62bc('0x13')](_0x278893[_0x62bc('0x1f')],'it',_0x62bc('0x20')+_0xc95407+_0x62bc('0x1e'))[_0x62bc('0x13')]('tools_tags','t',_0x62bc('0x21'));}function getSqlClauses(){var _0xb0d0fb={'body':squel[_0x62bc('0x22')](),'contact':squel[_0x62bc('0x22')](),'default':squel[_0x62bc('0x22')](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel[_0x62bc('0x22')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x62bc('0x22')]()};return _0xb0d0fb;}function parseTagParameter(_0x36af97){var _0x1e046d=squel['expr']();if(_0x36af97){var _0x3d55df=utils[_0x62bc('0x23')](_0x36af97);_0x3d55df[_0x62bc('0x24')](function(_0x5c03ac){_0x1e046d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5c03ac+',%');});}return _0x1e046d;}function parseReadParameter(_0x641626){var _0x410c36='';if(_0x641626){_0x410c36=_0x62bc('0x25');if(_0x641626==='1'){_0x410c36=_0x410c36['replace'](_0x62bc('0x26'),'=');}else{_0x410c36=_0x410c36[_0x62bc('0x27')](_0x62bc('0x26'),'>');}}return _0x410c36;}function parseSearchFilter(_0x444267,_0x5a9302){var _0x4522ef=squel['expr']();if(_0x5a9302){var _0x26701b=_0x5a9302[_0x62bc('0x27')]('\x5c','\x5c\x5c')[_0x62bc('0x27')](/'/g,'\x27\x27');if(qs[_0x62bc('0x28')](_0x26701b)){_0x4522ef['or'](_0x62bc('0x29'),_0x26701b+'%');if([_0x62bc('0x2a'),_0x62bc('0x2b')][_0x62bc('0x2c')](_0x444267)){_0x4522ef['or'](_0x62bc('0x2d'),_0x26701b+'%');}else if(_0x444267===_0x62bc('0x2e')){_0x4522ef['or'](_0x62bc('0x2f'),_0x26701b+'%');}else if(_0x444267===_0x62bc('0x30')){_0x4522ef['or'](_0x62bc('0x31'),_0x26701b+'%');}}else if(_0x444267===_0x62bc('0x32')&&qs[_0x62bc('0x33')](_0x26701b)){_0x4522ef['or'](_0x62bc('0x34'),_0x26701b+'%');}else{if(_0x444267===_0x62bc('0x32')){_0x4522ef['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x62bc('0x35')](_0x26701b))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x26701b));}else{if(_0x444267!==_0x62bc('0x2e')){_0x4522ef['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x26701b));}_0x4522ef['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x26701b+'%');}}}return _0x4522ef;}function parseAdvancedSearchFilter(_0x3f22c1,_0x45f829){var _0x26e043=getSqlClauses();var _0x4efabd=as['parseSearch'](_0x3f22c1);var _0x4cc0d3=_0x4efabd[_0x62bc('0x36')];for(var _0x2245a7=0x0;_0x2245a7<_0x4efabd['conditions']['length'];_0x2245a7++){var _0x33d0f7=_0x4efabd[_0x62bc('0x37')][_0x2245a7];var _0x3aaed8='i';var _0x549013=_[_0x62bc('0x38')](_0x45f829,[_0x62bc('0xa'),_0x33d0f7[_0x62bc('0x9')]]);if(_0x549013){var _0x9482f7=as['buildExpression'](_0x3aaed8,_0x549013[_0x62bc('0x39')],_0x33d0f7);_0x26e043[_0x62bc('0x3a')][_0x4cc0d3](_0x9482f7['text'],_0x9482f7[_0x62bc('0x3b')][_0x62bc('0x3c')],_0x9482f7[_0x62bc('0x3b')][_0x62bc('0x3d')]);}else{switch(_0x33d0f7['field']){case _0x62bc('0x3e'):var _0x50065a=parseReadParameter(_0x33d0f7[_0x62bc('0x3b')]);_0x26e043[_0x62bc('0x3f')][_0x62bc('0x40')](_0x50065a);break;case _0x62bc('0x41'):if(_0x33d0f7['operator']===_0x62bc('0x42')){if(_0x33d0f7[_0x62bc('0x3b')][_0x62bc('0x43')]('\x20')[_0x62bc('0x15')]>0x1){_0x26e043[_0x62bc('0x44')][_0x4cc0d3](_0x62bc('0x45'),qs[_0x62bc('0x35')](_0x33d0f7[_0x62bc('0x3b')]),null);}else{var _0xfef765='%'+_0x33d0f7[_0x62bc('0x3b')]+'%';_0x26e043[_0x62bc('0x44')][_0x4cc0d3]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xfef765,_0xfef765,_0xfef765);}}else{_0x549013=_['find'](_0x45f829,[_0x62bc('0xa'),_0x62bc('0x46')]);_0x33d0f7['field']=_0x62bc('0x46');_0x9482f7=as[_0x62bc('0x47')](_0x3aaed8,_0x549013[_0x62bc('0x39')],_0x33d0f7);_0x26e043[_0x62bc('0x44')][_0x4cc0d3](_0x9482f7[_0x62bc('0x48')],_0x9482f7['value'][_0x62bc('0x3c')],_0x9482f7[_0x62bc('0x3b')]['end']);}break;case'Tag':var _0x12194a=_0x33d0f7[_0x62bc('0x3b')][_0x62bc('0x43')](',')['map'](function(_0x185423){return Number(_0x185423);});var _0x2407b8=parseTagParameter(_0x12194a);_0x26e043[_0x62bc('0x49')][_0x62bc('0x4a')][_0x62bc('0x40')](_0x2407b8);_0x26e043[_0x62bc('0x49')]['ids']=_0x12194a;break;case _0x62bc('0x4b'):if(_0x33d0f7['operator']===_0x62bc('0x42')){_0x26e043[_0x62bc('0x4c')][_0x4cc0d3](_0x62bc('0x4d'),'%'+_0x33d0f7['value']+'%',null);}else{_0x549013=_['find'](_0x45f829,['name',_0x62bc('0x4e')]);_0x33d0f7['field']=_0x62bc('0x4e');_0x9482f7=as[_0x62bc('0x47')](_0x3aaed8,_0x549013['type'],_0x33d0f7);_0x26e043['user'][_0x4cc0d3](_0x9482f7['text'],_0x9482f7[_0x62bc('0x3b')][_0x62bc('0x3c')],_0x9482f7[_0x62bc('0x3b')][_0x62bc('0x3d')]);}break;case _0x62bc('0x4f'):case'plainBody':_0x9482f7=as[_0x62bc('0x47')]('me',null,_0x33d0f7);_0x26e043[_0x62bc('0x4f')][_0x4cc0d3](_0x9482f7['text'],_0x9482f7[_0x62bc('0x3b')]['start'],_0x9482f7[_0x62bc('0x3b')][_0x62bc('0x3d')]);break;}}}return _0x26e043;}function parseModelFields(_0x17e0ec,_0xca6190,_0x162609){var _0x28747b=utils[_0x62bc('0x4')](_0x17e0ec);var _0x481562=squel[_0x62bc('0x22')]();var _0x29916a=_(_0xca6190)['keys']()[_0x62bc('0x17')](function(_0x5b8bab){return _[_0x62bc('0x50')](_0x162609,[_0x62bc('0xa'),_0x5b8bab])?_0x5b8bab:undefined;})['compact']()[_0x62bc('0x3b')]();if(_0x29916a[_0x62bc('0x15')]>0x0){_0x29916a[_0x62bc('0x24')](function(_0x4c9b3e){if(_0x4c9b3e===_0x28747b){_0x481562[_0x62bc('0x40')]('i.'+_0x28747b+_0x62bc('0x16'),[][_0x62bc('0x51')](_0xca6190[_0x4c9b3e]));}else if(_0x4c9b3e===_0x62bc('0x52')){var _0x24b107=JSON[_0x62bc('0x53')](_0xca6190[_0x4c9b3e])[_0x62bc('0x54')];var _0x446160=JSON[_0x62bc('0x53')](_0xca6190[_0x4c9b3e])[_0x62bc('0x55')];_0x481562[_0x62bc('0x40')](_0x62bc('0x56'),_0x24b107,_0x446160);}else{if(_0xca6190[_0x4c9b3e]===_0x62bc('0x57')){_0x481562[_0x62bc('0x40')]('i.'+_0x4c9b3e+_0x62bc('0x58'));}else{_0x481562[_0x62bc('0x40')]('i.'+_0x4c9b3e+'\x20=\x20?',_0xca6190[_0x4c9b3e]);}}});}return _0x481562;}function parseQueryParameters(_0x1f9010,_0x440fd9,_0x3ce3ce){var _0x152045=getSqlClauses();return Promise[_0x62bc('0x59')]()[_0x62bc('0x5a')](function(){return parseModelFields(_0x1f9010,_0x440fd9,_0x3ce3ce);})[_0x62bc('0x5a')](function(_0x3fa883){_0x152045[_0x62bc('0x5b')][_0x62bc('0x40')](_0x3fa883);return parseReadParameter(_0x440fd9[_0x62bc('0x3f')]);})[_0x62bc('0x5a')](function(_0x5ebee0){_0x152045[_0x62bc('0x3f')]['and'](_0x5ebee0);return parseTagParameter(_0x440fd9[_0x62bc('0x5c')]);})[_0x62bc('0x5a')](function(_0x268681){_0x152045[_0x62bc('0x49')][_0x62bc('0x4a')][_0x62bc('0x40')](_0x268681);return parseSearchFilter(_0x1f9010,_0x440fd9[_0x62bc('0x5d')]);})[_0x62bc('0x5a')](function(_0x4934ce){_0x152045['filter']=_0x4934ce;return _0x152045;});}function checkAccountsRestrictions(_0xd35ce2,_0xaa83af,_0x1f72bb){var _0x56bccf=utils[_0x62bc('0x4')](_0xd35ce2);var _0x1325a4=_0x62bc('0x5e')+_[_0x62bc('0x5f')](_0xd35ce2)+(_0xd35ce2==='chat'?_0x62bc('0x60'):_0x62bc('0x61'));var _0x237714=squel[_0x62bc('0x22')]();return Promise[_0x62bc('0x59')]()[_0x62bc('0x5a')](function(){if(_0x1f72bb[_0x62bc('0x7')]&&_0xaa83af['role']===_0x62bc('0x6')){return _0xaa83af[_0x1325a4]({'attributes':['id'],'raw':!![]});}})[_0x62bc('0x5a')](function(_0x39c443){if(_0x39c443){if(_0x39c443['length']===0x0){_0x237714['and']('i.'+_0x56bccf+_0x62bc('0x58'));}else{_0x237714[_0x62bc('0x40')]('i.'+_0x56bccf+_0x62bc('0x16'),_['map'](_0x39c443,'id'));}}else if(!_0x1f72bb[_0x56bccf]){_0x237714[_0x62bc('0x40')]('i.'+_0x56bccf+'\x20IS\x20NOT\x20NULL');}})[_0x62bc('0x5a')](function(){return _0x237714;});}function getClosedOrderClause(_0x15741c,_0x4b593a){var _0x3884b0='';var _0x5d169c=[_0x62bc('0x62'),'i.secondDisposition',_0x62bc('0x63')];if(_0x15741c===_0x62bc('0x32')){_0x5d169c[_0x62bc('0x64')](_0x62bc('0x65'));}if(_0x4b593a[_0x62bc('0x66')]==='0'&&_0x15741c===_0x62bc('0x32')){_0x3884b0='i.substatus';}else{if(_0x4b593a[_0x62bc('0x66')]==='1'){_0x5d169c[_0x62bc('0x67')]();}_0x3884b0=_0x62bc('0x68')+_0x5d169c['join'](',\x20')+')';}return _0x3884b0;}function getFilteredInteractions(_0x107b36,_0x3de486,_0x304bdc,_0x132509){var _0x525590=utils[_0x62bc('0xd')](_0x107b36);var _0x38c171=_[_0x62bc('0x5f')](_0x107b36)+_0x62bc('0x69');var _0x31d5f0=[];var _0x4a6fca=getTagsQuery();var _0x48439f={'type':db[_0x62bc('0x6a')]['QueryTypes'][_0x62bc('0x6b')],'raw':!![]};var _0x18779a=[];var _0x4dc4c8=[];return db[_0x62bc('0x6c')]['query'](_0x4a6fca[_0x62bc('0x6d')](),_0x48439f)['then'](function(_0x468f58){_0x31d5f0=_['keyBy'](_0x468f58,'id');_0x48439f=_[_0x62bc('0x6e')](_0x48439f,{'model':db[_0x38c171],'mapToModel':!![],'nest':!![]});if(_0x304bdc[_0x62bc('0x5b')]){_0x132509[_0x62bc('0x6f')]['forEach'](function(_0x243122){_0x3de486[_0x62bc('0x9')]('i.'+_0x243122);});}else{_0x3de486[_0x62bc('0x9')](_0x62bc('0x70'),_0x62bc('0x3e'));_0x3de486['field'](_0x62bc('0x71'),_0x62bc('0x72'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x73'),_0x62bc('0x74'));if(_0x107b36===_0x62bc('0x32')){_0x3de486[_0x62bc('0x9')](_0x62bc('0x75'),_0x62bc('0x76'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x77'),'contactName');_0x3de486[_0x62bc('0x9')](_0x62bc('0x78'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x79'));_0x3de486['field'](_0x62bc('0x7a'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x7b'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x7c'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x7d'));_0x3de486[_0x62bc('0x9')]('i.lastMsgAt');_0x3de486[_0x62bc('0x9')](_0x62bc('0x7e'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x7f'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x63'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x80'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x62'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x65'));_0x3de486['field'](_0x62bc('0x81'));_0x3de486[_0x62bc('0x9')]('i.ContactId');_0x3de486[_0x62bc('0x9')]('i.MailAccountId');_0x3de486[_0x62bc('0x9')](_0x62bc('0x82'));}else if(_0x107b36==='openchannel'){_0x3de486[_0x62bc('0x9')]('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',_0x62bc('0x83'));}else{_0x3de486['field'](_0x62bc('0x84'),'contactName');}if(_0x107b36!==_0x62bc('0x32')){_0x3de486[_0x62bc('0x9')](_0x62bc('0x85'));}_0x3de486[_0x62bc('0x9')](_0x62bc('0x86'),_0x62bc('0x87'));_0x3de486['field'](_0x62bc('0x88'),_0x62bc('0x89'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x8a'),_0x62bc('0x8b'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x8c'),_0x62bc('0x8d'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x8e'),_0x62bc('0x8f'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x90'),'Contact.fax');_0x3de486['field']('o.fullname',_0x62bc('0x91'));_0x3de486['field'](_0x62bc('0x92'),_0x62bc('0x93'));_0x3de486[_0x62bc('0x9')](_0x62bc('0x94'),_0x62bc('0x95'));}if(_0x132509[_0x62bc('0x96')]){_0x3de486[_0x62bc('0x96')](_0x132509[_0x62bc('0x96')]);}if(_0x132509['offset']){_0x3de486[_0x62bc('0x97')](_0x132509[_0x62bc('0x97')]);}return db[_0x62bc('0x6c')]['query'](_0x3de486[_0x62bc('0x6d')](),_0x48439f);})['then'](function(_0x339248){_0x18779a=_0x339248;var _0x3aa295=getUsersQuery(_0x107b36,_0x18779a);return db['sequelize'][_0x62bc('0x98')](_0x3aa295[_0x62bc('0x6d')](),_0x48439f);})['then'](function(_0x4e2463){_0x4dc4c8=_['groupBy'](_0x4e2463,_0x525590);if(_0x107b36==='mail'){return db[_0x62bc('0x99')][_0x62bc('0x9a')]({'attributes':[_0x62bc('0x9b')],'raw':!![]});}})[_0x62bc('0x5a')](function(_0x3aac90){var _0x5beb17=_0x3aac90?_0x3aac90[_0x62bc('0x9b')]:undefined;var _0xbce458=_0x18779a[_0x62bc('0x17')](function(_0x12ff7a){return updateInteraction(_0x12ff7a,_0x31d5f0,_0x4dc4c8,_0x5beb17);});return Promise[_0x62bc('0x9c')](_0xbce458);});}function countFilteredInteractions(_0x19100f,_0xf5293c){var _0x25488f=_0x19100f[_0x62bc('0x9d')]();_0x25488f[_0x62bc('0x9')](_0x62bc('0x9e'));_0x25488f[_0x62bc('0x9')](_0x62bc('0x70'),_0x62bc('0x3e'));var _0x487bec=utils[_0x62bc('0x23')](_0xf5293c);if(!_[_0x62bc('0x9f')](_0x487bec)){_0x25488f['where'](_0x62bc('0xa0'),_0x487bec);}var _0x132335={'type':db[_0x62bc('0x6a')][_0x62bc('0xa1')]['SELECT'],'raw':!![]};return db[_0x62bc('0x6c')][_0x62bc('0x98')](_0x25488f['toString'](),_0x132335);}module[_0x62bc('0xa2')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x7a2c=['some','compact','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','then','tag','filter','get','capitalize','chat','Accounts','role','agent','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','join','Interaction','Sequelize','QueryTypes','SELECT','query','keyBy','merge','attributes','forEach','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','Account.mandatoryDisposition','a.email','contactName','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.UserId','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','TagIds','limit','offset','sequelize','toString','Setting','findOne','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','search','select','field','color','from','getInteractionFK','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','getAccountFK','cm_contacts','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','{OPERATOR}','replace','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','mail','getFullTextValue','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','buildExpression','type','text','value','end','unreadMessages','read','and','operator','split','contact','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','tags','ids','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys'];(function(_0x1c2571,_0x4fb247){var _0x51e16a=function(_0x96c1d9){while(--_0x96c1d9){_0x1c2571['push'](_0x1c2571['shift']());}};_0x51e16a(++_0x4fb247);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x52ed40,_0xae19b8){_0x52ed40=_0x52ed40-0x0;var _0x3892eb=_0x7a2c[_0x52ed40];return _0x3892eb;};'use strict';var _=require(_0xc7a2('0x0'));var squel=require('squel');var as=require(_0xc7a2('0x1'));var qs=require(_0xc7a2('0x2'));var updateInteraction=require(_0xc7a2('0x3'))[_0xc7a2('0x4')];var utils=require(_0xc7a2('0x5'));var db=require(_0xc7a2('0x6'))['db'];function skipInteractionsQuery(_0x3f2b0d,_0x34cd60,_0x489232){var _0x3a47c8=![];var _0x1ddbae=utils['getAccountFK'](_0x3f2b0d);if(_0x34cd60['role']==='agent'&&!_0x489232[_0xc7a2('0x7')]&&!_0x489232[_0x1ddbae]){_0x3a47c8=!![];}return _0x3a47c8;}function getTagsQuery(){return squel[_0xc7a2('0x8')]()[_0xc7a2('0x9')]('id')[_0xc7a2('0x9')]('name')[_0xc7a2('0x9')](_0xc7a2('0xa'))[_0xc7a2('0xb')]('tools_tags');}function getUsersQuery(_0x2c3f86,_0x4a44c7){var _0x3e216a=utils[_0xc7a2('0xc')](_0x2c3f86);var _0x1a9b38='user_has_'+_0x2c3f86+_0xc7a2('0xd');var _0x28d414=squel[_0xc7a2('0x8')]()['field'](_0xc7a2('0xe'))[_0xc7a2('0x9')](_0xc7a2('0xf'))[_0xc7a2('0x9')](_0xc7a2('0x10')+_0x3e216a)[_0xc7a2('0xb')](_0x1a9b38,'ui')[_0xc7a2('0x11')](_0xc7a2('0x12'),'u',_0xc7a2('0x13'));if(_0x4a44c7[_0xc7a2('0x14')]>0x0){_0x28d414[_0xc7a2('0x15')](_0xc7a2('0x10')+_0x3e216a+_0xc7a2('0x16'),_[_0xc7a2('0x17')](_0x4a44c7,'id'));}return _0x28d414;}function getInteractionsQuery(_0x2bc321){var _0x506396=utils[_0xc7a2('0x18')](_0x2bc321);var _0x59e8ad=utils[_0xc7a2('0x19')](_0x2bc321);var _0x302d54=utils[_0xc7a2('0xc')](_0x2bc321);return squel[_0xc7a2('0x8')]()['from'](_0x506396['interactions'],'i')[_0xc7a2('0x11')](_0xc7a2('0x1a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0xc7a2('0x1b'))['left_join'](_0x506396[_0xc7a2('0x1c')],'a',_0xc7a2('0x1d')+_0x59e8ad)['left_join'](_0x506396[_0xc7a2('0x1e')],'me',_0xc7a2('0x1f')+_0x302d54+_0xc7a2('0x20'))[_0xc7a2('0x11')](_0x506396[_0xc7a2('0x21')],'it',_0xc7a2('0x22')+_0x302d54+_0xc7a2('0x20'))['left_join']('tools_tags','t',_0xc7a2('0x23'));}function getSqlClauses(){var _0x1c3fb8={'body':squel['expr'](),'contact':squel[_0xc7a2('0x24')](),'default':squel[_0xc7a2('0x24')](),'fields':squel[_0xc7a2('0x24')](),'filter':squel[_0xc7a2('0x24')](),'read':squel[_0xc7a2('0x24')](),'tags':{'clause':squel[_0xc7a2('0x24')](),'ids':null},'user':squel[_0xc7a2('0x24')]()};return _0x1c3fb8;}function parseTagParameter(_0x429b05){var _0x591860=squel[_0xc7a2('0x24')]();if(_0x429b05){var _0x505fe8=utils[_0xc7a2('0x25')](_0x429b05);_0x505fe8['forEach'](function(_0x20404b){_0x591860['or'](_0xc7a2('0x26'),'%,'+_0x20404b+',%');});}return _0x591860;}function parseReadParameter(_0xd93f19){var _0x3959c9='';if(_0xd93f19){_0x3959c9='unreadMessages\x20{OPERATOR}\x200';if(_0xd93f19==='1'){_0x3959c9=_0x3959c9['replace'](_0xc7a2('0x27'),'=');}else{_0x3959c9=_0x3959c9[_0xc7a2('0x28')](_0xc7a2('0x27'),'>');}}return _0x3959c9;}function parseSearchFilter(_0x305efb,_0x3be88c){var _0x306e99=squel[_0xc7a2('0x24')]();if(_0x3be88c){var _0x5e970e=_0x3be88c[_0xc7a2('0x28')]('\x5c','\x5c\x5c')[_0xc7a2('0x28')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5e970e)){_0x306e99['or'](_0xc7a2('0x29'),_0x5e970e+'%');if([_0xc7a2('0x2a'),_0xc7a2('0x2b')]['includes'](_0x305efb)){_0x306e99['or'](_0xc7a2('0x2c'),_0x5e970e+'%');}else if(_0x305efb==='fax'){_0x306e99['or'](_0xc7a2('0x2d'),_0x5e970e+'%');}else if(_0x305efb==='openchannel'){_0x306e99['or']('i.from\x20LIKE\x20?',_0x5e970e+'%');}}else if(_0x305efb===_0xc7a2('0x2e')&&qs['isEmail'](_0x5e970e)){_0x306e99['or']('c.email\x20LIKE\x20?',_0x5e970e+'%');}else{if(_0x305efb===_0xc7a2('0x2e')){_0x306e99['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc7a2('0x2f')](_0x5e970e))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc7a2('0x2f')](_0x5e970e));}else{if(_0x305efb!==_0xc7a2('0x30')){_0x306e99['or'](_0xc7a2('0x31'),qs[_0xc7a2('0x2f')](_0x5e970e));}_0x306e99['or'](_0xc7a2('0x32'),_0x5e970e+'%');}}}return _0x306e99;}function parseAdvancedSearchFilter(_0x4226e3,_0x1e10fc){var _0x2a3bfb=getSqlClauses();var _0x29771b=as[_0xc7a2('0x33')](_0x4226e3);var _0x4ba53e=_0x29771b[_0xc7a2('0x34')];for(var _0x41a503=0x0;_0x41a503<_0x29771b['conditions'][_0xc7a2('0x14')];_0x41a503++){var _0xf7ed4a=_0x29771b[_0xc7a2('0x35')][_0x41a503];var _0x23187f='i';var _0x178c3e=_[_0xc7a2('0x36')](_0x1e10fc,[_0xc7a2('0x37'),_0xf7ed4a['field']]);if(_0x178c3e){var _0x4124bd=as[_0xc7a2('0x38')](_0x23187f,_0x178c3e[_0xc7a2('0x39')],_0xf7ed4a);_0x2a3bfb['default'][_0x4ba53e](_0x4124bd[_0xc7a2('0x3a')],_0x4124bd[_0xc7a2('0x3b')]['start'],_0x4124bd[_0xc7a2('0x3b')][_0xc7a2('0x3c')]);}else{switch(_0xf7ed4a[_0xc7a2('0x9')]){case _0xc7a2('0x3d'):var _0x2cdef8=parseReadParameter(_0xf7ed4a[_0xc7a2('0x3b')]);_0x2a3bfb[_0xc7a2('0x3e')][_0xc7a2('0x3f')](_0x2cdef8);break;case'Contact':if(_0xf7ed4a[_0xc7a2('0x40')]==='$substring'){if(_0xf7ed4a[_0xc7a2('0x3b')][_0xc7a2('0x41')]('\x20')[_0xc7a2('0x14')]>0x1){_0x2a3bfb[_0xc7a2('0x42')][_0x4ba53e](_0xc7a2('0x43'),qs[_0xc7a2('0x2f')](_0xf7ed4a[_0xc7a2('0x3b')]),null);}else{var _0x36f376='%'+_0xf7ed4a['value']+'%';_0x2a3bfb[_0xc7a2('0x42')][_0x4ba53e](_0xc7a2('0x44'),_0x36f376,_0x36f376,_0x36f376);}}else{_0x178c3e=_[_0xc7a2('0x36')](_0x1e10fc,[_0xc7a2('0x37'),_0xc7a2('0x45')]);_0xf7ed4a[_0xc7a2('0x9')]='ContactId';_0x4124bd=as['buildExpression'](_0x23187f,_0x178c3e['type'],_0xf7ed4a);_0x2a3bfb[_0xc7a2('0x42')][_0x4ba53e](_0x4124bd[_0xc7a2('0x3a')],_0x4124bd[_0xc7a2('0x3b')][_0xc7a2('0x46')],_0x4124bd[_0xc7a2('0x3b')][_0xc7a2('0x3c')]);}break;case _0xc7a2('0x47'):var _0x13d3b4=_0xf7ed4a[_0xc7a2('0x3b')]['split'](',')['map'](function(_0x4bcb42){return Number(_0x4bcb42);});var _0x47696c=parseTagParameter(_0x13d3b4);_0x2a3bfb[_0xc7a2('0x48')]['clause'][_0xc7a2('0x3f')](_0x47696c);_0x2a3bfb[_0xc7a2('0x48')][_0xc7a2('0x49')]=_0x13d3b4;break;case'User':if(_0xf7ed4a[_0xc7a2('0x40')]==='$substring'){_0x2a3bfb[_0xc7a2('0x4a')][_0x4ba53e](_0xc7a2('0x4b'),'%'+_0xf7ed4a['value']+'%',null);}else{_0x178c3e=_['find'](_0x1e10fc,[_0xc7a2('0x37'),_0xc7a2('0x4c')]);_0xf7ed4a['field']=_0xc7a2('0x4c');_0x4124bd=as[_0xc7a2('0x38')](_0x23187f,_0x178c3e[_0xc7a2('0x39')],_0xf7ed4a);_0x2a3bfb[_0xc7a2('0x4a')][_0x4ba53e](_0x4124bd[_0xc7a2('0x3a')],_0x4124bd[_0xc7a2('0x3b')]['start'],_0x4124bd[_0xc7a2('0x3b')][_0xc7a2('0x3c')]);}break;case _0xc7a2('0x4d'):case _0xc7a2('0x4e'):_0x4124bd=as['buildExpression']('me',null,_0xf7ed4a);_0x2a3bfb[_0xc7a2('0x4d')][_0x4ba53e](_0x4124bd[_0xc7a2('0x3a')],_0x4124bd[_0xc7a2('0x3b')][_0xc7a2('0x46')],_0x4124bd[_0xc7a2('0x3b')][_0xc7a2('0x3c')]);break;}}}return _0x2a3bfb;}function parseModelFields(_0x7378ed,_0xdc4644,_0x5f5154){var _0x37bce7=utils[_0xc7a2('0x19')](_0x7378ed);var _0x18b00a=squel[_0xc7a2('0x24')]();var _0x4ef4c1=_(_0xdc4644)[_0xc7a2('0x4f')]()[_0xc7a2('0x17')](function(_0x512375){return _[_0xc7a2('0x50')](_0x5f5154,[_0xc7a2('0x37'),_0x512375])?_0x512375:undefined;})[_0xc7a2('0x51')]()[_0xc7a2('0x3b')]();if(_0x4ef4c1[_0xc7a2('0x14')]>0x0){_0x4ef4c1['forEach'](function(_0x306047){if(_0x306047===_0x37bce7){_0x18b00a[_0xc7a2('0x3f')]('i.'+_0x37bce7+_0xc7a2('0x16'),[]['concat'](_0xdc4644[_0x306047]));}else if(_0x306047==='createdAt'){var _0x223755=JSON['parse'](_0xdc4644[_0x306047])['$gte'];var _0x340154=JSON[_0xc7a2('0x52')](_0xdc4644[_0x306047])['$lte'];_0x18b00a['and'](_0xc7a2('0x53'),_0x223755,_0x340154);}else{if(_0xdc4644[_0x306047]===_0xc7a2('0x54')){_0x18b00a[_0xc7a2('0x3f')]('i.'+_0x306047+_0xc7a2('0x55'));}else{_0x18b00a[_0xc7a2('0x3f')]('i.'+_0x306047+'\x20=\x20?',_0xdc4644[_0x306047]);}}});}return _0x18b00a;}function parseQueryParameters(_0x3754a4,_0x179bc1,_0x581509){var _0x3e7c7e=getSqlClauses();return Promise[_0xc7a2('0x56')]()[_0xc7a2('0x57')](function(){return parseModelFields(_0x3754a4,_0x179bc1,_0x581509);})[_0xc7a2('0x57')](function(_0x1f4c96){_0x3e7c7e['fields'][_0xc7a2('0x3f')](_0x1f4c96);return parseReadParameter(_0x179bc1[_0xc7a2('0x3e')]);})[_0xc7a2('0x57')](function(_0x5f3622){_0x3e7c7e[_0xc7a2('0x3e')][_0xc7a2('0x3f')](_0x5f3622);return parseTagParameter(_0x179bc1[_0xc7a2('0x58')]);})[_0xc7a2('0x57')](function(_0x2f53e9){_0x3e7c7e[_0xc7a2('0x48')]['clause'][_0xc7a2('0x3f')](_0x2f53e9);return parseSearchFilter(_0x3754a4,_0x179bc1[_0xc7a2('0x59')]);})[_0xc7a2('0x57')](function(_0x332e8e){_0x3e7c7e[_0xc7a2('0x59')]=_0x332e8e;return _0x3e7c7e;});}function checkAccountsRestrictions(_0x1f0762,_0x2885fe,_0x50a80a){var _0x2b1bb3=utils['getAccountFK'](_0x1f0762);var _0x4e1efa=_0xc7a2('0x5a')+_[_0xc7a2('0x5b')](_0x1f0762)+(_0x1f0762===_0xc7a2('0x5c')?'Websites':_0xc7a2('0x5d'));var _0x4d2973=squel['expr']();return Promise[_0xc7a2('0x56')]()[_0xc7a2('0x57')](function(){if(_0x50a80a[_0xc7a2('0x7')]&&_0x2885fe[_0xc7a2('0x5e')]===_0xc7a2('0x5f')){return _0x2885fe[_0x4e1efa]({'attributes':['id'],'raw':!![]});}})[_0xc7a2('0x57')](function(_0x4e2d6a){if(_0x4e2d6a){if(_0x4e2d6a['length']===0x0){_0x4d2973['and']('i.'+_0x2b1bb3+_0xc7a2('0x55'));}else{_0x4d2973['and']('i.'+_0x2b1bb3+'\x20IN\x20?',_['map'](_0x4e2d6a,'id'));}}else if(!_0x50a80a[_0x2b1bb3]){_0x4d2973['and']('i.'+_0x2b1bb3+_0xc7a2('0x60'));}})[_0xc7a2('0x57')](function(){return _0x4d2973;});}function getClosedOrderClause(_0xfd65d8,_0x15b8fd){var _0x52c83a='';var _0x160fe3=[_0xc7a2('0x61'),_0xc7a2('0x62'),_0xc7a2('0x63')];if(_0xfd65d8===_0xc7a2('0x2e')){_0x160fe3[_0xc7a2('0x64')](_0xc7a2('0x65'));}if(_0x15b8fd[_0xc7a2('0x66')]==='0'&&_0xfd65d8===_0xc7a2('0x2e')){_0x52c83a=_0xc7a2('0x65');}else{if(_0x15b8fd[_0xc7a2('0x66')]==='1'){_0x160fe3['shift']();}_0x52c83a='CONCAT_WS(\x27\x27,\x20'+_0x160fe3[_0xc7a2('0x67')](',\x20')+')';}return _0x52c83a;}function getFilteredInteractions(_0x5e5466,_0xf8dbd1,_0xe09b54,_0x3dc131){var _0x29f1e7=utils['getInteractionFK'](_0x5e5466);var _0xfe5203=_[_0xc7a2('0x5b')](_0x5e5466)+_0xc7a2('0x68');var _0xc7ce86=[];var _0x20331b=getTagsQuery();var _0x5765f0={'type':db[_0xc7a2('0x69')][_0xc7a2('0x6a')][_0xc7a2('0x6b')],'raw':!![]};var _0x45044a=[];var _0x23d7bc=[];return db['sequelize'][_0xc7a2('0x6c')](_0x20331b['toString'](),_0x5765f0)['then'](function(_0x3c06a8){_0xc7ce86=_[_0xc7a2('0x6d')](_0x3c06a8,'id');_0x5765f0=_[_0xc7a2('0x6e')](_0x5765f0,{'model':db[_0xfe5203],'mapToModel':!![],'nest':!![]});if(_0xe09b54['fields']){_0x3dc131[_0xc7a2('0x6f')][_0xc7a2('0x70')](function(_0x5b82de){_0xf8dbd1[_0xc7a2('0x9')]('i.'+_0x5b82de);});}else{_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x71'),'unreadMessages');_0xf8dbd1['field']('a.key',_0xc7a2('0x72'));_0xf8dbd1[_0xc7a2('0x9')]('a.mandatoryDisposition',_0xc7a2('0x73'));if(_0x5e5466===_0xc7a2('0x2e')){_0xf8dbd1['field'](_0xc7a2('0x74'),'Account.email');_0xf8dbd1[_0xc7a2('0x9')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xc7a2('0x75'));_0xf8dbd1[_0xc7a2('0x9')]('i.id');_0xf8dbd1[_0xc7a2('0x9')]('i.createdAt');_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x76'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x77'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x78'));_0xf8dbd1['field']('i.attach');_0xf8dbd1['field'](_0xc7a2('0x79'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x7a'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x7b'));_0xf8dbd1['field']('i.disposition');_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x62'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x61'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x65'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x7c'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x7d'));_0xf8dbd1['field']('i.MailAccountId');_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x7e'));}else if(_0x5e5466==='openchannel'){_0xf8dbd1[_0xc7a2('0x9')]('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',_0xc7a2('0x75'));}else{_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x7f'),_0xc7a2('0x75'));}if(_0x5e5466!=='mail'){_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x80'));}_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x81'),'Contact.firstName');_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x82'),_0xc7a2('0x83'));_0xf8dbd1[_0xc7a2('0x9')]('c.email',_0xc7a2('0x84'));_0xf8dbd1['field']('c.phone','Contact.phone');_0xf8dbd1[_0xc7a2('0x9')]('c.mobile',_0xc7a2('0x85'));_0xf8dbd1['field'](_0xc7a2('0x86'),_0xc7a2('0x87'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x88'),_0xc7a2('0x89'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x8a'),_0xc7a2('0x8b'));_0xf8dbd1[_0xc7a2('0x9')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc7a2('0x8c'));}if(_0x3dc131[_0xc7a2('0x8d')]){_0xf8dbd1[_0xc7a2('0x8d')](_0x3dc131[_0xc7a2('0x8d')]);}if(_0x3dc131[_0xc7a2('0x8e')]){_0xf8dbd1[_0xc7a2('0x8e')](_0x3dc131[_0xc7a2('0x8e')]);}return db[_0xc7a2('0x8f')][_0xc7a2('0x6c')](_0xf8dbd1[_0xc7a2('0x90')](),_0x5765f0);})[_0xc7a2('0x57')](function(_0x2f234f){_0x45044a=_0x2f234f;var _0x18461f=getUsersQuery(_0x5e5466,_0x45044a);return db[_0xc7a2('0x8f')][_0xc7a2('0x6c')](_0x18461f[_0xc7a2('0x90')](),_0x5765f0);})[_0xc7a2('0x57')](function(_0x2f65bd){_0x23d7bc=_['groupBy'](_0x2f65bd,_0x29f1e7);if(_0x5e5466==='mail'){return db[_0xc7a2('0x91')][_0xc7a2('0x92')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0xc7a2('0x57')](function(_0x30dca3){var _0x5cdfc8=_0x30dca3?_0x30dca3['enableEmailPreview']:undefined;var _0x31256b=_0x45044a[_0xc7a2('0x17')](function(_0xf25798){return updateInteraction(_0xf25798,_0xc7ce86,_0x23d7bc,_0x5cdfc8);});return Promise[_0xc7a2('0x93')](_0x31256b);});}function countFilteredInteractions(_0x470bf1,_0x259f04){var _0x4c48d9=_0x470bf1[_0xc7a2('0x94')]();_0x4c48d9['field'](_0xc7a2('0x95'));_0x4c48d9['field'](_0xc7a2('0x71'),_0xc7a2('0x3d'));var _0xe9e0fd=utils[_0xc7a2('0x25')](_0x259f04);if(!_[_0xc7a2('0x96')](_0xe9e0fd)){_0x4c48d9[_0xc7a2('0x15')](_0xc7a2('0x97'),_0xe9e0fd);}var _0x267e78={'type':db[_0xc7a2('0x69')]['QueryTypes']['SELECT'],'raw':!![]};return db['sequelize'][_0xc7a2('0x6c')](_0x4c48d9[_0xc7a2('0x90')](),_0x267e78);}module[_0xc7a2('0x98')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 98220de..8065529 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3694=['UserId','MailMessage','out','plainBody','-id','then','trimStart','catch','updateInteraction','Users','Tags','TagIds','lodash','../../mysqldb','fullname','split','forEach','waiting','talking','answered','unmanaged','abandoned','total','disposition'];(function(_0x4a209a,_0x4bf379){var _0x3651d7=function(_0x448b21){while(--_0x448b21){_0x4a209a['push'](_0x4a209a['shift']());}};_0x3651d7(++_0x4bf379);}(_0x3694,0xb4));var _0x4369=function(_0x4f1029,_0x1fd479){_0x4f1029=_0x4f1029-0x0;var _0x34012f=_0x3694[_0x4f1029];return _0x34012f;};'use strict';var _=require(_0x4369('0x0'));var db=require(_0x4369('0x1'))['db'];function getInteractionUsers(_0x592c1c,_0x4f4d65){return new Promise(function(_0x37d521,_0x2e025d){try{var _0x3d75a7=[];if(_0x4f4d65[_0x592c1c]){_0x3d75a7=_0x4f4d65[_0x592c1c]['map'](function(_0x3dd73a){return{'id':_0x3dd73a['id'],'fullname':_0x3dd73a[_0x4369('0x2')]};});}return _0x37d521(_0x3d75a7);}catch(_0x21ffe5){_0x2e025d(_0x21ffe5);}});}function getInteractionTags(_0x5159e1,_0x247bb5){var _0x3e5deb=[];if(_0x5159e1){_0x5159e1[_0x4369('0x3')](',')[_0x4369('0x4')](function(_0xa0e4fb){_0x3e5deb['push'](_0x247bb5[_0xa0e4fb]);});}return _0x3e5deb;}function updateWaitingCounter(_0x4e3706){if(_0x4e3706[_0x4369('0x5')]){_0x4e3706[_0x4369('0x5')]-=0x1;}}function updateInteractionCounters(_0x4c7b86){_0x4c7b86[_0x4369('0x5')]=0x0;_0x4c7b86[_0x4369('0x6')]=0x0;_0x4c7b86[_0x4369('0x7')]=0x0;_0x4c7b86[_0x4369('0x8')]=0x0;_0x4c7b86[_0x4369('0x9')]=0x0;_0x4c7b86[_0x4369('0xa')]=0x0;if(_0x4c7b86['closed']){if(_0x4c7b86[_0x4369('0xb')]===_0x4369('0x9')){_0x4c7b86['abandoned']+=0x1;updateWaitingCounter(_0x4c7b86);}if(_0x4c7b86[_0x4369('0xc')]){_0x4c7b86['answered']+=0x1;if(_0x4c7b86[_0x4369('0x6')]){_0x4c7b86[_0x4369('0x6')]-=0x1;}}else{if(_0x4c7b86[_0x4369('0xb')]){_0x4c7b86[_0x4369('0x8')]+=0x1;updateWaitingCounter(_0x4c7b86);}}}else{if(!_0x4c7b86[_0x4369('0xc')]){_0x4c7b86[_0x4369('0x5')]+=0x1;}if(_0x4c7b86[_0x4369('0xc')]){_0x4c7b86[_0x4369('0x6')]+=0x1;updateWaitingCounter(_0x4c7b86);}}_0x4c7b86[_0x4369('0xa')]+=0x1;return _0x4c7b86;}function getLastMessageText(_0x30eab5){return db[_0x4369('0xd')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x30eab5['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x4369('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x4369('0xf')],'order':_0x4369('0x10'),'raw':!![]})[_0x4369('0x11')](function(_0x564b97){if(_0x564b97&&_0x564b97[_0x4369('0xf')]){_0x30eab5['lastMsgText']=_[_0x4369('0x12')](_0x564b97[_0x4369('0xf')]);}return _0x30eab5;})[_0x4369('0x13')](function(_0x404d0e){throw _0x404d0e;});}exports[_0x4369('0x14')]=function(_0x2ab3d5,_0x469b60,_0x570117,_0x397a8d){return new Promise(function(_0x3daea9,_0x3e3f83){return getInteractionUsers(_0x2ab3d5['id'],_0x570117)[_0x4369('0x11')](function(_0x27cf56){_0x2ab3d5[_0x4369('0x15')]=_0x27cf56;return getInteractionTags(_0x2ab3d5['TagIds'],_0x469b60);})[_0x4369('0x11')](function(_0x1f8977){_0x2ab3d5[_0x4369('0x16')]=_0x1f8977;delete _0x2ab3d5[_0x4369('0x17')];return updateInteractionCounters(_0x2ab3d5);})[_0x4369('0x11')](function(_0x19ceb5){if(_0x397a8d){return getLastMessageText(_0x19ceb5);}else{return _0x19ceb5;}})[_0x4369('0x11')](function(_0x3bae4d){_0x3daea9(_0x3bae4d);})['catch'](function(_0x303b49){_0x3e3f83(_0x303b49);});});}; \ No newline at end of file +var _0x7825=['lodash','map','fullname','split','forEach','push','waiting','talking','answered','abandoned','total','disposition','UserId','unmanaged','MailMessage','findOne','out','plainBody','then','trimStart','catch','updateInteraction','Users','Tags','TagIds'];(function(_0x1d49be,_0x3ca600){var _0xac1b3f=function(_0x3eed2f){while(--_0x3eed2f){_0x1d49be['push'](_0x1d49be['shift']());}};_0xac1b3f(++_0x3ca600);}(_0x7825,0xaf));var _0x5782=function(_0xeaad17,_0xf6d4e8){_0xeaad17=_0xeaad17-0x0;var _0x2e4f6b=_0x7825[_0xeaad17];return _0x2e4f6b;};'use strict';var _=require(_0x5782('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x2049c5,_0x5721e0){return new Promise(function(_0x276945,_0x254eb9){try{var _0x597ecc=[];if(_0x5721e0[_0x2049c5]){_0x597ecc=_0x5721e0[_0x2049c5][_0x5782('0x1')](function(_0x2f267c){return{'id':_0x2f267c['id'],'fullname':_0x2f267c[_0x5782('0x2')]};});}return _0x276945(_0x597ecc);}catch(_0x5bb532){_0x254eb9(_0x5bb532);}});}function getInteractionTags(_0x3f565a,_0x142060){var _0x44a3c9=[];if(_0x3f565a){_0x3f565a[_0x5782('0x3')](',')[_0x5782('0x4')](function(_0x339624){_0x44a3c9[_0x5782('0x5')](_0x142060[_0x339624]);});}return _0x44a3c9;}function updateWaitingCounter(_0x5be6c4){if(_0x5be6c4[_0x5782('0x6')]){_0x5be6c4[_0x5782('0x6')]-=0x1;}}function updateInteractionCounters(_0xaf8a1){_0xaf8a1['waiting']=0x0;_0xaf8a1[_0x5782('0x7')]=0x0;_0xaf8a1[_0x5782('0x8')]=0x0;_0xaf8a1['unmanaged']=0x0;_0xaf8a1[_0x5782('0x9')]=0x0;_0xaf8a1[_0x5782('0xa')]=0x0;if(_0xaf8a1['closed']){if(_0xaf8a1[_0x5782('0xb')]===_0x5782('0x9')){_0xaf8a1[_0x5782('0x9')]+=0x1;updateWaitingCounter(_0xaf8a1);}if(_0xaf8a1[_0x5782('0xc')]){_0xaf8a1['answered']+=0x1;if(_0xaf8a1[_0x5782('0x7')]){_0xaf8a1[_0x5782('0x7')]-=0x1;}}else{if(_0xaf8a1[_0x5782('0xb')]){_0xaf8a1[_0x5782('0xd')]+=0x1;updateWaitingCounter(_0xaf8a1);}}}else{if(!_0xaf8a1['UserId']){_0xaf8a1['waiting']+=0x1;}if(_0xaf8a1[_0x5782('0xc')]){_0xaf8a1['talking']+=0x1;updateWaitingCounter(_0xaf8a1);}}_0xaf8a1[_0x5782('0xa')]+=0x1;return _0xaf8a1;}function getLastMessageText(_0x444511){return db[_0x5782('0xe')][_0x5782('0xf')]({'where':{'$and':[{'MailInteractionId':_0x444511['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x5782('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x5782('0x11')],'order':'-id','raw':!![]})[_0x5782('0x12')](function(_0x54745e){if(_0x54745e&&_0x54745e[_0x5782('0x11')]){_0x444511['lastMsgText']=_[_0x5782('0x13')](_0x54745e[_0x5782('0x11')]);}return _0x444511;})[_0x5782('0x14')](function(_0x4750d5){throw _0x4750d5;});}exports[_0x5782('0x15')]=function(_0x4480a5,_0x4396f8,_0x291e99,_0x550544){return new Promise(function(_0x5d3b7c,_0x210cac){return getInteractionUsers(_0x4480a5['id'],_0x291e99)[_0x5782('0x12')](function(_0x159c63){_0x4480a5[_0x5782('0x16')]=_0x159c63;return getInteractionTags(_0x4480a5['TagIds'],_0x4396f8);})[_0x5782('0x12')](function(_0x92b351){_0x4480a5[_0x5782('0x17')]=_0x92b351;delete _0x4480a5[_0x5782('0x18')];return updateInteractionCounters(_0x4480a5);})[_0x5782('0x12')](function(_0x111c73){if(_0x550544){return getLastMessageText(_0x111c73);}else{return _0x111c73;}})[_0x5782('0x12')](function(_0x4490b9){_0x5d3b7c(_0x4490b9);})[_0x5782('0x14')](function(_0x6d0ccf){_0x210cac(_0x6d0ccf);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index f1ba1b3..ecbab16 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc202=['[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','Interaction','findOne','then','update','info','catch','error','../../mysqldb','../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase'];(function(_0x25ff9b,_0x1df6ed){var _0x1234ec=function(_0x461167){while(--_0x461167){_0x25ff9b['push'](_0x25ff9b['shift']());}};_0x1234ec(++_0x1df6ed);}(_0xc202,0x14c));var _0x2c20=function(_0x2ebd83,_0x41f041){_0x2ebd83=_0x2ebd83-0x0;var _0x2fabba=_0xc202[_0x2ebd83];return _0x2fabba;};'use strict';var _=require('lodash');var db=require(_0x2c20('0x0'))['db'];var loggers={'openchannel':require(_0x2c20('0x1'))('openchannel-interactions'),'mail':require(_0x2c20('0x1'))('mail-interactions'),'fax':require('../../config/logger')(_0x2c20('0x2')),'sms':require(_0x2c20('0x1'))(_0x2c20('0x3')),'chat':require('../../config/logger')(_0x2c20('0x4')),'whatsapp':require(_0x2c20('0x1'))(_0x2c20('0x5'))};function getAccountFK(_0x21df6b){return _[_0x2c20('0x6')](_0x21df6b)+(_0x21df6b===_0x2c20('0x7')?_0x2c20('0x8'):_0x2c20('0x9'))+'Id';}function getInteractionFK(_0x50547a){return _['capitalize'](_0x50547a)+_0x2c20('0xa');}function getInteractionId(_0x3db1b2,_0xf47e,_0x5400e3){if(_0x3db1b2&&_0x3db1b2[_['upperFirst'](_0x5400e3)+_0x2c20('0xa')]){return _0x3db1b2[_[_0x2c20('0xb')](_0x5400e3)+'InteractionId'];}else if(_0x3db1b2&&_0x3db1b2['id']){return _0x3db1b2['id'];}else if(_0xf47e&&_0xf47e['id']){return _0xf47e['id'];}else{return _0x2c20('0xc');}}function getInteractionsTables(_0x148a5c){return{'accounts':_0x148a5c+'_'+(_0x148a5c===_0x2c20('0x7')?_0x2c20('0xd'):'accounts'),'interactions':_0x148a5c+_0x2c20('0xe'),'interactionsTags':_0x148a5c+_0x2c20('0xf'),'messages':_0x148a5c+_0x2c20('0x10'),'userInteractions':_0x2c20('0x11')+_0x148a5c+'_interactions'};}function getSelectedTags(_0x2c8b09){var _0x204f89=[];if(_0x2c8b09){_0x204f89=Array[_0x2c20('0x12')](_0x2c8b09)?_0x2c8b09:[_0x2c8b09];}return _0x204f89;}function log(_0x1791e5,_0x3369c7,_0x515912,_0x4ccdfd,_0x5e7f3b,_0x20bc91){loggers[_0x5e7f3b[_0x2c20('0x13')]()][_0x1791e5](_0x2c20('0x14'),_0x20bc91[_0x2c20('0x15')](),_0x3369c7?_0x3369c7['id']:null,_0x3369c7?_0x3369c7[_0x2c20('0x16')]:null,_0x3369c7?_0x3369c7['role']:null,getInteractionId(_0x515912,_0x4ccdfd,_0x5e7f3b),_0x515912?JSON[_0x2c20('0x17')](_0x515912):_0x2c20('0x18'));}function updateUser(_0x544766,_0x564312,_0x29a692,_0x642509,_0x2103d3){db[_[_0x2c20('0xb')](_0x642509)+_0x2c20('0x19')][_0x2c20('0x1a')]({'where':{'id':getInteractionId(_0x564312,_0x29a692,_0x642509)}})[_0x2c20('0x1b')](function(_0x25700a){if(_0x25700a){return _0x25700a[_0x2c20('0x1c')]({'UserId':_0x544766?_0x544766['id']:null});}})[_0x2c20('0x1b')](function(_0x5890f4){if(_0x5890f4){log(_0x2c20('0x1d'),_0x544766,_0x564312,_0x29a692,_0x642509,_0x2103d3);}})[_0x2c20('0x1e')](function(){log(_0x2c20('0x1f'),_0x544766,_0x564312,_0x29a692,_0x642509,_0x2103d3);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x3313=['catch','exports','openchannel-interactions','fax-interactions','../../config/logger','chat-interactions','whatsapp-interactions','chat','Account','InteractionId','upperFirst','unknown','accounts','_interactions','_interaction_has_tags','_messages','user_has_','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','stringify','null','Interaction','findOne','then','update','info'];(function(_0x53c2a9,_0x591554){var _0x3030a3=function(_0x120763){while(--_0x120763){_0x53c2a9['push'](_0x53c2a9['shift']());}};_0x3030a3(++_0x591554);}(_0x3313,0xec));var _0x3331=function(_0x4feaf8,_0x57df80){_0x4feaf8=_0x4feaf8-0x0;var _0x14b2ce=_0x3313[_0x4feaf8];return _0x14b2ce;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0x3331('0x0')),'mail':require('../../config/logger')('mail-interactions'),'fax':require('../../config/logger')(_0x3331('0x1')),'sms':require(_0x3331('0x2'))('sms-interactions'),'chat':require(_0x3331('0x2'))(_0x3331('0x3')),'whatsapp':require(_0x3331('0x2'))(_0x3331('0x4'))};function getAccountFK(_0x5e3ace){return _['capitalize'](_0x5e3ace)+(_0x5e3ace===_0x3331('0x5')?'Website':_0x3331('0x6'))+'Id';}function getInteractionFK(_0x24f413){return _['capitalize'](_0x24f413)+_0x3331('0x7');}function getInteractionId(_0x1b7705,_0x32f619,_0x125295){if(_0x1b7705&&_0x1b7705[_[_0x3331('0x8')](_0x125295)+_0x3331('0x7')]){return _0x1b7705[_[_0x3331('0x8')](_0x125295)+_0x3331('0x7')];}else if(_0x1b7705&&_0x1b7705['id']){return _0x1b7705['id'];}else if(_0x32f619&&_0x32f619['id']){return _0x32f619['id'];}else{return _0x3331('0x9');}}function getInteractionsTables(_0x561766){return{'accounts':_0x561766+'_'+(_0x561766===_0x3331('0x5')?'websites':_0x3331('0xa')),'interactions':_0x561766+_0x3331('0xb'),'interactionsTags':_0x561766+_0x3331('0xc'),'messages':_0x561766+_0x3331('0xd'),'userInteractions':_0x3331('0xe')+_0x561766+'_interactions'};}function getSelectedTags(_0x371b04){var _0x86fe53=[];if(_0x371b04){_0x86fe53=Array['isArray'](_0x371b04)?_0x371b04:[_0x371b04];}return _0x86fe53;}function log(_0x4e6ce8,_0x51c66a,_0x97b6ca,_0x2e9d50,_0xae020b,_0x3e0c99){loggers[_0xae020b['toLowerCase']()][_0x4e6ce8](_0x3331('0xf'),_0x3e0c99[_0x3331('0x10')](),_0x51c66a?_0x51c66a['id']:null,_0x51c66a?_0x51c66a['name']:null,_0x51c66a?_0x51c66a['role']:null,getInteractionId(_0x97b6ca,_0x2e9d50,_0xae020b),_0x97b6ca?JSON[_0x3331('0x11')](_0x97b6ca):_0x3331('0x12'));}function updateUser(_0x212ef3,_0x31e878,_0x1c35dc,_0x4737d0,_0x47a441){db[_[_0x3331('0x8')](_0x4737d0)+_0x3331('0x13')][_0x3331('0x14')]({'where':{'id':getInteractionId(_0x31e878,_0x1c35dc,_0x4737d0)}})[_0x3331('0x15')](function(_0x475082){if(_0x475082){return _0x475082[_0x3331('0x16')]({'UserId':_0x212ef3?_0x212ef3['id']:null});}})['then'](function(_0x442b4d){if(_0x442b4d){log(_0x3331('0x17'),_0x212ef3,_0x31e878,_0x1c35dc,_0x4737d0,_0x47a441);}})[_0x3331('0x18')](function(){log('error',_0x212ef3,_0x31e878,_0x1c35dc,_0x4737d0,_0x47a441);});}module[_0x3331('0x19')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 5438c0f..0c1c1ec 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 _0x96f1=['split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit','util','composable-middleware','../../config/environment','data1'];(function(_0x3fd135,_0x818346){var _0x1ab4e8=function(_0x1abc43){while(--_0x1abc43){_0x3fd135['push'](_0x3fd135['shift']());}};_0x1ab4e8(++_0x818346);}(_0x96f1,0x10a));var _0x196f=function(_0x3d4f12,_0x50b967){_0x3d4f12=_0x3d4f12-0x0;var _0x157e3f=_0x96f1[_0x3d4f12];return _0x157e3f;};'use strict';var crypto=require('crypto');var util=require(_0x196f('0x0'));var compose=require(_0x196f('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x196f('0x2'));function getValueFromLicense(_0x341422,_0x5c43cf){if(_0x341422&&_0x5c43cf){if(_0x5c43cf[_0x196f('0x3')]&&_0x5c43cf['license']){var _0xd756d6=_0x5c43cf[_0x196f('0x3')];var _0x5d843f=_0x5c43cf['license'];var _0x5da0c6=_0xd756d6[_0x196f('0x4')]('-')[0x4];var _0x44dc45=_0xd756d6[_0x196f('0x4')]('-')[0x0];var _0x37ba66=crypto[_0x196f('0x5')](_0x196f('0x6'),util[_0x196f('0x7')](_0x196f('0x8'),_0x5da0c6,_0xd756d6,_0x44dc45));var _0x3d3d23=_0x37ba66['update'](_0x5d843f,_0x196f('0x9'),_0x196f('0xa'));_0x3d3d23+=_0x37ba66[_0x196f('0xb')]('utf8');var _0x1fb6a7=JSON[_0x196f('0xc')](_0x3d3d23);return _0x1fb6a7[_0x196f('0xd')](_0x341422)?_0x1fb6a7[_0x341422]:null;}}return null;}function isLimit(_0x587d26,_0x5e2d3f,_0x330cbc,_0x45ae52){var _0x3f5334=_0x5e2d3f;return compose()[_0x196f('0xe')](function(_0x46c6c7,_0x12f0f6,_0x1d5a65){return db[_0x196f('0xf')][_0x196f('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x196f('0x11')](function(_0x52d141){var _0xbaf4c5=getValueFromLicense(_0x587d26,_0x52d141);return _0xbaf4c5?_0xbaf4c5:_0x3f5334;})['then'](function(_0x5141d3){_0x3f5334=_0x5141d3;return _0x330cbc[_0x196f('0x12')](_0x45ae52);})[_0x196f('0x11')](function(_0x2eee4c){if(_0x2eee4c>=_0x3f5334){return _0x12f0f6[_0x196f('0x13')](0x193)[_0x196f('0x14')]({'message':util[_0x196f('0x7')](_0x196f('0x15'),_0x587d26)});}_0x1d5a65();})[_0x196f('0x16')](function(_0x4866ab){_0x1d5a65(_0x4866ab);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x196f('0x17')],{'where':{'$or':[{'role':_0x196f('0x18')},{'role':_0x196f('0x19')}]}});}exports[_0x196f('0x1a')]=isUserLimit; \ No newline at end of file +var _0x0e03=['license','split','aes-256-ctr','format','utf8','parse','hasOwnProperty','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','isUserLimit','crypto','util','composable-middleware','../../mysqldb','data1'];(function(_0xfe1386,_0x4cf0d4){var _0x42b267=function(_0x43e869){while(--_0x43e869){_0xfe1386['push'](_0xfe1386['shift']());}};_0x42b267(++_0x4cf0d4);}(_0x0e03,0x1c7));var _0x30e0=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0x0e03[_0x100682];return _0xcb6e87;};'use strict';var crypto=require(_0x30e0('0x0'));var util=require(_0x30e0('0x1'));var compose=require(_0x30e0('0x2'));var db=require(_0x30e0('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x3a05b3,_0x400c21){if(_0x3a05b3&&_0x400c21){if(_0x400c21[_0x30e0('0x4')]&&_0x400c21[_0x30e0('0x5')]){var _0x548490=_0x400c21[_0x30e0('0x4')];var _0x2ec19d=_0x400c21['license'];var _0x321915=_0x548490[_0x30e0('0x6')]('-')[0x4];var _0x559f6b=_0x548490[_0x30e0('0x6')]('-')[0x0];var _0x342bf2=crypto['createDecipher'](_0x30e0('0x7'),util[_0x30e0('0x8')]('%s:%s:%s',_0x321915,_0x548490,_0x559f6b));var _0x5a5e83=_0x342bf2['update'](_0x2ec19d,'base64',_0x30e0('0x9'));_0x5a5e83+=_0x342bf2['final']('utf8');var _0x8c5a9a=JSON[_0x30e0('0xa')](_0x5a5e83);return _0x8c5a9a[_0x30e0('0xb')](_0x3a05b3)?_0x8c5a9a[_0x3a05b3]:null;}}return null;}function isLimit(_0x131bf3,_0x46cbfd,_0xd073e7,_0x3ac18b){var _0x1587fb=_0x46cbfd;return compose()['use'](function(_0x517631,_0x12eda7,_0x12494a){return db[_0x30e0('0xc')][_0x30e0('0xd')]({'where':{'id':0x1},'raw':!![]})[_0x30e0('0xe')](function(_0x2798d5){var _0x14ca70=getValueFromLicense(_0x131bf3,_0x2798d5);return _0x14ca70?_0x14ca70:_0x1587fb;})[_0x30e0('0xe')](function(_0x1ee8d1){_0x1587fb=_0x1ee8d1;return _0xd073e7[_0x30e0('0xf')](_0x3ac18b);})[_0x30e0('0xe')](function(_0x4234c3){if(_0x4234c3>=_0x1587fb){return _0x12eda7[_0x30e0('0x10')](0x193)[_0x30e0('0x11')]({'message':util['format'](_0x30e0('0x12'),_0x131bf3)});}_0x12494a();})['catch'](function(_0x16fa97){_0x12494a(_0x16fa97);});});}function isUserLimit(){return isLimit(_0x30e0('0x13'),0x1,db[_0x30e0('0x14')],{'where':{'$or':[{'role':_0x30e0('0x15')},{'role':'user'}]}});}exports[_0x30e0('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 8b47bcd..c77eae2 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 _0x4180=['$lte','add','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','shift','pop','utcOffset','hours','minutes','seconds','lodash','sqlOperator','startsWith','[$or]','replace','split','length','match','forEach','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','value','$gt'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4180,0x137));var _0x0418=function(_0x450a2c,_0x32600a){_0x450a2c=_0x450a2c-0x0;var _0x527dd5=_0x4180[_0x450a2c];return _0x527dd5;};'use strict';var _=require(_0x0418('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x2121cb){var _0x5b86cf={'conditions':[]};_0x5b86cf[_0x0418('0x1')]=_[_0x0418('0x2')](_0x2121cb,_0x0418('0x3'))?'or':'and';var _0x54ed74=_0x2121cb[_0x0418('0x4')]('[$and]','')[_0x0418('0x4')](_0x0418('0x3'),'')[_0x0418('0x5')]('||');for(var _0x612be7=0x0;_0x612be7<_0x54ed74[_0x0418('0x6')];_0x612be7++){var _0x430a0d=_0x54ed74[_0x612be7][_0x0418('0x5')](':=');var _0x254c8f=_0x430a0d[0x0];var _0x285b3e=_0x430a0d['slice'](0x1);_0x285b3e['forEach'](function(_0x552300){var _0x4caeff=_0x552300['split']('[')['shift']();var _0x519f71=_0x552300[_0x0418('0x7')](/\[(.*?)\]/g);_0x519f71[_0x0418('0x8')](function(_0x5c4a77){var _0x3bcff0=_0x5c4a77[_0x0418('0x5')]('[')['filter'](function(_0x38c974){return _0x38c974[_0x0418('0x9')](']')>-0x1;})[_0x0418('0xa')](function(_0x2242fa){return _0x2242fa[_0x0418('0x5')](']')[0x0];})[0x0];_0x5b86cf[_0x0418('0xb')][_0x0418('0xc')]({'field':_0x254c8f,'operator':_0x4caeff,'value':_0x3bcff0});});});}return _0x5b86cf;};exports[_0x0418('0xd')]=function(_0xdfd503,_0x409003,_0x3be4e1){var _0x1abdad={};if(_0x409003===_0x0418('0xe')){if(_0x3be4e1[_0x0418('0xf')]===_0x0418('0x10')){_0x3be4e1[_0x0418('0xf')]='$between';_0x3be4e1[_0x0418('0x11')]+=','+_0x3be4e1[_0x0418('0x11')];}else if(_['includes']([_0x0418('0x12'),_0x0418('0x13')],_0x3be4e1[_0x0418('0xf')])){_0x3be4e1[_0x0418('0x11')]=moment(_0x3be4e1[_0x0418('0x11')])[_0x0418('0x14')](0x1,'days')[_0x0418('0x15')](_0x0418('0x16'));}}if(_0x3be4e1[_0x0418('0x17')]){_0x409003=_0x3be4e1[_0x0418('0x17')];_0x1abdad[_0x0418('0x18')]=_0x0418('0x19')+_0xdfd503+'.'+_0x3be4e1[_0x0418('0x1a')]+_0x0418('0x1b')+_0x3be4e1[_0x0418('0x17')]+')\x20'+parseOperator(_0x3be4e1[_0x0418('0xf')]);}else{_0x1abdad[_0x0418('0x18')]=_0xdfd503+'.'+_0x3be4e1[_0x0418('0x1a')]+'\x20'+parseOperator(_0x3be4e1[_0x0418('0xf')]);}if(_[_0x0418('0x1c')]([_0x0418('0x1d'),_0x0418('0x1e')],_0x3be4e1[_0x0418('0xf')]))_0x1abdad[_0x0418('0x18')]='('+_0x1abdad[_0x0418('0x18')]+_0x0418('0x1f')+_0xdfd503+'.'+_0x3be4e1[_0x0418('0x1a')]+_0x0418('0x20');_0x1abdad[_0x0418('0x11')]=parseValue(_0x409003,_0x3be4e1[_0x0418('0xf')],_0x3be4e1[_0x0418('0x11')]);return _0x1abdad;};function parseOperator(_0x58d438){var _0x12a501;switch(_0x58d438){case _0x0418('0x21'):_0x12a501='IN\x20?';break;case _0x0418('0x1e'):_0x12a501='NOT\x20IN\x20?';break;case _0x0418('0x10'):_0x12a501=_0x0418('0x22');break;case'$ne':_0x12a501=_0x0418('0x23');break;case _0x0418('0x24'):case _0x0418('0x25'):case _0x0418('0x26'):_0x12a501=_0x0418('0x27');break;case _0x0418('0x28'):_0x12a501=_0x0418('0x29');break;case _0x0418('0x12'):_0x12a501=_0x0418('0x2a');break;case _0x0418('0x13'):_0x12a501=_0x0418('0x2b');break;case _0x0418('0x2c'):_0x12a501=_0x0418('0x2d');break;case _0x0418('0x2e'):_0x12a501=_0x0418('0x2f');break;}return _0x12a501;}function parseValue(_0xc7ef2a,_0x129ec6,_0x14c12a){var _0x375d06={'start':undefined,'end':undefined};switch(_0x129ec6){case _0x0418('0x21'):case'$notIn':_0x375d06[_0x0418('0x30')]=_0x14c12a[_0x0418('0x5')](',');break;case'$substring':_0x375d06['start']='%'+_0x14c12a+'%';break;case'$startsWith':_0x375d06[_0x0418('0x30')]=_0x14c12a+'%';break;case _0x0418('0x26'):_0x375d06[_0x0418('0x30')]='%'+_0x14c12a;break;case _0x0418('0x2e'):var _0x2c89a3=_0x14c12a[_0x0418('0x5')](',');var _0x14c12a=_0x2c89a3[_0x0418('0x31')]();var _0x51c165=_0x2c89a3[_0x0418('0x32')]();if(_0xc7ef2a===_0x0418('0xe')){_0x14c12a=moment(_0x14c12a)['utcOffset'](0x0,!![])['format']();_0x51c165=moment(_0x51c165)[_0x0418('0x33')](0x0,!![])[_0x0418('0x14')](0x17,_0x0418('0x34'))[_0x0418('0x14')](0x3b,_0x0418('0x35'))[_0x0418('0x14')](0x3b,_0x0418('0x36'))['format']();}_0x375d06={'start':_0x14c12a,'end':_0x51c165};break;default:_0x375d06['start']=_0x14c12a;break;}return _0x375d06;} \ No newline at end of file +var _0xbe4d=['=\x20?','<>\x20?','$startsWith','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$in','start','$substring','pop','hours','minutes','seconds','moment','sqlOperator','[$or]','and','replace','[$and]','length','split','forEach','shift','match','filter','indexOf','map','DATE','$eq','operator','includes','$gt','$lte','value','add','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?'];(function(_0x197b67,_0x1b1dd7){var _0x5700d3=function(_0x45aa99){while(--_0x45aa99){_0x197b67['push'](_0x197b67['shift']());}};_0x5700d3(++_0x1b1dd7);}(_0xbe4d,0xdd));var _0xdbe4=function(_0x2855bf,_0x5654d4){_0x2855bf=_0x2855bf-0x0;var _0x2e9f48=_0xbe4d[_0x2855bf];return _0x2e9f48;};'use strict';var _=require('lodash');var moment=require(_0xdbe4('0x0'));exports['parseSearch']=function(_0x2b266f){var _0x44bd7d={'conditions':[]};_0x44bd7d[_0xdbe4('0x1')]=_['startsWith'](_0x2b266f,_0xdbe4('0x2'))?'or':_0xdbe4('0x3');var _0x1fb303=_0x2b266f[_0xdbe4('0x4')](_0xdbe4('0x5'),'')['replace'](_0xdbe4('0x2'),'')['split']('||');for(var _0x2b7577=0x0;_0x2b7577<_0x1fb303[_0xdbe4('0x6')];_0x2b7577++){var _0x334864=_0x1fb303[_0x2b7577][_0xdbe4('0x7')](':=');var _0x4ed147=_0x334864[0x0];var _0x2efc58=_0x334864['slice'](0x1);_0x2efc58[_0xdbe4('0x8')](function(_0x4d061c){var _0x2b7d81=_0x4d061c[_0xdbe4('0x7')]('[')[_0xdbe4('0x9')]();var _0x4a54bd=_0x4d061c[_0xdbe4('0xa')](/\[(.*?)\]/g);_0x4a54bd[_0xdbe4('0x8')](function(_0x42da21){var _0x5cd0e7=_0x42da21[_0xdbe4('0x7')]('[')[_0xdbe4('0xb')](function(_0x23966e){return _0x23966e[_0xdbe4('0xc')](']')>-0x1;})[_0xdbe4('0xd')](function(_0x58ea31){return _0x58ea31['split'](']')[0x0];})[0x0];_0x44bd7d['conditions']['push']({'field':_0x4ed147,'operator':_0x2b7d81,'value':_0x5cd0e7});});});}return _0x44bd7d;};exports['buildExpression']=function(_0x38496b,_0x24dcbf,_0x39fe7f){var _0x18a77f={};if(_0x24dcbf===_0xdbe4('0xe')){if(_0x39fe7f['operator']===_0xdbe4('0xf')){_0x39fe7f[_0xdbe4('0x10')]='$between';_0x39fe7f['value']+=','+_0x39fe7f['value'];}else if(_[_0xdbe4('0x11')]([_0xdbe4('0x12'),_0xdbe4('0x13')],_0x39fe7f[_0xdbe4('0x10')])){_0x39fe7f[_0xdbe4('0x14')]=moment(_0x39fe7f[_0xdbe4('0x14')])[_0xdbe4('0x15')](0x1,'days')[_0xdbe4('0x16')](_0xdbe4('0x17'));}}if(_0x39fe7f[_0xdbe4('0x18')]){_0x24dcbf=_0x39fe7f[_0xdbe4('0x18')];_0x18a77f[_0xdbe4('0x19')]=_0xdbe4('0x1a')+_0x38496b+'.'+_0x39fe7f[_0xdbe4('0x1b')]+'\x20AS\x20'+_0x39fe7f['castTo']+')\x20'+parseOperator(_0x39fe7f['operator']);}else{_0x18a77f[_0xdbe4('0x19')]=_0x38496b+'.'+_0x39fe7f[_0xdbe4('0x1b')]+'\x20'+parseOperator(_0x39fe7f['operator']);}if(_['includes']([_0xdbe4('0x1c'),_0xdbe4('0x1d')],_0x39fe7f[_0xdbe4('0x10')]))_0x18a77f[_0xdbe4('0x19')]='('+_0x18a77f[_0xdbe4('0x19')]+_0xdbe4('0x1e')+_0x38496b+'.'+_0x39fe7f[_0xdbe4('0x1b')]+_0xdbe4('0x1f');_0x18a77f[_0xdbe4('0x14')]=parseValue(_0x24dcbf,_0x39fe7f[_0xdbe4('0x10')],_0x39fe7f[_0xdbe4('0x14')]);return _0x18a77f;};function parseOperator(_0xfd855c){var _0x13e327;switch(_0xfd855c){case'$in':_0x13e327=_0xdbe4('0x20');break;case _0xdbe4('0x1d'):_0x13e327=_0xdbe4('0x21');break;case'$eq':_0x13e327=_0xdbe4('0x22');break;case'$ne':_0x13e327=_0xdbe4('0x23');break;case'$substring':case _0xdbe4('0x24'):case _0xdbe4('0x25'):_0x13e327='LIKE\x20?';break;case _0xdbe4('0x26'):_0x13e327=_0xdbe4('0x27');break;case _0xdbe4('0x12'):_0x13e327=_0xdbe4('0x28');break;case _0xdbe4('0x13'):_0x13e327=_0xdbe4('0x29');break;case _0xdbe4('0x2a'):_0x13e327=_0xdbe4('0x2b');break;case'$between':_0x13e327='BETWEEN\x20?\x20AND\x20?';break;}return _0x13e327;}function parseValue(_0x1850ed,_0x42047e,_0x40e422){var _0x2f41f1={'start':undefined,'end':undefined};switch(_0x42047e){case _0xdbe4('0x2c'):case _0xdbe4('0x1d'):_0x2f41f1[_0xdbe4('0x2d')]=_0x40e422[_0xdbe4('0x7')](',');break;case _0xdbe4('0x2e'):_0x2f41f1[_0xdbe4('0x2d')]='%'+_0x40e422+'%';break;case'$startsWith':_0x2f41f1[_0xdbe4('0x2d')]=_0x40e422+'%';break;case _0xdbe4('0x25'):_0x2f41f1[_0xdbe4('0x2d')]='%'+_0x40e422;break;case'$between':var _0x2100be=_0x40e422[_0xdbe4('0x7')](',');var _0x40e422=_0x2100be[_0xdbe4('0x9')]();var _0x598bdf=_0x2100be[_0xdbe4('0x2f')]();if(_0x1850ed===_0xdbe4('0xe')){_0x40e422=moment(_0x40e422)['utcOffset'](0x0,!![])[_0xdbe4('0x16')]();_0x598bdf=moment(_0x598bdf)['utcOffset'](0x0,!![])[_0xdbe4('0x15')](0x17,_0xdbe4('0x30'))[_0xdbe4('0x15')](0x3b,_0xdbe4('0x31'))['add'](0x3b,_0xdbe4('0x32'))[_0xdbe4('0x16')]();}_0x2f41f1={'start':_0x40e422,'end':_0x598bdf};break;default:_0x2f41f1['start']=_0x40e422;break;}return _0x2f41f1;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 3050ab0..02c644b 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 _0xd6d6=['merge','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','isEmpty','forOwn','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','utc','uniqueid','isArray','split','limit','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isObject','isString','hasOwnProperty','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','push','getOptions','$id','query','model','name','filters','intersection','attributes','nolimit','offset','order','where','pick','filter','object','columns','value'];(function(_0x2f6cfa,_0x5a8b2c){var _0x345a7d=function(_0x4be0b8){while(--_0x4be0b8){_0x2f6cfa['push'](_0x2f6cfa['shift']());}};_0x345a7d(++_0x5a8b2c);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x29dd43,_0x34c537){_0x29dd43=_0x29dd43-0x0;var _0x3905e1=_0xd6d6[_0x29dd43];return _0x3905e1;};'use strict';var _=require(_0x6d6d('0x0'));var sequelize=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x33226e){var _0x536523=['ne'];try{var _0x2e1aed=JSON[_0x6d6d('0x3')](_0x33226e);var _0x1b8610=Object[_0x6d6d('0x4')](_0x2e1aed)[0x0];return _0x536523[_0x6d6d('0x5')](_0x1b8610);}catch(_0x16e259){return![];}}function getOperatorValue(_0x35a813){var _0x5702dc=JSON[_0x6d6d('0x3')](_0x35a813);var _0x1bf731=Object[_0x6d6d('0x4')](_0x5702dc)[0x0];var _0x18f824=_0x5702dc[_0x1bf731];return{['$'+_0x1bf731]:_0x18f824};}exports[_0x6d6d('0x6')]=function(_0x408f88){var _0x3e69a4=null;if(_0x408f88){_0x3e69a4=_0x408f88['split'](',');}return _0x3e69a4;};exports['filters']=function(_0x404c88,_0x1fa46d){var _0x23b18a={};if(!_[_0x6d6d('0x7')](_0x404c88)){_[_0x6d6d('0x8')](_0x404c88,function(_0x576c88,_0x1f2b86){try{if(_0x1fa46d){var _0x158f82=_['find'](_0x1fa46d,{'name':_0x1f2b86})||{};if(hasSequelizeOperator(_0x576c88)){_0x23b18a[_0x1f2b86]=getOperatorValue(_0x576c88);}else if(_0x158f82['type']===_0x6d6d('0x9')&&_[_0x6d6d('0xa')](_0x576c88)){var _0xe61c36=JSON[_0x6d6d('0x3')](_0x576c88);var _0x2b74ed={'$gte':moment(moment(_0xe61c36[_0x6d6d('0xb')])[_0x6d6d('0xc')](_0x6d6d('0xd')))['utc']()[_0x6d6d('0xc')](),'$lte':moment(moment(_0xe61c36[_0x6d6d('0xe')])[_0x6d6d('0xc')](_0x6d6d('0xd')))[_0x6d6d('0xf')]()['subtract'](0x1,'s')[_0x6d6d('0xc')]()};_0x23b18a[_0x1f2b86]=_0x2b74ed;}else if(_0x158f82['name']===_0x6d6d('0x10')){_0x23b18a[_0x1f2b86]=_0x576c88;}else{_0x23b18a[_0x1f2b86]=_[_0x6d6d('0x11')](_0x576c88)?_0x576c88:JSON[_0x6d6d('0x3')](_0x576c88);}}else{_0x23b18a[_0x1f2b86]=_['isArray'](_0x576c88)?_0x576c88:JSON['parse'](_0x576c88);}}catch(_0x9e1e18){_0x23b18a[_0x1f2b86]=_0x576c88[_0x6d6d('0x12')](',');}});}return _0x23b18a;};exports[_0x6d6d('0x13')]=function(_0x2c5314){_0x2c5314=parseInt(_0x2c5314,0xa);if(!_0x2c5314||_0x2c5314<0x0){_0x2c5314=LIMIT_VALUE;}return _0x2c5314;};exports['offset']=function(_0x554392){_0x554392=parseInt(_0x554392,0xa);if(!_0x554392||_0x554392<0x0){_0x554392=0x0;}return _0x554392;};exports[_0x6d6d('0x14')]=function(_0x5a5855){var _0x26f631,_0xb8590d=null;if(_0x5a5855){_0x26f631=_0x5a5855[_0x6d6d('0x12')](',');_0xb8590d=_[_0x6d6d('0x15')](_0x26f631,function(_0x40d35b){if(_0x40d35b[_0x6d6d('0x16')]('-')===0x0){return[_0x40d35b===_0x6d6d('0x17')?sequelize[_0x6d6d('0x18')](sequelize[_0x6d6d('0x19')](_0x6d6d('0x17')),_0x6d6d('0x1a')):_0x40d35b[_0x6d6d('0x1b')](0x1),_0x6d6d('0x1c')];}else{return[_0x40d35b===_0x6d6d('0x17')?sequelize[_0x6d6d('0x18')](sequelize[_0x6d6d('0x19')](_0x6d6d('0x17')),'unsigned'):_0x40d35b,_0x6d6d('0x1d')];}});}return _0xb8590d;};exports[_0x6d6d('0x1e')]=function(_0x99f7d6,_0x97ec9e){if(_[_0x6d6d('0x7')](_0x99f7d6)){return _0x99f7d6;}if(_[_0x6d6d('0x11')](_0x99f7d6)){for(var _0x554f8e=0x0;_0x554f8e<_0x99f7d6[_0x6d6d('0x1f')];_0x554f8e+=0x1){_0x99f7d6[_0x554f8e]=this[_0x6d6d('0x1e')](_0x99f7d6[_0x554f8e],_0x97ec9e);}return _0x99f7d6;}if(!_[_0x6d6d('0x20')](_0x99f7d6)){return _0x99f7d6;}if(_[_0x6d6d('0x21')](_0x97ec9e)){_0x97ec9e=[_0x97ec9e];}if(!_[_0x6d6d('0x11')](_0x97ec9e)){return _0x99f7d6;}for(var _0x408f98=0x0;_0x408f98<_0x97ec9e[_0x6d6d('0x1f')];_0x408f98+=0x1){_['unset'](_0x99f7d6,_0x97ec9e[_0x408f98]);}for(var _0x298408 in _0x99f7d6){if(_0x99f7d6[_0x6d6d('0x22')](_0x298408)){_0x99f7d6[_0x298408]=this['omit'](_0x99f7d6[_0x298408],_0x97ec9e);}}return _0x99f7d6;};exports['isNumeric']=function(_0x3edcce){return _0x3edcce[_0x6d6d('0x23')](RegExp(_0x6d6d('0x24')))?!![]:![];};exports['isEmail']=function(_0xde3272){return _0xde3272[_0x6d6d('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0x6d6d('0x25')]=function(_0x1c8340){var _0x64d1f7=[];_0x1c8340[_0x6d6d('0x12')](/[ ,]+/)[_0x6d6d('0x26')](function(_0x359cfd){_0x359cfd=_0x359cfd[_0x6d6d('0x27')](/([^:]")"+/g,'$1');_0x359cfd='+'+_0x359cfd+'*';var _0x34050a=/[ `!@#$%^&*()_\-?~]/;if(_0x359cfd['match'](_0x34050a))_0x359cfd='\x22'+_0x359cfd+'\x22';_0x64d1f7[_0x6d6d('0x28')](_0x359cfd);});return _0x64d1f7['join']('\x20');};exports[_0x6d6d('0x29')]=function(_0x1ea9b2,_0xf527da,_0x2814ed){var _0x5c6248={},_0x182441={};if(_0xf527da['query'][_0x6d6d('0x2a')]){_0xf527da[_0x6d6d('0x2b')]['id']=_0xf527da['query'][_0x6d6d('0x2a')];delete _0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x2a')];}_0x5c6248[_0x6d6d('0x2c')]=_[_0x6d6d('0x15')](_0x1ea9b2,_0x6d6d('0x2d'));_0x5c6248[_0x6d6d('0x2b')]=_[_0x6d6d('0x4')](_0xf527da[_0x6d6d('0x2b')]);_0x5c6248[_0x6d6d('0x2e')]=_[_0x6d6d('0x2f')](_0x5c6248[_0x6d6d('0x2c')],_0x5c6248[_0x6d6d('0x2b')]);_0x182441[_0x6d6d('0x30')]=_['intersection'](_0x5c6248[_0x6d6d('0x2c')],this[_0x6d6d('0x6')](_0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x6')]));_0x182441['attributes']=_0x182441['attributes'][_0x6d6d('0x1f')]?_0x182441[_0x6d6d('0x30')]:_0x5c6248[_0x6d6d('0x2c')];if(!_0xf527da['query'][_0x6d6d('0x22')](_0x6d6d('0x31'))){_0x182441[_0x6d6d('0x13')]=this[_0x6d6d('0x13')](_0xf527da['query']['limit']);_0x182441['offset']=this[_0x6d6d('0x32')](_0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x32')]);}_0x182441[_0x6d6d('0x33')]=this['sort'](_0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x14')]);_0x182441[_0x6d6d('0x34')]=this[_0x6d6d('0x2e')](_[_0x6d6d('0x35')](_0xf527da[_0x6d6d('0x2b')],_0x5c6248['filters']),_0x1ea9b2);if(_0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x36')]){var _0x42aff0=_0x1ea9b2;var _0x1f4160=_0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x36')];if(typeof _0x1f4160===_0x6d6d('0x37')){_0x42aff0=_['filter'](_0x1ea9b2,function(_0x2d5cdd){return _[_0x6d6d('0x5')](_0x1f4160[_0x6d6d('0x38')],_0x2d5cdd[_0x6d6d('0x2d')]);});_0x1f4160=_0x1f4160[_0x6d6d('0x39')];}_0x182441['where']=_[_0x6d6d('0x3a')](_0x182441[_0x6d6d('0x34')],{'$or':_['map'](_0x42aff0,function(_0x452de2){if(_0x452de2['type']!==_0x6d6d('0x3b')){if(_0x2814ed){return sequelize[_0x6d6d('0x34')](sequelize['fn']('lower',sequelize[_0x6d6d('0x19')](_0x452de2[_0x6d6d('0x2d')])),{'$like':sequelize['fn'](_0x6d6d('0x3c'),'%'+_0xf527da[_0x6d6d('0x2b')][_0x6d6d('0x36')]+'%')});}else{var _0x513506={};_0x513506[_0x452de2['name']]={'$like':'%'+_0xf527da[_0x6d6d('0x2b')]['filter']+'%'};return _0x513506;}}})});}_0x182441=_['merge']({},_0x182441,_0xf527da[_0x6d6d('0x3d')]);return _0x182441;}; \ No newline at end of file +var _0x723e=['order','sort','where','pick','filter','object','value','VIRTUAL','lower','merge','options','sequelize','moment','parse','keys','includes','fields','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','utc','format','$lte','YYYY-MM-DD','subtract','name','uniqueid','isArray','split','limit','offset','map','priority','col','unsigned','substr','DESC','cast','ASC','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','forEach','push','join','getOptions','query','$id','model','intersection','attributes','nolimit'];(function(_0x262b75,_0x4c979c){var _0x3504b3=function(_0x542ef4){while(--_0x542ef4){_0x262b75['push'](_0x262b75['shift']());}};_0x3504b3(++_0x4c979c);}(_0x723e,0x179));var _0xe723=function(_0x18e847,_0x255dbf){_0x18e847=_0x18e847-0x0;var _0x1c4f5d=_0x723e[_0x18e847];return _0x1c4f5d;};'use strict';var _=require('lodash');var sequelize=require(_0xe723('0x0'));var moment=require(_0xe723('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x21d00c){var _0x161d6b=['ne'];try{var _0x2801c5=JSON[_0xe723('0x2')](_0x21d00c);var _0x39e35c=Object[_0xe723('0x3')](_0x2801c5)[0x0];return _0x161d6b[_0xe723('0x4')](_0x39e35c);}catch(_0x10aa61){return![];}}function getOperatorValue(_0x4b1c43){var _0x32d689=JSON[_0xe723('0x2')](_0x4b1c43);var _0x1335cd=Object[_0xe723('0x3')](_0x32d689)[0x0];var _0x2aebbd=_0x32d689[_0x1335cd];return{['$'+_0x1335cd]:_0x2aebbd};}exports[_0xe723('0x5')]=function(_0x1b46e0){var _0x1f07f3=null;if(_0x1b46e0){_0x1f07f3=_0x1b46e0['split'](',');}return _0x1f07f3;};exports[_0xe723('0x6')]=function(_0x270346,_0x34831f){var _0x5a43fb={};if(!_[_0xe723('0x7')](_0x270346)){_[_0xe723('0x8')](_0x270346,function(_0xcf68e2,_0x583291){try{if(_0x34831f){var _0x146098=_[_0xe723('0x9')](_0x34831f,{'name':_0x583291})||{};if(hasSequelizeOperator(_0xcf68e2)){_0x5a43fb[_0x583291]=getOperatorValue(_0xcf68e2);}else if(_0x146098[_0xe723('0xa')]===_0xe723('0xb')&&_[_0xe723('0xc')](_0xcf68e2)){var _0x5c066c=JSON[_0xe723('0x2')](_0xcf68e2);var _0x4bfbc1={'$gte':moment(moment(_0x5c066c['$gte'])['format']('YYYY-MM-DD'))[_0xe723('0xd')]()[_0xe723('0xe')](),'$lte':moment(moment(_0x5c066c[_0xe723('0xf')])[_0xe723('0xe')](_0xe723('0x10')))['utc']()[_0xe723('0x11')](0x1,'s')[_0xe723('0xe')]()};_0x5a43fb[_0x583291]=_0x4bfbc1;}else if(_0x146098[_0xe723('0x12')]===_0xe723('0x13')){_0x5a43fb[_0x583291]=_0xcf68e2;}else{_0x5a43fb[_0x583291]=_[_0xe723('0x14')](_0xcf68e2)?_0xcf68e2:JSON[_0xe723('0x2')](_0xcf68e2);}}else{_0x5a43fb[_0x583291]=_[_0xe723('0x14')](_0xcf68e2)?_0xcf68e2:JSON[_0xe723('0x2')](_0xcf68e2);}}catch(_0x17e2c1){_0x5a43fb[_0x583291]=_0xcf68e2[_0xe723('0x15')](',');}});}return _0x5a43fb;};exports[_0xe723('0x16')]=function(_0x3012cf){_0x3012cf=parseInt(_0x3012cf,0xa);if(!_0x3012cf||_0x3012cf<0x0){_0x3012cf=LIMIT_VALUE;}return _0x3012cf;};exports[_0xe723('0x17')]=function(_0x367782){_0x367782=parseInt(_0x367782,0xa);if(!_0x367782||_0x367782<0x0){_0x367782=0x0;}return _0x367782;};exports['sort']=function(_0x5b2308){var _0x31c839,_0x1ed6fb=null;if(_0x5b2308){_0x31c839=_0x5b2308['split'](',');_0x1ed6fb=_[_0xe723('0x18')](_0x31c839,function(_0x2762e2){if(_0x2762e2['indexOf']('-')===0x0){return[_0x2762e2===_0xe723('0x19')?sequelize['cast'](sequelize[_0xe723('0x1a')](_0xe723('0x19')),_0xe723('0x1b')):_0x2762e2[_0xe723('0x1c')](0x1),_0xe723('0x1d')];}else{return[_0x2762e2===_0xe723('0x19')?sequelize[_0xe723('0x1e')](sequelize[_0xe723('0x1a')](_0xe723('0x19')),_0xe723('0x1b')):_0x2762e2,_0xe723('0x1f')];}});}return _0x1ed6fb;};exports[_0xe723('0x20')]=function(_0x5c4fb4,_0x384786){if(_['isEmpty'](_0x5c4fb4)){return _0x5c4fb4;}if(_[_0xe723('0x14')](_0x5c4fb4)){for(var _0x3ffa15=0x0;_0x3ffa15<_0x5c4fb4[_0xe723('0x21')];_0x3ffa15+=0x1){_0x5c4fb4[_0x3ffa15]=this[_0xe723('0x20')](_0x5c4fb4[_0x3ffa15],_0x384786);}return _0x5c4fb4;}if(!_[_0xe723('0x22')](_0x5c4fb4)){return _0x5c4fb4;}if(_['isString'](_0x384786)){_0x384786=[_0x384786];}if(!_[_0xe723('0x14')](_0x384786)){return _0x5c4fb4;}for(var _0x52feb9=0x0;_0x52feb9<_0x384786['length'];_0x52feb9+=0x1){_[_0xe723('0x23')](_0x5c4fb4,_0x384786[_0x52feb9]);}for(var _0x511c74 in _0x5c4fb4){if(_0x5c4fb4[_0xe723('0x24')](_0x511c74)){_0x5c4fb4[_0x511c74]=this[_0xe723('0x20')](_0x5c4fb4[_0x511c74],_0x384786);}}return _0x5c4fb4;};exports[_0xe723('0x25')]=function(_0x4d55cc){return _0x4d55cc[_0xe723('0x26')](RegExp(_0xe723('0x27')))?!![]:![];};exports['isEmail']=function(_0x3c8c56){return _0x3c8c56['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x312dc9){var _0x2c2240=[];_0x312dc9[_0xe723('0x15')](/[ ,]+/)[_0xe723('0x28')](function(_0x49788a){_0x49788a=_0x49788a['replace'](/([^:]")"+/g,'$1');_0x49788a='+'+_0x49788a+'*';var _0x1d1146=/[ `!@#$%^&*()_\-?~]/;if(_0x49788a['match'](_0x1d1146))_0x49788a='\x22'+_0x49788a+'\x22';_0x2c2240[_0xe723('0x29')](_0x49788a);});return _0x2c2240[_0xe723('0x2a')]('\x20');};exports[_0xe723('0x2b')]=function(_0xb91a9c,_0x8ced18,_0x26497e){var _0x4706d4={},_0x163549={};if(_0x8ced18[_0xe723('0x2c')][_0xe723('0x2d')]){_0x8ced18[_0xe723('0x2c')]['id']=_0x8ced18[_0xe723('0x2c')][_0xe723('0x2d')];delete _0x8ced18[_0xe723('0x2c')]['$id'];}_0x4706d4[_0xe723('0x2e')]=_['map'](_0xb91a9c,_0xe723('0x12'));_0x4706d4[_0xe723('0x2c')]=_['keys'](_0x8ced18['query']);_0x4706d4[_0xe723('0x6')]=_[_0xe723('0x2f')](_0x4706d4[_0xe723('0x2e')],_0x4706d4[_0xe723('0x2c')]);_0x163549[_0xe723('0x30')]=_[_0xe723('0x2f')](_0x4706d4['model'],this[_0xe723('0x5')](_0x8ced18[_0xe723('0x2c')][_0xe723('0x5')]));_0x163549[_0xe723('0x30')]=_0x163549[_0xe723('0x30')][_0xe723('0x21')]?_0x163549[_0xe723('0x30')]:_0x4706d4[_0xe723('0x2e')];if(!_0x8ced18[_0xe723('0x2c')][_0xe723('0x24')](_0xe723('0x31'))){_0x163549[_0xe723('0x16')]=this[_0xe723('0x16')](_0x8ced18[_0xe723('0x2c')][_0xe723('0x16')]);_0x163549[_0xe723('0x17')]=this['offset'](_0x8ced18[_0xe723('0x2c')][_0xe723('0x17')]);}_0x163549[_0xe723('0x32')]=this[_0xe723('0x33')](_0x8ced18['query']['sort']);_0x163549[_0xe723('0x34')]=this[_0xe723('0x6')](_[_0xe723('0x35')](_0x8ced18[_0xe723('0x2c')],_0x4706d4['filters']),_0xb91a9c);if(_0x8ced18['query'][_0xe723('0x36')]){var _0x2f1618=_0xb91a9c;var _0x24909=_0x8ced18[_0xe723('0x2c')][_0xe723('0x36')];if(typeof _0x24909===_0xe723('0x37')){_0x2f1618=_[_0xe723('0x36')](_0xb91a9c,function(_0x2b74d5){return _[_0xe723('0x4')](_0x24909['columns'],_0x2b74d5['name']);});_0x24909=_0x24909[_0xe723('0x38')];}_0x163549['where']=_['merge'](_0x163549[_0xe723('0x34')],{'$or':_['map'](_0x2f1618,function(_0x36272){if(_0x36272[_0xe723('0xa')]!==_0xe723('0x39')){if(_0x26497e){return sequelize[_0xe723('0x34')](sequelize['fn'](_0xe723('0x3a'),sequelize[_0xe723('0x1a')](_0x36272[_0xe723('0x12')])),{'$like':sequelize['fn']('lower','%'+_0x8ced18['query'][_0xe723('0x36')]+'%')});}else{var _0x562583={};_0x562583[_0x36272[_0xe723('0x12')]]={'$like':'%'+_0x8ced18['query'][_0xe723('0x36')]+'%'};return _0x562583;}}})});}_0x163549=_[_0xe723('0x3b')]({},_0x163549,_0x8ced18[_0xe723('0x3c')]);return _0x163549;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 2b61398..9f2d3ad 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13dd=['phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','lodash','jayson/promise','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','voiceStatus','faxStatus','mailStatus','smsStatus','whatsappStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','error','merge','pause','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value','includes','busy','User','name','pauseType','find','globalStatus','catch','getSortedAgentsIdsByStatus','order','DESC','ASC','getUpdatedSortOptions','fullname','internal','substring','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','openchannelStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent'];(function(_0xa98a28,_0x18e8b1){var _0x494918=function(_0x9f208d){while(--_0x9f208d){_0xa98a28['push'](_0xa98a28['shift']());}};_0x494918(++_0x18e8b1);}(_0x13dd,0xb1));var _0xd13d=function(_0x1ca502,_0x5953b0){_0x1ca502=_0x1ca502-0x0;var _0xb484dc=_0x13dd[_0x1ca502];return _0xb484dc;};'use strict';var _=require(_0xd13d('0x0'));var jayson=require(_0xd13d('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xd13d('0x2')][_0xd13d('0x3')]({'port':0x232a});var routingClient=jayson[_0xd13d('0x2')][_0xd13d('0x3')]({'port':0x232c});function isAgentPaused(_0x19cbd1,_0x2bfe3b){var _0x16ae9d=[_0x19cbd1[_0xd13d('0x4')],_0x19cbd1[_0xd13d('0x5')],_0x19cbd1[_0xd13d('0x6')],_0x19cbd1[_0xd13d('0x7')],_0x19cbd1[_0xd13d('0x8')],_0x19cbd1[_0xd13d('0x9')],_0x19cbd1[_0xd13d('0xa')]];if(!_0x2bfe3b)return _[_0xd13d('0xb')](_0x16ae9d);var _0x10a2cf=_[_0xd13d('0xc')](_0x16ae9d);return _0x10a2cf['length']>0x0&&_0x10a2cf[_0xd13d('0xd')]<_0x16ae9d[_0xd13d('0xd')]?!![]:![];}function isIdle(_0xaab7d6){return _0xaab7d6===_0xd13d('0xe')||_0xaab7d6===_0xd13d('0xf')||_0xaab7d6===_0xd13d('0x10')||_0xaab7d6===_0xd13d('0x11')||_['isNil'](_0xaab7d6);}function isAgentIdle(_0x410c7a){if(_0x410c7a[_0xd13d('0x12')]!=='idle'&&_0x410c7a['voicePause']){_0x410c7a[_0xd13d('0x12')]='pause';return![];}return _[_0xd13d('0xb')]([_0x410c7a['chatStatus'],_0x410c7a[_0xd13d('0x13')],_0x410c7a[_0xd13d('0x14')],_0x410c7a['openchannelStatus'],_0x410c7a[_0xd13d('0x15')],_0x410c7a[_0xd13d('0x12')],_0x410c7a[_0xd13d('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xd13d('0x17')](_0xd13d('0x18'),{})[_0xd13d('0x19')](function(_0x52190d){if(_0x52190d['error']){throw new Error(_0xd13d('0x1a'));}var _0x372fa6=_0x52190d['result'];return routingClient[_0xd13d('0x17')]('Agents',{})['then'](function(_0x5964f3){if(_0x5964f3[_0xd13d('0x1b')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x1617b9=_0x5964f3['result'];return _[_0xd13d('0x1c')]({},_0x372fa6,_0x1617b9);});})['catch'](function(_0x1f8ca3){throw _0x1f8ca3;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x181f90){var _0x1ab0cb=_0xd13d('0xf');if(isAgentPaused(_0x181f90))_0x1ab0cb=_0xd13d('0x1d');else if(isAgentPaused(_0x181f90,!![]))_0x1ab0cb='*pause';else if(isAgentIdle(_0x181f90))_0x1ab0cb=_0xd13d('0xe');else _0x1ab0cb='busy';return _0x1ab0cb;}exports[_0xd13d('0x1e')]=getAgentStatus;function getAgentIdsByQueues(_0x1db6ce,_0x50ae9e){var _0xaaee91=_[_0xd13d('0x1f')](_0x1db6ce)?_0x1db6ce:[_0x1db6ce];var _0xcb2f14=_[_0xd13d('0x20')](_0x50ae9e)+_0xd13d('0x21');var _0x5b73ce=_[_0xd13d('0x22')](_0xaaee91,function(_0x21af2c){return db[_0xcb2f14][_0xd13d('0x23')]({'where':{'id':_0x21af2c}})[_0xd13d('0x19')](function(_0x215043){if(!_0x215043)return[];return _0x215043[_0xd13d('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xd13d('0x25')](_0x5b73ce)['then'](function(_0x24f82d){var _0x97e992=_(_0x24f82d)[_0xd13d('0x26')]()['map']('id')[_0xd13d('0x27')]()[_0xd13d('0x28')]();return _0x97e992;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3e901f,_0x25ed6a,_0xbae7fc){try{if(_0x25ed6a['length']>0x0){_0x3e901f=_0x3e901f[_0xd13d('0xc')](function(_0x4a63b9){return _0x25ed6a[_0xd13d('0x29')](_0x4a63b9['id']);});}var _0x362b89=_0x3e901f[_0xd13d('0xc')](function(_0x59d53c){var _0x403bc3=_0xd13d('0x2a');if(isAgentIdle(_0x59d53c)){_0x403bc3=_0xd13d('0xe');}return _0x403bc3===_0xbae7fc;});return _['map'](_0x362b89,'id');}catch(_0x5037ac){throw _0x5037ac;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x4a6f85,_0x1959bb,_0x18516d){return Promise['resolve']()[_0xd13d('0x19')](function(){if(_0x1959bb[_0xd13d('0xd')]>0x0){_0x4a6f85=_0x4a6f85[_0xd13d('0xc')](function(_0x22dcf0){return _0x1959bb[_0xd13d('0x29')](_0x22dcf0['id']);});}return _0x4a6f85;})[_0xd13d('0x19')](function(){return db[_0xd13d('0x2b')]['findAll']({'attributes':['id',_0xd13d('0x2c'),'fullname',_0xd13d('0x4'),_0xd13d('0x5'),_0xd13d('0x6'),'openchannelPause','smsPause',_0xd13d('0x9'),'whatsappPause',_0xd13d('0x2d')],'where':{'id':{'$in':_[_0xd13d('0x22')](_0x4a6f85,'id')}},'raw':!![]});})['then'](function(_0x94544c){return _0x94544c[_0xd13d('0x22')](function(_0x4d52ff){var _0x17e35c=_[_0xd13d('0x2e')](_0x4a6f85,['id',_0x4d52ff['id']]);var _0x8519aa=filterAgentAttributes(_0x17e35c);_[_0xd13d('0x1c')](_0x4d52ff,_0x8519aa);_0x4d52ff[_0xd13d('0x2f')]=getAgentStatus(_0x4d52ff);return _0x4d52ff;});})[_0xd13d('0x19')](function(_0x5ee14b){var _0x178a5a=sortAgentsByStatus(_0x5ee14b,_0x18516d);return _[_0xd13d('0x22')](_0x178a5a,'id');})[_0xd13d('0x30')](function(_0xab4a74){throw _0xab4a74;});}exports[_0xd13d('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0xb1e71){var _0x30c813={'fields':[],'order':null};var _0x51d2af=_0xb1e71['split'](',');_0x30c813['fields']=_[_0xd13d('0xc')](_0x51d2af,function(_0x1621a1){if(!_0x1621a1[_0xd13d('0x29')](_0xd13d('0x2f'))){return!![];}_0x30c813[_0xd13d('0x32')]=_['startsWith'](_0x1621a1,'-')?_0xd13d('0x33'):_0xd13d('0x34');return![];});return _0x30c813;}exports[_0xd13d('0x35')]=getUpdatedSortOptions;function validateSortParameter(_0x232981){if(_0x232981[_0xd13d('0x29')](_0xd13d('0x36'))&&!_0x232981[_0xd13d('0x29')](_0xd13d('0x37'))){var _0x512ef8=_0x232981[_0xd13d('0x38')](0x0,_0x232981['indexOf'](_0xd13d('0x36')));_0x232981+=','+_0x512ef8+_0xd13d('0x37');}return _0x232981;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x264084,_0x48f3b8){var _0x537be9=_0x264084[_0xd13d('0x39')](function(_0x362b15,_0x560b9b){if(_0x362b15['globalStatus']===_0x560b9b[_0xd13d('0x2f')]){if(_0x362b15[_0xd13d('0x2f')]===_0xd13d('0x1d')){if(_0x48f3b8===_0xd13d('0x33')){return(_0x362b15[_0xd13d('0x2d')]||'')<(_0x560b9b[_0xd13d('0x2d')]||'')||_0x362b15[_0xd13d('0x36')][_0xd13d('0x3a')]()>_0x560b9b[_0xd13d('0x36')][_0xd13d('0x3a')]()?0x1:-0x1;}else{return(_0x362b15[_0xd13d('0x2d')]||'')<(_0x560b9b[_0xd13d('0x2d')]||'')||_0x362b15[_0xd13d('0x36')][_0xd13d('0x3a')]()>_0x560b9b[_0xd13d('0x36')][_0xd13d('0x3a')]()?-0x1:0x1;}}else{if(_0x48f3b8==='DESC'){return _0x362b15[_0xd13d('0x36')][_0xd13d('0x3a')]()<_0x560b9b[_0xd13d('0x36')][_0xd13d('0x3a')]()?0x1:-0x1;}else{return _0x362b15[_0xd13d('0x36')][_0xd13d('0x3a')]()<_0x560b9b[_0xd13d('0x36')][_0xd13d('0x3a')]()?-0x1:0x1;}}}else{if(_0x48f3b8==='DESC'){return _0x362b15[_0xd13d('0x2f')]<_0x560b9b[_0xd13d('0x2f')]?0x1:-0x1;}else{return _0x362b15[_0xd13d('0x2f')]<_0x560b9b[_0xd13d('0x2f')]?-0x1:0x1;}}});return _0x537be9;}exports[_0xd13d('0x3b')]=sortAgentsByStatus;function filterAgentAttributes(_0x4ac4e1){var _0x78e70=[_0xd13d('0x3c'),_0xd13d('0x3d'),_0xd13d('0x3e'),_0xd13d('0x3f'),_0xd13d('0x2d'),_0xd13d('0x3f'),_0xd13d('0x37'),'address',_0xd13d('0x4'),_0xd13d('0x7'),_0xd13d('0x6'),'smsPause','whatsappPause','faxPause','voicePause',_0xd13d('0x40'),_0xd13d('0x41'),'mailCapacity','smsCapacity',_0xd13d('0x42'),'faxCapacity',_0xd13d('0x43'),_0xd13d('0x44'),_0xd13d('0x45'),_0xd13d('0x46'),'whatsappCurrentCapacity','faxCurrentCapacity','chatStatus',_0xd13d('0x47'),_0xd13d('0x14'),_0xd13d('0x15'),_0xd13d('0x16'),_0xd13d('0x13'),_0xd13d('0x12'),_0xd13d('0x48'),_0xd13d('0x49'),_0xd13d('0x4a'),_0xd13d('0x4b'),_0xd13d('0x4c'),_0xd13d('0x4d'),'voiceStatusTime','queue',_0xd13d('0x4e'),_0xd13d('0x4f'),_0xd13d('0x50'),_0xd13d('0x51'),_0xd13d('0x52')];var _0x5dcfc2=['chatPause',_0xd13d('0x7'),_0xd13d('0x6'),_0xd13d('0x8'),_0xd13d('0xa'),'faxPause',_0xd13d('0x9'),'online'];var _0x4aaab2=_(_0x4ac4e1)[_0xd13d('0x53')](_0x5dcfc2)[_0xd13d('0x54')](_0x78e70)[_0xd13d('0x28')]();return _0x4aaab2;}exports[_0xd13d('0x55')]=filterAgentAttributes; \ No newline at end of file +var _0xafcd=['busy','getAgentStatus','isArray','startCase','Queue','findOne','getAgents','all','flatten','map','getAgentIdsByQueues','includes','getAgentIdsByStatus','User','name','find','globalStatus','catch','getSortedAgentsIdsByStatus','startsWith','DESC','ASC','getUpdatedSortOptions','fullname','internal','substring','validateSortParameter','sort','pauseType','toLowerCase','sortAgentsByStatus','online','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unavailable','isNil','voiceStatus','pause','chatStatus','faxStatus','smsStatus','whatsappStatus','request','then','result','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','getRealtimeAgents','unknown','*pause'];(function(_0x56c7c9,_0x10affd){var _0x19db04=function(_0x2009dc){while(--_0x2009dc){_0x56c7c9['push'](_0x56c7c9['shift']());}};_0x19db04(++_0x10affd);}(_0xafcd,0xf8));var _0xdafc=function(_0x19a5d8,_0x347207){_0x19a5d8=_0x19a5d8-0x0;var _0x30104a=_0xafcd[_0x19a5d8];return _0x30104a;};'use strict';var _=require('lodash');var jayson=require(_0xdafc('0x0'));var db=require(_0xdafc('0x1'))['db'];var amiClient=jayson[_0xdafc('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0xdafc('0x2')][_0xdafc('0x3')]({'port':0x232c});function isAgentPaused(_0x41e5da,_0x2038a7){var _0x130152=[_0x41e5da[_0xdafc('0x4')],_0x41e5da[_0xdafc('0x5')],_0x41e5da[_0xdafc('0x6')],_0x41e5da[_0xdafc('0x7')],_0x41e5da[_0xdafc('0x8')],_0x41e5da[_0xdafc('0x9')],_0x41e5da[_0xdafc('0xa')]];if(!_0x2038a7)return _[_0xdafc('0xb')](_0x130152);var _0x45758f=_[_0xdafc('0xc')](_0x130152);return _0x45758f['length']>0x0&&_0x45758f[_0xdafc('0xd')]<_0x130152[_0xdafc('0xd')]?!![]:![];}function isIdle(_0x423d7b){return _0x423d7b===_0xdafc('0xe')||_0x423d7b==='unknown'||_0x423d7b===_0xdafc('0xf')||_0x423d7b==='ringing'||_[_0xdafc('0x10')](_0x423d7b);}function isAgentIdle(_0x3f0e38){if(_0x3f0e38[_0xdafc('0x11')]!==_0xdafc('0xe')&&_0x3f0e38[_0xdafc('0x9')]){_0x3f0e38[_0xdafc('0x11')]=_0xdafc('0x12');return![];}return _['every']([_0x3f0e38[_0xdafc('0x13')],_0x3f0e38[_0xdafc('0x14')],_0x3f0e38['mailStatus'],_0x3f0e38['openchannelStatus'],_0x3f0e38[_0xdafc('0x15')],_0x3f0e38[_0xdafc('0x11')],_0x3f0e38[_0xdafc('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xdafc('0x17')]('Agents',{})[_0xdafc('0x18')](function(_0x156ec0){if(_0x156ec0['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x511b63=_0x156ec0[_0xdafc('0x19')];return routingClient[_0xdafc('0x17')]('Agents',{})[_0xdafc('0x18')](function(_0x173bf3){if(_0x173bf3[_0xdafc('0x1a')]){throw new Error(_0xdafc('0x1b'));}var _0x1dd820=_0x173bf3['result'];return _['merge']({},_0x511b63,_0x1dd820);});})['catch'](function(_0x381d98){throw _0x381d98;});}exports[_0xdafc('0x1c')]=getRealtimeAgents;function getAgentStatus(_0x57a410){var _0x233428=_0xdafc('0x1d');if(isAgentPaused(_0x57a410))_0x233428=_0xdafc('0x12');else if(isAgentPaused(_0x57a410,!![]))_0x233428=_0xdafc('0x1e');else if(isAgentIdle(_0x57a410))_0x233428='idle';else _0x233428=_0xdafc('0x1f');return _0x233428;}exports[_0xdafc('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x4b1b8a,_0x4e0e1b){var _0x39a09a=_[_0xdafc('0x21')](_0x4b1b8a)?_0x4b1b8a:[_0x4b1b8a];var _0x15a03f=_[_0xdafc('0x22')](_0x4e0e1b)+_0xdafc('0x23');var _0x21fc09=_['map'](_0x39a09a,function(_0x31b3ff){return db[_0x15a03f][_0xdafc('0x24')]({'where':{'id':_0x31b3ff}})['then'](function(_0x164a5a){if(!_0x164a5a)return[];return _0x164a5a[_0xdafc('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xdafc('0x26')](_0x21fc09)['then'](function(_0x1729c7){var _0x51d497=_(_0x1729c7)[_0xdafc('0x27')]()[_0xdafc('0x28')]('id')['uniq']()['value']();return _0x51d497;});}exports[_0xdafc('0x29')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3ee880,_0x2d4b45,_0x18cbb6){try{if(_0x2d4b45[_0xdafc('0xd')]>0x0){_0x3ee880=_0x3ee880[_0xdafc('0xc')](function(_0x9114a6){return _0x2d4b45[_0xdafc('0x2a')](_0x9114a6['id']);});}var _0x4a5012=_0x3ee880[_0xdafc('0xc')](function(_0x25bb5c){var _0x34b036=_0xdafc('0x1f');if(isAgentIdle(_0x25bb5c)){_0x34b036=_0xdafc('0xe');}return _0x34b036===_0x18cbb6;});return _[_0xdafc('0x28')](_0x4a5012,'id');}catch(_0x3303d6){throw _0x3303d6;}}exports[_0xdafc('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x4b0d5b,_0x1c1238,_0x4f268f){return Promise['resolve']()[_0xdafc('0x18')](function(){if(_0x1c1238[_0xdafc('0xd')]>0x0){_0x4b0d5b=_0x4b0d5b['filter'](function(_0x48ff97){return _0x1c1238['includes'](_0x48ff97['id']);});}return _0x4b0d5b;})['then'](function(){return db[_0xdafc('0x2c')]['findAll']({'attributes':['id',_0xdafc('0x2d'),'fullname','chatPause',_0xdafc('0x5'),_0xdafc('0x6'),_0xdafc('0x7'),'smsPause',_0xdafc('0x9'),_0xdafc('0xa'),'pauseType'],'where':{'id':{'$in':_['map'](_0x4b0d5b,'id')}},'raw':!![]});})[_0xdafc('0x18')](function(_0x53622c){return _0x53622c['map'](function(_0x45bf3b){var _0x5ec361=_[_0xdafc('0x2e')](_0x4b0d5b,['id',_0x45bf3b['id']]);var _0x7220e5=filterAgentAttributes(_0x5ec361);_['merge'](_0x45bf3b,_0x7220e5);_0x45bf3b[_0xdafc('0x2f')]=getAgentStatus(_0x45bf3b);return _0x45bf3b;});})['then'](function(_0x2bea2c){var _0x326370=sortAgentsByStatus(_0x2bea2c,_0x4f268f);return _[_0xdafc('0x28')](_0x326370,'id');})[_0xdafc('0x30')](function(_0x3ae191){throw _0x3ae191;});}exports[_0xdafc('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4157c4){var _0x4fb233={'fields':[],'order':null};var _0x32819b=_0x4157c4['split'](',');_0x4fb233['fields']=_[_0xdafc('0xc')](_0x32819b,function(_0x19e4c7){if(!_0x19e4c7[_0xdafc('0x2a')](_0xdafc('0x2f'))){return!![];}_0x4fb233['order']=_[_0xdafc('0x32')](_0x19e4c7,'-')?_0xdafc('0x33'):_0xdafc('0x34');return![];});return _0x4fb233;}exports[_0xdafc('0x35')]=getUpdatedSortOptions;function validateSortParameter(_0x3f80c2){if(_0x3f80c2['includes'](_0xdafc('0x36'))&&!_0x3f80c2[_0xdafc('0x2a')](_0xdafc('0x37'))){var _0x13b638=_0x3f80c2[_0xdafc('0x38')](0x0,_0x3f80c2['indexOf'](_0xdafc('0x36')));_0x3f80c2+=','+_0x13b638+_0xdafc('0x37');}return _0x3f80c2;}exports[_0xdafc('0x39')]=validateSortParameter;function sortAgentsByStatus(_0x34e667,_0x3f4dcf){var _0x41d7ed=_0x34e667[_0xdafc('0x3a')](function(_0x27a463,_0x2ff8c3){if(_0x27a463[_0xdafc('0x2f')]===_0x2ff8c3[_0xdafc('0x2f')]){if(_0x27a463[_0xdafc('0x2f')]===_0xdafc('0x12')){if(_0x3f4dcf===_0xdafc('0x33')){return(_0x27a463['pauseType']||'')<(_0x2ff8c3[_0xdafc('0x3b')]||'')||_0x27a463['fullname'][_0xdafc('0x3c')]()>_0x2ff8c3['fullname'][_0xdafc('0x3c')]()?0x1:-0x1;}else{return(_0x27a463[_0xdafc('0x3b')]||'')<(_0x2ff8c3['pauseType']||'')||_0x27a463['fullname']['toLowerCase']()>_0x2ff8c3[_0xdafc('0x36')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x3f4dcf===_0xdafc('0x33')){return _0x27a463[_0xdafc('0x36')]['toLowerCase']()<_0x2ff8c3['fullname'][_0xdafc('0x3c')]()?0x1:-0x1;}else{return _0x27a463['fullname'][_0xdafc('0x3c')]()<_0x2ff8c3[_0xdafc('0x36')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x3f4dcf===_0xdafc('0x33')){return _0x27a463[_0xdafc('0x2f')]<_0x2ff8c3[_0xdafc('0x2f')]?0x1:-0x1;}else{return _0x27a463[_0xdafc('0x2f')]<_0x2ff8c3[_0xdafc('0x2f')]?-0x1:0x1;}}});return _0x41d7ed;}exports[_0xdafc('0x3d')]=sortAgentsByStatus;function filterAgentAttributes(_0x490ddf){var _0x200c62=['userpic',_0xdafc('0x3e'),_0xdafc('0x3f'),_0xdafc('0x40'),_0xdafc('0x3b'),_0xdafc('0x40'),'internal','address',_0xdafc('0x4'),_0xdafc('0x7'),_0xdafc('0x6'),'smsPause',_0xdafc('0xa'),_0xdafc('0x5'),_0xdafc('0x9'),_0xdafc('0x41'),_0xdafc('0x42'),_0xdafc('0x43'),_0xdafc('0x44'),_0xdafc('0x45'),_0xdafc('0x46'),_0xdafc('0x47'),_0xdafc('0x48'),_0xdafc('0x49'),_0xdafc('0x4a'),_0xdafc('0x4b'),_0xdafc('0x4c'),_0xdafc('0x13'),_0xdafc('0x4d'),_0xdafc('0x4e'),_0xdafc('0x15'),_0xdafc('0x16'),_0xdafc('0x14'),'voiceStatus',_0xdafc('0x4f'),_0xdafc('0x50'),_0xdafc('0x51'),_0xdafc('0x52'),_0xdafc('0x53'),_0xdafc('0x54'),_0xdafc('0x55'),_0xdafc('0x56'),_0xdafc('0x57'),_0xdafc('0x58'),'phoneBarEnableScreenRecordingByAgent',_0xdafc('0x59'),_0xdafc('0x5a')];var _0x26b123=[_0xdafc('0x4'),_0xdafc('0x7'),_0xdafc('0x6'),'smsPause',_0xdafc('0xa'),_0xdafc('0x5'),_0xdafc('0x9'),'online'];var _0x481c68=_(_0x490ddf)[_0xdafc('0x5b')](_0x26b123)[_0xdafc('0x5c')](_0x200c62)['value']();return _0x481c68;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index cc9414c..29aa323 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x14e201,_0x31e6d7){var _0x1f0fa0=function(_0x1a7da9){while(--_0x1a7da9){_0x14e201['push'](_0x14e201['shift']());}};_0x1f0fa0(++_0x31e6d7);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index d8cc9a4..09f5bba 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 _0xf87b=['../environment','networkInterfaces','length','family','IPv4','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','map','join','createHash','md5','digest','hex','platform','test','licenseToken','win32','utf8','hostname','update','substring','lodash','bimedia-machine-uuid','execSync'];(function(_0x488e8f,_0x5c0a85){var _0x58c67b=function(_0x2a86c0){while(--_0x2a86c0){_0x488e8f['push'](_0x488e8f['shift']());}};_0x58c67b(++_0x5c0a85);}(_0xf87b,0x147));var _0xbf87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf87b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbf87('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xbf87('0x1'));var exec=require('child_process')[_0xbf87('0x2')];var config=require(_0xbf87('0x3'));function getInterfaces(){var _0x43ea1d=[];var _0x4c0501=os[_0xbf87('0x4')]();var _0x2b6f42=_['orderBy'](_['keys'](_0x4c0501));for(var _0x39f1c2=0x0;_0x39f1c2<_0x2b6f42[_0xbf87('0x5')];_0x39f1c2++){var _0x32e662=_0x4c0501[_0x2b6f42[_0x39f1c2]]['filter'](function(_0x5b61ef){return _0x5b61ef[_0xbf87('0x6')]===_0xbf87('0x7')&&_0x5b61ef[_0xbf87('0x8')]===![];});_0x43ea1d=_0x43ea1d[_0xbf87('0x9')](_0x32e662);}return _0x43ea1d;}function getFirstInterface(){var _0x43118a=_[_0xbf87('0xa')](getInterfaces());return{'macAddress':_0x43118a&&_0x43118a[_0xbf87('0xb')]?_0x43118a[_0xbf87('0xb')]:'00:00:00:00:00:00','ipAddress':_0x43118a&&_0x43118a['address']?_0x43118a[_0xbf87('0xc')]:_0xbf87('0xd')};}exports[_0xbf87('0xe')]=getFirstInterface;function getCPUhash(){var _0x1352a2=_['orderBy'](os[_0xbf87('0xf')]()[_0xbf87('0x10')](function(_0x42931b){return _0x42931b['model'];}))[_0xbf87('0x11')](':');return crypto[_0xbf87('0x12')](_0xbf87('0x13'))['update'](_0x1352a2)[_0xbf87('0x14')](_0xbf87('0x15'));}exports['getUuid']=function(){var _0x373c1c=os[_0xbf87('0x16')]();var _0x110595=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x110595[_0xbf87('0x17')](config[_0xbf87('0x18')])){return config[_0xbf87('0x18')];}else if(_0x373c1c===_0xbf87('0x19')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xbf87('0x1a')})['replace']('\x0d\x0a','');}else{var _0xd4ed0c=getFirstInterface();var _0x4ecbba=getCPUhash();var _0x4da4ca=_0x4ecbba+'|'+os[_0xbf87('0x1b')]()+'|'+_0xd4ed0c['macAddress']+'|'+_0xd4ed0c['ipAddress'];var _0x278e3c=crypto[_0xbf87('0x12')]('md5')[_0xbf87('0x1c')](_0x4da4ca)[_0xbf87('0x14')](_0xbf87('0x15'));return _0x278e3c[_0xbf87('0x1d')](0x0,0x8)+'-'+_0x278e3c[_0xbf87('0x1d')](0x8,0xc)+'-'+_0x278e3c[_0xbf87('0x1d')](0xc,0x10)+'-'+_0x278e3c[_0xbf87('0x1d')](0x10,0x14)+'-'+_0x278e3c[_0xbf87('0x1d')](0x14);}}; \ No newline at end of file +var _0xc0a1=['keys','length','filter','IPv4','concat','mac','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','update','digest','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','orderBy'];(function(_0x13de6f,_0x423a33){var _0x2f61be=function(_0xf1101a){while(--_0xf1101a){_0x13de6f['push'](_0x13de6f['shift']());}};_0x2f61be(++_0x423a33);}(_0xc0a1,0x15a));var _0x1c0a=function(_0x352fbf,_0x5d417d){_0x352fbf=_0x352fbf-0x0;var _0x45784a=_0xc0a1[_0x352fbf];return _0x45784a;};'use strict';var _=require(_0x1c0a('0x0'));var os=require('os');var crypto=require(_0x1c0a('0x1'));var machine=require(_0x1c0a('0x2'));var exec=require(_0x1c0a('0x3'))['execSync'];var config=require(_0x1c0a('0x4'));function getInterfaces(){var _0x2184e6=[];var _0x1e6494=os['networkInterfaces']();var _0x496c61=_[_0x1c0a('0x5')](_[_0x1c0a('0x6')](_0x1e6494));for(var _0xeda3ac=0x0;_0xeda3ac<_0x496c61[_0x1c0a('0x7')];_0xeda3ac++){var _0x14f4a1=_0x1e6494[_0x496c61[_0xeda3ac]][_0x1c0a('0x8')](function(_0x70914){return _0x70914['family']===_0x1c0a('0x9')&&_0x70914['internal']===![];});_0x2184e6=_0x2184e6[_0x1c0a('0xa')](_0x14f4a1);}return _0x2184e6;}function getFirstInterface(){var _0x25f12f=_['head'](getInterfaces());return{'macAddress':_0x25f12f&&_0x25f12f[_0x1c0a('0xb')]?_0x25f12f[_0x1c0a('0xb')]:'00:00:00:00:00:00','ipAddress':_0x25f12f&&_0x25f12f['address']?_0x25f12f[_0x1c0a('0xc')]:_0x1c0a('0xd')};}exports[_0x1c0a('0xe')]=getFirstInterface;function getCPUhash(){var _0x19befb=_[_0x1c0a('0x5')](os[_0x1c0a('0xf')]()[_0x1c0a('0x10')](function(_0x12947c){return _0x12947c[_0x1c0a('0x11')];}))[_0x1c0a('0x12')](':');return crypto[_0x1c0a('0x13')]('md5')[_0x1c0a('0x14')](_0x19befb)[_0x1c0a('0x15')](_0x1c0a('0x16'));}exports[_0x1c0a('0x17')]=function(){var _0x33dd76=os[_0x1c0a('0x18')]();var _0x15d117=/[0-9a-f-]{36}/;if(config[_0x1c0a('0x19')]&&_0x15d117[_0x1c0a('0x1a')](config['licenseToken'])){return config[_0x1c0a('0x19')];}else if(_0x33dd76==='win32'){return exec(_0x1c0a('0x1b'),{'encoding':_0x1c0a('0x1c')})[_0x1c0a('0x1d')]('\x0d\x0a','');}else{var _0x165611=getFirstInterface();var _0x59db99=getCPUhash();var _0x401c82=_0x59db99+'|'+os['hostname']()+'|'+_0x165611['macAddress']+'|'+_0x165611[_0x1c0a('0x1e')];var _0x28fdfa=crypto[_0x1c0a('0x13')]('md5')['update'](_0x401c82)[_0x1c0a('0x15')](_0x1c0a('0x16'));return _0x28fdfa[_0x1c0a('0x1f')](0x0,0x8)+'-'+_0x28fdfa[_0x1c0a('0x1f')](0x8,0xc)+'-'+_0x28fdfa[_0x1c0a('0x1f')](0xc,0x10)+'-'+_0x28fdfa[_0x1c0a('0x1f')](0x10,0x14)+'-'+_0x28fdfa[_0x1c0a('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index d9a9eef..d818ea0 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 _0xb458=['%s/api/servers/%s/check?version=%s','exports','then','get','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','message','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','version','../../mysqldb','license','https://www.xcallymotion.com','format'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0xb458,0xb5));var _0x8b45=function(_0x1741ba,_0x33116f){_0x1741ba=_0x1741ba-0x0;var _0x2a3110=_0xb458[_0x1741ba];return _0x2a3110;};'use strict';var util=require(_0x8b45('0x0'));var moment=require(_0x8b45('0x1'));var rp=require(_0x8b45('0x2'));var BPromise=require(_0x8b45('0x3'));var pkginfo=require('pkginfo')(module,_0x8b45('0x4'));var db=require(_0x8b45('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require('../logger')(_0x8b45('0x6'));var HOST=_0x8b45('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x7448ac){return new BPromise(function(_0x452f97,_0x513d2d){var _0x204a53=util[_0x8b45('0x8')](_0x8b45('0x9'),HOST,_0x7448ac,module['exports'][_0x8b45('0x4')]);if(oldToken){_0x204a53=util[_0x8b45('0x8')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x7448ac,module[_0x8b45('0xa')][_0x8b45('0x4')],oldToken);}var _0x2eb37d={'uri':_0x204a53,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x2eb37d)[_0x8b45('0xb')](function(_0x50472d){_0x452f97(_0x50472d);})['catch'](function(_0xe182f5){_0x513d2d(_0xe182f5);});});}function manageLicense(_0x3432c4,_0x418eaf){var _0x537e58=_0x418eaf[_0x8b45('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0x537e58[_0x8b45('0xd')]!==_0x3432c4&&!_0x537e58[_0x8b45('0xe')]){oldToken=_0x537e58[_0x8b45('0xd')];}httpRequest(_0x3432c4)[_0x8b45('0xb')](function(_0x6bfeae){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x6bfeae[_0x8b45('0xf')]){isOldTokenSent=![];if(!_0x537e58[_0x8b45('0x6')]&&_0x537e58[_0x8b45('0x6')]!=_0x6bfeae[_0x8b45('0x6')]||_0x537e58[_0x8b45('0x6')]&&_0x537e58['data2']){logger['info'](_0x8b45('0x10'));}if(_0x537e58[_0x8b45('0x6')]&&!_0x537e58[_0x8b45('0xe')]&&_0x537e58[_0x8b45('0x6')]!=_0x6bfeae[_0x8b45('0x6')]){logger[_0x8b45('0x11')](_0x8b45('0x12'));}if(_0x537e58['license']&&!_0x537e58['data2']&&_0x537e58[_0x8b45('0x6')]==_0x6bfeae[_0x8b45('0x6')]){return _0x418eaf;}return _0x418eaf['update']({'data1':_0x3432c4,'data2':null,'license':_0x6bfeae[_0x8b45('0x6')]});}else{if(_0x6bfeae[_0x8b45('0x6')]||_0x537e58[_0x8b45('0x6')]){if(!_0x537e58[_0x8b45('0xe')]){if(_0x537e58['data1']==_0x3432c4){GRAY_PERIOD_REASON=_0x8b45('0x13');logger[_0x8b45('0x11')](_0x8b45('0x14'));}else{GRAY_PERIOD_REASON=_0x8b45('0x15');logger[_0x8b45('0x11')](_0x8b45('0x16'),_0x537e58[_0x8b45('0xd')],_0x3432c4);}logger['info'](_0x8b45('0x17'),GRAY_PERIOD_REASON[_0x8b45('0x18')](),moment()[_0x8b45('0x8')](_0x8b45('0x19')));return _0x418eaf[_0x8b45('0x1a')]({'data2':encryptor[_0x8b45('0x1b')](moment()[_0x8b45('0x8')](_0x8b45('0x19')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x537e58['data2']),_0x8b45('0x1c'))>DAYS){logger[_0x8b45('0x11')](_0x8b45('0x1d'),moment()[_0x8b45('0x8')](_0x8b45('0x19')));isOldTokenSent=![];return _0x418eaf[_0x8b45('0x1a')]({'data1':_0x3432c4,'data2':null,'license':null});}}}else{if(_0x537e58[_0x8b45('0xd')]!=_0x3432c4){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x537e58[_0x8b45('0xd')],_0x3432c4);return _0x418eaf['update']({'data1':_0x3432c4,'data2':null,'license':null});}}}return _0x418eaf;})['then'](function(_0x1c44f0){_0x418eaf=_0x1c44f0;})[_0x8b45('0x1e')](function(_0x43abb9){logger[_0x8b45('0x1f')](_0x43abb9[_0x8b45('0x20')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x8b45('0x21')](),_0x418eaf);},TIME);});}function defaultLicense(){var _0x21efdc=hardware[_0x8b45('0x21')]();if(_0x21efdc){return db[_0x8b45('0x22')][_0x8b45('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x21efdc}})['spread'](function(_0x3fc69e,_0x4247ed){logger['info'](_0x8b45('0x24'),_0x21efdc);manageLicense(_0x21efdc,_0x3fc69e);})['catch'](function(_0x26c542){logger[_0x8b45('0x1f')](_0x26c542[_0x8b45('0x20')]);});}}exports[_0x8b45('0x25')]=defaultLicense; \ No newline at end of file +var _0x9fee=['info','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','then','catch','get','data2','data1','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled'];(function(_0x2fd405,_0x415434){var _0x4ec4aa=function(_0x5bc038){while(--_0x5bc038){_0x2fd405['push'](_0x2fd405['shift']());}};_0x4ec4aa(++_0x415434);}(_0x9fee,0x1a2));var _0xe9fe=function(_0x5ec0ef,_0x3029db){_0x5ec0ef=_0x5ec0ef-0x0;var _0x2040a2=_0x9fee[_0x5ec0ef];return _0x2040a2;};'use strict';var util=require(_0xe9fe('0x0'));var moment=require(_0xe9fe('0x1'));var rp=require('request-promise');var BPromise=require(_0xe9fe('0x2'));var pkginfo=require(_0xe9fe('0x3'))(module,_0xe9fe('0x4'));var db=require(_0xe9fe('0x5'))['db'];var encryptor=require(_0xe9fe('0x6'));var hardware=require(_0xe9fe('0x7'));var logger=require(_0xe9fe('0x8'))('license');var HOST=_0xe9fe('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x68cf45){return new BPromise(function(_0x3f15ed,_0x1df963){var _0x172e33=util[_0xe9fe('0xa')](_0xe9fe('0xb'),HOST,_0x68cf45,module[_0xe9fe('0xc')][_0xe9fe('0x4')]);if(oldToken){_0x172e33=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x68cf45,module[_0xe9fe('0xc')][_0xe9fe('0x4')],oldToken);}var _0x314cfc={'uri':_0x172e33,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x314cfc)[_0xe9fe('0xd')](function(_0x157b58){_0x3f15ed(_0x157b58);})[_0xe9fe('0xe')](function(_0xf2710e){_0x1df963(_0xf2710e);});});}function manageLicense(_0x59bfad,_0x58641d){var _0x5c8cd2=_0x58641d[_0xe9fe('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x5c8cd2['data1']!==_0x59bfad&&!_0x5c8cd2[_0xe9fe('0x10')]){oldToken=_0x5c8cd2[_0xe9fe('0x11')];}httpRequest(_0x59bfad)['then'](function(_0x258f4d){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x258f4d['active']){isOldTokenSent=![];if(!_0x5c8cd2[_0xe9fe('0x12')]&&_0x5c8cd2[_0xe9fe('0x12')]!=_0x258f4d[_0xe9fe('0x12')]||_0x5c8cd2['license']&&_0x5c8cd2[_0xe9fe('0x10')]){logger['info'](_0xe9fe('0x13'));}if(_0x5c8cd2[_0xe9fe('0x12')]&&!_0x5c8cd2[_0xe9fe('0x10')]&&_0x5c8cd2['license']!=_0x258f4d[_0xe9fe('0x12')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x5c8cd2['license']&&!_0x5c8cd2['data2']&&_0x5c8cd2['license']==_0x258f4d[_0xe9fe('0x12')]){return _0x58641d;}return _0x58641d[_0xe9fe('0x14')]({'data1':_0x59bfad,'data2':null,'license':_0x258f4d[_0xe9fe('0x12')]});}else{if(_0x258f4d[_0xe9fe('0x12')]||_0x5c8cd2[_0xe9fe('0x12')]){if(!_0x5c8cd2[_0xe9fe('0x10')]){if(_0x5c8cd2[_0xe9fe('0x11')]==_0x59bfad){GRAY_PERIOD_REASON=_0xe9fe('0x15');logger[_0xe9fe('0x16')](_0xe9fe('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xe9fe('0x16')](_0xe9fe('0x18'),_0x5c8cd2[_0xe9fe('0x11')],_0x59bfad);}logger[_0xe9fe('0x16')](_0xe9fe('0x19'),GRAY_PERIOD_REASON[_0xe9fe('0x1a')](),moment()['format'](_0xe9fe('0x1b')));return _0x58641d[_0xe9fe('0x14')]({'data2':encryptor[_0xe9fe('0x1c')](moment()[_0xe9fe('0xa')](_0xe9fe('0x1b')))});}else{if(moment()[_0xe9fe('0x1d')](encryptor[_0xe9fe('0x1e')](_0x5c8cd2[_0xe9fe('0x10')]),'days')>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()['format'](_0xe9fe('0x1b')));isOldTokenSent=![];return _0x58641d[_0xe9fe('0x14')]({'data1':_0x59bfad,'data2':null,'license':null});}}}else{if(_0x5c8cd2[_0xe9fe('0x11')]!=_0x59bfad){logger[_0xe9fe('0x16')](_0xe9fe('0x18'),_0x5c8cd2[_0xe9fe('0x11')],_0x59bfad);return _0x58641d[_0xe9fe('0x14')]({'data1':_0x59bfad,'data2':null,'license':null});}}}return _0x58641d;})[_0xe9fe('0xd')](function(_0x22fb96){_0x58641d=_0x22fb96;})['catch'](function(_0x22e11f){logger[_0xe9fe('0x1f')](_0x22e11f[_0xe9fe('0x20')]);})[_0xe9fe('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0xe9fe('0x22')](),_0x58641d);},TIME);});}function defaultLicense(){var _0x24367c=hardware['getUuid']();if(_0x24367c){return db[_0xe9fe('0x23')][_0xe9fe('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x24367c}})[_0xe9fe('0x25')](function(_0x1d263f,_0xa1f87c){logger['info'](_0xe9fe('0x26'),_0x24367c);manageLicense(_0x24367c,_0x1d263f);})['catch'](function(_0x6fad37){logger[_0xe9fe('0x1f')](_0x6fad37[_0xe9fe('0x20')]);});}}exports[_0xe9fe('0x27')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 3b1aec4..1a55d54 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 _0xdf77=['demo','machineUuid','gray','deadline','add','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','col','count','admin','user','telephone','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','License','find','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xdf77,0x138));var _0x7df7=function(_0x5caa3f,_0x30de03){_0x5caa3f=_0x5caa3f-0x0;var _0x390078=_0xdf77[_0x5caa3f];return _0x390078;};'use strict';var util=require(_0x7df7('0x0'));var _=require(_0x7df7('0x1'));var moment=require(_0x7df7('0x2'));var BPromise=require(_0x7df7('0x3'));var hardware=require(_0x7df7('0x4'));var encryptor=require(_0x7df7('0x5'));var db=require(_0x7df7('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7df7('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x7df7('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x7df7('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5f0eaa){return new BPromise(function(_0x50b7a7,_0x8e40a3){return db[_0x7df7('0xa')][_0x7df7('0xb')](_['defaults'](_0x5f0eaa,{'raw':!![],'where':{'id':0x1}}))[_0x7df7('0xc')](function(_0x3afc2f){return checkLicense(_0x3afc2f,null);})[_0x7df7('0xc')](function(_0x3c9b45){_0x50b7a7(_0x3c9b45);return;})[_0x7df7('0xd')](function(_0x1a3022){_0x8e40a3(_0x1a3022);});});}function checkLicense(_0x1f642f,_0x490343){if(!_0x1f642f){demoLicense[_0x7df7('0xe')]=_0x1f642f[_0x7df7('0xf')];return demoLicense;}try{var _0x348f64=_0x490343||_0x1f642f[_0x7df7('0x10')];if(_[_0x7df7('0x11')](_0x348f64)){throw new Error(_0x7df7('0x12'));}var _0xfdad2c=_0x1f642f['data1'];var _0x2ab86e=_0x1f642f[_0x7df7('0x13')];var _0xab77f2=_0xfdad2c[_0x7df7('0x14')]('-')[0x4];var _0x36564b=_0xfdad2c[_0x7df7('0x14')]('-')[0x0];var _0x327e58=encryptor[_0x7df7('0x15')](_0x348f64,util['format'](_0x7df7('0x16'),_0xab77f2,_0xfdad2c,_0x36564b));var _0x2ba070=JSON[_0x7df7('0x17')](_0x327e58);_0x2ba070[_0x7df7('0x18')]=![];_0x2ba070[_0x7df7('0xe')]=_0xfdad2c;_0x2ba070[_0x7df7('0x19')]=hardware['getUuid']();if(_0x2ab86e){var _0x1d9793=encryptor['decryptString'](_0x2ab86e);_0x2ba070[_0x7df7('0x1a')]=_0x1d9793;_0x2ba070[_0x7df7('0x1b')]=moment(_0x1d9793)[_0x7df7('0x1c')](0x7,_0x7df7('0x1d'))['format']();_0x2ba070[_0x7df7('0x1e')]=_0x2ba070[_0x7df7('0xe')]!=_0x2ba070['machineUuid']?_0x7df7('0x1f'):_0x7df7('0x20');}return _0x2ba070;}catch(_0x53064f){breakingLicense[_0x7df7('0xe')]=_0x1f642f['data1'];breakingLicense[_0x7df7('0x21')]=_0x53064f[_0x7df7('0x21')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5c6c0c,_0x5b47b6){getLicense()[_0x7df7('0xc')](function(_0x10856b){return db[_0x7df7('0x22')][_0x7df7('0x23')]({'attributes':[_0x7df7('0x24'),[db[_0x7df7('0x25')]['fn']('COUNT',db['sequelize'][_0x7df7('0x26')]('role')),_0x7df7('0x27')]],'group':_0x7df7('0x24'),'where':{'role':{'$or':[_0x7df7('0x28'),_0x7df7('0x29'),_0x7df7('0x2a')]}},'raw':!![]})[_0x7df7('0xc')](function(_0x20692d){var _0xbcda89={'user':_0x10856b['users']||0x0,'telephone':_0x10856b[_0x7df7('0x2b')]||0x0};_0x20692d[_0x7df7('0x2c')](function(_0x2c6338){var _0xea35a8=_0x2c6338[_0x7df7('0x24')]===_0x7df7('0x28')?'user':_0x2c6338['role'];_0xbcda89[_0xea35a8]-=_0x2c6338[_0x7df7('0x27')];if(_0xbcda89[_0xea35a8]<0x0)_0xbcda89[_0xea35a8]=0x0;});_0x5c6c0c(_0xbcda89);return;});})['catch'](function(_0x480f9a){_0x5b47b6(_0x480f9a);});});}function checkUserLimits(_0x1c2cdb){return new BPromise(function(_0x53225d,_0x38d94e){getLimits()[_0x7df7('0xc')](function(_0xd6d9f6){var _0xfaab71=_[_0x7df7('0x2d')](_[_0x7df7('0x2e')](_0x1c2cdb,_0x7df7('0x24')),[_0x7df7('0x28'),_0x7df7('0x29'),_0x7df7('0x2a')]);var _0x7cc8a4=(_0xfaab71[_0x7df7('0x28')]||0x0)+(_0xfaab71[_0x7df7('0x29')]||0x0);var _0x36ed1a=_0xfaab71['telephone']||0x0;if(_0x7cc8a4>_0xd6d9f6[_0x7df7('0x29')])return _0x38d94e('License\x20limit\x20reached\x20for\x20users');if(_0x36ed1a>_0xd6d9f6['telephone'])return _0x38d94e(_0x7df7('0x2f'));return _0x53225d();})[_0x7df7('0xd')](function(_0x97bee2){_0x38d94e(_0x97bee2);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x644b=['telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','defaults','then','catch','uuid','license','isEmpty','data1','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','add','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','count','admin','user'];(function(_0x285043,_0xee0e4e){var _0x54a553=function(_0x2c174c){while(--_0x2c174c){_0x285043['push'](_0x285043['shift']());}};_0x54a553(++_0xee0e4e);}(_0x644b,0x1b9));var _0xb644=function(_0x5aaf93,_0x5c0001){_0x5aaf93=_0x5aaf93-0x0;var _0x17d307=_0x644b[_0x5aaf93];return _0x17d307;};'use strict';var util=require('util');var _=require(_0xb644('0x0'));var moment=require(_0xb644('0x1'));var BPromise=require(_0xb644('0x2'));var hardware=require(_0xb644('0x3'));var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb644('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xb644('0x5'),'machineUuid':hardware[_0xb644('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb644('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb644('0x7'),'machineUuid':hardware[_0xb644('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2423f9){return new BPromise(function(_0x464b03,_0x4793de){return db[_0xb644('0x8')]['find'](_[_0xb644('0x9')](_0x2423f9,{'raw':!![],'where':{'id':0x1}}))[_0xb644('0xa')](function(_0x2008b3){return checkLicense(_0x2008b3,null);})[_0xb644('0xa')](function(_0x4b0da3){_0x464b03(_0x4b0da3);return;})[_0xb644('0xb')](function(_0x2ef480){_0x4793de(_0x2ef480);});});}function checkLicense(_0x48126b,_0x2c54a3){if(!_0x48126b){demoLicense[_0xb644('0xc')]=_0x48126b['data1'];return demoLicense;}try{var _0x530cd8=_0x2c54a3||_0x48126b[_0xb644('0xd')];if(_[_0xb644('0xe')](_0x530cd8)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x2ebbd4=_0x48126b[_0xb644('0xf')];var _0x837e0a=_0x48126b[_0xb644('0x10')];var _0x3f93b2=_0x2ebbd4[_0xb644('0x11')]('-')[0x4];var _0x25b3e3=_0x2ebbd4[_0xb644('0x11')]('-')[0x0];var _0x40b9cd=encryptor[_0xb644('0x12')](_0x530cd8,util[_0xb644('0x13')](_0xb644('0x14'),_0x3f93b2,_0x2ebbd4,_0x25b3e3));var _0x13e0e1=JSON[_0xb644('0x15')](_0x40b9cd);_0x13e0e1[_0xb644('0x16')]=![];_0x13e0e1[_0xb644('0xc')]=_0x2ebbd4;_0x13e0e1[_0xb644('0x17')]=hardware['getUuid']();if(_0x837e0a){var _0x31f29d=encryptor[_0xb644('0x12')](_0x837e0a);_0x13e0e1[_0xb644('0x18')]=_0x31f29d;_0x13e0e1['deadline']=moment(_0x31f29d)[_0xb644('0x19')](0x7,_0xb644('0x1a'))[_0xb644('0x13')]();_0x13e0e1[_0xb644('0x1b')]=_0x13e0e1['uuid']!=_0x13e0e1[_0xb644('0x17')]?_0xb644('0x1c'):_0xb644('0x1d');}return _0x13e0e1;}catch(_0x5f1aba){breakingLicense[_0xb644('0xc')]=_0x48126b[_0xb644('0xf')];breakingLicense['message']=_0x5f1aba[_0xb644('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x592a05,_0x24f358){getLicense()[_0xb644('0xa')](function(_0x567941){return db[_0xb644('0x1f')][_0xb644('0x20')]({'attributes':[_0xb644('0x21'),[db[_0xb644('0x22')]['fn'](_0xb644('0x23'),db[_0xb644('0x22')]['col']('role')),_0xb644('0x24')]],'group':'role','where':{'role':{'$or':[_0xb644('0x25'),_0xb644('0x26'),_0xb644('0x27')]}},'raw':!![]})['then'](function(_0x9370d5){var _0x455834={'user':_0x567941[_0xb644('0x28')]||0x0,'telephone':_0x567941[_0xb644('0x29')]||0x0};_0x9370d5[_0xb644('0x2a')](function(_0x293797){var _0x1dae86=_0x293797['role']===_0xb644('0x25')?_0xb644('0x26'):_0x293797[_0xb644('0x21')];_0x455834[_0x1dae86]-=_0x293797[_0xb644('0x24')];if(_0x455834[_0x1dae86]<0x0)_0x455834[_0x1dae86]=0x0;});_0x592a05(_0x455834);return;});})[_0xb644('0xb')](function(_0x1fd79a){_0x24f358(_0x1fd79a);});});}function checkUserLimits(_0x451daf){return new BPromise(function(_0x15b008,_0x21f866){getLimits()[_0xb644('0xa')](function(_0xd3b8e1){var _0x4fbbf8=_[_0xb644('0x2b')](_[_0xb644('0x2c')](_0x451daf,_0xb644('0x21')),['admin',_0xb644('0x26'),_0xb644('0x27')]);var _0x2e9dc2=(_0x4fbbf8['admin']||0x0)+(_0x4fbbf8['user']||0x0);var _0x51678b=_0x4fbbf8[_0xb644('0x27')]||0x0;if(_0x2e9dc2>_0xd3b8e1[_0xb644('0x26')])return _0x21f866(_0xb644('0x2d'));if(_0x51678b>_0xd3b8e1['telephone'])return _0x21f866(_0xb644('0x2e'));return _0x15b008();})[_0xb644('0xb')](function(_0x5adce0){_0x21f866(_0x5adce0);});});}module[_0xb644('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 990f720..d29a277 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 _0x4024=['secret','exports','http://localhost:9000','app-id'];(function(_0x4fc7d6,_0x128e72){var _0x2ec385=function(_0x4cb960){while(--_0x4cb960){_0x4fc7d6['push'](_0x4fc7d6['shift']());}};_0x2ec385(++_0x128e72);}(_0x4024,0x89));var _0x4402=function(_0xc02915,_0x48be3e){_0xc02915=_0xc02915-0x0;var _0x366bb0=_0x4024[_0xc02915];return _0x366bb0;};'use strict';module[_0x4402('0x0')]={'DOMAIN':_0x4402('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4402('0x2'),'GOOGLE_SECRET':_0x4402('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x056b=['app-id','secret','http://localhost:9000','myappanuglar-secret'];(function(_0x3d42d6,_0x481a22){var _0x3a3060=function(_0x5b0bfc){while(--_0x5b0bfc){_0x3d42d6['push'](_0x3d42d6['shift']());}};_0x3a3060(++_0x481a22);}(_0x056b,0xb6));var _0xb056=function(_0x46a635,_0x3cf6f0){_0x46a635=_0x46a635-0x0;var _0xff72f1=_0x056b[_0x46a635];return _0xff72f1;};'use strict';module['exports']={'DOMAIN':_0xb056('0x0'),'SESSION_SECRET':_0xb056('0x1'),'GOOGLE_ID':_0xb056('0x2'),'GOOGLE_SECRET':_0xb056('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 12bd635..95b08b6 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44ee=['exports','../utils/loggers','fileLogger'];(function(_0x56b9ee,_0x4a5017){var _0x5bcf31=function(_0x302e8e){while(--_0x302e8e){_0x56b9ee['push'](_0x56b9ee['shift']());}};_0x5bcf31(++_0x4a5017);}(_0x44ee,0x88));var _0xe44e=function(_0x4004ba,_0x3e52a5){_0x4004ba=_0x4004ba-0x0;var _0x4eddc1=_0x44ee[_0x4004ba];return _0x4eddc1;};'use strict';var fileLogger=require(_0xe44e('0x0'))[_0xe44e('0x1')];module[_0xe44e('0x2')]=fileLogger; \ No newline at end of file +var _0xee8c=['exports','../utils/loggers','fileLogger'];(function(_0x2de697,_0x1cba29){var _0x36bc45=function(_0x4c4390){while(--_0x4c4390){_0x2de697['push'](_0x2de697['shift']());}};_0x36bc45(++_0x1cba29);}(_0xee8c,0x7f));var _0xcee8=function(_0x12f180,_0x37da58){_0x12f180=_0x12f180-0x0;var _0x589aec=_0xee8c[_0x12f180];return _0x589aec;};'use strict';var fileLogger=require(_0xcee8('0x0'))[_0xcee8('0x1')];module[_0xcee8('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index f9bcd1a..ec3e5fa 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 _0xc161=['../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','express','join'];(function(_0x54516e,_0x5df54c){var _0x4d1e6f=function(_0x454bbc){while(--_0x454bbc){_0x54516e['push'](_0x54516e['shift']());}};_0x4d1e6f(++_0x5df54c);}(_0xc161,0xa7));var _0x1c16=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0xc161[_0x13843f];return _0x1063ae;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x1c16('0x0'),'script':path[_0x1c16('0x1')](__dirname,_0x1c16('0x2'))},{'name':_0x1c16('0x3'),'script':path[_0x1c16('0x1')](__dirname,_0x1c16('0x4'))},{'name':_0x1c16('0x5'),'script':path[_0x1c16('0x1')](__dirname,_0x1c16('0x6'))},{'name':_0x1c16('0x7'),'script':path[_0x1c16('0x1')](__dirname,_0x1c16('0x8'))},{'name':_0x1c16('0x9'),'script':path[_0x1c16('0x1')](__dirname,'../../services/routing/index.js')},{'name':_0x1c16('0xa'),'script':path[_0x1c16('0x1')](__dirname,_0x1c16('0xb'))}]};module[_0x1c16('0xc')]=config; \ No newline at end of file +var _0xb6c4=['exports','path','express','ami','join','agi','email','routing','../../services/xdr/index.js'];(function(_0x103478,_0x33f5f0){var _0x5b2b02=function(_0x5ab720){while(--_0x5ab720){_0x103478['push'](_0x103478['shift']());}};_0x5b2b02(++_0x33f5f0);}(_0xb6c4,0xbe));var _0x4b6c=function(_0x3ffbab,_0x2ee1b4){_0x3ffbab=_0x3ffbab-0x0;var _0x42b220=_0xb6c4[_0x3ffbab];return _0x42b220;};'use strict';var path=require(_0x4b6c('0x0'));var os=require('os');var config={'apps':[{'name':_0x4b6c('0x1'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0x4b6c('0x2'),'script':path[_0x4b6c('0x3')](__dirname,'../../services/ami/index.js')},{'name':_0x4b6c('0x4'),'script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0x4b6c('0x5'),'script':path[_0x4b6c('0x3')](__dirname,'../../services/email/index.js')},{'name':_0x4b6c('0x6'),'script':path['join'](__dirname,'../../services/routing/index.js')},{'name':'xdr','script':path[_0x4b6c('0x3')](__dirname,_0x4b6c('0x7'))}]};module[_0x4b6c('0x8')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 890a979..e45a536 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 _0xb382=['connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','connect'];(function(_0x36139d,_0xa45e95){var _0x16eb27=function(_0x2fb633){while(--_0x2fb633){_0x36139d['push'](_0x36139d['shift']());}};_0x16eb27(++_0xa45e95);}(_0xb382,0x193));var _0x2b38=function(_0x2da33a,_0x21cf38){_0x2da33a=_0x2da33a-0x0;var _0xdbb35=_0xb382[_0x2da33a];return _0xdbb35;};'use strict';var pm2=require(_0x2b38('0x0'));var BPromise=require(_0x2b38('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x647bc8,_0x22fc45){return pm2[_0x2b38('0x2')](function(_0xc8524f){if(_0xc8524f){return _0x22fc45(_0xc8524f);}return _0x647bc8(_0x2b38('0x3'));});});};exports[_0x2b38('0x4')]=function(_0x230964){return connect()[_0x2b38('0x5')](function(){return new BPromise(function(_0x5346c8,_0x3faa88){return pm2[_0x2b38('0x4')](_0x230964,function(_0x3dbc2a,_0x17a75e){if(_0x3dbc2a){return _0x3faa88(_0x3dbc2a);}pm2[_0x2b38('0x6')]();return _0x5346c8(_0x17a75e);});});});};exports['stop']=function(_0xb9b0b7){return connect()[_0x2b38('0x5')](function(){return new BPromise(function(_0x2fa1d5,_0x5b412e){return pm2[_0x2b38('0x7')](_0xb9b0b7,function(_0x1ecd77,_0x4191ef){if(_0x1ecd77){return _0x5b412e(_0x1ecd77);}pm2[_0x2b38('0x6')]();return _0x2fa1d5(_0x4191ef);});});});};exports[_0x2b38('0x8')]=function(_0x14d1d2){return connect()['then'](function(){return new BPromise(function(_0x57d98e,_0x39798b){return pm2[_0x2b38('0x8')](_0x14d1d2,function(_0xf3ebf9,_0x39b158){if(_0xf3ebf9){return _0x39798b(_0xf3ebf9);}pm2[_0x2b38('0x6')]();return _0x57d98e(_0x39b158);});});});};exports[_0x2b38('0x9')]=function(){return connect()[_0x2b38('0x5')](function(){return new BPromise(function(_0x2e58c0,_0x59dd5b){return pm2[_0x2b38('0x9')](function(_0x36db2b,_0x5a88cc){if(_0x36db2b){return _0x59dd5b(_0x36db2b);}pm2[_0x2b38('0x6')]();return _0x2e58c0(_0x5a88cc);});});});};exports[_0x2b38('0xa')]=function(_0x82b99f){return connect()['then'](function(){return new BPromise(function(_0x2b2b9a,_0x18848e){return pm2['describe'](_0x82b99f,function(_0x8f9a67,_0x360f6c){if(_0x8f9a67){return _0x18848e(_0x8f9a67);}pm2[_0x2b38('0x6')]();return _0x2b2b9a(_0x360f6c);});});});};exports[_0x2b38('0xb')]=function(_0x4878fc){return connect()['then'](function(){return new BPromise(function(_0x11927c,_0x359673){return pm2[_0x2b38('0xb')](_0x4878fc,function(_0x10a334,_0x631332){if(_0x10a334){return _0x359673(_0x10a334);}pm2[_0x2b38('0x6')]();return _0x11927c(_0x631332);});});});};exports[_0x2b38('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2684a3,_0x3f4888){return pm2['dump'](function(_0x2a05c3){if(_0x2a05c3){return _0x3f4888(_0x2a05c3);}return _0x2684a3(_0x2b38('0xd'));});});});}; \ No newline at end of file +var _0xe37e=['then','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connected','start','disconnect','stop'];(function(_0xaca658,_0x19feee){var _0x35079a=function(_0x5677d2){while(--_0x5677d2){_0xaca658['push'](_0xaca658['shift']());}};_0x35079a(++_0x19feee);}(_0xe37e,0xf5));var _0xee37=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xe37e[_0x39d544];return _0x5a5ff2;};'use strict';var pm2=require(_0xee37('0x0'));var BPromise=require(_0xee37('0x1'));var config=require(_0xee37('0x2'));function connect(){return new BPromise(function(_0x34aed0,_0x282d8a){return pm2['connect'](function(_0x166c99){if(_0x166c99){return _0x282d8a(_0x166c99);}return _0x34aed0(_0xee37('0x3'));});});};exports[_0xee37('0x4')]=function(_0x5cc387){return connect()['then'](function(){return new BPromise(function(_0x35cae6,_0x18c344){return pm2[_0xee37('0x4')](_0x5cc387,function(_0x57bb3d,_0x3b7369){if(_0x57bb3d){return _0x18c344(_0x57bb3d);}pm2[_0xee37('0x5')]();return _0x35cae6(_0x3b7369);});});});};exports[_0xee37('0x6')]=function(_0x42deb1){return connect()[_0xee37('0x7')](function(){return new BPromise(function(_0x1bf500,_0x2135ae){return pm2[_0xee37('0x6')](_0x42deb1,function(_0x5d5593,_0x1848ad){if(_0x5d5593){return _0x2135ae(_0x5d5593);}pm2[_0xee37('0x5')]();return _0x1bf500(_0x1848ad);});});});};exports[_0xee37('0x8')]=function(_0x12b331){return connect()['then'](function(){return new BPromise(function(_0x339df0,_0xe3a1bc){return pm2['restart'](_0x12b331,function(_0x29ba10,_0x47783f){if(_0x29ba10){return _0xe3a1bc(_0x29ba10);}pm2[_0xee37('0x5')]();return _0x339df0(_0x47783f);});});});};exports['list']=function(){return connect()[_0xee37('0x7')](function(){return new BPromise(function(_0x2a4c5d,_0x3bd4d6){return pm2[_0xee37('0x9')](function(_0x38b3ef,_0x1a7f3e){if(_0x38b3ef){return _0x3bd4d6(_0x38b3ef);}pm2[_0xee37('0x5')]();return _0x2a4c5d(_0x1a7f3e);});});});};exports[_0xee37('0xa')]=function(_0x169846){return connect()[_0xee37('0x7')](function(){return new BPromise(function(_0xf16d48,_0x57fa41){return pm2[_0xee37('0xa')](_0x169846,function(_0x9a88fc,_0x323555){if(_0x9a88fc){return _0x57fa41(_0x9a88fc);}pm2[_0xee37('0x5')]();return _0xf16d48(_0x323555);});});});};exports[_0xee37('0xb')]=function(_0x10639e){return connect()[_0xee37('0x7')](function(){return new BPromise(function(_0x142460,_0x2bc8d1){return pm2[_0xee37('0xb')](_0x10639e,function(_0x18b53d,_0x3bd3ed){if(_0x18b53d){return _0x2bc8d1(_0x18b53d);}pm2['disconnect']();return _0x142460(_0x3bd3ed);});});});};exports['dump']=function(){return connect()[_0xee37('0x7')](function(){return new BPromise(function(_0x1ce9c5,_0x471644){return pm2[_0xee37('0xc')](function(_0x3791b4){if(_0x3791b4){return _0x471644(_0x3791b4);}return _0x1ce9c5(_0xee37('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index b103e23..84588a1 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 _0x9ad8=['inspect','lodash','moment','ioredis','util','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','findAll','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error'];(function(_0x210d7f,_0x2abe4f){var _0x42d687=function(_0x46b2ae){while(--_0x46b2ae){_0x210d7f['push'](_0x210d7f['shift']());}};_0x42d687(++_0x2abe4f);}(_0x9ad8,0xe1));var _0x89ad=function(_0x64b57d,_0x2a79d8){_0x64b57d=_0x64b57d-0x0;var _0x2f55bd=_0x9ad8[_0x64b57d];return _0x2f55bd;};'use strict';var _=require(_0x89ad('0x0'));var moment=require(_0x89ad('0x1'));var Redis=require(_0x89ad('0x2'));var util=require(_0x89ad('0x3'));var config=require('../../config/environment');var db=require(_0x89ad('0x4'))['db'];var logger=require('../logger')(_0x89ad('0x5'));config[_0x89ad('0x6')]=_[_0x89ad('0x7')](config[_0x89ad('0x6')],{'host':_0x89ad('0x8'),'port':0x18eb});var io=require(_0x89ad('0x9'))(new Redis(config[_0x89ad('0x6')]));function closeInteractions(){var _0x3dbef7=0x0;var _0x22e266=[];return db[_0x89ad('0xa')]['find']({'raw':!![],'attributes':['id',_0x89ad('0xb')],'where':{'id':0x1}})[_0x89ad('0xc')](function(_0x207b62){_0x3dbef7=_0x207b62['chatTimeout'];if(_0x3dbef7){return db[_0x89ad('0xd')][_0x89ad('0xe')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x89ad('0xf')](_0x207b62[_0x89ad('0xb')],_0x89ad('0x10'))}}});}else{return[];}})['then'](function(_0x28b687){if(_0x28b687&&_0x28b687[_0x89ad('0x11')]){_0x22e266=_[_0x89ad('0x12')](_0x28b687||[],'id');logger[_0x89ad('0x13')](_0x89ad('0x14'),_0x22e266[_0x89ad('0x15')]());return db['ChatInteraction'][_0x89ad('0x16')]({'closeReason':_0x89ad('0x17'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x89ad('0x18')](_0x89ad('0x19'))},{'where':{'id':_0x22e266}});}})[_0x89ad('0xc')](function(){if(_0x22e266&&_0x22e266[_0x89ad('0x11')]){logger['info'](_0x89ad('0x1a'),_0x22e266[_0x89ad('0x15')]());for(var _0x1ef52e=0x0;_0x1ef52e<_0x22e266[_0x89ad('0x11')];_0x1ef52e++){io[_0x89ad('0x1b')](_0x89ad('0x1c'),{'id':_0x22e266[_0x1ef52e],'closed':!![]});}}})[_0x89ad('0x1d')](function(_0x3f6b70){logger[_0x89ad('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0x3f6b70?util[_0x89ad('0x1f')](_0x3f6b70,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2feb=['minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','socket.io-emitter','Setting','chatTimeout','ChatInteraction','lastMsgAt'];(function(_0x325fd8,_0x43c0e4){var _0x5b3c9a=function(_0x5c17f7){while(--_0x5c17f7){_0x325fd8['push'](_0x325fd8['shift']());}};_0x5b3c9a(++_0x43c0e4);}(_0x2feb,0x6f));var _0xb2fe=function(_0x5e5c7b,_0x2495a3){_0x5e5c7b=_0x5e5c7b-0x0;var _0x3f947f=_0x2feb[_0x5e5c7b];return _0x3f947f;};'use strict';var _=require(_0xb2fe('0x0'));var moment=require(_0xb2fe('0x1'));var Redis=require(_0xb2fe('0x2'));var util=require('util');var config=require(_0xb2fe('0x3'));var db=require(_0xb2fe('0x4'))['db'];var logger=require(_0xb2fe('0x5'))(_0xb2fe('0x6'));config[_0xb2fe('0x7')]=_['defaults'](config[_0xb2fe('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xb2fe('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x2a458e=0x0;var _0x299ace=[];return db[_0xb2fe('0x9')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x5184f6){_0x2a458e=_0x5184f6[_0xb2fe('0xa')];if(_0x2a458e){return db[_0xb2fe('0xb')]['findAll']({'raw':!![],'attributes':['id',_0xb2fe('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x5184f6[_0xb2fe('0xa')],_0xb2fe('0xd'))}}});}else{return[];}})[_0xb2fe('0xe')](function(_0x472389){if(_0x472389&&_0x472389[_0xb2fe('0xf')]){_0x299ace=_[_0xb2fe('0x10')](_0x472389||[],'id');logger[_0xb2fe('0x11')](_0xb2fe('0x12'),_0x299ace['join']());return db['ChatInteraction'][_0xb2fe('0x13')]({'closeReason':_0xb2fe('0x14'),'disposition':_0xb2fe('0x15'),'closed':!![],'closedAt':moment()[_0xb2fe('0x16')](_0xb2fe('0x17'))},{'where':{'id':_0x299ace}});}})['then'](function(){if(_0x299ace&&_0x299ace[_0xb2fe('0xf')]){logger[_0xb2fe('0x11')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x299ace['join']());for(var _0x1959fa=0x0;_0x1959fa<_0x299ace[_0xb2fe('0xf')];_0x1959fa++){io[_0xb2fe('0x18')](_0xb2fe('0x19'),{'id':_0x299ace[_0x1959fa],'closed':!![]});}}})[_0xb2fe('0x1a')](function(_0x88a3ee){logger[_0xb2fe('0x1b')](_0xb2fe('0x1c'),_0x88a3ee?util[_0xb2fe('0x1d')](_0x88a3ee,{'showHidden':![],'depth':null}):'');});}exports[_0xb2fe('0x1e')]=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 8f7d733..cd0f9e9 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 _0x04c1=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x4eb832,_0x324bff){var _0x2e5927=function(_0x4687ce){while(--_0x4687ce){_0x4eb832['push'](_0x4eb832['shift']());}};_0x2e5927(++_0x324bff);}(_0x04c1,0x79));var _0x104c=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0x04c1[_0x19dd7a];return _0x3feb6a;};'use strict';function start(){var _0x326780=require(_0x104c('0x0'));return _0x326780[_0x104c('0x1')]();}module[_0x104c('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xe2d6=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x449c96,_0x4428d9){var _0x528e73=function(_0x34bdaa){while(--_0x34bdaa){_0x449c96['push'](_0x449c96['shift']());}};_0x528e73(++_0x4428d9);}(_0xe2d6,0xae));var _0x6e2d=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0xe2d6[_0x3fe6df];return _0x372a0e;};'use strict';function start(){var _0x5c821a=require(_0x6e2d('0x0'));return _0x5c821a[_0x6e2d('0x1')]();}module[_0x6e2d('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 46e8361..7f64bd5 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 _0xbb3e=['keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','toRun','index','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','add','add\x20cron','update','stop\x20cron','run','start','util','path','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','extname','zip','join','existsSync','status','Sent','message','text','stringify','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','then','error','error\x20mail','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','findAll','CloudProvider'];(function(_0x2d759a,_0x316fda){var _0x4cc6a3=function(_0x34edf1){while(--_0x34edf1){_0x2d759a['push'](_0x2d759a['shift']());}};_0x4cc6a3(++_0x316fda);}(_0xbb3e,0x116));var _0xebb3=function(_0x115819,_0x5ea0c9){_0x115819=_0x115819-0x0;var _0x39a48b=_0xbb3e[_0x115819];return _0x39a48b;};'use strict';var fs=require('fs');var util=require(_0xebb3('0x0'));var path=require(_0xebb3('0x1'));var _=require(_0xebb3('0x2'));var moment=require(_0xebb3('0x3'));var CronJobManager=require(_0xebb3('0x4'));var jayson=require(_0xebb3('0x5'));var BPromise=require('bluebird');var logger=require(_0xebb3('0x6'))(_0xebb3('0x7'));var db=require(_0xebb3('0x8'))['db'];var analyticCustomReportController=require(_0xebb3('0x9'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xebb3('0xa')][_0xebb3('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4f1e82,_0x253dfe){return function(){logger[_0xebb3('0xc')](_0xebb3('0xd'),_0x4f1e82[_0xebb3('0xe')]);var _0x14579c=!![];var _0x13f546=_0x4f1e82[_0xebb3('0xf')][_0xebb3('0x10')]();var _0x23d57f={'account':_0x13f546,'message':{'from':util[_0xebb3('0x11')](_0xebb3('0x12'),_0x4f1e82[_0xebb3('0xf')][_0xebb3('0x13')],_0x4f1e82[_0xebb3('0xf')]['email']||_0x4f1e82['MailAccount'][_0xebb3('0x14')][_0xebb3('0x15')]),'to':_0x4f1e82[_0xebb3('0xe')],'cc':_0x4f1e82['cc'],'bcc':_0x4f1e82['bcc'],'subject':util[_0xebb3('0x11')](_0xebb3('0x16'),_0x253dfe[_0xebb3('0x13')],_0x4f1e82[_0xebb3('0x17')],_0x4f1e82[_0xebb3('0x18')])}};var _0xfa7280=path['join'](__dirname,_0xebb3('0x19'));var _0x171921=_0x253dfe[_0xebb3('0x1a')];var _0x230af6=util[_0xebb3('0x11')](_0xebb3('0x1b'),path['basename'](_0x253dfe[_0xebb3('0x1a')],path[_0xebb3('0x1c')](_0x253dfe[_0xebb3('0x1a')])),_0xebb3('0x1d'));var _0x43626a=path[_0xebb3('0x1e')](_0xfa7280,_0x171921);var _0x236da7=path[_0xebb3('0x1e')](_0xfa7280,_0x230af6);if(fs[_0xebb3('0x1f')](_0x43626a)){_0x253dfe[_0xebb3('0x20')]=_0xebb3('0x21');_0x23d57f['message']['attachments']=[{'filename':_0x171921,'path':_0x43626a}];_0x23d57f[_0xebb3('0x22')][_0xebb3('0x23')]=util[_0xebb3('0x11')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xebb3('0x24')](_0x253dfe,null,0x2));}else if(fs[_0xebb3('0x1f')](_0x236da7)){_0x253dfe[_0xebb3('0x20')]=_0xebb3('0x21');_0x23d57f[_0xebb3('0x22')][_0xebb3('0x25')]=[{'filename':_0x230af6,'path':_0x236da7}];}else{_0x23d57f[_0xebb3('0x22')][_0xebb3('0x23')]=_0xebb3('0x26');if(!_0x4f1e82[_0xebb3('0x27')]){_0x14579c=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x14579c){return client[_0xebb3('0x28')]('SendMail',_0x23d57f)[_0xebb3('0x29')](function(_0x3cc5fd){if(_0x3cc5fd['error']){return logger[_0xebb3('0x2a')](_0xebb3('0x2b'),JSON[_0xebb3('0x24')](_0x3cc5fd));}return logger[_0xebb3('0xc')]('email\x20sent');})[_0xebb3('0x2c')](function(_0x3fe8c8){return logger['error'](_0xebb3('0x2b'),JSON['stringify'](_0x3fe8c8));});}};}function handleError(){return function(_0x131e1f){return logger[_0xebb3('0x2a')](JSON[_0xebb3('0x24')](_0x131e1f));};}function handleResult(_0x12eb2d){return function(_0x480697){logger['info']('data',JSON[_0xebb3('0x24')](_0x480697));if(_0x12eb2d[_0xebb3('0xf')]&&_0x12eb2d[_0xebb3('0xf')]['Smtp']&&!_[_0xebb3('0x2d')](_0x12eb2d[_0xebb3('0xe')])){setTimeout(handleSendEmail(_0x12eb2d,_0x480697),0x3c*0x3e8);}};}function handleJob(_0x371196){return function(){try{if(_['isNil'](_0x371196[_0xebb3('0x17')])){return logger[_0xebb3('0xc')](_0xebb3('0x2e'));}if(_[_0xebb3('0x2d')](_0x371196[_0xebb3('0x18')])){return logger[_0xebb3('0xc')](_0xebb3('0x2f'));}var _0x1de16a={'startDate':moment()[_0xebb3('0x30')](_0x371196[_0xebb3('0x17')],_0x371196[_0xebb3('0x18')])[_0xebb3('0x11')](_0xebb3('0x31')),'endDate':moment()['format'](_0xebb3('0x31')),'type':_0xebb3('0x32'),'output':_0x371196[_0xebb3('0x33')],'name':_0x371196['name']};if(!_[_0xebb3('0x2d')](_0x371196[_0xebb3('0x34')])){logger[_0xebb3('0xc')](_0xebb3('0x35'),_0x371196[_0xebb3('0x34')]);return analyticDefaultReportController[_0xebb3('0x36')]({'id':_0x371196[_0xebb3('0x34')]},_0x1de16a)[_0xebb3('0x29')](handleResult(_0x371196))[_0xebb3('0x2c')](handleError());}if(!_[_0xebb3('0x2d')](_0x371196[_0xebb3('0x37')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x371196[_0xebb3('0x37')]);return analyticCustomReportController[_0xebb3('0x36')]({'id':_0x371196['CustomReportId']},_0x1de16a)[_0xebb3('0x29')](handleResult(_0x371196))[_0xebb3('0x2c')](handleError());}}catch(_0x3f9207){logger[_0xebb3('0x2a')](JSON[_0xebb3('0x24')](_0x3f9207));}return logger[_0xebb3('0xc')]('no\x20report\x20id');};}function getJobs(_0x2627d1){var _0xaee70d={};if(_0x2627d1){_0xaee70d['id']=_0x2627d1;}return db['Schedule'][_0xebb3('0x38')]({'where':_0xaee70d,'include':[{'model':db[_0xebb3('0xf')],'attributes':['id',_0xebb3('0x13'),'email'],'include':[{'model':db['MailServerOut'],'as':_0xebb3('0x14'),'include':[{'model':db[_0xebb3('0x39')],'as':_0xebb3('0x39')}]}]}]})[_0xebb3('0x29')](function(_0x4d1a2c){var _0x555a15=_[_0xebb3('0x3a')](manager[_0xebb3('0x3b')]);var _0x463709=_[_0xebb3('0x3c')](_0x4d1a2c,function(_0x4f422c){return _0x4f422c['id'][_0xebb3('0x3d')]();});var _0x490252=_[_0xebb3('0x3e')](_0x4d1a2c,function(_0x2ebe64){return _0x2ebe64['id']['toString']();});var _0x131003=_0x2627d1?_0x463709:_[_0xebb3('0x3f')](_0x463709,_0x555a15);var _0x57e0e5=_[_0xebb3('0x40')](_0x463709,_0x555a15);var _0x17647e=_[_0xebb3('0x3f')](_0x555a15,_0x463709);var _0x14ef19;var _0x2e1eb7;for(_0x14ef19=0x0;_0x14ef19<_0x17647e[_0xebb3('0x41')]&&!_0x2627d1;_0x14ef19+=0x1){_0x2e1eb7=_0x17647e[_0x14ef19][_0xebb3('0x3d')]();if(manager[_0xebb3('0x42')](_0x2e1eb7)){manager[_0xebb3('0x43')](_0x2e1eb7);manager[_0xebb3('0x44')](_0x2e1eb7);logger[_0xebb3('0xc')]('delete\x20cron',_0x2e1eb7);}}logger[_0xebb3('0xc')](_0xebb3('0x45'),JSON[_0xebb3('0x24')](_0x131003));for(_0x14ef19=0x0;_0x14ef19<_0x131003['length'];_0x14ef19+=0x1){_0x2e1eb7=_0x131003[_0x14ef19][_0xebb3('0x3d')]();logger[_0xebb3('0xc')](_0xebb3('0x46'),_0x2e1eb7);if(_0x2627d1){logger[_0xebb3('0xc')](_0xebb3('0x47'),_0x2627d1);logger[_0xebb3('0xc')](JSON[_0xebb3('0x24')](_0x490252[_0x2e1eb7]));BPromise['resolve']()[_0xebb3('0x29')](handleJob(_0x490252[_0x2e1eb7]));logger['info'](_0xebb3('0x48'),_0x490252[_0x2e1eb7][_0xebb3('0x13')],_0x490252[_0x2e1eb7][_0xebb3('0x49')]);}else if(_0x490252[_0x2e1eb7][_0xebb3('0x49')]&&_0x490252[_0x2e1eb7][_0xebb3('0x4a')]&&moment()[_0xebb3('0x4b')](_0x490252[_0x2e1eb7][_0xebb3('0x4c')],_0x490252[_0x2e1eb7][_0xebb3('0x4d')])){manager[_0xebb3('0x4e')](_0x2e1eb7,_0x490252[_0x2e1eb7][_0xebb3('0x49')],handleJob(_0x490252[_0x2e1eb7]));manager['start'](_0x2e1eb7);logger[_0xebb3('0xc')](_0xebb3('0x4f'),_0x490252[_0x2e1eb7]['name'],_0x490252[_0x2e1eb7][_0xebb3('0x49')]);}else if(manager['exists'](_0x2e1eb7)){manager[_0xebb3('0x43')](_0x2e1eb7);manager['deleteJob'](_0x2e1eb7);logger[_0xebb3('0xc')]('stop\x20cron',_0x490252[_0x2e1eb7][_0xebb3('0x13')],_0x490252[_0x2e1eb7][_0xebb3('0x49')]);}}for(_0x14ef19=0x0,_0x2e1eb7;_0x14ef19<_0x57e0e5['length']&&!_0x2627d1;_0x14ef19+=0x1){_0x2e1eb7=_0x57e0e5[_0x14ef19][_0xebb3('0x3d')]();if(manager[_0xebb3('0x42')](_0x2e1eb7)){if(_0x490252[_0x2e1eb7][_0xebb3('0x49')]&&_0x490252[_0x2e1eb7][_0xebb3('0x4a')]&&moment()['isBetween'](_0x490252[_0x2e1eb7][_0xebb3('0x4c')],_0x490252[_0x2e1eb7][_0xebb3('0x4d')])){manager[_0xebb3('0x50')](_0x2e1eb7,_0x490252[_0x2e1eb7][_0xebb3('0x49')],handleJob(_0x490252[_0x2e1eb7]));logger[_0xebb3('0xc')]('update\x20cron',_0x490252[_0x2e1eb7][_0xebb3('0x13')],_0x490252[_0x2e1eb7][_0xebb3('0x49')]);}else{manager[_0xebb3('0x43')](_0x2e1eb7);manager[_0xebb3('0x44')](_0x2e1eb7);logger['info'](_0xebb3('0x51'),_0x490252[_0x2e1eb7][_0xebb3('0x13')],_0x490252[_0x2e1eb7]['cron']);}}}})[_0xebb3('0x2c')](function(_0x3510be){logger[_0xebb3('0x2a')](JSON['stringify'](_0x3510be));});}exports[_0xebb3('0x52')]=function(_0x19334a){return getJobs(_0x19334a);};exports[_0xebb3('0x53')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xd364=['Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','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','then','error','error\x20mail','data','isNil','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','format','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','CloudProvider','jobs','map','toString','keyBy','difference','intersection','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','cron','active','isBetween','startAt','endAt','add','add\x20cron','exists','stop\x20cron','run','start','util','lodash','cron-job-manager','jayson/promise','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','%s.%s','extname','zip','existsSync','status','Sent','message','text'];(function(_0x3cc8cb,_0x31f8fe){var _0x427615=function(_0x4dda8e){while(--_0x4dda8e){_0x3cc8cb['push'](_0x3cc8cb['shift']());}};_0x427615(++_0x31f8fe);}(_0xd364,0x8a));var _0x4d36=function(_0x2ec225,_0x127c27){_0x2ec225=_0x2ec225-0x0;var _0x3c2395=_0xd364[_0x2ec225];return _0x3c2395;};'use strict';var fs=require('fs');var util=require(_0x4d36('0x0'));var path=require('path');var _=require(_0x4d36('0x1'));var moment=require('moment');var CronJobManager=require(_0x4d36('0x2'));var jayson=require(_0x4d36('0x3'));var BPromise=require('bluebird');var logger=require(_0x4d36('0x4'))(_0x4d36('0x5'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x4d36('0x6'));var analyticDefaultReportController=require(_0x4d36('0x7'));var client=jayson[_0x4d36('0x8')][_0x4d36('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x37e8e0,_0x459607){return function(){logger[_0x4d36('0xa')](_0x4d36('0xb'),_0x37e8e0[_0x4d36('0xc')]);var _0x5e84d1=!![];var _0x3112d3=_0x37e8e0['MailAccount'][_0x4d36('0xd')]();var _0x22b74d={'account':_0x3112d3,'message':{'from':util['format'](_0x4d36('0xe'),_0x37e8e0[_0x4d36('0xf')][_0x4d36('0x10')],_0x37e8e0['MailAccount']['email']||_0x37e8e0[_0x4d36('0xf')][_0x4d36('0x11')][_0x4d36('0x12')]),'to':_0x37e8e0[_0x4d36('0xc')],'cc':_0x37e8e0['cc'],'bcc':_0x37e8e0['bcc'],'subject':util['format'](_0x4d36('0x13'),_0x459607[_0x4d36('0x10')],_0x37e8e0[_0x4d36('0x14')],_0x37e8e0['subtractUnit'])}};var _0x30ce1a=path[_0x4d36('0x15')](__dirname,_0x4d36('0x16'));var _0x1ba3f0=_0x459607[_0x4d36('0x17')];var _0x7d8938=util['format'](_0x4d36('0x18'),path['basename'](_0x459607['savename'],path[_0x4d36('0x19')](_0x459607[_0x4d36('0x17')])),_0x4d36('0x1a'));var _0x3f9a1d=path[_0x4d36('0x15')](_0x30ce1a,_0x1ba3f0);var _0x45b649=path[_0x4d36('0x15')](_0x30ce1a,_0x7d8938);if(fs[_0x4d36('0x1b')](_0x3f9a1d)){_0x459607[_0x4d36('0x1c')]=_0x4d36('0x1d');_0x22b74d['message']['attachments']=[{'filename':_0x1ba3f0,'path':_0x3f9a1d}];_0x22b74d[_0x4d36('0x1e')][_0x4d36('0x1f')]=util['format'](_0x4d36('0x20'),JSON[_0x4d36('0x21')](_0x459607,null,0x2));}else if(fs[_0x4d36('0x1b')](_0x45b649)){_0x459607[_0x4d36('0x1c')]=_0x4d36('0x1d');_0x22b74d[_0x4d36('0x1e')][_0x4d36('0x22')]=[{'filename':_0x7d8938,'path':_0x45b649}];}else{_0x22b74d[_0x4d36('0x1e')][_0x4d36('0x1f')]=_0x4d36('0x23');if(!_0x37e8e0[_0x4d36('0x24')]){_0x5e84d1=![];logger['info'](_0x4d36('0x25'));}}if(_0x5e84d1){return client[_0x4d36('0x26')]('SendMail',_0x22b74d)[_0x4d36('0x27')](function(_0x505e2b){if(_0x505e2b['error']){return logger[_0x4d36('0x28')](_0x4d36('0x29'),JSON['stringify'](_0x505e2b));}return logger[_0x4d36('0xa')]('email\x20sent');})['catch'](function(_0x366ac4){return logger[_0x4d36('0x28')](_0x4d36('0x29'),JSON[_0x4d36('0x21')](_0x366ac4));});}};}function handleError(){return function(_0x1d5e26){return logger[_0x4d36('0x28')](JSON[_0x4d36('0x21')](_0x1d5e26));};}function handleResult(_0x185903){return function(_0x1e51be){logger['info'](_0x4d36('0x2a'),JSON['stringify'](_0x1e51be));if(_0x185903['MailAccount']&&_0x185903['MailAccount'][_0x4d36('0x11')]&&!_['isNil'](_0x185903[_0x4d36('0xc')])){setTimeout(handleSendEmail(_0x185903,_0x1e51be),0x3c*0x3e8);}};}function handleJob(_0x781b7){return function(){try{if(_[_0x4d36('0x2b')](_0x781b7[_0x4d36('0x14')])){return logger[_0x4d36('0xa')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x4d36('0x2b')](_0x781b7[_0x4d36('0x2c')])){return logger['info'](_0x4d36('0x2d'));}var _0xc9af2d={'startDate':moment()[_0x4d36('0x2e')](_0x781b7['subtractNumber'],_0x781b7[_0x4d36('0x2c')])[_0x4d36('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x4d36('0x2f')](_0x4d36('0x30')),'type':_0x4d36('0x31'),'output':_0x781b7[_0x4d36('0x32')],'name':_0x781b7[_0x4d36('0x10')]};if(!_['isNil'](_0x781b7['DefaultReportId'])){logger[_0x4d36('0xa')](_0x4d36('0x33'),_0x781b7[_0x4d36('0x34')]);return analyticDefaultReportController[_0x4d36('0x35')]({'id':_0x781b7[_0x4d36('0x34')]},_0xc9af2d)[_0x4d36('0x27')](handleResult(_0x781b7))[_0x4d36('0x36')](handleError());}if(!_['isNil'](_0x781b7[_0x4d36('0x37')])){logger[_0x4d36('0xa')](_0x4d36('0x38'),_0x781b7[_0x4d36('0x37')]);return analyticCustomReportController['runReport']({'id':_0x781b7[_0x4d36('0x37')]},_0xc9af2d)[_0x4d36('0x27')](handleResult(_0x781b7))[_0x4d36('0x36')](handleError());}}catch(_0x29d70f){logger[_0x4d36('0x28')](JSON['stringify'](_0x29d70f));}return logger[_0x4d36('0xa')]('no\x20report\x20id');};}function getJobs(_0x18610e){var _0x123843={};if(_0x18610e){_0x123843['id']=_0x18610e;}return db[_0x4d36('0x39')][_0x4d36('0x3a')]({'where':_0x123843,'include':[{'model':db['MailAccount'],'attributes':['id',_0x4d36('0x10'),'email'],'include':[{'model':db[_0x4d36('0x3b')],'as':'Smtp','include':[{'model':db[_0x4d36('0x3c')],'as':'CloudProvider'}]}]}]})[_0x4d36('0x27')](function(_0x13d927){var _0x121bde=_['keys'](manager[_0x4d36('0x3d')]);var _0x47a59c=_[_0x4d36('0x3e')](_0x13d927,function(_0x494839){return _0x494839['id'][_0x4d36('0x3f')]();});var _0x7c43ac=_[_0x4d36('0x40')](_0x13d927,function(_0x166899){return _0x166899['id'][_0x4d36('0x3f')]();});var _0xf99229=_0x18610e?_0x47a59c:_[_0x4d36('0x41')](_0x47a59c,_0x121bde);var _0x493ab8=_[_0x4d36('0x42')](_0x47a59c,_0x121bde);var _0x37c982=_['difference'](_0x121bde,_0x47a59c);var _0xd954b9;var _0x3bbcb9;for(_0xd954b9=0x0;_0xd954b9<_0x37c982[_0x4d36('0x43')]&&!_0x18610e;_0xd954b9+=0x1){_0x3bbcb9=_0x37c982[_0xd954b9][_0x4d36('0x3f')]();if(manager['exists'](_0x3bbcb9)){manager[_0x4d36('0x44')](_0x3bbcb9);manager[_0x4d36('0x45')](_0x3bbcb9);logger[_0x4d36('0xa')](_0x4d36('0x46'),_0x3bbcb9);}}logger[_0x4d36('0xa')](_0x4d36('0x47'),JSON[_0x4d36('0x21')](_0xf99229));for(_0xd954b9=0x0;_0xd954b9<_0xf99229['length'];_0xd954b9+=0x1){_0x3bbcb9=_0xf99229[_0xd954b9][_0x4d36('0x3f')]();logger[_0x4d36('0xa')](_0x4d36('0x48'),_0x3bbcb9);if(_0x18610e){logger['info'](_0x4d36('0x49'),_0x18610e);logger['info'](JSON[_0x4d36('0x21')](_0x7c43ac[_0x3bbcb9]));BPromise['resolve']()[_0x4d36('0x27')](handleJob(_0x7c43ac[_0x3bbcb9]));logger[_0x4d36('0xa')]('run\x20job',_0x7c43ac[_0x3bbcb9][_0x4d36('0x10')],_0x7c43ac[_0x3bbcb9][_0x4d36('0x4a')]);}else if(_0x7c43ac[_0x3bbcb9]['cron']&&_0x7c43ac[_0x3bbcb9][_0x4d36('0x4b')]&&moment()[_0x4d36('0x4c')](_0x7c43ac[_0x3bbcb9][_0x4d36('0x4d')],_0x7c43ac[_0x3bbcb9][_0x4d36('0x4e')])){manager[_0x4d36('0x4f')](_0x3bbcb9,_0x7c43ac[_0x3bbcb9][_0x4d36('0x4a')],handleJob(_0x7c43ac[_0x3bbcb9]));manager['start'](_0x3bbcb9);logger['info'](_0x4d36('0x50'),_0x7c43ac[_0x3bbcb9][_0x4d36('0x10')],_0x7c43ac[_0x3bbcb9][_0x4d36('0x4a')]);}else if(manager[_0x4d36('0x51')](_0x3bbcb9)){manager['stop'](_0x3bbcb9);manager[_0x4d36('0x45')](_0x3bbcb9);logger[_0x4d36('0xa')](_0x4d36('0x52'),_0x7c43ac[_0x3bbcb9][_0x4d36('0x10')],_0x7c43ac[_0x3bbcb9][_0x4d36('0x4a')]);}}for(_0xd954b9=0x0,_0x3bbcb9;_0xd954b9<_0x493ab8['length']&&!_0x18610e;_0xd954b9+=0x1){_0x3bbcb9=_0x493ab8[_0xd954b9]['toString']();if(manager[_0x4d36('0x51')](_0x3bbcb9)){if(_0x7c43ac[_0x3bbcb9][_0x4d36('0x4a')]&&_0x7c43ac[_0x3bbcb9][_0x4d36('0x4b')]&&moment()[_0x4d36('0x4c')](_0x7c43ac[_0x3bbcb9][_0x4d36('0x4d')],_0x7c43ac[_0x3bbcb9][_0x4d36('0x4e')])){manager['update'](_0x3bbcb9,_0x7c43ac[_0x3bbcb9][_0x4d36('0x4a')],handleJob(_0x7c43ac[_0x3bbcb9]));logger['info']('update\x20cron',_0x7c43ac[_0x3bbcb9][_0x4d36('0x10')],_0x7c43ac[_0x3bbcb9][_0x4d36('0x4a')]);}else{manager[_0x4d36('0x44')](_0x3bbcb9);manager[_0x4d36('0x45')](_0x3bbcb9);logger[_0x4d36('0xa')](_0x4d36('0x52'),_0x7c43ac[_0x3bbcb9][_0x4d36('0x10')],_0x7c43ac[_0x3bbcb9][_0x4d36('0x4a')]);}}}})['catch'](function(_0x3ae640){logger['error'](JSON[_0x4d36('0x21')](_0x3ae640));});}exports[_0x4d36('0x53')]=function(_0x12a274){return getJobs(_0x12a274);};exports[_0x4d36('0x54')]=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 97cdf08..69cb3ca 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 _0xe706=['VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','push','all','catch','error','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','transcribeName','transcribeRegion','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','Transcript','TranscriptFileUri','info','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','fileText','transcripts','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','findOne','Cloud\x20Provider\x20not\x20available','COMPLETED','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect'];(function(_0x2fa199,_0x4f64ff){var _0x1aae5b=function(_0xce02c2){while(--_0xce02c2){_0x2fa199['push'](_0x2fa199['shift']());}};_0x1aae5b(++_0x4f64ff);}(_0xe706,0xa3));var _0x6e70=function(_0x401ccd,_0x140815){_0x401ccd=_0x401ccd-0x0;var _0x5a57ad=_0xe706[_0x401ccd];return _0x5a57ad;};var _=require(_0x6e70('0x0'));var AWS=require(_0x6e70('0x1'));var rp=require(_0x6e70('0x2'));var util=require('util');var BPromise=require(_0x6e70('0x3'));var db=require(_0x6e70('0x4'))['db'];var logger=require(_0x6e70('0x5'))(_0x6e70('0x6'));function getTranscriptionJob(_0x142c27,_0x2164a4,_0x376a8d,_0x506db9){return new Promise(function(_0x1b0389,_0x4381d1){var _0x36357b=new AWS[(_0x6e70('0x7'))]({'accessKeyId':_0x2164a4,'secretAccessKey':_0x142c27,'region':_0x376a8d});_0x36357b[_0x6e70('0x8')]({'TranscriptionJobName':_0x506db9},function(_0x188ed3,_0x3c4843){if(_0x188ed3){return _0x4381d1(_0x188ed3);}else{return _0x1b0389(_0x3c4843);}});});}function sentiment(_0x449b48,_0x954545,_0x25e61c,_0x100eb7,_0x463853){return new Promise(function(_0x743eb5,_0x3f474a){var _0x37b3e0=new AWS[(_0x6e70('0x9'))]({'accessKeyId':_0x954545,'secretAccessKey':_0x449b48,'region':_0x25e61c});_0x37b3e0['detectSentiment']({'Text':_0x100eb7,'LanguageCode':_0x463853['substring'](0x0,0x2)},function(_0x3594c1,_0x15a1a5){if(_0x3594c1){return _0x3f474a(_0x3594c1);}else{return _0x743eb5(_0x15a1a5);}});});}function checkTranscribeJob(_0x18cf27,_0x27dd9b,_0x3b38f3){var _0x310eb7;return new BPromise(function(_0xa1eb74,_0x181005){logger['info'](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x18cf27['id'],_0x18cf27[_0x6e70('0xa')]));return getTranscriptionJob(_0x3b38f3['data1'],_0x3b38f3['data2'],_0x27dd9b[_0x6e70('0xb')],_0x18cf27[_0x6e70('0xa')])['then'](function(_0x24f3ac){logger['info'](util[_0x6e70('0xc')](_0x6e70('0xd'),_0x18cf27['id'],_0x18cf27['transcribeName'],_0x24f3ac['TranscriptionJob'][_0x6e70('0xe')]));if(!_0x18cf27['fileText']){switch(_0x24f3ac[_0x6e70('0xf')][_0x6e70('0xe')]){case'COMPLETED':var _0x497d61={'transcribeStatus':_0x24f3ac[_0x6e70('0xf')][_0x6e70('0xe')],'fileUri':_0x24f3ac[_0x6e70('0xf')][_0x6e70('0x10')][_0x6e70('0x11')]};logger[_0x6e70('0x12')](util[_0x6e70('0xc')](_0x6e70('0x13'),_0x18cf27['id']));return rp({'uri':_0x24f3ac[_0x6e70('0xf')][_0x6e70('0x10')]['TranscriptFileUri'],'json':!![]})[_0x6e70('0x14')](function(_0x344b65){logger[_0x6e70('0x12')](util['format'](_0x6e70('0x15'),_0x18cf27['id']));if(_0x344b65&&_0x344b65[_0x6e70('0x16')]&&_0x344b65[_0x6e70('0x16')]['transcripts']&&_0x344b65[_0x6e70('0x16')]['transcripts']['length']){_0x497d61['fileText']='';for(var _0x41e352=0x0;_0x41e352<_0x344b65[_0x6e70('0x16')]['transcripts'][_0x6e70('0x17')];_0x41e352++){_0x497d61[_0x6e70('0x18')]+=_0x344b65['results'][_0x6e70('0x19')][_0x41e352][_0x6e70('0x1a')]+'';}}return _0x18cf27[_0x6e70('0x1b')](_0x497d61);})['then'](function(){logger['info'](util[_0x6e70('0xc')](_0x6e70('0x1c'),_0x18cf27['id']));if(!_0x18cf27[_0x6e70('0x1d')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x27dd9b[_0x6e70('0x20')]||!_0x27dd9b[_0x6e70('0x21')]||!_0x27dd9b[_0x6e70('0x22')]||!_0x27dd9b[_0x6e70('0x23')]||!_0x27dd9b[_0x6e70('0x24')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x25'));}if(!_0x497d61[_0x6e70('0x18')]){throw new Error(_0x6e70('0x26'));}if(_0x27dd9b['sentimentAccountId']===_0x3b38f3['id']){return _0x3b38f3;}else{return db[_0x6e70('0x27')]['findOne']({'where':{'id':_settings[_0x6e70('0x21')]}});}})['then'](function(_0xdd7cc1){if(!_0xdd7cc1){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xdd7cc1[_0x6e70('0x28')]||!_0xdd7cc1[_0x6e70('0x29')]){throw new db['Sequelize'][(_0x6e70('0x1f'))](_0x6e70('0x2a'));}_0x310eb7=_0xdd7cc1;logger['info'](util[_0x6e70('0xc')](_0x6e70('0x2b'),_0x18cf27['id']));return sentiment(_0x310eb7[_0x6e70('0x28')],_0x310eb7[_0x6e70('0x29')],_0x27dd9b[_0x6e70('0x22')],_0x497d61[_0x6e70('0x18')],_0x27dd9b[_0x6e70('0x23')]);})[_0x6e70('0x14')](function(_0xf146fd){logger[_0x6e70('0x12')](util['format'](_0x6e70('0x2c'),_0x18cf27['id']));return _0x18cf27['update']({'sentiment':_0xf146fd[_0x6e70('0x2d')],'sPositive':_0xf146fd[_0x6e70('0x2e')][_0x6e70('0x2f')],'sNegative':_0xf146fd[_0x6e70('0x2e')][_0x6e70('0x30')],'sMixed':_0xf146fd[_0x6e70('0x2e')][_0x6e70('0x31')],'sNeutral':_0xf146fd[_0x6e70('0x2e')][_0x6e70('0x32')]});})[_0x6e70('0x14')](function(){logger[_0x6e70('0x12')](util[_0x6e70('0xc')](_0x6e70('0x1c'),_0x18cf27['id']));_0xa1eb74();});case'FAILED':return _0x18cf27['update']({'transcribeStatus':'FAILED','failureReason':_0x24f3ac[_0x6e70('0xf')][_0x6e70('0x33')]})[_0x6e70('0x14')](function(){logger[_0x6e70('0x12')](util[_0x6e70('0xc')](_0x6e70('0x1c'),_0x18cf27['id']));_0xa1eb74();});default:logger['info'](util[_0x6e70('0xc')](_0x6e70('0x34'),_0x18cf27['id']));break;}}else{return BPromise[_0x6e70('0x35')]()[_0x6e70('0x14')](function(){if(!_0x18cf27[_0x6e70('0x1d')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x36'));}if(!_0x27dd9b['sentiment']||!_0x27dd9b[_0x6e70('0x21')]||!_0x27dd9b[_0x6e70('0x22')]||!_0x27dd9b[_0x6e70('0x23')]||!_0x27dd9b[_0x6e70('0x24')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x25'));}if(!_0x18cf27['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x27dd9b['sentimentAccountId']===_0x3b38f3['id']){return _0x3b38f3;}else{return db[_0x6e70('0x27')][_0x6e70('0x37')]({'where':{'id':_settings[_0x6e70('0x21')]}});}})[_0x6e70('0x14')](function(_0x45c83a){if(!_0x45c83a){throw new db['Sequelize'][(_0x6e70('0x1f'))](_0x6e70('0x38'));}if(!_0x45c83a[_0x6e70('0x28')]||!_0x45c83a['data2']){throw new db['Sequelize']['ValidationError'](_0x6e70('0x2a'));}_0x310eb7=_0x45c83a;logger['info'](util[_0x6e70('0xc')](_0x6e70('0x2b'),_0x18cf27['id']));return sentiment(_0x310eb7[_0x6e70('0x28')],_0x310eb7[_0x6e70('0x29')],_0x27dd9b['sentimentRegion'],_0x18cf27[_0x6e70('0x18')],_0x27dd9b['language']);})[_0x6e70('0x14')](function(_0x1e9b06){logger[_0x6e70('0x12')](util[_0x6e70('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x18cf27['id']));return _0x18cf27[_0x6e70('0x1b')]({'sentiment':_0x1e9b06[_0x6e70('0x2d')],'sPositive':_0x1e9b06[_0x6e70('0x2e')][_0x6e70('0x2f')],'sNegative':_0x1e9b06[_0x6e70('0x2e')][_0x6e70('0x30')],'sMixed':_0x1e9b06[_0x6e70('0x2e')]['Mixed'],'sNeutral':_0x1e9b06[_0x6e70('0x2e')][_0x6e70('0x32')],'transcribeStatus':_0x6e70('0x39')});})[_0x6e70('0x14')](function(){logger[_0x6e70('0x12')](util[_0x6e70('0xc')](_0x6e70('0x1c'),_0x18cf27['id']));_0xa1eb74();});}})['catch'](function(_0x3f5c89){if(_0x3f5c89){if(!_0x3f5c89['name']||_0x3f5c89[_0x6e70('0x3a')]!==_0x6e70('0x3b')){logger['error'](util['format'](_0x6e70('0x3c'),_0x18cf27['id']),util[_0x6e70('0x3d')](_0x3f5c89,{'showHidden':![],'depth':null}));}}_0xa1eb74();});});}function checkTranscribe(){var _0x18fa40;var _0x587f04;var _0x4af9b1;return db[_0x6e70('0x3e')][_0x6e70('0x3f')]({'where':{'transcribeStatus':_0x6e70('0x40')}})[_0x6e70('0x14')](function(_0x2e25d5){if(!_0x2e25d5||!_0x2e25d5[_0x6e70('0x17')]){throw new db['Sequelize'][(_0x6e70('0x1f'))](_0x6e70('0x41'));}_0x18fa40=_0x2e25d5;return db[_0x6e70('0x42')][_0x6e70('0x37')]({'where':{'id':0x1}});})[_0x6e70('0x14')](function(_0x4b354e){if(!_0x4b354e){throw new db['Sequelize'][(_0x6e70('0x1f'))](_0x6e70('0x43'));}_0x587f04=_0x4b354e;if(!_0x587f04[_0x6e70('0x6')]||!_0x587f04[_0x6e70('0x44')]||!_0x587f04[_0x6e70('0xb')]||!_0x587f04['language']||!_0x587f04[_0x6e70('0x24')]){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x45'));}return db[_0x6e70('0x27')]['findOne']({'where':{'id':_0x587f04[_0x6e70('0x44')]}});})[_0x6e70('0x14')](function(_0x2c20d3){if(!_0x2c20d3){throw new db[(_0x6e70('0x1e'))][(_0x6e70('0x1f'))](_0x6e70('0x38'));}if(!_0x2c20d3['data1']||!_0x2c20d3[_0x6e70('0x29')]){throw new db[(_0x6e70('0x1e'))]['ValidationError'](_0x6e70('0x2a'));}_0x4af9b1=_0x2c20d3;var _0xebe5f7=[];_0x18fa40['forEach'](function(_0x3cfaa9){_0xebe5f7[_0x6e70('0x46')](checkTranscribeJob(_0x3cfaa9,_0x587f04,_0x4af9b1));});return BPromise[_0x6e70('0x47')](_0xebe5f7);})[_0x6e70('0x48')](function(_0xfcadfe){if(_0xfcadfe){if(!_0xfcadfe['name']||_0xfcadfe[_0x6e70('0x3a')]!==_0x6e70('0x3b')){logger[_0x6e70('0x49')](util[_0x6e70('0x3d')](_0xfcadfe,{'showHidden':![],'depth':null}));}}});}exports[_0x6e70('0x4a')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x09dd=['[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Sequelize','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','update','FailureReason','resolve','Transcript\x20not\x20available','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','push','SequelizeValidationError','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x09dd,0xb7));var _0xd09d=function(_0x180763,_0x4b889d){_0x180763=_0x180763-0x0;var _0x991e0c=_0x09dd[_0x180763];return _0x991e0c;};var _=require(_0xd09d('0x0'));var AWS=require(_0xd09d('0x1'));var rp=require(_0xd09d('0x2'));var util=require(_0xd09d('0x3'));var BPromise=require(_0xd09d('0x4'));var db=require(_0xd09d('0x5'))['db'];var logger=require(_0xd09d('0x6'))(_0xd09d('0x7'));function getTranscriptionJob(_0x297ba2,_0x50d0a5,_0x467211,_0x5c3a69){return new Promise(function(_0x274db5,_0x535080){var _0x57eba0=new AWS['TranscribeService']({'accessKeyId':_0x50d0a5,'secretAccessKey':_0x297ba2,'region':_0x467211});_0x57eba0['getTranscriptionJob']({'TranscriptionJobName':_0x5c3a69},function(_0x58c10c,_0x483c0a){if(_0x58c10c){return _0x535080(_0x58c10c);}else{return _0x274db5(_0x483c0a);}});});}function sentiment(_0x66a82,_0x4cfa68,_0x439f9c,_0x2566ce,_0x50692e){return new Promise(function(_0x5f1a89,_0x5f1205){var _0x477658=new AWS[(_0xd09d('0x8'))]({'accessKeyId':_0x4cfa68,'secretAccessKey':_0x66a82,'region':_0x439f9c});_0x477658[_0xd09d('0x9')]({'Text':_0x2566ce,'LanguageCode':_0x50692e[_0xd09d('0xa')](0x0,0x2)},function(_0x2fa597,_0x367838){if(_0x2fa597){return _0x5f1205(_0x2fa597);}else{return _0x5f1a89(_0x367838);}});});}function checkTranscribeJob(_0x4ac130,_0x58c129,_0x3004d0){var _0x3c4a7a;return new BPromise(function(_0x34aed6,_0x2494f9){logger[_0xd09d('0xb')](util['format'](_0xd09d('0xc'),_0x4ac130['id'],_0x4ac130[_0xd09d('0xd')]));return getTranscriptionJob(_0x3004d0[_0xd09d('0xe')],_0x3004d0[_0xd09d('0xf')],_0x58c129[_0xd09d('0x10')],_0x4ac130['transcribeName'])[_0xd09d('0x11')](function(_0x375e61){logger['info'](util[_0xd09d('0x12')](_0xd09d('0x13'),_0x4ac130['id'],_0x4ac130[_0xd09d('0xd')],_0x375e61[_0xd09d('0x14')][_0xd09d('0x15')]));if(!_0x4ac130[_0xd09d('0x16')]){switch(_0x375e61[_0xd09d('0x14')][_0xd09d('0x15')]){case _0xd09d('0x17'):var _0x175920={'transcribeStatus':_0x375e61['TranscriptionJob'][_0xd09d('0x15')],'fileUri':_0x375e61['TranscriptionJob'][_0xd09d('0x18')][_0xd09d('0x19')]};logger[_0xd09d('0xb')](util[_0xd09d('0x12')]('[RECORDING:%d]\x20Get\x20transcript',_0x4ac130['id']));return rp({'uri':_0x375e61[_0xd09d('0x14')]['Transcript']['TranscriptFileUri'],'json':!![]})[_0xd09d('0x11')](function(_0x220beb){logger['info'](util[_0xd09d('0x12')](_0xd09d('0x1a'),_0x4ac130['id']));if(_0x220beb&&_0x220beb[_0xd09d('0x1b')]&&_0x220beb[_0xd09d('0x1b')][_0xd09d('0x1c')]&&_0x220beb[_0xd09d('0x1b')][_0xd09d('0x1c')][_0xd09d('0x1d')]){_0x175920[_0xd09d('0x16')]='';for(var _0x12997c=0x0;_0x12997c<_0x220beb[_0xd09d('0x1b')][_0xd09d('0x1c')][_0xd09d('0x1d')];_0x12997c++){_0x175920[_0xd09d('0x16')]+=_0x220beb[_0xd09d('0x1b')]['transcripts'][_0x12997c]['transcript']+'';}}return _0x4ac130['update'](_0x175920);})['then'](function(){logger[_0xd09d('0xb')](util[_0xd09d('0x12')](_0xd09d('0x1e'),_0x4ac130['id']));if(!_0x4ac130[_0xd09d('0x1f')]){throw new db['Sequelize'][(_0xd09d('0x20'))](_0xd09d('0x21'));}if(!_0x58c129['sentiment']||!_0x58c129[_0xd09d('0x22')]||!_0x58c129['sentimentRegion']||!_0x58c129[_0xd09d('0x23')]||!_0x58c129[_0xd09d('0x24')]){throw new db['Sequelize'][(_0xd09d('0x20'))](_0xd09d('0x25'));}if(!_0x175920['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x58c129[_0xd09d('0x22')]===_0x3004d0['id']){return _0x3004d0;}else{return db[_0xd09d('0x26')][_0xd09d('0x27')]({'where':{'id':_settings[_0xd09d('0x22')]}});}})[_0xd09d('0x11')](function(_0x1ecfa4){if(!_0x1ecfa4){throw new db[(_0xd09d('0x28'))][(_0xd09d('0x20'))](_0xd09d('0x29'));}if(!_0x1ecfa4[_0xd09d('0xe')]||!_0x1ecfa4[_0xd09d('0xf')]){throw new db[(_0xd09d('0x28'))]['ValidationError'](_0xd09d('0x2a'));}_0x3c4a7a=_0x1ecfa4;logger[_0xd09d('0xb')](util[_0xd09d('0x12')](_0xd09d('0x2b'),_0x4ac130['id']));return sentiment(_0x3c4a7a['data1'],_0x3c4a7a[_0xd09d('0xf')],_0x58c129[_0xd09d('0x2c')],_0x175920['fileText'],_0x58c129['language']);})['then'](function(_0x897b3){logger[_0xd09d('0xb')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4ac130['id']));return _0x4ac130['update']({'sentiment':_0x897b3[_0xd09d('0x2d')],'sPositive':_0x897b3[_0xd09d('0x2e')][_0xd09d('0x2f')],'sNegative':_0x897b3['SentimentScore'][_0xd09d('0x30')],'sMixed':_0x897b3[_0xd09d('0x2e')][_0xd09d('0x31')],'sNeutral':_0x897b3['SentimentScore'][_0xd09d('0x32')]});})[_0xd09d('0x11')](function(){logger[_0xd09d('0xb')](util[_0xd09d('0x12')](_0xd09d('0x1e'),_0x4ac130['id']));_0x34aed6();});case _0xd09d('0x33'):return _0x4ac130[_0xd09d('0x34')]({'transcribeStatus':_0xd09d('0x33'),'failureReason':_0x375e61[_0xd09d('0x14')][_0xd09d('0x35')]})[_0xd09d('0x11')](function(){logger[_0xd09d('0xb')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4ac130['id']));_0x34aed6();});default:logger[_0xd09d('0xb')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x4ac130['id']));break;}}else{return BPromise[_0xd09d('0x36')]()[_0xd09d('0x11')](function(){if(!_0x4ac130[_0xd09d('0x1f')]){throw new db['Sequelize']['ValidationError'](_0xd09d('0x21'));}if(!_0x58c129['sentiment']||!_0x58c129[_0xd09d('0x22')]||!_0x58c129[_0xd09d('0x2c')]||!_0x58c129[_0xd09d('0x23')]||!_0x58c129[_0xd09d('0x24')]){throw new db[(_0xd09d('0x28'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4ac130['fileText']){throw new Error(_0xd09d('0x37'));}if(_0x58c129['sentimentAccountId']===_0x3004d0['id']){return _0x3004d0;}else{return db[_0xd09d('0x26')][_0xd09d('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x3d7c46){if(!_0x3d7c46){throw new db[(_0xd09d('0x28'))][(_0xd09d('0x20'))](_0xd09d('0x29'));}if(!_0x3d7c46[_0xd09d('0xe')]||!_0x3d7c46[_0xd09d('0xf')]){throw new db[(_0xd09d('0x28'))][(_0xd09d('0x20'))](_0xd09d('0x2a'));}_0x3c4a7a=_0x3d7c46;logger[_0xd09d('0xb')](util['format'](_0xd09d('0x2b'),_0x4ac130['id']));return sentiment(_0x3c4a7a[_0xd09d('0xe')],_0x3c4a7a['data2'],_0x58c129[_0xd09d('0x2c')],_0x4ac130[_0xd09d('0x16')],_0x58c129['language']);})[_0xd09d('0x11')](function(_0x83a22a){logger['info'](util[_0xd09d('0x12')](_0xd09d('0x38'),_0x4ac130['id']));return _0x4ac130[_0xd09d('0x34')]({'sentiment':_0x83a22a[_0xd09d('0x2d')],'sPositive':_0x83a22a[_0xd09d('0x2e')][_0xd09d('0x2f')],'sNegative':_0x83a22a[_0xd09d('0x2e')][_0xd09d('0x30')],'sMixed':_0x83a22a[_0xd09d('0x2e')][_0xd09d('0x31')],'sNeutral':_0x83a22a[_0xd09d('0x2e')][_0xd09d('0x32')],'transcribeStatus':_0xd09d('0x17')});})[_0xd09d('0x11')](function(){logger['info'](util[_0xd09d('0x12')](_0xd09d('0x1e'),_0x4ac130['id']));_0x34aed6();});}})[_0xd09d('0x39')](function(_0x5d9190){if(_0x5d9190){if(!_0x5d9190[_0xd09d('0x3a')]||_0x5d9190['name']!=='SequelizeValidationError'){logger[_0xd09d('0x3b')](util['format'](_0xd09d('0x3c'),_0x4ac130['id']),util[_0xd09d('0x3d')](_0x5d9190,{'showHidden':![],'depth':null}));}}_0x34aed6();});});}function checkTranscribe(){var _0x50716b;var _0x42a3f2;var _0x3d3199;return db['VoiceRecording'][_0xd09d('0x3e')]({'where':{'transcribeStatus':_0xd09d('0x3f')}})[_0xd09d('0x11')](function(_0x36732f){if(!_0x36732f||!_0x36732f[_0xd09d('0x1d')]){throw new db['Sequelize']['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x50716b=_0x36732f;return db[_0xd09d('0x40')][_0xd09d('0x27')]({'where':{'id':0x1}});})[_0xd09d('0x11')](function(_0x403b0c){if(!_0x403b0c){throw new db['Sequelize'][(_0xd09d('0x20'))](_0xd09d('0x41'));}_0x42a3f2=_0x403b0c;if(!_0x42a3f2[_0xd09d('0x7')]||!_0x42a3f2[_0xd09d('0x42')]||!_0x42a3f2[_0xd09d('0x10')]||!_0x42a3f2[_0xd09d('0x23')]||!_0x42a3f2[_0xd09d('0x24')]){throw new db[(_0xd09d('0x28'))]['ValidationError'](_0xd09d('0x43'));}return db[_0xd09d('0x26')][_0xd09d('0x27')]({'where':{'id':_0x42a3f2[_0xd09d('0x42')]}});})[_0xd09d('0x11')](function(_0x472ffa){if(!_0x472ffa){throw new db[(_0xd09d('0x28'))][(_0xd09d('0x20'))](_0xd09d('0x29'));}if(!_0x472ffa[_0xd09d('0xe')]||!_0x472ffa[_0xd09d('0xf')]){throw new db['Sequelize']['ValidationError'](_0xd09d('0x2a'));}_0x3d3199=_0x472ffa;var _0x5bba56=[];_0x50716b['forEach'](function(_0x5f1032){_0x5bba56[_0xd09d('0x44')](checkTranscribeJob(_0x5f1032,_0x42a3f2,_0x3d3199));});return BPromise['all'](_0x5bba56);})[_0xd09d('0x39')](function(_0x593f8b){if(_0x593f8b){if(!_0x593f8b['name']||_0x593f8b[_0xd09d('0x3a')]!==_0xd09d('0x45')){logger[_0xd09d('0x3b')](util[_0xd09d('0x3d')](_0x593f8b,{'showHidden':![],'depth':null}));}}});}exports[_0xd09d('0x46')]=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 8869993..68581f6 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 _0x194e=['info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','join','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','then','length','map'];(function(_0x2795d9,_0x1cb1af){var _0x1c7d47=function(_0x5b4e44){while(--_0x5b4e44){_0x2795d9['push'](_0x2795d9['shift']());}};_0x1c7d47(++_0x1cb1af);}(_0x194e,0x1a2));var _0xe194=function(_0x33880f,_0x39c554){_0x33880f=_0x33880f-0x0;var _0x69d7a2=_0x194e[_0x33880f];return _0x69d7a2;};'use strict';var _=require(_0xe194('0x0'));var moment=require(_0xe194('0x1'));var Redis=require(_0xe194('0x2'));var util=require(_0xe194('0x3'));var config=require('../../config/environment');var db=require(_0xe194('0x4'))['db'];var logger=require('../logger')('schedule');config[_0xe194('0x5')]=_[_0xe194('0x6')](config[_0xe194('0x5')],{'host':_0xe194('0x7'),'port':0x18eb});var io=require(_0xe194('0x8'))(new Redis(config[_0xe194('0x5')]));function closeInteractions(){var _0x3841ab=[];return db[_0xe194('0x9')][_0xe194('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})[_0xe194('0xb')](function(_0x23cdd7){if(_0x23cdd7&&_0x23cdd7[_0xe194('0xc')]){_0x3841ab=_[_0xe194('0xd')](_0x23cdd7||[],'id');logger[_0xe194('0xe')](_0xe194('0xf'),_0x3841ab['join']());return db[_0xe194('0x9')][_0xe194('0x10')]({'closeReason':'system','disposition':_0xe194('0x11'),'closed':!![],'closedAt':moment()[_0xe194('0x12')](_0xe194('0x13'))},{'where':{'id':_0x3841ab}});}})[_0xe194('0xb')](function(){if(_0x3841ab&&_0x3841ab['length']){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x3841ab[_0xe194('0x14')]());for(var _0x548087=0x0;_0x548087<_0x3841ab['length'];_0x548087++){io[_0xe194('0x15')](_0xe194('0x16'),{'id':_0x3841ab[_0x548087],'closed':!![]});}}})['catch'](function(_0x2ceac5){logger[_0xe194('0x17')](_0xe194('0x18'),_0x2ceac5?util[_0xe194('0x19')](_0x2ceac5,{'showHidden':![],'depth':null}):'');});}exports[_0xe194('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6ef5=['util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0x6ef5,0x1a1));var _0x56ef=function(_0x31547f,_0x89864){_0x31547f=_0x31547f-0x0;var _0x3b35f0=_0x6ef5[_0x31547f];return _0x3b35f0;};'use strict';var _=require(_0x56ef('0x0'));var moment=require(_0x56ef('0x1'));var Redis=require(_0x56ef('0x2'));var util=require(_0x56ef('0x3'));var config=require(_0x56ef('0x4'));var db=require(_0x56ef('0x5'))['db'];var logger=require(_0x56ef('0x6'))(_0x56ef('0x7'));config[_0x56ef('0x8')]=_['defaults'](config['redis'],{'host':_0x56ef('0x9'),'port':0x18eb});var io=require(_0x56ef('0xa'))(new Redis(config[_0x56ef('0x8')]));function closeInteractions(){var _0x2bd386=[];return db[_0x56ef('0xb')][_0x56ef('0xc')]({'raw':!![],'attributes':['id',_0x56ef('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x56ef('0xe'))}}})[_0x56ef('0xf')](function(_0x4cb734){if(_0x4cb734&&_0x4cb734[_0x56ef('0x10')]){_0x2bd386=_[_0x56ef('0x11')](_0x4cb734||[],'id');logger[_0x56ef('0x12')](_0x56ef('0x13'),_0x2bd386[_0x56ef('0x14')]());return db[_0x56ef('0xb')][_0x56ef('0x15')]({'closeReason':_0x56ef('0x16'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x56ef('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x2bd386}});}})[_0x56ef('0xf')](function(){if(_0x2bd386&&_0x2bd386[_0x56ef('0x10')]){logger[_0x56ef('0x12')](_0x56ef('0x18'),_0x2bd386[_0x56ef('0x14')]());for(var _0x7f7e6f=0x0;_0x7f7e6f<_0x2bd386[_0x56ef('0x10')];_0x7f7e6f++){io['emit'](_0x56ef('0x19'),{'id':_0x2bd386[_0x7f7e6f],'closed':!![]});}}})[_0x56ef('0x1a')](function(_0x4ed976){logger[_0x56ef('0x1b')](_0x56ef('0x1c'),_0x4ed976?util[_0x56ef('0x1d')](_0x4ed976,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index c0ccd53..5e52a2b 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x413f=['../mysqldb','Biondo','innocenzo.biondo','@xcally.com','push','now','Innocenzo','CmContact','then','log','destroy','CmHopper','bulkCreate','finished\x20populating','contacts2','catch','util'];(function(_0x400766,_0x368660){var _0x3ae58b=function(_0x4c6a6e){while(--_0x4c6a6e){_0x400766['push'](_0x400766['shift']());}};_0x3ae58b(++_0x368660);}(_0x413f,0x197));var _0xf413=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x413f[_0x40a045];return _0x1a687c;};'use strict';var util=require(_0xf413('0x0'));var db=require(_0xf413('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xf413('0x2')+i,'phone':0xf879fb460+i,'email':_0xf413('0x3')+i+_0xf413('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xf413('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xf413('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf413('0x6')](),'updatedAt':Date[_0xf413('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xf413('0x7')+i,'lastName':_0xf413('0x2')+i,'phone':0xf879fb460+i,'email':_0xf413('0x3')+i+_0xf413('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xf413('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xf413('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xf413('0x6')]()});}db[_0xf413('0x8')]['destroy']({'where':{}})[_0xf413('0x9')](function(){return db['CmContact']['bulkCreate'](contacts);})[_0xf413('0x9')](function(){console[_0xf413('0xa')]('finished\x20populating','contacts1');return db['CmHopper'][_0xf413('0xb')]({'where':{}});})[_0xf413('0x9')](function(){return db[_0xf413('0xc')][_0xf413('0xd')](hopper);})[_0xf413('0x9')](function(){console[_0xf413('0xa')](_0xf413('0xe'),'hopper1');return db[_0xf413('0x8')][_0xf413('0xd')](contacts2);})[_0xf413('0x9')](function(){console[_0xf413('0xa')](_0xf413('0xe'),_0xf413('0xf'));return db[_0xf413('0xc')][_0xf413('0xd')](hopper2);})[_0xf413('0x9')](function(){console[_0xf413('0xa')](_0xf413('0xe'),'hopper2');})[_0xf413('0x10')](function(_0x503cb2){console[_0xf413('0xa')](_0x503cb2);}); \ No newline at end of file +var _0xf73b=['util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','log','hopper1','contacts2','hopper2','catch'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf73b,0xa0));var _0xbf73=function(_0x2acc42,_0x3ce31c){_0x2acc42=_0x2acc42-0x0;var _0x4b02d1=_0xf73b[_0x2acc42];return _0x4b02d1;};'use strict';var util=require(_0xbf73('0x0'));var db=require(_0xbf73('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xbf73('0x2')]({'id':i,'firstName':_0xbf73('0x3')+i,'lastName':_0xbf73('0x4')+i,'phone':0xf879fb460+i,'email':_0xbf73('0x5')+i+_0xbf73('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xbf73('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xbf73('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xbf73('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xbf73('0x5')+i+_0xbf73('0x6')});}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[_0xbf73('0x7')](),'updatedAt':Date[_0xbf73('0x7')]()});}db[_0xbf73('0x8')][_0xbf73('0x9')]({'where':{}})[_0xbf73('0xa')](function(){return db[_0xbf73('0x8')][_0xbf73('0xb')](contacts);})[_0xbf73('0xa')](function(){console['log'](_0xbf73('0xc'),_0xbf73('0xd'));return db[_0xbf73('0xe')][_0xbf73('0x9')]({'where':{}});})['then'](function(){return db['CmHopper'][_0xbf73('0xb')](hopper);})[_0xbf73('0xa')](function(){console[_0xbf73('0xf')]('finished\x20populating',_0xbf73('0x10'));return db[_0xbf73('0x8')][_0xbf73('0xb')](contacts2);})[_0xbf73('0xa')](function(){console[_0xbf73('0xf')](_0xbf73('0xc'),_0xbf73('0x11'));return db[_0xbf73('0xe')][_0xbf73('0xb')](hopper2);})[_0xbf73('0xa')](function(){console['log'](_0xbf73('0xc'),_0xbf73('0x12'));})[_0xbf73('0x13')](function(_0x57db5f){console['log'](_0x57db5f);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 7573965..379a02d 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x88fb=['log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','User','bulkCreate','then'];(function(_0x4f46f1,_0x2a39b9){var _0x5e146b=function(_0x5aed22){while(--_0x5aed22){_0x4f46f1['push'](_0x4f46f1['shift']());}};_0x5e146b(++_0x2a39b9);}(_0x88fb,0x13e));var _0xb88f=function(_0x23ed97,_0x58f926){_0x23ed97=_0x23ed97-0x0;var _0x1bcaf5=_0x88fb[_0x23ed97];return _0x1bcaf5;};'use strict';var util=require(_0xb88f('0x0'));var db=require(_0xb88f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xb88f('0x2')]({'name':util[_0xb88f('0x3')]('%s%s','agent',i),'fullname':util['format'](_0xb88f('0x4'),_0xb88f('0x5'),i),'email':util[_0xb88f('0x3')](_0xb88f('0x6'),_0xb88f('0x5'),i),'role':_0xb88f('0x5'),'password':_0xb88f('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0xb88f('0x8'),'ws',_0xb88f('0x9')],'disallow':[_0xb88f('0xa')],'allow':[_0xb88f('0xb')],'defaultuser':util[_0xb88f('0x3')](_0xb88f('0x4'),_0xb88f('0x5'),i),'encryption':_0xb88f('0xc'),'avpf':_0xb88f('0xc'),'force_avp':_0xb88f('0xc'),'icesupport':_0xb88f('0xc'),'dtlsenable':_0xb88f('0xc'),'dtlsverify':'no','dtlscertfile':_0xb88f('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util['format'](_0xb88f('0xe'),util['format'](_0xb88f('0x4'),_0xb88f('0x5'),i),0xfa0+i)});}db[_0xb88f('0xf')][_0xb88f('0x10')](users)[_0xb88f('0x11')](function(){console[_0xb88f('0x12')](_0xb88f('0x13'));})[_0xb88f('0x14')](function(_0x1b9c8a){console[_0xb88f('0x12')](_0x1b9c8a);}); \ No newline at end of file +var _0x2976=['ulaw','%s%s','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','bulkCreate','then','log','add\x20user','util','format','agent','%s%s@xcally.com','password','friend','udp','all'];(function(_0xf57bb7,_0x419f26){var _0x2c8149=function(_0x51d051){while(--_0x51d051){_0xf57bb7['push'](_0xf57bb7['shift']());}};_0x2c8149(++_0x419f26);}(_0x2976,0x118));var _0x6297=function(_0x5abc3d,_0x5cec9f){_0x5abc3d=_0x5abc3d-0x0;var _0x9cfc2=_0x2976[_0x5abc3d];return _0x9cfc2;};'use strict';var util=require(_0x6297('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x6297('0x1')]('%s%s',_0x6297('0x2'),i),'fullname':util[_0x6297('0x1')]('%s%s',_0x6297('0x2'),i),'email':util[_0x6297('0x1')](_0x6297('0x3'),_0x6297('0x2'),i),'role':'agent','password':_0x6297('0x4'),'internal':0xfa0+i,'type':_0x6297('0x5'),'transport':[_0x6297('0x6'),'ws','wss'],'disallow':[_0x6297('0x7')],'allow':[_0x6297('0x8')],'defaultuser':util[_0x6297('0x1')](_0x6297('0x9'),_0x6297('0x2'),i),'encryption':_0x6297('0xa'),'avpf':_0x6297('0xa'),'force_avp':'yes','icesupport':_0x6297('0xa'),'dtlsenable':_0x6297('0xa'),'dtlsverify':'no','dtlscertfile':_0x6297('0xb'),'dtlsprivatekey':_0x6297('0xc'),'dtlssetup':_0x6297('0xd'),'callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x6297('0x1')](_0x6297('0x9'),_0x6297('0x2'),i),0xfa0+i)});}db['User'][_0x6297('0xe')](users)[_0x6297('0xf')](function(){console[_0x6297('0x10')](_0x6297('0x11'));})['catch'](function(_0x27d60d){console[_0x6297('0x10')](_0x27d60d);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 881272d..6d98014 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7ae=['getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','User','name','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','where','role','format','%s:queue:%s','user:%s','query','find','userProfileId','handshake','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Campaign','user','VoiceQueue','ChatQueues','MailQueue','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7ae,0xf3));var _0xeb7a=function(_0x29e6de,_0xdc5364){_0x29e6de=_0x29e6de-0x0;var _0x2eeb24=_0xb7ae[_0x29e6de];return _0x2eeb24;};'use strict';var _=require(_0xeb7a('0x0'));var util=require(_0xeb7a('0x1'));var BPromise=require(_0xeb7a('0x2'));var db=require(_0xeb7a('0x3'))['db'];var config=require(_0xeb7a('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xeb7a('0x5'),'model':db[_0xeb7a('0x6')],'attributes':['id',_0xeb7a('0x7'),'role'],'raw':!![],'where':{'role':_0xeb7a('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xeb7a('0x7')],'where':{'role':_0xeb7a('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0xeb7a('0x7')]};var queryAgents={'raw':!![],'attributes':['id',_0xeb7a('0x7')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xeb7a('0x7'),_0xeb7a('0xa')],'where':{'type':_0xeb7a('0xb')}};function getAssociatedResources(_0x4f5024,_0x2f42a5,_0x4243b5){return db[_0xeb7a('0xc')][_0xeb7a('0xd')]({'where':{'name':_0x4f5024,'userProfileId':_0x2f42a5},'raw':!![]})[_0xeb7a('0xe')](function(_0x275d58){if(_0x275d58){if(_0x275d58[_0xeb7a('0xf')]){switch(_0x4f5024){case'VoiceQueues':case'ChatQueues':case _0xeb7a('0x10'):case _0xeb7a('0x11'):case _0xeb7a('0x12'):case _0xeb7a('0x13'):case _0xeb7a('0x14'):return db[_0x4243b5][_0xeb7a('0x15')](queryQueues);case _0xeb7a('0x16'):return db[_0x4243b5]['findAll'](queryTelephones);case _0xeb7a('0x17'):return db[_0x4243b5][_0xeb7a('0x15')](queryTrunks);case'IvrCampaigns':return db[_0x4243b5][_0xeb7a('0x15')](queryCampaigns);}}else{return db[_0xeb7a('0x18')]['findAll']({'attributes':[_0xeb7a('0x19')],'where':{'sectionId':_0x275d58['id']},'raw':!![]})['then'](function(_0x5d953f){if(_0x5d953f){var _0x388666={'where':{'id':_['map'](_0x5d953f,'resourceId')},'raw':!![]};switch(_0x4243b5){case _0xeb7a('0x6'):_0x388666[_0xeb7a('0x1a')][_0xeb7a('0x1b')]=_0xeb7a('0x9');break;case'Campaign':_0x388666['where'][_0xeb7a('0xa')]=_0xeb7a('0xb');break;}return db[_0x4243b5]['findAll'](_0x388666);}else{return[];}});}}else{return[];}})['then'](function(_0x326e81){return _0x326e81;});}function joinOrLeaveQueues(_0x25a399,_0x47b62c,_0x268a17,_0x302e41){_0x25a399[_0x47b62c](util[_0xeb7a('0x1c')](_0xeb7a('0x1d'),_0x268a17,_0x302e41[_0xeb7a('0x7')]));if(_0x302e41['Agents']){for(var _0x431d4a=0x0;_0x431d4a<_0x302e41[_0xeb7a('0x5')]['length'];_0x431d4a+=0x1){_0x25a399[_0x47b62c](util['format'](_0xeb7a('0x1e'),_0x302e41[_0xeb7a('0x5')][_0x431d4a][_0xeb7a('0x7')]));}}}function joinOrLeave(_0x4023e2,_0x29db91,_0x44cefc){var _0xfb62a5;if(_0x4023e2['handshake'][_0xeb7a('0x1f')]['id']){db[_0xeb7a('0x6')][_0xeb7a('0x20')]({'attributes':['id','name',_0xeb7a('0x1b'),_0xeb7a('0x21')],'where':{'id':_0x4023e2[_0xeb7a('0x22')][_0xeb7a('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xeb7a('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xeb7a('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xeb7a('0x25')],'as':_0xeb7a('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xeb7a('0x27')],'as':_0xeb7a('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xeb7a('0x29')],'as':_0xeb7a('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xeb7a('0x2b')],'as':_0xeb7a('0x2c'),'attributes':['id'],'raw':!![]}]})[_0xeb7a('0xe')](function(_0x2d2f9f){if(_0x2d2f9f){_0xfb62a5=_0x2d2f9f;_0x4023e2[_0x29db91](util['format'](_0xeb7a('0x1e'),_0x2d2f9f[_0xeb7a('0x7')]));var _0x5c2ddc=[];switch(_0x2d2f9f[_0xeb7a('0x1b')]){case _0xeb7a('0x2d'):_0x4023e2[_0x29db91](_0xeb7a('0x2e'));_0x4023e2[_0x29db91](_0xeb7a('0x2f'));if(queryQueues[_0xeb7a('0x30')](_0xeb7a('0x31'))){delete queryQueues[_0xeb7a('0x31')];}_0x5c2ddc[_0xeb7a('0x32')](db['VoiceQueue'][_0xeb7a('0x15')](queryQueues));_0x5c2ddc[_0xeb7a('0x32')](db[_0xeb7a('0x33')][_0xeb7a('0x15')](queryQueues));_0x5c2ddc['push'](db[_0xeb7a('0x34')][_0xeb7a('0x15')](queryQueues));_0x5c2ddc[_0xeb7a('0x32')](db[_0xeb7a('0x35')][_0xeb7a('0x15')](queryQueues));_0x5c2ddc[_0xeb7a('0x32')](db['MailQueue'][_0xeb7a('0x15')](queryQueues));_0x5c2ddc[_0xeb7a('0x32')](db[_0xeb7a('0x36')][_0xeb7a('0x15')](queryQueues));_0x5c2ddc[_0xeb7a('0x32')](db[_0xeb7a('0x37')]['findAll'](queryQueues));_0x5c2ddc[_0xeb7a('0x32')](db['User'][_0xeb7a('0x15')](queryTelephones));_0x5c2ddc[_0xeb7a('0x32')](db['Trunk'][_0xeb7a('0x15')](queryTrunks));_0x5c2ddc[_0xeb7a('0x32')](db[_0xeb7a('0x38')][_0xeb7a('0x15')](queryCampaigns));_0x5c2ddc[_0xeb7a('0x32')](db[_0xeb7a('0x6')][_0xeb7a('0x15')](queryAgents));break;case _0xeb7a('0x39'):_0x4023e2[_0x29db91]('voice:inbound');_0x4023e2[_0x29db91](_0xeb7a('0x2f'));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources('VoiceQueues',_0x2d2f9f[_0xeb7a('0x21')],_0xeb7a('0x3a')));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources(_0xeb7a('0x3b'),_0x2d2f9f[_0xeb7a('0x21')],_0xeb7a('0x33')));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources('FaxQueues',_0x2d2f9f[_0xeb7a('0x21')],_0xeb7a('0x34')));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources(_0xeb7a('0x11'),_0x2d2f9f[_0xeb7a('0x21')],_0xeb7a('0x35')));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources(_0xeb7a('0x12'),_0x2d2f9f[_0xeb7a('0x21')],_0xeb7a('0x3c')));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources(_0xeb7a('0x13'),_0x2d2f9f['userProfileId'],_0xeb7a('0x36')));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources(_0xeb7a('0x14'),_0x2d2f9f[_0xeb7a('0x21')],'WhatsappQueue'));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources(_0xeb7a('0x16'),_0x2d2f9f[_0xeb7a('0x21')],_0xeb7a('0x6')));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources(_0xeb7a('0x17'),_0x2d2f9f['userProfileId'],_0xeb7a('0x3d')));_0x5c2ddc[_0xeb7a('0x32')](getAssociatedResources('IvrCampaigns',_0x2d2f9f[_0xeb7a('0x21')],'Campaign'));_0x5c2ddc['push'](db['User'][_0xeb7a('0x15')](queryAgents));break;case _0xeb7a('0x8'):_0x4023e2[_0x29db91](_0xeb7a('0x2e'));_0x4023e2[_0x29db91](_0xeb7a('0x2f'));_0x5c2ddc[_0xeb7a('0x32')](_0x2d2f9f[_0xeb7a('0x3e')]({'attributes':['id','name']}));_0x5c2ddc['push'](_0x2d2f9f[_0xeb7a('0x3f')]({'attributes':['id','name']}));_0x5c2ddc[_0xeb7a('0x32')](_0x2d2f9f[_0xeb7a('0x40')]({'attributes':['id',_0xeb7a('0x7')]}));_0x5c2ddc[_0xeb7a('0x32')](_0x2d2f9f['getSmsQueues']({'attributes':['id',_0xeb7a('0x7')]}));_0x5c2ddc[_0xeb7a('0x32')](_0x2d2f9f[_0xeb7a('0x41')]({'attributes':['id',_0xeb7a('0x7')]}));_0x5c2ddc['push'](_0x2d2f9f[_0xeb7a('0x42')]({'attributes':['id','name']}));_0x5c2ddc[_0xeb7a('0x32')](_0x2d2f9f[_0xeb7a('0x43')]({'attributes':['id',_0xeb7a('0x7')]}));break;}return BPromise[_0xeb7a('0x44')](_0x5c2ddc);}})[_0xeb7a('0xe')](function(_0x248f29){if(_0x248f29&&_0x248f29[_0xeb7a('0x45')]){for(var _0x5e3d8e=0x0;_0x5e3d8e<_0x248f29['length'];_0x5e3d8e+=0x1){for(var _0x232350=0x0;_0x232350<_0x248f29[_0x5e3d8e][_0xeb7a('0x45')];_0x232350+=0x1){switch(_0x5e3d8e){case 0x0:joinOrLeaveQueues(_0x4023e2,_0x29db91,_0xeb7a('0x46'),_0x248f29[_0x5e3d8e][_0x232350]);break;case 0x1:joinOrLeaveQueues(_0x4023e2,_0x29db91,_0xeb7a('0x47'),_0x248f29[_0x5e3d8e][_0x232350]);break;case 0x2:joinOrLeaveQueues(_0x4023e2,_0x29db91,_0xeb7a('0x48'),_0x248f29[_0x5e3d8e][_0x232350]);break;case 0x3:joinOrLeaveQueues(_0x4023e2,_0x29db91,'sms',_0x248f29[_0x5e3d8e][_0x232350]);break;case 0x4:joinOrLeaveQueues(_0x4023e2,_0x29db91,'mail',_0x248f29[_0x5e3d8e][_0x232350]);break;case 0x5:joinOrLeaveQueues(_0x4023e2,_0x29db91,_0xeb7a('0x49'),_0x248f29[_0x5e3d8e][_0x232350]);break;case 0x6:joinOrLeaveQueues(_0x4023e2,_0x29db91,'whatsapp',_0x248f29[_0x5e3d8e][_0x232350]);break;case 0x7:if(_0xfb62a5[_0xeb7a('0x1b')]!==_0xeb7a('0x8'))_0x4023e2[_0x29db91](util[_0xeb7a('0x1c')](_0xeb7a('0x4a'),_0x248f29[_0x5e3d8e][_0x232350][_0xeb7a('0x7')]));break;case 0x8:if(_0xfb62a5[_0xeb7a('0x1b')]!==_0xeb7a('0x8'))_0x4023e2[_0x29db91](util[_0xeb7a('0x1c')](_0xeb7a('0x4b'),_0x248f29[_0x5e3d8e][_0x232350][_0xeb7a('0x7')]));break;case 0x9:if(_0xfb62a5[_0xeb7a('0x1b')]!==_0xeb7a('0x8'))_0x4023e2[_0x29db91](util[_0xeb7a('0x1c')](_0xeb7a('0x4c'),_0x248f29[_0x5e3d8e][_0x232350]['type'],_0x248f29[_0x5e3d8e][_0x232350][_0xeb7a('0x7')]));break;case 0xa:_0x4023e2[_0x29db91](util[_0xeb7a('0x1c')](_0xeb7a('0x1e'),_0x248f29[_0x5e3d8e][_0x232350][_0xeb7a('0x7')]));break;}}}}})[_0xeb7a('0xe')](function(){if(_0x29db91===_0xeb7a('0x4d')){var _0x410921=_[_0xeb7a('0x4e')](_0xfb62a5[_0xeb7a('0x23')],'id');return _0xfb62a5[_0xeb7a('0x4f')](_0x410921)[_0xeb7a('0xe')](function(){for(var _0x2bedb0=0x0;_0x2bedb0<_0x410921[_0xeb7a('0x45')];_0x2bedb0+=0x1){_0x44cefc[_0xeb7a('0x50')](_0xeb7a('0x51'),{'ChatInteractionId':Number(_0x410921[_0x2bedb0]),'UserId':Number(_0xfb62a5['id'])});}});}})[_0xeb7a('0xe')](function(){if(_0x29db91===_0xeb7a('0x4d')){var _0x18950c=_[_0xeb7a('0x4e')](_0xfb62a5[_0xeb7a('0x24')],'id');return _0xfb62a5[_0xeb7a('0x52')](_0x18950c)[_0xeb7a('0xe')](function(){for(var _0x196438=0x0;_0x196438<_0x18950c['length'];_0x196438+=0x1){_0x44cefc[_0xeb7a('0x50')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x18950c[_0x196438]),'UserId':Number(_0xfb62a5['id'])});}});}})[_0xeb7a('0xe')](function(){if(_0x29db91==='leave'){var _0xd576e6=_[_0xeb7a('0x4e')](_0xfb62a5[_0xeb7a('0x26')],'id');return _0xfb62a5[_0xeb7a('0x53')](_0xd576e6)[_0xeb7a('0xe')](function(){for(var _0x76c02e=0x0;_0x76c02e<_0xd576e6['length'];_0x76c02e+=0x1){_0x44cefc[_0xeb7a('0x50')](_0xeb7a('0x54'),{'FaxInteractionId':Number(_0xd576e6[_0x76c02e]),'UserId':Number(_0xfb62a5['id'])});}});}})[_0xeb7a('0xe')](function(){if(_0x29db91===_0xeb7a('0x4d')){var _0x4a76c0=_[_0xeb7a('0x4e')](_0xfb62a5[_0xeb7a('0x28')],'id');return _0xfb62a5[_0xeb7a('0x55')](_0x4a76c0)[_0xeb7a('0xe')](function(){for(var _0x19b006=0x0;_0x19b006<_0x4a76c0[_0xeb7a('0x45')];_0x19b006+=0x1){_0x44cefc[_0xeb7a('0x50')](_0xeb7a('0x56'),{'SmsInteractionId':Number(_0x4a76c0[_0x19b006]),'UserId':Number(_0xfb62a5['id'])});}});}})[_0xeb7a('0xe')](function(){if(_0x29db91===_0xeb7a('0x4d')){var _0x40f52f=_[_0xeb7a('0x4e')](_0xfb62a5[_0xeb7a('0x2a')],'id');return _0xfb62a5['removeOpenchannelInteractions'](_0x40f52f)[_0xeb7a('0xe')](function(){for(var _0x1633ef=0x0;_0x1633ef<_0x40f52f[_0xeb7a('0x45')];_0x1633ef+=0x1){_0x44cefc[_0xeb7a('0x50')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x40f52f[_0x1633ef]),'UserId':Number(_0xfb62a5['id'])});}});}})[_0xeb7a('0xe')](function(){if(_0x29db91===_0xeb7a('0x4d')){var _0x16b94f=_[_0xeb7a('0x4e')](_0xfb62a5[_0xeb7a('0x2c')],'id');return _0xfb62a5[_0xeb7a('0x57')](_0x16b94f)[_0xeb7a('0xe')](function(){for(var _0x381bd6=0x0;_0x381bd6<_0x16b94f['length'];_0x381bd6+=0x1){_0x44cefc[_0xeb7a('0x50')](_0xeb7a('0x58'),{'WhatsappInteractionId':Number(_0x16b94f[_0x381bd6]),'UserId':Number(_0xfb62a5['id'])});}});}})[_0xeb7a('0x59')](function(_0x3c3e66){_0x4023e2['log'](_0x3c3e66);});}}function onDisconnect(_0x1291b5,_0xa29957){joinOrLeave(_0x1291b5,_0xeb7a('0x4d'),_0xa29957);}function onConnect(_0x3e45f8){joinOrLeave(_0x3e45f8,'join');}exports[_0xeb7a('0x5a')]=function(_0x50a654){_0x50a654['on']('connection',function(_0x46c194){_0x46c194[_0xeb7a('0x5b')](0x0);_0x46c194[_0xeb7a('0x5c')]=_0x46c194[_0xeb7a('0x5d')][_0xeb7a('0x5e')][_0xeb7a('0x5f')]+':'+_0x46c194[_0xeb7a('0x5d')][_0xeb7a('0x5e')][_0xeb7a('0x60')];_0x46c194[_0xeb7a('0x61')]=new Date();_0x46c194[_0xeb7a('0x62')]=function(_0x2adcb9){console['log'](_0xeb7a('0x63')+_0x46c194[_0xeb7a('0x64')]['name']+'['+_0x46c194[_0xeb7a('0x5c')]+']',_0x2adcb9);};_0x46c194['on']('disconnect',function(){onDisconnect(_0x46c194,_0x50a654);_0x46c194['log'](_0xeb7a('0x65'));});onConnect(_0x46c194);_0x46c194[_0xeb7a('0x62')](_0xeb7a('0x66'));});}; \ No newline at end of file +var _0x117c=['removeMailInteractions','emit','FaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','../mysqldb','Agents','User','name','role','agent','ivr','UserProfileSection','then','autoAssociation','ChatQueues','FaxQueues','MailQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','where','telephone','Campaign','type','format','%s:queue:%s','user:%s','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','MailQueue','WhatsappQueue','user','ChatQueue','SmsQueues','SmsQueue','OpenchannelQueues','OpenchannelQueue','Trunk','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','length','chat','fax','whatsapp','telephone:%s','trunk:%s','leave','map','user_has_chat_interactions:remove'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0x117c,0x71));var _0xc117=function(_0x102789,_0x24217f){_0x102789=_0x102789-0x0;var _0x4aeb4f=_0x117c[_0x102789];return _0x4aeb4f;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require('bluebird');var db=require(_0xc117('0x0'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0xc117('0x1'),'model':db[_0xc117('0x2')],'attributes':['id',_0xc117('0x3'),_0xc117('0x4')],'raw':!![],'where':{'role':_0xc117('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xc117('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xc117('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0xc117('0x3')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xc117('0x3'),'type'],'where':{'type':_0xc117('0x6')}};function getAssociatedResources(_0x2982fa,_0x62548,_0x39e33f){return db[_0xc117('0x7')]['findOne']({'where':{'name':_0x2982fa,'userProfileId':_0x62548},'raw':!![]})[_0xc117('0x8')](function(_0x574c99){if(_0x574c99){if(_0x574c99[_0xc117('0x9')]){switch(_0x2982fa){case'VoiceQueues':case _0xc117('0xa'):case _0xc117('0xb'):case'SmsQueues':case _0xc117('0xc'):case'OpenchannelQueues':case _0xc117('0xd'):return db[_0x39e33f][_0xc117('0xe')](queryQueues);case _0xc117('0xf'):return db[_0x39e33f][_0xc117('0xe')](queryTelephones);case'Trunks':return db[_0x39e33f][_0xc117('0xe')](queryTrunks);case _0xc117('0x10'):return db[_0x39e33f][_0xc117('0xe')](queryCampaigns);}}else{return db[_0xc117('0x11')][_0xc117('0xe')]({'attributes':[_0xc117('0x12')],'where':{'sectionId':_0x574c99['id']},'raw':!![]})[_0xc117('0x8')](function(_0x6960b9){if(_0x6960b9){var _0xc14e71={'where':{'id':_['map'](_0x6960b9,'resourceId')},'raw':!![]};switch(_0x39e33f){case _0xc117('0x2'):_0xc14e71[_0xc117('0x13')][_0xc117('0x4')]=_0xc117('0x14');break;case _0xc117('0x15'):_0xc14e71[_0xc117('0x13')][_0xc117('0x16')]=_0xc117('0x6');break;}return db[_0x39e33f][_0xc117('0xe')](_0xc14e71);}else{return[];}});}}else{return[];}})[_0xc117('0x8')](function(_0x2eddf1){return _0x2eddf1;});}function joinOrLeaveQueues(_0x224395,_0x547deb,_0x1b9095,_0x4717ec){_0x224395[_0x547deb](util[_0xc117('0x17')](_0xc117('0x18'),_0x1b9095,_0x4717ec[_0xc117('0x3')]));if(_0x4717ec[_0xc117('0x1')]){for(var _0x32ef4e=0x0;_0x32ef4e<_0x4717ec['Agents']['length'];_0x32ef4e+=0x1){_0x224395[_0x547deb](util[_0xc117('0x17')](_0xc117('0x19'),_0x4717ec[_0xc117('0x1')][_0x32ef4e][_0xc117('0x3')]));}}}function joinOrLeave(_0x1658e2,_0x2531f1,_0x5d5ba1){var _0x4bde1b;if(_0x1658e2[_0xc117('0x1a')]['query']['id']){db[_0xc117('0x2')][_0xc117('0x1b')]({'attributes':['id',_0xc117('0x3'),'role',_0xc117('0x1c')],'where':{'id':_0x1658e2[_0xc117('0x1a')][_0xc117('0x1d')]['id']},'include':[{'model':db[_0xc117('0x1e')],'as':_0xc117('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0xc117('0x20')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc117('0x21')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xc117('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xc117('0x23')],'as':_0xc117('0x24'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xc117('0x25'),'attributes':['id'],'raw':!![]}]})[_0xc117('0x8')](function(_0x4a2a10){if(_0x4a2a10){_0x4bde1b=_0x4a2a10;_0x1658e2[_0x2531f1](util[_0xc117('0x17')](_0xc117('0x19'),_0x4a2a10[_0xc117('0x3')]));var _0x4e8630=[];switch(_0x4a2a10[_0xc117('0x4')]){case'admin':_0x1658e2[_0x2531f1](_0xc117('0x26'));_0x1658e2[_0x2531f1](_0xc117('0x27'));if(queryQueues[_0xc117('0x28')](_0xc117('0x29'))){delete queryQueues['include'];}_0x4e8630[_0xc117('0x2a')](db[_0xc117('0x2b')][_0xc117('0xe')](queryQueues));_0x4e8630[_0xc117('0x2a')](db['ChatQueue'][_0xc117('0xe')](queryQueues));_0x4e8630['push'](db[_0xc117('0x2c')]['findAll'](queryQueues));_0x4e8630[_0xc117('0x2a')](db['SmsQueue'][_0xc117('0xe')](queryQueues));_0x4e8630['push'](db[_0xc117('0x2d')][_0xc117('0xe')](queryQueues));_0x4e8630[_0xc117('0x2a')](db['OpenchannelQueue'][_0xc117('0xe')](queryQueues));_0x4e8630[_0xc117('0x2a')](db[_0xc117('0x2e')][_0xc117('0xe')](queryQueues));_0x4e8630[_0xc117('0x2a')](db[_0xc117('0x2')][_0xc117('0xe')](queryTelephones));_0x4e8630[_0xc117('0x2a')](db['Trunk'][_0xc117('0xe')](queryTrunks));_0x4e8630[_0xc117('0x2a')](db[_0xc117('0x15')]['findAll'](queryCampaigns));_0x4e8630[_0xc117('0x2a')](db[_0xc117('0x2')][_0xc117('0xe')](queryAgents));break;case _0xc117('0x2f'):_0x1658e2[_0x2531f1](_0xc117('0x26'));_0x1658e2[_0x2531f1](_0xc117('0x27'));_0x4e8630[_0xc117('0x2a')](getAssociatedResources('VoiceQueues',_0x4a2a10[_0xc117('0x1c')],_0xc117('0x2b')));_0x4e8630['push'](getAssociatedResources(_0xc117('0xa'),_0x4a2a10[_0xc117('0x1c')],_0xc117('0x30')));_0x4e8630['push'](getAssociatedResources('FaxQueues',_0x4a2a10['userProfileId'],_0xc117('0x2c')));_0x4e8630['push'](getAssociatedResources(_0xc117('0x31'),_0x4a2a10[_0xc117('0x1c')],_0xc117('0x32')));_0x4e8630[_0xc117('0x2a')](getAssociatedResources(_0xc117('0xc'),_0x4a2a10[_0xc117('0x1c')],'MailQueue'));_0x4e8630[_0xc117('0x2a')](getAssociatedResources(_0xc117('0x33'),_0x4a2a10['userProfileId'],_0xc117('0x34')));_0x4e8630['push'](getAssociatedResources(_0xc117('0xd'),_0x4a2a10[_0xc117('0x1c')],_0xc117('0x2e')));_0x4e8630['push'](getAssociatedResources(_0xc117('0xf'),_0x4a2a10[_0xc117('0x1c')],_0xc117('0x2')));_0x4e8630[_0xc117('0x2a')](getAssociatedResources('Trunks',_0x4a2a10[_0xc117('0x1c')],_0xc117('0x35')));_0x4e8630['push'](getAssociatedResources(_0xc117('0x10'),_0x4a2a10[_0xc117('0x1c')],'Campaign'));_0x4e8630[_0xc117('0x2a')](db['User'][_0xc117('0xe')](queryAgents));break;case _0xc117('0x5'):_0x1658e2[_0x2531f1](_0xc117('0x26'));_0x1658e2[_0x2531f1](_0xc117('0x27'));_0x4e8630['push'](_0x4a2a10['getVoiceQueues']({'attributes':['id','name']}));_0x4e8630[_0xc117('0x2a')](_0x4a2a10[_0xc117('0x36')]({'attributes':['id','name']}));_0x4e8630['push'](_0x4a2a10['getFaxQueues']({'attributes':['id',_0xc117('0x3')]}));_0x4e8630[_0xc117('0x2a')](_0x4a2a10[_0xc117('0x37')]({'attributes':['id',_0xc117('0x3')]}));_0x4e8630[_0xc117('0x2a')](_0x4a2a10[_0xc117('0x38')]({'attributes':['id','name']}));_0x4e8630['push'](_0x4a2a10[_0xc117('0x39')]({'attributes':['id',_0xc117('0x3')]}));_0x4e8630['push'](_0x4a2a10['getWhatsappQueues']({'attributes':['id',_0xc117('0x3')]}));break;}return BPromise['all'](_0x4e8630);}})[_0xc117('0x8')](function(_0x11bb48){if(_0x11bb48&&_0x11bb48[_0xc117('0x3a')]){for(var _0x3078e0=0x0;_0x3078e0<_0x11bb48['length'];_0x3078e0+=0x1){for(var _0x31a269=0x0;_0x31a269<_0x11bb48[_0x3078e0][_0xc117('0x3a')];_0x31a269+=0x1){switch(_0x3078e0){case 0x0:joinOrLeaveQueues(_0x1658e2,_0x2531f1,'voice',_0x11bb48[_0x3078e0][_0x31a269]);break;case 0x1:joinOrLeaveQueues(_0x1658e2,_0x2531f1,_0xc117('0x3b'),_0x11bb48[_0x3078e0][_0x31a269]);break;case 0x2:joinOrLeaveQueues(_0x1658e2,_0x2531f1,_0xc117('0x3c'),_0x11bb48[_0x3078e0][_0x31a269]);break;case 0x3:joinOrLeaveQueues(_0x1658e2,_0x2531f1,'sms',_0x11bb48[_0x3078e0][_0x31a269]);break;case 0x4:joinOrLeaveQueues(_0x1658e2,_0x2531f1,'mail',_0x11bb48[_0x3078e0][_0x31a269]);break;case 0x5:joinOrLeaveQueues(_0x1658e2,_0x2531f1,'openchannel',_0x11bb48[_0x3078e0][_0x31a269]);break;case 0x6:joinOrLeaveQueues(_0x1658e2,_0x2531f1,_0xc117('0x3d'),_0x11bb48[_0x3078e0][_0x31a269]);break;case 0x7:if(_0x4bde1b[_0xc117('0x4')]!==_0xc117('0x5'))_0x1658e2[_0x2531f1](util[_0xc117('0x17')](_0xc117('0x3e'),_0x11bb48[_0x3078e0][_0x31a269][_0xc117('0x3')]));break;case 0x8:if(_0x4bde1b['role']!=='agent')_0x1658e2[_0x2531f1](util[_0xc117('0x17')](_0xc117('0x3f'),_0x11bb48[_0x3078e0][_0x31a269][_0xc117('0x3')]));break;case 0x9:if(_0x4bde1b[_0xc117('0x4')]!==_0xc117('0x5'))_0x1658e2[_0x2531f1](util[_0xc117('0x17')]('campaign:%s:%s',_0x11bb48[_0x3078e0][_0x31a269][_0xc117('0x16')],_0x11bb48[_0x3078e0][_0x31a269][_0xc117('0x3')]));break;case 0xa:_0x1658e2[_0x2531f1](util[_0xc117('0x17')](_0xc117('0x19'),_0x11bb48[_0x3078e0][_0x31a269][_0xc117('0x3')]));break;}}}}})[_0xc117('0x8')](function(){if(_0x2531f1===_0xc117('0x40')){var _0x18e3bb=_[_0xc117('0x41')](_0x4bde1b[_0xc117('0x1f')],'id');return _0x4bde1b['removeChatInteractions'](_0x18e3bb)[_0xc117('0x8')](function(){for(var _0x4d179d=0x0;_0x4d179d<_0x18e3bb[_0xc117('0x3a')];_0x4d179d+=0x1){_0x5d5ba1['emit'](_0xc117('0x42'),{'ChatInteractionId':Number(_0x18e3bb[_0x4d179d]),'UserId':Number(_0x4bde1b['id'])});}});}})[_0xc117('0x8')](function(){if(_0x2531f1===_0xc117('0x40')){var _0xdca56a=_[_0xc117('0x41')](_0x4bde1b['MailInteractions'],'id');return _0x4bde1b[_0xc117('0x43')](_0xdca56a)[_0xc117('0x8')](function(){for(var _0x49af31=0x0;_0x49af31<_0xdca56a[_0xc117('0x3a')];_0x49af31+=0x1){_0x5d5ba1[_0xc117('0x44')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0xdca56a[_0x49af31]),'UserId':Number(_0x4bde1b['id'])});}});}})[_0xc117('0x8')](function(){if(_0x2531f1==='leave'){var _0x42fafd=_['map'](_0x4bde1b[_0xc117('0x45')],'id');return _0x4bde1b['removeFaxInteractions'](_0x42fafd)[_0xc117('0x8')](function(){for(var _0x100e28=0x0;_0x100e28<_0x42fafd[_0xc117('0x3a')];_0x100e28+=0x1){_0x5d5ba1[_0xc117('0x44')](_0xc117('0x46'),{'FaxInteractionId':Number(_0x42fafd[_0x100e28]),'UserId':Number(_0x4bde1b['id'])});}});}})[_0xc117('0x8')](function(){if(_0x2531f1==='leave'){var _0x51e163=_[_0xc117('0x41')](_0x4bde1b['SmsInteractions'],'id');return _0x4bde1b[_0xc117('0x47')](_0x51e163)[_0xc117('0x8')](function(){for(var _0x13e1df=0x0;_0x13e1df<_0x51e163['length'];_0x13e1df+=0x1){_0x5d5ba1[_0xc117('0x44')](_0xc117('0x48'),{'SmsInteractionId':Number(_0x51e163[_0x13e1df]),'UserId':Number(_0x4bde1b['id'])});}});}})['then'](function(){if(_0x2531f1===_0xc117('0x40')){var _0x298502=_[_0xc117('0x41')](_0x4bde1b[_0xc117('0x24')],'id');return _0x4bde1b[_0xc117('0x49')](_0x298502)[_0xc117('0x8')](function(){for(var _0x34f8cb=0x0;_0x34f8cb<_0x298502[_0xc117('0x3a')];_0x34f8cb+=0x1){_0x5d5ba1[_0xc117('0x44')](_0xc117('0x4a'),{'OpenchannelInteractionId':Number(_0x298502[_0x34f8cb]),'UserId':Number(_0x4bde1b['id'])});}});}})[_0xc117('0x8')](function(){if(_0x2531f1===_0xc117('0x40')){var _0x3bfeda=_['map'](_0x4bde1b['WhatsappInteractions'],'id');return _0x4bde1b[_0xc117('0x4b')](_0x3bfeda)[_0xc117('0x8')](function(){for(var _0x5a9176=0x0;_0x5a9176<_0x3bfeda[_0xc117('0x3a')];_0x5a9176+=0x1){_0x5d5ba1[_0xc117('0x44')](_0xc117('0x4c'),{'WhatsappInteractionId':Number(_0x3bfeda[_0x5a9176]),'UserId':Number(_0x4bde1b['id'])});}});}})[_0xc117('0x4d')](function(_0x21d5ac){_0x1658e2[_0xc117('0x4e')](_0x21d5ac);});}}function onDisconnect(_0x32ed57,_0x33587a){joinOrLeave(_0x32ed57,_0xc117('0x40'),_0x33587a);}function onConnect(_0x7f7504){joinOrLeave(_0x7f7504,_0xc117('0x4f'));}exports['default']=function(_0x44302e){_0x44302e['on'](_0xc117('0x50'),function(_0x3a4ccd){_0x3a4ccd[_0xc117('0x51')](0x0);_0x3a4ccd[_0xc117('0x52')]=_0x3a4ccd[_0xc117('0x53')][_0xc117('0x50')][_0xc117('0x54')]+':'+_0x3a4ccd[_0xc117('0x53')][_0xc117('0x50')]['remotePort'];_0x3a4ccd[_0xc117('0x55')]=new Date();_0x3a4ccd['log']=function(_0x8b6705){console[_0xc117('0x4e')](_0xc117('0x56')+_0x3a4ccd[_0xc117('0x57')][_0xc117('0x3')]+'['+_0x3a4ccd[_0xc117('0x52')]+']',_0x8b6705);};_0x3a4ccd['on']('disconnect',function(){onDisconnect(_0x3a4ccd,_0x44302e);_0x3a4ccd[_0xc117('0x4e')](_0xc117('0x58'));});onConnect(_0x3a4ccd);_0x3a4ccd[_0xc117('0x4e')](_0xc117('0x59'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index b5d765c..f361b56 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 _0x9044=['catch','channel','motionChannel','event','direction','resolve','undefined','sequelize','query','Sequelize','QueryTypes','SELECT','UserId','format','agent','incomingmessage','AfterCreateMessage','get','offlineMessage','opened','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','interface','name','AfterCreate','closed','substatus','contact','SIP/%s','AfterUpdate','find','email','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9044,0x6f));var _0x4904=function(_0x3e7b93,_0x391e5a){_0x3e7b93=_0x3e7b93-0x0;var _0x2cee51=_0x9044[_0x3e7b93];return _0x2cee51;};'use strict';var util=require('util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var logger=require('../logger')(_0x4904('0x0'));var client=jayson[_0x4904('0x1')][_0x4904('0x2')]({'port':0x232a});var triggers=[{'channel':_0x4904('0x3'),'model':_0x4904('0x4'),'event':_0x4904('0x5'),'condition':_0x4904('0x6'),'callback':afterCreate},{'channel':'Chat','model':_0x4904('0x4'),'event':_0x4904('0x7'),'condition':_0x4904('0x8'),'callback':afterUpdate},{'channel':'Chat','model':_0x4904('0x9'),'event':_0x4904('0x5'),'condition':_0x4904('0xa'),'callback':afterCreateMessage},{'channel':_0x4904('0x3'),'model':_0x4904('0xb'),'event':_0x4904('0x5'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0x4904('0xc'),'model':'SmsInteraction','event':_0x4904('0x5'),'condition':_0x4904('0x6'),'callback':afterCreate},{'channel':_0x4904('0xc'),'model':_0x4904('0xd'),'event':'afterUpdate','condition':_0x4904('0x8'),'callback':afterUpdate},{'channel':_0x4904('0xc'),'model':_0x4904('0xe'),'event':_0x4904('0x5'),'condition':_0x4904('0xa'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0x4904('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x4904('0xf'),'model':_0x4904('0x10'),'event':_0x4904('0x7'),'condition':_0x4904('0x8'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x4904('0x11'),'event':_0x4904('0x5'),'condition':_0x4904('0xa'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x4904('0x12'),'event':_0x4904('0x5'),'condition':_0x4904('0x6'),'callback':afterCreate},{'channel':'Fax','model':_0x4904('0x12'),'event':_0x4904('0x7'),'condition':_0x4904('0x8'),'callback':afterUpdate},{'channel':_0x4904('0x13'),'model':_0x4904('0x14'),'event':_0x4904('0x5'),'condition':_0x4904('0xa'),'callback':afterCreateMessage},{'channel':_0x4904('0x15'),'model':'MailInteraction','event':_0x4904('0x5'),'condition':_0x4904('0x6'),'callback':afterCreate},{'channel':_0x4904('0x15'),'model':'MailInteraction','event':_0x4904('0x7'),'condition':_0x4904('0x8'),'callback':afterUpdate},{'channel':_0x4904('0x15'),'model':_0x4904('0x16'),'event':'afterCreate','condition':_0x4904('0xa'),'callback':afterCreateMessage},{'channel':_0x4904('0x17'),'model':'OpenchannelInteraction','event':_0x4904('0x5'),'condition':_0x4904('0x6'),'callback':afterCreate},{'channel':'Openchannel','model':_0x4904('0x18'),'event':_0x4904('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x4904('0x17'),'model':_0x4904('0x19'),'event':_0x4904('0x5'),'condition':_0x4904('0xa'),'callback':afterCreateMessage}];function request(_0x48b859){return client[_0x4904('0x1a')](_0x4904('0x1b'),_0x48b859)[_0x4904('0x1c')](function(_0x22bf59){logger[_0x4904('0x1d')](_0x4904('0x1e'),'EventManager',_0x22bf59);if(_0x22bf59['error']){if(_0x22bf59[_0x4904('0x1f')][_0x4904('0x20')]===0x1f4){logger['error']('Trigger,\x20%s','EventManager',_0x22bf59['error']);}}})[_0x4904('0x21')](function(_0x23ec48){logger[_0x4904('0x1f')](_0x4904('0x1e'),_0x4904('0x1b'),_0x23ec48);});}function afterCreateMessage(_0x22c47e){return function(_0x346099){_0x346099=_0x346099['get']({'plain':!![]});_0x346099[_0x4904('0x22')]=_0x22c47e;_0x346099[_0x4904('0x23')]=_0x22c47e;_0x346099[_0x4904('0x24')]=_0x346099[_0x4904('0x25')];Promise[_0x4904('0x26')]()[_0x4904('0x1c')](function(){if(typeof _0x346099['ContactId']===_0x4904('0x27'))return null;var _0x4dff9c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x346099['ContactId'];return db[_0x4904('0x28')][_0x4904('0x29')](_0x4dff9c,{'type':db[_0x4904('0x2a')][_0x4904('0x2b')][_0x4904('0x2c')],'raw':!![]});})[_0x4904('0x1c')](function(_0x31fd64){if(_0x31fd64){_0x346099['contact']=_0x31fd64[0x0];}if(typeof _0x346099[_0x4904('0x2d')]===_0x4904('0x27'))return;return getAgent(_0x346099[_0x4904('0x2d')]);})['then'](function(_0x5b765c){if(_0x5b765c){_0x346099['interface']=util[_0x4904('0x2e')]('SIP/%s',_0x5b765c['name']);_0x346099[_0x4904('0x2f')]=_0x5b765c;_0x346099[_0x4904('0x22')]=_0x22c47e;return request({'event':_0x4904('0x30'),'message':_0x346099});}else{return request({'event':'outgoingmessage','message':_0x346099});}})[_0x4904('0x21')](function(_0x54b69e){logger[_0x4904('0x1f')](_0x4904('0x1e'),_0x4904('0x31'),_0x54b69e);});};}function afterCreateOfflineMessage(_0x529b08){return function(_0x455302){_0x455302=_0x455302[_0x4904('0x32')]({'plain':!![]});_0x455302['channel']=_0x529b08;_0x455302['motionChannel']=_0x529b08;_0x455302[_0x4904('0x24')]=_0x4904('0x33');return request({'event':_0x455302[_0x4904('0x24')],'message':_0x455302});};}function afterCreate(_0x268d4f,_0x3825cd){return function(_0x23a933){_0x23a933=_0x23a933['get']({'plain':!![]});_0x23a933['channel']=_0x268d4f;_0x23a933[_0x4904('0x23')]=_0x268d4f;_0x23a933[_0x4904('0x24')]=_0x4904('0x34');Promise['resolve']()[_0x4904('0x1c')](function(){var _0x2b24e1=_0x4904('0x35')+_0x23a933[_0x4904('0x36')];return db[_0x4904('0x28')][_0x4904('0x29')](_0x2b24e1,{'type':db['Sequelize'][_0x4904('0x2b')][_0x4904('0x2c')],'raw':!![]});})['then'](function(_0x3b63a0){if(_0x3b63a0){_0x23a933['contact']=_0x3b63a0[0x0];}if(typeof _0x23a933['UserId']===_0x4904('0x27'))return;return getAgent(_0x23a933[_0x4904('0x2d')]);})[_0x4904('0x1c')](function(_0xff957c){if(_0xff957c){_0x23a933[_0x4904('0x37')]=util[_0x4904('0x2e')]('SIP/%s',_0xff957c[_0x4904('0x38')]);_0x23a933[_0x4904('0x2f')]=_0xff957c;}return request({'event':_0x3825cd,'message':_0x23a933});})[_0x4904('0x21')](function(_0x194d2a){logger['error'](_0x4904('0x1e'),_0x4904('0x39'),_0x194d2a);});};}function afterUpdate(_0x3f0fae){return function(_0x500c86){var _0x5e75b6=_0x500c86['changed'](_0x4904('0x3a'))&&_0x500c86[_0x4904('0x3a')];var _0x22ba8a=_0x500c86['changed'](_0x4904('0x3b'));if(_0x5e75b6||_0x22ba8a){var _0x1111ff=_0x5e75b6?_0x4904('0x8'):_0x4904('0x3b');var _0x4fd83d=_0x500c86['get']({'plain':!![]});_0x4fd83d[_0x4904('0x22')]=_0x3f0fae;_0x4fd83d[_0x4904('0x23')]=_0x3f0fae;_0x4fd83d['event']=_0x5e75b6?_0x4904('0x3a'):_0x4904('0x3b');var _0x8d4e92=_0x4904('0x35')+_0x4fd83d[_0x4904('0x36')];return db[_0x4904('0x28')]['query'](_0x8d4e92,{'type':db[_0x4904('0x2a')][_0x4904('0x2b')][_0x4904('0x2c')],'raw':!![]})[_0x4904('0x1c')](function(_0x103598){if(_0x103598){_0x4fd83d[_0x4904('0x3c')]=_0x103598[0x0];}if(typeof _0x4fd83d[_0x4904('0x2d')]===_0x4904('0x27'))return;return getAgent(_0x4fd83d[_0x4904('0x2d')]);})['then'](function(_0x29a40f){if(_0x29a40f){_0x4fd83d[_0x4904('0x37')]=util[_0x4904('0x2e')](_0x4904('0x3d'),_0x29a40f[_0x4904('0x38')]);_0x4fd83d['agent']=_0x29a40f;}return request({'event':_0x1111ff,'message':_0x4fd83d});})[_0x4904('0x21')](function(_0x2eb892){logger[_0x4904('0x1f')]('Trigger,\x20%s',_0x4904('0x3e'),_0x2eb892);});}};}function getAgent(_0x18e3e2){return db['User'][_0x4904('0x3f')]({'where':{'id':_0x18e3e2},'attributes':['id','name','fullname',_0x4904('0x40'),'internal'],'raw':!![]})[_0x4904('0x1c')](function(_0x331228){return _0x331228;});}exports['default']=function(){for(var _0xfbb80a=0x0;_0xfbb80a=_0x20d59e[_0x6b2c('0x15')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x2daee9(_0x521cff);})[_0x6b2c('0x16')](function(_0x240e47){_0x547190(_0x240e47);});});}; \ No newline at end of file +var _0x09a4=['openchannel','getChannels','isValidChannel','toLowerCase','includes','getLicense','agent','User','count','then','catch','lodash','../mysqldb','mail','chat','fax','sms','whatsapp'];(function(_0x44e2c5,_0x91d659){var _0x1df672=function(_0x302fd1){while(--_0x302fd1){_0x44e2c5['push'](_0x44e2c5['shift']());}};_0x1df672(++_0x91d659);}(_0x09a4,0xf5));var _0x409a=function(_0x1c3c9c,_0x5e8a1f){_0x1c3c9c=_0x1c3c9c-0x0;var _0x161807=_0x09a4[_0x1c3c9c];return _0x161807;};'use strict';var _=require(_0x409a('0x0'));var BPromise=require('bluebird');var db=require(_0x409a('0x1'))['db'];var util=require('./license/util');var channels=['voice',_0x409a('0x2'),_0x409a('0x3'),_0x409a('0x4'),_0x409a('0x5'),_0x409a('0x6'),_0x409a('0x7')];exports[_0x409a('0x8')]=function(){return channels;};exports[_0x409a('0x9')]=function(_0x5c02ff){_0x5c02ff=_0x5c02ff[_0x409a('0xa')]();return _[_0x409a('0xb')](channels,_0x5c02ff);};exports['clearBlockUser']=function(_0x58c1ad,_0x5164bb,_0x58e87f,_0x44560c){var _0x4dde34={'loginAttempts':_0x5164bb,'blocked':_0x58e87f};if(!_['isUndefined'](_0x44560c)){_0x4dde34['blockedAt']=_0x44560c;}return _0x58c1ad['updateAttributes'](_0x4dde34);};exports[_0x409a('0xc')]=function(_0xc834dc){return new BPromise(function(_0x340df9,_0x5ad2d1){var _0x952dd7=0x0;if(_0xc834dc['role']!==_0x409a('0xd')){_0x340df9(_0xc834dc);}db[_0x409a('0xe')][_0x409a('0xf')]({'where':{'role':_0x409a('0xd'),'online':!![],'id':{'$ne':_0xc834dc['id']}}})[_0x409a('0x10')](function(_0x30cf5d){_0x952dd7=_0x30cf5d;return util[_0x409a('0xc')]();})[_0x409a('0x10')](function(_0x515638){if(_0x515638&&_0x515638['agents']&&_0x952dd7>=_0x515638['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x340df9(_0xc834dc);})[_0x409a('0x11')](function(_0x4dee0a){_0x5ad2d1(_0x4dee0a);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index df706a9..2e05dd9 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf109=['status','exports','util','../config/logger','api','Internal\x20Server\x20Error','name','Error','inherits','message','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','stack'];(function(_0x254076,_0x5e7b8d){var _0x21a93e=function(_0x26aa78){while(--_0x26aa78){_0x254076['push'](_0x254076['shift']());}};_0x21a93e(++_0x5e7b8d);}(_0xf109,0xce));var _0x9f10=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xf109[_0x346737];return _0x1ade2e;};'use strict';var util=require(_0x9f10('0x0'));var logger=require(_0x9f10('0x1'))(_0x9f10('0x2'));var APIError=function(_0x5d2950,_0x5b381d){this['message']=_0x5d2950||_0x9f10('0x3');this[_0x9f10('0x4')]=_0x5b381d||_0x9f10('0x5');util[_0x9f10('0x6')](APIError,Error);};var APIBadRequestError=function(_0x4027f4){this[_0x9f10('0x7')]=_0x4027f4||_0x9f10('0x8');this[_0x9f10('0x4')]=_0x9f10('0x8');util[_0x9f10('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x3fd82f){this['message']=_0x3fd82f||_0x9f10('0x9');this[_0x9f10('0x4')]=_0x9f10('0xa');util[_0x9f10('0x6')](APINotFoundError,APIError);};function getStatusCode(_0x325f22){switch(_0x325f22){case'Bad\x20Request':return 0x190;case _0x9f10('0xb'),_0x9f10('0xc'):return 0x193;case _0x9f10('0xa'):return 0x194;default:return 0x1f4;}}function handleError(_0x4e577d){return function(_0x50215f){logger[_0x9f10('0xd')](_0x50215f[_0x9f10('0xe')]);var _0x407336=getStatusCode(_0x50215f['name']);if(_0x50215f[_0x9f10('0x4')])delete _0x50215f[_0x9f10('0x4')];return _0x4e577d[_0x9f10('0xf')](_0x407336)['send'](_0x50215f);};}module[_0x9f10('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x6f0d=['../config/logger','api','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','message','Not\x20Found','Forbidden','error','status','send','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x366388,_0x4595a6){_0x366388=_0x366388-0x0;var _0x41c97e=_0x6f0d[_0x366388];return _0x41c97e;};'use strict';var util=require('util');var logger=require(_0xd6f0('0x0'))(_0xd6f0('0x1'));var APIError=function(_0xd1480,_0x107a8c){this['message']=_0xd1480||_0xd6f0('0x2');this[_0xd6f0('0x3')]=_0x107a8c||_0xd6f0('0x4');util[_0xd6f0('0x5')](APIError,Error);};var APIBadRequestError=function(_0x3a757f){this['message']=_0x3a757f||_0xd6f0('0x6');this['name']=_0xd6f0('0x6');util[_0xd6f0('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x8b89a9){this[_0xd6f0('0x7')]=_0x8b89a9||'Entity\x20not\x20found';this['name']=_0xd6f0('0x8');util[_0xd6f0('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x2854cd){switch(_0x2854cd){case _0xd6f0('0x6'):return 0x190;case _0xd6f0('0x9'),'OutOfInterval':return 0x193;case _0xd6f0('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0xee144c){return function(_0x329f69){logger[_0xd6f0('0xa')](_0x329f69['stack']);var _0x1ce8d5=getStatusCode(_0x329f69[_0xd6f0('0x3')]);if(_0x329f69[_0xd6f0('0x3')])delete _0x329f69[_0xd6f0('0x3')];return _0xee144c[_0xd6f0('0xb')](_0x1ce8d5)[_0xd6f0('0xc')](_0x329f69);};}module[_0xd6f0('0xd')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 884cfd0..c4043d6 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9857=['exports','404','status','render','json'];(function(_0x461d24,_0x9dd951){var _0x25a523=function(_0x4894da){while(--_0x4894da){_0x461d24['push'](_0x461d24['shift']());}};_0x25a523(++_0x9dd951);}(_0x9857,0x87));var _0x7985=function(_0x112fe2,_0x13d91b){_0x112fe2=_0x112fe2-0x0;var _0x3eaf45=_0x9857[_0x112fe2];return _0x3eaf45;};'use strict';module[_0x7985('0x0')][0x194]=function pageNotFound(_0x10e5f6,_0x209549){var _0x53aa17=_0x7985('0x1');var _0x5305fe=0x194;var _0xfe90c8={'status':_0x5305fe};_0x209549[_0x7985('0x2')](_0xfe90c8[_0x7985('0x2')]);_0x209549[_0x7985('0x3')](_0x53aa17,{},function(_0x20ebae,_0x2cad90){if(_0x20ebae){return _0x209549[_0x7985('0x2')](_0xfe90c8[_0x7985('0x2')])[_0x7985('0x4')](_0xfe90c8);}_0x209549['send'](_0x2cad90);});}; \ No newline at end of file +var _0xf076=['status','render','send','exports','404'];(function(_0x3edc88,_0x2a9e59){var _0x2eb52c=function(_0x50af16){while(--_0x50af16){_0x3edc88['push'](_0x3edc88['shift']());}};_0x2eb52c(++_0x2a9e59);}(_0xf076,0x13e));var _0x6f07=function(_0xa5d4b6,_0x1bf2e7){_0xa5d4b6=_0xa5d4b6-0x0;var _0x2340dc=_0xf076[_0xa5d4b6];return _0x2340dc;};'use strict';module[_0x6f07('0x0')][0x194]=function pageNotFound(_0x58df87,_0x350421){var _0x559568=_0x6f07('0x1');var _0x1ef7ff=0x194;var _0x3167af={'status':_0x1ef7ff};_0x350421[_0x6f07('0x2')](_0x3167af[_0x6f07('0x2')]);_0x350421[_0x6f07('0x3')](_0x559568,{},function(_0x34d5e5,_0x592281){if(_0x34d5e5){return _0x350421['status'](_0x3167af[_0x6f07('0x2')])['json'](_0x3167af);}_0x350421[_0x6f07('0x4')](_0x592281);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 0f601d1..a90506f 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x697e=['DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../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','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','VoiceMail','UserId','userSetting','cascade','hasMany','VoiceRecording','Recordings','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','SenderId','belongsTo','userProfileId','ChatGroup','Groups','belongsToMany','Contacts','Lists','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','VoiceQueue','VoicePrefixes','UserVoicePrefix','MailQueue','MailQueues','ChatQueues','FaxQueue','FaxQueues','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','BlackLists','ScreenRecording','Messages','mailbox','mailboxuser','VoiceQueueReport','uniqueid','VoiceCallReport','MailAccountId','CloudProvider','CloudProviderId','Smtp','Dispositions','Answers','Interactions','List','ListId','Agents','team_has_mail_queues','MailInteractionId','Account','Contact','Owner','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','ContactId','Items','FaxAccountId','Exntensions','FaxMessage','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','Tags','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsApplication','user_has_sms_accounts','SmsMessage','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','OpenchannelQueue','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','ChatMessage','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatInternalMessage','ChatGroupId','chat_group_has_users','Phones','CmContactId','CmHopperFinal','HopperHistories','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OneAll','OneAny','Actions','AutomationId','ParentId','MailApplications','ChatApplications','FaxApplications','SmsApplications','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllCondition','TriggerAllId','AnyConditions','AnyCondition','Fields','CustomReportId','AnalyticDefaultReport','DefaultReportId','MetricId','Configurations','AccountId','SalesforceField','Subjects','DescriptionId','FieldId','SubjectId','Description','Field','VariableId','SugarcrmConfiguration','Descriptions','Subject','int_zendesk_configuration_has_tags','FreshdeskField','ServicenowField','ToId','JscriptyQuestionReport','SessionId','JscriptyProject','ProjectId','VoiceQueues','OpenchannelQueues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromUserId','FromAgent','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','CustomFields','Queues','cm_user_has_lists','VoicePrefix','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','team_has_whatsapp_queues','user','Imap','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','127.0.0.1','database','options','username','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatOfflineMessage','ChatQueue','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model'];(function(_0x156b64,_0x1f199d){var _0x112620=function(_0x719aa4){while(--_0x719aa4){_0x156b64['push'](_0x156b64['shift']());}};_0x112620(++_0x1f199d);}(_0x697e,0x15d));var _0xe697=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x697e[_0x321bb2];return _0x9c12ed;};'use strict';var config=require(_0xe697('0x0'));var Sequelize=require(_0xe697('0x1'));var _=require(_0xe697('0x2'));var jstz=require(_0xe697('0x3'));var timezone=jstz[_0xe697('0x4')]();config[_0xe697('0x1')]=_[_0xe697('0x5')](config[_0xe697('0x1')],{'database':_0xe697('0x6'),'username':_0xe697('0x7'),'password':_0xe697('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xe697('0x9'),'dialectOptions':{'charset':_0xe697('0xa')},'logging':![],'timezone':timezone[_0xe697('0xb')](),'define':{'charset':_0xe697('0xc'),'collate':_0xe697('0xd')}}});config[_0xe697('0xe')]=_[_0xe697('0x5')](config['sequelizeHistory'],{'database':_0xe697('0x6'),'username':'xcall','password':_0xe697('0x8'),'options':{'host':_0xe697('0xf'),'port':0xcea,'dialect':_0xe697('0x9'),'dialectOptions':{'charset':_0xe697('0xa')},'logging':![],'timezone':timezone[_0xe697('0xb')](),'define':{'charset':_0xe697('0xc'),'collate':_0xe697('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xe697('0x10')],config[_0xe697('0x1')]['username'],config[_0xe697('0x1')]['password'],config[_0xe697('0x1')][_0xe697('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe697('0xe')]['database'],config['sequelizeHistory'][_0xe697('0x12')],config['sequelizeHistory'][_0xe697('0x13')],config['sequelizeHistory'][_0xe697('0x11')])};db[_0xe697('0x14')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x16'));db[_0xe697('0x17')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x18'));db[_0xe697('0x19')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x1a'));db[_0xe697('0x1b')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x1c'));db['VoiceMusicOnHold']=db['sequelize'][_0xe697('0x15')](_0xe697('0x1d'));db['VoiceQueue']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x1e'));db['VoiceRecording']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x1f'));db['ScreenRecording']=db['sequelize'][_0xe697('0x15')](_0xe697('0x20'));db['VoiceMail']=db['sequelize']['import'](_0xe697('0x21'));db[_0xe697('0x22')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x23'));db['VoiceCallReport']=db[_0xe697('0x1')]['import'](_0xe697('0x24'));db[_0xe697('0x25')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x26'));db[_0xe697('0x27')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x28'));db['VoiceQueueReport']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x29'));db['MemberReport']=db[_0xe697('0x1')][_0xe697('0x15')]('../api/memberReport/memberReport.model');db['Trunk']=db[_0xe697('0x1')]['import'](_0xe697('0x2a'));db[_0xe697('0x2b')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x2c'));db[_0xe697('0x2d')]=db[_0xe697('0x1')]['import'](_0xe697('0x2e'));db[_0xe697('0x2f')]=db['sequelize'][_0xe697('0x15')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xe697('0x30')]=db['sequelize'][_0xe697('0x15')]('../api/userChatQueue/userChatQueue.model');db[_0xe697('0x31')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x32'));db[_0xe697('0x33')]=db['sequelize']['import']('../api/userFaxQueue/userFaxQueue.model');db[_0xe697('0x34')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x35'));db['UserOpenchannelQueue']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x36'));db[_0xe697('0x37')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x38'));db[_0xe697('0x39')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x3a'));db[_0xe697('0x3b')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x3c'));db[_0xe697('0x3d')]=db[_0xe697('0x1')]['import']('../api/mailAccount/mailAccount.model');db['MailQueue']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x3e'));db[_0xe697('0x3f')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x40'));db[_0xe697('0x41')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x42'));db[_0xe697('0x43')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x44'));db[_0xe697('0x45')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x46'));db[_0xe697('0x47')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x48'));db[_0xe697('0x49')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x4a'));db[_0xe697('0x4b')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x4c'));db[_0xe697('0x4d')]=db[_0xe697('0x1')]['import'](_0xe697('0x4e'));db[_0xe697('0x4f')]=db[_0xe697('0x1')]['import'](_0xe697('0x50'));db[_0xe697('0x51')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x52'));db['FaxMessage']=db[_0xe697('0x1')]['import'](_0xe697('0x53'));db['FaxQueue']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x54'));db['FaxQueueReport']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x55'));db[_0xe697('0x56')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x57'));db['SmsApplication']=db[_0xe697('0x1')][_0xe697('0x15')]('../api/smsApplication/smsApplication.model');db[_0xe697('0x58')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x59'));db['SmsMessage']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x5a'));db[_0xe697('0x5b')]=db['sequelize']['import'](_0xe697('0x5c'));db[_0xe697('0x5d')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db['sequelize'][_0xe697('0x15')](_0xe697('0x5e'));db[_0xe697('0x5f')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x60'));db['OpenchannelMessage']=db['sequelize']['import'](_0xe697('0x61'));db['OpenchannelQueue']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x62'));db['ChatWebsite']=db[_0xe697('0x1')]['import'](_0xe697('0x63'));db[_0xe697('0x64')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xe697('0x65')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x66'));db['ChatInteraction']=db[_0xe697('0x1')][_0xe697('0x15')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0xe697('0x1')][_0xe697('0x15')]('../api/chatMessage/chatMessage.model');db[_0xe697('0x67')]=db['sequelize']['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xe697('0x68')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0xe697('0x1')][_0xe697('0x15')]('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db['sequelize'][_0xe697('0x15')](_0xe697('0x69'));db[_0xe697('0x6a')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/cmCompany/cmCompany.model');db[_0xe697('0x6b')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x6c'));db[_0xe697('0x6d')]=db['sequelize'][_0xe697('0x15')]('../api/cmHopper/cmHopper.model');db[_0xe697('0x6e')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/cmHopperBlack/cmHopperBlack.model');db['CmHopperFinal']=db[_0xe697('0x1')][_0xe697('0x15')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xe697('0x6f')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x70'));db['ReportAgentPreview']=db[_0xe697('0x1')]['import'](_0xe697('0x71'));db[_0xe697('0x72')]=db['sequelize'][_0xe697('0x15')]('../api/cmCustomField/cmCustomField.model');db[_0xe697('0x73')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x74'));db[_0xe697('0x75')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x76'));db[_0xe697('0x77')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/cannedAnswer/cannedAnswer.model');db[_0xe697('0x78')]=db['sequelize'][_0xe697('0x15')]('../api/disposition/disposition.model');db[_0xe697('0x79')]=db['sequelize'][_0xe697('0x15')]('../api/condition/condition.model');db[_0xe697('0x7a')]=db['sequelize']['import'](_0xe697('0x7b'));db[_0xe697('0x7c')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x7d'));db[_0xe697('0x7e')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x7f'));db[_0xe697('0x80')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x81'));db[_0xe697('0x82')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x83'));db[_0xe697('0x84')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x85'));db[_0xe697('0x86')]=db['sequelize'][_0xe697('0x15')]('../api/tag/tag.model');db[_0xe697('0x87')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x88'));db[_0xe697('0x89')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x8a'));db[_0xe697('0x8b')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x8c'));db[_0xe697('0x8d')]=db[_0xe697('0x1')]['import'](_0xe697('0x8e'));db[_0xe697('0x8f')]=db[_0xe697('0x1')]['import'](_0xe697('0x90'));db[_0xe697('0x91')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x92'));db[_0xe697('0x93')]=db[_0xe697('0x1')]['import'](_0xe697('0x94'));db[_0xe697('0x95')]=db[_0xe697('0x1')]['import'](_0xe697('0x96'));db[_0xe697('0x97')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x98'));db['AnalyticDefaultReport']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x99'));db[_0xe697('0x9a')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x9b'));db[_0xe697('0x9c')]=db['sequelize'][_0xe697('0x15')]('../api/analyticMetric/analyticMetric.model');db[_0xe697('0x9d')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0xe697('0x1')]['import'](_0xe697('0x9e'));db[_0xe697('0x9f')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xe697('0xa0')]=db[_0xe697('0x1')]['import'](_0xe697('0xa1'));db['SalesforceField']=db[_0xe697('0x1')]['import']('../api/intSalesforceField/intSalesforceField.model');db[_0xe697('0xa2')]=db[_0xe697('0x1')]['import'](_0xe697('0xa3'));db['SugarcrmConfiguration']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xa4'));db[_0xe697('0xa5')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xa6'));db[_0xe697('0xa7')]=db[_0xe697('0x1')]['import'](_0xe697('0xa8'));db[_0xe697('0xa9')]=db[_0xe697('0x1')]['import'](_0xe697('0xaa'));db[_0xe697('0xab')]=db[_0xe697('0x1')]['import'](_0xe697('0xac'));db[_0xe697('0xad')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xae'));db[_0xe697('0xaf')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xb0'));db[_0xe697('0xb1')]=db['sequelize'][_0xe697('0x15')]('../api/intZohoField/intZohoField.model');db[_0xe697('0xb2')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xe697('0xb3')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xb4'));db[_0xe697('0xb5')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/intZendeskField/intZendeskField.model');db[_0xe697('0xb6')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xb7'));db[_0xe697('0xb8')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xb9'));db['FreshdeskField']=db['sequelize'][_0xe697('0x15')](_0xe697('0xba'));db[_0xe697('0xbb')]=db[_0xe697('0x1')]['import'](_0xe697('0xbc'));db[_0xe697('0xbd')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xbe'));db[_0xe697('0xbf')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/intVtigerField/intVtigerField.model');db[_0xe697('0xc0')]=db['sequelize']['import'](_0xe697('0xc1'));db[_0xe697('0xc2')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xc3'));db['ServicenowField']=db[_0xe697('0x1')]['import'](_0xe697('0xc4'));db[_0xe697('0xc5')]=db['sequelize'][_0xe697('0x15')](_0xe697('0xc6'));db[_0xe697('0xc7')]=db['sequelize'][_0xe697('0x15')](_0xe697('0xc8'));db[_0xe697('0xc9')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xca'));db[_0xe697('0xcb')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xcc'));db[_0xe697('0xcd')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xce'));db[_0xe697('0xcf')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0xe697('0x93')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x94'));db[_0xe697('0xd0')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xd1'));db[_0xe697('0xd2')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xd3'));db['ChatInternalMessage']=db['sequelize'][_0xe697('0x15')](_0xe697('0xd4'));db[_0xe697('0xd5')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db['sequelize'][_0xe697('0x15')](_0xe697('0xd6'));db[_0xe697('0xd7')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xd8'));db[_0xe697('0xd9')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xda'));db[_0xe697('0xdb')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/squareReport/squareReport.model');db[_0xe697('0xdc')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xdd'));db['JscriptyProject']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xde'));db[_0xe697('0xdf')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xe0'));db[_0xe697('0xe1')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xe2'));db[_0xe697('0xe3')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xe4'));db['SquareRecording']=db['sequelize'][_0xe697('0x15')](_0xe697('0xe5'));db[_0xe697('0xe6')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xe7'));db[_0xe697('0xe8')]=db['sequelize'][_0xe697('0x15')](_0xe697('0xe9'));db[_0xe697('0xea')]=db[_0xe697('0x1')]['import'](_0xe697('0xeb'));db[_0xe697('0xec')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xed'));db['Migration']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xee'));db[_0xe697('0xef')]=db['sequelize'][_0xe697('0x15')](_0xe697('0xf0'));db['Plugin']=db['sequelize'][_0xe697('0x15')](_0xe697('0xf1'));db['MailTransferReport']=db['sequelize'][_0xe697('0x15')](_0xe697('0xf2'));db['ChatTransferReport']=db[_0xe697('0x1')][_0xe697('0x15')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xf3'));db[_0xe697('0xf4')]=db['sequelize']['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xe697('0xf5')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xf6'));db[_0xe697('0xf7')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xf8'));db['VoicePrefix']=db['sequelize']['import'](_0xe697('0xf9'));db[_0xe697('0xfa')]=db[_0xe697('0x1')]['import'](_0xe697('0xfb'));db[_0xe697('0xfc')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0xfd'));db[_0xe697('0xfe')]=db[_0xe697('0x1')]['import'](_0xe697('0xff'));db[_0xe697('0x100')]=db[_0xe697('0x1')][_0xe697('0x15')]('../api/userNotification/userNotification.model');db[_0xe697('0x101')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x102'));db['WhatsappApplication']=db['sequelize'][_0xe697('0x15')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db['sequelize']['import'](_0xe697('0x103'));db[_0xe697('0x104')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x105'));db[_0xe697('0x106')]=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x107'));db['WhatsappTransferReport']=db[_0xe697('0x1')]['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0xe697('0x108')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x109'));db['CloudProvider']=db[_0xe697('0x1')][_0xe697('0x15')](_0xe697('0x10a'));db[_0xe697('0x10b')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x10c'));db[_0xe697('0x10d')]=db[_0xe697('0x1')]['import'](_0xe697('0x10e'));db['UserVoicePrefix']=db[_0xe697('0x1')]['import'](_0xe697('0x10f'));db[_0xe697('0x110')]=db['sequelize'][_0xe697('0x15')](_0xe697('0x111'));db['User'][_0xe697('0x112')](db[_0xe697('0x113')],{'as':_0xe697('0x113'),'onDelete':'cascade','foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x112')](db[_0xe697('0x110')],{'as':_0xe697('0x115'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x118')],{'as':_0xe697('0x119'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x1b')],{'as':_0xe697('0x11a'),'onDelete':_0xe697('0x116'),'hooks':!![]});db['User'][_0xe697('0x117')](db['CmHopperFinal'],{'as':_0xe697('0x11b'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x6f')],{'as':_0xe697('0x11c'),'foreignKey':'UserId'});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x11d')],{'as':'ReportAgentPreview','foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x5f')],{'as':_0xe697('0x11e'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x11f')],{'as':_0xe697('0x120'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x58')],{'as':_0xe697('0x121'),'foreignKey':'UserId'});db[_0xe697('0x14')]['hasMany'](db[_0xe697('0x51')],{'as':'FaxInteractions','foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x41')],{'as':_0xe697('0x122'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x123')],{'as':_0xe697('0x124'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x14')][_0xe697('0x117')](db[_0xe697('0x100')],{'as':'UserNotifications','foreignKey':_0xe697('0x125')});db[_0xe697('0x14')][_0xe697('0x126')](db[_0xe697('0xfa')],{'as':_0xe697('0xfa'),'foreignKey':_0xe697('0x127')});db[_0xe697('0x14')]['belongsToMany'](db[_0xe697('0x128')],{'as':_0xe697('0x129'),'through':'chat_group_has_users'});db['User'][_0xe697('0x12a')](db[_0xe697('0x6b')],{'as':_0xe697('0x12b'),'through':'cm_user_has_contacts'});db['User'][_0xe697('0x12a')](db[_0xe697('0xf7')],{'as':_0xe697('0x12c'),'through':'cm_user_has_lists'});db[_0xe697('0x14')][_0xe697('0x12a')](db['Team'],{'through':_0xe697('0x12d')});db['User'][_0xe697('0x12a')](db[_0xe697('0x41')],{'as':'MailInteractions','through':_0xe697('0x12e')});db[_0xe697('0x14')][_0xe697('0x12a')](db['ChatInteraction'],{'as':_0xe697('0x120'),'through':'user_has_chat_interactions'});db[_0xe697('0x14')][_0xe697('0x12a')](db[_0xe697('0x51')],{'as':_0xe697('0x12f'),'through':_0xe697('0x130')});db['User'][_0xe697('0x12a')](db[_0xe697('0x58')],{'as':_0xe697('0x121'),'through':_0xe697('0x131')});db[_0xe697('0x14')]['belongsToMany'](db[_0xe697('0x5f')],{'as':_0xe697('0x11e'),'through':'user_has_openchannel_interactions'});db['User'][_0xe697('0x12a')](db['WhatsappInteraction'],{'as':_0xe697('0x124'),'through':'user_has_whatsapp_interactions'});db[_0xe697('0x14')][_0xe697('0x12a')](db[_0xe697('0x132')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0xe697('0x14')]['belongsToMany'](db['VoicePrefix'],{'as':_0xe697('0x133'),'through':_0xe697('0x134'),'required':![]});db[_0xe697('0x14')][_0xe697('0x12a')](db[_0xe697('0x135')],{'as':_0xe697('0x136'),'through':_0xe697('0x31'),'required':![]});db[_0xe697('0x14')]['belongsToMany'](db[_0xe697('0x68')],{'as':_0xe697('0x137'),'through':_0xe697('0x30'),'required':![],'hooks':!![]});db[_0xe697('0x14')]['belongsToMany'](db[_0xe697('0x138')],{'as':_0xe697('0x139'),'through':_0xe697('0x33'),'required':![]});db[_0xe697('0x14')][_0xe697('0x12a')](db[_0xe697('0x5b')],{'as':'SmsQueues','through':_0xe697('0x34'),'required':![]});db[_0xe697('0x14')][_0xe697('0x12a')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0xe697('0x14')]['belongsToMany'](db[_0xe697('0x108')],{'as':'WhatsappQueues','through':_0xe697('0x37'),'required':![]});db[_0xe697('0x14')]['belongsToMany'](db['CmList'],{'through':'cm_user_has_lists'});db['User'][_0xe697('0x12a')](db[_0xe697('0x13a')],{'as':_0xe697('0x13b'),'through':_0xe697('0x13c')});db[_0xe697('0x14')]['belongsToMany'](db[_0xe697('0x4d')],{'as':_0xe697('0x13d'),'through':'user_has_fax_accounts'});db[_0xe697('0x14')][_0xe697('0x12a')](db[_0xe697('0x3d')],{'as':_0xe697('0x13e'),'through':_0xe697('0x13f')});db[_0xe697('0x14')][_0xe697('0x12a')](db[_0xe697('0x5d')],{'as':_0xe697('0x140'),'through':_0xe697('0x141')});db[_0xe697('0x14')][_0xe697('0x12a')](db['SmsAccount'],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db['User']['belongsToMany'](db['WhatsappAccount'],{'as':_0xe697('0x142'),'through':_0xe697('0x143')});db[_0xe697('0x14')][_0xe697('0x12a')](db[_0xe697('0xe3')],{'as':_0xe697('0x144'),'through':_0xe697('0x145')});db[_0xe697('0x17')][_0xe697('0x117')](db[_0xe697('0x1b')],{'as':_0xe697('0x146'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x147')});db['VoiceContext'][_0xe697('0x117')](db[_0xe697('0x1b')],{'onDelete':_0xe697('0x116')});db[_0xe697('0x1b')]['hasMany'](db[_0xe697('0x1b')],{'as':_0xe697('0x148'),'onDelete':_0xe697('0x116')});db[_0xe697('0x149')][_0xe697('0x12a')](db[_0xe697('0x84')],{'as':_0xe697('0x14a'),'through':_0xe697('0x14b')});db[_0xe697('0x132')][_0xe697('0x117')](db[_0xe697('0x2d')],{'as':_0xe697('0x14c'),'foreignKey':_0xe697('0x14d')});db[_0xe697('0x132')][_0xe697('0x117')](db[_0xe697('0x6d')],{'as':_0xe697('0x14e'),'foreignKey':'VoiceQueueId'});db[_0xe697('0x132')][_0xe697('0x117')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xe697('0x14d')});db[_0xe697('0x132')][_0xe697('0x117')](db[_0xe697('0x6f')],{'as':'HopperHistories','foreignKey':_0xe697('0x14d')});db[_0xe697('0x132')][_0xe697('0x117')](db[_0xe697('0x11d')],{'as':_0xe697('0x11d'),'foreignKey':_0xe697('0x14d')});db[_0xe697('0x132')][_0xe697('0x117')](db[_0xe697('0x6e')],{'as':_0xe697('0x14f'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xe697('0x117')](db[_0xe697('0xd7')],{'as':_0xe697('0x150'),'foreignKey':_0xe697('0x14d')});db[_0xe697('0x132')][_0xe697('0x126')](db[_0xe697('0x151')],{'as':_0xe697('0x151'),'foreignKey':_0xe697('0x152')});db[_0xe697('0x132')]['belongsTo'](db[_0xe697('0x151')],{'as':_0xe697('0x153'),'foreignKey':_0xe697('0x154')});db[_0xe697('0x132')][_0xe697('0x126')](db[_0xe697('0x7a')],{'as':_0xe697('0x7a'),'foreignKey':_0xe697('0x155')});db[_0xe697('0x132')][_0xe697('0x126')](db[_0xe697('0x7c')],{'as':_0xe697('0x156'),'foreignKey':_0xe697('0x157')});db[_0xe697('0x132')][_0xe697('0x12a')](db[_0xe697('0xf7')],{'as':_0xe697('0x12c'),'through':_0xe697('0x158')});db[_0xe697('0x132')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':'Agents','through':_0xe697('0x2f')});db['VoiceQueue'][_0xe697('0x12a')](db[_0xe697('0xe8')],{'as':_0xe697('0x159'),'through':'TeamVoiceQueue'});db[_0xe697('0x132')]['belongsToMany'](db[_0xe697('0xf7')],{'as':_0xe697('0x15a'),'through':'voice_queues_has_cm_blacklists'});db[_0xe697('0x118')]['belongsTo'](db[_0xe697('0x14')],{'as':_0xe697('0x14'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x15b')]['belongsTo'](db[_0xe697('0x14')],{'as':_0xe697('0x14'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x113')][_0xe697('0x117')](db['VoiceMailMessage'],{'as':_0xe697('0x15c'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0xe697('0x15d')});db[_0xe697('0x22')]['belongsTo'](db[_0xe697('0x113')],{'foreignKey':_0xe697('0x15e'),'targetKey':'mailbox'});db['VoiceCallReport'][_0xe697('0x117')](db[_0xe697('0x15f')],{'as':'QueueCalls','foreignKey':_0xe697('0x160'),'constraints':![]});db[_0xe697('0x161')][_0xe697('0x117')](db[_0xe697('0x27')],{'as':'AgentReports','foreignKey':_0xe697('0x160'),'constraints':![]});db['VoiceCallReport'][_0xe697('0x126')](db[_0xe697('0x14')],{'as':'User','foreignKey':'UserId'});db[_0xe697('0x161')][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':'Contact','foreignKey':'ContactId'});db[_0xe697('0x39')][_0xe697('0x126')](db[_0xe697('0x3d')],{'as':'MailAccount','foreignKey':_0xe697('0x162')});db[_0xe697('0x39')][_0xe697('0x126')](db['CloudProvider'],{'as':_0xe697('0x163'),'foreignKey':_0xe697('0x164'),'onDelete':'restrict'});db[_0xe697('0x3b')][_0xe697('0x126')](db['MailAccount'],{'as':_0xe697('0x3d'),'foreignKey':_0xe697('0x162')});db[_0xe697('0x3b')][_0xe697('0x126')](db[_0xe697('0x163')],{'as':_0xe697('0x163'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0xe697('0x3d')][_0xe697('0x112')](db[_0xe697('0x39')],{'as':'Imap','onDelete':_0xe697('0x116')});db[_0xe697('0x3d')][_0xe697('0x112')](db['MailServerOut'],{'as':_0xe697('0x165'),'onDelete':_0xe697('0x116')});db[_0xe697('0x3d')][_0xe697('0x117')](db['Disposition'],{'as':_0xe697('0x166'),'foreignKey':_0xe697('0x162'),'onDelete':_0xe697('0x116')});db[_0xe697('0x3d')][_0xe697('0x117')](db[_0xe697('0x77')],{'as':_0xe697('0x167'),'foreignKey':_0xe697('0x162')});db[_0xe697('0x3d')]['hasMany'](db[_0xe697('0x43')],{'as':_0xe697('0x15c'),'foreignKey':_0xe697('0x162')});db[_0xe697('0x3d')][_0xe697('0x117')](db[_0xe697('0x41')],{'as':_0xe697('0x168')});db[_0xe697('0x3d')][_0xe697('0x117')](db[_0xe697('0x45')],{'as':'Applications'});db[_0xe697('0x3d')]['belongsTo'](db[_0xe697('0xf7')],{'as':_0xe697('0x169'),'foreignKey':_0xe697('0x16a')});db[_0xe697('0x3d')][_0xe697('0x126')](db[_0xe697('0x8d')],{'as':'Template','foreignKey':'TemplateId'});db[_0xe697('0x3d')]['belongsTo'](db[_0xe697('0x7c')],{'as':_0xe697('0x156'),'foreignKey':_0xe697('0x157')});db[_0xe697('0x3d')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0xe697('0x135')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':_0xe697('0x16b'),'through':'UserMailQueue'});db[_0xe697('0x135')][_0xe697('0x12a')](db[_0xe697('0xe8')],{'through':_0xe697('0x16c'),'as':_0xe697('0x159')});db['MailInteraction'][_0xe697('0x117')](db[_0xe697('0x43')],{'as':_0xe697('0x15c'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x16d')});db[_0xe697('0x41')][_0xe697('0x126')](db['MailAccount'],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x162')});db[_0xe697('0x41')]['belongsTo'](db['CmContact'],{'as':_0xe697('0x16f'),'foreignKey':'ContactId'});db[_0xe697('0x41')][_0xe697('0x126')](db[_0xe697('0x14')],{'as':_0xe697('0x170'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x41')][_0xe697('0x12a')](db[_0xe697('0x86')],{'through':'mail_interaction_has_tags','as':'Tags'});db[_0xe697('0x41')][_0xe697('0x12a')](db[_0xe697('0x86')],{'through':_0xe697('0x171'),'as':_0xe697('0x172')});db[_0xe697('0x41')]['belongsToMany'](db[_0xe697('0x14')],{'as':_0xe697('0x173'),'through':_0xe697('0x12e'),'foreignKey':_0xe697('0x16d')});db[_0xe697('0x43')]['hasMany'](db[_0xe697('0xef')],{'as':_0xe697('0x174'),'onDelete':_0xe697('0x116')});db['MailMessage'][_0xe697('0x126')](db[_0xe697('0x14')],{'as':_0xe697('0x14')});db['MailMessage'][_0xe697('0x126')](db[_0xe697('0x6b')],{'onDelete':_0xe697('0x116'),'as':'Contact'});db[_0xe697('0x43')][_0xe697('0x126')](db[_0xe697('0x41')],{'as':_0xe697('0x175'),'foreignKey':_0xe697('0x16d')});db['MailMessage'][_0xe697('0x126')](db['MailAccount'],{'as':'Account','foreignKey':_0xe697('0x162')});db[_0xe697('0x43')][_0xe697('0x126')](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':_0xe697('0x176')});db[_0xe697('0x43')][_0xe697('0x126')](db[_0xe697('0x67')],{'as':_0xe697('0x67'),'foreignKey':_0xe697('0x177')});db['MailApplication'][_0xe697('0x126')](db['User'],{'onDelete':'restrict'});db[_0xe697('0x45')]['belongsTo'](db[_0xe697('0x135')],{'onDelete':_0xe697('0x178')});db['MailApplication'][_0xe697('0x126')](db['MailAccount'],{'onDelete':_0xe697('0x178')});db[_0xe697('0x45')][_0xe697('0x126')](db[_0xe697('0x7a')],{'onDelete':_0xe697('0x178'),'foreignKey':_0xe697('0x155')});db['MailApplication'][_0xe697('0x126')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xe697('0x179')});db[_0xe697('0x47')][_0xe697('0x126')](db['MailAccount'],{});db['MailQueueReport'][_0xe697('0x126')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['MailQueueReport']['belongsTo'](db['CmContact'],{'as':_0xe697('0x16f'),'foreignKey':_0xe697('0x17a')});db[_0xe697('0x47')]['belongsTo'](db[_0xe697('0x41')],{});db['MailQueueReport'][_0xe697('0x126')](db[_0xe697('0x43')],{});db[_0xe697('0x47')][_0xe697('0x126')](db[_0xe697('0x14')],{});db[_0xe697('0x47')][_0xe697('0x126')](db[_0xe697('0x135')],{});db[_0xe697('0x49')][_0xe697('0x117')](db[_0xe697('0x4b')],{'as':_0xe697('0x17b'),'onDelete':'cascade'});db[_0xe697('0x4d')]['hasMany'](db[_0xe697('0x78')],{'as':_0xe697('0x166'),'foreignKey':_0xe697('0x17c'),'onDelete':_0xe697('0x116')});db[_0xe697('0x4d')][_0xe697('0x117')](db['CannedAnswer'],{'as':_0xe697('0x167'),'foreignKey':_0xe697('0x17c')});db[_0xe697('0x4d')]['hasMany'](db['FaxInteraction'],{'as':_0xe697('0x168')});db[_0xe697('0x4d')]['hasMany'](db[_0xe697('0x4f')],{'as':'Applications'});db[_0xe697('0x4d')]['hasMany'](db['VoiceExtension'],{'as':_0xe697('0x17d'),'onDelete':_0xe697('0x116')});db[_0xe697('0x4d')][_0xe697('0x117')](db[_0xe697('0x17e')],{'as':_0xe697('0x15c')});db[_0xe697('0x4d')][_0xe697('0x126')](db[_0xe697('0x151')],{'as':_0xe697('0x151')});db[_0xe697('0x4d')][_0xe697('0x126')](db[_0xe697('0xf7')],{'as':_0xe697('0x169'),'foreignKey':_0xe697('0x16a')});db['FaxAccount'][_0xe697('0x126')](db['Pause'],{'as':_0xe697('0x156'),'foreignKey':_0xe697('0x157')});db[_0xe697('0x4d')][_0xe697('0x12a')](db['User'],{'as':_0xe697('0x16b'),'through':_0xe697('0x17f')});db[_0xe697('0x4f')][_0xe697('0x126')](db[_0xe697('0x14')],{'onDelete':'restrict'});db['FaxApplication'][_0xe697('0x126')](db['FaxQueue'],{'onDelete':_0xe697('0x178')});db['FaxApplication'][_0xe697('0x126')](db[_0xe697('0x4d')],{'onDelete':_0xe697('0x178')});db[_0xe697('0x4f')][_0xe697('0x126')](db[_0xe697('0x86')],{'onDelete':_0xe697('0x178'),'foreignKey':'TagId'});db[_0xe697('0x51')][_0xe697('0x117')](db['FaxMessage'],{'as':_0xe697('0x15c'),'onDelete':'cascade','foreignKey':_0xe697('0x180')});db[_0xe697('0x51')][_0xe697('0x126')](db[_0xe697('0x4d')],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x17c')});db[_0xe697('0x51')][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':_0xe697('0x16f'),'foreignKey':_0xe697('0x17a')});db[_0xe697('0x51')][_0xe697('0x126')](db[_0xe697('0x14')],{'as':_0xe697('0x170'),'foreignKey':_0xe697('0x114')});db['FaxInteraction'][_0xe697('0x12a')](db[_0xe697('0x86')],{'through':_0xe697('0x181'),'as':_0xe697('0x182')});db['FaxInteraction'][_0xe697('0x12a')](db['Tag'],{'through':_0xe697('0x181'),'as':_0xe697('0x172')});db['FaxInteraction']['belongsToMany'](db[_0xe697('0x14')],{'as':_0xe697('0x173'),'through':_0xe697('0x130'),'foreignKey':_0xe697('0x180')});db[_0xe697('0x17e')][_0xe697('0x126')](db[_0xe697('0x14')],{'onDelete':_0xe697('0x116'),'as':_0xe697('0x14')});db[_0xe697('0x17e')]['belongsTo'](db['FaxInteraction'],{'as':_0xe697('0x175'),'foreignKey':_0xe697('0x180')});db[_0xe697('0x17e')][_0xe697('0x126')](db[_0xe697('0x6b')],{'onDelete':_0xe697('0x116'),'as':_0xe697('0x16f')});db['FaxMessage'][_0xe697('0x126')](db['Attachment'],{'as':_0xe697('0xef'),'foreignKey':_0xe697('0x183')});db[_0xe697('0x17e')][_0xe697('0x126')](db[_0xe697('0x4d')],{'as':_0xe697('0x16e'),'foreignKey':'FaxAccountId'});db[_0xe697('0x138')]['belongsToMany'](db[_0xe697('0x14')],{'as':_0xe697('0x16b'),'through':_0xe697('0x33')});db[_0xe697('0x138')][_0xe697('0x12a')](db[_0xe697('0xe8')],{'through':_0xe697('0x184'),'as':_0xe697('0x159')});db[_0xe697('0x185')][_0xe697('0x126')](db[_0xe697('0x4d')],{});db[_0xe697('0x185')][_0xe697('0x126')](db[_0xe697('0xf7')],{'as':_0xe697('0x169'),'foreignKey':_0xe697('0x16a')});db['FaxQueueReport']['belongsTo'](db[_0xe697('0x6b')],{'as':_0xe697('0x16f'),'foreignKey':'ContactId'});db[_0xe697('0x185')][_0xe697('0x126')](db[_0xe697('0x51')],{});db[_0xe697('0x185')][_0xe697('0x126')](db[_0xe697('0x17e')],{});db[_0xe697('0x185')][_0xe697('0x126')](db['User'],{});db[_0xe697('0x185')][_0xe697('0x126')](db[_0xe697('0x138')],{});db[_0xe697('0x56')][_0xe697('0x117')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xe697('0x186'),'onDelete':_0xe697('0x116')});db[_0xe697('0x56')]['hasMany'](db[_0xe697('0x77')],{'as':_0xe697('0x167'),'foreignKey':_0xe697('0x186')});db[_0xe697('0x56')][_0xe697('0x117')](db['SmsMessage'],{'as':_0xe697('0x15c'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0xe697('0x117')](db[_0xe697('0x58')],{'as':'Interactions'});db[_0xe697('0x56')][_0xe697('0x117')](db[_0xe697('0x187')],{'as':_0xe697('0x148')});db[_0xe697('0x56')]['belongsTo'](db[_0xe697('0xf7')],{'as':'List','foreignKey':_0xe697('0x16a')});db[_0xe697('0x56')][_0xe697('0x126')](db[_0xe697('0x7c')],{'as':_0xe697('0x156'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe697('0x56')]['belongsToMany'](db[_0xe697('0x14')],{'as':'Agents','through':_0xe697('0x188')});db['SmsApplication'][_0xe697('0x126')](db['User'],{'onDelete':_0xe697('0x178')});db['SmsApplication'][_0xe697('0x126')](db[_0xe697('0x5b')],{'onDelete':_0xe697('0x178')});db[_0xe697('0x187')]['belongsTo'](db[_0xe697('0x56')],{'onDelete':_0xe697('0x178')});db[_0xe697('0x187')][_0xe697('0x126')](db['Interval'],{'onDelete':_0xe697('0x178'),'foreignKey':_0xe697('0x155')});db['SmsApplication'][_0xe697('0x126')](db[_0xe697('0x86')],{'onDelete':'restrict','foreignKey':_0xe697('0x179')});db[_0xe697('0x58')][_0xe697('0x117')](db[_0xe697('0x189')],{'as':_0xe697('0x15c'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x18a')});db['SmsInteraction'][_0xe697('0x126')](db[_0xe697('0x56')],{'as':'Account','foreignKey':_0xe697('0x186')});db[_0xe697('0x58')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xe697('0x17a')});db[_0xe697('0x58')][_0xe697('0x126')](db[_0xe697('0x14')],{'as':_0xe697('0x170'),'foreignKey':_0xe697('0x114')});db[_0xe697('0x58')]['belongsToMany'](db[_0xe697('0x86')],{'through':_0xe697('0x18b'),'as':_0xe697('0x182')});db['SmsInteraction']['belongsToMany'](db[_0xe697('0x86')],{'through':_0xe697('0x18b'),'as':_0xe697('0x172')});db['SmsInteraction'][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':'Users','through':_0xe697('0x131'),'foreignKey':_0xe697('0x18a')});db[_0xe697('0x189')][_0xe697('0x126')](db[_0xe697('0x14')],{'as':_0xe697('0x14')});db[_0xe697('0x189')][_0xe697('0x126')](db[_0xe697('0x6b')],{'onDelete':_0xe697('0x116'),'as':_0xe697('0x16f')});db[_0xe697('0x189')]['belongsTo'](db[_0xe697('0x58')],{'onDelete':_0xe697('0x116'),'as':'Interaction','foreignKey':_0xe697('0x18a')});db[_0xe697('0x189')][_0xe697('0x126')](db[_0xe697('0x56')],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x186')});db[_0xe697('0x5b')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':'Agents','through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0xe697('0x5b')][_0xe697('0x12a')](db[_0xe697('0xe8')],{'through':_0xe697('0x18c'),'as':_0xe697('0x159')});db['OpenchannelAccount']['hasMany'](db['Disposition'],{'as':_0xe697('0x166'),'foreignKey':_0xe697('0x18d'),'onDelete':_0xe697('0x116')});db[_0xe697('0x5d')][_0xe697('0x117')](db[_0xe697('0x77')],{'as':_0xe697('0x167'),'foreignKey':'OpenchannelAccountId'});db[_0xe697('0x5d')][_0xe697('0x117')](db[_0xe697('0x5f')],{'as':_0xe697('0x168'),'foreignKey':_0xe697('0x18d')});db[_0xe697('0x5d')]['hasMany'](db[_0xe697('0x18e')],{'as':_0xe697('0x15c'),'foreignKey':'OpenchannelAccountId'});db[_0xe697('0x5d')][_0xe697('0x117')](db['OpenchannelApplication'],{'as':_0xe697('0x148'),'foreignKey':_0xe697('0x18d')});db[_0xe697('0x5d')][_0xe697('0x126')](db[_0xe697('0xf7')],{'as':_0xe697('0x169'),'foreignKey':_0xe697('0x16a')});db[_0xe697('0x5d')][_0xe697('0x126')](db[_0xe697('0x7c')],{'as':_0xe697('0x156'),'foreignKey':_0xe697('0x157')});db[_0xe697('0x5d')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':_0xe697('0x16b'),'through':_0xe697('0x141')});db[_0xe697('0x18f')][_0xe697('0x126')](db[_0xe697('0x14')],{'onDelete':_0xe697('0x178')});db[_0xe697('0x18f')][_0xe697('0x126')](db[_0xe697('0x190')],{'onDelete':_0xe697('0x178'),'foreignKey':_0xe697('0x191')});db[_0xe697('0x18f')][_0xe697('0x126')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0xe697('0x18d')});db[_0xe697('0x18f')][_0xe697('0x126')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xe697('0x155')});db['OpenchannelApplication']['belongsTo'](db[_0xe697('0x86')],{'onDelete':_0xe697('0x178'),'foreignKey':'TagId'});db[_0xe697('0x5f')][_0xe697('0x117')](db[_0xe697('0x18e')],{'as':_0xe697('0x15c'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x192')});db[_0xe697('0x5f')][_0xe697('0x126')](db[_0xe697('0x5d')],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x18d')});db[_0xe697('0x5f')][_0xe697('0x126')](db['CmContact'],{'as':_0xe697('0x16f'),'foreignKey':'ContactId'});db[_0xe697('0x5f')][_0xe697('0x126')](db['User'],{'as':_0xe697('0x170'),'foreignKey':_0xe697('0x114')});db['OpenchannelInteraction'][_0xe697('0x12a')](db[_0xe697('0x86')],{'through':_0xe697('0x193'),'as':_0xe697('0x182')});db[_0xe697('0x5f')]['belongsToMany'](db[_0xe697('0x86')],{'through':_0xe697('0x193'),'as':_0xe697('0x172')});db['OpenchannelInteraction']['belongsToMany'](db[_0xe697('0x14')],{'as':_0xe697('0x173'),'through':_0xe697('0x194'),'foreignKey':_0xe697('0x192')});db[_0xe697('0x18e')][_0xe697('0x126')](db[_0xe697('0x14')],{'onDelete':_0xe697('0x116'),'as':_0xe697('0x14')});db[_0xe697('0x18e')][_0xe697('0x126')](db[_0xe697('0x6b')],{'onDelete':'cascade','as':_0xe697('0x16f')});db[_0xe697('0x18e')]['belongsTo'](db[_0xe697('0x5f')],{'onDelete':_0xe697('0x116'),'as':_0xe697('0x175'),'foreignKey':_0xe697('0x192')});db[_0xe697('0x18e')][_0xe697('0x126')](db[_0xe697('0xef')],{'as':'Attachment','foreignKey':_0xe697('0x183')});db[_0xe697('0x18e')][_0xe697('0x126')](db[_0xe697('0x5d')],{'as':_0xe697('0x16e'),'foreignKey':'OpenchannelAccountId'});db[_0xe697('0x190')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':_0xe697('0x16b'),'through':'UserOpenchannelQueue','foreignKey':_0xe697('0x191')});db[_0xe697('0x190')][_0xe697('0x12a')](db[_0xe697('0xe8')],{'through':_0xe697('0x195'),'as':_0xe697('0x159')});db['ChatWebsite'][_0xe697('0x117')](db[_0xe697('0x78')],{'as':_0xe697('0x166'),'foreignKey':_0xe697('0x176'),'onDelete':'cascade'});db['ChatWebsite'][_0xe697('0x117')](db[_0xe697('0x77')],{'as':'Answers','foreignKey':_0xe697('0x176')});db[_0xe697('0x13a')][_0xe697('0x117')](db[_0xe697('0x196')],{'as':_0xe697('0x197')});db[_0xe697('0x13a')]['hasMany'](db[_0xe697('0x11f')],{'as':_0xe697('0x168')});db[_0xe697('0x13a')][_0xe697('0x117')](db[_0xe697('0x65')],{'as':'Applications'});db[_0xe697('0x13a')][_0xe697('0x117')](db[_0xe697('0x198')],{'as':_0xe697('0x15c')});db[_0xe697('0x13a')]['belongsTo'](db[_0xe697('0xf7')],{'as':'List','foreignKey':_0xe697('0x16a')});db[_0xe697('0x13a')][_0xe697('0x126')](db[_0xe697('0x7a')],{'as':_0xe697('0x7a'),'foreignKey':_0xe697('0x155')});db['ChatWebsite']['belongsTo'](db[_0xe697('0x3d')],{'as':_0xe697('0x3d'),'foreignKey':'MailAccountId'});db[_0xe697('0x13a')][_0xe697('0x126')](db[_0xe697('0x7c')],{'as':_0xe697('0x156'),'foreignKey':_0xe697('0x157')});db[_0xe697('0x13a')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':_0xe697('0x16b'),'through':'user_has_chat_websites'});db[_0xe697('0x64')][_0xe697('0x126')](db[_0xe697('0x5d')],{});db[_0xe697('0x64')][_0xe697('0x126')](db['CmList'],{'as':_0xe697('0x169'),'foreignKey':'ListId'});db[_0xe697('0x64')][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':_0xe697('0x16f'),'foreignKey':_0xe697('0x17a')});db[_0xe697('0x64')][_0xe697('0x126')](db[_0xe697('0x5f')],{});db['OpenchannelQueueReport'][_0xe697('0x126')](db[_0xe697('0x18e')],{});db[_0xe697('0x64')][_0xe697('0x126')](db[_0xe697('0x14')],{});db[_0xe697('0x64')]['belongsTo'](db['OpenchannelQueue'],{});db['ChatApplication'][_0xe697('0x126')](db['User'],{'as':_0xe697('0x199'),'foreignKey':'UserId','onDelete':_0xe697('0x178')});db['ChatApplication'][_0xe697('0x126')](db['ChatQueue'],{'as':_0xe697('0x19a'),'foreignKey':_0xe697('0x19b'),'onDelete':_0xe697('0x178')});db[_0xe697('0x65')][_0xe697('0x126')](db['ChatWebsite'],{'as':_0xe697('0x19c'),'foreignKey':_0xe697('0x176'),'onDelete':_0xe697('0x178')});db[_0xe697('0x65')][_0xe697('0x126')](db[_0xe697('0x86')],{'onDelete':'restrict','foreignKey':_0xe697('0x179')});db[_0xe697('0x11f')][_0xe697('0x117')](db[_0xe697('0x198')],{'as':_0xe697('0x15c'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x19d')});db[_0xe697('0x11f')][_0xe697('0x126')](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xe697('0x11f')][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':'Contact','foreignKey':'ContactId'});db[_0xe697('0x11f')][_0xe697('0x126')](db['User'],{'as':_0xe697('0x170'),'foreignKey':_0xe697('0x114')});db['ChatInteraction'][_0xe697('0x12a')](db[_0xe697('0x86')],{'through':'chat_interaction_has_tags','as':_0xe697('0x182')});db[_0xe697('0x11f')][_0xe697('0x12a')](db[_0xe697('0x86')],{'through':_0xe697('0x19e'),'as':'ThroughTags'});db[_0xe697('0x11f')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':_0xe697('0x173'),'through':_0xe697('0x19f'),'foreignKey':_0xe697('0x19d')});db[_0xe697('0x198')]['belongsTo'](db['User'],{'onDelete':'cascade','as':_0xe697('0x14')});db[_0xe697('0x198')][_0xe697('0x126')](db['CmContact'],{'onDelete':_0xe697('0x116'),'as':'Contact','foreignKey':_0xe697('0x17a')});db['ChatMessage'][_0xe697('0x126')](db[_0xe697('0x11f')],{'onDelete':'cascade','as':_0xe697('0x175'),'foreignKey':'ChatInteractionId'});db[_0xe697('0x198')][_0xe697('0x126')](db[_0xe697('0xef')],{'as':'Attachment','foreignKey':_0xe697('0x183')});db[_0xe697('0x198')][_0xe697('0x126')](db[_0xe697('0x13a')],{'as':'Account','foreignKey':_0xe697('0x176')});db[_0xe697('0x67')][_0xe697('0x117')](db[_0xe697('0xef')],{'as':'Attachments','foreignKey':_0xe697('0x177'),'onDelete':_0xe697('0x116'),'hooks':!![]});db[_0xe697('0x67')][_0xe697('0x126')](db['CmContact'],{'onDelete':'cascade','as':_0xe697('0x16f'),'foreignKey':'ContactId'});db[_0xe697('0x67')]['belongsTo'](db[_0xe697('0x13a')],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x176')});db[_0xe697('0x68')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':_0xe697('0x16b'),'through':_0xe697('0x30'),'hooks':!![]});db[_0xe697('0x68')][_0xe697('0x12a')](db[_0xe697('0xe8')],{'through':'team_has_chat_queues','as':'Teams'});db[_0xe697('0x128')][_0xe697('0x117')](db[_0xe697('0x1a0')],{'as':_0xe697('0x15c'),'foreignKey':_0xe697('0x1a1'),'onDelete':'cascade'});db[_0xe697('0x128')]['belongsToMany'](db[_0xe697('0x14')],{'as':_0xe697('0x14c'),'through':_0xe697('0x1a2')});db[_0xe697('0x196')]['belongsTo'](db['ChatWebsite'],{'as':_0xe697('0x19c'),'foreignKey':'ChatWebsiteId'});db[_0xe697('0x6a')][_0xe697('0x117')](db['CmContact'],{'as':_0xe697('0x12b'),'foreignKey':'CompanyId'});db[_0xe697('0x6b')][_0xe697('0x117')](db[_0xe697('0x89')],{'as':_0xe697('0x1a3'),'foreignKey':_0xe697('0x1a4')});db[_0xe697('0x6b')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db['CmContact'][_0xe697('0x117')](db[_0xe697('0x1a5')],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0xe697('0x6b')][_0xe697('0x117')](db['CmHopperHistory'],{'as':_0xe697('0x1a6'),'foreignKey':_0xe697('0x17a')});db['CmContact']['hasMany'](db[_0xe697('0x11d')],{'as':_0xe697('0x11d'),'foreignKey':_0xe697('0x17a')});db[_0xe697('0x6b')][_0xe697('0x117')](db[_0xe697('0xd7')],{'as':'JscriptySessions','foreignKey':_0xe697('0x17a')});db[_0xe697('0x6b')]['hasMany'](db[_0xe697('0x5f')],{'as':_0xe697('0x11e'),'foreignKey':'ContactId','onDelete':_0xe697('0x178')});db[_0xe697('0x6b')][_0xe697('0x117')](db[_0xe697('0x11f')],{'as':_0xe697('0x120'),'foreignKey':_0xe697('0x17a'),'onDelete':_0xe697('0x178')});db[_0xe697('0x6b')][_0xe697('0x117')](db[_0xe697('0x58')],{'as':_0xe697('0x121'),'foreignKey':_0xe697('0x17a'),'onDelete':_0xe697('0x178')});db[_0xe697('0x6b')]['hasMany'](db[_0xe697('0x51')],{'as':_0xe697('0x12f'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xe697('0x6b')]['hasMany'](db[_0xe697('0x41')],{'as':_0xe697('0x122'),'foreignKey':_0xe697('0x17a'),'onDelete':_0xe697('0x178')});db['CmContact'][_0xe697('0x126')](db[_0xe697('0x6a')],{'as':_0xe697('0x1a7'),'foreignKey':'CompanyId'});db['CmContact'][_0xe697('0x126')](db['CmList'],{'as':_0xe697('0x169'),'foreignKey':'ListId','onDelete':_0xe697('0x116')});db['CmContact']['belongsToMany'](db[_0xe697('0x14')],{'as':_0xe697('0x173'),'through':'cm_user_has_contacts'});db['CmContact']['belongsToMany'](db['Tag'],{'as':_0xe697('0x182'),'through':_0xe697('0x1a8')});db['CmContact']['belongsToMany'](db['Tag'],{'through':_0xe697('0x1a8'),'as':_0xe697('0x172')});db[_0xe697('0x6d')]['hasMany'](db[_0xe697('0x8b')],{'as':_0xe697('0x1a9'),'foreignKey':_0xe697('0x1aa')});db[_0xe697('0x6d')][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':_0xe697('0x16f'),'foreignKey':'ContactId','onDelete':_0xe697('0x116')});db['CmHopper'][_0xe697('0x126')](db['CmList'],{'as':_0xe697('0x169'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xe697('0x6d')][_0xe697('0x126')](db[_0xe697('0x14')],{'as':'Agent','foreignKey':_0xe697('0x114')});db[_0xe697('0x6d')][_0xe697('0x126')](db[_0xe697('0x132')],{'as':_0xe697('0x19a'),'foreignKey':_0xe697('0x14d'),'onDelete':'cascade'});db[_0xe697('0x6d')][_0xe697('0x126')](db[_0xe697('0xec')],{'as':'Campaign','foreignKey':_0xe697('0x1ab'),'onDelete':'cascade'});db[_0xe697('0x6d')][_0xe697('0x126')](db['User'],{'as':_0xe697('0x170'),'foreignKey':'OwnerId'});db[_0xe697('0x6e')][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0xe697('0x116')});db[_0xe697('0x6e')]['belongsTo'](db['CmList'],{'as':_0xe697('0x169'),'foreignKey':_0xe697('0x16a'),'onDelete':_0xe697('0x116')});db['CmHopperBlack'][_0xe697('0x126')](db[_0xe697('0x132')],{'as':_0xe697('0x19a'),'foreignKey':'VoiceQueueId','onDelete':_0xe697('0x116')});db[_0xe697('0x6e')][_0xe697('0x126')](db[_0xe697('0xec')],{'as':_0xe697('0xec'),'foreignKey':_0xe697('0x1ab'),'onDelete':_0xe697('0x116')});db[_0xe697('0x75')]['hasMany'](db[_0xe697('0x79')],{'as':{'plural':'All','singular':_0xe697('0x1ac')},'foreignKey':'AutomationAllId','onDelete':_0xe697('0x116'),'hooks':!![]});db['Automation']['hasMany'](db[_0xe697('0x79')],{'as':{'plural':'Any','singular':_0xe697('0x1ad')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db['Automation'][_0xe697('0x117')](db[_0xe697('0x73')],{'as':_0xe697('0x1ae'),'foreignKey':_0xe697('0x1af'),'onDelete':'cascade','hooks':!![]});db['Disposition'][_0xe697('0x117')](db['Disposition'],{'as':_0xe697('0x166'),'foreignKey':_0xe697('0x1b0'),'onDelete':_0xe697('0x116')});db[_0xe697('0x7a')]['hasMany'](db[_0xe697('0x7a')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db[_0xe697('0x7a')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0xe697('0x155'),'onDelete':'restrict'});db['Interval'][_0xe697('0x117')](db[_0xe697('0x45')],{'as':_0xe697('0x1b1'),'foreignKey':'IntervalId'});db[_0xe697('0x7a')][_0xe697('0x117')](db[_0xe697('0x65')],{'as':_0xe697('0x1b2'),'foreignKey':_0xe697('0x155')});db['Interval']['hasMany'](db[_0xe697('0x4f')],{'as':_0xe697('0x1b3'),'foreignKey':_0xe697('0x155')});db['Interval']['hasMany'](db[_0xe697('0x187')],{'as':_0xe697('0x1b4'),'foreignKey':_0xe697('0x155')});db[_0xe697('0x82')][_0xe697('0x126')](db[_0xe697('0x3d')],{});db[_0xe697('0x82')][_0xe697('0x126')](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db[_0xe697('0x82')][_0xe697('0x126')](db[_0xe697('0x97')],{'foreignKey':'CustomReportId'});db[_0xe697('0x84')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0xe697('0x1b5'),'through':_0xe697('0x14b'),'onDelete':_0xe697('0x178')});db[_0xe697('0x86')][_0xe697('0x12a')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0xe697('0x86')][_0xe697('0x12a')](db['ChatInteraction'],{'through':_0xe697('0x19e')});db[_0xe697('0x86')]['belongsToMany'](db[_0xe697('0x41')],{'through':_0xe697('0x171')});db[_0xe697('0x86')]['belongsToMany'](db['SmsInteraction'],{'through':_0xe697('0x18b')});db[_0xe697('0x86')][_0xe697('0x12a')](db[_0xe697('0x51')],{'through':_0xe697('0x181')});db[_0xe697('0x86')][_0xe697('0x12a')](db[_0xe697('0x5f')],{'through':'openchannel_interaction_has_tags'});db[_0xe697('0x86')][_0xe697('0x12a')](db[_0xe697('0x123')],{'through':_0xe697('0x1b6')});db[_0xe697('0x89')][_0xe697('0x126')](db['ContactItemType'],{'as':_0xe697('0x1b7'),'foreignKey':_0xe697('0x1b8')});db['CmHopperAdditionalPhone']['belongsTo'](db['CmHopper'],{'as':_0xe697('0x1b9'),'foreignKey':'CmHopperId'});db[_0xe697('0x89')]['belongsTo'](db[_0xe697('0x6b')],{'as':_0xe697('0x16f'),'foreignKey':_0xe697('0x1a4')});db['Trigger'][_0xe697('0x117')](db[_0xe697('0x79')],{'as':{'plural':'AllConditions','singular':_0xe697('0x1ba')},'foreignKey':_0xe697('0x1bb'),'onDelete':_0xe697('0x116'),'hooks':!![]});db[_0xe697('0x8f')][_0xe697('0x117')](db[_0xe697('0x79')],{'as':{'plural':_0xe697('0x1bc'),'singular':_0xe697('0x1bd')},'foreignKey':'TriggerAnyId','onDelete':_0xe697('0x116'),'hooks':!![]});db['Trigger'][_0xe697('0x117')](db[_0xe697('0x73')],{'as':_0xe697('0x1ae'),'foreignKey':'TriggerId','onDelete':_0xe697('0x116'),'hooks':!![]});db[_0xe697('0x97')][_0xe697('0x117')](db['AnalyticFieldReport'],{'as':_0xe697('0x1be'),'onDelete':'cascade','foreignKey':_0xe697('0x1bf'),'hooks':!![]});db[_0xe697('0x1c0')][_0xe697('0x117')](db[_0xe697('0x9d')],{'as':_0xe697('0x1be'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c1')});db[_0xe697('0x9c')]['hasMany'](db[_0xe697('0x9d')],{'as':_0xe697('0x1be'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c2')});db[_0xe697('0x9d')][_0xe697('0x126')](db[_0xe697('0x9c')],{'foreignKey':_0xe697('0x1c2')});db[_0xe697('0x9f')]['hasMany'](db['SalesforceConfiguration'],{'as':_0xe697('0x1c3'),'onDelete':'cascade','foreignKey':_0xe697('0x1c4')});db[_0xe697('0xa0')][_0xe697('0x117')](db[_0xe697('0x1c5')],{'as':_0xe697('0x1c6'),'onDelete':_0xe697('0x116'),'foreignKey':'SubjectId'});db[_0xe697('0xa0')][_0xe697('0x117')](db['SalesforceField'],{'as':'Descriptions','onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c7')});db['SalesforceConfiguration'][_0xe697('0x117')](db['SalesforceField'],{'as':_0xe697('0x1be'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0xa0')][_0xe697('0x126')](db[_0xe697('0x9f')],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x1c4')});db[_0xe697('0x1c5')]['hasMany'](db[_0xe697('0x1c5')],{'as':'Subject','foreignKey':_0xe697('0x1c9')});db[_0xe697('0x1c5')]['hasMany'](db[_0xe697('0x1c5')],{'as':_0xe697('0x1ca'),'foreignKey':_0xe697('0x1c7')});db[_0xe697('0x1c5')][_0xe697('0x117')](db[_0xe697('0x1c5')],{'as':_0xe697('0x1cb'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0x1c5')]['belongsTo'](db[_0xe697('0x91')],{'as':_0xe697('0x91'),'foreignKey':_0xe697('0x1cc')});db[_0xe697('0xa2')]['hasMany'](db[_0xe697('0x1cd')],{'as':'Configurations','onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c4')});db[_0xe697('0x1cd')][_0xe697('0x117')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c9')});db[_0xe697('0x1cd')]['hasMany'](db[_0xe697('0xa5')],{'as':_0xe697('0x1ce'),'onDelete':_0xe697('0x116'),'foreignKey':'DescriptionId'});db[_0xe697('0x1cd')][_0xe697('0x117')](db['SugarcrmField'],{'as':_0xe697('0x1be'),'onDelete':'cascade','foreignKey':_0xe697('0x1c8')});db[_0xe697('0x1cd')][_0xe697('0x126')](db[_0xe697('0xa2')],{'as':'Account','foreignKey':_0xe697('0x1c4')});db[_0xe697('0xa5')]['hasMany'](db['SugarcrmField'],{'as':_0xe697('0x1cf'),'foreignKey':_0xe697('0x1c9')});db[_0xe697('0xa5')][_0xe697('0x117')](db[_0xe697('0xa5')],{'as':_0xe697('0x1ca'),'foreignKey':_0xe697('0x1c7')});db[_0xe697('0xa5')]['hasMany'](db[_0xe697('0xa5')],{'as':_0xe697('0x1cb'),'foreignKey':_0xe697('0x1c8')});db['SugarcrmField'][_0xe697('0x126')](db['Variable'],{'as':'Variable','foreignKey':_0xe697('0x1cc')});db[_0xe697('0xa7')][_0xe697('0x117')](db[_0xe697('0xa9')],{'as':_0xe697('0x1c3'),'onDelete':'cascade','foreignKey':_0xe697('0x1c4')});db[_0xe697('0xa9')]['hasMany'](db[_0xe697('0xab')],{'as':_0xe697('0x1c6'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c9')});db[_0xe697('0xa9')][_0xe697('0x117')](db[_0xe697('0xab')],{'as':_0xe697('0x1ce'),'onDelete':_0xe697('0x116'),'foreignKey':'DescriptionId'});db[_0xe697('0xa9')][_0xe697('0x117')](db['DeskField'],{'as':_0xe697('0x1be'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xe697('0xa9')][_0xe697('0x126')](db[_0xe697('0xa7')],{'as':'Account','foreignKey':_0xe697('0x1c4')});db[_0xe697('0xa9')][_0xe697('0x12a')](db[_0xe697('0x86')],{'through':'int_desk_configuration_has_tags'});db[_0xe697('0xab')][_0xe697('0x117')](db['DeskField'],{'as':_0xe697('0x1cf'),'foreignKey':_0xe697('0x1c9')});db[_0xe697('0xab')][_0xe697('0x117')](db[_0xe697('0xab')],{'as':_0xe697('0x1ca'),'foreignKey':_0xe697('0x1c7')});db[_0xe697('0xab')][_0xe697('0x117')](db[_0xe697('0xab')],{'as':_0xe697('0x1cb'),'foreignKey':'FieldId'});db[_0xe697('0xab')][_0xe697('0x126')](db[_0xe697('0x91')],{'as':_0xe697('0x91'),'foreignKey':'VariableId'});db['ZohoAccount'][_0xe697('0x117')](db['ZohoConfiguration'],{'as':'Configurations','onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c4')});db['ZohoConfiguration'][_0xe697('0x117')](db[_0xe697('0xb1')],{'as':'Subjects','onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c9')});db['ZohoConfiguration'][_0xe697('0x117')](db[_0xe697('0xb1')],{'as':_0xe697('0x1ce'),'onDelete':'cascade','foreignKey':_0xe697('0x1c7')});db[_0xe697('0xaf')][_0xe697('0x117')](db['ZohoField'],{'as':_0xe697('0x1be'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0xaf')][_0xe697('0x126')](db['ZohoAccount'],{'as':_0xe697('0x16e'),'foreignKey':'AccountId'});db[_0xe697('0xb1')][_0xe697('0x117')](db['ZohoField'],{'as':_0xe697('0x1cf'),'foreignKey':_0xe697('0x1c9')});db[_0xe697('0xb1')]['hasMany'](db['ZohoField'],{'as':'Description','foreignKey':_0xe697('0x1c7')});db[_0xe697('0xb1')][_0xe697('0x117')](db[_0xe697('0xb1')],{'as':'Field','foreignKey':_0xe697('0x1c8')});db['ZohoField'][_0xe697('0x126')](db[_0xe697('0x91')],{'as':_0xe697('0x91'),'foreignKey':_0xe697('0x1cc')});db[_0xe697('0xb2')][_0xe697('0x117')](db[_0xe697('0xb3')],{'as':_0xe697('0x1c3'),'onDelete':_0xe697('0x116'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xe697('0x117')](db[_0xe697('0xb5')],{'as':_0xe697('0x1c6'),'foreignKey':'SubjectId'});db[_0xe697('0xb3')][_0xe697('0x117')](db[_0xe697('0xb5')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xe697('0xb3')][_0xe697('0x117')](db[_0xe697('0xb5')],{'as':'Fields','foreignKey':'FieldId'});db['ZendeskConfiguration'][_0xe697('0x126')](db[_0xe697('0xb2')],{'as':'Account','foreignKey':_0xe697('0x1c4')});db[_0xe697('0xb3')]['belongsToMany'](db[_0xe697('0x86')],{'through':_0xe697('0x1d0')});db[_0xe697('0xb5')][_0xe697('0x117')](db[_0xe697('0xb5')],{'as':'Subject','foreignKey':_0xe697('0x1c9')});db[_0xe697('0xb5')][_0xe697('0x117')](db[_0xe697('0xb5')],{'as':_0xe697('0x1ca'),'foreignKey':_0xe697('0x1c7')});db[_0xe697('0xb5')][_0xe697('0x117')](db[_0xe697('0xb5')],{'as':_0xe697('0x1cb'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0xb5')]['belongsTo'](db[_0xe697('0x91')],{'as':_0xe697('0x91'),'foreignKey':_0xe697('0x1cc')});db['FreshdeskAccount'][_0xe697('0x117')](db[_0xe697('0xb8')],{'as':_0xe697('0x1c3'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c4')});db[_0xe697('0xb8')]['hasMany'](db[_0xe697('0x1d1')],{'as':_0xe697('0x1c6'),'onDelete':'cascade','foreignKey':_0xe697('0x1c9')});db[_0xe697('0xb8')][_0xe697('0x117')](db[_0xe697('0x1d1')],{'as':'Descriptions','onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c7')});db[_0xe697('0xb8')]['hasMany'](db[_0xe697('0x1d1')],{'as':_0xe697('0x1be'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0xb8')]['belongsTo'](db[_0xe697('0xb6')],{'as':'Account','foreignKey':_0xe697('0x1c4')});db[_0xe697('0xb8')]['belongsToMany'](db[_0xe697('0x86')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xe697('0x1d1')][_0xe697('0x117')](db[_0xe697('0x1d1')],{'as':_0xe697('0x1cf'),'foreignKey':_0xe697('0x1c9')});db['FreshdeskField'][_0xe697('0x117')](db['FreshdeskField'],{'as':_0xe697('0x1ca'),'foreignKey':_0xe697('0x1c7')});db[_0xe697('0x1d1')][_0xe697('0x117')](db[_0xe697('0x1d1')],{'as':'Field','foreignKey':_0xe697('0x1c8')});db['FreshdeskField'][_0xe697('0x126')](db[_0xe697('0x91')],{'as':_0xe697('0x91'),'foreignKey':_0xe697('0x1cc')});db[_0xe697('0xbb')][_0xe697('0x117')](db[_0xe697('0xbd')],{'as':_0xe697('0x1c3'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c4')});db[_0xe697('0xbd')][_0xe697('0x117')](db[_0xe697('0xbf')],{'as':_0xe697('0x1c6'),'foreignKey':'SubjectId'});db[_0xe697('0xbd')][_0xe697('0x117')](db[_0xe697('0xbf')],{'as':'Descriptions','foreignKey':_0xe697('0x1c7')});db[_0xe697('0xbd')][_0xe697('0x117')](db[_0xe697('0xbf')],{'as':_0xe697('0x1be'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0xbd')][_0xe697('0x126')](db[_0xe697('0xbb')],{'as':_0xe697('0x16e'),'foreignKey':'AccountId'});db[_0xe697('0xbf')]['hasMany'](db[_0xe697('0xbf')],{'as':_0xe697('0x1cf'),'foreignKey':_0xe697('0x1c9')});db['VtigerField'][_0xe697('0x117')](db[_0xe697('0xbf')],{'as':_0xe697('0x1ca'),'foreignKey':_0xe697('0x1c7')});db[_0xe697('0xbf')][_0xe697('0x117')](db['VtigerField'],{'as':_0xe697('0x1cb'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0xbf')][_0xe697('0x126')](db[_0xe697('0x91')],{'as':_0xe697('0x91'),'foreignKey':_0xe697('0x1cc')});db[_0xe697('0xc0')][_0xe697('0x117')](db[_0xe697('0xc2')],{'as':'Configurations','onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c4')});db[_0xe697('0xc2')][_0xe697('0x117')](db[_0xe697('0x1d2')],{'as':_0xe697('0x1c6'),'foreignKey':_0xe697('0x1c9')});db[_0xe697('0xc2')][_0xe697('0x117')](db['ServicenowField'],{'as':_0xe697('0x1ce'),'foreignKey':'DescriptionId'});db[_0xe697('0xc2')][_0xe697('0x117')](db[_0xe697('0x1d2')],{'as':_0xe697('0x1be'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0xc2')]['belongsTo'](db['ServicenowAccount'],{'as':'Account','foreignKey':_0xe697('0x1c4')});db['ServicenowField'][_0xe697('0x117')](db[_0xe697('0x1d2')],{'as':_0xe697('0x1cf'),'foreignKey':'SubjectId'});db['ServicenowField']['hasMany'](db[_0xe697('0x1d2')],{'as':_0xe697('0x1ca'),'foreignKey':'DescriptionId'});db[_0xe697('0x1d2')][_0xe697('0x117')](db['ServicenowField'],{'as':'Field','foreignKey':_0xe697('0x1c8')});db['ServicenowField'][_0xe697('0x126')](db[_0xe697('0x91')],{'as':_0xe697('0x91'),'foreignKey':'VariableId'});db[_0xe697('0xc5')][_0xe697('0x117')](db[_0xe697('0xc7')],{'as':_0xe697('0x1c3'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c4')});db[_0xe697('0xc5')][_0xe697('0x126')](db['CloudProvider'],{'as':_0xe697('0x163'),'foreignKey':'CloudProviderId'});db['Dynamics365Configuration'][_0xe697('0x117')](db['Dynamics365Field'],{'as':_0xe697('0x1c6'),'onDelete':_0xe697('0x116'),'foreignKey':'SubjectId'});db[_0xe697('0xc7')][_0xe697('0x117')](db['Dynamics365Field'],{'as':_0xe697('0x1ce'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c7')});db['Dynamics365Configuration'][_0xe697('0x117')](db[_0xe697('0xc9')],{'as':_0xe697('0x1be'),'onDelete':_0xe697('0x116'),'foreignKey':'FieldId'});db[_0xe697('0xc7')]['belongsTo'](db['Dynamics365Account'],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x1c4')});db[_0xe697('0xc9')][_0xe697('0x117')](db[_0xe697('0xc9')],{'as':_0xe697('0x1cf'),'foreignKey':_0xe697('0x1c9')});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':_0xe697('0x1ca'),'foreignKey':_0xe697('0x1c7')});db['Dynamics365Field'][_0xe697('0x117')](db['Dynamics365Field'],{'as':_0xe697('0x1cb'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0xc9')]['belongsTo'](db[_0xe697('0x91')],{'as':_0xe697('0x91'),'foreignKey':_0xe697('0x1cc')});db[_0xe697('0xcb')]['hasMany'](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x1c4')});db['FreshsalesConfiguration'][_0xe697('0x117')](db['FreshsalesField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xe697('0xcd')]['hasMany'](db[_0xe697('0xcf')],{'as':_0xe697('0x1ce'),'foreignKey':'DescriptionId'});db[_0xe697('0xcd')][_0xe697('0x117')](db['FreshsalesField'],{'as':'Fields','foreignKey':'FieldId'});db[_0xe697('0xcd')][_0xe697('0x126')](db[_0xe697('0xcb')],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x1c4')});db[_0xe697('0xcf')][_0xe697('0x117')](db[_0xe697('0xcf')],{'as':_0xe697('0x1cf'),'foreignKey':_0xe697('0x1c9')});db[_0xe697('0xcf')][_0xe697('0x117')](db['FreshsalesField'],{'as':_0xe697('0x1ca'),'foreignKey':_0xe697('0x1c7')});db['FreshsalesField'][_0xe697('0x117')](db[_0xe697('0xcf')],{'as':_0xe697('0x1cb'),'foreignKey':_0xe697('0x1c8')});db[_0xe697('0xcf')][_0xe697('0x126')](db[_0xe697('0x91')],{'as':'Variable','foreignKey':'VariableId'});db[_0xe697('0xd2')][_0xe697('0x126')](db[_0xe697('0x13a')],{});db['ChatQueueReport']['belongsTo'](db[_0xe697('0xf7')],{'as':_0xe697('0x169'),'foreignKey':_0xe697('0x16a')});db[_0xe697('0xd2')][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':_0xe697('0x16f'),'foreignKey':_0xe697('0x17a')});db[_0xe697('0xd2')]['belongsTo'](db[_0xe697('0x11f')],{});db['ChatQueueReport'][_0xe697('0x126')](db[_0xe697('0x198')],{});db[_0xe697('0xd2')][_0xe697('0x126')](db[_0xe697('0x14')],{});db[_0xe697('0xd2')][_0xe697('0x126')](db[_0xe697('0x68')],{});db[_0xe697('0x1a0')][_0xe697('0x126')](db[_0xe697('0x14')],{'onDelete':_0xe697('0x116'),'foreignKey':'FromId'});db[_0xe697('0x1a0')][_0xe697('0x126')](db[_0xe697('0x14')],{'onDelete':'cascade','foreignKey':_0xe697('0x1d3')});db[_0xe697('0xd7')]['hasMany'](db[_0xe697('0x1d4')],{'foreignKey':_0xe697('0x1d5'),'onDelete':'cascade'});db[_0xe697('0xd7')][_0xe697('0x117')](db[_0xe697('0xd5')],{'foreignKey':_0xe697('0x1d5'),'onDelete':_0xe697('0x116')});db['SmsQueueReport']['belongsTo'](db[_0xe697('0x56')],{});db[_0xe697('0xd9')][_0xe697('0x126')](db[_0xe697('0xf7')],{'as':_0xe697('0x169'),'foreignKey':_0xe697('0x16a')});db[_0xe697('0xd9')][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':_0xe697('0x16f'),'foreignKey':'ContactId'});db[_0xe697('0xd9')][_0xe697('0x126')](db['SmsInteraction'],{});db['SmsQueueReport']['belongsTo'](db[_0xe697('0x189')],{});db['SmsQueueReport'][_0xe697('0x126')](db[_0xe697('0x14')],{});db['SmsQueueReport'][_0xe697('0x126')](db[_0xe697('0x5b')],{});db['JscriptyProject'][_0xe697('0x117')](db[_0xe697('0xd7')],{'foreignKey':'ProjectId'});db[_0xe697('0x1d6')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0xe697('0x1d7')});db[_0xe697('0x1d6')][_0xe697('0x117')](db[_0xe697('0xd5')],{'foreignKey':_0xe697('0x1d7')});db[_0xe697('0xe3')]['belongsToMany'](db[_0xe697('0x14')],{'as':_0xe697('0x173'),'through':_0xe697('0x145')});db[_0xe697('0xe8')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':_0xe697('0x16b'),'through':'user_has_teams'});db['Team']['belongsToMany'](db['VoiceQueue'],{'through':_0xe697('0x10b'),'as':_0xe697('0x1d8')});db[_0xe697('0xe8')][_0xe697('0x12a')](db[_0xe697('0x135')],{'through':_0xe697('0x16c'),'as':_0xe697('0x136')});db[_0xe697('0xe8')][_0xe697('0x12a')](db[_0xe697('0x68')],{'through':'team_has_chat_queues','as':_0xe697('0x137')});db[_0xe697('0xe8')][_0xe697('0x12a')](db['FaxQueue'],{'through':_0xe697('0x184'),'as':_0xe697('0x139')});db['Team'][_0xe697('0x12a')](db[_0xe697('0x5b')],{'through':'team_has_sms_queues','as':'SmsQueues'});db[_0xe697('0xe8')][_0xe697('0x12a')](db[_0xe697('0x190')],{'through':_0xe697('0x195'),'as':_0xe697('0x1d9')});db[_0xe697('0xe8')][_0xe697('0x12a')](db[_0xe697('0x108')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0xe697('0xe8')]['belongsToMany'](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':_0xe697('0x133')});db[_0xe697('0xec')][_0xe697('0x117')](db['CmHopper'],{'as':_0xe697('0x14e'),'foreignKey':_0xe697('0x1ab')});db[_0xe697('0xec')][_0xe697('0x117')](db[_0xe697('0x1a5')],{'as':_0xe697('0x11b'),'foreignKey':_0xe697('0x1ab')});db[_0xe697('0xec')]['hasMany'](db[_0xe697('0x6f')],{'as':'HopperHistories','foreignKey':_0xe697('0x1ab')});db[_0xe697('0xec')][_0xe697('0x117')](db[_0xe697('0x6e')],{'as':_0xe697('0x14f'),'foreignKey':'CampaignId'});db[_0xe697('0xec')][_0xe697('0x126')](db['Trunk'],{'as':_0xe697('0x151'),'foreignKey':_0xe697('0x152')});db[_0xe697('0xec')][_0xe697('0x126')](db[_0xe697('0x151')],{'as':'TrunkBackup','foreignKey':_0xe697('0x154')});db[_0xe697('0xec')][_0xe697('0x126')](db['Interval'],{'as':_0xe697('0x7a'),'foreignKey':_0xe697('0x155')});db[_0xe697('0xec')]['belongsTo'](db[_0xe697('0xe3')],{'as':'SquareProject','foreignKey':_0xe697('0x1da')});db[_0xe697('0xec')][_0xe697('0x12a')](db[_0xe697('0xf7')],{'as':'Lists','through':_0xe697('0x1db')});db[_0xe697('0xec')]['belongsToMany'](db['CmList'],{'as':_0xe697('0x15a'),'through':_0xe697('0x1dc')});db[_0xe697('0xef')]['belongsTo'](db[_0xe697('0x67')],{'as':_0xe697('0x67'),'foreignKey':'ChatOfflineMessageId'});db[_0xe697('0x1dd')]['belongsTo'](db[_0xe697('0x43')],{});db[_0xe697('0x1dd')]['belongsTo'](db[_0xe697('0x41')],{});db[_0xe697('0x1dd')][_0xe697('0x126')](db[_0xe697('0x3d')],{'foreignKey':_0xe697('0x1de'),'as':_0xe697('0x1df')});db[_0xe697('0x1dd')][_0xe697('0x126')](db[_0xe697('0x14')],{'foreignKey':'FromUserId','as':'FromAgent'});db['MailTransferReport'][_0xe697('0x126')](db[_0xe697('0x14')],{'foreignKey':_0xe697('0x1e0'),'as':_0xe697('0x1e1')});db[_0xe697('0x1dd')][_0xe697('0x126')](db[_0xe697('0x135')],{'foreignKey':_0xe697('0x1e2'),'as':_0xe697('0x1e3')});db[_0xe697('0x1dd')][_0xe697('0x126')](db[_0xe697('0x3d')],{'foreignKey':_0xe697('0x1e4'),'as':_0xe697('0x1e5')});db[_0xe697('0x1e6')]['belongsTo'](db[_0xe697('0x198')],{});db[_0xe697('0x1e6')][_0xe697('0x126')](db[_0xe697('0x11f')],{});db[_0xe697('0x1e6')]['belongsTo'](db[_0xe697('0x13a')],{'foreignKey':_0xe697('0x1e7'),'as':_0xe697('0x1df')});db[_0xe697('0x1e6')][_0xe697('0x126')](db['User'],{'foreignKey':_0xe697('0x1e8'),'as':_0xe697('0x1e9')});db[_0xe697('0x1e6')]['belongsTo'](db[_0xe697('0x14')],{'foreignKey':_0xe697('0x1e0'),'as':_0xe697('0x1e1')});db[_0xe697('0x1e6')][_0xe697('0x126')](db[_0xe697('0x68')],{'foreignKey':_0xe697('0x1ea'),'as':_0xe697('0x1e3')});db[_0xe697('0x1e6')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0xe697('0x1eb'),'as':'ToAccount'});db[_0xe697('0x1ec')][_0xe697('0x126')](db[_0xe697('0x17e')],{});db[_0xe697('0x1ec')][_0xe697('0x126')](db[_0xe697('0x51')],{});db[_0xe697('0x1ec')]['belongsTo'](db[_0xe697('0x4d')],{'foreignKey':_0xe697('0x1ed'),'as':_0xe697('0x1df')});db[_0xe697('0x1ec')][_0xe697('0x126')](db[_0xe697('0x14')],{'foreignKey':_0xe697('0x1e8'),'as':_0xe697('0x1e9')});db[_0xe697('0x1ec')][_0xe697('0x126')](db[_0xe697('0x14')],{'foreignKey':_0xe697('0x1e0'),'as':'ToAgent'});db[_0xe697('0x1ec')][_0xe697('0x126')](db[_0xe697('0x138')],{'foreignKey':_0xe697('0x1ee'),'as':_0xe697('0x1e3')});db[_0xe697('0x1ec')][_0xe697('0x126')](db[_0xe697('0x4d')],{'foreignKey':_0xe697('0x1ef'),'as':'ToAccount'});db[_0xe697('0xf4')]['belongsTo'](db['OpenchannelMessage'],{});db[_0xe697('0xf4')]['belongsTo'](db[_0xe697('0x5f')],{});db[_0xe697('0xf4')][_0xe697('0x126')](db['OpenchannelAccount'],{'foreignKey':_0xe697('0x1f0'),'as':_0xe697('0x1df')});db['OpenchannelTransferReport'][_0xe697('0x126')](db[_0xe697('0x14')],{'foreignKey':_0xe697('0x1e8'),'as':_0xe697('0x1e9')});db[_0xe697('0xf4')][_0xe697('0x126')](db[_0xe697('0x14')],{'foreignKey':'ToUserId','as':_0xe697('0x1e1')});db[_0xe697('0xf4')][_0xe697('0x126')](db[_0xe697('0x190')],{'foreignKey':_0xe697('0x1f1'),'as':_0xe697('0x1e3')});db['OpenchannelTransferReport'][_0xe697('0x126')](db[_0xe697('0x5d')],{'foreignKey':_0xe697('0x1f2'),'as':_0xe697('0x1e5')});db['SmsTransferReport'][_0xe697('0x126')](db[_0xe697('0x189')],{});db[_0xe697('0xf5')][_0xe697('0x126')](db[_0xe697('0x58')],{});db[_0xe697('0xf5')][_0xe697('0x126')](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':'FromAccount'});db[_0xe697('0xf5')]['belongsTo'](db['User'],{'foreignKey':_0xe697('0x1e8'),'as':'FromAgent'});db[_0xe697('0xf5')]['belongsTo'](db[_0xe697('0x14')],{'foreignKey':_0xe697('0x1e0'),'as':_0xe697('0x1e1')});db[_0xe697('0xf5')][_0xe697('0x126')](db[_0xe697('0x5b')],{'foreignKey':_0xe697('0x1f3'),'as':'ToQueue'});db[_0xe697('0xf5')]['belongsTo'](db[_0xe697('0x56')],{'foreignKey':'ToSmsAccountId','as':_0xe697('0x1e5')});db[_0xe697('0xf7')][_0xe697('0x117')](db[_0xe697('0x78')],{'as':_0xe697('0x166'),'foreignKey':_0xe697('0x16a'),'onDelete':_0xe697('0x116')});db[_0xe697('0xf7')][_0xe697('0x117')](db[_0xe697('0x72')],{'as':_0xe697('0x1f4'),'foreignKey':_0xe697('0x16a')});db[_0xe697('0xf7')]['hasMany'](db[_0xe697('0x6b')],{'as':_0xe697('0x12b'),'onDelete':_0xe697('0x116'),'foreignKey':_0xe697('0x16a')});db[_0xe697('0xf7')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xe697('0x16a')});db['CmList'][_0xe697('0x117')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0xe697('0x16a')});db[_0xe697('0xf7')][_0xe697('0x117')](db[_0xe697('0x11d')],{'as':_0xe697('0x11d'),'foreignKey':_0xe697('0x16a')});db['CmList'][_0xe697('0x12a')](db[_0xe697('0x132')],{'as':_0xe697('0x1f5'),'through':_0xe697('0x158')});db['CmList'][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':_0xe697('0x16b'),'through':_0xe697('0x1f6')});db['VoicePrefix'][_0xe697('0x117')](db[_0xe697('0x1b')],{'as':_0xe697('0x11a'),'onDelete':'cascade'});db[_0xe697('0x1f7')][_0xe697('0x12a')](db['User'],{'as':'Agents','through':_0xe697('0x134')});db['VoicePrefix'][_0xe697('0x12a')](db[_0xe697('0xe8')],{'through':_0xe697('0x10d'),'as':_0xe697('0x159')});db[_0xe697('0xfa')]['hasMany'](db['User'],{'as':_0xe697('0x173'),'foreignKey':_0xe697('0x127')});db[_0xe697('0xfa')][_0xe697('0x117')](db[_0xe697('0xfc')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0xe697('0x116')});db[_0xe697('0xfc')][_0xe697('0x117')](db[_0xe697('0xfe')],{'as':'Resources','foreignKey':_0xe697('0x1f8'),'onDelete':_0xe697('0x116')});db['WhatsappAccount'][_0xe697('0x117')](db[_0xe697('0x78')],{'as':_0xe697('0x166'),'foreignKey':_0xe697('0x1f9'),'onDelete':_0xe697('0x116')});db['WhatsappAccount'][_0xe697('0x117')](db[_0xe697('0x77')],{'as':_0xe697('0x167'),'foreignKey':_0xe697('0x1f9')});db[_0xe697('0x101')][_0xe697('0x117')](db[_0xe697('0x104')],{'as':_0xe697('0x15c'),'foreignKey':_0xe697('0x1f9')});db[_0xe697('0x101')]['hasMany'](db[_0xe697('0x123')],{'as':'Interactions'});db[_0xe697('0x101')][_0xe697('0x117')](db[_0xe697('0x1fa')],{'as':_0xe697('0x148')});db[_0xe697('0x101')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xe697('0x16a')});db[_0xe697('0x101')][_0xe697('0x126')](db[_0xe697('0x7c')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xe697('0x101')]['belongsToMany'](db[_0xe697('0x14')],{'as':_0xe697('0x16b'),'through':_0xe697('0x143')});db[_0xe697('0x1fa')][_0xe697('0x126')](db[_0xe697('0x14')],{'onDelete':_0xe697('0x178')});db[_0xe697('0x1fa')][_0xe697('0x126')](db['WhatsappQueue'],{'onDelete':_0xe697('0x178')});db[_0xe697('0x1fa')][_0xe697('0x126')](db[_0xe697('0x101')],{'onDelete':_0xe697('0x178')});db['WhatsappApplication'][_0xe697('0x126')](db[_0xe697('0x7a')],{'onDelete':_0xe697('0x178'),'foreignKey':_0xe697('0x155')});db[_0xe697('0x1fa')][_0xe697('0x126')](db[_0xe697('0x86')],{'onDelete':_0xe697('0x178'),'foreignKey':_0xe697('0x179')});db['WhatsappInteraction']['hasMany'](db['WhatsappMessage'],{'as':_0xe697('0x15c'),'onDelete':'cascade','foreignKey':_0xe697('0x1fb')});db[_0xe697('0x123')]['belongsTo'](db[_0xe697('0x101')],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x1f9')});db['WhatsappInteraction'][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':_0xe697('0x16f'),'foreignKey':_0xe697('0x17a')});db[_0xe697('0x123')]['belongsTo'](db['User'],{'as':_0xe697('0x170'),'foreignKey':_0xe697('0x114')});db['WhatsappInteraction'][_0xe697('0x12a')](db[_0xe697('0x86')],{'through':_0xe697('0x1b6'),'as':'Tags'});db[_0xe697('0x123')]['belongsToMany'](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0xe697('0x172')});db[_0xe697('0x123')][_0xe697('0x12a')](db[_0xe697('0x14')],{'as':_0xe697('0x173'),'through':_0xe697('0x1fc'),'foreignKey':'WhatsappInteractionId'});db[_0xe697('0x104')][_0xe697('0x126')](db[_0xe697('0x14')],{'as':_0xe697('0x14')});db['WhatsappMessage'][_0xe697('0x126')](db[_0xe697('0x6b')],{'onDelete':_0xe697('0x116'),'as':'Contact'});db[_0xe697('0x104')][_0xe697('0x126')](db[_0xe697('0x123')],{'onDelete':'cascade','as':_0xe697('0x175'),'foreignKey':_0xe697('0x1fb')});db[_0xe697('0x104')][_0xe697('0x126')](db[_0xe697('0x101')],{'as':_0xe697('0x16e'),'foreignKey':_0xe697('0x1f9')});db[_0xe697('0x106')][_0xe697('0x126')](db[_0xe697('0x101')],{});db[_0xe697('0x106')]['belongsTo'](db[_0xe697('0xf7')],{'as':_0xe697('0x169'),'foreignKey':'ListId'});db['WhatsappQueueReport'][_0xe697('0x126')](db[_0xe697('0x6b')],{'as':_0xe697('0x16f'),'foreignKey':_0xe697('0x17a')});db['WhatsappQueueReport'][_0xe697('0x126')](db[_0xe697('0x123')],{});db['WhatsappQueueReport'][_0xe697('0x126')](db['WhatsappQueue'],{});db[_0xe697('0x106')][_0xe697('0x126')](db[_0xe697('0x104')],{});db[_0xe697('0x106')][_0xe697('0x126')](db[_0xe697('0x14')],{});db[_0xe697('0x1fd')][_0xe697('0x126')](db[_0xe697('0x104')],{});db[_0xe697('0x1fd')][_0xe697('0x126')](db['WhatsappInteraction'],{});db[_0xe697('0x1fd')][_0xe697('0x126')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0xe697('0x1df')});db['WhatsappTransferReport'][_0xe697('0x126')](db[_0xe697('0x101')],{'foreignKey':_0xe697('0x1fe'),'as':_0xe697('0x1e5')});db['WhatsappTransferReport']['belongsTo'](db[_0xe697('0x108')],{'foreignKey':_0xe697('0x1ff'),'as':_0xe697('0x1e3')});db[_0xe697('0x1fd')][_0xe697('0x126')](db['User'],{'foreignKey':_0xe697('0x1e8'),'as':_0xe697('0x1e9')});db[_0xe697('0x1fd')][_0xe697('0x126')](db[_0xe697('0x14')],{'foreignKey':_0xe697('0x1e0'),'as':'ToAgent'});db[_0xe697('0x108')][_0xe697('0x12a')](db['User'],{'as':_0xe697('0x16b'),'through':_0xe697('0x37'),'foreignKey':'WhatsappQueueId'});db[_0xe697('0x108')][_0xe697('0x12a')](db[_0xe697('0xe8')],{'through':_0xe697('0x200'),'as':'Teams'});db[_0xe697('0x110')][_0xe697('0x126')](db[_0xe697('0x14')],{'as':_0xe697('0x201'),'foreignKey':_0xe697('0x114'),'onDelete':_0xe697('0x116'),'hooks':!![]});db[_0xe697('0x163')]['hasOne'](db[_0xe697('0xc5')],{'as':'Dynamics365Account','onDelete':'restrict'});db[_0xe697('0x163')][_0xe697('0x112')](db[_0xe697('0x39')],{'as':_0xe697('0x202'),'onDelete':_0xe697('0x178')});db[_0xe697('0x163')][_0xe697('0x112')](db[_0xe697('0x3b')],{'as':_0xe697('0x165'),'onDelete':_0xe697('0x178')});module[_0xe697('0x203')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x132c=['UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','userSetting','hasMany','Recordings','VoiceQueuesRt','CmHopperFinal','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteraction','SmsInteractions','FaxInteraction','FaxInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','Lists','Team','user_has_teams','MailInteractions','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueue','VoiceQueues','VoicePrefixes','UserVoicePrefix','ChatQueues','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','UserWhatsappQueue','CmList','ChatWebsites','user_has_chat_websites','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','SquareProjects','user_has_square_projects','Applications','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','CmHopperBlack','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','UserVoiceQueue','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Dispositions','Answers','ListId','TemplateId','Agents','team_has_mail_queues','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Interaction','ChatOfflineMessage','TagId','List','Dashboard','Items','FaxAccountId','Interactions','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','UserFaxQueue','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','IntervalId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatApplication','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','chat_group_has_users','Phones','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','All','Any','AutomationAnyId','Action','Actions','ParentId','Intervals','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','CustomReportId','Mohs','ItemType','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','Fields','DefaultReportId','MetricId','Subjects','SubjectId','Descriptions','AccountId','Subject','Description','DescriptionId','Field','FieldId','VariableId','Configurations','SugarcrmField','DeskConfiguration','int_desk_configuration_has_tags','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowAccount','Dynamics365Account','ToId','SessionId','JscriptyAnswerReport','ProjectId','team_has_whatsapp_queues','HopperBlacks','SquareProjectId','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToUserId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','voice_queues_has_cm_lists','Extensions','UserProfileSection','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','whatsapp_interaction_has_tags','user_has_whatsapp_interactions','ToQueueId','WhatsappQueueId','user','../config/environment','jstz','determine','sequelize','defaultsDeep','motion2','xcall','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','database','username','options','password','User','import','VoiceChanSpy','VoiceContext','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userFaxQueue/userFaxQueue.model'];(function(_0x3d00db,_0x3692b3){var _0x41f115=function(_0x3c94fd){while(--_0x3c94fd){_0x3d00db['push'](_0x3d00db['shift']());}};_0x41f115(++_0x3692b3);}(_0x132c,0x1c9));var _0xc132=function(_0x2e86d3,_0x4bfd72){_0x2e86d3=_0x2e86d3-0x0;var _0x16b599=_0x132c[_0x2e86d3];return _0x16b599;};'use strict';var config=require(_0xc132('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0xc132('0x1'));var timezone=jstz[_0xc132('0x2')]();config[_0xc132('0x3')]=_[_0xc132('0x4')](config['sequelize'],{'database':_0xc132('0x5'),'username':_0xc132('0x6'),'password':'xC@LL1234','options':{'host':_0xc132('0x7'),'port':0xcea,'dialect':_0xc132('0x8'),'dialectOptions':{'charset':_0xc132('0x9')},'logging':![],'timezone':timezone[_0xc132('0xa')](),'define':{'charset':_0xc132('0xb'),'collate':_0xc132('0xc')}}});config[_0xc132('0xd')]=_[_0xc132('0x4')](config[_0xc132('0xd')],{'database':_0xc132('0x5'),'username':_0xc132('0x6'),'password':_0xc132('0xe'),'options':{'host':_0xc132('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xc132('0xa')](),'define':{'charset':_0xc132('0xb'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xc132('0xf')],config['sequelize'][_0xc132('0x10')],config['sequelize']['password'],config[_0xc132('0x3')][_0xc132('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xc132('0xf')],config['sequelizeHistory'][_0xc132('0x10')],config[_0xc132('0xd')][_0xc132('0x12')],config[_0xc132('0xd')][_0xc132('0x11')])};db[_0xc132('0x13')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/user/user.model');db[_0xc132('0x15')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xc132('0x16')]=db['sequelize'][_0xc132('0x14')]('../api/voiceContext/voiceContext.model');db[_0xc132('0x17')]=db[_0xc132('0x3')]['import']('../api/voiceExtension/voiceExtension.model');db[_0xc132('0x18')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x19'));db['VoiceQueue']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x1a'));db[_0xc132('0x1b')]=db['sequelize'][_0xc132('0x14')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0xc132('0x3')]['import']('../api/screenRecording/screenRecording.model');db[_0xc132('0x1c')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x1d'));db[_0xc132('0x1e')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x1f'));db[_0xc132('0x20')]=db[_0xc132('0x3')]['import'](_0xc132('0x21'));db[_0xc132('0x22')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x23'));db[_0xc132('0x24')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x25'));db[_0xc132('0x26')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0xc132('0x27')]=db['sequelize'][_0xc132('0x14')](_0xc132('0x28'));db[_0xc132('0x29')]=db['sequelize'][_0xc132('0x14')]('../api/trunk/trunk.model');db[_0xc132('0x2a')]=db[_0xc132('0x3')]['import'](_0xc132('0x2b'));db[_0xc132('0x2c')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x2d'));db['UserVoiceQueue']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x2e'));db[_0xc132('0x2f')]=db[_0xc132('0x3')]['import'](_0xc132('0x30'));db[_0xc132('0x31')]=db['sequelize'][_0xc132('0x14')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x32'));db[_0xc132('0x33')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x34'));db['UserOpenchannelQueue']=db[_0xc132('0x3')]['import'](_0xc132('0x35'));db['UserWhatsappQueue']=db['sequelize'][_0xc132('0x14')](_0xc132('0x36'));db[_0xc132('0x37')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x38'));db[_0xc132('0x39')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x3a'));db[_0xc132('0x3b')]=db['sequelize']['import'](_0xc132('0x3c'));db[_0xc132('0x3d')]=db['sequelize'][_0xc132('0x14')]('../api/mailQueue/mailQueue.model');db[_0xc132('0x3e')]=db[_0xc132('0x3')]['import']('../api/mailSubstatus/mailSubstatus.model');db[_0xc132('0x3f')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x40'));db[_0xc132('0x41')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x42'));db[_0xc132('0x43')]=db[_0xc132('0x3')]['import'](_0xc132('0x44'));db[_0xc132('0x45')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x46'));db['Dashboard']=db[_0xc132('0x3')]['import'](_0xc132('0x47'));db[_0xc132('0x48')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x49'));db[_0xc132('0x4a')]=db['sequelize'][_0xc132('0x14')](_0xc132('0x4b'));db[_0xc132('0x4c')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x4d'));db[_0xc132('0x4e')]=db[_0xc132('0x3')]['import']('../api/faxMessage/faxMessage.model');db['FaxQueue']=db[_0xc132('0x3')][_0xc132('0x14')]('../api/faxQueue/faxQueue.model');db[_0xc132('0x4f')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x50'));db[_0xc132('0x51')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x52'));db[_0xc132('0x53')]=db['sequelize'][_0xc132('0x14')](_0xc132('0x54'));db[_0xc132('0x55')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x56'));db[_0xc132('0x57')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/smsMessage/smsMessage.model');db[_0xc132('0x58')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x59'));db[_0xc132('0x5a')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x5b'));db[_0xc132('0x5c')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x5d'));db[_0xc132('0x5e')]=db['sequelize'][_0xc132('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xc132('0x5f')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db['sequelize'][_0xc132('0x14')](_0xc132('0x60'));db[_0xc132('0x61')]=db[_0xc132('0x3')]['import'](_0xc132('0x62'));db[_0xc132('0x63')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x64'));db['ChatApplication']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x65'));db['ChatInteraction']=db[_0xc132('0x3')]['import'](_0xc132('0x66'));db[_0xc132('0x67')]=db[_0xc132('0x3')]['import'](_0xc132('0x68'));db['ChatOfflineMessage']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x69'));db[_0xc132('0x6a')]=db['sequelize'][_0xc132('0x14')](_0xc132('0x6b'));db[_0xc132('0x6c')]=db['sequelize']['import'](_0xc132('0x6d'));db[_0xc132('0x6e')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x6f'));db[_0xc132('0x70')]=db[_0xc132('0x3')]['import'](_0xc132('0x71'));db[_0xc132('0x72')]=db[_0xc132('0x3')]['import'](_0xc132('0x73'));db[_0xc132('0x74')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x75'));db['CmHopperBlack']=db['sequelize']['import'](_0xc132('0x76'));db['CmHopperFinal']=db[_0xc132('0x3')][_0xc132('0x14')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0xc132('0x3')][_0xc132('0x14')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xc132('0x77')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x78'));db[_0xc132('0x79')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x7a'));db['Action']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x7b'));db[_0xc132('0x7c')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x7d'));db[_0xc132('0x7e')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x7f'));db[_0xc132('0x80')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x81'));db[_0xc132('0x82')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/condition/condition.model');db[_0xc132('0x83')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x84'));db[_0xc132('0x85')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x86'));db['Cdr']=db[_0xc132('0x3')][_0xc132('0x14')]('../api/cdr/cdr.model');db[_0xc132('0x87')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x88'));db[_0xc132('0x89')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x8a'));db[_0xc132('0x8b')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x8c'));db[_0xc132('0x8d')]=db['sequelize'][_0xc132('0x14')](_0xc132('0x8e'));db[_0xc132('0x8f')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/contactItemType/contactItemType.model');db[_0xc132('0x90')]=db['sequelize'][_0xc132('0x14')](_0xc132('0x91'));db[_0xc132('0x92')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x93'));db[_0xc132('0x94')]=db[_0xc132('0x3')]['import'](_0xc132('0x95'));db['Trigger']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x96'));db[_0xc132('0x97')]=db['sequelize'][_0xc132('0x14')](_0xc132('0x98'));db[_0xc132('0x99')]=db[_0xc132('0x3')]['import']('../api/integration/integration.model');db[_0xc132('0x9a')]=db['sequelize']['import'](_0xc132('0x9b'));db[_0xc132('0x9c')]=db['sequelize'][_0xc132('0x14')](_0xc132('0x9d'));db['AnalyticDefaultReport']=db[_0xc132('0x3')]['import'](_0xc132('0x9e'));db['AnalyticExtractedReport']=db[_0xc132('0x3')][_0xc132('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xc132('0x9f')]=db[_0xc132('0x3')]['import'](_0xc132('0xa0'));db[_0xc132('0xa1')]=db['sequelize'][_0xc132('0x14')](_0xc132('0xa2'));db[_0xc132('0xa3')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xa4'));db[_0xc132('0xa5')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xc132('0xa6')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xa7'));db[_0xc132('0xa8')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/intSalesforceField/intSalesforceField.model');db[_0xc132('0xa9')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xc132('0xaa')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xab'));db[_0xc132('0xac')]=db['sequelize'][_0xc132('0x14')](_0xc132('0xad'));db['DeskConfiguration']=db[_0xc132('0x3')]['import'](_0xc132('0xae'));db[_0xc132('0xaf')]=db['sequelize'][_0xc132('0x14')]('../api/intDeskField/intDeskField.model');db[_0xc132('0xb0')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/intZohoAccount/intZohoAccount.model');db[_0xc132('0xb1')]=db[_0xc132('0x3')]['import'](_0xc132('0xb2'));db[_0xc132('0xb3')]=db[_0xc132('0x3')]['import']('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db['sequelize']['import'](_0xc132('0xb4'));db[_0xc132('0xb5')]=db['sequelize'][_0xc132('0x14')](_0xc132('0xb6'));db[_0xc132('0xb7')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xb8'));db['FreshdeskAccount']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xb9'));db[_0xc132('0xba')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xbb'));db[_0xc132('0xbc')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xc132('0xbd')]=db[_0xc132('0x3')]['import'](_0xc132('0xbe'));db['VtigerConfiguration']=db[_0xc132('0x3')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xc132('0xbf')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db[_0xc132('0x3')]['import'](_0xc132('0xc0'));db[_0xc132('0xc1')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xc2'));db[_0xc132('0xc3')]=db['sequelize']['import'](_0xc132('0xc4'));db['Dynamics365Account']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xc5'));db[_0xc132('0xc6')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xc7'));db[_0xc132('0xc8')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xc9'));db[_0xc132('0xca')]=db['sequelize'][_0xc132('0x14')](_0xc132('0xcb'));db[_0xc132('0xcc')]=db['sequelize']['import'](_0xc132('0xcd'));db[_0xc132('0xce')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xcf'));db['Integration']=db[_0xc132('0x3')][_0xc132('0x14')]('../api/integration/integration.model');db[_0xc132('0xd0')]=db['sequelize'][_0xc132('0x14')](_0xc132('0xd1'));db[_0xc132('0xd2')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xd3'));db[_0xc132('0xd4')]=db[_0xc132('0x3')]['import'](_0xc132('0xd5'));db['JscriptyAnswerReport']=db[_0xc132('0x3')]['import'](_0xc132('0xd6'));db[_0xc132('0xd7')]=db['sequelize'][_0xc132('0x14')](_0xc132('0xd8'));db['JscriptySessionReport']=db['sequelize'][_0xc132('0x14')](_0xc132('0xd9'));db[_0xc132('0xda')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/smsQueueReport/smsQueueReport.model');db[_0xc132('0xdb')]=db['sequelize']['import'](_0xc132('0xdc'));db[_0xc132('0xdd')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xde'));db[_0xc132('0xdf')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xe0'));db[_0xc132('0xe1')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/setting/setting.model');db[_0xc132('0xe2')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xe3'));db[_0xc132('0xe4')]=db[_0xc132('0x3')]['import']('../api/squareProject/squareProject.model');db[_0xc132('0xe5')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xe6'));db[_0xc132('0xe7')]=db['sequelize'][_0xc132('0x14')](_0xc132('0xe8'));db['Team']=db[_0xc132('0x3')]['import'](_0xc132('0xe9'));db[_0xc132('0xea')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xeb'));db[_0xc132('0xec')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xed'));db['Migration']=db[_0xc132('0x3')][_0xc132('0x14')]('../api/migration/migration.model');db[_0xc132('0xee')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xef'));db[_0xc132('0xf0')]=db['sequelize'][_0xc132('0x14')](_0xc132('0xf1'));db['MailTransferReport']=db['sequelize'][_0xc132('0x14')](_0xc132('0xf2'));db[_0xc132('0xf3')]=db['sequelize'][_0xc132('0x14')](_0xc132('0xf4'));db['FaxTransferReport']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xf5'));db[_0xc132('0xf6')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xf7'));db[_0xc132('0xf8')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xf9'));db['CmList']=db[_0xc132('0x3')][_0xc132('0x14')]('../api/cmList/cmList.model');db[_0xc132('0xfa')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/voicePrefix/voicePrefix.model');db[_0xc132('0xfb')]=db[_0xc132('0x3')]['import'](_0xc132('0xfc'));db['UserProfileSection']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xfd'));db[_0xc132('0xfe')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0xc132('0xff')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x100'));db[_0xc132('0x101')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x102'));db[_0xc132('0x103')]=db['sequelize'][_0xc132('0x14')]('../api/whatsappApplication/whatsappApplication.model');db[_0xc132('0x104')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x105'));db[_0xc132('0x106')]=db[_0xc132('0x3')]['import'](_0xc132('0x107'));db[_0xc132('0x108')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xc132('0x109')]=db[_0xc132('0x3')]['import'](_0xc132('0x10a'));db[_0xc132('0x10b')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x10c'));db[_0xc132('0x10d')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x10e'));db[_0xc132('0x10f')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x110'));db[_0xc132('0x111')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x112'));db['UserVoicePrefix']=db[_0xc132('0x3')][_0xc132('0x14')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0xc132('0x113')]=db['sequelize'][_0xc132('0x14')](_0xc132('0x114'));db['User'][_0xc132('0x115')](db[_0xc132('0x1c')],{'as':_0xc132('0x1c'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x117')});db['User'][_0xc132('0x115')](db[_0xc132('0x113')],{'as':_0xc132('0x118'),'onDelete':_0xc132('0x116'),'foreignKey':'UserId'});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x1b')],{'as':_0xc132('0x11a'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x2c')],{'as':_0xc132('0x11b'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x17')],{'as':'Extensions','onDelete':_0xc132('0x116'),'hooks':!![]});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x11c')],{'as':_0xc132('0x11d'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x11e')],{'as':_0xc132('0x11f'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x77')],{'as':'ReportAgentPreview','foreignKey':_0xc132('0x117')});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x5e')],{'as':_0xc132('0x120'),'foreignKey':'UserId'});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x121')],{'as':'ChatInteractions','foreignKey':_0xc132('0x117')});db[_0xc132('0x13')]['hasMany'](db[_0xc132('0x55')],{'as':_0xc132('0x122'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x123')],{'as':_0xc132('0x124'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x3f')],{'as':'MailInteractions','foreignKey':_0xc132('0x117')});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x104')],{'as':_0xc132('0x125'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x13')][_0xc132('0x119')](db['UserNotification'],{'as':_0xc132('0x126'),'foreignKey':_0xc132('0x127')});db[_0xc132('0x13')][_0xc132('0x128')](db[_0xc132('0xfb')],{'as':_0xc132('0xfb'),'foreignKey':_0xc132('0x129')});db[_0xc132('0x13')][_0xc132('0x12a')](db[_0xc132('0x6c')],{'as':_0xc132('0x12b'),'through':'chat_group_has_users'});db[_0xc132('0x13')]['belongsToMany'](db[_0xc132('0x72')],{'as':_0xc132('0x12c'),'through':_0xc132('0x12d')});db['User'][_0xc132('0x12a')](db['CmList'],{'as':_0xc132('0x12e'),'through':'cm_user_has_lists'});db[_0xc132('0x13')][_0xc132('0x12a')](db[_0xc132('0x12f')],{'through':_0xc132('0x130')});db[_0xc132('0x13')][_0xc132('0x12a')](db[_0xc132('0x3f')],{'as':_0xc132('0x131'),'through':_0xc132('0x132')});db[_0xc132('0x13')][_0xc132('0x12a')](db['ChatInteraction'],{'as':_0xc132('0x133'),'through':_0xc132('0x134')});db[_0xc132('0x13')][_0xc132('0x12a')](db[_0xc132('0x123')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0xc132('0x13')]['belongsToMany'](db['SmsInteraction'],{'as':_0xc132('0x122'),'through':_0xc132('0x135')});db['User'][_0xc132('0x12a')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0xc132('0x136')});db[_0xc132('0x13')][_0xc132('0x12a')](db[_0xc132('0x104')],{'as':_0xc132('0x125'),'through':'user_has_whatsapp_interactions'});db[_0xc132('0x13')][_0xc132('0x12a')](db[_0xc132('0x137')],{'as':_0xc132('0x138'),'through':'UserVoiceQueue','required':![]});db[_0xc132('0x13')][_0xc132('0x12a')](db['VoicePrefix'],{'as':_0xc132('0x139'),'through':_0xc132('0x13a'),'required':![]});db[_0xc132('0x13')][_0xc132('0x12a')](db[_0xc132('0x3d')],{'as':'MailQueues','through':'UserMailQueue','required':![]});db[_0xc132('0x13')][_0xc132('0x12a')](db['ChatQueue'],{'as':_0xc132('0x13b'),'through':_0xc132('0x2f'),'required':![],'hooks':!![]});db['User'][_0xc132('0x12a')](db[_0xc132('0x13c')],{'as':_0xc132('0x13d'),'through':'UserFaxQueue','required':![]});db['User'][_0xc132('0x12a')](db[_0xc132('0x58')],{'as':_0xc132('0x13e'),'through':'UserSmsQueue','required':![]});db[_0xc132('0x13')]['belongsToMany'](db[_0xc132('0x13f')],{'as':_0xc132('0x140'),'through':_0xc132('0x141'),'required':![]});db[_0xc132('0x13')][_0xc132('0x12a')](db[_0xc132('0x10b')],{'as':_0xc132('0x142'),'through':_0xc132('0x143'),'required':![]});db[_0xc132('0x13')]['belongsToMany'](db[_0xc132('0x144')],{'through':'cm_user_has_lists'});db[_0xc132('0x13')][_0xc132('0x12a')](db['ChatWebsite'],{'as':_0xc132('0x145'),'through':_0xc132('0x146')});db[_0xc132('0x13')]['belongsToMany'](db['FaxAccount'],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0xc132('0x13')]['belongsToMany'](db[_0xc132('0x3b')],{'as':_0xc132('0x147'),'through':_0xc132('0x148')});db['User']['belongsToMany'](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0xc132('0x149')});db[_0xc132('0x13')][_0xc132('0x12a')](db[_0xc132('0x51')],{'as':'SmsAccounts','through':_0xc132('0x14a')});db['User']['belongsToMany'](db[_0xc132('0x101')],{'as':_0xc132('0x14b'),'through':'user_has_whatsapp_accounts'});db['User'][_0xc132('0x12a')](db['SquareProject'],{'as':_0xc132('0x14c'),'through':_0xc132('0x14d')});db['VoiceChanSpy'][_0xc132('0x119')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0xc132('0x116'),'foreignKey':'ChanSpyId'});db[_0xc132('0x16')][_0xc132('0x119')](db[_0xc132('0x17')],{'onDelete':'cascade'});db['VoiceExtension'][_0xc132('0x119')](db[_0xc132('0x17')],{'as':_0xc132('0x14e'),'onDelete':'cascade'});db[_0xc132('0x18')][_0xc132('0x12a')](db[_0xc132('0x8b')],{'as':_0xc132('0x14f'),'through':_0xc132('0x150')});db[_0xc132('0x137')][_0xc132('0x119')](db[_0xc132('0x2c')],{'as':_0xc132('0x151'),'foreignKey':'VoiceQueueId'});db[_0xc132('0x137')][_0xc132('0x119')](db[_0xc132('0x74')],{'as':_0xc132('0x152'),'foreignKey':_0xc132('0x153')});db[_0xc132('0x137')][_0xc132('0x119')](db['CmHopperFinal'],{'as':_0xc132('0x11d'),'foreignKey':_0xc132('0x153')});db[_0xc132('0x137')][_0xc132('0x119')](db[_0xc132('0x11e')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db[_0xc132('0x137')][_0xc132('0x119')](db['ReportAgentPreview'],{'as':_0xc132('0x77'),'foreignKey':_0xc132('0x153')});db['VoiceQueue'][_0xc132('0x119')](db[_0xc132('0x154')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0xc132('0x137')][_0xc132('0x119')](db[_0xc132('0x155')],{'as':_0xc132('0x156'),'foreignKey':_0xc132('0x153')});db[_0xc132('0x137')][_0xc132('0x128')](db[_0xc132('0x29')],{'as':_0xc132('0x29'),'foreignKey':_0xc132('0x157')});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':_0xc132('0x158'),'foreignKey':_0xc132('0x159')});db[_0xc132('0x137')][_0xc132('0x128')](db[_0xc132('0x83')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xc132('0x137')][_0xc132('0x128')](db[_0xc132('0x85')],{'as':_0xc132('0x15a'),'foreignKey':_0xc132('0x15b')});db[_0xc132('0x137')][_0xc132('0x12a')](db[_0xc132('0x144')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':'Agents','through':_0xc132('0x15c')});db['VoiceQueue'][_0xc132('0x12a')](db[_0xc132('0x12f')],{'as':_0xc132('0x15d'),'through':_0xc132('0x10f')});db['VoiceQueue'][_0xc132('0x12a')](db[_0xc132('0x144')],{'as':_0xc132('0x15e'),'through':_0xc132('0x15f')});db[_0xc132('0x1b')][_0xc132('0x128')](db[_0xc132('0x13')],{'as':_0xc132('0x13'),'foreignKey':'UserId'});db['ScreenRecording'][_0xc132('0x128')](db[_0xc132('0x13')],{'as':_0xc132('0x13'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x1c')][_0xc132('0x119')](db[_0xc132('0x1e')],{'as':_0xc132('0x160'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x161'),'sourceKey':'mailbox'});db[_0xc132('0x1e')][_0xc132('0x128')](db[_0xc132('0x1c')],{'foreignKey':'mailboxuser','targetKey':'mailbox'});db[_0xc132('0x20')]['hasMany'](db[_0xc132('0x26')],{'as':_0xc132('0x162'),'foreignKey':_0xc132('0x163'),'constraints':![]});db[_0xc132('0x20')][_0xc132('0x119')](db[_0xc132('0x24')],{'as':_0xc132('0x164'),'foreignKey':'uniqueid','constraints':![]});db[_0xc132('0x20')][_0xc132('0x128')](db[_0xc132('0x13')],{'as':_0xc132('0x13'),'foreignKey':'UserId'});db[_0xc132('0x20')][_0xc132('0x128')](db[_0xc132('0x72')],{'as':_0xc132('0x165'),'foreignKey':_0xc132('0x166')});db[_0xc132('0x37')][_0xc132('0x128')](db[_0xc132('0x3b')],{'as':_0xc132('0x3b'),'foreignKey':_0xc132('0x167')});db[_0xc132('0x37')][_0xc132('0x128')](db[_0xc132('0x10d')],{'as':_0xc132('0x10d'),'foreignKey':_0xc132('0x168'),'onDelete':_0xc132('0x169')});db[_0xc132('0x39')][_0xc132('0x128')](db[_0xc132('0x3b')],{'as':_0xc132('0x3b'),'foreignKey':_0xc132('0x167')});db[_0xc132('0x39')][_0xc132('0x128')](db['CloudProvider'],{'as':_0xc132('0x10d'),'foreignKey':_0xc132('0x168'),'onDelete':_0xc132('0x169')});db[_0xc132('0x3b')][_0xc132('0x115')](db[_0xc132('0x37')],{'as':'Imap','onDelete':_0xc132('0x116')});db[_0xc132('0x3b')]['hasOne'](db[_0xc132('0x39')],{'as':'Smtp','onDelete':_0xc132('0x116')});db[_0xc132('0x3b')]['hasMany'](db['Disposition'],{'as':_0xc132('0x16a'),'foreignKey':'MailAccountId','onDelete':_0xc132('0x116')});db[_0xc132('0x3b')][_0xc132('0x119')](db[_0xc132('0x7e')],{'as':_0xc132('0x16b'),'foreignKey':_0xc132('0x167')});db[_0xc132('0x3b')]['hasMany'](db[_0xc132('0x41')],{'as':_0xc132('0x160'),'foreignKey':_0xc132('0x167')});db[_0xc132('0x3b')][_0xc132('0x119')](db[_0xc132('0x3f')],{'as':'Interactions'});db[_0xc132('0x3b')][_0xc132('0x119')](db[_0xc132('0x43')],{'as':'Applications'});db[_0xc132('0x3b')][_0xc132('0x128')](db[_0xc132('0x144')],{'as':'List','foreignKey':_0xc132('0x16c')});db['MailAccount'][_0xc132('0x128')](db[_0xc132('0x94')],{'as':_0xc132('0x94'),'foreignKey':_0xc132('0x16d')});db[_0xc132('0x3b')][_0xc132('0x128')](db[_0xc132('0x85')],{'as':_0xc132('0x15a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xc132('0x3b')][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':'Agents','through':_0xc132('0x148')});db[_0xc132('0x3d')]['belongsToMany'](db[_0xc132('0x13')],{'as':_0xc132('0x16e'),'through':'UserMailQueue'});db['MailQueue']['belongsToMany'](db[_0xc132('0x12f')],{'through':_0xc132('0x16f'),'as':'Teams'});db[_0xc132('0x3f')][_0xc132('0x119')](db[_0xc132('0x41')],{'as':'Messages','onDelete':_0xc132('0x116'),'foreignKey':'MailInteractionId'});db[_0xc132('0x3f')][_0xc132('0x128')](db[_0xc132('0x3b')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x167')});db[_0xc132('0x3f')]['belongsTo'](db['CmContact'],{'as':_0xc132('0x165'),'foreignKey':_0xc132('0x166')});db['MailInteraction']['belongsTo'](db[_0xc132('0x13')],{'as':_0xc132('0x171'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x3f')][_0xc132('0x12a')](db[_0xc132('0x8d')],{'through':_0xc132('0x172'),'as':_0xc132('0x173')});db['MailInteraction']['belongsToMany'](db['Tag'],{'through':_0xc132('0x172'),'as':_0xc132('0x174')});db['MailInteraction'][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':_0xc132('0x175'),'through':_0xc132('0x132'),'foreignKey':_0xc132('0x176')});db[_0xc132('0x41')][_0xc132('0x119')](db['Attachment'],{'as':'Attachments','onDelete':'cascade'});db['MailMessage']['belongsTo'](db[_0xc132('0x13')],{'as':'User'});db[_0xc132('0x41')][_0xc132('0x128')](db[_0xc132('0x72')],{'onDelete':_0xc132('0x116'),'as':'Contact'});db[_0xc132('0x41')][_0xc132('0x128')](db[_0xc132('0x3f')],{'as':_0xc132('0x177'),'foreignKey':_0xc132('0x176')});db[_0xc132('0x41')]['belongsTo'](db['MailAccount'],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x167')});db[_0xc132('0x41')][_0xc132('0x128')](db[_0xc132('0x61')],{'as':_0xc132('0x61'),'foreignKey':'ChatWebsiteId'});db[_0xc132('0x41')][_0xc132('0x128')](db[_0xc132('0x178')],{'as':_0xc132('0x178'),'foreignKey':'ChatOfflineMessageId'});db['MailApplication']['belongsTo'](db[_0xc132('0x13')],{'onDelete':_0xc132('0x169')});db[_0xc132('0x43')]['belongsTo'](db[_0xc132('0x3d')],{'onDelete':'restrict'});db['MailApplication'][_0xc132('0x128')](db[_0xc132('0x3b')],{'onDelete':_0xc132('0x169')});db[_0xc132('0x43')]['belongsTo'](db['Interval'],{'onDelete':_0xc132('0x169'),'foreignKey':'IntervalId'});db[_0xc132('0x43')][_0xc132('0x128')](db[_0xc132('0x8d')],{'onDelete':_0xc132('0x169'),'foreignKey':_0xc132('0x179')});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0xc132('0x45')][_0xc132('0x128')](db[_0xc132('0x144')],{'as':_0xc132('0x17a'),'foreignKey':_0xc132('0x16c')});db[_0xc132('0x45')][_0xc132('0x128')](db[_0xc132('0x72')],{'as':_0xc132('0x165'),'foreignKey':_0xc132('0x166')});db[_0xc132('0x45')][_0xc132('0x128')](db[_0xc132('0x3f')],{});db[_0xc132('0x45')]['belongsTo'](db[_0xc132('0x41')],{});db[_0xc132('0x45')][_0xc132('0x128')](db['User'],{});db['MailQueueReport'][_0xc132('0x128')](db[_0xc132('0x3d')],{});db[_0xc132('0x17b')][_0xc132('0x119')](db[_0xc132('0x48')],{'as':_0xc132('0x17c'),'onDelete':_0xc132('0x116')});db[_0xc132('0x4a')][_0xc132('0x119')](db['Disposition'],{'as':_0xc132('0x16a'),'foreignKey':_0xc132('0x17d'),'onDelete':'cascade'});db[_0xc132('0x4a')][_0xc132('0x119')](db[_0xc132('0x7e')],{'as':_0xc132('0x16b'),'foreignKey':_0xc132('0x17d')});db[_0xc132('0x4a')][_0xc132('0x119')](db[_0xc132('0x123')],{'as':_0xc132('0x17e')});db[_0xc132('0x4a')][_0xc132('0x119')](db[_0xc132('0x4c')],{'as':'Applications'});db[_0xc132('0x4a')]['hasMany'](db[_0xc132('0x17')],{'as':_0xc132('0x17f'),'onDelete':_0xc132('0x116')});db[_0xc132('0x4a')][_0xc132('0x119')](db[_0xc132('0x4e')],{'as':_0xc132('0x160')});db[_0xc132('0x4a')]['belongsTo'](db[_0xc132('0x29')],{'as':'Trunk'});db[_0xc132('0x4a')][_0xc132('0x128')](db[_0xc132('0x144')],{'as':'List','foreignKey':_0xc132('0x16c')});db[_0xc132('0x4a')][_0xc132('0x128')](db[_0xc132('0x85')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xc132('0x4a')][_0xc132('0x12a')](db['User'],{'as':_0xc132('0x16e'),'through':_0xc132('0x180')});db['FaxApplication']['belongsTo'](db[_0xc132('0x13')],{'onDelete':_0xc132('0x169')});db['FaxApplication']['belongsTo'](db[_0xc132('0x13c')],{'onDelete':_0xc132('0x169')});db[_0xc132('0x4c')]['belongsTo'](db[_0xc132('0x4a')],{'onDelete':_0xc132('0x169')});db[_0xc132('0x4c')][_0xc132('0x128')](db[_0xc132('0x8d')],{'onDelete':_0xc132('0x169'),'foreignKey':_0xc132('0x179')});db[_0xc132('0x123')][_0xc132('0x119')](db[_0xc132('0x4e')],{'as':'Messages','onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x181')});db[_0xc132('0x123')]['belongsTo'](db[_0xc132('0x4a')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x17d')});db['FaxInteraction'][_0xc132('0x128')](db[_0xc132('0x72')],{'as':_0xc132('0x165'),'foreignKey':'ContactId'});db[_0xc132('0x123')][_0xc132('0x128')](db[_0xc132('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0xc132('0x123')][_0xc132('0x12a')](db[_0xc132('0x8d')],{'through':_0xc132('0x182'),'as':_0xc132('0x173')});db[_0xc132('0x123')][_0xc132('0x12a')](db['Tag'],{'through':_0xc132('0x182'),'as':_0xc132('0x174')});db[_0xc132('0x123')][_0xc132('0x12a')](db['User'],{'as':'Users','through':_0xc132('0x183'),'foreignKey':_0xc132('0x181')});db[_0xc132('0x4e')][_0xc132('0x128')](db['User'],{'onDelete':_0xc132('0x116'),'as':_0xc132('0x13')});db[_0xc132('0x4e')][_0xc132('0x128')](db['FaxInteraction'],{'as':'Interaction','foreignKey':_0xc132('0x181')});db['FaxMessage'][_0xc132('0x128')](db[_0xc132('0x72')],{'onDelete':'cascade','as':'Contact'});db[_0xc132('0x4e')][_0xc132('0x128')](db['Attachment'],{'as':_0xc132('0xee'),'foreignKey':_0xc132('0x184')});db['FaxMessage'][_0xc132('0x128')](db[_0xc132('0x4a')],{'as':'Account','foreignKey':_0xc132('0x17d')});db[_0xc132('0x13c')][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':_0xc132('0x16e'),'through':_0xc132('0x185')});db[_0xc132('0x13c')][_0xc132('0x12a')](db[_0xc132('0x12f')],{'through':'team_has_fax_queues','as':_0xc132('0x15d')});db['FaxQueueReport'][_0xc132('0x128')](db[_0xc132('0x4a')],{});db[_0xc132('0x4f')][_0xc132('0x128')](db[_0xc132('0x144')],{'as':_0xc132('0x17a'),'foreignKey':'ListId'});db[_0xc132('0x4f')]['belongsTo'](db[_0xc132('0x72')],{'as':'Contact','foreignKey':_0xc132('0x166')});db[_0xc132('0x4f')][_0xc132('0x128')](db[_0xc132('0x123')],{});db[_0xc132('0x4f')][_0xc132('0x128')](db[_0xc132('0x4e')],{});db[_0xc132('0x4f')]['belongsTo'](db[_0xc132('0x13')],{});db[_0xc132('0x4f')][_0xc132('0x128')](db[_0xc132('0x13c')],{});db[_0xc132('0x51')][_0xc132('0x119')](db[_0xc132('0x80')],{'as':_0xc132('0x16a'),'foreignKey':_0xc132('0x186'),'onDelete':_0xc132('0x116')});db['SmsAccount'][_0xc132('0x119')](db[_0xc132('0x7e')],{'as':'Answers','foreignKey':_0xc132('0x186')});db[_0xc132('0x51')][_0xc132('0x119')](db[_0xc132('0x57')],{'as':_0xc132('0x160'),'foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db[_0xc132('0x55')],{'as':_0xc132('0x17e')});db[_0xc132('0x51')][_0xc132('0x119')](db[_0xc132('0x53')],{'as':_0xc132('0x14e')});db['SmsAccount'][_0xc132('0x128')](db[_0xc132('0x144')],{'as':_0xc132('0x17a'),'foreignKey':_0xc132('0x16c')});db[_0xc132('0x51')][_0xc132('0x128')](db[_0xc132('0x85')],{'as':'mandatoryDispositionPause','foreignKey':_0xc132('0x15b')});db[_0xc132('0x51')]['belongsToMany'](db[_0xc132('0x13')],{'as':_0xc132('0x16e'),'through':_0xc132('0x14a')});db[_0xc132('0x53')]['belongsTo'](db[_0xc132('0x13')],{'onDelete':'restrict'});db[_0xc132('0x53')][_0xc132('0x128')](db[_0xc132('0x58')],{'onDelete':_0xc132('0x169')});db['SmsApplication'][_0xc132('0x128')](db[_0xc132('0x51')],{'onDelete':'restrict'});db[_0xc132('0x53')][_0xc132('0x128')](db[_0xc132('0x83')],{'onDelete':_0xc132('0x169'),'foreignKey':'IntervalId'});db[_0xc132('0x53')][_0xc132('0x128')](db[_0xc132('0x8d')],{'onDelete':_0xc132('0x169'),'foreignKey':'TagId'});db[_0xc132('0x55')][_0xc132('0x119')](db['SmsMessage'],{'as':_0xc132('0x160'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x187')});db['SmsInteraction'][_0xc132('0x128')](db[_0xc132('0x51')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x186')});db[_0xc132('0x55')]['belongsTo'](db[_0xc132('0x72')],{'as':_0xc132('0x165'),'foreignKey':'ContactId'});db['SmsInteraction'][_0xc132('0x128')](db[_0xc132('0x13')],{'as':_0xc132('0x171'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x55')]['belongsToMany'](db[_0xc132('0x8d')],{'through':_0xc132('0x188'),'as':_0xc132('0x173')});db[_0xc132('0x55')][_0xc132('0x12a')](db['Tag'],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db[_0xc132('0x55')][_0xc132('0x12a')](db['User'],{'as':_0xc132('0x175'),'through':_0xc132('0x135'),'foreignKey':_0xc132('0x187')});db[_0xc132('0x57')]['belongsTo'](db['User'],{'as':'User'});db['SmsMessage'][_0xc132('0x128')](db['CmContact'],{'onDelete':_0xc132('0x116'),'as':_0xc132('0x165')});db[_0xc132('0x57')][_0xc132('0x128')](db[_0xc132('0x55')],{'onDelete':'cascade','as':_0xc132('0x177'),'foreignKey':_0xc132('0x187')});db[_0xc132('0x57')][_0xc132('0x128')](db['SmsAccount'],{'as':_0xc132('0x170'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':_0xc132('0x16e'),'through':_0xc132('0x33'),'foreignKey':_0xc132('0x189')});db[_0xc132('0x58')][_0xc132('0x12a')](db[_0xc132('0x12f')],{'through':_0xc132('0x18a'),'as':_0xc132('0x15d')});db[_0xc132('0x5a')]['hasMany'](db[_0xc132('0x80')],{'as':_0xc132('0x16a'),'foreignKey':_0xc132('0x18b'),'onDelete':'cascade'});db[_0xc132('0x5a')][_0xc132('0x119')](db[_0xc132('0x7e')],{'as':_0xc132('0x16b'),'foreignKey':_0xc132('0x18b')});db[_0xc132('0x5a')][_0xc132('0x119')](db[_0xc132('0x5e')],{'as':_0xc132('0x17e'),'foreignKey':_0xc132('0x18b')});db[_0xc132('0x5a')][_0xc132('0x119')](db[_0xc132('0x5f')],{'as':'Messages','foreignKey':_0xc132('0x18b')});db[_0xc132('0x5a')][_0xc132('0x119')](db[_0xc132('0x5c')],{'as':_0xc132('0x14e'),'foreignKey':'OpenchannelAccountId'});db[_0xc132('0x5a')][_0xc132('0x128')](db[_0xc132('0x144')],{'as':_0xc132('0x17a'),'foreignKey':_0xc132('0x16c')});db['OpenchannelAccount'][_0xc132('0x128')](db[_0xc132('0x85')],{'as':'mandatoryDispositionPause','foreignKey':_0xc132('0x15b')});db[_0xc132('0x5a')][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':'Agents','through':_0xc132('0x149')});db['OpenchannelApplication'][_0xc132('0x128')](db[_0xc132('0x13')],{'onDelete':'restrict'});db[_0xc132('0x5c')]['belongsTo'](db[_0xc132('0x13f')],{'onDelete':_0xc132('0x169'),'foreignKey':_0xc132('0x18c')});db[_0xc132('0x5c')][_0xc132('0x128')](db[_0xc132('0x5a')],{'onDelete':_0xc132('0x169'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0xc132('0x128')](db[_0xc132('0x83')],{'onDelete':_0xc132('0x169'),'foreignKey':_0xc132('0x18d')});db[_0xc132('0x5c')][_0xc132('0x128')](db[_0xc132('0x8d')],{'onDelete':_0xc132('0x169'),'foreignKey':_0xc132('0x179')});db[_0xc132('0x5e')][_0xc132('0x119')](db[_0xc132('0x5f')],{'as':_0xc132('0x160'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x18e')});db[_0xc132('0x5e')]['belongsTo'](db[_0xc132('0x5a')],{'as':'Account','foreignKey':_0xc132('0x18b')});db[_0xc132('0x5e')]['belongsTo'](db[_0xc132('0x72')],{'as':_0xc132('0x165'),'foreignKey':_0xc132('0x166')});db['OpenchannelInteraction'][_0xc132('0x128')](db['User'],{'as':_0xc132('0x171'),'foreignKey':_0xc132('0x117')});db['OpenchannelInteraction'][_0xc132('0x12a')](db[_0xc132('0x8d')],{'through':_0xc132('0x18f'),'as':_0xc132('0x173')});db[_0xc132('0x5e')][_0xc132('0x12a')](db['Tag'],{'through':_0xc132('0x18f'),'as':'ThroughTags'});db[_0xc132('0x5e')][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':_0xc132('0x175'),'through':_0xc132('0x136'),'foreignKey':_0xc132('0x18e')});db[_0xc132('0x5f')]['belongsTo'](db['User'],{'onDelete':_0xc132('0x116'),'as':_0xc132('0x13')});db[_0xc132('0x5f')][_0xc132('0x128')](db[_0xc132('0x72')],{'onDelete':_0xc132('0x116'),'as':_0xc132('0x165')});db[_0xc132('0x5f')][_0xc132('0x128')](db[_0xc132('0x5e')],{'onDelete':_0xc132('0x116'),'as':_0xc132('0x177'),'foreignKey':'OpenchannelInteractionId'});db[_0xc132('0x5f')]['belongsTo'](db[_0xc132('0xee')],{'as':_0xc132('0xee'),'foreignKey':_0xc132('0x184')});db[_0xc132('0x5f')][_0xc132('0x128')](db[_0xc132('0x5a')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x18b')});db['OpenchannelQueue'][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':_0xc132('0x16e'),'through':_0xc132('0x141'),'foreignKey':_0xc132('0x18c')});db[_0xc132('0x13f')]['belongsToMany'](db[_0xc132('0x12f')],{'through':_0xc132('0x190'),'as':_0xc132('0x15d')});db[_0xc132('0x61')]['hasMany'](db[_0xc132('0x80')],{'as':_0xc132('0x16a'),'foreignKey':_0xc132('0x191'),'onDelete':_0xc132('0x116')});db[_0xc132('0x61')]['hasMany'](db['CannedAnswer'],{'as':_0xc132('0x16b'),'foreignKey':_0xc132('0x191')});db[_0xc132('0x61')][_0xc132('0x119')](db['ChatProactiveAction'],{'as':_0xc132('0x192')});db[_0xc132('0x61')][_0xc132('0x119')](db[_0xc132('0x121')],{'as':_0xc132('0x17e')});db[_0xc132('0x61')]['hasMany'](db['ChatApplication'],{'as':'Applications'});db[_0xc132('0x61')]['hasMany'](db[_0xc132('0x67')],{'as':_0xc132('0x160')});db[_0xc132('0x61')][_0xc132('0x128')](db[_0xc132('0x144')],{'as':_0xc132('0x17a'),'foreignKey':'ListId'});db[_0xc132('0x61')][_0xc132('0x128')](db[_0xc132('0x83')],{'as':_0xc132('0x83'),'foreignKey':'IntervalId'});db[_0xc132('0x61')][_0xc132('0x128')](db[_0xc132('0x3b')],{'as':_0xc132('0x3b'),'foreignKey':_0xc132('0x167')});db[_0xc132('0x61')]['belongsTo'](db[_0xc132('0x85')],{'as':_0xc132('0x15a'),'foreignKey':_0xc132('0x15b')});db['ChatWebsite']['belongsToMany'](db[_0xc132('0x13')],{'as':'Agents','through':_0xc132('0x146')});db['OpenchannelQueueReport']['belongsTo'](db[_0xc132('0x5a')],{});db[_0xc132('0x63')][_0xc132('0x128')](db['CmList'],{'as':_0xc132('0x17a'),'foreignKey':_0xc132('0x16c')});db[_0xc132('0x63')][_0xc132('0x128')](db['CmContact'],{'as':_0xc132('0x165'),'foreignKey':_0xc132('0x166')});db[_0xc132('0x63')][_0xc132('0x128')](db[_0xc132('0x5e')],{});db[_0xc132('0x63')][_0xc132('0x128')](db[_0xc132('0x5f')],{});db[_0xc132('0x63')]['belongsTo'](db[_0xc132('0x13')],{});db[_0xc132('0x63')]['belongsTo'](db[_0xc132('0x13f')],{});db[_0xc132('0x193')][_0xc132('0x128')](db['User'],{'as':_0xc132('0x194'),'foreignKey':_0xc132('0x117'),'onDelete':_0xc132('0x169')});db[_0xc132('0x193')]['belongsTo'](db[_0xc132('0x6a')],{'as':_0xc132('0x195'),'foreignKey':'ChatQueueId','onDelete':_0xc132('0x169')});db['ChatApplication'][_0xc132('0x128')](db[_0xc132('0x61')],{'as':_0xc132('0x196'),'foreignKey':'ChatWebsiteId','onDelete':_0xc132('0x169')});db[_0xc132('0x193')][_0xc132('0x128')](db['Tag'],{'onDelete':_0xc132('0x169'),'foreignKey':_0xc132('0x179')});db[_0xc132('0x121')][_0xc132('0x119')](db[_0xc132('0x67')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xc132('0x197')});db[_0xc132('0x121')]['belongsTo'](db[_0xc132('0x61')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x191')});db[_0xc132('0x121')][_0xc132('0x128')](db[_0xc132('0x72')],{'as':_0xc132('0x165'),'foreignKey':'ContactId'});db[_0xc132('0x121')][_0xc132('0x128')](db[_0xc132('0x13')],{'as':_0xc132('0x171'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x121')][_0xc132('0x12a')](db[_0xc132('0x8d')],{'through':_0xc132('0x198'),'as':_0xc132('0x173')});db[_0xc132('0x121')]['belongsToMany'](db[_0xc132('0x8d')],{'through':'chat_interaction_has_tags','as':'ThroughTags'});db[_0xc132('0x121')][_0xc132('0x12a')](db['User'],{'as':_0xc132('0x175'),'through':_0xc132('0x134'),'foreignKey':_0xc132('0x197')});db[_0xc132('0x67')][_0xc132('0x128')](db['User'],{'onDelete':'cascade','as':_0xc132('0x13')});db['ChatMessage'][_0xc132('0x128')](db[_0xc132('0x72')],{'onDelete':_0xc132('0x116'),'as':'Contact','foreignKey':_0xc132('0x166')});db['ChatMessage'][_0xc132('0x128')](db['ChatInteraction'],{'onDelete':_0xc132('0x116'),'as':_0xc132('0x177'),'foreignKey':_0xc132('0x197')});db['ChatMessage'][_0xc132('0x128')](db[_0xc132('0xee')],{'as':_0xc132('0xee'),'foreignKey':'AttachmentId'});db[_0xc132('0x67')]['belongsTo'](db['ChatWebsite'],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x191')});db[_0xc132('0x178')]['hasMany'](db[_0xc132('0xee')],{'as':'Attachments','foreignKey':_0xc132('0x199'),'onDelete':'cascade','hooks':!![]});db[_0xc132('0x178')][_0xc132('0x128')](db[_0xc132('0x72')],{'onDelete':_0xc132('0x116'),'as':_0xc132('0x165'),'foreignKey':_0xc132('0x166')});db['ChatOfflineMessage'][_0xc132('0x128')](db[_0xc132('0x61')],{'as':_0xc132('0x170'),'foreignKey':'ChatWebsiteId'});db[_0xc132('0x6a')][_0xc132('0x12a')](db['User'],{'as':_0xc132('0x16e'),'through':_0xc132('0x2f'),'hooks':!![]});db[_0xc132('0x6a')][_0xc132('0x12a')](db[_0xc132('0x12f')],{'through':_0xc132('0x19a'),'as':'Teams'});db[_0xc132('0x6c')][_0xc132('0x119')](db['ChatInternalMessage'],{'as':_0xc132('0x160'),'foreignKey':_0xc132('0x19b'),'onDelete':'cascade'});db[_0xc132('0x6c')]['belongsToMany'](db[_0xc132('0x13')],{'as':_0xc132('0x151'),'through':_0xc132('0x19c')});db['ChatProactiveAction'][_0xc132('0x128')](db[_0xc132('0x61')],{'as':'Website','foreignKey':_0xc132('0x191')});db[_0xc132('0x70')][_0xc132('0x119')](db['CmContact'],{'as':_0xc132('0x12c'),'foreignKey':'CompanyId'});db[_0xc132('0x72')]['hasMany'](db[_0xc132('0x90')],{'as':_0xc132('0x19d'),'foreignKey':_0xc132('0x19e')});db[_0xc132('0x72')][_0xc132('0x119')](db[_0xc132('0x74')],{'as':'Hoppers','foreignKey':_0xc132('0x166')});db['CmContact'][_0xc132('0x119')](db[_0xc132('0x11c')],{'as':'HopperFinals','foreignKey':_0xc132('0x166')});db[_0xc132('0x72')][_0xc132('0x119')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0xc132('0x166')});db[_0xc132('0x72')]['hasMany'](db['ReportAgentPreview'],{'as':_0xc132('0x77'),'foreignKey':_0xc132('0x166')});db['CmContact'][_0xc132('0x119')](db['JscriptySessionReport'],{'as':_0xc132('0x156'),'foreignKey':_0xc132('0x166')});db[_0xc132('0x72')][_0xc132('0x119')](db[_0xc132('0x5e')],{'as':_0xc132('0x120'),'foreignKey':'ContactId','onDelete':_0xc132('0x169')});db[_0xc132('0x72')][_0xc132('0x119')](db[_0xc132('0x121')],{'as':_0xc132('0x133'),'foreignKey':_0xc132('0x166'),'onDelete':'restrict'});db[_0xc132('0x72')][_0xc132('0x119')](db[_0xc132('0x55')],{'as':_0xc132('0x122'),'foreignKey':_0xc132('0x166'),'onDelete':'restrict'});db[_0xc132('0x72')][_0xc132('0x119')](db[_0xc132('0x123')],{'as':_0xc132('0x124'),'foreignKey':_0xc132('0x166'),'onDelete':_0xc132('0x169')});db[_0xc132('0x72')][_0xc132('0x119')](db[_0xc132('0x3f')],{'as':_0xc132('0x131'),'foreignKey':_0xc132('0x166'),'onDelete':_0xc132('0x169')});db['CmContact'][_0xc132('0x128')](db[_0xc132('0x70')],{'as':_0xc132('0x19f'),'foreignKey':'CompanyId'});db['CmContact'][_0xc132('0x128')](db[_0xc132('0x144')],{'as':'List','foreignKey':'ListId','onDelete':_0xc132('0x116')});db[_0xc132('0x72')][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':_0xc132('0x175'),'through':'cm_user_has_contacts'});db[_0xc132('0x72')][_0xc132('0x12a')](db[_0xc132('0x8d')],{'as':'Tags','through':_0xc132('0x1a0')});db[_0xc132('0x72')]['belongsToMany'](db[_0xc132('0x8d')],{'through':_0xc132('0x1a0'),'as':_0xc132('0x174')});db[_0xc132('0x74')][_0xc132('0x119')](db['CmHopperAdditionalPhone'],{'as':_0xc132('0x1a1'),'foreignKey':_0xc132('0x1a2')});db[_0xc132('0x74')][_0xc132('0x128')](db['CmContact'],{'as':_0xc132('0x165'),'foreignKey':'ContactId','onDelete':'cascade'});db['CmHopper'][_0xc132('0x128')](db[_0xc132('0x144')],{'as':_0xc132('0x17a'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xc132('0x74')][_0xc132('0x128')](db[_0xc132('0x13')],{'as':_0xc132('0x194'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x74')]['belongsTo'](db[_0xc132('0x137')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0xc132('0x116')});db[_0xc132('0x74')]['belongsTo'](db['Campaign'],{'as':_0xc132('0xec'),'foreignKey':_0xc132('0x1a3'),'onDelete':_0xc132('0x116')});db[_0xc132('0x74')][_0xc132('0x128')](db['User'],{'as':_0xc132('0x171'),'foreignKey':_0xc132('0x1a4')});db[_0xc132('0x154')][_0xc132('0x128')](db[_0xc132('0x72')],{'as':_0xc132('0x165'),'foreignKey':_0xc132('0x166'),'onDelete':'cascade'});db[_0xc132('0x154')]['belongsTo'](db['CmList'],{'as':_0xc132('0x17a'),'foreignKey':_0xc132('0x16c'),'onDelete':_0xc132('0x116')});db['CmHopperBlack'][_0xc132('0x128')](db[_0xc132('0x137')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0xc132('0x116')});db[_0xc132('0x154')][_0xc132('0x128')](db['Campaign'],{'as':'Campaign','foreignKey':_0xc132('0x1a3'),'onDelete':_0xc132('0x116')});db[_0xc132('0x7c')]['hasMany'](db[_0xc132('0x82')],{'as':{'plural':_0xc132('0x1a5'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0xc132('0x116'),'hooks':!![]});db[_0xc132('0x7c')][_0xc132('0x119')](db['Condition'],{'as':{'plural':_0xc132('0x1a6'),'singular':'OneAny'},'foreignKey':_0xc132('0x1a7'),'onDelete':_0xc132('0x116'),'hooks':!![]});db['Automation'][_0xc132('0x119')](db[_0xc132('0x1a8')],{'as':_0xc132('0x1a9'),'foreignKey':'AutomationId','onDelete':_0xc132('0x116'),'hooks':!![]});db['Disposition'][_0xc132('0x119')](db[_0xc132('0x80')],{'as':_0xc132('0x16a'),'foreignKey':_0xc132('0x1aa'),'onDelete':'cascade'});db[_0xc132('0x83')][_0xc132('0x119')](db['Interval'],{'as':_0xc132('0x1ab'),'foreignKey':'IntervalId','onDelete':_0xc132('0x116'),'hooks':!![],'required':![]});db[_0xc132('0x83')][_0xc132('0x119')](db[_0xc132('0x17')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0xc132('0x169')});db[_0xc132('0x83')]['hasMany'](db[_0xc132('0x43')],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0xc132('0x83')][_0xc132('0x119')](db[_0xc132('0x193')],{'as':_0xc132('0x1ac'),'foreignKey':_0xc132('0x18d')});db['Interval'][_0xc132('0x119')](db[_0xc132('0x4c')],{'as':_0xc132('0x1ad'),'foreignKey':'IntervalId'});db[_0xc132('0x83')]['hasMany'](db[_0xc132('0x53')],{'as':_0xc132('0x1ae'),'foreignKey':_0xc132('0x18d')});db[_0xc132('0x89')]['belongsTo'](db[_0xc132('0x3b')],{});db[_0xc132('0x89')][_0xc132('0x128')](db[_0xc132('0x1af')],{'foreignKey':'DefaultReportId'});db[_0xc132('0x89')][_0xc132('0x128')](db['AnalyticCustomReport'],{'foreignKey':_0xc132('0x1b0')});db['Sound']['belongsToMany'](db[_0xc132('0x18')],{'as':_0xc132('0x1b1'),'through':_0xc132('0x150'),'onDelete':_0xc132('0x169')});db[_0xc132('0x8d')][_0xc132('0x12a')](db[_0xc132('0x72')],{'through':_0xc132('0x1a0')});db[_0xc132('0x8d')][_0xc132('0x12a')](db[_0xc132('0x121')],{'through':_0xc132('0x198')});db[_0xc132('0x8d')][_0xc132('0x12a')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0xc132('0x8d')][_0xc132('0x12a')](db['SmsInteraction'],{'through':_0xc132('0x188')});db[_0xc132('0x8d')][_0xc132('0x12a')](db['FaxInteraction'],{'through':_0xc132('0x182')});db[_0xc132('0x8d')][_0xc132('0x12a')](db[_0xc132('0x5e')],{'through':_0xc132('0x18f')});db[_0xc132('0x8d')][_0xc132('0x12a')](db[_0xc132('0x104')],{'through':'whatsapp_interaction_has_tags'});db[_0xc132('0x90')]['belongsTo'](db[_0xc132('0x8f')],{'as':_0xc132('0x1b2'),'foreignKey':'ItemTypeId'});db[_0xc132('0x92')][_0xc132('0x128')](db[_0xc132('0x74')],{'as':'Hopper','foreignKey':'CmHopperId'});db[_0xc132('0x90')][_0xc132('0x128')](db['CmContact'],{'as':_0xc132('0x165'),'foreignKey':'CmContactId'});db[_0xc132('0x1b3')][_0xc132('0x119')](db[_0xc132('0x82')],{'as':{'plural':_0xc132('0x1b4'),'singular':_0xc132('0x1b5')},'foreignKey':_0xc132('0x1b6'),'onDelete':_0xc132('0x116'),'hooks':!![]});db[_0xc132('0x1b3')][_0xc132('0x119')](db[_0xc132('0x82')],{'as':{'plural':_0xc132('0x1b7'),'singular':'AnyCondition'},'foreignKey':_0xc132('0x1b8'),'onDelete':_0xc132('0x116'),'hooks':!![]});db[_0xc132('0x1b3')][_0xc132('0x119')](db[_0xc132('0x1a8')],{'as':_0xc132('0x1a9'),'foreignKey':'TriggerId','onDelete':_0xc132('0x116'),'hooks':!![]});db[_0xc132('0x9c')][_0xc132('0x119')](db['AnalyticFieldReport'],{'as':_0xc132('0x1b9'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1b0'),'hooks':!![]});db[_0xc132('0x1af')][_0xc132('0x119')](db['AnalyticFieldReport'],{'as':_0xc132('0x1b9'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1ba')});db[_0xc132('0x9f')]['hasMany'](db[_0xc132('0xa1')],{'as':_0xc132('0x1b9'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1bb')});db['AnalyticFieldReport'][_0xc132('0x128')](db[_0xc132('0x9f')],{'foreignKey':_0xc132('0x1bb')});db[_0xc132('0xa5')][_0xc132('0x119')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0xc132('0x116'),'foreignKey':'AccountId'});db[_0xc132('0xa6')][_0xc132('0x119')](db[_0xc132('0xa8')],{'as':_0xc132('0x1bc'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xa6')]['hasMany'](db[_0xc132('0xa8')],{'as':_0xc132('0x1be'),'onDelete':_0xc132('0x116'),'foreignKey':'DescriptionId'});db[_0xc132('0xa6')][_0xc132('0x119')](db[_0xc132('0xa8')],{'as':_0xc132('0x1b9'),'onDelete':_0xc132('0x116'),'foreignKey':'FieldId'});db[_0xc132('0xa6')][_0xc132('0x128')](db[_0xc132('0xa5')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x1bf')});db[_0xc132('0xa8')]['hasMany'](db[_0xc132('0xa8')],{'as':_0xc132('0x1c0'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xa8')][_0xc132('0x119')](db[_0xc132('0xa8')],{'as':_0xc132('0x1c1'),'foreignKey':_0xc132('0x1c2')});db['SalesforceField'][_0xc132('0x119')](db[_0xc132('0xa8')],{'as':_0xc132('0x1c3'),'foreignKey':_0xc132('0x1c4')});db['SalesforceField'][_0xc132('0x128')](db[_0xc132('0x97')],{'as':_0xc132('0x97'),'foreignKey':_0xc132('0x1c5')});db[_0xc132('0xa9')]['hasMany'](db['SugarcrmConfiguration'],{'as':_0xc132('0x1c6'),'onDelete':'cascade','foreignKey':_0xc132('0x1bf')});db[_0xc132('0xaa')][_0xc132('0x119')](db[_0xc132('0x1c7')],{'as':'Subjects','onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xaa')][_0xc132('0x119')](db[_0xc132('0x1c7')],{'as':_0xc132('0x1be'),'onDelete':'cascade','foreignKey':_0xc132('0x1c2')});db['SugarcrmConfiguration'][_0xc132('0x119')](db[_0xc132('0x1c7')],{'as':_0xc132('0x1b9'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1c4')});db[_0xc132('0xaa')]['belongsTo'](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0xc132('0x1bf')});db[_0xc132('0x1c7')][_0xc132('0x119')](db[_0xc132('0x1c7')],{'as':_0xc132('0x1c0'),'foreignKey':_0xc132('0x1bd')});db['SugarcrmField']['hasMany'](db[_0xc132('0x1c7')],{'as':_0xc132('0x1c1'),'foreignKey':_0xc132('0x1c2')});db[_0xc132('0x1c7')][_0xc132('0x119')](db[_0xc132('0x1c7')],{'as':'Field','foreignKey':_0xc132('0x1c4')});db[_0xc132('0x1c7')][_0xc132('0x128')](db['Variable'],{'as':_0xc132('0x97'),'foreignKey':'VariableId'});db['DeskAccount'][_0xc132('0x119')](db['DeskConfiguration'],{'as':_0xc132('0x1c6'),'onDelete':'cascade','foreignKey':_0xc132('0x1bf')});db[_0xc132('0x1c8')]['hasMany'](db['DeskField'],{'as':_0xc132('0x1bc'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1bd')});db['DeskConfiguration'][_0xc132('0x119')](db['DeskField'],{'as':_0xc132('0x1be'),'onDelete':_0xc132('0x116'),'foreignKey':'DescriptionId'});db[_0xc132('0x1c8')][_0xc132('0x119')](db[_0xc132('0xaf')],{'as':_0xc132('0x1b9'),'onDelete':'cascade','foreignKey':_0xc132('0x1c4')});db[_0xc132('0x1c8')][_0xc132('0x128')](db['DeskAccount'],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x1bf')});db['DeskConfiguration']['belongsToMany'](db[_0xc132('0x8d')],{'through':_0xc132('0x1c9')});db[_0xc132('0xaf')][_0xc132('0x119')](db[_0xc132('0xaf')],{'as':'Subject','foreignKey':_0xc132('0x1bd')});db[_0xc132('0xaf')][_0xc132('0x119')](db[_0xc132('0xaf')],{'as':_0xc132('0x1c1'),'foreignKey':_0xc132('0x1c2')});db[_0xc132('0xaf')][_0xc132('0x119')](db[_0xc132('0xaf')],{'as':_0xc132('0x1c3'),'foreignKey':'FieldId'});db[_0xc132('0xaf')][_0xc132('0x128')](db[_0xc132('0x97')],{'as':_0xc132('0x97'),'foreignKey':_0xc132('0x1c5')});db[_0xc132('0xb0')][_0xc132('0x119')](db[_0xc132('0xb1')],{'as':'Configurations','onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1bf')});db[_0xc132('0xb1')][_0xc132('0x119')](db[_0xc132('0xb3')],{'as':_0xc132('0x1bc'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xb1')][_0xc132('0x119')](db['ZohoField'],{'as':'Descriptions','onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1c2')});db[_0xc132('0xb1')][_0xc132('0x119')](db[_0xc132('0xb3')],{'as':_0xc132('0x1b9'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1c4')});db['ZohoConfiguration'][_0xc132('0x128')](db[_0xc132('0xb0')],{'as':'Account','foreignKey':_0xc132('0x1bf')});db[_0xc132('0xb3')]['hasMany'](db[_0xc132('0xb3')],{'as':_0xc132('0x1c0'),'foreignKey':'SubjectId'});db[_0xc132('0xb3')][_0xc132('0x119')](db[_0xc132('0xb3')],{'as':'Description','foreignKey':_0xc132('0x1c2')});db['ZohoField'][_0xc132('0x119')](db['ZohoField'],{'as':_0xc132('0x1c3'),'foreignKey':_0xc132('0x1c4')});db[_0xc132('0xb3')][_0xc132('0x128')](db[_0xc132('0x97')],{'as':_0xc132('0x97'),'foreignKey':_0xc132('0x1c5')});db[_0xc132('0x1ca')][_0xc132('0x119')](db['ZendeskConfiguration'],{'as':_0xc132('0x1c6'),'onDelete':'cascade','foreignKey':_0xc132('0x1bf')});db[_0xc132('0xb5')][_0xc132('0x119')](db[_0xc132('0xb7')],{'as':_0xc132('0x1bc'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xb5')][_0xc132('0x119')](db[_0xc132('0xb7')],{'as':_0xc132('0x1be'),'foreignKey':_0xc132('0x1c2')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0xc132('0x1b9'),'foreignKey':'FieldId'});db[_0xc132('0xb5')]['belongsTo'](db[_0xc132('0x1ca')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x1bf')});db[_0xc132('0xb5')][_0xc132('0x12a')](db[_0xc132('0x8d')],{'through':_0xc132('0x1cb')});db[_0xc132('0xb7')][_0xc132('0x119')](db[_0xc132('0xb7')],{'as':_0xc132('0x1c0'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xb7')]['hasMany'](db[_0xc132('0xb7')],{'as':_0xc132('0x1c1'),'foreignKey':_0xc132('0x1c2')});db[_0xc132('0xb7')][_0xc132('0x119')](db[_0xc132('0xb7')],{'as':_0xc132('0x1c3'),'foreignKey':'FieldId'});db[_0xc132('0xb7')][_0xc132('0x128')](db[_0xc132('0x97')],{'as':_0xc132('0x97'),'foreignKey':_0xc132('0x1c5')});db['FreshdeskAccount'][_0xc132('0x119')](db[_0xc132('0xba')],{'as':_0xc132('0x1c6'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1bf')});db[_0xc132('0xba')]['hasMany'](db[_0xc132('0xbc')],{'as':_0xc132('0x1bc'),'onDelete':'cascade','foreignKey':_0xc132('0x1bd')});db['FreshdeskConfiguration'][_0xc132('0x119')](db['FreshdeskField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xc132('0xba')]['hasMany'](db[_0xc132('0xbc')],{'as':_0xc132('0x1b9'),'onDelete':'cascade','foreignKey':_0xc132('0x1c4')});db['FreshdeskConfiguration'][_0xc132('0x128')](db[_0xc132('0x1cc')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x1bf')});db[_0xc132('0xba')]['belongsToMany'](db[_0xc132('0x8d')],{'through':_0xc132('0x1cd')});db[_0xc132('0xbc')][_0xc132('0x119')](db['FreshdeskField'],{'as':_0xc132('0x1c0'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xbc')][_0xc132('0x119')](db['FreshdeskField'],{'as':'Description','foreignKey':_0xc132('0x1c2')});db['FreshdeskField']['hasMany'](db[_0xc132('0xbc')],{'as':'Field','foreignKey':_0xc132('0x1c4')});db['FreshdeskField'][_0xc132('0x128')](db[_0xc132('0x97')],{'as':_0xc132('0x97'),'foreignKey':_0xc132('0x1c5')});db[_0xc132('0xbd')]['hasMany'](db['VtigerConfiguration'],{'as':_0xc132('0x1c6'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1bf')});db[_0xc132('0x1ce')][_0xc132('0x119')](db[_0xc132('0xbf')],{'as':'Subjects','foreignKey':'SubjectId'});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':_0xc132('0x1be'),'foreignKey':_0xc132('0x1c2')});db[_0xc132('0x1ce')][_0xc132('0x119')](db['VtigerField'],{'as':_0xc132('0x1b9'),'foreignKey':_0xc132('0x1c4')});db[_0xc132('0x1ce')]['belongsTo'](db[_0xc132('0xbd')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x1bf')});db[_0xc132('0xbf')][_0xc132('0x119')](db[_0xc132('0xbf')],{'as':_0xc132('0x1c0'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xbf')][_0xc132('0x119')](db[_0xc132('0xbf')],{'as':_0xc132('0x1c1'),'foreignKey':_0xc132('0x1c2')});db[_0xc132('0xbf')][_0xc132('0x119')](db['VtigerField'],{'as':_0xc132('0x1c3'),'foreignKey':_0xc132('0x1c4')});db[_0xc132('0xbf')][_0xc132('0x128')](db[_0xc132('0x97')],{'as':_0xc132('0x97'),'foreignKey':_0xc132('0x1c5')});db[_0xc132('0x1cf')][_0xc132('0x119')](db[_0xc132('0xc1')],{'as':_0xc132('0x1c6'),'onDelete':_0xc132('0x116'),'foreignKey':'AccountId'});db[_0xc132('0xc1')][_0xc132('0x119')](db[_0xc132('0xc3')],{'as':_0xc132('0x1bc'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xc1')][_0xc132('0x119')](db[_0xc132('0xc3')],{'as':_0xc132('0x1be'),'foreignKey':_0xc132('0x1c2')});db['ServicenowConfiguration'][_0xc132('0x119')](db[_0xc132('0xc3')],{'as':_0xc132('0x1b9'),'foreignKey':_0xc132('0x1c4')});db[_0xc132('0xc1')][_0xc132('0x128')](db[_0xc132('0x1cf')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x1bf')});db['ServicenowField'][_0xc132('0x119')](db['ServicenowField'],{'as':'Subject','foreignKey':_0xc132('0x1bd')});db[_0xc132('0xc3')][_0xc132('0x119')](db[_0xc132('0xc3')],{'as':_0xc132('0x1c1'),'foreignKey':'DescriptionId'});db['ServicenowField'][_0xc132('0x119')](db[_0xc132('0xc3')],{'as':'Field','foreignKey':_0xc132('0x1c4')});db[_0xc132('0xc3')][_0xc132('0x128')](db['Variable'],{'as':_0xc132('0x97'),'foreignKey':_0xc132('0x1c5')});db[_0xc132('0x1d0')]['hasMany'](db['Dynamics365Configuration'],{'as':_0xc132('0x1c6'),'onDelete':_0xc132('0x116'),'foreignKey':'AccountId'});db['Dynamics365Account'][_0xc132('0x128')](db[_0xc132('0x10d')],{'as':_0xc132('0x10d'),'foreignKey':_0xc132('0x168')});db[_0xc132('0xc6')]['hasMany'](db[_0xc132('0xc8')],{'as':'Subjects','onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1bd')});db['Dynamics365Configuration'][_0xc132('0x119')](db[_0xc132('0xc8')],{'as':_0xc132('0x1be'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1c2')});db[_0xc132('0xc6')][_0xc132('0x119')](db[_0xc132('0xc8')],{'as':'Fields','onDelete':_0xc132('0x116'),'foreignKey':'FieldId'});db[_0xc132('0xc6')][_0xc132('0x128')](db[_0xc132('0x1d0')],{'as':'Account','foreignKey':_0xc132('0x1bf')});db['Dynamics365Field'][_0xc132('0x119')](db[_0xc132('0xc8')],{'as':_0xc132('0x1c0'),'foreignKey':_0xc132('0x1bd')});db['Dynamics365Field'][_0xc132('0x119')](db['Dynamics365Field'],{'as':_0xc132('0x1c1'),'foreignKey':_0xc132('0x1c2')});db[_0xc132('0xc8')][_0xc132('0x119')](db[_0xc132('0xc8')],{'as':_0xc132('0x1c3'),'foreignKey':'FieldId'});db[_0xc132('0xc8')][_0xc132('0x128')](db[_0xc132('0x97')],{'as':_0xc132('0x97'),'foreignKey':_0xc132('0x1c5')});db[_0xc132('0xca')]['hasMany'](db[_0xc132('0xcc')],{'as':_0xc132('0x1c6'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xc132('0xcc')][_0xc132('0x119')](db[_0xc132('0xce')],{'as':_0xc132('0x1bc'),'foreignKey':_0xc132('0x1bd')});db['FreshsalesConfiguration']['hasMany'](db[_0xc132('0xce')],{'as':_0xc132('0x1be'),'foreignKey':_0xc132('0x1c2')});db[_0xc132('0xcc')]['hasMany'](db[_0xc132('0xce')],{'as':_0xc132('0x1b9'),'foreignKey':_0xc132('0x1c4')});db['FreshsalesConfiguration'][_0xc132('0x128')](db[_0xc132('0xca')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x1bf')});db[_0xc132('0xce')][_0xc132('0x119')](db[_0xc132('0xce')],{'as':_0xc132('0x1c0'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xce')][_0xc132('0x119')](db[_0xc132('0xce')],{'as':_0xc132('0x1c1'),'foreignKey':'DescriptionId'});db[_0xc132('0xce')]['hasMany'](db[_0xc132('0xce')],{'as':'Field','foreignKey':_0xc132('0x1c4')});db['FreshsalesField']['belongsTo'](db['Variable'],{'as':_0xc132('0x97'),'foreignKey':_0xc132('0x1c5')});db['ChatQueueReport'][_0xc132('0x128')](db['ChatWebsite'],{});db['ChatQueueReport']['belongsTo'](db[_0xc132('0x144')],{'as':_0xc132('0x17a'),'foreignKey':'ListId'});db[_0xc132('0xd2')][_0xc132('0x128')](db['CmContact'],{'as':_0xc132('0x165'),'foreignKey':_0xc132('0x166')});db[_0xc132('0xd2')][_0xc132('0x128')](db['ChatInteraction'],{});db['ChatQueueReport']['belongsTo'](db['ChatMessage'],{});db[_0xc132('0xd2')]['belongsTo'](db['User'],{});db[_0xc132('0xd2')][_0xc132('0x128')](db[_0xc132('0x6a')],{});db[_0xc132('0xd4')][_0xc132('0x128')](db['User'],{'onDelete':_0xc132('0x116'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0xc132('0x128')](db[_0xc132('0x13')],{'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1d1')});db[_0xc132('0x155')][_0xc132('0x119')](db[_0xc132('0xd7')],{'foreignKey':_0xc132('0x1d2'),'onDelete':_0xc132('0x116')});db['JscriptySessionReport'][_0xc132('0x119')](db[_0xc132('0x1d3')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xc132('0xda')][_0xc132('0x128')](db['SmsAccount'],{});db[_0xc132('0xda')]['belongsTo'](db['CmList'],{'as':_0xc132('0x17a'),'foreignKey':_0xc132('0x16c')});db[_0xc132('0xda')][_0xc132('0x128')](db[_0xc132('0x72')],{'as':_0xc132('0x165'),'foreignKey':'ContactId'});db['SmsQueueReport']['belongsTo'](db[_0xc132('0x55')],{});db[_0xc132('0xda')][_0xc132('0x128')](db[_0xc132('0x57')],{});db[_0xc132('0xda')]['belongsTo'](db['User'],{});db[_0xc132('0xda')][_0xc132('0x128')](db[_0xc132('0x58')],{});db[_0xc132('0xdf')][_0xc132('0x119')](db[_0xc132('0x155')],{'foreignKey':'ProjectId'});db[_0xc132('0xdf')][_0xc132('0x119')](db[_0xc132('0xd7')],{'foreignKey':_0xc132('0x1d4')});db[_0xc132('0xdf')]['hasMany'](db[_0xc132('0x1d3')],{'foreignKey':'ProjectId'});db[_0xc132('0xe4')]['belongsToMany'](db[_0xc132('0x13')],{'as':_0xc132('0x175'),'through':_0xc132('0x14d')});db[_0xc132('0x12f')][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':_0xc132('0x16e'),'through':_0xc132('0x130')});db['Team'][_0xc132('0x12a')](db[_0xc132('0x137')],{'through':_0xc132('0x10f'),'as':'VoiceQueues'});db[_0xc132('0x12f')][_0xc132('0x12a')](db[_0xc132('0x3d')],{'through':_0xc132('0x16f'),'as':'MailQueues'});db[_0xc132('0x12f')][_0xc132('0x12a')](db[_0xc132('0x6a')],{'through':_0xc132('0x19a'),'as':_0xc132('0x13b')});db['Team'][_0xc132('0x12a')](db['FaxQueue'],{'through':'team_has_fax_queues','as':_0xc132('0x13d')});db[_0xc132('0x12f')]['belongsToMany'](db[_0xc132('0x58')],{'through':_0xc132('0x18a'),'as':'SmsQueues'});db['Team'][_0xc132('0x12a')](db[_0xc132('0x13f')],{'through':_0xc132('0x190'),'as':_0xc132('0x140')});db['Team'][_0xc132('0x12a')](db['WhatsappQueue'],{'through':_0xc132('0x1d5'),'as':'WhatsappQueues'});db['Team'][_0xc132('0x12a')](db['VoicePrefix'],{'through':_0xc132('0x111'),'as':_0xc132('0x139')});db[_0xc132('0xec')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xc132('0x1a3')});db[_0xc132('0xec')][_0xc132('0x119')](db[_0xc132('0x11c')],{'as':_0xc132('0x11d'),'foreignKey':_0xc132('0x1a3')});db[_0xc132('0xec')][_0xc132('0x119')](db[_0xc132('0x11e')],{'as':'HopperHistories','foreignKey':_0xc132('0x1a3')});db[_0xc132('0xec')][_0xc132('0x119')](db[_0xc132('0x154')],{'as':_0xc132('0x1d6'),'foreignKey':'CampaignId'});db['Campaign'][_0xc132('0x128')](db[_0xc132('0x29')],{'as':_0xc132('0x29'),'foreignKey':'TrunkId'});db[_0xc132('0xec')][_0xc132('0x128')](db['Trunk'],{'as':_0xc132('0x158'),'foreignKey':_0xc132('0x159')});db[_0xc132('0xec')][_0xc132('0x128')](db[_0xc132('0x83')],{'as':_0xc132('0x83'),'foreignKey':_0xc132('0x18d')});db[_0xc132('0xec')][_0xc132('0x128')](db[_0xc132('0xe4')],{'as':_0xc132('0xe4'),'foreignKey':_0xc132('0x1d7')});db[_0xc132('0xec')][_0xc132('0x12a')](db[_0xc132('0x144')],{'as':_0xc132('0x12e'),'through':'campaigns_has_cm_lists'});db[_0xc132('0xec')][_0xc132('0x12a')](db[_0xc132('0x144')],{'as':'BlackLists','through':_0xc132('0x1d8')});db[_0xc132('0xee')][_0xc132('0x128')](db['ChatOfflineMessage'],{'as':_0xc132('0x178'),'foreignKey':_0xc132('0x199')});db[_0xc132('0x1d9')][_0xc132('0x128')](db[_0xc132('0x41')],{});db[_0xc132('0x1d9')][_0xc132('0x128')](db['MailInteraction'],{});db[_0xc132('0x1d9')][_0xc132('0x128')](db['MailAccount'],{'foreignKey':_0xc132('0x1da'),'as':_0xc132('0x1db')});db[_0xc132('0x1d9')][_0xc132('0x128')](db[_0xc132('0x13')],{'foreignKey':_0xc132('0x1dc'),'as':_0xc132('0x1dd')});db[_0xc132('0x1d9')]['belongsTo'](db[_0xc132('0x13')],{'foreignKey':'ToUserId','as':_0xc132('0x1de')});db[_0xc132('0x1d9')][_0xc132('0x128')](db['MailQueue'],{'foreignKey':_0xc132('0x1df'),'as':_0xc132('0x1e0')});db['MailTransferReport'][_0xc132('0x128')](db['MailAccount'],{'foreignKey':_0xc132('0x1e1'),'as':_0xc132('0x1e2')});db[_0xc132('0xf3')]['belongsTo'](db[_0xc132('0x67')],{});db[_0xc132('0xf3')]['belongsTo'](db[_0xc132('0x121')],{});db['ChatTransferReport'][_0xc132('0x128')](db[_0xc132('0x61')],{'foreignKey':_0xc132('0x1e3'),'as':'FromAccount'});db[_0xc132('0xf3')][_0xc132('0x128')](db['User'],{'foreignKey':_0xc132('0x1dc'),'as':_0xc132('0x1dd')});db[_0xc132('0xf3')][_0xc132('0x128')](db['User'],{'foreignKey':'ToUserId','as':_0xc132('0x1de')});db[_0xc132('0xf3')][_0xc132('0x128')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0xc132('0x1e0')});db[_0xc132('0xf3')][_0xc132('0x128')](db[_0xc132('0x61')],{'foreignKey':_0xc132('0x1e4'),'as':_0xc132('0x1e2')});db[_0xc132('0x1e5')]['belongsTo'](db[_0xc132('0x4e')],{});db[_0xc132('0x1e5')][_0xc132('0x128')](db[_0xc132('0x123')],{});db[_0xc132('0x1e5')][_0xc132('0x128')](db[_0xc132('0x4a')],{'foreignKey':_0xc132('0x1e6'),'as':'FromAccount'});db['FaxTransferReport'][_0xc132('0x128')](db[_0xc132('0x13')],{'foreignKey':_0xc132('0x1dc'),'as':_0xc132('0x1dd')});db[_0xc132('0x1e5')][_0xc132('0x128')](db[_0xc132('0x13')],{'foreignKey':_0xc132('0x1e7'),'as':'ToAgent'});db['FaxTransferReport']['belongsTo'](db[_0xc132('0x13c')],{'foreignKey':_0xc132('0x1e8'),'as':_0xc132('0x1e0')});db[_0xc132('0x1e5')][_0xc132('0x128')](db[_0xc132('0x4a')],{'foreignKey':'ToFaxAccountId','as':_0xc132('0x1e2')});db['OpenchannelTransferReport'][_0xc132('0x128')](db[_0xc132('0x5f')],{});db[_0xc132('0xf6')]['belongsTo'](db[_0xc132('0x5e')],{});db[_0xc132('0xf6')]['belongsTo'](db[_0xc132('0x5a')],{'foreignKey':_0xc132('0x1e9'),'as':_0xc132('0x1db')});db[_0xc132('0xf6')]['belongsTo'](db['User'],{'foreignKey':_0xc132('0x1dc'),'as':_0xc132('0x1dd')});db[_0xc132('0xf6')][_0xc132('0x128')](db[_0xc132('0x13')],{'foreignKey':'ToUserId','as':_0xc132('0x1de')});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0xc132('0x1e0')});db[_0xc132('0xf6')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0xc132('0x1ea'),'as':_0xc132('0x1e2')});db[_0xc132('0xf8')][_0xc132('0x128')](db['SmsMessage'],{});db[_0xc132('0xf8')][_0xc132('0x128')](db[_0xc132('0x55')],{});db['SmsTransferReport'][_0xc132('0x128')](db[_0xc132('0x51')],{'foreignKey':_0xc132('0x1eb'),'as':_0xc132('0x1db')});db[_0xc132('0xf8')][_0xc132('0x128')](db[_0xc132('0x13')],{'foreignKey':_0xc132('0x1dc'),'as':_0xc132('0x1dd')});db[_0xc132('0xf8')][_0xc132('0x128')](db[_0xc132('0x13')],{'foreignKey':_0xc132('0x1e7'),'as':'ToAgent'});db[_0xc132('0xf8')][_0xc132('0x128')](db['SmsQueue'],{'foreignKey':_0xc132('0x1ec'),'as':_0xc132('0x1e0')});db[_0xc132('0xf8')][_0xc132('0x128')](db[_0xc132('0x51')],{'foreignKey':'ToSmsAccountId','as':_0xc132('0x1e2')});db['CmList'][_0xc132('0x119')](db['Disposition'],{'as':_0xc132('0x16a'),'foreignKey':_0xc132('0x16c'),'onDelete':_0xc132('0x116')});db[_0xc132('0x144')]['hasMany'](db[_0xc132('0x79')],{'as':_0xc132('0x1ed'),'foreignKey':_0xc132('0x16c')});db['CmList'][_0xc132('0x119')](db[_0xc132('0x72')],{'as':_0xc132('0x12c'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x16c')});db['CmList'][_0xc132('0x119')](db[_0xc132('0x11c')],{'as':_0xc132('0x11d'),'foreignKey':_0xc132('0x16c')});db[_0xc132('0x144')]['hasMany'](db[_0xc132('0x11e')],{'as':_0xc132('0x11f'),'foreignKey':_0xc132('0x16c')});db['CmList'][_0xc132('0x119')](db['ReportAgentPreview'],{'as':_0xc132('0x77'),'foreignKey':'ListId'});db[_0xc132('0x144')][_0xc132('0x12a')](db[_0xc132('0x137')],{'as':_0xc132('0x1ee'),'through':_0xc132('0x1ef')});db[_0xc132('0x144')][_0xc132('0x12a')](db['User'],{'as':'Agents','through':'cm_user_has_lists'});db['VoicePrefix'][_0xc132('0x119')](db[_0xc132('0x17')],{'as':_0xc132('0x1f0'),'onDelete':_0xc132('0x116')});db[_0xc132('0xfa')][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':_0xc132('0x16e'),'through':_0xc132('0x13a')});db[_0xc132('0xfa')][_0xc132('0x12a')](db[_0xc132('0x12f')],{'through':'TeamVoicePrefix','as':_0xc132('0x15d')});db['UserProfile'][_0xc132('0x119')](db[_0xc132('0x13')],{'as':'Users','foreignKey':_0xc132('0x129')});db['UserProfile'][_0xc132('0x119')](db[_0xc132('0x1f1')],{'as':'UserProfileSections','foreignKey':_0xc132('0x129'),'onDelete':'cascade'});db[_0xc132('0x1f1')][_0xc132('0x119')](db[_0xc132('0xfe')],{'as':_0xc132('0x1f2'),'foreignKey':_0xc132('0x1f3'),'onDelete':_0xc132('0x116')});db[_0xc132('0x101')][_0xc132('0x119')](db[_0xc132('0x80')],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0xc132('0x101')][_0xc132('0x119')](db['CannedAnswer'],{'as':_0xc132('0x16b'),'foreignKey':_0xc132('0x1f4')});db['WhatsappAccount'][_0xc132('0x119')](db[_0xc132('0x106')],{'as':'Messages','foreignKey':_0xc132('0x1f4')});db['WhatsappAccount'][_0xc132('0x119')](db[_0xc132('0x104')],{'as':'Interactions'});db[_0xc132('0x101')][_0xc132('0x119')](db['WhatsappApplication'],{'as':_0xc132('0x14e')});db[_0xc132('0x101')][_0xc132('0x128')](db[_0xc132('0x144')],{'as':'List','foreignKey':_0xc132('0x16c')});db[_0xc132('0x101')][_0xc132('0x128')](db['Pause'],{'as':_0xc132('0x15a'),'foreignKey':_0xc132('0x15b')});db[_0xc132('0x101')]['belongsToMany'](db['User'],{'as':_0xc132('0x16e'),'through':_0xc132('0x1f5')});db['WhatsappApplication'][_0xc132('0x128')](db[_0xc132('0x13')],{'onDelete':'restrict'});db[_0xc132('0x103')]['belongsTo'](db['WhatsappQueue'],{'onDelete':_0xc132('0x169')});db[_0xc132('0x103')][_0xc132('0x128')](db[_0xc132('0x101')],{'onDelete':_0xc132('0x169')});db[_0xc132('0x103')][_0xc132('0x128')](db[_0xc132('0x83')],{'onDelete':_0xc132('0x169'),'foreignKey':_0xc132('0x18d')});db[_0xc132('0x103')][_0xc132('0x128')](db[_0xc132('0x8d')],{'onDelete':'restrict','foreignKey':_0xc132('0x179')});db[_0xc132('0x104')]['hasMany'](db[_0xc132('0x106')],{'as':'Messages','onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1f6')});db[_0xc132('0x104')][_0xc132('0x128')](db[_0xc132('0x101')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x1f4')});db[_0xc132('0x104')][_0xc132('0x128')](db['CmContact'],{'as':_0xc132('0x165'),'foreignKey':'ContactId'});db[_0xc132('0x104')][_0xc132('0x128')](db[_0xc132('0x13')],{'as':_0xc132('0x171'),'foreignKey':_0xc132('0x117')});db['WhatsappInteraction']['belongsToMany'](db[_0xc132('0x8d')],{'through':_0xc132('0x1f7'),'as':_0xc132('0x173')});db[_0xc132('0x104')][_0xc132('0x12a')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0xc132('0x174')});db[_0xc132('0x104')]['belongsToMany'](db['User'],{'as':_0xc132('0x175'),'through':_0xc132('0x1f8'),'foreignKey':_0xc132('0x1f6')});db[_0xc132('0x106')][_0xc132('0x128')](db['User'],{'as':_0xc132('0x13')});db[_0xc132('0x106')][_0xc132('0x128')](db['CmContact'],{'onDelete':_0xc132('0x116'),'as':_0xc132('0x165')});db[_0xc132('0x106')]['belongsTo'](db[_0xc132('0x104')],{'onDelete':_0xc132('0x116'),'as':_0xc132('0x177'),'foreignKey':_0xc132('0x1f6')});db[_0xc132('0x106')][_0xc132('0x128')](db[_0xc132('0x101')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x1f4')});db[_0xc132('0x108')][_0xc132('0x128')](db[_0xc132('0x101')],{});db[_0xc132('0x108')][_0xc132('0x128')](db[_0xc132('0x144')],{'as':'List','foreignKey':_0xc132('0x16c')});db['WhatsappQueueReport'][_0xc132('0x128')](db[_0xc132('0x72')],{'as':_0xc132('0x165'),'foreignKey':_0xc132('0x166')});db[_0xc132('0x108')][_0xc132('0x128')](db[_0xc132('0x104')],{});db[_0xc132('0x108')][_0xc132('0x128')](db[_0xc132('0x10b')],{});db[_0xc132('0x108')][_0xc132('0x128')](db[_0xc132('0x106')],{});db[_0xc132('0x108')][_0xc132('0x128')](db['User'],{});db[_0xc132('0x109')][_0xc132('0x128')](db[_0xc132('0x106')],{});db[_0xc132('0x109')][_0xc132('0x128')](db['WhatsappInteraction'],{});db[_0xc132('0x109')][_0xc132('0x128')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0xc132('0x1db')});db[_0xc132('0x109')]['belongsTo'](db[_0xc132('0x101')],{'foreignKey':'ToWhatsappAccountId','as':'ToAccount'});db[_0xc132('0x109')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0xc132('0x1f9'),'as':'ToQueue'});db[_0xc132('0x109')][_0xc132('0x128')](db[_0xc132('0x13')],{'foreignKey':_0xc132('0x1dc'),'as':'FromAgent'});db[_0xc132('0x109')][_0xc132('0x128')](db[_0xc132('0x13')],{'foreignKey':_0xc132('0x1e7'),'as':_0xc132('0x1de')});db[_0xc132('0x10b')]['belongsToMany'](db[_0xc132('0x13')],{'as':_0xc132('0x16e'),'through':_0xc132('0x143'),'foreignKey':_0xc132('0x1fa')});db[_0xc132('0x10b')][_0xc132('0x12a')](db[_0xc132('0x12f')],{'through':_0xc132('0x1d5'),'as':_0xc132('0x15d')});db[_0xc132('0x113')][_0xc132('0x128')](db[_0xc132('0x13')],{'as':_0xc132('0x1fb'),'foreignKey':'UserId','onDelete':_0xc132('0x116'),'hooks':!![]});db[_0xc132('0x10d')][_0xc132('0x115')](db[_0xc132('0x1d0')],{'as':'Dynamics365Account','onDelete':_0xc132('0x169')});db['CloudProvider'][_0xc132('0x115')](db[_0xc132('0x37')],{'as':'Imap','onDelete':_0xc132('0x169')});db[_0xc132('0x10d')][_0xc132('0x115')](db['MailServerOut'],{'as':'Smtp','onDelete':_0xc132('0x169')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 961a607..2f4addd 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeef8=['./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','get','sendFile','resolve','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/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/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations'];(function(_0x192c82,_0xd9460b){var _0x27a0f4=function(_0x5c6f8e){while(--_0x5c6f8e){_0x192c82['push'](_0x192c82['shift']());}};_0x27a0f4(++_0xd9460b);}(_0xeef8,0x1a3));var _0x8eef=function(_0x4b5e38,_0xac796d){_0x4b5e38=_0x4b5e38-0x0;var _0x2b2c13=_0xeef8[_0x4b5e38];return _0x2b2c13;};'use strict';var path=require('path');var express=require(_0x8eef('0x0'));var errors=require(_0x8eef('0x1'));var config=require(_0x8eef('0x2'));var setupLoggers=require(_0x8eef('0x3'))[_0x8eef('0x4')];var clientSideLogs=require(_0x8eef('0x5'));exports[_0x8eef('0x6')]=function(_0x1d4dba){return setupLoggers(_0x1d4dba)['then'](function(){_0x1d4dba[_0x8eef('0x7')]('/api/users',require(_0x8eef('0x8')));_0x1d4dba[_0x8eef('0x7')]('/api/voice/chanspy',require(_0x8eef('0x9')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xa'),require(_0x8eef('0xb')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xc'),require(_0x8eef('0xd')));_0x1d4dba['use'](_0x8eef('0xe'),require(_0x8eef('0xf')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x10'),require(_0x8eef('0x11')));_0x1d4dba[_0x8eef('0x7')]('/api/voice/recordings',require(_0x8eef('0x12')));_0x1d4dba['use'](_0x8eef('0x13'),require(_0x8eef('0x14')));_0x1d4dba[_0x8eef('0x7')]('/api/voice/mails',require(_0x8eef('0x15')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x16'),require(_0x8eef('0x17')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x18'),require(_0x8eef('0x19')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x1a'),require(_0x8eef('0x1b')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x1c'),require('./api/voiceAgentReport'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x1d'),require('./api/voiceQueueReport'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x1e'),require('./api/memberReport'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x1f'),require(_0x8eef('0x20')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x21'),require(_0x8eef('0x22')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x23'),require(_0x8eef('0x24')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x25'),require('./api/mailAccount'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x26'),require(_0x8eef('0x27')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x28'),require(_0x8eef('0x29')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x2a'),require(_0x8eef('0x2b')));_0x1d4dba[_0x8eef('0x7')]('/api/mail/messages',require(_0x8eef('0x2c')));_0x1d4dba[_0x8eef('0x7')]('/api/mail/applications',require(_0x8eef('0x2d')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x2e'),require(_0x8eef('0x2f')));_0x1d4dba['use'](_0x8eef('0x30'),require(_0x8eef('0x31')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x32'),require('./api/dashboardItem'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x33'),require(_0x8eef('0x34')));_0x1d4dba['use'](_0x8eef('0x35'),require('./api/faxApplication'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x36'),require(_0x8eef('0x37')));_0x1d4dba['use'](_0x8eef('0x38'),require(_0x8eef('0x39')));_0x1d4dba['use'](_0x8eef('0x3a'),require(_0x8eef('0x3b')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x3c'),require(_0x8eef('0x3d')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x3e'),require(_0x8eef('0x3f')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x40'),require(_0x8eef('0x41')));_0x1d4dba['use'](_0x8eef('0x42'),require(_0x8eef('0x43')));_0x1d4dba[_0x8eef('0x7')]('/api/sms/messages',require(_0x8eef('0x44')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x45'),require(_0x8eef('0x46')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x47'),require(_0x8eef('0x48')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x49'),require('./api/openchannelApplication'));_0x1d4dba['use']('/api/openchannel/interactions',require(_0x8eef('0x4a')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x4b'),require('./api/openchannelMessage'));_0x1d4dba[_0x8eef('0x7')]('/api/openchannel/queues',require(_0x8eef('0x4c')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x4d'),require(_0x8eef('0x4e')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x4f'),require(_0x8eef('0x50')));_0x1d4dba[_0x8eef('0x7')]('/api/chat/applications',require(_0x8eef('0x51')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x52'),require(_0x8eef('0x53')));_0x1d4dba[_0x8eef('0x7')]('/api/chat/messages',require(_0x8eef('0x54')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x55'),require(_0x8eef('0x56')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x57'),require(_0x8eef('0x58')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x59'),require(_0x8eef('0x5a')));_0x1d4dba['use']('/api/chat/proactive_actions',require(_0x8eef('0x5b')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x5c'),require('./api/cmCompany'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x5d'),require(_0x8eef('0x5e')));_0x1d4dba[_0x8eef('0x7')]('/api/cm/hopper',require(_0x8eef('0x5f')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x60'),require(_0x8eef('0x61')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x62'),require(_0x8eef('0x63')));_0x1d4dba['use'](_0x8eef('0x64'),require(_0x8eef('0x65')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x66'),require(_0x8eef('0x67')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x68'),require(_0x8eef('0x69')));_0x1d4dba['use'](_0x8eef('0x6a'),require(_0x8eef('0x6b')));_0x1d4dba['use'](_0x8eef('0x6c'),require('./api/cannedAnswer'));_0x1d4dba['use']('/api/dispositions',require(_0x8eef('0x6d')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x6e'),require(_0x8eef('0x6f')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x70'),require(_0x8eef('0x71')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x72'),require('./api/pause'));_0x1d4dba['use'](_0x8eef('0x73'),require('./api/cdr'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x74'),require(_0x8eef('0x75')));_0x1d4dba['use'](_0x8eef('0x76'),require('./api/schedule'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x77'),require(_0x8eef('0x78')));_0x1d4dba['use'](_0x8eef('0x79'),require(_0x8eef('0x7a')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x7b'),require(_0x8eef('0x7c')));_0x1d4dba[_0x8eef('0x7')]('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x1d4dba['use'](_0x8eef('0x7d'),require(_0x8eef('0x7e')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x7f'),require('./api/template'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x80'),require(_0x8eef('0x81')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x82'),require(_0x8eef('0x83')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x84'),require('./api/integration'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x85'),require(_0x8eef('0x86')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x87'),require(_0x8eef('0x88')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x89'),require('./api/analyticDefaultReport'));_0x1d4dba['use'](_0x8eef('0x8a'),require(_0x8eef('0x8b')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x8c'),require(_0x8eef('0x8d')));_0x1d4dba[_0x8eef('0x7')]('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x8e'),require(_0x8eef('0x8f')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x90'),require(_0x8eef('0x91')));_0x1d4dba['use']('/api/integrations/salesforce/configurations',require(_0x8eef('0x92')));_0x1d4dba['use'](_0x8eef('0x93'),require('./api/intSalesforceField'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x94'),require(_0x8eef('0x95')));_0x1d4dba['use'](_0x8eef('0x96'),require(_0x8eef('0x97')));_0x1d4dba[_0x8eef('0x7')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x1d4dba['use'](_0x8eef('0x98'),require(_0x8eef('0x99')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x9a'),require(_0x8eef('0x9b')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x9c'),require('./api/intDeskField'));_0x1d4dba['use'](_0x8eef('0x9d'),require('./api/intZohoAccount'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x9e'),require(_0x8eef('0x9f')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xa0'),require(_0x8eef('0xa1')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xa2'),require(_0x8eef('0xa3')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xa4'),require('./api/intZendeskConfiguration'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xa5'),require(_0x8eef('0xa6')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xa7'),require(_0x8eef('0xa8')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xa9'),require('./api/intFreshdeskConfiguration'));_0x1d4dba[_0x8eef('0x7')]('/api/integrations/freshdesk/fields',require(_0x8eef('0xaa')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xab'),require(_0x8eef('0xac')));_0x1d4dba['use']('/api/integrations/vtiger/configurations',require(_0x8eef('0xad')));_0x1d4dba[_0x8eef('0x7')]('/api/integrations/vtiger/fields',require(_0x8eef('0xae')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xaf'),require(_0x8eef('0xb0')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xb1'),require(_0x8eef('0xb2')));_0x1d4dba['use']('/api/integrations/servicenow/fields',require(_0x8eef('0xb3')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xb4'),require('./api/intDynamics365Account'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xb5'),require(_0x8eef('0xb6')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xb7'),require(_0x8eef('0xb8')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xb9'),require('./api/intFreshsalesAccount'));_0x1d4dba[_0x8eef('0x7')]('/api/integrations/freshsales/configurations',require(_0x8eef('0xba')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xbb'),require(_0x8eef('0xbc')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xbd'),require(_0x8eef('0xbe')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xbf'),require(_0x8eef('0xc0')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xc1'),require('./api/chatInternalMessage'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xc2'),require(_0x8eef('0xc3')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xc4'),require(_0x8eef('0xc5')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xc6'),require('./api/jscriptySessionReport'));_0x1d4dba['use'](_0x8eef('0xc7'),require(_0x8eef('0xc8')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xc9'),require(_0x8eef('0xca')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xcb'),require(_0x8eef('0xcc')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xcd'),require('./api/jscriptyProject'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xce'),require('./api/setting'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xcf'),require('./api/squareOdbc'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xd0'),require(_0x8eef('0xd1')));_0x1d4dba['use'](_0x8eef('0xd2'),require(_0x8eef('0xd3')));_0x1d4dba['use'](_0x8eef('0xd4'),require(_0x8eef('0xd5')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xd6'),require(_0x8eef('0xd7')));_0x1d4dba['use'](_0x8eef('0xd8'),require(_0x8eef('0xd9')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xda'),require(_0x8eef('0xdb')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xdc'),require(_0x8eef('0xdd')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xde'),require(_0x8eef('0xdf')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xe0'),require('./api/plugin'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xe1'),require(_0x8eef('0xe2')));_0x1d4dba['use'](_0x8eef('0xe3'),require(_0x8eef('0xe4')));_0x1d4dba['use'](_0x8eef('0xe5'),require('./api/faxTransferReport'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xe6'),require(_0x8eef('0xe7')));_0x1d4dba[_0x8eef('0x7')]('/api/sms/reports/transfer',require(_0x8eef('0xe8')));_0x1d4dba[_0x8eef('0x7')]('/api/cm/lists',require('./api/cmList'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xe9'),require(_0x8eef('0xea')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xeb'),require('./api/userProfile'));_0x1d4dba['use'](_0x8eef('0xec'),require(_0x8eef('0xed')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xee'),require(_0x8eef('0xef')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xf0'),require(_0x8eef('0xf1')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xf2'),require('./api/whatsappAccount'));_0x1d4dba[_0x8eef('0x7')]('/api/whatsapp/applications',require(_0x8eef('0xf3')));_0x1d4dba[_0x8eef('0x7')]('/api/whatsapp/interactions',require(_0x8eef('0xf4')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xf5'),require('./api/whatsappMessage'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xf6'),require('./api/whatsappQueueReport'));_0x1d4dba[_0x8eef('0x7')]('/api/whatsapp/reports/transfer',require(_0x8eef('0xf7')));_0x1d4dba[_0x8eef('0x7')]('/api/whatsapp/queues',require(_0x8eef('0xf8')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xf9'),require(_0x8eef('0xfa')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xfb'),require(_0x8eef('0xfc')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xfd'),require(_0x8eef('0xfe')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0xff'),require(_0x8eef('0x100')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x101'),require('./api/authGoogle'));_0x1d4dba[_0x8eef('0x7')]('/api/auth/activedirectory',require(_0x8eef('0x102')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x103'),require(_0x8eef('0x104')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x105'),require(_0x8eef('0x106')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x107'),require(_0x8eef('0x108')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x109'),require('./api/system'));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x10a'),require(_0x8eef('0x10b')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x10c'),require(_0x8eef('0x10d')));_0x1d4dba['use'](_0x8eef('0x10e'),clientSideLogs);_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x10f'),express[_0x8eef('0x110')](path[_0x8eef('0x111')](config[_0x8eef('0x112')],'/apidoc')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x113'),express[_0x8eef('0x110')](path['join'](config[_0x8eef('0x112')],_0x8eef('0x113'))));_0x1d4dba['use'](_0x8eef('0x114'),express[_0x8eef('0x110')](path[_0x8eef('0x111')](config[_0x8eef('0x112')],'/demo')));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x115'),express[_0x8eef('0x110')](path[_0x8eef('0x111')](config[_0x8eef('0x112')],_0x8eef('0x116'),_0x8eef('0x117'))));_0x1d4dba[_0x8eef('0x7')](_0x8eef('0x118'),express[_0x8eef('0x110')](path['join'](config[_0x8eef('0x112')],_0x8eef('0x119'))));_0x1d4dba['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0x8eef('0x11a')](errors[0x194]);_0x1d4dba['route']('/*')[_0x8eef('0x11a')](function(_0x42973c,_0x4e34a5){_0x4e34a5[_0x8eef('0x11b')](path[_0x8eef('0x11c')](_0x1d4dba['get'](_0x8eef('0x11d'))+_0x8eef('0x11e')));});return _0x1d4dba;});}; \ No newline at end of file +var _0xd743=['/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareMessage','/api/teams','./api/license','./api/campaign','./api/migration','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/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/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/questions/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'];(function(_0x52a857,_0xc99fa1){var _0x4e2aae=function(_0x5410d9){while(--_0x5410d9){_0x52a857['push'](_0x52a857['shift']());}};_0x4e2aae(++_0xc99fa1);}(_0xd743,0x170));var _0x3d74=function(_0x25bab0,_0x4d4860){_0x25bab0=_0x25bab0-0x0;var _0x3392a9=_0xd743[_0x25bab0];return _0x3392a9;};'use strict';var path=require(_0x3d74('0x0'));var express=require(_0x3d74('0x1'));var errors=require(_0x3d74('0x2'));var config=require('./config/environment');var setupLoggers=require(_0x3d74('0x3'))[_0x3d74('0x4')];var clientSideLogs=require(_0x3d74('0x5'));exports[_0x3d74('0x6')]=function(_0x17809a){return setupLoggers(_0x17809a)[_0x3d74('0x7')](function(){_0x17809a[_0x3d74('0x8')](_0x3d74('0x9'),require('./api/user'));_0x17809a[_0x3d74('0x8')](_0x3d74('0xa'),require(_0x3d74('0xb')));_0x17809a['use'](_0x3d74('0xc'),require(_0x3d74('0xd')));_0x17809a['use'](_0x3d74('0xe'),require('./api/voiceExtension'));_0x17809a[_0x3d74('0x8')](_0x3d74('0xf'),require(_0x3d74('0x10')));_0x17809a[_0x3d74('0x8')]('/api/voice/queues',require(_0x3d74('0x11')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x12'),require('./api/voiceRecording'));_0x17809a['use'](_0x3d74('0x13'),require(_0x3d74('0x14')));_0x17809a['use'](_0x3d74('0x15'),require(_0x3d74('0x16')));_0x17809a[_0x3d74('0x8')]('/api/voice/mails/messages',require(_0x3d74('0x17')));_0x17809a['use'](_0x3d74('0x18'),require(_0x3d74('0x19')));_0x17809a['use'](_0x3d74('0x1a'),require(_0x3d74('0x1b')));_0x17809a['use'](_0x3d74('0x1c'),require(_0x3d74('0x1d')));_0x17809a[_0x3d74('0x8')]('/api/voice/queues/reports',require(_0x3d74('0x1e')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x1f'),require(_0x3d74('0x20')));_0x17809a[_0x3d74('0x8')]('/api/trunks',require(_0x3d74('0x21')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x22'),require('./api/voiceTransferReport'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x23'),require(_0x3d74('0x24')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x25'),require(_0x3d74('0x26')));_0x17809a[_0x3d74('0x8')]('/api/mail/queues',require(_0x3d74('0x27')));_0x17809a[_0x3d74('0x8')]('/api/mail/substatuses',require(_0x3d74('0x28')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x29'),require(_0x3d74('0x2a')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x2b'),require(_0x3d74('0x2c')));_0x17809a[_0x3d74('0x8')]('/api/mail/applications',require(_0x3d74('0x2d')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x2e'),require('./api/mailQueueReport'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x2f'),require(_0x3d74('0x30')));_0x17809a['use']('/api/dashboards/items',require(_0x3d74('0x31')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x32'),require('./api/faxAccount'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x33'),require(_0x3d74('0x34')));_0x17809a[_0x3d74('0x8')]('/api/fax/interactions',require(_0x3d74('0x35')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x36'),require(_0x3d74('0x37')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x38'),require('./api/faxQueue'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x39'),require(_0x3d74('0x3a')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x3b'),require(_0x3d74('0x3c')));_0x17809a[_0x3d74('0x8')]('/api/sms/applications',require(_0x3d74('0x3d')));_0x17809a[_0x3d74('0x8')]('/api/sms/interactions',require('./api/smsInteraction'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x3e'),require(_0x3d74('0x3f')));_0x17809a[_0x3d74('0x8')]('/api/sms/queues',require(_0x3d74('0x40')));_0x17809a['use'](_0x3d74('0x41'),require(_0x3d74('0x42')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x43'),require(_0x3d74('0x44')));_0x17809a[_0x3d74('0x8')]('/api/openchannel/interactions',require(_0x3d74('0x45')));_0x17809a['use'](_0x3d74('0x46'),require(_0x3d74('0x47')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x48'),require(_0x3d74('0x49')));_0x17809a['use'](_0x3d74('0x4a'),require('./api/chatWebsite'));_0x17809a['use'](_0x3d74('0x4b'),require(_0x3d74('0x4c')));_0x17809a[_0x3d74('0x8')]('/api/chat/applications',require(_0x3d74('0x4d')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x4e'),require(_0x3d74('0x4f')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x50'),require('./api/chatMessage'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x51'),require(_0x3d74('0x52')));_0x17809a[_0x3d74('0x8')]('/api/chat/queues',require('./api/chatQueue'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x53'),require('./api/chatGroup'));_0x17809a['use'](_0x3d74('0x54'),require(_0x3d74('0x55')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x56'),require(_0x3d74('0x57')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x58'),require(_0x3d74('0x59')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x5a'),require('./api/cmHopper'));_0x17809a[_0x3d74('0x8')]('/api/cm/hopper_black',require(_0x3d74('0x5b')));_0x17809a['use'](_0x3d74('0x5c'),require('./api/cmHopperFinal'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x5d'),require('./api/cmHopperHistory'));_0x17809a['use'](_0x3d74('0x5e'),require(_0x3d74('0x5f')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x60'),require(_0x3d74('0x61')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x62'),require(_0x3d74('0x63')));_0x17809a[_0x3d74('0x8')]('/api/canned_answers',require(_0x3d74('0x64')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x65'),require('./api/disposition'));_0x17809a[_0x3d74('0x8')]('/api/conditions',require(_0x3d74('0x66')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x67'),require('./api/interval'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x68'),require(_0x3d74('0x69')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x6a'),require(_0x3d74('0x6b')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x6c'),require('./api/voiceQueuesLog'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x6d'),require(_0x3d74('0x6e')));_0x17809a[_0x3d74('0x8')]('/api/sounds',require(_0x3d74('0x6f')));_0x17809a['use'](_0x3d74('0x70'),require(_0x3d74('0x71')));_0x17809a[_0x3d74('0x8')]('/api/contact_item_types',require(_0x3d74('0x72')));_0x17809a[_0x3d74('0x8')]('/api/cm_contact_has_items',require(_0x3d74('0x73')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x74'),require(_0x3d74('0x75')));_0x17809a['use']('/api/templates',require(_0x3d74('0x76')));_0x17809a['use']('/api/triggers',require('./api/trigger'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x77'),require(_0x3d74('0x78')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x79'),require('./api/integration'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x7a'),require(_0x3d74('0x7b')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x7c'),require(_0x3d74('0x7d')));_0x17809a['use'](_0x3d74('0x7e'),require(_0x3d74('0x7f')));_0x17809a['use'](_0x3d74('0x80'),require(_0x3d74('0x81')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x82'),require(_0x3d74('0x83')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x84'),require(_0x3d74('0x85')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x86'),require('./api/analyticTreeReport'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x87'),require(_0x3d74('0x88')));_0x17809a[_0x3d74('0x8')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x89'),require(_0x3d74('0x8a')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x8b'),require(_0x3d74('0x8c')));_0x17809a['use'](_0x3d74('0x8d'),require(_0x3d74('0x8e')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x8f'),require(_0x3d74('0x90')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x91'),require('./api/intDeskAccount'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x92'),require(_0x3d74('0x93')));_0x17809a[_0x3d74('0x8')]('/api/integrations/desk/fields',require(_0x3d74('0x94')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x95'),require(_0x3d74('0x96')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x97'),require(_0x3d74('0x98')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x99'),require(_0x3d74('0x9a')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x9b'),require(_0x3d74('0x9c')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x9d'),require(_0x3d74('0x9e')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x9f'),require(_0x3d74('0xa0')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xa1'),require('./api/intFreshdeskAccount'));_0x17809a[_0x3d74('0x8')](_0x3d74('0xa2'),require(_0x3d74('0xa3')));_0x17809a['use'](_0x3d74('0xa4'),require(_0x3d74('0xa5')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xa6'),require(_0x3d74('0xa7')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xa8'),require(_0x3d74('0xa9')));_0x17809a['use'](_0x3d74('0xaa'),require(_0x3d74('0xab')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xac'),require(_0x3d74('0xad')));_0x17809a[_0x3d74('0x8')]('/api/integrations/servicenow/configurations',require(_0x3d74('0xae')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xaf'),require(_0x3d74('0xb0')));_0x17809a[_0x3d74('0x8')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x17809a[_0x3d74('0x8')](_0x3d74('0xb1'),require(_0x3d74('0xb2')));_0x17809a['use']('/api/integrations/dynamics365/fields',require(_0x3d74('0xb3')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xb4'),require(_0x3d74('0xb5')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xb6'),require(_0x3d74('0xb7')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xb8'),require('./api/intFreshsalesField'));_0x17809a[_0x3d74('0x8')](_0x3d74('0xb9'),require(_0x3d74('0xba')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xbb'),require(_0x3d74('0xbc')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xbd'),require(_0x3d74('0xbe')));_0x17809a['use']('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x17809a[_0x3d74('0x8')](_0x3d74('0xbf'),require('./api/jscriptyQuestionReport'));_0x17809a[_0x3d74('0x8')]('/api/jscripty/sessions/reports',require(_0x3d74('0xc0')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xc1'),require(_0x3d74('0xc2')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xc3'),require(_0x3d74('0xc4')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xc5'),require(_0x3d74('0xc6')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xc7'),require(_0x3d74('0xc8')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xc9'),require('./api/setting'));_0x17809a['use'](_0x3d74('0xca'),require(_0x3d74('0xcb')));_0x17809a['use'](_0x3d74('0xcc'),require(_0x3d74('0xcd')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xce'),require('./api/squareRecording'));_0x17809a[_0x3d74('0x8')]('/api/square/messages',require(_0x3d74('0xcf')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xd0'),require('./api/team'));_0x17809a['use']('/api/license',require(_0x3d74('0xd1')));_0x17809a[_0x3d74('0x8')]('/api/campaigns',require(_0x3d74('0xd2')));_0x17809a['use']('/api/migrations',require(_0x3d74('0xd3')));_0x17809a[_0x3d74('0x8')]('/api/attachments',require(_0x3d74('0xd4')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xd5'),require('./api/plugin'));_0x17809a['use'](_0x3d74('0xd6'),require(_0x3d74('0xd7')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xd8'),require(_0x3d74('0xd9')));_0x17809a['use'](_0x3d74('0xda'),require(_0x3d74('0xdb')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xdc'),require(_0x3d74('0xdd')));_0x17809a['use'](_0x3d74('0xde'),require(_0x3d74('0xdf')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xe0'),require(_0x3d74('0xe1')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xe2'),require(_0x3d74('0xe3')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xe4'),require(_0x3d74('0xe5')));_0x17809a[_0x3d74('0x8')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x17809a['use'](_0x3d74('0xe6'),require(_0x3d74('0xe7')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xe8'),require('./api/userNotification'));_0x17809a[_0x3d74('0x8')](_0x3d74('0xe9'),require(_0x3d74('0xea')));_0x17809a[_0x3d74('0x8')]('/api/whatsapp/applications',require(_0x3d74('0xeb')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xec'),require(_0x3d74('0xed')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xee'),require(_0x3d74('0xef')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xf0'),require(_0x3d74('0xf1')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xf2'),require(_0x3d74('0xf3')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xf4'),require(_0x3d74('0xf5')));_0x17809a[_0x3d74('0x8')]('/api/cloudProviders',require(_0x3d74('0xf6')));_0x17809a[_0x3d74('0x8')]('/api/realtime',require(_0x3d74('0xf7')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xf8'),require(_0x3d74('0xf9')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xfa'),require(_0x3d74('0xfb')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xfc'),require(_0x3d74('0xfd')));_0x17809a['use'](_0x3d74('0xfe'),require('./api/authActiveDirectory'));_0x17809a[_0x3d74('0x8')](_0x3d74('0xff'),require(_0x3d74('0x100')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x101'),require(_0x3d74('0x102')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x103'),require(_0x3d74('0x104')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x105'),require(_0x3d74('0x106')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x107'),require(_0x3d74('0x108')));_0x17809a['use'](_0x3d74('0x109'),require(_0x3d74('0x10a')));_0x17809a[_0x3d74('0x8')]('/api/logs',clientSideLogs);_0x17809a['use'](_0x3d74('0x10b'),express[_0x3d74('0x10c')](path[_0x3d74('0x10d')](config['root'],_0x3d74('0x10b'))));_0x17809a['use']('/www',express[_0x3d74('0x10c')](path['join'](config[_0x3d74('0x10e')],_0x3d74('0x10f'))));_0x17809a[_0x3d74('0x8')](_0x3d74('0x110'),express['static'](path[_0x3d74('0x10d')](config[_0x3d74('0x10e')],'/demo')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x111'),express[_0x3d74('0x10c')](path[_0x3d74('0x10d')](config[_0x3d74('0x10e')],_0x3d74('0x112'),_0x3d74('0x113'))));_0x17809a['use'](_0x3d74('0x114'),express[_0x3d74('0x10c')](path['join'](config['root'],_0x3d74('0x115'))));_0x17809a[_0x3d74('0x116')](_0x3d74('0x117'))[_0x3d74('0x118')](errors[0x194]);_0x17809a[_0x3d74('0x116')]('/*')[_0x3d74('0x118')](function(_0xde684e,_0xcf3037){_0xcf3037[_0x3d74('0x119')](path[_0x3d74('0x11a')](_0x17809a[_0x3d74('0x118')](_0x3d74('0x11b'))+_0x3d74('0x11c')));});return _0x17809a;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index eb07d42..3457a63 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f9e=['../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc'];(function(_0x9577ff,_0x168745){var _0x3465cd=function(_0x46832f){while(--_0x46832f){_0x9577ff['push'](_0x9577ff['shift']());}};_0x3465cd(++_0x168745);}(_0x9f9e,0x183));var _0xe9f9=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x9f9e[_0xb833b1];return _0x1ab87a;};'use strict';var jayson=require(_0xe9f9('0x0'));var _=require('lodash');var config=require(_0xe9f9('0x1'));exports[_0xe9f9('0x2')]=function(){return new Promise(function(_0x4ec936,_0x47d3e4){var _0x12de63={};_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x4')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x5')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x6')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x7')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x8')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x9')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0xa')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0xb')));_0x12de63=_['merge'](_0x12de63,require('../api/trunk/trunk.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0xc')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x12de63=_['merge'](_0x12de63,require('../api/mailServerIn/mailServerIn.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0xd')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0xe')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0xf')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/mailMessage/mailMessage.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x10')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x11')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x12')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x13')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x14')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x15')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x16')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x17')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/smsAccount/smsAccount.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x18')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x19')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x1a')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x1b')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x1c')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x1d')));_0x12de63=_['merge'](_0x12de63,require('../api/chatInteraction/chatInteraction.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x1e')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/chatQueue/chatQueue.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/cmContact/cmContact.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x1f')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x20')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x21')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x22')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x12de63=_['merge'](_0x12de63,require('../api/interval/interval.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/pause/pause.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x23')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x24')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x25')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x26')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x27')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x28')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x29')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x2a')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x2b')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x2c')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x2d')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x2e')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x2f')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x30')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x31')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x32')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x33')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x34')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x35')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x36')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require('../api/squareRecording/squareRecording.rpc'));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x37')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x38')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x39')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x3a')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x3b')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x3c')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x3d')));_0x12de63=_['merge'](_0x12de63,require(_0xe9f9('0x3e')));_0x12de63=_[_0xe9f9('0x3')](_0x12de63,require(_0xe9f9('0x3f')));var _0x39561e=jayson['server'](_0x12de63)['http']();var _0x593774=config[_0xe9f9('0x40')][_0xe9f9('0x41')]||config['port']+0x1;var _0x1dcff2=config['rpc']['ip']||_0xe9f9('0x42');_0x39561e['on'](_0xe9f9('0x43'),function(_0x2f6624){return _0x47d3e4(_0x2f6624);});_0x39561e[_0xe9f9('0x2')](_0x593774,_0x1dcff2,function(){console['log'](_0xe9f9('0x44'),_0x1dcff2,_0x593774);require('../config/triggers')[_0xe9f9('0x45')]();return _0x4ec936(_0xe9f9('0x46')+_0x1dcff2+':'+_0x593774);});});}; \ No newline at end of file +var _0x07b5=['server','http','port','rpc','localhost','error','listen','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/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','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc'];(function(_0x35727b,_0x3a93ad){var _0x1e7e2d=function(_0x439a61){while(--_0x439a61){_0x35727b['push'](_0x35727b['shift']());}};_0x1e7e2d(++_0x3a93ad);}(_0x07b5,0x1ed));var _0x507b=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x07b5[_0x2070da];return _0x4f9fe1;};'use strict';var jayson=require(_0x507b('0x0'));var _=require('lodash');var config=require(_0x507b('0x1'));exports['listen']=function(){return new Promise(function(_0x36fa86,_0x55ec4e){var _0x7ec702={};_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x3')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x4')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x5')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x6')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x7')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x8')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x9')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/memberReport/memberReport.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0xa')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0xb')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/mailServerIn/mailServerIn.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0xc')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0xd')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0xe')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0xf')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x10')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x11')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x12')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x13')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x14')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x15')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x16')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/smsAccount/smsAccount.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/smsInteraction/smsInteraction.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x17')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x18')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x19')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x1a')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x1b')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x1c')));_0x7ec702=_['merge'](_0x7ec702,require('../api/chatInteraction/chatInteraction.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x1d')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x1e')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/cmContact/cmContact.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x1f')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x20')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x21')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x22')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x23')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/interval/interval.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/pause/pause.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x24')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x25')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x26')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x27')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x28')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x29')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x2a')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x2b')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x2c')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x2d')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x2e')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x2f')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x30')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/squareReport/squareReport.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x31')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x32')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x33')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x34')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/squareRecording/squareRecording.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x35')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x36')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/attachment/attachment.rpc'));_0x7ec702=_['merge'](_0x7ec702,require('../api/plugin/plugin.rpc'));_0x7ec702=_['merge'](_0x7ec702,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x37')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x38')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x39')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x3a')));var _0xf4aa3b=jayson[_0x507b('0x3b')](_0x7ec702)[_0x507b('0x3c')]();var _0x378ad7=config['rpc'][_0x507b('0x3d')]||config[_0x507b('0x3d')]+0x1;var _0x4b5e55=config[_0x507b('0x3e')]['ip']||_0x507b('0x3f');_0xf4aa3b['on'](_0x507b('0x40'),function(_0x524296){return _0x55ec4e(_0x524296);});_0xf4aa3b[_0x507b('0x41')](_0x378ad7,_0x4b5e55,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x4b5e55,_0x378ad7);require(_0x507b('0x42'))[_0x507b('0x43')]();return _0x36fa86(_0x507b('0x44')+_0x4b5e55+':'+_0x378ad7);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index b9fa59e..67bedfd 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 _0xb3a9=['SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','wait','WAIT','label','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520-Invalid','function','replace','result=','indexOf','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','inherits','prototype','sendRequest','command','sync','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','isArray','EXEC\x20%s\x20%s','setContext','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber'];(function(_0x5b5347,_0x3c9cbd){var _0x2a6698=function(_0x21ca57){while(--_0x21ca57){_0x5b5347['push'](_0x5b5347['shift']());}};_0x2a6698(++_0x3c9cbd);}(_0xb3a9,0xa2));var _0x9b3a=function(_0x141d91,_0x3b60eb){_0x141d91=_0x141d91-0x0;var _0x1a21eb=_0xb3a9[_0x141d91];return _0x1a21eb;};'use strict';var util=require(_0x9b3a('0x0'));var _=require(_0x9b3a('0x1'));var EventEmitter=require(_0x9b3a('0x2'))[_0x9b3a('0x3')];var AGIReply=require(_0x9b3a('0x4'));var AGIError=require(_0x9b3a('0x5'));function AGIChannel(_0x48fc6f){var _0x2b1e25=this,_0xf3f015=new AGIReply(),_0x49ffcf=![],_0x182913={};EventEmitter[_0x9b3a('0x6')](_0x2b1e25);_0x48fc6f[_0x9b3a('0x7')](_0x9b3a('0x8'));_0x48fc6f[_0x9b3a('0x9')](0x8*0x3c*0x3c*0x3e8);_0xf3f015[_0x9b3a('0x7')](_0x9b3a('0x8'));_0xf3f015['on']('headers',function(_0xd7cb7c){for(var _0x5a9e15 in _0xd7cb7c){_0x2b1e25[_0x5a9e15]=_0xd7cb7c[_0x5a9e15];}_0x2b1e25[_0x9b3a('0xa')](_0x9b3a('0xb'));});_0xf3f015['on']('line',function(_0x3cb1df){if(_0x3cb1df[_0x9b3a('0xc')]()==_0x9b3a('0xd')){_0x2b1e25[_0x9b3a('0xa')](_0x9b3a('0xd'));return;}if(_0x3cb1df[_0x9b3a('0xe')](0x0,0xb)==_0x9b3a('0xf')){_0x49ffcf=!![];}if(_0x49ffcf){_0x182913['rx']+=_0x3cb1df+'\x0a';if(_0x3cb1df['search']('520\x20End\x20of\x20proper')!=-0x1){_0x49ffcf=![];}}else{_0x182913['rx']=_0x3cb1df;}if(_0x49ffcf){return;}if(typeof _0x182913['cb']==_0x9b3a('0x10')){var _0x39e268=_0x182913['rx'][_0x9b3a('0xe')](0x0,0x3),_0x34274c=null,_0x31383d=null;_0x39e268=parseInt(_0x39e268);if(isNaN(_0x39e268)){_0x182913['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x39e268!=0xc8){_0x182913['cb'](null,{'code':_0x39e268,'result':-0x1,'extra':'KO'});return;}_0x34274c=_0x182913['rx'][_0x9b3a('0xe')](0x4)[_0x9b3a('0x11')](_0x9b3a('0x12'),'');if(_0x34274c[_0x9b3a('0x13')]('\x20')!=-0x1){_0x34274c=_0x34274c['substr'](0x0,_0x34274c[_0x9b3a('0x13')]('\x20'));}if(_[_0x9b3a('0x14')](_0x34274c,'-1')){_0x34274c=parseInt(_0x34274c);}_0x31383d=_0x182913['rx'][_0x9b3a('0x15')]('\x20');if(_0x31383d['length']==0x3){_0x31383d=_0x31383d[0x2][_0x9b3a('0xe')](0x1,_0x31383d[0x2][_0x9b3a('0x16')]-0x1);}else if(_0x31383d[_0x9b3a('0x16')]>0x3){var _0x1c8a05=/\((.+)\)/;var _0x14f7c6=_0x182913['rx'][_0x9b3a('0x17')](_0x1c8a05);if(_0x14f7c6){_0x31383d=_0x14f7c6[0x1];}else{_0x31383d=null;}}else{_0x31383d=null;}_0x182913['cb'](null,{'code':_0x39e268,'result':_0x34274c,'extra':_0x31383d});}});_0x48fc6f['on'](_0x9b3a('0x18'),function(_0x2950a2){_0x2b1e25[_0x9b3a('0xa')](_0x9b3a('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x2950a2[_0x9b3a('0x19')]));});_0x48fc6f['on'](_0x9b3a('0x1a'),function(){_0x2b1e25[_0x9b3a('0xa')]('close',new AGIError(_0x9b3a('0x1b')));});_0x48fc6f['on'](_0x9b3a('0x1c'),function(){_0x2b1e25[_0x9b3a('0xa')](_0x9b3a('0x1c'),new AGIError(_0x9b3a('0x1d')));_0x48fc6f[_0x9b3a('0x1e')]();});_0x48fc6f[_0x9b3a('0x1f')](_0xf3f015);this['command']=function(_0x3b3308,_0x4cd288){var _0x3b3308=_0x3b3308||'',_0x4cd288=typeof _0x4cd288==_0x9b3a('0x10')?_0x4cd288:new Function();_0x182913={'tx':_0x3b3308,'rx':'','cb':_0x4cd288};_0x48fc6f['write'](_0x3b3308+'\x0a');},this[_0x9b3a('0x1a')]=function(){_0x48fc6f['destroy']();};}util[_0x9b3a('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x9b3a('0x21')][_0x9b3a('0x22')]=function(_0x4c0e57){return this[_0x9b3a('0x23')][_0x9b3a('0x24')](this,_0x4c0e57);};AGIChannel[_0x9b3a('0x21')][_0x9b3a('0x25')]=function(){return this[_0x9b3a('0x22')](_0x9b3a('0x26'));};AGIChannel[_0x9b3a('0x21')][_0x9b3a('0x27')]=function(_0xb472,_0x2d7ed6,_0x496004){_0xb472=_0xb472===undefined?'beep':_0xb472;_0x2d7ed6=_0x2d7ed6===undefined?'5':_0x2d7ed6;_0x496004=_0x496004===undefined?'1':_0x496004;return this['sendRequest'](util[_0x9b3a('0x28')](_0x9b3a('0x29'),_0xb472,_0x2d7ed6*0x3e8,_0x496004));};AGIChannel['prototype']['noop']=function(_0x12d3a4){_0x12d3a4=_0x12d3a4||'NO\x20MESSAGE';return this[_0x9b3a('0x22')](util[_0x9b3a('0x28')]('VERBOSE\x20\x22%s\x22',_0x12d3a4));};AGIChannel[_0x9b3a('0x21')]['exec']=function(_0x27a8de,_0x3a3fff){if(_[_0x9b3a('0x2a')](_0x3a3fff)){return this[_0x9b3a('0x22')](util[_0x9b3a('0x28')](_0x9b3a('0x2b'),_0x27a8de,_0x3a3fff['join'](',')));}return this['sendRequest'](util[_0x9b3a('0x28')](_0x9b3a('0x2b'),_0x27a8de,_0x3a3fff));};AGIChannel[_0x9b3a('0x21')][_0x9b3a('0x2c')]=function(_0x368375){return this[_0x9b3a('0x22')](util['format']('SET\x20CONTEXT\x20%s',_0x368375));};AGIChannel['prototype'][_0x9b3a('0x2d')]=function(_0x5e7a61){return this[_0x9b3a('0x22')](util[_0x9b3a('0x28')](_0x9b3a('0x2e'),_0x5e7a61));};AGIChannel[_0x9b3a('0x21')]['setPriority']=function(_0x2b502f){return this[_0x9b3a('0x22')](util['format'](_0x9b3a('0x2f'),_0x2b502f));};AGIChannel[_0x9b3a('0x21')]['hangup']=function(){return this[_0x9b3a('0x22')](_0x9b3a('0x30'));};AGIChannel[_0x9b3a('0x21')][_0x9b3a('0x31')]=function(_0x6a8720,_0x228777){var _0x10bcd2=_[_0x9b3a('0x32')](_0x228777)||_['isNumber'](_0x228777)?_0x228777[_0x9b3a('0x33')]():_0x228777;return this['sendRequest'](util[_0x9b3a('0x28')](_0x9b3a('0x34'),_0x6a8720,_0x10bcd2?_0x10bcd2[_0x9b3a('0x33')]()[_0x9b3a('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9b3a('0x21')][_0x9b3a('0x35')]=function(_0x2c9b0e,_0x2f9bfa){return this['sendRequest'](util['format'](_0x9b3a('0x36'),_0x2c9b0e,_0x2f9bfa));};AGIChannel[_0x9b3a('0x21')]['sayDigits']=function(_0x473ffe,_0x1e9abb){return this['sendRequest'](util[_0x9b3a('0x28')](_0x9b3a('0x37'),_0x473ffe,_0x1e9abb));};AGIChannel['prototype'][_0x9b3a('0x38')]=function(_0xf375f4,_0x615e4){return this[_0x9b3a('0x22')](util[_0x9b3a('0x28')](_0x9b3a('0x39'),_0xf375f4,_0x615e4));};AGIChannel['prototype'][_0x9b3a('0x3a')]=function(_0x50ba7d,_0x19698f,_0x5ea016){_0x19698f=_0x19698f||this[_0x9b3a('0x3b')];_0x5ea016=_0x5ea016||0x1;this[_0x9b3a('0x2c')](_0x50ba7d);this['setExtension'](_0x19698f);this['setPriority'](_0x5ea016);return this[_0x9b3a('0x3c')](util[_0x9b3a('0x28')](_0x9b3a('0x3d'),_0x50ba7d,_0x19698f,_0x5ea016));};AGIChannel[_0x9b3a('0x21')][_0x9b3a('0x3e')]=function(_0x5914d4){return this[_0x9b3a('0x22')](util[_0x9b3a('0x28')](_0x9b3a('0x3f'),_0x5914d4));};AGIChannel[_0x9b3a('0x21')]['recordFile']=function(_0x58a003,_0x2f832f,_0xb6c55e,_0x2f546a,_0x3261e3,_0x33d2c8){_0x2f832f=_0x2f832f||_0x9b3a('0x40');_0xb6c55e=_0xb6c55e||'';_0x2f546a=_0x2f546a===undefined?-0x1:_0x2f546a==='-1'?-0x1:_0x2f546a*0x3e8;_0x3261e3=_0x3261e3===undefined?'':'s='+_0x3261e3;_0x33d2c8=_0x33d2c8?'BEEP':'';return this[_0x9b3a('0x22')](util[_0x9b3a('0x28')](_0x9b3a('0x41'),_0x58a003,_0x2f832f,_0xb6c55e,_0x2f546a,_0x33d2c8,_0x3261e3));};AGIChannel[_0x9b3a('0x21')]['streamFile']=function(_0x5dfd68,_0x398cfd){_0x398cfd=_0x398cfd||'';return this[_0x9b3a('0x22')](util[_0x9b3a('0x28')](_0x9b3a('0x42'),_0x5dfd68,_0x398cfd));};AGIChannel['prototype'][_0x9b3a('0x43')]=function(_0x29f67c){return this[_0x9b3a('0x44')]('AGI',_0x29f67c);};AGIChannel[_0x9b3a('0x21')][_0x9b3a('0x45')]=function(_0x484791){return this[_0x9b3a('0x44')](_0x9b3a('0x46'),_0x484791);};AGIChannel[_0x9b3a('0x21')][_0x9b3a('0x18')]=function(_0x500594,_0x210c7d){this['noop'](util[_0x9b3a('0x28')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x500594['id'],_0x500594[_0x9b3a('0x47')],_0x210c7d));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x507b=['GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','agi','exec','AGI','WAIT','label','exports','lodash','EventEmitter','./reply','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','sendRequest','sync','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','getVariable'];(function(_0x1a1683,_0xb6dc22){var _0x7b42d1=function(_0x45d0bb){while(--_0x45d0bb){_0x1a1683['push'](_0x1a1683['shift']());}};_0x7b42d1(++_0xb6dc22);}(_0x507b,0x187));var _0xb507=function(_0x48c4b0,_0x6dfcba){_0x48c4b0=_0x48c4b0-0x0;var _0x1bfc9e=_0x507b[_0x48c4b0];return _0x1bfc9e;};'use strict';var util=require('util');var _=require(_0xb507('0x0'));var EventEmitter=require('events')[_0xb507('0x1')];var AGIReply=require(_0xb507('0x2'));var AGIError=require('./error');function AGIChannel(_0x3d0eb2){var _0x4a9af=this,_0xda9de6=new AGIReply(),_0x2a81c4=![],_0x3909b3={};EventEmitter['call'](_0x4a9af);_0x3d0eb2[_0xb507('0x3')](_0xb507('0x4'));_0x3d0eb2[_0xb507('0x5')](0x8*0x3c*0x3c*0x3e8);_0xda9de6[_0xb507('0x3')](_0xb507('0x4'));_0xda9de6['on'](_0xb507('0x6'),function(_0x2cfe10){for(var _0x1637c4 in _0x2cfe10){_0x4a9af[_0x1637c4]=_0x2cfe10[_0x1637c4];}_0x4a9af[_0xb507('0x7')](_0xb507('0x8'));});_0xda9de6['on'](_0xb507('0x9'),function(_0x2169b1){if(_0x2169b1[_0xb507('0xa')]()==_0xb507('0xb')){_0x4a9af[_0xb507('0x7')](_0xb507('0xb'));return;}if(_0x2169b1[_0xb507('0xc')](0x0,0xb)=='520-Invalid'){_0x2a81c4=!![];}if(_0x2a81c4){_0x3909b3['rx']+=_0x2169b1+'\x0a';if(_0x2169b1[_0xb507('0xd')](_0xb507('0xe'))!=-0x1){_0x2a81c4=![];}}else{_0x3909b3['rx']=_0x2169b1;}if(_0x2a81c4){return;}if(typeof _0x3909b3['cb']==_0xb507('0xf')){var _0x21e1bf=_0x3909b3['rx']['substring'](0x0,0x3),_0x44d796=null,_0x147ce8=null;_0x21e1bf=parseInt(_0x21e1bf);if(isNaN(_0x21e1bf)){_0x3909b3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xb507('0x10')});return;}if(_0x21e1bf!=0xc8){_0x3909b3['cb'](null,{'code':_0x21e1bf,'result':-0x1,'extra':'KO'});return;}_0x44d796=_0x3909b3['rx']['substring'](0x4)['replace']('result=','');if(_0x44d796[_0xb507('0x11')]('\x20')!=-0x1){_0x44d796=_0x44d796[_0xb507('0x12')](0x0,_0x44d796['indexOf']('\x20'));}if(_[_0xb507('0x13')](_0x44d796,'-1')){_0x44d796=parseInt(_0x44d796);}_0x147ce8=_0x3909b3['rx'][_0xb507('0x14')]('\x20');if(_0x147ce8['length']==0x3){_0x147ce8=_0x147ce8[0x2][_0xb507('0xc')](0x1,_0x147ce8[0x2][_0xb507('0x15')]-0x1);}else if(_0x147ce8[_0xb507('0x15')]>0x3){var _0x186cb9=/\((.+)\)/;var _0x13546b=_0x3909b3['rx'][_0xb507('0x16')](_0x186cb9);if(_0x13546b){_0x147ce8=_0x13546b[0x1];}else{_0x147ce8=null;}}else{_0x147ce8=null;}_0x3909b3['cb'](null,{'code':_0x21e1bf,'result':_0x44d796,'extra':_0x147ce8});}});_0x3d0eb2['on'](_0xb507('0x17'),function(_0xd6e7e2){_0x4a9af[_0xb507('0x7')](_0xb507('0x17'),new AGIError(_0xb507('0x18'),_0xd6e7e2[_0xb507('0x19')]));});_0x3d0eb2['on'](_0xb507('0x1a'),function(){_0x4a9af[_0xb507('0x7')](_0xb507('0x1a'),new AGIError(_0xb507('0x1b')));});_0x3d0eb2['on']('timeout',function(){_0x4a9af[_0xb507('0x7')]('timeout',new AGIError(_0xb507('0x1c')));_0x3d0eb2[_0xb507('0x1d')]();});_0x3d0eb2[_0xb507('0x1e')](_0xda9de6);this[_0xb507('0x1f')]=function(_0x2e1327,_0x3dd97a){var _0x2e1327=_0x2e1327||'',_0x3dd97a=typeof _0x3dd97a==_0xb507('0xf')?_0x3dd97a:new Function();_0x3909b3={'tx':_0x2e1327,'rx':'','cb':_0x3dd97a};_0x3d0eb2[_0xb507('0x20')](_0x2e1327+'\x0a');},this[_0xb507('0x1a')]=function(){_0x3d0eb2[_0xb507('0x1d')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xb507('0x21')][_0xb507('0x22')]=function(_0x31f130){return this[_0xb507('0x1f')][_0xb507('0x23')](this,_0x31f130);};AGIChannel[_0xb507('0x21')]['answer']=function(){return this['sendRequest'](_0xb507('0x24'));};AGIChannel[_0xb507('0x21')][_0xb507('0x25')]=function(_0x515caa,_0x3d6a18,_0x5150a8){_0x515caa=_0x515caa===undefined?_0xb507('0x26'):_0x515caa;_0x3d6a18=_0x3d6a18===undefined?'5':_0x3d6a18;_0x5150a8=_0x5150a8===undefined?'1':_0x5150a8;return this['sendRequest'](util[_0xb507('0x27')](_0xb507('0x28'),_0x515caa,_0x3d6a18*0x3e8,_0x5150a8));};AGIChannel[_0xb507('0x21')][_0xb507('0x29')]=function(_0x52a703){_0x52a703=_0x52a703||'NO\x20MESSAGE';return this['sendRequest'](util[_0xb507('0x27')](_0xb507('0x2a'),_0x52a703));};AGIChannel[_0xb507('0x21')]['exec']=function(_0x254e1e,_0x51288a){if(_['isArray'](_0x51288a)){return this[_0xb507('0x22')](util[_0xb507('0x27')](_0xb507('0x2b'),_0x254e1e,_0x51288a[_0xb507('0x2c')](',')));}return this['sendRequest'](util['format'](_0xb507('0x2b'),_0x254e1e,_0x51288a));};AGIChannel['prototype'][_0xb507('0x2d')]=function(_0x458db2){return this[_0xb507('0x22')](util['format'](_0xb507('0x2e'),_0x458db2));};AGIChannel[_0xb507('0x21')][_0xb507('0x2f')]=function(_0x1196ab){return this[_0xb507('0x22')](util[_0xb507('0x27')](_0xb507('0x30'),_0x1196ab));};AGIChannel[_0xb507('0x21')][_0xb507('0x31')]=function(_0x429d9b){return this[_0xb507('0x22')](util[_0xb507('0x27')](_0xb507('0x32'),_0x429d9b));};AGIChannel[_0xb507('0x21')]['hangup']=function(){return this[_0xb507('0x22')]('HANGUP');};AGIChannel[_0xb507('0x21')]['setVariable']=function(_0x1280ef,_0x260efc){var _0x2f52ed=_[_0xb507('0x33')](_0x260efc)||_[_0xb507('0x34')](_0x260efc)?_0x260efc['toString']():_0x260efc;return this[_0xb507('0x22')](util[_0xb507('0x27')](_0xb507('0x35'),_0x1280ef,_0x2f52ed?_0x2f52ed[_0xb507('0x36')]()[_0xb507('0x37')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xb507('0x38')]=function(_0x5c8bbb,_0x4003b9){return this[_0xb507('0x22')](util[_0xb507('0x27')](_0xb507('0x39'),_0x5c8bbb,_0x4003b9));};AGIChannel[_0xb507('0x21')][_0xb507('0x3a')]=function(_0x12e0ef,_0x1d2051){return this[_0xb507('0x22')](util['format'](_0xb507('0x3b'),_0x12e0ef,_0x1d2051));};AGIChannel[_0xb507('0x21')][_0xb507('0x3c')]=function(_0x9a4397,_0x59132c){return this[_0xb507('0x22')](util[_0xb507('0x27')](_0xb507('0x3d'),_0x9a4397,_0x59132c));};AGIChannel[_0xb507('0x21')][_0xb507('0x3e')]=function(_0x37b71e,_0x588a4d,_0xd5db41){_0x588a4d=_0x588a4d||this[_0xb507('0x3f')];_0xd5db41=_0xd5db41||0x1;this[_0xb507('0x2d')](_0x37b71e);this['setExtension'](_0x588a4d);this[_0xb507('0x31')](_0xd5db41);return this['noop'](util[_0xb507('0x27')]('GOTO\x20%s\x20%s\x20%s',_0x37b71e,_0x588a4d,_0xd5db41));};AGIChannel[_0xb507('0x21')][_0xb507('0x40')]=function(_0x24f6cd){return this[_0xb507('0x22')](util['format'](_0xb507('0x41'),_0x24f6cd));};AGIChannel['prototype'][_0xb507('0x42')]=function(_0x219edc,_0x5766de,_0x2ac412,_0x1388ab,_0x1d38ff,_0x57ef4a){_0x5766de=_0x5766de||_0xb507('0x43');_0x2ac412=_0x2ac412||'';_0x1388ab=_0x1388ab===undefined?-0x1:_0x1388ab==='-1'?-0x1:_0x1388ab*0x3e8;_0x1d38ff=_0x1d38ff===undefined?'':'s='+_0x1d38ff;_0x57ef4a=_0x57ef4a?_0xb507('0x44'):'';return this[_0xb507('0x22')](util[_0xb507('0x27')](_0xb507('0x45'),_0x219edc,_0x5766de,_0x2ac412,_0x1388ab,_0x57ef4a,_0x1d38ff));};AGIChannel[_0xb507('0x21')]['streamFile']=function(_0x330e42,_0x4e0216){_0x4e0216=_0x4e0216||'';return this[_0xb507('0x22')](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x330e42,_0x4e0216));};AGIChannel[_0xb507('0x21')][_0xb507('0x46')]=function(_0xd1b4bf){return this[_0xb507('0x47')](_0xb507('0x48'),_0xd1b4bf);};AGIChannel[_0xb507('0x21')]['wait']=function(_0x51a564){return this['exec'](_0xb507('0x49'),_0x51a564);};AGIChannel[_0xb507('0x21')]['error']=function(_0x38a490,_0x21080e){this[_0xb507('0x29')](util[_0xb507('0x27')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x38a490['id'],_0x38a490[_0xb507('0x4a')],_0x21080e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xb507('0x4b')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 83195c4..ce28bf4 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 _0xbd0e=['name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message'];(function(_0x5e295c,_0x4a2c73){var _0x5899aa=function(_0x25fecf){while(--_0x25fecf){_0x5e295c['push'](_0x5e295c['shift']());}};_0x5899aa(++_0x4a2c73);}(_0xbd0e,0x1a2));var _0xebd0=function(_0xc0d9bc,_0x2bd6be){_0xc0d9bc=_0xc0d9bc-0x0;var _0x32ff73=_0xbd0e[_0xc0d9bc];return _0x32ff73;};'use strict';var util=require(_0xebd0('0x0'));var error={'E_AGI_UNDEFINED':_0xebd0('0x1'),'E_AGI_ARGUMENT_PORT':_0xebd0('0x2'),'E_AGI_SERVER_ERROR':_0xebd0('0x3'),'E_AGI_SERVER_CLOSE':_0xebd0('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xebd0('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xebd0('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xebd0('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xebd0('0x8'),'E_AGI_IVR_ENTRY':_0xebd0('0x9')};function AGIError(_0x3b3ae1){var _0x3b3ae1=_0x3b3ae1||null,_0x45bd90=_0x45bd90||[],_0x13befc=0x1,_0xc6a043='';if(!error[_0x3b3ae1]){_0x3b3ae1='E_AGI_UNDEFINED';}_0x45bd90[_0xebd0('0xa')](error[_0x3b3ae1]);while(arguments[_0x13befc]){_0x45bd90[_0xebd0('0xa')](arguments[_0x13befc]);_0x13befc++;}_0xc6a043=util[_0xebd0('0xb')][_0xebd0('0xc')](util,_0x45bd90);this[_0xebd0('0xd')]=_0xc6a043;this[_0xebd0('0xe')]=_0x3b3ae1;}module[_0xebd0('0xf')]=AGIError; \ No newline at end of file +var _0x8603=['util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports'];(function(_0x2e189a,_0x51bd30){var _0x446416=function(_0x2fdcbe){while(--_0x2fdcbe){_0x2e189a['push'](_0x2e189a['shift']());}};_0x446416(++_0x51bd30);}(_0x8603,0x1d1));var _0x3860=function(_0x469ed3,_0x3c1e7b){_0x469ed3=_0x469ed3-0x0;var _0x11dff4=_0x8603[_0x469ed3];return _0x11dff4;};'use strict';var util=require(_0x3860('0x0'));var error={'E_AGI_UNDEFINED':_0x3860('0x1'),'E_AGI_ARGUMENT_PORT':_0x3860('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x3860('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x3860('0x4'),'E_AGI_SOCKET_TIMEOUT':_0x3860('0x5'),'E_AGI_COMMAND_EMPTY':_0x3860('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x3860('0x7')};function AGIError(_0x167994){var _0x167994=_0x167994||null,_0x21b20f=_0x21b20f||[],_0x57bb74=0x1,_0x90419d='';if(!error[_0x167994]){_0x167994=_0x3860('0x8');}_0x21b20f[_0x3860('0x9')](error[_0x167994]);while(arguments[_0x57bb74]){_0x21b20f['push'](arguments[_0x57bb74]);_0x57bb74++;}_0x90419d=util[_0x3860('0xa')][_0x3860('0xb')](util,_0x21b20f);this[_0x3860('0xc')]=_0x90419d;this[_0x3860('0xd')]=_0x167994;}module[_0x3860('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 2521d9b..f15e582 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa82=['ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe','agi','emit','error','message','parse','projectUpdate','exports','lodash','events','EventEmitter'];(function(_0x3e76da,_0x2efe2b){var _0x3f433d=function(_0x5002af){while(--_0x5002af){_0x3e76da['push'](_0x3e76da['shift']());}};_0x3f433d(++_0x2efe2b);}(_0xfa82,0x151));var _0x2fa8=function(_0x54c27c,_0x4047e5){_0x54c27c=_0x54c27c-0x0;var _0x224b78=_0xfa82[_0x54c27c];return _0x224b78;};'use strict';var _=require(_0x2fa8('0x0'));var EventEmitter=require(_0x2fa8('0x1'))[_0x2fa8('0x2')];var Redis=require(_0x2fa8('0x3'));var AGIError=require(_0x2fa8('0x4'));var config=require(_0x2fa8('0x5'));config[_0x2fa8('0x6')]=_[_0x2fa8('0x7')](config['redis'],{'host':_0x2fa8('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x2fa8('0x6')]);sub[_0x2fa8('0x9')](_0x2fa8('0xa'),function(_0x398578){if(_0x398578)return eventEmitter[_0x2fa8('0xb')](_0x2fa8('0xc'),new AGIError('E_AGI_SERVER_ERROR',_0x398578));});sub['on'](_0x2fa8('0xd'),function(_0x41eafc,_0x55beb3){if(_0x41eafc!==_0x2fa8('0xa'))return;try{var _0xcc1be=JSON[_0x2fa8('0xe')](_0x55beb3);eventEmitter['emit'](_0x2fa8('0xf'),_0xcc1be);}catch(_0x19f52f){eventEmitter['emit'](_0x2fa8('0xc'),new AGIError('E_AGI_SERVER_ERROR',_0x19f52f));}});module[_0x2fa8('0x10')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xf6ed=['error','message','emit','projectUpdate','E_AGI_SERVER_ERROR','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','localhost','subscribe','agi'];(function(_0x2afce3,_0x1e99fa){var _0x1c88d8=function(_0x57902d){while(--_0x57902d){_0x2afce3['push'](_0x2afce3['shift']());}};_0x1c88d8(++_0x1e99fa);}(_0xf6ed,0x196));var _0xdf6e=function(_0x48ef7c,_0x29c5b8){_0x48ef7c=_0x48ef7c-0x0;var _0x2a5967=_0xf6ed[_0x48ef7c];return _0x2a5967;};'use strict';var _=require(_0xdf6e('0x0'));var EventEmitter=require(_0xdf6e('0x1'))[_0xdf6e('0x2')];var Redis=require(_0xdf6e('0x3'));var AGIError=require(_0xdf6e('0x4'));var config=require(_0xdf6e('0x5'));config[_0xdf6e('0x6')]=_['defaults'](config[_0xdf6e('0x6')],{'host':_0xdf6e('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xdf6e('0x6')]);sub[_0xdf6e('0x8')](_0xdf6e('0x9'),function(_0x459bb3){if(_0x459bb3)return eventEmitter['emit'](_0xdf6e('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x459bb3));});sub['on'](_0xdf6e('0xb'),function(_0x3c0a90,_0x3e2611){if(_0x3c0a90!==_0xdf6e('0x9'))return;try{var _0x2623f0=JSON['parse'](_0x3e2611);eventEmitter[_0xdf6e('0xc')](_0xdf6e('0xd'),_0x2623f0);}catch(_0xfb3969){eventEmitter[_0xdf6e('0xc')](_0xdf6e('0xa'),new AGIError(_0xdf6e('0xe'),_0xfb3969));}});module[_0xdf6e('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 9a6e231..7065970 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 _0x0f4d=['getdigits','vertices','numberOfEdges','prototype','addVertex','edges','addEdge','push','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','vswitch','target','default','agicommand','invalid','includes','max\x20retry\x20reach','condition\x20not\x20found','../../../config/logger','menu'];(function(_0x44594e,_0x1a0374){var _0x10af21=function(_0x30b448){while(--_0x30b448){_0x44594e['push'](_0x44594e['shift']());}};_0x10af21(++_0x1a0374);}(_0x0f4d,0xde));var _0xd0f4=function(_0x8667c3,_0x1bc32f){_0x8667c3=_0x8667c3-0x0;var _0x435540=_0x0f4d[_0x8667c3];return _0x435540;};'use strict';var _=require('lodash');var logger=require(_0xd0f4('0x0'))('agi');var verticesWithRetry=[_0xd0f4('0x1'),_0xd0f4('0x2'),'getsecretdigits'];var Graph=function(){this[_0xd0f4('0x3')]={};this['edges']={};this[_0xd0f4('0x4')]=0x0;};Graph[_0xd0f4('0x5')][_0xd0f4('0x6')]=function(_0x139ea3){this[_0xd0f4('0x3')][_0x139ea3['id']]=_0x139ea3;this[_0xd0f4('0x7')][_0x139ea3['id']]=[];};Graph[_0xd0f4('0x5')][_0xd0f4('0x8')]=function(_0xda8bb5,_0x4669d7,_0x5ee15f){this[_0xd0f4('0x7')][_0xda8bb5][_0xd0f4('0x9')]({'target':_0x4669d7,'condition':_0x5ee15f});this[_0xd0f4('0x4')]+=0x1;};Graph['prototype'][_0xd0f4('0xa')]=function(){return _[_0xd0f4('0xa')](this['vertices']);};Graph[_0xd0f4('0x5')][_0xd0f4('0xb')]=function(){return this[_0xd0f4('0x4')];};Graph[_0xd0f4('0x5')][_0xd0f4('0xc')]=function(_0x4e99a1){return this['vertices'][_0x4e99a1];};Graph[_0xd0f4('0x5')][_0xd0f4('0xd')]=function(_0x4993db,_0x4c56c6){if(!this[_0xd0f4('0x3')][_0x4993db]){return logger['info'](_0xd0f4('0xe'));}var _0x3d627b=_0x4c56c6(this[_0xd0f4('0x3')][_0x4993db]);if(!_0x3d627b){return logger[_0xd0f4('0xf')](_0xd0f4('0x10'));}if(this[_0xd0f4('0x7')][_0x4993db][_0xd0f4('0x11')]===0x0){return logger['info'](_0xd0f4('0x12'));}for(var _0x5c67c1=0x0,_0x1502f4=[],_0x39d6ec=![];_0x5c67c1\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','stringify','timeout','hangup','find','handleNotFound','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','getAll','./server','connection','close','lodash','syncho','util','../../config/logger','agi','../../config/license/util','EventEmitter','defaults','projectUpdate','nextTick','error'];(function(_0x36b6b4,_0x48813c){var _0x44f801=function(_0x369a62){while(--_0x369a62){_0x36b6b4['push'](_0x36b6b4['shift']());}};_0x44f801(++_0x48813c);}(_0xe35a,0x14b));var _0xae35=function(_0x3b30d6,_0xf98295){_0x3b30d6=_0x3b30d6-0x0;var _0x1ecef4=_0xe35a[_0x3b30d6];return _0x1ecef4;};'use strict';var _=require(_0xae35('0x0'));var syncho=require(_0xae35('0x1'));var util=require(_0xae35('0x2'));var config=require('../../config/environment');var logger=require(_0xae35('0x3'))(_0xae35('0x4'));var utilLicense=require(_0xae35('0x5'));var rpc=require('./rpc');var Project=require('./project');var AGIEmitter=require('./events')[_0xae35('0x6')];var projects=[];config[_0xae35('0x4')]=_[_0xae35('0x7')](config[_0xae35('0x4')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xae35('0x8'),projectUpdateHandler);function connectionHandler(_0x2b3e2f){process[_0xae35('0x9')](function(){syncho(function(){try{setChannelVariables(_0x2b3e2f);agiHandler(_0x2b3e2f);}catch(_0x5075b6){logger[_0xae35('0xa')](_0x5075b6[_0xae35('0xb')]);}});});}function projectUpdateHandler(_0x2b11ea){try{var _0x430b99=_[_0xae35('0xc')](projects,['id',_0x2b11ea['id']]);if(_0x430b99>-0x1){if(_0x2b11ea[_0xae35('0xd')]===!![]){projects[_0xae35('0xe')](_0x430b99,0x1);}else{projects[_0x430b99]=_0x2b11ea;}}else{projects[_0xae35('0xf')](_0x2b11ea);}}catch(_0x1c8d71){logger[_0xae35('0xa')](_0x1c8d71[_0xae35('0xb')]);}}function listeningHandler(){console[_0xae35('0x10')](_0xae35('0x11'),config[_0xae35('0x4')][_0xae35('0x12')]);logger['info'](util['format'](_0xae35('0x13'),config[_0xae35('0x4')]['ip'],config[_0xae35('0x4')][_0xae35('0x12')]));}function errorHandler(_0x1f31fe){if(_0x1f31fe&&_0x1f31fe[_0xae35('0x14')]&&_0x1f31fe['message']){logger[_0xae35('0xa')](util[_0xae35('0x15')]('[%s]\x20%s',_0x1f31fe['name'],_0x1f31fe[_0xae35('0x16')]));}else{logger[_0xae35('0xa')](util[_0xae35('0x15')](_0xae35('0x17'),_0x1f31fe[_0xae35('0xb')]));}}function closeHandler(){logger[_0xae35('0x18')](util['format'](_0xae35('0x19'),this[_0xae35('0x1a')],this[_0xae35('0x1b')],this['callerid'],this['dnid'],this[_0xae35('0x1c')]));try{createSquareReport(this);}catch(_0x391b3c){logger['error'](_0x391b3c['stack']);}}function timeoutHandler(){logger['info'](util[_0xae35('0x15')](_0xae35('0x1d'),this['arg_1'],this[_0xae35('0x1b')],this[_0xae35('0x1e')],this[_0xae35('0x1f')],this['uniqueid']));}function hangupHandler(){logger[_0xae35('0x18')](util[_0xae35('0x15')](_0xae35('0x20'),this[_0xae35('0x1a')],this[_0xae35('0x1b')],this['callerid'],this[_0xae35('0x1f')],this[_0xae35('0x1c')]));this[_0xae35('0x21')]=!![];}function createSquareReport(_0x419bff,_0x4b3d8c){rpc[_0xae35('0x22')](_0x419bff)[_0xae35('0x23')](function(_0xf91241){if(_0x4b3d8c){_0x4b3d8c(null,_0xf91241);}})[_0xae35('0x24')](function(_0x1f2017){if(_0x4b3d8c){_0x4b3d8c(null,_0x1f2017);}});}function setChannelVariables(_0x31b6d7){for(var _0x23569d in _0x31b6d7){if(_0x31b6d7[_0xae35('0x25')](_0x23569d)){if(_0x23569d[_0xae35('0x26')](_0xae35('0x27'))===0x0){_0x31b6d7[_0x23569d[_0xae35('0x28')](0x4)]=_0x31b6d7[_0x23569d];delete _0x31b6d7[_0x23569d];}}}}function agiHandler(_0x403d7b){logger[_0xae35('0x29')]('variables',JSON[_0xae35('0x2a')](_0x403d7b,null,0x2));logger[_0xae35('0x18')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x403d7b['arg_1'],_0x403d7b[_0xae35('0x1b')],_0x403d7b[_0xae35('0x1e')],_0x403d7b['dnid'],_0x403d7b[_0xae35('0x1c')]));_0x403d7b['on']('error',errorHandler);_0x403d7b['on']('close',closeHandler);_0x403d7b['on'](_0xae35('0x2b'),timeoutHandler);_0x403d7b[_0xae35('0x21')]=![];_0x403d7b['on'](_0xae35('0x2c'),hangupHandler);var _0x2d357f=_[_0xae35('0x2d')](projects,[_0xae35('0x14'),_0x403d7b['arg_1']]);if(!_0x2d357f)return Project[_0xae35('0x2e')](_0x403d7b);if(!_0x2d357f[_0xae35('0x2f')])return Project['handleUnpublished'](_0x403d7b);return Project[_0xae35('0x30')](_0x2d357f,_0x403d7b);}function main(){var _0x4c6043;return utilLicense[_0xae35('0x31')]()[_0xae35('0x23')](function(_0x589cb4){if(!_0x589cb4)return;if(_0x589cb4[_0xae35('0x32')]){if(_0x589cb4[_0xae35('0x33')]&&_0x589cb4['callysquare']>0x0){logger[_0xae35('0x18')](util['format'](_0xae35('0x34'),_0x589cb4[_0xae35('0x33')]));_0x4c6043=_0x589cb4['callysquare'];}else{logger[_0xae35('0x18')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xae35('0x18')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x4c6043=-0x1;}})[_0xae35('0x23')](function(){return Project[_0xae35('0x35')]();})['then'](function(_0x2d557b){projects=_0x2d557b;return;})[_0xae35('0x24')](function(_0x2cb357){logger[_0xae35('0xa')]('[LICENSE]',_0x2cb357[_0xae35('0xb')]);})['finally'](function(){var _0x39c256=require(_0xae35('0x36'))(config['agi'][_0xae35('0x12')],config[_0xae35('0x4')]['ip'],_0x4c6043);_0x39c256['on'](_0xae35('0xa'),errorHandler);_0x39c256['on']('listening',listeningHandler);_0x39c256['on'](_0xae35('0x37'),connectionHandler);_0x39c256['on'](_0xae35('0x38'),closeHandler);});}main(); \ No newline at end of file +var _0x0937=['getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','catch','[LICENSE]','finally','./server','connection','lodash','syncho','../../config/environment','../../config/logger','../../config/license/util','./project','./events','EventEmitter','projectUpdate','nextTick','stack','findIndex','deleted','splice','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','agi','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','callerid','evtHangup','createSquareReport','then','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','hangup','handleNotFound','production','handleUnpublished','initialize'];(function(_0xb4c33c,_0x2c80cd){var _0x557bd5=function(_0x25ff4e){while(--_0x25ff4e){_0xb4c33c['push'](_0xb4c33c['shift']());}};_0x557bd5(++_0x2c80cd);}(_0x0937,0x132));var _0x7093=function(_0x51f8d7,_0x239ea6){_0x51f8d7=_0x51f8d7-0x0;var _0x11d45f=_0x0937[_0x51f8d7];return _0x11d45f;};'use strict';var _=require(_0x7093('0x0'));var syncho=require(_0x7093('0x1'));var util=require('util');var config=require(_0x7093('0x2'));var logger=require(_0x7093('0x3'))('agi');var utilLicense=require(_0x7093('0x4'));var rpc=require('./rpc');var Project=require(_0x7093('0x5'));var AGIEmitter=require(_0x7093('0x6'))[_0x7093('0x7')];var projects=[];config['agi']=_['defaults'](config['agi'],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x7093('0x8'),projectUpdateHandler);function connectionHandler(_0x35177d){process[_0x7093('0x9')](function(){syncho(function(){try{setChannelVariables(_0x35177d);agiHandler(_0x35177d);}catch(_0x4aabe3){logger['error'](_0x4aabe3[_0x7093('0xa')]);}});});}function projectUpdateHandler(_0x1ef053){try{var _0x48851a=_[_0x7093('0xb')](projects,['id',_0x1ef053['id']]);if(_0x48851a>-0x1){if(_0x1ef053[_0x7093('0xc')]===!![]){projects[_0x7093('0xd')](_0x48851a,0x1);}else{projects[_0x48851a]=_0x1ef053;}}else{projects['push'](_0x1ef053);}}catch(_0x361b25){logger[_0x7093('0xe')](_0x361b25[_0x7093('0xa')]);}}function listeningHandler(){console[_0x7093('0xf')](_0x7093('0x10'),config[_0x7093('0x11')][_0x7093('0x12')]);logger['info'](util[_0x7093('0x13')](_0x7093('0x14'),config['agi']['ip'],config[_0x7093('0x11')][_0x7093('0x12')]));}function errorHandler(_0x313b62){if(_0x313b62&&_0x313b62[_0x7093('0x15')]&&_0x313b62[_0x7093('0x16')]){logger['error'](util[_0x7093('0x13')](_0x7093('0x17'),_0x313b62['name'],_0x313b62[_0x7093('0x16')]));}else{logger[_0x7093('0xe')](util[_0x7093('0x13')](_0x7093('0x18'),_0x313b62['stack']));}}function closeHandler(){logger[_0x7093('0x19')](util[_0x7093('0x13')](_0x7093('0x1a'),this[_0x7093('0x1b')],this[_0x7093('0x1c')],this['callerid'],this[_0x7093('0x1d')],this[_0x7093('0x1e')]));try{createSquareReport(this);}catch(_0x5e969a){logger[_0x7093('0xe')](_0x5e969a[_0x7093('0xa')]);}}function timeoutHandler(){logger[_0x7093('0x19')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x7093('0x1b')],this[_0x7093('0x1c')],this[_0x7093('0x1f')],this[_0x7093('0x1d')],this['uniqueid']));}function hangupHandler(){logger[_0x7093('0x19')](util[_0x7093('0x13')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x7093('0x1b')],this['calleridname'],this['callerid'],this[_0x7093('0x1d')],this[_0x7093('0x1e')]));this[_0x7093('0x20')]=!![];}function createSquareReport(_0x3d952e,_0x21bce6){rpc[_0x7093('0x21')](_0x3d952e)[_0x7093('0x22')](function(_0x1ac1a2){if(_0x21bce6){_0x21bce6(null,_0x1ac1a2);}})['catch'](function(_0x349a23){if(_0x21bce6){_0x21bce6(null,_0x349a23);}});}function setChannelVariables(_0x527b3c){for(var _0x319075 in _0x527b3c){if(_0x527b3c[_0x7093('0x23')](_0x319075)){if(_0x319075[_0x7093('0x24')](_0x7093('0x25'))===0x0){_0x527b3c[_0x319075[_0x7093('0x26')](0x4)]=_0x527b3c[_0x319075];delete _0x527b3c[_0x319075];}}}}function agiHandler(_0x3e6216){logger['debug'](_0x7093('0x27'),JSON[_0x7093('0x28')](_0x3e6216,null,0x2));logger[_0x7093('0x19')](util[_0x7093('0x13')](_0x7093('0x29'),_0x3e6216[_0x7093('0x1b')],_0x3e6216['calleridname'],_0x3e6216[_0x7093('0x1f')],_0x3e6216[_0x7093('0x1d')],_0x3e6216['uniqueid']));_0x3e6216['on'](_0x7093('0xe'),errorHandler);_0x3e6216['on'](_0x7093('0x2a'),closeHandler);_0x3e6216['on']('timeout',timeoutHandler);_0x3e6216[_0x7093('0x20')]=![];_0x3e6216['on'](_0x7093('0x2b'),hangupHandler);var _0x20879e=_['find'](projects,[_0x7093('0x15'),_0x3e6216['arg_1']]);if(!_0x20879e)return Project[_0x7093('0x2c')](_0x3e6216);if(!_0x20879e[_0x7093('0x2d')])return Project[_0x7093('0x2e')](_0x3e6216);return Project[_0x7093('0x2f')](_0x20879e,_0x3e6216);}function main(){var _0x254495;return utilLicense[_0x7093('0x30')]()[_0x7093('0x22')](function(_0x19d83e){if(!_0x19d83e)return;if(_0x19d83e[_0x7093('0x31')]){if(_0x19d83e[_0x7093('0x32')]&&_0x19d83e[_0x7093('0x32')]>0x0){logger[_0x7093('0x19')](util[_0x7093('0x13')]('[LICENSE]\x20CHANNELS:\x20%s',_0x19d83e[_0x7093('0x32')]));_0x254495=_0x19d83e['callysquare'];}else{logger[_0x7093('0x19')](_0x7093('0x33'));}}else{logger[_0x7093('0x19')](_0x7093('0x34'));_0x254495=-0x1;}})['then'](function(){return Project[_0x7093('0x35')]();})[_0x7093('0x22')](function(_0x1b2e90){projects=_0x1b2e90;return;})[_0x7093('0x36')](function(_0x37e4a3){logger['error'](_0x7093('0x37'),_0x37e4a3['stack']);})[_0x7093('0x38')](function(){var _0x2f557a=require(_0x7093('0x39'))(config[_0x7093('0x11')][_0x7093('0x12')],config[_0x7093('0x11')]['ip'],_0x254495);_0x2f557a['on'](_0x7093('0xe'),errorHandler);_0x2f557a['on']('listening',listeningHandler);_0x2f557a['on'](_0x7093('0x3a'),connectionHandler);_0x2f557a['on'](_0x7093('0x2a'),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 4efaa40..2bd2161 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 _0x14ca=['client','http','request','error','message','catch','SendMail'];(function(_0x29417d,_0x30066c){var _0x12a18d=function(_0x7f732e){while(--_0x7f732e){_0x29417d['push'](_0x29417d['shift']());}};_0x12a18d(++_0x30066c);}(_0x14ca,0x69));var _0xa14c=function(_0x2e6184,_0xf2fc16){_0x2e6184=_0x2e6184-0x0;var _0x1e4c2c=_0x14ca[_0x2e6184];return _0x1e4c2c;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0xa14c('0x0')][_0xa14c('0x1')]({'port':0x232b});function request(_0x139fa2,_0x1d9157){return new BPromise(function(_0x12ca6a,_0x1dcb51){return client[_0xa14c('0x2')](_0x139fa2,_0x1d9157)['then'](function(_0x329d69){if(_0x329d69[_0xa14c('0x3')]){return _0x1dcb51(_0x329d69['error'][_0xa14c('0x4')]);}else{return _0x12ca6a(_0x329d69['result']);}})[_0xa14c('0x5')](function(_0x273286){return _0x1dcb51(_0x273286);});});}exports['sendMailMessage']=function(_0x1424f4,_0x2d17b9){return request(_0xa14c('0x6'),{'account':_0x1424f4,'message':_0x2d17b9});}; \ No newline at end of file +var _0xb6f8=['request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http'];(function(_0x20758c,_0x44a42a){var _0x1c4ab7=function(_0x80197e){while(--_0x80197e){_0x20758c['push'](_0x20758c['shift']());}};_0x1c4ab7(++_0x44a42a);}(_0xb6f8,0x1e8));var _0x8b6f=function(_0x190dbd,_0x24a507){_0x190dbd=_0x190dbd-0x0;var _0x868d27=_0xb6f8[_0x190dbd];return _0x868d27;};'use strict';var BPromise=require(_0x8b6f('0x0'));var jayson=require(_0x8b6f('0x1'));var client=jayson[_0x8b6f('0x2')][_0x8b6f('0x3')]({'port':0x232b});function request(_0x1a8507,_0xa6e9a7){return new BPromise(function(_0x583aed,_0x2c138b){return client[_0x8b6f('0x4')](_0x1a8507,_0xa6e9a7)[_0x8b6f('0x5')](function(_0x24a0d4){if(_0x24a0d4[_0x8b6f('0x6')]){return _0x2c138b(_0x24a0d4[_0x8b6f('0x6')][_0x8b6f('0x7')]);}else{return _0x583aed(_0x24a0d4[_0x8b6f('0x8')]);}})[_0x8b6f('0x9')](function(_0x403e2f){return _0x2c138b(_0x403e2f);});});}exports[_0x8b6f('0xa')]=function(_0x5b4cf7,_0x11f6e1){return request(_0x8b6f('0xb'),{'account':_0x5b4cf7,'message':_0x11f6e1});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index a6e0289..62e32d7 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde6e=['stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','info','response','code','evtHangup','isUndefined','toString','agicommand\x20not\x20found','finally','result','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','exports','lodash','moment','util','../../config/logger','./rpc','./mailRpc','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','target','value','toJson','mxGraphModel','root','production','start','debug'];(function(_0x5beb2d,_0x16d8e4){var _0x2c140a=function(_0x2fcc6f){while(--_0x2fcc6f){_0x5beb2d['push'](_0x5beb2d['shift']());}};_0x2c140a(++_0x16d8e4);}(_0xde6e,0x1bd));var _0xede6=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0xde6e[_0x359bbe];return _0x1b3353;};'use strict';var _=require(_0xede6('0x0'));var moment=require(_0xede6('0x1'));var parser=require('xml2json');var util=require(_0xede6('0x2'));var logger=require(_0xede6('0x3'))('agi');var rpc=require(_0xede6('0x4'));var mailRpc=require(_0xede6('0x5'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xede6('0x6')]()['catch'](function(_0x3ff24b){logger[_0xede6('0x7')](_0xede6('0x8'),_0x3ff24b[_0xede6('0x9')]);return[];});}function addVertex(_0x570683,_0x1a5544,_0x4e9749){_0x1a5544[_0xede6('0xa')]=_0x4e9749;if(_0x1a5544[_0xede6('0xb')](_0xede6('0xc'))){_0x1a5544[_0xede6('0xd')]=parseInt(_0x1a5544[_0xede6('0xc')],0xa);}_0x570683[_0xede6('0xe')](_[_0xede6('0xf')](_0x1a5544,'mxCell'));}function initGraph(_0x18d170,_0x17c15a){var _0x310a47=new Graph();for(var _0x125048 in _0x18d170){if(_0x18d170[_0xede6('0xb')](_0x125048)){if(_[_0xede6('0x10')](_0x18d170[_0x125048])){for(var _0x9fb22c=0x0;_0x9fb22c<_0x18d170[_0x125048][_0xede6('0x11')];_0x9fb22c+=0x1){addVertex(_0x310a47,_0x18d170[_0x125048][_0x9fb22c],_0x125048);}}else{addVertex(_0x310a47,_0x18d170[_0x125048],_0x125048);}}}for(var _0x26772b=0x0;_0x26772b<_0x17c15a[_0xede6('0x11')];_0x26772b+=0x1){if(_0x17c15a[_0x26772b][_0xede6('0x12')]&&_0x17c15a[_0x26772b][_0xede6('0x13')]){_0x310a47['addEdge'](_0x17c15a[_0x26772b][_0xede6('0x12')],_0x17c15a[_0x26772b][_0xede6('0x13')],_0x17c15a[_0x26772b][_0xede6('0x14')]);}}return _0x310a47;}function getRoot(_0x1a5c50){return parser[_0xede6('0x15')](_0x1a5c50,{'object':!![]})[_0xede6('0x16')][_0xede6('0x17')];}function inspect(_0x42f10f){return util['inspect'](_0x42f10f,{'showHidden':![],'depth':null});}function initialize(_0x2eafeb,_0xa0353c){var _0x1c0db7=getRoot(_0x2eafeb[_0xede6('0x18')]);if(!_0x1c0db7||!_0x1c0db7[_0xede6('0x19')])return;var _0x4dc734,_0x5e1583,_0x4486a4;logger[_0xede6('0x1a')](_0xede6('0x17'),JSON[_0xede6('0x1b')](_0x1c0db7,null,0x2));_0xa0353c[_0xede6('0x1c')]=moment()[_0xede6('0x1d')](_0xede6('0x1e'));_0x4dc734=initGraph(_[_0xede6('0xf')](_0x1c0db7,_0xede6('0x1f')),_0x1c0db7[_0xede6('0x1f')]);_0x5e1583=new Vertices(_0xa0353c,rpc,mailRpc);logger['info'](util[_0xede6('0x1d')](_0xede6('0x20'),_0xa0353c[_0xede6('0x21')],_0xa0353c[_0xede6('0x22')],_0xa0353c[_0xede6('0x23')],_0xa0353c[_0xede6('0x24')],_0xa0353c[_0xede6('0x25')]));_0x4dc734['traverseBFS'](_0x1c0db7[_0xede6('0x19')]['id'],function(_0x189426){try{_0x189426=_0x5e1583['clear'](_0x189426);logger[_0xede6('0x1a')](_0xede6('0x26'),JSON[_0xede6('0x1b')](_0x189426,null,0x2));if(_0x189426[_0xede6('0xa')]===_0xede6('0x27')){logger['info'](_0xede6('0x28'));_0xa0353c[_0xede6('0x29')]=_0x189426[_0xede6('0x29')]||_0xa0353c[_0xede6('0x29')];_0xa0353c[_0xede6('0x2a')]=_0x189426[_0xede6('0x2a')];_0xa0353c[_0xede6('0x2b')]=_0x189426[_0xede6('0x2b')]?_0x189426[_0xede6('0x2b')]-0x1:0x1;return null;}else if(_0x189426&&_0x5e1583[_0x189426[_0xede6('0xa')]]){_0x4486a4=_0x5e1583[_0x189426[_0xede6('0xa')]](_0x189426);logger[_0xede6('0x2c')](_0xede6('0x2d'),JSON['stringify'](_0x4486a4,null,0x2));if(_0x4486a4&&_0x4486a4[_0xede6('0x2e')]===AGI_CODE_SUCCESS&&_0x4486a4['result']!==AGI_RESULT_ERROR&&!_0xa0353c[_0xede6('0x2f')]){logger[_0xede6('0x1a')]('response',inspect(_0x4486a4));return _[_0xede6('0x30')](_0x4486a4['result'])?null:_0x4486a4['result'][_0xede6('0x31')]();}else{logger[_0xede6('0x7')](_0xede6('0x2d'),inspect(_0x4486a4));return null;}}else{logger[_0xede6('0x7')](_0xede6('0x32'));return null;}}catch(_0x21c29c){logger['error'](_0x21c29c[_0xede6('0x9')]);return null;}});if(_0x1c0db7[_0xede6('0x33')]){logger[_0xede6('0x2c')](util[_0xede6('0x1d')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xa0353c[_0xede6('0x21')],_0xa0353c['calleridname'],_0xa0353c[_0xede6('0x23')],_0xa0353c['dnid'],_0xa0353c[_0xede6('0x25')]));_0x4dc734['traverseBFS'](_0x1c0db7['finally']['id'],function(_0x243d22){try{_0x243d22=_0x5e1583['clear'](_0x243d22);logger[_0xede6('0x1a')]('vertex',JSON['stringify'](_0x243d22,null,0x2));if(_0x243d22&&_0x5e1583[_0x243d22[_0xede6('0xa')]]){_0x4486a4=_0x5e1583[_0x243d22['agicommand']](_0x243d22);if(_0x4486a4){logger['debug'](_0xede6('0x2d'),inspect(_0x4486a4));return _[_0xede6('0x30')](_0x4486a4[_0xede6('0x34')])?null:_0x4486a4[_0xede6('0x34')][_0xede6('0x31')]();}else{logger[_0xede6('0x7')](_0xede6('0x2d'),inspect(_0x4486a4));return null;}}else{logger[_0xede6('0x7')](_0xede6('0x32'));return null;}}catch(_0x402538){logger[_0xede6('0x7')](_0x402538[_0xede6('0x9')]);return null;}});}logger['info'](util[_0xede6('0x1d')](_0xede6('0x35'),_0xa0353c[_0xede6('0x21')],_0xa0353c[_0xede6('0x22')],_0xa0353c['callerid'],_0xa0353c['dnid'],_0xa0353c[_0xede6('0x25')]));logger['info'](util['format'](_0xede6('0x36'),_0xa0353c[_0xede6('0x29')],_0xa0353c[_0xede6('0x2a')],parseInt(_0xa0353c[_0xede6('0x2b')],0xa)+0x1));_0xa0353c[_0xede6('0x37')](_0xa0353c[_0xede6('0x29')],_0xa0353c['extension'],parseInt(_0xa0353c[_0xede6('0x2b')],0xa)+0x1);_0xa0353c['close']();}function handleNotFound(_0xfa3f64){logger[_0xede6('0x7')](util[_0xede6('0x1d')](_0xede6('0x38'),_0xfa3f64[_0xede6('0x21')]));_0xfa3f64[_0xede6('0x37')](_0xfa3f64[_0xede6('0x29')],_0xfa3f64[_0xede6('0x2a')],parseInt(_0xfa3f64[_0xede6('0x2b')],0xa)+0x1);_0xfa3f64['close']();}function handleUnpublished(_0x20b90f){logger[_0xede6('0x7')](util[_0xede6('0x1d')]('Project\x20%s\x20not\x20published',_0x20b90f['arg_1']));_0x20b90f[_0xede6('0x37')](_0x20b90f[_0xede6('0x29')],_0x20b90f[_0xede6('0x2a')],parseInt(_0x20b90f['priority'],0xa)+0x1);_0x20b90f[_0xede6('0x39')]();}module[_0xede6('0x3a')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xdee4=['stack','hasOwnProperty','retry','maxRetry','mxCell','isArray','length','target','value','toJson','mxGraphModel','production','start','debug','root','stringify','format','YYYY-MM-DD\x20HH:mm:ss','omit','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','response','code','result','evtHangup','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','clear','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','priority','Project\x20%s\x20not\x20published','close','exports','lodash','moment','xml2json','util','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xdee4,0x1e3));var _0x4dee=function(_0x46b979,_0x3f0e9a){_0x46b979=_0x46b979-0x0;var _0x355217=_0xdee4[_0x46b979];return _0x355217;};'use strict';var _=require(_0x4dee('0x0'));var moment=require(_0x4dee('0x1'));var parser=require(_0x4dee('0x2'));var util=require(_0x4dee('0x3'));var logger=require('../../config/logger')(_0x4dee('0x4'));var rpc=require(_0x4dee('0x5'));var mailRpc=require(_0x4dee('0x6'));var Graph=require(_0x4dee('0x7'));var Vertices=require(_0x4dee('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x4dee('0x9')]()[_0x4dee('0xa')](function(_0x504ef6){logger[_0x4dee('0xb')](_0x4dee('0xc'),_0x504ef6[_0x4dee('0xd')]);return[];});}function addVertex(_0x3180a8,_0x631f2e,_0x803c59){_0x631f2e['agicommand']=_0x803c59;if(_0x631f2e[_0x4dee('0xe')](_0x4dee('0xf'))){_0x631f2e[_0x4dee('0x10')]=parseInt(_0x631f2e[_0x4dee('0xf')],0xa);}_0x3180a8['addVertex'](_['omit'](_0x631f2e,_0x4dee('0x11')));}function initGraph(_0x4563b7,_0x57e816){var _0x4d0290=new Graph();for(var _0x5543c7 in _0x4563b7){if(_0x4563b7[_0x4dee('0xe')](_0x5543c7)){if(_[_0x4dee('0x12')](_0x4563b7[_0x5543c7])){for(var _0x1cfd68=0x0;_0x1cfd68<_0x4563b7[_0x5543c7][_0x4dee('0x13')];_0x1cfd68+=0x1){addVertex(_0x4d0290,_0x4563b7[_0x5543c7][_0x1cfd68],_0x5543c7);}}else{addVertex(_0x4d0290,_0x4563b7[_0x5543c7],_0x5543c7);}}}for(var _0x490cd6=0x0;_0x490cd6<_0x57e816[_0x4dee('0x13')];_0x490cd6+=0x1){if(_0x57e816[_0x490cd6]['source']&&_0x57e816[_0x490cd6][_0x4dee('0x14')]){_0x4d0290['addEdge'](_0x57e816[_0x490cd6]['source'],_0x57e816[_0x490cd6][_0x4dee('0x14')],_0x57e816[_0x490cd6][_0x4dee('0x15')]);}}return _0x4d0290;}function getRoot(_0x104590){return parser[_0x4dee('0x16')](_0x104590,{'object':!![]})[_0x4dee('0x17')]['root'];}function inspect(_0x13b624){return util['inspect'](_0x13b624,{'showHidden':![],'depth':null});}function initialize(_0x3d526e,_0x2b11e5){var _0x42a7ae=getRoot(_0x3d526e[_0x4dee('0x18')]);if(!_0x42a7ae||!_0x42a7ae[_0x4dee('0x19')])return;var _0x90b8c1,_0x12ba98,_0x1915e0;logger[_0x4dee('0x1a')](_0x4dee('0x1b'),JSON[_0x4dee('0x1c')](_0x42a7ae,null,0x2));_0x2b11e5['joinAt']=moment()[_0x4dee('0x1d')](_0x4dee('0x1e'));_0x90b8c1=initGraph(_[_0x4dee('0x1f')](_0x42a7ae,_0x4dee('0x11')),_0x42a7ae[_0x4dee('0x11')]);_0x12ba98=new Vertices(_0x2b11e5,rpc,mailRpc);logger[_0x4dee('0x20')](util[_0x4dee('0x1d')](_0x4dee('0x21'),_0x2b11e5[_0x4dee('0x22')],_0x2b11e5[_0x4dee('0x23')],_0x2b11e5['callerid'],_0x2b11e5['dnid'],_0x2b11e5[_0x4dee('0x24')]));_0x90b8c1['traverseBFS'](_0x42a7ae[_0x4dee('0x19')]['id'],function(_0x25f154){try{_0x25f154=_0x12ba98['clear'](_0x25f154);logger['debug'](_0x4dee('0x25'),JSON[_0x4dee('0x1c')](_0x25f154,null,0x2));if(_0x25f154[_0x4dee('0x26')]===_0x4dee('0x27')){logger[_0x4dee('0x20')](_0x4dee('0x28'));_0x2b11e5[_0x4dee('0x29')]=_0x25f154[_0x4dee('0x29')]||_0x2b11e5[_0x4dee('0x29')];_0x2b11e5[_0x4dee('0x2a')]=_0x25f154[_0x4dee('0x2a')];_0x2b11e5['priority']=_0x25f154['priority']?_0x25f154['priority']-0x1:0x1;return null;}else if(_0x25f154&&_0x12ba98[_0x25f154['agicommand']]){_0x1915e0=_0x12ba98[_0x25f154[_0x4dee('0x26')]](_0x25f154);logger[_0x4dee('0x20')](_0x4dee('0x2b'),JSON[_0x4dee('0x1c')](_0x1915e0,null,0x2));if(_0x1915e0&&_0x1915e0[_0x4dee('0x2c')]===AGI_CODE_SUCCESS&&_0x1915e0[_0x4dee('0x2d')]!==AGI_RESULT_ERROR&&!_0x2b11e5[_0x4dee('0x2e')]){logger[_0x4dee('0x1a')](_0x4dee('0x2b'),inspect(_0x1915e0));return _['isUndefined'](_0x1915e0[_0x4dee('0x2d')])?null:_0x1915e0[_0x4dee('0x2d')][_0x4dee('0x2f')]();}else{logger['error'](_0x4dee('0x2b'),inspect(_0x1915e0));return null;}}else{logger[_0x4dee('0xb')](_0x4dee('0x30'));return null;}}catch(_0x51bb1c){logger[_0x4dee('0xb')](_0x51bb1c['stack']);return null;}});if(_0x42a7ae[_0x4dee('0x31')]){logger['info'](util[_0x4dee('0x1d')](_0x4dee('0x32'),_0x2b11e5[_0x4dee('0x22')],_0x2b11e5[_0x4dee('0x23')],_0x2b11e5['callerid'],_0x2b11e5[_0x4dee('0x33')],_0x2b11e5[_0x4dee('0x24')]));_0x90b8c1['traverseBFS'](_0x42a7ae[_0x4dee('0x31')]['id'],function(_0x177ef3){try{_0x177ef3=_0x12ba98[_0x4dee('0x34')](_0x177ef3);logger[_0x4dee('0x1a')](_0x4dee('0x25'),JSON[_0x4dee('0x1c')](_0x177ef3,null,0x2));if(_0x177ef3&&_0x12ba98[_0x177ef3[_0x4dee('0x26')]]){_0x1915e0=_0x12ba98[_0x177ef3['agicommand']](_0x177ef3);if(_0x1915e0){logger[_0x4dee('0x1a')](_0x4dee('0x2b'),inspect(_0x1915e0));return _[_0x4dee('0x35')](_0x1915e0[_0x4dee('0x2d')])?null:_0x1915e0['result'][_0x4dee('0x2f')]();}else{logger[_0x4dee('0xb')](_0x4dee('0x2b'),inspect(_0x1915e0));return null;}}else{logger[_0x4dee('0xb')]('agicommand\x20not\x20found');return null;}}catch(_0x2851c1){logger['error'](_0x2851c1['stack']);return null;}});}logger[_0x4dee('0x20')](util[_0x4dee('0x1d')](_0x4dee('0x36'),_0x2b11e5[_0x4dee('0x22')],_0x2b11e5['calleridname'],_0x2b11e5[_0x4dee('0x37')],_0x2b11e5[_0x4dee('0x33')],_0x2b11e5['uniqueid']));logger[_0x4dee('0x20')](util[_0x4dee('0x1d')](_0x4dee('0x38'),_0x2b11e5['context'],_0x2b11e5[_0x4dee('0x2a')],parseInt(_0x2b11e5['priority'],0xa)+0x1));_0x2b11e5[_0x4dee('0x39')](_0x2b11e5[_0x4dee('0x29')],_0x2b11e5[_0x4dee('0x2a')],parseInt(_0x2b11e5[_0x4dee('0x3a')],0xa)+0x1);_0x2b11e5['close']();}function handleNotFound(_0x7f9a60){logger[_0x4dee('0xb')](util['format']('Project\x20%s\x20not\x20found',_0x7f9a60[_0x4dee('0x22')]));_0x7f9a60[_0x4dee('0x39')](_0x7f9a60[_0x4dee('0x29')],_0x7f9a60['extension'],parseInt(_0x7f9a60[_0x4dee('0x3a')],0xa)+0x1);_0x7f9a60['close']();}function handleUnpublished(_0x3a4d9c){logger['error'](util[_0x4dee('0x1d')](_0x4dee('0x3b'),_0x3a4d9c[_0x4dee('0x22')]));_0x3a4d9c[_0x4dee('0x39')](_0x3a4d9c[_0x4dee('0x29')],_0x3a4d9c['extension'],parseInt(_0x3a4d9c[_0x4dee('0x3a')],0xa)+0x1);_0x3a4d9c[_0x4dee('0x3c')]();}module[_0x4dee('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index b0da8ac..e1481c0 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 _0xd840=['stream','Transform','call','_localBuffer','_inBody','prototype','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','trim','slice','emit','line','exports','util'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xd840,0xd7));var _0x0d84=function(_0x21731c,_0x3b38f0){_0x21731c=_0x21731c-0x0;var _0x168953=_0xd840[_0x21731c];return _0x168953;};'use strict';var util=require(_0x0d84('0x0'));var Transform=require(_0x0d84('0x1'))[_0x0d84('0x2')];function AGIReply(_0x58cd73){Transform[_0x0d84('0x3')](this,_0x58cd73);this[_0x0d84('0x4')]='';this[_0x0d84('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x0d84('0x6')]['_transform']=function(_0x55e3b9,_0x3f5f34,_0x5e83a2){var _0x3f4732='\x0a',_0x5df0e9=['\x0a\x0a',_0x0d84('0x7')],_0x4edba8=-0x1,_0x95403c=-0x1,_0x3147a1='',_0x4e633e=0x0,_0x286d73='',_0x365421='';this['_localBuffer']+=_0x55e3b9[_0x0d84('0x8')]();_0x286d73=this[_0x0d84('0x4')];if(!this[_0x0d84('0x5')]){_0x4e633e=0x0;while(_0x5df0e9[_0x4e633e]){while((_0x95403c=_0x286d73[_0x0d84('0x9')](_0x5df0e9[_0x4e633e]))!=-0x1){_0x3147a1=_0x5df0e9[_0x4e633e];_0x365421=_0x286d73['substring'](0x0,_0x95403c);_0x286d73=_0x286d73[_0x0d84('0xa')](_0x95403c+_0x3147a1[_0x0d84('0xb')]);var _0x489d97=_0x365421[_0x0d84('0xc')](_0x3f4732),_0x418c8d=0x0,_0x4bed18={},_0xb14a7a='',_0x466792='',_0x5a2b57=-0x1;while(_0x489d97[_0x418c8d]){_0x5a2b57=_0x489d97[_0x418c8d][_0x0d84('0x9')](':');if(_0x5a2b57!=-0x1){_0xb14a7a=_0x489d97[_0x418c8d]['slice'](0x0,_0x5a2b57)[_0x0d84('0xd')]();_0x466792=_0x489d97[_0x418c8d][_0x0d84('0xe')](_0x5a2b57+0x1)['trim']();if(_0xb14a7a[_0x0d84('0xb')]>0x0){_0x4bed18[_0xb14a7a]=_0x466792;}}else{}_0x418c8d++;}this[_0x0d84('0xf')]('headers',_0x4bed18);this[_0x0d84('0x5')]=!![];}_0x4e633e++;}this['_localBuffer']=_0x286d73;}else{while((_0x4edba8=_0x286d73[_0x0d84('0x9')](_0x3f4732))!=-0x1){_0x365421=_0x286d73[_0x0d84('0xa')](0x0,_0x4edba8);this[_0x0d84('0xf')](_0x0d84('0x10'),_0x365421);_0x286d73=_0x286d73[_0x0d84('0xa')](_0x4edba8+_0x3f4732['length']);}this[_0x0d84('0x4')]=_0x286d73;}_0x5e83a2();};module[_0x0d84('0x11')]=AGIReply; \ No newline at end of file +var _0xdcf9=['line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','indexOf','substring','length','trim','headers','emit'];(function(_0x2e8383,_0x4c1100){var _0x49311a=function(_0x3fc0e6){while(--_0x3fc0e6){_0x2e8383['push'](_0x2e8383['shift']());}};_0x49311a(++_0x4c1100);}(_0xdcf9,0x101));var _0x9dcf=function(_0x755ce4,_0x385b95){_0x755ce4=_0x755ce4-0x0;var _0x40974b=_0xdcf9[_0x755ce4];return _0x40974b;};'use strict';var util=require(_0x9dcf('0x0'));var Transform=require(_0x9dcf('0x1'))[_0x9dcf('0x2')];function AGIReply(_0x3f2035){Transform[_0x9dcf('0x3')](this,_0x3f2035);this[_0x9dcf('0x4')]='';this[_0x9dcf('0x5')]=![];}util[_0x9dcf('0x6')](AGIReply,Transform);AGIReply[_0x9dcf('0x7')][_0x9dcf('0x8')]=function(_0x3d89b0,_0x2489e3,_0x46b7bb){var _0x544404='\x0a',_0x4c6588=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x5cad6d=-0x1,_0x19567a=-0x1,_0x16d36d='',_0x1399f2=0x0,_0x1352c0='',_0x3c9ca2='';this[_0x9dcf('0x4')]+=_0x3d89b0['toString']();_0x1352c0=this['_localBuffer'];if(!this['_inBody']){_0x1399f2=0x0;while(_0x4c6588[_0x1399f2]){while((_0x19567a=_0x1352c0[_0x9dcf('0x9')](_0x4c6588[_0x1399f2]))!=-0x1){_0x16d36d=_0x4c6588[_0x1399f2];_0x3c9ca2=_0x1352c0['substring'](0x0,_0x19567a);_0x1352c0=_0x1352c0[_0x9dcf('0xa')](_0x19567a+_0x16d36d[_0x9dcf('0xb')]);var _0x53f202=_0x3c9ca2['split'](_0x544404),_0x2e677a=0x0,_0x1e33a4={},_0x36c5e4='',_0x4fd583='',_0x1d2f93=-0x1;while(_0x53f202[_0x2e677a]){_0x1d2f93=_0x53f202[_0x2e677a][_0x9dcf('0x9')](':');if(_0x1d2f93!=-0x1){_0x36c5e4=_0x53f202[_0x2e677a]['slice'](0x0,_0x1d2f93)['trim']();_0x4fd583=_0x53f202[_0x2e677a]['slice'](_0x1d2f93+0x1)[_0x9dcf('0xc')]();if(_0x36c5e4[_0x9dcf('0xb')]>0x0){_0x1e33a4[_0x36c5e4]=_0x4fd583;}}else{}_0x2e677a++;}this['emit'](_0x9dcf('0xd'),_0x1e33a4);this['_inBody']=!![];}_0x1399f2++;}this[_0x9dcf('0x4')]=_0x1352c0;}else{while((_0x5cad6d=_0x1352c0[_0x9dcf('0x9')](_0x544404))!=-0x1){_0x3c9ca2=_0x1352c0[_0x9dcf('0xa')](0x0,_0x5cad6d);this[_0x9dcf('0xe')](_0x9dcf('0xf'),_0x3c9ca2);_0x1352c0=_0x1352c0[_0x9dcf('0xa')](_0x5cad6d+_0x544404['length']);}this['_localBuffer']=_0x1352c0;}_0x46b7bb();};module[_0x9dcf('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 45e3518..c682d82 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 _0x43b1=['ShowCmHopper','ListId','CreateCmContact','getPauseById','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','lodash','moment','jayson/promise','http','request','then','error','message','result','getSquareProjects','GetSquareProjects','name','production','getSquareProject','getMailAccountById','MailServerOut','CloudProvider','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','merge','arg_2','format','createSquareMessage','createCmContact'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43b1,0x7d));var _0x143b=function(_0x4585a4,_0x362e07){_0x4585a4=_0x4585a4-0x0;var _0x4691cb=_0x43b1[_0x4585a4];return _0x4691cb;};'use strict';var _=require(_0x143b('0x0'));var moment=require(_0x143b('0x1'));var jayson=require(_0x143b('0x2'));var client=jayson['client'][_0x143b('0x3')]({'port':0x2329});function request(_0x4976d0,_0x1e1282){return new Promise(function(_0x4388c5,_0x223e86){return client[_0x143b('0x4')](_0x4976d0,_0x1e1282)[_0x143b('0x5')](function(_0x367a29){if(_0x367a29['error']){return _0x223e86(_0x367a29[_0x143b('0x6')][_0x143b('0x7')]);}else{return _0x4388c5(_0x367a29[_0x143b('0x8')]);}})['catch'](function(_0x453a09){return _0x223e86(_0x453a09);});});}exports[_0x143b('0x9')]=function(){return request(_0x143b('0xa'),{'options':{'raw':![],'attributes':['id',_0x143b('0xb'),_0x143b('0xc')]}});};exports[_0x143b('0xd')]=function(_0xf5e80b){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0xf5e80b},'attributes':[_0x143b('0xc')]}});};exports[_0x143b('0xe')]=function(_0x4e49bf){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x4e49bf},'include':[{'model':_0x143b('0xf'),'as':'Smtp','include':[{'model':_0x143b('0x10'),'as':_0x143b('0x10')}]}],'attributes':['id','name',_0x143b('0x11')],'smtp':!![]}});};exports[_0x143b('0x12')]=function(_0x8d5095){return request(_0x143b('0x13'),{'options':{'where':{'id':_0x8d5095},'attributes':[_0x143b('0xb')]}});};exports[_0x143b('0x14')]=function(_0x1325c3){return request(_0x143b('0x15'),{'options':{'where':{'id':_0x1325c3},'attributes':[_0x143b('0xb')]}});};exports[_0x143b('0x16')]=function(_0x2bca2c){return request(_0x143b('0x17'),{'options':{'where':{'id':_0x2bca2c},'attributes':[_0x143b('0xb')]}});};exports[_0x143b('0x18')]=function(_0x11d3a9){return request(_0x143b('0x19'),{'options':{'where':{'id':_0x11d3a9},'attributes':[_0x143b('0x1a')]}});};exports['getUserById']=function(_0x520197){return request(_0x143b('0x1b'),{'options':{'where':{'id':_0x520197},'attributes':[_0x143b('0xb')]}});};exports[_0x143b('0x1c')]=function(_0x139aa9){return request(_0x143b('0x1d'),{'options':{'where':{'phone':_0x139aa9[_0x143b('0x1e')]},'attributes':['id']}});};exports[_0x143b('0x1f')]=function(_0x1ca6d2){return request(_0x143b('0x20'),{'options':{'where':{'id':_0x1ca6d2},'attributes':[_0x143b('0xb')]}});};exports[_0x143b('0x21')]=function(_0x59c3d9){return request(_0x143b('0x22'),{'options':{'where':{'id':_0x59c3d9},'attributes':[_0x143b('0x23')]}});};exports[_0x143b('0x24')]=function(_0xfd9194){return request(_0x143b('0x25'),{'options':{'raw':![],'where':{'id':_0xfd9194},'include':[{'model':_0x143b('0x26'),'as':_0x143b('0x27')}]}});};exports[_0x143b('0x28')]=function(_0x5d0684){return request(_0x143b('0x29'),{'options':{'where':{'id':_0x5d0684},'attributes':['id','name']}});};exports[_0x143b('0x2a')]=function(_0x5bdebc){return request('CreateSmsMessage',{'body':_0x5bdebc});};exports[_0x143b('0x2b')]=function(_0x100021){return request('CreateSquareDetailsReport',{'body':_0x100021});};exports['createSquareReport']=function(_0x161f9c){return request('CreateSquareReport',{'body':_[_0x143b('0x2c')](_0x161f9c,{'project_name':_0x161f9c['arg_1'],'prev_project_name':_0x161f9c[_0x143b('0x2d')]||'','is_subproject':_0x161f9c[_0x143b('0x2d')]?!![]:![],'leaveAt':moment()[_0x143b('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x485336){return request('CreateSquareRecording',{'body':_0x485336});};exports[_0x143b('0x2f')]=function(_0x4a4090){return request('CreateSquareMessage',{'body':_0x4a4090});};exports[_0x143b('0x30')]=function(_0x37611b){return request(_0x143b('0x31'),{'options':{'raw':![],'where':{'phone':_0x37611b['phone'],'ListId':_0x37611b[_0x143b('0x32')]}}})[_0x143b('0x5')](function(_0x42e136){if(_0x42e136){return _0x42e136;}return request(_0x143b('0x33'),{'body':_0x37611b});});};exports[_0x143b('0x34')]=function(_0x487101){return request('ShowPause',{'options':{'where':{'id':_0x487101},'attributes':['name']}});};exports['agentLogin']=function(_0x25e9ca,_0x144e60){return request(_0x143b('0x35'),{'body':{'interface':_0x144e60},'options':{'where':_0x25e9ca}});};exports[_0x143b('0x36')]=function(_0x129366,_0x1012d7,_0x10cef8){return request(_0x143b('0x37'),{'body':{'type':_0x1012d7,'uniqueid':_0x10cef8},'options':{'where':_0x129366}});};exports[_0x143b('0x38')]=function(_0x3f6e0e){return request('UnpauseUser',{'body':{},'options':{'where':_0x3f6e0e}});};exports[_0x143b('0x39')]=function(_0x3711a5){return request('LogoutUser',{'body':{},'options':{'where':_0x3711a5}});}; \ No newline at end of file +var _0x192f=['arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','jayson/promise','http','request','then','error','message','result','getSquareProjects','GetSquareProjects','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge'];(function(_0x372b76,_0x510d62){var _0x2da7e5=function(_0x1eaa2f){while(--_0x1eaa2f){_0x372b76['push'](_0x372b76['shift']());}};_0x2da7e5(++_0x510d62);}(_0x192f,0xd6));var _0xf192=function(_0xbb3269,_0xee00b0){_0xbb3269=_0xbb3269-0x0;var _0x1950bf=_0x192f[_0xbb3269];return _0x1950bf;};'use strict';var _=require(_0xf192('0x0'));var moment=require('moment');var jayson=require(_0xf192('0x1'));var client=jayson['client'][_0xf192('0x2')]({'port':0x2329});function request(_0x5aec4b,_0x527d53){return new Promise(function(_0x3ed9c1,_0x3b704f){return client[_0xf192('0x3')](_0x5aec4b,_0x527d53)[_0xf192('0x4')](function(_0x1df2e1){if(_0x1df2e1[_0xf192('0x5')]){return _0x3b704f(_0x1df2e1['error'][_0xf192('0x6')]);}else{return _0x3ed9c1(_0x1df2e1[_0xf192('0x7')]);}})['catch'](function(_0x2c4102){return _0x3b704f(_0x2c4102);});});}exports[_0xf192('0x8')]=function(){return request(_0xf192('0x9'),{'options':{'raw':![],'attributes':['id',_0xf192('0xa'),_0xf192('0xb')]}});};exports['getSquareProject']=function(_0x4c9d03){return request(_0xf192('0xc'),{'options':{'raw':![],'where':{'name':_0x4c9d03},'attributes':[_0xf192('0xb')]}});};exports[_0xf192('0xd')]=function(_0x2cb4b2){return request(_0xf192('0xe'),{'options':{'raw':![],'where':{'id':_0x2cb4b2},'include':[{'model':_0xf192('0xf'),'as':_0xf192('0x10'),'include':[{'model':_0xf192('0x11'),'as':'CloudProvider'}]}],'attributes':['id',_0xf192('0xa'),_0xf192('0x12')],'smtp':!![]}});};exports[_0xf192('0x13')]=function(_0x16b525){return request(_0xf192('0xc'),{'options':{'where':{'id':_0x16b525},'attributes':[_0xf192('0xa')]}});};exports[_0xf192('0x14')]=function(_0xb51acc){return request(_0xf192('0x15'),{'options':{'where':{'id':_0xb51acc},'attributes':[_0xf192('0xa')]}});};exports[_0xf192('0x16')]=function(_0x287088){return request('ShowVariable',{'options':{'where':{'id':_0x287088},'attributes':[_0xf192('0xa')]}});};exports[_0xf192('0x17')]=function(_0x578423){return request(_0xf192('0x18'),{'options':{'where':{'id':_0x578423},'attributes':[_0xf192('0x19')]}});};exports[_0xf192('0x1a')]=function(_0x2185ea){return request(_0xf192('0x1b'),{'options':{'where':{'id':_0x2185ea},'attributes':[_0xf192('0xa')]}});};exports[_0xf192('0x1c')]=function(_0x3aa61c){return request(_0xf192('0x1d'),{'options':{'where':{'phone':_0x3aa61c[_0xf192('0x1e')]},'attributes':['id']}});};exports[_0xf192('0x1f')]=function(_0x3ee921){return request('ShowTrunk',{'options':{'where':{'id':_0x3ee921},'attributes':[_0xf192('0xa')]}});};exports[_0xf192('0x20')]=function(_0x418bc2){return request(_0xf192('0x21'),{'options':{'where':{'id':_0x418bc2},'attributes':[_0xf192('0x22')]}});};exports[_0xf192('0x23')]=function(_0x1dcf33){return request(_0xf192('0x24'),{'options':{'raw':![],'where':{'id':_0x1dcf33},'include':[{'model':'Interval','as':_0xf192('0x25')}]}});};exports[_0xf192('0x26')]=function(_0x32fc43){return request(_0xf192('0x27'),{'options':{'where':{'id':_0x32fc43},'attributes':['id','name']}});};exports[_0xf192('0x28')]=function(_0x5d3d2c){return request(_0xf192('0x29'),{'body':_0x5d3d2c});};exports['createSquareDetailsReport']=function(_0x466aa0){return request(_0xf192('0x2a'),{'body':_0x466aa0});};exports[_0xf192('0x2b')]=function(_0x425dea){return request(_0xf192('0x2c'),{'body':_[_0xf192('0x2d')](_0x425dea,{'project_name':_0x425dea[_0xf192('0x2e')],'prev_project_name':_0x425dea[_0xf192('0x2f')]||'','is_subproject':_0x425dea['arg_2']?!![]:![],'leaveAt':moment()[_0xf192('0x30')](_0xf192('0x31'))})});};exports[_0xf192('0x32')]=function(_0x5f0a2f){return request('CreateSquareRecording',{'body':_0x5f0a2f});};exports[_0xf192('0x33')]=function(_0x256fb6){return request(_0xf192('0x34'),{'body':_0x256fb6});};exports[_0xf192('0x35')]=function(_0x596c6a){return request(_0xf192('0x36'),{'options':{'raw':![],'where':{'phone':_0x596c6a['phone'],'ListId':_0x596c6a[_0xf192('0x37')]}}})['then'](function(_0x555f01){if(_0x555f01){return _0x555f01;}return request(_0xf192('0x38'),{'body':_0x596c6a});});};exports[_0xf192('0x39')]=function(_0x5460cc){return request('ShowPause',{'options':{'where':{'id':_0x5460cc},'attributes':[_0xf192('0xa')]}});};exports[_0xf192('0x3a')]=function(_0x3d2db4,_0x574908){return request(_0xf192('0x3b'),{'body':{'interface':_0x574908},'options':{'where':_0x3d2db4}});};exports[_0xf192('0x3c')]=function(_0x367c9b,_0x16956a,_0x57e5ee){return request(_0xf192('0x3d'),{'body':{'type':_0x16956a,'uniqueid':_0x57e5ee},'options':{'where':_0x367c9b}});};exports[_0xf192('0x3e')]=function(_0x241e28){return request('UnpauseUser',{'body':{},'options':{'where':_0x241e28}});};exports[_0xf192('0x3f')]=function(_0x290e79){return request(_0xf192('0x40'),{'body':{},'options':{'where':_0x290e79}});}; \ 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 ebfc926..7e723dc 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 _0x5496=['exports','./polly','./lex'];(function(_0x2892db,_0x37719b){var _0x39089f=function(_0x3731c0){while(--_0x3731c0){_0x2892db['push'](_0x2892db['shift']());}};_0x39089f(++_0x37719b);}(_0x5496,0x175));var _0x6549=function(_0x4c969e,_0x475c50){_0x4c969e=_0x4c969e-0x0;var _0x1cb300=_0x5496[_0x4c969e];return _0x1cb300;};var polly=require(_0x6549('0x0'));var lex=require(_0x6549('0x1'));module[_0x6549('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xbd51=['./polly','exports'];(function(_0x1f5ce8,_0xa1cfae){var _0x5baa4f=function(_0x31c767){while(--_0x31c767){_0x1f5ce8['push'](_0x1f5ce8['shift']());}};_0x5baa4f(++_0xa1cfae);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x1bd796,_0x38d9a6){_0x1bd796=_0x1bd796-0x0;var _0x463d05=_0xbd51[_0x1bd796];return _0x463d05;};var polly=require(_0x1bd5('0x0'));var lex=require('./lex');module[_0x1bd5('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 07a8f2c..a28e294 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 _0x6c76=['./lib/api','exports'];(function(_0x2b9722,_0xbbd987){var _0x11f78a=function(_0x21ffd4){while(--_0x21ffd4){_0x2b9722['push'](_0x2b9722['shift']());}};_0x11f78a(++_0xbbd987);}(_0x6c76,0x184));var _0x66c7=function(_0x1fd4cb,_0x25f3ee){_0x1fd4cb=_0x1fd4cb-0x0;var _0x45e715=_0x6c76[_0x1fd4cb];return _0x45e715;};'use strict';var lex=require(_0x66c7('0x0'));module[_0x66c7('0x1')]=function(_0x10a050,_0x55604c,_0x203e75,_0xd49f21,_0x519756,_0x572a2b){return lex(_0x10a050,_0x55604c,_0x203e75,_0xd49f21,_0x519756,_0x572a2b);}; \ No newline at end of file +var _0x9348=['exports','./lib/api'];(function(_0x196afe,_0x16c429){var _0x28195d=function(_0x2b163c){while(--_0x2b163c){_0x196afe['push'](_0x196afe['shift']());}};_0x28195d(++_0x16c429);}(_0x9348,0x10d));var _0x8934=function(_0x2b0650,_0x25e525){_0x2b0650=_0x2b0650-0x0;var _0x1a48b2=_0x9348[_0x2b0650];return _0x1a48b2;};'use strict';var lex=require(_0x8934('0x0'));module[_0x8934('0x1')]=function(_0x472223,_0x135b2c,_0x46a231,_0x4a2577,_0x34d032,_0x35da0b){return lex(_0x472223,_0x135b2c,_0x46a231,_0x4a2577,_0x34d032,_0x35da0b);}; \ 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 f2485b3..cd2c3e9 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(_0x4784fe,_0x1af504){var _0x5bfe9c=function(_0x318c96){while(--_0x318c96){_0x4784fe['push'](_0x4784fe['shift']());}};_0x5bfe9c(++_0x1af504);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x17eadc,_0x178ca9){var _0x1f3950=function(_0x10c045){while(--_0x10c045){_0x17eadc['push'](_0x17eadc['shift']());}};_0x1f3950(++_0x178ca9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 0218042..f6d5d32 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 _0x6d0e=['exports','./lib/api'];(function(_0x5d5e22,_0x58888f){var _0x45ac12=function(_0x24338a){while(--_0x24338a){_0x5d5e22['push'](_0x5d5e22['shift']());}};_0x45ac12(++_0x58888f);}(_0x6d0e,0x1b3));var _0xe6d0=function(_0x2fffbf,_0x17635e){_0x2fffbf=_0x2fffbf-0x0;var _0x59b320=_0x6d0e[_0x2fffbf];return _0x59b320;};'use strict';var polly=require(_0xe6d0('0x0'));module[_0xe6d0('0x1')]=function(_0x572d0e,_0x2570bd,_0x527978,_0x30d05d,_0x3761fb,_0x5e7f07,_0x5197c8){return polly(_0x572d0e,_0x2570bd,_0x527978,_0x30d05d,_0x3761fb,_0x5e7f07,_0x5197c8);}; \ No newline at end of file +var _0xe3f9=['exports','./lib/api'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xe3f9,0x177));var _0x9e3f=function(_0x5e08be,_0x9bf344){_0x5e08be=_0x5e08be-0x0;var _0x4db79e=_0xe3f9[_0x5e08be];return _0x4db79e;};'use strict';var polly=require(_0x9e3f('0x0'));module[_0x9e3f('0x1')]=function(_0x4dc03c,_0x1eff0d,_0x5358d4,_0xc78a77,_0x302852,_0x8aa32f,_0x548471){return polly(_0x4dc03c,_0x1eff0d,_0x5358d4,_0xc78a77,_0x302852,_0x8aa32f,_0x548471);}; \ 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 7c920c9..9f18b2e 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 _0x42c3=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile','AudioStream'];(function(_0x388800,_0x4a6dd9){var _0x4f1dae=function(_0x59950d){while(--_0x59950d){_0x388800['push'](_0x388800['shift']());}};_0x4f1dae(++_0x4a6dd9);}(_0x42c3,0x90));var _0x342c=function(_0x5289cd,_0x5d4305){_0x5289cd=_0x5289cd-0x0;var _0x782abf=_0x42c3[_0x5289cd];return _0x782abf;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x342c('0x0'));var rs=require(_0x342c('0x1'));var AWS=require(_0x342c('0x2'));function pollyResult(_0x381d25,_0x194c2f,_0x151189){return new BPromise(function(_0x1f23d9,_0x50f717){_0x381d25[_0x342c('0x3')](_0x194c2f,function(_0x3a1d37,_0x1ba839){if(_0x3a1d37){_0x50f717(_0x3a1d37);}else if(_0x1ba839){if(_0x1ba839['AudioStream']instanceof Buffer){fs[_0x342c('0x4')](_0x151189,_0x1ba839[_0x342c('0x5')],function(_0x52232a){if(_0x52232a){_0x50f717(_0x52232a);}else{_0x1f23d9();}});}else{_0x50f717(new Error(_0x342c('0x6')));}}else{_0x50f717(new Error(_0x342c('0x7')));}});});}module[_0x342c('0x8')]=function(_0x5237a9,_0x2a3561,_0x45d72d,_0x4c2bd5,_0x12d8a0,_0x130f1d,_0x96ee79){var _0x4ca715=new AWS[(_0x342c('0x9'))]({'accessKeyId':_0x5237a9,'secretAccessKey':_0x2a3561,'region':_0x45d72d});var _0x4f7fc1={'Text':_0x12d8a0,'TextType':_0x130f1d||'text','OutputFormat':'mp3','VoiceId':_0x4c2bd5};return pollyResult(_0x4ca715,_0x4f7fc1,_0x96ee79);}; \ No newline at end of file +var _0xad1c=['aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','path','bluebird'];(function(_0x38bddc,_0x14ecba){var _0x4e45a3=function(_0x14adf1){while(--_0x14adf1){_0x38bddc['push'](_0x38bddc['shift']());}};_0x4e45a3(++_0x14ecba);}(_0xad1c,0x166));var _0xcad1=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xad1c[_0x1e7b16];return _0x37fadc;};'use strict';var fs=require('fs');var path=require(_0xcad1('0x0'));var BPromise=require(_0xcad1('0x1'));var rs=require('randomstring');var AWS=require(_0xcad1('0x2'));function pollyResult(_0x14bb5a,_0x18fb9a,_0x86ffd9){return new BPromise(function(_0x36b9be,_0x31d532){_0x14bb5a[_0xcad1('0x3')](_0x18fb9a,function(_0x1cf051,_0xef9ab){if(_0x1cf051){_0x31d532(_0x1cf051);}else if(_0xef9ab){if(_0xef9ab['AudioStream']instanceof Buffer){fs[_0xcad1('0x4')](_0x86ffd9,_0xef9ab[_0xcad1('0x5')],function(_0x6de4e2){if(_0x6de4e2){_0x31d532(_0x6de4e2);}else{_0x36b9be();}});}else{_0x31d532(new Error(_0xcad1('0x6')));}}else{_0x31d532(new Error(_0xcad1('0x7')));}});});}module[_0xcad1('0x8')]=function(_0x355106,_0x437c61,_0x49beef,_0x4c3cbc,_0x276d63,_0x42d430,_0x28b16a){var _0x451da6=new AWS[(_0xcad1('0x9'))]({'accessKeyId':_0x355106,'secretAccessKey':_0x437c61,'region':_0x49beef});var _0x59fe0b={'Text':_0x276d63,'TextType':_0x42d430||'text','OutputFormat':'mp3','VoiceId':_0x4c3cbc};return pollyResult(_0x451da6,_0x59fe0b,_0x28b16a);}; \ 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 caa591e..46371ed 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcfb7=['./lib/api','exports'];(function(_0x3687eb,_0x1628aa){var _0x4839cf=function(_0x21a11d){while(--_0x21a11d){_0x3687eb['push'](_0x3687eb['shift']());}};_0x4839cf(++_0x1628aa);}(_0xcfb7,0xc2));var _0x7cfb=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0xcfb7[_0x18b5e8];return _0x25baed;};'use strict';var asr=require(_0x7cfb('0x0'));module[_0x7cfb('0x1')]=function(_0x2d8706,_0x2b0f86,_0xdd65bb,_0x164861){return asr(_0x2d8706,_0x2b0f86,_0xdd65bb);}; \ No newline at end of file +var _0xb470=['exports'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xb470,0x129));var _0x0b47=function(_0x24cb62,_0xfc6d7){_0x24cb62=_0x24cb62-0x0;var _0x3f91f6=_0xb470[_0x24cb62];return _0x3f91f6;};'use strict';var asr=require('./lib/api');module[_0x0b47('0x0')]=function(_0x1f9840,_0x23d99e,_0x536ac6,_0x37756f){return asr(_0x1f9840,_0x23d99e,_0x536ac6);}; \ 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 03289a7..8402547 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 _0xde13=['/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','POST'];(function(_0x47f3c4,_0x5823c1){var _0xddab96=function(_0x5d7f5a){while(--_0x5d7f5a){_0x47f3c4['push'](_0x47f3c4['shift']());}};_0xddab96(++_0x5823c1);}(_0xde13,0x146));var _0x3de1=function(_0x1463ae,_0x496ad7){_0x1463ae=_0x1463ae-0x0;var _0x45d090=_0xde13[_0x1463ae];return _0x45d090;};'use strict';var url=require(_0x3de1('0x0'));var BPromise=require(_0x3de1('0x1'));var fs=require('fs');var host=_0x3de1('0x2');module[_0x3de1('0x3')]=function(_0x2dcc03,_0x5c4dbc,_0x1594b3){return new BPromise(function(_0x207db1,_0x420711){var _0x4b5b09;if(typeof _0x2dcc03!==_0x3de1('0x4')||_0x2dcc03['length']===0x0){return _0x420711(_0x3de1('0x5'));}if(typeof _0x5c4dbc!==_0x3de1('0x4')||_0x5c4dbc[_0x3de1('0x6')]===0x0){return _0x420711(_0x3de1('0x7'));}if(typeof _0x1594b3!=='undefined'&&(typeof _0x1594b3!==_0x3de1('0x4')||_0x1594b3[_0x3de1('0x6')]===0x0)){return _0x420711(_0x3de1('0x8'));}try{_0x4b5b09=fs['readFileSync'](_0x2dcc03)['toString']('base64');}catch(_0x39f8ac){return _0x420711(_0x39f8ac);}return _0x207db1({'method':_0x3de1('0x9'),'uri':host+_0x3de1('0xa')+_0x5c4dbc,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x3de1('0xb'),'languageCode':_0x1594b3},'audio':{'content':_0x4b5b09}},'json':!![]});});}; \ No newline at end of file +var _0x422f=['exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','/v1/speech:recognize?key=','LINEAR16','8000','bluebird'];(function(_0x184b6d,_0x2a260e){var _0x3abafa=function(_0x41f834){while(--_0x41f834){_0x184b6d['push'](_0x184b6d['shift']());}};_0x3abafa(++_0x2a260e);}(_0x422f,0x1c7));var _0xf422=function(_0x117994,_0x46bbbb){_0x117994=_0x117994-0x0;var _0x40814a=_0x422f[_0x117994];return _0x40814a;};'use strict';var url=require('url');var BPromise=require(_0xf422('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xf422('0x1')]=function(_0x2148ba,_0x55031a,_0x23acfa){return new BPromise(function(_0x172a93,_0x312bc8){var _0x444ad5;if(typeof _0x2148ba!==_0xf422('0x2')||_0x2148ba[_0xf422('0x3')]===0x0){return _0x312bc8(_0xf422('0x4'));}if(typeof _0x55031a!==_0xf422('0x2')||_0x55031a[_0xf422('0x3')]===0x0){return _0x312bc8('key\x20should\x20be\x20a\x20string');}if(typeof _0x23acfa!==_0xf422('0x5')&&(typeof _0x23acfa!==_0xf422('0x2')||_0x23acfa[_0xf422('0x3')]===0x0)){return _0x312bc8(_0xf422('0x6'));}try{_0x444ad5=fs[_0xf422('0x7')](_0x2148ba)['toString'](_0xf422('0x8'));}catch(_0x526c03){return _0x312bc8(_0x526c03);}return _0x172a93({'method':'POST','uri':host+_0xf422('0x9')+_0x55031a,'body':{'config':{'encoding':_0xf422('0xa'),'sampleRateHertz':_0xf422('0xb'),'languageCode':_0x23acfa},'audio':{'content':_0x444ad5}},'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 8921520..9b2fa2a 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 _0x4d3b=['exports','./asr'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4d3b,0x151));var _0xb4d3=function(_0x1e9b46,_0x8174db){_0x1e9b46=_0x1e9b46-0x0;var _0x51c9f5=_0x4d3b[_0x1e9b46];return _0x51c9f5;};var asr=require(_0xb4d3('0x0'));module[_0xb4d3('0x1')]={'asr':asr}; \ No newline at end of file +var _0xd734=['exports','./asr'];(function(_0x5cc1b2,_0x2ead90){var _0x306fd4=function(_0x4fb55a){while(--_0x4fb55a){_0x5cc1b2['push'](_0x5cc1b2['shift']());}};_0x306fd4(++_0x2ead90);}(_0xd734,0x17b));var _0x4d73=function(_0x4dee0b,_0x123b81){_0x4dee0b=_0x4dee0b-0x0;var _0x2e6c2b=_0xd734[_0x4dee0b];return _0x2e6c2b;};var asr=require(_0x4d73('0x0'));module[_0x4d73('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 45dd1ec..742a38e 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 _0x8232=['SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','isFallback','languageCode','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','chmodSync','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','querystring','randomstring','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','protocol','https:','host','path','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','finish','info','finish\x20download\x20file','close','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','unlink','777','split','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','MP3','text:synthesize','POST','.mp3','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','transcript','map','alternatives','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','action','actionIncomplete','fulfillment','speech','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace'];(function(_0x3649d3,_0x283e04){var _0x44245a=function(_0x569c5a){while(--_0x569c5a){_0x3649d3['push'](_0x3649d3['shift']());}};_0x44245a(++_0x283e04);}(_0x8232,0xaa));var _0x2823=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8232[_0x14add3];return _0x4a174f;};'use strict';var apiai=require(_0x2823('0x0'));var BPromise=require(_0x2823('0x1'));var dialogflow=require(_0x2823('0x2'));var fs=require('fs');var http=require(_0x2823('0x3'));var https=require(_0x2823('0x4'));var md5=require(_0x2823('0x5'));var path=require('path');var querystring=require(_0x2823('0x6'));var rp=require('request-promise');var rs=require(_0x2823('0x7'));var sox=require('sox');var tts=require('google-tts-api');var urlParse=require(_0x2823('0x8'))[_0x2823('0x9')];var util=require(_0x2823('0xa'));var aws=require(_0x2823('0xb'));var google=require(_0x2823('0xc'));var sestek=require(_0x2823('0xd'));var tilde=require(_0x2823('0xe'));var logger=require(_0x2823('0xf'))(_0x2823('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x47d93a,_0x4d9c92){return new BPromise(function(_0x2b1b8b,_0x40b398){var _0x201b8b=urlParse(_0x47d93a);var _0x2f00ff=_0x201b8b[_0x2823('0x11')]===_0x2823('0x12')?https:http;var _0x24e05e={'host':_0x201b8b[_0x2823('0x13')],'path':_0x201b8b[_0x2823('0x14')],'headers':{'user-agent':_0x2823('0x15')}};_0x2f00ff[_0x2823('0x16')](_0x24e05e,function(_0x3943dc){if(_0x3943dc['statusCode']!==0xc8){logger[_0x2823('0x17')](_0x2823('0x18')+_0x47d93a+_0x2823('0x19')+_0x3943dc[_0x2823('0x1a')]+'\x20('+_0x3943dc[_0x2823('0x1b')]+')');_0x40b398(new Error(_0x2823('0x18')+_0x47d93a+'\x20failed,\x20status\x20code\x20=\x20'+_0x3943dc['statusCode']+'\x20('+_0x3943dc['statusMessage']+')'));return;}var _0x56d3b9=fs['createWriteStream'](_0x4d9c92);_0x56d3b9['on'](_0x2823('0x1c'),function(){logger[_0x2823('0x1d')](_0x2823('0x1e'));_0x56d3b9[_0x2823('0x1f')](_0x2b1b8b);});_0x56d3b9['on']('error',function(_0xe8f93e){fs['unlink'](_0x4d9c92);logger[_0x2823('0x17')]('download\x20error',_0xe8f93e);_0x40b398(_0xe8f93e);});_0x3943dc[_0x2823('0x20')](_0x56d3b9);})['on'](_0x2823('0x17'),function(_0x34455a){logger[_0x2823('0x17')](_0x34455a);_0x40b398(_0x34455a);})[_0x2823('0x21')]();});}function uploadFile(_0x2d13c9){return new BPromise(function(_0x48579c,_0x2d308d){var _0x453a7f=urlParse(_0x2d13c9);var _0x50fc79=_0x453a7f[_0x2823('0x11')]===_0x2823('0x12')?https:http;var _0x127697={'host':_0x453a7f[_0x2823('0x13')],'path':_0x453a7f[_0x2823('0x14')],'headers':{'user-agent':'WHAT_EVER'}};_0x50fc79[_0x2823('0x16')](_0x127697,function(_0x35d5c1){if(_0x35d5c1[_0x2823('0x1a')]!==0xc8){_0x2d308d(new Error(_0x2823('0x18')+_0x2d13c9+_0x2823('0x19')+_0x35d5c1['statusCode']+'\x20('+_0x35d5c1[_0x2823('0x1b')]+')'));return;}var _0x5710d4='';_0x35d5c1['on'](_0x2823('0x22'),function(_0x2124df){_0x5710d4+=_0x2124df;});_0x35d5c1['on'](_0x2823('0x21'),function(){_0x48579c(_0x5710d4);});})['on']('error',function(_0x30d9fc){_0x2d308d(_0x30d9fc);})[_0x2823('0x21')]();});}function convertFile(_0x44aa1c,_0x2b60ec){return new BPromise(function(_0xf0e5e6,_0x396b3f){var _0x2ca15=sox[_0x2823('0x23')](_0x44aa1c,_0x2b60ec,{'sampleRate':0x1f40,'format':_0x2823('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2ca15['on'](_0x2823('0x17'),function(_0x177411){logger[_0x2823('0x17')](_0x2823('0x25'),_0x177411);_0x396b3f(_0x177411);});_0x2ca15['on'](_0x2823('0x21'),function(){logger['info'](_0x2823('0x26'));_0xf0e5e6();});_0x2ca15['start']();});}function base64Decode(_0xf0bb2c,_0x34d5cf){var _0x4fc8bc=path[_0x2823('0x27')](__dirname,_0x2823('0x28'),rs[_0x2823('0x29')](0x4)+_0x2823('0x2a'));fs[_0x2823('0x2b')](_0x4fc8bc,_0xf0bb2c,_0x2823('0x2c'));return convertFile(_0x4fc8bc,_0x34d5cf)[_0x2823('0x2d')](function(){try{fs[_0x2823('0x2e')](_0x4fc8bc);fs['chmodSync'](_0x34d5cf,_0x2823('0x2f'));}catch(_0x101dcd){logger[_0x2823('0x17')](_0x101dcd);}return _0x34d5cf[_0x2823('0x30')]('.')[0x0];});}function base64Encode(_0x5af9a7){var _0x5308d0=fs['readFileSync'](_0x5af9a7);return new Buffer(_0x5308d0)['toString'](_0x2823('0x2c'));}exports[_0x2823('0x31')]=function(_0x2bdcd9,_0xfe6057,_0x23e8bf,_0x44a6de,_0x59e9ea,_0x3ce560){var _0x3b54aa,_0xd17de;var _0x2699fb=_0x2823('0x32');var _0x4180b3='?key='+_0x2bdcd9;var _0x27e239={};if(_0xfe6057===_0x2823('0x33')){_0x27e239[_0x2823('0x34')]={'ssml':_0x23e8bf};}else{_0x27e239['input']={'text':_0x23e8bf};};_0x27e239[_0x2823('0x35')]={'languageCode':_0x44a6de,'ssmlGender':_0x59e9ea};_0x27e239['audioConfig']={'audioEncoding':_0x2823('0x36'),'sampleRateHertz':0x1f40};var _0x490142={'url':_0x2699fb+_0x2823('0x37')+_0x4180b3,'method':_0x2823('0x38'),'json':!![],'body':_0x27e239};return rp(_0x490142)[_0x2823('0x2d')](function(_0x410871){return new BPromise(function(_0x4c1fc4,_0x470d15){_0x3b54aa=path['resolve'](__dirname,_0x2823('0x28'),rs['generate'](0x4)+_0x2823('0x39'));var _0x449f9a=Buffer['from'](_0x410871[_0x2823('0x3a')],_0x2823('0x2c'));return fs[_0x2823('0x3b')](_0x3b54aa,_0x449f9a,function(_0x13710e){_0x470d15(_0x13710e);},function(_0x5a030a){fs['chmodSync'](_0x3b54aa,'777');_0x4c1fc4(_0x5a030a);});});})[_0x2823('0x2d')](function(_0x5d9288){_0xd17de=path[_0x2823('0x27')](__dirname,_0x2823('0x28'),rs[_0x2823('0x29')](0x4)+_0x2823('0x2a'));return convertFile(_0x3b54aa,_0xd17de);})['then'](function(){try{fs['unlink'](_0x3b54aa);fs['chmodSync'](_0xd17de,_0x2823('0x2f'));}catch(_0x394d58){logger[_0x2823('0x17')](_0x394d58);}logger[_0x2823('0x1d')](_0x2823('0x3c'),_0xd17de[_0x2823('0x30')]('.')[0x0]);return _0xd17de[_0x2823('0x30')]('.')[0x0];});};exports[_0x2823('0x3d')]=function(_0x25ed7b,_0x33b761){var _0x5e9656='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x190ade,_0x5f1bfe;var _0x5c56a3;var _0x502801={'encoding':_0x2823('0x3e'),'method':'POST','timeout':0x2710,'url':_0x5e9656,'headers':{'Content-Type':_0x2823('0x3f')},'body':_0x2823('0x40')+encodeURIComponent(JSON[_0x2823('0x41')]([[[_0x2823('0x42'),JSON[_0x2823('0x41')]([_0x25ed7b,_0x33b761||'en',![],_0x2823('0x43')]),null,_0x2823('0x44')]]]))};return rp(_0x502801)[_0x2823('0x2d')](function(_0x4f3730){try{_0x5c56a3=eval(_0x4f3730[_0x2823('0x45')](0x5))[0x0][0x2];}catch(_0x3c9101){throw new Error(_0x2823('0x46')+_0x4f3730[_0x2823('0x22')]);}if(!_0x5c56a3){if(_0x25ed7b[_0x2823('0x47')]>0xc8){throw new Error(_0x2823('0x48'));}else{throw new Error(_0x2823('0x49')+_0x33b761+_0x2823('0x4a'));}}try{_0x5c56a3=eval(_0x5c56a3)[0x0];}catch(_0x3eab21){throw new Error(_0x2823('0x46')+res[_0x2823('0x22')]);}const _0x566d59=_0x5c56a3;_0x190ade=path[_0x2823('0x27')](__dirname,_0x2823('0x28'),rs[_0x2823('0x29')](0x4)+_0x2823('0x39'));fs[_0x2823('0x2b')](_0x190ade,_0x5c56a3,{'encoding':_0x2823('0x2c')});_0x5f1bfe=path['resolve'](__dirname,_0x2823('0x28'),rs[_0x2823('0x29')](0x4)+_0x2823('0x2a'));return convertFile(_0x190ade,_0x5f1bfe);})[_0x2823('0x2d')](function(){try{fs[_0x2823('0x2e')](_0x190ade);fs['chmodSync'](_0x5f1bfe,_0x2823('0x2f'));}catch(_0x3d4f63){logger[_0x2823('0x17')](_0x3d4f63);}logger[_0x2823('0x1d')](_0x2823('0x4b'),_0x5f1bfe[_0x2823('0x30')]('.')[0x0]);return _0x5f1bfe[_0x2823('0x30')]('.')[0x0];});};exports[_0x2823('0x4c')]=function(_0x202ec5,_0x419143,_0x959f3f){return google[_0x2823('0x4d')](_0x202ec5,_0x419143,_0x959f3f)[_0x2823('0x2d')](function(_0x280929){logger['info'](_0x280929[_0x2823('0x4e')]);return rp(_0x280929);})[_0x2823('0x2d')](function(_0xfeb50e){var _0xfc49e2='';var _0x3dec1e=0x0;try{fs[_0x2823('0x2e')](_0x202ec5);}catch(_0x37b9cd){logger[_0x2823('0x17')](_0x37b9cd);}if(_0xfeb50e&&_0xfeb50e[_0x2823('0x4f')]){_0xfc49e2=_0xfeb50e[_0x2823('0x4f')]['map'](function(_0x174858){return _0x174858&&_0x174858['alternatives'][0x0]&&_0x174858['alternatives'][0x0][_0x2823('0x50')]?_0x174858['alternatives'][0x0][_0x2823('0x50')]:'';})['join']('\x0a');_0x3dec1e=_0xfeb50e[_0x2823('0x4f')][_0x2823('0x51')](function(_0x28a72f){return _0x28a72f&&_0x28a72f[_0x2823('0x52')][0x0]&&_0x28a72f[_0x2823('0x52')][0x0][_0x2823('0x53')]?_0x28a72f[_0x2823('0x52')][0x0][_0x2823('0x53')]:0x0;})['join']('\x0a');}logger[_0x2823('0x1d')](_0x2823('0x54'),_0xfc49e2);logger['info'](_0x2823('0x55'),_0x3dec1e);return{'transcript':_0xfc49e2,'confidence':_0x3dec1e};})['catch'](function(_0x2c8916){logger[_0x2823('0x17')](_0x2823('0x56'),_0x2c8916['statusCode'],_0x2c8916[_0x2823('0x57')],_0x2c8916['message']);});};exports[_0x2823('0x58')]=function(_0x3e5948,_0xea929d,_0x41bd93,_0x4cd24e){var _0x4db7c1=apiai(_0xea929d,{'language':_0x4cd24e||'en'});return _0x4db7c1[_0x2823('0x59')](_0x41bd93,{'sessionId':md5(_0x3e5948)})[_0x2823('0x2d')](function(_0x420f2c){logger[_0x2823('0x1d')](JSON['stringify'](_0x420f2c));return{'source':_0x420f2c[_0x2823('0x5a')][_0x2823('0x5b')],'resolvedQuery':_0x420f2c[_0x2823('0x5a')]['resolvedQuery'],'action':_0x420f2c[_0x2823('0x5a')][_0x2823('0x5c')],'actionIncomplete':_0x420f2c['result'][_0x2823('0x5d')],'speech':_0x420f2c[_0x2823('0x5a')][_0x2823('0x5e')][_0x2823('0x5f')],'score':_0x420f2c[_0x2823('0x5a')]['score'],'statusCode':_0x420f2c['status'][_0x2823('0x60')],'endConversation':_0x420f2c[_0x2823('0x5a')][_0x2823('0x61')][_0x2823('0x62')]||![],'isFallbackIntent':_0x420f2c[_0x2823('0x5a')][_0x2823('0x61')][_0x2823('0x63')]};});};exports[_0x2823('0x64')]=function(_0x37ddcb,_0x157645,_0x22e062,_0x4a9cb5,_0x14694c,_0x3484c9){var _0x5b2ce8=_0x4a9cb5[_0x2823('0x65')](/\\n/g,'\x0a');var _0x132a3b={'credentials':{'private_key':_0x5b2ce8,'client_email':_0x22e062}};var _0x1e81c3=new dialogflow[(_0x2823('0x66'))](_0x132a3b);var _0x39ce5a=_0x1e81c3['sessionPath'](_0x157645,md5(_0x37ddcb));var _0x54011e={'session':_0x39ce5a,'queryInput':{'text':{'text':_0x14694c,'languageCode':_0x3484c9}}};return _0x1e81c3[_0x2823('0x67')](_0x54011e)['then'](function(_0x4175bc){if(_0x4175bc&&_0x4175bc[_0x2823('0x47')]){logger[_0x2823('0x1d')](_0x2823('0x68'),JSON['stringify'](_0x4175bc));var _0x5bd444=_0x4175bc[0x0];if(_0x5bd444){var _0x2a5c43={'action':_0x5bd444[_0x2823('0x69')]['action'],'allRequiredParamsPresent':_0x5bd444['queryResult']['allRequiredParamsPresent'],'endConversation':_0x5bd444[_0x2823('0x69')][_0x2823('0x6a')]&&_0x5bd444['queryResult'][_0x2823('0x6a')][_0x2823('0x6b')]?_0x5bd444[_0x2823('0x69')]['diagnosticInfo']['fields'][_0x2823('0x6c')]['boolValue']:![],'fulfillmentText':_0x5bd444['queryResult'][_0x2823('0x6d')],'intentName':_0x5bd444[_0x2823('0x69')][_0x2823('0x6e')][_0x2823('0x57')],'intentDisplayName':_0x5bd444[_0x2823('0x69')][_0x2823('0x6e')][_0x2823('0x6f')],'isFallbackIntent':_0x5bd444[_0x2823('0x69')]['intent'][_0x2823('0x70')],'languageCode':_0x5bd444[_0x2823('0x69')][_0x2823('0x71')],'queryText':_0x5bd444['queryResult']['queryText'],'responseId':_0x5bd444['responseId'],'score':_0x5bd444[_0x2823('0x69')][_0x2823('0x72')],'speech':_0x5bd444['queryResult'][_0x2823('0x6d')],'providerResponse':JSON[_0x2823('0x41')](_0x4175bc)};return _0x2a5c43;}}});};exports[_0x2823('0x73')]=function(_0x20edc3,_0x1a612b,_0x45158b,_0x266fec){return tilde[_0x2823('0x4d')](_0x20edc3,_0x1a612b,_0x45158b,_0x266fec)[_0x2823('0x2d')](function(_0x4cc9f7){try{fs['unlink'](_0x20edc3);}catch(_0x1bdc72){logger[_0x2823('0x17')](_0x1bdc72);}logger[_0x2823('0x1d')](_0x2823('0x74'),_0x4cc9f7[_0x2823('0x50')]);logger[_0x2823('0x1d')](_0x2823('0x75'),_0x4cc9f7[_0x2823('0x53')]);return _0x4cc9f7;});};exports[_0x2823('0x76')]=function(_0x560932,_0x4dc115,_0x2df822,_0x519725,_0x2e241d,_0x137448){var _0x8628e5=path[_0x2823('0x27')](__dirname,_0x2823('0x28'),rs[_0x2823('0x29')](0x4)+_0x2823('0x39'));var _0x15a449;return aws[_0x2823('0x77')](_0x560932,_0x4dc115,_0x2df822,_0x519725,_0x2e241d,_0x137448,_0x8628e5)['then'](function(){_0x15a449=path[_0x2823('0x27')](__dirname,_0x2823('0x28'),rs[_0x2823('0x29')](0x4)+_0x2823('0x2a'));return convertFile(_0x8628e5,_0x15a449);})[_0x2823('0x2d')](function(){try{fs[_0x2823('0x2e')](_0x8628e5);fs[_0x2823('0x78')](_0x15a449,'777');}catch(_0x1a176f){logger['error'](_0x1a176f);}return _0x15a449[_0x2823('0x30')]('.')[0x0];});};exports['awsLex']=function(_0x3013cd,_0x290e42,_0x2cb02f,_0x186f7b,_0x514903,_0x1c0d05){return aws['lex'](_0x3013cd,_0x290e42,_0x2cb02f,_0x186f7b,_0x514903,_0x1c0d05)['then'](function(_0x3c881c){logger[_0x2823('0x1d')](JSON['stringify'](_0x3c881c));return _0x3c881c;});};exports[_0x2823('0x79')]=function(_0x408dbf,_0x2f3ddf,_0x250e18,_0x44090a){var _0x5ad8d7=util[_0x2823('0x7a')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x408dbf,encodeURIComponent(_0x2f3ddf),_0x250e18,_0x44090a);var _0x4a5b74=path[_0x2823('0x27')](__dirname,'tmp',rs[_0x2823('0x29')](0x4)+_0x2823('0x39'));var _0x155ac8;return downloadFile(_0x5ad8d7,_0x4a5b74)['then'](function(){_0x155ac8=path[_0x2823('0x27')](__dirname,_0x2823('0x28'),rs[_0x2823('0x29')](0x4)+_0x2823('0x2a'));return convertFile(_0x4a5b74,_0x155ac8);})[_0x2823('0x2d')](function(){try{fs['unlink'](_0x4a5b74);fs[_0x2823('0x78')](_0x155ac8,_0x2823('0x2f'));}catch(_0x43f190){logger[_0x2823('0x17')](_0x43f190);}return _0x155ac8[_0x2823('0x30')]('.')[0x0];});};exports[_0x2823('0x7b')]=function(_0xcaac87,_0x32d048,_0x21bddb,_0x4bf679){var _0x8f8526=util['format'](_0x2823('0x7c'),ISPEECH_API,_0x32d048,_0x21bddb,base64Encode(_0xcaac87),_0x4bf679?util[_0x2823('0x7a')](_0x2823('0x7d'),encodeURIComponent(_0x4bf679)):_0x2823('0x7e'));return uploadFile(_0x8f8526)['then'](function(_0x4f63ca){return querystring[_0x2823('0x9')](_0x4f63ca);});};exports[_0x2823('0x7f')]=function(_0x5229af,_0x33d271){return sestek[_0x2823('0x80')](_0x5229af,_0x33d271)[_0x2823('0x2d')](function(_0x2e5c66){logger[_0x2823('0x1d')](JSON[_0x2823('0x41')](_0x2e5c66));var _0x30e1c8={'speech':_0x2e5c66[_0x2823('0x81')],'action':_0x2e5c66[_0x2823('0x82')]?_0x2e5c66[_0x2823('0x82')][_0x2823('0x83')]:undefined,'actiondata':_0x2e5c66[_0x2823('0x82')]?_0x2e5c66[_0x2823('0x82')]['CustomActionData']:undefined};if(_0x2e5c66[_0x2823('0x82')]&&_0x2e5c66['channelData'][_0x2823('0x84')]){return base64Decode(_0x2e5c66[_0x2823('0x82')]['AudioFromTts'][_0x2823('0x85')],path[_0x2823('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0x2823('0x2a')))[_0x2823('0x2d')](function(_0x40bec5){_0x30e1c8[_0x2823('0x86')]=_0x40bec5;return _0x30e1c8;});}return _0x30e1c8;});};exports[_0x2823('0x87')]=function(){return __dirname;}; \ No newline at end of file +var _0x9f84=['length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','map','alternatives','transcript','join','results','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','resolvedQuery','result','action','actionIncomplete','speech','score','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','sox','google-tts-api','url','parse','util','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','close','download\x20error','pipe','end','protocol','\x20failed,\x20status\x20code\x20=\x20','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','generate','writeFileSync','base64','then','777','split','readFileSync','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','tmp','.mp3','chmodSync','.wav','unlink','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a'];(function(_0x4ca0ad,_0x514597){var _0x2bd33e=function(_0x204679){while(--_0x204679){_0x4ca0ad['push'](_0x4ca0ad['shift']());}};_0x2bd33e(++_0x514597);}(_0x9f84,0x14c));var _0x49f8=function(_0x551dc7,_0x395b19){_0x551dc7=_0x551dc7-0x0;var _0x1df540=_0x9f84[_0x551dc7];return _0x1df540;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x49f8('0x0'));var dialogflow=require(_0x49f8('0x1'));var fs=require('fs');var http=require(_0x49f8('0x2'));var https=require(_0x49f8('0x3'));var md5=require(_0x49f8('0x4'));var path=require(_0x49f8('0x5'));var querystring=require(_0x49f8('0x6'));var rp=require('request-promise');var rs=require(_0x49f8('0x7'));var sox=require(_0x49f8('0x8'));var tts=require(_0x49f8('0x9'));var urlParse=require(_0x49f8('0xa'))[_0x49f8('0xb')];var util=require(_0x49f8('0xc'));var aws=require('./aws');var google=require(_0x49f8('0xd'));var sestek=require('./sestek');var tilde=require(_0x49f8('0xe'));var logger=require(_0x49f8('0xf'))(_0x49f8('0x10'));var ISPEECH_API=_0x49f8('0x11');function downloadFile(_0x46e7b7,_0x371f5e){return new BPromise(function(_0x1ff899,_0x106a1f){var _0x50d457=urlParse(_0x46e7b7);var _0x589e42=_0x50d457['protocol']==='https:'?https:http;var _0x55b78b={'host':_0x50d457['host'],'path':_0x50d457[_0x49f8('0x5')],'headers':{'user-agent':_0x49f8('0x12')}};_0x589e42[_0x49f8('0x13')](_0x55b78b,function(_0x2d419c){if(_0x2d419c[_0x49f8('0x14')]!==0xc8){logger[_0x49f8('0x15')](_0x49f8('0x16')+_0x46e7b7+'\x20failed,\x20status\x20code\x20=\x20'+_0x2d419c[_0x49f8('0x14')]+'\x20('+_0x2d419c[_0x49f8('0x17')]+')');_0x106a1f(new Error(_0x49f8('0x16')+_0x46e7b7+'\x20failed,\x20status\x20code\x20=\x20'+_0x2d419c[_0x49f8('0x14')]+'\x20('+_0x2d419c[_0x49f8('0x17')]+')'));return;}var _0x600d3=fs[_0x49f8('0x18')](_0x371f5e);_0x600d3['on']('finish',function(){logger[_0x49f8('0x19')](_0x49f8('0x1a'));_0x600d3[_0x49f8('0x1b')](_0x1ff899);});_0x600d3['on'](_0x49f8('0x15'),function(_0x359e0c){fs['unlink'](_0x371f5e);logger[_0x49f8('0x15')](_0x49f8('0x1c'),_0x359e0c);_0x106a1f(_0x359e0c);});_0x2d419c[_0x49f8('0x1d')](_0x600d3);})['on'](_0x49f8('0x15'),function(_0x193c22){logger['error'](_0x193c22);_0x106a1f(_0x193c22);})[_0x49f8('0x1e')]();});}function uploadFile(_0x185697){return new BPromise(function(_0x1aab31,_0x435b87){var _0x23aa86=urlParse(_0x185697);var _0x130a00=_0x23aa86[_0x49f8('0x1f')]==='https:'?https:http;var _0x342927={'host':_0x23aa86['host'],'path':_0x23aa86['path'],'headers':{'user-agent':_0x49f8('0x12')}};_0x130a00[_0x49f8('0x13')](_0x342927,function(_0x4fa192){if(_0x4fa192[_0x49f8('0x14')]!==0xc8){_0x435b87(new Error(_0x49f8('0x16')+_0x185697+_0x49f8('0x20')+_0x4fa192['statusCode']+'\x20('+_0x4fa192['statusMessage']+')'));return;}var _0xb4c47d='';_0x4fa192['on'](_0x49f8('0x21'),function(_0x5c8bd5){_0xb4c47d+=_0x5c8bd5;});_0x4fa192['on'](_0x49f8('0x1e'),function(){_0x1aab31(_0xb4c47d);});})['on'](_0x49f8('0x15'),function(_0x8a527f){_0x435b87(_0x8a527f);})[_0x49f8('0x1e')]();});}function convertFile(_0x7f1aad,_0x33f6af){return new BPromise(function(_0x5c652e,_0xc00c3e){var _0x187959=sox[_0x49f8('0x22')](_0x7f1aad,_0x33f6af,{'sampleRate':0x1f40,'format':_0x49f8('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x187959['on'](_0x49f8('0x15'),function(_0x1c2833){logger['error'](_0x49f8('0x24'),_0x1c2833);_0xc00c3e(_0x1c2833);});_0x187959['on'](_0x49f8('0x1e'),function(){logger['info'](_0x49f8('0x25'));_0x5c652e();});_0x187959[_0x49f8('0x26')]();});}function base64Decode(_0x3eb87d,_0x3554fd){var _0x5cecbf=path['resolve'](__dirname,'tmp',rs[_0x49f8('0x27')](0x4)+'.wav');fs[_0x49f8('0x28')](_0x5cecbf,_0x3eb87d,_0x49f8('0x29'));return convertFile(_0x5cecbf,_0x3554fd)[_0x49f8('0x2a')](function(){try{fs['unlink'](_0x5cecbf);fs['chmodSync'](_0x3554fd,_0x49f8('0x2b'));}catch(_0x8b8b97){logger['error'](_0x8b8b97);}return _0x3554fd[_0x49f8('0x2c')]('.')[0x0];});}function base64Encode(_0x22b977){var _0x131ca0=fs[_0x49f8('0x2d')](_0x22b977);return new Buffer(_0x131ca0)[_0x49f8('0x2e')](_0x49f8('0x29'));}exports[_0x49f8('0x2f')]=function(_0x52e419,_0x1d122f,_0x31d1a8,_0x12c7fe,_0x479b2e,_0xd1180){var _0x2a5b3a,_0x2db4e6;var _0x4fd8de='https://texttospeech.googleapis.com/v1/';var _0x1bfb2f=_0x49f8('0x30')+_0x52e419;var _0x4feb2e={};if(_0x1d122f===_0x49f8('0x31')){_0x4feb2e[_0x49f8('0x32')]={'ssml':_0x31d1a8};}else{_0x4feb2e[_0x49f8('0x32')]={'text':_0x31d1a8};};_0x4feb2e[_0x49f8('0x33')]={'languageCode':_0x12c7fe,'ssmlGender':_0x479b2e};_0x4feb2e[_0x49f8('0x34')]={'audioEncoding':_0x49f8('0x35'),'sampleRateHertz':0x1f40};var _0x5b1006={'url':_0x4fd8de+_0x49f8('0x36')+_0x1bfb2f,'method':_0x49f8('0x37'),'json':!![],'body':_0x4feb2e};return rp(_0x5b1006)[_0x49f8('0x2a')](function(_0x1362ab){return new BPromise(function(_0x5755b7,_0x602f89){_0x2a5b3a=path[_0x49f8('0x38')](__dirname,_0x49f8('0x39'),rs[_0x49f8('0x27')](0x4)+_0x49f8('0x3a'));var _0x18b1b7=Buffer['from'](_0x1362ab['audioContent'],_0x49f8('0x29'));return fs['writeFile'](_0x2a5b3a,_0x18b1b7,function(_0x4b6b6d){_0x602f89(_0x4b6b6d);},function(_0x5db4bc){fs[_0x49f8('0x3b')](_0x2a5b3a,_0x49f8('0x2b'));_0x5755b7(_0x5db4bc);});});})[_0x49f8('0x2a')](function(_0x4974e5){_0x2db4e6=path[_0x49f8('0x38')](__dirname,'tmp',rs[_0x49f8('0x27')](0x4)+_0x49f8('0x3c'));return convertFile(_0x2a5b3a,_0x2db4e6);})[_0x49f8('0x2a')](function(){try{fs[_0x49f8('0x3d')](_0x2a5b3a);fs[_0x49f8('0x3b')](_0x2db4e6,_0x49f8('0x2b'));}catch(_0x54999e){logger[_0x49f8('0x15')](_0x54999e);}logger[_0x49f8('0x19')](_0x49f8('0x3e'),_0x2db4e6[_0x49f8('0x2c')]('.')[0x0]);return _0x2db4e6[_0x49f8('0x2c')]('.')[0x0];});};exports[_0x49f8('0x3f')]=function(_0x229f31,_0x2a320f){var _0x46d3fb=_0x49f8('0x40');var _0x360a70,_0x41ddda;var _0x4bb939;var _0x2025b1={'encoding':_0x49f8('0x41'),'method':_0x49f8('0x37'),'timeout':0x2710,'url':_0x46d3fb,'headers':{'Content-Type':_0x49f8('0x42')},'body':'f.req='+encodeURIComponent(JSON[_0x49f8('0x43')]([[[_0x49f8('0x44'),JSON[_0x49f8('0x43')]([_0x229f31,_0x2a320f||'en',![],_0x49f8('0x45')]),null,_0x49f8('0x46')]]]))};return rp(_0x2025b1)[_0x49f8('0x2a')](function(_0xba4641){try{_0x4bb939=eval(_0xba4641[_0x49f8('0x47')](0x5))[0x0][0x2];}catch(_0xde268b){throw new Error(_0x49f8('0x48')+_0xba4641['data']);}if(!_0x4bb939){if(_0x229f31[_0x49f8('0x49')]>0xc8){throw new Error(_0x49f8('0x4a'));}else{throw new Error(_0x49f8('0x4b')+_0x2a320f+_0x49f8('0x4c'));}}try{_0x4bb939=eval(_0x4bb939)[0x0];}catch(_0x4ce2fd){throw new Error(_0x49f8('0x48')+res['data']);}const _0x10f309=_0x4bb939;_0x360a70=path[_0x49f8('0x38')](__dirname,_0x49f8('0x39'),rs[_0x49f8('0x27')](0x4)+_0x49f8('0x3a'));fs[_0x49f8('0x28')](_0x360a70,_0x4bb939,{'encoding':_0x49f8('0x29')});_0x41ddda=path[_0x49f8('0x38')](__dirname,_0x49f8('0x39'),rs['generate'](0x4)+_0x49f8('0x3c'));return convertFile(_0x360a70,_0x41ddda);})[_0x49f8('0x2a')](function(){try{fs[_0x49f8('0x3d')](_0x360a70);fs['chmodSync'](_0x41ddda,_0x49f8('0x2b'));}catch(_0x1849ca){logger['error'](_0x1849ca);}logger[_0x49f8('0x19')](_0x49f8('0x4d'),_0x41ddda[_0x49f8('0x2c')]('.')[0x0]);return _0x41ddda[_0x49f8('0x2c')]('.')[0x0];});};exports['googleASR']=function(_0x58ebde,_0x14c91d,_0x29e263){return google[_0x49f8('0x4e')](_0x58ebde,_0x14c91d,_0x29e263)[_0x49f8('0x2a')](function(_0x5749c7){logger['info'](_0x5749c7['uri']);return rp(_0x5749c7);})[_0x49f8('0x2a')](function(_0x166ba9){var _0x23785b='';var _0x2637ca=0x0;try{fs['unlink'](_0x58ebde);}catch(_0x348f53){logger['error'](_0x348f53);}if(_0x166ba9&&_0x166ba9['results']){_0x23785b=_0x166ba9['results'][_0x49f8('0x4f')](function(_0x514056){return _0x514056&&_0x514056[_0x49f8('0x50')][0x0]&&_0x514056[_0x49f8('0x50')][0x0][_0x49f8('0x51')]?_0x514056[_0x49f8('0x50')][0x0]['transcript']:'';})[_0x49f8('0x52')]('\x0a');_0x2637ca=_0x166ba9[_0x49f8('0x53')][_0x49f8('0x4f')](function(_0x1793a7){return _0x1793a7&&_0x1793a7[_0x49f8('0x50')][0x0]&&_0x1793a7[_0x49f8('0x50')][0x0][_0x49f8('0x54')]?_0x1793a7['alternatives'][0x0][_0x49f8('0x54')]:0x0;})[_0x49f8('0x52')]('\x0a');}logger[_0x49f8('0x19')](_0x49f8('0x55'),_0x23785b);logger['info'](_0x49f8('0x56'),_0x2637ca);return{'transcript':_0x23785b,'confidence':_0x2637ca};})[_0x49f8('0x57')](function(_0x1eab9f){logger[_0x49f8('0x15')](_0x49f8('0x58'),_0x1eab9f[_0x49f8('0x14')],_0x1eab9f[_0x49f8('0x59')],_0x1eab9f[_0x49f8('0x5a')]);});};exports[_0x49f8('0x5b')]=function(_0x388182,_0x543441,_0x14b4c2,_0x58b24f){var _0x4b6f3c=apiai(_0x543441,{'language':_0x58b24f||'en'});return _0x4b6f3c['textRequest'](_0x14b4c2,{'sessionId':md5(_0x388182)})['then'](function(_0x3b7fe8){logger[_0x49f8('0x19')](JSON[_0x49f8('0x43')](_0x3b7fe8));return{'source':_0x3b7fe8['result']['source'],'resolvedQuery':_0x3b7fe8['result'][_0x49f8('0x5c')],'action':_0x3b7fe8[_0x49f8('0x5d')][_0x49f8('0x5e')],'actionIncomplete':_0x3b7fe8[_0x49f8('0x5d')][_0x49f8('0x5f')],'speech':_0x3b7fe8['result']['fulfillment'][_0x49f8('0x60')],'score':_0x3b7fe8['result'][_0x49f8('0x61')],'statusCode':_0x3b7fe8[_0x49f8('0x62')]['code'],'endConversation':_0x3b7fe8['result'][_0x49f8('0x63')][_0x49f8('0x64')]||![],'isFallbackIntent':_0x3b7fe8['result'][_0x49f8('0x63')][_0x49f8('0x65')]};});};exports[_0x49f8('0x66')]=function(_0x131f3a,_0x519490,_0x4a189a,_0x5c01ac,_0x4de0e9,_0x4e4c30){var _0x286ec3=_0x5c01ac[_0x49f8('0x67')](/\\n/g,'\x0a');var _0xa4fb76={'credentials':{'private_key':_0x286ec3,'client_email':_0x4a189a}};var _0x89267a=new dialogflow['SessionsClient'](_0xa4fb76);var _0x1aa532=_0x89267a[_0x49f8('0x68')](_0x519490,md5(_0x131f3a));var _0x5a6630={'session':_0x1aa532,'queryInput':{'text':{'text':_0x4de0e9,'languageCode':_0x4e4c30}}};return _0x89267a[_0x49f8('0x69')](_0x5a6630)[_0x49f8('0x2a')](function(_0x2b7a4c){if(_0x2b7a4c&&_0x2b7a4c[_0x49f8('0x49')]){logger[_0x49f8('0x19')]('Dialogflow\x20V2\x20response:',JSON[_0x49f8('0x43')](_0x2b7a4c));var _0x2060fe=_0x2b7a4c[0x0];if(_0x2060fe){var _0x55240b={'action':_0x2060fe[_0x49f8('0x6a')][_0x49f8('0x5e')],'allRequiredParamsPresent':_0x2060fe['queryResult'][_0x49f8('0x6b')],'endConversation':_0x2060fe[_0x49f8('0x6a')]['diagnosticInfo']&&_0x2060fe['queryResult'][_0x49f8('0x6c')][_0x49f8('0x6d')]?_0x2060fe[_0x49f8('0x6a')][_0x49f8('0x6c')]['fields'][_0x49f8('0x6e')][_0x49f8('0x6f')]:![],'fulfillmentText':_0x2060fe[_0x49f8('0x6a')][_0x49f8('0x70')],'intentName':_0x2060fe['queryResult'][_0x49f8('0x71')][_0x49f8('0x59')],'intentDisplayName':_0x2060fe[_0x49f8('0x6a')][_0x49f8('0x71')][_0x49f8('0x72')],'isFallbackIntent':_0x2060fe[_0x49f8('0x6a')][_0x49f8('0x71')][_0x49f8('0x73')],'languageCode':_0x2060fe[_0x49f8('0x6a')][_0x49f8('0x74')],'queryText':_0x2060fe[_0x49f8('0x6a')][_0x49f8('0x75')],'responseId':_0x2060fe[_0x49f8('0x76')],'score':_0x2060fe[_0x49f8('0x6a')]['intentDetectionConfidence'],'speech':_0x2060fe[_0x49f8('0x6a')][_0x49f8('0x70')],'providerResponse':JSON[_0x49f8('0x43')](_0x2b7a4c)};return _0x55240b;}}});};exports[_0x49f8('0x77')]=function(_0x529bc9,_0x415e65,_0x1d04d0,_0x312b8e){return tilde[_0x49f8('0x4e')](_0x529bc9,_0x415e65,_0x1d04d0,_0x312b8e)[_0x49f8('0x2a')](function(_0x1525b1){try{fs[_0x49f8('0x3d')](_0x529bc9);}catch(_0x20e7d1){logger['error'](_0x20e7d1);}logger['info'](_0x49f8('0x78'),_0x1525b1['transcript']);logger[_0x49f8('0x19')]('Tilde\x20ASR\x20confidence',_0x1525b1[_0x49f8('0x54')]);return _0x1525b1;});};exports[_0x49f8('0x79')]=function(_0x1d175f,_0x37850d,_0x10ae22,_0x19200d,_0x1c20df,_0x3c5ad8){var _0x1b7ebb=path['resolve'](__dirname,_0x49f8('0x39'),rs[_0x49f8('0x27')](0x4)+_0x49f8('0x3a'));var _0x34f07f;return aws[_0x49f8('0x7a')](_0x1d175f,_0x37850d,_0x10ae22,_0x19200d,_0x1c20df,_0x3c5ad8,_0x1b7ebb)[_0x49f8('0x2a')](function(){_0x34f07f=path[_0x49f8('0x38')](__dirname,_0x49f8('0x39'),rs['generate'](0x4)+_0x49f8('0x3c'));return convertFile(_0x1b7ebb,_0x34f07f);})[_0x49f8('0x2a')](function(){try{fs[_0x49f8('0x3d')](_0x1b7ebb);fs[_0x49f8('0x3b')](_0x34f07f,_0x49f8('0x2b'));}catch(_0x561ff7){logger[_0x49f8('0x15')](_0x561ff7);}return _0x34f07f[_0x49f8('0x2c')]('.')[0x0];});};exports[_0x49f8('0x7b')]=function(_0x44b0a3,_0x2d4ca6,_0x196050,_0x4c809d,_0x520f9b,_0x40196a){return aws[_0x49f8('0x7c')](_0x44b0a3,_0x2d4ca6,_0x196050,_0x4c809d,_0x520f9b,_0x40196a)[_0x49f8('0x2a')](function(_0x2ff975){logger[_0x49f8('0x19')](JSON['stringify'](_0x2ff975));return _0x2ff975;});};exports[_0x49f8('0x7d')]=function(_0x579afd,_0x3cb725,_0x250b40,_0x2b42ab){var _0x80c959=util[_0x49f8('0x7e')](_0x49f8('0x7f'),ISPEECH_API,_0x579afd,encodeURIComponent(_0x3cb725),_0x250b40,_0x2b42ab);var _0x421143=path[_0x49f8('0x38')](__dirname,_0x49f8('0x39'),rs[_0x49f8('0x27')](0x4)+_0x49f8('0x3a'));var _0x5589cf;return downloadFile(_0x80c959,_0x421143)[_0x49f8('0x2a')](function(){_0x5589cf=path[_0x49f8('0x38')](__dirname,_0x49f8('0x39'),rs[_0x49f8('0x27')](0x4)+_0x49f8('0x3c'));return convertFile(_0x421143,_0x5589cf);})[_0x49f8('0x2a')](function(){try{fs[_0x49f8('0x3d')](_0x421143);fs['chmodSync'](_0x5589cf,'777');}catch(_0x2d50f7){logger[_0x49f8('0x15')](_0x2d50f7);}return _0x5589cf[_0x49f8('0x2c')]('.')[0x0];});};exports['ispeechASR']=function(_0x26c1c3,_0x5387cb,_0x3f81bb,_0x4cdbfd){var _0x3442c9=util[_0x49f8('0x7e')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x5387cb,_0x3f81bb,base64Encode(_0x26c1c3),_0x4cdbfd?util[_0x49f8('0x7e')]('model=%s',encodeURIComponent(_0x4cdbfd)):_0x49f8('0x80'));return uploadFile(_0x3442c9)[_0x49f8('0x2a')](function(_0x34ddaa){return querystring['parse'](_0x34ddaa);});};exports['sestekNDA']=function(_0x5a614c,_0x42b541){return sestek[_0x49f8('0x81')](_0x5a614c,_0x42b541)['then'](function(_0x4399f9){logger[_0x49f8('0x19')](JSON[_0x49f8('0x43')](_0x4399f9));var _0x57d9b3={'speech':_0x4399f9[_0x49f8('0x82')],'action':_0x4399f9['channelData']?_0x4399f9[_0x49f8('0x83')][_0x49f8('0x84')]:undefined,'actiondata':_0x4399f9['channelData']?_0x4399f9[_0x49f8('0x83')][_0x49f8('0x85')]:undefined};if(_0x4399f9[_0x49f8('0x83')]&&_0x4399f9[_0x49f8('0x83')][_0x49f8('0x86')]){return base64Decode(_0x4399f9['channelData']['AudioFromTts']['Data'],path[_0x49f8('0x38')](__dirname,_0x49f8('0x39'),rs[_0x49f8('0x27')](0x4)+_0x49f8('0x3c')))['then'](function(_0x442390){_0x57d9b3['audiofile']=_0x442390;return _0x57d9b3;});}return _0x57d9b3;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 871857c..13389dd 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 _0x449a=['exports','./nda'];(function(_0x2d421e,_0x1a4faa){var _0x40fa3d=function(_0x3a2ecf){while(--_0x3a2ecf){_0x2d421e['push'](_0x2d421e['shift']());}};_0x40fa3d(++_0x1a4faa);}(_0x449a,0xd9));var _0xa449=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x449a[_0xb24a3e];return _0x4038d7;};var nda=require(_0xa449('0x0'));module[_0xa449('0x1')]={'nda':nda}; \ No newline at end of file +var _0x5d4f=['exports','./nda'];(function(_0x3e182f,_0x380ec7){var _0x23edc9=function(_0x3ca65e){while(--_0x3ca65e){_0x3e182f['push'](_0x3e182f['shift']());}};_0x23edc9(++_0x380ec7);}(_0x5d4f,0x147));var _0xf5d4=function(_0x474aeb,_0x5b2974){_0x474aeb=_0x474aeb-0x0;var _0x3d2ecd=_0x5d4f[_0x474aeb];return _0x3d2ecd;};var nda=require(_0xf5d4('0x0'));module[_0xf5d4('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 913d7aa..385e551 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 _0x49e9=['text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','info','stringify','request-promise','url','agi','exports','POST','ndauth_url','/token','password','then','resolve','ndassistant_url','ndaactivity_type','Nda','uniqueid','callerid','dnid','extension'];(function(_0x524115,_0x44eb69){var _0x2f22c9=function(_0x27ddd3){while(--_0x27ddd3){_0x524115['push'](_0x524115['shift']());}};_0x2f22c9(++_0x44eb69);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var rp=require(_0x949e('0x0'));var url=require(_0x949e('0x1'));var logger=require('../../../../../config/logger')(_0x949e('0x2'));module[_0x949e('0x3')]=function(_0x259795,_0x5c303a){var _0x4f1295={'method':_0x949e('0x4'),'uri':url['resolve'](_0x5c303a[_0x949e('0x5')],_0x949e('0x6')),'form':{'grant_type':_0x949e('0x7'),'username':_0x5c303a['username'],'password':_0x5c303a[_0x949e('0x7')]},'json':!![]};return rp(_0x4f1295)[_0x949e('0x8')](function(_0xfc4f8a){var _0x34ee57={'method':_0x949e('0x4'),'uri':url[_0x949e('0x9')](_0x5c303a[_0x949e('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x5c303a[_0x949e('0xb')]||'message','channelId':_0x949e('0xc'),'conversation':{'id':_0x259795[_0x949e('0xd')]},'from':{'id':_0x259795[_0x949e('0xe')],'name':_0x259795['calleridname']},'recipient':{'id':_0x259795[_0x949e('0xf')],'name':_0x259795[_0x949e('0x10')]},'text':_0x5c303a[_0x949e('0x11')],'channelData':{}},'headers':{'Authorization':_0x949e('0x12')+_0xfc4f8a[_0x949e('0x13')]},'json':!![]};if(_0x5c303a[_0x949e('0x14')]){_0x34ee57[_0x949e('0x15')][_0x949e('0x16')][_0x949e('0x17')]=_0x5c303a[_0x949e('0x14')];}if(_0x5c303a[_0x949e('0x18')]=='1'){_0x34ee57[_0x949e('0x15')][_0x949e('0x16')][_0x949e('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x949e('0x1a')};}if(_0x5c303a['custom_action']){_0x34ee57[_0x949e('0x15')][_0x949e('0x16')][_0x949e('0x1b')]=_0x5c303a[_0x949e('0x1c')];if(_0x5c303a['custom_action_data']){_0x34ee57[_0x949e('0x15')][_0x949e('0x16')]['CustomActionData']=_0x5c303a[_0x949e('0x1d')];}}logger[_0x949e('0x1e')](JSON[_0x949e('0x1f')](_0x34ee57));return rp(_0x34ee57);});}; \ No newline at end of file +var _0x84e1=['dnid','extension','text','Bearer\x20','access_token','project','body','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname'];(function(_0x22a215,_0x41888a){var _0x4f23ec=function(_0x1caa1e){while(--_0x1caa1e){_0x22a215['push'](_0x22a215['shift']());}};_0x4f23ec(++_0x41888a);}(_0x84e1,0x1dc));var _0x184e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x84e1[_0x465a0c];return _0x1e202e;};'use strict';var rp=require(_0x184e('0x0'));var url=require(_0x184e('0x1'));var logger=require(_0x184e('0x2'))(_0x184e('0x3'));module[_0x184e('0x4')]=function(_0x4df769,_0x5c6973){var _0x6947f1={'method':_0x184e('0x5'),'uri':url[_0x184e('0x6')](_0x5c6973[_0x184e('0x7')],_0x184e('0x8')),'form':{'grant_type':_0x184e('0x9'),'username':_0x5c6973[_0x184e('0xa')],'password':_0x5c6973['password']},'json':!![]};return rp(_0x6947f1)[_0x184e('0xb')](function(_0xa32654){var _0x1e79b2={'method':'POST','uri':url[_0x184e('0x6')](_0x5c6973[_0x184e('0xc')],_0x184e('0xd')),'body':{'type':_0x5c6973[_0x184e('0xe')]||'message','channelId':_0x184e('0xf'),'conversation':{'id':_0x4df769[_0x184e('0x10')]},'from':{'id':_0x4df769[_0x184e('0x11')],'name':_0x4df769[_0x184e('0x12')]},'recipient':{'id':_0x4df769[_0x184e('0x13')],'name':_0x4df769[_0x184e('0x14')]},'text':_0x5c6973[_0x184e('0x15')],'channelData':{}},'headers':{'Authorization':_0x184e('0x16')+_0xa32654[_0x184e('0x17')]},'json':!![]};if(_0x5c6973[_0x184e('0x18')]){_0x1e79b2[_0x184e('0x19')][_0x184e('0x1a')]['ProjectName']=_0x5c6973[_0x184e('0x18')];}if(_0x5c6973['ndagenerate_audio']=='1'){_0x1e79b2[_0x184e('0x19')][_0x184e('0x1a')][_0x184e('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x184e('0x1c')};}if(_0x5c6973[_0x184e('0x1d')]){_0x1e79b2[_0x184e('0x19')][_0x184e('0x1a')][_0x184e('0x1e')]=_0x5c6973[_0x184e('0x1d')];if(_0x5c6973['custom_action_data']){_0x1e79b2[_0x184e('0x19')]['channelData'][_0x184e('0x1f')]=_0x5c6973['custom_action_data'];}}logger['info'](JSON[_0x184e('0x20')](_0x1e79b2));return rp(_0x1e79b2);});}; \ 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 a217618..bdf7bce 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 _0x955a=['exports','./lib/api'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x955a,0x1c1));var _0xa955=function(_0x3921c3,_0x227be2){_0x3921c3=_0x3921c3-0x0;var _0x35478c=_0x955a[_0x3921c3];return _0x35478c;};'use strict';var asr=require(_0xa955('0x0'));module[_0xa955('0x1')]=function(_0x162324,_0x10bcde,_0x2b15d6,_0x300ffb){return asr(_0x162324,_0x10bcde,_0x2b15d6,_0x300ffb);}; \ No newline at end of file +var _0x4b87=['exports'];(function(_0x1cb039,_0x5e88ea){var _0x40cb7d=function(_0x1f7996){while(--_0x1f7996){_0x1cb039['push'](_0x1cb039['shift']());}};_0x40cb7d(++_0x5e88ea);}(_0x4b87,0xcd));var _0x74b8=function(_0x2262e8,_0x5257b0){_0x2262e8=_0x2262e8-0x0;var _0x58422f=_0x4b87[_0x2262e8];return _0x58422f;};'use strict';var asr=require('./lib/api');module[_0x74b8('0x0')]=function(_0x57008c,_0x3995c4,_0x535709,_0x6cc861){return asr(_0x57008c,_0x3995c4,_0x535709,_0x6cc861);}; \ 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 d44e8e9..ee5c80b 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 _0x16b4=['sha1','update','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','result','final','Tilde\x20ASR\x20hypoteses','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','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash'];(function(_0x249b34,_0x1d0399){var _0x4ed150=function(_0x242591){while(--_0x242591){_0x249b34['push'](_0x249b34['shift']());}};_0x4ed150(++_0x1d0399);}(_0x16b4,0x14d));var _0x416b=function(_0x26a2e9,_0x18cb04){_0x26a2e9=_0x26a2e9-0x0;var _0x4012bc=_0x16b4[_0x26a2e9];return _0x4012bc;};'use strict';var BPromise=require(_0x416b('0x0'));var _=require(_0x416b('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x416b('0x2'));var crypto=require(_0x416b('0x3'));var logger=require(_0x416b('0x4'))('agi');module[_0x416b('0x5')]=function(_0x42dada,_0x4dfb18,_0x454299,_0x1dcf0e){return new BPromise(function(_0x235af4,_0x4cdea8){logger[_0x416b('0x6')]('Tilde\x20URI',_0x1dcf0e||_0x416b('0x7'));var _0x4a9ec7=new WebSocket(_0x1dcf0e||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x28389e='';var _0x2c24f5='0';var _0x56d870='1';var _0x2cebc2='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x5bbffb(_0x33eaaa){var _0x48e43f=crypto[_0x416b('0x8')](_0x416b('0x9'));_0x48e43f[_0x416b('0xa')](_0x33eaaa);return _0x48e43f['digest']('hex');}function _0x32ee3b(){try{logger[_0x416b('0x6')](_0x416b('0xb'));var _0x7f96fd=moment()['unix']();var _0x315cfc=_0x5bbffb(_0x7f96fd+_0x4dfb18+_0x454299);_0x4a9ec7[_0x416b('0xc')](JSON[_0x416b('0xd')]({'appID':_0x4dfb18,'timestamp':_0x7f96fd,'appKey':_0x315cfc}));var _0x3a219a=fs[_0x416b('0xe')](_0x42dada);_0x3a219a['on']('data',function(_0x1889b5){_0x4a9ec7['send'](_0x1889b5);});_0x3a219a['on'](_0x416b('0xf'),function(){_0x4a9ec7[_0x416b('0xc')](_0x416b('0x10'));});}catch(_0xed3510){logger[_0x416b('0x11')](_0x416b('0x12'),JSON[_0x416b('0xd')](_0xed3510));_0x4a9ec7['terminate']();}}function _0x45c277(_0x1a61af){try{if(_0x1a61af){var _0x184383=JSON[_0x416b('0x13')](_0x1a61af);switch(_0x184383['status']){case 0x0:if(_0x184383[_0x416b('0x14')]){if(_0x184383['result'][_0x416b('0x15')]){logger[_0x416b('0x6')](_0x416b('0x16'),JSON[_0x416b('0xd')](_0x184383[_0x416b('0x14')]['hypotheses']));_0x28389e=_0x184383[_0x416b('0x14')][_0x416b('0x17')][0x0][_0x416b('0x18')];_0x2c24f5=_0x184383[_0x416b('0x14')][_0x416b('0x17')][0x0]['likelihood'];_0x56d870='0';_0x2cebc2=_0x416b('0x19');_0x4a9ec7['terminate']();}}break;case 0x1:logger[_0x416b('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x56d870='1';_0x2cebc2='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x416b('0x6')](_0x416b('0x1a'));_0x56d870='2';_0x2cebc2=_0x416b('0x1a');break;case 0x9:logger['info'](_0x416b('0x1b'));_0x56d870='9';_0x2cebc2=_0x416b('0x1b');break;case 0xa:logger[_0x416b('0x6')](_0x416b('0x1c'));_0x56d870='10';_0x2cebc2='Authentication\x20failed.';break;case 0xb:logger[_0x416b('0x6')](_0x416b('0x1d'));_0x56d870='11';_0x2cebc2=_0x416b('0x1d');}}}catch(_0x18137f){logger[_0x416b('0x11')](_0x416b('0x1e'),JSON[_0x416b('0xd')](_0x18137f));_0x4a9ec7[_0x416b('0x1f')]();}}function _0x501b51(){logger['info'](_0x416b('0x20'));_0x235af4({'transcript':_0x28389e,'confidence':_0x2c24f5,'status':_0x56d870,'status_message':_0x2cebc2});}function _0x43b53e(_0x348543){logger[_0x416b('0x11')](_0x416b('0x21'));if(!_[_0x416b('0x22')](_0x348543)){logger[_0x416b('0x11')](_[_0x416b('0x23')](_0x348543)?JSON[_0x416b('0xd')](_0x348543):_0x348543);}}_0x4a9ec7['on'](_0x416b('0x24'),_0x32ee3b);_0x4a9ec7['on'](_0x416b('0x25'),_0x45c277);_0x4a9ec7['on']('close',_0x501b51);_0x4a9ec7['on']('error',_0x43b53e);});}; \ No newline at end of file +var _0x91e2=['wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','info','unix','send','stringify','data','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','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.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0x91e2,0x169));var _0x291e=function(_0x3beac1,_0x1ba6cc){_0x3beac1=_0x3beac1-0x0;var _0x32cd74=_0x91e2[_0x3beac1];return _0x32cd74;};'use strict';var BPromise=require(_0x291e('0x0'));var _=require(_0x291e('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x291e('0x2'));var crypto=require(_0x291e('0x3'));var logger=require(_0x291e('0x4'))(_0x291e('0x5'));module[_0x291e('0x6')]=function(_0x26b7b4,_0x4b384f,_0x6c330c,_0x1022a4){return new BPromise(function(_0x27d04f,_0x295194){logger['info'](_0x291e('0x7'),_0x1022a4||_0x291e('0x8'));var _0x8edd0f=new WebSocket(_0x1022a4||_0x291e('0x8'),{'perMessageDeflate':![]});var _0x3c563d='';var _0x74ce4e='0';var _0x2d5f14='1';var _0x48c5b3=_0x291e('0x9');function _0x1f04ef(_0x267fae){var _0x16b404=crypto[_0x291e('0xa')](_0x291e('0xb'));_0x16b404[_0x291e('0xc')](_0x267fae);return _0x16b404['digest'](_0x291e('0xd'));}function _0x34b915(){try{logger[_0x291e('0xe')]('Open\x20Tilde\x20ASR\x20socket');var _0x14a2c1=moment()[_0x291e('0xf')]();var _0x2d2952=_0x1f04ef(_0x14a2c1+_0x4b384f+_0x6c330c);_0x8edd0f[_0x291e('0x10')](JSON[_0x291e('0x11')]({'appID':_0x4b384f,'timestamp':_0x14a2c1,'appKey':_0x2d2952}));var _0x2939f3=fs['createReadStream'](_0x26b7b4);_0x2939f3['on'](_0x291e('0x12'),function(_0x2c74cc){_0x8edd0f[_0x291e('0x10')](_0x2c74cc);});_0x2939f3['on']('close',function(){_0x8edd0f[_0x291e('0x10')]('EOS');});}catch(_0x5da1f9){logger[_0x291e('0x13')](_0x291e('0x14'),JSON[_0x291e('0x11')](_0x5da1f9));_0x8edd0f[_0x291e('0x15')]();}}function _0x481550(_0x2173cc){try{if(_0x2173cc){var _0x5c53d8=JSON[_0x291e('0x16')](_0x2173cc);switch(_0x5c53d8[_0x291e('0x17')]){case 0x0:if(_0x5c53d8[_0x291e('0x18')]){if(_0x5c53d8[_0x291e('0x18')][_0x291e('0x19')]){logger['info'](_0x291e('0x1a'),JSON[_0x291e('0x11')](_0x5c53d8[_0x291e('0x18')][_0x291e('0x1b')]));_0x3c563d=_0x5c53d8[_0x291e('0x18')][_0x291e('0x1b')][0x0][_0x291e('0x1c')];_0x74ce4e=_0x5c53d8[_0x291e('0x18')][_0x291e('0x1b')][0x0][_0x291e('0x1d')];_0x2d5f14='0';_0x48c5b3='Success.';_0x8edd0f[_0x291e('0x15')]();}}break;case 0x1:logger[_0x291e('0xe')](_0x291e('0x9'));_0x2d5f14='1';_0x48c5b3=_0x291e('0x9');break;case 0x2:logger[_0x291e('0xe')](_0x291e('0x1e'));_0x2d5f14='2';_0x48c5b3='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x2d5f14='9';_0x48c5b3=_0x291e('0x1f');break;case 0xa:logger[_0x291e('0xe')](_0x291e('0x20'));_0x2d5f14='10';_0x48c5b3=_0x291e('0x20');break;case 0xb:logger[_0x291e('0xe')](_0x291e('0x21'));_0x2d5f14='11';_0x48c5b3=_0x291e('0x21');}}}catch(_0x563ea5){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0x291e('0x11')](_0x563ea5));_0x8edd0f[_0x291e('0x15')]();}}function _0x397ba6(){logger[_0x291e('0xe')](_0x291e('0x22'));_0x27d04f({'transcript':_0x3c563d,'confidence':_0x74ce4e,'status':_0x2d5f14,'status_message':_0x48c5b3});}function _0x22514c(_0x43d0c0){logger[_0x291e('0x13')](_0x291e('0x23'));if(!_[_0x291e('0x24')](_0x43d0c0)){logger[_0x291e('0x13')](_[_0x291e('0x25')](_0x43d0c0)?JSON[_0x291e('0x11')](_0x43d0c0):_0x43d0c0);}}_0x8edd0f['on'](_0x291e('0x26'),_0x34b915);_0x8edd0f['on'](_0x291e('0x27'),_0x481550);_0x8edd0f['on'](_0x291e('0x28'),_0x397ba6);_0x8edd0f['on']('error',_0x22514c);});}; \ 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 3336fd5..10cb4be 100644 --- a/server/services/agi/scripts/tilde/index.js +++ b/server/services/agi/scripts/tilde/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2df1=['./asr'];(function(_0x5c8237,_0x2000d2){var _0x50ff61=function(_0x291a08){while(--_0x291a08){_0x5c8237['push'](_0x5c8237['shift']());}};_0x50ff61(++_0x2000d2);}(_0x2df1,0x85));var _0x12df=function(_0x20a6dd,_0x146025){_0x20a6dd=_0x20a6dd-0x0;var _0x164d02=_0x2df1[_0x20a6dd];return _0x164d02;};var asr=require(_0x12df('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 191495c..f5f4268 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 _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x5a2299,_0x3e2922){var _0xedff0f=function(_0x1624cb){while(--_0x1624cb){_0x5a2299['push'](_0x5a2299['shift']());}};_0xedff0f(++_0x3e2922);}(_0xe706,0xa3));var _0x6e70=function(_0x277d61,_0xab8c96){_0x277d61=_0x277d61-0x0;var _0x34f6e1=_0xe706[_0x277d61];return _0x34f6e1;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index b034da4..982df2a 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 _0xa7b5=['restAPI','method','timeout','includes','POST','PUT','toUpperCase','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','url','headers','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clear','agicommand','clone','isString','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','saveRestApiResult','%s.%s','replaceObjectAllVariables','split','replaceAll','getVariable','extra','result','info','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','noop','Executed\x20command\x20MRCPSynth\x20%s','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','add','delay','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','createSquareDetailsReport','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20password\x20configured','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','wav','%s/recordings/%s','beep','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','no\x20key\x20configured','NOBEEP','ispeech\x20%s\x20file\x20created','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','agentLogout','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','output','getPause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','agi','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','smtpOptions','SENDFAX\x20block\x20not\x20implemented','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','variable_value','Enter\x20in\x20START\x20(%s)\x20block','yes','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','exports','util','lodash','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','../../config/environment/shared','./scripts','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariableById','name','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','catch','getSquareOdbc','getSquareOdbcById','then','getUser','getUserById','getTrunk','getSoundPath','save_name','getMailAccountById','sendMailMessage','mailRpc','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','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','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','callback_','lastName','phone','scheduledAt','toString','getPauseById','agentPause','agent','isNil','agentUnpause','agentLogin','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','audioEncoding','MP3','google_tts_language'];(function(_0x6d5dac,_0x1235dc){var _0x5ca86d=function(_0x55b3dc){while(--_0x55b3dc){_0x6d5dac['push'](_0x6d5dac['shift']());}};_0x5ca86d(++_0x1235dc);}(_0xa7b5,0x162));var _0x5a7b=function(_0x499ad2,_0x30c092){_0x499ad2=_0x499ad2-0x0;var _0x58f6be=_0xa7b5[_0x499ad2];return _0x58f6be;};'use strict';var fs=require('fs');var util=require(_0x5a7b('0x0'));var _=require(_0x5a7b('0x1'));var sh=require(_0x5a7b('0x2'));var odbc=require(_0x5a7b('0x3'))();var rs=require(_0x5a7b('0x4'));var moment=require('moment');var Mustache=require(_0x5a7b('0x5'));var rp=require(_0x5a7b('0x6'));var logger=require(_0x5a7b('0x7'))('agi');var config=require('../../config/environment');var shared=require(_0x5a7b('0x8'));var scripts=require(_0x5a7b('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x5a7b('0xa'),_0x5a7b('0xb')];var verticesWithRetry=[_0x5a7b('0xc'),_0x5a7b('0xd'),_0x5a7b('0xe')];var AGIVertices=function(_0x5c281b,_0x21a69c,_0x59b6df){this[_0x5a7b('0xf')]=_0x5c281b;this[_0x5a7b('0x10')]=_0x21a69c;this['mailRpc']=_0x59b6df;};AGIVertices[_0x5a7b('0x11')]['getVariable']=function(_0x31d60c,_0x238f76){this[_0x5a7b('0x10')][_0x5a7b('0x12')](_0x31d60c)['then'](function(_0x4d3c4d){_0x238f76(null,_0x4d3c4d?_0x4d3c4d[_0x5a7b('0x13')]:![]);})['catch'](function(_0x5f263c){_0x238f76(_0x5f263c);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x14')]=function(_0x5088a5,_0xda652d){this[_0x5a7b('0x10')][_0x5a7b('0x15')](_0x5088a5)['then'](function(_0x5081){_0xda652d(null,_0x5081?_0x5081[_0x5a7b('0x13')]:![]);})['catch'](function(_0x31fb21){_0xda652d(_0x31fb21);});};AGIVertices['prototype'][_0x5a7b('0x16')]=function(_0x5039dc,_0x34804c){this[_0x5a7b('0x10')][_0x5a7b('0x17')](_0x5039dc)['then'](function(_0xe59f65){_0x34804c(null,_0xe59f65?_0xe59f65[_0x5a7b('0x13')]:![]);})[_0x5a7b('0x18')](function(_0x47ce0f){_0x34804c(_0x47ce0f);});};AGIVertices['prototype'][_0x5a7b('0x19')]=function(_0x5c711c,_0x23583a){this['rpc'][_0x5a7b('0x1a')](_0x5c711c)[_0x5a7b('0x1b')](function(_0x2ea965){_0x23583a(null,_0x2ea965?_0x2ea965['dsn']:![]);})[_0x5a7b('0x18')](function(_0x458511){_0x23583a(_0x458511);});};AGIVertices['prototype'][_0x5a7b('0x1c')]=function(_0x1ae7f1,_0x57ebf9){this[_0x5a7b('0x10')][_0x5a7b('0x1d')](_0x1ae7f1)['then'](function(_0x59fa7f){_0x57ebf9(null,_0x59fa7f?_0x59fa7f[_0x5a7b('0x13')]:![]);})[_0x5a7b('0x18')](function(_0x54d4f8){_0x57ebf9(_0x54d4f8);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x1e')]=function(_0x16b89,_0x300ae9){this['rpc']['getTrunkById'](_0x16b89)[_0x5a7b('0x1b')](function(_0x262cdc){_0x300ae9(null,_0x262cdc?_0x262cdc[_0x5a7b('0x13')]:![]);})[_0x5a7b('0x18')](function(_0x48ee7e){_0x300ae9(_0x48ee7e);});};AGIVertices[_0x5a7b('0x11')]['getSound']=function(_0x63d8eb,_0x3531cf){var _0x3d505f=this;this[_0x5a7b('0x10')]['getSoundById'](_0x63d8eb)[_0x5a7b('0x1b')](function(_0x1147c0){_0x3531cf(null,_0x1147c0?_0x3d505f[_0x5a7b('0x1f')](_0x1147c0[_0x5a7b('0x20')]):![]);})[_0x5a7b('0x18')](function(_0x5dd6b9){_0x3531cf(_0x5dd6b9);});};AGIVertices[_0x5a7b('0x11')]['getMailAccount']=function(_0x4bdf52,_0x517499){this['rpc'][_0x5a7b('0x21')](_0x4bdf52)[_0x5a7b('0x1b')](function(_0x564afa){_0x517499(null,_0x564afa?_0x564afa:![]);})['catch'](function(_0x3d7400){_0x517499(_0x3d7400);});};AGIVertices['prototype'][_0x5a7b('0x22')]=function(_0x2f78d7,_0x53ecc6,_0x44c988){this[_0x5a7b('0x23')][_0x5a7b('0x22')](_0x2f78d7,_0x53ecc6)[_0x5a7b('0x1b')](function(){_0x44c988(null);})[_0x5a7b('0x18')](function(_0x5e6a6f){_0x44c988(_0x5e6a6f);});};AGIVertices[_0x5a7b('0x11')]['getIntervals']=function(_0x77f4ba,_0x51d729){this[_0x5a7b('0x10')]['getIntervalById'](_0x77f4ba)[_0x5a7b('0x1b')](function(_0xb8cb94){if(_0xb8cb94){if(_0xb8cb94[_0x5a7b('0x24')]){_0x51d729(null,[_0xb8cb94[_0x5a7b('0x25')]]);}else{_0x51d729(null,_[_0x5a7b('0x26')](_0xb8cb94[_0x5a7b('0x27')],'interval'));}}else{_0x51d729(null,![]);}})[_0x5a7b('0x18')](function(_0x165420){_0x51d729(_0x165420);});};AGIVertices[_0x5a7b('0x11')]['getSoundPath']=function(_0xa12ce2){return util['format'](_0x5a7b('0x28'),FILES_PATH,_0xa12ce2);};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x29')]=function(_0x2f6ab7,_0x3e5055,_0x375cf7){odbc[_0x5a7b('0x2a')](_0x2f6ab7,function(_0x225dec){if(_0x225dec){logger[_0x5a7b('0x2b')](_0x5a7b('0x2c'),_0x225dec);_0x375cf7(_0x225dec);}else{logger['info'](_0x5a7b('0x2d'));odbc[_0x5a7b('0x2e')](_0x3e5055,function(_0x161bde,_0x38056f){if(_0x161bde){logger['info'](_0x5a7b('0x2f'),_0x3e5055);_0x375cf7(_0x161bde);}else{logger['info'](_0x5a7b('0x30'),_0x3e5055);odbc[_0x5a7b('0x31')](function(_0x56397c){if(_0x56397c){logger['error'](_0x5a7b('0x32'),_0x56397c);}_0x375cf7(null,_0x38056f);});}});}});};AGIVertices['prototype'][_0x5a7b('0x33')]=function(_0x1b1b8a,_0x3ecf62){this[_0x5a7b('0x10')][_0x5a7b('0x34')](_0x1b1b8a)['then'](function(_0x5b53e3){_0x3ecf62(null,_0x5b53e3?_0x5b53e3:![]);})[_0x5a7b('0x18')](function(_0x3ecff8){_0x3ecf62(_0x3ecff8);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x35')]=function(_0x2d9186,_0x4944a6){this[_0x5a7b('0x10')]['createSmsMessage'](_0x2d9186)['then'](function(_0x2fa44e){_0x4944a6(null,_0x2fa44e);})[_0x5a7b('0x18')](function(_0x30676e){_0x4944a6(_0x30676e);});};AGIVertices[_0x5a7b('0x11')]['createSquareDetailsReport']=function(_0x41e3a5,_0x127064,_0x2a8516){this[_0x5a7b('0x10')]['createSquareDetailsReport']({'uniqueid':this['channel'][_0x5a7b('0x36')],'node':_0x41e3a5[_0x5a7b('0x37')],'application':_0x41e3a5['agicommand'],'data':_0x127064||null,'project_name':this[_0x5a7b('0xf')][_0x5a7b('0x38')],'callerid':this['channel'][_0x5a7b('0x39')]})[_0x5a7b('0x1b')](function(_0x5a9953){if(_0x2a8516){_0x2a8516(null,_0x5a9953);}})[_0x5a7b('0x18')](function(_0x4d6754){if(_0x2a8516){_0x2a8516(_0x4d6754);}});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x3a')]=function(_0x11e81b,_0x504496,_0x503533,_0x5bcd19){this['rpc']['createSquareRecording']({'uniqueid':this['channel'][_0x5a7b('0x36')],'callerid':this[_0x5a7b('0xf')][_0x5a7b('0x39')],'calleridname':this[_0x5a7b('0xf')][_0x5a7b('0x3b')],'context':this['channel'][_0x5a7b('0x3c')],'extension':this[_0x5a7b('0xf')][_0x5a7b('0x3d')],'priority':this[_0x5a7b('0xf')][_0x5a7b('0x3e')],'accountcode':this[_0x5a7b('0xf')][_0x5a7b('0x3f')],'dnid':this['channel'][_0x5a7b('0x40')],'projectName':this[_0x5a7b('0xf')][_0x5a7b('0x38')],'saveName':_0x504496,'filename':_0x11e81b['file']||_0x504496,'savePath':_0x503533})[_0x5a7b('0x1b')](function(_0x324ab3){_0x5bcd19(null,_0x324ab3);})['catch'](function(_0x4a1edc){_0x5bcd19(_0x4a1edc);});};AGIVertices['prototype'][_0x5a7b('0x41')]=function(_0x41231d,_0x390ff0,_0x57d6c6,_0x4d6d40,_0x211dc4){this['rpc'][_0x5a7b('0x41')]({'uniqueid':this[_0x5a7b('0xf')][_0x5a7b('0x36')],'body':_0x41231d,'direction':_0x390ff0,'providerName':_0x57d6c6,'providerResponse':_0x4d6d40})[_0x5a7b('0x1b')](function(_0x7837fd){if(_0x211dc4){_0x211dc4(null,_0x7837fd);}})[_0x5a7b('0x18')](function(_0x3b4f24){if(_0x211dc4){_0x211dc4(_0x3b4f24);}});};AGIVertices[_0x5a7b('0x11')]['createCmContact']=function(_0x2d1d3c,_0x837524){this['rpc'][_0x5a7b('0x42')]({'firstName':_[_0x5a7b('0x43')](_0x2d1d3c[_0x5a7b('0x13')])||_['isNil'](_0x2d1d3c[_0x5a7b('0x13')])?_0x5a7b('0x44')+Math['random']():_0x2d1d3c[_0x5a7b('0x13')],'lastName':_[_0x5a7b('0x43')](_0x2d1d3c['lastName'])||_['isNil'](_0x2d1d3c[_0x5a7b('0x45')])?null:_0x2d1d3c[_0x5a7b('0x45')],'phone':_0x2d1d3c[_0x5a7b('0x46')],'ListId':_0x2d1d3c['list_id'],'scheduledat':_0x2d1d3c[_0x5a7b('0x47')],'callbackUniqueid':this['channel']['uniqueid'],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x2d1d3c[_0x5a7b('0x47')][_0x5a7b('0x48')](),'priority':_0x2d1d3c['callback_priority']})[_0x5a7b('0x1b')](function(_0x23fd0b){_0x837524(null,_0x23fd0b);})[_0x5a7b('0x18')](function(_0x5b1441){_0x837524(_0x5b1441);});};AGIVertices['prototype']['getPause']=function(_0x261d7c,_0x3aaae6){this['rpc'][_0x5a7b('0x49')](_0x261d7c)['then'](function(_0x16391f){_0x3aaae6(null,_0x16391f?_0x16391f[_0x5a7b('0x13')]:![]);})['catch'](function(_0x49bb22){_0x3aaae6(_0x49bb22);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x4a')]=function(_0x1fbe4e,_0x46aa17,_0x71bc6c){var _0x5ab3a7={'role':_0x5a7b('0x4b')};_0x5ab3a7[_0x1fbe4e]=this[_0x5a7b('0xf')][_0x5a7b('0x39')];this['rpc']['agentPause'](_0x5ab3a7,_0x46aa17,this[_0x5a7b('0xf')][_0x5a7b('0x36')])['then'](function(_0x59da48){_0x71bc6c(null,_[_0x5a7b('0x4c')](_0x59da48)?![]:!![]);})[_0x5a7b('0x18')](function(_0x271e6f){logger['error'](_0x271e6f);_0x71bc6c(null,![]);});};AGIVertices['prototype'][_0x5a7b('0x4d')]=function(_0x3c61fa,_0x546b9e){var _0x490da5={'role':'agent'};_0x490da5[_0x3c61fa]=this[_0x5a7b('0xf')]['callerid'];this['rpc'][_0x5a7b('0x4d')](_0x490da5)[_0x5a7b('0x1b')](function(_0x9aa727){_0x546b9e(null,_['isNil'](_0x9aa727)?![]:!![]);})[_0x5a7b('0x18')](function(_0x120a91){logger['error'](_0x120a91);_0x546b9e(null,![]);});};AGIVertices[_0x5a7b('0x11')]['agentLogout']=function(_0x3c4ab1,_0x5bdcb6){var _0x3f57d9={'role':_0x5a7b('0x4b')};_0x3f57d9[_0x3c4ab1]=this[_0x5a7b('0xf')][_0x5a7b('0x39')];this['rpc']['agentLogout'](_0x3f57d9)['then'](function(_0x3f1a1e){_0x5bdcb6(null,_[_0x5a7b('0x4c')](_0x3f1a1e)?![]:!![]);})[_0x5a7b('0x18')](function(_0x576df0){logger[_0x5a7b('0x2b')](_0x576df0);_0x5bdcb6(null,![]);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x4e')]=function(_0x5d34a8,_0x4191f4){var _0x1b2b0c={'role':'agent'};_0x1b2b0c[_0x5d34a8]=this[_0x5a7b('0xf')][_0x5a7b('0x39')];var _0xbd5467=_0x5d34a8!='internal'?util[_0x5a7b('0x4f')](_0x5a7b('0x50'),_0x5a7b('0x51'),this[_0x5a7b('0xf')][_0x5a7b('0x39')]):undefined;this[_0x5a7b('0x10')]['agentLogin'](_0x1b2b0c,_0xbd5467)[_0x5a7b('0x1b')](function(_0x7897d2){_0x4191f4(null,_[_0x5a7b('0x4c')](_0x7897d2)?![]:!![]);})['catch'](function(_0x487b5c){logger[_0x5a7b('0x2b')](_0x487b5c);_0x4191f4(null,![]);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x52')]=function(_0x17a656,_0x2ce9ea){sh[_0x5a7b('0x53')](_[_0x5a7b('0x54')](_0x17a656),function(_0x15537f,_0x24f8f4){var _0x225802=_0x24f8f4['replace'](/(\r\n|\n|\r)/gm,'');_0x2ce9ea(null,_0x225802);});};AGIVertices['prototype'][_0x5a7b('0x55')]=function(_0x4f2582,_0x1c1752){scripts[_0x5a7b('0x55')](_0x4f2582[_0x5a7b('0x56')],_0x4f2582[_0x5a7b('0x57')]||_0x5a7b('0x58'),_0x4f2582[_0x5a7b('0x58')],_0x4f2582['languageCode']||_0x5a7b('0x59'),_0x4f2582[_0x5a7b('0x5a')]||'MALE',_0x4f2582[_0x5a7b('0x5b')]||_0x5a7b('0x5c'))[_0x5a7b('0x1b')](function(_0x524d4b){_0x1c1752(null,_0x524d4b);})['catch'](function(_0x5ed990){_0x1c1752(_0x5ed990);});};AGIVertices[_0x5a7b('0x11')]['googleTTS']=function(_0x408105,_0x329923){scripts['googleTTS'](_0x408105['text'],_0x408105[_0x5a7b('0x5d')]||'en',0x1)[_0x5a7b('0x1b')](function(_0x36cd15){_0x329923(null,_0x36cd15);})[_0x5a7b('0x18')](function(_0x1c435d){_0x329923(_0x1c435d);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x5e')]=function(_0x456222,_0x439f40){var _0x18c2ff={'uri':_0x456222['url'],'method':_0x456222[_0x5a7b('0x5f')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x456222[_0x5a7b('0x60')])==='number'&&parseInt(_0x456222[_0x5a7b('0x60')])>=0x1?parseInt(_0x456222[_0x5a7b('0x60')])*0x3e8:0x5*0x3e8};if(_[_0x5a7b('0x61')]([_0x5a7b('0x62'),_0x5a7b('0x63')],_0x18c2ff[_0x5a7b('0x5f')][_0x5a7b('0x64')]())){try{_0x18c2ff['body']=_0x456222[_0x5a7b('0xb')]?JSON[_0x5a7b('0x65')](_0x456222['rawBody']):{};}catch(_0x5c74f7){logger['error'](_0x5a7b('0x66'),_0x5c74f7);}}try{_0x18c2ff['headers']=_0x456222[_0x5a7b('0xa')]?JSON[_0x5a7b('0x65')](_0x456222['rawHeaders']):{};}catch(_0x20e86a){logger['error'](_0x5a7b('0x67'),_0x20e86a);}if(_0x456222[_0x5a7b('0x68')]){try{var _0x16cfaf=require(_0x456222[_0x5a7b('0x68')])[_0x5a7b('0x69')](this,_0x18c2ff);_0x18c2ff['uri']=Mustache['render'](_0x456222[_0x5a7b('0x6a')],_0x16cfaf,{},['$$','$$']);if(_0x18c2ff[_0x5a7b('0x6b')]){_0x18c2ff[_0x5a7b('0x6b')]=JSON[_0x5a7b('0x65')](Mustache[_0x5a7b('0x6c')](JSON[_0x5a7b('0x6d')](_0x18c2ff[_0x5a7b('0x6b')]),_0x16cfaf,{},['$$','$$']));}if(_0x18c2ff['body']){_0x18c2ff[_0x5a7b('0x6e')]=JSON[_0x5a7b('0x65')](Mustache[_0x5a7b('0x6c')](JSON[_0x5a7b('0x6d')](_0x18c2ff[_0x5a7b('0x6e')]),_0x16cfaf,{},['$$','$$']));}}catch(_0x4e6998){logger[_0x5a7b('0x2b')](_0x5a7b('0x6f'),_0x4e6998);}}rp(_0x18c2ff)[_0x5a7b('0x1b')](function(_0x13e640){var _0x41c54e={'statusCode':_0x13e640[_0x5a7b('0x70')]||0xc8,'statusMessage':_0x13e640['statusMessage']||'OK','headers':_0x13e640[_0x5a7b('0x6b')]||{},'body':_0x13e640[_0x5a7b('0x6e')]||{}};_0x439f40(null,_0x41c54e);})['catch'](function(_0x5ea2be){var _0x5435fa={'statusCode':_0x5ea2be[_0x5a7b('0x70')]||0x1f4,'statusMessage':_0x5ea2be[_0x5a7b('0x71')]||_0x5a7b('0x72'),'headers':_0x5ea2be['options'][_0x5a7b('0x6b')]||{},'body':_0x5ea2be[_0x5a7b('0x73')]['body']||{}};_0x439f40(null,_0x5435fa);});};AGIVertices[_0x5a7b('0x11')]['googleDialogflow']=function(_0xaf82e2,_0x47c8ed){scripts[_0x5a7b('0x74')](this[_0x5a7b('0xf')][_0x5a7b('0x36')],_0xaf82e2[_0x5a7b('0x75')],_0xaf82e2['text'],_0xaf82e2[_0x5a7b('0x76')]||'en')['then'](function(_0x5395f9){_0x47c8ed(null,_0x5395f9);})[_0x5a7b('0x18')](function(_0x23fb30){_0x47c8ed(_0x23fb30);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x77')]=function(_0x2b3dba,_0x3fe1fe){scripts[_0x5a7b('0x77')](this[_0x5a7b('0xf')][_0x5a7b('0x36')],_0x2b3dba['dialogflowV2_project_id'],_0x2b3dba[_0x5a7b('0x78')],_0x2b3dba['private_key'],_0x2b3dba['text'],_0x2b3dba[_0x5a7b('0x79')]||'en')[_0x5a7b('0x1b')](function(_0x15fb80){_0x3fe1fe(null,_0x15fb80);})[_0x5a7b('0x18')](function(_0x41b8ba){_0x3fe1fe(_0x41b8ba);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x7a')]=function(_0x27b87f,_0x2a46fc){scripts[_0x5a7b('0x7a')](this[_0x5a7b('0xf')],_0x27b87f)['then'](function(_0x112ce0){_0x2a46fc(null,_0x112ce0);})[_0x5a7b('0x18')](function(_0x53b02a){_0x2a46fc(_0x53b02a);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x7b')]=function(_0xb1da68,_0x3c0a46){scripts['ispeechTTS'](_0xb1da68[_0x5a7b('0x75')],_0xb1da68[_0x5a7b('0x58')],_0xb1da68[_0x5a7b('0x7c')]||'en-US',_0xb1da68[_0x5a7b('0x7d')])[_0x5a7b('0x1b')](function(_0xeee31){_0x3c0a46(null,_0xeee31);})[_0x5a7b('0x18')](function(_0x41d3f6){_0x3c0a46(_0x41d3f6);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x7e')]=function(_0x4d18ef,_0x5037c2,_0x146764){scripts[_0x5a7b('0x7e')](_0x5037c2,_0x4d18ef['key'],_0x4d18ef['ispeech_asr_language']||_0x5a7b('0x59'),this['isConfigured'](_0x4d18ef[_0x5a7b('0x7f')])?_0x4d18ef[_0x5a7b('0x7f')]:undefined)[_0x5a7b('0x1b')](function(_0x5ebeea){_0x146764(null,_0x5ebeea);})[_0x5a7b('0x18')](function(_0x197d96){_0x146764(_0x197d96);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x80')]=function(_0x3894a2,_0xafa71c){scripts['awsPolly'](_0x3894a2['aws_access_key_id'],_0x3894a2[_0x5a7b('0x81')],_0x3894a2[_0x5a7b('0x82')],_0x3894a2[_0x5a7b('0x83')]||_0x5a7b('0x84'),_0x3894a2[_0x5a7b('0x58')],_0x3894a2[_0x5a7b('0x85')]||'text')['then'](function(_0x3627a3){_0xafa71c(null,_0x3627a3);})[_0x5a7b('0x18')](function(_0x52c404){_0xafa71c(_0x52c404);});};AGIVertices['prototype'][_0x5a7b('0x86')]=function(_0x1910ed,_0x24aa7c){scripts['awsLex'](this[_0x5a7b('0xf')]['uniqueid'],_0x1910ed[_0x5a7b('0x87')],_0x1910ed[_0x5a7b('0x81')],_0x1910ed['aws_lex_region'],_0x1910ed['text'],_0x1910ed[_0x5a7b('0x88')])[_0x5a7b('0x1b')](function(_0x9c3f78){_0x24aa7c(null,_0x9c3f78);})[_0x5a7b('0x18')](function(_0x20dadd){_0x24aa7c(_0x20dadd);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x89')]=function(_0x3febfd,_0xb58bd9,_0x2ae4ff){scripts[_0x5a7b('0x89')](_0xb58bd9,_0x3febfd[_0x5a7b('0x75')],_0x3febfd[_0x5a7b('0x8a')]||'en-US')[_0x5a7b('0x1b')](function(_0x341b6d){_0x2ae4ff(null,_0x341b6d);})[_0x5a7b('0x18')](function(_0x1a181a){_0x2ae4ff(_0x1a181a);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x8b')]=function(_0x397625,_0xb14a0a,_0x58bf1b){scripts['tildeASR'](_0xb14a0a,_0x397625[_0x5a7b('0x8c')],_0x397625[_0x5a7b('0x8d')],_0x397625[_0x5a7b('0x8e')])['then'](function(_0x68aca6){_0x58bf1b(null,_0x68aca6);})[_0x5a7b('0x18')](function(_0x473d63){_0x58bf1b(_0x473d63);});};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x8f')]=function(_0x3f303d){var _0x5d8c36=_[_0x5a7b('0x61')](verticesWithRetry,_0x3f303d[_0x5a7b('0x90')])?_0x3f303d:_[_0x5a7b('0x91')](_0x3f303d);for(var _0x466f21 in _0x5d8c36){if(_0x5d8c36['hasOwnProperty'](_0x466f21)){if(_0x5d8c36[_0x466f21]&&_[_0x5a7b('0x92')](_0x5d8c36[_0x466f21])){if(_[_0x5a7b('0x61')](recursiveMapAttributes,_0x466f21)){_0x5d8c36[_0x466f21]=this['replaceObjectAllVariables'](_0x5d8c36[_0x466f21]);}else{_0x5d8c36[_0x466f21]=this[_0x5a7b('0x93')](_0x5d8c36[_0x466f21]);}}}}return _0x5d8c36;};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x94')]=function(_0x426cc2){for(var _0x964caf in _0x426cc2){if(_0x426cc2[_0x5a7b('0x95')](_0x964caf)){if(_[_0x5a7b('0x96')](_0x426cc2[_0x964caf])){this[_0x5a7b('0x94')](_0x426cc2[_0x964caf]);}else if(_[_0x5a7b('0x97')](_0x426cc2[_0x964caf])){for(var _0x571ee2=0x0;_0x571ee2<_0x426cc2[_0x964caf][_0x5a7b('0x98')];_0x571ee2++){this[_0x5a7b('0x94')](_0x426cc2[_0x964caf][_0x571ee2]);}}else if(_[_0x5a7b('0x92')](_0x426cc2[_0x964caf])){_0x426cc2[_0x964caf]=this[_0x5a7b('0x93')](_0x426cc2[_0x964caf]);}}}};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x99')]=function(_0x442fe5,_0x5157af){for(var _0x4b6634 in _0x442fe5){if(_0x442fe5[_0x5a7b('0x95')](_0x4b6634)){if(_[_0x5a7b('0x96')](_0x442fe5[_0x4b6634])){if(!_[_0x5a7b('0x43')](_0x442fe5[_0x4b6634])){this[_0x5a7b('0x99')](_0x442fe5[_0x4b6634],util['format'](_0x5a7b('0x9a'),_0x5157af,_0x4b6634));}}else if(_[_0x5a7b('0x97')](_0x442fe5[_0x4b6634])){for(var _0x2ad7f2=0x0;_0x2ad7f2<_0x442fe5[_0x4b6634]['length'];_0x2ad7f2++){this[_0x5a7b('0x99')](_0x442fe5[_0x4b6634][_0x2ad7f2],util[_0x5a7b('0x4f')](_0x5a7b('0x9a'),_0x5157af,_0x4b6634+'['+_0x2ad7f2+']'));}}else{if(!_['isNil'](_0x442fe5[_0x4b6634])){this[_0x5a7b('0xf')]['setVariable'](util[_0x5a7b('0x4f')](_0x5a7b('0x9a'),_0x5157af,_0x4b6634),_0x442fe5[_0x4b6634]);}}}}};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x9b')]=function(_0x3747b3){try{var _0x5a8ede=JSON[_0x5a7b('0x65')](_0x3747b3);this[_0x5a7b('0x94')](_0x5a8ede);return JSON['stringify'](_0x5a8ede);}catch(_0x368652){return this[_0x5a7b('0x93')](_0x3747b3);}};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x93')]=function(_0x1bf803){var _0x3cecaa=_0x1bf803[_0x5a7b('0x9c')]('{');for(var _0x124239=0x1;_0x124239<_0x3cecaa[_0x5a7b('0x98')];_0x124239+=0x1){var _0x2b1475=_0x3cecaa[_0x124239][_0x5a7b('0x9c')]('}');if(_0x2b1475['length']>0x1){_0x1bf803=_0x1bf803[_0x5a7b('0x9d')]('{'+_0x2b1475[0x0]+'}',this[_0x5a7b('0xf')][_0x5a7b('0x9e')](_0x2b1475[0x0])[_0x5a7b('0x9f')]||_0x2b1475[0x0]);}}if(_0x3cecaa[_0x5a7b('0x98')]===0x1){return _0x1bf803[_0x5a7b('0x48')]();}return this[_0x5a7b('0x93')](_0x1bf803);};AGIVertices['prototype']['getAndSetVariable']=function(_0x3bc9ed,_0x50d145){var _0x331d9f=this[_0x5a7b('0xf')][_0x5a7b('0x9e')](_0x3bc9ed);if(_0x331d9f[_0x5a7b('0xa0')]===-0x1){return _0x331d9f;}logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0xa2'),_0x50d145,_0x331d9f[_0x5a7b('0x9f')]));return this[_0x5a7b('0xf')][_0x5a7b('0xa3')](_0x50d145,_0x331d9f['extra']);};AGIVertices[_0x5a7b('0x11')]['isConfigured']=function(_0x45cdd5){return _0x45cdd5&&_0x45cdd5!=='0'&&_0x45cdd5!=='-1'&&_0x45cdd5!=='';};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xa4')]=function(_0x9f88da){this['createSquareDetailsReport'][_0x5a7b('0x69')](this,_0x9f88da,'-');_0x9f88da[_0x5a7b('0xa5')]=_0x9f88da[_0x5a7b('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xa6')]=function(_0x8e4285){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0xa7'),_0x8e4285[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x8e4285['text'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')]('no\x20text\x20configured');}var _0xa299c1='\x22'+_0x8e4285[_0x5a7b('0x58')]+'\x22';if(this[_0x5a7b('0xa8')](_0x8e4285[_0x5a7b('0x73')])){_0xa299c1+=','+_0x8e4285[_0x5a7b('0x73')];}var _0x12a368=this[_0x5a7b('0xf')][_0x5a7b('0x53')]('MRCPSynth',_0xa299c1);if(_0x12a368[_0x5a7b('0xa0')]===-0x1){return _0x12a368;}return this['channel'][_0x5a7b('0xa9')](util['format'](_0x5a7b('0xaa'),_0xa299c1));};AGIVertices[_0x5a7b('0x11')]['mrcprecog']=function(_0x4671d3){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x4671d3[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x4671d3[_0x5a7b('0xab')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xac'));}var _0x4c3230=_0x4671d3[_0x5a7b('0xab')];if(this[_0x5a7b('0xa8')](_0x4671d3[_0x5a7b('0x73')])){_0x4c3230+=','+_0x4671d3[_0x5a7b('0x73')];}var _0x1b9256=this[_0x5a7b('0xf')][_0x5a7b('0x53')](_0x5a7b('0xad'),_0x4c3230);if(_0x1b9256[_0x5a7b('0xa0')]===-0x1){return _0x1b9256;}var _0x5314de=this[_0x5a7b('0xae')](_0x5a7b('0xaf'),_0x5a7b('0xb0'));if(_0x5314de['result']===-0x1){return _0x5314de;}var _0x355edf=this[_0x5a7b('0xae')](_0x5a7b('0xb1'),_0x5a7b('0xb2'));if(_0x355edf[_0x5a7b('0xa0')]===-0x1){return _0x355edf;}var _0x6946e0=this['getAndSetVariable'](_0x5a7b('0xb3'),_0x5a7b('0xb4'));if(_0x6946e0[_0x5a7b('0xa0')]===-0x1){return _0x6946e0;}return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util['format'](_0x5a7b('0xb5'),_0x4c3230));};AGIVertices[_0x5a7b('0x11')]['agi']=function(_0x4d6981){logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0xb6'),_0x4d6981[_0x5a7b('0x37')]));return this[_0x5a7b('0xf')]['agi']([_0x4d6981[_0x5a7b('0xb7')],_0x4d6981['args']]);};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xb8')]=function(_0x156c96){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0xb9'),_0x156c96[_0x5a7b('0x37')]));if(this[_0x5a7b('0xa8')](_0x156c96[_0x5a7b('0x60')])){logger['info'](util[_0x5a7b('0x4f')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x156c96[_0x5a7b('0x60')]));var _0x49a5ab=this[_0x5a7b('0xf')][_0x5a7b('0xba')](_0x156c96['timeout']);if(_0x49a5ab['result']===-0x1){return _0x49a5ab;}}return this[_0x5a7b('0xf')]['answer']();};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xbb')]=function(_0x1f4a0d){logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0xbc'),_0x1f4a0d[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x1f4a0d[_0x5a7b('0xbd')])){return this[_0x5a7b('0xf')]['error'](_0x1f4a0d,_0x5a7b('0xbe'));}_0x1f4a0d[_0x5a7b('0x47')]=moment();if(this[_0x5a7b('0xa8')](_0x1f4a0d['delay'])){_0x1f4a0d[_0x5a7b('0x47')]=moment()[_0x5a7b('0xbf')](_0x1f4a0d[_0x5a7b('0xc0')],'minutes');}if(!this['isConfigured'](_0x1f4a0d['callback_priority'])){_0x1f4a0d['callback_priority']=0x2;}this['createCmContact'][_0x5a7b('0x69')](this,_0x1f4a0d);return this['channel']['noop'](util[_0x5a7b('0x4f')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x1f4a0d[_0x5a7b('0x46')],_0x1f4a0d['list_id'],_0x1f4a0d[_0x5a7b('0x47')]));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xc1')]=function(_0x386d5d){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0xc2'),_0x386d5d[_0x5a7b('0x37')]));var _0x29e0ea=this[_0x5a7b('0xf')]['exec'](_0x386d5d[_0x5a7b('0xc3')],_0x386d5d['options']);if(_0x29e0ea['result']===-0x1){return _0x29e0ea;}return this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0xc4'),_0x386d5d[_0x5a7b('0xc3')],_0x386d5d[_0x5a7b('0x73')]));};AGIVertices['prototype'][_0x5a7b('0xc5')]=function(_0x475928){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x475928['label']));if(!this[_0x5a7b('0xa8')](_0x475928[_0x5a7b('0x58')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')]('no\x20text\x20configured');}var _0x2f41d9='\x22'+_0x475928[_0x5a7b('0x58')]+'\x22';if(this['isConfigured'](_0x475928[_0x5a7b('0x73')])){_0x2f41d9+=','+_0x475928[_0x5a7b('0x73')];}var _0x3e2dfe=this[_0x5a7b('0xf')]['exec'](_0x5a7b('0xc6'),_0x2f41d9);if(_0x3e2dfe[_0x5a7b('0xa0')]===-0x1){return _0x3e2dfe;}return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0xaa'),_0x2f41d9));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xc7')]=function(_0x42ef21){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0xc8'),_0x42ef21[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x42ef21['text'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xc9'));}var _0x12b542='\x22'+_0x42ef21[_0x5a7b('0x58')]+'\x22';if(this[_0x5a7b('0xa8')](_0x42ef21[_0x5a7b('0x73')])){_0x12b542+=','+_0x42ef21['options'];}var _0x1198bb=this[_0x5a7b('0xf')]['exec']('MRCPSynth',_0x12b542);if(_0x1198bb[_0x5a7b('0xa0')]===-0x1){return _0x1198bb;}return this['channel']['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0xaa'),_0x12b542));};AGIVertices[_0x5a7b('0x11')]['lumenvoxasr']=function(_0x48f544){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x48f544[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x48f544[_0x5a7b('0xab')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xac'));}var _0x13b595=_0x48f544[_0x5a7b('0xab')];if(this['isConfigured'](_0x48f544[_0x5a7b('0x73')])){_0x13b595+=','+_0x48f544[_0x5a7b('0x73')];}var _0xbbc417=this[_0x5a7b('0xf')][_0x5a7b('0x53')](_0x5a7b('0xad'),_0x13b595);if(_0xbbc417[_0x5a7b('0xa0')]===-0x1){return _0xbbc417;}var _0x30d8e5=this[_0x5a7b('0xae')](_0x5a7b('0xaf'),_0x5a7b('0xca'));if(_0x30d8e5[_0x5a7b('0xa0')]===-0x1){return _0x30d8e5;}var _0x1bbaf2=this[_0x5a7b('0xae')](_0x5a7b('0xb1'),_0x5a7b('0xcb'));if(_0x1bbaf2[_0x5a7b('0xa0')]===-0x1){return _0x1bbaf2;}var _0x5a23d9=this[_0x5a7b('0xae')](_0x5a7b('0xb3'),_0x5a7b('0xcc'));if(_0x5a23d9[_0x5a7b('0xa0')]===-0x1){return _0x5a23d9;}return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0xb5'),_0x13b595));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xcd')]=function(_0x1713ce){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x1713ce[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x1713ce[_0x5a7b('0xab')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xac'));}var _0x3c8e9c=_0x1713ce[_0x5a7b('0xab')];if(this[_0x5a7b('0xa8')](_0x1713ce[_0x5a7b('0x73')])){_0x3c8e9c+=','+_0x1713ce[_0x5a7b('0x73')];}var _0x413ba5=this[_0x5a7b('0xf')][_0x5a7b('0x53')](_0x5a7b('0xad'),_0x3c8e9c);if(_0x413ba5[_0x5a7b('0xa0')]===-0x1){return _0x413ba5;}var _0x5efea5=this[_0x5a7b('0xae')](_0x5a7b('0xaf'),_0x5a7b('0xce'));if(_0x5efea5['result']===-0x1){return _0x5efea5;}var _0x4aad38=this['getAndSetVariable']('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x4aad38[_0x5a7b('0xa0')]===-0x1){return _0x4aad38;}var _0x363f4c=this[_0x5a7b('0xae')]('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x363f4c['result']===-0x1){return _0x363f4c;}return this['channel']['noop'](util[_0x5a7b('0x4f')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3c8e9c));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xcf')]=function(_0x412cf0){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0xd0'),_0x412cf0[_0x5a7b('0x37')]));if(!this['isConfigured'](_0x412cf0[_0x5a7b('0xd1')])){return this[_0x5a7b('0xf')]['error'](_0x412cf0,_0x5a7b('0xd2'));}var _0x273b6d=this[_0x5a7b('0x19')][_0x5a7b('0x69')](this,_0x412cf0[_0x5a7b('0xd1')]);if(!_0x273b6d){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x412cf0,_0x5a7b('0xd3'));}if(!this[_0x5a7b('0xa8')](_0x412cf0[_0x5a7b('0x2e')])){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x412cf0,'no\x20query\x20configured');}var _0x5370e5=_0x412cf0[_0x5a7b('0x2e')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')]('query:\x20%s',_0x5370e5));var _0x232c27=this[_0x5a7b('0x29')]['sync'](this,_0x273b6d,_0x5370e5);this[_0x5a7b('0xd4')]['sync'](this,_0x412cf0,_0x5370e5);if(!this['isConfigured'](_0x412cf0['variable_id'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xd5'));}var _0x5c0766=this[_0x5a7b('0x9e')][_0x5a7b('0x69')](this,_0x412cf0[_0x5a7b('0xd6')]);if(!_0x5c0766){return this[_0x5a7b('0xf')]['error'](_0x412cf0,_0x5a7b('0xd7'));}var _0x134fe6=this;_0x232c27[_0x5a7b('0xd8')](function(_0x5bc650,_0x3d959e){Object[_0x5a7b('0xd9')](_0x5bc650)[_0x5a7b('0xd8')](function(_0x394363){_0x134fe6[_0x5a7b('0xf')][_0x5a7b('0xa3')](util[_0x5a7b('0x4f')](_0x5a7b('0xda'),_0x5c0766,_0x3d959e,_0x394363),_0x5bc650[_0x394363]);});});this[_0x5a7b('0xf')][_0x5a7b('0xa3')](util[_0x5a7b('0x4f')](_0x5a7b('0xdb'),_0x5c0766),_0x232c27[_0x5a7b('0x98')]);return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util['format']('variable\x20%s\x20set',_0x5c0766));};AGIVertices[_0x5a7b('0x11')]['dial']=function(_0x2765c2){logger[_0x5a7b('0xdc')](util[_0x5a7b('0x4f')](_0x5a7b('0xdd'),_0x2765c2['label']));if(!this[_0x5a7b('0xa8')](_0x2765c2[_0x5a7b('0xde')])){return this[_0x5a7b('0xf')]['error'](_0x2765c2,'no\x20user\x20selected');}var _0x433a4d=this['getUser'][_0x5a7b('0x69')](this,_0x2765c2['sip_id']);if(!_0x433a4d){return this['channel'][_0x5a7b('0x2b')](_0x2765c2,'no\x20user\x20found');}var _0x53c5ab=this[_0x5a7b('0xf')][_0x5a7b('0x53')](_0x5a7b('0xdf'),[util['format'](_0x5a7b('0xe0'),_0x433a4d),_0x2765c2['timeout'],_0x2765c2[_0x5a7b('0xe1')],_0x2765c2[_0x5a7b('0x6a')]]);if(_0x53c5ab[_0x5a7b('0xa0')]===-0x1){return _0x53c5ab;}return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xe2')]=function(_0xc411f1){logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0xe3'),_0xc411f1[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0xc411f1[_0x5a7b('0x75')])){return this[_0x5a7b('0xf')]['noop']('no\x20key\x20configured');}if(!this[_0x5a7b('0xa8')](_0xc411f1[_0x5a7b('0x58')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')]('no\x20text\x20configured');}this[_0x5a7b('0xf')][_0x5a7b('0xe4')]=!![];this['createSquareDetailsReport'](_0xc411f1);this[_0x5a7b('0x41')](_0xc411f1[_0x5a7b('0x58')],'in','','');this['channel']['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0xe5'),_0xc411f1[_0x5a7b('0x58')]));var _0x8939bd=this[_0x5a7b('0x74')]['sync'](this,_0xc411f1);if(_0x8939bd){for(var _0x135666 in _0x8939bd){if(_0x8939bd['hasOwnProperty'](_0x135666)){this[_0x5a7b('0xf')][_0x5a7b('0xa3')](util[_0x5a7b('0x4f')]('DIALOGFLOW_%s',_0x135666['toUpperCase']()),_0x8939bd[_0x135666]);}}this[_0x5a7b('0x41')](_0x8939bd[_0x5a7b('0xe6')],_0x5a7b('0xe7'),'dialogflow','');return this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0xe8'),_0x8939bd[_0x5a7b('0xe6')]));}return this[_0x5a7b('0xf')]['error'](_0xc411f1,_0x5a7b('0xe9'));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xea')]=function(_0x2af8d2){logger['info'](util['format'](_0x5a7b('0xeb'),_0x2af8d2['label']));if(!this[_0x5a7b('0xa8')](_0x2af8d2[_0x5a7b('0xec')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xed'));}if(!this['isConfigured'](_0x2af8d2[_0x5a7b('0x78')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xee'));}if(!this[_0x5a7b('0xa8')](_0x2af8d2[_0x5a7b('0xef')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')]('no\x20private_key\x20configured');}if(!this[_0x5a7b('0xa8')](_0x2af8d2[_0x5a7b('0x79')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xf0'));}if(!this[_0x5a7b('0xa8')](_0x2af8d2[_0x5a7b('0x58')])){return this[_0x5a7b('0xf')]['noop']('no\x20text\x20configured');}this[_0x5a7b('0xf')][_0x5a7b('0xe4')]=!![];this[_0x5a7b('0xd4')](_0x2af8d2);this[_0x5a7b('0x41')](_0x2af8d2[_0x5a7b('0x58')],'in','','');this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0xf1'),_0x2af8d2[_0x5a7b('0x58')]));var _0x52b90c=this['googleDialogflowV2'][_0x5a7b('0x69')](this,_0x2af8d2);if(_0x52b90c){for(var _0x565d51 in _0x52b90c){if(_0x52b90c[_0x5a7b('0x95')](_0x565d51)){if(_0x565d51!=='providerResponse'){this[_0x5a7b('0xf')][_0x5a7b('0xa3')](util[_0x5a7b('0x4f')](_0x5a7b('0xf2'),_0x565d51['toUpperCase']()),_0x52b90c[_0x565d51]);}}}this[_0x5a7b('0x41')](_0x52b90c[_0x5a7b('0xe6')],_0x5a7b('0xe7'),_0x5a7b('0xea'),_0x52b90c[_0x5a7b('0xf3')]);return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0xf4'),_0x52b90c[_0x5a7b('0xe6')]));}return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x2af8d2,_0x5a7b('0xf5'));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xf6')]=function(_0xa94cf2){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0xf7'),_0xa94cf2['label']));if(!this[_0x5a7b('0xa8')](_0xa94cf2[_0x5a7b('0xf8')])){return this[_0x5a7b('0xf')]['noop'](_0x5a7b('0xf9'));}if(!this['isConfigured'](_0xa94cf2['username'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')]('no\x20username\x20configured');}if(!this[_0x5a7b('0xa8')](_0xa94cf2['password'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xfa'));}if(!this[_0x5a7b('0xa8')](_0xa94cf2['ndassistant_url'])){return this[_0x5a7b('0xf')]['noop'](_0x5a7b('0xc9'));}this[_0x5a7b('0xf')][_0x5a7b('0xe4')]=!![];this[_0x5a7b('0xd4')](_0xa94cf2);this['createSquareMessage'](_0xa94cf2[_0x5a7b('0x58')],'in','','');this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')]('Trying\x20SestekNDA:\x20%s',_0xa94cf2[_0x5a7b('0x58')]));var _0x3874a5=this[_0x5a7b('0x7a')][_0x5a7b('0x69')](this,_0xa94cf2);if(_0x3874a5){for(var _0x1a9dff in _0x3874a5){if(_0x3874a5[_0x5a7b('0x95')](_0x1a9dff)){this[_0x5a7b('0xf')][_0x5a7b('0xa3')](util['format'](_0x5a7b('0xfb'),_0x1a9dff[_0x5a7b('0x64')]()),_0x3874a5[_0x1a9dff]);}}this[_0x5a7b('0x41')](_0x3874a5['speech'],'out',_0x5a7b('0xf6'),'');if(_0x3874a5[_0x5a7b('0xfc')]){this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x3874a5[_0x5a7b('0xfc')]));var _0x4912f8=this[_0x5a7b('0xf')][_0x5a7b('0xfd')](_0x3874a5[_0x5a7b('0xfc')]);try{fs[_0x5a7b('0xfe')](_0x3874a5[_0x5a7b('0xfc')]+_0x5a7b('0xff'));}catch(_0x2f2c83){logger[_0x5a7b('0x2b')](_0x2f2c83);}return _0x4912f8;}else{return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x100'),_0x3874a5[_0x5a7b('0xe6')]));}}return this[_0x5a7b('0xf')]['error'](_0xa94cf2,_0x5a7b('0x101'));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x102')]=function(_0x306b4e){logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x103'),_0x306b4e[_0x5a7b('0x37')]));return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0x102'));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x104')]=function(_0x3021d9){logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x105'),_0x3021d9[_0x5a7b('0x37')]));var _0x39baa5='';if(_0x3021d9[_0x5a7b('0x106')]){if(!this[_0x5a7b('0xa8')](_0x3021d9[_0x5a7b('0x106')])){return this[_0x5a7b('0xf')]['error'](_0x3021d9,_0x5a7b('0x107'));}else{var _0x2cb118=parseInt(_0x3021d9[_0x5a7b('0x106')],0xa);if(isNaN(_0x2cb118)){_0x39baa5=_0x3021d9['trunk_id'];}else{_0x39baa5=this[_0x5a7b('0x1e')][_0x5a7b('0x69')](this,_0x3021d9[_0x5a7b('0x106')]);if(!_0x39baa5){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x3021d9,_0x5a7b('0x108'));}}}}else if(_0x3021d9['trunk_name']){_0x39baa5=_0x3021d9[_0x5a7b('0x109')];}else{return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x3021d9,_0x5a7b('0x107'));}var _0x2d5af2=this[_0x5a7b('0xf')][_0x5a7b('0x53')]('DIAL',[util[_0x5a7b('0x4f')](_0x5a7b('0x10a'),_0x39baa5,_0x3021d9[_0x5a7b('0x46')]),_0x3021d9[_0x5a7b('0x60')],_0x3021d9[_0x5a7b('0xe1')],_0x3021d9[_0x5a7b('0x6a')]]);if(_0x2d5af2[_0x5a7b('0xa0')]===-0x1){return _0x2d5af2;}return this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x10b'),_0x5a7b('0xdf')));};AGIVertices[_0x5a7b('0x11')]['finally']=function(_0x12d309){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x12d309[_0x5a7b('0x37')]));return this[_0x5a7b('0xf')]['noop'](_0x5a7b('0x10c'));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xd')]=function(_0x2c1125){logger['info'](util[_0x5a7b('0x4f')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x2c1125[_0x5a7b('0x37')]));if(_0x2c1125[_0x5a7b('0xa5')]===0x0){return this[_0x5a7b('0xa4')](_0x2c1125);}_0x2c1125[_0x5a7b('0xa5')]-=0x1;if(!this['isConfigured'](_0x2c1125[_0x5a7b('0x10d')])){return this['channel'][_0x5a7b('0x2b')](_0x2c1125,_0x5a7b('0x10e'));}var _0x14ca35=this[_0x5a7b('0x10f')][_0x5a7b('0x69')](this,_0x2c1125['file_id']);if(!_0x14ca35){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x2c1125,_0x5a7b('0x110'));}if(!this[_0x5a7b('0xa8')](_0x2c1125[_0x5a7b('0xd6')])){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x5a7b('0xd5'));}var _0x46b445=this[_0x5a7b('0xf')][_0x5a7b('0x111')](_0x14ca35,_0x2c1125[_0x5a7b('0x112')],_0x2c1125[_0x5a7b('0x113')]);var _0xc4ca15=_0x46b445['result']?_0x46b445[_0x5a7b('0xa0')][_0x5a7b('0x48')]():'';logger[_0x5a7b('0xa1')](_0x5a7b('0x114'),JSON[_0x5a7b('0x6d')](_0x46b445));if(_0x46b445['result']===-0x1){this['createSquareDetailsReport']['sync'](this,_0x2c1125,_0xc4ca15);return _0x46b445;}else if(_0x46b445[_0x5a7b('0x9f')]==='timeout'){_0x46b445[_0x5a7b('0xa0')]=_0xc4ca15[_0x5a7b('0x98')]>=parseInt(_0x2c1125[_0x5a7b('0x115')])?'x':'i';}else{_0x46b445['result']=_0xc4ca15[_0x5a7b('0x98')]>=parseInt(_0x2c1125[_0x5a7b('0x115')])&&_0xc4ca15[_0x5a7b('0x98')]<=parseInt(_0x2c1125[_0x5a7b('0x113')])?'x':'i';}var _0x171044=this['getVariable'][_0x5a7b('0x69')](this,_0x2c1125['variable_id']);if(!_0x171044){return this[_0x5a7b('0xf')]['error'](_0x2c1125,_0x5a7b('0xd7'));}this['channel'][_0x5a7b('0xa3')](_0x171044,_0xc4ca15);if(this[_0x5a7b('0xa8')](_0x2c1125[_0x5a7b('0x116')])){var _0x285eef=parseInt(_0x2c1125[_0x5a7b('0x116')],0xa);var _0x41dd7c=rs[_0x5a7b('0x117')]({'charset':'*','length':_0x285eef});var _0x11a204=_0xc4ca15[_0x5a7b('0x98')];if(_0x11a204>0x0){if(_0x11a204>_0x285eef){this[_0x5a7b('0xd4')]['sync'](this,_0x2c1125,_0x2c1125['hiddendigitspos']==='first'?_0x41dd7c+_0xc4ca15[_0x5a7b('0x118')](_0x285eef):_0xc4ca15[_0x5a7b('0x118')](0x0,_0x11a204-_0x285eef)+_0x41dd7c);}else{this[_0x5a7b('0xd4')]['sync'](this,_0x2c1125,rs[_0x5a7b('0x117')]({'charset':'*','length':_0x11a204}));}}else{this[_0x5a7b('0xd4')][_0x5a7b('0x69')](this,_0x2c1125,'');}}else{this[_0x5a7b('0xd4')][_0x5a7b('0x69')](this,_0x2c1125,_0xc4ca15);}return _0x46b445;};AGIVertices[_0x5a7b('0x11')]['getsecretdigits']=function(_0x127aae){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x127aae[_0x5a7b('0x37')]));return this[_0x5a7b('0xd')](_0x127aae);};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x119')]=function(_0x36ff13){logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0x11a'),_0x36ff13[_0x5a7b('0x37')]));this['createSquareDetailsReport']['sync'](this,_0x36ff13,_0x36ff13[_0x5a7b('0x11b')]);return this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x11c'),_0x36ff13[_0x5a7b('0x11b')]));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x11d')]=function(_0x10d2e7){logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x11e'),_0x10d2e7[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x10d2e7['aws_access_key_id'])||!this[_0x5a7b('0xa8')](_0x10d2e7['aws_secret_access_key'])){return this[_0x5a7b('0xf')]['noop'](_0x5a7b('0x11f'));}if(!this[_0x5a7b('0xa8')](_0x10d2e7[_0x5a7b('0x58')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xc9'));}this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x120'),_0x10d2e7['text']));var _0x21056b=this[_0x5a7b('0x80')][_0x5a7b('0x69')](this,_0x10d2e7);if(_0x21056b){this['channel']['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x121'),_0x21056b));var _0x2fe7f3=this[_0x5a7b('0xf')][_0x5a7b('0xfd')](_0x21056b);try{fs[_0x5a7b('0xfe')](_0x21056b+_0x5a7b('0xff'));}catch(_0x46e8e6){logger[_0x5a7b('0x2b')](_0x46e8e6);}return _0x2fe7f3;}return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x10d2e7,_0x5a7b('0x122'));};AGIVertices[_0x5a7b('0x11')]['awslex']=function(_0x24a13e){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x24a13e[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x24a13e[_0x5a7b('0x87')])||!this[_0x5a7b('0xa8')](_0x24a13e[_0x5a7b('0x81')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0x11f'));}if(!this[_0x5a7b('0xa8')](_0x24a13e[_0x5a7b('0x88')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')]('no\x20bot\x20name\x20configured');}if(!this[_0x5a7b('0xa8')](_0x24a13e[_0x5a7b('0x58')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xc9'));}this[_0x5a7b('0xf')]['bot']=!![];this[_0x5a7b('0xd4')](_0x24a13e);this[_0x5a7b('0x41')](_0x24a13e[_0x5a7b('0x58')],'in','','');this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x123'),_0x24a13e[_0x5a7b('0x58')]));var _0x1f6453=this[_0x5a7b('0x86')]['sync'](this,_0x24a13e);if(_0x1f6453){for(var _0x5df370 in _0x1f6453){if(_0x1f6453[_0x5a7b('0x95')](_0x5df370)&&_[_0x5a7b('0x92')](_0x1f6453[_0x5df370])){this['channel'][_0x5a7b('0xa3')](util['format'](_0x5a7b('0x124'),_0x5df370[_0x5a7b('0x64')]()),_0x1f6453[_0x5df370]);}}if(_[_0x5a7b('0x4c')](_0x1f6453['message'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0x125'));}else{this[_0x5a7b('0x41')](_0x1f6453[_0x5a7b('0x71')],_0x5a7b('0xe7'),_0x5a7b('0x126'),'');return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x127'),_0x1f6453['message']));}}return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x24a13e,_0x5a7b('0x128'));};AGIVertices[_0x5a7b('0x11')]['googleasr']=function(_0x3839fa){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x3839fa[_0x5a7b('0x37')],_0x3839fa[_0x5a7b('0x60')]));if(!this[_0x5a7b('0xa8')](_0x3839fa['key'])){return this['channel'][_0x5a7b('0xa9')]('no\x20key\x20configured');}var _0x2d0c33=_0x5a7b('0x129');var _0x48b83a=util[_0x5a7b('0x4f')](_0x5a7b('0x12a'),FILES_PATH,rs[_0x5a7b('0x117')](0x4));var _0x431137=util[_0x5a7b('0x4f')]('%s.%s',_0x48b83a,_0x2d0c33);var _0x18ce9c=!![];if(_0x3839fa[_0x5a7b('0x12b')]==='NOBEEP'){_0x18ce9c=![];}var _0x2b28aa=this[_0x5a7b('0xf')][_0x5a7b('0x12c')](_0x48b83a,_0x2d0c33,_0x3839fa['intKey'],_0x3839fa[_0x5a7b('0x60')],undefined,_0x18ce9c);if(_0x2b28aa['result']!==-0x1){this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x12d'),_0x431137));var _0x4a4a29=this[_0x5a7b('0x89')][_0x5a7b('0x69')](this,_0x3839fa,_0x431137);if(_0x4a4a29){for(var _0x53f1ea in _0x4a4a29){if(_0x4a4a29[_0x5a7b('0x95')](_0x53f1ea)){this[_0x5a7b('0xf')][_0x5a7b('0xa3')](util[_0x5a7b('0x4f')](_0x5a7b('0x12e'),_0x53f1ea['toUpperCase']()),_0x4a4a29[_0x53f1ea]);}}return this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x12f'),JSON['stringify'](_0x4a4a29)));}}return _0x2b28aa;};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x130')]=function(_0x38a775){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x131'),_0x38a775['label']));if(!this['isConfigured'](_0x38a775[_0x5a7b('0x8c')])){return this['channel'][_0x5a7b('0xa9')]('no\x20appid\x20configured');}if(!this[_0x5a7b('0xa8')](_0x38a775['appsecret'])){return this['channel']['noop'](_0x5a7b('0x132'));}var _0x1bc88f=_0x5a7b('0x129');var _0x510263=util[_0x5a7b('0x4f')]('%s/recordings/%s',FILES_PATH,rs[_0x5a7b('0x117')](0x4));var _0x4d9959=util[_0x5a7b('0x4f')](_0x5a7b('0x9a'),_0x510263,_0x1bc88f);var _0x1dc19c=!![];if(_0x38a775[_0x5a7b('0x12b')]==='NOBEEP'){_0x1dc19c=![];}var _0x21eb3a=this[_0x5a7b('0xf')]['recordFile'](_0x510263,_0x1bc88f,_0x38a775[_0x5a7b('0x133')],_0x38a775[_0x5a7b('0x60')],undefined,_0x1dc19c);if(_0x21eb3a[_0x5a7b('0xa0')]!==-0x1){this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x134'),_0x4d9959));var _0x4c7a10=this['tildeASR']['sync'](this,_0x38a775,_0x4d9959);if(_0x4c7a10){for(var _0x7eb39f in _0x4c7a10){if(_0x4c7a10[_0x5a7b('0x95')](_0x7eb39f)){this[_0x5a7b('0xf')][_0x5a7b('0xa3')](util[_0x5a7b('0x4f')](_0x5a7b('0x135'),_0x7eb39f[_0x5a7b('0x64')]()),_0x4c7a10[_0x7eb39f]);}}return this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x136'),JSON[_0x5a7b('0x6d')](_0x4c7a10)));}}return _0x21eb3a;};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x137')]=function(_0x2edac2){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x138'),_0x2edac2[_0x5a7b('0x37')]));return this[_0x5a7b('0xf')][_0x5a7b('0x139')](_0x2edac2[_0x5a7b('0x3c')],_0x2edac2[_0x5a7b('0x3d')],_0x2edac2[_0x5a7b('0x3e')]);};AGIVertices['prototype'][_0x5a7b('0x13a')]=function(_0x3ef5a9){logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x13b'),_0x3ef5a9[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x3ef5a9[_0x5a7b('0x13c')])){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x3ef5a9,_0x5a7b('0x13d'));}try{var _0x9ae416=eval(_0x3ef5a9[_0x5a7b('0x13c')])?_0x5a7b('0x13e'):_0x5a7b('0x13f');this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x140'),_0x3ef5a9[_0x5a7b('0x13c')],_0x9ae416));return{'code':0xc8,'result':_0x9ae416};}catch(_0x4133c2){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype'][_0x5a7b('0x141')]=function(_0x27a266){logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x142'),_0x27a266[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x27a266[_0x5a7b('0x143')])){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x27a266,_0x5a7b('0x144'));}var _0x4503e3=this['getIntervals'][_0x5a7b('0x69')](this,_0x27a266['interval_id']);if(!_0x4503e3){return this['channel'][_0x5a7b('0x2b')](_0x27a266,_0x5a7b('0x145'));}for(var _0x1a074d=0x0;_0x1a074d<_0x4503e3[_0x5a7b('0x98')];_0x1a074d+=0x1){var _0x247c12=this['channel'][_0x5a7b('0x9e')](util[_0x5a7b('0x4f')](_0x5a7b('0x146'),_0x4503e3[_0x1a074d]));if(_0x247c12[_0x5a7b('0xa0')]===-0x1){return _0x247c12;}logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x147'),_0x4503e3[_0x1a074d],_0x247c12[_0x5a7b('0x9f')]));if(_0x247c12[_0x5a7b('0x9f')]===_0x5a7b('0x13e')){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('IFTIME\x20%s\x20%s',_0x4503e3[_0x1a074d],'true'));this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x147'),_0x4503e3[_0x1a074d],_0x5a7b('0x13e')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x147'),_0x4503e3[_0x1a074d],_0x5a7b('0x13f')));this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x147'),_0x4503e3[_0x1a074d],'false'));}}return{'code':0xc8,'result':_0x5a7b('0x13f')};};AGIVertices['prototype'][_0x5a7b('0x148')]=function(_0xada860){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x149'),_0xada860['label']));return this[_0x5a7b('0xf')]['hangup']();};AGIVertices['prototype'][_0x5a7b('0x14a')]=function(_0x2bf24b){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x14b'),_0x2bf24b['label']));if(!this[_0x5a7b('0xa8')](_0x2bf24b['key'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0x14c'));}var _0x3f95e9=_0x5a7b('0x129');var _0x2ac7c7=util[_0x5a7b('0x4f')](_0x5a7b('0x12a'),FILES_PATH,rs['generate'](0x4));var _0xd9a2ad=util[_0x5a7b('0x4f')](_0x5a7b('0x9a'),_0x2ac7c7,_0x3f95e9);var _0x3689f0=!![];if(_0x2bf24b['beep']===_0x5a7b('0x14d')){_0x3689f0=![];}var _0x24bc77=this['channel'][_0x5a7b('0x12c')](_0x2ac7c7,_0x3f95e9,_0x2bf24b[_0x5a7b('0x133')],_0x2bf24b['timeout'],undefined,_0x3689f0);if(_0x24bc77[_0x5a7b('0xa0')]!==-0x1){this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x14e'),_0xd9a2ad));var _0x3161b1=this[_0x5a7b('0x7e')][_0x5a7b('0x69')](this,_0x2bf24b,_0xd9a2ad);if(_0x3161b1){for(var _0x1e007e in _0x3161b1){if(_0x3161b1[_0x5a7b('0x95')](_0x1e007e)){this[_0x5a7b('0xf')]['setVariable'](util[_0x5a7b('0x4f')]('ISPEECH_ASR_%s',_0x1e007e[_0x5a7b('0x64')]()),_0x3161b1[_0x1e007e]);}}return this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x14f'),JSON[_0x5a7b('0x6d')](_0x3161b1)));}}return _0x24bc77;};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x150')]=function(_0x17793e){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x151'),_0x17793e[_0x5a7b('0x37')]));if(!this['isConfigured'](_0x17793e['key'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0x14c'));}if(!this[_0x5a7b('0xa8')](_0x17793e['text'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xc9'));}this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x152'),_0x17793e[_0x5a7b('0x58')]));var _0x4c5d3a=this[_0x5a7b('0x7b')][_0x5a7b('0x69')](this,_0x17793e);if(_0x4c5d3a){this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')]('ispeech\x20%s\x20file\x20created',_0x4c5d3a));var _0xaf9f2e=this[_0x5a7b('0xf')]['streamFile'](_0x4c5d3a,_0x17793e[_0x5a7b('0x133')]);try{fs[_0x5a7b('0xfe')](_0x4c5d3a+'.wav');}catch(_0x2dc2cc){logger[_0x5a7b('0x2b')](_0x2dc2cc);}return _0xaf9f2e;}return this['channel']['error'](_0x17793e,_0x5a7b('0x153'));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x154')]=function(_0x538e8b){logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0x155'),_0x538e8b[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x538e8b[_0x5a7b('0x156')])){return this[_0x5a7b('0xf')]['error'](_0x538e8b,_0x5a7b('0x157'));}logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x158'),this['channel'][_0x5a7b('0x39')],_0x538e8b['findBy']));var _0x26e2a5=this[_0x5a7b('0x4e')]['sync'](this,_0x538e8b[_0x5a7b('0x156')]);if(_0x26e2a5){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x159'),this['channel'][_0x5a7b('0x39')],_0x538e8b['findBy']));this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0x538e8b['findBy']));return{'code':0xc8,'result':_0x5a7b('0x15a')};}else{logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x15b'),this['channel'][_0x5a7b('0x39')],_0x538e8b[_0x5a7b('0x156')]));this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x15b'),this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0x538e8b[_0x5a7b('0x156')]));return{'code':0xc8,'result':_0x5a7b('0x15c')};}};AGIVertices['prototype']['logout']=function(_0x5be4dc){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x15d'),_0x5be4dc[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x5be4dc[_0x5a7b('0x156')])){return this['channel'][_0x5a7b('0x2b')](_0x5be4dc,'no\x20find\x20by\x20configured');}logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x5a7b('0xf')]['callerid'],_0x5be4dc['findBy']));var _0x5a8457=this[_0x5a7b('0x15e')][_0x5a7b('0x69')](this,_0x5be4dc[_0x5a7b('0x156')]);if(_0x5a8457){logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0x159'),this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0x5be4dc[_0x5a7b('0x156')]));this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util['format'](_0x5a7b('0x159'),this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0x5be4dc[_0x5a7b('0x156')]));return{'code':0xc8,'result':_0x5a7b('0x15a')};}else{logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x15b'),this['channel'][_0x5a7b('0x39')],_0x5be4dc[_0x5a7b('0x156')]));this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x15b'),this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0x5be4dc['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x15f')]=function(_0x4f19bf){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x160'),_0x4f19bf[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x4f19bf[_0x5a7b('0x161')])){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x4f19bf,_0x5a7b('0x162'));}this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x163'),_0x4f19bf['operation']));var _0x1219f6=eval(_0x4f19bf['operation']);if(!this[_0x5a7b('0xa8')](_0x4f19bf[_0x5a7b('0xd6')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xd5'));}var _0x498d03=this[_0x5a7b('0x9e')][_0x5a7b('0x69')](this,_0x4f19bf['variable_id']);if(!_0x498d03){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x4f19bf,'no\x20variable\x20found');}if(_['isArray'](_0x1219f6)){var _0x18a9e2=this;_0x1219f6[_0x5a7b('0xd8')](function(_0x157a4e,_0x5886a2){_0x18a9e2[_0x5a7b('0xf')][_0x5a7b('0xa3')](util[_0x5a7b('0x4f')]('%s[%s]',_0x498d03,_0x5886a2),_0x157a4e);});return this[_0x5a7b('0xf')]['noop'](util['format']('variable\x20%s[key]\x20set',_0x498d03));}else{return this['channel']['setVariable'](_0x498d03,_0x1219f6);}};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0xc')]=function(_0x169ee7){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x169ee7['label']));if(_0x169ee7[_0x5a7b('0xa5')]===0x0){return this['maxRetry'](_0x169ee7);}_0x169ee7[_0x5a7b('0xa5')]-=0x1;if(!this[_0x5a7b('0xa8')](_0x169ee7[_0x5a7b('0x10d')])){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x169ee7,_0x5a7b('0x10e'));}var _0x4d4ca7=this[_0x5a7b('0x10f')][_0x5a7b('0x69')](this,_0x169ee7[_0x5a7b('0x10d')]);if(!_0x4d4ca7){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x169ee7,_0x5a7b('0x110'));}var _0x19f6ff=this['channel'][_0x5a7b('0x111')](_0x4d4ca7,_0x169ee7['response'],_0x169ee7['digit']);var _0x314824=_0x19f6ff[_0x5a7b('0xa0')];if(_0x19f6ff['result']===-0x1){this[_0x5a7b('0xd4')][_0x5a7b('0x69')](this,_0x169ee7,'-1');return _0x19f6ff;}else if(_0x19f6ff[_0x5a7b('0x9f')]===_0x5a7b('0x60')){_0x19f6ff[_0x5a7b('0xa0')]=_0x19f6ff['result'][_0x5a7b('0x98')]>0x0?_0x19f6ff[_0x5a7b('0xa0')]:'t';}else if(_[_0x5a7b('0x43')](_0x19f6ff['result'])){_0x19f6ff[_0x5a7b('0xa0')]='#';_0x314824='#';}if(!this[_0x5a7b('0xa8')](_0x169ee7['variable_id'])){this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0xd5'));}else{var _0x956bba=this['getVariable'][_0x5a7b('0x69')](this,_0x169ee7['variable_id']);if(!_0x956bba){return this['channel'][_0x5a7b('0x2b')](_0x169ee7,'no\x20variable\x20found');}this[_0x5a7b('0xf')][_0x5a7b('0xa3')](_0x956bba,_0x314824);}this['createSquareDetailsReport']['sync'](this,_0x169ee7,_0x314824);return _0x19f6ff;};AGIVertices['prototype']['noop']=function(_0x2fe077){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x2fe077[_0x5a7b('0x37')]));return this['channel'][_0x5a7b('0xa9')](_0x2fe077[_0x5a7b('0x164')]||_0x2fe077[_0x5a7b('0x37')]);};AGIVertices[_0x5a7b('0x11')]['pause']=function(_0x4406b8){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x4406b8[_0x5a7b('0x37')]));if(!this['isConfigured'](_0x4406b8[_0x5a7b('0x156')])){return this[_0x5a7b('0xf')]['error'](_0x4406b8,_0x5a7b('0x157'));}logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x158'),this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0x4406b8[_0x5a7b('0x156')]));var _0x85aaf9=this[_0x5a7b('0x165')][_0x5a7b('0x69')](this,_0x4406b8[_0x5a7b('0x166')]);var _0x6e6fa0=this[_0x5a7b('0x4a')][_0x5a7b('0x69')](this,_0x4406b8['findBy'],_0x85aaf9);if(_0x6e6fa0){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x159'),this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0x4406b8['findBy']));this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x159'),this[_0x5a7b('0xf')]['callerid'],_0x4406b8['findBy']));return{'code':0xc8,'result':_0x5a7b('0x15a')};}else{logger['info'](util[_0x5a7b('0x4f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0x4406b8[_0x5a7b('0x156')]));this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x159'),this[_0x5a7b('0xf')]['callerid'],_0x4406b8['findBy']));return{'code':0xc8,'result':_0x5a7b('0x15c')};}};AGIVertices['prototype']['playback']=function(_0x56e16b){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x167'),_0x56e16b[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x56e16b[_0x5a7b('0x10d')])){return this[_0x5a7b('0xf')]['error'](_0x56e16b,'no\x20file\x20audio\x20selected');}var _0x57d863=this['getSound'][_0x5a7b('0x69')](this,_0x56e16b[_0x5a7b('0x10d')]);if(!_0x57d863){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x56e16b,_0x5a7b('0x110'));}var _0x4dc6c5=this[_0x5a7b('0xf')][_0x5a7b('0x53')](_0x5a7b('0x168'),[_0x57d863,_0x56e16b['opts']]);if(_0x4dc6c5[_0x5a7b('0xa0')]===-0x1){return _0x4dc6c5;}return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0xc4'),_0x5a7b('0x168'),_0x57d863));};AGIVertices['prototype']['queue']=function(_0x590c42){logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0x169'),_0x590c42['label']));if(!this[_0x5a7b('0xa8')](_0x590c42[_0x5a7b('0x16a')])){return this['channel'][_0x5a7b('0x2b')](_0x590c42,'no\x20queue\x20selected');}var _0x9fa902='';var _0x5e5c66=parseInt(_0x590c42[_0x5a7b('0x16a')],0xa);if(isNaN(_0x5e5c66)){_0x9fa902=_0x590c42[_0x5a7b('0x16a')];}else{_0x9fa902=this[_0x5a7b('0x14')]['sync'](this,_0x590c42[_0x5a7b('0x16a')]);if(!_0x9fa902){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x590c42,'no\x20queue\x20found');}}var _0x186d44='';if(this[_0x5a7b('0xa8')](_0x590c42['file_id'])){var _0x2767e4=this[_0x5a7b('0x10f')]['sync'](this,_0x590c42[_0x5a7b('0x10d')]);if(_0x2767e4){_0x186d44=_0x2767e4;}}this[_0x5a7b('0xd4')][_0x5a7b('0x69')](this,_0x590c42,_0x9fa902);if(_0x590c42[_0x5a7b('0xe1')]['indexOf']('x')<0x0){_0x590c42[_0x5a7b('0xe1')]+='x';}if(_0x590c42[_0x5a7b('0xe1')][_0x5a7b('0x16b')]('X')<0x0){_0x590c42[_0x5a7b('0xe1')]+='X';}this[_0x5a7b('0xf')][_0x5a7b('0xa3')](_0x5a7b('0x16c'),_0x9fa902?_0x9fa902[_0x5a7b('0x16d')]():'');var _0x588ecd=this['channel'][_0x5a7b('0x53')](_0x5a7b('0x16e'),[_0x9fa902,_0x590c42[_0x5a7b('0xe1')],_0x590c42[_0x5a7b('0x6a')],_0x186d44,_0x590c42[_0x5a7b('0x60')],_0x590c42[_0x5a7b('0x16f')],_0x590c42[_0x5a7b('0x170')],_0x590c42[_0x5a7b('0x171')],'',_0x590c42['position']]);if(_0x588ecd[_0x5a7b('0xa0')]===-0x1){return _0x588ecd;}return this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0xc4'),_0x5a7b('0x16e'),_0x9fa902));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x172')]=function(_0x1cc497){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x173'),_0x1cc497[_0x5a7b('0x37')]));var _0x1e92ed=_0x1cc497['recordingFormat']||_0x5a7b('0x129');var _0x521a86=util[_0x5a7b('0x4f')](_0x5a7b('0x174'),this[_0x5a7b('0xf')]['uniqueid'],rs[_0x5a7b('0x117')](0x5));var _0x2cf720=util['format'](_0x5a7b('0x175'),FILES_PATH,_0x521a86,_0x1e92ed);var _0x9473a2=util['format'](_0x5a7b('0x12a'),FILES_PATH,_0x521a86);this[_0x5a7b('0x3a')][_0x5a7b('0x69')](this,_0x1cc497,_0x521a86,_0x2cf720);this[_0x5a7b('0xf')][_0x5a7b('0xa3')](_0x5a7b('0x176'),_0x521a86);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x9473a2,_0x1e92ed,_0x1cc497[_0x5a7b('0x177')],_0x1cc497[_0x5a7b('0x60')]);return this['channel'][_0x5a7b('0x12c')](_0x9473a2,_0x1e92ed,_0x1cc497[_0x5a7b('0x177')],_0x1cc497[_0x5a7b('0x60')],undefined,!![]);};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x178')]=function(_0x5a21b7){logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0x179'),_0x5a21b7[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x5a21b7[_0x5a7b('0x6a')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')]('no\x20url\x20configured');}var _0x4546ca=this[_0x5a7b('0x5e')][_0x5a7b('0x69')](this,_0x5a21b7);logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x17a'),util[_0x5a7b('0x17b')](_0x4546ca,{'showHidden':![],'depth':null})));if(!this[_0x5a7b('0xa8')](_0x5a21b7['variable_id'])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0x17c'));}var _0x3fe746=this[_0x5a7b('0x9e')]['sync'](this,_0x5a21b7[_0x5a7b('0xd6')]);if(!_0x3fe746){return this[_0x5a7b('0xf')]['error'](_0x5a21b7,_0x5a7b('0xd7'));}this[_0x5a7b('0xf')][_0x5a7b('0xa3')](util[_0x5a7b('0x4f')](_0x5a7b('0x17d'),_0x3fe746),_0x4546ca[_0x5a7b('0x70')]?_0x4546ca[_0x5a7b('0x70')]:_0x5a7b('0x17e'));this['channel'][_0x5a7b('0xa3')](util[_0x5a7b('0x4f')]('%s_STATUS_MESSAGE',_0x3fe746),_0x4546ca[_0x5a7b('0x17f')]?_0x4546ca['statusMessage']:'OK');if(_0x4546ca['body']){try{this[_0x5a7b('0x99')](_0x4546ca[_0x5a7b('0x6e')],_0x3fe746);}catch(_0xf193a3){logger[_0x5a7b('0x2b')](util[_0x5a7b('0x4f')](_0x5a7b('0x180'),_0x3fe746));}}return this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x181'),_0x3fe746));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x182')]=function(_0x2e9486){logger['info'](util['format'](_0x5a7b('0x183'),_0x2e9486['label']));return this[_0x5a7b('0xf')]['sayDigits'](_0x2e9486[_0x5a7b('0x184')][_0x5a7b('0x185')](/\s+/g,''),_0x2e9486[_0x5a7b('0x177')]);};AGIVertices['prototype'][_0x5a7b('0x186')]=function(_0x30ebbe){logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0x187'),_0x30ebbe['label']));return this[_0x5a7b('0xf')][_0x5a7b('0x188')](_0x30ebbe['number'][_0x5a7b('0x185')](/\s+/g,''),_0x30ebbe[_0x5a7b('0x177')]);};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x189')]=function(_0x5418a1){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x18a'),_0x5418a1[_0x5a7b('0x37')]));return this[_0x5a7b('0xf')][_0x5a7b('0x18b')](_0x5418a1[_0x5a7b('0x58')],_0x5418a1[_0x5a7b('0x177')]);};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x18c')]=function(_0x1acd70){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x1acd70[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x1acd70[_0x5a7b('0x18d')])){return this['channel'][_0x5a7b('0xa9')](_0x5a7b('0x18e'));}var _0x4c5d64=this[_0x5a7b('0x18f')]['sync'](this,_0x1acd70[_0x5a7b('0x18d')]);if(!_0x4c5d64||!_0x4c5d64[_0x5a7b('0x190')]){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x1acd70,_0x5a7b('0x191'));}var _0x107758={'from':util[_0x5a7b('0x4f')](_0x5a7b('0x192'),_0x4c5d64[_0x5a7b('0x13')],_0x4c5d64[_0x5a7b('0x193')]||_0x4c5d64[_0x5a7b('0x190')][_0x5a7b('0x194')]),'to':_0x1acd70['to']||'','cc':_0x1acd70['cc']||'','bcc':_0x1acd70[_0x5a7b('0x195')]||'','subject':_0x1acd70[_0x5a7b('0x196')],'html':_0x1acd70[_0x5a7b('0x58')],'text':_0x1acd70[_0x5a7b('0x58')]};if(this['isConfigured'](_0x1acd70['template_id'])){}logger[_0x5a7b('0xdc')]('sendMail\x20message',JSON[_0x5a7b('0x6d')](_0x107758));this['createSquareDetailsReport'][_0x5a7b('0x69')](this,_0x1acd70,_0x1acd70[_0x5a7b('0x18d')]);this['channel'][_0x5a7b('0xa9')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x4c5d64[_0x5a7b('0x13')]));this[_0x5a7b('0x22')][_0x5a7b('0x69')](this,_0x4c5d64[_0x5a7b('0x197')],_0x107758);return this[_0x5a7b('0xf')][_0x5a7b('0xa9')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x5a7b('0x11')]['sendFax']=function(_0x2e60c0){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x2e60c0['label']));return this['channel'][_0x5a7b('0xa9')](_0x5a7b('0x198'));};AGIVertices[_0x5a7b('0x11')]['sendSMS']=function(_0x30a8f8){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x30a8f8[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x30a8f8[_0x5a7b('0x199')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0x19a'));}var _0x2689d7=this[_0x5a7b('0x33')][_0x5a7b('0x69')](this,_0x30a8f8['sms_account_id']);if(!_0x2689d7){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x30a8f8,_0x5a7b('0x19b'));}var _0x5c1b5d={'body':_0x30a8f8[_0x5a7b('0x19c')],'phone':_0x30a8f8['to']||'','SmsAccountId':_0x2689d7['id']};logger[_0x5a7b('0xdc')](_0x5a7b('0x19d'),JSON['stringify'](_0x5c1b5d));this[_0x5a7b('0xd4')][_0x5a7b('0x69')](this,_0x30a8f8,_0x30a8f8[_0x5a7b('0x199')]);this['channel'][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x19e'),_0x2689d7['name']));this[_0x5a7b('0x35')][_0x5a7b('0x69')](this,_0x5c1b5d);return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](_0x5a7b('0x19f'));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x1a0')]=function(_0x3f8238){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x3f8238[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x3f8238[_0x5a7b('0xd6')])){return this['channel'][_0x5a7b('0x2b')](_0x3f8238,'no\x20variable\x20selected');}var _0x16f8ae=this[_0x5a7b('0x9e')][_0x5a7b('0x69')](this,_0x3f8238['variable_id']);if(!_0x16f8ae){return this[_0x5a7b('0xf')]['error'](_0x3f8238,_0x5a7b('0xd7'));}return this[_0x5a7b('0xf')]['setVariable'](_0x16f8ae,_0x3f8238[_0x5a7b('0x1a1')]);};AGIVertices[_0x5a7b('0x11')]['start']=function(_0x1bceba){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x1a2'),_0x1bceba[_0x5a7b('0x37')]));this[_0x5a7b('0xf')]['noop']('START\x20CALLY\x20SQUARE');if(_0x1bceba['answer']===_0x5a7b('0x1a3')){this['channel'][_0x5a7b('0xa9')]('Answer');return this[_0x5a7b('0xf')][_0x5a7b('0xb8')]();}return this[_0x5a7b('0xf')]['noop'](_0x5a7b('0x1a4'));};AGIVertices['prototype'][_0x5a7b('0x1a5')]=function(_0x4bea75){logger['info'](util[_0x5a7b('0x4f')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x4bea75[_0x5a7b('0x37')]));if(!this['isConfigured'](_0x4bea75[_0x5a7b('0x1a6')])){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x4bea75,'no\x20subproject\x20selected');}var _0x30a77f=this['getSquareProject']['sync'](this,_0x4bea75[_0x5a7b('0x1a6')]);if(!this[_0x5a7b('0xa8')](_0x30a77f)){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x4bea75,util[_0x5a7b('0x4f')](_0x5a7b('0x1a7'),_0x4bea75['project_id']));}if(_0x30a77f===this[_0x5a7b('0xf')][_0x5a7b('0x38')]){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x4bea75,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x5a7b('0xd4')]['sync'](this,_0x4bea75,_0x30a77f);var _0xc03ac9=this[_0x5a7b('0xf')][_0x5a7b('0x53')](_0x5a7b('0x1a8'),util[_0x5a7b('0x4f')](_0x5a7b('0x1a9'),config[_0x5a7b('0x16f')][_0x5a7b('0x1aa')]||_0x5a7b('0x1ab'),_0x30a77f,this[_0x5a7b('0xf')]['arg_1']));if(_0xc03ac9['result']===-0x1){return _0xc03ac9;}return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0xc4'),'AGI',_0x30a77f));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x1ac')]=function(_0x18b06a){logger['info'](util[_0x5a7b('0x4f')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x18b06a[_0x5a7b('0x37')]));var _0x1a97f2=this[_0x5a7b('0x52')]['sync'](this,_0x18b06a[_0x5a7b('0xb7')]);this['createSquareDetailsReport'][_0x5a7b('0x69')](this,_0x18b06a,_0x18b06a[_0x5a7b('0xb7')]);if(this[_0x5a7b('0xa8')](_0x18b06a['variable_id'])){var _0x31053d=this['getVariable'][_0x5a7b('0x69')](this,_0x18b06a['variable_id']);if(_0x31053d){this[_0x5a7b('0xf')]['setVariable'](_0x31053d,_0x1a97f2);return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util['format'](_0x5a7b('0x1ad'),_0x18b06a['command'],_0x31053d));}}return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x1ae'),_0x18b06a[_0x5a7b('0xb7')]));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x1af')]=function(_0x897ac8){logger['info'](util[_0x5a7b('0x4f')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x897ac8[_0x5a7b('0x37')]));_0x897ac8[_0x5a7b('0x58')]=_0x897ac8[_0x5a7b('0x58')][_0x5a7b('0x185')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5a7b('0xa8')](_0x897ac8[_0x5a7b('0x56')])){return this['channel']['noop'](_0x5a7b('0x1b0'));}if(!this[_0x5a7b('0xa8')](_0x897ac8[_0x5a7b('0x58')])){return this[_0x5a7b('0xf')][_0x5a7b('0xa9')]('no\x20text\x20configured');}this[_0x5a7b('0xf')]['noop'](util['format'](_0x5a7b('0x1b1'),_0x897ac8[_0x5a7b('0x58')]));var _0x4b59ed=this['googleCloudTTS'][_0x5a7b('0x69')](this,_0x897ac8);if(_0x4b59ed){this[_0x5a7b('0xf')]['noop'](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x4b59ed));var _0x555123=this[_0x5a7b('0xf')][_0x5a7b('0xfd')](_0x4b59ed);try{fs[_0x5a7b('0xfe')](_0x4b59ed+_0x5a7b('0xff'));}catch(_0x385260){logger[_0x5a7b('0x2b')](_0x385260);}return _0x555123;}return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x897ac8,_0x5a7b('0x1b2'));};AGIVertices['prototype'][_0x5a7b('0x1b3')]=function(_0x27e33b){logger[_0x5a7b('0xa1')](util['format'](_0x5a7b('0x1b4'),_0x27e33b[_0x5a7b('0x37')]));_0x27e33b['text']=_0x27e33b[_0x5a7b('0x58')][_0x5a7b('0x185')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x27e33b[_0x5a7b('0x58')])){return this[_0x5a7b('0xf')]['noop'](_0x5a7b('0xc9'));}this[_0x5a7b('0xf')]['noop'](util[_0x5a7b('0x4f')](_0x5a7b('0x1b5'),_0x27e33b[_0x5a7b('0x58')]));var _0x41c3af=this[_0x5a7b('0x1b6')][_0x5a7b('0x69')](this,_0x27e33b);if(_0x41c3af){this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util['format'](_0x5a7b('0x1b7'),_0x41c3af));var _0x3ea8d2=this[_0x5a7b('0xf')][_0x5a7b('0xfd')](_0x41c3af);try{fs[_0x5a7b('0xfe')](_0x41c3af+_0x5a7b('0xff'));}catch(_0x3c1347){logger[_0x5a7b('0x2b')](_0x3c1347);}return _0x3ea8d2;}return this['channel'][_0x5a7b('0x2b')](_0x27e33b,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['unpause']=function(_0xdc29a8){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x1b8'),_0xdc29a8[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0xdc29a8[_0x5a7b('0x156')])){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0xdc29a8,_0x5a7b('0x157'));}logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x158'),this[_0x5a7b('0xf')]['callerid'],_0xdc29a8[_0x5a7b('0x156')]));var _0x3157f7=this[_0x5a7b('0x4d')][_0x5a7b('0x69')](this,_0xdc29a8[_0x5a7b('0x156')]);if(_0x3157f7){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')](_0x5a7b('0x159'),this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0xdc29a8['findBy']));this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x159'),this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0xdc29a8['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x5a7b('0x15b'),this[_0x5a7b('0xf')][_0x5a7b('0x39')],_0xdc29a8[_0x5a7b('0x156')]));this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')](_0x5a7b('0x15b'),this['channel']['callerid'],_0xdc29a8[_0x5a7b('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x1b9')]=function(_0x1424c8){logger[_0x5a7b('0xa1')](util[_0x5a7b('0x4f')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x1424c8[_0x5a7b('0x37')]));var _0x481dc1=this[_0x5a7b('0xf')][_0x5a7b('0x53')]('VOICEMAIL',[_0x1424c8[_0x5a7b('0x1ba')],_0x1424c8[_0x5a7b('0x73')]]);if(_0x481dc1[_0x5a7b('0xa0')]===-0x1){return _0x481dc1;}return this[_0x5a7b('0xf')][_0x5a7b('0xa9')](util[_0x5a7b('0x4f')]('Executed\x20command\x20%s\x20%s',_0x5a7b('0x1bb'),_0x1424c8[_0x5a7b('0x1ba')]));};AGIVertices[_0x5a7b('0x11')][_0x5a7b('0x1bc')]=function(_0x36b2df){logger['info'](util[_0x5a7b('0x4f')](_0x5a7b('0x1bd'),_0x36b2df[_0x5a7b('0x37')]));if(!this[_0x5a7b('0xa8')](_0x36b2df[_0x5a7b('0xd6')])){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x36b2df,_0x5a7b('0x1be'));}var _0x1438fd=this['getVariable'][_0x5a7b('0x69')](this,_0x36b2df['variable_id']);if(!_0x1438fd){return this[_0x5a7b('0xf')][_0x5a7b('0x2b')](_0x36b2df,_0x5a7b('0xd7'));}var _0x286c3a=this[_0x5a7b('0xf')][_0x5a7b('0x9e')](_0x1438fd);return{'code':0xc8,'result':_0x286c3a[_0x5a7b('0x9f')]?_0x286c3a['extra']:'-'};};String[_0x5a7b('0x11')][_0x5a7b('0x9d')]=function(_0x59ae66,_0x543233){return this['split'](_0x59ae66)['join'](_0x543233);};module[_0x5a7b('0x1bf')]=AGIVertices; \ No newline at end of file +var _0x6c76=['accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','callback_','lastName','phone','list_id','scheduledAt','callback','toString','getPause','getPauseById','agentPause','agent','isNil','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','timeout','number','includes','POST','PUT','method','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','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','speed','ispeechASR','isConfigured','model','awsPolly','Amy','awsLex','aws_access_key_id','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','isString','saveRestApiResult','isArray','%s.%s','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','createSquareDetailsReport','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','noop','no\x20grammar\x20configured','grammar','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','no\x20list\x20selected','delay','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','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','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','setVariable','DIALOGFLOW_%s','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','speech','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.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','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','no\x20bot\x20name\x20configured','bot','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','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','no\x20appsecret\x20configured','%s/recordings/%s','beep','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','true','false','condition','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','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','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','toLowerCase','QUEUE','macro','gosub','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','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','saydigits','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','sendMail\x20message','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','START\x20CALLY\x20SQUARE','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','randomstring','moment','../../config/logger','agi','../../config/environment/shared','./scripts','rawHeaders','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','catch','prototype','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareOdbc','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','info','close','getSmsAccount','getSmsAccountById','createSmsMessage','uniqueid','label','agicommand','createSquareRecording','callerid','calleridname','context','extension','priority'];(function(_0x4b980d,_0x32fc6a){var _0x5c7974=function(_0x3b7af4){while(--_0x3b7af4){_0x4b980d['push'](_0x4b980d['shift']());}};_0x5c7974(++_0x32fc6a);}(_0x6c76,0x184));var _0x66c7=function(_0x488838,_0xfc56d0){_0x488838=_0x488838-0x0;var _0x1c8741=_0x6c76[_0x488838];return _0x1c8741;};'use strict';var fs=require('fs');var util=require(_0x66c7('0x0'));var _=require(_0x66c7('0x1'));var sh=require(_0x66c7('0x2'));var odbc=require('odbc')();var rs=require(_0x66c7('0x3'));var moment=require(_0x66c7('0x4'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x66c7('0x5'))(_0x66c7('0x6'));var config=require('../../config/environment');var shared=require(_0x66c7('0x7'));var scripts=require(_0x66c7('0x8'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x66c7('0x9'),'rawBody'];var verticesWithRetry=['menu',_0x66c7('0xa'),_0x66c7('0xb')];var AGIVertices=function(_0x24349f,_0x53a81c,_0x20c010){this[_0x66c7('0xc')]=_0x24349f;this[_0x66c7('0xd')]=_0x53a81c;this[_0x66c7('0xe')]=_0x20c010;};AGIVertices['prototype'][_0x66c7('0xf')]=function(_0x45db57,_0x26c9b2){this[_0x66c7('0xd')][_0x66c7('0x10')](_0x45db57)[_0x66c7('0x11')](function(_0x174717){_0x26c9b2(null,_0x174717?_0x174717['name']:![]);})[_0x66c7('0x12')](function(_0x760e36){_0x26c9b2(_0x760e36);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x14')]=function(_0x4f6c91,_0x1e91d1){this[_0x66c7('0xd')][_0x66c7('0x15')](_0x4f6c91)[_0x66c7('0x11')](function(_0x5d44e1){_0x1e91d1(null,_0x5d44e1?_0x5d44e1[_0x66c7('0x16')]:![]);})['catch'](function(_0x208010){_0x1e91d1(_0x208010);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x17')]=function(_0x42e930,_0x22b262){this['rpc']['getSquareProjectById'](_0x42e930)['then'](function(_0x5129f6){_0x22b262(null,_0x5129f6?_0x5129f6[_0x66c7('0x16')]:![]);})[_0x66c7('0x12')](function(_0x47a299){_0x22b262(_0x47a299);});};AGIVertices['prototype'][_0x66c7('0x18')]=function(_0x9b65cf,_0x4756f7){this[_0x66c7('0xd')]['getSquareOdbcById'](_0x9b65cf)['then'](function(_0x1853b2){_0x4756f7(null,_0x1853b2?_0x1853b2[_0x66c7('0x19')]:![]);})[_0x66c7('0x12')](function(_0x1c43c4){_0x4756f7(_0x1c43c4);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x1a')]=function(_0x4804cf,_0x4ddbd2){this[_0x66c7('0xd')]['getUserById'](_0x4804cf)[_0x66c7('0x11')](function(_0x8b96b1){_0x4ddbd2(null,_0x8b96b1?_0x8b96b1[_0x66c7('0x16')]:![]);})[_0x66c7('0x12')](function(_0x5bfaf6){_0x4ddbd2(_0x5bfaf6);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x1b')]=function(_0x5b28e6,_0x2ae31f){this[_0x66c7('0xd')][_0x66c7('0x1c')](_0x5b28e6)[_0x66c7('0x11')](function(_0x2af0a3){_0x2ae31f(null,_0x2af0a3?_0x2af0a3['name']:![]);})['catch'](function(_0x4e514a){_0x2ae31f(_0x4e514a);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x1d')]=function(_0x5c5e42,_0x9afd50){var _0x3e979d=this;this[_0x66c7('0xd')][_0x66c7('0x1e')](_0x5c5e42)[_0x66c7('0x11')](function(_0x27be81){_0x9afd50(null,_0x27be81?_0x3e979d['getSoundPath'](_0x27be81[_0x66c7('0x1f')]):![]);})[_0x66c7('0x12')](function(_0xc4b2bf){_0x9afd50(_0xc4b2bf);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x20')]=function(_0x592f0e,_0x263b48){this['rpc'][_0x66c7('0x21')](_0x592f0e)['then'](function(_0x296875){_0x263b48(null,_0x296875?_0x296875:![]);})[_0x66c7('0x12')](function(_0x29f292){_0x263b48(_0x29f292);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x22')]=function(_0x24e776,_0x559ab9,_0x520bd2){this[_0x66c7('0xe')][_0x66c7('0x22')](_0x24e776,_0x559ab9)[_0x66c7('0x11')](function(){_0x520bd2(null);})[_0x66c7('0x12')](function(_0x344345){_0x520bd2(_0x344345);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x23')]=function(_0x255ac3,_0x15edc8){this[_0x66c7('0xd')][_0x66c7('0x24')](_0x255ac3)[_0x66c7('0x11')](function(_0x4eb03f){if(_0x4eb03f){if(_0x4eb03f['IntervalId']){_0x15edc8(null,[_0x4eb03f[_0x66c7('0x25')]]);}else{_0x15edc8(null,_[_0x66c7('0x26')](_0x4eb03f[_0x66c7('0x27')],_0x66c7('0x25')));}}else{_0x15edc8(null,![]);}})[_0x66c7('0x12')](function(_0x2bf7c2){_0x15edc8(_0x2bf7c2);});};AGIVertices[_0x66c7('0x13')]['getSoundPath']=function(_0x30b90f){return util[_0x66c7('0x28')](_0x66c7('0x29'),FILES_PATH,_0x30b90f);};AGIVertices[_0x66c7('0x13')][_0x66c7('0x2a')]=function(_0x324696,_0x3c8638,_0x2b3ac1){odbc[_0x66c7('0x2b')](_0x324696,function(_0x274c45){if(_0x274c45){logger[_0x66c7('0x2c')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x274c45);_0x2b3ac1(_0x274c45);}else{logger['info'](_0x66c7('0x2d'));odbc[_0x66c7('0x2e')](_0x3c8638,function(_0xc63941,_0x540c6a){if(_0xc63941){logger['info'](_0x66c7('0x2f'),_0x3c8638);_0x2b3ac1(_0xc63941);}else{logger[_0x66c7('0x30')]('Query\x20executed\x20correctly\x20%s',_0x3c8638);odbc[_0x66c7('0x31')](function(_0x6e9796){if(_0x6e9796){logger[_0x66c7('0x2c')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x6e9796);}_0x2b3ac1(null,_0x540c6a);});}});}});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x32')]=function(_0x9f6ca8,_0x14d59c){this[_0x66c7('0xd')][_0x66c7('0x33')](_0x9f6ca8)[_0x66c7('0x11')](function(_0x279d27){_0x14d59c(null,_0x279d27?_0x279d27:![]);})[_0x66c7('0x12')](function(_0x5f34ed){_0x14d59c(_0x5f34ed);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x34')]=function(_0xd91797,_0x17a1e8){this[_0x66c7('0xd')][_0x66c7('0x34')](_0xd91797)[_0x66c7('0x11')](function(_0x750adc){_0x17a1e8(null,_0x750adc);})[_0x66c7('0x12')](function(_0x3d371a){_0x17a1e8(_0x3d371a);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x528f5c,_0x209f58,_0x1661e8){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x66c7('0xc')][_0x66c7('0x35')],'node':_0x528f5c[_0x66c7('0x36')],'application':_0x528f5c[_0x66c7('0x37')],'data':_0x209f58||null,'project_name':this[_0x66c7('0xc')]['arg_1'],'callerid':this[_0x66c7('0xc')]['callerid']})['then'](function(_0x370ae2){if(_0x1661e8){_0x1661e8(null,_0x370ae2);}})[_0x66c7('0x12')](function(_0x39062a){if(_0x1661e8){_0x1661e8(_0x39062a);}});};AGIVertices[_0x66c7('0x13')]['createSquareRecording']=function(_0x5cf5c1,_0x3e89f8,_0x52506a,_0x4e0c89){this[_0x66c7('0xd')][_0x66c7('0x38')]({'uniqueid':this[_0x66c7('0xc')][_0x66c7('0x35')],'callerid':this['channel'][_0x66c7('0x39')],'calleridname':this[_0x66c7('0xc')][_0x66c7('0x3a')],'context':this['channel'][_0x66c7('0x3b')],'extension':this[_0x66c7('0xc')][_0x66c7('0x3c')],'priority':this[_0x66c7('0xc')][_0x66c7('0x3d')],'accountcode':this[_0x66c7('0xc')][_0x66c7('0x3e')],'dnid':this[_0x66c7('0xc')]['dnid'],'projectName':this[_0x66c7('0xc')][_0x66c7('0x3f')],'saveName':_0x3e89f8,'filename':_0x5cf5c1[_0x66c7('0x40')]||_0x3e89f8,'savePath':_0x52506a})[_0x66c7('0x11')](function(_0x208a15){_0x4e0c89(null,_0x208a15);})[_0x66c7('0x12')](function(_0x2cd0c6){_0x4e0c89(_0x2cd0c6);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x41')]=function(_0x2d8eeb,_0x9e2346,_0x1096e3,_0x5b343a,_0x186dfd){this['rpc'][_0x66c7('0x41')]({'uniqueid':this[_0x66c7('0xc')][_0x66c7('0x35')],'body':_0x2d8eeb,'direction':_0x9e2346,'providerName':_0x1096e3,'providerResponse':_0x5b343a})[_0x66c7('0x11')](function(_0x533ff5){if(_0x186dfd){_0x186dfd(null,_0x533ff5);}})[_0x66c7('0x12')](function(_0x1a159f){if(_0x186dfd){_0x186dfd(_0x1a159f);}});};AGIVertices['prototype'][_0x66c7('0x42')]=function(_0x2affe4,_0xe4304c){this[_0x66c7('0xd')][_0x66c7('0x42')]({'firstName':_[_0x66c7('0x43')](_0x2affe4[_0x66c7('0x16')])||_['isNil'](_0x2affe4[_0x66c7('0x16')])?_0x66c7('0x44')+Math['random']():_0x2affe4[_0x66c7('0x16')],'lastName':_[_0x66c7('0x43')](_0x2affe4[_0x66c7('0x45')])||_['isNil'](_0x2affe4[_0x66c7('0x45')])?null:_0x2affe4[_0x66c7('0x45')],'phone':_0x2affe4[_0x66c7('0x46')],'ListId':_0x2affe4[_0x66c7('0x47')],'scheduledat':_0x2affe4[_0x66c7('0x48')],'callbackUniqueid':this[_0x66c7('0xc')][_0x66c7('0x35')],'tags':_0x66c7('0x49'),'description':'Callback\x20scheduled\x20at\x20'+_0x2affe4[_0x66c7('0x48')][_0x66c7('0x4a')](),'priority':_0x2affe4['callback_priority']})[_0x66c7('0x11')](function(_0x167968){_0xe4304c(null,_0x167968);})[_0x66c7('0x12')](function(_0x577d19){_0xe4304c(_0x577d19);});};AGIVertices['prototype'][_0x66c7('0x4b')]=function(_0x5388e1,_0x3c8fd9){this[_0x66c7('0xd')][_0x66c7('0x4c')](_0x5388e1)[_0x66c7('0x11')](function(_0xebff6b){_0x3c8fd9(null,_0xebff6b?_0xebff6b[_0x66c7('0x16')]:![]);})['catch'](function(_0x58f938){_0x3c8fd9(_0x58f938);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x4d')]=function(_0x5e6e32,_0x5a4908,_0x157369){var _0x5004aa={'role':_0x66c7('0x4e')};_0x5004aa[_0x5e6e32]=this[_0x66c7('0xc')][_0x66c7('0x39')];this[_0x66c7('0xd')]['agentPause'](_0x5004aa,_0x5a4908,this[_0x66c7('0xc')][_0x66c7('0x35')])[_0x66c7('0x11')](function(_0x2659f5){_0x157369(null,_[_0x66c7('0x4f')](_0x2659f5)?![]:!![]);})[_0x66c7('0x12')](function(_0x4ec465){logger[_0x66c7('0x2c')](_0x4ec465);_0x157369(null,![]);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x50')]=function(_0x5352ec,_0xd27aa4){var _0x5cb63e={'role':_0x66c7('0x4e')};_0x5cb63e[_0x5352ec]=this[_0x66c7('0xc')][_0x66c7('0x39')];this[_0x66c7('0xd')][_0x66c7('0x50')](_0x5cb63e)[_0x66c7('0x11')](function(_0x4b36d2){_0xd27aa4(null,_[_0x66c7('0x4f')](_0x4b36d2)?![]:!![]);})[_0x66c7('0x12')](function(_0x2d9069){logger[_0x66c7('0x2c')](_0x2d9069);_0xd27aa4(null,![]);});};AGIVertices[_0x66c7('0x13')]['agentLogout']=function(_0x463c15,_0x1cb5ef){var _0x429096={'role':_0x66c7('0x4e')};_0x429096[_0x463c15]=this[_0x66c7('0xc')][_0x66c7('0x39')];this[_0x66c7('0xd')][_0x66c7('0x51')](_0x429096)[_0x66c7('0x11')](function(_0x1a4e2b){_0x1cb5ef(null,_[_0x66c7('0x4f')](_0x1a4e2b)?![]:!![]);})[_0x66c7('0x12')](function(_0x50f72d){logger[_0x66c7('0x2c')](_0x50f72d);_0x1cb5ef(null,![]);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x52')]=function(_0x213757,_0x1a7e10){var _0x419b49={'role':_0x66c7('0x4e')};_0x419b49[_0x213757]=this['channel'][_0x66c7('0x39')];var _0x2943f3=_0x213757!=_0x66c7('0x53')?util[_0x66c7('0x28')](_0x66c7('0x54'),_0x66c7('0x55'),this[_0x66c7('0xc')][_0x66c7('0x39')]):undefined;this[_0x66c7('0xd')][_0x66c7('0x52')](_0x419b49,_0x2943f3)[_0x66c7('0x11')](function(_0x450b14){_0x1a7e10(null,_[_0x66c7('0x4f')](_0x450b14)?![]:!![]);})[_0x66c7('0x12')](function(_0x2b25e7){logger[_0x66c7('0x2c')](_0x2b25e7);_0x1a7e10(null,![]);});};AGIVertices['prototype'][_0x66c7('0x56')]=function(_0x31bc19,_0x43a623){sh[_0x66c7('0x57')](_[_0x66c7('0x58')](_0x31bc19),function(_0x2c9af2,_0x3133f5){var _0x3ee5b3=_0x3133f5[_0x66c7('0x59')](/(\r\n|\n|\r)/gm,'');_0x43a623(null,_0x3ee5b3);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x5a')]=function(_0x326a6c,_0x2476e6){scripts[_0x66c7('0x5a')](_0x326a6c[_0x66c7('0x5b')],_0x326a6c[_0x66c7('0x5c')]||_0x66c7('0x5d'),_0x326a6c['text'],_0x326a6c[_0x66c7('0x5e')]||_0x66c7('0x5f'),_0x326a6c[_0x66c7('0x60')]||_0x66c7('0x61'),_0x326a6c[_0x66c7('0x62')]||_0x66c7('0x63'))['then'](function(_0x4de349){_0x2476e6(null,_0x4de349);})[_0x66c7('0x12')](function(_0x59b45f){_0x2476e6(_0x59b45f);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x64')]=function(_0x367b59,_0x139529){scripts[_0x66c7('0x64')](_0x367b59[_0x66c7('0x5d')],_0x367b59[_0x66c7('0x65')]||'en',0x1)[_0x66c7('0x11')](function(_0x1f0a06){_0x139529(null,_0x1f0a06);})[_0x66c7('0x12')](function(_0x3b8a45){_0x139529(_0x3b8a45);});};AGIVertices[_0x66c7('0x13')]['restAPI']=function(_0x25f193,_0x2b4f98){var _0x30634c={'uri':_0x25f193[_0x66c7('0x66')],'method':_0x25f193['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x25f193[_0x66c7('0x67')])===_0x66c7('0x68')&&parseInt(_0x25f193['timeout'])>=0x1?parseInt(_0x25f193[_0x66c7('0x67')])*0x3e8:0x5*0x3e8};if(_[_0x66c7('0x69')]([_0x66c7('0x6a'),_0x66c7('0x6b')],_0x30634c[_0x66c7('0x6c')][_0x66c7('0x6d')]())){try{_0x30634c['body']=_0x25f193['rawBody']?JSON[_0x66c7('0x6e')](_0x25f193['rawBody']):{};}catch(_0x570a63){logger[_0x66c7('0x2c')](_0x66c7('0x6f'),_0x570a63);}}try{_0x30634c[_0x66c7('0x70')]=_0x25f193[_0x66c7('0x9')]?JSON[_0x66c7('0x6e')](_0x25f193[_0x66c7('0x9')]):{};}catch(_0x11de69){logger[_0x66c7('0x2c')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x11de69);}if(_0x25f193[_0x66c7('0x71')]){try{var _0x508e2c=require(_0x25f193[_0x66c7('0x71')])[_0x66c7('0x72')](this,_0x30634c);_0x30634c[_0x66c7('0x73')]=Mustache[_0x66c7('0x74')](_0x25f193[_0x66c7('0x66')],_0x508e2c,{},['$$','$$']);if(_0x30634c[_0x66c7('0x70')]){_0x30634c[_0x66c7('0x70')]=JSON[_0x66c7('0x6e')](Mustache[_0x66c7('0x74')](JSON[_0x66c7('0x75')](_0x30634c[_0x66c7('0x70')]),_0x508e2c,{},['$$','$$']));}if(_0x30634c[_0x66c7('0x76')]){_0x30634c[_0x66c7('0x76')]=JSON[_0x66c7('0x6e')](Mustache[_0x66c7('0x74')](JSON[_0x66c7('0x75')](_0x30634c[_0x66c7('0x76')]),_0x508e2c,{},['$$','$$']));}}catch(_0x12e91b){logger[_0x66c7('0x2c')](_0x66c7('0x77'),_0x12e91b);}}rp(_0x30634c)[_0x66c7('0x11')](function(_0x300ff4){var _0x418090={'statusCode':_0x300ff4[_0x66c7('0x78')]||0xc8,'statusMessage':_0x300ff4[_0x66c7('0x79')]||'OK','headers':_0x300ff4['headers']||{},'body':_0x300ff4[_0x66c7('0x76')]||{}};_0x2b4f98(null,_0x418090);})[_0x66c7('0x12')](function(_0x94bae8){var _0x5a163c={'statusCode':_0x94bae8[_0x66c7('0x78')]||0x1f4,'statusMessage':_0x94bae8[_0x66c7('0x7a')]||_0x66c7('0x7b'),'headers':_0x94bae8['options'][_0x66c7('0x70')]||{},'body':_0x94bae8[_0x66c7('0x7c')][_0x66c7('0x76')]||{}};_0x2b4f98(null,_0x5a163c);});};AGIVertices['prototype'][_0x66c7('0x7d')]=function(_0x131aaf,_0x280cdc){scripts[_0x66c7('0x7d')](this['channel'][_0x66c7('0x35')],_0x131aaf[_0x66c7('0x7e')],_0x131aaf[_0x66c7('0x5d')],_0x131aaf[_0x66c7('0x7f')]||'en')['then'](function(_0x596f63){_0x280cdc(null,_0x596f63);})[_0x66c7('0x12')](function(_0x2f3f75){_0x280cdc(_0x2f3f75);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x80')]=function(_0x114f47,_0x50f3de){scripts[_0x66c7('0x80')](this[_0x66c7('0xc')][_0x66c7('0x35')],_0x114f47[_0x66c7('0x81')],_0x114f47[_0x66c7('0x82')],_0x114f47['private_key'],_0x114f47[_0x66c7('0x5d')],_0x114f47[_0x66c7('0x83')]||'en')[_0x66c7('0x11')](function(_0x10b7d5){_0x50f3de(null,_0x10b7d5);})[_0x66c7('0x12')](function(_0x4310e6){_0x50f3de(_0x4310e6);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x84')]=function(_0x50e2f2,_0x32fb79){scripts[_0x66c7('0x84')](this[_0x66c7('0xc')],_0x50e2f2)['then'](function(_0x2cf267){_0x32fb79(null,_0x2cf267);})[_0x66c7('0x12')](function(_0x41ba9a){_0x32fb79(_0x41ba9a);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x85')]=function(_0x2e528e,_0x13d121){scripts[_0x66c7('0x85')](_0x2e528e['key'],_0x2e528e[_0x66c7('0x5d')],_0x2e528e[_0x66c7('0x86')]||_0x66c7('0x5f'),_0x2e528e[_0x66c7('0x87')])[_0x66c7('0x11')](function(_0x39f425){_0x13d121(null,_0x39f425);})['catch'](function(_0x475272){_0x13d121(_0x475272);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x88')]=function(_0x223ab1,_0x12085a,_0x14608f){scripts[_0x66c7('0x88')](_0x12085a,_0x223ab1[_0x66c7('0x7e')],_0x223ab1['ispeech_asr_language']||_0x66c7('0x5f'),this[_0x66c7('0x89')](_0x223ab1[_0x66c7('0x8a')])?_0x223ab1['model']:undefined)[_0x66c7('0x11')](function(_0x2f0bf0){_0x14608f(null,_0x2f0bf0);})[_0x66c7('0x12')](function(_0x3dd1f5){_0x14608f(_0x3dd1f5);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x8b')]=function(_0x108a52,_0x4c2f20){scripts[_0x66c7('0x8b')](_0x108a52['aws_access_key_id'],_0x108a52['aws_secret_access_key'],_0x108a52['aws_polly_region'],_0x108a52['aws_polly_voice']||_0x66c7('0x8c'),_0x108a52[_0x66c7('0x5d')],_0x108a52['aws_text_type']||'text')[_0x66c7('0x11')](function(_0xd733d1){_0x4c2f20(null,_0xd733d1);})['catch'](function(_0x4fdce4){_0x4c2f20(_0x4fdce4);});};AGIVertices[_0x66c7('0x13')]['awsLex']=function(_0x564f39,_0x917faf){scripts[_0x66c7('0x8d')](this['channel'][_0x66c7('0x35')],_0x564f39[_0x66c7('0x8e')],_0x564f39[_0x66c7('0x8f')],_0x564f39[_0x66c7('0x90')],_0x564f39[_0x66c7('0x5d')],_0x564f39[_0x66c7('0x91')])[_0x66c7('0x11')](function(_0x41bc8d){_0x917faf(null,_0x41bc8d);})[_0x66c7('0x12')](function(_0x491146){_0x917faf(_0x491146);});};AGIVertices[_0x66c7('0x13')]['googleASR']=function(_0x364168,_0x2ff10b,_0x500bc1){scripts[_0x66c7('0x92')](_0x2ff10b,_0x364168[_0x66c7('0x7e')],_0x364168[_0x66c7('0x93')]||_0x66c7('0x5f'))[_0x66c7('0x11')](function(_0x5d575e){_0x500bc1(null,_0x5d575e);})[_0x66c7('0x12')](function(_0x5c463c){_0x500bc1(_0x5c463c);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x94')]=function(_0x2eda7a,_0x368abf,_0x389d62){scripts[_0x66c7('0x94')](_0x368abf,_0x2eda7a[_0x66c7('0x95')],_0x2eda7a['appsecret'],_0x2eda7a['uri'])[_0x66c7('0x11')](function(_0x4f5494){_0x389d62(null,_0x4f5494);})['catch'](function(_0x4cc48d){_0x389d62(_0x4cc48d);});};AGIVertices[_0x66c7('0x13')]['clear']=function(_0x30f8d8){var _0x6dac20=_[_0x66c7('0x69')](verticesWithRetry,_0x30f8d8['agicommand'])?_0x30f8d8:_[_0x66c7('0x96')](_0x30f8d8);for(var _0x5376d7 in _0x6dac20){if(_0x6dac20[_0x66c7('0x97')](_0x5376d7)){if(_0x6dac20[_0x5376d7]&&_['isString'](_0x6dac20[_0x5376d7])){if(_[_0x66c7('0x69')](recursiveMapAttributes,_0x5376d7)){_0x6dac20[_0x5376d7]=this[_0x66c7('0x98')](_0x6dac20[_0x5376d7]);}else{_0x6dac20[_0x5376d7]=this[_0x66c7('0x99')](_0x6dac20[_0x5376d7]);}}}}return _0x6dac20;};AGIVertices[_0x66c7('0x13')][_0x66c7('0x9a')]=function(_0x18f46f){for(var _0x1912a6 in _0x18f46f){if(_0x18f46f['hasOwnProperty'](_0x1912a6)){if(_[_0x66c7('0x9b')](_0x18f46f[_0x1912a6])){this['recursiveNodeIndex'](_0x18f46f[_0x1912a6]);}else if(_['isArray'](_0x18f46f[_0x1912a6])){for(var _0x36e332=0x0;_0x36e332<_0x18f46f[_0x1912a6][_0x66c7('0x9c')];_0x36e332++){this[_0x66c7('0x9a')](_0x18f46f[_0x1912a6][_0x36e332]);}}else if(_[_0x66c7('0x9d')](_0x18f46f[_0x1912a6])){_0x18f46f[_0x1912a6]=this[_0x66c7('0x99')](_0x18f46f[_0x1912a6]);}}}};AGIVertices[_0x66c7('0x13')][_0x66c7('0x9e')]=function(_0x2d06a0,_0x30c228){for(var _0x73399 in _0x2d06a0){if(_0x2d06a0[_0x66c7('0x97')](_0x73399)){if(_[_0x66c7('0x9b')](_0x2d06a0[_0x73399])){if(!_[_0x66c7('0x43')](_0x2d06a0[_0x73399])){this['saveRestApiResult'](_0x2d06a0[_0x73399],util[_0x66c7('0x28')]('%s.%s',_0x30c228,_0x73399));}}else if(_[_0x66c7('0x9f')](_0x2d06a0[_0x73399])){for(var _0x225b6d=0x0;_0x225b6d<_0x2d06a0[_0x73399][_0x66c7('0x9c')];_0x225b6d++){this[_0x66c7('0x9e')](_0x2d06a0[_0x73399][_0x225b6d],util[_0x66c7('0x28')](_0x66c7('0xa0'),_0x30c228,_0x73399+'['+_0x225b6d+']'));}}else{if(!_['isNil'](_0x2d06a0[_0x73399])){this['channel']['setVariable'](util['format']('%s.%s',_0x30c228,_0x73399),_0x2d06a0[_0x73399]);}}}}};AGIVertices[_0x66c7('0x13')][_0x66c7('0x98')]=function(_0x11826c){try{var _0x315891=JSON['parse'](_0x11826c);this['recursiveNodeIndex'](_0x315891);return JSON[_0x66c7('0x75')](_0x315891);}catch(_0x2345be){return this['replaceAllVariables'](_0x11826c);}};AGIVertices[_0x66c7('0x13')][_0x66c7('0x99')]=function(_0x5a23c4){var _0x16965c=_0x5a23c4[_0x66c7('0xa1')]('{');for(var _0x1656be=0x1;_0x1656be<_0x16965c[_0x66c7('0x9c')];_0x1656be+=0x1){var _0x5c9135=_0x16965c[_0x1656be]['split']('}');if(_0x5c9135[_0x66c7('0x9c')]>0x1){_0x5a23c4=_0x5a23c4[_0x66c7('0xa2')]('{'+_0x5c9135[0x0]+'}',this[_0x66c7('0xc')][_0x66c7('0xf')](_0x5c9135[0x0])[_0x66c7('0xa3')]||_0x5c9135[0x0]);}}if(_0x16965c[_0x66c7('0x9c')]===0x1){return _0x5a23c4[_0x66c7('0x4a')]();}return this[_0x66c7('0x99')](_0x5a23c4);};AGIVertices[_0x66c7('0x13')][_0x66c7('0xa4')]=function(_0x487240,_0xf9c623){var _0x27b7f0=this[_0x66c7('0xc')][_0x66c7('0xf')](_0x487240);if(_0x27b7f0[_0x66c7('0xa5')]===-0x1){return _0x27b7f0;}logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0xa6'),_0xf9c623,_0x27b7f0[_0x66c7('0xa3')]));return this[_0x66c7('0xc')]['setVariable'](_0xf9c623,_0x27b7f0[_0x66c7('0xa3')]);};AGIVertices[_0x66c7('0x13')][_0x66c7('0x89')]=function(_0x42ef4c){return _0x42ef4c&&_0x42ef4c!=='0'&&_0x42ef4c!=='-1'&&_0x42ef4c!=='';};AGIVertices[_0x66c7('0x13')][_0x66c7('0xa7')]=function(_0x27a72a){this[_0x66c7('0xa8')]['sync'](this,_0x27a72a,'-');_0x27a72a[_0x66c7('0xa9')]=_0x27a72a[_0x66c7('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x66c7('0x13')][_0x66c7('0xaa')]=function(_0x13477f){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0xab'),_0x13477f[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x13477f[_0x66c7('0x5d')])){return this[_0x66c7('0xc')]['noop']('no\x20text\x20configured');}var _0x441eec='\x22'+_0x13477f[_0x66c7('0x5d')]+'\x22';if(this[_0x66c7('0x89')](_0x13477f[_0x66c7('0x7c')])){_0x441eec+=','+_0x13477f[_0x66c7('0x7c')];}var _0x1bd0bd=this[_0x66c7('0xc')][_0x66c7('0x57')]('MRCPSynth',_0x441eec);if(_0x1bd0bd[_0x66c7('0xa5')]===-0x1){return _0x1bd0bd;}return this[_0x66c7('0xc')]['noop'](util[_0x66c7('0x28')](_0x66c7('0xac'),_0x441eec));};AGIVertices[_0x66c7('0x13')][_0x66c7('0xad')]=function(_0x5c97da){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0xae'),_0x5c97da[_0x66c7('0x36')]));if(!this['isConfigured'](_0x5c97da['grammar'])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xb0'));}var _0x3723e9=_0x5c97da[_0x66c7('0xb1')];if(this[_0x66c7('0x89')](_0x5c97da['options'])){_0x3723e9+=','+_0x5c97da[_0x66c7('0x7c')];}var _0x20c734=this[_0x66c7('0xc')][_0x66c7('0x57')]('MRCPRecog',_0x3723e9);if(_0x20c734[_0x66c7('0xa5')]===-0x1){return _0x20c734;}var _0x4b01ee=this[_0x66c7('0xa4')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x4b01ee[_0x66c7('0xa5')]===-0x1){return _0x4b01ee;}var _0x159d6f=this['getAndSetVariable']('RECOG_INPUT()',_0x66c7('0xb2'));if(_0x159d6f['result']===-0x1){return _0x159d6f;}var _0x4284f5=this[_0x66c7('0xa4')](_0x66c7('0xb3'),_0x66c7('0xb4'));if(_0x4284f5['result']===-0x1){return _0x4284f5;}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xb5'),_0x3723e9));};AGIVertices[_0x66c7('0x13')]['agi']=function(_0x516d7c){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0xb6'),_0x516d7c[_0x66c7('0x36')]));return this[_0x66c7('0xc')]['agi']([_0x516d7c[_0x66c7('0xb7')],_0x516d7c[_0x66c7('0xb8')]]);};AGIVertices[_0x66c7('0x13')][_0x66c7('0xb9')]=function(_0xf71059){logger['info'](util['format'](_0x66c7('0xba'),_0xf71059[_0x66c7('0x36')]));if(this['isConfigured'](_0xf71059[_0x66c7('0x67')])){logger['info'](util[_0x66c7('0x28')](_0x66c7('0xbb'),_0xf71059[_0x66c7('0x67')]));var _0x4dc210=this[_0x66c7('0xc')]['wait'](_0xf71059[_0x66c7('0x67')]);if(_0x4dc210['result']===-0x1){return _0x4dc210;}}return this[_0x66c7('0xc')][_0x66c7('0xb9')]();};AGIVertices[_0x66c7('0x13')][_0x66c7('0x49')]=function(_0x5ceda2){logger[_0x66c7('0x30')](util[_0x66c7('0x28')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x5ceda2[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x5ceda2['list_id'])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x5ceda2,_0x66c7('0xbc'));}_0x5ceda2[_0x66c7('0x48')]=moment();if(this['isConfigured'](_0x5ceda2['delay'])){_0x5ceda2[_0x66c7('0x48')]=moment()['add'](_0x5ceda2[_0x66c7('0xbd')],_0x66c7('0xbe'));}if(!this['isConfigured'](_0x5ceda2[_0x66c7('0xbf')])){_0x5ceda2['callback_priority']=0x2;}this[_0x66c7('0x42')][_0x66c7('0x72')](this,_0x5ceda2);return this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0xc0'),_0x5ceda2[_0x66c7('0x46')],_0x5ceda2['list_id'],_0x5ceda2[_0x66c7('0x48')]));};AGIVertices[_0x66c7('0x13')][_0x66c7('0xc1')]=function(_0x158887){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0xc2'),_0x158887[_0x66c7('0x36')]));var _0x171847=this[_0x66c7('0xc')][_0x66c7('0x57')](_0x158887[_0x66c7('0xc3')],_0x158887[_0x66c7('0x7c')]);if(_0x171847[_0x66c7('0xa5')]===-0x1){return _0x171847;}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0xc4'),_0x158887['application'],_0x158887['options']));};AGIVertices[_0x66c7('0x13')][_0x66c7('0xc5')]=function(_0x4d7b1d){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0xc6'),_0x4d7b1d[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x4d7b1d['text'])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xc7'));}var _0x600d2b='\x22'+_0x4d7b1d[_0x66c7('0x5d')]+'\x22';if(this[_0x66c7('0x89')](_0x4d7b1d['options'])){_0x600d2b+=','+_0x4d7b1d[_0x66c7('0x7c')];}var _0x598212=this[_0x66c7('0xc')]['exec'](_0x66c7('0xc8'),_0x600d2b);if(_0x598212[_0x66c7('0xa5')]===-0x1){return _0x598212;}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x600d2b));};AGIVertices[_0x66c7('0x13')][_0x66c7('0xc9')]=function(_0x23a56e){logger['info'](util[_0x66c7('0x28')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x23a56e[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x23a56e['text'])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xc7'));}var _0x550ea1='\x22'+_0x23a56e[_0x66c7('0x5d')]+'\x22';if(this[_0x66c7('0x89')](_0x23a56e[_0x66c7('0x7c')])){_0x550ea1+=','+_0x23a56e['options'];}var _0x56b097=this[_0x66c7('0xc')]['exec'](_0x66c7('0xc8'),_0x550ea1);if(_0x56b097[_0x66c7('0xa5')]===-0x1){return _0x56b097;}return this['channel'][_0x66c7('0xaf')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x550ea1));};AGIVertices[_0x66c7('0x13')][_0x66c7('0xca')]=function(_0x36a108){logger['info'](util[_0x66c7('0x28')](_0x66c7('0xcb'),_0x36a108[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x36a108[_0x66c7('0xb1')])){return this['channel'][_0x66c7('0xaf')](_0x66c7('0xb0'));}var _0x2462c6=_0x36a108['grammar'];if(this[_0x66c7('0x89')](_0x36a108['options'])){_0x2462c6+=','+_0x36a108[_0x66c7('0x7c')];}var _0x26894a=this[_0x66c7('0xc')][_0x66c7('0x57')](_0x66c7('0xcc'),_0x2462c6);if(_0x26894a[_0x66c7('0xa5')]===-0x1){return _0x26894a;}var _0x528b69=this[_0x66c7('0xa4')](_0x66c7('0xcd'),'LUMENVOX_ASR_CONFIDENCE');if(_0x528b69[_0x66c7('0xa5')]===-0x1){return _0x528b69;}var _0x449670=this[_0x66c7('0xa4')](_0x66c7('0xce'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x449670[_0x66c7('0xa5')]===-0x1){return _0x449670;}var _0x10a682=this['getAndSetVariable']('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x10a682[_0x66c7('0xa5')]===-0x1){return _0x10a682;}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xb5'),_0x2462c6));};AGIVertices[_0x66c7('0x13')]['sestekasr']=function(_0xc7ee91){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0xcf'),_0xc7ee91[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0xc7ee91[_0x66c7('0xb1')])){return this['channel'][_0x66c7('0xaf')]('no\x20grammar\x20configured');}var _0x116477=_0xc7ee91[_0x66c7('0xb1')];if(this['isConfigured'](_0xc7ee91[_0x66c7('0x7c')])){_0x116477+=','+_0xc7ee91[_0x66c7('0x7c')];}var _0x271a11=this['channel'][_0x66c7('0x57')](_0x66c7('0xcc'),_0x116477);if(_0x271a11[_0x66c7('0xa5')]===-0x1){return _0x271a11;}var _0x26551d=this[_0x66c7('0xa4')]('RECOG_CONFIDENCE()',_0x66c7('0xd0'));if(_0x26551d[_0x66c7('0xa5')]===-0x1){return _0x26551d;}var _0x17ea56=this[_0x66c7('0xa4')]('RECOG_INPUT()',_0x66c7('0xd1'));if(_0x17ea56[_0x66c7('0xa5')]===-0x1){return _0x17ea56;}var _0x3cec33=this['getAndSetVariable']('RECOG_INSTANCE()',_0x66c7('0xd2'));if(_0x3cec33[_0x66c7('0xa5')]===-0x1){return _0x3cec33;}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xb5'),_0x116477));};AGIVertices[_0x66c7('0x13')][_0x66c7('0xd3')]=function(_0x54785){logger[_0x66c7('0x30')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x54785[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x54785[_0x66c7('0xd4')])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x54785,_0x66c7('0xd5'));}var _0x2ab139=this['getSquareOdbc']['sync'](this,_0x54785[_0x66c7('0xd4')]);if(!_0x2ab139){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x54785,_0x66c7('0xd6'));}if(!this[_0x66c7('0x89')](_0x54785[_0x66c7('0x2e')])){return this[_0x66c7('0xc')]['error'](_0x54785,_0x66c7('0xd7'));}var _0x471565=_0x54785[_0x66c7('0x2e')][_0x66c7('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xd8'),_0x471565));var _0x2a6ca3=this['getQueryOdbc'][_0x66c7('0x72')](this,_0x2ab139,_0x471565);this[_0x66c7('0xa8')]['sync'](this,_0x54785,_0x471565);if(!this[_0x66c7('0x89')](_0x54785[_0x66c7('0xd9')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xda'));}var _0x17389b=this['getVariable'][_0x66c7('0x72')](this,_0x54785['variable_id']);if(!_0x17389b){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x54785,_0x66c7('0xdb'));}var _0x247bc1=this;_0x2a6ca3[_0x66c7('0xdc')](function(_0x4ca682,_0x21074d){Object[_0x66c7('0xdd')](_0x4ca682)[_0x66c7('0xdc')](function(_0xb81e87){_0x247bc1[_0x66c7('0xc')]['setVariable'](util[_0x66c7('0x28')](_0x66c7('0xde'),_0x17389b,_0x21074d,_0xb81e87),_0x4ca682[_0xb81e87]);});});this[_0x66c7('0xc')]['setVariable'](util[_0x66c7('0x28')](_0x66c7('0xdf'),_0x17389b),_0x2a6ca3[_0x66c7('0x9c')]);return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xe0'),_0x17389b));};AGIVertices['prototype'][_0x66c7('0xe1')]=function(_0x2b2a0d){logger[_0x66c7('0xe2')](util[_0x66c7('0x28')](_0x66c7('0xe3'),_0x2b2a0d['label']));if(!this['isConfigured'](_0x2b2a0d[_0x66c7('0xe4')])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x2b2a0d,'no\x20user\x20selected');}var _0x2440de=this[_0x66c7('0x1a')][_0x66c7('0x72')](this,_0x2b2a0d[_0x66c7('0xe4')]);if(!_0x2440de){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x2b2a0d,_0x66c7('0xe5'));}var _0x4dea9c=this['channel'][_0x66c7('0x57')](_0x66c7('0xe6'),[util['format'](_0x66c7('0xe7'),_0x2440de),_0x2b2a0d[_0x66c7('0x67')],_0x2b2a0d[_0x66c7('0xe8')],_0x2b2a0d[_0x66c7('0x66')]]);if(_0x4dea9c['result']===-0x1){return _0x4dea9c;}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0xe9'),_0x66c7('0xe6')));};AGIVertices[_0x66c7('0x13')]['dialogflow']=function(_0x27590a){logger['info'](util['format'](_0x66c7('0xea'),_0x27590a[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x27590a[_0x66c7('0x7e')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xeb'));}if(!this[_0x66c7('0x89')](_0x27590a[_0x66c7('0x5d')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xc7'));}this[_0x66c7('0xc')]['bot']=!![];this[_0x66c7('0xa8')](_0x27590a);this[_0x66c7('0x41')](_0x27590a[_0x66c7('0x5d')],'in','','');this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xec'),_0x27590a['text']));var _0x2beba7=this[_0x66c7('0x7d')][_0x66c7('0x72')](this,_0x27590a);if(_0x2beba7){for(var _0x11f42d in _0x2beba7){if(_0x2beba7[_0x66c7('0x97')](_0x11f42d)){this[_0x66c7('0xc')][_0x66c7('0xed')](util[_0x66c7('0x28')](_0x66c7('0xee'),_0x11f42d[_0x66c7('0x6d')]()),_0x2beba7[_0x11f42d]);}}this[_0x66c7('0x41')](_0x2beba7['speech'],_0x66c7('0xef'),_0x66c7('0xf0'),'');return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xf1'),_0x2beba7['speech']));}return this[_0x66c7('0xc')]['error'](_0x27590a,_0x66c7('0xf2'));};AGIVertices[_0x66c7('0x13')][_0x66c7('0xf3')]=function(_0x45db08){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0xf4'),_0x45db08[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x45db08[_0x66c7('0x81')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xf5'));}if(!this[_0x66c7('0x89')](_0x45db08[_0x66c7('0x82')])){return this['channel']['noop'](_0x66c7('0xf6'));}if(!this['isConfigured'](_0x45db08['private_key'])){return this['channel'][_0x66c7('0xaf')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x45db08['dialogflowV2_language'])){return this['channel']['noop'](_0x66c7('0xf7'));}if(!this[_0x66c7('0x89')](_0x45db08[_0x66c7('0x5d')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xc7'));}this[_0x66c7('0xc')]['bot']=!![];this['createSquareDetailsReport'](_0x45db08);this[_0x66c7('0x41')](_0x45db08[_0x66c7('0x5d')],'in','','');this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xf8'),_0x45db08[_0x66c7('0x5d')]));var _0x55a4e2=this[_0x66c7('0x80')][_0x66c7('0x72')](this,_0x45db08);if(_0x55a4e2){for(var _0x46ce44 in _0x55a4e2){if(_0x55a4e2[_0x66c7('0x97')](_0x46ce44)){if(_0x46ce44!==_0x66c7('0xf9')){this['channel'][_0x66c7('0xed')](util[_0x66c7('0x28')]('DIALOGFLOW_%s',_0x46ce44[_0x66c7('0x6d')]()),_0x55a4e2[_0x46ce44]);}}}this[_0x66c7('0x41')](_0x55a4e2[_0x66c7('0xfa')],_0x66c7('0xef'),_0x66c7('0xf3'),_0x55a4e2['providerResponse']);return this['channel'][_0x66c7('0xaf')](util['format'](_0x66c7('0xfb'),_0x55a4e2[_0x66c7('0xfa')]));}return this['channel'][_0x66c7('0x2c')](_0x45db08,_0x66c7('0xfc'));};AGIVertices[_0x66c7('0x13')][_0x66c7('0xfd')]=function(_0x579ae3){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0xfe'),_0x579ae3['label']));if(!this['isConfigured'](_0x579ae3['ndauth_url'])){return this[_0x66c7('0xc')][_0x66c7('0xaf')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x66c7('0x89')](_0x579ae3[_0x66c7('0xff')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0x100'));}if(!this[_0x66c7('0x89')](_0x579ae3[_0x66c7('0x101')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0x102'));}if(!this['isConfigured'](_0x579ae3[_0x66c7('0x103')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')]('no\x20text\x20configured');}this[_0x66c7('0xc')]['bot']=!![];this[_0x66c7('0xa8')](_0x579ae3);this[_0x66c7('0x41')](_0x579ae3[_0x66c7('0x5d')],'in','','');this['channel'][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x104'),_0x579ae3['text']));var _0x3743c3=this[_0x66c7('0x84')]['sync'](this,_0x579ae3);if(_0x3743c3){for(var _0x4df4ee in _0x3743c3){if(_0x3743c3[_0x66c7('0x97')](_0x4df4ee)){this['channel'][_0x66c7('0xed')](util[_0x66c7('0x28')](_0x66c7('0x105'),_0x4df4ee[_0x66c7('0x6d')]()),_0x3743c3[_0x4df4ee]);}}this[_0x66c7('0x41')](_0x3743c3[_0x66c7('0xfa')],_0x66c7('0xef'),_0x66c7('0xfd'),'');if(_0x3743c3[_0x66c7('0x106')]){this[_0x66c7('0xc')]['noop'](util['format'](_0x66c7('0x107'),_0x3743c3['audiofile']));var _0x5684e9=this[_0x66c7('0xc')][_0x66c7('0x108')](_0x3743c3[_0x66c7('0x106')]);try{fs[_0x66c7('0x109')](_0x3743c3[_0x66c7('0x106')]+_0x66c7('0x10a'));}catch(_0x29c394){logger[_0x66c7('0x2c')](_0x29c394);}return _0x5684e9;}else{return this['channel'][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x10b'),_0x3743c3[_0x66c7('0xfa')]));}}return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x579ae3,_0x66c7('0x10c'));};AGIVertices[_0x66c7('0x13')]['end']=function(_0x112f27){logger[_0x66c7('0x30')](util[_0x66c7('0x28')]('Enter\x20in\x20END\x20(%s)\x20block',_0x112f27[_0x66c7('0x36')]));return this['channel'][_0x66c7('0xaf')](_0x66c7('0x10d'));};AGIVertices[_0x66c7('0x13')][_0x66c7('0x10e')]=function(_0x3625ea){logger[_0x66c7('0x30')](util['format'](_0x66c7('0x10f'),_0x3625ea[_0x66c7('0x36')]));var _0x2aec90='';if(_0x3625ea[_0x66c7('0x110')]){if(!this[_0x66c7('0x89')](_0x3625ea[_0x66c7('0x110')])){return this[_0x66c7('0xc')]['error'](_0x3625ea,_0x66c7('0x111'));}else{var _0x3b155e=parseInt(_0x3625ea[_0x66c7('0x110')],0xa);if(isNaN(_0x3b155e)){_0x2aec90=_0x3625ea[_0x66c7('0x110')];}else{_0x2aec90=this[_0x66c7('0x1b')][_0x66c7('0x72')](this,_0x3625ea[_0x66c7('0x110')]);if(!_0x2aec90){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x3625ea,_0x66c7('0x112'));}}}}else if(_0x3625ea[_0x66c7('0x113')]){_0x2aec90=_0x3625ea['trunk_name'];}else{return this[_0x66c7('0xc')]['error'](_0x3625ea,'no\x20trunk\x20selected');}var _0x2fc5f4=this[_0x66c7('0xc')][_0x66c7('0x57')](_0x66c7('0xe6'),[util[_0x66c7('0x28')](_0x66c7('0x114'),_0x2aec90,_0x3625ea[_0x66c7('0x46')]),_0x3625ea[_0x66c7('0x67')],_0x3625ea['opts'],_0x3625ea[_0x66c7('0x66')]]);if(_0x2fc5f4[_0x66c7('0xa5')]===-0x1){return _0x2fc5f4;}return this['channel'][_0x66c7('0xaf')](util[_0x66c7('0x28')]('Executed\x20command\x20%s',_0x66c7('0xe6')));};AGIVertices[_0x66c7('0x13')][_0x66c7('0x115')]=function(_0x3e831c){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x116'),_0x3e831c[_0x66c7('0x36')]));return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0x115'));};AGIVertices[_0x66c7('0x13')][_0x66c7('0xa')]=function(_0x2f2e94){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x117'),_0x2f2e94[_0x66c7('0x36')]));if(_0x2f2e94[_0x66c7('0xa9')]===0x0){return this[_0x66c7('0xa7')](_0x2f2e94);}_0x2f2e94[_0x66c7('0xa9')]-=0x1;if(!this[_0x66c7('0x89')](_0x2f2e94[_0x66c7('0x118')])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x2f2e94,'no\x20file\x20audio\x20selected');}var _0x4aa471=this[_0x66c7('0x1d')][_0x66c7('0x72')](this,_0x2f2e94[_0x66c7('0x118')]);if(!_0x4aa471){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x2f2e94,_0x66c7('0x119'));}if(!this[_0x66c7('0x89')](_0x2f2e94[_0x66c7('0xd9')])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x66c7('0xda'));}var _0x57e9ba=this[_0x66c7('0xc')][_0x66c7('0x11a')](_0x4aa471,_0x2f2e94[_0x66c7('0x11b')],_0x2f2e94[_0x66c7('0x11c')]);var _0x24ba0d=_0x57e9ba['result']?_0x57e9ba['result'][_0x66c7('0x4a')]():'';logger[_0x66c7('0x30')]('test',JSON[_0x66c7('0x75')](_0x57e9ba));if(_0x57e9ba[_0x66c7('0xa5')]===-0x1){this[_0x66c7('0xa8')]['sync'](this,_0x2f2e94,_0x24ba0d);return _0x57e9ba;}else if(_0x57e9ba[_0x66c7('0xa3')]==='timeout'){_0x57e9ba[_0x66c7('0xa5')]=_0x24ba0d['length']>=parseInt(_0x2f2e94[_0x66c7('0x11d')])?'x':'i';}else{_0x57e9ba[_0x66c7('0xa5')]=_0x24ba0d[_0x66c7('0x9c')]>=parseInt(_0x2f2e94['mindigit'])&&_0x24ba0d[_0x66c7('0x9c')]<=parseInt(_0x2f2e94[_0x66c7('0x11c')])?'x':'i';}var _0x2ff094=this[_0x66c7('0xf')][_0x66c7('0x72')](this,_0x2f2e94['variable_id']);if(!_0x2ff094){return this['channel'][_0x66c7('0x2c')](_0x2f2e94,'no\x20variable\x20found');}this[_0x66c7('0xc')][_0x66c7('0xed')](_0x2ff094,_0x24ba0d);if(this[_0x66c7('0x89')](_0x2f2e94['hiddendigitsnum'])){var _0x405737=parseInt(_0x2f2e94[_0x66c7('0x11e')],0xa);var _0xb321a=rs['generate']({'charset':'*','length':_0x405737});var _0x54bfeb=_0x24ba0d[_0x66c7('0x9c')];if(_0x54bfeb>0x0){if(_0x54bfeb>_0x405737){this[_0x66c7('0xa8')][_0x66c7('0x72')](this,_0x2f2e94,_0x2f2e94[_0x66c7('0x11f')]===_0x66c7('0x120')?_0xb321a+_0x24ba0d[_0x66c7('0x121')](_0x405737):_0x24ba0d['substr'](0x0,_0x54bfeb-_0x405737)+_0xb321a);}else{this['createSquareDetailsReport']['sync'](this,_0x2f2e94,rs[_0x66c7('0x122')]({'charset':'*','length':_0x54bfeb}));}}else{this[_0x66c7('0xa8')][_0x66c7('0x72')](this,_0x2f2e94,'');}}else{this[_0x66c7('0xa8')][_0x66c7('0x72')](this,_0x2f2e94,_0x24ba0d);}return _0x57e9ba;};AGIVertices[_0x66c7('0x13')][_0x66c7('0xb')]=function(_0x5b41d6){logger[_0x66c7('0x30')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x5b41d6[_0x66c7('0x36')]));return this[_0x66c7('0xa')](_0x5b41d6);};AGIVertices[_0x66c7('0x13')][_0x66c7('0x123')]=function(_0x84b174){logger[_0x66c7('0x30')](util['format'](_0x66c7('0x124'),_0x84b174[_0x66c7('0x36')]));this['createSquareDetailsReport']['sync'](this,_0x84b174,_0x84b174['goalname']);return this['channel'][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x125'),_0x84b174[_0x66c7('0x126')]));};AGIVertices['prototype']['awspolly']=function(_0x348a23){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x127'),_0x348a23[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x348a23[_0x66c7('0x8e')])||!this['isConfigured'](_0x348a23[_0x66c7('0x8f')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0x128'));}if(!this[_0x66c7('0x89')](_0x348a23[_0x66c7('0x5d')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')]('no\x20text\x20configured');}this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x129'),_0x348a23[_0x66c7('0x5d')]));var _0x2c8c07=this[_0x66c7('0x8b')][_0x66c7('0x72')](this,_0x348a23);if(_0x2c8c07){this['channel'][_0x66c7('0xaf')](util['format'](_0x66c7('0x12a'),_0x2c8c07));var _0x2a4c52=this[_0x66c7('0xc')][_0x66c7('0x108')](_0x2c8c07);try{fs[_0x66c7('0x109')](_0x2c8c07+_0x66c7('0x10a'));}catch(_0x39b70a){logger[_0x66c7('0x2c')](_0x39b70a);}return _0x2a4c52;}return this[_0x66c7('0xc')]['error'](_0x348a23,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype']['awslex']=function(_0x2f2848){logger[_0x66c7('0x30')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x2f2848[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x2f2848[_0x66c7('0x8e')])||!this['isConfigured'](_0x2f2848[_0x66c7('0x8f')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0x128'));}if(!this[_0x66c7('0x89')](_0x2f2848[_0x66c7('0x91')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0x12b'));}if(!this[_0x66c7('0x89')](_0x2f2848['text'])){return this['channel']['noop'](_0x66c7('0xc7'));}this[_0x66c7('0xc')][_0x66c7('0x12c')]=!![];this[_0x66c7('0xa8')](_0x2f2848);this[_0x66c7('0x41')](_0x2f2848[_0x66c7('0x5d')],'in','','');this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x12d'),_0x2f2848[_0x66c7('0x5d')]));var _0x32b1ba=this[_0x66c7('0x8d')][_0x66c7('0x72')](this,_0x2f2848);if(_0x32b1ba){for(var _0x5ca1e9 in _0x32b1ba){if(_0x32b1ba[_0x66c7('0x97')](_0x5ca1e9)&&_[_0x66c7('0x9d')](_0x32b1ba[_0x5ca1e9])){this[_0x66c7('0xc')][_0x66c7('0xed')](util[_0x66c7('0x28')](_0x66c7('0x12e'),_0x5ca1e9[_0x66c7('0x6d')]()),_0x32b1ba[_0x5ca1e9]);}}if(_[_0x66c7('0x4f')](_0x32b1ba['message'])){return this['channel'][_0x66c7('0xaf')](_0x66c7('0x12f'));}else{this[_0x66c7('0x41')](_0x32b1ba[_0x66c7('0x7a')],_0x66c7('0xef'),_0x66c7('0x130'),'');return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x131'),_0x32b1ba['message']));}}return this[_0x66c7('0xc')]['error'](_0x2f2848,_0x66c7('0x132'));};AGIVertices[_0x66c7('0x13')]['googleasr']=function(_0x3391db){logger['info'](util[_0x66c7('0x28')](_0x66c7('0x133'),_0x3391db[_0x66c7('0x36')],_0x3391db['timeout']));if(!this[_0x66c7('0x89')](_0x3391db[_0x66c7('0x7e')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xeb'));}var _0x325b37=_0x66c7('0x134');var _0x53c935=util[_0x66c7('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0x66c7('0x122')](0x4));var _0xc70e25=util[_0x66c7('0x28')](_0x66c7('0xa0'),_0x53c935,_0x325b37);var _0x14f9c7=!![];if(_0x3391db['beep']===_0x66c7('0x135')){_0x14f9c7=![];}var _0x293d71=this['channel'][_0x66c7('0x136')](_0x53c935,_0x325b37,_0x3391db[_0x66c7('0x137')],_0x3391db['timeout'],undefined,_0x14f9c7);if(_0x293d71[_0x66c7('0xa5')]!==-0x1){this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0x138'),_0xc70e25));var _0x4f94b0=this[_0x66c7('0x92')]['sync'](this,_0x3391db,_0xc70e25);if(_0x4f94b0){for(var _0x25126f in _0x4f94b0){if(_0x4f94b0[_0x66c7('0x97')](_0x25126f)){this[_0x66c7('0xc')][_0x66c7('0xed')](util[_0x66c7('0x28')](_0x66c7('0x139'),_0x25126f[_0x66c7('0x6d')]()),_0x4f94b0[_0x25126f]);}}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0x13a'),JSON['stringify'](_0x4f94b0)));}}return _0x293d71;};AGIVertices[_0x66c7('0x13')][_0x66c7('0x13b')]=function(_0x1df8ab){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x13c'),_0x1df8ab[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x1df8ab[_0x66c7('0x95')])){return this[_0x66c7('0xc')]['noop']('no\x20appid\x20configured');}if(!this[_0x66c7('0x89')](_0x1df8ab[_0x66c7('0x13d')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0x13e'));}var _0x536f27='wav';var _0xafc657=util[_0x66c7('0x28')](_0x66c7('0x13f'),FILES_PATH,rs[_0x66c7('0x122')](0x4));var _0x2bd854=util[_0x66c7('0x28')](_0x66c7('0xa0'),_0xafc657,_0x536f27);var _0x1bd88c=!![];if(_0x1df8ab[_0x66c7('0x140')]==='NOBEEP'){_0x1bd88c=![];}var _0x3ebf3a=this[_0x66c7('0xc')][_0x66c7('0x136')](_0xafc657,_0x536f27,_0x1df8ab[_0x66c7('0x137')],_0x1df8ab[_0x66c7('0x67')],undefined,_0x1bd88c);if(_0x3ebf3a[_0x66c7('0xa5')]!==-0x1){this['channel'][_0x66c7('0xaf')](util[_0x66c7('0x28')]('tilde\x20%s\x20file\x20created',_0x2bd854));var _0x34bd36=this[_0x66c7('0x94')][_0x66c7('0x72')](this,_0x1df8ab,_0x2bd854);if(_0x34bd36){for(var _0x4b96db in _0x34bd36){if(_0x34bd36['hasOwnProperty'](_0x4b96db)){this[_0x66c7('0xc')][_0x66c7('0xed')](util['format'](_0x66c7('0x141'),_0x4b96db[_0x66c7('0x6d')]()),_0x34bd36[_0x4b96db]);}}return this[_0x66c7('0xc')]['noop'](util[_0x66c7('0x28')](_0x66c7('0x142'),JSON[_0x66c7('0x75')](_0x34bd36)));}}return _0x3ebf3a;};AGIVertices['prototype'][_0x66c7('0x143')]=function(_0x4ed01d){logger['info'](util[_0x66c7('0x28')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4ed01d['label']));return this[_0x66c7('0xc')][_0x66c7('0x144')](_0x4ed01d[_0x66c7('0x3b')],_0x4ed01d['extension'],_0x4ed01d[_0x66c7('0x3d')]);};AGIVertices[_0x66c7('0x13')][_0x66c7('0x145')]=function(_0x2c4bcb){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x146'),_0x2c4bcb['label']));if(!this['isConfigured'](_0x2c4bcb['condition'])){return this['channel'][_0x66c7('0x2c')](_0x2c4bcb,'no\x20condition\x20configured');}try{var _0x4c9e56=eval(_0x2c4bcb['condition'])?_0x66c7('0x147'):_0x66c7('0x148');this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x2c4bcb[_0x66c7('0x149')],_0x4c9e56));return{'code':0xc8,'result':_0x4c9e56};}catch(_0x52b8a1){return{'code':0xc8,'result':_0x66c7('0x148')};}};AGIVertices[_0x66c7('0x13')][_0x66c7('0x14a')]=function(_0x49ad5e){logger['info'](util[_0x66c7('0x28')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x49ad5e[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x49ad5e[_0x66c7('0x14b')])){return this['channel'][_0x66c7('0x2c')](_0x49ad5e,'no\x20interval\x20configured');}var _0x4091a2=this[_0x66c7('0x23')][_0x66c7('0x72')](this,_0x49ad5e[_0x66c7('0x14b')]);if(!_0x4091a2){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x49ad5e,_0x66c7('0x14c'));}for(var _0x37fc4c=0x0;_0x37fc4c<_0x4091a2['length'];_0x37fc4c+=0x1){var _0x1ec1f9=this[_0x66c7('0xc')][_0x66c7('0xf')](util[_0x66c7('0x28')]('IFTIME(%s?true:false)',_0x4091a2[_0x37fc4c]));if(_0x1ec1f9[_0x66c7('0xa5')]===-0x1){return _0x1ec1f9;}logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x14d'),_0x4091a2[_0x37fc4c],_0x1ec1f9['extra']));if(_0x1ec1f9[_0x66c7('0xa3')]===_0x66c7('0x147')){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x14d'),_0x4091a2[_0x37fc4c],_0x66c7('0x147')));this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0x14d'),_0x4091a2[_0x37fc4c],'true'));return{'code':0xc8,'result':_0x66c7('0x147')};}else{logger['info'](util[_0x66c7('0x28')](_0x66c7('0x14d'),_0x4091a2[_0x37fc4c],_0x66c7('0x148')));this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0x14d'),_0x4091a2[_0x37fc4c],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x66c7('0x13')][_0x66c7('0x14e')]=function(_0x2f2e0){logger['info'](util[_0x66c7('0x28')](_0x66c7('0x14f'),_0x2f2e0[_0x66c7('0x36')]));return this['channel'][_0x66c7('0x14e')]();};AGIVertices['prototype'][_0x66c7('0x150')]=function(_0x544c80){logger[_0x66c7('0x30')](util[_0x66c7('0x28')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x544c80[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x544c80[_0x66c7('0x7e')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xeb'));}var _0x3ae46f=_0x66c7('0x134');var _0x46b948=util['format'](_0x66c7('0x13f'),FILES_PATH,rs[_0x66c7('0x122')](0x4));var _0x3d2d83=util[_0x66c7('0x28')](_0x66c7('0xa0'),_0x46b948,_0x3ae46f);var _0x8af33e=!![];if(_0x544c80[_0x66c7('0x140')]===_0x66c7('0x135')){_0x8af33e=![];}var _0x2bbbac=this['channel'][_0x66c7('0x136')](_0x46b948,_0x3ae46f,_0x544c80[_0x66c7('0x137')],_0x544c80[_0x66c7('0x67')],undefined,_0x8af33e);if(_0x2bbbac[_0x66c7('0xa5')]!==-0x1){this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x151'),_0x3d2d83));var _0x5c4ff4=this[_0x66c7('0x88')][_0x66c7('0x72')](this,_0x544c80,_0x3d2d83);if(_0x5c4ff4){for(var _0x107744 in _0x5c4ff4){if(_0x5c4ff4['hasOwnProperty'](_0x107744)){this[_0x66c7('0xc')]['setVariable'](util[_0x66c7('0x28')]('ISPEECH_ASR_%s',_0x107744['toUpperCase']()),_0x5c4ff4[_0x107744]);}}return this['channel'][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x152'),JSON[_0x66c7('0x75')](_0x5c4ff4)));}}return _0x2bbbac;};AGIVertices['prototype'][_0x66c7('0x153')]=function(_0x26a71a){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x154'),_0x26a71a[_0x66c7('0x36')]));if(!this['isConfigured'](_0x26a71a['key'])){return this[_0x66c7('0xc')][_0x66c7('0xaf')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x26a71a[_0x66c7('0x5d')])){return this[_0x66c7('0xc')]['noop'](_0x66c7('0xc7'));}this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x155'),_0x26a71a[_0x66c7('0x5d')]));var _0x1aa4a4=this[_0x66c7('0x85')][_0x66c7('0x72')](this,_0x26a71a);if(_0x1aa4a4){this[_0x66c7('0xc')]['noop'](util['format'](_0x66c7('0x151'),_0x1aa4a4));var _0x3a52f4=this['channel'][_0x66c7('0x108')](_0x1aa4a4,_0x26a71a[_0x66c7('0x137')]);try{fs['unlink'](_0x1aa4a4+'.wav');}catch(_0x588eeb){logger[_0x66c7('0x2c')](_0x588eeb);}return _0x3a52f4;}return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x26a71a,_0x66c7('0x156'));};AGIVertices[_0x66c7('0x13')][_0x66c7('0x157')]=function(_0x2c89b9){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x158'),_0x2c89b9['label']));if(!this[_0x66c7('0x89')](_0x2c89b9['findBy'])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x2c89b9,_0x66c7('0x159'));}logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x15a'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x2c89b9['findBy']));var _0x1b7747=this[_0x66c7('0x52')][_0x66c7('0x72')](this,_0x2c89b9[_0x66c7('0x15b')]);if(_0x1b7747){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x15c'),this['channel']['callerid'],_0x2c89b9[_0x66c7('0x15b')]));this[_0x66c7('0xc')]['noop'](util[_0x66c7('0x28')](_0x66c7('0x15c'),this[_0x66c7('0xc')]['callerid'],_0x2c89b9[_0x66c7('0x15b')]));return{'code':0xc8,'result':_0x66c7('0x15d')};}else{logger[_0x66c7('0x30')](util['format'](_0x66c7('0x15e'),this[_0x66c7('0xc')]['callerid'],_0x2c89b9[_0x66c7('0x15b')]));this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0x15e'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x2c89b9[_0x66c7('0x15b')]));return{'code':0xc8,'result':_0x66c7('0x15f')};}};AGIVertices[_0x66c7('0x13')][_0x66c7('0x160')]=function(_0x55e486){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x161'),_0x55e486[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x55e486[_0x66c7('0x15b')])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x55e486,_0x66c7('0x159'));}logger['info'](util[_0x66c7('0x28')](_0x66c7('0x15a'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x55e486['findBy']));var _0x8b4d2e=this[_0x66c7('0x51')][_0x66c7('0x72')](this,_0x55e486[_0x66c7('0x15b')]);if(_0x8b4d2e){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x15c'),this['channel'][_0x66c7('0x39')],_0x55e486['findBy']));this['channel']['noop'](util[_0x66c7('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x66c7('0xc')][_0x66c7('0x39')],_0x55e486[_0x66c7('0x15b')]));return{'code':0xc8,'result':_0x66c7('0x15d')};}else{logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x15e'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x55e486[_0x66c7('0x15b')]));this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x66c7('0xc')][_0x66c7('0x39')],_0x55e486[_0x66c7('0x15b')]));return{'code':0xc8,'result':_0x66c7('0x15f')};}};AGIVertices['prototype'][_0x66c7('0x162')]=function(_0x406793){logger[_0x66c7('0x30')](util[_0x66c7('0x28')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x406793[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x406793[_0x66c7('0x163')])){return this['channel']['error'](_0x406793,_0x66c7('0x164'));}this[_0x66c7('0xc')]['noop'](util['format'](_0x66c7('0x165'),_0x406793[_0x66c7('0x163')]));var _0xd0e9c8=eval(_0x406793[_0x66c7('0x163')]);if(!this[_0x66c7('0x89')](_0x406793[_0x66c7('0xd9')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x40673b=this[_0x66c7('0xf')][_0x66c7('0x72')](this,_0x406793[_0x66c7('0xd9')]);if(!_0x40673b){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x406793,_0x66c7('0xdb'));}if(_[_0x66c7('0x9f')](_0xd0e9c8)){var _0x3ef1e1=this;_0xd0e9c8[_0x66c7('0xdc')](function(_0x23e807,_0x41c973){_0x3ef1e1[_0x66c7('0xc')][_0x66c7('0xed')](util[_0x66c7('0x28')](_0x66c7('0x166'),_0x40673b,_0x41c973),_0x23e807);});return this[_0x66c7('0xc')]['noop'](util[_0x66c7('0x28')](_0x66c7('0x167'),_0x40673b));}else{return this[_0x66c7('0xc')]['setVariable'](_0x40673b,_0xd0e9c8);}};AGIVertices[_0x66c7('0x13')][_0x66c7('0x168')]=function(_0x4792b3){logger[_0x66c7('0x30')](util[_0x66c7('0x28')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x4792b3['label']));if(_0x4792b3[_0x66c7('0xa9')]===0x0){return this['maxRetry'](_0x4792b3);}_0x4792b3[_0x66c7('0xa9')]-=0x1;if(!this['isConfigured'](_0x4792b3[_0x66c7('0x118')])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x4792b3,_0x66c7('0x169'));}var _0x51934e=this[_0x66c7('0x1d')]['sync'](this,_0x4792b3[_0x66c7('0x118')]);if(!_0x51934e){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x4792b3,_0x66c7('0x119'));}var _0x3c575b=this[_0x66c7('0xc')][_0x66c7('0x11a')](_0x51934e,_0x4792b3[_0x66c7('0x11b')],_0x4792b3[_0x66c7('0x16a')]);var _0x28255a=_0x3c575b[_0x66c7('0xa5')];if(_0x3c575b[_0x66c7('0xa5')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x4792b3,'-1');return _0x3c575b;}else if(_0x3c575b['extra']===_0x66c7('0x67')){_0x3c575b[_0x66c7('0xa5')]=_0x3c575b['result'][_0x66c7('0x9c')]>0x0?_0x3c575b[_0x66c7('0xa5')]:'t';}else if(_[_0x66c7('0x43')](_0x3c575b['result'])){_0x3c575b['result']='#';_0x28255a='#';}if(!this[_0x66c7('0x89')](_0x4792b3[_0x66c7('0xd9')])){this['channel']['noop'](_0x66c7('0xda'));}else{var _0x54c510=this[_0x66c7('0xf')][_0x66c7('0x72')](this,_0x4792b3[_0x66c7('0xd9')]);if(!_0x54c510){return this['channel'][_0x66c7('0x2c')](_0x4792b3,_0x66c7('0xdb'));}this[_0x66c7('0xc')][_0x66c7('0xed')](_0x54c510,_0x28255a);}this[_0x66c7('0xa8')][_0x66c7('0x72')](this,_0x4792b3,_0x28255a);return _0x3c575b;};AGIVertices['prototype'][_0x66c7('0xaf')]=function(_0x348f4e){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x16b'),_0x348f4e[_0x66c7('0x36')]));return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x348f4e[_0x66c7('0x16c')]||_0x348f4e['label']);};AGIVertices[_0x66c7('0x13')][_0x66c7('0x16d')]=function(_0x19384c){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x16e'),_0x19384c[_0x66c7('0x36')]));if(!this['isConfigured'](_0x19384c['findBy'])){return this['channel'][_0x66c7('0x2c')](_0x19384c,'no\x20find\x20by\x20configured');}logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x15a'),this[_0x66c7('0xc')]['callerid'],_0x19384c[_0x66c7('0x15b')]));var _0x53d478=this[_0x66c7('0x4b')][_0x66c7('0x72')](this,_0x19384c[_0x66c7('0x16f')]);var _0x1d1810=this[_0x66c7('0x4d')][_0x66c7('0x72')](this,_0x19384c[_0x66c7('0x15b')],_0x53d478);if(_0x1d1810){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x15c'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x19384c[_0x66c7('0x15b')]));this[_0x66c7('0xc')]['noop'](util[_0x66c7('0x28')](_0x66c7('0x15c'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x19384c[_0x66c7('0x15b')]));return{'code':0xc8,'result':_0x66c7('0x15d')};}else{logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x15e'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x19384c[_0x66c7('0x15b')]));this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0x15c'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x19384c[_0x66c7('0x15b')]));return{'code':0xc8,'result':_0x66c7('0x15f')};}};AGIVertices[_0x66c7('0x13')][_0x66c7('0x170')]=function(_0x31c33c){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x171'),_0x31c33c[_0x66c7('0x36')]));if(!this['isConfigured'](_0x31c33c['file_id'])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x31c33c,_0x66c7('0x169'));}var _0x2d25b1=this[_0x66c7('0x1d')]['sync'](this,_0x31c33c[_0x66c7('0x118')]);if(!_0x2d25b1){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x31c33c,'no\x20file\x20audio\x20found');}var _0x5c1bf9=this['channel'][_0x66c7('0x57')](_0x66c7('0x172'),[_0x2d25b1,_0x31c33c['opts']]);if(_0x5c1bf9['result']===-0x1){return _0x5c1bf9;}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x2d25b1));};AGIVertices[_0x66c7('0x13')][_0x66c7('0x173')]=function(_0x525128){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x174'),_0x525128[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x525128[_0x66c7('0x175')])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x525128,_0x66c7('0x176'));}var _0x749ae0='';var _0x354ab7=parseInt(_0x525128[_0x66c7('0x175')],0xa);if(isNaN(_0x354ab7)){_0x749ae0=_0x525128['queue_id'];}else{_0x749ae0=this[_0x66c7('0x14')][_0x66c7('0x72')](this,_0x525128[_0x66c7('0x175')]);if(!_0x749ae0){return this[_0x66c7('0xc')]['error'](_0x525128,'no\x20queue\x20found');}}var _0x11cd1e='';if(this[_0x66c7('0x89')](_0x525128[_0x66c7('0x118')])){var _0x15d0f5=this[_0x66c7('0x1d')][_0x66c7('0x72')](this,_0x525128[_0x66c7('0x118')]);if(_0x15d0f5){_0x11cd1e=_0x15d0f5;}}this[_0x66c7('0xa8')][_0x66c7('0x72')](this,_0x525128,_0x749ae0);if(_0x525128[_0x66c7('0xe8')][_0x66c7('0x177')]('x')<0x0){_0x525128['opts']+='x';}if(_0x525128[_0x66c7('0xe8')][_0x66c7('0x177')]('X')<0x0){_0x525128[_0x66c7('0xe8')]+='X';}this[_0x66c7('0xc')][_0x66c7('0xed')]('XMCS-QUEUE',_0x749ae0?_0x749ae0[_0x66c7('0x178')]():'');var _0x1a92bd=this[_0x66c7('0xc')][_0x66c7('0x57')](_0x66c7('0x179'),[_0x749ae0,_0x525128[_0x66c7('0xe8')],_0x525128[_0x66c7('0x66')],_0x11cd1e,_0x525128['timeout'],_0x525128[_0x66c7('0x6')],_0x525128[_0x66c7('0x17a')],_0x525128[_0x66c7('0x17b')],'',_0x525128['position']]);if(_0x1a92bd[_0x66c7('0xa5')]===-0x1){return _0x1a92bd;}return this[_0x66c7('0xc')]['noop'](util[_0x66c7('0x28')]('Executed\x20command\x20%s\x20%s',_0x66c7('0x179'),_0x749ae0));};AGIVertices[_0x66c7('0x13')]['record']=function(_0x543b01){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x17c'),_0x543b01[_0x66c7('0x36')]));var _0x3bd76d=_0x543b01[_0x66c7('0x17d')]||_0x66c7('0x134');var _0x506cc2=util['format'](_0x66c7('0x17e'),this[_0x66c7('0xc')][_0x66c7('0x35')],rs[_0x66c7('0x122')](0x5));var _0x5c887f=util[_0x66c7('0x28')](_0x66c7('0x17f'),FILES_PATH,_0x506cc2,_0x3bd76d);var _0x274b20=util[_0x66c7('0x28')](_0x66c7('0x13f'),FILES_PATH,_0x506cc2);this[_0x66c7('0x38')][_0x66c7('0x72')](this,_0x543b01,_0x506cc2,_0x5c887f);this[_0x66c7('0xc')]['setVariable'](_0x66c7('0x180'),_0x506cc2);logger[_0x66c7('0x30')](_0x66c7('0x181'),_0x274b20,_0x3bd76d,_0x543b01[_0x66c7('0x182')],_0x543b01[_0x66c7('0x67')]);return this[_0x66c7('0xc')][_0x66c7('0x136')](_0x274b20,_0x3bd76d,_0x543b01[_0x66c7('0x182')],_0x543b01[_0x66c7('0x67')],undefined,!![]);};AGIVertices[_0x66c7('0x13')][_0x66c7('0x183')]=function(_0x18ccd6){logger[_0x66c7('0x30')](util['format'](_0x66c7('0x184'),_0x18ccd6[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x18ccd6['url'])){return this['channel']['noop']('no\x20url\x20configured');}var _0x3087e2=this['restAPI']['sync'](this,_0x18ccd6);logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x185'),util[_0x66c7('0x186')](_0x3087e2,{'showHidden':![],'depth':null})));if(!this[_0x66c7('0x89')](_0x18ccd6['variable_id'])){return this[_0x66c7('0xc')]['noop'](_0x66c7('0x187'));}var _0x22c10d=this['getVariable'][_0x66c7('0x72')](this,_0x18ccd6[_0x66c7('0xd9')]);if(!_0x22c10d){return this[_0x66c7('0xc')]['error'](_0x18ccd6,_0x66c7('0xdb'));}this[_0x66c7('0xc')][_0x66c7('0xed')](util[_0x66c7('0x28')]('%s_STATUS_CODE',_0x22c10d),_0x3087e2['statusCode']?_0x3087e2[_0x66c7('0x78')]:_0x66c7('0x188'));this['channel']['setVariable'](util[_0x66c7('0x28')](_0x66c7('0x189'),_0x22c10d),_0x3087e2[_0x66c7('0x79')]?_0x3087e2['statusMessage']:'OK');if(_0x3087e2[_0x66c7('0x76')]){try{this[_0x66c7('0x9e')](_0x3087e2[_0x66c7('0x76')],_0x22c10d);}catch(_0x10d805){logger[_0x66c7('0x2c')](util[_0x66c7('0x28')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x22c10d));}}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xe0'),_0x22c10d));};AGIVertices[_0x66c7('0x13')][_0x66c7('0x18a')]=function(_0x354744){logger[_0x66c7('0x30')](util[_0x66c7('0x28')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x354744['label']));return this[_0x66c7('0xc')][_0x66c7('0x18b')](_0x354744[_0x66c7('0x18c')][_0x66c7('0x59')](/\s+/g,''),_0x354744['escape_digits']);};AGIVertices['prototype']['saynumber']=function(_0x53805f){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x18d'),_0x53805f[_0x66c7('0x36')]));return this[_0x66c7('0xc')][_0x66c7('0x18e')](_0x53805f[_0x66c7('0x68')]['replace'](/\s+/g,''),_0x53805f['escape_digits']);};AGIVertices['prototype'][_0x66c7('0x18f')]=function(_0x4407b8){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x190'),_0x4407b8[_0x66c7('0x36')]));return this[_0x66c7('0xc')][_0x66c7('0x191')](_0x4407b8[_0x66c7('0x5d')],_0x4407b8[_0x66c7('0x182')]);};AGIVertices[_0x66c7('0x13')]['sendMail']=function(_0x5d39f7){logger[_0x66c7('0x30')](util[_0x66c7('0x28')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x5d39f7[_0x66c7('0x36')]));if(!this['isConfigured'](_0x5d39f7[_0x66c7('0x192')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')]('no\x20mail\x20account\x20configured');}var _0x292043=this['getMailAccount'][_0x66c7('0x72')](this,_0x5d39f7[_0x66c7('0x192')]);if(!_0x292043||!_0x292043[_0x66c7('0x193')]){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x5d39f7,_0x66c7('0x194'));}var _0x2d192e={'from':util['format'](_0x66c7('0x195'),_0x292043[_0x66c7('0x16')],_0x292043[_0x66c7('0x196')]||_0x292043[_0x66c7('0x193')]['user']),'to':_0x5d39f7['to']||'','cc':_0x5d39f7['cc']||'','bcc':_0x5d39f7[_0x66c7('0x197')]||'','subject':_0x5d39f7[_0x66c7('0x198')],'html':_0x5d39f7[_0x66c7('0x5d')],'text':_0x5d39f7[_0x66c7('0x5d')]};if(this['isConfigured'](_0x5d39f7['template_id'])){}logger['debug'](_0x66c7('0x199'),JSON['stringify'](_0x2d192e));this['createSquareDetailsReport']['sync'](this,_0x5d39f7,_0x5d39f7[_0x66c7('0x192')]);this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x292043[_0x66c7('0x16')]));this[_0x66c7('0x22')][_0x66c7('0x72')](this,_0x292043['smtpOptions'],_0x2d192e);return this['channel'][_0x66c7('0xaf')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x66c7('0x19a')]=function(_0x451374){logger['info'](util[_0x66c7('0x28')](_0x66c7('0x19b'),_0x451374[_0x66c7('0x36')]));return this[_0x66c7('0xc')]['noop'](_0x66c7('0x19c'));};AGIVertices[_0x66c7('0x13')][_0x66c7('0x19d')]=function(_0xaee53a){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x19e'),_0xaee53a[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0xaee53a[_0x66c7('0x19f')])){return this['channel'][_0x66c7('0xaf')](_0x66c7('0x1a0'));}var _0x18a8af=this[_0x66c7('0x32')][_0x66c7('0x72')](this,_0xaee53a[_0x66c7('0x19f')]);if(!_0x18a8af){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0xaee53a,_0x66c7('0x1a1'));}var _0x9b327b={'body':_0xaee53a[_0x66c7('0x1a2')],'phone':_0xaee53a['to']||'','SmsAccountId':_0x18a8af['id']};logger[_0x66c7('0xe2')]('sendSMS\x20message',JSON[_0x66c7('0x75')](_0x9b327b));this[_0x66c7('0xa8')][_0x66c7('0x72')](this,_0xaee53a,_0xaee53a[_0x66c7('0x19f')]);this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x18a8af[_0x66c7('0x16')]));this[_0x66c7('0x34')]['sync'](this,_0x9b327b);return this['channel'][_0x66c7('0xaf')](_0x66c7('0x1a3'));};AGIVertices[_0x66c7('0x13')]['set']=function(_0x2ca6b7){logger[_0x66c7('0x30')](util['format'](_0x66c7('0x1a4'),_0x2ca6b7['label']));if(!this[_0x66c7('0x89')](_0x2ca6b7['variable_id'])){return this['channel'][_0x66c7('0x2c')](_0x2ca6b7,_0x66c7('0x1a5'));}var _0x96363b=this[_0x66c7('0xf')]['sync'](this,_0x2ca6b7[_0x66c7('0xd9')]);if(!_0x96363b){return this[_0x66c7('0xc')]['error'](_0x2ca6b7,_0x66c7('0xdb'));}return this[_0x66c7('0xc')][_0x66c7('0xed')](_0x96363b,_0x2ca6b7['variable_value']);};AGIVertices['prototype']['start']=function(_0x553b28){logger[_0x66c7('0x30')](util[_0x66c7('0x28')]('Enter\x20in\x20START\x20(%s)\x20block',_0x553b28[_0x66c7('0x36')]));this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0x1a6'));if(_0x553b28[_0x66c7('0xb9')]==='yes'){this[_0x66c7('0xc')][_0x66c7('0xaf')]('Answer');return this['channel'][_0x66c7('0xb9')]();}return this['channel'][_0x66c7('0xaf')]('Skipped\x20Answer');};AGIVertices[_0x66c7('0x13')][_0x66c7('0x1a7')]=function(_0x1e1617){logger['info'](util['format'](_0x66c7('0x1a8'),_0x1e1617[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x1e1617[_0x66c7('0x1a9')])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x1e1617,_0x66c7('0x1aa'));}var _0x3977d8=this[_0x66c7('0x17')]['sync'](this,_0x1e1617[_0x66c7('0x1a9')]);if(!this[_0x66c7('0x89')](_0x3977d8)){return this[_0x66c7('0xc')]['error'](_0x1e1617,util[_0x66c7('0x28')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x1e1617[_0x66c7('0x1a9')]));}if(_0x3977d8===this[_0x66c7('0xc')][_0x66c7('0x3f')]){return this[_0x66c7('0xc')]['error'](_0x1e1617,_0x66c7('0x1ab'));}this[_0x66c7('0xa8')]['sync'](this,_0x1e1617,_0x3977d8);var _0x24239b=this[_0x66c7('0xc')]['exec'](_0x66c7('0x1ac'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x66c7('0x1ad')]||'127.0.0.1',_0x3977d8,this['channel'][_0x66c7('0x3f')]));if(_0x24239b[_0x66c7('0xa5')]===-0x1){return _0x24239b;}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format']('Executed\x20command\x20%s\x20%s',_0x66c7('0x1ac'),_0x3977d8));};AGIVertices[_0x66c7('0x13')][_0x66c7('0x1ae')]=function(_0x3aec02){logger['info'](util['format'](_0x66c7('0x1af'),_0x3aec02[_0x66c7('0x36')]));var _0x3dda9f=this[_0x66c7('0x56')]['sync'](this,_0x3aec02[_0x66c7('0xb7')]);this[_0x66c7('0xa8')][_0x66c7('0x72')](this,_0x3aec02,_0x3aec02['command']);if(this['isConfigured'](_0x3aec02[_0x66c7('0xd9')])){var _0x438bef=this['getVariable'][_0x66c7('0x72')](this,_0x3aec02[_0x66c7('0xd9')]);if(_0x438bef){this[_0x66c7('0xc')][_0x66c7('0xed')](_0x438bef,_0x3dda9f);return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x1b0'),_0x3aec02['command'],_0x438bef));}}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x1b1'),_0x3aec02[_0x66c7('0xb7')]));};AGIVertices['prototype']['google_cloud_tts']=function(_0x2fdb4e){logger['info'](util[_0x66c7('0x28')](_0x66c7('0x1b2'),_0x2fdb4e[_0x66c7('0x36')]));_0x2fdb4e[_0x66c7('0x5d')]=_0x2fdb4e[_0x66c7('0x5d')][_0x66c7('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x66c7('0x89')](_0x2fdb4e[_0x66c7('0x5b')])){return this[_0x66c7('0xc')]['noop'](_0x66c7('0x1b3'));}if(!this[_0x66c7('0x89')](_0x2fdb4e[_0x66c7('0x5d')])){return this[_0x66c7('0xc')]['noop'](_0x66c7('0xc7'));}this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0x1b4'),_0x2fdb4e[_0x66c7('0x5d')]));var _0x341811=this[_0x66c7('0x5a')][_0x66c7('0x72')](this,_0x2fdb4e);if(_0x341811){this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x1b5'),_0x341811));var _0x5850ee=this['channel']['streamFile'](_0x341811);try{fs[_0x66c7('0x109')](_0x341811+_0x66c7('0x10a'));}catch(_0x6cda09){logger[_0x66c7('0x2c')](_0x6cda09);}return _0x5850ee;}return this['channel'][_0x66c7('0x2c')](_0x2fdb4e,_0x66c7('0x1b6'));};AGIVertices[_0x66c7('0x13')]['tts']=function(_0x13483f){logger['info'](util[_0x66c7('0x28')](_0x66c7('0x1b7'),_0x13483f[_0x66c7('0x36')]));_0x13483f[_0x66c7('0x5d')]=_0x13483f[_0x66c7('0x5d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x66c7('0x89')](_0x13483f[_0x66c7('0x5d')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xc7'));}this['channel'][_0x66c7('0xaf')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x13483f['text']));var _0x159703=this[_0x66c7('0x64')][_0x66c7('0x72')](this,_0x13483f);if(_0x159703){this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')]('Google\x20TTS\x20%s\x20file\x20created',_0x159703));var _0x4c214e=this[_0x66c7('0xc')]['streamFile'](_0x159703);try{fs['unlink'](_0x159703+_0x66c7('0x10a'));}catch(_0x2c2d9b){logger['error'](_0x2c2d9b);}return _0x4c214e;}return this[_0x66c7('0xc')]['error'](_0x13483f,_0x66c7('0x1b8'));};AGIVertices[_0x66c7('0x13')][_0x66c7('0x1b9')]=function(_0x33119a){logger[_0x66c7('0x30')](util['format'](_0x66c7('0x1ba'),_0x33119a['label']));if(!this['isConfigured'](_0x33119a[_0x66c7('0x15b')])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x33119a,'no\x20find\x20by\x20configured');}logger[_0x66c7('0x30')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x66c7('0x39')],_0x33119a[_0x66c7('0x15b')]));var _0x1c7c20=this[_0x66c7('0x50')][_0x66c7('0x72')](this,_0x33119a['findBy']);if(_0x1c7c20){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x15c'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x33119a[_0x66c7('0x15b')]));this['channel'][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x15c'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x33119a[_0x66c7('0x15b')]));return{'code':0xc8,'result':_0x66c7('0x15d')};}else{logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x15e'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x33119a[_0x66c7('0x15b')]));this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x15e'),this[_0x66c7('0xc')]['callerid'],_0x33119a[_0x66c7('0x15b')]));return{'code':0xc8,'result':_0x66c7('0x15f')};}};AGIVertices[_0x66c7('0x13')]['voicemail']=function(_0x53bfda){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x1bb'),_0x53bfda[_0x66c7('0x36')]));var _0x33cb86=this[_0x66c7('0xc')][_0x66c7('0x57')]('VOICEMAIL',[_0x53bfda[_0x66c7('0x1bc')],_0x53bfda[_0x66c7('0x7c')]]);if(_0x33cb86[_0x66c7('0xa5')]===-0x1){return _0x33cb86;}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xc4'),_0x66c7('0x1bd'),_0x53bfda[_0x66c7('0x1bc')]));};AGIVertices[_0x66c7('0x13')][_0x66c7('0x1be')]=function(_0x6d71a4){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x1bf'),_0x6d71a4[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x6d71a4['variable_id'])){return this['channel'][_0x66c7('0x2c')](_0x6d71a4,'no\x20variable\x20selected');}var _0x2de6fe=this[_0x66c7('0xf')][_0x66c7('0x72')](this,_0x6d71a4[_0x66c7('0xd9')]);if(!_0x2de6fe){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x6d71a4,_0x66c7('0xdb'));}var _0x2fc368=this[_0x66c7('0xc')][_0x66c7('0xf')](_0x2de6fe);return{'code':0xc8,'result':_0x2fc368[_0x66c7('0xa3')]?_0x2fc368[_0x66c7('0xa3')]:'-'};};String[_0x66c7('0x13')]['replaceAll']=function(_0x449bae,_0x3e7239){return this[_0x66c7('0xa1')](_0x449bae)[_0x66c7('0x1c0')](_0x3e7239);};module[_0x66c7('0x1c1')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 11df026..45c1c86 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 _0x2ba8=['syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','milliseconds','diff','prototype','startAcw','interface','queue','mandatoryDisposition','name','mandatoryDispositionPause','QueuePause','getAgent','info','destlinkedid','savePause','then','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','lastPauseAt','format','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','attended','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup'];(function(_0x5d5171,_0x176f5d){var _0x431958=function(_0x4a2df7){while(--_0x4a2df7){_0x5d5171['push'](_0x5d5171['shift']());}};_0x431958(++_0x176f5d);}(_0x2ba8,0x18d));var _0x82ba=function(_0x3353cb,_0x235a81){_0x3353cb=_0x3353cb-0x0;var _0x461146=_0x2ba8[_0x3353cb];return _0x461146;};'use strict';var util=require(_0x82ba('0x0'));var _=require(_0x82ba('0x1'));var moment=require(_0x82ba('0x2'));var ami=require(_0x82ba('0x3'));var logger=require(_0x82ba('0x4'))(_0x82ba('0x5'));var RpcUser=require(_0x82ba('0x6'));var RpcVoiceAgentReport=require(_0x82ba('0x7'));function Acw(_0x39649d){this['voiceQueues']=_0x39649d[_0x82ba('0x8')];this[_0x82ba('0x9')]=_0x39649d['agents'];this[_0x82ba('0xa')]=_0x39649d[_0x82ba('0xa')];this[_0x82ba('0xb')]={};ami['on'](_0x82ba('0xc'),this[_0x82ba('0xd')][_0x82ba('0xe')](this));ami['on'](_0x82ba('0xf'),this[_0x82ba('0x10')][_0x82ba('0xe')](this));ami['on'](_0x82ba('0x11'),this[_0x82ba('0x12')][_0x82ba('0xe')](this));ami['on'](_0x82ba('0x13'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x82ba('0x14'),this[_0x82ba('0x15')][_0x82ba('0xe')](this));ami['on'](_0x82ba('0x16'),this['syncBlindTransfer']['bind'](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x1433f9){var _0x42e373=moment()[_0x82ba('0x17')](0x0);var _0x591b23=moment(_0x1433f9)[_0x82ba('0x17')](0x0);return _0x42e373[_0x82ba('0x18')](_0x591b23,'seconds');}Acw[_0x82ba('0x19')][_0x82ba('0x1a')]=function(_0x3f44fa){try{var _0x55799e=this;var _0x162d81=this[_0x82ba('0xb')][_0x3f44fa][_0x82ba('0x1b')];var _0x15fd29=this['channels'][_0x3f44fa][_0x82ba('0x1c')];var _0x34626b=this['voiceQueues'][_0x15fd29];var _0x3f1b51=![];var _0x4ae607='ACW';if(_0x34626b[_0x82ba('0x1d')]){if(_0x34626b['mandatoryDispositionPause'][_0x82ba('0x1e')]){_0x3f1b51=!![];_0x4ae607=_0x34626b[_0x82ba('0x1f')][_0x82ba('0x1e')];}}ami['Action']({'action':_0x82ba('0x20'),'interface':_0x162d81,'paused':!![],'reason':_0x4ae607})['then'](function(_0x96901a){if(_0x55799e[_0x82ba('0x9')][_0x162d81]){return RpcUser[_0x82ba('0x21')](_0x55799e[_0x82ba('0x9')][_0x162d81]['id'])['then'](function(_0x231d4f){if(_0x231d4f&&!_0x231d4f['voicePause']){logger[_0x82ba('0x22')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x3f44fa,_0x162d81,_0x15fd29);var _0x4166d9=_0x55799e['channels'][_0x3f44fa]['attended']&&_0x55799e[_0x82ba('0xb')][_0x3f44fa][_0x82ba('0x23')]?_0x55799e[_0x82ba('0xb')][_0x3f44fa][_0x82ba('0x23')]:_0x3f44fa;return RpcUser[_0x82ba('0x24')](_0x55799e[_0x82ba('0x9')][_0x162d81],_0x4ae607,_0x4166d9)[_0x82ba('0x25')](function(_0xd8bfed){if(!_0x3f1b51){_0x55799e['timers'][_0x162d81]={};logger['info'](_0x82ba('0x26'),_0x3f44fa,_0x55799e[_0x82ba('0x8')][_0x15fd29]['acwTimeout'],_0x162d81,_0x15fd29);_0x55799e[_0x82ba('0xa')][_0x162d81][_0x82ba('0x27')]=setTimeout(_0x55799e[_0x82ba('0x28')][_0x82ba('0xe')](_0x55799e,_0x162d81),_0x55799e[_0x82ba('0x8')][_0x15fd29][_0x82ba('0x29')]*0x3e8);_0x55799e[_0x82ba('0xa')][_0x162d81][_0x82ba('0x2a')]=moment()[_0x82ba('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');_0x55799e[_0x82ba('0xa')][_0x162d81]['uniqueid']=_0x3f44fa;_0x55799e[_0x82ba('0xa')][_0x162d81][_0x82ba('0x1c')]=_0x15fd29;_0x55799e[_0x82ba('0xa')][_0x162d81]['updateAcw']=function(){var _0x27fc4f=getDiff(_0x55799e['timers'][_0x162d81][_0x82ba('0x2a')]);clearTimeout(_0x55799e[_0x82ba('0xa')][_0x162d81][_0x82ba('0x27')]);_0x55799e[_0x82ba('0xa')][_0x162d81][_0x82ba('0x27')]=![];RpcVoiceAgentReport[_0x82ba('0x2c')]({'acwtime':_0x27fc4f},_0x55799e['timers'][_0x162d81][_0x82ba('0x2d')],_0x162d81)[_0x82ba('0x25')](function(_0x2ec4c2){logger[_0x82ba('0x22')](_0x82ba('0x2e'),_0x3f44fa,_0x27fc4f,_0x2ec4c2);})[_0x82ba('0x2f')](function(_0x456fe6){logger[_0x82ba('0x30')]('[%s][UPDATE][ERRORS:%s]',_0x3f44fa,_0x456fe6);});delete _0x55799e[_0x82ba('0xa')][_0x162d81];};}});}else{logger[_0x82ba('0x22')](_0x82ba('0x31'),_0x3f44fa,_0x162d81,_0x15fd29);}});}})[_0x82ba('0x2f')](function(_0x441974){logger['error'](_0x82ba('0x26'),_0x3f44fa,_0x55799e[_0x82ba('0x8')][_0x15fd29][_0x82ba('0x29')],_0x162d81,_0x15fd29);})[_0x82ba('0x32')](function(){delete _0x55799e[_0x82ba('0xb')][_0x3f44fa];});}catch(_0xe1e8af){logger[_0x82ba('0x30')]('[ACW][START]\x20%s',_0xe1e8af[_0x82ba('0x33')]);}};Acw[_0x82ba('0x19')]['stopAcw']=function(_0x2798df){try{var _0x25750d=this;if(_0x25750d['timers'][_0x2798df]){_0x25750d[_0x82ba('0xa')][_0x2798df][_0x82ba('0x27')]=![];var _0x4a297f=_0x25750d[_0x82ba('0xa')][_0x2798df][_0x82ba('0x2d')];var _0x39ddd6=_0x25750d[_0x82ba('0xa')][_0x2798df][_0x82ba('0x1c')];var _0x21a1d5=_0x25750d[_0x82ba('0x8')][_0x39ddd6]['acwTimeout'];logger[_0x82ba('0x22')](_0x82ba('0x34'),_0x4a297f,_0x2798df);RpcUser[_0x82ba('0x35')](this[_0x82ba('0x9')][_0x2798df]);RpcVoiceAgentReport[_0x82ba('0x2c')]({'acwtime':_0x21a1d5,'agentacw':!![]},_0x4a297f,_0x2798df)['then'](function(_0x3d1ce9){logger[_0x82ba('0x22')](_0x82ba('0x2e'),_0x4a297f,_0x21a1d5,_0x3d1ce9);})[_0x82ba('0x2f')](function(_0x5ac5ef){logger[_0x82ba('0x30')](_0x82ba('0x36'),_0x4a297f,_0x5ac5ef);});}else{logger[_0x82ba('0x30')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x2798df);if(_0x25750d[_0x82ba('0xa')]){logger['info']('[ACW][TIMERS]',JSON['stringify'](_0x25750d['timers']));}}}catch(_0x5edcc8){logger['error'](_0x82ba('0x37'),_0x5edcc8[_0x82ba('0x33')]);}};Acw['prototype'][_0x82ba('0xd')]=function(_0x232e8a){try{if(this['voiceQueues'][_0x232e8a[_0x82ba('0x1c')]]&&(this[_0x82ba('0x8')][_0x232e8a[_0x82ba('0x1c')]][_0x82ba('0x5')]||this[_0x82ba('0x8')][_0x232e8a[_0x82ba('0x1c')]][_0x82ba('0x1d')])){if(this[_0x82ba('0x9')][_0x232e8a[_0x82ba('0x1b')]]){this[_0x82ba('0xb')][_0x232e8a[_0x82ba('0x2d')]]={'queue':_0x232e8a['queue'],'interface':_0x232e8a[_0x82ba('0x1b')],'destlinkedid':_0x232e8a['destlinkedid']};}}}catch(_0x3f9604){logger[_0x82ba('0x30')](_0x82ba('0x38'),_0x3f9604[_0x82ba('0x33')]);}};Acw[_0x82ba('0x19')]['syncAgentConnectPreview']=function(_0x2a7f25){try{if(this[_0x82ba('0x8')][_0x2a7f25[_0x82ba('0x1c')]]&&(this[_0x82ba('0x8')][_0x2a7f25[_0x82ba('0x1c')]][_0x82ba('0x5')]||this[_0x82ba('0x8')][_0x2a7f25[_0x82ba('0x1c')]][_0x82ba('0x1d')])){if(this[_0x82ba('0x9')][_0x2a7f25[_0x82ba('0x1b')]]){this[_0x82ba('0xb')][_0x2a7f25[_0x82ba('0x2d')]]={'queue':_0x2a7f25[_0x82ba('0x1c')],'interface':_0x2a7f25['interface']};}}}catch(_0x1aff8c){logger['error'](_0x82ba('0x39'),_0x1aff8c[_0x82ba('0x33')]);}};Acw[_0x82ba('0x19')][_0x82ba('0x10')]=function(_0x4de3cb){try{if(this[_0x82ba('0xb')][_0x4de3cb['uniqueid']]&&_[_0x82ba('0x3a')](this[_0x82ba('0xb')][_0x4de3cb[_0x82ba('0x2d')]]['attended'])){logger[_0x82ba('0x22')]('[%s][HANGUP:UNIQUEID]',_0x4de3cb[_0x82ba('0x2d')]);this[_0x82ba('0x1a')](_0x4de3cb[_0x82ba('0x2d')]);}else if(this[_0x82ba('0xb')][_0x4de3cb[_0x82ba('0x3b')]]&&_['isUndefined'](this[_0x82ba('0xb')][_0x4de3cb[_0x82ba('0x3b')]][_0x82ba('0x3c')])){logger[_0x82ba('0x22')](_0x82ba('0x3d'),_0x4de3cb['linkedid']);this[_0x82ba('0x1a')](_0x4de3cb[_0x82ba('0x3b')]);}}catch(_0x3aaba2){logger['error'](_0x82ba('0x3e'),_0x3aaba2[_0x82ba('0x33')]);}};Acw[_0x82ba('0x19')][_0x82ba('0x12')]=function(_0x2e1880){try{if(this[_0x82ba('0xb')][_0x2e1880['uniqueid']]&&this[_0x82ba('0xb')][_0x2e1880[_0x82ba('0x2d')]][_0x82ba('0x3c')]){logger[_0x82ba('0x22')](_0x82ba('0x3f'),_0x2e1880['uniqueid']);this[_0x82ba('0x1a')](_0x2e1880[_0x82ba('0x2d')]);}else if(this['channels'][_0x2e1880[_0x82ba('0x3b')]]&&this[_0x82ba('0xb')][_0x2e1880[_0x82ba('0x3b')]][_0x82ba('0x3c')]){logger[_0x82ba('0x22')](_0x82ba('0x40'),_0x2e1880[_0x82ba('0x3b')]);this[_0x82ba('0x1a')](_0x2e1880[_0x82ba('0x3b')]);}}catch(_0x25c387){logger[_0x82ba('0x30')](_0x82ba('0x41'),_0x25c387[_0x82ba('0x33')]);}};Acw[_0x82ba('0x19')][_0x82ba('0x15')]=function(_0x2f46d4){try{if(!_[_0x82ba('0x42')](this[_0x82ba('0xb')][_0x2f46d4[_0x82ba('0x43')]])){this['startAcw'](_0x2f46d4[_0x82ba('0x43')]);if(this['channels'][_0x2f46d4[_0x82ba('0x44')]]){this['channels'][_0x2f46d4[_0x82ba('0x44')]][_0x82ba('0x3c')]=!![];this['channels'][_0x2f46d4[_0x82ba('0x45')]]=this[_0x82ba('0xb')][_0x2f46d4['secondtransfereruniqueid']];delete this[_0x82ba('0xb')][_0x2f46d4[_0x82ba('0x44')]];}}else if(!_[_0x82ba('0x42')](this['channels'][_0x2f46d4[_0x82ba('0x45')]])){this[_0x82ba('0x1a')](_0x2f46d4[_0x82ba('0x45')]);if(this[_0x82ba('0xb')][_0x2f46d4[_0x82ba('0x46')]]){this[_0x82ba('0xb')][_0x2f46d4['origtransfereruniqueid']][_0x82ba('0x3c')]=!![];this[_0x82ba('0xb')][_0x2f46d4[_0x82ba('0x43')]]=this['channels'][_0x2f46d4[_0x82ba('0x46')]];delete this[_0x82ba('0xb')][_0x2f46d4[_0x82ba('0x46')]];}}}catch(_0x45fe8a){logger['error'](_0x82ba('0x47'),_0x45fe8a['message']);}};Acw[_0x82ba('0x19')]['syncBlindTransfer']=function(_0x33e2b3){try{if(this[_0x82ba('0xb')][_0x33e2b3['transfereruniqueid']]){logger['info'](_0x82ba('0x48'),JSON[_0x82ba('0x49')](_0x33e2b3[_0x82ba('0x4a')]));this[_0x82ba('0x1a')](_0x33e2b3[_0x82ba('0x4a')]);}else if(this[_0x82ba('0xb')][_0x33e2b3[_0x82ba('0x4b')]]){logger[_0x82ba('0x22')](_0x82ba('0x4c'),JSON['stringify'](_0x33e2b3[_0x82ba('0x4b')]));this[_0x82ba('0x1a')](_0x33e2b3[_0x82ba('0x4b')]);}}catch(_0x24bc7b){logger['error'](_0x82ba('0x4d'),_0x24bc7b[_0x82ba('0x33')]);}};Acw[_0x82ba('0x19')][_0x82ba('0x4e')]=function(_0xe3df90){try{if(this['voiceQueues'][_0xe3df90['queue']]&&this[_0x82ba('0x8')][_0xe3df90['queue']][_0x82ba('0x4f')]===_0x82ba('0x50')){if(this[_0x82ba('0x9')][_0xe3df90['interface']]){logger['info'](_0x82ba('0x51'),_0xe3df90[_0x82ba('0x2d')],_0xe3df90[_0x82ba('0x1b')],_0xe3df90[_0x82ba('0x1c')]);return RpcUser[_0x82ba('0x24')](this[_0x82ba('0x9')][_0xe3df90[_0x82ba('0x1b')]],'Auto-Pause',_0xe3df90[_0x82ba('0x2d')]);}}}catch(_0x40042f){logger[_0x82ba('0x30')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x40042f['message']);}};module[_0x82ba('0x52')]=Acw; \ No newline at end of file +var _0xa595=['prototype','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','update','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','attended','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds'];(function(_0x4f8f3b,_0x43281b){var _0x4c250c=function(_0x19a7ff){while(--_0x19a7ff){_0x4f8f3b['push'](_0x4f8f3b['shift']());}};_0x4c250c(++_0x43281b);}(_0xa595,0x19d));var _0x5a59=function(_0x2ac6f4,_0x429419){_0x2ac6f4=_0x2ac6f4-0x0;var _0x493548=_0xa595[_0x2ac6f4];return _0x493548;};'use strict';var util=require(_0x5a59('0x0'));var _=require(_0x5a59('0x1'));var moment=require(_0x5a59('0x2'));var ami=require(_0x5a59('0x3'));var logger=require('../../../config/logger')(_0x5a59('0x4'));var RpcUser=require(_0x5a59('0x5'));var RpcVoiceAgentReport=require(_0x5a59('0x6'));function Acw(_0x2951df){this[_0x5a59('0x7')]=_0x2951df[_0x5a59('0x7')];this[_0x5a59('0x8')]=_0x2951df['agents'];this[_0x5a59('0x9')]=_0x2951df[_0x5a59('0x9')];this[_0x5a59('0xa')]={};ami['on'](_0x5a59('0xb'),this[_0x5a59('0xc')][_0x5a59('0xd')](this));ami['on'](_0x5a59('0xe'),this[_0x5a59('0xf')][_0x5a59('0xd')](this));ami['on'](_0x5a59('0x10'),this[_0x5a59('0x11')][_0x5a59('0xd')](this));ami['on']('agentringnoanswer',this[_0x5a59('0x12')][_0x5a59('0xd')](this));ami['on'](_0x5a59('0x13'),this[_0x5a59('0x14')][_0x5a59('0xd')](this));ami['on'](_0x5a59('0x15'),this[_0x5a59('0x16')][_0x5a59('0xd')](this));ami['on'](_0x5a59('0x17'),this[_0x5a59('0x18')][_0x5a59('0xd')](this));}function getDiff(_0xb0fa7e){var _0x21a896=moment()['milliseconds'](0x0);var _0x2059d3=moment(_0xb0fa7e)[_0x5a59('0x19')](0x0);return _0x21a896['diff'](_0x2059d3,_0x5a59('0x1a'));}Acw[_0x5a59('0x1b')]['startAcw']=function(_0x3369c2){try{var _0x4c8e4b=this;var _0x1eed0c=this[_0x5a59('0xa')][_0x3369c2][_0x5a59('0x1c')];var _0x1052ac=this[_0x5a59('0xa')][_0x3369c2][_0x5a59('0x1d')];var _0x151ecb=this['voiceQueues'][_0x1052ac];var _0x453a76=![];var _0x22b83d=_0x5a59('0x1e');if(_0x151ecb[_0x5a59('0x1f')]){if(_0x151ecb[_0x5a59('0x20')][_0x5a59('0x21')]){_0x453a76=!![];_0x22b83d=_0x151ecb[_0x5a59('0x20')][_0x5a59('0x21')];}}ami[_0x5a59('0x22')]({'action':'QueuePause','interface':_0x1eed0c,'paused':!![],'reason':_0x22b83d})['then'](function(_0x3e819b){if(_0x4c8e4b['agents'][_0x1eed0c]){return RpcUser['getAgent'](_0x4c8e4b[_0x5a59('0x8')][_0x1eed0c]['id'])[_0x5a59('0x23')](function(_0x5857a9){if(_0x5857a9&&!_0x5857a9[_0x5a59('0x24')]){logger[_0x5a59('0x25')](_0x5a59('0x26'),_0x3369c2,_0x1eed0c,_0x1052ac);var _0x393245=_0x4c8e4b[_0x5a59('0xa')][_0x3369c2]['attended']&&_0x4c8e4b['channels'][_0x3369c2][_0x5a59('0x27')]?_0x4c8e4b[_0x5a59('0xa')][_0x3369c2][_0x5a59('0x27')]:_0x3369c2;return RpcUser[_0x5a59('0x28')](_0x4c8e4b[_0x5a59('0x8')][_0x1eed0c],_0x22b83d,_0x393245)['then'](function(_0x14ddfe){if(!_0x453a76){_0x4c8e4b[_0x5a59('0x9')][_0x1eed0c]={};logger[_0x5a59('0x25')](_0x5a59('0x29'),_0x3369c2,_0x4c8e4b[_0x5a59('0x7')][_0x1052ac][_0x5a59('0x2a')],_0x1eed0c,_0x1052ac);_0x4c8e4b[_0x5a59('0x9')][_0x1eed0c][_0x5a59('0x2b')]=setTimeout(_0x4c8e4b['stopAcw'][_0x5a59('0xd')](_0x4c8e4b,_0x1eed0c),_0x4c8e4b['voiceQueues'][_0x1052ac][_0x5a59('0x2a')]*0x3e8);_0x4c8e4b[_0x5a59('0x9')][_0x1eed0c]['lastPauseAt']=moment()[_0x5a59('0x2c')](_0x5a59('0x2d'));_0x4c8e4b[_0x5a59('0x9')][_0x1eed0c]['uniqueid']=_0x3369c2;_0x4c8e4b[_0x5a59('0x9')][_0x1eed0c][_0x5a59('0x1d')]=_0x1052ac;_0x4c8e4b[_0x5a59('0x9')][_0x1eed0c][_0x5a59('0x2e')]=function(){var _0x59e3f0=getDiff(_0x4c8e4b[_0x5a59('0x9')][_0x1eed0c]['lastPauseAt']);clearTimeout(_0x4c8e4b[_0x5a59('0x9')][_0x1eed0c]['timer']);_0x4c8e4b[_0x5a59('0x9')][_0x1eed0c]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x59e3f0},_0x4c8e4b['timers'][_0x1eed0c][_0x5a59('0x2f')],_0x1eed0c)['then'](function(_0x31d11b){logger['info'](_0x5a59('0x30'),_0x3369c2,_0x59e3f0,_0x31d11b);})[_0x5a59('0x31')](function(_0x2982ba){logger[_0x5a59('0x32')]('[%s][UPDATE][ERRORS:%s]',_0x3369c2,_0x2982ba);});delete _0x4c8e4b[_0x5a59('0x9')][_0x1eed0c];};}});}else{logger[_0x5a59('0x25')](_0x5a59('0x33'),_0x3369c2,_0x1eed0c,_0x1052ac);}});}})[_0x5a59('0x31')](function(_0x4443b2){logger[_0x5a59('0x32')](_0x5a59('0x29'),_0x3369c2,_0x4c8e4b['voiceQueues'][_0x1052ac][_0x5a59('0x2a')],_0x1eed0c,_0x1052ac);})[_0x5a59('0x34')](function(){delete _0x4c8e4b[_0x5a59('0xa')][_0x3369c2];});}catch(_0x584425){logger['error'](_0x5a59('0x35'),_0x584425[_0x5a59('0x36')]);}};Acw['prototype'][_0x5a59('0x37')]=function(_0x226f35){try{var _0x233b54=this;if(_0x233b54[_0x5a59('0x9')][_0x226f35]){_0x233b54[_0x5a59('0x9')][_0x226f35][_0x5a59('0x2b')]=![];var _0x1af20c=_0x233b54['timers'][_0x226f35]['uniqueid'];var _0x489290=_0x233b54[_0x5a59('0x9')][_0x226f35]['queue'];var _0x1f7496=_0x233b54['voiceQueues'][_0x489290][_0x5a59('0x2a')];logger[_0x5a59('0x25')](_0x5a59('0x38'),_0x1af20c,_0x226f35);RpcUser['saveUnpause'](this[_0x5a59('0x8')][_0x226f35]);RpcVoiceAgentReport[_0x5a59('0x39')]({'acwtime':_0x1f7496,'agentacw':!![]},_0x1af20c,_0x226f35)[_0x5a59('0x23')](function(_0x512581){logger[_0x5a59('0x25')](_0x5a59('0x30'),_0x1af20c,_0x1f7496,_0x512581);})[_0x5a59('0x31')](function(_0xb5552f){logger[_0x5a59('0x32')](_0x5a59('0x3a'),_0x1af20c,_0xb5552f);});}else{logger[_0x5a59('0x32')](_0x5a59('0x3b'),_0x226f35);if(_0x233b54[_0x5a59('0x9')]){logger[_0x5a59('0x25')](_0x5a59('0x3c'),JSON[_0x5a59('0x3d')](_0x233b54[_0x5a59('0x9')]));}}}catch(_0x278169){logger[_0x5a59('0x32')]('[ACW][STOP]\x20%s',_0x278169['message']);}};Acw[_0x5a59('0x1b')]['syncAgentConnect']=function(_0x2c0865){try{if(this[_0x5a59('0x7')][_0x2c0865[_0x5a59('0x1d')]]&&(this[_0x5a59('0x7')][_0x2c0865[_0x5a59('0x1d')]][_0x5a59('0x4')]||this['voiceQueues'][_0x2c0865[_0x5a59('0x1d')]][_0x5a59('0x1f')])){if(this[_0x5a59('0x8')][_0x2c0865[_0x5a59('0x1c')]]){this[_0x5a59('0xa')][_0x2c0865[_0x5a59('0x2f')]]={'queue':_0x2c0865['queue'],'interface':_0x2c0865[_0x5a59('0x1c')],'destlinkedid':_0x2c0865[_0x5a59('0x27')]};}}}catch(_0x503a7c){logger[_0x5a59('0x32')](_0x5a59('0x3e'),_0x503a7c[_0x5a59('0x36')]);}};Acw[_0x5a59('0x1b')][_0x5a59('0x18')]=function(_0x2e8b5b){try{if(this[_0x5a59('0x7')][_0x2e8b5b[_0x5a59('0x1d')]]&&(this[_0x5a59('0x7')][_0x2e8b5b[_0x5a59('0x1d')]]['acw']||this['voiceQueues'][_0x2e8b5b[_0x5a59('0x1d')]][_0x5a59('0x1f')])){if(this[_0x5a59('0x8')][_0x2e8b5b[_0x5a59('0x1c')]]){this['channels'][_0x2e8b5b[_0x5a59('0x2f')]]={'queue':_0x2e8b5b[_0x5a59('0x1d')],'interface':_0x2e8b5b[_0x5a59('0x1c')]};}}}catch(_0x24d9c8){logger[_0x5a59('0x32')]('[ACW][syncAgentConnectPreview]\x20%s',_0x24d9c8[_0x5a59('0x36')]);}};Acw[_0x5a59('0x1b')][_0x5a59('0xf')]=function(_0x23defb){try{if(this[_0x5a59('0xa')][_0x23defb[_0x5a59('0x2f')]]&&_[_0x5a59('0x3f')](this[_0x5a59('0xa')][_0x23defb[_0x5a59('0x2f')]]['attended'])){logger[_0x5a59('0x25')](_0x5a59('0x40'),_0x23defb['uniqueid']);this[_0x5a59('0x41')](_0x23defb[_0x5a59('0x2f')]);}else if(this[_0x5a59('0xa')][_0x23defb[_0x5a59('0x42')]]&&_[_0x5a59('0x3f')](this[_0x5a59('0xa')][_0x23defb['linkedid']][_0x5a59('0x43')])){logger[_0x5a59('0x25')](_0x5a59('0x44'),_0x23defb[_0x5a59('0x42')]);this[_0x5a59('0x41')](_0x23defb[_0x5a59('0x42')]);}}catch(_0x59f313){logger[_0x5a59('0x32')](_0x5a59('0x45'),_0x59f313['message']);}};Acw['prototype'][_0x5a59('0x11')]=function(_0x4b5bd4){try{if(this['channels'][_0x4b5bd4[_0x5a59('0x2f')]]&&this[_0x5a59('0xa')][_0x4b5bd4[_0x5a59('0x2f')]][_0x5a59('0x43')]){logger[_0x5a59('0x25')](_0x5a59('0x46'),_0x4b5bd4[_0x5a59('0x2f')]);this[_0x5a59('0x41')](_0x4b5bd4[_0x5a59('0x2f')]);}else if(this['channels'][_0x4b5bd4['linkedid']]&&this[_0x5a59('0xa')][_0x4b5bd4[_0x5a59('0x42')]][_0x5a59('0x43')]){logger['info'](_0x5a59('0x47'),_0x4b5bd4['linkedid']);this[_0x5a59('0x41')](_0x4b5bd4[_0x5a59('0x42')]);}}catch(_0x442b5b){logger[_0x5a59('0x32')](_0x5a59('0x48'),_0x442b5b['message']);}};Acw[_0x5a59('0x1b')][_0x5a59('0x14')]=function(_0x3edc0a){try{if(!_[_0x5a59('0x49')](this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4a')]])){this[_0x5a59('0x41')](_0x3edc0a[_0x5a59('0x4a')]);if(this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4b')]]){this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4b')]][_0x5a59('0x43')]=!![];this['channels'][_0x3edc0a['transfertargetuniqueid']]=this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4b')]];delete this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4b')]];}}else if(!_['isNil'](this[_0x5a59('0xa')][_0x3edc0a['transfertargetuniqueid']])){this[_0x5a59('0x41')](_0x3edc0a[_0x5a59('0x4c')]);if(this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4d')]]){this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4d')]][_0x5a59('0x43')]=!![];this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4a')]]=this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4d')]];delete this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4d')]];}}}catch(_0x54037c){logger['error'](_0x5a59('0x4e'),_0x54037c[_0x5a59('0x36')]);}};Acw['prototype'][_0x5a59('0x16')]=function(_0x1a33bf){try{if(this['channels'][_0x1a33bf[_0x5a59('0x4f')]]){logger[_0x5a59('0x25')](_0x5a59('0x50'),JSON[_0x5a59('0x3d')](_0x1a33bf[_0x5a59('0x4f')]));this[_0x5a59('0x41')](_0x1a33bf[_0x5a59('0x4f')]);}else if(this[_0x5a59('0xa')][_0x1a33bf['transfererlinkedid']]){logger[_0x5a59('0x25')](_0x5a59('0x51'),JSON[_0x5a59('0x3d')](_0x1a33bf[_0x5a59('0x52')]));this[_0x5a59('0x41')](_0x1a33bf[_0x5a59('0x52')]);}}catch(_0x261d8b){logger[_0x5a59('0x32')](_0x5a59('0x53'),_0x261d8b[_0x5a59('0x36')]);}};Acw[_0x5a59('0x1b')][_0x5a59('0x12')]=function(_0x243730){try{if(this[_0x5a59('0x7')][_0x243730[_0x5a59('0x1d')]]&&this[_0x5a59('0x7')][_0x243730[_0x5a59('0x1d')]]['autopause']===_0x5a59('0x54')){if(this[_0x5a59('0x8')][_0x243730[_0x5a59('0x1c')]]){logger[_0x5a59('0x25')](_0x5a59('0x55'),_0x243730[_0x5a59('0x2f')],_0x243730[_0x5a59('0x1c')],_0x243730[_0x5a59('0x1d')]);return RpcUser['savePause'](this[_0x5a59('0x8')][_0x243730[_0x5a59('0x1c')]],_0x5a59('0x56'),_0x243730[_0x5a59('0x2f')]);}}}catch(_0x3a079f){logger[_0x5a59('0x32')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x3a079f['message']);}};module[_0x5a59('0x57')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 31a67e3..b652eba 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 _0x757a=['devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','close','exports','bluebird','moment','ami','../../config/environment','asterisk','port','password','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','actionDeviceStateList'];(function(_0xd73d3,_0x392d57){var _0x126331=function(_0x12c4f9){while(--_0x12c4f9){_0xd73d3['push'](_0xd73d3['shift']());}};_0x126331(++_0x392d57);}(_0x757a,0xde));var _0xa757=function(_0x58ee94,_0xfa0b16){_0x58ee94=_0x58ee94-0x0;var _0x281361=_0x757a[_0x58ee94];return _0x281361;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var util=require('util');var _=require('lodash');var logger=require('../../config/logger')(_0xa757('0x2'));var config=require(_0xa757('0x3'));var ami=new Manager(config[_0xa757('0x4')][_0xa757('0x5')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')]['username'],config[_0xa757('0x4')][_0xa757('0x6')],!![]);ami['keepConnected']();ami[_0xa757('0x7')]=BPromise[_0xa757('0x8')](ami[_0xa757('0x9')]);function error(_0x1a95ee){logger[_0xa757('0xa')](util['format'](_0xa757('0xb'),config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x1a95ee,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0xa757('0x4')]['ip'],config['asterisk']['port']));}ami[_0xa757('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xa757('0xf')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x10')});};};ami[_0xa757('0x11')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x12')});};};ami[_0xa757('0x13')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x14')});};};ami[_0xa757('0x15')]=function(){return function(){return ami['Action']({'action':_0xa757('0x16')});};};function connect(_0x44eab8){logger[_0xa757('0x17')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));ami[_0xa757('0x18')]('error',error);ami[_0xa757('0x18')]('close',close);}ami['on'](_0xa757('0x19'),connect);ami['on'](_0xa757('0x1a'),function(_0x14014c){logger[_0xa757('0x17')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x14014c,![],null)));});ami['on'](_0xa757('0x1b'),function(_0x21f1af){logger[_0xa757('0x17')](util['format'](_0xa757('0x1c'),config['asterisk'][_0xa757('0xc')],config['asterisk']['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));return BPromise[_0xa757('0x1d')]()['then'](ami[_0xa757('0xe')]())[_0xa757('0x1e')](ami[_0xa757('0xf')]())[_0xa757('0x1e')](ami['actionSipPeerStatus']())[_0xa757('0x1e')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())['catch'](function(_0xfdf69d){logger['error'](_0xa757('0x1f'),util[_0xa757('0xd')](_0xfdf69d,{'showHidden':![],'depth':null}));});});ami['once'](_0xa757('0xa'),error);ami['once'](_0xa757('0x20'),close);module[_0xa757('0x21')]=ami; \ No newline at end of file +var _0x757a=['devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','close','exports','bluebird','moment','ami','../../config/environment','asterisk','port','password','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','actionDeviceStateList'];(function(_0x2f4406,_0x131aca){var _0x4b142b=function(_0x328880){while(--_0x328880){_0x2f4406['push'](_0x2f4406['shift']());}};_0x4b142b(++_0x131aca);}(_0x757a,0xde));var _0xa757=function(_0x3eea2c,_0x54940c){_0x3eea2c=_0x3eea2c-0x0;var _0x129af8=_0x757a[_0x3eea2c];return _0x129af8;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var util=require('util');var _=require('lodash');var logger=require('../../config/logger')(_0xa757('0x2'));var config=require(_0xa757('0x3'));var ami=new Manager(config[_0xa757('0x4')][_0xa757('0x5')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')]['username'],config[_0xa757('0x4')][_0xa757('0x6')],!![]);ami['keepConnected']();ami[_0xa757('0x7')]=BPromise[_0xa757('0x8')](ami[_0xa757('0x9')]);function error(_0x1a95ee){logger[_0xa757('0xa')](util['format'](_0xa757('0xb'),config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x1a95ee,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0xa757('0x4')]['ip'],config['asterisk']['port']));}ami[_0xa757('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xa757('0xf')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x10')});};};ami[_0xa757('0x11')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x12')});};};ami[_0xa757('0x13')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x14')});};};ami[_0xa757('0x15')]=function(){return function(){return ami['Action']({'action':_0xa757('0x16')});};};function connect(_0x44eab8){logger[_0xa757('0x17')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));ami[_0xa757('0x18')]('error',error);ami[_0xa757('0x18')]('close',close);}ami['on'](_0xa757('0x19'),connect);ami['on'](_0xa757('0x1a'),function(_0x14014c){logger[_0xa757('0x17')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x14014c,![],null)));});ami['on'](_0xa757('0x1b'),function(_0x21f1af){logger[_0xa757('0x17')](util['format'](_0xa757('0x1c'),config['asterisk'][_0xa757('0xc')],config['asterisk']['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));return BPromise[_0xa757('0x1d')]()['then'](ami[_0xa757('0xe')]())[_0xa757('0x1e')](ami[_0xa757('0xf')]())[_0xa757('0x1e')](ami['actionSipPeerStatus']())[_0xa757('0x1e')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())['catch'](function(_0xfdf69d){logger['error'](_0xa757('0x1f'),util[_0xa757('0xd')](_0xfdf69d,{'showHidden':![],'depth':null}));});});ami['once'](_0xa757('0xa'),error);ami['once'](_0xa757('0x20'),close);module[_0xa757('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 9ff0235..6c57f85 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 _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x47d4df,_0x437fa4){var _0x5e0ec7=function(_0x41e280){while(--_0x41e280){_0x47d4df['push'](_0x47d4df['shift']());}};_0x5e0ec7(++_0x437fa4);}(_0xf4eb,0xec));var _0xbf4e=function(_0x186b7a,_0x4b7c56){_0x186b7a=_0x186b7a-0x0;var _0x191cc0=_0xf4eb[_0x186b7a];return _0x191cc0;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=client; \ No newline at end of file +var _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x154f8c,_0x150b24){var _0x41b362=function(_0x4d4144){while(--_0x4d4144){_0x154f8c['push'](_0x154f8c['shift']());}};_0x41b362(++_0x150b24);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x38d977,_0x42be1d){_0x38d977=_0x38d977-0x0;var _0x355379=_0xbdb7[_0x38d977];return _0x355379;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index b3a9054..6265acd 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 _0x3010=['ListId','UserId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','number','getQueue','exports','lodash','isNil','string','voiceQueue','name','phone','Contact','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId'];(function(_0x3660fe,_0x591050){var _0x2986c2=function(_0x604063){while(--_0x604063){_0x3660fe['push'](_0x3660fe['shift']());}};_0x2986c2(++_0x591050);}(_0x3010,0x152));var _0x0301=function(_0x68a3f,_0x48d861){_0x68a3f=_0x68a3f-0x0;var _0x7ee19f=_0x3010[_0x68a3f];return _0x7ee19f;};'use strict';var util=require('util');var _=require(_0x0301('0x0'));var moment=require('moment');function checkNameSurname(_0x36becd,_0x1f5d3c,_0x69fe0f){var _0x27c211='';if(!_[_0x0301('0x1')](_0x1f5d3c)&&_0x0301('0x2')===typeof _0x1f5d3c){_0x27c211+=_0x1f5d3c;}if(!_[_0x0301('0x1')](_0x69fe0f)&&_0x0301('0x2')===typeof _0x69fe0f){_0x27c211+='\x20'+_0x69fe0f;}if(_0x27c211!==''){return _0x27c211;}return _0x36becd;}function Action(_0x249dad,_0x5d4142,_0x5d2c63){this[_0x0301('0x3')]=_0x249dad;this['uniqueid']=_0x5d2c63||undefined;this[_0x0301('0x4')]=checkNameSurname(_0x5d4142['Contact'][_0x0301('0x5')],_0x5d4142[_0x0301('0x6')]['firstName'],_0x5d4142['Contact'][_0x0301('0x7')]);this['number']=_0x5d4142[_0x0301('0x5')];this[_0x0301('0x8')]=_0x249dad[_0x0301('0x4')];this[_0x0301('0x9')]=_0x5d4142[_0x0301('0x9')]||![];this[_0x0301('0xa')]=_0x249dad[_0x0301('0xa')];this[_0x0301('0xb')]=_0x249dad[_0x0301('0xb')]||0x3;this['scheduledat']=_0x5d4142[_0x0301('0xc')];this[_0x0301('0xd')]=_0x5d4142[_0x0301('0xd')];this['countcongestionretry']=_0x5d4142[_0x0301('0xe')];this[_0x0301('0xf')]=_0x5d4142[_0x0301('0xf')];this[_0x0301('0x10')]=_0x5d4142['countnosuchnumberretry'];this[_0x0301('0x11')]=_0x5d4142[_0x0301('0x11')];this[_0x0301('0x12')]=_0x5d4142['countabandonedretry'];this[_0x0301('0x13')]=_0x5d4142[_0x0301('0x13')];this['countagentrejectretry']=_0x5d4142[_0x0301('0x14')];this[_0x0301('0x15')]=_0x5d4142[_0x0301('0x15')];this[_0x0301('0x16')]=_0x5d4142[_0x0301('0x16')];this[_0x0301('0x17')]=_0x5d4142[_0x0301('0x17')];this['VoiceQueueId']=_0x5d4142['VoiceQueueId'];this[_0x0301('0x18')]=_0x5d4142[_0x0301('0x18')];this[_0x0301('0x19')]=_0x5d4142['id'];this[_0x0301('0x1a')]=_0x5d4142[_0x0301('0x6')][_0x0301('0x1b')]||'';this[_0x0301('0x1c')]=moment()[_0x0301('0x1d')](_0x0301('0x1e'));this[_0x0301('0x1f')]=_0x5d4142['callback'];this[_0x0301('0x20')]=_0x5d4142[_0x0301('0x20')];this[_0x0301('0x21')]=_0x5d4142[_0x0301('0x21')];this['recallme']=_0x5d4142[_0x0301('0x22')];this[_0x0301('0x23')]='';this[_0x0301('0x24')]='';}Action[_0x0301('0x25')][_0x0301('0x26')]=function(){return util[_0x0301('0x1d')](_0x0301('0x27'),this[_0x0301('0x4')],this['voiceQueue'][_0x0301('0x28')]>0x0?this['number'][_0x0301('0x29')](this[_0x0301('0x3')]['dialCutDigit']):this[_0x0301('0x2a')]);};Action['prototype'][_0x0301('0x2b')]=function(){return this[_0x0301('0x8')];};module[_0x0301('0x2c')]=Action; \ No newline at end of file +var _0x1352=['exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','substring','dialCutDigit','getQueue','queue'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1352,0x115));var _0x2135=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1352[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0x2135('0x0'));var _=require(_0x2135('0x1'));var moment=require(_0x2135('0x2'));function checkNameSurname(_0x13fa5f,_0xdae173,_0x1c1f7c){var _0x437d0a='';if(!_[_0x2135('0x3')](_0xdae173)&&_0x2135('0x4')===typeof _0xdae173){_0x437d0a+=_0xdae173;}if(!_[_0x2135('0x3')](_0x1c1f7c)&&_0x2135('0x4')===typeof _0x1c1f7c){_0x437d0a+='\x20'+_0x1c1f7c;}if(_0x437d0a!==''){return _0x437d0a;}return _0x13fa5f;}function Action(_0x4358d5,_0x34ee66,_0x1eaff9){this[_0x2135('0x5')]=_0x4358d5;this[_0x2135('0x6')]=_0x1eaff9||undefined;this[_0x2135('0x7')]=checkNameSurname(_0x34ee66[_0x2135('0x8')][_0x2135('0x9')],_0x34ee66[_0x2135('0x8')][_0x2135('0xa')],_0x34ee66[_0x2135('0x8')][_0x2135('0xb')]);this[_0x2135('0xc')]=_0x34ee66['phone'];this['queue']=_0x4358d5[_0x2135('0x7')];this[_0x2135('0xd')]=_0x34ee66[_0x2135('0xd')]||![];this['type']=_0x4358d5[_0x2135('0xe')];this[_0x2135('0xf')]=_0x4358d5[_0x2135('0xf')]||0x3;this['scheduledat']=_0x34ee66['scheduledat'];this[_0x2135('0x10')]=_0x34ee66[_0x2135('0x10')];this[_0x2135('0x11')]=_0x34ee66[_0x2135('0x11')];this[_0x2135('0x12')]=_0x34ee66[_0x2135('0x12')];this[_0x2135('0x13')]=_0x34ee66[_0x2135('0x13')];this[_0x2135('0x14')]=_0x34ee66['countdropretry'];this[_0x2135('0x15')]=_0x34ee66[_0x2135('0x15')];this[_0x2135('0x16')]=_0x34ee66[_0x2135('0x16')];this['countagentrejectretry']=_0x34ee66[_0x2135('0x17')];this[_0x2135('0x18')]=_0x34ee66[_0x2135('0x18')];this[_0x2135('0x19')]=_0x34ee66['ListId'];this['UserId']=_0x34ee66[_0x2135('0x1a')];this[_0x2135('0x1b')]=_0x34ee66[_0x2135('0x1b')];this[_0x2135('0x1c')]=_0x34ee66[_0x2135('0x1c')];this[_0x2135('0x1d')]=_0x34ee66['id'];this[_0x2135('0x1e')]=_0x34ee66[_0x2135('0x8')]['firstName']||'';this[_0x2135('0x1f')]=moment()[_0x2135('0x20')](_0x2135('0x21'));this[_0x2135('0x22')]=_0x34ee66[_0x2135('0x22')];this['callbackuniqueid']=_0x34ee66[_0x2135('0x23')];this[_0x2135('0x24')]=_0x34ee66['callbackat'];this[_0x2135('0x25')]=_0x34ee66[_0x2135('0x25')];this[_0x2135('0x26')]='';this[_0x2135('0x27')]='';}Action[_0x2135('0x28')]['getCaller']=function(){return util[_0x2135('0x20')]('\x22%s\x22\x20<%s>',this[_0x2135('0x7')],this[_0x2135('0x5')]['dialCutDigit']>0x0?this[_0x2135('0xc')][_0x2135('0x29')](this[_0x2135('0x5')][_0x2135('0x2a')]):this[_0x2135('0xc')]);};Action[_0x2135('0x28')][_0x2135('0x2b')]=function(){return this[_0x2135('0x2c')];};module[_0x2135('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 34d36fe..a2b2612 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 _0x384d=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countagentrejectretry','countdropretry','countmachineretry','name','calleridnum','number','starttime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','moment','milliseconds','diff','seconds','statedesc','scheduledat','type','outbound','queue'];(function(_0x544fdd,_0x2c8e78){var _0x69b17c=function(_0x2722f8){while(--_0x2722f8){_0x544fdd['push'](_0x544fdd['shift']());}};_0x69b17c(++_0x2c8e78);}(_0x384d,0x167));var _0xd384=function(_0x5594e8,_0x3eb9a8){_0x5594e8=_0x5594e8-0x0;var _0x592b3b=_0x384d[_0x5594e8];return _0x592b3b;};'use strict';var util=require(_0xd384('0x0'));var _=require('lodash');var moment=require(_0xd384('0x1'));function getSeconds(_0x3196f0,_0x2861f3){var _0x2e60a9=moment(_0x3196f0)[_0xd384('0x2')](0x0);var _0x171baa=moment(_0x2861f3)['milliseconds'](0x0);return _0x2e60a9[_0xd384('0x3')](_0x171baa,_0xd384('0x4'));}function AgentComplete(_0x57fb51,_0x31b17d){this['state']=0x4;this[_0xd384('0x5')]='Answer';this['scheduledat']=_0x57fb51[_0xd384('0x6')];this[_0xd384('0x7')]=_0x57fb51[_0xd384('0x7')];this['campaigntype']=_0x57fb51[_0xd384('0x7')]===_0xd384('0x8')?_0xd384('0x9'):_0x57fb51['type'];this[_0xd384('0xa')]=_0x57fb51[_0xd384('0xa')];this[_0xd384('0xb')]=_0x57fb51[_0xd384('0xb')];this[_0xd384('0xc')]=_0x57fb51[_0xd384('0xc')];this[_0xd384('0xd')]=_0x57fb51['countbusyretry']+_0x57fb51[_0xd384('0xb')]+_0x57fb51[_0xd384('0xc')]+_0x57fb51['countnosuchnumberretry']+_0x57fb51['countdropretry']+_0x57fb51['countabandonedretry']+_0x57fb51['countmachineretry']+_0x57fb51[_0xd384('0xe')];this['countnosuchnumberretry']=_0x57fb51['countnosuchnumberretry'];this['countdropretry']=_0x57fb51[_0xd384('0xf')];this['countabandonedretry']=_0x57fb51['countabandonedretry'];this[_0xd384('0x10')]=_0x57fb51['countmachineretry'];this[_0xd384('0xe')]=_0x57fb51[_0xd384('0xe')];this['uniqueid']=_0x31b17d['uniqueid'];this['calleridname']=_0x57fb51[_0xd384('0x11')];this[_0xd384('0x12')]=_0x57fb51[_0xd384('0x13')];this[_0xd384('0x14')]=_0x57fb51['starttime'];this['responsetime']=_0x57fb51['responsetime'];this[_0xd384('0x15')]=_0x57fb51[_0xd384('0x15')];this[_0xd384('0x16')]=moment()[_0xd384('0x17')](_0xd384('0x18'));this[_0xd384('0x19')]=getSeconds(_0x57fb51[_0xd384('0x1a')],_0x57fb51['starttime']);this[_0xd384('0x1b')]=getSeconds(_0x57fb51[_0xd384('0x15')],_0x57fb51['responsetime']);this[_0xd384('0x1c')]=getSeconds(this[_0xd384('0x16')],_0x57fb51[_0xd384('0x15')]);this[_0xd384('0x9')]=_0x31b17d[_0xd384('0x9')];this['membername']=_0x31b17d['membername'];this[_0xd384('0x1d')]=_0x31b17d[_0xd384('0x1d')];this[_0xd384('0x1e')]=_0x57fb51[_0xd384('0x1e')];this[_0xd384('0x1f')]=_0x57fb51['callbackuniqueid'];this[_0xd384('0x20')]=_0x57fb51[_0xd384('0x20')];this[_0xd384('0x21')]=_0x57fb51['recallme'];this[_0xd384('0x22')]=_0x57fb51[_0xd384('0x22')];this['ListId']=_0x57fb51[_0xd384('0x23')];this[_0xd384('0x24')]=_0x57fb51['UserId'];this[_0xd384('0x25')]=_0x57fb51[_0xd384('0x25')];this[_0xd384('0x26')]=_0x57fb51[_0xd384('0x26')];this[_0xd384('0x27')]=_0x57fb51['originatecalleridnum']||'';this['originatecalleridname']=_0x57fb51['originatecalleridname']||'';}module[_0xd384('0x28')]=AgentComplete; \ No newline at end of file +var _0x4eac=['statedesc','scheduledat','type','outbound','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','starttime','responsetime','answertime','ringtime','holdtime','talktime','endtime','queue','membername','reason','callback','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','state'];(function(_0x4fca39,_0x4f1df7){var _0x28475c=function(_0x10a97d){while(--_0x10a97d){_0x4fca39['push'](_0x4fca39['shift']());}};_0x28475c(++_0x4f1df7);}(_0x4eac,0xf1));var _0xc4ea=function(_0x934afd,_0x2847b9){_0x934afd=_0x934afd-0x0;var _0x3ab4d3=_0x4eac[_0x934afd];return _0x3ab4d3;};'use strict';var util=require('util');var _=require(_0xc4ea('0x0'));var moment=require('moment');function getSeconds(_0x1cb8cb,_0x3cd343){var _0x4bebb2=moment(_0x1cb8cb)[_0xc4ea('0x1')](0x0);var _0xdf7164=moment(_0x3cd343)[_0xc4ea('0x1')](0x0);return _0x4bebb2[_0xc4ea('0x2')](_0xdf7164,_0xc4ea('0x3'));}function AgentComplete(_0x3e8afa,_0x70feea){this[_0xc4ea('0x4')]=0x4;this[_0xc4ea('0x5')]='Answer';this[_0xc4ea('0x6')]=_0x3e8afa[_0xc4ea('0x6')];this['type']=_0x3e8afa[_0xc4ea('0x7')];this['campaigntype']=_0x3e8afa['type']===_0xc4ea('0x8')?'queue':_0x3e8afa['type'];this['countbusyretry']=_0x3e8afa['countbusyretry'];this[_0xc4ea('0x9')]=_0x3e8afa[_0xc4ea('0x9')];this[_0xc4ea('0xa')]=_0x3e8afa['countnoanswerretry'];this[_0xc4ea('0xb')]=_0x3e8afa[_0xc4ea('0xc')]+_0x3e8afa[_0xc4ea('0x9')]+_0x3e8afa[_0xc4ea('0xa')]+_0x3e8afa[_0xc4ea('0xd')]+_0x3e8afa[_0xc4ea('0xe')]+_0x3e8afa[_0xc4ea('0xf')]+_0x3e8afa[_0xc4ea('0x10')]+_0x3e8afa[_0xc4ea('0x11')];this[_0xc4ea('0xd')]=_0x3e8afa[_0xc4ea('0xd')];this['countdropretry']=_0x3e8afa[_0xc4ea('0xe')];this[_0xc4ea('0xf')]=_0x3e8afa['countabandonedretry'];this[_0xc4ea('0x10')]=_0x3e8afa[_0xc4ea('0x10')];this[_0xc4ea('0x11')]=_0x3e8afa['countagentrejectretry'];this[_0xc4ea('0x12')]=_0x70feea['uniqueid'];this[_0xc4ea('0x13')]=_0x3e8afa['name'];this[_0xc4ea('0x14')]=_0x3e8afa['number'];this[_0xc4ea('0x15')]=_0x3e8afa['starttime'];this[_0xc4ea('0x16')]=_0x3e8afa[_0xc4ea('0x16')];this[_0xc4ea('0x17')]=_0x3e8afa[_0xc4ea('0x17')];this['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xc4ea('0x18')]=getSeconds(_0x3e8afa[_0xc4ea('0x16')],_0x3e8afa[_0xc4ea('0x15')]);this[_0xc4ea('0x19')]=getSeconds(_0x3e8afa[_0xc4ea('0x17')],_0x3e8afa['responsetime']);this[_0xc4ea('0x1a')]=getSeconds(this[_0xc4ea('0x1b')],_0x3e8afa[_0xc4ea('0x17')]);this[_0xc4ea('0x1c')]=_0x70feea[_0xc4ea('0x1c')];this[_0xc4ea('0x1d')]=_0x70feea['membername'];this[_0xc4ea('0x1e')]=_0x70feea[_0xc4ea('0x1e')];this['callback']=_0x3e8afa[_0xc4ea('0x1f')];this['callbackuniqueid']=_0x3e8afa['callbackuniqueid'];this[_0xc4ea('0x20')]=_0x3e8afa[_0xc4ea('0x20')];this[_0xc4ea('0x21')]=_0x3e8afa[_0xc4ea('0x21')];this[_0xc4ea('0x22')]=_0x3e8afa[_0xc4ea('0x22')];this[_0xc4ea('0x23')]=_0x3e8afa[_0xc4ea('0x23')];this['UserId']=_0x3e8afa['UserId'];this['VoiceQueueId']=_0x3e8afa[_0xc4ea('0x24')];this[_0xc4ea('0x25')]=_0x3e8afa[_0xc4ea('0x25')];this[_0xc4ea('0x26')]=_0x3e8afa[_0xc4ea('0x26')]||'';this[_0xc4ea('0x27')]=_0x3e8afa[_0xc4ea('0x27')]||'';}module[_0xc4ea('0x28')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index aa40966..0218112 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 _0xb66c=['ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0xb66c,0x175));var _0xcb66=function(_0x243335,_0x147dbe){_0x243335=_0x243335-0x0;var _0x33a0a1=_0xb66c[_0x243335];return _0x33a0a1;};'use strict';var util=require(_0xcb66('0x0'));var _=require('lodash');var moment=require(_0xcb66('0x1'));function getSeconds(_0x55a57b,_0x2afcb8){var _0x24ea13=moment(_0x55a57b)[_0xcb66('0x2')](0x0);var _0x5f487c=moment(_0x2afcb8)[_0xcb66('0x2')](0x0);return _0x24ea13[_0xcb66('0x3')](_0x5f487c,_0xcb66('0x4'));}function Final(_0x21be55){this['uniqueid']=_0x21be55['uniqueid'];this[_0xcb66('0x5')]=_0x21be55[_0xcb66('0x5')];this[_0xcb66('0x6')]=_0x21be55[_0xcb66('0x6')];this[_0xcb66('0x7')]=_0x21be55['type']===_0xcb66('0x8')?_0xcb66('0x9'):_0x21be55[_0xcb66('0x6')];this[_0xcb66('0xa')]=_0x21be55[_0xcb66('0xa')];this['countcongestionretry']=_0x21be55[_0xcb66('0xb')];this[_0xcb66('0xc')]=_0x21be55[_0xcb66('0xc')];this[_0xcb66('0xd')]=_0x21be55['countbusyretry']+_0x21be55[_0xcb66('0xb')]+_0x21be55[_0xcb66('0xc')]+_0x21be55[_0xcb66('0xe')]+_0x21be55[_0xcb66('0xf')]+_0x21be55['countabandonedretry']+_0x21be55[_0xcb66('0x10')]+_0x21be55[_0xcb66('0x11')];this[_0xcb66('0xe')]=_0x21be55[_0xcb66('0xe')];this['countdropretry']=_0x21be55[_0xcb66('0xf')];this['countabandonedretry']=_0x21be55[_0xcb66('0x12')];this['countmachineretry']=_0x21be55[_0xcb66('0x10')];this['countagentrejectretry']=_0x21be55['countagentrejectretry'];this[_0xcb66('0x9')]=_0x21be55[_0xcb66('0x9')];this[_0xcb66('0x13')]=_0x21be55[_0xcb66('0x13')];this['calleridnum']=_0x21be55[_0xcb66('0x14')];this[_0xcb66('0x15')]=_0x21be55[_0xcb66('0x15')];this['responsetime']=_0x21be55[_0xcb66('0x16')];this['endtime']=_0x21be55[_0xcb66('0x16')];this[_0xcb66('0x17')]=_0x21be55[_0xcb66('0x17')]||0x0;this[_0xcb66('0x18')]=_0x21be55['holdtime']||0x0;this['talktime']=_0x21be55['talktime']||0x0;this[_0xcb66('0x19')]=_0x21be55['callback'];this['callbackuniqueid']=_0x21be55[_0xcb66('0x1a')];this['callbackat']=_0x21be55[_0xcb66('0x1b')];this[_0xcb66('0x1c')]=_0x21be55[_0xcb66('0x1c')];this[_0xcb66('0x1d')]=_0x21be55[_0xcb66('0x1d')];this[_0xcb66('0x1e')]=_0x21be55[_0xcb66('0x1e')];this['UserId']=_0x21be55[_0xcb66('0x1f')];this['VoiceQueueId']=_0x21be55['VoiceQueueId'];this[_0xcb66('0x20')]=_0x21be55[_0xcb66('0x20')];this[_0xcb66('0x21')]=_0x21be55['originatecalleridnum']||'';this[_0xcb66('0x22')]=_0x21be55[_0xcb66('0x22')]||'';}module[_0xcb66('0x23')]=Final; \ No newline at end of file +var _0x61a5=['scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','moment','milliseconds','diff','uniqueid'];(function(_0x7a85ef,_0x5a10ec){var _0x565d7d=function(_0x3491c9){while(--_0x3491c9){_0x7a85ef['push'](_0x7a85ef['shift']());}};_0x565d7d(++_0x5a10ec);}(_0x61a5,0xf0));var _0x561a=function(_0x687ddc,_0x2092fa){_0x687ddc=_0x687ddc-0x0;var _0x441991=_0x61a5[_0x687ddc];return _0x441991;};'use strict';var util=require(_0x561a('0x0'));var _=require('lodash');var moment=require(_0x561a('0x1'));function getSeconds(_0x28892d,_0xc164c0){var _0x862a0e=moment(_0x28892d)[_0x561a('0x2')](0x0);var _0x58f636=moment(_0xc164c0)[_0x561a('0x2')](0x0);return _0x862a0e[_0x561a('0x3')](_0x58f636,'seconds');}function Final(_0x18902a){this[_0x561a('0x4')]=_0x18902a[_0x561a('0x4')];this[_0x561a('0x5')]=_0x18902a[_0x561a('0x5')];this[_0x561a('0x6')]=_0x18902a[_0x561a('0x6')];this['campaigntype']=_0x18902a[_0x561a('0x6')]==='outbound'?_0x561a('0x7'):_0x18902a[_0x561a('0x6')];this['countbusyretry']=_0x18902a[_0x561a('0x8')];this[_0x561a('0x9')]=_0x18902a['countcongestionretry'];this[_0x561a('0xa')]=_0x18902a['countnoanswerretry'];this[_0x561a('0xb')]=_0x18902a[_0x561a('0x8')]+_0x18902a[_0x561a('0x9')]+_0x18902a[_0x561a('0xa')]+_0x18902a[_0x561a('0xc')]+_0x18902a[_0x561a('0xd')]+_0x18902a[_0x561a('0xe')]+_0x18902a[_0x561a('0xf')]+_0x18902a[_0x561a('0x10')];this[_0x561a('0xc')]=_0x18902a[_0x561a('0xc')];this[_0x561a('0xd')]=_0x18902a['countdropretry'];this[_0x561a('0xe')]=_0x18902a[_0x561a('0xe')];this[_0x561a('0xf')]=_0x18902a[_0x561a('0xf')];this[_0x561a('0x10')]=_0x18902a[_0x561a('0x10')];this[_0x561a('0x7')]=_0x18902a[_0x561a('0x7')];this[_0x561a('0x11')]=_0x18902a[_0x561a('0x11')];this[_0x561a('0x12')]=_0x18902a['calleridnum'];this[_0x561a('0x13')]=_0x18902a[_0x561a('0x13')];this['responsetime']=_0x18902a[_0x561a('0x14')];this[_0x561a('0x15')]=_0x18902a['responsetime'];this[_0x561a('0x16')]=_0x18902a['ringtime']||0x0;this['holdtime']=_0x18902a[_0x561a('0x17')]||0x0;this[_0x561a('0x18')]=_0x18902a['talktime']||0x0;this[_0x561a('0x19')]=_0x18902a[_0x561a('0x19')];this[_0x561a('0x1a')]=_0x18902a[_0x561a('0x1a')];this[_0x561a('0x1b')]=_0x18902a[_0x561a('0x1b')];this['recallme']=_0x18902a[_0x561a('0x1c')];this[_0x561a('0x1d')]=_0x18902a[_0x561a('0x1d')];this['ListId']=_0x18902a['ListId'];this[_0x561a('0x1e')]=_0x18902a[_0x561a('0x1e')];this[_0x561a('0x1f')]=_0x18902a[_0x561a('0x1f')];this[_0x561a('0x20')]=_0x18902a[_0x561a('0x20')];this[_0x561a('0x21')]=_0x18902a[_0x561a('0x21')]||'';this['originatecalleridname']=_0x18902a['originatecalleridname']||'';}module[_0x561a('0x22')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 0eb5780..27cd4d1 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 _0xf059=['membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','moment','milliseconds','seconds','state','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime'];(function(_0x2f965f,_0x100aca){var _0x73f2b9=function(_0x25705d){while(--_0x25705d){_0x2f965f['push'](_0x2f965f['shift']());}};_0x73f2b9(++_0x100aca);}(_0xf059,0x1cf));var _0x9f05=function(_0x2aadc1,_0x3d1a36){_0x2aadc1=_0x2aadc1-0x0;var _0x15d9e9=_0xf059[_0x2aadc1];return _0x15d9e9;};'use strict';var util=require(_0x9f05('0x0'));var _=require('lodash');var moment=require(_0x9f05('0x1'));function getSeconds(_0x3a72d8,_0x5ca802){var _0x3a9167=moment(_0x3a72d8)['milliseconds'](0x0);var _0x3af067=moment(_0x5ca802)[_0x9f05('0x2')](0x0);return _0x3a9167['diff'](_0x3af067,_0x9f05('0x3'));}function Hangup(_0x9642e1,_0x55ce17){this[_0x9f05('0x4')]=0x4;this['statedesc']='Answer';this[_0x9f05('0x5')]=_0x9642e1[_0x9f05('0x5')];this['type']=_0x9642e1[_0x9f05('0x6')];this[_0x9f05('0x7')]=_0x9642e1[_0x9f05('0x6')]===_0x9f05('0x8')?_0x9f05('0x9'):_0x9642e1['type'];this[_0x9f05('0xa')]=_0x9642e1['countbusyretry'];this[_0x9f05('0xb')]=_0x9642e1[_0x9f05('0xb')];this[_0x9f05('0xc')]=_0x9642e1['countnoanswerretry'];this['countglobal']=_0x9642e1[_0x9f05('0xa')]+_0x9642e1[_0x9f05('0xb')]+_0x9642e1[_0x9f05('0xc')]+_0x9642e1[_0x9f05('0xd')]+_0x9642e1[_0x9f05('0xe')]+_0x9642e1[_0x9f05('0xf')]+_0x9642e1[_0x9f05('0x10')]+_0x9642e1['countagentrejectretry'];this[_0x9f05('0xd')]=_0x9642e1[_0x9f05('0xd')];this[_0x9f05('0xe')]=_0x9642e1[_0x9f05('0xe')];this[_0x9f05('0xf')]=_0x9642e1[_0x9f05('0xf')];this['countmachineretry']=_0x9642e1['countmachineretry'];this['countagentrejectretry']=_0x9642e1['countagentrejectretry'];this[_0x9f05('0x11')]=_0x55ce17[_0x9f05('0x11')];this[_0x9f05('0x12')]=_0x9642e1[_0x9f05('0x13')];this['calleridnum']=_0x9642e1[_0x9f05('0x14')];this['starttime']=_0x9642e1[_0x9f05('0x15')];this[_0x9f05('0x16')]=_0x9642e1[_0x9f05('0x16')];this[_0x9f05('0x17')]=moment()[_0x9f05('0x18')](_0x9f05('0x19'));this[_0x9f05('0x1a')]=getSeconds(_0x9642e1[_0x9f05('0x16')],_0x9642e1[_0x9f05('0x15')]);this[_0x9f05('0x1b')]=0x0;this[_0x9f05('0x1c')]=getSeconds(this[_0x9f05('0x17')],_0x9642e1[_0x9f05('0x16')]);this[_0x9f05('0x9')]=_0x9642e1[_0x9f05('0x9')];this[_0x9f05('0x1d')]=_0x9f05('0x1e');this['reason']=_0x55ce17[_0x9f05('0x1f')];this[_0x9f05('0x20')]=_0x9642e1[_0x9f05('0x20')];this[_0x9f05('0x21')]=_0x9642e1[_0x9f05('0x21')];this[_0x9f05('0x22')]=_0x9642e1[_0x9f05('0x22')];this[_0x9f05('0x23')]=_0x9642e1['recallme'];this[_0x9f05('0x24')]=_0x9642e1[_0x9f05('0x24')];this[_0x9f05('0x25')]=_0x9642e1['ListId'];this['UserId']=_0x9642e1[_0x9f05('0x26')];this[_0x9f05('0x27')]=_0x9642e1[_0x9f05('0x27')];this[_0x9f05('0x28')]=_0x9642e1['CampaignId'];}module['exports']=Hangup; \ No newline at end of file +var _0x40c8=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','holdtime','talktime','membername','IVR','cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds','seconds','state','Answer','scheduledat','type','campaigntype'];(function(_0x11daae,_0x3a6d41){var _0x59e28f=function(_0x2d2874){while(--_0x2d2874){_0x11daae['push'](_0x11daae['shift']());}};_0x59e28f(++_0x3a6d41);}(_0x40c8,0xd2));var _0x840c=function(_0x5abb00,_0x41cf01){_0x5abb00=_0x5abb00-0x0;var _0x440615=_0x40c8[_0x5abb00];return _0x440615;};'use strict';var util=require(_0x840c('0x0'));var _=require(_0x840c('0x1'));var moment=require(_0x840c('0x2'));function getSeconds(_0x41aa99,_0x19d587){var _0xa0277e=moment(_0x41aa99)[_0x840c('0x3')](0x0);var _0x20cb1c=moment(_0x19d587)[_0x840c('0x3')](0x0);return _0xa0277e['diff'](_0x20cb1c,_0x840c('0x4'));}function Hangup(_0x163302,_0x15fed3){this[_0x840c('0x5')]=0x4;this['statedesc']=_0x840c('0x6');this[_0x840c('0x7')]=_0x163302[_0x840c('0x7')];this[_0x840c('0x8')]=_0x163302[_0x840c('0x8')];this[_0x840c('0x9')]=_0x163302[_0x840c('0x8')]===_0x840c('0xa')?_0x840c('0xb'):_0x163302['type'];this[_0x840c('0xc')]=_0x163302[_0x840c('0xc')];this[_0x840c('0xd')]=_0x163302['countcongestionretry'];this[_0x840c('0xe')]=_0x163302['countnoanswerretry'];this[_0x840c('0xf')]=_0x163302[_0x840c('0xc')]+_0x163302[_0x840c('0xd')]+_0x163302[_0x840c('0xe')]+_0x163302[_0x840c('0x10')]+_0x163302[_0x840c('0x11')]+_0x163302[_0x840c('0x12')]+_0x163302[_0x840c('0x13')]+_0x163302[_0x840c('0x14')];this[_0x840c('0x10')]=_0x163302['countnosuchnumberretry'];this[_0x840c('0x11')]=_0x163302[_0x840c('0x11')];this[_0x840c('0x12')]=_0x163302[_0x840c('0x12')];this[_0x840c('0x13')]=_0x163302[_0x840c('0x13')];this[_0x840c('0x14')]=_0x163302[_0x840c('0x14')];this[_0x840c('0x15')]=_0x15fed3[_0x840c('0x15')];this[_0x840c('0x16')]=_0x163302[_0x840c('0x17')];this[_0x840c('0x18')]=_0x163302[_0x840c('0x19')];this['starttime']=_0x163302['starttime'];this[_0x840c('0x1a')]=_0x163302[_0x840c('0x1a')];this[_0x840c('0x1b')]=moment()['format'](_0x840c('0x1c'));this[_0x840c('0x1d')]=getSeconds(_0x163302[_0x840c('0x1a')],_0x163302[_0x840c('0x1e')]);this[_0x840c('0x1f')]=0x0;this[_0x840c('0x20')]=getSeconds(this[_0x840c('0x1b')],_0x163302['responsetime']);this['queue']=_0x163302[_0x840c('0xb')];this[_0x840c('0x21')]=_0x840c('0x22');this['reason']=_0x15fed3[_0x840c('0x23')];this['callback']=_0x163302['callback'];this[_0x840c('0x24')]=_0x163302[_0x840c('0x24')];this['callbackat']=_0x163302[_0x840c('0x25')];this['recallme']=_0x163302[_0x840c('0x26')];this[_0x840c('0x27')]=_0x163302['ContactId'];this[_0x840c('0x28')]=_0x163302[_0x840c('0x28')];this['UserId']=_0x163302[_0x840c('0x29')];this[_0x840c('0x2a')]=_0x163302['VoiceQueueId'];this[_0x840c('0x2b')]=_0x163302[_0x840c('0x2b')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index ae49a3c..4749922 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 _0x289d=['seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number','responsetime','endtime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x289d,0xbf));var _0xd289=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x289d[_0x4d07cc];return _0x42de3b;};'use strict';var util=require(_0xd289('0x0'));var _=require('lodash');var moment=require(_0xd289('0x1'));function getSeconds(_0x32d106,_0xc9d5a1){var _0x1bafeb=moment(_0x32d106)[_0xd289('0x2')](0x0);var _0x3b12f0=moment(_0xc9d5a1)[_0xd289('0x2')](0x0);return _0x1bafeb[_0xd289('0x3')](_0x3b12f0,_0xd289('0x4'));}function History(_0x55fdc5){this[_0xd289('0x5')]=_0x55fdc5[_0xd289('0x5')];this[_0xd289('0x6')]=_0x55fdc5['scheduledat']||undefined;this[_0xd289('0x7')]=_0x55fdc5[_0xd289('0x7')];this[_0xd289('0x8')]=_0x55fdc5[_0xd289('0x7')]===_0xd289('0x9')?_0xd289('0xa'):_0x55fdc5[_0xd289('0x7')];this[_0xd289('0xb')]=_0x55fdc5[_0xd289('0xb')];this['countcongestionretry']=_0x55fdc5['countcongestionretry'];this[_0xd289('0xc')]=_0x55fdc5[_0xd289('0xc')];this[_0xd289('0xd')]=_0x55fdc5[_0xd289('0xb')]+_0x55fdc5[_0xd289('0xe')]+_0x55fdc5[_0xd289('0xc')]+_0x55fdc5['countnosuchnumberretry']+_0x55fdc5[_0xd289('0xf')]+_0x55fdc5[_0xd289('0x10')]+_0x55fdc5[_0xd289('0x11')]+_0x55fdc5[_0xd289('0x12')];this[_0xd289('0x13')]=_0x55fdc5[_0xd289('0x13')];this[_0xd289('0xf')]=_0x55fdc5[_0xd289('0xf')];this[_0xd289('0x10')]=_0x55fdc5[_0xd289('0x10')];this['countmachineretry']=_0x55fdc5[_0xd289('0x11')];this['countagentrejectretry']=_0x55fdc5[_0xd289('0x12')];this['queue']=_0x55fdc5[_0xd289('0xa')];this[_0xd289('0x14')]=_0x55fdc5[_0xd289('0x15')];this[_0xd289('0x16')]=_0x55fdc5[_0xd289('0x17')];this['starttime']=_0x55fdc5['starttime'];this[_0xd289('0x18')]=_0x55fdc5[_0xd289('0x18')];this[_0xd289('0x19')]=_0x55fdc5[_0xd289('0x18')];this[_0xd289('0x1a')]=getSeconds(_0x55fdc5[_0xd289('0x18')],_0x55fdc5['starttime']);this['holdtime']=0x0;this['talktime']=0x0;this[_0xd289('0x1b')]=_0x55fdc5[_0xd289('0x1b')];this['callbackuniqueid']=_0x55fdc5[_0xd289('0x1c')];this[_0xd289('0x1d')]=_0x55fdc5[_0xd289('0x1d')];this['recallme']=_0x55fdc5[_0xd289('0x1e')];this['ContactId']=_0x55fdc5[_0xd289('0x1f')];this[_0xd289('0x20')]=_0x55fdc5[_0xd289('0x20')];this['UserId']=_0x55fdc5[_0xd289('0x21')];this[_0xd289('0x22')]=_0x55fdc5[_0xd289('0x22')];this['CampaignId']=_0x55fdc5[_0xd289('0x23')];this['originatecalleridnum']=_0x55fdc5[_0xd289('0x24')]||'';this[_0xd289('0x25')]=_0x55fdc5['originatecalleridname']||'';}module[_0xd289('0x26')]=History; \ No newline at end of file +var _0x5847=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','responsetime','ringtime','starttime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x3f0f5a,_0x392903){var _0xe6500a=function(_0x4332bc){while(--_0x4332bc){_0x3f0f5a['push'](_0x3f0f5a['shift']());}};_0xe6500a(++_0x392903);}(_0x5847,0xf5));var _0x7584=function(_0x5e8f24,_0x259efe){_0x5e8f24=_0x5e8f24-0x0;var _0x3d1b33=_0x5847[_0x5e8f24];return _0x3d1b33;};'use strict';var util=require(_0x7584('0x0'));var _=require(_0x7584('0x1'));var moment=require(_0x7584('0x2'));function getSeconds(_0x3602d3,_0x3debef){var _0x223e75=moment(_0x3602d3)[_0x7584('0x3')](0x0);var _0x424a77=moment(_0x3debef)[_0x7584('0x3')](0x0);return _0x223e75[_0x7584('0x4')](_0x424a77,'seconds');}function History(_0x589988){this[_0x7584('0x5')]=_0x589988['uniqueid'];this[_0x7584('0x6')]=_0x589988[_0x7584('0x6')]||undefined;this[_0x7584('0x7')]=_0x589988['type'];this[_0x7584('0x8')]=_0x589988[_0x7584('0x7')]===_0x7584('0x9')?_0x7584('0xa'):_0x589988[_0x7584('0x7')];this[_0x7584('0xb')]=_0x589988['countbusyretry'];this[_0x7584('0xc')]=_0x589988['countcongestionretry'];this[_0x7584('0xd')]=_0x589988['countnoanswerretry'];this[_0x7584('0xe')]=_0x589988[_0x7584('0xb')]+_0x589988['countcongestionretry']+_0x589988[_0x7584('0xd')]+_0x589988[_0x7584('0xf')]+_0x589988[_0x7584('0x10')]+_0x589988['countabandonedretry']+_0x589988['countmachineretry']+_0x589988['countagentrejectretry'];this[_0x7584('0xf')]=_0x589988[_0x7584('0xf')];this['countdropretry']=_0x589988[_0x7584('0x10')];this[_0x7584('0x11')]=_0x589988['countabandonedretry'];this['countmachineretry']=_0x589988[_0x7584('0x12')];this[_0x7584('0x13')]=_0x589988['countagentrejectretry'];this[_0x7584('0xa')]=_0x589988['queue'];this[_0x7584('0x14')]=_0x589988[_0x7584('0x15')];this[_0x7584('0x16')]=_0x589988['number'];this['starttime']=_0x589988['starttime'];this[_0x7584('0x17')]=_0x589988[_0x7584('0x17')];this['endtime']=_0x589988['responsetime'];this[_0x7584('0x18')]=getSeconds(_0x589988[_0x7584('0x17')],_0x589988[_0x7584('0x19')]);this[_0x7584('0x1a')]=0x0;this[_0x7584('0x1b')]=0x0;this['callback']=_0x589988[_0x7584('0x1c')];this[_0x7584('0x1d')]=_0x589988[_0x7584('0x1d')];this[_0x7584('0x1e')]=_0x589988['callbackat'];this[_0x7584('0x1f')]=_0x589988[_0x7584('0x1f')];this['ContactId']=_0x589988[_0x7584('0x20')];this[_0x7584('0x21')]=_0x589988[_0x7584('0x21')];this[_0x7584('0x22')]=_0x589988[_0x7584('0x22')];this[_0x7584('0x23')]=_0x589988[_0x7584('0x23')];this[_0x7584('0x24')]=_0x589988[_0x7584('0x24')];this[_0x7584('0x25')]=_0x589988[_0x7584('0x25')]||'';this['originatecalleridname']=_0x589988[_0x7584('0x26')]||'';}module[_0x7584('0x27')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index ccc6634..8fb937d 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 _0x518d=['tags','createdAt','updatedAt','%s%s','XMD-','toUpper','TrunkBackup','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','trim','dialCutDigit','substring','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','reason\x205\x20busy','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose]','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','emptyContact','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Ts\x20=\x20','[busyFactor]','Umin\x20=\x20','exports','util','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','defaults','localhost','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./agentComplete','./hangup','env','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','isEmpty','INTERVAL_IS_NULL','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','ivr','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','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','stack','inspect','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','debug','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','state','statedesc','endtime','starttime','clearZombieChannels','[actions]','isNil','status','channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','swapAdditionalPhones','resolve','[swapAdditionalPhone]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','undefined','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','saveInDb','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','Success','SIP/%s','reachable','uniqueid','variable','amdstatus','value','outboundAnswerAgiCallsDay','membername','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','AMD','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr]','add','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','Unknow','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','Drop','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actions','strategy','actionid','locked','stateinterface','push','pick','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','timezones','\x20Timezone\x20unknow\x20','isArray','length','Action','iftime\x20%s,%s','interval','content','indexOf','true','command','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','checkDialMethod','progressive','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:dialPreviewRecallReminder','handleIvr','syncQueueSummary','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','throttle','filter','dialPreviewRecallmeReminder','online','user:%s','syncCampaigns','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','getCaller','ACTIVE','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-CAMPAIGNID','Contact'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x518d,0x95));var _0xd518=function(_0x256077,_0x5da5de){_0x256077=_0x256077-0x0;var _0x144e2b=_0x518d[_0x256077];return _0x144e2b;};'use strict';var util=require(_0xd518('0x0'));var _=require('lodash');var uuid=require(_0xd518('0x1'));var moment=require(_0xd518('0x2'));var rr=require('rr');var md5=require(_0xd518('0x3'));var Redis=require(_0xd518('0x4'));var ut=require(_0xd518('0x5'));var config=require(_0xd518('0x6'));var logger=require(_0xd518('0x7'))(_0xd518('0x8'));var loggerBooked=require(_0xd518('0x7'))(_0xd518('0x9'));var loggerPredictive=require('../../../config/logger')(_0xd518('0xa'));var loggerPredictiveCalls=require(_0xd518('0x7'))(_0xd518('0xb'));var loggerSyncQueueSummary=require(_0xd518('0x7'))('syncQueueSummary');var ami=require(_0xd518('0xc'));config[_0xd518('0xd')]=_[_0xd518('0xe')](config[_0xd518('0xd')],{'host':_0xd518('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd518('0xd')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xd518('0x10'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0xd518('0x11'));var voiceQueueRt=require(_0xd518('0x12'));var RpcSetting=require('../rpc/setting');var Action=require(_0xd518('0x13'));var History=require('./history');var Final=require(_0xd518('0x14'));var AgentComplete=require(_0xd518('0x15'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0xd518('0x16'));var ipAgi=process[_0xd518('0x17')][_0xd518('0x18')]||'127.0.0.1';var strategy={'rrmemory':_0xd518('0x19'),'roundrobin':_0xd518('0x1a')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xd518('0x1b')][_0xd518('0x1c')]=function(_0x33fc30){this[_0xd518('0x1d')]=this[_0xd518('0x1d')]?this[_0xd518('0x1d')][_0xd518('0x1e')](_0x33fc30):_0x33fc30();};function Dialer(_0x17451d,_0x1eae47){this[_0xd518('0x1f')]=new Sequence();this[_0xd518('0x20')]=_0x1eae47;this[_0xd518('0x21')]=_0x17451d[_0xd518('0x21')];this['campaigns']=_0x17451d[_0xd518('0x22')];this['agents']=_0x17451d[_0xd518('0x23')];this[_0xd518('0x24')]=_0x17451d[_0xd518('0x24')];this['maxNumberOriginate']=config[_0xd518('0x25')]||0x2;this[_0xd518('0x26')]={};this['actions']={};this[_0xd518('0x27')]={};this[_0xd518('0x28')]={};this['optionPredictive']={};this[_0xd518('0x29')]={};this[_0xd518('0x2a')]={};this[_0xd518('0x2b')]={};this[_0xd518('0x2c')]={};this[_0xd518('0x2d')]={};ami['on'](_0xd518('0x2e'),this[_0xd518('0x2f')]['bind'](this));ami['on'](_0xd518('0x30'),this[_0xd518('0x31')][_0xd518('0x32')](this));ami['on'](_0xd518('0x33'),this[_0xd518('0x34')]['bind'](this));ami['on'](_0xd518('0x35'),this['syncAgentComplete']['bind'](this));ami['on'](_0xd518('0x36'),this['syncQueueSummary'][_0xd518('0x32')](this));ami['on'](_0xd518('0x37'),this[_0xd518('0x38')][_0xd518('0x32')](this));ami['on'](_0xd518('0x39'),this['syncHangup'][_0xd518('0x32')](this));ami['on'](_0xd518('0x3a'),this[_0xd518('0x3b')][_0xd518('0x32')](this));ami['on']('varset',this[_0xd518('0x3c')][_0xd518('0x32')](this));ami['on'](_0xd518('0x3d'),this[_0xd518('0x3e')]['bind'](this));ami['on']('queuestatuscomplete',this[_0xd518('0x3f')][_0xd518('0x32')](this));this[_0xd518('0x40')]();this[_0xd518('0x41')]();RpcSetting[_0xd518('0x42')]()[_0xd518('0x43')](function(_0x55795c){previewRecallmeReminderInterval=_0x55795c[_0xd518('0x44')];});}function isNotNull(_0x2cff47){return _0x2cff47!==null&&!_[_0xd518('0x45')](_0x2cff47);}function checkIsLoggedIn(_0x342d61,_0x204baa){return function(){if(_0x204baa<=0x0){_0x342d61[_0xd518('0x46')]='AGENTS_NOT_LOGGED';throw _0x342d61[_0xd518('0x47')]+_0xd518('0x48');}};}function isActive(_0x4c1e26){return _0x4c1e26;}function checkIsActive(_0xa06daa,_0x4062d9){return function(){if(!isActive(_0x4062d9)){_0xa06daa[_0xd518('0x46')]=_0xd518('0x49');throw _0xa06daa['name']+_0xd518('0x4a');}};}function checkInterval(_0x3a53cc){return function(){if(!isNotNull(_0x3a53cc[_0xd518('0x4b')])){_0x3a53cc[_0xd518('0x46')]='INTERVAL_IS_NULL';throw _0x3a53cc[_0xd518('0x47')]+_0xd518('0x4c');}if(!isNotNull(_0x3a53cc[_0xd518('0x4b')][_0xd518('0x4d')])){_0x3a53cc['message']='INTERVAL_IS_NULL';throw _0x3a53cc[_0xd518('0x47')]+_0xd518('0x4c');}if(!isNotNull(_[_0xd518('0x4e')](_0x3a53cc[_0xd518('0x4b')]['Intervals']))){_0x3a53cc[_0xd518('0x46')]=_0xd518('0x4f');throw _0x3a53cc[_0xd518('0x47')]+_0xd518('0x4c');}};}function msgResponse(_0x3fc2fa,_0x41c7f2,_0x1918af){return{'action':_0x3fc2fa,'response':_0x41c7f2,'message':_0x1918af,'stack':_0x1918af};}function myreject(_0x580352){return function(_0x27e2cf){return _0x580352(msgResponse(_0xd518('0x50'),_0xd518('0x51'),JSON[_0xd518('0x52')](_0x27e2cf)));};}function getSeconds(_0x13c2d2,_0x2bcd70){var _0x1bb6aa=moment(_0x13c2d2)[_0xd518('0x53')](0x0);var _0xfde308=moment(_0x2bcd70)[_0xd518('0x53')](0x0);return _0x1bb6aa[_0xd518('0x54')](_0xfde308,_0xd518('0x55'));}function emit(_0x230bc4,_0x5ac840,_0x3c33c0){io['to'](_0x230bc4)['emit'](_0x5ac840,_0x3c33c0);}function emitVoiceQueueSummary(_0x848a72){if(_0x848a72[_0xd518('0x56')]===_0xd518('0x57')){var _0x17b328={'id':_0x848a72['id'],'name':_0x848a72[_0xd518('0x47')],'strategy':_0x848a72['strategy'],'answered':_0x848a72[_0xd518('0x58')],'available':_0x848a72[_0xd518('0x59')],'loggedIn':_0x848a72[_0xd518('0x5a')],'pTalking':_0x848a72[_0xd518('0x5b')],'sumBillable':_0x848a72[_0xd518('0x5c')],'sumDuration':_0x848a72[_0xd518('0x5d')],'sumHoldTime':_0x848a72[_0xd518('0x5e')]||0x0,'talking':_0x848a72[_0xd518('0x5f')],'total':_0x848a72[_0xd518('0x60')],'type':_0x848a72['type'],'unmanaged':_0x848a72[_0xd518('0x61')],'abandoned':_0x848a72['abandoned'],'waiting':_0x848a72[_0xd518('0x62')],'loggedInDb':_0x848a72[_0xd518('0x63')],'dialActive':_0x848a72[_0xd518('0x64')],'dialMethod':_0x848a72[_0xd518('0x65')],'dialOriginateCallerIdName':_0x848a72[_0xd518('0x66')],'dialOriginateCallerIdNumber':_0x848a72[_0xd518('0x67')],'dialOriginateTimeout':_0x848a72['dialOriginateTimeout'],'dialPrefix':_0x848a72[_0xd518('0x68')],'outboundAnswerAgiCallsDay':_0x848a72['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x848a72[_0xd518('0x69')],'outboundBlacklistCallsDay':_0x848a72[_0xd518('0x6a')],'outboundBusyCallsDay':_0x848a72['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x848a72[_0xd518('0x6b')],'outboundDropCallsDayACS':_0x848a72['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x848a72[_0xd518('0x6c')],'outboundDropCallsDayTimeout':_0x848a72[_0xd518('0x6d')],'outboundNoAnswerCallsDay':_0x848a72[_0xd518('0x6e')],'outboundNoSuchCallsDay':_0x848a72[_0xd518('0x6f')],'outboundOriginateFailureCallsDay':_0x848a72[_0xd518('0x70')],'outboundReCallsDay':_0x848a72[_0xd518('0x71')],'outboundRejectCallsDay':_0x848a72[_0xd518('0x72')],'outboundUnknownCallsDay':_0x848a72[_0xd518('0x73')],'predictiveIntervalAnsweredCalls':_0x848a72[_0xd518('0x74')],'predictiveIntervalAvgHoldtime':_0x848a72[_0xd518('0x75')],'predictiveIntervalAvgTalktime':_0x848a72[_0xd518('0x76')],'predictiveIntervalDroppedCallsCallersExit':_0x848a72['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x848a72[_0xd518('0x77')],'predictiveIntervalErlangCalls':_0x848a72['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x848a72[_0xd518('0x78')],'predictiveIntervalHitRate':_0x848a72[_0xd518('0x79')],'predictiveIntervalMultiplicativeFactor':_0x848a72['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x848a72[_0xd518('0x7a')],'predictiveIntervalAvailable':_0x848a72[_0xd518('0x7b')],'predictiveIntervalTotalCalls':_0x848a72['predictiveIntervalTotalCalls'],'message':_0x848a72[_0xd518('0x46')],'originated':_0x848a72[_0xd518('0x7c')],'erlangCalls':_0x848a72['erlangCalls'],'erlangCallToSecond':_0x848a72['erlangCallToSecond'],'erlangAbandonmentRate':_0x848a72['erlangAbandonmentRate'],'erlangBusyFactor':_0x848a72[_0xd518('0x7d')],'startPredictive':_0x848a72[_0xd518('0x29')],'startProgressive':_0x848a72['startProgressive']};if(_0x848a72[_0xd518('0x7e')]){_0x17b328['Trunk']={'id':_0x848a72[_0xd518('0x7e')]['id'],'name':_0x848a72[_0xd518('0x7e')][_0xd518('0x47')],'active':_0x848a72[_0xd518('0x7e')][_0xd518('0x7f')],'callerid':_0x848a72['Trunk'][_0xd518('0x80')]};}if(_0x848a72[_0xd518('0x4b')]){_0x17b328['Interval']={'id':_0x848a72[_0xd518('0x4b')]['id'],'name':_0x848a72[_0xd518('0x4b')]['name']};}var _0xc947fc=md5(JSON['stringify'](_0x17b328));if(_0x848a72[_0xd518('0x3')]!==_0xc947fc){_0x848a72[_0xd518('0x3')]=_0xc947fc;emit(util[_0xd518('0x81')](_0xd518('0x82'),_0x17b328[_0xd518('0x47')]),'voice_queue:save',_0x17b328);}}}function emitCampaignSummary(_0x1e47d1){if(_0x1e47d1[_0xd518('0x56')]===_0xd518('0x83')){emit(util[_0xd518('0x81')]('campaign:ivr:%s',_0x1e47d1[_0xd518('0x47')]),'campaign:save',_0x1e47d1);}}function checkGetDataPredictive(_0x5d3835){if(isNotNull(_0x5d3835)&&!_[_0xd518('0x4e')](_0x5d3835)){loggerPredictive[_0xd518('0x84')](_0xd518('0x85'));loggerPredictive[_0xd518('0x84')](_0xd518('0x86'),_0x5d3835[_0xd518('0x87')]);loggerPredictive[_0xd518('0x84')](_0xd518('0x88'),_0x5d3835[_0xd518('0x74')]);loggerPredictive['info'](_0xd518('0x89'),_0x5d3835['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0xd518('0x8a'),_0x5d3835[_0xd518('0x8b')]);loggerPredictive['info'](_0xd518('0x8c'),_0x5d3835['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xd518('0x84')](_0xd518('0x8d'),_0x5d3835['predictiveIntervalAvgTalktime']);loggerPredictive[_0xd518('0x84')]('---------------------------');if(_0x5d3835[_0xd518('0x87')]>0x0){if(!_[_0xd518('0x45')](_0x5d3835[_0xd518('0x76')])&&_0x5d3835['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xd518('0x84')](_0xd518('0x8e'));if(!_[_0xd518('0x45')](_0x5d3835[_0xd518('0x75')])&&_0x5d3835[_0xd518('0x75')]>0x0){return!![];}loggerPredictive['info'](_0xd518('0x8f'));}else{loggerPredictive[_0xd518('0x84')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xd518('0x84')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5e5640){return function(_0x54ef1f){loggerPredictive[_0xd518('0x84')](_0xd518('0x90'));loggerPredictive[_0xd518('0x84')](_0xd518('0x91'),_0x54ef1f[_0xd518('0x92')]);loggerPredictive['info'](_0xd518('0x93'),_0x54ef1f['erlangCallToSecond']);loggerPredictive[_0xd518('0x84')](_0xd518('0x94'),_0x54ef1f[_0xd518('0x95')]);loggerPredictive[_0xd518('0x84')](_0xd518('0x96'),_0x54ef1f['erlangBusyFactor']);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54ef1f[_0xd518('0x95')]);loggerPredictive[_0xd518('0x84')](_0xd518('0x97'));_[_0xd518('0x98')](_0x5e5640,_0x54ef1f);};}function getDiff(_0xaafad7){var _0x162442=moment()[_0xd518('0x53')](0x0);var _0x317b50=moment(_0xaafad7)[_0xd518('0x53')](0x0);return _0x162442['diff'](_0x317b50,_0xd518('0x55'));}function ifInterval(_0x30ff51,_0x398804){if(_[_0xd518('0x45')](_0x398804)){return![];}return getDiff(_0x398804)<_0x30ff51*0x3c;}function freeVariablesPredictive(_0x30b71e){if(isNotNull(_0x30b71e)){if(!_['isUndefined'](_0x30b71e[_0xd518('0x2a')])){_0x30b71e[_0xd518('0x2a')]=undefined;loggerPredictive['info'](_0x30b71e['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xd518('0x45')](_0x30b71e[_0xd518('0x29')])){_0x30b71e[_0xd518('0x29')]=undefined;loggerPredictive['info'](_0x30b71e[_0xd518('0x47')],_0xd518('0x99'));}if(!_[_0xd518('0x45')](_0x30b71e[_0xd518('0x9a')])){clearInterval(_0x30b71e[_0xd518('0x9a')]);_0x30b71e[_0xd518('0x9a')]=undefined;loggerPredictive['info'](_0x30b71e[_0xd518('0x47')],_0xd518('0x9b'));}}}function erlangb(_0x1b99ce,_0x16202e){if(_0x16202e===0x0){return 0x0;}var _0x1ec795=0x1;for(var _0x5eac67=0x1;_0x5eac67<=_0x16202e;_0x5eac67+=0x1){_0x1ec795=0x1+_0x1ec795*_0x5eac67/_0x1b99ce;}return 0x1/_0x1ec795;}function isVoiceQueueOutbound(_0x16bbaa){return _0x16bbaa===_0xd518('0x57');}function isNotPreview(_0xc8287){return _0xc8287!==_0xd518('0x20');}function isCampaignIvr(_0x19feae){return _0x19feae===_0xd518('0x83');}function getCallerId(_0x273ee5,_0x3f611c,_0x5b15f0){if(!_['isUndefined'](_0x5b15f0)&&typeof _0x5b15f0===_0xd518('0x9c')&&!_[_0xd518('0x4e')](_0x5b15f0)){if(!_[_0xd518('0x45')](_0x3f611c)&&typeof _0x3f611c===_0xd518('0x9c')&&!_[_0xd518('0x4e')](_0x3f611c)){return util[_0xd518('0x81')]('\x22%s\x22\x20<%s>',_0x3f611c,_0x5b15f0);}return util[_0xd518('0x81')](_0xd518('0x9d'),_0x5b15f0,_0x5b15f0);}if(!_[_0xd518('0x45')](_0x273ee5)&&typeof _0x273ee5===_0xd518('0x9c')&&!_[_0xd518('0x4e')](_0x273ee5)){return _0x273ee5;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x13c2dc,_0x55512a){return function(_0x15074b){freeVariablesPredictive(_0x55512a);emitVoiceQueueSummary(_0x55512a);emitCampaignSummary(_0x55512a);loggerSyncQueueSummary['debug'](_0x13c2dc,util['inspect'](_0x15074b,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2ed8c1,_0x190deb){return function(_0x2d7040){loggerPredictive[_0xd518('0x9e')](_0x190deb['name'],_0x2ed8c1);loggerPredictive['error'](_0x2d7040[_0xd518('0x9f')]);freeVariablesPredictive(_0x190deb);};}function loggerCatch(_0x377398){return function(_0x43e20c){logger[_0xd518('0x9e')](_0x377398,util[_0xd518('0xa0')](_0x43e20c,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4be65e){return _0x4be65e&&!_[_0xd518('0x45')](_0x4be65e)&&_0x4be65e['length']>0x0;}function decremetOriginate(_0x4e5a93){if(!_[_0xd518('0x45')](_0x4e5a93)&&_0x4e5a93!==null){if(typeof _0x4e5a93[_0xd518('0x7c')]!=='undefined'){if(_0x4e5a93['originated']>0x0){_0x4e5a93['originated']-=0x1;}else{logger[_0xd518('0x9e')](_0xd518('0xa1'));}}}else{logger[_0xd518('0x9e')](_0xd518('0xa2'));}}function checkContactLowerLimitOriginate(_0x2d733c,_0x3c9203,_0xc90a53){if(_0x3c9203>_0xc90a53){for(var _0x2cd591=0x0;_0x2cd591<_0x3c9203-_0xc90a53;_0x2cd591+=0x1){decremetOriginate(_0x2d733c);}}}function loggerGetContactDialer(_0x430367,_0x3eeb7c,_0x2196c3){return function(_0x68add5){checkContactLowerLimitOriginate(_0x3eeb7c,_0x2196c3,0x0);logger[_0xd518('0x9e')](_0x430367,util['inspect'](_0x68add5,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5c0430){return function(_0x38d4ed){if(isNotNull(_0x38d4ed)&&isNotNull(_0x38d4ed[0x0])){if(_0x38d4ed[0x0][_0xd518('0xa3')]>0x0){_0x5c0430[_0xd518('0x46')]='RESCHEDULED_CONTACTS';logger[_0xd518('0x84')](_0xd518('0xa4')+_0x5c0430[_0xd518('0x47')],_0x38d4ed[0x0][_0xd518('0xa3')],_0xd518('0xa5'));}else{_0x5c0430['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xd518('0x84')](_0xd518('0xa6')+_0x5c0430['name']);}}};}function notSendMessagesQueue(_0x1886b4){if(_0x1886b4[_0xd518('0xa7')]){freeVariablesPredictive(_0x1886b4);if(_0x1886b4[_0xd518('0x7c')]===0x0&&_0x1886b4['talking']===0x0&&_0x1886b4[_0xd518('0x62')]===0x0&&(_0x1886b4['pTalking']||0x0)===0x0){_0x1886b4['sendMessageOneNotActive']=![];_0x1886b4[_0xd518('0x59')]=0x0;_0x1886b4[_0xd518('0x46')]=_0xd518('0x49');loggerSyncQueueSummary[_0xd518('0xa8')](_0xd518('0xa9'),_0x1886b4[_0xd518('0x47')],'is\x20not\x20active');}else{_0x1886b4[_0xd518('0x46')]='IS_DISACTIVED';loggerSyncQueueSummary['debug'](_0xd518('0xa9'),_0x1886b4[_0xd518('0x47')],_0xd518('0xaa'));}emitVoiceQueueSummary(_0x1886b4);}}function notSendMessagesCampaign(_0x437baa){if(_0x437baa[_0xd518('0xa7')]){if(_0x437baa[_0xd518('0x7c')]===0x0){_0x437baa[_0xd518('0xa7')]=![];_0x437baa['message']=_0xd518('0x49');loggerSyncQueueSummary[_0xd518('0xa8')](_0xd518('0xab'),_0x437baa[_0xd518('0x47')],'is\x20not\x20active');}else{_0x437baa[_0xd518('0x46')]=_0xd518('0xac');loggerSyncQueueSummary[_0xd518('0xa8')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x437baa[_0xd518('0x47')],'is\x20disactive');}emitCampaignSummary(_0x437baa);}}function createObjHistory(_0x2c78c5,_0xcc450a,_0x190cd2,_0x33c453,_0x239867){_0x2c78c5[_0xd518('0x46')]=_0x190cd2;var _0x308dad=new Action(_0x2c78c5,_0xcc450a);var _0x6ab99b=new History(_0x308dad);_0x6ab99b[_0xd518('0xad')]=_0x33c453;_0x6ab99b[_0xd518('0xae')]=_0x239867;_0x6ab99b[_0xd518('0xaf')]=_0x308dad[_0xd518('0xb0')];return _0x6ab99b;}Dialer[_0xd518('0x1b')][_0xd518('0x41')]=function(){var _0x693b12=this;setInterval(function(){_0x693b12[_0xd518('0xb1')](_0x693b12[_0xd518('0x28')],'[uniqueid]');_0x693b12[_0xd518('0xb1')](_0x693b12['actions'],_0xd518('0xb2'));},0x32c8);};Dialer[_0xd518('0x1b')][_0xd518('0xb1')]=function(_0x5aa5d7,_0x236fe9){var _0x16d3b7=this;for(var _0xba005b in _0x5aa5d7){if(typeof _0x5aa5d7[_0xba005b]!=='undefined'){this['sequence'][_0xd518('0x1c')](function(){if(!_[_0xd518('0xb3')](_0x5aa5d7[_0xba005b])){return ami['Action']({'action':_0xd518('0xb4'),'channel':_0x5aa5d7[_0xba005b][_0xd518('0xb5')]})['catch'](function(_0x1f71f6){if(_0x1f71f6[_0xd518('0x46')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x5aa5d7[_0xba005b]&&_0x5aa5d7[_0xba005b]['type']!==_0xd518('0x83')){_0x16d3b7[_0xd518('0xb6')](_0x16d3b7['voiceQueues'][_0x5aa5d7[_0xba005b][_0xd518('0xb7')]]);logger['error'](_0xd518('0xb8'),_0x236fe9,_0xba005b,_0x5aa5d7[_0xba005b]['queue']);delete _0x5aa5d7[_0xba005b];}if(_0x5aa5d7[_0xba005b]&&_0x5aa5d7[_0xba005b][_0xd518('0x56')]==='ivr'){_0x16d3b7['updateOriginated'](_0x16d3b7['campaigns'][_0x5aa5d7[_0xba005b][_0xd518('0xb7')]]);logger[_0xd518('0x9e')](_0xd518('0xb9'),_0x236fe9,_0xba005b,_0x5aa5d7[_0xba005b]['queue']);delete _0x5aa5d7[_0xba005b];}},0x2328);}});}});}}};Dialer[_0xd518('0x1b')][_0xd518('0xba')]=function(_0x562a01){return Promise['resolve']()[_0xd518('0x43')](cmHopper[_0xd518('0xba')](_0x562a01))[_0xd518('0xbb')](loggerCatch(_0xd518('0xbc')));};Dialer[_0xd518('0x1b')]['checkIsBlackList']=function(_0x36a683){return Promise['resolve']()[_0xd518('0x43')](cmHopperBlack[_0xd518('0xbd')](_0x36a683))[_0xd518('0xbb')](loggerCatch(_0xd518('0xbe')));};Dialer['prototype']['verifyAdditionalPhones']=function(_0x564e29,_0xfb109b,_0x4500e6){return Promise['resolve']()[_0xd518('0x43')](cmHopperAdditionalPhone[_0xd518('0xbf')](_0x564e29,_0xfb109b,_0x4500e6))[_0xd518('0xbb')](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer[_0xd518('0x1b')][_0xd518('0xc0')]=function(_0x512706,_0x46f970,_0x4b422f){return Promise[_0xd518('0xc1')]()[_0xd518('0x43')](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x512706,_0x46f970,_0x4b422f))[_0xd518('0xbb')](loggerCatch(_0xd518('0xc2')));};Dialer[_0xd518('0x1b')][_0xd518('0xc3')]=function(_0x2d4da4){return Promise['resolve']()[_0xd518('0x43')](cmHopperBlack[_0xd518('0xc3')](_0x2d4da4))[_0xd518('0xbb')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xd518('0x1b')][_0xd518('0xc4')]=function(_0x5d497a){return Promise[_0xd518('0xc1')]()[_0xd518('0x43')](cmHopperHistory[_0xd518('0xc5')](_0x5d497a))['catch'](loggerCatch(_0xd518('0xc6')));};Dialer['prototype'][_0xd518('0xc7')]=function(_0xf1040a){return Promise[_0xd518('0xc1')]()[_0xd518('0x43')](cmHopper[_0xd518('0xc7')](_0xf1040a))[_0xd518('0xbb')](loggerCatch(_0xd518('0xc8')));};Dialer[_0xd518('0x1b')]['unlockContact']=function(_0x71d07b,_0x235a5f,_0x21af51){return Promise[_0xd518('0xc1')]()[_0xd518('0x43')](cmHopper[_0xd518('0xc9')](_0x71d07b,_0x235a5f,_0x21af51))[_0xd518('0xbb')](loggerCatch(_0xd518('0xca')));};Dialer[_0xd518('0x1b')]['getContactDialer']=function(_0xd2edc2,_0x2f4f1c,_0x5013ac,_0x4660a9,_0x15f28d){return Promise[_0xd518('0xc1')]()['then'](cmHopper[_0xd518('0xcb')](_0xd2edc2,_0x2f4f1c,_0x5013ac,_0x4660a9))['catch'](function(_0x108479){_0x15f28d[_0xd518('0xcc')]-=_0x5013ac;_0x15f28d[_0xd518('0xcc')]=_0x15f28d[_0xd518('0xcc')]>0x0?_0x15f28d[_0xd518('0xcc')]:0x0;loggerCatch(_0xd518('0xcd'))(_0x108479);});};Dialer['prototype'][_0xd518('0xce')]=function(_0x4f9649,_0x116b45,_0x1d859d,_0x42a8a0){return Promise[_0xd518('0xc1')]()['then'](cmHopper[_0xd518('0xce')](_0x4f9649,_0x116b45,_0x1d859d))['catch'](function(_0xe7af75){_0x42a8a0[_0xd518('0xcc')]-=_0x116b45;_0x42a8a0[_0xd518('0xcc')]=_0x42a8a0[_0xd518('0xcc')]>0x0?_0x42a8a0[_0xd518('0xcc')]:0x0;loggerCatch(_0xd518('0xcf'))(_0xe7af75);});};Dialer[_0xd518('0x1b')]['getVoiceQueueRtPauses']=function(_0x5ed3bb){return Promise[_0xd518('0xc1')]()[_0xd518('0x43')](voiceQueueRt['getVoiceQueueRtPauses'](_0x5ed3bb))[_0xd518('0xbb')](loggerCatch(_0xd518('0xd0')));};Dialer[_0xd518('0x1b')][_0xd518('0xd1')]=function(_0x5da8f0){return Promise[_0xd518('0xc1')]()[_0xd518('0x43')](cmHopper['moveContactManagedDialer'](_0x5da8f0))['catch'](loggerCatch(_0xd518('0xd2')));};Dialer['prototype']['createHistory']=function(_0x5e758d){return Promise[_0xd518('0xc1')]()[_0xd518('0x43')](cmHopperHistory[_0xd518('0xd3')](_0x5e758d))[_0xd518('0xbb')](loggerCatch(_0xd518('0xd4')));};Dialer[_0xd518('0x1b')][_0xd518('0xb6')]=function(_0x56d421){if(!_[_0xd518('0x45')](_0x56d421)&&_0x56d421!==null){if(typeof _0x56d421[_0xd518('0x7c')]!==_0xd518('0xd5')){if(_0x56d421[_0xd518('0x7c')]>0x0){_0x56d421[_0xd518('0x7c')]-=0x1;}else{logger['error'](_0xd518('0xd6'));}}}else{logger[_0xd518('0x9e')](_0xd518('0xd7'));}};Dialer[_0xd518('0x1b')][_0xd518('0xd8')]=function(_0x4e812e,_0x29e8d4){var _0xe536c5=this;return function(_0xd141d4){_0xe536c5[_0xd518('0xb6')](_0x29e8d4);logger[_0xd518('0x9e')](_0x4e812e,util[_0xd518('0xa0')](_0xd141d4,{'showHidden':![],'depth':null}));};};Dialer[_0xd518('0x1b')]['emptyContact']=function(_0x48c411,_0x53414f,_0x407fbf){var _0x90d34e={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x53414f);this[_0xd518('0xd9')](_[_0xd518('0x98')](_0x90d34e,_['pick'](_0x407fbf,[_0xd518('0xda'),_0xd518('0xdb'),_0xd518('0xdc'),_0xd518('0xdd'),_0xd518('0xde')])),'[emptyContact][createHistory]',_0xd518('0xdf'));logger[_0xd518('0x9e')](_0x48c411);};Dialer[_0xd518('0x1b')][_0xd518('0xe0')]=function(_0x4fa987){return _0x4fa987===_0xd518('0xe1');};Dialer[_0xd518('0x1b')]['isTrunkReachable']=function(_0x5d7904){return!_[_0xd518('0x45')](_0x5d7904)&&_0x5d7904&&!_[_0xd518('0x45')](_0x5d7904[_0xd518('0x47')])&&!_[_0xd518('0x45')](_0x5d7904['active'])&&_0x5d7904[_0xd518('0x7f')]&&(this[_0xd518('0x24')][util[_0xd518('0x81')](_0xd518('0xe2'),_0x5d7904[_0xd518('0x47')])]['status']===_0xd518('0xe3')||this['trunks'][util[_0xd518('0x81')]('SIP/%s',_0x5d7904[_0xd518('0x47')])][_0xd518('0xb4')]==='unmonitored');};Dialer[_0xd518('0x1b')][_0xd518('0xd9')]=function(_0x2ae25f,_0x23e85c,_0x2925fa){this[_0xd518('0xd3')](_0x2ae25f)['catch'](loggerCatch(_0x23e85c));this[_0xd518('0xd1')](_0x2ae25f)['catch'](loggerCatch(_0x2925fa));};Dialer[_0xd518('0x1b')][_0xd518('0x3c')]=function(_0x5ab7e2){var _0x27f44a=this;var _0x2bf710=this[_0xd518('0x28')][_0x5ab7e2[_0xd518('0xe4')]];var _0x173c0e;if(!_[_0xd518('0xb3')](_0x5ab7e2)&&!_[_0xd518('0xb3')](_0x5ab7e2[_0xd518('0xe5')])&&!_[_0xd518('0xb3')](_0x5ab7e2[_0xd518('0xe5')][_0xd518('0xe6')])&&_0x5ab7e2['exten']==='xcally-motion-dialer'&&_0x2bf710){if(_0x2bf710[_0xd518('0x56')]!=='ivr'&&this[_0xd518('0x21')][_0x2bf710[_0xd518('0xb7')]]['dialAMDActive']&&_0x5ab7e2[_0xd518('0xe7')]==='HANGUP'){delete this['uniqueId'][_0x5ab7e2['uniqueid']];this[_0xd518('0xb6')](this[_0xd518('0x21')][_0x2bf710[_0xd518('0xb7')]]);this[_0xd518('0x21')][_0x2bf710[_0xd518('0xb7')]][_0xd518('0x69')]+=0x1;this[_0xd518('0x21')][_0x2bf710[_0xd518('0xb7')]][_0xd518('0xe8')]+=0x1;_0x173c0e=new Hangup(_0x2bf710,_0x5ab7e2);_0x173c0e[_0xd518('0xad')]=0x12;_0x173c0e[_0xd518('0xae')]='HangupInAMD';_0x173c0e[_0xd518('0xe9')]='AMD';ami[_0xd518('0xea')](_0xd518('0xeb'),ut[_0xd518('0xec')](_0x173c0e,_0xd518('0xed')));this[_0xd518('0xd9')](_0x173c0e,_0xd518('0xee'),_0xd518('0xef'));}if(_0x2bf710['type']!=='ivr'&&this[_0xd518('0x21')][_0x2bf710[_0xd518('0xb7')]][_0xd518('0xf0')]&&_0x5ab7e2[_0xd518('0xe7')]===_0xd518('0xf1')){return new Promise(function(_0x1eafda,_0xa1ec9b){delete _0x27f44a[_0xd518('0x28')][_0x5ab7e2['uniqueid']];_0x27f44a[_0xd518('0xb6')](_0x27f44a[_0xd518('0x21')][_0x2bf710['queue']]);_0x27f44a[_0xd518('0x21')][_0x2bf710[_0xd518('0xb7')]]['outboundAnswerCallsDay']+=0x1;_0x27f44a[_0xd518('0x21')][_0x2bf710['queue']][_0xd518('0xe8')]+=0x1;var _0x2464d6=_0x27f44a[_0xd518('0x21')][_0x2bf710[_0xd518('0xb7')]];var _0x33e3e8=new Hangup(_0x2bf710,_0x5ab7e2);_0x33e3e8[_0xd518('0xad')]=0x13;_0x33e3e8[_0xd518('0xae')]=_0xd518('0xf2');_0x33e3e8['membername']=_0xd518('0xf3');_0x33e3e8['countmachineretry']+=0x1;_0x33e3e8[_0xd518('0xf4')]+=0x1;_0x33e3e8['amd']=!![];ami[_0xd518('0xea')](_0xd518('0xeb'),ut[_0xd518('0xec')](_0x33e3e8,_0xd518('0xed')));_0x27f44a[_0xd518('0xd3')](_0x33e3e8)[_0xd518('0xbb')](loggerCatch(_0xd518('0xf5')));if(_0x33e3e8[_0xd518('0xf6')]+_0x33e3e8[_0xd518('0xf7')]+_0x33e3e8[_0xd518('0xf8')]+_0x33e3e8[_0xd518('0xf9')]+_0x33e3e8[_0xd518('0xfa')]+_0x33e3e8[_0xd518('0xfb')]+_0x33e3e8[_0xd518('0xfc')]+_0x33e3e8[_0xd518('0xfd')]>=_0x2464d6[_0xd518('0xfe')]){_0x27f44a[_0xd518('0xff')](_0x33e3e8,_0x1eafda,_0xa1ec9b,_0xd518('0x100'));}else{if(_0x33e3e8[_0xd518('0xfc')]>=_0x2464d6[_0xd518('0x101')]){_0x27f44a[_0xd518('0x102')](_0x33e3e8,_0x1eafda,_0xa1ec9b,_0xd518('0x103'));}else{_0x27f44a[_0xd518('0xc7')]({'active':![],'countmachineretry':_0x33e3e8['countmachineretry'],'scheduledat':moment()['add'](_0x2464d6[_0xd518('0x104')],_0xd518('0x105'))[_0xd518('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33e3e8[_0xd518('0xda')],'ListId':_0x33e3e8[_0xd518('0xdb')],'VoiceQueueId':_0x33e3e8[_0xd518('0xdd')]||undefined,'CampaignId':_0x33e3e8[_0xd518('0xde')]||undefined})[_0xd518('0xbb')](loggerCatch(_0xd518('0x106')));_0x1eafda({'reschedule':0x1});}}});}if(_0x2bf710[_0xd518('0x56')]==='ivr'&&this['campaigns'][_0x2bf710[_0xd518('0xb7')]][_0xd518('0xf0')]&&_0x5ab7e2[_0xd518('0xe7')]===_0xd518('0x107')){delete this[_0xd518('0x28')][_0x5ab7e2[_0xd518('0xe4')]];this['updateOriginated'](this[_0xd518('0x22')][_0x2bf710[_0xd518('0xb7')]]);_0x173c0e=new Hangup(_0x2bf710,_0x5ab7e2);_0x173c0e['state']=0x12;_0x173c0e[_0xd518('0xae')]='HangupInAMD';_0x173c0e[_0xd518('0xe9')]=_0xd518('0xf3');ami[_0xd518('0xea')](_0xd518('0xeb'),ut[_0xd518('0xec')](_0x173c0e,_0xd518('0xed')));this['saveInDb'](_0x173c0e,'[syncHangupInAMDIvr][createHistory]',_0xd518('0x108'));}if(_0x2bf710[_0xd518('0x56')]===_0xd518('0x83')&&this[_0xd518('0x22')][_0x2bf710['queue']][_0xd518('0xf0')]&&_0x5ab7e2[_0xd518('0xe7')]===_0xd518('0xf1')){return new Promise(function(_0x3c8db7,_0x2f2b27){delete _0x27f44a[_0xd518('0x28')][_0x5ab7e2[_0xd518('0xe4')]];_0x27f44a[_0xd518('0xb6')](_0x27f44a['campaigns'][_0x2bf710[_0xd518('0xb7')]]);_0x27f44a[_0xd518('0x22')][_0x2bf710[_0xd518('0xb7')]]['outboundAnswerCallsDay']+=0x1;_0x27f44a[_0xd518('0x22')][_0x2bf710[_0xd518('0xb7')]][_0xd518('0xe8')]+=0x1;var _0x1cadfb=_0x27f44a[_0xd518('0x22')][_0x2bf710[_0xd518('0xb7')]];var _0x55b12f=new Hangup(_0x2bf710,_0x5ab7e2);_0x55b12f['state']=0x13;_0x55b12f[_0xd518('0xae')]='Machine';_0x55b12f['membername']=_0xd518('0xf3');_0x55b12f[_0xd518('0xfc')]+=0x1;_0x55b12f[_0xd518('0xf4')]+=0x1;_0x55b12f[_0xd518('0xed')]=!![];ami['emit'](_0xd518('0xeb'),ut[_0xd518('0xec')](_0x55b12f,'amd'));_0x27f44a['createHistory'](_0x55b12f)[_0xd518('0xbb')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x55b12f[_0xd518('0xf6')]+_0x55b12f[_0xd518('0xf7')]+_0x55b12f['countnoanswerretry']+_0x55b12f[_0xd518('0xf9')]+_0x55b12f['countdropretry']+_0x55b12f[_0xd518('0xfb')]+_0x55b12f['countmachineretry']+_0x55b12f[_0xd518('0xfd')]>=_0x1cadfb[_0xd518('0xfe')]){_0x27f44a[_0xd518('0xff')](_0x55b12f,_0x3c8db7,_0x2f2b27,_0xd518('0x100'));}else{if(_0x55b12f['countmachineretry']>=_0x1cadfb[_0xd518('0x101')]){_0x27f44a[_0xd518('0x102')](_0x55b12f,_0x3c8db7,_0x2f2b27,_0xd518('0x103'));}else{_0x27f44a[_0xd518('0xc7')]({'active':![],'countmachineretry':_0x55b12f[_0xd518('0xfc')],'scheduledat':moment()[_0xd518('0x109')](_0x1cadfb['dialMachineRetryFrequency'],'minutes')[_0xd518('0x81')](_0xd518('0x10a')),'ContactId':_0x55b12f[_0xd518('0xda')],'ListId':_0x55b12f[_0xd518('0xdb')],'VoiceQueueId':_0x55b12f[_0xd518('0xdd')]||undefined,'CampaignId':_0x55b12f[_0xd518('0xde')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x3c8db7({'reschedule':0x1});}}});}}};Dialer[_0xd518('0x1b')]['syncHangup']=function(_0x5cbbd5){var _0x2b9b85=this['uniqueId'][_0x5cbbd5[_0xd518('0xe4')]];var _0x578ee9;if(_0x2b9b85&&_0x2b9b85[_0xd518('0x56')]===_0xd518('0x83')){delete this[_0xd518('0x28')][_0x5cbbd5[_0xd518('0xe4')]];this[_0xd518('0xb6')](this[_0xd518('0x22')][_0x2b9b85[_0xd518('0xb7')]]);this[_0xd518('0x22')][_0x2b9b85[_0xd518('0xb7')]][_0xd518('0x10b')]+=0x1;_0x578ee9=new Hangup(_0x2b9b85,_0x5cbbd5);this[_0xd518('0xd3')](_0x578ee9)[_0xd518('0xbb')](loggerCatch(_0xd518('0x10c')));this[_0xd518('0xd1')](_0x578ee9)[_0xd518('0xbb')](loggerCatch('[syncHangupIvr]'));}if(_0x2b9b85&&_0x2b9b85[_0xd518('0x56')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x2b9b85[_0xd518('0xb7')]][_0xd518('0x10d')])){delete this[_0xd518('0x28')][_0x5cbbd5['uniqueid']];this[_0xd518('0xb6')](this[_0xd518('0x21')][_0x2b9b85[_0xd518('0xb7')]]);this[_0xd518('0x21')][_0x2b9b85[_0xd518('0xb7')]][_0xd518('0x69')]+=0x1;this[_0xd518('0x21')][_0x2b9b85[_0xd518('0xb7')]]['outboundAnswerAgiCallsDay']+=0x1;_0x578ee9=new Hangup(_0x2b9b85,_0x5cbbd5);_0x578ee9[_0xd518('0xad')]=0x10;_0x578ee9['statedesc']=_0xd518('0x10e');_0x578ee9['membername']=_0xd518('0x10f');this[_0xd518('0xd3')](_0x578ee9)[_0xd518('0xbb')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xd518('0xd1')](_0x578ee9)[_0xd518('0xbb')](loggerCatch(_0xd518('0x110')));}if(_0x2b9b85&&_0x2b9b85[_0xd518('0x56')]!==_0xd518('0x83')&&!isNotNull(this[_0xd518('0x21')][_0x2b9b85['queue']][_0xd518('0x10d')])){delete this[_0xd518('0x28')][_0x5cbbd5[_0xd518('0xe4')]];this[_0xd518('0xb6')](this['voiceQueues'][_0x2b9b85[_0xd518('0xb7')]]);this[_0xd518('0x21')][_0x2b9b85[_0xd518('0xb7')]][_0xd518('0x73')]+=0x1;_0x578ee9=new Hangup(_0x2b9b85,_0x5cbbd5);_0x578ee9[_0xd518('0xad')]=0xc;_0x578ee9[_0xd518('0xae')]=_0x5cbbd5[_0xd518('0x111')];_0x578ee9[_0xd518('0xe9')]=_0xd518('0x112');this[_0xd518('0xd3')](_0x578ee9)[_0xd518('0xbb')](loggerCatch(_0xd518('0x10c')));this[_0xd518('0xd1')](_0x578ee9)[_0xd518('0xbb')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xd518('0x1b')]['syncAgentComplete']=function(_0x54babf){var _0x894468=this[_0xd518('0x28')][_0x54babf['uniqueid']];if(this[_0xd518('0x21')][_0x54babf[_0xd518('0xb7')]]){if(_0x894468&&_0x894468[_0xd518('0x56')]!=='ivr'){delete this[_0xd518('0x28')][_0x54babf['uniqueid']];this['voiceQueues'][_0x54babf['queue']][_0xd518('0x69')]+=0x1;var _0x3bf95c=new AgentComplete(_0x894468,_0x54babf);if(_0x54babf[_0xd518('0x113')]==='agent'){_0x3bf95c[_0xd518('0x114')]=this['voiceQueues'][_0x54babf[_0xd518('0xb7')]][_0xd518('0x115')]&&this[_0xd518('0x21')][_0x54babf['queue']][_0xd518('0x116')]?moment()['format'](_0xd518('0x10a')):undefined;}this['createHistory'](_0x3bf95c)['catch'](loggerCatch(_0xd518('0x117')));this['moveContactManagedDialer'](_0x3bf95c)[_0xd518('0xbb')](loggerCatch(_0xd518('0x118')));}}};Dialer[_0xd518('0x1b')]['syncAgentConnect']=function(_0x45e425){if(this[_0xd518('0x21')][_0x45e425['queue']]){if(this['uniqueId'][_0x45e425[_0xd518('0xe4')]]&&this[_0xd518('0x28')][_0x45e425['uniqueid']][_0xd518('0x56')]!=='ivr'){this[_0xd518('0xb6')](this[_0xd518('0x21')][_0x45e425['queue']]);this[_0xd518('0x28')][_0x45e425[_0xd518('0xe4')]][_0xd518('0x119')]=moment()['format'](_0xd518('0x10a'));}}};Dialer[_0xd518('0x1b')][_0xd518('0x11a')]=function(_0x37d339,_0x391681){this[_0xd518('0xd3')](_0x37d339)[_0xd518('0xbb')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x391681==0x0){this[_0xd518('0xd1')](_0x37d339)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0xd518('0x1b')][_0xd518('0x31')]=function(_0x440642){var _0x2f88f2=this[_0xd518('0x28')][_0x440642['uniqueid']];var _0x481bfd=this;var _0x1f4ce3=![];var _0x824852;var _0x1b6f5e;if(this[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]]){if(_0x2f88f2&&_0x2f88f2['type']!==_0xd518('0x83')){delete this[_0xd518('0x28')][_0x440642[_0xd518('0xe4')]];this[_0xd518('0xb6')](this[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]]);_0x2f88f2[_0xd518('0x11b')]=moment()['format'](_0xd518('0x10a'));var _0x1c484f=new QueueCallerAbandon(_0x2f88f2,_0x440642);if(getSeconds(_0x2f88f2[_0xd518('0x11b')],_0x2f88f2[_0xd518('0x11c')])>=_0x2f88f2[_0xd518('0x11d')]){this[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x440642[_0xd518('0xb7')]][_0xd518('0x6d')]+=0x1;this[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]][_0xd518('0x78')]+=0x1;_0x1c484f['state']=0xa;_0x1c484f[_0xd518('0xae')]=_0xd518('0x11e');_0x1c484f['dropreason']=_0xd518('0x11f');_0x1c484f[_0xd518('0x114')]=this[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]]['dialQueueProject2']?moment()[_0xd518('0x81')](_0xd518('0x10a')):undefined;_0x1c484f['countdropretry']+=0x1;_0x1c484f[_0xd518('0xf4')]+=0x1;_0x824852=this[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]][_0xd518('0x120')];_0x1b6f5e=this['voiceQueues'][_0x440642[_0xd518('0xb7')]][_0xd518('0x121')];_0x481bfd[_0xd518('0xbf')](_0x1c484f,_0x1c484f[_0xd518('0xad')],_0x2f88f2[_0xd518('0x122')])[_0xd518('0x43')](function(_0x35a76b){_0x1f4ce3=_0x35a76b[_0xd518('0x123')]==0x1;if(_0x1c484f[_0xd518('0xfa')]>=_0x481bfd[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]][_0xd518('0x124')]){_0x481bfd['queueCallerAbandonCreateState'](_0x1c484f,_0x35a76b['additional']);}else{_0x481bfd[_0xd518('0xc7')]({'active':![],'countdropretry':_0x1c484f[_0xd518('0xfa')],'scheduledat':moment()[_0xd518('0x109')](_0x481bfd['voiceQueues'][_0x440642[_0xd518('0xb7')]][_0xd518('0x120')],_0xd518('0x105'))[_0xd518('0x81')](_0xd518('0x10a')),'ContactId':_0x2f88f2['ContactId'],'ListId':_0x2f88f2['ListId'],'VoiceQueueId':_0x2f88f2['VoiceQueueId']||undefined,'CampaignId':_0x2f88f2[_0xd518('0xde')]||undefined})[_0xd518('0xbb')](loggerCatch(_0xd518('0x125')));var _0x35e37b=new History(_0x1c484f);_0x35e37b['state']=0xa;_0x35e37b[_0xd518('0xae')]=_0xd518('0x11e');_0x35e37b[_0xd518('0xb0')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x35e37b[_0xd518('0xaf')]=_0x35e37b['starttime'];_0x35e37b[_0xd518('0x126')]=_0x1c484f[_0xd518('0x126')];_0x35e37b[_0xd518('0x127')]=_0x1c484f[_0xd518('0x127')];_0x481bfd[_0xd518('0xd3')](_0x35e37b)[_0xd518('0xbb')](loggerCatch(_0xd518('0x128')));}})['then'](function(){if(_0x1f4ce3)_0x481bfd[_0xd518('0xc0')](_0x1c484f,_0x824852,_0x1b6f5e)['then'](function(){return 0x1;});});}else{this[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]][_0xd518('0x8b')]+=0x1;this[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]]['outboundDropCallsDayCallersExit']+=0x1;_0x1c484f[_0xd518('0xad')]=0xb;_0x1c484f[_0xd518('0xae')]=_0xd518('0x129');_0x1c484f[_0xd518('0x12a')]=_0xd518('0x12b');_0x1c484f['countabandonedretry']+=0x1;_0x1c484f[_0xd518('0xf4')]+=0x1;_0x824852=this[_0xd518('0x21')][_0x440642['queue']][_0xd518('0x12c')];_0x1b6f5e=this[_0xd518('0x21')][_0x440642[_0xd518('0xb7')]][_0xd518('0x121')];_0x481bfd[_0xd518('0xbf')](_0x1c484f,_0x1c484f[_0xd518('0xad')],_0x2f88f2[_0xd518('0x122')])[_0xd518('0x43')](function(_0x1a09d8){if(_0x1c484f[_0xd518('0xfb')]>=_0x481bfd['voiceQueues'][_0x440642['queue']]['dialAbandonedMaxRetry']){_0x481bfd['queueCallerAbandonCreateState'](_0x1c484f,_0x1a09d8['additional']);}else{_0x481bfd[_0xd518('0xc7')]({'active':![],'countabandonedretry':_0x1c484f[_0xd518('0xfb')],'scheduledat':moment()['add'](_0x481bfd['voiceQueues'][_0x440642[_0xd518('0xb7')]][_0xd518('0x12c')],'minutes')[_0xd518('0x81')](_0xd518('0x10a')),'ContactId':_0x2f88f2[_0xd518('0xda')],'ListId':_0x2f88f2[_0xd518('0xdb')],'VoiceQueueId':_0x2f88f2[_0xd518('0xdd')]||undefined,'CampaignId':_0x2f88f2['CampaignId']||undefined})[_0xd518('0xbb')](loggerCatch(_0xd518('0x12d')));var _0x29c298=new History(_0x1c484f);_0x29c298[_0xd518('0xad')]=0xb;_0x29c298[_0xd518('0xae')]='Abandoned';_0x29c298[_0xd518('0xb0')]=moment()[_0xd518('0x81')](_0xd518('0x10a'));_0x29c298['endtime']=_0x29c298['starttime'];_0x29c298[_0xd518('0x126')]=_0x1c484f[_0xd518('0x126')];_0x29c298[_0xd518('0x127')]=_0x1c484f[_0xd518('0x127')];_0x481bfd[_0xd518('0xd3')](_0x29c298)[_0xd518('0xbb')](loggerCatch(_0xd518('0x12e')));}})['then'](function(){if(_0x1f4ce3)_0x481bfd[_0xd518('0xc0')](_0x1c484f,_0x824852,_0x1b6f5e)[_0xd518('0x43')](function(){return 0x1;});});}}}};Dialer['prototype'][_0xd518('0x3b')]=function(_0x3a655d){if(this['actions'][_0x3a655d[_0xd518('0xe4')]]){this[_0xd518('0x12f')][_0x3a655d[_0xd518('0xe4')]][_0xd518('0xb5')]=_0x3a655d['channel'];}if(this[_0xd518('0x28')][_0x3a655d[_0xd518('0xe4')]]){this[_0xd518('0x28')][_0x3a655d['uniqueid']][_0xd518('0xb5')]=_0x3a655d[_0xd518('0xb5')];}};Dialer[_0xd518('0x1b')][_0xd518('0x3e')]=function(_0xfd725){if(strategy[this[_0xd518('0x21')][this[_0xd518('0x12f')][_0xfd725['actionid']]['queue']][_0xd518('0x130')]]===_0xd518('0x1a')){if(this['actions'][_0xfd725[_0xd518('0x131')]]&&_[_0xd518('0xb3')](this['actions'][_0xfd725[_0xd518('0x131')]][_0xd518('0x132')])&&_0xfd725[_0xd518('0xb4')]==='1'&&_0xfd725['paused']==='0'){if(this[_0xd518('0x23')][_0xfd725['stateinterface']]){if(!this[_0xd518('0x23')][_0xfd725['stateinterface']][_0xd518('0x132')]){this[_0xd518('0x23')][_0xfd725[_0xd518('0x133')]]['locked']=!![];this[_0xd518('0x12f')][_0xfd725[_0xd518('0x131')]][_0xd518('0x132')]=!![];this['actions'][_0xfd725[_0xd518('0x131')]][_0xd518('0x133')]=_0xfd725[_0xd518('0x133')];}}}}else if((strategy[this[_0xd518('0x21')][this['actions'][_0xfd725[_0xd518('0x131')]][_0xd518('0xb7')]][_0xd518('0x130')]]||_0xd518('0x19'))===_0xd518('0x19')){if(this[_0xd518('0x12f')][_0xfd725['actionid']]){if(this[_0xd518('0x23')][_0xfd725['stateinterface']]){this[_0xd518('0x12f')][_0xfd725[_0xd518('0x131')]]['stateinterface']=_0xfd725[_0xd518('0x133')];if(_[_0xd518('0xb3')](this[_0xd518('0x2c')][this[_0xd518('0x12f')][_0xfd725['actionid']][_0xd518('0xb7')]])){this[_0xd518('0x2c')][this['actions'][_0xfd725[_0xd518('0x131')]][_0xd518('0xb7')]]=[];}this[_0xd518('0x2c')][this[_0xd518('0x12f')][_0xfd725[_0xd518('0x131')]][_0xd518('0xb7')]][_0xd518('0x134')](_[_0xd518('0x98')](_[_0xd518('0x135')](this[_0xd518('0x12f')][_0xfd725[_0xd518('0x131')]],[_0xd518('0x136'),'stateinterface']),{'status':_0xfd725[_0xd518('0xb4')],'paused':_0xfd725[_0xd518('0x137')]}));}}}};function unlockQueueStatus(_0x3f2b97,_0x13d5d2){setTimeout(function(){if(_[_0xd518('0x45')](_0x3f2b97[_0xd518('0x138')])){loggerBooked[_0xd518('0x9e')](_0xd518('0x139'),_0x13d5d2);}_0x3f2b97['queueStatusComplete']=!![];loggerBooked[_0xd518('0x84')](_0xd518('0x13a'),_0x13d5d2,JSON[_0xd518('0x52')](_[_0xd518('0x135')](_0x3f2b97,['name',_0xd518('0x138')])));},0x1f3);}Dialer[_0xd518('0x1b')][_0xd518('0x3f')]=function(_0x54bbe6){var _0x800471=this;var _0x3e1cd9=_0x800471['voiceQueues'][_0x800471[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]];if(strategy[this[_0xd518('0x21')][this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]][_0xd518('0x130')]]===_0xd518('0x1a')){if(this['actions'][_0x54bbe6['actionid']]&&this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0x133')]){this['preview'][_0xd518('0x13b')](this[_0xd518('0x12f')][_0x54bbe6['actionid']][_0xd518('0x136')],this[_0xd518('0x12f')][_0x54bbe6['actionid']][_0xd518('0x133')])[_0xd518('0xbb')](function(_0x5c114b){logger['error'](_0xd518('0x13c'),util[_0xd518('0xa0')](_0x5c114b,{'showHidden':![],'depth':null}));})[_0xd518('0x1e')](function(){_0x800471[_0xd518('0xb6')](_0x800471[_0xd518('0x21')][_0x800471['actions'][_0x54bbe6['actionid']][_0xd518('0xb7')]]);_0x800471['agents'][_0x800471['actions'][_0x54bbe6[_0xd518('0x131')]][_0xd518('0x133')]][_0xd518('0x132')]=![];delete _0x800471[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]];unlockQueueStatus(_0x3e1cd9);});}else{this[_0xd518('0xb6')](this[_0xd518('0x21')][this['actions'][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]]);this[_0xd518('0xc7')]({'active':![],'ContactId':this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]]['ContactId'],'ListId':this['actions'][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xdb')],'VoiceQueueId':this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xdd')]||undefined,'CampaignId':this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xde')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xd518('0x12f')][_0x54bbe6['actionid']];unlockQueueStatus(_0x3e1cd9);}}else if((strategy[this['voiceQueues'][this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]][_0xd518('0x130')]]||_0xd518('0x19'))==='rrmemory'){var _0x1d8455;if(this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]]&&!_[_0xd518('0x4e')](this[_0xd518('0x2c')][this['actions'][_0x54bbe6[_0xd518('0x131')]]['queue']])){if(this['queueBookedRR'][_0x800471['actions'][_0x54bbe6['actionid']][_0xd518('0xb7')]]){this[_0xd518('0x2d')][_0x800471[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]]=this[_0xd518('0x2d')][this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]]?this[_0xd518('0x2d')][this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]]:this['queueBooked'][this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]]?this['queueBooked'][this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]][_0xd518('0x13d')]||0x0:0x0;}this[_0xd518('0x2c')][this[_0xd518('0x12f')][_0x54bbe6['actionid']][_0xd518('0xb7')]][_0xd518('0x13d')]=this[_0xd518('0x2d')][this[_0xd518('0x12f')][_0x54bbe6[_0xd518('0x131')]][_0xd518('0xb7')]];for(var _0x3259a2=0x0;_0x3259a2=0x0;})[_0xd518('0xbb')](myreject(_0x1bd105)));}}else{_0x16bdb7[_0xd518('0x134')](ami['Action']({'action':_0xd518('0x159'),'command':util[_0xd518('0x81')](_0xd518('0x154'),_0x5b39ff,!_[_0xd518('0x45')](config[_0xd518('0x14f')][_0x5d2d40])?_0x5d2d40:'')})[_0xd518('0x43')](function(_0x24b8f2){return _0x24b8f2[_0xd518('0x156')][_0xd518('0x157')](_0xd518('0x158'))>=0x0;})[_0xd518('0xbb')](myreject(_0x1bd105)));}Promise['all'](_0x16bdb7)[_0xd518('0x43')](function(_0x14e143){var _0x107fff=_['some'](_0x14e143);if(_0x107fff){return _0x256f65(_0x107fff);}else{_0x4882cf['message']=_0x1b158b?_0xd518('0x15a'):_0xd518('0x15b');return _0x1bd105(msgResponse(_0xd518('0x15c'),_0xd518('0x14e'),'Global:\x20'+_0x1b158b+'\x20'+_0x1bfeff+'\x20Interval\x20is\x20overtime:\x20'+util[_0xd518('0xa0')](_0x5b39ff,{'showHidden':![],'depth':null})+_0xd518('0x15d')+_0x5d2d40));}})[_0xd518('0xbb')](function(_0x3f0405){return _0x1bd105(msgResponse(_0xd518('0x14b'),_0xd518('0x14e'),JSON[_0xd518('0x52')](_0x3f0405)));});});};Dialer['prototype'][_0xd518('0x15e')]=function(_0x42a6e6){var _0x34d9be=this;return function(){switch(_0x42a6e6[_0xd518('0x65')]){case _0xd518('0x15f'):freeVariablesPredictive(_0x42a6e6);_0x34d9be['handlePower'](_0x42a6e6,0x1);break;case _0xd518('0x160'):freeVariablesPredictive(_0x42a6e6);_0x34d9be[_0xd518('0x161')](_0x42a6e6,_0x42a6e6[_0xd518('0x162')]);break;case _0xd518('0xa'):_0x34d9be[_0xd518('0xa')](_0x42a6e6);break;case'booked':freeVariablesPredictive(_0x42a6e6);_0x34d9be['handlePower'](_0x42a6e6,0x1);break;default:freeVariablesPredictive(_0x42a6e6);logger[_0xd518('0x9e')](_0xd518('0x163'),_0x42a6e6[_0xd518('0x47')],_0xd518('0x164'));}};};Dialer[_0xd518('0x1b')][_0xd518('0x165')]=function(_0x255547){return Promise[_0xd518('0xc1')]()[_0xd518('0x43')](cmHopper[_0xd518('0x166')](_0x255547['id'],previewRecallmeReminderInterval))[_0xd518('0x43')](function(_0x16ff58){for(var _0x18507b=0x0;_0x18507b<_0x16ff58[_0xd518('0x152')];_0x18507b++){var _0x4a1175=_0x16ff58[_0x18507b][_0xd518('0x167')]['name'];if(_0x4a1175)io['to'](util[_0xd518('0x81')]('user:%s',_0x4a1175))[_0xd518('0xea')](_0xd518('0x168'),{'hopper':_0x16ff58[_0x18507b]});}})[_0xd518('0xbb')](function(){});};Dialer[_0xd518('0x1b')]['launchHandleIvr']=function(_0x1ea944){var _0x585b82=this;return function(){_0x585b82[_0xd518('0x169')](_0x1ea944);};};Dialer[_0xd518('0x1b')][_0xd518('0x16a')]=function(_0x12e71a){var _0x2dddc2=this;if(isNotPreview(_0x12e71a[_0xd518('0x65')])){if(isVoiceQueueOutbound(_0x12e71a[_0xd518('0x56')])&&isActive(_0x12e71a['dialActive'])){_0x12e71a['sendMessageOneNotActive']=!![];Promise['resolve']()[_0xd518('0x43')](checkIsLoggedIn(_0x12e71a,_0x12e71a['loggedIn']))['then'](checkIsActive(_0x12e71a,_0x12e71a['dialActive']))[_0xd518('0x43')](checkInterval(_0x12e71a))[_0xd518('0x43')](_0x2dddc2[_0xd518('0x146')](_0x12e71a))[_0xd518('0x43')](_0x2dddc2[_0xd518('0x16b')](_0x12e71a[_0xd518('0x16c')],_0x12e71a[_0xd518('0x16d')],_0x12e71a[_0xd518('0x47')],_0x12e71a))[_0xd518('0x43')](_0x2dddc2[_0xd518('0x14a')](_0x12e71a[_0xd518('0x4b')],_0x12e71a['dialTimezone'],_0x12e71a['name'],_0x12e71a))[_0xd518('0x43')](_0x2dddc2['checkDialMethod'](_0x12e71a))[_0xd518('0xbb')](loggerCatchQueueSummary(_0xd518('0x16e'),_0x12e71a));}else{notSendMessagesQueue(_0x12e71a);}}else{freeVariablesPredictive(_0x12e71a);}};Dialer[_0xd518('0x1b')]['syncQueueSummaryComplete']=_[_0xd518('0x16f')](function(){var _0x508b08=_[_0xd518('0x170')](this['voiceQueues'],function(_0x3fe996){return _0x3fe996[_0xd518('0x171')];});var _0x3e1fdc=_[_0xd518('0x170')](this[_0xd518('0x23')],function(_0x4d6f4d){return _0x4d6f4d[_0xd518('0x172')]&&_0x4d6f4d[_0xd518('0xb4')]===_0xd518('0xe3');});if(_0x508b08[_0xd518('0x152')]>0x0&&_0x3e1fdc[_0xd518('0x152')]>0x0){return Promise[_0xd518('0xc1')]()[_0xd518('0x43')](cmHopper[_0xd518('0x166')](_['map'](_0x508b08,'id'),previewRecallmeReminderInterval,_['map'](_0x3e1fdc,'id')))[_0xd518('0x43')](function(_0x376635){for(var _0x5cdad0=0x0;_0x5cdad0<_0x376635[_0xd518('0x152')];_0x5cdad0++){var _0x4c63a4=_0x376635[_0x5cdad0]['Agent'][_0xd518('0x47')];if(_0x4c63a4)io['to'](util[_0xd518('0x81')](_0xd518('0x173'),_0x4c63a4))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x376635[_0x5cdad0]});}})[_0xd518('0xbb')](function(_0x3dffd1){logger[_0xd518('0x9e')](_0xd518('0x165'),_0x3dffd1);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xd518('0x1b')][_0xd518('0x174')]=function(){var _0x54e91e=this;var _0x1fe4de;for(var _0xd797f2 in this['campaigns']){if(typeof this[_0xd518('0x22')][_0xd797f2]!==_0xd518('0xd5')){_0x1fe4de=this[_0xd518('0x22')][_0xd797f2];if(isCampaignIvr(_0x1fe4de[_0xd518('0x56')])&&isActive(_0x1fe4de[_0xd518('0x7f')])){_0x1fe4de[_0xd518('0xa7')]=!![];Promise[_0xd518('0xc1')]()[_0xd518('0x43')](checkIsActive(_0x1fe4de,_0x1fe4de[_0xd518('0x7f')]))[_0xd518('0x43')](checkInterval(_0x1fe4de))[_0xd518('0x43')](_0x54e91e[_0xd518('0x146')](_0x1fe4de))['then'](_0x54e91e[_0xd518('0x16b')](_0x1fe4de[_0xd518('0x16c')],_0x1fe4de[_0xd518('0x16d')],_0x1fe4de[_0xd518('0x47')],_0x1fe4de))[_0xd518('0x43')](_0x54e91e['checkIfTimeIntervals'](_0x1fe4de['Interval'],_0x1fe4de['dialTimezone'],_0x1fe4de[_0xd518('0x47')],_0x1fe4de))['then'](_0x54e91e[_0xd518('0x175')](_0x1fe4de))[_0xd518('0xbb')](loggerCatchQueueSummary(_0xd518('0x176'),_0x1fe4de));}else{notSendMessagesCampaign(_0x1fe4de);}}}};function getCallerIdRandom(_0x3d6536,_0x51d3b5){var _0x71be64;var _0x29cac5;var _0x4ce667;if(_0x51d3b5<=0x0){_0x51d3b5=0x1;}_0x71be64=new RegExp(_0xd518('0x177')+_0x51d3b5+'}$');_0x29cac5=Math[_0xd518('0x178')](0xa,_0x51d3b5-0x1);_0x4ce667=Math[_0xd518('0x178')](0xa,_0x51d3b5)-0x1;return util[_0xd518('0x81')]('%s',_[_0xd518('0x179')](_0x3d6536,_0x71be64,_[_0xd518('0x17a')](_0x29cac5,_0x4ce667)));}function extractCalleridName(_0x270ce7){var _0x2172ac=_0x270ce7[_0xd518('0x17b')](/"(.*?)"/);return _0x2172ac?_0x2172ac[0x1]:_0x270ce7;}Dialer[_0xd518('0x1b')][_0xd518('0x17c')]=function(_0x52f7ce,_0x1c95e3){var _0x451081=this;var _0x4f50d5=uuid['v4']();this[_0xd518('0x12f')][_0x4f50d5]=new Action(_0x52f7ce,_0x1c95e3,_0x4f50d5);return new Promise(function(_0x361afe,_0x313733){if(_[_0xd518('0x45')](_0x52f7ce)&&typeof _0x52f7ce!==_0xd518('0x17d')){return _0x313733(msgResponse('originate',_0xd518('0x14e'),_0xd518('0x17e')));}if(_[_0xd518('0x45')](_0x1c95e3['phone'])||_0x1c95e3[_0xd518('0x17f')]===null){return _0x313733(msgResponse(_0xd518('0x180'),_0xd518('0x14e'),_0xd518('0x181')));}var _0x4877b5={'XMD-CALLERID':_0x451081[_0xd518('0x12f')][_0x4f50d5]['getCaller'](),'XMD-AGI':_0x52f7ce[_0xd518('0x10d')]?util[_0xd518('0x81')](_0xd518('0x182'),ipAgi,_0x52f7ce[_0xd518('0x10d')]):_0xd518('0x183'),'XMD-AGIAFTER':_0x52f7ce['dialQueueProject2']?util['format'](_0xd518('0x182'),ipAgi,_0x52f7ce[_0xd518('0x115')]):_0xd518('0x183'),'XMD-QUEUE':_0x52f7ce[_0xd518('0x56')]===_0xd518('0x57')?util[_0xd518('0x81')](_0xd518('0x184'),_0x52f7ce['name'],_0x52f7ce['dialQueueOptions']||'',_0x52f7ce[_0xd518('0x116')]?'c':'',_0x52f7ce[_0xd518('0x11d')]||0x3):_0xd518('0x183'),'XMD-CONTACTID':_0x1c95e3[_0xd518('0xda')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x451081['actions'][_0x4f50d5][_0xd518('0x185')](),'XMD-AMD':_0x52f7ce['dialAMDActive']?_0xd518('0x186'):_0xd518('0x183'),'XMD-DESTINATION':_0xd518('0x187')};if(_0x52f7ce[_0xd518('0xf0')]){_0x4877b5['XMD-AMDINITIALSILENCE']=_0x52f7ce[_0xd518('0x188')]||0x9c4;_0x4877b5[_0xd518('0x189')]=_0x52f7ce[_0xd518('0x18a')]||0x5dc;_0x4877b5['XMD-AMDAFTERGREETINGSILENCE']=_0x52f7ce[_0xd518('0x18b')]||0x320;_0x4877b5[_0xd518('0x18c')]=_0x52f7ce[_0xd518('0x18d')]||0x1388;_0x4877b5['XMD-AMDMINWORDLENGTH']=_0x52f7ce[_0xd518('0x18e')]||0x64;_0x4877b5['XMD-AMDBETWEENWORDSSILENCE']=_0x52f7ce[_0xd518('0x18f')]||0x32;_0x4877b5[_0xd518('0x190')]=_0x52f7ce[_0xd518('0x191')]||0x3;_0x4877b5[_0xd518('0x192')]=_0x52f7ce[_0xd518('0x193')]||0x100;_0x4877b5['XMD-AMDMAXIMUMWORDLENGTH']=_0x52f7ce['dialAMDMaximumWordLength']||0x1388;}if(_0x52f7ce[_0xd518('0x56')]==='outbound'){_0x4877b5['XMD-VOICEQUEUEID']=_0x1c95e3['VoiceQueueId'];}else{_0x4877b5[_0xd518('0x194')]=_0x1c95e3[_0xd518('0xde')];}for(var _0x6e5e4 in _0x1c95e3[_0xd518('0x195')]){if(typeof _0x1c95e3[_0xd518('0x195')][_0x6e5e4]!==_0xd518('0xd5')){if(isNotNull(_0x1c95e3[_0xd518('0x195')][_0x6e5e4])&&_0x6e5e4!=='id'&&_0x6e5e4!==_0xd518('0x196')&&_0x6e5e4!==_0xd518('0x197')&&_0x6e5e4!==_0xd518('0x198')){_0x4877b5[util[_0xd518('0x81')](_0xd518('0x199'),_0xd518('0x19a'),_[_0xd518('0x19b')](_0x6e5e4))]=_0x1c95e3['Contact'][_0x6e5e4];}}}var _0x2bdde6=_0x451081[_0xd518('0x147')](_0x52f7ce['Trunk'])?getCallerId(_0x52f7ce[_0xd518('0x7e')]['callerid'],_0x52f7ce[_0xd518('0x66')],_0x52f7ce['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x52f7ce[_0xd518('0x67')],_0x52f7ce['dialRandomLastDigitCallerIdNumber']):_0x52f7ce['dialOriginateCallerIdNumber']):getCallerId(_[_0xd518('0xb3')](_0x52f7ce[_0xd518('0x19c')])?_0x52f7ce[_0xd518('0x7e')][_0xd518('0x80')]:_0x52f7ce['TrunkBackup'][_0xd518('0x80')],_0x52f7ce[_0xd518('0x66')],_0x52f7ce[_0xd518('0x19d')]>0x0?getCallerIdRandom(_0x52f7ce['dialOriginateCallerIdNumber'],_0x52f7ce['dialRandomLastDigitCallerIdNumber']):_0x52f7ce['dialOriginateCallerIdNumber']);if(_0x2bdde6){_0x4877b5['XMD-ORIGINATECALLERIDNAME']=_0x451081[_0xd518('0x12f')][_0x4f50d5][_0xd518('0x19e')]=extractCalleridName(_0x2bdde6);_0x4877b5[_0xd518('0x19f')]=_0x1c95e3[_0xd518('0x17f')];}_0x52f7ce[_0xd518('0x1a0')]=_0x4877b5;return ami['Action']({'actionid':_0x4f50d5,'action':_0xd518('0x180'),'channel':_0x451081['isTrunkReachable'](_0x52f7ce[_0xd518('0x7e')])?util[_0xd518('0x81')](_0xd518('0x1a1'),_0x52f7ce[_0xd518('0x7e')][_0xd518('0x47')],isNotNull(_0x52f7ce[_0xd518('0x68')])?_0x52f7ce[_0xd518('0x68')][_0xd518('0x1a2')]()||'':'',_0x52f7ce['dialCutDigit']>0x0?_0x1c95e3[_0xd518('0x17f')]['substring'](_0x52f7ce[_0xd518('0x1a3')]):_0x1c95e3[_0xd518('0x17f')]):util['format'](_0xd518('0x1a1'),_['isNil'](_0x52f7ce[_0xd518('0x19c')])?_0x52f7ce[_0xd518('0x7e')][_0xd518('0x47')]:_0x52f7ce[_0xd518('0x19c')][_0xd518('0x47')],isNotNull(_0x52f7ce[_0xd518('0x68')])?_0x52f7ce[_0xd518('0x68')][_0xd518('0x1a2')]()||'':'',_0x52f7ce[_0xd518('0x1a3')]>0x0?_0x1c95e3['phone'][_0xd518('0x1a4')](_0x52f7ce[_0xd518('0x1a3')]):_0x1c95e3[_0xd518('0x17f')]),'callerid':_0x2bdde6,'Exten':_0xd518('0x187'),'Context':'from-sip','Priority':'1','variable':_0x4877b5,'timeout':(_0x52f7ce[_0xd518('0x1a5')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4f50d5})[_0xd518('0x43')](function(_0x3bc396){return _0x361afe(_0x3bc396);})[_0xd518('0xbb')](function(_0x312b5){_0x52f7ce[_0xd518('0x70')]+=0x1;var _0x51bbf7=new History(_0x451081[_0xd518('0x12f')][_0x4f50d5]);logger[_0xd518('0x9e')](util[_0xd518('0x81')](_0xd518('0x1a6'),JSON[_0xd518('0x52')](_0x312b5)));_0x51bbf7['state']=0xe;_0x51bbf7['statedesc']=_0xd518('0x1a7');_0x51bbf7[_0xd518('0xb0')]=moment()['format'](_0xd518('0x10a'));_0x51bbf7[_0xd518('0xaf')]=_0x51bbf7['starttime'];_0x451081[_0xd518('0xd3')](_0x51bbf7)['catch'](loggerCatch(_0xd518('0x1a8')));_0x451081[_0xd518('0xd1')](_0x51bbf7)['catch'](loggerCatch(_0xd518('0x1a8')))[_0xd518('0x1e')](function(){delete _0x451081[_0xd518('0x12f')][_0x4f50d5];return _0x313733(msgResponse(_0xd518('0x180'),_0xd518('0x51'),_0xd518('0x1a9')));});});});};Dialer[_0xd518('0x1b')][_0xd518('0x34')]=function(_0x322fe6){var _0x1363e1=this[_0xd518('0x12f')][_0x322fe6[_0xd518('0x131')]];if(_0x1363e1){delete this['actions'][_0x322fe6[_0xd518('0x131')]];_0x1363e1[_0xd518('0x11c')]=moment()['format'](_0xd518('0x10a'));var _0x459418=_0x1363e1[_0xd518('0x56')]===_0xd518('0x83')?this['campaigns'][_0x1363e1[_0xd518('0xb7')]]:this[_0xd518('0x21')][_0x1363e1[_0xd518('0x1aa')]()];if(!this[_0xd518('0xe0')](_0x322fe6[_0xd518('0x1ab')])){this[_0xd518('0xb6')](_0x459418);return this[_0xd518('0x1ac')](_0x1363e1,_0x459418,_0x322fe6)['catch'](loggerCatch(_0xd518('0x1ad')));}this[_0xd518('0x28')][_0x322fe6[_0xd518('0xe4')]]=_0x1363e1;}};Dialer[_0xd518('0x1b')][_0xd518('0x1ae')]=function(_0x3f6191,_0x37e875,_0x2c5c02){var _0x4ea2e4=new History(_0x37e875);if(_0x4ea2e4[_0xd518('0xf6')]+_0x4ea2e4[_0xd518('0xf7')]+_0x4ea2e4['countnoanswerretry']+_0x4ea2e4['countnosuchnumberretry']+_0x4ea2e4[_0xd518('0xfa')]+_0x4ea2e4[_0xd518('0xfb')]+_0x4ea2e4[_0xd518('0xfc')]+_0x4ea2e4[_0xd518('0xfd')]>=_0x2c5c02[_0xd518('0xfe')]-0x1){return!![];}switch(_0x3f6191){case 0x3:if(_0x4ea2e4[_0xd518('0xf8')]>=_0x2c5c02[_0xd518('0x1af')]-0x1){return!![];}this[_0xd518('0xc7')]({'active':![],'countnoanswerretry':_0x4ea2e4['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xd518('0x109')](_0x2c5c02['dialNoAnswerRetryFrequency'],_0xd518('0x105'))['format'](_0xd518('0x10a')),'ContactId':_0x4ea2e4[_0xd518('0xda')],'ListId':_0x4ea2e4[_0xd518('0xdb')],'VoiceQueueId':_0x4ea2e4['VoiceQueueId']||undefined,'CampaignId':_0x4ea2e4[_0xd518('0xde')]||undefined})['catch'](loggerCatch(_0xd518('0x1b0')));break;case 0x5:if(_0x4ea2e4[_0xd518('0xf6')]>=_0x2c5c02[_0xd518('0x1b1')]-0x1){return!![];}this[_0xd518('0xc7')]({'active':![],'countbusyretry':_0x4ea2e4['countbusyretry']+=0x1,'scheduledat':moment()[_0xd518('0x109')](_0x2c5c02[_0xd518('0x1b2')],_0xd518('0x105'))[_0xd518('0x81')](_0xd518('0x10a')),'ContactId':_0x4ea2e4[_0xd518('0xda')],'ListId':_0x4ea2e4[_0xd518('0xdb')],'VoiceQueueId':_0x4ea2e4[_0xd518('0xdd')]||undefined,'CampaignId':_0x4ea2e4['CampaignId']||undefined})['catch'](loggerCatch(_0xd518('0x1b3')));break;case 0x8:if(_0x4ea2e4[_0xd518('0xf7')]>=_0x2c5c02['dialCongestionMaxRetry']-0x1){return!![];}this[_0xd518('0xc7')]({'active':![],'countcongestionretry':_0x4ea2e4[_0xd518('0xf7')]+=0x1,'scheduledat':moment()[_0xd518('0x109')](_0x2c5c02['dialCongestionRetryFrequency'],_0xd518('0x105'))[_0xd518('0x81')](_0xd518('0x10a')),'ContactId':_0x4ea2e4['ContactId'],'ListId':_0x4ea2e4[_0xd518('0xdb')],'VoiceQueueId':_0x4ea2e4[_0xd518('0xdd')]||undefined,'CampaignId':_0x4ea2e4['CampaignId']||undefined})[_0xd518('0xbb')](loggerCatch(_0xd518('0x1b4')));break;case 0x0:if(_0x4ea2e4[_0xd518('0xf9')]>=_0x2c5c02['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xd518('0xc7')]({'active':![],'countnosuchnumberretry':_0x4ea2e4[_0xd518('0xf9')]+=0x1,'scheduledat':moment()[_0xd518('0x109')](_0x2c5c02[_0xd518('0x1b5')],_0xd518('0x105'))[_0xd518('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4ea2e4[_0xd518('0xda')],'ListId':_0x4ea2e4['ListId'],'VoiceQueueId':_0x4ea2e4[_0xd518('0xdd')]||undefined,'CampaignId':_0x4ea2e4['CampaignId']||undefined})[_0xd518('0xbb')](loggerCatch(_0xd518('0x1b6')));}break;case 0xa:if(_0x4ea2e4['countdropretry']>=_0x2c5c02[_0xd518('0x124')]-0x1){return!![];}this[_0xd518('0xc7')]({'active':![],'countdropretry':_0x4ea2e4[_0xd518('0xfa')]+=0x1,'scheduledat':moment()[_0xd518('0x109')](_0x2c5c02[_0xd518('0x120')],'minutes')['format'](_0xd518('0x10a')),'ContactId':_0x4ea2e4['ContactId'],'ListId':_0x4ea2e4[_0xd518('0xdb')],'VoiceQueueId':_0x4ea2e4[_0xd518('0xdd')]||undefined,'CampaignId':_0x4ea2e4[_0xd518('0xde')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x4ea2e4[_0xd518('0xfb')]>=_0x2c5c02[_0xd518('0x1b7')]-0x1){return!![];}this[_0xd518('0xc7')]({'active':![],'countabandonedretry':_0x4ea2e4[_0xd518('0xfb')]+=0x1,'scheduledat':moment()[_0xd518('0x109')](_0x2c5c02[_0xd518('0x12c')],_0xd518('0x105'))[_0xd518('0x81')](_0xd518('0x10a')),'ContactId':_0x4ea2e4[_0xd518('0xda')],'ListId':_0x4ea2e4[_0xd518('0xdb')],'VoiceQueueId':_0x4ea2e4[_0xd518('0xdd')]||undefined,'CampaignId':_0x4ea2e4[_0xd518('0xde')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x4ea2e4[_0xd518('0xfc')]>=_0x2c5c02[_0xd518('0x101')]-0x1){return!![];}this[_0xd518('0xc7')]({'active':![],'countmachineretry':_0x4ea2e4[_0xd518('0xfc')]+=0x1,'scheduledat':moment()[_0xd518('0x109')](_0x2c5c02[_0xd518('0x104')],_0xd518('0x105'))[_0xd518('0x81')](_0xd518('0x10a')),'ContactId':_0x4ea2e4[_0xd518('0xda')],'ListId':_0x4ea2e4[_0xd518('0xdb')],'VoiceQueueId':_0x4ea2e4[_0xd518('0xdd')]||undefined,'CampaignId':_0x4ea2e4[_0xd518('0xde')]||undefined})['catch'](loggerCatch(_0xd518('0x106')));break;case 0x14:if(_0x4ea2e4[_0xd518('0xfd')]>=_0x2c5c02[_0xd518('0x1b8')]-0x1){return!![];}this[_0xd518('0xc7')]({'active':![],'countagentrejectretry':_0x4ea2e4[_0xd518('0xfd')]+=0x1,'scheduledat':moment()[_0xd518('0x109')](_0x2c5c02[_0xd518('0x1b9')],_0xd518('0x105'))[_0xd518('0x81')](_0xd518('0x10a')),'ContactId':_0x4ea2e4[_0xd518('0xda')],'ListId':_0x4ea2e4[_0xd518('0xdb')],'VoiceQueueId':_0x4ea2e4['VoiceQueueId']||undefined,'CampaignId':_0x4ea2e4['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xd518('0x1b')]['callProgressDetecting']=function(_0x3bce07,_0x5c1cb6,_0x17727d){var _0x471964=this;var _0x55cdcd=new History(_0x3bce07);var _0xa57e6b=![];var _0x4ff934;var _0x102733;return new Promise(function(_0x575d1b,_0x42f081){if(_[_0xd518('0x45')](_0x5c1cb6)&&typeof _0x5c1cb6!==_0xd518('0x17d')){return _0x42f081(msgResponse('[callProgressDetecting]','Failure','entity\x20is\x20undefine'));}if(_[_0xd518('0x45')](_0x17727d)&&typeof _0x17727d!==_0xd518('0x17d')){return _0x42f081(msgResponse(_0xd518('0x1ba'),_0xd518('0x14e'),_0xd518('0x1bb')));}_0x471964[_0xd518('0xbf')](_0x55cdcd,_0x17727d['reason'],_0x5c1cb6)[_0xd518('0x43')](function(_0x3f807f){if(_0x3f807f[_0xd518('0x123')]==0x1)_0xa57e6b=!![];switch(_0x17727d['reason']){case'0':_0x5c1cb6[_0xd518('0x6f')]+=0x1;_0x55cdcd[_0xd518('0xad')]=0x0;_0x55cdcd[_0xd518('0xae')]=_0xd518('0x1bc');_0x55cdcd[_0xd518('0xf9')]+=0x1;_0x55cdcd[_0xd518('0xf4')]+=0x1;ami['emit'](_0xd518('0x1bd'),ut[_0xd518('0xec')](_0x3bce07,_0xd518('0x1be')));_0x4ff934=_0x5c1cb6[_0xd518('0x1b5')];_0x102733=_0x5c1cb6[_0xd518('0x121')];_0x471964[_0xd518('0xd3')](_0x55cdcd)[_0xd518('0xbb')](loggerCatch(_0xd518('0xf5')));if(_0x471964[_0xd518('0x1ae')](0x0,_0x3bce07,_0x5c1cb6)&&!_0xa57e6b){if(_0x55cdcd['countnosuchnumberretry']>=_0x5c1cb6[_0xd518('0x1bf')]){_0x471964[_0xd518('0x102')](_0x55cdcd,_0x575d1b,_0x42f081,_0xd518('0x1c0'));}else{_0x471964[_0xd518('0xff')](_0x55cdcd,_0x575d1b,_0x42f081,_0xd518('0x1c0'));}}break;case'3':_0x5c1cb6[_0xd518('0x6e')]+=0x1;_0x55cdcd[_0xd518('0xad')]=0x3;_0x55cdcd[_0xd518('0xae')]=_0xd518('0x1c1');_0x55cdcd[_0xd518('0xf8')]+=0x1;_0x55cdcd['countglobal']+=0x1;var _0x3c68ca=ut[_0xd518('0x1c2')](_0x3bce07,_0x5c1cb6);ami[_0xd518('0xea')]('custom:agentnoanswer',_0x3c68ca);_0x4ff934=_0x5c1cb6['dialNoAnswerRetryFrequency'];_0x102733=_0x5c1cb6[_0xd518('0x121')];_0x471964[_0xd518('0xd3')](_0x55cdcd)[_0xd518('0xbb')](loggerCatch(_0xd518('0x1c3')));if(_0x471964[_0xd518('0x1ae')](0x3,_0x3bce07,_0x5c1cb6)&&!_0xa57e6b){if(_0x55cdcd['countnoanswerretry']>=_0x5c1cb6['dialNoAnswerMaxRetry']){_0x471964[_0xd518('0x102')](_0x55cdcd,_0x575d1b,_0x42f081,_0xd518('0x1c4'));}else{_0x471964[_0xd518('0xff')](_0x55cdcd,_0x575d1b,_0x42f081,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x5c1cb6['outboundBusyCallsDay']+=0x1;_0x55cdcd['state']=0x5;_0x55cdcd[_0xd518('0xae')]=_0xd518('0x1c5');_0x55cdcd[_0xd518('0xf6')]+=0x1;_0x55cdcd[_0xd518('0xf4')]+=0x1;ami[_0xd518('0xea')](_0xd518('0x1c6'),ut['buildObj'](_0x3bce07,_0xd518('0x1c7')));_0x4ff934=_0x5c1cb6[_0xd518('0x1b2')];_0x102733=_0x5c1cb6['callAdditionalPhoneAfterMin'];_0x471964['createHistory'](_0x55cdcd)[_0xd518('0xbb')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x471964[_0xd518('0x1ae')](0x5,_0x3bce07,_0x5c1cb6)&&!_0xa57e6b){if(_0x55cdcd['countbusyretry']>=_0x5c1cb6[_0xd518('0x1b1')]){_0x471964[_0xd518('0x102')](_0x55cdcd,_0x575d1b,_0x42f081,'reason\x205\x20busy');}else{_0x471964[_0xd518('0xff')](_0x55cdcd,_0x575d1b,_0x42f081,_0xd518('0x1c8'));}}break;case'8':_0x5c1cb6[_0xd518('0x6b')]+=0x1;_0x55cdcd[_0xd518('0xad')]=0x8;_0x55cdcd[_0xd518('0xae')]=_0xd518('0x1c9');_0x55cdcd[_0xd518('0xf7')]+=0x1;_0x55cdcd[_0xd518('0xf4')]+=0x1;_0x4ff934=_0x5c1cb6[_0xd518('0x1ca')];_0x102733=_0x5c1cb6['callAdditionalPhoneAfterMin'];ami[_0xd518('0xea')](_0xd518('0x1cb'),ut['buildObj'](_0x3bce07,_0xd518('0x1cc')));_0x471964[_0xd518('0xd3')](_0x55cdcd)[_0xd518('0xbb')](loggerCatch(_0xd518('0x1cd')));if(_0x471964[_0xd518('0x1ae')](0x8,_0x3bce07,_0x5c1cb6)&&!_0xa57e6b){if(_0x55cdcd['countcongestionretry']>=_0x5c1cb6[_0xd518('0x1ce')]){_0x471964[_0xd518('0x102')](_0x55cdcd,_0x575d1b,_0x42f081,'reason\x208\x20congestion');}else{_0x471964[_0xd518('0xff')](_0x55cdcd,_0x575d1b,_0x42f081,_0xd518('0x1cf'));}}break;case'11':_0x5c1cb6[_0xd518('0x1d0')]+=0x1;_0x55cdcd[_0xd518('0xad')]=0xb;_0x55cdcd['statedesc']='Abandoned';_0x55cdcd[_0xd518('0xfb')]+=0x1;_0x55cdcd[_0xd518('0xf4')]+=0x1;_0x4ff934=_0x5c1cb6[_0xd518('0x12c')];_0x102733=_0x5c1cb6[_0xd518('0x121')];_0x471964[_0xd518('0xd3')](_0x55cdcd)[_0xd518('0xbb')](loggerCatch(_0xd518('0x12e')));if(_0x471964[_0xd518('0x1ae')](0xb,_0x3bce07,_0x5c1cb6)&&!_0xa57e6b){if(_0x55cdcd[_0xd518('0xfb')]>=_0x5c1cb6[_0xd518('0x1b7')]){_0x471964['createStateFinal'](_0x55cdcd,_0x575d1b,_0x42f081,_0xd518('0x1d1'));}else{_0x471964['stateGlobal'](_0x55cdcd,_0x575d1b,_0x42f081,_0xd518('0x1d1'));}}break;case'20':_0x5c1cb6[_0xd518('0x72')]+=0x1;_0x55cdcd[_0xd518('0xad')]=0x14;_0x55cdcd['statedesc']='AgentReject';_0x55cdcd[_0xd518('0xfd')]+=0x1;_0x55cdcd[_0xd518('0xf4')]+=0x1;_0x4ff934=_0x5c1cb6[_0xd518('0x1b9')];_0x102733=_0x5c1cb6[_0xd518('0x121')];ami[_0xd518('0xea')](_0xd518('0x1d2'),ut[_0xd518('0xec')](_0x3bce07,_0xd518('0x1d3')));_0x471964[_0xd518('0xd3')](_0x55cdcd)[_0xd518('0xbb')](loggerCatch(_0xd518('0x1d4')));if(_0x471964[_0xd518('0x1ae')](0x14,_0x3bce07,_0x5c1cb6)&&!_0xa57e6b){if(_0x55cdcd[_0xd518('0xfd')]>=_0x5c1cb6['dialAgentRejectMaxRetry']){_0x471964[_0xd518('0x102')](_0x55cdcd,_0x575d1b,_0x42f081,'reason\x2020\x20agentreject');}else{_0x471964['stateGlobal'](_0x55cdcd,_0x575d1b,_0x42f081,_0xd518('0x1d5'));}}break;default:_0x5c1cb6[_0xd518('0x73')]+=0x1;_0x55cdcd['state']=0xc;_0x55cdcd['statedesc']=_0x17727d['reason'];_0x4ff934=_0x5c1cb6[_0xd518('0x1b9')];_0x102733=_0x5c1cb6['callAdditionalPhoneAfterMin'];_0x471964[_0xd518('0xd3')](_0x55cdcd)[_0xd518('0xbb')](loggerCatch(_0xd518('0x1d6')));if(_0x471964[_0xd518('0x1ae')](_0x17727d[_0xd518('0x113')],_0x3bce07,_0x5c1cb6)&&!_0xa57e6b){if(_0x55cdcd[_0xd518('0xf6')]+_0x55cdcd[_0xd518('0xf7')]+_0x55cdcd[_0xd518('0xf8')]+_0x55cdcd[_0xd518('0xf9')]+_0x55cdcd['countdropretry']+_0x55cdcd[_0xd518('0xfb')]+_0x55cdcd['countmachineretry']+_0x55cdcd[_0xd518('0xfd')]>=_0x5c1cb6['dialGlobalMaxRetry']){_0x471964[_0xd518('0xff')](_0x55cdcd,_0x575d1b,_0x42f081,_0x17727d[_0xd518('0x113')]);}else{_0x471964[_0xd518('0x102')](_0x55cdcd,_0x575d1b,_0x42f081,_0x17727d['reason']);}}}})[_0xd518('0x43')](function(){if(_0xa57e6b){_0x471964['swapAdditionalPhones'](_0x55cdcd,_0x4ff934,_0x102733)[_0xd518('0x43')](function(){return _0x575d1b(0x1);});}});});};Dialer[_0xd518('0x1b')][_0xd518('0xff')]=function(_0x39e04c,_0x34e96e,_0x4a34bf,_0x197bb8){var _0x493b82=new Final(_0x39e04c);_0x493b82['state']=0xf;_0x493b82[_0xd518('0xae')]='Global';this[_0xd518('0x102')](_0x493b82,_0x34e96e,_0x4a34bf,_0x197bb8);};Dialer[_0xd518('0x1b')][_0xd518('0x102')]=function(_0x18cf2d,_0x457559,_0x20a589,_0x3be752){this['moveContactManagedDialer'](_0x18cf2d)[_0xd518('0x43')](function(){return _0x457559(msgResponse(_0xd518('0x1ba'),_0xd518('0xe1'),_0x3be752));})[_0xd518('0xbb')](function(){return _0x20a589(msgResponse(_0xd518('0x1d7'),_0xd518('0x14e'),_0xd518('0x1d8')));});};Dialer['prototype'][_0xd518('0xa')]=function(_0x3069f3){var _0x18d79a=_0x3069f3['dialPredictiveOptimizationPercentage']/0x64;var _0x44eb81=_0x3069f3[_0xd518('0x6d')]/(_0x3069f3['outboundDropCallsDayTimeout']+_0x3069f3[_0xd518('0x69')]);var _0x2728fd=Math[_0xd518('0x1d9')](_0x3069f3[_0xd518('0x7b')]*(_0x3069f3['predictiveIntervalMaxThreshold']/0x64));var _0x5b03b7=Math[_0xd518('0x1d9')](_0x3069f3[_0xd518('0x7b')]*(_0x3069f3['predictiveIntervalMinThreshold']/0x64));var _0x58bffa=_0x3069f3['available']+_0x3069f3['talking'];var _0x19d893=Math[_0xd518('0x1da')](_0x3069f3[_0xd518('0x92')]*_0x3069f3[_0xd518('0x95')]*_0x3069f3[_0xd518('0x79')]*_0x3069f3[_0xd518('0x1db')]);if(_['isUndefined'](_0x3069f3[_0xd518('0x2a')])){if(!_['isUndefined'](_0x3069f3[_0xd518('0x29')])){_0x3069f3[_0xd518('0x29')]=undefined;loggerPredictive[_0xd518('0x9e')](_0xd518('0x1dc'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xd518('0x45')](_0x3069f3['handlePredictive'])){loggerPredictive[_0xd518('0x9e')]('[startMethodPredictive][StartProgressive]',_0xd518('0x1dd'));clearInterval(_0x3069f3[_0xd518('0x9a')]);_0x3069f3[_0xd518('0x9a')]=undefined;}_0x3069f3[_0xd518('0x2a')]=moment()['format'](_0xd518('0x10a'));loggerPredictive['info'](_0x3069f3['name'],_0xd518('0x1de'),_0x3069f3['startProgressive']);this[_0xd518('0x161')](_0x3069f3,0x1);}else if(ifInterval(_0x3069f3[_0xd518('0x1df')],_0x3069f3[_0xd518('0x2a')])){this[_0xd518('0x161')](_0x3069f3,0x1);loggerPredictiveCalls[_0xd518('0x84')]('[startMethodPredictive][StartProgressive][Loop]',_0x3069f3[_0xd518('0x2a')],_0x3069f3['name']);_0x3069f3[_0xd518('0x92')]=0x0;_0x3069f3['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x18d79a<_0x44eb81&&_0x3069f3[_0xd518('0x1e0')]===_0xd518('0x1e1')){freeVariablesPredictive(_0x3069f3);loggerPredictive[_0xd518('0x84')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xd518('0x1e2'),_0x44eb81,_0xd518('0x2a'),_0x3069f3[_0xd518('0x47')]);}else if(_0x19d893<_0x3069f3[_0xd518('0x78')]&&_0x3069f3['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x3069f3);loggerPredictive[_0xd518('0x84')](_0xd518('0x1e3'),_0xd518('0x1e4'),_0x19d893,_0xd518('0x1e5'),_0x3069f3[_0xd518('0x78')],_0xd518('0x2a'),_0x3069f3[_0xd518('0x47')]);}else if(!ifInterval(_0x3069f3[_0xd518('0x1df')],_0x3069f3[_0xd518('0x2a')])&&_['isUndefined'](_0x3069f3[_0xd518('0x29')])&&!_[_0xd518('0x45')](_0x3069f3['startProgressive'])){_0x3069f3[_0xd518('0x29')]=moment()['format'](_0xd518('0x10a'));loggerPredictive['info'](_0x3069f3[_0xd518('0x47')],'started\x20in\x20predictive\x20at',_0x3069f3[_0xd518('0x29')]);this[_0xd518('0xc4')](_0x3069f3[_0xd518('0x1df')])[_0xd518('0x43')](this[_0xd518('0x1e6')](_0x3069f3))['then'](mergeDataErlangB(_0x3069f3))[_0xd518('0x43')](this[_0xd518('0x1e7')](_0x3069f3))[_0xd518('0xbb')](loggerCatchPredictive(_0xd518('0x1e8'),_0x3069f3));}else if(!ifInterval(_0x3069f3[_0xd518('0x1df')],_0x3069f3[_0xd518('0x29')])){_0x3069f3[_0xd518('0x78')]=0x0;_0x3069f3[_0xd518('0x29')]=moment()[_0xd518('0x81')](_0xd518('0x10a'));loggerPredictive[_0xd518('0x84')](_0x3069f3[_0xd518('0x47')],_0xd518('0x1e9'),_0x3069f3[_0xd518('0x29')]);clearInterval(_0x3069f3[_0xd518('0x9a')]);_0x3069f3[_0xd518('0x9a')]=undefined;this[_0xd518('0xc4')](_0x3069f3[_0xd518('0x1df')])[_0xd518('0x43')](this['getDataPredictive'](_0x3069f3))[_0xd518('0x43')](mergeDataErlangB(_0x3069f3))[_0xd518('0x43')](this[_0xd518('0x1e7')](_0x3069f3))['catch'](loggerCatchPredictive(_0xd518('0x1ea'),_0x3069f3));}else if(_0x3069f3[_0xd518('0x7b')]&&_0x58bffa<_0x3069f3[_0xd518('0x7b')]-_0x5b03b7){freeVariablesPredictive(_0x3069f3);loggerPredictive[_0xd518('0x84')](_0x3069f3['name'],_0xd518('0x1eb'),_0x58bffa,_0xd518('0x1ec'),_0x3069f3[_0xd518('0x7b')],'-',_0x5b03b7,'=',_0x3069f3[_0xd518('0x7b')]-_0x5b03b7,')');}else if(_0x3069f3[_0xd518('0x7b')]&&_0x58bffa>_0x3069f3[_0xd518('0x7b')]+_0x2728fd){freeVariablesPredictive(_0x3069f3);loggerPredictive[_0xd518('0x84')](_0x3069f3[_0xd518('0x47')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x58bffa,_0xd518('0x1ed'),_0x3069f3[_0xd518('0x7b')],'+',_0x2728fd,'=',_0x3069f3[_0xd518('0x7b')]+_0x2728fd,')');}};Dialer[_0xd518('0x1b')][_0xd518('0x1e6')]=function(_0x13b330){var _0x174529=this;return function(_0x1f8e62){return new Promise(function(_0xb803c6,_0x289616){_[_0xd518('0x98')](_0x13b330,_0x1f8e62[0x0]);if(checkGetDataPredictive(_0x1f8e62[0x0])){var _0xa828e9=_0x13b330[_0xd518('0x7b')]=_0x13b330[_0xd518('0x5f')]+_0x13b330[_0xd518('0x59')];var _0x306195=_0x13b330[_0xd518('0x1df')]*0x3c;var _0x33ffe6=_0x1f8e62[0x0][_0xd518('0x76')]+_0x1f8e62[0x0][_0xd518('0x75')];var _0x317aac=(_0x1f8e62[0x0][_0xd518('0x74')]+_0x1f8e62[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1f8e62[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1f8e62[0x0][_0xd518('0x87')];_0x13b330[_0xd518('0x79')]=_0x317aac>0x0?_0x317aac:0x1;switch(_0x13b330[_0xd518('0x1e0')]){case _0xd518('0x1e1'):var _0x46a92a=_0x13b330[_0xd518('0x1ee')]/0x64;return _0x174529[_0xd518('0x1ef')](_0xa828e9,_0x306195,_0x33ffe6,_0x317aac,_0x46a92a)[_0xd518('0x43')](function(_0x498eae){return _0xb803c6(_0x498eae);});case _0xd518('0x1f0'):var _0x4fd29e=_0x13b330[_0xd518('0x1ee')]/0x64;return _0x174529[_0xd518('0x1f1')](_0xa828e9,_0x306195,_0x33ffe6,_0x317aac,_0x4fd29e)[_0xd518('0x43')](function(_0x18aca8){return _0xb803c6(_0x18aca8);});default:return _0x289616(msgResponse(_0xd518('0x1f2'),_0xd518('0x14e'),_0xd518('0x1f3')));}}else{return _0x289616(msgResponse(_0xd518('0x1f2'),_0xd518('0x14e'),_0xd518('0x1f4')));}});};};Dialer[_0xd518('0x1b')][_0xd518('0x1f5')]=function(_0x25f2a6){var _0x1e0789=this;return function(_0x46d6d0){return new Promise(function(_0x146f8b,_0x2fe5f1){_[_0xd518('0x98')](_0x25f2a6,_0x46d6d0[0x0]);if(checkGetDataPredictive(_0x46d6d0[0x0])){loggerPredictive[_0xd518('0x84')](JSON[_0xd518('0x52')](_0x46d6d0[0x0]));if(_0x25f2a6[_0xd518('0x1e0')]===_0xd518('0x1e1')){return _0x1e0789['getVoiceQueueRtPauses'](_0x25f2a6['id'])['then'](function(_0x376e2a){var _0x2e12f8=_0x25f2a6[_0xd518('0x5a')]-_0x376e2a[0x0][_0xd518('0x1f6')];var _0x373ea2=_0x25f2a6[_0xd518('0x1df')]*0x3c;var _0x3b6c8f=_0x46d6d0[0x0]['predictiveIntervalAvgTalktime']+_0x46d6d0[0x0]['predictiveIntervalAvgHoldtime'];var _0x211ea0=(_0x46d6d0[0x0][_0xd518('0x74')]+_0x46d6d0[0x0][_0xd518('0x77')]+_0x46d6d0[0x0][_0xd518('0x8b')])/_0x46d6d0[0x0][_0xd518('0x87')];var _0x1c1592=_0x25f2a6[_0xd518('0x1ee')]/0x64;_0x25f2a6[_0xd518('0x7a')]=_0x376e2a[0x0][_0xd518('0x1f6')]||0x0;_0x25f2a6[_0xd518('0x79')]=_0x211ea0>0x0?_0x211ea0:0x1;return _0x1e0789[_0xd518('0x1ef')](_0x2e12f8,_0x373ea2,_0x3b6c8f,_0x211ea0,_0x1c1592);})['then'](function(_0x21a1da){return _0x146f8b(_0x21a1da);})[_0xd518('0xbb')](function(_0xbb1092){return _0x2fe5f1(msgResponse('[CatchErlangB]',_0xd518('0x14e'),JSON[_0xd518('0x52')](_0xbb1092)));});}if(_0x25f2a6[_0xd518('0x1e0')]===_0xd518('0x1f0')){return _0x1e0789['getVoiceQueueRtPauses'](_0x25f2a6['id'])[_0xd518('0x43')](function(_0x5329b7){var _0x36f044=_0x25f2a6[_0xd518('0x5a')]-_0x5329b7[0x0][_0xd518('0x1f6')];var _0x4cf8db=_0x25f2a6['dialPredictiveInterval']*0x3c;var _0x2ce243=_0x46d6d0[0x0][_0xd518('0x76')]+_0x46d6d0[0x0][_0xd518('0x75')];var _0x4f971d=(_0x46d6d0[0x0][_0xd518('0x74')]+_0x46d6d0[0x0][_0xd518('0x77')]+_0x46d6d0[0x0][_0xd518('0x8b')])/_0x46d6d0[0x0][_0xd518('0x87')];var _0x45204f=_0x25f2a6['dialPredictiveOptimizationPercentage']/0x64;_0x25f2a6[_0xd518('0x7a')]=_0x5329b7[0x0][_0xd518('0x1f6')]||0x0;_0x25f2a6[_0xd518('0x79')]=_0x4f971d>0x0?_0x4f971d:0x1;return _0x1e0789['busyFactor'](_0x36f044,_0x4cf8db,_0x2ce243,_0x4f971d,_0x45204f);})[_0xd518('0x43')](function(_0x4003d2){return _0x146f8b(_0x4003d2);})[_0xd518('0xbb')](function(_0x3be1fa){return _0x2fe5f1(msgResponse(_0xd518('0x1f7'),_0xd518('0x14e'),JSON[_0xd518('0x52')](_0x3be1fa)));});}}else{return _0x2fe5f1(msgResponse('[getDataPredictive]','Failure','check\x20failure'));}});};};Dialer[_0xd518('0x1b')][_0xd518('0x1e7')]=function(_0x30958a){var _0x243ed4=this;return function(){var _0x298ae6=0x0;var _0x2e1a26=Math[_0xd518('0x1da')](_0x30958a[_0xd518('0x1f8')]*0x3e8);if(_0x2e1a26>0x0){_0x2e1a26=_0x2e1a26<0x64?0x64:_0x2e1a26;loggerPredictive[_0xd518('0x84')](_0x30958a[_0xd518('0x47')],_0xd518('0x1f9'),_0x2e1a26,'milliseconds');_0x30958a[_0xd518('0x9a')]=setInterval(function(){_0x243ed4['handlePredictive'](_0x30958a);loggerPredictiveCalls['info'](_0xd518('0x1fa'),_0x298ae6+=0x1);},_0x2e1a26);}else{loggerPredictive[_0xd518('0x84')](_0x30958a[_0xd518('0x47')],_0xd518('0x1fb'));}};};Dialer[_0xd518('0x1b')][_0xd518('0x1fc')]=function(_0x29b607,_0x2c891a){var _0x300e48=this;return function(_0x2f98c2){if(_[_0xd518('0x4e')](_0x2f98c2)){if(_[_0xd518('0xb3')](_0x2c891a[_0xd518('0xdc')])||!_0x2c891a[_0xd518('0x1fd')]){if(_0x29b607[_0xd518('0x65')]===_0xd518('0x9')){_0x29b607[_0xd518('0x138')]=_[_0xd518('0x45')](_0x29b607[_0xd518('0x138')])?!![]:_0x29b607[_0xd518('0x138')];var _0x31a86e=uuid['v4']();_0x300e48[_0xd518('0x12f')][_0x31a86e]=new Action(_0x29b607,_0x2c891a,_0x31a86e);loggerBooked['info']('[booked][checkContactBlack]',_0x31a86e,'queueStatusComplete:\x20',JSON[_0xd518('0x52')](_0x29b607[_0xd518('0x138')]),_0xd518('0x1fe'),_0x29b607[_0xd518('0x47')]);if(_0x29b607[_0xd518('0x138')]){_0x29b607[_0xd518('0x138')]=![];_0x300e48['queueBooked'][_0x300e48[_0xd518('0x12f')][_0x31a86e][_0xd518('0xb7')]]=[];ami[_0xd518('0x153')]({'actionid':_0x31a86e,'action':'queuestatus','queue':_0x29b607[_0xd518('0x47')]})[_0xd518('0xbb')](function(){_0x300e48[_0xd518('0xb6')](_0x29b607);_0x300e48[_0xd518('0xc7')]({'active':![],'ContactId':_0x300e48[_0xd518('0x12f')][_0x31a86e][_0xd518('0xda')],'ListId':_0x300e48[_0xd518('0x12f')][_0x31a86e][_0xd518('0xdb')],'VoiceQueueId':_0x300e48['actions'][_0x31a86e][_0xd518('0xdd')]||undefined,'CampaignId':_0x300e48[_0xd518('0x12f')][_0x31a86e][_0xd518('0xde')]||undefined})[_0xd518('0xbb')](loggerCatch(_0xd518('0x1ff')));delete _0x300e48[_0xd518('0x12f')][_0x31a86e];});}else{loggerBooked[_0xd518('0x84')](_0xd518('0x200'),JSON[_0xd518('0x52')](_0x29b607[_0xd518('0x138')]),_0xd518('0x1fe'),_0x29b607[_0xd518('0x47')]);_0x300e48[_0xd518('0xb6')](_0x29b607);_0x300e48[_0xd518('0xc7')]({'active':![],'ContactId':_0x300e48[_0xd518('0x12f')][_0x31a86e][_0xd518('0xda')],'ListId':_0x300e48[_0xd518('0x12f')][_0x31a86e][_0xd518('0xdb')],'VoiceQueueId':_0x300e48['actions'][_0x31a86e][_0xd518('0xdd')]||undefined,'CampaignId':_0x300e48[_0xd518('0x12f')][_0x31a86e][_0xd518('0xde')]||undefined})[_0xd518('0xbb')](loggerCatch(_0xd518('0x1ff')));delete _0x300e48[_0xd518('0x12f')][_0x31a86e];}}else{return _0x300e48[_0xd518('0x17c')](_0x29b607,_0x2c891a);}}else{if(getDiff(_0x2c891a[_0xd518('0x201')])<_0x29b607[_0xd518('0x202')]*0x3c){if(_0x2c891a[_0xd518('0x167')]&&!_0x2c891a[_0xd518('0x167')][_0xd518('0x203')]){_0x300e48['preview'][_0xd518('0x13b')](_0x2c891a['id'])[_0xd518('0x1e')](function(){_0x300e48[_0xd518('0xb6')](_0x29b607);});}else{_0x300e48[_0xd518('0xc9')]({'active':![]},_0x2c891a['id'],0x1)['finally'](function(){_0x300e48[_0xd518('0xb6')](_0x29b607);});}}else{_0x29b607[_0xd518('0x71')]+=0x1;_0x300e48['updateOriginated'](_0x29b607);if(_0x29b607['dialRecallInQueue']){_0x300e48[_0xd518('0xc7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2c891a[_0xd518('0xda')],'ListId':_0x2c891a[_0xd518('0xdb')],'VoiceQueueId':_0x2c891a[_0xd518('0xdd')]||undefined,'CampaignId':_0x2c891a[_0xd518('0xde')]||undefined})[_0xd518('0xbb')](loggerCatch(_0xd518('0x204')));_0x300e48[_0xd518('0xd3')](createObjHistory(_0x29b607,_0x2c891a,_0xd518('0x205'),0x17,_0xd518('0x206')))[_0xd518('0xbb')](loggerCatch(_0xd518('0x207')));}else{_0x300e48['saveInDb'](createObjHistory(_0x29b607,_0x2c891a,'RECALLFAILEDTIMEOUT',0x16,_0xd518('0x208')),'[Originate][HistoryRecallClose][historyCatch]',_0xd518('0x209'));}}}}else{_0x29b607['outboundBlacklistCallsDay']+=0x1;_0x300e48[_0xd518('0xd9')](createObjHistory(_0x29b607,_0x2c891a,'BLACKLIST',0xd,'Blacklist'),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0xd518('0x1b')][_0xd518('0x169')]=function(_0x912b75){var _0x260272=this;var _0xf3c657=_0x912b75[_0xd518('0x20a')]-_0x912b75[_0xd518('0x7c')]-_0x912b75[_0xd518('0xcc')];emitCampaignSummary(_0x912b75);if(_0xf3c657>0x0){if(_0xf3c657>this[_0xd518('0x25')]){_0xf3c657=this[_0xd518('0x25')];}_0x912b75[_0xd518('0xcc')]+=_0xf3c657;this[_0xd518('0xce')](_0x912b75['id'],_0xf3c657,_0x912b75[_0xd518('0x20b')],_0x912b75)[_0xd518('0x43')](function(_0x1b8e5f){_0x912b75[_0xd518('0xcc')]-=_0xf3c657;_0x912b75[_0xd518('0xcc')]=_0x912b75[_0xd518('0xcc')]>0x0?_0x912b75[_0xd518('0xcc')]:0x0;if(!checkContactEmpty(_0x1b8e5f)){_0x912b75['message']=_0xd518('0x20c');logger[_0xd518('0x84')](_0xd518('0x20d')+_0x912b75[_0xd518('0x47')]);}else{_0x912b75[_0xd518('0x7c')]+=_0x1b8e5f[_0xd518('0x152')];_0x912b75[_0xd518('0x46')]=_0xd518('0x20e');for(var _0x17e624=0x0;_0x17e624<_0x1b8e5f[_0xd518('0x152')];_0x17e624+=0x1){_0x912b75[_0xd518('0x20f')]+=0x1;if(_['isNil'](_0x1b8e5f[_0x17e624])||_[_0xd518('0xb3')](_0x1b8e5f[_0x17e624][_0xd518('0x195')])||_[_0xd518('0xb3')](_0x1b8e5f[_0x17e624][_0xd518('0x17f')])){_0x260272['emptyContact']('[actionOriginate]\x20',_0x912b75,_0x1b8e5f[_0x17e624]);}else{_0x260272['checkIsBlackListIvr'](_['pick'](_0x1b8e5f[_0x17e624],[_0xd518('0xde'),_0xd518('0x17f')]))['then'](_0x260272[_0xd518('0x1fc')](_0x912b75,_0x1b8e5f[_0x17e624]))[_0xd518('0xbb')](_0x260272[_0xd518('0xd8')](_0xd518('0x210'),_0x912b75));}}}})[_0xd518('0xbb')](loggerGetContactDialer(_0xd518('0x211'),_0x912b75,_0xf3c657));}};Dialer[_0xd518('0x1b')]['handlePower']=function(_0xe310a9,_0x33906f){var _0x1fbf7f=this;var _0x1e29e1=[];var _0x175551=_0x33906f>=0x1?_0x33906f:0x1;if(_0xe310a9[_0xd518('0x65')]===_0xd518('0x9')){_0x175551=0x1;}var _0x40af7e=Math[_0xd518('0x1da')](_0xe310a9['available']*_0x175551)-_0xe310a9[_0xd518('0x7c')]-_0xe310a9['temp'];emitVoiceQueueSummary(_0xe310a9);if(_0xe310a9[_0xd518('0x212')]>0x0){var _0x34292f=_0xe310a9[_0xd518('0x212')]-_0xe310a9['originated']-_0xe310a9['talking']-_0xe310a9['temp']-_0xe310a9[_0xd518('0x5b')];if(_0x40af7e>_0x34292f){_0x40af7e=_0x34292f;}}if(_0x40af7e>0x0){if(_0xe310a9[_0xd518('0x65')]==='booked'){_0x40af7e=0x1;}if(_0x40af7e>this['maxNumberOriginate']){_0x40af7e=this[_0xd518('0x25')];}_0xe310a9[_0xd518('0xcc')]+=_0x40af7e;for(var _0x4e1292 in this['agents']){if(typeof this[_0xd518('0x23')][_0x4e1292]!==_0xd518('0xd5')){if(this['agents'][_0x4e1292]['state']==='not_inuse'&&this[_0xd518('0x23')][_0x4e1292]['status']==='reachable'){_0x1e29e1[_0xd518('0x134')](this[_0xd518('0x23')][_0x4e1292]['id']);}}}this[_0xd518('0xcb')](_0xe310a9['id'],_0x1e29e1,_0x40af7e,_0xe310a9['dialOrderByScheduledAt'],_0xe310a9)[_0xd518('0x43')](function(_0xee294){_0xe310a9['temp']-=_0x40af7e;_0xe310a9['temp']=_0xe310a9[_0xd518('0xcc')]>0x0?_0xe310a9[_0xd518('0xcc')]:0x0;if(!checkContactEmpty(_0xee294)){_0x1fbf7f[_0xd518('0xba')](_0xe310a9)['then'](sendMessageReschedule(_0xe310a9))[_0xd518('0xbb')](loggerCatch(_0xd518('0xbc')));}else{_0xe310a9[_0xd518('0x7c')]+=_0xee294[_0xd518('0x152')];_0xe310a9[_0xd518('0x46')]=_0xe310a9[_0xd518('0x65')]===_0xd518('0x9')?_0xd518('0x186'):'RUNNING';for(var _0x552a4c=0x0;_0x552a4c<_0xee294[_0xd518('0x152')];_0x552a4c+=0x1){if(_[_0xd518('0xb3')](_0xee294[_0x552a4c])||_['isNil'](_0xee294[_0x552a4c][_0xd518('0x195')])||_['isNil'](_0xee294[_0x552a4c]['phone'])){_0x1fbf7f[_0xd518('0x213')](_0xd518('0x214'),_0xe310a9,_0xee294[_0x552a4c]);}else{_0x1fbf7f['checkIsBlackList'](_[_0xd518('0x135')](_0xee294[_0x552a4c],[_0xd518('0xdd'),_0xd518('0x17f')]))['then'](_0x1fbf7f[_0xd518('0x1fc')](_0xe310a9,_0xee294[_0x552a4c]))[_0xd518('0xbb')](_0x1fbf7f[_0xd518('0xd8')]('[actionOriginate]\x20',_0xe310a9));}}}})[_0xd518('0xbb')](loggerGetContactDialer(_0xd518('0x215'),_0xe310a9,_0x40af7e));}};Dialer[_0xd518('0x1b')]['handlePredictive']=function(_0x47b795){if(_0x47b795[_0xd518('0x212')]>0x0){var _0x32acbb=_0x47b795['dialLimitQueue']-_0x47b795[_0xd518('0x7c')]-_0x47b795[_0xd518('0x5f')];if(_0x32acbb>0x0){this[_0xd518('0x216')](_0x47b795);}else{loggerPredictiveCalls[_0xd518('0x84')](_0xd518('0x217'));}}else{this[_0xd518('0x216')](_0x47b795);}};Dialer['prototype'][_0xd518('0x216')]=function(_0x45d1a4){var _0x1cecb2=this;var _0x160ea8=[];_0x45d1a4[_0xd518('0x7c')]+=0x1;for(var _0x1fb13e in this[_0xd518('0x23')]){if(typeof this[_0xd518('0x23')][_0x1fb13e]!==_0xd518('0xd5')){if(this[_0xd518('0x23')][_0x1fb13e][_0xd518('0xad')]===_0xd518('0x218')&&this[_0xd518('0x23')][_0x1fb13e][_0xd518('0xb4')]===_0xd518('0xe3')){_0x160ea8['push'](this[_0xd518('0x23')][_0x1fb13e]['id']);}}}this[_0xd518('0xcb')](_0x45d1a4['id'],_0x160ea8,0x1,_0x45d1a4[_0xd518('0x20b')],_0x45d1a4)[_0xd518('0x43')](function(_0x13dc3a){if(!checkContactEmpty(_0x13dc3a)){checkContactLowerLimitOriginate(_0x45d1a4,0x1,0x0);_0x1cecb2[_0xd518('0xba')](_0x45d1a4)[_0xd518('0x43')](sendMessageReschedule(_0x45d1a4))[_0xd518('0xbb')](loggerCatch(_0xd518('0xbc')));}else{_0x45d1a4[_0xd518('0x46')]=_0xd518('0x20e');if(_['isNil'](_0x13dc3a[0x0])||_['isNil'](_0x13dc3a[0x0]['Contact'])||_['isNil'](_0x13dc3a[0x0]['phone'])){_0x1cecb2[_0xd518('0x213')](_0xd518('0x214'),_0x45d1a4,_0x13dc3a[0x0]);}else{_0x1cecb2[_0xd518('0xbd')](_[_0xd518('0x135')](_0x13dc3a[0x0],['VoiceQueueId',_0xd518('0x17f')]))[_0xd518('0x43')](_0x1cecb2[_0xd518('0x1fc')](_0x45d1a4,_0x13dc3a[0x0]))[_0xd518('0xbb')](_0x1cecb2[_0xd518('0xd8')](_0xd518('0x219'),_0x45d1a4));}}})['catch'](loggerGetContactDialer(_0xd518('0x21a'),_0x45d1a4,0x1));emitVoiceQueueSummary(_0x45d1a4);};Dialer[_0xd518('0x1b')][_0xd518('0x1ef')]=function(_0x53a415,_0x4a26b7,_0x33967a,_0x5bb709,_0x406492,_0x3bf9c4){loggerPredictive[_0xd518('0x84')](_0xd518('0x21b'));loggerPredictive[_0xd518('0x84')](_0xd518('0x21c'),_0x53a415);loggerPredictive['info'](_0xd518('0x21d'),_0x4a26b7);loggerPredictive[_0xd518('0x84')](_0xd518('0x21e'),_0x33967a);loggerPredictive[_0xd518('0x84')](_0xd518('0x21f'),_0x5bb709);loggerPredictive['info'](_0xd518('0x220'),_0x406492);loggerPredictive[_0xd518('0x84')](_0xd518('0x97'));return new Promise(function(_0xd65c13,_0x542951){if(_0x53a415<=0x0||isNaN(_0x53a415)){return _0x542951(msgResponse('[abandonmentRate]',_0xd518('0x51'),_0xd518('0x221')+_0x53a415));}if(_0x33967a<=0x0||isNaN(_0x33967a)){return _0x542951(msgResponse(_0xd518('0x222'),'Error','Ts\x20=\x20'+_0x33967a));}if(_0x5bb709<=0x0||isNaN(_0x5bb709)){return _0x542951(msgResponse(_0xd518('0x222'),_0xd518('0x51'),_0xd518('0x223')+_0x5bb709));}if(_0x4a26b7<=0x0||isNaN(_0x4a26b7)){return _0x542951(msgResponse(_0xd518('0x222'),'Error',_0xd518('0x224')+_0x4a26b7));}if(_0x406492<=0x0||isNaN(_0x406492)){return _0x542951(msgResponse(_0xd518('0x222'),_0xd518('0x51'),_0xd518('0x225')+_0x406492));}_0x3bf9c4=_0x3bf9c4||0x0;var _0xc37a45=0x1/_0x33967a;var _0x2242e8=0x0;var _0x4e0cdd=0x0;var _0xe63342=0x0;var _0x49aa98=0x0;for(var _0x5173c0=0x0;_0xe63342<_0x406492;_0x5173c0+=0x1){_0x4e0cdd=_0x5173c0/_0x4a26b7;_0x2242e8=(_0x5bb709*_0x4e0cdd+_0x3bf9c4)/_0xc37a45;_0xe63342=erlangb(_0x2242e8,_0x53a415);_0x49aa98=_0x2242e8/_0x53a415*(0x1-erlangb(_0x2242e8,_0x53a415));}return _0xd65c13({'erlangCalls':_0x5173c0,'erlangCallToSecond':_0x4a26b7/_0x5173c0,'erlangAbandonmentRate':_0xe63342,'erlangBusyFactor':_0x49aa98});});};Dialer[_0xd518('0x1b')][_0xd518('0x1f1')]=function(_0x30f4b3,_0x497085,_0x426587,_0x3e264b,_0x102af2,_0x14a5d2){loggerPredictive[_0xd518('0x84')](_0xd518('0x226'));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',_0x30f4b3);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x497085);loggerPredictive[_0xd518('0x84')](_0xd518('0x21e'),_0x426587);loggerPredictive[_0xd518('0x84')](_0xd518('0x21f'),_0x3e264b);loggerPredictive[_0xd518('0x84')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x102af2);loggerPredictive[_0xd518('0x84')](_0xd518('0x97'));return new Promise(function(_0x1c5c0a,_0x18ad85){if(_0x30f4b3<=0x0||isNaN(_0x30f4b3)){return _0x18ad85(msgResponse('[busyFactor]',_0xd518('0x51'),_0xd518('0x221')+_0x30f4b3));}if(_0x426587<=0x0||isNaN(_0x426587)){return _0x18ad85(msgResponse('[busyFactor]',_0xd518('0x51'),_0xd518('0x227')+_0x426587));}if(_0x3e264b<=0x0||isNaN(_0x3e264b)){return _0x18ad85(msgResponse(_0xd518('0x228'),_0xd518('0x51'),_0xd518('0x223')+_0x3e264b));}if(_0x497085<=0x0||isNaN(_0x497085)){return _0x18ad85(msgResponse(_0xd518('0x228'),_0xd518('0x51'),_0xd518('0x224')+_0x497085));}if(_0x102af2<=0x0||isNaN(_0x102af2)){return _0x18ad85(msgResponse(_0xd518('0x228'),_0xd518('0x51'),_0xd518('0x229')+_0x102af2));}_0x14a5d2=_0x14a5d2||0x0;var _0x2c51ee=0x1/_0x426587;var _0x5461cc=0x0;var _0x14f3a2=0x0;var _0x36ddde=0x0;var _0x446ef9=0x0;for(var _0x3e9b41=0x0;_0x446ef9<_0x102af2;_0x3e9b41+=0x1){_0x14f3a2=_0x3e9b41/_0x497085;_0x5461cc=(_0x3e264b*_0x14f3a2+_0x14a5d2)/_0x2c51ee;_0x36ddde=erlangb(_0x5461cc,_0x30f4b3);_0x446ef9=_0x5461cc/_0x30f4b3*(0x1-erlangb(_0x5461cc,_0x30f4b3));}return _0x1c5c0a({'erlangCalls':_0x3e9b41,'erlangCallToSecond':_0x497085/_0x3e9b41,'erlangAbandonmentRate':_0x36ddde,'erlangBusyFactor':_0x446ef9});});};module[_0xd518('0x22a')]=Dialer; \ No newline at end of file +var _0xedc4=['[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','locked','paused','stateinterface','rrmemory','queueBooked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','command','interval','content','indexOf','true','iftime\x20%s,%s','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','dialPowerLevel','Queue','checkPreviewRecallReminder','handlePreviewRecallNotifications','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','checkIsTrunkReachable','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','throttle','filter','map','checkIfTimeIntervals','\x5cw{0,','pow','replace','match','object','originate','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','Contact','tags','updatedAt','%s%s','XMD-','callerid','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','phone','variables','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','OriginateError','[originate][error]','getQueue','isSuccess','response','callProgressDetecting','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','dialCongestionRetryFrequency','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimization','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','one\x20call\x20every:','[handlePredictive]','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','Queue:\x20','scheduledat','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','tryOriginatePredictive','RUNNING','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./queueCallerAbandon','./hangup','env','127.0.0.1','roundrobin','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','startProgressive','ivrOriginated','queueBookedRR','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','AGENTS_NOT_LOGGED','name','message','NOT_ACTIVE','Interval','\x20INTERVAL_IS_NULL','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','emit','type','outbound','strategy','answered','available','loggedIn','sumBillable','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','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','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','clearing\x20variable\x20start\x20progressive','startPredictive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','length','originated','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','pTalking','debug','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','enqueue','Action','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','saveInDb','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','status','reachable','SIP/%s','unmonitored','createHistory','uniqueId','isNil','variable','amdstatus','exten','dialAMDActive','value','HANGUP','uniqueid','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','buildObj','amd','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','custom:amd','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countnoanswerretry','countdropretry','syncHangup','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','Unknow','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','dropreason','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xedc4,0xf4));var _0x4edc=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xedc4[_0x2b4411];return _0x8e41ef;};'use strict';var util=require(_0x4edc('0x0'));var _=require(_0x4edc('0x1'));var uuid=require(_0x4edc('0x2'));var moment=require(_0x4edc('0x3'));var rr=require('rr');var md5=require(_0x4edc('0x4'));var Redis=require(_0x4edc('0x5'));var ut=require(_0x4edc('0x6'));var config=require(_0x4edc('0x7'));var logger=require(_0x4edc('0x8'))(_0x4edc('0x9'));var loggerBooked=require(_0x4edc('0x8'))(_0x4edc('0xa'));var loggerPredictive=require(_0x4edc('0x8'))(_0x4edc('0xb'));var loggerPredictiveCalls=require('../../../config/logger')(_0x4edc('0xc'));var loggerSyncQueueSummary=require(_0x4edc('0x8'))(_0x4edc('0xd'));var ami=require(_0x4edc('0xe'));config[_0x4edc('0xf')]=_[_0x4edc('0x10')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4edc('0xf')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperAdditionalPhone=require(_0x4edc('0x11'));var cmHopperBlack=require(_0x4edc('0x12'));var voiceQueueRt=require(_0x4edc('0x13'));var RpcSetting=require(_0x4edc('0x14'));var Action=require(_0x4edc('0x15'));var History=require(_0x4edc('0x16'));var Final=require(_0x4edc('0x17'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x4edc('0x18'));var Hangup=require(_0x4edc('0x19'));var ipAgi=process[_0x4edc('0x1a')]['XCALLY_IP_AGI']||_0x4edc('0x1b');var strategy={'rrmemory':'rrmemory','roundrobin':_0x4edc('0x1c')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x4edc('0x1d')]['enqueue']=function(_0x37ed40){this[_0x4edc('0x1e')]=this[_0x4edc('0x1e')]?this['tail'][_0x4edc('0x1f')](_0x37ed40):_0x37ed40();};function Dialer(_0x217447,_0x5c5a32){this[_0x4edc('0x20')]=new Sequence();this[_0x4edc('0x21')]=_0x5c5a32;this['voiceQueues']=_0x217447[_0x4edc('0x22')];this[_0x4edc('0x23')]=_0x217447[_0x4edc('0x23')];this[_0x4edc('0x24')]=_0x217447[_0x4edc('0x24')];this['trunks']=_0x217447[_0x4edc('0x25')];this[_0x4edc('0x26')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x4edc('0x27')]={};this['contactsId']={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this[_0x4edc('0x28')]={};this[_0x4edc('0x29')]={};this['queueBooked']={};this[_0x4edc('0x2a')]={};ami['on']('agentconnect',this[_0x4edc('0x2b')][_0x4edc('0x2c')](this));ami['on']('queuecallerabandon',this[_0x4edc('0x2d')]['bind'](this));ami['on'](_0x4edc('0x2e'),this[_0x4edc('0x2f')][_0x4edc('0x2c')](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on'](_0x4edc('0x30'),this[_0x4edc('0xd')]['bind'](this));ami['on'](_0x4edc('0x31'),this[_0x4edc('0x32')][_0x4edc('0x2c')](this));ami['on'](_0x4edc('0x33'),this['syncHangup'][_0x4edc('0x2c')](this));ami['on'](_0x4edc('0x34'),this[_0x4edc('0x35')][_0x4edc('0x2c')](this));ami['on'](_0x4edc('0x36'),this[_0x4edc('0x37')][_0x4edc('0x2c')](this));ami['on'](_0x4edc('0x38'),this['syncQueueMember'][_0x4edc('0x2c')](this));ami['on'](_0x4edc('0x39'),this[_0x4edc('0x3a')][_0x4edc('0x2c')](this));this[_0x4edc('0x3b')]();this[_0x4edc('0x3c')]();RpcSetting[_0x4edc('0x3d')]()[_0x4edc('0x3e')](function(_0x568012){previewRecallmeReminderInterval=_0x568012['previewRecallmeReminderInterval'];});}function isNotNull(_0x555469){return _0x555469!==null&&!_[_0x4edc('0x3f')](_0x555469);}function checkIsLoggedIn(_0x281368,_0x168b02){return function(){if(_0x168b02<=0x0){_0x281368['message']=_0x4edc('0x40');throw _0x281368[_0x4edc('0x41')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x1a714c){return _0x1a714c;}function checkIsActive(_0x28bc62,_0x588535){return function(){if(!isActive(_0x588535)){_0x28bc62[_0x4edc('0x42')]=_0x4edc('0x43');throw _0x28bc62[_0x4edc('0x41')]+'\x20NOT\x20Active';}};}function checkInterval(_0x4de80c){return function(){if(!isNotNull(_0x4de80c[_0x4edc('0x44')])){_0x4de80c[_0x4edc('0x42')]='INTERVAL_IS_NULL';throw _0x4de80c['name']+_0x4edc('0x45');}if(!isNotNull(_0x4de80c[_0x4edc('0x44')]['Intervals'])){_0x4de80c[_0x4edc('0x42')]=_0x4edc('0x46');throw _0x4de80c['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x4edc('0x47')](_0x4de80c[_0x4edc('0x44')]['Intervals']))){_0x4de80c[_0x4edc('0x42')]='INTERVAL_IS_NULL';throw _0x4de80c[_0x4edc('0x41')]+_0x4edc('0x45');}};}function msgResponse(_0x33f8b6,_0x166381,_0x118382){return{'action':_0x33f8b6,'response':_0x166381,'message':_0x118382,'stack':_0x118382};}function myreject(_0x5b9732){return function(_0x1a6047){return _0x5b9732(msgResponse(_0x4edc('0x48'),_0x4edc('0x49'),JSON[_0x4edc('0x4a')](_0x1a6047)));};}function getSeconds(_0x465d21,_0x476565){var _0x1bfbd1=moment(_0x465d21)[_0x4edc('0x4b')](0x0);var _0x3121d3=moment(_0x476565)['milliseconds'](0x0);return _0x1bfbd1['diff'](_0x3121d3,'seconds');}function emit(_0x2028eb,_0x17ab6a,_0x1c6322){io['to'](_0x2028eb)[_0x4edc('0x4c')](_0x17ab6a,_0x1c6322);}function emitVoiceQueueSummary(_0x5b94f7){if(_0x5b94f7[_0x4edc('0x4d')]===_0x4edc('0x4e')){var _0x52d3d3={'id':_0x5b94f7['id'],'name':_0x5b94f7[_0x4edc('0x41')],'strategy':_0x5b94f7[_0x4edc('0x4f')],'answered':_0x5b94f7[_0x4edc('0x50')],'available':_0x5b94f7[_0x4edc('0x51')],'loggedIn':_0x5b94f7[_0x4edc('0x52')],'pTalking':_0x5b94f7['pTalking'],'sumBillable':_0x5b94f7[_0x4edc('0x53')],'sumDuration':_0x5b94f7['sumDuration'],'sumHoldTime':_0x5b94f7['sumHoldTime']||0x0,'talking':_0x5b94f7[_0x4edc('0x54')],'total':_0x5b94f7[_0x4edc('0x55')],'type':_0x5b94f7[_0x4edc('0x4d')],'unmanaged':_0x5b94f7[_0x4edc('0x56')],'abandoned':_0x5b94f7[_0x4edc('0x57')],'waiting':_0x5b94f7[_0x4edc('0x58')],'loggedInDb':_0x5b94f7[_0x4edc('0x59')],'dialActive':_0x5b94f7[_0x4edc('0x5a')],'dialMethod':_0x5b94f7[_0x4edc('0x5b')],'dialOriginateCallerIdName':_0x5b94f7[_0x4edc('0x5c')],'dialOriginateCallerIdNumber':_0x5b94f7[_0x4edc('0x5d')],'dialOriginateTimeout':_0x5b94f7[_0x4edc('0x5e')],'dialPrefix':_0x5b94f7[_0x4edc('0x5f')],'outboundAnswerAgiCallsDay':_0x5b94f7['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x5b94f7['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x5b94f7[_0x4edc('0x60')],'outboundBusyCallsDay':_0x5b94f7[_0x4edc('0x61')],'outboundCongestionCallsDay':_0x5b94f7[_0x4edc('0x62')],'outboundDropCallsDayACS':_0x5b94f7[_0x4edc('0x63')],'outboundDropCallsDayCallersExit':_0x5b94f7['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x5b94f7['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x5b94f7[_0x4edc('0x64')],'outboundNoSuchCallsDay':_0x5b94f7[_0x4edc('0x65')],'outboundOriginateFailureCallsDay':_0x5b94f7[_0x4edc('0x66')],'outboundReCallsDay':_0x5b94f7[_0x4edc('0x67')],'outboundRejectCallsDay':_0x5b94f7['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x5b94f7[_0x4edc('0x68')],'predictiveIntervalAnsweredCalls':_0x5b94f7['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x5b94f7[_0x4edc('0x69')],'predictiveIntervalAvgTalktime':_0x5b94f7[_0x4edc('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x5b94f7[_0x4edc('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x5b94f7['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x5b94f7['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x5b94f7[_0x4edc('0x6c')],'predictiveIntervalHitRate':_0x5b94f7[_0x4edc('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x5b94f7[_0x4edc('0x6e')],'predictiveIntervalPauses':_0x5b94f7[_0x4edc('0x6f')],'predictiveIntervalAvailable':_0x5b94f7[_0x4edc('0x70')],'predictiveIntervalTotalCalls':_0x5b94f7[_0x4edc('0x71')],'message':_0x5b94f7[_0x4edc('0x42')],'originated':_0x5b94f7['originated'],'erlangCalls':_0x5b94f7[_0x4edc('0x72')],'erlangCallToSecond':_0x5b94f7[_0x4edc('0x73')],'erlangAbandonmentRate':_0x5b94f7[_0x4edc('0x74')],'erlangBusyFactor':_0x5b94f7[_0x4edc('0x75')],'startPredictive':_0x5b94f7['startPredictive'],'startProgressive':_0x5b94f7[_0x4edc('0x28')]};if(_0x5b94f7[_0x4edc('0x76')]){_0x52d3d3['Trunk']={'id':_0x5b94f7[_0x4edc('0x76')]['id'],'name':_0x5b94f7[_0x4edc('0x76')][_0x4edc('0x41')],'active':_0x5b94f7[_0x4edc('0x76')][_0x4edc('0x77')],'callerid':_0x5b94f7[_0x4edc('0x76')]['callerid']};}if(_0x5b94f7[_0x4edc('0x44')]){_0x52d3d3[_0x4edc('0x44')]={'id':_0x5b94f7[_0x4edc('0x44')]['id'],'name':_0x5b94f7[_0x4edc('0x44')]['name']};}var _0x49a1db=md5(JSON['stringify'](_0x52d3d3));if(_0x5b94f7[_0x4edc('0x4')]!==_0x49a1db){_0x5b94f7[_0x4edc('0x4')]=_0x49a1db;emit(util[_0x4edc('0x78')](_0x4edc('0x79'),_0x52d3d3[_0x4edc('0x41')]),_0x4edc('0x7a'),_0x52d3d3);}}}function emitCampaignSummary(_0x5c5424){if(_0x5c5424['type']===_0x4edc('0x7b')){emit(util[_0x4edc('0x78')](_0x4edc('0x7c'),_0x5c5424[_0x4edc('0x41')]),_0x4edc('0x7d'),_0x5c5424);}}function checkGetDataPredictive(_0x29fbf2){if(isNotNull(_0x29fbf2)&&!_[_0x4edc('0x47')](_0x29fbf2)){loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x7f'));loggerPredictive['info'](_0x4edc('0x80'),_0x29fbf2[_0x4edc('0x71')]);loggerPredictive['info'](_0x4edc('0x81'),_0x29fbf2[_0x4edc('0x82')]);loggerPredictive[_0x4edc('0x7e')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x29fbf2[_0x4edc('0x83')]);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x84'),_0x29fbf2['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0x4edc('0x85'),_0x29fbf2['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x86'),_0x29fbf2[_0x4edc('0x6a')]);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x87'));if(_0x29fbf2[_0x4edc('0x71')]>0x0){if(!_['isUndefined'](_0x29fbf2[_0x4edc('0x6a')])&&_0x29fbf2['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x88'));if(!_[_0x4edc('0x3f')](_0x29fbf2['predictiveIntervalAvgHoldtime'])&&_0x29fbf2[_0x4edc('0x69')]>0x0){return!![];}loggerPredictive[_0x4edc('0x7e')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x89'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5d609d){return function(_0xc5ecd8){loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x8a'));loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x8b'),_0xc5ecd8['erlangCalls']);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x8c'),_0xc5ecd8[_0x4edc('0x73')]);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x8d'),_0xc5ecd8['erlangAbandonmentRate']);loggerPredictive['info'](_0x4edc('0x8e'),_0xc5ecd8[_0x4edc('0x75')]);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x8d'),_0xc5ecd8[_0x4edc('0x74')]);loggerPredictive['info'](_0x4edc('0x87'));_[_0x4edc('0x8f')](_0x5d609d,_0xc5ecd8);};}function getDiff(_0x22bfb5){var _0x4a30bd=moment()['milliseconds'](0x0);var _0x4fb9a1=moment(_0x22bfb5)[_0x4edc('0x4b')](0x0);return _0x4a30bd[_0x4edc('0x90')](_0x4fb9a1,'seconds');}function ifInterval(_0x1831a6,_0x2177dd){if(_[_0x4edc('0x3f')](_0x2177dd)){return![];}return getDiff(_0x2177dd)<_0x1831a6*0x3c;}function freeVariablesPredictive(_0x4342b2){if(isNotNull(_0x4342b2)){if(!_[_0x4edc('0x3f')](_0x4342b2['startProgressive'])){_0x4342b2['startProgressive']=undefined;loggerPredictive[_0x4edc('0x7e')](_0x4342b2[_0x4edc('0x41')],_0x4edc('0x91'));}if(!_[_0x4edc('0x3f')](_0x4342b2[_0x4edc('0x92')])){_0x4342b2[_0x4edc('0x92')]=undefined;loggerPredictive[_0x4edc('0x7e')](_0x4342b2[_0x4edc('0x41')],_0x4edc('0x93'));}if(!_['isUndefined'](_0x4342b2['handlePredictive'])){clearInterval(_0x4342b2['handlePredictive']);_0x4342b2[_0x4edc('0x94')]=undefined;loggerPredictive[_0x4edc('0x7e')](_0x4342b2[_0x4edc('0x41')],_0x4edc('0x95'));}}}function erlangb(_0x26d3ca,_0x4dfab3){if(_0x4dfab3===0x0){return 0x0;}var _0x4f8a3d=0x1;for(var _0x53a5b2=0x1;_0x53a5b2<=_0x4dfab3;_0x53a5b2+=0x1){_0x4f8a3d=0x1+_0x4f8a3d*_0x53a5b2/_0x26d3ca;}return 0x1/_0x4f8a3d;}function isVoiceQueueOutbound(_0xfe0d95){return _0xfe0d95===_0x4edc('0x4e');}function isNotPreview(_0x56520d){return _0x56520d!==_0x4edc('0x21');}function isCampaignIvr(_0x5a16f3){return _0x5a16f3===_0x4edc('0x7b');}function getCallerId(_0x5580e6,_0x1e429a,_0x647001){if(!_[_0x4edc('0x3f')](_0x647001)&&typeof _0x647001==='string'&&!_[_0x4edc('0x47')](_0x647001)){if(!_[_0x4edc('0x3f')](_0x1e429a)&&typeof _0x1e429a===_0x4edc('0x96')&&!_['isEmpty'](_0x1e429a)){return util[_0x4edc('0x78')](_0x4edc('0x97'),_0x1e429a,_0x647001);}return util['format']('\x22%s\x22\x20<%s>',_0x647001,_0x647001);}if(!_[_0x4edc('0x3f')](_0x5580e6)&&typeof _0x5580e6===_0x4edc('0x96')&&!_[_0x4edc('0x47')](_0x5580e6)){return _0x5580e6;}return _0x4edc('0x98');}function loggerCatchQueueSummary(_0x3f7f19,_0x37e6d2){return function(_0x27db61){freeVariablesPredictive(_0x37e6d2);emitVoiceQueueSummary(_0x37e6d2);emitCampaignSummary(_0x37e6d2);loggerSyncQueueSummary['debug'](_0x3f7f19,util[_0x4edc('0x99')](_0x27db61,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x51223f,_0x352f5a){return function(_0x5c56f7){loggerPredictive[_0x4edc('0x9a')](_0x352f5a['name'],_0x51223f);loggerPredictive['error'](_0x5c56f7['stack']);freeVariablesPredictive(_0x352f5a);};}function loggerCatch(_0x31816b){return function(_0x1ba56c){logger[_0x4edc('0x9a')](_0x31816b,util[_0x4edc('0x99')](_0x1ba56c,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x298451){return _0x298451&&!_[_0x4edc('0x3f')](_0x298451)&&_0x298451[_0x4edc('0x9b')]>0x0;}function decremetOriginate(_0x675ff0){if(!_['isUndefined'](_0x675ff0)&&_0x675ff0!==null){if(typeof _0x675ff0[_0x4edc('0x9c')]!==_0x4edc('0x9d')){if(_0x675ff0[_0x4edc('0x9c')]>0x0){_0x675ff0[_0x4edc('0x9c')]-=0x1;}else{logger['error']('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x4edc('0x9a')](_0x4edc('0x9e'));}}function checkContactLowerLimitOriginate(_0xd568d,_0x117e14,_0xdf94a1){if(_0x117e14>_0xdf94a1){for(var _0x366b86=0x0;_0x366b86<_0x117e14-_0xdf94a1;_0x366b86+=0x1){decremetOriginate(_0xd568d);}}}function loggerGetContactDialer(_0x5d3829,_0xd57ea4,_0x5da033){return function(_0x783971){checkContactLowerLimitOriginate(_0xd57ea4,_0x5da033,0x0);logger[_0x4edc('0x9a')](_0x5d3829,util[_0x4edc('0x99')](_0x783971,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2bd1f7){return function(_0x3311f6){if(isNotNull(_0x3311f6)&&isNotNull(_0x3311f6[0x0])){if(_0x3311f6[0x0]['contactsRescheduled']>0x0){_0x2bd1f7[_0x4edc('0x42')]='RESCHEDULED_CONTACTS';logger[_0x4edc('0x7e')]('[getContactDialer2][ReScheduled]'+_0x2bd1f7['name'],_0x3311f6[0x0][_0x4edc('0x9f')],'contacts');}else{_0x2bd1f7[_0x4edc('0x42')]=_0x4edc('0xa0');logger[_0x4edc('0x7e')]('[getContactDialer2][Empty]'+_0x2bd1f7[_0x4edc('0x41')]);}}};}function notSendMessagesQueue(_0x40fc17){if(_0x40fc17[_0x4edc('0xa1')]){freeVariablesPredictive(_0x40fc17);if(_0x40fc17[_0x4edc('0x9c')]===0x0&&_0x40fc17[_0x4edc('0x54')]===0x0&&_0x40fc17[_0x4edc('0x58')]===0x0&&(_0x40fc17[_0x4edc('0xa2')]||0x0)===0x0){_0x40fc17[_0x4edc('0xa1')]=![];_0x40fc17[_0x4edc('0x51')]=0x0;_0x40fc17[_0x4edc('0x42')]=_0x4edc('0x43');loggerSyncQueueSummary[_0x4edc('0xa3')](_0x4edc('0xa4'),_0x40fc17[_0x4edc('0x41')],_0x4edc('0xa5'));}else{_0x40fc17[_0x4edc('0x42')]=_0x4edc('0xa6');loggerSyncQueueSummary[_0x4edc('0xa3')](_0x4edc('0xa4'),_0x40fc17[_0x4edc('0x41')],'is\x20disactive');}emitVoiceQueueSummary(_0x40fc17);}}function notSendMessagesCampaign(_0x49fdc8){if(_0x49fdc8['sendMessageOneNotActive']){if(_0x49fdc8[_0x4edc('0x9c')]===0x0){_0x49fdc8['sendMessageOneNotActive']=![];_0x49fdc8[_0x4edc('0x42')]=_0x4edc('0x43');loggerSyncQueueSummary['debug'](_0x4edc('0xa7'),_0x49fdc8['name'],'is\x20not\x20active');}else{_0x49fdc8['message']=_0x4edc('0xa6');loggerSyncQueueSummary[_0x4edc('0xa3')](_0x4edc('0xa7'),_0x49fdc8[_0x4edc('0x41')],'is\x20disactive');}emitCampaignSummary(_0x49fdc8);}}function createObjHistory(_0x527c3d,_0x155163,_0x3adbbe,_0x1f5b12,_0x167458){_0x527c3d[_0x4edc('0x42')]=_0x3adbbe;var _0x183bb1=new Action(_0x527c3d,_0x155163);var _0x3e8f2c=new History(_0x183bb1);_0x3e8f2c[_0x4edc('0xa8')]=_0x1f5b12;_0x3e8f2c[_0x4edc('0xa9')]=_0x167458;_0x3e8f2c[_0x4edc('0xaa')]=_0x183bb1[_0x4edc('0xab')];return _0x3e8f2c;}Dialer[_0x4edc('0x1d')][_0x4edc('0x3c')]=function(){var _0xdc032a=this;setInterval(function(){_0xdc032a[_0x4edc('0xac')](_0xdc032a['uniqueId'],_0x4edc('0xad'));_0xdc032a[_0x4edc('0xac')](_0xdc032a[_0x4edc('0x27')],_0x4edc('0xae'));},0x32c8);};Dialer[_0x4edc('0x1d')]['clearZombieChannels']=function(_0x2feb43,_0x1ad5bf){var _0x552165=this;for(var _0x1cb729 in _0x2feb43){if(typeof _0x2feb43[_0x1cb729]!==_0x4edc('0x9d')){this[_0x4edc('0x20')][_0x4edc('0xaf')](function(){if(!_['isNil'](_0x2feb43[_0x1cb729])){return ami[_0x4edc('0xb0')]({'action':'status','channel':_0x2feb43[_0x1cb729][_0x4edc('0xb1')]})['catch'](function(_0x5ba021){if(_0x5ba021[_0x4edc('0x42')]===_0x4edc('0xb2')){setTimeout(function(){if(_0x2feb43[_0x1cb729]&&_0x2feb43[_0x1cb729][_0x4edc('0x4d')]!==_0x4edc('0x7b')){_0x552165[_0x4edc('0xb3')](_0x552165[_0x4edc('0x22')][_0x2feb43[_0x1cb729][_0x4edc('0xb4')]]);logger[_0x4edc('0x9a')](_0x4edc('0xb5'),_0x1ad5bf,_0x1cb729,_0x2feb43[_0x1cb729][_0x4edc('0xb4')]);delete _0x2feb43[_0x1cb729];}if(_0x2feb43[_0x1cb729]&&_0x2feb43[_0x1cb729][_0x4edc('0x4d')]==='ivr'){_0x552165['updateOriginated'](_0x552165[_0x4edc('0x23')][_0x2feb43[_0x1cb729][_0x4edc('0xb4')]]);logger['error'](_0x4edc('0xb6'),_0x1ad5bf,_0x1cb729,_0x2feb43[_0x1cb729][_0x4edc('0xb4')]);delete _0x2feb43[_0x1cb729];}},0x2328);}});}});}}};Dialer['prototype'][_0x4edc('0xb7')]=function(_0x252805){return Promise[_0x4edc('0xb8')]()[_0x4edc('0x3e')](cmHopper[_0x4edc('0xb7')](_0x252805))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0xba')));};Dialer['prototype'][_0x4edc('0xbb')]=function(_0x409300){return Promise['resolve']()[_0x4edc('0x3e')](cmHopperBlack[_0x4edc('0xbb')](_0x409300))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0xbc')));};Dialer[_0x4edc('0x1d')][_0x4edc('0xbd')]=function(_0x4e882c,_0x482268,_0x49f015){return Promise[_0x4edc('0xb8')]()[_0x4edc('0x3e')](cmHopperAdditionalPhone[_0x4edc('0xbd')](_0x4e882c,_0x482268,_0x49f015))['catch'](loggerCatch(_0x4edc('0xbe')));};Dialer['prototype'][_0x4edc('0xbf')]=function(_0x2c2f6a,_0xeeb411,_0x489c15){return Promise[_0x4edc('0xb8')]()[_0x4edc('0x3e')](cmHopperAdditionalPhone[_0x4edc('0xbf')](_0x2c2f6a,_0xeeb411,_0x489c15))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0xc0')));};Dialer['prototype'][_0x4edc('0xc1')]=function(_0x1c6994){return Promise[_0x4edc('0xb8')]()[_0x4edc('0x3e')](cmHopperBlack['checkIsBlackListIvr'](_0x1c6994))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0xc2')));};Dialer[_0x4edc('0x1d')][_0x4edc('0xc3')]=function(_0x3bfa51){return Promise[_0x4edc('0xb8')]()[_0x4edc('0x3e')](cmHopperHistory[_0x4edc('0xc4')](_0x3bfa51))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0xc5')));};Dialer[_0x4edc('0x1d')][_0x4edc('0xc6')]=function(_0x4328b9){return Promise[_0x4edc('0xb8')]()[_0x4edc('0x3e')](cmHopper[_0x4edc('0xc6')](_0x4328b9))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0xc7')));};Dialer['prototype'][_0x4edc('0xc8')]=function(_0x2c645e,_0x38b803,_0x50cb08){return Promise['resolve']()['then'](cmHopper[_0x4edc('0xc8')](_0x2c645e,_0x38b803,_0x50cb08))['catch'](loggerCatch(_0x4edc('0xc9')));};Dialer[_0x4edc('0x1d')][_0x4edc('0xca')]=function(_0x27dc74,_0x592c7d,_0x3684c9,_0x282348,_0x356373){return Promise[_0x4edc('0xb8')]()[_0x4edc('0x3e')](cmHopper[_0x4edc('0xca')](_0x27dc74,_0x592c7d,_0x3684c9,_0x282348))[_0x4edc('0xb9')](function(_0x5079c8){_0x356373['temp']-=_0x3684c9;_0x356373[_0x4edc('0xcb')]=_0x356373[_0x4edc('0xcb')]>0x0?_0x356373[_0x4edc('0xcb')]:0x0;loggerCatch(_0x4edc('0xcc'))(_0x5079c8);});};Dialer[_0x4edc('0x1d')][_0x4edc('0xcd')]=function(_0x2b7171,_0x549d61,_0x2f6f4a,_0x3f6ee0){return Promise[_0x4edc('0xb8')]()[_0x4edc('0x3e')](cmHopper['getContactDialerIvr'](_0x2b7171,_0x549d61,_0x2f6f4a))[_0x4edc('0xb9')](function(_0x4e1cdc){_0x3f6ee0[_0x4edc('0xcb')]-=_0x549d61;_0x3f6ee0[_0x4edc('0xcb')]=_0x3f6ee0['temp']>0x0?_0x3f6ee0[_0x4edc('0xcb')]:0x0;loggerCatch(_0x4edc('0xce'))(_0x4e1cdc);});};Dialer[_0x4edc('0x1d')][_0x4edc('0xcf')]=function(_0x20bb84){return Promise[_0x4edc('0xb8')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x20bb84))['catch'](loggerCatch(_0x4edc('0xd0')));};Dialer['prototype'][_0x4edc('0xd1')]=function(_0x32020c){return Promise['resolve']()[_0x4edc('0x3e')](cmHopper[_0x4edc('0xd1')](_0x32020c))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0xd2')));};Dialer[_0x4edc('0x1d')]['createHistory']=function(_0x46e042){return Promise[_0x4edc('0xb8')]()[_0x4edc('0x3e')](cmHopperHistory['createHistory'](_0x46e042))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0xd3')));};Dialer['prototype'][_0x4edc('0xb3')]=function(_0x4165fa){if(!_[_0x4edc('0x3f')](_0x4165fa)&&_0x4165fa!==null){if(typeof _0x4165fa[_0x4edc('0x9c')]!==_0x4edc('0x9d')){if(_0x4165fa[_0x4edc('0x9c')]>0x0){_0x4165fa[_0x4edc('0x9c')]-=0x1;}else{logger[_0x4edc('0x9a')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x4edc('0x9a')](_0x4edc('0xd4'));}};Dialer[_0x4edc('0x1d')][_0x4edc('0xd5')]=function(_0x5ab67e,_0x1e0ac5){var _0x400c73=this;return function(_0x59ab97){_0x400c73[_0x4edc('0xb3')](_0x1e0ac5);logger[_0x4edc('0x9a')](_0x5ab67e,util['inspect'](_0x59ab97,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x4edc('0xd6')]=function(_0xb8c98,_0x29c814,_0x5f1bc3){var _0x513024={'state':0x19,'statedesc':'notFound'};this[_0x4edc('0xb3')](_0x29c814);this[_0x4edc('0xd7')](_[_0x4edc('0x8f')](_0x513024,_['pick'](_0x5f1bc3,[_0x4edc('0xd8'),_0x4edc('0xd9'),'UserId',_0x4edc('0xda'),_0x4edc('0xdb')])),_0x4edc('0xdc'),_0x4edc('0xdd'));logger[_0x4edc('0x9a')](_0xb8c98);};Dialer[_0x4edc('0x1d')]['isSuccess']=function(_0x1f9e2c){return _0x1f9e2c===_0x4edc('0xde');};Dialer[_0x4edc('0x1d')][_0x4edc('0xdf')]=function(_0x38af77){return!_[_0x4edc('0x3f')](_0x38af77)&&_0x38af77&&!_[_0x4edc('0x3f')](_0x38af77[_0x4edc('0x41')])&&!_[_0x4edc('0x3f')](_0x38af77[_0x4edc('0x77')])&&_0x38af77[_0x4edc('0x77')]&&(this[_0x4edc('0x25')][util[_0x4edc('0x78')]('SIP/%s',_0x38af77[_0x4edc('0x41')])][_0x4edc('0xe0')]===_0x4edc('0xe1')||this['trunks'][util[_0x4edc('0x78')](_0x4edc('0xe2'),_0x38af77[_0x4edc('0x41')])][_0x4edc('0xe0')]===_0x4edc('0xe3'));};Dialer[_0x4edc('0x1d')][_0x4edc('0xd7')]=function(_0x483b4f,_0x52ed,_0x388aa2){this[_0x4edc('0xe4')](_0x483b4f)['catch'](loggerCatch(_0x52ed));this[_0x4edc('0xd1')](_0x483b4f)['catch'](loggerCatch(_0x388aa2));};Dialer[_0x4edc('0x1d')][_0x4edc('0x37')]=function(_0x2d7fe9){var _0x2b004b=this;var _0x2f7e00=this[_0x4edc('0xe5')][_0x2d7fe9['uniqueid']];var _0x39534b;if(!_[_0x4edc('0xe6')](_0x2d7fe9)&&!_['isNil'](_0x2d7fe9[_0x4edc('0xe7')])&&!_[_0x4edc('0xe6')](_0x2d7fe9[_0x4edc('0xe7')][_0x4edc('0xe8')])&&_0x2d7fe9[_0x4edc('0xe9')]==='xcally-motion-dialer'&&_0x2f7e00){if(_0x2f7e00[_0x4edc('0x4d')]!==_0x4edc('0x7b')&&this['voiceQueues'][_0x2f7e00[_0x4edc('0xb4')]][_0x4edc('0xea')]&&_0x2d7fe9[_0x4edc('0xeb')]===_0x4edc('0xec')){delete this[_0x4edc('0xe5')][_0x2d7fe9[_0x4edc('0xed')]];this[_0x4edc('0xb3')](this[_0x4edc('0x22')][_0x2f7e00[_0x4edc('0xb4')]]);this[_0x4edc('0x22')][_0x2f7e00[_0x4edc('0xb4')]][_0x4edc('0xee')]+=0x1;this[_0x4edc('0x22')][_0x2f7e00[_0x4edc('0xb4')]][_0x4edc('0xef')]+=0x1;_0x39534b=new Hangup(_0x2f7e00,_0x2d7fe9);_0x39534b[_0x4edc('0xa8')]=0x12;_0x39534b['statedesc']=_0x4edc('0xf0');_0x39534b[_0x4edc('0xf1')]=_0x4edc('0xf2');ami[_0x4edc('0x4c')]('custom:amd',ut[_0x4edc('0xf3')](_0x39534b,_0x4edc('0xf4')));this['saveInDb'](_0x39534b,'[syncHangupInAMD][createHistory]',_0x4edc('0xf5'));}if(_0x2f7e00[_0x4edc('0x4d')]!=='ivr'&&this[_0x4edc('0x22')][_0x2f7e00[_0x4edc('0xb4')]][_0x4edc('0xea')]&&_0x2d7fe9[_0x4edc('0xeb')]===_0x4edc('0xf6')){return new Promise(function(_0x454600,_0x13fcf8){delete _0x2b004b[_0x4edc('0xe5')][_0x2d7fe9[_0x4edc('0xed')]];_0x2b004b[_0x4edc('0xb3')](_0x2b004b[_0x4edc('0x22')][_0x2f7e00[_0x4edc('0xb4')]]);_0x2b004b[_0x4edc('0x22')][_0x2f7e00['queue']][_0x4edc('0xee')]+=0x1;_0x2b004b[_0x4edc('0x22')][_0x2f7e00[_0x4edc('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x2ecfaa=_0x2b004b[_0x4edc('0x22')][_0x2f7e00[_0x4edc('0xb4')]];var _0x152d7c=new Hangup(_0x2f7e00,_0x2d7fe9);_0x152d7c[_0x4edc('0xa8')]=0x13;_0x152d7c[_0x4edc('0xa9')]=_0x4edc('0xf7');_0x152d7c[_0x4edc('0xf1')]='AMD';_0x152d7c[_0x4edc('0xf8')]+=0x1;_0x152d7c[_0x4edc('0xf9')]+=0x1;_0x152d7c[_0x4edc('0xf4')]=!![];ami['emit'](_0x4edc('0xfa'),ut['buildObj'](_0x152d7c,_0x4edc('0xf4')));_0x2b004b[_0x4edc('0xe4')](_0x152d7c)[_0x4edc('0xb9')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x152d7c[_0x4edc('0xfb')]+_0x152d7c[_0x4edc('0xfc')]+_0x152d7c['countnoanswerretry']+_0x152d7c[_0x4edc('0xfd')]+_0x152d7c['countdropretry']+_0x152d7c[_0x4edc('0xfe')]+_0x152d7c[_0x4edc('0xf8')]+_0x152d7c[_0x4edc('0xff')]>=_0x2ecfaa[_0x4edc('0x100')]){_0x2b004b[_0x4edc('0x101')](_0x152d7c,_0x454600,_0x13fcf8,_0x4edc('0x102'));}else{if(_0x152d7c['countmachineretry']>=_0x2ecfaa[_0x4edc('0x103')]){_0x2b004b[_0x4edc('0x104')](_0x152d7c,_0x454600,_0x13fcf8,_0x4edc('0x105'));}else{_0x2b004b['rescheduleContact']({'active':![],'countmachineretry':_0x152d7c[_0x4edc('0xf8')],'scheduledat':moment()[_0x4edc('0x106')](_0x2ecfaa[_0x4edc('0x107')],_0x4edc('0x108'))[_0x4edc('0x78')](_0x4edc('0x109')),'ContactId':_0x152d7c[_0x4edc('0xd8')],'ListId':_0x152d7c[_0x4edc('0xd9')],'VoiceQueueId':_0x152d7c[_0x4edc('0xda')]||undefined,'CampaignId':_0x152d7c['CampaignId']||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x10a')));_0x454600({'reschedule':0x1});}}});}if(_0x2f7e00[_0x4edc('0x4d')]===_0x4edc('0x7b')&&this[_0x4edc('0x23')][_0x2f7e00['queue']][_0x4edc('0xea')]&&_0x2d7fe9['value']===_0x4edc('0xec')){delete this[_0x4edc('0xe5')][_0x2d7fe9[_0x4edc('0xed')]];this[_0x4edc('0xb3')](this[_0x4edc('0x23')][_0x2f7e00[_0x4edc('0xb4')]]);_0x39534b=new Hangup(_0x2f7e00,_0x2d7fe9);_0x39534b[_0x4edc('0xa8')]=0x12;_0x39534b[_0x4edc('0xa9')]=_0x4edc('0xf0');_0x39534b[_0x4edc('0xf1')]=_0x4edc('0xf2');ami['emit'](_0x4edc('0xfa'),ut[_0x4edc('0xf3')](_0x39534b,_0x4edc('0xf4')));this['saveInDb'](_0x39534b,_0x4edc('0x10b'),_0x4edc('0x10c'));}if(_0x2f7e00[_0x4edc('0x4d')]===_0x4edc('0x7b')&&this[_0x4edc('0x23')][_0x2f7e00['queue']][_0x4edc('0xea')]&&_0x2d7fe9[_0x4edc('0xeb')]===_0x4edc('0xf6')){return new Promise(function(_0x4aa44a,_0x815c50){delete _0x2b004b[_0x4edc('0xe5')][_0x2d7fe9[_0x4edc('0xed')]];_0x2b004b[_0x4edc('0xb3')](_0x2b004b[_0x4edc('0x23')][_0x2f7e00[_0x4edc('0xb4')]]);_0x2b004b[_0x4edc('0x23')][_0x2f7e00[_0x4edc('0xb4')]][_0x4edc('0xee')]+=0x1;_0x2b004b[_0x4edc('0x23')][_0x2f7e00['queue']][_0x4edc('0xef')]+=0x1;var _0x2b7aa9=_0x2b004b[_0x4edc('0x23')][_0x2f7e00['queue']];var _0x46e9f3=new Hangup(_0x2f7e00,_0x2d7fe9);_0x46e9f3[_0x4edc('0xa8')]=0x13;_0x46e9f3['statedesc']=_0x4edc('0xf7');_0x46e9f3[_0x4edc('0xf1')]=_0x4edc('0xf2');_0x46e9f3[_0x4edc('0xf8')]+=0x1;_0x46e9f3[_0x4edc('0xf9')]+=0x1;_0x46e9f3[_0x4edc('0xf4')]=!![];ami[_0x4edc('0x4c')](_0x4edc('0xfa'),ut[_0x4edc('0xf3')](_0x46e9f3,_0x4edc('0xf4')));_0x2b004b[_0x4edc('0xe4')](_0x46e9f3)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x10d')));if(_0x46e9f3[_0x4edc('0xfb')]+_0x46e9f3[_0x4edc('0xfc')]+_0x46e9f3[_0x4edc('0x10e')]+_0x46e9f3[_0x4edc('0xfd')]+_0x46e9f3[_0x4edc('0x10f')]+_0x46e9f3[_0x4edc('0xfe')]+_0x46e9f3[_0x4edc('0xf8')]+_0x46e9f3['countagentrejectretry']>=_0x2b7aa9[_0x4edc('0x100')]){_0x2b004b['stateGlobal'](_0x46e9f3,_0x4aa44a,_0x815c50,_0x4edc('0x102'));}else{if(_0x46e9f3[_0x4edc('0xf8')]>=_0x2b7aa9[_0x4edc('0x103')]){_0x2b004b['createStateFinal'](_0x46e9f3,_0x4aa44a,_0x815c50,_0x4edc('0x105'));}else{_0x2b004b[_0x4edc('0xc6')]({'active':![],'countmachineretry':_0x46e9f3[_0x4edc('0xf8')],'scheduledat':moment()[_0x4edc('0x106')](_0x2b7aa9[_0x4edc('0x107')],_0x4edc('0x108'))[_0x4edc('0x78')](_0x4edc('0x109')),'ContactId':_0x46e9f3[_0x4edc('0xd8')],'ListId':_0x46e9f3[_0x4edc('0xd9')],'VoiceQueueId':_0x46e9f3['VoiceQueueId']||undefined,'CampaignId':_0x46e9f3['CampaignId']||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x10a')));_0x4aa44a({'reschedule':0x1});}}});}}};Dialer[_0x4edc('0x1d')][_0x4edc('0x110')]=function(_0x59f044){var _0x1e19f3=this[_0x4edc('0xe5')][_0x59f044[_0x4edc('0xed')]];var _0x11ef6f;if(_0x1e19f3&&_0x1e19f3[_0x4edc('0x4d')]===_0x4edc('0x7b')){delete this[_0x4edc('0xe5')][_0x59f044[_0x4edc('0xed')]];this['updateOriginated'](this[_0x4edc('0x23')][_0x1e19f3[_0x4edc('0xb4')]]);this[_0x4edc('0x23')][_0x1e19f3[_0x4edc('0xb4')]][_0x4edc('0x111')]+=0x1;_0x11ef6f=new Hangup(_0x1e19f3,_0x59f044);this[_0x4edc('0xe4')](_0x11ef6f)[_0x4edc('0xb9')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x11ef6f)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x112')));}if(_0x1e19f3&&_0x1e19f3[_0x4edc('0x4d')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x1e19f3['queue']][_0x4edc('0x113')])){delete this[_0x4edc('0xe5')][_0x59f044[_0x4edc('0xed')]];this[_0x4edc('0xb3')](this['voiceQueues'][_0x1e19f3[_0x4edc('0xb4')]]);this[_0x4edc('0x22')][_0x1e19f3['queue']][_0x4edc('0xee')]+=0x1;this[_0x4edc('0x22')][_0x1e19f3['queue']][_0x4edc('0xef')]+=0x1;_0x11ef6f=new Hangup(_0x1e19f3,_0x59f044);_0x11ef6f['state']=0x10;_0x11ef6f[_0x4edc('0xa9')]=_0x4edc('0x114');_0x11ef6f[_0x4edc('0xf1')]=_0x4edc('0x115');this[_0x4edc('0xe4')](_0x11ef6f)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x116')));this[_0x4edc('0xd1')](_0x11ef6f)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x112')));}if(_0x1e19f3&&_0x1e19f3[_0x4edc('0x4d')]!==_0x4edc('0x7b')&&!isNotNull(this[_0x4edc('0x22')][_0x1e19f3[_0x4edc('0xb4')]][_0x4edc('0x113')])){delete this[_0x4edc('0xe5')][_0x59f044[_0x4edc('0xed')]];this[_0x4edc('0xb3')](this[_0x4edc('0x22')][_0x1e19f3[_0x4edc('0xb4')]]);this[_0x4edc('0x22')][_0x1e19f3[_0x4edc('0xb4')]][_0x4edc('0x68')]+=0x1;_0x11ef6f=new Hangup(_0x1e19f3,_0x59f044);_0x11ef6f['state']=0xc;_0x11ef6f[_0x4edc('0xa9')]=_0x59f044[_0x4edc('0x117')];_0x11ef6f['membername']=_0x4edc('0x118');this[_0x4edc('0xe4')](_0x11ef6f)[_0x4edc('0xb9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x4edc('0xd1')](_0x11ef6f)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x4edc('0x1d')][_0x4edc('0x119')]=function(_0x19a875){var _0x43f695=this[_0x4edc('0xe5')][_0x19a875[_0x4edc('0xed')]];if(this[_0x4edc('0x22')][_0x19a875[_0x4edc('0xb4')]]){if(_0x43f695&&_0x43f695[_0x4edc('0x4d')]!==_0x4edc('0x7b')){delete this[_0x4edc('0xe5')][_0x19a875[_0x4edc('0xed')]];this[_0x4edc('0x22')][_0x19a875[_0x4edc('0xb4')]][_0x4edc('0xee')]+=0x1;var _0x17638f=new AgentComplete(_0x43f695,_0x19a875);if(_0x19a875[_0x4edc('0x11a')]===_0x4edc('0x11b')){_0x17638f[_0x4edc('0x11c')]=this['voiceQueues'][_0x19a875[_0x4edc('0xb4')]][_0x4edc('0x11d')]&&this[_0x4edc('0x22')][_0x19a875['queue']]['dialAgiAfterHangupAgent']?moment()[_0x4edc('0x78')](_0x4edc('0x109')):undefined;}this['createHistory'](_0x17638f)['catch'](loggerCatch(_0x4edc('0x11e')));this[_0x4edc('0xd1')](_0x17638f)['catch'](loggerCatch(_0x4edc('0x11f')));}}};Dialer[_0x4edc('0x1d')][_0x4edc('0x2b')]=function(_0x305abb){if(this[_0x4edc('0x22')][_0x305abb['queue']]){if(this[_0x4edc('0xe5')][_0x305abb[_0x4edc('0xed')]]&&this[_0x4edc('0xe5')][_0x305abb[_0x4edc('0xed')]][_0x4edc('0x4d')]!==_0x4edc('0x7b')){this['updateOriginated'](this[_0x4edc('0x22')][_0x305abb[_0x4edc('0xb4')]]);this[_0x4edc('0xe5')][_0x305abb[_0x4edc('0xed')]][_0x4edc('0x120')]=moment()[_0x4edc('0x78')](_0x4edc('0x109'));}}};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x493173,_0x29fb3c){this[_0x4edc('0xe4')](_0x493173)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x11e')));if(_0x29fb3c==0x0){this[_0x4edc('0xd1')](_0x493173)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x121')));}};Dialer[_0x4edc('0x1d')][_0x4edc('0x2d')]=function(_0x26fa74){var _0x3fd55d=this[_0x4edc('0xe5')][_0x26fa74[_0x4edc('0xed')]];var _0x434042=this;var _0x57a435=![];var _0x249ca1;var _0x29d269;if(this[_0x4edc('0x22')][_0x26fa74[_0x4edc('0xb4')]]){if(_0x3fd55d&&_0x3fd55d[_0x4edc('0x4d')]!==_0x4edc('0x7b')){delete this[_0x4edc('0xe5')][_0x26fa74[_0x4edc('0xed')]];this[_0x4edc('0xb3')](this[_0x4edc('0x22')][_0x26fa74[_0x4edc('0xb4')]]);_0x3fd55d['droptime']=moment()[_0x4edc('0x78')](_0x4edc('0x109'));var _0x5185b7=new QueueCallerAbandon(_0x3fd55d,_0x26fa74);if(getSeconds(_0x3fd55d[_0x4edc('0x122')],_0x3fd55d[_0x4edc('0x123')])>=_0x3fd55d[_0x4edc('0x124')]){this[_0x4edc('0x22')][_0x26fa74[_0x4edc('0xb4')]][_0x4edc('0x83')]+=0x1;this[_0x4edc('0x22')][_0x26fa74['queue']][_0x4edc('0x125')]+=0x1;this[_0x4edc('0x22')][_0x26fa74[_0x4edc('0xb4')]][_0x4edc('0x6c')]+=0x1;_0x5185b7[_0x4edc('0xa8')]=0xa;_0x5185b7[_0x4edc('0xa9')]='Drop';_0x5185b7['dropreason']=_0x4edc('0x126');_0x5185b7['agiafterat']=this[_0x4edc('0x22')][_0x26fa74['queue']][_0x4edc('0x11d')]?moment()['format'](_0x4edc('0x109')):undefined;_0x5185b7[_0x4edc('0x10f')]+=0x1;_0x5185b7[_0x4edc('0xf9')]+=0x1;_0x249ca1=this[_0x4edc('0x22')][_0x26fa74['queue']][_0x4edc('0x127')];_0x29d269=this['voiceQueues'][_0x26fa74[_0x4edc('0xb4')]][_0x4edc('0x128')];_0x434042[_0x4edc('0xbd')](_0x5185b7,_0x5185b7[_0x4edc('0xa8')],_0x3fd55d[_0x4edc('0x129')])[_0x4edc('0x3e')](function(_0x4247d5){_0x57a435=_0x4247d5[_0x4edc('0x12a')]==0x1;if(_0x5185b7[_0x4edc('0x10f')]>=_0x434042[_0x4edc('0x22')][_0x26fa74[_0x4edc('0xb4')]][_0x4edc('0x12b')]){_0x434042[_0x4edc('0x12c')](_0x5185b7,_0x4247d5[_0x4edc('0x12a')]);}else{_0x434042[_0x4edc('0xc6')]({'active':![],'countdropretry':_0x5185b7[_0x4edc('0x10f')],'scheduledat':moment()[_0x4edc('0x106')](_0x434042[_0x4edc('0x22')][_0x26fa74[_0x4edc('0xb4')]][_0x4edc('0x127')],_0x4edc('0x108'))[_0x4edc('0x78')](_0x4edc('0x109')),'ContactId':_0x3fd55d[_0x4edc('0xd8')],'ListId':_0x3fd55d[_0x4edc('0xd9')],'VoiceQueueId':_0x3fd55d[_0x4edc('0xda')]||undefined,'CampaignId':_0x3fd55d[_0x4edc('0xdb')]||undefined})['catch'](loggerCatch(_0x4edc('0x12d')));var _0x252a70=new History(_0x5185b7);_0x252a70[_0x4edc('0xa8')]=0xa;_0x252a70[_0x4edc('0xa9')]=_0x4edc('0x12e');_0x252a70[_0x4edc('0xab')]=moment()['format'](_0x4edc('0x109'));_0x252a70['endtime']=_0x252a70[_0x4edc('0xab')];_0x252a70[_0x4edc('0x12f')]=_0x5185b7[_0x4edc('0x12f')];_0x252a70['calleridnum']=_0x5185b7[_0x4edc('0x130')];_0x434042[_0x4edc('0xe4')](_0x252a70)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x131')));}})[_0x4edc('0x3e')](function(){if(_0x57a435)_0x434042['swapAdditionalPhones'](_0x5185b7,_0x249ca1,_0x29d269)[_0x4edc('0x3e')](function(){return 0x1;});});}else{this[_0x4edc('0x22')][_0x26fa74['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x26fa74['queue']][_0x4edc('0x132')]+=0x1;_0x5185b7[_0x4edc('0xa8')]=0xb;_0x5185b7[_0x4edc('0xa9')]='Abandoned';_0x5185b7[_0x4edc('0x133')]=_0x4edc('0x134');_0x5185b7[_0x4edc('0xfe')]+=0x1;_0x5185b7[_0x4edc('0xf9')]+=0x1;_0x249ca1=this[_0x4edc('0x22')][_0x26fa74[_0x4edc('0xb4')]][_0x4edc('0x135')];_0x29d269=this['voiceQueues'][_0x26fa74[_0x4edc('0xb4')]]['callAdditionalPhoneAfterMin'];_0x434042[_0x4edc('0xbd')](_0x5185b7,_0x5185b7[_0x4edc('0xa8')],_0x3fd55d[_0x4edc('0x129')])[_0x4edc('0x3e')](function(_0x3d79ce){if(_0x5185b7[_0x4edc('0xfe')]>=_0x434042[_0x4edc('0x22')][_0x26fa74[_0x4edc('0xb4')]][_0x4edc('0x136')]){_0x434042[_0x4edc('0x12c')](_0x5185b7,_0x3d79ce['additional']);}else{_0x434042[_0x4edc('0xc6')]({'active':![],'countabandonedretry':_0x5185b7[_0x4edc('0xfe')],'scheduledat':moment()[_0x4edc('0x106')](_0x434042[_0x4edc('0x22')][_0x26fa74[_0x4edc('0xb4')]]['dialAbandonedRetryFrequency'],_0x4edc('0x108'))[_0x4edc('0x78')](_0x4edc('0x109')),'ContactId':_0x3fd55d[_0x4edc('0xd8')],'ListId':_0x3fd55d[_0x4edc('0xd9')],'VoiceQueueId':_0x3fd55d['VoiceQueueId']||undefined,'CampaignId':_0x3fd55d[_0x4edc('0xdb')]||undefined})['catch'](loggerCatch(_0x4edc('0x137')));var _0x9082b=new History(_0x5185b7);_0x9082b[_0x4edc('0xa8')]=0xb;_0x9082b[_0x4edc('0xa9')]=_0x4edc('0x138');_0x9082b[_0x4edc('0xab')]=moment()[_0x4edc('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x9082b[_0x4edc('0xaa')]=_0x9082b['starttime'];_0x9082b['calleridname']=_0x5185b7['calleridname'];_0x9082b[_0x4edc('0x130')]=_0x5185b7[_0x4edc('0x130')];_0x434042[_0x4edc('0xe4')](_0x9082b)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x139')));}})[_0x4edc('0x3e')](function(){if(_0x57a435)_0x434042['swapAdditionalPhones'](_0x5185b7,_0x249ca1,_0x29d269)[_0x4edc('0x3e')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x4edc('0x35')]=function(_0x23dd62){if(this[_0x4edc('0x27')][_0x23dd62[_0x4edc('0xed')]]){this[_0x4edc('0x27')][_0x23dd62['uniqueid']][_0x4edc('0xb1')]=_0x23dd62[_0x4edc('0xb1')];}if(this[_0x4edc('0xe5')][_0x23dd62[_0x4edc('0xed')]]){this[_0x4edc('0xe5')][_0x23dd62[_0x4edc('0xed')]][_0x4edc('0xb1')]=_0x23dd62['channel'];}};Dialer[_0x4edc('0x1d')][_0x4edc('0x13a')]=function(_0xc2481){if(strategy[this[_0x4edc('0x22')][this[_0x4edc('0x27')][_0xc2481[_0x4edc('0x13b')]][_0x4edc('0xb4')]][_0x4edc('0x4f')]]===_0x4edc('0x1c')){if(this['actions'][_0xc2481['actionid']]&&_[_0x4edc('0xe6')](this[_0x4edc('0x27')][_0xc2481[_0x4edc('0x13b')]][_0x4edc('0x13c')])&&_0xc2481[_0x4edc('0xe0')]==='1'&&_0xc2481[_0x4edc('0x13d')]==='0'){if(this[_0x4edc('0x24')][_0xc2481['stateinterface']]){if(!this['agents'][_0xc2481['stateinterface']][_0x4edc('0x13c')]){this[_0x4edc('0x24')][_0xc2481[_0x4edc('0x13e')]][_0x4edc('0x13c')]=!![];this[_0x4edc('0x27')][_0xc2481[_0x4edc('0x13b')]]['locked']=!![];this[_0x4edc('0x27')][_0xc2481['actionid']][_0x4edc('0x13e')]=_0xc2481[_0x4edc('0x13e')];}}}}else if((strategy[this['voiceQueues'][this['actions'][_0xc2481[_0x4edc('0x13b')]]['queue']]['strategy']]||_0x4edc('0x13f'))==='rrmemory'){if(this[_0x4edc('0x27')][_0xc2481[_0x4edc('0x13b')]]){if(this[_0x4edc('0x24')][_0xc2481[_0x4edc('0x13e')]]){this[_0x4edc('0x27')][_0xc2481['actionid']][_0x4edc('0x13e')]=_0xc2481[_0x4edc('0x13e')];if(_[_0x4edc('0xe6')](this[_0x4edc('0x140')][this[_0x4edc('0x27')][_0xc2481['actionid']][_0x4edc('0xb4')]])){this[_0x4edc('0x140')][this[_0x4edc('0x27')][_0xc2481[_0x4edc('0x13b')]][_0x4edc('0xb4')]]=[];}this[_0x4edc('0x140')][this[_0x4edc('0x27')][_0xc2481[_0x4edc('0x13b')]]['queue']][_0x4edc('0x141')](_[_0x4edc('0x8f')](_['pick'](this[_0x4edc('0x27')][_0xc2481[_0x4edc('0x13b')]],[_0x4edc('0x142'),'stateinterface']),{'status':_0xc2481[_0x4edc('0xe0')],'paused':_0xc2481[_0x4edc('0x13d')]}));}}}};function unlockQueueStatus(_0xd9b7b6,_0x4afcee){setTimeout(function(){if(_[_0x4edc('0x3f')](_0xd9b7b6[_0x4edc('0x143')])){loggerBooked[_0x4edc('0x9a')](_0x4edc('0x144'),_0x4afcee);}_0xd9b7b6[_0x4edc('0x143')]=!![];loggerBooked[_0x4edc('0x7e')](_0x4edc('0x145'),_0x4afcee,JSON[_0x4edc('0x4a')](_[_0x4edc('0x146')](_0xd9b7b6,[_0x4edc('0x41'),_0x4edc('0x143')])));},0x1f3);}Dialer[_0x4edc('0x1d')][_0x4edc('0x3a')]=function(_0x1895b7){var _0x5eb14a=this;var _0x326948=_0x5eb14a['voiceQueues'][_0x5eb14a[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0xb4')]];if(strategy[this[_0x4edc('0x22')][this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0xb4')]][_0x4edc('0x4f')]]===_0x4edc('0x1c')){if(this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]]&&this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0x13e')]){this[_0x4edc('0x21')][_0x4edc('0x147')](this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0x142')],this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0x13e')])[_0x4edc('0xb9')](function(_0x276da5){logger[_0x4edc('0x9a')](_0x4edc('0x148'),util[_0x4edc('0x99')](_0x276da5,{'showHidden':![],'depth':null}));})[_0x4edc('0x1f')](function(){_0x5eb14a[_0x4edc('0xb3')](_0x5eb14a[_0x4edc('0x22')][_0x5eb14a[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0xb4')]]);_0x5eb14a[_0x4edc('0x24')][_0x5eb14a[_0x4edc('0x27')][_0x1895b7['actionid']][_0x4edc('0x13e')]][_0x4edc('0x13c')]=![];delete _0x5eb14a[_0x4edc('0x27')][_0x1895b7['actionid']];unlockQueueStatus(_0x326948);});}else{this['updateOriginated'](this[_0x4edc('0x22')][this['actions'][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0xb4')]]);this[_0x4edc('0xc6')]({'active':![],'ContactId':this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]]['ContactId'],'ListId':this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]]['ListId'],'VoiceQueueId':this[_0x4edc('0x27')][_0x1895b7['actionid']]['VoiceQueueId']||undefined,'CampaignId':this[_0x4edc('0x27')][_0x1895b7['actionid']][_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x1895b7['actionid']];unlockQueueStatus(_0x326948);}}else if((strategy[this[_0x4edc('0x22')][this[_0x4edc('0x27')][_0x1895b7['actionid']]['queue']][_0x4edc('0x4f')]]||'rrmemory')===_0x4edc('0x13f')){var _0x225697;if(this['actions'][_0x1895b7['actionid']]&&!_[_0x4edc('0x47')](this['queueBooked'][this[_0x4edc('0x27')][_0x1895b7['actionid']][_0x4edc('0xb4')]])){if(this[_0x4edc('0x2a')][_0x5eb14a[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]]['queue']]){this[_0x4edc('0x2a')][_0x5eb14a['actions'][_0x1895b7['actionid']][_0x4edc('0xb4')]]=this['queueBookedRR'][this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0xb4')]]?this[_0x4edc('0x2a')][this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0xb4')]]:this[_0x4edc('0x140')][this['actions'][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0xb4')]]?this['queueBooked'][this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0xb4')]][_0x4edc('0x149')]||0x0:0x0;}this['queueBooked'][this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0xb4')]][_0x4edc('0x149')]=this['queueBookedRR'][this['actions'][_0x1895b7['actionid']][_0x4edc('0xb4')]];for(var _0x3cde5e=0x0;_0x3cde5e=0x0;})[_0x4edc('0xb9')](myreject(_0x501cfe)));}}else{_0x523e46['push'](ami['Action']({'action':'command','command':util[_0x4edc('0x78')](_0x4edc('0x164'),_0x15152d,!_['isUndefined'](config['timezones'][_0x300c24])?_0x300c24:'')})['then'](function(_0x1d5efe){return _0x1d5efe[_0x4edc('0x161')][_0x4edc('0x162')]('true')>=0x0;})[_0x4edc('0xb9')](myreject(_0x501cfe)));}Promise['all'](_0x523e46)[_0x4edc('0x3e')](function(_0x3d88e6){var _0x2f6c49=_['some'](_0x3d88e6);if(_0x2f6c49){return _0x2b0f00(_0x2f6c49);}else{_0x1af94a[_0x4edc('0x42')]=_0x3e2872?'GLOBAL_INTERVAL_IS_OVERTIME':_0x4edc('0x165');return _0x501cfe(msgResponse('[ifTime][promiseAll]','Failure',_0x4edc('0x166')+_0x3e2872+'\x20'+_0x42c855+_0x4edc('0x167')+util[_0x4edc('0x99')](_0x15152d,{'showHidden':![],'depth':null})+_0x4edc('0x168')+_0x300c24));}})['catch'](function(_0x230e6b){return _0x501cfe(msgResponse(_0x4edc('0x158'),_0x4edc('0x159'),JSON[_0x4edc('0x4a')](_0x230e6b)));});});};Dialer[_0x4edc('0x1d')][_0x4edc('0x169')]=function(_0x1a2c27){var _0x39e805=this;return function(){switch(_0x1a2c27['dialMethod']){case'progressive':freeVariablesPredictive(_0x1a2c27);_0x39e805[_0x4edc('0x16a')](_0x1a2c27,0x1);break;case _0x4edc('0x16b'):freeVariablesPredictive(_0x1a2c27);_0x39e805['handlePower'](_0x1a2c27,_0x1a2c27[_0x4edc('0x16c')]);break;case _0x4edc('0xb'):_0x39e805[_0x4edc('0xb')](_0x1a2c27);break;case _0x4edc('0xa'):freeVariablesPredictive(_0x1a2c27);_0x39e805[_0x4edc('0x16a')](_0x1a2c27,0x1);break;default:freeVariablesPredictive(_0x1a2c27);logger[_0x4edc('0x9a')](_0x4edc('0x16d'),_0x1a2c27[_0x4edc('0x41')],'method\x20not\x20recognized');}};};Dialer[_0x4edc('0x1d')][_0x4edc('0x16e')]=function(_0x1f269f){return Promise['resolve']()['then'](cmHopper[_0x4edc('0x16f')](_0x1f269f['id'],previewRecallmeReminderInterval))[_0x4edc('0x3e')](function(_0xbc3ec1){for(var _0x2cc449=0x0;_0x2cc449<_0xbc3ec1['length'];_0x2cc449++){var _0x5f315a=_0xbc3ec1[_0x2cc449]['Agent']['name'];if(_0x5f315a)io['to'](util[_0x4edc('0x78')](_0x4edc('0x170'),_0x5f315a))[_0x4edc('0x4c')](_0x4edc('0x171'),{'hopper':_0xbc3ec1[_0x2cc449]});}})[_0x4edc('0xb9')](function(){});};Dialer['prototype'][_0x4edc('0x172')]=function(_0x2fa9ef){var _0x8549a8=this;return function(){_0x8549a8[_0x4edc('0x173')](_0x2fa9ef);};};Dialer[_0x4edc('0x1d')][_0x4edc('0xd')]=function(_0x2e420b){var _0x3c75da=this;if(isNotPreview(_0x2e420b[_0x4edc('0x5b')])){if(isVoiceQueueOutbound(_0x2e420b[_0x4edc('0x4d')])&&isActive(_0x2e420b[_0x4edc('0x5a')])){_0x2e420b[_0x4edc('0xa1')]=!![];Promise['resolve']()[_0x4edc('0x3e')](checkIsLoggedIn(_0x2e420b,_0x2e420b[_0x4edc('0x52')]))[_0x4edc('0x3e')](checkIsActive(_0x2e420b,_0x2e420b[_0x4edc('0x5a')]))[_0x4edc('0x3e')](checkInterval(_0x2e420b))[_0x4edc('0x3e')](_0x3c75da[_0x4edc('0x174')](_0x2e420b))[_0x4edc('0x3e')](_0x3c75da[_0x4edc('0x175')](_0x2e420b[_0x4edc('0x176')],_0x2e420b['dialTimezone'],_0x2e420b[_0x4edc('0x41')],_0x2e420b))[_0x4edc('0x3e')](_0x3c75da['checkIfTimeIntervals'](_0x2e420b['Interval'],_0x2e420b[_0x4edc('0x177')],_0x2e420b[_0x4edc('0x41')],_0x2e420b))[_0x4edc('0x3e')](_0x3c75da[_0x4edc('0x169')](_0x2e420b))[_0x4edc('0xb9')](loggerCatchQueueSummary(_0x4edc('0x178'),_0x2e420b));}else{notSendMessagesQueue(_0x2e420b);}}else{freeVariablesPredictive(_0x2e420b);}};Dialer[_0x4edc('0x1d')][_0x4edc('0x32')]=_[_0x4edc('0x179')](function(){var _0x551ea7=_[_0x4edc('0x17a')](this['voiceQueues'],function(_0x12bcfb){return _0x12bcfb['dialPreviewRecallmeReminder'];});var _0x1da513=_[_0x4edc('0x17a')](this[_0x4edc('0x24')],function(_0x566a31){return _0x566a31['online']&&_0x566a31[_0x4edc('0xe0')]===_0x4edc('0xe1');});if(_0x551ea7[_0x4edc('0x9b')]>0x0&&_0x1da513['length']>0x0){return Promise[_0x4edc('0xb8')]()['then'](cmHopper[_0x4edc('0x16f')](_[_0x4edc('0x17b')](_0x551ea7,'id'),previewRecallmeReminderInterval,_[_0x4edc('0x17b')](_0x1da513,'id')))['then'](function(_0x50c7e7){for(var _0x5bf951=0x0;_0x5bf951<_0x50c7e7[_0x4edc('0x9b')];_0x5bf951++){var _0x49413e=_0x50c7e7[_0x5bf951]['Agent']['name'];if(_0x49413e)io['to'](util[_0x4edc('0x78')](_0x4edc('0x170'),_0x49413e))[_0x4edc('0x4c')]('user:dialPreviewRecallReminder',{'hopper':_0x50c7e7[_0x5bf951]});}})['catch'](function(_0x46229f){logger[_0x4edc('0x9a')](_0x4edc('0x16e'),_0x46229f);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x4edc('0x1d')][_0x4edc('0x154')]=function(){var _0x22bccb=this;var _0x5bcd47;for(var _0x24dad7 in this[_0x4edc('0x23')]){if(typeof this[_0x4edc('0x23')][_0x24dad7]!==_0x4edc('0x9d')){_0x5bcd47=this[_0x4edc('0x23')][_0x24dad7];if(isCampaignIvr(_0x5bcd47[_0x4edc('0x4d')])&&isActive(_0x5bcd47[_0x4edc('0x77')])){_0x5bcd47[_0x4edc('0xa1')]=!![];Promise[_0x4edc('0xb8')]()['then'](checkIsActive(_0x5bcd47,_0x5bcd47[_0x4edc('0x77')]))['then'](checkInterval(_0x5bcd47))[_0x4edc('0x3e')](_0x22bccb[_0x4edc('0x174')](_0x5bcd47))[_0x4edc('0x3e')](_0x22bccb['checkIfTime'](_0x5bcd47[_0x4edc('0x176')],_0x5bcd47[_0x4edc('0x177')],_0x5bcd47[_0x4edc('0x41')],_0x5bcd47))['then'](_0x22bccb[_0x4edc('0x17c')](_0x5bcd47['Interval'],_0x5bcd47[_0x4edc('0x177')],_0x5bcd47[_0x4edc('0x41')],_0x5bcd47))[_0x4edc('0x3e')](_0x22bccb[_0x4edc('0x172')](_0x5bcd47))[_0x4edc('0xb9')](loggerCatchQueueSummary('[syncCampaigns]',_0x5bcd47));}else{notSendMessagesCampaign(_0x5bcd47);}}}};function getCallerIdRandom(_0x56d52f,_0x51e1d3){var _0x5ee2f1;var _0x26040e;var _0x326c2c;if(_0x51e1d3<=0x0){_0x51e1d3=0x1;}_0x5ee2f1=new RegExp(_0x4edc('0x17d')+_0x51e1d3+'}$');_0x26040e=Math[_0x4edc('0x17e')](0xa,_0x51e1d3-0x1);_0x326c2c=Math[_0x4edc('0x17e')](0xa,_0x51e1d3)-0x1;return util[_0x4edc('0x78')]('%s',_[_0x4edc('0x17f')](_0x56d52f,_0x5ee2f1,_['random'](_0x26040e,_0x326c2c)));}function extractCalleridName(_0xe8c3d9){var _0x53c864=_0xe8c3d9[_0x4edc('0x180')](/"(.*?)"/);return _0x53c864?_0x53c864[0x1]:_0xe8c3d9;}Dialer['prototype']['actionOriginate']=function(_0x2ad5d1,_0x50ee7a){var _0x1a1859=this;var _0x4a4d20=uuid['v4']();this[_0x4edc('0x27')][_0x4a4d20]=new Action(_0x2ad5d1,_0x50ee7a,_0x4a4d20);return new Promise(function(_0x4d2fdf,_0x5f4911){if(_[_0x4edc('0x3f')](_0x2ad5d1)&&typeof _0x2ad5d1!==_0x4edc('0x181')){return _0x5f4911(msgResponse(_0x4edc('0x182'),_0x4edc('0x159'),'voiceQueue\x20is\x20undefine'));}if(_[_0x4edc('0x3f')](_0x50ee7a['phone'])||_0x50ee7a['phone']===null){return _0x5f4911(msgResponse('originate',_0x4edc('0x159'),_0x4edc('0x183')));}var _0x518e22={'XMD-CALLERID':_0x1a1859[_0x4edc('0x27')][_0x4a4d20][_0x4edc('0x184')](),'XMD-AGI':_0x2ad5d1[_0x4edc('0x113')]?util[_0x4edc('0x78')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2ad5d1[_0x4edc('0x113')]):_0x4edc('0x185'),'XMD-AGIAFTER':_0x2ad5d1[_0x4edc('0x11d')]?util[_0x4edc('0x78')](_0x4edc('0x186'),ipAgi,_0x2ad5d1['dialQueueProject2']):_0x4edc('0x185'),'XMD-QUEUE':_0x2ad5d1[_0x4edc('0x4d')]===_0x4edc('0x4e')?util[_0x4edc('0x78')](_0x4edc('0x187'),_0x2ad5d1['name'],_0x2ad5d1[_0x4edc('0x188')]||'',_0x2ad5d1[_0x4edc('0x189')]?'c':'',_0x2ad5d1[_0x4edc('0x124')]||0x3):'NONE','XMD-CONTACTID':_0x50ee7a[_0x4edc('0xd8')],'XMD-CDRTYPE':_0x4edc('0x9'),'CALLERID(all)':_0x1a1859['actions'][_0x4a4d20][_0x4edc('0x184')](),'XMD-AMD':_0x2ad5d1[_0x4edc('0xea')]?_0x4edc('0x18a'):_0x4edc('0x185'),'XMD-DESTINATION':_0x4edc('0x18b')};if(_0x2ad5d1['dialAMDActive']){_0x518e22[_0x4edc('0x18c')]=_0x2ad5d1['dialAMDInitialSilence']||0x9c4;_0x518e22['XMD-AMDGREETING']=_0x2ad5d1[_0x4edc('0x18d')]||0x5dc;_0x518e22['XMD-AMDAFTERGREETINGSILENCE']=_0x2ad5d1[_0x4edc('0x18e')]||0x320;_0x518e22[_0x4edc('0x18f')]=_0x2ad5d1['dialAMDTotalAnalysisTime']||0x1388;_0x518e22[_0x4edc('0x190')]=_0x2ad5d1[_0x4edc('0x191')]||0x64;_0x518e22[_0x4edc('0x192')]=_0x2ad5d1['dialAMDBetweenWordsSilence']||0x32;_0x518e22[_0x4edc('0x193')]=_0x2ad5d1[_0x4edc('0x194')]||0x3;_0x518e22['XMD-AMDSILENCETHRESHOLD']=_0x2ad5d1[_0x4edc('0x195')]||0x100;_0x518e22['XMD-AMDMAXIMUMWORDLENGTH']=_0x2ad5d1[_0x4edc('0x196')]||0x1388;}if(_0x2ad5d1[_0x4edc('0x4d')]===_0x4edc('0x4e')){_0x518e22[_0x4edc('0x197')]=_0x50ee7a[_0x4edc('0xda')];}else{_0x518e22['XMD-CAMPAIGNID']=_0x50ee7a[_0x4edc('0xdb')];}for(var _0x36999f in _0x50ee7a[_0x4edc('0x198')]){if(typeof _0x50ee7a[_0x4edc('0x198')][_0x36999f]!=='undefined'){if(isNotNull(_0x50ee7a['Contact'][_0x36999f])&&_0x36999f!=='id'&&_0x36999f!==_0x4edc('0x199')&&_0x36999f!=='createdAt'&&_0x36999f!==_0x4edc('0x19a')){_0x518e22[util['format'](_0x4edc('0x19b'),_0x4edc('0x19c'),_['toUpper'](_0x36999f))]=_0x50ee7a[_0x4edc('0x198')][_0x36999f];}}}var _0x570274=_0x1a1859[_0x4edc('0xdf')](_0x2ad5d1['Trunk'])?getCallerId(_0x2ad5d1[_0x4edc('0x76')][_0x4edc('0x19d')],_0x2ad5d1['dialOriginateCallerIdName'],_0x2ad5d1[_0x4edc('0x19e')]>0x0?getCallerIdRandom(_0x2ad5d1[_0x4edc('0x5d')],_0x2ad5d1[_0x4edc('0x19e')]):_0x2ad5d1[_0x4edc('0x5d')]):getCallerId(_[_0x4edc('0xe6')](_0x2ad5d1[_0x4edc('0x155')])?_0x2ad5d1[_0x4edc('0x76')][_0x4edc('0x19d')]:_0x2ad5d1[_0x4edc('0x155')][_0x4edc('0x19d')],_0x2ad5d1[_0x4edc('0x5c')],_0x2ad5d1[_0x4edc('0x19e')]>0x0?getCallerIdRandom(_0x2ad5d1[_0x4edc('0x5d')],_0x2ad5d1[_0x4edc('0x19e')]):_0x2ad5d1[_0x4edc('0x5d')]);if(_0x570274){_0x518e22['XMD-ORIGINATECALLERIDNAME']=_0x1a1859[_0x4edc('0x27')][_0x4a4d20][_0x4edc('0x19f')]=extractCalleridName(_0x570274);_0x518e22[_0x4edc('0x1a0')]=_0x50ee7a[_0x4edc('0x1a1')];}_0x2ad5d1[_0x4edc('0x1a2')]=_0x518e22;return ami['Action']({'actionid':_0x4a4d20,'action':_0x4edc('0x182'),'channel':_0x1a1859['isTrunkReachable'](_0x2ad5d1[_0x4edc('0x76')])?util[_0x4edc('0x78')](_0x4edc('0x1a3'),_0x2ad5d1[_0x4edc('0x76')][_0x4edc('0x41')],isNotNull(_0x2ad5d1[_0x4edc('0x5f')])?_0x2ad5d1[_0x4edc('0x5f')][_0x4edc('0x1a4')]()||'':'',_0x2ad5d1[_0x4edc('0x1a5')]>0x0?_0x50ee7a['phone']['substring'](_0x2ad5d1[_0x4edc('0x1a5')]):_0x50ee7a[_0x4edc('0x1a1')]):util[_0x4edc('0x78')](_0x4edc('0x1a3'),_['isNil'](_0x2ad5d1[_0x4edc('0x155')])?_0x2ad5d1[_0x4edc('0x76')][_0x4edc('0x41')]:_0x2ad5d1[_0x4edc('0x155')][_0x4edc('0x41')],isNotNull(_0x2ad5d1[_0x4edc('0x5f')])?_0x2ad5d1[_0x4edc('0x5f')][_0x4edc('0x1a4')]()||'':'',_0x2ad5d1[_0x4edc('0x1a5')]>0x0?_0x50ee7a[_0x4edc('0x1a1')][_0x4edc('0x1a6')](_0x2ad5d1[_0x4edc('0x1a5')]):_0x50ee7a[_0x4edc('0x1a1')]),'callerid':_0x570274,'Exten':_0x4edc('0x18b'),'Context':_0x4edc('0x1a7'),'Priority':'1','variable':_0x518e22,'timeout':(_0x2ad5d1['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4a4d20})[_0x4edc('0x3e')](function(_0x9264da){return _0x4d2fdf(_0x9264da);})['catch'](function(_0x502592){_0x2ad5d1['outboundOriginateFailureCallsDay']+=0x1;var _0x53a8da=new History(_0x1a1859[_0x4edc('0x27')][_0x4a4d20]);logger['error'](util['format']('[originateError]:\x20%s',JSON[_0x4edc('0x4a')](_0x502592)));_0x53a8da[_0x4edc('0xa8')]=0xe;_0x53a8da[_0x4edc('0xa9')]=_0x4edc('0x1a8');_0x53a8da['starttime']=moment()[_0x4edc('0x78')](_0x4edc('0x109'));_0x53a8da['endtime']=_0x53a8da[_0x4edc('0xab')];_0x1a1859[_0x4edc('0xe4')](_0x53a8da)['catch'](loggerCatch(_0x4edc('0x1a9')));_0x1a1859['moveContactManagedDialer'](_0x53a8da)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1a9')))[_0x4edc('0x1f')](function(){delete _0x1a1859['actions'][_0x4a4d20];return _0x5f4911(msgResponse(_0x4edc('0x182'),_0x4edc('0x49'),'originate\x20action\x20Error'));});});});};Dialer[_0x4edc('0x1d')]['syncOriginateResponse']=function(_0x5cbfd8){var _0x3d4660=this[_0x4edc('0x27')][_0x5cbfd8[_0x4edc('0x13b')]];if(_0x3d4660){delete this[_0x4edc('0x27')][_0x5cbfd8[_0x4edc('0x13b')]];_0x3d4660[_0x4edc('0x123')]=moment()[_0x4edc('0x78')]('YYYY-MM-DD\x20HH:mm:ss');var _0x418847=_0x3d4660[_0x4edc('0x4d')]===_0x4edc('0x7b')?this[_0x4edc('0x23')][_0x3d4660[_0x4edc('0xb4')]]:this[_0x4edc('0x22')][_0x3d4660[_0x4edc('0x1aa')]()];if(!this[_0x4edc('0x1ab')](_0x5cbfd8[_0x4edc('0x1ac')])){this[_0x4edc('0xb3')](_0x418847);return this[_0x4edc('0x1ad')](_0x3d4660,_0x418847,_0x5cbfd8)[_0x4edc('0xb9')](loggerCatch('[callProgressDetecting]\x20'));}this[_0x4edc('0xe5')][_0x5cbfd8[_0x4edc('0xed')]]=_0x3d4660;}};Dialer['prototype']['checkRetriveMax']=function(_0x5121ff,_0x1d843e,_0xe36ea0){var _0x58a63e=new History(_0x1d843e);if(_0x58a63e[_0x4edc('0xfb')]+_0x58a63e['countcongestionretry']+_0x58a63e[_0x4edc('0x10e')]+_0x58a63e[_0x4edc('0xfd')]+_0x58a63e[_0x4edc('0x10f')]+_0x58a63e[_0x4edc('0xfe')]+_0x58a63e['countmachineretry']+_0x58a63e[_0x4edc('0xff')]>=_0xe36ea0[_0x4edc('0x100')]-0x1){return!![];}switch(_0x5121ff){case 0x3:if(_0x58a63e['countnoanswerretry']>=_0xe36ea0[_0x4edc('0x1ae')]-0x1){return!![];}this[_0x4edc('0xc6')]({'active':![],'countnoanswerretry':_0x58a63e[_0x4edc('0x10e')]+=0x1,'scheduledat':moment()[_0x4edc('0x106')](_0xe36ea0[_0x4edc('0x1af')],_0x4edc('0x108'))['format'](_0x4edc('0x109')),'ContactId':_0x58a63e[_0x4edc('0xd8')],'ListId':_0x58a63e['ListId'],'VoiceQueueId':_0x58a63e[_0x4edc('0xda')]||undefined,'CampaignId':_0x58a63e[_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1b0')));break;case 0x5:if(_0x58a63e[_0x4edc('0xfb')]>=_0xe36ea0[_0x4edc('0x1b1')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x58a63e[_0x4edc('0xfb')]+=0x1,'scheduledat':moment()[_0x4edc('0x106')](_0xe36ea0['dialBusyRetryFrequency'],_0x4edc('0x108'))[_0x4edc('0x78')](_0x4edc('0x109')),'ContactId':_0x58a63e[_0x4edc('0xd8')],'ListId':_0x58a63e[_0x4edc('0xd9')],'VoiceQueueId':_0x58a63e['VoiceQueueId']||undefined,'CampaignId':_0x58a63e[_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1b2')));break;case 0x8:if(_0x58a63e['countcongestionretry']>=_0xe36ea0[_0x4edc('0x1b3')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x58a63e['countcongestionretry']+=0x1,'scheduledat':moment()[_0x4edc('0x106')](_0xe36ea0['dialCongestionRetryFrequency'],'minutes')['format'](_0x4edc('0x109')),'ContactId':_0x58a63e['ContactId'],'ListId':_0x58a63e[_0x4edc('0xd9')],'VoiceQueueId':_0x58a63e['VoiceQueueId']||undefined,'CampaignId':_0x58a63e[_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1b4')));break;case 0x0:if(_0x58a63e['countnosuchnumberretry']>=_0xe36ea0[_0x4edc('0x1b5')]-0x1){return!![];}else{this[_0x4edc('0xc6')]({'active':![],'countnosuchnumberretry':_0x58a63e[_0x4edc('0xfd')]+=0x1,'scheduledat':moment()['add'](_0xe36ea0[_0x4edc('0x1b6')],'minutes')['format'](_0x4edc('0x109')),'ContactId':_0x58a63e[_0x4edc('0xd8')],'ListId':_0x58a63e[_0x4edc('0xd9')],'VoiceQueueId':_0x58a63e[_0x4edc('0xda')]||undefined,'CampaignId':_0x58a63e[_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1b7')));}break;case 0xa:if(_0x58a63e['countdropretry']>=_0xe36ea0[_0x4edc('0x12b')]-0x1){return!![];}this[_0x4edc('0xc6')]({'active':![],'countdropretry':_0x58a63e[_0x4edc('0x10f')]+=0x1,'scheduledat':moment()[_0x4edc('0x106')](_0xe36ea0['dialDropRetryFrequency'],_0x4edc('0x108'))[_0x4edc('0x78')](_0x4edc('0x109')),'ContactId':_0x58a63e[_0x4edc('0xd8')],'ListId':_0x58a63e['ListId'],'VoiceQueueId':_0x58a63e[_0x4edc('0xda')]||undefined,'CampaignId':_0x58a63e[_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x12d')));break;case 0xb:if(_0x58a63e[_0x4edc('0xfe')]>=_0xe36ea0[_0x4edc('0x136')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x58a63e[_0x4edc('0xfe')]+=0x1,'scheduledat':moment()['add'](_0xe36ea0[_0x4edc('0x135')],'minutes')[_0x4edc('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x58a63e[_0x4edc('0xd8')],'ListId':_0x58a63e[_0x4edc('0xd9')],'VoiceQueueId':_0x58a63e['VoiceQueueId']||undefined,'CampaignId':_0x58a63e[_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x137')));break;case 0x13:if(_0x58a63e[_0x4edc('0xf8')]>=_0xe36ea0[_0x4edc('0x103')]-0x1){return!![];}this[_0x4edc('0xc6')]({'active':![],'countmachineretry':_0x58a63e[_0x4edc('0xf8')]+=0x1,'scheduledat':moment()[_0x4edc('0x106')](_0xe36ea0[_0x4edc('0x107')],_0x4edc('0x108'))[_0x4edc('0x78')](_0x4edc('0x109')),'ContactId':_0x58a63e[_0x4edc('0xd8')],'ListId':_0x58a63e[_0x4edc('0xd9')],'VoiceQueueId':_0x58a63e[_0x4edc('0xda')]||undefined,'CampaignId':_0x58a63e['CampaignId']||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x10a')));break;case 0x14:if(_0x58a63e[_0x4edc('0xff')]>=_0xe36ea0[_0x4edc('0x1b8')]-0x1){return!![];}this[_0x4edc('0xc6')]({'active':![],'countagentrejectretry':_0x58a63e['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0xe36ea0[_0x4edc('0x1b9')],_0x4edc('0x108'))[_0x4edc('0x78')](_0x4edc('0x109')),'ContactId':_0x58a63e[_0x4edc('0xd8')],'ListId':_0x58a63e[_0x4edc('0xd9')],'VoiceQueueId':_0x58a63e['VoiceQueueId']||undefined,'CampaignId':_0x58a63e[_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1ba')));break;default:return!![];}};Dialer[_0x4edc('0x1d')][_0x4edc('0x1ad')]=function(_0x56c5b4,_0x156541,_0x58672d){var _0x63d2c6=this;var _0x567aa6=new History(_0x56c5b4);var _0xec787d=![];var _0x30d104;var _0x5f3155;return new Promise(function(_0x31b9b4,_0x204c5c){if(_[_0x4edc('0x3f')](_0x156541)&&typeof _0x156541!==_0x4edc('0x181')){return _0x204c5c(msgResponse(_0x4edc('0x1bb'),_0x4edc('0x159'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x58672d)&&typeof _0x58672d!=='object'){return _0x204c5c(msgResponse('[callProgressDetecting]',_0x4edc('0x159'),_0x4edc('0x1bc')));}_0x63d2c6[_0x4edc('0xbd')](_0x567aa6,_0x58672d['reason'],_0x156541)[_0x4edc('0x3e')](function(_0x10c659){if(_0x10c659[_0x4edc('0x12a')]==0x1)_0xec787d=!![];switch(_0x58672d[_0x4edc('0x11a')]){case'0':_0x156541[_0x4edc('0x65')]+=0x1;_0x567aa6[_0x4edc('0xa8')]=0x0;_0x567aa6[_0x4edc('0xa9')]=_0x4edc('0x1bd');_0x567aa6['countnosuchnumberretry']+=0x1;_0x567aa6['countglobal']+=0x1;ami[_0x4edc('0x4c')](_0x4edc('0x1be'),ut[_0x4edc('0xf3')](_0x56c5b4,_0x4edc('0x1bf')));_0x30d104=_0x156541[_0x4edc('0x1b6')];_0x5f3155=_0x156541[_0x4edc('0x128')];_0x63d2c6[_0x4edc('0xe4')](_0x567aa6)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x10d')));if(_0x63d2c6[_0x4edc('0x1c0')](0x0,_0x56c5b4,_0x156541)&&!_0xec787d){if(_0x567aa6[_0x4edc('0xfd')]>=_0x156541['dialNoSuchNumberMaxRetry']){_0x63d2c6[_0x4edc('0x104')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1c1'));}else{_0x63d2c6[_0x4edc('0x101')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1c1'));}}break;case'3':_0x156541[_0x4edc('0x64')]+=0x1;_0x567aa6[_0x4edc('0xa8')]=0x3;_0x567aa6['statedesc']=_0x4edc('0x1c2');_0x567aa6[_0x4edc('0x10e')]+=0x1;_0x567aa6['countglobal']+=0x1;var _0x353179=ut['buildNoAnswerEventPayload'](_0x56c5b4,_0x156541);ami['emit'](_0x4edc('0x1c3'),_0x353179);_0x30d104=_0x156541['dialNoAnswerRetryFrequency'];_0x5f3155=_0x156541[_0x4edc('0x128')];_0x63d2c6[_0x4edc('0xe4')](_0x567aa6)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1c4')));if(_0x63d2c6[_0x4edc('0x1c0')](0x3,_0x56c5b4,_0x156541)&&!_0xec787d){if(_0x567aa6['countnoanswerretry']>=_0x156541[_0x4edc('0x1ae')]){_0x63d2c6[_0x4edc('0x104')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1c5'));}else{_0x63d2c6[_0x4edc('0x101')](_0x567aa6,_0x31b9b4,_0x204c5c,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x156541['outboundBusyCallsDay']+=0x1;_0x567aa6['state']=0x5;_0x567aa6[_0x4edc('0xa9')]=_0x4edc('0x1c6');_0x567aa6[_0x4edc('0xfb')]+=0x1;_0x567aa6[_0x4edc('0xf9')]+=0x1;ami[_0x4edc('0x4c')](_0x4edc('0x1c7'),ut['buildObj'](_0x56c5b4,_0x4edc('0x1c8')));_0x30d104=_0x156541[_0x4edc('0x1c9')];_0x5f3155=_0x156541[_0x4edc('0x128')];_0x63d2c6[_0x4edc('0xe4')](_0x567aa6)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1ca')));if(_0x63d2c6[_0x4edc('0x1c0')](0x5,_0x56c5b4,_0x156541)&&!_0xec787d){if(_0x567aa6[_0x4edc('0xfb')]>=_0x156541['dialBusyMaxRetry']){_0x63d2c6[_0x4edc('0x104')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1cb'));}else{_0x63d2c6[_0x4edc('0x101')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1cb'));}}break;case'8':_0x156541[_0x4edc('0x62')]+=0x1;_0x567aa6[_0x4edc('0xa8')]=0x8;_0x567aa6[_0x4edc('0xa9')]=_0x4edc('0x1cc');_0x567aa6[_0x4edc('0xfc')]+=0x1;_0x567aa6[_0x4edc('0xf9')]+=0x1;_0x30d104=_0x156541[_0x4edc('0x1cd')];_0x5f3155=_0x156541[_0x4edc('0x128')];ami['emit']('custom:agentcongestion',ut[_0x4edc('0xf3')](_0x56c5b4,'congestion'));_0x63d2c6[_0x4edc('0xe4')](_0x567aa6)['catch'](loggerCatch(_0x4edc('0x1ce')));if(_0x63d2c6[_0x4edc('0x1c0')](0x8,_0x56c5b4,_0x156541)&&!_0xec787d){if(_0x567aa6[_0x4edc('0xfc')]>=_0x156541['dialCongestionMaxRetry']){_0x63d2c6[_0x4edc('0x104')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1cf'));}else{_0x63d2c6['stateGlobal'](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1cf'));}}break;case'11':_0x156541[_0x4edc('0x1d0')]+=0x1;_0x567aa6[_0x4edc('0xa8')]=0xb;_0x567aa6[_0x4edc('0xa9')]=_0x4edc('0x138');_0x567aa6[_0x4edc('0xfe')]+=0x1;_0x567aa6[_0x4edc('0xf9')]+=0x1;_0x30d104=_0x156541['dialAbandonedRetryFrequency'];_0x5f3155=_0x156541['callAdditionalPhoneAfterMin'];_0x63d2c6['createHistory'](_0x567aa6)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x139')));if(_0x63d2c6[_0x4edc('0x1c0')](0xb,_0x56c5b4,_0x156541)&&!_0xec787d){if(_0x567aa6[_0x4edc('0xfe')]>=_0x156541[_0x4edc('0x136')]){_0x63d2c6[_0x4edc('0x104')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1d1'));}else{_0x63d2c6[_0x4edc('0x101')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1d1'));}}break;case'20':_0x156541[_0x4edc('0x1d2')]+=0x1;_0x567aa6[_0x4edc('0xa8')]=0x14;_0x567aa6[_0x4edc('0xa9')]=_0x4edc('0x1d3');_0x567aa6[_0x4edc('0xff')]+=0x1;_0x567aa6[_0x4edc('0xf9')]+=0x1;_0x30d104=_0x156541[_0x4edc('0x1b9')];_0x5f3155=_0x156541[_0x4edc('0x128')];ami[_0x4edc('0x4c')](_0x4edc('0x1d4'),ut[_0x4edc('0xf3')](_0x56c5b4,'agentreject'));_0x63d2c6[_0x4edc('0xe4')](_0x567aa6)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1d5')));if(_0x63d2c6['checkRetriveMax'](0x14,_0x56c5b4,_0x156541)&&!_0xec787d){if(_0x567aa6[_0x4edc('0xff')]>=_0x156541[_0x4edc('0x1b8')]){_0x63d2c6[_0x4edc('0x104')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1d6'));}else{_0x63d2c6[_0x4edc('0x101')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1d6'));}}break;default:_0x156541['outboundUnknownCallsDay']+=0x1;_0x567aa6[_0x4edc('0xa8')]=0xc;_0x567aa6[_0x4edc('0xa9')]=_0x58672d[_0x4edc('0x11a')];_0x30d104=_0x156541[_0x4edc('0x1b9')];_0x5f3155=_0x156541[_0x4edc('0x128')];_0x63d2c6[_0x4edc('0xe4')](_0x567aa6)[_0x4edc('0xb9')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x63d2c6[_0x4edc('0x1c0')](_0x58672d[_0x4edc('0x11a')],_0x56c5b4,_0x156541)&&!_0xec787d){if(_0x567aa6[_0x4edc('0xfb')]+_0x567aa6[_0x4edc('0xfc')]+_0x567aa6[_0x4edc('0x10e')]+_0x567aa6[_0x4edc('0xfd')]+_0x567aa6[_0x4edc('0x10f')]+_0x567aa6[_0x4edc('0xfe')]+_0x567aa6[_0x4edc('0xf8')]+_0x567aa6[_0x4edc('0xff')]>=_0x156541[_0x4edc('0x100')]){_0x63d2c6[_0x4edc('0x101')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x58672d[_0x4edc('0x11a')]);}else{_0x63d2c6['createStateFinal'](_0x567aa6,_0x31b9b4,_0x204c5c,_0x58672d[_0x4edc('0x11a')]);}}}})[_0x4edc('0x3e')](function(){if(_0xec787d){_0x63d2c6['swapAdditionalPhones'](_0x567aa6,_0x30d104,_0x5f3155)['then'](function(){return _0x31b9b4(0x1);});}});});};Dialer[_0x4edc('0x1d')][_0x4edc('0x101')]=function(_0x175b4f,_0x4f3125,_0x5159be,_0x67a37){var _0x58918a=new Final(_0x175b4f);_0x58918a['state']=0xf;_0x58918a[_0x4edc('0xa9')]=_0x4edc('0x1d7');this['createStateFinal'](_0x58918a,_0x4f3125,_0x5159be,_0x67a37);};Dialer[_0x4edc('0x1d')]['createStateFinal']=function(_0x3da6bb,_0x44d1c7,_0x3f7473,_0x32645d){this[_0x4edc('0xd1')](_0x3da6bb)[_0x4edc('0x3e')](function(){return _0x44d1c7(msgResponse(_0x4edc('0x1bb'),_0x4edc('0xde'),_0x32645d));})[_0x4edc('0xb9')](function(){return _0x3f7473(msgResponse(_0x4edc('0x1d8'),_0x4edc('0x159'),_0x4edc('0x1d9')));});};Dialer[_0x4edc('0x1d')][_0x4edc('0xb')]=function(_0x26dcd5){var _0xe62564=_0x26dcd5[_0x4edc('0x1da')]/0x64;var _0x4bad9d=_0x26dcd5[_0x4edc('0x125')]/(_0x26dcd5[_0x4edc('0x125')]+_0x26dcd5[_0x4edc('0xee')]);var _0x1fefc2=Math['round'](_0x26dcd5[_0x4edc('0x70')]*(_0x26dcd5['predictiveIntervalMaxThreshold']/0x64));var _0x584429=Math['round'](_0x26dcd5[_0x4edc('0x70')]*(_0x26dcd5[_0x4edc('0x1db')]/0x64));var _0x56a1fa=_0x26dcd5[_0x4edc('0x51')]+_0x26dcd5[_0x4edc('0x54')];var _0x1bea71=Math[_0x4edc('0x1dc')](_0x26dcd5[_0x4edc('0x72')]*_0x26dcd5[_0x4edc('0x74')]*_0x26dcd5[_0x4edc('0x6d')]*_0x26dcd5[_0x4edc('0x6e')]);if(_[_0x4edc('0x3f')](_0x26dcd5['startProgressive'])){if(!_[_0x4edc('0x3f')](_0x26dcd5[_0x4edc('0x92')])){_0x26dcd5['startPredictive']=undefined;loggerPredictive[_0x4edc('0x9a')]('[startMethodPredictive][StartProgressive]',_0x4edc('0x1dd'));}if(!_[_0x4edc('0x3f')](_0x26dcd5[_0x4edc('0x94')])){loggerPredictive[_0x4edc('0x9a')](_0x4edc('0x1de'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x26dcd5['handlePredictive']);_0x26dcd5[_0x4edc('0x94')]=undefined;}_0x26dcd5[_0x4edc('0x28')]=moment()[_0x4edc('0x78')](_0x4edc('0x109'));loggerPredictive[_0x4edc('0x7e')](_0x26dcd5[_0x4edc('0x41')],_0x4edc('0x1df'),_0x26dcd5[_0x4edc('0x28')]);this[_0x4edc('0x16a')](_0x26dcd5,0x1);}else if(ifInterval(_0x26dcd5[_0x4edc('0x1e0')],_0x26dcd5[_0x4edc('0x28')])){this[_0x4edc('0x16a')](_0x26dcd5,0x1);loggerPredictiveCalls[_0x4edc('0x7e')](_0x4edc('0x1e1'),_0x26dcd5[_0x4edc('0x28')],_0x26dcd5['name']);_0x26dcd5[_0x4edc('0x72')]=0x0;_0x26dcd5[_0x4edc('0x6c')]=0x0;}else if(_0xe62564<_0x4bad9d&&_0x26dcd5['dialPredictiveOptimization']===_0x4edc('0x1e2')){freeVariablesPredictive(_0x26dcd5);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x1e3'),_0x4edc('0x1e4'),_0x4bad9d,_0x4edc('0x28'),_0x26dcd5['name']);}else if(_0x1bea71<_0x26dcd5['predictiveIntervalErlangCallsDroppedCalls']&&_0x26dcd5['dialPredictiveOptimization']===_0x4edc('0x1e2')){freeVariablesPredictive(_0x26dcd5);loggerPredictive[_0x4edc('0x7e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x4edc('0x1e5'),_0x1bea71,_0x4edc('0x1e6'),_0x26dcd5[_0x4edc('0x6c')],'startProgressive',_0x26dcd5[_0x4edc('0x41')]);}else if(!ifInterval(_0x26dcd5[_0x4edc('0x1e0')],_0x26dcd5['startProgressive'])&&_[_0x4edc('0x3f')](_0x26dcd5[_0x4edc('0x92')])&&!_[_0x4edc('0x3f')](_0x26dcd5['startProgressive'])){_0x26dcd5[_0x4edc('0x92')]=moment()[_0x4edc('0x78')](_0x4edc('0x109'));loggerPredictive[_0x4edc('0x7e')](_0x26dcd5['name'],_0x4edc('0x1e7'),_0x26dcd5['startPredictive']);this[_0x4edc('0xc3')](_0x26dcd5[_0x4edc('0x1e0')])['then'](this[_0x4edc('0x1e8')](_0x26dcd5))[_0x4edc('0x3e')](mergeDataErlangB(_0x26dcd5))['then'](this['startMethodPredictive'](_0x26dcd5))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x26dcd5));}else if(!ifInterval(_0x26dcd5[_0x4edc('0x1e0')],_0x26dcd5[_0x4edc('0x92')])){_0x26dcd5[_0x4edc('0x6c')]=0x0;_0x26dcd5[_0x4edc('0x92')]=moment()[_0x4edc('0x78')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x4edc('0x7e')](_0x26dcd5[_0x4edc('0x41')],_0x4edc('0x1e9'),_0x26dcd5[_0x4edc('0x92')]);clearInterval(_0x26dcd5[_0x4edc('0x94')]);_0x26dcd5[_0x4edc('0x94')]=undefined;this['averageHandleTime'](_0x26dcd5[_0x4edc('0x1e0')])[_0x4edc('0x3e')](this[_0x4edc('0x1e8')](_0x26dcd5))[_0x4edc('0x3e')](mergeDataErlangB(_0x26dcd5))['then'](this[_0x4edc('0x1ea')](_0x26dcd5))['catch'](loggerCatchPredictive(_0x4edc('0x1eb'),_0x26dcd5));}else if(_0x26dcd5['predictiveIntervalAvailable']&&_0x56a1fa<_0x26dcd5[_0x4edc('0x70')]-_0x584429){freeVariablesPredictive(_0x26dcd5);loggerPredictive[_0x4edc('0x7e')](_0x26dcd5[_0x4edc('0x41')],_0x4edc('0x1ec'),_0x56a1fa,_0x4edc('0x1ed'),_0x26dcd5['predictiveIntervalAvailable'],'-',_0x584429,'=',_0x26dcd5['predictiveIntervalAvailable']-_0x584429,')');}else if(_0x26dcd5[_0x4edc('0x70')]&&_0x56a1fa>_0x26dcd5['predictiveIntervalAvailable']+_0x1fefc2){freeVariablesPredictive(_0x26dcd5);loggerPredictive[_0x4edc('0x7e')](_0x26dcd5[_0x4edc('0x41')],_0x4edc('0x1ec'),_0x56a1fa,_0x4edc('0x1ee'),_0x26dcd5['predictiveIntervalAvailable'],'+',_0x1fefc2,'=',_0x26dcd5[_0x4edc('0x70')]+_0x1fefc2,')');}};Dialer[_0x4edc('0x1d')][_0x4edc('0x1e8')]=function(_0x20a6f6){var _0x29d972=this;return function(_0x47c878){return new Promise(function(_0x2d1b85,_0x2658fe){_[_0x4edc('0x8f')](_0x20a6f6,_0x47c878[0x0]);if(checkGetDataPredictive(_0x47c878[0x0])){var _0x19aece=_0x20a6f6[_0x4edc('0x70')]=_0x20a6f6[_0x4edc('0x54')]+_0x20a6f6[_0x4edc('0x51')];var _0x30b748=_0x20a6f6['dialPredictiveInterval']*0x3c;var _0x3384e3=_0x47c878[0x0][_0x4edc('0x6a')]+_0x47c878[0x0]['predictiveIntervalAvgHoldtime'];var _0x18292b=(_0x47c878[0x0][_0x4edc('0x82')]+_0x47c878[0x0][_0x4edc('0x83')]+_0x47c878[0x0][_0x4edc('0x6b')])/_0x47c878[0x0]['predictiveIntervalTotalCalls'];_0x20a6f6[_0x4edc('0x6d')]=_0x18292b>0x0?_0x18292b:0x1;switch(_0x20a6f6[_0x4edc('0x1ef')]){case _0x4edc('0x1e2'):var _0x2015cd=_0x20a6f6[_0x4edc('0x1da')]/0x64;return _0x29d972[_0x4edc('0x1f0')](_0x19aece,_0x30b748,_0x3384e3,_0x18292b,_0x2015cd)[_0x4edc('0x3e')](function(_0x19ffcc){return _0x2d1b85(_0x19ffcc);});case _0x4edc('0x1f1'):var _0x677b36=_0x20a6f6['dialPredictiveOptimizationPercentage']/0x64;return _0x29d972[_0x4edc('0x1f2')](_0x19aece,_0x30b748,_0x3384e3,_0x18292b,_0x677b36)['then'](function(_0xf1cf9e){return _0x2d1b85(_0xf1cf9e);});default:return _0x2658fe(msgResponse(_0x4edc('0x1f3'),_0x4edc('0x159'),_0x4edc('0x1f4')));}}else{return _0x2658fe(msgResponse(_0x4edc('0x1f3'),_0x4edc('0x159'),_0x4edc('0x1f5')));}});};};Dialer[_0x4edc('0x1d')][_0x4edc('0x1f6')]=function(_0x5951cd){var _0x2de850=this;return function(_0x4f560e){return new Promise(function(_0x3427a6,_0xb5d743){_[_0x4edc('0x8f')](_0x5951cd,_0x4f560e[0x0]);if(checkGetDataPredictive(_0x4f560e[0x0])){loggerPredictive[_0x4edc('0x7e')](JSON['stringify'](_0x4f560e[0x0]));if(_0x5951cd[_0x4edc('0x1ef')]===_0x4edc('0x1e2')){return _0x2de850[_0x4edc('0xcf')](_0x5951cd['id'])[_0x4edc('0x3e')](function(_0x436bc3){var _0x29100b=_0x5951cd[_0x4edc('0x52')]-_0x436bc3[0x0][_0x4edc('0x1f7')];var _0x323fdc=_0x5951cd['dialPredictiveInterval']*0x3c;var _0x3d9f8=_0x4f560e[0x0][_0x4edc('0x6a')]+_0x4f560e[0x0][_0x4edc('0x69')];var _0x2ae540=(_0x4f560e[0x0][_0x4edc('0x82')]+_0x4f560e[0x0][_0x4edc('0x83')]+_0x4f560e[0x0][_0x4edc('0x6b')])/_0x4f560e[0x0][_0x4edc('0x71')];var _0x375b30=_0x5951cd[_0x4edc('0x1da')]/0x64;_0x5951cd[_0x4edc('0x6f')]=_0x436bc3[0x0][_0x4edc('0x1f7')]||0x0;_0x5951cd['predictiveIntervalHitRate']=_0x2ae540>0x0?_0x2ae540:0x1;return _0x2de850[_0x4edc('0x1f0')](_0x29100b,_0x323fdc,_0x3d9f8,_0x2ae540,_0x375b30);})[_0x4edc('0x3e')](function(_0x2d3598){return _0x3427a6(_0x2d3598);})[_0x4edc('0xb9')](function(_0x3a4afe){return _0xb5d743(msgResponse('[CatchErlangB]',_0x4edc('0x159'),JSON['stringify'](_0x3a4afe)));});}if(_0x5951cd[_0x4edc('0x1ef')]===_0x4edc('0x1f1')){return _0x2de850['getVoiceQueueRtPauses'](_0x5951cd['id'])[_0x4edc('0x3e')](function(_0x400d51){var _0x531331=_0x5951cd['loggedIn']-_0x400d51[0x0][_0x4edc('0x1f7')];var _0x7a54d0=_0x5951cd[_0x4edc('0x1e0')]*0x3c;var _0x22fe62=_0x4f560e[0x0][_0x4edc('0x6a')]+_0x4f560e[0x0][_0x4edc('0x69')];var _0x3430fe=(_0x4f560e[0x0][_0x4edc('0x82')]+_0x4f560e[0x0][_0x4edc('0x83')]+_0x4f560e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4f560e[0x0][_0x4edc('0x71')];var _0x27b21f=_0x5951cd[_0x4edc('0x1da')]/0x64;_0x5951cd[_0x4edc('0x6f')]=_0x400d51[0x0][_0x4edc('0x1f7')]||0x0;_0x5951cd[_0x4edc('0x6d')]=_0x3430fe>0x0?_0x3430fe:0x1;return _0x2de850[_0x4edc('0x1f2')](_0x531331,_0x7a54d0,_0x22fe62,_0x3430fe,_0x27b21f);})[_0x4edc('0x3e')](function(_0xc808ed){return _0x3427a6(_0xc808ed);})[_0x4edc('0xb9')](function(_0x2389ba){return _0xb5d743(msgResponse('[CatchErlangB]',_0x4edc('0x159'),JSON['stringify'](_0x2389ba)));});}}else{return _0xb5d743(msgResponse('[getDataPredictive]',_0x4edc('0x159'),'check\x20failure'));}});};};Dialer[_0x4edc('0x1d')][_0x4edc('0x1ea')]=function(_0x2c7bb3){var _0x5b7051=this;return function(){var _0x189d1d=0x0;var _0x16d03b=Math[_0x4edc('0x1dc')](_0x2c7bb3['erlangCallToSecond']*0x3e8);if(_0x16d03b>0x0){_0x16d03b=_0x16d03b<0x64?0x64:_0x16d03b;loggerPredictive[_0x4edc('0x7e')](_0x2c7bb3[_0x4edc('0x41')],_0x4edc('0x1f8'),_0x16d03b,_0x4edc('0x4b'));_0x2c7bb3[_0x4edc('0x94')]=setInterval(function(){_0x5b7051[_0x4edc('0x94')](_0x2c7bb3);loggerPredictiveCalls['info'](_0x4edc('0x1f9'),_0x189d1d+=0x1);},_0x16d03b);}else{loggerPredictive['info'](_0x2c7bb3[_0x4edc('0x41')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x4edc('0x1d')]['checkContactBlack']=function(_0x32a616,_0x44c0cf){var _0xf6646f=this;return function(_0x4a083b){if(_[_0x4edc('0x47')](_0x4a083b)){if(_['isNil'](_0x44c0cf['UserId'])||!_0x44c0cf[_0x4edc('0x1fa')]){if(_0x32a616[_0x4edc('0x5b')]===_0x4edc('0xa')){_0x32a616[_0x4edc('0x143')]=_[_0x4edc('0x3f')](_0x32a616[_0x4edc('0x143')])?!![]:_0x32a616[_0x4edc('0x143')];var _0x28a4b5=uuid['v4']();_0xf6646f['actions'][_0x28a4b5]=new Action(_0x32a616,_0x44c0cf,_0x28a4b5);loggerBooked[_0x4edc('0x7e')](_0x4edc('0x1fb'),_0x28a4b5,_0x4edc('0x1fc'),JSON[_0x4edc('0x4a')](_0x32a616['queueStatusComplete']),'Queue:\x20',_0x32a616[_0x4edc('0x41')]);if(_0x32a616[_0x4edc('0x143')]){_0x32a616[_0x4edc('0x143')]=![];_0xf6646f[_0x4edc('0x140')][_0xf6646f['actions'][_0x28a4b5][_0x4edc('0xb4')]]=[];ami[_0x4edc('0xb0')]({'actionid':_0x28a4b5,'action':_0x4edc('0x1fd'),'queue':_0x32a616[_0x4edc('0x41')]})[_0x4edc('0xb9')](function(){_0xf6646f[_0x4edc('0xb3')](_0x32a616);_0xf6646f[_0x4edc('0xc6')]({'active':![],'ContactId':_0xf6646f[_0x4edc('0x27')][_0x28a4b5][_0x4edc('0xd8')],'ListId':_0xf6646f[_0x4edc('0x27')][_0x28a4b5][_0x4edc('0xd9')],'VoiceQueueId':_0xf6646f[_0x4edc('0x27')][_0x28a4b5][_0x4edc('0xda')]||undefined,'CampaignId':_0xf6646f[_0x4edc('0x27')][_0x28a4b5][_0x4edc('0xdb')]||undefined})['catch'](loggerCatch(_0x4edc('0x1fe')));delete _0xf6646f[_0x4edc('0x27')][_0x28a4b5];});}else{loggerBooked[_0x4edc('0x7e')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x32a616[_0x4edc('0x143')]),_0x4edc('0x1ff'),_0x32a616[_0x4edc('0x41')]);_0xf6646f[_0x4edc('0xb3')](_0x32a616);_0xf6646f[_0x4edc('0xc6')]({'active':![],'ContactId':_0xf6646f[_0x4edc('0x27')][_0x28a4b5][_0x4edc('0xd8')],'ListId':_0xf6646f[_0x4edc('0x27')][_0x28a4b5][_0x4edc('0xd9')],'VoiceQueueId':_0xf6646f[_0x4edc('0x27')][_0x28a4b5][_0x4edc('0xda')]||undefined,'CampaignId':_0xf6646f[_0x4edc('0x27')][_0x28a4b5][_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1fe')));delete _0xf6646f[_0x4edc('0x27')][_0x28a4b5];}}else{return _0xf6646f['actionOriginate'](_0x32a616,_0x44c0cf);}}else{if(getDiff(_0x44c0cf[_0x4edc('0x200')])<_0x32a616['dialRecallMeTimeout']*0x3c){if(_0x44c0cf['Agent']&&!_0x44c0cf['Agent'][_0x4edc('0x201')]){_0xf6646f['preview']['run'](_0x44c0cf['id'])[_0x4edc('0x1f')](function(){_0xf6646f[_0x4edc('0xb3')](_0x32a616);});}else{_0xf6646f[_0x4edc('0xc8')]({'active':![]},_0x44c0cf['id'],0x1)[_0x4edc('0x1f')](function(){_0xf6646f[_0x4edc('0xb3')](_0x32a616);});}}else{_0x32a616['outboundReCallsDay']+=0x1;_0xf6646f[_0x4edc('0xb3')](_0x32a616);if(_0x32a616[_0x4edc('0x202')]){_0xf6646f['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x44c0cf['ContactId'],'ListId':_0x44c0cf[_0x4edc('0xd9')],'VoiceQueueId':_0x44c0cf[_0x4edc('0xda')]||undefined,'CampaignId':_0x44c0cf[_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x203')));_0xf6646f[_0x4edc('0xe4')](createObjHistory(_0x32a616,_0x44c0cf,'RECALLINQUEUE',0x17,_0x4edc('0x204')))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x205')));}else{_0xf6646f['saveInDb'](createObjHistory(_0x32a616,_0x44c0cf,'RECALLFAILEDTIMEOUT',0x16,_0x4edc('0x206')),_0x4edc('0x207'),_0x4edc('0x208'));}}}}else{_0x32a616[_0x4edc('0x60')]+=0x1;_0xf6646f[_0x4edc('0xd7')](createObjHistory(_0x32a616,_0x44c0cf,_0x4edc('0x209'),0xd,_0x4edc('0x20a')),_0x4edc('0x20b'),_0x4edc('0x20c'));throw'inBlackList';}};};Dialer[_0x4edc('0x1d')][_0x4edc('0x173')]=function(_0x579baf){var _0x5ee4f7=this;var _0x22bc92=_0x579baf[_0x4edc('0x20d')]-_0x579baf['originated']-_0x579baf[_0x4edc('0xcb')];emitCampaignSummary(_0x579baf);if(_0x22bc92>0x0){if(_0x22bc92>this[_0x4edc('0x26')]){_0x22bc92=this[_0x4edc('0x26')];}_0x579baf[_0x4edc('0xcb')]+=_0x22bc92;this[_0x4edc('0xcd')](_0x579baf['id'],_0x22bc92,_0x579baf['dialOrderByScheduledAt'],_0x579baf)[_0x4edc('0x3e')](function(_0x18a641){_0x579baf[_0x4edc('0xcb')]-=_0x22bc92;_0x579baf['temp']=_0x579baf[_0x4edc('0xcb')]>0x0?_0x579baf[_0x4edc('0xcb')]:0x0;if(!checkContactEmpty(_0x18a641)){_0x579baf['message']=_0x4edc('0xa0');logger[_0x4edc('0x7e')](_0x4edc('0x20e')+_0x579baf[_0x4edc('0x41')]);}else{_0x579baf[_0x4edc('0x9c')]+=_0x18a641['length'];_0x579baf['message']='RUNNING';for(var _0x3ec309=0x0;_0x3ec309<_0x18a641['length'];_0x3ec309+=0x1){_0x579baf[_0x4edc('0x20f')]+=0x1;if(_[_0x4edc('0xe6')](_0x18a641[_0x3ec309])||_['isNil'](_0x18a641[_0x3ec309]['Contact'])||_[_0x4edc('0xe6')](_0x18a641[_0x3ec309][_0x4edc('0x1a1')])){_0x5ee4f7['emptyContact'](_0x4edc('0x210'),_0x579baf,_0x18a641[_0x3ec309]);}else{_0x5ee4f7[_0x4edc('0xc1')](_[_0x4edc('0x146')](_0x18a641[_0x3ec309],[_0x4edc('0xdb'),_0x4edc('0x1a1')]))[_0x4edc('0x3e')](_0x5ee4f7[_0x4edc('0x211')](_0x579baf,_0x18a641[_0x3ec309]))[_0x4edc('0xb9')](_0x5ee4f7[_0x4edc('0xd5')](_0x4edc('0x212'),_0x579baf));}}}})['catch'](loggerGetContactDialer(_0x4edc('0x213'),_0x579baf,_0x22bc92));}};Dialer['prototype'][_0x4edc('0x16a')]=function(_0x425027,_0xaad84d){var _0xd0e2b5=this;var _0x190ed2=[];var _0x22bc70=_0xaad84d>=0x1?_0xaad84d:0x1;if(_0x425027[_0x4edc('0x5b')]==='booked'){_0x22bc70=0x1;}var _0x350ba8=Math['floor'](_0x425027[_0x4edc('0x51')]*_0x22bc70)-_0x425027[_0x4edc('0x9c')]-_0x425027[_0x4edc('0xcb')];emitVoiceQueueSummary(_0x425027);if(_0x425027[_0x4edc('0x214')]>0x0){var _0x54befc=_0x425027[_0x4edc('0x214')]-_0x425027['originated']-_0x425027[_0x4edc('0x54')]-_0x425027[_0x4edc('0xcb')]-_0x425027['pTalking'];if(_0x350ba8>_0x54befc){_0x350ba8=_0x54befc;}}if(_0x350ba8>0x0){if(_0x425027['dialMethod']==='booked'){_0x350ba8=0x1;}if(_0x350ba8>this['maxNumberOriginate']){_0x350ba8=this[_0x4edc('0x26')];}_0x425027[_0x4edc('0xcb')]+=_0x350ba8;for(var _0x356e9e in this[_0x4edc('0x24')]){if(typeof this[_0x4edc('0x24')][_0x356e9e]!==_0x4edc('0x9d')){if(this[_0x4edc('0x24')][_0x356e9e][_0x4edc('0xa8')]===_0x4edc('0x215')&&this['agents'][_0x356e9e][_0x4edc('0xe0')]===_0x4edc('0xe1')){_0x190ed2['push'](this[_0x4edc('0x24')][_0x356e9e]['id']);}}}this[_0x4edc('0xca')](_0x425027['id'],_0x190ed2,_0x350ba8,_0x425027[_0x4edc('0x216')],_0x425027)['then'](function(_0x58c934){_0x425027[_0x4edc('0xcb')]-=_0x350ba8;_0x425027['temp']=_0x425027[_0x4edc('0xcb')]>0x0?_0x425027[_0x4edc('0xcb')]:0x0;if(!checkContactEmpty(_0x58c934)){_0xd0e2b5[_0x4edc('0xb7')](_0x425027)[_0x4edc('0x3e')](sendMessageReschedule(_0x425027))[_0x4edc('0xb9')](loggerCatch('[countReScheduled]\x20'));}else{_0x425027[_0x4edc('0x9c')]+=_0x58c934[_0x4edc('0x9b')];_0x425027[_0x4edc('0x42')]=_0x425027[_0x4edc('0x5b')]===_0x4edc('0xa')?_0x4edc('0x18a'):'RUNNING';for(var _0x4302f9=0x0;_0x4302f9<_0x58c934[_0x4edc('0x9b')];_0x4302f9+=0x1){if(_[_0x4edc('0xe6')](_0x58c934[_0x4302f9])||_[_0x4edc('0xe6')](_0x58c934[_0x4302f9][_0x4edc('0x198')])||_['isNil'](_0x58c934[_0x4302f9]['phone'])){_0xd0e2b5['emptyContact'](_0x4edc('0x210'),_0x425027,_0x58c934[_0x4302f9]);}else{_0xd0e2b5['checkIsBlackList'](_['pick'](_0x58c934[_0x4302f9],['VoiceQueueId','phone']))['then'](_0xd0e2b5['checkContactBlack'](_0x425027,_0x58c934[_0x4302f9]))['catch'](_0xd0e2b5[_0x4edc('0xd5')]('[actionOriginate]\x20',_0x425027));}}}})[_0x4edc('0xb9')](loggerGetContactDialer('[getContactDialer2]',_0x425027,_0x350ba8));}};Dialer[_0x4edc('0x1d')][_0x4edc('0x94')]=function(_0x5f1e9c){if(_0x5f1e9c['dialLimitQueue']>0x0){var _0x48ba24=_0x5f1e9c[_0x4edc('0x214')]-_0x5f1e9c[_0x4edc('0x9c')]-_0x5f1e9c[_0x4edc('0x54')];if(_0x48ba24>0x0){this[_0x4edc('0x217')](_0x5f1e9c);}else{loggerPredictiveCalls[_0x4edc('0x7e')]('[handlePredictive][limitChannel]');}}else{this[_0x4edc('0x217')](_0x5f1e9c);}};Dialer[_0x4edc('0x1d')][_0x4edc('0x217')]=function(_0x42e8dd){var _0x1e5365=this;var _0x168ad8=[];_0x42e8dd[_0x4edc('0x9c')]+=0x1;for(var _0x1badee in this[_0x4edc('0x24')]){if(typeof this[_0x4edc('0x24')][_0x1badee]!==_0x4edc('0x9d')){if(this[_0x4edc('0x24')][_0x1badee][_0x4edc('0xa8')]===_0x4edc('0x215')&&this[_0x4edc('0x24')][_0x1badee][_0x4edc('0xe0')]==='reachable'){_0x168ad8[_0x4edc('0x141')](this['agents'][_0x1badee]['id']);}}}this[_0x4edc('0xca')](_0x42e8dd['id'],_0x168ad8,0x1,_0x42e8dd[_0x4edc('0x216')],_0x42e8dd)[_0x4edc('0x3e')](function(_0x5ed852){if(!checkContactEmpty(_0x5ed852)){checkContactLowerLimitOriginate(_0x42e8dd,0x1,0x0);_0x1e5365[_0x4edc('0xb7')](_0x42e8dd)[_0x4edc('0x3e')](sendMessageReschedule(_0x42e8dd))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0xba')));}else{_0x42e8dd[_0x4edc('0x42')]=_0x4edc('0x218');if(_[_0x4edc('0xe6')](_0x5ed852[0x0])||_[_0x4edc('0xe6')](_0x5ed852[0x0][_0x4edc('0x198')])||_[_0x4edc('0xe6')](_0x5ed852[0x0][_0x4edc('0x1a1')])){_0x1e5365['emptyContact']('[actionOriginate]\x20',_0x42e8dd,_0x5ed852[0x0]);}else{_0x1e5365[_0x4edc('0xbb')](_[_0x4edc('0x146')](_0x5ed852[0x0],[_0x4edc('0xda'),_0x4edc('0x1a1')]))[_0x4edc('0x3e')](_0x1e5365[_0x4edc('0x211')](_0x42e8dd,_0x5ed852[0x0]))[_0x4edc('0xb9')](_0x1e5365[_0x4edc('0xd5')](_0x4edc('0x219'),_0x42e8dd));}}})[_0x4edc('0xb9')](loggerGetContactDialer(_0x4edc('0x21a'),_0x42e8dd,0x1));emitVoiceQueueSummary(_0x42e8dd);};Dialer['prototype']['abandonmentRate']=function(_0x22c0d9,_0x558862,_0x150862,_0x3f33f1,_0x9508cc,_0x1784ac){loggerPredictive['info'](_0x4edc('0x21b'));loggerPredictive['info'](_0x4edc('0x21c'),_0x22c0d9);loggerPredictive['info'](_0x4edc('0x21d'),_0x558862);loggerPredictive['info'](_0x4edc('0x21e'),_0x150862);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x21f'),_0x3f33f1);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x220'),_0x9508cc);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x87'));return new Promise(function(_0x33cf5f,_0x51baab){if(_0x22c0d9<=0x0||isNaN(_0x22c0d9)){return _0x51baab(msgResponse(_0x4edc('0x221'),_0x4edc('0x49'),'m\x20=\x20'+_0x22c0d9));}if(_0x150862<=0x0||isNaN(_0x150862)){return _0x51baab(msgResponse('[abandonmentRate]',_0x4edc('0x49'),_0x4edc('0x222')+_0x150862));}if(_0x3f33f1<=0x0||isNaN(_0x3f33f1)){return _0x51baab(msgResponse(_0x4edc('0x221'),'Error',_0x4edc('0x223')+_0x3f33f1));}if(_0x558862<=0x0||isNaN(_0x558862)){return _0x51baab(msgResponse(_0x4edc('0x221'),_0x4edc('0x49'),_0x4edc('0x224')+_0x558862));}if(_0x9508cc<=0x0||isNaN(_0x9508cc)){return _0x51baab(msgResponse('[abandonmentRate]','Error',_0x4edc('0x225')+_0x9508cc));}_0x1784ac=_0x1784ac||0x0;var _0x5b9aad=0x1/_0x150862;var _0x434f8d=0x0;var _0x2ae490=0x0;var _0x620cfd=0x0;var _0x182323=0x0;for(var _0x4305c3=0x0;_0x620cfd<_0x9508cc;_0x4305c3+=0x1){_0x2ae490=_0x4305c3/_0x558862;_0x434f8d=(_0x3f33f1*_0x2ae490+_0x1784ac)/_0x5b9aad;_0x620cfd=erlangb(_0x434f8d,_0x22c0d9);_0x182323=_0x434f8d/_0x22c0d9*(0x1-erlangb(_0x434f8d,_0x22c0d9));}return _0x33cf5f({'erlangCalls':_0x4305c3,'erlangCallToSecond':_0x558862/_0x4305c3,'erlangAbandonmentRate':_0x620cfd,'erlangBusyFactor':_0x182323});});};Dialer['prototype'][_0x4edc('0x1f2')]=function(_0x33b288,_0x5294ad,_0x3ee6cc,_0x75adeb,_0x2d49c0,_0x31bd46){loggerPredictive['info'](_0x4edc('0x226'));loggerPredictive[_0x4edc('0x7e')]('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',_0x33b288);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x21d'),_0x5294ad);loggerPredictive[_0x4edc('0x7e')]('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',_0x3ee6cc);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x21f'),_0x75adeb);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x227'),_0x2d49c0);loggerPredictive['info'](_0x4edc('0x87'));return new Promise(function(_0x3219ea,_0x309f7f){if(_0x33b288<=0x0||isNaN(_0x33b288)){return _0x309f7f(msgResponse('[busyFactor]',_0x4edc('0x49'),'m\x20=\x20'+_0x33b288));}if(_0x3ee6cc<=0x0||isNaN(_0x3ee6cc)){return _0x309f7f(msgResponse(_0x4edc('0x228'),_0x4edc('0x49'),_0x4edc('0x222')+_0x3ee6cc));}if(_0x75adeb<=0x0||isNaN(_0x75adeb)){return _0x309f7f(msgResponse(_0x4edc('0x228'),_0x4edc('0x49'),_0x4edc('0x223')+_0x75adeb));}if(_0x5294ad<=0x0||isNaN(_0x5294ad)){return _0x309f7f(msgResponse('[busyFactor]','Error',_0x4edc('0x224')+_0x5294ad));}if(_0x2d49c0<=0x0||isNaN(_0x2d49c0)){return _0x309f7f(msgResponse(_0x4edc('0x228'),_0x4edc('0x49'),_0x4edc('0x229')+_0x2d49c0));}_0x31bd46=_0x31bd46||0x0;var _0x11475b=0x1/_0x3ee6cc;var _0x1a7fba=0x0;var _0x1a5d90=0x0;var _0x149ab6=0x0;var _0x4236ae=0x0;for(var _0x2691e9=0x0;_0x4236ae<_0x2d49c0;_0x2691e9+=0x1){_0x1a5d90=_0x2691e9/_0x5294ad;_0x1a7fba=(_0x75adeb*_0x1a5d90+_0x31bd46)/_0x11475b;_0x149ab6=erlangb(_0x1a7fba,_0x33b288);_0x4236ae=_0x1a7fba/_0x33b288*(0x1-erlangb(_0x1a7fba,_0x33b288));}return _0x3219ea({'erlangCalls':_0x2691e9,'erlangCallToSecond':_0x5294ad/_0x2691e9,'erlangAbandonmentRate':_0x149ab6,'erlangBusyFactor':_0x4236ae});});};module[_0x4edc('0x22a')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index e085f0a..8d987ab 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 _0xde06=['countmachineretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','endtime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry'];(function(_0x851a81,_0xc3d770){var _0x34e35a=function(_0x1e303a){while(--_0x1e303a){_0x851a81['push'](_0x851a81['shift']());}};_0x34e35a(++_0xc3d770);}(_0xde06,0x113));var _0x6de0=function(_0x3244b0,_0xbfc103){_0x3244b0=_0x3244b0-0x0;var _0x1d8199=_0xde06[_0x3244b0];return _0x1d8199;};'use strict';var util=require(_0x6de0('0x0'));var _=require(_0x6de0('0x1'));var moment=require(_0x6de0('0x2'));function getSeconds(_0x26406b,_0x5ba682){var _0x28830d=moment(_0x26406b)[_0x6de0('0x3')](0x0);var _0x39bdd6=moment(_0x5ba682)['milliseconds'](0x0);return _0x28830d[_0x6de0('0x4')](_0x39bdd6,_0x6de0('0x5'));}function QueueCallerAbandon(_0x2db166,_0x2308b5){this[_0x6de0('0x6')]=_0x2db166[_0x6de0('0x6')];this[_0x6de0('0x7')]=_0x2db166[_0x6de0('0x7')];this[_0x6de0('0x8')]=_0x2db166[_0x6de0('0x7')]===_0x6de0('0x9')?_0x6de0('0xa'):_0x2db166[_0x6de0('0x7')];this[_0x6de0('0xb')]=_0x2db166[_0x6de0('0xb')];this[_0x6de0('0xc')]=_0x2db166[_0x6de0('0xc')];this[_0x6de0('0xd')]=_0x2db166[_0x6de0('0xd')];this[_0x6de0('0xe')]=_0x2db166[_0x6de0('0xb')]+_0x2db166['countcongestionretry']+_0x2db166[_0x6de0('0xd')]+_0x2db166[_0x6de0('0xf')]+_0x2db166[_0x6de0('0x10')]+_0x2db166[_0x6de0('0x11')]+_0x2db166['countmachineretry']+_0x2db166[_0x6de0('0x12')];this[_0x6de0('0xf')]=_0x2db166[_0x6de0('0xf')];this[_0x6de0('0x10')]=_0x2db166[_0x6de0('0x10')];this[_0x6de0('0x11')]=_0x2db166[_0x6de0('0x11')];this[_0x6de0('0x13')]=_0x2db166[_0x6de0('0x13')];this[_0x6de0('0x12')]=_0x2db166[_0x6de0('0x12')];this['uniqueid']=_0x2308b5[_0x6de0('0x14')];this[_0x6de0('0x15')]=_0x2db166[_0x6de0('0x16')];this[_0x6de0('0x17')]=_0x2db166['number'];this[_0x6de0('0x18')]=_0x2db166[_0x6de0('0x18')];this[_0x6de0('0x19')]=_0x2db166['responsetime'];this[_0x6de0('0x1a')]=_0x2db166[_0x6de0('0x1a')];this[_0x6de0('0x1b')]=this[_0x6de0('0x1a')];this['ringtime']=getSeconds(_0x2db166[_0x6de0('0x19')],_0x2db166[_0x6de0('0x18')]);this[_0x6de0('0x1c')]=getSeconds(this['droptime'],_0x2db166[_0x6de0('0x19')]);this['talktime']=0x0;this[_0x6de0('0xa')]=_0x2308b5['queue'];this[_0x6de0('0x1d')]=_0x2308b5['connectedlinename'];this[_0x6de0('0x1e')]=_0x2308b5[_0x6de0('0x1e')];this[_0x6de0('0x1f')]=_0x2db166['callback'];this[_0x6de0('0x20')]=_0x2db166[_0x6de0('0x20')];this[_0x6de0('0x21')]=_0x2db166[_0x6de0('0x21')];this[_0x6de0('0x22')]=_0x2db166[_0x6de0('0x22')];this[_0x6de0('0x23')]=_0x2db166[_0x6de0('0x23')];this[_0x6de0('0x24')]=_0x2db166[_0x6de0('0x24')];this['UserId']=_0x2db166['UserId'];this[_0x6de0('0x25')]=_0x2db166['VoiceQueueId'];this['CampaignId']=_0x2db166[_0x6de0('0x26')];this[_0x6de0('0x27')]=_0x2db166['originatecalleridnum']||'';this[_0x6de0('0x28')]=_0x2db166[_0x6de0('0x28')]||'';}module[_0x6de0('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0xc080=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridnum','number','starttime','droptime','endtime','ringtime','responsetime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry'];(function(_0x5fe1b2,_0x30daae){var _0x104b8d=function(_0x5e2d71){while(--_0x5e2d71){_0x5fe1b2['push'](_0x5fe1b2['shift']());}};_0x104b8d(++_0x30daae);}(_0xc080,0xc2));var _0x0c08=function(_0x35d99e,_0x566e5f){_0x35d99e=_0x35d99e-0x0;var _0x412b9b=_0xc080[_0x35d99e];return _0x412b9b;};'use strict';var util=require(_0x0c08('0x0'));var _=require('lodash');var moment=require(_0x0c08('0x1'));function getSeconds(_0x192610,_0x30faf9){var _0xc9d79b=moment(_0x192610)[_0x0c08('0x2')](0x0);var _0x518656=moment(_0x30faf9)[_0x0c08('0x2')](0x0);return _0xc9d79b[_0x0c08('0x3')](_0x518656,_0x0c08('0x4'));}function QueueCallerAbandon(_0x1013e5,_0x130917){this['scheduledat']=_0x1013e5[_0x0c08('0x5')];this[_0x0c08('0x6')]=_0x1013e5['type'];this[_0x0c08('0x7')]=_0x1013e5[_0x0c08('0x6')]==='outbound'?_0x0c08('0x8'):_0x1013e5[_0x0c08('0x6')];this[_0x0c08('0x9')]=_0x1013e5['countbusyretry'];this[_0x0c08('0xa')]=_0x1013e5['countcongestionretry'];this[_0x0c08('0xb')]=_0x1013e5[_0x0c08('0xb')];this[_0x0c08('0xc')]=_0x1013e5['countbusyretry']+_0x1013e5[_0x0c08('0xa')]+_0x1013e5[_0x0c08('0xb')]+_0x1013e5[_0x0c08('0xd')]+_0x1013e5[_0x0c08('0xe')]+_0x1013e5['countabandonedretry']+_0x1013e5[_0x0c08('0xf')]+_0x1013e5[_0x0c08('0x10')];this[_0x0c08('0xd')]=_0x1013e5['countnosuchnumberretry'];this[_0x0c08('0xe')]=_0x1013e5['countdropretry'];this[_0x0c08('0x11')]=_0x1013e5[_0x0c08('0x11')];this[_0x0c08('0xf')]=_0x1013e5[_0x0c08('0xf')];this[_0x0c08('0x10')]=_0x1013e5['countagentrejectretry'];this['uniqueid']=_0x130917['uniqueid'];this['calleridname']=_0x1013e5['name'];this[_0x0c08('0x12')]=_0x1013e5[_0x0c08('0x13')];this[_0x0c08('0x14')]=_0x1013e5['starttime'];this['responsetime']=_0x1013e5['responsetime'];this[_0x0c08('0x15')]=_0x1013e5[_0x0c08('0x15')];this[_0x0c08('0x16')]=this[_0x0c08('0x15')];this[_0x0c08('0x17')]=getSeconds(_0x1013e5[_0x0c08('0x18')],_0x1013e5[_0x0c08('0x14')]);this[_0x0c08('0x19')]=getSeconds(this[_0x0c08('0x15')],_0x1013e5[_0x0c08('0x18')]);this[_0x0c08('0x1a')]=0x0;this['queue']=_0x130917[_0x0c08('0x8')];this['membername']=_0x130917[_0x0c08('0x1b')];this[_0x0c08('0x1c')]=_0x130917[_0x0c08('0x1c')];this[_0x0c08('0x1d')]=_0x1013e5[_0x0c08('0x1d')];this[_0x0c08('0x1e')]=_0x1013e5[_0x0c08('0x1e')];this[_0x0c08('0x1f')]=_0x1013e5['callbackat'];this['recallme']=_0x1013e5[_0x0c08('0x20')];this[_0x0c08('0x21')]=_0x1013e5[_0x0c08('0x21')];this[_0x0c08('0x22')]=_0x1013e5[_0x0c08('0x22')];this[_0x0c08('0x23')]=_0x1013e5[_0x0c08('0x23')];this[_0x0c08('0x24')]=_0x1013e5[_0x0c08('0x24')];this[_0x0c08('0x25')]=_0x1013e5[_0x0c08('0x25')];this[_0x0c08('0x26')]=_0x1013e5[_0x0c08('0x26')]||'';this[_0x0c08('0x27')]=_0x1013e5[_0x0c08('0x27')]||'';}module[_0x0c08('0x28')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 6316362..724f560 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(_0x220966,_0x120477){var _0x18a244=function(_0x194479){while(--_0x194479){_0x220966['push'](_0x220966['shift']());}};_0x18a244(++_0x120477);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var 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(_0x355514,_0x383367){var _0x55eca5=function(_0x5e7595){while(--_0x5e7595){_0x355514['push'](_0x355514['shift']());}};_0x55eca5(++_0x383367);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 c578abd..721b07c 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 _0x6005=['notify','.pdf','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','[Fax][execOriginate][success]','message','Fax\x20failed','checkAfterSend','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','execOriginate','ext','isTrunkReachable','isNil','active','reachable','SIP/%s','unmonitored','checkTrunk','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','util','lodash','uuid','moment','path','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','application/pdf'];(function(_0x589c57,_0x5064a9){var _0x1c8a9c=function(_0x17e67d){while(--_0x17e67d){_0x589c57['push'](_0x589c57['shift']());}};_0x1c8a9c(++_0x5064a9);}(_0x6005,0x11e));var _0x5600=function(_0x4ea281,_0x52e87a){_0x4ea281=_0x4ea281-0x0;var _0x37196e=_0x6005[_0x4ea281];return _0x37196e;};'use strict';var util=require(_0x5600('0x0'));var _=require(_0x5600('0x1'));var BPromise=require('bluebird');var uuid=require(_0x5600('0x2'));var moment=require(_0x5600('0x3'));var path=require(_0x5600('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x5600('0x5'));var ami=require(_0x5600('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0x5600('0x7'));var ut=require(_0x5600('0x8'));var Action=require(_0x5600('0x9'));var faxAccount=require(_0x5600('0xa'));var attachment=require(_0x5600('0xb'));var faxMessage=require(_0x5600('0xc'));function Fax(_0x531aca){this['channels']={};this[_0x5600('0xd')]=_0x531aca['faxAccounts'];this[_0x5600('0xe')]=_0x531aca[_0x5600('0xe')];this[_0x5600('0xf')]={};ami['on'](_0x5600('0x10'),this[_0x5600('0x11')][_0x5600('0x12')](this));ami['on']('varset',this[_0x5600('0x13')][_0x5600('0x12')](this));ami['on'](_0x5600('0x14'),this['syncNewState'][_0x5600('0x12')](this));ami['on']('newexten',this[_0x5600('0x15')][_0x5600('0x12')](this));ami['on'](_0x5600('0x16'),this[_0x5600('0x17')][_0x5600('0x12')](this));ami['on'](_0x5600('0x18'),this[_0x5600('0x19')][_0x5600('0x12')](this));ami['on'](_0x5600('0x1a'),this[_0x5600('0x1b')][_0x5600('0x12')](this));ami['on']('originateresponse',this[_0x5600('0x1c')][_0x5600('0x12')](this));}Fax[_0x5600('0x1d')][_0x5600('0x11')]=function(_0x47158b){if(_0x47158b[_0x5600('0x1e')]===_0x5600('0x1f')){for(var _0x45d5e4 in this[_0x5600('0xd')]){if(this[_0x5600('0xd')][_0x5600('0x20')](_0x45d5e4)){if(_0x47158b[_0x5600('0x21')]===this[_0x5600('0xd')][_0x45d5e4][_0x5600('0x22')]){this[_0x5600('0x23')][_0x47158b['uniqueid']]={};this[_0x5600('0x23')][_0x47158b[_0x5600('0x24')]][_0x5600('0x25')]=_0x47158b[_0x5600('0x25')];this['channels'][_0x47158b[_0x5600('0x24')]]['id']=this['faxAccounts'][_0x45d5e4]['id'];this[_0x5600('0x23')][_0x47158b[_0x5600('0x24')]][_0x5600('0x26')]=this[_0x5600('0xd')][_0x45d5e4][_0x5600('0x26')];logger[_0x5600('0x27')](_0x47158b[_0x5600('0x24')],'\x20syncNewchannel\x20');}}}}if(this[_0x5600('0xf')][_0x47158b[_0x5600('0x24')]]){this['channels'][_0x47158b[_0x5600('0x24')]]={};this[_0x5600('0x23')][_0x47158b['uniqueid']][_0x5600('0x25')]=_0x47158b[_0x5600('0x25')];logger['info'](_0x47158b['uniqueid'],_0x5600('0x28'));}};Fax[_0x5600('0x1d')]['syncVarSet']=function(_0x56ee47){if(this[_0x5600('0x23')][_0x56ee47[_0x5600('0x24')]]){for(var _0x989b7 in _0x56ee47[_0x5600('0x29')]){if(_0x56ee47[_0x5600('0x29')][_0x5600('0x20')](_0x989b7)){this[_0x5600('0x23')][_0x56ee47[_0x5600('0x24')]][_0x989b7]=_0x56ee47[_0x5600('0x2a')];}}}};Fax[_0x5600('0x1d')][_0x5600('0x2b')]=function(_0x42ad7c){if(this['channels'][_0x42ad7c[_0x5600('0x24')]]){this[_0x5600('0x23')][_0x42ad7c[_0x5600('0x24')]][_0x5600('0x2c')]=_0x42ad7c['channelstate'];this[_0x5600('0x23')][_0x42ad7c[_0x5600('0x24')]][_0x5600('0x2d')]=_0x42ad7c['channelstatedesc'];}};Fax[_0x5600('0x1d')][_0x5600('0x15')]=function(_0x424551){if(this['channels'][_0x424551[_0x5600('0x24')]]){for(var _0x119d22 in _0x424551[_0x5600('0x29')]){if(_0x424551[_0x5600('0x29')][_0x5600('0x20')](_0x119d22)){this[_0x5600('0x23')][_0x424551['uniqueid']][_0x119d22]=_0x424551[_0x5600('0x2a')];}}}};Fax[_0x5600('0x1d')][_0x5600('0x17')]=function(_0x23132a){if(this[_0x5600('0x23')][_0x23132a[_0x5600('0x24')]]){this[_0x5600('0x23')][_0x23132a[_0x5600('0x24')]][_0x5600('0x2e')]=_0x23132a['operation'];this['channels'][_0x23132a[_0x5600('0x24')]][_0x5600('0x2f')]=_0x23132a[_0x5600('0x2f')];this[_0x5600('0x23')][_0x23132a[_0x5600('0x24')]][_0x5600('0x22')]=_0x23132a[_0x5600('0x22')];this[_0x5600('0x23')][_0x23132a['uniqueid']][_0x5600('0x30')]=_0x23132a['filename'];logger['info'](_0x23132a[_0x5600('0x24')],_0x5600('0x31'));}};Fax[_0x5600('0x1d')][_0x5600('0x19')]=function(_0x8b431d){var _0x1ae1ec=this;if(this[_0x5600('0x23')][_0x8b431d[_0x5600('0x24')]]){var _0x197143=this[_0x5600('0x23')][_0x8b431d[_0x5600('0x24')]]['id'];this[_0x5600('0x23')][_0x8b431d['uniqueid']][_0x5600('0x32')]=_0x8b431d[_0x5600('0x32')];this[_0x5600('0x23')][_0x8b431d[_0x5600('0x24')]][_0x5600('0x33')]=_0x8b431d[_0x5600('0x33')];this[_0x5600('0x23')][_0x8b431d[_0x5600('0x24')]][_0x5600('0x22')]=_0x8b431d[_0x5600('0x22')];this[_0x5600('0x23')][_0x8b431d[_0x5600('0x24')]][_0x5600('0x34')]=_0x8b431d[_0x5600('0x34')];this[_0x5600('0x23')][_0x8b431d[_0x5600('0x24')]][_0x5600('0x35')]=_0x8b431d[_0x5600('0x35')];this[_0x5600('0x23')][_0x8b431d[_0x5600('0x24')]][_0x5600('0x30')]=_0x8b431d[_0x5600('0x30')];this['channels'][_0x8b431d[_0x5600('0x24')]][_0x5600('0x36')]=_0x8b431d[_0x5600('0x36')];if(this[_0x5600('0x23')][_0x8b431d[_0x5600('0x24')]][_0x5600('0x33')]>0x0){tiff2pdf(_0x8b431d[_0x5600('0x30')],_0x5600('0x37'),function(_0x3b9455){logger['info'](_0x8b431d[_0x5600('0x24')],'\x20result\x20conversion\x20file\x20',_0x3b9455['message']);attachment[_0x5600('0x38')]({'name':path[_0x5600('0x39')](_0x8b431d[_0x5600('0x30')])['name'],'basename':path['parse'](_0x8b431d[_0x5600('0x30')])[_0x5600('0x26')]+'.pdf','type':_0x5600('0x3a')})['then'](function(_0x299706){faxAccount[_0x5600('0x3b')](_0x197143,{'from':_0x8b431d[_0x5600('0x36')],'mapKey':_0x5600('0x5'),'body':path[_0x5600('0x39')](_0x8b431d[_0x5600('0x30')])['name']+_0x5600('0x3c'),'AttachmentId':_0x299706['id']})['catch'](function(_0x13542b){logger[_0x5600('0x3d')](_0x8b431d[_0x5600('0x24')],_0x5600('0x3e'),JSON[_0x5600('0x3f')](_0x13542b));});})[_0x5600('0x40')](function(_0x28793c){logger[_0x5600('0x3d')](_0x8b431d[_0x5600('0x24')],_0x5600('0x41'),JSON[_0x5600('0x3f')](_0x28793c));});});}logger[_0x5600('0x27')](_0x8b431d['uniqueid'],_0x5600('0x41'));}};Fax[_0x5600('0x1d')][_0x5600('0x1c')]=function(_0x3738d4){if(this[_0x5600('0xf')][_0x3738d4[_0x5600('0x24')]]){_[_0x5600('0x42')](this[_0x5600('0x23')][_0x3738d4[_0x5600('0x24')]],_[_0x5600('0x43')](_0x3738d4,[_0x5600('0x44'),_0x5600('0x45')]));}};function updateStatus(_0x4e593c){if(_0x4e593c[_0x5600('0x46')]){faxMessage[_0x5600('0x47')](_0x4e593c[_0x5600('0x46')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x5600('0x48')](function(_0x25d34d){ut[_0x5600('0x49')](_0x5600('0x4a'),_0x25d34d);})['catch'](function(_0x5350d9){ut[_0x5600('0x49')](_0x5600('0x4b'),_0x5350d9);});}else{ut['logger'](_0x5600('0x4c'));}}Fax['prototype'][_0x5600('0x4d')]=function(_0x478a61,_0x5edf83,_0xa4642e){var _0x310c02=this;var _0x15a573={};if(_0x5edf83){_0x15a573={'read':_0x5edf83};}else{_0x15a573={'failMessage':_0xa4642e};}if(this['actions'][_0x478a61][_0x5600('0x46')]){faxMessage[_0x5600('0x47')](this['actions'][_0x478a61][_0x5600('0x46')],_0x15a573)['then'](function(_0x12dd67){ut['logger'](_0x5600('0x4e'),_0x12dd67);})[_0x5600('0x40')](function(_0x2ba85f){ut[_0x5600('0x49')](_0x5600('0x4f'),_0x2ba85f);})[_0x5600('0x50')](function(){delete _0x310c02[_0x5600('0x23')][_0x478a61];delete _0x310c02[_0x5600('0xf')][_0x478a61];});}else{ut[_0x5600('0x49')]('[Fax][Message][NoUpdate2]');delete this[_0x5600('0x23')][_0x478a61];delete this[_0x5600('0xf')][_0x478a61];}};Fax[_0x5600('0x1d')]['syncHangup']=function(_0x4f047a){var _0x34b4d2=this;if(this[_0x5600('0x23')][_0x4f047a[_0x5600('0x24')]]){if(this[_0x5600('0xf')][_0x4f047a[_0x5600('0x24')]]){this[_0x5600('0x23')][_0x4f047a['uniqueid']]['id']=this[_0x5600('0xf')][_0x4f047a[_0x5600('0x24')]]['id'];this['channels'][_0x4f047a[_0x5600('0x24')]]['name']=this[_0x5600('0xf')][_0x4f047a['uniqueid']][_0x5600('0x26')];}logger[_0x5600('0x27')](_0x4f047a['uniqueid'],this[_0x5600('0xf')][_0x4f047a['uniqueid']]?_0x5600('0x51'):'\x20hangup\x20faxRiceive\x20',JSON[_0x5600('0x3f')](this[_0x5600('0x23')][_0x4f047a[_0x5600('0x24')]]));if(this['actions'][_0x4f047a[_0x5600('0x24')]]){if(this['channels'][_0x4f047a['uniqueid']][_0x5600('0x52')]>0x0&&this[_0x5600('0x23')][_0x4f047a[_0x5600('0x24')]]['faxstatus']===_0x5600('0x53')){this['updateStatus'](_0x4f047a[_0x5600('0x24')],!![]);}else{this['updateStatus'](_0x4f047a['uniqueid'],![],this['channels'][_0x4f047a['uniqueid']][_0x5600('0x54')]?'SENDING\x20FAILED:\x20'+this[_0x5600('0x23')][_0x4f047a[_0x5600('0x24')]]['faxstatusstring']:_0x5600('0x55'));}}}};Fax[_0x5600('0x1d')][_0x5600('0x56')]=function(_0x59b301){var _0x215b33=this;return new BPromise(function(_0xca068e,_0x45770e){_0x215b33['execOriginate'](_0x59b301,_0x215b33[_0x5600('0xd')][_0x59b301['FaxAccountId']])['then'](function(_0x41e78c){ut[_0x5600('0x49')](_0x5600('0x57'),_0x41e78c);_0xca068e(ut[_0x5600('0x58')]('Fax\x20received'));})['catch'](function(_0x13b81c){ut[_0x5600('0x49')]('[Fax][execOriginate][failure]',_0x13b81c);updateStatus(_0x59b301);_0x45770e(ut['message'](_0x5600('0x59')));});});};Fax['prototype'][_0x5600('0x5a')]=function(_0x191d2e){var _0x561b29=this;return new BPromise(function(_0x5c93d2,_0x23e661){var _0x35f923=_0x561b29['checkTrunk'](_0x561b29[_0x5600('0xd')][_0x191d2e[_0x5600('0x5b')]][_0x5600('0x5c')],_0x191d2e);if(_0x35f923[_0x5600('0x5d')]){_0x5c93d2(ut[_0x5600('0x58')](_0x5600('0x5e')));}else{_0x23e661(ut[_0x5600('0x58')](_0x35f923[_0x5600('0x58')]));}});};function originate(_0x4808a0,_0x58fb0d,_0x36066c){return new BPromise(function(_0x4f4b18,_0x2c02e4){if(_0x36066c){var _0x2f2f47=util[_0x5600('0x5f')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x5600('0x39')](_0x4808a0['path'])['name'],_0x4808a0[_0x5600('0x4')]);gs[_0x5600('0x60')](_0x2f2f47)[_0x5600('0x48')](function(){_0x4808a0[_0x5600('0x4')]=util[_0x5600('0x5f')](_0x5600('0x61'),path[_0x5600('0x39')](_0x4808a0[_0x5600('0x4')])[_0x5600('0x62')],path[_0x5600('0x39')](_0x4808a0[_0x5600('0x4')])[_0x5600('0x26')]);_0x58fb0d[_0x5600('0x63')]=_0x4808a0['path'];ut[_0x5600('0x49')]('Convert\x20pdf\x20to\x20tif','');ami[_0x5600('0x64')](ut['variablesAction'](_0x4808a0,_0x58fb0d))[_0x5600('0x48')](function(_0xdadf35){_0x4f4b18(_0xdadf35);})[_0x5600('0x40')](function(_0x5df4ee){_0x2c02e4(_0x5df4ee);});})['catch'](function(_0x248c04){_0x2c02e4(_0x248c04);});}else{ami[_0x5600('0x64')](ut[_0x5600('0x65')](_0x4808a0,_0x58fb0d))[_0x5600('0x48')](function(_0x50b902){_0x4f4b18(_0x50b902);})[_0x5600('0x40')](function(_0x109939){_0x2c02e4(_0x109939);});}});}Fax['prototype'][_0x5600('0x66')]=function(_0x27b995,_0x2d1b33){var _0x6d5946=this;return new BPromise(function(_0x52ade1,_0x36d013){var _0x521d0f=uuid['v4']();var _0x1bb56a=ut['addVariables'](_0x27b995,_0x2d1b33);_0x6d5946['actions'][_0x521d0f]=new Action(_0x521d0f,_0x2d1b33,_0x27b995);var _0x4f06b3=_0x6d5946[_0x5600('0xf')][_0x521d0f];if(path[_0x5600('0x39')](_0x27b995[_0x5600('0x4')])[_0x5600('0x67')]===_0x5600('0x3c')){originate(_0x4f06b3,_0x1bb56a,!![])[_0x5600('0x48')](function(_0x51701d){_0x52ade1(_0x51701d);})['catch'](function(_0x1a74e2){_0x36d013(_0x1a74e2);});}else{originate(_0x4f06b3,_0x1bb56a,![])[_0x5600('0x48')](function(_0x4f36b2){_0x52ade1(_0x4f36b2);})['catch'](function(_0x274141){_0x36d013(_0x274141);});}});};Fax[_0x5600('0x1d')][_0x5600('0x68')]=function(_0x268f27){return!_['isNil'](_0x268f27)&&!_[_0x5600('0x69')](_0x268f27[_0x5600('0x26')])&&!_[_0x5600('0x69')](_0x268f27[_0x5600('0x6a')])&&_0x268f27[_0x5600('0x6a')]&&!_['isNil'](this['trunks'][util[_0x5600('0x5f')]('SIP/%s',_0x268f27[_0x5600('0x26')])])&&!_[_0x5600('0x69')](this[_0x5600('0xe')][util[_0x5600('0x5f')]('SIP/%s',_0x268f27[_0x5600('0x26')])][_0x5600('0x2f')])&&(this[_0x5600('0xe')][util[_0x5600('0x5f')]('SIP/%s',_0x268f27[_0x5600('0x26')])][_0x5600('0x2f')]===_0x5600('0x6b')||this['trunks'][util[_0x5600('0x5f')](_0x5600('0x6c'),_0x268f27[_0x5600('0x26')])][_0x5600('0x2f')]===_0x5600('0x6d'));};Fax[_0x5600('0x1d')][_0x5600('0x6e')]=function(_0x221221,_0x2be20a){if(!this[_0x5600('0x68')](_0x221221)){ut[_0x5600('0x49')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x5600('0x69')](_0x221221)?'':_0x221221[_0x5600('0x26')]+_0x5600('0x6f'));return{'isValid':![],'message':_0x5600('0x70')};}if(_[_0x5600('0x69')](_0x2be20a[_0x5600('0x5')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x5600('0x3f')](_0x2be20a));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x2be20a[_0x5600('0x4')])){ut[_0x5600('0x49')](_0x5600('0x71'),JSON[_0x5600('0x3f')](_0x2be20a));return{'isValid':![],'message':_0x5600('0x72')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file +var _0x2fb2=['resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','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','path','execute','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isNil','active','SIP/%s','reachable','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','exports','bluebird','uuid','moment','tiff2pdf','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','hasOwnProperty','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2fb2,0xc5));var _0x22fb=function(_0x513c39,_0x381800){_0x513c39=_0x513c39-0x0;var _0x24e141=_0x2fb2[_0x513c39];return _0x24e141;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x22fb('0x0'));var uuid=require(_0x22fb('0x1'));var moment=require(_0x22fb('0x2'));var path=require('path');var tiff2pdf=require(_0x22fb('0x3'));var gs=require('./util/gs');var logger=require(_0x22fb('0x4'))('fax');var ami=require(_0x22fb('0x5'));var rpcDb=require(_0x22fb('0x6'));var Channel=require(_0x22fb('0x7'));var ut=require(_0x22fb('0x8'));var Action=require(_0x22fb('0x9'));var faxAccount=require(_0x22fb('0xa'));var attachment=require(_0x22fb('0xb'));var faxMessage=require(_0x22fb('0xc'));function Fax(_0x450e38){this[_0x22fb('0xd')]={};this[_0x22fb('0xe')]=_0x450e38[_0x22fb('0xe')];this['trunks']=_0x450e38[_0x22fb('0xf')];this[_0x22fb('0x10')]={};ami['on']('newchannel',this[_0x22fb('0x11')][_0x22fb('0x12')](this));ami['on']('varset',this['syncVarSet'][_0x22fb('0x12')](this));ami['on']('newstate',this[_0x22fb('0x13')][_0x22fb('0x12')](this));ami['on'](_0x22fb('0x14'),this['syncNewExten'][_0x22fb('0x12')](this));ami['on'](_0x22fb('0x15'),this[_0x22fb('0x16')][_0x22fb('0x12')](this));ami['on'](_0x22fb('0x17'),this[_0x22fb('0x18')][_0x22fb('0x12')](this));ami['on'](_0x22fb('0x19'),this[_0x22fb('0x1a')][_0x22fb('0x12')](this));ami['on'](_0x22fb('0x1b'),this[_0x22fb('0x1c')][_0x22fb('0x12')](this));}Fax[_0x22fb('0x1d')]['syncNewchannel']=function(_0x1e6dd2){if(_0x1e6dd2[_0x22fb('0x1e')]===_0x22fb('0x1f')){for(var _0x29fa31 in this[_0x22fb('0xe')]){if(this[_0x22fb('0xe')]['hasOwnProperty'](_0x29fa31)){if(_0x1e6dd2[_0x22fb('0x20')]===this[_0x22fb('0xe')][_0x29fa31][_0x22fb('0x21')]){this[_0x22fb('0xd')][_0x1e6dd2[_0x22fb('0x22')]]={};this[_0x22fb('0xd')][_0x1e6dd2[_0x22fb('0x22')]]['channel']=_0x1e6dd2[_0x22fb('0x23')];this[_0x22fb('0xd')][_0x1e6dd2[_0x22fb('0x22')]]['id']=this[_0x22fb('0xe')][_0x29fa31]['id'];this[_0x22fb('0xd')][_0x1e6dd2[_0x22fb('0x22')]][_0x22fb('0x24')]=this['faxAccounts'][_0x29fa31][_0x22fb('0x24')];logger[_0x22fb('0x25')](_0x1e6dd2[_0x22fb('0x22')],_0x22fb('0x26'));}}}}if(this[_0x22fb('0x10')][_0x1e6dd2[_0x22fb('0x22')]]){this[_0x22fb('0xd')][_0x1e6dd2[_0x22fb('0x22')]]={};this[_0x22fb('0xd')][_0x1e6dd2[_0x22fb('0x22')]][_0x22fb('0x23')]=_0x1e6dd2[_0x22fb('0x23')];logger[_0x22fb('0x25')](_0x1e6dd2[_0x22fb('0x22')],_0x22fb('0x26'));}};Fax['prototype'][_0x22fb('0x27')]=function(_0x4d053d){if(this[_0x22fb('0xd')][_0x4d053d[_0x22fb('0x22')]]){for(var _0x38cafd in _0x4d053d[_0x22fb('0x28')]){if(_0x4d053d[_0x22fb('0x28')]['hasOwnProperty'](_0x38cafd)){this[_0x22fb('0xd')][_0x4d053d['uniqueid']][_0x38cafd]=_0x4d053d[_0x22fb('0x29')];}}}};Fax[_0x22fb('0x1d')][_0x22fb('0x13')]=function(_0x32ae9){if(this[_0x22fb('0xd')][_0x32ae9[_0x22fb('0x22')]]){this['channels'][_0x32ae9['uniqueid']][_0x22fb('0x2a')]=_0x32ae9[_0x22fb('0x2a')];this[_0x22fb('0xd')][_0x32ae9[_0x22fb('0x22')]][_0x22fb('0x2b')]=_0x32ae9['channelstatedesc'];}};Fax[_0x22fb('0x1d')]['syncNewExten']=function(_0x3201b8){if(this[_0x22fb('0xd')][_0x3201b8[_0x22fb('0x22')]]){for(var _0x57d124 in _0x3201b8[_0x22fb('0x28')]){if(_0x3201b8[_0x22fb('0x28')][_0x22fb('0x2c')](_0x57d124)){this[_0x22fb('0xd')][_0x3201b8[_0x22fb('0x22')]][_0x57d124]=_0x3201b8[_0x22fb('0x29')];}}}};Fax[_0x22fb('0x1d')][_0x22fb('0x16')]=function(_0x1d2e8f){if(this[_0x22fb('0xd')][_0x1d2e8f[_0x22fb('0x22')]]){this[_0x22fb('0xd')][_0x1d2e8f['uniqueid']][_0x22fb('0x2d')]=_0x1d2e8f[_0x22fb('0x2d')];this[_0x22fb('0xd')][_0x1d2e8f[_0x22fb('0x22')]]['status']=_0x1d2e8f[_0x22fb('0x2e')];this[_0x22fb('0xd')][_0x1d2e8f[_0x22fb('0x22')]][_0x22fb('0x21')]=_0x1d2e8f['localstationid'];this[_0x22fb('0xd')][_0x1d2e8f['uniqueid']][_0x22fb('0x2f')]=_0x1d2e8f['filename'];logger[_0x22fb('0x25')](_0x1d2e8f['uniqueid'],_0x22fb('0x30'));}};Fax[_0x22fb('0x1d')][_0x22fb('0x18')]=function(_0x1609a7){var _0x195f62=this;if(this['channels'][_0x1609a7['uniqueid']]){var _0x4012bf=this[_0x22fb('0xd')][_0x1609a7['uniqueid']]['id'];this[_0x22fb('0xd')][_0x1609a7['uniqueid']][_0x22fb('0x31')]=_0x1609a7['remotestationid'];this[_0x22fb('0xd')][_0x1609a7[_0x22fb('0x22')]][_0x22fb('0x32')]=_0x1609a7[_0x22fb('0x32')];this[_0x22fb('0xd')][_0x1609a7[_0x22fb('0x22')]]['localstationid']=_0x1609a7[_0x22fb('0x21')];this['channels'][_0x1609a7[_0x22fb('0x22')]]['resolution']=_0x1609a7[_0x22fb('0x33')];this['channels'][_0x1609a7[_0x22fb('0x22')]][_0x22fb('0x34')]=_0x1609a7[_0x22fb('0x34')];this[_0x22fb('0xd')][_0x1609a7[_0x22fb('0x22')]][_0x22fb('0x2f')]=_0x1609a7[_0x22fb('0x2f')];this[_0x22fb('0xd')][_0x1609a7['uniqueid']]['calleridnum']=_0x1609a7[_0x22fb('0x35')];if(this['channels'][_0x1609a7['uniqueid']][_0x22fb('0x32')]>0x0){tiff2pdf(_0x1609a7[_0x22fb('0x2f')],_0x22fb('0x36'),function(_0x3ea4d3){logger['info'](_0x1609a7[_0x22fb('0x22')],_0x22fb('0x37'),_0x3ea4d3[_0x22fb('0x38')]);attachment[_0x22fb('0x39')]({'name':path[_0x22fb('0x3a')](_0x1609a7[_0x22fb('0x2f')])['name'],'basename':path[_0x22fb('0x3a')](_0x1609a7[_0x22fb('0x2f')])[_0x22fb('0x24')]+_0x22fb('0x3b'),'type':_0x22fb('0x3c')})[_0x22fb('0x3d')](function(_0x2f91fb){faxAccount[_0x22fb('0x3e')](_0x4012bf,{'from':_0x1609a7[_0x22fb('0x35')],'mapKey':_0x22fb('0x3f'),'body':path['parse'](_0x1609a7[_0x22fb('0x2f')])[_0x22fb('0x24')]+_0x22fb('0x3b'),'AttachmentId':_0x2f91fb['id']})[_0x22fb('0x40')](function(_0x38245a){logger[_0x22fb('0x41')](_0x1609a7[_0x22fb('0x22')],_0x22fb('0x42'),JSON[_0x22fb('0x43')](_0x38245a));});})[_0x22fb('0x40')](function(_0x5caa97){logger['error'](_0x1609a7[_0x22fb('0x22')],_0x22fb('0x44'),JSON[_0x22fb('0x43')](_0x5caa97));});});}logger[_0x22fb('0x25')](_0x1609a7[_0x22fb('0x22')],_0x22fb('0x44'));}};Fax[_0x22fb('0x1d')][_0x22fb('0x1c')]=function(_0x1dcd11){if(this['actions'][_0x1dcd11[_0x22fb('0x22')]]){_[_0x22fb('0x45')](this[_0x22fb('0xd')][_0x1dcd11[_0x22fb('0x22')]],_[_0x22fb('0x46')](_0x1dcd11,[_0x22fb('0x47'),_0x22fb('0x48')]));}};function updateStatus(_0x310bb0){if(_0x310bb0[_0x22fb('0x49')]){faxMessage[_0x22fb('0x4a')](_0x310bb0[_0x22fb('0x49')],{'failMessage':_0x22fb('0x4b')})[_0x22fb('0x3d')](function(_0x3911c6){ut[_0x22fb('0x4c')](_0x22fb('0x4d'),_0x3911c6);})[_0x22fb('0x40')](function(_0x2d2654){ut[_0x22fb('0x4c')](_0x22fb('0x4e'),_0x2d2654);});}else{ut[_0x22fb('0x4c')](_0x22fb('0x4f'));}}Fax[_0x22fb('0x1d')][_0x22fb('0x50')]=function(_0x47c185,_0x5e9903,_0x3773db){var _0x56bb4c=this;var _0x14ce8e={};if(_0x5e9903){_0x14ce8e={'read':_0x5e9903};}else{_0x14ce8e={'failMessage':_0x3773db};}if(this[_0x22fb('0x10')][_0x47c185]['AttachmentId']){faxMessage[_0x22fb('0x4a')](this['actions'][_0x47c185][_0x22fb('0x49')],_0x14ce8e)['then'](function(_0x5d6f62){ut[_0x22fb('0x4c')](_0x22fb('0x51'),_0x5d6f62);})['catch'](function(_0x46827f){ut[_0x22fb('0x4c')](_0x22fb('0x52'),_0x46827f);})['finally'](function(){delete _0x56bb4c[_0x22fb('0xd')][_0x47c185];delete _0x56bb4c['actions'][_0x47c185];});}else{ut[_0x22fb('0x4c')](_0x22fb('0x53'));delete this[_0x22fb('0xd')][_0x47c185];delete this[_0x22fb('0x10')][_0x47c185];}};Fax['prototype'][_0x22fb('0x1a')]=function(_0x583894){var _0x635435=this;if(this['channels'][_0x583894[_0x22fb('0x22')]]){if(this[_0x22fb('0x10')][_0x583894[_0x22fb('0x22')]]){this['channels'][_0x583894[_0x22fb('0x22')]]['id']=this[_0x22fb('0x10')][_0x583894[_0x22fb('0x22')]]['id'];this[_0x22fb('0xd')][_0x583894['uniqueid']][_0x22fb('0x24')]=this[_0x22fb('0x10')][_0x583894[_0x22fb('0x22')]]['name'];}logger[_0x22fb('0x25')](_0x583894[_0x22fb('0x22')],this[_0x22fb('0x10')][_0x583894[_0x22fb('0x22')]]?_0x22fb('0x54'):_0x22fb('0x55'),JSON[_0x22fb('0x43')](this[_0x22fb('0xd')][_0x583894[_0x22fb('0x22')]]));if(this[_0x22fb('0x10')][_0x583894[_0x22fb('0x22')]]){if(this[_0x22fb('0xd')][_0x583894[_0x22fb('0x22')]][_0x22fb('0x56')]>0x0&&this[_0x22fb('0xd')][_0x583894[_0x22fb('0x22')]][_0x22fb('0x15')]==='SUCCESS'){this[_0x22fb('0x50')](_0x583894[_0x22fb('0x22')],!![]);}else{this['updateStatus'](_0x583894[_0x22fb('0x22')],![],this['channels'][_0x583894[_0x22fb('0x22')]][_0x22fb('0x57')]?_0x22fb('0x58')+this[_0x22fb('0xd')][_0x583894['uniqueid']][_0x22fb('0x57')]:_0x22fb('0x59'));}}}};Fax['prototype'][_0x22fb('0x5a')]=function(_0x1035c1){var _0x12cae7=this;return new BPromise(function(_0x1e9db8,_0x270049){_0x12cae7['execOriginate'](_0x1035c1,_0x12cae7[_0x22fb('0xe')][_0x1035c1[_0x22fb('0x5b')]])[_0x22fb('0x3d')](function(_0x140243){ut[_0x22fb('0x4c')](_0x22fb('0x5c'),_0x140243);_0x1e9db8(ut[_0x22fb('0x38')](_0x22fb('0x5d')));})[_0x22fb('0x40')](function(_0x2c4bb0){ut[_0x22fb('0x4c')](_0x22fb('0x5e'),_0x2c4bb0);updateStatus(_0x1035c1);_0x270049(ut[_0x22fb('0x38')](_0x22fb('0x5f')));});});};Fax['prototype'][_0x22fb('0x60')]=function(_0x4c0588){var _0x535687=this;return new BPromise(function(_0x47792f,_0x41f9a6){var _0x3e2938=_0x535687[_0x22fb('0x61')](_0x535687[_0x22fb('0xe')][_0x4c0588[_0x22fb('0x5b')]][_0x22fb('0x62')],_0x4c0588);if(_0x3e2938[_0x22fb('0x63')]){_0x47792f(ut[_0x22fb('0x38')](_0x22fb('0x64')));}else{_0x41f9a6(ut['message'](_0x3e2938[_0x22fb('0x38')]));}});};function originate(_0x37df41,_0x142fca,_0xe43c4a){return new BPromise(function(_0x320161,_0x5537c2){if(_0xe43c4a){var _0x3dadf1=util[_0x22fb('0x65')](_0x22fb('0x66'),path[_0x22fb('0x3a')](_0x37df41[_0x22fb('0x67')])['name'],_0x37df41['path']);gs[_0x22fb('0x68')](_0x3dadf1)[_0x22fb('0x3d')](function(){_0x37df41[_0x22fb('0x67')]=util[_0x22fb('0x65')]('%s/%s.tif',path[_0x22fb('0x3a')](_0x37df41[_0x22fb('0x67')])[_0x22fb('0x69')],path[_0x22fb('0x3a')](_0x37df41[_0x22fb('0x67')])[_0x22fb('0x24')]);_0x142fca['XMF-PATH']=_0x37df41[_0x22fb('0x67')];ut[_0x22fb('0x4c')](_0x22fb('0x6a'),'');ami[_0x22fb('0x6b')](ut[_0x22fb('0x6c')](_0x37df41,_0x142fca))[_0x22fb('0x3d')](function(_0x349eff){_0x320161(_0x349eff);})[_0x22fb('0x40')](function(_0x5de212){_0x5537c2(_0x5de212);});})[_0x22fb('0x40')](function(_0x15aa27){_0x5537c2(_0x15aa27);});}else{ami['Action'](ut[_0x22fb('0x6c')](_0x37df41,_0x142fca))['then'](function(_0x234836){_0x320161(_0x234836);})['catch'](function(_0x483825){_0x5537c2(_0x483825);});}});}Fax[_0x22fb('0x1d')][_0x22fb('0x6d')]=function(_0x2189e5,_0x12557a){var _0x5f3d6a=this;return new BPromise(function(_0x5a3896,_0x318b80){var _0x101dd8=uuid['v4']();var _0xb664ac=ut[_0x22fb('0x6e')](_0x2189e5,_0x12557a);_0x5f3d6a[_0x22fb('0x10')][_0x101dd8]=new Action(_0x101dd8,_0x12557a,_0x2189e5);var _0x51fed3=_0x5f3d6a['actions'][_0x101dd8];if(path[_0x22fb('0x3a')](_0x2189e5[_0x22fb('0x67')])[_0x22fb('0x6f')]===_0x22fb('0x3b')){originate(_0x51fed3,_0xb664ac,!![])[_0x22fb('0x3d')](function(_0x45e1a2){_0x5a3896(_0x45e1a2);})[_0x22fb('0x40')](function(_0x45b4b0){_0x318b80(_0x45b4b0);});}else{originate(_0x51fed3,_0xb664ac,![])['then'](function(_0x3668f2){_0x5a3896(_0x3668f2);})['catch'](function(_0x4c8c32){_0x318b80(_0x4c8c32);});}});};Fax['prototype']['isTrunkReachable']=function(_0x3e6b49){return!_[_0x22fb('0x70')](_0x3e6b49)&&!_['isNil'](_0x3e6b49['name'])&&!_[_0x22fb('0x70')](_0x3e6b49[_0x22fb('0x71')])&&_0x3e6b49[_0x22fb('0x71')]&&!_['isNil'](this[_0x22fb('0xf')][util[_0x22fb('0x65')](_0x22fb('0x72'),_0x3e6b49[_0x22fb('0x24')])])&&!_[_0x22fb('0x70')](this[_0x22fb('0xf')][util[_0x22fb('0x65')](_0x22fb('0x72'),_0x3e6b49['name'])][_0x22fb('0x2e')])&&(this[_0x22fb('0xf')][util['format'](_0x22fb('0x72'),_0x3e6b49[_0x22fb('0x24')])][_0x22fb('0x2e')]===_0x22fb('0x73')||this['trunks'][util[_0x22fb('0x65')](_0x22fb('0x72'),_0x3e6b49[_0x22fb('0x24')])][_0x22fb('0x2e')]==='unmonitored');};Fax[_0x22fb('0x1d')]['checkTrunk']=function(_0x33b8f9,_0x5c4829){if(!this[_0x22fb('0x74')](_0x33b8f9)){ut[_0x22fb('0x4c')](_0x22fb('0x75'),_['isNil'](_0x33b8f9)?'':_0x33b8f9['name']+_0x22fb('0x76'));return{'isValid':![],'message':_0x22fb('0x77')};}if(_[_0x22fb('0x70')](_0x5c4829['fax'])){ut[_0x22fb('0x4c')](_0x22fb('0x78'),JSON[_0x22fb('0x43')](_0x5c4829));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x22fb('0x70')](_0x5c4829['path'])){ut[_0x22fb('0x4c')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x5c4829));return{'isValid':![],'message':_0x22fb('0x79')};}return{'isValid':!![],'message':_0x22fb('0x7a')};};module[_0x22fb('0x7b')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index f0a6a15..753a552 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 _0xe897=['lodash','error','inspect','notify','resolve','then','[Notify]\x20','bluebird','../../../config/logger'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xe897,0xdf));var _0x7e89=function(_0x2a94d8,_0x47d4fe){_0x2a94d8=_0x2a94d8-0x0;var _0xe1f74d=_0xe897[_0x2a94d8];return _0xe1f74d;};'use strict';var util=require('util');var BPromise=require(_0x7e89('0x0'));var logger=require(_0x7e89('0x1'))('preview');var _=require(_0x7e89('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x23ee2f){return function(_0x43ce7c){logger[_0x7e89('0x3')](_0x23ee2f,util[_0x7e89('0x4')](_0x43ce7c,{'showHidden':![],'depth':null}));};}exports[_0x7e89('0x5')]=function(_0x18536e,_0x2cfe6f){return BPromise[_0x7e89('0x6')]()[_0x7e89('0x7')](faxAccount[_0x7e89('0x5')](_0x18536e,_0x2cfe6f))['catch'](loggerCatch(_0x7e89('0x8')));}; \ No newline at end of file +var _0x3068=['notify','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','inspect'];(function(_0x3d6811,_0x111fcd){var _0x4e9325=function(_0x51580f){while(--_0x51580f){_0x3d6811['push'](_0x3d6811['shift']());}};_0x4e9325(++_0x111fcd);}(_0x3068,0xd5));var _0x8306=function(_0x3d48c6,_0x3ca23b){_0x3d48c6=_0x3d48c6-0x0;var _0x1cd3c5=_0x3068[_0x3d48c6];return _0x1cd3c5;};'use strict';var util=require(_0x8306('0x0'));var BPromise=require(_0x8306('0x1'));var logger=require(_0x8306('0x2'))(_0x8306('0x3'));var _=require(_0x8306('0x4'));var faxAccount=require(_0x8306('0x5'));function loggerCatch(_0x58c4e5){return function(_0x322d85){logger['error'](_0x58c4e5,util[_0x8306('0x6')](_0x322d85,{'showHidden':![],'depth':null}));};}exports[_0x8306('0x7')]=function(_0x511715,_0x42a66c){return BPromise['resolve']()['then'](faxAccount[_0x8306('0x7')](_0x511715,_0x42a66c))[_0x8306('0x8')](loggerCatch(_0x8306('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 9901118..584d48f 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 _0x5a9c=['info','Exec\x20gs','inspect','util','../../../../config/logger','bluebird','child_process','exec'];(function(_0xd299c3,_0x4ba0f1){var _0x376574=function(_0xc585f){while(--_0xc585f){_0xd299c3['push'](_0xd299c3['shift']());}};_0x376574(++_0x4ba0f1);}(_0x5a9c,0x14b));var _0xc5a9=function(_0x1a1b16,_0x11f086){_0x1a1b16=_0x1a1b16-0x0;var _0x5586bf=_0x5a9c[_0x1a1b16];return _0x5586bf;};'use strict';var util=require(_0xc5a9('0x0'));var logger=require(_0xc5a9('0x1'))('fax');var BPromise=require(_0xc5a9('0x2'));var exec=require(_0xc5a9('0x3'))[_0xc5a9('0x4')];exports['execute']=function(_0xaa0e17){return new BPromise(function(_0x489f56,_0x231ecc){exec(_0xaa0e17,function(_0x12b833,_0x1c194c,_0x3a531f){logger[_0xc5a9('0x5')]('Exec\x20gs',_0x1c194c);if(_0x12b833){logger[_0xc5a9('0x5')](_0xc5a9('0x6'),'\x20Error\x20:',util[_0xc5a9('0x7')](_0x12b833,{'showHidden':![],'depth':null}),_0x1c194c,_0x3a531f);_0x231ecc(_0x12b833);}_0x489f56(_0x1c194c);});});}; \ No newline at end of file +var _0x7859=['inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute','Exec\x20gs','info'];(function(_0x3e284d,_0x42c938){var _0x278746=function(_0xde3859){while(--_0xde3859){_0x3e284d['push'](_0x3e284d['shift']());}};_0x278746(++_0x42c938);}(_0x7859,0x83));var _0x9785=function(_0x46dba8,_0x15f02e){_0x46dba8=_0x46dba8-0x0;var _0x35614e=_0x7859[_0x46dba8];return _0x35614e;};'use strict';var util=require(_0x9785('0x0'));var logger=require(_0x9785('0x1'))(_0x9785('0x2'));var BPromise=require(_0x9785('0x3'));var exec=require(_0x9785('0x4'))[_0x9785('0x5')];exports[_0x9785('0x6')]=function(_0x3df42e){return new BPromise(function(_0x4b1fc2,_0x5cf5bb){exec(_0x3df42e,function(_0x2d1f41,_0x7fc525,_0x51a1ae){logger['info'](_0x9785('0x7'),_0x7fc525);if(_0x2d1f41){logger[_0x9785('0x8')](_0x9785('0x7'),'\x20Error\x20:',util[_0x9785('0x9')](_0x2d1f41,{'showHidden':![],'depth':null}),_0x7fc525,_0x51a1ae);_0x5cf5bb(_0x2d1f41);}_0x4b1fc2(_0x7fc525);});});}; \ 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 12c5985..2cb21f3 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 _0x6840=['gateway','faxdetect','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','util','lodash','../../../../config/logger','message','logger','info','inspect','addVariables','headerinfo','minrate','format','modem'];(function(_0x44d75f,_0x5a62f2){var _0x55ffd2=function(_0x24f27b){while(--_0x24f27b){_0x44d75f['push'](_0x44d75f['shift']());}};_0x55ffd2(++_0x5a62f2);}(_0x6840,0x9c));var _0x0684=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x6840[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0x0684('0x0'));var _=require(_0x0684('0x1'));var moment=require('moment');var logger=require(_0x0684('0x2'))('fax');exports[_0x0684('0x3')]=function(_0x183793){return{'message':_0x183793};};exports[_0x0684('0x4')]=function(_0x49d512,_0x2a837b){logger[_0x0684('0x5')](_0x49d512,util[_0x0684('0x6')](_0x2a837b,{'showHidden':![],'depth':null}));};exports[_0x0684('0x7')]=function(_0xec0039,_0x3da415){var _0xe763cb={'XMF-ECM':_0x3da415['ecm'],'XMF-HEADERINFO':_0x3da415[_0x0684('0x8')],'XMF-MINRATE':_0x3da415[_0x0684('0x9')],'XMF-MAXRATE':_0x3da415['maxrate'],'XMF-MODEM':util[_0x0684('0xa')]('\x22%s\x22',_0x3da415[_0x0684('0xb')]),'XMF-GATEWAY':_0x3da415[_0x0684('0xc')],'XMF-FAXDETECT':_0x3da415[_0x0684('0xd')],'XMF-T38TIMEOUT':_0x3da415['t38timeout'],'XMF-LOCALSTATIONID':_0x3da415[_0x0684('0xe')],'XMF-PATH':_0xec0039[_0x0684('0xf')]};return _0xe763cb;};exports[_0x0684('0x10')]=function(_0x578a75,_0x161f47){return{'actionid':_0x578a75[_0x0684('0x11')],'action':_0x0684('0x12'),'channel':_0x578a75[_0x0684('0x13')],'Exten':_0x0684('0x14'),'Context':'from-sip','Priority':'1','callerid':util[_0x0684('0xa')]('\x22%s\x22\x20<%s>',_0x578a75[_0x0684('0x8')]?_0x578a75[_0x0684('0x8')]:'',_0x578a75['localstationid']),'variable':_0x161f47,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x578a75['uniqueid']};}; \ No newline at end of file +var _0x842f=['uniqueid','originate','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','../../../../config/logger','fax','message','logger','inspect','addVariables','ecm','minrate','format','\x22%s\x22','modem','gateway','t38timeout','localstationid','path','variablesAction'];(function(_0xa66be4,_0x1b2845){var _0x199af6=function(_0x116479){while(--_0x116479){_0xa66be4['push'](_0xa66be4['shift']());}};_0x199af6(++_0x1b2845);}(_0x842f,0x12f));var _0xf842=function(_0x4c6bca,_0x3de390){_0x4c6bca=_0x4c6bca-0x0;var _0x29d58e=_0x842f[_0x4c6bca];return _0x29d58e;};'use strict';var util=require(_0xf842('0x0'));var _=require(_0xf842('0x1'));var moment=require(_0xf842('0x2'));var logger=require(_0xf842('0x3'))(_0xf842('0x4'));exports[_0xf842('0x5')]=function(_0x11a9c3){return{'message':_0x11a9c3};};exports[_0xf842('0x6')]=function(_0x37cfa0,_0x41449d){logger['info'](_0x37cfa0,util[_0xf842('0x7')](_0x41449d,{'showHidden':![],'depth':null}));};exports[_0xf842('0x8')]=function(_0x17580c,_0x2568b1){var _0x11a36c={'XMF-ECM':_0x2568b1[_0xf842('0x9')],'XMF-HEADERINFO':_0x2568b1['headerinfo'],'XMF-MINRATE':_0x2568b1[_0xf842('0xa')],'XMF-MAXRATE':_0x2568b1['maxrate'],'XMF-MODEM':util[_0xf842('0xb')](_0xf842('0xc'),_0x2568b1[_0xf842('0xd')]),'XMF-GATEWAY':_0x2568b1[_0xf842('0xe')],'XMF-FAXDETECT':_0x2568b1['faxdetect'],'XMF-T38TIMEOUT':_0x2568b1[_0xf842('0xf')],'XMF-LOCALSTATIONID':_0x2568b1[_0xf842('0x10')],'XMF-PATH':_0x17580c[_0xf842('0x11')]};return _0x11a36c;};exports[_0xf842('0x12')]=function(_0x3cb133,_0x5f153e){return{'actionid':_0x3cb133[_0xf842('0x13')],'action':_0xf842('0x14'),'channel':_0x3cb133['channel'],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util['format'](_0xf842('0x15'),_0x3cb133[_0xf842('0x16')]?_0x3cb133[_0xf842('0x16')]:'',_0x3cb133[_0xf842('0x10')]),'variable':_0x5f153e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3cb133[_0xf842('0x13')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 44d331f..bdb60ea 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 _0xc060=['initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','moment','./server','./realtime','./report','./acw','./dialer','./preview','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','hour','get','resolve','then','getAgents'];(function(_0x3b4626,_0x14d17b){var _0x404a2e=function(_0x1d0e4f){while(--_0x1d0e4f){_0x3b4626['push'](_0x3b4626['shift']());}};_0x404a2e(++_0x14d17b);}(_0xc060,0x1bb));var _0x0c06=function(_0x25115d,_0x17417b){_0x25115d=_0x25115d-0x0;var _0x359867=_0xc060[_0x25115d];return _0x359867;};'use strict';var BPromise=require(_0x0c06('0x0'));var util=require('util');var moment=require(_0x0c06('0x1'));var server=require(_0x0c06('0x2'));var Realtime=require(_0x0c06('0x3'));var Report=require(_0x0c06('0x4'));var Acw=require(_0x0c06('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x0c06('0x6'));var Preview=require(_0x0c06('0x7'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require(_0x0c06('0x8'));var voiceQueueReport=require(_0x0c06('0x9'));var voiceCallReport=require(_0x0c06('0xa'));var trunk=require(_0x0c06('0xb'));var trigger=require(_0x0c06('0xc'));var template=require(_0x0c06('0xd'));var cmHopperHistory=require(_0x0c06('0xe'));var campaign=require(_0x0c06('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x0c06('0x10'));var zendesk=require(_0x0c06('0x11'));var salesforce=require(_0x0c06('0x12'));var sugarcrm=require(_0x0c06('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x0c06('0x14'));var zoho=require(_0x0c06('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x0c06('0x16'));var servicenow=require(_0x0c06('0x17'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x0c06('0x18'))(_0x0c06('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x0c06('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0c06('0x1b')](_0x0c06('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0c06('0x1c')]()[_0x0c06('0x1d')](user[_0x0c06('0x1e')]())['then'](realtime[_0x0c06('0x1f')]())[_0x0c06('0x1d')](user[_0x0c06('0x20')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x21')]())['then'](trunk[_0x0c06('0x22')]())['then'](realtime[_0x0c06('0x23')]())[_0x0c06('0x1d')](voiceQueue[_0x0c06('0x24')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x25')]())[_0x0c06('0x1d')](trigger[_0x0c06('0x26')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x27')]())[_0x0c06('0x1d')](template[_0x0c06('0x28')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x29')]())[_0x0c06('0x1d')](zendesk[_0x0c06('0x2a')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x2b')]())[_0x0c06('0x1d')](salesforce[_0x0c06('0x2c')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x2d')]())[_0x0c06('0x1d')](sugarcrm[_0x0c06('0x2e')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x2f')]())[_0x0c06('0x1d')](freshdesk[_0x0c06('0x30')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x31')]())['then'](desk[_0x0c06('0x32')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x33')]())[_0x0c06('0x1d')](zoho[_0x0c06('0x34')]())['then'](realtime[_0x0c06('0x35')]())[_0x0c06('0x1d')](vtiger[_0x0c06('0x36')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x37')]())['then'](freshsales[_0x0c06('0x38')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x39')]())[_0x0c06('0x1d')](servicenow['getServicenowAccounts']())[_0x0c06('0x1d')](realtime[_0x0c06('0x3a')]())[_0x0c06('0x1d')](dynamics365[_0x0c06('0x3b')]())['then'](realtime['initDynamics365Accounts']())[_0x0c06('0x1d')](campaign[_0x0c06('0x3c')]())[_0x0c06('0x1d')](realtime[_0x0c06('0x3d')]())[_0x0c06('0x1d')](voiceExtension['getVoiceExtensions']())[_0x0c06('0x1d')](realtime[_0x0c06('0x3e')]())['then'](faxAccount[_0x0c06('0x3f')]())['then'](realtime[_0x0c06('0x40')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x0c06('0x1c')]()[_0x0c06('0x1d')](voiceQueueReport[_0x0c06('0x41')]())['then'](realtime[_0x0c06('0x42')]())[_0x0c06('0x1d')](cmHopperHistory[_0x0c06('0x43')]())[_0x0c06('0x1d')](realtime['initVoiceQueueHopperHistory']())[_0x0c06('0x1d')](cmHopperHistory[_0x0c06('0x44')]())['then'](realtime[_0x0c06('0x45')]())[_0x0c06('0x1d')](voiceCallReport[_0x0c06('0x46')]())['then'](realtime[_0x0c06('0x47')]())[_0x0c06('0x48')](function(_0x333095){logger[_0x0c06('0x49')](_0x0c06('0x4a'),util[_0x0c06('0x4b')](_0x333095,{'showHidden':![],'depth':null}));});}function main(){return server[_0x0c06('0x4c')](realtime,preview,fax)[_0x0c06('0x1d')](function(_0x1d4a2f){return initRealtime();})[_0x0c06('0x1d')](function(){return initParams();})[_0x0c06('0x1d')](function(){report[_0x0c06('0x4d')]();setInterval(initRealtime,0x1388);})[_0x0c06('0x48')](function(_0x303ed3){logger[_0x0c06('0x49')](_0x0c06('0x4e'),util[_0x0c06('0x4b')](_0x303ed3,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x8c6f=['./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','ami','get','hour','resolve','getAgents','then','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','inspect','sync','[index.js][main]','bluebird','util','moment','./acw','./trigger','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension'];(function(_0x117f87,_0x4a1be5){var _0x3b46ad=function(_0x36e7e0){while(--_0x36e7e0){_0x117f87['push'](_0x117f87['shift']());}};_0x3b46ad(++_0x4a1be5);}(_0x8c6f,0x101));var _0xf8c6=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x8c6f[_0x1cc8fe];return _0x230054;};'use strict';var BPromise=require(_0xf8c6('0x0'));var util=require(_0xf8c6('0x1'));var moment=require(_0xf8c6('0x2'));var server=require('./server');var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0xf8c6('0x3'));var Trigger=require(_0xf8c6('0x4'));var Dialer=require('./dialer');var Preview=require(_0xf8c6('0x5'));var Fax=require('./fax');var user=require(_0xf8c6('0x6'));var voiceQueue=require(_0xf8c6('0x7'));var voiceQueueReport=require(_0xf8c6('0x8'));var voiceCallReport=require(_0xf8c6('0x9'));var trunk=require('./rpc/trunk');var trigger=require(_0xf8c6('0xa'));var template=require(_0xf8c6('0xb'));var cmHopperHistory=require(_0xf8c6('0xc'));var campaign=require(_0xf8c6('0xd'));var voiceExtension=require(_0xf8c6('0xe'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xf8c6('0xf'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xf8c6('0x10'));var freshdesk=require(_0xf8c6('0x11'));var desk=require(_0xf8c6('0x12'));var zoho=require(_0xf8c6('0x13'));var vtiger=require(_0xf8c6('0x14'));var freshsales=require(_0xf8c6('0x15'));var servicenow=require(_0xf8c6('0x16'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0xf8c6('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xf8c6('0x18')](_0xf8c6('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xf8c6('0x18')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xf8c6('0x1a')]()['then'](user[_0xf8c6('0x1b')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x1d')]())[_0xf8c6('0x1c')](user[_0xf8c6('0x1e')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x1f')]())['then'](trunk['getTrunks']())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x20')]())[_0xf8c6('0x1c')](voiceQueue[_0xf8c6('0x21')]())[_0xf8c6('0x1c')](realtime['initVoiceQueues']())[_0xf8c6('0x1c')](trigger['getTriggers']())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x22')]())['then'](template[_0xf8c6('0x23')]())[_0xf8c6('0x1c')](realtime['initTemplates']())[_0xf8c6('0x1c')](zendesk[_0xf8c6('0x24')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x25')]())[_0xf8c6('0x1c')](salesforce[_0xf8c6('0x26')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x27')]())[_0xf8c6('0x1c')](sugarcrm['getSugarcrmAccounts']())['then'](realtime[_0xf8c6('0x28')]())['then'](freshdesk[_0xf8c6('0x29')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x2a')]())[_0xf8c6('0x1c')](desk[_0xf8c6('0x2b')]())['then'](realtime[_0xf8c6('0x2c')]())[_0xf8c6('0x1c')](zoho[_0xf8c6('0x2d')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x2e')]())[_0xf8c6('0x1c')](vtiger['getVtigerAccounts']())['then'](realtime['initVtigerAccounts']())[_0xf8c6('0x1c')](freshsales[_0xf8c6('0x2f')]())['then'](realtime['initFreshsalesAccounts']())['then'](servicenow[_0xf8c6('0x30')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x31')]())[_0xf8c6('0x1c')](dynamics365[_0xf8c6('0x32')]())[_0xf8c6('0x1c')](realtime['initDynamics365Accounts']())[_0xf8c6('0x1c')](campaign[_0xf8c6('0x33')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x34')]())[_0xf8c6('0x1c')](voiceExtension['getVoiceExtensions']())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x35')]())[_0xf8c6('0x1c')](faxAccount[_0xf8c6('0x36')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x37')]())[_0xf8c6('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0xf8c6('0x1a')]()[_0xf8c6('0x1c')](voiceQueueReport[_0xf8c6('0x38')]())['then'](realtime[_0xf8c6('0x39')]())[_0xf8c6('0x1c')](cmHopperHistory[_0xf8c6('0x3a')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x3b')]())[_0xf8c6('0x1c')](cmHopperHistory[_0xf8c6('0x3c')]())['then'](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0xf8c6('0x3d')]())[_0xf8c6('0x1c')](realtime['initVoiceCallReports']())[_0xf8c6('0x3e')](function(_0x4bdef5){logger[_0xf8c6('0x3f')](_0xf8c6('0x40'),util[_0xf8c6('0x41')](_0x4bdef5,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xf8c6('0x1c')](function(_0x558898){return initRealtime();})['then'](function(){return initParams();})[_0xf8c6('0x1c')](function(){report[_0xf8c6('0x42')]();setInterval(initRealtime,0x1388);})[_0xf8c6('0x3e')](function(_0x3d69bb){logger['error'](_0xf8c6('0x43'),util[_0xf8c6('0x41')](_0x3d69bb,{'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 6e090de..4b3ca3d 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(_0x386081,_0x490292){var _0x26a92c=function(_0x58f5f3){while(--_0x58f5f3){_0x386081['push'](_0x386081['shift']());}};_0x26a92c(++_0x490292);}(_0xe706,0xa3));var _0x6e70=function(_0x5ee3d3,_0x537c30){_0x5ee3d3=_0x5ee3d3-0x0;var _0x4b272f=_0xe706[_0x5ee3d3];return _0x4b272f;};'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 _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0x39cff5,_0x234f0c){var _0x430437=function(_0xb2375){while(--_0xb2375){_0x39cff5['push'](_0x39cff5['shift']());}};_0x430437(++_0x234f0c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 3c2b3fd..42acd7d 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 _0x454b=['dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x5130bb,_0x38f6c6){var _0x2a1b2b=function(_0x37d626){while(--_0x37d626){_0x5130bb['push'](_0x5130bb['shift']());}};_0x2a1b2b(++_0x38f6c6);}(_0x454b,0x19b));var _0xb454=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x454b[_0x4bf96c];return _0x281d09;};'use strict';function Campaign(_0x435c3a){this['id']=_0x435c3a['id']||0x0;this[_0xb454('0x0')]=_0x435c3a['name']||'';this['type']=_0x435c3a[_0xb454('0x1')]||_0xb454('0x2');this[_0xb454('0x3')]=0x0;this[_0xb454('0x4')]=0x0;this[_0xb454('0x5')]=0x0;this[_0xb454('0x6')]=0x0;this[_0xb454('0x7')]='';this[_0xb454('0x8')]=!![];this[_0xb454('0x9')]=_0x435c3a[_0xb454('0x9')];this[_0xb454('0xa')]=_0x435c3a['limitCalls'];this['dialTimezone']=_0x435c3a[_0xb454('0xb')]||null;this[_0xb454('0xc')]=_0x435c3a[_0xb454('0xc')]?_0x435c3a[_0xb454('0xc')]:null;this[_0xb454('0xd')]=_0x435c3a['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x435c3a['dialOriginateCallerIdNumber'];this[_0xb454('0xe')]=_0x435c3a['dialOriginateTimeout']||0x1e;this[_0xb454('0xf')]=_0x435c3a['dialCongestionMaxRetry'];this[_0xb454('0x10')]=_0x435c3a[_0xb454('0x10')];this['dialBusyMaxRetry']=_0x435c3a[_0xb454('0x11')];this['dialBusyRetryFrequency']=_0x435c3a[_0xb454('0x12')];this['dialNoAnswerMaxRetry']=_0x435c3a[_0xb454('0x13')];this[_0xb454('0x14')]=_0x435c3a[_0xb454('0x14')];this[_0xb454('0x15')]=_0x435c3a[_0xb454('0x15')];this[_0xb454('0x16')]=_0x435c3a[_0xb454('0x16')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x435c3a[_0xb454('0x17')]||0x96;this['dialDropMaxRetry']=_0x435c3a[_0xb454('0x18')]||0x3;this['dialDropRetryFrequency']=_0x435c3a['dialDropRetryFrequency']||0x96;this[_0xb454('0x19')]=_0x435c3a[_0xb454('0x19')]||0x3;this[_0xb454('0x1a')]=_0x435c3a[_0xb454('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x435c3a['dialMachineMaxRetry']||0x3;this[_0xb454('0x1b')]=_0x435c3a[_0xb454('0x1b')]||0x96;this[_0xb454('0x1c')]=_0x435c3a[_0xb454('0x1c')]||0x3;this[_0xb454('0x1d')]=_0x435c3a[_0xb454('0x1d')]||0x96;this[_0xb454('0x1e')]=_0x435c3a[_0xb454('0x1e')]||'DESC';this[_0xb454('0x1f')]=_0x435c3a[_0xb454('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x435c3a[_0xb454('0x20')]||undefined;this[_0xb454('0x21')]=_0x435c3a[_0xb454('0x21')]||undefined;this[_0xb454('0x22')]=_0x435c3a['TrunkBackup']?_0x435c3a['TrunkBackup']:undefined;this['Trunk']=_0x435c3a[_0xb454('0x23')]?_0x435c3a[_0xb454('0x23')]:undefined;this[_0xb454('0x24')]=_0x435c3a[_0xb454('0x24')]?_0x435c3a[_0xb454('0x24')]:undefined;this['SquareProject']=_0x435c3a[_0xb454('0x25')]?_0x435c3a[_0xb454('0x25')]:undefined;this['dialQueueProject']=_0x435c3a[_0xb454('0x25')]?_0x435c3a[_0xb454('0x25')][_0xb454('0x0')]:undefined;this['dialAMDActive']=_0x435c3a[_0xb454('0x26')]||![];this[_0xb454('0x27')]=_0x435c3a[_0xb454('0x27')];this[_0xb454('0x28')]=_0x435c3a[_0xb454('0x28')];this[_0xb454('0x29')]=_0x435c3a[_0xb454('0x29')];this[_0xb454('0x2a')]=_0x435c3a[_0xb454('0x2a')];this[_0xb454('0x2b')]=_0x435c3a['dialAMDMinWordLength'];this[_0xb454('0x2c')]=_0x435c3a[_0xb454('0x2c')];this[_0xb454('0x2d')]=_0x435c3a[_0xb454('0x2d')];this[_0xb454('0x2e')]=_0x435c3a['dialAMDSilenceThreshold'];this[_0xb454('0x2f')]=_0x435c3a['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file +var _0xa607=['dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','exports','name','type','originated','ivrAnswerCallsDay','message','active','limitCalls','dialTimezone','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'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa607,0x167));var _0x7a60=function(_0x22de84,_0x56142b){_0x22de84=_0x22de84-0x0;var _0x54fc49=_0xa607[_0x22de84];return _0x54fc49;};'use strict';function Campaign(_0x126530){this['id']=_0x126530['id']||0x0;this[_0x7a60('0x0')]=_0x126530['name']||'';this[_0x7a60('0x1')]=_0x126530[_0x7a60('0x1')]||'campaign';this[_0x7a60('0x2')]=0x0;this['temp']=0x0;this[_0x7a60('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x7a60('0x4')]='';this['sendMessageOneNotActive']=!![];this[_0x7a60('0x5')]=_0x126530[_0x7a60('0x5')];this[_0x7a60('0x6')]=_0x126530[_0x7a60('0x6')];this[_0x7a60('0x7')]=_0x126530[_0x7a60('0x7')]||null;this[_0x7a60('0x8')]=_0x126530['dialGlobalInterval']?_0x126530[_0x7a60('0x8')]:null;this[_0x7a60('0x9')]=_0x126530[_0x7a60('0x9')];this[_0x7a60('0xa')]=_0x126530['dialOriginateCallerIdNumber'];this[_0x7a60('0xb')]=_0x126530['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x126530[_0x7a60('0xc')];this['dialCongestionRetryFrequency']=_0x126530[_0x7a60('0xd')];this[_0x7a60('0xe')]=_0x126530[_0x7a60('0xe')];this[_0x7a60('0xf')]=_0x126530[_0x7a60('0xf')];this[_0x7a60('0x10')]=_0x126530[_0x7a60('0x10')];this[_0x7a60('0x11')]=_0x126530[_0x7a60('0x11')];this['dialGlobalMaxRetry']=_0x126530[_0x7a60('0x12')];this[_0x7a60('0x13')]=_0x126530[_0x7a60('0x13')]||0x3;this[_0x7a60('0x14')]=_0x126530[_0x7a60('0x14')]||0x96;this[_0x7a60('0x15')]=_0x126530[_0x7a60('0x15')]||0x3;this[_0x7a60('0x16')]=_0x126530[_0x7a60('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x126530[_0x7a60('0x17')]||0x3;this['dialAbandonedRetryFrequency']=_0x126530[_0x7a60('0x18')]||0x96;this['dialMachineMaxRetry']=_0x126530[_0x7a60('0x19')]||0x3;this['dialMachineRetryFrequency']=_0x126530[_0x7a60('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x126530[_0x7a60('0x1b')]||0x3;this[_0x7a60('0x1c')]=_0x126530['dialAgentRejectRetryFrequency']||0x96;this[_0x7a60('0x1d')]=_0x126530[_0x7a60('0x1d')]||_0x7a60('0x1e');this['dialPrefix']=_0x126530[_0x7a60('0x1f')]||undefined;this[_0x7a60('0x20')]=_0x126530[_0x7a60('0x20')]||undefined;this[_0x7a60('0x21')]=_0x126530['dialCutDigit']||undefined;this[_0x7a60('0x22')]=_0x126530[_0x7a60('0x22')]?_0x126530[_0x7a60('0x22')]:undefined;this[_0x7a60('0x23')]=_0x126530['Trunk']?_0x126530[_0x7a60('0x23')]:undefined;this[_0x7a60('0x24')]=_0x126530[_0x7a60('0x24')]?_0x126530[_0x7a60('0x24')]:undefined;this['SquareProject']=_0x126530[_0x7a60('0x25')]?_0x126530['SquareProject']:undefined;this[_0x7a60('0x26')]=_0x126530['SquareProject']?_0x126530[_0x7a60('0x25')]['name']:undefined;this['dialAMDActive']=_0x126530[_0x7a60('0x27')]||![];this[_0x7a60('0x28')]=_0x126530[_0x7a60('0x28')];this[_0x7a60('0x29')]=_0x126530[_0x7a60('0x29')];this['dialAMDAfterGreetingSilence']=_0x126530[_0x7a60('0x2a')];this['dialAMDTotalAnalysisTime']=_0x126530[_0x7a60('0x2b')];this[_0x7a60('0x2c')]=_0x126530[_0x7a60('0x2c')];this[_0x7a60('0x2d')]=_0x126530[_0x7a60('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x126530[_0x7a60('0x2e')];this['dialAMDSilenceThreshold']=_0x126530['dialAMDSilenceThreshold'];this[_0x7a60('0x2f')]=_0x126530['dialAMDMaximumWordLength'];}module[_0x7a60('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 55ff2f6..6a33b9c 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 _0xf269=['endtime','unmanaged','abandoned','lastapplication','holdtime','type','monitor','monitorFilename','queue','monitors','mohtime','exports','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','context','linkedid','exten','answered','answertime'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xf269,0xd2));var _0x9f26=function(_0x110bea,_0x28a529){_0x110bea=_0x110bea-0x0;var _0x33768f=_0xf269[_0x110bea];return _0x33768f;};'use strict';function Channel(){this['starttime']=null;this[_0x9f26('0x0')]='';this[_0x9f26('0x1')]='';this['calleridnum']=0x0;this[_0x9f26('0x2')]='';this[_0x9f26('0x3')]=undefined;this[_0x9f26('0x4')]=undefined;this['accountcode']=0x0;this[_0x9f26('0x5')]='';this['uniqueid']=0x0;this[_0x9f26('0x6')]=0x0;this[_0x9f26('0x7')]=0x0;this[_0x9f26('0x8')]=![];this[_0x9f26('0x9')]=null;this[_0x9f26('0xa')]=null;this[_0x9f26('0xb')]=![];this[_0x9f26('0xc')]=![];this[_0x9f26('0xd')]='';this['lastdata']='';this['duration']=0x0;this['billableseconds']=0x0;this[_0x9f26('0xe')]=0x0;this[_0x9f26('0xf')]=null;this['tag']=null;this['disposition']=null;this[_0x9f26('0x10')]=![];this[_0x9f26('0x11')]=null;this[_0x9f26('0x12')]=null;this[_0x9f26('0x13')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0x9f26('0x14')]=0x0;}module[_0x9f26('0x15')]=Channel; \ No newline at end of file +var _0x6fc2=['transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','uniqueid','linkedid','answered','answertime','endtime','unmanaged','lastapplication','billableseconds','holdtime','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6fc2,0x117));var _0x26fc=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x6fc2[_0x4b7895];return _0x264180;};'use strict';function Channel(){this[_0x26fc('0x0')]=null;this[_0x26fc('0x1')]='';this[_0x26fc('0x2')]='';this['calleridnum']=0x0;this[_0x26fc('0x3')]='';this[_0x26fc('0x4')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this['context']='';this[_0x26fc('0x5')]=0x0;this[_0x26fc('0x6')]=0x0;this['exten']=0x0;this[_0x26fc('0x7')]=![];this[_0x26fc('0x8')]=null;this[_0x26fc('0x9')]=null;this[_0x26fc('0xa')]=![];this['abandoned']=![];this[_0x26fc('0xb')]='';this['lastdata']='';this['duration']=0x0;this[_0x26fc('0xc')]=0x0;this[_0x26fc('0xd')]=0x0;this[_0x26fc('0xe')]=null;this['tag']=null;this[_0x26fc('0xf')]=null;this[_0x26fc('0x10')]=![];this[_0x26fc('0x11')]=null;this[_0x26fc('0x12')]=null;this[_0x26fc('0x13')]=[];this[_0x26fc('0x14')]=undefined;this[_0x26fc('0x15')]=undefined;this[_0x26fc('0x16')]=undefined;this[_0x26fc('0x17')]=0x0;}module[_0x26fc('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 77993d0..022dcbe 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 _0xb7e7=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','remoteUri'];(function(_0x290af3,_0x5442b6){var _0x39e480=function(_0x2b9557){while(--_0x2b9557){_0x290af3['push'](_0x290af3['shift']());}};_0x39e480(++_0x5442b6);}(_0xb7e7,0x15e));var _0x7b7e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xb7e7[_0x3c4737];return _0x2bb926;};'use strict';function DeskAccount(_0x3e8ebe){this['id']=_0x3e8ebe['id']||0x0;this[_0x7b7e('0x0')]=_0x3e8ebe[_0x7b7e('0x0')]||'';this['username']=_0x3e8ebe['username']||'';this[_0x7b7e('0x1')]=_0x3e8ebe[_0x7b7e('0x1')]||'';this[_0x7b7e('0x2')]=_0x3e8ebe[_0x7b7e('0x2')]||'';this[_0x7b7e('0x3')]=_0x3e8ebe[_0x7b7e('0x3')]||'';this[_0x7b7e('0x4')]=_0x3e8ebe[_0x7b7e('0x4')]||'';this[_0x7b7e('0x5')]=_0x3e8ebe['consumerSecret']||'';this[_0x7b7e('0x6')]=_0x3e8ebe[_0x7b7e('0x6')]||'';this['tokenSecret']=_0x3e8ebe[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x3e8ebe[_0x7b7e('0x8')]||'';this[_0x7b7e('0x9')]=_0x3e8ebe['serverUrl']||'';this['Configurations']=_0x3e8ebe[_0x7b7e('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x7394=['password','token','tokenSecret','type','serverUrl','Configurations','exports','username','remoteUri','authType'];(function(_0x23461e,_0x4944b8){var _0x33f3f5=function(_0x3658c7){while(--_0x3658c7){_0x23461e['push'](_0x23461e['shift']());}};_0x33f3f5(++_0x4944b8);}(_0x7394,0x15b));var _0x4739=function(_0x36b03c,_0x58106c){_0x36b03c=_0x36b03c-0x0;var _0x103615=_0x7394[_0x36b03c];return _0x103615;};'use strict';function DeskAccount(_0x529426){this['id']=_0x529426['id']||0x0;this['name']=_0x529426['name']||'';this[_0x4739('0x0')]=_0x529426[_0x4739('0x0')]||'';this[_0x4739('0x1')]=_0x529426[_0x4739('0x1')]||'';this['authType']=_0x529426[_0x4739('0x2')]||'';this[_0x4739('0x3')]=_0x529426[_0x4739('0x3')]||'';this['consumerKey']=_0x529426['consumerKey']||'';this['consumerSecret']=_0x529426['consumerSecret']||'';this['token']=_0x529426[_0x4739('0x4')]||'';this[_0x4739('0x5')]=_0x529426[_0x4739('0x5')]||'';this['type']=_0x529426[_0x4739('0x6')]||'';this['serverUrl']=_0x529426[_0x4739('0x7')]||'';this[_0x4739('0x8')]=_0x529426[_0x4739('0x8')]||{};}module[_0x4739('0x9')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index e6c67ca..89239d4 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 _0xe8cb=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe8cb,0x142));var _0xbe8c=function(_0x22e102,_0x481e57){_0x22e102=_0x22e102-0x0;var _0x8e8bb3=_0xe8cb[_0x22e102];return _0x8e8bb3;};'use strict';function Dynamics365Account(_0x47ed4e){this['id']=_0x47ed4e['id']||0x0;this[_0xbe8c('0x0')]=_0x47ed4e[_0xbe8c('0x0')]||'';this[_0xbe8c('0x1')]=_0x47ed4e[_0xbe8c('0x1')]||'';this[_0xbe8c('0x2')]=_0x47ed4e['password']||'';this[_0xbe8c('0x3')]=_0x47ed4e[_0xbe8c('0x3')]||'';this[_0xbe8c('0x4')]=_0x47ed4e[_0xbe8c('0x4')]||'';this[_0xbe8c('0x5')]=_0x47ed4e[_0xbe8c('0x5')]||'';this[_0xbe8c('0x6')]=_0x47ed4e[_0xbe8c('0x6')]||{};this[_0xbe8c('0x7')]=_0x47ed4e['serverUrl']||'';this[_0xbe8c('0x8')]=_0x47ed4e[_0xbe8c('0x8')]||![];this[_0xbe8c('0x9')]=_0x47ed4e[_0xbe8c('0x9')]||{};this[_0xbe8c('0xa')]=_0x47ed4e[_0xbe8c('0xa')]||{};}module[_0xbe8c('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x935a=['serverUrl','modernAuthentication','Configurations','CloudProvider','name','password','remoteUri','clientId','clientSecret'];(function(_0x4179e4,_0x4c16c0){var _0x593f54=function(_0x449b55){while(--_0x449b55){_0x4179e4['push'](_0x4179e4['shift']());}};_0x593f54(++_0x4c16c0);}(_0x935a,0x94));var _0xa935=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x935a[_0x4d613c];return _0x301fe3;};'use strict';function Dynamics365Account(_0xbeb7e1){this['id']=_0xbeb7e1['id']||0x0;this[_0xa935('0x0')]=_0xbeb7e1[_0xa935('0x0')]||'';this['username']=_0xbeb7e1['username']||'';this[_0xa935('0x1')]=_0xbeb7e1['password']||'';this['remoteUri']=_0xbeb7e1[_0xa935('0x2')]||'';this['tenantId']=_0xbeb7e1['tenantId']||'';this[_0xa935('0x3')]=_0xbeb7e1[_0xa935('0x3')]||'';this['clientSecret']=_0xbeb7e1[_0xa935('0x4')]||{};this[_0xa935('0x5')]=_0xbeb7e1[_0xa935('0x5')]||'';this[_0xa935('0x6')]=_0xbeb7e1[_0xa935('0x6')]||![];this[_0xa935('0x7')]=_0xbeb7e1[_0xa935('0x7')]||{};this[_0xa935('0x8')]=_0xbeb7e1[_0xa935('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 6afd7a6..428ac6d 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 _0xe5ef=['localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x1c06f4,_0x2feba6){var _0x1a727e=function(_0x2e83af){while(--_0x2e83af){_0x1c06f4['push'](_0x1c06f4['shift']());}};_0x1a727e(++_0x2feba6);}(_0xe5ef,0x9d));var _0xfe5e=function(_0x127770,_0x1631f){_0x127770=_0x127770-0x0;var _0x563208=_0xe5ef[_0x127770];return _0x563208;};'use strict';function FaxAccount(_0x35573f){this['id']=_0x35573f['id']||0x0;this[_0xfe5e('0x0')]=_0x35573f[_0xfe5e('0x0')]||'';this[_0xfe5e('0x1')]=_0x35573f[_0xfe5e('0x1')];this[_0xfe5e('0x2')]=_0x35573f['ecm'];this['headerinfo']=_0x35573f['headerinfo'];this[_0xfe5e('0x3')]=_0x35573f[_0xfe5e('0x3')];this['minrate']=_0x35573f[_0xfe5e('0x4')]||0x960;this[_0xfe5e('0x5')]=_0x35573f['maxrate']||0x3840;this[_0xfe5e('0x6')]=_0x35573f[_0xfe5e('0x6')]||'v17,v27,v29';this[_0xfe5e('0x7')]=_0x35573f[_0xfe5e('0x7')]||'no';this[_0xfe5e('0x8')]=_0x35573f[_0xfe5e('0x8')]||'no';this['t38timeout']=_0x35573f[_0xfe5e('0x9')]||0x1388;this['tech']=_0x35573f[_0xfe5e('0xa')]||_0xfe5e('0xb');this[_0xfe5e('0xc')]=_0x35573f[_0xfe5e('0xc')]?_0x35573f[_0xfe5e('0xc')]:undefined;this[_0xfe5e('0xd')]=_0x35573f[_0xfe5e('0xd')];this['key']=_0x35573f[_0xfe5e('0xe')];}module[_0xfe5e('0xf')]=FaxAccount; \ No newline at end of file +var _0xcc9c=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','SIP','Trunk','ListId','key'];(function(_0x1d3577,_0x17a32e){var _0x277d9a=function(_0x4b4144){while(--_0x4b4144){_0x1d3577['push'](_0x1d3577['shift']());}};_0x277d9a(++_0x17a32e);}(_0xcc9c,0x1ee));var _0xccc9=function(_0x58772e,_0x5ecf45){_0x58772e=_0x58772e-0x0;var _0x3c4357=_0xcc9c[_0x58772e];return _0x3c4357;};'use strict';function FaxAccount(_0x1fab25){this['id']=_0x1fab25['id']||0x0;this[_0xccc9('0x0')]=_0x1fab25['name']||'';this[_0xccc9('0x1')]=_0x1fab25[_0xccc9('0x1')];this['ecm']=_0x1fab25[_0xccc9('0x2')];this[_0xccc9('0x3')]=_0x1fab25[_0xccc9('0x3')];this[_0xccc9('0x4')]=_0x1fab25[_0xccc9('0x4')];this[_0xccc9('0x5')]=_0x1fab25[_0xccc9('0x5')]||0x960;this[_0xccc9('0x6')]=_0x1fab25[_0xccc9('0x6')]||0x3840;this[_0xccc9('0x7')]=_0x1fab25[_0xccc9('0x7')]||_0xccc9('0x8');this[_0xccc9('0x9')]=_0x1fab25[_0xccc9('0x9')]||'no';this[_0xccc9('0xa')]=_0x1fab25[_0xccc9('0xa')]||'no';this[_0xccc9('0xb')]=_0x1fab25[_0xccc9('0xb')]||0x1388;this['tech']=_0x1fab25['tech']||_0xccc9('0xc');this['Trunk']=_0x1fab25[_0xccc9('0xd')]?_0x1fab25[_0xccc9('0xd')]:undefined;this[_0xccc9('0xe')]=_0x1fab25[_0xccc9('0xe')];this[_0xccc9('0xf')]=_0x1fab25[_0xccc9('0xf')];}module[_0xccc9('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 78c67bf..4e0ae75 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 _0x7313=['remoteUri','Configurations','name','username','apiKey','token'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x7313,0x17c));var _0x3731=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x7313[_0x5608a3];return _0x1ed50a;};'use strict';function FreshdeskAccount(_0x23b685){this['id']=_0x23b685['id']||0x0;this[_0x3731('0x0')]=_0x23b685[_0x3731('0x0')]||'';this['username']=_0x23b685[_0x3731('0x1')]||'';this[_0x3731('0x2')]=_0x23b685[_0x3731('0x3')]||'';this[_0x3731('0x4')]=_0x23b685[_0x3731('0x4')]||'';this['serverUrl']=_0x23b685['serverUrl']||'';this[_0x3731('0x5')]=_0x23b685[_0x3731('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xc1b7=['username','apiKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4cdc39,_0x15a39e){var _0x340a85=function(_0x14ee05){while(--_0x14ee05){_0x4cdc39['push'](_0x4cdc39['shift']());}};_0x340a85(++_0x15a39e);}(_0xc1b7,0x110));var _0x7c1b=function(_0x2f6799,_0x4e7f00){_0x2f6799=_0x2f6799-0x0;var _0x3cb26f=_0xc1b7[_0x2f6799];return _0x3cb26f;};'use strict';function FreshdeskAccount(_0x1bcc9a){this['id']=_0x1bcc9a['id']||0x0;this[_0x7c1b('0x0')]=_0x1bcc9a['name']||'';this[_0x7c1b('0x1')]=_0x1bcc9a[_0x7c1b('0x1')]||'';this[_0x7c1b('0x2')]=_0x1bcc9a['token']||'';this[_0x7c1b('0x3')]=_0x1bcc9a[_0x7c1b('0x3')]||'';this[_0x7c1b('0x4')]=_0x1bcc9a[_0x7c1b('0x4')]||'';this[_0x7c1b('0x5')]=_0x1bcc9a['Configurations']||{};}module[_0x7c1b('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 313fef5..e060254 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 _0x448a=['serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x448a,0x1ef));var _0xa448=function(_0x3ab2e6,_0x312027){_0x3ab2e6=_0x3ab2e6-0x0;var _0x3f59a8=_0x448a[_0x3ab2e6];return _0x3f59a8;};'use strict';function FreshsalesAccount(_0x526c52){this['id']=_0x526c52['id']||0x0;this[_0xa448('0x0')]=_0x526c52[_0xa448('0x0')]||'';this['username']=_0x526c52[_0xa448('0x1')]||'';this['apiKey']=_0x526c52['token']||'';this[_0xa448('0x2')]=_0x526c52[_0xa448('0x2')]||'';this['serverUrl']=_0x526c52[_0xa448('0x3')]||'';this[_0xa448('0x4')]=_0x526c52[_0xa448('0x4')]||{};}module[_0xa448('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0xcddb=['serverUrl','Configurations','name','apiKey','remoteUri'];(function(_0x58d49a,_0x5a2469){var _0x176700=function(_0x1ccebd){while(--_0x1ccebd){_0x58d49a['push'](_0x58d49a['shift']());}};_0x176700(++_0x5a2469);}(_0xcddb,0x1c4));var _0xbcdd=function(_0xc5ef06,_0x5dbab3){_0xc5ef06=_0xc5ef06-0x0;var _0x492f2e=_0xcddb[_0xc5ef06];return _0x492f2e;};'use strict';function FreshsalesAccount(_0x82d2ab){this['id']=_0x82d2ab['id']||0x0;this[_0xbcdd('0x0')]=_0x82d2ab[_0xbcdd('0x0')]||'';this['username']=_0x82d2ab['username']||'';this[_0xbcdd('0x1')]=_0x82d2ab['token']||'';this[_0xbcdd('0x2')]=_0x82d2ab[_0xbcdd('0x2')]||'';this[_0xbcdd('0x3')]=_0x82d2ab[_0xbcdd('0x3')]||'';this['Configurations']=_0x82d2ab[_0xbcdd('0x4')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 304e8c6..87aa781 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 _0xae76=['originalposition','connectedlinename','context','exten','priority','assigned','lastAssignedTo','motionChannel','voice','variables','exports','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0xae76,0x83));var _0x6ae7=function(_0x1553be,_0x4b167f){_0x1553be=_0x1553be-0x0;var _0x418597=_0xae76[_0x1553be];return _0x418597;};'use strict';function QueueReport(){this['type']=_0x6ae7('0x0');this[_0x6ae7('0x1')]='';this['calleridnum']='';this[_0x6ae7('0x2')]='';this[_0x6ae7('0x3')]='';this[_0x6ae7('0x4')]=null;this[_0x6ae7('0x5')]=null;this[_0x6ae7('0x6')]=0x1;this[_0x6ae7('0x7')]=0x1;this[_0x6ae7('0x8')]=![];this['queuecallerabandonAt']=null;this[_0x6ae7('0x9')]=![];this[_0x6ae7('0xa')]=null;this[_0x6ae7('0xb')]=![];this[_0x6ae7('0xc')]=null;this[_0x6ae7('0xd')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0x6ae7('0xe')]='';this['accountcode']='';this[_0x6ae7('0xf')]='';this[_0x6ae7('0x10')]='';this[_0x6ae7('0x11')]='';this['holdtime']=0x0;this[_0x6ae7('0x12')]=![];this[_0x6ae7('0x13')]='';this[_0x6ae7('0x14')]=_0x6ae7('0x15');this['mohtime']=0x0;this[_0x6ae7('0x16')]={};}module[_0x6ae7('0x17')]=QueueReport; \ No newline at end of file +var _0xe9a8=['context','exten','priority','holdtime','assigned','lastAssignedTo','voice','mohtime','type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename'];(function(_0x484cac,_0x30ad3a){var _0x1d6e77=function(_0x4f5f16){while(--_0x4f5f16){_0x484cac['push'](_0x484cac['shift']());}};_0x1d6e77(++_0x30ad3a);}(_0xe9a8,0x19d));var _0x8e9a=function(_0x55a2ba,_0x2fd4cc){_0x55a2ba=_0x55a2ba-0x0;var _0x39028d=_0xe9a8[_0x55a2ba];return _0x39028d;};'use strict';function QueueReport(){this[_0x8e9a('0x0')]=_0x8e9a('0x1');this[_0x8e9a('0x2')]='';this['calleridnum']='';this[_0x8e9a('0x3')]='';this[_0x8e9a('0x4')]='';this[_0x8e9a('0x5')]=null;this[_0x8e9a('0x6')]=null;this[_0x8e9a('0x7')]=0x1;this[_0x8e9a('0x8')]=0x1;this[_0x8e9a('0x9')]=![];this[_0x8e9a('0xa')]=null;this[_0x8e9a('0xb')]=![];this[_0x8e9a('0xc')]=null;this[_0x8e9a('0xd')]=![];this[_0x8e9a('0xe')]=null;this[_0x8e9a('0xf')]=0x1;this[_0x8e9a('0x10')]='';this[_0x8e9a('0x11')]='';this[_0x8e9a('0x12')]='';this['accountcode']='';this[_0x8e9a('0x13')]='';this[_0x8e9a('0x14')]='';this[_0x8e9a('0x15')]='';this[_0x8e9a('0x16')]=0x0;this[_0x8e9a('0x17')]=![];this[_0x8e9a('0x18')]='';this['motionChannel']=_0x8e9a('0x19');this[_0x8e9a('0x1a')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 6d31bef..fb48fc0 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 _0x22f0=['clientSecret','securityToken','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId'];(function(_0x514ac3,_0x497d2c){var _0x116919=function(_0x410a22){while(--_0x410a22){_0x514ac3['push'](_0x514ac3['shift']());}};_0x116919(++_0x497d2c);}(_0x22f0,0x159));var _0x022f=function(_0x216e72,_0x5cd161){_0x216e72=_0x216e72-0x0;var _0x2ff28d=_0x22f0[_0x216e72];return _0x2ff28d;};'use strict';function SalesforceAccount(_0x275d93){this['id']=_0x275d93['id']||0x0;this[_0x022f('0x0')]=_0x275d93[_0x022f('0x0')]||'';this[_0x022f('0x1')]=_0x275d93[_0x022f('0x1')]||'';this[_0x022f('0x2')]=_0x275d93[_0x022f('0x2')]||'';this[_0x022f('0x3')]=_0x275d93[_0x022f('0x3')]||'';this[_0x022f('0x4')]=_0x275d93[_0x022f('0x4')]||'';this[_0x022f('0x5')]=_0x275d93['clientSecret']||'';this[_0x022f('0x6')]=_0x275d93[_0x022f('0x6')]||'';this['type']=_0x275d93['type']||_0x022f('0x7');this[_0x022f('0x8')]=_0x275d93[_0x022f('0x8')]||'';this[_0x022f('0x9')]=_0x275d93[_0x022f('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xabc4=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xabc4,0xfd));var _0x4abc=function(_0x3e5595,_0xbe4275){_0x3e5595=_0x3e5595-0x0;var _0x3fd3a6=_0xabc4[_0x3e5595];return _0x3fd3a6;};'use strict';function SalesforceAccount(_0x29e1b4){this['id']=_0x29e1b4['id']||0x0;this['name']=_0x29e1b4[_0x4abc('0x0')]||'';this[_0x4abc('0x1')]=_0x29e1b4[_0x4abc('0x1')]||'';this['remoteUri']=_0x29e1b4[_0x4abc('0x2')]||'';this[_0x4abc('0x3')]=_0x29e1b4['password']||'';this[_0x4abc('0x4')]=_0x29e1b4[_0x4abc('0x4')]||'';this[_0x4abc('0x5')]=_0x29e1b4[_0x4abc('0x5')]||'';this[_0x4abc('0x6')]=_0x29e1b4[_0x4abc('0x6')]||'';this[_0x4abc('0x7')]=_0x29e1b4[_0x4abc('0x7')]||_0x4abc('0x8');this['serverUrl']=_0x29e1b4[_0x4abc('0x9')]||'';this[_0x4abc('0xa')]=_0x29e1b4[_0x4abc('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 55503bf..21d62bc 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 _0xeca5=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x12a9ac,_0x18d78e){var _0xeb7540=function(_0x2d5932){while(--_0x2d5932){_0x12a9ac['push'](_0x12a9ac['shift']());}};_0xeb7540(++_0x18d78e);}(_0xeca5,0x1d6));var _0x5eca=function(_0x1db02d,_0x16a4ef){_0x1db02d=_0x1db02d-0x0;var _0x5d26a8=_0xeca5[_0x1db02d];return _0x5d26a8;};'use strict';function ServicenowAccount(_0x788118){this['id']=_0x788118['id']||0x0;this[_0x5eca('0x0')]=_0x788118[_0x5eca('0x0')]||'';this[_0x5eca('0x1')]=_0x788118[_0x5eca('0x1')]||'';this[_0x5eca('0x2')]=_0x788118[_0x5eca('0x2')]||'';this[_0x5eca('0x3')]=_0x788118['remoteUri']||'';this['serverUrl']=_0x788118[_0x5eca('0x4')]||'';this['Configurations']=_0x788118[_0x5eca('0x5')]||{};}module[_0x5eca('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xe0fb=['username','password','remoteUri','serverUrl','exports','name'];(function(_0x3c7fc6,_0x5166f8){var _0x5b52bc=function(_0x1f86a0){while(--_0x1f86a0){_0x3c7fc6['push'](_0x3c7fc6['shift']());}};_0x5b52bc(++_0x5166f8);}(_0xe0fb,0x197));var _0xbe0f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xe0fb[_0x4b369d];return _0x571a98;};'use strict';function ServicenowAccount(_0x3c49b){this['id']=_0x3c49b['id']||0x0;this[_0xbe0f('0x0')]=_0x3c49b['name']||'';this[_0xbe0f('0x1')]=_0x3c49b[_0xbe0f('0x1')]||'';this[_0xbe0f('0x2')]=_0x3c49b['password']||'';this[_0xbe0f('0x3')]=_0x3c49b[_0xbe0f('0x3')]||'';this['serverUrl']=_0x3c49b[_0xbe0f('0x4')]||'';this['Configurations']=_0x3c49b['Configurations']||{};}module[_0xbe0f('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 14a02d8..12a4b97 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 _0x5f7c=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x4d8608,_0x46a674){var _0x52823c=function(_0x21ed7a){while(--_0x21ed7a){_0x4d8608['push'](_0x4d8608['shift']());}};_0x52823c(++_0x46a674);}(_0x5f7c,0x1a8));var _0xc5f7=function(_0x530948,_0x189fb9){_0x530948=_0x530948-0x0;var _0x442d73=_0x5f7c[_0x530948];return _0x442d73;};'use strict';function SugarcrmAccount(_0x39829a){this['id']=_0x39829a['id']||0x0;this['name']=_0x39829a[_0xc5f7('0x0')]||'';this[_0xc5f7('0x1')]=_0x39829a['username']||'';this[_0xc5f7('0x2')]=_0x39829a['password']||'';this['remoteUri']=_0x39829a[_0xc5f7('0x3')]||'';this[_0xc5f7('0x4')]=_0x39829a[_0xc5f7('0x4')]||'';this[_0xc5f7('0x5')]=_0x39829a[_0xc5f7('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x5f30=['password','remoteUri','serverUrl','Configurations','exports','username'];(function(_0x1acc3c,_0x12438d){var _0x471679=function(_0x2e9fc8){while(--_0x2e9fc8){_0x1acc3c['push'](_0x1acc3c['shift']());}};_0x471679(++_0x12438d);}(_0x5f30,0xe9));var _0x05f3=function(_0x2eb95d,_0xecd8b6){_0x2eb95d=_0x2eb95d-0x0;var _0x1dc86f=_0x5f30[_0x2eb95d];return _0x1dc86f;};'use strict';function SugarcrmAccount(_0x212c5e){this['id']=_0x212c5e['id']||0x0;this['name']=_0x212c5e['name']||'';this[_0x05f3('0x0')]=_0x212c5e['username']||'';this['password']=_0x212c5e[_0x05f3('0x1')]||'';this[_0x05f3('0x2')]=_0x212c5e[_0x05f3('0x2')]||'';this['serverUrl']=_0x212c5e[_0x05f3('0x3')]||'';this[_0x05f3('0x4')]=_0x212c5e[_0x05f3('0x4')]||{};}module[_0x05f3('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 3e49e48..b414039 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 _0xc00b=['status','address','exports','name','accountcode','unknown'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0xc00b,0x135));var _0xbc00=function(_0x5161fc,_0x37c5f6){_0x5161fc=_0x5161fc-0x0;var _0x38490b=_0xc00b[_0x5161fc];return _0x38490b;};'use strict';function Telephone(_0x533bba){this['id']=_0x533bba['id']||0x0;this[_0xbc00('0x0')]=_0x533bba['name']||'';this['accountcode']=_0x533bba[_0xbc00('0x1')]||'';this['state']=_0xbc00('0x2');this['stateTime']=0x0;this[_0xbc00('0x3')]=_0xbc00('0x2');this[_0xbc00('0x4')]='';}module[_0xbc00('0x5')]=Telephone; \ No newline at end of file +var _0x8507=['stateTime','status','address','exports','name','accountcode','state','unknown'];(function(_0x49158a,_0x3fe9eb){var _0x1c76ce=function(_0x1e14db){while(--_0x1e14db){_0x49158a['push'](_0x49158a['shift']());}};_0x1c76ce(++_0x3fe9eb);}(_0x8507,0x14c));var _0x7850=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8507[_0x20a584];return _0x4b41a8;};'use strict';function Telephone(_0x2b21e3){this['id']=_0x2b21e3['id']||0x0;this['name']=_0x2b21e3[_0x7850('0x0')]||'';this['accountcode']=_0x2b21e3[_0x7850('0x1')]||'';this[_0x7850('0x2')]=_0x7850('0x3');this[_0x7850('0x4')]=0x0;this[_0x7850('0x5')]=_0x7850('0x3');this[_0x7850('0x6')]='';}module[_0x7850('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 72cf8c6..3d5f219 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x2132a7,_0xf4cd64){var _0x39086b=function(_0x52f91b){while(--_0x52f91b){_0x2132a7['push'](_0x2132a7['shift']());}};_0x39086b(++_0xf4cd64);}(_0xb10b,0x12a));var _0xbb10=function(_0x98459f,_0x4dfb55){_0x98459f=_0x98459f-0x0;var _0x128f94=_0xb10b[_0x98459f];return _0x128f94;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x12e1af,_0x10e725){var _0x265fff=function(_0x531608){while(--_0x531608){_0x12e1af['push'](_0x12e1af['shift']());}};_0x265fff(++_0x10e725);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 2ef57be..464b4fa 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x10e983,_0x2f4eda){var _0x324138=function(_0x17a377){while(--_0x17a377){_0x10e983['push'](_0x10e983['shift']());}};_0x324138(++_0x2f4eda);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file +var _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0b0e,0x187));var _0xe0b0=function(_0xa3400,_0x3a980a){_0xa3400=_0xa3400-0x0;var _0x33dba2=_0x0b0e[_0xa3400];return _0x33dba2;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 40d90f9..b373912 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 _0xba3f=['domain','stateRegistry','registrationtime','address','defaultuser','exports','active','name','status','unknown','registry','indexOf','split','host','port'];(function(_0x255a63,_0x2b8f0c){var _0xf6a438=function(_0x1c3a0f){while(--_0x1c3a0f){_0x255a63['push'](_0x255a63['shift']());}};_0xf6a438(++_0x2b8f0c);}(_0xba3f,0x1aa));var _0xfba3=function(_0x46c954,_0x9dc2ae){_0x46c954=_0x46c954-0x0;var _0x1c1a41=_0xba3f[_0x46c954];return _0x1c1a41;};'use strict';function Trunk(_0x4c9f95){this['id']=_0x4c9f95['id']||0x0;this[_0xfba3('0x0')]=_0x4c9f95['active']||![];this['name']=_0x4c9f95[_0xfba3('0x1')]||'';this['state']='unknown';this['stateTime']=0x0;this[_0xfba3('0x2')]=_0xfba3('0x3');this['registry']=_0x4c9f95[_0xfba3('0x4')]&&_0x4c9f95[_0xfba3('0x4')][_0xfba3('0x5')](':')?_0x4c9f95[_0xfba3('0x4')][_0xfba3('0x6')](':')[0x0]:'';this[_0xfba3('0x7')]='';this[_0xfba3('0x8')]='';this[_0xfba3('0x9')]='';this['domainport']='';this['refresh']='';this[_0xfba3('0xa')]=_0xfba3('0x3');this[_0xfba3('0xb')]='';this[_0xfba3('0xc')]='';this[_0xfba3('0xd')]=_0x4c9f95[_0xfba3('0xd')]||'';}module[_0xfba3('0xe')]=Trunk; \ No newline at end of file +var _0x272f=['refresh','stateRegistry','registrationtime','address','defaultuser','active','name','unknown','stateTime','status','registry','indexOf','split','host','port','domain'];(function(_0x5944cf,_0x38144a){var _0x65778f=function(_0x317d35){while(--_0x317d35){_0x5944cf['push'](_0x5944cf['shift']());}};_0x65778f(++_0x38144a);}(_0x272f,0xa5));var _0xf272=function(_0x245b7c,_0x46bc4e){_0x245b7c=_0x245b7c-0x0;var _0x666e6f=_0x272f[_0x245b7c];return _0x666e6f;};'use strict';function Trunk(_0x33f256){this['id']=_0x33f256['id']||0x0;this[_0xf272('0x0')]=_0x33f256['active']||![];this[_0xf272('0x1')]=_0x33f256['name']||'';this['state']=_0xf272('0x2');this[_0xf272('0x3')]=0x0;this[_0xf272('0x4')]='unknown';this['registry']=_0x33f256[_0xf272('0x5')]&&_0x33f256[_0xf272('0x5')][_0xf272('0x6')](':')?_0x33f256[_0xf272('0x5')][_0xf272('0x7')](':')[0x0]:'';this[_0xf272('0x8')]='';this[_0xf272('0x9')]='';this[_0xf272('0xa')]='';this['domainport']='';this[_0xf272('0xb')]='';this[_0xf272('0xc')]=_0xf272('0x2');this[_0xf272('0xd')]='';this[_0xf272('0xe')]='';this['defaultuser']=_0x33f256[_0xf272('0xf')]||'';}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 f406ef0..df269ef 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 _0x9781=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x4519a7,_0x3303d5){var _0x3188dc=function(_0x15e540){while(--_0x15e540){_0x4519a7['push'](_0x4519a7['shift']());}};_0x3188dc(++_0x3303d5);}(_0x9781,0x70));var _0x1978=function(_0x12c280,_0x51dd07){_0x12c280=_0x12c280-0x0;var _0x3638d3=_0x9781[_0x12c280];return _0x3638d3;};'use strict';function voiceExtension(_0x24482b){this['id']=_0x24482b['id']||0x0;this['exten']=_0x24482b[_0x1978('0x0')]||'';this[_0x1978('0x1')]=_0x24482b[_0x1978('0x1')]||_0x1978('0x2');this[_0x1978('0x3')]=_0x24482b['mandatoryDisposition']||![];}module[_0x1978('0x4')]=voiceExtension; \ No newline at end of file +var _0xeab2=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x40b9d0,_0x3537da){var _0x144b8d=function(_0x3071b5){while(--_0x3071b5){_0x40b9d0['push'](_0x40b9d0['shift']());}};_0x144b8d(++_0x3537da);}(_0xeab2,0x14e));var _0x2eab=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0xeab2[_0x585133];return _0x18254a;};'use strict';function voiceExtension(_0x223bc7){this['id']=_0x223bc7['id']||0x0;this[_0x2eab('0x0')]=_0x223bc7['exten']||'';this[_0x2eab('0x1')]=_0x223bc7['recordingFormat']||_0x2eab('0x2');this['mandatoryDisposition']=_0x223bc7[_0x2eab('0x3')]||![];}module[_0x2eab('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 80cb1f3..aa73a24 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 _0xcbe6=['inbound','waiting','talking','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','acw','acwTimeout','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','gsm','roundrobin','monitor_format','type'];(function(_0x111bab,_0x271498){var _0x5999fa=function(_0x9512f4){while(--_0x9512f4){_0x111bab['push'](_0x111bab['shift']());}};_0x5999fa(++_0x271498);}(_0xcbe6,0x72));var _0x6cbe=function(_0x2ad39d,_0x4168dc){_0x2ad39d=_0x2ad39d-0x0;var _0x29495f=_0xcbe6[_0x2ad39d];return _0x29495f;};'use strict';var statusDesc=[_0x6cbe('0x0'),_0x6cbe('0x1'),_0x6cbe('0x2'),_0x6cbe('0x3'),_0x6cbe('0x4'),_0x6cbe('0x5'),_0x6cbe('0x6'),_0x6cbe('0x7'),_0x6cbe('0x8')];var monitorFormat={'wav':_0x6cbe('0x9'),'wav49':'wav49','gsm':_0x6cbe('0xa')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x6cbe('0xb')};function VoiceQueue(_0x9e7b1b){this['id']=_0x9e7b1b['id']||0x0;this['name']=_0x9e7b1b['name']||'';this[_0x6cbe('0xc')]=_0x9e7b1b[_0x6cbe('0xc')]||'';this['type']=_0x9e7b1b[_0x6cbe('0xd')]||_0x6cbe('0xe');this[_0x6cbe('0xf')]=0x0;this[_0x6cbe('0x10')]=0x0;this[_0x6cbe('0x11')]=0x0;this[_0x6cbe('0x12')]=0x0;this['sumDuration']=0x0;this[_0x6cbe('0x13')]=0x0;this[_0x6cbe('0x14')]=0x0;this[_0x6cbe('0x15')]=0x0;this[_0x6cbe('0x16')]=0x0;this[_0x6cbe('0x17')]=0x0;this['available']=0x0;this[_0x6cbe('0x18')]=_0x9e7b1b[_0x6cbe('0x18')]||![];this['acwTimeout']=_0x9e7b1b[_0x6cbe('0x19')]||0xa;this['autopause']=_0x9e7b1b['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0x6cbe('0x1a')]='';this[_0x6cbe('0x1b')]=0x0;this['temp']=0x0;this[_0x6cbe('0x1c')]=_0x9e7b1b['dialTimezone']||null;this['dialGlobalInterval']=_0x9e7b1b['dialGlobalInterval']?_0x9e7b1b[_0x6cbe('0x1d')]:null;this['dialActive']=_0x9e7b1b[_0x6cbe('0x1e')];this[_0x6cbe('0x1f')]=_0x9e7b1b[_0x6cbe('0x1f')]||_0x6cbe('0x20');this[_0x6cbe('0x21')]=_0x9e7b1b[_0x6cbe('0x21')]||0x0;this[_0x6cbe('0x22')]=_0x9e7b1b[_0x6cbe('0x22')]||0x0;this[_0x6cbe('0x23')]=_0x9e7b1b[_0x6cbe('0x23')]||0x1;this[_0x6cbe('0x24')]=_0x9e7b1b[_0x6cbe('0x24')]||_0x6cbe('0x25');this[_0x6cbe('0x26')]=_0x9e7b1b[_0x6cbe('0x26')]||0.03;this[_0x6cbe('0x27')]=_0x9e7b1b[_0x6cbe('0x27')]||0x258;this[_0x6cbe('0x28')]=_0x9e7b1b[_0x6cbe('0x28')]||'anonymous';this[_0x6cbe('0x29')]=_0x9e7b1b[_0x6cbe('0x29')]||_0x6cbe('0x2a');this[_0x6cbe('0x2b')]=_0x9e7b1b[_0x6cbe('0x2b')]||0x1e;this['dialQueueOptions']=_0x9e7b1b['dialQueueOptions']||_0x6cbe('0x2c');this[_0x6cbe('0x2d')]=_0x9e7b1b[_0x6cbe('0x2d')]||0x3;this[_0x6cbe('0x2e')]=_0x9e7b1b[_0x6cbe('0x2e')]||undefined;this[_0x6cbe('0x2f')]=_0x9e7b1b[_0x6cbe('0x2f')]||0x3;this[_0x6cbe('0x30')]=_0x9e7b1b[_0x6cbe('0x30')]||0x96;this[_0x6cbe('0x31')]=_0x9e7b1b[_0x6cbe('0x31')]||0x3;this[_0x6cbe('0x32')]=_0x9e7b1b['dialBusyRetryFrequency']||0x96;this[_0x6cbe('0x33')]=_0x9e7b1b[_0x6cbe('0x33')]||0x3;this['dialNoAnswerRetryFrequency']=_0x9e7b1b[_0x6cbe('0x34')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x9e7b1b[_0x6cbe('0x35')]||0x3;this[_0x6cbe('0x36')]=_0x9e7b1b[_0x6cbe('0x36')]||0x96;this[_0x6cbe('0x37')]=_0x9e7b1b[_0x6cbe('0x37')]||0x3;this[_0x6cbe('0x38')]=_0x9e7b1b[_0x6cbe('0x38')]||0x96;this[_0x6cbe('0x39')]=_0x9e7b1b[_0x6cbe('0x39')]||0x3;this['dialAbandonedRetryFrequency']=_0x9e7b1b[_0x6cbe('0x3a')]||0x96;this[_0x6cbe('0x3b')]=_0x9e7b1b[_0x6cbe('0x3b')]||0x3;this[_0x6cbe('0x3c')]=_0x9e7b1b[_0x6cbe('0x3c')]||0x96;this[_0x6cbe('0x3d')]=_0x9e7b1b[_0x6cbe('0x3d')]||0x3;this[_0x6cbe('0x3e')]=_0x9e7b1b[_0x6cbe('0x3e')]||0x96;this[_0x6cbe('0x3f')]=_0x9e7b1b[_0x6cbe('0x3f')]||0x3;this[_0x6cbe('0x40')]=_0x9e7b1b[_0x6cbe('0x40')]||0x4;this[_0x6cbe('0x41')]=_0x9e7b1b[_0x6cbe('0x41')]?_0x9e7b1b['Trunk']:undefined;this[_0x6cbe('0x42')]=_0x9e7b1b[_0x6cbe('0x42')]?_0x9e7b1b[_0x6cbe('0x42')]:undefined;this[_0x6cbe('0x43')]=_0x9e7b1b['dialPrefix']||undefined;this['Interval']=_0x9e7b1b[_0x6cbe('0x44')]?_0x9e7b1b['Interval']:undefined;this[_0x6cbe('0x45')]=_0x9e7b1b[_0x6cbe('0x45')]||'DESC';this[_0x6cbe('0x46')]=_0x9e7b1b[_0x6cbe('0x46')]||undefined;this[_0x6cbe('0x47')]=_0x9e7b1b[_0x6cbe('0x47')]||undefined;this[_0x6cbe('0x48')]=strategy[_0x9e7b1b['strategy']]||_0x6cbe('0x49');this[_0x6cbe('0x4a')]=!![];this[_0x6cbe('0x4b')]=_0x9e7b1b[_0x6cbe('0x4b')]||![];this['dialAMDInitialSilence']=_0x9e7b1b[_0x6cbe('0x4c')];this['dialAMDGreeting']=_0x9e7b1b[_0x6cbe('0x4d')];this[_0x6cbe('0x4e')]=_0x9e7b1b[_0x6cbe('0x4e')];this[_0x6cbe('0x4f')]=_0x9e7b1b[_0x6cbe('0x4f')];this['dialAMDMinWordLength']=_0x9e7b1b[_0x6cbe('0x50')];this[_0x6cbe('0x51')]=_0x9e7b1b[_0x6cbe('0x51')];this[_0x6cbe('0x52')]=_0x9e7b1b[_0x6cbe('0x52')];this[_0x6cbe('0x53')]=_0x9e7b1b[_0x6cbe('0x53')];this[_0x6cbe('0x54')]=_0x9e7b1b['dialAMDMaximumWordLength'];this[_0x6cbe('0x55')]=0x0;this[_0x6cbe('0x56')]=0x0;this[_0x6cbe('0x57')]=_0x9e7b1b[_0x6cbe('0x57')];this[_0x6cbe('0x58')]=0x0;this[_0x6cbe('0x59')]=0x0;this[_0x6cbe('0x5a')]=0x0;this[_0x6cbe('0x5b')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x6cbe('0x5c')]=0x0;this[_0x6cbe('0x5d')]=0x0;this[_0x6cbe('0x5e')]=0x0;this[_0x6cbe('0x5f')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x6cbe('0x60')]=0x0;this[_0x6cbe('0x61')]=0x0;this['outboundReCallsDay']=0x0;this[_0x6cbe('0x62')]=0x0;this[_0x6cbe('0x63')]=undefined;this[_0x6cbe('0x64')]=undefined;this[_0x6cbe('0x65')]=undefined;this[_0x6cbe('0x66')]=1.05;this[_0x6cbe('0x67')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x6cbe('0x68')]=0x0;this[_0x6cbe('0x69')]=0x0;this[_0x6cbe('0x6a')]=0x0;this[_0x6cbe('0x6b')]=0x0;this[_0x6cbe('0x6c')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x6cbe('0x6d')]=_0x9e7b1b[_0x6cbe('0x6e')]||0x14;this[_0x6cbe('0x6f')]=_0x9e7b1b['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x6cbe('0x70')]=0x0;this[_0x6cbe('0x71')]=0x0;this[_0x6cbe('0x72')]=0x1;this[_0x6cbe('0x73')]=0x0;this[_0x6cbe('0x74')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x6cbe('0x75')]=0x0;this[_0x6cbe('0x76')]=_0x9e7b1b[_0x6cbe('0x76')]||0x1e;this[_0x6cbe('0x77')]=_0x9e7b1b[_0x6cbe('0x77')]||![];this[_0x6cbe('0x78')]=!!_0x9e7b1b[_0x6cbe('0x78')]||![];this[_0x6cbe('0x79')]=!!_0x9e7b1b[_0x6cbe('0x79')]||![];this[_0x6cbe('0x7a')]=_0x9e7b1b[_0x6cbe('0x7a')]||undefined;this[_0x6cbe('0x7b')]=_0x9e7b1b[_0x6cbe('0x7b')]||![];this['dialAgiAfterHangupAgent']=_0x9e7b1b[_0x6cbe('0x7c')]||![];this['monitor_format']=monitorFormat[_0x9e7b1b[_0x6cbe('0xc')]]?monitorFormat[_0x9e7b1b['monitor_format']]:undefined;this['mandatoryDisposition']=_0x9e7b1b[_0x6cbe('0x7d')]||![];this['mandatoryDispositionPause']=_0x9e7b1b[_0x6cbe('0x7e')]?_0x9e7b1b[_0x6cbe('0x7e')]:undefined;}module[_0x6cbe('0x7f')]=VoiceQueue; \ No newline at end of file +var _0x1b7f=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','unavailable','wav','wav49','gsm','rrmemory','name','monitor_format','type','answered','sumDuration','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1b7f,0x11f));var _0xf1b7=function(_0x2a779f,_0x4a5bbd){_0x2a779f=_0x2a779f-0x0;var _0x5021d3=_0x1b7f[_0x2a779f];return _0x5021d3;};'use strict';var statusDesc=[_0xf1b7('0x0'),'not_inuse',_0xf1b7('0x1'),'busy','invalid',_0xf1b7('0x2'),'ringing','ringinuse','onhold'];var monitorFormat={'wav':_0xf1b7('0x3'),'wav49':_0xf1b7('0x4'),'gsm':_0xf1b7('0x5')};var strategy={'rrmemory':_0xf1b7('0x6'),'roundrobin':'roundrobin'};function VoiceQueue(_0x224972){this['id']=_0x224972['id']||0x0;this[_0xf1b7('0x7')]=_0x224972[_0xf1b7('0x7')]||'';this[_0xf1b7('0x8')]=_0x224972[_0xf1b7('0x8')]||'';this[_0xf1b7('0x9')]=_0x224972[_0xf1b7('0x9')]||'inbound';this['waiting']=0x0;this['talking']=0x0;this['total']=0x0;this[_0xf1b7('0xa')]=0x0;this[_0xf1b7('0xb')]=0x0;this['sumHoldTime']=0x0;this[_0xf1b7('0xc')]=0x0;this[_0xf1b7('0xd')]=0x0;this['abandoned']=0x0;this[_0xf1b7('0xe')]=0x0;this[_0xf1b7('0xf')]=0x0;this[_0xf1b7('0x10')]=_0x224972['acw']||![];this[_0xf1b7('0x11')]=_0x224972[_0xf1b7('0x11')]||0xa;this[_0xf1b7('0x12')]=_0x224972[_0xf1b7('0x12')]||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0xf1b7('0x13')]=0x0;this[_0xf1b7('0x14')]=0x0;this[_0xf1b7('0x15')]=_0x224972[_0xf1b7('0x15')]||null;this[_0xf1b7('0x16')]=_0x224972['dialGlobalInterval']?_0x224972[_0xf1b7('0x16')]:null;this['dialActive']=_0x224972[_0xf1b7('0x17')];this[_0xf1b7('0x18')]=_0x224972[_0xf1b7('0x18')]||'progressive';this[_0xf1b7('0x19')]=_0x224972[_0xf1b7('0x19')]||0x0;this['dialLimitQueue']=_0x224972[_0xf1b7('0x1a')]||0x0;this[_0xf1b7('0x1b')]=_0x224972[_0xf1b7('0x1b')]||0x1;this[_0xf1b7('0x1c')]=_0x224972[_0xf1b7('0x1c')]||_0xf1b7('0x1d');this[_0xf1b7('0x1e')]=_0x224972['dialPredictiveOptimizationPercentage']||0.03;this[_0xf1b7('0x1f')]=_0x224972['dialPredictiveInterval']||0x258;this[_0xf1b7('0x20')]=_0x224972[_0xf1b7('0x20')]||_0xf1b7('0x21');this[_0xf1b7('0x22')]=_0x224972['dialOriginateCallerIdNumber']||_0xf1b7('0x21');this[_0xf1b7('0x23')]=_0x224972[_0xf1b7('0x23')]||0x1e;this[_0xf1b7('0x24')]=_0x224972[_0xf1b7('0x24')]||_0xf1b7('0x25');this[_0xf1b7('0x26')]=_0x224972[_0xf1b7('0x26')]||0x3;this[_0xf1b7('0x27')]=_0x224972['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x224972[_0xf1b7('0x28')]||0x3;this['dialCongestionRetryFrequency']=_0x224972['dialCongestionRetryFrequency']||0x96;this[_0xf1b7('0x29')]=_0x224972[_0xf1b7('0x29')]||0x3;this[_0xf1b7('0x2a')]=_0x224972[_0xf1b7('0x2a')]||0x96;this[_0xf1b7('0x2b')]=_0x224972[_0xf1b7('0x2b')]||0x3;this[_0xf1b7('0x2c')]=_0x224972['dialNoAnswerRetryFrequency']||0x96;this[_0xf1b7('0x2d')]=_0x224972['dialNoSuchNumberMaxRetry']||0x3;this[_0xf1b7('0x2e')]=_0x224972[_0xf1b7('0x2e')]||0x96;this['dialDropMaxRetry']=_0x224972['dialDropMaxRetry']||0x3;this[_0xf1b7('0x2f')]=_0x224972[_0xf1b7('0x2f')]||0x96;this[_0xf1b7('0x30')]=_0x224972[_0xf1b7('0x30')]||0x3;this[_0xf1b7('0x31')]=_0x224972[_0xf1b7('0x31')]||0x96;this[_0xf1b7('0x32')]=_0x224972[_0xf1b7('0x32')]||0x3;this[_0xf1b7('0x33')]=_0x224972['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x224972[_0xf1b7('0x34')]||0x3;this[_0xf1b7('0x35')]=_0x224972[_0xf1b7('0x35')]||0x96;this[_0xf1b7('0x36')]=_0x224972[_0xf1b7('0x36')]||0x3;this[_0xf1b7('0x37')]=_0x224972['dialGlobalMaxRetry']||0x4;this[_0xf1b7('0x38')]=_0x224972[_0xf1b7('0x38')]?_0x224972[_0xf1b7('0x38')]:undefined;this[_0xf1b7('0x39')]=_0x224972[_0xf1b7('0x39')]?_0x224972['TrunkBackup']:undefined;this[_0xf1b7('0x3a')]=_0x224972['dialPrefix']||undefined;this[_0xf1b7('0x3b')]=_0x224972[_0xf1b7('0x3b')]?_0x224972[_0xf1b7('0x3b')]:undefined;this[_0xf1b7('0x3c')]=_0x224972[_0xf1b7('0x3c')]||_0xf1b7('0x3d');this[_0xf1b7('0x3e')]=_0x224972[_0xf1b7('0x3e')]||undefined;this['dialCutDigit']=_0x224972[_0xf1b7('0x3f')]||undefined;this[_0xf1b7('0x40')]=strategy[_0x224972['strategy']]||_0xf1b7('0x6');this[_0xf1b7('0x41')]=!![];this[_0xf1b7('0x42')]=_0x224972['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x224972[_0xf1b7('0x43')];this[_0xf1b7('0x44')]=_0x224972[_0xf1b7('0x44')];this[_0xf1b7('0x45')]=_0x224972[_0xf1b7('0x45')];this[_0xf1b7('0x46')]=_0x224972[_0xf1b7('0x46')];this[_0xf1b7('0x47')]=_0x224972[_0xf1b7('0x47')];this[_0xf1b7('0x48')]=_0x224972[_0xf1b7('0x48')];this[_0xf1b7('0x49')]=_0x224972[_0xf1b7('0x49')];this[_0xf1b7('0x4a')]=_0x224972['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x224972['dialAMDMaximumWordLength'];this[_0xf1b7('0x4b')]=0x0;this[_0xf1b7('0x4c')]=0x0;this[_0xf1b7('0x4d')]=_0x224972['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0xf1b7('0x4e')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xf1b7('0x4f')]=0x0;this[_0xf1b7('0x50')]=0x0;this[_0xf1b7('0x51')]=0x0;this[_0xf1b7('0x52')]=0x0;this[_0xf1b7('0x53')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xf1b7('0x54')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xf1b7('0x55')]=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0xf1b7('0x56')]=undefined;this[_0xf1b7('0x57')]=undefined;this[_0xf1b7('0x58')]=1.05;this[_0xf1b7('0x59')]=0x0;this[_0xf1b7('0x5a')]=0x0;this[_0xf1b7('0x5b')]=0x0;this[_0xf1b7('0x5c')]=0x0;this[_0xf1b7('0x5d')]=0x0;this[_0xf1b7('0x5e')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xf1b7('0x5f')]=_0x224972['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xf1b7('0x60')]=_0x224972['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xf1b7('0x61')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xf1b7('0x62')]=0x1;this[_0xf1b7('0x63')]=0x0;this[_0xf1b7('0x64')]=0x0;this[_0xf1b7('0x65')]=0x0;this[_0xf1b7('0x66')]=0x0;this['dialRecallMeTimeout']=_0x224972[_0xf1b7('0x67')]||0x1e;this['dialRecallInQueue']=_0x224972[_0xf1b7('0x68')]||![];this[_0xf1b7('0x69')]=!!_0x224972[_0xf1b7('0x69')]||![];this[_0xf1b7('0x6a')]=!!_0x224972[_0xf1b7('0x6a')]||![];this[_0xf1b7('0x6b')]=_0x224972[_0xf1b7('0x6b')]||undefined;this[_0xf1b7('0x6c')]=_0x224972['dialAgiAfterHangupClient']||![];this[_0xf1b7('0x6d')]=_0x224972[_0xf1b7('0x6d')]||![];this[_0xf1b7('0x8')]=monitorFormat[_0x224972[_0xf1b7('0x8')]]?monitorFormat[_0x224972['monitor_format']]:undefined;this[_0xf1b7('0x6e')]=_0x224972[_0xf1b7('0x6e')]||![];this[_0xf1b7('0x6f')]=_0x224972[_0xf1b7('0x6f')]?_0x224972[_0xf1b7('0x6f')]:undefined;}module[_0xf1b7('0x70')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 257bb6d..e5b2e31 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 _0x0d37=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x43a995,_0x2921f7){var _0x24d91b=function(_0x1c4f86){while(--_0x1c4f86){_0x43a995['push'](_0x43a995['shift']());}};_0x24d91b(++_0x2921f7);}(_0x0d37,0x1ba));var _0x70d3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0d37[_0x321bb2];return _0x9c12ed;};'use strict';function VtigerAccount(_0x4fcd5c){this['id']=_0x4fcd5c['id']||0x0;this[_0x70d3('0x0')]=_0x4fcd5c['name']||'';this[_0x70d3('0x1')]=_0x4fcd5c[_0x70d3('0x1')]||'';this[_0x70d3('0x2')]=_0x4fcd5c['accessKey']||'';this[_0x70d3('0x3')]=_0x4fcd5c[_0x70d3('0x3')]||'';this[_0x70d3('0x4')]=_0x4fcd5c[_0x70d3('0x4')]||'';this[_0x70d3('0x5')]=_0x4fcd5c[_0x70d3('0x5')]||{};}module[_0x70d3('0x6')]=VtigerAccount; \ No newline at end of file +var _0x5ade=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x29c680,_0x1ce209){var _0x370475=function(_0x4942bb){while(--_0x4942bb){_0x29c680['push'](_0x29c680['shift']());}};_0x370475(++_0x1ce209);}(_0x5ade,0x14e));var _0xe5ad=function(_0x1fa7c6,_0x24f7b5){_0x1fa7c6=_0x1fa7c6-0x0;var _0x43a6cd=_0x5ade[_0x1fa7c6];return _0x43a6cd;};'use strict';function VtigerAccount(_0x241c02){this['id']=_0x241c02['id']||0x0;this[_0xe5ad('0x0')]=_0x241c02[_0xe5ad('0x0')]||'';this[_0xe5ad('0x1')]=_0x241c02[_0xe5ad('0x1')]||'';this[_0xe5ad('0x2')]=_0x241c02[_0xe5ad('0x2')]||'';this[_0xe5ad('0x3')]=_0x241c02['remoteUri']||'';this[_0xe5ad('0x4')]=_0x241c02[_0xe5ad('0x4')]||'';this[_0xe5ad('0x5')]=_0x241c02[_0xe5ad('0x5')]||{};}module[_0xe5ad('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 bcd41ac..d2975aa 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 _0x9d1e=['password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x9d1e,0xbc));var _0xe9d1=function(_0x1e61f7,_0x9acdc){_0x1e61f7=_0x1e61f7-0x0;var _0x279354=_0x9d1e[_0x1e61f7];return _0x279354;};'use strict';function ZendeskAccount(_0x43a245){this['id']=_0x43a245['id']||0x0;this['name']=_0x43a245[_0xe9d1('0x0')]||'';this[_0xe9d1('0x1')]=_0x43a245[_0xe9d1('0x1')]||'';this['password']=_0x43a245[_0xe9d1('0x2')]||'';this[_0xe9d1('0x3')]=_0x43a245[_0xe9d1('0x3')]||'';this[_0xe9d1('0x4')]=_0x43a245[_0xe9d1('0x4')]||'';this[_0xe9d1('0x5')]=_0x43a245[_0xe9d1('0x5')]||'';this[_0xe9d1('0x6')]=_0x43a245['type']||_0xe9d1('0x7');this[_0xe9d1('0x8')]=_0x43a245[_0xe9d1('0x8')]||'';this[_0xe9d1('0x9')]=_0x43a245[_0xe9d1('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x61f2=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0x20b504,_0x330c27){var _0x237692=function(_0x21e7c3){while(--_0x21e7c3){_0x20b504['push'](_0x20b504['shift']());}};_0x237692(++_0x330c27);}(_0x61f2,0x1d1));var _0x261f=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x61f2[_0x9df060];return _0x338dfe;};'use strict';function ZendeskAccount(_0xc7ac3){this['id']=_0xc7ac3['id']||0x0;this[_0x261f('0x0')]=_0xc7ac3[_0x261f('0x0')]||'';this[_0x261f('0x1')]=_0xc7ac3[_0x261f('0x1')]||'';this[_0x261f('0x2')]=_0xc7ac3[_0x261f('0x2')]||'';this['token']=_0xc7ac3[_0x261f('0x3')]||'';this[_0x261f('0x4')]=_0xc7ac3[_0x261f('0x4')]||'';this[_0x261f('0x5')]=_0xc7ac3[_0x261f('0x5')]||'';this[_0x261f('0x6')]=_0xc7ac3[_0x261f('0x6')]||_0x261f('0x7');this[_0x261f('0x8')]=_0xc7ac3['serverUrl']||'';this['Configurations']=_0xc7ac3[_0x261f('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index c1d81ae..60eb9d5 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 _0x3611=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x268396,_0x864c1c){var _0x2d7b5d=function(_0x4a3a6a){while(--_0x4a3a6a){_0x268396['push'](_0x268396['shift']());}};_0x2d7b5d(++_0x864c1c);}(_0x3611,0xfe));var _0x1361=function(_0x3654d7,_0x15cf2e){_0x3654d7=_0x3654d7-0x0;var _0xeba933=_0x3611[_0x3654d7];return _0xeba933;};'use strict';function ZohoAccount(_0x391b43){this['id']=_0x391b43['id']||0x0;this[_0x1361('0x0')]=_0x391b43[_0x1361('0x0')]||'';this[_0x1361('0x1')]=_0x391b43['description']||'';this[_0x1361('0x2')]=_0x391b43[_0x1361('0x2')]||'';this[_0x1361('0x3')]=_0x391b43[_0x1361('0x3')]||'';this[_0x1361('0x4')]=_0x391b43['clientId']||'';this[_0x1361('0x5')]=_0x391b43[_0x1361('0x5')]||'';this['serverUrl']=_0x391b43[_0x1361('0x6')]||'';this[_0x1361('0x7')]=_0x391b43[_0x1361('0x7')]||'';this[_0x1361('0x8')]=_0x391b43[_0x1361('0x8')]||'';this[_0x1361('0x9')]=_0x391b43['Configurations']||{};}module[_0x1361('0xa')]=ZohoAccount; \ No newline at end of file +var _0xb456=['serverUrl','code','refreshToken','exports','name','description','host','clientId','clientSecret'];(function(_0x547ba7,_0x522bf2){var _0x20513a=function(_0xeb2db5){while(--_0xeb2db5){_0x547ba7['push'](_0x547ba7['shift']());}};_0x20513a(++_0x522bf2);}(_0xb456,0x13f));var _0x6b45=function(_0x36d408,_0x29def2){_0x36d408=_0x36d408-0x0;var _0x3a37c8=_0xb456[_0x36d408];return _0x3a37c8;};'use strict';function ZohoAccount(_0x521788){this['id']=_0x521788['id']||0x0;this['name']=_0x521788[_0x6b45('0x0')]||'';this[_0x6b45('0x1')]=_0x521788[_0x6b45('0x1')]||'';this['host']=_0x521788[_0x6b45('0x2')]||'';this['zone']=_0x521788['zone']||'';this['clientId']=_0x521788[_0x6b45('0x3')]||'';this['clientSecret']=_0x521788[_0x6b45('0x4')]||'';this[_0x6b45('0x5')]=_0x521788['serverUrl']||'';this[_0x6b45('0x6')]=_0x521788[_0x6b45('0x6')]||'';this[_0x6b45('0x7')]=_0x521788[_0x6b45('0x7')]||'';this['Configurations']=_0x521788['Configurations']||{};}module[_0x6b45('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 d2431ae..5f70587 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 _0xb03e=['format','SIP/%s','calleridname','Contact','phone','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','number','exports','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent'];(function(_0x3e3064,_0x3dd6f5){var _0x4547e1=function(_0x785d07){while(--_0x785d07){_0x3e3064['push'](_0x3e3064['shift']());}};_0x4547e1(++_0x3dd6f5);}(_0xb03e,0x1eb));var _0xeb03=function(_0x1524e4,_0x5b01a8){_0x1524e4=_0x1524e4-0x0;var _0x4de023=_0xb03e[_0x1524e4];return _0x4de023;};'use strict';var util=require('util');var _=require(_0xeb03('0x0'));var moment=require(_0xeb03('0x1'));function checkNameSurname(_0x868905,_0x3c5e68,_0x1c58b5){var _0x2db660='';if(!_[_0xeb03('0x2')](_0x3c5e68)&&_0xeb03('0x3')===typeof _0x3c5e68){_0x2db660+=_0x3c5e68;}if(!_[_0xeb03('0x2')](_0x1c58b5)&&_0xeb03('0x3')===typeof _0x1c58b5){_0x2db660+='\x20'+_0x1c58b5;}if(_0x2db660!==''){return _0x2db660;}return _0x868905;}function Action(_0x88925b,_0xee2291,_0x4e1cea,_0x3b58a2,_0x3d3322){this[_0xeb03('0x4')]=_0x4e1cea||undefined;this[_0xeb03('0x5')]=_0x88925b['id'];this[_0xeb03('0x6')]=_0xee2291[_0xeb03('0x7')];this['type']=_0xee2291[_0xeb03('0x8')];this[_0xeb03('0x9')]=_0xeb03('0x6');this['dialAnswer']=![];this[_0xeb03('0xa')]=_['isNil'](_0x88925b[_0xeb03('0xb')])?undefined:_0x88925b[_0xeb03('0xb')][_0xeb03('0x7')];this[_0xeb03('0xc')]=this[_0xeb03('0xa')]?util[_0xeb03('0xd')](_0xeb03('0xe'),this[_0xeb03('0xa')]):_0x3b58a2||undefined;this[_0xeb03('0xf')]=checkNameSurname(_0x88925b[_0xeb03('0x10')][_0xeb03('0x11')],_0x88925b[_0xeb03('0x10')]['firstName'],_0x88925b[_0xeb03('0x10')][_0xeb03('0x12')]);this[_0xeb03('0x13')]=_0x88925b[_0xeb03('0x13')]||![];this['calleridnum']=_0x88925b[_0xeb03('0x11')];this[_0xeb03('0x14')]=_0x88925b[_0xeb03('0x14')];this['countbusyretry']=_0x88925b[_0xeb03('0x15')]||0x0;this[_0xeb03('0x16')]=_0x88925b[_0xeb03('0x16')]||0x0;this[_0xeb03('0x17')]=_0x88925b[_0xeb03('0x17')]||0x0;this[_0xeb03('0x18')]=(_0x88925b[_0xeb03('0x15')]||0x0)+(_0x88925b[_0xeb03('0x16')]||0x0)+(_0x88925b[_0xeb03('0x17')]||0x0)+(_0x88925b[_0xeb03('0x19')]||0x0)+(_0x88925b[_0xeb03('0x1a')]||0x0)+(_0x88925b[_0xeb03('0x1b')]||0x0)+(_0x88925b[_0xeb03('0x1c')]||0x0)+(_0x88925b[_0xeb03('0x1d')]||0x0);this['countnosuchnumberretry']=_0x88925b[_0xeb03('0x19')]||0x0;this[_0xeb03('0x1a')]=_0x88925b[_0xeb03('0x1a')]||0x0;this[_0xeb03('0x1b')]=_0x88925b[_0xeb03('0x1b')]||0x0;this[_0xeb03('0x1c')]=_0x88925b[_0xeb03('0x1c')]||0x0;this[_0xeb03('0x1d')]=_0x88925b[_0xeb03('0x1d')]||0x0;this['callback']=_0x88925b[_0xeb03('0x1e')];this[_0xeb03('0x1f')]=_0x88925b[_0xeb03('0x1f')];this[_0xeb03('0x20')]=_0x88925b[_0xeb03('0x20')];this['recallme']=_0x88925b[_0xeb03('0x21')];this[_0xeb03('0x22')]=_0x88925b[_0xeb03('0x22')];this[_0xeb03('0x23')]=_0x88925b[_0xeb03('0x23')];this[_0xeb03('0x24')]=_[_0xeb03('0x2')](_0x88925b[_0xeb03('0xb')])?_0x88925b[_0xeb03('0x24')]:_0x88925b['Agent']['id'];this[_0xeb03('0x25')]=_0x88925b[_0xeb03('0x25')];this[_0xeb03('0x26')]='';this[_0xeb03('0x27')]='';}Action['prototype']['getCaller']=function(){return util[_0xeb03('0xd')]('\x22%s\x22\x20<%s>',this[_0xeb03('0xf')],this[_0xeb03('0x28')]);};module[_0xeb03('0x29')]=Action; \ No newline at end of file +var _0xb44a=['recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','calleridname','number','exports','moment','isNil','string','uniqueid','idContact','queue','name','type','membername','Agent','channelAgent','format','SIP/%s','Contact','lastName','active','calleridnum','phone','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat'];(function(_0x34986b,_0x56fb4a){var _0x28a0d1=function(_0x2c1e2a){while(--_0x2c1e2a){_0x34986b['push'](_0x34986b['shift']());}};_0x28a0d1(++_0x56fb4a);}(_0xb44a,0x1c2));var _0xab44=function(_0x26bf51,_0x5e261a){_0x26bf51=_0x26bf51-0x0;var _0x503415=_0xb44a[_0x26bf51];return _0x503415;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xab44('0x0'));function checkNameSurname(_0x492c1a,_0x186fec,_0x5c825d){var _0x50cb3c='';if(!_[_0xab44('0x1')](_0x186fec)&&'string'===typeof _0x186fec){_0x50cb3c+=_0x186fec;}if(!_[_0xab44('0x1')](_0x5c825d)&&_0xab44('0x2')===typeof _0x5c825d){_0x50cb3c+='\x20'+_0x5c825d;}if(_0x50cb3c!==''){return _0x50cb3c;}return _0x492c1a;}function Action(_0x2e3662,_0x28681a,_0x2f3948,_0x3303b1,_0x3ead8d){this[_0xab44('0x3')]=_0x2f3948||undefined;this[_0xab44('0x4')]=_0x2e3662['id'];this[_0xab44('0x5')]=_0x28681a[_0xab44('0x6')];this[_0xab44('0x7')]=_0x28681a[_0xab44('0x7')];this['campaigntype']=_0xab44('0x5');this['dialAnswer']=![];this[_0xab44('0x8')]=_['isNil'](_0x2e3662['Agent'])?undefined:_0x2e3662[_0xab44('0x9')][_0xab44('0x6')];this[_0xab44('0xa')]=this[_0xab44('0x8')]?util[_0xab44('0xb')](_0xab44('0xc'),this['membername']):_0x3303b1||undefined;this['calleridname']=checkNameSurname(_0x2e3662[_0xab44('0xd')]['phone'],_0x2e3662[_0xab44('0xd')]['firstName'],_0x2e3662[_0xab44('0xd')][_0xab44('0xe')]);this[_0xab44('0xf')]=_0x2e3662[_0xab44('0xf')]||![];this[_0xab44('0x10')]=_0x2e3662[_0xab44('0x11')];this['scheduledat']=_0x2e3662['scheduledat'];this[_0xab44('0x12')]=_0x2e3662[_0xab44('0x12')]||0x0;this[_0xab44('0x13')]=_0x2e3662[_0xab44('0x13')]||0x0;this[_0xab44('0x14')]=_0x2e3662[_0xab44('0x14')]||0x0;this[_0xab44('0x15')]=(_0x2e3662[_0xab44('0x12')]||0x0)+(_0x2e3662[_0xab44('0x13')]||0x0)+(_0x2e3662[_0xab44('0x14')]||0x0)+(_0x2e3662[_0xab44('0x16')]||0x0)+(_0x2e3662['countdropretry']||0x0)+(_0x2e3662[_0xab44('0x17')]||0x0)+(_0x2e3662[_0xab44('0x18')]||0x0)+(_0x2e3662[_0xab44('0x19')]||0x0);this[_0xab44('0x16')]=_0x2e3662[_0xab44('0x16')]||0x0;this['countdropretry']=_0x2e3662[_0xab44('0x1a')]||0x0;this['countabandonedretry']=_0x2e3662[_0xab44('0x17')]||0x0;this[_0xab44('0x18')]=_0x2e3662[_0xab44('0x18')]||0x0;this[_0xab44('0x19')]=_0x2e3662['countagentrejectretry']||0x0;this[_0xab44('0x1b')]=_0x2e3662[_0xab44('0x1b')];this[_0xab44('0x1c')]=_0x2e3662[_0xab44('0x1c')];this[_0xab44('0x1d')]=_0x2e3662[_0xab44('0x1d')];this[_0xab44('0x1e')]=_0x2e3662['recallme'];this['ContactId']=_0x2e3662[_0xab44('0x1f')];this['ListId']=_0x2e3662[_0xab44('0x20')];this['UserId']=_[_0xab44('0x1')](_0x2e3662['Agent'])?_0x2e3662['UserId']:_0x2e3662[_0xab44('0x9')]['id'];this[_0xab44('0x21')]=_0x2e3662[_0xab44('0x21')];this[_0xab44('0x22')]='';this[_0xab44('0x23')]='';}Action['prototype'][_0xab44('0x24')]=function(){return util[_0xab44('0xb')]('\x22%s\x22\x20<%s>',this[_0xab44('0x25')],this[_0xab44('0x26')]);};module[_0xab44('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 87b99e1..27860d9 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 _0x0465=['ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','outboundBlacklistCallsDay','[Blacklist][error]','SIP/%s','status','reachable','execRun','unlock','unlockContact','disableContact','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','execCall','SIP/%s/%s%s','trim','dialCutDigit','substring','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','originatecalleridname','originatecalleridnum','addVariables','merge','toLowerVariables','variables','[originated][increment]','OriginateError','logLookAgent','lookAgent','clone','response','custom:agentringnoanswer','callProgressDetectingAgent','Answer','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','transfer','reason','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','addVariable','keys','variable','[syncVarSet][Preview]','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','util','lodash','uuid','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','hanguprequest','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','stringify','md5','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','available','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','logger','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','size','recallMe','getContactRecallMe','agentReadyId','then','isNil','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','callAdditionalPhoneAfterMin','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','additional','dialBusyMaxRetry','countnoanswerretry','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countagentrejectretry','dialAgentRejectRetryFrequency'];(function(_0x222361,_0x1e350d){var _0x50814b=function(_0x1bc6ef){while(--_0x1bc6ef){_0x222361['push'](_0x222361['shift']());}};_0x50814b(++_0x1e350d);}(_0x0465,0x1cf));var _0x5046=function(_0x1800f7,_0x517232){_0x1800f7=_0x1800f7-0x0;var _0x518c0c=_0x0465[_0x1800f7];return _0x518c0c;};'use strict';var util=require(_0x5046('0x0'));var _=require(_0x5046('0x1'));var uuid=require(_0x5046('0x2'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x5046('0x3'));var config=require(_0x5046('0x4'));var logger=require('../../../config/logger')(_0x5046('0x5'));var loggerAction=require(_0x5046('0x6'))(_0x5046('0x7'));var ami=require('../ami');var rpcDb=require(_0x5046('0x8'));var cmHopperAdditionalPhone=require(_0x5046('0x9'));var Action=require(_0x5046('0xa'));var ut=require(_0x5046('0xb'));config[_0x5046('0xc')]=_[_0x5046('0xd')](config[_0x5046('0xc')],{'host':_0x5046('0xe'),'port':0x18eb});var io=require(_0x5046('0xf'))(new Redis(config[_0x5046('0xc')]));var Sequence=function(){};Sequence[_0x5046('0x10')][_0x5046('0x11')]=function(_0x44827d){this[_0x5046('0x12')]=this['tail']?this[_0x5046('0x12')][_0x5046('0x13')](_0x44827d):_0x44827d();};function Preview(_0x556ce1){this[_0x5046('0x14')]=new Sequence();this[_0x5046('0x15')]=_0x556ce1[_0x5046('0x16')];this['trunks']=_0x556ce1[_0x5046('0x17')];this[_0x5046('0x18')]={};this[_0x5046('0x19')]=_0x556ce1[_0x5046('0x19')];this[_0x5046('0x1a')]=0x0;ami['on'](_0x5046('0x1b'),this[_0x5046('0x1c')][_0x5046('0x1d')](this));ami['on'](_0x5046('0x1e'),this['syncHangup'][_0x5046('0x1d')](this));ami['on'](_0x5046('0x1f'),this['syncHangupRequest'][_0x5046('0x1d')](this));ami['on'](_0x5046('0x20'),this[_0x5046('0x21')][_0x5046('0x1d')](this));ami['on']('newexten',this[_0x5046('0x22')]['bind'](this));ami['on'](_0x5046('0x23'),this[_0x5046('0x24')][_0x5046('0x1d')](this));ami['on'](_0x5046('0x25'),this[_0x5046('0x26')][_0x5046('0x1d')](this));ami['on'](_0x5046('0x27'),this['syncBlindTransfer'][_0x5046('0x1d')](this));this[_0x5046('0x28')](this['campaignsPreview']);}function emit(_0x3e80f6,_0x2ad173,_0x135995){io['to'](_0x3e80f6)[_0x5046('0x29')](_0x2ad173,_0x135995);}function emitCampaignPreview(_0x15b689){if(_0x15b689[_0x5046('0x2a')]===_0x5046('0x2b')){var _0x35d2fe={'id':_0x15b689['id'],'name':_0x15b689[_0x5046('0x2c')],'strategy':_0x15b689[_0x5046('0x2d')],'answered':_0x15b689[_0x5046('0x2e')],'available':_0x15b689['available'],'loggedIn':_0x15b689[_0x5046('0x2f')],'pTalking':_0x15b689[_0x5046('0x30')],'sumBillable':_0x15b689[_0x5046('0x31')],'sumDuration':_0x15b689[_0x5046('0x32')],'sumHoldTime':_0x15b689[_0x5046('0x33')]||0x0,'talking':_0x15b689[_0x5046('0x34')],'total':_0x15b689[_0x5046('0x35')],'type':_0x15b689[_0x5046('0x2a')],'unmanaged':_0x15b689[_0x5046('0x36')],'abandoned':_0x15b689[_0x5046('0x37')],'waiting':_0x15b689[_0x5046('0x38')],'loggedInDb':_0x15b689['loggedInDb'],'dialActive':_0x15b689[_0x5046('0x39')],'dialMethod':_0x15b689[_0x5046('0x3a')],'dialOriginateCallerIdName':_0x15b689[_0x5046('0x3b')],'dialOriginateCallerIdNumber':_0x15b689[_0x5046('0x3c')],'dialOriginateTimeout':_0x15b689['dialOriginateTimeout'],'dialPrefix':_0x15b689[_0x5046('0x3d')],'outboundAnswerAgiCallsDay':_0x15b689[_0x5046('0x3e')],'outboundAnswerCallsDay':_0x15b689[_0x5046('0x3f')],'outboundBlacklistCallsDay':_0x15b689['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x15b689[_0x5046('0x40')],'outboundCongestionCallsDay':_0x15b689[_0x5046('0x41')],'outboundDropCallsDayACS':_0x15b689['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x15b689[_0x5046('0x42')],'outboundDropCallsDayTimeout':_0x15b689[_0x5046('0x43')],'outboundNoAnswerCallsDay':_0x15b689[_0x5046('0x44')],'outboundNoSuchCallsDay':_0x15b689[_0x5046('0x45')],'outboundOriginateFailureCallsDay':_0x15b689[_0x5046('0x46')],'outboundReCallsDay':_0x15b689['outboundReCallsDay'],'outboundRejectCallsDay':_0x15b689[_0x5046('0x47')],'outboundUnknownCallsDay':_0x15b689[_0x5046('0x48')],'outboundAbandonedCallsDay':_0x15b689[_0x5046('0x49')],'predictiveIntervalAnsweredCalls':_0x15b689['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x15b689[_0x5046('0x4a')],'predictiveIntervalAvgTalktime':_0x15b689[_0x5046('0x4b')],'predictiveIntervalDroppedCallsCallersExit':_0x15b689[_0x5046('0x4c')],'predictiveIntervalDroppedCallsTimeout':_0x15b689['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x15b689[_0x5046('0x4d')],'predictiveIntervalErlangCallsDroppedCalls':_0x15b689[_0x5046('0x4e')],'predictiveIntervalHitRate':_0x15b689[_0x5046('0x4f')],'predictiveIntervalMultiplicativeFactor':_0x15b689[_0x5046('0x50')],'predictiveIntervalPauses':_0x15b689['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x15b689[_0x5046('0x51')],'predictiveIntervalTotalCalls':_0x15b689[_0x5046('0x52')],'message':_0x15b689[_0x5046('0x53')],'originated':_0x15b689['originated'],'erlangCalls':_0x15b689['erlangCalls'],'erlangCallToSecond':_0x15b689[_0x5046('0x54')],'erlangAbandonmentRate':_0x15b689[_0x5046('0x55')],'erlangBusyFactor':_0x15b689[_0x5046('0x56')],'startPredictive':_0x15b689['startPredictive'],'startProgressive':_0x15b689[_0x5046('0x57')]};if(_0x15b689[_0x5046('0x58')]){_0x35d2fe[_0x5046('0x58')]={'id':_0x15b689[_0x5046('0x58')]['id'],'name':_0x15b689['Trunk'][_0x5046('0x2c')],'active':_0x15b689[_0x5046('0x58')][_0x5046('0x59')],'callerid':_0x15b689[_0x5046('0x58')][_0x5046('0x5a')]};}if(_0x15b689['Interval']){_0x35d2fe[_0x5046('0x5b')]={'id':_0x15b689['Interval']['id'],'name':_0x15b689['Interval'][_0x5046('0x2c')]};}var _0xdbdc65=md5(JSON[_0x5046('0x5c')](_0x35d2fe));if(_0x15b689[_0x5046('0x5d')]!==_0xdbdc65){_0x15b689['md5']=_0xdbdc65;emit(util[_0x5046('0x5e')](_0x5046('0x5f'),_0x35d2fe[_0x5046('0x2c')]),_0x5046('0x60'),_0x35d2fe);}}}function emitVoiceQueueChannelRemove(_0x6c1249){logger[_0x5046('0x61')](_0x5046('0x62'),JSON[_0x5046('0x5c')](_0x6c1249));emit(util[_0x5046('0x5e')](_0x5046('0x5f'),_0x6c1249[_0x5046('0x2c')]),_0x5046('0x63'),_0x6c1249);io['emit'](_0x5046('0x64'),_0x6c1249);}function notSendMessagesQueue(_0x1b8b7c){if(_0x1b8b7c[_0x5046('0x65')]){if(_0x1b8b7c[_0x5046('0x66')]===0x0&&_0x1b8b7c['pTalking']===0x0){_0x1b8b7c[_0x5046('0x65')]=![];_0x1b8b7c[_0x5046('0x67')]=0x0;_0x1b8b7c[_0x5046('0x68')]=0x0;_0x1b8b7c['message']=_0x5046('0x69');ut['logger'](_0x5046('0x6a'),_0x1b8b7c[_0x5046('0x2c')]+'\x20is\x20not\x20active');}else{_0x1b8b7c[_0x5046('0x53')]=_0x5046('0x6b');ut[_0x5046('0x6c')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x1b8b7c[_0x5046('0x2c')]+'\x20is\x20deactivated');}emitCampaignPreview(_0x1b8b7c);}}Preview['prototype'][_0x5046('0x28')]=function(){var _0x53438c=this;setInterval(function(){_0x53438c[_0x5046('0x6d')]();},0x7cf);};Preview[_0x5046('0x10')]['syncCampaigns']=function(){var _0x1e63e8=this[_0x5046('0x15')];this[_0x5046('0x1a')]+=0x1;for(var _0x1b02e9 in _0x1e63e8){if(_0x1e63e8[_0x5046('0x6e')](_0x1b02e9)&&(_0x1e63e8[_0x1b02e9][_0x5046('0x3a')]==='preview'||_0x1e63e8[_0x1b02e9][_0x5046('0x3a')]===_0x5046('0x6f'))&&_0x1e63e8[_0x1b02e9][_0x5046('0x2a')]===_0x5046('0x2b')){if(this[_0x5046('0x1a')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x5046('0x70')]();}}if(_0x1e63e8['hasOwnProperty'](_0x1b02e9)&&_0x1e63e8[_0x1b02e9][_0x5046('0x3a')]==='preview'&&_0x1e63e8[_0x1b02e9][_0x5046('0x2a')]==='outbound'){if(_0x1e63e8[_0x1b02e9][_0x5046('0x39')]){this[_0x5046('0x71')](_0x1e63e8[_0x1b02e9]);if(_0x1e63e8[_0x1b02e9]['dialPreviewAutoRecallMe'])this['recallMe'](_0x1e63e8[_0x1b02e9]);}else{notSendMessagesQueue(_0x1e63e8[_0x1b02e9]);}}}};Preview[_0x5046('0x10')]['clearZombieChannel']=function(_0x275e59){var _0x23eec6=this;this[_0x5046('0x14')][_0x5046('0x11')](function(){if(!_['isNil'](_0x23eec6[_0x5046('0x18')][_0x275e59])){loggerAction['info']('[clearZombieChannels][talking]',_0x275e59,_0x5046('0x72'),_0x23eec6['actions'][_0x275e59][_0x5046('0x73')],_0x5046('0x74'),JSON[_0x5046('0x5c')](_0x23eec6[_0x5046('0x15')][_0x23eec6[_0x5046('0x18')][_0x275e59][_0x5046('0x73')]][_0x5046('0x66')]),_0x5046('0x75'),JSON[_0x5046('0x5c')](_0x23eec6[_0x5046('0x15')][_0x23eec6[_0x5046('0x18')][_0x275e59]['queue']][_0x5046('0x30')]),JSON[_0x5046('0x5c')](_0x23eec6[_0x5046('0x18')][_0x275e59][_0x5046('0x76')]),JSON[_0x5046('0x5c')](_[_0x5046('0x77')](_0x23eec6[_0x5046('0x18')][_0x275e59],[_0x5046('0x78'),_0x5046('0x79'),_0x5046('0x7a'),_0x5046('0x7b')])));return ami[_0x5046('0x7c')]({'action':'status','channel':_0x23eec6[_0x5046('0x18')][_0x275e59][_0x5046('0x7d')]})[_0x5046('0x7e')](function(_0x5ea228){if(_0x5ea228[_0x5046('0x53')]===_0x5046('0x7f')){setTimeout(function(){if(_0x23eec6[_0x5046('0x18')][_0x275e59]){ut[_0x5046('0x80')](_0x23eec6[_0x5046('0x15')][_0x23eec6[_0x5046('0x18')][_0x275e59][_0x5046('0x73')]],_0x5046('0x81'));if(_0x23eec6[_0x5046('0x18')][_0x275e59][_0x5046('0x76')]===!![]){ut[_0x5046('0x82')](_0x23eec6[_0x5046('0x15')][_0x23eec6[_0x5046('0x18')][_0x275e59][_0x5046('0x73')]],_0x5046('0x81'));ut[_0x5046('0x83')](_0x5046('0x84')+_0x275e59,_0x23eec6['actions'][_0x275e59][_0x5046('0x73')]);}ut[_0x5046('0x83')]('[Dialer][checkChannel][Preview]'+_0x275e59,_0x23eec6['actions'][_0x275e59][_0x5046('0x73')]);delete _0x23eec6[_0x5046('0x18')][_0x275e59];}},0x2328);}});}});};Preview[_0x5046('0x10')]['clearZombieChannels']=function(){var _0x277a0e=this;loggerAction[_0x5046('0x61')]('[action]',_[_0x5046('0x85')](this[_0x5046('0x18')]));for(var _0x429ada in this['actions']){if(_0x277a0e[_0x5046('0x18')][_0x5046('0x6e')](_0x429ada)){_0x277a0e['clearZombieChannel'](_0x429ada);}}};Preview[_0x5046('0x10')][_0x5046('0x86')]=function(_0x5d5830){var _0x483825=this;rpcDb[_0x5046('0x87')](_0x5d5830['id'],ut[_0x5046('0x88')](this[_0x5046('0x19')]))[_0x5046('0x89')](function(_0x4088f7){if(!_[_0x5046('0x8a')](_0x4088f7)){for(var _0x4b497d=0x0;_0x4b497d<_0x4088f7['length'];_0x4b497d+=0x1){if(ut[_0x5046('0x8b')](_0x4088f7[_0x4b497d][_0x5046('0x8c')])<_0x5d5830['dialRecallMeTimeout']*0x3c){if(_0x4088f7[_0x4b497d]['Agent']&&!_0x4088f7[_0x4b497d][_0x5046('0x8d')][_0x5046('0x8e')]){_0x483825[_0x5046('0x8f')](_0x4088f7[_0x4b497d]['id'])['then'](ut[_0x5046('0x90')](_0x5046('0x91')))[_0x5046('0x7e')](ut[_0x5046('0x90')](_0x5046('0x91')));}else{rpcDb['disableContact'](_0x4088f7[_0x4b497d]['id']);}}else{var _0x2707a0=new Action(_0x4088f7[_0x4b497d],_0x5d5830);_0x2707a0[_0x5046('0x92')]=moment()[_0x5046('0x5e')](_0x5046('0x93'));_0x5d5830[_0x5046('0x94')]+=0x1;ut[_0x5046('0x95')](_0x2707a0,0x17,_0x5046('0x96'));if(_0x5d5830[_0x5046('0x97')]){rpcDb[_0x5046('0x98')](ut['createBody'](_0x4088f7[_0x4b497d]));rpcDb[_0x5046('0x99')](_0x2707a0,_0x5046('0x9a'));}else{ut[_0x5046('0x95')](_0x2707a0,0x16,_0x5046('0x9b'));rpcDb[_0x5046('0x99')](_0x2707a0,_0x5046('0x9c'));rpcDb[_0x5046('0x9d')](_0x2707a0,_0x5046('0x9c'));}}}}})[_0x5046('0x7e')](ut[_0x5046('0x90')](_0x5046('0x9e')));};Preview[_0x5046('0x10')][_0x5046('0x71')]=function(_0x34c0c7){_0x34c0c7['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x34c0c7[_0x5046('0x2f')])){_0x34c0c7[_0x5046('0x53')]=_0x5046('0x9f');}else if(!ut[_0x5046('0xa0')](_0x34c0c7[_0x5046('0x39')])){_0x34c0c7['message']=_0x5046('0x69');}else if(!this[_0x5046('0xa1')](_0x34c0c7[_0x5046('0x58')])){if(!this[_0x5046('0xa1')](_0x34c0c7[_0x5046('0xa2')])){_0x34c0c7['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x34c0c7['message']=_0x5046('0xa3');}}else{_0x34c0c7[_0x5046('0x53')]='ACTIVE';}emitCampaignPreview(_0x34c0c7);};Preview[_0x5046('0x10')][_0x5046('0xa4')]=function(_0x1e1c4d,_0x50303d,_0xd33cb8){var _0x4e4661=this;var _0x419c6c=this['actions'][_0x50303d];var _0x191f2f=this['campaignsPreview'][_0x419c6c[_0x5046('0x73')]];var _0x288b06;var _0x304a8f=![];var _0x49b342=0x2;var _0x49619c=0x3;if(_0x191f2f){switch(_0xd33cb8){case'1':_0x191f2f[_0x5046('0x45')]+=0x1;_0x419c6c[_0x5046('0xa5')]+=0x1;_0x419c6c[_0x5046('0xa6')]=ut[_0x5046('0xa7')](_0x419c6c);ut[_0x5046('0x95')](_0x419c6c,0x0,_0x5046('0xa8'));ami[_0x5046('0x29')](_0x5046('0xa9'),ut[_0x5046('0xaa')](_0x419c6c,'nosuchnumber'));rpcDb[_0x5046('0x99')](_0x419c6c,_0x5046('0xab'));_0x4e4661['verifyAdditionalPhones'](_0x419c6c,'0',_0x191f2f)[_0x5046('0x89')](function(_0x4e80d9){_0x304a8f=_0x4e80d9['additional']==0x1;_0x49b342=_0x191f2f['dialNoSuchNumberRetryFrequency'];_0x49619c=_0x191f2f[_0x5046('0xac')];if(!_0x304a8f){if(ut[_0x5046('0xa7')](_0x419c6c)>=_0x191f2f['dialGlobalMaxRetry']){_0x288b06=ut[_0x5046('0xad')](_0x419c6c,0xf,'Global');rpcDb['createCustomerFinal'](_0x288b06,_0x5046('0xae'));}else{if(_0x419c6c[_0x5046('0xa5')]>=_0x191f2f[_0x5046('0xaf')]){rpcDb['createCustomerFinal'](_0x419c6c,_0x5046('0xae'));}else{rpcDb[_0x5046('0xb0')](ut[_0x5046('0xb1')](_0x419c6c,_0x5046('0xa5'),_0x191f2f['dialNoSuchNumberRetryFrequency']),_0x419c6c[_0x5046('0xb2')],_0x419c6c[_0x5046('0xb3')]);}}delete this[_0x5046('0x18')][_0x1e1c4d[_0x5046('0xb4')]];}else{_0x419c6c[_0x5046('0xa5')]++;logger[_0x5046('0x61')](_0x5046('0xb5'),_0x419c6c['countnosuchnumberretry']);logger[_0x5046('0x61')]('id',_0x419c6c[_0x5046('0xb6')]);_0x4e4661[_0x5046('0xb7')]({'id':_0x419c6c['idContact'],'field':{'countnosuchnumberretry':_0x419c6c[_0x5046('0xa5')]}})[_0x5046('0x89')](function(){_0x4e4661[_0x5046('0xb8')](_0x419c6c,_0x49b342,_0x49619c)[_0x5046('0x89')](function(){});});}});break;case _0x5046('0xb9'):var _0x2972c2=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x419c6c[_0x5046('0xba')]=_0x2972c2;_0x419c6c[_0x5046('0xbb')]=_0x2972c2;_0x419c6c['dialAnswer']=!![];_0x191f2f[_0x5046('0x30')]+=0x1;logger[_0x5046('0x61')]('[syncHangup][talking][increment]',_0x419c6c[_0x5046('0xbc')],_0x5046('0xbd'),_0x191f2f[_0x5046('0x2c')],_0x5046('0x75'),_0x191f2f['pTalking']);ami[_0x5046('0x29')](_0x5046('0xbe'),ut[_0x5046('0xaa')](_0x419c6c,'connect',this[_0x5046('0x15')][_0x419c6c[_0x5046('0x73')]]));if(_0x191f2f[_0x5046('0xbf')]){ami['emit'](_0x5046('0xc0'),ut[_0x5046('0xc1')](_0x419c6c));}break;case'16':ami[_0x5046('0x29')]('custom:agentcomplete',ut[_0x5046('0xaa')](_0x419c6c,_0x5046('0xc2'),this[_0x5046('0x15')][_0x419c6c[_0x5046('0x73')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x419c6c,_0x5046('0xc2')));_0x191f2f[_0x5046('0x3f')]+=0x1;_0x191f2f[_0x5046('0x35')]+=0x1;_0x191f2f[_0x5046('0x2e')]+=0x1;ut[_0x5046('0x82')](_0x191f2f,_0x5046('0xc3'));_0x419c6c['countglobal']=ut[_0x5046('0xa7')](_0x419c6c);ut[_0x5046('0x95')](_0x419c6c,0x4,'Answer');rpcDb[_0x5046('0x99')](_0x419c6c,_0x5046('0xc4'));rpcDb[_0x5046('0x9d')](_0x419c6c,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x5046('0xc5')](_0x419c6c);_0x191f2f[_0x5046('0x32')]+=_0x419c6c['talktime'];_0x191f2f[_0x5046('0x31')]+=_0x419c6c[_0x5046('0xc6')];logger[_0x5046('0x61')](_0x5046('0xc7'),_0x419c6c['uniqueid'],_0x5046('0xbd'),_0x191f2f[_0x5046('0x2c')],_0x5046('0x75'),_0x191f2f[_0x5046('0x30')]);delete this[_0x5046('0x18')][_0x1e1c4d[_0x5046('0xb4')]];break;case _0x5046('0xc8'):_0x191f2f[_0x5046('0x40')]+=0x1;_0x419c6c[_0x5046('0xc9')]+=0x1;_0x419c6c['countglobal']=ut[_0x5046('0xa7')](_0x419c6c);ut[_0x5046('0x95')](_0x419c6c,0x5,'Busy');_0x49b342=_0x191f2f[_0x5046('0xca')];_0x49619c=_0x191f2f['callAdditionalPhoneAfterMin'];ami[_0x5046('0x29')](_0x5046('0xcb'),ut[_0x5046('0xaa')](_0x419c6c,_0x5046('0xcc')));rpcDb[_0x5046('0x99')](_0x419c6c,_0x5046('0xcd'));_0x4e4661[_0x5046('0xce')](_0x419c6c,'5',_0x191f2f)[_0x5046('0x89')](function(_0x3e0edf){_0x304a8f=_0x3e0edf[_0x5046('0xcf')]==0x1;if(!_0x304a8f){if(ut['totalGlobal'](_0x419c6c)>=_0x191f2f['dialGlobalMaxRetry']){_0x288b06=ut[_0x5046('0xad')](_0x419c6c,0xf,'Global');rpcDb[_0x5046('0x9d')](_0x288b06,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x419c6c[_0x5046('0xc9')]>=_0x191f2f[_0x5046('0xd0')]){rpcDb[_0x5046('0x9d')](_0x419c6c,_0x5046('0xcd'));}else{rpcDb[_0x5046('0xb0')](ut[_0x5046('0xb1')](_0x419c6c,_0x5046('0xc9'),_0x191f2f[_0x5046('0xca')]),_0x419c6c[_0x5046('0xb2')],_0x419c6c[_0x5046('0xb3')]);}}}else{_0x419c6c[_0x5046('0xc9')]++;_0x4e4661['incrementPreviewCounters']({'id':_0x419c6c['idContact'],'field':{'countbusyretry':_0x419c6c['countbusyretry']}})[_0x5046('0x89')](function(){_0x4e4661['swapAdditionalPhones'](_0x419c6c,_0x49b342,_0x49619c)[_0x5046('0x89')](function(){});});}});break;case'NOANSWER':_0x191f2f[_0x5046('0x44')]+=0x1;_0x419c6c[_0x5046('0xd1')]+=0x1;_0x419c6c[_0x5046('0xa6')]=ut[_0x5046('0xa7')](_0x419c6c);ut[_0x5046('0x95')](_0x419c6c,0x3,_0x5046('0xd2'));_0x49b342=_0x191f2f['dialNoAnswerRetryFrequency'];_0x49619c=_0x191f2f[_0x5046('0xac')];var _0x5e7d13=ut[_0x5046('0xd3')](_0x419c6c,_0x191f2f);ami[_0x5046('0x29')](_0x5046('0xd4'),_0x5e7d13);rpcDb[_0x5046('0x99')](_0x419c6c,_0x5046('0xd5'));_0x4e4661['verifyAdditionalPhones'](_0x419c6c,'3',_0x191f2f)['then'](function(_0xcfb78d){_0x304a8f=_0xcfb78d[_0x5046('0xcf')]==0x1;if(!_0x304a8f){if(ut['totalGlobal'](_0x419c6c)>=_0x191f2f[_0x5046('0xd6')]){_0x288b06=ut[_0x5046('0xad')](_0x419c6c,0xf,_0x5046('0xd7'));rpcDb[_0x5046('0x9d')](_0x288b06,_0x5046('0xd8'));}else{if(_0x419c6c[_0x5046('0xd1')]>=_0x191f2f[_0x5046('0xd9')]){rpcDb[_0x5046('0x9d')](_0x419c6c,_0x5046('0xd5'));}else{rpcDb[_0x5046('0xb0')](ut['scheduledAt'](_0x419c6c,'countnoanswerretry',_0x191f2f[_0x5046('0xda')]),_0x419c6c[_0x5046('0xb2')],_0x419c6c['activeContact']);}}}else{_0x419c6c[_0x5046('0xd1')]++;_0x4e4661[_0x5046('0xb7')]({'id':_0x419c6c[_0x5046('0xb6')],'field':{'countnoanswerretry':_0x419c6c['countnoanswerretry']}})['then'](function(){_0x4e4661[_0x5046('0xb8')](_0x419c6c,_0x49b342,_0x49619c)['then'](function(){});});}});break;case'CONGESTION':_0x191f2f[_0x5046('0x41')]+=0x1;_0x419c6c[_0x5046('0xdb')]+=0x1;_0x419c6c['countglobal']=ut[_0x5046('0xa7')](_0x419c6c);ut['logCustomer'](_0x419c6c,0x8,_0x5046('0xdc'));_0x49b342=_0x191f2f['dialCongestionRetryFrequency'];_0x49619c=_0x191f2f[_0x5046('0xac')];ami[_0x5046('0x29')](_0x5046('0xdd'),ut[_0x5046('0xaa')](_0x419c6c,_0x5046('0xde')));rpcDb[_0x5046('0x99')](_0x419c6c,_0x5046('0xdf'));_0x4e4661[_0x5046('0xce')](_0x419c6c,'8',_0x191f2f)[_0x5046('0x89')](function(_0xedc938){_0x304a8f=_0xedc938['additional']==0x1;if(!_0x304a8f){if(ut[_0x5046('0xa7')](_0x419c6c)>=_0x191f2f[_0x5046('0xd6')]){_0x288b06=ut[_0x5046('0xad')](_0x419c6c,0xf,_0x5046('0xd7'));rpcDb['createCustomerFinal'](_0x288b06,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x419c6c[_0x5046('0xdb')]>=_0x191f2f[_0x5046('0xe0')]){rpcDb[_0x5046('0x9d')](_0x419c6c,_0x5046('0xdf'));}else{rpcDb['rescheduleContact'](ut[_0x5046('0xb1')](_0x419c6c,_0x5046('0xdb'),_0x191f2f[_0x5046('0xca')]),_0x419c6c[_0x5046('0xb2')],_0x419c6c[_0x5046('0xb3')]);}}}else{_0x419c6c['countcongestionretry']++;_0x4e4661['incrementPreviewCounters']({'id':_0x419c6c['idContact'],'field':{'countcongestionretry':_0x419c6c['countcongestionretry']}})[_0x5046('0x89')](function(){_0x4e4661[_0x5046('0xb8')](_0x419c6c,_0x49b342,_0x49619c)[_0x5046('0x89')](function(){});});}});break;case _0x5046('0xe1'):_0x191f2f['outboundRejectCallsDay']+=0x1;_0x419c6c['countagentrejectretry']+=0x1;_0x419c6c[_0x5046('0xa6')]=ut[_0x5046('0xa7')](_0x419c6c);ut[_0x5046('0x95')](_0x419c6c,0x14,'AgentReject');_0x49b342=_0x191f2f['dialAgentRejectRetryFrequency'];_0x49619c=_0x191f2f[_0x5046('0xac')];ami[_0x5046('0x29')]('custom:agentreject',ut['buildObj'](_0x419c6c,_0x5046('0xe2')));rpcDb['createCustomerHistory'](_0x419c6c,_0x5046('0xe3'));_0x4e4661[_0x5046('0xce')](_0x419c6c,'20',_0x191f2f)[_0x5046('0x89')](function(_0x1c6c3a){_0x304a8f=_0x1c6c3a[_0x5046('0xcf')]==0x1;if(!_0x304a8f){if(ut[_0x5046('0xa7')](_0x419c6c)>=_0x191f2f[_0x5046('0xd6')]){_0x288b06=ut[_0x5046('0xad')](_0x419c6c,0x14,_0x5046('0xe4'));rpcDb[_0x5046('0x9d')](_0x288b06,_0x5046('0xe5'));}else{if(_0x419c6c['countagentrejectretry']>=_0x191f2f[_0x5046('0xe6')]){rpcDb[_0x5046('0x9d')](_0x419c6c,_0x5046('0xe5'));}else{rpcDb['rescheduleContact'](ut[_0x5046('0xb1')](_0x419c6c,_0x5046('0xe7'),_0x191f2f[_0x5046('0xe8')]),_0x419c6c[_0x5046('0xb2')],_0x419c6c[_0x5046('0xb3')]);}}}else{_0x419c6c['countnoanswerretry']++;_0x4e4661[_0x5046('0xb7')]({'id':_0x419c6c[_0x5046('0xb6')],'field':{'countnoanswerretry':_0x419c6c[_0x5046('0xd1')]}})[_0x5046('0x89')](function(){_0x4e4661[_0x5046('0xb8')](_0x419c6c,_0x49b342,_0x49619c)['then'](function(){});});}});break;case _0x5046('0xe9'):_0x191f2f['outboundAbandonedCallsDay']+=0x1;_0x419c6c[_0x5046('0xea')]+=0x1;_0x419c6c[_0x5046('0xa6')]=ut[_0x5046('0xa7')](_0x419c6c);ut[_0x5046('0x95')](_0x419c6c,0xb,'Abandoned');rpcDb[_0x5046('0x99')](_0x419c6c,_0x5046('0xeb'));_0x4e4661[_0x5046('0xce')](_0x419c6c,'11',_0x191f2f)['then'](function(_0x2942b1){_0x304a8f=_0x2942b1['additional']==0x1;if(!_0x304a8f){if(ut[_0x5046('0xa7')](_0x419c6c)>=_0x191f2f[_0x5046('0xd6')]){_0x288b06=ut[_0x5046('0xad')](_0x419c6c,0xf,_0x5046('0xd7'));rpcDb[_0x5046('0x9d')](_0x288b06,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x419c6c[_0x5046('0xec')]>=_0x191f2f[_0x5046('0xed')]){rpcDb[_0x5046('0x9d')](_0x419c6c,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x5046('0xb0')](ut[_0x5046('0xb1')](_0x419c6c,_0x5046('0xea'),_0x191f2f[_0x5046('0xee')]),_0x419c6c[_0x5046('0xb2')],_0x419c6c[_0x5046('0xb3')]);}}}else{_0x419c6c[_0x5046('0xd1')]++;_0x4e4661[_0x5046('0xb7')]({'id':_0x419c6c[_0x5046('0xb6')],'field':{'countnoanswerretry':_0x419c6c[_0x5046('0xd1')]}})['then'](function(){_0x4e4661[_0x5046('0xb8')](_0x419c6c,_0x49b342,_0x49619c)[_0x5046('0x89')](function(){});});}});break;case'18':_0x191f2f[_0x5046('0x48')]+=0x1;_0x419c6c[_0x5046('0xef')]+=0x1;_0x419c6c['countglobal']=ut[_0x5046('0xa7')](_0x419c6c);ut[_0x5046('0x95')](_0x419c6c,0x12,_0x1e1c4d['cause-txt']||_0x1e1c4d['dialstatus']);ami[_0x5046('0x29')](_0x5046('0xf0'),ut[_0x5046('0xaa')](_0x419c6c,_0x5046('0xf1')));rpcDb[_0x5046('0x99')](_0x419c6c,_0x5046('0xf2'));_0x4e4661[_0x5046('0xce')](_0x419c6c,'18',_0x191f2f)[_0x5046('0x89')](function(_0x3389cb){_0x304a8f=_0x3389cb[_0x5046('0xcf')]==0x1;if(!_0x304a8f){if(ut[_0x5046('0xa7')](_0x419c6c)>=_0x191f2f['dialGlobalMaxRetry']){_0x288b06=ut[_0x5046('0xad')](_0x419c6c,0x12,_0x5046('0xd7'));rpcDb[_0x5046('0x9d')](_0x288b06,_0x5046('0xf2'));}else{rpcDb[_0x5046('0x9d')](_0x419c6c,_0x5046('0xf2'));}}else{_0x419c6c[_0x5046('0xd1')]++;_0x4e4661[_0x5046('0xb7')]({'id':_0x419c6c['idContact'],'field':{'countnoanswerretry':_0x419c6c[_0x5046('0xd1')]}})[_0x5046('0x89')](function(){_0x4e4661[_0x5046('0xb8')](_0x419c6c,_0x49b342,_0x49619c)[_0x5046('0x89')](function(){});});}});delete this[_0x5046('0x18')][_0x1e1c4d[_0x5046('0xb4')]];break;case'19':_0x191f2f[_0x5046('0x48')]+=0x1;_0x419c6c[_0x5046('0xa6')]=ut[_0x5046('0xa7')](_0x419c6c);ut[_0x5046('0x95')](_0x419c6c,0x13,_0x1e1c4d['cause-txt']||_0x1e1c4d[_0x5046('0xf3')]);ami[_0x5046('0x29')](_0x5046('0xf0'),ut[_0x5046('0xaa')](_0x419c6c,'amd'));rpcDb[_0x5046('0x99')](_0x419c6c,_0x5046('0xf4'));_0x4e4661[_0x5046('0xce')](_0x419c6c,'18',_0x191f2f)[_0x5046('0x89')](function(_0x193c4c){_0x304a8f=_0x193c4c[_0x5046('0xcf')]==0x1;if(!_0x304a8f){if(ut[_0x5046('0xa7')](_0x419c6c)>=_0x191f2f['dialGlobalMaxRetry']){_0x288b06=ut['cloneAction'](_0x419c6c,0xf,'Global');rpcDb[_0x5046('0x9d')](_0x288b06,_0x5046('0xf4'));}else{rpcDb[_0x5046('0x9d')](_0x419c6c,'[callProgressDetectingCustomer][machine]');}}else{_0x419c6c['countnoanswerretry']++;_0x4e4661[_0x5046('0xb7')]({'id':_0x419c6c[_0x5046('0xb6')],'field':{'countnoanswerretry':_0x419c6c[_0x5046('0xd1')]}})[_0x5046('0x89')](function(){_0x4e4661[_0x5046('0xb8')](_0x419c6c,_0x49b342,_0x49619c)[_0x5046('0x89')](function(){});});}});delete this[_0x5046('0x18')][_0x1e1c4d[_0x5046('0xb4')]];break;default:if(_0x419c6c['dialAnswer']){ut['decrementTalkink'](_0x191f2f,_0x5046('0xf5'));ut[_0x5046('0x83')](_0x5046('0xf6')+_0x191f2f[_0x5046('0x2c')],_0x1e1c4d);}_0x191f2f[_0x5046('0x48')]+=0x1;_0x419c6c[_0x5046('0xa6')]=ut[_0x5046('0xa7')](_0x419c6c);ut[_0x5046('0x95')](_0x419c6c,0xc,_0x1e1c4d[_0x5046('0xf7')]||_0x1e1c4d[_0x5046('0xf3')]);_0x49b342=_0x191f2f['dialAgentRejectRetryFrequency'];_0x49619c=_0x191f2f[_0x5046('0xac')];rpcDb[_0x5046('0x99')](_0x419c6c,_0x5046('0xf8'));_0x4e4661[_0x5046('0xce')](_0x419c6c,'20',_0x191f2f)[_0x5046('0x89')](function(_0x50cec5){_0x304a8f=_0x50cec5[_0x5046('0xcf')]==0x1;if(!_0x304a8f){if(ut[_0x5046('0xa7')](_0x419c6c)>=_0x191f2f[_0x5046('0xd6')]){_0x288b06=ut[_0x5046('0xad')](_0x419c6c,0xf,_0x5046('0xd7'));rpcDb['createCustomerFinal'](_0x288b06,_0x5046('0xf9'));}else{rpcDb['createCustomerFinal'](_0x419c6c,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x1e1c4d[_0x5046('0xb4')]];}else{_0x4e4661[_0x5046('0xb8')](_0x419c6c,_0x49b342,_0x49619c)['then'](function(){});}});}if(!(_0x419c6c['dialAnswer']&&_0xd33cb8==='16')){ut[_0x5046('0x80')](_0x191f2f,_0x5046('0xfa'));logger['info'](_0x5046('0xfb'),_0x419c6c['uniqueid'],_0x5046('0xbd'),_0x191f2f['name'],_0x5046('0x74'),_0x191f2f[_0x5046('0x66')]);}if(_0xd33cb8!==_0x5046('0xb9')){delete this['actions'][_0x1e1c4d[_0x5046('0xb4')]];delete this[_0x5046('0x18')][_0x1e1c4d[_0x5046('0xfc')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0xfc0f8e,_0x68b170,_0x788f1e){if(_['isUndefined'](_0x68b170)&&'object'!==typeof _0x68b170){return;}if(_[_0x5046('0xfd')](_0x788f1e)&&_0x5046('0xfe')!==typeof _0x788f1e){return;}switch(_0x788f1e['reason']){case'0':ut['logAgent'](_0xfc0f8e,0x0,_0x5046('0xa8'));rpcDb[_0x5046('0xff')](_0xfc0f8e,_0x5046('0x100'));break;case'3':ut[_0x5046('0x101')](_0xfc0f8e,0x3,_0x5046('0xd2'));rpcDb[_0x5046('0xff')](_0xfc0f8e,_0x5046('0x102'));break;case'5':ut[_0x5046('0x101')](_0xfc0f8e,0x5,_0x5046('0x103'));rpcDb[_0x5046('0xff')](_0xfc0f8e,_0x5046('0x104'));break;case'8':ut['logAgent'](_0xfc0f8e,0x8,'Congestion');rpcDb['createAgentHistory'](_0xfc0f8e,_0x5046('0x105'));break;case'22':ut[_0x5046('0x101')](_0xfc0f8e,0x16,_0x5046('0x106'));rpcDb[_0x5046('0xff')](_0xfc0f8e,_0x5046('0x107'));break;default:ut['logAgent'](_0xfc0f8e,0xc,_0x788f1e['reason']);rpcDb[_0x5046('0xff')](_0xfc0f8e,_0x5046('0x105'));}ut[_0x5046('0x80')](_0x68b170,_0x5046('0x108'));logger[_0x5046('0x61')](_0x5046('0x109'),_0xfc0f8e[_0x5046('0xbc')],_0x5046('0xbd'),_0x68b170[_0x5046('0x2c')],'originated:\x20',_0x68b170[_0x5046('0x66')]);delete this[_0x5046('0x18')][_0xfc0f8e[_0x5046('0xbc')]];};Preview[_0x5046('0x10')][_0x5046('0xce')]=function(_0x4cb201,_0x4746c1,_0x3b297a){return Promise[_0x5046('0x10a')]()['then'](cmHopperAdditionalPhone[_0x5046('0xce')](_0x4cb201,_0x4746c1,_0x3b297a))['catch'](logger[_0x5046('0x61')](_0x5046('0x10b')));};Preview[_0x5046('0x10')]['swapAdditionalPhones']=function(_0x13da52,_0x48778a,_0x1d0880){return Promise[_0x5046('0x10a')]()[_0x5046('0x89')](cmHopperAdditionalPhone[_0x5046('0xb8')](_0x13da52,_0x48778a,_0x1d0880))[_0x5046('0x7e')](logger[_0x5046('0x61')](_0x5046('0x10c')));};Preview[_0x5046('0x10')]['incrementPreviewCounters']=function(_0x2f2a22){return Promise[_0x5046('0x10a')]()[_0x5046('0x89')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x2f2a22))['catch'](logger[_0x5046('0x61')](_0x5046('0x10d')));};Preview['prototype'][_0x5046('0x10e')]=function(_0x398979,_0x41e907,_0x1f10e5,_0x49e6fb,_0x220637){var _0x4c6fdf=this;return new Promise(function(_0xea3a71,_0x1af9a1){if(_['isNil'](_0x41e907)||_[_0x5046('0x8a')](_0x41e907[_0x5046('0x10f')])||_[_0x5046('0x8a')](_0x41e907[_0x5046('0x110')])||_[_0x5046('0x8a')](_0x41e907[_0x5046('0x7a')])){_0x1af9a1(ut['message'](_0x5046('0x111'),_0x49e6fb,_0x220637));return;}var _0x959162=uuid['v4']();var _0x41b6af=_0x4c6fdf[_0x5046('0x15')][_0x41e907['Queue']['name']];var _0x113e7a=_0x1f10e5?_0x4c6fdf[_0x5046('0x19')][_0x1f10e5]['id']:undefined;_0x4c6fdf[_0x5046('0x18')][_0x959162]=new Action(_0x41e907,_0x41b6af,_0x959162,_0x1f10e5,_0x113e7a);var _0x27d979=_0x4c6fdf['actions'][_0x959162];_0x27d979['unlockAgent']=_0x49e6fb;_0x27d979['activeContact']=_0x220637;_0x27d979['lookAgent']=_0x1f10e5;if(_['isEmpty'](_0x398979)){_0x4c6fdf['execCall'](_0x27d979,_0x41b6af,_0x41e907,_0x1f10e5)[_0x5046('0x89')](function(_0x25609d){logger[_0x5046('0x61')]('[Preview][execCall][success]',_0x5046('0x112')+_0x27d979[_0x5046('0x73')]+_0x5046('0x113')+_0x27d979[_0x5046('0xb6')],JSON[_0x5046('0x5c')](_0x25609d));ami[_0x5046('0x29')](_0x5046('0x114'),ut['buildObj'](_0x27d979,_0x5046('0x115'),_0x4c6fdf['campaignsPreview'][_0x27d979[_0x5046('0x73')]]));_0xea3a71(ut[_0x5046('0x53')](_0x5046('0x116')));})[_0x5046('0x7e')](function(_0x4f00e0){ut['logger']('[Preview][execCall][failure]',_0x4f00e0);_0x1af9a1(ut['message']('Call\x20failed',_0x49e6fb,_0x220637));});}else{_0x41b6af[_0x5046('0x117')]+=0x1;ut['logBlacklist'](_0x27d979);rpcDb['createHistory'](_0x27d979,_0x5046('0x118'));delete _0x4c6fdf[_0x5046('0x18')][_0x959162];_0x1af9a1(ut[_0x5046('0x53')]('Contact\x20in\x20black\x20List',_0x49e6fb,_0x220637));}});};Preview[_0x5046('0x10')][_0x5046('0xa1')]=function(_0x454e3a){return!_[_0x5046('0x8a')](_0x454e3a)&&!_['isNil'](_0x454e3a[_0x5046('0x2c')])&&!_[_0x5046('0x8a')](_0x454e3a[_0x5046('0x59')])&&_0x454e3a[_0x5046('0x59')]&&!_[_0x5046('0x8a')](this[_0x5046('0x17')][util[_0x5046('0x5e')]('SIP/%s',_0x454e3a[_0x5046('0x2c')])])&&!_[_0x5046('0x8a')](this['trunks'][util[_0x5046('0x5e')](_0x5046('0x119'),_0x454e3a[_0x5046('0x2c')])][_0x5046('0x11a')])&&(this[_0x5046('0x17')][util[_0x5046('0x5e')](_0x5046('0x119'),_0x454e3a[_0x5046('0x2c')])][_0x5046('0x11a')]===_0x5046('0x11b')||this['trunks'][util[_0x5046('0x5e')](_0x5046('0x119'),_0x454e3a['name'])][_0x5046('0x11a')]==='unmonitored');};Preview[_0x5046('0x10')][_0x5046('0x8f')]=function(_0x34cfae,_0x5a234e){var _0x2655b5=this;return new Promise(function(_0x3cb5e7,_0x568740){_0x2655b5[_0x5046('0x11c')](_0x34cfae,_0x5a234e)['then'](function(_0x5c0b7f){_0x3cb5e7(_['pick'](_0x5c0b7f,[_0x5046('0x53')]));})[_0x5046('0x7e')](function(_0x3b30de){if(_0x3b30de[_0x5046('0x11d')]){rpcDb[_0x5046('0x11e')](_0x34cfae);}if(_0x3b30de[_0x5046('0x59')]){rpcDb[_0x5046('0x11f')](_0x34cfae);}_0x568740(_[_0x5046('0x77')](_0x3b30de,[_0x5046('0x53')]));});});};Preview[_0x5046('0x10')]['execRun']=function(_0x21f037,_0x444561){var _0x3b048f=this;return new Promise(function(_0x5ed685,_0xdf5edd){var _0x3504ac,_0x2b70a2;rpcDb['getContactPreview'](_0x21f037)[_0x5046('0x89')](function(_0xcb47d5){if(!_[_0x5046('0x8a')](_0xcb47d5[0x0])){_0x2b70a2=_0xcb47d5[0x0][_0x5046('0x120')]?![]:!![];_0x3504ac=_0xcb47d5[0x0][_0x5046('0x120')]?!![]:![];_0x3504ac=_0x444561?!![]:_0x3504ac;}var _0x511b75=_0x3b048f[_0x5046('0x121')](_0xcb47d5);if(_0x511b75[_0x5046('0x122')]){rpcDb[_0x5046('0x123')](_['pick'](_0xcb47d5[0x0],[_0x5046('0x7a'),_0x5046('0x110')]))[_0x5046('0x89')](function(_0x44ad67){_0x3b048f[_0x5046('0x10e')](_0x44ad67,_0xcb47d5[0x0],_0x444561,_0x2b70a2,_0x3504ac)['then'](function(_0x4a704c){_0x5ed685(_0x4a704c);})[_0x5046('0x7e')](function(_0x3d10a2){_0xdf5edd(_0x3d10a2);});})[_0x5046('0x7e')](function(_0x22b3a1){ut[_0x5046('0x6c')](_0x5046('0x124'),_0x22b3a1);_0xdf5edd(ut[_0x5046('0x53')](_0x5046('0x125'),_0x2b70a2,_0x3504ac));});}else{_0xdf5edd(ut['message'](_0x511b75[_0x5046('0x53')],_0x2b70a2,_0x3504ac));}})[_0x5046('0x7e')](function(_0x179b39){ut['logger'](_0x5046('0x126'),_0x179b39);_0xdf5edd(ut[_0x5046('0x53')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x5046('0x10')][_0x5046('0x121')]=function(_0x8d1b){if(_['isNil'](_0x8d1b)||_[_0x5046('0x127')](_0x8d1b)||!_[_0x5046('0x8a')](_0x8d1b[0x0][_0x5046('0x8d')])&&_['isNil'](_0x8d1b[0x0][_0x5046('0x8d')]['name'])){ut['logger'](_0x5046('0x128'),_0x8d1b);return{'isValid':![],'message':_0x5046('0x129')};}var _0x3145de=this[_0x5046('0x15')][_0x8d1b[0x0][_0x5046('0x72')][_0x5046('0x2c')]];_0x3145de[_0x5046('0x53')]=_0x5046('0xa3');if(_[_0x5046('0x8a')](_0x3145de)){ut[_0x5046('0x6c')](_0x5046('0x12a'),_0x3145de);return{'isValid':![],'message':_0x5046('0x12b')};}if(!this[_0x5046('0xa1')](_0x3145de['Trunk'])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20'+_0x3145de['name']+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x5046('0xa1')](_0x3145de[_0x5046('0xa2')])){ut[_0x5046('0x6c')](_0x5046('0x12c'),_0x3145de[_0x5046('0x2c')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x5046('0x12d')};}}if(!ut['isActive'](_0x3145de[_0x5046('0x39')])){ut[_0x5046('0x6c')](_0x5046('0x12e'),_0x3145de[_0x5046('0x2c')]+_0x5046('0x12f'));return{'isValid':![],'message':_0x5046('0x130')+_0x3145de['name']+_0x5046('0x12f')};}return{'isValid':!![],'message':_0x5046('0x131')};};Preview[_0x5046('0x10')][_0x5046('0x132')]=function(_0x2e1996,_0x354166,_0x346d1c,_0x2d8b34){var _0x4a7eb0=this;return new Promise(function(_0x29b992,_0x4db142){var _0x4fc22b=_0x2e1996['uniqueid'];var _0x153d9f=_0x4a7eb0[_0x5046('0xa1')](_0x354166[_0x5046('0x58')])?util[_0x5046('0x5e')](_0x5046('0x133'),_0x354166[_0x5046('0x58')][_0x5046('0x2c')],_[_0x5046('0x8a')](_0x354166[_0x5046('0x3d')])?'':_0x354166[_0x5046('0x3d')][_0x5046('0x134')]()||'',_0x354166[_0x5046('0x135')]>0x0?_0x346d1c[_0x5046('0x110')][_0x5046('0x136')](_0x354166['dialCutDigit']):_0x346d1c[_0x5046('0x110')]):util[_0x5046('0x5e')](_0x5046('0x133'),_[_0x5046('0x8a')](_0x354166['TrunkBackup'])?_0x354166[_0x5046('0x58')][_0x5046('0x2c')]:_0x354166[_0x5046('0xa2')][_0x5046('0x2c')],_[_0x5046('0x8a')](_0x354166[_0x5046('0x3d')])?'':_0x354166[_0x5046('0x3d')][_0x5046('0x134')]()||'',_0x354166['dialCutDigit']>0x0?_0x346d1c[_0x5046('0x110')][_0x5046('0x136')](_0x354166[_0x5046('0x135')]):_0x346d1c[_0x5046('0x110')]);var _0x3c688f=_0x4a7eb0['isTrunkReachable'](_0x354166[_0x5046('0x58')])?ut['getCallerId'](_0x354166[_0x5046('0x58')][_0x5046('0x5a')],_0x354166[_0x5046('0x3b')],_0x354166[_0x5046('0x137')]>0x0?ut[_0x5046('0x138')](_0x354166[_0x5046('0x3c')],_0x354166[_0x5046('0x137')]):_0x354166['dialOriginateCallerIdNumber']):ut[_0x5046('0x139')](_[_0x5046('0x8a')](_0x354166['TrunkBackup'])?_0x354166['Trunk'][_0x5046('0x5a')]:_0x354166[_0x5046('0xa2')]['callerid'],_0x354166[_0x5046('0x3b')],_0x354166['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x5046('0x138')](_0x354166[_0x5046('0x3c')],_0x354166[_0x5046('0x137')]):_0x354166['dialOriginateCallerIdNumber']);if(_0x3c688f){_0x2e1996[_0x5046('0x13a')]=ut['extractCalleridName'](_0x3c688f);_0x2e1996[_0x5046('0x13b')]=ut['extractCalleridNumber'](_0x3c688f);}var _0x524850=ut[_0x5046('0x13c')](_0x354166,_0x346d1c,_0x153d9f,_0x3c688f,_0x4fc22b,_0x2e1996);_[_0x5046('0x13d')](_0x2e1996,ut[_0x5046('0x13e')](_0x524850));_0x2e1996[_0x5046('0x92')]=moment()[_0x5046('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x354166[_0x5046('0x13f')]=_0x524850;ami[_0x5046('0x7c')](ut['variablesAction'](_0x2e1996,_0x354166,_0x524850,_0x2e1996[_0x5046('0xb3')],_0x2d8b34))['then'](function(_0x44e258){_0x354166[_0x5046('0x66')]+=0x1;logger['info'](_0x5046('0x140'),_0x4fc22b,_0x5046('0xbd'),_0x354166[_0x5046('0x2c')],_0x5046('0x74'),_0x354166['originated']);_0x29b992(_0x44e258);})[_0x5046('0x7e')](function(_0x1889d4){ut[_0x5046('0x101')](_0x2e1996,0xe,_0x5046('0x141'));rpcDb[_0x5046('0xff')](_0x2e1996,'[originateFailure][logOriginateFailure]');_0x4db142(_0x1889d4);});});};Preview[_0x5046('0x10')][_0x5046('0x22')]=function(_0x3b721a){if(this['actions'][_0x3b721a[_0x5046('0xb4')]]){this['actions'][_0x3b721a[_0x5046('0xb4')]][_0x5046('0x7d')]=_0x3b721a[_0x5046('0x7d')];}};Preview[_0x5046('0x10')]['syncOriginateResponse']=function(_0x3c959f){var _0x39de58=this;var _0x48ea22=this[_0x5046('0x18')][_0x3c959f['actionid']];if(_0x48ea22){if(_0x48ea22['lookAgent']&&this[_0x5046('0x19')][_0x48ea22['lookAgent']]){ut[_0x5046('0x142')](_0x48ea22,this[_0x5046('0x19')][_0x48ea22[_0x5046('0x143')]][_0x5046('0x2c')],this[_0x5046('0x19')][_0x48ea22[_0x5046('0x143')]]['id']);}var _0x22226b=_[_0x5046('0x144')](_0x48ea22);_0x22226b[_0x5046('0xba')]=moment()[_0x5046('0x5e')](_0x5046('0x93'));var _0x3ea940=_0x39de58[_0x5046('0x15')][_0x48ea22['queue']];if(ut['isFailure'](_0x3c959f[_0x5046('0x145')])){if(_0x48ea22[_0x5046('0xb2')]){rpcDb[_0x5046('0x11e')](_0x48ea22[_0x5046('0xb6')]);}if(_0x48ea22[_0x5046('0xb3')]){rpcDb[_0x5046('0x11f')](_0x48ea22[_0x5046('0xb6')]);}ami[_0x5046('0x29')](_0x5046('0x146'),ut['buildObj'](_0x48ea22,'rejected',this['campaignsPreview'][_0x48ea22[_0x5046('0x73')]]));this[_0x5046('0x147')](_0x22226b,_0x3ea940,_0x3c959f);}else{_0x48ea22[_0x5046('0x92')]=moment()[_0x5046('0x5e')](_0x5046('0x93'));ut['logAgent'](_0x22226b,0x4,_0x5046('0x148'));rpcDb['createAgentHistory'](_0x22226b,_0x5046('0x149'));}}};Preview[_0x5046('0x10')][_0x5046('0x14a')]=function(_0xe45d8b){var _0x5da5ea=this[_0x5046('0x18')][_0xe45d8b[_0x5046('0xb4')]];var _0x39743b;if(_0x5da5ea){_0x39743b=this[_0x5046('0x15')][_0x5da5ea['queue']];logger[_0x5046('0x61')](_0x5046('0x14b'),_0xe45d8b[_0x5046('0xb4')],'\x20Queue',_0x39743b['name'],_0x5046('0x75'),_0x39743b['pTalking']);}if(this[_0x5046('0x18')][_0xe45d8b[_0x5046('0xb4')]]&&_0xe45d8b['linkedid']!==_0xe45d8b['uniqueid']){if(_0xe45d8b[_0x5046('0x14c')]==='16'&&this[_0x5046('0x18')][_0xe45d8b[_0x5046('0xb4')]][_0x5046('0x76')]){this['callProgressDetectingCustomer'](_0xe45d8b,_0xe45d8b[_0x5046('0xb4')],_0xe45d8b[_0x5046('0x14c')]);}else if(this['actions'][_0xe45d8b['linkedid']][_0x5046('0x76')]){logger[_0x5046('0x61')](_0x5046('0x14d'),_0xe45d8b[_0x5046('0xb4')],_0xe45d8b[_0x5046('0x14c')],_0x5046('0xbd'),_0x39743b['name'],'pTalking:\x20',_0x39743b[_0x5046('0x30')]);this[_0x5046('0xa4')](_0xe45d8b,_0xe45d8b['linkedid'],_0xe45d8b['cause']);}}else if(_0x5da5ea&&_[_0x5046('0x8a')](_0x5da5ea[_0x5046('0x14e')])&&_0x39743b['dialQueueProject']&&_0xe45d8b['linkedid']===_0xe45d8b[_0x5046('0xbc')]&&_[_0x5046('0x8a')](_0xe45d8b['reason'])&&_0xe45d8b['cause']==='16'&&_0xe45d8b[_0x5046('0x14f')]==='6'&&_[_0x5046('0xfd')](_0x5da5ea[_0x5046('0x150')])){if(_0x5da5ea[_0x5046('0xb2')]){rpcDb[_0x5046('0x11e')](_0x5da5ea[_0x5046('0xb6')]);}if(_0x5da5ea[_0x5046('0xb3')]){rpcDb['disableContact'](_0x5da5ea[_0x5046('0xb6')]);}_0xe45d8b[_0x5046('0x151')]='22';this[_0x5046('0x147')](_0x5da5ea,_0x39743b,_0xe45d8b);}else if(_0x5da5ea&&_0x5da5ea[_0x5046('0x150')]){if(_0xe45d8b[_0x5046('0x14c')]==='16'&&this[_0x5046('0x18')][_0xe45d8b[_0x5046('0xb4')]][_0x5046('0x76')]){logger['info'](_0x5046('0x152'),_0xe45d8b[_0x5046('0xb4')],_0xe45d8b[_0x5046('0x14c')],_0x5046('0xbd'),_0x39743b['name'],_0x5046('0x75'),_0x39743b[_0x5046('0x30')]);this[_0x5046('0xa4')](_0xe45d8b,_0xe45d8b['linkedid'],_0xe45d8b['cause']);}else if(this['actions'][_0xe45d8b['linkedid']]['dialAnswer']){logger[_0x5046('0x61')](_0x5046('0x14d'),_0xe45d8b['linkedid'],_0xe45d8b[_0x5046('0x14c')],_0x5046('0xbd'),_0x39743b[_0x5046('0x2c')],'pTalking:\x20',_0x39743b[_0x5046('0x30')]);this[_0x5046('0xa4')](_0xe45d8b,_0xe45d8b[_0x5046('0xb4')],_0xe45d8b['cause']);}}};Preview[_0x5046('0x10')][_0x5046('0x21')]=function(_0x471be0){if(this['actions'][_0x471be0['destlinkedid']]&&_0x471be0[_0x5046('0xfc')]!==_0x471be0[_0x5046('0x153')]){this[_0x5046('0xa4')](_0x471be0,_0x471be0[_0x5046('0xfc')],_0x471be0[_0x5046('0xf3')]);}};Preview['prototype'][_0x5046('0x154')]=function(_0x58cc5e){if(this[_0x5046('0x18')][_0x58cc5e['linkedid']]&&_0x58cc5e[_0x5046('0xb4')]!==_0x58cc5e[_0x5046('0xbc')]&&!this[_0x5046('0x18')][_0x58cc5e[_0x5046('0xb4')]][_0x5046('0x76')]){if(_0x58cc5e[_0x5046('0x14c')]==='1'){this[_0x5046('0xa4')](_0x58cc5e,_0x58cc5e['linkedid'],_0x58cc5e[_0x5046('0x14c')]);}}};Preview[_0x5046('0x10')][_0x5046('0x155')]=function(_0x1f3e50,_0x1735f0,_0x51e173){if(this[_0x5046('0x18')][_0x1f3e50]){if(_[_0x5046('0x8a')](this['actions'][_0x1f3e50]['variables'])){this[_0x5046('0x18')][_0x1f3e50][_0x5046('0x13f')]={};}this[_0x5046('0x18')][_0x1f3e50][_0x5046('0x13f')][_0x1735f0]=_0x51e173;}};Preview[_0x5046('0x10')][_0x5046('0x24')]=function(_0x5ea18c){try{if(!_[_0x5046('0x8a')](_0x5ea18c)){if(ut['filterKey'](_[_0x5046('0x156')](_0x5ea18c[_0x5046('0x157')])[0x0])){this[_0x5046('0x155')](_0x5ea18c[_0x5046('0xbc')],_['keys'](_0x5ea18c[_0x5046('0x157')])[0x0],_0x5ea18c['value']);}}}catch(_0x251dbd){logger['error'](_0x5046('0x158'),util['inspect'](_0x251dbd,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0xe886c1){if(_0xe886c1){if(this[_0x5046('0x18')][_0xe886c1[_0x5046('0x159')]]){this[_0x5046('0x18')][_0xe886c1['transfertargetlinkedid']][_0x5046('0x150')]=!![];}}};Preview[_0x5046('0x10')][_0x5046('0x15a')]=function(_0x415072){if(_0x415072){if(this[_0x5046('0x18')][_0x415072[_0x5046('0x15b')]]){this['actions'][_0x415072['transfererlinkedid']][_0x5046('0x150')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x3cd7=['hasOwnProperty','dialMethod','booked','clearZombieChannels','outbound','setMessage','clearZombieChannel','sequence','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','contactId','VoiceQueueId','Action','status','channel','updateOriginated','dialAnswer','decrementTalkink','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','size','recallMe','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','\x20Queue','BUSY','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','incrementPreviewCounters','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','swapAdditionalPhones','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialAgentRejectRetryFrequency','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','reason','createAgentHistory','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[swapAdditionalPhone]\x20','checkInBlack','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','Calling','logger','Call\x20failed','logBlacklist','createHistory','SIP/%s','reachable','unmonitored','execRun','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','pick','phone','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','extractCalleridName','extractCalleridNumber','addVariables','merge','toLowerVariables','YYYY-MM-DD\x20HH:mm:ss','variables','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','filterKey','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','moment','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','name','strategy','answered','pTalking','sumBillable','sumDuration','sumHoldTime','total','abandoned','dialActive','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','sendMessageOneNotActive','originated','available','paused','message','\x20is\x20not\x20active','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns'];(function(_0x3e7597,_0x776edc){var _0xe652c3=function(_0x3fb191){while(--_0x3fb191){_0x3e7597['push'](_0x3e7597['shift']());}};_0xe652c3(++_0x776edc);}(_0x3cd7,0xf4));var _0x73cd=function(_0x4c42f3,_0x2d920b){_0x4c42f3=_0x4c42f3-0x0;var _0x416cb9=_0x3cd7[_0x4c42f3];return _0x416cb9;};'use strict';var util=require(_0x73cd('0x0'));var _=require('lodash');var uuid=require('uuid');var moment=require(_0x73cd('0x1'));var md5=require(_0x73cd('0x2'));var Redis=require('ioredis');var config=require(_0x73cd('0x3'));var logger=require(_0x73cd('0x4'))(_0x73cd('0x5'));var loggerAction=require(_0x73cd('0x4'))(_0x73cd('0x6'));var ami=require(_0x73cd('0x7'));var rpcDb=require(_0x73cd('0x8'));var cmHopperAdditionalPhone=require(_0x73cd('0x9'));var Action=require(_0x73cd('0xa'));var ut=require('./util/util');config['redis']=_[_0x73cd('0xb')](config[_0x73cd('0xc')],{'host':_0x73cd('0xd'),'port':0x18eb});var io=require(_0x73cd('0xe'))(new Redis(config[_0x73cd('0xc')]));var Sequence=function(){};Sequence[_0x73cd('0xf')][_0x73cd('0x10')]=function(_0xaa6a4){this[_0x73cd('0x11')]=this[_0x73cd('0x11')]?this[_0x73cd('0x11')][_0x73cd('0x12')](_0xaa6a4):_0xaa6a4();};function Preview(_0x242e8f){this['sequence']=new Sequence();this[_0x73cd('0x13')]=_0x242e8f['voiceQueues'];this[_0x73cd('0x14')]=_0x242e8f[_0x73cd('0x14')];this[_0x73cd('0x15')]={};this[_0x73cd('0x16')]=_0x242e8f[_0x73cd('0x16')];this[_0x73cd('0x17')]=0x0;ami['on']('originateresponse',this[_0x73cd('0x18')][_0x73cd('0x19')](this));ami['on'](_0x73cd('0x1a'),this[_0x73cd('0x1b')][_0x73cd('0x19')](this));ami['on'](_0x73cd('0x1c'),this[_0x73cd('0x1d')][_0x73cd('0x19')](this));ami['on']('dialend',this[_0x73cd('0x1e')][_0x73cd('0x19')](this));ami['on'](_0x73cd('0x1f'),this[_0x73cd('0x20')]['bind'](this));ami['on'](_0x73cd('0x21'),this[_0x73cd('0x22')][_0x73cd('0x19')](this));ami['on'](_0x73cd('0x23'),this[_0x73cd('0x24')][_0x73cd('0x19')](this));ami['on']('blindtransfer',this[_0x73cd('0x25')]['bind'](this));this[_0x73cd('0x26')](this[_0x73cd('0x13')]);}function emit(_0x5de83a,_0xadfab5,_0x1216b6){io['to'](_0x5de83a)[_0x73cd('0x27')](_0xadfab5,_0x1216b6);}function emitCampaignPreview(_0xc5464b){if(_0xc5464b[_0x73cd('0x28')]==='outbound'){var _0x2684ab={'id':_0xc5464b['id'],'name':_0xc5464b[_0x73cd('0x29')],'strategy':_0xc5464b[_0x73cd('0x2a')],'answered':_0xc5464b[_0x73cd('0x2b')],'available':_0xc5464b['available'],'loggedIn':_0xc5464b['loggedIn'],'pTalking':_0xc5464b[_0x73cd('0x2c')],'sumBillable':_0xc5464b[_0x73cd('0x2d')],'sumDuration':_0xc5464b[_0x73cd('0x2e')],'sumHoldTime':_0xc5464b[_0x73cd('0x2f')]||0x0,'talking':_0xc5464b['talking'],'total':_0xc5464b[_0x73cd('0x30')],'type':_0xc5464b[_0x73cd('0x28')],'unmanaged':_0xc5464b['unmanaged'],'abandoned':_0xc5464b[_0x73cd('0x31')],'waiting':_0xc5464b['waiting'],'loggedInDb':_0xc5464b['loggedInDb'],'dialActive':_0xc5464b[_0x73cd('0x32')],'dialMethod':_0xc5464b['dialMethod'],'dialOriginateCallerIdName':_0xc5464b['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0xc5464b['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0xc5464b[_0x73cd('0x33')],'dialPrefix':_0xc5464b[_0x73cd('0x34')],'outboundAnswerAgiCallsDay':_0xc5464b[_0x73cd('0x35')],'outboundAnswerCallsDay':_0xc5464b['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0xc5464b[_0x73cd('0x36')],'outboundBusyCallsDay':_0xc5464b[_0x73cd('0x37')],'outboundCongestionCallsDay':_0xc5464b['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0xc5464b[_0x73cd('0x38')],'outboundDropCallsDayCallersExit':_0xc5464b[_0x73cd('0x39')],'outboundDropCallsDayTimeout':_0xc5464b[_0x73cd('0x3a')],'outboundNoAnswerCallsDay':_0xc5464b[_0x73cd('0x3b')],'outboundNoSuchCallsDay':_0xc5464b[_0x73cd('0x3c')],'outboundOriginateFailureCallsDay':_0xc5464b[_0x73cd('0x3d')],'outboundReCallsDay':_0xc5464b[_0x73cd('0x3e')],'outboundRejectCallsDay':_0xc5464b['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0xc5464b[_0x73cd('0x3f')],'outboundAbandonedCallsDay':_0xc5464b[_0x73cd('0x40')],'predictiveIntervalAnsweredCalls':_0xc5464b['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0xc5464b[_0x73cd('0x41')],'predictiveIntervalAvgTalktime':_0xc5464b[_0x73cd('0x42')],'predictiveIntervalDroppedCallsCallersExit':_0xc5464b[_0x73cd('0x43')],'predictiveIntervalDroppedCallsTimeout':_0xc5464b[_0x73cd('0x44')],'predictiveIntervalErlangCalls':_0xc5464b[_0x73cd('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0xc5464b['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0xc5464b[_0x73cd('0x46')],'predictiveIntervalMultiplicativeFactor':_0xc5464b['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0xc5464b['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0xc5464b[_0x73cd('0x47')],'predictiveIntervalTotalCalls':_0xc5464b[_0x73cd('0x48')],'message':_0xc5464b['message'],'originated':_0xc5464b['originated'],'erlangCalls':_0xc5464b[_0x73cd('0x49')],'erlangCallToSecond':_0xc5464b[_0x73cd('0x4a')],'erlangAbandonmentRate':_0xc5464b[_0x73cd('0x4b')],'erlangBusyFactor':_0xc5464b[_0x73cd('0x4c')],'startPredictive':_0xc5464b[_0x73cd('0x4d')],'startProgressive':_0xc5464b[_0x73cd('0x4e')]};if(_0xc5464b[_0x73cd('0x4f')]){_0x2684ab['Trunk']={'id':_0xc5464b['Trunk']['id'],'name':_0xc5464b['Trunk'][_0x73cd('0x29')],'active':_0xc5464b[_0x73cd('0x4f')][_0x73cd('0x50')],'callerid':_0xc5464b[_0x73cd('0x4f')][_0x73cd('0x51')]};}if(_0xc5464b[_0x73cd('0x52')]){_0x2684ab[_0x73cd('0x52')]={'id':_0xc5464b[_0x73cd('0x52')]['id'],'name':_0xc5464b[_0x73cd('0x52')]['name']};}var _0x35c481=md5(JSON[_0x73cd('0x53')](_0x2684ab));if(_0xc5464b[_0x73cd('0x2')]!==_0x35c481){_0xc5464b[_0x73cd('0x2')]=_0x35c481;emit(util[_0x73cd('0x54')]('voice:queue:%s',_0x2684ab[_0x73cd('0x29')]),_0x73cd('0x55'),_0x2684ab);}}}function emitVoiceQueueChannelRemove(_0x2c5449){logger['info'](_0x73cd('0x56'),JSON[_0x73cd('0x53')](_0x2c5449));emit(util['format'](_0x73cd('0x57'),_0x2c5449[_0x73cd('0x29')]),'voice_queue_channel:remove',_0x2c5449);io['emit']('voice_queue_presence:remove',_0x2c5449);}function notSendMessagesQueue(_0x4ce1ba){if(_0x4ce1ba[_0x73cd('0x58')]){if(_0x4ce1ba[_0x73cd('0x59')]===0x0&&_0x4ce1ba[_0x73cd('0x2c')]===0x0){_0x4ce1ba[_0x73cd('0x58')]=![];_0x4ce1ba[_0x73cd('0x5a')]=0x0;_0x4ce1ba[_0x73cd('0x5b')]=0x0;_0x4ce1ba[_0x73cd('0x5c')]='NOT_ACTIVE';ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x4ce1ba['name']+_0x73cd('0x5d'));}else{_0x4ce1ba[_0x73cd('0x5c')]=_0x73cd('0x5e');ut['logger'](_0x73cd('0x5f'),_0x4ce1ba[_0x73cd('0x29')]+'\x20is\x20deactivated');}emitCampaignPreview(_0x4ce1ba);}}Preview[_0x73cd('0xf')]['loopCampaigns']=function(){var _0x7bedcb=this;setInterval(function(){_0x7bedcb[_0x73cd('0x60')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x6893a=this['campaignsPreview'];this[_0x73cd('0x17')]+=0x1;for(var _0x91dfa5 in _0x6893a){if(_0x6893a[_0x73cd('0x61')](_0x91dfa5)&&(_0x6893a[_0x91dfa5][_0x73cd('0x62')]===_0x73cd('0x5')||_0x6893a[_0x91dfa5][_0x73cd('0x62')]===_0x73cd('0x63'))&&_0x6893a[_0x91dfa5][_0x73cd('0x28')]==='outbound'){if(this[_0x73cd('0x17')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x73cd('0x64')]();}}if(_0x6893a[_0x73cd('0x61')](_0x91dfa5)&&_0x6893a[_0x91dfa5][_0x73cd('0x62')]==='preview'&&_0x6893a[_0x91dfa5]['type']===_0x73cd('0x65')){if(_0x6893a[_0x91dfa5][_0x73cd('0x32')]){this[_0x73cd('0x66')](_0x6893a[_0x91dfa5]);if(_0x6893a[_0x91dfa5]['dialPreviewAutoRecallMe'])this['recallMe'](_0x6893a[_0x91dfa5]);}else{notSendMessagesQueue(_0x6893a[_0x91dfa5]);}}}};Preview[_0x73cd('0xf')][_0x73cd('0x67')]=function(_0x581c85){var _0x41a474=this;this[_0x73cd('0x68')]['enqueue'](function(){if(!_['isNil'](_0x41a474['actions'][_0x581c85])){loggerAction[_0x73cd('0x69')](_0x73cd('0x6a'),_0x581c85,_0x73cd('0x6b'),_0x41a474[_0x73cd('0x15')][_0x581c85][_0x73cd('0x6c')],_0x73cd('0x6d'),JSON['stringify'](_0x41a474[_0x73cd('0x13')][_0x41a474[_0x73cd('0x15')][_0x581c85][_0x73cd('0x6c')]][_0x73cd('0x59')]),_0x73cd('0x6e'),JSON['stringify'](_0x41a474['campaignsPreview'][_0x41a474[_0x73cd('0x15')][_0x581c85][_0x73cd('0x6c')]][_0x73cd('0x2c')]),JSON[_0x73cd('0x53')](_0x41a474[_0x73cd('0x15')][_0x581c85]['dialAnswer']),JSON[_0x73cd('0x53')](_['pick'](_0x41a474[_0x73cd('0x15')][_0x581c85],[_0x73cd('0x6f'),'UserId',_0x73cd('0x70'),'ListId'])));return ami[_0x73cd('0x71')]({'action':_0x73cd('0x72'),'channel':_0x41a474[_0x73cd('0x15')][_0x581c85][_0x73cd('0x73')]})['catch'](function(_0x18ecef){if(_0x18ecef[_0x73cd('0x5c')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x41a474[_0x73cd('0x15')][_0x581c85]){ut[_0x73cd('0x74')](_0x41a474[_0x73cd('0x13')][_0x41a474[_0x73cd('0x15')][_0x581c85][_0x73cd('0x6c')]],'[clearZombieChannel]');if(_0x41a474['actions'][_0x581c85][_0x73cd('0x75')]===!![]){ut[_0x73cd('0x76')](_0x41a474['campaignsPreview'][_0x41a474[_0x73cd('0x15')][_0x581c85][_0x73cd('0x6c')]],_0x73cd('0x77'));ut['loggerError'](_0x73cd('0x78')+_0x581c85,_0x41a474[_0x73cd('0x15')][_0x581c85][_0x73cd('0x6c')]);}ut[_0x73cd('0x79')](_0x73cd('0x7a')+_0x581c85,_0x41a474['actions'][_0x581c85][_0x73cd('0x6c')]);delete _0x41a474[_0x73cd('0x15')][_0x581c85];}},0x2328);}});}});};Preview['prototype'][_0x73cd('0x64')]=function(){var _0x3551f5=this;loggerAction[_0x73cd('0x69')]('[action]',_[_0x73cd('0x7b')](this['actions']));for(var _0x40ae35 in this['actions']){if(_0x3551f5[_0x73cd('0x15')][_0x73cd('0x61')](_0x40ae35)){_0x3551f5[_0x73cd('0x67')](_0x40ae35);}}};Preview[_0x73cd('0xf')][_0x73cd('0x7c')]=function(_0x364032){var _0x2eb255=this;rpcDb[_0x73cd('0x7d')](_0x364032['id'],ut[_0x73cd('0x7e')](this[_0x73cd('0x16')]))[_0x73cd('0x7f')](function(_0x21ad8d){if(!_[_0x73cd('0x80')](_0x21ad8d)){for(var _0x1e748b=0x0;_0x1e748b<_0x21ad8d[_0x73cd('0x81')];_0x1e748b+=0x1){if(ut[_0x73cd('0x82')](_0x21ad8d[_0x1e748b][_0x73cd('0x83')])<_0x364032['dialRecallMeTimeout']*0x3c){if(_0x21ad8d[_0x1e748b][_0x73cd('0x84')]&&!_0x21ad8d[_0x1e748b][_0x73cd('0x84')][_0x73cd('0x85')]){_0x2eb255[_0x73cd('0x86')](_0x21ad8d[_0x1e748b]['id'])['then'](ut['logger2'](_0x73cd('0x87')))[_0x73cd('0x88')](ut[_0x73cd('0x89')]('[RecallMe]'));}else{rpcDb[_0x73cd('0x8a')](_0x21ad8d[_0x1e748b]['id']);}}else{var _0xda167c=new Action(_0x21ad8d[_0x1e748b],_0x364032);_0xda167c[_0x73cd('0x8b')]=moment()[_0x73cd('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x364032[_0x73cd('0x3e')]+=0x1;ut['logCustomer'](_0xda167c,0x17,_0x73cd('0x8c'));if(_0x364032[_0x73cd('0x8d')]){rpcDb[_0x73cd('0x8e')](ut[_0x73cd('0x8f')](_0x21ad8d[_0x1e748b]));rpcDb[_0x73cd('0x90')](_0xda167c,_0x73cd('0x91'));}else{ut[_0x73cd('0x92')](_0xda167c,0x16,'RecallFailedTimeout');rpcDb[_0x73cd('0x90')](_0xda167c,_0x73cd('0x93'));rpcDb[_0x73cd('0x94')](_0xda167c,_0x73cd('0x93'));}}}}})['catch'](ut[_0x73cd('0x89')](_0x73cd('0x95')));};Preview[_0x73cd('0xf')][_0x73cd('0x66')]=function(_0xbd0d0c){_0xbd0d0c['sendMessageOneNotActive']=!![];if(ut[_0x73cd('0x96')](_0xbd0d0c[_0x73cd('0x97')])){_0xbd0d0c[_0x73cd('0x5c')]='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0xbd0d0c[_0x73cd('0x32')])){_0xbd0d0c['message']=_0x73cd('0x98');}else if(!this[_0x73cd('0x99')](_0xbd0d0c[_0x73cd('0x4f')])){if(!this[_0x73cd('0x99')](_0xbd0d0c[_0x73cd('0x9a')])){_0xbd0d0c[_0x73cd('0x5c')]=_0x73cd('0x9b');}else{_0xbd0d0c['message']=_0x73cd('0x9c');}}else{_0xbd0d0c['message']='ACTIVE';}emitCampaignPreview(_0xbd0d0c);};Preview[_0x73cd('0xf')][_0x73cd('0x9d')]=function(_0x6c74ca,_0x3bc474,_0x20e485){var _0x1ca8c8=this;var _0xde29cb=this['actions'][_0x3bc474];var _0x3496f1=this[_0x73cd('0x13')][_0xde29cb[_0x73cd('0x6c')]];var _0x21d2a1;var _0x5464ec=![];var _0x1ed57f=0x2;var _0x428b62=0x3;if(_0x3496f1){switch(_0x20e485){case'1':_0x3496f1[_0x73cd('0x3c')]+=0x1;_0xde29cb[_0x73cd('0x9e')]+=0x1;_0xde29cb[_0x73cd('0x9f')]=ut['totalGlobal'](_0xde29cb);ut[_0x73cd('0x92')](_0xde29cb,0x0,_0x73cd('0xa0'));ami['emit'](_0x73cd('0xa1'),ut[_0x73cd('0xa2')](_0xde29cb,_0x73cd('0xa3')));rpcDb[_0x73cd('0x90')](_0xde29cb,_0x73cd('0xa4'));_0x1ca8c8[_0x73cd('0xa5')](_0xde29cb,'0',_0x3496f1)['then'](function(_0x3a2693){_0x5464ec=_0x3a2693[_0x73cd('0xa6')]==0x1;_0x1ed57f=_0x3496f1[_0x73cd('0xa7')];_0x428b62=_0x3496f1[_0x73cd('0xa8')];if(!_0x5464ec){if(ut[_0x73cd('0xa9')](_0xde29cb)>=_0x3496f1[_0x73cd('0xaa')]){_0x21d2a1=ut[_0x73cd('0xab')](_0xde29cb,0xf,'Global');rpcDb[_0x73cd('0x94')](_0x21d2a1,_0x73cd('0xac'));}else{if(_0xde29cb[_0x73cd('0x9e')]>=_0x3496f1[_0x73cd('0xad')]){rpcDb[_0x73cd('0x94')](_0xde29cb,_0x73cd('0xac'));}else{rpcDb[_0x73cd('0xae')](ut['scheduledAt'](_0xde29cb,'countnosuchnumberretry',_0x3496f1[_0x73cd('0xa7')]),_0xde29cb[_0x73cd('0xaf')],_0xde29cb[_0x73cd('0xb0')]);}}delete this[_0x73cd('0x15')][_0x6c74ca[_0x73cd('0xb1')]];}else{_0xde29cb[_0x73cd('0x9e')]++;logger['info'](_0x73cd('0xb2'),_0xde29cb[_0x73cd('0x9e')]);logger[_0x73cd('0x69')]('id',_0xde29cb[_0x73cd('0xb3')]);_0x1ca8c8['incrementPreviewCounters']({'id':_0xde29cb[_0x73cd('0xb3')],'field':{'countnosuchnumberretry':_0xde29cb['countnosuchnumberretry']}})[_0x73cd('0x7f')](function(){_0x1ca8c8['swapAdditionalPhones'](_0xde29cb,_0x1ed57f,_0x428b62)[_0x73cd('0x7f')](function(){});});}});break;case _0x73cd('0xb4'):var _0x56f540=moment()[_0x73cd('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0xde29cb[_0x73cd('0xb5')]=_0x56f540;_0xde29cb[_0x73cd('0xb6')]=_0x56f540;_0xde29cb[_0x73cd('0x75')]=!![];_0x3496f1['pTalking']+=0x1;logger[_0x73cd('0x69')](_0x73cd('0xb7'),_0xde29cb[_0x73cd('0xb8')],'\x20Queue',_0x3496f1[_0x73cd('0x29')],'pTalking:\x20',_0x3496f1['pTalking']);ami[_0x73cd('0x27')](_0x73cd('0xb9'),ut['buildObj'](_0xde29cb,_0x73cd('0xba'),this[_0x73cd('0x13')][_0xde29cb['queue']]));if(_0x3496f1[_0x73cd('0xbb')]){ami[_0x73cd('0x27')](_0x73cd('0xbc'),ut[_0x73cd('0xbd')](_0xde29cb));}break;case'16':ami[_0x73cd('0x27')]('custom:agentcomplete',ut[_0x73cd('0xa2')](_0xde29cb,_0x73cd('0xbe'),this[_0x73cd('0x13')][_0xde29cb[_0x73cd('0x6c')]]));emitVoiceQueueChannelRemove(ut[_0x73cd('0xa2')](_0xde29cb,'complete'));_0x3496f1[_0x73cd('0xbf')]+=0x1;_0x3496f1[_0x73cd('0x30')]+=0x1;_0x3496f1[_0x73cd('0x2b')]+=0x1;ut[_0x73cd('0x76')](_0x3496f1,_0x73cd('0xc0'));_0xde29cb['countglobal']=ut[_0x73cd('0xa9')](_0xde29cb);ut[_0x73cd('0x92')](_0xde29cb,0x4,_0x73cd('0xc1'));rpcDb[_0x73cd('0x90')](_0xde29cb,_0x73cd('0xc2'));rpcDb[_0x73cd('0x94')](_0xde29cb,_0x73cd('0xc3'));rpcDb[_0x73cd('0xc4')](_0xde29cb);_0x3496f1[_0x73cd('0x2e')]+=_0xde29cb[_0x73cd('0xc5')];_0x3496f1[_0x73cd('0x2d')]+=_0xde29cb[_0x73cd('0xc5')];logger[_0x73cd('0x69')](_0x73cd('0xc6'),_0xde29cb[_0x73cd('0xb8')],_0x73cd('0xc7'),_0x3496f1['name'],_0x73cd('0x6e'),_0x3496f1['pTalking']);delete this[_0x73cd('0x15')][_0x6c74ca['linkedid']];break;case _0x73cd('0xc8'):_0x3496f1['outboundBusyCallsDay']+=0x1;_0xde29cb[_0x73cd('0xc9')]+=0x1;_0xde29cb['countglobal']=ut[_0x73cd('0xa9')](_0xde29cb);ut[_0x73cd('0x92')](_0xde29cb,0x5,_0x73cd('0xca'));_0x1ed57f=_0x3496f1['dialBusyRetryFrequency'];_0x428b62=_0x3496f1[_0x73cd('0xa8')];ami['emit'](_0x73cd('0xcb'),ut[_0x73cd('0xa2')](_0xde29cb,'busy'));rpcDb[_0x73cd('0x90')](_0xde29cb,_0x73cd('0xcc'));_0x1ca8c8[_0x73cd('0xa5')](_0xde29cb,'5',_0x3496f1)[_0x73cd('0x7f')](function(_0x4ee876){_0x5464ec=_0x4ee876[_0x73cd('0xa6')]==0x1;if(!_0x5464ec){if(ut[_0x73cd('0xa9')](_0xde29cb)>=_0x3496f1[_0x73cd('0xaa')]){_0x21d2a1=ut['cloneAction'](_0xde29cb,0xf,_0x73cd('0xcd'));rpcDb['createCustomerFinal'](_0x21d2a1,_0x73cd('0xce'));}else{if(_0xde29cb[_0x73cd('0xc9')]>=_0x3496f1[_0x73cd('0xcf')]){rpcDb[_0x73cd('0x94')](_0xde29cb,_0x73cd('0xcc'));}else{rpcDb[_0x73cd('0xae')](ut[_0x73cd('0xd0')](_0xde29cb,_0x73cd('0xc9'),_0x3496f1[_0x73cd('0xd1')]),_0xde29cb['unlockAgent'],_0xde29cb[_0x73cd('0xb0')]);}}}else{_0xde29cb['countbusyretry']++;_0x1ca8c8[_0x73cd('0xd2')]({'id':_0xde29cb['idContact'],'field':{'countbusyretry':_0xde29cb[_0x73cd('0xc9')]}})['then'](function(){_0x1ca8c8['swapAdditionalPhones'](_0xde29cb,_0x1ed57f,_0x428b62)[_0x73cd('0x7f')](function(){});});}});break;case _0x73cd('0xd3'):_0x3496f1['outboundNoAnswerCallsDay']+=0x1;_0xde29cb[_0x73cd('0xd4')]+=0x1;_0xde29cb[_0x73cd('0x9f')]=ut[_0x73cd('0xa9')](_0xde29cb);ut[_0x73cd('0x92')](_0xde29cb,0x3,_0x73cd('0xd5'));_0x1ed57f=_0x3496f1['dialNoAnswerRetryFrequency'];_0x428b62=_0x3496f1['callAdditionalPhoneAfterMin'];var _0x3daf05=ut['buildNoAnswerEventPayload'](_0xde29cb,_0x3496f1);ami[_0x73cd('0x27')]('custom:agentnoanswer',_0x3daf05);rpcDb[_0x73cd('0x90')](_0xde29cb,'[callProgressDetectingCustomer][logNoAnswer]');_0x1ca8c8[_0x73cd('0xa5')](_0xde29cb,'3',_0x3496f1)['then'](function(_0x19f7d8){_0x5464ec=_0x19f7d8[_0x73cd('0xa6')]==0x1;if(!_0x5464ec){if(ut[_0x73cd('0xa9')](_0xde29cb)>=_0x3496f1[_0x73cd('0xaa')]){_0x21d2a1=ut['cloneAction'](_0xde29cb,0xf,_0x73cd('0xcd'));rpcDb[_0x73cd('0x94')](_0x21d2a1,_0x73cd('0xd6'));}else{if(_0xde29cb[_0x73cd('0xd4')]>=_0x3496f1['dialNoAnswerMaxRetry']){rpcDb[_0x73cd('0x94')](_0xde29cb,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x73cd('0xae')](ut[_0x73cd('0xd0')](_0xde29cb,_0x73cd('0xd4'),_0x3496f1[_0x73cd('0xd7')]),_0xde29cb[_0x73cd('0xaf')],_0xde29cb[_0x73cd('0xb0')]);}}}else{_0xde29cb[_0x73cd('0xd4')]++;_0x1ca8c8[_0x73cd('0xd2')]({'id':_0xde29cb[_0x73cd('0xb3')],'field':{'countnoanswerretry':_0xde29cb['countnoanswerretry']}})[_0x73cd('0x7f')](function(){_0x1ca8c8['swapAdditionalPhones'](_0xde29cb,_0x1ed57f,_0x428b62)[_0x73cd('0x7f')](function(){});});}});break;case _0x73cd('0xd8'):_0x3496f1[_0x73cd('0xd9')]+=0x1;_0xde29cb[_0x73cd('0xda')]+=0x1;_0xde29cb[_0x73cd('0x9f')]=ut[_0x73cd('0xa9')](_0xde29cb);ut['logCustomer'](_0xde29cb,0x8,'Congestion');_0x1ed57f=_0x3496f1[_0x73cd('0xdb')];_0x428b62=_0x3496f1[_0x73cd('0xa8')];ami[_0x73cd('0x27')](_0x73cd('0xdc'),ut[_0x73cd('0xa2')](_0xde29cb,_0x73cd('0xdd')));rpcDb[_0x73cd('0x90')](_0xde29cb,'[callProgressDetectingCustomer][logCongestion]');_0x1ca8c8[_0x73cd('0xa5')](_0xde29cb,'8',_0x3496f1)['then'](function(_0x1144ac){_0x5464ec=_0x1144ac['additional']==0x1;if(!_0x5464ec){if(ut['totalGlobal'](_0xde29cb)>=_0x3496f1[_0x73cd('0xaa')]){_0x21d2a1=ut['cloneAction'](_0xde29cb,0xf,_0x73cd('0xcd'));rpcDb[_0x73cd('0x94')](_0x21d2a1,_0x73cd('0xde'));}else{if(_0xde29cb[_0x73cd('0xda')]>=_0x3496f1['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0xde29cb,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x73cd('0xae')](ut[_0x73cd('0xd0')](_0xde29cb,_0x73cd('0xda'),_0x3496f1[_0x73cd('0xd1')]),_0xde29cb['unlockAgent'],_0xde29cb[_0x73cd('0xb0')]);}}}else{_0xde29cb[_0x73cd('0xda')]++;_0x1ca8c8[_0x73cd('0xd2')]({'id':_0xde29cb[_0x73cd('0xb3')],'field':{'countcongestionretry':_0xde29cb['countcongestionretry']}})[_0x73cd('0x7f')](function(){_0x1ca8c8['swapAdditionalPhones'](_0xde29cb,_0x1ed57f,_0x428b62)[_0x73cd('0x7f')](function(){});});}});break;case _0x73cd('0xdf'):_0x3496f1[_0x73cd('0xe0')]+=0x1;_0xde29cb[_0x73cd('0xe1')]+=0x1;_0xde29cb[_0x73cd('0x9f')]=ut['totalGlobal'](_0xde29cb);ut['logCustomer'](_0xde29cb,0x14,_0x73cd('0xe2'));_0x1ed57f=_0x3496f1['dialAgentRejectRetryFrequency'];_0x428b62=_0x3496f1[_0x73cd('0xa8')];ami[_0x73cd('0x27')](_0x73cd('0xe3'),ut['buildObj'](_0xde29cb,_0x73cd('0xe4')));rpcDb[_0x73cd('0x90')](_0xde29cb,_0x73cd('0xe5'));_0x1ca8c8['verifyAdditionalPhones'](_0xde29cb,'20',_0x3496f1)[_0x73cd('0x7f')](function(_0x3a142e){_0x5464ec=_0x3a142e['additional']==0x1;if(!_0x5464ec){if(ut[_0x73cd('0xa9')](_0xde29cb)>=_0x3496f1[_0x73cd('0xaa')]){_0x21d2a1=ut[_0x73cd('0xab')](_0xde29cb,0x14,'AgentReject');rpcDb[_0x73cd('0x94')](_0x21d2a1,_0x73cd('0xe6'));}else{if(_0xde29cb[_0x73cd('0xe1')]>=_0x3496f1[_0x73cd('0xe7')]){rpcDb['createCustomerFinal'](_0xde29cb,_0x73cd('0xe6'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0xde29cb,_0x73cd('0xe1'),_0x3496f1['dialAgentRejectRetryFrequency']),_0xde29cb[_0x73cd('0xaf')],_0xde29cb[_0x73cd('0xb0')]);}}}else{_0xde29cb[_0x73cd('0xd4')]++;_0x1ca8c8[_0x73cd('0xd2')]({'id':_0xde29cb[_0x73cd('0xb3')],'field':{'countnoanswerretry':_0xde29cb['countnoanswerretry']}})[_0x73cd('0x7f')](function(){_0x1ca8c8[_0x73cd('0xe8')](_0xde29cb,_0x1ed57f,_0x428b62)['then'](function(){});});}});break;case _0x73cd('0xe9'):_0x3496f1[_0x73cd('0x40')]+=0x1;_0xde29cb[_0x73cd('0xea')]+=0x1;_0xde29cb[_0x73cd('0x9f')]=ut[_0x73cd('0xa9')](_0xde29cb);ut[_0x73cd('0x92')](_0xde29cb,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0xde29cb,'[callProgressDetectingCustomer][logAbandoned]');_0x1ca8c8['verifyAdditionalPhones'](_0xde29cb,'11',_0x3496f1)[_0x73cd('0x7f')](function(_0x549e86){_0x5464ec=_0x549e86[_0x73cd('0xa6')]==0x1;if(!_0x5464ec){if(ut[_0x73cd('0xa9')](_0xde29cb)>=_0x3496f1[_0x73cd('0xaa')]){_0x21d2a1=ut['cloneAction'](_0xde29cb,0xf,'Global');rpcDb[_0x73cd('0x94')](_0x21d2a1,_0x73cd('0xeb'));}else{if(_0xde29cb['countabandonedetry']>=_0x3496f1[_0x73cd('0xec')]){rpcDb[_0x73cd('0x94')](_0xde29cb,_0x73cd('0xeb'));}else{rpcDb[_0x73cd('0xae')](ut[_0x73cd('0xd0')](_0xde29cb,'countabandonedretry',_0x3496f1[_0x73cd('0xed')]),_0xde29cb[_0x73cd('0xaf')],_0xde29cb['activeContact']);}}}else{_0xde29cb[_0x73cd('0xd4')]++;_0x1ca8c8[_0x73cd('0xd2')]({'id':_0xde29cb[_0x73cd('0xb3')],'field':{'countnoanswerretry':_0xde29cb[_0x73cd('0xd4')]}})[_0x73cd('0x7f')](function(){_0x1ca8c8[_0x73cd('0xe8')](_0xde29cb,_0x1ed57f,_0x428b62)['then'](function(){});});}});break;case'18':_0x3496f1[_0x73cd('0x3f')]+=0x1;_0xde29cb['countmachineretry']+=0x1;_0xde29cb['countglobal']=ut[_0x73cd('0xa9')](_0xde29cb);ut[_0x73cd('0x92')](_0xde29cb,0x12,_0x6c74ca['cause-txt']||_0x6c74ca['dialstatus']);ami[_0x73cd('0x27')](_0x73cd('0xee'),ut[_0x73cd('0xa2')](_0xde29cb,_0x73cd('0xef')));rpcDb[_0x73cd('0x90')](_0xde29cb,_0x73cd('0xf0'));_0x1ca8c8['verifyAdditionalPhones'](_0xde29cb,'18',_0x3496f1)['then'](function(_0x32f8fc){_0x5464ec=_0x32f8fc[_0x73cd('0xa6')]==0x1;if(!_0x5464ec){if(ut[_0x73cd('0xa9')](_0xde29cb)>=_0x3496f1[_0x73cd('0xaa')]){_0x21d2a1=ut[_0x73cd('0xab')](_0xde29cb,0x12,'Global');rpcDb[_0x73cd('0x94')](_0x21d2a1,_0x73cd('0xf0'));}else{rpcDb[_0x73cd('0x94')](_0xde29cb,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0xde29cb[_0x73cd('0xd4')]++;_0x1ca8c8[_0x73cd('0xd2')]({'id':_0xde29cb['idContact'],'field':{'countnoanswerretry':_0xde29cb[_0x73cd('0xd4')]}})[_0x73cd('0x7f')](function(){_0x1ca8c8[_0x73cd('0xe8')](_0xde29cb,_0x1ed57f,_0x428b62)[_0x73cd('0x7f')](function(){});});}});delete this[_0x73cd('0x15')][_0x6c74ca['linkedid']];break;case'19':_0x3496f1[_0x73cd('0x3f')]+=0x1;_0xde29cb[_0x73cd('0x9f')]=ut[_0x73cd('0xa9')](_0xde29cb);ut[_0x73cd('0x92')](_0xde29cb,0x13,_0x6c74ca['cause-txt']||_0x6c74ca[_0x73cd('0xf1')]);ami[_0x73cd('0x27')]('custom:amd',ut[_0x73cd('0xa2')](_0xde29cb,_0x73cd('0xef')));rpcDb[_0x73cd('0x90')](_0xde29cb,'[callProgressDetectingCustomer][machine]');_0x1ca8c8['verifyAdditionalPhones'](_0xde29cb,'18',_0x3496f1)[_0x73cd('0x7f')](function(_0x3e8342){_0x5464ec=_0x3e8342[_0x73cd('0xa6')]==0x1;if(!_0x5464ec){if(ut['totalGlobal'](_0xde29cb)>=_0x3496f1[_0x73cd('0xaa')]){_0x21d2a1=ut[_0x73cd('0xab')](_0xde29cb,0xf,_0x73cd('0xcd'));rpcDb['createCustomerFinal'](_0x21d2a1,_0x73cd('0xf2'));}else{rpcDb[_0x73cd('0x94')](_0xde29cb,_0x73cd('0xf2'));}}else{_0xde29cb[_0x73cd('0xd4')]++;_0x1ca8c8['incrementPreviewCounters']({'id':_0xde29cb[_0x73cd('0xb3')],'field':{'countnoanswerretry':_0xde29cb[_0x73cd('0xd4')]}})[_0x73cd('0x7f')](function(){_0x1ca8c8[_0x73cd('0xe8')](_0xde29cb,_0x1ed57f,_0x428b62)['then'](function(){});});}});delete this[_0x73cd('0x15')][_0x6c74ca[_0x73cd('0xb1')]];break;default:if(_0xde29cb[_0x73cd('0x75')]){ut[_0x73cd('0x76')](_0x3496f1,_0x73cd('0xf3'));ut[_0x73cd('0x79')](_0x73cd('0xf4')+_0x3496f1['name'],_0x6c74ca);}_0x3496f1['outboundUnknownCallsDay']+=0x1;_0xde29cb[_0x73cd('0x9f')]=ut[_0x73cd('0xa9')](_0xde29cb);ut[_0x73cd('0x92')](_0xde29cb,0xc,_0x6c74ca[_0x73cd('0xf5')]||_0x6c74ca['dialstatus']);_0x1ed57f=_0x3496f1[_0x73cd('0xf6')];_0x428b62=_0x3496f1[_0x73cd('0xa8')];rpcDb[_0x73cd('0x90')](_0xde29cb,_0x73cd('0xf7'));_0x1ca8c8['verifyAdditionalPhones'](_0xde29cb,'20',_0x3496f1)[_0x73cd('0x7f')](function(_0x48647e){_0x5464ec=_0x48647e[_0x73cd('0xa6')]==0x1;if(!_0x5464ec){if(ut[_0x73cd('0xa9')](_0xde29cb)>=_0x3496f1['dialGlobalMaxRetry']){_0x21d2a1=ut['cloneAction'](_0xde29cb,0xf,_0x73cd('0xcd'));rpcDb['createCustomerFinal'](_0x21d2a1,_0x73cd('0xf8'));}else{rpcDb[_0x73cd('0x94')](_0xde29cb,_0x73cd('0xf8'));}delete this[_0x73cd('0x15')][_0x6c74ca[_0x73cd('0xb1')]];}else{_0x1ca8c8['swapAdditionalPhones'](_0xde29cb,_0x1ed57f,_0x428b62)[_0x73cd('0x7f')](function(){});}});}if(!(_0xde29cb[_0x73cd('0x75')]&&_0x20e485==='16')){ut[_0x73cd('0x74')](_0x3496f1,_0x73cd('0xf9'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0xde29cb[_0x73cd('0xb8')],'\x20Queue',_0x3496f1[_0x73cd('0x29')],_0x73cd('0x6d'),_0x3496f1[_0x73cd('0x59')]);}if(_0x20e485!==_0x73cd('0xb4')){delete this[_0x73cd('0x15')][_0x6c74ca[_0x73cd('0xb1')]];delete this[_0x73cd('0x15')][_0x6c74ca[_0x73cd('0xfa')]];}}};Preview[_0x73cd('0xf')][_0x73cd('0xfb')]=function(_0x2974b6,_0x5c1d9a,_0x556afa){if(_[_0x73cd('0xfc')](_0x5c1d9a)&&'object'!==typeof _0x5c1d9a){return;}if(_['isUndefined'](_0x556afa)&&'object'!==typeof _0x556afa){return;}switch(_0x556afa[_0x73cd('0xfd')]){case'0':ut['logAgent'](_0x2974b6,0x0,_0x73cd('0xa0'));rpcDb[_0x73cd('0xfe')](_0x2974b6,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x73cd('0xff')](_0x2974b6,0x3,'NoAnswer');rpcDb[_0x73cd('0xfe')](_0x2974b6,_0x73cd('0x100'));break;case'5':ut[_0x73cd('0xff')](_0x2974b6,0x5,'Busy');rpcDb[_0x73cd('0xfe')](_0x2974b6,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x73cd('0xff')](_0x2974b6,0x8,'Congestion');rpcDb[_0x73cd('0xfe')](_0x2974b6,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x73cd('0xff')](_0x2974b6,0x16,'AnswerAGI');rpcDb[_0x73cd('0xfe')](_0x2974b6,_0x73cd('0x101'));break;default:ut[_0x73cd('0xff')](_0x2974b6,0xc,_0x556afa[_0x73cd('0xfd')]);rpcDb['createAgentHistory'](_0x2974b6,_0x73cd('0x102'));}ut[_0x73cd('0x74')](_0x5c1d9a,_0x73cd('0x103'));logger[_0x73cd('0x69')](_0x73cd('0x104'),_0x2974b6[_0x73cd('0xb8')],'\x20Queue',_0x5c1d9a[_0x73cd('0x29')],_0x73cd('0x6d'),_0x5c1d9a['originated']);delete this['actions'][_0x2974b6[_0x73cd('0xb8')]];};Preview[_0x73cd('0xf')][_0x73cd('0xa5')]=function(_0x109fff,_0x1bba9d,_0x37b0f9){return Promise['resolve']()[_0x73cd('0x7f')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x109fff,_0x1bba9d,_0x37b0f9))[_0x73cd('0x88')](logger[_0x73cd('0x69')](_0x73cd('0x105')));};Preview[_0x73cd('0xf')][_0x73cd('0xe8')]=function(_0x584f92,_0x4b154a,_0x58c4f9){return Promise[_0x73cd('0x106')]()[_0x73cd('0x7f')](cmHopperAdditionalPhone[_0x73cd('0xe8')](_0x584f92,_0x4b154a,_0x58c4f9))[_0x73cd('0x88')](logger[_0x73cd('0x69')](_0x73cd('0x107')));};Preview[_0x73cd('0xf')]['incrementPreviewCounters']=function(_0x150a79){return Promise[_0x73cd('0x106')]()[_0x73cd('0x7f')](cmHopperAdditionalPhone[_0x73cd('0xd2')](_0x150a79))[_0x73cd('0x88')](logger[_0x73cd('0x69')]('[incrementPreviewCounters]\x20'));};Preview[_0x73cd('0xf')][_0x73cd('0x108')]=function(_0x2f5bfc,_0x4e1d0a,_0x25d066,_0x76a50a,_0x3e11cc){var _0x5b7d7b=this;return new Promise(function(_0x207d9e,_0x1ae953){if(_[_0x73cd('0x80')](_0x4e1d0a)||_[_0x73cd('0x80')](_0x4e1d0a['Contact'])||_['isNil'](_0x4e1d0a['phone'])||_[_0x73cd('0x80')](_0x4e1d0a[_0x73cd('0x70')])){_0x1ae953(ut[_0x73cd('0x5c')](_0x73cd('0x109'),_0x76a50a,_0x3e11cc));return;}var _0xc9774a=uuid['v4']();var _0x2f1ec1=_0x5b7d7b[_0x73cd('0x13')][_0x4e1d0a[_0x73cd('0x6b')][_0x73cd('0x29')]];var _0xe2a1c5=_0x25d066?_0x5b7d7b[_0x73cd('0x16')][_0x25d066]['id']:undefined;_0x5b7d7b[_0x73cd('0x15')][_0xc9774a]=new Action(_0x4e1d0a,_0x2f1ec1,_0xc9774a,_0x25d066,_0xe2a1c5);var _0x46d878=_0x5b7d7b[_0x73cd('0x15')][_0xc9774a];_0x46d878['unlockAgent']=_0x76a50a;_0x46d878[_0x73cd('0xb0')]=_0x3e11cc;_0x46d878[_0x73cd('0x10a')]=_0x25d066;if(_[_0x73cd('0x10b')](_0x2f5bfc)){_0x5b7d7b[_0x73cd('0x10c')](_0x46d878,_0x2f1ec1,_0x4e1d0a,_0x25d066)[_0x73cd('0x7f')](function(_0x4d28b6){logger[_0x73cd('0x69')](_0x73cd('0x10d'),_0x73cd('0x10e')+_0x46d878['queue']+'\x20IdHopper:\x20'+_0x46d878[_0x73cd('0xb3')],JSON[_0x73cd('0x53')](_0x4d28b6));ami[_0x73cd('0x27')]('custom:agentcalled',ut[_0x73cd('0xa2')](_0x46d878,'called',_0x5b7d7b[_0x73cd('0x13')][_0x46d878[_0x73cd('0x6c')]]));_0x207d9e(ut[_0x73cd('0x5c')](_0x73cd('0x10f')));})[_0x73cd('0x88')](function(_0x17caf3){ut[_0x73cd('0x110')]('[Preview][execCall][failure]',_0x17caf3);_0x1ae953(ut[_0x73cd('0x5c')](_0x73cd('0x111'),_0x76a50a,_0x3e11cc));});}else{_0x2f1ec1[_0x73cd('0x36')]+=0x1;ut[_0x73cd('0x112')](_0x46d878);rpcDb[_0x73cd('0x113')](_0x46d878,'[Blacklist][error]');delete _0x5b7d7b[_0x73cd('0x15')][_0xc9774a];_0x1ae953(ut[_0x73cd('0x5c')]('Contact\x20in\x20black\x20List',_0x76a50a,_0x3e11cc));}});};Preview[_0x73cd('0xf')]['isTrunkReachable']=function(_0xb656d9){return!_[_0x73cd('0x80')](_0xb656d9)&&!_['isNil'](_0xb656d9[_0x73cd('0x29')])&&!_['isNil'](_0xb656d9[_0x73cd('0x50')])&&_0xb656d9['active']&&!_['isNil'](this['trunks'][util['format'](_0x73cd('0x114'),_0xb656d9['name'])])&&!_['isNil'](this['trunks'][util[_0x73cd('0x54')]('SIP/%s',_0xb656d9[_0x73cd('0x29')])][_0x73cd('0x72')])&&(this[_0x73cd('0x14')][util[_0x73cd('0x54')](_0x73cd('0x114'),_0xb656d9['name'])][_0x73cd('0x72')]===_0x73cd('0x115')||this[_0x73cd('0x14')][util[_0x73cd('0x54')]('SIP/%s',_0xb656d9[_0x73cd('0x29')])][_0x73cd('0x72')]===_0x73cd('0x116'));};Preview['prototype'][_0x73cd('0x86')]=function(_0x3db7a,_0x4e250f){var _0x4753a3=this;return new Promise(function(_0xed43c5,_0x256f3e){_0x4753a3[_0x73cd('0x117')](_0x3db7a,_0x4e250f)['then'](function(_0x950d2f){_0xed43c5(_['pick'](_0x950d2f,[_0x73cd('0x5c')]));})[_0x73cd('0x88')](function(_0x1bf2e8){if(_0x1bf2e8['unlock']){rpcDb[_0x73cd('0x118')](_0x3db7a);}if(_0x1bf2e8[_0x73cd('0x50')]){rpcDb[_0x73cd('0x8a')](_0x3db7a);}_0x256f3e(_['pick'](_0x1bf2e8,[_0x73cd('0x5c')]));});});};Preview['prototype']['execRun']=function(_0x42418c,_0x5d322d){var _0x24d7a5=this;return new Promise(function(_0x27399c,_0x29d923){var _0x52a56f,_0x315f26;rpcDb[_0x73cd('0x119')](_0x42418c)[_0x73cd('0x7f')](function(_0x3e0a5d){if(!_[_0x73cd('0x80')](_0x3e0a5d[0x0])){_0x315f26=_0x3e0a5d[0x0]['recallme']?![]:!![];_0x52a56f=_0x3e0a5d[0x0][_0x73cd('0x11a')]?!![]:![];_0x52a56f=_0x5d322d?!![]:_0x52a56f;}var _0x38116e=_0x24d7a5[_0x73cd('0x11b')](_0x3e0a5d);if(_0x38116e[_0x73cd('0x11c')]){rpcDb[_0x73cd('0x11d')](_[_0x73cd('0x11e')](_0x3e0a5d[0x0],[_0x73cd('0x70'),_0x73cd('0x11f')]))[_0x73cd('0x7f')](function(_0x378c17){_0x24d7a5['checkInBlack'](_0x378c17,_0x3e0a5d[0x0],_0x5d322d,_0x315f26,_0x52a56f)[_0x73cd('0x7f')](function(_0x3842cd){_0x27399c(_0x3842cd);})[_0x73cd('0x88')](function(_0x1f1937){_0x29d923(_0x1f1937);});})[_0x73cd('0x88')](function(_0x5253d3){ut['logger']('[Preview][checkIsBlackList]',_0x5253d3);_0x29d923(ut[_0x73cd('0x5c')](_0x73cd('0x120'),_0x315f26,_0x52a56f));});}else{_0x29d923(ut[_0x73cd('0x5c')](_0x38116e[_0x73cd('0x5c')],_0x315f26,_0x52a56f));}})['catch'](function(_0x39570b){ut[_0x73cd('0x110')](_0x73cd('0x121'),_0x39570b);_0x29d923(ut[_0x73cd('0x5c')](_0x73cd('0x120'),![],!![]));});});};Preview['prototype'][_0x73cd('0x11b')]=function(_0x363513){if(_[_0x73cd('0x80')](_0x363513)||_[_0x73cd('0x10b')](_0x363513)||!_[_0x73cd('0x80')](_0x363513[0x0][_0x73cd('0x84')])&&_[_0x73cd('0x80')](_0x363513[0x0]['Agent'][_0x73cd('0x29')])){ut[_0x73cd('0x110')]('[Preview][validateContact][Empty\x20Contact]',_0x363513);return{'isValid':![],'message':_0x73cd('0x122')};}var _0x35237f=this[_0x73cd('0x13')][_0x363513[0x0][_0x73cd('0x6b')][_0x73cd('0x29')]];_0x35237f['message']=_0x73cd('0x9c');if(_[_0x73cd('0x80')](_0x35237f)){ut[_0x73cd('0x110')](_0x73cd('0x123'),_0x35237f);return{'isValid':![],'message':_0x73cd('0x124')};}if(!this[_0x73cd('0x99')](_0x35237f[_0x73cd('0x4f')])){ut[_0x73cd('0x110')](_0x73cd('0x125'),'campaign\x20Name:\x20'+_0x35237f[_0x73cd('0x29')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x73cd('0x99')](_0x35237f[_0x73cd('0x9a')])){ut['logger'](_0x73cd('0x125'),_0x35237f[_0x73cd('0x29')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x73cd('0x126')](_0x35237f[_0x73cd('0x32')])){ut[_0x73cd('0x110')](_0x73cd('0x127'),_0x35237f[_0x73cd('0x29')]+_0x73cd('0x128'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x35237f['name']+_0x73cd('0x128')};}return{'isValid':!![],'message':_0x73cd('0x129')};};Preview['prototype'][_0x73cd('0x10c')]=function(_0x22bec3,_0x10289e,_0x4a8dfb,_0x4d8c62){var _0x1af28c=this;return new Promise(function(_0x4c6632,_0x14e3ea){var _0x598083=_0x22bec3[_0x73cd('0xb8')];var _0x21d90f=_0x1af28c['isTrunkReachable'](_0x10289e[_0x73cd('0x4f')])?util[_0x73cd('0x54')](_0x73cd('0x12a'),_0x10289e['Trunk'][_0x73cd('0x29')],_[_0x73cd('0x80')](_0x10289e['dialPrefix'])?'':_0x10289e[_0x73cd('0x34')][_0x73cd('0x12b')]()||'',_0x10289e[_0x73cd('0x12c')]>0x0?_0x4a8dfb['phone']['substring'](_0x10289e['dialCutDigit']):_0x4a8dfb[_0x73cd('0x11f')]):util['format'](_0x73cd('0x12a'),_[_0x73cd('0x80')](_0x10289e[_0x73cd('0x9a')])?_0x10289e[_0x73cd('0x4f')][_0x73cd('0x29')]:_0x10289e[_0x73cd('0x9a')]['name'],_[_0x73cd('0x80')](_0x10289e['dialPrefix'])?'':_0x10289e[_0x73cd('0x34')][_0x73cd('0x12b')]()||'',_0x10289e[_0x73cd('0x12c')]>0x0?_0x4a8dfb[_0x73cd('0x11f')][_0x73cd('0x12d')](_0x10289e[_0x73cd('0x12c')]):_0x4a8dfb[_0x73cd('0x11f')]);var _0x12934b=_0x1af28c[_0x73cd('0x99')](_0x10289e[_0x73cd('0x4f')])?ut['getCallerId'](_0x10289e[_0x73cd('0x4f')][_0x73cd('0x51')],_0x10289e[_0x73cd('0x12e')],_0x10289e[_0x73cd('0x12f')]>0x0?ut[_0x73cd('0x130')](_0x10289e[_0x73cd('0x131')],_0x10289e['dialRandomLastDigitCallerIdNumber']):_0x10289e[_0x73cd('0x131')]):ut[_0x73cd('0x132')](_[_0x73cd('0x80')](_0x10289e[_0x73cd('0x9a')])?_0x10289e[_0x73cd('0x4f')][_0x73cd('0x51')]:_0x10289e['TrunkBackup'][_0x73cd('0x51')],_0x10289e[_0x73cd('0x12e')],_0x10289e[_0x73cd('0x12f')]>0x0?ut[_0x73cd('0x130')](_0x10289e[_0x73cd('0x131')],_0x10289e[_0x73cd('0x12f')]):_0x10289e['dialOriginateCallerIdNumber']);if(_0x12934b){_0x22bec3['originatecalleridname']=ut[_0x73cd('0x133')](_0x12934b);_0x22bec3['originatecalleridnum']=ut[_0x73cd('0x134')](_0x12934b);}var _0x312278=ut[_0x73cd('0x135')](_0x10289e,_0x4a8dfb,_0x21d90f,_0x12934b,_0x598083,_0x22bec3);_[_0x73cd('0x136')](_0x22bec3,ut[_0x73cd('0x137')](_0x312278));_0x22bec3['starttime']=moment()['format'](_0x73cd('0x138'));_0x10289e[_0x73cd('0x139')]=_0x312278;ami[_0x73cd('0x71')](ut['variablesAction'](_0x22bec3,_0x10289e,_0x312278,_0x22bec3[_0x73cd('0xb0')],_0x4d8c62))[_0x73cd('0x7f')](function(_0x3e8a78){_0x10289e[_0x73cd('0x59')]+=0x1;logger[_0x73cd('0x69')](_0x73cd('0x13a'),_0x598083,_0x73cd('0xc7'),_0x10289e[_0x73cd('0x29')],_0x73cd('0x6d'),_0x10289e[_0x73cd('0x59')]);_0x4c6632(_0x3e8a78);})[_0x73cd('0x88')](function(_0x3d9784){ut[_0x73cd('0xff')](_0x22bec3,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x22bec3,_0x73cd('0x13b'));_0x14e3ea(_0x3d9784);});});};Preview[_0x73cd('0xf')][_0x73cd('0x20')]=function(_0x39df41){if(this[_0x73cd('0x15')][_0x39df41[_0x73cd('0xb1')]]){this[_0x73cd('0x15')][_0x39df41[_0x73cd('0xb1')]][_0x73cd('0x73')]=_0x39df41['channel'];}};Preview['prototype'][_0x73cd('0x18')]=function(_0x1e2ebc){var _0xa65421=this;var _0x501c3c=this[_0x73cd('0x15')][_0x1e2ebc[_0x73cd('0x13c')]];if(_0x501c3c){if(_0x501c3c['lookAgent']&&this[_0x73cd('0x16')][_0x501c3c[_0x73cd('0x10a')]]){ut[_0x73cd('0x13d')](_0x501c3c,this[_0x73cd('0x16')][_0x501c3c['lookAgent']][_0x73cd('0x29')],this['agents'][_0x501c3c['lookAgent']]['id']);}var _0xf985ec=_[_0x73cd('0x13e')](_0x501c3c);_0xf985ec['responsetime']=moment()[_0x73cd('0x54')](_0x73cd('0x138'));var _0x527501=_0xa65421['campaignsPreview'][_0x501c3c[_0x73cd('0x6c')]];if(ut['isFailure'](_0x1e2ebc[_0x73cd('0x13f')])){if(_0x501c3c[_0x73cd('0xaf')]){rpcDb[_0x73cd('0x118')](_0x501c3c[_0x73cd('0xb3')]);}if(_0x501c3c[_0x73cd('0xb0')]){rpcDb[_0x73cd('0x8a')](_0x501c3c[_0x73cd('0xb3')]);}ami[_0x73cd('0x27')](_0x73cd('0x140'),ut[_0x73cd('0xa2')](_0x501c3c,_0x73cd('0x141'),this['campaignsPreview'][_0x501c3c[_0x73cd('0x6c')]]));this[_0x73cd('0xfb')](_0xf985ec,_0x527501,_0x1e2ebc);}else{_0x501c3c[_0x73cd('0x8b')]=moment()[_0x73cd('0x54')](_0x73cd('0x138'));ut['logAgent'](_0xf985ec,0x4,_0x73cd('0xc1'));rpcDb['createAgentHistory'](_0xf985ec,_0x73cd('0x142'));}}};Preview[_0x73cd('0xf')][_0x73cd('0x1b')]=function(_0xf0e0ac){var _0x18b84d=this[_0x73cd('0x15')][_0xf0e0ac[_0x73cd('0xb1')]];var _0x408652;if(_0x18b84d){_0x408652=this[_0x73cd('0x13')][_0x18b84d['queue']];logger[_0x73cd('0x69')](_0x73cd('0x143'),_0xf0e0ac[_0x73cd('0xb1')],_0x73cd('0xc7'),_0x408652[_0x73cd('0x29')],_0x73cd('0x6e'),_0x408652[_0x73cd('0x2c')]);}if(this[_0x73cd('0x15')][_0xf0e0ac['linkedid']]&&_0xf0e0ac[_0x73cd('0xb1')]!==_0xf0e0ac[_0x73cd('0xb8')]){if(_0xf0e0ac[_0x73cd('0x144')]==='16'&&this[_0x73cd('0x15')][_0xf0e0ac['linkedid']][_0x73cd('0x75')]){this[_0x73cd('0x9d')](_0xf0e0ac,_0xf0e0ac[_0x73cd('0xb1')],_0xf0e0ac[_0x73cd('0x144')]);}else if(this[_0x73cd('0x15')][_0xf0e0ac[_0x73cd('0xb1')]][_0x73cd('0x75')]){logger['info'](_0x73cd('0x145'),_0xf0e0ac[_0x73cd('0xb1')],_0xf0e0ac['cause'],_0x73cd('0xc7'),_0x408652[_0x73cd('0x29')],_0x73cd('0x6e'),_0x408652['pTalking']);this[_0x73cd('0x9d')](_0xf0e0ac,_0xf0e0ac[_0x73cd('0xb1')],_0xf0e0ac[_0x73cd('0x144')]);}}else if(_0x18b84d&&_[_0x73cd('0x80')](_0x18b84d[_0x73cd('0x146')])&&_0x408652[_0x73cd('0x147')]&&_0xf0e0ac['linkedid']===_0xf0e0ac[_0x73cd('0xb8')]&&_[_0x73cd('0x80')](_0xf0e0ac[_0x73cd('0xfd')])&&_0xf0e0ac[_0x73cd('0x144')]==='16'&&_0xf0e0ac[_0x73cd('0x148')]==='6'&&_['isUndefined'](_0x18b84d[_0x73cd('0x149')])){if(_0x18b84d[_0x73cd('0xaf')]){rpcDb[_0x73cd('0x118')](_0x18b84d[_0x73cd('0xb3')]);}if(_0x18b84d['activeContact']){rpcDb[_0x73cd('0x8a')](_0x18b84d[_0x73cd('0xb3')]);}_0xf0e0ac['reason']='22';this[_0x73cd('0xfb')](_0x18b84d,_0x408652,_0xf0e0ac);}else if(_0x18b84d&&_0x18b84d[_0x73cd('0x149')]){if(_0xf0e0ac[_0x73cd('0x144')]==='16'&&this[_0x73cd('0x15')][_0xf0e0ac[_0x73cd('0xb1')]][_0x73cd('0x75')]){logger[_0x73cd('0x69')](_0x73cd('0x14a'),_0xf0e0ac[_0x73cd('0xb1')],_0xf0e0ac[_0x73cd('0x144')],_0x73cd('0xc7'),_0x408652[_0x73cd('0x29')],_0x73cd('0x6e'),_0x408652[_0x73cd('0x2c')]);this[_0x73cd('0x9d')](_0xf0e0ac,_0xf0e0ac[_0x73cd('0xb1')],_0xf0e0ac[_0x73cd('0x144')]);}else if(this[_0x73cd('0x15')][_0xf0e0ac[_0x73cd('0xb1')]][_0x73cd('0x75')]){logger[_0x73cd('0x69')](_0x73cd('0x145'),_0xf0e0ac[_0x73cd('0xb1')],_0xf0e0ac[_0x73cd('0x144')],_0x73cd('0xc7'),_0x408652[_0x73cd('0x29')],_0x73cd('0x6e'),_0x408652[_0x73cd('0x2c')]);this[_0x73cd('0x9d')](_0xf0e0ac,_0xf0e0ac[_0x73cd('0xb1')],_0xf0e0ac[_0x73cd('0x144')]);}}};Preview[_0x73cd('0xf')][_0x73cd('0x1e')]=function(_0x4921d2){if(this[_0x73cd('0x15')][_0x4921d2[_0x73cd('0xfa')]]&&_0x4921d2[_0x73cd('0xfa')]!==_0x4921d2[_0x73cd('0x14b')]){this[_0x73cd('0x9d')](_0x4921d2,_0x4921d2[_0x73cd('0xfa')],_0x4921d2[_0x73cd('0xf1')]);}};Preview[_0x73cd('0xf')][_0x73cd('0x1d')]=function(_0x87b201){if(this[_0x73cd('0x15')][_0x87b201[_0x73cd('0xb1')]]&&_0x87b201[_0x73cd('0xb1')]!==_0x87b201['uniqueid']&&!this[_0x73cd('0x15')][_0x87b201['linkedid']][_0x73cd('0x75')]){if(_0x87b201[_0x73cd('0x144')]==='1'){this[_0x73cd('0x9d')](_0x87b201,_0x87b201['linkedid'],_0x87b201[_0x73cd('0x144')]);}}};Preview[_0x73cd('0xf')][_0x73cd('0x14c')]=function(_0x5cae4c,_0x523663,_0x16e389){if(this[_0x73cd('0x15')][_0x5cae4c]){if(_[_0x73cd('0x80')](this[_0x73cd('0x15')][_0x5cae4c][_0x73cd('0x139')])){this[_0x73cd('0x15')][_0x5cae4c][_0x73cd('0x139')]={};}this[_0x73cd('0x15')][_0x5cae4c]['variables'][_0x523663]=_0x16e389;}};Preview[_0x73cd('0xf')][_0x73cd('0x22')]=function(_0x1af2b6){try{if(!_[_0x73cd('0x80')](_0x1af2b6)){if(ut[_0x73cd('0x14d')](_[_0x73cd('0x14e')](_0x1af2b6['variable'])[0x0])){this[_0x73cd('0x14c')](_0x1af2b6[_0x73cd('0xb8')],_[_0x73cd('0x14e')](_0x1af2b6['variable'])[0x0],_0x1af2b6[_0x73cd('0x14f')]);}}}catch(_0x4faeca){logger[_0x73cd('0x150')](_0x73cd('0x151'),util[_0x73cd('0x152')](_0x4faeca,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x147e7b){if(_0x147e7b){if(this['actions'][_0x147e7b['transfertargetlinkedid']]){this['actions'][_0x147e7b[_0x73cd('0x153')]]['transfer']=!![];}}};Preview[_0x73cd('0xf')][_0x73cd('0x25')]=function(_0xccabb0){if(_0xccabb0){if(this[_0x73cd('0x15')][_0xccabb0[_0x73cd('0x154')]]){this[_0x73cd('0x15')][_0xccabb0['transfererlinkedid']][_0x73cd('0x149')]=!![];}}};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 c9b2377..9db1a6b 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 _0x9e81=['rescheduleContact','UserId','active','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x9e81,0x87));var _0x19e8=function(_0x59e7e0,_0x3ec148){_0x59e7e0=_0x59e7e0-0x0;var _0x26b058=_0x9e81[_0x59e7e0];return _0x26b058;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x19e8('0x0'))(_0x19e8('0x1'));var _=require(_0x19e8('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x19e8('0x3'));var cmHopperHistory=require(_0x19e8('0x4'));var cmHopperBlack=require(_0x19e8('0x5'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x19e8('0x6'));var voiceQueueReport=require(_0x19e8('0x7'));function loggerCatch(_0x2abcdf){return function(_0x5b42f2){logger[_0x19e8('0x8')](_0x2abcdf,util[_0x19e8('0x9')](_0x5b42f2,{'showHidden':![],'depth':null}));};}function create(_0x2ee370){return BPromise[_0x19e8('0xa')]()[_0x19e8('0xb')](cmHopperHistory[_0x19e8('0xc')](_0x2ee370))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x458038){return BPromise[_0x19e8('0xa')]()[_0x19e8('0xb')](agentReportPreview[_0x19e8('0xc')](_0x458038))[_0x19e8('0xd')](loggerCatch(_0x19e8('0xe')));}function moveContact(_0x480742){return BPromise[_0x19e8('0xa')]()[_0x19e8('0xb')](cmHopper['moveContactManagedDialer'](_0x480742,!![]))[_0x19e8('0xd')](loggerCatch(_0x19e8('0xf')));}exports[_0x19e8('0x10')]=function(_0x5e909b){return BPromise[_0x19e8('0xa')]()[_0x19e8('0xb')](cmHopperBlack['checkIsBlackList'](_0x5e909b))[_0x19e8('0xd')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x19e8('0x11')]=function(_0x29de8d){return BPromise[_0x19e8('0xa')]()['then'](cmHopper[_0x19e8('0x11')](_0x29de8d))[_0x19e8('0xd')](loggerCatch('[getContactPreview]\x20'));};exports[_0x19e8('0xc')]=function(_0x4e7868,_0x406325){create(_0x4e7868)['catch'](loggerCatch(_0x406325));moveContact(_0x4e7868)[_0x19e8('0xd')](loggerCatch(_0x406325));};exports[_0x19e8('0x12')]=function(_0x20aab3,_0x2e9b3b){createAgent(_0x20aab3)[_0x19e8('0xd')](loggerCatch(_0x2e9b3b));};exports[_0x19e8('0x13')]=function(_0x1f87dc,_0x3ff45b){create(_0x1f87dc)['catch'](loggerCatch(_0x3ff45b));};exports[_0x19e8('0x14')]=function(_0x5c61c7,_0x34b647){moveContact(_0x5c61c7)[_0x19e8('0xd')](loggerCatch(_0x34b647));};exports[_0x19e8('0x15')]=function(_0xc6e6b7,_0x531f92,_0x1458fc){if(_0x531f92){_0xc6e6b7[_0x19e8('0x16')]=null;}if(_0x1458fc){_0xc6e6b7[_0x19e8('0x17')]=![];}return BPromise['resolve']()[_0x19e8('0xb')](cmHopper[_0x19e8('0x15')](_0xc6e6b7))[_0x19e8('0xd')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x3c9163){return BPromise[_0x19e8('0xa')]()['then'](cmHopper[_0x19e8('0x18')](_0x3c9163))[_0x19e8('0xd')](loggerCatch('[countReScheduled]\x20'));};exports[_0x19e8('0x19')]=function(_0x1e0e7c){return BPromise['resolve']()[_0x19e8('0xb')](cmHopper['unlockContact']({'UserId':null},_0x1e0e7c,0x1))[_0x19e8('0xd')](loggerCatch(_0x19e8('0x1a')));};exports[_0x19e8('0x1b')]=function(_0x43db86){return BPromise[_0x19e8('0xa')]()[_0x19e8('0xb')](cmHopper[_0x19e8('0x19')]({'active':![]},_0x43db86,0x1))[_0x19e8('0xd')](loggerCatch(_0x19e8('0x1c')));};exports['crateCustomerReportQueue']=function(_0x1b2cf9){var _0x156e0b={};_0x156e0b[_0x19e8('0x1d')]=_0x1b2cf9[_0x19e8('0x1d')];_0x156e0b['uniqueid']=_0x1b2cf9['uniqueid'];_0x156e0b[_0x19e8('0x1e')]=_0x1b2cf9[_0x19e8('0x1e')];_0x156e0b[_0x19e8('0x1f')]=_0x1b2cf9['calleridname'];_0x156e0b[_0x19e8('0x20')]=_0x1b2cf9['queue'];_0x156e0b[_0x19e8('0x21')]=_0x1b2cf9[_0x19e8('0x22')];_0x156e0b[_0x19e8('0x23')]=_0x1b2cf9[_0x19e8('0x22')];_0x156e0b['queuecallercomplete']=0x1;_0x156e0b[_0x19e8('0x24')]=_0x1b2cf9[_0x19e8('0x25')];_0x156e0b[_0x19e8('0x26')]=_0x1b2cf9[_0x19e8('0x27')];_0x156e0b[_0x19e8('0x28')]='from-sip';_0x156e0b[_0x19e8('0x29')]=_0x19e8('0x2a');_0x156e0b[_0x19e8('0x2b')]=0x0;_0x156e0b[_0x19e8('0x2c')]=0x1;_0x156e0b[_0x19e8('0x2d')]=_0x1b2cf9[_0x19e8('0x27')];_0x156e0b['queuecallerexitreason']=_0x19e8('0x2e');return BPromise[_0x19e8('0xa')]()[_0x19e8('0xb')](voiceQueueReport[_0x19e8('0x2f')](_0x156e0b))[_0x19e8('0xd')](loggerCatch(_0x19e8('0x30')));};exports[_0x19e8('0x31')]=function(_0x4dc03a,_0x442281){return BPromise['resolve']()[_0x19e8('0xb')](cmHopper[_0x19e8('0x31')](_0x4dc03a,_0x442281))['catch'](loggerCatch(_0x19e8('0x32')));};exports['rescheduleContactInQueue']=function(_0x1cd3a4){return BPromise['resolve']()[_0x19e8('0xb')](cmHopper[_0x19e8('0x15')](_0x1cd3a4,!![],!![]))['catch'](loggerCatch(_0x19e8('0x33')));}; \ No newline at end of file +var _0x1a69=['queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/voiceQueueRt','../rpc/voiceQueueReport','then','createHistory','catch','resolve','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','answertime'];(function(_0x1eb186,_0x3e8197){var _0x49079e=function(_0x2ebd6f){while(--_0x2ebd6f){_0x1eb186['push'](_0x1eb186['shift']());}};_0x49079e(++_0x3e8197);}(_0x1a69,0x124));var _0x91a6=function(_0x11cc41,_0x3c30ab){_0x11cc41=_0x11cc41-0x0;var _0x474e9e=_0x1a69[_0x11cc41];return _0x474e9e;};'use strict';var util=require(_0x91a6('0x0'));var BPromise=require(_0x91a6('0x1'));var logger=require(_0x91a6('0x2'))(_0x91a6('0x3'));var _=require(_0x91a6('0x4'));var cmHopper=require(_0x91a6('0x5'));var cmHopperFinal=require(_0x91a6('0x6'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x91a6('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x91a6('0x8'));function loggerCatch(_0x2071fb){return function(_0x1ef62d){logger['error'](_0x2071fb,util['inspect'](_0x1ef62d,{'showHidden':![],'depth':null}));};}function create(_0x52b65f){return BPromise['resolve']()[_0x91a6('0x9')](cmHopperHistory[_0x91a6('0xa')](_0x52b65f))[_0x91a6('0xb')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x1840e9){return BPromise[_0x91a6('0xc')]()[_0x91a6('0x9')](agentReportPreview[_0x91a6('0xa')](_0x1840e9))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x2a3acd){return BPromise[_0x91a6('0xc')]()[_0x91a6('0x9')](cmHopper['moveContactManagedDialer'](_0x2a3acd,!![]))['catch'](loggerCatch(_0x91a6('0xd')));}exports[_0x91a6('0xe')]=function(_0xa458bc){return BPromise[_0x91a6('0xc')]()['then'](cmHopperBlack[_0x91a6('0xe')](_0xa458bc))[_0x91a6('0xb')](loggerCatch(_0x91a6('0xf')));};exports['getContactPreview']=function(_0x17d61c){return BPromise[_0x91a6('0xc')]()[_0x91a6('0x9')](cmHopper[_0x91a6('0x10')](_0x17d61c))['catch'](loggerCatch(_0x91a6('0x11')));};exports[_0x91a6('0xa')]=function(_0x3acbcf,_0x3fc791){create(_0x3acbcf)[_0x91a6('0xb')](loggerCatch(_0x3fc791));moveContact(_0x3acbcf)[_0x91a6('0xb')](loggerCatch(_0x3fc791));};exports[_0x91a6('0x12')]=function(_0x485680,_0x574ce6){createAgent(_0x485680)[_0x91a6('0xb')](loggerCatch(_0x574ce6));};exports[_0x91a6('0x13')]=function(_0x2c3252,_0x375d90){create(_0x2c3252)[_0x91a6('0xb')](loggerCatch(_0x375d90));};exports[_0x91a6('0x14')]=function(_0x165596,_0x26fa5a){moveContact(_0x165596)[_0x91a6('0xb')](loggerCatch(_0x26fa5a));};exports[_0x91a6('0x15')]=function(_0x2f8305,_0x58d121,_0x48eb91){if(_0x58d121){_0x2f8305[_0x91a6('0x16')]=null;}if(_0x48eb91){_0x2f8305[_0x91a6('0x17')]=![];}return BPromise[_0x91a6('0xc')]()['then'](cmHopper[_0x91a6('0x15')](_0x2f8305))['catch'](loggerCatch(_0x91a6('0x18')));};exports[_0x91a6('0x19')]=function(_0x511abc){return BPromise['resolve']()[_0x91a6('0x9')](cmHopper[_0x91a6('0x19')](_0x511abc))[_0x91a6('0xb')](loggerCatch(_0x91a6('0x1a')));};exports['unlockContact']=function(_0x4ed36f){return BPromise[_0x91a6('0xc')]()[_0x91a6('0x9')](cmHopper[_0x91a6('0x1b')]({'UserId':null},_0x4ed36f,0x1))['catch'](loggerCatch(_0x91a6('0x1c')));};exports[_0x91a6('0x1d')]=function(_0x4910b2){return BPromise[_0x91a6('0xc')]()['then'](cmHopper[_0x91a6('0x1b')]({'active':![]},_0x4910b2,0x1))['catch'](loggerCatch(_0x91a6('0x1e')));};exports[_0x91a6('0x1f')]=function(_0x13bd4f){var _0x15abc5={};_0x15abc5['type']=_0x13bd4f[_0x91a6('0x20')];_0x15abc5[_0x91a6('0x21')]=_0x13bd4f[_0x91a6('0x21')];_0x15abc5[_0x91a6('0x22')]=_0x13bd4f[_0x91a6('0x22')];_0x15abc5[_0x91a6('0x23')]=_0x13bd4f[_0x91a6('0x23')];_0x15abc5['queue']=_0x13bd4f['queue'];_0x15abc5[_0x91a6('0x24')]=_0x13bd4f[_0x91a6('0x25')];_0x15abc5[_0x91a6('0x26')]=_0x13bd4f[_0x91a6('0x25')];_0x15abc5['queuecallercomplete']=0x1;_0x15abc5[_0x91a6('0x27')]=_0x13bd4f[_0x91a6('0x28')];_0x15abc5[_0x91a6('0x29')]=_0x13bd4f[_0x91a6('0x2a')];_0x15abc5['context']=_0x91a6('0x2b');_0x15abc5[_0x91a6('0x2c')]=_0x91a6('0x2d');_0x15abc5[_0x91a6('0x2e')]=0x0;_0x15abc5[_0x91a6('0x2f')]=0x1;_0x15abc5[_0x91a6('0x30')]=_0x13bd4f[_0x91a6('0x2a')];_0x15abc5['queuecallerexitreason']='COMPLETED';return BPromise[_0x91a6('0xc')]()[_0x91a6('0x9')](voiceQueueReport[_0x91a6('0x31')](_0x15abc5))['catch'](loggerCatch(_0x91a6('0x32')));};exports['getContactRecallMe']=function(_0x3e1c23,_0x3d391c){return BPromise[_0x91a6('0xc')]()[_0x91a6('0x9')](cmHopper[_0x91a6('0x33')](_0x3e1c23,_0x3d391c))[_0x91a6('0xb')](loggerCatch(_0x91a6('0x34')));};exports[_0x91a6('0x35')]=function(_0x4fcf91){return BPromise[_0x91a6('0xc')]()['then'](cmHopper['rescheduleContact'](_0x4fcf91,!![],!![]))[_0x91a6('0xb')](loggerCatch(_0x91a6('0x36')));}; \ 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 26a4f3d..5b18202 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 _0x40c5=['toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','logCustomer','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','channelAgent','from-sip','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','diff','seconds','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','callback','callbackuniqueid','callbackat','UserId','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','keys','variables','forEach','toLowerCase','buildNoAnswerEventPayload','moment','preview','milliseconds','loggerCatch','inspect','info','loggerError','error','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','updatedAt','%s%s','XMD-','toUpper','toLowerVariables'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x40c5,0xee));var _0x540c=function(_0x51d810,_0x30b6c3){_0x51d810=_0x51d810-0x0;var _0x2ad77b=_0x40c5[_0x51d810];return _0x2ad77b;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x540c('0x0'));var logger=require('../../../../config/logger')(_0x540c('0x1'));var ipAgi=process['env']['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0xd50e72,_0x5297a8){var _0x8eb460=moment(_0xd50e72)[_0x540c('0x2')](0x0);var _0x3d5f17=moment(_0x5297a8)[_0x540c('0x2')](0x0);return _0x8eb460['diff'](_0x3d5f17,'seconds');}exports[_0x540c('0x3')]=function(_0x3e19eb){return function(_0x12e4cc){logger['error'](_0x3e19eb,util[_0x540c('0x4')](_0x12e4cc,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x21e202,_0x17eeae){logger[_0x540c('0x5')](_0x21e202,util[_0x540c('0x4')](_0x17eeae,{'showHidden':![],'depth':null}));};exports[_0x540c('0x6')]=function(_0x715236,_0x216778){logger[_0x540c('0x7')](_0x715236,util['inspect'](_0x216778,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x4fd9b9){return function(_0x521ff2){logger['info'](_0x4fd9b9,util[_0x540c('0x4')](_0x521ff2,{'showHidden':![],'depth':null}));};};exports[_0x540c('0x8')]=function(_0x412d67,_0x2dc0a4,_0x3ccd3f){return{'message':_0x412d67,'unlock':_0x2dc0a4,'active':_0x3ccd3f};};exports[_0x540c('0x9')]=function(_0x2247e8,_0x5894f2,_0x282989){if(!_[_0x540c('0xa')](_0x282989)&&_0x540c('0xb')===typeof _0x282989&&!_[_0x540c('0xc')](_0x282989)){if(!_['isUndefined'](_0x5894f2)&&_0x540c('0xb')===typeof _0x5894f2&&!_[_0x540c('0xc')](_0x5894f2)){return util[_0x540c('0xd')]('\x22%s\x22\x20<%s>',_0x5894f2,_0x282989);}return util['format'](_0x540c('0xe'),_0x282989,_0x282989);}if(!_[_0x540c('0xa')](_0x2247e8)&&_0x540c('0xb')===typeof _0x2247e8&&!_[_0x540c('0xc')](_0x2247e8)){return _0x2247e8;}return _0x540c('0xf');};exports[_0x540c('0x10')]=function(_0x3ca756){if(_[_0x540c('0x11')](_0x3ca756)){return![];}return _0x3ca756;};exports[_0x540c('0x12')]=function(_0x27e005,_0x23e059,_0x2fab51,_0x3dc95a,_0x5d8536,_0x1e31a8){var _0x513478={'XMD-QUEUE':_0x23e059['Queue']?_0x23e059[_0x540c('0x13')][_0x540c('0x14')]:'','XMD-CALLERID':_0x3dc95a,'XMD-CALLERID-PREVIEW':_0x1e31a8?util['format'](_0x540c('0xe'),_0x1e31a8[_0x540c('0x15')],_0x1e31a8[_0x540c('0x16')]):_0x3dc95a,'XMD-DIALID':_0x5d8536,'XMD-CONTACTID':_0x23e059[_0x540c('0x17')],'XMD-CDRTYPE':_0x540c('0x18'),'CALLERID(all)':_0x3dc95a,'XMD-VOICEQUEUEID':_0x23e059[_0x540c('0x19')],'XMD-DIALCHANNEL':_0x2fab51,'XMD-DIALTIMEOUT':_0x27e005[_0x540c('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0x540c('0xd')](_0x540c('0x1b'),_0x27e005['dialQueueProject2']?'g':'',_['isEmpty'](_0x27e005[_0x540c('0x1c')])?'':_0x540c('0x1d')),'XMD-DIALURL':_0x27e005['dialPreviewUrl']||'','XMD-AGI':_0x27e005[_0x540c('0x1e')]?util[_0x540c('0xd')](_0x540c('0x1f'),ipAgi,_0x27e005[_0x540c('0x1e')]):'NONE','XMD-AGIAFTER':_0x27e005['dialQueueProject2']?util[_0x540c('0xd')]('\x22agi://%s/square,%s\x22',ipAgi,_0x27e005[_0x540c('0x20')]):_0x540c('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x1e31a8?_0x1e31a8[_0x540c('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x1e31a8?_0x1e31a8['originatecalleridname']:'','XMD-DESTINATION':_0x540c('0x23'),'SIPADDHEADER':_0x540c('0x24')};if(!_[_0x540c('0xc')](_0x27e005[_0x540c('0x1c')])){_0x513478[util['format']('%s',_0x540c('0x25'))]=_0x27e005[_0x540c('0x1c')];_0x513478[util[_0x540c('0xd')]('%s',_0x540c('0x26'))]=_0x5d8536;}if(_0x23e059&&_0x23e059[_0x540c('0x27')]){for(var _0x1cf076 in _0x23e059[_0x540c('0x27')]){if(_0x23e059[_0x540c('0x27')][_0x540c('0x28')](_0x1cf076)){if(!_[_0x540c('0x11')](_0x23e059['Contact'][_0x1cf076])&&_0x1cf076!=='id'&&_0x1cf076!=='tags'&&_0x1cf076!=='createdAt'&&_0x1cf076!==_0x540c('0x29')){_0x513478[util[_0x540c('0xd')](_0x540c('0x2a'),_0x540c('0x2b'),_[_0x540c('0x2c')](_0x1cf076))]=_0x23e059[_0x540c('0x27')][_0x1cf076];}}}}return _0x513478;};exports[_0x540c('0x2d')]=function(_0x5b2977){var _0x2a9337={};for(var _0x249084 in _0x5b2977){if(_0x5b2977[_0x540c('0x28')](_0x249084)){_0x2a9337[util[_0x540c('0xd')]('%s',_[_0x540c('0x2e')](_0x249084))]=_0x5b2977[_0x249084];}}return{'variables':_0x2a9337};};exports['updateOriginated']=function(_0x1a8aaf,_0x391b1e){if(!_[_0x540c('0x11')](_0x1a8aaf)){if(_0x1a8aaf[_0x540c('0x28')](_0x540c('0x2f'))){if(_0x1a8aaf['originated']>0x0){_0x1a8aaf[_0x540c('0x2f')]-=0x1;}else{logger[_0x540c('0x7')](_0x540c('0x30'),_0x391b1e);}}}else{logger[_0x540c('0x7')](_0x540c('0x31'),_0x391b1e);}};exports[_0x540c('0x32')]=function(_0x13911f){var _0x40dced=moment()[_0x540c('0xd')](_0x540c('0x33'));_0x13911f[_0x540c('0x34')]=0xd;_0x13911f[_0x540c('0x35')]=_0x540c('0x36');_0x13911f['starttime']=_0x40dced;_0x13911f[_0x540c('0x37')]=_0x40dced;_0x13911f[_0x540c('0x38')]=_0x40dced;};exports[_0x540c('0x39')]=function(_0x4d569e,_0x32f860,_0xef7492){var _0x3d2a37=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4d569e[_0x540c('0x34')]=_0x32f860;_0x4d569e[_0x540c('0x35')]=_0xef7492;_0x4d569e[_0x540c('0x37')]=_0x3d2a37;_0x4d569e[_0x540c('0x3a')]=getSeconds(_0x4d569e['responsetime'],_0x4d569e['starttime']);};exports[_0x540c('0x3b')]=function(_0x2b9dd4,_0x1b24b5,_0x3d8c88){_0x2b9dd4[_0x540c('0x3c')]=_0x1b24b5;_0x2b9dd4['UserId']=_0x3d8c88;};exports[_0x540c('0x3d')]=function(_0x262d02,_0x4c0d3f,_0x2d147f){var _0x3d06d2=moment()[_0x540c('0xd')](_0x540c('0x33'));_0x262d02[_0x540c('0x34')]=_0x4c0d3f;_0x262d02[_0x540c('0x35')]=_0x2d147f;_0x262d02[_0x540c('0x37')]=_0x262d02[_0x540c('0x37')]?_0x262d02['responsetime']:_0x3d06d2;_0x262d02['endtime']=_0x262d02['endtime']?_0x262d02[_0x540c('0x38')]:_0x3d06d2;_0x262d02[_0x540c('0x3a')]=getSeconds(_0x262d02[_0x540c('0x37')]||0x0,_0x262d02['starttime']||0x0);_0x262d02[_0x540c('0x3e')]=_0x262d02[_0x540c('0x3f')]?getSeconds(_0x262d02[_0x540c('0x38')],_0x262d02[_0x540c('0x3f')]):0x0;};exports['isFailure']=function(_0x71575){return _0x71575===_0x540c('0x40');};exports[_0x540c('0x41')]=function(_0x1be359,_0x3cefcd,_0x2c5ecd,_0x419685,_0x14510a){var _0xd27c3f=_0x419685?_0x540c('0x42'):_0x1be359['calleridname'];_0xd27c3f=_0x14510a?_0x540c('0x43'):_0xd27c3f;return{'actionid':_0x1be359[_0x540c('0x44')],'action':'originate','channel':_0x1be359[_0x540c('0x45')],'callerid':util[_0x540c('0xd')]('\x22%s\x22\x20<%s>',_0xd27c3f,_0x1be359[_0x540c('0x16')]),'Exten':_0x540c('0x23'),'Context':_0x540c('0x46'),'Priority':'1','variable':_0x2c5ecd,'timeout':(_0x3cefcd['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1be359['uniqueid']};};exports['totalGlobal']=function(_0x5851fa){return _0x5851fa[_0x540c('0x47')]+_0x5851fa[_0x540c('0x48')]+_0x5851fa[_0x540c('0x49')]+_0x5851fa[_0x540c('0x4a')]+_0x5851fa['countnosuchnumberretry'];};exports[_0x540c('0x4b')]=function(_0x19f8c5){var _0x220c46=_[_0x540c('0x4c')](_0x19f8c5);_0x220c46[_0x540c('0x34')]=0xf;_0x220c46['statedesc']=_0x540c('0x4d');return _0x220c46;};exports[_0x540c('0x4e')]=function(_0x267dd1,_0x1b43ff,_0x482cc2){var _0x1d9686={};_0x1d9686[_0x1b43ff]=_0x267dd1[_0x1b43ff];_0x1d9686[_0x540c('0x4f')]=![];_0x1d9686[_0x540c('0x50')]=moment()[_0x540c('0x51')](_0x482cc2,_0x540c('0x52'))[_0x540c('0xd')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d9686[_0x540c('0x17')]=_0x267dd1[_0x540c('0x17')];_0x1d9686['ListId']=_0x267dd1[_0x540c('0x53')];_0x1d9686['VoiceQueueId']=_0x267dd1[_0x540c('0x19')]||undefined;return _0x1d9686;};exports[_0x540c('0x54')]=function(_0x5b4a18,_0x1edbdb){if(!_[_0x540c('0x11')](_0x5b4a18)){if(_0x5b4a18['pTalking']>0x0){_0x5b4a18[_0x540c('0x55')]-=0x1;}else{logger['error'](_0x1edbdb,_0x540c('0x56'));}}else{logger[_0x540c('0x7')](_0x1edbdb,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x540c('0x57')]=function(_0x53d306){if(_0x53d306<=0x0){return!![];}return![];};function buildObj(_0x180f7f,_0x3a17f4,_0x9e6ec8){_0x180f7f[_0x540c('0x58')]=_0x3a17f4;_0x180f7f[_0x540c('0x14')]=_0x180f7f[_0x540c('0x59')];_0x180f7f[_0x540c('0x5a')]=_0x180f7f['channelAgent'];_0x180f7f[_0x540c('0x5b')]=_0x540c('0x5c');if(_0x9e6ec8){_0x180f7f[_0x540c('0x5d')]=_0x9e6ec8[_0x540c('0x5d')];}return _0x180f7f;}exports[_0x540c('0x5e')]=buildObj;exports['buildAcw']=function(_0xc5c813){var _0x105542={};_0x105542[_0x540c('0x59')]=_0xc5c813[_0x540c('0x59')];_0x105542[_0x540c('0x5a')]=_0xc5c813[_0x540c('0x45')];_0x105542[_0x540c('0x44')]=_0xc5c813[_0x540c('0x44')];return _0x105542;};exports[_0x540c('0x5f')]=function(_0x48dd78){var _0x43570f=[];for(var _0x5405c7 in _0x48dd78){if(_0x48dd78[_0x540c('0x28')](_0x5405c7)){if(!_[_0x540c('0x11')](_0x48dd78[_0x5405c7])&&_0x48dd78[_0x5405c7][_0x540c('0x34')]===_0x540c('0x60')&&_0x48dd78[_0x5405c7][_0x540c('0x61')]===_0x540c('0x62')){_0x43570f[_0x540c('0x63')](_0x48dd78[_0x5405c7]['id']);}}}return _0x43570f;};exports['getDiff']=function(_0xee82bd){var _0x8c5085=moment()[_0x540c('0x2')](0x0);var _0x180dd3=moment(_0xee82bd)[_0x540c('0x2')](0x0);return _0x8c5085[_0x540c('0x64')](_0x180dd3,_0x540c('0x65'));};exports[_0x540c('0x66')]=function(_0x44a369){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x44a369[_0x540c('0x17')],'ListId':_0x44a369['ListId'],'VoiceQueueId':_0x44a369[_0x540c('0x19')]||undefined,'CampaignId':_0x44a369[_0x540c('0x67')]||undefined};};exports[_0x540c('0x68')]=function(_0x39c235){if(_0x39c235==='uniqueid'||_0x39c235===_0x540c('0x69')||_0x39c235===_0x540c('0x59')||_0x39c235==='type'||_0x39c235===_0x540c('0x6a')||_0x39c235===_0x540c('0x6b')||_0x39c235==='membername'||_0x39c235===_0x540c('0x45')||_0x39c235==='calleridname'||_0x39c235===_0x540c('0x4f')||_0x39c235==='calleridnum'||_0x39c235===_0x540c('0x50')||_0x39c235===_0x540c('0x47')||_0x39c235===_0x540c('0x48')||_0x39c235===_0x540c('0x49')||_0x39c235==='countglobal'||_0x39c235===_0x540c('0x6c')||_0x39c235===_0x540c('0x6d')||_0x39c235===_0x540c('0x6e')||_0x39c235==='recallme'||_0x39c235==='ContactId'||_0x39c235==='ListId'||_0x39c235===_0x540c('0x6f')||_0x39c235===_0x540c('0x19')||_0x39c235==='sipcallid'||_0x39c235==='xmd-voicequeueid'||_0x39c235==='xmd-queue'||_0x39c235===_0x540c('0x70')||_0x39c235===_0x540c('0x71')||_0x39c235==='xmd-dialurl'||_0x39c235==='xmd-dialtimeout'||_0x39c235===_0x540c('0x72')||_0x39c235===_0x540c('0x73')||_0x39c235===_0x540c('0x74')||_0x39c235==='xmd-contactid'||_0x39c235===_0x540c('0x75')||_0x39c235==='xmd-callerid'||_0x39c235==='xmd-agiafter'||_0x39c235===_0x540c('0x76')||_0x39c235===_0x540c('0x77')||_0x39c235==='rtpaudioqosbridged'||_0x39c235===_0x540c('0x78')||_0x39c235===_0x540c('0x79')||_0x39c235===_0x540c('0x7a')||_0x39c235===_0x540c('0x7b')||_0x39c235===_0x540c('0x7c')||_0x39c235===_0x540c('0x7d')||_0x39c235===_0x540c('0x77')||_0x39c235===_0x540c('0x7e')||_0x39c235==='rtpaudioqosjitter'||_0x39c235==='rtpaudioqosjitterbridged'||_0x39c235==='rtpaudioqosloss'||_0x39c235===_0x540c('0x7b')||_0x39c235===_0x540c('0x7c')||_0x39c235===_0x540c('0x7d')||_0x39c235===_0x540c('0x7f')||_0x39c235===_0x540c('0x80')||_0x39c235==='state'||_0x39c235===_0x540c('0x35')){return![];}return!![];};exports[_0x540c('0x81')]=function(_0x285fde,_0x4bf624){var _0x486874,_0x33fc8a,_0x2cf698;if(_0x4bf624<=0x0){_0x4bf624=0x1;}_0x486874=new RegExp('\x5cw{0,'+_0x4bf624+'}$');_0x33fc8a=Math['pow'](0xa,_0x4bf624-0x1);_0x2cf698=Math[_0x540c('0x82')](0xa,_0x4bf624)-0x1;return util[_0x540c('0xd')]('%s',_[_0x540c('0x83')](_0x285fde,_0x486874,_[_0x540c('0x84')](_0x33fc8a,_0x2cf698)));};exports[_0x540c('0x85')]=function(_0x223201){var _0x4593f1=_0x223201[_0x540c('0x86')](/"(.*?)"/);return _0x4593f1?_0x4593f1[0x1]:_0x223201;};exports[_0x540c('0x87')]=function(_0x57aacb){var _0x1b14d0=_0x57aacb[_0x540c('0x86')](/<(.*?)>/);return _0x1b14d0?_0x1b14d0[0x1]:_0x57aacb;};function buildNoAnswerEventPayload(_0x4e403c,_0x58d9a9){var _0x4fb0d2=buildObj(_0x4e403c,_0x540c('0x88'));if(!_[_0x540c('0xc')](_0x58d9a9['variables'])){Object[_0x540c('0x89')](_0x58d9a9[_0x540c('0x8a')])[_0x540c('0x8b')](function(_0x2b266c){_0x4fb0d2[_0x2b266c[_0x540c('0x8c')]()]=_0x58d9a9[_0x540c('0x8a')][_0x2b266c];});}return _0x4fb0d2;}exports[_0x540c('0x8d')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x1a6c=['rtpaudioqosloss','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','inspect','loggerError','error','logger2','info','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','timeout','countbusyretry','countagentrejectretry','countnosuchnumberretry','clone','Global','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','not_inuse','push','getDiff','createBody','CampaignId','filterKey','idContact','membername','countcongestionretry','countnoanswerretry','callback','recallme','sipcallid','xmd-voicequeueid','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitter'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x1a6c,0x126));var _0xc1a6=function(_0xb57c81,_0x3905b1){_0xb57c81=_0xb57c81-0x0;var _0x479337=_0x1a6c[_0xb57c81];return _0x479337;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xc1a6('0x0'));var logger=require(_0xc1a6('0x1'))(_0xc1a6('0x2'));var ipAgi=process[_0xc1a6('0x3')][_0xc1a6('0x4')]||_0xc1a6('0x5');function getSeconds(_0x1fd8b6,_0x5f17ee){var _0x162a76=moment(_0x1fd8b6)[_0xc1a6('0x6')](0x0);var _0x41cdd5=moment(_0x5f17ee)[_0xc1a6('0x6')](0x0);return _0x162a76[_0xc1a6('0x7')](_0x41cdd5,_0xc1a6('0x8'));}exports['loggerCatch']=function(_0x22675d){return function(_0x1bd0a4){logger['error'](_0x22675d,util[_0xc1a6('0x9')](_0x1bd0a4,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x25acdb,_0x3a518d){logger['info'](_0x25acdb,util[_0xc1a6('0x9')](_0x3a518d,{'showHidden':![],'depth':null}));};exports[_0xc1a6('0xa')]=function(_0x2a601a,_0xaf3db0){logger[_0xc1a6('0xb')](_0x2a601a,util[_0xc1a6('0x9')](_0xaf3db0,{'showHidden':![],'depth':null}));};exports[_0xc1a6('0xc')]=function(_0x182bce){return function(_0x289bac){logger[_0xc1a6('0xd')](_0x182bce,util['inspect'](_0x289bac,{'showHidden':![],'depth':null}));};};exports[_0xc1a6('0xe')]=function(_0x18ebda,_0x57401c,_0x26ef9f){return{'message':_0x18ebda,'unlock':_0x57401c,'active':_0x26ef9f};};exports[_0xc1a6('0xf')]=function(_0x50c83c,_0x5def4,_0x1f965b){if(!_[_0xc1a6('0x10')](_0x1f965b)&&_0xc1a6('0x11')===typeof _0x1f965b&&!_[_0xc1a6('0x12')](_0x1f965b)){if(!_[_0xc1a6('0x10')](_0x5def4)&&_0xc1a6('0x11')===typeof _0x5def4&&!_[_0xc1a6('0x12')](_0x5def4)){return util[_0xc1a6('0x13')](_0xc1a6('0x14'),_0x5def4,_0x1f965b);}return util[_0xc1a6('0x13')](_0xc1a6('0x14'),_0x1f965b,_0x1f965b);}if(!_[_0xc1a6('0x10')](_0x50c83c)&&'string'===typeof _0x50c83c&&!_['isEmpty'](_0x50c83c)){return _0x50c83c;}return _0xc1a6('0x15');};exports[_0xc1a6('0x16')]=function(_0x57395b){if(_[_0xc1a6('0x17')](_0x57395b)){return![];}return _0x57395b;};exports[_0xc1a6('0x18')]=function(_0x2680e3,_0x1e7700,_0x4445a0,_0xbf4aaa,_0xaa91b,_0x218460){var _0x37a43f={'XMD-QUEUE':_0x1e7700['Queue']?_0x1e7700['Queue'][_0xc1a6('0x19')]:'','XMD-CALLERID':_0xbf4aaa,'XMD-CALLERID-PREVIEW':_0x218460?util['format'](_0xc1a6('0x14'),_0x218460[_0xc1a6('0x1a')],_0x218460[_0xc1a6('0x1b')]):_0xbf4aaa,'XMD-DIALID':_0xaa91b,'XMD-CONTACTID':_0x1e7700[_0xc1a6('0x1c')],'XMD-CDRTYPE':_0xc1a6('0x1d'),'CALLERID(all)':_0xbf4aaa,'XMD-VOICEQUEUEID':_0x1e7700[_0xc1a6('0x1e')],'XMD-DIALCHANNEL':_0x4445a0,'XMD-DIALTIMEOUT':_0x2680e3[_0xc1a6('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0xc1a6('0x13')](_0xc1a6('0x20'),_0x2680e3['dialQueueProject2']?'g':'',_[_0xc1a6('0x12')](_0x2680e3[_0xc1a6('0x21')])?'':_0xc1a6('0x22')),'XMD-DIALURL':_0x2680e3['dialPreviewUrl']||'','XMD-AGI':_0x2680e3[_0xc1a6('0x23')]?util[_0xc1a6('0x13')](_0xc1a6('0x24'),ipAgi,_0x2680e3[_0xc1a6('0x23')]):_0xc1a6('0x25'),'XMD-AGIAFTER':_0x2680e3['dialQueueProject2']?util[_0xc1a6('0x13')](_0xc1a6('0x24'),ipAgi,_0x2680e3[_0xc1a6('0x26')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x218460?_0x218460[_0xc1a6('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x218460?_0x218460[_0xc1a6('0x28')]:'','XMD-DESTINATION':_0xc1a6('0x29'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xc1a6('0x12')](_0x2680e3[_0xc1a6('0x21')])){_0x37a43f[util[_0xc1a6('0x13')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x2680e3['monitor_format'];_0x37a43f[util['format']('%s',_0xc1a6('0x2a'))]=_0xaa91b;}if(_0x1e7700&&_0x1e7700['Contact']){for(var _0x5795b4 in _0x1e7700['Contact']){if(_0x1e7700[_0xc1a6('0x2b')][_0xc1a6('0x2c')](_0x5795b4)){if(!_['isNil'](_0x1e7700[_0xc1a6('0x2b')][_0x5795b4])&&_0x5795b4!=='id'&&_0x5795b4!=='tags'&&_0x5795b4!==_0xc1a6('0x2d')&&_0x5795b4!==_0xc1a6('0x2e')){_0x37a43f[util[_0xc1a6('0x13')](_0xc1a6('0x2f'),_0xc1a6('0x30'),_['toUpper'](_0x5795b4))]=_0x1e7700[_0xc1a6('0x2b')][_0x5795b4];}}}}return _0x37a43f;};exports[_0xc1a6('0x31')]=function(_0x478224){var _0x16d443={};for(var _0xab9928 in _0x478224){if(_0x478224[_0xc1a6('0x2c')](_0xab9928)){_0x16d443[util[_0xc1a6('0x13')]('%s',_[_0xc1a6('0x32')](_0xab9928))]=_0x478224[_0xab9928];}}return{'variables':_0x16d443};};exports[_0xc1a6('0x33')]=function(_0x34c5a6,_0x5aaa7a){if(!_[_0xc1a6('0x17')](_0x34c5a6)){if(_0x34c5a6['hasOwnProperty'](_0xc1a6('0x34'))){if(_0x34c5a6[_0xc1a6('0x34')]>0x0){_0x34c5a6['originated']-=0x1;}else{logger[_0xc1a6('0xb')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x5aaa7a);}}}else{logger[_0xc1a6('0xb')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x5aaa7a);}};exports[_0xc1a6('0x35')]=function(_0x593269){var _0x145dfe=moment()['format'](_0xc1a6('0x36'));_0x593269[_0xc1a6('0x37')]=0xd;_0x593269[_0xc1a6('0x38')]='Blacklist';_0x593269[_0xc1a6('0x39')]=_0x145dfe;_0x593269[_0xc1a6('0x3a')]=_0x145dfe;_0x593269[_0xc1a6('0x3b')]=_0x145dfe;};exports[_0xc1a6('0x3c')]=function(_0x11fc4a,_0x456fbf,_0x110f8c){var _0x578d43=moment()[_0xc1a6('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x11fc4a[_0xc1a6('0x37')]=_0x456fbf;_0x11fc4a[_0xc1a6('0x38')]=_0x110f8c;_0x11fc4a[_0xc1a6('0x3a')]=_0x578d43;_0x11fc4a[_0xc1a6('0x3d')]=getSeconds(_0x11fc4a[_0xc1a6('0x3a')],_0x11fc4a[_0xc1a6('0x39')]);};exports[_0xc1a6('0x3e')]=function(_0x4428dd,_0x58deb9,_0x38630a){_0x4428dd['membername']=_0x58deb9;_0x4428dd[_0xc1a6('0x3f')]=_0x38630a;};exports[_0xc1a6('0x40')]=function(_0x53fdca,_0x29b80d,_0x2ac131){var _0x76da4a=moment()['format'](_0xc1a6('0x36'));_0x53fdca[_0xc1a6('0x37')]=_0x29b80d;_0x53fdca['statedesc']=_0x2ac131;_0x53fdca[_0xc1a6('0x3a')]=_0x53fdca['responsetime']?_0x53fdca[_0xc1a6('0x3a')]:_0x76da4a;_0x53fdca[_0xc1a6('0x3b')]=_0x53fdca['endtime']?_0x53fdca['endtime']:_0x76da4a;_0x53fdca[_0xc1a6('0x3d')]=getSeconds(_0x53fdca['responsetime']||0x0,_0x53fdca[_0xc1a6('0x39')]||0x0);_0x53fdca[_0xc1a6('0x41')]=_0x53fdca['answertime']?getSeconds(_0x53fdca[_0xc1a6('0x3b')],_0x53fdca[_0xc1a6('0x42')]):0x0;};exports[_0xc1a6('0x43')]=function(_0x7acbbf){return _0x7acbbf===_0xc1a6('0x44');};exports[_0xc1a6('0x45')]=function(_0x273ec8,_0x401bc7,_0x7cc196,_0x9fe855,_0x539ef4){var _0x2a7463=_0x9fe855?_0xc1a6('0x46'):_0x273ec8['calleridname'];_0x2a7463=_0x539ef4?_0xc1a6('0x47'):_0x2a7463;return{'actionid':_0x273ec8[_0xc1a6('0x48')],'action':_0xc1a6('0x49'),'channel':_0x273ec8[_0xc1a6('0x4a')],'callerid':util[_0xc1a6('0x13')]('\x22%s\x22\x20<%s>',_0x2a7463,_0x273ec8[_0xc1a6('0x1b')]),'Exten':_0xc1a6('0x29'),'Context':'from-sip','Priority':'1','variable':_0x7cc196,'timeout':(_0x401bc7[_0xc1a6('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x273ec8[_0xc1a6('0x48')]};};exports['totalGlobal']=function(_0x311a2e){return _0x311a2e[_0xc1a6('0x4c')]+_0x311a2e['countcongestionretry']+_0x311a2e['countnoanswerretry']+_0x311a2e[_0xc1a6('0x4d')]+_0x311a2e[_0xc1a6('0x4e')];};exports['cloneAction']=function(_0x278245){var _0x2b262a=_[_0xc1a6('0x4f')](_0x278245);_0x2b262a[_0xc1a6('0x37')]=0xf;_0x2b262a[_0xc1a6('0x38')]=_0xc1a6('0x50');return _0x2b262a;};exports['scheduledAt']=function(_0x4a1fff,_0x12ac8c,_0x5df443){var _0x323041={};_0x323041[_0x12ac8c]=_0x4a1fff[_0x12ac8c];_0x323041[_0xc1a6('0x51')]=![];_0x323041[_0xc1a6('0x52')]=moment()['add'](_0x5df443,_0xc1a6('0x53'))['format'](_0xc1a6('0x36'));_0x323041[_0xc1a6('0x1c')]=_0x4a1fff['ContactId'];_0x323041['ListId']=_0x4a1fff[_0xc1a6('0x54')];_0x323041[_0xc1a6('0x1e')]=_0x4a1fff[_0xc1a6('0x1e')]||undefined;return _0x323041;};exports[_0xc1a6('0x55')]=function(_0x2f6bcb,_0x57513c){if(!_[_0xc1a6('0x17')](_0x2f6bcb)){if(_0x2f6bcb[_0xc1a6('0x56')]>0x0){_0x2f6bcb[_0xc1a6('0x56')]-=0x1;}else{logger[_0xc1a6('0xb')](_0x57513c,_0xc1a6('0x57'));}}else{logger[_0xc1a6('0xb')](_0x57513c,_0xc1a6('0x58'));}};exports[_0xc1a6('0x59')]=function(_0x1fb8e3){if(_0x1fb8e3<=0x0){return!![];}return![];};function buildObj(_0x5444aa,_0x39bf34,_0x2f9324){_0x5444aa[_0xc1a6('0x5a')]=_0x39bf34;_0x5444aa[_0xc1a6('0x19')]=_0x5444aa[_0xc1a6('0x5b')];_0x5444aa[_0xc1a6('0x5c')]=_0x5444aa[_0xc1a6('0x4a')];_0x5444aa[_0xc1a6('0x5d')]=_0xc1a6('0x5e');if(_0x2f9324){_0x5444aa[_0xc1a6('0x5f')]=_0x2f9324[_0xc1a6('0x5f')];}return _0x5444aa;}exports['buildObj']=buildObj;exports['buildAcw']=function(_0x3a490d){var _0x16f377={};_0x16f377[_0xc1a6('0x5b')]=_0x3a490d[_0xc1a6('0x5b')];_0x16f377[_0xc1a6('0x5c')]=_0x3a490d[_0xc1a6('0x4a')];_0x16f377[_0xc1a6('0x48')]=_0x3a490d['uniqueid'];return _0x16f377;};exports['agentReadyId']=function(_0x3154be){var _0x58f7d1=[];for(var _0x484e2c in _0x3154be){if(_0x3154be[_0xc1a6('0x2c')](_0x484e2c)){if(!_[_0xc1a6('0x17')](_0x3154be[_0x484e2c])&&_0x3154be[_0x484e2c][_0xc1a6('0x37')]===_0xc1a6('0x60')&&_0x3154be[_0x484e2c]['status']==='reachable'){_0x58f7d1[_0xc1a6('0x61')](_0x3154be[_0x484e2c]['id']);}}}return _0x58f7d1;};exports[_0xc1a6('0x62')]=function(_0x45e1e7){var _0x255991=moment()[_0xc1a6('0x6')](0x0);var _0x16cd59=moment(_0x45e1e7)[_0xc1a6('0x6')](0x0);return _0x255991[_0xc1a6('0x7')](_0x16cd59,'seconds');};exports[_0xc1a6('0x63')]=function(_0x3698d2){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3698d2[_0xc1a6('0x1c')],'ListId':_0x3698d2[_0xc1a6('0x54')],'VoiceQueueId':_0x3698d2[_0xc1a6('0x1e')]||undefined,'CampaignId':_0x3698d2[_0xc1a6('0x64')]||undefined};};exports[_0xc1a6('0x65')]=function(_0x687bf0){if(_0x687bf0==='uniqueid'||_0x687bf0===_0xc1a6('0x66')||_0x687bf0===_0xc1a6('0x5b')||_0x687bf0==='type'||_0x687bf0==='campaigntype'||_0x687bf0==='dialAnswer'||_0x687bf0===_0xc1a6('0x67')||_0x687bf0===_0xc1a6('0x4a')||_0x687bf0===_0xc1a6('0x1a')||_0x687bf0==='active'||_0x687bf0===_0xc1a6('0x1b')||_0x687bf0===_0xc1a6('0x52')||_0x687bf0===_0xc1a6('0x4c')||_0x687bf0===_0xc1a6('0x68')||_0x687bf0===_0xc1a6('0x69')||_0x687bf0==='countglobal'||_0x687bf0===_0xc1a6('0x6a')||_0x687bf0==='callbackuniqueid'||_0x687bf0==='callbackat'||_0x687bf0===_0xc1a6('0x6b')||_0x687bf0===_0xc1a6('0x1c')||_0x687bf0===_0xc1a6('0x54')||_0x687bf0===_0xc1a6('0x3f')||_0x687bf0===_0xc1a6('0x1e')||_0x687bf0===_0xc1a6('0x6c')||_0x687bf0===_0xc1a6('0x6d')||_0x687bf0==='xmd-queue'||_0x687bf0==='xmd-phone'||_0x687bf0===_0xc1a6('0x6e')||_0x687bf0==='xmd-dialurl'||_0x687bf0===_0xc1a6('0x6f')||_0x687bf0===_0xc1a6('0x70')||_0x687bf0===_0xc1a6('0x71')||_0x687bf0===_0xc1a6('0x72')||_0x687bf0===_0xc1a6('0x73')||_0x687bf0==='xmd-cdrtype'||_0x687bf0===_0xc1a6('0x74')||_0x687bf0===_0xc1a6('0x75')||_0x687bf0===_0xc1a6('0x76')||_0x687bf0===_0xc1a6('0x77')||_0x687bf0==='rtpaudioqosbridged'||_0x687bf0==='rtpaudioqosjitter'||_0x687bf0===_0xc1a6('0x78')||_0x687bf0==='rtpaudioqosloss'||_0x687bf0===_0xc1a6('0x79')||_0x687bf0===_0xc1a6('0x7a')||_0x687bf0===_0xc1a6('0x7b')||_0x687bf0===_0xc1a6('0x77')||_0x687bf0===_0xc1a6('0x7c')||_0x687bf0===_0xc1a6('0x7d')||_0x687bf0===_0xc1a6('0x78')||_0x687bf0===_0xc1a6('0x7e')||_0x687bf0===_0xc1a6('0x79')||_0x687bf0==='rtpaudioqosrtt'||_0x687bf0===_0xc1a6('0x7b')||_0x687bf0===_0xc1a6('0x7f')||_0x687bf0==='bridgepvtcallid'||_0x687bf0===_0xc1a6('0x37')||_0x687bf0===_0xc1a6('0x38')){return![];}return!![];};exports[_0xc1a6('0x80')]=function(_0x24765d,_0x368a3a){var _0x31e1c1,_0x55dccb,_0x3043a5;if(_0x368a3a<=0x0){_0x368a3a=0x1;}_0x31e1c1=new RegExp(_0xc1a6('0x81')+_0x368a3a+'}$');_0x55dccb=Math[_0xc1a6('0x82')](0xa,_0x368a3a-0x1);_0x3043a5=Math[_0xc1a6('0x82')](0xa,_0x368a3a)-0x1;return util[_0xc1a6('0x13')]('%s',_[_0xc1a6('0x83')](_0x24765d,_0x31e1c1,_[_0xc1a6('0x84')](_0x55dccb,_0x3043a5)));};exports['extractCalleridName']=function(_0x414b47){var _0x4b31e4=_0x414b47[_0xc1a6('0x85')](/"(.*?)"/);return _0x4b31e4?_0x4b31e4[0x1]:_0x414b47;};exports[_0xc1a6('0x86')]=function(_0x4b2824){var _0x33e687=_0x4b2824[_0xc1a6('0x85')](/<(.*?)>/);return _0x33e687?_0x33e687[0x1]:_0x4b2824;};function buildNoAnswerEventPayload(_0xf5ad01,_0x2859cb){var _0x3f3da3=buildObj(_0xf5ad01,'noanswer');if(!_[_0xc1a6('0x12')](_0x2859cb[_0xc1a6('0x87')])){Object[_0xc1a6('0x88')](_0x2859cb[_0xc1a6('0x87')])[_0xc1a6('0x89')](function(_0xa73d6){_0x3f3da3[_0xa73d6[_0xc1a6('0x8a')]()]=_0x2859cb['variables'][_0xa73d6];});}return _0x3f3da3;}exports[_0xc1a6('0x8b')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 43727ad..7dd6e01 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 _0x4dac=['string','number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x4dac,0xfb));var _0xc4da=function(_0x58bba8,_0x213d48){_0x58bba8=_0x58bba8-0x0;var _0x110a16=_0x4dac[_0x58bba8];return _0x110a16;};'use strict';exports[_0xc4da('0x0')]={'queue':{'type':_0xc4da('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xc4da('0x1'),'required':!![]},'penalty':{'type':_0xc4da('0x2'),'required':![]},'paused':{'type':_0xc4da('0x3'),'required':![]}};exports[_0xc4da('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xc4da('0x1'),'required':!![]},'paused':{'type':_0xc4da('0x3')},'reason':{'type':_0xc4da('0x1'),'required':![]}};exports[_0xc4da('0x5')]={'module':{'type':'string','required':![]}};exports[_0xc4da('0x6')]={'uniqueid':{'type':_0xc4da('0x1'),'required':!![]}};exports[_0xc4da('0x7')]={'uniqueid':{'type':_0xc4da('0x1'),'required':!![]},'filename':{'type':_0xc4da('0x1')},'format':{'type':_0xc4da('0x1')},'mixmonitorid':{'type':_0xc4da('0x1')}};exports[_0xc4da('0x8')]={'uniqueid':{'type':_0xc4da('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xc4da('0x1'),'required':!![]},'context':{'type':_0xc4da('0x1')}}; \ No newline at end of file +var _0x659e=['voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','boolean','queueremove','reload','voicequeuechannel'];(function(_0x3b5961,_0x599485){var _0x3a68b9=function(_0x3586ec){while(--_0x3586ec){_0x3b5961['push'](_0x3b5961['shift']());}};_0x3a68b9(++_0x599485);}(_0x659e,0x12c));var _0xe659=function(_0x42af7f,_0x3b8a6c){_0x42af7f=_0x42af7f-0x0;var _0x75303d=_0x659e[_0x42af7f];return _0x75303d;};'use strict';exports[_0xe659('0x0')]={'queue':{'type':_0xe659('0x1'),'required':!![]},'interface':{'type':_0xe659('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xe659('0x2'),'required':![]}};exports[_0xe659('0x3')]={'queue':{'type':_0xe659('0x1'),'required':!![]},'interface':{'type':_0xe659('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0xe659('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xe659('0x1'),'required':![]}};exports[_0xe659('0x4')]={'module':{'type':'string','required':![]}};exports[_0xe659('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xe659('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xe659('0x1')},'format':{'type':_0xe659('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xe659('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xe659('0x8')]={'uniqueid':{'type':_0xe659('0x1'),'required':!![]},'exten':{'type':_0xe659('0x1'),'required':!![]},'context':{'type':_0xe659('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 453ef41..d8fadff 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 _0xc76e=['outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','initTelephones','initTrunks','trunks','isUndefined','initVoiceQueues','initTemplates','initZendeskAccounts','initSalesforceAccounts','initZohoAccounts','initDeskAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','queue','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','sumBillable','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','faxAccounts','exports','util','lodash','moment','../model/agent','../model/telephone','../model/trigger','../model/template','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','sumHoldTime','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','sumDuration'];(function(_0x2dd9ba,_0x133df1){var _0x2b971e=function(_0x35d43e){while(--_0x35d43e){_0x2dd9ba['push'](_0x2dd9ba['shift']());}};_0x2b971e(++_0x133df1);}(_0xc76e,0x10c));var _0xec76=function(_0x5a8d04,_0x3b1223){_0x5a8d04=_0x5a8d04-0x0;var _0x1d985e=_0xc76e[_0x5a8d04];return _0x1d985e;};'use strict';var util=require(_0xec76('0x0'));var _=require(_0xec76('0x1'));var moment=require(_0xec76('0x2'));var Agent=require(_0xec76('0x3'));var Telephone=require(_0xec76('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xec76('0x5'));var Template=require(_0xec76('0x6'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xec76('0x7'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xec76('0x8'));var FreshdeskAccount=require(_0xec76('0x9'));var SugarcrmAccount=require(_0xec76('0xa'));var ZohoAccount=require(_0xec76('0xb'));var DeskAccount=require(_0xec76('0xc'));var VtigerAccount=require(_0xec76('0xd'));var ServicenowAccount=require(_0xec76('0xe'));var Dynamics365Account=require(_0xec76('0xf'));var FreshsalesAccount=require(_0xec76('0x10'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xec76('0x11')]={};this[_0xec76('0x12')]={};this['trunks']={};this[_0xec76('0x13')]={};this[_0xec76('0x14')]={};this['campaigns']={};this[_0xec76('0x15')]={};this[_0xec76('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xec76('0x17')]={};this[_0xec76('0x18')]={};this[_0xec76('0x19')]={};this[_0xec76('0x1a')]={};this[_0xec76('0x1b')]={};this[_0xec76('0x1c')]={};this[_0xec76('0x1d')]={};this[_0xec76('0x1e')]={};this[_0xec76('0x1f')]={};this[_0xec76('0x20')]={};this[_0xec76('0x21')]={};this[_0xec76('0x22')]={};this[_0xec76('0x23')]={};this[_0xec76('0x24')]={};this['dynamics365Accounts']={};this[_0xec76('0x25')]={};this['faxAccounts']={};};function freeIsNotKey(_0x2fe444,_0x36347e,_0x4452fd){var _0x91a265=_[_0xec76('0x26')](_0x2fe444,function(_0x17931d,_0x4e7fb0){return _0x17931d[_0x4452fd];});for(var _0x4a591a in _0x36347e){if(_0x36347e[_0xec76('0x27')](_0x4a591a)){if(!_0x91a265[_0x4a591a]){delete _0x36347e[_0x4a591a];}}}}function freeIsNotKeySip(_0x300ee6,_0x2e6c6b){var _0xd40f1c=_[_0xec76('0x26')](_0x300ee6,function(_0xbcd2f3,_0x35f8e1){return util[_0xec76('0x28')](_0xec76('0x29'),_0xbcd2f3[_0xec76('0x2a')]);});for(var _0x55a5f3 in _0x2e6c6b){if(_0x2e6c6b[_0xec76('0x27')](_0x55a5f3)){if(!_0xd40f1c[_0x55a5f3]){delete _0x2e6c6b[_0x55a5f3];}}}}function freeIsNotKeyAgent(_0x5ae445,_0x1ef320){var _0x246860=_[_0xec76('0x26')](_0x5ae445,function(_0x233ee4,_0x3627b5){var _0x175119=_[_0xec76('0x2b')](_0x233ee4['interface'])?util['format'](_0xec76('0x29'),_0x233ee4['name']):_0x233ee4[_0xec76('0x2c')];return _0x175119;});for(var _0x37c904 in _0x1ef320){if(_0x1ef320[_0xec76('0x27')](_0x37c904)){if(!_0x246860[_0x37c904]){delete _0x1ef320[_0x37c904];}}}}function clearVoiceCallReports(_0x2fe9ff){_0x2fe9ff[_0xec76('0x2d')]=0x0;_0x2fe9ff['answered']=0x0;_0x2fe9ff[_0xec76('0x2e')]=0x0;_0x2fe9ff['sumDuration']=0x0;_0x2fe9ff['sumBillable']=0x0;}function clearCampaigns(_0x5bf545){if(!_[_0xec76('0x2f')](_0x5bf545)){for(var _0x3f5662 in _0x5bf545){if(_0x5bf545['hasOwnProperty'](_0x3f5662)){_0x5bf545[_0x3f5662][_0xec76('0x30')]=0x0;_0x5bf545[_0x3f5662][_0xec76('0x31')]=0x0;}}}}function clearVoiceQueues(_0x6585f2){if(!_[_0xec76('0x2f')](_0x6585f2)){for(var _0x26e31a in _0x6585f2){if(_0x6585f2[_0xec76('0x27')](_0x26e31a)){_0x6585f2[_0x26e31a][_0xec76('0x2d')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x32')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x33')]=0x0;_0x6585f2[_0x26e31a]['abandoned']=0x0;_0x6585f2[_0x26e31a][_0xec76('0x2e')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x34')]=0x0;_0x6585f2[_0x26e31a]['sumBillable']=0x0;_0x6585f2[_0x26e31a][_0xec76('0x35')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x36')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x37')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x38')]=0x0;_0x6585f2[_0x26e31a]['outboundNoSuchCallsDay']=0x0;_0x6585f2[_0x26e31a]['outboundUnknownCallsDay']=0x0;_0x6585f2[_0x26e31a][_0xec76('0x39')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x3a')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x3b')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x3c')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x3d')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x3e')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x35')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x3f')]=0x0;_0x6585f2[_0x26e31a][_0xec76('0x40')]=!![];}}}}Realtime[_0xec76('0x41')][_0xec76('0x42')]=function(_0xd3beed,_0x1829d8){for(var _0x44cb5d in _0x1829d8){if(_0xd3beed[_0xec76('0x27')](_0x44cb5d)){_0xd3beed[_0x44cb5d]=_0x1829d8[_0x44cb5d];}}};Realtime[_0xec76('0x41')][_0xec76('0x43')]=function(){var _0x2e8300=this;return function(_0x5e758a){if(_0x5e758a){freeIsNotKeyAgent(_0x5e758a,_0x2e8300[_0xec76('0x11')]);for(var _0x30a212=0x0,_0x1ab72f={},_0x2f52ec={};_0x30a212<_0x5e758a[_0xec76('0x44')];_0x30a212+=0x1){_0x1ab72f=_0x5e758a[_0x30a212];var _0x280acd=_[_0xec76('0x2b')](_0x1ab72f[_0xec76('0x2c')])?util['format'](_0xec76('0x29'),_0x1ab72f[_0xec76('0x2a')]):_0x1ab72f['interface'];if(_['isUndefined'](_0x2e8300['agents'][_0x280acd])){_0x2e8300[_0xec76('0x11')][_0x280acd]=new Agent(_0x1ab72f);}else{_0x2e8300[_0xec76('0x42')](_0x2e8300[_0xec76('0x11')][_0x280acd],_0x1ab72f);}}}return _0x2e8300[_0xec76('0x11')];};};Realtime[_0xec76('0x41')][_0xec76('0x45')]=function(){var _0xc4ff43=this;return function(_0x395595){if(_0x395595){freeIsNotKeySip(_0x395595,_0xc4ff43[_0xec76('0x12')]);for(var _0x55b91a=0x0,_0x49caa2={},_0xf3525={};_0x55b91a<_0x395595['length'];_0x55b91a+=0x1){_0x49caa2=_0x395595[_0x55b91a];if(_['isUndefined'](_0xc4ff43[_0xec76('0x12')][util[_0xec76('0x28')](_0xec76('0x29'),_0x49caa2[_0xec76('0x2a')])])){_0xc4ff43[_0xec76('0x12')][util['format'](_0xec76('0x29'),_0x49caa2[_0xec76('0x2a')])]=new Telephone(_0x49caa2);}else{_0xc4ff43[_0xec76('0x42')](_0xc4ff43[_0xec76('0x12')][util[_0xec76('0x28')](_0xec76('0x29'),_0x49caa2[_0xec76('0x2a')])],_0x49caa2);}}}return _0xc4ff43[_0xec76('0x12')];};};Realtime[_0xec76('0x41')][_0xec76('0x46')]=function(){var _0xeb85f8=this;return function(_0x2a21d9){if(_0x2a21d9){freeIsNotKeySip(_0x2a21d9,_0xeb85f8[_0xec76('0x47')]);for(var _0x39828e=0x0,_0x1eb42a={},_0x5b01dc={};_0x39828e<_0x2a21d9[_0xec76('0x44')];_0x39828e+=0x1){_0x1eb42a=_0x2a21d9[_0x39828e];if(_[_0xec76('0x48')](_0xeb85f8[_0xec76('0x47')][util[_0xec76('0x28')](_0xec76('0x29'),_0x1eb42a['name'])])){_0xeb85f8[_0xec76('0x47')][util[_0xec76('0x28')](_0xec76('0x29'),_0x1eb42a['name'])]=new Trunk(_0x1eb42a);}else{_0xeb85f8['mergeFromDatabase'](_0xeb85f8[_0xec76('0x47')][util[_0xec76('0x28')]('SIP/%s',_0x1eb42a[_0xec76('0x2a')])],_0x1eb42a);}}}return _0xeb85f8['trunks'];};};Realtime[_0xec76('0x41')][_0xec76('0x49')]=function(){var _0x3da87e=this;return function(_0x33e6bd){if(_0x33e6bd){freeIsNotKey(_0x33e6bd,_0x3da87e[_0xec76('0x13')],_0xec76('0x2a'));for(var _0xef1340=0x0,_0x10594d={},_0x2b962f={};_0xef1340<_0x33e6bd[_0xec76('0x44')];_0xef1340+=0x1){_0x10594d=_0x33e6bd[_0xef1340];if(_[_0xec76('0x48')](_0x3da87e[_0xec76('0x13')][_0x10594d[_0xec76('0x2a')]])){_0x3da87e[_0xec76('0x13')][_0x10594d[_0xec76('0x2a')]]=new VoiceQueue(_0x10594d);}else{_0x3da87e[_0xec76('0x42')](_0x3da87e[_0xec76('0x13')][_0x10594d[_0xec76('0x2a')]],_0x10594d);}}}return _0x3da87e['voiceQueues'];};};Realtime[_0xec76('0x41')]['initTriggers']=function(){var _0x1168bc=this;return function(_0xc223cc){if(_0xc223cc){freeIsNotKey(_0xc223cc,_0x1168bc[_0xec76('0x14')],'id');for(var _0x2c0dc0=0x0,_0x8fb197={},_0x46e905={};_0x2c0dc0<_0xc223cc['length'];_0x2c0dc0+=0x1){_0x8fb197=_0xc223cc[_0x2c0dc0];if(_[_0xec76('0x48')](_0x1168bc['triggers'][_0x8fb197['id']])){_0x1168bc[_0xec76('0x14')][_0x8fb197['id']]=new Trigger(_0x8fb197);}else{_0x1168bc[_0xec76('0x42')](_0x1168bc['triggers'][_0x8fb197['id']],_0x8fb197);}}}return _0x1168bc['triggers'];};};Realtime[_0xec76('0x41')][_0xec76('0x4a')]=function(){var _0x1cc99c=this;return function(_0x4fc000){if(_0x4fc000){freeIsNotKey(_0x4fc000,_0x1cc99c[_0xec76('0x15')],'id');for(var _0x4e86e4=0x0,_0x30c4b7={},_0x5673cb={};_0x4e86e4<_0x4fc000[_0xec76('0x44')];_0x4e86e4+=0x1){_0x30c4b7=_0x4fc000[_0x4e86e4];if(_[_0xec76('0x48')](_0x1cc99c['templates'][_0x30c4b7['id']])){_0x1cc99c[_0xec76('0x15')][_0x30c4b7['id']]=new Template(_0x30c4b7);}else{_0x1cc99c[_0xec76('0x42')](_0x1cc99c['templates'][_0x30c4b7['id']],_0x30c4b7);}}}return _0x1cc99c['templates'];};};Realtime[_0xec76('0x41')][_0xec76('0x4b')]=function(){var _0xc93409=this;return function(_0x1de618){if(_0x1de618){freeIsNotKey(_0x1de618,_0xc93409['zendeskAccounts'],'id');for(var _0x18fa1e=0x0,_0x4544c3={},_0x10b333={};_0x18fa1e<_0x1de618[_0xec76('0x44')];_0x18fa1e+=0x1){_0x4544c3=_0x1de618[_0x18fa1e];if(_[_0xec76('0x48')](_0xc93409[_0xec76('0x1d')][_0x4544c3['id']])){_0xc93409[_0xec76('0x1d')][_0x4544c3['id']]=new ZendeskAccount(_0x4544c3);}else{_0xc93409['mergeFromDatabase'](_0xc93409[_0xec76('0x1d')][_0x4544c3['id']],_0x4544c3);}}}return _0xc93409[_0xec76('0x1d')];};};Realtime['prototype'][_0xec76('0x4c')]=function(){var _0x544f36=this;return function(_0x4c15a8){if(_0x4c15a8){freeIsNotKey(_0x4c15a8,_0x544f36[_0xec76('0x1e')],'id');for(var _0x3c5ad5=0x0,_0x25ef4b={},_0x67e971={};_0x3c5ad5<_0x4c15a8['length'];_0x3c5ad5+=0x1){_0x25ef4b=_0x4c15a8[_0x3c5ad5];if(_[_0xec76('0x48')](_0x544f36[_0xec76('0x1e')][_0x25ef4b['id']])){_0x544f36[_0xec76('0x1e')][_0x25ef4b['id']]=new SalesforceAccount(_0x25ef4b);}else{_0x544f36[_0xec76('0x42')](_0x544f36[_0xec76('0x1e')][_0x25ef4b['id']],_0x25ef4b);}}}return _0x544f36[_0xec76('0x1e')];};};Realtime[_0xec76('0x41')]['initFreshdeskAccounts']=function(){var _0x481cb6=this;return function(_0x31fd11){if(_0x31fd11){freeIsNotKey(_0x31fd11,_0x481cb6['freshdeskAccounts'],'id');for(var _0x347ade=0x0,_0x504a8b={},_0x2d4302={};_0x347ade<_0x31fd11[_0xec76('0x44')];_0x347ade+=0x1){_0x504a8b=_0x31fd11[_0x347ade];if(_[_0xec76('0x48')](_0x481cb6[_0xec76('0x20')][_0x504a8b['id']])){_0x481cb6[_0xec76('0x20')][_0x504a8b['id']]=new FreshdeskAccount(_0x504a8b);}else{_0x481cb6[_0xec76('0x42')](_0x481cb6[_0xec76('0x20')][_0x504a8b['id']],_0x504a8b);}}}return _0x481cb6['freshdeskAccounts'];};};Realtime[_0xec76('0x41')][_0xec76('0x4d')]=function(){var _0x3f6edd=this;return function(_0x8edc96){if(_0x8edc96){freeIsNotKey(_0x8edc96,_0x3f6edd['zohoAccounts'],'id');for(var _0x35c46e=0x0,_0x21e9f={},_0x3debc2={};_0x35c46e<_0x8edc96[_0xec76('0x44')];_0x35c46e+=0x1){_0x21e9f=_0x8edc96[_0x35c46e];if(_[_0xec76('0x48')](_0x3f6edd['zohoAccounts'][_0x21e9f['id']])){_0x3f6edd[_0xec76('0x21')][_0x21e9f['id']]=new ZohoAccount(_0x21e9f);}else{_0x3f6edd[_0xec76('0x42')](_0x3f6edd['zohoAccounts'][_0x21e9f['id']],_0x21e9f);}}}return _0x3f6edd[_0xec76('0x21')];};};Realtime[_0xec76('0x41')][_0xec76('0x4e')]=function(){var _0x58e5d0=this;return function(_0x4c359b){if(_0x4c359b){freeIsNotKey(_0x4c359b,_0x58e5d0[_0xec76('0x22')],'id');for(var _0x399bb6=0x0,_0x4ab905={},_0x27274f={};_0x399bb6<_0x4c359b['length'];_0x399bb6+=0x1){_0x4ab905=_0x4c359b[_0x399bb6];if(_[_0xec76('0x48')](_0x58e5d0[_0xec76('0x22')][_0x4ab905['id']])){_0x58e5d0['deskAccounts'][_0x4ab905['id']]=new DeskAccount(_0x4ab905);}else{_0x58e5d0[_0xec76('0x42')](_0x58e5d0[_0xec76('0x22')][_0x4ab905['id']],_0x4ab905);}}}return _0x58e5d0[_0xec76('0x22')];};};Realtime[_0xec76('0x41')]['initSugarcrmAccounts']=function(){var _0x217a0c=this;return function(_0x45e465){if(_0x45e465){freeIsNotKey(_0x45e465,_0x217a0c['sugarcrmAccounts'],'id');for(var _0xa95819=0x0,_0x2755af={},_0x4f4e0a={};_0xa95819<_0x45e465[_0xec76('0x44')];_0xa95819+=0x1){_0x2755af=_0x45e465[_0xa95819];if(_[_0xec76('0x48')](_0x217a0c[_0xec76('0x1f')][_0x2755af['id']])){_0x217a0c[_0xec76('0x1f')][_0x2755af['id']]=new SugarcrmAccount(_0x2755af);}else{_0x217a0c[_0xec76('0x42')](_0x217a0c['sugarcrmAccounts'][_0x2755af['id']],_0x2755af);}}}return _0x217a0c['sugarcrmAccounts'];};};Realtime[_0xec76('0x41')]['initVtigerAccounts']=function(){var _0x574e9c=this;return function(_0x31bb11){if(_0x31bb11){freeIsNotKey(_0x31bb11,_0x574e9c[_0xec76('0x23')],'id');for(var _0x2b25bd=0x0,_0x3a8447={},_0x338a7f={};_0x2b25bd<_0x31bb11[_0xec76('0x44')];_0x2b25bd+=0x1){_0x3a8447=_0x31bb11[_0x2b25bd];if(_['isUndefined'](_0x574e9c['vtigerAccounts'][_0x3a8447['id']])){_0x574e9c[_0xec76('0x23')][_0x3a8447['id']]=new VtigerAccount(_0x3a8447);}else{_0x574e9c[_0xec76('0x42')](_0x574e9c[_0xec76('0x23')][_0x3a8447['id']],_0x3a8447);}}}return _0x574e9c[_0xec76('0x23')];};};Realtime['prototype'][_0xec76('0x4f')]=function(){var _0x8f28d9=this;return function(_0x3661bd){if(_0x3661bd){freeIsNotKey(_0x3661bd,_0x8f28d9['servicenowAccounts'],'id');for(var _0x50fcb9=0x0,_0x50c978={},_0x367ee7={};_0x50fcb9<_0x3661bd['length'];_0x50fcb9+=0x1){_0x50c978=_0x3661bd[_0x50fcb9];if(_[_0xec76('0x48')](_0x8f28d9['servicenowAccounts'][_0x50c978['id']])){_0x8f28d9[_0xec76('0x24')][_0x50c978['id']]=new ServicenowAccount(_0x50c978);}else{_0x8f28d9[_0xec76('0x42')](_0x8f28d9[_0xec76('0x24')][_0x50c978['id']],_0x50c978);}}}return _0x8f28d9[_0xec76('0x24')];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x22d597=this;return function(_0x597fff){if(_0x597fff){freeIsNotKey(_0x597fff,_0x22d597[_0xec76('0x50')],'id');for(var _0x1c1cdf=0x0,_0x369f0a={},_0x5e803a={};_0x1c1cdf<_0x597fff[_0xec76('0x44')];_0x1c1cdf+=0x1){_0x369f0a=_0x597fff[_0x1c1cdf];if(_[_0xec76('0x48')](_0x22d597['dynamics365Accounts'][_0x369f0a['id']])){_0x22d597[_0xec76('0x50')][_0x369f0a['id']]=new Dynamics365Account(_0x369f0a);}else{_0x22d597[_0xec76('0x42')](_0x22d597[_0xec76('0x50')][_0x369f0a['id']],_0x369f0a);}}}return _0x22d597['dynamics365Accounts'];};};Realtime[_0xec76('0x41')][_0xec76('0x51')]=function(){var _0x1e7ed7=this;return function(_0x7306f6){if(_0x7306f6){freeIsNotKey(_0x7306f6,_0x1e7ed7[_0xec76('0x25')],'id');for(var _0x4c5b1d=0x0,_0x1167a4={},_0x5033ab={};_0x4c5b1d<_0x7306f6[_0xec76('0x44')];_0x4c5b1d+=0x1){_0x1167a4=_0x7306f6[_0x4c5b1d];if(_[_0xec76('0x48')](_0x1e7ed7[_0xec76('0x25')][_0x1167a4['id']])){_0x1e7ed7[_0xec76('0x25')][_0x1167a4['id']]=new FreshsalesAccount(_0x1167a4);}else{_0x1e7ed7[_0xec76('0x42')](_0x1e7ed7['freshsalesAccounts'][_0x1167a4['id']],_0x1167a4);}}}return _0x1e7ed7[_0xec76('0x25')];};};Realtime[_0xec76('0x41')]['initVoiceQueueHopperHistory']=function(){var _0x26e2d7=this;return function(_0x18145d){for(var _0x51a7a4=0x0;_0x51a7a4<_0x18145d[_0xec76('0x44')];_0x51a7a4+=0x1){_['merge'](_0x26e2d7['voiceQueues'][_0x18145d[_0x51a7a4][_0xec76('0x2a')]],_0x18145d[_0x51a7a4]);}return _0x26e2d7[_0xec76('0x13')];};};Realtime[_0xec76('0x41')]['initVoiceQueueReports']=function(){var _0x1ed0e7=this;return function(_0x4868e0){clearVoiceQueues(_0x1ed0e7[_0xec76('0x13')]);if(_0x4868e0){_0x4868e0=_['groupBy'](_0x4868e0,'uniqueid');for(var _0x1fa861 in _0x4868e0){if(_0x4868e0['hasOwnProperty'](_0x1fa861)){var _0x111c1c={};for(var _0x276bb8=0x0;_0x276bb8<_0x4868e0[_0x1fa861][_0xec76('0x44')];_0x276bb8+=0x1){var _0x1f818c=_0x4868e0[_0x1fa861][_0x276bb8][_0xec76('0x52')];if(_0x1ed0e7[_0xec76('0x13')][_0x1f818c]){if(_0x4868e0[_0x1fa861][_0x276bb8]['queuecallerexit']){_0x1ed0e7[_0xec76('0x13')][_0x1f818c][_0xec76('0x33')]+=0x1;}if(_0x4868e0[_0x1fa861][_0x276bb8]['queuecallerabandon']){_0x1ed0e7['voiceQueues'][_0x1f818c][_0xec76('0x53')]+=0x1;}_0x1ed0e7[_0xec76('0x13')][_0x1f818c]['sumHoldTime']+=moment(_0x4868e0[_0x1fa861][_0x276bb8][_0xec76('0x54')])[_0xec76('0x55')](moment(_0x4868e0[_0x1fa861][_0x276bb8][_0xec76('0x56')]),_0xec76('0x57'))||0x0;if(_0x276bb8===_0x4868e0[_0x1fa861][_0xec76('0x44')]-0x1){_0x1ed0e7[_0xec76('0x13')][_0x1f818c]['sumDuration']+=moment(_0x4868e0[_0x1fa861][_0x276bb8][_0xec76('0x58')]||_0x4868e0[_0x1fa861][_0x276bb8][_0xec76('0x59')]||_0x4868e0[_0x1fa861][_0x276bb8][_0xec76('0x5a')])['diff'](moment(_0x4868e0[_0x1fa861][_0x276bb8][_0xec76('0x56')]),'seconds')||0x0;_0x1ed0e7[_0xec76('0x13')][_0x1f818c][_0xec76('0x2d')]+=0x1;if(_0x4868e0[_0x1fa861][_0x276bb8][_0xec76('0x5b')]){_0x1ed0e7[_0xec76('0x13')][_0x1f818c][_0xec76('0x32')]+=0x1;_0x1ed0e7[_0xec76('0x13')][_0x1f818c][_0xec76('0x5c')]+=moment(_0x4868e0[_0x1fa861][_0x276bb8][_0xec76('0x58')])[_0xec76('0x55')](moment(_0x4868e0[_0x1fa861][_0x276bb8]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x1ed0e7[_0xec76('0x13')][_0x1f818c][_0xec76('0x34')]+=_0x1ed0e7[_0xec76('0x13')][_0x1f818c][_0xec76('0x2e')]||0x0;}}}}}}return _0x1ed0e7[_0xec76('0x13')];};};Realtime['prototype'][_0xec76('0x5d')]=function(){var _0x362819=this;return function(_0x26f4f4){clearVoiceCallReports(_0x362819[_0xec76('0x16')]);if(_0x26f4f4){for(var _0x3f6b12=0x0;_0x3f6b12<_0x26f4f4[_0xec76('0x44')];_0x3f6b12+=0x1){_0x362819['outbound'][_0xec76('0x2d')]+=0x1;_0x362819[_0xec76('0x16')][_0xec76('0x34')]+=_0x26f4f4[_0x3f6b12][_0xec76('0x5e')];if(_0x26f4f4[_0x3f6b12]['disposition']===_0xec76('0x5f')){_0x362819[_0xec76('0x16')][_0xec76('0x32')]+=0x1;_0x362819[_0xec76('0x16')][_0xec76('0x2e')]+=_0x26f4f4[_0x3f6b12][_0xec76('0x5e')]-_0x26f4f4[_0x3f6b12][_0xec76('0x60')]||0x0;_0x362819[_0xec76('0x16')][_0xec76('0x5c')]+=_0x26f4f4[_0x3f6b12][_0xec76('0x60')];}}}return _0x362819[_0xec76('0x16')];};};Realtime[_0xec76('0x41')][_0xec76('0x61')]=function(){var _0x316e15=this;return function(_0x14a4c9){if(_0x14a4c9){freeIsNotKey(_0x14a4c9,_0x316e15[_0xec76('0x62')],_0xec76('0x2a'));for(var _0x1c2099=0x0,_0x169ff1={};_0x1c2099<_0x14a4c9[_0xec76('0x44')];_0x1c2099+=0x1){_0x169ff1=_0x14a4c9[_0x1c2099];if(_[_0xec76('0x48')](_0x316e15[_0xec76('0x62')][_0x169ff1[_0xec76('0x2a')]])){_0x316e15[_0xec76('0x62')][_0x169ff1[_0xec76('0x2a')]]=new Campaign(_0x169ff1);}else{_0x316e15[_0xec76('0x42')](_0x316e15[_0xec76('0x62')][_0x169ff1[_0xec76('0x2a')]],_0x169ff1);_0x316e15[_0xec76('0x62')][_0x169ff1['name']][_0xec76('0x63')]=_0x169ff1[_0xec76('0x64')]?_0x169ff1[_0xec76('0x64')][_0xec76('0x2a')]:undefined;}}}return _0x316e15[_0xec76('0x62')];};};Realtime['prototype'][_0xec76('0x65')]=function(){var _0x2eb9a5=this;return function(_0x4201d9){if(_0x4201d9){freeIsNotKey(_0x4201d9,_0x2eb9a5['voiceExtensions'],'id');for(var _0x25da83=0x0,_0x50fa64={};_0x25da83<_0x4201d9[_0xec76('0x44')];_0x25da83+=0x1){_0x50fa64=_0x4201d9[_0x25da83];if(_['isUndefined'](_0x2eb9a5['voiceExtensions'][_0x50fa64['id']])){_0x2eb9a5[_0xec76('0x17')][_0x50fa64['id']]=new VoiceExtension(_0x50fa64);}else{_0x2eb9a5[_0xec76('0x42')](_0x2eb9a5['voiceExtensions'][_0x50fa64['id']],_0x50fa64);}}}return _0x2eb9a5[_0xec76('0x17')];};};Realtime[_0xec76('0x41')][_0xec76('0x66')]=function(){var _0x2fd419=this;return function(_0x43932b){clearCampaigns(_0x2fd419[_0xec76('0x62')]);for(var _0x5680ee=0x0;_0x5680ee<_0x43932b[_0xec76('0x44')];_0x5680ee+=0x1){_[_0xec76('0x67')](_0x2fd419[_0xec76('0x62')][_0x43932b[_0x5680ee][_0xec76('0x2a')]],_0x43932b[_0x5680ee]);}return _0x2fd419[_0xec76('0x62')];};};Realtime[_0xec76('0x41')][_0xec76('0x68')]=function(){var _0x239744=this;return function(_0x20a8e1){if(_0x20a8e1){freeIsNotKey(_0x20a8e1,_0x239744[_0xec76('0x69')],'id');for(var _0xc6f6d4=0x0,_0x5bc303={},_0x1a39e6={};_0xc6f6d4<_0x20a8e1[_0xec76('0x44')];_0xc6f6d4+=0x1){_0x5bc303=_0x20a8e1[_0xc6f6d4];if(_['isUndefined'](_0x239744[_0xec76('0x69')][_0x5bc303['id']])){_0x239744[_0xec76('0x69')][_0x5bc303['id']]=new FaxAccount(_0x5bc303);}else{_0x239744[_0xec76('0x42')](_0x239744[_0xec76('0x69')][_0x5bc303['id']],_0x5bc303);}}}return _0x239744[_0xec76('0x69')];};};module[_0xec76('0x6a')]=Realtime; \ No newline at end of file +var _0x3b90=['../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','telephones','trunks','voiceQueues','triggers','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','name','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundAnswerCallsDay','queueStatusComplete','initAgents','agents','length','isNil','isUndefined','prototype','initTelephones','mergeFromDatabase','initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','initVoiceCallReports','duration','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','lodash','moment','../model/agent','../model/telephone'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x3b90,0x143));var _0x03b9=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x3b90[_0x50aa2e];return _0x5e07f0;};'use strict';var util=require('util');var _=require(_0x03b9('0x0'));var moment=require(_0x03b9('0x1'));var Agent=require(_0x03b9('0x2'));var Telephone=require(_0x03b9('0x3'));var Trunk=require(_0x03b9('0x4'));var VoiceQueue=require(_0x03b9('0x5'));var Trigger=require(_0x03b9('0x6'));var Template=require(_0x03b9('0x7'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x03b9('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x03b9('0x9'));var FreshdeskAccount=require(_0x03b9('0xa'));var SugarcrmAccount=require(_0x03b9('0xb'));var ZohoAccount=require(_0x03b9('0xc'));var DeskAccount=require(_0x03b9('0xd'));var VtigerAccount=require(_0x03b9('0xe'));var ServicenowAccount=require(_0x03b9('0xf'));var Dynamics365Account=require(_0x03b9('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this['agents']={};this[_0x03b9('0x11')]={};this[_0x03b9('0x12')]={};this[_0x03b9('0x13')]={};this[_0x03b9('0x14')]={};this['campaigns']={};this[_0x03b9('0x15')]={};this[_0x03b9('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x03b9('0x17')]={};this[_0x03b9('0x18')]={};this[_0x03b9('0x19')]={};this[_0x03b9('0x1a')]={};this[_0x03b9('0x1b')]={};this[_0x03b9('0x1c')]={};this['salesforceAccounts']={};this[_0x03b9('0x1d')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x03b9('0x1e')]={};this[_0x03b9('0x1f')]={};this[_0x03b9('0x20')]={};this[_0x03b9('0x21')]={};this[_0x03b9('0x22')]={};this[_0x03b9('0x23')]={};};function freeIsNotKey(_0x43ee7e,_0x1d2f67,_0x4c1b0b){var _0x327f8e=_['mapKeys'](_0x43ee7e,function(_0x5dc485,_0x5a6e78){return _0x5dc485[_0x4c1b0b];});for(var _0x3852c8 in _0x1d2f67){if(_0x1d2f67[_0x03b9('0x24')](_0x3852c8)){if(!_0x327f8e[_0x3852c8]){delete _0x1d2f67[_0x3852c8];}}}}function freeIsNotKeySip(_0x3b9baf,_0x14e9de){var _0x10cfe4=_[_0x03b9('0x25')](_0x3b9baf,function(_0x29a26c,_0x408edc){return util[_0x03b9('0x26')]('SIP/%s',_0x29a26c[_0x03b9('0x27')]);});for(var _0x362216 in _0x14e9de){if(_0x14e9de[_0x03b9('0x24')](_0x362216)){if(!_0x10cfe4[_0x362216]){delete _0x14e9de[_0x362216];}}}}function freeIsNotKeyAgent(_0x47bb9d,_0x2609f3){var _0xc9bba7=_[_0x03b9('0x25')](_0x47bb9d,function(_0x13443f,_0x5b6700){var _0x1e7990=_['isNil'](_0x13443f[_0x03b9('0x28')])?util[_0x03b9('0x26')](_0x03b9('0x29'),_0x13443f['name']):_0x13443f[_0x03b9('0x28')];return _0x1e7990;});for(var _0x1d0770 in _0x2609f3){if(_0x2609f3[_0x03b9('0x24')](_0x1d0770)){if(!_0xc9bba7[_0x1d0770]){delete _0x2609f3[_0x1d0770];}}}}function clearVoiceCallReports(_0x18f43e){_0x18f43e[_0x03b9('0x2a')]=0x0;_0x18f43e[_0x03b9('0x2b')]=0x0;_0x18f43e[_0x03b9('0x2c')]=0x0;_0x18f43e[_0x03b9('0x2d')]=0x0;_0x18f43e[_0x03b9('0x2e')]=0x0;}function clearCampaigns(_0x191abc){if(!_[_0x03b9('0x2f')](_0x191abc)){for(var _0x54e539 in _0x191abc){if(_0x191abc['hasOwnProperty'](_0x54e539)){_0x191abc[_0x54e539]['ivrTotalCallsDays']=0x0;_0x191abc[_0x54e539][_0x03b9('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4cbc6d){if(!_['isEmpty'](_0x4cbc6d)){for(var _0x888193 in _0x4cbc6d){if(_0x4cbc6d['hasOwnProperty'](_0x888193)){_0x4cbc6d[_0x888193][_0x03b9('0x2a')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x2b')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x31')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x32')]=0x0;_0x4cbc6d[_0x888193]['sumHoldTime']=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x2d')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x2e')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x33')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x34')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x35')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x36')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x37')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x38')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x39')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x3a')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x3b')]=0x0;_0x4cbc6d[_0x888193]['outboundOriginateFailureCallsDay']=0x0;_0x4cbc6d[_0x888193]['outboundRejectCallsDay']=0x0;_0x4cbc6d[_0x888193]['outboundReCallsDay']=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x33')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x3c')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x3d')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x5a9ed0,_0xc116bc){for(var _0x3026ce in _0xc116bc){if(_0x5a9ed0[_0x03b9('0x24')](_0x3026ce)){_0x5a9ed0[_0x3026ce]=_0xc116bc[_0x3026ce];}}};Realtime['prototype'][_0x03b9('0x3e')]=function(){var _0x43b8f0=this;return function(_0x384298){if(_0x384298){freeIsNotKeyAgent(_0x384298,_0x43b8f0[_0x03b9('0x3f')]);for(var _0x474650=0x0,_0x125f81={},_0x8352a9={};_0x474650<_0x384298[_0x03b9('0x40')];_0x474650+=0x1){_0x125f81=_0x384298[_0x474650];var _0x6362c0=_[_0x03b9('0x41')](_0x125f81['interface'])?util['format'](_0x03b9('0x29'),_0x125f81[_0x03b9('0x27')]):_0x125f81[_0x03b9('0x28')];if(_[_0x03b9('0x42')](_0x43b8f0[_0x03b9('0x3f')][_0x6362c0])){_0x43b8f0[_0x03b9('0x3f')][_0x6362c0]=new Agent(_0x125f81);}else{_0x43b8f0['mergeFromDatabase'](_0x43b8f0[_0x03b9('0x3f')][_0x6362c0],_0x125f81);}}}return _0x43b8f0['agents'];};};Realtime[_0x03b9('0x43')][_0x03b9('0x44')]=function(){var _0x41e40a=this;return function(_0x249dce){if(_0x249dce){freeIsNotKeySip(_0x249dce,_0x41e40a['telephones']);for(var _0x3d2f3a=0x0,_0x508649={},_0x216ea3={};_0x3d2f3a<_0x249dce['length'];_0x3d2f3a+=0x1){_0x508649=_0x249dce[_0x3d2f3a];if(_['isUndefined'](_0x41e40a[_0x03b9('0x11')][util['format'](_0x03b9('0x29'),_0x508649['name'])])){_0x41e40a[_0x03b9('0x11')][util[_0x03b9('0x26')](_0x03b9('0x29'),_0x508649[_0x03b9('0x27')])]=new Telephone(_0x508649);}else{_0x41e40a[_0x03b9('0x45')](_0x41e40a['telephones'][util[_0x03b9('0x26')](_0x03b9('0x29'),_0x508649[_0x03b9('0x27')])],_0x508649);}}}return _0x41e40a[_0x03b9('0x11')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x46')]=function(){var _0x281a75=this;return function(_0x1c9dac){if(_0x1c9dac){freeIsNotKeySip(_0x1c9dac,_0x281a75[_0x03b9('0x12')]);for(var _0x3dc782=0x0,_0x4c6cd7={},_0x58ceab={};_0x3dc782<_0x1c9dac[_0x03b9('0x40')];_0x3dc782+=0x1){_0x4c6cd7=_0x1c9dac[_0x3dc782];if(_[_0x03b9('0x42')](_0x281a75['trunks'][util[_0x03b9('0x26')](_0x03b9('0x29'),_0x4c6cd7[_0x03b9('0x27')])])){_0x281a75[_0x03b9('0x12')][util[_0x03b9('0x26')](_0x03b9('0x29'),_0x4c6cd7['name'])]=new Trunk(_0x4c6cd7);}else{_0x281a75[_0x03b9('0x45')](_0x281a75[_0x03b9('0x12')][util[_0x03b9('0x26')](_0x03b9('0x29'),_0x4c6cd7['name'])],_0x4c6cd7);}}}return _0x281a75['trunks'];};};Realtime[_0x03b9('0x43')][_0x03b9('0x47')]=function(){var _0x2746c7=this;return function(_0x2cc15b){if(_0x2cc15b){freeIsNotKey(_0x2cc15b,_0x2746c7[_0x03b9('0x13')],_0x03b9('0x27'));for(var _0x1dd123=0x0,_0x44dbb7={},_0x29001d={};_0x1dd123<_0x2cc15b[_0x03b9('0x40')];_0x1dd123+=0x1){_0x44dbb7=_0x2cc15b[_0x1dd123];if(_[_0x03b9('0x42')](_0x2746c7[_0x03b9('0x13')][_0x44dbb7['name']])){_0x2746c7[_0x03b9('0x13')][_0x44dbb7[_0x03b9('0x27')]]=new VoiceQueue(_0x44dbb7);}else{_0x2746c7[_0x03b9('0x45')](_0x2746c7[_0x03b9('0x13')][_0x44dbb7['name']],_0x44dbb7);}}}return _0x2746c7[_0x03b9('0x13')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x48')]=function(){var _0x38f550=this;return function(_0x16b05c){if(_0x16b05c){freeIsNotKey(_0x16b05c,_0x38f550[_0x03b9('0x14')],'id');for(var _0x1e7e56=0x0,_0x4183ac={},_0x51b508={};_0x1e7e56<_0x16b05c['length'];_0x1e7e56+=0x1){_0x4183ac=_0x16b05c[_0x1e7e56];if(_[_0x03b9('0x42')](_0x38f550[_0x03b9('0x14')][_0x4183ac['id']])){_0x38f550[_0x03b9('0x14')][_0x4183ac['id']]=new Trigger(_0x4183ac);}else{_0x38f550[_0x03b9('0x45')](_0x38f550[_0x03b9('0x14')][_0x4183ac['id']],_0x4183ac);}}}return _0x38f550[_0x03b9('0x14')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x49')]=function(){var _0x381926=this;return function(_0xdfcc87){if(_0xdfcc87){freeIsNotKey(_0xdfcc87,_0x381926[_0x03b9('0x15')],'id');for(var _0x862904=0x0,_0x472a0b={},_0x4c99c8={};_0x862904<_0xdfcc87[_0x03b9('0x40')];_0x862904+=0x1){_0x472a0b=_0xdfcc87[_0x862904];if(_[_0x03b9('0x42')](_0x381926[_0x03b9('0x15')][_0x472a0b['id']])){_0x381926['templates'][_0x472a0b['id']]=new Template(_0x472a0b);}else{_0x381926[_0x03b9('0x45')](_0x381926[_0x03b9('0x15')][_0x472a0b['id']],_0x472a0b);}}}return _0x381926[_0x03b9('0x15')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x4a')]=function(){var _0x48972f=this;return function(_0x45b930){if(_0x45b930){freeIsNotKey(_0x45b930,_0x48972f['zendeskAccounts'],'id');for(var _0x402760=0x0,_0x424303={},_0x4fdedc={};_0x402760<_0x45b930['length'];_0x402760+=0x1){_0x424303=_0x45b930[_0x402760];if(_[_0x03b9('0x42')](_0x48972f[_0x03b9('0x1c')][_0x424303['id']])){_0x48972f[_0x03b9('0x1c')][_0x424303['id']]=new ZendeskAccount(_0x424303);}else{_0x48972f[_0x03b9('0x45')](_0x48972f[_0x03b9('0x1c')][_0x424303['id']],_0x424303);}}}return _0x48972f[_0x03b9('0x1c')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x4b')]=function(){var _0x6e04c5=this;return function(_0x3dcce5){if(_0x3dcce5){freeIsNotKey(_0x3dcce5,_0x6e04c5['salesforceAccounts'],'id');for(var _0x16e295=0x0,_0x2b9186={},_0x5c10b6={};_0x16e295<_0x3dcce5[_0x03b9('0x40')];_0x16e295+=0x1){_0x2b9186=_0x3dcce5[_0x16e295];if(_[_0x03b9('0x42')](_0x6e04c5[_0x03b9('0x4c')][_0x2b9186['id']])){_0x6e04c5[_0x03b9('0x4c')][_0x2b9186['id']]=new SalesforceAccount(_0x2b9186);}else{_0x6e04c5['mergeFromDatabase'](_0x6e04c5[_0x03b9('0x4c')][_0x2b9186['id']],_0x2b9186);}}}return _0x6e04c5[_0x03b9('0x4c')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x4d')]=function(){var _0x55b242=this;return function(_0x30621e){if(_0x30621e){freeIsNotKey(_0x30621e,_0x55b242[_0x03b9('0x4e')],'id');for(var _0x264166=0x0,_0xd48f8d={},_0x410a33={};_0x264166<_0x30621e['length'];_0x264166+=0x1){_0xd48f8d=_0x30621e[_0x264166];if(_['isUndefined'](_0x55b242[_0x03b9('0x4e')][_0xd48f8d['id']])){_0x55b242['freshdeskAccounts'][_0xd48f8d['id']]=new FreshdeskAccount(_0xd48f8d);}else{_0x55b242[_0x03b9('0x45')](_0x55b242['freshdeskAccounts'][_0xd48f8d['id']],_0xd48f8d);}}}return _0x55b242[_0x03b9('0x4e')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x4f')]=function(){var _0x30aebe=this;return function(_0x2c93c8){if(_0x2c93c8){freeIsNotKey(_0x2c93c8,_0x30aebe[_0x03b9('0x50')],'id');for(var _0x5ba8b4=0x0,_0x2379cd={},_0x586273={};_0x5ba8b4<_0x2c93c8['length'];_0x5ba8b4+=0x1){_0x2379cd=_0x2c93c8[_0x5ba8b4];if(_[_0x03b9('0x42')](_0x30aebe[_0x03b9('0x50')][_0x2379cd['id']])){_0x30aebe[_0x03b9('0x50')][_0x2379cd['id']]=new ZohoAccount(_0x2379cd);}else{_0x30aebe[_0x03b9('0x45')](_0x30aebe[_0x03b9('0x50')][_0x2379cd['id']],_0x2379cd);}}}return _0x30aebe['zohoAccounts'];};};Realtime[_0x03b9('0x43')][_0x03b9('0x51')]=function(){var _0x1e5010=this;return function(_0x32c226){if(_0x32c226){freeIsNotKey(_0x32c226,_0x1e5010[_0x03b9('0x1e')],'id');for(var _0x3c4f99=0x0,_0x49fb69={},_0x315c88={};_0x3c4f99<_0x32c226[_0x03b9('0x40')];_0x3c4f99+=0x1){_0x49fb69=_0x32c226[_0x3c4f99];if(_[_0x03b9('0x42')](_0x1e5010[_0x03b9('0x1e')][_0x49fb69['id']])){_0x1e5010[_0x03b9('0x1e')][_0x49fb69['id']]=new DeskAccount(_0x49fb69);}else{_0x1e5010[_0x03b9('0x45')](_0x1e5010[_0x03b9('0x1e')][_0x49fb69['id']],_0x49fb69);}}}return _0x1e5010['deskAccounts'];};};Realtime[_0x03b9('0x43')][_0x03b9('0x52')]=function(){var _0xc2c677=this;return function(_0x2a0a48){if(_0x2a0a48){freeIsNotKey(_0x2a0a48,_0xc2c677[_0x03b9('0x1d')],'id');for(var _0x153f51=0x0,_0x1ef413={},_0x5cc134={};_0x153f51<_0x2a0a48[_0x03b9('0x40')];_0x153f51+=0x1){_0x1ef413=_0x2a0a48[_0x153f51];if(_[_0x03b9('0x42')](_0xc2c677['sugarcrmAccounts'][_0x1ef413['id']])){_0xc2c677[_0x03b9('0x1d')][_0x1ef413['id']]=new SugarcrmAccount(_0x1ef413);}else{_0xc2c677[_0x03b9('0x45')](_0xc2c677['sugarcrmAccounts'][_0x1ef413['id']],_0x1ef413);}}}return _0xc2c677[_0x03b9('0x1d')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x53')]=function(){var _0x19fd75=this;return function(_0x2901a8){if(_0x2901a8){freeIsNotKey(_0x2901a8,_0x19fd75[_0x03b9('0x1f')],'id');for(var _0x5ce503=0x0,_0x4a6b80={},_0x5cb50d={};_0x5ce503<_0x2901a8['length'];_0x5ce503+=0x1){_0x4a6b80=_0x2901a8[_0x5ce503];if(_[_0x03b9('0x42')](_0x19fd75[_0x03b9('0x1f')][_0x4a6b80['id']])){_0x19fd75['vtigerAccounts'][_0x4a6b80['id']]=new VtigerAccount(_0x4a6b80);}else{_0x19fd75[_0x03b9('0x45')](_0x19fd75[_0x03b9('0x1f')][_0x4a6b80['id']],_0x4a6b80);}}}return _0x19fd75[_0x03b9('0x1f')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5d1e5b=this;return function(_0x44ae2e){if(_0x44ae2e){freeIsNotKey(_0x44ae2e,_0x5d1e5b[_0x03b9('0x20')],'id');for(var _0x5efef0=0x0,_0x2c1727={},_0x3a0063={};_0x5efef0<_0x44ae2e[_0x03b9('0x40')];_0x5efef0+=0x1){_0x2c1727=_0x44ae2e[_0x5efef0];if(_['isUndefined'](_0x5d1e5b[_0x03b9('0x20')][_0x2c1727['id']])){_0x5d1e5b[_0x03b9('0x20')][_0x2c1727['id']]=new ServicenowAccount(_0x2c1727);}else{_0x5d1e5b[_0x03b9('0x45')](_0x5d1e5b[_0x03b9('0x20')][_0x2c1727['id']],_0x2c1727);}}}return _0x5d1e5b['servicenowAccounts'];};};Realtime[_0x03b9('0x43')][_0x03b9('0x54')]=function(){var _0x6a0a05=this;return function(_0x41814f){if(_0x41814f){freeIsNotKey(_0x41814f,_0x6a0a05[_0x03b9('0x21')],'id');for(var _0x842b9=0x0,_0x5a051d={},_0x19c5a0={};_0x842b9<_0x41814f[_0x03b9('0x40')];_0x842b9+=0x1){_0x5a051d=_0x41814f[_0x842b9];if(_['isUndefined'](_0x6a0a05['dynamics365Accounts'][_0x5a051d['id']])){_0x6a0a05[_0x03b9('0x21')][_0x5a051d['id']]=new Dynamics365Account(_0x5a051d);}else{_0x6a0a05['mergeFromDatabase'](_0x6a0a05['dynamics365Accounts'][_0x5a051d['id']],_0x5a051d);}}}return _0x6a0a05[_0x03b9('0x21')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x55')]=function(){var _0x19f3c1=this;return function(_0xb3a989){if(_0xb3a989){freeIsNotKey(_0xb3a989,_0x19f3c1[_0x03b9('0x22')],'id');for(var _0x2f95c6=0x0,_0x32adf8={},_0x132993={};_0x2f95c6<_0xb3a989[_0x03b9('0x40')];_0x2f95c6+=0x1){_0x32adf8=_0xb3a989[_0x2f95c6];if(_[_0x03b9('0x42')](_0x19f3c1[_0x03b9('0x22')][_0x32adf8['id']])){_0x19f3c1[_0x03b9('0x22')][_0x32adf8['id']]=new FreshsalesAccount(_0x32adf8);}else{_0x19f3c1[_0x03b9('0x45')](_0x19f3c1[_0x03b9('0x22')][_0x32adf8['id']],_0x32adf8);}}}return _0x19f3c1[_0x03b9('0x22')];};};Realtime[_0x03b9('0x43')]['initVoiceQueueHopperHistory']=function(){var _0x536177=this;return function(_0x227122){for(var _0x587f1a=0x0;_0x587f1a<_0x227122[_0x03b9('0x40')];_0x587f1a+=0x1){_[_0x03b9('0x56')](_0x536177['voiceQueues'][_0x227122[_0x587f1a]['name']],_0x227122[_0x587f1a]);}return _0x536177[_0x03b9('0x13')];};};Realtime[_0x03b9('0x43')]['initVoiceQueueReports']=function(){var _0x17926f=this;return function(_0x1f677a){clearVoiceQueues(_0x17926f[_0x03b9('0x13')]);if(_0x1f677a){_0x1f677a=_[_0x03b9('0x57')](_0x1f677a,_0x03b9('0x58'));for(var _0x196ada in _0x1f677a){if(_0x1f677a[_0x03b9('0x24')](_0x196ada)){var _0x10aae1={};for(var _0x4e4b66=0x0;_0x4e4b66<_0x1f677a[_0x196ada][_0x03b9('0x40')];_0x4e4b66+=0x1){var _0x90b88a=_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x59')];if(_0x17926f[_0x03b9('0x13')][_0x90b88a]){if(_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x5a')]){_0x17926f['voiceQueues'][_0x90b88a]['unmanaged']+=0x1;}if(_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x5b')]){_0x17926f[_0x03b9('0x13')][_0x90b88a][_0x03b9('0x32')]+=0x1;}_0x17926f[_0x03b9('0x13')][_0x90b88a][_0x03b9('0x2c')]+=moment(_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x5c')])[_0x03b9('0x5d')](moment(_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x5e')]),_0x03b9('0x5f'))||0x0;if(_0x4e4b66===_0x1f677a[_0x196ada][_0x03b9('0x40')]-0x1){_0x17926f[_0x03b9('0x13')][_0x90b88a][_0x03b9('0x2d')]+=moment(_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x60')]||_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x61')]||_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x62')])[_0x03b9('0x5d')](moment(_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x5e')]),_0x03b9('0x5f'))||0x0;_0x17926f[_0x03b9('0x13')][_0x90b88a][_0x03b9('0x2a')]+=0x1;if(_0x1f677a[_0x196ada][_0x4e4b66]['queuecallercomplete']){_0x17926f['voiceQueues'][_0x90b88a][_0x03b9('0x2b')]+=0x1;_0x17926f[_0x03b9('0x13')][_0x90b88a][_0x03b9('0x2e')]+=moment(_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x60')])[_0x03b9('0x5d')](moment(_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x5c')]),_0x03b9('0x5f'))||0x0;}}else{_0x17926f[_0x03b9('0x13')][_0x90b88a][_0x03b9('0x2d')]+=_0x17926f[_0x03b9('0x13')][_0x90b88a][_0x03b9('0x2c')]||0x0;}}}}}}return _0x17926f[_0x03b9('0x13')];};};Realtime['prototype'][_0x03b9('0x63')]=function(){var _0x539c85=this;return function(_0x1afd51){clearVoiceCallReports(_0x539c85[_0x03b9('0x16')]);if(_0x1afd51){for(var _0x1fd31a=0x0;_0x1fd31a<_0x1afd51[_0x03b9('0x40')];_0x1fd31a+=0x1){_0x539c85[_0x03b9('0x16')][_0x03b9('0x2a')]+=0x1;_0x539c85[_0x03b9('0x16')]['sumDuration']+=_0x1afd51[_0x1fd31a][_0x03b9('0x64')];if(_0x1afd51[_0x1fd31a]['disposition']===_0x03b9('0x65')){_0x539c85[_0x03b9('0x16')][_0x03b9('0x2b')]+=0x1;_0x539c85['outbound'][_0x03b9('0x2c')]+=_0x1afd51[_0x1fd31a][_0x03b9('0x64')]-_0x1afd51[_0x1fd31a][_0x03b9('0x66')]||0x0;_0x539c85['outbound'][_0x03b9('0x2e')]+=_0x1afd51[_0x1fd31a]['billableseconds'];}}}return _0x539c85[_0x03b9('0x16')];};};Realtime[_0x03b9('0x43')]['initCampaigns']=function(){var _0x1d1c33=this;return function(_0xde75b7){if(_0xde75b7){freeIsNotKey(_0xde75b7,_0x1d1c33[_0x03b9('0x67')],_0x03b9('0x27'));for(var _0x10d2cc=0x0,_0x46e2c2={};_0x10d2cc<_0xde75b7[_0x03b9('0x40')];_0x10d2cc+=0x1){_0x46e2c2=_0xde75b7[_0x10d2cc];if(_[_0x03b9('0x42')](_0x1d1c33[_0x03b9('0x67')][_0x46e2c2['name']])){_0x1d1c33[_0x03b9('0x67')][_0x46e2c2[_0x03b9('0x27')]]=new Campaign(_0x46e2c2);}else{_0x1d1c33['mergeFromDatabase'](_0x1d1c33[_0x03b9('0x67')][_0x46e2c2[_0x03b9('0x27')]],_0x46e2c2);_0x1d1c33[_0x03b9('0x67')][_0x46e2c2[_0x03b9('0x27')]][_0x03b9('0x68')]=_0x46e2c2[_0x03b9('0x69')]?_0x46e2c2[_0x03b9('0x69')][_0x03b9('0x27')]:undefined;}}}return _0x1d1c33[_0x03b9('0x67')];};};Realtime['prototype'][_0x03b9('0x6a')]=function(){var _0x57c307=this;return function(_0xc23dfc){if(_0xc23dfc){freeIsNotKey(_0xc23dfc,_0x57c307['voiceExtensions'],'id');for(var _0x338d42=0x0,_0x54d4c1={};_0x338d42<_0xc23dfc[_0x03b9('0x40')];_0x338d42+=0x1){_0x54d4c1=_0xc23dfc[_0x338d42];if(_[_0x03b9('0x42')](_0x57c307[_0x03b9('0x6b')][_0x54d4c1['id']])){_0x57c307['voiceExtensions'][_0x54d4c1['id']]=new VoiceExtension(_0x54d4c1);}else{_0x57c307['mergeFromDatabase'](_0x57c307[_0x03b9('0x6b')][_0x54d4c1['id']],_0x54d4c1);}}}return _0x57c307[_0x03b9('0x6b')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x6c')]=function(){var _0x2fdc42=this;return function(_0x4301df){clearCampaigns(_0x2fdc42['campaigns']);for(var _0x4498da=0x0;_0x4498da<_0x4301df['length'];_0x4498da+=0x1){_['merge'](_0x2fdc42[_0x03b9('0x67')][_0x4301df[_0x4498da][_0x03b9('0x27')]],_0x4301df[_0x4498da]);}return _0x2fdc42[_0x03b9('0x67')];};};Realtime[_0x03b9('0x43')]['initFaxAccounts']=function(){var _0x7ea50d=this;return function(_0x49bf6c){if(_0x49bf6c){freeIsNotKey(_0x49bf6c,_0x7ea50d[_0x03b9('0x23')],'id');for(var _0x11a109=0x0,_0x1260dc={},_0x2429b6={};_0x11a109<_0x49bf6c[_0x03b9('0x40')];_0x11a109+=0x1){_0x1260dc=_0x49bf6c[_0x11a109];if(_[_0x03b9('0x42')](_0x7ea50d[_0x03b9('0x23')][_0x1260dc['id']])){_0x7ea50d['faxAccounts'][_0x1260dc['id']]=new FaxAccount(_0x1260dc);}else{_0x7ea50d[_0x03b9('0x45')](_0x7ea50d['faxAccounts'][_0x1260dc['id']],_0x1260dc);}}}return _0x7ea50d['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index afd56f5..bb6c2a5 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 _0x2df7=['prototype','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','SIP/%s','length','connectedlinenum','interface','format','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','split','destination','type','lastapplication','queue','context','callerid','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','disposition','ANSWERED','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','UserId','membername','monitors','filename','createdAt','connectedlinename','exten','xcally-motion-dialer','forEach','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','realtime','agents','telephones'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2df7,0x1e2));var _0x72df=function(_0x23fbb3,_0x396365){_0x23fbb3=_0x23fbb3-0x0;var _0x2d1815=_0x2df7[_0x23fbb3];return _0x2d1815;};'use strict';var _=require('lodash');var moment=require(_0x72df('0x0'));var util=require(_0x72df('0x1'));var config=require(_0x72df('0x2'));var ami=require(_0x72df('0x3'));var RpcVoiceAgentReport=require(_0x72df('0x4'));var RpcVoiceCallReport=require(_0x72df('0x5'));var RpcVoiceDialReport=require(_0x72df('0x6'));var RpcMemberReport=require(_0x72df('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x72df('0x8'));var RpcVoiceTransferReport=require(_0x72df('0x9'));var VoiceQueueReport=require(_0x72df('0xa'));var VoiceCallReport=require(_0x72df('0xb'));var VoiceAgentReport=require(_0x72df('0xc'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x20b168){this[_0x72df('0xd')]=_0x20b168;this[_0x72df('0xe')]=_0x20b168['agents'];this[_0x72df('0xf')]=_0x20b168[_0x72df('0xf')];}Report[_0x72df('0x10')]['sync']=function(_0x426f9d){var _0x1264a4=new VoiceQueueReport(this['realtime']);var _0x17b27e=new VoiceAgentReport(this[_0x72df('0xd')]);var _0x200046=new VoiceDialReport(this[_0x72df('0xd')]);var _0x2ebcf0=new VoiceCallReport(this[_0x72df('0xd')]);var _0x459a9a=new UserReport(this['realtime']);if(config[_0x72df('0x11')]&&config[_0x72df('0x11')][_0x72df('0x12')]){ami['on'](_0x72df('0x13'),this[_0x72df('0x14')][_0x72df('0x15')](this));ami['on']('custom:voiceCallReport',this[_0x72df('0x16')][_0x72df('0x15')](this));ami['on'](_0x72df('0x17'),this[_0x72df('0x18')][_0x72df('0x15')](this));ami['on']('custom:voiceDialReport',this[_0x72df('0x19')][_0x72df('0x15')](this));ami['on'](_0x72df('0x1a'),this['blindTransfer'][_0x72df('0x15')](this));ami['on']('attendedtransfer',this[_0x72df('0x1b')][_0x72df('0x15')](this));}};Report[_0x72df('0x10')][_0x72df('0x1c')]=function(_0x2a04a7){var _0x3b103d;_0x3b103d=_[_0x72df('0x1d')](this[_0x72df('0xe')],function(_0x26a8ae){return _0x26a8ae['accountcode']==_0x2a04a7||_0x26a8ae[_0x72df('0x1e')]==_0x2a04a7;});if(_[_0x72df('0x1f')](_0x3b103d)){var _0x4e82f1=_[_0x72df('0x1d')](this[_0x72df('0xf')],function(_0x497f38){return _0x497f38[_0x72df('0x20')]==_0x2a04a7||_0x497f38[_0x72df('0x1e')]==_0x2a04a7;});if(_0x4e82f1){_0x3b103d=_['find'](this[_0x72df('0xe')],function(_0xe2ec20){return _0xe2ec20['interface']==util['format'](_0x72df('0x21'),_0x4e82f1[_0x72df('0x1e')]);});}}return _0x3b103d;};Report[_0x72df('0x10')][_0x72df('0x14')]=function(_0x2be4e7){for(var _0x77ba77=0x0;_0x77ba77<_0x2be4e7[_0x72df('0x22')];_0x77ba77+=0x1){var _0x150f82=this['findAgent'](_0x2be4e7[_0x77ba77][_0x72df('0x23')]);if(_0x150f82){_0x2be4e7[_0x77ba77][_0x72df('0x20')]=_0x150f82[_0x72df('0x20')];_0x2be4e7[_0x77ba77]['assigned']=!![];_0x2be4e7[_0x77ba77]['lastAssignedTo']=_0x150f82[_0x72df('0x1e')];_0x2be4e7[_0x77ba77]['interface']=_[_0x72df('0x1f')](_0x150f82[_0x72df('0x24')])?util[_0x72df('0x25')](_0x72df('0x21'),_0x150f82[_0x72df('0x1e')]):_0x150f82['interface'];if(_0x2be4e7[_0x77ba77]['queuecallercomplete']){_0x2be4e7[_0x77ba77][_0x72df('0x26')]=moment()[_0x72df('0x25')](_0x72df('0x27'));}if(_0x2be4e7[_0x77ba77]['queuecallerexit']){_0x2be4e7[_0x77ba77][_0x72df('0x28')]=moment()['format'](_0x72df('0x27'));}RpcMemberReport[_0x72df('0x14')](_0x2be4e7[_0x77ba77]);}RpcVoiceQueueReport[_0x72df('0x29')](_0x2be4e7[_0x77ba77]);}};function extractCalleridNumber(_0x1036a1){var _0x317647=_0x1036a1[_0x72df('0x2a')](/<(.*?)>/);return _0x317647?_0x317647[0x1]:_0x1036a1;}Report[_0x72df('0x10')][_0x72df('0x2b')]=function(_0x547eea){for(var _0x21309a=0x0;_0x21309a',_0x69ccb5[_0x72df('0x3d')],_0x69ccb5[_0x72df('0x38')]);}if(RpcVoiceTransferReport[_0x72df('0x3e')][_0x69ccb5[_0x72df('0x3f')]]){var _0x26e36a=RpcVoiceTransferReport[_0x72df('0x3e')][_0x69ccb5[_0x72df('0x3f')]];_0x26e36a[_0x72df('0x40')]=_0x69ccb5[_0x72df('0x41')];RpcVoiceTransferReport[_0x72df('0x42')](_0x26e36a);delete RpcVoiceTransferReport[_0x72df('0x3e')][_0x69ccb5['linkedid']];}if(_['isNil'](_0x69ccb5['type'])){_0x69ccb5[_0x72df('0x31')]=this['getCallType'](_0x69ccb5);}if(_[_0x72df('0x1f')](_0x69ccb5[_0x72df('0x43')])){var _0x2696a4=_0x69ccb5[_0x72df('0x2e')][_0x72df('0x2f')]('-')[0x0];var _0x2c4dbb=this['agents'][_0x2696a4];if(!_0x2c4dbb)_0x2c4dbb=this[_0x72df('0x2b')](_0x69ccb5[_0x72df('0x20')]);if(_0x2c4dbb){_0x69ccb5[_0x72df('0x43')]=_0x2c4dbb['id'];_0x69ccb5[_0x72df('0x44')]=_0x2c4dbb[_0x72df('0x1e')];}}RpcVoiceCallReport['create'](_0x69ccb5);if(_0x69ccb5['monitor']){for(var _0x533319=0x0;_0x533319<_0x69ccb5['monitors'][_0x72df('0x22')];_0x533319+=0x1){_0x69ccb5['monitorFilename']=_0x69ccb5[_0x72df('0x45')][_0x533319][_0x72df('0x46')];_0x69ccb5[_0x72df('0x47')]=_0x69ccb5['monitors'][_0x533319]['createdAt'];if(_0x69ccb5['exten']==_0x72df('0x36')){_0x69ccb5[_0x72df('0x38')]=_0x69ccb5[_0x72df('0x23')];_0x69ccb5[_0x72df('0x3d')]=_0x69ccb5[_0x72df('0x48')];_0x69ccb5[_0x72df('0x23')]=_0x69ccb5['accountcode'];_0x69ccb5[_0x72df('0x48')]=_0x69ccb5[_0x72df('0x44')];_0x69ccb5[_0x72df('0x49')]=_0x69ccb5[_0x72df('0x39')];}else if(_0x69ccb5['exten']==_0x72df('0x4a')){_0x69ccb5[_0x72df('0x38')]=_0x69ccb5[_0x72df('0x30')];_0x69ccb5[_0x72df('0x49')]=_0x69ccb5[_0x72df('0x39')];}RpcVoiceRecording['create'](_0x69ccb5);}}};Report['prototype'][_0x72df('0x18')]=function(_0x29ddb4){if(_['isArray'](_0x29ddb4)){_0x29ddb4[_0x72df('0x4b')](function(_0x808aaf){RpcVoiceAgentReport[_0x72df('0x29')](_0x808aaf);});}else{RpcVoiceAgentReport[_0x72df('0x29')](_0x29ddb4);}};Report[_0x72df('0x10')][_0x72df('0x19')]=function(_0x18d7c5){RpcVoiceDialReport[_0x72df('0x29')](_0x18d7c5);var _0x30521f;var _0xea826a;var _0x1f55da=_0x18d7c5['channel'];if(_['startsWith'](_0x1f55da,'Local')){_0xea826a=_0x1f55da[_0x72df('0x4c')](_0x1f55da['indexOf']('/')+0x1,_0x1f55da[_0x72df('0x4d')]('@'));_0x30521f=_['find'](this[_0x72df('0xe')],function(_0xaeed06){return _0xaeed06[_0x72df('0x4e')]==_0xea826a||_0xaeed06[_0x72df('0x4f')]==_0xea826a||_0xaeed06['accountcode']==_0xea826a;});}else{_0xea826a=_0x1f55da['substring'](_0x1f55da[_0x72df('0x4d')]('/')+0x1,_0x1f55da[_0x72df('0x50')]('-'));_0x30521f=this[_0x72df('0x1c')](_0xea826a);}if(_0x30521f){_0x18d7c5['interface']=_['isNil'](_0x30521f[_0x72df('0x24')])?util[_0x72df('0x25')](_0x72df('0x21'),_0x30521f['name']):_0x30521f[_0x72df('0x24')];_0x18d7c5[_0x72df('0x44')]=_0x30521f['name'];_0x18d7c5['accountcode']=_0x30521f[_0x72df('0x20')];RpcMemberReport[_0x72df('0x19')](_0x18d7c5);}};Report[_0x72df('0x10')]['blindTransfer']=function(_0x5a2741){RpcVoiceTransferReport[_0x72df('0x3e')][_0x5a2741[_0x72df('0x51')]]=_0x5a2741;};Report[_0x72df('0x10')][_0x72df('0x1b')]=function(_0xf3b38f){RpcVoiceTransferReport[_0x72df('0x1b')](_0xf3b38f);};module[_0x72df('0x52')]=Report; \ No newline at end of file +var _0x66d4=['connectedlinenum','assigned','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','split','internal','voiceCallReport','destination','exten','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','type','UserId','membername','monitor','monitorFilename','monitors','filename','createdAt','xcally-motion-preview','connectedlinename','xcally-motion-dialer','forEach','voiceDialReport','Local','indexOf','phone','substring','lastIndexOf','transfererlinkedid','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','sync','xdr','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','bind','custom:voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','prototype','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length'];(function(_0x2fe27a,_0x286478){var _0x248e34=function(_0x344fc4){while(--_0x344fc4){_0x2fe27a['push'](_0x2fe27a['shift']());}};_0x248e34(++_0x286478);}(_0x66d4,0xf1));var _0x466d=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0x66d4[_0x3cc9d9];return _0x1a425d;};'use strict';var _=require(_0x466d('0x0'));var moment=require(_0x466d('0x1'));var util=require(_0x466d('0x2'));var config=require(_0x466d('0x3'));var ami=require(_0x466d('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x466d('0x5'));var RpcVoiceDialReport=require(_0x466d('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x466d('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x466d('0x8'));var VoiceQueueReport=require(_0x466d('0x9'));var VoiceCallReport=require(_0x466d('0xa'));var VoiceAgentReport=require(_0x466d('0xb'));var VoiceDialReport=require(_0x466d('0xc'));var UserReport=require('./userReport');function Report(_0x56d7bb){this[_0x466d('0xd')]=_0x56d7bb;this[_0x466d('0xe')]=_0x56d7bb[_0x466d('0xe')];this[_0x466d('0xf')]=_0x56d7bb[_0x466d('0xf')];}Report['prototype'][_0x466d('0x10')]=function(_0x4941a8){var _0x14be64=new VoiceQueueReport(this[_0x466d('0xd')]);var _0x4f1a30=new VoiceAgentReport(this['realtime']);var _0x4c71a7=new VoiceDialReport(this[_0x466d('0xd')]);var _0x438a93=new VoiceCallReport(this[_0x466d('0xd')]);var _0x4fe020=new UserReport(this[_0x466d('0xd')]);if(config[_0x466d('0x11')]&&config['xdr']['disabled']){ami['on'](_0x466d('0x12'),this[_0x466d('0x13')]['bind'](this));ami['on'](_0x466d('0x14'),this['voiceCallReport']['bind'](this));ami['on'](_0x466d('0x15'),this[_0x466d('0x16')][_0x466d('0x17')](this));ami['on'](_0x466d('0x18'),this['voiceDialReport'][_0x466d('0x17')](this));ami['on']('blindtransfer',this[_0x466d('0x19')]['bind'](this));ami['on'](_0x466d('0x1a'),this[_0x466d('0x1b')][_0x466d('0x17')](this));}};Report[_0x466d('0x1c')][_0x466d('0x1d')]=function(_0x158046){var _0x23b855;_0x23b855=_[_0x466d('0x1e')](this[_0x466d('0xe')],function(_0x175768){return _0x175768[_0x466d('0x1f')]==_0x158046||_0x175768[_0x466d('0x20')]==_0x158046;});if(_[_0x466d('0x21')](_0x23b855)){var _0x45919b=_[_0x466d('0x1e')](this[_0x466d('0xf')],function(_0x93351b){return _0x93351b['accountcode']==_0x158046||_0x93351b[_0x466d('0x20')]==_0x158046;});if(_0x45919b){_0x23b855=_[_0x466d('0x1e')](this[_0x466d('0xe')],function(_0x4a5837){return _0x4a5837[_0x466d('0x22')]==util[_0x466d('0x23')](_0x466d('0x24'),_0x45919b[_0x466d('0x20')]);});}}return _0x23b855;};Report[_0x466d('0x1c')][_0x466d('0x13')]=function(_0x4f85bf){for(var _0x40369f=0x0;_0x40369f<_0x4f85bf[_0x466d('0x25')];_0x40369f+=0x1){var _0x361cf3=this[_0x466d('0x1d')](_0x4f85bf[_0x40369f][_0x466d('0x26')]);if(_0x361cf3){_0x4f85bf[_0x40369f][_0x466d('0x1f')]=_0x361cf3['accountcode'];_0x4f85bf[_0x40369f][_0x466d('0x27')]=!![];_0x4f85bf[_0x40369f][_0x466d('0x28')]=_0x361cf3[_0x466d('0x20')];_0x4f85bf[_0x40369f]['interface']=_[_0x466d('0x21')](_0x361cf3[_0x466d('0x22')])?util[_0x466d('0x23')](_0x466d('0x24'),_0x361cf3[_0x466d('0x20')]):_0x361cf3[_0x466d('0x22')];if(_0x4f85bf[_0x40369f]['queuecallercomplete']){_0x4f85bf[_0x40369f][_0x466d('0x29')]=moment()[_0x466d('0x23')](_0x466d('0x2a'));}if(_0x4f85bf[_0x40369f]['queuecallerexit']){_0x4f85bf[_0x40369f][_0x466d('0x2b')]=moment()[_0x466d('0x23')](_0x466d('0x2a'));}RpcMemberReport['voiceQueueReport'](_0x4f85bf[_0x40369f]);}RpcVoiceQueueReport[_0x466d('0x2c')](_0x4f85bf[_0x40369f]);}};function extractCalleridNumber(_0x226c3f){var _0x57b5eb=_0x226c3f[_0x466d('0x2d')](/<(.*?)>/);return _0x57b5eb?_0x57b5eb[0x1]:_0x226c3f;}Report[_0x466d('0x1c')][_0x466d('0x2e')]=function(_0x3d6ade){for(var _0x3b35d7=0x0;_0x3b35d70x0?_0x126e5e:0x0;this[_0x6257('0x14')][_0x403e94[_0x6257('0x69')]][_0x6257('0x57')]=this['voiceQueues'][_0x403e94[_0x6257('0x69')]]['talking']>_[_0x6257('0x6e')](_0x403e94[_0x6257('0x70')])?_['toNumber'](_0x403e94[_0x6257('0x70')]):this['voiceQueues'][_0x403e94[_0x6257('0x69')]]['talking'];this[_0x6257('0x4e')](this[_0x6257('0x14')][_0x403e94['queue']],_0x6257('0x18'));}logger[_0x6257('0x40')](_0x6257('0x71'),util[_0x6257('0x3b')](this[_0x6257('0x14')][_0x403e94[_0x6257('0x69')]],{'showHidden':![],'depth':null}));ami['emit'](_0x6257('0x72'),this[_0x6257('0x14')][_0x403e94[_0x6257('0x69')]]);}}}catch(_0x3a742c){logger[_0x6257('0x3c')](_0x6257('0x68'),util[_0x6257('0x3b')](_0x3a742c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6257('0x1b')]=function(_0x5a9978){logger['debug'](_0x6257('0x73'),util[_0x6257('0x3b')](_0x5a9978,{'showHidden':![],'depth':null}));ami[_0x6257('0x3f')]('custom:queuesummarycomplete',{});this[_0x6257('0x15')]=!![];};VoiceQueueReport[_0x6257('0xb')]['syncQueueCallerJoin']=function(_0x5c8eef){try{if(this[_0x6257('0x63')](_0x5c8eef)){logger[_0x6257('0x40')](_0x6257('0x74'),_0x5c8eef[_0x6257('0x43')],util[_0x6257('0x3b')](_0x5c8eef,{'showHidden':![],'depth':null}));if(_[_0x6257('0x64')](this[_0x6257('0x10')][_0x5c8eef[_0x6257('0x43')]]))this['queueReports'][_0x5c8eef[_0x6257('0x43')]]=[];if(_['isUndefined'](this[_0x6257('0x12')][_0x5c8eef[_0x6257('0x43')]]))this['channels'][_0x5c8eef[_0x6257('0x43')]]={};var _0x3b161d=new QueueReport();_0x3b161d[_0x6257('0x4b')]=_0x5c8eef[_0x6257('0x69')];_0x3b161d[_0x6257('0x4f')]=this[_0x6257('0x14')][_0x3b161d[_0x6257('0x4b')]]&&this[_0x6257('0x14')][_0x3b161d[_0x6257('0x4b')]][_0x6257('0x4f')]?this['voiceQueues'][_0x3b161d[_0x6257('0x4b')]][_0x6257('0x4f')]||_0x6257('0x50'):_0x6257('0x50');_0x3b161d[_0x6257('0x69')]=_0x5c8eef['queue'];_0x3b161d[_0x6257('0x75')]=moment()[_0x6257('0x44')](_0x6257('0x76'));_0x3b161d[_0x6257('0x77')]=_0x5c8eef[_0x6257('0x77')];_0x3b161d[_0x6257('0x78')]=_0x5c8eef[_0x6257('0x78')];_0x3b161d[_0x6257('0x43')]=_0x5c8eef[_0x6257('0x43')];_0x3b161d[_0x6257('0x79')]=this[_0x6257('0x12')][_0x5c8eef[_0x6257('0x43')]][_0x6257('0x79')];logger[_0x6257('0x6b')](_0x6257('0x7a'),_0x3b161d['name'],_0x3b161d[_0x6257('0x4f')]);_[_0x6257('0x7b')](_0x3b161d,_['pick'](_0x5c8eef,_[_0x6257('0x7c')](_0x3b161d)));this['queueReports'][_0x5c8eef[_0x6257('0x43')]]['push'](_0x3b161d);this['channels'][_0x5c8eef[_0x6257('0x43')]]=_0x3b161d;this[_0x6257('0x7d')](_0x3b161d,_0x6257('0x1d'));}}catch(_0x593c8f){logger[_0x6257('0x3c')]('[%s][voiceQueueReport][queuecallerjoin]',_0x5c8eef[_0x6257('0x43')],util[_0x6257('0x3b')](_0x593c8f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6257('0x20')]=function(_0x427728){try{if(this[_0x6257('0x63')](_0x427728)){logger['debug'](_0x6257('0x7e'),_0x427728[_0x6257('0x43')],util[_0x6257('0x3b')](_0x427728,{'showHidden':![],'depth':null}));if(this[_0x6257('0x10')][_0x427728[_0x6257('0x43')]]){var _0x5093a9=_['last'](this[_0x6257('0x10')][_0x427728['uniqueid']]);_0x5093a9[_0x6257('0x7f')]=![];_0x5093a9[_0x6257('0x80')]=null;_0x5093a9['holdtime']=_0x427728[_0x6257('0x81')];_0x5093a9[_0x6257('0x82')]=_0x427728[_0x6257('0x82')];_0x5093a9[_0x6257('0x1f')]=!![];_0x5093a9[_0x6257('0x83')]=moment()['format'](_0x6257('0x76'));_0x5093a9['queuecallerexitreason']=_0x6257('0x84');_0x5093a9[_0x6257('0x85')]=null;logger[_0x6257('0x6b')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x5093a9['name'],_0x5093a9[_0x6257('0x4f')]);this[_0x6257('0x12')][_0x427728['uniqueid']]=_0x5093a9;this[_0x6257('0x48')](_0x5093a9,_0x6257('0x1f'));}}}catch(_0x24e3bb){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x427728['uniqueid'],util[_0x6257('0x3b')](_0x24e3bb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6257('0xb')][_0x6257('0x22')]=function(_0x438f7a){try{if(this[_0x6257('0x63')](_0x438f7a)){logger[_0x6257('0x40')](_0x6257('0x86'),_0x438f7a[_0x6257('0x43')],util[_0x6257('0x3b')](_0x438f7a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x438f7a[_0x6257('0x43')]]){var _0x489c07=_[_0x6257('0x87')](this['queueReports'][_0x438f7a[_0x6257('0x43')]]);_0x489c07['queuecallerleaveAt']=moment()[_0x6257('0x44')](_0x6257('0x76'));_0x489c07[_0x6257('0x88')]=_0x438f7a[_0x6257('0x88')];_0x489c07[_0x6257('0x89')]=_0x438f7a[_0x6257('0x89')];logger[_0x6257('0x6b')](_0x6257('0x8a'),_0x489c07[_0x6257('0x4b')],_0x489c07[_0x6257('0x4f')],_0x438f7a['connectedlinenum'],_0x438f7a['connectedlinename']);this[_0x6257('0x12')][_0x438f7a['uniqueid']]=_0x489c07;this[_0x6257('0x7d')](_0x489c07,_0x6257('0x21'));}}}catch(_0xe15ee9){logger['error'](_0x6257('0x86'),_0x438f7a[_0x6257('0x43')],util[_0x6257('0x3b')](_0xe15ee9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6257('0xb')][_0x6257('0x25')]=function(_0x4a747a){try{if(this[_0x6257('0x63')](_0x4a747a)){logger[_0x6257('0x40')](_0x6257('0x8b'),_0x4a747a[_0x6257('0x43')],util[_0x6257('0x3b')](_0x4a747a,{'showHidden':![],'depth':null}));if(this[_0x6257('0x10')][_0x4a747a[_0x6257('0x43')]]){var _0x240b0a=_[_0x6257('0x87')](this[_0x6257('0x10')][_0x4a747a['uniqueid']]);_0x240b0a[_0x6257('0x7f')]=!![];_0x240b0a[_0x6257('0x4a')]=_0x6257('0x8c');logger[_0x6257('0x6b')](_0x6257('0x8d'),_0x240b0a[_0x6257('0x4b')],_0x240b0a[_0x6257('0x4f')]);}}}catch(_0xcc6364){logger[_0x6257('0x3c')]('[%s][voiceQueueReport][agentconnect]',_0x4a747a[_0x6257('0x43')],util[_0x6257('0x3b')](_0xcc6364,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6257('0xb')][_0x6257('0x23')]=function(_0x4e75e6){try{if(this['isNotNull'](_0x4e75e6)){logger[_0x6257('0x40')]('[%s][voiceQueueReport][agentcomplete]',_0x4e75e6[_0x6257('0x43')],util[_0x6257('0x3b')](_0x4e75e6,{'showHidden':![],'depth':null}));if(this[_0x6257('0x10')][_0x4e75e6['uniqueid']]){var _0x2557ea=_[_0x6257('0x87')](this[_0x6257('0x10')][_0x4e75e6[_0x6257('0x43')]]);_0x2557ea['queuecallerabandon']=![];_0x2557ea[_0x6257('0x83')]=null;_0x2557ea[_0x6257('0x8e')]=!![];_0x2557ea[_0x6257('0x85')]=_0x4e75e6[_0x6257('0x8f')];_0x2557ea['holdtime']=_0x4e75e6[_0x6257('0x81')];_0x2557ea[_0x6257('0x7f')]=!![];_0x2557ea[_0x6257('0x90')]=![];_0x2557ea['queuecallerexitAt']=null;if(!_0x2557ea[_0x6257('0x91')]){if(_0x4e75e6[_0x6257('0x92')]==_0x6257('0x91')){_0x2557ea['queuecallerexitreason']=_0x6257('0x93');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x2557ea[_0x6257('0x4b')],_0x2557ea[_0x6257('0x4f')]);}else{if(_['startsWith'](_0x4e75e6['channel'][_0x6257('0x94')](),_0x6257('0x95'))){if(this[_0x6257('0x10')][_0x4e75e6[_0x6257('0x96')]]){var _0x1c0bdf=_[_0x6257('0x87')](this[_0x6257('0x10')][_0x4e75e6[_0x6257('0x96')]]);_0x1c0bdf[_0x6257('0x7f')]=![];_0x1c0bdf[_0x6257('0x90')]=!![];_0x1c0bdf[_0x6257('0x97')]=moment(_0x2557ea[_0x6257('0x75')])['add'](_0x4e75e6[_0x6257('0x81')],_0x6257('0x98'))[_0x6257('0x44')](_0x6257('0x76'));_0x1c0bdf[_0x6257('0x4a')]=_0x6257('0x99');_0x1c0bdf['transfer']=!![];_0x1c0bdf[_0x6257('0x9a')]='FORWARD';_0x1c0bdf[_0x6257('0x9b')]=_0x4e75e6['destexten'];_0x1c0bdf['transferuniqueid']=_0x4e75e6[_0x6257('0x43')];logger['info'](_0x6257('0x9c'),_0x1c0bdf['name'],_0x1c0bdf['type']);var _0x4aeb66=this[_0x6257('0x10')][_0x4e75e6[_0x6257('0x96')]];this[_0x6257('0x10')][_0x4e75e6[_0x6257('0x96')]]=this[_0x6257('0x10')][_0x4e75e6[_0x6257('0x43')]];this[_0x6257('0x10')][_0x4e75e6['uniqueid']]=_0x4aeb66;}}else{_0x2557ea['queuecallerexitreason']=_0x6257('0x9d')+_0x4e75e6['reason'][_0x6257('0x9e')]();logger[_0x6257('0x6b')](_0x6257('0x9f'),_0x2557ea[_0x6257('0x4b')],_0x2557ea['type'],_0x2557ea[_0x6257('0x4a')]);}}}this[_0x6257('0x12')][_0x4e75e6[_0x6257('0x43')]]=_0x2557ea;this[_0x6257('0x48')](_0x2557ea,_0x6257('0xa0'));}}}catch(_0x4f6066){logger[_0x6257('0x3c')]('[%s][voiceQueueReport][agentcomplete]',_0x4e75e6['uniqueid'],util['inspect'](_0x4f6066,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6257('0xb')]['syncVarSet']=function(_0x428c0e){try{if(this[_0x6257('0x63')](_0x428c0e)){logger[_0x6257('0x40')](_0x6257('0xa1'),_0x428c0e[_0x6257('0x43')],util['inspect'](_0x428c0e,{'showHidden':![],'depth':null}));this[_0x6257('0xa2')](_0x428c0e['uniqueid'],_[_0x6257('0x7c')](_0x428c0e[_0x6257('0xa3')])[0x0],_0x428c0e[_0x6257('0xa4')]);if(this[_0x6257('0x10')][_0x428c0e[_0x6257('0x43')]]){var _0x1ea9c8=_[_0x6257('0x87')](this[_0x6257('0x10')][_0x428c0e[_0x6257('0x43')]]);if(_0x1ea9c8){if(this[_0x6257('0x63')](_0x428c0e[_0x6257('0xa3')])&&this[_0x6257('0x63')](_0x428c0e['variable'][_0x6257('0xa5')])){switch(_0x428c0e[_0x6257('0xa4')]){case'CONTINUE':_0x1ea9c8[_0x6257('0x90')]=![];_0x1ea9c8[_0x6257('0x97')]=null;break;case _0x6257('0xa6'):_0x1ea9c8[_0x6257('0xa7')]=_0x6257('0xa8');_0x1ea9c8[_0x6257('0x90')]=!![];_0x1ea9c8[_0x6257('0x97')]=moment()[_0x6257('0x44')](_0x6257('0x76'));_0x1ea9c8['queuecallerleaveAt']=moment()['format'](_0x6257('0x76'));logger[_0x6257('0x40')](_0x6257('0xa9'),_0x428c0e[_0x6257('0x43')],util[_0x6257('0x3b')](_0x1ea9c8,{'showHidden':![],'depth':null}));ami[_0x6257('0x3f')]('custom:timeout',_0x1ea9c8);break;default:_0x1ea9c8[_0x6257('0x90')]=!![];_0x1ea9c8[_0x6257('0x97')]=moment()[_0x6257('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ea9c8['queuecallerleaveAt']=moment()[_0x6257('0x44')](_0x6257('0x76'));}_0x1ea9c8['queuecallerabandon']=![];_0x1ea9c8[_0x6257('0x83')]=null;_0x1ea9c8[_0x6257('0x4a')]=_0x428c0e[_0x6257('0xa4')];this['channels'][_0x428c0e[_0x6257('0x43')]]=_0x1ea9c8;this[_0x6257('0x48')](_0x1ea9c8,_0x6257('0x26'));}else if(this[_0x6257('0x63')](_0x428c0e[_0x6257('0xa3')])&&this[_0x6257('0x63')](_0x428c0e[_0x6257('0xa3')]['queueposition'])){if(!_0x1ea9c8[_0x6257('0x1f')]){_0x1ea9c8[_0x6257('0x90')]=!![];_0x1ea9c8[_0x6257('0x97')]=moment()[_0x6257('0x44')](_0x6257('0x76'));_0x1ea9c8[_0x6257('0x4a')]='EXITWITHKEY';_0x1ea9c8[_0x6257('0xaa')]=moment()[_0x6257('0x44')](_0x6257('0x76'));this[_0x6257('0x12')][_0x428c0e[_0x6257('0x43')]]=_0x1ea9c8;}}logger[_0x6257('0x6b')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x428c0e[_0x6257('0x43')],_0x1ea9c8[_0x6257('0x4b')],_0x1ea9c8[_0x6257('0x4f')],_[_0x6257('0x7c')](_0x428c0e[_0x6257('0xa3')])[0x0],_0x428c0e[_0x6257('0xa4')]);_0x1ea9c8[_0x6257('0x17')]=this[_0x6257('0x17')][_0x428c0e['uniqueid']];}}}}catch(_0x205e7e){logger['error']('[%s][voiceQueueReport][varset]',_0x428c0e['uniqueid'],util[_0x6257('0x3b')](_0x205e7e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6257('0xb')][_0x6257('0xa2')]=function(_0x2cc875,_0x155c63,_0x3a7f4f){var _0x37ffb2=[_0x6257('0xab'),'rtpaudioqosbridged',_0x6257('0xac'),_0x6257('0xad'),_0x6257('0xae'),'rtpaudioqoslossbridged',_0x6257('0xaf'),_0x6257('0xb0'),_0x6257('0xb1'),_0x6257('0xb2'),_0x6257('0xb3'),_0x6257('0xb4'),_0x6257('0xb5'),'memberdynamic','memberinterface',_0x6257('0xb6'),'membername',_0x6257('0xb7'),_0x6257('0xb8')];if(!_[_0x6257('0x35')](_0x155c63)&&!_['includes'](_0x37ffb2,_0x155c63)){if(_[_0x6257('0x64')](this['variables'][_0x2cc875])){this[_0x6257('0x17')][_0x2cc875]={};}this[_0x6257('0x17')][_0x2cc875][_0x155c63]=_0x3a7f4f;}};VoiceQueueReport['prototype'][_0x6257('0xb9')]=function(_0x27b53c,_0x531a8f,_0x281f62){var _0x2ecaff={};for(var _0x325c27=0x0;_0x325c270x0?_0x39316d:0x0;this['voiceQueues'][_0x42b809['queue']][_0xc01d('0x2e')]=this[_0xc01d('0x13')][_0x42b809['queue']][_0xc01d('0x2e')]>_['toNumber'](_0x42b809['loggedin'])?_[_0xc01d('0x69')](_0x42b809[_0xc01d('0x6a')]):this[_0xc01d('0x13')][_0x42b809[_0xc01d('0x63')]]['talking'];this['emitVoiceQueueSummary'](this[_0xc01d('0x13')][_0x42b809[_0xc01d('0x63')]],_0xc01d('0x60'));}logger[_0xc01d('0x42')](_0xc01d('0x6b'),util['inspect'](this[_0xc01d('0x13')][_0x42b809[_0xc01d('0x63')]],{'showHidden':![],'depth':null}));ami[_0xc01d('0x41')](_0xc01d('0x6c'),this[_0xc01d('0x13')][_0x42b809[_0xc01d('0x63')]]);}}}catch(_0x2442b6){logger[_0xc01d('0x3a')]('[voiceQueueReport][queuesummary]',util[_0xc01d('0x3c')](_0x2442b6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01d('0xb')]['syncQueueSummaryComplete']=function(_0xf28deb){logger[_0xc01d('0x42')](_0xc01d('0x6d'),util[_0xc01d('0x3c')](_0xf28deb,{'showHidden':![],'depth':null}));ami[_0xc01d('0x41')](_0xc01d('0x6e'),{});this['flagQueueSummary']=!![];};VoiceQueueReport[_0xc01d('0xb')][_0xc01d('0x6f')]=function(_0x17f550){try{if(this[_0xc01d('0x5c')](_0x17f550)){logger[_0xc01d('0x42')](_0xc01d('0x70'),_0x17f550[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x17f550,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xc01d('0xf')][_0x17f550[_0xc01d('0x44')]]))this[_0xc01d('0xf')][_0x17f550[_0xc01d('0x44')]]=[];if(_[_0xc01d('0x5d')](this[_0xc01d('0x11')][_0x17f550[_0xc01d('0x44')]]))this[_0xc01d('0x11')][_0x17f550[_0xc01d('0x44')]]={};var _0x35daa7=new QueueReport();_0x35daa7['name']=_0x17f550['queue'];_0x35daa7[_0xc01d('0x4d')]=this[_0xc01d('0x13')][_0x35daa7[_0xc01d('0x4b')]]&&this[_0xc01d('0x13')][_0x35daa7['name']][_0xc01d('0x4d')]?this[_0xc01d('0x13')][_0x35daa7[_0xc01d('0x4b')]][_0xc01d('0x4d')]||_0xc01d('0x4e'):_0xc01d('0x4e');_0x35daa7[_0xc01d('0x63')]=_0x17f550[_0xc01d('0x63')];_0x35daa7['queuecallerjoinAt']=moment()[_0xc01d('0x45')](_0xc01d('0x71'));_0x35daa7[_0xc01d('0x72')]=_0x17f550['position'];_0x35daa7[_0xc01d('0x73')]=_0x17f550[_0xc01d('0x73')];_0x35daa7[_0xc01d('0x44')]=_0x17f550[_0xc01d('0x44')];_0x35daa7[_0xc01d('0x74')]=this[_0xc01d('0x11')][_0x17f550[_0xc01d('0x44')]][_0xc01d('0x74')];logger['info'](_0xc01d('0x75'),_0x35daa7['name'],_0x35daa7[_0xc01d('0x4d')]);_[_0xc01d('0x76')](_0x35daa7,_[_0xc01d('0x77')](_0x17f550,_[_0xc01d('0x78')](_0x35daa7)));this['queueReports'][_0x17f550[_0xc01d('0x44')]][_0xc01d('0x79')](_0x35daa7);this['channels'][_0x17f550[_0xc01d('0x44')]]=_0x35daa7;this[_0xc01d('0x7a')](_0x35daa7,_0xc01d('0x1b'));}}catch(_0x529069){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x17f550[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x529069,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc01d('0x1c')]=function(_0x1817df){try{if(this['isNotNull'](_0x1817df)){logger[_0xc01d('0x42')](_0xc01d('0x7b'),_0x1817df[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x1817df,{'showHidden':![],'depth':null}));if(this[_0xc01d('0xf')][_0x1817df['uniqueid']]){var _0x3483b6=_[_0xc01d('0x7c')](this['queueReports'][_0x1817df['uniqueid']]);_0x3483b6[_0xc01d('0x7d')]=![];_0x3483b6['queuecallercompleteAt']=null;_0x3483b6['holdtime']=_0x1817df[_0xc01d('0x7e')];_0x3483b6[_0xc01d('0x7f')]=_0x1817df[_0xc01d('0x7f')];_0x3483b6[_0xc01d('0x80')]=!![];_0x3483b6['queuecallerabandonAt']=moment()[_0xc01d('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x3483b6[_0xc01d('0x48')]=_0xc01d('0x81');_0x3483b6['lastAssignedTo']=null;logger['info'](_0xc01d('0x82'),_0x3483b6['name'],_0x3483b6[_0xc01d('0x4d')]);this['channels'][_0x1817df[_0xc01d('0x44')]]=_0x3483b6;this['emitVoiceQueueChannelRemove'](_0x3483b6,_0xc01d('0x80'));}}}catch(_0x43dd0){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x1817df[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x43dd0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc01d('0x83')]=function(_0x2393c4){try{if(this[_0xc01d('0x5c')](_0x2393c4)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x2393c4[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x2393c4,{'showHidden':![],'depth':null}));if(this[_0xc01d('0xf')][_0x2393c4[_0xc01d('0x44')]]){var _0x366353=_['last'](this[_0xc01d('0xf')][_0x2393c4[_0xc01d('0x44')]]);_0x366353[_0xc01d('0x84')]=moment()[_0xc01d('0x45')](_0xc01d('0x71'));_0x366353['connectedlinenum']=_0x2393c4['connectedlinenum'];_0x366353['connectedlinename']=_0x2393c4[_0xc01d('0x85')];logger[_0xc01d('0x86')](_0xc01d('0x87'),_0x366353['name'],_0x366353[_0xc01d('0x4d')],_0x2393c4[_0xc01d('0x88')],_0x2393c4[_0xc01d('0x85')]);this[_0xc01d('0x11')][_0x2393c4[_0xc01d('0x44')]]=_0x366353;this[_0xc01d('0x7a')](_0x366353,'queuecallerleave');}}}catch(_0x487c59){logger[_0xc01d('0x3a')](_0xc01d('0x89'),_0x2393c4[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x487c59,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01d('0xb')][_0xc01d('0x8a')]=function(_0x3482c0){try{if(this['isNotNull'](_0x3482c0)){logger[_0xc01d('0x42')](_0xc01d('0x8b'),_0x3482c0[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x3482c0,{'showHidden':![],'depth':null}));if(this[_0xc01d('0xf')][_0x3482c0['uniqueid']]){var _0x660e02=_[_0xc01d('0x7c')](this[_0xc01d('0xf')][_0x3482c0[_0xc01d('0x44')]]);_0x660e02[_0xc01d('0x7d')]=!![];_0x660e02[_0xc01d('0x48')]=_0xc01d('0x8c');logger[_0xc01d('0x86')](_0xc01d('0x8d'),_0x660e02['name'],_0x660e02['type']);}}}catch(_0x590a7e){logger['error'](_0xc01d('0x8b'),_0x3482c0['uniqueid'],util[_0xc01d('0x3c')](_0x590a7e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc01d('0x8e')]=function(_0x1c1c31){try{if(this['isNotNull'](_0x1c1c31)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x1c1c31[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x1c1c31,{'showHidden':![],'depth':null}));if(this[_0xc01d('0xf')][_0x1c1c31[_0xc01d('0x44')]]){var _0x8c8e57=_[_0xc01d('0x7c')](this[_0xc01d('0xf')][_0x1c1c31[_0xc01d('0x44')]]);_0x8c8e57[_0xc01d('0x80')]=![];_0x8c8e57[_0xc01d('0x8f')]=null;_0x8c8e57[_0xc01d('0x90')]=!![];_0x8c8e57['lastAssignedTo']=_0x1c1c31[_0xc01d('0x91')];_0x8c8e57[_0xc01d('0x7e')]=_0x1c1c31['holdtime'];_0x8c8e57[_0xc01d('0x7d')]=!![];_0x8c8e57[_0xc01d('0x92')]=![];_0x8c8e57[_0xc01d('0x93')]=null;if(!_0x8c8e57['transfer']){if(_0x1c1c31[_0xc01d('0x94')]=='transfer'){_0x8c8e57['queuecallerexitreason']='COMPLETED';logger['info'](_0xc01d('0x95'),_0x8c8e57['name'],_0x8c8e57[_0xc01d('0x4d')]);}else{if(_[_0xc01d('0x96')](_0x1c1c31[_0xc01d('0x38')][_0xc01d('0x97')](),_0xc01d('0x98'))){if(this[_0xc01d('0xf')][_0x1c1c31['linkedid']]){var _0x143192=_['last'](this['queueReports'][_0x1c1c31[_0xc01d('0x99')]]);_0x143192[_0xc01d('0x7d')]=![];_0x143192[_0xc01d('0x92')]=!![];_0x143192[_0xc01d('0x93')]=moment(_0x8c8e57['queuecallerjoinAt'])[_0xc01d('0x9a')](_0x1c1c31[_0xc01d('0x7e')],_0xc01d('0x9b'))['format'](_0xc01d('0x71'));_0x143192[_0xc01d('0x48')]=_0xc01d('0x9c');_0x143192[_0xc01d('0x9d')]=!![];_0x143192[_0xc01d('0x9e')]=_0xc01d('0x9f');_0x143192['transferexten']=_0x1c1c31['destexten'];_0x143192[_0xc01d('0xa0')]=_0x1c1c31['uniqueid'];logger[_0xc01d('0x86')](_0xc01d('0xa1'),_0x143192[_0xc01d('0x4b')],_0x143192['type']);var _0x3acf3e=this[_0xc01d('0xf')][_0x1c1c31['linkedid']];this[_0xc01d('0xf')][_0x1c1c31[_0xc01d('0x99')]]=this[_0xc01d('0xf')][_0x1c1c31[_0xc01d('0x44')]];this[_0xc01d('0xf')][_0x1c1c31[_0xc01d('0x44')]]=_0x3acf3e;}}else{_0x8c8e57[_0xc01d('0x48')]=_0xc01d('0xa2')+_0x1c1c31[_0xc01d('0x94')][_0xc01d('0xa3')]();logger[_0xc01d('0x86')](_0xc01d('0xa4'),_0x8c8e57[_0xc01d('0x4b')],_0x8c8e57[_0xc01d('0x4d')],_0x8c8e57[_0xc01d('0x48')]);}}}this['channels'][_0x1c1c31['uniqueid']]=_0x8c8e57;this[_0xc01d('0x3f')](_0x8c8e57,'agentcomplete');}}}catch(_0x397a3e){logger[_0xc01d('0x3a')](_0xc01d('0xa5'),_0x1c1c31['uniqueid'],util[_0xc01d('0x3c')](_0x397a3e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01d('0xb')]['syncVarSet']=function(_0x55c652){try{if(this['isNotNull'](_0x55c652)){logger[_0xc01d('0x42')](_0xc01d('0xa6'),_0x55c652[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x55c652,{'showHidden':![],'depth':null}));this[_0xc01d('0xa7')](_0x55c652['uniqueid'],_[_0xc01d('0x78')](_0x55c652['variable'])[0x0],_0x55c652[_0xc01d('0xa8')]);if(this['queueReports'][_0x55c652[_0xc01d('0x44')]]){var _0x548975=_[_0xc01d('0x7c')](this[_0xc01d('0xf')][_0x55c652[_0xc01d('0x44')]]);if(_0x548975){if(this[_0xc01d('0x5c')](_0x55c652['variable'])&&this[_0xc01d('0x5c')](_0x55c652[_0xc01d('0xa9')]['queuestatus'])){switch(_0x55c652[_0xc01d('0xa8')]){case _0xc01d('0xaa'):_0x548975[_0xc01d('0x92')]=![];_0x548975[_0xc01d('0x93')]=null;break;case _0xc01d('0xab'):_0x548975[_0xc01d('0xac')]=_0xc01d('0xad');_0x548975[_0xc01d('0x92')]=!![];_0x548975[_0xc01d('0x93')]=moment()[_0xc01d('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x548975[_0xc01d('0x84')]=moment()[_0xc01d('0x45')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xc01d('0x42')](_0xc01d('0xae'),_0x55c652[_0xc01d('0x44')],util['inspect'](_0x548975,{'showHidden':![],'depth':null}));ami[_0xc01d('0x41')](_0xc01d('0xaf'),_0x548975);break;default:_0x548975[_0xc01d('0x92')]=!![];_0x548975[_0xc01d('0x93')]=moment()[_0xc01d('0x45')](_0xc01d('0x71'));_0x548975[_0xc01d('0x84')]=moment()[_0xc01d('0x45')](_0xc01d('0x71'));}_0x548975['queuecallerabandon']=![];_0x548975[_0xc01d('0x8f')]=null;_0x548975[_0xc01d('0x48')]=_0x55c652['value'];this['channels'][_0x55c652[_0xc01d('0x44')]]=_0x548975;this[_0xc01d('0x3f')](_0x548975,_0xc01d('0x20'));}else if(this['isNotNull'](_0x55c652[_0xc01d('0xa9')])&&this['isNotNull'](_0x55c652[_0xc01d('0xa9')][_0xc01d('0xb0')])){if(!_0x548975[_0xc01d('0x80')]){_0x548975[_0xc01d('0x92')]=!![];_0x548975[_0xc01d('0x93')]=moment()['format'](_0xc01d('0x71'));_0x548975[_0xc01d('0x48')]=_0xc01d('0xb1');_0x548975[_0xc01d('0x84')]=moment()[_0xc01d('0x45')](_0xc01d('0x71'));this[_0xc01d('0x11')][_0x55c652[_0xc01d('0x44')]]=_0x548975;}}logger[_0xc01d('0x86')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x55c652[_0xc01d('0x44')],_0x548975['name'],_0x548975[_0xc01d('0x4d')],_[_0xc01d('0x78')](_0x55c652[_0xc01d('0xa9')])[0x0],_0x55c652[_0xc01d('0xa8')]);_0x548975[_0xc01d('0x16')]=this[_0xc01d('0x16')][_0x55c652[_0xc01d('0x44')]];}}}}catch(_0x2a63c7){logger[_0xc01d('0x3a')](_0xc01d('0xa6'),_0x55c652[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x2a63c7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01d('0xb')][_0xc01d('0xa7')]=function(_0x59822d,_0x40a297,_0x1d62d9){var _0x5864ee=['rtpaudioqos',_0xc01d('0xb2'),_0xc01d('0xb3'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0xc01d('0xb4'),'rtpaudioqosrtt',_0xc01d('0xb5'),_0xc01d('0xb6'),_0xc01d('0xb7'),_0xc01d('0xb8'),_0xc01d('0xb9'),_0xc01d('0xba'),'memberdynamic','memberinterface','memberlastcall',_0xc01d('0x91'),_0xc01d('0xbb'),_0xc01d('0xbc')];if(!_[_0xc01d('0x35')](_0x40a297)&&!_[_0xc01d('0xbd')](_0x5864ee,_0x40a297)){if(_[_0xc01d('0x5d')](this[_0xc01d('0x16')][_0x59822d])){this[_0xc01d('0x16')][_0x59822d]={};}this[_0xc01d('0x16')][_0x59822d][_0x40a297]=_0x1d62d9;}};VoiceQueueReport[_0xc01d('0xb')]['handleHangup']=function(_0x3d45dc,_0x462eb8,_0x41f92c){var _0x5d9a8b={};for(var _0x18cfef=0x0;_0x18cfef=0x0?moment(_0x5377bd[_0x18df('0x19')])['diff'](_0x5377bd[_0x18df('0x18')],_0x18df('0x10')):null,'data1':_0x18df('0x1a'),'data2':_0x5377bd[_0x18df('0x14')],'data3':_0x5377bd[_0x18df('0x12')],'data4':_0x5377bd['dialstring']||null,'role':_0x18df('0x1b'),'internal':_0x5377bd[_0x18df('0x14')]?_['toNumber'](_0x5377bd[_0x18df('0x14')]):undefined,'uniqueid':_0x5377bd[_0x18df('0x16')]},'log':_0x18df('0x7')});}; \ No newline at end of file +var _0xa919=['format','SIP/%s','TALKING','queuecallerleaveAt','diff','exten','agent','accountcode','voiceDialReport','voice','starttime','endtime','seconds','dialstring','toNumber','uniqueid','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','lastAssignedTo','interface'];(function(_0x4b9429,_0x34e4be){var _0x246de9=function(_0x2f6609){while(--_0x2f6609){_0x4b9429['push'](_0x4b9429['shift']());}};_0x246de9(++_0x34e4be);}(_0xa919,0x1b0));var _0x9a91=function(_0x27fe26,_0x3b8ca7){_0x27fe26=_0x27fe26-0x0;var _0x4fcb35=_0xa919[_0x27fe26];return _0x4fcb35;};'use strict';var moment=require('moment');var _=require(_0x9a91('0x0'));var util=require(_0x9a91('0x1'));var client=require(_0x9a91('0x2'));exports[_0x9a91('0x3')]=function(_0x5b9fcc){var _0x1df82f=_0x5b9fcc[_0x9a91('0x4')]||_0x5b9fcc[_0x9a91('0x5')];return client[_0x9a91('0x6')](_0x9a91('0x7'),{'body':{'channel':'voice','membername':_0x5b9fcc[_0x9a91('0x8')],'interface':_['isNil'](_0x5b9fcc[_0x9a91('0x9')])?util[_0x9a91('0xa')](_0x9a91('0xb'),_0x5b9fcc[_0x9a91('0x8')]):_0x5b9fcc['interface'],'type':_0x9a91('0xc'),'enterAt':_0x5b9fcc[_0x9a91('0xd')],'exitAt':_0x1df82f,'duration':moment(_0x1df82f)[_0x9a91('0xe')](_0x5b9fcc[_0x9a91('0xd')],'seconds'),'data1':'inbound','data2':_0x5b9fcc['calleridnum'],'data3':_0x5b9fcc[_0x9a91('0xf')],'data4':null,'data5':_0x5b9fcc['queue'],'role':_0x9a91('0x10'),'internal':_0x5b9fcc[_0x9a91('0x11')]?_['toNumber'](_0x5b9fcc['accountcode']):undefined,'uniqueid':_0x5b9fcc['uniqueid']},'log':_0x9a91('0x7')});};exports[_0x9a91('0x12')]=function(_0x174853){return client[_0x9a91('0x6')](_0x9a91('0x7'),{'body':{'channel':_0x9a91('0x13'),'membername':_0x174853['membername'],'interface':_0x174853[_0x9a91('0x9')],'type':_0x9a91('0xc'),'enterAt':_0x174853[_0x9a91('0x14')],'exitAt':_0x174853[_0x9a91('0x15')],'duration':moment(_0x174853['endtime'])[_0x9a91('0xe')](_0x174853[_0x9a91('0x14')],_0x9a91('0x16'))>=0x0?moment(_0x174853[_0x9a91('0x15')])['diff'](_0x174853['starttime'],_0x9a91('0x16')):null,'data1':'outbound','data2':_0x174853[_0x9a91('0x11')],'data3':_0x174853['exten'],'data4':_0x174853[_0x9a91('0x17')]||null,'role':'agent','internal':_0x174853[_0x9a91('0x11')]?_[_0x9a91('0x18')](_0x174853[_0x9a91('0x11')]):undefined,'uniqueid':_0x174853[_0x9a91('0x19')]},'log':_0x9a91('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index c2bcf57..6e76af4 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 _0x7e33=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','stopRecordingOnTransfer'];(function(_0xc91614,_0x4f3a98){var _0x4bf80e=function(_0x4e9c37){while(--_0x4e9c37){_0xc91614['push'](_0xc91614['shift']());}};_0x4bf80e(++_0x4f3a98);}(_0x7e33,0x7a));var _0x37e3=function(_0x22740a,_0x47bae1){_0x22740a=_0x22740a-0x0;var _0x13815b=_0x7e33[_0x22740a];return _0x13815b;};'use strict';var client=require(_0x37e3('0x0'));exports[_0x37e3('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x37e3('0x2'),_0x37e3('0x3')]},'log':_0x37e3('0x4')});}; \ No newline at end of file +var _0xcac2=['Request','stopRecordingOnTransfer','previewRecallmeReminderInterval','../client','getSettings'];(function(_0x42c6f1,_0x338d7b){var _0x3c7398=function(_0x151494){while(--_0x151494){_0x42c6f1['push'](_0x42c6f1['shift']());}};_0x3c7398(++_0x338d7b);}(_0xcac2,0x1e8));var _0x2cac=function(_0x4ea693,_0xdb632f){_0x4ea693=_0x4ea693-0x0;var _0x46730b=_0xcac2[_0x4ea693];return _0x46730b;};'use strict';var client=require(_0x2cac('0x0'));exports[_0x2cac('0x1')]=function(){return client[_0x2cac('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2cac('0x3'),_0x2cac('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index d93cb6c..34dd996 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 _0x51ed=['Request','GetTemplate','name','html','../client'];(function(_0x3f217c,_0x15d504){var _0x12825a=function(_0x11eaa5){while(--_0x11eaa5){_0x3f217c['push'](_0x3f217c['shift']());}};_0x12825a(++_0x15d504);}(_0x51ed,0x1a3));var _0xd51e=function(_0x11239b,_0xdfd2b0){_0x11239b=_0x11239b-0x0;var _0x1d51c4=_0x51ed[_0x11239b];return _0x1d51c4;};'use strict';var client=require(_0xd51e('0x0'));exports['getTemplates']=function(_0x534fdd){return function(_0x2f63e8){return client[_0xd51e('0x1')](_0xd51e('0x2'),{'options':{'raw':!![],'attributes':['id',_0xd51e('0x3'),_0xd51e('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x6f62=['../client','getTemplates','Request','GetTemplate','name','html'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x6f62,0x12c));var _0x26f6=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x6f62[_0x5a3cf0];return _0x5a64ee;};'use strict';var client=require(_0x26f6('0x0'));exports[_0x26f6('0x1')]=function(_0x59041a){return function(_0x3bd771){return client[_0x26f6('0x2')](_0x26f6('0x3'),{'options':{'raw':!![],'attributes':['id',_0x26f6('0x4'),_0x26f6('0x5')]},'log':_0x26f6('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index c4032ea..2380ca7 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 _0x8378=['Condition','AnyConditions','Action','Actions','data1','data3','data4','data5','data6','data7','Request','GetTrigger','status','field','operator','value'];(function(_0x36f2b2,_0x4dea08){var _0x4a0f99=function(_0x5442b9){while(--_0x5442b9){_0x36f2b2['push'](_0x36f2b2['shift']());}};_0x4a0f99(++_0x4dea08);}(_0x8378,0x9a));var _0x8837=function(_0x2c7e55,_0x4acf73){_0x2c7e55=_0x2c7e55-0x0;var _0x4ebccc=_0x8378[_0x2c7e55];return _0x4ebccc;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x2c6107){return function(_0x4110b3){return client[_0x8837('0x0')](_0x8837('0x1'),{'options':{'raw':![],'attributes':['id','name','channel',_0x8837('0x2')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0x8837('0x3'),_0x8837('0x4'),_0x8837('0x5')]},{'model':_0x8837('0x6'),'as':_0x8837('0x7'),'attributes':['id',_0x8837('0x3'),_0x8837('0x4'),_0x8837('0x5')]},{'model':_0x8837('0x8'),'as':_0x8837('0x9'),'attributes':['id','action',_0x8837('0xa'),'data2',_0x8837('0xb'),_0x8837('0xc'),_0x8837('0xd'),_0x8837('0xe'),_0x8837('0xf')]}]},'log':_0x8837('0x1')});};}; \ No newline at end of file +var _0xe8ea=['operator','value','AnyConditions','Action','Actions','action','data1','data2','data4','data6','../client','Request','GetTrigger','name','channel','status','Condition','AllConditions','field'];(function(_0x4b85fe,_0x5d621b){var _0x2ecab7=function(_0x4c6c21){while(--_0x4c6c21){_0x4b85fe['push'](_0x4b85fe['shift']());}};_0x2ecab7(++_0x5d621b);}(_0xe8ea,0xa2));var _0xae8e=function(_0x465655,_0x4eb676){_0x465655=_0x465655-0x0;var _0x4fa2a4=_0xe8ea[_0x465655];return _0x4fa2a4;};'use strict';var client=require(_0xae8e('0x0'));exports['getTriggers']=function(_0xe42990){return function(_0x1bdd9b){return client[_0xae8e('0x1')](_0xae8e('0x2'),{'options':{'raw':![],'attributes':['id',_0xae8e('0x3'),_0xae8e('0x4'),_0xae8e('0x5')],'include':[{'model':_0xae8e('0x6'),'as':_0xae8e('0x7'),'attributes':['id',_0xae8e('0x8'),_0xae8e('0x9'),_0xae8e('0xa')]},{'model':_0xae8e('0x6'),'as':_0xae8e('0xb'),'attributes':['id',_0xae8e('0x8'),_0xae8e('0x9'),_0xae8e('0xa')]},{'model':_0xae8e('0xc'),'as':_0xae8e('0xd'),'attributes':['id',_0xae8e('0xe'),_0xae8e('0xf'),_0xae8e('0x10'),'data3',_0xae8e('0x11'),'data5',_0xae8e('0x12'),'data7']}]},'log':_0xae8e('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 0f3b2ec..c3d52b4 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 _0x1353=['getTrunks','Request','GetTrunk','registry','defaultuser','../client'];(function(_0x1d897a,_0x5eaf31){var _0x106376=function(_0x1ba8f9){while(--_0x1ba8f9){_0x1d897a['push'](_0x1d897a['shift']());}};_0x106376(++_0x5eaf31);}(_0x1353,0xb3));var _0x3135=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x1353[_0x164eca];return _0x2ce562;};'use strict';var client=require(_0x3135('0x0'));exports[_0x3135('0x1')]=function(_0x40566e){return function(_0xc37eec){return client[_0x3135('0x2')](_0x3135('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x3135('0x4'),_0x3135('0x5')]},'log':_0x3135('0x3')});};}; \ No newline at end of file +var _0x64e1=['defaultuser','../client','getTrunks'];(function(_0x3a2a78,_0x2daec8){var _0x19a353=function(_0x4bf730){while(--_0x4bf730){_0x3a2a78['push'](_0x3a2a78['shift']());}};_0x19a353(++_0x2daec8);}(_0x64e1,0x9a));var _0x164e=function(_0x128576,_0x12e43b){_0x128576=_0x128576-0x0;var _0x194603=_0x64e1[_0x128576];return _0x194603;};'use strict';var client=require(_0x164e('0x0'));exports[_0x164e('0x1')]=function(_0x1c3895){return function(_0x2d17b1){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0x164e('0x2')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index f1741c5..7caff01 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe706,0xa3));var _0x6e70=function(_0x2d4340,_0x14bd7f){_0x2d4340=_0x2d4340-0x0;var _0x5a2e9e=_0xe706[_0x2d4340];return _0x5a2e9e;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x2535ec,_0x47ec48){var _0x23cede=function(_0x59188e){while(--_0x59188e){_0x2535ec['push'](_0x2535ec['shift']());}};_0x23cede(++_0x47ec48);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index f486631..ea3eb95 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 _0xfdf0=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0xfdf0,0x176));var _0x0fdf=function(_0x3b632f,_0x453380){_0x3b632f=_0x3b632f-0x0;var _0x10e788=_0xfdf0[_0x3b632f];return _0x10e788;};'use strict';var client=require(_0x0fdf('0x0'));exports[_0x0fdf('0x1')]=function(_0x1cbba6){return client[_0x0fdf('0x2')](_0x0fdf('0x3'),{'body':_0x1cbba6,'log':_0x0fdf('0x3')});};exports[_0x0fdf('0x4')]=function(_0x3483c6,_0x57148e,_0x4e8f88){return client[_0x0fdf('0x2')](_0x0fdf('0x5'),{'body':_0x3483c6,'options':{'where':{'uniqueid':_0x57148e,'interface':_0x4e8f88,'agentcomplete':!![]}},'log':_0x0fdf('0x5')});}; \ No newline at end of file +var _0x1961=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x5829b0,_0x285159){var _0x5eb18c=function(_0x51127b){while(--_0x51127b){_0x5829b0['push'](_0x5829b0['shift']());}};_0x5eb18c(++_0x285159);}(_0x1961,0x7f));var _0x1196=function(_0x3ff33f,_0x3404f9){_0x3ff33f=_0x3ff33f-0x0;var _0x50e3d1=_0x1961[_0x3ff33f];return _0x50e3d1;};'use strict';var client=require(_0x1196('0x0'));exports[_0x1196('0x1')]=function(_0x3cbd94){return client[_0x1196('0x2')](_0x1196('0x3'),{'body':_0x3cbd94,'log':'CreateVoiceAgentReport'});};exports[_0x1196('0x4')]=function(_0xa7832c,_0x509980,_0x34116d){return client['Request']('UpdateVoiceAgentReport',{'body':_0xa7832c,'options':{'where':{'uniqueid':_0x509980,'interface':_0x34116d,'agentcomplete':!![]}},'log':_0x1196('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 2c446c7..b45c850 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 _0x732d=['context','DOCUMENTATION','getVoiceCallReports','Request','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','CreateVoiceCallReport','merge'];(function(_0x32b37e,_0x191506){var _0x5083df=function(_0x2cdce8){while(--_0x2cdce8){_0x32b37e['push'](_0x32b37e['shift']());}};_0x5083df(++_0x191506);}(_0x732d,0x119));var _0xd732=function(_0x3d7d11,_0x1e1ab6){_0x3d7d11=_0x3d7d11-0x0;var _0x2481fa=_0x732d[_0x3d7d11];return _0x2481fa;};'use strict';var moment=require(_0xd732('0x0'));var util=require(_0xd732('0x1'));var _=require(_0xd732('0x2'));var client=require(_0xd732('0x3'));exports[_0xd732('0x4')]=function(_0x5a77a9){return client['Request'](_0xd732('0x5'),{'body':_[_0xd732('0x6')](_0x5a77a9,{'source':_0x5a77a9['calleridnum'],'destinationcontext':_0x5a77a9[_0xd732('0x7')],'callerid':_0x5a77a9['callerid'],'amaflags':_0xd732('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0xd732('0x9')]=function(){return function(){return client[_0xd732('0xa')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xd732('0xb')],'createdAt':{'$between':[moment()['startOf']('day')['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xd732('0xc'))[_0xd732('0xd')](_0xd732('0xe'))]}},'attributes':['type','disposition',_0xd732('0xf'),_0xd732('0x10')]},'log':_0xd732('0x11')});};}; \ No newline at end of file +var _0xb8f1=['outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport'];(function(_0x1ef6fa,_0x4fd8c6){var _0x54977d=function(_0x153699){while(--_0x153699){_0x1ef6fa['push'](_0x1ef6fa['shift']());}};_0x54977d(++_0x4fd8c6);}(_0xb8f1,0x180));var _0x1b8f=function(_0xc1676d,_0x2f2b98){_0xc1676d=_0xc1676d-0x0;var _0x2e9c2d=_0xb8f1[_0xc1676d];return _0x2e9c2d;};'use strict';var moment=require('moment');var util=require(_0x1b8f('0x0'));var _=require(_0x1b8f('0x1'));var client=require(_0x1b8f('0x2'));exports[_0x1b8f('0x3')]=function(_0x26d9ad){return client[_0x1b8f('0x4')](_0x1b8f('0x5'),{'body':_[_0x1b8f('0x6')](_0x26d9ad,{'source':_0x26d9ad[_0x1b8f('0x7')],'destinationcontext':_0x26d9ad[_0x1b8f('0x8')],'callerid':_0x26d9ad[_0x1b8f('0x9')],'amaflags':'DOCUMENTATION'}),'log':_0x1b8f('0x5')});};exports[_0x1b8f('0xa')]=function(){return function(){return client[_0x1b8f('0x4')](_0x1b8f('0xb'),{'options':{'where':{'type':[_0x1b8f('0xc')],'createdAt':{'$between':[moment()[_0x1b8f('0xd')](_0x1b8f('0xe'))[_0x1b8f('0xf')](_0x1b8f('0x10')),moment()[_0x1b8f('0x11')](_0x1b8f('0xe'))[_0x1b8f('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x1b8f('0x12'),'disposition',_0x1b8f('0x13'),_0x1b8f('0x14')]},'log':_0x1b8f('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 18539e3..45afa9e 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 _0x44c6=['create','Request','CreateVoiceDialReport','../client'];(function(_0xbd2b8f,_0x1abf54){var _0x151694=function(_0x1b60d3){while(--_0x1b60d3){_0xbd2b8f['push'](_0xbd2b8f['shift']());}};_0x151694(++_0x1abf54);}(_0x44c6,0x6b));var _0x644c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x44c6[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x644c('0x0'));exports[_0x644c('0x1')]=function(_0x4f9f28){return client[_0x644c('0x2')](_0x644c('0x3'),{'body':_0x4f9f28,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x3470=['../client','create','CreateVoiceDialReport'];(function(_0x5bb4e8,_0x44b756){var _0x2a86f2=function(_0x279ab2){while(--_0x279ab2){_0x5bb4e8['push'](_0x5bb4e8['shift']());}};_0x2a86f2(++_0x44b756);}(_0x3470,0x180));var _0x0347=function(_0x4f6f97,_0x1de0b6){_0x4f6f97=_0x4f6f97-0x0;var _0x44b012=_0x3470[_0x4f6f97];return _0x44b012;};'use strict';var client=require(_0x0347('0x0'));exports[_0x0347('0x1')]=function(_0x5cb6d3){return client['Request'](_0x0347('0x2'),{'body':_0x5cb6d3,'log':_0x0347('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 10af251..1a4ec8e 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 _0x152f=['getVoiceExtensions','Request','GetVoiceExtension','exten','../client'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x152f,0x144));var _0xf152=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x152f[_0x2160a9];return _0xa88cf7;};'use strict';var client=require(_0xf152('0x0'));exports[_0xf152('0x1')]=function(){return function(){return client[_0xf152('0x2')](_0xf152('0x3'),{'options':{'raw':!![],'attributes':['id',_0xf152('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xf152('0x1')});};}; \ No newline at end of file +var _0x0e9f=['getVoiceExtensions','exten','../client'];(function(_0x2524f3,_0x13f76c){var _0x16d192=function(_0x17e7d5){while(--_0x17e7d5){_0x2524f3['push'](_0x2524f3['shift']());}};_0x16d192(++_0x13f76c);}(_0x0e9f,0x116));var _0xf0e9=function(_0xf5e995,_0x38d3d9){_0xf5e995=_0xf5e995-0x0;var _0x57bc34=_0x0e9f[_0xf5e995];return _0x57bc34;};'use strict';var client=require(_0xf0e9('0x0'));exports[_0xf0e9('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xf0e9('0x2'),'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 6307499..aebedfa 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 _0x8b55=['dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','callerid','Pause','mandatoryDispositionPause','Trunk','active','Interval','Intervals','../client','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords'];(function(_0xe7cd0e,_0x4b1667){var _0x1b5ef4=function(_0x2c80b7){while(--_0x2c80b7){_0xe7cd0e['push'](_0xe7cd0e['shift']());}};_0x1b5ef4(++_0x4b1667);}(_0x8b55,0x195));var _0x58b5=function(_0x281e15,_0x42294c){_0x281e15=_0x281e15-0x0;var _0x23ea04=_0x8b55[_0x281e15];return _0x23ea04;};'use strict';var client=require(_0x58b5('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x58b5('0x1')](_0x58b5('0x2'),{'options':{'raw':![],'attributes':['id',_0x58b5('0x3'),'acw',_0x58b5('0x4'),_0x58b5('0x5'),_0x58b5('0x6'),'type',_0x58b5('0x7'),_0x58b5('0x8'),_0x58b5('0x9'),_0x58b5('0xa'),_0x58b5('0xb'),_0x58b5('0xc'),_0x58b5('0xd'),'dialPredictiveInterval',_0x58b5('0xe'),_0x58b5('0xf'),_0x58b5('0x10'),'dialQueueOptions',_0x58b5('0x11'),_0x58b5('0x12'),_0x58b5('0x13'),_0x58b5('0x14'),_0x58b5('0x15'),_0x58b5('0x16'),_0x58b5('0x17'),_0x58b5('0x18'),_0x58b5('0x19'),_0x58b5('0x1a'),_0x58b5('0x1b'),_0x58b5('0x1c'),_0x58b5('0x1d'),'dialAMDActive',_0x58b5('0x1e'),_0x58b5('0x1f'),_0x58b5('0x20'),_0x58b5('0x21'),_0x58b5('0x22'),'dialAMDBetweenWordsSilence',_0x58b5('0x23'),'dialAMDSilenceThreshold',_0x58b5('0x24'),'timeout',_0x58b5('0x25'),'dialRecallInQueue',_0x58b5('0x26'),_0x58b5('0x27'),_0x58b5('0x28'),_0x58b5('0x29'),_0x58b5('0x6'),_0x58b5('0x2a'),'dialRandomLastDigitCallerIdNumber',_0x58b5('0x2b'),_0x58b5('0x2c'),_0x58b5('0x2d'),'dialDropMaxRetry',_0x58b5('0x2e'),_0x58b5('0x2f'),'dialAbandonedRetryFrequency',_0x58b5('0x30'),_0x58b5('0x31'),_0x58b5('0x32'),_0x58b5('0x33'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x58b5('0x34'),_0x58b5('0x35'),_0x58b5('0x36'),_0x58b5('0x37')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id','name',_0x58b5('0x38'),'active']},{'model':_0x58b5('0x39'),'as':_0x58b5('0x3a'),'attributes':['id',_0x58b5('0x3')]},{'model':_0x58b5('0x3b'),'as':'TrunkBackup','attributes':['id',_0x58b5('0x3'),_0x58b5('0x38'),_0x58b5('0x3c')]},{'model':_0x58b5('0x3d'),'as':'Interval','attributes':['id',_0x58b5('0x3')],'include':[{'model':_0x58b5('0x3d'),'as':_0x58b5('0x3e'),'attributes':['id',_0x58b5('0x3'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0xedc2=['dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','callAdditionalPhoneAfterMin','Trunk','callerid','active','Pause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','name','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence'];(function(_0x2f350e,_0x141f41){var _0x51c0cb=function(_0x323f5f){while(--_0x323f5f){_0x2f350e['push'](_0x2f350e['shift']());}};_0x51c0cb(++_0x141f41);}(_0xedc2,0x1ad));var _0x2edc=function(_0x499068,_0x59e8ef){_0x499068=_0x499068-0x0;var _0x2bae7b=_0xedc2[_0x499068];return _0x2bae7b;};'use strict';var client=require(_0x2edc('0x0'));exports[_0x2edc('0x1')]=function(){return function(){return client[_0x2edc('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x2edc('0x3'),'acw',_0x2edc('0x4'),_0x2edc('0x5'),_0x2edc('0x6'),_0x2edc('0x7'),'dialActive',_0x2edc('0x8'),_0x2edc('0x9'),_0x2edc('0xa'),_0x2edc('0xb'),_0x2edc('0xc'),_0x2edc('0xd'),_0x2edc('0xe'),_0x2edc('0xf'),_0x2edc('0x10'),_0x2edc('0x11'),_0x2edc('0x12'),_0x2edc('0x13'),_0x2edc('0x14'),'dialCongestionMaxRetry',_0x2edc('0x15'),_0x2edc('0x16'),_0x2edc('0x17'),'dialNoAnswerMaxRetry',_0x2edc('0x18'),'dialGlobalMaxRetry',_0x2edc('0x19'),_0x2edc('0x1a'),_0x2edc('0x1b'),_0x2edc('0x1c'),_0x2edc('0x1d'),_0x2edc('0x1e'),_0x2edc('0x1f'),_0x2edc('0x20'),_0x2edc('0x21'),_0x2edc('0x22'),_0x2edc('0x23'),_0x2edc('0x24'),_0x2edc('0x25'),_0x2edc('0x26'),_0x2edc('0x27'),_0x2edc('0x28'),'dialRecallInQueue',_0x2edc('0x29'),_0x2edc('0x2a'),_0x2edc('0x2b'),_0x2edc('0x2c'),'monitor_format',_0x2edc('0x2d'),_0x2edc('0x2e'),'dialCutDigit',_0x2edc('0x2f'),_0x2edc('0x30'),_0x2edc('0x31'),'dialDropRetryFrequency',_0x2edc('0x32'),'dialAbandonedRetryFrequency',_0x2edc('0x33'),_0x2edc('0x34'),_0x2edc('0x35'),_0x2edc('0x36'),_0x2edc('0x37'),_0x2edc('0x38'),'dialPredictiveIntervalMinThreshold',_0x2edc('0x39'),'dialPreviewRecallmeReminder',_0x2edc('0x3a')],'include':[{'model':_0x2edc('0x3b'),'as':'Trunk','attributes':['id',_0x2edc('0x3'),_0x2edc('0x3c'),_0x2edc('0x3d')]},{'model':_0x2edc('0x3e'),'as':'mandatoryDispositionPause','attributes':['id',_0x2edc('0x3')]},{'model':_0x2edc('0x3b'),'as':_0x2edc('0x3f'),'attributes':['id',_0x2edc('0x3'),'callerid',_0x2edc('0x3d')]},{'model':_0x2edc('0x40'),'as':_0x2edc('0x40'),'attributes':['id',_0x2edc('0x3')],'include':[{'model':_0x2edc('0x40'),'as':'Intervals','attributes':['id',_0x2edc('0x3'),_0x2edc('0x41')]}]}]},'log':_0x2edc('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 33a5267..9fc362d 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(_0xb001f0,_0x831652){var _0x403b49=function(_0x4dfdf2){while(--_0x4dfdf2){_0xb001f0['push'](_0xb001f0['shift']());}};_0x403b49(++_0x831652);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x1c7edc,_0x4e8cfa){var _0x49c30b=function(_0x389b13){while(--_0x389b13){_0x1c7edc['push'](_0x1c7edc['shift']());}};_0x49c30b(++_0x4e8cfa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 46cfb17..001acd8 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 _0xbcb0=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client'];(function(_0x27e6b2,_0x7769ac){var _0x5154d4=function(_0xf3c23c){while(--_0xf3c23c){_0x27e6b2['push'](_0x27e6b2['shift']());}};_0x5154d4(++_0x7769ac);}(_0xbcb0,0x1f1));var _0x0bcb=function(_0x382610,_0x101342){_0x382610=_0x382610-0x0;var _0x422af9=_0xbcb0[_0x382610];return _0x422af9;};'use strict';var client=require(_0x0bcb('0x0'));exports['getVoiceQueueRtPauses']=function(_0x531413){return function(){return client['Request'](_0x0bcb('0x1'),{'options':{'where':{'VoiceQueueId':_0x531413,'paused':!![]},'raw':!![]},'log':_0x0bcb('0x2')});};}; \ No newline at end of file +var _0x6c73=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x51d129,_0x175d7d){var _0x44c377=function(_0x5ee454){while(--_0x5ee454){_0x51d129['push'](_0x51d129['shift']());}};_0x44c377(++_0x175d7d);}(_0x6c73,0x1c1));var _0x36c7=function(_0x58f29c,_0x551df2){_0x58f29c=_0x58f29c-0x0;var _0x5266ed=_0x6c73[_0x58f29c];return _0x5266ed;};'use strict';var client=require(_0x36c7('0x0'));exports[_0x36c7('0x1')]=function(_0x2e277d){return function(){return client[_0x36c7('0x2')](_0x36c7('0x3'),{'options':{'where':{'VoiceQueueId':_0x2e277d,'paused':!![]},'raw':!![]},'log':_0x36c7('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 241f5d3..74df2b3 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(_0x1a860a,_0x39be84){var _0x9df661=function(_0x51ae01){while(--_0x51ae01){_0x1a860a['push'](_0x1a860a['shift']());}};_0x9df661(++_0x39be84);}(_0x7a54,0x106));var _0x47a5=function(_0x92bcb2,_0x19070b){_0x92bcb2=_0x92bcb2-0x0;var _0x386fa9=_0x7a54[_0x92bcb2];return _0x386fa9;};'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(_0x476280,_0x35ab2){var _0x47cfad=function(_0xe3b207){while(--_0xe3b207){_0x476280['push'](_0x476280['shift']());}};_0x47cfad(++_0x35ab2);}(_0x7a54,0x106));var _0x47a5=function(_0x5fcf59,_0x3642a2){_0x5fcf59=_0x5fcf59-0x0;var _0x1cbff2=_0x7a54[_0x5fcf59];return _0x1cbff2;};'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 7931ee4..a0dfab6 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 _0x49db=['origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum'];(function(_0x13f839,_0x2689f1){var _0x320832=function(_0x2ed104){while(--_0x2ed104){_0x13f839['push'](_0x13f839['shift']());}};_0x320832(++_0x2689f1);}(_0x49db,0x160));var _0xb49d=function(_0x6343c0,_0x315c24){_0x6343c0=_0x6343c0-0x0;var _0x320e0d=_0x49db[_0x6343c0];return _0x320e0d;};'use strict';var client=require(_0xb49d('0x0'));exports['transfers']={};exports[_0xb49d('0x1')]=function(_0x330e70){return client[_0xb49d('0x2')](_0xb49d('0x3'),{'body':{'result':_0x330e70[_0xb49d('0x4')],'transfererchannel':_0x330e70[_0xb49d('0x5')],'transferercalleridnum':_0x330e70[_0xb49d('0x6')],'transferercalleridname':_0x330e70[_0xb49d('0x7')],'transfererconnectedlinenum':_0x330e70['transfererconnectedlinenum'],'transfererconnectedlinename':_0x330e70[_0xb49d('0x8')],'transfereraccountcode':_0x330e70[_0xb49d('0x9')],'transferercontext':_0x330e70[_0xb49d('0xa')],'transfererexten':_0x330e70['transfererexten'],'transfererlinkedid':_0x330e70[_0xb49d('0xb')],'transfereechannel':_0x330e70[_0xb49d('0xc')],'transfereecalleridnum':_0x330e70['transfereecalleridnum'],'transfereecalleridname':_0x330e70[_0xb49d('0xd')],'transfereeconnectedlinenum':_0x330e70[_0xb49d('0xe')],'transfereeconnectedlinename':_0x330e70[_0xb49d('0xf')],'transfereeaccountcode':_0x330e70[_0xb49d('0x10')],'transfereecontext':_0x330e70[_0xb49d('0x11')],'transfereeexten':_0x330e70[_0xb49d('0x12')],'transfereelinkedid':_0x330e70['transfereelinkedid'],'isexternal':_0x330e70[_0xb49d('0x13')],'context':_0x330e70[_0xb49d('0x14')],'extension':_0x330e70[_0xb49d('0x15')],'type':_0xb49d('0x16')},'log':_0xb49d('0x3')});};exports[_0xb49d('0x17')]=function(_0x306a49){return client[_0xb49d('0x2')](_0xb49d('0x3'),{'body':{'result':_0x306a49[_0xb49d('0x4')],'transfererchannel':_0x306a49[_0xb49d('0x18')],'transferercalleridnum':_0x306a49[_0xb49d('0x19')],'transferercalleridname':_0x306a49[_0xb49d('0x1a')],'transfererconnectedlinenum':_0x306a49[_0xb49d('0x1b')],'transfererconnectedlinename':_0x306a49[_0xb49d('0x1c')],'transfereraccountcode':_0x306a49[_0xb49d('0x1d')],'transferercontext':_0x306a49[_0xb49d('0x1e')],'transfererexten':_0x306a49[_0xb49d('0x1f')],'transfererlinkedid':_0x306a49[_0xb49d('0x20')],'transfereechannel':_0x306a49[_0xb49d('0x21')],'transfereecalleridnum':_0x306a49['transfertargetcalleridnum'],'transfereecalleridname':_0x306a49[_0xb49d('0x22')],'transfereeconnectedlinenum':_0x306a49[_0xb49d('0x23')],'transfereeconnectedlinename':_0x306a49[_0xb49d('0x24')],'transfereeaccountcode':_0x306a49[_0xb49d('0x25')],'transfereecontext':_0x306a49[_0xb49d('0x26')],'transfereeexten':_0x306a49['transfertargetexten'],'transfereelinkedid':_0x306a49[_0xb49d('0x27')],'isexternal':_0x306a49['isexternal'],'context':_0x306a49[_0xb49d('0x28')],'extension':_0x306a49[_0xb49d('0x29')],'type':'attended'},'log':_0xb49d('0x3')});}; \ No newline at end of file +var _0x9cf1=['origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','context','result','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename'];(function(_0x215bf3,_0x4a1e0a){var _0x5aa0b5=function(_0x41c6a3){while(--_0x41c6a3){_0x215bf3['push'](_0x215bf3['shift']());}};_0x5aa0b5(++_0x4a1e0a);}(_0x9cf1,0xdd));var _0x19cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9cf1[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x19cf('0x0'));exports[_0x19cf('0x1')]={};exports[_0x19cf('0x2')]=function(_0x5a80ee){return client[_0x19cf('0x3')](_0x19cf('0x4'),{'body':{'result':_0x5a80ee['result'],'transfererchannel':_0x5a80ee['transfererchannel'],'transferercalleridnum':_0x5a80ee[_0x19cf('0x5')],'transferercalleridname':_0x5a80ee[_0x19cf('0x6')],'transfererconnectedlinenum':_0x5a80ee['transfererconnectedlinenum'],'transfererconnectedlinename':_0x5a80ee[_0x19cf('0x7')],'transfereraccountcode':_0x5a80ee[_0x19cf('0x8')],'transferercontext':_0x5a80ee[_0x19cf('0x9')],'transfererexten':_0x5a80ee['transfererexten'],'transfererlinkedid':_0x5a80ee[_0x19cf('0xa')],'transfereechannel':_0x5a80ee[_0x19cf('0xb')],'transfereecalleridnum':_0x5a80ee[_0x19cf('0xc')],'transfereecalleridname':_0x5a80ee[_0x19cf('0xd')],'transfereeconnectedlinenum':_0x5a80ee[_0x19cf('0xe')],'transfereeconnectedlinename':_0x5a80ee[_0x19cf('0xf')],'transfereeaccountcode':_0x5a80ee[_0x19cf('0x10')],'transfereecontext':_0x5a80ee[_0x19cf('0x11')],'transfereeexten':_0x5a80ee[_0x19cf('0x12')],'transfereelinkedid':_0x5a80ee['transfereelinkedid'],'isexternal':_0x5a80ee['isexternal'],'context':_0x5a80ee[_0x19cf('0x13')],'extension':_0x5a80ee['extension'],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x4914a3){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x4914a3[_0x19cf('0x14')],'transfererchannel':_0x4914a3['origtransfererchannel'],'transferercalleridnum':_0x4914a3[_0x19cf('0x15')],'transferercalleridname':_0x4914a3[_0x19cf('0x16')],'transfererconnectedlinenum':_0x4914a3['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4914a3[_0x19cf('0x17')],'transfereraccountcode':_0x4914a3[_0x19cf('0x18')],'transferercontext':_0x4914a3[_0x19cf('0x19')],'transfererexten':_0x4914a3[_0x19cf('0x1a')],'transfererlinkedid':_0x4914a3['origtransfererlinkedid'],'transfereechannel':_0x4914a3['transfertargetchannel'],'transfereecalleridnum':_0x4914a3[_0x19cf('0x1b')],'transfereecalleridname':_0x4914a3['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4914a3[_0x19cf('0x1c')],'transfereeconnectedlinename':_0x4914a3['transfertargetconnectedlinename'],'transfereeaccountcode':_0x4914a3['transfertargetaccountcode'],'transfereecontext':_0x4914a3['transfertargetcontext'],'transfereeexten':_0x4914a3[_0x19cf('0x1d')],'transfereelinkedid':_0x4914a3[_0x19cf('0x1e')],'isexternal':_0x4914a3[_0x19cf('0x1f')],'context':_0x4914a3[_0x19cf('0x20')],'extension':_0x4914a3[_0x19cf('0x21')],'type':_0x19cf('0x22')},'log':_0x19cf('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index e936950..fa1f2c8 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 _0xe812=['outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','find','omit','undefined','channels','voicechannel','map','uniqueid','channel','%s.%s','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','rec','mixmonitorid','status','MixMonitor\x20Success','validate','resolve','destinationchannel','StopMixMonitor','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','values','queueChannels','voicequeuechannel','Hangup','voicequeuechannelredirect','Redirect','context','trunks','campaigns','run','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','../../../config/environment','../properties','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','ami\x20disconnected','join','pick','keys','action','Reload','then','message','catch','isConnected','command','Command','Action','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xe812,0x1f2));var _0x2e81=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe812[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2e81('0x0'));var jayson=require(_0x2e81('0x1'));var schema=require('validate');var moment=require('moment');var config=require(_0x2e81('0x2'));var properties=require(_0x2e81('0x3'));var ami=require('../ami');exports[_0x2e81('0x4')]=function(_0x1478a4,_0x5e14d5,_0x1a0274){return new Promise(function(_0x251244,_0x4f6864){var _0x36604d={'QueuePause':function(_0x32b221){return new Promise(function(_0x27f9c6){var _0x5559ca=util[_0x2e81('0x5')](_0x2e81('0x6'),_0x2e81('0x7'),_0x32b221[_0x2e81('0x8')]);if(_0x1478a4['timers']&&_0x1478a4[_0x2e81('0x9')][_0x5559ca]&&_0x1478a4[_0x2e81('0x9')][_0x5559ca][_0x2e81('0xa')]){_0x1478a4[_0x2e81('0x9')][_0x5559ca][_0x2e81('0xb')]();}if(_0x1478a4[_0x2e81('0xc')][_0x5559ca]){_0x1478a4[_0x2e81('0xc')][_0x5559ca][_0x2e81('0xd')]({'statePause':_0x32b221[_0x2e81('0xe')]?!![]:![]});}_0x27f9c6({'code':0xc8,'message':_0x2e81('0xf')});});},'Reload':function(_0x4284f3){var _0x5c58a2=this;return new Promise(function(_0x30a730,_0x225802){if(ami['isConnected']()==![]){return _0x225802(_0x5c58a2[_0x2e81('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x2e81('0x11')][_0x2e81('0x12')],_0x2e81('0x13')][_0x2e81('0x14')]('\x20')));}_0x4284f3=_[_0x2e81('0x15')](_0x4284f3,_[_0x2e81('0x16')](properties['module']));_0x4284f3[_0x2e81('0x17')]=_0x2e81('0x18');return ami['Action'](_0x4284f3)[_0x2e81('0x19')](function(_0x5b1270){_0x30a730({'code':0xc8,'message':_0x5b1270[_0x2e81('0x1a')]});})[_0x2e81('0x1b')](function(_0x4c1b11){_0x225802(_0x5c58a2[_0x2e81('0x10')](0x1f5,_0x4c1b11[_0x2e81('0x1a')]));});});},'Command':function(_0xbb61a4){var _0x2e1fc9=this;return new Promise(function(_0x2553b0,_0x1f20bf){if(ami[_0x2e81('0x1c')]()==![]){return _0x1f20bf(_0x2e1fc9[_0x2e81('0x10')](0x1f4,[config[_0x2e81('0x11')]['ip'],config[_0x2e81('0x11')]['username'],_0x2e81('0x13')][_0x2e81('0x14')]('\x20')));}_0xbb61a4=_[_0x2e81('0x15')](_0xbb61a4,_0x2e81('0x1d'));_0xbb61a4[_0x2e81('0x17')]=_0x2e81('0x1e');return ami[_0x2e81('0x1f')](_0xbb61a4)[_0x2e81('0x19')](function(_0x5eabae){_0x2553b0({'code':0xc8,'message':_0x5eabae[_0x2e81('0x20')]});})['catch'](function(_0x2d50af){_0x1f20bf(_0x2e1fc9['error'](0x1f5,_0x2d50af[_0x2e81('0x1a')]));});});},'VoiceQueues':function(){return new Promise(function(_0x59117d){var _0x54e6be=[];for(var _0x123d3d in _0x1478a4[_0x2e81('0x21')]){if(_0x1478a4['voiceQueues'][_0x2e81('0x22')](_0x123d3d)){var _0x19b1a9=_0x1478a4[_0x2e81('0x21')][_0x123d3d];var _0x2d2fac={'id':_0x19b1a9['id'],'name':_0x19b1a9[_0x2e81('0x8')],'strategy':_0x19b1a9[_0x2e81('0x23')],'answered':_0x19b1a9[_0x2e81('0x24')],'available':_0x19b1a9[_0x2e81('0x25')],'loggedIn':_0x19b1a9[_0x2e81('0x26')],'pTalking':_0x19b1a9[_0x2e81('0x27')],'sumBillable':_0x19b1a9[_0x2e81('0x28')],'sumDuration':_0x19b1a9[_0x2e81('0x29')],'sumHoldTime':_0x19b1a9[_0x2e81('0x2a')]||0x0,'talking':_0x19b1a9[_0x2e81('0x2b')],'total':_0x19b1a9['total'],'type':_0x19b1a9['type'],'unmanaged':_0x19b1a9[_0x2e81('0x2c')],'abandoned':_0x19b1a9[_0x2e81('0x2d')],'waiting':_0x19b1a9[_0x2e81('0x2e')],'loggedInDb':_0x19b1a9[_0x2e81('0x2f')]};if(_0x19b1a9[_0x2e81('0x30')]===_0x2e81('0x31')){_0x2d2fac[_0x2e81('0x32')]=_0x19b1a9[_0x2e81('0x32')];_0x2d2fac[_0x2e81('0x33')]=_0x19b1a9[_0x2e81('0x33')];_0x2d2fac[_0x2e81('0x34')]=_0x19b1a9['dialOriginateCallerIdName'];_0x2d2fac[_0x2e81('0x35')]=_0x19b1a9[_0x2e81('0x35')];_0x2d2fac[_0x2e81('0x36')]=_0x19b1a9[_0x2e81('0x36')];_0x2d2fac[_0x2e81('0x37')]=_0x19b1a9[_0x2e81('0x37')];_0x2d2fac[_0x2e81('0x38')]=_0x19b1a9[_0x2e81('0x38')];_0x2d2fac[_0x2e81('0x39')]=_0x19b1a9[_0x2e81('0x39')];_0x2d2fac[_0x2e81('0x3a')]=_0x19b1a9[_0x2e81('0x3a')];_0x2d2fac[_0x2e81('0x3b')]=_0x19b1a9[_0x2e81('0x3b')];_0x2d2fac[_0x2e81('0x3c')]=_0x19b1a9[_0x2e81('0x3c')];_0x2d2fac[_0x2e81('0x3d')]=_0x19b1a9['outboundCongestionCallsDay'];_0x2d2fac[_0x2e81('0x3e')]=_0x19b1a9[_0x2e81('0x3e')];_0x2d2fac['outboundDropCallsDayCallersExit']=_0x19b1a9[_0x2e81('0x3f')];_0x2d2fac[_0x2e81('0x40')]=_0x19b1a9['outboundDropCallsDayTimeout'];_0x2d2fac[_0x2e81('0x41')]=_0x19b1a9[_0x2e81('0x41')];_0x2d2fac[_0x2e81('0x42')]=_0x19b1a9['outboundNoSuchCallsDay'];_0x2d2fac[_0x2e81('0x43')]=_0x19b1a9[_0x2e81('0x43')];_0x2d2fac[_0x2e81('0x44')]=_0x19b1a9[_0x2e81('0x44')];_0x2d2fac[_0x2e81('0x45')]=_0x19b1a9['outboundRejectCallsDay'];_0x2d2fac['outboundUnknownCallsDay']=_0x19b1a9['outboundUnknownCallsDay'];_0x2d2fac['predictiveIntervalAnsweredCalls']=_0x19b1a9[_0x2e81('0x46')];_0x2d2fac['predictiveIntervalAvgHoldtime']=_0x19b1a9['predictiveIntervalAvgHoldtime'];_0x2d2fac[_0x2e81('0x47')]=_0x19b1a9[_0x2e81('0x47')];_0x2d2fac[_0x2e81('0x48')]=_0x19b1a9['predictiveIntervalDroppedCallsCallersExit'];_0x2d2fac[_0x2e81('0x49')]=_0x19b1a9[_0x2e81('0x49')];_0x2d2fac[_0x2e81('0x4a')]=_0x19b1a9[_0x2e81('0x4a')];_0x2d2fac[_0x2e81('0x4b')]=_0x19b1a9['predictiveIntervalErlangCallsDroppedCalls'];_0x2d2fac['predictiveIntervalHitRate']=_0x19b1a9[_0x2e81('0x4c')];_0x2d2fac[_0x2e81('0x4d')]=_0x19b1a9[_0x2e81('0x4d')];_0x2d2fac['predictiveIntervalPauses']=_0x19b1a9[_0x2e81('0x4e')];_0x2d2fac[_0x2e81('0x4f')]=_0x19b1a9[_0x2e81('0x4f')];_0x2d2fac['predictiveIntervalTotalCalls']=_0x19b1a9[_0x2e81('0x50')];_0x2d2fac[_0x2e81('0x1a')]=_0x19b1a9[_0x2e81('0x1a')];_0x2d2fac[_0x2e81('0x51')]=_0x19b1a9[_0x2e81('0x51')];_0x2d2fac[_0x2e81('0x52')]=_0x19b1a9[_0x2e81('0x52')];_0x2d2fac[_0x2e81('0x53')]=_0x19b1a9['erlangCallToSecond'];_0x2d2fac['erlangAbandonmentRate']=_0x19b1a9[_0x2e81('0x54')];_0x2d2fac['erlangBusyFactor']=_0x19b1a9[_0x2e81('0x55')];_0x2d2fac[_0x2e81('0x56')]=_0x19b1a9[_0x2e81('0x56')];_0x2d2fac[_0x2e81('0x57')]=_0x19b1a9[_0x2e81('0x57')];}if(_0x19b1a9[_0x2e81('0x58')]){_0x2d2fac['Trunk']={'id':_0x19b1a9['Trunk']['id'],'name':_0x19b1a9[_0x2e81('0x58')][_0x2e81('0x8')],'active':_0x19b1a9[_0x2e81('0x58')]['active'],'callerid':_0x19b1a9[_0x2e81('0x58')][_0x2e81('0x59')]};}if(_0x19b1a9['Interval']){_0x2d2fac[_0x2e81('0x5a')]={'id':_0x19b1a9['Interval']['id'],'name':_0x19b1a9[_0x2e81('0x5a')][_0x2e81('0x8')]};}_0x54e6be[_0x2e81('0x5b')](_0x2d2fac);}}_0x59117d({'count':_0x54e6be[_0x2e81('0x5c')],'rows':_0x54e6be});});},'UpdateVoiceQueue':function(_0x503346){return new Promise(function(_0x251c16,_0x57af2d){var _0x1384fc=_[_0x2e81('0x5d')](_0x1478a4['voiceQueues'],{'id':parseInt(_0x503346['id'])});var _0x317f78=_[_0x2e81('0x5e')](_0x503346,['id']);if(_0x1384fc){for(var _0x15ec68 in _0x317f78){if(typeof _0x317f78[_0x15ec68]!==_0x2e81('0x5f')&&typeof _0x1384fc[_0x15ec68]!==_0x2e81('0x5f')){_0x1384fc[_0x15ec68]=_0x317f78[_0x15ec68];}}_0x251c16(_0x1384fc);}else{_0x57af2d();}});},'VoiceChannels':function(){return new Promise(function(_0x335956){var _0x243cb8=_['values'](_0x1478a4[_0x2e81('0x60')]);_0x335956({'count':_0x243cb8['length'],'rows':_0x243cb8});});},'VoiceChannelMixMonitor':function(_0x5448fa){var _0x5df48c=this;return new Promise(function(_0x5bd250,_0x551ad0){if(ami[_0x2e81('0x1c')]()==![]){return _0x551ad0(_0x5df48c[_0x2e81('0x10')](0x1f4,[config[_0x2e81('0x11')]['ip'],config['asterisk']['username'],_0x2e81('0x13')][_0x2e81('0x14')]('\x20')));}var _0x16ed11=schema(properties[_0x2e81('0x61')])['validate'](_0x5448fa);if(_0x16ed11['length']>0x0){return _0x551ad0(_0x5df48c[_0x2e81('0x10')](0x1f4,_[_0x2e81('0x62')](_0x16ed11,'message')['join'](',\x20')));}var _0x23a42b=_[_0x2e81('0x5d')](_0x1478a4['channels'],{'uniqueid':_0x5448fa[_0x2e81('0x63')]});if(_0x23a42b&&_0x23a42b[_0x2e81('0x64')]){var _0x25b243=util[_0x2e81('0x5')](_0x2e81('0x65'),_0x5448fa['filename']||_0x5448fa[_0x2e81('0x63')],_0x5448fa[_0x2e81('0x5')]||_0x2e81('0x66'));return ami[_0x2e81('0x1f')]({'action':'MixMonitor','channel':_0x23a42b['channel'],'file':_0x25b243,'options':_0x2e81('0x67')})[_0x2e81('0x19')](function(_0x292774){var _0x127d1b=_[_0x2e81('0x5d')](_0x23a42b['monitors'],{'filename':_0x2e81('0x68')+_0x25b243[_0x2e81('0x69')]()});if(_[_0x2e81('0x6a')](_0x127d1b)){_0x23a42b[_0x2e81('0x6b')][_0x2e81('0x5b')]({'filename':'/var/spool/asterisk/monitor/'+_0x25b243[_0x2e81('0x69')](),'createdAt':moment()[_0x2e81('0x5')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x292774['mixmonitorid'],'status':_0x2e81('0x6c')});}else{_0x127d1b['mixmonitorid']=_0x292774[_0x2e81('0x6d')];_0x127d1b[_0x2e81('0x6e')]=_0x2e81('0x6c');}_0x5bd250({'code':0xc8,'message':[_0x5448fa[_0x2e81('0x63')],_0x2e81('0x6f'),_0x292774[_0x2e81('0x6d')]][_0x2e81('0x14')]('\x20'),'mixmonitorid':_0x292774[_0x2e81('0x6d')]});})['catch'](function(_0xb5ce8c){_0x551ad0(_0x5df48c['error'](0x1f5,[_0x5448fa[_0x2e81('0x63')],_0xb5ce8c[_0x2e81('0x1a')]['toLowerCase']()][_0x2e81('0x14')]('\x20')));});}else{return _0x551ad0(_0x5df48c[_0x2e81('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x31eb2e){var _0x5c3b81=this;return new Promise(function(_0x352b29,_0x40f524){if(ami[_0x2e81('0x1c')]()==![]){return _0x40f524(_0x5c3b81[_0x2e81('0x10')](0x1f4,[config[_0x2e81('0x11')]['ip'],config[_0x2e81('0x11')][_0x2e81('0x12')],_0x2e81('0x13')]['join']('\x20')));}var _0x105c63=schema(properties[_0x2e81('0x61')])[_0x2e81('0x70')](_0x31eb2e);if(_0x105c63[_0x2e81('0x5c')]>0x0){return _0x40f524(_0x5c3b81[_0x2e81('0x10')](0x1f4,_[_0x2e81('0x62')](_0x105c63,_0x2e81('0x1a'))[_0x2e81('0x14')](',\x20')));}var _0x3def62=_[_0x2e81('0x5d')](_0x1478a4[_0x2e81('0x60')],{'uniqueid':_0x31eb2e[_0x2e81('0x63')]});if(_0x3def62){return Promise[_0x2e81('0x71')]()[_0x2e81('0x19')](function(){if(_0x3def62[_0x2e81('0x64')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x3def62[_0x2e81('0x64')],'mixmonitorid':_0x31eb2e[_0x2e81('0x6d')]})[_0x2e81('0x1b')](function(){});}})[_0x2e81('0x19')](function(){if(_0x3def62[_0x2e81('0x72')]){return ami[_0x2e81('0x1f')]({'action':_0x2e81('0x73'),'channel':_0x3def62[_0x2e81('0x72')],'mixmonitorid':_0x31eb2e['mixmonitorid']})['catch'](function(){});}})[_0x2e81('0x19')](function(){var _0x16481f=_['find'](_0x3def62[_0x2e81('0x6b')],{'mixmonitorid':_0x31eb2e[_0x2e81('0x6d')]});if(_0x16481f){_0x16481f[_0x2e81('0x6e')]=_0x2e81('0x74');}})[_0x2e81('0x19')](function(){var _0x85a455=util[_0x2e81('0x5')](_0x2e81('0x65'),_0x31eb2e['filename']||_0x31eb2e[_0x2e81('0x63')],_0x31eb2e['format']||_0x2e81('0x66'));var _0x2a47f0=_[_0x2e81('0x5d')](_0x3def62[_0x2e81('0x6b')],{'filename':_0x2e81('0x68')+_0x85a455[_0x2e81('0x69')]()});if(_0x2a47f0){_0x2a47f0[_0x2e81('0x6e')]=_0x2e81('0x74');}})[_0x2e81('0x19')](function(){_0x352b29({'code':0xc8,'message':[_0x31eb2e[_0x2e81('0x63')],_0x2e81('0x75')][_0x2e81('0x14')]('\x20')});})['catch'](function(_0xd01d1d){_0x40f524(_0x5c3b81[_0x2e81('0x10')](0x1f5,[_0x31eb2e[_0x2e81('0x63')],_0xd01d1d[_0x2e81('0x1a')][_0x2e81('0x69')]()]['join']('\x20')));});}else{return _0x40f524(_0x5c3b81[_0x2e81('0x10')](0x1f5,_0x2e81('0x76')));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x4a2c43){var _0x46e8e0=_[_0x2e81('0x77')](_0x1478a4[_0x2e81('0x78')]);_0x4a2c43({'count':_0x46e8e0[_0x2e81('0x5c')],'rows':_0x46e8e0});});},'VoiceQueuesChannel':function(_0x1e87f9){var _0x2e289a=this;return new Promise(function(_0x27bb80,_0x17c345){var _0x217242=schema(properties[_0x2e81('0x79')])['validate'](_0x1e87f9);if(_0x217242['length']>0x0){return _0x17c345(_0x2e289a['error'](0x1f4,_[_0x2e81('0x62')](_0x217242,_0x2e81('0x1a'))[_0x2e81('0x14')](',\x20')));}var _0xa2cf6f=_['find'](_0x1478a4[_0x2e81('0x78')],{'uniqueid':_0x1e87f9[_0x2e81('0x63')]});if(_0xa2cf6f){_0x27bb80(_0xa2cf6f);}else{return _0x17c345(_0x2e289a[_0x2e81('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x2652be){var _0x45677d=this;return new Promise(function(_0x53a320,_0x50ce73){if(ami[_0x2e81('0x1c')]()==![]){return _0x50ce73(_0x45677d['error'](0x1f4,[config[_0x2e81('0x11')]['ip'],config[_0x2e81('0x11')]['username'],_0x2e81('0x13')]['join']('\x20')));}var _0x474183=schema(properties['voicequeuechannelhangup'])['validate'](_0x2652be);if(_0x474183['length']>0x0){return _0x50ce73(_0x45677d[_0x2e81('0x10')](0x1f4,_['map'](_0x474183,_0x2e81('0x1a'))[_0x2e81('0x14')](',\x20')));}var _0x48daa3=_[_0x2e81('0x5d')](_0x1478a4[_0x2e81('0x78')],{'uniqueid':_0x2652be[_0x2e81('0x63')]});if(_0x48daa3&&_0x48daa3[_0x2e81('0x64')]){return ami[_0x2e81('0x1f')]({'action':_0x2e81('0x7a'),'channel':_0x48daa3[_0x2e81('0x64')]})[_0x2e81('0x19')](function(_0x2c128c){_0x53a320({'code':0xc8,'message':[_0x2652be[_0x2e81('0x63')],_0x2c128c['message']['toLowerCase']()][_0x2e81('0x14')]('\x20')});})[_0x2e81('0x1b')](function(_0x51e880){_0x50ce73(_0x45677d[_0x2e81('0x10')](0x1f5,[_0x2652be[_0x2e81('0x63')],_0x51e880[_0x2e81('0x1a')][_0x2e81('0x69')]()][_0x2e81('0x14')]('\x20')));});}else{return _0x50ce73(_0x45677d['error'](0x1f5,_0x2e81('0x76')));}});},'VoiceQueuesChannelRedirect':function(_0x217dc1){var _0x14e9ba=this;return new Promise(function(_0x4eb7d8,_0x1db473){if(ami[_0x2e81('0x1c')]()==![]){return _0x1db473(_0x14e9ba[_0x2e81('0x10')](0x1f4,[config[_0x2e81('0x11')]['ip'],config[_0x2e81('0x11')]['username'],_0x2e81('0x13')]['join']('\x20')));}var _0x261fc7=schema(properties[_0x2e81('0x7b')])[_0x2e81('0x70')](_0x217dc1);if(_0x261fc7[_0x2e81('0x5c')]>0x0){return _0x1db473(_0x14e9ba[_0x2e81('0x10')](0x1f4,_[_0x2e81('0x62')](_0x261fc7,_0x2e81('0x1a'))[_0x2e81('0x14')](',\x20')));}var _0x428e2c=_[_0x2e81('0x5d')](_0x1478a4['queueChannels'],{'uniqueid':_0x217dc1[_0x2e81('0x63')]});if(_0x428e2c&&_0x428e2c['channel']){return ami[_0x2e81('0x1f')]({'action':_0x2e81('0x7c'),'channel':_0x428e2c[_0x2e81('0x64')],'exten':_0x217dc1['exten'],'context':_0x217dc1['context']||_0x428e2c[_0x2e81('0x7d')],'priority':0x1})[_0x2e81('0x19')](function(_0x218767){_0x4eb7d8({'code':0xc8,'message':[_0x217dc1['uniqueid'],_0x218767[_0x2e81('0x1a')][_0x2e81('0x69')]()]['join']('\x20')});})[_0x2e81('0x1b')](function(_0x17724c){_0x1db473(_0x14e9ba['error'](0x1f5,[_0x217dc1[_0x2e81('0x63')],_0x17724c['message'][_0x2e81('0x69')]()]['join']('\x20')));});}else{return _0x1db473(_0x14e9ba[_0x2e81('0x10')](0x1f5,_0x2e81('0x76')));}});},'Agents':function(_0x177dc8){return new Promise(function(_0x33517c){var _0xb97446=_['values'](_0x1478a4[_0x2e81('0xc')]);if(_0x177dc8&&_0x177dc8['id']){var _0x48739f=_[_0x2e81('0x5d')](_0xb97446,function(_0x3af9df){return _0x3af9df['id']===_0x177dc8['id'];});_0x33517c(_0x48739f);}else{_0x33517c({'count':_0xb97446[_0x2e81('0x5c')],'rows':_0xb97446});}});},'Telephones':function(){return new Promise(function(_0x1a759b){var _0x33c849=_[_0x2e81('0x77')](_0x1478a4['telephones']);_0x1a759b({'count':_0x33c849[_0x2e81('0x5c')],'rows':_0x33c849});});},'Trunks':function(){return new Promise(function(_0x29eb77){var _0x4030d8=_[_0x2e81('0x77')](_0x1478a4[_0x2e81('0x7e')]);_0x29eb77({'count':_0x4030d8[_0x2e81('0x5c')],'rows':_0x4030d8});});},'OutboundChannels':function(){return new Promise(function(_0x1a1e68){var _0x28a9e3=_['values'](_0x1478a4['outboundChannels']);_0x1a1e68({'count':_0x28a9e3[_0x2e81('0x5c')],'rows':_0x28a9e3});});},'Outbound':function(){return new Promise(function(_0x263391){_0x263391(_0x1478a4['outbound']);});},'Campaigns':function(){return new Promise(function(_0x22734c){var _0x4c37dd=_[_0x2e81('0x77')](_0x1478a4[_0x2e81('0x7f')]);_0x22734c({'count':_0x4c37dd[_0x2e81('0x5c')],'rows':_0x4c37dd});});},'VoiceQueuesPreview':function(_0x10dc4c){var _0xf0292=this;return new Promise(function(_0x5df1c1,_0x18005c){_0x5e14d5[_0x2e81('0x80')](_0x10dc4c['id'])[_0x2e81('0x19')](function(_0x258684){_0x5df1c1({'code':0xc8,'message':_0x258684[_0x2e81('0x1a')]});})['catch'](function(_0x423379){_0x18005c(_0xf0292[_0x2e81('0x10')](0x1f4,_0x423379[_0x2e81('0x1a')]));});});},'EventManager':function(_0x30ea71){var _0x58340d=this;return new Promise(function(_0x2fdbd2,_0x5d104c){if(!_0x30ea71['event']){return _0x5d104c(_0x58340d[_0x2e81('0x10')](0x1f4,_0x2e81('0x81')));}ami[_0x2e81('0x82')](_0x2e81('0x83')+_0x30ea71['event'],_0x30ea71['message']);_0x2fdbd2({'code':0xc8,'message':_0x30ea71});});},'FaxAccounts':function(){return new Promise(function(_0xb2e23f){var _0x3336b1=_[_0x2e81('0x77')](_0x1478a4[_0x2e81('0x84')]);_0xb2e23f({'count':_0x3336b1[_0x2e81('0x5c')],'rows':_0x3336b1});});},'SendFax':function(_0x1715a8){var _0x2cbeac=this;return new Promise(function(_0x879912,_0x5e5854){_0x1a0274[_0x2e81('0x85')](_0x1715a8)['then'](function(_0x1f339c){_0x879912({'code':0xc8,'message':_0x1f339c[_0x2e81('0x1a')]});})['catch'](function(_0x5908db){_0x5e5854(_0x2cbeac[_0x2e81('0x10')](0x1f4,_0x5908db[_0x2e81('0x1a')]));});});},'CheckAfterSend':function(_0x5065f8){var _0x3b827b=this;return new Promise(function(_0xa197c8,_0x14950a){_0x1a0274[_0x2e81('0x86')](_0x5065f8)[_0x2e81('0x19')](function(_0x417e9a){_0xa197c8({'code':0xc8,'message':_0x417e9a['message']});})['catch'](function(_0x3592cb){_0x14950a(_0x3b827b[_0x2e81('0x10')](0x1f4,_0x3592cb[_0x2e81('0x1a')]));});});}};var _0x49e6fa=jayson['server'](_0x36604d)[_0x2e81('0x87')]();_0x49e6fa['on']('error',function(_0x35a64f){return _0x4f6864(_0x35a64f);});_0x49e6fa[_0x2e81('0x4')](0x232a,_0x2e81('0x88'),function(){console['log'](_0x2e81('0x89'),0x232a);return _0x251244(_0x2e81('0x8a')+0x232a);});});}; \ No newline at end of file +var _0x4fc2=['format','%s/%s','SIP','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module','Reload','Action','then','message','action','catch','voiceQueues','hasOwnProperty','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','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','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','map','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','filename','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','outbound','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','../../../config/environment','../properties','../ami'];(function(_0x22864d,_0x5836c9){var _0x5eaa64=function(_0x41d02f){while(--_0x41d02f){_0x22864d['push'](_0x22864d['shift']());}};_0x5eaa64(++_0x5836c9);}(_0x4fc2,0x111));var _0x24fc=function(_0x23dc29,_0x4127b3){_0x23dc29=_0x23dc29-0x0;var _0x5a79bb=_0x4fc2[_0x23dc29];return _0x5a79bb;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var jayson=require(_0x24fc('0x2'));var schema=require(_0x24fc('0x3'));var moment=require('moment');var config=require(_0x24fc('0x4'));var properties=require(_0x24fc('0x5'));var ami=require(_0x24fc('0x6'));exports['listen']=function(_0x126d90,_0x3772eb,_0x58dafc){return new Promise(function(_0x26fcc6,_0x12d602){var _0x4889f4={'QueuePause':function(_0x115851){return new Promise(function(_0x22a0c8){var _0x220f9a=util[_0x24fc('0x7')](_0x24fc('0x8'),_0x24fc('0x9'),_0x115851['name']);if(_0x126d90[_0x24fc('0xa')]&&_0x126d90[_0x24fc('0xa')][_0x220f9a]&&_0x126d90[_0x24fc('0xa')][_0x220f9a][_0x24fc('0xb')]){_0x126d90[_0x24fc('0xa')][_0x220f9a][_0x24fc('0xc')]();}if(_0x126d90[_0x24fc('0xd')][_0x220f9a]){_0x126d90[_0x24fc('0xd')][_0x220f9a]['updateStatusRealtime']({'statePause':_0x115851[_0x24fc('0xe')]?!![]:![]});}_0x22a0c8({'code':0xc8,'message':_0x24fc('0xf')});});},'Reload':function(_0x5cc65e){var _0x306873=this;return new Promise(function(_0x76cb25,_0x3f6d8b){if(ami[_0x24fc('0x10')]()==![]){return _0x3f6d8b(_0x306873[_0x24fc('0x11')](0x1f4,[config[_0x24fc('0x12')]['ip'],config['asterisk'][_0x24fc('0x13')],_0x24fc('0x14')][_0x24fc('0x15')]('\x20')));}_0x5cc65e=_[_0x24fc('0x16')](_0x5cc65e,_['keys'](properties[_0x24fc('0x17')]));_0x5cc65e['action']=_0x24fc('0x18');return ami[_0x24fc('0x19')](_0x5cc65e)[_0x24fc('0x1a')](function(_0x41c593){_0x76cb25({'code':0xc8,'message':_0x41c593[_0x24fc('0x1b')]});})['catch'](function(_0x23873c){_0x3f6d8b(_0x306873[_0x24fc('0x11')](0x1f5,_0x23873c[_0x24fc('0x1b')]));});});},'Command':function(_0x8ac114){var _0x4c5a43=this;return new Promise(function(_0x5eabee,_0x4073e0){if(ami[_0x24fc('0x10')]()==![]){return _0x4073e0(_0x4c5a43['error'](0x1f4,[config[_0x24fc('0x12')]['ip'],config[_0x24fc('0x12')][_0x24fc('0x13')],_0x24fc('0x14')]['join']('\x20')));}_0x8ac114=_[_0x24fc('0x16')](_0x8ac114,'command');_0x8ac114[_0x24fc('0x1c')]='Command';return ami[_0x24fc('0x19')](_0x8ac114)[_0x24fc('0x1a')](function(_0x2ffade){_0x5eabee({'code':0xc8,'message':_0x2ffade['content']});})[_0x24fc('0x1d')](function(_0x552035){_0x4073e0(_0x4c5a43[_0x24fc('0x11')](0x1f5,_0x552035[_0x24fc('0x1b')]));});});},'VoiceQueues':function(){return new Promise(function(_0x36a9b4){var _0x34b5b2=[];for(var _0x3296fc in _0x126d90[_0x24fc('0x1e')]){if(_0x126d90[_0x24fc('0x1e')][_0x24fc('0x1f')](_0x3296fc)){var _0x168d98=_0x126d90[_0x24fc('0x1e')][_0x3296fc];var _0x568441={'id':_0x168d98['id'],'name':_0x168d98[_0x24fc('0x20')],'strategy':_0x168d98[_0x24fc('0x21')],'answered':_0x168d98[_0x24fc('0x22')],'available':_0x168d98['available'],'loggedIn':_0x168d98[_0x24fc('0x23')],'pTalking':_0x168d98[_0x24fc('0x24')],'sumBillable':_0x168d98[_0x24fc('0x25')],'sumDuration':_0x168d98[_0x24fc('0x26')],'sumHoldTime':_0x168d98[_0x24fc('0x27')]||0x0,'talking':_0x168d98[_0x24fc('0x28')],'total':_0x168d98['total'],'type':_0x168d98[_0x24fc('0x29')],'unmanaged':_0x168d98[_0x24fc('0x2a')],'abandoned':_0x168d98[_0x24fc('0x2b')],'waiting':_0x168d98[_0x24fc('0x2c')],'loggedInDb':_0x168d98[_0x24fc('0x2d')]};if(_0x168d98['type']==='outbound'){_0x568441['dialActive']=_0x168d98[_0x24fc('0x2e')];_0x568441['dialMethod']=_0x168d98[_0x24fc('0x2f')];_0x568441[_0x24fc('0x30')]=_0x168d98[_0x24fc('0x30')];_0x568441[_0x24fc('0x31')]=_0x168d98['dialOriginateCallerIdNumber'];_0x568441[_0x24fc('0x32')]=_0x168d98[_0x24fc('0x32')];_0x568441['dialPrefix']=_0x168d98[_0x24fc('0x33')];_0x568441[_0x24fc('0x34')]=_0x168d98['temp'];_0x568441['outboundAnswerAgiCallsDay']=_0x168d98[_0x24fc('0x35')];_0x568441['outboundAnswerCallsDay']=_0x168d98[_0x24fc('0x36')];_0x568441[_0x24fc('0x37')]=_0x168d98['outboundBlacklistCallsDay'];_0x568441[_0x24fc('0x38')]=_0x168d98[_0x24fc('0x38')];_0x568441[_0x24fc('0x39')]=_0x168d98[_0x24fc('0x39')];_0x568441[_0x24fc('0x3a')]=_0x168d98[_0x24fc('0x3a')];_0x568441[_0x24fc('0x3b')]=_0x168d98[_0x24fc('0x3b')];_0x568441[_0x24fc('0x3c')]=_0x168d98['outboundDropCallsDayTimeout'];_0x568441[_0x24fc('0x3d')]=_0x168d98[_0x24fc('0x3d')];_0x568441[_0x24fc('0x3e')]=_0x168d98[_0x24fc('0x3e')];_0x568441[_0x24fc('0x3f')]=_0x168d98['outboundOriginateFailureCallsDay'];_0x568441['outboundReCallsDay']=_0x168d98[_0x24fc('0x40')];_0x568441['outboundRejectCallsDay']=_0x168d98[_0x24fc('0x41')];_0x568441[_0x24fc('0x42')]=_0x168d98[_0x24fc('0x42')];_0x568441[_0x24fc('0x43')]=_0x168d98['predictiveIntervalAnsweredCalls'];_0x568441[_0x24fc('0x44')]=_0x168d98['predictiveIntervalAvgHoldtime'];_0x568441[_0x24fc('0x45')]=_0x168d98[_0x24fc('0x45')];_0x568441[_0x24fc('0x46')]=_0x168d98[_0x24fc('0x46')];_0x568441[_0x24fc('0x47')]=_0x168d98['predictiveIntervalDroppedCallsTimeout'];_0x568441[_0x24fc('0x48')]=_0x168d98[_0x24fc('0x48')];_0x568441[_0x24fc('0x49')]=_0x168d98[_0x24fc('0x49')];_0x568441['predictiveIntervalHitRate']=_0x168d98[_0x24fc('0x4a')];_0x568441[_0x24fc('0x4b')]=_0x168d98['predictiveIntervalMultiplicativeFactor'];_0x568441[_0x24fc('0x4c')]=_0x168d98['predictiveIntervalPauses'];_0x568441[_0x24fc('0x4d')]=_0x168d98[_0x24fc('0x4d')];_0x568441[_0x24fc('0x4e')]=_0x168d98[_0x24fc('0x4e')];_0x568441[_0x24fc('0x1b')]=_0x168d98[_0x24fc('0x1b')];_0x568441[_0x24fc('0x4f')]=_0x168d98[_0x24fc('0x4f')];_0x568441['erlangCalls']=_0x168d98[_0x24fc('0x50')];_0x568441[_0x24fc('0x51')]=_0x168d98[_0x24fc('0x51')];_0x568441['erlangAbandonmentRate']=_0x168d98[_0x24fc('0x52')];_0x568441[_0x24fc('0x53')]=_0x168d98['erlangBusyFactor'];_0x568441[_0x24fc('0x54')]=_0x168d98[_0x24fc('0x54')];_0x568441[_0x24fc('0x55')]=_0x168d98['startProgressive'];}if(_0x168d98[_0x24fc('0x56')]){_0x568441[_0x24fc('0x56')]={'id':_0x168d98['Trunk']['id'],'name':_0x168d98[_0x24fc('0x56')][_0x24fc('0x20')],'active':_0x168d98[_0x24fc('0x56')][_0x24fc('0x57')],'callerid':_0x168d98['Trunk'][_0x24fc('0x58')]};}if(_0x168d98[_0x24fc('0x59')]){_0x568441[_0x24fc('0x59')]={'id':_0x168d98[_0x24fc('0x59')]['id'],'name':_0x168d98[_0x24fc('0x59')]['name']};}_0x34b5b2[_0x24fc('0x5a')](_0x568441);}}_0x36a9b4({'count':_0x34b5b2[_0x24fc('0x5b')],'rows':_0x34b5b2});});},'UpdateVoiceQueue':function(_0x17f683){return new Promise(function(_0x3c6ffb,_0x5c0798){var _0x2b8a9f=_[_0x24fc('0x5c')](_0x126d90['voiceQueues'],{'id':parseInt(_0x17f683['id'])});var _0x5bbb6c=_[_0x24fc('0x5d')](_0x17f683,['id']);if(_0x2b8a9f){for(var _0x5ddde2 in _0x5bbb6c){if(typeof _0x5bbb6c[_0x5ddde2]!=='undefined'&&typeof _0x2b8a9f[_0x5ddde2]!==_0x24fc('0x5e')){_0x2b8a9f[_0x5ddde2]=_0x5bbb6c[_0x5ddde2];}}_0x3c6ffb(_0x2b8a9f);}else{_0x5c0798();}});},'VoiceChannels':function(){return new Promise(function(_0x5879c2){var _0x281194=_[_0x24fc('0x5f')](_0x126d90[_0x24fc('0x60')]);_0x5879c2({'count':_0x281194['length'],'rows':_0x281194});});},'VoiceChannelMixMonitor':function(_0x1d2910){var _0x23c1d4=this;return new Promise(function(_0x1b1f1c,_0x1ad8d6){if(ami[_0x24fc('0x10')]()==![]){return _0x1ad8d6(_0x23c1d4[_0x24fc('0x11')](0x1f4,[config[_0x24fc('0x12')]['ip'],config[_0x24fc('0x12')]['username'],'ami\x20disconnected'][_0x24fc('0x15')]('\x20')));}var _0x2f1a99=schema(properties[_0x24fc('0x61')])['validate'](_0x1d2910);if(_0x2f1a99['length']>0x0){return _0x1ad8d6(_0x23c1d4[_0x24fc('0x11')](0x1f4,_[_0x24fc('0x62')](_0x2f1a99,_0x24fc('0x1b'))[_0x24fc('0x15')](',\x20')));}var _0x21f8b8=_[_0x24fc('0x5c')](_0x126d90[_0x24fc('0x60')],{'uniqueid':_0x1d2910[_0x24fc('0x63')]});if(_0x21f8b8&&_0x21f8b8[_0x24fc('0x64')]){var _0x4574d3=util[_0x24fc('0x7')](_0x24fc('0x65'),_0x1d2910['filename']||_0x1d2910[_0x24fc('0x63')],_0x1d2910[_0x24fc('0x7')]||_0x24fc('0x66'));return ami[_0x24fc('0x19')]({'action':_0x24fc('0x67'),'channel':_0x21f8b8['channel'],'file':_0x4574d3,'options':_0x24fc('0x68')})['then'](function(_0x2c8f74){var _0x2ee445=_[_0x24fc('0x5c')](_0x21f8b8[_0x24fc('0x69')],{'filename':_0x24fc('0x6a')+_0x4574d3[_0x24fc('0x6b')]()});if(_['isNil'](_0x2ee445)){_0x21f8b8[_0x24fc('0x69')][_0x24fc('0x5a')]({'filename':_0x24fc('0x6a')+_0x4574d3[_0x24fc('0x6b')](),'createdAt':moment()[_0x24fc('0x7')](_0x24fc('0x6c')),'mixmonitorid':_0x2c8f74['mixmonitorid'],'status':_0x24fc('0x6d')});}else{_0x2ee445[_0x24fc('0x6e')]=_0x2c8f74[_0x24fc('0x6e')];_0x2ee445[_0x24fc('0x6f')]=_0x24fc('0x6d');}_0x1b1f1c({'code':0xc8,'message':[_0x1d2910[_0x24fc('0x63')],_0x24fc('0x70'),_0x2c8f74['mixmonitorid']][_0x24fc('0x15')]('\x20'),'mixmonitorid':_0x2c8f74[_0x24fc('0x6e')]});})['catch'](function(_0x1368f6){_0x1ad8d6(_0x23c1d4[_0x24fc('0x11')](0x1f5,[_0x1d2910[_0x24fc('0x63')],_0x1368f6[_0x24fc('0x1b')][_0x24fc('0x6b')]()][_0x24fc('0x15')]('\x20')));});}else{return _0x1ad8d6(_0x23c1d4['error'](0x1f5,_0x24fc('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x4a0524){var _0x3e9644=this;return new Promise(function(_0x8c9649,_0x50e5b0){if(ami[_0x24fc('0x10')]()==![]){return _0x50e5b0(_0x3e9644['error'](0x1f4,[config[_0x24fc('0x12')]['ip'],config['asterisk'][_0x24fc('0x13')],_0x24fc('0x14')]['join']('\x20')));}var _0x2edef7=schema(properties['voicechannel'])[_0x24fc('0x3')](_0x4a0524);if(_0x2edef7[_0x24fc('0x5b')]>0x0){return _0x50e5b0(_0x3e9644['error'](0x1f4,_[_0x24fc('0x62')](_0x2edef7,_0x24fc('0x1b'))[_0x24fc('0x15')](',\x20')));}var _0x47179d=_[_0x24fc('0x5c')](_0x126d90['channels'],{'uniqueid':_0x4a0524[_0x24fc('0x63')]});if(_0x47179d){return Promise[_0x24fc('0x72')]()[_0x24fc('0x1a')](function(){if(_0x47179d[_0x24fc('0x64')]){return ami[_0x24fc('0x19')]({'action':'StopMixMonitor','channel':_0x47179d['channel'],'mixmonitorid':_0x4a0524[_0x24fc('0x6e')]})[_0x24fc('0x1d')](function(){});}})['then'](function(){if(_0x47179d['destinationchannel']){return ami[_0x24fc('0x19')]({'action':_0x24fc('0x73'),'channel':_0x47179d[_0x24fc('0x74')],'mixmonitorid':_0x4a0524[_0x24fc('0x6e')]})['catch'](function(){});}})[_0x24fc('0x1a')](function(){var _0x39f45a=_[_0x24fc('0x5c')](_0x47179d[_0x24fc('0x69')],{'mixmonitorid':_0x4a0524[_0x24fc('0x6e')]});if(_0x39f45a){_0x39f45a[_0x24fc('0x6f')]=_0x24fc('0x75');}})[_0x24fc('0x1a')](function(){var _0xbe136e=util[_0x24fc('0x7')](_0x24fc('0x65'),_0x4a0524[_0x24fc('0x76')]||_0x4a0524[_0x24fc('0x63')],_0x4a0524[_0x24fc('0x7')]||_0x24fc('0x66'));var _0x54ead5=_[_0x24fc('0x5c')](_0x47179d[_0x24fc('0x69')],{'filename':_0x24fc('0x6a')+_0xbe136e[_0x24fc('0x6b')]()});if(_0x54ead5){_0x54ead5[_0x24fc('0x6f')]=_0x24fc('0x75');}})[_0x24fc('0x1a')](function(){_0x8c9649({'code':0xc8,'message':[_0x4a0524[_0x24fc('0x63')],'StopMixMonitor\x20Success'][_0x24fc('0x15')]('\x20')});})[_0x24fc('0x1d')](function(_0x14adcb){_0x50e5b0(_0x3e9644[_0x24fc('0x11')](0x1f5,[_0x4a0524['uniqueid'],_0x14adcb[_0x24fc('0x1b')][_0x24fc('0x6b')]()]['join']('\x20')));});}else{return _0x50e5b0(_0x3e9644['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x2ae2ac){var _0x698283=_[_0x24fc('0x5f')](_0x126d90[_0x24fc('0x77')]);_0x2ae2ac({'count':_0x698283[_0x24fc('0x5b')],'rows':_0x698283});});},'VoiceQueuesChannel':function(_0x1d0f06){var _0x52e1aa=this;return new Promise(function(_0x11bafd,_0x15e8a3){var _0x5a2c09=schema(properties['voicequeuechannel'])[_0x24fc('0x3')](_0x1d0f06);if(_0x5a2c09[_0x24fc('0x5b')]>0x0){return _0x15e8a3(_0x52e1aa[_0x24fc('0x11')](0x1f4,_['map'](_0x5a2c09,_0x24fc('0x1b'))[_0x24fc('0x15')](',\x20')));}var _0x33f04e=_['find'](_0x126d90['queueChannels'],{'uniqueid':_0x1d0f06['uniqueid']});if(_0x33f04e){_0x11bafd(_0x33f04e);}else{return _0x15e8a3(_0x52e1aa['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x10ef7c){var _0x7e93d0=this;return new Promise(function(_0x2f1a7e,_0x2a1236){if(ami['isConnected']()==![]){return _0x2a1236(_0x7e93d0[_0x24fc('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x24fc('0x12')]['username'],_0x24fc('0x14')][_0x24fc('0x15')]('\x20')));}var _0x1b9079=schema(properties[_0x24fc('0x78')])[_0x24fc('0x3')](_0x10ef7c);if(_0x1b9079[_0x24fc('0x5b')]>0x0){return _0x2a1236(_0x7e93d0[_0x24fc('0x11')](0x1f4,_['map'](_0x1b9079,_0x24fc('0x1b'))[_0x24fc('0x15')](',\x20')));}var _0x2de101=_['find'](_0x126d90['queueChannels'],{'uniqueid':_0x10ef7c[_0x24fc('0x63')]});if(_0x2de101&&_0x2de101[_0x24fc('0x64')]){return ami['Action']({'action':_0x24fc('0x79'),'channel':_0x2de101[_0x24fc('0x64')]})['then'](function(_0x2b51c8){_0x2f1a7e({'code':0xc8,'message':[_0x10ef7c[_0x24fc('0x63')],_0x2b51c8['message'][_0x24fc('0x6b')]()][_0x24fc('0x15')]('\x20')});})[_0x24fc('0x1d')](function(_0x1efe4e){_0x2a1236(_0x7e93d0[_0x24fc('0x11')](0x1f5,[_0x10ef7c[_0x24fc('0x63')],_0x1efe4e['message']['toLowerCase']()][_0x24fc('0x15')]('\x20')));});}else{return _0x2a1236(_0x7e93d0['error'](0x1f5,_0x24fc('0x71')));}});},'VoiceQueuesChannelRedirect':function(_0x52d54e){var _0x5233c5=this;return new Promise(function(_0x436652,_0x16c609){if(ami[_0x24fc('0x10')]()==![]){return _0x16c609(_0x5233c5[_0x24fc('0x11')](0x1f4,[config[_0x24fc('0x12')]['ip'],config[_0x24fc('0x12')][_0x24fc('0x13')],_0x24fc('0x14')]['join']('\x20')));}var _0x795fff=schema(properties[_0x24fc('0x7a')])['validate'](_0x52d54e);if(_0x795fff['length']>0x0){return _0x16c609(_0x5233c5[_0x24fc('0x11')](0x1f4,_[_0x24fc('0x62')](_0x795fff,_0x24fc('0x1b'))[_0x24fc('0x15')](',\x20')));}var _0xd1e6=_['find'](_0x126d90[_0x24fc('0x77')],{'uniqueid':_0x52d54e[_0x24fc('0x63')]});if(_0xd1e6&&_0xd1e6['channel']){return ami[_0x24fc('0x19')]({'action':_0x24fc('0x7b'),'channel':_0xd1e6[_0x24fc('0x64')],'exten':_0x52d54e['exten'],'context':_0x52d54e[_0x24fc('0x7c')]||_0xd1e6[_0x24fc('0x7c')],'priority':0x1})[_0x24fc('0x1a')](function(_0x2c573b){_0x436652({'code':0xc8,'message':[_0x52d54e[_0x24fc('0x63')],_0x2c573b[_0x24fc('0x1b')][_0x24fc('0x6b')]()][_0x24fc('0x15')]('\x20')});})[_0x24fc('0x1d')](function(_0x54f379){_0x16c609(_0x5233c5[_0x24fc('0x11')](0x1f5,[_0x52d54e[_0x24fc('0x63')],_0x54f379[_0x24fc('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x16c609(_0x5233c5['error'](0x1f5,_0x24fc('0x71')));}});},'Agents':function(_0x560c80){return new Promise(function(_0x12a6a1){var _0x44132e=_['values'](_0x126d90[_0x24fc('0xd')]);if(_0x560c80&&_0x560c80['id']){var _0x559692=_[_0x24fc('0x5c')](_0x44132e,function(_0x57e241){return _0x57e241['id']===_0x560c80['id'];});_0x12a6a1(_0x559692);}else{_0x12a6a1({'count':_0x44132e[_0x24fc('0x5b')],'rows':_0x44132e});}});},'Telephones':function(){return new Promise(function(_0x367520){var _0x1ef6f3=_[_0x24fc('0x5f')](_0x126d90[_0x24fc('0x7d')]);_0x367520({'count':_0x1ef6f3[_0x24fc('0x5b')],'rows':_0x1ef6f3});});},'Trunks':function(){return new Promise(function(_0x4d30ba){var _0xa769cb=_[_0x24fc('0x5f')](_0x126d90[_0x24fc('0x7e')]);_0x4d30ba({'count':_0xa769cb[_0x24fc('0x5b')],'rows':_0xa769cb});});},'OutboundChannels':function(){return new Promise(function(_0xc9e77c){var _0x328d4d=_[_0x24fc('0x5f')](_0x126d90[_0x24fc('0x7f')]);_0xc9e77c({'count':_0x328d4d[_0x24fc('0x5b')],'rows':_0x328d4d});});},'Outbound':function(){return new Promise(function(_0x5f4ec2){_0x5f4ec2(_0x126d90[_0x24fc('0x80')]);});},'Campaigns':function(){return new Promise(function(_0x211295){var _0x31b110=_[_0x24fc('0x5f')](_0x126d90['campaigns']);_0x211295({'count':_0x31b110[_0x24fc('0x5b')],'rows':_0x31b110});});},'VoiceQueuesPreview':function(_0x3287ac){var _0xc2be0f=this;return new Promise(function(_0x59411e,_0x29cbc5){_0x3772eb['run'](_0x3287ac['id'])['then'](function(_0x4e7c8b){_0x59411e({'code':0xc8,'message':_0x4e7c8b[_0x24fc('0x1b')]});})['catch'](function(_0x29f1c1){_0x29cbc5(_0xc2be0f[_0x24fc('0x11')](0x1f4,_0x29f1c1[_0x24fc('0x1b')]));});});},'EventManager':function(_0x10abf7){var _0x50d1f7=this;return new Promise(function(_0x3a65c5,_0x315ce4){if(!_0x10abf7[_0x24fc('0x81')]){return _0x315ce4(_0x50d1f7[_0x24fc('0x11')](0x1f4,_0x24fc('0x82')));}ami['emit'](_0x24fc('0x83')+_0x10abf7[_0x24fc('0x81')],_0x10abf7[_0x24fc('0x1b')]);_0x3a65c5({'code':0xc8,'message':_0x10abf7});});},'FaxAccounts':function(){return new Promise(function(_0xdc1cb7){var _0x5b5109=_['values'](_0x126d90[_0x24fc('0x84')]);_0xdc1cb7({'count':_0x5b5109[_0x24fc('0x5b')],'rows':_0x5b5109});});},'SendFax':function(_0x24e27e){var _0x188d0d=this;return new Promise(function(_0x1f263c,_0x49e6f2){_0x58dafc[_0x24fc('0x85')](_0x24e27e)[_0x24fc('0x1a')](function(_0x95ecb1){_0x1f263c({'code':0xc8,'message':_0x95ecb1['message']});})[_0x24fc('0x1d')](function(_0x69a2cd){_0x49e6f2(_0x188d0d[_0x24fc('0x11')](0x1f4,_0x69a2cd[_0x24fc('0x1b')]));});});},'CheckAfterSend':function(_0xc52004){var _0x4c10d9=this;return new Promise(function(_0x52cc49,_0x587e47){_0x58dafc[_0x24fc('0x86')](_0xc52004)[_0x24fc('0x1a')](function(_0x2b7be3){_0x52cc49({'code':0xc8,'message':_0x2b7be3[_0x24fc('0x1b')]});})[_0x24fc('0x1d')](function(_0x2ac3e8){_0x587e47(_0x4c10d9[_0x24fc('0x11')](0x1f4,_0x2ac3e8[_0x24fc('0x1b')]));});});}};var _0x382a1c=jayson[_0x24fc('0x87')](_0x4889f4)[_0x24fc('0x88')]();_0x382a1c['on'](_0x24fc('0x11'),function(_0x5d01ab){return _0x12d602(_0x5d01ab);});_0x382a1c['listen'](0x232a,_0x24fc('0x89'),function(){console['log'](_0x24fc('0x8a'),0x232a);return _0x26fcc6(_0x24fc('0x8b')+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 29ce6b5..933ba63 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 _0xa3fe=['[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','trigger:%s','action','toLowerCase','merge','length','lodash','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','defaults','localhost','socket.io-emitter','redis','stringify','data1','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','mobile','fax','updatedAt','resolve','then','getContacts','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','firstName','calleridname','','Unknown','destcalleridname','createContact','push'];(function(_0xfa973f,_0x56d1ca){var _0x23e4c0=function(_0x4abc7f){while(--_0x4abc7f){_0xfa973f['push'](_0xfa973f['shift']());}};_0x23e4c0(++_0x56d1ca);}(_0xa3fe,0xd8));var _0xea3f=function(_0x273f21,_0x470137){_0x273f21=_0x273f21-0x0;var _0x34d7ec=_0xa3fe[_0x273f21];return _0x34d7ec;};'use strict';var _=require(_0xea3f('0x0'));var BPromise=require('bluebird');var Redis=require(_0xea3f('0x1'));var util=require(_0xea3f('0x2'));var config=require('../../../../config/environment');var logger=require(_0xea3f('0x3'))(_0xea3f('0x4'));var cmContactRpc=require(_0xea3f('0x5'));config['redis']=_[_0xea3f('0x6')](config['redis'],{'host':_0xea3f('0x7'),'port':0x18eb});var io=require(_0xea3f('0x8'))(new Redis(config[_0xea3f('0x9')]));function emit(_0x49e494,_0x56abd6,_0x187ce0,_0x35ba50,_0x3c4807){logger['info']('[CM][%s][%s]',_0x49e494,_0x56abd6['id'],_0x187ce0,_0x35ba50,JSON[_0xea3f('0xa')](_0x3c4807));io['to'](_0x187ce0)['emit'](_0x35ba50,_0x3c4807);}exports['exec']=function(_0x249e8e,_0xa8b25b,_0x414ddb,_0x5a34f2){var _0x4eeb5b,_0x5c8cd3;var _0x3f6c22={};var _0x14d764;var _0x426577=Number(_0x414ddb[_0xea3f('0xb')]);var _0x4a36da=_0x414ddb['data2']?Boolean(Number(_0x414ddb['data2'])):![];var _0x4538b6;var _0x347578=![];if(!_['isNil'](_0x414ddb[_0xea3f('0xc')])){if(_0x414ddb[_0xea3f('0xc')]=='1')_0x347578=!![];}if(!_0x347578){if(_0x5a34f2['xmd-contactid']){_0x3f6c22['id']=_0x5a34f2[_0xea3f('0xd')];}}if(!_0x3f6c22['id']){_0x3f6c22[_0xea3f('0xe')]=_0x426577;_0x4538b6=_0x414ddb[_0xea3f('0xf')]&&_0x414ddb[_0xea3f('0xf')]!=='0'?_0x414ddb[_0xea3f('0xf')][_0xea3f('0x10')](','):[_0xea3f('0x11')];_0x3f6c22[_0xea3f('0x12')]=_[_0xea3f('0x13')](_0x4538b6,function(_0x403fd2){var _0x3a2f1d={};_0x3a2f1d[_0x403fd2]=_0x5a34f2[_0xea3f('0x14')]?_0x5a34f2[_0xea3f('0x15')]:_0x5a34f2[_0xea3f('0x16')];return _0x3a2f1d;});_0x14d764=_0x5a34f2[_0xea3f('0x14')]?_0x5a34f2[_0xea3f('0x15')]:_0x5a34f2[_0xea3f('0x16')];}var _0x35153d=['id','firstName',_0xea3f('0x17'),_0xea3f('0x11'),_0xea3f('0x18'),_0xea3f('0x19'),_0xea3f('0xe'),'createdAt','scheduledAt',_0xea3f('0x1a')];var _0x29dd1f=_['union'](_0x35153d,_0x4538b6);BPromise[_0xea3f('0x1b')]()[_0xea3f('0x1c')](cmContactRpc[_0xea3f('0x1d')]({'attributes':_0x29dd1f,'where':_0x3f6c22,'phone':_0x14d764}))[_0xea3f('0x1c')](function(_0x5f452b){_0x5c8cd3=_0x5f452b;if(!_['isEmpty'](_0x5c8cd3)){if(_0x5c8cd3['length']===0x1){_0x4eeb5b=_0x5c8cd3[0x0];logger[_0xea3f('0x1e')](_0xea3f('0x1f'),_0x5a34f2[_0xea3f('0x20')],_0xa8b25b['id'],_0x4eeb5b['id']);}else{logger[_0xea3f('0x1e')](_0xea3f('0x21'),_0x5a34f2[_0xea3f('0x20')],_0xa8b25b['id'],_[_0xea3f('0x13')](_0x5c8cd3,'id')['join'](','));}return;}else{logger[_0xea3f('0x1e')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x5a34f2[_0xea3f('0x20')],_0xa8b25b['id']);var _0x22cd02={'ListId':_0x426577};var _0x1f66b3=_0x414ddb[_0xea3f('0x22')]&&_0x414ddb[_0xea3f('0x22')]!=='0'?_0x414ddb['data4']:_0xea3f('0x11');if(_0x4a36da){logger['info'](_0xea3f('0x23'),_0x5a34f2[_0xea3f('0x20')],_0xa8b25b['id']);_0x22cd02[_0x1f66b3]=_[_0xea3f('0x24')](_0x5a34f2['routeId'])?_0x5a34f2[_0xea3f('0x16')]:_0x5a34f2[_0xea3f('0x15')];if(_['isNil'](_0x5a34f2[_0xea3f('0x14')])){_0x22cd02[_0xea3f('0x25')]=_0x5a34f2[_0xea3f('0x26')]&&_0x5a34f2[_0xea3f('0x26')]!==_0xea3f('0x27')?_0x5a34f2[_0xea3f('0x26')]:_0xea3f('0x28');}else{_0x22cd02[_0xea3f('0x25')]=_0x5a34f2[_0xea3f('0x29')]&&_0x5a34f2[_0xea3f('0x29')]!==_0xea3f('0x27')?_0x5a34f2[_0xea3f('0x29')]:_0xea3f('0x28');}return BPromise[_0xea3f('0x1b')]()[_0xea3f('0x1c')](cmContactRpc[_0xea3f('0x2a')](_0x22cd02))[_0xea3f('0x1c')](function(_0x11e9f0){_0x4eeb5b=_0x11e9f0;_0x5c8cd3[_0xea3f('0x2b')](_0x11e9f0);if(_0x4eeb5b){logger['info'](_0xea3f('0x2c'),_0x5a34f2[_0xea3f('0x20')],_0xa8b25b['id'],_0x4eeb5b['id']);}return;});}else{logger[_0xea3f('0x1e')](_0xea3f('0x2d'),_0x5a34f2[_0xea3f('0x20')],_0xa8b25b['id']);_0x22cd02[_0x1f66b3]=_[_0xea3f('0x24')](_0x5a34f2[_0xea3f('0x14')])?_0x5a34f2[_0xea3f('0x16')]:_0x5a34f2[_0xea3f('0x15')];if(_['isNil'](_0x5a34f2[_0xea3f('0x14')])){_0x22cd02[_0xea3f('0x25')]=_0x5a34f2[_0xea3f('0x26')]&&_0x5a34f2[_0xea3f('0x26')]!==_0xea3f('0x27')?_0x5a34f2['calleridname']:'Unknown';}else{_0x22cd02[_0xea3f('0x25')]=_0x5a34f2['destcalleridname']&&_0x5a34f2[_0xea3f('0x29')]!==_0xea3f('0x27')?_0x5a34f2[_0xea3f('0x29')]:_0xea3f('0x28');}_0x4eeb5b=_0x22cd02;_0x5c8cd3[_0xea3f('0x2b')](_0x22cd02);return;}}})[_0xea3f('0x1c')](function(){if(_0x249e8e){emit(_0x5a34f2['uniqueid'],_0xa8b25b,util[_0xea3f('0x2e')]('user:%s',_0x249e8e['name']),util[_0xea3f('0x2e')](_0xea3f('0x2f'),_0x414ddb[_0xea3f('0x30')][_0xea3f('0x31')]()),{'evt':_[_0xea3f('0x32')](_0x5a34f2,{'autoCreate':_0x4a36da}),'contact':_0x4eeb5b===undefined?{}:_0x4eeb5b,'contacts':_0x5c8cd3[_0xea3f('0x33')]===0x0?undefined:_0x5c8cd3});}});}; \ No newline at end of file +var _0xbfe2=['data5','xmd-contactid','ListId','data3','phone','$or','map','routeId','calleridnum','destcalleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','action','merge','lodash','bluebird','ioredis','util','../../rpc/cmContact','redis','defaults','info','stringify','emit','exec','data2','isNil'];(function(_0x5da21c,_0x3daf7f){var _0x47ea89=function(_0x1e8140){while(--_0x1e8140){_0x5da21c['push'](_0x5da21c['shift']());}};_0x47ea89(++_0x3daf7f);}(_0xbfe2,0x16d));var _0x2bfe=function(_0x4c9727,_0x4c54a3){_0x4c9727=_0x4c9727-0x0;var _0x2412f6=_0xbfe2[_0x4c9727];return _0x2412f6;};'use strict';var _=require(_0x2bfe('0x0'));var BPromise=require(_0x2bfe('0x1'));var Redis=require(_0x2bfe('0x2'));var util=require(_0x2bfe('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x2bfe('0x4'));config[_0x2bfe('0x5')]=_[_0x2bfe('0x6')](config[_0x2bfe('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x46f6ab,_0x115257,_0x4c9646,_0x43b026,_0x213ab4){logger[_0x2bfe('0x7')]('[CM][%s][%s]',_0x46f6ab,_0x115257['id'],_0x4c9646,_0x43b026,JSON[_0x2bfe('0x8')](_0x213ab4));io['to'](_0x4c9646)[_0x2bfe('0x9')](_0x43b026,_0x213ab4);}exports[_0x2bfe('0xa')]=function(_0x47cd87,_0x2445d7,_0x3208a2,_0x4e5073){var _0x27c3d4,_0x513a31;var _0x1c7a44={};var _0x34e571;var _0x5c940b=Number(_0x3208a2['data1']);var _0x575b4b=_0x3208a2[_0x2bfe('0xb')]?Boolean(Number(_0x3208a2[_0x2bfe('0xb')])):![];var _0x4ec88d;var _0x474a45=![];if(!_[_0x2bfe('0xc')](_0x3208a2[_0x2bfe('0xd')])){if(_0x3208a2['data5']=='1')_0x474a45=!![];}if(!_0x474a45){if(_0x4e5073[_0x2bfe('0xe')]){_0x1c7a44['id']=_0x4e5073[_0x2bfe('0xe')];}}if(!_0x1c7a44['id']){_0x1c7a44[_0x2bfe('0xf')]=_0x5c940b;_0x4ec88d=_0x3208a2[_0x2bfe('0x10')]&&_0x3208a2['data3']!=='0'?_0x3208a2[_0x2bfe('0x10')]['split'](','):[_0x2bfe('0x11')];_0x1c7a44[_0x2bfe('0x12')]=_[_0x2bfe('0x13')](_0x4ec88d,function(_0x2d5f89){var _0x74844a={};_0x74844a[_0x2d5f89]=_0x4e5073[_0x2bfe('0x14')]?_0x4e5073['destcalleridnum']:_0x4e5073[_0x2bfe('0x15')];return _0x74844a;});_0x34e571=_0x4e5073[_0x2bfe('0x14')]?_0x4e5073[_0x2bfe('0x16')]:_0x4e5073[_0x2bfe('0x15')];}var _0x10f5ac=['id',_0x2bfe('0x17'),_0x2bfe('0x18'),_0x2bfe('0x11'),_0x2bfe('0x19'),_0x2bfe('0x1a'),_0x2bfe('0xf'),_0x2bfe('0x1b'),_0x2bfe('0x1c'),_0x2bfe('0x1d')];var _0x468231=_['union'](_0x10f5ac,_0x4ec88d);BPromise[_0x2bfe('0x1e')]()[_0x2bfe('0x1f')](cmContactRpc[_0x2bfe('0x20')]({'attributes':_0x468231,'where':_0x1c7a44,'phone':_0x34e571}))['then'](function(_0x51311a){_0x513a31=_0x51311a;if(!_[_0x2bfe('0x21')](_0x513a31)){if(_0x513a31[_0x2bfe('0x22')]===0x1){_0x27c3d4=_0x513a31[0x0];logger[_0x2bfe('0x7')](_0x2bfe('0x23'),_0x4e5073[_0x2bfe('0x24')],_0x2445d7['id'],_0x27c3d4['id']);}else{logger['info'](_0x2bfe('0x25'),_0x4e5073[_0x2bfe('0x24')],_0x2445d7['id'],_[_0x2bfe('0x13')](_0x513a31,'id')[_0x2bfe('0x26')](','));}return;}else{logger[_0x2bfe('0x7')](_0x2bfe('0x27'),_0x4e5073[_0x2bfe('0x24')],_0x2445d7['id']);var _0x5d6c85={'ListId':_0x5c940b};var _0x1c46ec=_0x3208a2[_0x2bfe('0x28')]&&_0x3208a2['data4']!=='0'?_0x3208a2[_0x2bfe('0x28')]:_0x2bfe('0x11');if(_0x575b4b){logger[_0x2bfe('0x7')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x4e5073['uniqueid'],_0x2445d7['id']);_0x5d6c85[_0x1c46ec]=_[_0x2bfe('0xc')](_0x4e5073[_0x2bfe('0x14')])?_0x4e5073['calleridnum']:_0x4e5073[_0x2bfe('0x16')];if(_[_0x2bfe('0xc')](_0x4e5073[_0x2bfe('0x14')])){_0x5d6c85[_0x2bfe('0x17')]=_0x4e5073[_0x2bfe('0x29')]&&_0x4e5073[_0x2bfe('0x29')]!==_0x2bfe('0x2a')?_0x4e5073['calleridname']:_0x2bfe('0x2b');}else{_0x5d6c85['firstName']=_0x4e5073[_0x2bfe('0x2c')]&&_0x4e5073[_0x2bfe('0x2c')]!==_0x2bfe('0x2a')?_0x4e5073[_0x2bfe('0x2c')]:'Unknown';}return BPromise['resolve']()[_0x2bfe('0x1f')](cmContactRpc[_0x2bfe('0x2d')](_0x5d6c85))[_0x2bfe('0x1f')](function(_0x34efc2){_0x27c3d4=_0x34efc2;_0x513a31[_0x2bfe('0x2e')](_0x34efc2);if(_0x27c3d4){logger[_0x2bfe('0x7')](_0x2bfe('0x2f'),_0x4e5073[_0x2bfe('0x24')],_0x2445d7['id'],_0x27c3d4['id']);}return;});}else{logger['info'](_0x2bfe('0x30'),_0x4e5073[_0x2bfe('0x24')],_0x2445d7['id']);_0x5d6c85[_0x1c46ec]=_[_0x2bfe('0xc')](_0x4e5073[_0x2bfe('0x14')])?_0x4e5073[_0x2bfe('0x15')]:_0x4e5073[_0x2bfe('0x16')];if(_[_0x2bfe('0xc')](_0x4e5073[_0x2bfe('0x14')])){_0x5d6c85[_0x2bfe('0x17')]=_0x4e5073[_0x2bfe('0x29')]&&_0x4e5073['calleridname']!==''?_0x4e5073[_0x2bfe('0x29')]:'Unknown';}else{_0x5d6c85[_0x2bfe('0x17')]=_0x4e5073['destcalleridname']&&_0x4e5073[_0x2bfe('0x2c')]!==_0x2bfe('0x2a')?_0x4e5073[_0x2bfe('0x2c')]:_0x2bfe('0x2b');}_0x27c3d4=_0x5d6c85;_0x513a31[_0x2bfe('0x2e')](_0x5d6c85);return;}}})[_0x2bfe('0x1f')](function(){if(_0x47cd87){emit(_0x4e5073[_0x2bfe('0x24')],_0x2445d7,util[_0x2bfe('0x31')]('user:%s',_0x47cd87[_0x2bfe('0x32')]),util[_0x2bfe('0x31')](_0x2bfe('0x33'),_0x3208a2[_0x2bfe('0x34')]['toLowerCase']()),{'evt':_[_0x2bfe('0x35')](_0x4e5073,{'autoCreate':_0x575b4b}),'contact':_0x27c3d4===undefined?{}:_0x27c3d4,'contacts':_0x513a31['length']===0x0?undefined:_0x513a31});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 91c03ea..8fc20ca 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 _0x9bc7=['servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:timeout','syncAgentDial','custom:newinteraction','custom:substatus','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','info','emit','clone','motionChannel','voice','checkTriggers','interface','triggers','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','data1','TemplateId','data2','html','render','uri','buildUri','data3','isNil','data4','uriLocation','data5','800','windowHeight','data6','winApplication','winArguments','user:%s','name','format','trigger:%s:%s','jscripty','trigger:%s','exec','integration','queue','urlforward','parse','query','search','replace','channel','AllConditions','every','AnyConditions','checkConditions','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','event','agent','membername','lastevent','routeId','null','substatus','offlineMessage','equals','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','trigger','../ami','redis','socket.io-emitter','popup','winapp','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9bc7,0x1cd));var _0x79bc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9bc7[_0x397e5f];return _0x5302b8;};'use strict';var util=require(_0x79bc('0x0'));var _=require(_0x79bc('0x1'));var url=require(_0x79bc('0x2'));var Mustache=require(_0x79bc('0x3'));var Redis=require(_0x79bc('0x4'));var urlforward=require(_0x79bc('0x5'));var integration=require(_0x79bc('0x6'));var cmContact=require(_0x79bc('0x7'));var script=require(_0x79bc('0x8'));var config=require(_0x79bc('0x9'));var logger=require('../../../config/logger')(_0x79bc('0xa'));var ami=require(_0x79bc('0xb'));config[_0x79bc('0xc')]=_['defaults'](config[_0x79bc('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x79bc('0xd'))(new Redis(config[_0x79bc('0xc')]));var operators={'equals':function(_0x11c9a1,_0x3727d4){return _0x11c9a1==_0x3727d4;},'not_equals':function(_0x6f370e,_0x5046ba){return _0x6f370e!=_0x5046ba;}};var barAndWebActions=[_0x79bc('0xe'),'url',_0x79bc('0xf')];function Trigger(_0x3c5c73){this['triggers']=_0x3c5c73['triggers'];this[_0x79bc('0x10')]=_0x3c5c73[_0x79bc('0x10')];this[_0x79bc('0x11')]=_0x3c5c73[_0x79bc('0x11')];this[_0x79bc('0x12')]=_0x3c5c73[_0x79bc('0x12')];this[_0x79bc('0x13')]=_0x3c5c73[_0x79bc('0x13')];this['zendeskAccounts']=_0x3c5c73[_0x79bc('0x14')];this[_0x79bc('0x15')]=_0x3c5c73[_0x79bc('0x15')];this[_0x79bc('0x16')]=_0x3c5c73[_0x79bc('0x16')];this[_0x79bc('0x17')]=_0x3c5c73['sugarcrmAccounts'];this[_0x79bc('0x18')]=_0x3c5c73[_0x79bc('0x18')];this['deskAccounts']=_0x3c5c73[_0x79bc('0x19')];this['vtigerAccounts']=_0x3c5c73[_0x79bc('0x1a')];this[_0x79bc('0x1b')]=_0x3c5c73['servicenowAccounts'];this[_0x79bc('0x1c')]=_0x3c5c73[_0x79bc('0x1c')];this[_0x79bc('0x1d')]=_0x3c5c73[_0x79bc('0x1d')];this[_0x79bc('0x1e')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x79bc('0x16')],'freshdesk':this[_0x79bc('0x15')],'sugarcrm':this[_0x79bc('0x17')],'zoho':this[_0x79bc('0x18')],'desk':this['deskAccounts'],'vtiger':this[_0x79bc('0x1a')],'dynamics365':this['dynamics365Accounts'],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x79bc('0x1b')]};ami['on'](_0x79bc('0x1f'),this[_0x79bc('0x20')]['bind'](this));ami['on'](_0x79bc('0x21'),this[_0x79bc('0x20')][_0x79bc('0x22')](this));ami['on'](_0x79bc('0x23'),this[_0x79bc('0x20')][_0x79bc('0x22')](this));ami['on']('custom:agentcomplete',this['syncCustomEvent'][_0x79bc('0x22')](this));ami['on'](_0x79bc('0x24'),this[_0x79bc('0x20')][_0x79bc('0x22')](this));ami['on'](_0x79bc('0x25'),this[_0x79bc('0x20')][_0x79bc('0x22')](this));ami['on'](_0x79bc('0x26'),this[_0x79bc('0x20')][_0x79bc('0x22')](this));ami['on'](_0x79bc('0x27'),this[_0x79bc('0x20')]['bind'](this));ami['on']('custom:agentreject',this[_0x79bc('0x20')][_0x79bc('0x22')](this));ami['on']('custom:amd',this[_0x79bc('0x20')][_0x79bc('0x22')](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent']['bind'](this));ami['on'](_0x79bc('0x28'),this[_0x79bc('0x20')][_0x79bc('0x22')](this));ami['on']('custom:dialbegin',this[_0x79bc('0x29')][_0x79bc('0x22')](this));ami['on']('custom:dialconnect',this['syncAgentDial'][_0x79bc('0x22')](this));ami['on']('custom:dialend',this[_0x79bc('0x29')][_0x79bc('0x22')](this));ami['on'](_0x79bc('0x2a'),this['syncCustomEvent'][_0x79bc('0x22')](this));ami['on']('custom:closedinteraction',this[_0x79bc('0x20')][_0x79bc('0x22')](this));ami['on'](_0x79bc('0x2b'),this[_0x79bc('0x20')][_0x79bc('0x22')](this));ami['on']('custom:incomingmessage',this[_0x79bc('0x20')][_0x79bc('0x22')](this));ami['on'](_0x79bc('0x2c'),this[_0x79bc('0x20')]['bind'](this));ami['on'](_0x79bc('0x2d'),this[_0x79bc('0x20')]['bind'](this));ami['on'](_0x79bc('0x2e'),this[_0x79bc('0x20')][_0x79bc('0x22')](this));ami['on']('custom:offlineMessage',this[_0x79bc('0x20')][_0x79bc('0x22')](this));}Trigger[_0x79bc('0x2f')]['emit']=function(_0xb53a7d,_0x5030b6,_0x5b7f1c){logger[_0x79bc('0x30')](_0xb53a7d,_0x5030b6,JSON['stringify'](_0x5b7f1c));io['to'](_0xb53a7d)[_0x79bc('0x31')](_0x5030b6,_0x5b7f1c);};Trigger[_0x79bc('0x2f')][_0x79bc('0x20')]=function(_0x77325c){var _0x24d88a=_[_0x79bc('0x32')](_0x77325c);if(typeof _0x24d88a['motionChannel']==='undefined'){_0x24d88a[_0x79bc('0x33')]=_0x79bc('0x34');}this[_0x79bc('0x35')](_0x24d88a);};Trigger['prototype'][_0x79bc('0x29')]=function(_0x57cc09){if(this['agents'][_0x57cc09[_0x79bc('0x36')]]){this[_0x79bc('0x20')](_0x57cc09);}};Trigger[_0x79bc('0x2f')][_0x79bc('0x35')]=function(_0x36a24c){var _0x17f9bc;for(var _0x7144d2 in this[_0x79bc('0x37')]){if(this[_0x79bc('0x37')][_0x79bc('0x38')](_0x7144d2)){if(this['triggers'][_0x7144d2][_0x79bc('0x39')]){_0x17f9bc=this[_0x79bc('0x3a')](this['triggers'][_0x7144d2],_0x36a24c);if(_0x17f9bc){_[_0x79bc('0x3b')](_0x36a24c,_0x36a24c[_0x79bc('0x3c')]);for(var _0x32ac3c=0x0,_0x34eab0,_0x107f62,_0x5a64a1;_0x32ac3c0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x42bafd,_0x3f0fe3){_0x42bafd=_0x42bafd-0x0;var _0x2ed705=_0x5fc3[_0x42bafd];return _0x2ed705;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 1e1e0ce..cdb3a95 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 _0xc6dd=['https://login.microsoftonline.com/%s/oauth2/token','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s','openNewTab','name','catch',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','ioredis','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','data5','POST','username','password','then','error','toUpperCase',']\x20Wrong\x20credentials!','GET','Bearer\x20','isNil','validateEmail','email','userEmail','length','internalemailaddress',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','destcalleridnum','calleridnum','contacts','/systemusers(','4.0','headers','lastIndexOf','message','toLowerCase','contacts?$select=','&$filter=','replace','%2b','value','enduserId','info',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','customField','indexOf','substring','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','phonecall','queue','callDirection','Subjects','Fields','format','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','outbound','%s/api/data/v9.0/'];(function(_0x330fdc,_0x3fdba4){var _0x2edb38=function(_0x4f79e8){while(--_0x4f79e8){_0x330fdc['push'](_0x330fdc['shift']());}};_0x2edb38(++_0x3fdba4);}(_0xc6dd,0x18d));var _0xdc6d=function(_0xfd3034,_0x4ad7a9){_0xfd3034=_0xfd3034-0x0;var _0x8e0e16=_0xc6dd[_0xfd3034];return _0x8e0e16;};'use strict';var _=require(_0xdc6d('0x0'));var rp=require(_0xdc6d('0x1'));var util=require('util');var intUtil=require(_0xdc6d('0x2'));var md5=require('md5');var Redis=require(_0xdc6d('0x3'));var logger=require('../../../../config/logger')(_0xdc6d('0x4'));var config=require(_0xdc6d('0x5'));config[_0xdc6d('0x6')]=_[_0xdc6d('0x7')](config[_0xdc6d('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xdc6d('0x8'))(new Redis(config[_0xdc6d('0x6')]));function getAuthToken(_0x2332e8,_0x4b8977,_0xd6723b){if(_0x2332e8[_0xdc6d('0x9')]){_0x2332e8[_0xdc6d('0xa')]=_0x2332e8[_0xdc6d('0xb')][_0xdc6d('0xc')];_0x2332e8[_0xdc6d('0xd')]=_0x2332e8[_0xdc6d('0xb')][_0xdc6d('0xe')];return Promise['resolve'](_0x2332e8[_0xdc6d('0xb')][_0xdc6d('0xf')]);}var _0x41115c={'method':_0xdc6d('0x10'),'uri':_0x4b8977,'form':{'client_id':_0x2332e8['clientId'],'resource':_0x2332e8[_0xdc6d('0xa')],'username':_0x2332e8[_0xdc6d('0x11')],'password':_0x2332e8[_0xdc6d('0x12')],'grant_type':_0xdc6d('0x12'),'client_secret':_0x2332e8['clientSecret']},'json':!![]};return rp(_0x41115c)[_0xdc6d('0x13')](function(_0x465fdd){return _0x465fdd['access_token'];})['catch'](function(_0x2537f5){logger[_0xdc6d('0x14')]('['+[_0xd6723b[_0xdc6d('0x15')]()]+_0xdc6d('0x16'));return _0x2537f5['message'];});}function getUser(_0x4d2b17,_0x3942cf,_0x237452,_0x4c6e5d,_0x4ed308,_0x2ba446){return new Promise(function(_0x2c9879,_0x5c77d3){return getAuthToken(_0x3942cf,_0x4c6e5d,_0x2ba446)[_0xdc6d('0x13')](function(_0x10ea65){var _0x5e1e08={'method':_0xdc6d('0x17'),'uri':_0x4ed308+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xdc6d('0x18')+_0x10ea65,'OData-Version':'4.0'},'json':!![]};return rp(_0x5e1e08);})[_0xdc6d('0x13')](function(_0x3353c6){var _0x2ba602=_0x3353c6['value'];var _0x51f8c6=![];var _0x326691=null;if(!_[_0xdc6d('0x19')](_0x237452)){if(intUtil[_0xdc6d('0x1a')](_0x237452[_0xdc6d('0x1b')])){_0x4d2b17[_0xdc6d('0x1c')]=_0x237452[_0xdc6d('0x1b')];for(_0x326691=0x0;_0x326691<_0x2ba602[_0xdc6d('0x1d')];_0x326691++){if(_0x2ba602[_0x326691][_0xdc6d('0x1e')]===_0x237452[_0xdc6d('0x1b')]&&!_0x2ba602[_0x326691]['isdisabled']){_0x51f8c6=!![];logger['info']('['+[_0x2ba446[_0xdc6d('0x15')]()]+_0xdc6d('0x1f')+_0x2ba602[_0x326691]['systemuserid']+'!');_0x4d2b17[_0xdc6d('0x20')]=_0x2ba602[_0x326691][_0xdc6d('0x21')];}}}}if(!_0x51f8c6){logger['info']('['+[_0x2ba446['toUpperCase']()]+_0xdc6d('0x22'));_0x4d2b17[_0xdc6d('0x1c')]=_0x3942cf[_0xdc6d('0x11')];for(_0x326691=0x0;_0x326691<_0x2ba602[_0xdc6d('0x1d')];_0x326691++){if(_0x2ba602[_0x326691][_0xdc6d('0x1e')]===_0x3942cf[_0xdc6d('0x11')]){_0x4d2b17[_0xdc6d('0x20')]=_0x2ba602[_0x326691][_0xdc6d('0x21')];}}}_0x2c9879(_0x4d2b17);})['catch'](function(_0x3e0ce7){_0x5c77d3(_0x3e0ce7['message']);});});}function createEndUser(_0x35c5c9,_0x4a8596,_0x4d2e14,_0x3ec2cf,_0x5643b7,_0x2713b2,_0x4ddfe8){return new Promise(function(_0x46af59,_0x430ab8){return getAuthToken(_0x4a8596,_0x4d2e14,_0x2713b2)[_0xdc6d('0x13')](function(_0x13b5ac){var _0x3454eb=_0x2713b2['toLowerCase']()==='outbound'?_0x5643b7[_0xdc6d('0x23')]:_0x5643b7[_0xdc6d('0x24')];var _0x24017e={'method':_0xdc6d('0x10'),'uri':_0x3ec2cf+_0xdc6d('0x25'),'body':{'fullname':_0x3454eb,'firstname':_0x3454eb,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xdc6d('0x26')+_0x35c5c9['userId']+')'},'headers':{'Authorization':_0xdc6d('0x18')+_0x13b5ac,'OData-Version':_0xdc6d('0x27')},'json':!![],'resolveWithFullResponse':!![]};_0x24017e['body'][_0x4ddfe8]=_0x3454eb;return rp(_0x24017e);})[_0xdc6d('0x13')](function(_0x185f70){var _0x1f5bcc=_0x185f70[_0xdc6d('0x28')]['odata-entityid'];var _0x206ec1=_0x1f5bcc['substring'](_0x1f5bcc[_0xdc6d('0x29')]('(')+0x1,_0x1f5bcc[_0xdc6d('0x29')](')'));_0x35c5c9['enduserId']=_0x206ec1;_0x46af59(_0x35c5c9);})['catch'](function(_0x1a6c8e){_0x430ab8(_0x1a6c8e[_0xdc6d('0x2a')]);});});}function getEndUser(_0x2357b3,_0x4153a5,_0x1e52fa,_0x21804e,_0x3ef1a4,_0x1bc518,_0x1650c2,_0x104937){var _0x4791e6=_0x1bc518[_0xdc6d('0x2b')]()==='outbound'?_0x3ef1a4['destcalleridnum']:_0x3ef1a4[_0xdc6d('0x24')];return getAuthToken(_0x4153a5,_0x1e52fa,_0x1bc518)['then'](function(_0xa23353){_0x104937=_0x104937?_0x104937:'telephone1';var _0x1f3b91={'method':_0xdc6d('0x17'),'uri':_0x21804e+_0xdc6d('0x2c')+_0x104937+_0xdc6d('0x2d')+_0x104937+'\x20eq\x20\x27'+_0x4791e6[_0xdc6d('0x2e')]('+',_0xdc6d('0x2f'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0xa23353,'If-None-Match':null,'OData-Version':_0xdc6d('0x27')},'json':!![]};return rp(_0x1f3b91);})[_0xdc6d('0x13')](function(_0x311e5b){var _0x12fd64=![];if(!_0x311e5b)return _0x12fd64;var _0x388703=_0x311e5b[_0xdc6d('0x30')];for(var _0x43f176=0x0;_0x43f176<_0x388703[_0xdc6d('0x1d')];_0x43f176++){if(_0x388703[_0x43f176][_0x104937]===_0x4791e6){_0x12fd64=!![];_0x2357b3[_0xdc6d('0x31')]=_0x388703[_0x43f176]['contactid'];}}return _0x12fd64;})['then'](function(_0x1cf86f){if(_0x1cf86f)return _0x2357b3;if(_0x1650c2==='nothing'){logger[_0xdc6d('0x32')]('['+[_0x1bc518[_0xdc6d('0x15')]()]+_0xdc6d('0x33'));return _0x2357b3;}return createEndUser(_0x2357b3,_0x4153a5,_0x1e52fa,_0x21804e,_0x3ef1a4,_0x1bc518,_0x104937)['then'](function(_0x321a8b){logger['info']('['+[_0x1bc518['toUpperCase']()]+_0xdc6d('0x34'),_0x321a8b[_0xdc6d('0x31')]);return _0x321a8b;});});}function getCustomFields(_0x55ec79,_0x2aca83,_0x5604c3){var _0x38e5d3={};if(_0x55ec79['length']>0x0){_[_0xdc6d('0x35')](_0x55ec79,function(_0x580e4a){if(_['includes']([_0xdc6d('0x36'),'picklist'],_0x580e4a['type'])&&_0x580e4a['nameField']&&!_0x580e4a[_0xdc6d('0x37')]){var _0x1fa6b7=_0x580e4a['idField'][_0xdc6d('0x2b')]();var _0x1fe09a=_0x1fa6b7['substring'](0x0,_0x1fa6b7[_0xdc6d('0x38')]('_'));var _0x188fc7=_0x1fa6b7[_0xdc6d('0x39')](_0x1fa6b7[_0xdc6d('0x38')]('_')+0x1);if(_0x1fe09a===_0x5604c3){_0x38e5d3[_0x188fc7]=_0x580e4a['content'];}}});}return _0x38e5d3;}function getTicket(_0x124c22,_0x372a40,_0x14397c,_0x258cb8,_0x98781b,_0x5e5611,_0x34aa75){return new Promise(function(_0x575487,_0x3a6cc9){var _0x533e4e;return getAuthToken(_0x372a40,_0x14397c,_0x34aa75)[_0xdc6d('0x13')](function(_0x2fba57){if(_0x5e5611[_0xdc6d('0x3a')]===_0xdc6d('0x3b')){_0x533e4e={'method':_0xdc6d('0x10'),'uri':_0x258cb8+_0xdc6d('0x3c'),'body':Object[_0xdc6d('0x3d')]({},{'title':intUtil[_0xdc6d('0x3e')](_0x5e5611['Subjects'],_0x98781b,'\x20'),'description':intUtil[_0xdc6d('0x3e')](_0x5e5611[_0xdc6d('0x3f')],_0x98781b,'\x0a'),'customerid_contact@odata.bind':_0x124c22['enduserId']?_0xdc6d('0x40')+_0x124c22[_0xdc6d('0x31')]+')':undefined,'ownerid@odata.bind':_0xdc6d('0x26')+_0x124c22[_0xdc6d('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x5e5611['Fields'],_0x98781b,_0x5e5611['ticketType'])),'headers':{'Authorization':_0xdc6d('0x18')+_0x2fba57,'OData-Version':_0xdc6d('0x27')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5e5611[_0xdc6d('0x3a')]===_0xdc6d('0x41')){var _0x4dbae2=_0x124c22[_0xdc6d('0x31')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x124c22[_0xdc6d('0x20')]+')','participationtypemask':_0x124c22['callDirection']===_0xdc6d('0x42')?0x2:0x1},{'partyid_contact@odata.bind':_0xdc6d('0x40')+_0x124c22[_0xdc6d('0x31')]+')','participationtypemask':_0x124c22[_0xdc6d('0x43')]===_0xdc6d('0x42')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xdc6d('0x26')+_0x124c22[_0xdc6d('0x20')]+')','participationtypemask':_0x124c22[_0xdc6d('0x43')]===_0xdc6d('0x42')?0x2:0x1}];_0x533e4e={'method':_0xdc6d('0x10'),'uri':_0x258cb8+'phonecalls','body':Object[_0xdc6d('0x3d')]({},{'subject':intUtil[_0xdc6d('0x3e')](_0x5e5611[_0xdc6d('0x44')],_0x98781b,'\x20'),'phonenumber':String(_0x98781b[_0xdc6d('0x24')]),'description':intUtil['getString'](_0x5e5611[_0xdc6d('0x3f')],_0x98781b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x124c22[_0xdc6d('0x31')]?_0xdc6d('0x40')+_0x124c22[_0xdc6d('0x31')]+')':undefined,'ownerid@odata.bind':_0xdc6d('0x26')+_0x124c22[_0xdc6d('0x20')]+')','directioncode':_0x124c22[_0xdc6d('0x43')]==='queue'?![]:!![],'phonecall_activity_parties':_0x4dbae2},getCustomFields(_0x5e5611[_0xdc6d('0x45')],_0x98781b,_0x5e5611[_0xdc6d('0x3a')])),'headers':{'Authorization':_0xdc6d('0x18')+_0x2fba57,'OData-Version':_0xdc6d('0x27')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x533e4e);})[_0xdc6d('0x13')](function(_0x106421){var _0x19e630=_0x106421[_0xdc6d('0x28')]['odata-entityid'];var _0x3e6831=_0x19e630[_0xdc6d('0x39')](_0x19e630[_0xdc6d('0x29')]('(')+0x1,_0x19e630['lastIndexOf'](')'));_0x124c22['ticketId']=_0x3e6831;_0x575487(_0x124c22);})['catch'](function(_0x9bc797){_0x3a6cc9(_0x9bc797['message']);});});}function emit(_0x3d58c0,_0x44699a,_0x1442b4,_0x4bd7c3){var _0x3b1f45={'uri':util[_0xdc6d('0x46')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x3d58c0,_0x1442b4,_0x4bd7c3)};io['to'](util[_0xdc6d('0x46')](_0xdc6d('0x47'),_0x44699a))[_0xdc6d('0x48')]('trigger:browser:url',_0x3b1f45);}exports['cs']=function(_0x240edc,_0x371022,_0x4146dd,_0x132b26,_0x505956,_0x376092,_0x476e58,_0x468d38){var _0x10a64b={};_0x376092[_0xdc6d('0xa')]=_0x376092[_0xdc6d('0x9')]?intUtil[_0xdc6d('0x49')](_0x376092[_0xdc6d('0xb')][_0xdc6d('0xc')]):intUtil[_0xdc6d('0x49')](_0x376092[_0xdc6d('0xa')]);_0x376092[_0xdc6d('0x4a')]=intUtil[_0xdc6d('0x49')](_0x376092[_0xdc6d('0x4a')]);_0x10a64b[_0xdc6d('0x43')]=_0x468d38==='queue'||_0x468d38===_0xdc6d('0x4b')?_0xdc6d('0x42'):_0xdc6d('0x4c');var _0x3739ca=_0x376092['modernAuthentication']?util[_0xdc6d('0x46')](_0xdc6d('0x4d'),_0x376092['CloudProvider'][_0xdc6d('0xc')]):util[_0xdc6d('0x46')](_0xdc6d('0x4d'),_0x376092[_0xdc6d('0xa')]);var _0x3e470d=util[_0xdc6d('0x46')](_0xdc6d('0x4e'),_0x376092[_0xdc6d('0xd')]);var _0x34c98d=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x376092[_0xdc6d('0x4a')],_0x371022[_0xdc6d('0x4f')],md5(_0x371022[_0xdc6d('0x4f')]));if(_0x505956&&_0x505956['monitor_format']){logger[_0xdc6d('0x32')](_0xdc6d('0x50'),_0xdc6d('0x51'));_0x371022[_0xdc6d('0x52')]=_0x34c98d;}else if(_0x476e58&&_0x476e58[_0xdc6d('0x53')]&&_0x476e58[_0xdc6d('0x53')]!=='none'){logger[_0xdc6d('0x32')](_0xdc6d('0x54'),_0xdc6d('0x51'));_0x371022[_0xdc6d('0x52')]=_0x34c98d;}else{_0x371022[_0xdc6d('0x52')]='';}return getUser(_0x10a64b,_0x376092,_0x132b26,_0x3e470d,_0x3739ca,_0x468d38)[_0xdc6d('0x13')](function(_0xccf166){logger[_0xdc6d('0x32')]('['+_0x468d38[_0xdc6d('0x15')]()+_0xdc6d('0x55'),_0xccf166[_0xdc6d('0x20')]);logger['info']('['+_0x468d38[_0xdc6d('0x15')]()+']\x20The\x20User\x20email\x20is:',_0xccf166['userEmail']);return getEndUser(_0xccf166,_0x376092,_0x3e470d,_0x3739ca,_0x371022,_0x468d38,_0x4146dd['moduleCreate'],_0x4146dd[_0xdc6d('0x56')]);})[_0xdc6d('0x13')](function(_0x1b7e76){logger[_0xdc6d('0x32')]('['+_0x468d38[_0xdc6d('0x15')]()+_0xdc6d('0x57'),_0x1b7e76['enduserId']);logger[_0xdc6d('0x32')]('['+_0x468d38['toUpperCase']()+_0xdc6d('0x58'),_0x371022[_0xdc6d('0x24')]);return getTicket(_0x1b7e76,_0x376092,_0x3e470d,_0x3739ca,_0x371022,_0x4146dd,_0x468d38);})['then'](function(_0x176ade){logger[_0xdc6d('0x32')](util[_0xdc6d('0x46')]('['+_0x468d38[_0xdc6d('0x15')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x4146dd[_0xdc6d('0x3a')],_0x176ade[_0xdc6d('0x59')]));logger['info'](util[_0xdc6d('0x46')]('['+_0x468d38['toUpperCase']()+_0xdc6d('0x5a'),_0x468d38));if(_0x468d38!=='unmanaged'&&_0x4146dd[_0xdc6d('0x5b')]){logger[_0xdc6d('0x32')]('['+_0x468d38[_0xdc6d('0x15')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x376092[_0xdc6d('0xa')],_0x132b26[_0xdc6d('0x5c')],_0x4146dd['ticketType'],_0x176ade[_0xdc6d('0x59')]);}})[_0xdc6d('0x5d')](function(_0x53dacb){logger[_0xdc6d('0x14')]('['+_0x468d38[_0xdc6d('0x15')]()+_0xdc6d('0x5e'),_0x53dacb[_0xdc6d('0x2a')]);console[_0xdc6d('0x14')]('Error\x20running\x20Dynamics365\x20integration',_0x53dacb);});}; \ No newline at end of file +var _0xb2b8=['/systemusers(','body','odata-entityid','substring','lastIndexOf','destcalleridnum','telephone1','contacts?$select=','\x20eq\x20\x27','replace','%2b','enduserId','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','toUpperCase',']\x20Enduser\x20created!','forEach','string','picklist','nameField','customField','indexOf','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','callDirection','queue','phonecalls','calleridnum','headers','ticketId','format','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter','modernAuthentication','remoteUri','data7','tenantId','CloudProvider','data2','POST','username','password','error',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','then','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','outbound','contacts'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xb2b8,0x1d8));var _0x8b2b=function(_0x2582b4,_0xe02d5c){_0x2582b4=_0x2582b4-0x0;var _0x925e7e=_0xb2b8[_0x2582b4];return _0x925e7e;};'use strict';var _=require('lodash');var rp=require(_0x8b2b('0x0'));var util=require(_0x8b2b('0x1'));var intUtil=require(_0x8b2b('0x2'));var md5=require(_0x8b2b('0x3'));var Redis=require(_0x8b2b('0x4'));var logger=require(_0x8b2b('0x5'))(_0x8b2b('0x6'));var config=require(_0x8b2b('0x7'));config[_0x8b2b('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8b2b('0x9'))(new Redis(config['redis']));function getAuthToken(_0x101904,_0x3a1e3b,_0x5da645){if(_0x101904[_0x8b2b('0xa')]){_0x101904[_0x8b2b('0xb')]=_0x101904['CloudProvider'][_0x8b2b('0xc')];_0x101904[_0x8b2b('0xd')]=_0x101904[_0x8b2b('0xe')][_0x8b2b('0xf')];return Promise['resolve'](_0x101904[_0x8b2b('0xe')]['data5']);}var _0x2ca8b0={'method':_0x8b2b('0x10'),'uri':_0x3a1e3b,'form':{'client_id':_0x101904['clientId'],'resource':_0x101904[_0x8b2b('0xb')],'username':_0x101904[_0x8b2b('0x11')],'password':_0x101904['password'],'grant_type':_0x8b2b('0x12'),'client_secret':_0x101904['clientSecret']},'json':!![]};return rp(_0x2ca8b0)['then'](function(_0xcc41b7){return _0xcc41b7['access_token'];})['catch'](function(_0x142072){logger[_0x8b2b('0x13')]('['+[_0x5da645['toUpperCase']()]+_0x8b2b('0x14'));return _0x142072[_0x8b2b('0x15')];});}function getUser(_0x35fed2,_0x15a3e5,_0x17fac0,_0x17b659,_0x4efb91,_0x31a97a){return new Promise(function(_0x5dde13,_0x499f92){return getAuthToken(_0x15a3e5,_0x17b659,_0x31a97a)['then'](function(_0x1c4354){var _0x34ddb7={'method':_0x8b2b('0x16'),'uri':_0x4efb91+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x8b2b('0x17')+_0x1c4354,'OData-Version':_0x8b2b('0x18')},'json':!![]};return rp(_0x34ddb7);})[_0x8b2b('0x19')](function(_0x31cfd0){var _0x1a59a8=_0x31cfd0[_0x8b2b('0x1a')];var _0x3f89ce=![];var _0x1d4ad5=null;if(!_[_0x8b2b('0x1b')](_0x17fac0)){if(intUtil[_0x8b2b('0x1c')](_0x17fac0[_0x8b2b('0x1d')])){_0x35fed2[_0x8b2b('0x1e')]=_0x17fac0[_0x8b2b('0x1d')];for(_0x1d4ad5=0x0;_0x1d4ad5<_0x1a59a8[_0x8b2b('0x1f')];_0x1d4ad5++){if(_0x1a59a8[_0x1d4ad5][_0x8b2b('0x20')]===_0x17fac0[_0x8b2b('0x1d')]&&!_0x1a59a8[_0x1d4ad5][_0x8b2b('0x21')]){_0x3f89ce=!![];logger[_0x8b2b('0x22')]('['+[_0x31a97a['toUpperCase']()]+_0x8b2b('0x23')+_0x1a59a8[_0x1d4ad5][_0x8b2b('0x24')]+'!');_0x35fed2[_0x8b2b('0x25')]=_0x1a59a8[_0x1d4ad5]['systemuserid'];}}}}if(!_0x3f89ce){logger[_0x8b2b('0x22')]('['+[_0x31a97a['toUpperCase']()]+_0x8b2b('0x26'));_0x35fed2[_0x8b2b('0x1e')]=_0x15a3e5[_0x8b2b('0x11')];for(_0x1d4ad5=0x0;_0x1d4ad5<_0x1a59a8[_0x8b2b('0x1f')];_0x1d4ad5++){if(_0x1a59a8[_0x1d4ad5][_0x8b2b('0x20')]===_0x15a3e5['username']){_0x35fed2[_0x8b2b('0x25')]=_0x1a59a8[_0x1d4ad5][_0x8b2b('0x24')];}}}_0x5dde13(_0x35fed2);})[_0x8b2b('0x27')](function(_0x489d19){_0x499f92(_0x489d19['message']);});});}function createEndUser(_0x434f62,_0x47c0c2,_0x1edd9e,_0x872f2b,_0x17df15,_0x66813,_0x76d55a){return new Promise(function(_0x1f3bb2,_0x555f36){return getAuthToken(_0x47c0c2,_0x1edd9e,_0x66813)[_0x8b2b('0x19')](function(_0x1abb21){var _0x3c4bed=_0x66813[_0x8b2b('0x28')]()===_0x8b2b('0x29')?_0x17df15['destcalleridnum']:_0x17df15['calleridnum'];var _0x3b54f4={'method':'POST','uri':_0x872f2b+_0x8b2b('0x2a'),'body':{'fullname':_0x3c4bed,'firstname':_0x3c4bed,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x8b2b('0x2b')+_0x434f62[_0x8b2b('0x25')]+')'},'headers':{'Authorization':_0x8b2b('0x17')+_0x1abb21,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x3b54f4[_0x8b2b('0x2c')][_0x76d55a]=_0x3c4bed;return rp(_0x3b54f4);})['then'](function(_0x970a7a){var _0x51d655=_0x970a7a['headers'][_0x8b2b('0x2d')];var _0x2f0876=_0x51d655[_0x8b2b('0x2e')](_0x51d655[_0x8b2b('0x2f')]('(')+0x1,_0x51d655[_0x8b2b('0x2f')](')'));_0x434f62['enduserId']=_0x2f0876;_0x1f3bb2(_0x434f62);})['catch'](function(_0x1b2c0c){_0x555f36(_0x1b2c0c[_0x8b2b('0x15')]);});});}function getEndUser(_0x1bd4ea,_0x505f1e,_0xa369b3,_0x26c5f7,_0x36fea3,_0x568b60,_0x4bc8d6,_0x1f087e){var _0x3621fc=_0x568b60[_0x8b2b('0x28')]()===_0x8b2b('0x29')?_0x36fea3[_0x8b2b('0x30')]:_0x36fea3['calleridnum'];return getAuthToken(_0x505f1e,_0xa369b3,_0x568b60)[_0x8b2b('0x19')](function(_0x392b3b){_0x1f087e=_0x1f087e?_0x1f087e:_0x8b2b('0x31');var _0x44b745={'method':_0x8b2b('0x16'),'uri':_0x26c5f7+_0x8b2b('0x32')+_0x1f087e+'&$filter='+_0x1f087e+_0x8b2b('0x33')+_0x3621fc[_0x8b2b('0x34')]('+',_0x8b2b('0x35'))+'\x27','headers':{'Authorization':_0x8b2b('0x17')+_0x392b3b,'If-None-Match':null,'OData-Version':_0x8b2b('0x18')},'json':!![]};return rp(_0x44b745);})[_0x8b2b('0x19')](function(_0x5b9c8d){var _0x2b1539=![];if(!_0x5b9c8d)return _0x2b1539;var _0x5aa0bf=_0x5b9c8d[_0x8b2b('0x1a')];for(var _0x35756e=0x0;_0x35756e<_0x5aa0bf[_0x8b2b('0x1f')];_0x35756e++){if(_0x5aa0bf[_0x35756e][_0x1f087e]===_0x3621fc){_0x2b1539=!![];_0x1bd4ea[_0x8b2b('0x36')]=_0x5aa0bf[_0x35756e][_0x8b2b('0x37')];}}return _0x2b1539;})['then'](function(_0x58d6f0){if(_0x58d6f0)return _0x1bd4ea;if(_0x4bc8d6==='nothing'){logger[_0x8b2b('0x22')]('['+[_0x568b60['toUpperCase']()]+_0x8b2b('0x38'));return _0x1bd4ea;}return createEndUser(_0x1bd4ea,_0x505f1e,_0xa369b3,_0x26c5f7,_0x36fea3,_0x568b60,_0x1f087e)[_0x8b2b('0x19')](function(_0x5f52e6){logger[_0x8b2b('0x22')]('['+[_0x568b60[_0x8b2b('0x39')]()]+_0x8b2b('0x3a'),_0x5f52e6[_0x8b2b('0x36')]);return _0x5f52e6;});});}function getCustomFields(_0x52f2d4,_0x43e381,_0x26a5c3){var _0x3436c9={};if(_0x52f2d4[_0x8b2b('0x1f')]>0x0){_[_0x8b2b('0x3b')](_0x52f2d4,function(_0x5e9d7a){if(_['includes']([_0x8b2b('0x3c'),_0x8b2b('0x3d')],_0x5e9d7a['type'])&&_0x5e9d7a[_0x8b2b('0x3e')]&&!_0x5e9d7a[_0x8b2b('0x3f')]){var _0x2fd8a1=_0x5e9d7a['idField'][_0x8b2b('0x28')]();var _0x22bce9=_0x2fd8a1[_0x8b2b('0x2e')](0x0,_0x2fd8a1[_0x8b2b('0x40')]('_'));var _0x514046=_0x2fd8a1[_0x8b2b('0x2e')](_0x2fd8a1[_0x8b2b('0x40')]('_')+0x1);if(_0x22bce9===_0x26a5c3){_0x3436c9[_0x514046]=_0x5e9d7a['content'];}}});}return _0x3436c9;}function getTicket(_0x289145,_0x1c8eda,_0x27ecc7,_0x1931a2,_0x2e4c86,_0x681d2e,_0xa1b3f1){return new Promise(function(_0x30a9a9,_0x2df916){var _0x36b04f;return getAuthToken(_0x1c8eda,_0x27ecc7,_0xa1b3f1)['then'](function(_0xc05bfe){if(_0x681d2e['ticketType']===_0x8b2b('0x41')){_0x36b04f={'method':_0x8b2b('0x10'),'uri':_0x1931a2+_0x8b2b('0x42'),'body':Object[_0x8b2b('0x43')]({},{'title':intUtil[_0x8b2b('0x44')](_0x681d2e[_0x8b2b('0x45')],_0x2e4c86,'\x20'),'description':intUtil['getString'](_0x681d2e[_0x8b2b('0x46')],_0x2e4c86,'\x0a'),'customerid_contact@odata.bind':_0x289145['enduserId']?_0x8b2b('0x47')+_0x289145[_0x8b2b('0x36')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x289145['userId']+')','caseorigincode':'1'},getCustomFields(_0x681d2e[_0x8b2b('0x48')],_0x2e4c86,_0x681d2e['ticketType'])),'headers':{'Authorization':_0x8b2b('0x17')+_0xc05bfe,'OData-Version':_0x8b2b('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x681d2e[_0x8b2b('0x49')]==='phonecall'){var _0x19fe19=_0x289145[_0x8b2b('0x36')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x289145[_0x8b2b('0x25')]+')','participationtypemask':_0x289145[_0x8b2b('0x4a')]===_0x8b2b('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0x8b2b('0x47')+_0x289145[_0x8b2b('0x36')]+')','participationtypemask':_0x289145[_0x8b2b('0x4a')]===_0x8b2b('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x289145[_0x8b2b('0x25')]+')','participationtypemask':_0x289145['callDirection']===_0x8b2b('0x4b')?0x2:0x1}];_0x36b04f={'method':_0x8b2b('0x10'),'uri':_0x1931a2+_0x8b2b('0x4c'),'body':Object['assign']({},{'subject':intUtil[_0x8b2b('0x44')](_0x681d2e[_0x8b2b('0x45')],_0x2e4c86,'\x20'),'phonenumber':String(_0x2e4c86[_0x8b2b('0x4d')]),'description':intUtil[_0x8b2b('0x44')](_0x681d2e[_0x8b2b('0x46')],_0x2e4c86,'\x0a'),'regardingobjectid_contact@odata.bind':_0x289145[_0x8b2b('0x36')]?_0x8b2b('0x47')+_0x289145[_0x8b2b('0x36')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x289145[_0x8b2b('0x25')]+')','directioncode':_0x289145[_0x8b2b('0x4a')]===_0x8b2b('0x4b')?![]:!![],'phonecall_activity_parties':_0x19fe19},getCustomFields(_0x681d2e[_0x8b2b('0x48')],_0x2e4c86,_0x681d2e[_0x8b2b('0x49')])),'headers':{'Authorization':'Bearer\x20'+_0xc05bfe,'OData-Version':_0x8b2b('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x36b04f);})[_0x8b2b('0x19')](function(_0xc00153){var _0x575f4f=_0xc00153[_0x8b2b('0x4e')][_0x8b2b('0x2d')];var _0x23252f=_0x575f4f[_0x8b2b('0x2e')](_0x575f4f[_0x8b2b('0x2f')]('(')+0x1,_0x575f4f['lastIndexOf'](')'));_0x289145[_0x8b2b('0x4f')]=_0x23252f;_0x30a9a9(_0x289145);})[_0x8b2b('0x27')](function(_0x5cc780){_0x2df916(_0x5cc780[_0x8b2b('0x15')]);});});}function emit(_0x35e1e4,_0x2c3547,_0x4ab677,_0x7d5f0f){var _0x457753={'uri':util[_0x8b2b('0x50')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x35e1e4,_0x4ab677,_0x7d5f0f)};io['to'](util['format']('user:%s',_0x2c3547))[_0x8b2b('0x51')](_0x8b2b('0x52'),_0x457753);}exports['cs']=function(_0x14138b,_0x45ab6f,_0x43187e,_0x5f2f37,_0x5c0c2a,_0xbb8a67,_0x412ca5,_0xe19a09){var _0x4148e0={};_0xbb8a67[_0x8b2b('0xb')]=_0xbb8a67[_0x8b2b('0xa')]?intUtil[_0x8b2b('0x53')](_0xbb8a67[_0x8b2b('0xe')][_0x8b2b('0xc')]):intUtil['stripTrailingSlash'](_0xbb8a67[_0x8b2b('0xb')]);_0xbb8a67[_0x8b2b('0x54')]=intUtil[_0x8b2b('0x53')](_0xbb8a67[_0x8b2b('0x54')]);_0x4148e0[_0x8b2b('0x4a')]=_0xe19a09===_0x8b2b('0x4b')||_0xe19a09===_0x8b2b('0x55')?_0x8b2b('0x4b'):_0x8b2b('0x29');var _0x27fb34=_0xbb8a67[_0x8b2b('0xa')]?util[_0x8b2b('0x50')]('%s/api/data/v9.0/',_0xbb8a67['CloudProvider'][_0x8b2b('0xc')]):util[_0x8b2b('0x50')](_0x8b2b('0x56'),_0xbb8a67[_0x8b2b('0xb')]);var _0x5f20cd=util['format'](_0x8b2b('0x57'),_0xbb8a67[_0x8b2b('0xd')]);var _0x3336e2=util[_0x8b2b('0x50')](_0x8b2b('0x58'),_0xbb8a67[_0x8b2b('0x54')],_0x45ab6f['uniqueid'],md5(_0x45ab6f['uniqueid']));if(_0x5c0c2a&&_0x5c0c2a[_0x8b2b('0x59')]){logger[_0x8b2b('0x22')](_0x8b2b('0x5a'),_0x8b2b('0x5b'));_0x45ab6f[_0x8b2b('0x5c')]=_0x3336e2;}else if(_0x412ca5&&_0x412ca5['recordingFormat']&&_0x412ca5[_0x8b2b('0x5d')]!==_0x8b2b('0x5e')){logger[_0x8b2b('0x22')]('[OUTBOUND]',_0x8b2b('0x5b'));_0x45ab6f[_0x8b2b('0x5c')]=_0x3336e2;}else{_0x45ab6f[_0x8b2b('0x5c')]='';}return getUser(_0x4148e0,_0xbb8a67,_0x5f2f37,_0x5f20cd,_0x27fb34,_0xe19a09)['then'](function(_0xb607af){logger['info']('['+_0xe19a09['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0xb607af['userId']);logger['info']('['+_0xe19a09[_0x8b2b('0x39')]()+']\x20The\x20User\x20email\x20is:',_0xb607af['userEmail']);return getEndUser(_0xb607af,_0xbb8a67,_0x5f20cd,_0x27fb34,_0x45ab6f,_0xe19a09,_0x43187e['moduleCreate'],_0x43187e[_0x8b2b('0x5f')]);})['then'](function(_0x2a9e23){logger[_0x8b2b('0x22')]('['+_0xe19a09['toUpperCase']()+_0x8b2b('0x60'),_0x2a9e23[_0x8b2b('0x36')]);logger[_0x8b2b('0x22')]('['+_0xe19a09[_0x8b2b('0x39')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x45ab6f[_0x8b2b('0x4d')]);return getTicket(_0x2a9e23,_0xbb8a67,_0x5f20cd,_0x27fb34,_0x45ab6f,_0x43187e,_0xe19a09);})[_0x8b2b('0x19')](function(_0x241739){logger[_0x8b2b('0x22')](util[_0x8b2b('0x50')]('['+_0xe19a09[_0x8b2b('0x39')]()+_0x8b2b('0x61'),_0x43187e['ticketType'],_0x241739['ticketId']));logger[_0x8b2b('0x22')](util[_0x8b2b('0x50')]('['+_0xe19a09[_0x8b2b('0x39')]()+_0x8b2b('0x62'),_0xe19a09));if(_0xe19a09!==_0x8b2b('0x55')&&_0x43187e[_0x8b2b('0x63')]){logger[_0x8b2b('0x22')]('['+_0xe19a09['toUpperCase']()+']',_0x8b2b('0x64'));emit(_0xbb8a67['remoteUri'],_0x5f2f37['name'],_0x43187e[_0x8b2b('0x49')],_0x241739[_0x8b2b('0x4f')]);}})[_0x8b2b('0x27')](function(_0x168502){logger['error']('['+_0xe19a09[_0x8b2b('0x39')]()+_0x8b2b('0x65'),_0x168502['message']);console[_0x8b2b('0x13')](_0x8b2b('0x66'),_0x168502);});}; \ 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 dc1f979..9c6bbc1 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 _0x7264=['Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','GET','map','forEach','picklist','type','nameField','customField','content','includes','string','idField','push','variable','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','error','stringify','recordingFormat','none','Authorization','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','user:%s','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','Subjects','getString','Descriptions','Tags','name','custom_fields','keyBy','value','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.'];(function(_0x307d2b,_0x3796e0){var _0xe82587=function(_0x3c9b26){while(--_0x3c9b26){_0x307d2b['push'](_0x307d2b['shift']());}};_0xe82587(++_0x3796e0);}(_0x7264,0x1a8));var _0x4726=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7264[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4726('0x0'));var rp=require(_0x4726('0x1'));var md5=require(_0x4726('0x2'));var util=require(_0x4726('0x3'));var Redis=require(_0x4726('0x4'));var intUtil=require(_0x4726('0x5'));var config=require(_0x4726('0x6'));var logger=require('../../../../config/logger')(_0x4726('0x7'));config['redis']=_[_0x4726('0x8')](config[_0x4726('0x9')],{'host':_0x4726('0xa'),'port':0x18eb});var io=require(_0x4726('0xb'))(new Redis(config[_0x4726('0x9')]));var headers={'Content-Type':_0x4726('0xc'),'Accept':'application/json'};function emit(_0xb65901,_0x143438,_0x3de75f){io['to'](_0xb65901)['emit'](_0x143438,_0x3de75f);}function getTicket(_0x535360,_0x1eee6f,_0xbc29,_0x207c16,_0x5a1fa5){logger[_0x4726('0xd')](_0x4726('0xe'));var _0x101394=_[_0x4726('0xf')]({'responder_id':_0x1eee6f['id'],'requester_id':_0xbc29['id'],'name':util[_0x4726('0x10')](_0x4726('0x11'),_0x5a1fa5['calleridname']),'phone':_0x5a1fa5[_0x4726('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x207c16[_0x4726('0x13')],_0x5a1fa5,'\x20'),'description':intUtil[_0x4726('0x14')](_0x207c16[_0x4726('0x15')],_0x5a1fa5,'
'),'tags':getTags(_0x207c16[_0x4726('0x16')],_0x4726('0x17'))},getCustomFields(_0x207c16['Fields'],_0x5a1fa5));_0x101394[_0x4726('0x18')]=_['mapValues'](_[_0x4726('0x19')](_0x101394[_0x4726('0x18')],'id'),_0x4726('0x1a'));return request({'uri':util[_0x4726('0x10')]('%s/api/v2/tickets',_0x535360['remoteUri']),'method':_0x4726('0x1b'),'body':_0x101394})[_0x4726('0x1c')](function(_0xf9302a){logger[_0x4726('0xd')](_0x4726('0x1d'));return _0xf9302a;});}function getUser(_0x1ca670,_0x59bf4a){if(intUtil[_0x4726('0x1e')](_0x59bf4a)){return request({'uri':util['format'](_0x4726('0x1f'),_0x1ca670[_0x4726('0x20')]),'qs':{'email':_0x59bf4a}})[_0x4726('0x1c')](function(_0x4460e8){if(_0x4460e8[_0x4726('0x21')]){logger[_0x4726('0xd')](_0x4726('0x22'));return _[_0x4726('0x23')](_0x4460e8,function(_0x55dfcf){return _0x55dfcf[_0x4726('0x24')][_0x4726('0x25')]===_0x59bf4a;});}else{logger[_0x4726('0xd')](_0x4726('0x26'));return request({'uri':util['format'](_0x4726('0x27'),_0x1ca670[_0x4726('0x20')])})['then'](function(_0x393ab4){logger[_0x4726('0xd')](_0x4726('0x28'));return _0x393ab4;});}});}else{logger['info'](_0x4726('0x29'));return request({'uri':util[_0x4726('0x10')]('%s/api/v2/agents/me',_0x1ca670['remoteUri'])})[_0x4726('0x1c')](function(_0x3a9bbd){logger[_0x4726('0xd')](_0x4726('0x28'));return _0x3a9bbd;});}}function getEndUser(_0x10a10e,_0x4ca917,_0x2347fd){logger[_0x4726('0xd')](_0x4726('0x2a'),_0x2347fd);return request({'uri':util[_0x4726('0x10')]('%s/api/v2/contacts',_0x10a10e['remoteUri']),'qs':{'phone':_0x2347fd}})[_0x4726('0x1c')](function(_0x16949f){if(_0x16949f[_0x4726('0x21')]){logger['info'](_0x4726('0x2b'));return _[_0x4726('0x23')](_0x16949f,{'phone':_0x2347fd});}else{logger[_0x4726('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format']('%s/api/v2/contacts',_0x10a10e[_0x4726('0x20')]),'method':'POST','body':{'name':_0x4ca917,'phone':_0x2347fd}})[_0x4726('0x1c')](function(_0x4e5bb4){logger[_0x4726('0xd')](_0x4726('0x2c'));return _0x4e5bb4;});}});}function getAuth(_0x451ccc){return util[_0x4726('0x10')](_0x4726('0x2d'),new Buffer(_0x451ccc[_0x4726('0x2e')]+':X')[_0x4726('0x2f')](_0x4726('0x30')));}function request(_0xd9d9b6){logger[_0x4726('0x31')](_0x4726('0x32'),JSON['stringify'](_0xd9d9b6));return rp(_[_0x4726('0x8')](_0xd9d9b6,{'method':_0x4726('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x5a0845,_0x558215){var _0x4e689a=[];if(_0x5a0845&&_0x5a0845[_0x4726('0x21')]>0x0){_0x4e689a=_[_0x4726('0x34')](_0x5a0845,_0x558215);}return _0x4e689a;}function getCustomFields(_0x4667bc,_0x6fb1db){var _0x386ba3=[];var _0x5397f9={'custom_fields':[]};if(_0x4667bc[_0x4726('0x21')]>0x0){_[_0x4726('0x35')](_0x4667bc,function(_0x5e3422){if(_['includes'](['string',_0x4726('0x36')],_0x5e3422[_0x4726('0x37')])&&_0x5e3422[_0x4726('0x38')]&&!_0x5e3422[_0x4726('0x39')]){_0x5397f9[_0x5e3422[_0x4726('0x38')]['toLowerCase']()]=_0x5e3422[_0x4726('0x3a')][_0x4726('0x2f')]();}else if(_[_0x4726('0x3b')]([_0x4726('0x3c'),_0x4726('0x36')],_0x5e3422['type'])&&_0x5e3422[_0x4726('0x3d')]&&_0x5e3422['customField']){_0x5397f9[_0x4726('0x18')][_0x4726('0x3e')]({'id':_0x5e3422[_0x4726('0x3d')],'value':_0x5e3422[_0x4726('0x3a')][_0x4726('0x2f')]()});}else if(_0x5e3422['type']===_0x4726('0x3f')&&_0x5e3422[_0x4726('0x40')]&&_0x5e3422[_0x4726('0x3d')]&&_0x5e3422[_0x4726('0x39')]){_0x6fb1db[_0x5e3422[_0x4726('0x40')]]&&_0x5397f9[_0x4726('0x18')][_0x4726('0x3e')]({'id':_0x5e3422[_0x4726('0x3d')],'value':_0x6fb1db[_0x5e3422[_0x4726('0x40')]][_0x4726('0x2f')]()});}else if(_0x5e3422[_0x4726('0x37')]==='customVariable'&&_0x5e3422[_0x4726('0x41')]&&_0x5e3422[_0x4726('0x41')][_0x4726('0x17')]&&_0x5e3422[_0x4726('0x3d')]&&_0x5e3422['customField']){_0x6fb1db[_0x5e3422[_0x4726('0x41')][_0x4726('0x17')][_0x4726('0x42')]()]&&_0x5397f9[_0x4726('0x18')][_0x4726('0x3e')]({'id':_0x5e3422[_0x4726('0x3d')],'value':_0x6fb1db[_0x5e3422[_0x4726('0x41')]['name'][_0x4726('0x42')]()]['toString']()});}});}return _0x5397f9;}exports[_0x4726('0x43')]=function(_0x1ca277,_0x2c5114,_0x34aee3,_0x31f1b8,_0x570bd7,_0x2ccadc){var _0x1aa10b,_0x334c65;_0x2ccadc[_0x4726('0x20')]=intUtil[_0x4726('0x44')](_0x2ccadc[_0x4726('0x20')]);_0x2ccadc['serverUrl']=intUtil[_0x4726('0x44')](_0x2ccadc[_0x4726('0x45')]);if(_0x570bd7&&_0x570bd7[_0x4726('0x46')]){logger['info']('[QUEUE]',_0x4726('0x47'));_0x2c5114[_0x4726('0x48')]=util[_0x4726('0x10')](_0x4726('0x49'),_0x2ccadc['serverUrl'],_0x2c5114[_0x4726('0x4a')],md5(_0x2c5114[_0x4726('0x4a')]));}else{_0x2c5114[_0x4726('0x48')]='';}headers['Authorization']=getAuth(_0x2ccadc);return getUser(_0x2ccadc,_0x31f1b8[_0x4726('0x25')])[_0x4726('0x1c')](function(_0x229243){_0x1aa10b=_0x229243;logger[_0x4726('0xd')]('The\x20User\x20ID\x20is:',_0x1aa10b['id']);return getEndUser(_0x2ccadc,_0x2c5114['calleridname'],_0x2c5114[_0x4726('0x12')]);})['then'](function(_0x13bd3c){_0x334c65=_0x13bd3c;logger[_0x4726('0xd')](_0x4726('0x4b'),_0x334c65['id']);return getTicket(_0x2ccadc,_0x1aa10b,_0x334c65,_0x34aee3,_0x2c5114);})[_0x4726('0x1c')](function(_0x32088b){if(_0x32088b&&_0x32088b['id']){logger[_0x4726('0xd')](_0x4726('0x1d'));logger[_0x4726('0xd')]('The\x20Ticket\x20ID\x20is:',_0x32088b['id']);logger[_0x4726('0xd')]('[QUEUE]',_0x4726('0x4c'));emit(util['format']('user:%s',_0x31f1b8['name']),_0x4726('0x4d'),{'uri':util[_0x4726('0x10')](_0x4726('0x4e'),_0x2ccadc[_0x4726('0x20')],_0x32088b['id'])});}})['catch'](function(_0x481edb){logger[_0x4726('0x4f')]('[QUEUE]',JSON[_0x4726('0x50')](_0x481edb));});};exports['outbound']=function(_0x3b0e04,_0x17dfa9,_0x2a23c0,_0x486204,_0x11f437,_0x2a6ce3,_0x77a2b1){var _0x1a2a4a,_0xd42995;_0x2a6ce3[_0x4726('0x20')]=intUtil[_0x4726('0x44')](_0x2a6ce3[_0x4726('0x20')]);_0x2a6ce3[_0x4726('0x45')]=intUtil['stripTrailingSlash'](_0x2a6ce3[_0x4726('0x45')]);if(_0x77a2b1&&_0x77a2b1[_0x4726('0x51')]&&_0x77a2b1[_0x4726('0x51')]!==_0x4726('0x52')){logger[_0x4726('0xd')]('[OUTBOUND]',_0x4726('0x47'));_0x17dfa9[_0x4726('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a6ce3[_0x4726('0x45')],_0x17dfa9[_0x4726('0x4a')],md5(_0x17dfa9[_0x4726('0x4a')]));}headers[_0x4726('0x53')]=getAuth(_0x2a6ce3);return getUser(_0x2a6ce3,_0x486204[_0x4726('0x25')])[_0x4726('0x1c')](function(_0x522b8b){_0x1a2a4a=_0x522b8b;logger[_0x4726('0xd')]('The\x20User\x20ID\x20is:',_0x1a2a4a['id']);return getEndUser(_0x2a6ce3,_0x17dfa9[_0x4726('0x54')],_0x17dfa9[_0x4726('0x55')]);})[_0x4726('0x1c')](function(_0x226edc){_0xd42995=_0x226edc;logger[_0x4726('0xd')](_0x4726('0x4b'),_0xd42995['id']);return getTicket(_0x2a6ce3,_0x1a2a4a,_0xd42995,_0x2a23c0,_0x17dfa9);})[_0x4726('0x1c')](function(_0x288073){if(_0x288073&&_0x288073['id']){logger[_0x4726('0xd')]('Ticket\x20created!');logger[_0x4726('0xd')](_0x4726('0x56'),_0x288073['id']);logger[_0x4726('0xd')](_0x4726('0x57'),_0x4726('0x4c'));emit(util[_0x4726('0x10')](_0x4726('0x58'),_0x486204[_0x4726('0x17')]),'trigger:browser:url',{'uri':util['format'](_0x4726('0x4e'),_0x2a6ce3[_0x4726('0x20')],_0x288073['id'])});}})['catch'](function(_0x2c4876){logger[_0x4726('0x4f')](_0x4726('0x57'),JSON[_0x4726('0x50')](_0x2c4876));});};exports[_0x4726('0x59')]=function(_0x369cca,_0x21e319,_0x175b92,_0x4df664,_0x46b1a9,_0x421ba6){var _0xe83e6,_0x453d6a;_0x421ba6[_0x4726('0x20')]=intUtil['stripTrailingSlash'](_0x421ba6[_0x4726('0x20')]);_0x421ba6[_0x4726('0x45')]=intUtil[_0x4726('0x44')](_0x421ba6['serverUrl']);if(_0x46b1a9&&_0x46b1a9[_0x4726('0x46')]){logger['info']('['+_0x21e319[_0x4726('0x5a')][_0x4726('0x5b')]()+']',_0x4726('0x47'));_0x21e319['recordingURL']=util[_0x4726('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x421ba6[_0x4726('0x45')],_0x21e319['uniqueid'],md5(_0x21e319[_0x4726('0x4a')]));}else{_0x21e319['recordingURL']='';}headers['Authorization']=getAuth(_0x421ba6);return getUser(_0x421ba6,'')[_0x4726('0x1c')](function(_0x245d48){_0xe83e6=_0x245d48;logger[_0x4726('0xd')](_0x4726('0x5c'),_0xe83e6['id']);return getEndUser(_0x421ba6,_0x21e319['calleridname'],_0x21e319[_0x4726('0x12')]);})[_0x4726('0x1c')](function(_0x40498e){_0x453d6a=_0x40498e;logger[_0x4726('0xd')](_0x4726('0x4b'),_0x453d6a['id']);return getTicket(_0x421ba6,_0xe83e6,_0x453d6a,_0x175b92,_0x21e319);})['then'](function(_0x113671){if(_0x113671){logger['info']('Ticket\x20created!');logger[_0x4726('0xd')](_0x4726('0x56'),_0x113671['id']);}})['catch'](function(_0x170493){logger[_0x4726('0x4f')]('['+_0x21e319[_0x4726('0x5a')][_0x4726('0x5b')]()+']',JSON[_0x4726('0x50')](_0x170493));});}; \ No newline at end of file +var _0x5a4e=['localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','name','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','%s/api/v2/agents','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','defaults','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','customField','idField','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','unmanaged','lastevent','recordingURL','catch','toUpperCase','request-promise','md5','ioredis','./util','../../../../config/environment','redis'];(function(_0x4fa2a3,_0x374c9b){var _0xba50a=function(_0x25ac2d){while(--_0x25ac2d){_0x4fa2a3['push'](_0x4fa2a3['shift']());}};_0xba50a(++_0x374c9b);}(_0x5a4e,0x172));var _0xe5a4=function(_0x52598d,_0x10fb73){_0x52598d=_0x52598d-0x0;var _0x170309=_0x5a4e[_0x52598d];return _0x170309;};'use strict';var _=require('lodash');var rp=require(_0xe5a4('0x0'));var md5=require(_0xe5a4('0x1'));var util=require('util');var Redis=require(_0xe5a4('0x2'));var intUtil=require(_0xe5a4('0x3'));var config=require(_0xe5a4('0x4'));var logger=require('../../../../config/logger')('freshdesk');config[_0xe5a4('0x5')]=_['defaults'](config[_0xe5a4('0x5')],{'host':_0xe5a4('0x6'),'port':0x18eb});var io=require(_0xe5a4('0x7'))(new Redis(config[_0xe5a4('0x5')]));var headers={'Content-Type':'application/json','Accept':_0xe5a4('0x8')};function emit(_0x2a51ba,_0x2f3656,_0x1b54ef){io['to'](_0x2a51ba)['emit'](_0x2f3656,_0x1b54ef);}function getTicket(_0x292142,_0x27ec04,_0x2a31e7,_0x4496fb,_0x251643){logger['info'](_0xe5a4('0x9'));var _0x81d96=_[_0xe5a4('0xa')]({'responder_id':_0x27ec04['id'],'requester_id':_0x2a31e7['id'],'name':util[_0xe5a4('0xb')](_0xe5a4('0xc'),_0x251643['calleridname']),'phone':_0x251643[_0xe5a4('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe5a4('0xe')](_0x4496fb[_0xe5a4('0xf')],_0x251643,'\x20'),'description':intUtil[_0xe5a4('0xe')](_0x4496fb[_0xe5a4('0x10')],_0x251643,'
'),'tags':getTags(_0x4496fb['Tags'],_0xe5a4('0x11'))},getCustomFields(_0x4496fb['Fields'],_0x251643));_0x81d96[_0xe5a4('0x12')]=_[_0xe5a4('0x13')](_['keyBy'](_0x81d96[_0xe5a4('0x12')],'id'),_0xe5a4('0x14'));return request({'uri':util[_0xe5a4('0xb')](_0xe5a4('0x15'),_0x292142[_0xe5a4('0x16')]),'method':_0xe5a4('0x17'),'body':_0x81d96})[_0xe5a4('0x18')](function(_0x564c58){logger[_0xe5a4('0x19')](_0xe5a4('0x1a'));return _0x564c58;});}function getUser(_0x31dd19,_0x7a1675){if(intUtil['validateEmail'](_0x7a1675)){return request({'uri':util[_0xe5a4('0xb')](_0xe5a4('0x1b'),_0x31dd19[_0xe5a4('0x16')]),'qs':{'email':_0x7a1675}})[_0xe5a4('0x18')](function(_0x47c464){if(_0x47c464['length']){logger[_0xe5a4('0x19')](_0xe5a4('0x1c'));return _[_0xe5a4('0x1d')](_0x47c464,function(_0x3800f6){return _0x3800f6[_0xe5a4('0x1e')][_0xe5a4('0x1f')]===_0x7a1675;});}else{logger['info'](_0xe5a4('0x20'));return request({'uri':util[_0xe5a4('0xb')](_0xe5a4('0x21'),_0x31dd19[_0xe5a4('0x16')])})[_0xe5a4('0x18')](function(_0x6bb78e){logger[_0xe5a4('0x19')](_0xe5a4('0x22'));return _0x6bb78e;});}});}else{logger['info'](_0xe5a4('0x23'));return request({'uri':util['format'](_0xe5a4('0x21'),_0x31dd19[_0xe5a4('0x16')])})[_0xe5a4('0x18')](function(_0x2b6fbe){logger['info'](_0xe5a4('0x22'));return _0x2b6fbe;});}}function getEndUser(_0x3248e1,_0x4a4f99,_0x5c4e70){logger['info'](_0xe5a4('0x24'),_0x5c4e70);return request({'uri':util[_0xe5a4('0xb')](_0xe5a4('0x25'),_0x3248e1[_0xe5a4('0x16')]),'qs':{'phone':_0x5c4e70}})[_0xe5a4('0x18')](function(_0x18c154){if(_0x18c154[_0xe5a4('0x26')]){logger[_0xe5a4('0x19')](_0xe5a4('0x27'));return _['find'](_0x18c154,{'phone':_0x5c4e70});}else{logger[_0xe5a4('0x19')](_0xe5a4('0x28'));return request({'uri':util['format']('%s/api/v2/contacts',_0x3248e1[_0xe5a4('0x16')]),'method':_0xe5a4('0x17'),'body':{'name':_0x4a4f99,'phone':_0x5c4e70}})[_0xe5a4('0x18')](function(_0x2d0d12){logger[_0xe5a4('0x19')](_0xe5a4('0x29'));return _0x2d0d12;});}});}function getAuth(_0x49f677){return util[_0xe5a4('0xb')](_0xe5a4('0x2a'),new Buffer(_0x49f677[_0xe5a4('0x2b')]+':X')[_0xe5a4('0x2c')](_0xe5a4('0x2d')));}function request(_0x1c4fc6){logger[_0xe5a4('0x2e')](_0xe5a4('0x2f'),JSON[_0xe5a4('0x30')](_0x1c4fc6));return rp(_[_0xe5a4('0x31')](_0x1c4fc6,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4e0f3c,_0x3f8321){var _0x5eef20=[];if(_0x4e0f3c&&_0x4e0f3c[_0xe5a4('0x26')]>0x0){_0x5eef20=_[_0xe5a4('0x32')](_0x4e0f3c,_0x3f8321);}return _0x5eef20;}function getCustomFields(_0x375b4c,_0x56d482){var _0x5019ba=[];var _0x1b6165={'custom_fields':[]};if(_0x375b4c[_0xe5a4('0x26')]>0x0){_[_0xe5a4('0x33')](_0x375b4c,function(_0x18453e){if(_[_0xe5a4('0x34')]([_0xe5a4('0x35'),_0xe5a4('0x36')],_0x18453e[_0xe5a4('0x37')])&&_0x18453e[_0xe5a4('0x38')]&&!_0x18453e['customField']){_0x1b6165[_0x18453e[_0xe5a4('0x38')][_0xe5a4('0x39')]()]=_0x18453e[_0xe5a4('0x3a')][_0xe5a4('0x2c')]();}else if(_[_0xe5a4('0x34')]([_0xe5a4('0x35'),_0xe5a4('0x36')],_0x18453e[_0xe5a4('0x37')])&&_0x18453e['idField']&&_0x18453e[_0xe5a4('0x3b')]){_0x1b6165[_0xe5a4('0x12')]['push']({'id':_0x18453e[_0xe5a4('0x3c')],'value':_0x18453e[_0xe5a4('0x3a')][_0xe5a4('0x2c')]()});}else if(_0x18453e[_0xe5a4('0x37')]===_0xe5a4('0x3d')&&_0x18453e[_0xe5a4('0x3e')]&&_0x18453e[_0xe5a4('0x3c')]&&_0x18453e[_0xe5a4('0x3b')]){_0x56d482[_0x18453e['variableName']]&&_0x1b6165['custom_fields'][_0xe5a4('0x3f')]({'id':_0x18453e[_0xe5a4('0x3c')],'value':_0x56d482[_0x18453e[_0xe5a4('0x3e')]][_0xe5a4('0x2c')]()});}else if(_0x18453e[_0xe5a4('0x37')]===_0xe5a4('0x40')&&_0x18453e['Variable']&&_0x18453e['Variable'][_0xe5a4('0x11')]&&_0x18453e[_0xe5a4('0x3c')]&&_0x18453e[_0xe5a4('0x3b')]){_0x56d482[_0x18453e[_0xe5a4('0x41')][_0xe5a4('0x11')][_0xe5a4('0x39')]()]&&_0x1b6165['custom_fields'][_0xe5a4('0x3f')]({'id':_0x18453e[_0xe5a4('0x3c')],'value':_0x56d482[_0x18453e[_0xe5a4('0x41')]['name'][_0xe5a4('0x39')]()]['toString']()});}});}return _0x1b6165;}exports[_0xe5a4('0x42')]=function(_0x21af4b,_0x52a335,_0x2642bb,_0x28c905,_0x50c72e,_0x4272bc){var _0x11fe23,_0x479fbd;_0x4272bc['remoteUri']=intUtil[_0xe5a4('0x43')](_0x4272bc['remoteUri']);_0x4272bc[_0xe5a4('0x44')]=intUtil[_0xe5a4('0x43')](_0x4272bc['serverUrl']);if(_0x50c72e&&_0x50c72e[_0xe5a4('0x45')]){logger[_0xe5a4('0x19')](_0xe5a4('0x46'),_0xe5a4('0x47'));_0x52a335['recordingURL']=util[_0xe5a4('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4272bc[_0xe5a4('0x44')],_0x52a335['uniqueid'],md5(_0x52a335[_0xe5a4('0x48')]));}else{_0x52a335['recordingURL']='';}headers[_0xe5a4('0x49')]=getAuth(_0x4272bc);return getUser(_0x4272bc,_0x28c905[_0xe5a4('0x1f')])[_0xe5a4('0x18')](function(_0x34d7d7){_0x11fe23=_0x34d7d7;logger[_0xe5a4('0x19')](_0xe5a4('0x4a'),_0x11fe23['id']);return getEndUser(_0x4272bc,_0x52a335[_0xe5a4('0x4b')],_0x52a335['calleridnum']);})[_0xe5a4('0x18')](function(_0x58860f){_0x479fbd=_0x58860f;logger[_0xe5a4('0x19')](_0xe5a4('0x4c'),_0x479fbd['id']);return getTicket(_0x4272bc,_0x11fe23,_0x479fbd,_0x2642bb,_0x52a335);})[_0xe5a4('0x18')](function(_0x2fd406){if(_0x2fd406&&_0x2fd406['id']){logger[_0xe5a4('0x19')](_0xe5a4('0x1a'));logger[_0xe5a4('0x19')]('The\x20Ticket\x20ID\x20is:',_0x2fd406['id']);logger[_0xe5a4('0x19')](_0xe5a4('0x46'),_0xe5a4('0x4d'));emit(util['format'](_0xe5a4('0x4e'),_0x28c905[_0xe5a4('0x11')]),_0xe5a4('0x4f'),{'uri':util[_0xe5a4('0xb')](_0xe5a4('0x50'),_0x4272bc[_0xe5a4('0x16')],_0x2fd406['id'])});}})['catch'](function(_0x20717f){logger[_0xe5a4('0x51')](_0xe5a4('0x46'),JSON['stringify'](_0x20717f));});};exports[_0xe5a4('0x52')]=function(_0x5c8bd1,_0x3baf7a,_0x353832,_0x4da66a,_0x3c7ebf,_0x4baaa5,_0x2364f2){var _0xdbf66d,_0x8017ec;_0x4baaa5[_0xe5a4('0x16')]=intUtil[_0xe5a4('0x43')](_0x4baaa5[_0xe5a4('0x16')]);_0x4baaa5[_0xe5a4('0x44')]=intUtil['stripTrailingSlash'](_0x4baaa5[_0xe5a4('0x44')]);if(_0x2364f2&&_0x2364f2[_0xe5a4('0x53')]&&_0x2364f2[_0xe5a4('0x53')]!=='none'){logger['info'](_0xe5a4('0x54'),'Recording\x20is\x20enabled!');_0x3baf7a['recordingURL']=util[_0xe5a4('0xb')](_0xe5a4('0x55'),_0x4baaa5[_0xe5a4('0x44')],_0x3baf7a[_0xe5a4('0x48')],md5(_0x3baf7a[_0xe5a4('0x48')]));}headers[_0xe5a4('0x49')]=getAuth(_0x4baaa5);return getUser(_0x4baaa5,_0x4da66a['email'])[_0xe5a4('0x18')](function(_0x5e3ef4){_0xdbf66d=_0x5e3ef4;logger[_0xe5a4('0x19')](_0xe5a4('0x4a'),_0xdbf66d['id']);return getEndUser(_0x4baaa5,_0x3baf7a[_0xe5a4('0x56')],_0x3baf7a[_0xe5a4('0x57')]);})[_0xe5a4('0x18')](function(_0xf22c45){_0x8017ec=_0xf22c45;logger[_0xe5a4('0x19')]('The\x20Enduser\x20ID\x20is:',_0x8017ec['id']);return getTicket(_0x4baaa5,_0xdbf66d,_0x8017ec,_0x353832,_0x3baf7a);})[_0xe5a4('0x18')](function(_0x3ebae6){if(_0x3ebae6&&_0x3ebae6['id']){logger['info']('Ticket\x20created!');logger[_0xe5a4('0x19')](_0xe5a4('0x58'),_0x3ebae6['id']);logger[_0xe5a4('0x19')](_0xe5a4('0x54'),_0xe5a4('0x4d'));emit(util[_0xe5a4('0xb')](_0xe5a4('0x4e'),_0x4da66a[_0xe5a4('0x11')]),'trigger:browser:url',{'uri':util[_0xe5a4('0xb')]('%s/helpdesk/tickets/%d',_0x4baaa5[_0xe5a4('0x16')],_0x3ebae6['id'])});}})['catch'](function(_0x5ded32){logger['error'](_0xe5a4('0x54'),JSON['stringify'](_0x5ded32));});};exports[_0xe5a4('0x59')]=function(_0x3ce511,_0x200ccd,_0x2d6df6,_0x37dc6e,_0x59e905,_0x2106f3){var _0x17b007,_0x1b4616;_0x2106f3['remoteUri']=intUtil[_0xe5a4('0x43')](_0x2106f3[_0xe5a4('0x16')]);_0x2106f3[_0xe5a4('0x44')]=intUtil[_0xe5a4('0x43')](_0x2106f3['serverUrl']);if(_0x59e905&&_0x59e905['monitor_format']){logger[_0xe5a4('0x19')]('['+_0x200ccd[_0xe5a4('0x5a')]['toUpperCase']()+']',_0xe5a4('0x47'));_0x200ccd['recordingURL']=util[_0xe5a4('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2106f3[_0xe5a4('0x44')],_0x200ccd[_0xe5a4('0x48')],md5(_0x200ccd[_0xe5a4('0x48')]));}else{_0x200ccd[_0xe5a4('0x5b')]='';}headers[_0xe5a4('0x49')]=getAuth(_0x2106f3);return getUser(_0x2106f3,'')[_0xe5a4('0x18')](function(_0x26503f){_0x17b007=_0x26503f;logger[_0xe5a4('0x19')](_0xe5a4('0x4a'),_0x17b007['id']);return getEndUser(_0x2106f3,_0x200ccd[_0xe5a4('0x4b')],_0x200ccd[_0xe5a4('0xd')]);})[_0xe5a4('0x18')](function(_0x1683ce){_0x1b4616=_0x1683ce;logger[_0xe5a4('0x19')](_0xe5a4('0x4c'),_0x1b4616['id']);return getTicket(_0x2106f3,_0x17b007,_0x1b4616,_0x2d6df6,_0x200ccd);})[_0xe5a4('0x18')](function(_0x5d19c9){if(_0x5d19c9){logger['info'](_0xe5a4('0x1a'));logger[_0xe5a4('0x19')](_0xe5a4('0x58'),_0x5d19c9['id']);}})[_0xe5a4('0x5c')](function(_0x12549a){logger['error']('['+_0x200ccd[_0xe5a4('0x5a')][_0xe5a4('0x5d')]()+']',JSON['stringify'](_0x12549a));});}; \ 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 6538454..0727211 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 _0x1344=['md5','util','moment','bluebird','ioredis','./util','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers','then','users','length','email','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','User\x20found:','userId','Admin\x20selected','userEmail','adminEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash'];(function(_0x5f2a50,_0x4700e0){var _0x7577ca=function(_0x45f47e){while(--_0x45f47e){_0x5f2a50['push'](_0x5f2a50['shift']());}};_0x7577ca(++_0x4700e0);}(_0x1344,0x1ad));var _0x4134=function(_0x56ba58,_0x1697c4){_0x56ba58=_0x56ba58-0x0;var _0x337772=_0x1344[_0x56ba58];return _0x337772;};'use strict';var _=require(_0x4134('0x0'));var rp=require('request-promise');var md5=require(_0x4134('0x1'));var util=require(_0x4134('0x2'));var moment=require(_0x4134('0x3'));var Promise=require(_0x4134('0x4'));var Redis=require(_0x4134('0x5'));var intUtil=require(_0x4134('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x4134('0x7'));config[_0x4134('0x8')]=_[_0x4134('0x9')](config[_0x4134('0x8')],{'host':_0x4134('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4134('0x8')]));function getAdminId(_0x1b273f,_0xc2ab20,_0x486bba,_0x2b39db){return new Promise(function(_0x1c3676,_0x31d8a5){var _0x25eb80=![];var _0x2d7142={'method':_0x4134('0xb'),'uri':_0x2b39db+_0x4134('0xc'),'json':!![]};_0x2d7142[_0x4134('0xd')]=_0x486bba;logger['info']('Getting\x20admin\x20information');return rp(_0x2d7142)[_0x4134('0xe')](function(_0x478c73){if(_0x478c73){var _0x615dbf=_0x478c73[_0x4134('0xf')];var _0xd9c456=null;for(_0xd9c456=0x0;_0xd9c456<_0x615dbf[_0x4134('0x10')];_0xd9c456++){if(_0x615dbf[_0xd9c456][_0x4134('0x11')]===_0x1b273f['adminEmail']){_0x1b273f[_0x4134('0x12')]=_0x615dbf[_0xd9c456]['id'];_0x25eb80=!![];}}if(_0x25eb80){logger[_0x4134('0x13')](_0x4134('0x14'),_0x1b273f[_0x4134('0x12')]);_0x1c3676(_0x1b273f);}else{_0x31d8a5({'statusCode':0x194,'message':_0x4134('0x15')});}}else{_0x31d8a5({'statusCode':0x194,'message':_0x4134('0x15')});}})[_0x4134('0x16')](function(_0x120561){logger[_0x4134('0x17')]('['+[_0xc2ab20[_0x4134('0x18')]()]+']',_0x120561[_0x4134('0x19')]);_0x31d8a5(_0x120561);});});}function getUser(_0x5efa96,_0x10d65f,_0x996ad5){return function(_0x392059){return new Promise(function(_0x20936,_0x4232f4){var _0x2a41e6={'method':_0x4134('0xb'),'uri':_0x996ad5+_0x4134('0xc'),'json':!![]};_0x2a41e6['headers']=_0x10d65f;logger['info'](_0x4134('0x1a'));return rp(_0x2a41e6)[_0x4134('0xe')](function(_0x5d3c94){if(_0x5d3c94){var _0x4667d7=_0x5d3c94[_0x4134('0xf')];var _0x7504f4=![];var _0x504e5e=null;if(_0x392059['agentEmail']!==null){logger[_0x4134('0x13')](_0x4134('0x1b'),_0x392059[_0x4134('0x1c')]);_0x392059['userEmail']=_0x392059[_0x4134('0x1c')];for(_0x504e5e=0x0;_0x504e5e<_0x4667d7['length'];_0x504e5e++){if(_0x4667d7[_0x504e5e]['email']===_0x392059[_0x4134('0x1c')]){_0x7504f4=!![];_0x392059['userId']=_0x4667d7[_0x504e5e]['id'];logger[_0x4134('0x13')](_0x4134('0x1d'),_0x392059[_0x4134('0x1e')]);}}}if(!_0x7504f4){logger[_0x4134('0x13')](_0x4134('0x1f'));_0x392059[_0x4134('0x20')]=_0x392059[_0x4134('0x21')];_0x392059[_0x4134('0x1e')]=_0x392059['adminId'];_0x7504f4=!![];}if(_0x7504f4){_0x20936(_0x392059);}else{_0x4232f4({'statusCode':0x194,'message':_0x4134('0x15')});}}else{_0x4232f4({'statusCode':0x194,'message':_0x4134('0x15')});}})[_0x4134('0x16')](function(_0x106978){logger['error']('['+[_0x5efa96['toUpperCase']()]+']',_0x106978['message']);_0x4232f4(_0x106978);});});};}function searchContact(_0x3be4cd,_0x2e9e4b,_0x28df31,_0x3dfbc4){return new Promise(function(_0x3add4c,_0x50f1b9){var _0x312441={'method':'GET','headers':_0x2e9e4b,'uri':_0x3be4cd+_0x4134('0x22')+_0x3dfbc4+_0x4134('0x23')+_0x28df31+_0x4134('0x24'),'json':!![]};rp(_0x312441)[_0x4134('0xe')](function(_0x554047){var _0x22975e=_[_0x4134('0x25')](_0x554047[_0x4134('0x26')][_0x4134('0x26')],[_0x28df31,_0x3dfbc4]);_0x3add4c(_0x22975e);})[_0x4134('0x16')](function(_0x30e034){_0x50f1b9(_0x30e034);});});}function getEndUser(_0x29d306,_0x171ed8,_0x15653b){return function(_0xccb356){return new Promise(function(_0xfb0fae,_0x5b201f){logger[_0x4134('0x13')](util[_0x4134('0x27')]('Searching\x20contact\x20with\x20phone\x20%s',_0xccb356[_0x4134('0x28')]));searchContact(_0x15653b,_0x171ed8,_0x4134('0x29'),_0xccb356[_0x4134('0x28')])[_0x4134('0xe')](function(_0x5b4aa7){if(_0x5b4aa7){_0xccb356[_0x4134('0x2a')]=_0x5b4aa7['id'];logger[_0x4134('0x13')](_0x4134('0x2b'),_0xccb356['endUserId']);return _0xfb0fae(_0xccb356);}searchContact(_0x15653b,_0x171ed8,_0x4134('0x2c'),_0xccb356[_0x4134('0x28')])['then'](function(_0x12676b){if(_0x12676b){_0xccb356['endUserId']=_0x12676b['id'];logger['info']('Contact\x20found\x20work_number:',_0xccb356['endUserId']);return _0xfb0fae(_0xccb356);}createEndUser(_0xccb356,_0x29d306,_0x171ed8,_0x15653b)[_0x4134('0xe')](function(_0x3778ac){logger[_0x4134('0x13')]('Contact\x20created:',_0x3778ac[_0x4134('0x2a')]);return _0xfb0fae(_0x3778ac);});});})[_0x4134('0x16')](function(_0x9420e1){_0x5b201f(_0x9420e1);});});};}function createEndUser(_0x41bd94,_0x194813,_0x28d013,_0x19a957){return new Promise(function(_0x42331e,_0x343476){var _0x3f6d6c=moment();var _0x5c77ff={'method':_0x4134('0x2d'),'uri':_0x19a957+_0x4134('0x2e'),'body':{'contact':{'last_name':_0x41bd94[_0x4134('0x28')],'work_number':_0x41bd94[_0x4134('0x28')],'mobile_number':_0x41bd94['contactNumber'],'owner_id':_0x41bd94[_0x4134('0x1e')],'created_at':_0x3f6d6c[_0x4134('0x27')](_0x4134('0x2f'))}},'json':!![]};_0x5c77ff['headers']=_0x28d013;logger['info'](_0x4134('0x30'));return rp(_0x5c77ff)[_0x4134('0xe')](function(_0x33a8b6){_0x41bd94[_0x4134('0x2a')]=_0x33a8b6[_0x4134('0x31')]['id'];_0x42331e(_0x41bd94);})[_0x4134('0x16')](function(_0x4c1def){logger[_0x4134('0x17')]('['+[_0x194813[_0x4134('0x18')]()]+']',_0x4c1def[_0x4134('0x19')]);_0x343476(_0x4c1def[_0x4134('0x19')]);});});}function getTicket(_0x4be558,_0x36a36b,_0x17c7a0,_0x3a5ebc,_0xe51d2){return function(_0x252f02){logger[_0x4134('0x13')]('Creating\x20new\x20task');return new Promise(function(_0x3958e9,_0x1529fb){var _0x2caea9=moment();var _0x458d8d={'method':_0x4134('0x2d'),'uri':_0x17c7a0+_0x4134('0x32'),'body':{'title':intUtil[_0x4134('0x33')](_0x3a5ebc[_0x4134('0x34')],_0xe51d2,'\x20'),'description':intUtil['getString'](_0x3a5ebc[_0x4134('0x35')],_0xe51d2,'\x0a'),'owner_id':_0x252f02[_0x4134('0x1e')],'creater_id':_0x252f02['adminId'],'targetable_id':_0x252f02[_0x4134('0x2a')],'targetable_type':_0x4134('0x36'),'created_at':_0x2caea9[_0x4134('0x27')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x2caea9[_0x4134('0x37')](0x1e,'m')['format'](_0x4134('0x2f'))},'json':!![]};_0x458d8d[_0x4134('0xd')]=_0x36a36b;return rp(_0x458d8d)[_0x4134('0xe')](function(_0x2d1cb0){_0x252f02[_0x4134('0x38')]=_0x2d1cb0[_0x4134('0x39')]['id'];logger[_0x4134('0x13')](_0x4134('0x3a'),_0x252f02[_0x4134('0x38')]);_0x3958e9(_0x252f02);})[_0x4134('0x16')](function(_0x393e33){logger[_0x4134('0x17')]('['+[_0x4be558[_0x4134('0x18')]()]+']',_0x393e33[_0x4134('0x19')]);_0x1529fb(_0x393e33[_0x4134('0x19')]);});});};}function emit(_0x332073,_0x5dd97f,_0x48b3c5){var _0x2eb27b={'uri':_0x332073+_0x4134('0x3b')+_0x48b3c5};io['to'](util[_0x4134('0x27')](_0x4134('0x3c'),_0x5dd97f))[_0x4134('0x3d')](_0x4134('0x3e'),_0x2eb27b);}exports['cs']=function(_0x438cfb,_0x1a770f,_0x5aecb0,_0x23d268,_0x413ba6,_0x4a5f8a,_0x17938c,_0x20e823){var _0x18ccd7={};var _0x563dbe={'Authorization':_0x4134('0x3f')+_0x4a5f8a[_0x4134('0x40')]};_0x4a5f8a[_0x4134('0x41')]=intUtil[_0x4134('0x42')](_0x4a5f8a[_0x4134('0x41')]);_0x4a5f8a[_0x4134('0x43')]=intUtil[_0x4134('0x42')](_0x4a5f8a[_0x4134('0x43')]);var _0x42feb4=_0x4a5f8a[_0x4134('0x41')];_0x18ccd7[_0x4134('0x21')]=_0x4a5f8a[_0x4134('0x44')];_0x18ccd7[_0x4134('0x28')]=_0x20e823['toLowerCase']()===_0x4134('0x45')?_0x1a770f[_0x4134('0x46')]:_0x1a770f[_0x4134('0x47')];_0x18ccd7['callDirection']=_0x20e823===_0x4134('0x48')||_0x20e823===_0x4134('0x49')?_0x4134('0x48'):_0x4134('0x45');if(_0x23d268){_0x18ccd7[_0x4134('0x1c')]=_0x23d268['email'];}var _0x4ae2ba=util[_0x4134('0x27')](_0x4134('0x4a'),_0x4a5f8a['serverUrl'],_0x1a770f['uniqueid'],md5(_0x1a770f[_0x4134('0x4b')]));if(_0x413ba6&&_0x413ba6[_0x4134('0x4c')]){logger[_0x4134('0x13')]('[QUEUE]','Recording\x20is\x20enabled!');_0x1a770f[_0x4134('0x4d')]=_0x4ae2ba;}else if(_0x17938c&&_0x17938c[_0x4134('0x4e')]&&_0x17938c['recordingFormat']!==_0x4134('0x4f')){logger['info'](_0x4134('0x50'),_0x4134('0x51'));_0x1a770f['recordingURL']=_0x4ae2ba;}else{_0x1a770f[_0x4134('0x4d')]='';}return getAdminId(_0x18ccd7,_0x20e823,_0x563dbe,_0x42feb4)[_0x4134('0xe')](getUser(_0x20e823,_0x563dbe,_0x42feb4))[_0x4134('0xe')](getEndUser(_0x20e823,_0x563dbe,_0x42feb4))[_0x4134('0xe')](getTicket(_0x20e823,_0x563dbe,_0x42feb4,_0x5aecb0,_0x1a770f))[_0x4134('0xe')](function(_0x1f5295){logger[_0x4134('0x13')](util[_0x4134('0x27')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1f5295[_0x4134('0x38')]));if(_0x20e823!==_0x4134('0x49')){logger[_0x4134('0x13')]('['+[_0x20e823[_0x4134('0x18')]()]+']',_0x4134('0x52'));emit(_0x42feb4,_0x23d268[_0x4134('0x53')],_0x1f5295[_0x4134('0x2a')]);}})['catch'](function(_0x515144){logger[_0x4134('0x17')]('['+[_0x20e823[_0x4134('0x18')]()]+_0x4134('0x54'),util[_0x4134('0x55')](_0x515144,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x88e4=['Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userId','Admin\x20selected','userEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Descriptions','Contact','add','ticketId','/contacts/','trigger:browser:url','Token\x20token=','apiKey','serverUrl','stripTrailingSlash','remoteUri','toLowerCase','outbound','calleridnum','callDirection','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','./util','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message'];(function(_0x46b1c9,_0x169f87){var _0x17569c=function(_0x4b7c45){while(--_0x4b7c45){_0x46b1c9['push'](_0x46b1c9['shift']());}};_0x17569c(++_0x169f87);}(_0x88e4,0x1ca));var _0x488e=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0x88e4[_0x2300c7];return _0x23f720;};'use strict';var _=require('lodash');var rp=require(_0x488e('0x0'));var md5=require(_0x488e('0x1'));var util=require(_0x488e('0x2'));var moment=require(_0x488e('0x3'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0x488e('0x4'));var config=require('../../../../config/environment');var logger=require(_0x488e('0x5'))(_0x488e('0x6'));config[_0x488e('0x7')]=_[_0x488e('0x8')](config[_0x488e('0x7')],{'host':_0x488e('0x9'),'port':0x18eb});var io=require(_0x488e('0xa'))(new Redis(config[_0x488e('0x7')]));function getAdminId(_0x99de1d,_0x578ecf,_0x322cfd,_0xe66009){return new Promise(function(_0x169ace,_0x3341c5){var _0x1cc4c5=![];var _0x38c99b={'method':_0x488e('0xb'),'uri':_0xe66009+_0x488e('0xc'),'json':!![]};_0x38c99b[_0x488e('0xd')]=_0x322cfd;logger[_0x488e('0xe')](_0x488e('0xf'));return rp(_0x38c99b)[_0x488e('0x10')](function(_0x1d6672){if(_0x1d6672){var _0x3e0c7d=_0x1d6672[_0x488e('0x11')];var _0x239e04=null;for(_0x239e04=0x0;_0x239e04<_0x3e0c7d[_0x488e('0x12')];_0x239e04++){if(_0x3e0c7d[_0x239e04][_0x488e('0x13')]===_0x99de1d[_0x488e('0x14')]){_0x99de1d[_0x488e('0x15')]=_0x3e0c7d[_0x239e04]['id'];_0x1cc4c5=!![];}}if(_0x1cc4c5){logger[_0x488e('0xe')](_0x488e('0x16'),_0x99de1d[_0x488e('0x15')]);_0x169ace(_0x99de1d);}else{_0x3341c5({'statusCode':0x194,'message':_0x488e('0x17')});}}else{_0x3341c5({'statusCode':0x194,'message':_0x488e('0x17')});}})[_0x488e('0x18')](function(_0x235098){logger[_0x488e('0x19')]('['+[_0x578ecf[_0x488e('0x1a')]()]+']',_0x235098[_0x488e('0x1b')]);_0x3341c5(_0x235098);});});}function getUser(_0x2afcd9,_0x5d83d1,_0x3862db){return function(_0x2ab0f1){return new Promise(function(_0x15401d,_0x2f1f25){var _0x7e33be={'method':_0x488e('0xb'),'uri':_0x3862db+_0x488e('0xc'),'json':!![]};_0x7e33be[_0x488e('0xd')]=_0x5d83d1;logger['info'](_0x488e('0x1c'));return rp(_0x7e33be)[_0x488e('0x10')](function(_0x4c2353){if(_0x4c2353){var _0x2d5536=_0x4c2353[_0x488e('0x11')];var _0x4cae77=![];var _0x377bb6=null;if(_0x2ab0f1['agentEmail']!==null){logger[_0x488e('0xe')](_0x488e('0x1d'),_0x2ab0f1['agentEmail']);_0x2ab0f1['userEmail']=_0x2ab0f1[_0x488e('0x1e')];for(_0x377bb6=0x0;_0x377bb6<_0x2d5536[_0x488e('0x12')];_0x377bb6++){if(_0x2d5536[_0x377bb6][_0x488e('0x13')]===_0x2ab0f1[_0x488e('0x1e')]){_0x4cae77=!![];_0x2ab0f1[_0x488e('0x1f')]=_0x2d5536[_0x377bb6]['id'];logger[_0x488e('0xe')]('User\x20found:',_0x2ab0f1[_0x488e('0x1f')]);}}}if(!_0x4cae77){logger['info'](_0x488e('0x20'));_0x2ab0f1[_0x488e('0x21')]=_0x2ab0f1['adminEmail'];_0x2ab0f1[_0x488e('0x1f')]=_0x2ab0f1[_0x488e('0x15')];_0x4cae77=!![];}if(_0x4cae77){_0x15401d(_0x2ab0f1);}else{_0x2f1f25({'statusCode':0x194,'message':_0x488e('0x17')});}}else{_0x2f1f25({'statusCode':0x194,'message':_0x488e('0x17')});}})[_0x488e('0x18')](function(_0x3fbab9){logger[_0x488e('0x19')]('['+[_0x2afcd9[_0x488e('0x1a')]()]+']',_0x3fbab9[_0x488e('0x1b')]);_0x2f1f25(_0x3fbab9);});});};}function searchContact(_0x43f395,_0x4536f5,_0x4616b0,_0x14febc){return new Promise(function(_0x432925,_0x206c88){var _0x4abb4d={'method':_0x488e('0xb'),'headers':_0x4536f5,'uri':_0x43f395+_0x488e('0x22')+_0x14febc+_0x488e('0x23')+_0x4616b0+_0x488e('0x24'),'json':!![]};rp(_0x4abb4d)[_0x488e('0x10')](function(_0x51ee94){var _0x3f97b9=_[_0x488e('0x25')](_0x51ee94[_0x488e('0x26')][_0x488e('0x26')],[_0x4616b0,_0x14febc]);_0x432925(_0x3f97b9);})[_0x488e('0x18')](function(_0x69b98b){_0x206c88(_0x69b98b);});});}function getEndUser(_0xa28376,_0x2dabc7,_0x53bf7d){return function(_0x273d40){return new Promise(function(_0x199432,_0x3d67ed){logger[_0x488e('0xe')](util['format'](_0x488e('0x27'),_0x273d40[_0x488e('0x28')]));searchContact(_0x53bf7d,_0x2dabc7,_0x488e('0x29'),_0x273d40[_0x488e('0x28')])[_0x488e('0x10')](function(_0x19d8ff){if(_0x19d8ff){_0x273d40['endUserId']=_0x19d8ff['id'];logger[_0x488e('0xe')](_0x488e('0x2a'),_0x273d40[_0x488e('0x2b')]);return _0x199432(_0x273d40);}searchContact(_0x53bf7d,_0x2dabc7,'work_number',_0x273d40[_0x488e('0x28')])[_0x488e('0x10')](function(_0x54abe6){if(_0x54abe6){_0x273d40[_0x488e('0x2b')]=_0x54abe6['id'];logger[_0x488e('0xe')](_0x488e('0x2c'),_0x273d40[_0x488e('0x2b')]);return _0x199432(_0x273d40);}createEndUser(_0x273d40,_0xa28376,_0x2dabc7,_0x53bf7d)[_0x488e('0x10')](function(_0x542aca){logger['info'](_0x488e('0x2d'),_0x542aca[_0x488e('0x2b')]);return _0x199432(_0x542aca);});});})[_0x488e('0x18')](function(_0x1732ca){_0x3d67ed(_0x1732ca);});});};}function createEndUser(_0x1dc077,_0x2a72c7,_0x326343,_0x31b451){return new Promise(function(_0x38f5f9,_0x1eba32){var _0x4a4384=moment();var _0x3184d8={'method':_0x488e('0x2e'),'uri':_0x31b451+'/api/contacts','body':{'contact':{'last_name':_0x1dc077[_0x488e('0x28')],'work_number':_0x1dc077[_0x488e('0x28')],'mobile_number':_0x1dc077[_0x488e('0x28')],'owner_id':_0x1dc077['userId'],'created_at':_0x4a4384[_0x488e('0x2f')](_0x488e('0x30'))}},'json':!![]};_0x3184d8['headers']=_0x326343;logger['info'](_0x488e('0x31'));return rp(_0x3184d8)[_0x488e('0x10')](function(_0x236582){_0x1dc077[_0x488e('0x2b')]=_0x236582[_0x488e('0x32')]['id'];_0x38f5f9(_0x1dc077);})[_0x488e('0x18')](function(_0x42f5e9){logger['error']('['+[_0x2a72c7[_0x488e('0x1a')]()]+']',_0x42f5e9[_0x488e('0x1b')]);_0x1eba32(_0x42f5e9[_0x488e('0x1b')]);});});}function getTicket(_0x20348d,_0x38f706,_0x131500,_0x71a189,_0x25f7cb){return function(_0x5e388c){logger['info'](_0x488e('0x33'));return new Promise(function(_0x361662,_0x291610){var _0x2d0a21=moment();var _0x24bcc8={'method':_0x488e('0x2e'),'uri':_0x131500+'/api/tasks','body':{'title':intUtil[_0x488e('0x34')](_0x71a189['Subjects'],_0x25f7cb,'\x20'),'description':intUtil[_0x488e('0x34')](_0x71a189[_0x488e('0x35')],_0x25f7cb,'\x0a'),'owner_id':_0x5e388c[_0x488e('0x1f')],'creater_id':_0x5e388c['adminId'],'targetable_id':_0x5e388c[_0x488e('0x2b')],'targetable_type':_0x488e('0x36'),'created_at':_0x2d0a21['format'](_0x488e('0x30')),'due_date':_0x2d0a21[_0x488e('0x37')](0x1e,'m')[_0x488e('0x2f')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x24bcc8[_0x488e('0xd')]=_0x38f706;return rp(_0x24bcc8)[_0x488e('0x10')](function(_0x5c907b){_0x5e388c[_0x488e('0x38')]=_0x5c907b['task']['id'];logger[_0x488e('0xe')]('Task\x20created:',_0x5e388c[_0x488e('0x38')]);_0x361662(_0x5e388c);})[_0x488e('0x18')](function(_0x18a3cb){logger[_0x488e('0x19')]('['+[_0x20348d[_0x488e('0x1a')]()]+']',_0x18a3cb['message']);_0x291610(_0x18a3cb['message']);});});};}function emit(_0x4b012f,_0x330a7b,_0x46a2e9){var _0xf9d0e4={'uri':_0x4b012f+_0x488e('0x39')+_0x46a2e9};io['to'](util['format']('user:%s',_0x330a7b))['emit'](_0x488e('0x3a'),_0xf9d0e4);}exports['cs']=function(_0x4bf049,_0x1d02aa,_0x4d8758,_0x55ab85,_0x4ef523,_0x5e5364,_0x4950e5,_0x2f7bcb){var _0x248cc7={};var _0x168150={'Authorization':_0x488e('0x3b')+_0x5e5364[_0x488e('0x3c')]};_0x5e5364['remoteUri']=intUtil['stripTrailingSlash'](_0x5e5364['remoteUri']);_0x5e5364[_0x488e('0x3d')]=intUtil[_0x488e('0x3e')](_0x5e5364[_0x488e('0x3d')]);var _0x4ba41f=_0x5e5364[_0x488e('0x3f')];_0x248cc7[_0x488e('0x14')]=_0x5e5364['username'];_0x248cc7['contactNumber']=_0x2f7bcb[_0x488e('0x40')]()===_0x488e('0x41')?_0x1d02aa['destcalleridnum']:_0x1d02aa[_0x488e('0x42')];_0x248cc7[_0x488e('0x43')]=_0x2f7bcb==='queue'||_0x2f7bcb==='unmanaged'?'queue':_0x488e('0x41');if(_0x55ab85){_0x248cc7[_0x488e('0x1e')]=_0x55ab85['email'];}var _0x3a33a8=util['format'](_0x488e('0x44'),_0x5e5364[_0x488e('0x3d')],_0x1d02aa[_0x488e('0x45')],md5(_0x1d02aa[_0x488e('0x45')]));if(_0x4ef523&&_0x4ef523[_0x488e('0x46')]){logger['info'](_0x488e('0x47'),_0x488e('0x48'));_0x1d02aa[_0x488e('0x49')]=_0x3a33a8;}else if(_0x4950e5&&_0x4950e5[_0x488e('0x4a')]&&_0x4950e5[_0x488e('0x4a')]!=='none'){logger[_0x488e('0xe')](_0x488e('0x4b'),_0x488e('0x48'));_0x1d02aa[_0x488e('0x49')]=_0x3a33a8;}else{_0x1d02aa['recordingURL']='';}return getAdminId(_0x248cc7,_0x2f7bcb,_0x168150,_0x4ba41f)['then'](getUser(_0x2f7bcb,_0x168150,_0x4ba41f))[_0x488e('0x10')](getEndUser(_0x2f7bcb,_0x168150,_0x4ba41f))[_0x488e('0x10')](getTicket(_0x2f7bcb,_0x168150,_0x4ba41f,_0x4d8758,_0x1d02aa))['then'](function(_0x3afb8d){logger[_0x488e('0xe')](util[_0x488e('0x2f')](_0x488e('0x4c'),_0x3afb8d[_0x488e('0x38')]));if(_0x2f7bcb!==_0x488e('0x4d')){logger[_0x488e('0xe')]('['+[_0x2f7bcb['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x4ba41f,_0x55ab85[_0x488e('0x4e')],_0x3afb8d[_0x488e('0x2b')]);}})[_0x488e('0x18')](function(_0x5ee539){logger['error']('['+[_0x2f7bcb[_0x488e('0x1a')]()]+_0x488e('0x4f'),util[_0x488e('0x50')](_0x5ee539,{'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 689ed6e..435e69c 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 _0xa801=['salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','toLowerCase','data1','find','Configurations','data3','routeId','outbound','log','desk','error','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','format','%s\x20account\x20#%s\x20not\x20found','data2','util','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xa801,0x1c5));var _0x1a80=function(_0x31c12c,_0x449d7a){_0x31c12c=_0x31c12c-0x0;var _0x3c0791=_0xa801[_0x31c12c];return _0x3c0791;};'use strict';var _=require('lodash');var util=require(_0x1a80('0x0'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x1a80('0x1'));var freshdesk=require(_0x1a80('0x2'));var zoho=require(_0x1a80('0x3'));var desk=require(_0x1a80('0x4'));var vtiger=require(_0x1a80('0x5'));var servicenow=require(_0x1a80('0x6'));var dynamics365=require(_0x1a80('0x7'));var freshsales=require('./freshsales');var integrations=[_0x1a80('0x8'),_0x1a80('0x9'),_0x1a80('0xa'),_0x1a80('0xb'),_0x1a80('0xc'),'desk',_0x1a80('0xd'),_0x1a80('0xe'),_0x1a80('0xf'),_0x1a80('0x10')];exports[_0x1a80('0x11')]=function(_0x34658b,_0x37ce9a,_0x5c036e,_0x200fb6,_0x3d8d66,_0x504352){if(_0x5c036e){if(_['includes'](integrations,_0x34658b['data1'][_0x1a80('0x12')]())){try{var _0x1911f4=null;var _0x5b3029='';var _0x5cf4c2=_0x5c036e[_0x34658b[_0x1a80('0x13')][_0x1a80('0x12')]()];if(_0x5cf4c2){var _0x38b99b=_0x5cf4c2[_0x34658b['data2']];if(_0x38b99b){var _0x35580c=_[_0x1a80('0x14')](_0x38b99b[_0x1a80('0x15')],{'id':parseInt(_0x34658b[_0x1a80('0x16')],0xa)});if(_0x35580c){if(_0x200fb6){if(_0x3d8d66&&_0x37ce9a['queue']){_0x5b3029='queue';}else if(_0x37ce9a[_0x1a80('0x17')]){_0x5b3029=_0x1a80('0x18');}else{console[_0x1a80('0x19')]('EVENT\x20UNKNOWN',_0x37ce9a);}}else{_0x5b3029='unmanaged';}switch(_0x34658b[_0x1a80('0x13')]['toLowerCase']()){case'zendesk':zendesk[_0x5b3029](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352);break;case _0x1a80('0x9'):salesforce[_0x5b3029](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352);break;case _0x1a80('0xa'):sugarcrm[_0x5b3029](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352);break;case _0x1a80('0xb'):freshdesk[_0x5b3029](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352);break;case _0x1a80('0xc'):zoho[_0x5b3029](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352);break;case _0x1a80('0x1a'):desk[_0x5b3029](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352);break;case _0x1a80('0xd'):vtiger[_0x5b3029](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352);break;case _0x1a80('0xf'):freshsales['cs'](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352,_0x5b3029);break;case'servicenow':servicenow['cs'](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352,_0x5b3029);break;case _0x1a80('0xe'):dynamics365['cs'](_0x34658b,_0x37ce9a,_0x35580c,_0x200fb6,_0x3d8d66,_0x38b99b,_0x504352,_0x5b3029);break;default:console[_0x1a80('0x19')]('unknown\x20integration');}}else{_0x1911f4=require('../../../../config/logger')(_0x34658b['data1'][_0x1a80('0x12')]());_0x1911f4[_0x1a80('0x1b')]('[EXEC]',util['format'](_0x1a80('0x1c'),_0x34658b[_0x1a80('0x13')][_0x1a80('0x12')](),_0x34658b[_0x1a80('0x16')]));}}else{_0x1911f4=require(_0x1a80('0x1d'))(_0x34658b[_0x1a80('0x13')]['toLowerCase']());_0x1911f4[_0x1a80('0x1b')]('[EXEC]',util[_0x1a80('0x1e')](_0x1a80('0x1f'),_0x34658b['data1'][_0x1a80('0x12')](),_0x34658b[_0x1a80('0x20')]));}}else{}}catch(_0x1cdfe8){console[_0x1a80('0x1b')](_0x1cdfe8);}}}}; \ No newline at end of file +var _0x496a=['./freshdesk','./vtiger','./servicenow','./dynamics365','./freshsales','sugarcrm','zoho','desk','dynamics365','freshsales','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','zendesk','salesforce','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','lodash','util','./zendesk','./salesforce','./sugarcrm'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0x496a,0x19f));var _0xa496=function(_0x460f4b,_0x2d3b64){_0x460f4b=_0x460f4b-0x0;var _0x551685=_0x496a[_0x460f4b];return _0x551685;};'use strict';var _=require(_0xa496('0x0'));var util=require(_0xa496('0x1'));var zendesk=require(_0xa496('0x2'));var salesforce=require(_0xa496('0x3'));var sugarcrm=require(_0xa496('0x4'));var freshdesk=require(_0xa496('0x5'));var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0xa496('0x6'));var servicenow=require(_0xa496('0x7'));var dynamics365=require(_0xa496('0x8'));var freshsales=require(_0xa496('0x9'));var integrations=['zendesk','salesforce',_0xa496('0xa'),'freshdesk',_0xa496('0xb'),_0xa496('0xc'),'vtiger',_0xa496('0xd'),_0xa496('0xe'),'servicenow'];exports['exec']=function(_0x23080e,_0x3e194e,_0x156f58,_0x4f58c1,_0x24f154,_0x3835d1){if(_0x156f58){if(_[_0xa496('0xf')](integrations,_0x23080e[_0xa496('0x10')][_0xa496('0x11')]())){try{var _0xe4a415=null;var _0xb099f6='';var _0x3889a4=_0x156f58[_0x23080e[_0xa496('0x10')][_0xa496('0x11')]()];if(_0x3889a4){var _0x1f24be=_0x3889a4[_0x23080e[_0xa496('0x12')]];if(_0x1f24be){var _0x22a645=_[_0xa496('0x13')](_0x1f24be[_0xa496('0x14')],{'id':parseInt(_0x23080e[_0xa496('0x15')],0xa)});if(_0x22a645){if(_0x4f58c1){if(_0x24f154&&_0x3e194e[_0xa496('0x16')]){_0xb099f6=_0xa496('0x16');}else if(_0x3e194e[_0xa496('0x17')]){_0xb099f6=_0xa496('0x18');}else{console['log'](_0xa496('0x19'),_0x3e194e);}}else{_0xb099f6=_0xa496('0x1a');}switch(_0x23080e[_0xa496('0x10')][_0xa496('0x11')]()){case _0xa496('0x1b'):zendesk[_0xb099f6](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1);break;case _0xa496('0x1c'):salesforce[_0xb099f6](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1);break;case _0xa496('0xa'):sugarcrm[_0xb099f6](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1);break;case'freshdesk':freshdesk[_0xb099f6](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1);break;case _0xa496('0xb'):zoho[_0xb099f6](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1);break;case _0xa496('0xc'):desk[_0xb099f6](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1);break;case'vtiger':vtiger[_0xb099f6](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1);break;case _0xa496('0xe'):freshsales['cs'](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1,_0xb099f6);break;case'servicenow':servicenow['cs'](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1,_0xb099f6);break;case _0xa496('0xd'):dynamics365['cs'](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1,_0xb099f6);break;default:console[_0xa496('0x1d')](_0xa496('0x1e'));}}else{_0xe4a415=require(_0xa496('0x1f'))(_0x23080e[_0xa496('0x10')][_0xa496('0x11')]());_0xe4a415[_0xa496('0x20')](_0xa496('0x21'),util[_0xa496('0x22')]('%s\x20configuration\x20#%s\x20not\x20found',_0x23080e[_0xa496('0x10')]['toLowerCase'](),_0x23080e['data3']));}}else{_0xe4a415=require(_0xa496('0x1f'))(_0x23080e[_0xa496('0x10')][_0xa496('0x11')]());_0xe4a415[_0xa496('0x20')](_0xa496('0x21'),util[_0xa496('0x22')]('%s\x20account\x20#%s\x20not\x20found',_0x23080e[_0xa496('0x10')][_0xa496('0x11')](),_0x23080e['data2']));}}else{}}catch(_0x2cefd4){console[_0xa496('0x20')](_0x2cefd4);}}}}; \ 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 fe2f366..78407ca 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 _0x3b7d=['recordingURL','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','toUpperCase','isNil','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','socket.io-emitter','redis','emit','assign','getString','Subjects','Descriptions','Task','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','ticketType','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','validateEmail','User','find','execute','length','Email','Agent\x20%s\x20found.','resolve','Name','identity','then','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','additionalSearchAccount','first','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','upperFirst','create','forEach','string','picklist','idField','content','toString','variable','customVariable','Variable','name','concat','remoteUri','login','username','Connection\x20established.','queue','serverUrl','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x3b7d,0x109));var _0xd3b7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3b7d[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xd3b7('0x0'));var rp=require(_0xd3b7('0x1'));var moment=require(_0xd3b7('0x2'));var BPromise=require(_0xd3b7('0x3'));var md5=require(_0xd3b7('0x4'));var jsforce=require(_0xd3b7('0x5'));var util=require(_0xd3b7('0x6'));var Redis=require(_0xd3b7('0x7'));var intUtil=require('./util');var config=require(_0xd3b7('0x8'));var logger=require(_0xd3b7('0x9'))(_0xd3b7('0xa'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd3b7('0xb'))(new Redis(config[_0xd3b7('0xc')]));function emit(_0x573b58,_0x4ad3a6,_0x3757ed){io['to'](_0x573b58)[_0xd3b7('0xd')](_0x4ad3a6,_0x3757ed);}function getTicket(_0x4a89e9,_0x255d6e,_0x92caef,_0x8b69d6,_0x516c28,_0x2ff337,_0x1864ef,_0x44284b){var _0x6f7056=Object[_0xd3b7('0xe')]({},{'OwnerId':_0x255d6e['id'],'Subject':intUtil[_0xd3b7('0xf')](_0x8b69d6[_0xd3b7('0x10')],_0x516c28,'\x20'),'Description':intUtil[_0xd3b7('0xf')](_0x8b69d6[_0xd3b7('0x11')],_0x516c28,'\x0a')},getCustomFields(_0x2ff337,_0x516c28));if(_0x92caef){if(_0x8b69d6['ticketType']===_0xd3b7('0x12')){_0x6f7056['ActivityDate']=moment['utc']();_0x6f7056[_0xd3b7('0x13')]=![];_0x6f7056[_0xd3b7('0x14')]=![];if(_0x92caef[_0xd3b7('0x15')]==='contact'||_0x92caef['endUserType']===_0xd3b7('0x16')){_0x6f7056[_0xd3b7('0x17')]=_0x92caef['id'];}else if(_0x92caef['endUserType']===_0xd3b7('0x18')){_0x6f7056[_0xd3b7('0x19')]=_0x92caef['id'];}}else if(_0x8b69d6[_0xd3b7('0x1a')]===_0xd3b7('0x1b')){if(_0x92caef[_0xd3b7('0x15')]==='contact'){_0x6f7056[_0xd3b7('0x1c')]=_0x92caef['id'];}else if(_0x92caef[_0xd3b7('0x15')]==='account'){_0x6f7056[_0xd3b7('0x1d')]=_0x92caef['id'];}else if(_0x92caef[_0xd3b7('0x15')]===_0xd3b7('0x16')&&_0x8b69d6[_0xd3b7('0x1e')]){_0x6f7056[_0x8b69d6[_0xd3b7('0x1e')]]=_0x92caef['id'];}else{logger[_0xd3b7('0x1f')](_0xd3b7('0x20'));}}}return _0x1864ef[_0xd3b7('0x21')](_0x8b69d6[_0xd3b7('0x1a')])['create'](_0x6f7056);}function getUser(_0x4909e7,_0x191abf,_0x534477){if(!_['isNil'](_0x191abf)&&intUtil[_0xd3b7('0x22')](_0x191abf)){var _0x4a94b3={'Email':_0x191abf};var _0x1772c5={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x534477[_0xd3b7('0x21')](_0xd3b7('0x23'))[_0xd3b7('0x24')](_0x4a94b3,_0x1772c5)[_0xd3b7('0x25')]()['then'](function(_0x1ab855){if(_0x1ab855[_0xd3b7('0x26')]){var _0x12af10=_[_0xd3b7('0x24')](_0x1ab855,function(_0x5aa1aa){return _0x5aa1aa[_0xd3b7('0x27')]===_0x191abf;});if(_0x12af10){logger['info'](_0xd3b7('0x28'),_0x191abf);return BPromise[_0xd3b7('0x29')]({'id':_0x12af10['Id'],'name':_0x12af10[_0xd3b7('0x2a')]});}}else{logger[_0xd3b7('0x1f')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x191abf);return _0x534477[_0xd3b7('0x2b')]()[_0xd3b7('0x2c')](function(_0x279e78){return BPromise['resolve']({'id':_0x279e78[_0xd3b7('0x2d')],'name':_0x279e78[_0xd3b7('0x2e')]});});}});}else{logger[_0xd3b7('0x1f')](_0xd3b7('0x2f'),_0x191abf);return _0x534477[_0xd3b7('0x2b')]()[_0xd3b7('0x2c')](function(_0x191b00){return BPromise[_0xd3b7('0x29')]({'id':_0x191b00[_0xd3b7('0x2d')],'name':_0x191b00[_0xd3b7('0x2e')]});});}}function getEndUser(_0x1b4074,_0x123514,_0x233721,_0x496a98,_0x20e7c3){var _0x283d36={'$or':{'Phone':_0x496a98}};var _0xa86b12={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd3b7('0x29')]()['then'](function(){logger[_0xd3b7('0x1f')](_0xd3b7('0x30'),_0x496a98,_0x123514[_0xd3b7('0x31')]);switch(_0x123514[_0xd3b7('0x31')]){case _0xd3b7('0x32'):var _0x5a5872=_[_0xd3b7('0x33')](_0x283d36);if(_0x123514[_0xd3b7('0x34')]){var _0x21d589={};_0x21d589[_0x123514['additionalSearchContact']]=_0x496a98;_[_0xd3b7('0x35')](_0x5a5872[_0xd3b7('0x36')],_0x21d589);}return _0x20e7c3[_0xd3b7('0x21')](_0xd3b7('0x37'))[_0xd3b7('0x24')](_0x5a5872,_0xa86b12)[_0xd3b7('0x25')]()[_0xd3b7('0x2c')](function(_0x5cab93){if(_0x5cab93&&_0x5cab93[_0xd3b7('0x26')]){return _0x5cab93;}else{var _0x584211=_[_0xd3b7('0x33')](_0x283d36);if(_0x123514['additionalSearchLead']){var _0x238635={};_0x238635[_0x123514[_0xd3b7('0x38')]]=_0x496a98;_['merge'](_0x584211[_0xd3b7('0x36')],_0x238635);}return _0x20e7c3[_0xd3b7('0x21')](_0xd3b7('0x39'))[_0xd3b7('0x24')](_0x584211,_0xa86b12);}});case'account_contact_lead':var _0x4a5497=_[_0xd3b7('0x33')](_0x283d36);if(_0x123514['additionalSearchAccount']){var _0x21d589={};_0x21d589[_0x123514['additionalSearchAccount']]=_0x496a98;_['merge'](_0x4a5497[_0xd3b7('0x36')],_0x21d589);}return _0x20e7c3[_0xd3b7('0x21')]('Account')['find'](_0x4a5497,_0xa86b12)['execute']()[_0xd3b7('0x2c')](function(_0x4c1951){if(_0x4c1951&&_0x4c1951[_0xd3b7('0x26')]){return _0x4c1951;}else{var _0x2f104f=_['cloneDeep'](_0x283d36);if(_0x123514[_0xd3b7('0x34')]){var _0x269a08={};_0x269a08[_0x123514[_0xd3b7('0x34')]]=_0x496a98;_[_0xd3b7('0x35')](_0x2f104f[_0xd3b7('0x36')],_0x269a08);}return _0x20e7c3[_0xd3b7('0x21')]('Contact')['find'](_0x2f104f,_0xa86b12)['then'](function(_0x276f72){if(_0x276f72&&_0x276f72[_0xd3b7('0x26')]){return _0x276f72;}else{var _0x23c121=_[_0xd3b7('0x33')](_0x283d36);if(_0x123514[_0xd3b7('0x38')]){var _0x3dbd96={};_0x3dbd96[_0x123514[_0xd3b7('0x38')]]=_0x496a98;_['merge'](_0x23c121['$or'],_0x3dbd96);}return _0x20e7c3[_0xd3b7('0x21')](_0xd3b7('0x39'))[_0xd3b7('0x24')](_0x23c121,_0xa86b12);}});}});case'contact':var _0x5a5872=_[_0xd3b7('0x33')](_0x283d36);if(_0x123514[_0xd3b7('0x34')]){var _0x21d589={};_0x21d589[_0x123514['additionalSearchContact']]=_0x496a98;_[_0xd3b7('0x35')](_0x5a5872[_0xd3b7('0x36')],_0x21d589);}return _0x20e7c3[_0xd3b7('0x21')](_0xd3b7('0x37'))[_0xd3b7('0x24')](_0x5a5872,_0xa86b12)[_0xd3b7('0x25')]();case _0xd3b7('0x16'):var _0x4999fb=_[_0xd3b7('0x33')](_0x283d36);if(_0x123514[_0xd3b7('0x38')]){var _0x21d589={};_0x21d589[_0x123514[_0xd3b7('0x38')]]=_0x496a98;_[_0xd3b7('0x35')](_0x4999fb[_0xd3b7('0x36')],_0x21d589);}return _0x20e7c3[_0xd3b7('0x21')](_0xd3b7('0x39'))[_0xd3b7('0x24')](_0x4999fb,_0xa86b12);case'account':var _0x4a5497=_['cloneDeep'](_0x283d36);if(_0x123514[_0xd3b7('0x3a')]){var _0x21d589={};_0x21d589[_0x123514['additionalSearchAccount']]=_0x496a98;_[_0xd3b7('0x35')](_0x4a5497[_0xd3b7('0x36')],_0x21d589);}return _0x20e7c3['sobject']('Account')[_0xd3b7('0x24')](_0x4a5497,_0xa86b12);default:return null;}})[_0xd3b7('0x2c')](function(_0x81b054){if(_0x81b054&&_0x81b054['length']){var _0xd9b8a8=_[_0xd3b7('0x3b')](_0x81b054);if(_0xd9b8a8){return BPromise[_0xd3b7('0x29')]({'id':_0xd9b8a8['Id'],'name':_0xd9b8a8['Name'],'phone':_0xd9b8a8['Phone'],'endUserType':_0xd9b8a8[_0xd3b7('0x3c')][_0xd3b7('0x3d')][_0xd3b7('0x3e')]()});}}})['then'](function(_0x3d0e5c){if(_0x3d0e5c){logger[_0xd3b7('0x1f')](_0xd3b7('0x3f'),_0x3d0e5c[_0xd3b7('0x15')],_0x496a98);return BPromise['resolve'](_0x3d0e5c);}else{logger['info'](_0xd3b7('0x40'),_0x496a98);var _0x2c3a40={'Phone':_0x496a98};if(_0x123514[_0xd3b7('0x41')]){if(_0x123514[_0xd3b7('0x41')]==='contact'){logger[_0xd3b7('0x1f')](_0xd3b7('0x42'),_0x496a98,_0x123514[_0xd3b7('0x41')]);_0x2c3a40[_0xd3b7('0x43')]=_0x233721!==_0xd3b7('0x44')?_0x233721:util[_0xd3b7('0x45')](_0xd3b7('0x46'),_0x496a98);}else if(_0x123514[_0xd3b7('0x41')]===_0xd3b7('0x16')){logger['info'](_0xd3b7('0x42'),_0x496a98,_0x123514[_0xd3b7('0x41')]);_0x2c3a40[_0xd3b7('0x43')]=_0x233721!==_0xd3b7('0x44')?_0x233721:util['format'](_0xd3b7('0x46'),_0x496a98);_0x2c3a40[_0xd3b7('0x47')]='No\x20Company';}else if(_0x123514[_0xd3b7('0x41')]===_0xd3b7('0x18')){logger[_0xd3b7('0x1f')](_0xd3b7('0x42'),_0x496a98,_0x123514[_0xd3b7('0x41')]);_0x2c3a40[_0xd3b7('0x2a')]=_0x233721!==_0xd3b7('0x44')?_0x233721:util['format'](_0xd3b7('0x46'),_0x496a98);}else{return null;}}return _0x20e7c3['sobject'](_[_0xd3b7('0x48')](_0x123514[_0xd3b7('0x41')]))[_0xd3b7('0x49')](_0x2c3a40)['then'](function(_0x3881c2){return BPromise[_0xd3b7('0x29')]({'id':_0x3881c2['id'],'endUserType':_0x123514[_0xd3b7('0x41')]});});}});}function getCustomFields(_0x487493,_0x489e54){var _0x449552={};if(_0x487493[_0xd3b7('0x26')]>0x0){_[_0xd3b7('0x4a')](_0x487493,function(_0x42db30){if(_['includes']([_0xd3b7('0x4b'),_0xd3b7('0x4c')],_0x42db30['type'])&&_0x42db30['idField']){_0x449552[_0x42db30[_0xd3b7('0x4d')]]=_0x42db30[_0xd3b7('0x4e')][_0xd3b7('0x4f')]();}else if(_0x42db30['type']===_0xd3b7('0x50')&&_0x42db30['variableName']&&_0x42db30[_0xd3b7('0x4d')]){_0x489e54[_0x42db30['variableName']]&&(_0x449552[_0x42db30['idField']]=_0x489e54[_0x42db30['variableName']]['toString']());}else if(_0x42db30[_0xd3b7('0x3d')]===_0xd3b7('0x51')&&_0x42db30[_0xd3b7('0x52')]&&_0x42db30[_0xd3b7('0x52')][_0xd3b7('0x53')]&&_0x42db30[_0xd3b7('0x4d')]){_0x489e54[_0x42db30[_0xd3b7('0x52')][_0xd3b7('0x53')][_0xd3b7('0x3e')]()]&&(_0x449552[_0x42db30[_0xd3b7('0x4d')]]=_0x489e54[_0x42db30[_0xd3b7('0x52')][_0xd3b7('0x53')][_0xd3b7('0x3e')]()][_0xd3b7('0x4f')]());}});}return _0x449552;}function getConnection(_0x362738){var _0x5af81e=_0x362738['password'][_0xd3b7('0x54')](_0x362738['securityToken']);var _0x5cd7d3=new jsforce['Connection']({'oauth2':{'loginUrl':_0x362738[_0xd3b7('0x55')]||'https://login.salesforce.com','clientId':_0x362738['clientId'],'clientSecret':_0x362738['clientSecret']}});return _0x5cd7d3[_0xd3b7('0x56')](_0x362738[_0xd3b7('0x57')],_0x5af81e)[_0xd3b7('0x2c')](function(){logger[_0xd3b7('0x1f')](_0xd3b7('0x58'));return _0x5cd7d3;});}exports[_0xd3b7('0x59')]=function(_0x27e175,_0xdf014a,_0x505d54,_0x3d59b8,_0x57e8e8,_0x38d9fa){var _0x225757,_0x55a1ab,_0x364dd6,_0x4f3672;_0x38d9fa[_0xd3b7('0x5a')]=intUtil['stripTrailingSlash'](_0x38d9fa[_0xd3b7('0x5a')]);_0x38d9fa[_0xd3b7('0x55')]=intUtil['stripTrailingSlash'](_0x38d9fa[_0xd3b7('0x55')]);if(_0x57e8e8&&_0x57e8e8[_0xd3b7('0x5b')]){logger['info']('[QUEUE]',_0xd3b7('0x5c'));_0xdf014a['recordingURL']=util[_0xd3b7('0x45')](_0xd3b7('0x5d'),_0x38d9fa[_0xd3b7('0x5a')],_0xdf014a[_0xd3b7('0x5e')],md5(_0xdf014a[_0xd3b7('0x5e')]));}else{_0xdf014a['recordingURL']='';}return getConnection(_0x38d9fa)[_0xd3b7('0x2c')](function(_0x3299ed){_0x4f3672=_0x3299ed;return getUser(_0x38d9fa,_0x3d59b8[_0xd3b7('0x5f')],_0x4f3672);})['then'](function(_0x324b7e){_0x225757=_0x324b7e;return getEndUser(_0x38d9fa,_0x505d54,_0xdf014a[_0xd3b7('0x60')],_0xdf014a[_0xd3b7('0x61')],_0x4f3672);})[_0xd3b7('0x2c')](function(_0x5ac3f5){_0x55a1ab=_0x5ac3f5;return getTicket(_0x38d9fa,_0x225757,_0x55a1ab,_0x505d54,_0xdf014a,_0x505d54[_0xd3b7('0x62')],_0x4f3672,_0xd3b7('0x59'));})['then'](function(_0x3eb35c){_0x364dd6=_0x3eb35c;logger[_0xd3b7('0x1f')](_0xd3b7('0x63'),_0x364dd6['id']);logger['info'](_0xd3b7('0x64'),_0x364dd6['id'],_0x3d59b8[_0xd3b7('0x53')],_0x38d9fa[_0xd3b7('0x3d')]);switch(_0x38d9fa[_0xd3b7('0x3d')]){case'integrationTab':emit(util[_0xd3b7('0x45')](_0xd3b7('0x65'),_0x3d59b8[_0xd3b7('0x53')]),_0xd3b7('0x66'),{'recordId':_0x364dd6['id']});break;case _0xd3b7('0x67'):emit(util['format'](_0xd3b7('0x65'),_0x3d59b8[_0xd3b7('0x53')]),_0xd3b7('0x68'),{'uri':util[_0xd3b7('0x45')](_0xd3b7('0x69'),_0x4f3672[_0xd3b7('0x6a')],_0x364dd6['id'])});break;default:logger[_0xd3b7('0x6b')](_0xd3b7('0x6c'));}})[_0xd3b7('0x6d')](function(_0x44f419){logger[_0xd3b7('0x6b')](_0xd3b7('0x6e'),_0x44f419);});};exports[_0xd3b7('0x6f')]=function(_0x6b32f1,_0x4e59fd,_0x2483f5,_0x395c54,_0x223fc1,_0x4144c8,_0x106330){var _0x114583,_0xba2bba,_0x3ac9b6,_0x51a0f0;_0x4144c8[_0xd3b7('0x5a')]=intUtil[_0xd3b7('0x70')](_0x4144c8[_0xd3b7('0x5a')]);_0x4144c8[_0xd3b7('0x55')]=intUtil[_0xd3b7('0x70')](_0x4144c8[_0xd3b7('0x55')]);if(_0x106330&&_0x106330[_0xd3b7('0x71')]&&_0x106330['recordingFormat']!==_0xd3b7('0x72')){logger[_0xd3b7('0x1f')](_0xd3b7('0x73'),_0xd3b7('0x5c'));_0x4e59fd[_0xd3b7('0x74')]=util['format'](_0xd3b7('0x5d'),_0x4144c8[_0xd3b7('0x5a')],_0x4e59fd[_0xd3b7('0x5e')],md5(_0x4e59fd[_0xd3b7('0x5e')]));}return getConnection(_0x4144c8)['then'](function(_0x180a57){_0x51a0f0=_0x180a57;return getUser(_0x4144c8,_0x395c54[_0xd3b7('0x5f')],_0x51a0f0);})[_0xd3b7('0x2c')](function(_0x5adac6){_0x114583=_0x5adac6;return getEndUser(_0x4144c8,_0x2483f5,_0x4e59fd['destcalleridname'],_0x4e59fd[_0xd3b7('0x75')],_0x51a0f0);})[_0xd3b7('0x2c')](function(_0x123a1c){_0xba2bba=_0x123a1c;return getTicket(_0x4144c8,_0x114583,_0xba2bba,_0x2483f5,_0x4e59fd,_0x2483f5[_0xd3b7('0x62')],_0x51a0f0,_0xd3b7('0x6f'));})[_0xd3b7('0x2c')](function(_0x22942e){_0x3ac9b6=_0x22942e;logger[_0xd3b7('0x1f')](_0xd3b7('0x76'),_0x3ac9b6['id']);logger[_0xd3b7('0x1f')](_0xd3b7('0x77'),_0x3ac9b6['id'],_0x395c54['name'],_0x4144c8[_0xd3b7('0x3d')]);switch(_0x4144c8[_0xd3b7('0x3d')]){case _0xd3b7('0x78'):emit(util[_0xd3b7('0x45')](_0xd3b7('0x65'),_0x395c54[_0xd3b7('0x53')]),_0xd3b7('0x66'),{'recordId':_0x3ac9b6['id']});break;case'newTab':emit(util[_0xd3b7('0x45')](_0xd3b7('0x65'),_0x395c54[_0xd3b7('0x53')]),'trigger:browser:url',{'uri':util[_0xd3b7('0x45')](_0xd3b7('0x69'),_0x51a0f0[_0xd3b7('0x6a')],_0x3ac9b6['id'])});break;default:logger[_0xd3b7('0x6b')](_0xd3b7('0x73'),_0xd3b7('0x79'));}})[_0xd3b7('0x6d')](function(_0x3f72a3){logger['error'](_0xd3b7('0x73'),_0x3f72a3);});};exports['unmanaged']=function(_0x4788f9,_0x4acfeb,_0x28fd22,_0x2a1cb6,_0x47b002,_0x2f1d40){var _0x40ce3c,_0x1d34c8,_0x17c916,_0xc22434;_0x2f1d40[_0xd3b7('0x5a')]=intUtil['stripTrailingSlash'](_0x2f1d40[_0xd3b7('0x5a')]);_0x2f1d40[_0xd3b7('0x55')]=intUtil[_0xd3b7('0x70')](_0x2f1d40['remoteUri']);if(_0x47b002&&_0x47b002['monitor_format']){logger[_0xd3b7('0x1f')]('['+_0x4acfeb['lastevent'][_0xd3b7('0x7a')]()+']',_0xd3b7('0x5c'));_0x4acfeb['recordingURL']=util[_0xd3b7('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f1d40[_0xd3b7('0x5a')],_0x4acfeb[_0xd3b7('0x5e')],md5(_0x4acfeb['uniqueid']));}else{_0x4acfeb[_0xd3b7('0x74')]='';}return getConnection(_0x2f1d40)['then'](function(_0x120e2a){_0xc22434=_0x120e2a;if(!_[_0xd3b7('0x7b')](_0x2a1cb6)){return getUser(_0x2f1d40,_0x2a1cb6[_0xd3b7('0x53')],_0xc22434);}else{return getUser(_0x2f1d40,null,_0xc22434);}})[_0xd3b7('0x2c')](function(_0x42d16a){_0x40ce3c=_0x42d16a;return getEndUser(_0x2f1d40,_0x28fd22,_0x4acfeb[_0xd3b7('0x60')],_0x4acfeb[_0xd3b7('0x61')],_0xc22434);})[_0xd3b7('0x2c')](function(_0xd7f86a){_0x1d34c8=_0xd7f86a;return getTicket(_0x2f1d40,_0x40ce3c,_0x1d34c8,_0x28fd22,_0x4acfeb,_0x28fd22[_0xd3b7('0x62')],_0xc22434);})[_0xd3b7('0x2c')](function(_0x25d5f4){_0x17c916=_0x25d5f4;logger['info']('['+_0x4acfeb[_0xd3b7('0x7c')][_0xd3b7('0x7a')]()+_0xd3b7('0x7d'),_0x17c916['id']);logger[_0xd3b7('0x1f')]('['+_0x4acfeb[_0xd3b7('0x7c')][_0xd3b7('0x7a')]()+_0xd3b7('0x7e'),_0x2f1d40[_0xd3b7('0x3d')]);})['catch'](function(_0x249da3){logger[_0xd3b7('0x6b')]('['+_0x4acfeb['lastevent'][_0xd3b7('0x7a')]()+']',_0x249da3);});}; \ No newline at end of file +var _0xe341=['WhatId','Case','lead','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','validateEmail','User','execute','then','length','find','Email','info','Agent\x20%s\x20found.','resolve','identity','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','$or','Lead','additionalSearchAccount','Account','contact','first','Name','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','picklist','idField','content','variableName','toString','Variable','name','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','queue','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','monitor_format','lastevent','toUpperCase','isNil','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','catch','lodash','request-promise','moment','md5','jsforce','util','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','WhoId','account'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe341,0x1cc));var _0x1e34=function(_0x16e434,_0x4be7fc){_0x16e434=_0x16e434-0x0;var _0x3de10a=_0xe341[_0x16e434];return _0x3de10a;};'use strict';var _=require(_0x1e34('0x0'));var rp=require(_0x1e34('0x1'));var moment=require(_0x1e34('0x2'));var BPromise=require('bluebird');var md5=require(_0x1e34('0x3'));var jsforce=require(_0x1e34('0x4'));var util=require(_0x1e34('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x1e34('0x6'))(_0x1e34('0x7'));config[_0x1e34('0x8')]=_[_0x1e34('0x9')](config[_0x1e34('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x1e34('0xa'))(new Redis(config[_0x1e34('0x8')]));function emit(_0xe28229,_0x33df04,_0x2ce0e2){io['to'](_0xe28229)[_0x1e34('0xb')](_0x33df04,_0x2ce0e2);}function getTicket(_0x245def,_0x317eb9,_0x29e014,_0x39640a,_0x5a4de2,_0x5df275,_0x4d4df3,_0x19cd58){var _0x4858b0=Object[_0x1e34('0xc')]({},{'OwnerId':_0x317eb9['id'],'Subject':intUtil[_0x1e34('0xd')](_0x39640a[_0x1e34('0xe')],_0x5a4de2,'\x20'),'Description':intUtil[_0x1e34('0xd')](_0x39640a[_0x1e34('0xf')],_0x5a4de2,'\x0a')},getCustomFields(_0x5df275,_0x5a4de2));if(_0x29e014){if(_0x39640a[_0x1e34('0x10')]===_0x1e34('0x11')){_0x4858b0[_0x1e34('0x12')]=moment['utc']();_0x4858b0[_0x1e34('0x13')]=![];_0x4858b0[_0x1e34('0x14')]=![];if(_0x29e014[_0x1e34('0x15')]==='contact'||_0x29e014[_0x1e34('0x15')]==='lead'){_0x4858b0[_0x1e34('0x16')]=_0x29e014['id'];}else if(_0x29e014[_0x1e34('0x15')]===_0x1e34('0x17')){_0x4858b0[_0x1e34('0x18')]=_0x29e014['id'];}}else if(_0x39640a['ticketType']===_0x1e34('0x19')){if(_0x29e014[_0x1e34('0x15')]==='contact'){_0x4858b0['ContactId']=_0x29e014['id'];}else if(_0x29e014[_0x1e34('0x15')]===_0x1e34('0x17')){_0x4858b0['AccountId']=_0x29e014['id'];}else if(_0x29e014['endUserType']===_0x1e34('0x1a')&&_0x39640a[_0x1e34('0x1b')]){_0x4858b0[_0x39640a[_0x1e34('0x1b')]]=_0x29e014['id'];}else{logger['info'](_0x1e34('0x1c'));}}}return _0x4d4df3[_0x1e34('0x1d')](_0x39640a[_0x1e34('0x10')])['create'](_0x4858b0);}function getUser(_0x5daebc,_0x35db43,_0x56f6e2){if(!_['isNil'](_0x35db43)&&intUtil[_0x1e34('0x1e')](_0x35db43)){var _0x59c6b1={'Email':_0x35db43};var _0x2bce1b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x56f6e2[_0x1e34('0x1d')](_0x1e34('0x1f'))['find'](_0x59c6b1,_0x2bce1b)[_0x1e34('0x20')]()[_0x1e34('0x21')](function(_0x542366){if(_0x542366[_0x1e34('0x22')]){var _0x11ab89=_[_0x1e34('0x23')](_0x542366,function(_0x3165c1){return _0x3165c1[_0x1e34('0x24')]===_0x35db43;});if(_0x11ab89){logger[_0x1e34('0x25')](_0x1e34('0x26'),_0x35db43);return BPromise[_0x1e34('0x27')]({'id':_0x11ab89['Id'],'name':_0x11ab89['Name']});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x35db43);return _0x56f6e2[_0x1e34('0x28')]()[_0x1e34('0x21')](function(_0x1baab4){return BPromise[_0x1e34('0x27')]({'id':_0x1baab4[_0x1e34('0x29')],'name':_0x1baab4[_0x1e34('0x2a')]});});}});}else{logger[_0x1e34('0x25')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x35db43);return _0x56f6e2[_0x1e34('0x28')]()[_0x1e34('0x21')](function(_0x5f106c){return BPromise[_0x1e34('0x27')]({'id':_0x5f106c[_0x1e34('0x29')],'name':_0x5f106c[_0x1e34('0x2a')]});});}}function getEndUser(_0x342702,_0xec835b,_0x272818,_0x261a9c,_0x411286){var _0x1ec6e5={'$or':{'Phone':_0x261a9c}};var _0x53a37e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x1e34('0x27')]()[_0x1e34('0x21')](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x261a9c,_0xec835b[_0x1e34('0x2b')]);switch(_0xec835b[_0x1e34('0x2b')]){case _0x1e34('0x2c'):var _0x3c01e6=_[_0x1e34('0x2d')](_0x1ec6e5);if(_0xec835b[_0x1e34('0x2e')]){var _0xd6a1ad={};_0xd6a1ad[_0xec835b['additionalSearchContact']]=_0x261a9c;_[_0x1e34('0x2f')](_0x3c01e6['$or'],_0xd6a1ad);}return _0x411286[_0x1e34('0x1d')](_0x1e34('0x30'))[_0x1e34('0x23')](_0x3c01e6,_0x53a37e)[_0x1e34('0x20')]()['then'](function(_0x347ce6){if(_0x347ce6&&_0x347ce6[_0x1e34('0x22')]){return _0x347ce6;}else{var _0xad54ae=_[_0x1e34('0x2d')](_0x1ec6e5);if(_0xec835b[_0x1e34('0x31')]){var _0x1b34c9={};_0x1b34c9[_0xec835b['additionalSearchLead']]=_0x261a9c;_[_0x1e34('0x2f')](_0xad54ae[_0x1e34('0x32')],_0x1b34c9);}return _0x411286[_0x1e34('0x1d')](_0x1e34('0x33'))['find'](_0xad54ae,_0x53a37e);}});case'account_contact_lead':var _0x4d91e3=_[_0x1e34('0x2d')](_0x1ec6e5);if(_0xec835b[_0x1e34('0x34')]){var _0xd6a1ad={};_0xd6a1ad[_0xec835b[_0x1e34('0x34')]]=_0x261a9c;_[_0x1e34('0x2f')](_0x4d91e3[_0x1e34('0x32')],_0xd6a1ad);}return _0x411286[_0x1e34('0x1d')](_0x1e34('0x35'))[_0x1e34('0x23')](_0x4d91e3,_0x53a37e)[_0x1e34('0x20')]()[_0x1e34('0x21')](function(_0x1c3c12){if(_0x1c3c12&&_0x1c3c12[_0x1e34('0x22')]){return _0x1c3c12;}else{var _0x5acc79=_['cloneDeep'](_0x1ec6e5);if(_0xec835b[_0x1e34('0x2e')]){var _0x12505b={};_0x12505b[_0xec835b[_0x1e34('0x2e')]]=_0x261a9c;_[_0x1e34('0x2f')](_0x5acc79[_0x1e34('0x32')],_0x12505b);}return _0x411286[_0x1e34('0x1d')](_0x1e34('0x30'))['find'](_0x5acc79,_0x53a37e)['then'](function(_0xfd204c){if(_0xfd204c&&_0xfd204c[_0x1e34('0x22')]){return _0xfd204c;}else{var _0x34af29=_[_0x1e34('0x2d')](_0x1ec6e5);if(_0xec835b[_0x1e34('0x31')]){var _0x4bc508={};_0x4bc508[_0xec835b[_0x1e34('0x31')]]=_0x261a9c;_[_0x1e34('0x2f')](_0x34af29['$or'],_0x4bc508);}return _0x411286[_0x1e34('0x1d')](_0x1e34('0x33'))['find'](_0x34af29,_0x53a37e);}});}});case _0x1e34('0x36'):var _0x3c01e6=_[_0x1e34('0x2d')](_0x1ec6e5);if(_0xec835b['additionalSearchContact']){var _0xd6a1ad={};_0xd6a1ad[_0xec835b[_0x1e34('0x2e')]]=_0x261a9c;_[_0x1e34('0x2f')](_0x3c01e6['$or'],_0xd6a1ad);}return _0x411286['sobject'](_0x1e34('0x30'))['find'](_0x3c01e6,_0x53a37e)[_0x1e34('0x20')]();case _0x1e34('0x1a'):var _0x4ec02c=_[_0x1e34('0x2d')](_0x1ec6e5);if(_0xec835b['additionalSearchLead']){var _0xd6a1ad={};_0xd6a1ad[_0xec835b[_0x1e34('0x31')]]=_0x261a9c;_[_0x1e34('0x2f')](_0x4ec02c['$or'],_0xd6a1ad);}return _0x411286['sobject']('Lead')[_0x1e34('0x23')](_0x4ec02c,_0x53a37e);case'account':var _0x4d91e3=_[_0x1e34('0x2d')](_0x1ec6e5);if(_0xec835b[_0x1e34('0x34')]){var _0xd6a1ad={};_0xd6a1ad[_0xec835b[_0x1e34('0x34')]]=_0x261a9c;_[_0x1e34('0x2f')](_0x4d91e3[_0x1e34('0x32')],_0xd6a1ad);}return _0x411286['sobject'](_0x1e34('0x35'))['find'](_0x4d91e3,_0x53a37e);default:return null;}})[_0x1e34('0x21')](function(_0x2a8b4f){if(_0x2a8b4f&&_0x2a8b4f[_0x1e34('0x22')]){var _0x383134=_[_0x1e34('0x37')](_0x2a8b4f);if(_0x383134){return BPromise[_0x1e34('0x27')]({'id':_0x383134['Id'],'name':_0x383134[_0x1e34('0x38')],'phone':_0x383134['Phone'],'endUserType':_0x383134['attributes'][_0x1e34('0x39')][_0x1e34('0x3a')]()});}}})[_0x1e34('0x21')](function(_0x1afc00){if(_0x1afc00){logger[_0x1e34('0x25')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x1afc00[_0x1e34('0x15')],_0x261a9c);return BPromise[_0x1e34('0x27')](_0x1afc00);}else{logger['info'](_0x1e34('0x3b'),_0x261a9c);var _0x4579c8={'Phone':_0x261a9c};if(_0xec835b['moduleCreate']){if(_0xec835b[_0x1e34('0x3c')]===_0x1e34('0x36')){logger['info'](_0x1e34('0x3d'),_0x261a9c,_0xec835b[_0x1e34('0x3c')]);_0x4579c8[_0x1e34('0x3e')]=_0x272818!==_0x1e34('0x3f')?_0x272818:util[_0x1e34('0x40')](_0x1e34('0x41'),_0x261a9c);}else if(_0xec835b[_0x1e34('0x3c')]===_0x1e34('0x1a')){logger[_0x1e34('0x25')](_0x1e34('0x3d'),_0x261a9c,_0xec835b[_0x1e34('0x3c')]);_0x4579c8['LastName']=_0x272818!==_0x1e34('0x3f')?_0x272818:util[_0x1e34('0x40')](_0x1e34('0x41'),_0x261a9c);_0x4579c8[_0x1e34('0x42')]=_0x1e34('0x43');}else if(_0xec835b[_0x1e34('0x3c')]===_0x1e34('0x17')){logger['info'](_0x1e34('0x3d'),_0x261a9c,_0xec835b[_0x1e34('0x3c')]);_0x4579c8[_0x1e34('0x38')]=_0x272818!==_0x1e34('0x3f')?_0x272818:util['format']('Caller\x20-\x20%s',_0x261a9c);}else{return null;}}return _0x411286[_0x1e34('0x1d')](_[_0x1e34('0x44')](_0xec835b[_0x1e34('0x3c')]))['create'](_0x4579c8)[_0x1e34('0x21')](function(_0x5f3a2b){return BPromise[_0x1e34('0x27')]({'id':_0x5f3a2b['id'],'endUserType':_0xec835b['moduleCreate']});});}});}function getCustomFields(_0x4e30a4,_0x218350){var _0x26d612={};if(_0x4e30a4[_0x1e34('0x22')]>0x0){_[_0x1e34('0x45')](_0x4e30a4,function(_0x429f70){if(_[_0x1e34('0x46')](['string',_0x1e34('0x47')],_0x429f70[_0x1e34('0x39')])&&_0x429f70['idField']){_0x26d612[_0x429f70[_0x1e34('0x48')]]=_0x429f70[_0x1e34('0x49')]['toString']();}else if(_0x429f70[_0x1e34('0x39')]==='variable'&&_0x429f70[_0x1e34('0x4a')]&&_0x429f70[_0x1e34('0x48')]){_0x218350[_0x429f70[_0x1e34('0x4a')]]&&(_0x26d612[_0x429f70[_0x1e34('0x48')]]=_0x218350[_0x429f70[_0x1e34('0x4a')]][_0x1e34('0x4b')]());}else if(_0x429f70[_0x1e34('0x39')]==='customVariable'&&_0x429f70['Variable']&&_0x429f70[_0x1e34('0x4c')][_0x1e34('0x4d')]&&_0x429f70[_0x1e34('0x48')]){_0x218350[_0x429f70['Variable'][_0x1e34('0x4d')]['toLowerCase']()]&&(_0x26d612[_0x429f70['idField']]=_0x218350[_0x429f70[_0x1e34('0x4c')][_0x1e34('0x4d')]['toLowerCase']()][_0x1e34('0x4b')]());}});}return _0x26d612;}function getConnection(_0x888e4f){var _0x21220c=_0x888e4f[_0x1e34('0x4e')]['concat'](_0x888e4f[_0x1e34('0x4f')]);var _0x58b95f=new jsforce[(_0x1e34('0x50'))]({'oauth2':{'loginUrl':_0x888e4f[_0x1e34('0x51')]||_0x1e34('0x52'),'clientId':_0x888e4f[_0x1e34('0x53')],'clientSecret':_0x888e4f['clientSecret']}});return _0x58b95f[_0x1e34('0x54')](_0x888e4f[_0x1e34('0x55')],_0x21220c)[_0x1e34('0x21')](function(){logger[_0x1e34('0x25')]('Connection\x20established.');return _0x58b95f;});}exports['queue']=function(_0x30ceb7,_0x4ccfff,_0x20f349,_0x3172ce,_0xa0f0c5,_0xf8f3cd){var _0x457097,_0x168a87,_0x4a5a30,_0x55970a;_0xf8f3cd[_0x1e34('0x56')]=intUtil['stripTrailingSlash'](_0xf8f3cd['serverUrl']);_0xf8f3cd[_0x1e34('0x51')]=intUtil[_0x1e34('0x57')](_0xf8f3cd[_0x1e34('0x51')]);if(_0xa0f0c5&&_0xa0f0c5['monitor_format']){logger[_0x1e34('0x25')](_0x1e34('0x58'),_0x1e34('0x59'));_0x4ccfff[_0x1e34('0x5a')]=util[_0x1e34('0x40')](_0x1e34('0x5b'),_0xf8f3cd[_0x1e34('0x56')],_0x4ccfff[_0x1e34('0x5c')],md5(_0x4ccfff[_0x1e34('0x5c')]));}else{_0x4ccfff[_0x1e34('0x5a')]='';}return getConnection(_0xf8f3cd)[_0x1e34('0x21')](function(_0x38e148){_0x55970a=_0x38e148;return getUser(_0xf8f3cd,_0x3172ce[_0x1e34('0x5d')],_0x55970a);})['then'](function(_0x56d8df){_0x457097=_0x56d8df;return getEndUser(_0xf8f3cd,_0x20f349,_0x4ccfff['calleridname'],_0x4ccfff[_0x1e34('0x5e')],_0x55970a);})[_0x1e34('0x21')](function(_0x127f9a){_0x168a87=_0x127f9a;return getTicket(_0xf8f3cd,_0x457097,_0x168a87,_0x20f349,_0x4ccfff,_0x20f349[_0x1e34('0x5f')],_0x55970a,_0x1e34('0x60'));})[_0x1e34('0x21')](function(_0x2f34df){_0x4a5a30=_0x2f34df;logger[_0x1e34('0x25')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x4a5a30['id']);logger[_0x1e34('0x25')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x4a5a30['id'],_0x3172ce[_0x1e34('0x4d')],_0xf8f3cd[_0x1e34('0x39')]);switch(_0xf8f3cd[_0x1e34('0x39')]){case _0x1e34('0x61'):emit(util[_0x1e34('0x40')](_0x1e34('0x62'),_0x3172ce['name']),_0x1e34('0x63'),{'recordId':_0x4a5a30['id']});break;case _0x1e34('0x64'):emit(util[_0x1e34('0x40')](_0x1e34('0x62'),_0x3172ce[_0x1e34('0x4d')]),'trigger:browser:url',{'uri':util[_0x1e34('0x40')](_0x1e34('0x65'),_0x55970a[_0x1e34('0x66')],_0x4a5a30['id'])});break;default:logger['error'](_0x1e34('0x67'));}})['catch'](function(_0x35e396){logger[_0x1e34('0x68')](_0x1e34('0x58'),_0x35e396);});};exports[_0x1e34('0x69')]=function(_0x51d23c,_0x4dc6d3,_0x4b6132,_0x11de7c,_0xb0be22,_0x35ed00,_0x2e602f){var _0x36003a,_0xd4150a,_0x2094e6,_0x1afc3c;_0x35ed00[_0x1e34('0x56')]=intUtil['stripTrailingSlash'](_0x35ed00[_0x1e34('0x56')]);_0x35ed00[_0x1e34('0x51')]=intUtil[_0x1e34('0x57')](_0x35ed00[_0x1e34('0x51')]);if(_0x2e602f&&_0x2e602f[_0x1e34('0x6a')]&&_0x2e602f[_0x1e34('0x6a')]!==_0x1e34('0x6b')){logger['info'](_0x1e34('0x6c'),'Recording\x20is\x20enabled!');_0x4dc6d3[_0x1e34('0x5a')]=util[_0x1e34('0x40')](_0x1e34('0x5b'),_0x35ed00[_0x1e34('0x56')],_0x4dc6d3['uniqueid'],md5(_0x4dc6d3[_0x1e34('0x5c')]));}return getConnection(_0x35ed00)[_0x1e34('0x21')](function(_0x1c655e){_0x1afc3c=_0x1c655e;return getUser(_0x35ed00,_0x11de7c['email'],_0x1afc3c);})['then'](function(_0x19ded8){_0x36003a=_0x19ded8;return getEndUser(_0x35ed00,_0x4b6132,_0x4dc6d3['destcalleridname'],_0x4dc6d3[_0x1e34('0x6d')],_0x1afc3c);})[_0x1e34('0x21')](function(_0x2563b0){_0xd4150a=_0x2563b0;return getTicket(_0x35ed00,_0x36003a,_0xd4150a,_0x4b6132,_0x4dc6d3,_0x4b6132[_0x1e34('0x5f')],_0x1afc3c,'outbound');})[_0x1e34('0x21')](function(_0x515fec){_0x2094e6=_0x515fec;logger[_0x1e34('0x25')](_0x1e34('0x6e'),_0x2094e6['id']);logger['info'](_0x1e34('0x6f'),_0x2094e6['id'],_0x11de7c[_0x1e34('0x4d')],_0x35ed00[_0x1e34('0x39')]);switch(_0x35ed00[_0x1e34('0x39')]){case _0x1e34('0x61'):emit(util[_0x1e34('0x40')](_0x1e34('0x62'),_0x11de7c[_0x1e34('0x4d')]),_0x1e34('0x63'),{'recordId':_0x2094e6['id']});break;case _0x1e34('0x64'):emit(util[_0x1e34('0x40')]('user:%s',_0x11de7c[_0x1e34('0x4d')]),_0x1e34('0x70'),{'uri':util['format']('%s/%s/e',_0x1afc3c[_0x1e34('0x66')],_0x2094e6['id'])});break;default:logger[_0x1e34('0x68')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x22c353){logger[_0x1e34('0x68')](_0x1e34('0x6c'),_0x22c353);});};exports['unmanaged']=function(_0x5ce297,_0x6f7e41,_0x486fdc,_0x91d3d6,_0x5f5a64,_0x31449e){var _0x12deee,_0x534a28,_0x5e2860,_0x2dfab1;_0x31449e['serverUrl']=intUtil['stripTrailingSlash'](_0x31449e[_0x1e34('0x56')]);_0x31449e['remoteUri']=intUtil[_0x1e34('0x57')](_0x31449e[_0x1e34('0x51')]);if(_0x5f5a64&&_0x5f5a64[_0x1e34('0x71')]){logger['info']('['+_0x6f7e41[_0x1e34('0x72')][_0x1e34('0x73')]()+']',_0x1e34('0x59'));_0x6f7e41['recordingURL']=util[_0x1e34('0x40')](_0x1e34('0x5b'),_0x31449e['serverUrl'],_0x6f7e41[_0x1e34('0x5c')],md5(_0x6f7e41[_0x1e34('0x5c')]));}else{_0x6f7e41[_0x1e34('0x5a')]='';}return getConnection(_0x31449e)[_0x1e34('0x21')](function(_0x290c52){_0x2dfab1=_0x290c52;if(!_[_0x1e34('0x74')](_0x91d3d6)){return getUser(_0x31449e,_0x91d3d6[_0x1e34('0x4d')],_0x2dfab1);}else{return getUser(_0x31449e,null,_0x2dfab1);}})[_0x1e34('0x21')](function(_0x29614f){_0x12deee=_0x29614f;return getEndUser(_0x31449e,_0x486fdc,_0x6f7e41[_0x1e34('0x75')],_0x6f7e41[_0x1e34('0x5e')],_0x2dfab1);})['then'](function(_0x132468){_0x534a28=_0x132468;return getTicket(_0x31449e,_0x12deee,_0x534a28,_0x486fdc,_0x6f7e41,_0x486fdc[_0x1e34('0x5f')],_0x2dfab1);})[_0x1e34('0x21')](function(_0xe20e45){_0x5e2860=_0xe20e45;logger['info']('['+_0x6f7e41[_0x1e34('0x72')][_0x1e34('0x73')]()+_0x1e34('0x76'),_0x5e2860['id']);logger[_0x1e34('0x25')]('['+_0x6f7e41['lastevent'][_0x1e34('0x73')]()+_0x1e34('0x77'),_0x31449e[_0x1e34('0x39')]);})[_0x1e34('0x78')](function(_0x1f7446){logger['error']('['+_0x6f7e41[_0x1e34('0x72')]['toUpperCase']()+']',_0x1f7446);});}; \ 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 f89de79..c8a140c 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 _0x438e=['variable','customVariable','Variable','name','outbound','incident','assign','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','Incident','Incident\x20-\x20','push','all','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','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20entity','length','active','true','userId','adminId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','customField','toLowerCase','toString','type','idField','content'];(function(_0x2a2db6,_0x6e4311){var _0x5e895e=function(_0x53b8a2){while(--_0x53b8a2){_0x2a2db6['push'](_0x2a2db6['shift']());}};_0x5e895e(++_0x6e4311);}(_0x438e,0x16d));var _0xe438=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x438e[_0x4e1d03];return _0x362d4b;};'use strict';var _=require(_0xe438('0x0'));var Promise=require(_0xe438('0x1'));var rp=require(_0xe438('0x2'));var util=require(_0xe438('0x3'));var md5=require(_0xe438('0x4'));var Redis=require(_0xe438('0x5'));var intUtil=require('./util');var config=require(_0xe438('0x6'));var logger=require(_0xe438('0x7'))(_0xe438('0x8'));config['redis']=_[_0xe438('0x9')](config[_0xe438('0xa')],{'host':_0xe438('0xb'),'port':0x18eb});var io=require(_0xe438('0xc'))(new Redis(config[_0xe438('0xa')]));function getAdminUser(_0x514d13,_0x3d0af9,_0x390994,_0x2e4de0,_0x5da5f5,_0x3bb01d){return new Promise(function(_0x33443e,_0x5aa6d5){var _0x2927fd={'method':_0xe438('0xd'),'uri':_0x2e4de0+_0xe438('0xe')+'&'+_0x5da5f5+'&'+_0x3bb01d,'auth':_0x3d0af9,'json':!![]};return rp(_0x2927fd)[_0xe438('0xf')](function(_0x50b882){if(_0x50b882[_0xe438('0x10')]['length']>0x0){_0x390994['adminId']=_0x50b882[_0xe438('0x10')][0x0][_0xe438('0x11')];}logger[_0xe438('0x12')]('['+[_0x514d13[_0xe438('0x13')]()]+_0xe438('0x14'),_0x390994);_0x33443e(_0x390994);})[_0xe438('0x15')](function(_0x54e3eb){logger[_0xe438('0x16')]('['+[_0x514d13['toUpperCase']()]+']',_0x54e3eb[_0xe438('0x17')]);_0x5aa6d5(_0x54e3eb[_0xe438('0x17')]);});});}function getUser(_0xd00ca9,_0x7d1de6,_0x58587a,_0x30e310,_0x47ef02){return function(_0x133c56){logger[_0xe438('0x12')]('['+[_0xd00ca9[_0xe438('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x133c56);return new Promise(function(_0x5dc490,_0x4f339e){if(intUtil[_0xe438('0x18')](_0x133c56['userEmail'])){var _0x5c3061={'method':'GET','uri':_0x58587a+_0xe438('0x19')+_0x133c56[_0xe438('0x1a')]+'&'+_0x30e310+'&'+_0x47ef02,'auth':_0x7d1de6,'json':!![]};logger[_0xe438('0x12')]('['+[_0xd00ca9['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x5c3061);return rp(_0x5c3061)[_0xe438('0xf')](function(_0x55bb48){logger[_0xe438('0x12')]('['+[_0xd00ca9[_0xe438('0x13')]()]+_0xe438('0x1b'),_0x55bb48);if(_0x55bb48[_0xe438('0x10')][_0xe438('0x1c')]>0x0&&String(_0x55bb48[_0xe438('0x10')][0x0][_0xe438('0x1d')])===_0xe438('0x1e')){_0x133c56[_0xe438('0x1f')]=_0x55bb48['result'][0x0][_0xe438('0x11')];}else{_0x133c56[_0xe438('0x1f')]=_0x133c56[_0xe438('0x20')];_0x133c56[_0xe438('0x1a')]=_0x133c56[_0xe438('0x21')];}logger[_0xe438('0x12')]('['+[_0xd00ca9[_0xe438('0x13')]()]+_0xe438('0x22'),_0x133c56);_0x5dc490(_0x133c56);})['catch'](function(_0x243ddc){logger[_0xe438('0x16')]('['+[_0xd00ca9[_0xe438('0x13')]()]+']',_0x243ddc[_0xe438('0x17')]);_0x4f339e(_0x243ddc['message']);});}else{logger['info']('['+[_0xd00ca9[_0xe438('0x13')]()]+_0xe438('0x23'));_0x133c56[_0xe438('0x1f')]=_0x133c56['adminId'];_0x133c56[_0xe438('0x1a')]=_0x133c56[_0xe438('0x21')];_0x5dc490(_0x133c56);}});};}function createEndUser(_0x558083,_0x299877,_0x23058a,_0x3637ba,_0x5c455c){logger['info']('['+[_0x558083['toUpperCase']()]+_0xe438('0x24'),_0x23058a);return new Promise(function(_0x5f1af5,_0x22fa4b){var _0x4dedbb={'method':_0xe438('0x25'),'uri':_0x3637ba+'sys_user?'+_0x5c455c,'body':{'user_name':_0x23058a[_0xe438('0x26')],'roles':'user','first_name':_0x23058a[_0xe438('0x26')],'active':_0xe438('0x1e'),'date_format':_0xe438('0x27'),'phone':_0x23058a[_0xe438('0x26')]},'auth':_0x299877,'json':!![]};return rp(_0x4dedbb)[_0xe438('0xf')](function(_0x3c8c97){logger[_0xe438('0x12')]('['+[_0x558083['toUpperCase']()]+_0xe438('0x28'),_0x3c8c97[_0xe438('0x10')]);_0x23058a[_0xe438('0x29')]=_0x3c8c97['result'][_0xe438('0x11')];_0x5f1af5(_0x23058a);})[_0xe438('0x15')](function(_0x56e168){logger[_0xe438('0x16')]('['+[_0x558083['toUpperCase']()]+']',_0x56e168[_0xe438('0x17')]);_0x22fa4b(_0x56e168[_0xe438('0x17')]);});});}function getEndUser(_0x1041a2,_0x4b6fb8,_0x544ba7,_0x15ff56,_0x4b76be){return function(_0x2074c0){logger['info']('['+[_0x1041a2['toUpperCase']()]+_0xe438('0x2a'),_0x2074c0);return new Promise(function(_0x2e2203,_0x286355){var _0x1d260d={'method':'GET','uri':_0x544ba7+'sys_user?sysparm_query=phone%3D'+_0x2074c0['endUserNumber']+'&'+_0x15ff56+'&'+_0x4b76be,'auth':_0x4b6fb8,'json':!![]};return rp(_0x1d260d)[_0xe438('0xf')](function(_0x15fcad){if(_0x15fcad[_0xe438('0x10')][_0xe438('0x1c')]>0x0){_0x2074c0[_0xe438('0x29')]=_0x15fcad[_0xe438('0x10')][0x0]['sys_id'];logger['info']('['+[_0x1041a2['toUpperCase']()]+_0xe438('0x2b'),_0x2074c0);_0x2e2203(_0x2074c0);}else{return createEndUser(_0x1041a2,_0x4b6fb8,_0x2074c0,_0x544ba7,_0x15ff56)['then'](function(_0x47ed73){logger[_0xe438('0x12')]('['+[_0x1041a2[_0xe438('0x13')]()]+_0xe438('0x2c'),_0x47ed73);_0x2e2203(_0x47ed73);});}})[_0xe438('0x15')](function(_0xc93989){logger['error']('['+[_0x1041a2[_0xe438('0x13')]()]+']',_0xc93989[_0xe438('0x17')]);_0x286355(_0xc93989['message']);});});};}function getCustomFields(_0x73cc2a,_0x3bb0ff){var _0x4a723f={};if(_0x73cc2a[_0xe438('0x1c')]>0x0){_[_0xe438('0x2d')](_0x73cc2a,function(_0x12aff5){if(_[_0xe438('0x2e')]([_0xe438('0x2f'),_0xe438('0x30')],_0x12aff5['type'])&&_0x12aff5['nameField']&&!_0x12aff5[_0xe438('0x31')]){_0x4a723f[_0x12aff5['nameField'][_0xe438('0x32')]()]=_0x12aff5['content'][_0xe438('0x33')]();}else if(_[_0xe438('0x2e')]([_0xe438('0x2f'),_0xe438('0x30')],_0x12aff5[_0xe438('0x34')])&&_0x12aff5[_0xe438('0x35')]&&_0x12aff5[_0xe438('0x31')]){_0x4a723f[_0x12aff5[_0xe438('0x35')][_0xe438('0x32')]()]=_0x12aff5[_0xe438('0x36')]['toString']();}else if(_0x12aff5['type']===_0xe438('0x37')&&_0x12aff5['variableName']&&_0x12aff5[_0xe438('0x35')]&&_0x12aff5[_0xe438('0x31')]){_0x4a723f[_0x12aff5[_0xe438('0x35')][_0xe438('0x32')]()]=_0x3bb0ff[_0x12aff5['variableName']][_0xe438('0x33')]();}else if(_0x12aff5[_0xe438('0x34')]===_0xe438('0x38')&&_0x12aff5[_0xe438('0x39')]&&_0x12aff5[_0xe438('0x39')][_0xe438('0x3a')]&&_0x12aff5[_0xe438('0x35')]&&_0x12aff5[_0xe438('0x31')]){_0x4a723f[_0x12aff5[_0xe438('0x35')]['toLowerCase']()]=_0x3bb0ff[_0x12aff5['Variable']['name']['toLowerCase']()][_0xe438('0x33')]();}});}return _0x4a723f;}function getTicket(_0x486ddd,_0x432a76,_0xea10db,_0x5bb5f5,_0x4659e5,_0x34bc37){return function(_0x37e10a){logger[_0xe438('0x12')]('['+[_0x486ddd['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0x37e10a);return new Promise(function(_0x28a1a2,_0x258061){var _0x193f6b=_0x486ddd[_0xe438('0x32')]()===_0xe438('0x3b')?_0x37e10a[_0xe438('0x1f')]:_0x37e10a['endUserId'];var _0x50a0f8={'method':_0xe438('0x25'),'uri':_0xea10db+_0xe438('0x3c')+'?'+_0x34bc37,'body':Object[_0xe438('0x3d')]({},{'active':'true','caller_id':_0x193f6b,'assigned_to':_0x37e10a[_0xe438('0x1f')],'short_description':intUtil['getString'](_0x5bb5f5['Subjects'],_0x4659e5,'\x20'),'description':intUtil['getString'](_0x5bb5f5[_0xe438('0x3e')],_0x4659e5,'\x0a')},getCustomFields(_0x5bb5f5['Fields'],_0x4659e5)),'auth':_0x432a76,'json':!![]};return rp(_0x50a0f8)[_0xe438('0xf')](function(_0x3ee1da){logger['info']('['+[_0x486ddd['toUpperCase']()]+_0xe438('0x3f'),_0x3ee1da[_0xe438('0x10')]);_0x37e10a[_0xe438('0x40')]=_0x3ee1da[_0xe438('0x10')][_0xe438('0x11')];_0x37e10a[_0xe438('0x41')]=_0x3ee1da['result'][_0xe438('0x42')];logger[_0xe438('0x12')]('['+[_0x486ddd['toUpperCase']()]+']\x20getTicket\x20crm',_0x37e10a);_0x28a1a2(_0x37e10a);})[_0xe438('0x15')](function(_0x720c21){logger['error']('['+[_0x486ddd[_0xe438('0x13')]()]+']',_0x720c21[_0xe438('0x17')]);_0x258061(_0x720c21[_0xe438('0x17')]);});});};}function createRemoteTag(_0x59bd89,_0x564f29,_0x248b02,_0xfcc67b){return new Promise(function(_0x483699,_0x450e6e){var _0x194550={'method':'POST','uri':_0x248b02+_0xe438('0x43')+'?'+_0xfcc67b,'body':{'short_description':_0x59bd89,'global':!![],'active':!![],'name':_0x59bd89},'auth':_0x564f29,'json':!![]};return rp(_0x194550)[_0xe438('0xf')](function(_0x1c54ed){var _0x297311=_0x1c54ed['result']['sys_id'];_0x483699(_0x297311);});});}function getRemoteTag(_0x47b608,_0x53f004,_0x522c4f,_0x13b02e,_0x570e73){return new Promise(function(_0x50e8af,_0x91ae07){var _0x14ceb8={'method':_0xe438('0xd'),'uri':_0x522c4f+_0xe438('0x43')+'?sysparm_query=name%3D'+_0x47b608+'&'+_0x13b02e,'auth':_0x53f004,'json':!![]};return rp(_0x14ceb8)['then'](function(_0x550947){if(_0x550947[_0xe438('0x10')][_0xe438('0x1c')]>0x0){var _0x2268e2=_0x550947['result'][0x0][_0xe438('0x11')];_0x50e8af(_0x2268e2);}else{return createRemoteTag(_0x47b608,_0x53f004,_0x522c4f,_0x13b02e)[_0xe438('0xf')](function(_0x19f32f){_0x50e8af(_0x19f32f);});}});});}function assignTagToIncident(_0x2f608a,_0x1c364d,_0x516a19,_0x13ee3f,_0x28224d){return new Promise(function(_0x5e8cba,_0x37552e){var _0x371b29={'method':_0xe438('0x25'),'uri':_0x516a19+'label_entry'+'?'+_0x28224d,'body':{'label':_0x2f608a,'table':_0xe438('0x3c'),'id_type':_0xe438('0x44'),'table_key':_0x13ee3f[_0xe438('0x40')],'title':_0xe438('0x45')+_0x13ee3f['ticketNumber'],'id_display':_0x13ee3f[_0xe438('0x41')]},'auth':_0x1c364d,'json':!![]};return rp(_0x371b29)[_0xe438('0xf')](function(_0x13cb85){_0x5e8cba();})[_0xe438('0x15')](function(){_0x5e8cba();});});}function manageTags(_0x25ced2,_0x52674b,_0x173c92,_0x3ee177,_0x5c4169,_0x1489ff,_0x4b69bc){return new Promise(function(_0x4afceb,_0x390f34){var _0x5de438=[];_0x52674b[_0xe438('0x2d')](function(_0x3d6dfb){_0x5de438[_0xe438('0x46')](getRemoteTag(_0x3d6dfb,_0x173c92,_0x3ee177,_0x1489ff,_0x4b69bc));});return Promise[_0xe438('0x47')](_0x5de438)[_0xe438('0xf')](function(_0x2b4fe6){if(_0x2b4fe6[_0xe438('0x1c')]){logger[_0xe438('0x12')]('['+[_0x25ced2[_0xe438('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x2b4fe6);var _0x26576a=[];_0x2b4fe6[_0xe438('0x2d')](function(_0x19c2db){_0x26576a[_0xe438('0x46')](assignTagToIncident(_0x19c2db,_0x173c92,_0x3ee177,_0x5c4169,_0x1489ff));});return Promise[_0xe438('0x47')](_0x26576a)['then'](function(){_0x4afceb();})[_0xe438('0x15')](function(){_0x4afceb();});}else{_0x4afceb();}});});}function getTags(_0x44c1ea,_0x3a01d2,_0x24dbb6,_0x5bd9d5,_0x292054,_0x513886){return function(_0x10653c){return new Promise(function(_0x28f9e3,_0x412f9b){var _0xc03d42=[];var _0x43fd5e=_0x5bd9d5['Tags'];if(_0x43fd5e&&_0x43fd5e[_0xe438('0x1c')]>0x0){_0xc03d42=_[_0xe438('0x48')](_0x43fd5e,_0xe438('0x3a'));}if(_0xc03d42['length']>0x0){return manageTags(_0x44c1ea,_0xc03d42,_0x3a01d2,_0x24dbb6,_0x10653c,_0x292054,_0x513886)[_0xe438('0xf')](function(){_0x28f9e3(_0x10653c);});}else{_0x28f9e3(_0x10653c);}});};}function emit(_0x20e8f5,_0x2be59b,_0x52c310){var _0x4a6d04=_0xe438('0x49')+_0xe438('0x4a')+_0xe438('0x4b')+_0xe438('0x4c');var _0x4a2922={'uri':_0x20e8f5+_0xe438('0x4d')+_0x52c310+_0x4a6d04};io['to'](util[_0xe438('0x4e')]('user:%s',_0x2be59b))[_0xe438('0x4f')](_0xe438('0x50'),_0x4a2922);}exports['cs']=function(_0xbd410a,_0x459b1a,_0x51a91a,_0x4cca44,_0xd3f6fb,_0x1c9098,_0x46eb2c,_0x32c30d){var _0x47a845={};var _0x51f65b={'user':_0x1c9098['username'],'pass':_0x1c9098[_0xe438('0x51')]};var _0x3d9f16=_0xe438('0x52');var _0x48151c=_0xe438('0x53');_0x1c9098[_0xe438('0x54')]=intUtil[_0xe438('0x55')](_0x1c9098[_0xe438('0x54')]);_0x1c9098['serverUrl']=intUtil[_0xe438('0x55')](_0x1c9098[_0xe438('0x56')]);var _0x317b17=util[_0xe438('0x4e')](_0xe438('0x57'),_0x1c9098[_0xe438('0x54')]);_0x47a845[_0xe438('0x1a')]=!_[_0xe438('0x58')](_0x4cca44)?_0x4cca44[_0xe438('0x59')]:null;_0x47a845[_0xe438('0x21')]=_0x1c9098['email'];_0x47a845['endUserNumber']=_0x32c30d[_0xe438('0x32')]()===_0xe438('0x3b')?_0x459b1a[_0xe438('0x5a')]:_0x459b1a['calleridnum'];_0x47a845[_0xe438('0x5b')]=_0x32c30d===_0xe438('0x5c')||_0x32c30d===_0xe438('0x5d')?'queue':_0xe438('0x3b');var _0x4c4b50=util[_0xe438('0x4e')](_0xe438('0x5e'),_0x1c9098[_0xe438('0x56')],_0x459b1a['uniqueid'],md5(_0x459b1a[_0xe438('0x5f')]));if(_0xd3f6fb&&_0xd3f6fb[_0xe438('0x60')]){logger['info'](_0xe438('0x61'),'Recording\x20is\x20enabled!');_0x459b1a[_0xe438('0x62')]=_0x4c4b50;}else if(_0x46eb2c&&_0x46eb2c['recordingFormat']&&_0x46eb2c[_0xe438('0x63')]!=='none'){logger[_0xe438('0x12')]('[OUTBOUND]',_0xe438('0x64'));_0x459b1a['recordingURL']=_0x4c4b50;}else{_0x459b1a[_0xe438('0x62')]='';}return getAdminUser(_0x32c30d,_0x51f65b,_0x47a845,_0x317b17,_0x48151c,_0x3d9f16)[_0xe438('0xf')](getUser(_0x32c30d,_0x51f65b,_0x317b17,_0x48151c,_0x3d9f16))[_0xe438('0xf')](getEndUser(_0x32c30d,_0x51f65b,_0x317b17,_0x48151c,_0x3d9f16))[_0xe438('0xf')](getTicket(_0x32c30d,_0x51f65b,_0x317b17,_0x51a91a,_0x459b1a,_0x48151c))[_0xe438('0xf')](function(_0x250ae7){logger[_0xe438('0x12')](util[_0xe438('0x4e')](_0xe438('0x65'),_0x250ae7[_0xe438('0x40')]));logger[_0xe438('0x12')](util[_0xe438('0x4e')]('call\x20direction:\x20%s',_0x32c30d));if(_0x32c30d!=='unmanaged'){logger[_0xe438('0x12')]('['+[_0x32c30d[_0xe438('0x13')]()]+']',_0xe438('0x66'));emit(_0x1c9098[_0xe438('0x54')],_0x4cca44[_0xe438('0x3a')],_0x250ae7[_0xe438('0x40')]);}})[_0xe438('0x15')](function(_0x12214a){logger['error']('['+[_0x32c30d[_0xe438('0x13')]()]+_0xe438('0x67'),util[_0xe438('0x68')](_0x12214a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2a85=['picklist','type','nameField','customField','toLowerCase','idField','content','variable','variableName','toString','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident\x20-\x20','forEach','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','isNil','email','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]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','md5','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','toUpperCase','catch','error','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','length','true','userId','adminEmail','],\x20getUser\x20crm','message','info',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','includes','string'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x2a85,0xad));var _0x52a8=function(_0x4a94b1,_0x4f2518){_0x4a94b1=_0x4a94b1-0x0;var _0x20949f=_0x2a85[_0x4a94b1];return _0x20949f;};'use strict';var _=require(_0x52a8('0x0'));var Promise=require(_0x52a8('0x1'));var rp=require('request-promise');var util=require('util');var md5=require(_0x52a8('0x2'));var Redis=require(_0x52a8('0x3'));var intUtil=require(_0x52a8('0x4'));var config=require('../../../../config/environment');var logger=require(_0x52a8('0x5'))('servicenow');config[_0x52a8('0x6')]=_[_0x52a8('0x7')](config[_0x52a8('0x6')],{'host':_0x52a8('0x8'),'port':0x18eb});var io=require(_0x52a8('0x9'))(new Redis(config[_0x52a8('0x6')]));function getAdminUser(_0x52f139,_0x42e9b0,_0x33a669,_0x34c7b9,_0x4708e8,_0x4946bb){return new Promise(function(_0x5b08ad,_0x45260c){var _0x20f62a={'method':_0x52a8('0xa'),'uri':_0x34c7b9+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x4708e8+'&'+_0x4946bb,'auth':_0x42e9b0,'json':!![]};return rp(_0x20f62a)[_0x52a8('0xb')](function(_0x20a5f5){if(_0x20a5f5[_0x52a8('0xc')]['length']>0x0){_0x33a669[_0x52a8('0xd')]=_0x20a5f5[_0x52a8('0xc')][0x0][_0x52a8('0xe')];}logger['info']('['+[_0x52f139[_0x52a8('0xf')]()]+'],\x20getAdminUser\x20crm',_0x33a669);_0x5b08ad(_0x33a669);})[_0x52a8('0x10')](function(_0x6f6271){logger[_0x52a8('0x11')]('['+[_0x52f139[_0x52a8('0xf')]()]+']',_0x6f6271['message']);_0x45260c(_0x6f6271['message']);});});}function getUser(_0x5bc1ae,_0x1d89e9,_0xc63ea5,_0x2290f9,_0x4db134){return function(_0x2780c8){logger['info']('['+[_0x5bc1ae[_0x52a8('0xf')]()]+_0x52a8('0x12'),_0x2780c8);return new Promise(function(_0xa7d1e7,_0x236399){if(intUtil[_0x52a8('0x13')](_0x2780c8['userEmail'])){var _0x48fcc2={'method':_0x52a8('0xa'),'uri':_0xc63ea5+'sys_user?sysparm_query=email%3D'+_0x2780c8[_0x52a8('0x14')]+'&'+_0x2290f9+'&'+_0x4db134,'auth':_0x1d89e9,'json':!![]};logger['info']('['+[_0x5bc1ae['toUpperCase']()]+_0x52a8('0x15'),_0x48fcc2);return rp(_0x48fcc2)[_0x52a8('0xb')](function(_0x4b754e){logger['info']('['+[_0x5bc1ae['toUpperCase']()]+'],\x20getUser\x20entity',_0x4b754e);if(_0x4b754e[_0x52a8('0xc')][_0x52a8('0x16')]>0x0&&String(_0x4b754e['result'][0x0]['active'])===_0x52a8('0x17')){_0x2780c8[_0x52a8('0x18')]=_0x4b754e[_0x52a8('0xc')][0x0][_0x52a8('0xe')];}else{_0x2780c8['userId']=_0x2780c8[_0x52a8('0xd')];_0x2780c8[_0x52a8('0x14')]=_0x2780c8[_0x52a8('0x19')];}logger['info']('['+[_0x5bc1ae[_0x52a8('0xf')]()]+_0x52a8('0x1a'),_0x2780c8);_0xa7d1e7(_0x2780c8);})['catch'](function(_0x44ff31){logger[_0x52a8('0x11')]('['+[_0x5bc1ae[_0x52a8('0xf')]()]+']',_0x44ff31[_0x52a8('0x1b')]);_0x236399(_0x44ff31[_0x52a8('0x1b')]);});}else{logger[_0x52a8('0x1c')]('['+[_0x5bc1ae[_0x52a8('0xf')]()]+_0x52a8('0x1d'));_0x2780c8[_0x52a8('0x18')]=_0x2780c8[_0x52a8('0xd')];_0x2780c8[_0x52a8('0x14')]=_0x2780c8['adminEmail'];_0xa7d1e7(_0x2780c8);}});};}function createEndUser(_0x5890d3,_0x3c8fa8,_0x3c4e22,_0xe7af57,_0x14fdb5){logger['info']('['+[_0x5890d3['toUpperCase']()]+_0x52a8('0x1e'),_0x3c4e22);return new Promise(function(_0x59e30a,_0x3ed161){var _0x364b33={'method':_0x52a8('0x1f'),'uri':_0xe7af57+_0x52a8('0x20')+_0x14fdb5,'body':{'user_name':_0x3c4e22[_0x52a8('0x21')],'roles':'user','first_name':_0x3c4e22[_0x52a8('0x21')],'active':_0x52a8('0x17'),'date_format':_0x52a8('0x22'),'phone':_0x3c4e22[_0x52a8('0x21')]},'auth':_0x3c8fa8,'json':!![]};return rp(_0x364b33)['then'](function(_0x26d54b){logger[_0x52a8('0x1c')]('['+[_0x5890d3[_0x52a8('0xf')]()]+_0x52a8('0x23'),_0x26d54b[_0x52a8('0xc')]);_0x3c4e22[_0x52a8('0x24')]=_0x26d54b['result']['sys_id'];_0x59e30a(_0x3c4e22);})[_0x52a8('0x10')](function(_0x1b2db1){logger[_0x52a8('0x11')]('['+[_0x5890d3[_0x52a8('0xf')]()]+']',_0x1b2db1[_0x52a8('0x1b')]);_0x3ed161(_0x1b2db1['message']);});});}function getEndUser(_0x43235a,_0x44bfa6,_0x1efdca,_0x47046c,_0x44c90e){return function(_0x7e09b){logger[_0x52a8('0x1c')]('['+[_0x43235a[_0x52a8('0xf')]()]+_0x52a8('0x25'),_0x7e09b);return new Promise(function(_0x40bd2f,_0x1ad56c){var _0x380db4={'method':'GET','uri':_0x1efdca+_0x52a8('0x26')+_0x7e09b[_0x52a8('0x21')]+'&'+_0x47046c+'&'+_0x44c90e,'auth':_0x44bfa6,'json':!![]};return rp(_0x380db4)[_0x52a8('0xb')](function(_0x48b37a){if(_0x48b37a[_0x52a8('0xc')]['length']>0x0){_0x7e09b[_0x52a8('0x24')]=_0x48b37a[_0x52a8('0xc')][0x0]['sys_id'];logger[_0x52a8('0x1c')]('['+[_0x43235a[_0x52a8('0xf')]()]+'],\x20getEndUser\x20crm',_0x7e09b);_0x40bd2f(_0x7e09b);}else{return createEndUser(_0x43235a,_0x44bfa6,_0x7e09b,_0x1efdca,_0x47046c)[_0x52a8('0xb')](function(_0x29bcbd){logger[_0x52a8('0x1c')]('['+[_0x43235a[_0x52a8('0xf')]()]+'],\x20createEndUser\x20crm',_0x29bcbd);_0x40bd2f(_0x29bcbd);});}})[_0x52a8('0x10')](function(_0x40dc65){logger[_0x52a8('0x11')]('['+[_0x43235a[_0x52a8('0xf')]()]+']',_0x40dc65[_0x52a8('0x1b')]);_0x1ad56c(_0x40dc65[_0x52a8('0x1b')]);});});};}function getCustomFields(_0xf062a6,_0x186367){var _0x5b6707={};if(_0xf062a6[_0x52a8('0x16')]>0x0){_['forEach'](_0xf062a6,function(_0x40ec34){if(_[_0x52a8('0x27')]([_0x52a8('0x28'),_0x52a8('0x29')],_0x40ec34[_0x52a8('0x2a')])&&_0x40ec34[_0x52a8('0x2b')]&&!_0x40ec34[_0x52a8('0x2c')]){_0x5b6707[_0x40ec34['nameField'][_0x52a8('0x2d')]()]=_0x40ec34['content']['toString']();}else if(_[_0x52a8('0x27')](['string',_0x52a8('0x29')],_0x40ec34[_0x52a8('0x2a')])&&_0x40ec34['idField']&&_0x40ec34[_0x52a8('0x2c')]){_0x5b6707[_0x40ec34[_0x52a8('0x2e')][_0x52a8('0x2d')]()]=_0x40ec34[_0x52a8('0x2f')]['toString']();}else if(_0x40ec34[_0x52a8('0x2a')]===_0x52a8('0x30')&&_0x40ec34[_0x52a8('0x31')]&&_0x40ec34['idField']&&_0x40ec34[_0x52a8('0x2c')]){_0x5b6707[_0x40ec34[_0x52a8('0x2e')][_0x52a8('0x2d')]()]=_0x186367[_0x40ec34[_0x52a8('0x31')]][_0x52a8('0x32')]();}else if(_0x40ec34[_0x52a8('0x2a')]===_0x52a8('0x33')&&_0x40ec34[_0x52a8('0x34')]&&_0x40ec34[_0x52a8('0x34')][_0x52a8('0x35')]&&_0x40ec34[_0x52a8('0x2e')]&&_0x40ec34[_0x52a8('0x2c')]){_0x5b6707[_0x40ec34['idField']['toLowerCase']()]=_0x186367[_0x40ec34[_0x52a8('0x34')][_0x52a8('0x35')][_0x52a8('0x2d')]()][_0x52a8('0x32')]();}});}return _0x5b6707;}function getTicket(_0x220336,_0x2273bb,_0x509870,_0x39f89f,_0x2eda42,_0x49ffdd){return function(_0xd8204c){logger['info']('['+[_0x220336['toUpperCase']()]+_0x52a8('0x36'),_0xd8204c);return new Promise(function(_0x267877,_0x20f4a2){var _0x30755b=_0x220336[_0x52a8('0x2d')]()==='outbound'?_0xd8204c[_0x52a8('0x18')]:_0xd8204c[_0x52a8('0x24')];var _0x5a2215={'method':'POST','uri':_0x509870+_0x52a8('0x37')+'?'+_0x49ffdd,'body':Object[_0x52a8('0x38')]({},{'active':_0x52a8('0x17'),'caller_id':_0x30755b,'assigned_to':_0xd8204c[_0x52a8('0x18')],'short_description':intUtil[_0x52a8('0x39')](_0x39f89f[_0x52a8('0x3a')],_0x2eda42,'\x20'),'description':intUtil['getString'](_0x39f89f[_0x52a8('0x3b')],_0x2eda42,'\x0a')},getCustomFields(_0x39f89f[_0x52a8('0x3c')],_0x2eda42)),'auth':_0x2273bb,'json':!![]};return rp(_0x5a2215)['then'](function(_0x3c64ca){logger[_0x52a8('0x1c')]('['+[_0x220336['toUpperCase']()]+_0x52a8('0x3d'),_0x3c64ca[_0x52a8('0xc')]);_0xd8204c[_0x52a8('0x3e')]=_0x3c64ca[_0x52a8('0xc')]['sys_id'];_0xd8204c[_0x52a8('0x3f')]=_0x3c64ca[_0x52a8('0xc')][_0x52a8('0x40')];logger['info']('['+[_0x220336[_0x52a8('0xf')]()]+_0x52a8('0x41'),_0xd8204c);_0x267877(_0xd8204c);})[_0x52a8('0x10')](function(_0x49d3f3){logger[_0x52a8('0x11')]('['+[_0x220336[_0x52a8('0xf')]()]+']',_0x49d3f3['message']);_0x20f4a2(_0x49d3f3[_0x52a8('0x1b')]);});});};}function createRemoteTag(_0x97e55c,_0x5c6306,_0x20839d,_0x404ed7){return new Promise(function(_0x3bcb6c,_0x2731ab){var _0x3ca8cc={'method':_0x52a8('0x1f'),'uri':_0x20839d+_0x52a8('0x42')+'?'+_0x404ed7,'body':{'short_description':_0x97e55c,'global':!![],'active':!![],'name':_0x97e55c},'auth':_0x5c6306,'json':!![]};return rp(_0x3ca8cc)[_0x52a8('0xb')](function(_0x47caad){var _0x317e70=_0x47caad[_0x52a8('0xc')][_0x52a8('0xe')];_0x3bcb6c(_0x317e70);});});}function getRemoteTag(_0x5bf556,_0xb553ac,_0xff8b4d,_0x4810c1,_0x1ee9e7){return new Promise(function(_0x23b366,_0x552226){var _0x2ed99b={'method':_0x52a8('0xa'),'uri':_0xff8b4d+'label'+'?sysparm_query=name%3D'+_0x5bf556+'&'+_0x4810c1,'auth':_0xb553ac,'json':!![]};return rp(_0x2ed99b)['then'](function(_0x81be88){if(_0x81be88['result']['length']>0x0){var _0x58ae07=_0x81be88[_0x52a8('0xc')][0x0][_0x52a8('0xe')];_0x23b366(_0x58ae07);}else{return createRemoteTag(_0x5bf556,_0xb553ac,_0xff8b4d,_0x4810c1)[_0x52a8('0xb')](function(_0x31aca0){_0x23b366(_0x31aca0);});}});});}function assignTagToIncident(_0xde79cc,_0x36aaa7,_0x41883c,_0x4d5287,_0x13b5d3){return new Promise(function(_0x37862e,_0x677064){var _0x1e491b={'method':'POST','uri':_0x41883c+_0x52a8('0x43')+'?'+_0x13b5d3,'body':{'label':_0xde79cc,'table':_0x52a8('0x37'),'id_type':'Incident','table_key':_0x4d5287[_0x52a8('0x3e')],'title':_0x52a8('0x44')+_0x4d5287[_0x52a8('0x3f')],'id_display':_0x4d5287[_0x52a8('0x3f')]},'auth':_0x36aaa7,'json':!![]};return rp(_0x1e491b)[_0x52a8('0xb')](function(_0x2acd74){_0x37862e();})[_0x52a8('0x10')](function(){_0x37862e();});});}function manageTags(_0x3eabd7,_0x5b18e6,_0xf409d1,_0x4d56be,_0x3e2807,_0x1573f7,_0x38afcf){return new Promise(function(_0x5b5e73,_0x2febba){var _0x1ad2dc=[];_0x5b18e6[_0x52a8('0x45')](function(_0xfe2c66){_0x1ad2dc[_0x52a8('0x46')](getRemoteTag(_0xfe2c66,_0xf409d1,_0x4d56be,_0x1573f7,_0x38afcf));});return Promise['all'](_0x1ad2dc)['then'](function(_0x1b931e){if(_0x1b931e[_0x52a8('0x16')]){logger[_0x52a8('0x1c')]('['+[_0x3eabd7['toUpperCase']()]+_0x52a8('0x47'),_0x1b931e);var _0x1b514d=[];_0x1b931e[_0x52a8('0x45')](function(_0x284c70){_0x1b514d[_0x52a8('0x46')](assignTagToIncident(_0x284c70,_0xf409d1,_0x4d56be,_0x3e2807,_0x1573f7));});return Promise['all'](_0x1b514d)[_0x52a8('0xb')](function(){_0x5b5e73();})[_0x52a8('0x10')](function(){_0x5b5e73();});}else{_0x5b5e73();}});});}function getTags(_0x112d14,_0x59bee4,_0x3bd29f,_0x13f6f3,_0x48247c,_0xec4129){return function(_0x28d5be){return new Promise(function(_0x450017,_0x4ccb18){var _0x4af2ae=[];var _0x13ee5b=_0x13f6f3[_0x52a8('0x48')];if(_0x13ee5b&&_0x13ee5b[_0x52a8('0x16')]>0x0){_0x4af2ae=_[_0x52a8('0x49')](_0x13ee5b,_0x52a8('0x35'));}if(_0x4af2ae[_0x52a8('0x16')]>0x0){return manageTags(_0x112d14,_0x4af2ae,_0x59bee4,_0x3bd29f,_0x28d5be,_0x48247c,_0xec4129)[_0x52a8('0xb')](function(){_0x450017(_0x28d5be);});}else{_0x450017(_0x28d5be);}});};}function emit(_0x1e29ca,_0xe417fb,_0x1b1c7f){var _0x4e297d=_0x52a8('0x4a')+_0x52a8('0x4b')+_0x52a8('0x4c')+_0x52a8('0x4d');var _0x2ca062={'uri':_0x1e29ca+_0x52a8('0x4e')+_0x1b1c7f+_0x4e297d};io['to'](util[_0x52a8('0x4f')]('user:%s',_0xe417fb))[_0x52a8('0x50')](_0x52a8('0x51'),_0x2ca062);}exports['cs']=function(_0x5c7171,_0x1f55b4,_0x375183,_0x5ea13d,_0x53cffe,_0x2a582a,_0x84dc6,_0x154978){var _0x244018={};var _0x178922={'user':_0x2a582a['username'],'pass':_0x2a582a[_0x52a8('0x52')]};var _0xc5acf1=_0x52a8('0x53');var _0x58eb67=_0x52a8('0x54');_0x2a582a[_0x52a8('0x55')]=intUtil['stripTrailingSlash'](_0x2a582a['remoteUri']);_0x2a582a['serverUrl']=intUtil['stripTrailingSlash'](_0x2a582a[_0x52a8('0x56')]);var _0x56af9f=util[_0x52a8('0x4f')]('%s/api/now/table/',_0x2a582a[_0x52a8('0x55')]);_0x244018['userEmail']=!_[_0x52a8('0x57')](_0x5ea13d)?_0x5ea13d[_0x52a8('0x58')]:null;_0x244018[_0x52a8('0x19')]=_0x2a582a[_0x52a8('0x58')];_0x244018[_0x52a8('0x21')]=_0x154978[_0x52a8('0x2d')]()===_0x52a8('0x59')?_0x1f55b4[_0x52a8('0x5a')]:_0x1f55b4[_0x52a8('0x5b')];_0x244018[_0x52a8('0x5c')]=_0x154978===_0x52a8('0x5d')||_0x154978===_0x52a8('0x5e')?_0x52a8('0x5d'):_0x52a8('0x59');var _0x3d31f2=util[_0x52a8('0x4f')](_0x52a8('0x5f'),_0x2a582a[_0x52a8('0x56')],_0x1f55b4['uniqueid'],md5(_0x1f55b4[_0x52a8('0x60')]));if(_0x53cffe&&_0x53cffe[_0x52a8('0x61')]){logger[_0x52a8('0x1c')]('[QUEUE]',_0x52a8('0x62'));_0x1f55b4[_0x52a8('0x63')]=_0x3d31f2;}else if(_0x84dc6&&_0x84dc6['recordingFormat']&&_0x84dc6[_0x52a8('0x64')]!==_0x52a8('0x65')){logger[_0x52a8('0x1c')](_0x52a8('0x66'),_0x52a8('0x62'));_0x1f55b4[_0x52a8('0x63')]=_0x3d31f2;}else{_0x1f55b4[_0x52a8('0x63')]='';}return getAdminUser(_0x154978,_0x178922,_0x244018,_0x56af9f,_0x58eb67,_0xc5acf1)[_0x52a8('0xb')](getUser(_0x154978,_0x178922,_0x56af9f,_0x58eb67,_0xc5acf1))[_0x52a8('0xb')](getEndUser(_0x154978,_0x178922,_0x56af9f,_0x58eb67,_0xc5acf1))['then'](getTicket(_0x154978,_0x178922,_0x56af9f,_0x375183,_0x1f55b4,_0x58eb67))[_0x52a8('0xb')](function(_0x157b71){logger[_0x52a8('0x1c')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x157b71[_0x52a8('0x3e')]));logger[_0x52a8('0x1c')](util[_0x52a8('0x4f')](_0x52a8('0x67'),_0x154978));if(_0x154978!==_0x52a8('0x5e')){logger[_0x52a8('0x1c')]('['+[_0x154978[_0x52a8('0xf')]()]+']',_0x52a8('0x68'));emit(_0x2a582a[_0x52a8('0x55')],_0x5ea13d[_0x52a8('0x35')],_0x157b71[_0x52a8('0x3e')]);}})[_0x52a8('0x10')](function(_0x27f6be){logger[_0x52a8('0x11')]('['+[_0x154978[_0x52a8('0xf')]()]+_0x52a8('0x69'),util[_0x52a8('0x6a')](_0x27f6be,{'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 0a8c925..bb0490c 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 _0x818d=['description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','variableName','push','set_entry','JSON','stringify','Calls','format','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','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','Agent\x20not\x20found,\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!','Caller\x20-\x20%s','[HTTP]','merge','map','forEach','string','nameField','toLowerCase','content','type','idField','customField','custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','users','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','serverUrl','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','The\x20Ticket\x20ID\x20is:','contacts','charAt','[OUTBOUND]','unmanaged','lastevent','toUpperCase','catch','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by'];(function(_0x414152,_0x41ab28){var _0x29de79=function(_0x405681){while(--_0x405681){_0x414152['push'](_0x414152['shift']());}};_0x29de79(++_0x41ab28);}(_0x818d,0x168));var _0xd818=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0x818d[_0x284807];return _0x50c774;};'use strict';var _=require('lodash');var rp=require(_0xd818('0x0'));var BPromise=require(_0xd818('0x1'));var md5=require('md5');var util=require(_0xd818('0x2'));var Redis=require(_0xd818('0x3'));var intUtil=require(_0xd818('0x4'));var config=require(_0xd818('0x5'));var logger=require(_0xd818('0x6'))(_0xd818('0x7'));config[_0xd818('0x8')]=_['defaults'](config[_0xd818('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd818('0x8')]));var def={'method':_0xd818('0x9'),'json':!![]};function emit(_0x2e269b,_0x10a91a,_0x3fca34){io['to'](_0x2e269b)[_0xd818('0xa')](_0x10a91a,_0x3fca34);}function getTicket(_0x2b7bf1,_0x2dde03,_0x1a5895,_0x5e6fbd,_0x16a30e,_0x3c466e,_0x18cc23,_0x52394b){logger[_0xd818('0xb')](_0xd818('0xc'));var _0x2b9a9e=new Date();var _0x3f15be=[{'name':_0xd818('0xd'),'value':intUtil[_0xd818('0xe')](_0x5e6fbd[_0xd818('0xf')],_0x16a30e,'\x20')},{'name':_0xd818('0x10'),'value':_0x2dde03['id']},{'name':_0xd818('0x11'),'value':_0x2dde03['id']},{'name':_0xd818('0x12'),'value':intUtil[_0xd818('0xe')](_0x5e6fbd[_0xd818('0x13')],_0x16a30e,'\x0a')},{'name':_0xd818('0x14'),'value':_0x2b9a9e[_0xd818('0x15')]()[_0xd818('0x16')](0x0,0x13)[_0xd818('0x17')]('T','\x20')},{'name':_0xd818('0x18'),'value':'0'},{'name':_0xd818('0x19'),'value':'15'},{'name':_0xd818('0x1a'),'value':_0x1a5895['id']},{'name':_0xd818('0x1b'),'value':_0xd818('0x1c')},{'name':_0xd818('0x1d'),'value':_0x1a5895[_0xd818('0xd')]},{'name':_0xd818('0x1e'),'value':_0x52394b}];if(_0x3c466e[_0xd818('0x1f')]){_['forEach'](_0x3c466e,function(_0xf81bbc){if(_0x16a30e[_0xf81bbc[_0xd818('0x20')]]){_0x3f15be[_0xd818('0x21')]({'name':_0xf81bbc['idField'],'value':_0x16a30e[_0xf81bbc[_0xd818('0x20')]]});}});}return request({'form':{'method':_0xd818('0x22'),'input_type':_0xd818('0x23'),'response_type':_0xd818('0x23'),'rest_data':JSON[_0xd818('0x24')]({'session':_0x18cc23['id'],'module_name':_0xd818('0x25'),'name_value_list':_0x3f15be})}});}function getAuth(_0x1f43bf){return util[_0xd818('0x26')]('Basic\x20%s',new Buffer(_0x1f43bf[_0xd818('0x27')]+':X')[_0xd818('0x28')](_0xd818('0x29')));}function getServerInfo(_0x91a4c3){return request({'form':{'method':_0xd818('0x2a'),'input_type':_0xd818('0x23'),'response_type':_0xd818('0x23'),'rest_data':JSON[_0xd818('0x24')]({'session':_0x91a4c3['id']})}});}function getUser(_0x51c50c,_0x10bf7b,_0x3df254){if(!_[_0xd818('0x2b')](_0x10bf7b)){logger[_0xd818('0xb')](_0xd818('0x2c'),_0x10bf7b);return request({'form':{'method':_0xd818('0x2d'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3df254['id'],'module_name':_0xd818('0x2e'),'query':util[_0xd818('0x26')](_0xd818('0x2f'),_0x10bf7b),'order_by':'','offset':'0','select_fields':['id',_0xd818('0xd'),_0xd818('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd818('0x31')](function(_0x519941){if(_0x519941[_0xd818('0x32')]['length']){var _0x4e807b=_[_0xd818('0x33')](_0x519941[_0xd818('0x32')],function(_0x61adb5){return _0x61adb5[_0xd818('0x34')][_0xd818('0x30')][_0xd818('0x35')]===_0x10bf7b;});if(_0x4e807b){logger[_0xd818('0xb')](_0xd818('0x36'));return BPromise[_0xd818('0x37')]({'id':_0x4e807b[_0xd818('0x34')]['id'][_0xd818('0x35')],'name':_0x4e807b['name_value_list'][_0xd818('0xd')]['value']});}}logger[_0xd818('0xb')](_0xd818('0x38'));return BPromise[_0xd818('0x37')]({'id':_0x3df254[_0xd818('0x34')]['user_id'][_0xd818('0x35')],'name':_0x3df254[_0xd818('0x34')][_0xd818('0x30')][_0xd818('0x35')]});});}else{logger[_0xd818('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xd818('0x37')]({'id':_0x3df254[_0xd818('0x34')]['user_id'][_0xd818('0x35')],'name':_0x3df254['name_value_list'][_0xd818('0x30')]['value']});}}function getEndUser(_0x196bac,_0x40561c,_0x5dec8f,_0x16b786){logger[_0xd818('0xb')](_0xd818('0x39'),_0x5dec8f);return request({'form':{'method':'get_entry_list','input_type':_0xd818('0x23'),'response_type':_0xd818('0x23'),'rest_data':JSON['stringify']({'session':_0x16b786['id'],'module_name':'Contacts','query':util[_0xd818('0x26')](_0xd818('0x3a'),_0x5dec8f),'order_by':'','offset':'0','select_fields':['id',_0xd818('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd818('0x31')](function(_0xc281eb){if(_0xc281eb[_0xd818('0x32')]['length']){var _0x42b465=_[_0xd818('0x33')](_0xc281eb[_0xd818('0x32')],function(_0x439bf0){return _0x439bf0[_0xd818('0x34')][_0xd818('0x3b')]['value']===_0x5dec8f;});if(_0x42b465){logger[_0xd818('0xb')](_0xd818('0x3c'));return BPromise[_0xd818('0x37')]({'id':_0x42b465[_0xd818('0x34')]['id'][_0xd818('0x35')],'name':_0x42b465['name_value_list'][_0xd818('0xd')][_0xd818('0x35')],'phone':_0x42b465['name_value_list'][_0xd818('0x3b')][_0xd818('0x35')]});}}else{logger[_0xd818('0xb')](_0xd818('0x3d'));return request({'form':{'method':_0xd818('0x22'),'input_type':_0xd818('0x23'),'response_type':_0xd818('0x23'),'rest_data':JSON[_0xd818('0x24')]({'session':_0x16b786['id'],'module_name':_0xd818('0x1c'),'name_value_list':[{'name':'first_name','value':_0x40561c!==''?_0x40561c:util['format'](_0xd818('0x3e'),_0x5dec8f)},{'name':_0xd818('0x3b'),'value':_0x5dec8f}]})}})[_0xd818('0x31')](function(_0x559606){logger[_0xd818('0xb')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x559606['id'],'name':_0x559606[_0xd818('0x32')]['first_name'][_0xd818('0x35')],'phone':_0x559606[_0xd818('0x32')]['phone_home']['value']});});}});}function request(_0x49ab37){logger['debug'](_0xd818('0x3f'),JSON[_0xd818('0x24')](_0x49ab37));return rp(_[_0xd818('0x40')](def,_0x49ab37));}function getTags(_0x2e4b6c,_0x11538b){var _0x15eee8=[];if(_0x2e4b6c&&_0x2e4b6c[_0xd818('0x1f')]>0x0){_0x15eee8=_[_0xd818('0x41')](_0x2e4b6c,_0x11538b);}return _0x15eee8;}function getCustomFields(_0x13f4de,_0x4752dd){var _0x2d7dc4=[];var _0x384c86={'custom_fields':[]};if(_0x13f4de[_0xd818('0x1f')]>0x0){_[_0xd818('0x42')](_0x13f4de,function(_0x3a7824){if(_0x3a7824['type']===_0xd818('0x43')&&_0x3a7824[_0xd818('0x44')]&&!_0x3a7824['customField']){_0x384c86[_0x3a7824['nameField'][_0xd818('0x45')]()]=_0x3a7824[_0xd818('0x46')][_0xd818('0x28')]();}else if(_0x3a7824[_0xd818('0x47')]==='string'&&_0x3a7824[_0xd818('0x48')]&&_0x3a7824[_0xd818('0x49')]){_0x384c86[_0xd818('0x4a')][_0xd818('0x21')]({'id':_0x3a7824[_0xd818('0x48')],'value':_0x3a7824[_0xd818('0x46')][_0xd818('0x28')]()});}else if(_0x3a7824[_0xd818('0x47')]===_0xd818('0x4b')&&_0x3a7824['variableName']&&_0x3a7824[_0xd818('0x48')]&&_0x3a7824[_0xd818('0x49')]){_0x4752dd[_0x3a7824[_0xd818('0x20')]]&&_0x384c86['custom_fields'][_0xd818('0x21')]({'id':_0x3a7824[_0xd818('0x48')],'value':_0x4752dd[_0x3a7824[_0xd818('0x20')]][_0xd818('0x28')]()});}else if(_0x3a7824[_0xd818('0x47')]===_0xd818('0x4c')&&_0x3a7824[_0xd818('0x4d')]&&_0x3a7824[_0xd818('0x4d')]['name']&&_0x3a7824['idField']&&_0x3a7824[_0xd818('0x49')]){_0x4752dd[_0x3a7824[_0xd818('0x4d')]['name'][_0xd818('0x45')]()]&&_0x384c86['custom_fields']['push']({'id':_0x3a7824[_0xd818('0x48')],'value':_0x4752dd[_0x3a7824['Variable'][_0xd818('0xd')][_0xd818('0x45')]()]['toString']()});}});}return _0x384c86;}function getConnection(_0x921427){return request({'method':_0xd818('0x9'),'form':{'method':_0xd818('0x4e'),'input_type':_0xd818('0x23'),'response_type':_0xd818('0x23'),'rest_data':JSON[_0xd818('0x24')]({'user_auth':{'user_name':_0x921427[_0xd818('0x4f')],'password':_0x921427[_0xd818('0x50')],'encryption':_0xd818('0x51')},'application':_0xd818('0x52')})}})[_0xd818('0x31')](function(_0x4688b6){var _0x3a907b=_0x4688b6;if(_0x3a907b['id']){def[_0xd818('0x53')]=_0x3a907b['id'];return BPromise[_0xd818('0x37')](_0x3a907b);}else{throw new Error(util['format'](_0xd818('0x54'),_0x921427['id']));}});}function setRelationship(_0x17da51,_0x1217aa,_0x4aeb4c,_0x2ec6bb){return request({'form':{'method':_0xd818('0x55'),'input_type':_0xd818('0x23'),'response_type':'JSON','rest_data':JSON[_0xd818('0x24')]({'session':_0x17da51['id'],'module_name':'Calls','module_id':_0x4aeb4c['id'],'link_field_name':_0x2ec6bb,'related_ids':[_0x1217aa['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xd818('0x56')]=function(_0x201844,_0x402378,_0x1628bf,_0x1bef65,_0x322471,_0x3886d7){var _0x18aaba,_0x50cf8e,_0x27238d,_0x31c0d7;_0x3886d7['remoteUri']=intUtil['stripTrailingSlash'](_0x3886d7[_0xd818('0x57')]);_0x3886d7['serverUrl']=intUtil[_0xd818('0x58')](_0x3886d7['serverUrl']);def[_0xd818('0x59')]=util['format'](_0xd818('0x5a'),_0x3886d7[_0xd818('0x57')]);if(_0x322471&&_0x322471[_0xd818('0x5b')]){logger[_0xd818('0xb')]('[QUEUE]',_0xd818('0x5c'));_0x402378['recordingURL']=util[_0xd818('0x26')](_0xd818('0x5d'),_0x3886d7['serverUrl'],_0x402378[_0xd818('0x5e')],md5(_0x402378[_0xd818('0x5e')]));}else{_0x402378[_0xd818('0x5f')]='';}return getConnection(_0x3886d7)['then'](function(_0x5f5c29){_0x31c0d7=_0x5f5c29;return getUser(_0x3886d7,_0x1bef65['name'],_0x31c0d7);})[_0xd818('0x31')](function(_0x2f885e){_0x18aaba=_0x2f885e;logger[_0xd818('0xb')](_0xd818('0x60'),_0x18aaba['id']);return getEndUser(_0x3886d7,_0x402378[_0xd818('0x61')],_0x402378[_0xd818('0x62')],_0x31c0d7);})[_0xd818('0x31')](function(_0x373c69){_0x50cf8e=_0x373c69;logger['info']('The\x20Enduser\x20ID\x20is:',_0x50cf8e['id']);return getTicket(_0x3886d7,_0x18aaba,_0x50cf8e,_0x1628bf,_0x402378,_0x1628bf[_0xd818('0x63')],_0x31c0d7,_0xd818('0x64'));})['then'](function(_0x3697e8){_0x27238d=_0x3697e8;logger['info'](_0xd818('0x65'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x27238d['id']);return setRelationship(_0x31c0d7,_0x18aaba,_0x27238d,_0xd818('0x66'));})[_0xd818('0x31')](function(){return setRelationship(_0x31c0d7,_0x50cf8e,_0x27238d,'contacts');})[_0xd818('0x31')](function(){return getServerInfo(_0x31c0d7);})['then'](function(_0x320f1c){var _0x2f01d2=parseInt(_0x320f1c[_0xd818('0x67')]['charAt'](0x0));var _0x213e15=util[_0xd818('0x26')](_0xd818('0x68'),_0x3886d7[_0xd818('0x57')],_0x27238d['id']);if(_0x2f01d2>0x6){_0x213e15=util['format'](_0xd818('0x69'),_0x3886d7['remoteUri'],_0x27238d['id']);}logger[_0xd818('0xb')]('[QUEUE]',_0xd818('0x6a'));emit(util[_0xd818('0x26')](_0xd818('0x6b'),_0x1bef65['name']),_0xd818('0x6c'),{'uri':_0x213e15});})['catch'](function(_0xe5461b){logger[_0xd818('0x6d')]('[QUEUE]',JSON[_0xd818('0x24')](_0xe5461b));});};exports[_0xd818('0x6e')]=function(_0x29aedb,_0x3320a7,_0x58a51b,_0x331eef,_0x35a07d,_0x104d1e,_0x5f2180){var _0x3cfb19,_0x25f690,_0x4cc933,_0x27a082;_0x104d1e[_0xd818('0x57')]=intUtil[_0xd818('0x58')](_0x104d1e['remoteUri']);_0x104d1e['serverUrl']=intUtil['stripTrailingSlash'](_0x104d1e[_0xd818('0x6f')]);def[_0xd818('0x59')]=util[_0xd818('0x26')]('%s/service/v4_1/rest.php',_0x104d1e[_0xd818('0x57')]);if(_0x5f2180&&_0x5f2180[_0xd818('0x70')]&&_0x5f2180[_0xd818('0x70')]!==_0xd818('0x71')){logger[_0xd818('0xb')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3320a7[_0xd818('0x5f')]=util[_0xd818('0x26')](_0xd818('0x5d'),_0x104d1e[_0xd818('0x6f')],_0x3320a7[_0xd818('0x5e')],md5(_0x3320a7[_0xd818('0x5e')]));}return getConnection(_0x104d1e)[_0xd818('0x31')](function(_0x5c58b0){_0x27a082=_0x5c58b0;return getUser(_0x104d1e,_0x331eef['name'],_0x27a082);})['then'](function(_0x5502ba){_0x3cfb19=_0x5502ba;logger['info'](_0xd818('0x60'),_0x3cfb19['id']);return getEndUser(_0x104d1e,_0x3320a7[_0xd818('0x72')],_0x3320a7[_0xd818('0x73')],_0x27a082);})[_0xd818('0x31')](function(_0x3bd120){_0x25f690=_0x3bd120;logger['info'](_0xd818('0x74'),_0x25f690['id']);return getTicket(_0x104d1e,_0x3cfb19,_0x25f690,_0x58a51b,_0x3320a7,_0x58a51b[_0xd818('0x63')],_0x27a082,_0xd818('0x75'));})[_0xd818('0x31')](function(_0x11e8cd){_0x4cc933=_0x11e8cd;logger[_0xd818('0xb')](_0xd818('0x65'));logger[_0xd818('0xb')](_0xd818('0x76'),_0x4cc933['id']);return setRelationship(_0x27a082,_0x3cfb19,_0x4cc933,_0xd818('0x66'));})['then'](function(){return setRelationship(_0x27a082,_0x25f690,_0x4cc933,_0xd818('0x77'));})['then'](function(){return getServerInfo(_0x27a082);})[_0xd818('0x31')](function(_0xcfeb76){var _0x25aa00=parseInt(_0xcfeb76[_0xd818('0x67')][_0xd818('0x78')](0x0));var _0xc8f816=util[_0xd818('0x26')](_0xd818('0x68'),_0x104d1e['remoteUri'],_0x4cc933['id']);if(_0x25aa00>0x6){_0xc8f816=util[_0xd818('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x104d1e[_0xd818('0x57')],_0x4cc933['id']);}logger[_0xd818('0xb')](_0xd818('0x79'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd818('0x26')](_0xd818('0x6b'),_0x331eef[_0xd818('0xd')]),_0xd818('0x6c'),{'uri':_0xc8f816});})['catch'](function(_0x5567a6){logger[_0xd818('0x6d')](_0xd818('0x79'),JSON['stringify'](_0x5567a6));});};exports[_0xd818('0x7a')]=function(_0x4f2c1a,_0x5d44a1,_0x2946d9,_0x587e05,_0x80a4b1,_0xf7906d){var _0xa10ccd,_0x3a1dcf,_0x10f818,_0x2922f5;_0xf7906d[_0xd818('0x57')]=intUtil[_0xd818('0x58')](_0xf7906d[_0xd818('0x57')]);_0xf7906d[_0xd818('0x6f')]=intUtil['stripTrailingSlash'](_0xf7906d['serverUrl']);def[_0xd818('0x59')]=util['format'](_0xd818('0x5a'),_0xf7906d[_0xd818('0x57')]);if(_0x80a4b1&&_0x80a4b1['monitor_format']){logger[_0xd818('0xb')]('['+_0x5d44a1[_0xd818('0x7b')][_0xd818('0x7c')]()+']',_0xd818('0x5c'));_0x5d44a1['recordingURL']=util[_0xd818('0x26')](_0xd818('0x5d'),_0xf7906d[_0xd818('0x6f')],_0x5d44a1['uniqueid'],md5(_0x5d44a1[_0xd818('0x5e')]));}else{_0x5d44a1[_0xd818('0x5f')]='';}return getConnection(_0xf7906d)[_0xd818('0x31')](function(_0x5d4929){_0x2922f5=_0x5d4929;if(!_[_0xd818('0x2b')](_0x587e05)){return getUser(_0xf7906d,_0x587e05[_0xd818('0xd')],_0x2922f5);}else{return getUser(_0xf7906d,null,_0x2922f5);}})[_0xd818('0x31')](function(_0x1f076a){_0xa10ccd=_0x1f076a;logger[_0xd818('0xb')](_0xd818('0x60'),_0xa10ccd['id']);return getEndUser(_0xf7906d,_0x5d44a1[_0xd818('0x61')],_0x5d44a1[_0xd818('0x62')],_0x2922f5);})['then'](function(_0x39ed94){_0x3a1dcf=_0x39ed94;logger[_0xd818('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3a1dcf['id']);return getTicket(_0xf7906d,_0xa10ccd,_0x3a1dcf,_0x2946d9,_0x5d44a1,_0x2946d9[_0xd818('0x63')],_0x2922f5,_0xd818('0x64'));})[_0xd818('0x31')](function(_0x3cbd53){_0x10f818=_0x3cbd53;logger['info'](_0xd818('0x65'));logger[_0xd818('0xb')](_0xd818('0x76'),_0x10f818['id']);return setRelationship(_0x2922f5,_0xa10ccd,_0x10f818,_0xd818('0x66'));})['then'](function(){return setRelationship(_0x2922f5,_0x3a1dcf,_0x10f818,_0xd818('0x77'));})[_0xd818('0x31')](function(){return getServerInfo(_0x2922f5);})[_0xd818('0x7d')](function(_0x3c4ffb){logger[_0xd818('0x6d')]('['+_0x5d44a1['lastevent']['toUpperCase']()+']',JSON[_0xd818('0x24')](_0x3c4ffb));});}; \ No newline at end of file +var _0xbe46=['version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','user:%s','trigger:browser:url','catch','error','%s/service/v4_1/rest.php','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','The\x20Enduser\x20ID\x20is:','Outbound','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','recordingURL','isNil','lodash','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','getString','Descriptions','toISOString','replace','duration_hours','Contacts','parent_name','length','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','name_value_list','user_name','value','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','map','forEach','type','nameField','customField','toLowerCase','content','string','custom_fields','variable','Variable','login','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','uri','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts'];(function(_0x55af51,_0x53b805){var _0x24bab2=function(_0x1ad5fb){while(--_0x1ad5fb){_0x55af51['push'](_0x55af51['shift']());}};_0x24bab2(++_0x53b805);}(_0xbe46,0xfd));var _0x6be4=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xbe46[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x6be4('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x6be4('0x1'));var util=require(_0x6be4('0x2'));var Redis=require(_0x6be4('0x3'));var intUtil=require('./util');var config=require(_0x6be4('0x4'));var logger=require(_0x6be4('0x5'))(_0x6be4('0x6'));config[_0x6be4('0x7')]=_[_0x6be4('0x8')](config[_0x6be4('0x7')],{'host':_0x6be4('0x9'),'port':0x18eb});var io=require(_0x6be4('0xa'))(new Redis(config['redis']));var def={'method':_0x6be4('0xb'),'json':!![]};function emit(_0x49dce0,_0x31f5c1,_0x202b8f){io['to'](_0x49dce0)[_0x6be4('0xc')](_0x31f5c1,_0x202b8f);}function getTicket(_0x921855,_0x4c6559,_0x50ade8,_0x2c262a,_0x19a3b5,_0x1b3bce,_0xded3c8,_0x3790c2){logger[_0x6be4('0xd')](_0x6be4('0xe'));var _0x5ea176=new Date();var _0x38e52b=[{'name':_0x6be4('0xf'),'value':intUtil['getString'](_0x2c262a[_0x6be4('0x10')],_0x19a3b5,'\x20')},{'name':_0x6be4('0x11'),'value':_0x4c6559['id']},{'name':_0x6be4('0x12'),'value':_0x4c6559['id']},{'name':_0x6be4('0x13'),'value':intUtil[_0x6be4('0x14')](_0x2c262a[_0x6be4('0x15')],_0x19a3b5,'\x0a')},{'name':'date_start','value':_0x5ea176[_0x6be4('0x16')]()['slice'](0x0,0x13)[_0x6be4('0x17')]('T','\x20')},{'name':_0x6be4('0x18'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x50ade8['id']},{'name':'parent_type','value':_0x6be4('0x19')},{'name':_0x6be4('0x1a'),'value':_0x50ade8[_0x6be4('0xf')]},{'name':'direction','value':_0x3790c2}];if(_0x1b3bce[_0x6be4('0x1b')]){_['forEach'](_0x1b3bce,function(_0x25e955){if(_0x19a3b5[_0x25e955[_0x6be4('0x1c')]]){_0x38e52b[_0x6be4('0x1d')]({'name':_0x25e955[_0x6be4('0x1e')],'value':_0x19a3b5[_0x25e955[_0x6be4('0x1c')]]});}});}return request({'form':{'method':_0x6be4('0x1f'),'input_type':_0x6be4('0x20'),'response_type':_0x6be4('0x20'),'rest_data':JSON[_0x6be4('0x21')]({'session':_0xded3c8['id'],'module_name':_0x6be4('0x22'),'name_value_list':_0x38e52b})}});}function getAuth(_0x3de5d1){return util[_0x6be4('0x23')](_0x6be4('0x24'),new Buffer(_0x3de5d1['apiKey']+':X')[_0x6be4('0x25')](_0x6be4('0x26')));}function getServerInfo(_0x3439e9){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0x6be4('0x20'),'rest_data':JSON[_0x6be4('0x21')]({'session':_0x3439e9['id']})}});}function getUser(_0x1fdaab,_0x3f23ad,_0x59d3c3){if(!_['isNil'](_0x3f23ad)){logger[_0x6be4('0xd')]('Getting\x20agent\x20with\x20name',_0x3f23ad);return request({'form':{'method':_0x6be4('0x27'),'input_type':_0x6be4('0x20'),'response_type':_0x6be4('0x20'),'rest_data':JSON[_0x6be4('0x21')]({'session':_0x59d3c3['id'],'module_name':_0x6be4('0x28'),'query':util[_0x6be4('0x23')](_0x6be4('0x29'),_0x3f23ad),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6be4('0x2a')](function(_0x1098c4){if(_0x1098c4[_0x6be4('0x2b')][_0x6be4('0x1b')]){var _0x5ee0b9=_['find'](_0x1098c4[_0x6be4('0x2b')],function(_0x11b4bf){return _0x11b4bf[_0x6be4('0x2c')][_0x6be4('0x2d')][_0x6be4('0x2e')]===_0x3f23ad;});if(_0x5ee0b9){logger[_0x6be4('0xd')]('Agent\x20found!');return BPromise['resolve']({'id':_0x5ee0b9['name_value_list']['id']['value'],'name':_0x5ee0b9[_0x6be4('0x2c')][_0x6be4('0xf')][_0x6be4('0x2e')]});}}logger[_0x6be4('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x6be4('0x2f')]({'id':_0x59d3c3[_0x6be4('0x2c')][_0x6be4('0x30')][_0x6be4('0x2e')],'name':_0x59d3c3['name_value_list'][_0x6be4('0x2d')]['value']});});}else{logger[_0x6be4('0xd')](_0x6be4('0x31'));return BPromise['resolve']({'id':_0x59d3c3[_0x6be4('0x2c')][_0x6be4('0x30')][_0x6be4('0x2e')],'name':_0x59d3c3[_0x6be4('0x2c')][_0x6be4('0x2d')][_0x6be4('0x2e')]});}}function getEndUser(_0x13ce29,_0x23cc05,_0x3d55f8,_0x473b79){logger['info']('Searching\x20enduser\x20with\x20phone',_0x3d55f8);return request({'form':{'method':_0x6be4('0x27'),'input_type':_0x6be4('0x20'),'response_type':_0x6be4('0x20'),'rest_data':JSON[_0x6be4('0x21')]({'session':_0x473b79['id'],'module_name':'Contacts','query':util[_0x6be4('0x23')](_0x6be4('0x32'),_0x3d55f8),'order_by':'','offset':'0','select_fields':['id',_0x6be4('0xf'),_0x6be4('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6be4('0x2a')](function(_0x560298){if(_0x560298[_0x6be4('0x2b')][_0x6be4('0x1b')]){var _0x1e646d=_[_0x6be4('0x34')](_0x560298[_0x6be4('0x2b')],function(_0x5984d3){return _0x5984d3['name_value_list'][_0x6be4('0x33')]['value']===_0x3d55f8;});if(_0x1e646d){logger[_0x6be4('0xd')](_0x6be4('0x35'));return BPromise[_0x6be4('0x2f')]({'id':_0x1e646d[_0x6be4('0x2c')]['id'][_0x6be4('0x2e')],'name':_0x1e646d[_0x6be4('0x2c')][_0x6be4('0xf')][_0x6be4('0x2e')],'phone':_0x1e646d['name_value_list']['phone_home'][_0x6be4('0x2e')]});}}else{logger['info'](_0x6be4('0x36'));return request({'form':{'method':_0x6be4('0x1f'),'input_type':_0x6be4('0x20'),'response_type':_0x6be4('0x20'),'rest_data':JSON['stringify']({'session':_0x473b79['id'],'module_name':_0x6be4('0x19'),'name_value_list':[{'name':_0x6be4('0x37'),'value':_0x23cc05!==_0x6be4('0x38')?_0x23cc05:util['format'](_0x6be4('0x39'),_0x3d55f8)},{'name':'phone_home','value':_0x3d55f8}]})}})[_0x6be4('0x2a')](function(_0x39747c){logger[_0x6be4('0xd')](_0x6be4('0x3a'));return BPromise[_0x6be4('0x2f')]({'id':_0x39747c['id'],'name':_0x39747c[_0x6be4('0x2b')][_0x6be4('0x37')][_0x6be4('0x2e')],'phone':_0x39747c[_0x6be4('0x2b')][_0x6be4('0x33')][_0x6be4('0x2e')]});});}});}function request(_0x51c0b5){logger['debug']('[HTTP]',JSON['stringify'](_0x51c0b5));return rp(_['merge'](def,_0x51c0b5));}function getTags(_0xc92493,_0xd57b50){var _0x2d5732=[];if(_0xc92493&&_0xc92493[_0x6be4('0x1b')]>0x0){_0x2d5732=_[_0x6be4('0x3b')](_0xc92493,_0xd57b50);}return _0x2d5732;}function getCustomFields(_0x40a584,_0x3e317a){var _0x3df320=[];var _0x44f5f0={'custom_fields':[]};if(_0x40a584[_0x6be4('0x1b')]>0x0){_[_0x6be4('0x3c')](_0x40a584,function(_0x9d9d49){if(_0x9d9d49[_0x6be4('0x3d')]==='string'&&_0x9d9d49[_0x6be4('0x3e')]&&!_0x9d9d49[_0x6be4('0x3f')]){_0x44f5f0[_0x9d9d49[_0x6be4('0x3e')][_0x6be4('0x40')]()]=_0x9d9d49[_0x6be4('0x41')][_0x6be4('0x25')]();}else if(_0x9d9d49[_0x6be4('0x3d')]===_0x6be4('0x42')&&_0x9d9d49[_0x6be4('0x1e')]&&_0x9d9d49['customField']){_0x44f5f0[_0x6be4('0x43')][_0x6be4('0x1d')]({'id':_0x9d9d49[_0x6be4('0x1e')],'value':_0x9d9d49[_0x6be4('0x41')][_0x6be4('0x25')]()});}else if(_0x9d9d49[_0x6be4('0x3d')]===_0x6be4('0x44')&&_0x9d9d49['variableName']&&_0x9d9d49['idField']&&_0x9d9d49['customField']){_0x3e317a[_0x9d9d49[_0x6be4('0x1c')]]&&_0x44f5f0[_0x6be4('0x43')][_0x6be4('0x1d')]({'id':_0x9d9d49[_0x6be4('0x1e')],'value':_0x3e317a[_0x9d9d49[_0x6be4('0x1c')]][_0x6be4('0x25')]()});}else if(_0x9d9d49['type']==='customVariable'&&_0x9d9d49[_0x6be4('0x45')]&&_0x9d9d49[_0x6be4('0x45')]['name']&&_0x9d9d49['idField']&&_0x9d9d49[_0x6be4('0x3f')]){_0x3e317a[_0x9d9d49[_0x6be4('0x45')][_0x6be4('0xf')][_0x6be4('0x40')]()]&&_0x44f5f0[_0x6be4('0x43')][_0x6be4('0x1d')]({'id':_0x9d9d49[_0x6be4('0x1e')],'value':_0x3e317a[_0x9d9d49['Variable'][_0x6be4('0xf')][_0x6be4('0x40')]()][_0x6be4('0x25')]()});}});}return _0x44f5f0;}function getConnection(_0x22e95d){return request({'method':_0x6be4('0xb'),'form':{'method':_0x6be4('0x46'),'input_type':_0x6be4('0x20'),'response_type':_0x6be4('0x20'),'rest_data':JSON[_0x6be4('0x21')]({'user_auth':{'user_name':_0x22e95d['username'],'password':_0x22e95d['password'],'encryption':_0x6be4('0x47')},'application':_0x6be4('0x48')})}})['then'](function(_0x3cbf5d){var _0x4a952f=_0x3cbf5d;if(_0x4a952f['id']){def['sessionID']=_0x4a952f['id'];return BPromise['resolve'](_0x4a952f);}else{throw new Error(util[_0x6be4('0x23')](_0x6be4('0x49'),_0x22e95d['id']));}});}function setRelationship(_0x2c0792,_0x4b936c,_0x4f3075,_0x58d0f0){return request({'form':{'method':_0x6be4('0x4a'),'input_type':_0x6be4('0x20'),'response_type':_0x6be4('0x20'),'rest_data':JSON[_0x6be4('0x21')]({'session':_0x2c0792['id'],'module_name':_0x6be4('0x22'),'module_id':_0x4f3075['id'],'link_field_name':_0x58d0f0,'related_ids':[_0x4b936c['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x6be4('0x4b')]=function(_0x4c417f,_0x556662,_0x3e8279,_0x3a884d,_0x4e8c1f,_0x25bbf2){var _0x9dd1cc,_0x41daf5,_0x344fcb,_0x49a418;_0x25bbf2['remoteUri']=intUtil[_0x6be4('0x4c')](_0x25bbf2[_0x6be4('0x4d')]);_0x25bbf2[_0x6be4('0x4e')]=intUtil[_0x6be4('0x4c')](_0x25bbf2[_0x6be4('0x4e')]);def[_0x6be4('0x4f')]=util[_0x6be4('0x23')]('%s/service/v4_1/rest.php',_0x25bbf2[_0x6be4('0x4d')]);if(_0x4e8c1f&&_0x4e8c1f[_0x6be4('0x50')]){logger[_0x6be4('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0x556662['recordingURL']=util[_0x6be4('0x23')](_0x6be4('0x51'),_0x25bbf2[_0x6be4('0x4e')],_0x556662[_0x6be4('0x52')],md5(_0x556662[_0x6be4('0x52')]));}else{_0x556662['recordingURL']='';}return getConnection(_0x25bbf2)[_0x6be4('0x2a')](function(_0x2193f8){_0x49a418=_0x2193f8;return getUser(_0x25bbf2,_0x3a884d[_0x6be4('0xf')],_0x49a418);})[_0x6be4('0x2a')](function(_0xa31317){_0x9dd1cc=_0xa31317;logger['info'](_0x6be4('0x53'),_0x9dd1cc['id']);return getEndUser(_0x25bbf2,_0x556662[_0x6be4('0x54')],_0x556662[_0x6be4('0x55')],_0x49a418);})[_0x6be4('0x2a')](function(_0xf4a59c){_0x41daf5=_0xf4a59c;logger[_0x6be4('0xd')]('The\x20Enduser\x20ID\x20is:',_0x41daf5['id']);return getTicket(_0x25bbf2,_0x9dd1cc,_0x41daf5,_0x3e8279,_0x556662,_0x3e8279[_0x6be4('0x56')],_0x49a418,_0x6be4('0x57'));})[_0x6be4('0x2a')](function(_0x42e5c7){_0x344fcb=_0x42e5c7;logger[_0x6be4('0xd')](_0x6be4('0x58'));logger[_0x6be4('0xd')](_0x6be4('0x59'),_0x344fcb['id']);return setRelationship(_0x49a418,_0x9dd1cc,_0x344fcb,_0x6be4('0x5a'));})[_0x6be4('0x2a')](function(){return setRelationship(_0x49a418,_0x41daf5,_0x344fcb,_0x6be4('0x5b'));})[_0x6be4('0x2a')](function(){return getServerInfo(_0x49a418);})['then'](function(_0x4e89fd){var _0x414c53=parseInt(_0x4e89fd[_0x6be4('0x5c')][_0x6be4('0x5d')](0x0));var _0x1a48b2=util[_0x6be4('0x23')](_0x6be4('0x5e'),_0x25bbf2[_0x6be4('0x4d')],_0x344fcb['id']);if(_0x414c53>0x6){_0x1a48b2=util[_0x6be4('0x23')](_0x6be4('0x5f'),_0x25bbf2['remoteUri'],_0x344fcb['id']);}logger[_0x6be4('0xd')](_0x6be4('0x60'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6be4('0x23')](_0x6be4('0x61'),_0x3a884d['name']),_0x6be4('0x62'),{'uri':_0x1a48b2});})[_0x6be4('0x63')](function(_0x112475){logger[_0x6be4('0x64')](_0x6be4('0x60'),JSON[_0x6be4('0x21')](_0x112475));});};exports['outbound']=function(_0x27cf51,_0x30db23,_0xfee7ac,_0x4706e3,_0x56b4e0,_0x10a85a,_0x5da770){var _0x162f2d,_0x3b5ebd,_0x432c41,_0x599744;_0x10a85a[_0x6be4('0x4d')]=intUtil[_0x6be4('0x4c')](_0x10a85a['remoteUri']);_0x10a85a['serverUrl']=intUtil[_0x6be4('0x4c')](_0x10a85a[_0x6be4('0x4e')]);def['uri']=util[_0x6be4('0x23')](_0x6be4('0x65'),_0x10a85a['remoteUri']);if(_0x5da770&&_0x5da770[_0x6be4('0x66')]&&_0x5da770[_0x6be4('0x66')]!==_0x6be4('0x67')){logger[_0x6be4('0xd')]('[OUTBOUND]',_0x6be4('0x68'));_0x30db23['recordingURL']=util[_0x6be4('0x23')](_0x6be4('0x51'),_0x10a85a[_0x6be4('0x4e')],_0x30db23['uniqueid'],md5(_0x30db23[_0x6be4('0x52')]));}return getConnection(_0x10a85a)[_0x6be4('0x2a')](function(_0xa96edf){_0x599744=_0xa96edf;return getUser(_0x10a85a,_0x4706e3[_0x6be4('0xf')],_0x599744);})['then'](function(_0x2b7e81){_0x162f2d=_0x2b7e81;logger[_0x6be4('0xd')](_0x6be4('0x53'),_0x162f2d['id']);return getEndUser(_0x10a85a,_0x30db23[_0x6be4('0x69')],_0x30db23['destcalleridnum'],_0x599744);})[_0x6be4('0x2a')](function(_0x295ed9){_0x3b5ebd=_0x295ed9;logger['info'](_0x6be4('0x6a'),_0x3b5ebd['id']);return getTicket(_0x10a85a,_0x162f2d,_0x3b5ebd,_0xfee7ac,_0x30db23,_0xfee7ac[_0x6be4('0x56')],_0x599744,_0x6be4('0x6b'));})['then'](function(_0x20a9a7){_0x432c41=_0x20a9a7;logger[_0x6be4('0xd')](_0x6be4('0x58'));logger[_0x6be4('0xd')](_0x6be4('0x59'),_0x432c41['id']);return setRelationship(_0x599744,_0x162f2d,_0x432c41,'users');})[_0x6be4('0x2a')](function(){return setRelationship(_0x599744,_0x3b5ebd,_0x432c41,'contacts');})[_0x6be4('0x2a')](function(){return getServerInfo(_0x599744);})[_0x6be4('0x2a')](function(_0x1e5d35){var _0x392e66=parseInt(_0x1e5d35[_0x6be4('0x5c')]['charAt'](0x0));var _0x48554d=util[_0x6be4('0x23')](_0x6be4('0x5e'),_0x10a85a[_0x6be4('0x4d')],_0x432c41['id']);if(_0x392e66>0x6){_0x48554d=util[_0x6be4('0x23')](_0x6be4('0x5f'),_0x10a85a['remoteUri'],_0x432c41['id']);}logger['info'](_0x6be4('0x6c'),_0x6be4('0x6d'));emit(util[_0x6be4('0x23')]('user:%s',_0x4706e3[_0x6be4('0xf')]),_0x6be4('0x62'),{'uri':_0x48554d});})[_0x6be4('0x63')](function(_0x583da4){logger[_0x6be4('0x64')]('[OUTBOUND]',JSON[_0x6be4('0x21')](_0x583da4));});};exports[_0x6be4('0x6e')]=function(_0xa66c10,_0x2ffbb0,_0x15efb6,_0x3ef266,_0xcdb872,_0x6ef879){var _0x2b41df,_0x38e1bb,_0xb8a0fe,_0x19ea09;_0x6ef879[_0x6be4('0x4d')]=intUtil[_0x6be4('0x4c')](_0x6ef879[_0x6be4('0x4d')]);_0x6ef879[_0x6be4('0x4e')]=intUtil[_0x6be4('0x4c')](_0x6ef879[_0x6be4('0x4e')]);def[_0x6be4('0x4f')]=util['format'](_0x6be4('0x65'),_0x6ef879[_0x6be4('0x4d')]);if(_0xcdb872&&_0xcdb872[_0x6be4('0x50')]){logger[_0x6be4('0xd')]('['+_0x2ffbb0[_0x6be4('0x6f')][_0x6be4('0x70')]()+']',_0x6be4('0x68'));_0x2ffbb0['recordingURL']=util['format'](_0x6be4('0x51'),_0x6ef879[_0x6be4('0x4e')],_0x2ffbb0['uniqueid'],md5(_0x2ffbb0[_0x6be4('0x52')]));}else{_0x2ffbb0[_0x6be4('0x71')]='';}return getConnection(_0x6ef879)[_0x6be4('0x2a')](function(_0x2b9624){_0x19ea09=_0x2b9624;if(!_[_0x6be4('0x72')](_0x3ef266)){return getUser(_0x6ef879,_0x3ef266[_0x6be4('0xf')],_0x19ea09);}else{return getUser(_0x6ef879,null,_0x19ea09);}})[_0x6be4('0x2a')](function(_0x501876){_0x2b41df=_0x501876;logger[_0x6be4('0xd')](_0x6be4('0x53'),_0x2b41df['id']);return getEndUser(_0x6ef879,_0x2ffbb0['calleridname'],_0x2ffbb0[_0x6be4('0x55')],_0x19ea09);})['then'](function(_0x15ad7f){_0x38e1bb=_0x15ad7f;logger['info'](_0x6be4('0x6a'),_0x38e1bb['id']);return getTicket(_0x6ef879,_0x2b41df,_0x38e1bb,_0x15efb6,_0x2ffbb0,_0x15efb6[_0x6be4('0x56')],_0x19ea09,_0x6be4('0x57'));})[_0x6be4('0x2a')](function(_0x3e79a6){_0xb8a0fe=_0x3e79a6;logger['info']('Ticket\x20created!');logger['info'](_0x6be4('0x59'),_0xb8a0fe['id']);return setRelationship(_0x19ea09,_0x2b41df,_0xb8a0fe,'users');})['then'](function(){return setRelationship(_0x19ea09,_0x38e1bb,_0xb8a0fe,_0x6be4('0x5b'));})[_0x6be4('0x2a')](function(){return getServerInfo(_0x19ea09);})[_0x6be4('0x63')](function(_0x365240){logger['error']('['+_0x2ffbb0[_0x6be4('0x6f')][_0x6be4('0x70')]()+']',JSON[_0x6be4('0x21')](_0x365240));});}; \ 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 559f1e3..2ae9668 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 _0x843f=['keyType','key','%s:\x20%s','keyContent','format','join','lastIndexOf','validateEmail','test','lodash','util','getString','length','sortBy','type','string','push','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue'];(function(_0x3fe260,_0x142428){var _0x55604a=function(_0x4d5ca6){while(--_0x4d5ca6){_0x3fe260['push'](_0x3fe260['shift']());}};_0x55604a(++_0x142428);}(_0x843f,0x167));var _0xf843=function(_0xb39df7,_0x4bc7ed){_0xb39df7=_0xb39df7-0x0;var _0x19c9b6=_0x843f[_0xb39df7];return _0x19c9b6;};'use strict';var _=require(_0xf843('0x0'));var util=require(_0xf843('0x1'));exports[_0xf843('0x2')]=function(_0x4a5128,_0x4ed6af,_0x20b16c){var _0x8ce73=[];if(_0x4a5128[_0xf843('0x3')]>0x0){var _0x16dc97=_[_0xf843('0x4')](_0x4a5128,['id']);for(var _0x7d2bd2=0x0;_0x7d2bd2<_0x16dc97[_0xf843('0x3')];_0x7d2bd2++){var _0x3b7382=_0x16dc97[_0x7d2bd2];if(_0x3b7382[_0xf843('0x5')]===_0xf843('0x6')){_0x8ce73[_0xf843('0x7')](_0x3b7382['content']);}else if(_0x3b7382[_0xf843('0x5')]===_0xf843('0x8')&&_0x3b7382['variableName']){_0x4ed6af[_0x3b7382[_0xf843('0x9')]]&&_0x8ce73[_0xf843('0x7')](_0x4ed6af[_0x3b7382[_0xf843('0x9')]][_0xf843('0xa')]());}else if(_0x3b7382['type']===_0xf843('0xb')&&_0x3b7382[_0xf843('0xc')]&&_0x3b7382['Variable'][_0xf843('0xd')]){_0x4ed6af[_0x3b7382[_0xf843('0xc')][_0xf843('0xd')][_0xf843('0xe')]()]&&_0x8ce73[_0xf843('0x7')](_0x4ed6af[_0x3b7382[_0xf843('0xc')]['name'][_0xf843('0xe')]()][_0xf843('0xa')]());}else if(_0x3b7382[_0xf843('0x5')]===_0xf843('0xf')){if(_0x3b7382[_0xf843('0x10')]===_0xf843('0x6')&&_0x3b7382[_0xf843('0x11')]){_0x8ce73[_0xf843('0x7')](util['format'](_0xf843('0x12'),_0x3b7382['key'],_0x3b7382[_0xf843('0x13')]));}else if(_0x3b7382['keyType']===_0xf843('0x8')&&_0x3b7382['variableName']&&_0x3b7382[_0xf843('0x11')]){_0x4ed6af[_0x3b7382[_0xf843('0x9')]]&&_0x8ce73[_0xf843('0x7')](util[_0xf843('0x14')]('%s:\x20%s',_0x3b7382['key'],_0x4ed6af[_0x3b7382[_0xf843('0x9')]]));}else if(_0x3b7382['keyType']==='customVariable'&&_0x3b7382[_0xf843('0xc')]&&_0x3b7382['Variable'][_0xf843('0xd')]&&_0x3b7382[_0xf843('0x11')]){_0x4ed6af[_0x3b7382[_0xf843('0xc')]['name'][_0xf843('0xe')]()]&&_0x8ce73[_0xf843('0x7')](util[_0xf843('0x14')](_0xf843('0x12'),_0x3b7382[_0xf843('0x11')],_0x4ed6af[_0x3b7382[_0xf843('0xc')]['name'][_0xf843('0xe')]()]));}}}}return _0x8ce73[_0xf843('0x15')](_0x20b16c);};exports['stripTrailingSlash']=function(_0x13b74b){var _0xabceeb=_0x13b74b['slice'](-0x1);if(_0xabceeb==='/'){_0x13b74b=_0x13b74b['substring'](0x0,_0x13b74b[_0xf843('0x16')](_0xabceeb));}return _0x13b74b;};exports[_0xf843('0x17')]=function(_0x180ec6){if(!_['isNil'](_0x180ec6)&&_0x180ec6!==''){var _0x187aa8=/^(([^<>()\[\]\\.,;:\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 _0x187aa8[_0xf843('0x18')](String(_0x180ec6)[_0xf843('0xe')]());}else{return![];}}; \ No newline at end of file +var _0xa6c8=['test','lodash','util','getString','length','sortBy','type','string','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','substring','lastIndexOf','isNil'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0xa6c8,0x1b1));var _0x8a6c=function(_0x4b8cf4,_0x22cdc1){_0x4b8cf4=_0x4b8cf4-0x0;var _0xd01f29=_0xa6c8[_0x4b8cf4];return _0xd01f29;};'use strict';var _=require(_0x8a6c('0x0'));var util=require(_0x8a6c('0x1'));exports[_0x8a6c('0x2')]=function(_0x376892,_0xc3b290,_0x4d2f7b){var _0x30c34=[];if(_0x376892[_0x8a6c('0x3')]>0x0){var _0x2eb729=_[_0x8a6c('0x4')](_0x376892,['id']);for(var _0x54888a=0x0;_0x54888a<_0x2eb729[_0x8a6c('0x3')];_0x54888a++){var _0x176e6e=_0x2eb729[_0x54888a];if(_0x176e6e[_0x8a6c('0x5')]===_0x8a6c('0x6')){_0x30c34[_0x8a6c('0x7')](_0x176e6e[_0x8a6c('0x8')]);}else if(_0x176e6e['type']===_0x8a6c('0x9')&&_0x176e6e[_0x8a6c('0xa')]){_0xc3b290[_0x176e6e[_0x8a6c('0xa')]]&&_0x30c34[_0x8a6c('0x7')](_0xc3b290[_0x176e6e[_0x8a6c('0xa')]]['toString']());}else if(_0x176e6e[_0x8a6c('0x5')]===_0x8a6c('0xb')&&_0x176e6e['Variable']&&_0x176e6e[_0x8a6c('0xc')][_0x8a6c('0xd')]){_0xc3b290[_0x176e6e[_0x8a6c('0xc')]['name'][_0x8a6c('0xe')]()]&&_0x30c34['push'](_0xc3b290[_0x176e6e['Variable'][_0x8a6c('0xd')][_0x8a6c('0xe')]()]['toString']());}else if(_0x176e6e['type']==='keyValue'){if(_0x176e6e[_0x8a6c('0xf')]==='string'&&_0x176e6e[_0x8a6c('0x10')]){_0x30c34[_0x8a6c('0x7')](util[_0x8a6c('0x11')](_0x8a6c('0x12'),_0x176e6e[_0x8a6c('0x10')],_0x176e6e[_0x8a6c('0x13')]));}else if(_0x176e6e[_0x8a6c('0xf')]===_0x8a6c('0x9')&&_0x176e6e[_0x8a6c('0xa')]&&_0x176e6e[_0x8a6c('0x10')]){_0xc3b290[_0x176e6e['variableName']]&&_0x30c34['push'](util[_0x8a6c('0x11')](_0x8a6c('0x12'),_0x176e6e['key'],_0xc3b290[_0x176e6e['variableName']]));}else if(_0x176e6e[_0x8a6c('0xf')]===_0x8a6c('0xb')&&_0x176e6e[_0x8a6c('0xc')]&&_0x176e6e['Variable'][_0x8a6c('0xd')]&&_0x176e6e[_0x8a6c('0x10')]){_0xc3b290[_0x176e6e[_0x8a6c('0xc')][_0x8a6c('0xd')][_0x8a6c('0xe')]()]&&_0x30c34[_0x8a6c('0x7')](util[_0x8a6c('0x11')](_0x8a6c('0x12'),_0x176e6e[_0x8a6c('0x10')],_0xc3b290[_0x176e6e[_0x8a6c('0xc')][_0x8a6c('0xd')][_0x8a6c('0xe')]()]));}}}}return _0x30c34[_0x8a6c('0x14')](_0x4d2f7b);};exports[_0x8a6c('0x15')]=function(_0x5b9721){var _0x175b77=_0x5b9721[_0x8a6c('0x16')](-0x1);if(_0x175b77==='/'){_0x5b9721=_0x5b9721[_0x8a6c('0x17')](0x0,_0x5b9721[_0x8a6c('0x18')](_0x175b77));}return _0x5b9721;};exports['validateEmail']=function(_0x2229f6){if(!_[_0x8a6c('0x19')](_0x2229f6)&&_0x2229f6!==''){var _0x17a933=/^(([^<>()\[\]\\.,;:\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 _0x17a933[_0x8a6c('0x1a')](String(_0x2229f6)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 366d940..68cbce2 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(_0x172581,_0x1c2351){var _0x4b10a9=function(_0x457380){while(--_0x457380){_0x172581['push'](_0x172581['shift']());}};_0x4b10a9(++_0x1c2351);}(_0xe706,0xa3));var _0x6e70=function(_0x4ffafb,_0x20171a){_0x4ffafb=_0x4ffafb-0x0;var _0x4ab472=_0xe706[_0x4ffafb];return _0x4ab472;};'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(_0x17882c,_0x4b964b){var _0x355a59=function(_0x534b5b){while(--_0x534b5b){_0x17882c['push'](_0x17882c['shift']());}};_0x355a59(++_0x4b964b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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 b56c9bc..7b6b928 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 _0x2588=['custom_fields','push','variable','variableName','customVariable','Variable','name','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','inspect','recordingFormat','none','[OUTBOUND]','Authorization','email','newTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','./util','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','Subjects','Descriptions','getString','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Enduser\x20created.','authType','%s:%s','password','token','%s/token:%s','username','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','type','nameField','customField','content','idField'];(function(_0x28edda,_0xbd447a){var _0x21f4a4=function(_0x5ae05e){while(--_0x5ae05e){_0x28edda['push'](_0x28edda['shift']());}};_0x21f4a4(++_0xbd447a);}(_0x2588,0x99));var _0x8258=function(_0x5cb99c,_0x4d325d){_0x5cb99c=_0x5cb99c-0x0;var _0x465e3a=_0x2588[_0x5cb99c];return _0x465e3a;};'use strict';var _=require(_0x8258('0x0'));var rp=require('request-promise');var md5=require(_0x8258('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x8258('0x2'));var config=require(_0x8258('0x3'));var logger=require(_0x8258('0x4'))('zendesk');config[_0x8258('0x5')]=_['defaults'](config[_0x8258('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x8258('0x6'))(new Redis(config[_0x8258('0x5')]));function emit(_0x494a17,_0x41da12,_0x533685){io['to'](_0x494a17)[_0x8258('0x7')](_0x41da12,_0x533685);}var headers={'Content-Type':_0x8258('0x8'),'Accept':'application/json'};function getTicket(_0x392f1c,_0x48f5b8,_0x4aade2,_0x130888,_0x1dcdb1){logger[_0x8258('0x9')](_0x8258('0xa'));return request({'uri':util[_0x8258('0xb')](_0x8258('0xc'),_0x392f1c[_0x8258('0xd')]),'method':_0x8258('0xe'),'body':{'ticket':_[_0x8258('0xf')]({'requester_id':_0x4aade2['id'],'submitter_id':_0x48f5b8?_0x48f5b8['id']:undefined,'assignee_id':_0x48f5b8?_0x48f5b8['id']:undefined,'tags':getTags(_0x130888[_0x8258('0x10')],'name'),'subject':intUtil['getString'](_0x130888[_0x8258('0x11')],_0x1dcdb1,'\x20'),'description':intUtil['getString'](_0x130888[_0x8258('0x12')],_0x1dcdb1,'\x0a'),'comment':{'public':![],'body':intUtil[_0x8258('0x13')](_0x130888[_0x8258('0x12')],_0x1dcdb1,'\x0a')}},getCustomFields(_0x130888['Fields'],_0x1dcdb1))}})[_0x8258('0x14')](function(_0x738aae){logger[_0x8258('0x9')](_0x8258('0x15'));return _0x738aae[_0x8258('0x16')];});}function getUser(_0x53bc8e,_0x3bc7bd){if(intUtil[_0x8258('0x17')](_0x3bc7bd)){logger[_0x8258('0x9')](_0x8258('0x18'),_0x3bc7bd);return request({'uri':util[_0x8258('0xb')](_0x8258('0x19'),_0x53bc8e['remoteUri']),'qs':{'query':util[_0x8258('0xb')](_0x8258('0x1a'),_0x3bc7bd)}})['then'](function(_0x3868e5){if(_0x3868e5[_0x8258('0x1b')]){logger['info'](_0x8258('0x1c'));return _[_0x8258('0x1d')](_0x3868e5[_0x8258('0x1e')],{'email':_0x3bc7bd,'role':_0x8258('0x1f')});}else{logger['info'](_0x8258('0x20'));return request({'uri':util[_0x8258('0xb')](_0x8258('0x21'),_0x53bc8e[_0x8258('0xd')])})[_0x8258('0x14')](function(_0x1ce500){logger[_0x8258('0x9')](_0x8258('0x22'));return _0x1ce500[_0x8258('0x23')];});}});}else{logger['info'](_0x8258('0x20'));return request({'uri':util[_0x8258('0xb')]('%s/users/me.json',_0x53bc8e['remoteUri'])})[_0x8258('0x14')](function(_0x4b0d42){logger[_0x8258('0x9')](_0x8258('0x22'));return _0x4b0d42[_0x8258('0x23')];});}}function getEndUser(_0x5a92f9,_0x1a630e,_0x1197f6){logger[_0x8258('0x9')](_0x8258('0x24'),_0x1197f6);return request({'uri':util[_0x8258('0xb')](_0x8258('0x19'),_0x5a92f9[_0x8258('0xd')]),'qs':{'query':util[_0x8258('0xb')]('type:user\x20role:end-user\x20phone:%s',_0x1197f6)}})[_0x8258('0x14')](function(_0xc8e1a2){var _0x49acda;if(_0xc8e1a2[_0x8258('0x1e')]['length']){_0xc8e1a2[_0x8258('0x1e')]=_['filter'](_0xc8e1a2['results'],{'suspended':![],'role':'end-user'});if(_0xc8e1a2[_0x8258('0x1e')][_0x8258('0x25')]){_0x49acda=_['first'](_0xc8e1a2[_0x8258('0x1e')]);}}if(_0x49acda){logger['info']('Enduser\x20found!');return _0x49acda;}else{logger[_0x8258('0x9')](_0x8258('0x26'));return request({'uri':util[_0x8258('0xb')](_0x8258('0x27'),_0x5a92f9[_0x8258('0xd')]),'method':'POST','body':{'user':{'role':_0x8258('0x28'),'name':util[_0x8258('0xb')]('Caller\x20-\x20%s',_0x1a630e||_0x1197f6),'phone':_0x1197f6}}})['then'](function(_0x4ea41f){logger[_0x8258('0x9')](_0x8258('0x29'));return _0x4ea41f['user'];});}});}function getAuth(_0x286003){var _0x2bbbc2;if(_0x286003[_0x8258('0x2a')]==='password'){_0x2bbbc2=util[_0x8258('0xb')](_0x8258('0x2b'),_0x286003['username'],_0x286003[_0x8258('0x2c')]);}else if(_0x286003['authType']===_0x8258('0x2d')){_0x2bbbc2=util['format'](_0x8258('0x2e'),_0x286003[_0x8258('0x2f')],_0x286003[_0x8258('0x2d')]);}return util[_0x8258('0xb')]('Basic\x20%s',new Buffer(_0x2bbbc2)[_0x8258('0x30')](_0x8258('0x31')));}function request(_0x2f127a){logger[_0x8258('0x32')](_0x8258('0x33'),JSON[_0x8258('0x34')](_0x2f127a));return rp(_['defaults'](_0x2f127a,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0xe5e7e1,_0x478d1a){var _0x2d1e86=[];if(_0xe5e7e1&&_0xe5e7e1[_0x8258('0x25')]>0x0){_0x2d1e86=_[_0x8258('0x35')](_0xe5e7e1,_0x478d1a);}return _0x2d1e86;}function getCustomFields(_0x331dd4,_0x1bb7e6){var _0x163ccb=[];var _0x2aa5a5={'custom_fields':[]};if(_0x331dd4[_0x8258('0x25')]>0x0){_[_0x8258('0x36')](_0x331dd4,function(_0x378195){if(_[_0x8258('0x37')]([_0x8258('0x38'),_0x8258('0x39')],_0x378195[_0x8258('0x3a')])&&_0x378195[_0x8258('0x3b')]&&!_0x378195[_0x8258('0x3c')]){_0x2aa5a5[_0x378195[_0x8258('0x3b')]['toLowerCase']()]=_0x378195[_0x8258('0x3d')]['toString']();}else if(_[_0x8258('0x37')](['string',_0x8258('0x39')],_0x378195['type'])&&_0x378195[_0x8258('0x3e')]&&_0x378195[_0x8258('0x3c')]){_0x2aa5a5[_0x8258('0x3f')][_0x8258('0x40')]({'id':_0x378195[_0x8258('0x3e')],'value':_0x378195[_0x8258('0x3d')]['toString']()});}else if(_0x378195['type']===_0x8258('0x41')&&_0x378195['variableName']&&_0x378195[_0x8258('0x3e')]&&_0x378195[_0x8258('0x3c')]){_0x1bb7e6[_0x378195['variableName']]&&_0x2aa5a5[_0x8258('0x3f')][_0x8258('0x40')]({'id':_0x378195['idField'],'value':_0x1bb7e6[_0x378195[_0x8258('0x42')]][_0x8258('0x30')]()});}else if(_0x378195['type']===_0x8258('0x43')&&_0x378195['Variable']&&_0x378195[_0x8258('0x44')]['name']&&_0x378195['idField']&&_0x378195[_0x8258('0x3c')]){_0x1bb7e6[_0x378195[_0x8258('0x44')][_0x8258('0x45')][_0x8258('0x46')]()]&&_0x2aa5a5['custom_fields'][_0x8258('0x40')]({'id':_0x378195[_0x8258('0x3e')],'value':_0x1bb7e6[_0x378195[_0x8258('0x44')][_0x8258('0x45')][_0x8258('0x46')]()][_0x8258('0x30')]()});}});}return _0x2aa5a5;}exports[_0x8258('0x47')]=function(_0x3c02f6,_0x336a7e,_0x25b5ca,_0x345755,_0x380a95,_0x495ef8){var _0x10377d,_0x310772;_0x495ef8[_0x8258('0xd')]=intUtil[_0x8258('0x48')](_0x495ef8[_0x8258('0xd')]);_0x495ef8[_0x8258('0x49')]=intUtil[_0x8258('0x48')](_0x495ef8['serverUrl']);if(_0x380a95&&_0x380a95[_0x8258('0x4a')]){logger[_0x8258('0x9')](_0x8258('0x4b'),_0x8258('0x4c'));_0x336a7e[_0x8258('0x4d')]=util['format'](_0x8258('0x4e'),_0x495ef8[_0x8258('0x49')],_0x336a7e[_0x8258('0x4f')],md5(_0x336a7e['uniqueid']));}else{_0x336a7e[_0x8258('0x4d')]='';}headers['Authorization']=getAuth(_0x495ef8);return getUser(_0x495ef8,_0x345755['email'])[_0x8258('0x14')](function(_0x196417){_0x10377d=_0x196417;logger[_0x8258('0x9')](_0x8258('0x50'),_0x10377d['id']);return getEndUser(_0x495ef8,_0x336a7e[_0x8258('0x51')],_0x336a7e[_0x8258('0x52')]);})['then'](function(_0x1b3817){_0x310772=_0x1b3817;logger[_0x8258('0x9')](_0x8258('0x53'),_0x310772['id']);return getTicket(_0x495ef8,_0x10377d,_0x310772,_0x25b5ca,_0x336a7e);})[_0x8258('0x14')](function(_0x52e6d4){if(_0x52e6d4){logger[_0x8258('0x9')](_0x8258('0x54'),_0x52e6d4['id']);switch(_0x495ef8[_0x8258('0x3a')]){case'integrationTab':logger[_0x8258('0x9')](_0x8258('0x4b'),_0x8258('0x55'));return request({'uri':util['format'](_0x8258('0x56'),_0x495ef8['remoteUri'],_0x10377d['id'],_0x52e6d4['id']),'method':_0x8258('0xe')});case'newTab':logger[_0x8258('0x9')](_0x8258('0x4b'),_0x8258('0x57'));emit(util[_0x8258('0xb')](_0x8258('0x58'),_0x345755[_0x8258('0x45')]),_0x8258('0x59'),{'uri':util[_0x8258('0xb')](_0x8258('0x5a'),_0x495ef8[_0x8258('0xd')][_0x8258('0x5b')](_0x8258('0x5c'),''),_0x52e6d4['id'])});break;default:logger['error']('[QUEUE]',_0x8258('0x5d'));}}})[_0x8258('0x5e')](function(_0x2e7402){logger[_0x8258('0x5f')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x8258('0x60')](_0x2e7402,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x4246aa,_0x41c0d0,_0x528f9e,_0x1d0cc3,_0x47a588,_0x460d54,_0x234ba3){var _0x36cef0,_0x4332f0;_0x460d54[_0x8258('0xd')]=intUtil[_0x8258('0x48')](_0x460d54[_0x8258('0xd')]);_0x460d54[_0x8258('0x49')]=intUtil[_0x8258('0x48')](_0x460d54['serverUrl']);if(_0x234ba3&&_0x234ba3[_0x8258('0x61')]&&_0x234ba3['recordingFormat']!==_0x8258('0x62')){logger['info'](_0x8258('0x63'),'Recording\x20is\x20enabled!');_0x41c0d0[_0x8258('0x4d')]=util[_0x8258('0xb')](_0x8258('0x4e'),_0x460d54[_0x8258('0x49')],_0x41c0d0[_0x8258('0x4f')],md5(_0x41c0d0[_0x8258('0x4f')]));}headers[_0x8258('0x64')]=getAuth(_0x460d54);return getUser(_0x460d54,_0x1d0cc3[_0x8258('0x65')])[_0x8258('0x14')](function(_0x28983c){_0x36cef0=_0x28983c;logger[_0x8258('0x9')](_0x8258('0x50'),_0x36cef0['id']);return getEndUser(_0x460d54,_0x41c0d0['destcalleridname'],_0x41c0d0['destcalleridnum']);})[_0x8258('0x14')](function(_0x15c17a){_0x4332f0=_0x15c17a;logger[_0x8258('0x9')](_0x8258('0x53'),_0x4332f0['id']);return getTicket(_0x460d54,_0x36cef0,_0x4332f0,_0x528f9e,_0x41c0d0);})[_0x8258('0x14')](function(_0x46eea8){if(_0x46eea8){logger[_0x8258('0x9')](_0x8258('0x54'),_0x46eea8['id']);switch(_0x460d54[_0x8258('0x3a')]){case'integrationTab':logger[_0x8258('0x9')](_0x8258('0x63'),_0x8258('0x55'));return request({'uri':util[_0x8258('0xb')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x460d54[_0x8258('0xd')],_0x36cef0['id'],_0x46eea8['id']),'method':_0x8258('0xe')});case _0x8258('0x66'):logger[_0x8258('0x9')]('[OUTBOUND]',_0x8258('0x57'));emit(util[_0x8258('0xb')](_0x8258('0x58'),_0x1d0cc3['name']),'trigger:browser:url',{'uri':util[_0x8258('0xb')](_0x8258('0x5a'),_0x460d54[_0x8258('0xd')][_0x8258('0x5b')](_0x8258('0x5c'),''),_0x46eea8['id'])});break;default:logger[_0x8258('0x5f')](_0x8258('0x63'),_0x8258('0x5d'));}}})[_0x8258('0x5e')](function(_0x4b571b){logger['error'](_0x8258('0x67'),util[_0x8258('0x60')](_0x4b571b,{'showHidden':!![],'depth':null}));});};exports[_0x8258('0x68')]=function(_0x3ca6ea,_0x29ecd8,_0x5ee488,_0x418ffa,_0x759d3b,_0x490013){var _0x3d508f,_0x219e93;_0x490013['remoteUri']=intUtil[_0x8258('0x48')](_0x490013['remoteUri']);_0x490013[_0x8258('0x49')]=intUtil[_0x8258('0x48')](_0x490013[_0x8258('0x49')]);if(_0x759d3b&&_0x759d3b['monitor_format']){logger[_0x8258('0x9')]('['+_0x29ecd8[_0x8258('0x69')]['toUpperCase']()+']',_0x8258('0x4c'));_0x29ecd8[_0x8258('0x4d')]=util[_0x8258('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x490013[_0x8258('0x49')],_0x29ecd8[_0x8258('0x4f')],md5(_0x29ecd8[_0x8258('0x4f')]));}else{_0x29ecd8[_0x8258('0x4d')]='';}headers[_0x8258('0x64')]=getAuth(_0x490013);return getUser(_0x490013)[_0x8258('0x14')](function(_0x1f7e11){_0x3d508f=_0x1f7e11;logger['info'](_0x8258('0x50'),_0x3d508f['id']);return getEndUser(_0x490013,_0x29ecd8[_0x8258('0x51')],_0x29ecd8['calleridnum']);})['then'](function(_0x1a29eb){_0x219e93=_0x1a29eb;logger[_0x8258('0x9')]('The\x20Enduser\x20ID\x20is:',_0x219e93['id']);return getTicket(_0x490013,_0x3d508f,_0x219e93,_0x5ee488,_0x29ecd8);})[_0x8258('0x14')](function(_0x4dc391){if(_0x4dc391){logger[_0x8258('0x9')](_0x8258('0x54'),_0x4dc391['id']);}})[_0x8258('0x5e')](function(_0x5c6459){logger[_0x8258('0x5f')]('['+_0x29ecd8['lastevent'][_0x8258('0x6a')]()+']'+_0x8258('0x6b'),util[_0x8258('0x60')](_0x5c6459,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6f4e=['content','picklist','type','idField','custom_fields','push','variable','variableName','customVariable','name','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','%s/agent/tickets/%s','/api/v2','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','trigger:browser:url','replace','Zendesk\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','calleridname','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','inspect','lodash','request-promise','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','length','results','end-user','first','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','includes','string','nameField','customField','toLowerCase'];(function(_0x2978e1,_0x26b3f5){var _0xca0ea8=function(_0x289c2e){while(--_0x289c2e){_0x2978e1['push'](_0x2978e1['shift']());}};_0xca0ea8(++_0x26b3f5);}(_0x6f4e,0x1dd));var _0xe6f4=function(_0x2efe86,_0x30867f){_0x2efe86=_0x2efe86-0x0;var _0xcc7579=_0x6f4e[_0x2efe86];return _0xcc7579;};'use strict';var _=require(_0xe6f4('0x0'));var rp=require(_0xe6f4('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xe6f4('0x2'));var intUtil=require(_0xe6f4('0x3'));var config=require('../../../../config/environment');var logger=require(_0xe6f4('0x4'))('zendesk');config[_0xe6f4('0x5')]=_[_0xe6f4('0x6')](config[_0xe6f4('0x5')],{'host':_0xe6f4('0x7'),'port':0x18eb});var io=require(_0xe6f4('0x8'))(new Redis(config['redis']));function emit(_0x406364,_0x18d39b,_0x289f05){io['to'](_0x406364)[_0xe6f4('0x9')](_0x18d39b,_0x289f05);}var headers={'Content-Type':_0xe6f4('0xa'),'Accept':_0xe6f4('0xa')};function getTicket(_0x1f0f1a,_0x5b3f26,_0x3efeb3,_0x5dcb0c,_0x461097){logger[_0xe6f4('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xe6f4('0xc')](_0xe6f4('0xd'),_0x1f0f1a[_0xe6f4('0xe')]),'method':_0xe6f4('0xf'),'body':{'ticket':_[_0xe6f4('0x10')]({'requester_id':_0x3efeb3['id'],'submitter_id':_0x5b3f26?_0x5b3f26['id']:undefined,'assignee_id':_0x5b3f26?_0x5b3f26['id']:undefined,'tags':getTags(_0x5dcb0c['Tags'],'name'),'subject':intUtil[_0xe6f4('0x11')](_0x5dcb0c[_0xe6f4('0x12')],_0x461097,'\x20'),'description':intUtil['getString'](_0x5dcb0c[_0xe6f4('0x13')],_0x461097,'\x0a'),'comment':{'public':![],'body':intUtil[_0xe6f4('0x11')](_0x5dcb0c[_0xe6f4('0x13')],_0x461097,'\x0a')}},getCustomFields(_0x5dcb0c[_0xe6f4('0x14')],_0x461097))}})[_0xe6f4('0x15')](function(_0x2461f3){logger[_0xe6f4('0xb')]('Ticket\x20created!');return _0x2461f3[_0xe6f4('0x16')];});}function getUser(_0x1bfdc6,_0x26083e){if(intUtil[_0xe6f4('0x17')](_0x26083e)){logger[_0xe6f4('0xb')](_0xe6f4('0x18'),_0x26083e);return request({'uri':util[_0xe6f4('0xc')](_0xe6f4('0x19'),_0x1bfdc6[_0xe6f4('0xe')]),'qs':{'query':util[_0xe6f4('0xc')](_0xe6f4('0x1a'),_0x26083e)}})[_0xe6f4('0x15')](function(_0x3ed287){if(_0x3ed287[_0xe6f4('0x1b')]){logger[_0xe6f4('0xb')](_0xe6f4('0x1c'));return _['find'](_0x3ed287['results'],{'email':_0x26083e,'role':_0xe6f4('0x1d')});}else{logger[_0xe6f4('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xe6f4('0xc')](_0xe6f4('0x1e'),_0x1bfdc6['remoteUri'])})[_0xe6f4('0x15')](function(_0x5e03ae){logger[_0xe6f4('0xb')](_0xe6f4('0x1f'));return _0x5e03ae[_0xe6f4('0x20')];});}});}else{logger[_0xe6f4('0xb')](_0xe6f4('0x21'));return request({'uri':util[_0xe6f4('0xc')](_0xe6f4('0x1e'),_0x1bfdc6[_0xe6f4('0xe')])})[_0xe6f4('0x15')](function(_0x53353e){logger[_0xe6f4('0xb')](_0xe6f4('0x1f'));return _0x53353e[_0xe6f4('0x20')];});}}function getEndUser(_0x254655,_0x6d9101,_0x48c095){logger[_0xe6f4('0xb')](_0xe6f4('0x22'),_0x48c095);return request({'uri':util[_0xe6f4('0xc')](_0xe6f4('0x19'),_0x254655[_0xe6f4('0xe')]),'qs':{'query':util[_0xe6f4('0xc')]('type:user\x20role:end-user\x20phone:%s',_0x48c095)}})['then'](function(_0x2a118c){var _0x46e00b;if(_0x2a118c['results'][_0xe6f4('0x23')]){_0x2a118c[_0xe6f4('0x24')]=_['filter'](_0x2a118c['results'],{'suspended':![],'role':_0xe6f4('0x25')});if(_0x2a118c[_0xe6f4('0x24')][_0xe6f4('0x23')]){_0x46e00b=_[_0xe6f4('0x26')](_0x2a118c[_0xe6f4('0x24')]);}}if(_0x46e00b){logger[_0xe6f4('0xb')]('Enduser\x20found!');return _0x46e00b;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format']('%s/users.json',_0x254655[_0xe6f4('0xe')]),'method':_0xe6f4('0xf'),'body':{'user':{'role':_0xe6f4('0x25'),'name':util[_0xe6f4('0xc')](_0xe6f4('0x27'),_0x6d9101||_0x48c095),'phone':_0x48c095}}})[_0xe6f4('0x15')](function(_0x50ae93){logger['info'](_0xe6f4('0x28'));return _0x50ae93[_0xe6f4('0x20')];});}});}function getAuth(_0x167db0){var _0x51a3eb;if(_0x167db0[_0xe6f4('0x29')]===_0xe6f4('0x2a')){_0x51a3eb=util['format'](_0xe6f4('0x2b'),_0x167db0[_0xe6f4('0x2c')],_0x167db0[_0xe6f4('0x2a')]);}else if(_0x167db0[_0xe6f4('0x29')]===_0xe6f4('0x2d')){_0x51a3eb=util[_0xe6f4('0xc')]('%s/token:%s',_0x167db0[_0xe6f4('0x2c')],_0x167db0[_0xe6f4('0x2d')]);}return util['format'](_0xe6f4('0x2e'),new Buffer(_0x51a3eb)[_0xe6f4('0x2f')]('base64'));}function request(_0x1bffc2){logger[_0xe6f4('0x30')](_0xe6f4('0x31'),JSON[_0xe6f4('0x32')](_0x1bffc2));return rp(_[_0xe6f4('0x6')](_0x1bffc2,{'method':_0xe6f4('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x46bd73,_0x44c761){var _0x1c1d79=[];if(_0x46bd73&&_0x46bd73[_0xe6f4('0x23')]>0x0){_0x1c1d79=_[_0xe6f4('0x34')](_0x46bd73,_0x44c761);}return _0x1c1d79;}function getCustomFields(_0x1910c6,_0xa6b5e9){var _0x4e517a=[];var _0x1433cd={'custom_fields':[]};if(_0x1910c6['length']>0x0){_['forEach'](_0x1910c6,function(_0x3466e5){if(_[_0xe6f4('0x35')]([_0xe6f4('0x36'),'picklist'],_0x3466e5['type'])&&_0x3466e5[_0xe6f4('0x37')]&&!_0x3466e5[_0xe6f4('0x38')]){_0x1433cd[_0x3466e5[_0xe6f4('0x37')][_0xe6f4('0x39')]()]=_0x3466e5[_0xe6f4('0x3a')][_0xe6f4('0x2f')]();}else if(_[_0xe6f4('0x35')]([_0xe6f4('0x36'),_0xe6f4('0x3b')],_0x3466e5[_0xe6f4('0x3c')])&&_0x3466e5[_0xe6f4('0x3d')]&&_0x3466e5['customField']){_0x1433cd[_0xe6f4('0x3e')][_0xe6f4('0x3f')]({'id':_0x3466e5[_0xe6f4('0x3d')],'value':_0x3466e5[_0xe6f4('0x3a')][_0xe6f4('0x2f')]()});}else if(_0x3466e5['type']===_0xe6f4('0x40')&&_0x3466e5['variableName']&&_0x3466e5[_0xe6f4('0x3d')]&&_0x3466e5[_0xe6f4('0x38')]){_0xa6b5e9[_0x3466e5[_0xe6f4('0x41')]]&&_0x1433cd[_0xe6f4('0x3e')]['push']({'id':_0x3466e5[_0xe6f4('0x3d')],'value':_0xa6b5e9[_0x3466e5[_0xe6f4('0x41')]][_0xe6f4('0x2f')]()});}else if(_0x3466e5[_0xe6f4('0x3c')]===_0xe6f4('0x42')&&_0x3466e5['Variable']&&_0x3466e5['Variable'][_0xe6f4('0x43')]&&_0x3466e5[_0xe6f4('0x3d')]&&_0x3466e5[_0xe6f4('0x38')]){_0xa6b5e9[_0x3466e5[_0xe6f4('0x44')][_0xe6f4('0x43')][_0xe6f4('0x39')]()]&&_0x1433cd['custom_fields'][_0xe6f4('0x3f')]({'id':_0x3466e5[_0xe6f4('0x3d')],'value':_0xa6b5e9[_0x3466e5[_0xe6f4('0x44')]['name'][_0xe6f4('0x39')]()][_0xe6f4('0x2f')]()});}});}return _0x1433cd;}exports[_0xe6f4('0x45')]=function(_0x3518a2,_0x3bf77d,_0x1e5d05,_0x438258,_0x7f5ad9,_0x5bf973){var _0x58da72,_0x488412;_0x5bf973[_0xe6f4('0xe')]=intUtil[_0xe6f4('0x46')](_0x5bf973[_0xe6f4('0xe')]);_0x5bf973[_0xe6f4('0x47')]=intUtil['stripTrailingSlash'](_0x5bf973[_0xe6f4('0x47')]);if(_0x7f5ad9&&_0x7f5ad9[_0xe6f4('0x48')]){logger[_0xe6f4('0xb')]('[QUEUE]',_0xe6f4('0x49'));_0x3bf77d[_0xe6f4('0x4a')]=util[_0xe6f4('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5bf973[_0xe6f4('0x47')],_0x3bf77d[_0xe6f4('0x4b')],md5(_0x3bf77d[_0xe6f4('0x4b')]));}else{_0x3bf77d[_0xe6f4('0x4a')]='';}headers[_0xe6f4('0x4c')]=getAuth(_0x5bf973);return getUser(_0x5bf973,_0x438258[_0xe6f4('0x4d')])['then'](function(_0x35855a){_0x58da72=_0x35855a;logger[_0xe6f4('0xb')]('The\x20User\x20ID\x20is:',_0x58da72['id']);return getEndUser(_0x5bf973,_0x3bf77d['calleridname'],_0x3bf77d['calleridnum']);})[_0xe6f4('0x15')](function(_0x4a973e){_0x488412=_0x4a973e;logger[_0xe6f4('0xb')](_0xe6f4('0x4e'),_0x488412['id']);return getTicket(_0x5bf973,_0x58da72,_0x488412,_0x1e5d05,_0x3bf77d);})[_0xe6f4('0x15')](function(_0x2a5f92){if(_0x2a5f92){logger[_0xe6f4('0xb')](_0xe6f4('0x4f'),_0x2a5f92['id']);switch(_0x5bf973[_0xe6f4('0x3c')]){case _0xe6f4('0x50'):logger[_0xe6f4('0xb')](_0xe6f4('0x51'),_0xe6f4('0x52'));return request({'uri':util['format'](_0xe6f4('0x53'),_0x5bf973[_0xe6f4('0xe')],_0x58da72['id'],_0x2a5f92['id']),'method':_0xe6f4('0xf')});case _0xe6f4('0x54'):logger[_0xe6f4('0xb')](_0xe6f4('0x51'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe6f4('0xc')](_0xe6f4('0x55'),_0x438258['name']),'trigger:browser:url',{'uri':util['format'](_0xe6f4('0x56'),_0x5bf973[_0xe6f4('0xe')]['replace'](_0xe6f4('0x57'),''),_0x2a5f92['id'])});break;default:logger[_0xe6f4('0x58')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x56b9d5){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x56b9d5,{'showHidden':!![],'depth':null}));});};exports[_0xe6f4('0x59')]=function(_0xb3079f,_0x29b8b2,_0x4a5b84,_0x35ca91,_0xdcd423,_0x47f0c6,_0x243f56){var _0x2e2127,_0x2db212;_0x47f0c6[_0xe6f4('0xe')]=intUtil[_0xe6f4('0x46')](_0x47f0c6[_0xe6f4('0xe')]);_0x47f0c6[_0xe6f4('0x47')]=intUtil['stripTrailingSlash'](_0x47f0c6[_0xe6f4('0x47')]);if(_0x243f56&&_0x243f56[_0xe6f4('0x5a')]&&_0x243f56['recordingFormat']!==_0xe6f4('0x5b')){logger[_0xe6f4('0xb')](_0xe6f4('0x5c'),_0xe6f4('0x49'));_0x29b8b2[_0xe6f4('0x4a')]=util[_0xe6f4('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x47f0c6[_0xe6f4('0x47')],_0x29b8b2['uniqueid'],md5(_0x29b8b2[_0xe6f4('0x4b')]));}headers['Authorization']=getAuth(_0x47f0c6);return getUser(_0x47f0c6,_0x35ca91[_0xe6f4('0x4d')])['then'](function(_0x4d4f49){_0x2e2127=_0x4d4f49;logger[_0xe6f4('0xb')]('The\x20User\x20ID\x20is:',_0x2e2127['id']);return getEndUser(_0x47f0c6,_0x29b8b2['destcalleridname'],_0x29b8b2[_0xe6f4('0x5d')]);})[_0xe6f4('0x15')](function(_0x4cd312){_0x2db212=_0x4cd312;logger[_0xe6f4('0xb')](_0xe6f4('0x4e'),_0x2db212['id']);return getTicket(_0x47f0c6,_0x2e2127,_0x2db212,_0x4a5b84,_0x29b8b2);})[_0xe6f4('0x15')](function(_0x47ecdf){if(_0x47ecdf){logger['info'](_0xe6f4('0x4f'),_0x47ecdf['id']);switch(_0x47f0c6['type']){case _0xe6f4('0x50'):logger[_0xe6f4('0xb')](_0xe6f4('0x5c'),_0xe6f4('0x52'));return request({'uri':util[_0xe6f4('0xc')](_0xe6f4('0x53'),_0x47f0c6[_0xe6f4('0xe')],_0x2e2127['id'],_0x47ecdf['id']),'method':_0xe6f4('0xf')});case _0xe6f4('0x54'):logger[_0xe6f4('0xb')](_0xe6f4('0x5c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe6f4('0xc')]('user:%s',_0x35ca91[_0xe6f4('0x43')]),_0xe6f4('0x5e'),{'uri':util[_0xe6f4('0xc')](_0xe6f4('0x56'),_0x47f0c6[_0xe6f4('0xe')][_0xe6f4('0x5f')](_0xe6f4('0x57'),''),_0x47ecdf['id'])});break;default:logger['error'](_0xe6f4('0x5c'),_0xe6f4('0x60'));}}})[_0xe6f4('0x61')](function(_0x1c1d8a){logger[_0xe6f4('0x58')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x1c1d8a,{'showHidden':!![],'depth':null}));});};exports[_0xe6f4('0x62')]=function(_0x10b4dc,_0x38ed77,_0x51e311,_0x192dc1,_0x4fb899,_0x28faf5){var _0xcfc185,_0x3b0d84;_0x28faf5[_0xe6f4('0xe')]=intUtil[_0xe6f4('0x46')](_0x28faf5[_0xe6f4('0xe')]);_0x28faf5[_0xe6f4('0x47')]=intUtil[_0xe6f4('0x46')](_0x28faf5[_0xe6f4('0x47')]);if(_0x4fb899&&_0x4fb899['monitor_format']){logger['info']('['+_0x38ed77[_0xe6f4('0x63')][_0xe6f4('0x64')]()+']',_0xe6f4('0x49'));_0x38ed77[_0xe6f4('0x4a')]=util[_0xe6f4('0xc')](_0xe6f4('0x65'),_0x28faf5['serverUrl'],_0x38ed77[_0xe6f4('0x4b')],md5(_0x38ed77[_0xe6f4('0x4b')]));}else{_0x38ed77['recordingURL']='';}headers['Authorization']=getAuth(_0x28faf5);return getUser(_0x28faf5)[_0xe6f4('0x15')](function(_0x351638){_0xcfc185=_0x351638;logger['info'](_0xe6f4('0x66'),_0xcfc185['id']);return getEndUser(_0x28faf5,_0x38ed77[_0xe6f4('0x67')],_0x38ed77[_0xe6f4('0x68')]);})[_0xe6f4('0x15')](function(_0x1362a3){_0x3b0d84=_0x1362a3;logger[_0xe6f4('0xb')](_0xe6f4('0x4e'),_0x3b0d84['id']);return getTicket(_0x28faf5,_0xcfc185,_0x3b0d84,_0x51e311,_0x38ed77);})['then'](function(_0x3b0fe3){if(_0x3b0fe3){logger[_0xe6f4('0xb')](_0xe6f4('0x4f'),_0x3b0fe3['id']);}})['catch'](function(_0xfbf186){logger[_0xe6f4('0x58')]('['+_0x38ed77[_0xe6f4('0x63')][_0xe6f4('0x64')]()+']'+_0xe6f4('0x69'),util[_0xe6f4('0x6a')](_0xfbf186,{'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 aa42663..29c4137 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 _0xb18e=['[OUTBOUND]','com','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','unmanaged','/downloads?type=uniqueid&token=','zoho.eu','calleridname','toUpperCase','lodash','request-promise','md5','./util','moment','ioredis','../../../../config/logger','redis','localhost','socket.io-emitter','emit','debug','length','includes','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','email','Agent\x20found!','findIndex','profile','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Descriptions','enduserType','Who_Id','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','utc','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','Rejected','abandoned','Abandoned','timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb18e,0x147));var _0xeb18=function(_0x3d38ae,_0x51102b){_0x3d38ae=_0x3d38ae-0x0;var _0x3757ee=_0xb18e[_0x3d38ae];return _0x3757ee;};'use strict';var _=require(_0xeb18('0x0'));var rp=require(_0xeb18('0x1'));var md5=require(_0xeb18('0x2'));var util=require('util');var intUtil=require(_0xeb18('0x3'));var moment=require(_0xeb18('0x4'));var Redis=require(_0xeb18('0x5'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0xeb18('0x6'))('zoho');config['redis']=_['defaults'](config[_0xeb18('0x7')],{'host':_0xeb18('0x8'),'port':0x18eb});var io=require(_0xeb18('0x9'))(new Redis(config[_0xeb18('0x7')]));function emit(_0x293512,_0x3874f1,_0x210203){io['to'](_0x293512)[_0xeb18('0xa')](_0x3874f1,_0x210203);}function request(_0x573558){logger[_0xeb18('0xb')]('[HTTP]',JSON['stringify'](_0x573558));return rp(_0x573558);}function getCustomFields(_0x8325e8,_0x10d859){var _0x5c6941={};if(_0x8325e8[_0xeb18('0xc')]>0x0){_['forEach'](_0x8325e8,function(_0x2750f9){if(_[_0xeb18('0xd')](['string',_0xeb18('0xe')],_0x2750f9[_0xeb18('0xf')])&&_0x2750f9[_0xeb18('0x10')]){_0x5c6941[_0x2750f9['idField']]=_0x2750f9['content'][_0xeb18('0x11')]();}else if(_0x2750f9[_0xeb18('0xf')]===_0xeb18('0x12')&&_0x2750f9[_0xeb18('0x13')]&&_0x2750f9[_0xeb18('0x10')]&&_0x10d859[_0x2750f9[_0xeb18('0x13')]]){_0x5c6941[_0x2750f9[_0xeb18('0x10')]]=_0x10d859[_0x2750f9['variableName']]['toString']();}else if(_0x2750f9[_0xeb18('0xf')]===_0xeb18('0x14')&&_0x2750f9[_0xeb18('0x15')]&&_0x2750f9[_0xeb18('0x15')][_0xeb18('0x16')]&&_0x2750f9[_0xeb18('0x10')]&&_0x10d859[_0x2750f9[_0xeb18('0x15')][_0xeb18('0x16')]['toLowerCase']()]){_0x5c6941[_0x2750f9['idField']]=_0x10d859[_0x2750f9[_0xeb18('0x15')][_0xeb18('0x16')][_0xeb18('0x17')]()][_0xeb18('0x11')]();}});}return _0x5c6941;}function getName(_0x118604){if(_0x118604[_0xeb18('0x18')]('\x20')>0x0){var _0x21b81a=_0x118604[_0xeb18('0x19')](/ (.+)/);if(_0x21b81a[0x1]){return _0x21b81a;}}return[_0x118604,_0x118604];}var accountsTokens={};function getAccessToken(_0x3623bf){return new Promise(function(_0x30e0d4,_0x32ad16){if(!_['isNil'](accountsTokens[_0x3623bf['id']])&&!_[_0xeb18('0x1a')](accountsTokens[_0x3623bf['id']][_0xeb18('0x1b')])){if(moment()[_0xeb18('0x1c')](accountsTokens[_0x3623bf['id']][_0xeb18('0x1d')])){_0x30e0d4(accountsTokens[_0x3623bf['id']][_0xeb18('0x1b')]);}}var _0x2f3a95;switch(_0x3623bf[_0xeb18('0x1e')]){case'US':_0x2f3a95=_0xeb18('0x1f');break;case'AU':_0x2f3a95=_0xeb18('0x20');break;case'EU':_0x2f3a95=_0xeb18('0x21');break;case'IN':_0x2f3a95=_0xeb18('0x22');break;case'CN':_0x2f3a95='https://accounts.zoho.com.cn';break;default:_0x2f3a95='https://accounts.zoho.eu';break;}var _0xd42ba6={'method':_0xeb18('0x23'),'uri':_0x2f3a95+_0xeb18('0x24'),'qs':{'refresh_token':_0x3623bf[_0xeb18('0x25')],'client_id':_0x3623bf[_0xeb18('0x26')],'client_secret':_0x3623bf[_0xeb18('0x27')],'grant_type':_0xeb18('0x28')},'json':!![]};return rp(_0xd42ba6)[_0xeb18('0x29')](function(_0xed79b1){accountsTokens[_0x3623bf['id']]={'access_token':_0xed79b1['access_token'],'expires_in':moment()[_0xeb18('0x2a')](_0xed79b1[_0xeb18('0x1d')],_0xeb18('0x2b'))};_0x30e0d4(_0xed79b1[_0xeb18('0x1b')]);})[_0xeb18('0x2c')](function(_0x69bd6a){logger['error'](_0xeb18('0x2d'),_0x69bd6a[_0xeb18('0x2e')]);_0x32ad16(_0x69bd6a);});});}function getUser(_0x569eca,_0x171bc0,_0x16bc70,_0x4201e9){logger[_0xeb18('0x2f')](_0xeb18('0x30'));return request({'method':_0xeb18('0x31'),'uri':util[_0xeb18('0x32')]('https://www.zohoapis.%s/crm/v2/users',_0x171bc0),'qs':{'type':_0xeb18('0x33')},'headers':{'Authorization':_0xeb18('0x34')+_0x569eca},'json':!![]})['then'](function(_0x25d97d){if(_0x25d97d['users']){var _0x406605=-0x1;if(_['isArrayLikeObject'](_0x25d97d[_0xeb18('0x35')])){if(!_['isNil'](_0x4201e9)){_0x406605=_['findIndex'](_0x25d97d[_0xeb18('0x35')],function(_0x3e166a){return _0x3e166a[_0xeb18('0x36')]===_0x4201e9;});}if(_0x406605>=0x0){logger['info'](_0xeb18('0x37'));}else{logger[_0xeb18('0x2f')]('Using\x20the\x20admin\x20account!');_0x406605=_[_0xeb18('0x38')](_0x25d97d['users'],function(_0x52d985){return _0x52d985[_0xeb18('0x39')][_0xeb18('0x16')]===_0xeb18('0x3a');});}return _0x25d97d[_0xeb18('0x35')][_0x406605];}else{if(_0x25d97d[_0xeb18('0x3b')][_0xeb18('0x39')][_0xeb18('0x16')]===_0xeb18('0x3a')){logger[_0xeb18('0x2f')](_0xeb18('0x3c'));user=_0x25d97d[_0xeb18('0x3b')];return user;}else{logger['error'](_0xeb18('0x3d'),JSON[_0xeb18('0x3e')](_0x25d97d));throw new Error(_0xeb18('0x3f')+JSON[_0xeb18('0x3e')](_0x25d97d));}}}else{logger[_0xeb18('0x40')](_0xeb18('0x3d'),JSON[_0xeb18('0x3e')](_0x25d97d));throw new Error(_0xeb18('0x3f')+JSON[_0xeb18('0x3e')](_0x25d97d));}})['catch'](function(_0x48658f){console['error'](_0x48658f);});}function getZohoUser(_0x126bde,_0xbbd27f){return new BPromise(function(_0x22f79e,_0x4498ba){request(_0x126bde)[_0xeb18('0x29')](function(_0x1618a8){var _0x48de23=null;if(_0x1618a8){_0x48de23=_0x1618a8[_0xeb18('0x41')][0x0];_0x48de23['enduserType']=_0xbbd27f;}_0x22f79e(_0x48de23);})['catch'](function(_0x238dd2){_0x4498ba(_0x238dd2);});});}function createEndUser(_0x1c80a3,_0x41526e,_0xc780fb,_0x3d188d,_0x14228e,_0x43558d){var _0xc780fb=getName(_0xc780fb);return request({'method':_0xeb18('0x23'),'uri':_0xeb18('0x42')+_0x41526e+_0xeb18('0x43')+_[_0xeb18('0x44')](_0x43558d[_0xeb18('0x45')])+'s','body':{'data':[{'Last_Name':_0xc780fb[0x1],'First_Name':_0xc780fb[0x0],'Phone':_0x3d188d,'Owner':{'name':!_[_0xeb18('0x1a')](_0x14228e[_0xeb18('0x46')][_0xeb18('0x16')])?_0x14228e[_0xeb18('0x46')][_0xeb18('0x16')]:!_[_0xeb18('0x1a')](_0x14228e[_0xeb18('0x47')])?_0x14228e['first_name']+'\x20'+_0x14228e[_0xeb18('0x48')]:_0x14228e[_0xeb18('0x48')],'id':_0x14228e['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1c80a3},'json':!![]})[_0xeb18('0x29')](function(_0x20abf9){if(_0x20abf9&&_0x20abf9[_0xeb18('0x41')][0x0][_0xeb18('0x49')]===_0xeb18('0x4a')){var _0x544eef=_0x20abf9[_0xeb18('0x41')][0x0][_0xeb18('0x4b')];_0x544eef['enduserType']=_[_0xeb18('0x44')](_0x43558d[_0xeb18('0x45')])+'s';return _0x544eef;}logger['error'](_0xeb18('0x3d'),JSON[_0xeb18('0x3e')](data));throw new Error(_0xeb18('0x4c')+JSON['stringify'](data));})[_0xeb18('0x2c')](function(_0x2f43a8){console[_0xeb18('0x4d')]('CREATE\x20ERROR',_0x2f43a8);});}function getEndUser(_0x3ec977,_0x49c2b8,_0x11305f,_0x50f0b3,_0x5be4a7,_0x25fa32,_0x1f6f05){var _0x47694f={'method':_0xeb18('0x31'),'uri':'','headers':{'Authorization':_0xeb18('0x34')+_0x3ec977},'json':!![]};switch(_0x1f6f05[_0xeb18('0x4e')]){case _0xeb18('0x4f'):_0x47694f[_0xeb18('0x50')]=_0xeb18('0x42')+_0x49c2b8+_0xeb18('0x51')+_0x5be4a7+'))';return getZohoUser(_0x47694f,_0xeb18('0x52'))[_0xeb18('0x29')](function(_0x44937a){if(_0x44937a)return _0x44937a;_0x47694f[_0xeb18('0x50')]=_0xeb18('0x42')+_0x49c2b8+_0xeb18('0x53')+_0x5be4a7+'))';return getZohoUser(_0x47694f,_0xeb18('0x54'))['then'](function(_0x477435){if(_0x477435)return _0x477435;if(_0x1f6f05[_0xeb18('0x45')]!=_0xeb18('0x55')){return createEndUser(_0x3ec977,_0x49c2b8,_0x50f0b3,_0x5be4a7,_0x25fa32,_0x1f6f05);}else{return{};}});});break;case'contact':_0x47694f['uri']=_0xeb18('0x42')+_0x49c2b8+_0xeb18('0x51')+_0x5be4a7+'))';return getZohoUser(_0x47694f,'Contacts')[_0xeb18('0x29')](function(_0x427a33){if(_0x427a33)return _0x427a33;if(_0x1f6f05[_0xeb18('0x45')]!=_0xeb18('0x55')){return createEndUser(_0x3ec977,_0x49c2b8,_0x50f0b3,_0x5be4a7,_0x25fa32,_0x1f6f05);}else{return{};}});break;case'lead':_0x47694f[_0xeb18('0x50')]='https://www.zohoapis.'+_0x49c2b8+_0xeb18('0x53')+_0x5be4a7+'))';return getZohoUser(_0x47694f,_0xeb18('0x54'))[_0xeb18('0x29')](function(_0x5063e2){if(_0x5063e2)return _0x5063e2;if(_0x1f6f05['moduleCreate']!=_0xeb18('0x55')){return createEndUser(_0x3ec977,_0x49c2b8,_0x50f0b3,_0x5be4a7,_0x25fa32,_0x1f6f05);}else{return{};}});break;}}function getCall(_0x56b92d,_0x4c31d3,_0x3a53cf,_0x20167f,_0x50448e,_0x2ab532,_0x74c06f,_0x495300){logger[_0xeb18('0x2f')](_0xeb18('0x56'));var _0x1bf320={};_0x1bf320['Owner']={'name':!_['isNil'](_0x20167f['role'][_0xeb18('0x16')])&&!_['isNil'](_0x20167f[_0xeb18('0x39')][_0xeb18('0x16')])&&_0x20167f[_0xeb18('0x39')][_0xeb18('0x16')]===_0xeb18('0x57')?_0x20167f[_0xeb18('0x46')][_0xeb18('0x16')]:!_['isNil'](_0x20167f[_0xeb18('0x47')])?_0x20167f[_0xeb18('0x47')]+'\x20'+_0x20167f[_0xeb18('0x48')]:_0x20167f['last_name'],'id':_0x20167f['id']};_0x1bf320[_0xeb18('0x58')]=intUtil[_0xeb18('0x59')](_0x2ab532[_0xeb18('0x5a')],_0x74c06f,'\x20');_0x1bf320[_0xeb18('0x5b')]=intUtil['getString'](_0x2ab532[_0xeb18('0x5c')],_0x74c06f,'\x0a');if(_0x50448e[_0xeb18('0x5d')]==='Contacts'){_0x1bf320[_0xeb18('0x5e')]={'name':!_['isNil'](_0x50448e['Full_Name'])?_0x50448e['Full_Name']:!_[_0xeb18('0x1a')](_0x50448e['First_Name'])?_0x50448e[_0xeb18('0x5f')]+'\x20'+_0x50448e[_0xeb18('0x60')]:_0x50448e[_0xeb18('0x60')],'id':_0x50448e['id']};}if(_0x50448e[_0xeb18('0x5d')]===_0xeb18('0x54')){_0x1bf320[_0xeb18('0x61')]={'name':!_['isNil'](_0x50448e['Full_Name'])?_0x50448e[_0xeb18('0x62')]:!_[_0xeb18('0x1a')](_0x50448e[_0xeb18('0x5f')])?_0x50448e['First_Name']+'\x20'+_0x50448e[_0xeb18('0x60')]:_0x50448e[_0xeb18('0x60')],'id':_0x50448e['id']};_0x1bf320[_0xeb18('0x63')]=_[_0xeb18('0x44')](_0x50448e['enduserType']);}if(_0x74c06f[_0xeb18('0x64')]){_0x1bf320['Call_Duration']=moment[_0xeb18('0x65')](parseInt(_0x74c06f[_0xeb18('0x64')])*0x3e8)[_0xeb18('0x32')](_0xeb18('0x66'));}else if(_0x74c06f[_0xeb18('0x67')]&&_0x74c06f[_0xeb18('0x68')]){_0x1bf320[_0xeb18('0x69')]=moment[_0xeb18('0x65')](moment(_0x74c06f['endtime'],_0xeb18('0x6a'))[_0xeb18('0x6b')](moment(_0x74c06f[_0xeb18('0x6c')],'YYYY-MM-DDTHH:mm:ss')))[_0xeb18('0x32')]('mm:ss');}switch(_0x74c06f[_0xeb18('0x6d')]){case _0xeb18('0x6e'):_0x1bf320[_0xeb18('0x6f')]=_0xeb18('0x70');break;case _0xeb18('0x71'):case _0xeb18('0x72'):_0x1bf320[_0xeb18('0x6f')]=_0xeb18('0x73');break;case'rejected':_0x1bf320[_0xeb18('0x6f')]=_0xeb18('0x74');break;case _0xeb18('0x75'):_0x1bf320[_0xeb18('0x6f')]=_0xeb18('0x76');break;case _0xeb18('0x77'):_0x1bf320[_0xeb18('0x6f')]='Timeout';default:}_0x1bf320['Call_Start_Time']=(_0x495300===_0xeb18('0x78')?moment(_0x74c06f[_0xeb18('0x6c')])[_0xeb18('0x32')](_0xeb18('0x6a')):moment(_0x74c06f[_0xeb18('0x79')])[_0xeb18('0x32')](_0xeb18('0x6a')))||moment()[_0xeb18('0x32')](_0xeb18('0x6a'));_0x1bf320[_0xeb18('0x7a')]=_0x495300||_0xeb18('0x7b');_0x1bf320=_[_0xeb18('0x7c')](_0x1bf320,getCustomFields(_0x2ab532['Fields'],_0x74c06f));return request({'method':_0xeb18('0x23'),'uri':_0xeb18('0x42')+_0x4c31d3+_0xeb18('0x7d'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x56b92d},'body':{'data':[_0x1bf320]},'json':!![]})[_0xeb18('0x29')](function(_0xbfdfeb){if(_0xbfdfeb&&_0xbfdfeb[_0xeb18('0x41')][0x0][_0xeb18('0x49')]===_0xeb18('0x4a')){logger[_0xeb18('0x2f')](_0xeb18('0x7e'));return{'id':_0xbfdfeb['data'][0x0]['details']['id']};}})[_0xeb18('0x2c')](function(_0x55cd0b){logger[_0xeb18('0x2f')]('err',_0x55cd0b[_0xeb18('0x2e')]);console[_0xeb18('0x4d')](_0xeb18('0x7f'),_0x55cd0b);});}exports[_0xeb18('0x80')]=function(_0x2b83d7,_0x4df232,_0x1dedf0,_0x46f09d,_0x46d08f,_0x3239c7){var _0x3b9147,_0x24029c,_0x25c346;_0x3239c7[_0xeb18('0x81')]=intUtil[_0xeb18('0x82')](_0x3239c7[_0xeb18('0x81')]);_0x3239c7[_0xeb18('0x83')]=intUtil['stripTrailingSlash'](_0x3239c7['serverUrl']);if(_0x46d08f&&_0x46d08f[_0xeb18('0x84')]){logger[_0xeb18('0x2f')](_0xeb18('0x85'),_0xeb18('0x86'));_0x4df232[_0xeb18('0x87')]=_0x3239c7[_0xeb18('0x83')]+_0xeb18('0x88')+_0x4df232[_0xeb18('0x89')]+'/downloads?type=uniqueid&token='+md5(_0x4df232[_0xeb18('0x89')]);}else{_0x4df232[_0xeb18('0x87')]='';}var _0x3af321=_0x3239c7[_0xeb18('0x81')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x3239c7)[_0xeb18('0x29')](function(_0x2783a){_0x25c346=_0x2783a;return getUser(_0x25c346,_0x3af321,_0x3239c7,_0x46f09d['email']);})[_0xeb18('0x29')](function(_0x3a6b13){_0x3b9147=_0x3a6b13;logger['info'](_0xeb18('0x8a'),_0x3b9147['id']);return getEndUser(_0x25c346,_0x3af321,_0x3239c7,_0x4df232['calleridname'],_0x4df232[_0xeb18('0x8b')],_0x3b9147,_0x1dedf0);})['then'](function(_0x1086a2){_0x24029c=_0x1086a2;return getCall(_0x25c346,_0x3af321,_0x3239c7,_0x3b9147,_0x24029c,_0x1dedf0,_0x4df232,_0xeb18('0x7b'));})[_0xeb18('0x29')](function(_0x5dc01b){if(_0x5dc01b){logger[_0xeb18('0x2f')](_0xeb18('0x8c'),_0x5dc01b['id']);logger[_0xeb18('0x2f')]('[QUEUE]',_0xeb18('0x8d'));emit(util[_0xeb18('0x32')](_0xeb18('0x8e'),_0x46f09d['name']),'trigger:browser:url',{'uri':_0xeb18('0x8f')+_0x3239c7[_0xeb18('0x81')]+_0xeb18('0x90')+_0x5dc01b['id']});}})['catch'](function(_0x5cd518){logger['error']('[QUEUE]',JSON[_0xeb18('0x3e')](_0x5cd518));});};exports[_0xeb18('0x78')]=function(_0x1b6a68,_0x9a9fc9,_0x76fa26,_0x5d49a8,_0x716817,_0x414d93,_0x34ab88){var _0x588d5,_0xe27c02,_0x1ec581;_0x414d93[_0xeb18('0x81')]=intUtil[_0xeb18('0x82')](_0x414d93[_0xeb18('0x81')]);_0x414d93[_0xeb18('0x83')]=intUtil['stripTrailingSlash'](_0x414d93[_0xeb18('0x83')]);if(_0x34ab88&&_0x34ab88[_0xeb18('0x91')]&&_0x34ab88[_0xeb18('0x91')]!==_0xeb18('0x92')){logger[_0xeb18('0x2f')](_0xeb18('0x93'),_0xeb18('0x86'));_0x9a9fc9[_0xeb18('0x87')]=_0x414d93[_0xeb18('0x83')]+_0xeb18('0x88')+_0x9a9fc9[_0xeb18('0x89')]+'/downloads?type=uniqueid&token='+md5(_0x9a9fc9['uniqueid']);}var _0x3d16d6=_0x414d93[_0xeb18('0x81')]==='zoho.eu'?'eu':_0xeb18('0x94');return getAccessToken(_0x414d93)[_0xeb18('0x29')](function(_0xa70fa0){_0x1ec581=_0xa70fa0;return getUser(_0x1ec581,_0x3d16d6,_0x414d93,_0x5d49a8['email']);})[_0xeb18('0x29')](function(_0x176f10){_0x588d5=_0x176f10;logger['info'](_0xeb18('0x8a'),_0x588d5['id']);return getEndUser(_0x1ec581,_0x3d16d6,_0x414d93,_0x9a9fc9[_0xeb18('0x95')],_0x9a9fc9[_0xeb18('0x96')],_0x588d5,_0x76fa26);})[_0xeb18('0x29')](function(_0x4756dd){_0xe27c02=_0x4756dd;return getCall(_0x1ec581,_0x3d16d6,_0x414d93,_0x588d5,_0xe27c02,_0x76fa26,_0x9a9fc9,_0xeb18('0x97'));})[_0xeb18('0x29')](function(_0x3c1583){if(_0x3c1583){logger[_0xeb18('0x2f')](_0xeb18('0x8c'),_0x3c1583['id']);logger[_0xeb18('0x2f')](_0xeb18('0x93'),_0xeb18('0x8d'));emit(util[_0xeb18('0x32')](_0xeb18('0x8e'),_0x5d49a8[_0xeb18('0x16')]),_0xeb18('0x98'),{'uri':_0xeb18('0x8f')+_0x414d93[_0xeb18('0x81')]+_0xeb18('0x90')+_0x3c1583['id']});}})[_0xeb18('0x2c')](function(_0xab19ad){logger[_0xeb18('0x40')]('[OUTBOUND]',JSON[_0xeb18('0x3e')](_0xab19ad));});};exports[_0xeb18('0x99')]=function(_0x3a24bc,_0x3aff70,_0x4c0c70,_0x574e80,_0x9b1758,_0x2c22e9){var _0x2b4ffb,_0x230cd6,_0x182cf1;_0x2c22e9['host']=intUtil[_0xeb18('0x82')](_0x2c22e9[_0xeb18('0x81')]);_0x2c22e9[_0xeb18('0x83')]=intUtil[_0xeb18('0x82')](_0x2c22e9['serverUrl']);if(_0x9b1758&&_0x9b1758[_0xeb18('0x84')]){logger[_0xeb18('0x2f')]('['+_0x3aff70['lastevent']['toUpperCase']()+']',_0xeb18('0x86'));_0x3aff70[_0xeb18('0x87')]=_0x2c22e9[_0xeb18('0x83')]+_0xeb18('0x88')+_0x3aff70[_0xeb18('0x89')]+_0xeb18('0x9a')+md5(_0x3aff70[_0xeb18('0x89')]);}else{_0x3aff70[_0xeb18('0x87')]='';}var _0x527b65=_0x2c22e9[_0xeb18('0x81')]===_0xeb18('0x9b')?'eu':_0xeb18('0x94');return getAccessToken(_0x2c22e9)['then'](function(_0x4bed08){_0x182cf1=_0x4bed08;return getUser(_0x182cf1,_0x527b65,_0x2c22e9);})['then'](function(_0x110a09){_0x2b4ffb=_0x110a09;logger['info'](_0xeb18('0x8a'),_0x2b4ffb['id']);return getEndUser(_0x182cf1,_0x527b65,_0x2c22e9,_0x3aff70[_0xeb18('0x9c')],_0x3aff70[_0xeb18('0x8b')],_0x2b4ffb,_0x4c0c70);})[_0xeb18('0x29')](function(_0x2968ec){_0x230cd6=_0x2968ec;return getCall(_0x182cf1,_0x527b65,_0x2c22e9,_0x2b4ffb,_0x230cd6,_0x4c0c70,_0x3aff70,'Inbound');})['then'](function(_0x4d7451){if(_0x4d7451){logger[_0xeb18('0x2f')](_0xeb18('0x8c'),_0x4d7451['id']);}})[_0xeb18('0x2c')](function(_0xf86256){logger['error']('['+_0x3aff70[_0xeb18('0x6d')][_0xeb18('0x9d')]()+']',JSON[_0xeb18('0x3e')](_0xf86256));});}; \ No newline at end of file +var _0x07c2=['Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','POST','role','first_name','last_name','SUCCESS','enduserType','moduleCreate','Error:\x20','log','moduleSearch','uri','Contacts','https://www.zohoapis.','Leads','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','startCase','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','complete','connect','Answered','Rejected','Abandoned','timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','code','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','unmanaged','toUpperCase','lodash','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','debug','stringify','length','forEach','string','type','content','toString','variable','variableName','idField','customVariable','Variable','toLowerCase','name','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','catch','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!'];(function(_0x28aa4c,_0x2e675d){var _0x203f0e=function(_0x4ee0e2){while(--_0x4ee0e2){_0x28aa4c['push'](_0x28aa4c['shift']());}};_0x203f0e(++_0x2e675d);}(_0x07c2,0xf1));var _0x207c=function(_0x538375,_0x365e8d){_0x538375=_0x538375-0x0;var _0x1c3531=_0x07c2[_0x538375];return _0x1c3531;};'use strict';var _=require(_0x207c('0x0'));var rp=require('request-promise');var md5=require(_0x207c('0x1'));var util=require('util');var intUtil=require(_0x207c('0x2'));var moment=require(_0x207c('0x3'));var Redis=require(_0x207c('0x4'));var BPromise=require(_0x207c('0x5'));var config=require(_0x207c('0x6'));var logger=require(_0x207c('0x7'))('zoho');config[_0x207c('0x8')]=_[_0x207c('0x9')](config[_0x207c('0x8')],{'host':_0x207c('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x207c('0x8')]));function emit(_0x59c410,_0x5359a4,_0x180812){io['to'](_0x59c410)[_0x207c('0xb')](_0x5359a4,_0x180812);}function request(_0x1ae9d2){logger[_0x207c('0xc')]('[HTTP]',JSON[_0x207c('0xd')](_0x1ae9d2));return rp(_0x1ae9d2);}function getCustomFields(_0x1403cf,_0x2b8a51){var _0x2807be={};if(_0x1403cf[_0x207c('0xe')]>0x0){_[_0x207c('0xf')](_0x1403cf,function(_0x3ba361){if(_['includes']([_0x207c('0x10'),'picklist'],_0x3ba361[_0x207c('0x11')])&&_0x3ba361['idField']){_0x2807be[_0x3ba361['idField']]=_0x3ba361[_0x207c('0x12')][_0x207c('0x13')]();}else if(_0x3ba361['type']===_0x207c('0x14')&&_0x3ba361[_0x207c('0x15')]&&_0x3ba361[_0x207c('0x16')]&&_0x2b8a51[_0x3ba361[_0x207c('0x15')]]){_0x2807be[_0x3ba361[_0x207c('0x16')]]=_0x2b8a51[_0x3ba361['variableName']][_0x207c('0x13')]();}else if(_0x3ba361['type']===_0x207c('0x17')&&_0x3ba361[_0x207c('0x18')]&&_0x3ba361['Variable']['name']&&_0x3ba361[_0x207c('0x16')]&&_0x2b8a51[_0x3ba361[_0x207c('0x18')]['name'][_0x207c('0x19')]()]){_0x2807be[_0x3ba361[_0x207c('0x16')]]=_0x2b8a51[_0x3ba361[_0x207c('0x18')][_0x207c('0x1a')][_0x207c('0x19')]()][_0x207c('0x13')]();}});}return _0x2807be;}function getName(_0x2bf33a){if(_0x2bf33a['indexOf']('\x20')>0x0){var _0x996988=_0x2bf33a[_0x207c('0x1b')](/ (.+)/);if(_0x996988[0x1]){return _0x996988;}}return[_0x2bf33a,_0x2bf33a];}var accountsTokens={};function getAccessToken(_0x19ce80){return new Promise(function(_0xe80172,_0x33ad7b){if(!_[_0x207c('0x1c')](accountsTokens[_0x19ce80['id']])&&!_[_0x207c('0x1c')](accountsTokens[_0x19ce80['id']][_0x207c('0x1d')])){if(moment()[_0x207c('0x1e')](accountsTokens[_0x19ce80['id']][_0x207c('0x1f')])){_0xe80172(accountsTokens[_0x19ce80['id']][_0x207c('0x1d')]);}}var _0x32ebb1;switch(_0x19ce80['zone']){case'US':_0x32ebb1='https://accounts.zoho.com';break;case'AU':_0x32ebb1=_0x207c('0x20');break;case'EU':_0x32ebb1='https://accounts.zoho.eu';break;case'IN':_0x32ebb1=_0x207c('0x21');break;case'CN':_0x32ebb1=_0x207c('0x22');break;default:_0x32ebb1=_0x207c('0x23');break;}var _0xdf1a29={'method':'POST','uri':_0x32ebb1+_0x207c('0x24'),'qs':{'refresh_token':_0x19ce80[_0x207c('0x25')],'client_id':_0x19ce80[_0x207c('0x26')],'client_secret':_0x19ce80[_0x207c('0x27')],'grant_type':_0x207c('0x28')},'json':!![]};return rp(_0xdf1a29)[_0x207c('0x29')](function(_0x5708d0){accountsTokens[_0x19ce80['id']]={'access_token':_0x5708d0[_0x207c('0x1d')],'expires_in':moment()[_0x207c('0x2a')](_0x5708d0['expires_in'],'seconds')};_0xe80172(_0x5708d0[_0x207c('0x1d')]);})[_0x207c('0x2b')](function(_0xbbd539){logger['error'](_0x207c('0x2c'),_0xbbd539['stack']);_0x33ad7b(_0xbbd539);});});}function getUser(_0x466de8,_0xeafa01,_0x3aa0fe,_0x527a6c){logger[_0x207c('0x2d')](_0x207c('0x2e'));return request({'method':_0x207c('0x2f'),'uri':util[_0x207c('0x30')]('https://www.zohoapis.%s/crm/v2/users',_0xeafa01),'qs':{'type':_0x207c('0x31')},'headers':{'Authorization':_0x207c('0x32')+_0x466de8},'json':!![]})[_0x207c('0x29')](function(_0x16fe20){if(_0x16fe20[_0x207c('0x33')]){var _0x1bde0a=-0x1;if(_['isArrayLikeObject'](_0x16fe20[_0x207c('0x33')])){if(!_[_0x207c('0x1c')](_0x527a6c)){_0x1bde0a=_[_0x207c('0x34')](_0x16fe20[_0x207c('0x33')],function(_0x2229b9){return _0x2229b9[_0x207c('0x35')]===_0x527a6c;});}if(_0x1bde0a>=0x0){logger[_0x207c('0x2d')](_0x207c('0x36'));}else{logger[_0x207c('0x2d')](_0x207c('0x37'));_0x1bde0a=_[_0x207c('0x34')](_0x16fe20[_0x207c('0x33')],function(_0x5af2dc){return _0x5af2dc[_0x207c('0x38')][_0x207c('0x1a')]===_0x207c('0x39');});}return _0x16fe20[_0x207c('0x33')][_0x1bde0a];}else{if(_0x16fe20[_0x207c('0x3a')][_0x207c('0x38')]['name']===_0x207c('0x39')){logger[_0x207c('0x2d')](_0x207c('0x37'));user=_0x16fe20[_0x207c('0x3a')];return user;}else{logger[_0x207c('0x3b')](_0x207c('0x3c'),JSON[_0x207c('0xd')](_0x16fe20));throw new Error(_0x207c('0x3d')+JSON['stringify'](_0x16fe20));}}}else{logger[_0x207c('0x3b')](_0x207c('0x3c'),JSON[_0x207c('0xd')](_0x16fe20));throw new Error(_0x207c('0x3d')+JSON['stringify'](_0x16fe20));}})[_0x207c('0x2b')](function(_0x52c682){console['error'](_0x52c682);});}function getZohoUser(_0x4244b6,_0x5cfa6d){return new BPromise(function(_0x55d6b7,_0x511e1b){request(_0x4244b6)[_0x207c('0x29')](function(_0x33adde){var _0xcfdaf6=null;if(_0x33adde){_0xcfdaf6=_0x33adde[_0x207c('0x3e')][0x0];_0xcfdaf6['enduserType']=_0x5cfa6d;}_0x55d6b7(_0xcfdaf6);})[_0x207c('0x2b')](function(_0x224aae){_0x511e1b(_0x224aae);});});}function createEndUser(_0x211c59,_0x129171,_0x4391b4,_0x18d567,_0x45217d,_0x15c9a1){var _0x4391b4=getName(_0x4391b4);return request({'method':_0x207c('0x3f'),'uri':'https://www.zohoapis.'+_0x129171+'/crm/v2/'+_['startCase'](_0x15c9a1['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4391b4[0x1],'First_Name':_0x4391b4[0x0],'Phone':_0x18d567,'Owner':{'name':!_[_0x207c('0x1c')](_0x45217d[_0x207c('0x40')][_0x207c('0x1a')])?_0x45217d[_0x207c('0x40')]['name']:!_[_0x207c('0x1c')](_0x45217d[_0x207c('0x41')])?_0x45217d[_0x207c('0x41')]+'\x20'+_0x45217d['last_name']:_0x45217d[_0x207c('0x42')],'id':_0x45217d['id']}}]},'headers':{'Authorization':_0x207c('0x32')+_0x211c59},'json':!![]})['then'](function(_0x20827a){if(_0x20827a&&_0x20827a[_0x207c('0x3e')][0x0]['code']===_0x207c('0x43')){var _0x3c65b7=_0x20827a[_0x207c('0x3e')][0x0]['details'];_0x3c65b7[_0x207c('0x44')]=_['startCase'](_0x15c9a1[_0x207c('0x45')])+'s';return _0x3c65b7;}logger['error'](_0x207c('0x3c'),JSON[_0x207c('0xd')](data));throw new Error(_0x207c('0x46')+JSON['stringify'](data));})[_0x207c('0x2b')](function(_0x20e8fa){console[_0x207c('0x47')]('CREATE\x20ERROR',_0x20e8fa);});}function getEndUser(_0x55e6a8,_0x2c499c,_0x522c70,_0x30714f,_0x215a42,_0x3d4a59,_0x3ba340){var _0x442f29={'method':'GET','uri':'','headers':{'Authorization':_0x207c('0x32')+_0x55e6a8},'json':!![]};switch(_0x3ba340[_0x207c('0x48')]){case'contact_lead':_0x442f29[_0x207c('0x49')]='https://www.zohoapis.'+_0x2c499c+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x215a42+'))';return getZohoUser(_0x442f29,_0x207c('0x4a'))[_0x207c('0x29')](function(_0xf4b1fc){if(_0xf4b1fc)return _0xf4b1fc;_0x442f29[_0x207c('0x49')]=_0x207c('0x4b')+_0x2c499c+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x215a42+'))';return getZohoUser(_0x442f29,_0x207c('0x4c'))['then'](function(_0x2f847e){if(_0x2f847e)return _0x2f847e;if(_0x3ba340['moduleCreate']!=_0x207c('0x4d')){return createEndUser(_0x55e6a8,_0x2c499c,_0x30714f,_0x215a42,_0x3d4a59,_0x3ba340);}else{return{};}});});break;case _0x207c('0x4e'):_0x442f29[_0x207c('0x49')]='https://www.zohoapis.'+_0x2c499c+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x215a42+'))';return getZohoUser(_0x442f29,_0x207c('0x4a'))[_0x207c('0x29')](function(_0x31e3e5){if(_0x31e3e5)return _0x31e3e5;if(_0x3ba340[_0x207c('0x45')]!=_0x207c('0x4d')){return createEndUser(_0x55e6a8,_0x2c499c,_0x30714f,_0x215a42,_0x3d4a59,_0x3ba340);}else{return{};}});break;case _0x207c('0x4f'):_0x442f29[_0x207c('0x49')]=_0x207c('0x4b')+_0x2c499c+_0x207c('0x50')+_0x215a42+'))';return getZohoUser(_0x442f29,_0x207c('0x4c'))[_0x207c('0x29')](function(_0x1979ec){if(_0x1979ec)return _0x1979ec;if(_0x3ba340[_0x207c('0x45')]!=_0x207c('0x4d')){return createEndUser(_0x55e6a8,_0x2c499c,_0x30714f,_0x215a42,_0x3d4a59,_0x3ba340);}else{return{};}});break;}}function getCall(_0x462b43,_0x10e335,_0x1f46f1,_0x4909dd,_0x11edcc,_0x47b550,_0x29ee4c,_0x327bdd){logger[_0x207c('0x2d')](_0x207c('0x51'));var _0x2274e2={};_0x2274e2[_0x207c('0x52')]={'name':!_[_0x207c('0x1c')](_0x4909dd[_0x207c('0x40')][_0x207c('0x1a')])&&!_[_0x207c('0x1c')](_0x4909dd[_0x207c('0x38')]['name'])&&_0x4909dd['profile'][_0x207c('0x1a')]==='administrator'?_0x4909dd[_0x207c('0x40')][_0x207c('0x1a')]:!_[_0x207c('0x1c')](_0x4909dd[_0x207c('0x41')])?_0x4909dd[_0x207c('0x41')]+'\x20'+_0x4909dd[_0x207c('0x42')]:_0x4909dd[_0x207c('0x42')],'id':_0x4909dd['id']};_0x2274e2[_0x207c('0x53')]=intUtil[_0x207c('0x54')](_0x47b550[_0x207c('0x55')],_0x29ee4c,'\x20');_0x2274e2[_0x207c('0x56')]=intUtil[_0x207c('0x54')](_0x47b550[_0x207c('0x57')],_0x29ee4c,'\x0a');if(_0x11edcc[_0x207c('0x44')]===_0x207c('0x4a')){_0x2274e2[_0x207c('0x58')]={'name':!_[_0x207c('0x1c')](_0x11edcc[_0x207c('0x59')])?_0x11edcc['Full_Name']:!_[_0x207c('0x1c')](_0x11edcc[_0x207c('0x5a')])?_0x11edcc[_0x207c('0x5a')]+'\x20'+_0x11edcc[_0x207c('0x5b')]:_0x11edcc[_0x207c('0x5b')],'id':_0x11edcc['id']};}if(_0x11edcc['enduserType']===_0x207c('0x4c')){_0x2274e2[_0x207c('0x5c')]={'name':!_[_0x207c('0x1c')](_0x11edcc['Full_Name'])?_0x11edcc[_0x207c('0x59')]:!_[_0x207c('0x1c')](_0x11edcc[_0x207c('0x5a')])?_0x11edcc[_0x207c('0x5a')]+'\x20'+_0x11edcc['Last_Name']:_0x11edcc['Last_Name'],'id':_0x11edcc['id']};_0x2274e2['$se_module']=_[_0x207c('0x5d')](_0x11edcc['enduserType']);}if(_0x29ee4c[_0x207c('0x5e')]){_0x2274e2[_0x207c('0x5f')]=moment[_0x207c('0x60')](parseInt(_0x29ee4c[_0x207c('0x5e')])*0x3e8)[_0x207c('0x30')](_0x207c('0x61'));}else if(_0x29ee4c[_0x207c('0x62')]&&_0x29ee4c['endtime']){_0x2274e2['Call_Duration']=moment[_0x207c('0x60')](moment(_0x29ee4c[_0x207c('0x63')],_0x207c('0x64'))[_0x207c('0x65')](moment(_0x29ee4c[_0x207c('0x66')],'YYYY-MM-DDTHH:mm:ss')))[_0x207c('0x30')](_0x207c('0x61'));}switch(_0x29ee4c[_0x207c('0x67')]){case'called':_0x2274e2[_0x207c('0x68')]='Called';break;case _0x207c('0x69'):case _0x207c('0x6a'):_0x2274e2['Call_Result']=_0x207c('0x6b');break;case'rejected':_0x2274e2['Call_Result']=_0x207c('0x6c');break;case'abandoned':_0x2274e2[_0x207c('0x68')]=_0x207c('0x6d');break;case _0x207c('0x6e'):_0x2274e2[_0x207c('0x68')]='Timeout';default:}_0x2274e2[_0x207c('0x6f')]=(_0x327bdd===_0x207c('0x70')?moment(_0x29ee4c[_0x207c('0x66')])['format'](_0x207c('0x64')):moment(_0x29ee4c['agentcalledAt'])[_0x207c('0x30')](_0x207c('0x64')))||moment()[_0x207c('0x30')](_0x207c('0x64'));_0x2274e2[_0x207c('0x71')]=_0x327bdd||_0x207c('0x72');_0x2274e2=_[_0x207c('0x73')](_0x2274e2,getCustomFields(_0x47b550[_0x207c('0x74')],_0x29ee4c));return request({'method':_0x207c('0x3f'),'uri':'https://www.zohoapis.'+_0x10e335+'/crm/v2/Calls','headers':{'Authorization':_0x207c('0x32')+_0x462b43},'body':{'data':[_0x2274e2]},'json':!![]})['then'](function(_0x54fd50){if(_0x54fd50&&_0x54fd50[_0x207c('0x3e')][0x0][_0x207c('0x75')]===_0x207c('0x43')){logger[_0x207c('0x2d')](_0x207c('0x76'));return{'id':_0x54fd50[_0x207c('0x3e')][0x0]['details']['id']};}})['catch'](function(_0x33223b){logger[_0x207c('0x2d')]('err',_0x33223b['stack']);console[_0x207c('0x47')](_0x207c('0x77'),_0x33223b);});}exports['queue']=function(_0xcdaf4b,_0x105e47,_0x226933,_0x4d36c1,_0x326b2c,_0x27df65){var _0xf4bcb6,_0x3070df,_0x2a1b6d;_0x27df65[_0x207c('0x78')]=intUtil[_0x207c('0x79')](_0x27df65[_0x207c('0x78')]);_0x27df65[_0x207c('0x7a')]=intUtil[_0x207c('0x79')](_0x27df65[_0x207c('0x7a')]);if(_0x326b2c&&_0x326b2c[_0x207c('0x7b')]){logger[_0x207c('0x2d')](_0x207c('0x7c'),'Recording\x20is\x20enabled!');_0x105e47[_0x207c('0x7d')]=_0x27df65[_0x207c('0x7a')]+_0x207c('0x7e')+_0x105e47[_0x207c('0x7f')]+_0x207c('0x80')+md5(_0x105e47[_0x207c('0x7f')]);}else{_0x105e47[_0x207c('0x7d')]='';}var _0x566b17=_0x27df65[_0x207c('0x78')]===_0x207c('0x81')?'eu':_0x207c('0x82');return getAccessToken(_0x27df65)[_0x207c('0x29')](function(_0x22a0da){_0x2a1b6d=_0x22a0da;return getUser(_0x2a1b6d,_0x566b17,_0x27df65,_0x4d36c1['email']);})[_0x207c('0x29')](function(_0xfc9537){_0xf4bcb6=_0xfc9537;logger[_0x207c('0x2d')](_0x207c('0x83'),_0xf4bcb6['id']);return getEndUser(_0x2a1b6d,_0x566b17,_0x27df65,_0x105e47[_0x207c('0x84')],_0x105e47[_0x207c('0x85')],_0xf4bcb6,_0x226933);})[_0x207c('0x29')](function(_0x494048){_0x3070df=_0x494048;return getCall(_0x2a1b6d,_0x566b17,_0x27df65,_0xf4bcb6,_0x3070df,_0x226933,_0x105e47,'Inbound');})[_0x207c('0x29')](function(_0x33b219){if(_0x33b219){logger['info'](_0x207c('0x86'),_0x33b219['id']);logger['info'](_0x207c('0x7c'),_0x207c('0x87'));emit(util[_0x207c('0x30')](_0x207c('0x88'),_0x4d36c1[_0x207c('0x1a')]),_0x207c('0x89'),{'uri':_0x207c('0x8a')+_0x27df65[_0x207c('0x78')]+_0x207c('0x8b')+_0x33b219['id']});}})[_0x207c('0x2b')](function(_0x45dd79){logger[_0x207c('0x3b')](_0x207c('0x7c'),JSON[_0x207c('0xd')](_0x45dd79));});};exports[_0x207c('0x70')]=function(_0x28ebaf,_0x43092d,_0x44402b,_0x4aeca7,_0x5efad5,_0x21834d,_0x3009f5){var _0x373709,_0x115e18,_0x25e9ed;_0x21834d[_0x207c('0x78')]=intUtil[_0x207c('0x79')](_0x21834d['host']);_0x21834d['serverUrl']=intUtil[_0x207c('0x79')](_0x21834d['serverUrl']);if(_0x3009f5&&_0x3009f5['recordingFormat']&&_0x3009f5['recordingFormat']!==_0x207c('0x8c')){logger['info']('[OUTBOUND]',_0x207c('0x8d'));_0x43092d[_0x207c('0x7d')]=_0x21834d['serverUrl']+'/api/voice/recordings/'+_0x43092d[_0x207c('0x7f')]+_0x207c('0x80')+md5(_0x43092d[_0x207c('0x7f')]);}var _0x2ffabc=_0x21834d[_0x207c('0x78')]==='zoho.eu'?'eu':_0x207c('0x82');return getAccessToken(_0x21834d)['then'](function(_0x5992b8){_0x25e9ed=_0x5992b8;return getUser(_0x25e9ed,_0x2ffabc,_0x21834d,_0x4aeca7[_0x207c('0x35')]);})['then'](function(_0x515c43){_0x373709=_0x515c43;logger['info'](_0x207c('0x83'),_0x373709['id']);return getEndUser(_0x25e9ed,_0x2ffabc,_0x21834d,_0x43092d[_0x207c('0x8e')],_0x43092d[_0x207c('0x8f')],_0x373709,_0x44402b);})[_0x207c('0x29')](function(_0x906ba7){_0x115e18=_0x906ba7;return getCall(_0x25e9ed,_0x2ffabc,_0x21834d,_0x373709,_0x115e18,_0x44402b,_0x43092d,_0x207c('0x90'));})[_0x207c('0x29')](function(_0x19c98f){if(_0x19c98f){logger[_0x207c('0x2d')](_0x207c('0x86'),_0x19c98f['id']);logger[_0x207c('0x2d')](_0x207c('0x91'),_0x207c('0x87'));emit(util[_0x207c('0x30')]('user:%s',_0x4aeca7[_0x207c('0x1a')]),_0x207c('0x89'),{'uri':'https://crm.'+_0x21834d[_0x207c('0x78')]+_0x207c('0x8b')+_0x19c98f['id']});}})[_0x207c('0x2b')](function(_0x5688f1){logger[_0x207c('0x3b')](_0x207c('0x91'),JSON['stringify'](_0x5688f1));});};exports[_0x207c('0x92')]=function(_0x2e5a74,_0x373b11,_0x3cdc3c,_0xe2d84e,_0x395823,_0x2768ac){var _0x454bee,_0x24a199,_0x2a005d;_0x2768ac[_0x207c('0x78')]=intUtil[_0x207c('0x79')](_0x2768ac[_0x207c('0x78')]);_0x2768ac[_0x207c('0x7a')]=intUtil['stripTrailingSlash'](_0x2768ac[_0x207c('0x7a')]);if(_0x395823&&_0x395823['monitor_format']){logger[_0x207c('0x2d')]('['+_0x373b11[_0x207c('0x67')][_0x207c('0x93')]()+']',_0x207c('0x8d'));_0x373b11['recordingURL']=_0x2768ac[_0x207c('0x7a')]+'/api/voice/recordings/'+_0x373b11[_0x207c('0x7f')]+_0x207c('0x80')+md5(_0x373b11['uniqueid']);}else{_0x373b11[_0x207c('0x7d')]='';}var _0x5f03f6=_0x2768ac['host']===_0x207c('0x81')?'eu':'com';return getAccessToken(_0x2768ac)['then'](function(_0x184d30){_0x2a005d=_0x184d30;return getUser(_0x2a005d,_0x5f03f6,_0x2768ac);})['then'](function(_0x55b544){_0x454bee=_0x55b544;logger[_0x207c('0x2d')](_0x207c('0x83'),_0x454bee['id']);return getEndUser(_0x2a005d,_0x5f03f6,_0x2768ac,_0x373b11[_0x207c('0x84')],_0x373b11[_0x207c('0x85')],_0x454bee,_0x3cdc3c);})[_0x207c('0x29')](function(_0x19a016){_0x24a199=_0x19a016;return getCall(_0x2a005d,_0x5f03f6,_0x2768ac,_0x454bee,_0x24a199,_0x3cdc3c,_0x373b11,_0x207c('0x72'));})['then'](function(_0x1e7461){if(_0x1e7461){logger[_0x207c('0x2d')]('The\x20Call\x20ID\x20is:',_0x1e7461['id']);}})[_0x207c('0x2b')](function(_0x578ea0){logger[_0x207c('0x3b')]('['+_0x373b11[_0x207c('0x67')][_0x207c('0x93')]()+']',JSON[_0x207c('0xd')](_0x578ea0));});}; \ 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 5fc1aa2..66d6b66 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 _0x424d=['%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','../../../../config/logger','data2','data3','error'];(function(_0x2112b7,_0x2dd0a2){var _0x100f93=function(_0x359f66){while(--_0x359f66){_0x2112b7['push'](_0x2112b7['shift']());}};_0x100f93(++_0x2dd0a2);}(_0x424d,0xb7));var _0xd424=function(_0x1c1259,_0x2db8ee){_0x1c1259=_0x1c1259-0x0;var _0x1dab5c=_0x424d[_0x1c1259];return _0x1dab5c;};'use strict';var util=require(_0xd424('0x0'));var sh=require(_0xd424('0x1'));var Mustache=require('mustache');var logger=require(_0xd424('0x2'))('trigger');exports['exec']=function(_0xc5f8ca,_0x349612){var _0x3a252e=_0xc5f8ca[_0xd424('0x3')]?_0xc5f8ca[_0xd424('0x3')]:'Script';var _0x4070c8=_0xc5f8ca['data3']?Mustache['render'](_0xc5f8ca[_0xd424('0x4')],_0x349612):_0x349612;sh['exec'](_0x4070c8,function(_0x390ceb,_0x2cd9b4,_0x51ce6c){if(_0x390ceb!==0x0){logger[_0xd424('0x5')](util['format'](_0xd424('0x6'),_0x3a252e,_0x4070c8,_0x390ceb,_0x51ce6c));}else{logger[_0xd424('0x7')](util['format'](_0xd424('0x8'),_0x3a252e,_0x4070c8,_0x2cd9b4));}});}; \ No newline at end of file +var _0x3d29=['info','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x3d29,0x16d));var _0x93d2=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0x3d29[_0x4c0622];return _0x1799d8;};'use strict';var util=require(_0x93d2('0x0'));var sh=require(_0x93d2('0x1'));var Mustache=require(_0x93d2('0x2'));var logger=require(_0x93d2('0x3'))(_0x93d2('0x4'));exports[_0x93d2('0x5')]=function(_0x347b20,_0x431ff8){var _0x2b5e8f=_0x347b20[_0x93d2('0x6')]?_0x347b20['data2']:_0x93d2('0x7');var _0xd7955e=_0x347b20[_0x93d2('0x8')]?Mustache[_0x93d2('0x9')](_0x347b20[_0x93d2('0x8')],_0x431ff8):_0x431ff8;sh['exec'](_0xd7955e,function(_0x5681d2,_0x3a1184,_0x158d4a){if(_0x5681d2!==0x0){logger[_0x93d2('0xa')](util[_0x93d2('0xb')](_0x93d2('0xc'),_0x2b5e8f,_0xd7955e,_0x5681d2,_0x158d4a));}else{logger[_0x93d2('0xd')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x2b5e8f,_0xd7955e,_0x3a1184));}});}; \ 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 98e3153..86eb3b8 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 _0x57c9=['object','stringify','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','exec','toUpperCase','data2','data5','number','headers','data6','error','stack','data1','GET','DELETE','POST','PUT','parse','render','body','info','format','then','isNil',',\x20request\x20body:\x20'];(function(_0x4d8742,_0xd8d845){var _0x59701d=function(_0x5ab85b){while(--_0x5ab85b){_0x4d8742['push'](_0x4d8742['shift']());}};_0x59701d(++_0xd8d845);}(_0x57c9,0x6d));var _0x957c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x57c9[_0x1ac595];return _0x455fff;};'use strict';var rp=require(_0x957c('0x0'));var util=require(_0x957c('0x1'));var _=require(_0x957c('0x2'));var Mustache=require(_0x957c('0x3'));var logger=require(_0x957c('0x4'))('trigger');exports[_0x957c('0x5')]=function(_0x355d57,_0x1f5031){var _0x3166df,_0x3beb9d;var _0x542dc1={'method':_0x355d57['data1'][_0x957c('0x6')](),'uri':Mustache['render'](_0x355d57[_0x957c('0x7')],_0x1f5031),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x355d57[_0x957c('0x8')])===_0x957c('0x9')&&parseInt(_0x355d57[_0x957c('0x8')])>=0x1&&parseInt(_0x355d57[_0x957c('0x8')])<=0xa?parseInt(_0x355d57[_0x957c('0x8')])*0x3e8:0x5*0x3e8};try{_0x542dc1[_0x957c('0xa')]=_0x355d57['data6']?JSON['parse'](Mustache['render'](_0x355d57[_0x957c('0xb')],_0x1f5031)):{};}catch(_0x5decce){logger[_0x957c('0xc')](_0x5decce[_0x957c('0xd')]);}switch(_0x355d57[_0x957c('0xe')]['toUpperCase']()){case _0x957c('0xf'):case _0x957c('0x10'):_0x3166df=null;_0x542dc1['qs']=_0x1f5031;break;case _0x957c('0x11'):case _0x957c('0x12'):if(_0x355d57['data7']){try{_0x3166df=JSON[_0x957c('0x13')](Mustache[_0x957c('0x14')](_0x355d57['data7'],_0x1f5031));_0x542dc1['body']=_0x3166df;}catch(_0x11b9be){logger[_0x957c('0xc')](_0x11b9be['stack']);logger[_0x957c('0xc')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x3166df=_0x1f5031;_0x542dc1[_0x957c('0x15')]=_0x3166df;}break;}logger[_0x957c('0x16')](util[_0x957c('0x17')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x355d57[_0x957c('0xe')],_0x355d57[_0x957c('0x7')],JSON['stringify'](_0x542dc1)));rp(_0x542dc1)[_0x957c('0x18')](function(_0x2eb479){_0x3166df=!_[_0x957c('0x19')](_0x3166df)?_0x957c('0x1a')+_0x3166df:'';_0x3beb9d=typeof _0x2eb479['body']===_0x957c('0x1b')?JSON[_0x957c('0x1c')](_0x2eb479[_0x957c('0x15')]):_0x2eb479['body'];logger[_0x957c('0x16')](util[_0x957c('0x17')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x355d57[_0x957c('0xe')],_0x355d57[_0x957c('0x7')],_0x2eb479[_0x957c('0x1d')],_0x3beb9d));})[_0x957c('0x1e')](function(_0x2a39d6){logger['error'](util[_0x957c('0x17')](_0x957c('0x1f'),_0x355d57[_0x957c('0xe')],_0x355d57['data2'],_0x2a39d6[_0x957c('0x1d')],_0x2a39d6[_0x957c('0x20')],_0x2a39d6[_0x957c('0x21')]));});}; \ No newline at end of file +var _0x709f=['data5','headers','data6','error','stack','data1','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','stringify','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','message','request-promise','util','lodash','mustache','../../../../config/logger','toUpperCase','render','data2'];(function(_0x5a4659,_0x3a6650){var _0x3a6895=function(_0x341d22){while(--_0x341d22){_0x5a4659['push'](_0x5a4659['shift']());}};_0x3a6895(++_0x3a6650);}(_0x709f,0x154));var _0xf709=function(_0x342782,_0x4236e0){_0x342782=_0x342782-0x0;var _0xadb50c=_0x709f[_0x342782];return _0xadb50c;};'use strict';var rp=require(_0xf709('0x0'));var util=require(_0xf709('0x1'));var _=require(_0xf709('0x2'));var Mustache=require(_0xf709('0x3'));var logger=require(_0xf709('0x4'))('trigger');exports['exec']=function(_0x3ce399,_0x359da8){var _0x40b50a,_0xf47278;var _0x33ffe9={'method':_0x3ce399['data1'][_0xf709('0x5')](),'uri':Mustache[_0xf709('0x6')](_0x3ce399[_0xf709('0x7')],_0x359da8),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3ce399['data5'])==='number'&&parseInt(_0x3ce399[_0xf709('0x8')])>=0x1&&parseInt(_0x3ce399[_0xf709('0x8')])<=0xa?parseInt(_0x3ce399[_0xf709('0x8')])*0x3e8:0x5*0x3e8};try{_0x33ffe9[_0xf709('0x9')]=_0x3ce399[_0xf709('0xa')]?JSON['parse'](Mustache[_0xf709('0x6')](_0x3ce399[_0xf709('0xa')],_0x359da8)):{};}catch(_0x2e5c31){logger[_0xf709('0xb')](_0x2e5c31[_0xf709('0xc')]);}switch(_0x3ce399[_0xf709('0xd')][_0xf709('0x5')]()){case _0xf709('0xe'):case _0xf709('0xf'):_0x40b50a=null;_0x33ffe9['qs']=_0x359da8;break;case _0xf709('0x10'):case _0xf709('0x11'):if(_0x3ce399[_0xf709('0x12')]){try{_0x40b50a=JSON['parse'](Mustache['render'](_0x3ce399[_0xf709('0x12')],_0x359da8));_0x33ffe9[_0xf709('0x13')]=_0x40b50a;}catch(_0x16d25d){logger[_0xf709('0xb')](_0x16d25d['stack']);logger[_0xf709('0xb')](_0xf709('0x14'));}}else{_0x40b50a=_0x359da8;_0x33ffe9[_0xf709('0x13')]=_0x40b50a;}break;}logger['info'](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x3ce399['data1'],_0x3ce399['data2'],JSON[_0xf709('0x15')](_0x33ffe9)));rp(_0x33ffe9)['then'](function(_0x519811){_0x40b50a=!_['isNil'](_0x40b50a)?',\x20request\x20body:\x20'+_0x40b50a:'';_0xf47278=typeof _0x519811[_0xf709('0x13')]===_0xf709('0x16')?JSON[_0xf709('0x15')](_0x519811[_0xf709('0x13')]):_0x519811[_0xf709('0x13')];logger['info'](util[_0xf709('0x17')](_0xf709('0x18'),_0x3ce399['data1'],_0x3ce399['data2'],_0x519811[_0xf709('0x19')],_0xf47278));})[_0xf709('0x1a')](function(_0x2ab8b3){logger[_0xf709('0xb')](util[_0xf709('0x17')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x3ce399['data1'],_0x3ce399['data2'],_0x2ab8b3[_0xf709('0x19')],_0x2ab8b3[_0xf709('0x1b')],_0x2ab8b3[_0xf709('0x1c')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 06c7cb7..3d01431 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 _0xcf7c=['client','Request','request','then','debug','error','rpc','message','result','catch','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x565fed,_0xb85768){var _0x3e018f=function(_0x104d8e){while(--_0x104d8e){_0x565fed['push'](_0x565fed['shift']());}};_0x3e018f(++_0xb85768);}(_0xcf7c,0xea));var _0xccf7=function(_0x599aaf,_0x3d3622){_0x599aaf=_0x599aaf-0x0;var _0xd995f3=_0xcf7c[_0x599aaf];return _0xd995f3;};'use strict';var jayson=require(_0xccf7('0x0'));var BPromise=require(_0xccf7('0x1'));var logger=require(_0xccf7('0x2'))(_0xccf7('0x3'));var client=jayson[_0xccf7('0x4')]['http']({'port':0x2329});client[_0xccf7('0x5')]=function(_0x10943a,_0x399f93){return new BPromise(function(_0x35e2d8,_0x4084e0){return client[_0xccf7('0x6')](_0x10943a,_0x399f93)[_0xccf7('0x7')](function(_0x458cd8){logger[_0xccf7('0x8')]('rpc','routing',_0x10943a,_0x399f93,_0x458cd8);if(_0x458cd8['error']){logger[_0xccf7('0x9')](_0xccf7('0xa'),_0xccf7('0x3'),_0x10943a,_0x458cd8[_0xccf7('0x9')][_0xccf7('0xb')],_0x399f93);return _0x4084e0(_0x458cd8['error'][_0xccf7('0xb')]);}else{return _0x35e2d8(_0x458cd8[_0xccf7('0xc')]);}})[_0xccf7('0xd')](function(_0x35be27){logger[_0xccf7('0x9')](_0xccf7('0xa'),'routing',_0x10943a,_0x35be27,_0x399f93);return _0x4084e0(_0x35be27);});});};module['exports']=client; \ No newline at end of file +var _0xf61c=['jayson/promise','../../config/logger','routing','client','http','Request','request','then','debug','error','rpc','message','result','catch','exports'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xf61c,0xff));var _0xcf61=function(_0x36ae5e,_0x4a0535){_0x36ae5e=_0x36ae5e-0x0;var _0x422de4=_0xf61c[_0x36ae5e];return _0x422de4;};'use strict';var jayson=require(_0xcf61('0x0'));var BPromise=require('bluebird');var logger=require(_0xcf61('0x1'))(_0xcf61('0x2'));var client=jayson[_0xcf61('0x3')][_0xcf61('0x4')]({'port':0x2329});client[_0xcf61('0x5')]=function(_0x34ccf3,_0x391512){return new BPromise(function(_0x5f5cfb,_0x784fd7){return client[_0xcf61('0x6')](_0x34ccf3,_0x391512)[_0xcf61('0x7')](function(_0xfa5890){logger[_0xcf61('0x8')]('rpc','routing',_0x34ccf3,_0x391512,_0xfa5890);if(_0xfa5890[_0xcf61('0x9')]){logger['error'](_0xcf61('0xa'),_0xcf61('0x2'),_0x34ccf3,_0xfa5890['error'][_0xcf61('0xb')],_0x391512);return _0x784fd7(_0xfa5890[_0xcf61('0x9')]['message']);}else{return _0x5f5cfb(_0xfa5890[_0xcf61('0xc')]);}})[_0xcf61('0xd')](function(_0xb94803){logger[_0xcf61('0x9')](_0xcf61('0xa'),_0xcf61('0x2'),_0x34ccf3,_0xb94803,_0x391512);return _0x784fd7(_0xb94803);});});};module[_0xcf61('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 2481ff0..8848951 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 _0xc250=['then','getMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','email','resolve'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc250,0xf9));var _0x0c25=function(_0x100868,_0x15270b){_0x100868=_0x100868-0x0;var _0x5f26f3=_0xc250[_0x100868];return _0x5f26f3;};'use strict';var server=require(_0x0c25('0x0'));var Realtime=require(_0x0c25('0x1'));var EmailChannel=require(_0x0c25('0x2'));var mailAccount=require(_0x0c25('0x3'));var setting=require(_0x0c25('0x4'));var logger=require('../../config/logger')(_0x0c25('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x0c25('0x6')]()[_0x0c25('0x7')](mailAccount[_0x0c25('0x8')]())['then'](realtime['initMailAccounts']())[_0x0c25('0x7')](function(){email[_0x0c25('0x9')](realtime[_0x0c25('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x0c25('0x7')](function(){return initRealtime();})['then'](function(){return setting[_0x0c25('0xb')]();})[_0x0c25('0x7')](function(_0x33a563){return setInterval(initRealtime,_0x33a563[_0x0c25('0xc')]*0x3e8);})[_0x0c25('0xd')](function(_0x5f5547){logger[_0x0c25('0xe')](_0x0c25('0xf'),_0x5f5547);});}main(); \ No newline at end of file +var _0x1cb0=['refresh','listen','loginMailFrequency','error','./server','./rpc/mailAccount','../../config/logger','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x5f1f55,_0x52a0ba){var _0xb95b54=function(_0x58c9b1){while(--_0x58c9b1){_0x5f1f55['push'](_0x5f1f55['shift']());}};_0xb95b54(++_0x52a0ba);}(_0x1cb0,0x9e));var _0x01cb=function(_0x21d36e,_0x5dc096){_0x21d36e=_0x21d36e-0x0;var _0x4cc307=_0x1cb0[_0x21d36e];return _0x4cc307;};'use strict';var server=require(_0x01cb('0x0'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0x01cb('0x1'));var setting=require('./rpc/setting');var logger=require(_0x01cb('0x2'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x01cb('0x3')]()[_0x01cb('0x4')](mailAccount[_0x01cb('0x5')]())[_0x01cb('0x4')](realtime[_0x01cb('0x6')]())[_0x01cb('0x4')](function(){email[_0x01cb('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x01cb('0x8')](realtime,email)[_0x01cb('0x4')](function(){return initRealtime();})[_0x01cb('0x4')](function(){return setting['getSettings']();})[_0x01cb('0x4')](function(_0x31c1db){return setInterval(initRealtime,_0x31c1db[_0x01cb('0x9')]*0x3e8);})['catch'](function(_0x29f8af){logger[_0x01cb('0xa')]('Email\x20service\x20initialization',_0x29f8af);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 725983e..63f2111 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 _0xbd6f=['box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','disabled','connected','messages','handleImapEmail','firstName','lastName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','Imap','status','messageStatus','total','isNil','mailAccount:update','refresh','hasOwnProperty','custom','service','provider'];(function(_0x5cd8c3,_0x4f608c){var _0xa4b5bf=function(_0x287f78){while(--_0x287f78){_0x5cd8c3['push'](_0x5cd8c3['shift']());}};_0xa4b5bf(++_0x4f608c);}(_0xbd6f,0x1b7));var _0xfbd6=function(_0x18f90e,_0x25a7f8){_0x18f90e=_0x18f90e-0x0;var _0x11cb87=_0xbd6f[_0x18f90e];return _0x11cb87;};'use strict';var _=require(_0xfbd6('0x0'));var moment=require(_0xfbd6('0x1'));var BPromise=require(_0xfbd6('0x2'));var md5=require(_0xfbd6('0x3'));var Redis=require(_0xfbd6('0x4'));var config=require(_0xfbd6('0x5'));var logger=require(_0xfbd6('0x6'))(_0xfbd6('0x7'));config[_0xfbd6('0x8')]=_[_0xfbd6('0x9')](config[_0xfbd6('0x8')],{'host':_0xfbd6('0xa'),'port':0x18eb});var io=require(_0xfbd6('0xb'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0xfbd6('0xc'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x4edb34){logger[_0xfbd6('0xd')](_0xfbd6('0xe'));this[_0xfbd6('0xf')]=_0x4edb34[_0xfbd6('0xf')];this[_0xfbd6('0x10')]={};this[_0xfbd6('0x11')]=new EmailSmtp();}EmailChannel[_0xfbd6('0x12')][_0xfbd6('0x13')]=function(_0x2ab3fc){var _0x22e058=this['mailAccounts'][_0x2ab3fc];var _0x28c443={'id':_0x22e058['id'],'name':_0x22e058[_0xfbd6('0x14')],'key':_0x22e058['key'],'active':_0x22e058[_0xfbd6('0x15')],'Imap':{'status':_0x22e058[_0xfbd6('0x16')][_0xfbd6('0x17')],'messageStatus':_0x22e058[_0xfbd6('0x16')][_0xfbd6('0x18')],'total':_0x22e058[_0xfbd6('0x16')][_0xfbd6('0x19')]}};if(_[_0xfbd6('0x1a')](md5Accounts[_0x2ab3fc])){md5Accounts[_0x2ab3fc]={};}var _0x473c88=md5(JSON['stringify'](_0x28c443));if(md5Accounts[_0x2ab3fc][_0xfbd6('0x3')]!==_0x473c88){md5Accounts[_0x2ab3fc]['md5']=_0x473c88;io[_0xfbd6('0x13')](_0xfbd6('0x1b'),_0x28c443);}};EmailChannel['prototype'][_0xfbd6('0x1c')]=function(_0x40b21f){for(var _0x3cb6e5 in _0x40b21f){if(_0x40b21f[_0xfbd6('0x1d')](_0x3cb6e5)){if(_0x40b21f[_0x3cb6e5][_0xfbd6('0x16')]&&_0x40b21f[_0x3cb6e5][_0xfbd6('0x15')]){var _0x5a6cd7=_0x40b21f[_0x3cb6e5][_0xfbd6('0x16')];if(!_0x5a6cd7['service']&&_0x40b21f[_0x3cb6e5]['provider']!==_0xfbd6('0x1e'))_0x5a6cd7[_0xfbd6('0x1f')]=_0x40b21f[_0x3cb6e5][_0xfbd6('0x20')];if(!this[_0xfbd6('0x10')][_0xfbd6('0x1d')](_0x5a6cd7['id'])){this[_0xfbd6('0x10')][_0x5a6cd7['id']]=new EmailImap(_0x5a6cd7,_0x40b21f[_0x3cb6e5]['email']);this['imapAccounts'][_0x5a6cd7['id']]['on'](_0xfbd6('0x21'),this[_0xfbd6('0x22')]['bind'](this,_0x3cb6e5));this[_0xfbd6('0x10')][_0x5a6cd7['id']]['on']('email',this['handleImapEmail'][_0xfbd6('0x23')](this,_0x3cb6e5));this['imapAccounts'][_0x5a6cd7['id']]['on'](_0xfbd6('0x24'),this[_0xfbd6('0x25')]['bind'](this,_0x3cb6e5));this[_0xfbd6('0x10')][_0x5a6cd7['id']]['on'](_0xfbd6('0x26'),this[_0xfbd6('0x27')][_0xfbd6('0x23')](this,_0x3cb6e5));}}else{if(_['isNil'](this['mailAccounts'][_0x3cb6e5][_0xfbd6('0x16')])){this['mailAccounts'][_0x3cb6e5][_0xfbd6('0x16')]={};}this[_0xfbd6('0xf')][_0x3cb6e5][_0xfbd6('0x16')][_0xfbd6('0x17')]=_0xfbd6('0x28');this[_0xfbd6('0xf')][_0x3cb6e5][_0xfbd6('0x16')][_0xfbd6('0x18')]='';this[_0xfbd6('0x13')](_0x3cb6e5);}}}};EmailChannel['prototype']['handleImapBox']=function(_0x366f53,_0x5cdd88){if(this[_0xfbd6('0xf')][_0x366f53]){this[_0xfbd6('0xf')][_0x366f53][_0xfbd6('0x16')][_0xfbd6('0x17')]=_0xfbd6('0x29');this[_0xfbd6('0xf')][_0x366f53]['Imap'][_0xfbd6('0x18')]=_0x5cdd88[_0xfbd6('0x14')];if(_0x5cdd88[_0xfbd6('0x2a')]){this[_0xfbd6('0xf')][_0x366f53][_0xfbd6('0x16')]['total']=_0x5cdd88[_0xfbd6('0x2a')]['total'];}return this[_0xfbd6('0x13')](_0x366f53);}};EmailChannel['prototype'][_0xfbd6('0x2b')]=function(_0x1a1d1e,_0x54733d){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x54733d[_0xfbd6('0x2c')],_0x54733d[_0xfbd6('0x2d')],_0x54733d[_0xfbd6('0x2e')],_0x1a1d1e);if(this['mailAccounts'][_0x1a1d1e]){return mailAccount[_0xfbd6('0x2f')](_0x1a1d1e,_0x54733d)[_0xfbd6('0x30')](function(_0x1b57a8){if(_0x1b57a8){logger[_0xfbd6('0xd')]('Mail\x20accepted\x20from\x20routing');}})[_0xfbd6('0x31')](function(_0x3dd381){logger[_0xfbd6('0x26')](_0xfbd6('0x32'),JSON[_0xfbd6('0x33')](_0x3dd381));});}};EmailChannel[_0xfbd6('0x12')][_0xfbd6('0x25')]=function(_0x46d5a7){if(this[_0xfbd6('0xf')][_0x46d5a7]&&this[_0xfbd6('0xf')][_0x46d5a7]['Imap']){if(this[_0xfbd6('0x10')][this[_0xfbd6('0xf')][_0x46d5a7]['Imap']['id']]){delete this[_0xfbd6('0x10')][this[_0xfbd6('0xf')][_0x46d5a7][_0xfbd6('0x16')]['id']];}this[_0xfbd6('0xf')][_0x46d5a7][_0xfbd6('0x16')][_0xfbd6('0x34')]=moment();this[_0xfbd6('0x13')](_0x46d5a7);}};EmailChannel['prototype'][_0xfbd6('0x27')]=function(_0x1ee6be,_0x1051b3){if(this['mailAccounts'][_0x1ee6be]){this[_0xfbd6('0xf')][_0x1ee6be]['Imap'][_0xfbd6('0x17')]=_0xfbd6('0x26');this[_0xfbd6('0xf')][_0x1ee6be]['Imap']['messageStatus']=_0x1051b3;return this['emit'](_0x1ee6be);}};EmailChannel['prototype']['sendMail']=function(_0x5b98fa,_0x4cffd0){return this['smtp'][_0xfbd6('0x35')](_0x5b98fa,_0x4cffd0);};EmailChannel[_0xfbd6('0x12')][_0xfbd6('0x36')]=function(_0x189744){var _0x122482=this;if(this[_0xfbd6('0xf')][_0x189744['id']]){if(_['isNil'](this['mailAccounts'][_0x189744['id']]['Smtp'])){this[_0xfbd6('0xf')][_0x189744['id']]['Smtp']={};}this[_0xfbd6('0xf')][_0x189744['id']][_0xfbd6('0x37')][_0xfbd6('0x34')]=moment();return new BPromise(function(_0x57149a,_0x5cbd86){return _0x122482['smtp'][_0xfbd6('0x38')](_0x189744)[_0xfbd6('0x30')](function(_0x2c3daf){_0x122482[_0xfbd6('0xf')][_0x189744['id']][_0xfbd6('0x37')][_0xfbd6('0x17')]=_0xfbd6('0x39');_0x122482[_0xfbd6('0xf')][_0x189744['id']]['Smtp']['messageStatus']='';_0x122482[_0xfbd6('0x13')](_0x189744['id']);_0x57149a(_0x2c3daf);})['catch'](function(_0x5ebee8){_0x122482[_0xfbd6('0xf')][_0x189744['id']][_0xfbd6('0x37')][_0xfbd6('0x17')]='error';_0x122482[_0xfbd6('0xf')][_0x189744['id']][_0xfbd6('0x37')]['messageStatus']=_0x5ebee8;_0x122482[_0xfbd6('0x13')](_0x189744['id']);_0x5cbd86(_0x5ebee8);});});}return this[_0xfbd6('0x11')][_0xfbd6('0x38')](_0x189744);};module[_0xfbd6('0x3a')]=EmailChannel; \ No newline at end of file +var _0x5702=['bind','handleImapEmail','end','error','handleImapError','isNil','disabled','connected','messages','info','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','catch','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','box','handleImapBox'];(function(_0xd9621e,_0x8a8f42){var _0x34f0df=function(_0x594133){while(--_0x594133){_0xd9621e['push'](_0xd9621e['shift']());}};_0x34f0df(++_0x8a8f42);}(_0x5702,0x92));var _0x2570=function(_0x164f2b,_0x1df442){_0x164f2b=_0x164f2b-0x0;var _0x1e9ca3=_0x5702[_0x164f2b];return _0x1e9ca3;};'use strict';var _=require(_0x2570('0x0'));var moment=require(_0x2570('0x1'));var BPromise=require('bluebird');var md5=require(_0x2570('0x2'));var Redis=require(_0x2570('0x3'));var config=require(_0x2570('0x4'));var logger=require(_0x2570('0x5'))(_0x2570('0x6'));config[_0x2570('0x7')]=_[_0x2570('0x8')](config[_0x2570('0x7')],{'host':_0x2570('0x9'),'port':0x18eb});var io=require(_0x2570('0xa'))(new Redis(config[_0x2570('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x2570('0xb'));var mailAccount=require(_0x2570('0xc'));var md5Accounts={};function EmailChannel(_0x14c529){logger['info'](_0x2570('0xd'));this['mailAccounts']=_0x14c529[_0x2570('0xe')];this[_0x2570('0xf')]={};this[_0x2570('0x10')]=new EmailSmtp();}EmailChannel[_0x2570('0x11')][_0x2570('0x12')]=function(_0x51c339){var _0x261507=this[_0x2570('0xe')][_0x51c339];var _0x325a24={'id':_0x261507['id'],'name':_0x261507[_0x2570('0x13')],'key':_0x261507[_0x2570('0x14')],'active':_0x261507[_0x2570('0x15')],'Imap':{'status':_0x261507[_0x2570('0x16')][_0x2570('0x17')],'messageStatus':_0x261507[_0x2570('0x16')][_0x2570('0x18')],'total':_0x261507[_0x2570('0x16')][_0x2570('0x19')]}};if(_['isNil'](md5Accounts[_0x51c339])){md5Accounts[_0x51c339]={};}var _0x4f16d0=md5(JSON[_0x2570('0x1a')](_0x325a24));if(md5Accounts[_0x51c339]['md5']!==_0x4f16d0){md5Accounts[_0x51c339]['md5']=_0x4f16d0;io['emit'](_0x2570('0x1b'),_0x325a24);}};EmailChannel[_0x2570('0x11')][_0x2570('0x1c')]=function(_0x2e4bea){for(var _0x191433 in _0x2e4bea){if(_0x2e4bea[_0x2570('0x1d')](_0x191433)){if(_0x2e4bea[_0x191433]['Imap']&&_0x2e4bea[_0x191433][_0x2570('0x15')]){var _0x583d2a=_0x2e4bea[_0x191433][_0x2570('0x16')];if(!_0x583d2a[_0x2570('0x1e')]&&_0x2e4bea[_0x191433][_0x2570('0x1f')]!=='custom')_0x583d2a[_0x2570('0x1e')]=_0x2e4bea[_0x191433][_0x2570('0x1f')];if(!this['imapAccounts'][_0x2570('0x1d')](_0x583d2a['id'])){this['imapAccounts'][_0x583d2a['id']]=new EmailImap(_0x583d2a,_0x2e4bea[_0x191433][_0x2570('0x6')]);this[_0x2570('0xf')][_0x583d2a['id']]['on'](_0x2570('0x20'),this[_0x2570('0x21')][_0x2570('0x22')](this,_0x191433));this[_0x2570('0xf')][_0x583d2a['id']]['on'](_0x2570('0x6'),this[_0x2570('0x23')][_0x2570('0x22')](this,_0x191433));this[_0x2570('0xf')][_0x583d2a['id']]['on'](_0x2570('0x24'),this['handleImapEnd']['bind'](this,_0x191433));this[_0x2570('0xf')][_0x583d2a['id']]['on'](_0x2570('0x25'),this[_0x2570('0x26')][_0x2570('0x22')](this,_0x191433));}}else{if(_[_0x2570('0x27')](this[_0x2570('0xe')][_0x191433]['Imap'])){this[_0x2570('0xe')][_0x191433]['Imap']={};}this[_0x2570('0xe')][_0x191433][_0x2570('0x16')]['status']=_0x2570('0x28');this[_0x2570('0xe')][_0x191433][_0x2570('0x16')][_0x2570('0x18')]='';this[_0x2570('0x12')](_0x191433);}}}};EmailChannel['prototype'][_0x2570('0x21')]=function(_0x35ccff,_0x55331f){if(this[_0x2570('0xe')][_0x35ccff]){this['mailAccounts'][_0x35ccff][_0x2570('0x16')][_0x2570('0x17')]=_0x2570('0x29');this[_0x2570('0xe')][_0x35ccff]['Imap'][_0x2570('0x18')]=_0x55331f[_0x2570('0x13')];if(_0x55331f[_0x2570('0x2a')]){this[_0x2570('0xe')][_0x35ccff][_0x2570('0x16')][_0x2570('0x19')]=_0x55331f[_0x2570('0x2a')][_0x2570('0x19')];}return this[_0x2570('0x12')](_0x35ccff);}};EmailChannel[_0x2570('0x11')][_0x2570('0x23')]=function(_0x4d2dbe,_0x3a6f39){logger[_0x2570('0x2b')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x3a6f39[_0x2570('0x2c')],_0x3a6f39['lastName'],_0x3a6f39[_0x2570('0x2d')],_0x4d2dbe);if(this['mailAccounts'][_0x4d2dbe]){return mailAccount[_0x2570('0x2e')](_0x4d2dbe,_0x3a6f39)[_0x2570('0x2f')](function(_0x58e656){if(_0x58e656){logger[_0x2570('0x2b')](_0x2570('0x30'));}})['catch'](function(_0x18a938){logger[_0x2570('0x25')](_0x2570('0x31'),JSON['stringify'](_0x18a938));});}};EmailChannel[_0x2570('0x11')][_0x2570('0x32')]=function(_0x41fad1){if(this[_0x2570('0xe')][_0x41fad1]&&this[_0x2570('0xe')][_0x41fad1][_0x2570('0x16')]){if(this['imapAccounts'][this['mailAccounts'][_0x41fad1][_0x2570('0x16')]['id']]){delete this[_0x2570('0xf')][this[_0x2570('0xe')][_0x41fad1][_0x2570('0x16')]['id']];}this['mailAccounts'][_0x41fad1][_0x2570('0x16')][_0x2570('0x33')]=moment();this[_0x2570('0x12')](_0x41fad1);}};EmailChannel[_0x2570('0x11')][_0x2570('0x26')]=function(_0x111547,_0x5d326f){if(this[_0x2570('0xe')][_0x111547]){this[_0x2570('0xe')][_0x111547][_0x2570('0x16')][_0x2570('0x17')]=_0x2570('0x25');this[_0x2570('0xe')][_0x111547][_0x2570('0x16')][_0x2570('0x18')]=_0x5d326f;return this['emit'](_0x111547);}};EmailChannel[_0x2570('0x11')][_0x2570('0x34')]=function(_0x3bafb0,_0x2a8587){return this[_0x2570('0x10')][_0x2570('0x35')](_0x3bafb0,_0x2a8587);};EmailChannel[_0x2570('0x11')][_0x2570('0x36')]=function(_0x100e73){var _0xfa2448=this;if(this[_0x2570('0xe')][_0x100e73['id']]){if(_[_0x2570('0x27')](this['mailAccounts'][_0x100e73['id']]['Smtp'])){this[_0x2570('0xe')][_0x100e73['id']][_0x2570('0x37')]={};}this['mailAccounts'][_0x100e73['id']][_0x2570('0x37')][_0x2570('0x33')]=moment();return new BPromise(function(_0x23fff7,_0x5bec5d){return _0xfa2448[_0x2570('0x10')][_0x2570('0x38')](_0x100e73)['then'](function(_0x37442c){_0xfa2448[_0x2570('0xe')][_0x100e73['id']][_0x2570('0x37')][_0x2570('0x17')]=_0x2570('0x39');_0xfa2448['mailAccounts'][_0x100e73['id']][_0x2570('0x37')][_0x2570('0x18')]='';_0xfa2448[_0x2570('0x12')](_0x100e73['id']);_0x23fff7(_0x37442c);})[_0x2570('0x3a')](function(_0x3e41b8){_0xfa2448['mailAccounts'][_0x100e73['id']][_0x2570('0x37')][_0x2570('0x17')]=_0x2570('0x25');_0xfa2448[_0x2570('0xe')][_0x100e73['id']][_0x2570('0x37')][_0x2570('0x18')]=_0x3e41b8;_0xfa2448[_0x2570('0x12')](_0x100e73['id']);_0x5bec5d(_0x3e41b8);});});}return this['smtp']['verify'](_0x100e73);};module[_0x2570('0x3b')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 4841da0..5cf8ada 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 _0xba34=['password','authentication','host','port','tls','autotls','openBox','handleOpenBox','handleError','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleSimpleParser','handleMessageAttributes','handleMessageEnd','parser','stringify','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','bind','handleEnd','error','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider'];(function(_0x26e159,_0x59d747){var _0x571cf3=function(_0x33af9f){while(--_0x33af9f){_0x26e159['push'](_0x26e159['shift']());}};_0x571cf3(++_0x59d747);}(_0xba34,0x119));var _0x4ba3=function(_0x4b0be9,_0x19ddbb){_0x4b0be9=_0x4b0be9-0x0;var _0x52f617=_0xba34[_0x4b0be9];return _0x52f617;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var Imap=require(_0x4ba3('0x2'));var simpleParser=require(_0x4ba3('0x3'))[_0x4ba3('0x4')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require('events')[_0x4ba3('0x5')];var utils=require(_0x4ba3('0x6'));var logger=require(_0x4ba3('0x7'))(_0x4ba3('0x8'));function EmailImap(_0x3590a1,_0xb88621){this[_0x4ba3('0x9')]='INBOX';this[_0x4ba3('0xa')]=this[_0x4ba3('0xb')](_0x3590a1,_0xb88621);this[_0x4ba3('0x2')]=new Imap(this[_0x4ba3('0xa')]);this[_0x4ba3('0x2')][_0x4ba3('0xc')](_0x4ba3('0xd'),this[_0x4ba3('0xe')][_0x4ba3('0xf')](this));this[_0x4ba3('0x2')][_0x4ba3('0xc')]('end',this[_0x4ba3('0x10')][_0x4ba3('0xf')](this));this['imap']['on'](_0x4ba3('0x11'),this['handleError'][_0x4ba3('0xf')](this));this['imap'][_0x4ba3('0x12')]();}util[_0x4ba3('0x13')](EmailImap,EventEmitter);EmailImap[_0x4ba3('0x14')][_0x4ba3('0xb')]=function(_0x2bc796,_0x3d2ace){var _0x3a74f7={'connTimeout':_0x2bc796[_0x4ba3('0x15')]?_0x2bc796[_0x4ba3('0x15')]*0x3e8:0x2710,'authTimeout':_0x2bc796[_0x4ba3('0x16')]?_0x2bc796[_0x4ba3('0x16')]*0x3e8:0x1388};if(_0x2bc796[_0x4ba3('0x17')]){_0x3a74f7[_0x4ba3('0x18')]=_0x2bc796[_0x4ba3('0x18')];_0x3a74f7[_0x4ba3('0x8')]=_0x3d2ace||_0x2bc796[_0x4ba3('0x18')]||'anonymous@xcally.com';if(_0x2bc796[_0x4ba3('0x19')]){_0x3a74f7[_0x4ba3('0x1a')]=utils[_0x4ba3('0x1b')](_0x2bc796[_0x4ba3('0x1c')]['data5'],_0x2bc796[_0x4ba3('0x18')]);}else{_0x3a74f7[_0x4ba3('0x1d')]=_0x2bc796[_0x4ba3('0x1d')];}}else{if(_0x2bc796[_0x4ba3('0x1e')]){_0x3a74f7[_0x4ba3('0x18')]=_0x2bc796[_0x4ba3('0x18')];_0x3a74f7['password']=_0x2bc796['password'];}}_0x3a74f7[_0x4ba3('0x1f')]=_0x2bc796['host'];_0x3a74f7[_0x4ba3('0x20')]=_0x2bc796[_0x4ba3('0x20')]||0x3e1;if(_0x2bc796[_0x4ba3('0x21')]){_0x3a74f7[_0x4ba3('0x21')]=!![];}else{_0x3a74f7[_0x4ba3('0x21')]=![];_0x3a74f7[_0x4ba3('0x22')]='required';}return _0x3a74f7;};EmailImap[_0x4ba3('0x14')][_0x4ba3('0xe')]=function(){this['imap'][_0x4ba3('0x23')](this['mailbox'],![],this[_0x4ba3('0x24')][_0x4ba3('0xf')](this));};EmailImap[_0x4ba3('0x14')][_0x4ba3('0x24')]=function(_0x152e41,_0xe29a49){if(_0x152e41){this[_0x4ba3('0x25')](_0x152e41,!![]);}else{this[_0x4ba3('0x26')](_0x4ba3('0x27'),_0xe29a49);this[_0x4ba3('0x28')]();}};EmailImap['prototype'][_0x4ba3('0x29')]=function(_0x13c353){if(_0x13c353){this[_0x4ba3('0x25')](_0x13c353,!![]);}else{this['imap'][_0x4ba3('0x2a')]();}};EmailImap[_0x4ba3('0x14')][_0x4ba3('0x28')]=function(){this['imap'][_0x4ba3('0x2b')]([_0x4ba3('0x2c')],this[_0x4ba3('0x2d')][_0x4ba3('0xf')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x38ef88,_0x33cad6){if(_0x38ef88){this[_0x4ba3('0x25')](_0x38ef88,!![]);}else{if(_0x33cad6[_0x4ba3('0x2e')]){try{var _0x2cb5d5=this[_0x4ba3('0x2')]['fetch'](_0x33cad6,{'bodies':'','markSeen':!![]});_0x2cb5d5['on'](_0x4ba3('0x2f'),this[_0x4ba3('0x30')][_0x4ba3('0xf')](this));_0x2cb5d5[_0x4ba3('0xc')](_0x4ba3('0x11'),this[_0x4ba3('0x31')][_0x4ba3('0xf')](this));_0x2cb5d5[_0x4ba3('0xc')](_0x4ba3('0x2a'),this[_0x4ba3('0x32')]['bind'](this));}catch(_0x5a453f){logger['error'](_0x5a453f);}}else{this[_0x4ba3('0x2')][_0x4ba3('0x33')](!![],this[_0x4ba3('0x29')][_0x4ba3('0xf')](this));}}};EmailImap[_0x4ba3('0x14')][_0x4ba3('0x30')]=function(_0x137551){_0x137551['on'](_0x4ba3('0x34'),this[_0x4ba3('0x35')][_0x4ba3('0xf')](this));_0x137551[_0x4ba3('0xc')](_0x4ba3('0x36'),this['handleMessageAttributes'][_0x4ba3('0xf')](this));_0x137551[_0x4ba3('0xc')](_0x4ba3('0x2a'),this['handleMessageEnd'][_0x4ba3('0xf')](this));};EmailImap['prototype'][_0x4ba3('0x35')]=function(_0x1cc70e){simpleParser(_0x1cc70e,{'Iconv':Iconv},this[_0x4ba3('0x37')][_0x4ba3('0xf')](this));};EmailImap[_0x4ba3('0x14')][_0x4ba3('0x38')]=function(){};EmailImap['prototype'][_0x4ba3('0x39')]=function(){};EmailImap[_0x4ba3('0x14')][_0x4ba3('0x37')]=function(_0x4b702b,_0x1865b8){if(_0x4b702b){logger[_0x4ba3('0x11')](_0x4b702b);}else{var _0x4d22db=this;utils[_0x4ba3('0x3a')](this['account'],_0x1865b8,function(_0x4c126d){_0x4d22db[_0x4ba3('0x26')](_0x4ba3('0x8'),_0x4c126d);});}};EmailImap[_0x4ba3('0x14')][_0x4ba3('0x32')]=function(){this[_0x4ba3('0x2')]['closeBox'](!![],this[_0x4ba3('0x29')][_0x4ba3('0xf')](this));};EmailImap[_0x4ba3('0x14')][_0x4ba3('0x31')]=function(_0xab7983){this[_0x4ba3('0x25')](_0xab7983);this[_0x4ba3('0x2')][_0x4ba3('0x33')](!![],this['handleCloseBox'][_0x4ba3('0xf')](this));};EmailImap[_0x4ba3('0x14')][_0x4ba3('0x10')]=function(){this[_0x4ba3('0x26')](_0x4ba3('0x2a'));};EmailImap[_0x4ba3('0x14')][_0x4ba3('0x25')]=function(_0xdcc2a2,_0x15d305){logger[_0x4ba3('0x11')](_0x4ba3('0x25'),this[_0x4ba3('0xa')][_0x4ba3('0x8')],JSON[_0x4ba3('0x3b')](_0xdcc2a2));var _0x4a1522='';if(_0xdcc2a2){if(_0xdcc2a2['textCode']){_0x4a1522=_0xdcc2a2['textCode'];}else{for(var _0x48280f in _0xdcc2a2){if(_0xdcc2a2['hasOwnProperty'](_0x48280f)){_0x4a1522+=_[_0x4ba3('0x3c')](_0x48280f)+':\x20'+_0xdcc2a2[_0x48280f]+'\x0a';}}}}if(_0x15d305){this['imap'][_0x4ba3('0x2a')]();}else{this['emit'](_0x4ba3('0x11'),_0x4a1522);this[_0x4ba3('0x26')](_0x4ba3('0x2a'));}};module[_0x4ba3('0x3d')]=EmailImap; \ No newline at end of file +var _0x4137=['simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','once','ready','bind','end','handleEnd','error','connect','connTimeout','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','prototype','openBox','handleOpenBox','box','handleCloseBox','readUnseen','search','handleReadUnseen','handleError','length','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser'];(function(_0x17e5e7,_0x3c98db){var _0x2b2c36=function(_0x2ba159){while(--_0x2ba159){_0x17e5e7['push'](_0x17e5e7['shift']());}};_0x2b2c36(++_0x3c98db);}(_0x4137,0xf8));var _0x7413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4137[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var Imap=require(_0x7413('0x2'));var simpleParser=require(_0x7413('0x3'))[_0x7413('0x4')];var Iconv=require(_0x7413('0x5'))[_0x7413('0x6')];var EventEmitter=require(_0x7413('0x7'))[_0x7413('0x8')];var utils=require(_0x7413('0x9'));var logger=require(_0x7413('0xa'))(_0x7413('0xb'));function EmailImap(_0x4fbade,_0xc808cd){this[_0x7413('0xc')]=_0x7413('0xd');this[_0x7413('0xe')]=this['getAccount'](_0x4fbade,_0xc808cd);this[_0x7413('0x2')]=new Imap(this[_0x7413('0xe')]);this['imap'][_0x7413('0xf')](_0x7413('0x10'),this['handleReady'][_0x7413('0x11')](this));this[_0x7413('0x2')][_0x7413('0xf')](_0x7413('0x12'),this[_0x7413('0x13')]['bind'](this));this[_0x7413('0x2')]['on'](_0x7413('0x14'),this['handleError'][_0x7413('0x11')](this));this[_0x7413('0x2')][_0x7413('0x15')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x2267f6,_0x336c4c){var _0x49f0f6={'connTimeout':_0x2267f6[_0x7413('0x16')]?_0x2267f6[_0x7413('0x16')]*0x3e8:0x2710,'authTimeout':_0x2267f6['authTimeout']?_0x2267f6[_0x7413('0x17')]*0x3e8:0x1388};if(_0x2267f6['service']){_0x49f0f6['user']=_0x2267f6[_0x7413('0x18')];_0x49f0f6['email']=_0x336c4c||_0x2267f6[_0x7413('0x18')]||'anonymous@xcally.com';if(_0x2267f6[_0x7413('0x19')]){_0x49f0f6[_0x7413('0x1a')]=utils[_0x7413('0x1b')](_0x2267f6[_0x7413('0x1c')][_0x7413('0x1d')],_0x2267f6[_0x7413('0x18')]);}else{_0x49f0f6['password']=_0x2267f6[_0x7413('0x1e')];}}else{if(_0x2267f6[_0x7413('0x1f')]){_0x49f0f6[_0x7413('0x18')]=_0x2267f6[_0x7413('0x18')];_0x49f0f6['password']=_0x2267f6[_0x7413('0x1e')];}}_0x49f0f6[_0x7413('0x20')]=_0x2267f6[_0x7413('0x20')];_0x49f0f6[_0x7413('0x21')]=_0x2267f6[_0x7413('0x21')]||0x3e1;if(_0x2267f6[_0x7413('0x22')]){_0x49f0f6[_0x7413('0x22')]=!![];}else{_0x49f0f6[_0x7413('0x22')]=![];_0x49f0f6['autotls']='required';}return _0x49f0f6;};EmailImap[_0x7413('0x23')]['handleReady']=function(){this[_0x7413('0x2')][_0x7413('0x24')](this[_0x7413('0xc')],![],this[_0x7413('0x25')][_0x7413('0x11')](this));};EmailImap[_0x7413('0x23')][_0x7413('0x25')]=function(_0x41cb5d,_0x1d455b){if(_0x41cb5d){this['handleError'](_0x41cb5d,!![]);}else{this['emit'](_0x7413('0x26'),_0x1d455b);this['readUnseen']();}};EmailImap[_0x7413('0x23')][_0x7413('0x27')]=function(_0x463b21){if(_0x463b21){this['handleError'](_0x463b21,!![]);}else{this[_0x7413('0x2')][_0x7413('0x12')]();}};EmailImap[_0x7413('0x23')][_0x7413('0x28')]=function(){this[_0x7413('0x2')][_0x7413('0x29')](['UNSEEN'],this[_0x7413('0x2a')]['bind'](this));};EmailImap[_0x7413('0x23')][_0x7413('0x2a')]=function(_0xae2969,_0x13a836){if(_0xae2969){this[_0x7413('0x2b')](_0xae2969,!![]);}else{if(_0x13a836[_0x7413('0x2c')]){try{var _0x5bb3ea=this[_0x7413('0x2')][_0x7413('0x2d')](_0x13a836,{'bodies':'','markSeen':!![]});_0x5bb3ea['on'](_0x7413('0x2e'),this[_0x7413('0x2f')][_0x7413('0x11')](this));_0x5bb3ea[_0x7413('0xf')](_0x7413('0x14'),this['handleFetchError'][_0x7413('0x11')](this));_0x5bb3ea[_0x7413('0xf')](_0x7413('0x12'),this[_0x7413('0x30')][_0x7413('0x11')](this));}catch(_0x51d676){logger[_0x7413('0x14')](_0x51d676);}}else{this['imap'][_0x7413('0x31')](!![],this[_0x7413('0x27')][_0x7413('0x11')](this));}}};EmailImap['prototype'][_0x7413('0x2f')]=function(_0x487dc8){_0x487dc8['on'](_0x7413('0x32'),this[_0x7413('0x33')]['bind'](this));_0x487dc8['once'](_0x7413('0x34'),this[_0x7413('0x35')][_0x7413('0x11')](this));_0x487dc8['once']('end',this[_0x7413('0x36')]['bind'](this));};EmailImap['prototype'][_0x7413('0x33')]=function(_0x575a79){simpleParser(_0x575a79,{'Iconv':Iconv},this[_0x7413('0x37')][_0x7413('0x11')](this));};EmailImap[_0x7413('0x23')][_0x7413('0x35')]=function(){};EmailImap[_0x7413('0x23')]['handleMessageEnd']=function(){};EmailImap[_0x7413('0x23')][_0x7413('0x37')]=function(_0x44e8b5,_0xfa34ef){if(_0x44e8b5){logger[_0x7413('0x14')](_0x44e8b5);}else{var _0x1168cd=this;utils[_0x7413('0x38')](this[_0x7413('0xe')],_0xfa34ef,function(_0x5993d){_0x1168cd[_0x7413('0x39')](_0x7413('0xb'),_0x5993d);});}};EmailImap[_0x7413('0x23')]['handleFetchEnd']=function(){this[_0x7413('0x2')]['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap['prototype']['handleFetchError']=function(_0x44af7d){this['handleError'](_0x44af7d);this['imap'][_0x7413('0x31')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x7413('0x23')][_0x7413('0x13')]=function(){this[_0x7413('0x39')](_0x7413('0x12'));};EmailImap[_0x7413('0x23')]['handleError']=function(_0x3f421c,_0x51c48a){logger[_0x7413('0x14')](_0x7413('0x2b'),this[_0x7413('0xe')][_0x7413('0xb')],JSON[_0x7413('0x3a')](_0x3f421c));var _0x125466='';if(_0x3f421c){if(_0x3f421c[_0x7413('0x3b')]){_0x125466=_0x3f421c[_0x7413('0x3b')];}else{for(var _0x35d198 in _0x3f421c){if(_0x3f421c[_0x7413('0x3c')](_0x35d198)){_0x125466+=_[_0x7413('0x3d')](_0x35d198)+':\x20'+_0x3f421c[_0x35d198]+'\x0a';}}}}if(_0x51c48a){this[_0x7413('0x2')][_0x7413('0x12')]();}else{this['emit'](_0x7413('0x14'),_0x125466);this[_0x7413('0x39')](_0x7413('0x12'));}};module[_0x7413('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index e055d44..637053e 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 _0x56d3=['exports','nodemailer-plugin-inline-base64','createTransport','use','compile','sendMail','toString','prototype','verify'];(function(_0x3585ad,_0x2a9e9c){var _0xcd7347=function(_0x59a596){while(--_0x59a596){_0x3585ad['push'](_0x3585ad['shift']());}};_0xcd7347(++_0x2a9e9c);}(_0x56d3,0x17b));var _0x356d=function(_0x56dac6,_0x291782){_0x56dac6=_0x56dac6-0x0;var _0x5766f1=_0x56d3[_0x56dac6];return _0x5766f1;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x356d('0x0'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x50a9c6,_0x4bfa19){return new Promise(function(_0x97f2e5,_0x3be64d){var _0x4caf16=nodemailer[_0x356d('0x1')](_0x50a9c6);_0x4caf16[_0x356d('0x2')](_0x356d('0x3'),inlineBase64());_0x4caf16[_0x356d('0x4')](_0x4bfa19,function(_0x30bb2d,_0x213d33){if(_0x30bb2d){_0x3be64d(_0x30bb2d[_0x356d('0x5')]());}else{_0x97f2e5(_0x213d33);}});});};EmailSmtp[_0x356d('0x6')][_0x356d('0x7')]=function(_0x2e3365){return new Promise(function(_0x2cbc9d,_0x508397){var _0x5e616c=nodemailer['createTransport'](_0x2e3365);_0x5e616c[_0x356d('0x7')](function(_0x4586d4,_0x26f931){if(_0x4586d4){_0x508397(_0x4586d4[_0x356d('0x5')]());}else{if(_0x26f931){_0x2cbc9d(_0x26f931);}else{_0x508397('Not\x20verifired');}}});});};module[_0x356d('0x8')]=EmailSmtp; \ No newline at end of file +var _0x287e=['use','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x3cd451,_0x26e81a){var _0x571ce6=function(_0x27af9e){while(--_0x27af9e){_0x3cd451['push'](_0x3cd451['shift']());}};_0x571ce6(++_0x26e81a);}(_0x287e,0x80));var _0xe287=function(_0x3ef106,_0x39b93a){_0x3ef106=_0x3ef106-0x0;var _0x4e8b67=_0x287e[_0x3ef106];return _0x4e8b67;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xe287('0x0'));function EmailSmtp(){}EmailSmtp[_0xe287('0x1')][_0xe287('0x2')]=function(_0xc1b62a,_0x79420b){return new Promise(function(_0x5d6b23,_0x523635){var _0x1fb693=nodemailer[_0xe287('0x3')](_0xc1b62a);_0x1fb693[_0xe287('0x4')](_0xe287('0x5'),inlineBase64());_0x1fb693[_0xe287('0x6')](_0x79420b,function(_0x513f80,_0x13c1da){if(_0x513f80){_0x523635(_0x513f80[_0xe287('0x7')]());}else{_0x5d6b23(_0x13c1da);}});});};EmailSmtp[_0xe287('0x1')][_0xe287('0x8')]=function(_0x2f498f){return new Promise(function(_0x2a2eef,_0x5a0e92){var _0x5110b0=nodemailer[_0xe287('0x3')](_0x2f498f);_0x5110b0[_0xe287('0x8')](function(_0x529d80,_0x5d38f5){if(_0x529d80){_0x5a0e92(_0x529d80[_0xe287('0x7')]());}else{if(_0x5d38f5){_0x2a2eef(_0x5d38f5);}else{_0x5a0e92(_0xe287('0x9'));}}});});};module[_0xe287('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 3ff6dd3..a3817ab 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 _0xb27b=['node-tnef','../../../config/logger','../../../config/environment','head','address','anonymous','generate','@xcally.com','value','name','substring','indexOf','split','length','slice','join','pop','isEmpty','html','test','','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','base64','lodash','moment','path','util'];(function(_0x13fdc7,_0x4ca0d4){var _0x2f690d=function(_0x14f6b0){while(--_0x14f6b0){_0x13fdc7['push'](_0x13fdc7['shift']());}};_0x2f690d(++_0x4ca0d4);}(_0xb27b,0x169));var _0xbb27=function(_0x25a152,_0x5795f9){_0x25a152=_0x25a152-0x0;var _0x26f30b=_0xb27b[_0x25a152];return _0x26f30b;};'use strict';var _=require(_0xbb27('0x0'));var moment=require(_0xbb27('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0xbb27('0x2'));var util=require(_0xbb27('0x3'));var tnef=require(_0xbb27('0x4'));var logger=require(_0xbb27('0x5'))('email');var config=require(_0xbb27('0x6'));function getAddress(_0x4d4cc4){var _0x3607fb=_[_0xbb27('0x7')](_0x4d4cc4['value']);return _0x3607fb&&_0x3607fb[_0xbb27('0x8')]?_0x3607fb[_0xbb27('0x8')]:_0xbb27('0x9')+random[_0xbb27('0xa')](0x6)+_0xbb27('0xb');}function getFirstName(_0x510c41){var _0x300c5e=_[_0xbb27('0x7')](_0x510c41[_0xbb27('0xc')]);if(_0x300c5e&&_0x300c5e[_0xbb27('0xd')]){if(_0x300c5e[_0xbb27('0xd')]==_0x300c5e['address']){return _0x300c5e[_0xbb27('0xd')][_0xbb27('0xe')](0x0,_0x300c5e[_0xbb27('0xd')][_0xbb27('0xf')]('@'));}var _0x3517d1=_0x300c5e[_0xbb27('0xd')][_0xbb27('0x10')](/\s+/);return _0x3517d1[_0xbb27('0x11')]>0x1?_0x3517d1[_0xbb27('0x12')](0x0,-0x1)[_0xbb27('0x13')]('\x20'):_0x300c5e['name'];}return'Anonymous';}function getLastName(_0x4f313b){var _0x1cddf5=_[_0xbb27('0x7')](_0x4f313b['value']);if(_0x1cddf5&&_0x1cddf5['name']){var _0x38f463=_0x1cddf5[_0xbb27('0xd')][_0xbb27('0x10')](/\s+/);return _0x38f463['length']>0x1?_0x38f463[_0xbb27('0x14')]():'';}return'';}function getMails(_0xf5d98f,_0x301860){var _0x411544='';for(var _0x2ead03=0x0;_0x2ead03<_0x301860[_0xbb27('0xc')]['length'];_0x2ead03+=0x1){if(_0x301860[_0xbb27('0xc')][_0x2ead03][_0xbb27('0x8')]!==_0xf5d98f){if(!_[_0xbb27('0x15')](_0x411544)){_0x411544+=',';}_0x411544+=_0x301860[_0xbb27('0xc')][_0x2ead03][_0xbb27('0xd')]||_0x301860['value'][_0x2ead03][_0xbb27('0x8')]||'';_0x411544+='\x20<';_0x411544+=_0x301860[_0xbb27('0xc')][_0x2ead03][_0xbb27('0x8')]?_0x301860[_0xbb27('0xc')][_0x2ead03][_0xbb27('0x8')]:'anonymous'+random[_0xbb27('0xa')](0x6)+_0xbb27('0xb');_0x411544+='>';}}return _0x411544;}function parseEmail(_0x34a58b,_0x6d8137,_0x94bbbf){if(_0x6d8137[_0xbb27('0x16')]){var _0x7677de=/)<[^<]*)*<\/script>/gi;while(_0x7677de[_0xbb27('0x17')](_0x6d8137[_0xbb27('0x16')])){_0x6d8137['html']=_0x6d8137[_0xbb27('0x16')]['replace'](_0x7677de,'');}if(_0x6d8137[_0xbb27('0x16')]['includes'](_0xbb27('0x18'))){var _0x327ccc=[];_0x6d8137[_0xbb27('0x19')][_0xbb27('0x1a')](_0x1b5ac2=>{_0x327ccc[_0xbb27('0x1b')](_0x1b5ac2[_0xbb27('0x1c')]);});var _0x254253=/]+>/g;var _0x5ddb25=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5be61b=_0x6d8137[_0xbb27('0x16')][_0xbb27('0x1d')](_0x5ddb25,_0xbb27('0x1e'));var _0x3f08fe=_0x5be61b[_0xbb27('0x1d')](_0x254253,'_IMG');for(let _0x50f38c=0x0;_0x50f38c<_0x327ccc[_0xbb27('0x11')];_0x50f38c++){var _0x14f35a=_0x3f08fe[_0xbb27('0x1d')](_0xbb27('0x1f'),'\x20[Attachment:\x20'+_0x327ccc[_0x50f38c]+_0xbb27('0x20'));_0x3f08fe=_0x14f35a;}_0x6d8137[_0xbb27('0x16')]=_0x3f08fe;}_0x94bbbf[_0xbb27('0x21')]=_0x6d8137[_0xbb27('0x16')];}else{_0x94bbbf[_0xbb27('0x21')]=_0x6d8137[_0xbb27('0x22')];}if(_0x94bbbf[_0xbb27('0x21')]){_0x94bbbf['body']=_0x94bbbf[_0xbb27('0x21')]['replace'](/0x0){var _0x33693b=['Auto-Submitted:\x20auto-replied',_0xbb27('0x32'),_0xbb27('0x33')];for(var _0x2980c3=0x0;_0x2980c3<_0x6d8137[_0xbb27('0x31')]['length'];_0x2980c3++){var _0x51407f=_[_0xbb27('0xf')](_0x33693b,_0x6d8137['headerLines'][_0x2980c3][_0xbb27('0x34')]);if(_0x51407f>=0x0){_0x94bbbf['isAutoreply']=!![];}}}return _0x94bbbf;}exports[_0xbb27('0x35')]=function(_0x79bfc6,_0x346cd5,_0x25d945){var _0x32ad19={'from':getAddress(_0x346cd5[_0xbb27('0x36')]),'firstName':getFirstName(_0x346cd5[_0xbb27('0x36')]),'lastName':getLastName(_0x346cd5[_0xbb27('0x36')]),'mapKey':_0xbb27('0x25'),'message':{'from':getMails(_0x79bfc6['email'],_0x346cd5[_0xbb27('0x36')]),'to':_0x79bfc6[_0xbb27('0x25')],'cc':'','subject':_0x346cd5['subject']||'','messageId':_0x346cd5[_0xbb27('0x37')],'inReplyTo':_0x346cd5['inReplyTo'],'sentAt':moment(_0x346cd5[_0xbb27('0x38')])[_0xbb27('0x2b')](_0xbb27('0x39')),'attach':![],'attachments':[]}};if(!_0x346cd5[_0xbb27('0x16')]&&!_0x346cd5[_0xbb27('0x22')]){var _0x457daa=_[_0xbb27('0x3a')](_0x346cd5[_0xbb27('0x19')],{'contentType':_0xbb27('0x3b')});if(_0x457daa[_0xbb27('0x11')]){logger['info'](util['format'](_0xbb27('0x3c'),_0x346cd5[_0xbb27('0x37')]));tnef[_0xbb27('0x3d')](_[_0xbb27('0x3e')](_0x457daa)[_0xbb27('0x2f')],function(_0x421f9d,_0x33f36a){if(_0x33f36a){_0x346cd5[_0xbb27('0x16')]=_0x33f36a[_0xbb27('0x3f')]||_0xbb27('0x40');if(_0x33f36a[_0xbb27('0x41')]){for(var _0x3a7f0b=0x0;_0x3a7f0b<_0x33f36a[_0xbb27('0x41')][_0xbb27('0x11')];_0x3a7f0b++){var _0x433709=_0x33f36a[_0xbb27('0x41')][_0x3a7f0b];_0x32ad19[_0xbb27('0x24')][_0xbb27('0x19')]['push']({'filename':_0x433709[_0xbb27('0x42')],'content':Buffer[_0xbb27('0x36')](_0x433709[_0xbb27('0x43')])});}}}_0x25d945(parseEmail(_0x79bfc6,_0x346cd5,_0x32ad19));});}else{_0x346cd5[_0xbb27('0x16')]='

Empty\x20message

';_0x25d945(parseEmail(_0x79bfc6,_0x346cd5,_0x32ad19));}}else{_0x25d945(parseEmail(_0x79bfc6,_0x346cd5,_0x32ad19));}};exports[_0xbb27('0x44')]=function(_0x71650e,_0x4c7551){var _0x5e9f97=[_0xbb27('0x45')+(_0x4c7551||''),_0xbb27('0x46')+_0x71650e,'',''];return Buffer[_0xbb27('0x36')](_0x5e9f97[_0xbb27('0x13')](''),_0xbb27('0x47'))['toString'](_0xbb27('0x48'));}; \ No newline at end of file +var _0x882c=['X-Auto-Response-Suppress:\x20All','indexOf','isAutoreply','parser','from','subject','messageId','inReplyTo','format','YYYY-MM-DD\x20HH:mm:ss','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','BodyHTML','

Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','auth=Bearer\x20','join','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','@xcally.com','name','substring','split','slice','value','pop','length','isEmpty','test','html','replace','includes','','textAsHtml','body','0x1?_0x354e95[_0xc882('0x11')](0x0,-0x1)['join']('\x20'):_0x104a78[_0xc882('0xe')];}return'Anonymous';}function getLastName(_0x1bff8f){var _0x1565dd=_[_0xc882('0x9')](_0x1bff8f[_0xc882('0x12')]);if(_0x1565dd&&_0x1565dd['name']){var _0x4a677c=_0x1565dd[_0xc882('0xe')][_0xc882('0x10')](/\s+/);return _0x4a677c['length']>0x1?_0x4a677c[_0xc882('0x13')]():'';}return'';}function getMails(_0x5e8400,_0x376620){var _0x4c3d2a='';for(var _0x15c773=0x0;_0x15c773<_0x376620[_0xc882('0x12')][_0xc882('0x14')];_0x15c773+=0x1){if(_0x376620[_0xc882('0x12')][_0x15c773]['address']!==_0x5e8400){if(!_[_0xc882('0x15')](_0x4c3d2a)){_0x4c3d2a+=',';}_0x4c3d2a+=_0x376620['value'][_0x15c773][_0xc882('0xe')]||_0x376620[_0xc882('0x12')][_0x15c773][_0xc882('0xa')]||'';_0x4c3d2a+='\x20<';_0x4c3d2a+=_0x376620[_0xc882('0x12')][_0x15c773][_0xc882('0xa')]?_0x376620[_0xc882('0x12')][_0x15c773]['address']:_0xc882('0xb')+random[_0xc882('0xc')](0x6)+'@xcally.com';_0x4c3d2a+='>';}}return _0x4c3d2a;}function parseEmail(_0x3840bf,_0x39183b,_0x15aea1){if(_0x39183b['html']){var _0x2c187e=/)<[^<]*)*<\/script>/gi;while(_0x2c187e[_0xc882('0x16')](_0x39183b[_0xc882('0x17')])){_0x39183b[_0xc882('0x17')]=_0x39183b[_0xc882('0x17')][_0xc882('0x18')](_0x2c187e,'');}if(_0x39183b['html'][_0xc882('0x19')](_0xc882('0x1a'))){var _0x5a5f3a=[];_0x39183b[_0xc882('0x1b')][_0xc882('0x1c')](_0x5ab8c1=>{_0x5a5f3a[_0xc882('0x1d')](_0x5ab8c1[_0xc882('0x1e')]);});var _0xdbcf08=/]+>/g;var _0x11a034=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1dcf7f=_0x39183b[_0xc882('0x17')][_0xc882('0x18')](_0x11a034,_0xc882('0x1f'));var _0x39ffe3=_0x1dcf7f[_0xc882('0x18')](_0xdbcf08,'_IMG');for(let _0x2fcd87=0x0;_0x2fcd87<_0x5a5f3a[_0xc882('0x14')];_0x2fcd87++){var _0x2f55ff=_0x39ffe3[_0xc882('0x18')]('_IMG','\x20[Attachment:\x20'+_0x5a5f3a[_0x2fcd87]+_0xc882('0x20'));_0x39ffe3=_0x2f55ff;}_0x39183b[_0xc882('0x17')]=_0x39ffe3;}_0x15aea1['body']=_0x39183b[_0xc882('0x17')];}else{_0x15aea1['body']=_0x39183b[_0xc882('0x21')];}if(_0x15aea1[_0xc882('0x22')]){_0x15aea1[_0xc882('0x22')]=_0x15aea1[_0xc882('0x22')][_0xc882('0x18')](/0x0){var _0x4c9347=[_0xc882('0x32'),_0xc882('0x33'),'Precedence:\x20auto_reply'];for(var _0x13d432=0x0;_0x13d432<_0x39183b['headerLines'][_0xc882('0x14')];_0x13d432++){var _0x87ce80=_[_0xc882('0x34')](_0x4c9347,_0x39183b['headerLines'][_0x13d432]['line']);if(_0x87ce80>=0x0){_0x15aea1[_0xc882('0x35')]=!![];}}}return _0x15aea1;}exports[_0xc882('0x36')]=function(_0x58a047,_0x56b0c1,_0x429222){var _0x12cbb4={'from':getAddress(_0x56b0c1[_0xc882('0x37')]),'firstName':getFirstName(_0x56b0c1[_0xc882('0x37')]),'lastName':getLastName(_0x56b0c1[_0xc882('0x37')]),'mapKey':_0xc882('0x7'),'message':{'from':getMails(_0x58a047[_0xc882('0x7')],_0x56b0c1['from']),'to':_0x58a047['email'],'cc':'','subject':_0x56b0c1[_0xc882('0x38')]||'','messageId':_0x56b0c1[_0xc882('0x39')],'inReplyTo':_0x56b0c1[_0xc882('0x3a')],'sentAt':moment(_0x56b0c1['date'])[_0xc882('0x3b')](_0xc882('0x3c')),'attach':![],'attachments':[]}};if(!_0x56b0c1[_0xc882('0x17')]&&!_0x56b0c1[_0xc882('0x21')]){var _0x45d4f1=_[_0xc882('0x3d')](_0x56b0c1[_0xc882('0x1b')],{'contentType':'application/ms-tnef'});if(_0x45d4f1[_0xc882('0x14')]){logger[_0xc882('0x3e')](util[_0xc882('0x3b')](_0xc882('0x3f'),_0x56b0c1[_0xc882('0x39')]));tnef['parseBuffer'](_[_0xc882('0x40')](_0x45d4f1)['content'],function(_0x226948,_0x58337f){if(_0x58337f){_0x56b0c1[_0xc882('0x17')]=_0x58337f[_0xc882('0x41')]||_0xc882('0x42');if(_0x58337f[_0xc882('0x43')]){for(var _0x3bed00=0x0;_0x3bed00<_0x58337f['Attachments'][_0xc882('0x14')];_0x3bed00++){var _0x560e55=_0x58337f[_0xc882('0x43')][_0x3bed00];_0x12cbb4['message']['attachments'][_0xc882('0x1d')]({'filename':_0x560e55[_0xc882('0x44')],'content':Buffer[_0xc882('0x37')](_0x560e55['Data'])});}}}_0x429222(parseEmail(_0x58a047,_0x56b0c1,_0x12cbb4));});}else{_0x56b0c1[_0xc882('0x17')]=_0xc882('0x42');_0x429222(parseEmail(_0x58a047,_0x56b0c1,_0x12cbb4));}}else{_0x429222(parseEmail(_0x58a047,_0x56b0c1,_0x12cbb4));}};exports[_0xc882('0x45')]=function(_0x5f5428,_0x255a32){var _0x1bbf4d=[_0xc882('0x46')+(_0x255a32||''),_0xc882('0x47')+_0x5f5428,'',''];return Buffer[_0xc882('0x37')](_0x1bbf4d[_0xc882('0x48')](''),_0xc882('0x49'))[_0xc882('0x4a')](_0xc882('0x4b'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 02fa829..0f0e516 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 _0x2b6e=['Smtp','exports','lodash','name','Service','key','SERV','active','Imap'];(function(_0x24cf7d,_0x11b8cf){var _0x238453=function(_0x5ccef8){while(--_0x5ccef8){_0x24cf7d['push'](_0x24cf7d['shift']());}};_0x238453(++_0x11b8cf);}(_0x2b6e,0x185));var _0xe2b6=function(_0x2dd3d5,_0x3cb473){_0x2dd3d5=_0x2dd3d5-0x0;var _0x212ed4=_0x2b6e[_0x2dd3d5];return _0x212ed4;};'use strict';var _=require(_0xe2b6('0x0'));function MailAccount(_0x45614c){this['id']=_0x45614c['id']||0x0;this[_0xe2b6('0x1')]=_0x45614c['name']||_0xe2b6('0x2');this['key']=_0x45614c[_0xe2b6('0x3')]||_0xe2b6('0x4');this[_0xe2b6('0x5')]=_0x45614c[_0xe2b6('0x5')]||![];this[_0xe2b6('0x6')]=_0x45614c[_0xe2b6('0x6')]||[];this[_0xe2b6('0x7')]=_0x45614c[_0xe2b6('0x7')]||[];}module[_0xe2b6('0x8')]=MailAccount; \ No newline at end of file +var _0x0ba2=['Smtp','exports','lodash','name','Service','key','SERV','active','Imap'];(function(_0xb746a4,_0x355bdc){var _0x4b6a58=function(_0x3ebf70){while(--_0x3ebf70){_0xb746a4['push'](_0xb746a4['shift']());}};_0x4b6a58(++_0x355bdc);}(_0x0ba2,0xb6));var _0x20ba=function(_0x1d0893,_0x45e9e6){_0x1d0893=_0x1d0893-0x0;var _0x55e423=_0x0ba2[_0x1d0893];return _0x55e423;};'use strict';var _=require(_0x20ba('0x0'));function MailAccount(_0x166e8f){this['id']=_0x166e8f['id']||0x0;this[_0x20ba('0x1')]=_0x166e8f[_0x20ba('0x1')]||_0x20ba('0x2');this[_0x20ba('0x3')]=_0x166e8f['key']||_0x20ba('0x4');this[_0x20ba('0x5')]=_0x166e8f['active']||![];this['Imap']=_0x166e8f[_0x20ba('0x6')]||[];this[_0x20ba('0x7')]=_0x166e8f[_0x20ba('0x7')]||[];}module[_0x20ba('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 7afa79a..34f9946 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 _0xf7c5=['prototype','initMailAccounts','length','isUndefined','merge','exports','../model/mailAccount','mailAccounts','mapKeys','mergeFromDatabase','hasOwnProperty'];(function(_0x115ad0,_0x5dc4f4){var _0x25043c=function(_0x9f1dcc){while(--_0x9f1dcc){_0x115ad0['push'](_0x115ad0['shift']());}};_0x25043c(++_0x5dc4f4);}(_0xf7c5,0x1b3));var _0x5f7c=function(_0x1200e9,_0x1a23a4){_0x1200e9=_0x1200e9-0x0;var _0x2c1ac4=_0xf7c5[_0x1200e9];return _0x2c1ac4;};'use strict';var _=require('lodash');var MailAccount=require(_0x5f7c('0x0'));var Realtime=function(){this[_0x5f7c('0x1')]={};};function freeIsNotKey(_0x13f825,_0x489c7e,_0x3ec86a){var _0x5ca8bc=_[_0x5f7c('0x2')](_0x13f825,function(_0x189cc4,_0x3c735d){return _0x189cc4[_0x3ec86a];});for(var _0x4fa426 in _0x489c7e){if(_0x489c7e['hasOwnProperty'](_0x4fa426)){if(!_0x5ca8bc[_0x4fa426]){delete _0x489c7e[_0x4fa426];}}}}Realtime['prototype'][_0x5f7c('0x3')]=function(_0x5e9974,_0xbb8ea){for(var _0xb7a01c in _0xbb8ea){if(_0x5e9974[_0x5f7c('0x4')](_0xb7a01c)){_0x5e9974[_0xb7a01c]=_0xbb8ea[_0xb7a01c];}}};Realtime[_0x5f7c('0x5')][_0x5f7c('0x6')]=function(){var _0x3b3236=this;return function(_0x33ec53){if(_0x33ec53){freeIsNotKey(_0x33ec53,_0x3b3236['mailAccounts'],'id');for(var _0xaf4177=0x0,_0x5699fa={},_0x6441fc={};_0xaf4177<_0x33ec53[_0x5f7c('0x7')];_0xaf4177+=0x1){_0x5699fa=_0x33ec53[_0xaf4177];if(_[_0x5f7c('0x8')](_0x3b3236[_0x5f7c('0x1')][_0x5699fa['id']])){_0x3b3236[_0x5f7c('0x1')][_0x5699fa['id']]=new MailAccount(_0x5699fa);}else{_[_0x5f7c('0x9')](_0x3b3236['mailAccounts'][_0x5699fa['id']],_0x5699fa);}}}return _0x3b3236[_0x5f7c('0x1')];};};module[_0x5f7c('0xa')]=Realtime; \ No newline at end of file +var _0x0939=['mergeFromDatabase','initMailAccounts','mailAccounts','length','isUndefined','merge','exports','lodash','mapKeys','hasOwnProperty','prototype'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x0939,0x17d));var _0x9093=function(_0x2c4a3f,_0x488ec7){_0x2c4a3f=_0x2c4a3f-0x0;var _0x1696aa=_0x0939[_0x2c4a3f];return _0x1696aa;};'use strict';var _=require(_0x9093('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x1919f9,_0x396228,_0x548652){var _0x5cb70e=_[_0x9093('0x1')](_0x1919f9,function(_0x35c1c0,_0x1b7410){return _0x35c1c0[_0x548652];});for(var _0x346a75 in _0x396228){if(_0x396228[_0x9093('0x2')](_0x346a75)){if(!_0x5cb70e[_0x346a75]){delete _0x396228[_0x346a75];}}}}Realtime[_0x9093('0x3')][_0x9093('0x4')]=function(_0x21f45f,_0x5d02e0){for(var _0xf7d5d2 in _0x5d02e0){if(_0x21f45f[_0x9093('0x2')](_0xf7d5d2)){_0x21f45f[_0xf7d5d2]=_0x5d02e0[_0xf7d5d2];}}};Realtime[_0x9093('0x3')][_0x9093('0x5')]=function(){var _0x335915=this;return function(_0x490e5c){if(_0x490e5c){freeIsNotKey(_0x490e5c,_0x335915[_0x9093('0x6')],'id');for(var _0x2ddd2e=0x0,_0x3a5649={},_0x2ef049={};_0x2ddd2e<_0x490e5c[_0x9093('0x7')];_0x2ddd2e+=0x1){_0x3a5649=_0x490e5c[_0x2ddd2e];if(_[_0x9093('0x8')](_0x335915['mailAccounts'][_0x3a5649['id']])){_0x335915[_0x9093('0x6')][_0x3a5649['id']]=new MailAccount(_0x3a5649);}else{_[_0x9093('0x9')](_0x335915[_0x9093('0x6')][_0x3a5649['id']],_0x3a5649);}}}return _0x335915['mailAccounts'];};};module[_0x9093('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 6b9d70b..d809baa 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 _0x7a12=['key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','MailServerOut','data5','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x7a12,0xe8));var _0x27a1=function(_0x3efb69,_0x17bd16){_0x3efb69=_0x3efb69-0x0;var _0x17a382=_0x7a12[_0x3efb69];return _0x17a382;};'use strict';var client=require(_0x27a1('0x0'));exports[_0x27a1('0x1')]=function(){return function(){return client[_0x27a1('0x2')](_0x27a1('0x3'),{'options':{'attributes':['id',_0x27a1('0x4'),_0x27a1('0x5'),_0x27a1('0x6'),_0x27a1('0x7'),'active',_0x27a1('0x8'),_0x27a1('0x9'),_0x27a1('0xa')],'raw':![],'include':[{'model':_0x27a1('0xb'),'as':_0x27a1('0xc'),'include':[{'model':_0x27a1('0xd'),'attributes':['id','name',_0x27a1('0x6'),_0x27a1('0xe'),'data5'],'as':_0x27a1('0xd')}]},{'model':_0x27a1('0xf'),'as':'Smtp','include':[{'model':_0x27a1('0xd'),'attributes':['id',_0x27a1('0x4'),_0x27a1('0x6'),'type',_0x27a1('0x10')],'as':_0x27a1('0xd')}]}]},'log':_0x27a1('0x11')});};};exports[_0x27a1('0x12')]=function(_0x324e2b,_0x5f3ba9){return client[_0x27a1('0x2')]('NotifyMailAccount',{'account':{'id':_0x324e2b},'body':_0x5f3ba9,'log':_0x27a1('0x13')});}; \ No newline at end of file +var _0xb7f0=['name','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider'];(function(_0x2d5e03,_0x24aeb3){var _0x3d11ca=function(_0xad926e){while(--_0xad926e){_0x2d5e03['push'](_0x2d5e03['shift']());}};_0x3d11ca(++_0x24aeb3);}(_0xb7f0,0x1eb));var _0x0b7f=function(_0x43b616,_0xb842c){_0x43b616=_0x43b616-0x0;var _0xc188db=_0xb7f0[_0x43b616];return _0xc188db;};'use strict';var client=require(_0x0b7f('0x0'));exports[_0x0b7f('0x1')]=function(){return function(){return client[_0x0b7f('0x2')](_0x0b7f('0x3'),{'options':{'attributes':['id','name','provider',_0x0b7f('0x4'),_0x0b7f('0x5'),_0x0b7f('0x6'),_0x0b7f('0x7'),_0x0b7f('0x8'),_0x0b7f('0x9')],'raw':![],'include':[{'model':_0x0b7f('0xa'),'as':_0x0b7f('0xb'),'include':[{'model':_0x0b7f('0xc'),'attributes':['id',_0x0b7f('0xd'),'service',_0x0b7f('0xe'),_0x0b7f('0xf')],'as':'CloudProvider'}]},{'model':_0x0b7f('0x10'),'as':_0x0b7f('0x11'),'include':[{'model':'CloudProvider','attributes':['id','name','service',_0x0b7f('0xe'),_0x0b7f('0xf')],'as':_0x0b7f('0xc')}]}]},'log':_0x0b7f('0x12')});};};exports[_0x0b7f('0x13')]=function(_0xc7fa85,_0x23a0b4){return client[_0x0b7f('0x2')](_0x0b7f('0x14'),{'account':{'id':_0xc7fa85},'body':_0x23a0b4,'log':_0x0b7f('0x14')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 965a66c..c45319e 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 _0x92c0=['../client','getSettings','Request','ShowSetting'];(function(_0x19cf1a,_0x4e13b8){var _0x36fc41=function(_0x14a495){while(--_0x14a495){_0x19cf1a['push'](_0x19cf1a['shift']());}};_0x36fc41(++_0x4e13b8);}(_0x92c0,0xdc));var _0x092c=function(_0x230f58,_0x1f8377){_0x230f58=_0x230f58-0x0;var _0x3fdd2c=_0x92c0[_0x230f58];return _0x3fdd2c;};'use strict';var client=require(_0x092c('0x0'));exports[_0x092c('0x1')]=function(){return client[_0x092c('0x2')](_0x092c('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':'GetSettings'});}; \ No newline at end of file +var _0xf4fb=['../client','getSettings','Request','loginMailFrequency','GetSettings'];(function(_0x10f82c,_0x4f46a8){var _0x5abc62=function(_0x18d82a){while(--_0x18d82a){_0x10f82c['push'](_0x10f82c['shift']());}};_0x5abc62(++_0x4f46a8);}(_0xf4fb,0x1f4));var _0xbf4f=function(_0x4d6004,_0x226e17){_0x4d6004=_0x4d6004-0x0;var _0x16b869=_0xf4fb[_0x4d6004];return _0x16b869;};'use strict';var client=require(_0xbf4f('0x0'));exports[_0xbf4f('0x1')]=function(){return client[_0xbf4f('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbf4f('0x3')]},'log':_0xbf4f('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 1c0b91f..f73861e 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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 c48085a..3f153a9 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 _0xb9c2=['createServer','timeout','socket.io','redis','socket.io-redis','../../config/triggers','default','../../routes','once','listening','log','port','exports','lodash','http','sticky-session','ioredis','../../config/environment'];(function(_0xea7461,_0x357cdb){var _0x48a33b=function(_0xb714d7){while(--_0xb714d7){_0xea7461['push'](_0xea7461['shift']());}};_0x48a33b(++_0x357cdb);}(_0xb9c2,0xc1));var _0x2b9c=function(_0x2f7aa6,_0x2072e5){_0x2f7aa6=_0x2f7aa6-0x0;var _0x18d006=_0xb9c2[_0x2f7aa6];return _0x18d006;};'use strict';var _=require(_0x2b9c('0x0'));var http=require(_0x2b9c('0x1'));var express=require('express');var sticky=require(_0x2b9c('0x2'));var Redis=require(_0x2b9c('0x3'));var config=require(_0x2b9c('0x4'));var app=express();var server=http[_0x2b9c('0x5')](app);server[_0x2b9c('0x6')]=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0x2b9c('0x7'))(server,{'transports':['websocket','polling']});config[_0x2b9c('0x8')]=_['defaults'](config[_0x2b9c('0x8')],{'host':'localhost','port':0x18eb});socketio['adapter'](require(_0x2b9c('0x9'))({'pubClient':new Redis(config[_0x2b9c('0x8')]),'subClient':new Redis(config[_0x2b9c('0x8')])}));require(_0x2b9c('0xa'))[_0x2b9c('0xb')]();require('../../config/socketio')[_0x2b9c('0xb')](socketio);require('../../config/express')[_0x2b9c('0xb')](app);require(_0x2b9c('0xc'))['default'](app);}else{server[_0x2b9c('0xd')](_0x2b9c('0xe'),function(){console[_0x2b9c('0xf')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x2b9c('0x10')]);});}exports=module[_0x2b9c('0x11')]=app; \ No newline at end of file +var _0x9e04=['Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','http','express','ioredis','createServer','timeout','listen','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log'];(function(_0xadfd35,_0x2c7539){var _0x325805=function(_0x5ecdfa){while(--_0x5ecdfa){_0xadfd35['push'](_0xadfd35['shift']());}};_0x325805(++_0x2c7539);}(_0x9e04,0x10b));var _0x49e0=function(_0x277e87,_0x2e2de8){_0x277e87=_0x277e87-0x0;var _0x13d780=_0x9e04[_0x277e87];return _0x13d780;};'use strict';var _=require('lodash');var http=require(_0x49e0('0x0'));var express=require(_0x49e0('0x1'));var sticky=require('sticky-session');var Redis=require(_0x49e0('0x2'));var config=require('../../config/environment');var app=express();var server=http[_0x49e0('0x3')](app);server[_0x49e0('0x4')]=0xdbba0;if(sticky[_0x49e0('0x5')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':[_0x49e0('0x6'),_0x49e0('0x7')]});config[_0x49e0('0x8')]=_[_0x49e0('0x9')](config[_0x49e0('0x8')],{'host':_0x49e0('0xa'),'port':0x18eb});socketio[_0x49e0('0xb')](require(_0x49e0('0xc'))({'pubClient':new Redis(config[_0x49e0('0x8')]),'subClient':new Redis(config[_0x49e0('0x8')])}));require(_0x49e0('0xd'))[_0x49e0('0xe')]();require(_0x49e0('0xf'))[_0x49e0('0xe')](socketio);require(_0x49e0('0x10'))[_0x49e0('0xe')](app);require(_0x49e0('0x11'))[_0x49e0('0xe')](app);}else{server[_0x49e0('0x12')](_0x49e0('0x13'),function(){console[_0x49e0('0x14')](_0x49e0('0x15'),config[_0x49e0('0x16')]);});}exports=module[_0x49e0('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index d99cd3a..2a9e2da 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 _0x3851=['message','catch','exports','jayson/promise','../../config/logger','routing','client','http','Request','request','then','debug','rpc','error'];(function(_0x2549be,_0x1878d8){var _0x3dd872=function(_0x341808){while(--_0x341808){_0x2549be['push'](_0x2549be['shift']());}};_0x3dd872(++_0x1878d8);}(_0x3851,0xe3));var _0x1385=function(_0x48338c,_0x579750){_0x48338c=_0x48338c-0x0;var _0x411564=_0x3851[_0x48338c];return _0x411564;};'use strict';var jayson=require(_0x1385('0x0'));var BPromise=require('bluebird');var logger=require(_0x1385('0x1'))(_0x1385('0x2'));var client=jayson[_0x1385('0x3')][_0x1385('0x4')]({'port':0x2329});client[_0x1385('0x5')]=function(_0x4f9489,_0x47ff6e){return new BPromise(function(_0x42d4dd,_0x10d70d){return client[_0x1385('0x6')](_0x4f9489,_0x47ff6e)[_0x1385('0x7')](function(_0x5afc3d){logger[_0x1385('0x8')](_0x1385('0x9'),_0x1385('0x2'),_0x4f9489,_0x47ff6e,_0x5afc3d);if(_0x5afc3d[_0x1385('0xa')]){logger[_0x1385('0xa')](_0x1385('0x9'),_0x1385('0x2'),_0x4f9489,_0x5afc3d['error']['message'],_0x47ff6e);return _0x10d70d(_0x5afc3d[_0x1385('0xa')][_0x1385('0xb')]);}else{return _0x42d4dd(_0x5afc3d['result']);}})[_0x1385('0xc')](function(_0x491f83){logger[_0x1385('0xa')](_0x1385('0x9'),'routing',_0x4f9489,_0x491f83,_0x47ff6e);return _0x10d70d(_0x491f83);});});};module[_0x1385('0xd')]=client; \ No newline at end of file +var _0xdb48=['bluebird','../../config/logger','routing','client','http','Request','request','debug','rpc','error','message','result','catch','exports','jayson/promise'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xdb48,0xfe));var _0x8db4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xdb48[_0x550d12];return _0x12103d;};'use strict';var jayson=require(_0x8db4('0x0'));var BPromise=require(_0x8db4('0x1'));var logger=require(_0x8db4('0x2'))(_0x8db4('0x3'));var client=jayson[_0x8db4('0x4')][_0x8db4('0x5')]({'port':0x2329});client[_0x8db4('0x6')]=function(_0x1317ff,_0x2972c9){return new BPromise(function(_0x5e350b,_0x4d94ab){return client[_0x8db4('0x7')](_0x1317ff,_0x2972c9)['then'](function(_0x11b9bf){logger[_0x8db4('0x8')](_0x8db4('0x9'),_0x8db4('0x3'),_0x1317ff,_0x2972c9,_0x11b9bf);if(_0x11b9bf[_0x8db4('0xa')]){logger['error'](_0x8db4('0x9'),_0x8db4('0x3'),_0x1317ff,_0x11b9bf['error'][_0x8db4('0xb')],_0x2972c9);return _0x4d94ab(_0x11b9bf[_0x8db4('0xa')][_0x8db4('0xb')]);}else{return _0x5e350b(_0x11b9bf[_0x8db4('0xc')]);}})[_0x8db4('0xd')](function(_0x1f76fa){logger[_0x8db4('0xa')](_0x8db4('0x9'),_0x8db4('0x3'),_0x1317ff,_0x1f76fa,_0x2972c9);return _0x4d94ab(_0x1f76fa);});});};module[_0x8db4('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 49c37cd..21e7f67 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 _0x2fc0=['initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','listen','catch','log','./server','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues'];(function(_0xdb6101,_0x2b0dac){var _0x3ce290=function(_0x25697d){while(--_0x25697d){_0xdb6101['push'](_0xdb6101['shift']());}};_0x3ce290(++_0x2b0dac);}(_0x2fc0,0x6a));var _0x02fc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2fc0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require('bluebird');var server=require(_0x02fc('0x0'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0x02fc('0x1'));var openchannelQueue=require(_0x02fc('0x2'));var chatQueue=require(_0x02fc('0x3'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x02fc('0x4'));var faxQueue=require(_0x02fc('0x5'));var whatsappQueue=require(_0x02fc('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x02fc('0x7')]()[_0x02fc('0x8')](user['getAgents']())[_0x02fc('0x8')](realtime['initAgents']())['then'](interval[_0x02fc('0x9')]())['then'](realtime[_0x02fc('0xa')]())[_0x02fc('0x8')](openchannelQueue[_0x02fc('0xb')]())[_0x02fc('0x8')](realtime[_0x02fc('0xc')]())[_0x02fc('0x8')](chatQueue[_0x02fc('0xd')]())[_0x02fc('0x8')](realtime[_0x02fc('0xe')]())[_0x02fc('0x8')](smsQueue[_0x02fc('0xf')]())['then'](realtime[_0x02fc('0x10')]())['then'](mailQueue[_0x02fc('0x11')]())[_0x02fc('0x8')](realtime[_0x02fc('0x12')]())[_0x02fc('0x8')](faxQueue[_0x02fc('0x13')]())[_0x02fc('0x8')](realtime['initFaxQueues']())[_0x02fc('0x8')](whatsappQueue[_0x02fc('0x14')]())['then'](realtime['initWhatsappQueues']())[_0x02fc('0x8')](function(){return realtime;});}function main(){return server[_0x02fc('0x15')](realtime)[_0x02fc('0x8')](function(_0x2a12bd){return initRealtime();})['then'](function(_0x3658da){return setInterval(initRealtime,0x1388);})[_0x02fc('0x16')](function(_0x2f1efa){console[_0x02fc('0x17')](_0x2f1efa);});}main(); \ No newline at end of file +var _0xd887=['initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd887,0x14a));var _0x7d88=function(_0x206096,_0x1c6cfd){_0x206096=_0x206096-0x0;var _0x3f3b50=_0xd887[_0x206096];return _0x3f3b50;};'use strict';var BPromise=require(_0x7d88('0x0'));var server=require(_0x7d88('0x1'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0x7d88('0x2'));var openchannelQueue=require(_0x7d88('0x3'));var chatQueue=require(_0x7d88('0x4'));var smsQueue=require(_0x7d88('0x5'));var mailQueue=require(_0x7d88('0x6'));var faxQueue=require(_0x7d88('0x7'));var whatsappQueue=require(_0x7d88('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x7d88('0x9')]()[_0x7d88('0xa')](user[_0x7d88('0xb')]())[_0x7d88('0xa')](realtime[_0x7d88('0xc')]())[_0x7d88('0xa')](interval['getIntervals']())[_0x7d88('0xa')](realtime[_0x7d88('0xd')]())[_0x7d88('0xa')](openchannelQueue[_0x7d88('0xe')]())[_0x7d88('0xa')](realtime[_0x7d88('0xf')]())['then'](chatQueue[_0x7d88('0x10')]())['then'](realtime[_0x7d88('0x11')]())[_0x7d88('0xa')](smsQueue['getSmsQueues']())['then'](realtime[_0x7d88('0x12')]())[_0x7d88('0xa')](mailQueue[_0x7d88('0x13')]())[_0x7d88('0xa')](realtime[_0x7d88('0x14')]())[_0x7d88('0xa')](faxQueue['getFaxQueues']())[_0x7d88('0xa')](realtime[_0x7d88('0x15')]())[_0x7d88('0xa')](whatsappQueue[_0x7d88('0x16')]())[_0x7d88('0xa')](realtime[_0x7d88('0x17')]())[_0x7d88('0xa')](function(){return realtime;});}function main(){return server[_0x7d88('0x18')](realtime)[_0x7d88('0xa')](function(_0x79dd91){return initRealtime();})['then'](function(_0xd5bda7){return setInterval(initRealtime,0x1388);})[_0x7d88('0x19')](function(_0x116b3b){console[_0x7d88('0x1a')](_0x116b3b);});}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 209718a..97d6d5a 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x29ae46,_0x1dda5b){var _0x5c4d8b=function(_0x59c666){while(--_0x59c666){_0x29ae46['push'](_0x29ae46['shift']());}};_0x5c4d8b(++_0x1dda5b);}(_0x814b,0x1a2));var _0xb814=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0x814b[_0x8a7e38];return _0x228609;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file +var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x4692a1,_0x41f54f){var _0x128700=function(_0x2661dc){while(--_0x2661dc){_0x4692a1['push'](_0x4692a1['shift']());}};_0x128700(++_0x41f54f);}(_0x326f,0xd1));var _0xf326=function(_0x38af97,_0x33f639){_0x38af97=_0x38af97-0x0;var _0xbc2a94=_0x326f[_0x38af97];return _0xbc2a94;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index d92c0a0..3da6e89 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 _0xbfde=['client','http','then','error','result','catch'];(function(_0x2a9e39,_0x357028){var _0x202f44=function(_0x1b7ca8){while(--_0x1b7ca8){_0x2a9e39['push'](_0x2a9e39['shift']());}};_0x202f44(++_0x357028);}(_0xbfde,0x162));var _0xebfd=function(_0x2e9df7,_0x1d2e69){_0x2e9df7=_0x2e9df7-0x0;var _0x454500=_0xbfde[_0x2e9df7];return _0x454500;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0xebfd('0x0')][_0xebfd('0x1')]({'port':0x232b});function request(_0x3ba81d,_0x27f8f0){return new BPromise(function(_0xdd7e22,_0xc30d20){return client['request'](_0x3ba81d,_0x27f8f0)[_0xebfd('0x2')](function(_0x22d158){if(_0x22d158[_0xebfd('0x3')]){return _0xc30d20(_0x22d158['error']['message']);}else{return _0xdd7e22(_0x22d158[_0xebfd('0x4')]);}})[_0xebfd('0x5')](function(_0x2ca5c0){return _0xc30d20(_0x2ca5c0);});});}exports['sendMailMessage']=function(_0x4c3551,_0x2c3c33){return request('SendMail',{'account':_0x4c3551,'message':_0x2c3c33});}; \ No newline at end of file +var _0xee34=['error','message','catch','sendMailMessage','SendMail','jayson/promise','client','http','request','then'];(function(_0x3df042,_0x4ce182){var _0xe0ef6d=function(_0x5bbfed){while(--_0x5bbfed){_0x3df042['push'](_0x3df042['shift']());}};_0xe0ef6d(++_0x4ce182);}(_0xee34,0xe1));var _0x4ee3=function(_0x5e5b78,_0xd2d9be){_0x5e5b78=_0x5e5b78-0x0;var _0x19207f=_0xee34[_0x5e5b78];return _0x19207f;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x4ee3('0x0'));var client=jayson[_0x4ee3('0x1')][_0x4ee3('0x2')]({'port':0x232b});function request(_0x46105f,_0x1cba95){return new BPromise(function(_0x122d67,_0xe0b85d){return client[_0x4ee3('0x3')](_0x46105f,_0x1cba95)[_0x4ee3('0x4')](function(_0x4dc33f){if(_0x4dc33f['error']){return _0xe0b85d(_0x4dc33f[_0x4ee3('0x5')][_0x4ee3('0x6')]);}else{return _0x122d67(_0x4dc33f['result']);}})[_0x4ee3('0x7')](function(_0x39c58d){return _0xe0b85d(_0x39c58d);});});}exports[_0x4ee3('0x8')]=function(_0x44469c,_0x18670a){return request(_0x4ee3('0x9'),{'account':_0x44469c,'message':_0x18670a});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index f982f28..43c0e70 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 _0x0ad0=['unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','chat','openchannel','fax','whatsapp','length','getChannelStatus','Status','faxStatusTime','faxCurrentCapacity','smsStatus','whatsappStatus','openchannelStatusTime','stringify','md5','emit','user:save','exports','lodash','moment','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus'];(function(_0x425738,_0x40109a){var _0x281783=function(_0x4d56ca){while(--_0x4d56ca){_0x425738['push'](_0x425738['shift']());}};_0x281783(++_0x40109a);}(_0x0ad0,0xa2));var _0x00ad=function(_0x1d458a,_0x57f3be){_0x1d458a=_0x1d458a-0x0;var _0x1bba5e=_0x0ad0[_0x1d458a];return _0x1bba5e;};'use strict';var _=require(_0x00ad('0x0'));var moment=require(_0x00ad('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x00ad('0x2'));config[_0x00ad('0x3')]=_[_0x00ad('0x4')](config[_0x00ad('0x3')],{'host':_0x00ad('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x00ad('0x3')]));function Agent(_0x49d17e){this['id']=_0x49d17e['id']||0x0;this[_0x00ad('0x6')]=_0x49d17e[_0x00ad('0x6')]||'';this['online']=_0x49d17e[_0x00ad('0x7')]||!![];this['voicePause']=_0x49d17e[_0x00ad('0x8')]||![];this[_0x00ad('0x9')]=_0x49d17e[_0x00ad('0x9')]||![];this[_0x00ad('0xa')]=_0x49d17e[_0x00ad('0xa')]||![];this['faxPause']=_0x49d17e[_0x00ad('0xb')]||![];this[_0x00ad('0xc')]=_0x49d17e[_0x00ad('0xc')]||![];this['openchannelPause']=_0x49d17e[_0x00ad('0xd')]||![];this[_0x00ad('0xe')]=_0x00ad('0xf');this[_0x00ad('0x10')]=0x0;this[_0x00ad('0x11')]=_0x49d17e['chatCapacity']||0x0;this[_0x00ad('0x12')]=0x0;this[_0x00ad('0x13')]=_0x00ad('0xf');this[_0x00ad('0x14')]=0x0;this['mailCapacity']=_0x49d17e[_0x00ad('0x15')]||0x0;this[_0x00ad('0x16')]=0x0;this[_0x00ad('0x17')]=_0x00ad('0xf');this['faxStatusTime']=0x0;this[_0x00ad('0x18')]=_0x49d17e['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']='unknown';this[_0x00ad('0x19')]=0x0;this[_0x00ad('0x1a')]=_0x49d17e['smsCapacity']||0x0;this[_0x00ad('0x1b')]=0x0;this['whatsappStatus']=_0x00ad('0xf');this[_0x00ad('0x1c')]=0x0;this[_0x00ad('0x1d')]=_0x49d17e['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x00ad('0x1e')]=_0x00ad('0xf');this['openchannelStatusTime']=0x0;this[_0x00ad('0x1f')]=_0x49d17e[_0x00ad('0x1f')]||0x0;this[_0x00ad('0x20')]=0x0;this[_0x00ad('0x21')]=![];this[_0x00ad('0x22')]=undefined;this['md5']='';this[_0x00ad('0x23')]();}Agent[_0x00ad('0x24')]['getChannelStatus']=function(_0x512430){if(this[_0x512430+_0x00ad('0x25')]>0x0){if(this[_0x512430+_0x00ad('0x26')]>0x0&&this[_0x512430+_0x00ad('0x25')]>=this[_0x512430+_0x00ad('0x26')]){return _0x00ad('0x27');}else{return _0x00ad('0x28');}}else{return _0x00ad('0x29');}};Agent[_0x00ad('0x24')][_0x00ad('0x23')]=function(){var _0x21e8ce=['mail',_0x00ad('0x2a'),_0x00ad('0x2b'),_0x00ad('0x2c'),'sms',_0x00ad('0x2d')];for(var _0x2f1714=0x0;_0x2f1714<_0x21e8ce[_0x00ad('0x2e')];_0x2f1714+=0x1){var _0x40b340=this[_0x00ad('0x2f')](_0x21e8ce[_0x2f1714]);if(this[_0x21e8ce[_0x2f1714]+_0x00ad('0x30')]!==_0x40b340){this[_0x21e8ce[_0x2f1714]+'StatusTime']=_['toNumber'](moment()['format']('x'));}this[_0x21e8ce[_0x2f1714]+'Status']=_0x40b340;}var _0x996014={'id':this['id'],'name':this[_0x00ad('0x6')],'online':this[_0x00ad('0x7')],'voicePause':this['voicePause'],'chatPause':this[_0x00ad('0x9')],'mailPause':this[_0x00ad('0xa')],'smsPause':this[_0x00ad('0xc')],'faxPause':this[_0x00ad('0xb')],'openchannelPause':this[_0x00ad('0xd')],'chatStatus':this[_0x00ad('0xe')],'chatStatusTime':this[_0x00ad('0x10')],'chatCapacity':this[_0x00ad('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x00ad('0x13')],'mailStatusTime':this[_0x00ad('0x14')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x00ad('0x16')],'faxStatus':this[_0x00ad('0x17')],'faxStatusTime':this[_0x00ad('0x31')],'faxCapacity':this[_0x00ad('0x18')],'faxCurrentCapacity':this[_0x00ad('0x32')],'smsStatus':this[_0x00ad('0x33')],'smsStatusTime':this[_0x00ad('0x19')],'smsCapacity':this[_0x00ad('0x1a')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x00ad('0x34')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x00ad('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x00ad('0x35')],'openchannelCapacity':this[_0x00ad('0x1f')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x00ad('0x22')]};var _0x55a0aa=md5(JSON[_0x00ad('0x36')](_0x996014));if(this[_0x00ad('0x37')]!==_0x55a0aa){this[_0x00ad('0x37')]=_0x55a0aa;io[_0x00ad('0x38')](_0x00ad('0x39'),_0x996014);}};module[_0x00ad('0x3a')]=Agent; \ No newline at end of file +var _0x8a34=['mailPause','faxPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailCapacity','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','mail','chat','openchannel','sms','whatsapp','length','Status','StatusTime','toNumber','format','smsPause','chatStatus','mailStatus','mailStatusTime','mailCurrentCapacity','faxStatus','faxCurrentCapacity','whatsappStatusTime','stringify','md5','emit','user:save','exports','lodash','moment','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause'];(function(_0x3ab353,_0x5d5283){var _0x1e2285=function(_0x55804f){while(--_0x55804f){_0x3ab353['push'](_0x3ab353['shift']());}};_0x1e2285(++_0x5d5283);}(_0x8a34,0x127));var _0x48a3=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0x8a34[_0x2706da];return _0x3ba87e;};'use strict';var _=require(_0x48a3('0x0'));var moment=require(_0x48a3('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x48a3('0x2'));config[_0x48a3('0x3')]=_['defaults'](config[_0x48a3('0x3')],{'host':_0x48a3('0x4'),'port':0x18eb});var io=require(_0x48a3('0x5'))(new Redis(config[_0x48a3('0x3')]));function Agent(_0x181a4c){this['id']=_0x181a4c['id']||0x0;this[_0x48a3('0x6')]=_0x181a4c['name']||'';this[_0x48a3('0x7')]=_0x181a4c[_0x48a3('0x7')]||!![];this[_0x48a3('0x8')]=_0x181a4c[_0x48a3('0x8')]||![];this[_0x48a3('0x9')]=_0x181a4c[_0x48a3('0x9')]||![];this['mailPause']=_0x181a4c[_0x48a3('0xa')]||![];this['faxPause']=_0x181a4c[_0x48a3('0xb')]||![];this['smsPause']=_0x181a4c['smsPause']||![];this[_0x48a3('0xc')]=_0x181a4c['openchannelPause']||![];this['chatStatus']=_0x48a3('0xd');this[_0x48a3('0xe')]=0x0;this['chatCapacity']=_0x181a4c[_0x48a3('0xf')]||0x0;this[_0x48a3('0x10')]=0x0;this['mailStatus']=_0x48a3('0xd');this['mailStatusTime']=0x0;this['mailCapacity']=_0x181a4c[_0x48a3('0x11')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0x48a3('0xd');this[_0x48a3('0x12')]=0x0;this[_0x48a3('0x13')]=_0x181a4c[_0x48a3('0x13')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x48a3('0x14')]=_0x48a3('0xd');this[_0x48a3('0x15')]=0x0;this[_0x48a3('0x16')]=_0x181a4c[_0x48a3('0x16')]||0x0;this[_0x48a3('0x17')]=0x0;this[_0x48a3('0x18')]=_0x48a3('0xd');this['whatsappStatusTime']=0x0;this[_0x48a3('0x19')]=_0x181a4c[_0x48a3('0x19')]||0x0;this[_0x48a3('0x1a')]=0x0;this[_0x48a3('0x1b')]='unknown';this['openchannelStatusTime']=0x0;this[_0x48a3('0x1c')]=_0x181a4c[_0x48a3('0x1c')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x48a3('0x1d')]=![];this[_0x48a3('0x1e')]=undefined;this['md5']='';this[_0x48a3('0x1f')]();}Agent[_0x48a3('0x20')][_0x48a3('0x21')]=function(_0x46bd6d){if(this[_0x46bd6d+_0x48a3('0x22')]>0x0){if(this[_0x46bd6d+'Capacity']>0x0&&this[_0x46bd6d+_0x48a3('0x22')]>=this[_0x46bd6d+_0x48a3('0x23')]){return _0x48a3('0x24');}else{return'working';}}else{return _0x48a3('0x25');}};Agent[_0x48a3('0x20')][_0x48a3('0x1f')]=function(){var _0x22e04e=[_0x48a3('0x26'),_0x48a3('0x27'),_0x48a3('0x28'),'fax',_0x48a3('0x29'),_0x48a3('0x2a')];for(var _0x42fd2c=0x0;_0x42fd2c<_0x22e04e[_0x48a3('0x2b')];_0x42fd2c+=0x1){var _0x395102=this[_0x48a3('0x21')](_0x22e04e[_0x42fd2c]);if(this[_0x22e04e[_0x42fd2c]+_0x48a3('0x2c')]!==_0x395102){this[_0x22e04e[_0x42fd2c]+_0x48a3('0x2d')]=_[_0x48a3('0x2e')](moment()[_0x48a3('0x2f')]('x'));}this[_0x22e04e[_0x42fd2c]+_0x48a3('0x2c')]=_0x395102;}var _0x522d46={'id':this['id'],'name':this[_0x48a3('0x6')],'online':this[_0x48a3('0x7')],'voicePause':this[_0x48a3('0x8')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x48a3('0x30')],'faxPause':this[_0x48a3('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x48a3('0x31')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x48a3('0xf')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x48a3('0x32')],'mailStatusTime':this[_0x48a3('0x33')],'mailCapacity':this[_0x48a3('0x11')],'mailCurrentCapacity':this[_0x48a3('0x34')],'faxStatus':this[_0x48a3('0x35')],'faxStatusTime':this[_0x48a3('0x12')],'faxCapacity':this[_0x48a3('0x13')],'faxCurrentCapacity':this[_0x48a3('0x36')],'smsStatus':this[_0x48a3('0x14')],'smsStatusTime':this[_0x48a3('0x15')],'smsCapacity':this[_0x48a3('0x16')],'smsCurrentCapacity':this[_0x48a3('0x17')],'whatsappStatus':this[_0x48a3('0x18')],'whatsappStatusTime':this[_0x48a3('0x37')],'whatsappCapacity':this[_0x48a3('0x19')],'whatsappCurrentCapacity':this[_0x48a3('0x1a')],'openchannelStatus':this[_0x48a3('0x1b')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x48a3('0x1e')]};var _0x30bc88=md5(JSON[_0x48a3('0x38')](_0x522d46));if(this[_0x48a3('0x39')]!==_0x30bc88){this[_0x48a3('0x39')]=_0x30bc88;io[_0x48a3('0x3a')](_0x48a3('0x3b'),_0x522d46);}};module[_0x48a3('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 052c15a..d98f587 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 _0x78a2=['chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','length','online','paused','available','stringify','md5','format','chat:queue:%s','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x78a2,0x17b));var _0x278a=function(_0x1bb63d,_0x3d6eb9){_0x1bb63d=_0x1bb63d-0x0;var _0x454c9b=_0x78a2[_0x1bb63d];return _0x454c9b;};'use strict';var _=require(_0x278a('0x0'));var md5=require('md5');var util=require(_0x278a('0x1'));var Redis=require(_0x278a('0x2'));var config=require(_0x278a('0x3'));config[_0x278a('0x4')]=_['defaults'](config[_0x278a('0x4')],{'host':_0x278a('0x5'),'port':0x18eb});var io=require(_0x278a('0x6'))(new Redis(config['redis']));function ChatQueue(_0x8df140){this['id']=_0x8df140['id']||0x0;this[_0x278a('0x7')]=_0x8df140['name']||'';this[_0x278a('0x8')]=_0x8df140[_0x278a('0x8')]||0xa;this['strategy']=_0x8df140['strategy']||'beepall';this['Agents']=_0x8df140[_0x278a('0x9')];this[_0x278a('0xa')]={};this[_0x278a('0xb')]=0x0;this['md5']='';this[_0x278a('0xc')]();this[_0x278a('0xd')]();}ChatQueue[_0x278a('0xe')][_0x278a('0xc')]=function(){var _0x412af5=this[_0x278a('0xa')]['_rr'];this[_0x278a('0xa')]=_[_0x278a('0xf')](this[_0x278a('0x9')],'id');this[_0x278a('0xa')][_0x278a('0x10')]=_0x412af5;};ChatQueue['prototype'][_0x278a('0xd')]=function(){this[_0x278a('0x11')]=0x0;this['paused']=0x0;for(var _0xd037c8=0x0;_0xd037c8=0x0?this[_0x278a('0x15')]:0x0;var _0x17dc7f={'id':this['id'],'available':this[_0x278a('0x15')],'loggedIn':this[_0x278a('0x11')],'name':this['name'],'paused':this[_0x278a('0x14')],'waiting':this[_0x278a('0xb')]};var _0x34d8e6=md5(JSON[_0x278a('0x16')](_0x17dc7f));if(this[_0x278a('0x17')]!==_0x34d8e6){this['md5']=_0x34d8e6;io['to'](util[_0x278a('0x18')](_0x278a('0x19'),_0x17dc7f['name']))[_0x278a('0x1a')](_0x278a('0x1b'),_0x17dc7f);}};module[_0x278a('0x1c')]=ChatQueue; \ No newline at end of file +var _0xfe39=['mapAgentsId','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','chatPause','paused','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x19dc9f,_0x509a5b){var _0x2aa779=function(_0x22607f){while(--_0x22607f){_0x19dc9f['push'](_0x19dc9f['shift']());}};_0x2aa779(++_0x509a5b);}(_0xfe39,0x1c0));var _0x9fe3=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xfe39[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x9fe3('0x0'));var md5=require(_0x9fe3('0x1'));var util=require(_0x9fe3('0x2'));var Redis=require(_0x9fe3('0x3'));var config=require(_0x9fe3('0x4'));config[_0x9fe3('0x5')]=_[_0x9fe3('0x6')](config[_0x9fe3('0x5')],{'host':_0x9fe3('0x7'),'port':0x18eb});var io=require(_0x9fe3('0x8'))(new Redis(config[_0x9fe3('0x5')]));function ChatQueue(_0x28640a){this['id']=_0x28640a['id']||0x0;this[_0x9fe3('0x9')]=_0x28640a[_0x9fe3('0x9')]||'';this[_0x9fe3('0xa')]=_0x28640a[_0x9fe3('0xa')]||0xa;this['strategy']=_0x28640a[_0x9fe3('0xb')]||_0x9fe3('0xc');this[_0x9fe3('0xd')]=_0x28640a['Agents'];this[_0x9fe3('0xe')]={};this['waiting']=0x0;this[_0x9fe3('0x1')]='';this['updateRouting']();this[_0x9fe3('0xf')]();}ChatQueue[_0x9fe3('0x10')][_0x9fe3('0x11')]=function(){var _0x531ca4=this[_0x9fe3('0xe')][_0x9fe3('0x12')];this[_0x9fe3('0xe')]=_[_0x9fe3('0x13')](this[_0x9fe3('0xd')],'id');this['mapAgentsId']['_rr']=_0x531ca4;};ChatQueue[_0x9fe3('0x10')][_0x9fe3('0xf')]=function(){this[_0x9fe3('0x14')]=0x0;this['paused']=0x0;for(var _0x1c78f7=0x0;_0x1c78f7=0x0?this[_0x9fe3('0x19')]:0x0;var _0x2bb3fd={'id':this['id'],'available':this['available'],'loggedIn':this[_0x9fe3('0x14')],'name':this[_0x9fe3('0x9')],'paused':this['paused'],'waiting':this[_0x9fe3('0x1a')]};var _0xebe4f5=md5(JSON[_0x9fe3('0x1b')](_0x2bb3fd));if(this[_0x9fe3('0x1')]!==_0xebe4f5){this['md5']=_0xebe4f5;io['to'](util[_0x9fe3('0x1c')](_0x9fe3('0x1d'),_0x2bb3fd[_0x9fe3('0x9')]))[_0x9fe3('0x1e')](_0x9fe3('0x1f'),_0x2bb3fd);}};module[_0x9fe3('0x20')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 0a00bac..3fa9aa5 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 _0x9e71=['socket.io-emitter','timeout','strategy','beepall','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','Agents','loggedIn','paused','available','name','format','fax:queue:%s','emit','fax_queue:save','lodash','md5','util','ioredis','redis','localhost'];(function(_0x19ba87,_0xea5dbc){var _0x343d62=function(_0x3cb331){while(--_0x3cb331){_0x19ba87['push'](_0x19ba87['shift']());}};_0x343d62(++_0xea5dbc);}(_0x9e71,0x192));var _0x19e7=function(_0x285ee2,_0x2b5995){_0x285ee2=_0x285ee2-0x0;var _0x56c97b=_0x9e71[_0x285ee2];return _0x56c97b;};'use strict';var _=require(_0x19e7('0x0'));var md5=require(_0x19e7('0x1'));var util=require(_0x19e7('0x2'));var Redis=require(_0x19e7('0x3'));var config=require('../../../config/environment');config[_0x19e7('0x4')]=_['defaults'](config[_0x19e7('0x4')],{'host':_0x19e7('0x5'),'port':0x18eb});var io=require(_0x19e7('0x6'))(new Redis(config[_0x19e7('0x4')]));function FaxQueue(_0x53d0cc){this['id']=_0x53d0cc['id']||0x0;this['name']=_0x53d0cc['name']||'';this[_0x19e7('0x7')]=_0x53d0cc['timeout']||0xa;this[_0x19e7('0x8')]=_0x53d0cc[_0x19e7('0x8')]||_0x19e7('0x9');this['Agents']=_0x53d0cc['Agents'];this[_0x19e7('0xa')]={};this[_0x19e7('0xb')]=0x0;this['md5']='';this['updateRouting']();this[_0x19e7('0xc')]();}FaxQueue[_0x19e7('0xd')][_0x19e7('0xe')]=function(){var _0x2d301d=this[_0x19e7('0xa')]['_rr'];this['mapAgentsId']=_['map'](this[_0x19e7('0xf')],'id');this[_0x19e7('0xa')]['_rr']=_0x2d301d;};FaxQueue[_0x19e7('0xd')][_0x19e7('0xc')]=function(){this[_0x19e7('0x10')]=0x0;this[_0x19e7('0x11')]=0x0;for(var _0x39aafb=0x0;_0x39aafb=0x0?this[_0x19e7('0x12')]:0x0;var _0x5643f0={'id':this['id'],'available':this[_0x19e7('0x12')],'loggedIn':this[_0x19e7('0x10')],'name':this[_0x19e7('0x13')],'paused':this['paused'],'waiting':this[_0x19e7('0xb')]};var _0x4895aa=md5(JSON['stringify'](_0x5643f0));if(this['md5']!==_0x4895aa){this['md5']=_0x4895aa;io['to'](util[_0x19e7('0x14')](_0x19e7('0x15'),_0x5643f0[_0x19e7('0x13')]))[_0x19e7('0x16')](_0x19e7('0x17'),_0x5643f0);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x5268=['beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','md5','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy'];(function(_0x183b97,_0x2d297c){var _0x629cf7=function(_0x4ffd24){while(--_0x4ffd24){_0x183b97['push'](_0x183b97['shift']());}};_0x629cf7(++_0x2d297c);}(_0x5268,0xdf));var _0x8526=function(_0x509e06,_0x31876d){_0x509e06=_0x509e06-0x0;var _0xb2883d=_0x5268[_0x509e06];return _0xb2883d;};'use strict';var _=require('lodash');var md5=require(_0x8526('0x0'));var util=require('util');var Redis=require(_0x8526('0x1'));var config=require(_0x8526('0x2'));config['redis']=_[_0x8526('0x3')](config[_0x8526('0x4')],{'host':_0x8526('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x5adf9f){this['id']=_0x5adf9f['id']||0x0;this[_0x8526('0x6')]=_0x5adf9f[_0x8526('0x6')]||'';this['timeout']=_0x5adf9f[_0x8526('0x7')]||0xa;this[_0x8526('0x8')]=_0x5adf9f[_0x8526('0x8')]||_0x8526('0x9');this[_0x8526('0xa')]=_0x5adf9f['Agents'];this['mapAgentsId']={};this[_0x8526('0xb')]=0x0;this[_0x8526('0x0')]='';this[_0x8526('0xc')]();this[_0x8526('0xd')]();}FaxQueue[_0x8526('0xe')][_0x8526('0xc')]=function(){var _0x287a3b=this[_0x8526('0xf')][_0x8526('0x10')];this[_0x8526('0xf')]=_['map'](this['Agents'],'id');this[_0x8526('0xf')][_0x8526('0x10')]=_0x287a3b;};FaxQueue[_0x8526('0xe')]['updateRealtime']=function(){this[_0x8526('0x11')]=0x0;this[_0x8526('0x12')]=0x0;for(var _0x4f72e6=0x0;_0x4f72e6=0x0?this[_0x8526('0x16')]:0x0;var _0x1248cf={'id':this['id'],'available':this[_0x8526('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x8526('0x6')],'paused':this['paused'],'waiting':this[_0x8526('0xb')]};var _0x39d0c0=md5(JSON[_0x8526('0x17')](_0x1248cf));if(this['md5']!==_0x39d0c0){this['md5']=_0x39d0c0;io['to'](util[_0x8526('0x18')](_0x8526('0x19'),_0x1248cf['name']))[_0x8526('0x1a')](_0x8526('0x1b'),_0x1248cf);}};module[_0x8526('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 1a9fc73..69dbfbe 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 _0xdb9d=['exports','Intervals'];(function(_0xfe4e05,_0xbf77a5){var _0x1e6d78=function(_0x1f5449){while(--_0x1f5449){_0xfe4e05['push'](_0xfe4e05['shift']());}};_0x1e6d78(++_0xbf77a5);}(_0xdb9d,0x6f));var _0xddb9=function(_0x27bcf5,_0x236765){_0x27bcf5=_0x27bcf5-0x0;var _0x4ce4cf=_0xdb9d[_0x27bcf5];return _0x4ce4cf;};'use strict';function Interval(_0x1ff65e){this['id']=_0x1ff65e['id']||0x0;this['name']=_0x1ff65e['name']||'';this[_0xddb9('0x0')]=_0x1ff65e['Intervals']||{};}module[_0xddb9('0x1')]=Interval; \ No newline at end of file +var _0x6c77=['exports','name','Intervals'];(function(_0x1c443a,_0x31a252){var _0x594afe=function(_0x13e9d6){while(--_0x13e9d6){_0x1c443a['push'](_0x1c443a['shift']());}};_0x594afe(++_0x31a252);}(_0x6c77,0x151));var _0x76c7=function(_0x5bb3a6,_0xc89ee3){_0x5bb3a6=_0x5bb3a6-0x0;var _0x279273=_0x6c77[_0x5bb3a6];return _0x279273;};'use strict';function Interval(_0x1da3cd){this['id']=_0x1da3cd['id']||0x0;this[_0x76c7('0x0')]=_0x1da3cd[_0x76c7('0x0')]||'';this[_0x76c7('0x1')]=_0x1da3cd['Intervals']||{};}module[_0x76c7('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 19eec91..68ddd5a 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 _0x2201=['updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','mailPause','available','format','emit','exports','md5','ioredis','../../../config/environment','redis','localhost','name','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x2201,0xcd));var _0x1220=function(_0x40b43e,_0x25cd65){_0x40b43e=_0x40b43e-0x0;var _0x223eb3=_0x2201[_0x40b43e];return _0x223eb3;};'use strict';var _=require('lodash');var md5=require(_0x1220('0x0'));var util=require('util');var Redis=require(_0x1220('0x1'));var config=require(_0x1220('0x2'));config['redis']=_['defaults'](config[_0x1220('0x3')],{'host':_0x1220('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1220('0x3')]));function MailQueue(_0x5a2b6c){this['id']=_0x5a2b6c['id']||0x0;this[_0x1220('0x5')]=_0x5a2b6c[_0x1220('0x5')]||'';this['timeout']=_0x5a2b6c['timeout']||0xa;this['strategy']=_0x5a2b6c['strategy']||_0x1220('0x6');this[_0x1220('0x7')]=_0x5a2b6c[_0x1220('0x7')];this[_0x1220('0x8')]={};this[_0x1220('0x9')]=0x0;this[_0x1220('0x0')]='';this[_0x1220('0xa')]();this[_0x1220('0xb')]();}MailQueue['prototype']['updateRouting']=function(){var _0x2cd2c9=this['mapAgentsId'][_0x1220('0xc')];this[_0x1220('0x8')]=_[_0x1220('0xd')](this['Agents'],'id');this[_0x1220('0x8')][_0x1220('0xc')]=_0x2cd2c9;};MailQueue[_0x1220('0xe')][_0x1220('0xb')]=function(){this[_0x1220('0xf')]=0x0;this[_0x1220('0x10')]=0x0;for(var _0x593b55=0x0;_0x593b55=0x0?this[_0x1220('0x14')]:0x0;var _0x15cdb4={'id':this['id'],'available':this[_0x1220('0x14')],'loggedIn':this[_0x1220('0xf')],'name':this[_0x1220('0x5')],'paused':this[_0x1220('0x10')],'waiting':this[_0x1220('0x9')]};var _0x5127cb=md5(JSON['stringify'](_0x15cdb4));if(this['md5']!==_0x5127cb){this[_0x1220('0x0')]=_0x5127cb;io['to'](util[_0x1220('0x15')]('mail:queue:%s',_0x15cdb4['name']))[_0x1220('0x16')]('mail_queue:save',_0x15cdb4);}};module[_0x1220('0x17')]=MailQueue; \ No newline at end of file +var _0x0817=['updateRealtime','loggedIn','paused','length','online','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map','_rr'];(function(_0x4e7f3f,_0x5c57da){var _0x441fd2=function(_0x177c74){while(--_0x177c74){_0x4e7f3f['push'](_0x4e7f3f['shift']());}};_0x441fd2(++_0x5c57da);}(_0x0817,0xcc));var _0x7081=function(_0x292e5f,_0x1efadd){_0x292e5f=_0x292e5f-0x0;var _0x57f40c=_0x0817[_0x292e5f];return _0x57f40c;};'use strict';var _=require(_0x7081('0x0'));var md5=require(_0x7081('0x1'));var util=require(_0x7081('0x2'));var Redis=require(_0x7081('0x3'));var config=require(_0x7081('0x4'));config[_0x7081('0x5')]=_[_0x7081('0x6')](config[_0x7081('0x5')],{'host':_0x7081('0x7'),'port':0x18eb});var io=require(_0x7081('0x8'))(new Redis(config['redis']));function MailQueue(_0x390ca2){this['id']=_0x390ca2['id']||0x0;this[_0x7081('0x9')]=_0x390ca2[_0x7081('0x9')]||'';this[_0x7081('0xa')]=_0x390ca2[_0x7081('0xa')]||0xa;this['strategy']=_0x390ca2[_0x7081('0xb')]||_0x7081('0xc');this[_0x7081('0xd')]=_0x390ca2[_0x7081('0xd')];this[_0x7081('0xe')]={};this[_0x7081('0xf')]=0x0;this[_0x7081('0x1')]='';this[_0x7081('0x10')]();this['updateRealtime']();}MailQueue[_0x7081('0x11')][_0x7081('0x10')]=function(){var _0x31a951=this['mapAgentsId']['_rr'];this[_0x7081('0xe')]=_[_0x7081('0x12')](this[_0x7081('0xd')],'id');this[_0x7081('0xe')][_0x7081('0x13')]=_0x31a951;};MailQueue[_0x7081('0x11')][_0x7081('0x14')]=function(){this[_0x7081('0x15')]=0x0;this[_0x7081('0x16')]=0x0;for(var _0x4a3e04=0x0;_0x4a3e04=0x0?this[_0x7081('0x19')]:0x0;var _0x13fd2a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x7081('0x15')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x7081('0xf')]};var _0x19823e=md5(JSON[_0x7081('0x1a')](_0x13fd2a));if(this[_0x7081('0x1')]!==_0x19823e){this['md5']=_0x19823e;io['to'](util[_0x7081('0x1b')](_0x7081('0x1c'),_0x13fd2a[_0x7081('0x9')]))[_0x7081('0x1d')](_0x7081('0x1e'),_0x13fd2a);}};module[_0x7081('0x1f')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index f9c611a..73f7f97 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(_0xc5a279,_0x155360){var _0xc755d3=function(_0x15051c){while(--_0x15051c){_0xc5a279['push'](_0xc5a279['shift']());}};_0xc755d3(++_0x155360);}(_0x2ef3,0xba));var _0x32ef=function(_0x2f67c9,_0xf0e24e){_0x2f67c9=_0x2f67c9-0x0;var _0x1f3ab0=_0x2ef3[_0x2f67c9];return _0x1f3ab0;};'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 _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(_0xa4928c,_0x16b89c){var _0x27cc29=function(_0x14b819){while(--_0x14b819){_0xa4928c['push'](_0xa4928c['shift']());}};_0x27cc29(++_0x16b89c);}(_0x2ef3,0xba));var _0x32ef=function(_0x540715,_0x5c910d){_0x540715=_0x540715-0x0;var _0x334ff9=_0x2ef3[_0x540715];return _0x334ff9;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index c67c7e7..298c001 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 _0xb90d=['sms_queue:save','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','length','loggedIn','available','paused','stringify','format','sms:queue:%s','emit'];(function(_0x53acc6,_0x351a19){var _0x195e4b=function(_0x1281d2){while(--_0x1281d2){_0x53acc6['push'](_0x53acc6['shift']());}};_0x195e4b(++_0x351a19);}(_0xb90d,0x17a));var _0xdb90=function(_0x40c6a7,_0x4fc99d){_0x40c6a7=_0x40c6a7-0x0;var _0x37f57d=_0xb90d[_0x40c6a7];return _0x37f57d;};'use strict';var _=require('lodash');var md5=require(_0xdb90('0x0'));var util=require(_0xdb90('0x1'));var Redis=require(_0xdb90('0x2'));var config=require(_0xdb90('0x3'));config[_0xdb90('0x4')]=_[_0xdb90('0x5')](config['redis'],{'host':_0xdb90('0x6'),'port':0x18eb});var io=require(_0xdb90('0x7'))(new Redis(config[_0xdb90('0x4')]));function SmsQueue(_0x532dbc){this['id']=_0x532dbc['id']||0x0;this['name']=_0x532dbc[_0xdb90('0x8')]||'';this[_0xdb90('0x9')]=_0x532dbc[_0xdb90('0x9')]||0xa;this[_0xdb90('0xa')]=_0x532dbc['strategy']||_0xdb90('0xb');this[_0xdb90('0xc')]=_0x532dbc[_0xdb90('0xc')];this['mapAgentsId']={};this[_0xdb90('0xd')]=0x0;this[_0xdb90('0x0')]='';this[_0xdb90('0xe')]();this[_0xdb90('0xf')]();}SmsQueue[_0xdb90('0x10')]['updateRouting']=function(){var _0x597572=this['mapAgentsId'][_0xdb90('0x11')];this[_0xdb90('0x12')]=_[_0xdb90('0x13')](this[_0xdb90('0xc')],'id');this[_0xdb90('0x12')][_0xdb90('0x11')]=_0x597572;};SmsQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x569d40=0x0;_0x569d40=0x0?this[_0xdb90('0x16')]:0x0;var _0xd50abd={'id':this['id'],'available':this[_0xdb90('0x16')],'loggedIn':this[_0xdb90('0x15')],'name':this[_0xdb90('0x8')],'paused':this[_0xdb90('0x17')],'waiting':this[_0xdb90('0xd')]};var _0x19e1bf=md5(JSON[_0xdb90('0x18')](_0xd50abd));if(this['md5']!==_0x19e1bf){this['md5']=_0x19e1bf;io['to'](util[_0xdb90('0x19')](_0xdb90('0x1a'),_0xd50abd[_0xdb90('0x8')]))[_0xdb90('0x1b')](_0xdb90('0x1c'),_0xd50abd);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x153f=['available','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','smsPause'];(function(_0xb3a57a,_0x57e8c2){var _0x199435=function(_0x465425){while(--_0x465425){_0xb3a57a['push'](_0xb3a57a['shift']());}};_0x199435(++_0x57e8c2);}(_0x153f,0x15b));var _0xf153=function(_0x305550,_0x3f5848){_0x305550=_0x305550-0x0;var _0x6101e=_0x153f[_0x305550];return _0x6101e;};'use strict';var _=require(_0xf153('0x0'));var md5=require(_0xf153('0x1'));var util=require(_0xf153('0x2'));var Redis=require(_0xf153('0x3'));var config=require(_0xf153('0x4'));config[_0xf153('0x5')]=_[_0xf153('0x6')](config['redis'],{'host':_0xf153('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf153('0x5')]));function SmsQueue(_0x2fcb1a){this['id']=_0x2fcb1a['id']||0x0;this[_0xf153('0x8')]=_0x2fcb1a[_0xf153('0x8')]||'';this[_0xf153('0x9')]=_0x2fcb1a['timeout']||0xa;this[_0xf153('0xa')]=_0x2fcb1a[_0xf153('0xa')]||_0xf153('0xb');this[_0xf153('0xc')]=_0x2fcb1a[_0xf153('0xc')];this[_0xf153('0xd')]={};this[_0xf153('0xe')]=0x0;this[_0xf153('0x1')]='';this[_0xf153('0xf')]();this[_0xf153('0x10')]();}SmsQueue['prototype'][_0xf153('0xf')]=function(){var _0x1c8de7=this[_0xf153('0xd')]['_rr'];this[_0xf153('0xd')]=_[_0xf153('0x11')](this[_0xf153('0xc')],'id');this[_0xf153('0xd')][_0xf153('0x12')]=_0x1c8de7;};SmsQueue[_0xf153('0x13')][_0xf153('0x10')]=function(){this[_0xf153('0x14')]=0x0;this[_0xf153('0x15')]=0x0;for(var _0x4c5283=0x0;_0x4c5283=0x0?this[_0xf153('0x19')]:0x0;var _0x44272e={'id':this['id'],'available':this['available'],'loggedIn':this[_0xf153('0x14')],'name':this[_0xf153('0x8')],'paused':this[_0xf153('0x15')],'waiting':this[_0xf153('0xe')]};var _0x15230c=md5(JSON[_0xf153('0x1a')](_0x44272e));if(this[_0xf153('0x1')]!==_0x15230c){this[_0xf153('0x1')]=_0x15230c;io['to'](util[_0xf153('0x1b')](_0xf153('0x1c'),_0x44272e[_0xf153('0x8')]))[_0xf153('0x1d')]('sms_queue:save',_0x44272e);}};module[_0xf153('0x1e')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 7f9479c..182de6e 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 _0x61e1=['loggedIn','length','online','whatsappPause','available','paused','waiting','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr'];(function(_0x224449,_0x29ac59){var _0xb92cb5=function(_0x1f54ae){while(--_0x1f54ae){_0x224449['push'](_0x224449['shift']());}};_0xb92cb5(++_0x29ac59);}(_0x61e1,0x129));var _0x161e=function(_0x598524,_0x43afdf){_0x598524=_0x598524-0x0;var _0xccf0eb=_0x61e1[_0x598524];return _0xccf0eb;};'use strict';var _=require(_0x161e('0x0'));var md5=require(_0x161e('0x1'));var util=require(_0x161e('0x2'));var Redis=require(_0x161e('0x3'));var config=require(_0x161e('0x4'));config['redis']=_['defaults'](config[_0x161e('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x161e('0x5')]));function WhatsappQueue(_0x42dcd5){this['id']=_0x42dcd5['id']||0x0;this[_0x161e('0x6')]=_0x42dcd5[_0x161e('0x6')]||'';this[_0x161e('0x7')]=_0x42dcd5['timeout']||0xa;this[_0x161e('0x8')]=_0x42dcd5[_0x161e('0x8')]||'beepall';this[_0x161e('0x9')]=_0x42dcd5['Agents'];this[_0x161e('0xa')]={};this['waiting']=0x0;this['md5']='';this[_0x161e('0xb')]();this[_0x161e('0xc')]();}WhatsappQueue[_0x161e('0xd')][_0x161e('0xb')]=function(){var _0x459ccd=this[_0x161e('0xa')][_0x161e('0xe')];this[_0x161e('0xa')]=_['map'](this[_0x161e('0x9')],'id');this['mapAgentsId'][_0x161e('0xe')]=_0x459ccd;};WhatsappQueue[_0x161e('0xd')][_0x161e('0xc')]=function(){this[_0x161e('0xf')]=0x0;this['paused']=0x0;for(var _0x4f8b87=0x0;_0x4f8b87=0x0?this[_0x161e('0x13')]:0x0;var _0x4d99ab={'id':this['id'],'available':this[_0x161e('0x13')],'loggedIn':this[_0x161e('0xf')],'name':this[_0x161e('0x6')],'paused':this[_0x161e('0x14')],'waiting':this[_0x161e('0x15')]};var _0xec0728=md5(JSON[_0x161e('0x16')](_0x4d99ab));if(this[_0x161e('0x1')]!==_0xec0728){this[_0x161e('0x1')]=_0xec0728;io['to'](util['format'](_0x161e('0x17'),_0x4d99ab['name']))[_0x161e('0x18')](_0x161e('0x19'),_0x4d99ab);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xb684=['paused','online','whatsappPause','available','loggedIn','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','redis','defaults','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0xbbe9f1,_0xb3e60d){var _0x5dc906=function(_0x18e52a){while(--_0x18e52a){_0xbbe9f1['push'](_0xbbe9f1['shift']());}};_0x5dc906(++_0xb3e60d);}(_0xb684,0xa6));var _0x4b68=function(_0x14f55c,_0x106a10){_0x14f55c=_0x14f55c-0x0;var _0x22dd31=_0xb684[_0x14f55c];return _0x22dd31;};'use strict';var _=require(_0x4b68('0x0'));var md5=require(_0x4b68('0x1'));var util=require(_0x4b68('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x4b68('0x3')]=_[_0x4b68('0x4')](config[_0x4b68('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4b68('0x3')]));function WhatsappQueue(_0x1d86ef){this['id']=_0x1d86ef['id']||0x0;this['name']=_0x1d86ef[_0x4b68('0x5')]||'';this[_0x4b68('0x6')]=_0x1d86ef[_0x4b68('0x6')]||0xa;this[_0x4b68('0x7')]=_0x1d86ef[_0x4b68('0x7')]||'beepall';this[_0x4b68('0x8')]=_0x1d86ef[_0x4b68('0x8')];this[_0x4b68('0x9')]={};this[_0x4b68('0xa')]=0x0;this[_0x4b68('0x1')]='';this[_0x4b68('0xb')]();this[_0x4b68('0xc')]();}WhatsappQueue[_0x4b68('0xd')][_0x4b68('0xb')]=function(){var _0x478e19=this[_0x4b68('0x9')][_0x4b68('0xe')];this['mapAgentsId']=_[_0x4b68('0xf')](this[_0x4b68('0x8')],'id');this['mapAgentsId'][_0x4b68('0xe')]=_0x478e19;};WhatsappQueue['prototype'][_0x4b68('0xc')]=function(){this['loggedIn']=0x0;this[_0x4b68('0x10')]=0x0;for(var _0x1f93a6=0x0;_0x1f93a6=0x0?this[_0x4b68('0x13')]:0x0;var _0x89b706={'id':this['id'],'available':this[_0x4b68('0x13')],'loggedIn':this[_0x4b68('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x4da3e2=md5(JSON['stringify'](_0x89b706));if(this[_0x4b68('0x1')]!==_0x4da3e2){this['md5']=_0x4da3e2;io['to'](util[_0x4b68('0x15')](_0x4b68('0x16'),_0x89b706[_0x4b68('0x5')]))[_0x4b68('0x17')](_0x4b68('0x18'),_0x89b706);}};module[_0x4b68('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index abdc2e4..f6c24f4 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x2ef549,_0xe3e55e){var _0x59422b=function(_0x2f2156){while(--_0x2f2156){_0x2ef549['push'](_0x2ef549['shift']());}};_0x59422b(++_0xe3e55e);}(_0xb10b,0x12a));var _0xbb10=function(_0x4caf4f,_0x1f9d37){_0x4caf4f=_0x4caf4f-0x0;var _0xf64dd9=_0xb10b[_0x4caf4f];return _0xf64dd9;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x33c5d1,_0x37cd6b){var _0x1c8b69=function(_0x344727){while(--_0x344727){_0x33c5d1['push'](_0x33c5d1['shift']());}};_0x1c8b69(++_0x37cd6b);}(_0xb10b,0x12a));var _0xbb10=function(_0x51ece4,_0x39165c){_0x51ece4=_0x51ece4-0x0;var _0x2b7e27=_0xb10b[_0x51ece4];return _0x2b7e27;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index a7c55cf..1e32d1b 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 _0xc029=['Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','updateChatInteraction','addTags'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xc029,0x7a));var _0x9c02=function(_0x20bbe5,_0x189723){_0x20bbe5=_0x20bbe5-0x0;var _0x1d94c7=_0xc029[_0x20bbe5];return _0x1d94c7;};'use strict';var client=require(_0x9c02('0x0'));exports[_0x9c02('0x1')]=function(_0x954092,_0x457753){return client['Request']('UpdateChatInteraction',{'body':_0x457753,'options':{'where':{'id':_0x954092}},'log':_0x9c02('0x2')});};exports[_0x9c02('0x3')]=function(_0x32ac6c,_0x51c908){return client[_0x9c02('0x4')](_0x9c02('0x5'),{'body':_0x51c908,'options':{'where':{'id':_0x32ac6c}},'log':_0x9c02('0x6')});}; \ No newline at end of file +var _0xe65c=['../client','Request','UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction'];(function(_0x476464,_0x422a44){var _0x4cd09b=function(_0x1dab6d){while(--_0x1dab6d){_0x476464['push'](_0x476464['shift']());}};_0x4cd09b(++_0x422a44);}(_0xe65c,0x156));var _0xce65=function(_0x5651ef,_0x4fd99a){_0x5651ef=_0x5651ef-0x0;var _0x392fba=_0xe65c[_0x5651ef];return _0x392fba;};'use strict';var client=require(_0xce65('0x0'));exports['update']=function(_0x140f98,_0x370e07){return client[_0xce65('0x1')](_0xce65('0x2'),{'body':_0x370e07,'options':{'where':{'id':_0x140f98}},'log':_0xce65('0x3')});};exports[_0xce65('0x4')]=function(_0x3b8928,_0x305a77){return client[_0xce65('0x1')]('AddTagsToChatInteraction',{'body':_0x305a77,'options':{'where':{'id':_0x3b8928}},'log':_0xce65('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index a420d97..3b77700 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 _0xf9eb=['createChatMessage','create','Request','CreateChatMessage'];(function(_0x57474e,_0x4178b8){var _0xfaae8c=function(_0x2e34d1){while(--_0x2e34d1){_0x57474e['push'](_0x57474e['shift']());}};_0xfaae8c(++_0x4178b8);}(_0xf9eb,0x169));var _0xbf9e=function(_0x4b040e,_0x5bb95f){_0x4b040e=_0x4b040e-0x0;var _0x1e2f00=_0xf9eb[_0x4b040e];return _0x1e2f00;};'use strict';var client=require('../client');exports[_0xbf9e('0x0')]=function(_0x426969){return client[_0xbf9e('0x1')](_0xbf9e('0x2'),{'body':_0x426969,'log':_0xbf9e('0x3')});}; \ No newline at end of file +var _0xb367=['CreateChatMessage','createChatMessage','create','Request'];(function(_0x5ae839,_0x1da370){var _0x1fafba=function(_0x167de7){while(--_0x167de7){_0x5ae839['push'](_0x5ae839['shift']());}};_0x1fafba(++_0x1da370);}(_0xb367,0x162));var _0x7b36=function(_0x192b1e,_0x578930){_0x192b1e=_0x192b1e-0x0;var _0x5db684=_0xb367[_0x192b1e];return _0x5db684;};'use strict';var client=require('../client');exports[_0x7b36('0x0')]=function(_0x303da3){return client[_0x7b36('0x1')](_0x7b36('0x2'),{'body':_0x303da3,'log':_0x7b36('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 259b706..aa508e0 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 _0xc01b=['name','timeout','strategy','Agents','online','chatPause','../client','getChatQueues','Request','GetChatQueue'];(function(_0x4cec42,_0x1ea380){var _0x84e435=function(_0x3596b9){while(--_0x3596b9){_0x4cec42['push'](_0x4cec42['shift']());}};_0x84e435(++_0x1ea380);}(_0xc01b,0x74));var _0xbc01=function(_0x52d6a1,_0x4d6211){_0x52d6a1=_0x52d6a1-0x0;var _0x48e9ad=_0xc01b[_0x52d6a1];return _0x48e9ad;};'use strict';var client=require(_0xbc01('0x0'));exports[_0xbc01('0x1')]=function(){return function(){return client[_0xbc01('0x2')](_0xbc01('0x3'),{'options':{'raw':![],'attributes':['id',_0xbc01('0x4'),_0xbc01('0x5'),_0xbc01('0x6')],'include':[{'model':'User','as':_0xbc01('0x7'),'attributes':['id',_0xbc01('0x4'),_0xbc01('0x8'),_0xbc01('0x9')]}]},'log':_0xbc01('0x1')});};}; \ No newline at end of file +var _0x3074=['name','strategy','Agents','chatPause','getChatQueues','../client','Request','GetChatQueue'];(function(_0x36d24d,_0x63dc02){var _0x5d1153=function(_0x18dc56){while(--_0x18dc56){_0x36d24d['push'](_0x36d24d['shift']());}};_0x5d1153(++_0x63dc02);}(_0x3074,0x1dd));var _0x4307=function(_0x4e6af5,_0x91e13c){_0x4e6af5=_0x4e6af5-0x0;var _0x4d36bc=_0x3074[_0x4e6af5];return _0x4d36bc;};'use strict';var client=require(_0x4307('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x4307('0x1')](_0x4307('0x2'),{'options':{'raw':![],'attributes':['id',_0x4307('0x3'),'timeout',_0x4307('0x4')],'include':[{'model':'User','as':_0x4307('0x5'),'attributes':['id',_0x4307('0x3'),'online',_0x4307('0x6')]}]},'log':_0x4307('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 3e0ca6e..5bed97e 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 _0x192f=['CreateChatQueueReport','Request','UpdateChatQueueReport','DESC','../client'];(function(_0x1ed9e5,_0x3da20f){var _0x2565b9=function(_0x35e73b){while(--_0x35e73b){_0x1ed9e5['push'](_0x1ed9e5['shift']());}};_0x2565b9(++_0x3da20f);}(_0x192f,0xd6));var _0xf192=function(_0x4108da,_0x5c052f){_0x4108da=_0x4108da-0x0;var _0xdfa050=_0x192f[_0x4108da];return _0xdfa050;};'use strict';var client=require(_0xf192('0x0'));exports['create']=function(_0x2ed899){return client['Request'](_0xf192('0x1'),{'body':_0x2ed899,'log':'CreateChatQueueReport'});};exports['update']=function(_0x3ed9c1,_0x3b704f){return client[_0xf192('0x2')](_0xf192('0x3'),{'body':_0x3b704f,'options':{'where':{'uniqueid':_0x3ed9c1},'order':[['id',_0xf192('0x4')]],'limit':0x1},'log':_0xf192('0x3')});}; \ No newline at end of file +var _0xfd28=['update','UpdateChatQueueReport','DESC','create','CreateChatQueueReport'];(function(_0x2a801b,_0x1b44d3){var _0x4bba0b=function(_0x4794a7){while(--_0x4794a7){_0x2a801b['push'](_0x2a801b['shift']());}};_0x4bba0b(++_0x1b44d3);}(_0xfd28,0x148));var _0x8fd2=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xfd28[_0x101e7b];return _0x4995c0;};'use strict';var client=require('../client');exports[_0x8fd2('0x0')]=function(_0x117219){return client['Request'](_0x8fd2('0x1'),{'body':_0x117219,'log':'CreateChatQueueReport'});};exports[_0x8fd2('0x2')]=function(_0xf7417d,_0x4e2108){return client['Request'](_0x8fd2('0x3'),{'body':_0x4e2108,'options':{'where':{'uniqueid':_0xf7417d},'order':[['id',_0x8fd2('0x4')]],'limit':0x1},'log':_0x8fd2('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 543e71e..0a5ab2b 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x271537,_0x8b7b3b){var _0x19dc22=function(_0x459bbf){while(--_0x459bbf){_0x271537['push'](_0x271537['shift']());}};_0x19dc22(++_0x8b7b3b);}(_0x7a54,0x106));var _0x47a5=function(_0x536e7c,_0x28379a){_0x536e7c=_0x536e7c-0x0;var _0x318b00=_0x7a54[_0x536e7c];return _0x318b00;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x344f15,_0x7aac9d){var _0x53e29d=function(_0x12eeeb){while(--_0x12eeeb){_0x344f15['push'](_0x344f15['shift']());}};_0x53e29d(++_0x7aac9d);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 9b888fd..e303aee 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 _0x066d=['Request','CreateFaxMessage','createFaxMessage'];(function(_0x54c25e,_0x28174f){var _0x2c4f3f=function(_0x3caa7){while(--_0x3caa7){_0x54c25e['push'](_0x54c25e['shift']());}};_0x2c4f3f(++_0x28174f);}(_0x066d,0xb1));var _0xd066=function(_0x4e6849,_0x1cb237){_0x4e6849=_0x4e6849-0x0;var _0x1b9754=_0x066d[_0x4e6849];return _0x1b9754;};'use strict';var client=require('../client');exports['create']=function(_0x80045){return client[_0xd066('0x0')](_0xd066('0x1'),{'body':_0x80045,'log':_0xd066('0x2')});}; \ No newline at end of file +var _0x07cf=['../client','create','createFaxMessage'];(function(_0x7122b5,_0x79ed62){var _0x30e0a5=function(_0x393040){while(--_0x393040){_0x7122b5['push'](_0x7122b5['shift']());}};_0x30e0a5(++_0x79ed62);}(_0x07cf,0x129));var _0xf07c=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x07cf[_0x34eb31];return _0x254994;};'use strict';var client=require(_0xf07c('0x0'));exports[_0xf07c('0x1')]=function(_0x42b033){return client['Request']('CreateFaxMessage',{'body':_0x42b033,'log':_0xf07c('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index f42b50a..14e79bc 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 _0x390f=['Request','GetFaxQueue','name','strategy','User','Agents','getFaxQueues'];(function(_0x1bd3ac,_0x43eb80){var _0x13dd51=function(_0x2520de){while(--_0x2520de){_0x1bd3ac['push'](_0x1bd3ac['shift']());}};_0x13dd51(++_0x43eb80);}(_0x390f,0x76));var _0xf390=function(_0x2fd111,_0xdcd209){_0x2fd111=_0x2fd111-0x0;var _0x467b0e=_0x390f[_0x2fd111];return _0x467b0e;};'use strict';var client=require('../client');exports[_0xf390('0x0')]=function(){return function(){return client[_0xf390('0x1')](_0xf390('0x2'),{'options':{'raw':![],'attributes':['id',_0xf390('0x3'),'timeout',_0xf390('0x4')],'include':[{'model':_0xf390('0x5'),'as':_0xf390('0x6'),'attributes':['id',_0xf390('0x3'),'online','faxPause']}]},'log':_0xf390('0x0')});};}; \ No newline at end of file +var _0xb0c1=['../client','getFaxQueues','Request','name','timeout','strategy','User','online','faxPause'];(function(_0x3cae69,_0x233c38){var _0x3128eb=function(_0x21d64e){while(--_0x21d64e){_0x3cae69['push'](_0x3cae69['shift']());}};_0x3128eb(++_0x233c38);}(_0xb0c1,0x195));var _0x1b0c=function(_0x4942b4,_0xd983ff){_0x4942b4=_0x4942b4-0x0;var _0x39986e=_0xb0c1[_0x4942b4];return _0x39986e;};'use strict';var client=require(_0x1b0c('0x0'));exports[_0x1b0c('0x1')]=function(){return function(){return client[_0x1b0c('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x1b0c('0x3'),_0x1b0c('0x4'),_0x1b0c('0x5')],'include':[{'model':_0x1b0c('0x6'),'as':'Agents','attributes':['id',_0x1b0c('0x3'),_0x1b0c('0x7'),_0x1b0c('0x8')]}]},'log':_0x1b0c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index d814d64..3654b9c 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 _0xb3c5=['UpdateFaxQueueReport','DESC','../client','Request','CreateFaxQueueReport','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb3c5,0xec));var _0x5b3c=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xb3c5[_0x465028];return _0xb783d4;};'use strict';var client=require(_0x5b3c('0x0'));exports['create']=function(_0xfcecf3){return client[_0x5b3c('0x1')](_0x5b3c('0x2'),{'body':_0xfcecf3,'log':_0x5b3c('0x2')});};exports[_0x5b3c('0x3')]=function(_0x1daa37,_0x157629){return client['Request'](_0x5b3c('0x4'),{'body':_0x157629,'options':{'where':{'uniqueid':_0x1daa37},'order':[['id',_0x5b3c('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x9324=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','create','Request'];(function(_0x575de5,_0x179f6a){var _0x1615db=function(_0x825b0a){while(--_0x825b0a){_0x575de5['push'](_0x575de5['shift']());}};_0x1615db(++_0x179f6a);}(_0x9324,0x1ea));var _0x4932=function(_0x566155,_0x275b7a){_0x566155=_0x566155-0x0;var _0x326b28=_0x9324[_0x566155];return _0x326b28;};'use strict';var client=require('../client');exports[_0x4932('0x0')]=function(_0x276110){return client[_0x4932('0x1')](_0x4932('0x2'),{'body':_0x276110,'log':_0x4932('0x2')});};exports[_0x4932('0x3')]=function(_0x4052f9,_0x187eff){return client[_0x4932('0x1')](_0x4932('0x4'),{'body':_0x187eff,'options':{'where':{'uniqueid':_0x4052f9},'order':[['id',_0x4932('0x5')]],'limit':0x1},'log':_0x4932('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 4a93371..d39800e 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 _0x0a0a=['Interval','Intervals','name','interval','getIntervals','Request','GetInterval'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0a0a,0xa5));var _0xa0a0=function(_0x1bf5b2,_0xa0a0ee){_0x1bf5b2=_0x1bf5b2-0x0;var _0x38fec5=_0x0a0a[_0x1bf5b2];return _0x38fec5;};'use strict';var client=require('../client');exports[_0xa0a0('0x0')]=function(){return function(){return client[_0xa0a0('0x1')](_0xa0a0('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xa0a0('0x3'),'as':_0xa0a0('0x4'),'attributes':['id',_0xa0a0('0x5'),_0xa0a0('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x5805=['name','interval','getIntervals','GetInterval'];(function(_0x1558ab,_0x39d1de){var _0x53b64a=function(_0x4771ed){while(--_0x4771ed){_0x1558ab['push'](_0x1558ab['shift']());}};_0x53b64a(++_0x39d1de);}(_0x5805,0x1ae));var _0x5580=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5805[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports[_0x5580('0x0')]=function(){return function(){return client['Request'](_0x5580('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x5580('0x2')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x5580('0x2'),_0x5580('0x3')]}]},'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 7c9768c..f936c6c 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 _0x3266=['addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x2b2469,_0x43a66a){var _0x47606a=function(_0x5c18e4){while(--_0x5c18e4){_0x2b2469['push'](_0x2b2469['shift']());}};_0x47606a(++_0x43a66a);}(_0x3266,0x6a));var _0x6326=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3266[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0x6326('0x0'));exports[_0x6326('0x1')]=function(_0x3a3ebd,_0x2bed83){return client[_0x6326('0x2')](_0x6326('0x3'),{'body':_0x2bed83,'options':{'where':{'id':_0x3a3ebd}},'log':_0x6326('0x4')});};exports[_0x6326('0x5')]=function(_0x265264,_0x5a6b4d){return client[_0x6326('0x2')]('AddTagsToMailInteraction',{'body':_0x5a6b4d,'options':{'where':{'id':_0x265264}},'log':_0x6326('0x6')});}; \ No newline at end of file +var _0xdd4f=['../client','Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x2b1310,_0x142e96){_0x2b1310=_0x2b1310-0x0;var _0x122b26=_0xdd4f[_0x2b1310];return _0x122b26;};'use strict';var client=require(_0xfdd4('0x0'));exports['update']=function(_0x5656ab,_0x55d8f9){return client[_0xfdd4('0x1')](_0xfdd4('0x2'),{'body':_0x55d8f9,'options':{'where':{'id':_0x5656ab}},'log':'updateMailInteraction'});};exports[_0xfdd4('0x3')]=function(_0x3175f6,_0x6b2b0d){return client['Request'](_0xfdd4('0x4'),{'body':_0x6b2b0d,'options':{'where':{'id':_0x3175f6}},'log':_0xfdd4('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 73edb6d..34257d8 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 _0xd2e3=['createMailMessage','../client'];(function(_0x26a5a2,_0x29591b){var _0x2800a4=function(_0x5a7c90){while(--_0x5a7c90){_0x26a5a2['push'](_0x26a5a2['shift']());}};_0x2800a4(++_0x29591b);}(_0xd2e3,0x187));var _0x3d2e=function(_0x570b0e,_0x3e0c2b){_0x570b0e=_0x570b0e-0x0;var _0xe9219d=_0xd2e3[_0x570b0e];return _0xe9219d;};'use strict';var client=require(_0x3d2e('0x0'));exports['create']=function(_0x29f0cb){return client['Request']('CreateMailMessage',{'body':_0x29f0cb,'log':_0x3d2e('0x1')});}; \ No newline at end of file +var _0xcbf3=['createMailMessage','../client','Request','CreateMailMessage'];(function(_0x12314f,_0x2ac7ae){var _0x3b6e61=function(_0x2b41b5){while(--_0x2b41b5){_0x12314f['push'](_0x12314f['shift']());}};_0x3b6e61(++_0x2ac7ae);}(_0xcbf3,0x1a9));var _0x3cbf=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xcbf3[_0x17928f];return _0x500b63;};'use strict';var client=require(_0x3cbf('0x0'));exports['create']=function(_0x3505ad){return client[_0x3cbf('0x1')](_0x3cbf('0x2'),{'body':_0x3505ad,'log':_0x3cbf('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 817ae3c..02bf40e 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 _0x0e10=['Agents','online','../client','getMailQueues','Request','strategy','User'];(function(_0x33f3da,_0x44e14a){var _0x4e4363=function(_0x20bccf){while(--_0x20bccf){_0x33f3da['push'](_0x33f3da['shift']());}};_0x4e4363(++_0x44e14a);}(_0x0e10,0x167));var _0x00e1=function(_0x4ad6df,_0x3e46d3){_0x4ad6df=_0x4ad6df-0x0;var _0x5c8bb0=_0x0e10[_0x4ad6df];return _0x5c8bb0;};'use strict';var client=require(_0x00e1('0x0'));exports[_0x00e1('0x1')]=function(){return function(){return client[_0x00e1('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x00e1('0x3')],'include':[{'model':_0x00e1('0x4'),'as':_0x00e1('0x5'),'attributes':['id','name',_0x00e1('0x6'),'mailPause']}]},'log':_0x00e1('0x1')});};}; \ No newline at end of file +var _0x0cf7=['getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','online','mailPause','../client'];(function(_0x2c65e2,_0x518e3a){var _0x4df129=function(_0x550137){while(--_0x550137){_0x2c65e2['push'](_0x2c65e2['shift']());}};_0x4df129(++_0x518e3a);}(_0x0cf7,0x1c1));var _0x70cf=function(_0x4a698e,_0x440a1a){_0x4a698e=_0x4a698e-0x0;var _0x534f44=_0x0cf7[_0x4a698e];return _0x534f44;};'use strict';var client=require(_0x70cf('0x0'));exports[_0x70cf('0x1')]=function(){return function(){return client[_0x70cf('0x2')](_0x70cf('0x3'),{'options':{'raw':![],'attributes':['id',_0x70cf('0x4'),_0x70cf('0x5'),_0x70cf('0x6')],'include':[{'model':_0x70cf('0x7'),'as':'Agents','attributes':['id',_0x70cf('0x4'),_0x70cf('0x8'),_0x70cf('0x9')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 18e215f..1475b4d 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 _0xfa49=['DESC','UpdateMailQueueReport','../client','Request','CreateMailQueueReport'];(function(_0x11a591,_0x3bf0b9){var _0x1d49ac=function(_0x2ccfd5){while(--_0x2ccfd5){_0x11a591['push'](_0x11a591['shift']());}};_0x1d49ac(++_0x3bf0b9);}(_0xfa49,0xac));var _0x9fa4=function(_0x525114,_0x10589d){_0x525114=_0x525114-0x0;var _0x5cdab8=_0xfa49[_0x525114];return _0x5cdab8;};'use strict';var client=require(_0x9fa4('0x0'));exports['create']=function(_0x3a2b5e){return client[_0x9fa4('0x1')]('CreateMailQueueReport',{'body':_0x3a2b5e,'log':_0x9fa4('0x2')});};exports['update']=function(_0x1393bf,_0x4e55a4){return client[_0x9fa4('0x1')]('UpdateMailQueueReport',{'body':_0x4e55a4,'options':{'where':{'uniqueid':_0x1393bf},'order':[['id',_0x9fa4('0x3')]],'limit':0x1},'log':_0x9fa4('0x4')});}; \ No newline at end of file +var _0xb534=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client'];(function(_0x5d0342,_0x15776f){var _0x1f0390=function(_0x1e7415){while(--_0x1e7415){_0x5d0342['push'](_0x5d0342['shift']());}};_0x1f0390(++_0x15776f);}(_0xb534,0xb5));var _0x4b53=function(_0x5da160,_0x1e2c32){_0x5da160=_0x5da160-0x0;var _0x4aa800=_0xb534[_0x5da160];return _0x4aa800;};'use strict';var client=require(_0x4b53('0x0'));exports[_0x4b53('0x1')]=function(_0x17aed6){return client[_0x4b53('0x2')](_0x4b53('0x3'),{'body':_0x17aed6,'log':_0x4b53('0x3')});};exports[_0x4b53('0x4')]=function(_0x47e98d,_0xd5b9da){return client[_0x4b53('0x2')](_0x4b53('0x5'),{'body':_0xd5b9da,'options':{'where':{'uniqueid':_0x47e98d},'order':[['id',_0x4b53('0x6')]],'limit':0x1},'log':_0x4b53('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 5d7fc43..c92ecf6 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 _0xce88=['Request','UpdateOpenchannelInteraction','addTags','addTagsToChatInteraction'];(function(_0x4c5ab6,_0x576d83){var _0x5263d5=function(_0x400409){while(--_0x400409){_0x4c5ab6['push'](_0x4c5ab6['shift']());}};_0x5263d5(++_0x576d83);}(_0xce88,0x180));var _0x8ce8=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xce88[_0x1caf6a];return _0x1bf493;};'use strict';var client=require('../client');exports['update']=function(_0x3e72a4,_0x1fe574){return client[_0x8ce8('0x0')](_0x8ce8('0x1'),{'body':_0x1fe574,'options':{'where':{'id':_0x3e72a4}},'log':'updateOpenchannelInteraction'});};exports[_0x8ce8('0x2')]=function(_0x566ea5,_0x5150ec){return client[_0x8ce8('0x0')]('AddTagsToOpenchannelInteraction',{'body':_0x5150ec,'options':{'where':{'id':_0x566ea5}},'log':_0x8ce8('0x3')});}; \ No newline at end of file +var _0x2e48=['update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x55a389,_0x3cf135){var _0x4aa7a3=function(_0x793645){while(--_0x793645){_0x55a389['push'](_0x55a389['shift']());}};_0x4aa7a3(++_0x3cf135);}(_0x2e48,0xc3));var _0x82e4=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x2e48[_0x4b2863];return _0x567d67;};'use strict';var client=require(_0x82e4('0x0'));exports[_0x82e4('0x1')]=function(_0x2307a9,_0x34cf6f){return client['Request'](_0x82e4('0x2'),{'body':_0x34cf6f,'options':{'where':{'id':_0x2307a9}},'log':_0x82e4('0x3')});};exports['addTags']=function(_0x36ebbe,_0x9ac632){return client[_0x82e4('0x4')](_0x82e4('0x5'),{'body':_0x9ac632,'options':{'where':{'id':_0x36ebbe}},'log':_0x82e4('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 042533f..db1ce42 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 _0x35d5=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x53f49e,_0x43d6ce){var _0x4ba71a=function(_0x1322cc){while(--_0x1322cc){_0x53f49e['push'](_0x53f49e['shift']());}};_0x4ba71a(++_0x43d6ce);}(_0x35d5,0x16f));var _0x535d=function(_0x40a190,_0x128df0){_0x40a190=_0x40a190-0x0;var _0x41ad0e=_0x35d5[_0x40a190];return _0x41ad0e;};'use strict';var client=require(_0x535d('0x0'));exports[_0x535d('0x1')]=function(_0x130330){return client[_0x535d('0x2')](_0x535d('0x3'),{'body':_0x130330,'log':_0x535d('0x4')});}; \ No newline at end of file +var _0xbed3=['create','createOpenchannelMessage','../client'];(function(_0x50450d,_0x314c15){var _0x1c391b=function(_0x3d5c86){while(--_0x3d5c86){_0x50450d['push'](_0x50450d['shift']());}};_0x1c391b(++_0x314c15);}(_0xbed3,0x1df));var _0x3bed=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbed3[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x3bed('0x0'));exports[_0x3bed('0x1')]=function(_0x5a0b60){return client['Request']('CreateOpenchannelMessage',{'body':_0x5a0b60,'log':_0x3bed('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 34888a5..7914990 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 _0x426a=['Request','GetOpenchannelQueue','name','timeout','User','online','../client','getOpenchannelQueues'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x426a,0x1c6));var _0xa426=function(_0x54ba5d,_0x134d1a){_0x54ba5d=_0x54ba5d-0x0;var _0x1699fe=_0x426a[_0x54ba5d];return _0x1699fe;};'use strict';var client=require(_0xa426('0x0'));exports[_0xa426('0x1')]=function(){return function(){return client[_0xa426('0x2')](_0xa426('0x3'),{'options':{'raw':![],'attributes':['id',_0xa426('0x4'),_0xa426('0x5'),'strategy'],'include':[{'model':_0xa426('0x6'),'as':'Agents','attributes':['id','name',_0xa426('0x7'),'openchannelPause']}]},'log':_0xa426('0x1')});};}; \ No newline at end of file +var _0x3c52=['timeout','strategy','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x3c52,0xa5));var _0x23c5=function(_0x226dda,_0x3732b7){_0x226dda=_0x226dda-0x0;var _0x57981e=_0x3c52[_0x226dda];return _0x57981e;};'use strict';var client=require(_0x23c5('0x0'));exports[_0x23c5('0x1')]=function(){return function(){return client[_0x23c5('0x2')](_0x23c5('0x3'),{'options':{'raw':![],'attributes':['id',_0x23c5('0x4'),_0x23c5('0x5'),_0x23c5('0x6')],'include':[{'model':'User','as':_0x23c5('0x7'),'attributes':['id',_0x23c5('0x4'),_0x23c5('0x8'),_0x23c5('0x9')]}]},'log':_0x23c5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index c19ad99..7c08352 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 _0x280b=['UpdateOpenchannelQueueReport','DESC','create','CreateOpenchannelQueueReport','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x280b,0x1bf));var _0xb280=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x280b[_0xbca1b1];return _0x4e1686;};'use strict';var client=require('../client');exports[_0xb280('0x0')]=function(_0x96e7a7){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x96e7a7,'log':_0xb280('0x1')});};exports[_0xb280('0x2')]=function(_0x4b5540,_0x536e29){return client['Request'](_0xb280('0x3'),{'body':_0x536e29,'options':{'where':{'uniqueid':_0x4b5540},'order':[['id',_0xb280('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x765f=['DESC','create','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport'];(function(_0x5ebe34,_0x421337){var _0x36a3ee=function(_0x1d3306){while(--_0x1d3306){_0x5ebe34['push'](_0x5ebe34['shift']());}};_0x36a3ee(++_0x421337);}(_0x765f,0x1b1));var _0xf765=function(_0x2939a6,_0x1c604f){_0x2939a6=_0x2939a6-0x0;var _0x143641=_0x765f[_0x2939a6];return _0x143641;};'use strict';var client=require('../client');exports[_0xf765('0x0')]=function(_0x312a00){return client['Request'](_0xf765('0x1'),{'body':_0x312a00,'log':_0xf765('0x1')});};exports['update']=function(_0x12a732,_0x1425cd){return client['Request'](_0xf765('0x2'),{'body':_0x1425cd,'options':{'where':{'uniqueid':_0x12a732},'order':[['id',_0xf765('0x3')]],'limit':0x1},'log':_0xf765('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 893171d..ab9019d 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 _0x97d5=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x55d1b0,_0x46fb94){var _0x17c5f7=function(_0x5e2bb5){while(--_0x5e2bb5){_0x55d1b0['push'](_0x55d1b0['shift']());}};_0x17c5f7(++_0x46fb94);}(_0x97d5,0x199));var _0x597d=function(_0x230b3c,_0x153e98){_0x230b3c=_0x230b3c-0x0;var _0x469bb3=_0x97d5[_0x230b3c];return _0x469bb3;};'use strict';var client=require(_0x597d('0x0'));exports[_0x597d('0x1')]=function(_0x2366b3,_0x552974){return client[_0x597d('0x2')](_0x597d('0x3'),{'body':_0x552974,'options':{'where':{'id':_0x2366b3}},'log':'updateSmsInteraction'});};exports[_0x597d('0x4')]=function(_0x2d89ef,_0x10ecda){return client['Request'](_0x597d('0x5'),{'body':_0x10ecda,'options':{'where':{'id':_0x2d89ef}},'log':_0x597d('0x6')});}; \ No newline at end of file +var _0x2fed=['Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x400635,_0x49a764){var _0x5b0c61=function(_0x2cb18a){while(--_0x2cb18a){_0x400635['push'](_0x400635['shift']());}};_0x5b0c61(++_0x49a764);}(_0x2fed,0x7c));var _0xd2fe=function(_0xe78084,_0x13d65b){_0xe78084=_0xe78084-0x0;var _0x15ffc3=_0x2fed[_0xe78084];return _0x15ffc3;};'use strict';var client=require(_0xd2fe('0x0'));exports[_0xd2fe('0x1')]=function(_0x35bf53,_0x1f0e53){return client[_0xd2fe('0x2')]('UpdateSmsInteraction',{'body':_0x1f0e53,'options':{'where':{'id':_0x35bf53}},'log':_0xd2fe('0x3')});};exports[_0xd2fe('0x4')]=function(_0x48707a,_0x58f3f8){return client[_0xd2fe('0x2')](_0xd2fe('0x5'),{'body':_0x58f3f8,'options':{'where':{'id':_0x48707a}},'log':_0xd2fe('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index f69cb09..511e9ac 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 _0x1070=['../client','createSmsMessage'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1070,0xd0));var _0x0107=function(_0x12cd7c,_0x3732aa){_0x12cd7c=_0x12cd7c-0x0;var _0x326331=_0x1070[_0x12cd7c];return _0x326331;};'use strict';var client=require(_0x0107('0x0'));exports['create']=function(_0x56670b){return client['Request']('CreateSmsMessage',{'body':_0x56670b,'log':_0x0107('0x1')});}; \ No newline at end of file +var _0xee3c=['createSmsMessage','create','CreateSmsMessage'];(function(_0x57a8bf,_0x40090d){var _0x568ef4=function(_0x457c6a){while(--_0x457c6a){_0x57a8bf['push'](_0x57a8bf['shift']());}};_0x568ef4(++_0x40090d);}(_0xee3c,0x10c));var _0xcee3=function(_0x1eea0a,_0x3a0c52){_0x1eea0a=_0x1eea0a-0x0;var _0x27379f=_0xee3c[_0x1eea0a];return _0x27379f;};'use strict';var client=require('../client');exports[_0xcee3('0x0')]=function(_0x112500){return client['Request'](_0xcee3('0x1'),{'body':_0x112500,'log':_0xcee3('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 5e6b4d6..adc3989 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(_0x4aa70f,_0x30edac){var _0x446fe9=function(_0x1494c6){while(--_0x1494c6){_0x4aa70f['push'](_0x4aa70f['shift']());}};_0x446fe9(++_0x30edac);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xb7e7[_0x2aec52];return _0x3b8835;};'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(_0x555be0,_0x10b9e1){var _0x214b97=function(_0x22fa25){while(--_0x22fa25){_0x555be0['push'](_0x555be0['shift']());}};_0x214b97(++_0x10b9e1);}(_0xe706,0xa3));var _0x6e70=function(_0x9cf14e,_0x57d04f){_0x9cf14e=_0x9cf14e-0x0;var _0x14877a=_0xe706[_0x9cf14e];return _0x14877a;};'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 70522c0..4ba6fda 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 _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x4ccb33,_0x2e8d20){var _0x30ce82=function(_0x8f0aed){while(--_0x8f0aed){_0x4ccb33['push'](_0x4ccb33['shift']());}};_0x30ce82(++_0x2e8d20);}(_0x3e74,0x175));var _0x43e7=function(_0x53defd,_0x341451){_0x53defd=_0x53defd-0x0;var _0x45d888=_0x3e74[_0x53defd];return _0x45d888;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x59998e,_0x82e455){var _0x10811f=function(_0x3a77a6){while(--_0x3a77a6){_0x59998e['push'](_0x59998e['shift']());}};_0x10811f(++_0x82e455);}(_0x55ca,0x126));var _0xa55c=function(_0x243f79,_0x429e45){_0x243f79=_0x243f79-0x0;var _0x460321=_0x55ca[_0x243f79];return _0x460321;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 5da1cc8..2946f14 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(_0x2f63f2,_0x3805db){var _0x33341d=function(_0x24ad6e){while(--_0x24ad6e){_0x2f63f2['push'](_0x2f63f2['shift']());}};_0x33341d(++_0x3805db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x1e90f8,_0x5916b5){var _0x1faff6=function(_0x2d6abb){while(--_0x2d6abb){_0x1e90f8['push'](_0x1e90f8['shift']());}};_0x1faff6(++_0x5916b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 ee4f2cc..2626e9f 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 _0x4148=['../client','update','Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4148,0xc6));var _0x8414=function(_0x36db65,_0x2b4af1){_0x36db65=_0x36db65-0x0;var _0x5bea6a=_0x4148[_0x36db65];return _0x5bea6a;};'use strict';var client=require(_0x8414('0x0'));exports[_0x8414('0x1')]=function(_0x140433,_0xc19cfb){return client[_0x8414('0x2')]('UpdateWhatsappInteraction',{'body':_0xc19cfb,'options':{'where':{'id':_0x140433}},'log':_0x8414('0x3')});};exports[_0x8414('0x4')]=function(_0x41ddde,_0x361d0b){return client['Request'](_0x8414('0x5'),{'body':_0x361d0b,'options':{'where':{'id':_0x41ddde}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x7bd0=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x26d153,_0x1b92bd){var _0x57941b=function(_0x584f19){while(--_0x584f19){_0x26d153['push'](_0x26d153['shift']());}};_0x57941b(++_0x1b92bd);}(_0x7bd0,0x111));var _0x07bd=function(_0x2bc1fe,_0x45da98){_0x2bc1fe=_0x2bc1fe-0x0;var _0x1a47a5=_0x7bd0[_0x2bc1fe];return _0x1a47a5;};'use strict';var client=require(_0x07bd('0x0'));exports[_0x07bd('0x1')]=function(_0x20836d,_0x3b79f2){return client[_0x07bd('0x2')](_0x07bd('0x3'),{'body':_0x3b79f2,'options':{'where':{'id':_0x20836d}},'log':_0x07bd('0x4')});};exports[_0x07bd('0x5')]=function(_0x5beba7,_0x2d7245){return client[_0x07bd('0x2')](_0x07bd('0x6'),{'body':_0x2d7245,'options':{'where':{'id':_0x5beba7}},'log':_0x07bd('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 63df0ec..482a4b2 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 _0x4674=['../client','create','Request','createWhatsappMessage'];(function(_0x5e6120,_0x85f70a){var _0x39f98d=function(_0x1bb8f9){while(--_0x1bb8f9){_0x5e6120['push'](_0x5e6120['shift']());}};_0x39f98d(++_0x85f70a);}(_0x4674,0x8c));var _0x4467=function(_0x2c194a,_0x5a8a59){_0x2c194a=_0x2c194a-0x0;var _0x3df316=_0x4674[_0x2c194a];return _0x3df316;};'use strict';var client=require(_0x4467('0x0'));exports[_0x4467('0x1')]=function(_0x1625f3){return client[_0x4467('0x2')]('CreateWhatsappMessage',{'body':_0x1625f3,'log':_0x4467('0x3')});}; \ No newline at end of file +var _0x7909=['CreateWhatsappMessage','../client','Request'];(function(_0x3baaf2,_0x894e3d){var _0x50e8b0=function(_0x35dd6f){while(--_0x35dd6f){_0x3baaf2['push'](_0x3baaf2['shift']());}};_0x50e8b0(++_0x894e3d);}(_0x7909,0x76));var _0x9790=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x7909[_0x2be8c2];return _0x97f531;};'use strict';var client=require(_0x9790('0x0'));exports['create']=function(_0x48fe5f){return client[_0x9790('0x1')](_0x9790('0x2'),{'body':_0x48fe5f,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index d5428c9..401afce 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 _0x7e5a=['../client','getWhatsappQueues','Request','name','timeout','strategy','User','Agents'];(function(_0x51b8e7,_0x5c70fb){var _0x81fd25=function(_0x20c527){while(--_0x20c527){_0x51b8e7['push'](_0x51b8e7['shift']());}};_0x81fd25(++_0x5c70fb);}(_0x7e5a,0x100));var _0xa7e5=function(_0x52a0be,_0x382e04){_0x52a0be=_0x52a0be-0x0;var _0x6d468f=_0x7e5a[_0x52a0be];return _0x6d468f;};'use strict';var client=require(_0xa7e5('0x0'));exports[_0xa7e5('0x1')]=function(){return function(){return client[_0xa7e5('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xa7e5('0x3'),_0xa7e5('0x4'),_0xa7e5('0x5')],'include':[{'model':_0xa7e5('0x6'),'as':_0xa7e5('0x7'),'attributes':['id',_0xa7e5('0x3'),'online','whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x5f51=['online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','timeout','Agents','name'];(function(_0x4f9171,_0x5431d7){var _0xa7c96a=function(_0x140726){while(--_0x140726){_0x4f9171['push'](_0x4f9171['shift']());}};_0xa7c96a(++_0x5431d7);}(_0x5f51,0x1c4));var _0x15f5=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x5f51[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x15f5('0x0'));exports[_0x15f5('0x1')]=function(){return function(){return client[_0x15f5('0x2')](_0x15f5('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x15f5('0x4'),'strategy'],'include':[{'model':'User','as':_0x15f5('0x5'),'attributes':['id',_0x15f5('0x6'),_0x15f5('0x7'),_0x15f5('0x8')]}]},'log':_0x15f5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 2867454..1a5250b 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 _0x6698=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','../client','create','Request'];(function(_0x195bba,_0x5b7581){var _0x4b17dc=function(_0x50ff0e){while(--_0x50ff0e){_0x195bba['push'](_0x195bba['shift']());}};_0x4b17dc(++_0x5b7581);}(_0x6698,0x1c4));var _0x8669=function(_0x20247a,_0x53c24c){_0x20247a=_0x20247a-0x0;var _0x4b122c=_0x6698[_0x20247a];return _0x4b122c;};'use strict';var client=require(_0x8669('0x0'));exports[_0x8669('0x1')]=function(_0x567333){return client[_0x8669('0x2')](_0x8669('0x3'),{'body':_0x567333,'log':_0x8669('0x3')});};exports['update']=function(_0x3c5a84,_0x2108dc){return client[_0x8669('0x2')](_0x8669('0x4'),{'body':_0x2108dc,'options':{'where':{'uniqueid':_0x3c5a84},'order':[['id','DESC']],'limit':0x1},'log':_0x8669('0x4')});}; \ No newline at end of file +var _0x6495=['update','UpdateWhatsappQueueReport','DESC','../client','Request','CreateWhatsappQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6495,0x177));var _0x5649=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6495[_0x2641f9];return _0x585741;};'use strict';var client=require(_0x5649('0x0'));exports['create']=function(_0xa7a116){return client[_0x5649('0x1')](_0x5649('0x2'),{'body':_0xa7a116,'log':_0x5649('0x2')});};exports[_0x5649('0x3')]=function(_0x2f3df9,_0x57761f){return client[_0x5649('0x1')](_0x5649('0x4'),{'body':_0x57761f,'options':{'where':{'uniqueid':_0x2f3df9},'order':[['id',_0x5649('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 d49bccd..9a99df4 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 _0xee0c=['atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','util','../../../../config/logger','routing','./strategy','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','validate','length','error','message','join','stop','find','agents','timeout','createQueue'];(function(_0x582ae6,_0x57aa08){var _0x303447=function(_0x158d7b){while(--_0x158d7b){_0x582ae6['push'](_0x582ae6['shift']());}};_0x303447(++_0x57aa08);}(_0xee0c,0x1dc));var _0xcee0=function(_0x2a6fd5,_0x3d6deb){_0x2a6fd5=_0x2a6fd5-0x0;var _0x43c6a4=_0xee0c[_0x2a6fd5];return _0x43c6a4;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xcee0('0x0'));var seqqueue=require('seq-queue');var logger=require(_0xcee0('0x1'))(_0xcee0('0x2'));var strategy=require(_0xcee0('0x3'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xcee0('0x4')}});function writeLog(_0x62ac0a,_0x3120f1,_0xee8260){return logger['info'](util[_0xcee0('0x5')](_0xcee0('0x6'),_0x62ac0a,_0x3120f1[_0xcee0('0x7')],_0xee8260));}function handleFindAgent(_0x15f87b){return function(_0x352224){return _0x352224['name'][_0xcee0('0x8')]()===_0x15f87b[_0xcee0('0x8')]();};}exports['consequence']=function(_0x52d569,_0x2ca136,_0x5c5fed,_0x27bc53){return function(_0x4317db){try{var _0x279f6b={'name':_0x2ca136[0x0],'timeout':_0x2ca136[0x1]};var _0xa12270=queue[_0xcee0('0x9')](_0x279f6b,{'typecast':!![]});if(_0xa12270[_0xcee0('0xa')]){logger[_0xcee0('0xb')]('[%s][AGENT]\x20%s',_0x52d569,_['map'](_0xa12270,_0xcee0('0xc'))[_0xcee0('0xd')](',\x20'));_0x4317db[_0xcee0('0xe')]();}else{var _0x35983e=_[_0xcee0('0xf')](_0x5c5fed[_0xcee0('0x10')],handleFindAgent(_0x279f6b['name']));if(_0x35983e){var _0x59e58d=(_0x279f6b[_0xcee0('0x11')]||0xa)*0x3e8;var _0x44df0b,_0x11b486;var _0xf801f9=seqqueue[_0xcee0('0x12')](_0x59e58d);_0xf801f9['id']=_0x52d569;_0xf801f9[_0xcee0('0x13')]=_0x59e58d;_0xf801f9[_0xcee0('0x14')]=_0x27bc53[_0xcee0('0x14')];writeLog(_0x52d569,_0x35983e,util['format'](_0xcee0('0x15'),_0x59e58d));_0x5c5fed[_0xcee0('0x16')][_0x52d569]['on'](_0xcee0('0x17'),function(){logger[_0xcee0('0x18')](_0xcee0('0x19'),_0x52d569);clearTimeout(_0x11b486);_0x11b486=undefined;_0xf801f9['close']();if(_0x5c5fed['rules'][_0x52d569]){delete _0x5c5fed['rules'][_0x52d569];}_0x4317db['stop']();});_0x5c5fed[_0xcee0('0x16')][_0x52d569]['on'](_0xcee0('0x1a'),function(){if(_0x5c5fed[_0xcee0('0x16')][_0x52d569]){delete _0x5c5fed[_0xcee0('0x16')][_0x52d569];}});_0x11b486=setTimeout(function(){logger['info'](_0xcee0('0x1b'),_0x52d569);clearTimeout(_0x11b486);_0xf801f9['close']();_0x4317db['next']();},_0x59e58d);strategy[_0xcee0('0x1c')](_0xf801f9,_0x35983e,_0x5c5fed,_0x27bc53);}else{logger[_0xcee0('0xb')](_0xcee0('0x1d'),_0x52d569,_0x279f6b[_0xcee0('0x7')]);_0x4317db['stop']();}}}catch(_0x40898a){console[_0xcee0('0x1e')](_0x40898a);logger[_0xcee0('0xb')](_0xcee0('0x1f'),_0x52d569,_0x40898a[_0xcee0('0x20')]);_0x4317db['stop']();}};}; \ No newline at end of file +var _0x5c3b=['name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','map','join','stop','find','agents','timeout','createQueue','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','./strategy'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5c3b,0x1aa));var _0xb5c3=function(_0x5d942e,_0x15a6f0){_0x5d942e=_0x5d942e-0x0;var _0x1549f9=_0x5c3b[_0x5d942e];return _0x1549f9;};'use strict';var schema=require(_0xb5c3('0x0'));var _=require(_0xb5c3('0x1'));var util=require(_0xb5c3('0x2'));var seqqueue=require(_0xb5c3('0x3'));var logger=require(_0xb5c3('0x4'))('routing');var strategy=require(_0xb5c3('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xb5c3('0x6')},'timeout':{'type':_0xb5c3('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x273361,_0x5ee01a,_0xf7fab8){return logger[_0xb5c3('0x8')](util[_0xb5c3('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x273361,_0x5ee01a[_0xb5c3('0xa')],_0xf7fab8));}function handleFindAgent(_0x33172e){return function(_0x5f15bb){return _0x5f15bb['name'][_0xb5c3('0xb')]()===_0x33172e['toLowerCase']();};}exports[_0xb5c3('0xc')]=function(_0xe691,_0x9da8f1,_0x38ad69,_0x9f2f1d){return function(_0x49ad62){try{var _0x23d5df={'name':_0x9da8f1[0x0],'timeout':_0x9da8f1[0x1]};var _0x2e35a3=queue['validate'](_0x23d5df,{'typecast':!![]});if(_0x2e35a3['length']){logger[_0xb5c3('0xd')](_0xb5c3('0xe'),_0xe691,_[_0xb5c3('0xf')](_0x2e35a3,'message')[_0xb5c3('0x10')](',\x20'));_0x49ad62[_0xb5c3('0x11')]();}else{var _0x41439b=_[_0xb5c3('0x12')](_0x38ad69[_0xb5c3('0x13')],handleFindAgent(_0x23d5df['name']));if(_0x41439b){var _0x4b31db=(_0x23d5df[_0xb5c3('0x14')]||0xa)*0x3e8;var _0x4a6b44,_0x31fcef;var _0x22eb2b=seqqueue[_0xb5c3('0x15')](_0x4b31db);_0x22eb2b['id']=_0xe691;_0x22eb2b[_0xb5c3('0x16')]=_0x4b31db;_0x22eb2b[_0xb5c3('0x17')]=_0x9f2f1d[_0xb5c3('0x17')];writeLog(_0xe691,_0x41439b,util[_0xb5c3('0x9')]('START:%s',_0x4b31db));_0x38ad69[_0xb5c3('0x18')][_0xe691]['on'](_0xb5c3('0x19'),function(){logger[_0xb5c3('0x8')](_0xb5c3('0x1a'),_0xe691);clearTimeout(_0x31fcef);_0x31fcef=undefined;_0x22eb2b[_0xb5c3('0x1b')]();if(_0x38ad69['rules'][_0xe691]){delete _0x38ad69[_0xb5c3('0x18')][_0xe691];}_0x49ad62[_0xb5c3('0x11')]();});_0x38ad69[_0xb5c3('0x18')][_0xe691]['on'](_0xb5c3('0x1c'),function(){if(_0x38ad69[_0xb5c3('0x18')][_0xe691]){delete _0x38ad69[_0xb5c3('0x18')][_0xe691];}});_0x31fcef=setTimeout(function(){logger[_0xb5c3('0x8')](_0xb5c3('0x1d'),_0xe691);clearTimeout(_0x31fcef);_0x22eb2b[_0xb5c3('0x1b')]();_0x49ad62[_0xb5c3('0x1e')]();},_0x4b31db);strategy[_0xb5c3('0x1f')](_0x22eb2b,_0x41439b,_0x38ad69,_0x9f2f1d);}else{logger[_0xb5c3('0xd')](_0xb5c3('0x20'),_0xe691,_0x23d5df[_0xb5c3('0xa')]);_0x49ad62['stop']();}}}catch(_0x2285ca){console[_0xb5c3('0x21')](_0x2285ca);logger['error'](_0xb5c3('0x22'),_0xe691,_0x2285ca[_0xb5c3('0x23')]);_0x49ad62[_0xb5c3('0x11')]();}};}; \ 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 bdaf860..109e163 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 _0xcd99=['account','upperFirst','InteractionId','created','getMustacheRender','Message','create','then','body','catch','error','stringify','finally','stop','LexRuntime','toString','postText','message','providerName','amazonlex','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','interaction','chat'];(function(_0x8dba22,_0x452588){var _0x1c67c6=function(_0x774a7f){while(--_0x774a7f){_0x8dba22['push'](_0x8dba22['shift']());}};_0x1c67c6(++_0x452588);}(_0xcd99,0x1c7));var _0x9cd9=function(_0x37f8ba,_0x2f8f08){_0x37f8ba=_0x37f8ba-0x0;var _0x5b2648=_0xcd99[_0x37f8ba];return _0x5b2648;};'use strict';var _=require(_0x9cd9('0x0'));var moment=require(_0x9cd9('0x1'));var AWS=require(_0x9cd9('0x2'));var utils=require(_0x9cd9('0x3'));var logger=require(_0x9cd9('0x4'))(_0x9cd9('0x5'));var rpc={'chatMessage':require(_0x9cd9('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x9cd9('0x7')),'smsMessage':require(_0x9cd9('0x8')),'faxMessage':require(_0x9cd9('0x9')),'whatsappMessage':require(_0x9cd9('0xa'))};exports[_0x9cd9('0xb')]=function(_0x5edae4,_0x56d34b){return function(_0x4f18e7){try{if(!_[_0x9cd9('0xc')](this['interaction'][_0x9cd9('0xd')])){logger[_0x9cd9('0xe')](_0x9cd9('0xf'),_0x5edae4,_0x9cd9('0x10'));return _0x4f18e7[_0x9cd9('0x11')]();}var _0x3b3cea={'ContactId':this[_0x9cd9('0x12')]['id'],'sentAt':moment()['format'](_0x9cd9('0x13')),'direction':_0x9cd9('0x14')};if(this[_0x9cd9('0x15')]===_0x9cd9('0x16')||this[_0x9cd9('0x15')]==='whatsapp'){_0x3b3cea['phone']=this[_0x9cd9('0x17')]['phone'];}var _0x2b7377=this['channel'];if(_0x2b7377===_0x9cd9('0x18')){_0x3b3cea['ChatWebsiteId']=this[_0x9cd9('0x19')]['id'];}else{_0x3b3cea[_[_0x9cd9('0x1a')](_0x2b7377)+'AccountId']=this[_0x9cd9('0x19')]['id'];}_0x3b3cea[_['upperFirst'](_0x2b7377)+_0x9cd9('0x1b')]=this[_0x9cd9('0x17')]['id'];if(this[_0x9cd9('0x17')][_0x9cd9('0x1c')]){var _0xc9c2eb=_0x56d34b[0x4];if(!_['isEmpty'](_0xc9c2eb)){_0x3b3cea['body']=utils[_0x9cd9('0x1d')](_0xc9c2eb,this);return rpc[_0x2b7377+_0x9cd9('0x1e')][_0x9cd9('0x1f')](_0x3b3cea)[_0x9cd9('0x20')](function(_0xef78af){logger[_0x9cd9('0xe')](_0x9cd9('0xf'),_0x5edae4,_0x3b3cea[_0x9cd9('0x21')]);})[_0x9cd9('0x22')](function(_0x5f1917){logger[_0x9cd9('0x23')](_0x9cd9('0xf'),_0x5edae4,JSON[_0x9cd9('0x24')](_0x5f1917));})[_0x9cd9('0x25')](function(){logger[_0x9cd9('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5edae4);_0x4f18e7['stop']();});}else{logger[_0x9cd9('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5edae4);_0x4f18e7[_0x9cd9('0x26')]();}}else{var _0x2f2929=this;var _0x2f7a6f=new AWS[(_0x9cd9('0x27'))]({'accessKeyId':_0x56d34b[0x0],'secretAccessKey':_0x56d34b[0x1],'region':_0x56d34b[0x2]});var _0xe98752={'botAlias':'$LATEST','botName':_0x56d34b[0x3],'inputText':this['message'][_0x9cd9('0x21')],'userId':this[_0x9cd9('0x15')]+':'+this['interaction']['id'][_0x9cd9('0x28')]()};_0x2f7a6f[_0x9cd9('0x29')](_0xe98752,function(_0x1e8e58,_0x19603e){if(_0x1e8e58){logger[_0x9cd9('0x23')](_0x9cd9('0xf'),_0x5edae4,_0x1e8e58[_0x9cd9('0x2a')]);_0x4f18e7[_0x9cd9('0x11')]();}else if(_0x19603e&&_0x19603e['message']){_0x2f2929['body']['amazonlex']=_0x19603e;_0x3b3cea[_0x9cd9('0x21')]=_0x19603e[_0x9cd9('0x2a')];_0x3b3cea[_0x9cd9('0x2b')]=_0x9cd9('0x2c');_0x3b3cea[_0x9cd9('0x2d')]=JSON[_0x9cd9('0x24')](_0x19603e);return rpc[_0x2b7377+_0x9cd9('0x1e')][_0x9cd9('0x1f')](_0x3b3cea)[_0x9cd9('0x20')](function(_0x4b5688){logger[_0x9cd9('0xe')](_0x9cd9('0xf'),_0x5edae4,_0x3b3cea[_0x9cd9('0x21')]);if(_0x19603e[_0x9cd9('0x2e')]==_0x9cd9('0x2f')){_0x4f18e7['next']();}else{_0x4f18e7[_0x9cd9('0x26')]();}})[_0x9cd9('0x22')](function(_0xb91c52){logger[_0x9cd9('0x23')](_0x9cd9('0xf'),_0x5edae4,JSON['stringify'](_0xb91c52));_0x4f18e7[_0x9cd9('0x11')]();});}else{_0x4f18e7['next']();}});}}catch(_0x3e5ef0){logger[_0x9cd9('0x23')](_0x9cd9('0xf'),_0x5edae4,JSON[_0x9cd9('0x24')](_0x3e5ef0));_0x4f18e7[_0x9cd9('0x26')]();}};}; \ No newline at end of file +var _0xe680=['../../rpc/faxMessage','consequence','interaction','UserId','info','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','create','then','[%s][AMAZONLEX]\x20%s','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','providerName','amazonlex','providerResponse','Message','dialogState','Failed','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x7a68b,_0x964789){var _0x110d37=function(_0x482401){while(--_0x482401){_0x7a68b['push'](_0x7a68b['shift']());}};_0x110d37(++_0x964789);}(_0xe680,0x90));var _0x0e68=function(_0x4496c1,_0x103294){_0x4496c1=_0x4496c1-0x0;var _0xa2da11=_0xe680[_0x4496c1];return _0xa2da11;};'use strict';var _=require(_0x0e68('0x0'));var moment=require(_0x0e68('0x1'));var AWS=require(_0x0e68('0x2'));var utils=require('./utils');var logger=require(_0x0e68('0x3'))(_0x0e68('0x4'));var rpc={'chatMessage':require(_0x0e68('0x5')),'openchannelMessage':require(_0x0e68('0x6')),'mailMessage':require(_0x0e68('0x7')),'smsMessage':require(_0x0e68('0x8')),'faxMessage':require(_0x0e68('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x0e68('0xa')]=function(_0x40428e,_0x4a3e0a){return function(_0x2772bb){try{if(!_['isNil'](this[_0x0e68('0xb')][_0x0e68('0xc')])){logger[_0x0e68('0xd')]('[%s][AMAZONLEX]\x20%s',_0x40428e,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2772bb[_0x0e68('0xe')]();}var _0x19aa26={'ContactId':this[_0x0e68('0xf')]['id'],'sentAt':moment()[_0x0e68('0x10')](_0x0e68('0x11')),'direction':_0x0e68('0x12')};if(this['channel']==='sms'||this[_0x0e68('0x13')]===_0x0e68('0x14')){_0x19aa26[_0x0e68('0x15')]=this['interaction']['phone'];}var _0x4baae3=this[_0x0e68('0x13')];if(_0x4baae3===_0x0e68('0x16')){_0x19aa26[_0x0e68('0x17')]=this[_0x0e68('0x18')]['id'];}else{_0x19aa26[_[_0x0e68('0x19')](_0x4baae3)+_0x0e68('0x1a')]=this['account']['id'];}_0x19aa26[_[_0x0e68('0x19')](_0x4baae3)+_0x0e68('0x1b')]=this['interaction']['id'];if(this[_0x0e68('0xb')][_0x0e68('0x1c')]){var _0x3f71e9=_0x4a3e0a[0x4];if(!_[_0x0e68('0x1d')](_0x3f71e9)){_0x19aa26[_0x0e68('0x1e')]=utils['getMustacheRender'](_0x3f71e9,this);return rpc[_0x4baae3+'Message'][_0x0e68('0x1f')](_0x19aa26)[_0x0e68('0x20')](function(_0x34a8ff){logger[_0x0e68('0xd')](_0x0e68('0x21'),_0x40428e,_0x19aa26[_0x0e68('0x1e')]);})[_0x0e68('0x22')](function(_0x5d1bc3){logger[_0x0e68('0x23')]('[%s][AMAZONLEX]\x20%s',_0x40428e,JSON[_0x0e68('0x24')](_0x5d1bc3));})['finally'](function(){logger[_0x0e68('0xd')](_0x0e68('0x25'),_0x40428e);_0x2772bb[_0x0e68('0x26')]();});}else{logger[_0x0e68('0xd')](_0x0e68('0x27'),_0x40428e);_0x2772bb[_0x0e68('0x26')]();}}else{var _0xa483bc=this;var _0x26f274=new AWS[(_0x0e68('0x28'))]({'accessKeyId':_0x4a3e0a[0x0],'secretAccessKey':_0x4a3e0a[0x1],'region':_0x4a3e0a[0x2]});var _0x57f6d0={'botAlias':_0x0e68('0x29'),'botName':_0x4a3e0a[0x3],'inputText':this[_0x0e68('0x2a')][_0x0e68('0x1e')],'userId':this['channel']+':'+this[_0x0e68('0xb')]['id'][_0x0e68('0x2b')]()};_0x26f274[_0x0e68('0x2c')](_0x57f6d0,function(_0x48e0e0,_0x3e95c7){if(_0x48e0e0){logger['error'](_0x0e68('0x21'),_0x40428e,_0x48e0e0['message']);_0x2772bb[_0x0e68('0xe')]();}else if(_0x3e95c7&&_0x3e95c7[_0x0e68('0x2a')]){_0xa483bc[_0x0e68('0x1e')]['amazonlex']=_0x3e95c7;_0x19aa26[_0x0e68('0x1e')]=_0x3e95c7[_0x0e68('0x2a')];_0x19aa26[_0x0e68('0x2d')]=_0x0e68('0x2e');_0x19aa26[_0x0e68('0x2f')]=JSON[_0x0e68('0x24')](_0x3e95c7);return rpc[_0x4baae3+_0x0e68('0x30')][_0x0e68('0x1f')](_0x19aa26)[_0x0e68('0x20')](function(_0x2158c5){logger[_0x0e68('0xd')](_0x0e68('0x21'),_0x40428e,_0x19aa26['body']);if(_0x3e95c7[_0x0e68('0x31')]==_0x0e68('0x32')){_0x2772bb[_0x0e68('0xe')]();}else{_0x2772bb[_0x0e68('0x26')]();}})[_0x0e68('0x22')](function(_0x267359){logger[_0x0e68('0x23')]('[%s][AMAZONLEX]\x20%s',_0x40428e,JSON['stringify'](_0x267359));_0x2772bb['next']();});}else{_0x2772bb[_0x0e68('0xe')]();}});}}catch(_0x50ae19){logger[_0x0e68('0x23')](_0x0e68('0x21'),_0x40428e,JSON[_0x0e68('0x24')](_0x50ae19));_0x2772bb[_0x0e68('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index c46a3b2..729561a 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 _0x6050=['../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','account','AccountId','upperFirst','InteractionId','Message','inReplyTo','messageId','','replace','','headers','All','auto_reply','sendMailMessage','smtpOptions','then','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','autoreplyExecuted','Interaction','resolve','update','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x2d982d,_0x121028){var _0x4f36b0=function(_0x11f3a9){while(--_0x11f3a9){_0x2d982d['push'](_0x2d982d['shift']());}};_0x4f36b0(++_0x121028);}(_0x6050,0xc7));var _0x0605=function(_0x3d095d,_0x57cbb1){_0x3d095d=_0x3d095d-0x0;var _0x34dce3=_0x6050[_0x3d095d];return _0x34dce3;};'use strict';var _=require(_0x0605('0x0'));var moment=require(_0x0605('0x1'));var utils=require('./utils');var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var rpc={'chatMessage':require(_0x0605('0x4')),'openchannelMessage':require(_0x0605('0x5')),'mailMessage':require(_0x0605('0x6')),'smsMessage':require(_0x0605('0x7')),'faxMessage':require(_0x0605('0x8')),'whatsappMessage':require(_0x0605('0x9')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x0605('0xa')),'mailInteraction':require(_0x0605('0xb')),'smsInteraction':require(_0x0605('0xc')),'faxInteraction':require(_0x0605('0xd')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x0605('0xe'));exports['consequence']=function(_0x26ab99,_0x39f350,_0x3c1e30,_0x53912a){return function(_0x5add59){try{var _0x2e717a=this[_0x0605('0xf')];if(_0x2e717a===_0x0605('0x10')&&_0x53912a[_0x0605('0x11')][_0x0605('0x12')]){logger[_0x0605('0x13')](_0x0605('0x14'),_0x26ab99,_0x0605('0x15'));return _0x5add59[_0x0605('0x16')]();}if(_0x39f350[0x0]==='1'&&(_[_0x0605('0x17')](this[_0x0605('0x18')][_0x0605('0x19')])||!this[_0x0605('0x18')][_0x0605('0x19')])){logger[_0x0605('0x13')]('[%s][AUTOREPLY]\x20%s',_0x26ab99,_0x0605('0x1a'));return _0x5add59[_0x0605('0x16')]();}if(_0x39f350[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger['info'](_0x0605('0x1b'),_0x26ab99,_0x0605('0x1c'));return _0x5add59[_0x0605('0x16')]();}var _0x2451d3={'ContactId':this[_0x0605('0x1d')]['id'],'sentAt':moment()[_0x0605('0x1e')](_0x0605('0x1f')),'direction':_0x0605('0x20')};if(this[_0x0605('0xf')]===_0x0605('0x10')){_0x2451d3['body']=utils[_0x0605('0x21')](_0x39f350[0x2],this);}else{_0x2451d3['body']=utils[_0x0605('0x21')](_0x39f350[0x1],this);}if(this[_0x0605('0x22')]){_0x2451d3['to']=this[_0x0605('0x22')][_0x0605('0x23')]||'';if(this[_0x0605('0xf')]===_0x0605('0x10')&&_0x39f350[0x1]==='1'){_0x2451d3['cc']=this[_0x0605('0x22')]['cc']||'';}_0x2451d3[_0x0605('0x23')]=this['message']['to']||'';_0x2451d3[_0x0605('0x24')]=this[_0x0605('0x22')][_0x0605('0x24')]||'';_0x2451d3[_0x0605('0x25')]=!![];if(this[_0x0605('0x22')]['subject']){_0x2451d3[_0x0605('0x26')]='';_0x2451d3[_0x0605('0x26')]+=_['startsWith'](this[_0x0605('0x22')]['subject'],_0x0605('0x27'))?'':_0x0605('0x28');_0x2451d3[_0x0605('0x26')]+=this[_0x0605('0x22')][_0x0605('0x26')];}}if(this[_0x0605('0xf')]==='chat'){_0x2451d3['ChatWebsiteId']=this[_0x0605('0x29')]['id'];}else{_0x2451d3[_['upperFirst'](this[_0x0605('0xf')])+_0x0605('0x2a')]=this[_0x0605('0x29')]['id'];}_0x2451d3[_[_0x0605('0x2b')](this[_0x0605('0xf')])+_0x0605('0x2c')]=this['interaction']['id'];var _0xbee64=this[_0x0605('0x18')];if(rpc[this[_0x0605('0xf')]+_0x0605('0x2d')]){if(this[_0x0605('0xf')]===_0x0605('0x10')){_0x2451d3[_0x0605('0x2e')]=this[_0x0605('0x22')][_0x0605('0x2f')];_0x2451d3['html']=_0x0605('0x30')+_[_0x0605('0x31')](_0x2451d3[_0x0605('0x11')],_0x0605('0x32'),_0x0605('0x33'))+_0x0605('0x34');_0x2451d3[_0x0605('0x35')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x0605('0x36'),'Precedence':_0x0605('0x37')};return mailRpc[_0x0605('0x38')](this['account'][_0x0605('0x39')],_0x2451d3)[_0x0605('0x3a')](function(_0x20a88b){logger[_0x0605('0x13')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x26ab99);_0x2451d3[_0x0605('0x2f')]=_0x20a88b[_0x0605('0x22')][_0x0605('0x2f')];return rpc[_0x2e717a+_0x0605('0x2d')][_0x0605('0x3b')](_0x2451d3);})[_0x0605('0x3a')](function(_0x547d5){logger[_0x0605('0x13')](_0x0605('0x14'),_0x26ab99,JSON[_0x0605('0x3c')](_0x547d5));})[_0x0605('0x3d')](function(_0x3ca06b){logger[_0x0605('0x3e')](_0x0605('0x3f'),_0x26ab99,JSON['stringify'](_0x3ca06b));})[_0x0605('0x40')](function(){Promise['resolve']()[_0x0605('0x3a')](function(){if(_0x39f350[0x0]!=='2'||_0xbee64[_0x0605('0x41')])return;return rpc[_0x2e717a+_0x0605('0x42')]['update'](_0xbee64['id'],{'autoreplyExecuted':!![]})['then'](function(_0x1b7916){logger[_0x0605('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x26ab99,JSON[_0x0605('0x3c')](_0x1b7916));})[_0x0605('0x3d')](function(_0x5a5830){logger[_0x0605('0x3e')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x26ab99,JSON[_0x0605('0x3c')](_0x5a5830));});})[_0x0605('0x3a')](function(){_0x5add59[_0x0605('0x16')]();});});}else{return rpc[this[_0x0605('0xf')]+_0x0605('0x2d')][_0x0605('0x3b')](_0x2451d3)[_0x0605('0x3a')](function(){logger[_0x0605('0x13')](_0x0605('0x14'),_0x26ab99,_0x2451d3['body']);})[_0x0605('0x3d')](function(_0x5a90d7){logger[_0x0605('0x3e')](_0x0605('0x14'),_0x26ab99,JSON['stringify'](_0x5a90d7));})[_0x0605('0x40')](function(){Promise[_0x0605('0x43')]()[_0x0605('0x3a')](function(){if(_0x39f350[0x0]!=='2'||_0xbee64[_0x0605('0x41')])return;return rpc[_0x2e717a+'Interaction'][_0x0605('0x44')](_0xbee64['id'],{'autoreplyExecuted':!![]})['then'](function(_0x32c474){logger[_0x0605('0x13')](_0x0605('0x1b'),_0x26ab99,JSON[_0x0605('0x3c')](_0x32c474));})[_0x0605('0x3d')](function(_0x12a8ad){logger[_0x0605('0x3e')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x26ab99,JSON[_0x0605('0x3c')](_0x12a8ad));});})[_0x0605('0x3a')](function(){_0x5add59['next']();});});}}}catch(_0x38bd27){logger[_0x0605('0x3e')](_0x0605('0x14'),_0x26ab99,JSON[_0x0605('0x3c')](_0x38bd27));_0x5add59['stop']();}};}; \ No newline at end of file +var _0x9964=['One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','body','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','AccountId','upperFirst','Message','inReplyTo','messageId','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','update','stringify','finally','Interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','channel','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','next','autoreplyExecuted'];(function(_0x578e9d,_0x255cdc){var _0x25e281=function(_0x16f839){while(--_0x16f839){_0x578e9d['push'](_0x578e9d['shift']());}};_0x25e281(++_0x255cdc);}(_0x9964,0x1cb));var _0x4996=function(_0x311666,_0x17b07d){_0x311666=_0x311666-0x0;var _0x2bc692=_0x9964[_0x311666];return _0x2bc692;};'use strict';var _=require('lodash');var moment=require(_0x4996('0x0'));var utils=require(_0x4996('0x1'));var logger=require(_0x4996('0x2'))('routing');var rpc={'chatMessage':require(_0x4996('0x3')),'openchannelMessage':require(_0x4996('0x4')),'mailMessage':require(_0x4996('0x5')),'smsMessage':require(_0x4996('0x6')),'faxMessage':require(_0x4996('0x7')),'whatsappMessage':require(_0x4996('0x8')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x4996('0x9')),'smsInteraction':require(_0x4996('0xa')),'faxInteraction':require(_0x4996('0xb')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x4996('0xc'));exports[_0x4996('0xd')]=function(_0x59acfe,_0x257c74,_0x900e2e,_0x2c5a6e){return function(_0x1e020e){try{var _0x10a73e=this[_0x4996('0xe')];if(_0x10a73e==='mail'&&_0x2c5a6e['body'][_0x4996('0xf')]){logger[_0x4996('0x10')](_0x4996('0x11'),_0x59acfe,_0x4996('0x12'));return _0x1e020e['next']();}if(_0x257c74[0x0]==='1'&&(_[_0x4996('0x13')](this[_0x4996('0x14')][_0x4996('0x15')])||!this[_0x4996('0x14')]['created'])){logger[_0x4996('0x10')](_0x4996('0x11'),_0x59acfe,'Autoreply\x20already\x20sent');return _0x1e020e[_0x4996('0x16')]();}if(_0x257c74[0x0]==='2'&&this[_0x4996('0x14')][_0x4996('0x17')]){logger[_0x4996('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x59acfe,_0x4996('0x18'));return _0x1e020e['next']();}var _0xb8ab5f={'ContactId':this['contact']['id'],'sentAt':moment()[_0x4996('0x19')](_0x4996('0x1a')),'direction':_0x4996('0x1b')};if(this[_0x4996('0xe')]===_0x4996('0x1c')){_0xb8ab5f['body']=utils[_0x4996('0x1d')](_0x257c74[0x2],this);}else{_0xb8ab5f[_0x4996('0x1e')]=utils[_0x4996('0x1d')](_0x257c74[0x1],this);}if(this[_0x4996('0x1f')]){_0xb8ab5f['to']=this[_0x4996('0x1f')][_0x4996('0x20')]||'';if(this[_0x4996('0xe')]===_0x4996('0x1c')&&_0x257c74[0x1]==='1'){_0xb8ab5f['cc']=this['message']['cc']||'';}_0xb8ab5f[_0x4996('0x20')]=this[_0x4996('0x1f')]['to']||'';_0xb8ab5f[_0x4996('0x21')]=this[_0x4996('0x1f')][_0x4996('0x21')]||'';_0xb8ab5f[_0x4996('0x22')]=!![];if(this['message'][_0x4996('0x23')]){_0xb8ab5f[_0x4996('0x23')]='';_0xb8ab5f['subject']+=_[_0x4996('0x24')](this[_0x4996('0x1f')][_0x4996('0x23')],'Re:')?'':_0x4996('0x25');_0xb8ab5f[_0x4996('0x23')]+=this[_0x4996('0x1f')][_0x4996('0x23')];}}if(this[_0x4996('0xe')]===_0x4996('0x26')){_0xb8ab5f[_0x4996('0x27')]=this[_0x4996('0x28')]['id'];}else{_0xb8ab5f[_['upperFirst'](this[_0x4996('0xe')])+_0x4996('0x29')]=this[_0x4996('0x28')]['id'];}_0xb8ab5f[_[_0x4996('0x2a')](this[_0x4996('0xe')])+'InteractionId']=this[_0x4996('0x14')]['id'];var _0x2b4bbe=this[_0x4996('0x14')];if(rpc[this[_0x4996('0xe')]+_0x4996('0x2b')]){if(this[_0x4996('0xe')]===_0x4996('0x1c')){_0xb8ab5f[_0x4996('0x2c')]=this[_0x4996('0x1f')][_0x4996('0x2d')];_0xb8ab5f['html']=''+_['replace'](_0xb8ab5f[_0x4996('0x1e')],_0x4996('0x2e'),_0x4996('0x2f'))+_0x4996('0x30');_0xb8ab5f[_0x4996('0x31')]={'Auto-Submitted':_0x4996('0x32'),'X-Auto-Response-Suppress':_0x4996('0x33'),'Precedence':_0x4996('0x34')};return mailRpc[_0x4996('0x35')](this[_0x4996('0x28')][_0x4996('0x36')],_0xb8ab5f)[_0x4996('0x37')](function(_0x2a0ac7){logger[_0x4996('0x10')](_0x4996('0x38'),_0x59acfe);_0xb8ab5f[_0x4996('0x2d')]=_0x2a0ac7['message'][_0x4996('0x2d')];return rpc[_0x10a73e+_0x4996('0x2b')][_0x4996('0x39')](_0xb8ab5f);})[_0x4996('0x37')](function(_0xef16b2){logger[_0x4996('0x10')](_0x4996('0x11'),_0x59acfe,JSON['stringify'](_0xef16b2));})[_0x4996('0x3a')](function(_0x54c2ef){logger[_0x4996('0x3b')](_0x4996('0x3c'),_0x59acfe,JSON['stringify'](_0x54c2ef));})['finally'](function(){Promise[_0x4996('0x3d')]()[_0x4996('0x37')](function(){if(_0x257c74[0x0]!=='2'||_0x2b4bbe[_0x4996('0x17')])return;return rpc[_0x10a73e+'Interaction'][_0x4996('0x3e')](_0x2b4bbe['id'],{'autoreplyExecuted':!![]})[_0x4996('0x37')](function(_0xb38b3c){logger[_0x4996('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x59acfe,JSON[_0x4996('0x3f')](_0xb38b3c));})['catch'](function(_0x463622){logger[_0x4996('0x3b')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x59acfe,JSON[_0x4996('0x3f')](_0x463622));});})[_0x4996('0x37')](function(){_0x1e020e[_0x4996('0x16')]();});});}else{return rpc[this['channel']+_0x4996('0x2b')]['create'](_0xb8ab5f)[_0x4996('0x37')](function(){logger[_0x4996('0x10')](_0x4996('0x11'),_0x59acfe,_0xb8ab5f[_0x4996('0x1e')]);})[_0x4996('0x3a')](function(_0x3e55df){logger[_0x4996('0x3b')](_0x4996('0x11'),_0x59acfe,JSON[_0x4996('0x3f')](_0x3e55df));})[_0x4996('0x40')](function(){Promise[_0x4996('0x3d')]()[_0x4996('0x37')](function(){if(_0x257c74[0x0]!=='2'||_0x2b4bbe['autoreplyExecuted'])return;return rpc[_0x10a73e+_0x4996('0x41')][_0x4996('0x3e')](_0x2b4bbe['id'],{'autoreplyExecuted':!![]})[_0x4996('0x37')](function(_0x1a3c47){logger[_0x4996('0x10')](_0x4996('0x42'),_0x59acfe,JSON[_0x4996('0x3f')](_0x1a3c47));})[_0x4996('0x3a')](function(_0x36f7fe){logger[_0x4996('0x3b')](_0x4996('0x43'),_0x59acfe,JSON['stringify'](_0x36f7fe));});})['then'](function(){_0x1e020e[_0x4996('0x16')]();});});}}}catch(_0x17311b){logger[_0x4996('0x3b')](_0x4996('0x11'),_0x59acfe,JSON[_0x4996('0x3f')](_0x17311b));_0x1e020e[_0x4996('0x44')]();}};}; \ 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 a9973c2..6931725 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 _0x9bec=['channel','Interaction','update','interaction','then','error','stringify','stop','[%s][CLOSE]\x20%s','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','YYYY-MM-DD\x20HH:mm:ss','system'];(function(_0x1b9077,_0x27de66){var _0x5cb0ef=function(_0x3c27fa){while(--_0x3c27fa){_0x1b9077['push'](_0x1b9077['shift']());}};_0x5cb0ef(++_0x27de66);}(_0x9bec,0x1ad));var _0xc9be=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x9bec[_0x1cb18a];return _0x22442e;};'use strict';var moment=require('moment');var logger=require(_0xc9be('0x0'))(_0xc9be('0x1'));var rpc={'chatInteraction':require(_0xc9be('0x2')),'openchannelInteraction':require(_0xc9be('0x3')),'smsInteraction':require(_0xc9be('0x4')),'mailInteraction':require(_0xc9be('0x5')),'faxInteraction':require(_0xc9be('0x6')),'whatsappInteraction':require(_0xc9be('0x7'))};exports[_0xc9be('0x8')]=function(_0x43118f,_0x253f45,_0x328f89,_0x449d9a){return function(_0x6e8342){try{logger[_0xc9be('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0x43118f,_0x253f45[0x0]);var _0x3fc51d={'closed':0x1,'closedAt':moment()['format'](_0xc9be('0xa')),'closeReason':_0xc9be('0xb'),'disposition':_0x253f45[0x0]};if(rpc[_0x449d9a[_0xc9be('0xc')]+_0xc9be('0xd')]){rpc[_0x449d9a[_0xc9be('0xc')]+'Interaction'][_0xc9be('0xe')](_0x449d9a[_0xc9be('0xf')]['id'],_0x3fc51d)[_0xc9be('0x10')](function(_0x567f6f){logger['info']('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x43118f,_0x449d9a[_0xc9be('0xf')]['id']);})['catch'](function(_0x58b497){logger[_0xc9be('0x11')]('[%s][CLOSE]\x20%s',_0x43118f,JSON[_0xc9be('0x12')](_0x58b497));})['finally'](function(){_0x6e8342[_0xc9be('0x13')]();});}}catch(_0x5ad067){logger['error'](_0xc9be('0x14'),_0x43118f,JSON[_0xc9be('0x12')](_0x5ad067));_0x6e8342[_0xc9be('0x13')]();}};}; \ No newline at end of file +var _0xc419=['format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','consequence','[%s][CLOSE]\x20reason\x20%s'];(function(_0xee122e,_0x58ef2e){var _0x34f98a=function(_0x18163e){while(--_0x18163e){_0xee122e['push'](_0xee122e['shift']());}};_0x34f98a(++_0x58ef2e);}(_0xc419,0x1dc));var _0x9c41=function(_0x27d4ed,_0x5d2929){_0x27d4ed=_0x27d4ed-0x0;var _0x361a97=_0xc419[_0x27d4ed];return _0x361a97;};'use strict';var moment=require(_0x9c41('0x0'));var logger=require(_0x9c41('0x1'))(_0x9c41('0x2'));var rpc={'chatInteraction':require(_0x9c41('0x3')),'openchannelInteraction':require(_0x9c41('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x9c41('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x9c41('0x6')]=function(_0x30fa51,_0x2f0382,_0x1fdc77,_0x23c9e5){return function(_0x18c2bd){try{logger['info'](_0x9c41('0x7'),_0x30fa51,_0x2f0382[0x0]);var _0xb2a3a9={'closed':0x1,'closedAt':moment()[_0x9c41('0x8')](_0x9c41('0x9')),'closeReason':'system','disposition':_0x2f0382[0x0]};if(rpc[_0x23c9e5[_0x9c41('0xa')]+_0x9c41('0xb')]){rpc[_0x23c9e5[_0x9c41('0xa')]+'Interaction'][_0x9c41('0xc')](_0x23c9e5[_0x9c41('0xd')]['id'],_0xb2a3a9)[_0x9c41('0xe')](function(_0x1099c3){logger[_0x9c41('0xf')](_0x9c41('0x10'),_0x30fa51,_0x23c9e5[_0x9c41('0xd')]['id']);})[_0x9c41('0x11')](function(_0x5da278){logger[_0x9c41('0x12')]('[%s][CLOSE]\x20%s',_0x30fa51,JSON[_0x9c41('0x13')](_0x5da278));})['finally'](function(){_0x18c2bd[_0x9c41('0x14')]();});}}catch(_0x550fd1){logger[_0x9c41('0x12')](_0x9c41('0x15'),_0x30fa51,JSON[_0x9c41('0x13')](_0x550fd1));_0x18c2bd[_0x9c41('0x14')]();}};}; \ 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 d73191b..3d2e1a3 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 _0xef17=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','create','catch','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','body','then','dialogflow','speech','providerName','providerResponse','result','endConversation','error','lodash','moment','apiai-promise','md5','./utils'];(function(_0x469ce9,_0x4a9239){var _0x180ebe=function(_0x39aa6f){while(--_0x39aa6f){_0x469ce9['push'](_0x469ce9['shift']());}};_0x180ebe(++_0x4a9239);}(_0xef17,0x136));var _0x7ef1=function(_0x3be93b,_0x506090){_0x3be93b=_0x3be93b-0x0;var _0x399341=_0xef17[_0x3be93b];return _0x399341;};'use strict';var _=require(_0x7ef1('0x0'));var moment=require(_0x7ef1('0x1'));var apiai=require(_0x7ef1('0x2'));var md5=require(_0x7ef1('0x3'));var utils=require(_0x7ef1('0x4'));var logger=require(_0x7ef1('0x5'))(_0x7ef1('0x6'));var rpc={'chatMessage':require(_0x7ef1('0x7')),'openchannelMessage':require(_0x7ef1('0x8')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7ef1('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x7ef1('0xa'))};exports['consequence']=function(_0x34a040,_0x4ba2f0){return function(_0x5aec63){try{if(!_[_0x7ef1('0xb')](this[_0x7ef1('0xc')]['UserId'])){logger[_0x7ef1('0xd')](_0x7ef1('0xe'),_0x34a040,_0x7ef1('0xf'));return _0x5aec63[_0x7ef1('0x10')]();}var _0x2cb9b0={'ContactId':this[_0x7ef1('0x11')]['id'],'sentAt':moment()[_0x7ef1('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x7ef1('0x13')]==='sms'||this['channel']==='whatsapp'){_0x2cb9b0[_0x7ef1('0x14')]=this['interaction'][_0x7ef1('0x14')];}var _0x29c920=this[_0x7ef1('0x13')];if(_0x29c920===_0x7ef1('0x15')){_0x2cb9b0[_0x7ef1('0x16')]=this[_0x7ef1('0x17')]['id'];}else{_0x2cb9b0[_[_0x7ef1('0x18')](_0x29c920)+_0x7ef1('0x19')]=this['account']['id'];}_0x2cb9b0[_['upperFirst'](_0x29c920)+_0x7ef1('0x1a')]=this['interaction']['id'];if(this[_0x7ef1('0xc')][_0x7ef1('0x1b')]){var _0x55e84e=_0x4ba2f0[0x2];if(!_['isEmpty'](_0x55e84e)){_0x2cb9b0['body']=utils[_0x7ef1('0x1c')](_0x55e84e,this);return rpc[_0x29c920+'Message'][_0x7ef1('0x1d')](_0x2cb9b0)['then'](function(_0x5a7b2b){logger['info'](_0x7ef1('0xe'),_0x34a040,_0x2cb9b0['body']);})[_0x7ef1('0x1e')](function(_0x2a8fab){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x34a040,JSON[_0x7ef1('0x1f')](_0x2a8fab));})['finally'](function(){logger[_0x7ef1('0xd')](_0x7ef1('0x20'),_0x34a040);_0x5aec63[_0x7ef1('0x21')]();});}else{logger[_0x7ef1('0xd')](_0x7ef1('0x22'),_0x34a040);_0x5aec63[_0x7ef1('0x21')]();}}else{var _0x20887b=this;var _0xd71594=apiai(_0x4ba2f0[0x0],{'language':_0x4ba2f0[0x1]||'en'});return _0xd71594['textRequest'](this[_0x7ef1('0x23')][_0x7ef1('0x24')],{'sessionId':md5(this[_0x7ef1('0xc')]['id'])})[_0x7ef1('0x25')](function(_0x31b5bf){_0x20887b[_0x7ef1('0x24')][_0x7ef1('0x26')]=_0x31b5bf;_0x2cb9b0[_0x7ef1('0x24')]=_0x31b5bf['result']['fulfillment'][_0x7ef1('0x27')];_0x2cb9b0[_0x7ef1('0x28')]=_0x7ef1('0x26');_0x2cb9b0[_0x7ef1('0x29')]=JSON[_0x7ef1('0x1f')](_0x31b5bf);return rpc[_0x29c920+'Message'][_0x7ef1('0x1d')](_0x2cb9b0)[_0x7ef1('0x25')](function(_0x445902){logger[_0x7ef1('0xd')](_0x7ef1('0xe'),_0x34a040,_0x2cb9b0[_0x7ef1('0x24')]);if(_0x31b5bf[_0x7ef1('0x2a')]['metadata'][_0x7ef1('0x2b')]){_0x5aec63['next']();}else{_0x5aec63[_0x7ef1('0x21')]();}})[_0x7ef1('0x1e')](function(_0x4b5fde){logger['error'](_0x7ef1('0xe'),_0x34a040,JSON[_0x7ef1('0x1f')](_0x4b5fde));_0x5aec63['next']();});})[_0x7ef1('0x1e')](function(_0x56fe40){logger[_0x7ef1('0x2c')]('[%s][DIALOGFLOW]\x20%s',_0x34a040,_0x56fe40[_0x7ef1('0x23')]);_0x5aec63[_0x7ef1('0x10')]();});}}catch(_0x585238){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x34a040,JSON['stringify'](_0x585238));_0x5aec63[_0x7ef1('0x21')]();}};}; \ No newline at end of file +var _0x8efc=['stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','body','dialogflow','result','fulfillment','providerResponse','metadata','endConversation','apiai-promise','./utils','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','getMustacheRender','Message','create','then','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!'];(function(_0x2b4eb3,_0x578d3a){var _0x472d1e=function(_0x4463cc){while(--_0x4463cc){_0x2b4eb3['push'](_0x2b4eb3['shift']());}};_0x472d1e(++_0x578d3a);}(_0x8efc,0x8f));var _0xc8ef=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0x8efc[_0x18abd2];return _0x1dcad6;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require(_0xc8ef('0x0'));var md5=require('md5');var utils=require(_0xc8ef('0x1'));var logger=require('../../../../config/logger')(_0xc8ef('0x2'));var rpc={'chatMessage':require(_0xc8ef('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xc8ef('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc8ef('0x5'))};exports[_0xc8ef('0x6')]=function(_0x1648ac,_0x1f7596){return function(_0x819e70){try{if(!_['isNil'](this[_0xc8ef('0x7')]['UserId'])){logger[_0xc8ef('0x8')](_0xc8ef('0x9'),_0x1648ac,_0xc8ef('0xa'));return _0x819e70[_0xc8ef('0xb')]();}var _0x49f653={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xc8ef('0xc')),'direction':_0xc8ef('0xd')};if(this[_0xc8ef('0xe')]===_0xc8ef('0xf')||this['channel']===_0xc8ef('0x10')){_0x49f653[_0xc8ef('0x11')]=this[_0xc8ef('0x7')][_0xc8ef('0x11')];}var _0x27e741=this[_0xc8ef('0xe')];if(_0x27e741===_0xc8ef('0x12')){_0x49f653[_0xc8ef('0x13')]=this['account']['id'];}else{_0x49f653[_['upperFirst'](_0x27e741)+_0xc8ef('0x14')]=this[_0xc8ef('0x15')]['id'];}_0x49f653[_[_0xc8ef('0x16')](_0x27e741)+_0xc8ef('0x17')]=this[_0xc8ef('0x7')]['id'];if(this[_0xc8ef('0x7')][_0xc8ef('0x18')]){var _0x4026c6=_0x1f7596[0x2];if(!_['isEmpty'](_0x4026c6)){_0x49f653['body']=utils[_0xc8ef('0x19')](_0x4026c6,this);return rpc[_0x27e741+_0xc8ef('0x1a')][_0xc8ef('0x1b')](_0x49f653)[_0xc8ef('0x1c')](function(_0x5a2815){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x1648ac,_0x49f653['body']);})[_0xc8ef('0x1d')](function(_0x4ee9df){logger[_0xc8ef('0x1e')](_0xc8ef('0x9'),_0x1648ac,JSON[_0xc8ef('0x1f')](_0x4ee9df));})['finally'](function(){logger[_0xc8ef('0x8')](_0xc8ef('0x20'),_0x1648ac);_0x819e70[_0xc8ef('0x21')]();});}else{logger[_0xc8ef('0x8')](_0xc8ef('0x22'),_0x1648ac);_0x819e70[_0xc8ef('0x21')]();}}else{var _0x1db74d=this;var _0x16bf51=apiai(_0x1f7596[0x0],{'language':_0x1f7596[0x1]||'en'});return _0x16bf51[_0xc8ef('0x23')](this[_0xc8ef('0x24')][_0xc8ef('0x25')],{'sessionId':md5(this[_0xc8ef('0x7')]['id'])})['then'](function(_0x509619){_0x1db74d[_0xc8ef('0x25')][_0xc8ef('0x26')]=_0x509619;_0x49f653[_0xc8ef('0x25')]=_0x509619[_0xc8ef('0x27')][_0xc8ef('0x28')]['speech'];_0x49f653['providerName']=_0xc8ef('0x26');_0x49f653[_0xc8ef('0x29')]=JSON[_0xc8ef('0x1f')](_0x509619);return rpc[_0x27e741+'Message'][_0xc8ef('0x1b')](_0x49f653)[_0xc8ef('0x1c')](function(_0xf285d9){logger[_0xc8ef('0x8')]('[%s][DIALOGFLOW]\x20%s',_0x1648ac,_0x49f653['body']);if(_0x509619[_0xc8ef('0x27')][_0xc8ef('0x2a')][_0xc8ef('0x2b')]){_0x819e70['next']();}else{_0x819e70[_0xc8ef('0x21')]();}})[_0xc8ef('0x1d')](function(_0x199af5){logger['error'](_0xc8ef('0x9'),_0x1648ac,JSON[_0xc8ef('0x1f')](_0x199af5));_0x819e70[_0xc8ef('0xb')]();});})[_0xc8ef('0x1d')](function(_0x17c07c){logger['error'](_0xc8ef('0x9'),_0x1648ac,_0x17c07c['message']);_0x819e70['next']();});}}catch(_0x46745d){logger['error'](_0xc8ef('0x9'),_0x1648ac,JSON['stringify'](_0x46745d));_0x819e70['stop']();}};}; \ 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 42bba97..0f29363 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 _0xb0b4=['isEmpty','getMustacheRender','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','length','fulfillmentText','push','all','next','lodash','moment','bluebird','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','info','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','out','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created'];(function(_0x52d4d2,_0x1af8c5){var _0x3336ae=function(_0x34b9c2){while(--_0x34b9c2){_0x52d4d2['push'](_0x52d4d2['shift']());}};_0x3336ae(++_0x1af8c5);}(_0xb0b4,0xb6));var _0x4b0b=function(_0xa7980a,_0x7fc90a){_0xa7980a=_0xa7980a-0x0;var _0x844172=_0xb0b4[_0xa7980a];return _0x844172;};'use strict';var _=require(_0x4b0b('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require(_0x4b0b('0x1'));var Promise=require(_0x4b0b('0x2'));var logger=require('../../../../config/logger')(_0x4b0b('0x3'));var utils=require('./utils');var rpc={'chatMessage':require(_0x4b0b('0x4')),'openchannelMessage':require(_0x4b0b('0x5')),'mailMessage':require(_0x4b0b('0x6')),'smsMessage':require(_0x4b0b('0x7')),'faxMessage':require(_0x4b0b('0x8')),'whatsappMessage':require(_0x4b0b('0x9'))};function createMessage(_0x3d0a0a,_0x19c374,_0x42917b,_0xeaa6a2){return new Promise(function(_0x1fbc36,_0x175bf7){var _0x3edda6=_[_0x4b0b('0xa')](_0x42917b);_0x3edda6[_0x4b0b('0xb')]=_0xeaa6a2;return rpc[_0x19c374+_0x4b0b('0xc')][_0x4b0b('0xd')](_0x3edda6)['then'](function(){logger[_0x4b0b('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x3d0a0a,_0x3edda6[_0x4b0b('0xb')]);_0x1fbc36();})[_0x4b0b('0xf')](function(_0x4ed635){logger[_0x4b0b('0x10')](_0x4b0b('0x11'),_0x3d0a0a,JSON[_0x4b0b('0x12')](_0x4ed635));_0x175bf7(_0x4ed635);});});}exports[_0x4b0b('0x13')]=function(_0x35bd90,_0x269ac6){return function(_0x532d1f){try{if(!_[_0x4b0b('0x14')](this[_0x4b0b('0x15')][_0x4b0b('0x16')])){logger[_0x4b0b('0xe')](_0x4b0b('0x11'),_0x35bd90,_0x4b0b('0x17'));return _0x532d1f['next']();}var _0x30e5c9={'ContactId':this[_0x4b0b('0x18')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x4b0b('0x19')};if(this[_0x4b0b('0x1a')]==='sms'||this[_0x4b0b('0x1a')]==='whatsapp'){_0x30e5c9['phone']=this[_0x4b0b('0x15')]['phone'];}var _0x3e74b4=this[_0x4b0b('0x1a')];if(_0x3e74b4===_0x4b0b('0x1b')){_0x30e5c9[_0x4b0b('0x1c')]=this['account']['id'];}else{_0x30e5c9[_[_0x4b0b('0x1d')](_0x3e74b4)+_0x4b0b('0x1e')]=this[_0x4b0b('0x1f')]['id'];}_0x30e5c9[_[_0x4b0b('0x1d')](_0x3e74b4)+_0x4b0b('0x20')]=this[_0x4b0b('0x15')]['id'];if(this[_0x4b0b('0x15')][_0x4b0b('0x21')]){var _0xdd1482=_0x269ac6[0x4];if(!_[_0x4b0b('0x22')](_0xdd1482)){_0x30e5c9[_0x4b0b('0xb')]=utils[_0x4b0b('0x23')](_0xdd1482,this);return rpc[_0x3e74b4+_0x4b0b('0xc')][_0x4b0b('0xd')](_0x30e5c9)[_0x4b0b('0x24')](function(_0x8fb089){logger['info'](_0x4b0b('0x11'),_0x35bd90,_0x30e5c9[_0x4b0b('0xb')]);})['catch'](function(_0x12dd7e){logger[_0x4b0b('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x35bd90,JSON[_0x4b0b('0x12')](_0x12dd7e));})[_0x4b0b('0x25')](function(){logger['info'](_0x4b0b('0x26'),_0x35bd90);_0x532d1f[_0x4b0b('0x27')]();});}else{logger['info'](_0x4b0b('0x28'),_0x35bd90);_0x532d1f[_0x4b0b('0x27')]();}}else{var _0x31218e=this;var _0x9ca813=_0x269ac6[0x2][_0x4b0b('0x29')](/\\n/g,'\x0a');var _0x3f3e37={'credentials':{'private_key':_0x9ca813,'client_email':_0x269ac6[0x1]}};var _0x2110e5=new dialogflow[(_0x4b0b('0x2a'))](_0x3f3e37);var _0x4af6dc=_0x2110e5[_0x4b0b('0x2b')](_0x269ac6[0x0],md5(_0x31218e[_0x4b0b('0x15')]['id']));var _0x46714a={'session':_0x4af6dc,'queryInput':{'text':{'text':_0x31218e[_0x4b0b('0x2c')][_0x4b0b('0xb')],'languageCode':_0x269ac6[0x3]||'en'}}};return _0x2110e5[_0x4b0b('0x2d')](_0x46714a)[_0x4b0b('0x24')](function(_0x48e2d3){if(_0x48e2d3&&_0x48e2d3['length']){_0x31218e['body'][_0x4b0b('0x2e')]=_0x48e2d3;var _0x1145d1=_0x48e2d3[0x0];var _0x4a0738=_0x1145d1[_0x4b0b('0x2f')][_0x4b0b('0x30')]&&_0x1145d1[_0x4b0b('0x2f')][_0x4b0b('0x30')]['fields']?_0x1145d1[_0x4b0b('0x2f')][_0x4b0b('0x30')][_0x4b0b('0x31')][_0x4b0b('0x32')][_0x4b0b('0x33')]:![];_0x31218e[_0x4b0b('0xb')][_0x4b0b('0x34')]=_0x1145d1[_0x4b0b('0x2f')][_0x4b0b('0x35')];_0x31218e[_0x4b0b('0xb')][_0x4b0b('0x36')]=_0x1145d1[_0x4b0b('0x2f')]['allRequiredParamsPresent'];_0x31218e[_0x4b0b('0xb')][_0x4b0b('0x37')]=_0x1145d1[_0x4b0b('0x2f')][_0x4b0b('0x30')]&&_0x1145d1['queryResult'][_0x4b0b('0x30')][_0x4b0b('0x31')]?_0x1145d1[_0x4b0b('0x2f')][_0x4b0b('0x30')]['fields'][_0x4b0b('0x32')]['boolValue']:![];_0x31218e[_0x4b0b('0xb')][_0x4b0b('0x38')]=_0x1145d1[_0x4b0b('0x2f')][_0x4b0b('0x39')]['name'];_0x31218e[_0x4b0b('0xb')][_0x4b0b('0x3a')]=_0x1145d1['queryResult'][_0x4b0b('0x39')][_0x4b0b('0x3b')];_0x31218e[_0x4b0b('0xb')][_0x4b0b('0x3c')]=_0x1145d1[_0x4b0b('0x2f')]['intent'][_0x4b0b('0x3d')];_0x31218e[_0x4b0b('0xb')][_0x4b0b('0x3e')]=_0x1145d1['queryResult'][_0x4b0b('0x3f')];_0x31218e[_0x4b0b('0xb')]['DIALOGFLOWV2_QUERYTEXT']=_0x1145d1[_0x4b0b('0x2f')][_0x4b0b('0x40')];_0x31218e[_0x4b0b('0xb')][_0x4b0b('0x41')]=_0x1145d1[_0x4b0b('0x2f')][_0x4b0b('0x42')];_0x30e5c9['providerName']=_0x4b0b('0x2e');_0x30e5c9['providerResponse']=JSON['stringify'](_0x48e2d3);var _0x558e55=[];for(var _0x1e5151=0x0;_0x1e5151<_0x48e2d3[_0x4b0b('0x43')];_0x1e5151++){var _0xb9a11f=_0x48e2d3[_0x1e5151];if(_0xb9a11f&&_0xb9a11f[_0x4b0b('0x2f')]&&_0xb9a11f[_0x4b0b('0x2f')][_0x4b0b('0x44')]){_0x558e55[_0x4b0b('0x45')](createMessage(_0x35bd90,_0x3e74b4,_0x30e5c9,_0xb9a11f[_0x4b0b('0x2f')][_0x4b0b('0x44')]));}}return Promise[_0x4b0b('0x46')](_0x558e55)[_0x4b0b('0x24')](function(){if(_0x4a0738){_0x532d1f[_0x4b0b('0x47')]();}else{_0x532d1f[_0x4b0b('0x27')]();}})[_0x4b0b('0xf')](function(_0xa859a7){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x35bd90,JSON[_0x4b0b('0x12')](_0xa859a7));_0x532d1f[_0x4b0b('0x47')]();});}})[_0x4b0b('0xf')](function(_0x32fe3f){logger['error'](_0x4b0b('0x11'),_0x35bd90,_0x32fe3f[_0x4b0b('0x2c')]);_0x532d1f[_0x4b0b('0x47')]();});}}catch(_0x4c25ca){logger[_0x4b0b('0x10')](_0x4b0b('0x11'),_0x35bd90,JSON[_0x4b0b('0x12')](_0x4c25ca));_0x532d1f[_0x4b0b('0x27')]();}};}; \ No newline at end of file +var _0xad9b=['DIALOGFLOWV2_SCORE','providerName','providerResponse','push','fulfillmentText','all','lodash','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/mailMessage','../../rpc/faxMessage','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','getMustacheRender','catch','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT'];(function(_0x5128ca,_0x1ac9ec){var _0x55c484=function(_0x6a8360){while(--_0x6a8360){_0x5128ca['push'](_0x5128ca['shift']());}};_0x55c484(++_0x1ac9ec);}(_0xad9b,0x10e));var _0xbad9=function(_0x3438de,_0x39292c){_0x3438de=_0x3438de-0x0;var _0x5de621=_0xad9b[_0x3438de];return _0x5de621;};'use strict';var _=require(_0xbad9('0x0'));var dialogflow=require('dialogflow');var md5=require(_0xbad9('0x1'));var moment=require(_0xbad9('0x2'));var Promise=require(_0xbad9('0x3'));var logger=require(_0xbad9('0x4'))(_0xbad9('0x5'));var utils=require(_0xbad9('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xbad9('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xbad9('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x4e05fd,_0x3ce50a,_0x18216f,_0x41895e){return new Promise(function(_0x585ae1,_0x3b91b2){var _0x187477=_['clone'](_0x18216f);_0x187477[_0xbad9('0x9')]=_0x41895e;return rpc[_0x3ce50a+_0xbad9('0xa')][_0xbad9('0xb')](_0x187477)[_0xbad9('0xc')](function(){logger[_0xbad9('0xd')](_0xbad9('0xe'),_0x4e05fd,_0x187477[_0xbad9('0x9')]);_0x585ae1();})['catch'](function(_0x3f6337){logger[_0xbad9('0xf')](_0xbad9('0xe'),_0x4e05fd,JSON[_0xbad9('0x10')](_0x3f6337));_0x3b91b2(_0x3f6337);});});}exports[_0xbad9('0x11')]=function(_0x503e7d,_0x3b193d){return function(_0x416867){try{if(!_[_0xbad9('0x12')](this['interaction'][_0xbad9('0x13')])){logger[_0xbad9('0xd')](_0xbad9('0xe'),_0x503e7d,_0xbad9('0x14'));return _0x416867[_0xbad9('0x15')]();}var _0xb56d58={'ContactId':this['contact']['id'],'sentAt':moment()[_0xbad9('0x16')](_0xbad9('0x17')),'direction':_0xbad9('0x18')};if(this[_0xbad9('0x19')]==='sms'||this['channel']===_0xbad9('0x1a')){_0xb56d58[_0xbad9('0x1b')]=this[_0xbad9('0x1c')][_0xbad9('0x1b')];}var _0x21c090=this[_0xbad9('0x19')];if(_0x21c090===_0xbad9('0x1d')){_0xb56d58[_0xbad9('0x1e')]=this[_0xbad9('0x1f')]['id'];}else{_0xb56d58[_[_0xbad9('0x20')](_0x21c090)+_0xbad9('0x21')]=this[_0xbad9('0x1f')]['id'];}_0xb56d58[_[_0xbad9('0x20')](_0x21c090)+_0xbad9('0x22')]=this[_0xbad9('0x1c')]['id'];if(this['interaction']['created']){var _0x2b1080=_0x3b193d[0x4];if(!_['isEmpty'](_0x2b1080)){_0xb56d58[_0xbad9('0x9')]=utils[_0xbad9('0x23')](_0x2b1080,this);return rpc[_0x21c090+'Message'][_0xbad9('0xb')](_0xb56d58)[_0xbad9('0xc')](function(_0x31977e){logger[_0xbad9('0xd')](_0xbad9('0xe'),_0x503e7d,_0xb56d58[_0xbad9('0x9')]);})[_0xbad9('0x24')](function(_0xedea9c){logger[_0xbad9('0xf')](_0xbad9('0xe'),_0x503e7d,JSON['stringify'](_0xedea9c));})[_0xbad9('0x25')](function(){logger[_0xbad9('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x503e7d);_0x416867[_0xbad9('0x26')]();});}else{logger[_0xbad9('0xd')](_0xbad9('0x27'),_0x503e7d);_0x416867[_0xbad9('0x26')]();}}else{var _0x5269f1=this;var _0x3a0704=_0x3b193d[0x2][_0xbad9('0x28')](/\\n/g,'\x0a');var _0x3c29bc={'credentials':{'private_key':_0x3a0704,'client_email':_0x3b193d[0x1]}};var _0x5610f6=new dialogflow[(_0xbad9('0x29'))](_0x3c29bc);var _0x597f51=_0x5610f6['sessionPath'](_0x3b193d[0x0],md5(_0x5269f1[_0xbad9('0x1c')]['id']));var _0x5b8b86={'session':_0x597f51,'queryInput':{'text':{'text':_0x5269f1[_0xbad9('0x2a')][_0xbad9('0x9')],'languageCode':_0x3b193d[0x3]||'en'}}};return _0x5610f6[_0xbad9('0x2b')](_0x5b8b86)['then'](function(_0x3585dd){if(_0x3585dd&&_0x3585dd['length']){_0x5269f1['body'][_0xbad9('0x2c')]=_0x3585dd;var _0x16ed83=_0x3585dd[0x0];var _0x11cb94=_0x16ed83[_0xbad9('0x2d')][_0xbad9('0x2e')]&&_0x16ed83[_0xbad9('0x2d')][_0xbad9('0x2e')][_0xbad9('0x2f')]?_0x16ed83['queryResult']['diagnosticInfo'][_0xbad9('0x2f')][_0xbad9('0x30')][_0xbad9('0x31')]:![];_0x5269f1[_0xbad9('0x9')]['DIALOGFLOWV2_ACTION']=_0x16ed83[_0xbad9('0x2d')][_0xbad9('0x32')];_0x5269f1[_0xbad9('0x9')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x16ed83[_0xbad9('0x2d')][_0xbad9('0x33')];_0x5269f1[_0xbad9('0x9')][_0xbad9('0x34')]=_0x16ed83['queryResult'][_0xbad9('0x2e')]&&_0x16ed83[_0xbad9('0x2d')][_0xbad9('0x2e')][_0xbad9('0x2f')]?_0x16ed83[_0xbad9('0x2d')][_0xbad9('0x2e')][_0xbad9('0x2f')][_0xbad9('0x30')][_0xbad9('0x31')]:![];_0x5269f1[_0xbad9('0x9')]['DIALOGFLOWV2_INTENTNAME']=_0x16ed83[_0xbad9('0x2d')][_0xbad9('0x35')]['name'];_0x5269f1[_0xbad9('0x9')][_0xbad9('0x36')]=_0x16ed83[_0xbad9('0x2d')]['intent'][_0xbad9('0x37')];_0x5269f1['body'][_0xbad9('0x38')]=_0x16ed83[_0xbad9('0x2d')][_0xbad9('0x35')][_0xbad9('0x39')];_0x5269f1['body'][_0xbad9('0x3a')]=_0x16ed83[_0xbad9('0x2d')]['languageCode'];_0x5269f1['body'][_0xbad9('0x3b')]=_0x16ed83[_0xbad9('0x2d')]['queryText'];_0x5269f1['body'][_0xbad9('0x3c')]=_0x16ed83[_0xbad9('0x2d')]['intentDetectionConfidence'];_0xb56d58[_0xbad9('0x3d')]=_0xbad9('0x2c');_0xb56d58[_0xbad9('0x3e')]=JSON[_0xbad9('0x10')](_0x3585dd);var _0x520af2=[];for(var _0x2daf79=0x0;_0x2daf79<_0x3585dd['length'];_0x2daf79++){var _0x59f0c6=_0x3585dd[_0x2daf79];if(_0x59f0c6&&_0x59f0c6[_0xbad9('0x2d')]&&_0x59f0c6[_0xbad9('0x2d')]['fulfillmentText']){_0x520af2[_0xbad9('0x3f')](createMessage(_0x503e7d,_0x21c090,_0xb56d58,_0x59f0c6[_0xbad9('0x2d')][_0xbad9('0x40')]));}}return Promise[_0xbad9('0x41')](_0x520af2)[_0xbad9('0xc')](function(){if(_0x11cb94){_0x416867[_0xbad9('0x15')]();}else{_0x416867[_0xbad9('0x26')]();}})[_0xbad9('0x24')](function(_0x551f1e){logger[_0xbad9('0xf')](_0xbad9('0xe'),_0x503e7d,JSON['stringify'](_0x551f1e));_0x416867['next']();});}})[_0xbad9('0x24')](function(_0x4f88ce){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x503e7d,_0x4f88ce['message']);_0x416867['next']();});}}catch(_0x28d20b){logger[_0xbad9('0xf')](_0xbad9('0xe'),_0x503e7d,JSON[_0xbad9('0x10')](_0x28d20b));_0x416867[_0xbad9('0x26')]();}};}; \ 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 1ab7904..8d35ad3 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 _0x1cd8=['validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify'];(function(_0x3e360a,_0x5c87a9){var _0x2f73d1=function(_0x129e6b){while(--_0x129e6b){_0x3e360a['push'](_0x3e360a['shift']());}};_0x2f73d1(++_0x5c87a9);}(_0x1cd8,0xf8));var _0x81cd=function(_0x3d0d25,_0x108611){_0x3d0d25=_0x3d0d25-0x0;var _0x3973d1=_0x1cd8[_0x3d0d25];return _0x3973d1;};'use strict';var schema=require(_0x81cd('0x0'));var _=require(_0x81cd('0x1'));var htmlToText=require(_0x81cd('0x2'));var utils=require(_0x81cd('0x3'));var logger=require(_0x81cd('0x4'))(_0x81cd('0x5'));var gotoif=schema({'condition':{'type':_0x81cd('0x6'),'required':!![],'message':_0x81cd('0x7')},'priorityTrue':{'type':_0x81cd('0x8'),'message':_0x81cd('0x9')},'priorityFalse':{'type':_0x81cd('0x8'),'message':_0x81cd('0xa')}});exports[_0x81cd('0xb')]=function(_0x17076a,_0x2c136d){return function(_0x179f71){try{var _0x12746a={'condition':htmlToText[_0x81cd('0xc')](utils[_0x81cd('0xd')](_0x2c136d[0x0],this),{'wordwrap':![]})[_0x81cd('0xe')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2c136d[0x1],'priorityFalse':_0x2c136d[0x2]};var _0x4585d5=gotoif[_0x81cd('0x0')](_0x12746a,{'typecast':!![]});if(_0x4585d5['length']){logger['error'](_0x81cd('0xf'),_0x17076a,_[_0x81cd('0x10')](_0x4585d5,_0x81cd('0x11'))[_0x81cd('0x12')](',\x20'));_0x179f71['stop']();}else{try{var _0x2cea4f=eval('('+_0x12746a[_0x81cd('0x13')]+')');var _0x1f95eb=_0x2cea4f?_0x12746a[_0x81cd('0x14')]:_0x12746a[_0x81cd('0x15')];logger[_0x81cd('0x16')](_0x81cd('0x17'),_0x17076a,_0x12746a[_0x81cd('0x13')],_0x2cea4f,_0x1f95eb||_0x81cd('0x18'));if(_0x1f95eb){var _0x3539bd=_['findIndex'](_0x179f71['rules'](),{'p':_0x1f95eb});if(_0x3539bd>=0x0){logger[_0x81cd('0x16')](_0x81cd('0x19'),_0x17076a,_0x1f95eb||'next',_0x3539bd);_0x179f71[_0x81cd('0x18')](_0x3539bd);}else{logger[_0x81cd('0x16')](_0x81cd('0x1a'),_0x17076a,_0x1f95eb||'next');_0x179f71[_0x81cd('0x1b')]();}}else{_0x179f71[_0x81cd('0x18')]();}}catch(_0x1ffb26){logger[_0x81cd('0x1c')](_0x81cd('0x1d'),_0x17076a,_0x1ffb26[_0x81cd('0x11')]);_0x179f71[_0x81cd('0x1b')]();}}}catch(_0x41056e){logger[_0x81cd('0x1c')](_0x81cd('0xf'),_0x17076a,JSON[_0x81cd('0x1e')](_0x41056e));_0x179f71['stop']();}};}; \ No newline at end of file +var _0xc1ed=['number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','getMustacheRender','length','error','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityTrue','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','html-to-text','./utils','../../../../config/logger','routing'];(function(_0x183256,_0x1a596d){var _0x5394a2=function(_0x192025){while(--_0x192025){_0x183256['push'](_0x183256['shift']());}};_0x5394a2(++_0x1a596d);}(_0xc1ed,0x17b));var _0xdc1e=function(_0x45a6ea,_0x32131e){_0x45a6ea=_0x45a6ea-0x0;var _0x346ffa=_0xc1ed[_0x45a6ea];return _0x346ffa;};'use strict';var schema=require(_0xdc1e('0x0'));var _=require('lodash');var htmlToText=require(_0xdc1e('0x1'));var utils=require(_0xdc1e('0x2'));var logger=require(_0xdc1e('0x3'))(_0xdc1e('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xdc1e('0x5'),'message':_0xdc1e('0x6')},'priorityFalse':{'type':'number','message':_0xdc1e('0x7')}});exports['consequence']=function(_0x45b938,_0x262aca){return function(_0x3090a9){try{var _0x15ac6b={'condition':htmlToText['fromString'](utils[_0xdc1e('0x8')](_0x262aca[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x262aca[0x1],'priorityFalse':_0x262aca[0x2]};var _0x34c5a6=gotoif['validate'](_0x15ac6b,{'typecast':!![]});if(_0x34c5a6[_0xdc1e('0x9')]){logger[_0xdc1e('0xa')](_0xdc1e('0xb'),_0x45b938,_['map'](_0x34c5a6,_0xdc1e('0xc'))[_0xdc1e('0xd')](',\x20'));_0x3090a9[_0xdc1e('0xe')]();}else{try{var _0x59961e=eval('('+_0x15ac6b[_0xdc1e('0xf')]+')');var _0x283dd2=_0x59961e?_0x15ac6b[_0xdc1e('0x10')]:_0x15ac6b['priorityFalse'];logger['info'](_0xdc1e('0x11'),_0x45b938,_0x15ac6b[_0xdc1e('0xf')],_0x59961e,_0x283dd2||'next');if(_0x283dd2){var _0x525331=_[_0xdc1e('0x12')](_0x3090a9['rules'](),{'p':_0x283dd2});if(_0x525331>=0x0){logger[_0xdc1e('0x13')](_0xdc1e('0x14'),_0x45b938,_0x283dd2||_0xdc1e('0x15'),_0x525331);_0x3090a9[_0xdc1e('0x15')](_0x525331);}else{logger[_0xdc1e('0x13')](_0xdc1e('0x16'),_0x45b938,_0x283dd2||_0xdc1e('0x15'));_0x3090a9['stop']();}}else{_0x3090a9['next']();}}catch(_0x4635d7){logger[_0xdc1e('0xa')](_0xdc1e('0x17'),_0x45b938,_0x4635d7[_0xdc1e('0xc')]);_0x3090a9[_0xdc1e('0xe')]();}}}catch(_0x5c6654){logger['error'](_0xdc1e('0xb'),_0x45b938,JSON['stringify'](_0x5c6654));_0x3090a9[_0xdc1e('0xe')]();}};}; \ 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 32857f0..3f43a03 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 _0x8b13=['map','message','join','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','validate','lodash','../../../../config/logger','routing','number','consequence','length','error','[%s][GOTOP]\x20%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8b13,0x1ac));var _0x38b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b13[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x38b1('0x0'));var _=require(_0x38b1('0x1'));var logger=require(_0x38b1('0x2'))(_0x38b1('0x3'));var gotop=schema({'priority':{'type':_0x38b1('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x38b1('0x5')]=function(_0x1f321b,_0x17dd68){return function(_0x2a7859){try{var _0x2f94fd={'priority':_0x17dd68[0x0]};var _0x13f520=gotop[_0x38b1('0x0')](_0x2f94fd,{'typecast':!![]});if(_0x13f520[_0x38b1('0x6')]){logger[_0x38b1('0x7')](_0x38b1('0x8'),_0x1f321b,_[_0x38b1('0x9')](_0x13f520,_0x38b1('0xa'))[_0x38b1('0xb')](',\x20'));_0x2a7859[_0x38b1('0xc')]();}else{logger[_0x38b1('0xd')]('[%s][GOTOP]\x20priority\x20%s',_0x1f321b,_0x2f94fd['priority']);if(_0x2f94fd[_0x38b1('0xe')]){var _0xbf6908=_[_0x38b1('0xf')](_0x2a7859[_0x38b1('0x10')](),{'p':_0x2f94fd[_0x38b1('0xe')]});if(_0xbf6908>=0x0){logger[_0x38b1('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1f321b,_0x2f94fd[_0x38b1('0xe')]||'next',_0xbf6908);_0x2a7859['next'](_0xbf6908);}else{logger['info'](_0x38b1('0x11'),_0x1f321b,_0x2f94fd[_0x38b1('0xe')]||'next');_0x2a7859[_0x38b1('0xc')]();}}else{_0x2a7859[_0x38b1('0x12')]();}}}catch(_0x1a7ff0){logger[_0x38b1('0x7')](_0x38b1('0x8'),_0x1f321b,JSON['stringify'](_0x1a7ff0));_0x2a7859[_0x38b1('0xc')]();}};}; \ No newline at end of file +var _0xa378=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','map','message','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','info'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0xa378,0xc1));var _0x8a37=function(_0x51e40a,_0x262dc6){_0x51e40a=_0x51e40a-0x0;var _0x53c323=_0xa378[_0x51e40a];return _0x53c323;};'use strict';var schema=require(_0x8a37('0x0'));var _=require(_0x8a37('0x1'));var logger=require(_0x8a37('0x2'))(_0x8a37('0x3'));var gotop=schema({'priority':{'type':_0x8a37('0x4'),'required':!![],'message':_0x8a37('0x5')}});exports[_0x8a37('0x6')]=function(_0x4d0afa,_0x502b60){return function(_0x837aa1){try{var _0x71c11e={'priority':_0x502b60[0x0]};var _0x1e5418=gotop[_0x8a37('0x0')](_0x71c11e,{'typecast':!![]});if(_0x1e5418[_0x8a37('0x7')]){logger[_0x8a37('0x8')]('[%s][GOTOP]\x20%s',_0x4d0afa,_[_0x8a37('0x9')](_0x1e5418,_0x8a37('0xa'))['join'](',\x20'));_0x837aa1[_0x8a37('0xb')]();}else{logger['info'](_0x8a37('0xc'),_0x4d0afa,_0x71c11e[_0x8a37('0xd')]);if(_0x71c11e[_0x8a37('0xd')]){var _0x1c1d00=_[_0x8a37('0xe')](_0x837aa1['rules'](),{'p':_0x71c11e[_0x8a37('0xd')]});if(_0x1c1d00>=0x0){logger[_0x8a37('0xf')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4d0afa,_0x71c11e['priority']||_0x8a37('0x10'),_0x1c1d00);_0x837aa1[_0x8a37('0x10')](_0x1c1d00);}else{logger[_0x8a37('0xf')](_0x8a37('0x11'),_0x4d0afa,_0x71c11e['priority']||_0x8a37('0x10'));_0x837aa1[_0x8a37('0xb')]();}}else{_0x837aa1[_0x8a37('0x10')]();}}}catch(_0x54c45e){logger[_0x8a37('0x8')](_0x8a37('0x12'),_0x4d0afa,JSON['stringify'](_0x54c45e));_0x837aa1[_0x8a37('0xb')]();}};}; \ 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 80f49a0..43c516b 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 _0x3ce2=['stringify','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','next','error'];(function(_0x4b3266,_0x1c0054){var _0x4fed16=function(_0x2edd75){while(--_0x2edd75){_0x4b3266['push'](_0x4b3266['shift']());}};_0x4fed16(++_0x1c0054);}(_0x3ce2,0x192));var _0x23ce=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x3ce2[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0x23ce('0x0'));var utils=require(_0x23ce('0x1'));var logger=require('../../../../config/logger')(_0x23ce('0x2'));var rpc={'chatMessage':require(_0x23ce('0x3')),'openchannelMessage':require(_0x23ce('0x4')),'mailMessage':require(_0x23ce('0x5')),'smsMessage':require(_0x23ce('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x23ce('0x7'))};exports[_0x23ce('0x8')]=function(_0x500895,_0xb3d43b){return function(_0x2571ab){try{var _0x3cc37c={'body':utils[_0x23ce('0x9')](_0xb3d43b[0x0],this),'ContactId':this[_0x23ce('0xa')]['id']};if(this[_0x23ce('0xb')]==='chat'){_0x3cc37c[_0x23ce('0xc')]=this[_0x23ce('0xd')]['id'];}else{_0x3cc37c[_['upperFirst'](this['channel'])+'AccountId']=this['account']['id'];}_0x3cc37c[_[_0x23ce('0xe')](this[_0x23ce('0xb')])+_0x23ce('0xf')]=this[_0x23ce('0x10')]['id'];if(rpc[this[_0x23ce('0xb')]+_0x23ce('0x11')]){return rpc[this[_0x23ce('0xb')]+'Message'][_0x23ce('0x12')](_0x3cc37c)[_0x23ce('0x13')](function(_0x90bfbf){logger['info'](_0x23ce('0x14'),_0x500895,_0x3cc37c['body']);_0x2571ab[_0x23ce('0x15')]();})['catch'](function(_0x5758f5){logger[_0x23ce('0x16')](_0x23ce('0x14'),_0x500895,JSON[_0x23ce('0x17')](_0x5758f5));_0x2571ab[_0x23ce('0x18')]();});}}catch(_0x19d6d3){logger[_0x23ce('0x16')](_0x23ce('0x14'),_0x500895,JSON[_0x23ce('0x17')](_0x19d6d3));_0x2571ab[_0x23ce('0x18')]();}};}; \ No newline at end of file +var _0xb12d=['consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','interaction','Message','then','info','body','next','[%s][MESSAGE]\x20%s','stringify','error','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x1869a6,_0x52f442){var _0x2a1450=function(_0x52aa23){while(--_0x52aa23){_0x1869a6['push'](_0x1869a6['shift']());}};_0x2a1450(++_0x52f442);}(_0xb12d,0x124));var _0xdb12=function(_0x4169d8,_0x3d7cd4){_0x4169d8=_0x4169d8-0x0;var _0x32084a=_0xb12d[_0x4169d8];return _0x32084a;};'use strict';var _=require(_0xdb12('0x0'));var utils=require(_0xdb12('0x1'));var logger=require(_0xdb12('0x2'))('routing');var rpc={'chatMessage':require(_0xdb12('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xdb12('0x4')),'smsMessage':require(_0xdb12('0x5')),'faxMessage':require(_0xdb12('0x6')),'whatsappMessage':require(_0xdb12('0x7'))};exports[_0xdb12('0x8')]=function(_0x15ac3f,_0x4c69e0){return function(_0x16666d){try{var _0x19e73f={'body':utils[_0xdb12('0x9')](_0x4c69e0[0x0],this),'ContactId':this[_0xdb12('0xa')]['id']};if(this[_0xdb12('0xb')]===_0xdb12('0xc')){_0x19e73f[_0xdb12('0xd')]=this[_0xdb12('0xe')]['id'];}else{_0x19e73f[_['upperFirst'](this[_0xdb12('0xb')])+'AccountId']=this[_0xdb12('0xe')]['id'];}_0x19e73f[_[_0xdb12('0xf')](this[_0xdb12('0xb')])+'InteractionId']=this[_0xdb12('0x10')]['id'];if(rpc[this[_0xdb12('0xb')]+_0xdb12('0x11')]){return rpc[this['channel']+_0xdb12('0x11')]['create'](_0x19e73f)[_0xdb12('0x12')](function(_0x127a69){logger[_0xdb12('0x13')]('[%s][MESSAGE]\x20%s',_0x15ac3f,_0x19e73f[_0xdb12('0x14')]);_0x16666d[_0xdb12('0x15')]();})['catch'](function(_0x44b39c){logger['error'](_0xdb12('0x16'),_0x15ac3f,JSON[_0xdb12('0x17')](_0x44b39c));_0x16666d['stop']();});}}catch(_0x1dc8b8){logger[_0xdb12('0x18')](_0xdb12('0x16'),_0x15ac3f,JSON[_0xdb12('0x17')](_0x1dc8b8));_0x16666d['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index e1de213..7c92515 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 _0x1ec6=['getMustacheRender','next','error','stop','./utils','../../../../config/logger','routing','info','[%s][NOOP]\x20%s'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1ec6,0x82));var _0x61ec=function(_0x257a01,_0x143777){_0x257a01=_0x257a01-0x0;var _0xc2cd98=_0x1ec6[_0x257a01];return _0xc2cd98;};'use strict';var utils=require(_0x61ec('0x0'));var logger=require(_0x61ec('0x1'))(_0x61ec('0x2'));exports['consequence']=function(_0x1fd59e,_0x3bc03e){return function(_0x17282d){try{logger[_0x61ec('0x3')](_0x61ec('0x4'),_0x1fd59e,utils[_0x61ec('0x5')](_0x3bc03e[0x0],this));_0x17282d[_0x61ec('0x6')]();}catch(_0x2898cc){logger[_0x61ec('0x7')](_0x61ec('0x4'),_0x1fd59e,JSON['stringify'](_0x2898cc));_0x17282d[_0x61ec('0x8')]();}};}; \ No newline at end of file +var _0x61bc=['next','error','[%s][NOOP]\x20%s','stringify','stop','../../../../config/logger','routing','consequence','info','getMustacheRender'];(function(_0x3b64fa,_0x1b7f87){var _0x2ed774=function(_0x41f2d7){while(--_0x41f2d7){_0x3b64fa['push'](_0x3b64fa['shift']());}};_0x2ed774(++_0x1b7f87);}(_0x61bc,0x9b));var _0xc61b=function(_0x207984,_0x4101c2){_0x207984=_0x207984-0x0;var _0xd56e3d=_0x61bc[_0x207984];return _0xd56e3d;};'use strict';var utils=require('./utils');var logger=require(_0xc61b('0x0'))(_0xc61b('0x1'));exports[_0xc61b('0x2')]=function(_0x2dff2f,_0x1fac24){return function(_0x144e28){try{logger[_0xc61b('0x3')]('[%s][NOOP]\x20%s',_0x2dff2f,utils[_0xc61b('0x4')](_0x1fac24[0x0],this));_0x144e28[_0xc61b('0x5')]();}catch(_0x1bfa8d){logger[_0xc61b('0x6')](_0xc61b('0x7'),_0x2dff2f,JSON[_0xc61b('0x8')](_0x1bfa8d));_0x144e28[_0xc61b('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index d6782ad..59fb67b 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 _0xa887=['util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','queue','joinAt','clone','account','format','%sQueuesWaitingInteractions','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','number','timeout\x20is\x20a\x20number','waiting','body','from','contact','list','channel','QueueId','upperFirst','interaction','message','AccountId','WebsiteId','info','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','update','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','timeout','createQueue','atimeout','qtimeout','rules','end','close','complete','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xa887,0x89));var _0x7a88=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa887[_0x5447fd];return _0x15b28a;};'use strict';var schema=require(_0x7a88('0x0'));var _=require('lodash');var util=require(_0x7a88('0x1'));var seqqueue=require(_0x7a88('0x2'));var moment=require('moment');var Redis=require(_0x7a88('0x3'));var config=require(_0x7a88('0x4'));var logger=require(_0x7a88('0x5'))(_0x7a88('0x6'));var strategy=require(_0x7a88('0x7'));config[_0x7a88('0x8')]=_[_0x7a88('0x9')](config[_0x7a88('0x8')],{'host':_0x7a88('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7a88('0x8')]));var attributes=['id',_0x7a88('0xb'),'account',_0x7a88('0xc'),'from',_0x7a88('0xd')];function emit(_0x179388,_0x2d0893,_0x4b4568){io['to'](_0x179388)['emit'](_0x2d0893,_0x4b4568);}function emitChannelQueueInteraction(_0x11c10e,_0x3c324b,_0x29793d,_0x3cf197,_0x8ccfc,_0x3f8907,_0xd0ef4c,_0x1e0272){var _0x495404=_[_0x7a88('0xe')](_0x29793d);_0x495404['queue_id']=_0x1e0272;_0x495404[_0x7a88('0xc')]=_0x3c324b;_0x495404[_0x7a88('0xf')]=_0x3cf197;_0x495404['id']=_0x8ccfc;if(_0x3f8907){_0xd0ef4c[util[_0x7a88('0x10')](_0x7a88('0x11'),_0x11c10e)][_0x8ccfc]=_['pick'](_0x495404,attributes);}else{delete _0xd0ef4c[util[_0x7a88('0x10')]('%sQueuesWaitingInteractions',_0x11c10e)][_0x8ccfc];}emit(util[_0x7a88('0x10')]('%s:queue:%s',_0x11c10e,_0x3c324b),util['format']('%s_queue_waiting_interaction:%s',_0x11c10e,_0x3f8907?_0x7a88('0x12'):'remove'),_[_0x7a88('0x13')](_0x495404,attributes));}var rpc={'openchannelQueueReport':require(_0x7a88('0x14')),'mailQueueReport':require(_0x7a88('0x15')),'chatQueueReport':require(_0x7a88('0x16')),'smsQueueReport':require(_0x7a88('0x17')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x7a88('0x18'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x7a88('0x19'),'message':_0x7a88('0x1a')}});function startRouting(_0x232a0e,_0x3d684a,_0x1ec86f,_0x1341ca){if(_0x232a0e&&_0x3d684a&&_0x1ec86f){_0x3d684a[_0x7a88('0x1b')]+=0x1;var _0x9d9d08={'uniqueid':_0x232a0e,'from':_0x1ec86f[_0x7a88('0x1c')]?_0x1ec86f[_0x7a88('0x1c')][_0x7a88('0x1d')]:'','joinAt':moment()[_0x7a88('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ec86f['contact']?_0x1ec86f[_0x7a88('0x1e')]['id']:null,'ListId':_0x1ec86f[_0x7a88('0x1f')]?_0x1ec86f['list']['id']:null};_0x9d9d08[_['upperFirst'](_0x1ec86f[_0x7a88('0x20')])+_0x7a88('0x21')]=_0x3d684a['id']||null;_0x9d9d08[_[_0x7a88('0x22')](_0x1ec86f[_0x7a88('0x20')])+'InteractionId']=_0x1ec86f[_0x7a88('0x23')]?_0x1ec86f[_0x7a88('0x23')]['id']:null;_0x9d9d08[_[_0x7a88('0x22')](_0x1ec86f[_0x7a88('0x20')])+'MessageId']=_0x1ec86f['message']?_0x1ec86f[_0x7a88('0x24')]['id']:null;_0x9d9d08[_['upperFirst'](_0x1ec86f[_0x7a88('0x20')])+(_0x1ec86f['channel']!=='chat'?_0x7a88('0x25'):_0x7a88('0x26'))]=_0x1ec86f[_0x7a88('0xf')]?_0x1ec86f[_0x7a88('0xf')]['id']:null;logger[_0x7a88('0x27')](util['format']('[%s][START:QUEUE][NAME:%s]',_0x232a0e,_0x3d684a[_0x7a88('0x28')]));emitChannelQueueInteraction(_0x1ec86f[_0x7a88('0x20')],_0x3d684a[_0x7a88('0x28')],_0x9d9d08,_0x1ec86f[_0x7a88('0xf')][_0x7a88('0x28')],_0x1ec86f[_0x7a88('0x24')]['id'],!![],_0x1341ca,_0x3d684a['id']);if(rpc[_0x1ec86f[_0x7a88('0x20')]+_0x7a88('0x29')]){return rpc[_0x1ec86f[_0x7a88('0x20')]+_0x7a88('0x29')][_0x7a88('0x2a')](_0x9d9d08)[_0x7a88('0x2b')](function(_0x354e9f){logger[_0x7a88('0x2c')](_0x7a88('0x2d'));});}}}function stopRouting(_0xd1cff1,_0x57ab8e,_0x1b77e3,_0x450fbd){if(_0xd1cff1&&_0x57ab8e){_0x57ab8e[_0x7a88('0x1b')]-=0x1;var _0x12964b={'leaveAt':moment()[_0x7a88('0x10')](_0x7a88('0x2e')),'acceptAt':moment()[_0x7a88('0x10')](_0x7a88('0x2e')),'reason':'accepted'};logger['info'](util[_0x7a88('0x10')]('[%s][STOP:QUEUE][NAME:%s]',_0xd1cff1,_0x57ab8e[_0x7a88('0x28')]));emitChannelQueueInteraction(_0x1b77e3[_0x7a88('0x20')],_0x57ab8e[_0x7a88('0x28')],_0x1b77e3[_0x7a88('0x1c')],_0x1b77e3['account'][_0x7a88('0x28')],_0x1b77e3['message']['id'],![],_0x450fbd,_0x57ab8e['id']);if(rpc[_0x1b77e3[_0x7a88('0x20')]+_0x7a88('0x29')]){return rpc[_0x1b77e3[_0x7a88('0x20')]+'QueueReport'][_0x7a88('0x2f')](_0xd1cff1,_0x12964b)[_0x7a88('0x2b')](function(_0x2a6d76){logger['error'](_0x7a88('0x30'));});}}}function endRouting(_0x38bd27,_0x3a6588,_0x29d55f,_0x4a3789){if(_0x38bd27&&_0x3a6588){_0x3a6588[_0x7a88('0x1b')]-=0x1;var _0x257293={'leaveAt':moment()[_0x7a88('0x10')](_0x7a88('0x2e')),'exitAt':moment()[_0x7a88('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger['info'](util[_0x7a88('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x38bd27,_0x3a6588[_0x7a88('0x28')]));emitChannelQueueInteraction(_0x29d55f[_0x7a88('0x20')],_0x3a6588[_0x7a88('0x28')],_0x29d55f[_0x7a88('0x1c')],_0x29d55f[_0x7a88('0xf')][_0x7a88('0x28')],_0x29d55f[_0x7a88('0x24')]['id'],![],_0x4a3789);if(rpc[_0x29d55f[_0x7a88('0x20')]+'QueueReport']){return rpc[_0x29d55f[_0x7a88('0x20')]+_0x7a88('0x29')][_0x7a88('0x2f')](_0x38bd27,_0x257293)[_0x7a88('0x2b')](function(_0x51741a){logger[_0x7a88('0x2c')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x5aff6c){return function(_0x5dd8ac){return _0x5dd8ac[_0x7a88('0x28')][_0x7a88('0x31')]()===_0x5aff6c[_0x7a88('0x31')]();};}exports['consequence']=function(_0x46e54f,_0x102a45,_0x3e56ab,_0x158259){return function(_0x2ec616){try{var _0x22e18f={'name':_0x102a45[0x0],'timeout':_0x102a45[0x1]};var _0xe5e816=queue[_0x7a88('0x0')](_0x22e18f,{'typecast':!![]});if(_0xe5e816[_0x7a88('0x32')]){logger[_0x7a88('0x2c')](_0x7a88('0x33'),_0x46e54f,_[_0x7a88('0x34')](_0xe5e816,'message')[_0x7a88('0x35')](',\x20'));_0x2ec616[_0x7a88('0x36')]();}else{var _0x331e1a=_[_0x7a88('0x37')](_0x3e56ab[_0x158259['channel']+'Queues'],handleFindQueue(_0x22e18f['name']));if(_0x331e1a){startRouting(_0x46e54f,_0x331e1a,_0x158259,_0x3e56ab);var _0xc3c9f7=(_0x331e1a[_0x7a88('0x38')]||0xa)*0x3e8;var _0x8d00a5=(_0x22e18f[_0x7a88('0x38')]||0x14)*0x3e8;var _0x5f17bf,_0x5b8ab8;if(_0xc3c9f7>_0x8d00a5){_0x8d00a5=_0xc3c9f7;}var _0x5aa888=seqqueue[_0x7a88('0x39')](_0xc3c9f7);_0x5aa888['id']=_0x46e54f;_0x5aa888[_0x7a88('0x3a')]=_0xc3c9f7;_0x5aa888[_0x7a88('0x3b')]=_0x8d00a5;_0x5aa888[_0x7a88('0x20')]=_0x158259[_0x7a88('0x20')];_0x3e56ab[_0x7a88('0x3c')][_0x46e54f]['on'](_0x7a88('0x3d'),function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x46e54f);stopRouting(_0x46e54f,_0x331e1a,_0x158259,_0x3e56ab);clearTimeout(_0x5f17bf);_0x5f17bf=undefined;_0x5aa888[_0x7a88('0x3e')](!![]);if(_0x3e56ab[_0x7a88('0x3c')][_0x46e54f]){delete _0x3e56ab['rules'][_0x46e54f];}_0x2ec616[_0x7a88('0x36')]();});_0x3e56ab[_0x7a88('0x3c')][_0x46e54f]['on'](_0x7a88('0x3f'),function(){if(_0x3e56ab[_0x7a88('0x3c')][_0x46e54f]){delete _0x3e56ab[_0x7a88('0x3c')][_0x46e54f];}});_0x5f17bf=setTimeout(function(){logger[_0x7a88('0x27')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x46e54f);endRouting(_0x46e54f,_0x331e1a,_0x158259,_0x3e56ab);clearTimeout(_0x5f17bf);_0x5aa888[_0x7a88('0x3e')](!![]);_0x2ec616[_0x7a88('0x40')]();},_0x8d00a5);switch(_0x331e1a[_0x7a88('0x41')]){case _0x7a88('0x42'):strategy['rrmemory'](_0x5aa888,_0x331e1a,_0x3e56ab,_0x158259);break;default:strategy[_0x7a88('0x43')](_0x5aa888,_0x331e1a,_0x3e56ab,_0x158259);}}else{logger['error'](_0x7a88('0x44'),_0x46e54f,_0x22e18f[_0x7a88('0x28')]);_0x2ec616[_0x7a88('0x36')]();}}}catch(_0x48c031){console['log'](_0x48c031);logger[_0x7a88('0x2c')](_0x7a88('0x33'),_0x46e54f,_0x48c031['stack']);_0x2ec616[_0x7a88('0x36')]();}};}; \ No newline at end of file +var _0x337f=['rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','moment','ioredis','../../../../config/environment','routing','./strategy','defaults','localhost','redis','queue','from','joinAt','emit','clone','queue_id','account','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','save','remove','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','upperFirst','channel','interaction','message','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','accepted','update','catch','timeout','update\x20queue\x20report','toLowerCase','[%s][QUEUE]\x20%s','map','join','stop','find','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x337f,0x11c));var _0xf337=function(_0x37e65f,_0x413059){_0x37e65f=_0x37e65f-0x0;var _0x4afff1=_0x337f[_0x37e65f];return _0x4afff1;};'use strict';var schema=require(_0xf337('0x0'));var _=require(_0xf337('0x1'));var util=require(_0xf337('0x2'));var seqqueue=require('seq-queue');var moment=require(_0xf337('0x3'));var Redis=require(_0xf337('0x4'));var config=require(_0xf337('0x5'));var logger=require('../../../../config/logger')(_0xf337('0x6'));var strategy=require(_0xf337('0x7'));config['redis']=_[_0xf337('0x8')](config['redis'],{'host':_0xf337('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf337('0xa')]));var attributes=['id','queue_id','account',_0xf337('0xb'),_0xf337('0xc'),_0xf337('0xd')];function emit(_0x2a4619,_0x31d704,_0x30936f){io['to'](_0x2a4619)[_0xf337('0xe')](_0x31d704,_0x30936f);}function emitChannelQueueInteraction(_0xca609b,_0x55ed61,_0x432c09,_0x9d0f24,_0x4013f6,_0x1c716e,_0x14358b,_0x269857){var _0x3be783=_[_0xf337('0xf')](_0x432c09);_0x3be783[_0xf337('0x10')]=_0x269857;_0x3be783[_0xf337('0xb')]=_0x55ed61;_0x3be783[_0xf337('0x11')]=_0x9d0f24;_0x3be783['id']=_0x4013f6;if(_0x1c716e){_0x14358b[util[_0xf337('0x12')]('%sQueuesWaitingInteractions',_0xca609b)][_0x4013f6]=_[_0xf337('0x13')](_0x3be783,attributes);}else{delete _0x14358b[util[_0xf337('0x12')](_0xf337('0x14'),_0xca609b)][_0x4013f6];}emit(util['format'](_0xf337('0x15'),_0xca609b,_0x55ed61),util[_0xf337('0x12')]('%s_queue_waiting_interaction:%s',_0xca609b,_0x1c716e?_0xf337('0x16'):_0xf337('0x17')),_[_0xf337('0x13')](_0x3be783,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xf337('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xf337('0x19')),'faxQueueReport':require(_0xf337('0x1a')),'whatsappQueueReport':require(_0xf337('0x1b'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xf337('0x1c'),'message':_0xf337('0x1d')}});function startRouting(_0x193607,_0x68e72b,_0x8858fe,_0xf212b6){if(_0x193607&&_0x68e72b&&_0x8858fe){_0x68e72b[_0xf337('0x1e')]+=0x1;var _0x240612={'uniqueid':_0x193607,'from':_0x8858fe[_0xf337('0x1f')]?_0x8858fe[_0xf337('0x1f')][_0xf337('0xc')]:'','joinAt':moment()[_0xf337('0x12')](_0xf337('0x20')),'ContactId':_0x8858fe['contact']?_0x8858fe[_0xf337('0x21')]['id']:null,'ListId':_0x8858fe['list']?_0x8858fe['list']['id']:null};_0x240612[_[_0xf337('0x22')](_0x8858fe[_0xf337('0x23')])+'QueueId']=_0x68e72b['id']||null;_0x240612[_[_0xf337('0x22')](_0x8858fe[_0xf337('0x23')])+'InteractionId']=_0x8858fe['interaction']?_0x8858fe[_0xf337('0x24')]['id']:null;_0x240612[_['upperFirst'](_0x8858fe['channel'])+'MessageId']=_0x8858fe[_0xf337('0x25')]?_0x8858fe['message']['id']:null;_0x240612[_['upperFirst'](_0x8858fe[_0xf337('0x23')])+(_0x8858fe[_0xf337('0x23')]!=='chat'?'AccountId':_0xf337('0x26'))]=_0x8858fe[_0xf337('0x11')]?_0x8858fe[_0xf337('0x11')]['id']:null;logger[_0xf337('0x27')](util['format'](_0xf337('0x28'),_0x193607,_0x68e72b[_0xf337('0x29')]));emitChannelQueueInteraction(_0x8858fe[_0xf337('0x23')],_0x68e72b[_0xf337('0x29')],_0x240612,_0x8858fe[_0xf337('0x11')][_0xf337('0x29')],_0x8858fe['message']['id'],!![],_0xf212b6,_0x68e72b['id']);if(rpc[_0x8858fe[_0xf337('0x23')]+_0xf337('0x2a')]){return rpc[_0x8858fe[_0xf337('0x23')]+_0xf337('0x2a')][_0xf337('0x2b')](_0x240612)['catch'](function(_0x27f0f7){logger[_0xf337('0x2c')](_0xf337('0x2d'));});}}}function stopRouting(_0x485e2e,_0x326b2d,_0x30a2c8,_0x9bb07){if(_0x485e2e&&_0x326b2d){_0x326b2d[_0xf337('0x1e')]-=0x1;var _0x2bc127={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0xf337('0x20')),'reason':_0xf337('0x2e')};logger[_0xf337('0x27')](util[_0xf337('0x12')]('[%s][STOP:QUEUE][NAME:%s]',_0x485e2e,_0x326b2d[_0xf337('0x29')]));emitChannelQueueInteraction(_0x30a2c8['channel'],_0x326b2d[_0xf337('0x29')],_0x30a2c8[_0xf337('0x1f')],_0x30a2c8[_0xf337('0x11')][_0xf337('0x29')],_0x30a2c8[_0xf337('0x25')]['id'],![],_0x9bb07,_0x326b2d['id']);if(rpc[_0x30a2c8[_0xf337('0x23')]+_0xf337('0x2a')]){return rpc[_0x30a2c8['channel']+_0xf337('0x2a')][_0xf337('0x2f')](_0x485e2e,_0x2bc127)[_0xf337('0x30')](function(_0x1e9347){logger[_0xf337('0x2c')]('update\x20queue\x20report');});}}}function endRouting(_0x314dc9,_0x2a5d6a,_0x50f4e4,_0x1ef800){if(_0x314dc9&&_0x2a5d6a){_0x2a5d6a[_0xf337('0x1e')]-=0x1;var _0x2b4009={'leaveAt':moment()['format'](_0xf337('0x20')),'exitAt':moment()[_0xf337('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xf337('0x31')};logger['info'](util[_0xf337('0x12')]('[%s][END:QUEUE][NAME:%s]',_0x314dc9,_0x2a5d6a[_0xf337('0x29')]));emitChannelQueueInteraction(_0x50f4e4[_0xf337('0x23')],_0x2a5d6a[_0xf337('0x29')],_0x50f4e4[_0xf337('0x1f')],_0x50f4e4[_0xf337('0x11')][_0xf337('0x29')],_0x50f4e4['message']['id'],![],_0x1ef800);if(rpc[_0x50f4e4['channel']+_0xf337('0x2a')]){return rpc[_0x50f4e4[_0xf337('0x23')]+_0xf337('0x2a')][_0xf337('0x2f')](_0x314dc9,_0x2b4009)[_0xf337('0x30')](function(_0x150bd9){logger[_0xf337('0x2c')](_0xf337('0x32'));});}}}function handleFindQueue(_0x4f7caf){return function(_0x38cbb5){return _0x38cbb5[_0xf337('0x29')][_0xf337('0x33')]()===_0x4f7caf[_0xf337('0x33')]();};}exports['consequence']=function(_0x57fcb0,_0x106cae,_0x45bc59,_0x58453e){return function(_0x207668){try{var _0x213cf0={'name':_0x106cae[0x0],'timeout':_0x106cae[0x1]};var _0x246ab9=queue[_0xf337('0x0')](_0x213cf0,{'typecast':!![]});if(_0x246ab9['length']){logger[_0xf337('0x2c')](_0xf337('0x34'),_0x57fcb0,_[_0xf337('0x35')](_0x246ab9,_0xf337('0x25'))[_0xf337('0x36')](',\x20'));_0x207668[_0xf337('0x37')]();}else{var _0x12b503=_[_0xf337('0x38')](_0x45bc59[_0x58453e[_0xf337('0x23')]+'Queues'],handleFindQueue(_0x213cf0['name']));if(_0x12b503){startRouting(_0x57fcb0,_0x12b503,_0x58453e,_0x45bc59);var _0x1a57a4=(_0x12b503['timeout']||0xa)*0x3e8;var _0x2f9f8b=(_0x213cf0[_0xf337('0x31')]||0x14)*0x3e8;var _0x3de8c2,_0x328484;if(_0x1a57a4>_0x2f9f8b){_0x2f9f8b=_0x1a57a4;}var _0x486d3e=seqqueue['createQueue'](_0x1a57a4);_0x486d3e['id']=_0x57fcb0;_0x486d3e[_0xf337('0x39')]=_0x1a57a4;_0x486d3e[_0xf337('0x3a')]=_0x2f9f8b;_0x486d3e['channel']=_0x58453e['channel'];_0x45bc59[_0xf337('0x3b')][_0x57fcb0]['on'](_0xf337('0x3c'),function(){logger[_0xf337('0x27')](_0xf337('0x3d'),_0x57fcb0);stopRouting(_0x57fcb0,_0x12b503,_0x58453e,_0x45bc59);clearTimeout(_0x3de8c2);_0x3de8c2=undefined;_0x486d3e[_0xf337('0x3e')](!![]);if(_0x45bc59[_0xf337('0x3b')][_0x57fcb0]){delete _0x45bc59[_0xf337('0x3b')][_0x57fcb0];}_0x207668['stop']();});_0x45bc59['rules'][_0x57fcb0]['on'](_0xf337('0x3f'),function(){if(_0x45bc59[_0xf337('0x3b')][_0x57fcb0]){delete _0x45bc59[_0xf337('0x3b')][_0x57fcb0];}});_0x3de8c2=setTimeout(function(){logger[_0xf337('0x27')](_0xf337('0x40'),_0x57fcb0);endRouting(_0x57fcb0,_0x12b503,_0x58453e,_0x45bc59);clearTimeout(_0x3de8c2);_0x486d3e[_0xf337('0x3e')](!![]);_0x207668['next']();},_0x2f9f8b);switch(_0x12b503[_0xf337('0x41')]){case _0xf337('0x42'):strategy[_0xf337('0x42')](_0x486d3e,_0x12b503,_0x45bc59,_0x58453e);break;default:strategy['beepall'](_0x486d3e,_0x12b503,_0x45bc59,_0x58453e);}}else{logger[_0xf337('0x2c')](_0xf337('0x43'),_0x57fcb0,_0x213cf0['name']);_0x207668[_0xf337('0x37')]();}}}catch(_0x3999f5){console[_0xf337('0x44')](_0x3999f5);logger[_0xf337('0x2c')](_0xf337('0x34'),_0x57fcb0,_0x3999f5[_0xf337('0x45')]);_0x207668[_0xf337('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 5428e5d..141dafa 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 _0x2109=['prototype','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','busy','busyQueue','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','handleTimeout','timeout','drained','bind'];(function(_0x169571,_0x2a94cd){var _0x5bc6a9=function(_0x44d66c){while(--_0x44d66c){_0x169571['push'](_0x169571['shift']());}};_0x5bc6a9(++_0x2a94cd);}(_0x2109,0x109));var _0x9210=function(_0x2b72f1,_0x10ae7d){_0x2b72f1=_0x2b72f1-0x0;var _0xbdd630=_0x2109[_0x2b72f1];return _0xbdd630;};'use strict';var _=require(_0x9210('0x0'));var uuid=require(_0x9210('0x1'));var util=require(_0x9210('0x2'));var logger=require(_0x9210('0x3'))(_0x9210('0x4'));var Agent=function(_0x4c6929,_0x23f024,_0x3b057d,_0x381d0c){this[_0x9210('0x5')]=uuid['v4']();this[_0x9210('0x6')]=_0x4c6929;this[_0x9210('0x7')]=_0x23f024;this[_0x9210('0x8')]=_0x3b057d;this[_0x9210('0x4')]=_0x381d0c;this[_0x9210('0x6')][_0x9210('0x9')](this[_0x9210('0xa')]['bind'](this),this[_0x9210('0xb')]['bind'](this));this[_0x9210('0x6')]['on'](_0x9210('0xc'),this[_0x9210('0xb')]['bind'](this));this[_0x9210('0x6')]['on'](_0x9210('0xd'),this['handleDrained'][_0x9210('0xe')](this));};Agent[_0x9210('0xf')][_0x9210('0x9')]=function(){this[_0x9210('0x6')][_0x9210('0x9')](this['handleRun'][_0x9210('0xe')](this),this[_0x9210('0xb')][_0x9210('0xe')](this));};Agent[_0x9210('0xf')][_0x9210('0x10')]=function(){this[_0x9210('0xb')](!![]);};Agent[_0x9210('0xf')][_0x9210('0xa')]=function(){logger[_0x9210('0x11')](_0x9210('0x12'),this[_0x9210('0x6')]['id'],this['agent']['id']);if(_[_0x9210('0x13')](this[_0x9210('0x8')][_0x9210('0x14')][this['agent']['id']])){logger[_0x9210('0x11')](_0x9210('0x15'),this['squeue']['id'],this[_0x9210('0x7')]['id']);setTimeout(this[_0x9210('0x9')]['bind'](this),0x3e8);}else{if(this[_0x9210('0x4')][_0x9210('0x16')]||util[_0x9210('0x17')](this[_0x9210('0x6')]['id'],this[_0x9210('0x8')][_0x9210('0x14')][this['agent']['id']],this['squeue'][_0x9210('0x18')],![])){this['realtime']['agents'][this[_0x9210('0x7')]['id']]['busy']=!![];this[_0x9210('0x8')][_0x9210('0x14')][this[_0x9210('0x7')]['id']]['busyQueue']=undefined;util[_0x9210('0x19')](this['notificationId'],this['squeue']['id'],this[_0x9210('0x8')][_0x9210('0x14')][this[_0x9210('0x7')]['id']],null,this[_0x9210('0x4')]);util[_0x9210('0x1a')](this['squeue']['id'],this[_0x9210('0x8')]['agents'][this[_0x9210('0x7')]['id']],_0x9210('0x1b')+(this['routing'][_0x9210('0x16')]?_0x9210('0x1c'):''));}else{logger[_0x9210('0x11')](_0x9210('0x1d'),this[_0x9210('0x6')]['id'],this[_0x9210('0x7')]['id']);setTimeout(this['push'][_0x9210('0xe')](this),0x3e8);}}};Agent[_0x9210('0xf')][_0x9210('0xb')]=function(_0x1a869a){if(_[_0x9210('0x13')](this['realtime'][_0x9210('0x14')][this[_0x9210('0x7')]['id']])){return logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x9210('0x6')]['id'],this[_0x9210('0x7')]['id']);}else{logger[_0x9210('0x11')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x9210('0x6')]['id'],this[_0x9210('0x7')]['id']);util['hideNotification'](this[_0x9210('0x5')],this[_0x9210('0x6')]['id'],this[_0x9210('0x8')]['agents'][this[_0x9210('0x7')]['id']],null,this[_0x9210('0x4')]);this['realtime'][_0x9210('0x14')][this[_0x9210('0x7')]['id']][_0x9210('0x1e')]=![];this[_0x9210('0x8')]['agents'][this['agent']['id']][_0x9210('0x1f')]=undefined;util[_0x9210('0x1a')](this['squeue']['id'],this[_0x9210('0x8')][_0x9210('0x14')][this['agent']['id']],_0x1a869a?_0x9210('0x20'):_0x9210('0x21'));}if(!_0x1a869a){setTimeout(this[_0x9210('0x9')][_0x9210('0xe')](this),0x3e8);}};function agent(_0x222643,_0x3bfec4,_0x490129,_0x553d12){return new Agent(_0x222643,_0x3bfec4,_0x490129,_0x553d12);}module[_0x9210('0x22')]=agent; \ No newline at end of file +var _0x3d4f=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busy','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','bind','timeout','drained','handleDrained','prototype','handleTimeout','debug','isNil','agents','agent','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busyQueue','showNotification','writeLog','RINGING'];(function(_0xc9fef,_0x5c422e){var _0x41cc04=function(_0x2fa453){while(--_0x2fa453){_0xc9fef['push'](_0xc9fef['shift']());}};_0x41cc04(++_0x5c422e);}(_0x3d4f,0x9f));var _0xf3d4=function(_0x5837d1,_0x4661e0){_0x5837d1=_0x5837d1-0x0;var _0x43b3b7=_0x3d4f[_0x5837d1];return _0x43b3b7;};'use strict';var _=require(_0xf3d4('0x0'));var uuid=require(_0xf3d4('0x1'));var util=require(_0xf3d4('0x2'));var logger=require(_0xf3d4('0x3'))(_0xf3d4('0x4'));var Agent=function(_0x2561cd,_0x5ebfcb,_0x32ca59,_0x5cc8f7){this[_0xf3d4('0x5')]=uuid['v4']();this[_0xf3d4('0x6')]=_0x2561cd;this['agent']=_0x5ebfcb;this[_0xf3d4('0x7')]=_0x32ca59;this['routing']=_0x5cc8f7;this[_0xf3d4('0x6')][_0xf3d4('0x8')](this[_0xf3d4('0x9')][_0xf3d4('0xa')](this),this['handleTimeout'][_0xf3d4('0xa')](this));this[_0xf3d4('0x6')]['on'](_0xf3d4('0xb'),this['handleTimeout'][_0xf3d4('0xa')](this));this['squeue']['on'](_0xf3d4('0xc'),this[_0xf3d4('0xd')][_0xf3d4('0xa')](this));};Agent[_0xf3d4('0xe')][_0xf3d4('0x8')]=function(){this[_0xf3d4('0x6')][_0xf3d4('0x8')](this[_0xf3d4('0x9')][_0xf3d4('0xa')](this),this[_0xf3d4('0xf')][_0xf3d4('0xa')](this));};Agent[_0xf3d4('0xe')][_0xf3d4('0xd')]=function(){this[_0xf3d4('0xf')](!![]);};Agent[_0xf3d4('0xe')][_0xf3d4('0x9')]=function(){logger[_0xf3d4('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this['agent']['id']);if(_[_0xf3d4('0x11')](this[_0xf3d4('0x7')][_0xf3d4('0x12')][this[_0xf3d4('0x13')]['id']])){logger[_0xf3d4('0x10')](_0xf3d4('0x14'),this[_0xf3d4('0x6')]['id'],this[_0xf3d4('0x13')]['id']);setTimeout(this[_0xf3d4('0x8')][_0xf3d4('0xa')](this),0x3e8);}else{if(this['routing'][_0xf3d4('0x15')]||util['isAgentAvailable'](this['squeue']['id'],this[_0xf3d4('0x7')][_0xf3d4('0x12')][this[_0xf3d4('0x13')]['id']],this[_0xf3d4('0x6')][_0xf3d4('0x16')],![])){this['realtime']['agents'][this[_0xf3d4('0x13')]['id']]['busy']=!![];this['realtime'][_0xf3d4('0x12')][this['agent']['id']][_0xf3d4('0x17')]=undefined;util[_0xf3d4('0x18')](this[_0xf3d4('0x5')],this[_0xf3d4('0x6')]['id'],this[_0xf3d4('0x7')]['agents'][this[_0xf3d4('0x13')]['id']],null,this[_0xf3d4('0x4')]);util[_0xf3d4('0x19')](this[_0xf3d4('0x6')]['id'],this[_0xf3d4('0x7')]['agents'][this[_0xf3d4('0x13')]['id']],_0xf3d4('0x1a')+(this[_0xf3d4('0x4')][_0xf3d4('0x15')]?':FORCED':''));}else{logger['debug'](_0xf3d4('0x1b'),this[_0xf3d4('0x6')]['id'],this[_0xf3d4('0x13')]['id']);setTimeout(this['push'][_0xf3d4('0xa')](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x5d8d15){if(_[_0xf3d4('0x11')](this[_0xf3d4('0x7')][_0xf3d4('0x12')][this[_0xf3d4('0x13')]['id']])){return logger['debug'](_0xf3d4('0x14'),this[_0xf3d4('0x6')]['id'],this['agent']['id']);}else{logger[_0xf3d4('0x10')](_0xf3d4('0x1c'),this[_0xf3d4('0x6')]['id'],this[_0xf3d4('0x13')]['id']);util['hideNotification'](this[_0xf3d4('0x5')],this['squeue']['id'],this[_0xf3d4('0x7')][_0xf3d4('0x12')][this[_0xf3d4('0x13')]['id']],null,this['routing']);this['realtime']['agents'][this[_0xf3d4('0x13')]['id']][_0xf3d4('0x1d')]=![];this[_0xf3d4('0x7')][_0xf3d4('0x12')][this[_0xf3d4('0x13')]['id']][_0xf3d4('0x17')]=undefined;util['writeLog'](this[_0xf3d4('0x6')]['id'],this[_0xf3d4('0x7')][_0xf3d4('0x12')][this[_0xf3d4('0x13')]['id']],_0x5d8d15?'STOP':'TIMEOUT');}if(!_0x5d8d15){setTimeout(this[_0xf3d4('0x8')]['bind'](this),0x3e8);}};function agent(_0x1deb7e,_0x25dadc,_0x56c610,_0x157ba8){return new Agent(_0x1deb7e,_0x25dadc,_0x56c610,_0x157ba8);}module[_0xf3d4('0x1e')]=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 737f6e2..85d6d56 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 _0xc6fe=['writeLog','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','Agents','length','agents','debug','isAgentAvailable'];(function(_0xa72261,_0x5f24ff){var _0x50b82c=function(_0x3964ad){while(--_0x3964ad){_0xa72261['push'](_0xa72261['shift']());}};_0x50b82c(++_0x5f24ff);}(_0xc6fe,0xbc));var _0xec6f=function(_0x326c53,_0x31cabc){_0x326c53=_0x326c53-0x0;var _0xfb3b8f=_0xc6fe[_0x326c53];return _0xfb3b8f;};'use strict';var _=require(_0xec6f('0x0'));var uuid=require(_0xec6f('0x1'));var util=require('./util');var logger=require(_0xec6f('0x2'))(_0xec6f('0x3'));var Beepall=function(_0x1c05f1,_0x50a1e9,_0x41ed86,_0x540732){this[_0xec6f('0x4')]=uuid['v4']();this[_0xec6f('0x5')]=_0x1c05f1;this[_0xec6f('0x6')]=_0x50a1e9;this[_0xec6f('0x7')]=_0x41ed86;this[_0xec6f('0x3')]=_0x540732;this[_0xec6f('0x5')][_0xec6f('0x8')](this[_0xec6f('0x9')][_0xec6f('0xa')](this),this[_0xec6f('0xb')]['bind'](this));this[_0xec6f('0x5')]['on'](_0xec6f('0xc'),this[_0xec6f('0xb')][_0xec6f('0xa')](this));this[_0xec6f('0x5')]['on'](_0xec6f('0xd'),this[_0xec6f('0xe')][_0xec6f('0xa')](this));};Beepall[_0xec6f('0xf')][_0xec6f('0x8')]=function(){this[_0xec6f('0x5')]['push'](this[_0xec6f('0x9')][_0xec6f('0xa')](this),this[_0xec6f('0xb')][_0xec6f('0xa')](this));};Beepall[_0xec6f('0xf')]['handleDrained']=function(){this['handleTimeout'](!![]);};Beepall[_0xec6f('0xf')][_0xec6f('0x9')]=function(){var _0x5b8f52=!![];if(!_['isNil'](this[_0xec6f('0x6')])&&!_[_0xec6f('0x10')](this['queue']['Agents'])&&this[_0xec6f('0x6')][_0xec6f('0x11')][_0xec6f('0x12')]>0x0){for(var _0x3d4ea1=0x0,_0x593c42;_0x3d4ea10x0){for(var _0x245f0d=0x0,_0x4c4123;_0x245f0d0x0&&_0xce9af6[_0x366f5c+_0xa9c5('0x23')]>=_0xce9af6[_0x366f5c+_0xa9c5('0x24')]){writeLog(_0x5d2115,_0xce9af6,_0x366f5c[_0xa9c5('0x25')]()+_0xa9c5('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x4e8a7f,_0x242771,_0x4cd5e6,_0x1762ac,_0x830bad){return sendNotification(!![],_0x4e8a7f,_0x242771,_0x4cd5e6,_0x1762ac,_0x830bad);};exports['hideNotification']=function(_0x11a723,_0x320dc0,_0x5f468b,_0x413edf,_0x32baf9){return sendNotification(![],_0x11a723,_0x320dc0,_0x5f468b,_0x413edf,_0x32baf9);};exports[_0xa9c5('0x27')]=writeLog; \ No newline at end of file +var _0x7dfd=['lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','format','user:%s','name','user:save','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','emit','save','remove','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var utils=require(_0xd7df('0x2'));var Redis=require(_0xd7df('0x3'));var config=require(_0xd7df('0x4'));var logger=require(_0xd7df('0x5'))(_0xd7df('0x6'));config[_0xd7df('0x7')]=_[_0xd7df('0x8')](config[_0xd7df('0x7')],{'host':_0xd7df('0x9'),'port':0x18eb});var io=require(_0xd7df('0xa'))(new Redis(config[_0xd7df('0x7')]));function sendNotification(_0x39ce98,_0x354ea7,_0x16e50,_0x2c48a4,_0x5c220a,_0xab6742){io['to'](util[_0xd7df('0xb')](_0xd7df('0xc'),_0x2c48a4[_0xd7df('0xd')]))['emit'](_0xd7df('0xe'),_0x2c48a4);var _0x532c14=_0xab6742||{};var _0x183ace=_0x16e50['split']('.');var _0x394d32={'uniqueid':_0x354ea7,'channel':_0x183ace[0x0],'id':_0x183ace[0x1],'title':_0x183ace[0x0]+_0xd7df('0xf'),'interactionId':_0x183ace[0x2],'queue':_0x5c220a?_0x5c220a[_0xd7df('0xd')]:null,'sound':_0x532c14[_0xd7df('0x10')][_0xd7df('0x11')],'shake':_0x532c14[_0xd7df('0x10')][_0xd7df('0x12')]};try{if(!_0x532c14[_0xd7df('0x13')]){_0x532c14[_0xd7df('0x13')]={};}if(_0x5c220a){_0x532c14[_0xd7df('0x13')][_0xd7df('0x14')]=_0x5c220a;}else if(_0x532c14[_0xd7df('0x13')][_0xd7df('0x14')]){delete _0x532c14[_0xd7df('0x13')][_0xd7df('0x14')];}_0x394d32[_0xd7df('0x15')]=utils[_0xd7df('0x16')](_0x532c14['account'][_0xd7df('0x17')],_0x532c14);}catch(_0x23cdbc){_0x394d32['msg']=_0xd7df('0x18');logger[_0xd7df('0x19')](util['format'](_0xd7df('0x1a'),_0x354ea7,_0x23cdbc[_0xd7df('0x1b')]));}io['to'](util[_0xd7df('0xb')]('user:%s',_0x2c48a4[_0xd7df('0xd')]))[_0xd7df('0x1c')](util[_0xd7df('0xb')]('notification:%s',_0x39ce98?_0xd7df('0x1d'):_0xd7df('0x1e')),_0x394d32);}function writeLog(_0x4e1985,_0x5acb0a,_0x4188af){return logger['debug'](util[_0xd7df('0xb')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x4e1985,_0x5acb0a[_0xd7df('0xd')],_0x4188af));}exports[_0xd7df('0x1f')]=function(_0x4eabb8,_0x5e59c3,_0xc50077,_0x502ae8){if(_0x5e59c3[_0xd7df('0x20')]){writeLog(_0x4eabb8,_0x5e59c3,_0xd7df('0x21'));return![];}if(!_0x5e59c3[_0xd7df('0x22')]){writeLog(_0x4eabb8,_0x5e59c3,_0xd7df('0x23'));return![];}if(_0x5e59c3[_0xc50077+_0xd7df('0x24')]){writeLog(_0x4eabb8,_0x5e59c3,_0xd7df('0x25'));return![];}if(_0x502ae8&&_0x5e59c3[_0xd7df('0x26')](_0xc50077+'Capacity')&&_0x5e59c3['hasOwnProperty'](_0xc50077+_0xd7df('0x27'))){if(_0x5e59c3[_0xc50077+_0xd7df('0x28')]>0x0&&_0x5e59c3[_0xc50077+_0xd7df('0x27')]>=_0x5e59c3[_0xc50077+_0xd7df('0x28')]){writeLog(_0x4eabb8,_0x5e59c3,_0xc50077[_0xd7df('0x29')]()+_0xd7df('0x2a'));return![];}}return!![];};exports[_0xd7df('0x2b')]=function(_0x2b6fde,_0x163904,_0x5c4d17,_0xe53f53,_0x132fd1){return sendNotification(!![],_0x2b6fde,_0x163904,_0x5c4d17,_0xe53f53,_0x132fd1);};exports[_0xd7df('0x2c')]=function(_0x29f0e8,_0x29b812,_0x2aa5a8,_0x3f78fa,_0x36de76){return sendNotification(![],_0x29f0e8,_0x29b812,_0x2aa5a8,_0x3f78fa,_0x36de76);};exports['writeLog']=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 0213d01..161f18c 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 _0x808a=['exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','error','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','consequence','length','map','message','info','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s'];(function(_0x9b1a6,_0xeb2cb){var _0x5363f1=function(_0x23a3bd){while(--_0x23a3bd){_0x9b1a6['push'](_0x9b1a6['shift']());}};_0x5363f1(++_0xeb2cb);}(_0x808a,0x1b7));var _0xa808=function(_0xd9f102,_0x5a0d28){_0xd9f102=_0xd9f102-0x0;var _0x2652e4=_0x808a[_0xd9f102];return _0x2652e4;};'use strict';var schema=require(_0xa808('0x0'));var sh=require(_0xa808('0x1'));var _=require(_0xa808('0x2'));var utils=require(_0xa808('0x3'));var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xa808('0x4')]=function(_0x38ed20,_0x3baf9b){return function(_0x342101){try{var _0x4ff931={'command':_0x3baf9b[0x0]};var _0x14b3bf=system[_0xa808('0x0')](_0x4ff931,{'typecast':!![]});if(_0x14b3bf[_0xa808('0x5')]){logger['error']('[%s][SYSTEM]\x20%s',_0x38ed20,_[_0xa808('0x6')](_0x14b3bf,_0xa808('0x7'))['join'](',\x20'));logger[_0xa808('0x8')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x38ed20);_0x342101['next']();}else{var _0x15b963=this;var _0x13561b=utils[_0xa808('0x9')](_0x3baf9b[0x0],this);logger[_0xa808('0x8')](_0xa808('0xa'),_0x38ed20,_0x13561b);sh[_0xa808('0xb')](_[_0xa808('0xc')](_0x13561b),function(_0x29ca49,_0x519b24){logger['info'](_0xa808('0xd'),_0x38ed20,_0x29ca49);if(_0x29ca49==0x0){var _0x3714fe=_0x519b24[_0xa808('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0xa808('0xf')](_0x3baf9b[0x1])||_[_0xa808('0x10')](_0x3baf9b[0x1])){logger['info'](_0xa808('0x11'),_0x38ed20);_0x15b963[_0xa808('0x12')][_0x3baf9b[0x1]]=_0x3714fe;}else{logger['info'](_0xa808('0x13'),_0x38ed20,_0x3baf9b[0x1],_0x3714fe);_0x15b963[_0xa808('0x12')][_0x3baf9b[0x1]]=_0x3714fe;}}_0x342101[_0xa808('0x14')]();});}}catch(_0x5ca5ba){logger[_0xa808('0x15')](_0xa808('0x16'),_0x38ed20,_[_0xa808('0x17')](_0x5ca5ba)?JSON[_0xa808('0x18')](_0x5ca5ba):_0x5ca5ba);logger[_0xa808('0x8')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x38ed20);_0x342101[_0xa808('0x14')]();}};}; \ No newline at end of file +var _0x6d66=['next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','lodash','./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x1fae4d,_0xc60732){var _0x24c881=function(_0x2d1ea5){while(--_0x2d1ea5){_0x1fae4d['push'](_0x1fae4d['shift']());}};_0x24c881(++_0xc60732);}(_0x6d66,0x9c));var _0x66d6=function(_0x180763,_0x4b889d){_0x180763=_0x180763-0x0;var _0x991e0c=_0x6d66[_0x180763];return _0x991e0c;};'use strict';var schema=require(_0x66d6('0x0'));var sh=require(_0x66d6('0x1'));var _=require(_0x66d6('0x2'));var utils=require(_0x66d6('0x3'));var logger=require('../../../../config/logger')(_0x66d6('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x66d6('0x5')}});exports['consequence']=function(_0x592f76,_0x3295a9){return function(_0x43c664){try{var _0x126133={'command':_0x3295a9[0x0]};var _0xc5da3c=system[_0x66d6('0x0')](_0x126133,{'typecast':!![]});if(_0xc5da3c[_0x66d6('0x6')]){logger[_0x66d6('0x7')](_0x66d6('0x8'),_0x592f76,_[_0x66d6('0x9')](_0xc5da3c,'message')['join'](',\x20'));logger[_0x66d6('0xa')](_0x66d6('0xb'),_0x592f76);_0x43c664[_0x66d6('0xc')]();}else{var _0x702a5e=this;var _0x11fd43=utils[_0x66d6('0xd')](_0x3295a9[0x0],this);logger[_0x66d6('0xa')](_0x66d6('0xe'),_0x592f76,_0x11fd43);sh[_0x66d6('0xf')](_[_0x66d6('0x10')](_0x11fd43),function(_0x56504c,_0x337673){logger[_0x66d6('0xa')](_0x66d6('0x11'),_0x592f76,_0x56504c);if(_0x56504c==0x0){var _0x89dff5=_0x337673[_0x66d6('0x12')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x3295a9[0x1])||_[_0x66d6('0x13')](_0x3295a9[0x1])){logger[_0x66d6('0xa')](_0x66d6('0x14'),_0x592f76);_0x702a5e[_0x66d6('0x15')][_0x3295a9[0x1]]=_0x89dff5;}else{logger['info'](_0x66d6('0x16'),_0x592f76,_0x3295a9[0x1],_0x89dff5);_0x702a5e[_0x66d6('0x15')][_0x3295a9[0x1]]=_0x89dff5;}}_0x43c664[_0x66d6('0xc')]();});}}catch(_0x4dab78){logger[_0x66d6('0x7')](_0x66d6('0x8'),_0x592f76,_[_0x66d6('0x17')](_0x4dab78)?JSON['stringify'](_0x4dab78):_0x4dab78);logger[_0x66d6('0xa')](_0x66d6('0xb'),_0x592f76);_0x43c664[_0x66d6('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 372323a..e423eeb 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 _0x726f=['../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][TAG]\x20%s','map','message','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction'];(function(_0x5e5c4c,_0x21abba){var _0x176148=function(_0x59522a){while(--_0x59522a){_0x5e5c4c['push'](_0x5e5c4c['shift']());}};_0x176148(++_0x21abba);}(_0x726f,0x1a5));var _0xf726=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x726f[_0x1d1779];return _0x2377e9;};'use strict';var schema=require(_0xf726('0x0'));var _=require(_0xf726('0x1'));var rpc={'chatInteraction':require(_0xf726('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xf726('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xf726('0x4'))};var logger=require(_0xf726('0x5'))(_0xf726('0x6'));var tag=schema({'tag':{'type':_0xf726('0x7'),'required':!![],'message':_0xf726('0x8')}});exports['consequence']=function(_0x3691ad,_0x20863a,_0x428561,_0x440af6){return function(_0x542806){try{var _0x4a6658={'tag':_0x20863a[0x0]};var _0x38e72e=tag[_0xf726('0x0')](_0x4a6658,{'typecast':!![]});if(_0x38e72e[_0xf726('0x9')]){logger[_0xf726('0xa')](_0xf726('0xb'),_0x3691ad,_[_0xf726('0xc')](_0x38e72e,_0xf726('0xd'))['join'](',\x20'));logger['info'](_0xf726('0xe'),_0x3691ad);_0x542806[_0xf726('0xf')]();}else{var _0x9de620={'ids':[_0x20863a[0x0]]};if(rpc[_0x440af6[_0xf726('0x10')]+_0xf726('0x11')]){rpc[_0x440af6[_0xf726('0x10')]+_0xf726('0x11')]['addTags'](_0x440af6['interaction']['id'],_0x9de620)[_0xf726('0x12')](function(_0x4059ce){logger[_0xf726('0x13')](_0xf726('0x14'),_0x3691ad,_0x20863a[0x1],_0x440af6[_0xf726('0x10')],_0x440af6['interaction']['id']);})[_0xf726('0x15')](function(_0x1da214){logger['error'](_0xf726('0xb'),_0x3691ad,JSON[_0xf726('0x16')](_0x1da214));logger[_0xf726('0x13')](_0xf726('0xe'),_0x3691ad);})[_0xf726('0x17')](function(){_0x542806[_0xf726('0xf')]();});}}}catch(_0x2c7f4b){logger[_0xf726('0xa')]('[%s][TAG]\x20%s',_0x3691ad,_[_0xf726('0x18')](_0x2c7f4b)?JSON[_0xf726('0x16')](_0x2c7f4b):_0x2c7f4b);logger[_0xf726('0x13')](_0xf726('0xe'),_0x3691ad);_0x542806['next']();}};}; \ No newline at end of file +var _0x563b=['routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','validate','lodash','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x15781b,_0x4db9bb){var _0x20f955=function(_0x636ad0){while(--_0x636ad0){_0x15781b['push'](_0x15781b['shift']());}};_0x20f955(++_0x4db9bb);}(_0x563b,0x15b));var _0xb563=function(_0x26054b,_0x555485){_0x26054b=_0x26054b-0x0;var _0x58a596=_0x563b[_0x26054b];return _0x58a596;};'use strict';var schema=require(_0xb563('0x0'));var _=require(_0xb563('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xb563('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xb563('0x3')),'whatsappInteraction':require(_0xb563('0x4'))};var logger=require('../../../../config/logger')(_0xb563('0x5'));var tag=schema({'tag':{'type':_0xb563('0x6'),'required':!![],'message':_0xb563('0x7')}});exports['consequence']=function(_0xde8191,_0x5f0df4,_0x60381f,_0x2c99c6){return function(_0x3a0766){try{var _0x19cc74={'tag':_0x5f0df4[0x0]};var _0x5d8fd0=tag[_0xb563('0x0')](_0x19cc74,{'typecast':!![]});if(_0x5d8fd0[_0xb563('0x8')]){logger['error'](_0xb563('0x9'),_0xde8191,_[_0xb563('0xa')](_0x5d8fd0,_0xb563('0xb'))['join'](',\x20'));logger[_0xb563('0xc')](_0xb563('0xd'),_0xde8191);_0x3a0766[_0xb563('0xe')]();}else{var _0x34d8c3={'ids':[_0x5f0df4[0x0]]};if(rpc[_0x2c99c6[_0xb563('0xf')]+'Interaction']){rpc[_0x2c99c6[_0xb563('0xf')]+'Interaction'][_0xb563('0x10')](_0x2c99c6[_0xb563('0x11')]['id'],_0x34d8c3)[_0xb563('0x12')](function(_0x4ec16b){logger['info'](_0xb563('0x13'),_0xde8191,_0x5f0df4[0x1],_0x2c99c6[_0xb563('0xf')],_0x2c99c6[_0xb563('0x11')]['id']);})[_0xb563('0x14')](function(_0x31d0b4){logger['error'](_0xb563('0x9'),_0xde8191,JSON[_0xb563('0x15')](_0x31d0b4));logger[_0xb563('0xc')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xde8191);})['finally'](function(){_0x3a0766['next']();});}}}catch(_0x5dca1b){logger['error'](_0xb563('0x9'),_0xde8191,_['isObject'](_0x5dca1b)?JSON[_0xb563('0x15')](_0x5dca1b):_0x5dca1b);logger[_0xb563('0xc')](_0xb563('0xd'),_0xde8191);_0x3a0766[_0xb563('0xe')]();}};}; \ 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 f4f2ba1..fe689e1 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 _0xb5cb=['parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','stringify','info','stop','catch','error','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','lodash','replace','includes','urlOnAnswer','?params=','urlOnRing','title','method','login','push','application/json-rpc','then'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xb5cb,0x179));var _0xbb5c=function(_0x540841,_0x149d1f){_0x540841=_0x540841-0x0;var _0x58c65d=_0xb5cb[_0x540841];return _0x58c65d;};'use strict';var rp=require(_0xbb5c('0x0'));var logger=require(_0xbb5c('0x1'))(_0xbb5c('0x2'));var _=require(_0xbb5c('0x3'));var arr=[];exports['consequence']=function(_0x2e9bb9,_0x4fc9db){return function(_0x1df30a){var _0x3364c8=_0x4fc9db[0xa];var _0x41289d=_0x4fc9db[0xb];var _0x3bc38d=_0x4fc9db[0xc];var _0x32c9aa=_0x4fc9db[0xd];var _0x451a50=_0x4fc9db[0xe];var _0xd49447=_0x4fc9db[0xf][_0xbb5c('0x4')](/\n/g,'\x20-\x20');var _0x1d2c7a=_0x4fc9db[0x10][_0xbb5c('0x4')](/\n/g,'\x20');if(!arr[_0xbb5c('0x5')](_0x41289d)){arr['push'](_0x41289d);var _0x3d56c4=_0x4fc9db[0x3];var _0x3dcbcf=_0x4fc9db[0x4];var _0x37ee53=_0x4fc9db[0x1];var _0x387549=_0x4fc9db[0x0];var _0x12f518={};_0x12f518[_0xbb5c('0x6')]=_0x4fc9db[0x8]+_0xbb5c('0x7')+_0x3bc38d+'|'+_0x3364c8+'|'+_0x32c9aa+'|'+_0x41289d+'|'+_0x451a50;_0x12f518[_0xbb5c('0x8')]=_0x4fc9db[0x7]+_0xbb5c('0x7')+_0x3bc38d+'|'+_0x3364c8+'|'+_0x32c9aa+'|'+_0x41289d+'|'+_0x451a50+'|'+_0xd49447+'|'+_0x1d2c7a;_0x12f518[_0xbb5c('0x9')]=_0x4fc9db[0x9];var _0x5dc45d={};_0x5dc45d['jsonrpc']='2.0';_0x5dc45d[_0xbb5c('0xa')]=_0xbb5c('0xb');var _0x24a99d=[];_0x24a99d['push'](_0x4fc9db[0x2]);_0x24a99d[_0xbb5c('0xc')](_0x4fc9db[0x5]);_0x24a99d[_0xbb5c('0xc')](_0x4fc9db[0x6]);_0x5dc45d['params']=_0x24a99d;_0x5dc45d['id']=0x1;var _0x20502b=JSON['stringify'](_0x5dc45d);var _0x4ba700={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x3d56c4,'headers':{'Content-Type':_0xbb5c('0xd')},'body':_0x20502b};return rp(_0x4ba700)[_0xbb5c('0xe')](function(_0xbc419a){const _0x294942=JSON[_0xbb5c('0xf')](_0xbc419a);if(!_0x294942[_0xbb5c('0x10')][_0xbb5c('0x11')]){throw new Error(_0xbb5c('0x12'));}var _0x356312=_0x41289d;var _0x3c8392=_0xbb5c('0x13')+_0x37ee53+_0xbb5c('0x14')+_0x387549+_0xbb5c('0x15')+_0x356312+'&data='+JSON[_0xbb5c('0x16')](_0x12f518);var _0x35a616=_0x3dcbcf+'?'+_0x3c8392;return rp(_0x35a616);})[_0xbb5c('0xe')](function(_0x873205){logger[_0xbb5c('0x17')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x2e9bb9,_0x873205);_0x1df30a[_0xbb5c('0x18')]();})[_0xbb5c('0x19')](function(_0x11626c){logger[_0xbb5c('0x1a')]('[%s][TVOX]\x20%s',_0x2e9bb9,_['isObject'](_0x11626c)?JSON[_0xbb5c('0x16')](_0x11626c):_0x11626c);_0x1df30a[_0xbb5c('0x18')]();});}else{logger[_0xbb5c('0x17')](_0xbb5c('0x1b'),_0x2e9bb9);_0x1df30a['next']();}};}; \ No newline at end of file +var _0x6a40=['[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','lodash','consequence','replace','\x20-\x20','includes','?params=','title','method','push','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','isObject','info'];(function(_0x16f10c,_0x313637){var _0x498a56=function(_0x161bfa){while(--_0x161bfa){_0x16f10c['push'](_0x16f10c['shift']());}};_0x498a56(++_0x313637);}(_0x6a40,0xda));var _0x06a4=function(_0x4fd462,_0x4d2ffd){_0x4fd462=_0x4fd462-0x0;var _0x4d773b=_0x6a40[_0x4fd462];return _0x4d773b;};'use strict';var rp=require(_0x06a4('0x0'));var logger=require(_0x06a4('0x1'))('routing');var _=require(_0x06a4('0x2'));var arr=[];exports[_0x06a4('0x3')]=function(_0x5cb8c3,_0x1899fb){return function(_0x50e3b1){var _0x2e98d3=_0x1899fb[0xa];var _0xcb0ca3=_0x1899fb[0xb];var _0x90acb=_0x1899fb[0xc];var _0xec13cc=_0x1899fb[0xd];var _0x5bbfe7=_0x1899fb[0xe];var _0x20672f=_0x1899fb[0xf][_0x06a4('0x4')](/\n/g,_0x06a4('0x5'));var _0x34ac0d=_0x1899fb[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x06a4('0x6')](_0xcb0ca3)){arr['push'](_0xcb0ca3);var _0x39cceb=_0x1899fb[0x3];var _0xe82112=_0x1899fb[0x4];var _0x45aae2=_0x1899fb[0x1];var _0x39e09b=_0x1899fb[0x0];var _0x229090={};_0x229090['urlOnAnswer']=_0x1899fb[0x8]+'?params='+_0x90acb+'|'+_0x2e98d3+'|'+_0xec13cc+'|'+_0xcb0ca3+'|'+_0x5bbfe7;_0x229090['urlOnRing']=_0x1899fb[0x7]+_0x06a4('0x7')+_0x90acb+'|'+_0x2e98d3+'|'+_0xec13cc+'|'+_0xcb0ca3+'|'+_0x5bbfe7+'|'+_0x20672f+'|'+_0x34ac0d;_0x229090[_0x06a4('0x8')]=_0x1899fb[0x9];var _0x5ea323={};_0x5ea323['jsonrpc']='2.0';_0x5ea323[_0x06a4('0x9')]='login';var _0x573fe5=[];_0x573fe5[_0x06a4('0xa')](_0x1899fb[0x2]);_0x573fe5[_0x06a4('0xa')](_0x1899fb[0x5]);_0x573fe5[_0x06a4('0xa')](_0x1899fb[0x6]);_0x5ea323[_0x06a4('0xb')]=_0x573fe5;_0x5ea323['id']=0x1;var _0x26fb28=JSON[_0x06a4('0xc')](_0x5ea323);var _0x31ddd7={'encoding':_0x06a4('0xd'),'method':_0x06a4('0xe'),'timeout':0x2710,'url':_0x39cceb,'headers':{'Content-Type':_0x06a4('0xf')},'body':_0x26fb28};return rp(_0x31ddd7)[_0x06a4('0x10')](function(_0x431c74){const _0x42a17e=JSON[_0x06a4('0x11')](_0x431c74);if(!_0x42a17e[_0x06a4('0x12')][_0x06a4('0x13')]){throw new Error(_0x06a4('0x14'));}var _0x3d7d9c=_0xcb0ca3;var _0x2c1425=_0x06a4('0x15')+_0x45aae2+_0x06a4('0x16')+_0x39e09b+_0x06a4('0x17')+_0x3d7d9c+_0x06a4('0x18')+JSON[_0x06a4('0xc')](_0x229090);var _0x52ddb1=_0xe82112+'?'+_0x2c1425;return rp(_0x52ddb1);})[_0x06a4('0x10')](function(_0x59aed0){logger['info'](_0x06a4('0x19'),_0x5cb8c3,_0x59aed0);_0x50e3b1[_0x06a4('0x1a')]();})[_0x06a4('0x1b')](function(_0x2c31e8){logger['error']('[%s][TVOX]\x20%s',_0x5cb8c3,_[_0x06a4('0x1c')](_0x2c31e8)?JSON['stringify'](_0x2c31e8):_0x2c31e8);_0x50e3b1[_0x06a4('0x1a')]();});}else{logger[_0x06a4('0x1d')](_0x06a4('0x1e'),_0x5cb8c3);_0x50e3b1['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 25129ca..92b3d55 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x277dcc,_0x537dc3){var _0x1d2c87=function(_0x300c48){while(--_0x300c48){_0x277dcc['push'](_0x277dcc['shift']());}};_0x1d2c87(++_0x537dc3);}(_0xe706,0xa3));var _0x6e70=function(_0x2bcb4d,_0x1b1d96){_0x2bcb4d=_0x2bcb4d-0x0;var _0x423940=_0xe706[_0x2bcb4d];return _0x423940;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x52d894,_0x20b608){var _0x52aed2=function(_0x3962cf){while(--_0x3962cf){_0x52d894['push'](_0x52d894['shift']());}};_0x52aed2(++_0x20b608);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index c45241d..987df44 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 _0xc368=['message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','values','find','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','jayson/promise','bluebird','./applications/utils','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','mail','push','slice','dialogflow','appdata','dialogflowv2','split','amazonlex','tag','TagId','tvox','account','ChatWebsiteId','ContactId','body','%s:%s:%s','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','stack'];(function(_0x493dda,_0x1528d3){var _0x31a5a6=function(_0x43c676){while(--_0x43c676){_0x493dda['push'](_0x493dda['shift']());}};_0x31a5a6(++_0x1528d3);}(_0xc368,0x7b));var _0x8c36=function(_0x3525de,_0x4bf473){_0x3525de=_0x3525de-0x0;var _0x26101c=_0xc368[_0x3525de];return _0x26101c;};'use strict';var _=require('lodash');var util=require(_0x8c36('0x0'));var path=require('path');var fs=require('fs');var jayson=require(_0x8c36('0x1'));var BPromise=require(_0x8c36('0x2'));var utils=require(_0x8c36('0x3'));var logger=require(_0x8c36('0x4'))(_0x8c36('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x8c36('0x6')),'chatQueueReport':require(_0x8c36('0x7')),'smsQueueReport':require(_0x8c36('0x8')),'faxQueueReport':require(_0x8c36('0x9')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x8ed437,_0x384867,_0x3e76be){return util[_0x8c36('0xa')](_0x8c36('0xb'),_0x8ed437,_0x384867||0x0,_0x3e76be||0x0);}function getIntervals(_0x207021,_0x569f29){var _0x5bfbdd=[];if(!_['isNil'](_0x569f29[_0x8c36('0xc')])&&!_[_0x8c36('0xd')](_0x207021[_0x569f29['IntervalId']])&&!_[_0x8c36('0xd')](_0x207021[_0x569f29[_0x8c36('0xc')]][_0x8c36('0xe')])){_0x5bfbdd=_[_0x8c36('0xf')](_0x207021[_0x569f29[_0x8c36('0xc')]][_0x8c36('0xe')],_0x8c36('0x10'));}else if(!_[_0x8c36('0xd')](_0x569f29[_0x8c36('0x10')])){_0x5bfbdd=[_0x569f29[_0x8c36('0x10')]];}return _0x5bfbdd;}exports[_0x8c36('0x11')]=function(_0x25a83e){_0x25a83e[_0x8c36('0x12')]={};return new BPromise(function(_0x220f18,_0x5dfcd5){var _0x31d8bf={'Start':function(_0x5e32ad){var _0xea7509=this;return new Promise(function(_0x3f83aa,_0x29e791){if(_0x5e32ad){try{var _0x1fc68e=[];var _0xcfdbf7=getId(_0x5e32ad[_0x8c36('0x13')],_0x5e32ad[_0x8c36('0x14')]?_0x5e32ad[_0x8c36('0x14')]['id']:0x0,_0x5e32ad[_0x8c36('0x15')]?_0x5e32ad['interaction']['id']:0x0);if(_0x5e32ad[_0x8c36('0x16')]&&_[_0x8c36('0x17')](_0x5e32ad[_0x8c36('0x16')])&&_0x5e32ad[_0x8c36('0x16')][_0x8c36('0x18')]){for(var _0x5e5162=0x0;_0x5e5162<_0x5e32ad[_0x8c36('0x16')][_0x8c36('0x18')];_0x5e5162+=0x1){var _0x2ac843=_0x5e32ad[_0x8c36('0x16')][_0x5e5162];if(fs[_0x8c36('0x19')](path[_0x8c36('0x1a')](__dirname,_0x8c36('0x16'),_0x2ac843[_0x8c36('0x1b')]+_0x8c36('0x1c')))){var _0x474c5d=[];switch(_0x2ac843[_0x8c36('0x1b')][_0x8c36('0x1d')]()){case _0x8c36('0x1e'):var _0x51fd6c=_0x2ac843['appdata']['split'](',');if(_0x5e32ad['channel']===_0x8c36('0x1f')){_0x474c5d[_0x8c36('0x20')](_0x51fd6c[0x0]);_0x474c5d[_0x8c36('0x20')](_0x51fd6c[0x1]);_0x474c5d[_0x8c36('0x20')](_0x51fd6c[_0x8c36('0x21')](0x2,_0x51fd6c[_0x8c36('0x18')])['join'](','));}else{_0x474c5d[_0x8c36('0x20')](_0x51fd6c[0x0]);_0x474c5d['push'](_0x51fd6c[_0x8c36('0x21')](0x1,_0x51fd6c['length'])[_0x8c36('0x1a')](','));}break;case _0x8c36('0x22'):var _0x271ec4=_0x2ac843[_0x8c36('0x23')]['split'](',');_0x474c5d['push'](_0x271ec4[0x0]);_0x474c5d[_0x8c36('0x20')](_0x271ec4[0x1]);_0x474c5d[_0x8c36('0x20')](_0x271ec4['slice'](0x2,_0x271ec4['length'])[_0x8c36('0x1a')](','));break;case _0x8c36('0x24'):var _0x502fa3=_0x2ac843[_0x8c36('0x23')][_0x8c36('0x25')](',');_0x474c5d[_0x8c36('0x20')](_0x502fa3[0x0]);_0x474c5d['push'](_0x502fa3[0x1]);_0x474c5d['push'](_0x502fa3[0x2]);_0x474c5d[_0x8c36('0x20')](_0x502fa3[0x3]);_0x474c5d[_0x8c36('0x20')](_0x502fa3[_0x8c36('0x21')](0x4,_0x502fa3[_0x8c36('0x18')])[_0x8c36('0x1a')](','));break;case _0x8c36('0x26'):var _0x387e66=_0x2ac843[_0x8c36('0x23')][_0x8c36('0x25')](',');_0x474c5d[_0x8c36('0x20')](_0x387e66[0x0]);_0x474c5d[_0x8c36('0x20')](_0x387e66[0x1]);_0x474c5d[_0x8c36('0x20')](_0x387e66[0x2]);_0x474c5d[_0x8c36('0x20')](_0x387e66[0x3]);_0x474c5d[_0x8c36('0x20')](_0x387e66[_0x8c36('0x21')](0x4,_0x387e66[_0x8c36('0x18')])[_0x8c36('0x1a')](','));break;case'message':_0x474c5d['push'](_0x2ac843['appdata']);break;case _0x8c36('0x27'):_0x474c5d[_0x8c36('0x20')](_0x2ac843[_0x8c36('0x28')]);_0x474c5d[_0x8c36('0x20')](_0x2ac843[_0x8c36('0x23')]);break;case _0x8c36('0x29'):var _0xc3f5b4=utils['getMustacheRender'](_0x5e32ad[_0x8c36('0x2a')]['notificationTemplate'],_0x5e32ad);var _0x3def90=_0x2ac843['appdata'][_0x8c36('0x25')](',');_0x474c5d[_0x8c36('0x20')](_0x3def90[0x0]);_0x474c5d[_0x8c36('0x20')](_0x3def90[0x1]);_0x474c5d['push'](_0x3def90[0x2]);_0x474c5d[_0x8c36('0x20')](_0x3def90[0x3]);_0x474c5d[_0x8c36('0x20')](_0x3def90[0x4]);_0x474c5d[_0x8c36('0x20')](_0x3def90[0x5]);_0x474c5d[_0x8c36('0x20')](_0x3def90[0x6]);_0x474c5d[_0x8c36('0x20')](_0x3def90[0x7]);_0x474c5d[_0x8c36('0x20')](_0x3def90[0x8]);_0x474c5d[_0x8c36('0x20')](_0x3def90[0x9]);_0x474c5d[_0x8c36('0x20')](_0x3def90[0xa]);_0x474c5d[_0x8c36('0x20')](_0x5e32ad[_0x8c36('0x15')]['id']);_0x474c5d[_0x8c36('0x20')](_0x5e32ad[_0x8c36('0x14')]['id']);_0x474c5d[_0x8c36('0x20')](_0x2ac843[_0x8c36('0x2b')]);_0x474c5d[_0x8c36('0x20')](_0x5e32ad[_0x8c36('0x15')][_0x8c36('0x2c')]);_0x474c5d['push'](_0x5e32ad[_0x8c36('0x2d')]['body']);_0x474c5d[_0x8c36('0x20')](_0xc3f5b4);break;default:_0x474c5d=_[_0x8c36('0xd')](_0x2ac843[_0x8c36('0x23')])?[]:_0x2ac843[_0x8c36('0x23')]['split'](',');}var _0x5a50d6={'id':util[_0x8c36('0xa')](_0x8c36('0x2e'),_0xcfdbf7,_0x2ac843['id'],_0x2ac843[_0x8c36('0x1b')]),'condition':require('./interval')['condition'](_0xcfdbf7,getIntervals(_0x25a83e[_0x8c36('0x2f')],_0x2ac843),_0x25a83e),'consequence':require('./applications/'+_0x2ac843['app'])[_0x8c36('0x30')](_0xcfdbf7,_0x474c5d,_0x25a83e,_0x5e32ad),'p':_0x2ac843[_0x8c36('0x31')]||0x0};logger[_0x8c36('0x32')](_0x8c36('0x33'),_0x5a50d6['id'],_0x8c36('0x34'),getIntervals(_0x25a83e[_0x8c36('0x2f')],_0x2ac843)[_0x8c36('0x1a')](_0x8c36('0x35')));_0x1fc68e[_0x8c36('0x20')](_0x5a50d6);}else{logger[_0x8c36('0x36')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x8c36('0x1a')](__dirname,_0x8c36('0x16'),_0x2ac843[_0x8c36('0x1b')]+_0x8c36('0x1c')));}}_0x25a83e[_0x8c36('0x12')][_0xcfdbf7]=new RuleEngine(_0x1fc68e);_0x25a83e['rules'][_0xcfdbf7][_0x8c36('0x37')](_0x5e32ad,function(_0x3dde7b){logger[_0x8c36('0x32')](_0x8c36('0x38'),JSON[_0x8c36('0x39')](_0x3dde7b[_0x8c36('0x3a')]));if(_0x25a83e['rules'][_0xcfdbf7]){_0x25a83e[_0x8c36('0x12')][_0xcfdbf7][_0x8c36('0x3b')](_0x8c36('0x3c'));}});return _0x3f83aa({'code':0xc8,'message':_0x5e32ad});}else{logger[_0x8c36('0x32')](_0x8c36('0x3d'));return _0x3f83aa({'code':0xc8,'message':_0x5e32ad});}}catch(_0x393fd0){logger[_0x8c36('0x36')](_0x393fd0['stack']);return _0x29e791(_0xea7509[_0x8c36('0x36')](0x1f4,_0x393fd0));}}return _0x29e791(_0x8c36('0x3e'));});},'AcceptMessage':function(_0x9d2165){var _0x35fef3=this;return new Promise(function(_0x2b3e58,_0x381060){if(_0x9d2165[_0x8c36('0x3f')]&&_0x9d2165[_0x8c36('0x3f')]['id']){if(_0x25a83e[_0x8c36('0x40')][_0x9d2165[_0x8c36('0x3f')]['id']]){_0x25a83e[_0x8c36('0x40')][_0x9d2165[_0x8c36('0x3f')]['id']]['busy']=![];_0x25a83e['agents'][_0x9d2165[_0x8c36('0x3f')]['id']][_0x8c36('0x41')]=undefined;}}if(_0x9d2165[_0x8c36('0x14')]&&_0x9d2165[_0x8c36('0x14')]['id']){try{var _0x5ea64d=getId(_0x9d2165[_0x8c36('0x13')],_0x9d2165[_0x8c36('0x14')]?_0x9d2165['message']['id']:0x0,_0x9d2165['interaction']?_0x9d2165['interaction']['id']:0x0);if(_0x25a83e[_0x8c36('0x12')][_0x5ea64d]){_0x25a83e[_0x8c36('0x12')][_0x5ea64d][_0x8c36('0x3b')](_0x8c36('0x42'));if(rpc[_0x9d2165[_0x8c36('0x13')]+_0x8c36('0x43')]){rpc[_0x9d2165['channel']+_0x8c36('0x43')][_0x8c36('0x44')](_0x5ea64d,{'UserId':_0x9d2165[_0x8c36('0x14')][_0x8c36('0x45')]})['catch'](function(){logger['error']('error\x20update\x20queue\x20report');});}}return _0x2b3e58({'code':0xc8,'message':_0x9d2165});}catch(_0x3887e4){logger[_0x8c36('0x36')](_0x3887e4[_0x8c36('0x46')]);return _0x381060(_0x35fef3[_0x8c36('0x36')](0x1f4,_0x3887e4));}}logger[_0x8c36('0x36')](_0x8c36('0x47'));return _0x381060(_0x35fef3[_0x8c36('0x36')](0x1f4,_0x8c36('0x47')));});},'RejectMessage':function(_0x2c9d63){var _0x4e0635=this;return new Promise(function(_0x4cba50,_0x41a120){if(_0x2c9d63['agent']&&_0x2c9d63['agent']['id']){try{if(_0x25a83e[_0x8c36('0x40')][_0x2c9d63['agent']['id']]){_0x25a83e[_0x8c36('0x40')][_0x2c9d63[_0x8c36('0x3f')]['id']]['busy']=![];_0x25a83e[_0x8c36('0x40')][_0x2c9d63['agent']['id']][_0x8c36('0x41')]=undefined;}return _0x4cba50({'code':0xc8,'message':_0x2c9d63});}catch(_0x25ebcc){logger[_0x8c36('0x36')](_0x25ebcc['stack']);return _0x41a120(_0x4e0635[_0x8c36('0x36')](0x1f4,_0x25ebcc));}}logger[_0x8c36('0x36')](_0x8c36('0x47'));return _0x41a120(_0x4e0635[_0x8c36('0x36')](0x1f4,_0x8c36('0x47')));});},'AbandonInteraction':function(_0x1505f3){var _0x242d1a=this;return new Promise(function(_0x5905c0,_0x20f1d9){if(_0x1505f3['channel']&&_0x1505f3['interaction']&&_0x1505f3['interaction']['id']){try{var _0x20c1b0=getId(_0x1505f3['channel'],_0x1505f3['message']?_0x1505f3[_0x8c36('0x14')]['id']:0x0,_0x1505f3[_0x8c36('0x15')]?_0x1505f3[_0x8c36('0x15')]['id']:0x0);if(_0x25a83e[_0x8c36('0x12')][_0x20c1b0]){_0x25a83e[_0x8c36('0x12')][_0x20c1b0]['emit']('end');}return _0x5905c0({'code':0xc8,'message':_0x1505f3});}catch(_0x54c675){logger[_0x8c36('0x36')](_0x54c675[_0x8c36('0x46')]);return _0x20f1d9(_0x242d1a['error'](0x1f4,_0x54c675));}}logger[_0x8c36('0x36')](_0x8c36('0x47'));return _0x20f1d9(_0x242d1a[_0x8c36('0x36')](0x1f4,_0x8c36('0x47')));});},'AgentCapacity':function(_0x32871e){var _0x1094f9=this;return new Promise(function(_0x1c0669,_0x273325){if(_0x25a83e[_0x8c36('0x40')]['hasOwnProperty'](_0x32871e['id'])){for(var _0x529453 in _0x32871e['capacity']){if(_0x32871e[_0x8c36('0x48')][_0x8c36('0x49')](_0x529453)){if(_0x25a83e[_0x8c36('0x40')][_0x32871e['id']][_0x8c36('0x49')](_0x529453+_0x8c36('0x4a'))){_0x25a83e[_0x8c36('0x40')][_0x32871e['id']][_0x529453+'CurrentCapacity']=parseInt(_0x32871e[_0x8c36('0x48')][_0x529453],0xa);}}}_0x25a83e['agents'][_0x32871e['id']][_0x8c36('0x4b')]();return _0x1c0669({'code':0xc8,'message':_0x25a83e[_0x8c36('0x40')][_0x32871e['id']]});}else{return _0x273325(_0x1094f9[_0x8c36('0x36')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0xe59f9b){return new Promise(function(_0x51c797){var _0x11acb3=_[_0x8c36('0x4c')](_0x25a83e[_0x8c36('0x40')]);if(_0xe59f9b&&_0xe59f9b['id']){var _0xaa4cea=_[_0x8c36('0x4d')](_0x11acb3,function(_0x51e103){return _0x51e103['id']===_0xe59f9b['id'];});_0x51c797(_0xaa4cea);}else{_0x51c797({'count':_0x11acb3[_0x8c36('0x18')],'rows':_0x11acb3});}});},'ChatQueues':function(){return new Promise(function(_0x4c9a41){var _0x39ab18=[];for(var _0x461290 in _0x25a83e['chatQueues']){if(_0x25a83e[_0x8c36('0x4e')][_0x8c36('0x49')](_0x461290)){var _0x10dfc1=_0x25a83e['chatQueues'][_0x461290];var _0x244634={'id':_0x10dfc1['id'],'available':_0x10dfc1[_0x8c36('0x4f')],'loggedIn':_0x10dfc1[_0x8c36('0x50')],'name':_0x10dfc1[_0x8c36('0x51')],'paused':_0x10dfc1['paused'],'waiting':_0x10dfc1[_0x8c36('0x52')]};_0x39ab18[_0x8c36('0x20')](_0x244634);}}_0x4c9a41({'count':_0x39ab18['length'],'rows':_0x39ab18});});},'MailQueues':function(){return new Promise(function(_0xff22f0){var _0x1bfe8c=[];for(var _0x73b4cc in _0x25a83e['mailQueues']){if(_0x25a83e[_0x8c36('0x53')][_0x8c36('0x49')](_0x73b4cc)){var _0x4e5c82=_0x25a83e[_0x8c36('0x53')][_0x73b4cc];var _0x251a43={'id':_0x4e5c82['id'],'available':_0x4e5c82[_0x8c36('0x4f')],'loggedIn':_0x4e5c82[_0x8c36('0x50')],'name':_0x4e5c82['name'],'paused':_0x4e5c82[_0x8c36('0x54')],'waiting':_0x4e5c82['waiting']};_0x1bfe8c[_0x8c36('0x20')](_0x251a43);}}_0xff22f0({'count':_0x1bfe8c[_0x8c36('0x18')],'rows':_0x1bfe8c});});},'OpenchannelQueues':function(){return new Promise(function(_0x5a820a){var _0x27b88d=[];for(var _0x1c3934 in _0x25a83e[_0x8c36('0x55')]){if(_0x25a83e[_0x8c36('0x55')][_0x8c36('0x49')](_0x1c3934)){var _0x3465f8=_0x25a83e[_0x8c36('0x55')][_0x1c3934];var _0x3471d0={'id':_0x3465f8['id'],'available':_0x3465f8['available'],'loggedIn':_0x3465f8[_0x8c36('0x50')],'name':_0x3465f8[_0x8c36('0x51')],'paused':_0x3465f8[_0x8c36('0x54')],'waiting':_0x3465f8['waiting']};_0x27b88d[_0x8c36('0x20')](_0x3471d0);}}_0x5a820a({'count':_0x27b88d[_0x8c36('0x18')],'rows':_0x27b88d});});},'SmsQueues':function(){return new Promise(function(_0x1554bc){var _0x287d7f=[];for(var _0x12f486 in _0x25a83e['smsQueues']){if(_0x25a83e[_0x8c36('0x56')][_0x8c36('0x49')](_0x12f486)){var _0x7f1a0f=_0x25a83e['smsQueues'][_0x12f486];var _0x29581d={'id':_0x7f1a0f['id'],'available':_0x7f1a0f[_0x8c36('0x4f')],'loggedIn':_0x7f1a0f[_0x8c36('0x50')],'name':_0x7f1a0f[_0x8c36('0x51')],'paused':_0x7f1a0f[_0x8c36('0x54')],'waiting':_0x7f1a0f['waiting']};_0x287d7f[_0x8c36('0x20')](_0x29581d);}}_0x1554bc({'count':_0x287d7f[_0x8c36('0x18')],'rows':_0x287d7f});});},'FaxQueues':function(){return new Promise(function(_0x3378cc){var _0x4ac7f2=[];for(var _0x2599fc in _0x25a83e[_0x8c36('0x57')]){if(_0x25a83e[_0x8c36('0x57')][_0x8c36('0x49')](_0x2599fc)){var _0x2cd946=_0x25a83e[_0x8c36('0x57')][_0x2599fc];var _0x37bc24={'id':_0x2cd946['id'],'available':_0x2cd946['available'],'loggedIn':_0x2cd946['loggedIn'],'name':_0x2cd946['name'],'paused':_0x2cd946[_0x8c36('0x54')],'waiting':_0x2cd946[_0x8c36('0x52')]};_0x4ac7f2[_0x8c36('0x20')](_0x37bc24);}}_0x3378cc({'count':_0x4ac7f2[_0x8c36('0x18')],'rows':_0x4ac7f2});});},'WhatsappQueues':function(){return new Promise(function(_0x3a7a7f){var _0x3a08ed=[];for(var _0x10f392 in _0x25a83e[_0x8c36('0x58')]){if(_0x25a83e[_0x8c36('0x58')][_0x8c36('0x49')](_0x10f392)){var _0x108f6c=_0x25a83e[_0x8c36('0x58')][_0x10f392];var _0x124d9e={'id':_0x108f6c['id'],'available':_0x108f6c[_0x8c36('0x4f')],'loggedIn':_0x108f6c[_0x8c36('0x50')],'name':_0x108f6c[_0x8c36('0x51')],'paused':_0x108f6c[_0x8c36('0x54')],'waiting':_0x108f6c[_0x8c36('0x52')]};_0x3a08ed['push'](_0x124d9e);}}_0x3a7a7f({'count':_0x3a08ed[_0x8c36('0x18')],'rows':_0x3a08ed});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4db694){var _0x4b141c=_[_0x8c36('0x4c')](_0x25a83e['chatQueuesWaitingInteractions']);_0x4db694({'count':_0x4b141c[_0x8c36('0x18')],'rows':_0x4b141c});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x28fe7f){var _0x100187=_[_0x8c36('0x4c')](_0x25a83e[_0x8c36('0x59')]);_0x28fe7f({'count':_0x100187[_0x8c36('0x18')],'rows':_0x100187});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xf6760b){var _0x5e13de=_['values'](_0x25a83e[_0x8c36('0x5a')]);_0xf6760b({'count':_0x5e13de[_0x8c36('0x18')],'rows':_0x5e13de});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x5a2043){var _0x10b687=_[_0x8c36('0x4c')](_0x25a83e[_0x8c36('0x5b')]);_0x5a2043({'count':_0x10b687[_0x8c36('0x18')],'rows':_0x10b687});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x49c9af){var _0x35b2b4=_[_0x8c36('0x4c')](_0x25a83e[_0x8c36('0x5c')]);_0x49c9af({'count':_0x35b2b4[_0x8c36('0x18')],'rows':_0x35b2b4});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x429065){var _0x431a8e=_['values'](_0x25a83e[_0x8c36('0x5d')]);_0x429065({'count':_0x431a8e[_0x8c36('0x18')],'rows':_0x431a8e});});}};var _0x1fffd9=jayson[_0x8c36('0x5e')](_0x31d8bf)[_0x8c36('0x5f')]();_0x1fffd9['on'](_0x8c36('0x36'),function(_0x257c2a){logger[_0x8c36('0x36')](JSON[_0x8c36('0x39')](_0x257c2a));return _0x5dfcd5(_0x257c2a);});_0x1fffd9[_0x8c36('0x11')](0x232c,'127.0.0.1',function(){console['log'](_0x8c36('0x60'),0x232c);return _0x220f18('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x6953=['body','%s:%s:%s','./interval','condition','intervals','./applications/','priority','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify','emit','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','./applications/utils','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','mail','push','slice','dialogflow','split','dialogflowv2','tag','TagId','tvox','account','notificationTemplate','ChatWebsiteId','ContactId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6953,0x91));var _0x3695=function(_0x23289e,_0x219583){_0x23289e=_0x23289e-0x0;var _0x86a4eb=_0x6953[_0x23289e];return _0x86a4eb;};'use strict';var _=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var utils=require(_0x3695('0x2'));var logger=require('../../../config/logger')(_0x3695('0x3'));var rpc={'openchannelQueueReport':require(_0x3695('0x4')),'mailQueueReport':require(_0x3695('0x5')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x3695('0x6')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x3695('0x7'))};var RuleEngine=require(_0x3695('0x8'));function getId(_0x912099,_0x1a4e75,_0x301e46){return util['format'](_0x3695('0x9'),_0x912099,_0x1a4e75||0x0,_0x301e46||0x0);}function getIntervals(_0x4a1ece,_0x1fcd43){var _0x4b8f82=[];if(!_['isNil'](_0x1fcd43[_0x3695('0xa')])&&!_['isNil'](_0x4a1ece[_0x1fcd43[_0x3695('0xa')]])&&!_[_0x3695('0xb')](_0x4a1ece[_0x1fcd43[_0x3695('0xa')]][_0x3695('0xc')])){_0x4b8f82=_[_0x3695('0xd')](_0x4a1ece[_0x1fcd43[_0x3695('0xa')]]['Intervals'],_0x3695('0xe'));}else if(!_[_0x3695('0xb')](_0x1fcd43[_0x3695('0xe')])){_0x4b8f82=[_0x1fcd43[_0x3695('0xe')]];}return _0x4b8f82;}exports[_0x3695('0xf')]=function(_0x27e243){_0x27e243[_0x3695('0x10')]={};return new BPromise(function(_0x4df429,_0x26dfc9){var _0xc5dc5={'Start':function(_0x1ffebd){var _0x4ca317=this;return new Promise(function(_0x3aa59d,_0x231c7d){if(_0x1ffebd){try{var _0x2cdd3=[];var _0x3cb320=getId(_0x1ffebd[_0x3695('0x11')],_0x1ffebd[_0x3695('0x12')]?_0x1ffebd[_0x3695('0x12')]['id']:0x0,_0x1ffebd['interaction']?_0x1ffebd[_0x3695('0x13')]['id']:0x0);if(_0x1ffebd['applications']&&_[_0x3695('0x14')](_0x1ffebd[_0x3695('0x15')])&&_0x1ffebd[_0x3695('0x15')][_0x3695('0x16')]){for(var _0xc91d6e=0x0;_0xc91d6e<_0x1ffebd['applications'][_0x3695('0x16')];_0xc91d6e+=0x1){var _0x2d7936=_0x1ffebd[_0x3695('0x15')][_0xc91d6e];if(fs[_0x3695('0x17')](path[_0x3695('0x18')](__dirname,_0x3695('0x15'),_0x2d7936[_0x3695('0x19')]+_0x3695('0x1a')))){var _0x1f267a=[];switch(_0x2d7936[_0x3695('0x19')][_0x3695('0x1b')]()){case _0x3695('0x1c'):var _0x459f33=_0x2d7936[_0x3695('0x1d')]['split'](',');if(_0x1ffebd[_0x3695('0x11')]===_0x3695('0x1e')){_0x1f267a['push'](_0x459f33[0x0]);_0x1f267a['push'](_0x459f33[0x1]);_0x1f267a[_0x3695('0x1f')](_0x459f33[_0x3695('0x20')](0x2,_0x459f33[_0x3695('0x16')])[_0x3695('0x18')](','));}else{_0x1f267a['push'](_0x459f33[0x0]);_0x1f267a[_0x3695('0x1f')](_0x459f33['slice'](0x1,_0x459f33[_0x3695('0x16')])['join'](','));}break;case _0x3695('0x21'):var _0x5adea3=_0x2d7936[_0x3695('0x1d')][_0x3695('0x22')](',');_0x1f267a[_0x3695('0x1f')](_0x5adea3[0x0]);_0x1f267a[_0x3695('0x1f')](_0x5adea3[0x1]);_0x1f267a[_0x3695('0x1f')](_0x5adea3[_0x3695('0x20')](0x2,_0x5adea3['length'])[_0x3695('0x18')](','));break;case _0x3695('0x23'):var _0x5f193c=_0x2d7936[_0x3695('0x1d')]['split'](',');_0x1f267a[_0x3695('0x1f')](_0x5f193c[0x0]);_0x1f267a[_0x3695('0x1f')](_0x5f193c[0x1]);_0x1f267a[_0x3695('0x1f')](_0x5f193c[0x2]);_0x1f267a[_0x3695('0x1f')](_0x5f193c[0x3]);_0x1f267a[_0x3695('0x1f')](_0x5f193c[_0x3695('0x20')](0x4,_0x5f193c[_0x3695('0x16')])[_0x3695('0x18')](','));break;case'amazonlex':var _0x35c67a=_0x2d7936[_0x3695('0x1d')][_0x3695('0x22')](',');_0x1f267a['push'](_0x35c67a[0x0]);_0x1f267a['push'](_0x35c67a[0x1]);_0x1f267a[_0x3695('0x1f')](_0x35c67a[0x2]);_0x1f267a['push'](_0x35c67a[0x3]);_0x1f267a[_0x3695('0x1f')](_0x35c67a[_0x3695('0x20')](0x4,_0x35c67a['length'])[_0x3695('0x18')](','));break;case'message':_0x1f267a[_0x3695('0x1f')](_0x2d7936[_0x3695('0x1d')]);break;case _0x3695('0x24'):_0x1f267a[_0x3695('0x1f')](_0x2d7936[_0x3695('0x25')]);_0x1f267a[_0x3695('0x1f')](_0x2d7936['appdata']);break;case _0x3695('0x26'):var _0x33043e=utils['getMustacheRender'](_0x1ffebd[_0x3695('0x27')][_0x3695('0x28')],_0x1ffebd);var _0x542d33=_0x2d7936['appdata']['split'](',');_0x1f267a['push'](_0x542d33[0x0]);_0x1f267a[_0x3695('0x1f')](_0x542d33[0x1]);_0x1f267a[_0x3695('0x1f')](_0x542d33[0x2]);_0x1f267a['push'](_0x542d33[0x3]);_0x1f267a[_0x3695('0x1f')](_0x542d33[0x4]);_0x1f267a[_0x3695('0x1f')](_0x542d33[0x5]);_0x1f267a[_0x3695('0x1f')](_0x542d33[0x6]);_0x1f267a[_0x3695('0x1f')](_0x542d33[0x7]);_0x1f267a['push'](_0x542d33[0x8]);_0x1f267a['push'](_0x542d33[0x9]);_0x1f267a[_0x3695('0x1f')](_0x542d33[0xa]);_0x1f267a[_0x3695('0x1f')](_0x1ffebd['interaction']['id']);_0x1f267a[_0x3695('0x1f')](_0x1ffebd[_0x3695('0x12')]['id']);_0x1f267a[_0x3695('0x1f')](_0x2d7936[_0x3695('0x29')]);_0x1f267a[_0x3695('0x1f')](_0x1ffebd[_0x3695('0x13')][_0x3695('0x2a')]);_0x1f267a[_0x3695('0x1f')](_0x1ffebd[_0x3695('0x2b')][_0x3695('0x2b')]);_0x1f267a[_0x3695('0x1f')](_0x33043e);break;default:_0x1f267a=_[_0x3695('0xb')](_0x2d7936[_0x3695('0x1d')])?[]:_0x2d7936[_0x3695('0x1d')][_0x3695('0x22')](',');}var _0x318551={'id':util['format'](_0x3695('0x2c'),_0x3cb320,_0x2d7936['id'],_0x2d7936[_0x3695('0x19')]),'condition':require(_0x3695('0x2d'))[_0x3695('0x2e')](_0x3cb320,getIntervals(_0x27e243[_0x3695('0x2f')],_0x2d7936),_0x27e243),'consequence':require(_0x3695('0x30')+_0x2d7936[_0x3695('0x19')])['consequence'](_0x3cb320,_0x1f267a,_0x27e243,_0x1ffebd),'p':_0x2d7936[_0x3695('0x31')]||0x0};logger[_0x3695('0x32')](_0x3695('0x33'),_0x318551['id'],'on\x20interval',getIntervals(_0x27e243[_0x3695('0x2f')],_0x2d7936)[_0x3695('0x18')](_0x3695('0x34')));_0x2cdd3[_0x3695('0x1f')](_0x318551);}else{logger[_0x3695('0x35')](_0x3695('0x36'),path[_0x3695('0x18')](__dirname,'applications',_0x2d7936[_0x3695('0x19')]+'.js'));}}_0x27e243['rules'][_0x3cb320]=new RuleEngine(_0x2cdd3);_0x27e243[_0x3695('0x10')][_0x3cb320]['execute'](_0x1ffebd,function(_0x148547){logger[_0x3695('0x32')](_0x3695('0x37'),JSON[_0x3695('0x38')](_0x148547['matchPath']));if(_0x27e243[_0x3695('0x10')][_0x3cb320]){_0x27e243[_0x3695('0x10')][_0x3cb320][_0x3695('0x39')]('complete');}});return _0x3aa59d({'code':0xc8,'message':_0x1ffebd});}else{logger[_0x3695('0x32')](_0x3695('0x3a'));return _0x3aa59d({'code':0xc8,'message':_0x1ffebd});}}catch(_0x172855){logger[_0x3695('0x35')](_0x172855[_0x3695('0x3b')]);return _0x231c7d(_0x4ca317[_0x3695('0x35')](0x1f4,_0x172855));}}return _0x231c7d(_0x3695('0x3c'));});},'AcceptMessage':function(_0x3e9533){var _0x3dd06a=this;return new Promise(function(_0x5d5d70,_0x57bf10){if(_0x3e9533[_0x3695('0x3d')]&&_0x3e9533[_0x3695('0x3d')]['id']){if(_0x27e243[_0x3695('0x3e')][_0x3e9533['agent']['id']]){_0x27e243[_0x3695('0x3e')][_0x3e9533[_0x3695('0x3d')]['id']][_0x3695('0x3f')]=![];_0x27e243['agents'][_0x3e9533[_0x3695('0x3d')]['id']][_0x3695('0x40')]=undefined;}}if(_0x3e9533[_0x3695('0x12')]&&_0x3e9533[_0x3695('0x12')]['id']){try{var _0x325b36=getId(_0x3e9533['channel'],_0x3e9533[_0x3695('0x12')]?_0x3e9533[_0x3695('0x12')]['id']:0x0,_0x3e9533[_0x3695('0x13')]?_0x3e9533[_0x3695('0x13')]['id']:0x0);if(_0x27e243['rules'][_0x325b36]){_0x27e243[_0x3695('0x10')][_0x325b36]['emit']('end');if(rpc[_0x3e9533[_0x3695('0x11')]+_0x3695('0x41')]){rpc[_0x3e9533[_0x3695('0x11')]+_0x3695('0x41')][_0x3695('0x42')](_0x325b36,{'UserId':_0x3e9533['message']['UserId']})['catch'](function(){logger[_0x3695('0x35')]('error\x20update\x20queue\x20report');});}}return _0x5d5d70({'code':0xc8,'message':_0x3e9533});}catch(_0x4f5f1b){logger['error'](_0x4f5f1b['stack']);return _0x57bf10(_0x3dd06a[_0x3695('0x35')](0x1f4,_0x4f5f1b));}}logger[_0x3695('0x35')]('message\x20is\x20empty');return _0x57bf10(_0x3dd06a[_0x3695('0x35')](0x1f4,_0x3695('0x43')));});},'RejectMessage':function(_0x567447){var _0x4a0a78=this;return new Promise(function(_0x419ed6,_0x2cf76d){if(_0x567447[_0x3695('0x3d')]&&_0x567447['agent']['id']){try{if(_0x27e243[_0x3695('0x3e')][_0x567447[_0x3695('0x3d')]['id']]){_0x27e243[_0x3695('0x3e')][_0x567447[_0x3695('0x3d')]['id']][_0x3695('0x3f')]=![];_0x27e243[_0x3695('0x3e')][_0x567447[_0x3695('0x3d')]['id']][_0x3695('0x40')]=undefined;}return _0x419ed6({'code':0xc8,'message':_0x567447});}catch(_0x2c695c){logger[_0x3695('0x35')](_0x2c695c[_0x3695('0x3b')]);return _0x2cf76d(_0x4a0a78[_0x3695('0x35')](0x1f4,_0x2c695c));}}logger[_0x3695('0x35')](_0x3695('0x43'));return _0x2cf76d(_0x4a0a78[_0x3695('0x35')](0x1f4,_0x3695('0x43')));});},'AbandonInteraction':function(_0x441997){var _0x38cfec=this;return new Promise(function(_0x22e4a9,_0x35ffae){if(_0x441997[_0x3695('0x11')]&&_0x441997[_0x3695('0x13')]&&_0x441997[_0x3695('0x13')]['id']){try{var _0x50f963=getId(_0x441997['channel'],_0x441997[_0x3695('0x12')]?_0x441997[_0x3695('0x12')]['id']:0x0,_0x441997['interaction']?_0x441997[_0x3695('0x13')]['id']:0x0);if(_0x27e243[_0x3695('0x10')][_0x50f963]){_0x27e243[_0x3695('0x10')][_0x50f963][_0x3695('0x39')](_0x3695('0x44'));}return _0x22e4a9({'code':0xc8,'message':_0x441997});}catch(_0x35a5a5){logger[_0x3695('0x35')](_0x35a5a5[_0x3695('0x3b')]);return _0x35ffae(_0x38cfec[_0x3695('0x35')](0x1f4,_0x35a5a5));}}logger[_0x3695('0x35')]('message\x20is\x20empty');return _0x35ffae(_0x38cfec[_0x3695('0x35')](0x1f4,_0x3695('0x43')));});},'AgentCapacity':function(_0x1e101f){var _0x37ae94=this;return new Promise(function(_0x380ddc,_0x59f506){if(_0x27e243[_0x3695('0x3e')][_0x3695('0x45')](_0x1e101f['id'])){for(var _0xf18f60 in _0x1e101f['capacity']){if(_0x1e101f[_0x3695('0x46')][_0x3695('0x45')](_0xf18f60)){if(_0x27e243['agents'][_0x1e101f['id']]['hasOwnProperty'](_0xf18f60+_0x3695('0x47'))){_0x27e243['agents'][_0x1e101f['id']][_0xf18f60+'CurrentCapacity']=parseInt(_0x1e101f[_0x3695('0x46')][_0xf18f60],0xa);}}}_0x27e243[_0x3695('0x3e')][_0x1e101f['id']][_0x3695('0x48')]();return _0x380ddc({'code':0xc8,'message':_0x27e243[_0x3695('0x3e')][_0x1e101f['id']]});}else{return _0x59f506(_0x37ae94[_0x3695('0x35')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x3250f1){return new Promise(function(_0x2f690a){var _0x2e9762=_['values'](_0x27e243[_0x3695('0x3e')]);if(_0x3250f1&&_0x3250f1['id']){var _0x193b35=_[_0x3695('0x49')](_0x2e9762,function(_0x43b42a){return _0x43b42a['id']===_0x3250f1['id'];});_0x2f690a(_0x193b35);}else{_0x2f690a({'count':_0x2e9762[_0x3695('0x16')],'rows':_0x2e9762});}});},'ChatQueues':function(){return new Promise(function(_0x45fc8e){var _0x558e82=[];for(var _0x1c6516 in _0x27e243[_0x3695('0x4a')]){if(_0x27e243[_0x3695('0x4a')][_0x3695('0x45')](_0x1c6516)){var _0x395547=_0x27e243['chatQueues'][_0x1c6516];var _0x35fde9={'id':_0x395547['id'],'available':_0x395547[_0x3695('0x4b')],'loggedIn':_0x395547[_0x3695('0x4c')],'name':_0x395547[_0x3695('0x4d')],'paused':_0x395547[_0x3695('0x4e')],'waiting':_0x395547[_0x3695('0x4f')]};_0x558e82['push'](_0x35fde9);}}_0x45fc8e({'count':_0x558e82[_0x3695('0x16')],'rows':_0x558e82});});},'MailQueues':function(){return new Promise(function(_0x46099d){var _0x5c1fb1=[];for(var _0x4e7d7a in _0x27e243[_0x3695('0x50')]){if(_0x27e243[_0x3695('0x50')][_0x3695('0x45')](_0x4e7d7a)){var _0x48be60=_0x27e243[_0x3695('0x50')][_0x4e7d7a];var _0x40e542={'id':_0x48be60['id'],'available':_0x48be60[_0x3695('0x4b')],'loggedIn':_0x48be60[_0x3695('0x4c')],'name':_0x48be60[_0x3695('0x4d')],'paused':_0x48be60['paused'],'waiting':_0x48be60[_0x3695('0x4f')]};_0x5c1fb1['push'](_0x40e542);}}_0x46099d({'count':_0x5c1fb1['length'],'rows':_0x5c1fb1});});},'OpenchannelQueues':function(){return new Promise(function(_0x47def1){var _0x2f994f=[];for(var _0x278fbd in _0x27e243[_0x3695('0x51')]){if(_0x27e243[_0x3695('0x51')][_0x3695('0x45')](_0x278fbd)){var _0x36777e=_0x27e243[_0x3695('0x51')][_0x278fbd];var _0x3b0794={'id':_0x36777e['id'],'available':_0x36777e[_0x3695('0x4b')],'loggedIn':_0x36777e[_0x3695('0x4c')],'name':_0x36777e[_0x3695('0x4d')],'paused':_0x36777e[_0x3695('0x4e')],'waiting':_0x36777e[_0x3695('0x4f')]};_0x2f994f[_0x3695('0x1f')](_0x3b0794);}}_0x47def1({'count':_0x2f994f[_0x3695('0x16')],'rows':_0x2f994f});});},'SmsQueues':function(){return new Promise(function(_0x3c64f7){var _0x500234=[];for(var _0x10bb6d in _0x27e243[_0x3695('0x52')]){if(_0x27e243[_0x3695('0x52')][_0x3695('0x45')](_0x10bb6d)){var _0x2bfe00=_0x27e243[_0x3695('0x52')][_0x10bb6d];var _0x54f1f5={'id':_0x2bfe00['id'],'available':_0x2bfe00[_0x3695('0x4b')],'loggedIn':_0x2bfe00[_0x3695('0x4c')],'name':_0x2bfe00['name'],'paused':_0x2bfe00['paused'],'waiting':_0x2bfe00[_0x3695('0x4f')]};_0x500234['push'](_0x54f1f5);}}_0x3c64f7({'count':_0x500234[_0x3695('0x16')],'rows':_0x500234});});},'FaxQueues':function(){return new Promise(function(_0x4489c6){var _0x194bf5=[];for(var _0x4348a8 in _0x27e243[_0x3695('0x53')]){if(_0x27e243['faxQueues'][_0x3695('0x45')](_0x4348a8)){var _0x60d6ed=_0x27e243[_0x3695('0x53')][_0x4348a8];var _0x586c92={'id':_0x60d6ed['id'],'available':_0x60d6ed['available'],'loggedIn':_0x60d6ed['loggedIn'],'name':_0x60d6ed[_0x3695('0x4d')],'paused':_0x60d6ed[_0x3695('0x4e')],'waiting':_0x60d6ed['waiting']};_0x194bf5[_0x3695('0x1f')](_0x586c92);}}_0x4489c6({'count':_0x194bf5[_0x3695('0x16')],'rows':_0x194bf5});});},'WhatsappQueues':function(){return new Promise(function(_0x32724d){var _0x27852b=[];for(var _0x167830 in _0x27e243[_0x3695('0x54')]){if(_0x27e243[_0x3695('0x54')][_0x3695('0x45')](_0x167830)){var _0x50b827=_0x27e243[_0x3695('0x54')][_0x167830];var _0x283ea7={'id':_0x50b827['id'],'available':_0x50b827[_0x3695('0x4b')],'loggedIn':_0x50b827[_0x3695('0x4c')],'name':_0x50b827[_0x3695('0x4d')],'paused':_0x50b827[_0x3695('0x4e')],'waiting':_0x50b827[_0x3695('0x4f')]};_0x27852b[_0x3695('0x1f')](_0x283ea7);}}_0x32724d({'count':_0x27852b['length'],'rows':_0x27852b});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x327143){var _0x4111de=_[_0x3695('0x55')](_0x27e243[_0x3695('0x56')]);_0x327143({'count':_0x4111de[_0x3695('0x16')],'rows':_0x4111de});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x21f7b4){var _0x3fa4b0=_[_0x3695('0x55')](_0x27e243[_0x3695('0x57')]);_0x21f7b4({'count':_0x3fa4b0[_0x3695('0x16')],'rows':_0x3fa4b0});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xd78b9b){var _0x92fcea=_[_0x3695('0x55')](_0x27e243['openchannelQueuesWaitingInteractions']);_0xd78b9b({'count':_0x92fcea['length'],'rows':_0x92fcea});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x45657f){var _0x247938=_[_0x3695('0x55')](_0x27e243['smsQueuesWaitingInteractions']);_0x45657f({'count':_0x247938[_0x3695('0x16')],'rows':_0x247938});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x11ae95){var _0x25a776=_['values'](_0x27e243[_0x3695('0x58')]);_0x11ae95({'count':_0x25a776['length'],'rows':_0x25a776});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x10dda9){var _0x224ce5=_[_0x3695('0x55')](_0x27e243[_0x3695('0x59')]);_0x10dda9({'count':_0x224ce5[_0x3695('0x16')],'rows':_0x224ce5});});}};var _0x5bd8e0=jayson[_0x3695('0x5a')](_0xc5dc5)[_0x3695('0x5b')]();_0x5bd8e0['on'](_0x3695('0x35'),function(_0x2a7cb3){logger[_0x3695('0x35')](JSON[_0x3695('0x38')](_0x2a7cb3));return _0x26dfc9(_0x2a7cb3);});_0x5bd8e0[_0x3695('0xf')](0x232c,_0x3695('0x5c'),function(){console['log'](_0x3695('0x5d'),0x232c);return _0x4df429('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index eab4294..12cd744 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 _0x014c=['stop','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','join','\x20|\x20','when','stack','bluebird','jayson/promise','../../../config/logger','routing','http','request','then','error','result','catch','rules'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x014c,0x120));var _0xc014=function(_0x4ea955,_0x1eda76){_0x4ea955=_0x4ea955-0x0;var _0x558561=_0x014c[_0x4ea955];return _0x558561;};'use strict';var util=require('util');var BPromise=require(_0xc014('0x0'));var jayson=require(_0xc014('0x1'));var _=require('lodash');var logger=require(_0xc014('0x2'))(_0xc014('0x3'));var client=jayson['client'][_0xc014('0x4')]({'port':0x232a});function request(_0x434b64,_0x20f75e){return new BPromise(function(_0x23fecb,_0x4cc177){return client[_0xc014('0x5')](_0x434b64,_0x20f75e)[_0xc014('0x6')](function(_0x4c897b){if(_0x4c897b['error']){return _0x4cc177(_0x4c897b[_0xc014('0x7')]['message']);}else{return _0x23fecb(_0x4c897b[_0xc014('0x8')]);}})[_0xc014('0x9')](function(_0x59ec3b){return _0x4cc177(_0x59ec3b);});});}exports['condition']=function(_0xce6616,_0x149a72,_0x2aef2d){return function(_0x833f37){if(_0x2aef2d[_0xc014('0xa')]&&!_0x2aef2d[_0xc014('0xa')][_0xce6616]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0xce6616);return _0x833f37[_0xc014('0xb')]();}var _0x254e75=[];for(var _0x28ee54=0x0;_0x28ee54<_0x149a72['length'];_0x28ee54+=0x1){_0x254e75['push'](request(_0xc014('0xc'),{'command':util[_0xc014('0xd')](_0xc014('0xe'),_0x149a72[_0x28ee54])})['then'](function(_0x5c2d0a){return _0x5c2d0a&&_0x5c2d0a['message']&&_0x5c2d0a['message'][_0xc014('0xf')](_0xc014('0x10'))>=0x0?!![]:![];})[_0xc014('0x9')](function(_0x48f3b5){logger['error'](_0xc014('0x11'),_0xce6616,_0x149a72[_0x28ee54]);}));}BPromise[_0xc014('0x12')](_0x254e75)['then'](function(_0x48356e){var _0x3ddc70=_['some'](_0x48356e);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0xce6616,_0x149a72[_0xc014('0x13')](_0xc014('0x14')),_0x3ddc70);_0x833f37[_0xc014('0x15')](_0x3ddc70);})[_0xc014('0x9')](function(_0x23ffcf){console['log'](_0x23ffcf);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0xce6616,_0x149a72['join'](_0xc014('0x14')),_0x23ffcf[_0xc014('0x16')]);_0x833f37['stop']();});};}; \ No newline at end of file +var _0x43c4=['error','catch','rules','length','push','Command','format','message','true','[%s][INTERVAL]\x20%s','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','request','then'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x43c4,0x163));var _0x443c=function(_0x3d536,_0x53ae9e){_0x3d536=_0x3d536-0x0;var _0x4bc83a=_0x43c4[_0x3d536];return _0x4bc83a;};'use strict';var util=require(_0x443c('0x0'));var BPromise=require(_0x443c('0x1'));var jayson=require(_0x443c('0x2'));var _=require(_0x443c('0x3'));var logger=require(_0x443c('0x4'))(_0x443c('0x5'));var client=jayson[_0x443c('0x6')]['http']({'port':0x232a});function request(_0x11856e,_0x29d40c){return new BPromise(function(_0x59468f,_0x29b1d2){return client[_0x443c('0x7')](_0x11856e,_0x29d40c)[_0x443c('0x8')](function(_0xfe3cff){if(_0xfe3cff[_0x443c('0x9')]){return _0x29b1d2(_0xfe3cff[_0x443c('0x9')]['message']);}else{return _0x59468f(_0xfe3cff['result']);}})[_0x443c('0xa')](function(_0x1b6459){return _0x29b1d2(_0x1b6459);});});}exports['condition']=function(_0x20a70f,_0x26f1ca,_0x470a5f){return function(_0x1a20be){if(_0x470a5f['rules']&&!_0x470a5f[_0x443c('0xb')][_0x20a70f]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x20a70f);return _0x1a20be['stop']();}var _0x34533e=[];for(var _0x365cc0=0x0;_0x365cc0<_0x26f1ca[_0x443c('0xc')];_0x365cc0+=0x1){_0x34533e[_0x443c('0xd')](request(_0x443c('0xe'),{'command':util[_0x443c('0xf')]('iftime\x20%s',_0x26f1ca[_0x365cc0])})['then'](function(_0x4f90fa){return _0x4f90fa&&_0x4f90fa[_0x443c('0x10')]&&_0x4f90fa[_0x443c('0x10')]['indexOf'](_0x443c('0x11'))>=0x0?!![]:![];})[_0x443c('0xa')](function(_0x4276b3){logger[_0x443c('0x9')](_0x443c('0x12'),_0x20a70f,_0x26f1ca[_0x365cc0]);}));}BPromise['all'](_0x34533e)[_0x443c('0x8')](function(_0x141a45){var _0x5e4d54=_[_0x443c('0x13')](_0x141a45);logger[_0x443c('0x14')](_0x443c('0x15'),_0x20a70f,_0x26f1ca[_0x443c('0x16')](_0x443c('0x17')),_0x5e4d54);_0x1a20be[_0x443c('0x18')](_0x5e4d54);})['catch'](function(_0x15c6a6){console[_0x443c('0x19')](_0x15c6a6);logger[_0x443c('0x9')](_0x443c('0x15'),_0x20a70f,_0x26f1ca[_0x443c('0x16')](_0x443c('0x17')),_0x15c6a6[_0x443c('0x1a')]);_0x1a20be[_0x443c('0x1b')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 059d3be..b7f19a2 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 _0xeb74=['timeout','reason','holdtime','ringtime','talktime','push','error','includes','debug','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','agentcomplete','agentcompleteAt','diffTime','agentconnectAt','complete','[%s][agents][agentcomplete]','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','calleridnum','calleridname','ATTENDED','transfertargetuniqueid','clone','[%s][agents][attendedtransfer]','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','lodash','util','./utils','info','format','uniqueid','channel','queue','membername','interface','connectedlinenum','getVoiceQueueByName','type','agentacw','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb74,0xe3));var _0x4eb7=function(_0x339469,_0xb63953){_0x339469=_0x339469-0x0;var _0xb8d76f=_0xeb74[_0x339469];return _0xb8d76f;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var utils=require(_0x4eb7('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x9b674c,_0x2b5a60){utils[_0x4eb7('0x3')](util[_0x4eb7('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x9b674c[_0x4eb7('0x5')],_0x9b674c[_0x4eb7('0x6')],_0x9b674c[_0x4eb7('0x7')],_0x9b674c[_0x4eb7('0x8')],_0x9b674c[_0x4eb7('0x9')],_0x9b674c['calleridnum'],_0x9b674c[_0x4eb7('0xa')],_0x9b674c['lastevent']));if(_0x9b674c[_0x4eb7('0x7')]){utils[_0x4eb7('0xb')](_0x9b674c['queue'])['then'](function(_0xe07330){if(_0xe07330){_0x9b674c[_0x4eb7('0xc')]=_0xe07330['type'];_0x9b674c[_0x4eb7('0xd')]=_0x9b674c['agentcomplete']?_0xe07330[_0x4eb7('0xe')]:![];_0x9b674c[_0x4eb7('0xf')]=_0x9b674c[_0x4eb7('0xd')]?_0xe07330['acwTimeout']:0x0;}utils[_0x4eb7('0x10')](_0x4eb7('0x11'),_0x9b674c);});}else{utils[_0x4eb7('0x10')](_0x4eb7('0x11'),_0x9b674c);}if(_0x2b5a60){delete transfers[_0x9b674c[_0x4eb7('0x5')]];}else{delete agents[_0x9b674c[_0x4eb7('0x12')]];}}exports[_0x4eb7('0x13')]=function(_0x4c27a4){try{utils['debug'](util['format'](_0x4eb7('0x14'),_0x4c27a4['uniqueid']),_0x4c27a4);agents[_0x4c27a4[_0x4eb7('0x12')]]=_0x4c27a4;agents[_0x4c27a4[_0x4eb7('0x12')]][_0x4eb7('0x15')]=utils[_0x4eb7('0x16')]();agents[_0x4c27a4[_0x4eb7('0x12')]][_0x4eb7('0x17')]=_0x4eb7('0x18');agents[_0x4c27a4[_0x4eb7('0x12')]][_0x4eb7('0xa')]=null;agents[_0x4c27a4[_0x4eb7('0x12')]]['connectedlinename']=null;utils[_0x4eb7('0x3')](util[_0x4eb7('0x4')](_0x4eb7('0x19'),_0x4c27a4[_0x4eb7('0x5')],agents[_0x4c27a4[_0x4eb7('0x12')]][_0x4eb7('0x8')],_0x4c27a4[_0x4eb7('0x12')]));}catch(_0x16c024){utils['error'](util[_0x4eb7('0x4')](_0x4eb7('0x14'),_0x4c27a4[_0x4eb7('0x5')]),_0x16c024);}};exports[_0x4eb7('0x1a')]=function(_0x32f0f5){try{if(!_[_0x4eb7('0x1b')](agents[_0x32f0f5[_0x4eb7('0x12')]])){utils['debug'](util[_0x4eb7('0x4')](_0x4eb7('0x1c'),_0x32f0f5[_0x4eb7('0x5')]),_0x32f0f5);utils[_0x4eb7('0x3')](util[_0x4eb7('0x4')](_0x4eb7('0x1d'),_0x32f0f5[_0x4eb7('0x5')],agents[_0x32f0f5[_0x4eb7('0x12')]][_0x4eb7('0x8')],_0x32f0f5[_0x4eb7('0x12')]));agents[_0x32f0f5['destuniqueid']][_0x4eb7('0x1a')]=!![];agents[_0x32f0f5[_0x4eb7('0x12')]][_0x4eb7('0x1e')]=utils[_0x4eb7('0x16')]();agents[_0x32f0f5[_0x4eb7('0x12')]][_0x4eb7('0x17')]=_0x4eb7('0x1f');agents[_0x32f0f5[_0x4eb7('0x12')]][_0x4eb7('0x20')]=_0x4eb7('0x1f');agents[_0x32f0f5[_0x4eb7('0x12')]][_0x4eb7('0x21')]=_0x32f0f5[_0x4eb7('0x22')]?parseInt(_0x32f0f5[_0x4eb7('0x22')])/0x3e8:0x0;agents[_0x32f0f5[_0x4eb7('0x12')]][_0x4eb7('0x23')]=0x0;unanswered[_0x4eb7('0x24')](_0x32f0f5[_0x4eb7('0x12')]);}}catch(_0x33a2c1){utils[_0x4eb7('0x25')](util[_0x4eb7('0x4')](_0x4eb7('0x1c'),_0x32f0f5[_0x4eb7('0x5')]),_0x33a2c1);}};exports['queuecallerabandon']=function(_0x34515c){try{_['forIn'](agents,function(_0x446872,_0x13f71a){if(_0x446872[_0x4eb7('0x5')]==_0x34515c[_0x4eb7('0x5')]&&!_[_0x4eb7('0x26')](unanswered,_0x446872[_0x4eb7('0x12')])){utils[_0x4eb7('0x27')](util[_0x4eb7('0x4')](_0x4eb7('0x28'),_0x34515c['uniqueid']),_0x34515c);utils[_0x4eb7('0x3')](util['format'](_0x4eb7('0x29'),_0x34515c[_0x4eb7('0x5')],_0x446872['membername'],_0x446872['destuniqueid']));_0x446872[_0x4eb7('0x1a')]=!![];_0x446872[_0x4eb7('0x1e')]=utils[_0x4eb7('0x16')]();_0x446872[_0x4eb7('0x17')]='abandoned';_0x446872[_0x4eb7('0x20')]=_0x4eb7('0x2a');_0x446872[_0x4eb7('0x21')]=_0x34515c[_0x4eb7('0x21')];_0x446872[_0x4eb7('0x23')]=0x0;writeDB(_0x446872);}});}catch(_0x5ab58d){utils[_0x4eb7('0x25')](util[_0x4eb7('0x4')](_0x4eb7('0x28'),_0x34515c['uniqueid']),_0x5ab58d);}};exports[_0x4eb7('0x2b')]=function(_0xe1cc8f){try{if(agents[_0xe1cc8f[_0x4eb7('0x12')]]){utils['debug'](util[_0x4eb7('0x4')]('[%s][agents][agentconnect]',_0xe1cc8f[_0x4eb7('0x5')]),_0xe1cc8f);utils[_0x4eb7('0x3')](util[_0x4eb7('0x4')](_0x4eb7('0x2c'),_0xe1cc8f['uniqueid'],agents[_0xe1cc8f[_0x4eb7('0x12')]][_0x4eb7('0x8')],_0xe1cc8f[_0x4eb7('0x12')]));agents[_0xe1cc8f[_0x4eb7('0x12')]]['agentconnectAt']=utils['now']();agents[_0xe1cc8f['destuniqueid']][_0x4eb7('0xa')]=_0xe1cc8f[_0x4eb7('0xa')];agents[_0xe1cc8f[_0x4eb7('0x12')]][_0x4eb7('0x2d')]=_0xe1cc8f[_0x4eb7('0x2d')];agents[_0xe1cc8f[_0x4eb7('0x12')]][_0x4eb7('0x21')]=_0xe1cc8f[_0x4eb7('0x22')];agents[_0xe1cc8f[_0x4eb7('0x12')]][_0x4eb7('0x17')]='connect';_[_0x4eb7('0x2e')](agents,function(_0x38218f,_0xe04d76){if(_0x38218f[_0x4eb7('0x12')]!=_0xe1cc8f[_0x4eb7('0x12')]&&_0x38218f[_0x4eb7('0x5')]==_0xe1cc8f[_0x4eb7('0x5')]){_0x38218f[_0x4eb7('0x23')]=0x0;_0x38218f[_0x4eb7('0x21')]=_0xe1cc8f[_0x4eb7('0x22')];_0x38218f[_0x4eb7('0x1a')]=!![];_0x38218f[_0x4eb7('0x1e')]=utils[_0x4eb7('0x16')]();_0x38218f[_0x4eb7('0x17')]=_0x4eb7('0x2f');_0x38218f[_0x4eb7('0x20')]=_0x4eb7('0x2f');_0x38218f[_0x4eb7('0x30')]=_0xe1cc8f[_0x4eb7('0x12')];_0x38218f[_0x4eb7('0x31')]=_0xe1cc8f['membername'];writeDB(_0x38218f);}});}}catch(_0x2fd5c2){utils[_0x4eb7('0x25')](util[_0x4eb7('0x4')](_0x4eb7('0x32'),_0xe1cc8f[_0x4eb7('0x5')]),_0x2fd5c2);}};exports[_0x4eb7('0x33')]=function(_0x3cd9e5){try{if(!_[_0x4eb7('0x1b')](agents[_0x3cd9e5[_0x4eb7('0x12')]])){utils['debug'](util[_0x4eb7('0x4')]('[%s][agents][agentcomplete]',_0x3cd9e5[_0x4eb7('0x5')]),_0x3cd9e5);utils[_0x4eb7('0x3')](util[_0x4eb7('0x4')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3cd9e5[_0x4eb7('0x5')],agents[_0x3cd9e5[_0x4eb7('0x12')]][_0x4eb7('0x8')],_0x3cd9e5[_0x4eb7('0x12')]));agents[_0x3cd9e5['destuniqueid']][_0x4eb7('0x33')]=!![];agents[_0x3cd9e5['destuniqueid']][_0x4eb7('0x34')]=utils[_0x4eb7('0x16')]();agents[_0x3cd9e5[_0x4eb7('0x12')]][_0x4eb7('0x23')]=utils[_0x4eb7('0x35')](agents[_0x3cd9e5['destuniqueid']]['agentcompleteAt'],agents[_0x3cd9e5[_0x4eb7('0x12')]][_0x4eb7('0x36')]);agents[_0x3cd9e5[_0x4eb7('0x12')]][_0x4eb7('0x20')]=_0x3cd9e5[_0x4eb7('0x20')];agents[_0x3cd9e5['destuniqueid']][_0x4eb7('0x17')]=_0x4eb7('0x37');writeDB(agents[_0x3cd9e5['destuniqueid']]);}}catch(_0x22e09c){utils[_0x4eb7('0x25')](util['format'](_0x4eb7('0x38'),_0x3cd9e5[_0x4eb7('0x5')]),_0x22e09c);}};exports[_0x4eb7('0x39')]=function(_0x5774d5){try{if(!_[_0x4eb7('0x1b')](agents[_0x5774d5['transfereruniqueid']])){utils['debug'](util[_0x4eb7('0x4')](_0x4eb7('0x3a'),_0x5774d5[_0x4eb7('0x5')]),_0x5774d5);utils[_0x4eb7('0x3')](util[_0x4eb7('0x4')](_0x4eb7('0x3b'),_0x5774d5[_0x4eb7('0x5')],agents[_0x5774d5[_0x4eb7('0x3c')]][_0x4eb7('0x8')],agents[_0x5774d5[_0x4eb7('0x3c')]][_0x4eb7('0x5')]));agents[_0x5774d5[_0x4eb7('0x3c')]][_0x4eb7('0x3d')]=!![];agents[_0x5774d5[_0x4eb7('0x3c')]][_0x4eb7('0x3e')]=_0x4eb7('0x3f');agents[_0x5774d5[_0x4eb7('0x3c')]][_0x4eb7('0x40')]=_0x5774d5[_0x4eb7('0x41')];agents[_0x5774d5[_0x4eb7('0x3c')]]['transferuniqueid']=agents[_0x5774d5[_0x4eb7('0x3c')]]['uniqueid'];}}catch(_0x4db5f7){utils[_0x4eb7('0x25')](util[_0x4eb7('0x4')](_0x4eb7('0x3a'),_0x5774d5[_0x4eb7('0x5')]),_0x4db5f7);}};exports[_0x4eb7('0x42')]=function(_0x553736){try{utils['debug'](util[_0x4eb7('0x4')]('[%s][agents][attendedtransfer]',_0x553736[_0x4eb7('0x43')]),_0x553736);if(_0x553736[_0x4eb7('0x43')]==_0x553736[_0x4eb7('0x44')]){if(!_[_0x4eb7('0x1b')](agents[_0x553736['secondtransfereruniqueid']])){utils[_0x4eb7('0x3')](util[_0x4eb7('0x4')](_0x4eb7('0x45'),_0x553736[_0x4eb7('0x43')],agents[_0x553736['secondtransfereruniqueid']][_0x4eb7('0x8')]));agents[_0x553736[_0x4eb7('0x46')]]['transfer']=!![];agents[_0x553736[_0x4eb7('0x46')]][_0x4eb7('0x3e')]='ATTENDED';agents[_0x553736[_0x4eb7('0x46')]]['transferexten']=_0x553736[_0x4eb7('0x47')];agents[_0x553736['secondtransfereruniqueid']][_0x4eb7('0x48')]=_0x553736[_0x4eb7('0x43')];}if(_0x553736[_0x4eb7('0x49')]&&agents[_0x553736[_0x4eb7('0x49')]]){agents[_0x553736[_0x4eb7('0x49')]][_0x4eb7('0x4a')]=0x1;transfers[_0x553736['transfereeuniqueid']]=_['clone'](agents[_0x553736[_0x4eb7('0x49')]]);transfers[_0x553736[_0x4eb7('0x49')]][_0x4eb7('0x4b')]=agents[_0x553736[_0x4eb7('0x46')]]['calleridnum'];transfers[_0x553736[_0x4eb7('0x49')]][_0x4eb7('0x4c')]=agents[_0x553736['secondtransfereruniqueid']][_0x4eb7('0x4c')];transfers[_0x553736[_0x4eb7('0x49')]][_0x4eb7('0x15')]=utils[_0x4eb7('0x16')]();transfers[_0x553736[_0x4eb7('0x49')]][_0x4eb7('0x36')]=utils[_0x4eb7('0x16')]();transfers[_0x553736['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x553736[_0x4eb7('0x49')]]['agententerreason']=0x2;}}else if(_0x553736[_0x4eb7('0x46')]==_0x553736['secondtransfererlinkedid']){if(!_[_0x4eb7('0x1b')](agents[_0x553736['origtransfereruniqueid']])){utils['info'](util[_0x4eb7('0x4')](_0x4eb7('0x45'),_0x553736['origtransfereruniqueid'],agents[_0x553736[_0x4eb7('0x43')]]['membername']));agents[_0x553736[_0x4eb7('0x43')]][_0x4eb7('0x3d')]=!![];agents[_0x553736['origtransfereruniqueid']][_0x4eb7('0x3e')]=_0x4eb7('0x4d');agents[_0x553736['origtransfereruniqueid']]['transferexten']=_0x553736['secondtransfererexten'];agents[_0x553736['origtransfereruniqueid']][_0x4eb7('0x48')]=_0x553736['secondtransfereruniqueid'];}if(_0x553736[_0x4eb7('0x4e')]&&agents[_0x553736[_0x4eb7('0x4e')]]){agents[_0x553736['transfertargetuniqueid']][_0x4eb7('0x4a')]=0x1;transfers[_0x553736[_0x4eb7('0x4e')]]=_[_0x4eb7('0x4f')](agents[_0x553736[_0x4eb7('0x4e')]]);transfers[_0x553736[_0x4eb7('0x4e')]][_0x4eb7('0x4b')]=agents[_0x553736['origtransfereruniqueid']]['calleridnum'];transfers[_0x553736['transfertargetuniqueid']][_0x4eb7('0x4c')]=agents[_0x553736[_0x4eb7('0x43')]][_0x4eb7('0x4c')];transfers[_0x553736[_0x4eb7('0x4e')]][_0x4eb7('0x15')]=utils['now']();transfers[_0x553736['transfertargetuniqueid']][_0x4eb7('0x36')]=utils[_0x4eb7('0x16')]();transfers[_0x553736[_0x4eb7('0x4e')]][_0x4eb7('0x21')]=0x0;transfers[_0x553736[_0x4eb7('0x4e')]]['agententerreason']=0x2;}}}catch(_0x439861){utils[_0x4eb7('0x25')](util[_0x4eb7('0x4')](_0x4eb7('0x50'),_0x553736['origtransfereruniqueid']),_0x439861);}};exports['hangup']=function(_0x3bcbd1){try{utils[_0x4eb7('0x27')](util['format'](_0x4eb7('0x51'),_0x3bcbd1['uniqueid']),_0x3bcbd1);if(agents[_0x3bcbd1[_0x4eb7('0x5')]]&&agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x20')]===_0x4eb7('0x1f')){if(_0x3bcbd1['cause']==='21'){agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x20')]=_0x4eb7('0x52');agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x17')]=_0x4eb7('0x52');}utils[_0x4eb7('0x3')](util[_0x4eb7('0x4')](_0x4eb7('0x53'),_0x3bcbd1[_0x4eb7('0x5')],agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x8')],agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x20')],agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x17')]));writeDB(agents[_0x3bcbd1[_0x4eb7('0x5')]]);var _0x31e6d2=unanswered[_0x4eb7('0x54')](_0x3bcbd1['uniqueid']);if(_0x31e6d2>-0x1){unanswered['splice'](_0x31e6d2,0x1);}}if(transfers[_0x3bcbd1[_0x4eb7('0x5')]]){transfers[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x33')]=!![];transfers[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x34')]=utils[_0x4eb7('0x16')]();transfers[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x23')]=utils['diffTime'](transfers[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x34')],transfers[_0x3bcbd1[_0x4eb7('0x5')]]['agentconnectAt']);transfers[_0x3bcbd1['uniqueid']][_0x4eb7('0x20')]=_0x4eb7('0x55');transfers[_0x3bcbd1[_0x4eb7('0x5')]]['lastevent']='complete';utils[_0x4eb7('0x3')](util[_0x4eb7('0x4')](_0x4eb7('0x53'),_0x3bcbd1[_0x4eb7('0x5')],transfers[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x8')],transfers[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x20')],transfers[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x17')]));writeDB(transfers[_0x3bcbd1[_0x4eb7('0x5')]],!![]);}if(agents[_0x3bcbd1[_0x4eb7('0x5')]]&&agents[_0x3bcbd1['uniqueid']]['agentconnectAt']){agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x33')]=!![];agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x34')]=utils[_0x4eb7('0x16')]();agents[_0x3bcbd1[_0x4eb7('0x5')]]['talktime']=utils['diffTime'](agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x34')],agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x36')]);agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x20')]=agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x3d')]?_0x4eb7('0x3d'):_0x4eb7('0x55');agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x17')]=_0x4eb7('0x37');utils[_0x4eb7('0x3')](util['format'](_0x4eb7('0x53'),_0x3bcbd1[_0x4eb7('0x5')],agents[_0x3bcbd1[_0x4eb7('0x5')]][_0x4eb7('0x8')],agents[_0x3bcbd1['uniqueid']][_0x4eb7('0x20')],agents[_0x3bcbd1[_0x4eb7('0x5')]]['lastevent']));writeDB(agents[_0x3bcbd1[_0x4eb7('0x5')]]);}}catch(_0x2448a1){utils[_0x4eb7('0x25')](util['format'](_0x4eb7('0x51'),_0x3bcbd1[_0x4eb7('0x5')]),_0x2448a1);}}; \ No newline at end of file +var _0xa5fa=['[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','transfertype','secondtransfererexten','transferuniqueid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','acw','acwTimeout','CreateVoiceAgentReport','request','uniqueid','destuniqueid','[%s][agents][agentcalled]','called','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','timeout','holdtime','ringtime','talktime','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','reason','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','[%s][agents][blindtransfer]','attendedtransfer'];(function(_0x3865b1,_0x2e7692){var _0x14f78a=function(_0x4c2db8){while(--_0x4c2db8){_0x3865b1['push'](_0x3865b1['shift']());}};_0x14f78a(++_0x2e7692);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x46fc28,_0x4746fb){_0x46fc28=_0x46fc28-0x0;var _0x5888fe=_0xa5fa[_0x46fc28];return _0x5888fe;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var utils=require(_0xaa5f('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x24d383,_0x1b7e1d){utils['info'](util[_0xaa5f('0x2')](_0xaa5f('0x3'),_0x24d383['uniqueid'],_0x24d383[_0xaa5f('0x4')],_0x24d383[_0xaa5f('0x5')],_0x24d383[_0xaa5f('0x6')],_0x24d383[_0xaa5f('0x7')],_0x24d383[_0xaa5f('0x8')],_0x24d383[_0xaa5f('0x9')],_0x24d383[_0xaa5f('0xa')]));if(_0x24d383[_0xaa5f('0x5')]){utils[_0xaa5f('0xb')](_0x24d383[_0xaa5f('0x5')])[_0xaa5f('0xc')](function(_0x4e5257){if(_0x4e5257){_0x24d383[_0xaa5f('0xd')]=_0x4e5257[_0xaa5f('0xd')];_0x24d383['agentacw']=_0x24d383['agentcomplete']?_0x4e5257[_0xaa5f('0xe')]:![];_0x24d383['acwtime']=_0x24d383['agentacw']?_0x4e5257[_0xaa5f('0xf')]:0x0;}utils['request'](_0xaa5f('0x10'),_0x24d383);});}else{utils[_0xaa5f('0x11')](_0xaa5f('0x10'),_0x24d383);}if(_0x1b7e1d){delete transfers[_0x24d383[_0xaa5f('0x12')]];}else{delete agents[_0x24d383[_0xaa5f('0x13')]];}}exports['agentcalled']=function(_0xbd4e10){try{utils['debug'](util[_0xaa5f('0x2')](_0xaa5f('0x14'),_0xbd4e10[_0xaa5f('0x12')]),_0xbd4e10);agents[_0xbd4e10[_0xaa5f('0x13')]]=_0xbd4e10;agents[_0xbd4e10[_0xaa5f('0x13')]]['agentcalledAt']=utils['now']();agents[_0xbd4e10[_0xaa5f('0x13')]][_0xaa5f('0xa')]=_0xaa5f('0x15');agents[_0xbd4e10[_0xaa5f('0x13')]][_0xaa5f('0x9')]=null;agents[_0xbd4e10[_0xaa5f('0x13')]][_0xaa5f('0x16')]=null;utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x18'),_0xbd4e10[_0xaa5f('0x12')],agents[_0xbd4e10[_0xaa5f('0x13')]]['membername'],_0xbd4e10[_0xaa5f('0x13')]));}catch(_0x4c0a9d){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x14'),_0xbd4e10[_0xaa5f('0x12')]),_0x4c0a9d);}};exports[_0xaa5f('0x1a')]=function(_0x194691){try{if(!_[_0xaa5f('0x1b')](agents[_0x194691[_0xaa5f('0x13')]])){utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')](_0xaa5f('0x1d'),_0x194691['uniqueid']),_0x194691);utils[_0xaa5f('0x17')](util['format'](_0xaa5f('0x1e'),_0x194691[_0xaa5f('0x12')],agents[_0x194691['destuniqueid']][_0xaa5f('0x6')],_0x194691[_0xaa5f('0x13')]));agents[_0x194691['destuniqueid']][_0xaa5f('0x1a')]=!![];agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0x1f')]=utils[_0xaa5f('0x20')]();agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0xa')]=_0xaa5f('0x21');agents[_0x194691[_0xaa5f('0x13')]]['reason']=_0xaa5f('0x21');agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0x22')]=_0x194691['ringtime']?parseInt(_0x194691[_0xaa5f('0x23')])/0x3e8:0x0;agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0x24')]=0x0;unanswered['push'](_0x194691[_0xaa5f('0x13')]);}}catch(_0x479f29){utils['error'](util[_0xaa5f('0x2')]('[%s][agents][agentringnoanswer]',_0x194691[_0xaa5f('0x12')]),_0x479f29);}};exports['queuecallerabandon']=function(_0x4c5dc0){try{_['forIn'](agents,function(_0x26a90d,_0x4ddebd){if(_0x26a90d[_0xaa5f('0x12')]==_0x4c5dc0[_0xaa5f('0x12')]&&!_['includes'](unanswered,_0x26a90d['destuniqueid'])){utils[_0xaa5f('0x1c')](util['format'](_0xaa5f('0x25'),_0x4c5dc0[_0xaa5f('0x12')]),_0x4c5dc0);utils['info'](util[_0xaa5f('0x2')](_0xaa5f('0x26'),_0x4c5dc0[_0xaa5f('0x12')],_0x26a90d['membername'],_0x26a90d[_0xaa5f('0x13')]));_0x26a90d[_0xaa5f('0x1a')]=!![];_0x26a90d['agentringnoanswerAt']=utils['now']();_0x26a90d['lastevent']='abandoned';_0x26a90d[_0xaa5f('0x27')]=_0xaa5f('0x28');_0x26a90d[_0xaa5f('0x22')]=_0x4c5dc0[_0xaa5f('0x22')];_0x26a90d[_0xaa5f('0x24')]=0x0;writeDB(_0x26a90d);}});}catch(_0x3bcaf6){utils[_0xaa5f('0x19')](util['format'](_0xaa5f('0x25'),_0x4c5dc0[_0xaa5f('0x12')]),_0x3bcaf6);}};exports[_0xaa5f('0x29')]=function(_0x1f3268){try{if(agents[_0x1f3268[_0xaa5f('0x13')]]){utils[_0xaa5f('0x1c')](util['format'](_0xaa5f('0x2a'),_0x1f3268[_0xaa5f('0x12')]),_0x1f3268);utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x2b'),_0x1f3268['uniqueid'],agents[_0x1f3268['destuniqueid']][_0xaa5f('0x6')],_0x1f3268[_0xaa5f('0x13')]));agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x2c')]=utils['now']();agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x9')]=_0x1f3268[_0xaa5f('0x9')];agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x16')]=_0x1f3268[_0xaa5f('0x16')];agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x22')]=_0x1f3268[_0xaa5f('0x23')];agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0xa')]='connect';_[_0xaa5f('0x2d')](agents,function(_0x2562ce,_0xcd9c30){if(_0x2562ce[_0xaa5f('0x13')]!=_0x1f3268[_0xaa5f('0x13')]&&_0x2562ce[_0xaa5f('0x12')]==_0x1f3268[_0xaa5f('0x12')]){_0x2562ce[_0xaa5f('0x24')]=0x0;_0x2562ce[_0xaa5f('0x22')]=_0x1f3268[_0xaa5f('0x23')];_0x2562ce['agentringnoanswer']=!![];_0x2562ce[_0xaa5f('0x1f')]=utils['now']();_0x2562ce[_0xaa5f('0xa')]=_0xaa5f('0x2e');_0x2562ce[_0xaa5f('0x27')]='answered_elsewhere';_0x2562ce[_0xaa5f('0x2f')]=_0x1f3268[_0xaa5f('0x13')];_0x2562ce[_0xaa5f('0x30')]=_0x1f3268['membername'];writeDB(_0x2562ce);}});}}catch(_0x12a8e4){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x2a'),_0x1f3268['uniqueid']),_0x12a8e4);}};exports[_0xaa5f('0x31')]=function(_0x2b2b4c){try{if(!_[_0xaa5f('0x1b')](agents[_0x2b2b4c[_0xaa5f('0x13')]])){utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')](_0xaa5f('0x32'),_0x2b2b4c[_0xaa5f('0x12')]),_0x2b2b4c);utils['info'](util[_0xaa5f('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2b2b4c[_0xaa5f('0x12')],agents[_0x2b2b4c['destuniqueid']][_0xaa5f('0x6')],_0x2b2b4c[_0xaa5f('0x13')]));agents[_0x2b2b4c['destuniqueid']][_0xaa5f('0x31')]=!![];agents[_0x2b2b4c[_0xaa5f('0x13')]][_0xaa5f('0x33')]=utils['now']();agents[_0x2b2b4c['destuniqueid']]['talktime']=utils[_0xaa5f('0x34')](agents[_0x2b2b4c['destuniqueid']][_0xaa5f('0x33')],agents[_0x2b2b4c[_0xaa5f('0x13')]][_0xaa5f('0x2c')]);agents[_0x2b2b4c[_0xaa5f('0x13')]]['reason']=_0x2b2b4c[_0xaa5f('0x27')];agents[_0x2b2b4c[_0xaa5f('0x13')]][_0xaa5f('0xa')]=_0xaa5f('0x35');writeDB(agents[_0x2b2b4c[_0xaa5f('0x13')]]);}}catch(_0x1f9629){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x32'),_0x2b2b4c[_0xaa5f('0x12')]),_0x1f9629);}};exports[_0xaa5f('0x36')]=function(_0x2de737){try{if(!_[_0xaa5f('0x1b')](agents[_0x2de737[_0xaa5f('0x37')]])){utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')]('[%s][agents][blindtransfer]',_0x2de737[_0xaa5f('0x12')]),_0x2de737);utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x38'),_0x2de737[_0xaa5f('0x12')],agents[_0x2de737[_0xaa5f('0x37')]][_0xaa5f('0x6')],agents[_0x2de737['transfereruniqueid']][_0xaa5f('0x12')]));agents[_0x2de737[_0xaa5f('0x37')]][_0xaa5f('0x39')]=!![];agents[_0x2de737[_0xaa5f('0x37')]]['transfertype']=_0xaa5f('0x3a');agents[_0x2de737[_0xaa5f('0x37')]][_0xaa5f('0x3b')]=_0x2de737['extension'];agents[_0x2de737['transfereruniqueid']]['transferuniqueid']=agents[_0x2de737['transfereruniqueid']]['uniqueid'];}}catch(_0x509c61){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x3c'),_0x2de737[_0xaa5f('0x12')]),_0x509c61);}};exports[_0xaa5f('0x3d')]=function(_0x17b872){try{utils['debug'](util['format'](_0xaa5f('0x3e'),_0x17b872[_0xaa5f('0x3f')]),_0x17b872);if(_0x17b872['origtransfereruniqueid']==_0x17b872[_0xaa5f('0x40')]){if(!_[_0xaa5f('0x1b')](agents[_0x17b872[_0xaa5f('0x41')]])){utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x42'),_0x17b872[_0xaa5f('0x3f')],agents[_0x17b872['secondtransfereruniqueid']]['membername']));agents[_0x17b872[_0xaa5f('0x41')]][_0xaa5f('0x39')]=!![];agents[_0x17b872['secondtransfereruniqueid']]['transfertype']='ATTENDED';agents[_0x17b872[_0xaa5f('0x41')]]['transferexten']=_0x17b872[_0xaa5f('0x43')];agents[_0x17b872['secondtransfereruniqueid']]['transferuniqueid']=_0x17b872[_0xaa5f('0x3f')];}if(_0x17b872[_0xaa5f('0x44')]&&agents[_0x17b872[_0xaa5f('0x44')]]){agents[_0x17b872['transfereeuniqueid']][_0xaa5f('0x45')]=0x1;transfers[_0x17b872[_0xaa5f('0x44')]]=_[_0xaa5f('0x46')](agents[_0x17b872['transfereeuniqueid']]);transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x8')]=agents[_0x17b872['secondtransfereruniqueid']][_0xaa5f('0x8')];transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x47')]=agents[_0x17b872[_0xaa5f('0x41')]][_0xaa5f('0x47')];transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x48')]=utils[_0xaa5f('0x20')]();transfers[_0x17b872[_0xaa5f('0x44')]]['agentconnectAt']=utils[_0xaa5f('0x20')]();transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x22')]=0x0;transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x45')]=0x2;}}else if(_0x17b872[_0xaa5f('0x41')]==_0x17b872[_0xaa5f('0x49')]){if(!_[_0xaa5f('0x1b')](agents[_0x17b872['origtransfereruniqueid']])){utils[_0xaa5f('0x17')](util['format'](_0xaa5f('0x42'),_0x17b872[_0xaa5f('0x3f')],agents[_0x17b872[_0xaa5f('0x3f')]][_0xaa5f('0x6')]));agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x39')]=!![];agents[_0x17b872[_0xaa5f('0x3f')]][_0xaa5f('0x4a')]='ATTENDED';agents[_0x17b872[_0xaa5f('0x3f')]]['transferexten']=_0x17b872[_0xaa5f('0x4b')];agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x4c')]=_0x17b872[_0xaa5f('0x41')];}if(_0x17b872[_0xaa5f('0x4d')]&&agents[_0x17b872[_0xaa5f('0x4d')]]){agents[_0x17b872['transfertargetuniqueid']][_0xaa5f('0x45')]=0x1;transfers[_0x17b872[_0xaa5f('0x4d')]]=_['clone'](agents[_0x17b872['transfertargetuniqueid']]);transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x8')]=agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x8')];transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x47')]=agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x47')];transfers[_0x17b872[_0xaa5f('0x4d')]]['agentcalledAt']=utils[_0xaa5f('0x20')]();transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x2c')]=utils['now']();transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x22')]=0x0;transfers[_0x17b872['transfertargetuniqueid']][_0xaa5f('0x45')]=0x2;}}}catch(_0x309605){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x3e'),_0x17b872['origtransfereruniqueid']),_0x309605);}};exports[_0xaa5f('0x4e')]=function(_0x2ba378){try{utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')](_0xaa5f('0x4f'),_0x2ba378['uniqueid']),_0x2ba378);if(agents[_0x2ba378[_0xaa5f('0x12')]]&&agents[_0x2ba378['uniqueid']][_0xaa5f('0x27')]===_0xaa5f('0x21')){if(_0x2ba378[_0xaa5f('0x50')]==='21'){agents[_0x2ba378[_0xaa5f('0x12')]]['reason']=_0xaa5f('0x51');agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]=_0xaa5f('0x51');}utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2ba378['uniqueid'],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x6')],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')],agents[_0x2ba378[_0xaa5f('0x12')]]['lastevent']));writeDB(agents[_0x2ba378['uniqueid']]);var _0x104079=unanswered[_0xaa5f('0x52')](_0x2ba378['uniqueid']);if(_0x104079>-0x1){unanswered[_0xaa5f('0x53')](_0x104079,0x1);}}if(transfers[_0x2ba378['uniqueid']]){transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x31')]=!![];transfers[_0x2ba378['uniqueid']][_0xaa5f('0x33')]=utils[_0xaa5f('0x20')]();transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x24')]=utils[_0xaa5f('0x34')](transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x33')],transfers[_0x2ba378['uniqueid']][_0xaa5f('0x2c')]);transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')]='agent';transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]=_0xaa5f('0x35');utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2ba378[_0xaa5f('0x12')],transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x6')],transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')],transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]));writeDB(transfers[_0x2ba378[_0xaa5f('0x12')]],!![]);}if(agents[_0x2ba378[_0xaa5f('0x12')]]&&agents[_0x2ba378[_0xaa5f('0x12')]]['agentconnectAt']){agents[_0x2ba378['uniqueid']][_0xaa5f('0x31')]=!![];agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x33')]=utils[_0xaa5f('0x20')]();agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x24')]=utils[_0xaa5f('0x34')](agents[_0x2ba378[_0xaa5f('0x12')]]['agentcompleteAt'],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x2c')]);agents[_0x2ba378[_0xaa5f('0x12')]]['reason']=agents[_0x2ba378['uniqueid']][_0xaa5f('0x39')]?_0xaa5f('0x39'):_0xaa5f('0x54');agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]=_0xaa5f('0x35');utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x55'),_0x2ba378[_0xaa5f('0x12')],agents[_0x2ba378['uniqueid']][_0xaa5f('0x6')],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]));writeDB(agents[_0x2ba378['uniqueid']]);}}catch(_0x4183c0){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')]('[%s][agents][hangup]',_0x2ba378['uniqueid']),_0x4183c0);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index cd55ce3..ce8655a 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 _0x0a01=['endtime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','secondtransfererchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','userfield','_attended','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%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','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','split','lastIndexOf','includes','noop','[%s][calls][newexten]','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','membername','interface','calleridnum','connectedlinenum','getUserByInternal','accountcode','then','request','CreateVoiceCallReport','newchannel','debug','format','[%s][calls][newchannel]','channel','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','disposition','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','diffTime'];(function(_0x392b1c,_0x307b1f){var _0x23fcb8=function(_0x1d5ccb){while(--_0x1d5ccb){_0x392b1c['push'](_0x392b1c['shift']());}};_0x23fcb8(++_0x307b1f);}(_0x0a01,0x10b));var _0x10a0=function(_0x14ec1f,_0x59ef2f){_0x14ec1f=_0x14ec1f-0x0;var _0x5cecb3=_0x0a01[_0x14ec1f];return _0x5cecb3;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var transfers=require(_0x10a0('0x0'));var dispositions=['NO\x20ANSWER','FAILED',_0x10a0('0x1'),'NO\x20ANSWER',_0x10a0('0x2'),_0x10a0('0x2'),_0x10a0('0x3'),_0x10a0('0x4'),_0x10a0('0x1'),_0x10a0('0x1'),'FAILED'];var channels={};function writeDB(_0x1c479e){var _0x46edde;if(transfers[_0x10a0('0x5')][_0x1c479e[_0x10a0('0x6')]]){_0x46edde=_0x1c479e[_0x10a0('0x6')];_0x1c479e[_0x10a0('0x6')]=transfers['blinds'][_0x1c479e[_0x10a0('0x6')]][_0x10a0('0x7')];}utils[_0x10a0('0x8')](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1c479e[_0x10a0('0x6')],_0x1c479e['channel'],_0x1c479e['queue'],_0x1c479e[_0x10a0('0x9')],_0x1c479e[_0x10a0('0xa')],_0x1c479e[_0x10a0('0xb')],_0x1c479e[_0x10a0('0xc')],_0x1c479e['lastevent']));if(_0x1c479e['accountcode']){utils[_0x10a0('0xd')](_0x1c479e[_0x10a0('0xe')])[_0x10a0('0xf')](function(_0x53d0a8){if(_0x53d0a8){_0x1c479e['UserId']=_0x53d0a8['id'];}utils[_0x10a0('0x10')](_0x10a0('0x11'),_0x1c479e);});}else{utils[_0x10a0('0x10')]('CreateVoiceCallReport',_0x1c479e);}if(channels[_0x1c479e[_0x10a0('0x6')]]){delete channels[_0x1c479e[_0x10a0('0x6')]];}else if(_0x46edde&&channels[_0x46edde]){if(!transfers['blinds'][_0x46edde]['recording'])delete transfers[_0x10a0('0x5')][_0x46edde];delete channels[_0x46edde];}}exports[_0x10a0('0x12')]=function(_0x464cb3){try{utils[_0x10a0('0x13')](util[_0x10a0('0x14')](_0x10a0('0x15'),_0x464cb3[_0x10a0('0x6')]),_0x464cb3);if(_0x464cb3['uniqueid']==_0x464cb3['linkedid']&&_0x464cb3[_0x10a0('0x16')]!=_0x10a0('0x17')){utils[_0x10a0('0x8')](util[_0x10a0('0x14')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x464cb3['uniqueid'],_0x464cb3[_0x10a0('0x18')],_0x464cb3[_0x10a0('0x19')]));channels[_0x464cb3['uniqueid']]={'uniqueid':_0x464cb3[_0x10a0('0x6')],'accountcode':_0x464cb3['accountcode'],'source':_0x464cb3[_0x10a0('0xb')],'destination':_0x464cb3[_0x10a0('0x19')],'destinationcontext':_0x464cb3[_0x10a0('0x18')],'channel':_0x464cb3[_0x10a0('0x16')],'starttime':utils[_0x10a0('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x10a0('0x2'),'amaflags':_0x10a0('0x1b')};}}catch(_0xee103a){utils[_0x10a0('0x1c')](util[_0x10a0('0x14')](_0x10a0('0x15'),_0x464cb3[_0x10a0('0x6')]),_0xee103a);}};exports[_0x10a0('0x1d')]=function(_0x23caf4){try{utils[_0x10a0('0x13')](util[_0x10a0('0x14')](_0x10a0('0x1e'),_0x23caf4['uniqueid']),_0x23caf4);if(!_[_0x10a0('0x1f')](channels[_0x23caf4['uniqueid']])&&_0x23caf4[_0x10a0('0x20')]==0x6){utils['info'](util[_0x10a0('0x14')](_0x10a0('0x21'),_0x23caf4[_0x10a0('0x6')],_0x23caf4[_0x10a0('0x18')],_0x23caf4[_0x10a0('0x16')]));if(_[_0x10a0('0x1f')](channels[_0x23caf4['uniqueid']][_0x10a0('0x22')])){channels[_0x23caf4['uniqueid']]['systemanswertime']=utils[_0x10a0('0x1a')]();}}else if(!_[_0x10a0('0x1f')](channels[_0x23caf4['linkedid']])&&_0x23caf4[_0x10a0('0x20')]==0x6&&_0x23caf4['context']!=_0x10a0('0x23')){utils[_0x10a0('0x8')](util[_0x10a0('0x14')](_0x10a0('0x24'),_0x23caf4[_0x10a0('0x6')],_0x23caf4['linkedid'],_0x23caf4[_0x10a0('0x18')],_0x23caf4[_0x10a0('0x16')]));channels[_0x23caf4[_0x10a0('0x25')]][_0x10a0('0xe')]=_0x23caf4['accountcode'];channels[_0x23caf4['linkedid']][_0x10a0('0x26')]=_0x23caf4['channel'];if(_[_0x10a0('0x1f')](channels[_0x23caf4['linkedid']][_0x10a0('0x27')])){channels[_0x23caf4[_0x10a0('0x25')]][_0x10a0('0x27')]=utils['now']();}channels[_0x23caf4[_0x10a0('0x25')]][_0x10a0('0x28')]=dispositions[_[_0x10a0('0x29')](_0x23caf4[_0x10a0('0x20')])]||_0x10a0('0x3');}}catch(_0x5a415c){utils[_0x10a0('0x1c')](util[_0x10a0('0x14')](_0x10a0('0x1e'),_0x23caf4[_0x10a0('0x6')]),_0x5a415c);}};exports[_0x10a0('0x2a')]=function(_0x37939c){try{if(!_['isNil'](channels[_0x37939c[_0x10a0('0x6')]])){utils[_0x10a0('0x13')](util[_0x10a0('0x14')]('[%s][calls][hangup]',_0x37939c['uniqueid']),_0x37939c);if(_[_0x10a0('0x1f')](channels[_0x37939c['uniqueid']][_0x10a0('0x2b')])){channels[_0x37939c['uniqueid']][_0x10a0('0x2b')]=_0x37939c[_0x10a0('0x2c')]+'\x20<'+_0x37939c[_0x10a0('0xb')]+'>';}utils['info'](util['format'](_0x10a0('0x2d'),_0x37939c[_0x10a0('0x6')],channels[_0x37939c['uniqueid']]['callerid'],_0x37939c[_0x10a0('0x2e')]));channels[_0x37939c['uniqueid']]['endtime']=utils[_0x10a0('0x1a')]();channels[_0x37939c[_0x10a0('0x6')]]['duration']=utils[_0x10a0('0x2f')](channels[_0x37939c[_0x10a0('0x6')]][_0x10a0('0x30')],channels[_0x37939c['uniqueid']]['starttime']);channels[_0x37939c['uniqueid']][_0x10a0('0x31')]=channels[_0x37939c[_0x10a0('0x6')]]['answertime']?utils[_0x10a0('0x2f')](channels[_0x37939c[_0x10a0('0x6')]][_0x10a0('0x30')],channels[_0x37939c[_0x10a0('0x6')]][_0x10a0('0x27')]):0x0;writeDB(channels[_0x37939c[_0x10a0('0x6')]]);}}catch(_0x4143a6){utils['error'](util[_0x10a0('0x14')](_0x10a0('0x32'),_0x37939c[_0x10a0('0x6')]),_0x4143a6);}};exports[_0x10a0('0x33')]=function(_0x1e4f22){try{if(!_[_0x10a0('0x1f')](channels[_0x1e4f22[_0x10a0('0x34')]])){utils['debug'](util['format']('[%s][calls][attendedtransfer]',_0x1e4f22[_0x10a0('0x35')]),_0x1e4f22);if(channels[_0x1e4f22[_0x10a0('0x34')]]['channel']==_0x1e4f22[_0x10a0('0x36')]){utils[_0x10a0('0x8')](util[_0x10a0('0x14')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x1e4f22[_0x10a0('0x35')],_0x1e4f22[_0x10a0('0x34')],_0x1e4f22[_0x10a0('0x37')]));channels[_0x1e4f22[_0x10a0('0x34')]]['destinationchannel']=_0x1e4f22[_0x10a0('0x37')];channels[_0x1e4f22['localtwolinkedid']]['userfield']='_attended';}else if(channels[_0x1e4f22[_0x10a0('0x34')]]['channel']=_0x1e4f22['transfertargetchannel']){utils[_0x10a0('0x8')](util['format'](_0x10a0('0x38'),_0x1e4f22['origtransfereruniqueid'],_0x1e4f22[_0x10a0('0x34')],_0x1e4f22[_0x10a0('0x39')]));channels[_0x1e4f22[_0x10a0('0x34')]][_0x10a0('0x26')]=_0x1e4f22[_0x10a0('0x39')];channels[_0x1e4f22['localtwolinkedid']][_0x10a0('0x3a')]=_0x10a0('0x3b');}}}catch(_0x59e29a){utils[_0x10a0('0x1c')](util['format'](_0x10a0('0x3c'),_0x1e4f22[_0x10a0('0x35')]),_0x59e29a);}};exports[_0x10a0('0x3d')]=function(_0x432bf9){try{if(!_[_0x10a0('0x1f')](channels[_0x432bf9['uniqueid']])){utils[_0x10a0('0x13')](util[_0x10a0('0x14')](_0x10a0('0x3e'),_0x432bf9[_0x10a0('0x6')]),_0x432bf9);channels[_0x432bf9[_0x10a0('0x6')]][_0x10a0('0x3f')]=utils[_0x10a0('0x1a')]();utils['info'](util[_0x10a0('0x14')](_0x10a0('0x40'),_0x432bf9[_0x10a0('0x6')],channels[_0x432bf9[_0x10a0('0x6')]][_0x10a0('0x3f')]));}}catch(_0x467544){utils['error'](util[_0x10a0('0x14')](_0x10a0('0x3e'),_0x432bf9[_0x10a0('0x6')]),_0x467544);}};exports[_0x10a0('0x41')]=function(_0x2e24d6){try{if(!_['isNil'](channels[_0x2e24d6[_0x10a0('0x6')]])){utils['debug'](util[_0x10a0('0x14')](_0x10a0('0x42'),_0x2e24d6['uniqueid']),_0x2e24d6);if(!_[_0x10a0('0x1f')](channels[_0x2e24d6[_0x10a0('0x6')]][_0x10a0('0x3f')])){channels[_0x2e24d6['uniqueid']][_0x10a0('0x43')]+=utils[_0x10a0('0x2f')](utils[_0x10a0('0x1a')](),channels[_0x2e24d6[_0x10a0('0x6')]][_0x10a0('0x3f')]);utils[_0x10a0('0x8')](util[_0x10a0('0x14')](_0x10a0('0x44'),_0x2e24d6['uniqueid'],channels[_0x2e24d6[_0x10a0('0x6')]][_0x10a0('0x43')]));delete channels[_0x2e24d6[_0x10a0('0x6')]][_0x10a0('0x3f')];}}}catch(_0x4c87a8){utils[_0x10a0('0x1c')](util['format'](_0x10a0('0x42'),_0x2e24d6['uniqueid']),_0x4c87a8);}};exports['varset']=function(_0xe62fd){try{if(!_[_0x10a0('0x1f')](channels[_0xe62fd[_0x10a0('0x6')]])){utils[_0x10a0('0x13')](util[_0x10a0('0x14')](_0x10a0('0x45'),_0xe62fd[_0x10a0('0x6')]),_0xe62fd);if(!_[_0x10a0('0x1f')](_0xe62fd[_0x10a0('0x46')][_0x10a0('0x47')])){utils['info'](util[_0x10a0('0x14')](_0x10a0('0x48'),_0xe62fd[_0x10a0('0x6')],_0xe62fd['value']));channels[_0xe62fd[_0x10a0('0x6')]][_0x10a0('0x49')]=_0xe62fd[_0x10a0('0x4a')];}if(!_['isNil'](_0xe62fd[_0x10a0('0x46')][_0x10a0('0x4b')])){utils[_0x10a0('0x8')](util[_0x10a0('0x14')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0xe62fd['uniqueid'],_0xe62fd[_0x10a0('0x4a')]));channels[_0xe62fd['uniqueid']]['destination']=_0xe62fd[_0x10a0('0x4a')];channels[_0xe62fd[_0x10a0('0x6')]][_0x10a0('0x2b')]='\x22'+_0xe62fd[_0x10a0('0x4a')]+_0x10a0('0x4c')+_0xe62fd[_0x10a0('0x4a')]+'>';}if(!_[_0x10a0('0x1f')](_0xe62fd['variable'][_0x10a0('0x4d')])||!_['isNil'](_0xe62fd[_0x10a0('0x46')][_0x10a0('0x4e')])){utils[_0x10a0('0x8')](util[_0x10a0('0x14')](_0x10a0('0x4f'),_0xe62fd['uniqueid'],!_['isNil'](_0xe62fd[_0x10a0('0x46')][_0x10a0('0x4d')])?_0x10a0('0x4d'):'xmd-callerid',_0xe62fd['value']));channels[_0xe62fd[_0x10a0('0x6')]]['callerid']=_0xe62fd[_0x10a0('0x4a')];}if(!_['isNil'](_0xe62fd[_0x10a0('0x46')][_0x10a0('0x50')])||!_[_0x10a0('0x1f')](_0xe62fd[_0x10a0('0x46')][_0x10a0('0x51')])){utils['info'](util[_0x10a0('0x14')](_0x10a0('0x4f'),_0xe62fd[_0x10a0('0x6')],!_[_0x10a0('0x1f')](_0xe62fd['variable'][_0x10a0('0x50')])?'xmd-queue':_0x10a0('0x51'),_0xe62fd[_0x10a0('0x4a')]));channels[_0xe62fd['uniqueid']]['lastapplication']='Queue';channels[_0xe62fd[_0x10a0('0x6')]][_0x10a0('0x52')]=_0xe62fd[_0x10a0('0x4a')];channels[_0xe62fd[_0x10a0('0x6')]][_0x10a0('0x53')]=!![];}if(!_[_0x10a0('0x1f')](_0xe62fd[_0x10a0('0x46')][_0x10a0('0x54')])){utils[_0x10a0('0x8')](util[_0x10a0('0x14')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0xe62fd[_0x10a0('0x6')],_0xe62fd['value']));channels[_0xe62fd['uniqueid']][_0x10a0('0x55')]=_0xe62fd['value'];}if(!_['isNil'](_0xe62fd[_0x10a0('0x46')][_0x10a0('0x56')])){utils[_0x10a0('0x8')](util[_0x10a0('0x14')](_0x10a0('0x57'),_0xe62fd['uniqueid'],_0xe62fd[_0x10a0('0x4a')]));channels[_0xe62fd[_0x10a0('0x6')]][_0x10a0('0x58')]=_0xe62fd[_0x10a0('0x4a')];}if(!_['isNil'](_0xe62fd['variable'][_0x10a0('0x59')])){utils['info'](util['format'](_0x10a0('0x5a'),_0xe62fd['uniqueid'],_0xe62fd[_0x10a0('0x4a')]));channels[_0xe62fd[_0x10a0('0x6')]][_0x10a0('0x5b')]=_0xe62fd[_0x10a0('0x4a')];}if(!_[_0x10a0('0x1f')](_0xe62fd[_0x10a0('0x46')][_0x10a0('0x5c')])){utils[_0x10a0('0x8')](util[_0x10a0('0x14')](_0x10a0('0x5d'),_0xe62fd[_0x10a0('0x6')],_0xe62fd[_0x10a0('0x4a')]));channels[_0xe62fd[_0x10a0('0x6')]][_0x10a0('0x5c')]=_0xe62fd[_0x10a0('0x4a')];}}}catch(_0xb492ca){utils[_0x10a0('0x1c')](util[_0x10a0('0x14')](_0x10a0('0x45'),_0xe62fd[_0x10a0('0x6')]),_0xb492ca);}};exports[_0x10a0('0x5e')]=function(_0x178ecf){try{if(!_[_0x10a0('0x1f')](channels[_0x178ecf[_0x10a0('0x6')]])){utils['debug'](util[_0x10a0('0x14')]('[%s][calls][newexten]',_0x178ecf['uniqueid']),_0x178ecf);utils[_0x10a0('0x8')](util['format'](_0x10a0('0x5f'),_0x178ecf['uniqueid'],_0x178ecf[_0x10a0('0x60')],_0x178ecf['appdata']));if(_0x178ecf[_0x10a0('0x60')][_0x10a0('0x61')]()=='set'&&_[_0x10a0('0x62')](_0x178ecf[_0x10a0('0x63')]['toLowerCase'](),'cdr')){var _0x2e2b23=_0x178ecf[_0x10a0('0x63')][_0x10a0('0x64')]('=');var _0x23bd13=_0x2e2b23[0x0]['substring'](_0x2e2b23[0x0][_0x10a0('0x65')]('(')+0x1,_0x2e2b23[0x0]['lastIndexOf'](')'));var _0xa17824=_0x2e2b23[0x1];channels[_0x178ecf[_0x10a0('0x6')]][_0x23bd13]=_0xa17824;}if(!_[_0x10a0('0x66')](['hangup',_0x10a0('0x67'),'execif','set','gotoif'],_0x178ecf[_0x10a0('0x60')][_0x10a0('0x61')]())){channels[_0x178ecf['uniqueid']]['lastapplication']=_0x178ecf['application'];channels[_0x178ecf[_0x10a0('0x6')]][_0x10a0('0x52')]=_0x178ecf['appdata'];}}}catch(_0x159274){utils[_0x10a0('0x1c')](util[_0x10a0('0x14')](_0x10a0('0x68'),_0x178ecf[_0x10a0('0x6')]),_0x159274);}}; \ No newline at end of file +var _0x73a8=['now','error','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid','xmd-callerid-preview','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','lastdata','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','set','startsWith','toLowerCase','split','substring','includes','noop','gotoif','util','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','linkedid','channel','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten'];(function(_0x60eab1,_0x954319){var _0x567c5a=function(_0x5f3716){while(--_0x5f3716){_0x60eab1['push'](_0x60eab1['shift']());}};_0x567c5a(++_0x954319);}(_0x73a8,0x12a));var _0x873a=function(_0x3942ff,_0x2c34a4){_0x3942ff=_0x3942ff-0x0;var _0x44d0af=_0x73a8[_0x3942ff];return _0x44d0af;};'use strict';var _=require('lodash');var util=require(_0x873a('0x0'));var utils=require('./utils');var transfers=require(_0x873a('0x1'));var dispositions=[_0x873a('0x2'),_0x873a('0x3'),_0x873a('0x3'),_0x873a('0x2'),_0x873a('0x2'),'NO\x20ANSWER',_0x873a('0x4'),_0x873a('0x5'),_0x873a('0x3'),_0x873a('0x3'),_0x873a('0x3')];var channels={};function writeDB(_0x2fae77){var _0x5d4a24;if(transfers['blinds'][_0x2fae77['uniqueid']]){_0x5d4a24=_0x2fae77[_0x873a('0x6')];_0x2fae77[_0x873a('0x6')]=transfers[_0x873a('0x7')][_0x2fae77['uniqueid']][_0x873a('0x8')];}utils['info'](util[_0x873a('0x9')](_0x873a('0xa'),_0x2fae77[_0x873a('0x6')],_0x2fae77['channel'],_0x2fae77[_0x873a('0xb')],_0x2fae77[_0x873a('0xc')],_0x2fae77[_0x873a('0xd')],_0x2fae77[_0x873a('0xe')],_0x2fae77[_0x873a('0xf')],_0x2fae77[_0x873a('0x10')]));if(_0x2fae77[_0x873a('0x11')]){utils['getUserByInternal'](_0x2fae77[_0x873a('0x11')])[_0x873a('0x12')](function(_0x3ac85e){if(_0x3ac85e){_0x2fae77[_0x873a('0x13')]=_0x3ac85e['id'];}utils[_0x873a('0x14')](_0x873a('0x15'),_0x2fae77);});}else{utils[_0x873a('0x14')]('CreateVoiceCallReport',_0x2fae77);}if(channels[_0x2fae77[_0x873a('0x6')]]){delete channels[_0x2fae77[_0x873a('0x6')]];}else if(_0x5d4a24&&channels[_0x5d4a24]){if(!transfers[_0x873a('0x7')][_0x5d4a24][_0x873a('0x16')])delete transfers[_0x873a('0x7')][_0x5d4a24];delete channels[_0x5d4a24];}}exports[_0x873a('0x17')]=function(_0x525ef6){try{utils[_0x873a('0x18')](util[_0x873a('0x9')]('[%s][calls][newchannel]',_0x525ef6[_0x873a('0x6')]),_0x525ef6);if(_0x525ef6[_0x873a('0x6')]==_0x525ef6[_0x873a('0x19')]&&_0x525ef6[_0x873a('0x1a')]!=_0x873a('0x1b')){utils[_0x873a('0x1c')](util[_0x873a('0x9')](_0x873a('0x1d'),_0x525ef6['uniqueid'],_0x525ef6[_0x873a('0x1e')],_0x525ef6[_0x873a('0x1f')]));channels[_0x525ef6[_0x873a('0x6')]]={'uniqueid':_0x525ef6['uniqueid'],'accountcode':_0x525ef6[_0x873a('0x11')],'source':_0x525ef6['calleridnum'],'destination':_0x525ef6[_0x873a('0x1f')],'destinationcontext':_0x525ef6[_0x873a('0x1e')],'channel':_0x525ef6[_0x873a('0x1a')],'starttime':utils[_0x873a('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x873a('0x2'),'amaflags':'DOCUMENTATION'};}}catch(_0x28a29c){utils[_0x873a('0x21')](util[_0x873a('0x9')]('[%s][calls][newchannel]',_0x525ef6['uniqueid']),_0x28a29c);}};exports['newstate']=function(_0xdd52c7){try{utils[_0x873a('0x18')](util[_0x873a('0x9')](_0x873a('0x22'),_0xdd52c7[_0x873a('0x6')]),_0xdd52c7);if(!_[_0x873a('0x23')](channels[_0xdd52c7[_0x873a('0x6')]])&&_0xdd52c7['channelstate']==0x6){utils['info'](util['format'](_0x873a('0x24'),_0xdd52c7[_0x873a('0x6')],_0xdd52c7[_0x873a('0x1e')],_0xdd52c7[_0x873a('0x1a')]));if(_[_0x873a('0x23')](channels[_0xdd52c7[_0x873a('0x6')]][_0x873a('0x25')])){channels[_0xdd52c7[_0x873a('0x6')]]['systemanswertime']=utils[_0x873a('0x20')]();}}else if(!_[_0x873a('0x23')](channels[_0xdd52c7[_0x873a('0x19')]])&&_0xdd52c7[_0x873a('0x26')]==0x6&&_0xdd52c7['context']!='transfer'){utils[_0x873a('0x1c')](util['format'](_0x873a('0x27'),_0xdd52c7[_0x873a('0x6')],_0xdd52c7[_0x873a('0x19')],_0xdd52c7[_0x873a('0x1e')],_0xdd52c7[_0x873a('0x1a')]));channels[_0xdd52c7[_0x873a('0x19')]]['accountcode']=_0xdd52c7[_0x873a('0x11')];channels[_0xdd52c7[_0x873a('0x19')]]['destinationchannel']=_0xdd52c7['channel'];if(_['isNil'](channels[_0xdd52c7[_0x873a('0x19')]][_0x873a('0x28')])){channels[_0xdd52c7[_0x873a('0x19')]][_0x873a('0x28')]=utils[_0x873a('0x20')]();}channels[_0xdd52c7[_0x873a('0x19')]][_0x873a('0x29')]=dispositions[_[_0x873a('0x2a')](_0xdd52c7['channelstate'])]||_0x873a('0x4');}}catch(_0x588dbb){utils[_0x873a('0x21')](util['format'](_0x873a('0x22'),_0xdd52c7[_0x873a('0x6')]),_0x588dbb);}};exports[_0x873a('0x2b')]=function(_0x45210b){try{if(!_[_0x873a('0x23')](channels[_0x45210b[_0x873a('0x6')]])){utils[_0x873a('0x18')](util[_0x873a('0x9')](_0x873a('0x2c'),_0x45210b[_0x873a('0x6')]),_0x45210b);if(_[_0x873a('0x23')](channels[_0x45210b[_0x873a('0x6')]][_0x873a('0x2d')])){channels[_0x45210b[_0x873a('0x6')]][_0x873a('0x2d')]=_0x45210b[_0x873a('0x2e')]+'\x20<'+_0x45210b[_0x873a('0xe')]+'>';}utils[_0x873a('0x1c')](util['format'](_0x873a('0x2f'),_0x45210b['uniqueid'],channels[_0x45210b[_0x873a('0x6')]][_0x873a('0x2d')],_0x45210b[_0x873a('0x30')]));channels[_0x45210b[_0x873a('0x6')]][_0x873a('0x31')]=utils[_0x873a('0x20')]();channels[_0x45210b[_0x873a('0x6')]]['duration']=utils['diffTime'](channels[_0x45210b['uniqueid']][_0x873a('0x31')],channels[_0x45210b[_0x873a('0x6')]][_0x873a('0x32')]);channels[_0x45210b[_0x873a('0x6')]][_0x873a('0x33')]=channels[_0x45210b[_0x873a('0x6')]][_0x873a('0x28')]?utils[_0x873a('0x34')](channels[_0x45210b[_0x873a('0x6')]][_0x873a('0x31')],channels[_0x45210b[_0x873a('0x6')]]['answertime']):0x0;writeDB(channels[_0x45210b['uniqueid']]);}}catch(_0x9ae941){utils[_0x873a('0x21')](util[_0x873a('0x9')](_0x873a('0x2c'),_0x45210b[_0x873a('0x6')]),_0x9ae941);}};exports[_0x873a('0x35')]=function(_0xd18558){try{if(!_['isNil'](channels[_0xd18558[_0x873a('0x36')]])){utils[_0x873a('0x18')](util['format'](_0x873a('0x37'),_0xd18558[_0x873a('0x38')]),_0xd18558);if(channels[_0xd18558[_0x873a('0x36')]][_0x873a('0x1a')]==_0xd18558[_0x873a('0x39')]){utils[_0x873a('0x1c')](util[_0x873a('0x9')](_0x873a('0x3a'),_0xd18558[_0x873a('0x38')],_0xd18558[_0x873a('0x36')],_0xd18558[_0x873a('0x3b')]));channels[_0xd18558[_0x873a('0x36')]][_0x873a('0x3c')]=_0xd18558['secondtransfererchannel'];channels[_0xd18558[_0x873a('0x36')]][_0x873a('0x3d')]=_0x873a('0x3e');}else if(channels[_0xd18558[_0x873a('0x36')]][_0x873a('0x1a')]=_0xd18558[_0x873a('0x3f')]){utils['info'](util[_0x873a('0x9')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xd18558[_0x873a('0x38')],_0xd18558[_0x873a('0x36')],_0xd18558[_0x873a('0x40')]));channels[_0xd18558[_0x873a('0x36')]][_0x873a('0x3c')]=_0xd18558[_0x873a('0x40')];channels[_0xd18558[_0x873a('0x36')]]['userfield']=_0x873a('0x3e');}}}catch(_0x1e08f9){utils[_0x873a('0x21')](util[_0x873a('0x9')](_0x873a('0x37'),_0xd18558[_0x873a('0x38')]),_0x1e08f9);}};exports[_0x873a('0x41')]=function(_0x5cf21d){try{if(!_['isNil'](channels[_0x5cf21d[_0x873a('0x6')]])){utils[_0x873a('0x18')](util[_0x873a('0x9')]('[%s][calls][musiconholdstart]',_0x5cf21d[_0x873a('0x6')]),_0x5cf21d);channels[_0x5cf21d[_0x873a('0x6')]]['musiconholdstartAt']=utils[_0x873a('0x20')]();utils['info'](util[_0x873a('0x9')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x5cf21d[_0x873a('0x6')],channels[_0x5cf21d[_0x873a('0x6')]][_0x873a('0x42')]));}}catch(_0x452340){utils[_0x873a('0x21')](util[_0x873a('0x9')](_0x873a('0x43'),_0x5cf21d[_0x873a('0x6')]),_0x452340);}};exports[_0x873a('0x44')]=function(_0x5ab225){try{if(!_['isNil'](channels[_0x5ab225[_0x873a('0x6')]])){utils['debug'](util[_0x873a('0x9')]('[%s][calls][musiconholdstop]',_0x5ab225[_0x873a('0x6')]),_0x5ab225);if(!_[_0x873a('0x23')](channels[_0x5ab225[_0x873a('0x6')]][_0x873a('0x42')])){channels[_0x5ab225[_0x873a('0x6')]][_0x873a('0x45')]+=utils[_0x873a('0x34')](utils[_0x873a('0x20')](),channels[_0x5ab225[_0x873a('0x6')]]['musiconholdstartAt']);utils['info'](util['format'](_0x873a('0x46'),_0x5ab225['uniqueid'],channels[_0x5ab225[_0x873a('0x6')]][_0x873a('0x45')]));delete channels[_0x5ab225[_0x873a('0x6')]][_0x873a('0x42')];}}}catch(_0x52fdce){utils[_0x873a('0x21')](util['format'](_0x873a('0x47'),_0x5ab225['uniqueid']),_0x52fdce);}};exports[_0x873a('0x48')]=function(_0x16fbbf){try{if(!_[_0x873a('0x23')](channels[_0x16fbbf['uniqueid']])){utils[_0x873a('0x18')](util[_0x873a('0x9')](_0x873a('0x49'),_0x16fbbf[_0x873a('0x6')]),_0x16fbbf);if(!_[_0x873a('0x23')](_0x16fbbf[_0x873a('0x4a')][_0x873a('0x4b')])){utils[_0x873a('0x1c')](util[_0x873a('0x9')](_0x873a('0x4c'),_0x16fbbf[_0x873a('0x6')],_0x16fbbf[_0x873a('0x4d')]));channels[_0x16fbbf['uniqueid']][_0x873a('0x4e')]=_0x16fbbf[_0x873a('0x4d')];}if(!_[_0x873a('0x23')](_0x16fbbf['variable'][_0x873a('0x4f')])){utils[_0x873a('0x1c')](util['format'](_0x873a('0x50'),_0x16fbbf[_0x873a('0x6')],_0x16fbbf[_0x873a('0x4d')]));channels[_0x16fbbf['uniqueid']][_0x873a('0x51')]=_0x16fbbf[_0x873a('0x4d')];channels[_0x16fbbf[_0x873a('0x6')]][_0x873a('0x2d')]='\x22'+_0x16fbbf[_0x873a('0x4d')]+'\x22\x20<'+_0x16fbbf[_0x873a('0x4d')]+'>';}if(!_[_0x873a('0x23')](_0x16fbbf[_0x873a('0x4a')]['xmd-callerid-preview'])||!_[_0x873a('0x23')](_0x16fbbf[_0x873a('0x4a')][_0x873a('0x52')])){utils[_0x873a('0x1c')](util[_0x873a('0x9')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x16fbbf[_0x873a('0x6')],!_[_0x873a('0x23')](_0x16fbbf['variable']['xmd-callerid-preview'])?_0x873a('0x53'):_0x873a('0x52'),_0x16fbbf['value']));channels[_0x16fbbf[_0x873a('0x6')]]['callerid']=_0x16fbbf[_0x873a('0x4d')];}if(!_['isNil'](_0x16fbbf['variable'][_0x873a('0x54')])||!_[_0x873a('0x23')](_0x16fbbf[_0x873a('0x4a')][_0x873a('0x55')])){utils['info'](util['format'](_0x873a('0x56'),_0x16fbbf[_0x873a('0x6')],!_[_0x873a('0x23')](_0x16fbbf['variable']['xmd-queue'])?'xmd-queue':_0x873a('0x55'),_0x16fbbf[_0x873a('0x4d')]));channels[_0x16fbbf[_0x873a('0x6')]][_0x873a('0x57')]='Queue';channels[_0x16fbbf[_0x873a('0x6')]][_0x873a('0x58')]=_0x16fbbf[_0x873a('0x4d')];channels[_0x16fbbf[_0x873a('0x6')]][_0x873a('0xb')]=!![];}if(!_[_0x873a('0x23')](_0x16fbbf[_0x873a('0x4a')]['xmd-contactid'])){utils[_0x873a('0x1c')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x16fbbf[_0x873a('0x6')],_0x16fbbf[_0x873a('0x4d')]));channels[_0x16fbbf[_0x873a('0x6')]][_0x873a('0x59')]=_0x16fbbf[_0x873a('0x4d')];}if(!_[_0x873a('0x23')](_0x16fbbf[_0x873a('0x4a')][_0x873a('0x5a')])){utils['info'](util[_0x873a('0x9')](_0x873a('0x5b'),_0x16fbbf[_0x873a('0x6')],_0x16fbbf[_0x873a('0x4d')]));channels[_0x16fbbf[_0x873a('0x6')]][_0x873a('0x5c')]=_0x16fbbf[_0x873a('0x4d')];}if(!_[_0x873a('0x23')](_0x16fbbf[_0x873a('0x4a')][_0x873a('0x5d')])){utils[_0x873a('0x1c')](util['format'](_0x873a('0x5e'),_0x16fbbf[_0x873a('0x6')],_0x16fbbf[_0x873a('0x4d')]));channels[_0x16fbbf[_0x873a('0x6')]][_0x873a('0x5f')]=_0x16fbbf[_0x873a('0x4d')];}if(!_[_0x873a('0x23')](_0x16fbbf['variable'][_0x873a('0x60')])){utils[_0x873a('0x1c')](util['format'](_0x873a('0x61'),_0x16fbbf[_0x873a('0x6')],_0x16fbbf[_0x873a('0x4d')]));channels[_0x16fbbf['uniqueid']][_0x873a('0x60')]=_0x16fbbf['value'];}}}catch(_0x10ff45){utils[_0x873a('0x21')](util[_0x873a('0x9')]('[%s][calls][varset]',_0x16fbbf[_0x873a('0x6')]),_0x10ff45);}};exports[_0x873a('0x62')]=function(_0x9fcd50){try{if(!_[_0x873a('0x23')](channels[_0x9fcd50[_0x873a('0x6')]])){utils[_0x873a('0x18')](util[_0x873a('0x9')](_0x873a('0x63'),_0x9fcd50[_0x873a('0x6')]),_0x9fcd50);utils['info'](util['format']('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x9fcd50[_0x873a('0x6')],_0x9fcd50[_0x873a('0x64')],_0x9fcd50[_0x873a('0x65')]));if(_0x9fcd50['application']['toLowerCase']()==_0x873a('0x66')&&_[_0x873a('0x67')](_0x9fcd50[_0x873a('0x65')][_0x873a('0x68')](),'cdr')){var _0x522090=_0x9fcd50[_0x873a('0x65')][_0x873a('0x69')]('=');var _0x392d49=_0x522090[0x0][_0x873a('0x6a')](_0x522090[0x0]['lastIndexOf']('(')+0x1,_0x522090[0x0]['lastIndexOf'](')'));var _0x3ff2fe=_0x522090[0x1];channels[_0x9fcd50[_0x873a('0x6')]][_0x392d49]=_0x3ff2fe;}if(!_[_0x873a('0x6b')]([_0x873a('0x2b'),_0x873a('0x6c'),'execif',_0x873a('0x66'),_0x873a('0x6d')],_0x9fcd50[_0x873a('0x64')][_0x873a('0x68')]())){channels[_0x9fcd50[_0x873a('0x6')]][_0x873a('0x57')]=_0x9fcd50[_0x873a('0x64')];channels[_0x9fcd50[_0x873a('0x6')]][_0x873a('0x58')]=_0x9fcd50[_0x873a('0x65')];}}}catch(_0x444257){utils[_0x873a('0x21')](util['format'](_0x873a('0x63'),_0x9fcd50[_0x873a('0x6')]),_0x444257);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 5f05553..63532b5 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 _0xd9aa=['[core]\x20connected','[core]\x20shutdown','fullybooted','error','[core]\x20close','./utils','info'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xd9aa,0x75));var _0xad9a=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xd9aa[_0x35885a];return _0xe86249;};'use strict';var utils=require(_0xad9a('0x0'));exports['connect']=function(){utils[_0xad9a('0x1')](_0xad9a('0x2'));};exports['shutdown']=function(){utils[_0xad9a('0x1')](_0xad9a('0x3'));};exports[_0xad9a('0x4')]=function(){utils[_0xad9a('0x1')]('[core]\x20fullybooted');};exports[_0xad9a('0x5')]=function(_0x116f09){utils['error']('[core]\x20error',_0x116f09);};exports['close']=function(){utils['info'](_0xad9a('0x6'));};exports['managerevent']=function(_0x488ae0){}; \ No newline at end of file +var _0x5b98=['./utils','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','managerevent'];(function(_0x538373,_0x51b0da){var _0x270a03=function(_0x462468){while(--_0x462468){_0x538373['push'](_0x538373['shift']());}};_0x270a03(++_0x51b0da);}(_0x5b98,0x16b));var _0x85b9=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x5b98[_0x313c96];return _0x522f53;};'use strict';var utils=require(_0x85b9('0x0'));exports[_0x85b9('0x1')]=function(){utils[_0x85b9('0x2')](_0x85b9('0x3'));};exports['shutdown']=function(){utils[_0x85b9('0x2')](_0x85b9('0x4'));};exports[_0x85b9('0x5')]=function(){utils[_0x85b9('0x2')](_0x85b9('0x6'));};exports[_0x85b9('0x7')]=function(_0xd89b97){utils['error']('[core]\x20error',_0xd89b97);};exports[_0x85b9('0x8')]=function(){utils[_0x85b9('0x2')](_0x85b9('0x9'));};exports[_0x85b9('0xa')]=function(_0x510c62){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 7caccc4..d19f937 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 _0xda24=['[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','billableseconds','lodash','util','./utils','info','format','uniqueid','channel','dialstring','calleridnum','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','split','error','varset','[%s][dials][varset]','variable','value','dialbegin','isNil','[%s][dials][dialbegin]','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','dialstatus','answertime'];(function(_0x561159,_0x2063fe){var _0x5a71a3=function(_0x2e8712){while(--_0x2e8712){_0x561159['push'](_0x561159['shift']());}};_0x5a71a3(++_0x2063fe);}(_0xda24,0x15b));var _0x4da2=function(_0x5b57ae,_0x31bac6){_0x5b57ae=_0x5b57ae-0x0;var _0x1877c2=_0xda24[_0x5b57ae];return _0x1877c2;};'use strict';var _=require(_0x4da2('0x0'));var util=require(_0x4da2('0x1'));var utils=require(_0x4da2('0x2'));var dials={};function writeDB(_0x554085){utils[_0x4da2('0x3')](util[_0x4da2('0x4')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x554085[_0x4da2('0x5')],_0x554085[_0x4da2('0x6')],_0x554085[_0x4da2('0x7')],_0x554085[_0x4da2('0x8')],_0x554085['connectedlinenum'],_0x554085['dialstatus']));utils[_0x4da2('0x9')](_0x4da2('0xa'),_0x554085);delete dials[_0x554085[_0x4da2('0x5')]];}exports['newexten']=function(_0x2bcfa6){try{utils[_0x4da2('0xb')](util[_0x4da2('0x4')](_0x4da2('0xc'),_0x2bcfa6['uniqueid']),_0x2bcfa6);utils[_0x4da2('0x3')](util[_0x4da2('0x4')](_0x4da2('0xd'),_0x2bcfa6[_0x4da2('0x5')],_0x2bcfa6[_0x4da2('0xe')],_0x2bcfa6[_0x4da2('0xf')]));if(_0x2bcfa6['application'][_0x4da2('0x10')]()==_0x4da2('0x11')&&_['startsWith'](_0x2bcfa6[_0x4da2('0xf')][_0x4da2('0x10')](),'cdr(routeid)')){var _0x4ca073=_0x2bcfa6[_0x4da2('0xf')][_0x4da2('0x12')]('=');dials[_0x2bcfa6[_0x4da2('0x5')]]={'routeId':_0x4ca073[0x1]};}}catch(_0x1f0498){utils[_0x4da2('0x13')](util['format'](_0x4da2('0xc'),_0x2bcfa6['uniqueid']),_0x1f0498);}};exports[_0x4da2('0x14')]=function(_0x45b42f){try{utils[_0x4da2('0xb')](util[_0x4da2('0x4')](_0x4da2('0x15'),_0x45b42f['uniqueid']),_0x45b42f);if(!_['isNil'](_0x45b42f[_0x4da2('0x16')]['outboundrouteid'])){utils[_0x4da2('0x3')](util[_0x4da2('0x4')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x45b42f['uniqueid'],_0x45b42f[_0x4da2('0x17')]));dials[_0x45b42f[_0x4da2('0x5')]]={'routeId':_0x45b42f['value']};}}catch(_0x3765c2){utils['error'](util[_0x4da2('0x4')](_0x4da2('0x15'),_0x45b42f[_0x4da2('0x5')]),_0x3765c2);}};exports[_0x4da2('0x18')]=function(_0x2caa2f){try{if(!_[_0x4da2('0x19')](dials[_0x2caa2f[_0x4da2('0x5')]])){utils[_0x4da2('0xb')](util['format'](_0x4da2('0x1a'),_0x2caa2f['uniqueid']),_0x2caa2f);dials[_0x2caa2f[_0x4da2('0x5')]]=_[_0x4da2('0x1b')](dials[_0x2caa2f[_0x4da2('0x5')]],_0x2caa2f);dials[_0x2caa2f[_0x4da2('0x5')]]['starttime']=utils[_0x4da2('0x1c')]();dials[_0x2caa2f[_0x4da2('0x5')]][_0x4da2('0x1d')]=_0x4da2('0x1e');utils[_0x4da2('0x3')](util[_0x4da2('0x4')](_0x4da2('0x1f'),_0x2caa2f[_0x4da2('0x5')],dials[_0x2caa2f[_0x4da2('0x5')]][_0x4da2('0x20')]));}}catch(_0x4f62e9){utils[_0x4da2('0x13')](util[_0x4da2('0x4')]('[%s][dials][dialbegin]',_0x2caa2f['uniqueid']),_0x4f62e9);}};exports[_0x4da2('0x21')]=function(_0x25f49c){try{if(!_[_0x4da2('0x19')](dials[_0x25f49c[_0x4da2('0x5')]])){utils[_0x4da2('0xb')](util['format'](_0x4da2('0x22'),_0x25f49c[_0x4da2('0x5')]),_0x25f49c);dials[_0x25f49c[_0x4da2('0x5')]][_0x4da2('0x23')]=_0x25f49c[_0x4da2('0x23')];if(_0x25f49c[_0x4da2('0x23')]=='ANSWER'){dials[_0x25f49c[_0x4da2('0x5')]]=_[_0x4da2('0x1b')](dials[_0x25f49c['uniqueid']],_0x25f49c);dials[_0x25f49c[_0x4da2('0x5')]][_0x4da2('0x24')]=utils['now']();dials[_0x25f49c['uniqueid']]['lastevent']='connect';utils[_0x4da2('0x3')](util[_0x4da2('0x4')](_0x4da2('0x25'),_0x25f49c['uniqueid'],_0x25f49c[_0x4da2('0x23')],dials[_0x25f49c[_0x4da2('0x5')]][_0x4da2('0x24')]));}else{utils['info'](util[_0x4da2('0x4')](_0x4da2('0x26'),_0x25f49c['uniqueid'],_0x25f49c['dialstatus']));}}}catch(_0x5ec4f8){utils[_0x4da2('0x13')](util['format'](_0x4da2('0x22'),_0x25f49c[_0x4da2('0x5')]),_0x5ec4f8);}};exports['hangup']=function(_0x34176e){try{if(!_[_0x4da2('0x19')](dials[_0x34176e[_0x4da2('0x5')]])){utils[_0x4da2('0xb')](util['format'](_0x4da2('0x27'),_0x34176e[_0x4da2('0x5')]),_0x34176e);utils['info'](util['format'](_0x4da2('0x28'),_0x34176e[_0x4da2('0x5')],_0x34176e[_0x4da2('0x8')],_0x34176e[_0x4da2('0x29')],_0x34176e[_0x4da2('0x2a')]));dials[_0x34176e[_0x4da2('0x5')]]=_[_0x4da2('0x1b')](dials[_0x34176e[_0x4da2('0x5')]],{'endtime':utils[_0x4da2('0x1c')](),'lastevent':_0x4da2('0x2b')});dials[_0x34176e['uniqueid']][_0x4da2('0x2c')]=utils[_0x4da2('0x2d')](dials[_0x34176e[_0x4da2('0x5')]][_0x4da2('0x2e')],dials[_0x34176e[_0x4da2('0x5')]][_0x4da2('0x20')]);dials[_0x34176e[_0x4da2('0x5')]]['holdtime']=utils['diffTime'](dials[_0x34176e['uniqueid']][_0x4da2('0x24')]||dials[_0x34176e[_0x4da2('0x5')]][_0x4da2('0x2e')],dials[_0x34176e['uniqueid']][_0x4da2('0x20')]);dials[_0x34176e[_0x4da2('0x5')]][_0x4da2('0x2f')]=dials[_0x34176e[_0x4da2('0x5')]][_0x4da2('0x24')]?utils[_0x4da2('0x2d')](dials[_0x34176e[_0x4da2('0x5')]][_0x4da2('0x2e')],dials[_0x34176e['uniqueid']]['answertime']):0x0;writeDB(dials[_0x34176e['uniqueid']]);}}catch(_0x2d8e9d){utils[_0x4da2('0x13')](util['format'](_0x4da2('0x27'),_0x34176e[_0x4da2('0x5')]),_0x2d8e9d);}}; \ No newline at end of file +var _0x0976=['[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','holdtime','endtime','billableseconds','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','dialstatus','CreateVoiceDialReport','appdata','toLowerCase','startsWith','cdr(routeid)','split','error','[%s][dials][newexten]','varset','debug','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]'];(function(_0x198794,_0x2e41b6){var _0x5b4967=function(_0x420416){while(--_0x420416){_0x198794['push'](_0x198794['shift']());}};_0x5b4967(++_0x2e41b6);}(_0x0976,0xc4));var _0x6097=function(_0x51b016,_0x5cffc5){_0x51b016=_0x51b016-0x0;var _0x3c4382=_0x0976[_0x51b016];return _0x3c4382;};'use strict';var _=require(_0x6097('0x0'));var util=require(_0x6097('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x8cee2f){utils[_0x6097('0x2')](util[_0x6097('0x3')](_0x6097('0x4'),_0x8cee2f[_0x6097('0x5')],_0x8cee2f[_0x6097('0x6')],_0x8cee2f[_0x6097('0x7')],_0x8cee2f['calleridnum'],_0x8cee2f['connectedlinenum'],_0x8cee2f[_0x6097('0x8')]));utils['request'](_0x6097('0x9'),_0x8cee2f);delete dials[_0x8cee2f[_0x6097('0x5')]];}exports['newexten']=function(_0x593c27){try{utils['debug'](util['format']('[%s][dials][newexten]',_0x593c27[_0x6097('0x5')]),_0x593c27);utils[_0x6097('0x2')](util[_0x6097('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x593c27['uniqueid'],_0x593c27['application'],_0x593c27[_0x6097('0xa')]));if(_0x593c27['application'][_0x6097('0xb')]()=='set'&&_[_0x6097('0xc')](_0x593c27[_0x6097('0xa')]['toLowerCase'](),_0x6097('0xd'))){var _0x109bda=_0x593c27[_0x6097('0xa')][_0x6097('0xe')]('=');dials[_0x593c27[_0x6097('0x5')]]={'routeId':_0x109bda[0x1]};}}catch(_0x3b0b74){utils[_0x6097('0xf')](util['format'](_0x6097('0x10'),_0x593c27[_0x6097('0x5')]),_0x3b0b74);}};exports[_0x6097('0x11')]=function(_0x38056a){try{utils[_0x6097('0x12')](util['format'](_0x6097('0x13'),_0x38056a[_0x6097('0x5')]),_0x38056a);if(!_[_0x6097('0x14')](_0x38056a[_0x6097('0x15')]['outboundrouteid'])){utils[_0x6097('0x2')](util[_0x6097('0x3')](_0x6097('0x16'),_0x38056a[_0x6097('0x5')],_0x38056a[_0x6097('0x17')]));dials[_0x38056a[_0x6097('0x5')]]={'routeId':_0x38056a[_0x6097('0x17')]};}}catch(_0x5e5ed0){utils['error'](util[_0x6097('0x3')](_0x6097('0x13'),_0x38056a[_0x6097('0x5')]),_0x5e5ed0);}};exports[_0x6097('0x18')]=function(_0x3fd237){try{if(!_[_0x6097('0x14')](dials[_0x3fd237['uniqueid']])){utils[_0x6097('0x12')](util[_0x6097('0x3')](_0x6097('0x19'),_0x3fd237[_0x6097('0x5')]),_0x3fd237);dials[_0x3fd237[_0x6097('0x5')]]=_[_0x6097('0x1a')](dials[_0x3fd237[_0x6097('0x5')]],_0x3fd237);dials[_0x3fd237[_0x6097('0x5')]][_0x6097('0x1b')]=utils[_0x6097('0x1c')]();dials[_0x3fd237['uniqueid']][_0x6097('0x1d')]=_0x6097('0x1e');utils['info'](util[_0x6097('0x3')](_0x6097('0x1f'),_0x3fd237['uniqueid'],dials[_0x3fd237[_0x6097('0x5')]][_0x6097('0x1b')]));}}catch(_0x25d5e7){utils[_0x6097('0xf')](util[_0x6097('0x3')](_0x6097('0x19'),_0x3fd237[_0x6097('0x5')]),_0x25d5e7);}};exports[_0x6097('0x20')]=function(_0x1664c2){try{if(!_['isNil'](dials[_0x1664c2['uniqueid']])){utils['debug'](util[_0x6097('0x3')](_0x6097('0x21'),_0x1664c2[_0x6097('0x5')]),_0x1664c2);dials[_0x1664c2[_0x6097('0x5')]][_0x6097('0x8')]=_0x1664c2[_0x6097('0x8')];if(_0x1664c2[_0x6097('0x8')]=='ANSWER'){dials[_0x1664c2[_0x6097('0x5')]]=_[_0x6097('0x1a')](dials[_0x1664c2[_0x6097('0x5')]],_0x1664c2);dials[_0x1664c2[_0x6097('0x5')]][_0x6097('0x22')]=utils[_0x6097('0x1c')]();dials[_0x1664c2[_0x6097('0x5')]][_0x6097('0x1d')]=_0x6097('0x23');utils['info'](util[_0x6097('0x3')](_0x6097('0x24'),_0x1664c2['uniqueid'],_0x1664c2[_0x6097('0x8')],dials[_0x1664c2[_0x6097('0x5')]][_0x6097('0x22')]));}else{utils['info'](util[_0x6097('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x1664c2[_0x6097('0x5')],_0x1664c2[_0x6097('0x8')]));}}}catch(_0x2f673c){utils['error'](util[_0x6097('0x3')](_0x6097('0x21'),_0x1664c2[_0x6097('0x5')]),_0x2f673c);}};exports[_0x6097('0x25')]=function(_0x10e5a9){try{if(!_[_0x6097('0x14')](dials[_0x10e5a9[_0x6097('0x5')]])){utils[_0x6097('0x12')](util[_0x6097('0x3')](_0x6097('0x26'),_0x10e5a9['uniqueid']),_0x10e5a9);utils['info'](util[_0x6097('0x3')](_0x6097('0x27'),_0x10e5a9[_0x6097('0x5')],_0x10e5a9['calleridnum'],_0x10e5a9[_0x6097('0x28')],_0x10e5a9['cause-txt']));dials[_0x10e5a9[_0x6097('0x5')]]=_[_0x6097('0x1a')](dials[_0x10e5a9[_0x6097('0x5')]],{'endtime':utils[_0x6097('0x1c')](),'lastevent':_0x6097('0x29')});dials[_0x10e5a9[_0x6097('0x5')]][_0x6097('0x2a')]=utils[_0x6097('0x2b')](dials[_0x10e5a9[_0x6097('0x5')]]['endtime'],dials[_0x10e5a9['uniqueid']]['starttime']);dials[_0x10e5a9[_0x6097('0x5')]][_0x6097('0x2c')]=utils[_0x6097('0x2b')](dials[_0x10e5a9[_0x6097('0x5')]][_0x6097('0x22')]||dials[_0x10e5a9[_0x6097('0x5')]][_0x6097('0x2d')],dials[_0x10e5a9[_0x6097('0x5')]][_0x6097('0x1b')]);dials[_0x10e5a9[_0x6097('0x5')]][_0x6097('0x2e')]=dials[_0x10e5a9[_0x6097('0x5')]]['answertime']?utils['diffTime'](dials[_0x10e5a9[_0x6097('0x5')]][_0x6097('0x2d')],dials[_0x10e5a9[_0x6097('0x5')]]['answertime']):0x0;writeDB(dials[_0x10e5a9[_0x6097('0x5')]]);}}catch(_0x37a307){utils['error'](util[_0x6097('0x3')](_0x6097('0x26'),_0x10e5a9[_0x6097('0x5')]),_0x37a307);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index dceeb48..dd8cf46 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 _0x3220=['keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./transfers.controller','connect','shutdown','fullybooted','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','error','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','util','xdr','disabled','env','local','asterisk','port','username','password'];(function(_0xd70e5e,_0x25fdd0){var _0x3ec256=function(_0x3e9fc3){while(--_0x3e9fc3){_0xd70e5e['push'](_0xd70e5e['shift']());}};_0x3ec256(++_0x25fdd0);}(_0x3220,0x7e));var _0x0322=function(_0x1cd907,_0x5b7249){_0x1cd907=_0x1cd907-0x0;var _0x37c00d=_0x3220[_0x1cd907];return _0x37c00d;};var AsteriskManager=require('asterisk-manager');var config=require(_0x0322('0x0'));var utils=require('./utils');var util=require(_0x0322('0x1'));var isXDREnabled=config[_0x0322('0x2')]&&config['xdr'][_0x0322('0x3')]?!config[_0x0322('0x2')][_0x0322('0x3')]:!![];var isProduction=config[_0x0322('0x4')]==='production'||![];var isLocalAsterisk=config[_0x0322('0x2')]&&config[_0x0322('0x2')][_0x0322('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0x0322('0x6')][_0x0322('0x7')],config[_0x0322('0x6')]['ip'],config['asterisk'][_0x0322('0x8')],config[_0x0322('0x6')][_0x0322('0x9')],!![]);ami[_0x0322('0xa')]();if(!isXDREnabled){utils['info'](_0x0322('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x0322('0xc')](_0x0322('0xd'));}else{var agents=require(_0x0322('0xe'));var calls=require('./calls.controller');var queues=require(_0x0322('0xf'));var recordings=require(_0x0322('0x10'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0x0322('0x11'));var core=require('./core.controller');ami['on'](_0x0322('0x12'),core[_0x0322('0x12')]);ami['on'](_0x0322('0x13'),core[_0x0322('0x13')]);ami['on'](_0x0322('0x14'),core[_0x0322('0x14')]);ami['on']('error',core['error']);ami['on'](_0x0322('0x15'),core[_0x0322('0x15')]);ami['on']('managerevent',core[_0x0322('0x16')]);ami['on'](_0x0322('0x17'),function(_0x986871){try{utils[_0x0322('0x18')](util[_0x0322('0x19')](_0x0322('0x1a'),_0x986871[_0x0322('0x1b')]),_0x986871);members[_0x0322('0x17')](_0x986871);}catch(_0x11c7b2){utils[_0x0322('0x1c')](util[_0x0322('0x19')]('[%s][index][devicestatechange]',_0x986871[_0x0322('0x1b')]),_0x11c7b2);}});ami['on'](_0x0322('0x1d'),function(_0x308e33){try{utils[_0x0322('0x18')](util[_0x0322('0x19')]('[%s][index][agentcalled]',_0x308e33[_0x0322('0x1e')]),_0x308e33);agents[_0x0322('0x1d')](_0x308e33);}catch(_0x4bd2e2){utils[_0x0322('0x1c')](util[_0x0322('0x19')](_0x0322('0x1f'),_0x308e33[_0x0322('0x1e')]),_0x4bd2e2);}});ami['on'](_0x0322('0x20'),function(_0xc7e415){try{utils[_0x0322('0x18')](util[_0x0322('0x19')](_0x0322('0x21'),_0xc7e415['uniqueid']),_0xc7e415);agents[_0x0322('0x20')](_0xc7e415);}catch(_0x4d5825){utils['error'](util[_0x0322('0x19')]('[%s][index][agentringnoanswer]',_0xc7e415[_0x0322('0x1e')]),_0x4d5825);}});ami['on'](_0x0322('0x22'),function(_0x201f8d){try{utils[_0x0322('0x18')](util['format'](_0x0322('0x23'),_0x201f8d[_0x0322('0x1e')]),_0x201f8d);agents[_0x0322('0x22')](_0x201f8d);queues[_0x0322('0x22')](_0x201f8d);}catch(_0x54f287){utils[_0x0322('0x1c')](util[_0x0322('0x19')](_0x0322('0x23'),_0x201f8d[_0x0322('0x1e')]),_0x54f287);}});ami['on'](_0x0322('0x24'),function(_0x217a12){try{utils['debug'](util[_0x0322('0x19')]('[%s][index][agentcomplete]',_0x217a12[_0x0322('0x1e')]),_0x217a12);agents[_0x0322('0x24')](_0x217a12);queues[_0x0322('0x24')](_0x217a12);members[_0x0322('0x24')](_0x217a12);}catch(_0x18e738){utils[_0x0322('0x1c')](util['format'](_0x0322('0x25'),_0x217a12[_0x0322('0x1e')]),_0x18e738);}});ami['on'](_0x0322('0x26'),function(_0x5f4c60){try{utils[_0x0322('0x18')](util[_0x0322('0x19')]('[%s][index][queuecallerabandon]',_0x5f4c60['uniqueid']),_0x5f4c60);agents['queuecallerabandon'](_0x5f4c60);queues['queuecallerabandon'](_0x5f4c60);}catch(_0x27a726){utils['error'](util['format']('[%s][index][queuecallerabandon]',_0x5f4c60[_0x0322('0x1e')]),_0x27a726);}});ami['on'](_0x0322('0x27'),function(_0x4b2d55){try{utils[_0x0322('0x18')](util[_0x0322('0x19')](_0x0322('0x28'),_0x4b2d55['uniqueid']),_0x4b2d55);queues[_0x0322('0x27')](_0x4b2d55);recordings[_0x0322('0x27')](_0x4b2d55);}catch(_0x50e811){utils[_0x0322('0x1c')](util[_0x0322('0x19')](_0x0322('0x28'),_0x4b2d55[_0x0322('0x1e')]),_0x50e811);}});ami['on'](_0x0322('0x29'),function(_0x4c952e){try{utils['debug'](util[_0x0322('0x19')]('[%s][index][queuecallerleave]',_0x4c952e['uniqueid']),_0x4c952e);queues[_0x0322('0x29')](_0x4c952e);}catch(_0x551930){utils[_0x0322('0x1c')](util[_0x0322('0x19')](_0x0322('0x2a'),_0x4c952e[_0x0322('0x1e')]),_0x551930);}});ami['on'](_0x0322('0x2b'),function(_0x1937ba){try{utils[_0x0322('0x18')](util[_0x0322('0x19')](_0x0322('0x2c'),_0x1937ba[_0x0322('0x1e')]),_0x1937ba);queues['musiconholdstart'](_0x1937ba);calls[_0x0322('0x2b')](_0x1937ba);}catch(_0x5b708e){utils['error'](util['format'](_0x0322('0x2c'),_0x1937ba[_0x0322('0x1e')]),_0x5b708e);}});ami['on']('musiconholdstop',function(_0x44c7a4){try{utils[_0x0322('0x18')](util[_0x0322('0x19')](_0x0322('0x2d'),_0x44c7a4[_0x0322('0x1e')]),_0x44c7a4);queues[_0x0322('0x2e')](_0x44c7a4);calls[_0x0322('0x2e')](_0x44c7a4);}catch(_0x300190){utils[_0x0322('0x1c')](util[_0x0322('0x19')](_0x0322('0x2d'),_0x44c7a4['uniqueid']),_0x300190);}});ami['on'](_0x0322('0x2f'),function(_0x551409){try{utils[_0x0322('0x18')](util[_0x0322('0x19')]('[%s][index][newstate]',_0x551409[_0x0322('0x1e')]),_0x551409);calls[_0x0322('0x2f')](_0x551409);recordings[_0x0322('0x2f')](_0x551409);}catch(_0xedeefc){utils['error'](util[_0x0322('0x19')]('[%s][index][newstate]',_0x551409[_0x0322('0x1e')]),_0xedeefc);}});ami['on'](_0x0322('0x30'),function(_0xa57e3){try{utils[_0x0322('0x18')](util['format'](_0x0322('0x31'),_0xa57e3['uniqueid']),_0xa57e3);calls['hangup'](_0xa57e3);recordings[_0x0322('0x30')](_0xa57e3);dials[_0x0322('0x30')](_0xa57e3);agents[_0x0322('0x30')](_0xa57e3);queues[_0x0322('0x30')](_0xa57e3);}catch(_0x498bad){utils[_0x0322('0x1c')](util[_0x0322('0x19')]('[%s][index][hangup]',_0xa57e3[_0x0322('0x1e')]),_0x498bad);}});ami['on'](_0x0322('0x32'),function(_0x49725e){try{utils[_0x0322('0x18')](util[_0x0322('0x19')]('[%s][index][cdr]',_0x49725e[_0x0322('0x1e')]),_0x49725e);members['cdr'](_0x49725e);}catch(_0x3d00f2){utils[_0x0322('0x1c')](util[_0x0322('0x19')](_0x0322('0x33'),_0x49725e['uniqueid']),_0x3d00f2);}});ami['on'](_0x0322('0x34'),function(_0x3e1202){try{utils[_0x0322('0x18')](util['format'](_0x0322('0x35'),_0x3e1202[_0x0322('0x1e')]),_0x3e1202);queues['blindtransfer'](_0x3e1202);agents[_0x0322('0x34')](_0x3e1202);transfers['blindtransfer'](_0x3e1202);recordings['blindtransfer'](_0x3e1202);}catch(_0x2f7e96){utils['error'](util['format'](_0x0322('0x35'),_0x3e1202[_0x0322('0x1e')]),_0x2f7e96);}});ami['on'](_0x0322('0x36'),function(_0x12acaa){try{utils[_0x0322('0x18')](util['format'](_0x0322('0x37'),_0x12acaa[_0x0322('0x38')]),_0x12acaa);queues[_0x0322('0x36')](_0x12acaa);transfers[_0x0322('0x36')](_0x12acaa);agents[_0x0322('0x36')](_0x12acaa);calls[_0x0322('0x36')](_0x12acaa);}catch(_0x5d0076){utils['error'](util[_0x0322('0x19')](_0x0322('0x37'),_0x12acaa[_0x0322('0x38')]),_0x5d0076);}});ami['on'](_0x0322('0x39'),function(_0x13efb2){try{utils[_0x0322('0x18')](util[_0x0322('0x19')](_0x0322('0x3a'),_0x13efb2[_0x0322('0x1e')]),_0x13efb2);queues['varset'](_0x13efb2);recordings[_0x0322('0x39')](_0x13efb2);calls[_0x0322('0x39')](_0x13efb2);dials['varset'](_0x13efb2);}catch(_0x47e84f){utils[_0x0322('0x1c')](util[_0x0322('0x19')]('[%s][index][varset]',_0x13efb2[_0x0322('0x1e')]),_0x47e84f);}});ami['on'](_0x0322('0x3b'),function(_0x3a59c6){try{utils['debug'](util[_0x0322('0x19')](_0x0322('0x3c'),_0x3a59c6['uniqueid']),_0x3a59c6);calls['newexten'](_0x3a59c6);recordings[_0x0322('0x3b')](_0x3a59c6);dials[_0x0322('0x3b')](_0x3a59c6);}catch(_0x28ead3){utils[_0x0322('0x1c')](util[_0x0322('0x19')](_0x0322('0x3c'),_0x3a59c6[_0x0322('0x1e')]),_0x28ead3);}});ami['on'](_0x0322('0x3d'),function(_0x312885){try{utils[_0x0322('0x18')](util[_0x0322('0x19')](_0x0322('0x3e'),_0x312885[_0x0322('0x1e')]),_0x312885);calls['newchannel'](_0x312885);recordings[_0x0322('0x3d')](_0x312885);}catch(_0x2e0c3c){utils['error'](util[_0x0322('0x19')]('[%s][index][newchannel]',_0x312885['uniqueid']),_0x2e0c3c);}});ami['on'](_0x0322('0x3f'),function(_0x225011){try{utils[_0x0322('0x18')](util['format'](_0x0322('0x40'),_0x225011['uniqueid']),_0x225011);dials['dialbegin'](_0x225011);}catch(_0x3dbf35){utils[_0x0322('0x1c')](util[_0x0322('0x19')](_0x0322('0x41'),_0x225011[_0x0322('0x1e')]),_0x3dbf35);}});ami['on'](_0x0322('0x42'),function(_0x337f7d){try{utils[_0x0322('0x18')](util[_0x0322('0x19')](_0x0322('0x43'),_0x337f7d[_0x0322('0x1e')]),_0x337f7d);dials[_0x0322('0x42')](_0x337f7d);}catch(_0x4d8cf3){utils[_0x0322('0x1c')](util['format'](_0x0322('0x43'),_0x337f7d['uniqueid']),_0x4d8cf3);}});} \ No newline at end of file +var _0x2bf5=['uniqueid','agentringnoanswer','debug','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','username','password','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','format','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','[%s][index][agentcalled]'];(function(_0x55ec91,_0x3e26cf){var _0x526a94=function(_0x192add){while(--_0x192add){_0x55ec91['push'](_0x55ec91['shift']());}};_0x526a94(++_0x3e26cf);}(_0x2bf5,0x153));var _0x52bf=function(_0x37dc88,_0x4ea261){_0x37dc88=_0x37dc88-0x0;var _0x5cfc4f=_0x2bf5[_0x37dc88];return _0x5cfc4f;};var AsteriskManager=require(_0x52bf('0x0'));var config=require(_0x52bf('0x1'));var utils=require(_0x52bf('0x2'));var util=require(_0x52bf('0x3'));var isXDREnabled=config[_0x52bf('0x4')]&&config['xdr']['disabled']?!config[_0x52bf('0x4')][_0x52bf('0x5')]:!![];var isProduction=config[_0x52bf('0x6')]===_0x52bf('0x7')||![];var isLocalAsterisk=config['xdr']&&config[_0x52bf('0x4')][_0x52bf('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x52bf('0x9')]['port'],config['asterisk']['ip'],config[_0x52bf('0x9')][_0x52bf('0xa')],config['asterisk'][_0x52bf('0xb')],!![]);ami[_0x52bf('0xc')]();if(!isXDREnabled){utils['info'](_0x52bf('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x52bf('0xe')](_0x52bf('0xf'));}else{var agents=require(_0x52bf('0x10'));var calls=require(_0x52bf('0x11'));var queues=require(_0x52bf('0x12'));var recordings=require(_0x52bf('0x13'));var members=require(_0x52bf('0x14'));var dials=require(_0x52bf('0x15'));var transfers=require(_0x52bf('0x16'));var core=require(_0x52bf('0x17'));ami['on'](_0x52bf('0x18'),core['connect']);ami['on'](_0x52bf('0x19'),core['shutdown']);ami['on'](_0x52bf('0x1a'),core[_0x52bf('0x1a')]);ami['on'](_0x52bf('0x1b'),core['error']);ami['on'](_0x52bf('0x1c'),core[_0x52bf('0x1c')]);ami['on'](_0x52bf('0x1d'),core[_0x52bf('0x1d')]);ami['on']('devicestatechange',function(_0x2120d2){try{utils['debug'](util[_0x52bf('0x1e')](_0x52bf('0x1f'),_0x2120d2[_0x52bf('0x20')]),_0x2120d2);members[_0x52bf('0x21')](_0x2120d2);}catch(_0x2c36c1){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')]('[%s][index][devicestatechange]',_0x2120d2[_0x52bf('0x20')]),_0x2c36c1);}});ami['on'](_0x52bf('0x22'),function(_0x5a3c60){try{utils['debug'](util[_0x52bf('0x1e')](_0x52bf('0x23'),_0x5a3c60[_0x52bf('0x24')]),_0x5a3c60);agents[_0x52bf('0x22')](_0x5a3c60);}catch(_0x3e099e){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')]('[%s][index][agentcalled]',_0x5a3c60['uniqueid']),_0x3e099e);}});ami['on'](_0x52bf('0x25'),function(_0x148140){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x27'),_0x148140[_0x52bf('0x24')]),_0x148140);agents[_0x52bf('0x25')](_0x148140);}catch(_0x1281a9){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')]('[%s][index][agentringnoanswer]',_0x148140[_0x52bf('0x24')]),_0x1281a9);}});ami['on'](_0x52bf('0x28'),function(_0x5b6967){try{utils[_0x52bf('0x26')](util['format']('[%s][index][agentconnect]',_0x5b6967[_0x52bf('0x24')]),_0x5b6967);agents[_0x52bf('0x28')](_0x5b6967);queues[_0x52bf('0x28')](_0x5b6967);}catch(_0x55b582){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')](_0x52bf('0x29'),_0x5b6967[_0x52bf('0x24')]),_0x55b582);}});ami['on'](_0x52bf('0x2a'),function(_0x3fbb06){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')]('[%s][index][agentcomplete]',_0x3fbb06[_0x52bf('0x24')]),_0x3fbb06);agents[_0x52bf('0x2a')](_0x3fbb06);queues[_0x52bf('0x2a')](_0x3fbb06);members[_0x52bf('0x2a')](_0x3fbb06);}catch(_0x5e0673){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')]('[%s][index][agentcomplete]',_0x3fbb06[_0x52bf('0x24')]),_0x5e0673);}});ami['on'](_0x52bf('0x2b'),function(_0x21cb88){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x2c'),_0x21cb88[_0x52bf('0x24')]),_0x21cb88);agents['queuecallerabandon'](_0x21cb88);queues[_0x52bf('0x2b')](_0x21cb88);}catch(_0x4fa4ab){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')](_0x52bf('0x2c'),_0x21cb88[_0x52bf('0x24')]),_0x4fa4ab);}});ami['on']('queuecallerjoin',function(_0x4d9f7d){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x2d'),_0x4d9f7d['uniqueid']),_0x4d9f7d);queues[_0x52bf('0x2e')](_0x4d9f7d);recordings[_0x52bf('0x2e')](_0x4d9f7d);}catch(_0x169891){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')](_0x52bf('0x2d'),_0x4d9f7d['uniqueid']),_0x169891);}});ami['on'](_0x52bf('0x2f'),function(_0x3e6b71){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x30'),_0x3e6b71['uniqueid']),_0x3e6b71);queues[_0x52bf('0x2f')](_0x3e6b71);}catch(_0x3e1f0c){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')](_0x52bf('0x30'),_0x3e6b71[_0x52bf('0x24')]),_0x3e1f0c);}});ami['on'](_0x52bf('0x31'),function(_0x2d4cb0){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x32'),_0x2d4cb0[_0x52bf('0x24')]),_0x2d4cb0);queues[_0x52bf('0x31')](_0x2d4cb0);calls['musiconholdstart'](_0x2d4cb0);}catch(_0x18159c){utils[_0x52bf('0x1b')](util['format'](_0x52bf('0x32'),_0x2d4cb0['uniqueid']),_0x18159c);}});ami['on']('musiconholdstop',function(_0x5f2391){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')]('[%s][index][musiconholdstop]',_0x5f2391[_0x52bf('0x24')]),_0x5f2391);queues[_0x52bf('0x33')](_0x5f2391);calls['musiconholdstop'](_0x5f2391);}catch(_0x1043be){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')](_0x52bf('0x34'),_0x5f2391[_0x52bf('0x24')]),_0x1043be);}});ami['on'](_0x52bf('0x35'),function(_0x22c08b){try{utils[_0x52bf('0x26')](util['format'](_0x52bf('0x36'),_0x22c08b[_0x52bf('0x24')]),_0x22c08b);calls[_0x52bf('0x35')](_0x22c08b);recordings[_0x52bf('0x35')](_0x22c08b);}catch(_0x51f893){utils[_0x52bf('0x1b')](util['format'](_0x52bf('0x36'),_0x22c08b[_0x52bf('0x24')]),_0x51f893);}});ami['on']('hangup',function(_0x393550){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x37'),_0x393550[_0x52bf('0x24')]),_0x393550);calls[_0x52bf('0x38')](_0x393550);recordings[_0x52bf('0x38')](_0x393550);dials[_0x52bf('0x38')](_0x393550);agents[_0x52bf('0x38')](_0x393550);queues[_0x52bf('0x38')](_0x393550);}catch(_0x25b118){utils['error'](util['format'](_0x52bf('0x37'),_0x393550[_0x52bf('0x24')]),_0x25b118);}});ami['on'](_0x52bf('0x39'),function(_0x322a30){try{utils['debug'](util['format'](_0x52bf('0x3a'),_0x322a30[_0x52bf('0x24')]),_0x322a30);members[_0x52bf('0x39')](_0x322a30);}catch(_0x4bed17){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')](_0x52bf('0x3a'),_0x322a30[_0x52bf('0x24')]),_0x4bed17);}});ami['on']('blindtransfer',function(_0x3d9c7b){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')]('[%s][index][blindtransfer]',_0x3d9c7b[_0x52bf('0x24')]),_0x3d9c7b);queues[_0x52bf('0x3b')](_0x3d9c7b);agents[_0x52bf('0x3b')](_0x3d9c7b);transfers[_0x52bf('0x3b')](_0x3d9c7b);recordings[_0x52bf('0x3b')](_0x3d9c7b);}catch(_0xeca3fa){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')](_0x52bf('0x3c'),_0x3d9c7b[_0x52bf('0x24')]),_0xeca3fa);}});ami['on'](_0x52bf('0x3d'),function(_0x43ed69){try{utils[_0x52bf('0x26')](util['format'](_0x52bf('0x3e'),_0x43ed69[_0x52bf('0x3f')]),_0x43ed69);queues[_0x52bf('0x3d')](_0x43ed69);transfers['attendedtransfer'](_0x43ed69);agents[_0x52bf('0x3d')](_0x43ed69);calls[_0x52bf('0x3d')](_0x43ed69);}catch(_0x34f1d5){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')](_0x52bf('0x3e'),_0x43ed69[_0x52bf('0x3f')]),_0x34f1d5);}});ami['on'](_0x52bf('0x40'),function(_0x2ead84){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x41'),_0x2ead84['uniqueid']),_0x2ead84);queues[_0x52bf('0x40')](_0x2ead84);recordings[_0x52bf('0x40')](_0x2ead84);calls[_0x52bf('0x40')](_0x2ead84);dials[_0x52bf('0x40')](_0x2ead84);}catch(_0x3d6d76){utils[_0x52bf('0x1b')](util['format'](_0x52bf('0x41'),_0x2ead84[_0x52bf('0x24')]),_0x3d6d76);}});ami['on'](_0x52bf('0x42'),function(_0x2946b1){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x43'),_0x2946b1[_0x52bf('0x24')]),_0x2946b1);calls[_0x52bf('0x42')](_0x2946b1);recordings['newexten'](_0x2946b1);dials['newexten'](_0x2946b1);}catch(_0x3587e1){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')]('[%s][index][newexten]',_0x2946b1[_0x52bf('0x24')]),_0x3587e1);}});ami['on'](_0x52bf('0x44'),function(_0x3de36f){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x45'),_0x3de36f['uniqueid']),_0x3de36f);calls['newchannel'](_0x3de36f);recordings[_0x52bf('0x44')](_0x3de36f);}catch(_0x142021){utils['error'](util[_0x52bf('0x1e')](_0x52bf('0x45'),_0x3de36f[_0x52bf('0x24')]),_0x142021);}});ami['on'](_0x52bf('0x46'),function(_0x17a012){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x47'),_0x17a012['uniqueid']),_0x17a012);dials[_0x52bf('0x46')](_0x17a012);}catch(_0x5b9da9){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')](_0x52bf('0x48'),_0x17a012['uniqueid']),_0x5b9da9);}});ami['on'](_0x52bf('0x49'),function(_0x2a91af){try{utils[_0x52bf('0x26')](util['format']('[%s][index][dialend]',_0x2a91af[_0x52bf('0x24')]),_0x2a91af);dials[_0x52bf('0x49')](_0x2a91af);}catch(_0x4497ac){utils[_0x52bf('0x1b')](util['format'](_0x52bf('0x4a'),_0x2a91af[_0x52bf('0x24')]),_0x4497ac);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 5088c7b..987aeb3 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 _0x403a=['voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data1','source','destination','destinationchannel','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','Local/_attended@transfer','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','error','[%s][members][writeDB]','some','startsWith','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY'];(function(_0x1c8209,_0x4abf10){var _0x38466e=function(_0x18e324){while(--_0x18e324){_0x1c8209['push'](_0x1c8209['shift']());}};_0x38466e(++_0x4abf10);}(_0x403a,0x19e));var _0xa403=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x403a[_0x4dcc2d];return _0x1bbd79;};'use strict';var _=require(_0xa403('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=[_0xa403('0x1'),'Queue:'];function writeDB(_0xc75afa){utils['info'](util[_0xa403('0x2')](_0xa403('0x3'),_0xc75afa[_0xa403('0x4')],_0xc75afa[_0xa403('0x5')],_0xc75afa[_0xa403('0x6')],_0xc75afa[_0xa403('0x7')],_0xc75afa[_0xa403('0x8')],_0xc75afa[_0xa403('0x9')]));if(_0xc75afa[_0xa403('0x5')]){utils[_0xa403('0xa')](_0xc75afa[_0xa403('0x5')])['then'](function(_0x16768e){if(_0x16768e){_0xc75afa[_0xa403('0x8')]=_0x16768e[_0xa403('0xb')];_0xc75afa[_0xa403('0xc')]=_0x16768e[_0xa403('0xc')];utils[_0xa403('0xd')](_0xa403('0xe'),_0xc75afa);}else{utils[_0xa403('0xf')](_0xc75afa[_0xa403('0x5')][_0xa403('0x10')]('/')[0x1])['then'](function(_0x512435){if(_0x512435){_0xc75afa[_0xa403('0x8')]=_0x512435[_0xa403('0xb')];_0xc75afa['internal']=_0x512435[_0xa403('0xc')];utils[_0xa403('0xd')](_0xa403('0xe'),_0xc75afa);}});}})['catch'](function(_0x2f485e){utils[_0xa403('0x11')](util[_0xa403('0x2')](_0xa403('0x12'),_0xc75afa[_0xa403('0x4')]),_0x2f485e);});}delete members[_0xc75afa['interface']];}function startsWith(_0x1fdc33,_0x40958c){return _[_0xa403('0x13')](_0x1fdc33,function(_0x3516ac){return _[_0xa403('0x14')](_0x40958c,_0x3516ac);});}exports['devicestatechange']=function(_0x329b0a){try{utils[_0xa403('0x15')](util[_0xa403('0x2')]('[%s][members][devicestatechange]',members[_0x329b0a[_0xa403('0x16')]]?members[_0x329b0a[_0xa403('0x16')]][_0xa403('0x4')]:_0x329b0a[_0xa403('0x16')]),_0x329b0a);utils['info'](util['format'](_0xa403('0x17'),members[_0x329b0a[_0xa403('0x16')]]?members[_0x329b0a[_0xa403('0x16')]][_0xa403('0x4')]:_0x329b0a[_0xa403('0x16')],_0x329b0a[_0xa403('0x18')],_0x329b0a[_0xa403('0x16')]));switch(_0x329b0a[_0xa403('0x18')]){case _0xa403('0x19'):case _0xa403('0x1a'):if(!startsWith(exclude,_0x329b0a[_0xa403('0x16')])){members[_0x329b0a[_0xa403('0x16')]]={'channel':_0xa403('0x1b'),'interface':_0x329b0a['device'],'type':_0xa403('0x1c'),'enterAt':utils[_0xa403('0x1d')](),'role':_0xa403('0x1e')};}break;case _0xa403('0x1f'):if(!_[_0xa403('0x20')](members[_0x329b0a[_0xa403('0x16')]])){members[_0x329b0a[_0xa403('0x16')]][_0xa403('0x21')]=utils['now']();members[_0x329b0a[_0xa403('0x16')]][_0xa403('0x22')]=utils['diffTime'](members[_0x329b0a['device']][_0xa403('0x21')],members[_0x329b0a['device']]['enterAt']);if(members[_0x329b0a[_0xa403('0x16')]][_0xa403('0x4')]){writeDB(members[_0x329b0a[_0xa403('0x16')]]);}}break;default:break;}}catch(_0x1fbd9c){utils[_0xa403('0x11')](util[_0xa403('0x2')](_0xa403('0x23'),members[_0x329b0a['device']]?members[_0x329b0a[_0xa403('0x16')]][_0xa403('0x4')]:_0x329b0a[_0xa403('0x16')]),_0x1fbd9c);}};exports[_0xa403('0x24')]=function(_0xeff335){try{if(!_['isNil'](members[_0xeff335[_0xa403('0x5')]])){utils[_0xa403('0x15')](util['format'](_0xa403('0x25'),_0xeff335[_0xa403('0x4')]),_0xeff335);utils[_0xa403('0x26')](util['format'](_0xa403('0x27'),_0xeff335[_0xa403('0x4')],_0xeff335[_0xa403('0x5')],_0xeff335[_0xa403('0x28')]));members[_0xeff335[_0xa403('0x5')]]=_[_0xa403('0x29')](members[_0xeff335[_0xa403('0x5')]],{'data4':_0xeff335['queue'],'uniqueid':_0xeff335['uniqueid']});}}catch(_0x50d8b0){utils[_0xa403('0x11')](util[_0xa403('0x2')](_0xa403('0x25'),_0xeff335[_0xa403('0x4')]),_0x50d8b0);}};exports['cdr']=function(_0x4582e6){try{utils[_0xa403('0x15')](util[_0xa403('0x2')](_0xa403('0x2a'),_0x4582e6['uniqueid']),_0x4582e6);if(_0x4582e6[_0xa403('0x6')]){var _0x26f173=_0x4582e6[_0xa403('0x6')][_0xa403('0x10')]('-')[0x0];if(!_[_0xa403('0x20')](members[_0x26f173])){members[_0x26f173]=_['assign'](members[_0x26f173],{'data1':members[_0x26f173][_0xa403('0x2b')]||_0x4582e6[_0xa403('0x9')],'data2':members[_0x26f173][_0xa403('0x7')]||_0x4582e6[_0xa403('0x2c')],'data3':members[_0x26f173]['data3']||_0x4582e6[_0xa403('0x2d')],'uniqueid':members[_0x26f173]['uniqueid']||_0x4582e6[_0xa403('0x4')]});utils[_0xa403('0x26')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x4582e6[_0xa403('0x4')],members[_0x26f173][_0xa403('0x2b')],members[_0x26f173][_0xa403('0x7')],members[_0x26f173]['data3']));if(members[_0x26f173][_0xa403('0x21')]){writeDB(members[_0x26f173]);}}}if(_0x4582e6['destinationchannel']){var _0x4dba29=_0x4582e6[_0xa403('0x2e')]['split']('-')[0x0];if(!_[_0xa403('0x20')](members[_0x4dba29])){members[_0x4dba29]=_[_0xa403('0x29')](members[_0x4dba29],{'data1':members[_0x4dba29][_0xa403('0x2b')]||_0x4582e6[_0xa403('0x9')],'data2':members[_0x4dba29][_0xa403('0x7')]||_0x4582e6['source'],'data3':members[_0x4dba29][_0xa403('0x2f')]||_0x4582e6[_0xa403('0x2d')],'uniqueid':members[_0x4dba29]['uniqueid']||_0x4582e6[_0xa403('0x4')]});utils[_0xa403('0x26')](util[_0xa403('0x2')](_0xa403('0x30'),_0x4582e6[_0xa403('0x4')],members[_0x4dba29][_0xa403('0x2b')],members[_0x4dba29][_0xa403('0x7')],members[_0x4dba29][_0xa403('0x2f')]));if(members[_0x4dba29][_0xa403('0x21')]){writeDB(members[_0x4dba29]);}}}}catch(_0xead406){utils[_0xa403('0x11')](util[_0xa403('0x2')](_0xa403('0x2a'),_0x4582e6[_0xa403('0x4')]),_0xead406);}}; \ No newline at end of file +var _0x5d3c=['state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','duration','diffTime','exitAt','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1','type','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','assign','source','lodash','util','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','getUserByInterface','membername','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s'];(function(_0xf10e79,_0x1bec0f){var _0x22a96e=function(_0x4092bc){while(--_0x4092bc){_0xf10e79['push'](_0xf10e79['shift']());}};_0x22a96e(++_0x1bec0f);}(_0x5d3c,0x159));var _0xc5d3=function(_0x370b3c,_0x458113){_0x370b3c=_0x370b3c-0x0;var _0x2d05ea=_0x5d3c[_0x370b3c];return _0x2d05ea;};'use strict';var _=require(_0xc5d3('0x0'));var util=require(_0xc5d3('0x1'));var utils=require(_0xc5d3('0x2'));var members={};var exclude=['Local/_attended@transfer',_0xc5d3('0x3')];function writeDB(_0x5db8dd){utils[_0xc5d3('0x4')](util[_0xc5d3('0x5')](_0xc5d3('0x6'),_0x5db8dd[_0xc5d3('0x7')],_0x5db8dd[_0xc5d3('0x8')],_0x5db8dd[_0xc5d3('0x9')],_0x5db8dd[_0xc5d3('0xa')],_0x5db8dd['membername'],_0x5db8dd['type']));if(_0x5db8dd[_0xc5d3('0x8')]){utils[_0xc5d3('0xb')](_0x5db8dd['interface'])['then'](function(_0x461460){if(_0x461460){_0x5db8dd[_0xc5d3('0xc')]=_0x461460[_0xc5d3('0xd')];_0x5db8dd[_0xc5d3('0xe')]=_0x461460['internal'];utils[_0xc5d3('0xf')](_0xc5d3('0x10'),_0x5db8dd);}else{utils[_0xc5d3('0x11')](_0x5db8dd['interface'][_0xc5d3('0x12')]('/')[0x1])['then'](function(_0x5a8e74){if(_0x5a8e74){_0x5db8dd[_0xc5d3('0xc')]=_0x5a8e74[_0xc5d3('0xd')];_0x5db8dd[_0xc5d3('0xe')]=_0x5a8e74['internal'];utils['request']('CreateMemberReport',_0x5db8dd);}});}})[_0xc5d3('0x13')](function(_0x4ecc59){utils[_0xc5d3('0x14')](util[_0xc5d3('0x5')](_0xc5d3('0x15'),_0x5db8dd[_0xc5d3('0x7')]),_0x4ecc59);});}delete members[_0x5db8dd[_0xc5d3('0x8')]];}function startsWith(_0x415b82,_0x53d00d){return _[_0xc5d3('0x16')](_0x415b82,function(_0x3b5adf){return _['startsWith'](_0x53d00d,_0x3b5adf);});}exports['devicestatechange']=function(_0x4d235b){try{utils[_0xc5d3('0x17')](util['format']('[%s][members][devicestatechange]',members[_0x4d235b['device']]?members[_0x4d235b['device']][_0xc5d3('0x7')]:_0x4d235b[_0xc5d3('0x18')]),_0x4d235b);utils['info'](util[_0xc5d3('0x5')](_0xc5d3('0x19'),members[_0x4d235b[_0xc5d3('0x18')]]?members[_0x4d235b[_0xc5d3('0x18')]][_0xc5d3('0x7')]:_0x4d235b[_0xc5d3('0x18')],_0x4d235b['state'],_0x4d235b[_0xc5d3('0x18')]));switch(_0x4d235b[_0xc5d3('0x1a')]){case _0xc5d3('0x1b'):case _0xc5d3('0x1c'):if(!startsWith(exclude,_0x4d235b['device'])){members[_0x4d235b[_0xc5d3('0x18')]]={'channel':_0xc5d3('0x1d'),'interface':_0x4d235b['device'],'type':_0xc5d3('0x1e'),'enterAt':utils[_0xc5d3('0x1f')](),'role':_0xc5d3('0x20')};}break;case _0xc5d3('0x21'):if(!_['isNil'](members[_0x4d235b['device']])){members[_0x4d235b[_0xc5d3('0x18')]]['exitAt']=utils[_0xc5d3('0x1f')]();members[_0x4d235b[_0xc5d3('0x18')]][_0xc5d3('0x22')]=utils[_0xc5d3('0x23')](members[_0x4d235b['device']][_0xc5d3('0x24')],members[_0x4d235b['device']][_0xc5d3('0x25')]);if(members[_0x4d235b[_0xc5d3('0x18')]][_0xc5d3('0x7')]){writeDB(members[_0x4d235b[_0xc5d3('0x18')]]);}}break;default:break;}}catch(_0x282e5b){utils[_0xc5d3('0x14')](util[_0xc5d3('0x5')]('[%s][members][devicestatechange]',members[_0x4d235b[_0xc5d3('0x18')]]?members[_0x4d235b[_0xc5d3('0x18')]]['uniqueid']:_0x4d235b['device']),_0x282e5b);}};exports[_0xc5d3('0x26')]=function(_0x236f8c){try{if(!_[_0xc5d3('0x27')](members[_0x236f8c[_0xc5d3('0x8')]])){utils[_0xc5d3('0x17')](util[_0xc5d3('0x5')]('[%s][members][agentcomplete]',_0x236f8c[_0xc5d3('0x7')]),_0x236f8c);utils[_0xc5d3('0x4')](util[_0xc5d3('0x5')](_0xc5d3('0x28'),_0x236f8c[_0xc5d3('0x7')],_0x236f8c[_0xc5d3('0x8')],_0x236f8c['queue']));members[_0x236f8c[_0xc5d3('0x8')]]=_['assign'](members[_0x236f8c[_0xc5d3('0x8')]],{'data4':_0x236f8c[_0xc5d3('0x29')],'uniqueid':_0x236f8c['uniqueid']});}}catch(_0xcee55c){utils[_0xc5d3('0x14')](util[_0xc5d3('0x5')](_0xc5d3('0x2a'),_0x236f8c[_0xc5d3('0x7')]),_0xcee55c);}};exports[_0xc5d3('0x2b')]=function(_0x8de569){try{utils[_0xc5d3('0x17')](util[_0xc5d3('0x5')](_0xc5d3('0x2c'),_0x8de569[_0xc5d3('0x7')]),_0x8de569);if(_0x8de569[_0xc5d3('0x9')]){var _0x2be084=_0x8de569[_0xc5d3('0x9')][_0xc5d3('0x12')]('-')[0x0];if(!_[_0xc5d3('0x27')](members[_0x2be084])){members[_0x2be084]=_['assign'](members[_0x2be084],{'data1':members[_0x2be084][_0xc5d3('0x2d')]||_0x8de569[_0xc5d3('0x2e')],'data2':members[_0x2be084][_0xc5d3('0xa')]||_0x8de569['source'],'data3':members[_0x2be084][_0xc5d3('0x2f')]||_0x8de569[_0xc5d3('0x30')],'uniqueid':members[_0x2be084][_0xc5d3('0x7')]||_0x8de569[_0xc5d3('0x7')]});utils[_0xc5d3('0x4')](util[_0xc5d3('0x5')](_0xc5d3('0x31'),_0x8de569['uniqueid'],members[_0x2be084][_0xc5d3('0x2d')],members[_0x2be084]['data2'],members[_0x2be084][_0xc5d3('0x2f')]));if(members[_0x2be084][_0xc5d3('0x24')]){writeDB(members[_0x2be084]);}}}if(_0x8de569[_0xc5d3('0x32')]){var _0x50a494=_0x8de569[_0xc5d3('0x32')][_0xc5d3('0x12')]('-')[0x0];if(!_[_0xc5d3('0x27')](members[_0x50a494])){members[_0x50a494]=_[_0xc5d3('0x33')](members[_0x50a494],{'data1':members[_0x50a494]['data1']||_0x8de569['type'],'data2':members[_0x50a494]['data2']||_0x8de569[_0xc5d3('0x34')],'data3':members[_0x50a494]['data3']||_0x8de569[_0xc5d3('0x30')],'uniqueid':members[_0x50a494][_0xc5d3('0x7')]||_0x8de569[_0xc5d3('0x7')]});utils[_0xc5d3('0x4')](util[_0xc5d3('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x8de569[_0xc5d3('0x7')],members[_0x50a494][_0xc5d3('0x2d')],members[_0x50a494]['data2'],members[_0x50a494][_0xc5d3('0x2f')]));if(members[_0x50a494][_0xc5d3('0x24')]){writeDB(members[_0x50a494]);}}}}catch(_0x3ade43){utils[_0xc5d3('0x14')](util[_0xc5d3('0x5')](_0xc5d3('0x2c'),_0x8de569[_0xc5d3('0x7')]),_0x3ade43);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 41c3df8..6395cfe 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 _0x8f02=['ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','diffTime','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','variable','queueposition','EXITWITHKEY','error','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','blindtransfer','transfereeuniqueid','transfertype','transferexten','extension','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten'];(function(_0xeb80e,_0x337608){var _0x68e9d7=function(_0x50c896){while(--_0x50c896){_0xeb80e['push'](_0xeb80e['shift']());}};_0x68e9d7(++_0x337608);}(_0x8f02,0xdd));var _0x28f0=function(_0x34f600,_0x1a7bc9){_0x34f600=_0x34f600-0x0;var _0x3a9123=_0x8f02[_0x34f600];return _0x3a9123;};'use strict';var _=require(_0x28f0('0x0'));var util=require(_0x28f0('0x1'));var utils=require(_0x28f0('0x2'));var queues={};function writeDB(_0x2c6596){utils[_0x28f0('0x3')](util[_0x28f0('0x4')](_0x28f0('0x5'),_0x2c6596[_0x28f0('0x6')],_0x2c6596[_0x28f0('0x7')],_0x2c6596[_0x28f0('0x8')],_0x2c6596[_0x28f0('0x9')],_0x2c6596[_0x28f0('0xa')],_0x2c6596[_0x28f0('0xb')],_0x2c6596['queuecallerexitreason']));if(_0x2c6596[_0x28f0('0x8')]){utils['getVoiceQueueByName'](_0x2c6596[_0x28f0('0x8')])[_0x28f0('0xc')](function(_0x14bcc2){if(_0x14bcc2){_0x2c6596[_0x28f0('0xd')]=_0x14bcc2[_0x28f0('0xd')];}utils[_0x28f0('0xe')](_0x28f0('0xf'),_0x2c6596);});}else{utils[_0x28f0('0xe')]('CreateVoiceQueueReport',_0x2c6596);}if(_0x2c6596['transfereduniqueid']){delete queues[_0x2c6596[_0x28f0('0x10')]];}else{delete queues[_0x2c6596[_0x28f0('0x6')]];}}exports[_0x28f0('0x11')]=function(_0x230b57){try{utils[_0x28f0('0x12')](util[_0x28f0('0x4')]('[%s][queues][queuecallerjoin]',_0x230b57['uniqueid']),_0x230b57);utils[_0x28f0('0x3')](util[_0x28f0('0x4')](_0x28f0('0x13'),_0x230b57['uniqueid'],_0x230b57[_0x28f0('0x8')],_0x230b57[_0x28f0('0x14')]));queues[_0x230b57[_0x28f0('0x6')]]=_['assign'](_0x230b57,{'originalposition':_0x230b57['position'],'queuecallerjoinAt':utils[_0x28f0('0x15')](),'mohtime':0x0});}catch(_0x3d0537){utils['error'](util[_0x28f0('0x4')]('[%s][queues][queuecallerjoin]',_0x230b57[_0x28f0('0x6')]),_0x3d0537);}};exports[_0x28f0('0x16')]=function(_0x20e693){try{if(!_[_0x28f0('0x17')](queues[_0x20e693[_0x28f0('0x6')]])){utils['debug'](util['format']('[%s][queues][hangup]',_0x20e693['uniqueid']),_0x20e693);if(queues[_0x20e693[_0x28f0('0x6')]][_0x28f0('0x18')]){if(!queues[_0x20e693['uniqueid']][_0x28f0('0x19')]&&!queues[_0x20e693['uniqueid']][_0x28f0('0x1a')]){queues[_0x20e693[_0x28f0('0x6')]][_0x28f0('0x1b')]=!![];queues[_0x20e693[_0x28f0('0x6')]][_0x28f0('0x1c')]=utils[_0x28f0('0x15')]();queues[_0x20e693[_0x28f0('0x6')]][_0x28f0('0x1d')]=_0x28f0('0x1e');}utils[_0x28f0('0x3')](util['format'](_0x28f0('0x1f'),_0x20e693['uniqueid'],queues[_0x20e693[_0x28f0('0x6')]]['name'],queues[_0x20e693[_0x28f0('0x6')]][_0x28f0('0x1d')]));writeDB(queues[_0x20e693[_0x28f0('0x6')]]);}else if(queues[_0x20e693[_0x28f0('0x6')]][_0x28f0('0x10')]){utils['info'](util[_0x28f0('0x4')](_0x28f0('0x20'),_0x20e693[_0x28f0('0x6')],queues[_0x20e693[_0x28f0('0x6')]][_0x28f0('0x21')],queues[_0x20e693[_0x28f0('0x6')]][_0x28f0('0x10')]));queues[queues[_0x20e693[_0x28f0('0x6')]][_0x28f0('0x10')]]=queues[_0x20e693[_0x28f0('0x6')]];queues[queues[_0x20e693[_0x28f0('0x6')]]['transfereduniqueid']][_0x28f0('0x22')]=0x2;delete queues[_0x20e693[_0x28f0('0x6')]];}}}catch(_0x20ae03){utils['error'](util['format']('[%s][queues][hangup]',_0x20e693[_0x28f0('0x6')]),_0x20ae03);}};exports[_0x28f0('0x23')]=function(_0x4448e0){try{utils[_0x28f0('0x12')](util[_0x28f0('0x4')](_0x28f0('0x24'),_0x4448e0[_0x28f0('0x6')]),_0x4448e0);if(!_[_0x28f0('0x17')](_0x4448e0['variable'][_0x28f0('0x25')])&&_0x4448e0[_0x28f0('0x26')][_0x28f0('0x27')]()!==_0x28f0('0x28')){if(!_[_0x28f0('0x17')](queues[_0x4448e0[_0x28f0('0x6')]])){queues[_0x4448e0[_0x28f0('0x6')]][_0x28f0('0x19')]=![];queues[_0x4448e0[_0x28f0('0x6')]][_0x28f0('0x29')]=null;queues[_0x4448e0[_0x28f0('0x6')]][_0x28f0('0x1a')]=!![];queues[_0x4448e0[_0x28f0('0x6')]][_0x28f0('0x2a')]=utils[_0x28f0('0x15')]();queues[_0x4448e0[_0x28f0('0x6')]]['queuecallerexitreason']=_0x4448e0['value'][_0x28f0('0x27')]();utils[_0x28f0('0x3')](util[_0x28f0('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x4448e0[_0x28f0('0x6')],queues[_0x4448e0[_0x28f0('0x6')]][_0x28f0('0x21')],_0x4448e0['value'],queues[_0x4448e0[_0x28f0('0x6')]][_0x28f0('0x1d')]));writeDB(queues[_0x4448e0[_0x28f0('0x6')]]);}}else if(!_[_0x28f0('0x17')](_0x4448e0[_0x28f0('0x2b')][_0x28f0('0x2c')])){if(!_[_0x28f0('0x17')](queues[_0x4448e0[_0x28f0('0x6')]])&&!queues[_0x4448e0[_0x28f0('0x6')]]['queuecallerabandon']){queues[_0x4448e0[_0x28f0('0x6')]]['queuecallerabandon']=![];queues[_0x4448e0[_0x28f0('0x6')]][_0x28f0('0x29')]=null;queues[_0x4448e0[_0x28f0('0x6')]]['queuecallerexit']=!![];queues[_0x4448e0[_0x28f0('0x6')]]['queuecallerexitAt']=utils[_0x28f0('0x15')]();queues[_0x4448e0[_0x28f0('0x6')]]['queuecallerexitreason']=_0x28f0('0x2d');utils['info'](util[_0x28f0('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4448e0[_0x28f0('0x6')],queues[_0x4448e0['uniqueid']]['name'],_0x4448e0[_0x28f0('0x26')],queues[_0x4448e0[_0x28f0('0x6')]][_0x28f0('0x1d')]));}}}catch(_0x46e768){utils[_0x28f0('0x2e')](util['format'](_0x28f0('0x24'),_0x4448e0[_0x28f0('0x6')]),_0x46e768);}};exports[_0x28f0('0x19')]=function(_0xd0625c){try{if(!_[_0x28f0('0x17')](queues[_0xd0625c['uniqueid']])){utils[_0x28f0('0x12')](util[_0x28f0('0x4')](_0x28f0('0x2f'),_0xd0625c[_0x28f0('0x6')]),_0xd0625c);queues[_0xd0625c[_0x28f0('0x6')]][_0x28f0('0x1a')]=![];queues[_0xd0625c[_0x28f0('0x6')]]['queuecallerexitAt']=null;queues[_0xd0625c['uniqueid']]['queuecallerabandon']=!![];queues[_0xd0625c[_0x28f0('0x6')]][_0x28f0('0x29')]=utils[_0x28f0('0x15')]();queues[_0xd0625c[_0x28f0('0x6')]][_0x28f0('0x1d')]=_0x28f0('0x30');utils['info'](util['format'](_0x28f0('0x31'),_0xd0625c[_0x28f0('0x6')],queues[_0xd0625c[_0x28f0('0x6')]][_0x28f0('0x21')],queues[_0xd0625c[_0x28f0('0x6')]][_0x28f0('0x1d')]));}}catch(_0x255a96){utils['error'](util[_0x28f0('0x4')](_0x28f0('0x2f'),_0xd0625c['uniqueid']),_0x255a96);}};exports[_0x28f0('0x32')]=function(_0x18047f){try{if(!_['isNil'](queues[_0x18047f[_0x28f0('0x6')]])){utils[_0x28f0('0x12')](util[_0x28f0('0x4')](_0x28f0('0x33'),_0x18047f['uniqueid']),_0x18047f);utils[_0x28f0('0x3')](util[_0x28f0('0x4')](_0x28f0('0x34'),_0x18047f[_0x28f0('0x6')],queues[_0x18047f[_0x28f0('0x6')]][_0x28f0('0x21')],_0x18047f[_0x28f0('0x35')],_0x18047f[_0x28f0('0x36')]));queues[_0x18047f[_0x28f0('0x6')]][_0x28f0('0x32')]=!![];queues[_0x18047f['uniqueid']]['queuecallerleaveAt']=utils[_0x28f0('0x15')]();queues[_0x18047f[_0x28f0('0x6')]][_0x28f0('0x37')]=utils['diffTime'](queues[_0x18047f['uniqueid']][_0x28f0('0x18')],queues[_0x18047f[_0x28f0('0x6')]][_0x28f0('0x38')]);queues[_0x18047f[_0x28f0('0x6')]][_0x28f0('0x14')]=_0x18047f[_0x28f0('0x14')];queues[_0x18047f[_0x28f0('0x6')]][_0x28f0('0x39')]=_0x18047f[_0x28f0('0x39')];queues[_0x18047f[_0x28f0('0x6')]][_0x28f0('0x35')]=_0x18047f[_0x28f0('0x35')];queues[_0x18047f[_0x28f0('0x6')]]['connectedlinename']=_0x18047f[_0x28f0('0x36')];}}catch(_0x1323c9){utils['error'](util[_0x28f0('0x4')]('[%s][queues][queuecallerleave]',_0x18047f[_0x28f0('0x6')]),_0x1323c9);}};exports['agentconnect']=function(_0x3b2d08){try{if(!_[_0x28f0('0x17')](queues[_0x3b2d08['uniqueid']])){utils[_0x28f0('0x12')](util[_0x28f0('0x4')](_0x28f0('0x3a'),_0x3b2d08[_0x28f0('0x6')]),_0x3b2d08);utils[_0x28f0('0x3')](util[_0x28f0('0x4')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x3b2d08['uniqueid'],queues[_0x3b2d08[_0x28f0('0x6')]][_0x28f0('0x21')],_0x3b2d08[_0x28f0('0x3b')],_0x3b2d08[_0x28f0('0x3c')]));queues[_0x3b2d08[_0x28f0('0x6')]]['queuecallerabandon']=![];queues[_0x3b2d08['uniqueid']]['queuecallerabandon']=![];queues[_0x3b2d08[_0x28f0('0x6')]][_0x28f0('0x29')]=null;queues[_0x3b2d08['uniqueid']][_0x28f0('0x1a')]=![];queues[_0x3b2d08[_0x28f0('0x6')]]['queuecallerexitreason']=null;queues[_0x3b2d08[_0x28f0('0x6')]][_0x28f0('0x2a')]=null;queues[_0x3b2d08[_0x28f0('0x6')]][_0x28f0('0x3d')]=!![];queues[_0x3b2d08[_0x28f0('0x6')]][_0x28f0('0xb')]=_0x3b2d08[_0x28f0('0x3c')];queues[_0x3b2d08[_0x28f0('0x6')]]['lastAssignedTo']=_0x3b2d08[_0x28f0('0x3b')];}}catch(_0x59b8e9){utils[_0x28f0('0x2e')](util[_0x28f0('0x4')](_0x28f0('0x3a'),_0x3b2d08[_0x28f0('0x6')]),_0x59b8e9);}};exports[_0x28f0('0x3e')]=function(_0x48afea){try{if(!_[_0x28f0('0x17')](queues[_0x48afea['uniqueid']])){if(queues[_0x48afea[_0x28f0('0x6')]][_0x28f0('0x18')]){utils[_0x28f0('0x12')](util['format'](_0x28f0('0x3f'),_0x48afea['uniqueid']),_0x48afea);queues[_0x48afea['uniqueid']][_0x28f0('0x19')]=![];queues[_0x48afea[_0x28f0('0x6')]][_0x28f0('0x19')]=![];queues[_0x48afea[_0x28f0('0x6')]][_0x28f0('0x29')]=null;queues[_0x48afea['uniqueid']][_0x28f0('0x1a')]=![];queues[_0x48afea['uniqueid']][_0x28f0('0x2a')]=null;queues[_0x48afea[_0x28f0('0x6')]]['assigned']=!![];queues[_0x48afea[_0x28f0('0x6')]][_0x28f0('0x9')]=_0x48afea['membername'];queues[_0x48afea[_0x28f0('0x6')]]['queuecallercomplete']=!![];queues[_0x48afea['uniqueid']]['queuecallercompleteAt']=utils['now']();if(_0x48afea['reason']=='transfer'){if(!queues[_0x48afea[_0x28f0('0x6')]][_0x28f0('0x40')]){queues[_0x48afea[_0x28f0('0x6')]]['queuecallerexitreason']=_0x28f0('0x41');}}else{queues[_0x48afea[_0x28f0('0x6')]][_0x28f0('0x1d')]='COMPLETEDBY'+_0x48afea['reason'][_0x28f0('0x27')]();}utils[_0x28f0('0x3')](util[_0x28f0('0x4')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x48afea[_0x28f0('0x6')],queues[_0x48afea[_0x28f0('0x6')]][_0x28f0('0x21')],_0x48afea[_0x28f0('0x3b')],queues[_0x48afea[_0x28f0('0x6')]][_0x28f0('0x1d')]));writeDB(queues[_0x48afea[_0x28f0('0x6')]]);}}}catch(_0x5cfd54){utils['error'](util[_0x28f0('0x4')](_0x28f0('0x3f'),_0x48afea[_0x28f0('0x6')]),_0x5cfd54);}};exports[_0x28f0('0x42')]=function(_0x5bce82){try{if(!_[_0x28f0('0x17')](queues[_0x5bce82[_0x28f0('0x43')]])){utils[_0x28f0('0x12')](util[_0x28f0('0x4')]('[%s][queues][blindtransfer]',_0x5bce82[_0x28f0('0x6')]),_0x5bce82);queues[_0x5bce82[_0x28f0('0x43')]][_0x28f0('0x40')]=!![];queues[_0x5bce82[_0x28f0('0x43')]][_0x28f0('0x44')]='BLIND';queues[_0x5bce82['transfereeuniqueid']][_0x28f0('0x45')]=_0x5bce82[_0x28f0('0x46')];queues[_0x5bce82['transfereeuniqueid']]['transferuniqueid']=_0x5bce82['transfereeuniqueid'];queues[_0x5bce82[_0x28f0('0x43')]][_0x28f0('0x1d')]=_0x28f0('0x47');utils[_0x28f0('0x3')](util[_0x28f0('0x4')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x5bce82[_0x28f0('0x6')],queues[_0x5bce82[_0x28f0('0x43')]][_0x28f0('0x21')],_0x5bce82['transfereeuniqueid'],_0x5bce82[_0x28f0('0x46')]));}}catch(_0xce24dd){utils[_0x28f0('0x2e')](util['format']('[%s][queues][blindtransfer]',_0x5bce82[_0x28f0('0x6')]),_0xce24dd);}};exports[_0x28f0('0x48')]=function(_0x13d23d){try{utils['debug'](util[_0x28f0('0x4')](_0x28f0('0x49'),_0x13d23d[_0x28f0('0x4a')]),_0x13d23d);if(_0x13d23d[_0x28f0('0x4a')]==_0x13d23d[_0x28f0('0x4b')]){if(!_[_0x28f0('0x17')](queues[_0x13d23d[_0x28f0('0x4c')]])){utils[_0x28f0('0x3')](util[_0x28f0('0x4')](_0x28f0('0x4d'),_0x13d23d[_0x28f0('0x4a')],queues[_0x13d23d[_0x28f0('0x4c')]][_0x28f0('0x21')],_0x13d23d[_0x28f0('0x4e')]));queues[_0x13d23d[_0x28f0('0x4c')]]['transfer']=!![];queues[_0x13d23d[_0x28f0('0x4c')]][_0x28f0('0x44')]=_0x28f0('0x4f');queues[_0x13d23d[_0x28f0('0x4c')]]['transferexten']=_0x13d23d['origtransfererexten'];queues[_0x13d23d['secondtransfererlinkedid']][_0x28f0('0x50')]=_0x13d23d[_0x28f0('0x4a')];queues[_0x13d23d['secondtransfererlinkedid']][_0x28f0('0x1d')]=_0x28f0('0x51');}if(!_[_0x28f0('0x17')](queues[_0x13d23d[_0x28f0('0x4b')]])){if(_0x13d23d['transfereelinkedid']&&queues[_0x13d23d[_0x28f0('0x52')]]){queues[_0x13d23d['transfereelinkedid']][_0x28f0('0x22')]=0x1;queues[_0x13d23d[_0x28f0('0x43')]]=_[_0x28f0('0x53')](queues[_0x13d23d[_0x28f0('0x52')]]);queues[_0x13d23d[_0x28f0('0x43')]][_0x28f0('0x10')]=_0x13d23d[_0x28f0('0x54')];queues[_0x13d23d[_0x28f0('0x43')]][_0x28f0('0x22')]=0x2;queues[_0x13d23d['transfereeuniqueid']][_0x28f0('0xa')]=queues[_0x13d23d['secondtransfererlinkedid']][_0x28f0('0xa')];queues[_0x13d23d['transfereeuniqueid']][_0x28f0('0x55')]=queues[_0x13d23d[_0x28f0('0x4c')]]['calleridname'];queues[_0x13d23d[_0x28f0('0x43')]][_0x28f0('0x38')]=utils[_0x28f0('0x15')]();queues[_0x13d23d[_0x28f0('0x43')]]['queuecallerleaveAt']=utils[_0x28f0('0x15')]();queues[_0x13d23d[_0x28f0('0x43')]][_0x28f0('0x37')]=0x0;queues[_0x13d23d['transfereeuniqueid']][_0x28f0('0x56')]=0x0;utils[_0x28f0('0x3')](util[_0x28f0('0x4')](_0x28f0('0x57'),_0x13d23d[_0x28f0('0x4a')],queues[_0x13d23d['transfereeuniqueid']]['name'],queues[_0x13d23d[_0x28f0('0x43')]][_0x28f0('0xa')],queues[_0x13d23d[_0x28f0('0x43')]]['calleridname']));}else{utils[_0x28f0('0x3')](util[_0x28f0('0x4')](_0x28f0('0x58'),_0x13d23d[_0x28f0('0x4a')],queues[_0x13d23d[_0x28f0('0x4b')]]['name'],_0x13d23d['secondtransfererlinkedid']));queues[_0x13d23d[_0x28f0('0x4b')]][_0x28f0('0x10')]=_0x13d23d[_0x28f0('0x4c')];}}}else if(_0x13d23d[_0x28f0('0x59')]==_0x13d23d['secondtransfererlinkedid']){if(!_[_0x28f0('0x17')](queues[_0x13d23d['origtransfererlinkedid']])){utils[_0x28f0('0x3')](util['format'](_0x28f0('0x5a'),_0x13d23d[_0x28f0('0x4a')],queues[_0x13d23d['origtransfererlinkedid']][_0x28f0('0x21')],_0x13d23d[_0x28f0('0x59')],_0x13d23d['secondtransfererexten']));queues[_0x13d23d['origtransfererlinkedid']]['transfer']=!![];queues[_0x13d23d[_0x28f0('0x4b')]][_0x28f0('0x44')]='ATTENDED';queues[_0x13d23d['origtransfererlinkedid']]['transferexten']=_0x13d23d[_0x28f0('0x5b')];queues[_0x13d23d[_0x28f0('0x4b')]][_0x28f0('0x50')]=_0x13d23d[_0x28f0('0x59')];queues[_0x13d23d['origtransfererlinkedid']][_0x28f0('0x1d')]=_0x28f0('0x51');}if(!_['isNil'](queues[_0x13d23d[_0x28f0('0x4c')]])){if(_0x13d23d[_0x28f0('0x5c')]&&queues[_0x13d23d[_0x28f0('0x5c')]]){queues[_0x13d23d[_0x28f0('0x5c')]]['queuecallerenterreason']=0x1;queues[_0x13d23d['transfertargetuniqueid']]=_[_0x28f0('0x53')](queues[_0x13d23d[_0x28f0('0x5c')]]);queues[_0x13d23d[_0x28f0('0x54')]]['transfereduniqueid']=_0x13d23d[_0x28f0('0x54')];queues[_0x13d23d[_0x28f0('0x54')]]['queuecallerenterreason']=0x2;queues[_0x13d23d[_0x28f0('0x54')]][_0x28f0('0xa')]=queues[_0x13d23d[_0x28f0('0x4b')]]['calleridnum'];queues[_0x13d23d[_0x28f0('0x54')]][_0x28f0('0x55')]=queues[_0x13d23d[_0x28f0('0x4b')]][_0x28f0('0x55')];queues[_0x13d23d[_0x28f0('0x54')]][_0x28f0('0x38')]=utils[_0x28f0('0x15')]();queues[_0x13d23d[_0x28f0('0x54')]]['queuecallerleaveAt']=utils['now']();queues[_0x13d23d['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x13d23d[_0x28f0('0x54')]][_0x28f0('0x56')]=0x0;utils[_0x28f0('0x3')](util[_0x28f0('0x4')](_0x28f0('0x5d'),_0x13d23d[_0x28f0('0x4a')],queues[_0x13d23d[_0x28f0('0x54')]][_0x28f0('0x21')],queues[_0x13d23d[_0x28f0('0x54')]]['transfereduniqueid'],queues[_0x13d23d[_0x28f0('0x54')]][_0x28f0('0xa')],queues[_0x13d23d['transfertargetuniqueid']][_0x28f0('0x55')]));}else{utils[_0x28f0('0x3')](util[_0x28f0('0x4')](_0x28f0('0x58'),_0x13d23d[_0x28f0('0x4a')],queues[_0x13d23d[_0x28f0('0x4c')]][_0x28f0('0x21')],_0x13d23d[_0x28f0('0x4b')]));queues[_0x13d23d[_0x28f0('0x4c')]][_0x28f0('0x10')]=_0x13d23d[_0x28f0('0x4b')];}}}}catch(_0x13b8a5){utils[_0x28f0('0x2e')](util[_0x28f0('0x4')](_0x28f0('0x49'),_0x13d23d[_0x28f0('0x4a')]),_0x13b8a5);}};exports[_0x28f0('0x5e')]=function(_0xc96492){try{if(!_[_0x28f0('0x17')](queues[_0xc96492[_0x28f0('0x6')]])){utils['debug'](util[_0x28f0('0x4')](_0x28f0('0x5f'),_0xc96492['uniqueid']),_0xc96492);queues[_0xc96492[_0x28f0('0x6')]][_0x28f0('0x60')]=utils[_0x28f0('0x15')]();utils[_0x28f0('0x3')](util[_0x28f0('0x4')](_0x28f0('0x61'),_0xc96492['uniqueid'],queues[_0xc96492[_0x28f0('0x6')]][_0x28f0('0x21')],queues[_0xc96492['uniqueid']][_0x28f0('0x60')]));}}catch(_0x310ee3){utils[_0x28f0('0x2e')](util[_0x28f0('0x4')](_0x28f0('0x5f'),_0xc96492[_0x28f0('0x6')]),_0x310ee3);}};exports['musiconholdstop']=function(_0x50ba69){try{if(!_[_0x28f0('0x17')](queues[_0x50ba69[_0x28f0('0x6')]])){if(!_[_0x28f0('0x17')](queues[_0x50ba69['uniqueid']][_0x28f0('0x60')])){utils['debug'](util[_0x28f0('0x4')]('[%s][queues][musiconholdstop]',_0x50ba69['uniqueid']),_0x50ba69);queues[_0x50ba69['uniqueid']][_0x28f0('0x56')]+=utils[_0x28f0('0x62')](utils[_0x28f0('0x15')](),queues[_0x50ba69['uniqueid']][_0x28f0('0x60')]);utils[_0x28f0('0x3')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x50ba69[_0x28f0('0x6')],queues[_0x50ba69['uniqueid']]['name'],queues[_0x50ba69[_0x28f0('0x6')]][_0x28f0('0x56')]));delete queues[_0x50ba69['uniqueid']][_0x28f0('0x60')];}}}catch(_0x53b40e){utils[_0x28f0('0x2e')](util[_0x28f0('0x4')](_0x28f0('0x63'),_0x50ba69[_0x28f0('0x6')]),_0x53b40e);}}; \ No newline at end of file +var _0x9263=['[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','isNil','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerabandon','EXITWITHKEY','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','transfer','TRANSFER','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','lastAssignedTo','calleridnum','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','format'];(function(_0x33b40c,_0x38e315){var _0x3fd36f=function(_0x10f41c){while(--_0x10f41c){_0x33b40c['push'](_0x33b40c['shift']());}};_0x3fd36f(++_0x38e315);}(_0x9263,0x12b));var _0x3926=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x9263[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0x3926('0x0'));var util=require(_0x3926('0x1'));var utils=require(_0x3926('0x2'));var queues={};function writeDB(_0xf87863){utils[_0x3926('0x3')](util['format'](_0x3926('0x4'),_0xf87863['uniqueid'],_0xf87863['channel'],_0xf87863['queue'],_0xf87863[_0x3926('0x5')],_0xf87863[_0x3926('0x6')],_0xf87863['accountcode'],_0xf87863[_0x3926('0x7')]));if(_0xf87863[_0x3926('0x8')]){utils[_0x3926('0x9')](_0xf87863[_0x3926('0x8')])[_0x3926('0xa')](function(_0x1f4410){if(_0x1f4410){_0xf87863[_0x3926('0xb')]=_0x1f4410[_0x3926('0xb')];}utils[_0x3926('0xc')](_0x3926('0xd'),_0xf87863);});}else{utils[_0x3926('0xc')](_0x3926('0xd'),_0xf87863);}if(_0xf87863[_0x3926('0xe')]){delete queues[_0xf87863['transfereduniqueid']];}else{delete queues[_0xf87863[_0x3926('0xf')]];}}exports[_0x3926('0x10')]=function(_0x347bee){try{utils[_0x3926('0x11')](util[_0x3926('0x12')](_0x3926('0x13'),_0x347bee[_0x3926('0xf')]),_0x347bee);utils[_0x3926('0x3')](util[_0x3926('0x12')](_0x3926('0x14'),_0x347bee['uniqueid'],_0x347bee[_0x3926('0x8')],_0x347bee[_0x3926('0x15')]));queues[_0x347bee[_0x3926('0xf')]]=_[_0x3926('0x16')](_0x347bee,{'originalposition':_0x347bee[_0x3926('0x15')],'queuecallerjoinAt':utils[_0x3926('0x17')](),'mohtime':0x0});}catch(_0x5ca407){utils[_0x3926('0x18')](util[_0x3926('0x12')](_0x3926('0x13'),_0x347bee['uniqueid']),_0x5ca407);}};exports[_0x3926('0x19')]=function(_0x8e3b50){try{if(!_['isNil'](queues[_0x8e3b50[_0x3926('0xf')]])){utils[_0x3926('0x11')](util[_0x3926('0x12')](_0x3926('0x1a'),_0x8e3b50[_0x3926('0xf')]),_0x8e3b50);if(queues[_0x8e3b50['uniqueid']][_0x3926('0x1b')]){if(!queues[_0x8e3b50[_0x3926('0xf')]]['queuecallerabandon']&&!queues[_0x8e3b50[_0x3926('0xf')]][_0x3926('0x1c')]){queues[_0x8e3b50['uniqueid']][_0x3926('0x1d')]=!![];queues[_0x8e3b50[_0x3926('0xf')]][_0x3926('0x1e')]=utils[_0x3926('0x17')]();queues[_0x8e3b50['uniqueid']]['queuecallerexitreason']=_0x3926('0x1f');}utils['info'](util[_0x3926('0x12')](_0x3926('0x20'),_0x8e3b50['uniqueid'],queues[_0x8e3b50[_0x3926('0xf')]][_0x3926('0x21')],queues[_0x8e3b50[_0x3926('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x8e3b50[_0x3926('0xf')]]);}else if(queues[_0x8e3b50['uniqueid']][_0x3926('0xe')]){utils[_0x3926('0x3')](util['format'](_0x3926('0x22'),_0x8e3b50[_0x3926('0xf')],queues[_0x8e3b50['uniqueid']][_0x3926('0x21')],queues[_0x8e3b50[_0x3926('0xf')]]['transfereduniqueid']));queues[queues[_0x8e3b50[_0x3926('0xf')]][_0x3926('0xe')]]=queues[_0x8e3b50['uniqueid']];queues[queues[_0x8e3b50[_0x3926('0xf')]][_0x3926('0xe')]][_0x3926('0x23')]=0x2;delete queues[_0x8e3b50[_0x3926('0xf')]];}}}catch(_0x433edc){utils[_0x3926('0x18')](util[_0x3926('0x12')](_0x3926('0x1a'),_0x8e3b50[_0x3926('0xf')]),_0x433edc);}};exports['varset']=function(_0x45065c){try{utils[_0x3926('0x11')](util[_0x3926('0x12')]('[%s][queues][varset]',_0x45065c[_0x3926('0xf')]),_0x45065c);if(!_[_0x3926('0x24')](_0x45065c[_0x3926('0x25')][_0x3926('0x26')])&&_0x45065c[_0x3926('0x27')]['toUpperCase']()!==_0x3926('0x28')){if(!_[_0x3926('0x24')](queues[_0x45065c[_0x3926('0xf')]])){queues[_0x45065c[_0x3926('0xf')]]['queuecallerabandon']=![];queues[_0x45065c['uniqueid']][_0x3926('0x29')]=null;queues[_0x45065c[_0x3926('0xf')]][_0x3926('0x1c')]=!![];queues[_0x45065c[_0x3926('0xf')]][_0x3926('0x2a')]=utils['now']();queues[_0x45065c[_0x3926('0xf')]][_0x3926('0x7')]=_0x45065c[_0x3926('0x27')][_0x3926('0x2b')]();utils[_0x3926('0x3')](util[_0x3926('0x12')](_0x3926('0x2c'),_0x45065c['uniqueid'],queues[_0x45065c[_0x3926('0xf')]][_0x3926('0x21')],_0x45065c[_0x3926('0x27')],queues[_0x45065c[_0x3926('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x45065c[_0x3926('0xf')]]);}}else if(!_[_0x3926('0x24')](_0x45065c[_0x3926('0x25')]['queueposition'])){if(!_[_0x3926('0x24')](queues[_0x45065c['uniqueid']])&&!queues[_0x45065c[_0x3926('0xf')]][_0x3926('0x2d')]){queues[_0x45065c[_0x3926('0xf')]][_0x3926('0x2d')]=![];queues[_0x45065c[_0x3926('0xf')]][_0x3926('0x29')]=null;queues[_0x45065c['uniqueid']][_0x3926('0x1c')]=!![];queues[_0x45065c[_0x3926('0xf')]][_0x3926('0x2a')]=utils[_0x3926('0x17')]();queues[_0x45065c[_0x3926('0xf')]]['queuecallerexitreason']=_0x3926('0x2e');utils['info'](util[_0x3926('0x12')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x45065c[_0x3926('0xf')],queues[_0x45065c['uniqueid']][_0x3926('0x21')],_0x45065c[_0x3926('0x27')],queues[_0x45065c['uniqueid']][_0x3926('0x7')]));}}}catch(_0x460775){utils[_0x3926('0x18')](util[_0x3926('0x12')](_0x3926('0x2f'),_0x45065c['uniqueid']),_0x460775);}};exports[_0x3926('0x2d')]=function(_0x496995){try{if(!_[_0x3926('0x24')](queues[_0x496995[_0x3926('0xf')]])){utils[_0x3926('0x11')](util[_0x3926('0x12')](_0x3926('0x30'),_0x496995[_0x3926('0xf')]),_0x496995);queues[_0x496995['uniqueid']][_0x3926('0x1c')]=![];queues[_0x496995[_0x3926('0xf')]][_0x3926('0x2a')]=null;queues[_0x496995['uniqueid']][_0x3926('0x2d')]=!![];queues[_0x496995[_0x3926('0xf')]][_0x3926('0x29')]=utils[_0x3926('0x17')]();queues[_0x496995[_0x3926('0xf')]][_0x3926('0x7')]=_0x3926('0x31');utils[_0x3926('0x3')](util['format'](_0x3926('0x32'),_0x496995[_0x3926('0xf')],queues[_0x496995[_0x3926('0xf')]][_0x3926('0x21')],queues[_0x496995[_0x3926('0xf')]][_0x3926('0x7')]));}}catch(_0x43e67f){utils[_0x3926('0x18')](util['format']('[%s][queues][queuecallerabandon]',_0x496995[_0x3926('0xf')]),_0x43e67f);}};exports[_0x3926('0x33')]=function(_0x5cd0ec){try{if(!_['isNil'](queues[_0x5cd0ec[_0x3926('0xf')]])){utils[_0x3926('0x11')](util['format'](_0x3926('0x34'),_0x5cd0ec[_0x3926('0xf')]),_0x5cd0ec);utils[_0x3926('0x3')](util[_0x3926('0x12')](_0x3926('0x35'),_0x5cd0ec[_0x3926('0xf')],queues[_0x5cd0ec[_0x3926('0xf')]][_0x3926('0x21')],_0x5cd0ec[_0x3926('0x36')],_0x5cd0ec[_0x3926('0x37')]));queues[_0x5cd0ec['uniqueid']][_0x3926('0x33')]=!![];queues[_0x5cd0ec[_0x3926('0xf')]][_0x3926('0x1b')]=utils[_0x3926('0x17')]();queues[_0x5cd0ec[_0x3926('0xf')]][_0x3926('0x38')]=utils[_0x3926('0x39')](queues[_0x5cd0ec[_0x3926('0xf')]][_0x3926('0x1b')],queues[_0x5cd0ec[_0x3926('0xf')]][_0x3926('0x3a')]);queues[_0x5cd0ec['uniqueid']][_0x3926('0x15')]=_0x5cd0ec[_0x3926('0x15')];queues[_0x5cd0ec[_0x3926('0xf')]][_0x3926('0x3b')]=_0x5cd0ec[_0x3926('0x3b')];queues[_0x5cd0ec[_0x3926('0xf')]]['connectedlinenum']=_0x5cd0ec['connectedlinenum'];queues[_0x5cd0ec[_0x3926('0xf')]][_0x3926('0x37')]=_0x5cd0ec[_0x3926('0x37')];}}catch(_0x383de2){utils[_0x3926('0x18')](util[_0x3926('0x12')]('[%s][queues][queuecallerleave]',_0x5cd0ec[_0x3926('0xf')]),_0x383de2);}};exports['agentconnect']=function(_0x1c0328){try{if(!_[_0x3926('0x24')](queues[_0x1c0328['uniqueid']])){utils[_0x3926('0x11')](util['format'](_0x3926('0x3c'),_0x1c0328['uniqueid']),_0x1c0328);utils[_0x3926('0x3')](util[_0x3926('0x12')](_0x3926('0x3d'),_0x1c0328['uniqueid'],queues[_0x1c0328[_0x3926('0xf')]][_0x3926('0x21')],_0x1c0328[_0x3926('0x3e')],_0x1c0328['destaccountcode']));queues[_0x1c0328[_0x3926('0xf')]][_0x3926('0x2d')]=![];queues[_0x1c0328[_0x3926('0xf')]][_0x3926('0x2d')]=![];queues[_0x1c0328[_0x3926('0xf')]][_0x3926('0x29')]=null;queues[_0x1c0328[_0x3926('0xf')]]['queuecallerexit']=![];queues[_0x1c0328[_0x3926('0xf')]]['queuecallerexitreason']=null;queues[_0x1c0328['uniqueid']][_0x3926('0x2a')]=null;queues[_0x1c0328[_0x3926('0xf')]]['assigned']=!![];queues[_0x1c0328[_0x3926('0xf')]]['accountcode']=_0x1c0328[_0x3926('0x3f')];queues[_0x1c0328[_0x3926('0xf')]][_0x3926('0x5')]=_0x1c0328[_0x3926('0x3e')];}}catch(_0x3704cc){utils[_0x3926('0x18')](util[_0x3926('0x12')](_0x3926('0x3c'),_0x1c0328[_0x3926('0xf')]),_0x3704cc);}};exports[_0x3926('0x40')]=function(_0x46265a){try{if(!_['isNil'](queues[_0x46265a['uniqueid']])){if(queues[_0x46265a[_0x3926('0xf')]][_0x3926('0x1b')]){utils[_0x3926('0x11')](util[_0x3926('0x12')](_0x3926('0x41'),_0x46265a[_0x3926('0xf')]),_0x46265a);queues[_0x46265a[_0x3926('0xf')]][_0x3926('0x2d')]=![];queues[_0x46265a[_0x3926('0xf')]][_0x3926('0x2d')]=![];queues[_0x46265a[_0x3926('0xf')]][_0x3926('0x29')]=null;queues[_0x46265a[_0x3926('0xf')]]['queuecallerexit']=![];queues[_0x46265a['uniqueid']][_0x3926('0x2a')]=null;queues[_0x46265a[_0x3926('0xf')]][_0x3926('0x42')]=!![];queues[_0x46265a[_0x3926('0xf')]][_0x3926('0x5')]=_0x46265a[_0x3926('0x3e')];queues[_0x46265a[_0x3926('0xf')]][_0x3926('0x1d')]=!![];queues[_0x46265a[_0x3926('0xf')]]['queuecallercompleteAt']=utils[_0x3926('0x17')]();if(_0x46265a['reason']==_0x3926('0x43')){if(!queues[_0x46265a[_0x3926('0xf')]][_0x3926('0x43')]){queues[_0x46265a['uniqueid']][_0x3926('0x7')]=_0x3926('0x44');}}else{queues[_0x46265a['uniqueid']][_0x3926('0x7')]='COMPLETEDBY'+_0x46265a[_0x3926('0x45')][_0x3926('0x2b')]();}utils[_0x3926('0x3')](util['format'](_0x3926('0x46'),_0x46265a[_0x3926('0xf')],queues[_0x46265a[_0x3926('0xf')]][_0x3926('0x21')],_0x46265a[_0x3926('0x3e')],queues[_0x46265a[_0x3926('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x46265a[_0x3926('0xf')]]);}}}catch(_0x19b9f6){utils[_0x3926('0x18')](util['format'](_0x3926('0x41'),_0x46265a[_0x3926('0xf')]),_0x19b9f6);}};exports[_0x3926('0x47')]=function(_0x105077){try{if(!_['isNil'](queues[_0x105077['transfereeuniqueid']])){utils[_0x3926('0x11')](util[_0x3926('0x12')](_0x3926('0x48'),_0x105077[_0x3926('0xf')]),_0x105077);queues[_0x105077[_0x3926('0x49')]][_0x3926('0x43')]=!![];queues[_0x105077[_0x3926('0x49')]][_0x3926('0x4a')]=_0x3926('0x4b');queues[_0x105077[_0x3926('0x49')]]['transferexten']=_0x105077[_0x3926('0x4c')];queues[_0x105077[_0x3926('0x49')]][_0x3926('0x4d')]=_0x105077[_0x3926('0x49')];queues[_0x105077['transfereeuniqueid']][_0x3926('0x7')]=_0x3926('0x4e');utils['info'](util[_0x3926('0x12')](_0x3926('0x4f'),_0x105077[_0x3926('0xf')],queues[_0x105077[_0x3926('0x49')]][_0x3926('0x21')],_0x105077[_0x3926('0x49')],_0x105077[_0x3926('0x4c')]));}}catch(_0x5cabb1){utils[_0x3926('0x18')](util[_0x3926('0x12')]('[%s][queues][blindtransfer]',_0x105077[_0x3926('0xf')]),_0x5cabb1);}};exports[_0x3926('0x50')]=function(_0x21dfba){try{utils['debug'](util[_0x3926('0x12')](_0x3926('0x51'),_0x21dfba[_0x3926('0x52')]),_0x21dfba);if(_0x21dfba[_0x3926('0x52')]==_0x21dfba[_0x3926('0x53')]){if(!_[_0x3926('0x24')](queues[_0x21dfba[_0x3926('0x54')]])){utils[_0x3926('0x3')](util['format'](_0x3926('0x55'),_0x21dfba['origtransfereruniqueid'],queues[_0x21dfba[_0x3926('0x54')]][_0x3926('0x21')],_0x21dfba[_0x3926('0x56')]));queues[_0x21dfba[_0x3926('0x54')]][_0x3926('0x43')]=!![];queues[_0x21dfba[_0x3926('0x54')]][_0x3926('0x4a')]=_0x3926('0x57');queues[_0x21dfba[_0x3926('0x54')]][_0x3926('0x58')]=_0x21dfba[_0x3926('0x56')];queues[_0x21dfba[_0x3926('0x54')]][_0x3926('0x4d')]=_0x21dfba['origtransfereruniqueid'];queues[_0x21dfba[_0x3926('0x54')]][_0x3926('0x7')]='ATTENDEDTRANSFER';}if(!_[_0x3926('0x24')](queues[_0x21dfba[_0x3926('0x53')]])){if(_0x21dfba[_0x3926('0x59')]&&queues[_0x21dfba[_0x3926('0x59')]]){queues[_0x21dfba[_0x3926('0x59')]][_0x3926('0x23')]=0x1;queues[_0x21dfba[_0x3926('0x49')]]=_['clone'](queues[_0x21dfba[_0x3926('0x59')]]);queues[_0x21dfba[_0x3926('0x49')]][_0x3926('0xe')]=_0x21dfba[_0x3926('0x5a')];queues[_0x21dfba[_0x3926('0x49')]][_0x3926('0x23')]=0x2;queues[_0x21dfba['transfereeuniqueid']][_0x3926('0x6')]=queues[_0x21dfba[_0x3926('0x54')]][_0x3926('0x6')];queues[_0x21dfba[_0x3926('0x49')]][_0x3926('0x5b')]=queues[_0x21dfba[_0x3926('0x54')]]['calleridname'];queues[_0x21dfba[_0x3926('0x49')]][_0x3926('0x3a')]=utils[_0x3926('0x17')]();queues[_0x21dfba['transfereeuniqueid']][_0x3926('0x1b')]=utils['now']();queues[_0x21dfba[_0x3926('0x49')]]['holdtime']=0x0;queues[_0x21dfba[_0x3926('0x49')]][_0x3926('0x5c')]=0x0;utils[_0x3926('0x3')](util[_0x3926('0x12')](_0x3926('0x5d'),_0x21dfba[_0x3926('0x52')],queues[_0x21dfba[_0x3926('0x49')]][_0x3926('0x21')],queues[_0x21dfba['transfereeuniqueid']]['calleridnum'],queues[_0x21dfba['transfereeuniqueid']][_0x3926('0x5b')]));}else{utils[_0x3926('0x3')](util['format'](_0x3926('0x5e'),_0x21dfba[_0x3926('0x52')],queues[_0x21dfba[_0x3926('0x53')]]['name'],_0x21dfba[_0x3926('0x54')]));queues[_0x21dfba['origtransfererlinkedid']]['transfereduniqueid']=_0x21dfba[_0x3926('0x54')];}}}else if(_0x21dfba['secondtransfereruniqueid']==_0x21dfba['secondtransfererlinkedid']){if(!_[_0x3926('0x24')](queues[_0x21dfba['origtransfererlinkedid']])){utils[_0x3926('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x21dfba['origtransfereruniqueid'],queues[_0x21dfba[_0x3926('0x53')]][_0x3926('0x21')],_0x21dfba[_0x3926('0x5f')],_0x21dfba[_0x3926('0x60')]));queues[_0x21dfba[_0x3926('0x53')]][_0x3926('0x43')]=!![];queues[_0x21dfba[_0x3926('0x53')]]['transfertype']=_0x3926('0x57');queues[_0x21dfba[_0x3926('0x53')]]['transferexten']=_0x21dfba['secondtransfererexten'];queues[_0x21dfba[_0x3926('0x53')]][_0x3926('0x4d')]=_0x21dfba['secondtransfereruniqueid'];queues[_0x21dfba[_0x3926('0x53')]][_0x3926('0x7')]='ATTENDEDTRANSFER';}if(!_[_0x3926('0x24')](queues[_0x21dfba[_0x3926('0x54')]])){if(_0x21dfba['transfertargetlinkedid']&&queues[_0x21dfba[_0x3926('0x61')]]){queues[_0x21dfba[_0x3926('0x61')]][_0x3926('0x23')]=0x1;queues[_0x21dfba[_0x3926('0x5a')]]=_['clone'](queues[_0x21dfba[_0x3926('0x61')]]);queues[_0x21dfba[_0x3926('0x5a')]][_0x3926('0xe')]=_0x21dfba[_0x3926('0x5a')];queues[_0x21dfba[_0x3926('0x5a')]][_0x3926('0x23')]=0x2;queues[_0x21dfba[_0x3926('0x5a')]][_0x3926('0x6')]=queues[_0x21dfba['origtransfererlinkedid']][_0x3926('0x6')];queues[_0x21dfba[_0x3926('0x5a')]][_0x3926('0x5b')]=queues[_0x21dfba[_0x3926('0x53')]][_0x3926('0x5b')];queues[_0x21dfba[_0x3926('0x5a')]][_0x3926('0x3a')]=utils[_0x3926('0x17')]();queues[_0x21dfba[_0x3926('0x5a')]][_0x3926('0x1b')]=utils[_0x3926('0x17')]();queues[_0x21dfba['transfertargetuniqueid']][_0x3926('0x38')]=0x0;queues[_0x21dfba[_0x3926('0x5a')]]['mohtime']=0x0;utils[_0x3926('0x3')](util['format'](_0x3926('0x62'),_0x21dfba[_0x3926('0x52')],queues[_0x21dfba[_0x3926('0x5a')]][_0x3926('0x21')],queues[_0x21dfba[_0x3926('0x5a')]][_0x3926('0xe')],queues[_0x21dfba[_0x3926('0x5a')]]['calleridnum'],queues[_0x21dfba['transfertargetuniqueid']][_0x3926('0x5b')]));}else{utils[_0x3926('0x3')](util[_0x3926('0x12')](_0x3926('0x5e'),_0x21dfba['origtransfereruniqueid'],queues[_0x21dfba['secondtransfererlinkedid']][_0x3926('0x21')],_0x21dfba[_0x3926('0x53')]));queues[_0x21dfba['secondtransfererlinkedid']][_0x3926('0xe')]=_0x21dfba[_0x3926('0x53')];}}}}catch(_0x534135){utils[_0x3926('0x18')](util['format']('[%s][queues][attendedtransfer]',_0x21dfba[_0x3926('0x52')]),_0x534135);}};exports[_0x3926('0x63')]=function(_0x48d2e1){try{if(!_[_0x3926('0x24')](queues[_0x48d2e1[_0x3926('0xf')]])){utils['debug'](util[_0x3926('0x12')](_0x3926('0x64'),_0x48d2e1[_0x3926('0xf')]),_0x48d2e1);queues[_0x48d2e1[_0x3926('0xf')]][_0x3926('0x65')]=utils['now']();utils['info'](util[_0x3926('0x12')](_0x3926('0x66'),_0x48d2e1[_0x3926('0xf')],queues[_0x48d2e1[_0x3926('0xf')]]['name'],queues[_0x48d2e1[_0x3926('0xf')]][_0x3926('0x65')]));}}catch(_0x28c59c){utils[_0x3926('0x18')](util[_0x3926('0x12')]('[%s][queues][musiconholdstart]',_0x48d2e1[_0x3926('0xf')]),_0x28c59c);}};exports[_0x3926('0x67')]=function(_0x52da9b){try{if(!_[_0x3926('0x24')](queues[_0x52da9b[_0x3926('0xf')]])){if(!_[_0x3926('0x24')](queues[_0x52da9b[_0x3926('0xf')]][_0x3926('0x65')])){utils[_0x3926('0x11')](util[_0x3926('0x12')](_0x3926('0x68'),_0x52da9b['uniqueid']),_0x52da9b);queues[_0x52da9b[_0x3926('0xf')]][_0x3926('0x5c')]+=utils['diffTime'](utils['now'](),queues[_0x52da9b[_0x3926('0xf')]][_0x3926('0x65')]);utils[_0x3926('0x3')](util[_0x3926('0x12')](_0x3926('0x69'),_0x52da9b[_0x3926('0xf')],queues[_0x52da9b[_0x3926('0xf')]][_0x3926('0x21')],queues[_0x52da9b['uniqueid']][_0x3926('0x5c')]));delete queues[_0x52da9b['uniqueid']][_0x3926('0x65')];}}}catch(_0x7568c){utils[_0x3926('0x18')](util[_0x3926('0x12')](_0x3926('0x68'),_0x52da9b[_0x3926('0xf')]),_0x7568c);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 597a86c..44538b2 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 _0x3cfe=['recording','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','accountcode','getUserByInternal','membername','name','UserId','request','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','isNil','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','.wav49','value','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinename','outbound','connectedlinenum','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','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','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid'];(function(_0x50702f,_0x4f509a){var _0x38cc6a=function(_0x36e905){while(--_0x36e905){_0x50702f['push'](_0x50702f['shift']());}};_0x38cc6a(++_0x4f509a);}(_0x3cfe,0x1eb));var _0xe3cf=function(_0x53c0da,_0x1e32f2){_0x53c0da=_0x53c0da-0x0;var _0x2cfb3c=_0x3cfe[_0x53c0da];return _0x2cfb3c;};'use strict';var _=require(_0xe3cf('0x0'));var util=require(_0xe3cf('0x1'));var utils=require(_0xe3cf('0x2'));var transfers=require(_0xe3cf('0x3'));var recordings={};function writeDB(_0x3007d2){var _0x5f2fb4;utils[_0xe3cf('0x4')](util[_0xe3cf('0x5')](_0xe3cf('0x6'),_0x3007d2[_0xe3cf('0x7')]));if(transfers[_0xe3cf('0x8')][_0x3007d2[_0xe3cf('0x7')]]){_0x5f2fb4=_0x3007d2[_0xe3cf('0x7')];_0x3007d2[_0xe3cf('0x7')]=transfers['blinds'][_0x3007d2[_0xe3cf('0x7')]]['transfereeuniqueid'];}if(_0x3007d2[_0xe3cf('0x9')]){utils[_0xe3cf('0xa')](_0x3007d2[_0xe3cf('0x9')])['then'](function(_0x1b96b4){if(_0x1b96b4){_0x3007d2[_0xe3cf('0xb')]=_0x1b96b4[_0xe3cf('0xc')];_0x3007d2[_0xe3cf('0xd')]=_0x1b96b4['id'];}utils['request']('CreateVoiceRecording',_0x3007d2);});}else{utils[_0xe3cf('0xe')]('CreateVoiceRecording',_0x3007d2);}if(_0x5f2fb4)delete transfers[_0xe3cf('0x8')][_0x5f2fb4];}exports['newchannel']=function(_0x1083e3){try{utils[_0xe3cf('0xf')](util['format']('[%s][recordings][newchannel]',_0x1083e3['uniqueid']),_0x1083e3);if(_0x1083e3[_0xe3cf('0x7')]==_0x1083e3[_0xe3cf('0x10')]){utils[_0xe3cf('0x4')](util['format'](_0xe3cf('0x11'),_0x1083e3[_0xe3cf('0x7')],_0x1083e3[_0xe3cf('0x12')],_0x1083e3[_0xe3cf('0x13')]));recordings[_0x1083e3['uniqueid']]={'uniqueid':_0x1083e3[_0xe3cf('0x7')],'accountcode':_0x1083e3[_0xe3cf('0x9')],'exten':_0x1083e3[_0xe3cf('0x13')],'context':_0x1083e3['context'],'channel':_0x1083e3[_0xe3cf('0x14')],'monitors':[]};}}catch(_0x5a7d47){utils[_0xe3cf('0x15')](util[_0xe3cf('0x5')](_0xe3cf('0x16'),_0x1083e3[_0xe3cf('0x7')]),_0x5a7d47);}};exports['newstate']=function(_0x1f1f1d){try{utils[_0xe3cf('0xf')](util[_0xe3cf('0x5')]('[%s][recordings][newstate]',_0x1f1f1d[_0xe3cf('0x7')]),_0x1f1f1d);if(!_['isNil'](recordings[_0x1f1f1d[_0xe3cf('0x7')]])&&_0x1f1f1d[_0xe3cf('0x17')]==0x6){utils['info'](util[_0xe3cf('0x5')](_0xe3cf('0x18'),_0x1f1f1d[_0xe3cf('0x7')],_0x1f1f1d[_0xe3cf('0x12')],_0x1f1f1d['channel']));}else if(!_['isNil'](recordings[_0x1f1f1d['linkedid']])&&_0x1f1f1d[_0xe3cf('0x17')]==0x6&&_0x1f1f1d[_0xe3cf('0x12')]!='transfer'){utils[_0xe3cf('0x4')](util[_0xe3cf('0x5')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1f1f1d[_0xe3cf('0x7')],_0x1f1f1d[_0xe3cf('0x10')],_0x1f1f1d['context'],_0x1f1f1d[_0xe3cf('0x14')]));recordings[_0x1f1f1d[_0xe3cf('0x10')]]['accountcode']=_0x1f1f1d[_0xe3cf('0x9')];}}catch(_0x2a15bc){utils[_0xe3cf('0x15')](util['format'](_0xe3cf('0x19'),_0x1f1f1d['uniqueid']),_0x2a15bc);}};exports[_0xe3cf('0x1a')]=function(_0x33d9e9){try{if(!_[_0xe3cf('0x1b')](_0x33d9e9[_0xe3cf('0x1c')])&&!_[_0xe3cf('0x1b')](_0x33d9e9[_0xe3cf('0x1c')]['mixmonitor_filename'])){utils[_0xe3cf('0xf')](util[_0xe3cf('0x5')](_0xe3cf('0x1d'),_0x33d9e9[_0xe3cf('0x7')]),_0x33d9e9);utils[_0xe3cf('0x4')](util[_0xe3cf('0x5')](_0xe3cf('0x1e'),_0x33d9e9['uniqueid'],_0x33d9e9[_0xe3cf('0x1c')],_0x33d9e9['value']));if(_['endsWith'](_0x33d9e9['value'],_0xe3cf('0x1f'))){_0x33d9e9['value']=_0x33d9e9[_0xe3cf('0x20')][_0xe3cf('0x21')](_0xe3cf('0x1f'),_0xe3cf('0x22'));}if(recordings[_0x33d9e9[_0xe3cf('0x10')]]){var _0x5c9b8b=_[_0xe3cf('0x23')](recordings[_0x33d9e9[_0xe3cf('0x10')]][_0xe3cf('0x24')],{'value':_0x33d9e9['value']});if(_[_0xe3cf('0x1b')](_0x5c9b8b)){recordings[_0x33d9e9[_0xe3cf('0x10')]][_0xe3cf('0x24')][_0xe3cf('0x25')]({'value':_0x33d9e9[_0xe3cf('0x20')]});}}}}catch(_0x1bd865){utils[_0xe3cf('0x15')](util[_0xe3cf('0x5')]('[%s][recordings][varset]',_0x33d9e9[_0xe3cf('0x7')]),_0x1bd865);}};exports[_0xe3cf('0x26')]=function(_0x32e593){try{if(!_[_0xe3cf('0x1b')](recordings[_0x32e593[_0xe3cf('0x7')]])){utils[_0xe3cf('0xf')](util[_0xe3cf('0x5')](_0xe3cf('0x27'),_0x32e593['uniqueid']),_0x32e593);utils[_0xe3cf('0x4')](util[_0xe3cf('0x5')](_0xe3cf('0x28'),_0x32e593[_0xe3cf('0x7')],_0x32e593['calleridnum'],_0x32e593[_0xe3cf('0x29')],_0x32e593[_0xe3cf('0x2a')]));recordings[_0x32e593[_0xe3cf('0x7')]][_0xe3cf('0x2b')]=_0x32e593[_0xe3cf('0x2b')];recordings[_0x32e593['uniqueid']]['calleridname']=_0x32e593[_0xe3cf('0x29')];recordings[_0x32e593[_0xe3cf('0x7')]]['connectedlinenum']=_0x32e593['connectedlinenum'];recordings[_0x32e593['uniqueid']][_0xe3cf('0x2c')]=_0x32e593[_0xe3cf('0x2c')];if(recordings[_0x32e593[_0xe3cf('0x7')]]['type']==_0xe3cf('0x2d')&&recordings[_0x32e593[_0xe3cf('0x7')]][_0xe3cf('0x9')]){recordings[_0x32e593[_0xe3cf('0x7')]][_0xe3cf('0x2e')]=recordings[_0x32e593[_0xe3cf('0x7')]][_0xe3cf('0x9')];recordings[_0x32e593[_0xe3cf('0x7')]][_0xe3cf('0x2c')]='';}recordings[_0x32e593[_0xe3cf('0x7')]][_0xe3cf('0x24')]['forEach'](function(_0x462375){var _0x5e7304=_[_0xe3cf('0x2f')](recordings[_0x32e593[_0xe3cf('0x7')]]);_0x5e7304[_0xe3cf('0x20')]=_0x462375[_0xe3cf('0x20')];writeDB(_0x5e7304);});delete recordings[_0x32e593[_0xe3cf('0x7')]];}}catch(_0x3071cc){utils[_0xe3cf('0x15')](util[_0xe3cf('0x5')](_0xe3cf('0x27'),_0x32e593[_0xe3cf('0x7')]),_0x3071cc);}};exports[_0xe3cf('0x30')]=function(_0xc3f50e){try{if(!_[_0xe3cf('0x1b')](recordings[_0xc3f50e[_0xe3cf('0x7')]])){utils[_0xe3cf('0xf')](util[_0xe3cf('0x5')](_0xe3cf('0x31'),_0xc3f50e[_0xe3cf('0x7')]),_0xc3f50e);utils[_0xe3cf('0x4')](util[_0xe3cf('0x5')](_0xe3cf('0x32'),_0xc3f50e['uniqueid'],_0xc3f50e['application'],_0xc3f50e[_0xe3cf('0x33')]));if(_0xc3f50e[_0xe3cf('0x34')][_0xe3cf('0x35')]()=='set'&&_[_0xe3cf('0x36')](_0xc3f50e['appdata'][_0xe3cf('0x35')](),_0xe3cf('0x37'))){var _0x5bee70=_0xc3f50e[_0xe3cf('0x33')][_0xe3cf('0x38')]('=');var _0x421d32=_0x5bee70[0x0]['substring'](_0x5bee70[0x0][_0xe3cf('0x39')]('(')+0x1,_0x5bee70[0x0]['lastIndexOf'](')'));var _0x57308e=_0x5bee70[0x1];recordings[_0xc3f50e[_0xe3cf('0x7')]][_0x421d32]=_0x57308e;}}}catch(_0xe82a0e){utils['error'](util[_0xe3cf('0x5')]('[%s][recordings][newexten]',_0xc3f50e['uniqueid']),_0xe82a0e);}};exports[_0xe3cf('0x3a')]=function(_0xa519ab){try{if(!_[_0xe3cf('0x1b')](recordings[_0xa519ab[_0xe3cf('0x7')]])){utils[_0xe3cf('0xf')](util[_0xe3cf('0x5')](_0xe3cf('0x3b'),_0xa519ab[_0xe3cf('0x7')]),_0xa519ab);utils[_0xe3cf('0x4')](util[_0xe3cf('0x5')](_0xe3cf('0x3c'),_0xa519ab[_0xe3cf('0x7')],_0xa519ab[_0xe3cf('0x3d')]));recordings[_0xa519ab[_0xe3cf('0x7')]][_0xe3cf('0x3d')]=_0xa519ab[_0xe3cf('0x3d')];}}catch(_0x5775e7){utils[_0xe3cf('0x15')](util[_0xe3cf('0x5')](_0xe3cf('0x3b'),_0xa519ab[_0xe3cf('0x7')]),_0x5775e7);}};exports[_0xe3cf('0x3e')]=function(_0x5f2494){try{utils[_0xe3cf('0xf')](util['format'](_0xe3cf('0x3f'),_0x5f2494['uniqueid']),_0x5f2494);utils[_0xe3cf('0x4')](util['format'](_0xe3cf('0x40'),_0x5f2494[_0xe3cf('0x7')],_0x5f2494[_0xe3cf('0x41')],_0x5f2494[_0xe3cf('0x42')],_0x5f2494[_0xe3cf('0x43')],_0x5f2494['transfereecalleridname']));if(recordings[_0x5f2494[_0xe3cf('0x44')]]&&transfers[_0xe3cf('0x8')][_0x5f2494[_0xe3cf('0x44')]]){transfers[_0xe3cf('0x8')][_0x5f2494[_0xe3cf('0x44')]][_0xe3cf('0x45')]=!![];}}catch(_0x569584){utils['error'](util[_0xe3cf('0x5')](_0xe3cf('0x3f'),_0x5f2494['uniqueid']),_0x569584);}}; \ No newline at end of file +var _0xaa2b=['accountcode','then','membername','name','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','format','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','.WAV','find','monitors','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','outbound','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','util','./utils','./transfers.controller','info','uniqueid','blinds','transfereeuniqueid'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xaa2b,0x7d));var _0xbaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xbaa2('0x0'));var utils=require(_0xbaa2('0x1'));var transfers=require(_0xbaa2('0x2'));var recordings={};function writeDB(_0x1f6c97){var _0x1acfdf;utils[_0xbaa2('0x3')](util['format']('[%s][recordings][writeDB]',_0x1f6c97[_0xbaa2('0x4')]));if(transfers['blinds'][_0x1f6c97['uniqueid']]){_0x1acfdf=_0x1f6c97[_0xbaa2('0x4')];_0x1f6c97['uniqueid']=transfers[_0xbaa2('0x5')][_0x1f6c97[_0xbaa2('0x4')]][_0xbaa2('0x6')];}if(_0x1f6c97[_0xbaa2('0x7')]){utils['getUserByInternal'](_0x1f6c97[_0xbaa2('0x7')])[_0xbaa2('0x8')](function(_0x7db5ed){if(_0x7db5ed){_0x1f6c97[_0xbaa2('0x9')]=_0x7db5ed[_0xbaa2('0xa')];_0x1f6c97[_0xbaa2('0xb')]=_0x7db5ed['id'];}utils[_0xbaa2('0xc')](_0xbaa2('0xd'),_0x1f6c97);});}else{utils[_0xbaa2('0xc')](_0xbaa2('0xd'),_0x1f6c97);}if(_0x1acfdf)delete transfers[_0xbaa2('0x5')][_0x1acfdf];}exports['newchannel']=function(_0x1e8835){try{utils[_0xbaa2('0xe')](util['format'](_0xbaa2('0xf'),_0x1e8835['uniqueid']),_0x1e8835);if(_0x1e8835[_0xbaa2('0x4')]==_0x1e8835[_0xbaa2('0x10')]){utils[_0xbaa2('0x3')](util['format'](_0xbaa2('0x11'),_0x1e8835[_0xbaa2('0x4')],_0x1e8835[_0xbaa2('0x12')],_0x1e8835[_0xbaa2('0x13')]));recordings[_0x1e8835['uniqueid']]={'uniqueid':_0x1e8835['uniqueid'],'accountcode':_0x1e8835[_0xbaa2('0x7')],'exten':_0x1e8835['exten'],'context':_0x1e8835[_0xbaa2('0x12')],'channel':_0x1e8835[_0xbaa2('0x14')],'monitors':[]};}}catch(_0x4af66f){utils[_0xbaa2('0x15')](util[_0xbaa2('0x16')](_0xbaa2('0xf'),_0x1e8835['uniqueid']),_0x4af66f);}};exports[_0xbaa2('0x17')]=function(_0x548849){try{utils[_0xbaa2('0xe')](util[_0xbaa2('0x16')](_0xbaa2('0x18'),_0x548849['uniqueid']),_0x548849);if(!_[_0xbaa2('0x19')](recordings[_0x548849['uniqueid']])&&_0x548849['channelstate']==0x6){utils['info'](util['format'](_0xbaa2('0x1a'),_0x548849['uniqueid'],_0x548849[_0xbaa2('0x12')],_0x548849[_0xbaa2('0x14')]));}else if(!_[_0xbaa2('0x19')](recordings[_0x548849[_0xbaa2('0x10')]])&&_0x548849['channelstate']==0x6&&_0x548849['context']!='transfer'){utils[_0xbaa2('0x3')](util[_0xbaa2('0x16')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x548849['uniqueid'],_0x548849['linkedid'],_0x548849[_0xbaa2('0x12')],_0x548849[_0xbaa2('0x14')]));recordings[_0x548849[_0xbaa2('0x10')]]['accountcode']=_0x548849[_0xbaa2('0x7')];}}catch(_0x25f7a2){utils[_0xbaa2('0x15')](util['format'](_0xbaa2('0x18'),_0x548849[_0xbaa2('0x4')]),_0x25f7a2);}};exports[_0xbaa2('0x1b')]=function(_0x1e7b9c){try{if(!_['isNil'](_0x1e7b9c[_0xbaa2('0x1c')])&&!_[_0xbaa2('0x19')](_0x1e7b9c['variable'][_0xbaa2('0x1d')])){utils[_0xbaa2('0xe')](util[_0xbaa2('0x16')](_0xbaa2('0x1e'),_0x1e7b9c[_0xbaa2('0x4')]),_0x1e7b9c);utils['info'](util[_0xbaa2('0x16')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x1e7b9c[_0xbaa2('0x4')],_0x1e7b9c[_0xbaa2('0x1c')],_0x1e7b9c[_0xbaa2('0x1f')]));if(_[_0xbaa2('0x20')](_0x1e7b9c[_0xbaa2('0x1f')],_0xbaa2('0x21'))){_0x1e7b9c['value']=_0x1e7b9c[_0xbaa2('0x1f')]['replace'](_0xbaa2('0x21'),_0xbaa2('0x22'));}if(recordings[_0x1e7b9c[_0xbaa2('0x10')]]){var _0x373949=_[_0xbaa2('0x23')](recordings[_0x1e7b9c[_0xbaa2('0x10')]][_0xbaa2('0x24')],{'value':_0x1e7b9c[_0xbaa2('0x1f')]});if(_[_0xbaa2('0x19')](_0x373949)){recordings[_0x1e7b9c[_0xbaa2('0x10')]]['monitors']['push']({'value':_0x1e7b9c[_0xbaa2('0x1f')]});}}}}catch(_0xb4ea9c){utils[_0xbaa2('0x15')](util[_0xbaa2('0x16')](_0xbaa2('0x1e'),_0x1e7b9c[_0xbaa2('0x4')]),_0xb4ea9c);}};exports[_0xbaa2('0x25')]=function(_0x2d13d9){try{if(!_[_0xbaa2('0x19')](recordings[_0x2d13d9[_0xbaa2('0x4')]])){utils[_0xbaa2('0xe')](util[_0xbaa2('0x16')]('[%s][recordings][hangup]',_0x2d13d9[_0xbaa2('0x4')]),_0x2d13d9);utils[_0xbaa2('0x3')](util[_0xbaa2('0x16')](_0xbaa2('0x26'),_0x2d13d9[_0xbaa2('0x4')],_0x2d13d9[_0xbaa2('0x27')],_0x2d13d9['calleridname'],_0x2d13d9[_0xbaa2('0x28')]));recordings[_0x2d13d9['uniqueid']][_0xbaa2('0x27')]=_0x2d13d9[_0xbaa2('0x27')];recordings[_0x2d13d9[_0xbaa2('0x4')]][_0xbaa2('0x29')]=_0x2d13d9[_0xbaa2('0x29')];recordings[_0x2d13d9[_0xbaa2('0x4')]][_0xbaa2('0x2a')]=_0x2d13d9[_0xbaa2('0x2a')];recordings[_0x2d13d9[_0xbaa2('0x4')]]['connectedlinename']=_0x2d13d9['connectedlinename'];if(recordings[_0x2d13d9[_0xbaa2('0x4')]]['type']==_0xbaa2('0x2b')&&recordings[_0x2d13d9['uniqueid']][_0xbaa2('0x7')]){recordings[_0x2d13d9[_0xbaa2('0x4')]][_0xbaa2('0x2a')]=recordings[_0x2d13d9[_0xbaa2('0x4')]][_0xbaa2('0x7')];recordings[_0x2d13d9[_0xbaa2('0x4')]]['connectedlinename']='';}recordings[_0x2d13d9['uniqueid']][_0xbaa2('0x24')]['forEach'](function(_0x552560){var _0xced083=_[_0xbaa2('0x2c')](recordings[_0x2d13d9[_0xbaa2('0x4')]]);_0xced083['value']=_0x552560[_0xbaa2('0x1f')];writeDB(_0xced083);});delete recordings[_0x2d13d9[_0xbaa2('0x4')]];}}catch(_0x3012e0){utils['error'](util[_0xbaa2('0x16')](_0xbaa2('0x2d'),_0x2d13d9[_0xbaa2('0x4')]),_0x3012e0);}};exports[_0xbaa2('0x2e')]=function(_0x34b4d1){try{if(!_[_0xbaa2('0x19')](recordings[_0x34b4d1[_0xbaa2('0x4')]])){utils['debug'](util[_0xbaa2('0x16')](_0xbaa2('0x2f'),_0x34b4d1[_0xbaa2('0x4')]),_0x34b4d1);utils[_0xbaa2('0x3')](util[_0xbaa2('0x16')](_0xbaa2('0x30'),_0x34b4d1[_0xbaa2('0x4')],_0x34b4d1[_0xbaa2('0x31')],_0x34b4d1['appdata']));if(_0x34b4d1[_0xbaa2('0x31')][_0xbaa2('0x32')]()=='set'&&_[_0xbaa2('0x33')](_0x34b4d1['appdata']['toLowerCase'](),_0xbaa2('0x34'))){var _0x25c93c=_0x34b4d1['appdata'][_0xbaa2('0x35')]('=');var _0x5427f9=_0x25c93c[0x0][_0xbaa2('0x36')](_0x25c93c[0x0]['lastIndexOf']('(')+0x1,_0x25c93c[0x0][_0xbaa2('0x37')](')'));var _0x439bf7=_0x25c93c[0x1];recordings[_0x34b4d1[_0xbaa2('0x4')]][_0x5427f9]=_0x439bf7;}}}catch(_0x344fc5){utils['error'](util[_0xbaa2('0x16')]('[%s][recordings][newexten]',_0x34b4d1[_0xbaa2('0x4')]),_0x344fc5);}};exports[_0xbaa2('0x38')]=function(_0x2cec20){try{if(!_[_0xbaa2('0x19')](recordings[_0x2cec20[_0xbaa2('0x4')]])){utils[_0xbaa2('0xe')](util['format'](_0xbaa2('0x39'),_0x2cec20[_0xbaa2('0x4')]),_0x2cec20);utils[_0xbaa2('0x3')](util['format'](_0xbaa2('0x3a'),_0x2cec20[_0xbaa2('0x4')],_0x2cec20[_0xbaa2('0x3b')]));recordings[_0x2cec20[_0xbaa2('0x4')]][_0xbaa2('0x3b')]=_0x2cec20['queue'];}}catch(_0x31e52f){utils[_0xbaa2('0x15')](util[_0xbaa2('0x16')](_0xbaa2('0x39'),_0x2cec20['uniqueid']),_0x31e52f);}};exports[_0xbaa2('0x3c')]=function(_0x457e43){try{utils[_0xbaa2('0xe')](util['format'](_0xbaa2('0x3d'),_0x457e43[_0xbaa2('0x4')]),_0x457e43);utils[_0xbaa2('0x3')](util[_0xbaa2('0x16')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x457e43[_0xbaa2('0x4')],_0x457e43[_0xbaa2('0x3e')],_0x457e43[_0xbaa2('0x3f')],_0x457e43[_0xbaa2('0x40')],_0x457e43[_0xbaa2('0x41')]));if(recordings[_0x457e43['transfereruniqueid']]&&transfers[_0xbaa2('0x5')][_0x457e43['transfereruniqueid']]){transfers[_0xbaa2('0x5')][_0x457e43['transfereruniqueid']]['recording']=!![];}}catch(_0x11427c){utils[_0xbaa2('0x15')](util['format'](_0xbaa2('0x3d'),_0x457e43[_0xbaa2('0x4')]),_0x11427c);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 3780a78..4607912 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 _0x8977=['transfertargetexten','transfertargetlinkedid','lodash','./utils','attended','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','blindtransfer','debug','format','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','blinds','transfereruniqueid','error','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode'];(function(_0x2d9f8b,_0x1eca48){var _0x251209=function(_0x15205f){while(--_0x15205f){_0x2d9f8b['push'](_0x2d9f8b['shift']());}};_0x251209(++_0x1eca48);}(_0x8977,0x161));var _0x7897=function(_0x4d20ff,_0x345261){_0x4d20ff=_0x4d20ff-0x0;var _0x2a7372=_0x8977[_0x4d20ff];return _0x2a7372;};'use strict';var _=require(_0x7897('0x0'));var util=require('util');var utils=require(_0x7897('0x1'));function writeDB(_0x32dba9){utils['info'](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x32dba9['type']===_0x7897('0x2')?_0x32dba9[_0x7897('0x3')]:_0x32dba9[_0x7897('0x4')],_0x32dba9[_0x7897('0x5')]));utils[_0x7897('0x6')](_0x7897('0x7'),_0x32dba9);}exports['blinds']={};exports[_0x7897('0x8')]=function(_0x5df83d){try{utils[_0x7897('0x9')](util[_0x7897('0xa')](_0x7897('0xb'),_0x5df83d[_0x7897('0x4')]),_0x5df83d);utils[_0x7897('0xc')](util[_0x7897('0xa')](_0x7897('0xd'),_0x5df83d[_0x7897('0x4')],_0x5df83d[_0x7897('0xe')],_0x5df83d[_0x7897('0xf')],_0x5df83d[_0x7897('0x10')],_0x5df83d['transfereecalleridname']));_0x5df83d[_0x7897('0x5')]=_0x7897('0x11');exports[_0x7897('0x12')][_0x5df83d[_0x7897('0x13')]]=_0x5df83d;writeDB(_0x5df83d);}catch(_0x41a346){utils[_0x7897('0x14')](util['format'](_0x7897('0xb'),_0x5df83d[_0x7897('0x4')]),_0x41a346);}};exports['attendedtransfer']=function(_0x3251fa){try{utils[_0x7897('0x9')](util[_0x7897('0xa')]('[%s][transfers][attendedtransfer]',_0x3251fa[_0x7897('0x3')]),_0x3251fa);utils[_0x7897('0xc')](util[_0x7897('0xa')](_0x7897('0x15'),_0x3251fa[_0x7897('0x3')],_0x3251fa[_0x7897('0x16')],_0x3251fa['origtransferercalleridname'],_0x3251fa[_0x7897('0x17')],_0x3251fa['transfertargetcalleridname']));_0x3251fa=_[_0x7897('0x18')](_0x3251fa,{'transfererchannel':_0x3251fa[_0x7897('0x19')],'transferercalleridnum':_0x3251fa[_0x7897('0x16')],'transferercalleridname':_0x3251fa[_0x7897('0x1a')],'transfererconnectedlinenum':_0x3251fa[_0x7897('0x1b')],'transfererconnectedlinename':_0x3251fa[_0x7897('0x1c')],'transfereraccountcode':_0x3251fa[_0x7897('0x1d')],'transferercontext':_0x3251fa['secondtransferercontext'],'transfererexten':_0x3251fa[_0x7897('0x1e')],'transfererlinkedid':_0x3251fa[_0x7897('0x1f')],'context':_0x3251fa[_0x7897('0x20')],'extension':_0x3251fa[_0x7897('0x21')],'type':'attended'});if(_['isNil'](_0x3251fa['transfereechannel'])){_0x3251fa=_[_0x7897('0x18')](_0x3251fa,{'transfereechannel':_0x3251fa[_0x7897('0x22')],'transfereecalleridnum':_0x3251fa['transfertargetcalleridnum'],'transfereecalleridname':_0x3251fa['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3251fa[_0x7897('0x23')],'transfereeconnectedlinename':_0x3251fa['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3251fa[_0x7897('0x24')],'transfereecontext':_0x3251fa['transfertargetcontext'],'transfereeexten':_0x3251fa[_0x7897('0x25')],'transfereelinkedid':_0x3251fa[_0x7897('0x26')]});}writeDB(_0x3251fa);}catch(_0x3233e8){utils[_0x7897('0x14')](util[_0x7897('0xa')]('[%s][transfers][attendedtransfer]',_0x3251fa['origtransfereruniqueid']),_0x3233e8);}}; \ No newline at end of file +var _0x1c1d=['transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','format','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil'];(function(_0x20e9ad,_0x2cd1e8){var _0x134868=function(_0x182f58){while(--_0x182f58){_0x20e9ad['push'](_0x20e9ad['shift']());}};_0x134868(++_0x2cd1e8);}(_0x1c1d,0x133));var _0xd1c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c1d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd1c1('0x0'));var util=require('util');var utils=require(_0xd1c1('0x1'));function writeDB(_0x52c626){utils[_0xd1c1('0x2')](util['format'](_0xd1c1('0x3'),_0x52c626[_0xd1c1('0x4')]==='attended'?_0x52c626[_0xd1c1('0x5')]:_0x52c626[_0xd1c1('0x6')],_0x52c626[_0xd1c1('0x4')]));utils[_0xd1c1('0x7')](_0xd1c1('0x8'),_0x52c626);}exports[_0xd1c1('0x9')]={};exports[_0xd1c1('0xa')]=function(_0x297bf6){try{utils[_0xd1c1('0xb')](util['format'](_0xd1c1('0xc'),_0x297bf6[_0xd1c1('0x6')]),_0x297bf6);utils[_0xd1c1('0x2')](util['format'](_0xd1c1('0xd'),_0x297bf6['uniqueid'],_0x297bf6[_0xd1c1('0xe')],_0x297bf6[_0xd1c1('0xf')],_0x297bf6[_0xd1c1('0x10')],_0x297bf6[_0xd1c1('0x11')]));_0x297bf6[_0xd1c1('0x4')]=_0xd1c1('0x12');exports[_0xd1c1('0x9')][_0x297bf6[_0xd1c1('0x13')]]=_0x297bf6;writeDB(_0x297bf6);}catch(_0x190cd7){utils[_0xd1c1('0x14')](util[_0xd1c1('0x15')](_0xd1c1('0xc'),_0x297bf6['uniqueid']),_0x190cd7);}};exports[_0xd1c1('0x16')]=function(_0x576c3b){try{utils[_0xd1c1('0xb')](util[_0xd1c1('0x15')](_0xd1c1('0x17'),_0x576c3b['origtransfereruniqueid']),_0x576c3b);utils[_0xd1c1('0x2')](util[_0xd1c1('0x15')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x576c3b[_0xd1c1('0x5')],_0x576c3b[_0xd1c1('0x18')],_0x576c3b[_0xd1c1('0x19')],_0x576c3b[_0xd1c1('0x1a')],_0x576c3b[_0xd1c1('0x1b')]));_0x576c3b=_[_0xd1c1('0x1c')](_0x576c3b,{'transfererchannel':_0x576c3b[_0xd1c1('0x1d')],'transferercalleridnum':_0x576c3b['origtransferercalleridnum'],'transferercalleridname':_0x576c3b[_0xd1c1('0x19')],'transfererconnectedlinenum':_0x576c3b['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x576c3b[_0xd1c1('0x1e')],'transfereraccountcode':_0x576c3b['origtransfereraccountcode'],'transferercontext':_0x576c3b['secondtransferercontext'],'transfererexten':_0x576c3b[_0xd1c1('0x1f')],'transfererlinkedid':_0x576c3b[_0xd1c1('0x20')],'context':_0x576c3b[_0xd1c1('0x21')],'extension':_0x576c3b[_0xd1c1('0x22')],'type':_0xd1c1('0x23')});if(_[_0xd1c1('0x24')](_0x576c3b[_0xd1c1('0x25')])){_0x576c3b=_[_0xd1c1('0x1c')](_0x576c3b,{'transfereechannel':_0x576c3b['transfertargetchannel'],'transfereecalleridnum':_0x576c3b[_0xd1c1('0x1a')],'transfereecalleridname':_0x576c3b['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x576c3b[_0xd1c1('0x26')],'transfereeconnectedlinename':_0x576c3b[_0xd1c1('0x27')],'transfereeaccountcode':_0x576c3b[_0xd1c1('0x28')],'transfereecontext':_0x576c3b[_0xd1c1('0x29')],'transfereeexten':_0x576c3b['transfertargetexten'],'transfereelinkedid':_0x576c3b[_0xd1c1('0x2a')]});}writeDB(_0x576c3b);}catch(_0x380c29){utils[_0xd1c1('0x14')](util[_0xd1c1('0x15')](_0xd1c1('0x17'),_0x576c3b[_0xd1c1('0x5')]),_0x380c29);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index ece852e..ab97c28 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 _0x22a1=['diffTime','diff','sumTime','YYYY-MM-DD\x20HH:mm:ss','isAfter','isBefore','bluebird','jayson/promise','moment','client','info','inspect','debug','error','[utils][request]\x20name:%s','catch','request','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify','result','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','found','add','seconds','format','subtractTime','subtract'];(function(_0x34def0,_0x554b5b){var _0x2be1c9=function(_0x45b895){while(--_0x45b895){_0x34def0['push'](_0x34def0['shift']());}};_0x2be1c9(++_0x554b5b);}(_0x22a1,0x19b));var _0x122a=function(_0x2a01c0,_0x2c0da8){_0x2a01c0=_0x2a01c0-0x0;var _0x5994cc=_0x22a1[_0x2a01c0];return _0x5994cc;};'use strict';var BPromise=require(_0x122a('0x0'));var jayson=require(_0x122a('0x1'));var moment=require(_0x122a('0x2'));var util=require('util');var client=jayson[_0x122a('0x3')]['http']({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0x122a('0x4')]=function(_0x53d8bf,_0x38e19c){logger[_0x122a('0x4')](_0x53d8bf,_0x38e19c?util[_0x122a('0x5')](_0x38e19c,{'showHidden':![],'depth':null}):'');};exports[_0x122a('0x6')]=function(_0x1e8735,_0x47f80b){logger[_0x122a('0x6')](_0x1e8735,_0x47f80b?util[_0x122a('0x5')](_0x47f80b,{'showHidden':![],'depth':null}):'');};exports[_0x122a('0x7')]=function(_0x436a72,_0x1e5362){logger['error'](_0x436a72,_0x1e5362?util['inspect'](_0x1e5362,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x369d87,_0x4c955c){return client['request'](_0x369d87,{'body':_0x4c955c})['then'](function(_0x38c44a){logger[_0x122a('0x6')](_0x122a('0x8'),_0x369d87,_0x38c44a?util[_0x122a('0x5')](_0x38c44a,{'showHidden':![],'depth':null}):'');})[_0x122a('0x9')](function(_0x479426){logger['error']('[utils][request]\x20name:%s',_0x369d87,_0x479426?util[_0x122a('0x5')](_0x479426,{'showHidden':![],'depth':null}):'');});};function getUser(_0x57b8f6){return client[_0x122a('0xa')](_0x122a('0xb'),{'options':{'raw':!![],'attributes':['id',_0x122a('0xc'),_0x122a('0xd'),_0x122a('0xe')],'where':_0x57b8f6,'limit':0x1}})[_0x122a('0xf')](function(_0x837580){logger[_0x122a('0x6')](_0x122a('0x10'),JSON[_0x122a('0x11')](_0x57b8f6),_0x837580?util[_0x122a('0x5')](_0x837580,{'showHidden':![],'depth':null}):'');return _0x837580['result']['length']?_0x837580[_0x122a('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x493f27){return new BPromise(function(_0x2b5d5d,_0x6f5fd2){if(_0x493f27){return getUser({'internal':_0x493f27})['then'](function(_0x3abd22){logger['info'](_0x122a('0x13'),_0x493f27,_0x3abd22?'found':_0x122a('0x14'));return _0x2b5d5d(_0x3abd22);})[_0x122a('0x9')](function(_0x580786){logger['error']('[utils][getUserByInternal]',_0x580786?util[_0x122a('0x5')](_0x580786,{'showHidden':![],'depth':null}):'');return _0x2b5d5d(null);});}return _0x2b5d5d(null);});};exports[_0x122a('0x15')]=function(_0x1935fd){return new BPromise(function(_0x131a95,_0x116053){if(_0x1935fd){return getUser({'interface':_0x1935fd})[_0x122a('0xf')](function(_0x56c266){logger[_0x122a('0x4')](_0x122a('0x16'),_0x1935fd,_0x56c266?'found':_0x122a('0x14'));return _0x131a95(_0x56c266);})[_0x122a('0x9')](function(_0x21c5fb){logger[_0x122a('0x7')](_0x122a('0x17'),_0x21c5fb?util[_0x122a('0x5')](_0x21c5fb,{'showHidden':![],'depth':null}):'');return _0x131a95(null);});}return _0x131a95(null);});};exports[_0x122a('0x18')]=function(_0x3b2d4a){return new BPromise(function(_0x52111b,_0x567ef8){if(_0x3b2d4a){return getUser({'name':_0x3b2d4a})[_0x122a('0xf')](function(_0x1cb41b){logger[_0x122a('0x4')]('[utils][getUserByName]\x20name:%s\x20%s',_0x3b2d4a,_0x1cb41b?'found':_0x122a('0x14'));return _0x52111b(_0x1cb41b);})[_0x122a('0x9')](function(_0x5d77f0){logger[_0x122a('0x7')](_0x122a('0x19'),_0x5d77f0?util[_0x122a('0x5')](_0x5d77f0,{'showHidden':![],'depth':null}):'');return _0x52111b(null);});}return _0x52111b(null);});};exports[_0x122a('0x1a')]=function(_0x53eee0){return new BPromise(function(_0x1bfcb5,_0x23e55e){if(_0x53eee0){return client[_0x122a('0xa')](_0x122a('0x1b'),{'options':{'raw':!![],'attributes':['id',_0x122a('0xd'),_0x122a('0x1c'),_0x122a('0x1d'),_0x122a('0x1e')],'where':{'name':_0x53eee0},'limit':0x1}})['then'](function(_0x2fc50c){logger[_0x122a('0x6')](_0x122a('0x1f'),_0x53eee0,_0x2fc50c?util[_0x122a('0x5')](_0x2fc50c,{'showHidden':![],'depth':null}):'');logger[_0x122a('0x4')](_0x122a('0x20'),_0x53eee0,_0x2fc50c?_0x122a('0x21'):_0x122a('0x14'));return _0x1bfcb5(_0x2fc50c[_0x122a('0x12')]['length']?_0x2fc50c['result'][0x0]:null);})[_0x122a('0x9')](function(_0x94ec89){logger[_0x122a('0x7')]('[utils][getVoiceQueueByName]',_0x94ec89?util[_0x122a('0x5')](_0x94ec89,{'showHidden':![],'depth':null}):'');return _0x1bfcb5(null);});}return _0x1bfcb5(null);});};exports['addTime']=function(_0x55bcd3,_0x2cd47f){return moment(_0x55bcd3)[_0x122a('0x22')](_0x2cd47f,_0x122a('0x23'))[_0x122a('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x122a('0x25')]=function(_0x25ab68,_0x183c5d){return moment(_0x25ab68)[_0x122a('0x26')](_0x183c5d,'seconds')[_0x122a('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x122a('0x27')]=function(_0x2d1c58,_0x165ad0){return moment(_0x2d1c58)[_0x122a('0x28')](moment(_0x165ad0),'seconds');};exports[_0x122a('0x29')]=function(_0x3fe484,_0x3f9005){return parseInt(_0x3fe484,0xa)+parseInt(_0x3f9005,0xa);};exports['now']=function(){return moment()[_0x122a('0x24')](_0x122a('0x2a'));};exports[_0x122a('0x2b')]=function(_0xab4a59,_0x2f1b40){if(_0x2f1b40){return moment(_0xab4a59)[_0x122a('0x2b')](_0x2f1b40);}return!![];};exports[_0x122a('0x2c')]=function(_0x2a34c4,_0x83ded){if(_0x83ded){return moment(_0x2a34c4)[_0x122a('0x2c')](_0x83ded);}else if(_0x2a34c4){return!![];}return![];}; \ No newline at end of file +var _0x4cd7=['[utils][request]\x20name:%s','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','subtractTime','subtract','format','YYYY-MM-DD\x20HH:mm:ss','diff','now','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','info','inspect','debug','error','request','then'];(function(_0x3a2118,_0x31fc3c){var _0x1d181d=function(_0x26a734){while(--_0x26a734){_0x3a2118['push'](_0x3a2118['shift']());}};_0x1d181d(++_0x31fc3c);}(_0x4cd7,0x1de));var _0x74cd=function(_0x4bdf12,_0x4c265c){_0x4bdf12=_0x4bdf12-0x0;var _0x455b61=_0x4cd7[_0x4bdf12];return _0x455b61;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x74cd('0x0'));var moment=require(_0x74cd('0x1'));var util=require(_0x74cd('0x2'));var client=jayson[_0x74cd('0x3')][_0x74cd('0x4')]({'port':0x2329});var logger=require(_0x74cd('0x5'))('xdr');exports[_0x74cd('0x6')]=function(_0x587b38,_0x3e10f1){logger[_0x74cd('0x6')](_0x587b38,_0x3e10f1?util[_0x74cd('0x7')](_0x3e10f1,{'showHidden':![],'depth':null}):'');};exports[_0x74cd('0x8')]=function(_0x5c5f59,_0xb430c3){logger[_0x74cd('0x8')](_0x5c5f59,_0xb430c3?util[_0x74cd('0x7')](_0xb430c3,{'showHidden':![],'depth':null}):'');};exports[_0x74cd('0x9')]=function(_0x5227f9,_0x30743d){logger[_0x74cd('0x9')](_0x5227f9,_0x30743d?util[_0x74cd('0x7')](_0x30743d,{'showHidden':![],'depth':null}):'');};exports[_0x74cd('0xa')]=function(_0xe6ddff,_0x5eb8ae){return client[_0x74cd('0xa')](_0xe6ddff,{'body':_0x5eb8ae})[_0x74cd('0xb')](function(_0x5d319c){logger[_0x74cd('0x8')](_0x74cd('0xc'),_0xe6ddff,_0x5d319c?util['inspect'](_0x5d319c,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x11adeb){logger[_0x74cd('0x9')](_0x74cd('0xc'),_0xe6ddff,_0x11adeb?util['inspect'](_0x11adeb,{'showHidden':![],'depth':null}):'');});};function getUser(_0x170b64){return client['request'](_0x74cd('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0x74cd('0xe'),_0x74cd('0xf')],'where':_0x170b64,'limit':0x1}})[_0x74cd('0xb')](function(_0x114a54){logger[_0x74cd('0x8')](_0x74cd('0x10'),JSON[_0x74cd('0x11')](_0x170b64),_0x114a54?util['inspect'](_0x114a54,{'showHidden':![],'depth':null}):'');return _0x114a54[_0x74cd('0x12')][_0x74cd('0x13')]?_0x114a54[_0x74cd('0x12')][0x0]:null;});}exports[_0x74cd('0x14')]=function(_0xd85dc){return new BPromise(function(_0x1c08e5,_0x62e4){if(_0xd85dc){return getUser({'internal':_0xd85dc})['then'](function(_0x5c1ad1){logger[_0x74cd('0x6')](_0x74cd('0x15'),_0xd85dc,_0x5c1ad1?_0x74cd('0x16'):_0x74cd('0x17'));return _0x1c08e5(_0x5c1ad1);})[_0x74cd('0x18')](function(_0x4bcbff){logger[_0x74cd('0x9')](_0x74cd('0x19'),_0x4bcbff?util[_0x74cd('0x7')](_0x4bcbff,{'showHidden':![],'depth':null}):'');return _0x1c08e5(null);});}return _0x1c08e5(null);});};exports[_0x74cd('0x1a')]=function(_0x4f25b2){return new BPromise(function(_0x3cea3e,_0x133cbc){if(_0x4f25b2){return getUser({'interface':_0x4f25b2})[_0x74cd('0xb')](function(_0x146368){logger[_0x74cd('0x6')](_0x74cd('0x1b'),_0x4f25b2,_0x146368?'found':_0x74cd('0x17'));return _0x3cea3e(_0x146368);})['catch'](function(_0x29e162){logger[_0x74cd('0x9')](_0x74cd('0x1c'),_0x29e162?util[_0x74cd('0x7')](_0x29e162,{'showHidden':![],'depth':null}):'');return _0x3cea3e(null);});}return _0x3cea3e(null);});};exports[_0x74cd('0x1d')]=function(_0x1af0b2){return new BPromise(function(_0x5a3fde,_0x405842){if(_0x1af0b2){return getUser({'name':_0x1af0b2})[_0x74cd('0xb')](function(_0x25238b){logger[_0x74cd('0x6')](_0x74cd('0x1e'),_0x1af0b2,_0x25238b?_0x74cd('0x16'):_0x74cd('0x17'));return _0x5a3fde(_0x25238b);})[_0x74cd('0x18')](function(_0x304e93){logger['error'](_0x74cd('0x1f'),_0x304e93?util['inspect'](_0x304e93,{'showHidden':![],'depth':null}):'');return _0x5a3fde(null);});}return _0x5a3fde(null);});};exports['getVoiceQueueByName']=function(_0x4f0d46){return new BPromise(function(_0x4fc68f,_0x4a8904){if(_0x4f0d46){return client[_0x74cd('0xa')](_0x74cd('0x20'),{'options':{'raw':!![],'attributes':['id',_0x74cd('0xe'),_0x74cd('0x21'),_0x74cd('0x22'),_0x74cd('0x23')],'where':{'name':_0x4f0d46},'limit':0x1}})[_0x74cd('0xb')](function(_0x515174){logger[_0x74cd('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x4f0d46,_0x515174?util[_0x74cd('0x7')](_0x515174,{'showHidden':![],'depth':null}):'');logger[_0x74cd('0x6')](_0x74cd('0x24'),_0x4f0d46,_0x515174?_0x74cd('0x16'):_0x74cd('0x17'));return _0x4fc68f(_0x515174[_0x74cd('0x12')][_0x74cd('0x13')]?_0x515174[_0x74cd('0x12')][0x0]:null);})['catch'](function(_0x152863){logger['error'](_0x74cd('0x25'),_0x152863?util[_0x74cd('0x7')](_0x152863,{'showHidden':![],'depth':null}):'');return _0x4fc68f(null);});}return _0x4fc68f(null);});};exports[_0x74cd('0x26')]=function(_0x487a11,_0x1387de){return moment(_0x487a11)[_0x74cd('0x27')](_0x1387de,_0x74cd('0x28'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x74cd('0x29')]=function(_0x2a4acc,_0x1aa944){return moment(_0x2a4acc)[_0x74cd('0x2a')](_0x1aa944,'seconds')[_0x74cd('0x2b')](_0x74cd('0x2c'));};exports['diffTime']=function(_0x313483,_0x304d10){return moment(_0x313483)[_0x74cd('0x2d')](moment(_0x304d10),_0x74cd('0x28'));};exports['sumTime']=function(_0x1fb983,_0x39c6a3){return parseInt(_0x1fb983,0xa)+parseInt(_0x39c6a3,0xa);};exports[_0x74cd('0x2e')]=function(){return moment()[_0x74cd('0x2b')](_0x74cd('0x2c'));};exports[_0x74cd('0x2f')]=function(_0x4fb723,_0x196500){if(_0x196500){return moment(_0x4fb723)['isAfter'](_0x196500);}return!![];};exports[_0x74cd('0x30')]=function(_0x5f3efd,_0x7e8689){if(_0x7e8689){return moment(_0x5f3efd)[_0x74cd('0x30')](_0x7e8689);}else if(_0x5f3efd){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 1629459..4873eab 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 _0xdd8f=['catch','user','no-user','data','timestamp','error','api','auth','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','method','x-forwarded-for','connection','remoteAddress','url','statusCode','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','format','headers','device','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','fileLogger','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','ensureDir','then'];(function(_0x18a81a,_0x4fc65b){var _0x114027=function(_0x1b7e0f){while(--_0x1b7e0f){_0x18a81a['push'](_0x18a81a['shift']());}};_0x114027(++_0x4fc65b);}(_0xdd8f,0x1a8));var _0xfdd8=function(_0x481011,_0x4afd3c){_0x481011=_0x481011-0x0;var _0x5d7833=_0xdd8f[_0x481011];return _0x5d7833;};var fs=require(_0xfdd8('0x0'));var _=require(_0xfdd8('0x1'));var ewinston=require(_0xfdd8('0x2'));var path=require(_0xfdd8('0x3'));var util=require('util');var fileLogger=require('./loggers')[_0xfdd8('0x4')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require(_0xfdd8('0x5'))[_0xfdd8('0x6')];function ClientSideLogger(){function _0x2a79a7(_0x5af0d7){var _0x511ab7=path[_0xfdd8('0x7')](_0xfdd8('0x8'),_0xfdd8('0x9'),_0xfdd8('0xa'));var _0x832a64=path[_0xfdd8('0x7')](_0xfdd8('0xb'),_0x5af0d7[_0xfdd8('0xc')]+'-'+_0x5af0d7[_0xfdd8('0xd')]);return fs[_0xfdd8('0xe')](path[_0xfdd8('0x7')](_0x511ab7,_0x832a64))[_0xfdd8('0xf')](function(){var _0x47d127=fileLogger('client',path[_0xfdd8('0x7')](_0x511ab7,_0x832a64));return _0x47d127;})[_0xfdd8('0x10')](function(_0xfeee4a){throw _0xfeee4a;});}this[_0xfdd8('0x9')]=function(_0x238765,_0x46c698,_0x2c5031,_0x5ab670){return _0x2a79a7(_0x238765[_0xfdd8('0x11')])['then'](function(_0xb628d4){var _0x339bf3=_0xb628d4[_0x46c698];return _0x339bf3;})[_0xfdd8('0xf')](function(_0x31abae){var _0x1a2ce2=_0x238765[_0xfdd8('0x11')]?_0x238765[_0xfdd8('0x11')]['id']:_0xfdd8('0x12');var _0xcd1110=_0x5ab670[_0xfdd8('0x13')];var _0x563095=_0x5ab670[_0xfdd8('0x14')];var _0x501761=new Date(Number(_0x563095));return _0x31abae(_0x1a2ce2,_0x501761,_0x2c5031,_0xcd1110);})[_0xfdd8('0x10')](function(_0x5a4933){fileLogger(_0xfdd8('0xb'))[_0xfdd8('0x15')](_0x5a4933);});};}function setupLoggers(_0x18e7e9){return new Promise(function(_0x599841){var _0x483ab0=new ClientSideLogger();var _0x454f4f=fileLogger(_0xfdd8('0x16'));var _0x2b9396=fileLogger(_0xfdd8('0x17'));_0x18e7e9['set']('client-side-logger',_0x483ab0);_0x18e7e9[_0xfdd8('0x18')](ewinston[_0xfdd8('0x19')]({'winstonInstance':_0x454f4f,'meta':![],'statusLevels':!![],'msg':function(_0x4e3288,_0x341f25){var _0x52080f=_0xfdd8('0x1a');if(!_['isEmpty'](_0x4e3288[_0xfdd8('0x1b')])){_0x52080f+=_0xfdd8('0x1c');var _0x4d6237=_0x4e3288[_0xfdd8('0x1b')];maskSensitiveData(_0x4d6237);}return safeTemplate(util['format'](_0x52080f,_0x4e3288[_0xfdd8('0x1d')],_0x4e3288['headers'][_0xfdd8('0x1e')]?_0x4e3288['headers'][_0xfdd8('0x1e')]:_0x4e3288[_0xfdd8('0x1f')][_0xfdd8('0x20')]||_0x4e3288['ip'],_0x4e3288[_0xfdd8('0x21')],_0x341f25[_0xfdd8('0x22')],_0x341f25['responseTime'],_0x4e3288[_0xfdd8('0x11')]?_0x4e3288[_0xfdd8('0x11')]['id']:null,_0x4e3288[_0xfdd8('0x11')]?_0x4e3288[_0xfdd8('0x11')]['name']:null,_0x4e3288[_0xfdd8('0x11')]?_0x4e3288[_0xfdd8('0x11')][_0xfdd8('0xc')]:null,_0x4d6237?util['inspect'](_0x4d6237,![],null):''));}}));_0x18e7e9['use'](ewinston['logger']({'winstonInstance':_0x2b9396,'meta':![],'statusLevels':!![],'msg':function(_0x588186,_0x4cfc14){var _0x3ec789=_0xfdd8('0x23');if(_0x588186[_0xfdd8('0x1b')]&&_0x588186[_0xfdd8('0x1b')]['device']&&_0x588186[_0xfdd8('0x1b')][_0xfdd8('0x24')]){_0x3ec789='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xfdd8('0x25')](_0x3ec789,_0x588186['method'],_0x588186[_0xfdd8('0x26')]['x-forwarded-for']?_0x588186['headers'][_0xfdd8('0x1e')]:_0x588186['connection'][_0xfdd8('0x20')]||_0x588186['ip'],_0x588186[_0xfdd8('0x21')],_0x4cfc14['statusCode'],_0x4cfc14['responseTime'],_0x588186[_0xfdd8('0x11')]?_0x588186['user']['id']:null,_0x588186[_0xfdd8('0x11')]?_0x588186['user'][_0xfdd8('0xd')]:null,_0x588186[_0xfdd8('0x11')]?_0x588186['user'][_0xfdd8('0xc')]:null,_0x588186['body']&&_0x588186[_0xfdd8('0x1b')][_0xfdd8('0x27')]?_0x588186['body'][_0xfdd8('0x27')]:_0xfdd8('0x28'),_0x588186['body']&&_0x588186[_0xfdd8('0x1b')][_0xfdd8('0x24')]?_0x588186['body'][_0xfdd8('0x24')]:'',_0x588186[_0xfdd8('0x1b')]&&_0x588186[_0xfdd8('0x1b')][_0xfdd8('0x29')]?_0x588186[_0xfdd8('0x1b')][_0xfdd8('0x29')]:'');},'ignoreRoute':function(_0x3ce6d9){var _0x28f618=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x28f618[_0xfdd8('0x2a')](_0x3ce6d9[_0xfdd8('0x21')]);}}));return _0x599841();});}exports[_0xfdd8('0x2b')]=setupLoggers; \ No newline at end of file +var _0x2f8d=['path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','xcally','join','client','role','name','ensureDir','then','catch','log','user','no-user','data','timestamp','error','api','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','responseTime','other','agent_name','test','setupLoggers','express-winston'];(function(_0x24178c,_0x131156){var _0x43dca8=function(_0x5ec762){while(--_0x5ec762){_0x24178c['push'](_0x24178c['shift']());}};_0x43dca8(++_0x131156);}(_0x2f8d,0xbf));var _0xd2f8=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x2f8d[_0x411add];return _0x238242;};var fs=require('fs-extra');var _=require('lodash');var ewinston=require(_0xd2f8('0x0'));var path=require(_0xd2f8('0x1'));var util=require(_0xd2f8('0x2'));var fileLogger=require(_0xd2f8('0x3'))[_0xd2f8('0x4')];var safeTemplate=require(_0xd2f8('0x5'))[_0xd2f8('0x6')];var maskSensitiveData=require(_0xd2f8('0x7'))[_0xd2f8('0x8')];function ClientSideLogger(){function _0x183858(_0x3d23f8){var _0x252d5c=path['join'](_0xd2f8('0x9'),'log',_0xd2f8('0xa'));var _0x49bab7=path[_0xd2f8('0xb')](_0xd2f8('0xc'),_0x3d23f8[_0xd2f8('0xd')]+'-'+_0x3d23f8[_0xd2f8('0xe')]);return fs[_0xd2f8('0xf')](path[_0xd2f8('0xb')](_0x252d5c,_0x49bab7))[_0xd2f8('0x10')](function(){var _0x2b281e=fileLogger('client',path[_0xd2f8('0xb')](_0x252d5c,_0x49bab7));return _0x2b281e;})[_0xd2f8('0x11')](function(_0x15e5bb){throw _0x15e5bb;});}this[_0xd2f8('0x12')]=function(_0x270973,_0x405bde,_0x1c822e,_0x397814){return _0x183858(_0x270973[_0xd2f8('0x13')])[_0xd2f8('0x10')](function(_0x3afe0a){var _0x12d760=_0x3afe0a[_0x405bde];return _0x12d760;})[_0xd2f8('0x10')](function(_0x35203c){var _0x419b93=_0x270973[_0xd2f8('0x13')]?_0x270973['user']['id']:_0xd2f8('0x14');var _0x434da9=_0x397814[_0xd2f8('0x15')];var _0x2a8e8a=_0x397814[_0xd2f8('0x16')];var _0x249fb0=new Date(Number(_0x2a8e8a));return _0x35203c(_0x419b93,_0x249fb0,_0x1c822e,_0x434da9);})['catch'](function(_0xad98ba){fileLogger(_0xd2f8('0xc'))[_0xd2f8('0x17')](_0xad98ba);});};}function setupLoggers(_0x44bd1f){return new Promise(function(_0x438288){var _0x148a25=new ClientSideLogger();var _0x1646c7=fileLogger(_0xd2f8('0x18'));var _0x3c8f5f=fileLogger('auth');_0x44bd1f[_0xd2f8('0x19')]('client-side-logger',_0x148a25);_0x44bd1f[_0xd2f8('0x1a')](ewinston[_0xd2f8('0x1b')]({'winstonInstance':_0x1646c7,'meta':![],'statusLevels':!![],'msg':function(_0x337038,_0x4d3908){var _0x9ce45c=_0xd2f8('0x1c');if(!_[_0xd2f8('0x1d')](_0x337038['body'])){_0x9ce45c+=_0xd2f8('0x1e');var _0x5d8357=_0x337038[_0xd2f8('0x1f')];maskSensitiveData(_0x5d8357);}return safeTemplate(util[_0xd2f8('0x20')](_0x9ce45c,_0x337038[_0xd2f8('0x21')],_0x337038[_0xd2f8('0x22')][_0xd2f8('0x23')]?_0x337038[_0xd2f8('0x22')][_0xd2f8('0x23')]:_0x337038[_0xd2f8('0x24')][_0xd2f8('0x25')]||_0x337038['ip'],_0x337038[_0xd2f8('0x26')],_0x4d3908[_0xd2f8('0x27')],_0x4d3908['responseTime'],_0x337038[_0xd2f8('0x13')]?_0x337038[_0xd2f8('0x13')]['id']:null,_0x337038[_0xd2f8('0x13')]?_0x337038[_0xd2f8('0x13')][_0xd2f8('0xe')]:null,_0x337038[_0xd2f8('0x13')]?_0x337038['user'][_0xd2f8('0xd')]:null,_0x5d8357?util['inspect'](_0x5d8357,![],null):''));}}));_0x44bd1f[_0xd2f8('0x1a')](ewinston[_0xd2f8('0x1b')]({'winstonInstance':_0x3c8f5f,'meta':![],'statusLevels':!![],'msg':function(_0x2b1337,_0x66d956){var _0x46ed62=_0xd2f8('0x28');if(_0x2b1337['body']&&_0x2b1337[_0xd2f8('0x1f')][_0xd2f8('0x29')]&&_0x2b1337[_0xd2f8('0x1f')][_0xd2f8('0x2a')]){_0x46ed62='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xd2f8('0x20')](_0x46ed62,_0x2b1337[_0xd2f8('0x21')],_0x2b1337['headers'][_0xd2f8('0x23')]?_0x2b1337['headers'][_0xd2f8('0x23')]:_0x2b1337['connection'][_0xd2f8('0x25')]||_0x2b1337['ip'],_0x2b1337[_0xd2f8('0x26')],_0x66d956[_0xd2f8('0x27')],_0x66d956[_0xd2f8('0x2b')],_0x2b1337[_0xd2f8('0x13')]?_0x2b1337[_0xd2f8('0x13')]['id']:null,_0x2b1337[_0xd2f8('0x13')]?_0x2b1337[_0xd2f8('0x13')]['name']:null,_0x2b1337['user']?_0x2b1337['user'][_0xd2f8('0xd')]:null,_0x2b1337[_0xd2f8('0x1f')]&&_0x2b1337['body'][_0xd2f8('0x29')]?_0x2b1337[_0xd2f8('0x1f')][_0xd2f8('0x29')]:_0xd2f8('0x2c'),_0x2b1337[_0xd2f8('0x1f')]&&_0x2b1337[_0xd2f8('0x1f')][_0xd2f8('0x2a')]?_0x2b1337['body']['agent_id']:'',_0x2b1337[_0xd2f8('0x1f')]&&_0x2b1337[_0xd2f8('0x1f')][_0xd2f8('0x2d')]?_0x2b1337[_0xd2f8('0x1f')][_0xd2f8('0x2d')]:'');},'ignoreRoute':function(_0x3c85e3){var _0x5c3058=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5c3058[_0xd2f8('0x2e')](_0x3c85e3[_0xd2f8('0x26')]);}}));return _0x438288();});}exports[_0xd2f8('0x2f')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 46a7b13..cae376b 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2da7=['consoleLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','white','bold\x20white','gray','bold\x20blue','addColors','/var/log/xcally','join','format','%s-%s.log','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','warn','File','%s-%s','error','Console'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x2da7,0x17d));var _0x72da=function(_0x16cef7,_0x30c9b9){_0x16cef7=_0x16cef7-0x0;var _0x2845be=_0x2da7[_0x16cef7];return _0x2845be;};'use strict';var path=require(_0x72da('0x0'));var util=require(_0x72da('0x1'));var moment=require(_0x72da('0x2'));var winston=require(_0x72da('0x3'));var config=require(_0x72da('0x4'));var debugLevel=config[_0x72da('0x5')]?config['debugLevel'][_0x72da('0x6')]():_0x72da('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x72da('0x8'),'error':'red','warn':'bold\x20yellow','info':_0x72da('0x9'),'print':_0x72da('0xa'),'success':'bold\x20green','http':_0x72da('0xb'),'verbose':'bold\x20magenta','debug':_0x72da('0xc'),'silly':'bold\x20cyan'};winston[_0x72da('0xd')](XC_LOG_COLORS);function getLogFileName(_0x3e8d68,_0x58d3b1,_0x53c09c){var _0xa26aed=_0x3e8d68||_0x72da('0xe');return path[_0x72da('0xf')](_0xa26aed,util[_0x72da('0x10')](_0x72da('0x11'),_0x58d3b1,_0x53c09c));}function formatter(_0x56d1d8,_0x2dadb5){_0x2dadb5['message']=_0x2dadb5[_0x72da('0x12')]['replace'](/@@{/g,_0x72da('0x13'))[_0x72da('0x14')](/}@@/g,_0x72da('0x15'))[_0x72da('0x14')](/@{/g,'{{')[_0x72da('0x14')](/}@/g,'}}');return util[_0x72da('0x10')](_0x72da('0x16'),moment()[_0x72da('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),_0x2dadb5['level'][_0x72da('0x17')](),_0x56d1d8,_0x2dadb5[_0x72da('0x12')]);}function fileFormat(_0x2ea0aa,_0x1e949d){_0x1e949d[_0x72da('0x12')]=_0x1e949d[_0x72da('0x12')][_0x72da('0x14')](/@@{/g,_0x72da('0x13'))[_0x72da('0x14')](/}@@/g,_0x72da('0x15'))[_0x72da('0x14')](/@{/g,'{{')[_0x72da('0x14')](/}@/g,'}}');var _0x5c05e7=_0x1e949d[_0x72da('0x18')]&&Object[_0x72da('0x19')](_0x1e949d['meta'])[_0x72da('0x1a')]?'\x0a\x09'+JSON[_0x72da('0x1b')](_0x1e949d['meta']):'';return util[_0x72da('0x10')](_0x72da('0x1c'),moment()[_0x72da('0x10')](_0x72da('0x1d')),_0x1e949d['level']['toUpperCase'](),_0x2ea0aa,_0x1e949d[_0x72da('0x12')],_0x5c05e7);}function consoleLogger(){var _0xcb79d0=new winston[(_0x72da('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x72da('0x1f'))]['Console']({'level':_0x72da('0x20'),'json':![],'formatter':function(_0x3a8b36){return formatter('',_0x3a8b36);}})]});return _0xcb79d0;}function fileLogger(_0x5694ef,_0x1fb074){var _0x484ce7=new winston[(_0x72da('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x72da('0x21'))]({'name':util[_0x72da('0x10')](_0x72da('0x22'),_0x5694ef,'error'),'filename':getLogFileName(_0x1fb074,_0x5694ef,_0x72da('0x23')),'level':_0x72da('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4d58d8){return fileFormat(_0x5694ef,_0x4d58d8);}}),new winston[(_0x72da('0x1f'))][(_0x72da('0x21'))]({'name':util['format'](_0x72da('0x22'),_0x5694ef,debugLevel),'filename':getLogFileName(_0x1fb074,_0x5694ef,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4cc9cb){return fileFormat(_0x5694ef,_0x4cc9cb);}}),new winston[(_0x72da('0x1f'))][(_0x72da('0x24'))]({'level':_0x72da('0x20'),'json':![],'formatter':function(_0x3f53a7){return fileFormat(_0x5694ef,_0x3f53a7);}})]});return _0x484ce7;}exports[_0x72da('0x25')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0xd5df=['format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','transports','Console','warn','File','error','%s-%s','consoleLogger','fileLogger','path','util','../config/environment','debugLevel','info','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors'];(function(_0x18fe19,_0x42829a){var _0x46ddaf=function(_0x331e7d){while(--_0x331e7d){_0x18fe19['push'](_0x18fe19['shift']());}};_0x46ddaf(++_0x42829a);}(_0xd5df,0x15a));var _0xfd5d=function(_0x3306cd,_0x4970db){_0x3306cd=_0x3306cd-0x0;var _0x428c82=_0xd5df[_0x3306cd];return _0x428c82;};'use strict';var path=require(_0xfd5d('0x0'));var util=require(_0xfd5d('0x1'));var moment=require('moment');var winston=require('winston');var config=require(_0xfd5d('0x2'));var debugLevel=config[_0xfd5d('0x3')]?config[_0xfd5d('0x3')]['toLowerCase']():_0xfd5d('0x4');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':_0xfd5d('0x5'),'warn':_0xfd5d('0x6'),'info':'white','print':_0xfd5d('0x7'),'success':_0xfd5d('0x8'),'http':_0xfd5d('0x9'),'verbose':_0xfd5d('0xa'),'debug':_0xfd5d('0xb'),'silly':_0xfd5d('0xc')};winston[_0xfd5d('0xd')](XC_LOG_COLORS);function getLogFileName(_0x1717d9,_0x562d7f,_0x3e28d7){var _0x3f449b=_0x1717d9||'/var/log/xcally';return path['join'](_0x3f449b,util[_0xfd5d('0xe')]('%s-%s.log',_0x562d7f,_0x3e28d7));}function formatter(_0x11e66e,_0x3860d4){_0x3860d4[_0xfd5d('0xf')]=_0x3860d4[_0xfd5d('0xf')][_0xfd5d('0x10')](/@@{/g,_0xfd5d('0x11'))['replace'](/}@@/g,_0xfd5d('0x12'))[_0xfd5d('0x10')](/@{/g,'{{')[_0xfd5d('0x10')](/}@/g,'}}');return util[_0xfd5d('0xe')](_0xfd5d('0x13'),moment()['format'](_0xfd5d('0x14')),_0x3860d4[_0xfd5d('0x15')]['toUpperCase'](),_0x11e66e,_0x3860d4['message']);}function fileFormat(_0x2e3ed1,_0x21ec05){_0x21ec05[_0xfd5d('0xf')]=_0x21ec05[_0xfd5d('0xf')][_0xfd5d('0x10')](/@@{/g,_0xfd5d('0x11'))[_0xfd5d('0x10')](/}@@/g,'}}}')[_0xfd5d('0x10')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0xbbec57=_0x21ec05[_0xfd5d('0x16')]&&Object[_0xfd5d('0x17')](_0x21ec05['meta'])[_0xfd5d('0x18')]?'\x0a\x09'+JSON['stringify'](_0x21ec05[_0xfd5d('0x16')]):'';return util[_0xfd5d('0xe')](_0xfd5d('0x19'),moment()[_0xfd5d('0xe')](_0xfd5d('0x14')),_0x21ec05[_0xfd5d('0x15')][_0xfd5d('0x1a')](),_0x2e3ed1,_0x21ec05[_0xfd5d('0xf')],_0xbbec57);}function consoleLogger(){var _0x3cdd32=new winston[(_0xfd5d('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xfd5d('0x1c'))][(_0xfd5d('0x1d'))]({'level':_0xfd5d('0x1e'),'json':![],'formatter':function(_0x166af1){return formatter('',_0x166af1);}})]});return _0x3cdd32;}function fileLogger(_0x3a9ecc,_0x5483c7){var _0x16b642=new winston[(_0xfd5d('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xfd5d('0x1c'))][(_0xfd5d('0x1f'))]({'name':util[_0xfd5d('0xe')]('%s-%s',_0x3a9ecc,'error'),'filename':getLogFileName(_0x5483c7,_0x3a9ecc,_0xfd5d('0x20')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5d1cc7){return fileFormat(_0x3a9ecc,_0x5d1cc7);}}),new winston['transports'][(_0xfd5d('0x1f'))]({'name':util['format'](_0xfd5d('0x21'),_0x3a9ecc,debugLevel),'filename':getLogFileName(_0x5483c7,_0x3a9ecc,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x144eb3){return fileFormat(_0x3a9ecc,_0x144eb3);}}),new winston[(_0xfd5d('0x1c'))][(_0xfd5d('0x1d'))]({'level':_0xfd5d('0x1e'),'json':![],'formatter':function(_0x37195d){return fileFormat(_0x3a9ecc,_0x37195d);}})]});return _0x16b642;}exports[_0xfd5d('0x22')]=consoleLogger;exports[_0xfd5d('0x23')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index c8c54e8..86247cc 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0x0295,0x1f0));var _0x5029=function(_0x2d489a,_0x25ce3c){_0x2d489a=_0x2d489a-0x0;var _0x11b301=_0x0295[_0x2d489a];return _0x11b301;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x5f66=['consumerSecret','membername','calleridname','exten','privateKey','secretaccesskey','user','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','length','isPlainObject','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','lastName','street','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','consumerKey'];(function(_0x1d8617,_0x480b56){var _0x5e7946=function(_0x22e9f1){while(--_0x22e9f1){_0x1d8617['push'](_0x1d8617['shift']());}};_0x5e7946(++_0x480b56);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};var _=require('lodash');var sensitiveFields=[_0x65f6('0x0'),'password',_0x65f6('0x1'),_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'phone',_0x65f6('0x6'),'fax',_0x65f6('0x7'),_0x65f6('0x8'),'clientSecret','securityToken',_0x65f6('0x9'),_0x65f6('0xa'),_0x65f6('0xb'),_0x65f6('0xc'),_0x65f6('0xd'),_0x65f6('0xe'),'accessTokenSecret','authToken',_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0x12'),'calleridnum',_0x65f6('0x13'),'vidaooApiKey','clientEmail',_0x65f6('0x14'),'accesskeyid',_0x65f6('0x15'),'key',_0x65f6('0x16'),_0x65f6('0x17'),_0x65f6('0x18'),_0x65f6('0x19'),_0x65f6('0x1a'),_0x65f6('0x1b'),_0x65f6('0x1c'),_0x65f6('0x1d')];function maskSensitiveData(_0x46dbc6){const _0x3440af=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x46dbc6)){for(const _0x19b9ff in _0x46dbc6){if(_['isArray'](_0x46dbc6[_0x19b9ff])){for(let _0x5dd324=0x0;_0x5dd324<_0x46dbc6[_0x19b9ff][_0x65f6('0x1e')];_0x5dd324++){maskSensitiveData(_0x46dbc6[_0x19b9ff][_0x5dd324]);}}else if(_[_0x65f6('0x1f')](_0x46dbc6[_0x19b9ff])){maskSensitiveData(_0x46dbc6[_0x19b9ff]);}else if(_[_0x65f6('0x20')](_0x46dbc6[_0x19b9ff])){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](/{{{/g,_0x65f6('0x22'))[_0x65f6('0x21')](/}}}/g,_0x65f6('0x23'))[_0x65f6('0x21')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x19b9ff)){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](_0x3440af,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 1ea9770..3ff7f4d 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 _0xb10b=['safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','reduce','exports'];(function(_0x10ee24,_0xb203e5){var _0x36007e=function(_0x2faaf9){while(--_0x2faaf9){_0x10ee24['push'](_0x10ee24['shift']());}};_0x36007e(++_0xb203e5);}(_0xb10b,0x12a));var _0xbb10=function(_0x57a670,_0x30e402){_0x57a670=_0x57a670-0x0;var _0x41ce21=_0xb10b[_0x57a670];return _0x41ce21;};var _=require(_0xbb10('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4bb7bb){return _0x4bb7bb==='{{'?_0xbb10('0x1'):_0xbb10('0x2');}function safeTemplate(_0x1dcb08){var _0x4d688c=_0x1dcb08;if(typeof _0x1dcb08===_0xbb10('0x3')){_0x4d688c=_0x1dcb08[_0xbb10('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xbb10('0x5')](_0x1dcb08)){_0x4d688c=_0x1dcb08[_0xbb10('0x6')](function(_0x49baf4){return safeTemplate(_0x49baf4);});}else if(_[_0xbb10('0x7')](_0x1dcb08)){_0x4d688c=Object['keys'](_0x1dcb08)[_0xbb10('0x8')](function(_0x3cdd53,_0x513741){_0x3cdd53[_0x513741]=safeTemplate(_0x1dcb08[_0x513741]);return _0x3cdd53;},{});}return _0x4d688c;}module[_0xbb10('0x9')][_0xbb10('0xa')]=safeTemplate; \ No newline at end of file +var _0x1775=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x3faf51,_0x4535f3){var _0x4685b7=function(_0x4c1839){while(--_0x4c1839){_0x3faf51['push'](_0x3faf51['shift']());}};_0x4685b7(++_0x4535f3);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0xb5c9b1){return _0xb5c9b1==='{{'?_0x5177('0x0'):_0x5177('0x1');}function safeTemplate(_0x2ca33b){var _0xaad33e=_0x2ca33b;if(typeof _0x2ca33b===_0x5177('0x2')){_0xaad33e=_0x2ca33b[_0x5177('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x5177('0x4')](_0x2ca33b)){_0xaad33e=_0x2ca33b[_0x5177('0x5')](function(_0x51275f){return safeTemplate(_0x51275f);});}else if(_[_0x5177('0x6')](_0x2ca33b)){_0xaad33e=Object[_0x5177('0x7')](_0x2ca33b)[_0x5177('0x8')](function(_0x2ac1c6,_0x300b43){_0x2ac1c6[_0x300b43]=safeTemplate(_0x2ca33b[_0x300b43]);return _0x2ac1c6;},{});}return _0xaad33e;}module[_0x5177('0x9')][_0x5177('0xa')]=safeTemplate; \ No newline at end of file